aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>1997-04-11 20:40:28 +0000
committer(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>1997-04-11 20:40:28 +0000
commit529e17e045db5e5033ab4385c56d3884b9d5fbeb (patch)
tree8ab22e50bbb181bc413bcd3776e1115fabd1acd6
parenta9cad11e0bd142bec65584bd46700580e48cfe9e (diff)
This commit was manufactured by cvs2svn to create tag 'release-1-0'.release-1-0
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/release-1-0@13856 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/Makefile.in2669
-rw-r--r--gcc/NEWS797
-rw-r--r--gcc/PROBLEMS117
-rw-r--r--gcc/PROJECTS448
-rw-r--r--gcc/README-fixinc9
-rw-r--r--gcc/README.ACORN18
-rw-r--r--gcc/README.ALTOS55
-rw-r--r--gcc/README.APOLLO112
-rw-r--r--gcc/README.DWARF574
-rw-r--r--gcc/README.FRESCO17
-rw-r--r--gcc/README.NS32K130
-rw-r--r--gcc/README.RS6000111
-rw-r--r--gcc/README.TRAD55
-rw-r--r--gcc/README.X11447
-rw-r--r--gcc/alloca.c504
-rw-r--r--gcc/assert.h54
-rw-r--r--gcc/basic-block.h69
-rw-r--r--gcc/bc-emit.c1018
-rw-r--r--gcc/bc-emit.h133
-rw-r--r--gcc/bc-optab.c798
-rw-r--r--gcc/bc-optab.h75
-rw-r--r--gcc/bc-typecd.def21
-rw-r--r--gcc/bc-typecd.h54
-rw-r--r--gcc/bi-arity.c91
-rw-r--r--gcc/bi-defs.h48
-rw-r--r--gcc/bi-lexer.c167
-rw-r--r--gcc/bi-opcode.c89
-rw-r--r--gcc/bi-opname.c70
-rw-r--r--gcc/bi-parser.y169
-rw-r--r--gcc/bi-reverse.c61
-rw-r--r--gcc/bi-run.h159
-rw-r--r--gcc/build-make35
-rw-r--r--gcc/bytecode.def322
-rw-r--r--gcc/bytecode.h82
-rw-r--r--gcc/bytetypes.h35
-rw-r--r--gcc/c-aux-info.c644
-rw-r--r--gcc/c-common.c2537
-rw-r--r--gcc/c-convert.c96
-rw-r--r--gcc/c-decl.c7177
-rw-r--r--gcc/c-iterate.c599
-rw-r--r--gcc/c-lang.c181
-rw-r--r--gcc/c-lex.c2016
-rw-r--r--gcc/c-lex.h80
-rw-r--r--gcc/c-parse.gperf84
-rw-r--r--gcc/c-parse.in3017
-rw-r--r--gcc/c-pragma.c169
-rw-r--r--gcc/c-pragma.h46
-rw-r--r--gcc/c-tree.h510
-rw-r--r--gcc/c-typeck.c6658
-rw-r--r--gcc/caller-save.c771
-rw-r--r--gcc/calls.c3212
-rw-r--r--gcc/cccp.c10338
-rw-r--r--gcc/cexp.y1213
-rw-r--r--gcc/choose-temp.c147
-rw-r--r--gcc/collect2.c3358
-rw-r--r--gcc/combine.c11519
-rw-r--r--gcc/conditions.h118
-rw-r--r--gcc/config/1750a/1750a.c749
-rw-r--r--gcc/config/1750a/1750a.h1323
-rw-r--r--gcc/config/1750a/1750a.md1359
-rw-r--r--gcc/config/1750a/ms1750.inc114
-rw-r--r--gcc/config/1750a/xm-1750a.h23
-rw-r--r--gcc/config/README5
-rw-r--r--gcc/config/a29k/a29k.c1536
-rw-r--r--gcc/config/a29k/a29k.h1666
-rw-r--r--gcc/config/a29k/a29k.md2874
-rw-r--r--gcc/config/a29k/t-a29k5
-rw-r--r--gcc/config/a29k/t-a29kbare19
-rw-r--r--gcc/config/a29k/t-vx29k17
-rw-r--r--gcc/config/a29k/udi.h94
-rw-r--r--gcc/config/a29k/unix.h92
-rw-r--r--gcc/config/a29k/vx29k.h46
-rw-r--r--gcc/config/a29k/x-unix2
-rw-r--r--gcc/config/a29k/xm-a29k.h41
-rw-r--r--gcc/config/alpha/alpha.c3172
-rw-r--r--gcc/config/alpha/alpha.h2296
-rw-r--r--gcc/config/alpha/alpha.md4414
-rw-r--r--gcc/config/alpha/config-nt.sed33
-rw-r--r--gcc/config/alpha/elf.h496
-rw-r--r--gcc/config/alpha/linux.h95
-rw-r--r--gcc/config/alpha/osf12.h33
-rw-r--r--gcc/config/alpha/osf2or3.h24
-rw-r--r--gcc/config/alpha/t-vms6
-rw-r--r--gcc/config/alpha/vms.h377
-rw-r--r--gcc/config/alpha/win-nt.h72
-rw-r--r--gcc/config/alpha/x-alpha1
-rw-r--r--gcc/config/alpha/xm-alpha.h78
-rw-r--r--gcc/config/alpha/xm-vms.h86
-rw-r--r--gcc/config/alpha/xm-winnt.h32
-rw-r--r--gcc/config/aoutos.h88
-rw-r--r--gcc/config/arm/aof.h439
-rw-r--r--gcc/config/arm/aout.h262
-rw-r--r--gcc/config/arm/arm.c5518
-rw-r--r--gcc/config/arm/arm.h1739
-rw-r--r--gcc/config/arm/arm.md6068
-rw-r--r--gcc/config/arm/coff.h209
-rw-r--r--gcc/config/arm/lib1funcs.asm404
-rw-r--r--gcc/config/arm/riscix.h134
-rw-r--r--gcc/config/arm/riscix1-1.h92
-rw-r--r--gcc/config/arm/rix-gas.h43
-rw-r--r--gcc/config/arm/semi.h55
-rw-r--r--gcc/config/arm/semiaof.h52
-rw-r--r--gcc/config/arm/t-bare30
-rw-r--r--gcc/config/arm/t-riscix3
-rw-r--r--gcc/config/arm/t-semi10
-rw-r--r--gcc/config/arm/t-semiaof63
-rw-r--r--gcc/config/arm/x-riscix9
-rw-r--r--gcc/config/arm/xm-arm.h74
-rw-r--r--gcc/config/clipper/clipper.c474
-rw-r--r--gcc/config/clipper/clipper.h1122
-rw-r--r--gcc/config/clipper/clipper.md1423
-rw-r--r--gcc/config/clipper/clix.h160
-rw-r--r--gcc/config/clipper/x-clix1
-rw-r--r--gcc/config/clipper/xm-clix.h39
-rw-r--r--gcc/config/convex/convex.c677
-rw-r--r--gcc/config/convex/convex.h1502
-rw-r--r--gcc/config/convex/convex.md1885
-rw-r--r--gcc/config/convex/fixinc.convex416
-rw-r--r--gcc/config/convex/x-convex5
-rw-r--r--gcc/config/convex/xm-convex.h53
-rw-r--r--gcc/config/dbx.h30
-rw-r--r--gcc/config/dbxcoff.h83
-rw-r--r--gcc/config/dsp16xx/dsp16xx.c2226
-rw-r--r--gcc/config/dsp16xx/dsp16xx.h1980
-rw-r--r--gcc/config/dsp16xx/dsp16xx.md2181
-rw-r--r--gcc/config/dsp16xx/xm-dsp16xx.h46
-rw-r--r--gcc/config/elxsi/elxsi.c127
-rw-r--r--gcc/config/elxsi/elxsi.h966
-rw-r--r--gcc/config/elxsi/elxsi.md1420
-rw-r--r--gcc/config/elxsi/x-elxsi9
-rw-r--r--gcc/config/elxsi/xm-elxsi.h38
-rw-r--r--gcc/config/float-i32.h96
-rw-r--r--gcc/config/float-i64.h96
-rw-r--r--gcc/config/float-sh.h130
-rw-r--r--gcc/config/float-vax.h96
-rw-r--r--gcc/config/fp-bit.c1406
-rw-r--r--gcc/config/fx80/fx80.c300
-rw-r--r--gcc/config/fx80/fx80.h1445
-rw-r--r--gcc/config/fx80/fx80.md2522
-rw-r--r--gcc/config/fx80/xm-fx80.h39
-rw-r--r--gcc/config/gmicro/gmicro.c984
-rw-r--r--gcc/config/gmicro/gmicro.h1588
-rw-r--r--gcc/config/gmicro/gmicro.md2740
-rw-r--r--gcc/config/gnu.h30
-rw-r--r--gcc/config/gofast.h96
-rw-r--r--gcc/config/h8300/h8300.c3092
-rw-r--r--gcc/config/h8300/h8300.h1406
-rw-r--r--gcc/config/h8300/h8300.md2300
-rw-r--r--gcc/config/h8300/lib1funcs.asm781
-rw-r--r--gcc/config/h8300/t-h830026
-rw-r--r--gcc/config/h8300/xm-h8300.h46
-rw-r--r--gcc/config/i370/i370.c482
-rw-r--r--gcc/config/i370/i370.h1543
-rw-r--r--gcc/config/i370/i370.md4215
-rw-r--r--gcc/config/i370/t-i3704
-rw-r--r--gcc/config/i370/xm-i370.h57
-rw-r--r--gcc/config/i386/386bsd.h76
-rw-r--r--gcc/config/i386/aix386.h69
-rw-r--r--gcc/config/i386/aix386ng.h142
-rw-r--r--gcc/config/i386/att.h93
-rw-r--r--gcc/config/i386/bsd.h130
-rw-r--r--gcc/config/i386/bsd386.h18
-rw-r--r--gcc/config/i386/config-nt.sed38
-rw-r--r--gcc/config/i386/cygwin32.asm32
-rw-r--r--gcc/config/i386/cygwin32.h175
-rw-r--r--gcc/config/i386/dgux.c191
-rw-r--r--gcc/config/i386/dgux.h283
-rw-r--r--gcc/config/i386/freebsd-elf.h187
-rw-r--r--gcc/config/i386/freebsd.h245
-rw-r--r--gcc/config/i386/gas.h162
-rw-r--r--gcc/config/i386/gmon-sol2.c402
-rw-r--r--gcc/config/i386/gnu.h19
-rw-r--r--gcc/config/i386/go32-rtems.h32
-rw-r--r--gcc/config/i386/go32.h127
-rw-r--r--gcc/config/i386/gstabs.h9
-rw-r--r--gcc/config/i386/i386-aout.h34
-rw-r--r--gcc/config/i386/i386-coff.h97
-rw-r--r--gcc/config/i386/i386.c4904
-rw-r--r--gcc/config/i386/i386.h2727
-rw-r--r--gcc/config/i386/i386.md7572
-rw-r--r--gcc/config/i386/isc.h89
-rw-r--r--gcc/config/i386/isccoff.h12
-rw-r--r--gcc/config/i386/iscdbx.h43
-rw-r--r--gcc/config/i386/linux-aout.h72
-rw-r--r--gcc/config/i386/linux-oldld.h72
-rw-r--r--gcc/config/i386/linux.h200
-rw-r--r--gcc/config/i386/lynx-ng.h37
-rw-r--r--gcc/config/i386/lynx.h39
-rw-r--r--gcc/config/i386/mach.h20
-rw-r--r--gcc/config/i386/moss.h34
-rw-r--r--gcc/config/i386/netbsd.h73
-rw-r--r--gcc/config/i386/next.h226
-rw-r--r--gcc/config/i386/os2.h76
-rw-r--r--gcc/config/i386/osfelf.h79
-rw-r--r--gcc/config/i386/osfrose.h920
-rw-r--r--gcc/config/i386/perform.h98
-rw-r--r--gcc/config/i386/ptx4-i.h247
-rw-r--r--gcc/config/i386/rtems.h31
-rw-r--r--gcc/config/i386/sco.h117
-rw-r--r--gcc/config/i386/sco4.h86
-rw-r--r--gcc/config/i386/sco4dbx.h81
-rw-r--r--gcc/config/i386/sco5.h920
-rw-r--r--gcc/config/i386/scodbx.h92
-rw-r--r--gcc/config/i386/seq-gas.h46
-rw-r--r--gcc/config/i386/seq-sysv3.h42
-rw-r--r--gcc/config/i386/seq2-sysv3.h8
-rw-r--r--gcc/config/i386/sequent.h152
-rw-r--r--gcc/config/i386/sol2-c1.asm156
-rw-r--r--gcc/config/i386/sol2-ci.asm51
-rw-r--r--gcc/config/i386/sol2-cn.asm46
-rw-r--r--gcc/config/i386/sol2-gc1.asm160
-rw-r--r--gcc/config/i386/sol2.h92
-rw-r--r--gcc/config/i386/sol2dbg.h16
-rw-r--r--gcc/config/i386/sun.h83
-rw-r--r--gcc/config/i386/sun386.h142
-rw-r--r--gcc/config/i386/svr3.ifile48
-rw-r--r--gcc/config/i386/svr3dbx.h86
-rw-r--r--gcc/config/i386/svr3gas.h293
-rw-r--r--gcc/config/i386/svr3z.ifile48
-rw-r--r--gcc/config/i386/sysv3.h124
-rw-r--r--gcc/config/i386/sysv4.h253
-rw-r--r--gcc/config/i386/t-crtpic10
-rw-r--r--gcc/config/i386/t-crtstuff2
-rw-r--r--gcc/config/i386/t-cygwin327
-rw-r--r--gcc/config/i386/t-dgux4
-rw-r--r--gcc/config/i386/t-go322
-rw-r--r--gcc/config/i386/t-i386bare3
-rw-r--r--gcc/config/i386/t-next9
-rw-r--r--gcc/config/i386/t-osf2
-rw-r--r--gcc/config/i386/t-sco591
-rw-r--r--gcc/config/i386/t-sol235
-rw-r--r--gcc/config/i386/t-svr3dbx7
-rw-r--r--gcc/config/i386/t-vsta2
-rw-r--r--gcc/config/i386/t-winnt6
-rw-r--r--gcc/config/i386/unix.h193
-rw-r--r--gcc/config/i386/v3gas.h80
-rw-r--r--gcc/config/i386/vsta.h78
-rw-r--r--gcc/config/i386/win-nt.h152
-rw-r--r--gcc/config/i386/winnt.c66
-rw-r--r--gcc/config/i386/x-aix12
-rw-r--r--gcc/config/i386/x-cygwin324
-rw-r--r--gcc/config/i386/x-dgux11
-rw-r--r--gcc/config/i386/x-isc3
-rw-r--r--gcc/config/i386/x-isc34
-rw-r--r--gcc/config/i386/x-ncr300034
-rw-r--r--gcc/config/i386/x-next3
-rw-r--r--gcc/config/i386/x-osfrose28
-rw-r--r--gcc/config/i386/x-sco7
-rw-r--r--gcc/config/i386/x-sco410
-rw-r--r--gcc/config/i386/x-sco59
-rw-r--r--gcc/config/i386/x-sysv31
-rw-r--r--gcc/config/i386/x-vsta1
-rw-r--r--gcc/config/i386/xm-aix.h37
-rw-r--r--gcc/config/i386/xm-cygwin32.h29
-rw-r--r--gcc/config/i386/xm-dos.h20
-rw-r--r--gcc/config/i386/xm-go32.h28
-rw-r--r--gcc/config/i386/xm-i386.h43
-rw-r--r--gcc/config/i386/xm-isc.h6
-rw-r--r--gcc/config/i386/xm-lynx.h33
-rw-r--r--gcc/config/i386/xm-next.h5
-rw-r--r--gcc/config/i386/xm-os2.h57
-rw-r--r--gcc/config/i386/xm-osf.h32
-rw-r--r--gcc/config/i386/xm-sco.h25
-rw-r--r--gcc/config/i386/xm-sco5.h8
-rw-r--r--gcc/config/i386/xm-sysv4.h16
-rw-r--r--gcc/config/i386/xm-vsta.h26
-rw-r--r--gcc/config/i860/bsd-gas.h2
-rw-r--r--gcc/config/i860/bsd.h44
-rw-r--r--gcc/config/i860/fx2800.h356
-rw-r--r--gcc/config/i860/i860.c2097
-rw-r--r--gcc/config/i860/i860.h1431
-rw-r--r--gcc/config/i860/i860.md2318
-rw-r--r--gcc/config/i860/mach.h14
-rw-r--r--gcc/config/i860/paragon.h236
-rw-r--r--gcc/config/i860/sysv3.h174
-rw-r--r--gcc/config/i860/sysv4.h193
-rw-r--r--gcc/config/i860/t-fx28003
-rw-r--r--gcc/config/i860/x-fx28007
-rw-r--r--gcc/config/i860/x-sysv31
-rw-r--r--gcc/config/i860/x-sysv444
-rw-r--r--gcc/config/i860/xm-i860.h43
-rw-r--r--gcc/config/i960/i960-coff.h101
-rw-r--r--gcc/config/i960/i960.c2617
-rw-r--r--gcc/config/i960/i960.h1540
-rw-r--r--gcc/config/i960/i960.md2673
-rw-r--r--gcc/config/i960/rtems.h31
-rw-r--r--gcc/config/i960/t-960bare24
-rw-r--r--gcc/config/i960/t-vxworks96027
-rw-r--r--gcc/config/i960/vx960-coff.h66
-rw-r--r--gcc/config/i960/vx960.h30
-rw-r--r--gcc/config/i960/xm-i960.h43
-rw-r--r--gcc/config/libgloss.h35
-rw-r--r--gcc/config/linux-aout.h48
-rw-r--r--gcc/config/linux.h102
-rw-r--r--gcc/config/lynx-ng.h118
-rw-r--r--gcc/config/lynx.h179
-rw-r--r--gcc/config/m32r/initfini.c169
-rw-r--r--gcc/config/m32r/m32r.c1815
-rw-r--r--gcc/config/m32r/m32r.h1871
-rw-r--r--gcc/config/m32r/m32r.md1421
-rw-r--r--gcc/config/m32r/t-m32r57
-rw-r--r--gcc/config/m32r/xm-m32r.h47
-rw-r--r--gcc/config/m68k/3b1.h513
-rw-r--r--gcc/config/m68k/3b1g.h64
-rw-r--r--gcc/config/m68k/a-ux.h206
-rw-r--r--gcc/config/m68k/altos3068.h135
-rw-r--r--gcc/config/m68k/amix.h149
-rw-r--r--gcc/config/m68k/apollo68.h208
-rw-r--r--gcc/config/m68k/atari.h106
-rw-r--r--gcc/config/m68k/aux-crt1.c134
-rw-r--r--gcc/config/m68k/aux-crt2.asm42
-rw-r--r--gcc/config/m68k/aux-crtn.asm26
-rw-r--r--gcc/config/m68k/aux-exit.c99
-rw-r--r--gcc/config/m68k/aux-low.gld38
-rw-r--r--gcc/config/m68k/aux-mcount.c69
-rw-r--r--gcc/config/m68k/auxas.h189
-rw-r--r--gcc/config/m68k/auxgas.h56
-rw-r--r--gcc/config/m68k/auxgld.h29
-rw-r--r--gcc/config/m68k/auxld.h35
-rw-r--r--gcc/config/m68k/ccur-GAS.h129
-rw-r--r--gcc/config/m68k/coff.h176
-rw-r--r--gcc/config/m68k/crds.h621
-rw-r--r--gcc/config/m68k/ctix.h48
-rw-r--r--gcc/config/m68k/dpx2.h822
-rw-r--r--gcc/config/m68k/dpx2.ifile55
-rw-r--r--gcc/config/m68k/dpx2cdbx.h31
-rw-r--r--gcc/config/m68k/dpx2g.h71
-rw-r--r--gcc/config/m68k/fpgnulib.c442
-rw-r--r--gcc/config/m68k/hp2bsd.h78
-rw-r--r--gcc/config/m68k/hp310.h36
-rw-r--r--gcc/config/m68k/hp310g.h12
-rw-r--r--gcc/config/m68k/hp320.h642
-rw-r--r--gcc/config/m68k/hp320g.h12
-rw-r--r--gcc/config/m68k/hp3bsd.h44
-rw-r--r--gcc/config/m68k/hp3bsd44.h53
-rw-r--r--gcc/config/m68k/hpux7.h7
-rw-r--r--gcc/config/m68k/isi-nfp.h9
-rw-r--r--gcc/config/m68k/isi.h91
-rw-r--r--gcc/config/m68k/lb1sf68.asm3904
-rw-r--r--gcc/config/m68k/linux-aout.h75
-rw-r--r--gcc/config/m68k/linux.h387
-rw-r--r--gcc/config/m68k/lynx-ng.h43
-rw-r--r--gcc/config/m68k/lynx.h74
-rw-r--r--gcc/config/m68k/m68k-aout.h44
-rw-r--r--gcc/config/m68k/m68k-coff.h28
-rw-r--r--gcc/config/m68k/m68k-none.h198
-rw-r--r--gcc/config/m68k/m68k-psos.h67
-rw-r--r--gcc/config/m68k/m68k.c3017
-rw-r--r--gcc/config/m68k/m68k.h2107
-rw-r--r--gcc/config/m68k/m68k.md7415
-rw-r--r--gcc/config/m68k/m68kemb.h53
-rw-r--r--gcc/config/m68k/m68kv4.h346
-rw-r--r--gcc/config/m68k/mot3300-crt0.S109
-rw-r--r--gcc/config/m68k/mot3300.h814
-rw-r--r--gcc/config/m68k/mot3300Mcrt0.S155
-rw-r--r--gcc/config/m68k/netbsd.h58
-rw-r--r--gcc/config/m68k/news.h552
-rw-r--r--gcc/config/m68k/news3.h6
-rw-r--r--gcc/config/m68k/news3gas.h6
-rw-r--r--gcc/config/m68k/newsgas.h19
-rw-r--r--gcc/config/m68k/next.h201
-rw-r--r--gcc/config/m68k/next21.h104
-rw-r--r--gcc/config/m68k/pbb.h163
-rw-r--r--gcc/config/m68k/plexus.h108
-rw-r--r--gcc/config/m68k/rtems.h31
-rw-r--r--gcc/config/m68k/sgs.h446
-rw-r--r--gcc/config/m68k/sun2.h77
-rw-r--r--gcc/config/m68k/sun2o4.h189
-rw-r--r--gcc/config/m68k/sun3.h301
-rw-r--r--gcc/config/m68k/sun3mach.h15
-rw-r--r--gcc/config/m68k/sun3n.h9
-rw-r--r--gcc/config/m68k/sun3n3.h5
-rw-r--r--gcc/config/m68k/sun3o3.h5
-rw-r--r--gcc/config/m68k/t-aux44
-rw-r--r--gcc/config/m68k/t-linux19
-rw-r--r--gcc/config/m68k/t-linux-aout5
-rw-r--r--gcc/config/m68k/t-lynx6
-rw-r--r--gcc/config/m68k/t-m68kbare24
-rw-r--r--gcc/config/m68k/t-mot330010
-rw-r--r--gcc/config/m68k/t-mot3300-gald13
-rw-r--r--gcc/config/m68k/t-mot3300-gas13
-rw-r--r--gcc/config/m68k/t-mot3300-gld12
-rw-r--r--gcc/config/m68k/t-next4
-rw-r--r--gcc/config/m68k/t-vxworks6827
-rw-r--r--gcc/config/m68k/tower-as.h616
-rw-r--r--gcc/config/m68k/tower.h104
-rw-r--r--gcc/config/m68k/vxm68k.h101
-rw-r--r--gcc/config/m68k/x-alloca-c1
-rw-r--r--gcc/config/m68k/x-amix27
-rw-r--r--gcc/config/m68k/x-apollo6815
-rw-r--r--gcc/config/m68k/x-ccur3
-rw-r--r--gcc/config/m68k/x-crds7
-rw-r--r--gcc/config/m68k/x-dpx216
-rw-r--r--gcc/config/m68k/x-hp2bsd4
-rw-r--r--gcc/config/m68k/x-hp32017
-rw-r--r--gcc/config/m68k/x-hp320g17
-rw-r--r--gcc/config/m68k/x-hp3bsd442
-rw-r--r--gcc/config/m68k/x-mot330014
-rw-r--r--gcc/config/m68k/x-mot3300-gas12
-rw-r--r--gcc/config/m68k/x-next9
-rw-r--r--gcc/config/m68k/x-tower9
-rw-r--r--gcc/config/m68k/xm-3b1.h14
-rw-r--r--gcc/config/m68k/xm-atari.h46
-rw-r--r--gcc/config/m68k/xm-crds.h26
-rw-r--r--gcc/config/m68k/xm-lynx.h35
-rw-r--r--gcc/config/m68k/xm-m68k.h41
-rw-r--r--gcc/config/m68k/xm-mot3300.h45
-rw-r--r--gcc/config/m68k/xm-next.h5
-rw-r--r--gcc/config/m68k/xm-plexus.h20
-rw-r--r--gcc/config/m88k/dgux.h303
-rw-r--r--gcc/config/m88k/dgux.ld48
-rw-r--r--gcc/config/m88k/dguxbcs.h62
-rw-r--r--gcc/config/m88k/dolph.h54
-rw-r--r--gcc/config/m88k/dolphin.ld40
-rw-r--r--gcc/config/m88k/luna.h58
-rw-r--r--gcc/config/m88k/m88k-aout.h32
-rw-r--r--gcc/config/m88k/m88k-coff.h34
-rwxr-xr-xgcc/config/m88k/m88k-move.sh306
-rw-r--r--gcc/config/m88k/m88k.c3148
-rw-r--r--gcc/config/m88k/m88k.h2644
-rw-r--r--gcc/config/m88k/m88k.md4040
-rw-r--r--gcc/config/m88k/sysv3.h139
-rw-r--r--gcc/config/m88k/sysv4.h85
-rw-r--r--gcc/config/m88k/t-bug12
-rw-r--r--gcc/config/m88k/t-dgux26
-rw-r--r--gcc/config/m88k/t-dgux-gas17
-rw-r--r--gcc/config/m88k/t-dguxbcs28
-rw-r--r--gcc/config/m88k/t-luna12
-rw-r--r--gcc/config/m88k/t-luna-gas13
-rw-r--r--gcc/config/m88k/t-m88k12
-rw-r--r--gcc/config/m88k/t-m88k-gas18
-rw-r--r--gcc/config/m88k/t-sysv422
-rw-r--r--gcc/config/m88k/tekXD88.h50
-rw-r--r--gcc/config/m88k/tekXD88.ld39
-rw-r--r--gcc/config/m88k/x-dgux5
-rw-r--r--gcc/config/m88k/x-dguxbcs5
-rw-r--r--gcc/config/m88k/x-dolph19
-rw-r--r--gcc/config/m88k/x-sysv37
-rw-r--r--gcc/config/m88k/x-sysv410
-rw-r--r--gcc/config/m88k/x-tekXD8812
-rw-r--r--gcc/config/m88k/xm-m88k.h70
-rw-r--r--gcc/config/m88k/xm-sysv3.h30
-rw-r--r--gcc/config/mips/abi64.h229
-rw-r--r--gcc/config/mips/bsd-4.h48
-rw-r--r--gcc/config/mips/bsd-5.h66
-rw-r--r--gcc/config/mips/cross64.h36
-rw-r--r--gcc/config/mips/dec-bsd.h53
-rw-r--r--gcc/config/mips/dec-osf1.h54
-rw-r--r--gcc/config/mips/ecoff.h36
-rw-r--r--gcc/config/mips/ecoffl.h29
-rw-r--r--gcc/config/mips/elf.h53
-rw-r--r--gcc/config/mips/elf64.h95
-rw-r--r--gcc/config/mips/elfl.h29
-rw-r--r--gcc/config/mips/elfl64.h29
-rw-r--r--gcc/config/mips/elforion.h24
-rw-r--r--gcc/config/mips/gnu.h128
-rw-r--r--gcc/config/mips/iris3.h74
-rw-r--r--gcc/config/mips/iris4.h50
-rw-r--r--gcc/config/mips/iris4loser.h7
-rw-r--r--gcc/config/mips/iris5.h158
-rw-r--r--gcc/config/mips/iris5gas.h31
-rw-r--r--gcc/config/mips/iris6.h523
-rw-r--r--gcc/config/mips/mips-5.h46
-rw-r--r--gcc/config/mips/mips.c6121
-rw-r--r--gcc/config/mips/mips.h4034
-rw-r--r--gcc/config/mips/mips.md7095
-rw-r--r--gcc/config/mips/netbsd.h227
-rw-r--r--gcc/config/mips/news4.h36
-rw-r--r--gcc/config/mips/news5.h62
-rw-r--r--gcc/config/mips/osfrose.h151
-rw-r--r--gcc/config/mips/rtems64.h31
-rw-r--r--gcc/config/mips/sni-gas.h43
-rw-r--r--gcc/config/mips/sni-svr4.h97
-rw-r--r--gcc/config/mips/svr3-4.h64
-rw-r--r--gcc/config/mips/svr3-5.h88
-rw-r--r--gcc/config/mips/svr4-4.h62
-rw-r--r--gcc/config/mips/svr4-5.h91
-rw-r--r--gcc/config/mips/svr4-t.h30
-rw-r--r--gcc/config/mips/t-bsd12
-rw-r--r--gcc/config/mips/t-bsd-gas8
-rw-r--r--gcc/config/mips/t-cross6419
-rw-r--r--gcc/config/mips/t-ecoff75
-rw-r--r--gcc/config/mips/t-iris620
-rw-r--r--gcc/config/mips/t-mips8
-rw-r--r--gcc/config/mips/t-mips-gas4
-rw-r--r--gcc/config/mips/t-osfrose8
-rw-r--r--gcc/config/mips/t-svr312
-rw-r--r--gcc/config/mips/t-svr3-gas8
-rw-r--r--gcc/config/mips/t-svr412
-rw-r--r--gcc/config/mips/t-svr4-gas8
-rw-r--r--gcc/config/mips/t-ultrix10
-rw-r--r--gcc/config/mips/ultrix.h49
-rw-r--r--gcc/config/mips/x-dec-osf118
-rw-r--r--gcc/config/mips/x-iris28
-rw-r--r--gcc/config/mips/x-iris328
-rw-r--r--gcc/config/mips/x-iris611
-rw-r--r--gcc/config/mips/x-mips20
-rw-r--r--gcc/config/mips/x-netbsd16
-rw-r--r--gcc/config/mips/x-nws3250v419
-rw-r--r--gcc/config/mips/x-osfrose33
-rw-r--r--gcc/config/mips/x-sni-svr418
-rw-r--r--gcc/config/mips/x-sony18
-rw-r--r--gcc/config/mips/x-sysv26
-rw-r--r--gcc/config/mips/x-ultrix17
-rw-r--r--gcc/config/mips/xm-iris5.h9
-rw-r--r--gcc/config/mips/xm-iris6.h21
-rw-r--r--gcc/config/mips/xm-mips.h81
-rw-r--r--gcc/config/mn10300/mn10300.c936
-rw-r--r--gcc/config/mn10300/mn10300.h1019
-rw-r--r--gcc/config/mn10300/mn10300.md1426
-rw-r--r--gcc/config/mn10300/t-mn1030020
-rw-r--r--gcc/config/mn10300/xm-mn10300.h40
-rw-r--r--gcc/config/msdos/configur.bat47
-rw-r--r--gcc/config/msdos/libgcc.mak14
-rw-r--r--gcc/config/msdos/mklibgcc.c98
-rw-r--r--gcc/config/msdos/top.sed57
-rw-r--r--gcc/config/netbsd.h207
-rw-r--r--gcc/config/nextstep.c99
-rw-r--r--gcc/config/nextstep.h583
-rw-r--r--gcc/config/nextstep21.h65
-rw-r--r--gcc/config/ns32k/encore.h196
-rw-r--r--gcc/config/ns32k/genix.h167
-rw-r--r--gcc/config/ns32k/merlin.h231
-rw-r--r--gcc/config/ns32k/netbsd.h107
-rw-r--r--gcc/config/ns32k/ns32k.c906
-rw-r--r--gcc/config/ns32k/ns32k.h1477
-rw-r--r--gcc/config/ns32k/ns32k.md2869
-rw-r--r--gcc/config/ns32k/pc532-mach.h30
-rw-r--r--gcc/config/ns32k/pc532-min.h41
-rw-r--r--gcc/config/ns32k/pc532.h73
-rw-r--r--gcc/config/ns32k/sequent.h77
-rw-r--r--gcc/config/ns32k/tek6000.h235
-rw-r--r--gcc/config/ns32k/tek6100.h7
-rw-r--r--gcc/config/ns32k/tek6200.h7
-rw-r--r--gcc/config/ns32k/x-genix6
-rw-r--r--gcc/config/ns32k/xm-ns32k.h42
-rw-r--r--gcc/config/ns32k/xm-pc532-min.h34
-rw-r--r--gcc/config/pa/ee.asm261
-rw-r--r--gcc/config/pa/ee_fp.asm274
-rw-r--r--gcc/config/pa/lib1funcs.asm1138
-rw-r--r--gcc/config/pa/lib2funcs.asm66
-rw-r--r--gcc/config/pa/pa-gas.h21
-rw-r--r--gcc/config/pa/pa-hiux.h26
-rw-r--r--gcc/config/pa/pa-hpux.h49
-rw-r--r--gcc/config/pa/pa-hpux10.h71
-rw-r--r--gcc/config/pa/pa-hpux7.h37
-rw-r--r--gcc/config/pa/pa-hpux9.h31
-rw-r--r--gcc/config/pa/pa-oldas.h22
-rw-r--r--gcc/config/pa/pa-osf.h42
-rw-r--r--gcc/config/pa/pa-pro-end.h41
-rw-r--r--gcc/config/pa/pa-pro.h78
-rw-r--r--gcc/config/pa/pa.c6013
-rw-r--r--gcc/config/pa/pa.h2390
-rw-r--r--gcc/config/pa/pa.md5158
-rw-r--r--gcc/config/pa/pa1.h28
-rw-r--r--gcc/config/pa/t-pa18
-rw-r--r--gcc/config/pa/t-pro38
-rw-r--r--gcc/config/pa/x-pa3
-rw-r--r--gcc/config/pa/x-pa-hpux4
-rw-r--r--gcc/config/pa/xm-pa.h65
-rw-r--r--gcc/config/pa/xm-pahpux.h68
-rw-r--r--gcc/config/pa/xm-papro.h61
-rw-r--r--gcc/config/pdp11/2bsd.h86
-rw-r--r--gcc/config/pdp11/pdp11.c1423
-rw-r--r--gcc/config/pdp11/pdp11.h1397
-rw-r--r--gcc/config/pdp11/pdp11.md1818
-rw-r--r--gcc/config/pdp11/t-pdp118
-rw-r--r--gcc/config/pdp11/xm-pdp11.h27
-rw-r--r--gcc/config/psos.h183
-rw-r--r--gcc/config/ptx4.h859
-rw-r--r--gcc/config/pyr/pyr.c864
-rw-r--r--gcc/config/pyr/pyr.h1505
-rw-r--r--gcc/config/pyr/pyr.md1375
-rw-r--r--gcc/config/pyr/x-pyr2
-rw-r--r--gcc/config/pyr/xm-pyr.h40
-rw-r--r--gcc/config/romp/romp.c2038
-rw-r--r--gcc/config/romp/romp.h1636
-rw-r--r--gcc/config/romp/romp.md2778
-rw-r--r--gcc/config/romp/x-mach5
-rw-r--r--gcc/config/romp/x-romp11
-rw-r--r--gcc/config/romp/xm-romp.h54
-rw-r--r--gcc/config/rs6000/aix31.h32
-rw-r--r--gcc/config/rs6000/aix3newas.h88
-rw-r--r--gcc/config/rs6000/aix41.h111
-rw-r--r--gcc/config/rs6000/cygwin32.h64
-rw-r--r--gcc/config/rs6000/eabi-ci.asm119
-rw-r--r--gcc/config/rs6000/eabi-cn.asm109
-rw-r--r--gcc/config/rs6000/eabi-ctors.c92
-rw-r--r--gcc/config/rs6000/eabi.asm555
-rw-r--r--gcc/config/rs6000/eabi.h40
-rw-r--r--gcc/config/rs6000/eabiaix.h41
-rw-r--r--gcc/config/rs6000/eabile.h46
-rw-r--r--gcc/config/rs6000/eabilesim.h46
-rw-r--r--gcc/config/rs6000/eabisim.h46
-rw-r--r--gcc/config/rs6000/linux.h60
-rw-r--r--gcc/config/rs6000/lynx.h104
-rw-r--r--gcc/config/rs6000/mach.h42
-rw-r--r--gcc/config/rs6000/milli.exp7
-rw-r--r--gcc/config/rs6000/netware.h273
-rw-r--r--gcc/config/rs6000/nt-ci.asm48
-rw-r--r--gcc/config/rs6000/nt-cn.asm48
-rw-r--r--gcc/config/rs6000/ntstack.asm42
-rw-r--r--gcc/config/rs6000/powerpc.h61
-rw-r--r--gcc/config/rs6000/rs6000.c4845
-rw-r--r--gcc/config/rs6000/rs6000.h3125
-rw-r--r--gcc/config/rs6000/rs6000.md9496
-rw-r--r--gcc/config/rs6000/rtems.h33
-rw-r--r--gcc/config/rs6000/sol-c0.c122
-rw-r--r--gcc/config/rs6000/sol-ci.asm104
-rw-r--r--gcc/config/rs6000/sol-cn.asm82
-rw-r--r--gcc/config/rs6000/sol2.h167
-rw-r--r--gcc/config/rs6000/sysv4.h1359
-rw-r--r--gcc/config/rs6000/sysv4le.h46
-rw-r--r--gcc/config/rs6000/t-newas52
-rw-r--r--gcc/config/rs6000/t-ppc12
-rw-r--r--gcc/config/rs6000/t-ppccomm69
-rw-r--r--gcc/config/rs6000/t-ppcgas22
-rw-r--r--gcc/config/rs6000/t-ppcos11
-rw-r--r--gcc/config/rs6000/t-rs600022
-rw-r--r--gcc/config/rs6000/t-winnt35
-rw-r--r--gcc/config/rs6000/t-xnewas58
-rw-r--r--gcc/config/rs6000/t-xrs600028
-rw-r--r--gcc/config/rs6000/tramp.asm122
-rw-r--r--gcc/config/rs6000/vxppc.h63
-rw-r--r--gcc/config/rs6000/win-nt.h478
-rw-r--r--gcc/config/rs6000/x-aix3111
-rw-r--r--gcc/config/rs6000/x-cygwin324
-rw-r--r--gcc/config/rs6000/x-lynx14
-rw-r--r--gcc/config/rs6000/x-mach7
-rw-r--r--gcc/config/rs6000/x-rs600010
-rw-r--r--gcc/config/rs6000/x-sysv42
-rw-r--r--gcc/config/rs6000/xm-cygwin32.h29
-rw-r--r--gcc/config/rs6000/xm-lynx.h35
-rw-r--r--gcc/config/rs6000/xm-mach.h25
-rw-r--r--gcc/config/rs6000/xm-rs6000.h68
-rw-r--r--gcc/config/rs6000/xm-sysv4.h72
-rw-r--r--gcc/config/sh/elf.h105
-rw-r--r--gcc/config/sh/lib1funcs.asm955
-rw-r--r--gcc/config/sh/sh.c3118
-rw-r--r--gcc/config/sh/sh.h1773
-rw-r--r--gcc/config/sh/sh.md2809
-rw-r--r--gcc/config/sh/t-sh29
-rw-r--r--gcc/config/sh/xm-sh.h44
-rw-r--r--gcc/config/sparc/aout.h26
-rw-r--r--gcc/config/sparc/bsd.h7
-rw-r--r--gcc/config/sparc/gmon-sol2.c427
-rw-r--r--gcc/config/sparc/lb1spc.asm486
-rw-r--r--gcc/config/sparc/lb1spl.asm246
-rw-r--r--gcc/config/sparc/linux-aout.h116
-rw-r--r--gcc/config/sparc/linux.h212
-rw-r--r--gcc/config/sparc/lite.h38
-rw-r--r--gcc/config/sparc/litecoff.h113
-rw-r--r--gcc/config/sparc/lynx-ng.h41
-rw-r--r--gcc/config/sparc/lynx.h53
-rw-r--r--gcc/config/sparc/netbsd.h40
-rw-r--r--gcc/config/sparc/pbd.h184
-rw-r--r--gcc/config/sparc/rtems.h31
-rw-r--r--gcc/config/sparc/sol2-c1.asm86
-rw-r--r--gcc/config/sparc/sol2-ci.asm60
-rw-r--r--gcc/config/sparc/sol2-cn.asm54
-rw-r--r--gcc/config/sparc/sol2-g1.asm88
-rw-r--r--gcc/config/sparc/sol2.h173
-rw-r--r--gcc/config/sparc/sp64-aout.h39
-rw-r--r--gcc/config/sparc/sp64-elf.h170
-rw-r--r--gcc/config/sparc/sparc.c5093
-rw-r--r--gcc/config/sparc/sparc.h3103
-rw-r--r--gcc/config/sparc/sparc.md6076
-rw-r--r--gcc/config/sparc/splet.h59
-rw-r--r--gcc/config/sparc/sun4o3.h10
-rw-r--r--gcc/config/sparc/sunos4.h27
-rw-r--r--gcc/config/sparc/sysv4.h274
-rw-r--r--gcc/config/sparc/t-sol230
-rw-r--r--gcc/config/sparc/t-sp643
-rw-r--r--gcc/config/sparc/t-sparcbare26
-rw-r--r--gcc/config/sparc/t-sparclite24
-rw-r--r--gcc/config/sparc/t-splet23
-rw-r--r--gcc/config/sparc/t-sunos407
-rw-r--r--gcc/config/sparc/t-sunos4116
-rw-r--r--gcc/config/sparc/t-vxsparc17
-rw-r--r--gcc/config/sparc/vxsim.h131
-rw-r--r--gcc/config/sparc/vxsparc.h54
-rw-r--r--gcc/config/sparc/x-sysv42
-rw-r--r--gcc/config/sparc/xm-linux.h23
-rw-r--r--gcc/config/sparc/xm-lynx.h39
-rw-r--r--gcc/config/sparc/xm-sol2.h12
-rw-r--r--gcc/config/sparc/xm-sparc.h51
-rw-r--r--gcc/config/sparc/xm-sysv4.h51
-rw-r--r--gcc/config/spur/spur.c327
-rw-r--r--gcc/config/spur/spur.h1050
-rw-r--r--gcc/config/spur/spur.md1093
-rw-r--r--gcc/config/spur/xm-spur.h39
-rw-r--r--gcc/config/svr3.h375
-rw-r--r--gcc/config/svr4.h986
-rw-r--r--gcc/config/t-gnu13
-rw-r--r--gcc/config/t-libc-ok3
-rw-r--r--gcc/config/t-linux10
-rw-r--r--gcc/config/t-linux-aout5
-rw-r--r--gcc/config/t-rtems2
-rw-r--r--gcc/config/t-svr47
-rw-r--r--gcc/config/tahoe/harris.h87
-rw-r--r--gcc/config/tahoe/tahoe.c565
-rw-r--r--gcc/config/tahoe/tahoe.h1015
-rw-r--r--gcc/config/tahoe/tahoe.md2113
-rw-r--r--gcc/config/tahoe/xm-tahoe.h59
-rw-r--r--gcc/config/vax/netbsd.h19
-rw-r--r--gcc/config/vax/ultrix.h9
-rw-r--r--gcc/config/vax/vax.c835
-rw-r--r--gcc/config/vax/vax.h1312
-rw-r--r--gcc/config/vax/vax.md2134
-rw-r--r--gcc/config/vax/vaxv.h70
-rw-r--r--gcc/config/vax/vms.h359
-rw-r--r--gcc/config/vax/xm-vax.h44
-rw-r--r--gcc/config/vax/xm-vms.h202
-rw-r--r--gcc/config/we32k/we32k.c140
-rw-r--r--gcc/config/we32k/we32k.h1047
-rw-r--r--gcc/config/we32k/we32k.md1197
-rw-r--r--gcc/config/we32k/x-we32k1
-rw-r--r--gcc/config/we32k/xm-we32k.h49
-rw-r--r--gcc/config/winnt/config-nt.bat58
-rw-r--r--gcc/config/winnt/config-nt.sed130
-rw-r--r--gcc/config/winnt/dirent.c360
-rw-r--r--gcc/config/winnt/dirent.h96
-rw-r--r--gcc/config/winnt/fixinc-nt.c260
-rw-r--r--gcc/config/winnt/headers.mak51
-rw-r--r--gcc/config/winnt/ld.c348
-rw-r--r--gcc/config/winnt/libgcc.mak19
-rw-r--r--gcc/config/winnt/mklibgcc.c97
-rw-r--r--gcc/config/winnt/oldnames.c47
-rw-r--r--gcc/config/winnt/spawnv.c71
-rw-r--r--gcc/config/winnt/win-nt.h58
-rw-r--r--gcc/config/winnt/x-winnt34
-rw-r--r--gcc/config/winnt/xm-winnt.h69
-rw-r--r--gcc/config/x-linux5
-rw-r--r--gcc/config/x-linux-aout14
-rw-r--r--gcc/config/x-lynx6
-rw-r--r--gcc/config/x-svr49
-rw-r--r--gcc/config/xm-gnu.h31
-rw-r--r--gcc/config/xm-lynx.h51
-rw-r--r--gcc/configure.bat21
-rw-r--r--gcc/convert.c472
-rw-r--r--gcc/convert.h24
-rw-r--r--gcc/cp/ChangeLog14352
-rw-r--r--gcc/cp/Make-lang.in274
-rw-r--r--gcc/cp/Makefile.in264
-rw-r--r--gcc/cp/call.c5860
-rw-r--r--gcc/cp/class.c5355
-rw-r--r--gcc/cp/class.h117
-rw-r--r--gcc/cp/config-lang.in39
-rw-r--r--gcc/cp/cp-tree.def154
-rw-r--r--gcc/cp/cp-tree.h2512
-rw-r--r--gcc/cp/cvt.c1826
-rw-r--r--gcc/cp/decl.c12637
-rw-r--r--gcc/cp/decl.h59
-rw-r--r--gcc/cp/decl2.c3693
-rw-r--r--gcc/cp/errfn.c231
-rw-r--r--gcc/cp/error.c1659
-rw-r--r--gcc/cp/except.c1152
-rw-r--r--gcc/cp/exception.cc111
-rw-r--r--gcc/cp/expr.c455
-rw-r--r--gcc/cp/friend.c414
-rw-r--r--gcc/cp/g++.1674
-rw-r--r--gcc/cp/g++spec.c226
-rw-r--r--gcc/cp/gxx.gperf102
-rw-r--r--gcc/cp/gxxint.texi1539
-rw-r--r--gcc/cp/hash.h211
-rw-r--r--gcc/cp/inc/exception42
-rw-r--r--gcc/cp/inc/new48
-rw-r--r--gcc/cp/inc/new.h13
-rw-r--r--gcc/cp/inc/typeinfo71
-rw-r--r--gcc/cp/init.c3508
-rw-r--r--gcc/cp/input.c202
-rw-r--r--gcc/cp/lang-options.h106
-rw-r--r--gcc/cp/lang-specs.h60
-rw-r--r--gcc/cp/lex.c4458
-rw-r--r--gcc/cp/lex.h137
-rw-r--r--gcc/cp/method.c2218
-rw-r--r--gcc/cp/mpw-config.in11
-rw-r--r--gcc/cp/mpw-make.sed112
-rw-r--r--gcc/cp/new.cc31
-rw-r--r--gcc/cp/new1.cc54
-rw-r--r--gcc/cp/new2.cc33
-rw-r--r--gcc/cp/parse.y4154
-rw-r--r--gcc/cp/pt.c3577
-rw-r--r--gcc/cp/ptree.c161
-rw-r--r--gcc/cp/repo.c413
-rw-r--r--gcc/cp/rtti.c1373
-rw-r--r--gcc/cp/search.c3683
-rw-r--r--gcc/cp/sig.c1059
-rw-r--r--gcc/cp/spew.c441
-rw-r--r--gcc/cp/tinfo.cc125
-rw-r--r--gcc/cp/tinfo.h55
-rw-r--r--gcc/cp/tinfo2.cc311
-rw-r--r--gcc/cp/tree.c2104
-rw-r--r--gcc/cp/typeck.c7437
-rw-r--r--gcc/cp/typeck2.c1610
-rw-r--r--gcc/cp/xref.c842
-rw-r--r--gcc/cplus-dem.c3058
-rw-r--r--gcc/cpp.11
-rw-r--r--gcc/cpp.texi2869
-rw-r--r--gcc/cppalloc.c55
-rw-r--r--gcc/cpperror.c136
-rw-r--r--gcc/cppexp.c1028
-rw-r--r--gcc/cpphash.c202
-rw-r--r--gcc/cpphash.h38
-rw-r--r--gcc/cpplib.c7551
-rw-r--r--gcc/cpplib.h657
-rw-r--r--gcc/cppmain.c104
-rw-r--r--gcc/cross-make24
-rw-r--r--gcc/crtstuff.c366
-rw-r--r--gcc/cse.c8821
-rw-r--r--gcc/dbxout.c2607
-rw-r--r--gcc/dbxstclass.h17
-rw-r--r--gcc/defaults.h135
-rw-r--r--gcc/demangle.h89
-rwxr-xr-xgcc/dostage22
-rwxr-xr-xgcc/dostage33
-rw-r--r--gcc/dwarf.h315
-rw-r--r--gcc/dwarf2.h541
-rw-r--r--gcc/dwarf2out.c8686
-rw-r--r--gcc/dwarfout.c5910
-rw-r--r--gcc/emit-rtl.c3470
-rw-r--r--gcc/enquire.c2842
-rw-r--r--gcc/except.c1571
-rw-r--r--gcc/except.h235
-rw-r--r--gcc/explow.c1231
-rw-r--r--gcc/expmed.c4315
-rw-r--r--gcc/expr.c12026
-rw-r--r--gcc/expr.h874
-rw-r--r--gcc/extend.texi3445
-rw-r--r--gcc/final.c3287
-rw-r--r--gcc/fix-header.c1356
-rwxr-xr-xgcc/fixcpp109
-rw-r--r--gcc/fixinc-nt.sed5
-rwxr-xr-xgcc/fixinc.dgux185
-rwxr-xr-xgcc/fixinc.irix161
-rw-r--r--gcc/fixinc.ptx257
-rwxr-xr-xgcc/fixinc.sco315
-rwxr-xr-xgcc/fixinc.svr41725
-rw-r--r--gcc/fixinc.winnt232
-rwxr-xr-xgcc/fixincludes2871
-rwxr-xr-xgcc/fixproto273
-rw-r--r--gcc/flags.h398
-rw-r--r--gcc/floatlib.c838
-rw-r--r--gcc/flow.c3018
-rw-r--r--gcc/fold-const.c5701
-rw-r--r--gcc/fp-test.c231
-rw-r--r--gcc/function.c5909
-rw-r--r--gcc/function.h248
-rw-r--r--gcc/future.options29
-rw-r--r--gcc/gansidecl.h88
-rw-r--r--gcc/gbl-ctors.h94
-rw-r--r--gcc/gcc.c5418
-rw-r--r--gcc/gcov-io.h136
-rw-r--r--gcc/gcov.c1380
-rw-r--r--gcc/gcov.texi344
-rw-r--r--gcc/gen-protos.c218
-rw-r--r--gcc/genattr.c424
-rw-r--r--gcc/genattrtab.c5716
-rw-r--r--gcc/gencodes.c161
-rw-r--r--gcc/genconfig.c356
-rw-r--r--gcc/genemit.c801
-rw-r--r--gcc/genextract.c554
-rw-r--r--gcc/genflags.c297
-rw-r--r--gcc/genmultilib269
-rw-r--r--gcc/genopinit.c388
-rw-r--r--gcc/genoutput.c1000
-rw-r--r--gcc/genpeep.c509
-rw-r--r--gcc/genrecog.c1814
-rw-r--r--gcc/getopt.h135
-rw-r--r--gcc/getopt1.c191
-rw-r--r--gcc/getpwd.c98
-rw-r--r--gcc/ginclude/iso646.h15
-rw-r--r--gcc/ginclude/math-3300.h461
-rw-r--r--gcc/ginclude/math-68881.h529
-rw-r--r--gcc/ginclude/ppc-asm.h170
-rw-r--r--gcc/ginclude/proto.h4
-rw-r--r--gcc/ginclude/stdarg.h190
-rw-r--r--gcc/ginclude/stddef.h327
-rw-r--r--gcc/ginclude/va-alpha.h131
-rw-r--r--gcc/ginclude/va-clipper.h60
-rw-r--r--gcc/ginclude/va-h8300.h56
-rw-r--r--gcc/ginclude/va-i860.h214
-rw-r--r--gcc/ginclude/va-i960.h79
-rw-r--r--gcc/ginclude/va-m32r.h86
-rw-r--r--gcc/ginclude/va-m88k.h87
-rw-r--r--gcc/ginclude/va-mips.h273
-rw-r--r--gcc/ginclude/va-mn10300.h35
-rw-r--r--gcc/ginclude/va-pa.h52
-rw-r--r--gcc/ginclude/va-ppc.h233
-rw-r--r--gcc/ginclude/va-pyr.h130
-rw-r--r--gcc/ginclude/va-sh.h223
-rw-r--r--gcc/ginclude/va-sparc.h206
-rw-r--r--gcc/ginclude/va-spur.h64
-rw-r--r--gcc/ginclude/varargs.h205
-rw-r--r--gcc/glimits.h97
-rw-r--r--gcc/global.c1724
-rw-r--r--gcc/gmon.c329
-rw-r--r--gcc/gsyms.h86
-rw-r--r--gcc/gsyslimits.h8
-rw-r--r--gcc/halfpic.c400
-rw-r--r--gcc/halfpic.h91
-rw-r--r--gcc/hard-reg-set.h470
-rw-r--r--gcc/input.h47
-rwxr-xr-xgcc/install.sh238
-rw-r--r--gcc/integrate.c3251
-rw-r--r--gcc/integrate.h130
-rw-r--r--gcc/intl/intl-compat.c76
-rwxr-xr-xgcc/intl/linux-msg.sed100
-rwxr-xr-xgcc/intl/po2tbl.sed.in102
-rwxr-xr-xgcc/intl/xopen-msg.sed104
-rw-r--r--gcc/invoke.texi5086
-rw-r--r--gcc/jump.c4704
-rwxr-xr-xgcc/just-fixinc39
-rw-r--r--gcc/libgcc1-test.c103
-rw-r--r--gcc/libgcc1.c596
-rw-r--r--gcc/libgcc2.c3372
-rw-r--r--gcc/limitx.h12
-rw-r--r--gcc/limity.h10
-rwxr-xr-xgcc/listing227
-rw-r--r--gcc/local-alloc.c2446
-rw-r--r--gcc/longlong.h1225
-rw-r--r--gcc/loop.c6923
-rw-r--r--gcc/loop.h180
-rw-r--r--gcc/machmode.def119
-rw-r--r--gcc/machmode.h227
-rw-r--r--gcc/make-cc1.com544
-rw-r--r--gcc/make-cccp.com117
-rw-r--r--gcc/make-gcc.com32
-rw-r--r--gcc/make-l2.com94
-rw-r--r--gcc/md.texi4096
-rw-r--r--gcc/mips-tdump.c1617
-rw-r--r--gcc/mips-tfile.c5803
-rw-r--r--gcc/modemap.def31
-rw-r--r--gcc/objc/Makefile.in105
-rw-r--r--gcc/objc/NXConstStr.h38
-rw-r--r--gcc/objc/NXConstStr.m36
-rw-r--r--gcc/objc/Object.h124
-rw-r--r--gcc/objc/Object.m387
-rw-r--r--gcc/objc/Protocol.h58
-rw-r--r--gcc/objc/Protocol.m128
-rw-r--r--gcc/objc/README97
-rw-r--r--gcc/objc/README.threads50
-rw-r--r--gcc/objc/THREADS336
-rw-r--r--gcc/objc/THREADS.MACH23
-rw-r--r--gcc/objc/archive.c1641
-rw-r--r--gcc/objc/class.c357
-rw-r--r--gcc/objc/encoding.c539
-rw-r--r--gcc/objc/encoding.h75
-rw-r--r--gcc/objc/hash.c283
-rw-r--r--gcc/objc/hash.h206
-rw-r--r--gcc/objc/init.c524
-rw-r--r--gcc/objc/linking.m40
-rw-r--r--gcc/objc/makefile.dos56
-rw-r--r--gcc/objc/misc.c152
-rw-r--r--gcc/objc/nil_method.c40
-rw-r--r--gcc/objc/objc-act.c8254
-rw-r--r--gcc/objc/objc-act.h117
-rw-r--r--gcc/objc/objc-api.h582
-rw-r--r--gcc/objc/objc-list.h147
-rw-r--r--gcc/objc/objc-tree.def37
-rw-r--r--gcc/objc/objc.gperf64
-rw-r--r--gcc/objc/objc.h157
-rw-r--r--gcc/objc/objects.c92
-rw-r--r--gcc/objc/runtime.h83
-rw-r--r--gcc/objc/sarray.c522
-rw-r--r--gcc/objc/sarray.h237
-rw-r--r--gcc/objc/selector.c393
-rw-r--r--gcc/objc/sendmsg.c638
-rw-r--r--gcc/objc/thr-decosf1.c326
-rw-r--r--gcc/objc/thr-irix.c314
-rw-r--r--gcc/objc/thr-mach.c464
-rw-r--r--gcc/objc/thr-os2.c341
-rw-r--r--gcc/objc/thr-posix.c322
-rw-r--r--gcc/objc/thr-pthreads.c418
-rw-r--r--gcc/objc/thr-single.c240
-rw-r--r--gcc/objc/thr-solaris.c431
-rw-r--r--gcc/objc/thr-win32.c337
-rw-r--r--gcc/objc/thr.c153
-rw-r--r--gcc/objc/thr.h104
-rw-r--r--gcc/objc/typedstream.h132
-rw-r--r--gcc/optabs.c4376
-rw-r--r--gcc/output.h431
-rw-r--r--gcc/pcp.h101
-rw-r--r--gcc/pexecute.c589
-rw-r--r--gcc/print-rtl.c332
-rw-r--r--gcc/print-tree.c698
-rw-r--r--gcc/profile.c1634
-rw-r--r--gcc/protoize.c4708
-rw-r--r--gcc/real.c6300
-rw-r--r--gcc/real.h444
-rw-r--r--gcc/recog.c1994
-rw-r--r--gcc/recog.h108
-rw-r--r--gcc/reg-stack.c3235
-rw-r--r--gcc/regclass.c1910
-rw-r--r--gcc/regs.h187
-rw-r--r--gcc/reload.c6163
-rw-r--r--gcc/reload.h242
-rw-r--r--gcc/reload1.c8186
-rw-r--r--gcc/reorg.c4617
-rw-r--r--gcc/rtl.c855
-rw-r--r--gcc/rtl.def764
-rw-r--r--gcc/rtl.h960
-rw-r--r--gcc/rtlanal.c1849
-rw-r--r--gcc/scan-decls.c252
-rwxr-xr-xgcc/scan-types.sh139
-rw-r--r--gcc/scan.c240
-rw-r--r--gcc/scan.h75
-rw-r--r--gcc/sched.c5137
-rw-r--r--gcc/sdbout.c1628
-rwxr-xr-xgcc/sort-protos9
-rw-r--r--gcc/stack.h42
-rw-r--r--gcc/stmt.c6189
-rw-r--r--gcc/stor-layout.c1242
-rw-r--r--gcc/stupid.c587
-rw-r--r--gcc/sys-protos.h1354
-rw-r--r--gcc/sys-types.h240
-rw-r--r--gcc/texinfo.tex4758
-rw-r--r--gcc/tm.texi6918
-rw-r--r--gcc/toplev.c4458
-rw-r--r--gcc/tree.c4612
-rw-r--r--gcc/tree.def725
-rw-r--r--gcc/tree.h1817
-rw-r--r--gcc/typeclass.h14
-rw-r--r--gcc/unprotoize.c1
-rw-r--r--gcc/unroll.c3625
-rw-r--r--gcc/varasm.c4508
-rw-r--r--gcc/vmsconfig.com489
-rw-r--r--gcc/xcoffout.c531
-rw-r--r--gcc/xcoffout.h168
1029 files changed, 0 insertions, 740044 deletions
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
deleted file mode 100644
index e839f6ba729..00000000000
--- a/gcc/Makefile.in
+++ /dev/null
@@ -1,2669 +0,0 @@
-# Makefile for GNU C compiler.
-# Copyright (C) 1987, 88, 90-96, 1997 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.
-
-# The targets for external use include:
-# all, doc, proto, install, install-cross, install-cross-rest,
-# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean,
-# stage1, stage2, stage3, stage4.
-
-# Suppress smart makes who think they know how to automake Yacc files
-.y.c:
-
-# Variables that exist for you to override.
-# See below for how to change them for certain systems.
-
-# List of language subdirectories.
-# This is overridden by configure.
-SUBDIRS =
-
-# Selection of languages to be made.
-# This is overridden by configure.
-LANGUAGES = c objective-c proto gcov
-
-# Selection of languages to be made during stage1 build.
-# This is overridden by configure.
-BOOT_LANGUAGES = c
-
-ALLOCA =
-ALLOCA_FLAGS =
-ALLOCA_FINISH = true
-
-# Various ways of specifying flags for compilations:
-# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
-# BOOT_CFLAGS is the value of CFLAGS to pass
-# to the stage2 and stage3 compilations
-# XCFLAGS is used for most compilations but not when using the GCC just built.
-# TCFLAGS is used for compilations with the GCC just built.
-XCFLAGS =
-TCFLAGS =
-CFLAGS = -g
-BOOT_CFLAGS = -O $(CFLAGS)
-# These exists to be overridden by the x-* and t-* files, respectively.
-X_CFLAGS =
-T_CFLAGS =
-
-X_CPPFLAGS =
-T_CPPFLAGS =
-
-CC = cc
-BISON = bison
-BISONFLAGS =
-LEX = flex
-LEXFLAGS =
-AR = ar
-OLDAR_FLAGS = qc
-AR_FLAGS = rc
-SHELL = /bin/sh
-# on sysV, define this as cp.
-INSTALL = install -c
-# These permit overriding just for certain files.
-INSTALL_PROGRAM = $(INSTALL)
-INSTALL_DATA = $(INSTALL)
-MAKEINFO = makeinfo
-MAKEINFOFLAGS =
-TEXI2DVI = texi2dvi
-# For GNUmake: let us decide what gets passed to recursive makes.
-MAKEOVERRIDES =
-
-# Define this as & to perform parallel make on a Sequent.
-# Note that this has some bugs, and it seems currently necessary
-# to compile all the gen* files first by hand to avoid erroneous results.
-P =
-
-# How to invoke ranlib.
-RANLIB = ranlib
-# Test to use to see whether ranlib exists on the system.
-RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
-
-# Compiler to use for compiling libgcc1.a.
-# OLDCC should not be the GNU C compiler,
-# since that would compile typical libgcc1.a functions such as mulsi3
-# into infinite recursions.
-OLDCC = cc
-
-# CFLAGS for use with OLDCC, for compiling libgcc1.a.
-# NOTE: -O does not work on some Unix systems!
-CCLIBFLAGS = -O
-
-# Version of ar to use when compiling libgcc1.a.
-OLDAR = ar
-
-# Target to use when installing include directory. Either
-# install-headers-tar or install-headers-cpio.
-INSTALL_HEADERS_DIR = install-headers-tar
-
-# Header files that are made available under the same name
-# to programs compiled with GCC.
-USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
- $(srcdir)/ginclude/varargs.h $(srcdir)/ginclude/va-alpha.h \
- $(srcdir)/ginclude/va-h8300.h $(srcdir)/ginclude/va-i860.h \
- $(srcdir)/ginclude/va-i960.h $(srcdir)/ginclude/va-mips.h \
- $(srcdir)/ginclude/va-m88k.h $(srcdir)/ginclude/va-mn10300.h \
- $(srcdir)/ginclude/va-pa.h \
- $(srcdir)/ginclude/va-pyr.h $(srcdir)/ginclude/va-sparc.h \
- $(srcdir)/ginclude/va-clipper.h $(srcdir)/ginclude/va-spur.h \
- $(srcdir)/ginclude/va-m32r.h $(srcdir)/ginclude/va-sh.h \
- $(srcdir)/ginclude/iso646.h $(srcdir)/ginclude/va-ppc.h \
- $(srcdir)/ginclude/proto.h $(EXTRA_HEADERS) \
- $(LANG_EXTRA_HEADERS)
-
-# Target to use whe installing assert.h. Some systems may
-# want to set this empty.
-INSTALL_ASSERT_H = install-assert-h
-
-# The GCC to use for compiling libgcc2.a, enquire, and libgcc1-test.
-# Usually the one we just built.
-# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
-GCC_FOR_TARGET = ./xgcc -B./
-
-# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
-# It omits XCFLAGS, and specifies -B./.
-# It also specifies -I./include to find, e.g., stddef.h.
-GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include $(TCFLAGS)
-
-# Special flags for compiling enquire.
-# We disable optimization to make floating point more reliable.
-ENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0
-ENQUIRE_LDFLAGS = $(LDFLAGS)
-
-# Sed command to transform gcc to installed name. Overwritten by configure.
-program_transform_name = -e s,x,x,
-program_transform_cross_name = -e s,^,$(target_alias)-,
-
-# Tools to use when building a cross-compiler.
-# These are used because `configure' appends `cross-make'
-# to the makefile when making a cross-compiler.
-
-TARGET_TOOLPREFIX = $(tooldir)/bin/
-AR_FOR_TARGET = $(TARGET_TOOLPREFIX)ar
-AR_FOR_TARGET_FLAGS = rc
-RANLIB_FOR_TARGET = $(TARGET_TOOLPREFIX)ranlib
-RANLIB_TEST_FOR_TARGET = [ -f $(TARGET_TOOLPREFIX)ranlib ]
-
-# Dir to search for system headers. Overridden by cross-make.
-SYSTEM_HEADER_DIR = /usr/include
-
-# Control whether to run fixproto.
-STMP_FIXPROTO = stmp-fixproto
-
-# Test to see whether <limits.h> exists in the system header files.
-LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
-
-# There may be a premade insn-attrtab.c for this machine.
-# (You could rebuild it with genattrtab as usual, but it takes a long time.)
-# PREMADE_ATTRTAB is the file name of the file to use.
-# PREMADE_ATTRTAB_MD is the md file it corresponds to.
-PREMADE_ATTRTAB_MD = Makefile # Guaranteed not to cmp equal to md.
-PREMADE_ATTRTAB =
-
-target= ... `configure' substitutes actual target name here.
-target_alias= ... `configure' substitutes specified target name here.
-xmake_file= ... `configure' substitutes actual x- file name here.
-tmake_file= ... `configure' substitutes actual t- file name here.
-out_file= ... `configure' substitutes actual out file name here.
-out_object_file= ... `configure' substitutes actual out object file name here.
-md_file= ... `configure' substitutes actual md file name here.
-tm_file= ... `configure' substitutes actual tm file name here.
-build_xm_file= ... `configure' substitutes actual build xm- file name here.
-host_xm_file= ... `configure' substitutes actual host xm- file name here.
-lang_specs_files= ... `configure' substitutes actual lang spec file names here.
-lang_options_files= ... `configure' puts actual lang options file names here.
-OBJC_THREAD_FILE= ... `configure' puts actual objc thread file name here.
-version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
-mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
-
-# Directory where sources are, from where we are.
-srcdir = .
-# Common prefix for installation directories.
-# NOTE: This directory must exist when you start installation.
-prefix = /usr/local
-# Directory in which to put localized header files. On the systems with
-# gcc as the native cc, `local_prefix' may not be `prefix' which is
-# `/usr'.
-# NOTE: local_prefix *should not* default from prefix.
-local_prefix = /usr/local
-# Directory in which to put host dependent programs and libraries
-exec_prefix = $(prefix)
-# Directory in which to put the executable for the command `gcc'
-bindir = $(exec_prefix)/bin
-# Directory in which to put the directories used by the compiler.
-libdir = $(exec_prefix)/lib
-# Directory in which the compiler finds executables, libraries, etc.
-libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version)
-# Directory in which the compiler finds g++ includes.
-gxx_include_dir= $(prefix)/include/g++
-# Directory in which the old g++ header files may be found.
-old_gxx_include_dir= $(libdir)/g++-include
-# Directory to search for site-specific includes.
-includedir = $(local_prefix)/include
-# assertdir is overridden in cross-make.
-# (But this currently agrees with what is in cross-make.)
-assertdir = $(tooldir)/include
-# where the info files go
-infodir = $(prefix)/info
-# Extension (if any) to put in installed man-page filename.
-manext = .1
-objext = .o
-exeext =
-
-# Directory in which to put man pages.
-mandir = $(prefix)/man/man1
-# Directory in which to find other cross-compilation tools and headers.
-# Used in install-cross.
-tooldir = $(exec_prefix)/$(target_alias)
-# Dir for temp files.
-tmpdir = /tmp
-
-# Additional system libraries to link with.
-CLIB=
-
-# Change this to a null string if obstacks are installed in the
-# system library.
-OBSTACK=obstack.o
-
-# Specify the rule for actually making libgcc.a,
-LIBGCC = libgcc.a
-# and the rule for installing it.
-INSTALL_LIBGCC = install-libgcc
-
-# Specify the rule for actually making libgcc1.a.
-# The value may be empty; that means to do absolutely nothing
-# with or for libgcc1.a.
-LIBGCC1 = libgcc1.a
-
-# Specify the rule for making libgcc1.a for a cross-compiler.
-# The default rule assumes that libgcc1.a is supplied by the user.
-CROSS_LIBGCC1 = libgcc1.cross
-
-# Specify the rule for actually making libgcc2.a.
-LIBGCC2 = libgcc2.a
-
-# Options to use when compiling libgcc2.a.
-# -g1 causes output of debug info only for file-scope entities.
-# we use this here because that should be enough, and also
-# so that -g1 will be tested.
-LIBGCC2_DEBUG_CFLAGS = -g1
-LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
-
-# Additional options to use when compiling libgcc2.a.
-# Some targets override this to -Iinclude
-LIBGCC2_INCLUDES =
-
-# Additional target-dependent options for compiling libgcc2.a.
-TARGET_LIBGCC2_CFLAGS =
-
-# Things which must be built before building libgcc2.a.
-# Some targets override this to stmp-int-hdrs
-LIBGCC2_DEPS =
-
-# Enquire target (This is a variable so that a target can choose not to
-# build it.)
-ENQUIRE = enquire
-
-# libgcc1-test target (must also be overridable for a target)
-LIBGCC1_TEST = libgcc1-test
-
-# List of extra executables that should be compiled for this target machine
-# that are used for compiling from source code to object code.
-# The rules for compiling them should be in the t-* file for the machine.
-EXTRA_PASSES =
-
-# Like EXTRA_PASSES, but these are used when linking.
-EXTRA_PROGRAMS =
-
-# List of extra object files that should be compiled for this target machine.
-# The rules for compiling them should be in the t-* file for the machine.
-EXTRA_PARTS =
-
-# List of extra object files that should be compiled and linked with
-# compiler proper (cc1, cc1obj, cc1plus).
-EXTRA_OBJS =
-
-# List of extra object files that should be compiled and linked with
-# the gcc driver.
-EXTRA_GCC_OBJS =
-
-# List of additional header files to install.
-# Often this is edited directly by `configure'.
-EXTRA_HEADERS =
-
-# Set this to `ld' to enable use of collect2.
-# USE_COLLECT2 =
-# It is convenient for configure to add the assignment at the beginning,
-# so don't override it here.
-
-# List of extra C and assembler files to add to libgcc1.a.
-# Assembler files should have names ending in `.asm'.
-LIB1FUNCS_EXTRA =
-
-# List of extra C and assembler files to add to libgcc2.a.
-# Assembler files should have names ending in `.asm'.
-LIB2FUNCS_EXTRA =
-
-# Default float.h source to use for cross-compiler.
-# This is overidden by configure.
-CROSS_FLOAT_H=float.h-cross
-
-# Program to convert libraries.
-LIBCONVERT =
-
-# Control whether header files are installed.
-INSTALL_HEADERS=install-headers
-
-# Options for tar when copying trees. So HPUX can override it.
-TAROUTOPTS = xpBf
-
-# Select which version of fixincludes to use (I.E. regular versus SVR4)
-# This value is overridden directly by configure.
-FIXINCLUDES=fixincludes
-
-# Additional directories of header files to run fixincludes on.
-# These should be directories searched automatically by default
-# just as /usr/include is.
-# *Do not* use this for directories that happen to contain
-# header files, but are not searched automatically by default.
-# On most systems, this is empty.
-OTHER_FIXINCLUDES_DIRS=
-
-# A list of all the language-specific executables.
-# This is overridden by configure.
-COMPILERS = cc1$(exeext) cc1obj$(exeext)
-
-# List of things which should already be built whenever we try to use xgcc
-# to compile anything (without linking).
-GCC_PASSES=xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES)
-
-# List of things which should already be built whenever we try to use xgcc
-# to link anything.
-GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
-
-# Directory to link to, when using the target `maketest'.
-DIR = ../gcc
-
-# Guaranteed to not exist when not passing md through cpp.
-# This value is overridden directly by configure.
-MD_FILE = md-cpp-not-used
-
-# Flags to use when cross-building GCC.
-# Prefix to apply to names of object files when using them
-# to run on the machine we are compiling on.
-HOST_PREFIX=
-# Prefix to apply to names of object files when compiling them
-# to run on the machine we are compiling on.
-# The default for this variable is chosen to keep these rules
-# out of the way of the other rules for compiling the same source files.
-HOST_PREFIX_1=loser-
-HOST_CC=$(CC)
-HOST_CFLAGS=$(ALL_CFLAGS)
-HOST_CLIB=$(CLIB)
-HOST_LDFLAGS=$(LDFLAGS)
-HOST_CPPFLAGS=$(ALL_CPPFLAGS)
-HOST_ALLOCA=$(ALLOCA)
-HOST_MALLOC=$(MALLOC)
-HOST_OBSTACK=$(OBSTACK)
-
-# Actual name to use when installing a native compiler.
-GCC_INSTALL_NAME = `t='$(program_transform_name)'; echo gcc | sed $$t`
-
-# Actual name to use when installing a cross-compiler.
-GCC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcc | sed $$t`
-
-# Choose the real default target.
-ALL=all.internal
-
-# Choose the real install target.
-INSTALL_TARGET=install-normal
-
-# Source for float.h. Overridden by cross-make.
-FLOAT_H=float.h-nat
-
-# Extra symbols for fixproto to define when parsing headers.
-FIXPROTO_DEFINES =
-
-# Extra flags to use when compiling crt{begin,end}.o.
-CRTSTUFF_T_CFLAGS =
-
-# Extra flags to use when compiling [m]crt0.o.
-CRT0STUFF_T_CFLAGS =
-
-# End of variables for you to override.
-
-# Definition of `all' is here so that new rules inserted by sed
-# do not specify the default target.
-# The real definition is under `all.internal' (for native compilers)
-# or `all.cross' (for cross compilers).
-all: all.indirect
-
-# This tells GNU Make version 3 not to put all variables in the environment.
-.NOEXPORT:
-
-# sed inserts variable overrides after the following line.
-####target overrides
-####host overrides
-####cross overrides
-####build overrides
-
-# Now figure out from those variables how to compile and link.
-
-all.indirect: $(ALL)
-
-# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
-# ??? IN_GCC should be obsolete now.
-INTERNAL_CFLAGS = $(CROSS) -DIN_GCC
-
-# This is the variable actually used when we compile.
-ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
-
-# Likewise.
-ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
-
-# Even if ALLOCA is set, don't use it if compiling with GCC.
-USE_ALLOCA= ` case "${CC}" in "${OLDCC}") echo "${ALLOCA}" ;; esac `
-USE_HOST_ALLOCA= ` case "${HOST_CC}"@"${HOST_ALLOCA}" in "${OLDCC}"@?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
-USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
-USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
-
-# Dependency on obstack, alloca, malloc or whatever library facilities
-# are not installed in the system libraries.
-# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
-LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)
-
-# Likewise, for use in the tools that must run on this machine
-# even if we are cross-building GCC.
-# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
-HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC)
-
-# How to link with both our special library facilities
-# and the system's installed libraries.
-LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB)
-
-# Likewise, for use in the tools that must run on this machine
-# even if we are cross-building GCC.
-HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
- $(HOST_CLIB)
-
-HOST_RTL = $(HOST_PREFIX)rtl.o
-HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
-HOST_PRINT = $(HOST_PREFIX)print-rtl.o
-
-# Specify the directories to be searched for header files.
-# Both . and srcdir are used, in that order,
-# so that tm.h and config.h will be found in the compilation
-# subdirectory rather than in the source directory.
-INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
-
-# Always use -I$(srcdir)/config when compiling.
-.c.o:
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
-
-# This tells GNU make version 3 not to export all the variables
-# defined in this file into the environment.
-.NOEXPORT:
-
-# Support for additional languages (other than c and objc).
-# ??? objc can be supported this way too (leave for later).
-
-# These next lines are overridden by configure.
-LANG_MAKEFILES =
-LANG_STAGESTUFF =
-LANG_DIFF_EXCLUDES =
-LANG_LIB2FUNCS =
-LANG_EXTRA_HEADERS =
-
-# Flags to pass to recursive makes.
-# CC is set by configure. Hosts without symlinks need special handling
-# because we need CC="stage1/xgcc -Bstage1/" to work in the language
-# subdirectories.
-# ??? The choices here will need some experimenting with.
-FLAGS_TO_PASS = \
- "AR_FLAGS=$(AR_FLAGS)" \
- "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
- "BISON=$(BISON)" \
- "BISONFLAGS=$(BISONFLAGS)" \
- "CC=set-by-configure" \
- "CFLAGS=$(CFLAGS)" \
- "CLIB=$(CLIB)" \
- "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
- "LDFLAGS=$(LDFLAGS)" \
- "LEX=$(LEX)" \
- "LEXFLAGS=$(LEXFLAGS)" \
- "MAKEINFO=$(MAKEINFO)" \
- "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
- "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
- "RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \
- "SHELL=$(SHELL)" \
- "STAGE_PREFIX=set-by-configure" \
- "exeext=$(exeext)" \
- "objext=$(objext)" \
- "exec_prefix=$(exec_prefix)" \
- "prefix=$(prefix)" \
- "tooldir=$(tooldir)" \
- "bindir=$(bindir)" \
- "libsubdir=$(libsubdir)"
-
-# Lists of files for various purposes.
-
-# Language-specific object files for C.
-C_OBJS = c-parse.o c-lang.o c-lex.o c-pragma.o \
- c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
-
-# Language-specific object files for Objective C.
-OBJC_OBJS = objc-parse.o objc-act.o c-lex.o c-pragma.o \
- c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
-
-# Files specific to the C interpreter bytecode compiler(s).
-BC_OBJS = bc-emit.o bc-optab.o
-
-# Bytecode header files constructed at build time; vmsconfig.com wants this.
-BC_ALL = bc-arity.h bc-opcode.h bc-opname.h
-
-# Language-independent object files.
-OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
- function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o \
- varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o real.o \
- dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o \
- integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o \
- regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o \
- insn-peep.o reorg.o sched.o final.o recog.o reg-stack.o \
- insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
- profile.o \
- insn-attrtab.o $(out_object_file) getpwd.o convert.o $(EXTRA_OBJS)
-
-# GEN files are listed separately, so they can be built before doing parallel
-# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
-# them before rtl.o is compiled.
-GEN= genemit genoutput genrecog genextract genflags gencodes genconfig genpeep
-
-CCCP=cccp
-# Uncomment this line if you want to use cppmain (w/cpplib) as cpp.
-#CCCP=cppmain
-
-# Files to be copied away after each stage in building.
-STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \
- insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
- insn-attr.h insn-attrtab.c insn-opinit.c \
- stamp-flags stamp-config stamp-codes stamp-mlib \
- stamp-output stamp-recog stamp-emit stamp-extract stamp-peep \
- stamp-attr stamp-attrtab stamp-opinit stamp-proto stamp-crt stamp-crtS stamp-crt0 \
- genemit$(exeext) genoutput$(exeext) genrecog$(exeext) genextract$(exeext) \
- genflags$(exeext) gencodes$(exeext) genconfig$(exeext) genpeep$(exeext) \
- genattrtab$(exeext) genattr$(exeext) genopinit$(exeext) \
- $(BC_ALL) \
- stamp-bcarity stamp-bcopcode stamp-bcopname \
- bi-arity$(exeext) bi-opcode$(exeext) bi-opname$(exeext) \
- $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
- $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \
- protoize$(exeext) unprotoize$(exeext) \
- specs collect2$(exeext) $(USE_COLLECT2) underscore.c \
- gcov$(exeext) *.bp \
- *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \
- *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack \
- *.[si] \
- $(LANG_STAGESTUFF)
-
-# Members of libgcc1.a.
-LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
- _lshrsi3 _ashrsi3 _ashlsi3 \
- _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
- _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
- _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
- _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
- _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
-
-# Library members defined in libgcc2.c.
-LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
- _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
- _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
- _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
- _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
- _fixtfdi _fixunstfdi _floatditf \
- __gcc_bcmp _varargs __dummy _eprintf _op_new _op_vnew _new_handler \
- _op_delete _op_vdel _bb _shtab _clear_cache _trampoline __main _exit \
- _ctors _eh _pure
-
-# The files that "belong" in CONFIG_H are deliberately omitted
-# because having them there would not be useful in actual practice.
-# All they would do is cause complete recompilation every time
-# one of the machine description files is edited.
-# That may or may not be what one wants to do.
-# If it is, rm *.o is an easy way to do it.
-# CONFIG_H = $(host_xm_file) $(tm_file)
-CONFIG_H =
-RTL_H = rtl.h rtl.def machmode.h machmode.def
-TREE_H = tree.h real.h tree.def machmode.h machmode.def
-BYTECODE_H = bytecode.h bc-emit.h bc-optab.h
-
-# "t" or nothing, for building multilibbed versions of, say, crtbegin.o.
-T =
-
-# Language makefile fragments.
-
-# The following targets define the interface between us and the languages.
-#
-# all.build, all.cross, start.encap, rest.encap,
-# info, dvi,
-# install-normal, install-common, install-info, install-man,
-# uninstall, distdir,
-# mostlyclean, clean, distclean, extraclean, maintainer-clean,
-# stage1, stage2, stage3, stage4
-#
-# Each language is linked in with a series of hooks (since we can't use `::'
-# targets). The name of each hooked is "lang.${target_name}" (eg: lang.info).
-# Configure computes and adds these here.
-
-####language hooks
-
-# sed inserts language fragments after the following line.
-####language fragments
-
-# End of language makefile fragments.
-
-# Avoid a lot of time thinking about remaking Makefile.in and *.def.
-.SUFFIXES: .in .def
-
-Makefile: $(srcdir)/Makefile.in $(srcdir)/configure $(srcdir)/version.c \
- $(xmake_file) $(tmake_file) \
- $(LANG_MAKEFILES)
- cp config.status config.run
- $(SHELL) config.run
- rm -f config.run
-
-all.internal: start.encap rest.encap
-# This is what to compile if making a cross-compiler.
-# Note that we can compile enquire using the cross-compiler just built,
-# although we can't run it on this machine.
-all.cross: native gcc-cross specs stmp-headers $(LIBGCC) $(STMP_FIXPROTO) \
- $(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross
-# This is what to compile if making gcc with a cross-compiler.
-all.build: native xgcc $(EXTRA_PARTS) lang.all.build
-# This is what must be made before installing GCC and converting libraries.
-start.encap: native xgcc specs $(LIBGCC1) xlimits.h lang.start.encap
-# These can't be made until after GCC can run.
-rest.encap: stmp-headers $(LIBGCC) $(STMP_FIXPROTO) $(EXTRA_PARTS) lang.rest.encap
-# This is what is made with the host's compiler
-# whether making a cross compiler or not.
-native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
-
-# Define the names for selecting languages in LANGUAGES.
-C c: cc1
-OBJC objc: cc1obj objc-runtime
-OBJECTIVE-C objective-c: cc1obj objc-runtime
-PROTO: proto
-
-# Tell GNU make these are phony targets.
-.PHONY: C c OBJC objc OBJECTIVE-C objective-c PROTO proto
-
-# Really, really stupid make features, such as SUN's KEEP_STATE, may force
-# a target to build even if it is up-to-date. So we must verify that
-# config.status does not exist before failing.
-config.status:
- @if [ ! -f config.status ] ; then \
- echo You must configure gcc. Look at the INSTALL file for details.; \
- false; \
- else \
- true; \
- fi
-
-# On the target machine, finish building a cross compiler.
-# This does the things that can't be done on the host machine.
-rest.cross: $(LIBGCC) gfloat.h specs
-
-# Verify that it works to compile and link libgcc1-test.
-# If it does, then there are sufficient replacements for libgcc1.a.
-libgcc1-test: libgcc1-test.o native $(GCC_PARTS)
- @echo "Testing libgcc1. Ignore linker warning messages."
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \
- -nostartfiles -nostdlib `$(GCC_FOR_TARGET) --print-libgcc-file-name`
-libgcc1-test.o: libgcc1-test.c native xgcc
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/libgcc1-test.c
-
-# Recompile all the language-independent object files.
-# This is used only if the user explicitly asks for it.
-compilations: ${OBJS}
-
-# Create a list of the language-independent object files so the language
-# subdirectories needn't mention their names explicitly.
-stamp-objlist: $(OBJS) $(BC_OBJS)
- echo " $(OBJS) $(BC_OBJS)" | sed -e 's, \([a-z0-9]\), ../\1,g' -e 's/\.o/$(objext)/g' >stamp-objlist
-
-# We call this executable `xgcc' rather than `gcc'
-# to avoid confusion if the current directory is in the path
-# and CC is `gcc'. It is renamed to `gcc' when it is installed.
-xgcc: gcc.o version.o choose-temp.o pexecute.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o version.o \
- choose-temp.o pexecute.o $(EXTRA_GCC_OBJS) $(LIBS)
-
-# Dump a specs file to make -B./ read these specs over installed ones.
-specs: xgcc
- $(GCC_FOR_TARGET) -dumpspecs > tmp-specs
- mv tmp-specs specs
-
-# We do want to create an executable named `xgcc', so we can use it to
-# compile libgcc2.a.
-# Also create gcc-cross, so that install-common will install properly.
-gcc-cross: xgcc
- cp xgcc$(exeext) gcc-cross$(exeext)
-
-cc1: $(P) $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
-
-cc1obj: $(P) $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
-
-# Copy float.h from its source.
-gfloat.h: $(FLOAT_H)
- -rm -f gfloat.h
- cp $(FLOAT_H) gfloat.h
-
-# Create float.h source for the native machine.
-float.h-nat: enquire
- -./enquire -f > tmp-float.h
- mv tmp-float.h float.h-nat
-
-# Create a dummy float.h source for a cross-compiler.
-# ??? This isn't used anymore. Should we create config/float-unkn.h
-# and make that the default float_format in configure?
-float.h-cross:
- echo "#ifndef __GCC_FLOAT_NOT_NEEDED" > t-float.h-cross
- echo "#error float.h values not known for cross-compiler" >> t-float.h-cross
- echo "#endif" >> t-float.h-cross
- mv t-float.h-cross float.h-cross
-
-# Used to compile enquire with standard cc, but have forgotten why.
-# Let's try with GCC.
-enquire: enquire.o $(GCC_PARTS)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
-enquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs
-# Breaking this line caused a problem with one version of GNU make.
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) -I. -c $(srcdir)/enquire.c
-
-# Build the version of limits.h that we will install.
-xlimits.h: glimits.h limitx.h limity.h
- if $(LIMITS_H_TEST) ; then \
- cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
- else \
- cat $(srcdir)/glimits.h > tmp-xlimits.h; \
- fi
- mv tmp-xlimits.h xlimits.h
-
-# Build libgcc.a.
-# This is done in two parts because some functions, in libgcc1.c,
-# must be compiled with something other than GCC,
-# while the rest, in libgcc2.c, must be compiled with xgcc.
-# That means we can't do libgcc2.c until after xgcc, cc1, etc.
-
-# Use this as value of LIBGCC1 to cause conversion to GNU library format.
-# LIBCONVERT should put its output in libgcc1.conv.
-libgcc1.conv: libgcc1.a
- $(LIBCONVERT) libgcc1.a libgcc1.conv
-
-# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
-# Make an empty file instead.
-libgcc1.null: $(GCC_PASSES)
- echo "__foo () {}" > dummy.c
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
- $(OLDAR) $(OLDAR_FLAGS) libgcc1.null dummy$(objext)
- rm -f dummy$(objext) dummy.c
-
-# This is $(LIBGCC1) for a cross-compiler.
-# We have no automatic way of building libgcc1.a,
-# so it's up to the installer to find a way to do that.
-# This rule deliberately does not depend on libgcc1.a
-# so that it will fail if the installer hasn't provided it.
-libgcc1.cross:
- mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
-
-# Compile the library of arithmetic subroutines with the native compiler.
-# Don't compile it with GCC!
-# (That would cause most arithmetic functions to call themselves.)
-#
-# NOTE: If you modify these rules substantially, please be sure to
-# check at least config/i386/t-sco5 and possibly other makefile
-# fragments.
-libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
- -rm -f tmplibgcc1.a
-# Actually build it in tmplibgcc1.a, then rename at end,
-# so that libgcc1.a itself remains nonexistent if compilation is aborted.
-# -e causes any failing command to make this rule fail.
-# -e doesn't work in certain shells, so we test $$? as well.
-# lynx has a broken ar, it always complains when the initial library is
-# empty, thus this command works only if we don't do -e
-# There is a trailing backslash (\) deleted from the following line.
-# set -e;
- for name in $(LIB1FUNCS); \
- do \
- echo $${name}; \
- rm -f $${name}$(objext); \
- $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- mv libgcc1$(objext) $${name}$(objext); \
- $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
- rm -f $${name}$(objext); \
- done
-# Some shells crash when a loop has no items.
-# So make sure there is always at least one--`..'.
-# Then ignore it.
-# We don't use -e here because there are if statements
-# that should not make the command give up when the if condition is false.
-# Instead, we test for failure after each command where it matters.
- for file in .. $(LIB1FUNCS_EXTRA); \
- do \
- if [ x$${file} != x.. ]; then \
- name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
- echo $${name}; \
- if [ $${name}.asm = $${file} ]; then \
- cp $${file} $${name}.s || exit 1; file=$${name}.s; \
- else true; fi; \
- $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- rm -f $${name}.s $${name}$(objext); \
- else true; \
- fi; \
- done
- -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc1.a; else true; fi
- mv tmplibgcc1.a libgcc1.a
-
-# Build libgcc1.a from assembler source. LIB1ASMFUNCS is the list of
-# functions. LIB1ASMSRC is the name of the source file in the config
-# subdirectory.
-libgcc1-asm.a: libgcc2.ready config.status $(srcdir)/config/$(LIB1ASMSRC)
- -rm -f tmplibgcc1.a libgcc1.S
- cp $(srcdir)/config/$(LIB1ASMSRC) libgcc1.S
-# Actually build it in tmplibgcc1.a, then rename at end,
-# so that libgcc1-asm.a itself remains nonexistent if compilation is aborted.
-# -e causes any failing command to make this rule fail.
-# -e doesn't work in certain shells, so we test $$? as well.
-# lynx has a broken ar, it always complains when the initial library is
-# empty, thus this command works only if we don't do -e
-# There is a trailing backslash (\) deleted from the following line.
-# set -e;
- for name in $(LIB1ASMFUNCS); \
- do \
- echo $${name}; \
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- mv libgcc1$(objext) $${name}$(objext); \
- $(AR) $(AR_FLAGS) tmplibgcc1.a $${name}$(objext); \
- rm -f $${name}$(objext); \
- done
- -rm -f libgcc1.S
- mv tmplibgcc1.a libgcc1-asm.a
-
-# Generate assembly versions of the functions required for libgcc1.
-# You'll still need to massage the code by hand (possibly hacking
-# underscores and local labels) but this will get you started.
-libgcc1.S: libgcc1.c $(CONFIG_H) config.status
- -rm -f libgcc1.S
- touch libgcc1.S
- for name in $(LIB1FUNCS); \
- do \
- echo $${name}; \
- $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -S -DL$${name} $(srcdir)/libgcc1.c; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- echo '#ifdef ' L$${name} >> libgcc1.S; \
- cat libgcc1.s >> libgcc1.S; \
- echo '#endif /*' L$${name} '*/' >> libgcc1.S; \
- echo "" >> libgcc1.S; \
- done
-
-# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
-# But recompiling cc1 should not force recompilation of libgcc2.a.
-# If you want to force recompilation, delete libgcc2.a.
-libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs
- -if [ -f libgcc2.ready ] ; then \
- true; \
- else \
- touch libgcc2.ready; \
- fi
-
-libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
- $(LANG_LIB2FUNCS) machmode.h longlong.h gbl-ctors.h config.status
-# Actually build it in tmplibgcc2.a, then rename at end,
-# so that libgcc2.a itself remains nonexistent if compilation is aborted.
- -rm -f tmplibgcc2.a
-# -e causes any failing command to make this rule fail.
-# -e doesn't work in certain shells, so we test $$? as well.
-# lynx has a broken ar, it always complains when the initial library is
-# empty, thus this command works only if we don't do -e
-# There is a trailing backslash (\) deleted from the following line.
-# set -e;
- for name in $(LIB2FUNCS); \
- do \
- echo $${name}; \
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
- $(srcdir)/libgcc2.c -o $${name}$(objext); \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
- rm -f $${name}$(objext); \
- done
-# Some shells crash when a loop has no items.
-# So make sure there is always at least one--`..'.
-# Then ignore it.
-# We don't use -e here because there are if statements
-# that should not make the command give up when the if condition is false.
-# Instead, we test for failure after each command where it matters.
- for file in .. $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS); \
- do \
- if [ x$${file} != x.. ]; then \
- name=`echo $${file} | sed -e 's/[.][cSo]$$//' -e 's/[.]asm$$//' -e 's/[.]txt$$//'`; \
- oname=` echo $${name} | sed -e 's,.*/,,'`; \
- if [ $${name}.txt = $${file} ]; then \
- for f in .. `cat $${file}`; do if [ x$${f} != x.. ]; then \
- $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
- AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" \
- CFLAGS="$(CFLAGS)" HOST_PREFIX="$(HOST_PREFIX)" \
- HOST_PREFIX_1="$(HOST_PREFIX_1)" \
- LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $${f}; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- $(AR) $(AR_FLAGS) tmplibgcc2.a $${f}; \
- rm -f $${f}; \
- fi; done; \
- else \
- echo $${name}; \
- if [ $${name}.asm = $${file} ]; then \
- cp $${file} $${name}.s || exit 1; file=$${name}.s; \
- else true; fi; \
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- $(AR) $(AR_FLAGS) tmplibgcc2.a $${oname}$(objext); \
- rm -f $${name}.s $${oname}$(objext); \
- fi; \
- else true; \
- fi; \
- done
- mv tmplibgcc2.a libgcc2.a
-# These lines were deleted from above the mv command
-# because ranlibing libgcc.a itself should suffice.
-# -if [ x${HPUX_GAS} = x ] ; then \
-# if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi; \
-# else true; fi
-
-# Combine the various libraries into a single library, libgcc.a.
-libgcc.a: $(LIBGCC1) $(LIBGCC2)
- -rm -rf tmplibgcc.a libgcc.a tmpcopy
- mkdir tmpcopy
- -if [ x$(LIBGCC1) != x ]; \
- then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
- else true; \
- fi
-# Some versions of ar (specifically the one in RISC/os 5.x), create an
-# unwritable table of contents file, and then print an error message when
-# the second ar command tries to overwrite this file. To avoid the error
-# message from ar, we make sure all files are writable.
- -(cd tmpcopy; chmod +w * > /dev/null 2>&1)
- (cd tmpcopy; $(AR) x ../$(LIBGCC2))
- (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
- rm -rf tmpcopy
- -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
-# Actually build it in tmplibgcc.a, then rename at end,
-# so that libgcc.a itself remains nonexistent if compilation is aborted.
- mv tmplibgcc.a libgcc.a
-
-# Use the genmultilib shell script to generate the information the gcc
-# driver program needs to select the library directory based on the
-# switches.
-multilib.h: stamp-mlib; @true
-stamp-mlib: $(srcdir)/genmultilib Makefile
- $(SHELL) $(srcdir)/genmultilib \
- "$(MULTILIB_OPTIONS)" \
- "$(MULTILIB_DIRNAMES)" \
- "$(MULTILIB_MATCHES)" \
- "$(MULTILIB_EXCEPTIONS)" \
- "$(MULTILIB_EXTRA_OPTS)" > tmp-mlib.h
- $(srcdir)/move-if-change tmp-mlib.h multilib.h
- touch stamp-mlib
-
-# Build multiple copies of libgcc.a, one for each target switch.
-stmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \
- $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS) machmode.h longlong.h gbl-ctors.h \
- config.status
- for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
- dir=`echo $$i | sed -e 's/;.*$$//'`; \
- flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
- $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
- AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
- RANLIB="$(RANLIB)" RANLIB_TEST="$(RANLIB_TEST)" \
- HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
- LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \
- MULTILIB_CFLAGS="$${flags}" \
- LIBGCC1="$(LIBGCC1)" LIBGCC2="$(LIBGCC2)" \
- dir="$${dir}" stmp-multilib-sub; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- done
- touch stmp-multilib
-
-# Subroutine of stmp-multilib so make -n works.
-stmp-multilib-sub:
- rm -f $(LIBGCC2)
- if [ -d $(dir) ]; then \
- cd $(dir); \
- rm -f libgcc.a $(EXTRA_MULTILIB_PARTS); \
- else true; \
- fi
- $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
- AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
- HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
- LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC2)
- if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
- then true; \
- else rm -f $(LIBGCC1); \
- fi
- if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
- then true; \
- else \
- $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
- AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
- HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
- LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC1); \
- fi
- rm -rf tmplibgcc.a tmpcopy
- mkdir tmpcopy
- if [ x$(LIBGCC1) != x ]; \
- then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
- else true; \
- fi
- (cd tmpcopy; $(AR) x ../$(LIBGCC2))
- (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
- rm -rf libgcc2.a tmpcopy
- if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
- if [ -d $(dir) ]; then true; else mkdir $(dir); fi
- mv tmplibgcc.a $(dir)/libgcc.a
- for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
- $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
- AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
- HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
- MULTILIB_CFLAGS="$(MULTILIB_CFLAGS)" T="t" t$${f}; \
- mv t$${f} $(dir)/$${f}; \
- else true; \
- fi; done
-
-objc-runtime: libobjc.a
-
-# Build the Objective C runtime library.
-libobjc.a: cc1obj specs stmp-int-hdrs libgcc2.ready $(USE_COLLECT2) $(EXTRA_PARTS)
- if [ -d objc ]; then true; else mkdir objc; fi
- thisdir1=`pwd`; \
- srcdir1=`cd $(srcdir); pwd`; \
- cd objc; \
- $(MAKE) -f $${srcdir1}/objc/Makefile libobjc.a \
- srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
- GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
- GCC_CFLAGS="$(GCC_CFLAGS)" OBJC_THREAD_FILE="$(OBJC_THREAD_FILE)"
- -rm -f libobjc.a
- ln objc/libobjc.a . >/dev/null 2>&1 || cp objc/libobjc.a .
- -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi
-
-# This is used by objc/Makefile if the user runs that directly.
-sublibobjc.a: cc1obj specs stmp-int-hdrs libgcc2.ready
- thisdir1=`pwd`; \
- srcdir1=`cd $(srcdir); pwd`; \
- cd objc; \
- $(MAKE) -f $$srcdir1/objc/Makefile libobjc.a \
- srcdir=$$srcdir1 tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
- GCC_FOR_TARGET="$$thisdir1/xgcc -B$$thisdir1/" \
- GCC_CFLAGS="$(GCC_CFLAGS)" OBJC_THREAD_FILE="$(OBJC_THREAD_FILE)"
-
-# Compile two additional files that are linked with every program
-# linked using GCC on systems using COFF or ELF, for the sake of C++
-# constructors.
-$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
- -finhibit-size-directive -fno-inline-functions $(CRTSTUFF_T_CFLAGS) \
- -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o $(T)crtbegin$(objext)
-
-$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
- -finhibit-size-directive -fno-inline-functions $(CRTSTUFF_T_CFLAGS) \
- -c $(srcdir)/crtstuff.c -DCRT_END -o $(T)crtend$(objext)
-
-# On some systems we also want to install versions of these files
-# compiled using PIC for use in shared libraries.
-crtbeginS.o crtendS.o: stamp-crtS ; @true
-
-stamp-crtS: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
- -DCRT_BEGIN -finhibit-size-directive -fno-inline-functions \
- -g0 -c $(srcdir)/crtstuff.c
- mv crtstuff$(objext) crtbeginS$(objext)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
- -DCRT_END -finhibit-size-directive -fno-inline-functions \
- -g0 -c $(srcdir)/crtstuff.c -o crtendS$(objext)
- touch stamp-crtS
-
-# Compile the start modules crt0.o and mcrt0.o that are linked with every program
-crt0.o: stamp-crt0 ; @true
-mcrt0.o: stamp-crt0; @true
-
-stamp-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
- -o crt0.o -c $(CRT0_S)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
- -o mcrt0.o -c $(MCRT0_S)
- touch stamp-crt0
-
-# Compiling object files from source files.
-
-# Note that dependencies on obstack.h are not written
-# because that file is not part of GCC.
-
-# C language specific files.
-
-c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
- $(srcdir)/c-parse.h c-tree.h input.h flags.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
-$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
-$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
- cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
-$(srcdir)/c-parse.y: c-parse.in
- echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
- sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
- -e "/^ifc$$/d" -e "/^end ifc$$/d" \
- $(srcdir)/c-parse.in >>tmp-c-parse.y
- $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
-
-$(srcdir)/c-gperf.h: c-parse.gperf
- gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
- $(srcdir)/c-parse.gperf >tmp-gperf.h
- $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
-
-c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h output.h
-c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h output.h
-c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
-c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h $(srcdir)/c-parse.h \
- input.h flags.h $(srcdir)/c-gperf.h c-pragma.h
-c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
-c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
-c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H) except.h function.h \
- defaults.h c-pragma.h
-c-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
-
-# To make a configuration always use collect2, set USE_COLLECT2 to ld.
-ld: collect2
- rm -f ld$(exeext)
- ln collect2$(exeext) ld$(exeext) > /dev/null 2>&1 \
- || cp collect2$(exeext) ld$(exeext)
-
-collect2 : collect2.o cplus-dem.o underscore.o version.o \
- choose-temp.o $(LIBDEPS)
-# Don't try modifying collect2 (aka ld) in place--it might be linking this.
- -rm -f collect2$(exeext)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ collect2.o \
- cplus-dem.o underscore.o version.o choose-temp.o $(LIBS)
-
-collect2.o : collect2.c $(CONFIG_H) gstab.h obstack.h demangle.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DTARGET_MACHINE=\"$(target_alias)\" $(MAYBE_USE_COLLECT2) \
- -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
-
-cplus-dem.o: cplus-dem.c demangle.h
-
-underscore.c: stamp-under ; @true
-
-stamp-under: $(GCC_PASSES)
- echo "int xxy_us_dummy;" >tmp-dum.c
- $(GCC_FOR_TARGET) -S tmp-dum.c
- echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
- if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
- echo "int prepends_underscore = 1;" >>tmp-under.c; \
- else \
- echo "int prepends_underscore = 0;" >>tmp-under.c; \
- fi
- $(srcdir)/move-if-change tmp-under.c underscore.c
- -rm -f tmp-dum.c tmp-dum.s
- touch stamp-under
-
-# Objective C language specific files.
-
-objc-parse.o : $(srcdir)/objc-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
- c-tree.h input.h flags.h objc-act.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/objc-parse.c
-$(srcdir)/objc-parse.c : $(srcdir)/objc-parse.y
- cd $(srcdir); $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c
-$(srcdir)/objc-parse.y: $(srcdir)/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" \
- $(srcdir)/c-parse.in >>tmp-objc-prs.y
- $(srcdir)/move-if-change tmp-objc-prs.y $(srcdir)/objc-parse.y
-
-objc-act.o : objc-act.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h c-lex.h \
- flags.h objc-act.h input.h function.h $(srcdir)/c-parse.h
-
-# A file used by all variants of C.
-
-c-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
-
-# Language-independent files.
-
-DRIVER_DEFINES = \
- -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
- -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
- -DDEFAULT_TARGET_VERSION=\"$(version)\" \
- -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
- -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\"
-gcc.o: gcc.c $(CONFIG_H) multilib.h config.status $(lang_specs_files)
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(DRIVER_DEFINES) \
- -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
-
-dumpvers: dumpvers.c
-
-version.o: version.c
-obstack.o: obstack.c
-choose-temp.o: choose-temp.c
-pexecute.o: pexecute.c
-
-convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
-
-tree.o : tree.c $(CONFIG_H) $(TREE_H) flags.h function.h
-print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
-stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) flags.h function.h
-fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h
-toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) bytecode.h bc-emit.h \
- flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
- $(lang_options_files)
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
- -DTARGET_NAME=\"$(target_alias)\" \
- -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
-
-rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
-
-print-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
-rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
-
-varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
- defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h \
- output.h bytecode.h c-pragma.h
-function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
- insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
- recog.h output.h bytecode.h bc-emit.h
-stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
- insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h except.h \
- loop.h recog.h bytecode.h bc-typecd.h bc-typecd.def bc-opcode.h \
- bc-optab.h bc-emit.h
-except.o : except.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
- insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
- recog.h output.h except.h
-expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h regs.h \
- insn-flags.h insn-codes.h expr.h insn-config.h recog.h output.h \
- typeclass.h bytecode.h bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h \
- bc-emit.h modemap.def hard-reg-set.h
-calls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
- insn-flags.h
-expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
- insn-flags.h insn-config.h insn-codes.h expr.h recog.h real.h
-explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
- insn-config.h expr.h recog.h insn-flags.h insn-codes.h
-optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
- insn-flags.h insn-config.h insn-codes.h expr.h recog.h reload.h
-dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
- insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
-sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h except.h \
- function.h expr.h output.h hard-reg-set.h regs.h defaults.h real.h \
- bytecode.h obstack.h xcoffout.h c-pragma.h
-dwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
- insn-config.h reload.h output.h defaults.h
-dwarf2out.o : dwarf2out.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf2.h flags.h \
- insn-config.h reload.h output.h defaults.h hard-reg-set.h regs.h
-xcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
-emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
- function.h regs.h insn-config.h insn-codes.h real.h expr.h bytecode.h \
- bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h bc-emit.h bc-opname.h
-real.o : real.c $(CONFIG_H) $(TREE_H)
-getpwd.o : getpwd.c $(CONFIG_H)
-
-integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
- insn-flags.h insn-config.h insn-codes.h expr.h real.h regs.h function.h \
- bytecode.h
-
-jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
- insn-config.h insn-flags.h insn-codes.h expr.h real.h
-stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
-
-cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
- insn-config.h recog.h
-profile.o : profile.c $(CONFIG_H) $(RTL_H) flags.h insn-flags.h gcov-io.h \
- tree.h output.h
-loop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
- insn-flags.h insn-codes.h regs.h hard-reg-set.h recog.h expr.h real.h
-unroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
- integrate.h regs.h flags.h expr.h loop.h
-flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
- basic-block.h regs.h hard-reg-set.h output.h
-combine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h \
- insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
- basic-block.h recog.h real.h hard-reg-set.h
-regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
- basic-block.h regs.h insn-config.h recog.h reload.h real.h bytecode.h
-local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \
- regs.h hard-reg-set.h insn-config.h recog.h output.h
-global.o : global.c $(CONFIG_H) $(RTL_H) flags.h \
- basic-block.h regs.h hard-reg-set.h insn-config.h output.h
-
-reload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h output.h expr.h\
- reload.h recog.h hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
-reload1.o : reload1.c $(CONFIG_H) $(RTL_H) real.h flags.h expr.h \
- reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
- basic-block.h recog.h output.h
-caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
- regs.h hard-reg-set.h insn-codes.h insn-config.h basic-block.h recog.h \
- reload.h expr.h
-reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
- basic-block.h regs.h insn-config.h insn-attr.h insn-flags.h recog.h \
- flags.h output.h
-sched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \
- flags.h insn-config.h insn-attr.h
-final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h regs.h \
- recog.h conditions.h insn-config.h insn-attr.h except.h real.h output.h \
- hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
-recog.o : recog.c $(CONFIG_H) $(RTL_H) \
- regs.h recog.h hard-reg-set.h flags.h insn-config.h insn-attr.h \
- insn-flags.h insn-codes.h real.h
-reg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
- regs.h hard-reg-set.h flags.h insn-config.h insn-flags.h
-
-$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
- $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
- insn-flags.h output.h insn-attr.h insn-codes.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
-
-# Build auxiliary files that support ecoff format.
-mips-tfile: mips-tfile.o version.o $(LIBDEPS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
-
-mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H)
-
-mips-tdump: mips-tdump.o version.o $(LIBDEPS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS)
-
-mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H)
-
-# Build file to support OSF/rose half-pic format.
-halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H)
-
-# Normally this target is not used; but it is used if you
-# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
-# from the GNU Emacs distribution.
-alloca.o: alloca.c
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
- -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
- $(ALLOCA_FINISH)
-
-# Generate header and source files from the machine description,
-# and compile them.
-
-.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
- insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
- insn-attr.h insn-attrtab.c
-
-# The following pair of rules has this effect:
-# genconfig is run only if the md has changed since genconfig was last run;
-# but the file insn-config.h is touched only when its contents actually change.
-
-# Each of the other insn-* files is handled by a similar pair of rules.
-
-# This causes an anomaly in the results of make -n
-# because insn-* is older than stamp-*
-# and thus make -n thinks that insn-* will be updated
-# and force recompilation of things that depend on it.
-# We use move-if-change precisely to avoid such recompilation.
-# But there is no way to teach make -n that it will be avoided.
-
-# Each of the insn-*.[ch] rules has a semicolon at the end,
-# for otherwise the system Make on SunOS 4.1 never tries
-# to recompile insn-*.o. To avoid problems and extra noise from
-# versions of make which don't like empty commands (nothing after the
-# trailing `;'), we call true for each.
-
-insn-config.h: stamp-config ; @true
-stamp-config : $(md_file) genconfig $(srcdir)/move-if-change
- ./genconfig $(md_file) > tmp-config.h
- $(srcdir)/move-if-change tmp-config.h insn-config.h
- touch stamp-config
-
-insn-flags.h: stamp-flags ; @true
-stamp-flags : $(md_file) genflags $(srcdir)/move-if-change
- ./genflags $(md_file) > tmp-flags.h
- $(srcdir)/move-if-change tmp-flags.h insn-flags.h
- touch stamp-flags
-
-insn-codes.h: stamp-codes ; @true
-stamp-codes : $(md_file) gencodes $(srcdir)/move-if-change
- ./gencodes $(md_file) > tmp-codes.h
- $(srcdir)/move-if-change tmp-codes.h insn-codes.h
- touch stamp-codes
-
-insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
- insn-config.h insn-flags.h insn-codes.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
-
-insn-emit.c: stamp-emit ; @true
-stamp-emit : $(md_file) genemit $(srcdir)/move-if-change
- ./genemit $(md_file) > tmp-emit.c
- $(srcdir)/move-if-change tmp-emit.c insn-emit.c
- touch stamp-emit
-
-insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h \
- real.h output.h flags.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
-
-insn-recog.c: stamp-recog ; @true
-stamp-recog : $(md_file) genrecog $(srcdir)/move-if-change
- ./genrecog $(md_file) > tmp-recog.c
- $(srcdir)/move-if-change tmp-recog.c insn-recog.c
- touch stamp-recog
-
-insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
- insn-config.h flags.h rtl.h recog.h expr.h reload.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
-
-insn-opinit.c: stamp-opinit ; @true
-stamp-opinit : $(md_file) genopinit $(srcdir)/move-if-change
- ./genopinit $(md_file) > tmp-opinit.c
- $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
- touch stamp-opinit
-
-insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
-
-insn-extract.c: stamp-extract ; @true
-stamp-extract : $(md_file) genextract $(srcdir)/move-if-change
- ./genextract $(md_file) > tmp-extract.c
- $(srcdir)/move-if-change tmp-extract.c insn-extract.c
- touch stamp-extract
-
-insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
-
-insn-peep.c: stamp-peep ; @true
-stamp-peep : $(md_file) genpeep $(srcdir)/move-if-change
- ./genpeep $(md_file) > tmp-peep.c
- $(srcdir)/move-if-change tmp-peep.c insn-peep.c
- touch stamp-peep
-
-insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
- insn-attr.h insn-config.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
-
-insn-attr.h: stamp-attr ; @true
-stamp-attr : $(md_file) genattr $(srcdir)/move-if-change
- ./genattr $(md_file) > tmp-attr.h
- $(srcdir)/move-if-change tmp-attr.h insn-attr.h
- touch stamp-attr
-
-insn-attrtab.c: stamp-attrtab ; @true
-stamp-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
- if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file); \
- then \
- echo Using $(PREMADE_ATTRTAB); \
- cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
- else \
- ./genattrtab $(md_file) > tmp-attrtab.c; \
- fi
- $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
- touch stamp-attrtab
-
-insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
- hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h recog.h \
- insn-codes.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
-
-insn-output.c: stamp-output ; @true
-stamp-output : $(md_file) genoutput $(srcdir)/move-if-change
- ./genoutput $(md_file) > tmp-output.c
- $(srcdir)/move-if-change tmp-output.c insn-output.c
- touch stamp-output
-
-# Compile the programs that generate insn-* from the machine description.
-# They are compiled with $(HOST_CC), and associated libraries,
-# since they need to run on this machine
-# even if GCC is being compiled to run on some other machine.
-
-# $(CONFIG_H) is omitted from the deps of the gen*.o
-# because these programs don't really depend on anything
-# about the target machine. They do depend on config.h itself,
-# since that describes the host machine.
-
-# Pass the md file through cpp if the target requests it.
-$(MD_FILE): $(MD_DEPS)
- rm -f $@
- $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
- mv tmp-$@ $@
-
-genconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genconfig.o $(HOST_RTL) $(HOST_LIBS)
-
-genconfig.o : genconfig.c $(RTL_H) $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
-
-genflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genflags.o $(HOST_RTL) $(HOST_LIBS)
-
-genflags.o : genflags.c $(RTL_H) $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
-
-gencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- gencodes.o $(HOST_RTL) $(HOST_LIBS)
-
-gencodes.o : gencodes.c $(RTL_H) $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
-
-genemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genemit.o $(HOST_RTL) $(HOST_LIBS)
-
-genemit.o : genemit.c $(RTL_H) $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
-
-genopinit : genopinit.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genopinit.o $(HOST_RTL) $(HOST_LIBS)
-
-genopinit.o : genopinit.c $(RTL_H) $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
-
-genrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genrecog.o $(HOST_RTL) $(HOST_LIBS)
-
-genrecog.o : genrecog.c $(RTL_H) $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
-
-genextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genextract.o $(HOST_RTL) $(HOST_LIBS)
-
-genextract.o : genextract.c $(RTL_H) $(build_xm_file) insn-config.h
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
-
-genpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genpeep.o $(HOST_RTL) $(HOST_LIBS)
-
-genpeep.o : genpeep.c $(RTL_H) $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
-
-genattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genattr.o $(HOST_RTL) $(HOST_LIBS)
-
-genattr.o : genattr.c $(RTL_H) $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
-
-genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
-
-genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) insn-config.h
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
-
-genoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- genoutput.o $(HOST_RTL) $(HOST_LIBS)
-
-genoutput.o : genoutput.c $(RTL_H) $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
-
-# Compile the libraries to be used by gen*.
-# If we are not cross-building, gen* use the same .o's that cc1 will use,
-# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
-# with the rules for rtl.o, alloca.o, etc.
-$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
- rm -f $(HOST_PREFIX)rtl.c
- sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
-
-$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
- rm -f $(HOST_PREFIX)print-rtl.c
- sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
-
-$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
- rm -f $(HOST_PREFIX)rtlanal.c
- sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
-
-$(HOST_PREFIX_1)alloca.o: alloca.c
- rm -f $(HOST_PREFIX)alloca.c
- cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
-
-$(HOST_PREFIX_1)obstack.o: obstack.c
- rm -f $(HOST_PREFIX)obstack.c
- sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
-
-$(HOST_PREFIX_1)malloc.o: malloc.c
- rm -f $(HOST_PREFIX)malloc.c
- sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
-
-# This satisfies the dependency that we get if you cross-compile a compiler
-# that does not need to compile alloca, malloc or whatever.
-$(HOST_PREFIX_1):
- touch $(HOST_PREFIX_1)
-
-# Remake bytecode files.
-BI_OBJ=bi-parser.o bi-lexer.o bi-reverse.o
-
-bc-emit.o : bc-emit.c $(CONFIG_H) $(RTL_H) real.h $(BYTECODE_H) \
- bc-arity.h bc-opcode.h bc-typecd.h bc-typecd.def bi-run.h bytetypes.h
-bc-optab.o : bc-optab.c $(CONFIG_H) $(REAL_H) $(BYTECODE_H) \
- bc-opcode.h bc-typecd.h bc-typecd.def
-
-bi-arity: bi-arity.o $(BI_OBJ) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- bi-arity.o $(BI_OBJ) $(HOST_LIBS)
-bi-opcode: bi-opcode.o $(BI_OBJ) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- bi-opcode.o $(BI_OBJ) $(HOST_LIBS)
-bi-opname: bi-opname.o $(BI_OBJ) $(HOST_LIBDEPS)
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- bi-opname.o $(BI_OBJ) $(HOST_LIBS)
-
-$(srcdir)/bi-parser.h: $(srcdir)/bi-parser.c
-$(srcdir)/bi-parser.c: $(srcdir)/bi-parser.y
- cd $(srcdir); $(BISON) $(BISONFLAGS) -d bi-parser.y -o bi-parser.c
-
-bi-parser.o: $(srcdir)/bi-parser.c bi-defs.h $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/bi-parser.c
-bi-lexer.o: bi-lexer.c $(srcdir)/bi-parser.h $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/bi-lexer.c
-bi-arity.o: bi-arity.c bi-defs.h $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/bi-arity.c
-bi-opcode.o: bi-opcode.c bi-defs.h $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/bi-opcode.c
-bi-opname.o: bi-opname.c bi-defs.h $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/bi-opname.c
-bi-reverse.o: bi-reverse.c bi-defs.h
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/bi-reverse.c
-
-bc-arity.h: stamp-bcarity ; @true
-stamp-bcarity : $(srcdir)/bytecode.def bi-arity $(srcdir)/move-if-change
- ./bi-arity < $(srcdir)/bytecode.def >tmp-bc-arity.h
- $(srcdir)/move-if-change tmp-bc-arity.h bc-arity.h
- touch stamp-bcarity
-
-bc-opcode.h: stamp-bcopcode ; @true
-stamp-bcopcode : $(srcdir)/bytecode.def bi-opcode $(srcdir)/move-if-change
- ./bi-opcode < $(srcdir)/bytecode.def >tmp-bcopcd.h
- $(srcdir)/move-if-change tmp-bcopcd.h bc-opcode.h
- touch stamp-bcopcode
-
-bc-opname.h: stamp-bcopname ; @true
-stamp-bcopname : $(srcdir)/bytecode.def bi-opname $(srcdir)/move-if-change
- ./bi-opname < $(srcdir)/bytecode.def >tmp-bcopnm.h
- $(srcdir)/move-if-change tmp-bcopnm.h bc-opname.h
- touch stamp-bcopname
-
-bytecode.mostlyclean:
- -rm -f bc-arity.h bc-opcode.h bc-opname.h
-
-bytecode.distclean bytecode.clean: bytecode.mostlyclean
- -rm -f bi-arity bi-opcode bi-opname bi-lexer
-
-bytecode.maintainer-clean: bytecode.clean
- -rm -f bi-parser.c bi-parser.h
-
-
-# Remake cpp and protoize.
-
-# Making the preprocessor
-cpp: $(CCCP)
- -rm -f cpp$(exeext)
- ln $(CCCP)$(exeext) cpp$(exeext) > /dev/null 2>&1 \
- || cp $(CCCP)$(exeext) cpp$(exeext)
-cccp: cccp.o cexp.o version.o $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o \
- version.o $(LIBS)
-cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
-$(srcdir)/cexp.c: $(srcdir)/cexp.y
- cd $(srcdir); $(BISON) -o cexp.c cexp.y
-
-cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
-# The reason we use $(libdir)/g++-include rather than using libsubdir
-# is for compatibility with the current version of libg++.
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
- -DOLD_GPLUSPLUS_INCLUDE_DIR=\"$(old_gxx_include_dir)\" \
- -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
- -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
- -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
- -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
-
-cppmain: cppmain.o cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o \
- version.o $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cppmain.o cpplib.o cpphash.o \
- cppalloc.o cpperror.o cppexp.o version.o $(LIBS)
-
-cppmain.o: cppmain.c $(CONFIG_H) cpplib.h
-
-cpplib.o: cpplib.c $(CONFIG_H) cpplib.h cpphash.h config.status
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
- -DOLD_GPLUSPLUS_INCLUDE_DIR=\"$(old_gxx_include_dir)\" \
- -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
- -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
- -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
- -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'`
-
-cpperror.o: cpperror.c $(CONFIG_H) cpplib.h
-
-cppexp.o: cppexp.c $(CONFIG_H) cpplib.h
-
-cpphash.o: cpphash.c cpplib.h cpphash.h
-
-cppalloc.o: cppalloc.c $(CONFIG_H)
-
-# Note for the stamp targets, we run the program `true' instead of
-# having an empty command (nothing following the semicolon).
-
-proto: config.status protoize unprotoize SYSCALLS.c.X
-
-protoize: protoize.o getopt.o getopt1.o getpwd.o version.o \
- pexecute.o choose-temp.o $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- protoize.o getopt.o getopt1.o getpwd.o version.o \
- pexecute.o choose-temp.o $(LIBS)
-protoize.o: stamp-proto ; @true
-
-unprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o \
- pexecute.o choose-temp.o $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- unprotoize.o getopt.o getopt1.o getpwd.o version.o \
- pexecute.o choose-temp.o $(LIBS)
-unprotoize.o: stamp-proto ; @true
-
-stamp-proto: protoize.c getopt.h $(CONFIG_H)
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
- -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
- -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
- -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
- -DSTD_PROTO_DIR=\"$(libsubdir)\" \
- -DUNPROTOIZE $(srcdir)/protoize.c
- mv protoize$(objext) unprotoize$(objext)
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
- -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
- -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
- -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
- -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
- -DSTD_PROTO_DIR=\"$(libsubdir)\" \
- $(srcdir)/protoize.c
- touch stamp-proto
-
-getopt.o: getopt.c getopt.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
-getopt1.o: getopt1.c getopt.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
-
-# This info describes the target machine, so compile with GCC just built.
-SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
- stmp-int-hdrs
- -rm -f SYSCALLS.c tmp-SYSCALLS.s
- cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
- -rm -f SYSCALLS.c tmp-SYSCALLS.s
-
-
-test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
- -rm -f tmp-proto.[cso]
- cp $(srcdir)/protoize.c tmp-proto.c
- chmod u+w tmp-proto.c
- ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
- $(CFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=0 \
- -DGPLUSPLUS_INCLUDE_DIR=0 \
- -DCROSS_INCLUDE_DIR=0 \
- -DTOOL_INCLUDE_DIR=0 \
- -DSTD_PROTO_DIR=0" tmp-proto.c
- @echo '**********' Expect 400 lines of differences.
- -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
- -wc -l tmp-proto.diff
- ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
- $(CFLAGS) $(INCLUDES) \
- -DGCC_INCLUDE_DIR=0 \
- -DGPLUSPLUS_INCLUDE_DIR=0 \
- -DCROSS_INCLUDE_DIR=0 \
- -DTOOL_INCLUDE_DIR=0 \
- -DSTD_PROTO_DIR=0" tmp-proto.c
- @echo Expect zero differences.
- diff $(srcdir)/protoize.c tmp-proto.c | cat
- -rm -f tmp-proto.[cs] tmp-proto$(objext)
-
-gcov.o: gcov.c gcov-io.h
-
-gcov: gcov.o $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) gcov.o $(LIBS) -o $@
-
-# Build the include directory. The stamp files are stmp-* rather than
-# stamp-* so that mostlyclean does not force the include directory to
-# be rebuilt.
-
-# Build the include directory except for float.h (which depends upon
-# enquire).
-stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h objc-headers
-# Copy in the headers provided with gcc.
-# The sed command gets just the last file name component;
-# this is necessary because VPATH could add a dirname.
-# Using basename would be simpler, but some systems don't have it.
- for file in .. $(USER_H); do \
- if [ X$$file != X.. ]; then \
- realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
- rm -f include/$$realfile; \
- cp $$file include; \
- chmod a+r include/$$realfile; \
- fi; \
- done
- rm -f include/limits.h
- cp xlimits.h include/limits.h
- chmod a+r include/limits.h
-# Install the README
- rm -f include/README
- cp $(srcdir)/README-fixinc include/README
- chmod a+r include/README
- touch stmp-int-hdrs
-
-# Build the complete include directory.
-stmp-headers: stmp-int-hdrs gfloat.h
- rm -f include/float.h
- cp gfloat.h include/float.h
- chmod a+r include/float.h
- touch stmp-headers
-
-# Build fixed copies of system files.
-stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
- rm -rf include
- mkdir include
- if [ x$(FIXINCLUDES) != xMakefile.in ]; \
- then \
- for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
- if [ -d $$dir ]; \
- then \
- $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
- else true; fi; \
- done; \
- else true; \
- fi
- rm -f include/syslimits.h
- if [ -f include/limits.h ]; then \
- mv include/limits.h include/syslimits.h; \
- else \
- cp $(srcdir)/gsyslimits.h include/syslimits.h; \
- fi
- chmod a+r include/syslimits.h
- touch stmp-fixinc
-
-# copy objc header files into build directory
-objc-headers: stmp-fixinc
- if [ -d include ]; then true; else mkdir include; fi
- if [ -d objc ]; then true; else mkdir objc; fi
- thisdir1=`pwd`; \
- srcdir1=`cd $(srcdir); pwd`; \
- cd objc; \
- if [ -f $${srcdir1}/objc/Makefile ]; then \
- $(MAKE) -f $${srcdir1}/objc/Makefile copy-headers \
- srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
- GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
- GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$${thisdir1}/include; \
- fi
- touch objc-headers
-
-# Files related to the fixproto script.
-
-deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
- CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
- export CC; \
- $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h
- mv tmp-deduced.h deduced.h
-
-gen-protos: gen-protos.o scan.o cppalloc.o $(HOST_LIBDEPS)
- ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
- gen-protos.o scan.o cppalloc.o $(HOST_LIBS)
-
-gen-protos.o: gen-protos.c scan.h $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
-
-scan.o: scan.c scan.h $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
-
-xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
- cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
- mv tmp-fixtmp.c fixtmp.c
- $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
- | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
- | ./gen-protos >xsys-protos.hT
- mv xsys-protos.hT xsys-protos.h
- rm -rf fixtmp.c
-
-fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \
- cpplib.o cpphash.o cppalloc.o cppexp.o cpperror.o version.o
- $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \
- scan-decls.o scan.o cpplib.o cpphash.o cppalloc.o version.o \
- cppexp.o $(HOST_LIBS)
-
-fix-header.o: fix-header.c obstack.h scan.h xsys-protos.h $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
-
-scan-decls.o: scan-decls.c scan.h cpplib.h $(build_xm_file)
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
-
-# stmp-fixproto depends on this, not on fix-header directly.
-# The idea is to make sure fix-header gets built,
-# but not rerun fixproto after each stage
-# just because fix-header's mtime has changed.
-fixhdr.ready: fix-header
- -if [ -f fixhdr.ready ] ; then \
- true; \
- else \
- touch fixhdr.ready; \
- fi
-
-# stmp-headers is to make sure fixincludes has already finished.
-# The if statement is so that we don't run fixproto a second time
-# if it has already been run on the files in `include'.
-stmp-fixproto: fixhdr.ready fixproto stmp-headers
- @echo "Various warnings and error messages from fixproto are normal"
- -if [ -d include ] ; then true; else mkdir include; fi
- -if [ -f include/fixed ] ; then true; \
- else \
- : This line works around a 'make' bug in BSDI 1.1.; \
- FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
- $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
- touch include/fixed; \
- fi
- touch stmp-fixproto
-
-# Remake the info files.
-
-doc: info
-info: $(srcdir)/cpp.info $(srcdir)/gcc.info lang.info
-
-$(srcdir)/cpp.info: cpp.texi
- cd $(srcdir); $(MAKEINFO) $(MAKEINFOFLAGS) cpp.texi
-
-$(srcdir)/gcc.info: gcc.texi extend.texi install.texi invoke.texi \
- md.texi rtl.texi tm.texi gcov.texi
- cd $(srcdir); $(MAKEINFO) $(MAKEINFOFLAGS) gcc.texi
-
-dvi: $(srcdir)/gcc.dvi $(srcdir)/cpp.dvi lang.dvi
-
-# This works with GNU Make's default rule.
-$(srcdir)/gcc.dvi: gcc.texi extend.texi install.texi invoke.texi \
- md.texi rtl.texi tm.texi gcov.texi
- $(TEXI2DVI) $<
-
-# This works with GNU Make's default rule.
-$(srcdir)/cpp.dvi: cpp.texi
- $(TEXI2DVI) $<
-
-$(srcdir)/INSTALL: install1.texi install.texi
- $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
- `echo $(srcdir)/install1.texi | sed 's,^\./,,'`
-
-# Deletion of files made during compilation.
-# There are four levels of this:
-# `mostlyclean', `clean', `distclean' and `maintainer-clean'.
-# `mostlyclean' is useful while working on a particular type of machine.
-# It deletes most, but not all, of the files made by compilation.
-# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
-# `clean' deletes everything made by running `make all'.
-# `distclean' also deletes the files made by config.
-# `maintainer-clean' also deletes everything that could be regenerated
-# automatically. We remove as much from the language subdirectories as we can
-# (less duplicated code).
-
-
-mostlyclean: bytecode.mostlyclean lang.mostlyclean
- -rm -f $(STAGESTUFF)
-# Clean the objc subdir if we created one.
- if [ -d objc ]; then \
- srcdir1=`cd $(srcdir); pwd`; \
- cd objc; $(MAKE) -f $$srcdir1/objc/Makefile mostlyclean; \
- else true; fi
- -rm -f libobjc.a
-# Delete the temporary source copies for cross compilation.
- -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
- -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
- -rm -f $(HOST_PREFIX_1)obstack.c
-# Delete the temp files made in the course of building libgcc.a.
- -rm -f tmplibgcc* tmpcopy xlimits.h
- for name in $(LIB1FUNCS); do rm -f $${name}.c; done
-# Delete other temporary files.
- -rm -f tmp-float.h tmp-gcc.xtar.gz
- -rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
- -rm -f tmp-c-parse.y tmp-objc-prs.y tmp-gperf.h
- -rm -f tmp-specs t-float.h-cross tmp-xlimits.h
- -rm -f tmp-fixtmp.c xsys-protos.hT
-# Delete the stamp files.
- -rm -f stamp-* tmp-*
- -rm -f */stamp-* */tmp-*
-# Delete debugging dump files.
- -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
- -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack
- -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
- -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
- -rm -f */*.sched2 */*.stack
-# Delete some files made during installation.
- -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
- -rm -f collect collect2 mips-tfile mips-tdump alloca.s
-# Delete files generated for fixproto
- -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
- gen-protos fixproto.list fixtmp.* fixhdr.ready
-# Delete unwanted output files from TeX.
- -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
- -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
-# Delete sorted indices we don't actually use.
- -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
-# Delete core dumps.
- -rm -f core */core
- -rm -f *.bp */*.bp
-
-# Delete all files made by compilation
-# that don't exist in the distribution.
-clean: mostlyclean bytecode.clean lang.clean
-# It may not be quite desirable to delete unprotoize.c here,
-# but the spec for `make clean' requires it.
-# Using unprotoize.c is not quite right in the first place,
-# but what better way is there?
- -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
- -rm -f libgcc1.null
- -rm -f *.dvi
- -rm -f */*.dvi
- -if [ -f md.pre-cpp ]; then \
- rm -f md ; \
- fi
-# Delete the include directory.
- -rm -rf stmp-* include objc-headers
- -rm -f */stmp-*
-# Delete files used by the "multilib" facility (including libgcc subdirs).
- -rm -f multilib.h tmpmultilib*
- -if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
- rm -rf $(MULTILIB_DIRNAMES); \
- else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
- rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
- fi ; fi
-
-# Delete all files that users would normally create
-# while building and installing GCC.
-distclean: clean bytecode.distclean lang.distclean
- -rm -f tm.h config.h tconfig.h hconfig.h md
- -rm -f config.status config.run
- -rm -f Makefile specs.h options.h *.oaux
- -rm -fr stage1 stage2 stage3 stage4
- -rm -f */stage1 */stage2 */stage3 */stage4 */include
- -rm -f objc-parse.output
- -rm -f c-parse.output
- -rm -f *.asm
- -rm -f float.h
-
-# Delete anything likely to be found in the source directory
-# that shouldn't be in the distribution.
-extraclean: distclean lang.extraclean
- -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
- -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
- -rm -f config/*/=* config/*/"#"* config/*/*~*
- -rm -f config/*/*.orig config/*/*.rej
- -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz
- -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
- -rm -f *lose config/*lose config/*/*lose
- -rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
- -rm -f */=* */"#"* */*~*
- -rm -f */patch* */*.orig */*.rej
- -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
- -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
- -rm -f */*lose */*.s */*.s[0-9] */*.i
-
-# Get rid of every file that's generated from some other file.
-# Most of these files ARE PRESENT in the GCC distribution.
-maintainer-clean: distclean bytecode.maintainer-clean lang.maintainer-clean
- -rm -f c-parse.y c-gperf.h objc-parse.y
- -rm -f objc-parse.c objc-parse.output
- -rm -f c-parse.c c-parse.h c-parse.output
- -rm -f cexp.c cexp.output TAGS
- -rm -f cpp.info* cpp.??s cpp.*aux
- -rm -f gcc.info* gcc.??s gcc.*aux
-
-# Entry points `install' and `uninstall'.
-# Also use `install-collect2' to install collect2 when the config files don't.
-
-# The semicolon is to prevent the install.sh -> install default rule
-# from doing anything. Having it run true helps avoid problems and
-# noise from versions of make which don't like to have null commands.
-install: $(INSTALL_TARGET) ; @true
-
-# Copy the compiler files into directories where they will be run.
-# Install the driver last so that the window when things are
-# broken is small.
-install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
- install-libobjc install-man install-info lang.install-normal install-driver
-
-# Do nothing while making gcc with a cross-compiler. The person who
-# makes gcc for the target machine has to know how to put a complete
-# gcc together by hand.
-install-build: force
- @echo You have to install gcc on your target machine by hand.
-
-# Run this on the target machine
-# to finish installation of cross compiler.
-install-cross-rest: install-float-h-cross
-
-# Install float.h for cross compiler.
-# Run this on the target machine!
-install-float-h-cross: installdirs
-# if [ -f enquire ] ; then true; else false; fi
-# Note: don't use -. We should fail right away if enquire was not made.
- ./enquire -f > $(tmpdir)/float.h
- -rm -f $(libsubdir)/include/float.h
- $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
- -rm -f $(tmpdir)/float.h
- chmod a-x $(libsubdir)/include/float.h
-
-# Create the installation directories.
-installdirs:
- -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi
- -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi
- -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
- -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
-# This dir isn't currently searched by cpp.
-# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
- -if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; chmod a+rx $(libdir)/gcc-lib/$(target_alias) ; fi
- -if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version) ; chmod a+rx $(libdir)/gcc-lib/$(target_alias)/$(version) ; fi
- -if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version)/include ; chmod a+rx $(libdir)/gcc-lib/$(target_alias)/$(version)/include ; fi
- -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
- -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
- -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
- -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
- -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
-# We don't use mkdir -p to create the parents of mandir,
-# because some systems don't support it.
-# Instead, we use this technique to create the immediate parent of mandir.
- -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
- if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
- -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; chmod a+rx $(mandir) ; fi
-
-# Install the compiler executables built during cross compilation.
-install-common: native installdirs $(EXTRA_PARTS) lang.install-common
- for file in $(COMPILERS); do \
- if [ -f $$file ] ; then \
- rm -f $(libsubdir)/$$file; \
- $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
- else true; \
- fi; \
- done
- for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
- if [ x"$$file" != x.. ]; then \
- rm -f $(libsubdir)/$$file; \
- $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
- else true; fi; \
- done
- for file in $(EXTRA_PARTS) ..; do \
- if [ x"$$file" != x.. ]; then \
- rm -f $(libsubdir)/$$file; \
- $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
- else true; fi; \
- done
-# Don't mess with specs if it doesn't exist yet.
- -if [ -f specs ] ; then \
- rm -f $(libsubdir)/specs; \
- $(INSTALL_DATA) specs $(libsubdir)/specs; \
- fi
-# Install protoize if it was compiled.
- -if [ -f protoize$(exeext) ]; \
- then \
- rm -f $(bindir)/protoize$(exeext); \
- $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/protoize$(exeext); \
- rm -f $(bindir)/unprotoize$(exeext); \
- $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/unprotoize$(exeext); \
- rm -f $(libsubdir)/SYSCALLS.c.X; \
- $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
- chmod a-x $(libsubdir)/SYSCALLS.c.X; \
- fi
- -rm -f $(libsubdir)/cpp$(exeext)
- $(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
-# Install gcov if it was compiled.
- -if [ -f gcov$(exeext) ]; \
- then \
- rm -f $(bindir)/gcov$(exeext); \
- $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/gcov$(exeext); \
- chmod a+x $(bindir)/gcov$(exeext); \
- fi
-
-# Install the driver program as $(target_alias)-gcc
-# and also as either gcc (if native) or $(tooldir)/bin/gcc.
-install-driver: xgcc
- -if [ -f gcc-cross$(exeext) ] ; then \
- rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
- $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
- if [ -d $(tooldir)/bin/. ] ; then \
- rm -f $(tooldir)/bin/gcc$(exeext); \
- $(INSTALL_PROGRAM) gcc-cross$(exeext) $(tooldir)/bin/gcc$(exeext); \
- else true; fi; \
- else \
- rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
- $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
- rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
- ln $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext) \
- > /dev/null 2>&1 \
- || cp $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
- mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
- fi
-
-# Install the info files.
-install-info: doc installdirs lang.install-info
- -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
- cd $(srcdir); for f in cpp.info* gcc.info*; \
- do $(INSTALL_DATA) $$f $(infodir)/$$f; done
- -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
-
-# Install the man pages.
-install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
- -if [ -f gcc-cross ] ; then \
- rm -f $(mandir)/$(GCC_CROSS_NAME)$(manext); \
- $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_CROSS_NAME)$(manext); \
- chmod a-x $(mandir)/$(GCC_CROSS_NAME)$(manext); \
- else \
- rm -f $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
- $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
- chmod a-x $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
- fi
- -rm -f $(mandir)/cccp$(manext)
- -$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
- -chmod a-x $(mandir)/cccp$(manext)
-
-# Install the library.
-install-libgcc: libgcc.a installdirs
- -if [ -f libgcc.a ] ; then \
- rm -f $(libsubdir)/libgcc.a; \
- $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
- if $(RANLIB_TEST) ; then \
- (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
- chmod a-x $(libsubdir)/libgcc.a; \
- else true; fi
-
-# Install multiple versions of libgcc.a.
-install-multilib: stmp-multilib installdirs
- for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
- dir=`echo $$i | sed -e 's/;.*$$//'`; \
- if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
- for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \
- rm -f $(libsubdir)/$${dir}/$${f}; \
- $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \
- done; \
- if $(RANLIB_TEST); then \
- (cd $(libsubdir)/$${dir}; $(RANLIB) libgcc.a); else true; fi; \
- chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
- done
-
-# Install the objc run time library.
-install-libobjc: installdirs
- -if [ -f libobjc.a ] ; then \
- rm -f $(libsubdir)/libobjc.a; \
- $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
- if $(RANLIB_TEST) ; then \
- (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \
- chmod a-x $(libsubdir)/libobjc.a; \
- else true; fi
-
-# Install all the header files built in the include subdirectory.
-install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
-# Fix symlinks to absolute paths in the installed include directory to
-# point to the installed directory, not the build directory.
- -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
- if [ $$? -eq 0 ]; then \
- dir=`cd include; pwd`; \
- for i in $$files; do \
- dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
- if expr "$$dest" : "$$dir.*" > /dev/null; then \
- rm -f $(libsubdir)/include/$$i; \
- ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
- fi; \
- done; \
- fi
-
-# Create or recreate the gcc private include file directory.
-install-include-dir: installdirs
- -rm -rf $(libsubdir)/include
- mkdir $(libsubdir)/include
- -chmod a+rx $(libsubdir)/include
-
-# Install the include directory using tar.
-install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
- (cd include; \
- tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
-# /bin/sh on some systems returns the status of the first tar,
-# and that can lose with GNU tar which always writes a full block.
-# So use `exit 0' to ignore its exit status.
-
-# Install the include directory using cpio.
-install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
- (cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include)
-
-# Put assert.h where it won't override GNU libc's assert.h.
-# It goes in a dir that is searched after GNU libc's headers;
-# thus, the following conditionals are no longer needed.
-# But it's not worth deleting them now.
-## Don't replace the assert.h already there if it is not from GCC.
-## This code would be simpler if it tested for -f ... && ! grep ...
-## but supposedly the ! operator is missing in sh on some systems.
-install-assert-h: assert.h installdirs
- if [ -f $(assertdir)/assert.h ]; \
- then \
- if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
- then \
- rm -f $(assertdir)/assert.h; \
- $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
- chmod a-x $(assertdir)/assert.h; \
- else true; \
- fi; \
- else \
- rm -f $(assertdir)/assert.h; \
- $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
- chmod a-x $(assertdir)/assert.h; \
- fi
-
-# Use this target to install the program `collect2' under the name `ld'.
-install-collect2: collect2 installdirs
- $(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/ld$(exeext)
-# Install the driver program as $(libsubdir)/gcc for collect2.
- $(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
-
-# Cancel installation by deleting the installed files.
-uninstall: lang.uninstall
- -rm -rf $(libsubdir)
- -rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext)
- -rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext)
- -rm -rf $(bindir)/protoize$(exeext)
- -rm -rf $(bindir)/unprotoize$(exeext)
- -rm -rf $(mandir)/$(GCC_INSTALL_NAME)$(manext)
- -rm -rf $(mandir)/$(GCC_CROSS_NAME)$(manext)
- -rm -rf $(mandir)/cccp$(manext)
- -rm -rf $(mandir)/protoize$(manext)
- -rm -rf $(mandir)/unprotoize$(manext)
-
-# These exist for maintenance purposes.
-
-# Update the tags table.
-TAGS: force
- cd $(srcdir); \
- mkdir temp; \
- mv -f c-parse.[ch] objc-parse.c cexp.c =*.[chy] temp; \
- etags *.y *.h *.c; \
- mv temp/* .; \
- rmdir temp
-
-# Create the distribution tar file.
-#dist: gcc-$(version).tar.gz
-dist: gcc.xtar.gz
-
-gcc.xtar.gz: gcc.xtar
- gzip --best < gcc.xtar > tmp-gcc.xtar.gz
- mv tmp-gcc.xtar.gz gcc.xtar.gz
-
-#gcc-$(version).tar.gz: gcc-$(version).tar
-# gzip < gcc-$(version).tar > gcc-$(version).tar.gz
-
-#gcc-$(version).tar:
-gcc.xtar: distdir
-# Make the distribution.
- tar -chf gcc.xtar gcc-$(version)
-
-# This target exists to do the initial work before the language specific
-# stuff gets done.
-distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \
- $(srcdir)/objc-parse.y $(srcdir)/c-parse.c $(srcdir)/objc-parse.c \
- $(srcdir)/cexp.c
- @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
- then true; \
- else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
- fi
-# Update the version number in README
- awk '$$1 " " $$2 " " $$3 == "This directory contains" \
- { $$6 = version; print $$0 } \
- $$1 " " $$2 " " $$3 != "This directory contains"' \
- version=$(version) README > tmp.README
- mv tmp.README README
- -rm -rf gcc-$(version) tmp
-# Put all the files in a temporary subdirectory
-# which has the name that we want to have in the tar file.
- mkdir tmp
- mkdir tmp/config
- mkdir tmp/ginclude
- mkdir tmp/objc
- for file in *[0-9a-zA-Z+]; do \
- ln $$file tmp > /dev/null 2>&1 || cp $$file tmp; \
- done
- cd config; \
- for file in *[0-9a-zA-Z+]; do \
- if test -d $$file && test "$$file" != RCS; then \
- mkdir ../tmp/config/$$file; \
- cd $$file; \
- for subfile in *[0-9a-zA-Z+]; do \
- ln $$subfile ../../tmp/config/$$file >/dev/null 2>&1 \
- || cp $$subfile ../../tmp/config/$$file; \
- done; \
- cd ..; \
- else \
- ln $$file ../tmp/config >/dev/null 2>&1 \
- || cp $$file ../tmp/config; \
- fi; \
- done
- cd ginclude; \
- for file in *[0-9a-zA-Z+]; do \
- ln $$file ../tmp/ginclude >/dev/null 2>&1 \
- || cp $$file ../tmp/ginclude; \
- done
- cd objc; \
- for file in *[0-9a-zA-Z+]; do \
- ln $$file ../tmp/objc >/dev/null 2>&1 || cp $$file ../tmp/objc; \
- done
- ln .gdbinit tmp
-
-# Finish making `distdir', after the languages have done their thing.
-distdir-finish:
- mv tmp gcc-$(version)
-# Get rid of everything we don't want in the distribution. We'd want
-# this to use Makefile.in, but it doesn't have the `lang.foo' targets
-# expanded.
- cd gcc-$(version); make extraclean
-
-distdir: distdir-start lang.distdir distdir-finish
-
-# make diff oldversion=M.N
-# creates a diff file between an older distribution and this one.
-# The -P option assumes this is GNU diff.
-diff:
- diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
- -x cexp.c -x bi-parser.c -x objc-parse.y -x objc-parse.c \
- -x TAGS \
- -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
- -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
- $(LANG_DIFF_EXCLUDES) \
- gcc-$(oldversion) gcc-$(version) > diffs
-
-bootstrap: force
-# Only build the C compiler for stage1, because that is the only one that
-# we can guarantee will build with the native compiler, and also it is the
-# only thing useful for building stage2.
- $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
- $(MAKE) stage1
-# This used to define ALLOCA as empty, but that would lead to bad results
-# for a subsequent `make install' since that would not have ALLOCA empty.
-# To prevent `make install' from compiling alloca.o and then relinking cc1
-# because alloca.o is newer, we permit these recursive makes to compile
-# alloca.o. Then cc1 is newer, so it won't have to be relinked.
- $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
- $(MAKE) stage2
- $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
-
-bootstrap2: force
- $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
- $(MAKE) stage2
- $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
-
-bootstrap3: force
- $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
-
-# Compare the object files in the current directory with those in the
-# stage2 directory.
-
-# ./ avoids bug in some versions of tail.
-compare: force
- for file in *$(objext); do \
- tail +16c ./$$file > tmp-foo1; \
- tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
- && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
- done
- for dir in tmp-foo $(SUBDIRS); do \
- if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
- for file in $$dir/*$(objext); do \
- tail +16c ./$$file > tmp-foo1; \
- tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
- && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
- done; \
- fi; \
- done
- -rm -f tmp-foo*
-
-# Similar, but compare with stage3 directory
-compare3: force
- for file in *$(objext); do \
- tail +16c ./$$file > tmp-foo1; \
- tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
- && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
- done
- for dir in tmp-foo $(SUBDIRS); do \
- if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
- for file in $$dir/*$(objext); do \
- tail +16c ./$$file > tmp-foo1; \
- tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
- && (cmp tmp-foo1 tmp-foo2 || echo $$file differs) || true; \
- done; \
- fi; \
- done
- -rm -f tmp-foo*
-
-# Compare the object files in the current directory with those in the
-# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid
-# running tail and the overhead of twice copying each object file.
-
-gnucompare: force
- for file in *$(objext); do \
- cmp --ignore-initial=16 $$file stage2/$$file || true ; \
- done
- for dir in tmp-foo $(SUBDIRS); do \
- if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
- for file in $$dir/*$(objext); do \
- cmp --ignore-initial=16 $$file stage2/$$file || true ; \
- done; \
- fi; \
- done
-
-# Similar, but compare with stage3 directory
-gnucompare3: force
- for file in *$(objext); do \
- cmp --ignore-initial=16 $$file stage3/$$file || true ; \
- done
- for dir in tmp-foo $(SUBDIRS); do \
- if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
- for file in $$dir/*$(objext); do \
- cmp --ignore-initial=16 $$file stage3/$$file || true ; \
- done; \
- fi; \
- done
-
-# Copy the object files from a particular stage into a subdirectory.
-stage1-start:
- -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
- -for dir in . $(SUBDIRS) ; \
- do \
- if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
- done
- -mv $(STAGESTUFF) stage1
-# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
-# dir will work properly.
- -if [ -f as$(exeext) ] ; then ln -s ../as$(exeext) stage1 || cp as$(exeext) stage1 ; else true ; fi
- -if [ -f ld$(exeext) ] ; then ln -s ../ld$(exeext) stage1 || cp ld$(exeext) stage1 ; else true ; fi
- -if [ -f collect-ld$(exeext) ] ; then ln -s ../collect-ld$(exeext) stage1 || cp collect-ld$(exeext) stage1 ; else true ; fi
- -rm -f stage1/libgcc.a
- -cp libgcc.a stage1
- -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
- -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
- cp stage1/$${f} . ; \
- fi; done
-stage1: force stage1-start lang.stage1
-
-stage2-start:
- -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
- -for dir in . $(SUBDIRS) ; \
- do \
- if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
- done
- -mv $(STAGESTUFF) stage2
-# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
-# dir will work properly.
- -if [ -f as$(exeext) ] ; then ln -s ../as$(exeext) stage2 || cp as$(exeext) stage2 ; else true ; fi
- -if [ -f ld$(exeext) ] ; then ln -s ../ld$(exeext) stage2 || cp ld$(exeext) stage2 ; else true ; fi
- -if [ -f collect-ld ] ; then ln -s ../collect-ld$(exeext) stage2 || cp collect-ld$(exeext) stage2 ; else true ; fi
- -rm -f stage2/libgcc.a
- -cp libgcc.a stage2
- -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
- -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
- cp stage2/$${f} . ; \
- fi; done
-stage2: force stage2-start lang.stage2
-
-stage3-start:
- -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
- -for dir in . $(SUBDIRS) ; \
- do \
- if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
- done
- -mv $(STAGESTUFF) stage3
-# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
-# dir will work properly.
- -if [ -f as$(exeext) ] ; then ln -s ../as$(exeext) stage3 || cp as$(exeext) stage3 ; else true ; fi
- -if [ -f ld$(exeext) ] ; then ln -s ../ld$(exeext) stage3 || cp ld$(exeext) stage3 ; else true ; fi
- -if [ -f collect-ld$(exeext) ] ; then ln -s ../collect-ld$(exeext) stage3 || cp collect-ld$(exeext) stage3 ; else true ; fi
- -rm -f stage3/libgcc.a
- -cp libgcc.a stage3
- -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
- -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
- cp stage3/$${f} . ; \
- fi; done
-stage3: force stage3-start lang.stage3
-
-stage4-start:
- -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
- -for dir in . $(SUBDIRS) ; \
- do \
- if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
- done
- -mv $(STAGESTUFF) stage4
-# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
-# dir will work properly.
- -if [ -f as$(exeext) ] ; then ln -s ../as$(exeext) stage4 || cp as$(exeext) stage4 ; else true ; fi
- -if [ -f ld$(exeext) ] ; then ln -s ../ld$(exeext) stage4 || cp ld$(exeext) stage4 ; else true ; fi
- -if [ -f collect-ld$(exeext) ] ; then ln -s ../collect-ld$(exeext) stage4 || cp collect-ld$(exeext) stage4 ; else true ; fi
- -rm -f stage4/libgcc.a
- -cp libgcc.a stage4
- -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
- -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
- cp stage4/$${f} . ; \
- fi; done
-stage4: force stage4-start lang.stage4
-
-# Copy just the executable files from a particular stage into a subdirectory,
-# and delete the object files. Use this if you're just verifying a version
-# that is pretty sure to work, and you are short of disk space.
-risky-stage1: stage1
- - make clean
-
-risky-stage2: stage2
- -make clean
-
-risky-stage3: stage3
- -make clean
-
-risky-stage4: stage4
- -make clean
-
-#In GNU Make, ignore whether `stage*' exists.
-.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap
-.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
-
-force:
diff --git a/gcc/NEWS b/gcc/NEWS
deleted file mode 100644
index 04d8a7c1017..00000000000
--- a/gcc/NEWS
+++ /dev/null
@@ -1,797 +0,0 @@
-Noteworthy changes in GCC version 2.8.0:
-
-The -specs=file switch allows you to override default specs used in invoking
-programs like cc1, as, etc.
-
-The following new targets are supported:
-
- Solaris 2.5 running on UltraSPARC's.
- The sparclet cpu (a.out file format).
- Solaris 2.51 running on PowerPC's.
- Linux running on PowerPC's.
-
-New features for the Hitachi H8/300(H).
-
- -malign-300
- -ms
-
-The -ms switch generates code for the Hitachi H8/S processor.
-
-New features for SPARC-based systems:
-
- -mcpu=xxx
- -mtune=xxx
- -mimpure-text and -mno-impure-text
-
-New features for PowerPC-based systems running either System V, Linux, Solaris,
-or embedded systems:
-
- -mregnames
- -meabi
- -mcall-linux
- -mcall-solaris
- -mcall-sysv-eabi
- -mcall-sysv-noeabi
- -msdata
- -memb
- -mtune=xxx
- -msim
- -mmvme
-
-Options -mno-v8 and -mno-sparclite are no longer supported on SPARC
-targets. Options -mcypress, -mv8, -msupersparc, -msparclite, -mf930,
-and -mf934 are deprecated and will be deleted in GCC 2.9.
-Use -mcpu=xxx instead.
-
-GCC on the PA requires either gas-2.7 or the HP assembler; for best
-results using GAS is highly recommended. GAS is required for -g
-and exception handling support.
-
-Aix 4.1 GCC targets now default to -mcpu=common so that programs compiled can
-be moved between rs6000 and powerpc based systems. A consequence of this is
-that -static won't work, and that some programs may be slightly slower.
-
-You can select the default value to use for -mcpu=xxx on rs6000 and powerpc
-targets by using the --with-cpu=xxx option when confiuring the compiler. In
-addition, a new options, -mtune=xxx was added that selects the machine to
-schedule for but does not select the architecture level.
-
-Directory names used for storing the multilib libraries on System V and
-embedded PowerPC systems have been shortened to work with commands like tar
-that have fixed limits on pathname size.
-
-Noteworthy changes in GCC version 2.7.2:
-
-A few bugs have been fixed (most notably the generation of an
-invalid assembler opcode on some RS/6000 systems).
-
-Noteworthy changes in GCC version 2.7.1:
-
-This release fixes numerous bugs (mostly minor) in GCC 2.7.0, but
-also contains a few new features, mostly related to specific targets.
-
-Major changes have been made in code to support Windows NT.
-
-The following new targets are supported:
-
- 2.9 BSD on PDP-11
- Linux on m68k
- HP/UX version 10 on HP PA RISC (treated like version 9)
- DEC Alpha running Windows NT
-
-When parsing C, GCC now recognizes C++ style `//' comments unless you
-specify `-ansi' or `-traditional'.
-
-The PowerPC System V targets (powerpc-*-sysv, powerpc-*-eabi) now use the
-calling sequence specified in the System V Application Binary Interface
-Processor Supplement (PowerPC Processor ABI Supplement) rather than the calling
-sequence used in GCC version 2.7.0. That calling sequence was based on the AIX
-calling sequence without function descriptors. To compile code for that older
-calling sequence, either configure the compiler for powerpc-*-eabiaix or use
-the -mcall-aix switch when compiling and linking.
-
-Noteworthy changes in GCC version 2.7.0:
-
-GCC now works better on systems that use ".obj" and ".exe" instead of
-".o" and no extension. This involved changes to the driver program,
-gcc.c, to convert ".o" names to ".obj" and to GCC's Makefile to use
-".obj" and ".exe" in filenames that are not targets. In order to
-build GCC on such systems, you may need versions of GNU make and/or
-compatible shells. At this point, this support is preliminary.
-
-Object file extensions of ".obj" and executable file extensions of
-".exe" are allowed when using appropriate version of GNU Make.
-
-Numerous enhancements were made to the __attribute__ facility including
-more attributes and more places that support it. We now support the
-"packed", "nocommon", "noreturn", "volatile", "const", "unused",
-"transparent_union", "constructor", "destructor", "mode", "section",
-"align", "format", "weak", and "alias" attributes. Each of these
-names may also be specified with added underscores, e.g., "__packed__".
-__attribute__ may now be applied to parameter definitions, function
-definitions, and structure, enum, and union definitions.
-
-GCC now supports returning more structures in registers, as specified by
-many calling sequences (ABIs), such as on the HP PA RISC.
-
-A new option '-fpack-struct' was added to automatically pack all structure
-members together without holes.
-
-There is a new library (cpplib) and program (cppmain) that at some
-point will replace cpp (aka cccp). To use cppmain as cpp now, pass
-the option CCCP=cppmain to make. The library is already used by the
-fix-header program, which should speed up the fixproto script.
-
-New options for supported targets:
-
- GNU on many targets.
- NetBSD on MIPS, m68k, VAX, and x86.
- LynxOS on x86, m68k, Sparc, and RS/6000.
- VxWorks on many targets.
-
- Windows/NT on x86 architecture. Initial support for Windows/NT on Alpha
- (not fully working).
-
- Many embedded targets, specifically UDI on a29k, aout, coff, elf,
- and vsta "operating systems" on m68k, m88k, mips, sparc, and x86.
-
-Additional support for x86 (i386, i486, and Pentium):
-
- Work with old and new linkers for Linux-based GNU systems,
- supporting both a.out and ELF.
- FreeBSD on x86.
- Stdcall convention.
- -malign-double, -mregparm=, -malign-loops= and -malign-jumps= switches.
- On ISC systems, support -Xp like -posix.
-
-Additions for RS/6000:
-
- Instruction scheduling information for PowerPC 403.
- AIX 4.1 on PowerPC.
- -mstring and -mno-string.
- -msoft-float and floating-point emulation included.
- Preliminary support for PowerPC System V.4 with or without the GNU as.
- Preliminary support for EABI.
- Preliminary support for 64-bit systems.
- Both big and little endian systems.
-
-New features for MIPS-based systems:
-
- r4650.
- mips4 and R8000.
- Irix 6.0.
- 64-bit ABI.
- Allow dollar signs in labels on SGI/Irix 5.x.
-
-New support for HP PA RISC:
-
- Generation of PIC (requires binutils-2.5.2.u6 or later).
- HP-UX version 9 on HP PA RISC (dynamically links even with -g).
- Processor variants for HP PA RISC: 700, 7100, and 7100LC.
- Automatic generation of long calls when needed.
- -mfast-indirect-calls for kernels and static binaries.
-
- The called routine now copies arguments passed by invisible reference,
- as required by the calling standard.
-
-Other new miscellaneous target-specific support:
-
- -mno-multm on a29k.
- -mold-align for i960.
- Configuration for "semi-hosted" ARM.
- -momit-leaf-frame-pointer for M88k.
- SH3 variant of Hitachi Super-H and support both big and little endian.
-
-Changes to Objective-C:
-
- Bare-bones implementation of NXConstantString has been added,
- which is invoked by the @"string" directive.
-
- Class * has been changed to Class to conform to the NextSTEP and
- OpenStep runtime.
-
- Enhancements to make dynamic loading easier.
-
- The module version number has been updated to Version 7, thus existing
- code will need to be recompiled to use the current run-time library.
-
-GCC now supports the ISO Normative Addendum 1 to the C Standard.
-As a result:
-
- The header <iso646.h> defines macros for C programs written
- in national variants of ISO 646.
-
- The following digraph tokens are supported:
- <: :> <% %> %: %:%:
- These behave like the following, respectively:
- [ ] { } # ##
-
- Digraph tokens are supported unless you specify the `-traditional'
- option; you do not need to specify `-ansi' or `-trigraphs'. Except
- for contrived and unlikely examples involving preprocessor
- stringizing, digraph interpretation doesn't change the meaning of
- programs; this is unlike trigraph interpretation, which changes the
- meanings of relatively common strings.
-
- The macro __STDC_VERSION__ has the value 199409L.
-
- As usual, for full conformance to the standard, you also need a
- C library that conforms.
-
-The following lists changes that have been made to g++. If some
-features mentioned below sound unfamiliar, you will probably want to
-look at the recently-released public review copy of the C++ Working
-Paper. For PostScript and PDF (Adobe Acrobat) versions, see the
-archive at ftp://research.att.com/dist/stdc++/WP. For HTML and ASCII
-versions, see ftp://ftp.cygnus.com/pub/g++. On the web, see
-http://www.cygnus.com/~mrs/wp-draft.
-
-The scope of variables declared in the for-init-statement has been changed
-to conform to http://www.cygnus.com/~mrs/wp-draft/stmt.html#stmt.for; as a
-result, packages such as groff 1.09 will not compile unless you specify the
--fno-for-scope flag. PLEASE DO NOT REPORT THIS AS A BUG; this is a change
-mandated by the C++ standardization committee.
-
-Binary incompatibilities:
-
- The builtin 'bool' type is now the size of a machine word on RISC targets,
- for code efficiency; it remains one byte long on CISC targets.
-
- Code that does not use #pragma interface/implementation will most
- likely shrink dramatically, as g++ now only emits the vtable for a
- class in the translation unit where its first non-inline, non-abstract
- virtual function is defined.
-
- Classes that do not define the copy constructor will sometimes be
- passed and returned in registers. This may illuminate latent bugs in
- your code.
-
-Support for automatic template instantiation has *NOT* been added, due
-to a disagreement over design philosophies.
-
-Support for exception handling has been improved; more targets are now
-supported, and throws will use the RTTI mechanism to match against the
-catch parameter type. Optimization is NOT SUPPORTED with
--fhandle-exceptions; no need to report this as a bug.
-
-Support for Run-Time Type Identification has been added with -frtti.
-This support is still in alpha; one major restriction is that any file
-compiled with -frtti must include <typeinfo.h>.
-
-Preliminary support for namespaces has been added. This support is far
-from complete, and probably not useful.
-
-Synthesis of compiler-generated constructors, destructors and
-assignment operators is now deferred until the functions are used.
-
-The parsing of expressions such as `a ? b : c = 1' has changed from
-`(a ? b : c) = 1' to `a : b ? (c = 1)'.
-
-The code generated for testing conditions, especially those using ||
-and &&, is now more efficient.
-
-The operator keywords and, and_eq, bitand, bitor, compl, not, not_eq,
-or, or_eq, xor and xor_eq are now supported. Use -ansi or
--foperator-names to enable them.
-
-The 'explicit' keyword is now supported. 'explicit' is used to mark
-constructors and type conversion operators that should not be used
-implicitly.
-
-g++ now accepts the typename keyword, though it currently has no
-semantics; it can be a no-op in the current template implementation.
-You may want to start using it in your code, however, since the
-pending rewrite of the template implementation to compile STL properly
-(perhaps for 2.8.0, perhaps not) will require you to use it as
-indicated by the current draft.
-
-Handling of user-defined type conversion has been overhauled so that
-type conversion operators are now found and used properly in
-expressions and function calls.
-
--fno-strict-prototype now only applies to function declarations with
-"C" linkage.
-
-g++ now warns about 'if (x=0)' with -Wparentheses or -Wall.
-
-#pragma weak and #pragma pack are supported on System V R4 targets, as
-are various other target-specific #pragmas supported by gcc.
-
-new and delete of const types is now allowed (with no additional
-semantics).
-
-Explicit instantiation of template methods is now supported. Also,
-'inline template class foo<int>;' can be used to emit only the vtable
-for a template class.
-
-With -fcheck-new, g++ will check the return value of all calls to
-operator new, and not attempt to modify a returned null pointer.
-
-The template instantiation code now handles more conversions when
-passing to a parameter that does not depend on template arguments.
-This means that code like 'string s; cout << s;' now works.
-
-Invalid jumps in a switch statement past declarations that require
-initializations are now caught.
-
-Functions declared 'extern inline' now have the same linkage semantics
-as inline member functions. On supported targets, where previously
-these functions (and vtables, and template instantiations) would have
-been defined statically, they will now be defined as weak symbols so
-that only one out-of-line definition is used.
-
-collect2 now demangles linker output, and c++filt has become part of
-the gcc distribution.
-
-Noteworthy changes in GCC version 2.6.3:
-
-A few more bugs have been fixed.
-
-Noteworthy changes in GCC version 2.6.2:
-
-A few bugs have been fixed.
-
-Names of attributes can now be preceded and followed by double underscores.
-
-Noteworthy changes in GCC version 2.6.1:
-
-Numerous (mostly minor) bugs have been fixed.
-
-The following new configurations are supported:
-
- GNU on x86 (instead of treating it like MACH)
- NetBSD on Sparc and Motorola 68k
- AIX 4.1 on RS/6000 and PowerPC systems
- Sequent DYNUX/ptx 1.x and 2.x.
- Both COFF and ELF configurations on AViiON without using /bin/gcc
- Windows/NT on x86 architecture; preliminary
- AT&T DSP1610 digital signal processor chips
- i960 systems on bare boards using COFF
- PDP11; target only and not extensively tested
-
-The -pg option is now supported for Alpha under OSF/1 V3.0 or later.
-
-Files with an extension of ".c++" are treated as C++ code.
-
-The -Xlinker and -Wl arguments are now passed to the linker in the
-position they were specified on the command line. This makes it
-possible, for example, to pass flags to the linker about specific
-object files.
-
-The use of positional arguments to the configure script is no longer
-recommended. Use --target= to specify the target; see the GCC manual.
-
-The 386 now supports two new switches: -mreg-alloc=<string> changes
-the default register allocation order used by the compiler, and
--mno-wide-multiply disables the use of the mul/imul instructions that
-produce 64 bit results in EAX:EDX from 32 bit operands to do long long
-multiplies and 32-bit division by constants.
-
-Noteworthy changes in GCC version 2.6.0:
-
-Numerous bugs have been fixed, in the C and C++ front-ends, as
-well as in the common compiler code.
-
-This release includes the C, Objective-C, and C++ compilers. However,
-we have moved the files for the C++ compiler (G++) files to a
-subdirectory, cp. Subsequent releases of GCC will split these files
-to a separate TAR file.
-
-The G++ team has been tracking the development of the ANSI standard for C++.
-Here are some new features added from the latest working paper:
-
- * built-in boolean type 'bool', with constants 'true' and 'false'.
- * array new and delete (operator new [] and delete []).
- * WP-conforming lifetime of temporaries.
- * explicit instantiation of templates (template class A<int>;),
- along with an option (-fno-implicit-templates) to disable emission
- of implicitly instantiated templates, obsoletes -fexternal-templates.
- * static member constants (static const int foo = 4; within the
- class declaration).
-
-Many error messages have been improved to tell the user more about the
-problem. Conformance checking with -pedantic-errors has been
-improved. G++ now compiles Fresco.
-
-There is now an experimental implementation of virtual functions using
-thunks instead of Cfront-style vtables, enabled with -fvtable-thunks.
-This option also enables a heuristic which causes the compiler to only
-emit the vtable in the translation unit where its first non-inline
-virtual function is defined; using this option and
--fno-implicit-templates, users should be able to avoid #pragma
-interface/implementation altogether.
-
-Signatures have been added as a GNU C++ extension. Using the option
--fhandle-signatures, users are able to turn on recognition of
-signatures. A short introduction on signatures is in the section
-`Extension to the C++ Language' in the manual.
-
-The `g++' program is now a C program, rather than a shell script.
-
-Lots and lots and lots of bugs fixes, in nested types, access control,
-pointers to member functions, the parser, templates, overload
-resolution, etc, etc.
-
-There have been two major enhancements to the Objective-C compiler:
-
-1) Added portability. It now runs on Alpha, and some problems with
- message forwarding have been addressed on other platforms.
-
-2) Selectors have been redefined to be pointers to structs like:
- { void *sel_id, char *sel_types }, where the sel_id is the unique
- identifier, the selector itself is no longer unique.
-
- Programmers should use the new function sel_eq to test selector
- equivalence.
-
-The following major changes have been made to the base compiler and
-machine-specific files.
-
-- The MIL-STD-1750A is a new port, but still preliminary.
-
-- The h8/300h is now supported; both the h8/300 and h8/300h ports come
- with 32 bit IEEE 754 software floating point support.
-
-- The 64-bit Sparc (v9) and 64-bit MIPS chips are supported.
-
-- NetBSD is supported on m68k, Intel x86, and pc523 systems and FreeBSD
- on x86.
-
-- COFF is supported on x86, m68k, and Sparc systems running LynxOS.
-
-- 68K systems from Bull and Concurrent are supported and System V
- Release 4 is supported on the Atari.
-
-- GCC supports GAS on the Motorola 3300 (sysV68) and debugging
- (assuming GAS) on the Plexus 68K system. (However, GAS does not yet
- work on those systems).
-
-- System V Release 4 is supported on MIPS (Tandem).
-
-- For DG/UX, an ELF configuration is now supported, and both the ELF
- and BCS configurations support ELF and COFF object file formats.
-
-- OSF/1 V2.0 is supported on Alpha.
-
-- Function profiling is also supported on Alpha.
-
-- GAS and GDB is supported for Irix 5 (MIPS).
-
-- "common mode" (code that will run on both POWER and PowerPC
- architectures) is now supported for the RS/6000 family; the
- compiler knows about more PPC chips.
-
-- Both NeXTStep 2.1 and 3 are supported on 68k-based architectures.
-
-- On the AMD 29k, the -msoft-float is now supported, as well as
- -mno-sum-in-toc for RS/6000, -mapp-regs and -mflat for Sparc, and
- -membedded-pic for MIPS.
-
-- GCC can now convert division by integer constants into the equivalent
- multiplication and shift operations when that is faster than the
- division.
-
-- Two new warning options, -Wbad-function-cast and
- -Wmissing-declarations have been added.
-
-- Configurations may now add machine-specific __attribute__ options on
- type; many machines support the `section' attribute.
-
-- The -ffast-math flag permits some optimization that violate strict
- IEEE rules, such as converting X * 0.0 to 0.0.
-
-Noteworthy changes in GCC version 2.5.8:
-
-This release only fixes a few serious bugs. These include fixes for a
-bug that prevented most programs from working on the RS/6000, a bug
-that caused invalid assembler code for programs with a `switch'
-statement on the NS32K, a G++ problem that caused undefined names in
-some configurations, and several less serious problems, some of which
-can affect most configuration.
-
-Noteworthy change in GCC version 2.5.7:
-
-This release only fixes a few bugs, one of which was causing bootstrap
-compare errors on some systems.
-
-Noteworthy change in GCC version 2.5.6:
-
-A few backend bugs have been fixed, some of which only occur on one
-machine.
-
-The C++ compiler in 2.5.6 includes:
-
- * fixes for some common crashes
- * correct handling of nested types that are referenced as `foo::bar'
- * spurious warnings about friends being declared static and never
- defined should no longer appear
- * enums that are local to a method in a class, or a class that's
- local to a function, are now handled correctly. For example:
- class foo { void bar () { enum { x, y } E; x; } };
- void bar () { class foo { enum { x, y } E; E baz; }; }
-
-Noteworthy change in GCC version 2.5.5:
-
-A large number of C++ bugs have been fixed.
-
-The fixproto script adds prototypes conditionally on __cplusplus.
-
-Noteworthy change in GCC version 2.5.4:
-
-A bug fix in passing of structure arguments for the HP-PA architecture
-makes code compiled with GCC 2.5.4 incompatible with code compiled
-with earlier versions (if it passes struct arguments of 33 to 64 bits,
-interspersed with other types of arguments).
-
-Noteworthy change in gcc version 2.5.3:
-
-The method of "mangling" C++ function names has been changed. So you
-must recompile all C++ programs completely when you start using GCC
-2.5. Also, GCC 2.5 requires libg++ version 2.5. Earlier libg++
-versions won't work with GCC 2.5. (This is generally true--GCC
-version M.N requires libg++ version M.N.)
-
-Noteworthy GCC changes in version 2.5:
-
-* There is now support for the IBM 370 architecture as a target.
-Currently the only operating system supported is MVS; GCC does not run
-on MVS, so you must produce .s files using GCC as a cross compiler,
-then transfer them to MVS to assemble them. This port is not reliable
-yet.
-
-* The Power PC is now supported.
-
-* The i860-based Paragon machine is now supported.
-
-* The Hitachi 3050 (an HP-PA machine) is now supported.
-
-* The variable __GNUC_MINOR__ holds the minor version number of GCC, as
-an integer. For version 2.5.X, the value is 5.
-
-* In C, initializers for static and global variables are now processed
-an element at a time, so that they don't need a lot of storage.
-
-* The C syntax for specifying which structure field comes next in an
-initializer is now `.FIELDNAME='. The corresponding syntax for
-array initializers is now `[INDEX]='. For example,
-
- char whitespace[256]
- = { [' '] = 1, ['\t'] = 1, ['\n'] = 1 };
-
-This was changed to accord with the syntax proposed by the Numerical
-C Extensions Group (NCEG).
-
-* Complex numbers are now supported in C. Use the keyword __complex__
-to declare complex data types. See the manual for details.
-
-* GCC now supports `long double' meaningfully on the Sparc (128-bit
-floating point) and on the 386 (96-bit floating point). The Sparc
-support is enabled on on Solaris 2.x because earlier system versions
-(SunOS 4) have bugs in the emulation.
-
-* All targets now have assertions for cpu, machine and system. So you
-can now use assertions to distinguish among all supported targets.
-
-* Nested functions in C may now be inline. Just declare them inline
-in the usual way.
-
-* Packed structure members are now supported fully; it should be possible
-to access them on any supported target, no matter how little alignment
-they have.
-
-* To declare that a function does not return, you must now write
-something like this (works only in 2.5):
-
- void fatal () __attribute__ ((noreturn));
-
-or like this (works in older versions too):
-
- typedef void voidfn ();
-
- volatile voidfn fatal;
-
-It used to be possible to do so by writing this:
-
- volatile void fatal ();
-
-but it turns out that ANSI C requires that to mean something
-else (which is useless).
-
-Likewise, to declare that a function is side-effect-free
-so that calls may be deleted or combined, write
-something like this (works only in 2.5):
-
- int computation () __attribute__ ((const));
-
-or like this (works in older versions too):
-
- typedef int intfn ();
-
- const intfn computation;
-
-* The new option -iwithprefixbefore specifies a directory to add to
-the search path for include files in the same position where -I would
-put it, but uses the specified prefix just like -iwithprefix.
-
-* Basic block profiling has been enhanced to record the function the
-basic block comes from, and if the module was compiled for debugging,
-the line number and filename. A default version of the basic block
-support module has been added to libgcc2 that appends the basic block
-information to a text file 'bb.out'. Machine descriptions can now
-override the basic block support module in the target macro file.
-
-New features in g++:
-
-* The new flag `-fansi-overloading' for C++. Use a newly implemented
-scheme of argument matching for C++. It makes g++ more accurately
-obey the rules set down in Chapter 13 of the Annotated C++ Reference
-Manual (the ARM). This option will be turned on by default in a
-future release.
-
-* The -finline-debug flag is now gone (it was never really used by the
- compiler).
-
-* Recognizing the syntax for pointers to members, e.g., "foo::*bar", has been
- dramatically improved. You should not get any syntax errors or incorrect
- runtime results while using pointers to members correctly; if you do, it's
- a definite bug.
-
-* Forward declaration of an enum is now flagged as an error.
-
-* Class-local typedefs are now working properly.
-
-* Nested class support has been significantly improved. The compiler
- will now (in theory) support up to 240 nested classes before hitting
- other system limits (like memory size).
-
-* There is a new C version of the `g++' driver, to replace the old
- shell script. This should significantly improve the performance of
- executing g++ on a system where a user's PATH environment variable
- references many NFS-mounted filesystems. This driver also works
- under MS-DOS and OS/2.
-
-* The ANSI committee working on the C++ standard has adopted a new
- keyword `mutable'. This will allow you to make a specific member be
- modifiable in an otherwise const class.
-
-Noteworthy GCC changes in version 2.4.4:
-
- A crash building g++ on various hosts (including m68k) has been
- fixed. Also the g++ compiler no longer reports incorrect
- ambiguities in some situations where they do not exist, and
- const template member functions are now being found properly.
-
-Noteworthy GCC changes in version 2.4:
-
-* On each target, the default is now to return short structures
-compatibly with the "usual" compiler on that target.
-
-For most targets, this means the default is to return all structures
-in memory, like long structures, in whatever way is used on that
-target. Use -freg-struct-return to enable returning short structures
-(and unions) in registers.
-
-This change means that newly compiled binaries are incompatible with
-binaries compiled with previous versions of GCC.
-
-On some targets, GCC is itself the usual compiler. On these targets,
-the default way to return short structures is still in registers.
-Use -fpcc-struct-return to tell GCC to return them in memory.
-
-* There is now a floating point emulator which can imitate the way all
-supported target machines do floating point arithmetic.
-
-This makes it possible to have cross compilation to and from the VAX,
-and between machines of different endianness. However, this works
-only when the target machine description is updated to use the new
-facilities, and not all have been updated.
-
-This also makes possible support for longer floating point types.
-GCC 2.4 supports extended format on the 68K if you use `long double',
-for targets that have a 68881. (When we have run time library
-routines for extended floating point, then `long double' will use
-extended format on all 68K targets.)
-
-We expect to support extended floating point on the i386 and Sparc in
-future versions.
-
-* Building GCC now automatically fixes the system's header files.
-This should require no attention.
-
-* GCC now installs an unsigned data type as size_t when it fixes the
-header files (on all but a handful of old target machines).
-Therefore, the bug that size_t failed to be unsigned is fixed.
-
-* Building and installation are now completely separate.
-All new files are constructed during the build process;
-installation just copies them.
-
-* New targets supported: Clipper, Hitachi SH, Hitachi 8300, and Sparc
-Lite.
-
-* A totally new and much better Objective C run time system is included.
-
-* Objective C supports many new features. Alas, I can't describe them
-since I don't use that language; however, they are the same ones
-supported in recent versions of the NeXT operating system.
-
-* The builtin functions __builtin_apply_args, __builtin_apply and
-__builtin_return let you record the arguments and returned
-value of a function without knowing their number or type.
-
-* The builtin string variables __FUNCTION__ and __PRETTY_FUNCTION__
-give the name of the function in the source, and a pretty-printed
-version of the name. The two are the same in C, but differ in C++.
-
-* Casts to union types do not yield lvalues.
-
-* ## before an empty rest argument discards the preceding sequence
-of non-whitespace characters from the macro definition.
-(This feature is subject to change.)
-
-
-New features specific to C++:
-
-* The manual contains a new section ``Common Misunderstandings with
-GNU C++'' that C++ users should read.
-
-* #pragma interface and #pragma implementation let you use the same
-C++ source file for both interface and implementation.
-However, this mechanism is still in transition.
-
-* Named returned values let you avoid an extra constructor call
-when a function result has a class type.
-
-* The C++ operators <? and >? yield min and max, respectively.
-
-* C++ gotos can exit a block safely even if the block has
-aggregates that require destructors.
-
-* gcc defines the macro __GNUG__ when compiling C++ programs.
-
-* GNU C++ now correctly distinguishes between the prefix and postfix
-forms of overloaded operator ++ and --. To avoid breaking old
-code, if a class defines only the prefix form, the compiler
-accepts either ++obj or obj++, unless -pedantic is used.
-
-* If you are using version 2.3 of libg++, you need to rebuild it with
-`make CC=gcc' to avoid mismatches in the definition of `size_t'.
-
-Newly documented compiler options:
-
--fnostartfiles
- Omit the standard system startup files when linking.
-
--fvolatile-global
- Consider memory references to extern and global data items to
- be volatile.
-
--idirafter DIR
- Add DIR to the second include path.
-
--iprefix PREFIX
- Specify PREFIX for later -iwithprefix options.
-
--iwithprefix DIR
- Add PREFIX/DIR to the second include path.
-
--mv8
- Emit Sparc v8 code (with integer multiply and divide).
--msparclite
- Emit Sparclite code (roughly v7.5).
-
--print-libgcc-file-name
- Search for the libgcc.a file, print its absolute file name, and exit.
-
--Woverloaded-virtual
- Warn when a derived class function declaration may be an error
- in defining a C++ virtual function.
-
--Wtemplate-debugging
- When using templates in a C++ program, warn if debugging is
- not yet fully available.
-
-+eN
- Control how C++ virtual function definitions are used
- (like cfront 1.x).
-
diff --git a/gcc/PROBLEMS b/gcc/PROBLEMS
deleted file mode 100644
index bc532e641a8..00000000000
--- a/gcc/PROBLEMS
+++ /dev/null
@@ -1,117 +0,0 @@
-3. When find_reloads is used to count number of spills needed
-it does not take into account the fact that a reload may
-turn out to be a dummy.
-
-I'm not sure this really happens any more. Doesn't it find
-all the dummies on both passes?
-
-10. movl a3@,a0
- movl a3@(16),a1
- clrb a0@(a1:l)
-is generated and may be worse than
- movl a3@,a0
- addl a3@(16),a0
- clrb a0@
-If ordering of operands is improved, many more
-such cases will be generated from typical array accesses.
-
-38. Hack expand_mult so that if there is no same-modes multiply
-it will use a widening multiply and then truncate rather than
-calling the library.
-
-39. Hack expanding of division to notice cases for
-long -> short division.
-
-40. Represent divide insns as (DIV:SI ...) followed by
-a separate lowpart extract. Represent remainder insns as DIV:SI
-followed by a separate highpart extract. Then cse can work on
-the DIV:SI part. Problem is, this may not be desirable on machines
-where computing the quotient alone does not necessarily give
-a remainder--such as the 68020 for long operands.
-
-52. Reloading can look at how reload_contents got set up.
-If it was copied from a register, just reload from that register.
-Otherwise, perhaps can change the previous insn to move the
-data via the reload reg, thus avoiding one memory ref.
-
-63. Potential problem in cc_status.value2, if it ever activates itself
-after a two-address subtraction (which currently cannot happen).
-It is supposed to compare the current value of the destination
-but eliminating it would use the results of the subtraction, equivalent
-to comparing the previous value of the destination.
-
-65. Should loops that neither start nor end with a break
-be rearranged to end with the last break?
-
-69. Define the floating point converting arithmetic instructions
-for the 68881.
-
-74. Combine loop opt with cse opt in one pass. Do cse on each loop,
-then loop opt on that loop, and go from innermost loops outward.
-Make loop invariants available for cse at end of loop.
-
-85. pea can force a value to be reloaded into an areg
-which can make it worse than separate adding and pushing.
-This can only happen for adding something within addql range
-and it only loses if the qty becomes dead at that point
-so it can be added to with no copying.
-
-93. If a pseudo doesn't get a hard reg everywhere,
-can it get one during a loop?
-
-96. Can do SImode bitfield insns without reloading, but must
-alter the operands in special ways.
-
-99. final could check loop-entry branches to see if they
-screw up deletion of a test instruction. If they do,
-can put another test instruction before the branch and
-make it conditional and redirect it.
-
-106. Aliasing may be impossible if data types of refs differ
-and data type of containing objects also differ.
-(But check this wrt unions.)
-
-108. Can speed up flow analysis by making a table saying which
-register is set and which registers are used by each instruction that
-only sets one register and only uses two. This way avoid the tree
-walk for such instructions (most instructions).
-
-109. It is desirable to avoid converting INDEX to SImode if a
-narrower mode suffices, as HImode does on the 68000.
-How can this be done?
-
-110. Possible special combination pattern:
-If the two operands to a comparison die there and both come from insns
-that are identical except for replacing one operand with the other,
-throw away those insns. Ok if insns being discarded are known 1 to 1.
-An andl #1 after a seq is 1 to 1, but how should compiler know that?
-
-112. Can convert float to unsigned int by subtracting a constant,
-converting to signed int, and changing the sign bit.
-
-117. Any number of slow zero-extensions in one loop, that have
-their clr insns moved out of the loop, can share one register
-if their original life spans are disjoint.
-But it may be hard to be sure of this since
-the life span data that regscan produces may be hard to interpret
-validly or may be incorrect after cse.
-
-118. In cse, when a bfext insn refers to a register, if the field
-corresponds to a halfword or a byte and the register is equivalent
-to a memory location, it would be possible to detect this and
-replace it with a simple memory reference.
-
-121. Insns that store two values cannot be moved out of loops.
-The code in scan_loop doesn't even try to deal with them.
-
-122. When insn-output.c turns a bit-test into a sign-test,
-it should see whether the cc is already set up with that sign.
-
-123. When a conditional expression is used as a function arg, it would
-be faster (and in some cases shorter) to push each alternative rather
-than compute in a register and push that. This would require
-being able to specify "push this" as a target for expand_expr.
-
-124. On the 386, bad code results from foo (bar ()) when bar
-returns a double, because the pseudo used fails to get preferenced
-into an fp reg because of the distinction between regs 8 and 9.
diff --git a/gcc/PROJECTS b/gcc/PROJECTS
deleted file mode 100644
index ee9be0241ed..00000000000
--- a/gcc/PROJECTS
+++ /dev/null
@@ -1,448 +0,0 @@
-0. Improved efficiency.
-
-* Parse and output array initializers an element at a time, freeing
-storage after each, instead of parsing the whole initializer first and
-then outputting. This would reduce memory usage for large
-initializers.
-
-* See if the techniques describe in Oct 1991 SIGPLAN Notices
-(Frazer and Hanson) are applicable to GCC.
-
-1. Better optimization.
-
-* Constants in unused inline functions
-
-It would be nice to delay output of string constants so that string
-constants mentioned in unused inline functions are never generated.
-Perhaps this would also take care of string constants in dead code.
-
-The difficulty is in finding a clean way for the RTL which refers
-to the constant (currently, only by an assembler symbol name)
-to point to the constant and cause it to be output.
-
-* More cse
-
-The techniques for doing full global cse are described in the red
-dragon book, or (a different version) in Frederick Chow's thesis from
-Stanford. It is likely to be slow and use a lot of memory, but it
-might be worth offering as an additional option.
-
-It is probably possible to extend cse to a few very frequent cases
-without so much expense.
-
-For example, it is not very hard to handle cse through if-then
-statements with no else clauses. Here's how to do it. On reaching a
-label, notice that the label's use-count is 1 and that the last
-preceding jump jumps conditionally to this label. Now you know it
-is a simple if-then statement. Remove from the hash table
-all the expressions that were entered since that jump insn
-and you can continue with cse.
-
-It is probably not hard to handle cse from the end of a loop
-around to the beginning, and a few loops would be greatly sped
-up by this.
-
-* Optimize a sequence of if statements whose conditions are exclusive.
-
-It is possible to optimize
-
- if (x == 1) ...;
- if (x == 2) ...;
- if (x == 3) ...;
-
-into
-
- if (x == 1) ...;
- else if (x == 2) ...;
- else if (x == 3) ...;
-
-provided that x is not altered by the contents of the if statements.
-
-It's not certain whether this is worth doing. Perhaps programmers
-nearly always write the else's themselves, leaving few opportunities
-to improve anything.
-
-* Un-cse.
-
-Perhaps we should have an un-cse step right after cse, which tries to
-replace a reg with its value if the value can be substituted for the
-reg everywhere, if that looks like an improvement. Which is if the
-reg is used only a few times. Use rtx_cost to determine if the
-change is really an improvement.
-
-* Clean up how cse works.
-
-The scheme is that each value has just one hash entry. The
-first_same_value and next_same_value chains are no longer needed.
-
-For arithmetic, each hash table elt has the following slots:
-
-* Operation. This is an rtx code.
-* Mode.
-* Operands 0, 1 and 2. These point to other hash table elements.
-
-So, if we want to enter (PLUS:SI (REG:SI 30) (CONST_INT 104)), we
-first enter (CONST_INT 104) and find the entry that (REG:SI 30) now
-points to. Then we put these elts into operands 0 and 1 of a new elt.
-We put PLUS and SI into the new elt.
-
-Registers and mem refs would never be entered into the table as such.
-However, the values they contain would be entered. There would be a
-table indexed by regno which points at the hash entry for the value in
-that reg.
-
-The hash entry index now plays the role of a qty number.
-We still need qty_first_reg, reg_next_eqv, etc. to record which regs
-share a particular qty.
-
-When a reg is used whose contents are unknown, we need to create a
-hash table entry whose contents say "unknown", as a place holder for
-whatever the reg contains. If that reg is added to something, then
-the hash entry for the sum will refer to the "unknown" entry. Use
-UNKNOWN for the rtx code in this entry. This replaces make_new_qty.
-
-For a constant, a unique hash entry would be made based on the
-value of the constant.
-
-What about MEM? Each time a memory address is referenced, we need a
-qty (a hash table elt) to represent what is in it. (Just as for a
-register.) If this isn't known, create one, just as for a reg whose
-contents are unknown.
-
-We need a way to find all mem refs that still contain a certain value.
-Do this with a chain of hash elts (for memory addresses) that point to
-locations that hold the value. The hash elt for the value itself should
-point to the start of the chain. It would be good for the hash elt
-for an address to point to the hash elt for the contents of that address
-(but this ptr can be null if the contents have never been entered).
-
-With this data structure, nothing need ever be invalidated except
-the lists of which regs or mems hold a particular value. It is easy
-to see if there is a reg or mem that is equiv to a particular value.
-If the value is constant, it is always explicitly constant.
-
-* Support more general tail-recursion among different functions.
-
-This might be possible under certain circumstances, such as when
-the argument lists of the functions have the same lengths.
-Perhaps it could be done with a special declaration.
-
-You would need to verify in the calling function that it does not
-use the addresses of any local variables and does not use setjmp.
-
-* Put short statics vars at low addresses and use short addressing mode?
-
-Useful on the 68000/68020 and perhaps on the 32000 series,
-provided one has a linker that works with the feature.
-This is said to make a 15% speedup on the 68000.
-
-* Keep global variables in registers.
-
-Here is a scheme for doing this. A global variable, or a local variable
-whose address is taken, can be kept in a register for an entire function
-if it does not use non-constant memory addresses and (for globals only)
-does not call other functions. If the entire function does not meet
-this criterion, a loop may.
-
-The VAR_DECL for such a variable would have to have two RTL expressions:
-the true home in memory, and the pseudo-register used temporarily.
-It is necessary to emit insns to copy the memory location into the
-pseudo-register at the beginning of the function or loop, and perhaps
-back out at the end. These insns should have REG_EQUIV notes so that,
-if the pseudo-register does not get a hard register, it is spilled into
-the memory location which exists in any case.
-
-The easiest way to set up these insns is to modify the routine
-put_var_into_stack so that it does not apply to the entire function
-(sparing any loops which contain nothing dangerous) and to call it at
-the end of the function regardless of where in the function the
-address of a local variable is taken. It would be called
-unconditionally at the end of the function for all relevant global
-variables.
-
-For debugger output, the thing to do is to invent a new binding level
-around the appropriate loop and define the variable name as a register
-variable with that scope.
-
-* Live-range splitting.
-
-Currently a variable is allocated a hard register either for the full
-extent of its use or not at all. Sometimes it would be good to
-allocate a variable a hard register for just part of a function; for
-example, through a particular loop where the variable is mostly used,
-or outside of a particular loop where the variable is not used. (The
-latter is nice because it might let the variable be in a register most
-of the time even though the loop needs all the registers.)
-
-It might not be very hard to do this in global.c when a variable
-fails to get a hard register for its entire life span.
-
-The first step is to find a loop in which the variable is live, but
-which is not the whole life span or nearly so. It's probably best to
-use a loop in which the variable is heavily used.
-
-Then create a new pseudo-register to represent the variable in that loop.
-Substitute this for the old pseudo-register there, and insert move insns
-to copy between the two at the loop entry and all exits. (When several
-such moves are inserted at the same place, some new feature should be
-added to say that none of those registers conflict merely because of
-overlap between the new moves. And the reload pass should reorder them
-so that a store precedes a load, for any given hard register.)
-
-After doing this for all the reasonable candidates, run global-alloc
-over again. With luck, one of the two pseudo-registers will be fit
-somewhere. It may even have a much higher priority due to its reduced
-life span.
-
-There will be no room in general for the new pseudo-registers in
-basic_block_live_at_start, so there will need to be a second such
-matrix exclusively for the new ones. Various other vectors indexed by
-register number will have to be made bigger, or there will have to be
-secondary extender vectors just for global-alloc.
-
-A simple new feature could arrange that both pseudo-registers get the
-same stack slot if they both fail to get hard registers.
-
-Other compilers split live ranges when they are not connected, or
-try to split off pieces `at the edge'. I think splitting around loops
-will provide more speedup.
-
-Creating a fake binding block and a new like-named variable with
-shorter life span and different address might succeed in describing
-this technique for the debugger.
-
-* Detect dead stores into memory?
-
-A store into memory is dead if it is followed by another store into
-the same location; and, in between, there is no reference to anything
-that might be that location (including no reference to a variable
-address).
-
-* Loop optimization.
-
-Strength reduction and iteration variable elimination could be
-smarter. They should know how to decide which iteration variables are
-not worth making explicit because they can be computed as part of an
-address calculation. Based on this information, they should decide
-when it is desirable to eliminate one iteration variable and create
-another in its place.
-
-It should be possible to compute what the value of an iteration
-variable will be at the end of the loop, and eliminate the variable
-within the loop by computing that value at the loop end.
-
-When a loop has a simple increment that adds 1,
-instead of jumping in after the increment,
-decrement the loop count and jump to the increment.
-This allows aob insns to be used.
-
-* Using constraints on values.
-
-Many operations could be simplified based on knowledge of the
-minimum and maximum possible values of a register at any particular time.
-These limits could come from the data types in the tree, via rtl generation,
-or they can be deduced from operations that are performed. For example,
-the result of an `and' operation one of whose operands is 7 must be in
-the range 0 to 7. Compare instructions also tell something about the
-possible values of the operand, in the code beyond the test.
-
-Value constraints can be used to determine the results of a further
-comparison. They can also indicate that certain `and' operations are
-redundant. Constraints might permit a decrement and branch
-instruction that checks zeroness to be used when the user has
-specified to exit if negative.
-
-* Smarter reload pass.
-
-The reload pass as currently written can reload values only into registers
-that are reserved for reloading. This means that in order to use a
-register for reloading it must spill everything out of that register.
-
-It would be straightforward, though complicated, for reload1.c to keep
-track, during its scan, of which hard registers were available at each
-point in the function, and use for reloading even registers that were
-free only at the point they were needed. This would avoid much spilling
-and make better code.
-
-* Change the type of a variable.
-
-Sometimes a variable is declared as `int', it is assigned only once
-from a value of type `char', and then it is used only by comparison
-against constants. On many machines, better code would result if
-the variable had type `char'. If the compiler could detect this
-case, it could change the declaration of the variable and change
-all the places that use it.
-
-* Better handling for very sparse switches.
-
-There may be cases where it would be better to compile a switch
-statement to use a fixed hash table rather than the current
-combination of jump tables and binary search.
-
-* Order of subexpressions.
-
-It might be possible to make better code by paying attention
-to the order in which to generate code for subexpressions of an expression.
-
-* More code motion.
-
-Consider hoisting common code up past conditional branches or
-tablejumps.
-
-* Trace scheduling.
-
-This technique is said to be able to figure out which way a jump
-will usually go, and rearrange the code to make that path the
-faster one.
-
-* Distributive law.
-
-The C expression *(X + 4 * (Y + C)) compiles better on certain
-machines if rewritten as *(X + 4*C + 4*Y) because of known addressing
-modes. It may be tricky to determine when, and for which machines, to
-use each alternative.
-
-Some work has been done on this, in combine.c.
-
-* Can optimize by changing if (x) y; else z; into z; if (x) y;
-if z and x do not interfere and z has no effects not undone by y.
-This is desirable if z is faster than jumping.
-
-* For a two-insn loop on the 68020, such as
- foo: movb a2@+,a3@+
- jne foo
-it is better to insert dbeq d0,foo before the jne.
-d0 can be a junk register. The challenge is to fit this into
-a portable framework: when can you detect this situation and
-still be able to allocate a junk register?
-
-2. Simpler porting.
-
-Right now, describing the target machine's instructions is done
-cleanly, but describing its addressing mode is done with several
-ad-hoc macro definitions. Porting would be much easier if there were
-an RTL description for addressing modes like that for instructions.
-Tools analogous to genflags and genrecog would generate macros from
-this description.
-
-There would be one pattern in the address-description file for each
-kind of addressing, and this pattern would have:
-
- * the RTL expression for the address
- * C code to verify its validity (since that may depend on
- the exact data).
- * C code to print the address in assembler language.
- * C code to convert the address into a valid one, if it is not valid.
- (This would replace LEGITIMIZE_ADDRESS).
- * Register constraints for all indeterminates that appear
- in the RTL expression.
-
-3. Other languages.
-
-Front ends for Pascal, Fortran, Algol, Cobol, Modula-2 and Ada are
-desirable.
-
-Pascal, Modula-2 and Ada require the implementation of functions
-within functions. Some of the mechanisms for this already exist.
-
-4. More extensions.
-
-* Generated unique labels. Have some way of generating distinct labels
-for use in extended asm statements. I don't know what a good syntax would
-be.
-
-* A way of defining a structure containing a union, in which the choice of
-union alternative is controlled by a previous structure component.
-
-Here is a possible syntax for this.
-
-struct foo {
- enum { INT, DOUBLE } code;
- auto union { case INT: int i; case DOUBLE: double d;} value : code;
-};
-
-* Allow constructor expressions as lvalues, like this:
-
- (struct foo) {a, b, c} = foo();
-
-This would call foo, which returns a structure, and then store the
-several components of the structure into the variables a, b, and c.
-
-5. Generalize the machine model.
-
-* Some new compiler features may be needed to do a good job on machines
-where static data needs to be addressed using base registers.
-
-* Some machines have two stacks in different areas of memory, one used
-for scalars and another for large objects. The compiler does not
-now have a way to understand this.
-
-6. Useful warnings.
-
-* Warn about statements that are undefined because the order of
-evaluation of increment operators makes a big difference. Here is an
-example:
-
- *foo++ = hack (*foo);
-
-7. Better documentation of how GCC works and how to port it.
-
-Here is an outline proposed by Allan Adler.
-
-I. Overview of this document
-II. The machines on which GCC is implemented
- A. Prose description of those characteristics of target machines and
- their operating systems which are pertinent to the implementation
- of GCC.
- i. target machine characteristics
- ii. comparison of this system of machine characteristics with
- other systems of machine specification currently in use
- B. Tables of the characteristics of the target machines on which
- GCC is implemented.
- C. A priori restrictions on the values of characteristics of target
- machines, with special reference to those parts of the source code
- which entail those restrictions
- i. restrictions on individual characteristics
- ii. restrictions involving relations between various characteristics
- D. The use of GCC as a cross-compiler
- i. cross-compilation to existing machines
- ii. cross-compilation to non-existent machines
- E. Assumptions which are made regarding the target machine
- i. assumptions regarding the architecture of the target machine
- ii. assumptions regarding the operating system of the target machine
- iii. assumptions regarding software resident on the target machine
- iv. where in the source code these assumptions are in effect made
-III. A systematic approach to writing the files tm.h and xm.h
- A. Macros which require special care or skill
- B. Examples, with special reference to the underlying reasoning
-IV. A systematic approach to writing the machine description file md
- A. Minimal viable sets of insn descriptions
- B. Examples, with special reference to the underlying reasoning
-V. Uses of the file aux-output.c
-VI. Specification of what constitutes correct performance of an
- implementation of GCC
- A. The components of GCC
- B. The itinerary of a C program through GCC
- C. A system of benchmark programs
- D. What your RTL and assembler should look like with these benchmarks
- E. Fine tuning for speed and size of compiled code
-VII. A systematic procedure for debugging an implementation of GCC
- A. Use of GDB
- i. the macros in the file .gdbinit for GCC
- ii. obstacles to the use of GDB
- a. functions implemented as macros can't be called in GDB
- B. Debugging without GDB
- i. How to turn off the normal operation of GCC and access specific
- parts of GCC
- C. Debugging tools
- D. Debugging the parser
- i. how machine macros and insn definitions affect the parser
- E. Debugging the recognizer
- i. how machine macros and insn definitions affect the recognizer
-
-ditto for other components
-
-VIII. Data types used by GCC, with special reference to restrictions not
- specified in the formal definition of the data type
-IX. References to the literature for the algorithms used in GCC
-
diff --git a/gcc/README-fixinc b/gcc/README-fixinc
deleted file mode 100644
index 4b303ddc63a..00000000000
--- a/gcc/README-fixinc
+++ /dev/null
@@ -1,9 +0,0 @@
-This README file is copied into the directory for GCC-only header files
-when fixincludes is run by the makefile for GCC.
-
-Many of the files in this directory were made from the standard system
-header files of this system by the shell script `fixincludes'.
-They are system-specific, and will not work on any other kind of system.
-They are also not part of GCC. The reason for making the files here
-is to fix the places in the header files which use constructs
-that are incompatible with ANSI C.
diff --git a/gcc/README.ACORN b/gcc/README.ACORN
deleted file mode 100644
index 769dba74a33..00000000000
--- a/gcc/README.ACORN
+++ /dev/null
@@ -1,18 +0,0 @@
-Specifying the -g flag to GCC on a RISC iX machine requires upgrading the
-standard assembler distributed with both RISC iX 1.1 and RISC iX 1.2 with a
-replacement that is available from Acorn. This version of the assembler is
-also an order of magnitude faster when assembling to an NFS mounted
-file-system.
-
-Users of RISC iX 1.2 and above can obtain a copy of the assembler from the
-following places:
-
-1) Via ftp from acorn.acorn.co.uk, directory pub/riscix.
-
-2) From Acorn Customer Services.
-
-3) From Granada Microcare.
-
-Users of versions of RISC iX prior 1.2 should contact Acorn Customer Services;
-the assembler available on the net will not work with these versions due to
-changes in the shared libraries and system call numbers.
diff --git a/gcc/README.ALTOS b/gcc/README.ALTOS
deleted file mode 100644
index c0a1a04145f..00000000000
--- a/gcc/README.ALTOS
+++ /dev/null
@@ -1,55 +0,0 @@
-Since COFF-encapsulation is obsolete, this may not be needed anymore.
-
-Return-Path: <jkp@sauna.hut.fi>
-Date: Mon, 10 Apr 89 10:13:45 +0300
-From: Jyrki Kuoppala <jkp@sauna.hut.fi>
-Sender: jkp@sauna.hut.fi
-To: info-gcc@prep.ai.mit.edu
-Subject: Kernel fix needed for Altos 3068 to get coff-encapsulation working right
-Organization: Helsinki University of Technology, Finland.
-
-Here's a description how to fix a kernel bug in Altos 3068 and get
-gcc-compiled programs working.
-
-Author: Jyrki Kuoppala (jkp@cs.hut.fi)
-Last modified: Mon Apr 10 09:28:40 1989
-
-There's a bug in the Altos 3068 kernel that causes gcc-compiled
-programs to fail in certain situations when the machine has a heavy
-load and also in some other situations. The bug exists at least in
-SVR 2.2 1.0gT1 and SVR 2.2 1.0e.
-
-If you have source code to your system, apply the following change to
-os/exec.c (function gethead):
-
-Change the lines containing
-
- u.u_exdata.ux_tstart = sizeof(struct naout) +
- sizeof(struct filhd) + (ep->ef.nscns * sizeof(struct scnhdr));
-
-to
-
- u.u_exdata.ux_tstart = u.u_exdata.ux_txtorg;
-
-If you only have binary, use sdb to find out the address of the
-previous lines (on our system it's gethead+0x140) and use your
-favourite binary editor to change the bytes '3036 0162 fffc 0002 0280
-0000' to '23f9 01fb f4ca 01fb f4c2 6016'. This may or may not work in
-your case, depending on the version of the operating system and the
-phase of the moon.
-
-Here's what is just before gethead+0x140 to ease finding out the right place:
-
-0x9224 (gethead+0x122): 23f9 01fb f4ca 01fb f4ce mov.l &0x1fbf4ca.L,&0
-x1fbf4ce.L []
-0x922e (gethead+0x12c): 23f9 01fb f4c6 01fb f4ca mov.l &0x1fbf4c6.L,&0
-x1fbf4ca.L []
-0x9238 (gethead+0x136): 23f9 01fb f4c2 01fb f4c6 mov.l &0x1fbf4c2.L,&0
-x1fbf4c6.L []
-
-Good luck !
-
-//Jyrki
-
-jkp@cs.hut.fi
-
diff --git a/gcc/README.APOLLO b/gcc/README.APOLLO
deleted file mode 100644
index ca02de14284..00000000000
--- a/gcc/README.APOLLO
+++ /dev/null
@@ -1,112 +0,0 @@
-README.apollo
-
-Building GCC 2.0 for 680x0 based Apollo systems requires the GNU
-assembler (GAS) version 1.38.1, with John Vasta's patches applied.
-
-If you haven't done so yet, get `gas-1.38.1.tar.Z' from your favourite
-GNU distribution site. Furthermore, get `apollo-gas-1.38.1.diffs'
-from `labrea.stanford.edu:/pub/gnu', apply the patches, compile and
-install gas (under the name as). This should go through without any
-problems.
-
-After switching into the BSD environment, you can configure GCC 2.0
-with the command
-
-% ./configure m68k-apollo-bsd
-
-The Apollo's `/usr/include/setjmp.h' uses a nonstandard `#options()'
-construct. You should create a local copy of this file and remove
-these constructs from the declarations of SIGSETJMP and SIGLONGJMP.
-
-The Apollo's `/usr/include/sys/types.h' (BSD Version) doesn't allow
-to test for the definition of `size_t'. This should be fixed by
-
- #ifndef _SIZE_T
- #define _SIZE_T
- typedef long size_t;
- #endif
-
-The script `patch-apollo-includes' fixes these two problems, but does
-_not_ pretend to be a full fledged `fixincludes' for this system.
-
-If you now follow the standard GCC installation instructions, building
-GCC 2.0 (including G++ 2.0) should proceed without any problems.
-
-NB: Debugging is not yet supported for the Apollo. If someone wants
- to do a _big_ favour to the Apollo users, he/she should consider
- porting the Binary File Description library (BFD) to the Apollo.
- This library can be found in the gdb-4.x distributions or in the
- binutils-1.9x distributions.
-
-
-
-
-#!/bin/sh
-# patch-apollo-includes -- fix some (but not all!) Apollo brain damage.
-
-FILES_TO_PATCH='sys/types.h setjmp.h'
-
-mkdir sys
-
-for i in $FILES_TO_PATCH;
-do
- cp /bsd4.3/usr/include/$i ./$i
-done
-
-patch -b -apollo <<'EOP'
-*** /bsd4.3/usr/include/sys/types.h Fri Apr 8 20:29:06 1988
---- sys/types.h Wed Feb 26 21:17:57 1992
-***************
-*** 38,44 ****
---- 38,47 ----
- typedef char * caddr_t;
- typedef u_long ino_t;
- typedef long swblk_t;
-+ #ifndef _SIZE_T
-+ #define _SIZE_T
- typedef long size_t;
-+ #endif
- typedef long time_t;
- typedef long dev_t;
- typedef long off_t;
-*** /bsd4.3/usr/include/setjmp.h Fri Feb 3 21:40:21 1989
---- setjmp.h Sun Feb 23 19:06:55 1992
-***************
-*** 24,30 ****
---- 24,39 ----
- #endif
-
-
-+ #ifdef __GNUC__
- #ifdef _PROTOTYPES
-+ extern int sigsetjmp (sigjmp_buf env, int savemask);
-+ extern void siglongjmp (sigjmp_buf env, int val);
-+ #else
-+ extern int sigsetjmp();
-+ extern void siglongjmp();
-+ #endif /* _PROTOTYPES */
-+ #else /* not __GNUC__ */
-+ #ifdef _PROTOTYPES
- extern int sigsetjmp(
- sigjmp_buf env,
- int savemask
-***************
-*** 37,43 ****
- extern int sigsetjmp() #options(abnormal);
- extern void siglongjmp() #options(noreturn);
- #endif /* _PROTOTYPES */
-!
- #undef _PROTOTYPES
-
- #ifdef __cplusplus
---- 46,52 ----
- extern int sigsetjmp() #options(abnormal);
- extern void siglongjmp() #options(noreturn);
- #endif /* _PROTOTYPES */
-! #endif /* not __GNUC__ */
- #undef _PROTOTYPES
-
- #ifdef __cplusplus
-EOP
-
-exit 0
diff --git a/gcc/README.DWARF b/gcc/README.DWARF
deleted file mode 100644
index ac4719d0493..00000000000
--- a/gcc/README.DWARF
+++ /dev/null
@@ -1,574 +0,0 @@
-Notes on the GNU Implementation of DWARF Debugging Information
---------------------------------------------------------------
-Last Updated: Sun Jul 17 08:17:42 PDT 1994 by rfg@segfault.us.com
-------------------------------------------------------------
-
-This file describes special and unique aspects of the GNU implementation
-of the DWARF debugging information language, as provided in the GNU version
-2.x compiler(s).
-
-For general information about the DWARF debugging information language,
-you should obtain the DWARF version 1 specification document (and perhaps
-also the DWARF version 2 draft specification document) developed by the
-UNIX International Programming Languages Special Interest Group. A copy
-of the the DWARF version 1 specification (in PostScript form) may be
-obtained either from me <rfg@netcom.com> or from the main Data General
-FTP server. (See below.) The file you are looking at now only describes
-known deviations from the DWARF version 1 specification, together with
-those things which are allowed by the DWARF version 1 specification but
-which are known to cause interoperability problems (e.g. with SVR4 SDB).
-
-To obtain a copy of the DWARF Version 1 and/or DWARF Version 2 specification
-from Data General's FTP server, use the following procedure:
-
----------------------------------------------------------------------------
- ftp to machine: "dg-rtp.dg.com" (128.222.1.2).
-
- Log in as "ftp".
- cd to "plsig"
- get any of the following file you are interested in:
-
- dwarf.1.0.3.ps
- dwarf.2.0.0.index.ps
- dwarf.2.0.0.ps
----------------------------------------------------------------------------
-
-The generation of DWARF debugging information by the GNU version 2.x C
-compiler has now been tested rather extensively for m88k, i386, i860, and
-Sparc targets. The DWARF output of the GNU C compiler appears to inter-
-operate well with the standard SVR4 SDB debugger on these kinds of target
-systems (but of course, there are no guarantees).
-
-DWARF generation for the GNU g++ compiler is still not operable. This is
-due primarily to the many remaining cases where the g++ front end does not
-conform to the conventions used in the GNU C front end for representing
-various kinds of declarations in the TREE data structure. It is not clear
-at this time how these problems will be addressed.
-
-Future plans for the dwarfout.c module of the GNU compiler(s) includes the
-addition of full support for GNU FORTRAN. (This should, in theory, be a
-lot simpler to add than adding support for g++... but we'll see.)
-
-Many features of the DWARF version 2 specification have been adapted to
-(and used in) the GNU implementation of DWARF (version 1). In most of
-these cases, a DWARF version 2 approach is used in place of (or in addition
-to) DWARF version 1 stuff simply because it is apparent that DWARF version
-1 is not sufficiently expressive to provide the kinds of information which
-may be necessary to support really robust debugging. In all of these cases
-however, the use of DWARF version 2 features should not interfere in any
-way with the interoperability (of GNU compilers) with generally available
-"classic" (pre version 1) DWARF consumer tools (e.g. SVR4 SDB).
-
-The DWARF generation enhancement for the GNU compiler(s) was initially
-donated to the Free Software Foundation by Network Computing Devices.
-(Thanks NCD!) Additional development and maintenance of dwarfout.c has
-been largely supported (i.e. funded) by Intel Corporation. (Thanks Intel!)
-
-If you have questions or comments about the DWARF generation feature, please
-send mail to me <rfg@netcom.com>. I will be happy to investigate any bugs
-reported and I may even provide fixes (but of course, I can make no promises).
-
-The DWARF debugging information produced by GCC may deviate in a few minor
-(but perhaps significant) respects from the DWARF debugging information
-currently produced by other C compilers. A serious attempt has been made
-however to conform to the published specifications, to existing practice,
-and to generally accepted norms in the GNU implementation of DWARF.
-
- ** IMPORTANT NOTE ** ** IMPORTANT NOTE ** ** IMPORTANT NOTE **
-
-Under normal circumstances, the DWARF information generated by the GNU
-compilers (in an assembly language file) is essentially impossible for
-a human being to read. This fact can make it very difficult to debug
-certain DWARF-related problems. In order to overcome this difficulty,
-a feature has been added to dwarfout.c (enabled by the -fverbose-asm
-option) which causes additional comments to be placed into the assembly
-language output file, out to the right-hand side of most bits of DWARF
-material. The comments indicate (far more clearly that the obscure
-DWARF hex codes do) what is actually being encoded in DWARF. Thus, the
--fverbose-asm option can be highly useful for those who must study the
-DWARF output from the GNU compilers in detail.
-
----------
-
-(Footnote: Within this file, the term `Debugging Information Entry' will
-be abbreviated as `DIE'.)
-
-
-Release Notes (aka known bugs)
--------------------------------
-
-In one very obscure case involving dynamically sized arrays, the DWARF
-"location information" for such an array may make it appear that the
-array has been totally optimized out of existence, when in fact it
-*must* actually exist. (This only happens when you are using *both* -g
-*and* -O.) This is due to aggressive dead store elimination in the
-compiler, and to the fact that the DECL_RTL expressions associated with
-variables are not always updated to correctly reflect the effects of
-GCC's aggressive dead store elimination.
-
--------------------------------
-
-When attempting to set a breakpoint at the "start" of a function compiled
-with -g1, the debugger currently has no way of knowing exactly where the
-end of the prologue code for the function is. Thus, for most targets,
-all the debugger can do is to set the breakpoint at the AT_low_pc address
-for the function. But if you stop there and then try to look at one or
-more of the formal parameter values, they may not have been "homed" yet,
-so you may get inaccurate answers (or perhaps even addressing errors).
-
-Some people may consider this simply a non-feature, but I consider it a
-bug, and I hope to provide some some GNU-specific attributes (on function
-DIEs) which will specify the address of the end of the prologue and the
-address of the beginning of the epilogue in a future release.
-
--------------------------------
-
-It is believed at this time that old bugs relating to the AT_bit_offset
-values for bit-fields have been fixed.
-
-There may still be some very obscure bugs relating to the DWARF description
-of type `long long' bit-fields for target machines (e.g. 80x86 machines)
-where the alignment of type `long long' data objects is different from
-(and less than) the size of a type `long long' data object.
-
-Please report any problems with the DWARF description of bit-fields as you
-would any other GCC bug. (Procedures for bug reporting are given in the
-GNU C compiler manual.)
-
---------------------------------
-
-At this time, GCC does not know how to handle the GNU C "nested functions"
-extension. (See the GCC manual for more info on this extension to ANSI C.)
-
---------------------------------
-
-The GNU compilers now represent inline functions (and inlined instances
-thereof) in exactly the manner described by the current DWARF version 2
-(draft) specification. The version 1 specification for handling inline
-functions (and inlined instances) was known to be brain-damaged (by the
-PLSIG) when the version 1 spec was finalized, but it was simply too late
-in the cycle to get it removed before the version 1 spec was formally
-released to the public (by UI).
-
---------------------------------
-
-At this time, GCC does not generate the kind of really precise information
-about the exact declared types of entities with signed integral types which
-is required by the current DWARF draft specification.
-
-Specifically, the current DWARF draft specification seems to require that
-the type of an non-unsigned integral bit-field member of a struct or union
-type be represented as either a "signed" type or as a "plain" type,
-depending upon the the exact set of keywords that were used in the
-type specification for the given bit-field member. It was felt (by the
-UI/PLSIG) that this distinction between "plain" and "signed" integral types
-could have some significance (in the case of bit-fields) because ANSI C
-does not constrain the signedness of a plain bit-field, whereas it does
-constrain the signedness of an explicitly "signed" bit-field. For this
-reason, the current DWARF specification calls for compilers to produce
-type information (for *all* integral typed entities... not just bit-fields)
-which explicitly indicates the signedness of the relevant type to be
-"signed" or "plain" or "unsigned".
-
-Unfortunately, the GNU DWARF implementation is currently incapable of making
-such distinctions.
-
---------------------------------
-
-
-Known Interoperability Problems
--------------------------------
-
-Although the GNU implementation of DWARF conforms (for the most part) with
-the current UI/PLSIG DWARF version 1 specification (with many compatible
-version 2 features added in as "vendor specific extensions" just for good
-measure) there are a few known cases where GCC's DWARF output can cause
-some confusion for "classic" (pre version 1) DWARF consumers such as the
-System V Release 4 SDB debugger. These cases are described in this section.
-
---------------------------------
-
-The DWARF version 1 specification includes the fundamental type codes
-FT_ext_prec_float, FT_complex, FT_dbl_prec_complex, and FT_ext_prec_complex.
-Since GNU C is only a C compiler (and since C doesn't provide any "complex"
-data types) the only one of these fundamental type codes which GCC ever
-generates is FT_ext_prec_float. This fundamental type code is generated
-by GCC for the `long double' data type. Unfortunately, due to an apparent
-bug in the SVR4 SDB debugger, SDB can become very confused wherever any
-attempt is made to print a variable, parameter, or field whose type was
-given in terms of FT_ext_prec_float.
-
-(Actually, SVR4 SDB fails to understand *any* of the four fundamental type
-codes mentioned here. This will fact will cause additional problems when
-there is a GNU FORTRAN front-end.)
-
---------------------------------
-
-In general, it appears that SVR4 SDB is not able to effectively ignore
-fundamental type codes in the "implementation defined" range. This can
-cause problems when a program being debugged uses the `long long' data
-type (or the signed or unsigned varieties thereof) because these types
-are not defined by ANSI C, and thus, GCC must use its own private fundamental
-type codes (from the implementation-defined range) to represent these types.
-
---------------------------------
-
-
-General GNU DWARF extensions
-----------------------------
-
-In the current DWARF version 1 specification, no mechanism is specified by
-which accurate information about executable code from include files can be
-properly (and fully) described. (The DWARF version 2 specification *does*
-specify such a mechanism, but it is about 10 times more complicated than
-it needs to be so I'm not terribly anxious to try to implement it right
-away.)
-
-In the GNU implementation of DWARF version 1, a fully downward-compatible
-extension has been implemented which permits the GNU compilers to specify
-which executable lines come from which files. This extension places
-additional information (about source file names) in GNU-specific sections
-(which should be totally ignored by all non-GNU DWARF consumers) so that
-this extended information can be provided (to GNU DWARF consumers) in a way
-which is totally transparent (and invisible) to non-GNU DWARF consumers
-(e.g. the SVR4 SDB debugger). The additional information is placed *only*
-in specialized GNU-specific sections, where it should never even be seen
-by non-GNU DWARF consumers.
-
-To understand this GNU DWARF extension, imagine that the sequence of entries
-in the .lines section is broken up into several subsections. Each contiguous
-sequence of .line entries which relates to a sequence of lines (or statements)
-from one particular file (either a `base' file or an `include' file) could
-be called a `line entries chunk' (LEC).
-
-For each LEC there is one entry in the .debug_srcinfo section.
-
-Each normal entry in the .debug_srcinfo section consists of two 4-byte
-words of data as follows:
-
- (1) The starting address (relative to the entire .line section)
- of the first .line entry in the relevant LEC.
-
- (2) The starting address (relative to the entire .debug_sfnames
- section) of a NUL terminated string representing the
- relevant filename. (This filename name be either a
- relative or an absolute filename, depending upon how the
- given source file was located during compilation.)
-
-Obviously, each .debug_srcinfo entry allows you to find the relevant filename,
-and it also points you to the first .line entry that was generated as a result
-of having compiled a given source line from the given source file.
-
-Each subsequent .line entry should also be assumed to have been produced
-as a result of compiling yet more lines from the same file. The end of
-any given LEC is easily found by looking at the first 4-byte pointer in
-the *next* .debug_srcinfo entry. That next .debug_srcinfo entry points
-to a new and different LEC, so the preceding LEC (implicitly) must have
-ended with the last .line section entry which occurs at the 2 1/2 words
-just before the address given in the first pointer of the new .debug_srcinfo
-entry.
-
-The following picture may help to clarify this feature. Let's assume that
-`LE' stands for `.line entry'. Also, assume that `* 'stands for a pointer.
-
-
- .line section .debug_srcinfo section .debug_sfnames section
- ----------------------------------------------------------------
-
- LE <---------------------- *
- LE * -----------------> "foobar.c" <---
- LE |
- LE |
- LE <---------------------- * |
- LE * -----------------> "foobar.h" <| |
- LE | |
- LE | |
- LE <---------------------- * | |
- LE * -----------------> "inner.h" | |
- LE | |
- LE <---------------------- * | |
- LE * ------------------------------- |
- LE |
- LE |
- LE |
- LE |
- LE <---------------------- * |
- LE * -----------------------------------
- LE
- LE
- LE
-
-In effect, each entry in the .debug_srcinfo section points to *both* a
-filename (in the .debug_sfnames section) and to the start of a block of
-consecutive LEs (in the .line section).
-
-Note that just like in the .line section, there are specialized first and
-last entries in the .debug_srcinfo section for each object file. These
-special first and last entries for the .debug_srcinfo section are very
-different from the normal .debug_srcinfo section entries. They provide
-additional information which may be helpful to a debugger when it is
-interpreting the data in the .debug_srcinfo, .debug_sfnames, and .line
-sections.
-
-The first entry in the .debug_srcinfo section for each compilation unit
-consists of five 4-byte words of data. The contents of these five words
-should be interpreted (by debuggers) as follows:
-
- (1) The starting address (relative to the entire .line section)
- of the .line section for this compilation unit.
-
- (2) The starting address (relative to the entire .debug_sfnames
- section) of the .debug_sfnames section for this compilation
- unit.
-
- (3) The starting address (in the execution virtual address space)
- of the .text section for this compilation unit.
-
- (4) The ending address plus one (in the execution virtual address
- space) of the .text section for this compilation unit.
-
- (5) The date/time (in seconds since midnight 1/1/70) at which the
- compilation of this compilation unit occurred. This value
- should be interpreted as an unsigned quantity because gcc
- might be configured to generate a default value of 0xffffffff
- in this field (in cases where it is desired to have object
- files created at different times from identical source files
- be byte-for-byte identical). By default, these timestamps
- are *not* generated by dwarfout.c (so that object files
- compiled at different times will be byte-for-byte identical).
- If you wish to enable this "timestamp" feature however, you
- can simply place a #define for the symbol `DWARF_TIMESTAMPS'
- in your target configuration file and then rebuild the GNU
- compiler(s).
-
-Note that the first string placed into the .debug_sfnames section for each
-compilation unit is the name of the directory in which compilation occurred.
-This string ends with a `/' (to help indicate that it is the pathname of a
-directory). Thus, the second word of each specialized initial .debug_srcinfo
-entry for each compilation unit may be used as a pointer to the (string)
-name of the compilation directory, and that string may in turn be used to
-"absolutize" any relative pathnames which may appear later on in the
-.debug_sfnames section entries for the same compilation unit.
-
-The fifth and last word of each specialized starting entry for a compilation
-unit in the .debug_srcinfo section may (depending upon your configuration)
-indicate the date/time of compilation, and this may be used (by a debugger)
-to determine if any of the source files which contributed code to this
-compilation unit are newer than the object code for the compilation unit
-itself. If so, the debugger may wish to print an "out-of-date" warning
-about the compilation unit.
-
-The .debug_srcinfo section associated with each compilation will also have
-a specialized terminating entry. This terminating .debug_srcinfo section
-entry will consist of the following two 4-byte words of data:
-
- (1) The offset, measured from the start of the .line section to
- the beginning of the terminating entry for the .line section.
-
- (2) A word containing the value 0xffffffff.
-
---------------------------------
-
-In the current DWARF version 1 specification, no mechanism is specified by
-which information about macro definitions and un-definitions may be provided
-to the DWARF consumer.
-
-The DWARF version 2 (draft) specification does specify such a mechanism.
-That specification was based on the GNU ("vendor specific extension")
-which provided some support for macro definitions and un-definitions,
-but the "official" DWARF version 2 (draft) specification mechanism for
-handling macros and the GNU implementation have diverged somewhat. I
-plan to update the GNU implementation to conform to the "official"
-DWARF version 2 (draft) specification as soon as I get time to do that.
-
-Note that in the GNU implementation, additional information about macro
-definitions and un-definitions is *only* provided when the -g3 level of
-debug-info production is selected. (The default level is -g2 and the
-plain old -g option is considered to be identical to -g2.)
-
-GCC records information about macro definitions and undefinitions primarily
-in a section called the .debug_macinfo section. Normal entries in the
-.debug_macinfo section consist of the following three parts:
-
- (1) A special "type" byte.
-
- (2) A 3-byte line-number/filename-offset field.
-
- (3) A NUL terminated string.
-
-The interpretation of the second and third parts is dependent upon the
-value of the leading (type) byte.
-
-The type byte may have one of four values depending upon the type of the
-.debug_macinfo entry which follows. The 1-byte MACINFO type codes presently
-used, and their meanings are as follows:
-
- MACINFO_start A base file or an include file starts here.
- MACINFO_resume The current base or include file ends here.
- MACINFO_define A #define directive occurs here.
- MACINFO_undef A #undef directive occur here.
-
-(Note that the MACINFO_... codes mentioned here are simply symbolic names
-for constants which are defined in the GNU dwarf.h file.)
-
-For MACINFO_define and MACINFO_undef entries, the second (3-byte) field
-contains the number of the source line (relative to the start of the current
-base source file or the current include files) when the #define or #undef
-directive appears. For a MACINFO_define entry, the following string field
-contains the name of the macro which is defined, followed by its definition.
-Note that the definition is always separated from the name of the macro
-by at least one whitespace character. For a MACINFO_undef entry, the
-string which follows the 3-byte line number field contains just the name
-of the macro which is being undef'ed.
-
-For a MACINFO_start entry, the 3-byte field following the type byte contains
-the offset, relative to the start of the .debug_sfnames section for the
-current compilation unit, of a string which names the new source file which
-is beginning its inclusion at this point. Following that 3-byte field,
-each MACINFO_start entry always contains a zero length NUL terminated
-string.
-
-For a MACINFO_resume entry, the 3-byte field following the type byte contains
-the line number WITHIN THE INCLUDING FILE at which the inclusion of the
-current file (whose inclusion ends here) was initiated. Following that
-3-byte field, each MACINFO_resume entry always contains a zero length NUL
-terminated string.
-
-Each set of .debug_macinfo entries for each compilation unit is terminated
-by a special .debug_macinfo entry consisting of a 4-byte zero value followed
-by a single NUL byte.
-
---------------------------------
-
-In the current DWARF draft specification, no provision is made for providing
-a separate level of (limited) debugging information necessary to support
-tracebacks (only) through fully-debugged code (e.g. code in system libraries).
-
-A proposal to define such a level was submitted (by me) to the UI/PLSIG.
-This proposal was rejected by the UI/PLSIG for inclusion into the DWARF
-version 1 specification for two reasons. First, it was felt (by the PLSIG)
-that the issues involved in supporting a "traceback only" subset of DWARF
-were not well understood. Second, and perhaps more importantly, the PLSIG
-is already having enough trouble agreeing on what it means to be "conforming"
-to the DWARF specification, and it was felt that trying to specify multiple
-different *levels* of conformance would only complicate our discussions of
-this already divisive issue. Nonetheless, the GNU implementation of DWARF
-provides an abbreviated "traceback only" level of debug-info production for
-use with fully-debugged "system library" code. This level should only be
-used for fully debugged system library code, and even then, it should only
-be used where there is a very strong need to conserve disk space. This
-abbreviated level of debug-info production can be used by specifying the
--g1 option on the compilation command line.
-
---------------------------------
-
-As mentioned above, the GNU implementation of DWARF currently uses the DWARF
-version 2 (draft) approach for inline functions (and inlined instances
-thereof). This is used in preference to the version 1 approach because
-(quite simply) the version 1 approach is highly brain-damaged and probably
-unworkable.
-
---------------------------------
-
-
-GNU DWARF Representation of GNU C Extensions to ANSI C
-------------------------------------------------------
-
-The file dwarfout.c has been designed and implemented so as to provide
-some reasonable DWARF representation for each and every declarative
-construct which is accepted by the GNU C compiler. Since the GNU C
-compiler accepts a superset of ANSI C, this means that there are some
-cases in which the DWARF information produced by GCC must take some
-liberties in improvising DWARF representations for declarations which
-are only valid in (extended) GNU C.
-
-In particular, GNU C provides at least three significant extensions to
-ANSI C when it comes to declarations. These are (1) inline functions,
-and (2) dynamic arrays, and (3) incomplete enum types. (See the GCC
-manual for more information on these GNU extensions to ANSI C.) When
-used, these GNU C extensions are represented (in the generated DWARF
-output of GCC) in the most natural and intuitively obvious ways.
-
-In the case of inline functions, the DWARF representation is exactly as
-called for in the DWARF version 2 (draft) specification for an identical
-function written in C++; i.e. we "reuse" the representation of inline
-functions which has been defined for C++ to support this GNU C extension.
-
-In the case of dynamic arrays, we use the most obvious representational
-mechanism available; i.e. an array type in which the upper bound of
-some dimension (usually the first and only dimension) is a variable
-rather than a constant. (See the DWARF version 1 specification for more
-details.)
-
-In the case of incomplete enum types, such types are represented simply
-as TAG_enumeration_type DIEs which DO NOT contain either AT_byte_size
-attributes or AT_element_list attributes.
-
---------------------------------
-
-
-Future Directions
------------------
-
-The codes, formats, and other paraphernalia necessary to provide proper
-support for symbolic debugging for the C++ language are still being worked
-on by the UI/PLSIG. The vast majority of the additions to DWARF which will
-be needed to completely support C++ have already been hashed out and agreed
-upon, but a few small issues (e.g. anonymous unions, access declarations)
-are still being discussed. Also, we in the PLSIG are still discussing
-whether or not we need to do anything special for C++ templates. (At this
-time it is not yet clear whether we even need to do anything special for
-these.)
-
-Unfortunately, as mentioned above, there are quite a few problems in the
-g++ front end itself, and these are currently responsible for severely
-restricting the progress which can be made on adding DWARF support
-specifically for the g++ front-end. Furthermore, Richard Stallman has
-expressed the view that C++ friendships might not be important enough to
-describe (in DWARF). This view directly conflicts with both the DWARF
-version 1 and version 2 (draft) specifications, so until this small
-misunderstanding is cleared up, DWARF support for g++ is unlikely.
-
-With regard to FORTRAN, the UI/PLSIG has defined what is believed to be a
-complete and sufficient set of codes and rules for adequately representing
-all of FORTRAN 77, and most of Fortran 90 in DWARF. While some support for
-this has been implemented in dwarfout.c, further implementation and testing
-will have to await the arrival of the GNU Fortran front-end (which is
-currently in early alpha test as of this writing).
-
-GNU DWARF support for other languages (i.e. Pascal and Modula) is a moot
-issue until there are GNU front-ends for these other languages.
-
-GNU DWARF support for DWARF version 2 will probably not be attempted until
-such time as the version 2 specification is finalized. (More work needs
-to be done on the version 2 specification to make the new "abbreviations"
-feature of version 2 more easily implementable. Until then, it will be
-a royal pain the ass to implement version 2 "abbreviations".) For the
-time being, version 2 features will be added (in a version 1 compatible
-manner) when and where these features seem necessary or extremely desirable.
-
-As currently defined, DWARF only describes a (binary) language which can
-be used to communicate symbolic debugging information from a compiler
-through an assembler and a linker, to a debugger. There is no clear
-specification of what processing should be (or must be) done by the
-assembler and/or the linker. Fortunately, the role of the assembler
-is easily inferred (by anyone knowledgeable about assemblers) just by
-looking at examples of assembly-level DWARF code. Sadly though, the
-allowable (or required) processing steps performed by a linker are
-harder to infer and (perhaps) even harder to agree upon. There are
-several forms of very useful `post-processing' steps which intelligent
-linkers *could* (in theory) perform on object files containing DWARF,
-but any and all such link-time transformations are currently both disallowed
-and unspecified.
-
-In particular, possible link-time transformations of DWARF code which could
-provide significant benefits include (but are not limited to):
-
- Commonization of duplicate DIEs obtained from multiple input
- (object) files.
-
- Cross-compilation type checking based upon DWARF type information
- for objects and functions.
-
- Other possible `compacting' transformations designed to save disk
- space and to reduce linker & debugger I/O activity.
diff --git a/gcc/README.FRESCO b/gcc/README.FRESCO
deleted file mode 100644
index 334e78023a9..00000000000
--- a/gcc/README.FRESCO
+++ /dev/null
@@ -1,17 +0,0 @@
-Compiling Fresco with g++
------------------------------
-
-Fresco is an evolving interface and toolkit for object-oriented
-graphics. A preliminary version (written in C++) was released
-with x11r6.
-
-Previous versions of Fresco have not compiled using g++,
-partly because of the use of true and false as identifiers.
-(They are now reserved words in g++, as required by the
-ANSI/ISO draft standard for C++.)
-
-If you get x11r6 with public patch #5 or a later version
-of Fresco, these problems should now be fixed.
-
-See http://www.faslab.com/fresco/HomePage.html for information
-on Fresco, including how to get the latest version.
diff --git a/gcc/README.NS32K b/gcc/README.NS32K
deleted file mode 100644
index 93c5beaef54..00000000000
--- a/gcc/README.NS32K
+++ /dev/null
@@ -1,130 +0,0 @@
-This file describes the implementation notes of the GNU C Compiler for
-the National Semiconductor 32032 chip (and 32000 family).
-
-The 32032 machine description and configuration file for this compiler
-is, for NS32000 family machine, primarily machine independent.
-However, since this release still depends on vendor-supplied
-assemblers and linkers, the compiler must obey the existing
-conventions of the actual machine to which this compiler is targeted.
-In this case, the actual machine which this compiler was targeted to
-is a Sequent Balance 8000, running DYNIX 2.1.
-
-The assembler for DYNIX 2.1 (and DYNIX 3.0, alas) does not cope with
-the full generality of the addressing mode REGISTER RELATIVE.
-Specifically, it generates incorrect code for operands of the
-following form:
-
- sym(rn)
-
-Where `rn' is one of the general registers. Correct code is generated
-for operands of the form
-
- sym(pn)
-
-where `pn' is one of the special processor registers (sb, fp, or sp).
-
-An equivalent operand can be generated by the form
-
- sym[rn:b]
-
-although this addressing mode is about twice as slow on the 32032.
-
-The more efficient addressing mode is controlled by defining the
-constant SEQUENT_ADDRESS_BUG to 0. It is currently defined to be 1.
-
-Another bug in the assembler makes it impossible to compute with
-explicit addresses. In order to compute with a symbolic address, it
-is necessary to load that address into a register using the "addr"
-instruction. For example, it is not possible to say
-
- cmpd _p,@_x
-
-Rather one must say
-
- addr _x,rn
- cmpd _p,rn
-
-
-The ns32032 chip has a number of known bugs. Any attempt to make the
-compiler unaware of these deficiencies will surely bring disaster.
-The current list of know bugs are as follows (list provided by Richard
-Stallman):
-
-1) instructions with two overlapping operands in memory
-(unlikely in C code, perhaps impossible).
-
-2) floating point conversion instructions with constant
-operands (these may never happen, but I'm not certain).
-
-3) operands crossing a page boundary. These can be prevented
-by setting the flag in tm.h that requires strict alignment.
-
-4) Scaled indexing in an insn following an insn that has a read-write
-operand in memory. This can be prevented by placing a no-op in
-between. I, Michael Tiemann, do not understand what exactly is meant
-by `read-write operand in memory'. If this is referring to the special
-TOS mode, for example "addd 5,tos" then one need not fear, since this
-will never be generated. However, is this includes "addd 5,-4(fp)"
-then there is room for disaster. The Sequent compiler does not insert
-a no-op for code involving the latter, and I have been informed that
-Sequent is aware of this list of bugs, so I must assume that it is not
-a problem.
-
-5) The 32032 cannot shift by 32 bits. It shifts modulo the word size
-of the operand. Therefore, for 32-bit operations, 32-bit shifts are
-interpreted as zero bit shifts. 32-bit shifts have been removed from
-the compiler, but future hackers must be careful not to reintroduce
-them.
-
-6) The ns32032 is a very slow chip; however, some instructions are
-still very much slower than one might expect. For example, it is
-almost always faster to double a quantity by adding it to itself than
-by shifting it by one, even if that quantity is deep in memory. The
-MOVM instruction has a 20-cycle setup time, after which it moves data
-at about the speed that normal moves would. It is also faster to use
-address generation instructions than shift instructions for left
-shifts less than 4. I do not claim that I generate optimal code for all
-given patterns, but where I did escape from National's "clean
-architecture", I did so because the timing specification from the data
-book says that I will win if I do. I suppose this is called the
-"performance gap".
-
-
-Signed bitfield extraction has not been implemented. It is not
-provided by the NS32032, and while it is most certainly possible to do
-better than the standard shift-left/shift-right sequence, it is also
-quite hairy. Also, since signed bitfields do not yet exist in C, this
-omission seems relatively harmless.
-
-
-Zero extractions could be better implemented if it were possible in
-GCC to provide sized zero extractions: i.e. a byte zero extraction
-would be allowed to yield a byte result. The current implementation
-of GCC manifests 68000-ist thinking, where bitfields are extracted
-into a register, and automatically sign/zero extended to fill the
-register. See comments in ns32k.md around the "extzv" insn for more
-details.
-
-
-It should be noted that while the NS32000 family was designed to
-provide odd-aligned addressing capability for multi-byte data (also
-provided by the 68020, but not by the 68000 or 68010), many machines
-do not opt to take advantage of this. For example, on the sequent,
-although there is no advantage to long-word aligning word data, shorts
-must be int-aligned in structs. This is an example of another
-machine-specific machine dependency.
-
-
-Because the ns32032 is has a coherent byte-order/bit-order
-architecture, many instructions which would be different for
-68000-style machines, fold into the same instruction for the 32032.
-The classic case is push effective address, where it does not matter
-whether one is pushing a long, word, or byte address. They all will
-push the same address.
-
-
-The macro FUNCTION_VALUE_REGNO_P is probably not sufficient, what is
-needed is FUNCTION_VALUE_P, which also takes a MODE parameter. In
-this way it will be possible to determine more exactly whether a
-register is really a function value register, or just one that happens
-to look right.
diff --git a/gcc/README.RS6000 b/gcc/README.RS6000
deleted file mode 100644
index d29604f968a..00000000000
--- a/gcc/README.RS6000
+++ /dev/null
@@ -1,111 +0,0 @@
- AIX 3.1 and 3.2 assembler problems
-
-Specifying the -g flag to GCC on the RS/6000 requires upgrading the
-standard AIX assembler distributed with AIX 3.1 and versions of AIX
-3.2 earlier than 3.2.4 with a replacement that is available from IBM.
-Note that Makefile.in specifies the -g when compiling libgcc2.c.
-
-You can test for the presence of a fixed assembler by entering the following:
- % as -u < /dev/null
-If the command exits normally, the assembler fix already is installed.
-If the assembler complains that "-u" is an unknown flag, you need to order
-the fix.
-
-If you are running AIX 3.1 (lslpp -h bos.obj output reports
-03.01.0005.XXXX where the 0005 can be any higher number and the XXXX
-can be any value), call IBM Support at 800-237-5511 and ask for
-shipment of AIX/6000 fix PTF U403044 for APAR IX22829 (.extern foo
-conflicts with defining foo).
-
-If you are running AIX 3.2 but not 3.2.4 or later (lslpp -h bos.obj
-output reports 03.02.0000.0000), a newer update to the assembler fix
-is available. Ask for shipment of AIX/6000 fix PTF U416277 for
-IX32992 (.global prevents detection of duplicate symbol).
-
-If you are running AIX 3.2.4 or later, you already have the new
-assembler.
-
-Any customer can order and get the replacement assembler, and install it on
-one or more machines. It is available on diskette from IBM Customer Support
-and from the IBM Internet fix anonymous ftp server (FixDist) at
-aix.boulder.ibm.com (198.17.57.66).
-
-If you contact IBM Customer Support, they may also ask you for your customer
-number. If you do not know it, you will still be able to get the fix, but
-you will have to be persistent. IBM has corresponding support organizations
-outside of North America. Call your IBM branch office and ask them to put
-you in touch with the department that handles fixes for AIX/6000. If that
-doesn't work, ask for the department that handles software defect support
-for AIX/6000 and ask for the APAR fix.
-
-If you use the GNU assembler instead of the system supplied assembler, you need
-an assembler modified after October 16th, 1995 in order to build the GNU C
-compiler. This is because the GNU C compiler wants to build a variant of its
-library, libgcc.a with the -mcpu=common switch to support building programs
-that can run on either the Power or PowerPC machines.
-
-
- AIX NLS problems
-
-AIX on the RS/6000 provides support (NLS) for environments outside of
-the United States. Compilers and assemblers use NLS to support
-locale-specific representations of various objects including
-floating-point numbers ("." vs "," for separating decimal fractions).
-There have been problems reported where the library linked with GCC does
-not produce the same floating-point formats that the assembler accepts.
-If you have this problem, set the LANG environment variable to "C" or
-"En_US".
-
-
- AIX 3.2.5 XLC-1.3 problems
-
-XLC version 1.3.0.0 distributed with AIX 3.2.5 will miscompile jump.c when
-building the stage1 compiler during the bootstrap process. This will cause
-GCC to crash and the bootstrap to fail later while compiling libgcc2.c. XLC
-version 1.3.0.1 or later fixes this problem. XLC-1.3.0.19 also cannot
-bootstrap GCC so please avoid that release as well. You can obtain
-XLC-1.3.0.24 by requesting PTF 432238 from IBM, or just ask for the latest
-release of XLC-1.3.
-
-There also have been reports of problems bootstrapping GCC with some older
-releases of xlc-1.2.1, including xlc-1.2.1.8. Newer releases of xlc-1.2.1
-do not exhibit this problem: xlc-1.2.1.28 is known to bootstrap properly.
-
-
- AIX 3.2 common-mode support
-
-AIX common-mode providing transparent support of both the POWER and PowerPC
-architectures is usable in AIX 3.2.3 and above but an export file and
-support for hidden export via libc.a will not exist until AIX 4.1. libgcc.a
-also must be compiled in common-mode. Note that executables generated for
-the POWER (RIOS1 and RSC) architecture will run directly on systems using
-the MPC601 chip. Common-mode only improves the performance of a single
-executable run on both POWER and PowerPC architecture platforms by not using
-POWER- or PowerPC-specific instructions and eliminating the need to trap to
-emulation (for POWER instructions run on PowerPC).
-
-To link a common-mode application prior to AIX 4.1 and run it on a system at
-AIX level 3.2.3 or above, use the text between the "<>" as an export file
-(e.g. milli.exp)
-
-<><><><><><><><><><><>
-#!
-__mulh 0x3100
-__mull 0x3180
-__divss 0x3200
-__divus 0x3280
-__quoss 0x3300
-__quous 0x3380
-<><><><><><><><><><><>
-
-and then link with -Wl,-bI:milli.exp.
-
-
- AIX 4.1 binder
-
-Due to changes in the way that GCC invokes the binder (linker) for AIX 4.1,
-the link step now may produce warnings of duplicate symbols which were not
-reported before. The assembly files generated by GCC for AIX always have
-included multiple symbol definitions for certain global variable and
-function declarations in the original program. The warnings should not
-prevent the linker from producing a correct library or runnable executable.
diff --git a/gcc/README.TRAD b/gcc/README.TRAD
deleted file mode 100644
index 07ccd16437b..00000000000
--- a/gcc/README.TRAD
+++ /dev/null
@@ -1,55 +0,0 @@
-This is a partial list of how `gcc -traditional' disagrees with
-traditional C compilers (perhaps only some of them). Most of these
-differences are not bugs.
-
----------------------------------------------------------------------------
-K&R-1 (2.4.3) says:
-
- "If the character following a backslash is not one of those
- specified {in the table above}, the backslash is ignored."
-
-Up until recently, `gcc -traditional' complained about \x \a and \v
-appearing in a character or string literal. I believe however that
-this non-feature has been eliminated (recently).
-
----------------------------------------------------------------------------
-When in -traditional mode, gcc allows the following erroneous pair of
-declarations to appear together in a given scope:
-
- typedef int foo;
- typedef foo foo;
-
----------------------------------------------------------------------------
-K&R-1 (8.5) says:
-
- "No field may be wider than a word."
-
-Gcc however allows:
-
- struct S { int i:33; };
-
----------------------------------------------------------------------------
-In K&R-1 there is no restriction against comments crossing include file
-boundaries. Gcc however doesn't allow this, even when in -traditional mode.
-
----------------------------------------------------------------------------
-Regarding the length of identifiers, K&R-1 (2.2) says:
-
- "No more than the first eight characters are significant,
- although more may be used."
-
-Gcc treats all characters of identifiers as significant, even when in
--traditional mode.
-
----------------------------------------------------------------------------
-K&R-1 (2.2) says:
-
- "An identifier is a sequence of letters and digits; the first
- character must be a letter. The underscore _ counts as a letter."
-
-Gcc also allows dollar signs in identifiers. (This may also be an issue
-for the -pedantic option.)
-
----------------------------------------------------------------------------
-
-
diff --git a/gcc/README.X11 b/gcc/README.X11
deleted file mode 100644
index 359dd5f9603..00000000000
--- a/gcc/README.X11
+++ /dev/null
@@ -1,447 +0,0 @@
-[This file contains two alternative recipes for compiling X11 with GCC.
-The first alternative puts libgcc.a into the shared X library; the second
-does not. Neither alternative works on all kinds of systems.
-It may be that when using GCC 2.4, both alternatives work okay on
-relatively recent Sparc systems. The first alternative is likely
-not to work on a Sun 3 without hardware floating point.]
-
-How to compile X11R5 (patch level 11) with GCC version 2:
-
-The patches include support for building the shared libraries with GCC
-2 on the Sparc and 68k machines. This version includes the necessary
-parts of libgcc.a in the shared library for X, in case functions in
-that library need it. Thus the default behavior is now to build
-everything, including the libraries, with gcc.
-
-If you build the shared library this way, it may not work with
-executables made with older versions of GCC (2.3.3 and earlier).
-If that happens, relink those executables with the latest GCC.
-IF YOU THINK YOU MIGHT COMPILE X FOR SOLARIS 2, then you really don't
-need this patch: get /contrib/R5.SunOS5.patch.tar.Z from
-export.lcs.mit.edu instead. It has everything you need to do the
-build for Solaris 2, sets you up to everything with GCC, and is
-backward compatible with Sunos 4.*. Get the the README
-(/contrib/R5.SunOS5.patch.README at export) for more info.
-
-If you see undefined symbols _dlopen, _dlsym, or _dlclose when linking
-with -lX11, compile and link against the file mit/util/misc/dlsym.c in
-the MIT X11R5 distribution. Alternatively, do dynamic linking
-by using a non-GNU ld.
-
-mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2.
-If -fstrength-reduce (or any other -f option) is a major win, then it
-will most likely be turned on by -O2 optimization.
-
-mit/config/sunLib.rules -- If HasGcc and GccVersion > 1 are true, then
-use gcc -fpic to generate PIC code. Make sure that gcc does not use
-gas (the GNU assembler) when compiling PIC code; gas does not assemble
-it correctly.
-
-***If you have gas installed where gcc uses it by default, you might have
-to add -B/bin/ to the PositionIndependentCFlags.***
-
-mit/config/site.def -- Define GccVersion to be 2.
-
-mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization.
-
-mit/config/sunLib.rules -- When compiling with GCC 2, use -fpic for
-position independent code generation.
-
-mit/rgb/Imakefile -- No longer need to compile some modules with
-cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code.
-
-mit/server/os/Imakefile -- Likewise.
-
-mit/server/ddx/sun/Imakefile -- When compiling with GCC 2, some modules
-should be compiled with -fvolatile.
-
-mit/clients/twm/Imakefile -- Fix bad decls of malloc, realloc in gram.c.
-
-mit/lib/X/Imakefile -- Make libgcc.a a required lib for libX11.so
-
-*** mit/clients/twm/Imakefile Mon May 17 22:05:22 1993
---- new/clients/twm/Imakefile Mon May 17 22:28:46 1993
-***************
-*** 32,41 ****
---- 32,48 ----
- ComplexProgramTarget(twm)
- InstallNonExecFile(system.twmrc,$(TWMDIR))
-
-+ #if HasGcc && GccVersion > 1 && defined (SunArchitecture)
- gram.h gram.c: gram.y
- yacc $(YFLAGS) gram.y
-+ sed -e 's/^extern char \*malloc(), \*realloc();//g' y.tab.c >gram.c
-+ $(MV) y.tab.h gram.h
-+ #else
-+ gram.h gram.c: gram.y
-+ yacc $(YFLAGS) gram.y
- $(MV) y.tab.c gram.c
- $(MV) y.tab.h gram.h
-+ #endif
-
- clean::
- $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c
-*** mit/config/Imake.tmpl Mon May 17 22:02:57 1993
---- new/config/Imake.tmpl Mon May 17 22:15:06 1993
-***************
-*** 500,506 ****
---- 500,510 ----
- #endif
- #ifndef CcCmd
- #if HasGcc
-+ #if GccVersion > 1
-+ #define CcCmd gcc -fpcc-struct-return
-+ #else
- #define CcCmd gcc -fstrength-reduce -fpcc-struct-return
-+ #endif
- #else
- #define CcCmd cc
- #endif
-*** mit/config/site.def Mon May 17 22:02:44 1993
---- new/config/site.def Mon May 17 22:22:28 1993
-***************
-*** 25,31 ****
-
- #ifdef BeforeVendorCF
-
-! /* #define HasGcc YES */
-
- #endif /* BeforeVendorCF */
-
---- 25,33 ----
-
- #ifdef BeforeVendorCF
-
-! #define HasGcc YES
-! /* GccVersion > 1 implies building shared libraries with gcc */
-! #define GccVersion 2
-
- #endif /* BeforeVendorCF */
-
-*** mit/config/sun.cf Mon May 17 22:03:02 1993
---- new/config/sun.cf Mon May 17 22:24:55 1993
-***************
-*** 41,49 ****
---- 41,55 ----
-
- #if HasGcc
-
-+ #if GccVersion > 1
-+ #define OptimizedCDebugFlags -O2
-+ #else
-+ #define OptimizedCDebugFlags -O
- #define SharedLibraryCcCmd cc
- #define ExtraLoadFlags -B/usr/bin/
- #define AllocateLocalDefines /**/
-+ #endif
-+
-
- .c.o:
- $(CC) -c $(CFLAGS) $*.c
-*** mit/config/sunLib.rules Mon May 17 22:02:46 1993
---- new/config/sunLib.rules Mon May 17 22:19:06 1993
-***************
-*** 23,29 ****
---- 23,33 ----
- #define SharedLibraryLoadFlags -assert pure-text
- #endif
- #ifndef PositionIndependentCFlags
-+ #if defined(HasGcc) && GccVersion > 1
-+ #define PositionIndependentCFlags -fpic
-+ #else
- #define PositionIndependentCFlags -pic
-+ #endif
- #endif
-
- /*
-*** mit/lib/X/Imakefile Mon May 17 22:05:03 1993
---- new/lib/X/Imakefile Mon May 17 22:32:26 1993
-***************
-*** 9,14 ****
---- 9,31 ----
- #define MotifBC NO
- #endif
-
-+ #if defined(SunArchitecture)
-+ #if SystemV4
-+ #if HasGcc
-+ REQUIREDLIBS= -lgcc -lc
-+ #else
-+ REQUIREDLIBS= -lc
-+ #endif
-+ #else
-+ #if HasGcc && GccVersion > 1
-+ XCOMM Hack to fix gcc 2 ``-nostdlib'' deficiency on SunOS 4.x
-+ REQUIREDLIBS= `gcc -v 2>&1 | awk '{print $$4}' | sed -e 's/specs$$/libgcc.a/'`
-+ #else
-+ REQUIREDLIBS=
-+ #endif
-+ #endif
-+ #endif
-+
- #ifndef BuildXimp
- #define BuildXimp NO
- #endif
-*** mit/rgb/Imakefile Mon May 17 22:05:31 1993
---- new/rgb/Imakefile Mon May 17 22:25:30 1993
-***************
-*** 17,23 ****
- #if !(defined(SGIArchitecture) || SystemV4)
- DBMLIB = -ldbm
- #endif
-! #if defined(SparcArchitecture) && HasGcc
- CC = cc
- CCOPTIONS = /**/
- EXTRA_LOAD_FLAGS = /**/
---- 17,23 ----
- #if !(defined(SGIArchitecture) || SystemV4)
- DBMLIB = -ldbm
- #endif
-! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1
- CC = cc
- CCOPTIONS = /**/
- EXTRA_LOAD_FLAGS = /**/
-*** mit/server/ddx/sun/Imakefile Mon May 17 22:05:57 1993
---- new/server/ddx/sun/Imakefile Mon May 17 22:27:23 1993
-***************
-*** 43,48 ****
---- 43,53 ----
- LinkFile(sunGX.o,sunGX.o.dist)
- #endif
-
-+ #if HasGcc && GccVersion > 1
-+ SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile)
-+ SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile)
-+ #endif
-+
- sunInitExtMono.o: $(ICONFIGFILES)
- ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT)
- ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY)
-*** mit/server/os/Imakefile Mon May 17 22:05:46 1993
---- new/server/os/Imakefile Mon May 17 22:26:02 1993
-***************
-*** 132,138 ****
- SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
- SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
- SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
-! #if defined(SparcArchitecture) && HasGcc
- oscolor.o: $(ICONFIGFILES)
- $(RM) $@
- cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
---- 132,138 ----
- SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
- SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
- SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
-! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1
- oscolor.o: $(ICONFIGFILES)
- $(RM) $@
- cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
-
-
-[This is the older version]
-
-How to compile X11R5 (patch level 11) with GCC version 2:
-
-The patches include support for building the shared libraries with GCC 2 on
-the Sparc and 68k machines.
-
-NOTE: Such shared libraries built with GCC version 2.3 DID NOT WORK
-with executables previously linked using Sun CC! This is because
-neither those executables nor the gcc-compiled shared libraries contain
-libgcc.a. The shared libraries did work with executables linked using
-GCC (running the Sun linker, of course) because GCC tells the linker to
-link in libgcc.a. Because of these limitations the default behavior is
-to NOT build the shared libraries with gcc.
-
-Changes in GCC 2.4 seem to have eliminated the problem, and such a
-shared library now seems work with all executables. If you want the
-gcc-compiled shared libraries turn on "Gcc2BuildLibs" in site.def. If
-you try this, please tell bug-gcc@prep.ai.mit.edu whether it works.
-
-Sun forgot to include a static version of libdl.a with some versions
-of SunOS (4.1 mainly). If you see undefined symbols _dlopen, _dlsym,
-or _dlclose when linking with -lX11, compile and link against the file
-mit/util/misc/dlsym.c in the MIT X11R5 distribution.
-
-mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2. If
--fstrength-reduce (or any other -f option) is a major win, then it will
-most likely be turned on by -O2 optimization.
-
-mit/config/sunLib.rules -- If HasGcc2 and Gcc2BuildLibs are defined, then
-use gcc -fpic to generate PIC code. Make sure that gcc does not use gas (the
-GNU assembler) when compiling PIC code; gas does not assemble it correctly.
-If you have gas installed where gcc uses it by default, you might have to add
--B/bin/ to the PositionIndependentCFlags.
-
-mit/config/site.def -- Define HasGcc2 to be YES.
-
-mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization.
-
-mit/rgb/Imakefile -- No longer need to compile some modules with
-cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code.
-
-mit/server/os/Imakefile -- Likewise.
-
-mit/clients/twm/Imakefile -- fix bad decls of malloc, realloc in gram.c.
-
-*** mit/config/Imake.tmpl.ORIG Tue Dec 31 11:07:56 1991
---- mit/config/Imake.tmpl Tue Dec 31 12:30:47 1991
-***************
-*** 499,508 ****
---- 499,512 ----
- #define HasGcc NO
- #endif
- #ifndef CcCmd
-+ #if HasGcc2
-+ #define CcCmd gcc -fpcc-struct-return
-+ #else
- #if HasGcc
- #define CcCmd gcc -fstrength-reduce -fpcc-struct-return
- #else
- #define CcCmd cc
-+ #endif
- #endif
- #endif
- #if HasFortran
-*** mit/config/sunLib.rules.ORIG Tue Dec 31 11:11:24 1991
---- mit/config/sunLib.rules Tue May 5 12:26:12 1992
-***************
-*** 23,30 ****
---- 23,34 ----
- #define SharedLibraryLoadFlags -assert pure-text
- #endif
- #ifndef PositionIndependentCFlags
-+ #if defined(HasGcc2) && defined (Gcc2BuildLibs)
-+ #define PositionIndependentCFlags -fpic
-+ #else
- #define PositionIndependentCFlags -pic
- #endif
-+ #endif
-
- /*
- * InstallSharedLibrary - generate rules to install the shared library.
-*** mit/config/site.def.ORIG Tue Dec 31 11:13:49 1991
---- mit/config/site.def Tue Dec 31 12:02:59 1991
-***************
-*** 25,31 ****
-
- #ifdef BeforeVendorCF
-
-! /* #define HasGcc YES */
-
- #endif /* BeforeVendorCF */
-
---- 25,33 ----
-
- #ifdef BeforeVendorCF
-
-! #define HasGcc YES
-! #define HasGcc2 YES
-! /* #define Gcc2BuildLibs YES */
-
- #endif /* BeforeVendorCF */
-
-*** mit/config/sun.cf.ORIG Tue Dec 31 11:13:57 1991
---- mit/config/sun.cf Tue May 5 12:29:50 1992
-***************
-*** 34,42 ****
---- 41,61 ----
-
- #if HasGcc
-
-+ #if defined(HasGcc2)
-+ #define OptimizedCDebugFlags -O2
-+ /* Leave Alone XXX */
-+ #else
-+ #define OptimizedCDebugFlags -O
- #define SharedLibraryCcCmd cc
- #define ExtraLoadFlags -B/usr/bin/
- #define AllocateLocalDefines /**/
-+ #endif
-+
-+ #if !defined(Gcc2BuildLibs)
-+ #define SharedLibraryCcCmd cc
-+ #define ExtraLoadFlags -B/usr/bin/
-+ #define AllocateLocalDefines /**/
-+ #endif
-
- .c.o:
- $(CC) -c $(CFLAGS) $*.c
-*** mit/rgb/Imakefile.ORIG Wed Jan 15 16:43:18 1992
---- mit/rgb/Imakefile Thu Jan 2 13:34:09 1992
-***************
-*** 17,23 ****
- #if !(defined(SGIArchitecture) || SystemV4)
- DBMLIB = -ldbm
- #endif
-! #if defined(SparcArchitecture) && HasGcc
- CC = cc
- CCOPTIONS = /**/
- EXTRA_LOAD_FLAGS = /**/
---- 17,23 ----
- #if !(defined(SGIArchitecture) || SystemV4)
- DBMLIB = -ldbm
- #endif
-! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
- CC = cc
- CCOPTIONS = /**/
- EXTRA_LOAD_FLAGS = /**/
-*** mit/server/os/Imakefile.ORIG Wed Jan 15 16:46:23 1992
---- mit/server/os/Imakefile Wed Jan 15 16:46:48 1992
-***************
-*** 132,138 ****
- SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
- SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
- SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
-! #if defined(SparcArchitecture) && HasGcc
- oscolor.o: $(ICONFIGFILES)
- $(RM) $@
- cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
---- 132,138 ----
- SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES))
- SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES))
- SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES))
-! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2)
- oscolor.o: $(ICONFIGFILES)
- $(RM) $@
- cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c
-*** 1.1 1992/09/08 19:52:07
---- mit/server/ddx/sun/Imakefile 1992/09/08 21:10:22
-***************
-*** 43,48 ****
---- 43,53 ----
- LinkFile(sunGX.o,sunGX.o.dist)
- #endif
-
-+ #if HasGcc2
-+ SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile)
-+ SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile)
-+ #endif
-+
- sunInitExtMono.o: $(ICONFIGFILES)
- ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT)
- ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY)
-
-*** /tmp/RCSAa24446 Tue Sep 15 12:23:32 1992
---- mit/clients/twm/Imakefile Thu Aug 13 18:18:07 1992
-***************
-*** 32,41 ****
---- 32,48 ----
- ComplexProgramTarget(twm)
- InstallNonExecFile(system.twmrc,$(TWMDIR))
-
-+ #if HasGcc2 && defined (SunArchitecture)
- gram.h gram.c: gram.y
- yacc $(YFLAGS) gram.y
-+ sed -e 's/^extern char \*malloc(), \*realloc();//g' y.tab.c >gram.c
-+ $(MV) y.tab.h gram.h
-+ #else
-+ gram.h gram.c: gram.y
-+ yacc $(YFLAGS) gram.y
- $(MV) y.tab.c gram.c
- $(MV) y.tab.h gram.h
-+ #endif
-
- clean::
- $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c
-
diff --git a/gcc/alloca.c b/gcc/alloca.c
deleted file mode 100644
index 8f98b73dbb9..00000000000
--- a/gcc/alloca.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef emacs
-#include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-#ifndef alloca
-
-#ifdef emacs
-#ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-#ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
-
-#if __STDC__
-typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Different portions of Emacs need to call different versions of
- malloc. The Emacs executable needs alloca to call xmalloc, because
- ordinary malloc isn't protected from input signals. On the other
- hand, the utilities in lib-src need alloca to call malloc; some of
- them are very simple, and don't have an xmalloc routine.
-
- Non-Emacs programs expect this to call use xmalloc.
-
- Callers below should use malloc. */
-
-#ifndef emacs
-#define malloc xmalloc
-#endif
-extern pointer malloc ();
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown. */
-#endif
-
-#if STACK_DIRECTION != 0
-
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-#else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-#define STACK_DIR stack_dir
-
-static void
-find_stack_direction ()
-{
- static char *addr = NULL; /* Address of first `dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-#endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-pointer
-alloca (size)
- unsigned size;
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-#if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-#endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-#ifdef emacs
- BLOCK_INPUT;
-#endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((pointer) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-#ifdef emacs
- UNBLOCK_INPUT;
-#endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register pointer new = malloc (sizeof (header) + size);
- /* Address of header. */
-
- if (new == 0)
- abort();
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (pointer) ((char *) new + sizeof (header));
- }
-}
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
-
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-#else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
-
-#ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-#else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-#endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-#endif /* not CRAY2 */
-#endif /* CRAY */
-
-#endif /* no alloca */
-#endif /* not GCC version 2 */
diff --git a/gcc/assert.h b/gcc/assert.h
deleted file mode 100644
index ecc02ee9991..00000000000
--- a/gcc/assert.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 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
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
deleted file mode 100644
index 3755388c92b..00000000000
--- a/gcc/basic-block.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Define control and data flow tables, and regsets.
- Copyright (C) 1987 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. */
-
-
-/* Number of bits in each actual element of a regset. */
-
-#define REGSET_ELT_BITS HOST_BITS_PER_WIDE_INT
-
-/* Type to use for a regset element. Note that lots of code assumes
- that the initial part of a regset that contains information on the
- hard registers is the same format as a HARD_REG_SET. */
-
-#define REGSET_ELT_TYPE unsigned HOST_WIDE_INT
-
-/* Define the type for a pointer to a set with a bit for each
- (hard or pseudo) register. */
-
-typedef REGSET_ELT_TYPE *regset;
-
-/* Size of a regset for the current function,
- in (1) bytes and (2) elements. */
-
-extern int regset_bytes;
-extern int regset_size;
-
-/* Number of basic blocks in the current function. */
-
-extern int n_basic_blocks;
-
-/* Index by basic block number, get first insn in the block. */
-
-extern rtx *basic_block_head;
-
-/* Index by basic block number, get last insn in the block. */
-
-extern rtx *basic_block_end;
-
-/* Index by basic block number, get address of regset
- describing the registers live at the start of that block. */
-
-extern regset *basic_block_live_at_start;
-
-/* Indexed by n, gives number of basic block that (REG n) is used in.
- If the value is REG_BLOCK_GLOBAL (-2),
- it means (REG n) is used in more than one basic block.
- REG_BLOCK_UNKNOWN (-1) means it hasn't been seen yet so we don't know.
- This information remains valid for the rest of the compilation
- of the current function; it is used to control register allocation. */
-
-#define REG_BLOCK_UNKNOWN -1
-#define REG_BLOCK_GLOBAL -2
-extern int *reg_basic_block;
diff --git a/gcc/bc-emit.c b/gcc/bc-emit.c
deleted file mode 100644
index c93195df9e1..00000000000
--- a/gcc/bc-emit.c
+++ /dev/null
@@ -1,1018 +0,0 @@
-/* Output bytecodes for GNU C-compiler.
- Copyright (C) 1993, 1994, 1996 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. */
-
-
-#include "config.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "machmode.h"
-#include "rtl.h"
-#include "real.h"
-#include "obstack.h"
-#include "bytecode.h"
-#ifdef __GNUC__
-#include "bytetypes.h"
-#endif
-#include "bc-emit.h"
-#include "bc-opcode.h"
-#include "bc-typecd.h"
-#include "bi-run.h"
-
-#include <stdio.h>
-
-extern char *xmalloc (), *xrealloc ();
-
-extern struct obstack *rtl_obstack;
-
-/* Indexed by mode class, gives the narrowest mode for each class. */
-
-extern enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS];
-
-/* Commonly used modes. */
-/* Mode whose width is BITS_PER_UNIT */
-extern enum machine_mode byte_mode;
-
-/* Mode whose width is BITS_PER_WORD */
-extern enum machine_mode word_mode;
-
-/* Vector indexed by opcode giving info about the args for each opcode. */
-static struct arityvec arityvec[] = {
-#include "bc-arity.h"
-};
-
-/* How to print a symbol name for the assembler. */
-
-static void
-prsym (file, s)
- FILE *file;
- char *s;
-{
- if (*s == '*')
- fprintf (file, "%s", s + 1);
- else
-
-#ifdef NAMES_HAVE_UNDERSCORES
- fprintf (file, "_%s", s);
-#else
- fprintf (file, "%s", s);
-#endif
-
-}
-
-/* Maintain a bucket hash table for symbol names. */
-
-#define HASH_BITS 32
-#define HASH_SIZE 509
-
-static struct bc_sym *hashtab[HASH_SIZE];
-
-static unsigned int
-hash (name)
- char *name;
-{
- unsigned int hash = 0;
-
- while (*name)
- {
- hash = hash << 3 | hash >> HASH_BITS - 3;
- hash += *name++;
- }
-
- return hash % HASH_SIZE;
-}
-
-
-/* Look up the named symbol, creating it if it doesn't exist. */
-
-struct bc_sym *
-sym_lookup (name)
- char *name;
-{
- int i;
- struct bc_sym *s;
-
- i = hash (name);
- for (s = hashtab[i]; s; s = s->next)
- if (!strcmp (s->name, name))
- return s;
-
- s = (struct bc_sym *) xmalloc (sizeof (struct bc_sym));
- s->name = xmalloc (strlen (name) + 1);
- strcpy (s->name, name);
- s->defined = s->global = s->common = 0;
- s->val = 0;
- s->next = hashtab[i];
- hashtab[i] = s;
- return s;
-}
-
-
-/* Write out .globl and common symbols to the named file. */
-
-static void
-bc_sym_write (file)
- FILE *file;
-{
- int i;
- struct bc_sym *s;
-
- for (i = 0; i < HASH_SIZE; ++i)
- for (s = hashtab[i]; s; s = s->next)
- {
- if (s->global)
- {
- fprintf (file, "\n\t.globl ");
- prsym (file, s->name);
- putc ('\n', file);
- if (s->common)
- {
- fprintf (file, "\n\t.comm ");
- prsym (file, s->name);
- fprintf (file, ", %lu\n", s->val);
- }
- }
- else if (s->common)
- {
- fprintf (file, "\n\t.lcomm ");
- prsym (file, s->name);
- fprintf (file, ", %lu\n", s->val);
- }
- }
-}
-
-
-
-
-/* Create and initialize a new segment. */
-
-static struct bc_seg *
-seg_create ()
-{
- struct bc_seg *result;
-
- result = (struct bc_seg *) xmalloc (sizeof (struct bc_seg));
- result->alloc = 256;
- result->data = xmalloc (result->alloc);
- result->size = 0;
- result->syms = 0;
- result->relocs = 0;
- return result;
-}
-
-
-/* Advance the segment index to the next alignment boundary. */
-
-static void
-seg_align (seg, log)
- struct bc_seg *seg;
- int log;
-{
- unsigned int oldsize = seg->size;
-
- seg->size = seg->size + (1 << log) - 1 & ~((1 << log) - 1);
- if (seg->size > seg->alloc)
- {
- while (seg->size > seg->alloc)
- seg->alloc *= 2;
- seg->data = xrealloc (seg->data, seg->alloc);
- }
- bzero (seg->data + oldsize, seg->size - oldsize);
-}
-
-
-/* Append the given data to the given segment. */
-
-static void
-seg_data (seg, data, size)
- struct bc_seg *seg;
- char *data;
- unsigned int size;
-{
- if (seg->size + size > seg->alloc)
- {
- while (seg->size + size > seg->alloc)
- seg->alloc *= 2;
- seg->data = xrealloc (seg->data, seg->alloc);
- }
-
- bcopy (data, seg->data + seg->size, size);
- seg->size += size;
-}
-
-
-/* Append a zero-filled skip to the given segment. */
-
-static void
-seg_skip (seg, size)
- struct bc_seg *seg;
- unsigned int size;
-{
- if (seg->size + size > seg->alloc)
- {
- while (seg->size + size > seg->alloc)
- seg->alloc *= 2;
- seg->data = xrealloc (seg->data, seg->alloc);
- }
-
- memset (seg->data + seg->size, 0, size);
- seg->size += size;
-}
-
-
-/* Define the given name as the current offset in the given segment. It
- is an error if the name is already defined. Return 0 or 1 indicating
- failure or success respectively. */
-
-static int
-seg_defsym (seg, name)
- struct bc_seg *seg;
- char *name;
-{
- struct bc_sym *sym;
- struct bc_segsym *segsym;
-
- sym = sym_lookup (name);
- if (sym->defined)
- return 0;
-
- sym->defined = 1;
- sym->val = seg->size;
- segsym = (struct bc_segsym *) xmalloc (sizeof (struct bc_segsym));
- segsym->sym = sym;
- segsym->next = seg->syms;
- seg->syms = segsym;
- return 1;
-}
-
-
-/* Generate in seg's data a reference to the given sym, adjusted by
- the given offset. */
-
-static void
-seg_refsym (seg, name, offset)
- struct bc_seg *seg;
- char *name;
- int offset;
-{
- struct bc_sym *sym;
- struct bc_segreloc *segreloc;
-
- sym = sym_lookup (name);
- segreloc = (struct bc_segreloc *) xmalloc (sizeof (struct bc_segreloc));
- segreloc->offset = seg->size;
- segreloc->sym = sym;
- segreloc->next = seg->relocs;
- seg->relocs = segreloc;
- seg_data (seg, (char *) &offset, sizeof offset);
-}
-
-
-/* Concatenate the contents of given segments into the first argument. */
-
-static void
-seg_concat (result, seg)
- struct bc_seg *result, *seg;
-{
- unsigned int fix;
- struct bc_segsym *segsym;
- struct bc_segreloc *segreloc;
-
- seg_align (result, MACHINE_SEG_ALIGN);
- fix = result->size;
- seg_data (result, seg->data, seg->size);
- free (seg->data);
-
- /* Go through the symbols and relocs of SEG, adjusting their offsets
- for their new location in RESULT. */
- if (seg->syms)
- {
- segsym = seg->syms;
- do
- segsym->sym->val += fix;
- while (segsym->next && (segsym = segsym->next));
- segsym->next = result->syms;
- result->syms = seg->syms;
- }
- if (seg->relocs)
- {
- segreloc = seg->relocs;
- do
- segreloc->offset += fix;
- while (segreloc->next && (segreloc = segreloc->next));
- segreloc->next = result->relocs;
- result->relocs = seg->relocs;
- }
-
- free ((char *) seg);
-}
-
-/* Write a segment to a file. */
-
-static void
-bc_seg_write (seg, file)
- struct bc_seg *seg;
- FILE *file;
-{
- struct bc_segsym *segsym, *nsegsym, *psegsym;
- struct bc_segreloc *segreloc, *nsegreloc, *psegreloc;
- int i, offset, flag;
-
- /* Reverse the list of symbols. */
- for (psegsym = 0, segsym = seg->syms; segsym; segsym = nsegsym)
- {
- nsegsym = segsym->next;
- segsym->next = psegsym;
- psegsym = segsym;
- }
- seg->syms = psegsym;
-
- /* Reverse the list of relocs. */
- for (psegreloc = 0, segreloc = seg->relocs; segreloc; segreloc = nsegreloc)
- {
- nsegreloc = segreloc->next;
- segreloc->next = psegreloc;
- psegreloc = segreloc;
- }
- seg->relocs = psegreloc;
-
- /* Output each byte of the segment. */
- for (i = 0, segsym = seg->syms, segreloc = seg->relocs; i < seg->size; ++i)
- {
- while (segsym && segsym->sym->val == i)
- {
- if (i % 8 != 0)
- putc ('\n', file);
-
- BC_WRITE_SEGSYM (segsym, file);
- segsym = segsym->next;
- flag = 1;
- }
- if (segreloc && segreloc->offset == i)
- {
- if (i % 8 != 0)
- putc ('\n', file);
-
- bcopy (seg->data + i, (char *) &offset, sizeof (int));
- i += sizeof (int) - 1;
-
- BC_WRITE_RELOC_ENTRY (segreloc, file, offset);
- segreloc = segreloc->next;
- flag = 1;
- }
- else
- {
- if (i % 8 == 0 || flag)
- BC_START_BYTECODE_LINE (file);
-
- BC_WRITE_BYTECODE (i % 8 == 0 || flag ? ' ' : ',',
- seg->data[i] & 0xFF,
- file);
- flag = 0;
- if (i % 8 == 7)
- putc ('\n', file);
- }
- }
-
- /* Paranoia check--we should have visited all syms and relocs during
- the output pass. */
-
- if (segsym || segreloc)
- abort ();
-}
-
-
-
-/* Text and data segments of the object file in making. */
-static struct bc_seg *bc_text_seg;
-static struct bc_seg *bc_data_seg;
-
-/* Called before anything else in this module. */
-
-void
-bc_initialize ()
-{
- int min_class_size[(int) MAX_MODE_CLASS];
- enum machine_mode mode;
- int i;
-
- bc_init_mode_to_code_map ();
-
- bc_text_seg = seg_create ();
- bc_data_seg = seg_create ();
-
- dconst0 = REAL_VALUE_ATOF ("0", DFmode);
- dconst1 = REAL_VALUE_ATOF ("1", DFmode);
- dconst2 = REAL_VALUE_ATOF ("2", DFmode);
- dconstm1 = REAL_VALUE_ATOF ("-1", DFmode);
-
- /* Find the narrowest mode for each class and compute the word and byte
- modes. */
-
- for (i = 0; i < (int) MAX_MODE_CLASS; i++)
- min_class_size[i] = 1000;
-
- for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
- mode = (enum machine_mode) ((int) mode + 1))
- {
- if (GET_MODE_SIZE (mode) < min_class_size[(int) GET_MODE_CLASS (mode)])
- {
- class_narrowest_mode[(int) GET_MODE_CLASS (mode)] = mode;
- min_class_size[(int) GET_MODE_CLASS (mode)] = GET_MODE_SIZE (mode);
- }
- if (GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_BITSIZE (mode) == BITS_PER_UNIT)
- byte_mode = mode;
-
- if (GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_BITSIZE (mode) == BITS_PER_WORD)
- word_mode = mode;
- }
-}
-
-
-/* External addresses referenced in a function. Rather than trying to
- work relocatable address directly into bytecoded functions (which would
- require us to provide hairy location info and possibly obey alignment
- rules imposed by the architecture) we build an auxiliary table of
- pointer constants, and encode just offsets into this table into the
- actual bytecode. */
-static struct bc_seg *ptrconsts;
-
-/* Trampoline code for the function entry. */
-struct bc_seg *trampoline;
-
-/* Actual byte code of the function. */
-struct bc_seg *bytecode;
-
-/* List of labels defined in the function. */
-struct bc_label *labels;
-
-/* List of label references in the function. */
-struct bc_labelref *labelrefs;
-
-
-/* Add symbol to pointer table. Return offset into table where
- pointer was stored. The offset usually goes into the bytecode
- stream as a constP literal. */
-
-int
-bc_define_pointer (p)
- char *p;
-{
- int offset = ptrconsts->size;
-
- seg_refsym (ptrconsts, p, 0);
- return offset;
-}
-
-
-/* Begin a bytecoded function. */
-
-int
-bc_begin_function (name)
- char *name;
-{
- ptrconsts = seg_create ();
- trampoline = seg_create ();
- bytecode = seg_create ();
- return seg_defsym (trampoline, name);
-}
-
-
-/* Force alignment in inline bytecode. */
-
-void
-bc_align_bytecode (align)
- int align;
-{
- seg_align (bytecode, align);
-}
-
-
-/* Emit data inline into bytecode. */
-
-void
-bc_emit_bytecode_const (data, size)
- char *data;
- unsigned int size;
-{
- if (bytecode)
- seg_data (bytecode, data, size);
-}
-
-
-/* Create a new "bytecode label", to have its value defined later.
- Bytecode labels have nothing to do with the object file symbol table,
- and are purely local to a given bytecoded function. */
-
-struct bc_label *
-bc_get_bytecode_label ()
-{
- struct bc_label *result;
-
- result = (struct bc_label *) xmalloc (sizeof (struct bc_label));
- result->defined = 0;
- result->next = labels;
- result->uid = 0;
- labels = result;
- return result;
-}
-
-
-/* Define the given label with the current location counter. */
-
-int
-bc_emit_bytecode_labeldef (label)
- struct bc_label *label;
-{
- extern int bc_new_uid ();
-
- if (!label || label->defined)
- return 0;
-
- label->offset = bytecode->size;
- label->defined = 1;
- label->uid = bc_new_uid ();
-
-#ifdef DEBUG_PRINT_CODE
- fprintf (stderr, "$%lx:\n", label);
-#endif
-
- return 1;
-}
-
-
-/* Generate a location-relative reference to the given bytecode label.
- It need not be defined yet; label references will be backpatched later. */
-
-void
-bc_emit_bytecode_labelref (label)
- struct bc_label *label;
-{
- struct bc_labelref *labelref;
- static int zero;
-
- labelref = (struct bc_labelref *) xmalloc (sizeof (struct bc_labelref));
- labelref->label = label;
- labelref->offset = bytecode->size;
- labelref->next = labelrefs;
- labelrefs = labelref;
-
-#ifdef DEBUG_PRINT_CODE
- fprintf (stderr, " $%lx", label);
-#endif
-
- seg_data (bytecode, (char *) &zero, sizeof zero);
-}
-
-
-/* Emit a reference to an external address; generate the reference in the
- ptrconst area, and emit an offset in the bytecode. */
-
-void
-bc_emit_code_labelref (name, offset)
- char *name;
- int offset;
-{
- int ptroff;
-
- ptroff = ptrconsts->size / sizeof (char *);
- seg_data (bytecode, (char *) &ptroff, sizeof ptroff);
- seg_refsym (ptrconsts, name, offset);
-
-#ifdef DEBUG_PRINT_CODE
- fprintf (stderr, " [external <%x> %s]", ptroff, name);
-#endif
-}
-
-
-/* Backpatch label references in the byte code, and concatenate the bytecode
- and pointer constant segments to the cumulative text for the object file.
- Return a label name for the pointer constants region. */
-
-char *
-bc_end_function ()
-{
- int addr;
- struct bc_label *label, *next;
- struct bc_labelref *ref, *nextref;
- char ptrconsts_label[20];
- static int nlab;
-
- /* Backpatch bytecode label references. */
- for (ref = labelrefs; ref; ref = ref->next)
- if (ref->label->defined)
- {
- addr = ref->label->offset;
- bcopy ((char *) &addr, bytecode->data + ref->offset, sizeof addr);
- }
-
- /* Free the chains of labelrefs and labeldefs. */
- for (ref = labelrefs; ref; ref = nextref)
- {
- nextref = ref->next;
- free ((char *) ref);
- }
-
- for (label = labels; label; label = next)
- {
- next = label->next;
- free ((char *) label);
- }
-
- seg_concat (trampoline, bytecode);
- seg_align (trampoline, MACHINE_SEG_ALIGN);
- sprintf (ptrconsts_label, "*LP%d", nlab++);
- seg_defsym (trampoline, ptrconsts_label);
- seg_concat (trampoline, ptrconsts);
- seg_concat (bc_text_seg, trampoline);
-
- labels = 0;
- labelrefs = 0;
- trampoline = 0;
- bytecode = 0;
- ptrconsts = 0;
-
- return sym_lookup (ptrconsts_label)->name;
-}
-
-/* Force alignment in const data. */
-
-void
-bc_align_const (align)
- int align;
-{
- seg_align (bc_text_seg, align);
-}
-
-/* Emit const data. */
-
-void
-bc_emit_const (data, size)
- char *data;
- unsigned int size;
-{
- seg_data (bc_text_seg, data, size);
-}
-
-/* Emit a zero-filled constant skip. */
-
-void
-bc_emit_const_skip (size)
- unsigned int size;
-{
- seg_skip (bc_text_seg, size);
-}
-
-/* Emit a label definition in const data. */
-
-int
-bc_emit_const_labeldef (name)
- char *name;
-{
- return seg_defsym (bc_text_seg, name);
-}
-
-/* Emit a label reference in const data. */
-
-void
-bc_emit_const_labelref (name, offset)
- char *name;
- int offset;
-{
- seg_refsym (bc_text_seg, name, offset);
-}
-
-/* Force alignment in data. */
-
-void
-bc_align_data (align)
- int align;
-{
- seg_align (bc_data_seg, align);
-}
-
-/* Emit data. */
-
-void
-bc_emit_data (data, size)
- char *data;
- unsigned int size;
-{
- seg_data (bc_data_seg, data, size);
-}
-
-/* Emit a zero-filled data skip. */
-
-void
-bc_emit_data_skip (size)
- unsigned int size;
-{
- seg_skip (bc_data_seg, size);
-}
-
-/* Emit label definition in data. */
-
-int
-bc_emit_data_labeldef (name)
- char *name;
-{
- return seg_defsym (bc_data_seg, name);
-}
-
-/* Emit label reference in data. */
-
-void
-bc_emit_data_labelref (name, offset)
- char *name;
- int offset;
-{
- seg_refsym (bc_data_seg, name, offset);
-}
-
-/* Emit a common block of the given name and size. Note that
- when the .o file is actually written non-global "common"
- blocks will have to be turned into space in the data section. */
-
-int
-bc_emit_common (name, size)
- char *name;
- unsigned int size;
-{
- struct bc_sym *sym;
-
- sym = sym_lookup (name);
- if (sym->defined)
- return 0;
-
- sym->defined = 1;
- sym->common = 1;
- sym->val = size;
- return 1;
-}
-
-/* Globalize the given label. */
-
-void
-bc_globalize_label (name)
- char *name;
-{
- struct bc_sym *sym;
-
- sym = sym_lookup (name);
- sym->global = 1;
-}
-
-static enum { in_text, in_data } section = in_text;
-
-void
-bc_text ()
-{
- section = in_text;
-}
-
-void
-bc_data ()
-{
- section = in_data;
-}
-
-void
-bc_align (align)
- int align;
-{
- if (section == in_text)
- bc_align_const (align);
- else
- bc_align_data (align);
-}
-
-void
-bc_emit (data, size)
- char *data;
- unsigned int size;
-{
- if (section == in_text)
- bc_emit_const (data, size);
- else
- bc_emit_data (data, size);
-}
-
-void
-bc_emit_skip (size)
- unsigned int size;
-{
- if (section == in_text)
- bc_emit_const_skip (size);
- else
- bc_emit_data_skip (size);
-}
-
-int
-bc_emit_labeldef (name)
- char *name;
-{
- if (section == in_text)
- return bc_emit_const_labeldef (name);
- else
- return bc_emit_data_labeldef (name);
-}
-
-void
-bc_emit_labelref (name, offset)
- char *name;
- int offset;
-{
- if (section == in_text)
- bc_emit_const_labelref (name, offset);
- else
- bc_emit_data_labelref (name, offset);
-}
-
-void
-bc_write_file (file)
- FILE *file;
-{
- BC_WRITE_FILE (file);
-}
-
-
-/* Allocate a new bytecode rtx.
- If you supply a null BC_LABEL, we generate one. */
-
-rtx
-bc_gen_rtx (label, offset, bc_label)
- char *label;
- int offset;
- struct bc_label *bc_label;
-{
- rtx r;
-
- if (bc_label == 0)
- bc_label = (struct bc_label *) xmalloc (sizeof (struct bc_label));
-
- r = gen_rtx (CODE_LABEL, VOIDmode, label, bc_label);
- bc_label->offset = offset;
-
- return r;
-}
-
-
-/* Print bytecode rtx */
-
-void
-bc_print_rtl (fp, r)
- FILE *fp;
- rtx r;
-{
-#if 0 /* This needs to get fixed to really work again. */
- /* BC_WRITE_RTL has a definition
- that doesn't even make sense for this use. */
- BC_WRITE_RTL (r, fp);
-#endif
-}
-
-
-/* Emit a bytecode, keeping a running tally of the stack depth. */
-
-void
-bc_emit_bytecode (bytecode)
- enum bytecode_opcode bytecode;
-{
- char byte;
- static int prev_lineno = -1;
-
- byte = (char) bytecode;
-
-#ifdef BCDEBUG_PRINT_CODE
- if (lineno != prev_lineno)
- {
- fprintf (stderr, "<line %d>\n", lineno);
- prev_lineno = lineno;
- }
-
- fputs (opcode_name[(unsigned int) bytecode], stderr);
-#endif
-
- /* Due to errors we are often requested to output bytecodes that
- will cause an interpreter stack undeflow when executed. Instead of
- dumping core on such occasions, we omit the bytecode. Erroneous code
- should not be executed, regardless. This makes life much easier, since
- we don't have to deceive ourselves about the known stack depth. */
-
- bc_emit_bytecode_const (&byte, 1);
-
- if ((stack_depth -= arityvec[(int) bytecode].ninputs) >= 0)
- {
- if ((stack_depth += arityvec[(int) bytecode].noutputs) > max_stack_depth)
- max_stack_depth = stack_depth;
- }
-
-#ifdef VALIDATE_STACK_FOR_BC
- VALIDATE_STACK_FOR_BC ();
-#endif
-}
-
-
-#ifdef BCDEBUG_PRINT_CODE
-#define PRLIT(TYPE, PTR) fprintf (stderr, " [%x]", *(TYPE *) PTR)
-#else
-#define PRLIT(X,Y)
-#endif
-
-/* Emit a complete bytecode instruction, expecting the correct number
- of literal values in the call. First argument is the instruction, the
- remaining arguments are literals of size HOST_WIDE_INT or smaller. */
-
-void
-bc_emit_instruction VPROTO((enum bytecode_opcode opcode, ...))
-{
-#ifndef __STDC__
- enum bytecode_opcode opcode;
-#endif
- va_list arguments;
- int nliteral, instruction;
-
- VA_START (arguments, opcode);
-
-#ifndef __STDC__
- opcode = va_arg (arguments, enum bytecode_opcode);
-#endif
-
- /* Emit instruction bytecode */
- bc_emit_bytecode (opcode);
- instruction = (int) opcode;
-
- /* Loop literals and emit as bytecode constants */
- for (nliteral = 0; nliteral < arityvec[instruction].nliterals; nliteral++)
- {
- switch (arityvec[instruction].literals[nliteral])
- {
-/* This conditional is a kludge, but it's necessary
- because TYPE might be long long. */
-#ifdef __GNUC__
- /* Expand definitions into case statements */
-#define DEFTYPECODE(CODE, NAME, MODE, TYPE) \
- case CODE: \
- { \
- TYPE temp = va_arg (arguments, TYPE); \
- bc_emit_bytecode_const ((void *) &temp, sizeof temp); \
- PRLIT (TYPE, &temp); } \
- break;
-
-#include "bc-typecd.def"
-
-#undef DEFTYPECODE
-#endif /* __GNUC__ */
-
- default:
- abort ();
- }
- }
-
- va_end (arguments);
-
-#ifdef BCDEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-}
-
-/* Emit the machine-code interface trampoline at the beginning of a byte
- coded function. The argument is a label name of the interpreter
- bytecode callinfo structure; the return value is a label name for
- the beginning of the actual bytecode. */
-
-char *
-bc_emit_trampoline (callinfo)
- char *callinfo;
-{
- char mylab[20];
- static int n;
-
- sprintf (mylab, "*LB%d", n++);
-
- BC_EMIT_TRAMPOLINE (trampoline, callinfo);
-
- seg_defsym (bytecode, mylab);
- return sym_lookup (mylab)->name;
-}
diff --git a/gcc/bc-emit.h b/gcc/bc-emit.h
deleted file mode 100644
index c00da5b3539..00000000000
--- a/gcc/bc-emit.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* bc-emit.h - declare entry points for producing object files of bytecodes. */
-
-/* Internal format of symbol table for the object file. */
-struct bc_sym
-{
- /* Private copy separately malloc'd. */
- char *name;
-
- /* Symbol has a defined value. */
- unsigned int defined:1;
-
- /* Symbol has been globalized. */
- unsigned int global:1;
-
- /* Symbol is common. */
- unsigned int common:1;
-
- /* Value if defined. */
- unsigned long int val;
-
- /* Used in internal symbol table structure. */
- struct bc_sym *next;
-};
-
-
-/* List of symbols defined in a particular segment. */
-struct bc_segsym
-{
- struct bc_sym *sym;
- struct bc_segsym *next;
-};
-
-
-/* List of relocations needed in a particular segment. */
-struct bc_segreloc
-{
- /* Offset of datum to be relocated. */
- unsigned int offset;
-
- /* Symbol to be relocated by. */
- struct bc_sym *sym;
-
- struct bc_segreloc *next;
-};
-
-
-/* Segment of an object file. */
-struct bc_seg
-{
- /* Size allocated to contents. */
- unsigned int alloc;
-
- /* Pointer to base of contents. */
- char *data;
-
- /* Actual size of contents. */
- unsigned int size;
-
- /* List of symbols defined in this segment. */
- struct bc_segsym *syms;
-
- /* List of relocations for this segment. */
- struct bc_segreloc *relocs;
-};
-
-
-/* Anonymous bytecode label within a single function. */
-struct bc_label
-{
- /* Offset of label from start of segment. */
- unsigned int offset;
-
- /* True when offset is valid. */
- unsigned int defined:1;
-
- /* Unique bytecode ID, used to determine innermost
- block containment */
- int uid;
-
- /* Next node in list */
- struct bc_label *next;
-};
-
-
-/* Reference to a bc_label; a list of all such references is kept for
- the function, then when it is finished they are backpatched to
- contain the correct values. */
-
-struct bc_labelref
-{
- /* Label referenced. */
- struct bc_label *label;
-
- /* Code offset of reference. */
- unsigned int offset;
-
- /* Next labelref in list */
- struct bc_labelref *next;
-};
-
-
-
-extern void bc_initialize();
-extern int bc_begin_function();
-extern char *bc_emit_trampoline();
-extern void bc_emit_bytecode();
-extern void bc_emit_bytecode_const();
-extern struct bc_label *bc_get_bytecode_label();
-extern int bc_emit_bytecode_labeldef();
-extern void bc_emit_bytecode_labelref();
-extern void bc_emit_code_labelref();
-extern char *bc_end_function();
-extern void bc_align_const();
-extern void bc_emit_const();
-extern void bc_emit_const_skip();
-extern int bc_emit_const_labeldef();
-extern void bc_emit_const_labelref();
-extern void bc_align_data();
-extern void bc_emit_data();
-extern void bc_emit_data_skip();
-extern int bc_emit_data_labeldef();
-extern void bc_emit_data_labelref();
-extern int bc_define_pointer ();
-extern int bc_emit_common();
-extern void bc_globalize_label();
-extern void bc_text();
-extern void bc_data();
-extern void bc_align();
-extern void bc_emit();
-extern void bc_emit_skip();
-extern int bc_emit_labeldef();
-extern void bc_emit_labelref();
-extern void bc_write_file();
diff --git a/gcc/bc-optab.c b/gcc/bc-optab.c
deleted file mode 100644
index 63587e284a9..00000000000
--- a/gcc/bc-optab.c
+++ /dev/null
@@ -1,798 +0,0 @@
-/* Bytecode conversion definitions for GNU C-compiler.
- Copyright (C) 1993, 1994 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. */
-
-
-#include "config.h"
-#include "tree.h"
-#include "rtl.h"
-#include "machmode.h"
-#include "obstack.h"
-#include "bytecode.h"
-#include "bc-typecd.h"
-#include "bc-opcode.h"
-#include "bc-optab.h"
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern char *xmalloc ();
-
-/* Table relating interpreter typecodes to machine modes. */
-#define GET_TYPECODE_MODE(CODE) (typecode_mode[((int) CODE)])
-enum machine_mode typecode_mode[] = {
-#define DEFTYPECODE(CODE, NAME, MODE, TYPE) MODE,
-#include "bc-typecd.def"
-#undef DEFTYPECODE
-};
-
-/* Machine mode to type code map */
-static enum typecode signed_mode_to_code_map[MAX_MACHINE_MODE+1];
-static enum typecode unsigned_mode_to_code_map[MAX_MACHINE_MODE+1];
-
-#define GET_TYPECODE_SIZE(CODE) GET_MODE_SIZE (GET_TYPECODE_MODE (CODE))
-
-#define BIG_ARBITRARY_NUMBER 100000
-
-/* Table of recipes for conversions among scalar types, to be filled
- in as needed at run time. */
-static struct conversion_recipe
-{
- unsigned char *opcodes; /* Bytecodes to emit in order. */
- int nopcodes; /* Count of bytecodes. */
- int cost; /* A rather arbitrary cost function. */
-} conversion_recipe[NUM_TYPECODES][NUM_TYPECODES];
-
-/* Binary operator tables. */
-struct binary_operator optab_plus_expr[] = {
- { addSI, SIcode, SIcode, SIcode },
- { addDI, DIcode, DIcode, DIcode },
- { addSF, SFcode, SFcode, SFcode },
- { addDF, DFcode, DFcode, DFcode },
- { addXF, XFcode, XFcode, XFcode },
- { addPSI, Pcode, Pcode, SIcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_minus_expr[] = {
- { subSI, SIcode, SIcode, SIcode },
- { subDI, DIcode, DIcode, DIcode },
- { subSF, SFcode, SFcode, SFcode },
- { subDF, DFcode, DFcode, DFcode },
- { subXF, XFcode, XFcode, XFcode },
- { subPP, SIcode, Pcode, Pcode },
- { -1, -1, -1, -1 },
-};
-
-/* The ordering of the tables for multiplicative operators
- is such that unsigned operations will be preferred to signed
- operations when one argument is unsigned. */
-
-struct binary_operator optab_mult_expr[] = {
- { mulSU, SUcode, SUcode, SUcode },
- { mulDU, DUcode, DUcode, DUcode },
- { mulSI, SIcode, SIcode, SIcode },
- { mulDI, DIcode, DIcode, DIcode },
- { mulSF, SFcode, SFcode, SFcode },
- { mulDF, DFcode, DFcode, DFcode },
- { mulXF, XFcode, XFcode, XFcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_trunc_div_expr[] = {
- { divSU, SUcode, SUcode, SUcode },
- { divDU, DUcode, DUcode, DUcode },
- { divSI, SIcode, SIcode, SIcode },
- { divDI, DIcode, DIcode, DIcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_trunc_mod_expr[] = {
- { modSU, SUcode, SUcode, SUcode },
- { modDU, DUcode, DUcode, DUcode },
- { modSI, SIcode, SIcode, SIcode },
- { modDI, DIcode, DIcode, DIcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_rdiv_expr[] = {
- { divSF, SFcode, SFcode, SFcode },
- { divDF, DFcode, DFcode, DFcode },
- { divXF, XFcode, XFcode, XFcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_bit_and_expr[] = {
- { andSI, SIcode, SIcode, SIcode },
- { andDI, DIcode, DIcode, DIcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_bit_ior_expr[] = {
- { iorSI, SIcode, SIcode, SIcode },
- { iorDI, DIcode, DIcode, DIcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_bit_xor_expr[] = {
- { xorSI, SIcode, SIcode, SIcode },
- { xorDI, DIcode, DIcode, DIcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_lshift_expr[] = {
- { lshiftSI, SIcode, SIcode, SIcode },
- { lshiftSU, SUcode, SUcode, SIcode },
- { lshiftDI, DIcode, DIcode, SIcode },
- { lshiftDU, DUcode, DUcode, SIcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_rshift_expr[] = {
- { rshiftSI, SIcode, SIcode, SIcode },
- { rshiftSU, SUcode, SUcode, SIcode },
- { rshiftDI, DIcode, DIcode, SIcode },
- { rshiftDU, DUcode, DUcode, SIcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_truth_and_expr[] = {
- { andSI, SIcode, Tcode, Tcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_truth_or_expr[] = {
- { iorSI, SIcode, Tcode, Tcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_lt_expr[] = {
- { ltSI, Tcode, SIcode, SIcode },
- { ltSU, Tcode, SUcode, SUcode },
- { ltDI, Tcode, DIcode, DIcode },
- { ltDU, Tcode, DUcode, DUcode },
- { ltSF, Tcode, SFcode, SFcode },
- { ltDF, Tcode, DFcode, DFcode },
- { ltXF, Tcode, XFcode, XFcode },
- { ltP, Tcode, Pcode, Pcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_le_expr[] = {
- { leSI, Tcode, SIcode, SIcode },
- { leSU, Tcode, SUcode, SUcode },
- { leDI, Tcode, DIcode, DIcode },
- { leDU, Tcode, DUcode, DUcode },
- { leSF, Tcode, SFcode, SFcode },
- { leDF, Tcode, DFcode, DFcode },
- { leXF, Tcode, XFcode, XFcode },
- { leP, Tcode, Pcode, Pcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_ge_expr[] = {
- { geSI, Tcode, SIcode, SIcode },
- { geSU, Tcode, SUcode, SUcode },
- { geDI, Tcode, DIcode, DIcode },
- { geDU, Tcode, DUcode, DUcode },
- { geSF, Tcode, SFcode, SFcode },
- { geDF, Tcode, DFcode, DFcode },
- { geXF, Tcode, XFcode, XFcode },
- { geP, Tcode, Pcode, Pcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_gt_expr[] = {
- { gtSI, Tcode, SIcode, SIcode },
- { gtSU, Tcode, SUcode, SUcode },
- { gtDI, Tcode, DIcode, DIcode },
- { gtDU, Tcode, DUcode, DUcode },
- { gtSF, Tcode, SFcode, SFcode },
- { gtDF, Tcode, DFcode, DFcode },
- { gtXF, Tcode, XFcode, XFcode },
- { gtP, Tcode, Pcode, Pcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_eq_expr[] = {
- { eqSI, Tcode, SIcode, SIcode },
- { eqDI, Tcode, DIcode, DIcode },
- { eqSF, Tcode, SFcode, SFcode },
- { eqDF, Tcode, DFcode, DFcode },
- { eqXF, Tcode, XFcode, XFcode },
- { eqP, Tcode, Pcode, Pcode },
- { -1, -1, -1, -1 },
-};
-
-struct binary_operator optab_ne_expr[] = {
- { neSI, Tcode, SIcode, SIcode },
- { neDI, Tcode, DIcode, DIcode },
- { neSF, Tcode, SFcode, SFcode },
- { neDF, Tcode, DFcode, DFcode },
- { neXF, Tcode, XFcode, XFcode },
- { neP, Tcode, Pcode, Pcode },
- { -1, -1, -1, -1 },
-};
-
-/* Unary operator tables. */
-struct unary_operator optab_negate_expr[] = {
- { negSI, SIcode, SIcode },
- { negDI, DIcode, DIcode },
- { negSF, SFcode, SFcode },
- { negDF, DFcode, DFcode },
- { negXF, XFcode, XFcode },
- { -1, -1, -1 },
-};
-
-struct unary_operator optab_bit_not_expr[] = {
- { notSI, SIcode, SIcode },
- { notDI, DIcode, DIcode },
- { -1, -1, -1 },
-};
-
-struct unary_operator optab_truth_not_expr[] = {
- { notT, SIcode, SIcode },
- { -1, -1, -1 },
-};
-
-/* Increment operator tables. */
-struct increment_operator optab_predecrement_expr[] = {
- { predecQI, QIcode },
- { predecQI, QUcode },
- { predecHI, HIcode },
- { predecHI, HUcode },
- { predecSI, SIcode },
- { predecSI, SUcode },
- { predecDI, DIcode },
- { predecDI, DUcode },
- { predecP, Pcode },
- { predecSF, SFcode },
- { predecDF, DFcode },
- { predecXF, XFcode },
- { -1, -1 },
-};
-
-struct increment_operator optab_preincrement_expr[] = {
- { preincQI, QIcode },
- { preincQI, QUcode },
- { preincHI, HIcode },
- { preincHI, HUcode },
- { preincSI, SIcode },
- { preincSI, SUcode },
- { preincDI, DIcode },
- { preincDI, DUcode },
- { preincP, Pcode },
- { preincSF, SFcode },
- { preincDF, DFcode },
- { preincXF, XFcode },
- { -1, -1 },
-};
-
-struct increment_operator optab_postdecrement_expr[] = {
- { postdecQI, QIcode },
- { postdecQI, QUcode },
- { postdecHI, HIcode },
- { postdecHI, HUcode },
- { postdecSI, SIcode },
- { postdecSI, SUcode },
- { postdecDI, DIcode },
- { postdecDI, DUcode },
- { postdecP, Pcode },
- { postdecSF, SFcode },
- { postdecDF, DFcode },
- { postdecXF, XFcode },
- { -1, -1 },
-};
-
-struct increment_operator optab_postincrement_expr[] = {
- { postincQI, QIcode },
- { postincQI, QUcode },
- { postincHI, HIcode },
- { postincHI, HUcode },
- { postincSI, SIcode },
- { postincSI, SUcode },
- { postincDI, DIcode },
- { postincDI, DUcode },
- { postincP, Pcode },
- { postincSF, SFcode },
- { postincDF, DFcode },
- { postincXF, XFcode },
- { -1, -1 },
-};
-
-/* Table of conversions supported by the interpreter. */
-static struct conversion_info
-{
- enum bytecode_opcode opcode; /* here indicates the conversion needs no opcode. */
- enum typecode from;
- enum typecode to;
- int cost; /* 1 for no-op conversions, 2 for widening conversions,
- 4 for int/float conversions, 8 for narrowing conversions. */
-} conversion_info[] = {
- { -1, QIcode, QUcode, 1 },
- { -1, HIcode, HUcode, 1 },
- { -1, SIcode, SUcode, 1 },
- { -1, DIcode, DUcode, 1 },
- { -1, QUcode, QIcode, 1 },
- { -1, HUcode, HIcode, 1 },
- { -1, SUcode, SIcode, 1 },
- { -1, DUcode, DIcode, 1 },
- { -1, Tcode, SIcode, 1 },
- { convertQIHI, QIcode, HIcode, 2 },
- { convertQUHU, QUcode, HUcode, 2 },
- { convertQUSU, QUcode, SUcode, 2 },
- { convertHISI, HIcode, SIcode, 2 },
- { convertHUSU, HUcode, SUcode, 2 },
- { convertSIDI, SIcode, DIcode, 2 },
- { convertSUDU, SUcode, DUcode, 2 },
- { convertSFDF, SFcode, DFcode, 2 },
- { convertDFXF, DFcode, XFcode, 2 },
- { convertHIQI, HIcode, QIcode, 8 },
- { convertSIQI, SIcode, QIcode, 8 },
- { convertSIHI, SIcode, HIcode, 8 },
- { convertSUQU, SUcode, QUcode, 8 },
- { convertDISI, DIcode, SIcode, 8 },
- { convertDFSF, DFcode, SFcode, 8 },
- { convertXFDF, XFcode, DFcode, 8 },
- { convertPSI, Pcode, SIcode, 2 },
- { convertSIP, SIcode, Pcode, 2 },
- { convertSIT, SIcode, Tcode, 2 },
- { convertDIT, DIcode, Tcode, 2 },
- { convertSFT, SFcode, Tcode, 2 },
- { convertDFT, DFcode, Tcode, 2 },
- { convertXFT, XFcode, Tcode, 2 },
- { convertQISI, QIcode, SIcode, 2 },
- { convertPT, Pcode, Tcode, 2 },
- { convertSISF, SIcode, SFcode, 4 },
- { convertSIDF, SIcode, DFcode, 4 },
- { convertSIXF, SIcode, XFcode, 4 },
- { convertSUSF, SUcode, SFcode, 4 },
- { convertSUDF, SUcode, DFcode, 4 },
- { convertSUXF, SUcode, XFcode, 4 },
- { convertDISF, DIcode, SFcode, 4 },
- { convertDIDF, DIcode, DFcode, 4 },
- { convertDIXF, DIcode, XFcode, 4 },
- { convertDUSF, DUcode, SFcode, 4 },
- { convertDUDF, DUcode, DFcode, 4 },
- { convertDUXF, DUcode, XFcode, 4 },
- { convertSFSI, SFcode, SIcode, 4 },
- { convertDFSI, DFcode, SIcode, 4 },
- { convertXFSI, XFcode, SIcode, 4 },
- { convertSFSU, SFcode, SUcode, 4 },
- { convertDFSU, DFcode, SUcode, 4 },
- { convertXFSU, XFcode, SUcode, 4 },
- { convertSFDI, SFcode, DIcode, 4 },
- { convertDFDI, DFcode, DIcode, 4 },
- { convertXFDI, XFcode, DIcode, 4 },
- { convertSFDU, SFcode, DUcode, 4 },
- { convertDFDU, DFcode, DUcode, 4 },
- { convertXFDU, XFcode, DUcode, 4 },
- { convertSIQI, SIcode, QIcode, 8 },
-};
-
-#define NUM_CONVERSIONS (sizeof conversion_info / sizeof (struct conversion_info))
-
-/* List form of a conversion recipe. */
-struct conversion_list
-{
- enum bytecode_opcode opcode;
- enum typecode to;
- int cost;
- struct conversion_list *prev;
-};
-
-/* Determine if it is "reasonable" to add a given conversion to
- a given list of conversions. The following criteria define
- "reasonable" conversion lists:
- * No typecode appears more than once in the sequence (no loops).
- * At most one conversion from integer to float or vice versa is present.
- * Either sign extensions or zero extensions may be present, but not both.
- * No widening conversions occur after a signed/unsigned conversion.
- * The sequence of sizes must be strict nonincreasing or nondecreasing. */
-
-static int
-conversion_reasonable_p (conversion, list)
- struct conversion_info *conversion;
- struct conversion_list *list;
-{
- struct conversion_list *curr;
- int curr_size, prev_size;
- int has_int_float, has_float_int;
- int has_sign_extend, has_zero_extend;
- int has_signed_unsigned, has_unsigned_signed;
-
- has_int_float = 0;
- has_float_int = 0;
- has_sign_extend = 0;
- has_zero_extend = 0;
- has_signed_unsigned = 0;
- has_unsigned_signed = 0;
-
- /* Make sure the destination typecode doesn't already appear in
- the list. */
- for (curr = list; curr; curr = curr->prev)
- if (conversion->to == curr->to)
- return 0;
-
- /* Check for certain kinds of conversions. */
- if (TYPECODE_INTEGER_P (conversion->from)
- && TYPECODE_FLOAT_P (conversion->to))
- has_int_float = 1;
- if (TYPECODE_FLOAT_P (conversion->from)
- && TYPECODE_INTEGER_P (conversion->to))
- has_float_int = 1;
- if (TYPECODE_SIGNED_P (conversion->from)
- && TYPECODE_SIGNED_P (conversion->to)
- && GET_TYPECODE_SIZE (conversion->from)
- < GET_TYPECODE_SIZE (conversion->to))
- has_sign_extend = 1;
- if (TYPECODE_UNSIGNED_P (conversion->from)
- && TYPECODE_UNSIGNED_P (conversion->to)
- && GET_TYPECODE_SIZE (conversion->from)
- < GET_TYPECODE_SIZE (conversion->to))
- has_zero_extend = 1;
-
- for (curr = list; curr && curr->prev; curr = curr->prev)
- {
- if (TYPECODE_INTEGER_P (curr->prev->to)
- && TYPECODE_FLOAT_P (curr->to))
- has_int_float = 1;
- if (TYPECODE_FLOAT_P (curr->prev->to)
- && TYPECODE_INTEGER_P (curr->to))
- has_float_int = 1;
- if (TYPECODE_SIGNED_P (curr->prev->to)
- && TYPECODE_SIGNED_P (curr->to)
- && GET_TYPECODE_SIZE (curr->prev->to)
- < GET_TYPECODE_SIZE (curr->to))
- has_sign_extend = 1;
- if (TYPECODE_UNSIGNED_P (curr->prev->to)
- && TYPECODE_UNSIGNED_P (curr->to)
- && GET_TYPECODE_SIZE (curr->prev->to)
- < GET_TYPECODE_SIZE (curr->to))
- has_zero_extend = 1;
- if (TYPECODE_SIGNED_P (curr->prev->to)
- && TYPECODE_UNSIGNED_P (curr->to))
- has_signed_unsigned = 1;
- if (TYPECODE_UNSIGNED_P (curr->prev->to)
- && TYPECODE_SIGNED_P (curr->to))
- has_unsigned_signed = 1;
- }
-
- if (TYPECODE_INTEGER_P (conversion->from)
- && TYPECODE_INTEGER_P (conversion->to)
- && GET_TYPECODE_SIZE (conversion->to)
- > GET_TYPECODE_SIZE (conversion->from)
- && (has_signed_unsigned || has_unsigned_signed))
- return 0;
-
- if (has_float_int && has_int_float || has_sign_extend && has_zero_extend)
- return 0;
-
- /* Make sure the sequence of destination typecode sizes is
- strictly nondecreasing or strictly nonincreasing. */
- prev_size = GET_TYPECODE_SIZE (conversion->to);
- for (curr = list; curr; curr = curr->prev)
- {
- curr_size = GET_TYPECODE_SIZE (curr->to);
- if (curr_size != prev_size)
- break;
- }
- if (!curr)
- return 1;
-
- if (curr_size < prev_size)
- for (prev_size = curr_size; curr; curr = curr->prev)
- {
- curr_size = GET_TYPECODE_SIZE (curr->to);
- if (curr_size > prev_size)
- return 0;
- prev_size = curr_size;
- }
- else
- for (prev_size = curr_size; curr; curr = curr->prev)
- {
- curr_size = GET_TYPECODE_SIZE (curr->to);
- if (curr_size < prev_size)
- return 0;
- prev_size = curr_size;
- }
- return 1;
-}
-
-
-/* Exhaustively search all reasonable conversions to find one to
- convert the given types. */
-
-static struct conversion_recipe
-deduce_conversion (from, to)
- enum typecode from, to;
-{
- struct rl
- {
- struct conversion_list *list;
- struct rl *next;
- } *prev, curr, *good, *temp;
- struct conversion_list *conv, *best;
- int i, cost, bestcost;
- struct conversion_recipe result;
- struct obstack recipe_obstack;
-
-
- obstack_init (&recipe_obstack);
- curr.next = (struct rl *) obstack_alloc (&recipe_obstack, sizeof (struct rl));
- curr.next->list =
- (struct conversion_list *) obstack_alloc (&recipe_obstack,
- sizeof (struct conversion_list));
- curr.next->list->opcode = -1;
- curr.next->list->to = from;
- curr.next->list->cost = 0;
- curr.next->list->prev = 0;
- curr.next->next = 0;
- good = 0;
-
- while (curr.next)
- {
- /* Remove successful conversions from further consideration. */
- for (prev = &curr; prev; prev = prev->next)
- if (prev->next && prev->next->list->to == to)
- {
- temp = prev->next->next;
- prev->next->next = good;
- good = prev->next;
- prev->next = temp;
- }
-
- /* Go through each of the pending conversion chains, trying
- all possible candidate conversions on them. */
- for (prev = curr.next, curr.next = 0; prev; prev = prev->next)
- for (i = 0; i < NUM_CONVERSIONS; ++i)
- if (conversion_info[i].from == prev->list->to
- && conversion_reasonable_p (&conversion_info[i], prev->list))
- {
- temp = (struct rl *) obstack_alloc (&recipe_obstack,
- sizeof (struct rl));
- temp->list = (struct conversion_list *)
- obstack_alloc (&recipe_obstack,
- sizeof (struct conversion_list));
- temp->list->opcode = conversion_info[i].opcode;
- temp->list->to = conversion_info[i].to;
- temp->list->cost = conversion_info[i].cost;
- temp->list->prev = prev->list;
- temp->next = curr.next;
- curr.next = temp;
- }
- }
-
- bestcost = BIG_ARBITRARY_NUMBER;
- best = 0;
- for (temp = good; temp; temp = temp->next)
- {
- for (conv = temp->list, cost = 0; conv; conv = conv->prev)
- cost += conv->cost;
- if (cost < bestcost)
- {
- bestcost = cost;
- best = temp->list;
- }
- }
-
- if (!best)
- abort ();
-
- for (i = 0, conv = best; conv; conv = conv->prev)
- if (conv->opcode != -1)
- ++i;
-
- result.opcodes = (unsigned char *) xmalloc (i);
- result.nopcodes = i;
- for (conv = best; conv; conv = conv->prev)
- if (conv->opcode != -1)
- result.opcodes[--i] = conv->opcode;
- result.cost = bestcost;
- obstack_free (&recipe_obstack, 0);
- return result;
-}
-
-#define DEDUCE_CONVERSION(FROM, TO) \
- (conversion_recipe[(int) FROM][(int) TO].opcodes ? 0 \
- : (conversion_recipe[(int) FROM][(int) TO] \
- = deduce_conversion (FROM, TO), 0))
-
-
-/* Emit a conversion between the given scalar types. */
-
-void
-emit_typecode_conversion (from, to)
- enum typecode from, to;
-{
- int i;
-
- DEDUCE_CONVERSION (from, to);
- for (i = 0; i < conversion_recipe[(int) from][(int) to].nopcodes; ++i)
- bc_emit_instruction (conversion_recipe[(int) from][(int) to].opcodes[i]);
-}
-
-
-/* Initialize mode_to_code_map[] */
-
-void
-bc_init_mode_to_code_map ()
-{
- int mode;
-
- for (mode = 0; mode < MAX_MACHINE_MODE + 1; mode++)
- {
- signed_mode_to_code_map[mode] =
- unsigned_mode_to_code_map[mode] =
- LAST_AND_UNUSED_TYPECODE;
- }
-
-#define DEF_MODEMAP(SYM, CODE, UCODE, CONST, LOAD, STORE) \
- { signed_mode_to_code_map[(int) SYM] = CODE; \
- unsigned_mode_to_code_map[(int) SYM] = UCODE; }
-#include "modemap.def"
-#undef DEF_MODEMAP
-
- /* Initialize opcode maps for const, load, and store */
- bc_init_mode_to_opcode_maps ();
-}
-
-/* Given a machine mode return the preferred typecode. */
-
-enum typecode
-preferred_typecode (mode, unsignedp)
- enum machine_mode mode;
- int unsignedp;
-{
- enum typecode code = (unsignedp
- ? unsigned_mode_to_code_map
- : signed_mode_to_code_map) [MIN ((int) mode,
- (int) MAX_MACHINE_MODE)];
-
- if (code == LAST_AND_UNUSED_TYPECODE)
- abort ();
-
- return code;
-}
-
-
-/* Expand a conversion between the given types. */
-
-void
-bc_expand_conversion (from, to)
- tree from, to;
-{
- enum typecode fcode, tcode;
-
- fcode = preferred_typecode (TYPE_MODE (from), TREE_UNSIGNED (from));
- tcode = preferred_typecode (TYPE_MODE (to), TREE_UNSIGNED (to));
-
- emit_typecode_conversion (fcode, tcode);
-}
-
-/* Expand a conversion of the given type to a truth value. */
-
-void
-bc_expand_truth_conversion (from)
- tree from;
-{
- enum typecode fcode;
-
- fcode = preferred_typecode (TYPE_MODE (from), TREE_UNSIGNED (from));
- emit_typecode_conversion (fcode, Tcode);
-}
-
-/* Emit an appropriate binary operation. */
-
-void
-bc_expand_binary_operation (optab, resulttype, arg0, arg1)
- struct binary_operator optab[];
- tree resulttype, arg0, arg1;
-{
- int i, besti, cost, bestcost;
- enum typecode resultcode, arg0code, arg1code;
-
- resultcode = preferred_typecode (TYPE_MODE (resulttype), TREE_UNSIGNED (resulttype));
- arg0code = preferred_typecode (TYPE_MODE (TREE_TYPE (arg0)), TREE_UNSIGNED (resulttype));
- arg1code = preferred_typecode (TYPE_MODE (TREE_TYPE (arg1)), TREE_UNSIGNED (resulttype));
-
- besti = -1;
- bestcost = BIG_ARBITRARY_NUMBER;
-
- for (i = 0; optab[i].opcode != -1; ++i)
- {
- cost = 0;
- DEDUCE_CONVERSION (arg0code, optab[i].arg0);
- cost += conversion_recipe[(int) arg0code][(int) optab[i].arg0].cost;
- DEDUCE_CONVERSION (arg1code, optab[i].arg1);
- cost += conversion_recipe[(int) arg1code][(int) optab[i].arg1].cost;
- if (cost < bestcost)
- {
- besti = i;
- bestcost = cost;
- }
- }
-
- if (besti == -1)
- abort ();
-
- expand_expr (arg1, 0, VOIDmode, 0);
- emit_typecode_conversion (arg1code, optab[besti].arg1);
- expand_expr (arg0, 0, VOIDmode, 0);
- emit_typecode_conversion (arg0code, optab[besti].arg0);
- bc_emit_instruction (optab[besti].opcode);
- emit_typecode_conversion (optab[besti].result, resultcode);
-}
-
-/* Emit an appropriate unary operation. */
-
-void
-bc_expand_unary_operation (optab, resulttype, arg0)
- struct unary_operator optab[];
- tree resulttype, arg0;
-{
- int i, besti, cost, bestcost;
- enum typecode resultcode, arg0code;
-
- resultcode = preferred_typecode (TYPE_MODE (resulttype), TREE_UNSIGNED (resulttype));
- arg0code = preferred_typecode (TYPE_MODE (TREE_TYPE (arg0)), TREE_UNSIGNED (TREE_TYPE (arg0)));
-
- besti = -1;
- bestcost = BIG_ARBITRARY_NUMBER;
-
- for (i = 0; optab[i].opcode != -1; ++i)
- {
- DEDUCE_CONVERSION (arg0code, optab[i].arg0);
- cost = conversion_recipe[(int) arg0code][(int) optab[i].arg0].cost;
- if (cost < bestcost)
- {
- besti = i;
- bestcost = cost;
- }
- }
-
- if (besti == -1)
- abort ();
-
- expand_expr (arg0, 0, VOIDmode, 0);
- emit_typecode_conversion (arg0code, optab[besti].arg0);
- bc_emit_instruction (optab[besti].opcode);
- emit_typecode_conversion (optab[besti].result, resultcode);
-}
-
-
-/* Emit an appropriate increment. */
-
-void
-bc_expand_increment (optab, type)
- struct increment_operator optab[];
- tree type;
-{
- enum typecode code;
- int i;
-
- code = preferred_typecode (TYPE_MODE (type), TREE_UNSIGNED (type));
- for (i = 0; (int) optab[i].opcode >= 0; ++i)
- if (code == optab[i].arg)
- {
- bc_emit_instruction (optab[i].opcode);
- return;
- }
- abort ();
-}
diff --git a/gcc/bc-optab.h b/gcc/bc-optab.h
deleted file mode 100644
index 6ad0b8592f6..00000000000
--- a/gcc/bc-optab.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Bytecode token definitions for GNU C-compiler.
- Copyright (C) 1993 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. */
-
-
-extern void bc_expand_conversion ();
-extern void bc_expand_truth_conversion ();
-extern void bc_expand_binary_operation ();
-extern void bc_expand_unary_operation ();
-
-struct binary_operator
-{
- enum bytecode_opcode opcode;
- enum typecode result;
- enum typecode arg0;
- enum typecode arg1;
-};
-
-extern struct binary_operator optab_plus_expr[];
-extern struct binary_operator optab_minus_expr[];
-extern struct binary_operator optab_mult_expr[];
-extern struct binary_operator optab_trunc_div_expr[];
-extern struct binary_operator optab_trunc_mod_expr[];
-extern struct binary_operator optab_rdiv_expr[];
-extern struct binary_operator optab_bit_and_expr[];
-extern struct binary_operator optab_bit_ior_expr[];
-extern struct binary_operator optab_bit_xor_expr[];
-extern struct binary_operator optab_lshift_expr[];
-extern struct binary_operator optab_rshift_expr[];
-extern struct binary_operator optab_truth_and_expr[];
-extern struct binary_operator optab_truth_or_expr[];
-extern struct binary_operator optab_lt_expr[];
-extern struct binary_operator optab_le_expr[];
-extern struct binary_operator optab_ge_expr[];
-extern struct binary_operator optab_gt_expr[];
-extern struct binary_operator optab_eq_expr[];
-extern struct binary_operator optab_ne_expr[];
-
-struct unary_operator
-{
- enum bytecode_opcode opcode;
- enum typecode result;
- enum typecode arg0;
-};
-
-extern struct unary_operator optab_negate_expr[];
-extern struct unary_operator optab_bit_not_expr[];
-extern struct unary_operator optab_truth_not_expr[];
-
-struct increment_operator
-{
- enum bytecode_opcode opcode;
- enum typecode arg;
-};
-
-extern struct increment_operator optab_predecrement_expr[];
-extern struct increment_operator optab_preincrement_expr[];
-extern struct increment_operator optab_postdecrement_expr[];
-extern struct increment_operator optab_postincrement_expr[];
diff --git a/gcc/bc-typecd.def b/gcc/bc-typecd.def
deleted file mode 100644
index fd92cdd9282..00000000000
--- a/gcc/bc-typecd.def
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Typecodes used by the interpreter and their related
- machine modes and types.
-
- The last argument is used for retrieving the given
- type from a varargs list. Due to a bug in varargs,
- the type has to be the generic machine type of
- larger. */
-
-DEFTYPECODE (QIcode, "QI", QImode, SItype)
-DEFTYPECODE (QUcode, "QU", QImode, SUtype)
-DEFTYPECODE (HIcode, "HI", HImode, SItype)
-DEFTYPECODE (HUcode, "HU", HImode, SUtype)
-DEFTYPECODE (SIcode, "SI", SImode, SItype)
-DEFTYPECODE (SUcode, "SU", SImode, SUtype)
-DEFTYPECODE (DIcode, "DI", DImode, DItype)
-DEFTYPECODE (DUcode, "DU", DImode, DUtype)
-DEFTYPECODE (SFcode, "SF", SFmode, SFtype)
-DEFTYPECODE (DFcode, "DF", DFmode, DFtype)
-DEFTYPECODE (XFcode, "XF", XFmode, XFtype)
-DEFTYPECODE (Pcode, "P", PSImode, Ptype)
-DEFTYPECODE (Tcode, "T", SImode, SItype)
diff --git a/gcc/bc-typecd.h b/gcc/bc-typecd.h
deleted file mode 100644
index 2dcea0e08f5..00000000000
--- a/gcc/bc-typecd.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Typecode definitions for Bytecode Interpreter.
- Copyright (C) 1993 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. */
-
-#ifndef TYPECODE_H
-#define TYPECODE_H
-
-enum typecode
-{
-#define DEFTYPECODE(CODE, NAME, MACHMODE, TYPE) CODE,
-#include "bc-typecd.def"
-#undef DEFTYPECODE
-
- LAST_AND_UNUSED_TYPECODE
-};
-
-/* Determine if a given type is integer. */
-#define TYPECODE_INTEGER_P(TYPECODE) ((int) (TYPECODE) < (int) SFcode)
-
-/* Determine if a given type is unsigned. */
-#define TYPECODE_UNSIGNED_P(TYPECODE) \
- (TYPECODE_INTEGER_P(TYPECODE) && (int) (TYPECODE) & 1)
-
-/* Determine if a given type is signed. */
-#define TYPECODE_SIGNED_P(TYPECODE) \
- (TYPECODE_INTEGER_P(TYPECODE) && !((int) (TYPECODE) & 1))
-
-/* Determine if a given type is floating. */
-#define TYPECODE_FLOAT_P(TYPECODE) \
- ((int) (TYPECODE) < (int) Pcode && !TYPECODE_INTEGER_P(TYPECODE))
-
-/* Determine if the given type is arithmetic. */
-#define TYPECODE_ARITH_P(TYPECODE) \
- (TYPECODE_INTEGER_P(TYPECODE) || TYPECODE_FLOAT_P(TYPECODE))
-
-#define NUM_TYPECODES ((int) LAST_AND_UNUSED_TYPECODE)
-
-#endif
diff --git a/gcc/bi-arity.c b/gcc/bi-arity.c
deleted file mode 100644
index ea1f3e1de08..00000000000
--- a/gcc/bi-arity.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Bytecode Interpreter utility to generate arity table.
- Copyright (C) 1993 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. */
-
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "bi-defs.h"
-
-int
-length (n)
- struct node *n;
-{
- int k;
-
- for (k = 0; n; n = n->next)
- ++k;
- return k;
-}
-
-int
-main ()
-{
- struct def *d;
- struct variation *v;
- struct node *n;
-
- yyparse ();
- reverse ();
-
- for (d = defs; d; d = d->next)
- for (v = d->variations; v; v = v->next)
- {
- printf ("{ %d, %d, %d, {", length (v->inputs),
- length (v->outputs), length (v->literals));
- for (n = v->literals; n; n = n->next)
- printf ("(char) %scode, ", n->text);
- if (v->literals == 0)
- printf ("0");
- printf ("}},\n");
- }
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
-
-/* Safely allocate NBYTES bytes of memory. Returns pointer to block of
- memory. */
-
-char *
-xmalloc (nbytes)
- int nbytes;
-{
- char *tmp = (char *) malloc (nbytes);
-
- if (!tmp)
- {
- fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
- exit (FATAL_EXIT_CODE);
- }
-
- return tmp;
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fprintf (stderr, "Internal gcc abort.\n");
- exit (FATAL_EXIT_CODE);
-}
diff --git a/gcc/bi-defs.h b/gcc/bi-defs.h
deleted file mode 100644
index 868312a847d..00000000000
--- a/gcc/bi-defs.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Definitions for Bytecode Interpreter.
- Copyright (C) 1993 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. */
-
-
-struct node
-{
- char *text;
- struct node *next;
-};
-
-struct variation
-{
- char *name;
- int code;
- struct node *inputs;
- struct node *outputs;
- struct node *literals;
- struct variation *next;
-};
-
-struct def
-{
- char *basename;
- char *template;
- struct variation *variations;
- struct def *next;
-};
-
-extern struct def *defs;
-extern int ndefs;
-extern void reverse();
diff --git a/gcc/bi-lexer.c b/gcc/bi-lexer.c
deleted file mode 100644
index 0ec0b1d56d3..00000000000
--- a/gcc/bi-lexer.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Lexer for scanner of bytecode definition file.
- Copyright (C) 1993, 1995 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. */
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "bi-parser.h"
-
-
-/* Safely allocate NBYTES bytes of memory. Returns pointer to block of
- memory. */
-
-static char *
-xmalloc (nbytes)
- int nbytes;
-{
- char *tmp = (char *) malloc (nbytes);
-
- if (!tmp)
- {
- fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
- exit (FATAL_EXIT_CODE);
- }
-
- return tmp;
-}
-
-
-/* Safely reallocate BLOCK so its size becomes NBYTES.
- The block returned may be different from the one supplied. */
-
-static char *
-xrealloc (block, nbytes)
- char *block;
- int nbytes;
-{
- char *tmp = (block
- ? (char *) realloc (block, nbytes)
- : (char *) malloc (nbytes));
-
- if (!tmp)
- {
- fprintf (stderr, "can't reallocate %d bytes (out of virtual memory)\n", nbytes);
- exit (FATAL_EXIT_CODE);
- }
-
- return tmp;
-}
-
-
-/* Scan for string token on standard input. A string is, for our
- purposes here, a sequence of characters that starts with the regexp
- ``[^ #\t\n(),]'' and is then followed by the regexp ``[^#(),]*''. Any
- character is accepted if preceded by a backslash, "\\". It is assumed
- that the first character has already been checked by the main loop. */
-
-static char *
-scan_string ()
-{
- char *buffer = NULL;
- char *point = NULL;
- int buffer_size = 0;
- int c;
-
- while ((c = getc (stdin)) != EOF
- && c != '#' && c != '(' && c != ')' && c != ',')
- {
- /* Extend buffer, if necessary (minus two so there's room for the NUL
- trailer as well as another character if this one is a backslash). */
- if (!buffer_size || (point - buffer >= buffer_size-2))
- {
- int previous_point_index = point - buffer;
-
- buffer_size = (!buffer_size ? 32 : buffer_size * 2);
- if (!buffer)
- buffer = xmalloc (buffer_size);
- else
- buffer = xrealloc (buffer, buffer_size);
-
- point = buffer + previous_point_index;
- }
- *point++ = c & 0xff;
-
- if (c == '\\')
- {
- c = getc (stdin);
-
- /* Catch special case: backslash at end of file */
- if (c == EOF)
- break;
-
- *point++ = c;
- }
- }
- *point = 0;
-
- if (c != EOF)
- ungetc (c, stdin);
-
- return buffer;
-}
-
-
-int
-yylex ()
-{
- int c;
- char *token;
-
-
- /* First char determines what token we're looking at */
- for (;;)
- {
- c = getc (stdin);
-
- switch (c)
- {
- case EOF:
- return 0;
-
- case ' ':
- case '\t':
- case '\n':
- /* Ignore whitespace */
- continue;
-
- case '#':
- /* Comments advance to next line */
- while ((c = getc (stdin)) != '\n' && c != EOF);
- continue;
-
- default:
- if (c != '(' && c != ')' && c != '\\' && c != ',')
- {
- ungetc (c, stdin);
- yylval.string = scan_string ();
-
- /* Check if string is "define_operator"; if so, return
- a DEFOP token instead. */
- if (!strcmp (yylval.string, "define_operator"))
- {
- free (yylval.string);
- yylval.string = 0;
- return DEFOP;
- }
- return STRING;
- }
- return c & 0xff;
- }
- }
-}
diff --git a/gcc/bi-opcode.c b/gcc/bi-opcode.c
deleted file mode 100644
index 795bb6fb275..00000000000
--- a/gcc/bi-opcode.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Utility to generate opcode list from bytecode definition.
- Copyright (C) 1993, 1994 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. */
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "bi-defs.h"
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- struct def *d;
- struct variation *v;
- int i;
-
- yyparse();
- reverse();
-
-
- printf ("/* This file is automatically generated from bytecode.def,\n");
- printf ("do not make any changes here. Instead edit bytecode.def. */\n\n");
- printf ("enum bytecode_opcode\n{");
-
- i = 0;
- for (d = defs; d; d = d->next)
- for (v = d->variations; v; v = v->next)
- {
- printf (" %s%s,\n", d->basename, v->name);
- ++i;
- }
-
- puts (" LAST_AND_UNUSED_OPCODE\n};");
-
- if (i > 256)
- fprintf (stderr, "%s: warning, number of opcodes is %d\n", *argv, i);
- else
- fprintf (stderr, "(Number of opcodes is %d)\n", i);
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
-
-/* Safely allocate NBYTES bytes of memory. Returns pointer to block of
- memory. */
-
-char *
-xmalloc (nbytes)
- int nbytes;
-{
- char *tmp = (char *) malloc (nbytes);
-
- if (!tmp)
- {
- fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
- exit (FATAL_EXIT_CODE);
- }
-
- return tmp;
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fprintf (stderr, "Internal gcc abort.\n");
- exit (FATAL_EXIT_CODE);
-}
diff --git a/gcc/bi-opname.c b/gcc/bi-opname.c
deleted file mode 100644
index 2f41dd27dbc..00000000000
--- a/gcc/bi-opname.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Utility to generate opcode name list from bytecode definition file.
- Copyright (C) 1993 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. */
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "bi-defs.h"
-
-int
-main()
-{
- struct def *d;
- struct variation *v;
-
- yyparse();
- reverse();
-
- for (d = defs; d; d = d->next)
- for (v = d->variations; v; v = v->next)
- printf("\"%s%s\",\n", d->basename, v->name);
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
-
-/* Safely allocate NBYTES bytes of memory. Returns pointer to block of
- memory. */
-
-char *
-xmalloc (nbytes)
- int nbytes;
-{
- char *tmp = (char *) malloc (nbytes);
-
- if (!tmp)
- {
- fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
- exit (FATAL_EXIT_CODE);
- }
-
- return tmp;
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fprintf (stderr, "Internal gcc abort.\n");
- exit (FATAL_EXIT_CODE);
-}
diff --git a/gcc/bi-parser.y b/gcc/bi-parser.y
deleted file mode 100644
index 0a03d0f05ad..00000000000
--- a/gcc/bi-parser.y
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Bytecode definition file parser.
- Copyright (C) 1993 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. */
-
-
-%{
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "bi-defs.h"
-
-extern char yytext[];
-extern int yyleng;
-
-
-/* Chain of all defs built by the parser. */
-struct def *defs;
-int ndefs;
-
-static struct node *makenode ();
-static struct variation *makevar ();
-static struct def *makedef ();
-
-void yyerror ();
-
-%}
-
-%union
-{
- char *string;
- struct def *def;
- struct variation *variation;
- struct node *node;
-}
-
-%token <string> DEFOP STRING
-%type <string> opt_string
-%type <def> defs def
-%type <variation> variations variation
-%type <node> list items item
-
-%%
-
-top:
- defs
- { defs = $1; }
- ;
-
-defs:
- def
- | defs def
- { $2->next = $1; $$ = $2; }
- ;
-
-def:
- DEFOP '(' STRING ',' opt_string ',' '(' variations ')' ')'
- { $$ = makedef ($3, $5, $8); }
- ;
-
-variations:
- variation
- | variations ',' variation
- { $3->next = $1; $$ = $3; }
- ;
-
-variation:
- '(' opt_string ')'
- { $$ = makevar ($2, (struct node *) NULL, (struct node *) NULL, (struct node *) NULL); }
- | '(' opt_string ',' list ')'
- { $$ = makevar ($2, $4, (struct node *) NULL, (struct node *) NULL); }
- | '(' opt_string ',' list ',' list ')'
- { $$ = makevar ($2, $4, $6, (struct node *) NULL); }
- | '(' opt_string ',' list ',' list ',' list ')'
- { $$ = makevar ($2, $4, $6, $8); }
- ;
-
-opt_string:
- /* empty */ { $$ = ""; }
- | STRING { $$ = $1; }
- ;
-
-list:
- '(' items ')'
- { $$ = $2; }
- | /* empty */
- { $$ = NULL; }
- ;
-
-items:
- item
- /* Note right recursion. */
- | item ',' items
- { $1->next = $3; $$ = $1; }
- ;
-
-item:
- STRING
- { $$ = makenode ($1); }
- ;
-
-%%
-
-static struct node *
-makenode (s)
- char *s;
-{
- struct node *n;
-
- n = (struct node *) malloc (sizeof (struct node));
- n->text = s;
- n->next = NULL;
- return n;
-}
-
-static struct variation *
-makevar (name, inputs, outputs, literals)
- char *name;
- struct node *inputs, *outputs, *literals;
-{
- struct variation *v;
-
- v = (struct variation *) malloc (sizeof (struct variation));
- v->name = name;
- v->code = ndefs++;
- v->inputs = inputs;
- v->outputs = outputs;
- v->literals = literals;
- v->next = NULL;
- return v;
-}
-
-static struct def *
-makedef (name, template, vars)
- char *name, *template;
- struct variation *vars;
-{
- struct def *d;
-
- d = (struct def *) malloc (sizeof (struct def));
- d->basename = name;
- d->template = template;
- d->variations = vars;
- d->next = NULL;
- return d;
-}
-
-void
-yyerror (s)
- char *s;
-{
- fprintf (stderr, "syntax error in input\n");
- exit (FATAL_EXIT_CODE);
-}
diff --git a/gcc/bi-reverse.c b/gcc/bi-reverse.c
deleted file mode 100644
index 6a84f827e73..00000000000
--- a/gcc/bi-reverse.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Reverse order of definitions obtained from bytecode definition file.
- Copyright (C) 1993 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. */
-
-
-#include "hconfig.h"
-#include "bi-defs.h"
-
-void
-reverse()
-{
- struct def *dp, *d, *dn;
- struct variation *vp, *v, *vn;
-
- dp = defs;
- if (dp)
- {
- vp = dp->variations;
- if (vp)
- {
- for (v = vp->next, vp->next = 0; v; vp = v, v = vn)
- {
- vn = v->next;
- v->next = vp;
- }
- dp->variations = vp;
- }
- for (d = dp->next, dp->next = 0; d; dp = d, d = dn)
- {
- vp = d->variations;
- if (vp)
- {
- for (v = vp->next, vp->next = 0; v; vp = v, v = vn)
- {
- vn = v->next;
- v->next = vp;
- }
- d->variations = vp;
- }
- dn = d->next;
- d->next = dp;
- }
- defs = dp;
- }
-}
diff --git a/gcc/bi-run.h b/gcc/bi-run.h
deleted file mode 100644
index dc9192f78b8..00000000000
--- a/gcc/bi-run.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* Definitions for Bytecode Interpreter.
- Copyright (C) 1993, 1994 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. */
-
-#define MAXLITERALS 5
-
-struct arityvec
-{
- char ninputs;
- char noutputs;
- char nliterals;
- char literals[MAXLITERALS];
-};
-
-struct argtype
-{
- int modealign; /* Argument mode:alignment */
- int size; /* Argument size, in bytes */
-};
-
-struct callinfo
-{
- int nargs; /* Number of arguments in call */
- struct argtype retvaltype; /* Type of return value */
- struct argtype argtypes[1]; /* Argument types */
-};
-
-/* Structure describing a bytecode function. If this changes, we also
- need to change expand_function_end () in bc-trans.c */
-struct bytecode
-{
- int stacksize; /* Depth required of evaluation stack. */
- int localsize; /* Size in bytes of local variables. */
- unsigned char *pc0; /* Initial program counter. */
- void **ptrlit; /* Vector of (relocatable) pointer literals. */
- struct callinfo *callinfo; /* Vector of procedure call type info. */
-};
-
-
-#define INTERP_BPC 8 /* Bits per char */
-#define INTERP_BPI \
- (sizeof (int) * INTERP_BPC) /* Bits per int */
-
-
-#ifndef min
-#define min(L, R) ((L) < (R) ? (L) : (R))
-#endif
-
-
-/* bit field operations. */
-
-/* Low (high) mask: int with low (high) N bits set */
-
-#define LM(N) ((1 << (N)) - 1)
-#define HM(N) ((~LM (INTERP_BPI - (N))))
-
-
-/* Sign-extend SIZE low bits of VALUE to integer (typeof VALUE)
- Signed bitfields are loaded from memory by the sxloadBI instruction,
- which first retrieves the bitfield with XFIELD and then sign extends
- it to an SItype. */
-
-#define EXTEND(SIZE, VALUE) \
- ({ SUtype value = (SUtype) (VALUE); \
- (value & (1 << ((SIZE) - 1)) ? value | ~LM (SIZE) : value); })
-
-
-/* Given OFFSET:SIZE for a bitfield, calculate:
-
- [1] BYTE_OFFSET = the byte offset of the bit field.
- [2] BIT_OFFSET = the bit offset of the bit field (less than INTERP_BPC).
- [3] NBYTES = the number of integral bytes in the bit field.
- [4] TRAILING_BITS= the number of trailing bits (less than INTERP_BPC).
-
-
- , , , , , (memory bytes)
- ---------------- (bitfield)
- | | || | | (divisions)
- ^ ^ ^ ^
- | | | |__ [4] (bits)
- | | |_________ [3] (bytes)
- | |_________________ [2] (bits)
- |___________________________ [1] (bytes)
-
-
- The above applies to BYTE_LOW_ENDIAN machines. In BYTE_BIG_ENDIAN machines, the
- bit numbering is reversed (i.e. bit 0 is the sign bit).
-
- (All right, so I drew this to keep my tongue in cheek while writing the code below,
- not because I'm into ASCII art.) */
-
-
-#define BI_PARAMS(OFFSET, SIZE, BYTE_OFFSET, BIT_OFFSET, NBYTES, TRAILING_BITS) \
- { BYTE_OFFSET = (OFFSET) / (INTERP_BPC); \
- BIT_OFFSET = (OFFSET) % (INTERP_BPC); \
- NBYTES = ((SIZE) - (INTERP_BPC - (BIT_OFFSET))) / INTERP_BPC; \
- if ((NBYTES) < 0 || ((NBYTES) > 64)) \
- NBYTES = 0; \
- if ((SIZE) + (BIT_OFFSET) <= INTERP_BPC) \
- TRAILING_BITS = 0; \
- else \
- TRAILING_BITS = ((SIZE) - (INTERP_BPC - (BIT_OFFSET))) % INTERP_BPC; }
-
-
-/* SHIFT_IN_BITS retrieves NBITS bits from SOURCE and shifts into
- DEST. The bit field starts OFFSET bits into SOURCE.
-
- OR_IN_BITS copies the NBITS low bits from VALUE into a the bitfield in
- DEST offset by OFFSET bits. */
-
-
-#define SHIFT_IN_BITS(DEST, SOURCE, OFFSET, NBITS) \
- (DEST = ((DEST) << (NBITS)) \
- | (LM ((NBITS)) \
- & ((SOURCE) \
- >> (BYTES_BIG_ENDIAN \
- ? (INTERP_BPC - (OFFSET) - (NBITS)) \
- : (OFFSET)))))
-
-#define OR_IN_BITS(DEST, VALUE, OFFSET, NBITS) \
- (DEST = ((DEST) & ~(LM ((NBITS)) \
- << (BIG_ENDIAN \
- ? (INTERP_BPC - (OFFSET) - (NBITS)) \
- : (OFFSET))) \
- | (((VALUE) & LM ((NBITS))) \
- << (BIG_ENDIAN \
- ? (INTERP_BPC - (OFFSET) - (NBITS)) \
- : (OFFSET)))))
-
-/* Procedure call; arguments are a pointer to the function to be called,
- a pointer to a place to store the return value, a pointer to a vector
- describing the type of procedure call, and the interpreter's stack pointer,
- which will point to the first of the arguments at this point. */
-
-#define CALL(FUNC, CALLDESC, RETVAL, SP) __call(FUNC, CALLDESC, RETVAL, SP)
-
-
-/* Procedure return; arguments are a pointer to the calldesc for this
- function, and a pointer to the place where the value to be returned
- may be found. Generally the MACHARGS above contain a machine dependent
- cookie that is used to determine where to jump to. */
-
-#define PROCRET(CALLDESC, RETVAL) return
diff --git a/gcc/build-make b/gcc/build-make
deleted file mode 100644
index 116d579ba66..00000000000
--- a/gcc/build-make
+++ /dev/null
@@ -1,35 +0,0 @@
-# We have to use the cross-compiler we just built to compile it.
-CC = gcc -b $(host)
-
-# Need those to compile binaries running on host machine.
-# It is configured by
-#
-# configure --host=target_cpu-target_os \
-# --target=host=target_cpu-target_os --build=host_cpu-host_os
-#
-# That HOST stuff has to be taken care of very carefully.
-HOST_PREFIX=l-
-HOST_PREFIX_1=$(HOST_PREFIX)
-HOST_CC=$(CC) -b $(build)
-HOST_CFLAGS=$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
-HOST_CLIB=
-HOST_LDFLAGS=$(LDFLAGS)
-HOST_CPPFLAGS=$(ALL_CPPFLAGS)
-HOST_ALLOCA=$(ALLOCA)
-HOST_MALLOC=$(MALLOC)
-HOST_OBSTACK=$(OBSTACK)
-
-# To build the native compiler with the cross compiler, the headers
-# for the target are already fixed. And /usr/include is for host, not
-# target.
-FIXINCLUDES=Makefile.in
-
-# Don't run fixproto either
-STMP_FIXPROTO =
-
-# Cause installation using install-build. We do nothing here.
-INSTALL_TARGET = install-build
-
-# Don't try to compile the things we can't compile or we have made
-# while making gcc with the cross-compiler.
-ALL = all.build
diff --git a/gcc/bytecode.def b/gcc/bytecode.def
deleted file mode 100644
index 5b24df70ed6..00000000000
--- a/gcc/bytecode.def
+++ /dev/null
@@ -1,322 +0,0 @@
-# -*- C -*-
-# bytecode.def - definitions of bytecodes for the stack machine.
-
-# The production of the bytecode interpreter and compiler is
-# heavily automated by using this file creatively.
-
-# Various elementary data types are understood by the bytecode interpreter.
-# Q[IU] - quarter word (byte) signed and unsigned integers (char).
-# H[IU] - half word signed and unsigned integers (short int, maybe int).
-# S[IU] - single word signed and unsigned integers (maybe int, long int).
-# D[IU] - double word signed and unsigned integers (long long int).
-# SF - single precision floating point (float).
-# DF - double precision floating point (double).
-# XF - extended precision floating point (long double).
-# P - pointer type for address arithmetic and other purposes.
-
-# The bytecode specification consists of a series of define_operator
-# forms, that are parsed by preprocessors to automatically build
-# various switch statements.
-# define_operator(name,
-# <C prototype code for implementing the operator>,
-# <list of variations>)
-# The <C prototype> is self explanatory.
-# The <list of variations> consists of a (parenthesized list) of
-# variation items, each of which is in itself a list. A variation
-# item consists of a name suffix, the types of the input arguments
-# expected on the stack (shallowest item first) and (optionally) the
-# types of the output arguments (similarly ordered). Finally, the
-# types of the literal arguments (if any) may appear.
-
-# Substitution in the C prototype code is as follows:
-# Substitution happens only after a dollar sign. To get a literal
-# dollar sign (why would you ever want one anyway?) use $$.
-# $R1 means "result 1" $TR1 means "type name of result one"
-# $S1 means "source 1" and similarly with $TS1.
-# $L1 means "literal (inline) argument 1" and $TL1 means type thereof.
-#
-
-# Notice that the number following $R doesn't affect the push order;
-# it's used only for clarity and orthogonality, although it's checked
-# to make sure it doesn't exceed the number of outputs. A $R reference
-# results in a push, and represents the result lvalue. E.g.
-
-# $R1 = 2\, $R2 = 17
-# will expand to:
-# INTERP_PUSH($TR1) = 2, INTERP_PUSH($TR2) = 17
-#
-
-# Opcode 0 should never happen.
-define_operator(neverneverland, abort\(\), (()))
-
-# Stack manipulations.
-define_operator(drop, 0, ((, (SI))))
-define_operator(duplicate, 0, ((, (SI), (SI, SI))))
-define_operator(over, 0, ((, (SI), (SI, SI))))
-
-# Adjust stack pointer
-
-define_operator(setstack, 0, ((SI,,,(SI))))
-define_operator(adjstack, 0, ((SI,,,(SI))))
-
-# Constants, loads, and stores.
-define_operator(const,
- $R1 = $L1,
- ((QI,, (QI), (QI)), (HI,, (HI), (HI)),
- (SI,, (SI), (SI)), (DI,, (DI), (DI)),
- (SF,, (SF), (SF)), (DF,, (DF), (DF)),
- (XF,, (XF), (XF)), (P,, (P), (P))))
-define_operator(load,
- $R1 = *\($TR1 *\) $S1,
- ((QI, (P), (QI)), (HI, (P), (HI)),
- (SI, (P), (SI)), (DI, (P), (DI)),
- (SF, (P), (SF)), (DF, (P), (DF)),
- (XF, (P), (XF)), (P, (P), (P))))
-define_operator(store,
- *\($TS2 *\) $S1 = $S2,
- ((QI, (P, QI)), (HI, (P, HI)),
- (SI, (P, SI)), (DI, (P, DI)),
- (SF, (P, SF)), (DF, (P, DF)),
- (XF, (P, XF)), (P, (P, P)),
- (BLK, (SI, BLK, BLK))))
-
-# Clear memory block
-
-define_operator(clear, $S1 + $S2, ((BLK, (SI, BLK))))
-
-
-# Advance pointer by SI constant
-
-define_operator(addconst, $R1 = $S1, ((PSI, (P), (P), (SI))))
-
-
-# newlocalSI is used for creating variable-sized storage during function
-# initialization.
-
-# Create local space, return pointer to block
-
-define_operator(newlocal, $R1 = $S1, ((SI, (SI), (P))))
-
-
-# Push the address of a local variable.
-define_operator(local, $R1 = locals + $L1, ((P,, (P), (SI))))
-
-# Push the address of an argument variable.
-define_operator(arg, $R1 = args + $L1, ((P,, (P), (SI))))
-
-# Arithmetic conversions.
-define_operator(convert,
- $R1 = \($TR1\) $S1,
- (# Signed integral promotions (sign extensions).
- (QIHI, (QI), (HI)), (HISI, (HI), (SI)), (SIDI, (SI), (DI)),
- (QISI, (QI), (SI)),
- # Unsigned integral promotions (zero extensions).
- (QUHU, (QU), (HU)), (HUSU, (HU), (SU)), (SUDU, (SU), (DU)),
- (QUSU, (QU), (SU)),
- # Floating promotions.
- (SFDF, (SF), (DF)), (DFXF, (DF), (XF)),
- # Integral truncation.
- (HIQI, (HI), (QI)), (SIHI, (SI), (HI)), (DISI, (DI), (SI)),
- (SIQI, (SI), (QI)),
- # Unsigned truncation.
- (SUQU, (SU), (QU)),
- # Floating truncation.
- (DFSF, (DF), (SF)), (XFDF, (XF), (DF)),
- # Integral conversions to floating types.
- (SISF, (SI), (SF)), (SIDF, (SI), (DF)), (SIXF, (SI), (XF)),
- (SUSF, (SU), (SF)), (SUDF, (SU), (DF)), (SUXF, (SU), (XF)),
- (DISF, (DI), (SF)), (DIDF, (DI), (DF)), (DIXF, (DI), (XF)),
- (DUSF, (DU), (SF)), (DUDF, (DU), (DF)), (DUXF, (DU), (XF)),
- # Floating conversions to integral types.
- (SFSI, (SF), (SI)), (DFSI, (DF), (SI)), (XFSI, (XF), (SI)),
- (SFSU, (SF), (SU)), (DFSU, (DF), (SU)), (XFSU, (XF), (SU)),
- (SFDI, (SF), (DI)), (DFDI, (DF), (DI)), (XFDI, (XF), (DI)),
- (SFDU, (SF), (DU)), (DFDU, (DF), (DU)), (XFDU, (XF), (DU)),
- # Pointer/integer conversions.
- (PSI, (P), (SI)), (SIP, (SI), (P))))
-
-# Truth value conversion. These are necessary because conversions of, e.g.,
-# floating types to integers may not function correctly for large values.
-define_operator(convert,
- $R1 = !!$S1,
- ((SIT, (SI), (T)), (DIT, (DI), (T)),
- (SFT, (SF), (T)), (DFT, (DF), (T)),
- (XFT, (XF), (T)), (PT, (P), (T))))
-
-# Bit field load/store.
-
-# Load and zero-extend bitfield
-
-define_operator(zxload, $R1 = $S1, ((BI, (SU, SU, P), (SU))))
-
-# Load and sign-extend bitfield
-
-define_operator(sxload, $R1 = $S1, ((BI, (SU, SU, P), (SI))))
-
-# Store integer in bitfield
-
-define_operator(sstore, $R1 = $S1, ((BI, (SU, SU, P, SI))))
-
-
-# Binary operations.
-define_operator(add,
- $R1 = $S1 + $S2,
- ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
- (SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)),
- (XF, (XF, XF), (XF)),
- (PSI, (P, SI), (P))))
-define_operator(sub,
- $R1 = $S1 - $S2,
- ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
- (SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)),
- (XF, (XF, XF), (XF)),
- (PP, (P, P), (SI))))
-define_operator(mul,
- $R1 = $S1 * $S2,
- ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
- (SU, (SU, SU), (SU)), (DU, (DU, DU), (DU)),
- (SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)),
- (XF, (XF, XF), (XF))))
-define_operator(div,
- $R1 = $S1 / $S2,
- ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
- (SU, (SU, SU), (SU)), (DU, (DU, DU), (DU)),
- (SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)),
- (XF, (XF, XF), (XF))))
-define_operator(mod,
- $R1 = $S1 % $S2,
- ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)),
- (SU, (SU, SU), (SU)), (DU, (DU, DU), (DU))))
-define_operator(and,
- $R1 = $S1 & $S2,
- ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI))))
-define_operator(ior,
- $R1 = $S1 | $S2,
- ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI))))
-define_operator(xor,
- $R1 = $S1 ^ $S2,
- ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI))))
-define_operator(lshift,
- $R1 = $S1 << $S2,
- ((SI, (SI, SI), (SI)), (SU, (SU, SI), (SU)),
- (DI, (DI, SI), (DI)), (DU, (DU, SI), (DU))))
-define_operator(rshift,
- $R1 = $S1 >> $S2,
- ((SI, (SI, SI), (SI)), (SU, (SU, SI), (SU)),
- (DI, (DI, SI), (DI)), (DU, (DU, SI), (DU))))
-define_operator(lt,
- $R1 = $S1 < $S2,
- ((SI, (SI, SI), (T)), (SU, (SU, SU), (T)),
- (DI, (DI, DI), (T)), (DU, (DU, DU), (T)),
- (SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
- (XF, (XF, XF), (T)), (P, (P, P), (T))))
-define_operator(le,
- $R1 = $S1 <= $S2,
- ((SI, (SI, SI), (T)), (SU, (SU, SU), (T)),
- (DI, (DI, DI), (T)), (DU, (DU, DU), (T)),
- (SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
- (XF, (XF, XF), (T)), (P, (P, P), (T))))
-define_operator(ge,
- $R1 = $S1 >= $S2,
- ((SI, (SI, SI), (T)), (SU, (SU, SU), (T)),
- (DI, (DI, DI), (T)), (DU, (DU, DU), (T)),
- (SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
- (XF, (XF, XF), (T)), (P, (P, P), (T))))
-define_operator(gt,
- $R1 = $S1 > $S2,
- ((SI, (SI, SI), (T)), (SU, (SU, SU), (T)),
- (DI, (DI, DI), (T)), (DU, (DU, DU), (T)),
- (SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
- (XF, (XF, XF), (T)), (P, (P, P), (T))))
-define_operator(eq,
- $R1 = $S1 == $S2,
- ((SI, (SI, SI), (T)), (DI, (DI, DI), (T)),
- (SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
- (XF, (XF, XF), (T)), (P, (P, P), (T))))
-define_operator(ne,
- $R1 = $S1 != $S2,
- ((SI, (SI, SI), (T)), (DI, (DI, DI), (T)),
- (SF, (SF, SF), (T)), (DF, (DF, DF), (T)),
- (XF, (XF, XF), (T)), (P, (P, P), (T))))
-
-# Unary operations.
-define_operator(neg,
- $R1 = -$S1,
- ((SI, (SI), (SI)), (DI, (DI), (DI)),
- (SF, (SF), (SF)), (DF, (DF), (DF)),
- (XF, (XF), (XF))))
-define_operator(not,
- $R1 = ~$S1,
- ((SI, (SI), (SI)), (DI, (DI), (DI))))
-define_operator(not,
- $R1 = !$S1,
- ((T, (SI), (SI))))
-
-# Increment operations.
-define_operator(predec,
- $R1 = *\($TR1 *\) $S1 -= $S2,
- ((QI, (P, QI), (QI)), (HI, (P, HI), (HI)),
- (SI, (P, SI), (SI)), (DI, (P, DI), (DI)),
- (P, (P, SI), (P)), (SF, (P, SF), (SF)),
- (DF, (P, DF), (DF)), (XF, (P, XF), (XF)),
- (BI, (SU, SU, P, SI), (SI))))
-
-define_operator(preinc,
- $R1 = *\($TR1 *\) $S1 += $S2,
- ((QI, (P, QI), (QI)), (HI, (P, HI), (HI)),
- (SI, (P, SI), (SI)), (DI, (P, DI), (DI)),
- (P, (P, SI), (P)), (SF, (P, SF), (SF)),
- (DF, (P, DF), (DF)), (XF, (P, XF), (XF)),
- (BI, (SU, SU, P, SI), (SI))))
-
-define_operator(postdec,
- $R1 = *\($TR1 *\) $S1\, *\($TR1 *\) $S1 -= $S2,
- ((QI, (P, QI), (QI)), (HI, (P, HI), (HI)),
- (SI, (P, SI), (SI)), (DI, (P, DI), (DI)),
- (P, (P, SI), (P)), (SF, (P, SF), (SF)),
- (DF, (P, DF), (DF)), (XF, (P, XF), (XF)),
- (BI, (SU, SU, P, SI), (SI))))
-
-define_operator(postinc,
- $R1 = *\($TR1 *\) $S1\, *\($TR1 *\) $S1 += $S2,
- ((QI, (P, QI), (QI)), (HI, (P, HI), (HI)),
- (SI, (P, SI), (SI)), (DI, (P, DI), (DI)),
- (P, (P, SI), (P)), (SF, (P, SF), (SF)),
- (DF, (P, DF), (DF)), (XF, (P, XF), (XF)),
- (BI, (SU, SU, P, SI), (SI))))
-
-# Jumps.
-define_operator(xjumpif, if \($S1\) pc = code->pc0 + $L1, ((, (T),, (SI))))
-define_operator(xjumpifnot, if \(! $S1\) pc = code->pc0 + $L1, ((, (T),, (SI))))
-define_operator(jump, pc = code->pc0 + $L1, ((,,,(SI))))
-
-# This is for GCC2. It jumps to the address on the stack.
-define_operator(jump, pc = \(void *\) $S1, ((P,,)))
-
-# Switches. In order to (eventually) support ranges we provide four different
-# varieties of switches. Arguments are the switch index from the stack, the
-# bytecode offset of the switch table, the size of the switch table, and
-# the default label.
-define_operator(caseSI, CASESI\($S1\, $L1\, $L2\, $L3\), ((, (SI),, (SI, SI, SI))))
-define_operator(caseSU, CASESU\($S1\, $L1\, $L2\, $L3\), ((, (SU),, (SI, SI, SI))))
-define_operator(caseDI, CASEDI\($S1\, $L1\, $L2\, $L3\), ((, (DI),, (SI, SI, SI))))
-define_operator(caseDU, CASEDU\($S1\, $L1\, $L2\, $L3\), ((, (DU),, (SI, SI, SI))))
-
-# Procedure call.
-# Stack arguments are (deepest first):
-# procedure arguments in reverse order.
-# pointer to the place to hold the return value.
-# address of the call description vector.
-# pointer to the procedure to be called.
-define_operator(call, CALL\($S1\, $S2\, $S3\, sp\), ((, (P, P, P))))
-
-# Procedure return.
-# Pushes on interpreter stack:
-# value of retptr (pointer to return value storage slot)
-define_operator(return, $R1 = retptr, ((P,,(P))))
-
-# Really return.
-define_operator(ret, return, (()))
-
-# Print an obnoxious line number.
-define_operator(linenote, fprintf\(stderr\, "%d\\n"\, $L1\), ((,,,(SI))))
diff --git a/gcc/bytecode.h b/gcc/bytecode.h
deleted file mode 100644
index a029f93f602..00000000000
--- a/gcc/bytecode.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Bytecode definitions for GNU C-compiler.
- Copyright (C) 1993, 1994, 1996 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. */
-
-
-extern int output_bytecode;
-extern int stack_depth;
-extern int max_stack_depth;
-
-/* Emit DI constant according to target machine word ordering */
-
-#define bc_emit_bytecode_DI_const(CST) \
-{ int opcode; \
- opcode = (WORDS_BIG_ENDIAN \
- ? TREE_INT_CST_HIGH (CST) \
- : TREE_INT_CST_LOW (CST)); \
- bc_emit_bytecode_const ((char *) &opcode, sizeof opcode); \
- opcode = (WORDS_BIG_ENDIAN \
- ? TREE_INT_CST_LOW (CST) \
- : TREE_INT_CST_HIGH (CST)); \
- bc_emit_bytecode_const ((char *) &opcode, sizeof opcode); \
-}
-
-extern void bc_expand_expr ();
-extern void bc_output_data_constructor ();
-extern void bc_store_field ();
-extern void bc_load_bit_field ();
-extern void bc_store_bit_field ();
-extern void bc_push_offset_and_size ();
-extern void bc_init_mode_to_code_map ();
-
-/* These are just stubs, so the compiler will compile for targets
- that aren't yet supported by the bytecode generator. */
-
-#ifndef TARGET_SUPPORTS_BYTECODE
-
-#define MACHINE_SEG_ALIGN 1
-#define INT_ALIGN 1
-#define PTR_ALIGN 1
-#define NAMES_HAVE_UNDERSCORES
-#define BC_NOP (0)
-#define BC_GLOBALIZE_LABEL(FP, NAME) BC_NOP
-#define BC_OUTPUT_COMMON(FP, NAME, SIZE, ROUNDED) BC_NOP
-#define BC_OUTPUT_BSS(FP, NAME, SIZE, ROUNDED) BC_NOP
-#define BC_OUTPUT_LOCAL(FP, NAME, SIZE, ROUNDED) BC_NOP
-#define BC_OUTPUT_ALIGN(FP, ALIGN) BC_NOP
-#define BC_OUTPUT_LABEL(FP, NAME) BC_NOP
-#define BC_OUTPUT_SKIP(FP, SIZE) BC_NOP
-#define BC_OUTPUT_LABELREF(FP, NAME) BC_NOP
-#define BC_OUTPUT_FLOAT(FP, VAL) BC_NOP
-#define BC_OUTPUT_DOUBLE(FP, VAL) BC_NOP
-#define BC_OUTPUT_BYTE(FP, VAL) BC_NOP
-#define BC_OUTPUT_FILE ASM_OUTPUT_FILE
-#define BC_OUTPUT_ASCII ASM_OUTPUT_ASCII
-#define BC_OUTPUT_IDENT ASM_OUTPUT_IDENT
-#define BCXSTR(RTX) ((RTX)->bc_label)
-#define BC_WRITE_FILE(FP) BC_NOP
-#define BC_WRITE_SEGSYM(SEGSYM, FP) BC_NOP
-#define BC_WRITE_RELOC_ENTRY(SEGRELOC, FP, OFFSET) BC_NOP
-#define BC_START_BYTECODE_LINE(FP) BC_NOP
-#define BC_WRITE_BYTECODE(SEP, VAL, FP) BC_NOP
-#define BC_WRITE_RTL(R, FP) BC_NOP
-#define BC_EMIT_TRAMPOLINE(TRAMPSEG, CALLINFO) BC_NOP
-#define VALIDATE_STACK BC_NOP
-
-#endif /* !TARGET_SUPPORTS_BYTECODE */
diff --git a/gcc/bytetypes.h b/gcc/bytetypes.h
deleted file mode 100644
index f91566900c6..00000000000
--- a/gcc/bytetypes.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* These should come from genemit */
-
-/* Use __signed__ in case compiling with -traditional. */
-
-typedef __signed__ char QItype;
-typedef unsigned char QUtype;
-typedef __signed__ short int HItype;
-typedef unsigned short int HUtype;
-typedef __signed__ long int SItype;
-typedef unsigned long int SUtype;
-typedef __signed__ long long int DItype;
-typedef unsigned long long int DUtype;
-typedef float SFtype;
-typedef double DFtype;
-typedef long double XFtype;
-typedef char *Ptype;
-typedef int Ttype;
-
-
-typedef union stacktype
-{
- QItype QIval;
- QUtype QUval;
- HItype HIval;
- HUtype HUval;
- SItype SIval;
- SUtype SUval;
- DItype DIval;
- DUtype DUval;
- SFtype SFval;
- DFtype DFval;
- XFtype XFval;
- Ptype Pval;
- Ttype Tval;
-} stacktype;
diff --git a/gcc/c-aux-info.c b/gcc/c-aux-info.c
deleted file mode 100644
index 429601f21fa..00000000000
--- a/gcc/c-aux-info.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/* Generate information regarding function declarations and definitions based
- on information stored in GCC's tree structure. This code implements the
- -aux-info option.
- Copyright (C) 1989, 1991, 1994, 1995 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@segfault.us.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 <stdio.h>
-#include "config.h"
-#include "flags.h"
-#include "tree.h"
-#include "c-tree.h"
-
-extern char *xmalloc ();
-
-enum formals_style_enum {
- ansi,
- k_and_r_names,
- k_and_r_decls
-};
-typedef enum formals_style_enum formals_style;
-
-
-static char *data_type;
-
-static char *concat ();
-static char *concat3 ();
-static char *gen_formal_list_for_type ();
-static int deserves_ellipsis ();
-static char *gen_formal_list_for_func_def ();
-static char *gen_type ();
-static char *gen_decl ();
-void gen_aux_info_record ();
-
-/* Take two strings and mash them together into a newly allocated area. */
-
-static char *
-concat (s1, s2)
- char *s1;
- char *s2;
-{
- int size1, size2;
- char *ret_val;
-
- if (!s1)
- s1 = "";
- if (!s2)
- s2 = "";
-
- size1 = strlen (s1);
- size2 = strlen (s2);
- ret_val = xmalloc (size1 + size2 + 1);
- strcpy (ret_val, s1);
- strcpy (&ret_val[size1], s2);
- return ret_val;
-}
-
-/* Take three strings and mash them together into a newly allocated area. */
-
-static char *
-concat3 (s1, s2, s3)
- char *s1;
- char *s2;
- char *s3;
-{
- int size1, size2, size3;
- char *ret_val;
-
- if (!s1)
- s1 = "";
- if (!s2)
- s2 = "";
- if (!s3)
- s3 = "";
-
- size1 = strlen (s1);
- size2 = strlen (s2);
- size3 = strlen (s3);
- ret_val = xmalloc (size1 + size2 + size3 + 1);
- strcpy (ret_val, s1);
- strcpy (&ret_val[size1], s2);
- strcpy (&ret_val[size1+size2], s3);
- return ret_val;
-}
-
-/* Given a string representing an entire type or an entire declaration
- which only lacks the actual "data-type" specifier (at its left end),
- affix the data-type specifier to the left end of the given type
- specification or object declaration.
-
- Because of C language weirdness, the data-type specifier (which normally
- goes in at the very left end) may have to be slipped in just to the
- right of any leading "const" or "volatile" qualifiers (there may be more
- than one). Actually this may not be strictly necessary because it seems
- that GCC (at least) accepts `<data-type> const foo;' and treats it the
- same as `const <data-type> foo;' but people are accustomed to seeing
- `const char *foo;' and *not* `char const *foo;' so we try to create types
- that look as expected. */
-
-static char *
-affix_data_type (type_or_decl)
- char *type_or_decl;
-{
- char *p = type_or_decl;
- char *qualifiers_then_data_type;
- char saved;
-
- /* Skip as many leading const's or volatile's as there are. */
-
- for (;;)
- {
- if (!strncmp (p, "volatile ", 9))
- {
- p += 9;
- continue;
- }
- if (!strncmp (p, "const ", 6))
- {
- p += 6;
- continue;
- }
- break;
- }
-
- /* p now points to the place where we can insert the data type. We have to
- add a blank after the data-type of course. */
-
- if (p == type_or_decl)
- return concat3 (data_type, " ", type_or_decl);
-
- saved = *p;
- *p = '\0';
- qualifiers_then_data_type = concat (type_or_decl, data_type);
- *p = saved;
- return concat3 (qualifiers_then_data_type, " ", p);
-}
-
-/* Given a tree node which represents some "function type", generate the
- source code version of a formal parameter list (of some given style) for
- this function type. Return the whole formal parameter list (including
- a pair of surrounding parens) as a string. Note that if the style
- we are currently aiming for is non-ansi, then we just return a pair
- of empty parens here. */
-
-static char *
-gen_formal_list_for_type (fntype, style)
- tree fntype;
- formals_style style;
-{
- char *formal_list = "";
- tree formal_type;
-
- if (style != ansi)
- return "()";
-
- formal_type = TYPE_ARG_TYPES (fntype);
- while (formal_type && TREE_VALUE (formal_type) != void_type_node)
- {
- char *this_type;
-
- if (*formal_list)
- formal_list = concat (formal_list, ", ");
-
- this_type = gen_type ("", TREE_VALUE (formal_type), ansi);
- formal_list =
- (strlen (this_type))
- ? concat (formal_list, affix_data_type (this_type))
- : concat (formal_list, data_type);
-
- formal_type = TREE_CHAIN (formal_type);
- }
-
- /* If we got to here, then we are trying to generate an ANSI style formal
- parameters list.
-
- New style prototyped ANSI formal parameter lists should in theory always
- contain some stuff between the opening and closing parens, even if it is
- only "void".
-
- The brutal truth though is that there is lots of old K&R code out there
- which contains declarations of "pointer-to-function" parameters and
- these almost never have fully specified formal parameter lists associated
- with them. That is, the pointer-to-function parameters are declared
- with just empty parameter lists.
-
- In cases such as these, protoize should really insert *something* into
- the vacant parameter lists, but what? It has no basis on which to insert
- anything in particular.
-
- Here, we make life easy for protoize by trying to distinguish between
- K&R empty parameter lists and new-style prototyped parameter lists
- that actually contain "void". In the latter case we (obviously) want
- to output the "void" verbatim, and that what we do. In the former case,
- we do our best to give protoize something nice to insert.
-
- This "something nice" should be something that is still valid (when
- re-compiled) but something that can clearly indicate to the user that
- more typing information (for the parameter list) should be added (by
- hand) at some convenient moment.
-
- The string chosen here is a comment with question marks in it. */
-
- if (!*formal_list)
- {
- if (TYPE_ARG_TYPES (fntype))
- /* assert (TREE_VALUE (TYPE_ARG_TYPES (fntype)) == void_type_node); */
- formal_list = "void";
- else
- formal_list = "/* ??? */";
- }
- else
- {
- /* If there were at least some parameters, and if the formals-types-list
- petered out to a NULL (i.e. without being terminated by a
- void_type_node) then we need to tack on an ellipsis. */
- if (!formal_type)
- formal_list = concat (formal_list, ", ...");
- }
-
- return concat3 (" (", formal_list, ")");
-}
-
-/* For the generation of an ANSI prototype for a function definition, we have
- to look at the formal parameter list of the function's own "type" to
- determine if the function's formal parameter list should end with an
- ellipsis. Given a tree node, the following function will return non-zero
- if the "function type" parameter list should end with an ellipsis. */
-
-static int
-deserves_ellipsis (fntype)
- tree fntype;
-{
- tree formal_type;
-
- formal_type = TYPE_ARG_TYPES (fntype);
- while (formal_type && TREE_VALUE (formal_type) != void_type_node)
- formal_type = TREE_CHAIN (formal_type);
-
- /* If there were at least some parameters, and if the formals-types-list
- petered out to a NULL (i.e. without being terminated by a void_type_node)
- then we need to tack on an ellipsis. */
-
- return (!formal_type && TYPE_ARG_TYPES (fntype));
-}
-
-/* Generate a parameter list for a function definition (in some given style).
-
- Note that this routine has to be separate (and different) from the code that
- generates the prototype parameter lists for function declarations, because
- in the case of a function declaration, all we have to go on is a tree node
- representing the function's own "function type". This can tell us the types
- of all of the formal parameters for the function, but it cannot tell us the
- actual *names* of each of the formal parameters. We need to output those
- parameter names for each function definition.
-
- This routine gets a pointer to a tree node which represents the actual
- declaration of the given function, and this DECL node has a list of formal
- parameter (variable) declarations attached to it. These formal parameter
- (variable) declaration nodes give us the actual names of the formal
- parameters for the given function definition.
-
- This routine returns a string which is the source form for the entire
- function formal parameter list. */
-
-static char *
-gen_formal_list_for_func_def (fndecl, style)
- tree fndecl;
- formals_style style;
-{
- char *formal_list = "";
- tree formal_decl;
-
- formal_decl = DECL_ARGUMENTS (fndecl);
- while (formal_decl)
- {
- char *this_formal;
-
- if (*formal_list && ((style == ansi) || (style == k_and_r_names)))
- formal_list = concat (formal_list, ", ");
- this_formal = gen_decl (formal_decl, 0, style);
- if (style == k_and_r_decls)
- formal_list = concat3 (formal_list, this_formal, "; ");
- else
- formal_list = concat (formal_list, this_formal);
- formal_decl = TREE_CHAIN (formal_decl);
- }
- if (style == ansi)
- {
- if (!DECL_ARGUMENTS (fndecl))
- formal_list = concat (formal_list, "void");
- if (deserves_ellipsis (TREE_TYPE (fndecl)))
- formal_list = concat (formal_list, ", ...");
- }
- if ((style == ansi) || (style == k_and_r_names))
- formal_list = concat3 (" (", formal_list, ")");
- return formal_list;
-}
-
-/* Generate a string which is the source code form for a given type (t). This
- routine is ugly and complex because the C syntax for declarations is ugly
- and complex. This routine is straightforward so long as *no* pointer types,
- array types, or function types are involved.
-
- In the simple cases, this routine will return the (string) value which was
- passed in as the "ret_val" argument. Usually, this starts out either as an
- empty string, or as the name of the declared item (i.e. the formal function
- parameter variable).
-
- This routine will also return with the global variable "data_type" set to
- some string value which is the "basic" data-type of the given complete type.
- This "data_type" string can be concatenated onto the front of the returned
- string after this routine returns to its caller.
-
- In complicated cases involving pointer types, array types, or function
- types, the C declaration syntax requires an "inside out" approach, i.e. if
- you have a type which is a "pointer-to-function" type, you need to handle
- the "pointer" part first, but it also has to be "innermost" (relative to
- the declaration stuff for the "function" type). Thus, is this case, you
- must prepend a "(*" and append a ")" to the name of the item (i.e. formal
- variable). Then you must append and prepend the other info for the
- "function type" part of the overall type.
-
- To handle the "innermost precedence" rules of complicated C declarators, we
- do the following (in this routine). The input parameter called "ret_val"
- is treated as a "seed". Each time gen_type is called (perhaps recursively)
- some additional strings may be appended or prepended (or both) to the "seed"
- string. If yet another (lower) level of the GCC tree exists for the given
- type (as in the case of a pointer type, an array type, or a function type)
- then the (wrapped) seed is passed to a (recursive) invocation of gen_type()
- this recursive invocation may again "wrap" the (new) seed with yet more
- declarator stuff, by appending, prepending (or both). By the time the
- recursion bottoms out, the "seed value" at that point will have a value
- which is (almost) the complete source version of the declarator (except
- for the data_type info). Thus, this deepest "seed" value is simply passed
- back up through all of the recursive calls until it is given (as the return
- value) to the initial caller of the gen_type() routine. All that remains
- to do at this point is for the initial caller to prepend the "data_type"
- string onto the returned "seed". */
-
-static char *
-gen_type (ret_val, t, style)
- char *ret_val;
- tree t;
- formals_style style;
-{
- tree chain_p;
-
- if (TYPE_NAME (t) && DECL_NAME (TYPE_NAME (t)))
- data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t)));
- else
- {
- switch (TREE_CODE (t))
- {
- case POINTER_TYPE:
- if (TYPE_READONLY (t))
- ret_val = concat ("const ", ret_val);
- if (TYPE_VOLATILE (t))
- ret_val = concat ("volatile ", ret_val);
-
- ret_val = concat ("*", ret_val);
-
- if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
- ret_val = concat3 ("(", ret_val, ")");
-
- ret_val = gen_type (ret_val, TREE_TYPE (t), style);
-
- return ret_val;
-
- case ARRAY_TYPE:
- if (TYPE_SIZE (t) == 0 || TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST)
- ret_val = gen_type (concat (ret_val, "[]"), TREE_TYPE (t), style);
- else if (int_size_in_bytes (t) == 0)
- ret_val = gen_type (concat (ret_val, "[0]"), TREE_TYPE (t), style);
- else
- {
- int size = (int_size_in_bytes (t) / int_size_in_bytes (TREE_TYPE (t)));
- char buff[10];
- sprintf (buff, "[%d]", size);
- ret_val = gen_type (concat (ret_val, buff),
- TREE_TYPE (t), style);
- }
- break;
-
- case FUNCTION_TYPE:
- ret_val = gen_type (concat (ret_val, gen_formal_list_for_type (t, style)), TREE_TYPE (t), style);
- break;
-
- case IDENTIFIER_NODE:
- data_type = IDENTIFIER_POINTER (t);
- break;
-
- /* The following three cases are complicated by the fact that a
- user may do something really stupid, like creating a brand new
- "anonymous" type specification in a formal argument list (or as
- part of a function return type specification). For example:
-
- int f (enum { red, green, blue } color);
-
- In such cases, we have no name that we can put into the prototype
- to represent the (anonymous) type. Thus, we have to generate the
- whole darn type specification. Yuck! */
-
- case RECORD_TYPE:
- if (TYPE_NAME (t))
- data_type = IDENTIFIER_POINTER (TYPE_NAME (t));
- else
- {
- data_type = "";
- chain_p = TYPE_FIELDS (t);
- while (chain_p)
- {
- data_type = concat (data_type, gen_decl (chain_p, 0, ansi));
- chain_p = TREE_CHAIN (chain_p);
- data_type = concat (data_type, "; ");
- }
- data_type = concat3 ("{ ", data_type, "}");
- }
- data_type = concat ("struct ", data_type);
- break;
-
- case UNION_TYPE:
- if (TYPE_NAME (t))
- data_type = IDENTIFIER_POINTER (TYPE_NAME (t));
- else
- {
- data_type = "";
- chain_p = TYPE_FIELDS (t);
- while (chain_p)
- {
- data_type = concat (data_type, gen_decl (chain_p, 0, ansi));
- chain_p = TREE_CHAIN (chain_p);
- data_type = concat (data_type, "; ");
- }
- data_type = concat3 ("{ ", data_type, "}");
- }
- data_type = concat ("union ", data_type);
- break;
-
- case ENUMERAL_TYPE:
- if (TYPE_NAME (t))
- data_type = IDENTIFIER_POINTER (TYPE_NAME (t));
- else
- {
- data_type = "";
- chain_p = TYPE_VALUES (t);
- while (chain_p)
- {
- data_type = concat (data_type,
- IDENTIFIER_POINTER (TREE_PURPOSE (chain_p)));
- chain_p = TREE_CHAIN (chain_p);
- if (chain_p)
- data_type = concat (data_type, ", ");
- }
- data_type = concat3 ("{ ", data_type, " }");
- }
- data_type = concat ("enum ", data_type);
- break;
-
- case TYPE_DECL:
- data_type = IDENTIFIER_POINTER (DECL_NAME (t));
- break;
-
- case INTEGER_TYPE:
- data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t)));
- /* Normally, `unsigned' is part of the deal. Not so if it comes
- with `const' or `volatile'. */
- if (TREE_UNSIGNED (t) && (TYPE_READONLY (t) || TYPE_VOLATILE (t)))
- data_type = concat ("unsigned ", data_type);
- break;
-
- case REAL_TYPE:
- data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t)));
- break;
-
- case VOID_TYPE:
- data_type = "void";
- break;
-
- case ERROR_MARK:
- data_type = "[ERROR]";
- break;
-
- default:
- abort ();
- }
- }
- if (TYPE_READONLY (t))
- ret_val = concat ("const ", ret_val);
- if (TYPE_VOLATILE (t))
- ret_val = concat ("volatile ", ret_val);
- return ret_val;
-}
-
-/* Generate a string (source) representation of an entire entity declaration
- (using some particular style for function types).
-
- The given entity may be either a variable or a function.
-
- If the "is_func_definition" parameter is non-zero, assume that the thing
- we are generating a declaration for is a FUNCTION_DECL node which is
- associated with a function definition. In this case, we can assume that
- an attached list of DECL nodes for function formal arguments is present. */
-
-static char *
-gen_decl (decl, is_func_definition, style)
- tree decl;
- int is_func_definition;
- formals_style style;
-{
- char *ret_val;
-
- if (DECL_NAME (decl))
- ret_val = IDENTIFIER_POINTER (DECL_NAME (decl));
- else
- ret_val = "";
-
- /* If we are just generating a list of names of formal parameters, we can
- simply return the formal parameter name (with no typing information
- attached to it) now. */
-
- if (style == k_and_r_names)
- return ret_val;
-
- /* Note that for the declaration of some entity (either a function or a
- data object, like for instance a parameter) if the entity itself was
- declared as either const or volatile, then const and volatile properties
- are associated with just the declaration of the entity, and *not* with
- the `type' of the entity. Thus, for such declared entities, we have to
- generate the qualifiers here. */
-
- if (TREE_THIS_VOLATILE (decl))
- ret_val = concat ("volatile ", ret_val);
- if (TREE_READONLY (decl))
- ret_val = concat ("const ", ret_val);
-
- data_type = "";
-
- /* For FUNCTION_DECL nodes, there are two possible cases here. First, if
- this FUNCTION_DECL node was generated from a function "definition", then
- we will have a list of DECL_NODE's, one for each of the function's formal
- parameters. In this case, we can print out not only the types of each
- formal, but also each formal's name. In the second case, this
- FUNCTION_DECL node came from an actual function declaration (and *not*
- a definition). In this case, we do nothing here because the formal
- argument type-list will be output later, when the "type" of the function
- is added to the string we are building. Note that the ANSI-style formal
- parameter list is considered to be a (suffix) part of the "type" of the
- function. */
-
- if (TREE_CODE (decl) == FUNCTION_DECL && is_func_definition)
- {
- ret_val = concat (ret_val, gen_formal_list_for_func_def (decl, ansi));
-
- /* Since we have already added in the formals list stuff, here we don't
- add the whole "type" of the function we are considering (which
- would include its parameter-list info), rather, we only add in
- the "type" of the "type" of the function, which is really just
- the return-type of the function (and does not include the parameter
- list info). */
-
- ret_val = gen_type (ret_val, TREE_TYPE (TREE_TYPE (decl)), style);
- }
- else
- ret_val = gen_type (ret_val, TREE_TYPE (decl), style);
-
- ret_val = affix_data_type (ret_val);
-
- if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl))
- ret_val = concat ("register ", ret_val);
- if (TREE_PUBLIC (decl))
- ret_val = concat ("extern ", ret_val);
- if (TREE_CODE (decl) == FUNCTION_DECL && !TREE_PUBLIC (decl))
- ret_val = concat ("static ", ret_val);
-
- return ret_val;
-}
-
-extern FILE *aux_info_file;
-
-/* Generate and write a new line of info to the aux-info (.X) file. This
- routine is called once for each function declaration, and once for each
- function definition (even the implicit ones). */
-
-void
-gen_aux_info_record (fndecl, is_definition, is_implicit, is_prototyped)
- tree fndecl;
- int is_definition;
- int is_implicit;
- int is_prototyped;
-{
- if (flag_gen_aux_info)
- {
- static int compiled_from_record = 0;
-
- /* Each output .X file must have a header line. Write one now if we
- have not yet done so. */
-
- if (! compiled_from_record++)
- {
- /* The first line tells which directory file names are relative to.
- Currently, -aux-info works only for files in the working
- directory, so just use a `.' as a placeholder for now. */
- fprintf (aux_info_file, "/* compiled from: . */\n");
- }
-
- /* Write the actual line of auxiliary info. */
-
- fprintf (aux_info_file, "/* %s:%d:%c%c */ %s;",
- DECL_SOURCE_FILE (fndecl),
- DECL_SOURCE_LINE (fndecl),
- (is_implicit) ? 'I' : (is_prototyped) ? 'N' : 'O',
- (is_definition) ? 'F' : 'C',
- gen_decl (fndecl, is_definition, ansi));
-
- /* If this is an explicit function declaration, we need to also write
- out an old-style (i.e. K&R) function header, just in case the user
- wants to run unprotoize. */
-
- if (is_definition)
- {
- fprintf (aux_info_file, " /*%s %s*/",
- gen_formal_list_for_func_def (fndecl, k_and_r_names),
- gen_formal_list_for_func_def (fndecl, k_and_r_decls));
- }
-
- fprintf (aux_info_file, "\n");
- }
-}
diff --git a/gcc/c-common.c b/gcc/c-common.c
deleted file mode 100644
index d921661578e..00000000000
--- a/gcc/c-common.c
+++ /dev/null
@@ -1,2537 +0,0 @@
-/* Subroutines shared by all languages that are variants of C.
- Copyright (C) 1992, 1993, 1994, 1995, 1996 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. */
-
-#include "config.h"
-#include "tree.h"
-#include "c-lex.h"
-#include "c-tree.h"
-#include "flags.h"
-#include "obstack.h"
-#include <stdio.h>
-#include <ctype.h>
-
-#ifndef WCHAR_TYPE_SIZE
-#ifdef INT_TYPE_SIZE
-#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
-#else
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-#endif
-#endif
-
-extern struct obstack permanent_obstack;
-
-/* Nonzero means the expression being parsed will never be evaluated.
- This is a count, since unevaluated expressions can nest. */
-int skip_evaluation;
-
-enum attrs {A_PACKED, A_NOCOMMON, A_COMMON, A_NORETURN, A_CONST, A_T_UNION,
- A_CONSTRUCTOR, A_DESTRUCTOR, A_MODE, A_SECTION, A_ALIGNED,
- A_UNUSED, A_FORMAT, A_FORMAT_ARG, A_WEAK, A_ALIAS};
-
-static void declare_hidden_char_array PROTO((char *, char *));
-static void add_attribute PROTO((enum attrs, char *,
- int, int, int));
-static void init_attributes PROTO((void));
-static void record_international_format PROTO((tree, tree, int));
-
-/* Make bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */
-
-void
-declare_function_name ()
-{
- char *name, *printable_name;
-
- if (current_function_decl == NULL)
- {
- name = "";
- printable_name = "top level";
- }
- else
- {
- /* Allow functions to be nameless (such as artificial ones). */
- if (DECL_NAME (current_function_decl))
- name = IDENTIFIER_POINTER (DECL_NAME (current_function_decl));
- else
- name = "";
- printable_name = (*decl_printable_name) (current_function_decl, 2);
- }
-
- declare_hidden_char_array ("__FUNCTION__", name);
- declare_hidden_char_array ("__PRETTY_FUNCTION__", printable_name);
-}
-
-static void
-declare_hidden_char_array (name, value)
- char *name, *value;
-{
- tree decl, type, init;
- int vlen;
-
- /* If the default size of char arrays isn't big enough for the name,
- or if we want to give warnings for large objects, make a bigger one. */
- vlen = strlen (value) + 1;
- type = char_array_type_node;
- if (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TREE_TYPE (type))) < vlen
- || warn_larger_than)
- type = build_array_type (char_type_node,
- build_index_type (build_int_2 (vlen, 0)));
- push_obstacks_nochange ();
- decl = build_decl (VAR_DECL, get_identifier (name), type);
- TREE_STATIC (decl) = 1;
- TREE_READONLY (decl) = 1;
- TREE_ASM_WRITTEN (decl) = 1;
- DECL_SOURCE_LINE (decl) = 0;
- DECL_ARTIFICIAL (decl) = 1;
- DECL_IN_SYSTEM_HEADER (decl) = 1;
- DECL_IGNORED_P (decl) = 1;
- init = build_string (vlen, value);
- TREE_TYPE (init) = type;
- DECL_INITIAL (decl) = init;
- finish_decl (pushdecl (decl), init, NULL_TREE);
-}
-
-/* Given a chain of STRING_CST nodes,
- concatenate them into one STRING_CST
- and give it a suitable array-of-chars data type. */
-
-tree
-combine_strings (strings)
- tree strings;
-{
- register tree value, t;
- register int length = 1;
- int wide_length = 0;
- int wide_flag = 0;
- int wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT;
- int nchars;
-
- if (TREE_CHAIN (strings))
- {
- /* More than one in the chain, so concatenate. */
- register char *p, *q;
-
- /* Don't include the \0 at the end of each substring,
- except for the last one.
- Count wide strings and ordinary strings separately. */
- for (t = strings; t; t = TREE_CHAIN (t))
- {
- if (TREE_TYPE (t) == wchar_array_type_node)
- {
- wide_length += (TREE_STRING_LENGTH (t) - wchar_bytes);
- wide_flag = 1;
- }
- else
- length += (TREE_STRING_LENGTH (t) - 1);
- }
-
- /* If anything is wide, the non-wides will be converted,
- which makes them take more space. */
- if (wide_flag)
- length = length * wchar_bytes + wide_length;
-
- p = savealloc (length);
-
- /* Copy the individual strings into the new combined string.
- If the combined string is wide, convert the chars to ints
- for any individual strings that are not wide. */
-
- q = p;
- for (t = strings; t; t = TREE_CHAIN (t))
- {
- int len = (TREE_STRING_LENGTH (t)
- - ((TREE_TYPE (t) == wchar_array_type_node)
- ? wchar_bytes : 1));
- if ((TREE_TYPE (t) == wchar_array_type_node) == wide_flag)
- {
- bcopy (TREE_STRING_POINTER (t), q, len);
- q += len;
- }
- else
- {
- int i;
- for (i = 0; i < len; i++)
- {
- if (WCHAR_TYPE_SIZE == HOST_BITS_PER_SHORT)
- ((short *) q)[i] = TREE_STRING_POINTER (t)[i];
- else
- ((int *) q)[i] = TREE_STRING_POINTER (t)[i];
- }
- q += len * wchar_bytes;
- }
- }
- if (wide_flag)
- {
- int i;
- for (i = 0; i < wchar_bytes; i++)
- *q++ = 0;
- }
- else
- *q = 0;
-
- value = make_node (STRING_CST);
- TREE_STRING_POINTER (value) = p;
- TREE_STRING_LENGTH (value) = length;
- TREE_CONSTANT (value) = 1;
- }
- else
- {
- value = strings;
- length = TREE_STRING_LENGTH (value);
- if (TREE_TYPE (value) == wchar_array_type_node)
- wide_flag = 1;
- }
-
- /* Compute the number of elements, for the array type. */
- nchars = wide_flag ? length / wchar_bytes : length;
-
- /* Create the array type for the string constant.
- -Wwrite-strings says make the string constant an array of const char
- so that copying it to a non-const pointer will get a warning. */
- if (warn_write_strings
- && (! flag_traditional && ! flag_writable_strings))
- {
- tree elements
- = build_type_variant (wide_flag ? wchar_type_node : char_type_node,
- 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,
- build_index_type (build_int_2 (nchars - 1, 0)));
- TREE_CONSTANT (value) = 1;
- TREE_STATIC (value) = 1;
- return value;
-}
-
-/* To speed up processing of attributes, we maintain an array of
- IDENTIFIER_NODES and the corresponding attribute types. */
-
-/* Array to hold attribute information. */
-
-static struct {enum attrs id; tree name; int min, max, decl_req;} attrtab[50];
-
-static int attrtab_idx = 0;
-
-/* Add an entry to the attribute table above. */
-
-static void
-add_attribute (id, string, min_len, max_len, decl_req)
- enum attrs id;
- char *string;
- int min_len, max_len;
- int decl_req;
-{
- char buf[100];
-
- attrtab[attrtab_idx].id = id;
- attrtab[attrtab_idx].name = get_identifier (string);
- attrtab[attrtab_idx].min = min_len;
- attrtab[attrtab_idx].max = max_len;
- attrtab[attrtab_idx++].decl_req = decl_req;
-
- sprintf (buf, "__%s__", string);
-
- attrtab[attrtab_idx].id = id;
- attrtab[attrtab_idx].name = get_identifier (buf);
- attrtab[attrtab_idx].min = min_len;
- attrtab[attrtab_idx].max = max_len;
- attrtab[attrtab_idx++].decl_req = decl_req;
-}
-
-/* Initialize attribute table. */
-
-static void
-init_attributes ()
-{
- add_attribute (A_PACKED, "packed", 0, 0, 0);
- add_attribute (A_NOCOMMON, "nocommon", 0, 0, 1);
- add_attribute (A_COMMON, "common", 0, 0, 1);
- add_attribute (A_NORETURN, "noreturn", 0, 0, 1);
- add_attribute (A_NORETURN, "volatile", 0, 0, 1);
- add_attribute (A_UNUSED, "unused", 0, 0, 1);
- add_attribute (A_CONST, "const", 0, 0, 1);
- add_attribute (A_T_UNION, "transparent_union", 0, 0, 0);
- add_attribute (A_CONSTRUCTOR, "constructor", 0, 0, 1);
- add_attribute (A_DESTRUCTOR, "destructor", 0, 0, 1);
- add_attribute (A_MODE, "mode", 1, 1, 1);
- add_attribute (A_SECTION, "section", 1, 1, 1);
- add_attribute (A_ALIGNED, "aligned", 0, 1, 0);
- add_attribute (A_FORMAT, "format", 3, 3, 1);
- add_attribute (A_FORMAT_ARG, "format_arg", 1, 1, 1);
- add_attribute (A_WEAK, "weak", 0, 0, 1);
- add_attribute (A_ALIAS, "alias", 1, 1, 1);
-}
-
-/* Process the attributes listed in ATTRIBUTES and PREFIX_ATTRIBUTES
- and install them in NODE, which is either a DECL (including a TYPE_DECL)
- or a TYPE. PREFIX_ATTRIBUTES can appear after the declaration specifiers
- and declaration modifiers but before the declaration proper. */
-
-void
-decl_attributes (node, attributes, prefix_attributes)
- tree node, attributes, prefix_attributes;
-{
- tree decl = 0, type;
- int is_type;
- tree a;
-
- if (attrtab_idx == 0)
- init_attributes ();
-
- if (TREE_CODE_CLASS (TREE_CODE (node)) == 'd')
- {
- decl = node;
- type = TREE_TYPE (decl);
- is_type = TREE_CODE (node) == TYPE_DECL;
- }
- else if (TREE_CODE_CLASS (TREE_CODE (node)) == 't')
- type = node, is_type = 1;
-
- attributes = chainon (prefix_attributes, attributes);
-
- for (a = attributes; a; a = TREE_CHAIN (a))
- {
- tree name = TREE_PURPOSE (a);
- tree args = TREE_VALUE (a);
- int i;
- enum attrs id;
-
- for (i = 0; i < attrtab_idx; i++)
- if (attrtab[i].name == name)
- break;
-
- if (i == attrtab_idx)
- {
- if (! valid_machine_attribute (name, args, decl, type))
- warning ("`%s' attribute directive ignored",
- IDENTIFIER_POINTER (name));
- else if (decl != 0)
- type = TREE_TYPE (decl);
- continue;
- }
- else if (attrtab[i].decl_req && decl == 0)
- {
- warning ("`%s' attribute does not apply to types",
- IDENTIFIER_POINTER (name));
- continue;
- }
- else if (list_length (args) < attrtab[i].min
- || list_length (args) > attrtab[i].max)
- {
- error ("wrong number of arguments specified for `%s' attribute",
- IDENTIFIER_POINTER (name));
- continue;
- }
-
- id = attrtab[i].id;
- switch (id)
- {
- case A_PACKED:
- if (is_type)
- TYPE_PACKED (type) = 1;
- else if (TREE_CODE (decl) == FIELD_DECL)
- DECL_PACKED (decl) = 1;
- /* We can't set DECL_PACKED for a VAR_DECL, because the bit is
- used for DECL_REGISTER. It wouldn't mean anything anyway. */
- else
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
-
- case A_NOCOMMON:
- if (TREE_CODE (decl) == VAR_DECL)
- DECL_COMMON (decl) = 0;
- else
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
-
- case A_COMMON:
- if (TREE_CODE (decl) == VAR_DECL)
- DECL_COMMON (decl) = 1;
- else
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
-
- case A_NORETURN:
- if (TREE_CODE (decl) == FUNCTION_DECL)
- TREE_THIS_VOLATILE (decl) = 1;
- else if (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
- TREE_TYPE (decl) = type
- = build_pointer_type
- (build_type_variant (TREE_TYPE (type),
- TREE_READONLY (TREE_TYPE (type)), 1));
- else
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
-
- case A_UNUSED:
- if (TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == VAR_DECL
- || TREE_CODE (decl) == FUNCTION_DECL)
- TREE_USED (decl) = 1;
- else
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
-
- case A_CONST:
- if (TREE_CODE (decl) == FUNCTION_DECL)
- TREE_READONLY (decl) = 1;
- else if (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
- TREE_TYPE (decl) = type
- = build_pointer_type
- (build_type_variant (TREE_TYPE (type), 1,
- TREE_THIS_VOLATILE (TREE_TYPE (type))));
- else
- warning ( "`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
-
- case A_T_UNION:
- if (is_type
- && TREE_CODE (type) == UNION_TYPE
- && (decl == 0
- || (TYPE_FIELDS (type) != 0
- && TYPE_MODE (type) == DECL_MODE (TYPE_FIELDS (type)))))
- TYPE_TRANSPARENT_UNION (type) = 1;
- else if (decl != 0 && TREE_CODE (decl) == PARM_DECL
- && TREE_CODE (type) == UNION_TYPE
- && TYPE_MODE (type) == DECL_MODE (TYPE_FIELDS (type)))
- DECL_TRANSPARENT_UNION (decl) = 1;
- else
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
-
- case A_CONSTRUCTOR:
- if (TREE_CODE (decl) == FUNCTION_DECL
- && TREE_CODE (type) == FUNCTION_TYPE
- && decl_function_context (decl) == 0)
- {
- DECL_STATIC_CONSTRUCTOR (decl) = 1;
- TREE_USED (decl) = 1;
- }
- else
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
-
- case A_DESTRUCTOR:
- if (TREE_CODE (decl) == FUNCTION_DECL
- && TREE_CODE (type) == FUNCTION_TYPE
- && decl_function_context (decl) == 0)
- {
- DECL_STATIC_DESTRUCTOR (decl) = 1;
- TREE_USED (decl) = 1;
- }
- else
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
-
- case A_MODE:
- if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE)
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- else
- {
- int j;
- char *p = IDENTIFIER_POINTER (TREE_VALUE (args));
- int len = strlen (p);
- enum machine_mode mode = VOIDmode;
- tree typefm;
-
- if (len > 4 && p[0] == '_' && p[1] == '_'
- && p[len - 1] == '_' && p[len - 2] == '_')
- {
- char *newp = (char *) alloca (len - 1);
-
- strcpy (newp, &p[2]);
- newp[len - 4] = '\0';
- p = newp;
- }
-
- /* Give this decl a type with the specified mode.
- First check for the special modes. */
- if (! strcmp (p, "byte"))
- mode = byte_mode;
- else if (!strcmp (p, "word"))
- mode = word_mode;
- else if (! strcmp (p, "pointer"))
- mode = ptr_mode;
- else
- for (j = 0; j < NUM_MACHINE_MODES; j++)
- if (!strcmp (p, GET_MODE_NAME (j)))
- mode = (enum machine_mode) j;
-
- if (mode == VOIDmode)
- error ("unknown machine mode `%s'", p);
- else if (0 == (typefm = type_for_mode (mode,
- TREE_UNSIGNED (type))))
- error ("no data type for mode `%s'", p);
- else
- {
- TREE_TYPE (decl) = type = typefm;
- DECL_SIZE (decl) = 0;
- layout_decl (decl, 0);
- }
- }
- break;
-
- case A_SECTION:
-#ifdef ASM_OUTPUT_SECTION_NAME
- if ((TREE_CODE (decl) == FUNCTION_DECL
- || TREE_CODE (decl) == VAR_DECL)
- && TREE_CODE (TREE_VALUE (args)) == STRING_CST)
- {
- if (TREE_CODE (decl) == VAR_DECL
- && current_function_decl != NULL_TREE
- && ! TREE_STATIC (decl))
- error_with_decl (decl,
- "section attribute cannot be specified for local variables");
- /* The decl may have already been given a section attribute from
- a previous declaration. Ensure they match. */
- else if (DECL_SECTION_NAME (decl) != NULL_TREE
- && strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
- TREE_STRING_POINTER (TREE_VALUE (args))) != 0)
- error_with_decl (node,
- "section of `%s' conflicts with previous declaration");
- else
- DECL_SECTION_NAME (decl) = TREE_VALUE (args);
- }
- else
- error_with_decl (node,
- "section attribute not allowed for `%s'");
-#else
- error_with_decl (node,
- "section attributes are not supported for this target");
-#endif
- break;
-
- case A_ALIGNED:
- {
- tree align_expr
- = (args ? TREE_VALUE (args)
- : size_int (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
- int align;
-
- /* Strip any NOPs of any kind. */
- while (TREE_CODE (align_expr) == NOP_EXPR
- || TREE_CODE (align_expr) == CONVERT_EXPR
- || TREE_CODE (align_expr) == NON_LVALUE_EXPR)
- align_expr = TREE_OPERAND (align_expr, 0);
-
- if (TREE_CODE (align_expr) != INTEGER_CST)
- {
- error ("requested alignment is not a constant");
- continue;
- }
-
- align = TREE_INT_CST_LOW (align_expr) * BITS_PER_UNIT;
-
- if (exact_log2 (align) == -1)
- error ("requested alignment is not a power of 2");
- else if (is_type)
- TYPE_ALIGN (type) = align;
- else if (TREE_CODE (decl) != VAR_DECL
- && TREE_CODE (decl) != FIELD_DECL)
- error_with_decl (decl,
- "alignment may not be specified for `%s'");
- else
- DECL_ALIGN (decl) = align;
- }
- break;
-
- case A_FORMAT:
- {
- tree format_type = TREE_VALUE (args);
- tree format_num_expr = TREE_VALUE (TREE_CHAIN (args));
- tree first_arg_num_expr
- = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (args)));
- int format_num;
- int first_arg_num;
- int is_scan;
- tree argument;
- int arg_num;
-
- if (TREE_CODE (decl) != FUNCTION_DECL)
- {
- error_with_decl (decl,
- "argument format specified for non-function `%s'");
- continue;
- }
-
- if (TREE_CODE (format_type) == IDENTIFIER_NODE
- && (!strcmp (IDENTIFIER_POINTER (format_type), "printf")
- || !strcmp (IDENTIFIER_POINTER (format_type),
- "__printf__")))
- is_scan = 0;
- else if (TREE_CODE (format_type) == IDENTIFIER_NODE
- && (!strcmp (IDENTIFIER_POINTER (format_type), "scanf")
- || !strcmp (IDENTIFIER_POINTER (format_type),
- "__scanf__")))
- is_scan = 1;
- else if (TREE_CODE (format_type) == IDENTIFIER_NODE)
- {
- error ("`%s' is an unrecognized format function type",
- IDENTIFIER_POINTER (format_type));
- continue;
- }
- else
- {
- error ("unrecognized format specifier");
- continue;
- }
-
- /* Strip any conversions from the string index and first arg number
- and verify they are constants. */
- while (TREE_CODE (format_num_expr) == NOP_EXPR
- || TREE_CODE (format_num_expr) == CONVERT_EXPR
- || TREE_CODE (format_num_expr) == NON_LVALUE_EXPR)
- format_num_expr = TREE_OPERAND (format_num_expr, 0);
-
- while (TREE_CODE (first_arg_num_expr) == NOP_EXPR
- || TREE_CODE (first_arg_num_expr) == CONVERT_EXPR
- || TREE_CODE (first_arg_num_expr) == NON_LVALUE_EXPR)
- first_arg_num_expr = TREE_OPERAND (first_arg_num_expr, 0);
-
- if (TREE_CODE (format_num_expr) != INTEGER_CST
- || TREE_CODE (first_arg_num_expr) != INTEGER_CST)
- {
- error ("format string has non-constant operand number");
- continue;
- }
-
- format_num = TREE_INT_CST_LOW (format_num_expr);
- first_arg_num = TREE_INT_CST_LOW (first_arg_num_expr);
- if (first_arg_num != 0 && first_arg_num <= format_num)
- {
- error ("format string arg follows the args to be formatted");
- continue;
- }
-
- /* If a parameter list is specified, verify that the format_num
- argument is actually a string, in case the format attribute
- is in error. */
- argument = TYPE_ARG_TYPES (type);
- if (argument)
- {
- for (arg_num = 1; ; ++arg_num)
- {
- if (argument == 0 || arg_num == format_num)
- break;
- argument = TREE_CHAIN (argument);
- }
- if (! argument
- || TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE
- || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (argument)))
- != char_type_node))
- {
- error ("format string arg not a string type");
- continue;
- }
- if (first_arg_num != 0)
- {
- /* Verify that first_arg_num points to the last arg,
- the ... */
- while (argument)
- arg_num++, argument = TREE_CHAIN (argument);
- if (arg_num != first_arg_num)
- {
- error ("args to be formatted is not ...");
- continue;
- }
- }
- }
-
- record_function_format (DECL_NAME (decl),
- DECL_ASSEMBLER_NAME (decl),
- is_scan, format_num, first_arg_num);
- break;
- }
-
- case A_FORMAT_ARG:
- {
- tree format_num_expr = TREE_VALUE (args);
- int format_num, arg_num;
- tree argument;
-
- if (TREE_CODE (decl) != FUNCTION_DECL)
- {
- error_with_decl (decl,
- "argument format specified for non-function `%s'");
- continue;
- }
-
- /* Strip any conversions from the first arg number and verify it
- is a constant. */
- while (TREE_CODE (format_num_expr) == NOP_EXPR
- || TREE_CODE (format_num_expr) == CONVERT_EXPR
- || TREE_CODE (format_num_expr) == NON_LVALUE_EXPR)
- format_num_expr = TREE_OPERAND (format_num_expr, 0);
-
- if (TREE_CODE (format_num_expr) != INTEGER_CST)
- {
- error ("format string has non-constant operand number");
- continue;
- }
-
- format_num = TREE_INT_CST_LOW (format_num_expr);
-
- /* If a parameter list is specified, verify that the format_num
- argument is actually a string, in case the format attribute
- is in error. */
- argument = TYPE_ARG_TYPES (type);
- if (argument)
- {
- for (arg_num = 1; ; ++arg_num)
- {
- if (argument == 0 || arg_num == format_num)
- break;
- argument = TREE_CHAIN (argument);
- }
- if (! argument
- || TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE
- || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (argument)))
- != char_type_node))
- {
- error ("format string arg not a string type");
- continue;
- }
- }
-
- if (TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) != POINTER_TYPE
- || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (TREE_TYPE (decl))))
- != char_type_node))
- {
- error ("function does not return string type");
- continue;
- }
-
- record_international_format (DECL_NAME (decl),
- DECL_ASSEMBLER_NAME (decl),
- format_num);
- break;
- }
-
- case A_WEAK:
- declare_weak (decl);
- break;
-
- case A_ALIAS:
- if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl))
- || (TREE_CODE (decl) != FUNCTION_DECL && ! DECL_EXTERNAL (decl)))
- error_with_decl (decl,
- "`%s' defined both normally and as an alias");
- else if (decl_function_context (decl) == 0)
- {
- tree id = get_identifier (TREE_STRING_POINTER
- (TREE_VALUE (args)));
- if (TREE_CODE (decl) == FUNCTION_DECL)
- DECL_INITIAL (decl) = error_mark_node;
- else
- DECL_EXTERNAL (decl) = 0;
- assemble_alias (decl, id);
- }
- else
- warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
- break;
- }
- }
-}
-
-/* Split SPECS_ATTRS, a list of declspecs and prefix attributes, into two
- lists. SPECS_ATTRS may also be just a typespec (eg: RECORD_TYPE).
-
- The head of the declspec list is stored in DECLSPECS.
- The head of the attribute list is stored in PREFIX_ATTRIBUTES.
-
- Note that attributes in SPECS_ATTRS are stored in the TREE_PURPOSE of
- the list elements. We drop the containing TREE_LIST nodes and link the
- resulting attributes together the way decl_attributes expects them. */
-
-void
-split_specs_attrs (specs_attrs, declspecs, prefix_attributes)
- tree specs_attrs;
- tree *declspecs, *prefix_attributes;
-{
- tree t, s, a, next, specs, attrs;
-
- /* This can happen in c++ (eg: decl: typespec initdecls ';'). */
- if (specs_attrs != NULL_TREE
- && TREE_CODE (specs_attrs) != TREE_LIST)
- {
- *declspecs = specs_attrs;
- *prefix_attributes = NULL_TREE;
- return;
- }
-
- /* Remember to keep the lists in the same order, element-wise. */
-
- specs = s = NULL_TREE;
- attrs = a = NULL_TREE;
- for (t = specs_attrs; t; t = next)
- {
- next = TREE_CHAIN (t);
- /* Declspecs have a non-NULL TREE_VALUE. */
- if (TREE_VALUE (t) != NULL_TREE)
- {
- if (specs == NULL_TREE)
- specs = s = t;
- else
- {
- TREE_CHAIN (s) = t;
- s = t;
- }
- }
- else
- {
- if (attrs == NULL_TREE)
- attrs = a = TREE_PURPOSE (t);
- else
- {
- TREE_CHAIN (a) = TREE_PURPOSE (t);
- a = TREE_PURPOSE (t);
- }
- /* More attrs can be linked here, move A to the end. */
- while (TREE_CHAIN (a) != NULL_TREE)
- a = TREE_CHAIN (a);
- }
- }
-
- /* Terminate the lists. */
- if (s != NULL_TREE)
- TREE_CHAIN (s) = NULL_TREE;
- if (a != NULL_TREE)
- TREE_CHAIN (a) = NULL_TREE;
-
- /* All done. */
- *declspecs = specs;
- *prefix_attributes = attrs;
-}
-
-/* Check a printf/fprintf/sprintf/scanf/fscanf/sscanf format against
- a parameter list. */
-
-#define T_I &integer_type_node
-#define T_L &long_integer_type_node
-#define T_LL &long_long_integer_type_node
-#define T_S &short_integer_type_node
-#define T_UI &unsigned_type_node
-#define T_UL &long_unsigned_type_node
-#define T_ULL &long_long_unsigned_type_node
-#define T_US &short_unsigned_type_node
-#define T_F &float_type_node
-#define T_D &double_type_node
-#define T_LD &long_double_type_node
-#define T_C &char_type_node
-#define T_V &void_type_node
-#define T_W &wchar_type_node
-#define T_ST &sizetype
-
-typedef struct {
- char *format_chars;
- int pointer_count;
- /* Type of argument if no length modifier is used. */
- tree *nolen;
- /* Type of argument if length modifier for shortening is used.
- If NULL, then this modifier is not allowed. */
- tree *hlen;
- /* Type of argument if length modifier `l' is used.
- If NULL, then this modifier is not allowed. */
- tree *llen;
- /* Type of argument if length modifier `q' or `ll' is used.
- If NULL, then this modifier is not allowed. */
- tree *qlen;
- /* Type of argument if length modifier `L' is used.
- If NULL, then this modifier is not allowed. */
- tree *bigllen;
- /* List of other modifier characters allowed with these options. */
- char *flag_chars;
-} format_char_info;
-
-static format_char_info print_char_table[] = {
- { "di", 0, T_I, T_I, T_L, T_LL, T_LL, "-wp0 +" },
- { "oxX", 0, T_UI, T_UI, T_UL, T_ULL, T_ULL, "-wp0#" },
- { "u", 0, T_UI, T_UI, T_UL, T_ULL, T_ULL, "-wp0" },
-/* Two GNU extensions. */
- { "Z", 0, T_ST, NULL, NULL, NULL, NULL, "-wp0" },
- { "m", 0, T_V, NULL, NULL, NULL, NULL, "-wp" },
- { "feEgG", 0, T_D, NULL, NULL, NULL, T_LD, "-wp0 +#" },
- { "c", 0, T_I, NULL, T_W, NULL, NULL, "-w" },
- { "C", 0, T_W, NULL, NULL, NULL, NULL, "-w" },
- { "s", 1, T_C, NULL, T_W, NULL, NULL, "-wp" },
- { "S", 1, T_W, NULL, NULL, NULL, NULL, "-wp" },
- { "p", 1, T_V, NULL, NULL, NULL, NULL, "-w" },
- { "n", 1, T_I, T_S, T_L, T_LL, NULL, "" },
- { NULL }
-};
-
-static format_char_info scan_char_table[] = {
- { "di", 1, T_I, T_S, T_L, T_LL, T_LL, "*" },
- { "ouxX", 1, T_UI, T_US, T_UL, T_ULL, T_ULL, "*" },
- { "efgEG", 1, T_F, NULL, T_D, NULL, T_LD, "*" },
- { "sc", 1, T_C, NULL, T_W, NULL, NULL, "*a" },
- { "[", 1, T_C, NULL, NULL, NULL, NULL, "*a" },
- { "C", 1, T_W, NULL, NULL, NULL, NULL, "*" },
- { "S", 1, T_W, NULL, NULL, NULL, NULL, "*" },
- { "p", 2, T_V, NULL, NULL, NULL, NULL, "*" },
- { "n", 1, T_I, T_S, T_L, T_LL, NULL, "" },
- { NULL }
-};
-
-typedef struct function_format_info
-{
- struct function_format_info *next; /* next structure on the list */
- tree name; /* identifier such as "printf" */
- tree assembler_name; /* optional mangled identifier (for C++) */
- int is_scan; /* TRUE if *scanf */
- int format_num; /* number of format argument */
- int first_arg_num; /* number of first arg (zero for varargs) */
-} function_format_info;
-
-static function_format_info *function_format_list = NULL;
-
-typedef struct international_format_info
-{
- struct international_format_info *next; /* next structure on the list */
- tree name; /* identifier such as "gettext" */
- tree assembler_name; /* optional mangled identifier (for C++) */
- int format_num; /* number of format argument */
-} international_format_info;
-
-static international_format_info *international_format_list = NULL;
-
-static void check_format_info PROTO((function_format_info *, tree));
-
-/* Initialize the table of functions to perform format checking on.
- The ANSI functions are always checked (whether <stdio.h> is
- included or not), since it is common to call printf without
- including <stdio.h>. There shouldn't be a problem with this,
- since ANSI reserves these function names whether you include the
- header file or not. In any case, the checking is harmless.
-
- Also initialize the name of function that modify the format string for
- internationalization purposes. */
-
-void
-init_function_format_info ()
-{
- record_function_format (get_identifier ("printf"), NULL_TREE, 0, 1, 2);
- record_function_format (get_identifier ("fprintf"), NULL_TREE, 0, 2, 3);
- record_function_format (get_identifier ("sprintf"), NULL_TREE, 0, 2, 3);
- record_function_format (get_identifier ("scanf"), NULL_TREE, 1, 1, 2);
- record_function_format (get_identifier ("fscanf"), NULL_TREE, 1, 2, 3);
- record_function_format (get_identifier ("sscanf"), NULL_TREE, 1, 2, 3);
- record_function_format (get_identifier ("vprintf"), NULL_TREE, 0, 1, 0);
- record_function_format (get_identifier ("vfprintf"), NULL_TREE, 0, 2, 0);
- record_function_format (get_identifier ("vsprintf"), NULL_TREE, 0, 2, 0);
-
- record_international_format (get_identifier ("gettext"), NULL_TREE, 1);
- record_international_format (get_identifier ("dgettext"), NULL_TREE, 2);
- record_international_format (get_identifier ("dcgettext"), NULL_TREE, 2);
-}
-
-/* Record information for argument format checking. FUNCTION_IDENT is
- the identifier node for the name of the function to check (its decl
- need not exist yet). IS_SCAN is true for scanf-type format checking;
- false indicates printf-style format checking. FORMAT_NUM is the number
- of the argument which is the format control string (starting from 1).
- FIRST_ARG_NUM is the number of the first actual argument to check
- against the format string, or zero if no checking is not be done
- (e.g. for varargs such as vfprintf). */
-
-void
-record_function_format (name, assembler_name, is_scan,
- format_num, first_arg_num)
- tree name;
- tree assembler_name;
- int is_scan;
- int format_num;
- int first_arg_num;
-{
- function_format_info *info;
-
- /* Re-use existing structure if it's there. */
-
- for (info = function_format_list; info; info = info->next)
- {
- if (info->name == name && info->assembler_name == assembler_name)
- break;
- }
- if (! info)
- {
- info = (function_format_info *) xmalloc (sizeof (function_format_info));
- info->next = function_format_list;
- function_format_list = info;
-
- info->name = name;
- info->assembler_name = assembler_name;
- }
-
- info->is_scan = is_scan;
- info->format_num = format_num;
- info->first_arg_num = first_arg_num;
-}
-
-/* Record information for the names of function that modify the format
- argument to format functions. FUNCTION_IDENT is the identifier node for
- the name of the function (its decl need not exist yet) and FORMAT_NUM is
- the number of the argument which is the format control string (starting
- from 1). */
-
-static void
-record_international_format (name, assembler_name, format_num)
- tree name;
- tree assembler_name;
- int format_num;
-{
- international_format_info *info;
-
- /* Re-use existing structure if it's there. */
-
- for (info = international_format_list; info; info = info->next)
- {
- if (info->name == name && info->assembler_name == assembler_name)
- break;
- }
-
- if (! info)
- {
- info
- = (international_format_info *)
- xmalloc (sizeof (international_format_info));
- info->next = international_format_list;
- international_format_list = info;
-
- info->name = name;
- info->assembler_name = assembler_name;
- }
-
- info->format_num = format_num;
-}
-
-static char tfaff[] = "too few arguments for format";
-
-/* Check the argument list of a call to printf, scanf, etc.
- NAME is the function identifier.
- ASSEMBLER_NAME is the function's assembler identifier.
- (Either NAME or ASSEMBLER_NAME, but not both, may be NULL_TREE.)
- PARAMS is the list of argument values. */
-
-void
-check_function_format (name, assembler_name, params)
- tree name;
- tree assembler_name;
- tree params;
-{
- function_format_info *info;
-
- /* See if this function is a format function. */
- for (info = function_format_list; info; info = info->next)
- {
- if (info->assembler_name
- ? (info->assembler_name == assembler_name)
- : (info->name == name))
- {
- /* Yup; check it. */
- check_format_info (info, params);
- break;
- }
- }
-}
-
-/* Check the argument list of a call to printf, scanf, etc.
- INFO points to the function_format_info structure.
- PARAMS is the list of argument values. */
-
-static void
-check_format_info (info, params)
- function_format_info *info;
- tree params;
-{
- int i;
- int arg_num;
- int suppressed, wide, precise;
- int length_char;
- int format_char;
- int format_length;
- tree format_tree;
- tree cur_param;
- tree cur_type;
- tree wanted_type;
- tree first_fillin_param;
- char *format_chars;
- format_char_info *fci;
- static char message[132];
- char flag_chars[8];
- int has_operand_number = 0;
-
- /* Skip to format argument. If the argument isn't available, there's
- no work for us to do; prototype checking will catch the problem. */
- for (arg_num = 1; ; ++arg_num)
- {
- if (params == 0)
- return;
- if (arg_num == info->format_num)
- break;
- params = TREE_CHAIN (params);
- }
- format_tree = TREE_VALUE (params);
- params = TREE_CHAIN (params);
- if (format_tree == 0)
- return;
-
- /* We can only check the format if it's a string constant. */
- while (TREE_CODE (format_tree) == NOP_EXPR)
- format_tree = TREE_OPERAND (format_tree, 0); /* strip coercion */
-
- if (TREE_CODE (format_tree) == CALL_EXPR
- && TREE_CODE (TREE_OPERAND (format_tree, 0)) == ADDR_EXPR
- && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (format_tree, 0), 0))
- == FUNCTION_DECL))
- {
- tree function = TREE_OPERAND (TREE_OPERAND (format_tree, 0), 0);
-
- /* See if this is a call to a known internationalization function
- that modifies the format arg. */
- international_format_info *info;
-
- for (info = international_format_list; info; info = info->next)
- if (info->assembler_name
- ? (info->assembler_name == DECL_ASSEMBLER_NAME (function))
- : (info->name == DECL_NAME (function)))
- {
- tree inner_args;
- int i;
-
- for (inner_args = TREE_OPERAND (format_tree, 1), i = 1;
- inner_args != 0;
- inner_args = TREE_CHAIN (inner_args), i++)
- if (i == info->format_num)
- {
- format_tree = TREE_VALUE (inner_args);
-
- while (TREE_CODE (format_tree) == NOP_EXPR)
- format_tree = TREE_OPERAND (format_tree, 0);
- }
- }
- }
-
- if (integer_zerop (format_tree))
- {
- warning ("null format string");
- return;
- }
- if (TREE_CODE (format_tree) != ADDR_EXPR)
- return;
- format_tree = TREE_OPERAND (format_tree, 0);
- if (TREE_CODE (format_tree) != STRING_CST)
- return;
- format_chars = TREE_STRING_POINTER (format_tree);
- format_length = TREE_STRING_LENGTH (format_tree);
- if (format_length <= 1)
- warning ("zero-length format string");
- if (format_chars[--format_length] != 0)
- {
- warning ("unterminated format string");
- return;
- }
- /* Skip to first argument to check. */
- while (arg_num + 1 < info->first_arg_num)
- {
- if (params == 0)
- return;
- params = TREE_CHAIN (params);
- ++arg_num;
- }
-
- first_fillin_param = params;
- while (1)
- {
- int aflag;
- if (*format_chars == 0)
- {
- if (format_chars - TREE_STRING_POINTER (format_tree) != format_length)
- warning ("embedded `\\0' in format");
- if (info->first_arg_num != 0 && params != 0 && ! has_operand_number)
- warning ("too many arguments for format");
- return;
- }
- if (*format_chars++ != '%')
- continue;
- if (*format_chars == 0)
- {
- warning ("spurious trailing `%%' in format");
- continue;
- }
- if (*format_chars == '%')
- {
- ++format_chars;
- continue;
- }
- flag_chars[0] = 0;
- suppressed = wide = precise = FALSE;
- if (info->is_scan)
- {
- suppressed = *format_chars == '*';
- if (suppressed)
- ++format_chars;
- while (isdigit (*format_chars))
- ++format_chars;
- }
- else
- {
- /* See if we have a number followed by a dollar sign. If we do,
- it is an operand number, so set PARAMS to that operand. */
- if (*format_chars >= '0' && *format_chars <= '9')
- {
- char *p = format_chars;
-
- while (*p >= '0' && *p++ <= '9')
- ;
-
- if (*p == '$')
- {
- int opnum = atoi (format_chars);
-
- params = first_fillin_param;
- format_chars = p + 1;
- has_operand_number = 1;
-
- for (i = 1; i < opnum && params != 0; i++)
- params = TREE_CHAIN (params);
-
- if (opnum == 0 || params == 0)
- {
- warning ("operand number out of range in format");
- return;
- }
- }
- }
-
- while (*format_chars != 0 && index (" +#0-", *format_chars) != 0)
- {
- if (index (flag_chars, *format_chars) != 0)
- {
- sprintf (message, "repeated `%c' flag in format",
- *format_chars);
- warning (message);
- }
- i = strlen (flag_chars);
- flag_chars[i++] = *format_chars++;
- flag_chars[i] = 0;
- }
- /* "If the space and + flags both appear,
- the space flag will be ignored." */
- if (index (flag_chars, ' ') != 0
- && index (flag_chars, '+') != 0)
- warning ("use of both ` ' and `+' flags in format");
- /* "If the 0 and - flags both appear,
- the 0 flag will be ignored." */
- if (index (flag_chars, '0') != 0
- && index (flag_chars, '-') != 0)
- warning ("use of both `0' and `-' flags in format");
- if (*format_chars == '*')
- {
- wide = TRUE;
- /* "...a field width...may be indicated by an asterisk.
- In this case, an int argument supplies the field width..." */
- ++format_chars;
- if (params == 0)
- {
- warning (tfaff);
- return;
- }
- if (info->first_arg_num != 0)
- {
- cur_param = TREE_VALUE (params);
- params = TREE_CHAIN (params);
- ++arg_num;
- /* size_t is generally not valid here.
- It will work on most machines, because size_t and int
- have the same mode. But might as well warn anyway,
- since it will fail on other machines. */
- if ((TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
- != integer_type_node)
- &&
- (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
- != unsigned_type_node))
- {
- sprintf (message,
- "field width is not type int (arg %d)",
- arg_num);
- warning (message);
- }
- }
- }
- else
- {
- while (isdigit (*format_chars))
- {
- wide = TRUE;
- ++format_chars;
- }
- }
- if (*format_chars == '.')
- {
- precise = TRUE;
- ++format_chars;
- if (*format_chars != '*' && !isdigit (*format_chars))
- warning ("`.' not followed by `*' or digit in format");
- /* "...a...precision...may be indicated by an asterisk.
- In this case, an int argument supplies the...precision." */
- if (*format_chars == '*')
- {
- if (info->first_arg_num != 0)
- {
- ++format_chars;
- if (params == 0)
- {
- warning (tfaff);
- return;
- }
- cur_param = TREE_VALUE (params);
- params = TREE_CHAIN (params);
- ++arg_num;
- if (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
- != integer_type_node)
- {
- sprintf (message,
- "field width is not type int (arg %d)",
- arg_num);
- warning (message);
- }
- }
- }
- else
- {
- while (isdigit (*format_chars))
- ++format_chars;
- }
- }
- }
- if (*format_chars == 'h' || *format_chars == 'l')
- length_char = *format_chars++;
- else if (*format_chars == 'q' || *format_chars == 'L')
- {
- length_char = *format_chars++;
- if (pedantic)
- pedwarn ("ANSI C does not support the `%c' length modifier",
- length_char);
- }
- else
- length_char = 0;
- if (length_char == 'l' && *format_chars == 'l')
- {
- length_char = 'q', format_chars++;
- if (pedantic)
- pedwarn ("ANSI C does not support the `ll' length modifier");
- }
- aflag = 0;
- if (*format_chars == 'a')
- {
- aflag = 1;
- format_chars++;
- }
- if (suppressed && length_char != 0)
- {
- sprintf (message,
- "use of `*' and `%c' together in format",
- length_char);
- warning (message);
- }
- format_char = *format_chars;
- if (format_char == 0 || format_char == '%')
- {
- warning ("conversion lacks type at end of format");
- continue;
- }
- format_chars++;
- fci = info->is_scan ? scan_char_table : print_char_table;
- while (fci->format_chars != 0
- && index (fci->format_chars, format_char) == 0)
- ++fci;
- if (fci->format_chars == 0)
- {
- if (format_char >= 040 && format_char < 0177)
- sprintf (message,
- "unknown conversion type character `%c' in format",
- format_char);
- else
- sprintf (message,
- "unknown conversion type character 0x%x in format",
- format_char);
- warning (message);
- continue;
- }
- if (wide && index (fci->flag_chars, 'w') == 0)
- {
- sprintf (message, "width used with `%c' format",
- format_char);
- warning (message);
- }
- if (precise && index (fci->flag_chars, 'p') == 0)
- {
- sprintf (message, "precision used with `%c' format",
- format_char);
- warning (message);
- }
- if (aflag && index (fci->flag_chars, 'a') == 0)
- {
- sprintf (message, "`a' flag used with `%c' format",
- format_char);
- warning (message);
- }
- if (info->is_scan && format_char == '[')
- {
- /* Skip over scan set, in case it happens to have '%' in it. */
- if (*format_chars == '^')
- ++format_chars;
- /* Find closing bracket; if one is hit immediately, then
- it's part of the scan set rather than a terminator. */
- if (*format_chars == ']')
- ++format_chars;
- while (*format_chars && *format_chars != ']')
- ++format_chars;
- if (*format_chars != ']')
- /* The end of the format string was reached. */
- warning ("no closing `]' for `%%[' format");
- }
- if (suppressed)
- {
- if (index (fci->flag_chars, '*') == 0)
- {
- sprintf (message,
- "suppression of `%c' conversion in format",
- format_char);
- warning (message);
- }
- continue;
- }
- for (i = 0; flag_chars[i] != 0; ++i)
- {
- if (index (fci->flag_chars, flag_chars[i]) == 0)
- {
- sprintf (message, "flag `%c' used with type `%c'",
- flag_chars[i], format_char);
- warning (message);
- }
- }
- if (precise && index (flag_chars, '0') != 0
- && (format_char == 'd' || format_char == 'i'
- || format_char == 'o' || format_char == 'u'
- || format_char == 'x' || format_char == 'x'))
- {
- sprintf (message,
- "`0' flag ignored with precision specifier and `%c' format",
- format_char);
- warning (message);
- }
- switch (length_char)
- {
- default: wanted_type = fci->nolen ? *(fci->nolen) : 0; break;
- case 'h': wanted_type = fci->hlen ? *(fci->hlen) : 0; break;
- case 'l': wanted_type = fci->llen ? *(fci->llen) : 0; break;
- case 'q': wanted_type = fci->qlen ? *(fci->qlen) : 0; break;
- case 'L': wanted_type = fci->bigllen ? *(fci->bigllen) : 0; break;
- }
- if (wanted_type == 0)
- {
- sprintf (message,
- "use of `%c' length character with `%c' type character",
- length_char, format_char);
- warning (message);
- }
-
- /*
- ** XXX -- should kvetch about stuff such as
- ** {
- ** const int i;
- **
- ** scanf ("%d", &i);
- ** }
- */
-
- /* Finally. . .check type of argument against desired type! */
- if (info->first_arg_num == 0)
- continue;
- if (fci->pointer_count == 0 && wanted_type == void_type_node)
- /* This specifier takes no argument. */
- continue;
- if (params == 0)
- {
- warning (tfaff);
- return;
- }
- cur_param = TREE_VALUE (params);
- params = TREE_CHAIN (params);
- ++arg_num;
- cur_type = TREE_TYPE (cur_param);
-
- /* Check the types of any additional pointer arguments
- that precede the "real" argument. */
- for (i = 0; i < fci->pointer_count; ++i)
- {
- if (TREE_CODE (cur_type) == POINTER_TYPE)
- {
- cur_type = TREE_TYPE (cur_type);
- continue;
- }
- if (TREE_CODE (cur_type) != ERROR_MARK)
- {
- sprintf (message,
- "format argument is not a %s (arg %d)",
- ((fci->pointer_count == 1) ? "pointer" : "pointer to a pointer"),
- arg_num);
- warning (message);
- }
- break;
- }
-
- /* Check the type of the "real" argument, if there's a type we want. */
- if (i == fci->pointer_count && wanted_type != 0
- && TREE_CODE (cur_type) != ERROR_MARK
- && wanted_type != TYPE_MAIN_VARIANT (cur_type)
- /* If we want `void *', allow any pointer type.
- (Anything else would already have got a warning.) */
- && ! (wanted_type == void_type_node
- && fci->pointer_count > 0)
- /* Don't warn about differences merely in signedness. */
- && !(TREE_CODE (wanted_type) == INTEGER_TYPE
- && TREE_CODE (TYPE_MAIN_VARIANT (cur_type)) == INTEGER_TYPE
- && (TREE_UNSIGNED (wanted_type)
- ? wanted_type == (cur_type = unsigned_type (cur_type))
- : wanted_type == (cur_type = signed_type (cur_type))))
- /* Likewise, "signed char", "unsigned char" and "char" are
- equivalent but the above test won't consider them equivalent. */
- && ! (wanted_type == char_type_node
- && (TYPE_MAIN_VARIANT (cur_type) == signed_char_type_node
- || TYPE_MAIN_VARIANT (cur_type) == unsigned_char_type_node)))
- {
- register char *this;
- register char *that;
-
- this = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (wanted_type)));
- that = 0;
- if (TREE_CODE (cur_type) != ERROR_MARK
- && TYPE_NAME (cur_type) != 0
- && TREE_CODE (cur_type) != INTEGER_TYPE
- && !(TREE_CODE (cur_type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (cur_type)) == INTEGER_TYPE))
- {
- if (TREE_CODE (TYPE_NAME (cur_type)) == TYPE_DECL
- && DECL_NAME (TYPE_NAME (cur_type)) != 0)
- that = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (cur_type)));
- else
- that = IDENTIFIER_POINTER (TYPE_NAME (cur_type));
- }
-
- /* A nameless type can't possibly match what the format wants.
- So there will be a warning for it.
- Make up a string to describe vaguely what it is. */
- if (that == 0)
- {
- if (TREE_CODE (cur_type) == POINTER_TYPE)
- that = "pointer";
- else
- that = "different type";
- }
-
- /* Make the warning better in case of mismatch of int vs long. */
- if (TREE_CODE (cur_type) == INTEGER_TYPE
- && TREE_CODE (wanted_type) == INTEGER_TYPE
- && TYPE_PRECISION (cur_type) == TYPE_PRECISION (wanted_type)
- && TYPE_NAME (cur_type) != 0
- && TREE_CODE (TYPE_NAME (cur_type)) == TYPE_DECL)
- that = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (cur_type)));
-
- if (strcmp (this, that) != 0)
- {
- sprintf (message, "%s format, %s arg (arg %d)",
- this, that, arg_num);
- warning (message);
- }
- }
- }
-}
-
-/* Print a warning if a constant expression had overflow in folding.
- Invoke this function on every expression that the language
- requires to be a constant expression.
- Note the ANSI C standard says it is erroneous for a
- constant expression to overflow. */
-
-void
-constant_expression_warning (value)
- tree value;
-{
- if ((TREE_CODE (value) == INTEGER_CST || TREE_CODE (value) == REAL_CST
- || TREE_CODE (value) == COMPLEX_CST)
- && TREE_CONSTANT_OVERFLOW (value) && pedantic)
- pedwarn ("overflow in constant expression");
-}
-
-/* Print a warning if an expression had overflow in folding.
- Invoke this function on every expression that
- (1) appears in the source code, and
- (2) might be a constant expression that overflowed, and
- (3) is not already checked by convert_and_check;
- however, do not invoke this function on operands of explicit casts. */
-
-void
-overflow_warning (value)
- tree value;
-{
- if ((TREE_CODE (value) == INTEGER_CST
- || (TREE_CODE (value) == COMPLEX_CST
- && TREE_CODE (TREE_REALPART (value)) == INTEGER_CST))
- && TREE_OVERFLOW (value))
- {
- TREE_OVERFLOW (value) = 0;
- if (skip_evaluation == 0)
- warning ("integer overflow in expression");
- }
- else if ((TREE_CODE (value) == REAL_CST
- || (TREE_CODE (value) == COMPLEX_CST
- && TREE_CODE (TREE_REALPART (value)) == REAL_CST))
- && TREE_OVERFLOW (value))
- {
- TREE_OVERFLOW (value) = 0;
- if (skip_evaluation == 0)
- warning ("floating point overflow in expression");
- }
-}
-
-/* Print a warning if a large constant is truncated to unsigned,
- or if -Wconversion is used and a constant < 0 is converted to unsigned.
- Invoke this function on every expression that might be implicitly
- converted to an unsigned type. */
-
-void
-unsigned_conversion_warning (result, operand)
- tree result, operand;
-{
- if (TREE_CODE (operand) == INTEGER_CST
- && TREE_CODE (TREE_TYPE (result)) == INTEGER_TYPE
- && TREE_UNSIGNED (TREE_TYPE (result))
- && skip_evaluation == 0
- && !int_fits_type_p (operand, TREE_TYPE (result)))
- {
- if (!int_fits_type_p (operand, signed_type (TREE_TYPE (result))))
- /* This detects cases like converting -129 or 256 to unsigned char. */
- warning ("large integer implicitly truncated to unsigned type");
- else if (warn_conversion)
- warning ("negative integer implicitly converted to unsigned type");
- }
-}
-
-/* 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. */
-
-tree
-convert_and_check (type, expr)
- tree type, expr;
-{
- tree t = convert (type, expr);
- if (TREE_CODE (t) == INTEGER_CST)
- {
- if (TREE_OVERFLOW (t))
- {
- TREE_OVERFLOW (t) = 0;
-
- /* Do not diagnose overflow in a constant expression merely
- because a conversion overflowed. */
- TREE_CONSTANT_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (expr);
-
- /* No warning for converting 0x80000000 to int. */
- if (!(TREE_UNSIGNED (type) < TREE_UNSIGNED (TREE_TYPE (expr))
- && TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE
- && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (expr))))
- /* If EXPR fits in the unsigned version of TYPE,
- don't warn unless pedantic. */
- if ((pedantic
- || TREE_UNSIGNED (type)
- || ! int_fits_type_p (expr, unsigned_type (type)))
- && skip_evaluation == 0)
- warning ("overflow in implicit constant conversion");
- }
- else
- unsigned_conversion_warning (t, expr);
- }
- return t;
-}
-
-void
-c_expand_expr_stmt (expr)
- tree expr;
-{
- /* Do default conversion if safe and possibly important,
- in case within ({...}). */
- if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE && lvalue_p (expr))
- || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
- expr = default_conversion (expr);
-
- if (TREE_TYPE (expr) != error_mark_node
- && TYPE_SIZE (TREE_TYPE (expr)) == 0
- && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
- error ("expression statement has incomplete type");
-
- expand_expr_stmt (expr);
-}
-
-/* Validate the expression after `case' and apply default promotions. */
-
-tree
-check_case_value (value)
- tree value;
-{
- if (value == NULL_TREE)
- return value;
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- STRIP_TYPE_NOPS (value);
-
- if (TREE_CODE (value) != INTEGER_CST
- && value != error_mark_node)
- {
- error ("case label does not reduce to an integer constant");
- value = error_mark_node;
- }
- else
- /* Promote char or short to int. */
- value = default_conversion (value);
-
- constant_expression_warning (value);
-
- return value;
-}
-
-/* Return an integer type with BITS bits of precision,
- that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */
-
-tree
-type_for_size (bits, unsignedp)
- unsigned bits;
- int unsignedp;
-{
- if (bits == TYPE_PRECISION (integer_type_node))
- return unsignedp ? unsigned_type_node : integer_type_node;
-
- if (bits == TYPE_PRECISION (signed_char_type_node))
- return unsignedp ? unsigned_char_type_node : signed_char_type_node;
-
- if (bits == TYPE_PRECISION (short_integer_type_node))
- return unsignedp ? short_unsigned_type_node : short_integer_type_node;
-
- if (bits == TYPE_PRECISION (long_integer_type_node))
- return unsignedp ? long_unsigned_type_node : long_integer_type_node;
-
- if (bits == TYPE_PRECISION (long_long_integer_type_node))
- return (unsignedp ? long_long_unsigned_type_node
- : long_long_integer_type_node);
-
- if (bits <= TYPE_PRECISION (intQI_type_node))
- return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
-
- if (bits <= TYPE_PRECISION (intHI_type_node))
- return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
-
- if (bits <= TYPE_PRECISION (intSI_type_node))
- return unsignedp ? unsigned_intSI_type_node : intSI_type_node;
-
- if (bits <= TYPE_PRECISION (intDI_type_node))
- return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
-
- return 0;
-}
-
-/* Return a data type that has machine mode MODE.
- If the mode is an integer,
- then UNSIGNEDP selects between signed and unsigned types. */
-
-tree
-type_for_mode (mode, unsignedp)
- enum machine_mode mode;
- int unsignedp;
-{
- if (mode == TYPE_MODE (integer_type_node))
- return unsignedp ? unsigned_type_node : integer_type_node;
-
- if (mode == TYPE_MODE (signed_char_type_node))
- return unsignedp ? unsigned_char_type_node : signed_char_type_node;
-
- if (mode == TYPE_MODE (short_integer_type_node))
- return unsignedp ? short_unsigned_type_node : short_integer_type_node;
-
- if (mode == TYPE_MODE (long_integer_type_node))
- return unsignedp ? long_unsigned_type_node : long_integer_type_node;
-
- if (mode == TYPE_MODE (long_long_integer_type_node))
- return unsignedp ? long_long_unsigned_type_node : long_long_integer_type_node;
-
- if (mode == TYPE_MODE (intQI_type_node))
- return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
-
- if (mode == TYPE_MODE (intHI_type_node))
- return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
-
- if (mode == TYPE_MODE (intSI_type_node))
- return unsignedp ? unsigned_intSI_type_node : intSI_type_node;
-
- if (mode == TYPE_MODE (intDI_type_node))
- return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
-
- if (mode == TYPE_MODE (float_type_node))
- return float_type_node;
-
- if (mode == TYPE_MODE (double_type_node))
- return double_type_node;
-
- if (mode == TYPE_MODE (long_double_type_node))
- return long_double_type_node;
-
- if (mode == TYPE_MODE (build_pointer_type (char_type_node)))
- return build_pointer_type (char_type_node);
-
- if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
- return build_pointer_type (integer_type_node);
-
- return 0;
-}
-
-/* Return the minimum number of bits needed to represent VALUE in a
- signed or unsigned type, UNSIGNEDP says which. */
-
-int
-min_precision (value, unsignedp)
- tree value;
- int unsignedp;
-{
- int log;
-
- /* If the value is negative, compute its negative minus 1. The latter
- adjustment is because the absolute value of the largest negative value
- is one larger than the largest positive value. This is equivalent to
- a bit-wise negation, so use that operation instead. */
-
- if (tree_int_cst_sgn (value) < 0)
- value = fold (build1 (BIT_NOT_EXPR, TREE_TYPE (value), value));
-
- /* Return the number of bits needed, taking into account the fact
- that we need one more bit for a signed than unsigned type. */
-
- if (integer_zerop (value))
- log = 0;
- else if (TREE_INT_CST_HIGH (value) != 0)
- log = HOST_BITS_PER_WIDE_INT + floor_log2 (TREE_INT_CST_HIGH (value));
- else
- log = floor_log2 (TREE_INT_CST_LOW (value));
-
- return log + 1 + ! unsignedp;
-}
-
-/* Print an error message for invalid operands to arith operation CODE.
- NOP_EXPR is used as a special case (see truthvalue_conversion). */
-
-void
-binary_op_error (code)
- enum tree_code code;
-{
- register char *opname = "unknown";
-
- switch (code)
- {
- case NOP_EXPR:
- error ("invalid truth-value expression");
- return;
-
- case PLUS_EXPR:
- opname = "+"; break;
- case MINUS_EXPR:
- opname = "-"; break;
- case MULT_EXPR:
- opname = "*"; break;
- case MAX_EXPR:
- opname = "max"; break;
- case MIN_EXPR:
- opname = "min"; break;
- case EQ_EXPR:
- opname = "=="; break;
- case NE_EXPR:
- opname = "!="; break;
- case LE_EXPR:
- opname = "<="; break;
- case GE_EXPR:
- opname = ">="; break;
- case LT_EXPR:
- opname = "<"; break;
- case GT_EXPR:
- opname = ">"; break;
- case LSHIFT_EXPR:
- opname = "<<"; break;
- case RSHIFT_EXPR:
- opname = ">>"; break;
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- opname = "%"; break;
- case TRUNC_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- opname = "/"; break;
- case BIT_AND_EXPR:
- opname = "&"; break;
- case BIT_IOR_EXPR:
- opname = "|"; break;
- case TRUTH_ANDIF_EXPR:
- opname = "&&"; break;
- case TRUTH_ORIF_EXPR:
- opname = "||"; break;
- case BIT_XOR_EXPR:
- opname = "^"; break;
- case LROTATE_EXPR:
- case RROTATE_EXPR:
- opname = "rotate"; break;
- }
- error ("invalid operands to binary %s", opname);
-}
-
-/* Subroutine of build_binary_op, used for comparison operations.
- See if the operands have both been converted from subword integer types
- and, if so, perhaps change them both back to their original type.
- This function is also responsible for converting the two operands
- to the proper common type for comparison.
-
- The arguments of this function are all pointers to local variables
- of build_binary_op: OP0_PTR is &OP0, OP1_PTR is &OP1,
- RESTYPE_PTR is &RESULT_TYPE and RESCODE_PTR is &RESULTCODE.
-
- If this function returns nonzero, it means that the comparison has
- a constant value. What this function returns is an expression for
- that value. */
-
-tree
-shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
- tree *op0_ptr, *op1_ptr;
- tree *restype_ptr;
- enum tree_code *rescode_ptr;
-{
- register tree type;
- tree op0 = *op0_ptr;
- tree op1 = *op1_ptr;
- int unsignedp0, unsignedp1;
- int real1, real2;
- tree primop0, primop1;
- enum tree_code code = *rescode_ptr;
-
- /* Throw away any conversions to wider types
- already present in the operands. */
-
- primop0 = get_narrower (op0, &unsignedp0);
- primop1 = get_narrower (op1, &unsignedp1);
-
- /* Handle the case that OP0 does not *contain* a conversion
- but it *requires* conversion to FINAL_TYPE. */
-
- if (op0 == primop0 && TREE_TYPE (op0) != *restype_ptr)
- unsignedp0 = TREE_UNSIGNED (TREE_TYPE (op0));
- if (op1 == primop1 && TREE_TYPE (op1) != *restype_ptr)
- unsignedp1 = TREE_UNSIGNED (TREE_TYPE (op1));
-
- /* If one of the operands must be floated, we cannot optimize. */
- real1 = TREE_CODE (TREE_TYPE (primop0)) == REAL_TYPE;
- real2 = TREE_CODE (TREE_TYPE (primop1)) == REAL_TYPE;
-
- /* If first arg is constant, swap the args (changing operation
- so value is preserved), for canonicalization. Don't do this if
- the second arg is 0. */
-
- if (TREE_CONSTANT (primop0)
- && ! integer_zerop (primop1) && ! real_zerop (primop1))
- {
- register tree tem = primop0;
- register int temi = unsignedp0;
- primop0 = primop1;
- primop1 = tem;
- tem = op0;
- op0 = op1;
- op1 = tem;
- *op0_ptr = op0;
- *op1_ptr = op1;
- unsignedp0 = unsignedp1;
- unsignedp1 = temi;
- temi = real1;
- real1 = real2;
- real2 = temi;
-
- switch (code)
- {
- case LT_EXPR:
- code = GT_EXPR;
- break;
- case GT_EXPR:
- code = LT_EXPR;
- break;
- case LE_EXPR:
- code = GE_EXPR;
- break;
- case GE_EXPR:
- code = LE_EXPR;
- break;
- }
- *rescode_ptr = code;
- }
-
- /* If comparing an integer against a constant more bits wide,
- maybe we can deduce a value of 1 or 0 independent of the data.
- Or else truncate the constant now
- rather than extend the variable at run time.
-
- This is only interesting if the constant is the wider arg.
- Also, it is not safe if the constant is unsigned and the
- variable arg is signed, since in this case the variable
- would be sign-extended and then regarded as unsigned.
- Our technique fails in this case because the lowest/highest
- possible unsigned results don't follow naturally from the
- lowest/highest possible values of the variable operand.
- For just EQ_EXPR and NE_EXPR there is another technique that
- could be used: see if the constant can be faithfully represented
- in the other operand's type, by truncating it and reextending it
- and see if that preserves the constant's value. */
-
- if (!real1 && !real2
- && TREE_CODE (primop1) == INTEGER_CST
- && TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (*restype_ptr))
- {
- int min_gt, max_gt, min_lt, max_lt;
- tree maxval, minval;
- /* 1 if comparison is nominally unsigned. */
- int unsignedp = TREE_UNSIGNED (*restype_ptr);
- tree val;
-
- type = signed_or_unsigned_type (unsignedp0, TREE_TYPE (primop0));
-
- maxval = TYPE_MAX_VALUE (type);
- minval = TYPE_MIN_VALUE (type);
-
- if (unsignedp && !unsignedp0)
- *restype_ptr = signed_type (*restype_ptr);
-
- if (TREE_TYPE (primop1) != *restype_ptr)
- primop1 = convert (*restype_ptr, primop1);
- if (type != *restype_ptr)
- {
- minval = convert (*restype_ptr, minval);
- maxval = convert (*restype_ptr, maxval);
- }
-
- if (unsignedp && unsignedp0)
- {
- min_gt = INT_CST_LT_UNSIGNED (primop1, minval);
- max_gt = INT_CST_LT_UNSIGNED (primop1, maxval);
- min_lt = INT_CST_LT_UNSIGNED (minval, primop1);
- max_lt = INT_CST_LT_UNSIGNED (maxval, primop1);
- }
- else
- {
- min_gt = INT_CST_LT (primop1, minval);
- max_gt = INT_CST_LT (primop1, maxval);
- min_lt = INT_CST_LT (minval, primop1);
- max_lt = INT_CST_LT (maxval, primop1);
- }
-
- val = 0;
- /* This used to be a switch, but Genix compiler can't handle that. */
- if (code == NE_EXPR)
- {
- if (max_lt || min_gt)
- val = boolean_true_node;
- }
- else if (code == EQ_EXPR)
- {
- if (max_lt || min_gt)
- val = boolean_false_node;
- }
- else if (code == LT_EXPR)
- {
- if (max_lt)
- val = boolean_true_node;
- if (!min_lt)
- val = boolean_false_node;
- }
- else if (code == GT_EXPR)
- {
- if (min_gt)
- val = boolean_true_node;
- if (!max_gt)
- val = boolean_false_node;
- }
- else if (code == LE_EXPR)
- {
- if (!max_gt)
- val = boolean_true_node;
- if (min_gt)
- val = boolean_false_node;
- }
- else if (code == GE_EXPR)
- {
- if (!min_lt)
- val = boolean_true_node;
- if (max_lt)
- val = boolean_false_node;
- }
-
- /* If primop0 was sign-extended and unsigned comparison specd,
- we did a signed comparison above using the signed type bounds.
- But the comparison we output must be unsigned.
-
- Also, for inequalities, VAL is no good; but if the signed
- comparison had *any* fixed result, it follows that the
- unsigned comparison just tests the sign in reverse
- (positive values are LE, negative ones GE).
- So we can generate an unsigned comparison
- against an extreme value of the signed type. */
-
- if (unsignedp && !unsignedp0)
- {
- if (val != 0)
- switch (code)
- {
- case LT_EXPR:
- case GE_EXPR:
- primop1 = TYPE_MIN_VALUE (type);
- val = 0;
- break;
-
- case LE_EXPR:
- case GT_EXPR:
- primop1 = TYPE_MAX_VALUE (type);
- val = 0;
- break;
- }
- type = unsigned_type (type);
- }
-
- if (!max_gt && !unsignedp0 && TREE_CODE (primop0) != INTEGER_CST)
- {
- /* This is the case of (char)x >?< 0x80, which people used to use
- expecting old C compilers to change the 0x80 into -0x80. */
- if (val == boolean_false_node)
- warning ("comparison is always 0 due to limited range of data type");
- if (val == boolean_true_node)
- warning ("comparison is always 1 due to limited range of data type");
- }
-
- if (!min_lt && unsignedp0 && TREE_CODE (primop0) != INTEGER_CST)
- {
- /* This is the case of (unsigned char)x >?< -1 or < 0. */
- if (val == boolean_false_node)
- warning ("comparison is always 0 due to limited range of data type");
- if (val == boolean_true_node)
- warning ("comparison is always 1 due to limited range of data type");
- }
-
- if (val != 0)
- {
- /* Don't forget to evaluate PRIMOP0 if it has side effects. */
- if (TREE_SIDE_EFFECTS (primop0))
- return build (COMPOUND_EXPR, TREE_TYPE (val), primop0, val);
- return val;
- }
-
- /* Value is not predetermined, but do the comparison
- in the type of the operand that is not constant.
- TYPE is already properly set. */
- }
- else if (real1 && real2
- && (TYPE_PRECISION (TREE_TYPE (primop0))
- == TYPE_PRECISION (TREE_TYPE (primop1))))
- type = TREE_TYPE (primop0);
-
- /* If args' natural types are both narrower than nominal type
- and both extend in the same manner, compare them
- in the type of the wider arg.
- Otherwise must actually extend both to the nominal
- common type lest different ways of extending
- alter the result.
- (eg, (short)-1 == (unsigned short)-1 should be 0.) */
-
- else if (unsignedp0 == unsignedp1 && real1 == real2
- && TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (*restype_ptr)
- && TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr))
- {
- type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1));
- type = signed_or_unsigned_type (unsignedp0
- || TREE_UNSIGNED (*restype_ptr),
- type);
- /* Make sure shorter operand is extended the right way
- to match the longer operand. */
- primop0 = convert (signed_or_unsigned_type (unsignedp0, TREE_TYPE (primop0)),
- primop0);
- primop1 = convert (signed_or_unsigned_type (unsignedp1, TREE_TYPE (primop1)),
- primop1);
- }
- else
- {
- /* Here we must do the comparison on the nominal type
- using the args exactly as we received them. */
- type = *restype_ptr;
- primop0 = op0;
- primop1 = op1;
-
- if (!real1 && !real2 && integer_zerop (primop1)
- && TREE_UNSIGNED (*restype_ptr))
- {
- tree value = 0;
- switch (code)
- {
- case GE_EXPR:
- /* All unsigned values are >= 0, so we warn if extra warnings
- are requested. However, if OP0 is a constant that is
- >= 0, the signedness of the comparison isn't an issue,
- so suppress the warning. */
- if (extra_warnings
- && ! (TREE_CODE (primop0) == INTEGER_CST
- && ! TREE_OVERFLOW (convert (signed_type (type),
- primop0))))
- warning ("unsigned value >= 0 is always 1");
- value = boolean_true_node;
- break;
-
- case LT_EXPR:
- if (extra_warnings
- && ! (TREE_CODE (primop0) == INTEGER_CST
- && ! TREE_OVERFLOW (convert (signed_type (type),
- primop0))))
- warning ("unsigned value < 0 is always 0");
- value = boolean_false_node;
- }
-
- if (value != 0)
- {
- /* Don't forget to evaluate PRIMOP0 if it has side effects. */
- if (TREE_SIDE_EFFECTS (primop0))
- return build (COMPOUND_EXPR, TREE_TYPE (value),
- primop0, value);
- return value;
- }
- }
- }
-
- *op0_ptr = convert (type, primop0);
- *op1_ptr = convert (type, primop1);
-
- *restype_ptr = boolean_type_node;
-
- return 0;
-}
-
-/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
- or validate its data type for an `if' or `while' statement or ?..: exp.
-
- This preparation consists of taking the ordinary
- representation of an expression expr and producing a valid tree
- boolean expression describing whether expr is nonzero. We could
- simply always do build_binary_op (NE_EXPR, expr, boolean_false_node, 1),
- but we optimize comparisons, &&, ||, and !.
-
- The resulting type should always be `boolean_type_node'. */
-
-tree
-truthvalue_conversion (expr)
- tree expr;
-{
- if (TREE_CODE (expr) == ERROR_MARK)
- return expr;
-
-#if 0 /* This appears to be wrong for C++. */
- /* These really should return error_mark_node after 2.4 is stable.
- But not all callers handle ERROR_MARK properly. */
- switch (TREE_CODE (TREE_TYPE (expr)))
- {
- case RECORD_TYPE:
- error ("struct type value used where scalar is required");
- return boolean_false_node;
-
- case UNION_TYPE:
- error ("union type value used where scalar is required");
- return boolean_false_node;
-
- case ARRAY_TYPE:
- error ("array type value used where scalar is required");
- return boolean_false_node;
-
- default:
- break;
- }
-#endif /* 0 */
-
- switch (TREE_CODE (expr))
- {
- /* It is simpler and generates better code to have only TRUTH_*_EXPR
- or comparison expressions as truth values at this level. */
-#if 0
- case COMPONENT_REF:
- /* A one-bit unsigned bit-field is already acceptable. */
- if (1 == TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (expr, 1)))
- && TREE_UNSIGNED (TREE_OPERAND (expr, 1)))
- return expr;
- break;
-#endif
-
- case EQ_EXPR:
- /* It is simpler and generates better code to have only TRUTH_*_EXPR
- or comparison expressions as truth values at this level. */
-#if 0
- if (integer_zerop (TREE_OPERAND (expr, 1)))
- return build_unary_op (TRUTH_NOT_EXPR, TREE_OPERAND (expr, 0), 0);
-#endif
- case NE_EXPR: case LE_EXPR: case GE_EXPR: case LT_EXPR: case GT_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case TRUTH_XOR_EXPR:
- case TRUTH_NOT_EXPR:
- TREE_TYPE (expr) = boolean_type_node;
- return expr;
-
- case ERROR_MARK:
- return expr;
-
- case INTEGER_CST:
- return integer_zerop (expr) ? boolean_false_node : boolean_true_node;
-
- case REAL_CST:
- return real_zerop (expr) ? boolean_false_node : boolean_true_node;
-
- case ADDR_EXPR:
- /* If we are taking the address of a external decl, it might be zero
- if it is weak, so we cannot optimize. */
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (expr, 0))) == 'd'
- && DECL_EXTERNAL (TREE_OPERAND (expr, 0)))
- break;
-
- if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 0)))
- return build (COMPOUND_EXPR, boolean_type_node,
- TREE_OPERAND (expr, 0), boolean_true_node);
- else
- return boolean_true_node;
-
- case COMPLEX_EXPR:
- return build_binary_op ((TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1))
- ? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR),
- truthvalue_conversion (TREE_OPERAND (expr, 0)),
- truthvalue_conversion (TREE_OPERAND (expr, 1)),
- 0);
-
- case NEGATE_EXPR:
- case ABS_EXPR:
- case FLOAT_EXPR:
- case FFS_EXPR:
- /* These don't change whether an object is non-zero or zero. */
- return truthvalue_conversion (TREE_OPERAND (expr, 0));
-
- case LROTATE_EXPR:
- case RROTATE_EXPR:
- /* These don't change whether an object is zero or non-zero, but
- we can't ignore them if their second arg has side-effects. */
- if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1)))
- return build (COMPOUND_EXPR, boolean_type_node, TREE_OPERAND (expr, 1),
- truthvalue_conversion (TREE_OPERAND (expr, 0)));
- else
- return truthvalue_conversion (TREE_OPERAND (expr, 0));
-
- case COND_EXPR:
- /* Distribute the conversion into the arms of a COND_EXPR. */
- return fold (build (COND_EXPR, boolean_type_node, TREE_OPERAND (expr, 0),
- truthvalue_conversion (TREE_OPERAND (expr, 1)),
- truthvalue_conversion (TREE_OPERAND (expr, 2))));
-
- case CONVERT_EXPR:
- /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE,
- since that affects how `default_conversion' will behave. */
- if (TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE
- || TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == REFERENCE_TYPE)
- break;
- /* fall through... */
- case NOP_EXPR:
- /* If this is widening the argument, we can ignore it. */
- if (TYPE_PRECISION (TREE_TYPE (expr))
- >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (expr, 0))))
- return truthvalue_conversion (TREE_OPERAND (expr, 0));
- break;
-
- case MINUS_EXPR:
- /* With IEEE arithmetic, x - x may not equal 0, so we can't optimize
- this case. */
- if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
- && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE)
- break;
- /* fall through... */
- case BIT_XOR_EXPR:
- /* This and MINUS_EXPR can be changed into a comparison of the
- two objects. */
- if (TREE_TYPE (TREE_OPERAND (expr, 0))
- == TREE_TYPE (TREE_OPERAND (expr, 1)))
- return build_binary_op (NE_EXPR, TREE_OPERAND (expr, 0),
- TREE_OPERAND (expr, 1), 1);
- return build_binary_op (NE_EXPR, TREE_OPERAND (expr, 0),
- fold (build1 (NOP_EXPR,
- TREE_TYPE (TREE_OPERAND (expr, 0)),
- TREE_OPERAND (expr, 1))), 1);
-
- case BIT_AND_EXPR:
- if (integer_onep (TREE_OPERAND (expr, 1))
- && TREE_TYPE (expr) != boolean_type_node)
- /* Using convert here would cause infinite recursion. */
- return build1 (NOP_EXPR, boolean_type_node, expr);
- break;
-
- case MODIFY_EXPR:
- if (warn_parentheses && C_EXP_ORIGINAL_CODE (expr) == MODIFY_EXPR)
- warning ("suggest parentheses around assignment used as truth value");
- break;
- }
-
- if (TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE)
- return (build_binary_op
- ((TREE_SIDE_EFFECTS (expr)
- ? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR),
- truthvalue_conversion (build_unary_op (REALPART_EXPR, expr, 0)),
- truthvalue_conversion (build_unary_op (IMAGPART_EXPR, expr, 0)),
- 0));
-
- return build_binary_op (NE_EXPR, expr, integer_zero_node, 1);
-}
-
-/* Read the rest of a #-directive from input stream FINPUT.
- In normal use, the directive name and the white space after it
- have already been read, so they won't be included in the result.
- We allow for the fact that the directive line may contain
- a newline embedded within a character or string literal which forms
- a part of the directive.
-
- The value is a string in a reusable buffer. It remains valid
- only until the next time this function is called.
-
- The terminating character ('\n' or EOF) is left in FINPUT for the
- caller to re-read. */
-
-char *
-get_directive_line (finput)
- register FILE *finput;
-{
- static char *directive_buffer = NULL;
- static unsigned buffer_length = 0;
- register char *p;
- register char *buffer_limit;
- register int looking_for = 0;
- register int char_escaped = 0;
-
- if (buffer_length == 0)
- {
- directive_buffer = (char *)xmalloc (128);
- buffer_length = 128;
- }
-
- buffer_limit = &directive_buffer[buffer_length];
-
- for (p = directive_buffer; ; )
- {
- int c;
-
- /* Make buffer bigger if it is full. */
- if (p >= buffer_limit)
- {
- register unsigned bytes_used = (p - directive_buffer);
-
- buffer_length *= 2;
- directive_buffer
- = (char *)xrealloc (directive_buffer, buffer_length);
- p = &directive_buffer[bytes_used];
- buffer_limit = &directive_buffer[buffer_length];
- }
-
- c = getc (finput);
-
- /* Discard initial whitespace. */
- if ((c == ' ' || c == '\t') && p == directive_buffer)
- continue;
-
- /* Detect the end of the directive. */
- if (looking_for == 0
- && (c == '\n' || c == EOF))
- {
- ungetc (c, finput);
- c = '\0';
- }
-
- *p++ = c;
-
- if (c == 0)
- return directive_buffer;
-
- /* Handle string and character constant syntax. */
- if (looking_for)
- {
- if (looking_for == c && !char_escaped)
- looking_for = 0; /* Found terminator... stop looking. */
- }
- else
- if (c == '\'' || c == '"')
- looking_for = c; /* Don't stop buffering until we see another
- another one of these (or an EOF). */
-
- /* Handle backslash. */
- char_escaped = (c == '\\' && ! char_escaped);
- }
-}
-
-/* Make a variant type in the proper way for C/C++, propagating qualifiers
- down to the element type of an array. */
-
-tree
-c_build_type_variant (type, constp, volatilep)
- tree type;
- int constp, volatilep;
-{
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- tree real_main_variant = TYPE_MAIN_VARIANT (type);
-
- push_obstacks (TYPE_OBSTACK (real_main_variant),
- TYPE_OBSTACK (real_main_variant));
- type = build_array_type (c_build_type_variant (TREE_TYPE (type),
- constp, volatilep),
- TYPE_DOMAIN (type));
-
- /* TYPE must be on same obstack as REAL_MAIN_VARIANT. If not,
- make a copy. (TYPE might have come from the hash table and
- REAL_MAIN_VARIANT might be in some function's obstack.) */
-
- if (TYPE_OBSTACK (type) != TYPE_OBSTACK (real_main_variant))
- {
- type = copy_node (type);
- TYPE_POINTER_TO (type) = TYPE_REFERENCE_TO (type) = 0;
- }
-
- TYPE_MAIN_VARIANT (type) = real_main_variant;
- pop_obstacks ();
- }
- return build_type_variant (type, constp, volatilep);
-}
diff --git a/gcc/c-convert.c b/gcc/c-convert.c
deleted file mode 100644
index 8ba93a9816a..00000000000
--- a/gcc/c-convert.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Language-level data type conversion for GNU C.
- Copyright (C) 1987, 1988, 1991 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 contains the functions for converting C expressions
- to different data types. The only entry point is `convert'.
- Every language front end must have a `convert' function
- but what kind of conversions it does will depend on the language. */
-
-#include "config.h"
-#include "tree.h"
-#include "flags.h"
-#include "convert.h"
-
-/* Change of width--truncation and extension of integers or reals--
- is represented with NOP_EXPR. Proper functioning of many things
- assumes that no other conversions can be NOP_EXPRs.
-
- Conversion between integer and pointer is represented with CONVERT_EXPR.
- Converting integer to real uses FLOAT_EXPR
- and real to integer uses FIX_TRUNC_EXPR.
-
- Here is a list of all the functions that assume that widening and
- narrowing is always done with a NOP_EXPR:
- In convert.c, convert_to_integer.
- In c-typeck.c, build_binary_op (boolean ops), and truthvalue_conversion.
- In expr.c: expand_expr, for operands of a MULT_EXPR.
- In fold-const.c: fold.
- In tree.c: get_narrower and get_unwidened. */
-
-/* Subroutines of `convert'. */
-
-
-
-/* Create an expression whose value is that of EXPR,
- converted to type TYPE. The TREE_TYPE of the value
- is always TYPE. This function implements all reasonable
- conversions; callers should filter out those that are
- not permitted by the language being compiled. */
-
-tree
-convert (type, expr)
- tree type, expr;
-{
- register tree e = expr;
- register enum tree_code code = TREE_CODE (type);
-
- if (type == TREE_TYPE (expr)
- || TREE_CODE (expr) == ERROR_MARK)
- return expr;
- if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
- return fold (build1 (NOP_EXPR, type, expr));
- if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
- return error_mark_node;
- if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE)
- {
- error ("void value not ignored as it ought to be");
- return error_mark_node;
- }
- if (code == VOID_TYPE)
- return build1 (CONVERT_EXPR, type, e);
-#if 0
- /* This is incorrect. A truncation can't be stripped this way.
- Extensions will be stripped by the use of get_unwidened. */
- if (TREE_CODE (expr) == NOP_EXPR)
- return convert (type, TREE_OPERAND (expr, 0));
-#endif
- if (code == INTEGER_TYPE || code == ENUMERAL_TYPE)
- return fold (convert_to_integer (type, e));
- if (code == POINTER_TYPE)
- return fold (convert_to_pointer (type, e));
- if (code == REAL_TYPE)
- return fold (convert_to_real (type, e));
- if (code == COMPLEX_TYPE)
- return fold (convert_to_complex (type, e));
-
- error ("conversion to non-scalar type requested");
- return error_mark_node;
-}
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
deleted file mode 100644
index f9860e299af..00000000000
--- a/gcc/c-decl.c
+++ /dev/null
@@ -1,7177 +0,0 @@
-/* Process declarations and variables for C compiler.
- Copyright (C) 1988, 92, 93, 94, 95, 96, 1997 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. */
-
-
-/* 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 "tree.h"
-#include "flags.h"
-#include "output.h"
-#include "c-tree.h"
-#include "c-lex.h"
-#include <stdio.h>
-
-/* In grokdeclarator, distinguish syntactic contexts of declarators. */
-enum decl_context
-{ NORMAL, /* Ordinary declaration */
- FUNCDEF, /* Function definition */
- PARM, /* Declaration of parm before function body */
- FIELD, /* Declaration inside struct or union */
- BITFIELD, /* Likewise but with specified width */
- TYPENAME}; /* Typename (inside cast or sizeof) */
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-/* We let tm.h override the types used here, to handle trivial differences
- such as the choice of unsigned int or long unsigned int for size_t.
- When machines start needing nontrivial differences in the size type,
- it would be best to do something here to figure out automatically
- from other information what type to use. */
-
-#ifndef SIZE_TYPE
-#define SIZE_TYPE "long unsigned int"
-#endif
-
-#ifndef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-#endif
-
-#ifndef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-#endif
-
-/* a node which has tree code ERROR_MARK, and whose type is itself.
- All erroneous expressions are replaced with this node. All functions
- that accept nodes as arguments should avoid generating error messages
- if this node is one of the arguments, since it is undesirable to get
- multiple error messages from one error in the input. */
-
-tree error_mark_node;
-
-/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */
-
-tree short_integer_type_node;
-tree integer_type_node;
-tree long_integer_type_node;
-tree long_long_integer_type_node;
-
-tree short_unsigned_type_node;
-tree unsigned_type_node;
-tree long_unsigned_type_node;
-tree long_long_unsigned_type_node;
-
-tree boolean_type_node;
-tree boolean_false_node;
-tree boolean_true_node;
-
-tree ptrdiff_type_node;
-
-tree unsigned_char_type_node;
-tree signed_char_type_node;
-tree char_type_node;
-tree wchar_type_node;
-tree signed_wchar_type_node;
-tree unsigned_wchar_type_node;
-
-tree float_type_node;
-tree double_type_node;
-tree long_double_type_node;
-
-tree complex_integer_type_node;
-tree complex_float_type_node;
-tree complex_double_type_node;
-tree complex_long_double_type_node;
-
-tree intQI_type_node;
-tree intHI_type_node;
-tree intSI_type_node;
-tree intDI_type_node;
-
-tree unsigned_intQI_type_node;
-tree unsigned_intHI_type_node;
-tree unsigned_intSI_type_node;
-tree unsigned_intDI_type_node;
-
-/* a VOID_TYPE node. */
-
-tree void_type_node;
-
-/* Nodes for types `void *' and `const void *'. */
-
-tree ptr_type_node, const_ptr_type_node;
-
-/* Nodes for types `char *' and `const char *'. */
-
-tree string_type_node, const_string_type_node;
-
-/* Type `char[SOMENUMBER]'.
- Used when an array of char is needed and the size is irrelevant. */
-
-tree char_array_type_node;
-
-/* Type `int[SOMENUMBER]' or something like it.
- Used when an array of int needed and the size is irrelevant. */
-
-tree int_array_type_node;
-
-/* Type `wchar_t[SOMENUMBER]' or something like it.
- Used when a wide string literal is created. */
-
-tree wchar_array_type_node;
-
-/* type `int ()' -- used for implicit declaration of functions. */
-
-tree default_function_type;
-
-/* function types `double (double)' and `double (double, double)', etc. */
-
-tree double_ftype_double, double_ftype_double_double;
-tree int_ftype_int, long_ftype_long;
-tree float_ftype_float;
-tree ldouble_ftype_ldouble;
-
-/* Function type `void (void *, void *, int)' and similar ones */
-
-tree void_ftype_ptr_ptr_int, int_ftype_ptr_ptr_int, void_ftype_ptr_int_int;
-
-/* Function type `char *(char *, char *)' and similar ones */
-tree string_ftype_ptr_ptr, int_ftype_string_string;
-
-/* Function type `int (const void *, const void *, size_t)' */
-tree int_ftype_cptr_cptr_sizet;
-
-/* Two expressions that are constants with value zero.
- The first is of type `int', the second of type `void *'. */
-
-tree integer_zero_node;
-tree null_pointer_node;
-
-/* A node for the integer constant 1. */
-
-tree integer_one_node;
-
-/* Nonzero if we have seen an invalid cross reference
- to a struct, union, or enum, but not yet printed the message. */
-
-tree pending_invalid_xref;
-/* File and line to appear in the eventual error message. */
-char *pending_invalid_xref_file;
-int pending_invalid_xref_line;
-
-/* While defining an enum type, this is 1 plus the last enumerator
- constant value. Note that will do not have to save this or `enum_overflow'
- around nested function definition since such a definition could only
- occur in an enum value expression and we don't use these variables in
- that case. */
-
-static tree enum_next_value;
-
-/* Nonzero means that there was overflow computing enum_next_value. */
-
-static int enum_overflow;
-
-/* Parsing a function declarator leaves a list of parameter names
- or a chain or parameter decls here. */
-
-static tree last_function_parms;
-
-/* Parsing a function declarator leaves here a chain of structure
- and enum types declared in the parmlist. */
-
-static tree last_function_parm_tags;
-
-/* After parsing the declarator that starts a function definition,
- `start_function' puts here the list of parameter names or chain of decls.
- `store_parm_decls' finds it here. */
-
-static tree current_function_parms;
-
-/* Similar, for last_function_parm_tags. */
-static tree current_function_parm_tags;
-
-/* Similar, for the file and line that the prototype came from if this is
- an old-style definition. */
-static char *current_function_prototype_file;
-static int current_function_prototype_line;
-
-/* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function
- that have names. Here so we can clear out their names' definitions
- at the end of the function. */
-
-static tree named_labels;
-
-/* A list of LABEL_DECLs from outer contexts that are currently shadowed. */
-
-static tree shadowed_labels;
-
-/* Nonzero when store_parm_decls is called indicates a varargs function.
- Value not meaningful after store_parm_decls. */
-
-static int c_function_varargs;
-
-/* The FUNCTION_DECL for the function currently being compiled,
- or 0 if between functions. */
-tree current_function_decl;
-
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement that specifies a return value is seen. */
-
-int current_function_returns_value;
-
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement with no argument is seen. */
-
-int current_function_returns_null;
-
-/* Set to nonzero by `grokdeclarator' for a function
- whose return type is defaulted, if warnings for this are desired. */
-
-static int warn_about_return_type;
-
-/* Nonzero when starting a function declared `extern inline'. */
-
-static int current_extern_inline;
-
-/* For each binding contour we allocate a binding_level structure
- * which records the names defined in that contour.
- * Contours include:
- * 0) the global one
- * 1) one for each function definition,
- * where internal declarations of the parameters appear.
- * 2) one for each compound statement,
- * to record its declarations.
- *
- * The current meaning of a name can be found by searching the levels from
- * the current one out to the global one.
- */
-
-/* Note that the information in the `names' component of the global contour
- is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */
-
-struct binding_level
- {
- /* A chain of _DECL nodes for all variables, constants, functions,
- and typedef types. These are in the reverse of the order supplied.
- */
- tree names;
-
- /* A list of structure, union and enum definitions,
- * for looking up tag names.
- * It is a chain of TREE_LIST nodes, each of whose TREE_PURPOSE is a name,
- * or NULL_TREE; and whose TREE_VALUE is a RECORD_TYPE, UNION_TYPE,
- * or ENUMERAL_TYPE node.
- */
- tree tags;
-
- /* For each level, a list of shadowed outer-level local definitions
- to be restored when this level is popped.
- Each link is a TREE_LIST whose TREE_PURPOSE is an identifier and
- whose TREE_VALUE is its old definition (a kind of ..._DECL node). */
- tree shadowed;
-
- /* For each level (except not the global one),
- a chain of BLOCK nodes for all the levels
- that were entered and exited one level down. */
- tree blocks;
-
- /* The BLOCK node for this level, if one has been preallocated.
- If 0, the BLOCK is allocated (if needed) when the level is popped. */
- tree this_block;
-
- /* The binding level which this one is contained in (inherits from). */
- struct binding_level *level_chain;
-
- /* Nonzero for the level that holds the parameters of a function. */
- char parm_flag;
-
- /* Nonzero if this level "doesn't exist" for tags. */
- char tag_transparent;
-
- /* Nonzero if sublevels of this level "don't exist" for tags.
- This is set in the parm level of a function definition
- while reading the function body, so that the outermost block
- of the function body will be tag-transparent. */
- char subblocks_tag_transparent;
-
- /* Nonzero means make a BLOCK for this level regardless of all else. */
- char keep;
-
- /* Nonzero means make a BLOCK if this level has any subblocks. */
- char keep_if_subblocks;
-
- /* Number of decls in `names' that have incomplete
- structure or union types. */
- int n_incomplete;
-
- /* A list of decls giving the (reversed) specified order of parms,
- not including any forward-decls in the parmlist.
- This is so we can put the parms in proper order for assign_parms. */
- tree parm_order;
- };
-
-#define NULL_BINDING_LEVEL (struct binding_level *) NULL
-
-/* The binding level currently in effect. */
-
-static struct binding_level *current_binding_level;
-
-/* A chain of binding_level structures awaiting reuse. */
-
-static struct binding_level *free_binding_level;
-
-/* The outermost binding level, for names of file scope.
- This is created when the compiler is started and exists
- through the entire run. */
-
-static struct binding_level *global_binding_level;
-
-/* Binding level structures are initialized by copying this one. */
-
-static struct binding_level clear_binding_level
- = {NULL, NULL, NULL, NULL, NULL, NULL_BINDING_LEVEL, 0, 0, 0, 0, 0, 0,
- NULL};
-
-/* Nonzero means unconditionally make a BLOCK for the next level pushed. */
-
-static int keep_next_level_flag;
-
-/* Nonzero means make a BLOCK for the next level pushed
- if it has subblocks. */
-
-static int keep_next_if_subblocks;
-
-/* The chain of outer levels of label scopes.
- This uses the same data structure used for binding levels,
- but it works differently: each link in the chain records
- saved values of named_labels and shadowed_labels for
- a label binding level outside the current one. */
-
-static struct binding_level *label_level_chain;
-
-/* Functions called automatically at the beginning and end of execution. */
-
-tree static_ctors, static_dtors;
-
-/* Forward declarations. */
-
-static struct binding_level * make_binding_level PROTO((void));
-static void clear_limbo_values PROTO((tree));
-static int duplicate_decls PROTO((tree, tree, int));
-static char *redeclaration_error_message PROTO((tree, tree));
-static void storedecls PROTO((tree));
-static void storetags PROTO((tree));
-static tree lookup_tag PROTO((enum tree_code, tree,
- struct binding_level *, int));
-static tree lookup_tag_reverse PROTO((tree));
-static tree grokdeclarator PROTO((tree, tree, enum decl_context,
- int));
-static tree grokparms PROTO((tree, int));
-static int field_decl_cmp PROTO((const GENERIC_PTR, const GENERIC_PTR));
-static void layout_array_type PROTO((tree));
-
-/* C-specific option variables. */
-
-/* Nonzero means allow type mismatches in conditional expressions;
- just make their values `void'. */
-
-int flag_cond_mismatch;
-
-/* Nonzero means give `double' the same size as `float'. */
-
-int flag_short_double;
-
-/* Nonzero means don't recognize the keyword `asm'. */
-
-int flag_no_asm;
-
-/* Nonzero means don't recognize any builtin functions. */
-
-int flag_no_builtin;
-
-/* Nonzero means don't recognize the non-ANSI builtin functions.
- -ansi sets this. */
-
-int flag_no_nonansi_builtin;
-
-/* Nonzero means do some things the same way PCC does. */
-
-int flag_traditional;
-
-/* Nonzero means that we have builtin functions, and main is an int */
-
-int flag_hosted = 1;
-
-/* Nonzero means to allow single precision math even if we're generally
- being traditional. */
-int flag_allow_single_precision = 0;
-
-/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
-
-int flag_signed_bitfields = 1;
-int explicit_flag_signed_bitfields = 0;
-
-/* Nonzero means handle `#ident' directives. 0 means ignore them. */
-
-int flag_no_ident = 0;
-
-/* Nonzero means warn about implicit declarations. */
-
-int warn_implicit;
-
-/* Nonzero means give string constants the type `const char *'
- to get extra warnings from them. These warnings will be too numerous
- to be useful, except in thoroughly ANSIfied programs. */
-
-int warn_write_strings;
-
-/* Nonzero means warn about pointer casts that can drop a type qualifier
- from the pointer target type. */
-
-int warn_cast_qual;
-
-/* Nonzero means warn when casting a function call to a type that does
- not match the return type (e.g. (float)sqrt() or (anything*)malloc()
- when there is no previous declaration of sqrt or malloc. */
-
-int warn_bad_function_cast;
-
-/* Warn about traditional constructs whose meanings changed in ANSI C. */
-
-int warn_traditional;
-
-/* Nonzero means warn about sizeof(function) or addition/subtraction
- of function pointers. */
-
-int warn_pointer_arith;
-
-/* Nonzero means warn for non-prototype function decls
- or non-prototyped defs without previous prototype. */
-
-int warn_strict_prototypes;
-
-/* Nonzero means warn for any global function def
- without separate previous prototype decl. */
-
-int warn_missing_prototypes;
-
-/* Nonzero means warn for any global function def
- without separate previous decl. */
-
-int warn_missing_declarations;
-
-/* Nonzero means warn about multiple (redundant) decls for the same single
- variable or function. */
-
-int warn_redundant_decls = 0;
-
-/* Nonzero means warn about extern declarations of objects not at
- file-scope level and about *all* declarations of functions (whether
- extern or static) not at file-scope level. Note that we exclude
- implicit function declarations. To get warnings about those, use
- -Wimplicit. */
-
-int warn_nested_externs = 0;
-
-/* Warn about *printf or *scanf format/argument anomalies. */
-
-int warn_format;
-
-/* Warn about a subscript that has type char. */
-
-int warn_char_subscripts = 0;
-
-/* Warn if a type conversion is done that might have confusing results. */
-
-int warn_conversion;
-
-/* Warn if adding () is suggested. */
-
-int warn_parentheses;
-
-/* Warn if initializer is not completely bracketed. */
-
-int warn_missing_braces;
-
-/* Warn if main is suspicious. */
-
-int warn_main;
-
-/* Warn about comparison of signed and unsigned values. */
-
-int warn_sign_compare;
-
-/* Nonzero means `$' can be in an identifier. */
-
-#ifndef DOLLARS_IN_IDENTIFIERS
-#define DOLLARS_IN_IDENTIFIERS 1
-#endif
-int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
-
-/* Decode the string P as a language-specific option for C.
- Return 1 if it is recognized (and handle it);
- return 0 if not recognized. */
-
-int
-c_decode_option (p)
- char *p;
-{
- if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
- {
- flag_traditional = 1;
- flag_writable_strings = 1;
- }
- else if (!strcmp (p, "-fallow-single-precision"))
- flag_allow_single_precision = 1;
- else if (!strcmp (p, "-fhosted") || !strcmp (p, "-fno-freestanding"))
- {
- flag_hosted = 1;
- flag_no_builtin = 0;
- }
- else if (!strcmp (p, "-ffreestanding") || !strcmp (p, "-fno-hosted"))
- {
- flag_hosted = 0;
- flag_no_builtin = 1;
- /* warn_main will be 2 if set by -Wall, 1 if set by -Wmain */
- if (warn_main == 2)
- warn_main = 0;
- }
- else if (!strcmp (p, "-fnotraditional") || !strcmp (p, "-fno-traditional"))
- {
- flag_traditional = 0;
- flag_writable_strings = 0;
- }
- else if (!strcmp (p, "-fdollars-in-identifiers"))
- dollars_in_ident = 1;
- else if (!strcmp (p, "-fno-dollars-in-identifiers"))
- dollars_in_ident = 0;
- else if (!strcmp (p, "-fsigned-char"))
- flag_signed_char = 1;
- else if (!strcmp (p, "-funsigned-char"))
- flag_signed_char = 0;
- else if (!strcmp (p, "-fno-signed-char"))
- flag_signed_char = 0;
- else if (!strcmp (p, "-fno-unsigned-char"))
- flag_signed_char = 1;
- else if (!strcmp (p, "-fsigned-bitfields")
- || !strcmp (p, "-fno-unsigned-bitfields"))
- {
- flag_signed_bitfields = 1;
- explicit_flag_signed_bitfields = 1;
- }
- else if (!strcmp (p, "-funsigned-bitfields")
- || !strcmp (p, "-fno-signed-bitfields"))
- {
- flag_signed_bitfields = 0;
- explicit_flag_signed_bitfields = 1;
- }
- else if (!strcmp (p, "-fshort-enums"))
- flag_short_enums = 1;
- else if (!strcmp (p, "-fno-short-enums"))
- flag_short_enums = 0;
- else if (!strcmp (p, "-fcond-mismatch"))
- flag_cond_mismatch = 1;
- else if (!strcmp (p, "-fno-cond-mismatch"))
- flag_cond_mismatch = 0;
- else if (!strcmp (p, "-fshort-double"))
- flag_short_double = 1;
- else if (!strcmp (p, "-fno-short-double"))
- flag_short_double = 0;
- else if (!strcmp (p, "-fasm"))
- flag_no_asm = 0;
- else if (!strcmp (p, "-fno-asm"))
- flag_no_asm = 1;
- else if (!strcmp (p, "-fbuiltin"))
- flag_no_builtin = 0;
- else if (!strcmp (p, "-fno-builtin"))
- flag_no_builtin = 1;
- else if (!strcmp (p, "-fno-ident"))
- flag_no_ident = 1;
- else if (!strcmp (p, "-fident"))
- flag_no_ident = 0;
- else if (!strcmp (p, "-ansi"))
- flag_no_asm = 1, flag_no_nonansi_builtin = 1;
- else if (!strcmp (p, "-Wimplicit"))
- warn_implicit = 1;
- else if (!strcmp (p, "-Wno-implicit"))
- warn_implicit = 0;
- else if (!strcmp (p, "-Wwrite-strings"))
- warn_write_strings = 1;
- else if (!strcmp (p, "-Wno-write-strings"))
- warn_write_strings = 0;
- else if (!strcmp (p, "-Wcast-qual"))
- warn_cast_qual = 1;
- else if (!strcmp (p, "-Wno-cast-qual"))
- warn_cast_qual = 0;
- else if (!strcmp (p, "-Wbad-function-cast"))
- warn_bad_function_cast = 1;
- else if (!strcmp (p, "-Wno-bad-function-cast"))
- warn_bad_function_cast = 0;
- else if (!strcmp (p, "-Wpointer-arith"))
- warn_pointer_arith = 1;
- else if (!strcmp (p, "-Wno-pointer-arith"))
- warn_pointer_arith = 0;
- else if (!strcmp (p, "-Wstrict-prototypes"))
- warn_strict_prototypes = 1;
- else if (!strcmp (p, "-Wno-strict-prototypes"))
- warn_strict_prototypes = 0;
- else if (!strcmp (p, "-Wmissing-prototypes"))
- warn_missing_prototypes = 1;
- else if (!strcmp (p, "-Wno-missing-prototypes"))
- warn_missing_prototypes = 0;
- else if (!strcmp (p, "-Wmissing-declarations"))
- warn_missing_declarations = 1;
- else if (!strcmp (p, "-Wno-missing-declarations"))
- warn_missing_declarations = 0;
- else if (!strcmp (p, "-Wredundant-decls"))
- warn_redundant_decls = 1;
- else if (!strcmp (p, "-Wno-redundant-decls"))
- warn_redundant_decls = 0;
- else if (!strcmp (p, "-Wnested-externs"))
- warn_nested_externs = 1;
- else if (!strcmp (p, "-Wno-nested-externs"))
- warn_nested_externs = 0;
- else if (!strcmp (p, "-Wtraditional"))
- warn_traditional = 1;
- else if (!strcmp (p, "-Wno-traditional"))
- warn_traditional = 0;
- else if (!strcmp (p, "-Wformat"))
- warn_format = 1;
- else if (!strcmp (p, "-Wno-format"))
- warn_format = 0;
- else if (!strcmp (p, "-Wchar-subscripts"))
- warn_char_subscripts = 1;
- else if (!strcmp (p, "-Wno-char-subscripts"))
- warn_char_subscripts = 0;
- else if (!strcmp (p, "-Wconversion"))
- warn_conversion = 1;
- else if (!strcmp (p, "-Wno-conversion"))
- warn_conversion = 0;
- else if (!strcmp (p, "-Wparentheses"))
- warn_parentheses = 1;
- else if (!strcmp (p, "-Wno-parentheses"))
- warn_parentheses = 0;
- else if (!strcmp (p, "-Wreturn-type"))
- warn_return_type = 1;
- else if (!strcmp (p, "-Wno-return-type"))
- warn_return_type = 0;
- else if (!strcmp (p, "-Wcomment"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "-Wno-comment"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "-Wcomments"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "-Wno-comments"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "-Wtrigraphs"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "-Wno-trigraphs"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "-Wimport"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "-Wno-import"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "-Wmissing-braces"))
- warn_missing_braces = 1;
- else if (!strcmp (p, "-Wno-missing-braces"))
- warn_missing_braces = 0;
- else if (!strcmp (p, "-Wmain"))
- warn_main = 1;
- else if (!strcmp (p, "-Wno-main"))
- warn_main = 0;
- else if (!strcmp (p, "-Wsign-compare"))
- warn_sign_compare = 1;
- else if (!strcmp (p, "-Wno-sign-compare"))
- warn_sign_compare = 0;
- else if (!strcmp (p, "-Wall"))
- {
- /* We save the value of warn_uninitialized, since if they put
- -Wuninitialized on the command line, we need to generate a
- warning about not using it without also specifying -O. */
- if (warn_uninitialized != 1)
- warn_uninitialized = 2;
- warn_implicit = 1;
- warn_return_type = 1;
- warn_unused = 1;
- warn_switch = 1;
- warn_format = 1;
- warn_char_subscripts = 1;
- warn_parentheses = 1;
- warn_missing_braces = 1;
- warn_sign_compare = 1;
- /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding can turn
- it off only if it's not explicit. */
- warn_main = 2;
- }
- else
- return 0;
-
- return 1;
-}
-
-/* Hooks for print_node. */
-
-void
-print_lang_decl (file, node, indent)
- FILE *file;
- tree node;
- int indent;
-{
-}
-
-void
-print_lang_type (file, node, indent)
- FILE *file;
- tree node;
- int indent;
-{
-}
-
-void
-print_lang_identifier (file, node, indent)
- FILE *file;
- tree node;
- int indent;
-{
- print_node (file, "global", IDENTIFIER_GLOBAL_VALUE (node), indent + 4);
- print_node (file, "local", IDENTIFIER_LOCAL_VALUE (node), indent + 4);
- print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
- print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4);
- print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4);
- print_node (file, "limbo value", IDENTIFIER_LIMBO_VALUE (node), indent + 4);
-}
-
-/* Hook called at end of compilation to assume 1 elt
- for a top-level array decl that wasn't complete before. */
-
-void
-finish_incomplete_decl (decl)
- tree decl;
-{
- if (TREE_CODE (decl) == VAR_DECL)
- {
- tree type = TREE_TYPE (decl);
- if (type != error_mark_node
- && TREE_CODE (type) == ARRAY_TYPE
- && TYPE_DOMAIN (type) == 0)
- {
- if (! DECL_EXTERNAL (decl))
- warning_with_decl (decl, "array `%s' assumed to have one element");
-
- complete_array_type (type, NULL_TREE, 1);
-
- layout_decl (decl, 0);
- }
- }
-}
-
-/* Create a new `struct binding_level'. */
-
-static
-struct binding_level *
-make_binding_level ()
-{
- /* NOSTRICT */
- return (struct binding_level *) xmalloc (sizeof (struct binding_level));
-}
-
-/* Nonzero if we are currently in the global binding level. */
-
-int
-global_bindings_p ()
-{
- return current_binding_level == global_binding_level;
-}
-
-void
-keep_next_level ()
-{
- keep_next_level_flag = 1;
-}
-
-/* Nonzero if the current level needs to have a BLOCK made. */
-
-int
-kept_level_p ()
-{
- return ((current_binding_level->keep_if_subblocks
- && current_binding_level->blocks != 0)
- || current_binding_level->keep
- || current_binding_level->names != 0
- || (current_binding_level->tags != 0
- && !current_binding_level->tag_transparent));
-}
-
-/* Identify this binding level as a level of parameters.
- DEFINITION_FLAG is 1 for a definition, 0 for a declaration.
- But it turns out there is no way to pass the right value for
- DEFINITION_FLAG, so we ignore it. */
-
-void
-declare_parm_level (definition_flag)
- int definition_flag;
-{
- current_binding_level->parm_flag = 1;
-}
-
-/* Nonzero if currently making parm declarations. */
-
-int
-in_parm_level_p ()
-{
- return current_binding_level->parm_flag;
-}
-
-/* Enter a new binding level.
- If TAG_TRANSPARENT is nonzero, do so only for the name space of variables,
- not for that of tags. */
-
-void
-pushlevel (tag_transparent)
- int tag_transparent;
-{
- register struct binding_level *newlevel = NULL_BINDING_LEVEL;
-
- /* If this is the top level of a function,
- just make sure that NAMED_LABELS is 0. */
-
- if (current_binding_level == global_binding_level)
- {
- named_labels = 0;
- }
-
- /* Reuse or create a struct for this binding level. */
-
- if (free_binding_level)
- {
- newlevel = free_binding_level;
- free_binding_level = free_binding_level->level_chain;
- }
- else
- {
- newlevel = make_binding_level ();
- }
-
- /* Add this level to the front of the chain (stack) of levels that
- are active. */
-
- *newlevel = clear_binding_level;
- newlevel->tag_transparent
- = (tag_transparent
- || (current_binding_level
- ? current_binding_level->subblocks_tag_transparent
- : 0));
- newlevel->level_chain = current_binding_level;
- current_binding_level = newlevel;
- newlevel->keep = keep_next_level_flag;
- keep_next_level_flag = 0;
- newlevel->keep_if_subblocks = keep_next_if_subblocks;
- keep_next_if_subblocks = 0;
-}
-
-/* Clear the limbo values of all identifiers defined in BLOCK or a subblock. */
-
-static void
-clear_limbo_values (block)
- tree block;
-{
- tree tem;
-
- for (tem = BLOCK_VARS (block); tem; tem = TREE_CHAIN (tem))
- if (DECL_NAME (tem) != 0)
- IDENTIFIER_LIMBO_VALUE (DECL_NAME (tem)) = 0;
-
- for (tem = BLOCK_SUBBLOCKS (block); tem; tem = TREE_CHAIN (tem))
- clear_limbo_values (tem);
-}
-
-/* Exit a binding level.
- Pop the level off, and restore the state of the identifier-decl mappings
- that were in effect when this level was entered.
-
- If KEEP is nonzero, this level had explicit declarations, so
- and create a "block" (a BLOCK node) for the level
- to record its declarations and subblocks for symbol table output.
-
- If FUNCTIONBODY is nonzero, this level is the body of a function,
- so create a block as if KEEP were set and also clear out all
- label names.
-
- If REVERSE is nonzero, reverse the order of decls before putting
- them into the BLOCK. */
-
-tree
-poplevel (keep, reverse, functionbody)
- int keep;
- int reverse;
- int functionbody;
-{
- register tree link;
- /* The chain of decls was accumulated in reverse order.
- Put it into forward order, just for cleanliness. */
- tree decls;
- tree tags = current_binding_level->tags;
- tree subblocks = current_binding_level->blocks;
- tree block = 0;
- tree decl;
- int block_previously_created;
-
- keep |= current_binding_level->keep;
-
- /* This warning is turned off because it causes warnings for
- declarations like `extern struct foo *x'. */
-#if 0
- /* Warn about incomplete structure types in this level. */
- for (link = tags; link; link = TREE_CHAIN (link))
- if (TYPE_SIZE (TREE_VALUE (link)) == 0)
- {
- tree type = TREE_VALUE (link);
- char *errmsg;
- switch (TREE_CODE (type))
- {
- case RECORD_TYPE:
- errmsg = "`struct %s' incomplete in scope ending here";
- break;
- case UNION_TYPE:
- errmsg = "`union %s' incomplete in scope ending here";
- break;
- case ENUMERAL_TYPE:
- errmsg = "`enum %s' incomplete in scope ending here";
- break;
- }
- if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- error (errmsg, IDENTIFIER_POINTER (TYPE_NAME (type)));
- else
- /* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */
- error (errmsg, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
- }
-#endif /* 0 */
-
- /* Get the decls in the order they were written.
- Usually current_binding_level->names is in reverse order.
- But parameter decls were previously put in forward order. */
-
- if (reverse)
- current_binding_level->names
- = decls = nreverse (current_binding_level->names);
- else
- decls = current_binding_level->names;
-
- /* Output any nested inline functions within this block
- if they weren't already output. */
-
- for (decl = decls; decl; decl = TREE_CHAIN (decl))
- if (TREE_CODE (decl) == FUNCTION_DECL
- && ! TREE_ASM_WRITTEN (decl)
- && DECL_INITIAL (decl) != 0
- && TREE_ADDRESSABLE (decl))
- {
- /* If this decl was copied from a file-scope decl
- on account of a block-scope extern decl,
- propagate TREE_ADDRESSABLE to the file-scope decl.
-
- DECL_ABSTRACT_ORIGIN can be set to itself if warn_return_type is
- true, since then the decl goes through save_for_inline_copying. */
- if (DECL_ABSTRACT_ORIGIN (decl) != 0
- && DECL_ABSTRACT_ORIGIN (decl) != decl)
- TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (decl)) = 1;
- else if (DECL_SAVED_INSNS (decl) != 0)
- {
- push_function_context ();
- output_inline_function (decl);
- pop_function_context ();
- }
- }
-
- /* If there were any declarations or structure tags in that level,
- or if this level is a function body,
- create a BLOCK to record them for the life of this function. */
-
- block = 0;
- block_previously_created = (current_binding_level->this_block != 0);
- if (block_previously_created)
- block = current_binding_level->this_block;
- else if (keep || functionbody
- || (current_binding_level->keep_if_subblocks && subblocks != 0))
- block = make_node (BLOCK);
- if (block != 0)
- {
- BLOCK_VARS (block) = decls;
- BLOCK_TYPE_TAGS (block) = tags;
- BLOCK_SUBBLOCKS (block) = subblocks;
- remember_end_note (block);
- }
-
- /* In each subblock, record that this is its superior. */
-
- for (link = subblocks; link; link = TREE_CHAIN (link))
- BLOCK_SUPERCONTEXT (link) = block;
-
- /* Clear out the meanings of the local variables of this level. */
-
- for (link = decls; link; link = TREE_CHAIN (link))
- {
- if (DECL_NAME (link) != 0)
- {
- /* If the ident. was used or addressed via a local extern decl,
- don't forget that fact. */
- if (DECL_EXTERNAL (link))
- {
- if (TREE_USED (link))
- TREE_USED (DECL_NAME (link)) = 1;
- if (TREE_ADDRESSABLE (link))
- TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (link)) = 1;
- }
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (link)) = 0;
- }
- }
-
- /* Restore all name-meanings of the outer levels
- that were shadowed by this level. */
-
- for (link = current_binding_level->shadowed; link; link = TREE_CHAIN (link))
- IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
-
- /* If the level being exited is the top level of a function,
- check over all the labels, and clear out the current
- (function local) meanings of their names. */
-
- if (functionbody)
- {
- clear_limbo_values (block);
-
- /* If this is the top level block of a function,
- the vars are the function's parameters.
- Don't leave them in the BLOCK because they are
- found in the FUNCTION_DECL instead. */
-
- BLOCK_VARS (block) = 0;
-
- /* Clear out the definitions of all label names,
- since their scopes end here,
- and add them to BLOCK_VARS. */
-
- for (link = named_labels; link; link = TREE_CHAIN (link))
- {
- register tree label = TREE_VALUE (link);
-
- if (DECL_INITIAL (label) == 0)
- {
- error_with_decl (label, "label `%s' used but not defined");
- /* Avoid crashing later. */
- define_label (input_filename, lineno,
- DECL_NAME (label));
- }
- else if (warn_unused && !TREE_USED (label))
- warning_with_decl (label, "label `%s' defined but not used");
- IDENTIFIER_LABEL_VALUE (DECL_NAME (label)) = 0;
-
- /* Put the labels into the "variables" of the
- top-level block, so debugger can see them. */
- TREE_CHAIN (label) = BLOCK_VARS (block);
- BLOCK_VARS (block) = label;
- }
- }
-
- /* Pop the current level, and free the structure for reuse. */
-
- {
- register struct binding_level *level = current_binding_level;
- current_binding_level = current_binding_level->level_chain;
-
- level->level_chain = free_binding_level;
- free_binding_level = level;
- }
-
- /* Dispose of the block that we just made inside some higher level. */
- if (functionbody)
- DECL_INITIAL (current_function_decl) = block;
- else if (block)
- {
- if (!block_previously_created)
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
- }
- /* If we did not make a block for the level just exited,
- any blocks made for inner levels
- (since they cannot be recorded as subblocks in that level)
- must be carried forward so they will later become subblocks
- of something else. */
- else if (subblocks)
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, subblocks);
-
- /* Set the TYPE_CONTEXTs for all of the tagged types belonging to this
- binding contour so that they point to the appropriate construct, i.e.
- either to the current FUNCTION_DECL node, or else to the BLOCK node
- we just constructed.
-
- Note that for tagged types whose scope is just the formal parameter
- list for some function type specification, we can't properly set
- their TYPE_CONTEXTs here, because we don't have a pointer to the
- appropriate FUNCTION_TYPE node readily available to us. For those
- cases, the TYPE_CONTEXTs of the relevant tagged type nodes get set
- in `grokdeclarator' as soon as we have created the FUNCTION_TYPE
- node which will represent the "scope" for these "parameter list local"
- tagged types.
- */
-
- if (functionbody)
- for (link = tags; link; link = TREE_CHAIN (link))
- TYPE_CONTEXT (TREE_VALUE (link)) = current_function_decl;
- else if (block)
- for (link = tags; link; link = TREE_CHAIN (link))
- TYPE_CONTEXT (TREE_VALUE (link)) = block;
-
- if (block)
- TREE_USED (block) = 1;
- return block;
-}
-
-/* Delete the node BLOCK from the current binding level.
- This is used for the block inside a stmt expr ({...})
- so that the block can be reinserted where appropriate. */
-
-void
-delete_block (block)
- tree block;
-{
- tree t;
- if (current_binding_level->blocks == block)
- current_binding_level->blocks = TREE_CHAIN (block);
- for (t = current_binding_level->blocks; t;)
- {
- if (TREE_CHAIN (t) == block)
- TREE_CHAIN (t) = TREE_CHAIN (block);
- else
- t = TREE_CHAIN (t);
- }
- TREE_CHAIN (block) = NULL;
- /* Clear TREE_USED which is always set by poplevel.
- The flag is set again if insert_block is called. */
- TREE_USED (block) = 0;
-}
-
-/* Insert BLOCK at the end of the list of subblocks of the
- current binding level. This is used when a BIND_EXPR is expanded,
- to handle the BLOCK node inside the BIND_EXPR. */
-
-void
-insert_block (block)
- tree block;
-{
- TREE_USED (block) = 1;
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
-}
-
-/* Set the BLOCK node for the innermost scope
- (the one we are currently in). */
-
-void
-set_block (block)
- register tree block;
-{
- current_binding_level->this_block = block;
-}
-
-void
-push_label_level ()
-{
- register struct binding_level *newlevel;
-
- /* Reuse or create a struct for this binding level. */
-
- if (free_binding_level)
- {
- newlevel = free_binding_level;
- free_binding_level = free_binding_level->level_chain;
- }
- else
- {
- newlevel = make_binding_level ();
- }
-
- /* Add this level to the front of the chain (stack) of label levels. */
-
- newlevel->level_chain = label_level_chain;
- label_level_chain = newlevel;
-
- newlevel->names = named_labels;
- newlevel->shadowed = shadowed_labels;
- named_labels = 0;
- shadowed_labels = 0;
-}
-
-void
-pop_label_level ()
-{
- register struct binding_level *level = label_level_chain;
- tree link, prev;
-
- /* Clear out the definitions of the declared labels in this level.
- Leave in the list any ordinary, non-declared labels. */
- for (link = named_labels, prev = 0; link;)
- {
- if (C_DECLARED_LABEL_FLAG (TREE_VALUE (link)))
- {
- if (DECL_SOURCE_LINE (TREE_VALUE (link)) == 0)
- {
- error_with_decl (TREE_VALUE (link),
- "label `%s' used but not defined");
- /* Avoid crashing later. */
- define_label (input_filename, lineno,
- DECL_NAME (TREE_VALUE (link)));
- }
- else if (warn_unused && !TREE_USED (TREE_VALUE (link)))
- warning_with_decl (TREE_VALUE (link),
- "label `%s' defined but not used");
- IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link))) = 0;
-
- /* Delete this element from the list. */
- link = TREE_CHAIN (link);
- if (prev)
- TREE_CHAIN (prev) = link;
- else
- named_labels = link;
- }
- else
- {
- prev = link;
- link = TREE_CHAIN (link);
- }
- }
-
- /* Bring back all the labels that were shadowed. */
- for (link = shadowed_labels; link; link = TREE_CHAIN (link))
- if (DECL_NAME (TREE_VALUE (link)) != 0)
- IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link)))
- = TREE_VALUE (link);
-
- named_labels = chainon (named_labels, level->names);
- shadowed_labels = level->shadowed;
-
- /* Pop the current level, and free the structure for reuse. */
- label_level_chain = label_level_chain->level_chain;
- level->level_chain = free_binding_level;
- free_binding_level = level;
-}
-
-/* Push a definition or a declaration of struct, union or enum tag "name".
- "type" should be the type node.
- We assume that the tag "name" is not already defined.
-
- Note that the definition may really be just a forward reference.
- In that case, the TYPE_SIZE will be zero. */
-
-void
-pushtag (name, type)
- tree name, type;
-{
- register struct binding_level *b;
-
- /* Find the proper binding level for this type tag. */
-
- for (b = current_binding_level; b->tag_transparent; b = b->level_chain)
- continue;
-
- if (name)
- {
- /* Record the identifier as the type's name if it has none. */
-
- if (TYPE_NAME (type) == 0)
- TYPE_NAME (type) = name;
- }
-
- if (b == global_binding_level)
- b->tags = perm_tree_cons (name, type, b->tags);
- else
- b->tags = saveable_tree_cons (name, type, b->tags);
-
- /* Create a fake NULL-named TYPE_DECL node whose TREE_TYPE will be the
- tagged type we just added to the current binding level. This fake
- NULL-named TYPE_DECL node helps dwarfout.c to know when it needs
- to output a representation of a tagged type, and it also gives
- us a convenient place to record the "scope start" address for the
- tagged type. */
-
- TYPE_STUB_DECL (type) = pushdecl (build_decl (TYPE_DECL, NULL_TREE, type));
-
- /* An approximation for now, so we can tell this is a function-scope tag.
- This will be updated in poplevel. */
- TYPE_CONTEXT (type) = DECL_CONTEXT (TYPE_STUB_DECL (type));
-}
-
-/* Handle when a new declaration NEWDECL
- has the same name as an old one OLDDECL
- in the same binding contour.
- Prints an error message if appropriate.
-
- If safely possible, alter OLDDECL to look like NEWDECL, and return 1.
- Otherwise, return 0.
-
- When DIFFERENT_BINDING_LEVEL is true, NEWDECL is an external declaration,
- and OLDDECL is in an outer binding level and should thus not be changed. */
-
-static int
-duplicate_decls (newdecl, olddecl, different_binding_level)
- register tree newdecl, olddecl;
- int different_binding_level;
-{
- int types_match = comptypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
- int new_is_definition = (TREE_CODE (newdecl) == FUNCTION_DECL
- && DECL_INITIAL (newdecl) != 0);
- tree oldtype = TREE_TYPE (olddecl);
- tree newtype = TREE_TYPE (newdecl);
- char *errmsg = 0;
-
- if (TREE_CODE_CLASS (TREE_CODE (olddecl)) == 'd')
- DECL_MACHINE_ATTRIBUTES (newdecl) = DECL_MACHINE_ATTRIBUTES (olddecl);
-
- if (TREE_CODE (newtype) == ERROR_MARK
- || TREE_CODE (oldtype) == ERROR_MARK)
- types_match = 0;
-
- /* New decl is completely inconsistent with the old one =>
- tell caller to replace the old one.
- This is always an error except in the case of shadowing a builtin. */
- if (TREE_CODE (olddecl) != TREE_CODE (newdecl))
- {
- if (TREE_CODE (olddecl) == FUNCTION_DECL
- && (DECL_BUILT_IN (olddecl)
- || DECL_BUILT_IN_NONANSI (olddecl)))
- {
- /* If you declare a built-in or predefined function name as static,
- the old definition is overridden,
- but optionally warn this was a bad choice of name. */
- if (!TREE_PUBLIC (newdecl))
- {
- if (!warn_shadow)
- ;
- else if (DECL_BUILT_IN (olddecl))
- warning_with_decl (newdecl, "shadowing built-in function `%s'");
- else
- warning_with_decl (newdecl, "shadowing library function `%s'");
- }
- /* Likewise, if the built-in is not ansi, then programs can
- override it even globally without an error. */
- else if (! DECL_BUILT_IN (olddecl))
- warning_with_decl (newdecl,
- "library function `%s' declared as non-function");
-
- else if (DECL_BUILT_IN_NONANSI (olddecl))
- warning_with_decl (newdecl,
- "built-in function `%s' declared as non-function");
- else
- warning_with_decl (newdecl,
- "built-in function `%s' declared as non-function");
- }
- else
- {
- error_with_decl (newdecl, "`%s' redeclared as different kind of symbol");
- error_with_decl (olddecl, "previous declaration of `%s'");
- }
-
- return 0;
- }
-
- /* For real parm decl following a forward decl,
- return 1 so old decl will be reused. */
- if (types_match && TREE_CODE (newdecl) == PARM_DECL
- && TREE_ASM_WRITTEN (olddecl) && ! TREE_ASM_WRITTEN (newdecl))
- return 1;
-
- /* The new declaration is the same kind of object as the old one.
- The declarations may partially match. Print warnings if they don't
- match enough. Ultimately, copy most of the information from the new
- decl to the old one, and keep using the old one. */
-
- if (flag_traditional && TREE_CODE (newdecl) == FUNCTION_DECL
- && IDENTIFIER_IMPLICIT_DECL (DECL_NAME (newdecl)) == olddecl
- && DECL_INITIAL (olddecl) == 0)
- /* If -traditional, avoid error for redeclaring fcn
- after implicit decl. */
- ;
- else if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_BUILT_IN (olddecl))
- {
- /* A function declaration for a built-in function. */
- if (!TREE_PUBLIC (newdecl))
- {
- /* If you declare a built-in function name as static, the
- built-in definition is overridden,
- but optionally warn this was a bad choice of name. */
- if (warn_shadow)
- warning_with_decl (newdecl, "shadowing built-in function `%s'");
- /* Discard the old built-in function. */
- return 0;
- }
- else if (!types_match)
- {
- /* Accept the return type of the new declaration if same modes. */
- tree oldreturntype = TREE_TYPE (oldtype);
- tree newreturntype = TREE_TYPE (newtype);
-
- /* Make sure we put the new type in the same obstack as the old ones.
- If the old types are not both in the same obstack, use the
- permanent one. */
- if (TYPE_OBSTACK (oldtype) == TYPE_OBSTACK (newtype))
- push_obstacks (TYPE_OBSTACK (oldtype), TYPE_OBSTACK (oldtype));
- else
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- }
-
- if (TYPE_MODE (oldreturntype) == TYPE_MODE (newreturntype))
- {
- /* Function types may be shared, so we can't just modify
- the return type of olddecl's function type. */
- tree trytype
- = build_function_type (newreturntype,
- TYPE_ARG_TYPES (oldtype));
-
- types_match = comptypes (newtype, trytype);
- if (types_match)
- oldtype = trytype;
- }
- /* Accept harmless mismatch in first argument type also.
- This is for ffs. */
- if (TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != 0
- && TYPE_ARG_TYPES (oldtype) != 0
- && TREE_VALUE (TYPE_ARG_TYPES (newtype)) != 0
- && TREE_VALUE (TYPE_ARG_TYPES (oldtype)) != 0
- && (TYPE_MODE (TREE_VALUE (TYPE_ARG_TYPES (newtype)))
- == TYPE_MODE (TREE_VALUE (TYPE_ARG_TYPES (oldtype)))))
- {
- /* Function types may be shared, so we can't just modify
- the return type of olddecl's function type. */
- tree trytype
- = build_function_type (TREE_TYPE (oldtype),
- tree_cons (NULL_TREE,
- TREE_VALUE (TYPE_ARG_TYPES (newtype)),
- TREE_CHAIN (TYPE_ARG_TYPES (oldtype))));
-
- types_match = comptypes (newtype, trytype);
- if (types_match)
- oldtype = trytype;
- }
- if (! different_binding_level)
- TREE_TYPE (olddecl) = oldtype;
-
- pop_obstacks ();
- }
- if (!types_match)
- {
- /* If types don't match for a built-in, throw away the built-in. */
- warning_with_decl (newdecl, "conflicting types for built-in function `%s'");
- return 0;
- }
- }
- else if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_SOURCE_LINE (olddecl) == 0)
- {
- /* A function declaration for a predeclared function
- that isn't actually built in. */
- if (!TREE_PUBLIC (newdecl))
- {
- /* If you declare it as static, the
- default definition is overridden. */
- return 0;
- }
- else if (!types_match)
- {
- /* If the types don't match, preserve volatility indication.
- Later on, we will discard everything else about the
- default declaration. */
- TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl);
- }
- }
- /* Permit char *foo () to match void *foo (...) if not pedantic,
- if one of them came from a system header file. */
- else if (!types_match
- && TREE_CODE (olddecl) == FUNCTION_DECL
- && TREE_CODE (newdecl) == FUNCTION_DECL
- && TREE_CODE (TREE_TYPE (oldtype)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (newtype)) == POINTER_TYPE
- && (DECL_IN_SYSTEM_HEADER (olddecl)
- || DECL_IN_SYSTEM_HEADER (newdecl))
- && ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (newtype))) == void_type_node
- && TYPE_ARG_TYPES (oldtype) == 0
- && self_promoting_args_p (TYPE_ARG_TYPES (newtype))
- && TREE_TYPE (TREE_TYPE (oldtype)) == char_type_node)
- ||
- (TREE_TYPE (TREE_TYPE (newtype)) == char_type_node
- && TYPE_ARG_TYPES (newtype) == 0
- && self_promoting_args_p (TYPE_ARG_TYPES (oldtype))
- && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (oldtype))) == void_type_node)))
- {
- if (pedantic)
- pedwarn_with_decl (newdecl, "conflicting types for `%s'");
- /* Make sure we keep void * as ret type, not char *. */
- if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (oldtype))) == void_type_node)
- TREE_TYPE (newdecl) = newtype = oldtype;
-
- /* Set DECL_IN_SYSTEM_HEADER, so that if we see another declaration
- we will come back here again. */
- DECL_IN_SYSTEM_HEADER (newdecl) = 1;
- }
- else if (!types_match
- /* Permit char *foo (int, ...); followed by char *foo ();
- if not pedantic. */
- && ! (TREE_CODE (olddecl) == FUNCTION_DECL
- && ! pedantic
- /* Return types must still match. */
- && comptypes (TREE_TYPE (oldtype),
- TREE_TYPE (newtype))
- && TYPE_ARG_TYPES (newtype) == 0))
- {
- error_with_decl (newdecl, "conflicting types for `%s'");
- /* Check for function type mismatch
- involving an empty arglist vs a nonempty one. */
- if (TREE_CODE (olddecl) == FUNCTION_DECL
- && comptypes (TREE_TYPE (oldtype),
- TREE_TYPE (newtype))
- && ((TYPE_ARG_TYPES (oldtype) == 0
- && DECL_INITIAL (olddecl) == 0)
- ||
- (TYPE_ARG_TYPES (newtype) == 0
- && DECL_INITIAL (newdecl) == 0)))
- {
- /* Classify the problem further. */
- register tree t = TYPE_ARG_TYPES (oldtype);
- if (t == 0)
- t = TYPE_ARG_TYPES (newtype);
- for (; t; t = TREE_CHAIN (t))
- {
- register tree type = TREE_VALUE (t);
-
- if (TREE_CHAIN (t) == 0
- && TYPE_MAIN_VARIANT (type) != void_type_node)
- {
- error ("A parameter list with an ellipsis can't match");
- error ("an empty parameter name list declaration.");
- break;
- }
-
- if (TYPE_MAIN_VARIANT (type) == float_type_node
- || C_PROMOTING_INTEGER_TYPE_P (type))
- {
- error ("An argument type that has a default promotion");
- error ("can't match an empty parameter name list declaration.");
- break;
- }
- }
- }
- error_with_decl (olddecl, "previous declaration of `%s'");
- }
- else
- {
- errmsg = redeclaration_error_message (newdecl, olddecl);
- if (errmsg)
- {
- error_with_decl (newdecl, errmsg);
- error_with_decl (olddecl,
- ((DECL_INITIAL (olddecl)
- && current_binding_level == global_binding_level)
- ? "`%s' previously defined here"
- : "`%s' previously declared here"));
- }
- else if (TREE_CODE (newdecl) == TYPE_DECL
- && (DECL_IN_SYSTEM_HEADER (olddecl)
- || DECL_IN_SYSTEM_HEADER (newdecl)))
- {
- warning_with_decl (newdecl, "redefinition of `%s'");
- warning_with_decl
- (olddecl,
- ((DECL_INITIAL (olddecl)
- && current_binding_level == global_binding_level)
- ? "`%s' previously defined here"
- : "`%s' previously declared here"));
- }
- else if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_INITIAL (olddecl) != 0
- && TYPE_ARG_TYPES (oldtype) == 0
- && TYPE_ARG_TYPES (newtype) != 0
- && TYPE_ACTUAL_ARG_TYPES (oldtype) != 0)
- {
- register tree type, parm;
- register int nargs;
- /* Prototype decl follows defn w/o prototype. */
-
- for (parm = TYPE_ACTUAL_ARG_TYPES (oldtype),
- type = TYPE_ARG_TYPES (newtype),
- nargs = 1;
- (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) != void_type_node
- || TYPE_MAIN_VARIANT (TREE_VALUE (type)) != void_type_node);
- parm = TREE_CHAIN (parm), type = TREE_CHAIN (type), nargs++)
- {
- if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == void_type_node
- || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
- {
- errmsg = "prototype for `%s' follows and number of arguments";
- break;
- }
- /* Type for passing arg must be consistent
- with that declared for the arg. */
- if (! comptypes (TREE_VALUE (parm), TREE_VALUE (type))
- /* If -traditional, allow `unsigned int' instead of `int'
- in the prototype. */
- && (! (flag_traditional
- && TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == integer_type_node
- && TYPE_MAIN_VARIANT (TREE_VALUE (type)) == unsigned_type_node)))
- {
- errmsg = "prototype for `%s' follows and argument %d";
- break;
- }
- }
- if (errmsg)
- {
- error_with_decl (newdecl, errmsg, nargs);
- error_with_decl (olddecl,
- "doesn't match non-prototype definition here");
- }
- else
- {
- warning_with_decl (newdecl, "prototype for `%s' follows");
- warning_with_decl (olddecl, "non-prototype definition here");
- }
- }
- /* Warn about mismatches in various flags. */
- else
- {
- /* Warn if function is now inline
- but was previously declared not inline and has been called. */
- if (TREE_CODE (olddecl) == FUNCTION_DECL
- && ! DECL_INLINE (olddecl) && DECL_INLINE (newdecl)
- && TREE_USED (olddecl))
- warning_with_decl (newdecl,
- "`%s' declared inline after being called");
- if (TREE_CODE (olddecl) == FUNCTION_DECL
- && ! DECL_INLINE (olddecl) && DECL_INLINE (newdecl)
- && DECL_INITIAL (olddecl) != 0)
- warning_with_decl (newdecl,
- "`%s' declared inline after its definition");
-
- /* If pedantic, warn when static declaration follows a non-static
- declaration. Otherwise, do so only for functions. */
- if ((pedantic || TREE_CODE (olddecl) == FUNCTION_DECL)
- && TREE_PUBLIC (olddecl)
- && !TREE_PUBLIC (newdecl))
- warning_with_decl (newdecl, "static declaration for `%s' follows non-static");
-
- /* Warn when const declaration follows a non-const
- declaration, but not for functions. */
- if (TREE_CODE (olddecl) != FUNCTION_DECL
- && !TREE_READONLY (olddecl)
- && TREE_READONLY (newdecl))
- warning_with_decl (newdecl, "const declaration for `%s' follows non-const");
- /* These bits are logically part of the type, for variables.
- But not for functions
- (where qualifiers are not valid ANSI anyway). */
- else if (pedantic && TREE_CODE (olddecl) != FUNCTION_DECL
- && (TREE_READONLY (newdecl) != TREE_READONLY (olddecl)
- || TREE_THIS_VOLATILE (newdecl) != TREE_THIS_VOLATILE (olddecl)))
- pedwarn_with_decl (newdecl, "type qualifiers for `%s' conflict with previous decl");
- }
- }
-
- /* Optionally warn about more than one declaration for the same name. */
- if (errmsg == 0 && warn_redundant_decls && DECL_SOURCE_LINE (olddecl) != 0
- /* Dont warn about a function declaration
- followed by a definition. */
- && !(TREE_CODE (newdecl) == FUNCTION_DECL && DECL_INITIAL (newdecl) != 0
- && DECL_INITIAL (olddecl) == 0)
- /* Don't warn about extern decl followed by (tentative) definition. */
- && !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl)))
- {
- warning_with_decl (newdecl, "redundant redeclaration of `%s' in same scope");
- warning_with_decl (olddecl, "previous declaration of `%s'");
- }
-
- /* Copy all the DECL_... slots specified in the new decl
- except for any that we copy here from the old type.
-
- Past this point, we don't change OLDTYPE and NEWTYPE
- even if we change the types of NEWDECL and OLDDECL. */
-
- if (types_match)
- {
- /* When copying info to olddecl, we store into write_olddecl
- instead. This allows us to avoid modifying olddecl when
- different_binding_level is true. */
- tree write_olddecl = different_binding_level ? newdecl : olddecl;
-
- /* Make sure we put the new type in the same obstack as the old ones.
- If the old types are not both in the same obstack, use the permanent
- one. */
- if (TYPE_OBSTACK (oldtype) == TYPE_OBSTACK (newtype))
- push_obstacks (TYPE_OBSTACK (oldtype), TYPE_OBSTACK (oldtype));
- else
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- }
-
- /* Merge the data types specified in the two decls. */
- if (TREE_CODE (newdecl) != FUNCTION_DECL || !DECL_BUILT_IN (olddecl))
- {
- if (different_binding_level)
- TREE_TYPE (newdecl)
- = build_type_attribute_variant
- (newtype,
- merge_attributes (TYPE_ATTRIBUTES (newtype),
- TYPE_ATTRIBUTES (oldtype)));
- else
- TREE_TYPE (newdecl)
- = TREE_TYPE (olddecl)
- = common_type (newtype, oldtype);
- }
-
- /* Lay the type out, unless already done. */
- if (oldtype != TREE_TYPE (newdecl))
- {
- if (TREE_TYPE (newdecl) != error_mark_node)
- layout_type (TREE_TYPE (newdecl));
- if (TREE_CODE (newdecl) != FUNCTION_DECL
- && TREE_CODE (newdecl) != TYPE_DECL
- && TREE_CODE (newdecl) != CONST_DECL)
- layout_decl (newdecl, 0);
- }
- else
- {
- /* Since the type is OLDDECL's, make OLDDECL's size go with. */
- DECL_SIZE (newdecl) = DECL_SIZE (olddecl);
- if (TREE_CODE (olddecl) != FUNCTION_DECL)
- if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl))
- DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl);
- }
-
- /* Keep the old rtl since we can safely use it. */
- DECL_RTL (newdecl) = DECL_RTL (olddecl);
-
- /* Merge the type qualifiers. */
- if (DECL_BUILT_IN_NONANSI (olddecl) && TREE_THIS_VOLATILE (olddecl)
- && !TREE_THIS_VOLATILE (newdecl))
- TREE_THIS_VOLATILE (write_olddecl) = 0;
- if (TREE_READONLY (newdecl))
- TREE_READONLY (write_olddecl) = 1;
- if (TREE_THIS_VOLATILE (newdecl))
- {
- TREE_THIS_VOLATILE (write_olddecl) = 1;
- if (TREE_CODE (newdecl) == VAR_DECL)
- make_var_volatile (newdecl);
- }
-
- /* Keep source location of definition rather than declaration. */
- /* When called with different_binding_level set, keep the old
- information so that meaningful diagnostics can be given. */
- if (DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0
- && ! different_binding_level)
- {
- DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl);
- DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl);
- }
-
- /* Merge the unused-warning information. */
- if (DECL_IN_SYSTEM_HEADER (olddecl))
- DECL_IN_SYSTEM_HEADER (newdecl) = 1;
- else if (DECL_IN_SYSTEM_HEADER (newdecl))
- DECL_IN_SYSTEM_HEADER (write_olddecl) = 1;
-
- /* Merge the initialization information. */
- /* When called with different_binding_level set, don't copy over
- DECL_INITIAL, so that we don't accidentally change function
- declarations into function definitions. */
- if (DECL_INITIAL (newdecl) == 0 && ! different_binding_level)
- DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
-
- /* Merge the section attribute.
- We want to issue an error if the sections conflict but that must be
- done later in decl_attributes since we are called before attributes
- are assigned. */
- if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
- DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
-
- if (TREE_CODE (newdecl) == FUNCTION_DECL)
- {
- DECL_STATIC_CONSTRUCTOR(newdecl) |= DECL_STATIC_CONSTRUCTOR(olddecl);
- DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
- }
-
- pop_obstacks ();
- }
- /* If cannot merge, then use the new type and qualifiers,
- and don't preserve the old rtl. */
- else if (! different_binding_level)
- {
- TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
- TREE_READONLY (olddecl) = TREE_READONLY (newdecl);
- TREE_THIS_VOLATILE (olddecl) = TREE_THIS_VOLATILE (newdecl);
- TREE_SIDE_EFFECTS (olddecl) = TREE_SIDE_EFFECTS (newdecl);
- }
-
- /* Merge the storage class information. */
- DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
- /* For functions, static overrides non-static. */
- if (TREE_CODE (newdecl) == FUNCTION_DECL)
- {
- TREE_PUBLIC (newdecl) &= TREE_PUBLIC (olddecl);
- /* This is since we don't automatically
- copy the attributes of NEWDECL into OLDDECL. */
- /* No need to worry about different_binding_level here because
- then TREE_PUBLIC (newdecl) was true. */
- TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl);
- /* If this clears `static', clear it in the identifier too. */
- if (! TREE_PUBLIC (olddecl))
- TREE_PUBLIC (DECL_NAME (olddecl)) = 0;
- }
- if (DECL_EXTERNAL (newdecl))
- {
- TREE_STATIC (newdecl) = TREE_STATIC (olddecl);
- DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl);
- /* An extern decl does not override previous storage class. */
- TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
- if (! DECL_EXTERNAL (newdecl))
- DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl);
- }
- else
- {
- TREE_STATIC (olddecl) = TREE_STATIC (newdecl);
- TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl);
- }
-
- /* If either decl says `inline', this fn is inline,
- unless its definition was passed already. */
- if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == 0)
- DECL_INLINE (olddecl) = 1;
- DECL_INLINE (newdecl) = DECL_INLINE (olddecl);
-
- if (TREE_CODE (newdecl) == FUNCTION_DECL)
- {
- if (DECL_BUILT_IN (olddecl))
- {
- /* Get rid of any built-in function if new arg types don't match it
- or if we have a function definition. */
- if (! types_match || new_is_definition)
- {
- if (! different_binding_level)
- {
- TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
- DECL_BUILT_IN (olddecl) = 0;
- }
- }
- else
- {
- /* If redeclaring a builtin function, and not a definition,
- it stays built in. */
- DECL_BUILT_IN (newdecl) = 1;
- DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
- }
- }
- /* Also preserve various other info from the definition. */
- else if (! new_is_definition)
- DECL_FRAME_SIZE (newdecl) = DECL_FRAME_SIZE (olddecl);
- if (! new_is_definition)
- {
- DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
- /* When called with different_binding_level set, don't copy over
- DECL_INITIAL, so that we don't accidentally change function
- declarations into function definitions. */
- if (! different_binding_level)
- DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
- DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl);
- DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
- }
- }
- if (different_binding_level)
- {
- /* Don't output a duplicate symbol for this declaration. */
- TREE_ASM_WRITTEN (newdecl) = 1;
- return 0;
- }
-
- /* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
- But preserve OLDdECL's DECL_UID. */
- {
- register unsigned olddecl_uid = DECL_UID (olddecl);
-
- bcopy ((char *) newdecl + sizeof (struct tree_common),
- (char *) olddecl + sizeof (struct tree_common),
- sizeof (struct tree_decl) - sizeof (struct tree_common));
- DECL_UID (olddecl) = olddecl_uid;
- }
-
- return 1;
-}
-
-/* Record a decl-node X as belonging to the current lexical scope.
- Check for errors (such as an incompatible declaration for the same
- name already seen in the same scope).
-
- Returns either X or an old decl for the same name.
- If an old decl is returned, it may have been smashed
- to agree with what X says. */
-
-tree
-pushdecl (x)
- tree x;
-{
- register tree t;
- register tree name = DECL_NAME (x);
- register struct binding_level *b = current_binding_level;
-
- DECL_CONTEXT (x) = current_function_decl;
- /* A local extern declaration for a function doesn't constitute nesting.
- A local auto declaration does, since it's a forward decl
- for a nested function coming later. */
- if (TREE_CODE (x) == FUNCTION_DECL && DECL_INITIAL (x) == 0
- && DECL_EXTERNAL (x))
- DECL_CONTEXT (x) = 0;
-
- if (warn_nested_externs && DECL_EXTERNAL (x) && b != global_binding_level
- && x != IDENTIFIER_IMPLICIT_DECL (name)
- /* Don't print error messages for __FUNCTION__ and __PRETTY_FUNCTION__ */
- && !DECL_IN_SYSTEM_HEADER (x))
- warning ("nested extern declaration of `%s'", IDENTIFIER_POINTER (name));
-
- if (name)
- {
- char *file;
- int line;
- int different_binding_level = 0;
-
- t = lookup_name_current_level (name);
- /* Don't type check externs here when -traditional. This is so that
- code with conflicting declarations inside blocks will get warnings
- not errors. X11 for instance depends on this. */
- if (! t && DECL_EXTERNAL (x) && TREE_PUBLIC (x) && ! flag_traditional)
- {
- t = IDENTIFIER_GLOBAL_VALUE (name);
- /* Type decls at global scope don't conflict with externs declared
- inside lexical blocks. */
- if (t && TREE_CODE (t) == TYPE_DECL)
- t = 0;
- different_binding_level = 1;
- }
- if (t != 0 && t == error_mark_node)
- /* error_mark_node is 0 for a while during initialization! */
- {
- t = 0;
- error_with_decl (x, "`%s' used prior to declaration");
- }
-
- if (t != 0)
- {
- file = DECL_SOURCE_FILE (t);
- line = DECL_SOURCE_LINE (t);
- }
-
- /* If this decl is `static' and an implicit decl was seen previously,
- warn. But don't complain if -traditional,
- since traditional compilers don't complain. */
- if (! flag_traditional && TREE_PUBLIC (name)
- /* Don't test for DECL_EXTERNAL, because grokdeclarator
- sets this for all functions. */
- && ! TREE_PUBLIC (x)
- && (TREE_CODE (x) == FUNCTION_DECL || b == global_binding_level)
- /* We used to warn also for explicit extern followed by static,
- but sometimes you need to do it that way. */
- && IDENTIFIER_IMPLICIT_DECL (name) != 0)
- {
- pedwarn ("`%s' was declared implicitly `extern' and later `static'",
- IDENTIFIER_POINTER (name));
- pedwarn_with_file_and_line
- (DECL_SOURCE_FILE (IDENTIFIER_IMPLICIT_DECL (name)),
- DECL_SOURCE_LINE (IDENTIFIER_IMPLICIT_DECL (name)),
- "previous declaration of `%s'",
- IDENTIFIER_POINTER (name));
- }
-
- if (t != 0 && duplicate_decls (x, t, different_binding_level))
- {
- if (TREE_CODE (t) == PARM_DECL)
- {
- /* Don't allow more than one "real" duplicate
- of a forward parm decl. */
- TREE_ASM_WRITTEN (t) = TREE_ASM_WRITTEN (x);
- return t;
- }
- return t;
- }
-
- /* If we are processing a typedef statement, generate a whole new
- ..._TYPE node (which will be just an variant of the existing
- ..._TYPE node with identical properties) and then install the
- TYPE_DECL node generated to represent the typedef name as the
- TYPE_NAME of this brand new (duplicate) ..._TYPE node.
-
- The whole point here is to end up with a situation where each
- and every ..._TYPE node the compiler creates will be uniquely
- associated with AT MOST one node representing a typedef name.
- This way, even though the compiler substitutes corresponding
- ..._TYPE nodes for TYPE_DECL (i.e. "typedef name") nodes very
- early on, later parts of the compiler can always do the reverse
- translation and get back the corresponding typedef name. For
- example, given:
-
- typedef struct S MY_TYPE;
- MY_TYPE object;
-
- Later parts of the compiler might only know that `object' was of
- type `struct S' if if were not for code just below. With this
- code however, later parts of the compiler see something like:
-
- struct S' == struct S
- typedef struct S' MY_TYPE;
- struct S' object;
-
- And they can then deduce (from the node for type struct S') that
- the original object declaration was:
-
- MY_TYPE object;
-
- Being able to do this is important for proper support of protoize,
- and also for generating precise symbolic debugging information
- which takes full account of the programmer's (typedef) vocabulary.
-
- Obviously, we don't want to generate a duplicate ..._TYPE node if
- the TYPE_DECL node that we are now processing really represents a
- standard built-in type.
-
- Since all standard types are effectively declared at line zero
- in the source file, we can easily check to see if we are working
- on a standard type by checking the current value of lineno. */
-
- if (TREE_CODE (x) == TYPE_DECL)
- {
- if (DECL_SOURCE_LINE (x) == 0)
- {
- if (TYPE_NAME (TREE_TYPE (x)) == 0)
- TYPE_NAME (TREE_TYPE (x)) = x;
- }
- else if (TREE_TYPE (x) != error_mark_node)
- {
- tree tt = TREE_TYPE (x);
- DECL_ORIGINAL_TYPE (x) = tt;
- tt = build_type_copy (tt);
- TYPE_NAME (tt) = x;
- TREE_TYPE (x) = tt;
- }
- }
-
- /* Multiple external decls of the same identifier ought to match.
- Check against both global declarations (when traditional) and out of
- scope (limbo) block level declarations.
-
- We get warnings about inline functions where they are defined.
- Avoid duplicate warnings where they are used. */
- if (TREE_PUBLIC (x) && ! DECL_INLINE (x))
- {
- tree decl;
-
- if (flag_traditional && IDENTIFIER_GLOBAL_VALUE (name) != 0
- && (DECL_EXTERNAL (IDENTIFIER_GLOBAL_VALUE (name))
- || TREE_PUBLIC (IDENTIFIER_GLOBAL_VALUE (name))))
- decl = IDENTIFIER_GLOBAL_VALUE (name);
- else if (IDENTIFIER_LIMBO_VALUE (name) != 0)
- /* Decls in limbo are always extern, so no need to check that. */
- decl = IDENTIFIER_LIMBO_VALUE (name);
- else
- decl = 0;
-
- if (decl && ! comptypes (TREE_TYPE (x), TREE_TYPE (decl))
- /* If old decl is built-in, we already warned if we should. */
- && !DECL_BUILT_IN (decl))
- {
- pedwarn_with_decl (x,
- "type mismatch with previous external decl");
- pedwarn_with_decl (decl, "previous external decl of `%s'");
- }
- }
-
- /* If a function has had an implicit declaration, and then is defined,
- make sure they are compatible. */
-
- if (IDENTIFIER_IMPLICIT_DECL (name) != 0
- && IDENTIFIER_GLOBAL_VALUE (name) == 0
- && TREE_CODE (x) == FUNCTION_DECL
- && ! comptypes (TREE_TYPE (x),
- TREE_TYPE (IDENTIFIER_IMPLICIT_DECL (name))))
- {
- warning_with_decl (x, "type mismatch with previous implicit declaration");
- warning_with_decl (IDENTIFIER_IMPLICIT_DECL (name),
- "previous implicit declaration of `%s'");
- }
-
- /* In PCC-compatibility mode, extern decls of vars with no current decl
- take effect at top level no matter where they are. */
- if (flag_traditional && DECL_EXTERNAL (x)
- && lookup_name (name) == 0)
- {
- tree type = TREE_TYPE (x);
-
- /* But don't do this if the type contains temporary nodes. */
- while (type)
- {
- if (type == error_mark_node)
- break;
- if (! TREE_PERMANENT (type))
- {
- warning_with_decl (x, "type of external `%s' is not global");
- /* By exiting the loop early, we leave TYPE nonzero,
- and thus prevent globalization of the decl. */
- break;
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE
- && TYPE_ARG_TYPES (type) != 0)
- /* The types might not be truly local,
- but the list of arg types certainly is temporary.
- Since prototypes are nontraditional,
- ok not to do the traditional thing. */
- break;
- type = TREE_TYPE (type);
- }
-
- if (type == 0)
- b = global_binding_level;
- }
-
- /* This name is new in its binding level.
- Install the new declaration and return it. */
- if (b == global_binding_level)
- {
- /* Install a global value. */
-
- /* If the first global decl has external linkage,
- warn if we later see static one. */
- if (IDENTIFIER_GLOBAL_VALUE (name) == 0 && TREE_PUBLIC (x))
- TREE_PUBLIC (name) = 1;
-
- IDENTIFIER_GLOBAL_VALUE (name) = x;
-
- /* We no longer care about any previous block level declarations. */
- IDENTIFIER_LIMBO_VALUE (name) = 0;
-
- /* Don't forget if the function was used via an implicit decl. */
- if (IDENTIFIER_IMPLICIT_DECL (name)
- && TREE_USED (IDENTIFIER_IMPLICIT_DECL (name)))
- TREE_USED (x) = 1, TREE_USED (name) = 1;
-
- /* Don't forget if its address was taken in that way. */
- if (IDENTIFIER_IMPLICIT_DECL (name)
- && TREE_ADDRESSABLE (IDENTIFIER_IMPLICIT_DECL (name)))
- TREE_ADDRESSABLE (x) = 1;
-
- /* Warn about mismatches against previous implicit decl. */
- if (IDENTIFIER_IMPLICIT_DECL (name) != 0
- /* If this real decl matches the implicit, don't complain. */
- && ! (TREE_CODE (x) == FUNCTION_DECL
- && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (x)))
- == integer_type_node)))
- pedwarn ("`%s' was previously implicitly declared to return `int'",
- IDENTIFIER_POINTER (name));
-
- /* If this decl is `static' and an `extern' was seen previously,
- that is erroneous. */
- if (TREE_PUBLIC (name)
- && ! TREE_PUBLIC (x) && ! DECL_EXTERNAL (x))
- {
- /* Okay to redeclare an ANSI built-in as static. */
- if (t != 0 && DECL_BUILT_IN (t))
- ;
- /* Okay to declare a non-ANSI built-in as anything. */
- else if (t != 0 && DECL_BUILT_IN_NONANSI (t))
- ;
- /* Okay to have global type decl after an earlier extern
- declaration inside a lexical block. */
- else if (TREE_CODE (x) == TYPE_DECL)
- ;
- else if (IDENTIFIER_IMPLICIT_DECL (name))
- pedwarn ("`%s' was declared implicitly `extern' and later `static'",
- IDENTIFIER_POINTER (name));
- else
- pedwarn ("`%s' was declared `extern' and later `static'",
- IDENTIFIER_POINTER (name));
- }
- }
- else
- {
- /* Here to install a non-global value. */
- tree oldlocal = IDENTIFIER_LOCAL_VALUE (name);
- tree oldglobal = IDENTIFIER_GLOBAL_VALUE (name);
- IDENTIFIER_LOCAL_VALUE (name) = x;
-
- /* If this is an extern function declaration, see if we
- have a global definition or declaration for the function. */
- if (oldlocal == 0
- && DECL_EXTERNAL (x) && !DECL_INLINE (x)
- && oldglobal != 0
- && TREE_CODE (x) == FUNCTION_DECL
- && TREE_CODE (oldglobal) == FUNCTION_DECL)
- {
- /* We have one. Their types must agree. */
- if (! comptypes (TREE_TYPE (x),
- TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (name))))
- pedwarn_with_decl (x, "extern declaration of `%s' doesn't match global one");
- else
- {
- /* Inner extern decl is inline if global one is.
- Copy enough to really inline it. */
- if (DECL_INLINE (oldglobal))
- {
- DECL_INLINE (x) = DECL_INLINE (oldglobal);
- DECL_INITIAL (x) = (current_function_decl == oldglobal
- ? 0 : DECL_INITIAL (oldglobal));
- DECL_SAVED_INSNS (x) = DECL_SAVED_INSNS (oldglobal);
- DECL_FRAME_SIZE (x) = DECL_FRAME_SIZE (oldglobal);
- DECL_ARGUMENTS (x) = DECL_ARGUMENTS (oldglobal);
- DECL_RESULT (x) = DECL_RESULT (oldglobal);
- TREE_ASM_WRITTEN (x) = TREE_ASM_WRITTEN (oldglobal);
- DECL_ABSTRACT_ORIGIN (x) = oldglobal;
- }
- /* Inner extern decl is built-in if global one is. */
- if (DECL_BUILT_IN (oldglobal))
- {
- DECL_BUILT_IN (x) = DECL_BUILT_IN (oldglobal);
- DECL_FUNCTION_CODE (x) = DECL_FUNCTION_CODE (oldglobal);
- }
- /* Keep the arg types from a file-scope fcn defn. */
- if (TYPE_ARG_TYPES (TREE_TYPE (oldglobal)) != 0
- && DECL_INITIAL (oldglobal)
- && TYPE_ARG_TYPES (TREE_TYPE (x)) == 0)
- TREE_TYPE (x) = TREE_TYPE (oldglobal);
- }
- }
-
-#if 0 /* This case is probably sometimes the right thing to do. */
- /* If we have a local external declaration,
- then any file-scope declaration should not
- have been static. */
- if (oldlocal == 0 && oldglobal != 0
- && !TREE_PUBLIC (oldglobal)
- && DECL_EXTERNAL (x) && TREE_PUBLIC (x))
- warning ("`%s' locally external but globally static",
- IDENTIFIER_POINTER (name));
-#endif
-
- /* If we have a local external declaration,
- and no file-scope declaration has yet been seen,
- then if we later have a file-scope decl it must not be static. */
- if (oldlocal == 0
- && DECL_EXTERNAL (x)
- && TREE_PUBLIC (x))
- {
- if (oldglobal == 0)
- TREE_PUBLIC (name) = 1;
-
- /* Save this decl, so that we can do type checking against
- other decls after it falls out of scope.
-
- Only save it once. This prevents temporary decls created in
- expand_inline_function from being used here, since this
- will have been set when the inline function was parsed.
- It also helps give slightly better warnings. */
- if (IDENTIFIER_LIMBO_VALUE (name) == 0)
- IDENTIFIER_LIMBO_VALUE (name) = x;
- }
-
- /* Warn if shadowing an argument at the top level of the body. */
- if (oldlocal != 0 && !DECL_EXTERNAL (x)
- /* This warning doesn't apply to the parms of a nested fcn. */
- && ! current_binding_level->parm_flag
- /* Check that this is one level down from the parms. */
- && current_binding_level->level_chain->parm_flag
- /* Check that the decl being shadowed
- comes from the parm level, one level up. */
- && chain_member (oldlocal, current_binding_level->level_chain->names))
- {
- if (TREE_CODE (oldlocal) == PARM_DECL)
- pedwarn ("declaration of `%s' shadows a parameter",
- IDENTIFIER_POINTER (name));
- else
- pedwarn ("declaration of `%s' shadows a symbol from the parameter list",
- IDENTIFIER_POINTER (name));
- }
-
- /* Maybe warn if shadowing something else. */
- else if (warn_shadow && !DECL_EXTERNAL (x)
- /* No shadow warnings for internally generated vars. */
- && DECL_SOURCE_LINE (x) != 0
- /* No shadow warnings for vars made for inlining. */
- && ! DECL_FROM_INLINE (x))
- {
- char *warnstring = 0;
-
- if (TREE_CODE (x) == PARM_DECL
- && current_binding_level->level_chain->parm_flag)
- /* Don't warn about the parm names in function declarator
- within a function declarator.
- It would be nice to avoid warning in any function
- declarator in a declaration, as opposed to a definition,
- but there is no way to tell it's not a definition. */
- ;
- else if (oldlocal != 0 && TREE_CODE (oldlocal) == PARM_DECL)
- warnstring = "declaration of `%s' shadows a parameter";
- else if (oldlocal != 0)
- warnstring = "declaration of `%s' shadows previous local";
- else if (IDENTIFIER_GLOBAL_VALUE (name) != 0
- && IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node)
- warnstring = "declaration of `%s' shadows global declaration";
-
- if (warnstring)
- warning (warnstring, IDENTIFIER_POINTER (name));
- }
-
- /* If storing a local value, there may already be one (inherited).
- If so, record it for restoration when this binding level ends. */
- if (oldlocal != 0)
- b->shadowed = tree_cons (name, oldlocal, b->shadowed);
- }
-
- /* Keep count of variables in this level with incomplete type. */
- if (TYPE_SIZE (TREE_TYPE (x)) == 0)
- ++b->n_incomplete;
- }
-
- /* Put decls on list in reverse order.
- We will reverse them later if necessary. */
- TREE_CHAIN (x) = b->names;
- b->names = x;
-
- return x;
-}
-
-/* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL, if appropriate. */
-
-tree
-pushdecl_top_level (x)
- tree x;
-{
- register tree t;
- register struct binding_level *b = current_binding_level;
-
- current_binding_level = global_binding_level;
- t = pushdecl (x);
- current_binding_level = b;
- return t;
-}
-
-/* Generate an implicit declaration for identifier FUNCTIONID
- as a function of type int (). Print a warning if appropriate. */
-
-tree
-implicitly_declare (functionid)
- tree functionid;
-{
- register tree decl;
- int traditional_warning = 0;
- /* Only one "implicit declaration" warning per identifier. */
- int implicit_warning;
-
- /* Save the decl permanently so we can warn if definition follows. */
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- /* We used to reuse an old implicit decl here,
- but this loses with inline functions because it can clobber
- the saved decl chains. */
-/* if (IDENTIFIER_IMPLICIT_DECL (functionid) != 0)
- decl = IDENTIFIER_IMPLICIT_DECL (functionid);
- else */
- decl = build_decl (FUNCTION_DECL, functionid, default_function_type);
-
- /* Warn of implicit decl following explicit local extern decl.
- This is probably a program designed for traditional C. */
- if (TREE_PUBLIC (functionid) && IDENTIFIER_GLOBAL_VALUE (functionid) == 0)
- traditional_warning = 1;
-
- /* Warn once of an implicit declaration. */
- implicit_warning = (IDENTIFIER_IMPLICIT_DECL (functionid) == 0);
-
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- DECL_ARTIFICIAL (decl);
-
- /* Record that we have an implicit decl and this is it. */
- IDENTIFIER_IMPLICIT_DECL (functionid) = decl;
-
- /* ANSI standard says implicit declarations are in the innermost block.
- So we record the decl in the standard fashion.
- If flag_traditional is set, pushdecl does it top-level. */
- pushdecl (decl);
-
- /* This is a no-op in c-lang.c or something real in objc-actions.c. */
- maybe_objc_check_decl (decl);
-
- rest_of_decl_compilation (decl, NULL_PTR, 0, 0);
-
- if (warn_implicit && implicit_warning)
- warning ("implicit declaration of function `%s'",
- IDENTIFIER_POINTER (functionid));
- else if (warn_traditional && traditional_warning)
- warning ("function `%s' was previously declared within a block",
- IDENTIFIER_POINTER (functionid));
-
- /* Write a record describing this implicit function declaration to the
- prototypes file (if requested). */
-
- gen_aux_info_record (decl, 0, 1, 0);
-
- pop_obstacks ();
-
- return decl;
-}
-
-/* Return zero if the declaration NEWDECL is valid
- when the declaration OLDDECL (assumed to be for the same name)
- has already been seen.
- Otherwise return an error message format string with a %s
- where the identifier should go. */
-
-static char *
-redeclaration_error_message (newdecl, olddecl)
- tree newdecl, olddecl;
-{
- if (TREE_CODE (newdecl) == TYPE_DECL)
- {
- if (flag_traditional && TREE_TYPE (newdecl) == TREE_TYPE (olddecl))
- return 0;
- /* pushdecl creates distinct types for TYPE_DECLs by calling
- build_type_copy, so the above comparison generally fails. We do
- another test against the TYPE_MAIN_VARIANT of the olddecl, which
- is equivalent to what this code used to do before the build_type_copy
- call. The variant type distinction should not matter for traditional
- code, because it doesn't have type qualifiers. */
- if (flag_traditional
- && TYPE_MAIN_VARIANT (TREE_TYPE (olddecl)) == TREE_TYPE (newdecl))
- return 0;
- if (DECL_IN_SYSTEM_HEADER (olddecl) || DECL_IN_SYSTEM_HEADER (newdecl))
- return 0;
- return "redefinition of `%s'";
- }
- else if (TREE_CODE (newdecl) == FUNCTION_DECL)
- {
- /* Declarations of functions can insist on internal linkage
- but they can't be inconsistent with internal linkage,
- so there can be no error on that account.
- However defining the same name twice is no good. */
- if (DECL_INITIAL (olddecl) != 0 && DECL_INITIAL (newdecl) != 0
- /* However, defining once as extern inline and a second
- time in another way is ok. */
- && !(DECL_INLINE (olddecl) && DECL_EXTERNAL (olddecl)
- && !(DECL_INLINE (newdecl) && DECL_EXTERNAL (newdecl))))
- return "redefinition of `%s'";
- return 0;
- }
- else if (current_binding_level == global_binding_level)
- {
- /* Objects declared at top level: */
- /* If at least one is a reference, it's ok. */
- if (DECL_EXTERNAL (newdecl) || DECL_EXTERNAL (olddecl))
- return 0;
- /* Reject two definitions. */
- if (DECL_INITIAL (olddecl) != 0 && DECL_INITIAL (newdecl) != 0)
- return "redefinition of `%s'";
- /* Now we have two tentative defs, or one tentative and one real def. */
- /* Insist that the linkage match. */
- if (TREE_PUBLIC (olddecl) != TREE_PUBLIC (newdecl))
- return "conflicting declarations of `%s'";
- return 0;
- }
- else if (current_binding_level->parm_flag
- && TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl))
- return 0;
- else
- {
- /* Newdecl has block scope. If olddecl has block scope also, then
- reject two definitions, and reject a definition together with an
- external reference. Otherwise, it is OK, because newdecl must
- be an extern reference to olddecl. */
- if (!(DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl))
- && DECL_CONTEXT (newdecl) == DECL_CONTEXT (olddecl))
- return "redeclaration of `%s'";
- return 0;
- }
-}
-
-/* Get the LABEL_DECL corresponding to identifier ID as a label.
- Create one if none exists so far for the current function.
- This function is called for both label definitions and label references. */
-
-tree
-lookup_label (id)
- tree id;
-{
- register tree decl = IDENTIFIER_LABEL_VALUE (id);
-
- if (current_function_decl == 0)
- {
- error ("label %s referenced outside of any function",
- IDENTIFIER_POINTER (id));
- return 0;
- }
-
- /* Use a label already defined or ref'd with this name. */
- if (decl != 0)
- {
- /* But not if it is inherited and wasn't declared to be inheritable. */
- if (DECL_CONTEXT (decl) != current_function_decl
- && ! C_DECLARED_LABEL_FLAG (decl))
- return shadow_label (id);
- return decl;
- }
-
- decl = build_decl (LABEL_DECL, id, void_type_node);
-
- /* Make sure every label has an rtx. */
- label_rtx (decl);
-
- /* A label not explicitly declared must be local to where it's ref'd. */
- DECL_CONTEXT (decl) = current_function_decl;
-
- DECL_MODE (decl) = VOIDmode;
-
- /* Say where one reference is to the label,
- for the sake of the error if it is not defined. */
- DECL_SOURCE_LINE (decl) = lineno;
- DECL_SOURCE_FILE (decl) = input_filename;
-
- IDENTIFIER_LABEL_VALUE (id) = decl;
-
- named_labels = tree_cons (NULL_TREE, decl, named_labels);
-
- return decl;
-}
-
-/* Make a label named NAME in the current function,
- shadowing silently any that may be inherited from containing functions
- or containing scopes.
-
- Note that valid use, if the label being shadowed
- comes from another scope in the same function,
- requires calling declare_nonlocal_label right away. */
-
-tree
-shadow_label (name)
- tree name;
-{
- register tree decl = IDENTIFIER_LABEL_VALUE (name);
-
- if (decl != 0)
- {
- register tree dup;
-
- /* Check to make sure that the label hasn't already been declared
- at this label scope */
- for (dup = named_labels; dup; dup = TREE_CHAIN (dup))
- if (TREE_VALUE (dup) == decl)
- {
- error ("duplicate label declaration `%s'",
- IDENTIFIER_POINTER (name));
- error_with_decl (TREE_VALUE (dup),
- "this is a previous declaration");
- /* Just use the previous declaration. */
- return lookup_label (name);
- }
-
- shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
- IDENTIFIER_LABEL_VALUE (name) = decl = 0;
- }
-
- return lookup_label (name);
-}
-
-/* Define a label, specifying the location in the source file.
- Return the LABEL_DECL node for the label, if the definition is valid.
- Otherwise return 0. */
-
-tree
-define_label (filename, line, name)
- char *filename;
- int line;
- tree name;
-{
- tree decl = lookup_label (name);
-
- /* If label with this name is known from an outer context, shadow it. */
- if (decl != 0 && DECL_CONTEXT (decl) != current_function_decl)
- {
- shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
- IDENTIFIER_LABEL_VALUE (name) = 0;
- decl = lookup_label (name);
- }
-
- if (DECL_INITIAL (decl) != 0)
- {
- error ("duplicate label `%s'", IDENTIFIER_POINTER (name));
- return 0;
- }
- else
- {
- /* Mark label as having been defined. */
- DECL_INITIAL (decl) = error_mark_node;
- /* Say where in the source. */
- DECL_SOURCE_FILE (decl) = filename;
- DECL_SOURCE_LINE (decl) = line;
- return decl;
- }
-}
-
-/* Return the list of declarations of the current level.
- Note that this list is in reverse order unless/until
- you nreverse it; and when you do nreverse it, you must
- store the result back using `storedecls' or you will lose. */
-
-tree
-getdecls ()
-{
- return current_binding_level->names;
-}
-
-/* Return the list of type-tags (for structs, etc) of the current level. */
-
-tree
-gettags ()
-{
- return current_binding_level->tags;
-}
-
-/* Store the list of declarations of the current level.
- This is done for the parameter declarations of a function being defined,
- after they are modified in the light of any missing parameters. */
-
-static void
-storedecls (decls)
- tree decls;
-{
- current_binding_level->names = decls;
-}
-
-/* Similarly, store the list of tags of the current level. */
-
-static void
-storetags (tags)
- tree tags;
-{
- current_binding_level->tags = tags;
-}
-
-/* Given NAME, an IDENTIFIER_NODE,
- return the structure (or union or enum) definition for that name.
- Searches binding levels from BINDING_LEVEL up to the global level.
- If THISLEVEL_ONLY is nonzero, searches only the specified context
- (but skips any tag-transparent contexts to find one that is
- meaningful for tags).
- CODE says which kind of type the caller wants;
- it is RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE.
- If the wrong kind of type is found, an error is reported. */
-
-static tree
-lookup_tag (code, name, binding_level, thislevel_only)
- enum tree_code code;
- struct binding_level *binding_level;
- tree name;
- int thislevel_only;
-{
- register struct binding_level *level;
-
- for (level = binding_level; level; level = level->level_chain)
- {
- register tree tail;
- for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
- {
- if (TREE_PURPOSE (tail) == name)
- {
- if (TREE_CODE (TREE_VALUE (tail)) != code)
- {
- /* Definition isn't the kind we were looking for. */
- pending_invalid_xref = name;
- pending_invalid_xref_file = input_filename;
- pending_invalid_xref_line = lineno;
- }
- return TREE_VALUE (tail);
- }
- }
- if (thislevel_only && ! level->tag_transparent)
- return NULL_TREE;
- }
- return NULL_TREE;
-}
-
-/* Print an error message now
- for a recent invalid struct, union or enum cross reference.
- We don't print them immediately because they are not invalid
- when used in the `struct foo;' construct for shadowing. */
-
-void
-pending_xref_error ()
-{
- if (pending_invalid_xref != 0)
- error_with_file_and_line (pending_invalid_xref_file,
- pending_invalid_xref_line,
- "`%s' defined as wrong kind of tag",
- IDENTIFIER_POINTER (pending_invalid_xref));
- pending_invalid_xref = 0;
-}
-
-/* Given a type, find the tag that was defined for it and return the tag name.
- Otherwise return 0. */
-
-static tree
-lookup_tag_reverse (type)
- tree type;
-{
- register struct binding_level *level;
-
- for (level = current_binding_level; level; level = level->level_chain)
- {
- register tree tail;
- for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
- {
- if (TREE_VALUE (tail) == type)
- return TREE_PURPOSE (tail);
- }
- }
- return NULL_TREE;
-}
-
-/* Look up NAME in the current binding level and its superiors
- in the namespace of variables, functions and typedefs.
- Return a ..._DECL node of some kind representing its definition,
- or return 0 if it is undefined. */
-
-tree
-lookup_name (name)
- tree name;
-{
- register tree val;
- if (current_binding_level != global_binding_level
- && IDENTIFIER_LOCAL_VALUE (name))
- val = IDENTIFIER_LOCAL_VALUE (name);
- else
- val = IDENTIFIER_GLOBAL_VALUE (name);
- return val;
-}
-
-/* Similar to `lookup_name' but look only at current binding level. */
-
-tree
-lookup_name_current_level (name)
- tree name;
-{
- register tree t;
-
- if (current_binding_level == global_binding_level)
- return IDENTIFIER_GLOBAL_VALUE (name);
-
- if (IDENTIFIER_LOCAL_VALUE (name) == 0)
- return 0;
-
- for (t = current_binding_level->names; t; t = TREE_CHAIN (t))
- if (DECL_NAME (t) == name)
- break;
-
- return t;
-}
-
-/* Create the predefined scalar types of C,
- and some nodes representing standard constants (0, 1, (void *) 0).
- Initialize the global binding level.
- Make definitions for built-in primitive functions. */
-
-void
-init_decl_processing ()
-{
- register tree endlink;
- /* Either char* or void*. */
- tree traditional_ptr_type_node;
- /* Data types of memcpy and strlen. */
- tree memcpy_ftype, memset_ftype, strlen_ftype;
- tree void_ftype_any;
- int wchar_type_size;
- tree temp;
- tree array_domain_type;
-
- current_function_decl = NULL;
- named_labels = NULL;
- current_binding_level = NULL_BINDING_LEVEL;
- free_binding_level = NULL_BINDING_LEVEL;
- pushlevel (0); /* make the binding_level structure for global names */
- global_binding_level = current_binding_level;
-
- /* Define `int' and `char' first so that dbx will output them first. */
-
- integer_type_node = make_signed_type (INT_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_INT],
- integer_type_node));
-
- /* Define `char', which is like either `signed char' or `unsigned char'
- but not the same as either. */
-
- char_type_node
- = (flag_signed_char
- ? make_signed_type (CHAR_TYPE_SIZE)
- : make_unsigned_type (CHAR_TYPE_SIZE));
- pushdecl (build_decl (TYPE_DECL, get_identifier ("char"),
- char_type_node));
-
- long_integer_type_node = make_signed_type (LONG_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("long int"),
- long_integer_type_node));
-
- unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"),
- unsigned_type_node));
-
- long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("long unsigned int"),
- long_unsigned_type_node));
-
- long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("long long int"),
- long_long_integer_type_node));
-
- long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"),
- long_long_unsigned_type_node));
-
- short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("short int"),
- short_integer_type_node));
-
- short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("short unsigned int"),
- short_unsigned_type_node));
-
- /* `unsigned long' is the standard type for sizeof.
- Traditionally, use a signed type.
- Note that stddef.h uses `unsigned long',
- and this must agree, even of long and int are the same size. */
- sizetype
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)));
- if (flag_traditional && TREE_UNSIGNED (sizetype))
- sizetype = signed_type (sizetype);
-
- ptrdiff_type_node
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
-
- TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (char_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (unsigned_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_unsigned_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_long_integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_long_unsigned_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (short_integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (short_unsigned_type_node)) = sizetype;
-
- error_mark_node = make_node (ERROR_MARK);
- TREE_TYPE (error_mark_node) = error_mark_node;
-
- /* Define both `signed char' and `unsigned char'. */
- signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("signed char"),
- signed_char_type_node));
-
- unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned char"),
- unsigned_char_type_node));
-
- intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
-
- intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node));
-
- intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node));
-
- intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node));
-
- unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node));
-
- unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node));
-
- unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node));
-
- unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node));
-
- float_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE;
- pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_FLOAT],
- float_type_node));
- layout_type (float_type_node);
-
- double_type_node = make_node (REAL_TYPE);
- if (flag_short_double)
- TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE;
- else
- TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE;
- pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_DOUBLE],
- double_type_node));
- layout_type (double_type_node);
-
- long_double_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE;
- pushdecl (build_decl (TYPE_DECL, get_identifier ("long double"),
- long_double_type_node));
- layout_type (long_double_type_node);
-
- complex_integer_type_node = make_node (COMPLEX_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"),
- complex_integer_type_node));
- TREE_TYPE (complex_integer_type_node) = integer_type_node;
- layout_type (complex_integer_type_node);
-
- complex_float_type_node = make_node (COMPLEX_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"),
- complex_float_type_node));
- TREE_TYPE (complex_float_type_node) = float_type_node;
- layout_type (complex_float_type_node);
-
- complex_double_type_node = make_node (COMPLEX_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"),
- complex_double_type_node));
- TREE_TYPE (complex_double_type_node) = double_type_node;
- layout_type (complex_double_type_node);
-
- complex_long_double_type_node = make_node (COMPLEX_TYPE);
- pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"),
- complex_long_double_type_node));
- TREE_TYPE (complex_long_double_type_node) = long_double_type_node;
- layout_type (complex_long_double_type_node);
-
- wchar_type_node
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WCHAR_TYPE)));
- wchar_type_size = TYPE_PRECISION (wchar_type_node);
- signed_wchar_type_node = signed_type (wchar_type_node);
- unsigned_wchar_type_node = unsigned_type (wchar_type_node);
-
- integer_zero_node = build_int_2 (0, 0);
- TREE_TYPE (integer_zero_node) = integer_type_node;
- integer_one_node = build_int_2 (1, 0);
- TREE_TYPE (integer_one_node) = integer_type_node;
-
- boolean_type_node = integer_type_node;
- boolean_true_node = integer_one_node;
- boolean_false_node = integer_zero_node;
-
- size_zero_node = build_int_2 (0, 0);
- TREE_TYPE (size_zero_node) = sizetype;
- size_one_node = build_int_2 (1, 0);
- TREE_TYPE (size_one_node) = sizetype;
-
- void_type_node = make_node (VOID_TYPE);
- pushdecl (build_decl (TYPE_DECL,
- ridpointers[(int) RID_VOID], void_type_node));
- layout_type (void_type_node); /* Uses integer_zero_node */
- /* We are not going to have real types in C with less than byte alignment,
- so we might as well not have any types that claim to have it. */
- TYPE_ALIGN (void_type_node) = BITS_PER_UNIT;
-
- null_pointer_node = build_int_2 (0, 0);
- TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node);
- layout_type (TREE_TYPE (null_pointer_node));
-
- string_type_node = build_pointer_type (char_type_node);
- const_string_type_node
- = build_pointer_type (build_type_variant (char_type_node, 1, 0));
-
- /* Make a type to be the domain of a few array types
- whose domains don't really matter.
- 200 is small enough that it always fits in size_t
- and large enough that it can hold most function names for the
- initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */
- array_domain_type = build_index_type (build_int_2 (200, 0));
-
- /* make a type for arrays of characters.
- With luck nothing will ever really depend on the length of this
- array type. */
- char_array_type_node
- = build_array_type (char_type_node, array_domain_type);
- /* Likewise for arrays of ints. */
- int_array_type_node
- = build_array_type (integer_type_node, array_domain_type);
- /* This is for wide string constants. */
- wchar_array_type_node
- = build_array_type (wchar_type_node, array_domain_type);
-
- default_function_type
- = build_function_type (integer_type_node, NULL_TREE);
-
- ptr_type_node = build_pointer_type (void_type_node);
- const_ptr_type_node
- = build_pointer_type (build_type_variant (void_type_node, 1, 0));
-
- endlink = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
-
- void_ftype_any
- = build_function_type (void_type_node, NULL_TREE);
-
- float_ftype_float
- = build_function_type (float_type_node,
- tree_cons (NULL_TREE, float_type_node, endlink));
-
- double_ftype_double
- = build_function_type (double_type_node,
- tree_cons (NULL_TREE, double_type_node, endlink));
-
- ldouble_ftype_ldouble
- = build_function_type (long_double_type_node,
- tree_cons (NULL_TREE, long_double_type_node,
- endlink));
-
- double_ftype_double_double
- = build_function_type (double_type_node,
- tree_cons (NULL_TREE, double_type_node,
- tree_cons (NULL_TREE,
- double_type_node, endlink)));
-
- int_ftype_int
- = build_function_type (integer_type_node,
- tree_cons (NULL_TREE, integer_type_node, endlink));
-
- long_ftype_long
- = build_function_type (long_integer_type_node,
- tree_cons (NULL_TREE,
- long_integer_type_node, endlink));
-
- void_ftype_ptr_ptr_int
- = build_function_type (void_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE,
- integer_type_node,
- endlink))));
-
- int_ftype_cptr_cptr_sizet
- = build_function_type (integer_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- tree_cons (NULL_TREE,
- sizetype,
- endlink))));
-
- void_ftype_ptr_int_int
- = build_function_type (void_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, integer_type_node,
- tree_cons (NULL_TREE,
- integer_type_node,
- endlink))));
-
- string_ftype_ptr_ptr /* strcpy prototype */
- = build_function_type (string_type_node,
- tree_cons (NULL_TREE, string_type_node,
- tree_cons (NULL_TREE,
- const_string_type_node,
- endlink)));
-
- int_ftype_string_string /* strcmp prototype */
- = build_function_type (integer_type_node,
- tree_cons (NULL_TREE, const_string_type_node,
- tree_cons (NULL_TREE,
- const_string_type_node,
- endlink)));
-
- strlen_ftype /* strlen prototype */
- = build_function_type (flag_traditional ? integer_type_node : sizetype,
- tree_cons (NULL_TREE, const_string_type_node,
- endlink));
-
- traditional_ptr_type_node
- = (flag_traditional ? string_type_node : ptr_type_node);
-
- memcpy_ftype /* memcpy prototype */
- = build_function_type (traditional_ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- tree_cons (NULL_TREE,
- sizetype,
- endlink))));
-
- memset_ftype /* memset prototype */
- = build_function_type (traditional_ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, integer_type_node,
- tree_cons (NULL_TREE,
- sizetype,
- endlink))));
-
- builtin_function ("__builtin_constant_p", default_function_type,
- BUILT_IN_CONSTANT_P, NULL_PTR);
-
- builtin_function ("__builtin_return_address",
- build_function_type (ptr_type_node,
- tree_cons (NULL_TREE,
- unsigned_type_node,
- endlink)),
- BUILT_IN_RETURN_ADDRESS, NULL_PTR);
-
- builtin_function ("__builtin_frame_address",
- build_function_type (ptr_type_node,
- tree_cons (NULL_TREE,
- unsigned_type_node,
- endlink)),
- BUILT_IN_FRAME_ADDRESS, NULL_PTR);
-
- builtin_function ("__builtin_alloca",
- build_function_type (ptr_type_node,
- tree_cons (NULL_TREE,
- sizetype,
- endlink)),
- BUILT_IN_ALLOCA, "alloca");
- builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
- /* Define alloca, ffs as builtins.
- Declare _exit just to mark it as volatile. */
- if (! flag_no_builtin && !flag_no_nonansi_builtin)
- {
- temp = builtin_function ("alloca",
- build_function_type (ptr_type_node,
- tree_cons (NULL_TREE,
- sizetype,
- endlink)),
- BUILT_IN_ALLOCA, NULL_PTR);
- /* Suppress error if redefined as a non-function. */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- temp = builtin_function ("ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
- /* Suppress error if redefined as a non-function. */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- temp = builtin_function ("_exit", void_ftype_any, NOT_BUILT_IN,
- NULL_PTR);
- TREE_THIS_VOLATILE (temp) = 1;
- TREE_SIDE_EFFECTS (temp) = 1;
- /* Suppress error if redefined as a non-function. */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- }
-
- builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
- builtin_function ("__builtin_fabsf", float_ftype_float, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("__builtin_fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("__builtin_labs", long_ftype_long, BUILT_IN_LABS,
- NULL_PTR);
- builtin_function ("__builtin_saveregs",
- build_function_type (ptr_type_node, NULL_TREE),
- BUILT_IN_SAVEREGS, NULL_PTR);
-/* EXPAND_BUILTIN_VARARGS is obsolete. */
-#if 0
- builtin_function ("__builtin_varargs",
- build_function_type (ptr_type_node,
- tree_cons (NULL_TREE,
- integer_type_node,
- endlink)),
- BUILT_IN_VARARGS, NULL_PTR);
-#endif
- builtin_function ("__builtin_classify_type", default_function_type,
- BUILT_IN_CLASSIFY_TYPE, NULL_PTR);
- builtin_function ("__builtin_next_arg",
- build_function_type (ptr_type_node, NULL_TREE),
- BUILT_IN_NEXT_ARG, NULL_PTR);
- builtin_function ("__builtin_args_info",
- build_function_type (integer_type_node,
- tree_cons (NULL_TREE,
- integer_type_node,
- endlink)),
- BUILT_IN_ARGS_INFO, NULL_PTR);
-
- /* Untyped call and return. */
- builtin_function ("__builtin_apply_args",
- build_function_type (ptr_type_node, NULL_TREE),
- BUILT_IN_APPLY_ARGS, NULL_PTR);
-
- temp = tree_cons (NULL_TREE,
- build_pointer_type (build_function_type (void_type_node,
- NULL_TREE)),
- tree_cons (NULL_TREE,
- ptr_type_node,
- tree_cons (NULL_TREE,
- sizetype,
- endlink)));
- builtin_function ("__builtin_apply",
- build_function_type (ptr_type_node, temp),
- BUILT_IN_APPLY, NULL_PTR);
- builtin_function ("__builtin_return",
- build_function_type (void_type_node,
- tree_cons (NULL_TREE,
- ptr_type_node,
- endlink)),
- BUILT_IN_RETURN, NULL_PTR);
-
- /* Currently under experimentation. */
- builtin_function ("__builtin_memcpy", memcpy_ftype,
- BUILT_IN_MEMCPY, "memcpy");
- builtin_function ("__builtin_memcmp", int_ftype_cptr_cptr_sizet,
- BUILT_IN_MEMCMP, "memcmp");
- builtin_function ("__builtin_memset", memset_ftype,
- BUILT_IN_MEMSET, NULL_PTR);
- builtin_function ("__builtin_strcmp", int_ftype_string_string,
- BUILT_IN_STRCMP, "strcmp");
- builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr,
- BUILT_IN_STRCPY, "strcpy");
- builtin_function ("__builtin_strlen", strlen_ftype,
- BUILT_IN_STRLEN, "strlen");
- builtin_function ("__builtin_sqrtf", float_ftype_float,
- BUILT_IN_FSQRT, "sqrtf");
- builtin_function ("__builtin_fsqrt", double_ftype_double,
- BUILT_IN_FSQRT, "sqrt");
- builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble,
- BUILT_IN_FSQRT, "sqrtl");
- builtin_function ("__builtin_sinf", float_ftype_float,
- BUILT_IN_SIN, "sinf");
- builtin_function ("__builtin_sin", double_ftype_double,
- BUILT_IN_SIN, "sin");
- builtin_function ("__builtin_sinl", ldouble_ftype_ldouble,
- BUILT_IN_SIN, "sinl");
- builtin_function ("__builtin_cosf", float_ftype_float,
- BUILT_IN_COS, "cosf");
- builtin_function ("__builtin_cos", double_ftype_double,
- BUILT_IN_COS, "cos");
- builtin_function ("__builtin_cosl", ldouble_ftype_ldouble,
- BUILT_IN_COS, "cosl");
- builtin_function ("__builtin_setjmp",
- build_function_type (integer_type_node,
- tree_cons (NULL_TREE,
- ptr_type_node, endlink)),
- BUILT_IN_SETJMP, NULL_PTR);
- builtin_function ("__builtin_longjmp",
- build_function_type
- (void_type_node,
- tree_cons (NULL, ptr_type_node,
- tree_cons (NULL_TREE,
- integer_type_node,
- endlink))),
- BUILT_IN_LONGJMP, NULL_PTR);
-
- /* In an ANSI C program, it is okay to supply built-in meanings
- for these functions, since applications cannot validly use them
- with any other meaning.
- However, honor the -fno-builtin option. */
- if (!flag_no_builtin)
- {
- builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
- builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR);
- builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR);
- builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR);
- builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, NULL_PTR);
- builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP,
- NULL_PTR);
- builtin_function ("memset", memset_ftype, BUILT_IN_MEMSET, NULL_PTR);
- builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP,
- NULL_PTR);
- builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY,
- NULL_PTR);
- builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, NULL_PTR);
- builtin_function ("sqrtf", float_ftype_float, BUILT_IN_FSQRT, NULL_PTR);
- builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, NULL_PTR);
- builtin_function ("sqrtl", ldouble_ftype_ldouble, BUILT_IN_FSQRT,
- NULL_PTR);
- builtin_function ("sinf", float_ftype_float, BUILT_IN_SIN, NULL_PTR);
- builtin_function ("sin", double_ftype_double, BUILT_IN_SIN, NULL_PTR);
- builtin_function ("sinl", ldouble_ftype_ldouble, BUILT_IN_SIN, NULL_PTR);
- builtin_function ("cosf", float_ftype_float, BUILT_IN_COS, NULL_PTR);
- builtin_function ("cos", double_ftype_double, BUILT_IN_COS, NULL_PTR);
- builtin_function ("cosl", ldouble_ftype_ldouble, BUILT_IN_COS, NULL_PTR);
-
- /* Declare these functions volatile
- to avoid spurious "control drops through" warnings. */
- /* Don't specify the argument types, to avoid errors
- from certain code which isn't valid in ANSI but which exists. */
- temp = builtin_function ("abort", void_ftype_any, NOT_BUILT_IN,
- NULL_PTR);
- TREE_THIS_VOLATILE (temp) = 1;
- TREE_SIDE_EFFECTS (temp) = 1;
- temp = builtin_function ("exit", void_ftype_any, NOT_BUILT_IN, NULL_PTR);
- TREE_THIS_VOLATILE (temp) = 1;
- TREE_SIDE_EFFECTS (temp) = 1;
- }
-
-#if 0
- /* Support for these has not been written in either expand_builtin
- or build_function_call. */
- builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, NULL_PTR);
- builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, NULL_PTR);
- builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR,
- NULL_PTR);
- builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL,
- NULL_PTR);
- builtin_function ("__builtin_fmod", double_ftype_double_double,
- BUILT_IN_FMOD, NULL_PTR);
- builtin_function ("__builtin_frem", double_ftype_double_double,
- BUILT_IN_FREM, NULL_PTR);
- builtin_function ("__builtin_memset", ptr_ftype_ptr_int_int,
- BUILT_IN_MEMSET, NULL_PTR);
- builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP,
- NULL_PTR);
- builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN,
- NULL_PTR);
-#endif
-
- pedantic_lvalues = pedantic;
-
- /* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */
- declare_function_name ();
-
- start_identifier_warnings ();
-
- /* Prepare to check format strings against argument lists. */
- init_function_format_info ();
-
- init_iterators ();
-
- incomplete_decl_finalize_hook = finish_incomplete_decl;
-}
-
-/* Return a definition for a builtin function named NAME and whose data type
- is TYPE. TYPE should be a function type with argument types.
- FUNCTION_CODE tells later passes how to compile calls to this function.
- See tree.h for its possible values.
-
- If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
- the name to be called if we can't opencode the function. */
-
-tree
-builtin_function (name, type, function_code, library_name)
- char *name;
- tree type;
- enum built_in_function function_code;
- char *library_name;
-{
- tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- /* If -traditional, permit redefining a builtin function any way you like.
- (Though really, if the program redefines these functions,
- it probably won't work right unless compiled with -fno-builtin.) */
- if (flag_traditional && name[0] != '_')
- DECL_BUILT_IN_NONANSI (decl) = 1;
- if (library_name)
- DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
- make_decl_rtl (decl, NULL_PTR, 1);
- pushdecl (decl);
- if (function_code != NOT_BUILT_IN)
- {
- DECL_BUILT_IN (decl) = 1;
- DECL_FUNCTION_CODE (decl) = function_code;
- }
- /* Warn if a function in the namespace for users
- is used without an occasion to consider it declared. */
- if (name[0] != '_' || name[1] != '_')
- C_DECL_ANTICIPATED (decl) = 1;
-
- 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
- from a containing scope, shadow that tag name for the current scope
- with a forward reference.
- If its type defines a new named structure or union
- or defines an enum, it is valid but we need not do anything here.
- Otherwise, it is an error. */
-
-void
-shadow_tag (declspecs)
- tree declspecs;
-{
- shadow_tag_warned (declspecs, 0);
-}
-
-void
-shadow_tag_warned (declspecs, warned)
- tree declspecs;
- int warned;
- /* 1 => we have done a pedwarn. 2 => we have done a warning, but
- no pedwarn. */
-{
- int found_tag = 0;
- register tree link;
-
- pending_invalid_xref = 0;
-
- for (link = declspecs; link; link = TREE_CHAIN (link))
- {
- register tree value = TREE_VALUE (link);
- register enum tree_code code = TREE_CODE (value);
-
- if (code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE)
- /* Used to test also that TYPE_SIZE (value) != 0.
- That caused warning for `struct foo;' at top level in the file. */
- {
- register tree name = lookup_tag_reverse (value);
- register tree t;
-
- found_tag++;
-
- if (name == 0)
- {
- if (warned != 1 && code != ENUMERAL_TYPE)
- /* Empty unnamed enum OK */
- {
- pedwarn ("unnamed struct/union that defines no instances");
- warned = 1;
- }
- }
- else
- {
- t = lookup_tag (code, name, current_binding_level, 1);
-
- if (t == 0)
- {
- t = make_node (code);
- pushtag (name, t);
- }
- }
- }
- else
- {
- if (!warned && ! in_system_header)
- {
- warning ("useless keyword or type name in empty declaration");
- warned = 2;
- }
- }
- }
-
- if (found_tag > 1)
- error ("two types specified in one empty declaration");
-
- if (warned != 1)
- {
- if (found_tag == 0)
- pedwarn ("empty declaration");
- }
-}
-
-/* Decode a "typename", such as "int **", returning a ..._TYPE node. */
-
-tree
-groktypename (typename)
- tree typename;
-{
- if (TREE_CODE (typename) != TREE_LIST)
- return typename;
- return grokdeclarator (TREE_VALUE (typename),
- TREE_PURPOSE (typename),
- TYPENAME, 0);
-}
-
-/* Return a PARM_DECL node for a given pair of specs and declarator. */
-
-tree
-groktypename_in_parm_context (typename)
- tree typename;
-{
- if (TREE_CODE (typename) != TREE_LIST)
- return typename;
- return grokdeclarator (TREE_VALUE (typename),
- TREE_PURPOSE (typename),
- PARM, 0);
-}
-
-/* Decode a declarator in an ordinary declaration or data definition.
- This is called as soon as the type information and variable name
- have been parsed, before parsing the initializer if any.
- Here we create the ..._DECL node, fill in its type,
- and put it on the list of decls for the current context.
- The ..._DECL node is returned as the value.
-
- Exception: for arrays where the length is not specified,
- the type is left null, to be filled in by `finish_decl'.
-
- Function definitions do not come here; they go to start_function
- instead. However, external and forward declarations of functions
- do go through here. Structure field declarations are done by
- grokfield and not through here. */
-
-/* Set this to zero to debug not using the temporary obstack
- to parse initializers. */
-int debug_temp_inits = 1;
-
-tree
-start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
- tree declarator, declspecs;
- int initialized;
- tree attributes, prefix_attributes;
-{
- register tree decl = grokdeclarator (declarator, declspecs,
- NORMAL, initialized);
- register tree tem;
- int init_written = initialized;
-
- /* The corresponding pop_obstacks is in finish_decl. */
- push_obstacks_nochange ();
-
- if (warn_main && !strcmp (IDENTIFIER_POINTER (declarator), "main"))
- warning_with_decl (decl, "`%s' is usually a function");
-
- if (initialized)
- /* Is it valid for this decl to have an initializer at all?
- If not, set INITIALIZED to zero, which will indirectly
- tell `finish_decl' to ignore the initializer once it is parsed. */
- switch (TREE_CODE (decl))
- {
- case TYPE_DECL:
- /* typedef foo = bar means give foo the same type as bar.
- We haven't parsed bar yet, so `finish_decl' will fix that up.
- Any other case of an initialization in a TYPE_DECL is an error. */
- if (pedantic || list_length (declspecs) > 1)
- {
- error ("typedef `%s' is initialized",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- initialized = 0;
- }
- break;
-
- case FUNCTION_DECL:
- error ("function `%s' is initialized like a variable",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- initialized = 0;
- break;
-
- case PARM_DECL:
- /* DECL_INITIAL in a PARM_DECL is really DECL_ARG_TYPE. */
- error ("parameter `%s' is initialized",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- initialized = 0;
- break;
-
- default:
- /* Don't allow initializations for incomplete types
- except for arrays which might be completed by the initialization. */
- if (TYPE_SIZE (TREE_TYPE (decl)) != 0)
- {
- /* A complete type is ok if size is fixed. */
-
- if (TREE_CODE (TYPE_SIZE (TREE_TYPE (decl))) != INTEGER_CST
- || C_DECL_VARIABLE_SIZE (decl))
- {
- error ("variable-sized object may not be initialized");
- initialized = 0;
- }
- }
- else if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE)
- {
- error ("variable `%s' has initializer but incomplete type",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- initialized = 0;
- }
- else if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl))) == 0)
- {
- error ("elements of array `%s' have incomplete type",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- initialized = 0;
- }
- }
-
- if (initialized)
- {
-#if 0 /* Seems redundant with grokdeclarator. */
- if (current_binding_level != global_binding_level
- && DECL_EXTERNAL (decl)
- && TREE_CODE (decl) != FUNCTION_DECL)
- warning ("declaration of `%s' has `extern' and is initialized",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
-#endif
- DECL_EXTERNAL (decl) = 0;
- if (current_binding_level == global_binding_level)
- TREE_STATIC (decl) = 1;
-
- /* Tell `pushdecl' this is an initialized decl
- even though we don't yet have the initializer expression.
- Also tell `finish_decl' it may store the real initializer. */
- DECL_INITIAL (decl) = error_mark_node;
- }
-
- /* If this is a function declaration, write a record describing it to the
- prototypes file (if requested). */
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- gen_aux_info_record (decl, 0, 0, TYPE_ARG_TYPES (TREE_TYPE (decl)) != 0);
-
- /* ANSI specifies that a tentative definition which is not merged with
- a non-tentative definition behaves exactly like a definition with an
- initializer equal to zero. (Section 3.7.2)
- -fno-common gives strict ANSI behavior. Usually you don't want it.
- This matters only for variables with external linkage. */
- if (! flag_no_common || ! TREE_PUBLIC (decl))
- DECL_COMMON (decl) = 1;
-
- /* Set attributes here so if duplicate decl, will have proper attributes. */
- decl_attributes (decl, attributes, prefix_attributes);
-
- /* Add this decl to the current binding level.
- TEM may equal DECL or it may be a previous decl of the same name. */
- tem = pushdecl (decl);
-
- /* For a local variable, define the RTL now. */
- if (current_binding_level != global_binding_level
- /* But not if this is a duplicate decl
- and we preserved the rtl from the previous one
- (which may or may not happen). */
- && DECL_RTL (tem) == 0)
- {
- if (TYPE_SIZE (TREE_TYPE (tem)) != 0)
- expand_decl (tem);
- else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE
- && DECL_INITIAL (tem) != 0)
- expand_decl (tem);
- }
-
- if (init_written)
- {
- /* When parsing and digesting the initializer,
- use temporary storage. Do this even if we will ignore the value. */
- if (current_binding_level == global_binding_level && debug_temp_inits)
- temporary_allocation ();
- }
-
- return tem;
-}
-
-/* Finish processing of a declaration;
- install its initial value.
- If the length of an array type is not known before,
- it must be determined now, from the initial value, or it is an error. */
-
-void
-finish_decl (decl, init, asmspec_tree)
- tree decl, init;
- tree asmspec_tree;
-{
- register tree type = TREE_TYPE (decl);
- int was_incomplete = (DECL_SIZE (decl) == 0);
- int temporary = allocation_temporary_p ();
- char *asmspec = 0;
-
- /* If a name was specified, get the string. */
- if (asmspec_tree)
- asmspec = TREE_STRING_POINTER (asmspec_tree);
-
- /* If `start_decl' didn't like having an initialization, ignore it now. */
-
- if (init != 0 && DECL_INITIAL (decl) == 0)
- init = 0;
- /* Don't crash if parm is initialized. */
- if (TREE_CODE (decl) == PARM_DECL)
- init = 0;
-
- if (ITERATOR_P (decl))
- {
- if (init == 0)
- error_with_decl (decl, "iterator has no initial value");
- else
- init = save_expr (init);
- }
-
- if (init)
- {
- if (TREE_CODE (decl) != TYPE_DECL)
- store_init_value (decl, init);
- else
- {
- /* typedef foo = bar; store the type of bar as the type of foo. */
- TREE_TYPE (decl) = TREE_TYPE (init);
- DECL_INITIAL (decl) = init = 0;
- }
- }
-
- /* Pop back to the obstack that is current for this binding level.
- This is because MAXINDEX, rtl, etc. to be made below
- must go in the permanent obstack. But don't discard the
- temporary data yet. */
- pop_obstacks ();
-#if 0 /* pop_obstacks was near the end; this is what was here. */
- if (current_binding_level == global_binding_level && temporary)
- end_temporary_allocation ();
-#endif
-
- /* Deduce size of array from initialization, if not already known */
-
- if (TREE_CODE (type) == ARRAY_TYPE
- && TYPE_DOMAIN (type) == 0
- && TREE_CODE (decl) != TYPE_DECL)
- {
- int do_default
- = (TREE_STATIC (decl)
- /* Even if pedantic, an external linkage array
- may have incomplete type at first. */
- ? pedantic && !TREE_PUBLIC (decl)
- : !DECL_EXTERNAL (decl));
- int failure
- = complete_array_type (type, DECL_INITIAL (decl), do_default);
-
- /* Get the completed type made by complete_array_type. */
- type = TREE_TYPE (decl);
-
- if (failure == 1)
- error_with_decl (decl, "initializer fails to determine size of `%s'");
-
- if (failure == 2)
- {
- if (do_default)
- error_with_decl (decl, "array size missing in `%s'");
- /* If a `static' var's size isn't known,
- make it extern as well as static, so it does not get
- allocated.
- If it is not `static', then do not mark extern;
- finish_incomplete_decl will give it a default size
- and it will get allocated. */
- else if (!pedantic && TREE_STATIC (decl) && ! TREE_PUBLIC (decl))
- DECL_EXTERNAL (decl) = 1;
- }
-
- /* TYPE_MAX_VALUE is always one less than the number of elements
- in the array, because we start counting at zero. Therefore,
- warn only if the value is less than zero. */
- if (pedantic && TYPE_DOMAIN (type) != 0
- && tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) < 0)
- error_with_decl (decl, "zero or negative size array `%s'");
-
- layout_decl (decl, 0);
- }
-
- if (TREE_CODE (decl) == VAR_DECL)
- {
- if (DECL_SIZE (decl) == 0
- && TYPE_SIZE (TREE_TYPE (decl)) != 0)
- layout_decl (decl, 0);
-
- if (DECL_SIZE (decl) == 0
- && (TREE_STATIC (decl)
- ?
- /* A static variable with an incomplete type
- is an error if it is initialized.
- Also if it is not file scope.
- Otherwise, let it through, but if it is not `extern'
- then it may cause an error message later. */
- /* A duplicate_decls call could have changed an extern
- declaration into a file scope one. This can be detected
- by TREE_ASM_WRITTEN being set. */
- (DECL_INITIAL (decl) != 0
- || DECL_CONTEXT (decl) != 0 && ! TREE_ASM_WRITTEN (decl))
- :
- /* An automatic variable with an incomplete type
- is an error. */
- !DECL_EXTERNAL (decl)))
- {
- error_with_decl (decl, "storage size of `%s' isn't known");
- TREE_TYPE (decl) = error_mark_node;
- }
-
- if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
- && DECL_SIZE (decl) != 0)
- {
- if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
- constant_expression_warning (DECL_SIZE (decl));
- else
- error_with_decl (decl, "storage size of `%s' isn't constant");
- }
- }
-
- /* If this is a function and an assembler name is specified, it isn't
- builtin any more. Also reset DECL_RTL so we can give it its new
- name. */
- if (TREE_CODE (decl) == FUNCTION_DECL && asmspec)
- {
- DECL_BUILT_IN (decl) = 0;
- DECL_RTL (decl) = 0;
- }
-
- /* Output the assembler code and/or RTL code for variables and functions,
- unless the type is an undefined structure or union.
- If not, it will get done when the type is completed. */
-
- if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
- {
- if ((flag_traditional || TREE_PERMANENT (decl))
- && allocation_temporary_p ())
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- /* This is a no-op in c-lang.c or something real in objc-actions.c. */
- maybe_objc_check_decl (decl);
- rest_of_decl_compilation (decl, asmspec,
- (DECL_CONTEXT (decl) == 0
- || TREE_ASM_WRITTEN (decl)),
- 0);
- pop_obstacks ();
- }
- else
- {
- /* This is a no-op in c-lang.c or something real in objc-actions.c. */
- maybe_objc_check_decl (decl);
- rest_of_decl_compilation (decl, asmspec, DECL_CONTEXT (decl) == 0,
- 0);
- }
- if (DECL_CONTEXT (decl) != 0)
- {
- /* Recompute the RTL of a local array now
- if it used to be an incomplete type. */
- if (was_incomplete
- && ! TREE_STATIC (decl) && ! DECL_EXTERNAL (decl))
- {
- /* If we used it already as memory, it must stay in memory. */
- TREE_ADDRESSABLE (decl) = TREE_USED (decl);
- /* If it's still incomplete now, no init will save it. */
- if (DECL_SIZE (decl) == 0)
- DECL_INITIAL (decl) = 0;
- expand_decl (decl);
- }
- /* Compute and store the initial value. */
- if (TREE_CODE (decl) != FUNCTION_DECL)
- expand_decl_init (decl);
- }
- }
-
- if (TREE_CODE (decl) == TYPE_DECL)
- {
- /* This is a no-op in c-lang.c or something real in objc-actions.c. */
- maybe_objc_check_decl (decl);
- rest_of_decl_compilation (decl, NULL_PTR, DECL_CONTEXT (decl) == 0,
- 0);
- }
-
- /* ??? After 2.3, test (init != 0) instead of TREE_CODE. */
- /* This test used to include TREE_PERMANENT, however, we have the same
- problem with initializers at the function level. Such initializers get
- saved until the end of the function on the momentary_obstack. */
- if (!(TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
- && temporary
- /* DECL_INITIAL is not defined in PARM_DECLs, since it shares
- space with DECL_ARG_TYPE. */
- && TREE_CODE (decl) != PARM_DECL)
- {
- /* We need to remember that this array HAD an initialization,
- but discard the actual temporary nodes,
- since we can't have a permanent node keep pointing to them. */
- /* We make an exception for inline functions, since it's
- normal for a local extern redeclaration of an inline function
- to have a copy of the top-level decl's DECL_INLINE. */
- if (DECL_INITIAL (decl) != 0 && DECL_INITIAL (decl) != error_mark_node)
- {
- /* If this is a const variable, then preserve the
- initializer instead of discarding it so that we can optimize
- references to it. */
- /* This test used to include TREE_STATIC, but this won't be set
- for function level initializers. */
- if (TREE_READONLY (decl) || ITERATOR_P (decl))
- {
- preserve_initializer ();
- /* Hack? Set the permanent bit for something that is permanent,
- but not on the permanent obstack, so as to convince
- output_constant_def to make its rtl on the permanent
- obstack. */
- TREE_PERMANENT (DECL_INITIAL (decl)) = 1;
-
- /* The initializer and DECL must have the same (or equivalent
- types), but if the initializer is a STRING_CST, its type
- might not be on the right obstack, so copy the type
- of DECL. */
- TREE_TYPE (DECL_INITIAL (decl)) = type;
- }
- else
- DECL_INITIAL (decl) = error_mark_node;
- }
- }
-
- /* If requested, warn about definitions of large data objects. */
-
- if (warn_larger_than
- && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL)
- && !DECL_EXTERNAL (decl))
- {
- register tree decl_size = DECL_SIZE (decl);
-
- if (decl_size && TREE_CODE (decl_size) == INTEGER_CST)
- {
- unsigned units = TREE_INT_CST_LOW(decl_size) / BITS_PER_UNIT;
-
- if (units > larger_than_size)
- warning_with_decl (decl, "size of `%s' is %u bytes", units);
- }
- }
-
-#if 0
- /* Resume permanent allocation, if not within a function. */
- /* The corresponding push_obstacks_nochange is in start_decl,
- and in push_parm_decl and in grokfield. */
- pop_obstacks ();
-#endif
-
- /* If we have gone back from temporary to permanent allocation,
- actually free the temporary space that we no longer need. */
- if (temporary && !allocation_temporary_p ())
- permanent_allocation (0);
-
- /* At the end of a declaration, throw away any variable type sizes
- of types defined inside that declaration. There is no use
- computing them in the following function definition. */
- if (current_binding_level == global_binding_level)
- get_pending_sizes ();
-}
-
-/* If DECL has a cleanup, build and return that cleanup here.
- This is a callback called by expand_expr. */
-
-tree
-maybe_build_cleanup (decl)
- tree decl;
-{
- /* There are no cleanups in C. */
- return NULL_TREE;
-}
-
-/* Given a parsed parameter declaration,
- decode it into a PARM_DECL and push that on the current binding level.
- Also, for the sake of forward parm decls,
- record the given order of parms in `parm_order'. */
-
-void
-push_parm_decl (parm)
- tree parm;
-{
- tree decl;
- int old_immediate_size_expand = immediate_size_expand;
- /* Don't try computing parm sizes now -- wait till fn is called. */
- immediate_size_expand = 0;
-
- /* The corresponding pop_obstacks is in finish_decl. */
- push_obstacks_nochange ();
-
- decl = grokdeclarator (TREE_VALUE (TREE_PURPOSE (parm)),
- TREE_PURPOSE (TREE_PURPOSE (parm)), PARM, 0);
- decl_attributes (decl, TREE_VALUE (TREE_VALUE (parm)),
- TREE_PURPOSE (TREE_VALUE (parm)));
-
-#if 0
- if (DECL_NAME (decl))
- {
- tree olddecl;
- olddecl = lookup_name (DECL_NAME (decl));
- if (pedantic && olddecl != 0 && TREE_CODE (olddecl) == TYPE_DECL)
- pedwarn_with_decl (decl, "ANSI C forbids parameter `%s' shadowing typedef");
- }
-#endif
-
- decl = pushdecl (decl);
-
- immediate_size_expand = old_immediate_size_expand;
-
- current_binding_level->parm_order
- = tree_cons (NULL_TREE, decl, current_binding_level->parm_order);
-
- /* Add this decl to the current binding level. */
- finish_decl (decl, NULL_TREE, NULL_TREE);
-}
-
-/* Clear the given order of parms in `parm_order'.
- Used at start of parm list,
- and also at semicolon terminating forward decls. */
-
-void
-clear_parm_order ()
-{
- current_binding_level->parm_order = NULL_TREE;
-}
-
-/* Make TYPE a complete type based on INITIAL_VALUE.
- Return 0 if successful, 1 if INITIAL_VALUE can't be deciphered,
- 2 if there was no information (in which case assume 1 if DO_DEFAULT). */
-
-int
-complete_array_type (type, initial_value, do_default)
- tree type;
- tree initial_value;
- int do_default;
-{
- register tree maxindex = NULL_TREE;
- int value = 0;
-
- if (initial_value)
- {
- /* Note MAXINDEX is really the maximum index,
- one less than the size. */
- if (TREE_CODE (initial_value) == STRING_CST)
- {
- int eltsize
- = int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value)));
- maxindex = build_int_2 ((TREE_STRING_LENGTH (initial_value)
- / eltsize) - 1, 0);
- }
- else if (TREE_CODE (initial_value) == CONSTRUCTOR)
- {
- tree elts = CONSTRUCTOR_ELTS (initial_value);
- maxindex = size_binop (MINUS_EXPR, integer_zero_node, size_one_node);
- for (; elts; elts = TREE_CHAIN (elts))
- {
- if (TREE_PURPOSE (elts))
- maxindex = TREE_PURPOSE (elts);
- else
- maxindex = size_binop (PLUS_EXPR, maxindex, size_one_node);
- }
- maxindex = copy_node (maxindex);
- }
- else
- {
- /* Make an error message unless that happened already. */
- if (initial_value != error_mark_node)
- value = 1;
-
- /* Prevent further error messages. */
- maxindex = build_int_2 (0, 0);
- }
- }
-
- if (!maxindex)
- {
- if (do_default)
- maxindex = build_int_2 (0, 0);
- value = 2;
- }
-
- if (maxindex)
- {
- TYPE_DOMAIN (type) = build_index_type (maxindex);
- if (!TREE_TYPE (maxindex))
- TREE_TYPE (maxindex) = TYPE_DOMAIN (type);
-#if 0 /* I took out this change
- together with the change in build_array_type. --rms */
- change_main_variant (type,
- build_array_type (TREE_TYPE (type),
- TYPE_DOMAIN (type)));
-#endif
- }
-
- /* Lay out the type now that we can get the real answer. */
-
- layout_type (type);
-
- return value;
-}
-
-/* Given declspecs and a declarator,
- determine the name and type of the object declared
- and construct a ..._DECL node for it.
- (In one case we can return a ..._TYPE node instead.
- For invalid input we sometimes return 0.)
-
- DECLSPECS is a chain of tree_list nodes whose value fields
- are the storage classes and type specifiers.
-
- DECL_CONTEXT says which syntactic context this declaration is in:
- NORMAL for most contexts. Make a VAR_DECL or FUNCTION_DECL or TYPE_DECL.
- FUNCDEF for a function definition. Like NORMAL but a few different
- error messages in each case. Return value may be zero meaning
- this definition is too screwy to try to parse.
- PARM for a parameter declaration (either within a function prototype
- or before a function body). Make a PARM_DECL, or return void_type_node.
- TYPENAME if for a typename (in a cast or sizeof).
- Don't make a DECL node; just return the ..._TYPE node.
- FIELD for a struct or union field; make a FIELD_DECL.
- BITFIELD for a field with specified width.
- INITIALIZED is 1 if the decl has an initializer.
-
- In the TYPENAME case, DECLARATOR is really an absolute declarator.
- It may also be so in the PARM case, for a prototype where the
- argument type is specified but not the name.
-
- This function is where the complicated C meanings of `static'
- and `extern' are interpreted. */
-
-static tree
-grokdeclarator (declarator, declspecs, decl_context, initialized)
- tree declspecs;
- tree declarator;
- enum decl_context decl_context;
- int initialized;
-{
- int specbits = 0;
- tree spec;
- tree type = NULL_TREE;
- int longlong = 0;
- int constp;
- int volatilep;
- int inlinep;
- int explicit_int = 0;
- int explicit_char = 0;
- int defaulted_int = 0;
- tree typedef_decl = 0;
- char *name;
- tree typedef_type = 0;
- int funcdef_flag = 0;
- enum tree_code innermost_code = ERROR_MARK;
- int bitfield = 0;
- int size_varies = 0;
- tree decl_machine_attr = NULL_TREE;
-
- if (decl_context == BITFIELD)
- bitfield = 1, decl_context = FIELD;
-
- if (decl_context == FUNCDEF)
- funcdef_flag = 1, decl_context = NORMAL;
-
- push_obstacks_nochange ();
-
- if (flag_traditional && allocation_temporary_p ())
- end_temporary_allocation ();
-
- /* Look inside a declarator for the name being declared
- and get it as a string, for an error message. */
- {
- register tree decl = declarator;
- name = 0;
-
- while (decl)
- switch (TREE_CODE (decl))
- {
- case ARRAY_REF:
- case INDIRECT_REF:
- case CALL_EXPR:
- innermost_code = TREE_CODE (decl);
- decl = TREE_OPERAND (decl, 0);
- break;
-
- case IDENTIFIER_NODE:
- name = IDENTIFIER_POINTER (decl);
- decl = 0;
- break;
-
- default:
- abort ();
- }
- if (name == 0)
- name = "type name";
- }
-
- /* A function definition's declarator must have the form of
- a function declarator. */
-
- if (funcdef_flag && innermost_code != CALL_EXPR)
- return 0;
-
- /* Anything declared one level down from the top level
- must be one of the parameters of a function
- (because the body is at least two levels down). */
-
- /* If this looks like a function definition, make it one,
- even if it occurs where parms are expected.
- Then store_parm_decls will reject it and not use it as a parm. */
- if (decl_context == NORMAL && !funcdef_flag
- && current_binding_level->parm_flag)
- decl_context = PARM;
-
- /* Look through the decl specs and record which ones appear.
- Some typespecs are defined as built-in typenames.
- Others, the ones that are modifiers of other types,
- are represented by bits in SPECBITS: set the bits for
- the modifiers that appear. Storage class keywords are also in SPECBITS.
-
- If there is a typedef name or a type, store the type in TYPE.
- This includes builtin typedefs such as `int'.
-
- Set EXPLICIT_INT or EXPLICIT_CHAR if the type is `int' or `char'
- and did not come from a user typedef.
-
- Set LONGLONG if `long' is mentioned twice. */
-
- for (spec = declspecs; spec; spec = TREE_CHAIN (spec))
- {
- register int i;
- register tree id = TREE_VALUE (spec);
-
- if (id == ridpointers[(int) RID_INT])
- explicit_int = 1;
- if (id == ridpointers[(int) RID_CHAR])
- explicit_char = 1;
-
- if (TREE_CODE (id) == IDENTIFIER_NODE)
- for (i = (int) RID_FIRST_MODIFIER; i < (int) RID_MAX; i++)
- {
- if (ridpointers[i] == id)
- {
- if (i == (int) RID_LONG && specbits & (1<<i))
- {
- if (longlong)
- error ("`long long long' is too long for GCC");
- else
- {
- if (pedantic && ! in_system_header)
- pedwarn ("ANSI C does not support `long long'");
- longlong = 1;
- }
- }
- else if (specbits & (1 << i))
- pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id));
- specbits |= 1 << i;
- goto found;
- }
- }
- if (type)
- error ("two or more data types in declaration of `%s'", name);
- /* Actual typedefs come to us as TYPE_DECL nodes. */
- else if (TREE_CODE (id) == TYPE_DECL)
- {
- type = TREE_TYPE (id);
- decl_machine_attr = DECL_MACHINE_ATTRIBUTES (id);
- typedef_decl = id;
- }
- /* Built-in types come as identifiers. */
- else if (TREE_CODE (id) == IDENTIFIER_NODE)
- {
- register tree t = lookup_name (id);
- if (TREE_TYPE (t) == error_mark_node)
- ;
- else if (!t || TREE_CODE (t) != TYPE_DECL)
- error ("`%s' fails to be a typedef or built in type",
- IDENTIFIER_POINTER (id));
- else
- {
- type = TREE_TYPE (t);
- typedef_decl = t;
- }
- }
- else if (TREE_CODE (id) != ERROR_MARK)
- type = id;
-
- found: {}
- }
-
- typedef_type = type;
- if (type)
- size_varies = C_TYPE_VARIABLE_SIZE (type);
-
- /* No type at all: default to `int', and set DEFAULTED_INT
- because it was not a user-defined typedef. */
-
- if (type == 0)
- {
- if (! (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
- | (1 << (int) RID_SIGNED)
- | (1 << (int) RID_UNSIGNED))))
- {
- /* C9x will probably require a diagnostic here.
- For now, issue a warning if -Wreturn-type and this is a function,
- or if -Wimplicit; prefer the former warning since it is more
- explicit. */
- if ((warn_implicit || warn_return_type) && funcdef_flag)
- warn_about_return_type = 1;
- else if (warn_implicit)
- warning ("type defaults to `int' in declaration of `%s'", name);
- }
-
- defaulted_int = 1;
- type = integer_type_node;
- }
-
- /* Now process the modifiers that were specified
- and check for invalid combinations. */
-
- /* Long double is a special combination. */
-
- if ((specbits & 1 << (int) RID_LONG)
- && TYPE_MAIN_VARIANT (type) == double_type_node)
- {
- specbits &= ~ (1 << (int) RID_LONG);
- type = long_double_type_node;
- }
-
- /* Check all other uses of type modifiers. */
-
- if (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
- | (1 << (int) RID_UNSIGNED) | (1 << (int) RID_SIGNED)))
- {
- int ok = 0;
-
- if (TREE_CODE (type) != INTEGER_TYPE)
- error ("long, short, signed or unsigned invalid for `%s'", name);
- else if ((specbits & 1 << (int) RID_LONG)
- && (specbits & 1 << (int) RID_SHORT))
- error ("long and short specified together for `%s'", name);
- else if (((specbits & 1 << (int) RID_LONG)
- || (specbits & 1 << (int) RID_SHORT))
- && explicit_char)
- error ("long or short specified with char for `%s'", name);
- else if (((specbits & 1 << (int) RID_LONG)
- || (specbits & 1 << (int) RID_SHORT))
- && TREE_CODE (type) == REAL_TYPE)
- error ("long or short specified with floating type for `%s'", name);
- else if ((specbits & 1 << (int) RID_SIGNED)
- && (specbits & 1 << (int) RID_UNSIGNED))
- error ("signed and unsigned given together for `%s'", name);
- else
- {
- ok = 1;
- if (!explicit_int && !defaulted_int && !explicit_char && pedantic)
- {
- pedwarn ("long, short, signed or unsigned used invalidly for `%s'",
- name);
- if (flag_pedantic_errors)
- ok = 0;
- }
- }
-
- /* Discard the type modifiers if they are invalid. */
- if (! ok)
- {
- specbits &= ~((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
- | (1 << (int) RID_UNSIGNED) | (1 << (int) RID_SIGNED));
- longlong = 0;
- }
- }
-
- if ((specbits & (1 << (int) RID_COMPLEX))
- && TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE)
- {
- error ("complex invalid for `%s'", name);
- specbits &= ~ (1 << (int) RID_COMPLEX);
- }
-
- /* Decide whether an integer type is signed or not.
- Optionally treat bitfields as signed by default. */
- if (specbits & 1 << (int) RID_UNSIGNED
- /* Traditionally, all bitfields are unsigned. */
- || (bitfield && flag_traditional
- && (! explicit_flag_signed_bitfields || !flag_signed_bitfields))
- || (bitfield && ! flag_signed_bitfields
- && (explicit_int || defaulted_int || explicit_char
- /* A typedef for plain `int' without `signed'
- can be controlled just like plain `int'. */
- || ! (typedef_decl != 0
- && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
- && TREE_CODE (type) != ENUMERAL_TYPE
- && !(specbits & 1 << (int) RID_SIGNED)))
- {
- if (longlong)
- type = long_long_unsigned_type_node;
- else if (specbits & 1 << (int) RID_LONG)
- type = long_unsigned_type_node;
- else if (specbits & 1 << (int) RID_SHORT)
- type = short_unsigned_type_node;
- else if (type == char_type_node)
- type = unsigned_char_type_node;
- else if (typedef_decl)
- type = unsigned_type (type);
- else
- type = unsigned_type_node;
- }
- else if ((specbits & 1 << (int) RID_SIGNED)
- && type == char_type_node)
- type = signed_char_type_node;
- else if (longlong)
- type = long_long_integer_type_node;
- else if (specbits & 1 << (int) RID_LONG)
- type = long_integer_type_node;
- else if (specbits & 1 << (int) RID_SHORT)
- type = short_integer_type_node;
-
- if (specbits & 1 << (int) RID_COMPLEX)
- {
- /* If we just have "complex", it is equivalent to
- "complex double", but if any modifiers at all are specified it is
- the complex form of TYPE. E.g, "complex short" is
- "complex short int". */
-
- if (defaulted_int && ! longlong
- && ! (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
- | (1 << (int) RID_SIGNED)
- | (1 << (int) RID_UNSIGNED))))
- type = complex_double_type_node;
- else if (type == integer_type_node)
- type = complex_integer_type_node;
- else if (type == float_type_node)
- type = complex_float_type_node;
- else if (type == double_type_node)
- type = complex_double_type_node;
- else if (type == long_double_type_node)
- type = complex_long_double_type_node;
- else
- type = build_complex_type (type);
- }
-
- /* Set CONSTP if this declaration is `const', whether by
- explicit specification or via a typedef.
- Likewise for VOLATILEP. */
-
- constp = !! (specbits & 1 << (int) RID_CONST) + TYPE_READONLY (type);
- volatilep = !! (specbits & 1 << (int) RID_VOLATILE) + TYPE_VOLATILE (type);
- inlinep = !! (specbits & (1 << (int) RID_INLINE));
- if (constp > 1)
- pedwarn ("duplicate `const'");
- if (volatilep > 1)
- pedwarn ("duplicate `volatile'");
- if (! flag_gen_aux_info && (TYPE_READONLY (type) || TYPE_VOLATILE (type)))
- type = TYPE_MAIN_VARIANT (type);
-
- /* Warn if two storage classes are given. Default to `auto'. */
-
- {
- int nclasses = 0;
-
- if (specbits & 1 << (int) RID_AUTO) nclasses++;
- if (specbits & 1 << (int) RID_STATIC) nclasses++;
- if (specbits & 1 << (int) RID_EXTERN) nclasses++;
- if (specbits & 1 << (int) RID_REGISTER) nclasses++;
- if (specbits & 1 << (int) RID_TYPEDEF) nclasses++;
- if (specbits & 1 << (int) RID_ITERATOR) nclasses++;
-
- /* Warn about storage classes that are invalid for certain
- kinds of declarations (parameters, typenames, etc.). */
-
- if (nclasses > 1)
- error ("multiple storage classes in declaration of `%s'", name);
- else if (funcdef_flag
- && (specbits
- & ((1 << (int) RID_REGISTER)
- | (1 << (int) RID_AUTO)
- | (1 << (int) RID_TYPEDEF))))
- {
- if (specbits & 1 << (int) RID_AUTO
- && (pedantic || current_binding_level == global_binding_level))
- pedwarn ("function definition declared `auto'");
- if (specbits & 1 << (int) RID_REGISTER)
- error ("function definition declared `register'");
- if (specbits & 1 << (int) RID_TYPEDEF)
- error ("function definition declared `typedef'");
- specbits &= ~ ((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER)
- | (1 << (int) RID_AUTO));
- }
- else if (decl_context != NORMAL && nclasses > 0)
- {
- if (decl_context == PARM && specbits & 1 << (int) RID_REGISTER)
- ;
- else
- {
- error ((decl_context == FIELD
- ? "storage class specified for structure field `%s'"
- : (decl_context == PARM
- ? "storage class specified for parameter `%s'"
- : "storage class specified for typename")),
- name);
- specbits &= ~ ((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER)
- | (1 << (int) RID_AUTO) | (1 << (int) RID_STATIC)
- | (1 << (int) RID_EXTERN));
- }
- }
- else if (specbits & 1 << (int) RID_EXTERN && initialized && ! funcdef_flag)
- {
- /* `extern' with initialization is invalid if not at top level. */
- if (current_binding_level == global_binding_level)
- warning ("`%s' initialized and declared `extern'", name);
- else
- error ("`%s' has both `extern' and initializer", name);
- }
- else if (specbits & 1 << (int) RID_EXTERN && funcdef_flag
- && current_binding_level != global_binding_level)
- error ("nested function `%s' declared `extern'", name);
- else if (current_binding_level == global_binding_level
- && specbits & (1 << (int) RID_AUTO))
- error ("top-level declaration of `%s' specifies `auto'", name);
- else if ((specbits & 1 << (int) RID_ITERATOR)
- && TREE_CODE (declarator) != IDENTIFIER_NODE)
- {
- error ("iterator `%s' has derived type", name);
- type = error_mark_node;
- }
- else if ((specbits & 1 << (int) RID_ITERATOR)
- && TREE_CODE (type) != INTEGER_TYPE)
- {
- error ("iterator `%s' has noninteger type", name);
- type = error_mark_node;
- }
- }
-
- /* Now figure out the structure of the declarator proper.
- Descend through it, creating more complex types, until we reach
- the declared identifier (or NULL_TREE, in an absolute declarator). */
-
- while (declarator && TREE_CODE (declarator) != IDENTIFIER_NODE)
- {
- if (type == error_mark_node)
- {
- declarator = TREE_OPERAND (declarator, 0);
- continue;
- }
-
- /* Each level of DECLARATOR is either an ARRAY_REF (for ...[..]),
- an INDIRECT_REF (for *...),
- a CALL_EXPR (for ...(...)),
- an identifier (for the name being declared)
- or a null pointer (for the place in an absolute declarator
- where the name was omitted).
- For the last two cases, we have just exited the loop.
-
- At this point, TYPE is the type of elements of an array,
- or for a function to return, or for a pointer to point to.
- After this sequence of ifs, TYPE is the type of the
- array or function or pointer, and DECLARATOR has had its
- outermost layer removed. */
-
- if (TREE_CODE (declarator) == ARRAY_REF)
- {
- register tree itype = NULL_TREE;
- register tree size = TREE_OPERAND (declarator, 1);
- /* An uninitialized decl with `extern' is a reference. */
- int extern_ref = !initialized && (specbits & (1 << (int) RID_EXTERN));
- /* The index is a signed object `sizetype' bits wide. */
- tree index_type = signed_type (sizetype);
-
- declarator = TREE_OPERAND (declarator, 0);
-
- /* Check for some types that there cannot be arrays of. */
-
- if (TYPE_MAIN_VARIANT (type) == void_type_node)
- {
- error ("declaration of `%s' as array of voids", name);
- type = error_mark_node;
- }
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- error ("declaration of `%s' as array of functions", name);
- type = error_mark_node;
- }
-
- if (size == error_mark_node)
- type = error_mark_node;
-
- if (type == error_mark_node)
- continue;
-
- /* If this is a block level extern, it must live past the end
- of the function so that we can check it against other extern
- declarations (IDENTIFIER_LIMBO_VALUE). */
- if (extern_ref && allocation_temporary_p ())
- end_temporary_allocation ();
-
- /* If size was specified, set ITYPE to a range-type for that size.
- Otherwise, ITYPE remains null. finish_decl may figure it out
- from an initial value. */
-
- if (size)
- {
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- STRIP_TYPE_NOPS (size);
-
- if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE)
- {
- error ("size of array `%s' has non-integer type", name);
- size = integer_one_node;
- }
-
- if (pedantic && integer_zerop (size))
- pedwarn ("ANSI C forbids zero-size array `%s'", name);
-
- if (TREE_CODE (size) == INTEGER_CST)
- {
- constant_expression_warning (size);
- if (tree_int_cst_sgn (size) < 0)
- {
- error ("size of array `%s' is negative", name);
- size = integer_one_node;
- }
- }
- else
- {
- /* Make sure the array size remains visibly nonconstant
- even if it is (eg) a const variable with known value. */
- size_varies = 1;
-
- if (pedantic)
- {
- if (TREE_CONSTANT (size))
- pedwarn ("ANSI C forbids array `%s' whose size can't be evaluated", name);
- else
- pedwarn ("ANSI C forbids variable-size array `%s'", name);
- }
- }
-
- /* Convert size to index_type, so that if it is a variable
- the computations will be done in the proper mode. */
- itype = fold (build (MINUS_EXPR, index_type,
- convert (index_type, size),
- convert (index_type, size_one_node)));
-
- if (size_varies)
- itype = variable_size (itype);
- itype = build_index_type (itype);
- }
-
-#if 0 /* This had bad results for pointers to arrays, as in
- union incomplete (*foo)[4]; */
- /* Complain about arrays of incomplete types, except in typedefs. */
-
- if (TYPE_SIZE (type) == 0
- /* Avoid multiple warnings for nested array types. */
- && TREE_CODE (type) != ARRAY_TYPE
- && !(specbits & (1 << (int) RID_TYPEDEF))
- && !C_TYPE_BEING_DEFINED (type))
- warning ("array type has incomplete element type");
-#endif
-
-#if 0 /* We shouldn't have a function type here at all!
- Functions aren't allowed as array elements. */
- if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
- && (constp || volatilep))
- pedwarn ("ANSI C forbids const or volatile function types");
-#endif
-
- /* Build the array type itself, then merge any constancy or
- volatility into the target type. We must do it in this order
- to ensure that the TYPE_MAIN_VARIANT field of the array type
- is set correctly. */
-
- type = build_array_type (type, itype);
- if (constp || volatilep)
- type = c_build_type_variant (type, constp, volatilep);
-
-#if 0 /* don't clear these; leave them set so that the array type
- or the variable is itself const or volatile. */
- constp = 0;
- volatilep = 0;
-#endif
-
- if (size_varies)
- C_TYPE_VARIABLE_SIZE (type) = 1;
- }
- else if (TREE_CODE (declarator) == CALL_EXPR)
- {
- int extern_ref = (!(specbits & (1 << (int) RID_AUTO))
- || current_binding_level == global_binding_level);
- tree arg_types;
-
- /* Declaring a function type.
- Make sure we have a valid type for the function to return. */
- if (type == error_mark_node)
- continue;
-
- size_varies = 0;
-
- /* Warn about some types functions can't return. */
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- error ("`%s' declared as function returning a function", name);
- type = integer_type_node;
- }
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- error ("`%s' declared as function returning an array", name);
- type = integer_type_node;
- }
-
-#ifndef TRADITIONAL_RETURN_FLOAT
- /* Traditionally, declaring return type float means double. */
-
- if (flag_traditional && TYPE_MAIN_VARIANT (type) == float_type_node)
- type = double_type_node;
-#endif /* TRADITIONAL_RETURN_FLOAT */
-
- /* If this is a block level extern, it must live past the end
- of the function so that we can check it against other extern
- declarations (IDENTIFIER_LIMBO_VALUE). */
- if (extern_ref && allocation_temporary_p ())
- end_temporary_allocation ();
-
- /* Construct the function type and go to the next
- inner layer of declarator. */
-
- arg_types = grokparms (TREE_OPERAND (declarator, 1),
- funcdef_flag
- /* Say it's a definition
- only for the CALL_EXPR
- closest to the identifier. */
- && TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE);
-#if 0 /* This seems to be false. We turn off temporary allocation
- above in this function if -traditional.
- And this code caused inconsistent results with prototypes:
- callers would ignore them, and pass arguments wrong. */
-
- /* Omit the arg types if -traditional, since the arg types
- and the list links might not be permanent. */
- type = build_function_type (type,
- flag_traditional
- ? NULL_TREE : arg_types);
-#endif
- /* ANSI seems to say that `const int foo ();'
- does not make the function foo const. */
- if (constp || volatilep)
- type = c_build_type_variant (type, constp, volatilep);
- constp = 0;
- volatilep = 0;
-
- type = build_function_type (type, arg_types);
- declarator = TREE_OPERAND (declarator, 0);
-
- /* Set the TYPE_CONTEXTs for each tagged type which is local to
- the formal parameter list of this FUNCTION_TYPE to point to
- the FUNCTION_TYPE node itself. */
-
- {
- register tree link;
-
- for (link = current_function_parm_tags;
- link;
- link = TREE_CHAIN (link))
- TYPE_CONTEXT (TREE_VALUE (link)) = type;
- }
- }
- else if (TREE_CODE (declarator) == INDIRECT_REF)
- {
- /* Merge any constancy or volatility into the target type
- for the pointer. */
-
- if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
- && (constp || volatilep))
- pedwarn ("ANSI C forbids const or volatile function types");
- if (constp || volatilep)
- type = c_build_type_variant (type, constp, volatilep);
- constp = 0;
- volatilep = 0;
- size_varies = 0;
-
- type = build_pointer_type (type);
-
- /* Process a list of type modifier keywords
- (such as const or volatile) that were given inside the `*'. */
-
- if (TREE_TYPE (declarator))
- {
- register tree typemodlist;
- int erred = 0;
- for (typemodlist = TREE_TYPE (declarator); typemodlist;
- typemodlist = TREE_CHAIN (typemodlist))
- {
- if (TREE_VALUE (typemodlist) == ridpointers[(int) RID_CONST])
- constp++;
- else if (TREE_VALUE (typemodlist) == ridpointers[(int) RID_VOLATILE])
- volatilep++;
- else if (!erred)
- {
- erred = 1;
- error ("invalid type modifier within pointer declarator");
- }
- }
- if (constp > 1)
- pedwarn ("duplicate `const'");
- if (volatilep > 1)
- pedwarn ("duplicate `volatile'");
- }
-
- declarator = TREE_OPERAND (declarator, 0);
- }
- else
- abort ();
-
- }
-
- /* Now TYPE has the actual type. */
-
- /* If this is declaring a typedef name, return a TYPE_DECL. */
-
- if (specbits & (1 << (int) RID_TYPEDEF))
- {
- tree decl;
- /* Note that the grammar rejects storage classes
- in typenames, fields or parameters */
- if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
- && (constp || volatilep))
- pedwarn ("ANSI C forbids const or volatile function types");
- if (constp || volatilep)
- type = c_build_type_variant (type, constp, volatilep);
- decl = build_decl (TYPE_DECL, declarator, type);
- if ((specbits & (1 << (int) RID_SIGNED))
- || (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
- C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
- pop_obstacks ();
- return decl;
- }
-
- /* Detect the case of an array type of unspecified size
- which came, as such, direct from a typedef name.
- We must copy the type, so that each identifier gets
- a distinct type, so that each identifier's size can be
- controlled separately by its own initializer. */
-
- if (type != 0 && typedef_type != 0
- && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (typedef_type)
- && TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == 0)
- {
- type = build_array_type (TREE_TYPE (type), 0);
- if (size_varies)
- C_TYPE_VARIABLE_SIZE (type) = 1;
- }
-
- /* If this is a type name (such as, in a cast or sizeof),
- compute the type and return it now. */
-
- if (decl_context == TYPENAME)
- {
- /* Note that the grammar rejects storage classes
- in typenames, fields or parameters */
- if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
- && (constp || volatilep))
- pedwarn ("ANSI C forbids const or volatile function types");
- if (constp || volatilep)
- type = c_build_type_variant (type, constp, volatilep);
- pop_obstacks ();
- return type;
- }
-
- /* Aside from typedefs and type names (handle above),
- `void' at top level (not within pointer)
- is allowed only in public variables.
- We don't complain about parms either, but that is because
- a better error message can be made later. */
-
- if (TYPE_MAIN_VARIANT (type) == void_type_node && decl_context != PARM
- && ! ((decl_context != FIELD && TREE_CODE (type) != FUNCTION_TYPE)
- && ((specbits & (1 << (int) RID_EXTERN))
- || (current_binding_level == global_binding_level
- && !(specbits
- & ((1 << (int) RID_STATIC) | (1 << (int) RID_REGISTER)))))))
- {
- error ("variable or field `%s' declared void", name);
- type = integer_type_node;
- }
-
- /* Now create the decl, which may be a VAR_DECL, a PARM_DECL
- or a FUNCTION_DECL, depending on DECL_CONTEXT and TYPE. */
-
- {
- register tree decl;
-
- if (decl_context == PARM)
- {
- tree type_as_written = type;
- tree main_type;
-
- /* A parameter declared as an array of T is really a pointer to T.
- One declared as a function is really a pointer to a function. */
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- /* Transfer const-ness of array into that of type pointed to. */
- type = TREE_TYPE (type);
- if (constp || volatilep)
- type = c_build_type_variant (type, constp, volatilep);
- type = build_pointer_type (type);
- volatilep = constp = 0;
- size_varies = 0;
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- if (pedantic && (constp || volatilep))
- pedwarn ("ANSI C forbids const or volatile function types");
- if (constp || volatilep)
- type = c_build_type_variant (type, constp, volatilep);
- type = build_pointer_type (type);
- volatilep = constp = 0;
- }
-
- decl = build_decl (PARM_DECL, declarator, type);
- if (size_varies)
- C_DECL_VARIABLE_SIZE (decl) = 1;
-
- /* Compute the type actually passed in the parmlist,
- for the case where there is no prototype.
- (For example, shorts and chars are passed as ints.)
- When there is a prototype, this is overridden later. */
-
- DECL_ARG_TYPE (decl) = type;
- main_type = (type == error_mark_node
- ? error_mark_node
- : TYPE_MAIN_VARIANT (type));
- if (main_type == float_type_node)
- DECL_ARG_TYPE (decl) = double_type_node;
- /* Don't use TYPE_PRECISION to decide whether to promote,
- because we should convert short if it's the same size as int,
- but we should not convert long if it's the same size as int. */
- else if (TREE_CODE (main_type) != ERROR_MARK
- && C_PROMOTING_INTEGER_TYPE_P (main_type))
- {
- if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)
- && TREE_UNSIGNED (type))
- DECL_ARG_TYPE (decl) = unsigned_type_node;
- else
- DECL_ARG_TYPE (decl) = integer_type_node;
- }
-
- DECL_ARG_TYPE_AS_WRITTEN (decl) = type_as_written;
- }
- else if (decl_context == FIELD)
- {
- /* Structure field. It may not be a function. */
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- error ("field `%s' declared as a function", name);
- type = build_pointer_type (type);
- }
- else if (TREE_CODE (type) != ERROR_MARK && TYPE_SIZE (type) == 0)
- {
- error ("field `%s' has incomplete type", name);
- type = error_mark_node;
- }
- /* Move type qualifiers down to element of an array. */
- if (TREE_CODE (type) == ARRAY_TYPE && (constp || volatilep))
- {
- type = build_array_type (c_build_type_variant (TREE_TYPE (type),
- constp, volatilep),
- TYPE_DOMAIN (type));
-#if 0 /* Leave the field const or volatile as well. */
- constp = volatilep = 0;
-#endif
- }
- decl = build_decl (FIELD_DECL, declarator, type);
- if (size_varies)
- C_DECL_VARIABLE_SIZE (decl) = 1;
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- /* Every function declaration is "external"
- except for those which are inside a function body
- in which `auto' is used.
- That is a case not specified by ANSI C,
- and we use it for forward declarations for nested functions. */
- int extern_ref = (!(specbits & (1 << (int) RID_AUTO))
- || current_binding_level == global_binding_level);
-
- if (specbits & (1 << (int) RID_AUTO)
- && (pedantic || current_binding_level == global_binding_level))
- pedwarn ("invalid storage class for function `%s'", name);
- if (specbits & (1 << (int) RID_REGISTER))
- error ("invalid storage class for function `%s'", name);
- /* Function declaration not at top level.
- Storage classes other than `extern' are not allowed
- and `extern' makes no difference. */
- if (current_binding_level != global_binding_level
- && (specbits & ((1 << (int) RID_STATIC) | (1 << (int) RID_INLINE)))
- && pedantic)
- pedwarn ("invalid storage class for function `%s'", name);
-
- /* If this is a block level extern, it must live past the end
- of the function so that we can check it against other
- extern declarations (IDENTIFIER_LIMBO_VALUE). */
- if (extern_ref && allocation_temporary_p ())
- end_temporary_allocation ();
-
- decl = build_decl (FUNCTION_DECL, declarator, type);
- decl = build_decl_attribute_variant (decl, decl_machine_attr);
-
- if (pedantic && (constp || volatilep)
- && ! DECL_IN_SYSTEM_HEADER (decl))
- pedwarn ("ANSI C forbids const or volatile functions");
-
- if (pedantic
- && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl))) == void_type_node
- && (TYPE_READONLY (TREE_TYPE (TREE_TYPE (decl)))
- || TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (decl))))
- && ! DECL_IN_SYSTEM_HEADER (decl))
- pedwarn ("ANSI C forbids const or volatile void function return type");
-
- if (volatilep
- && TREE_TYPE (TREE_TYPE (decl)) != void_type_node)
- warning ("`noreturn' function returns non-void value");
-
- if (extern_ref)
- DECL_EXTERNAL (decl) = 1;
- /* Record absence of global scope for `static' or `auto'. */
- TREE_PUBLIC (decl)
- = !(specbits & ((1 << (int) RID_STATIC) | (1 << (int) RID_AUTO)));
-
- /* Record presence of `inline', if it is reasonable. */
- if (inlinep)
- {
- tree last = tree_last (TYPE_ARG_TYPES (type));
-
- if (! strcmp (IDENTIFIER_POINTER (declarator), "main"))
- warning ("cannot inline function `main'");
- else if (last && (TYPE_MAIN_VARIANT (TREE_VALUE (last))
- != void_type_node))
- warning ("inline declaration ignored for function with `...'");
- else
- /* Assume that otherwise the function can be inlined. */
- DECL_INLINE (decl) = 1;
-
- if (specbits & (1 << (int) RID_EXTERN))
- current_extern_inline = 1;
- }
- }
- else
- {
- /* It's a variable. */
- /* An uninitialized decl with `extern' is a reference. */
- int extern_ref = !initialized && (specbits & (1 << (int) RID_EXTERN));
-
- /* Move type qualifiers down to element of an array. */
- if (TREE_CODE (type) == ARRAY_TYPE && (constp || volatilep))
- {
- type = build_array_type (c_build_type_variant (TREE_TYPE (type),
- constp, volatilep),
- TYPE_DOMAIN (type));
-#if 0 /* Leave the variable const or volatile as well. */
- constp = volatilep = 0;
-#endif
- }
-
- /* If this is a block level extern, it must live past the end
- of the function so that we can check it against other
- extern declarations (IDENTIFIER_LIMBO_VALUE). */
- if (extern_ref && allocation_temporary_p ())
- end_temporary_allocation ();
-
- decl = build_decl (VAR_DECL, declarator, type);
- if (size_varies)
- C_DECL_VARIABLE_SIZE (decl) = 1;
-
- if (inlinep)
- pedwarn_with_decl (decl, "variable `%s' declared `inline'");
-
- DECL_EXTERNAL (decl) = extern_ref;
- /* At top level, 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,
- the absence of both `static' and `register' makes it public. */
- if (current_binding_level == global_binding_level)
- {
- TREE_PUBLIC (decl)
- = !(specbits
- & ((1 << (int) RID_STATIC) | (1 << (int) RID_REGISTER)));
- TREE_STATIC (decl) = ! DECL_EXTERNAL (decl);
- }
- /* Not at top level, only `static' makes a static definition. */
- else
- {
- TREE_STATIC (decl) = (specbits & (1 << (int) RID_STATIC)) != 0;
- TREE_PUBLIC (decl) = DECL_EXTERNAL (decl);
- }
-
- if (specbits & 1 << (int) RID_ITERATOR)
- ITERATOR_P (decl) = 1;
- }
-
- /* Record `register' declaration for warnings on &
- and in case doing stupid register allocation. */
-
- if (specbits & (1 << (int) RID_REGISTER))
- DECL_REGISTER (decl) = 1;
-
- /* Record constancy and volatility. */
-
- if (constp)
- TREE_READONLY (decl) = 1;
- if (volatilep)
- {
- TREE_SIDE_EFFECTS (decl) = 1;
- TREE_THIS_VOLATILE (decl) = 1;
- }
- /* If a type has volatile components, it should be stored in memory.
- Otherwise, the fact that those components are volatile
- will be ignored, and would even crash the compiler. */
- if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (decl)))
- mark_addressable (decl);
-
- pop_obstacks ();
-
- return decl;
- }
-}
-
-/* Decode the parameter-list info for a function type or function definition.
- The argument is the value returned by `get_parm_info' (or made in parse.y
- if there is an identifier list instead of a parameter decl list).
- These two functions are separate because when a function returns
- or receives functions then each is called multiple times but the order
- of calls is different. The last call to `grokparms' is always the one
- that contains the formal parameter names of a function definition.
-
- Store in `last_function_parms' a chain of the decls of parms.
- Also store in `last_function_parm_tags' a chain of the struct, union,
- and enum tags declared among the parms.
-
- Return a list of arg types to use in the FUNCTION_TYPE for this function.
-
- FUNCDEF_FLAG is nonzero for a function definition, 0 for
- a mere declaration. A nonempty identifier-list gets an error message
- when FUNCDEF_FLAG is zero. */
-
-static tree
-grokparms (parms_info, funcdef_flag)
- tree parms_info;
- int funcdef_flag;
-{
- tree first_parm = TREE_CHAIN (parms_info);
-
- last_function_parms = TREE_PURPOSE (parms_info);
- last_function_parm_tags = TREE_VALUE (parms_info);
-
- if (warn_strict_prototypes && first_parm == 0 && !funcdef_flag
- && !in_system_header)
- warning ("function declaration isn't a prototype");
-
- if (first_parm != 0
- && TREE_CODE (TREE_VALUE (first_parm)) == IDENTIFIER_NODE)
- {
- if (! funcdef_flag)
- pedwarn ("parameter names (without types) in function declaration");
-
- last_function_parms = first_parm;
- return 0;
- }
- else
- {
- tree parm;
- tree typelt;
- /* We no longer test FUNCDEF_FLAG.
- If the arg types are incomplete in a declaration,
- they must include undefined tags.
- These tags can never be defined in the scope of the declaration,
- so the types can never be completed,
- and no call can be compiled successfully. */
-#if 0
- /* In a fcn definition, arg types must be complete. */
- if (funcdef_flag)
-#endif
- for (parm = last_function_parms, typelt = first_parm;
- parm;
- parm = TREE_CHAIN (parm))
- /* Skip over any enumeration constants declared here. */
- if (TREE_CODE (parm) == PARM_DECL)
- {
- /* Barf if the parameter itself has an incomplete type. */
- tree type = TREE_VALUE (typelt);
- if (TYPE_SIZE (type) == 0)
- {
- if (funcdef_flag && DECL_NAME (parm) != 0)
- error ("parameter `%s' has incomplete type",
- IDENTIFIER_POINTER (DECL_NAME (parm)));
- else
- warning ("parameter has incomplete type");
- if (funcdef_flag)
- {
- TREE_VALUE (typelt) = error_mark_node;
- TREE_TYPE (parm) = error_mark_node;
- }
- }
-#if 0 /* This has been replaced by parm_tags_warning
- which uses a more accurate criterion for what to warn about. */
- else
- {
- /* Now warn if is a pointer to an incomplete type. */
- while (TREE_CODE (type) == POINTER_TYPE
- || TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
- type = TYPE_MAIN_VARIANT (type);
- if (TYPE_SIZE (type) == 0)
- {
- if (DECL_NAME (parm) != 0)
- warning ("parameter `%s' points to incomplete type",
- IDENTIFIER_POINTER (DECL_NAME (parm)));
- else
- warning ("parameter points to incomplete type");
- }
- }
-#endif
- typelt = TREE_CHAIN (typelt);
- }
-
- /* Allocate the list of types the way we allocate a type. */
- if (first_parm && ! TREE_PERMANENT (first_parm))
- {
- /* Construct a copy of the list of types
- on the saveable obstack. */
- tree result = NULL;
- for (typelt = first_parm; typelt; typelt = TREE_CHAIN (typelt))
- result = saveable_tree_cons (NULL_TREE, TREE_VALUE (typelt),
- result);
- return nreverse (result);
- }
- else
- /* The list we have is permanent already. */
- return first_parm;
- }
-}
-
-
-/* Return a tree_list node with info on a parameter list just parsed.
- The TREE_PURPOSE is a chain of decls of those parms.
- The TREE_VALUE is a list of structure, union and enum tags defined.
- The TREE_CHAIN is a list of argument types to go in the FUNCTION_TYPE.
- This tree_list node is later fed to `grokparms'.
-
- VOID_AT_END nonzero means append `void' to the end of the type-list.
- Zero means the parmlist ended with an ellipsis so don't append `void'. */
-
-tree
-get_parm_info (void_at_end)
- int void_at_end;
-{
- register tree decl, t;
- register tree types = 0;
- int erred = 0;
- tree tags = gettags ();
- tree parms = getdecls ();
- tree new_parms = 0;
- tree order = current_binding_level->parm_order;
-
- /* Just `void' (and no ellipsis) is special. There are really no parms. */
- if (void_at_end && parms != 0
- && TREE_CHAIN (parms) == 0
- && TYPE_MAIN_VARIANT (TREE_TYPE (parms)) == void_type_node
- && DECL_NAME (parms) == 0)
- {
- parms = NULL_TREE;
- storedecls (NULL_TREE);
- return saveable_tree_cons (NULL_TREE, NULL_TREE,
- saveable_tree_cons (NULL_TREE, void_type_node, NULL_TREE));
- }
-
- /* Extract enumerator values and other non-parms declared with the parms.
- Likewise any forward parm decls that didn't have real parm decls. */
- for (decl = parms; decl; )
- {
- tree next = TREE_CHAIN (decl);
-
- if (TREE_CODE (decl) != PARM_DECL)
- {
- TREE_CHAIN (decl) = new_parms;
- new_parms = decl;
- }
- else if (TREE_ASM_WRITTEN (decl))
- {
- error_with_decl (decl, "parameter `%s' has just a forward declaration");
- TREE_CHAIN (decl) = new_parms;
- new_parms = decl;
- }
- decl = next;
- }
-
- /* Put the parm decls back in the order they were in in the parm list. */
- for (t = order; t; t = TREE_CHAIN (t))
- {
- if (TREE_CHAIN (t))
- TREE_CHAIN (TREE_VALUE (t)) = TREE_VALUE (TREE_CHAIN (t));
- else
- TREE_CHAIN (TREE_VALUE (t)) = 0;
- }
-
- new_parms = chainon (order ? nreverse (TREE_VALUE (order)) : 0,
- new_parms);
-
- /* Store the parmlist in the binding level since the old one
- is no longer a valid list. (We have changed the chain pointers.) */
- storedecls (new_parms);
-
- for (decl = new_parms; decl; decl = TREE_CHAIN (decl))
- /* There may also be declarations for enumerators if an enumeration
- type is declared among the parms. Ignore them here. */
- if (TREE_CODE (decl) == PARM_DECL)
- {
- /* Since there is a prototype,
- args are passed in their declared types. */
- tree type = TREE_TYPE (decl);
- DECL_ARG_TYPE (decl) = type;
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
- DECL_ARG_TYPE (decl) = integer_type_node;
-#endif
-
- types = saveable_tree_cons (NULL_TREE, TREE_TYPE (decl), types);
- if (TYPE_MAIN_VARIANT (TREE_VALUE (types)) == void_type_node && ! erred
- && DECL_NAME (decl) == 0)
- {
- error ("`void' in parameter list must be the entire list");
- erred = 1;
- }
- }
-
- if (void_at_end)
- return saveable_tree_cons (new_parms, tags,
- nreverse (saveable_tree_cons (NULL_TREE, void_type_node, types)));
-
- return saveable_tree_cons (new_parms, tags, nreverse (types));
-}
-
-/* At end of parameter list, warn about any struct, union or enum tags
- defined within. Do so because these types cannot ever become complete. */
-
-void
-parmlist_tags_warning ()
-{
- tree elt;
- static int already;
-
- for (elt = current_binding_level->tags; elt; elt = TREE_CHAIN (elt))
- {
- enum tree_code code = TREE_CODE (TREE_VALUE (elt));
- /* An anonymous union parm type is meaningful as a GNU extension.
- So don't warn for that. */
- if (code == UNION_TYPE && !pedantic)
- continue;
- if (TREE_PURPOSE (elt) != 0)
- warning ("`%s %s' declared inside parameter list",
- (code == RECORD_TYPE ? "struct"
- : code == UNION_TYPE ? "union"
- : "enum"),
- IDENTIFIER_POINTER (TREE_PURPOSE (elt)));
- else
- warning ("anonymous %s declared inside parameter list",
- (code == RECORD_TYPE ? "struct"
- : code == UNION_TYPE ? "union"
- : "enum"));
-
- if (! already)
- {
- warning ("its scope is only this definition or declaration,");
- warning ("which is probably not what you want.");
- already = 1;
- }
- }
-}
-
-/* Get the struct, enum or union (CODE says which) with tag NAME.
- Define the tag as a forward-reference if it is not defined. */
-
-tree
-xref_tag (code, name)
- enum tree_code code;
- tree name;
-{
- int temporary = allocation_temporary_p ();
-
- /* If a cross reference is requested, look up the type
- already defined for this tag and return it. */
-
- register tree ref = lookup_tag (code, name, current_binding_level, 0);
- /* Even if this is the wrong type of tag, return what we found.
- There will be an error message anyway, from pending_xref_error.
- If we create an empty xref just for an invalid use of the type,
- the main result is to create lots of superfluous error messages. */
- if (ref)
- return ref;
-
- push_obstacks_nochange ();
-
- if (current_binding_level == global_binding_level && temporary)
- end_temporary_allocation ();
-
- /* If no such tag is yet defined, create a forward-reference node
- and record it as the "definition".
- When a real declaration of this type is found,
- the forward-reference will be altered into a real type. */
-
- ref = make_node (code);
- if (code == ENUMERAL_TYPE)
- {
- /* (In ANSI, Enums can be referred to only if already defined.) */
- if (pedantic)
- pedwarn ("ANSI C forbids forward references to `enum' types");
- /* Give the type a default layout like unsigned int
- to avoid crashing if it does not get defined. */
- TYPE_MODE (ref) = TYPE_MODE (unsigned_type_node);
- TYPE_ALIGN (ref) = TYPE_ALIGN (unsigned_type_node);
- TREE_UNSIGNED (ref) = 1;
- TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node);
- TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node);
- TYPE_MAX_VALUE (ref) = TYPE_MAX_VALUE (unsigned_type_node);
- }
-
- pushtag (name, ref);
-
- pop_obstacks ();
-
- return ref;
-}
-
-/* Make sure that the tag NAME is defined *in the current binding level*
- at least as a forward reference.
- CODE says which kind of tag NAME ought to be.
-
- We also do a push_obstacks_nochange
- whose matching pop is in finish_struct. */
-
-tree
-start_struct (code, name)
- enum tree_code code;
- tree name;
-{
- /* If there is already a tag defined at this binding level
- (as a forward reference), just return it. */
-
- register tree ref = 0;
-
- push_obstacks_nochange ();
- if (current_binding_level == global_binding_level)
- end_temporary_allocation ();
-
- if (name != 0)
- ref = lookup_tag (code, name, current_binding_level, 1);
- if (ref && TREE_CODE (ref) == code)
- {
- C_TYPE_BEING_DEFINED (ref) = 1;
- if (TYPE_FIELDS (ref))
- error ((code == UNION_TYPE ? "redefinition of `union %s'"
- : "redefinition of `struct %s'"),
- IDENTIFIER_POINTER (name));
-
- return ref;
- }
-
- /* Otherwise create a forward-reference just so the tag is in scope. */
-
- ref = make_node (code);
- pushtag (name, ref);
- C_TYPE_BEING_DEFINED (ref) = 1;
- TYPE_PACKED (ref) = flag_pack_struct;
- return ref;
-}
-
-/* Process the specs, declarator (NULL if omitted) and width (NULL if omitted)
- of a structure component, returning a FIELD_DECL node.
- WIDTH is non-NULL for bit fields only, and is an INTEGER_CST node.
-
- This is done during the parsing of the struct declaration.
- The FIELD_DECL nodes are chained together and the lot of them
- are ultimately passed to `build_struct' to make the RECORD_TYPE node. */
-
-tree
-grokfield (filename, line, declarator, declspecs, width)
- char *filename;
- int line;
- tree declarator, declspecs, width;
-{
- tree value;
-
- /* The corresponding pop_obstacks is in finish_decl. */
- push_obstacks_nochange ();
-
- value = grokdeclarator (declarator, declspecs, width ? BITFIELD : FIELD, 0);
-
- finish_decl (value, NULL_TREE, NULL_TREE);
- DECL_INITIAL (value) = width;
-
- maybe_objc_check_decl (value);
- return value;
-}
-
-/* Function to help qsort sort FIELD_DECLs by name order. */
-
-static int
-field_decl_cmp (xp, yp)
- const GENERIC_PTR xp;
- const GENERIC_PTR yp;
-{
- tree *x = (tree *)xp, *y = (tree *)yp;
-
- if (DECL_NAME (*x) == DECL_NAME (*y))
- return 0;
- if (DECL_NAME (*x) == NULL)
- return -1;
- if (DECL_NAME (*y) == NULL)
- return 1;
- if (DECL_NAME (*x) < DECL_NAME (*y))
- return -1;
- return 1;
-}
-
-/* Fill in the fields of a RECORD_TYPE or UNION_TYPE node, T.
- FIELDLIST is a chain of FIELD_DECL nodes for the fields.
- ATTRIBUTES are attributes to be applied to the structure.
-
- We also do a pop_obstacks to match the push in start_struct. */
-
-tree
-finish_struct (t, fieldlist, attributes)
- tree t;
- tree fieldlist;
- tree attributes;
-{
- register tree x;
- int old_momentary;
- int toplevel = global_binding_level == current_binding_level;
-
- /* If this type was previously laid out as a forward reference,
- make sure we lay it out again. */
-
- TYPE_SIZE (t) = 0;
-
- decl_attributes (t, attributes, NULL_TREE);
-
- /* Nameless union parm types are useful as GCC extension. */
- if (! (TREE_CODE (t) == UNION_TYPE && TYPE_NAME (t) == 0) && !pedantic)
- /* Otherwise, warn about any struct or union def. in parmlist. */
- if (in_parm_level_p ())
- {
- if (pedantic)
- pedwarn ((TREE_CODE (t) == UNION_TYPE ? "union defined inside parms"
- : "structure defined inside parms"));
- else if (! flag_traditional)
- warning ((TREE_CODE (t) == UNION_TYPE ? "union defined inside parms"
- : "structure defined inside parms"));
- }
-
- old_momentary = suspend_momentary ();
-
- if (pedantic)
- {
- for (x = fieldlist; x; x = TREE_CHAIN (x))
- if (DECL_NAME (x) != 0)
- break;
-
- if (x == 0)
- pedwarn ("%s has no %smembers",
- (TREE_CODE (t) == UNION_TYPE ? "union" : "structure"),
- (fieldlist ? "named " : ""));
- }
-
- /* Install struct as DECL_CONTEXT of each field decl.
- Also process specified field sizes.
- Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
- The specified size is found in the DECL_INITIAL.
- Store 0 there, except for ": 0" fields (so we can find them
- and delete them, below). */
-
- for (x = fieldlist; x; x = TREE_CHAIN (x))
- {
- DECL_CONTEXT (x) = t;
- DECL_PACKED (x) |= TYPE_PACKED (t);
- DECL_FIELD_SIZE (x) = 0;
-
- /* If any field is const, the structure type is pseudo-const. */
- if (TREE_READONLY (x))
- C_TYPE_FIELDS_READONLY (t) = 1;
- else
- {
- /* A field that is pseudo-const makes the structure likewise. */
- tree t1 = TREE_TYPE (x);
- while (TREE_CODE (t1) == ARRAY_TYPE)
- t1 = TREE_TYPE (t1);
- if ((TREE_CODE (t1) == RECORD_TYPE || TREE_CODE (t1) == UNION_TYPE)
- && C_TYPE_FIELDS_READONLY (t1))
- C_TYPE_FIELDS_READONLY (t) = 1;
- }
-
- /* Any field that is volatile means variables of this type must be
- treated in some ways as volatile. */
- if (TREE_THIS_VOLATILE (x))
- C_TYPE_FIELDS_VOLATILE (t) = 1;
-
- /* Any field of nominal variable size implies structure is too. */
- if (C_DECL_VARIABLE_SIZE (x))
- C_TYPE_VARIABLE_SIZE (t) = 1;
-
- /* Detect invalid nested redefinition. */
- if (TREE_TYPE (x) == t)
- error ("nested redefinition of `%s'",
- IDENTIFIER_POINTER (TYPE_NAME (t)));
-
- /* Detect invalid bit-field size. */
- if (DECL_INITIAL (x))
- STRIP_NOPS (DECL_INITIAL (x));
- if (DECL_INITIAL (x))
- {
- if (TREE_CODE (DECL_INITIAL (x)) == INTEGER_CST)
- constant_expression_warning (DECL_INITIAL (x));
- else
- {
- error_with_decl (x, "bit-field `%s' width not an integer constant");
- DECL_INITIAL (x) = NULL;
- }
- }
-
- /* Detect invalid bit-field type. */
- if (DECL_INITIAL (x)
- && TREE_CODE (TREE_TYPE (x)) != INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE)
- {
- error_with_decl (x, "bit-field `%s' has invalid type");
- DECL_INITIAL (x) = NULL;
- }
- if (DECL_INITIAL (x) && pedantic
- && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != integer_type_node
- && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != unsigned_type_node
- /* Accept an enum that's equivalent to int or unsigned int. */
- && !(TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
- && (TYPE_PRECISION (TREE_TYPE (x))
- == TYPE_PRECISION (integer_type_node))))
- pedwarn_with_decl (x, "bit-field `%s' type invalid in ANSI C");
-
- /* Detect and ignore out of range field width. */
- if (DECL_INITIAL (x))
- {
- unsigned HOST_WIDE_INT width = TREE_INT_CST_LOW (DECL_INITIAL (x));
-
- if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0)
- {
- DECL_INITIAL (x) = NULL;
- error_with_decl (x, "negative width in bit-field `%s'");
- }
- else if (TREE_INT_CST_HIGH (DECL_INITIAL (x)) != 0
- || width > TYPE_PRECISION (TREE_TYPE (x)))
- {
- DECL_INITIAL (x) = NULL;
- pedwarn_with_decl (x, "width of `%s' exceeds its type");
- }
- else if (width == 0 && DECL_NAME (x) != 0)
- {
- error_with_decl (x, "zero width for bit-field `%s'");
- DECL_INITIAL (x) = NULL;
- }
- }
-
- /* Process valid field width. */
- if (DECL_INITIAL (x))
- {
- register int width = TREE_INT_CST_LOW (DECL_INITIAL (x));
-
- if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
- && (width < min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)),
- TREE_UNSIGNED (TREE_TYPE (x)))
- || width < min_precision (TYPE_MAX_VALUE (TREE_TYPE (x)),
- TREE_UNSIGNED (TREE_TYPE (x)))))
- warning_with_decl (x, "`%s' is narrower than values of its type");
-
- DECL_FIELD_SIZE (x) = width;
- DECL_BIT_FIELD (x) = DECL_C_BIT_FIELD (x) = 1;
- DECL_INITIAL (x) = NULL;
-
- if (width == 0)
- {
- /* field size 0 => force desired amount of alignment. */
-#ifdef EMPTY_FIELD_BOUNDARY
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x), EMPTY_FIELD_BOUNDARY);
-#endif
-#ifdef PCC_BITFIELD_TYPE_MATTERS
- if (PCC_BITFIELD_TYPE_MATTERS)
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x),
- TYPE_ALIGN (TREE_TYPE (x)));
-#endif
- }
- }
- else if (TREE_TYPE (x) != error_mark_node)
- {
- int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT
- : TYPE_ALIGN (TREE_TYPE (x)));
- /* Non-bit-fields are aligned for their type, except packed
- fields which require only BITS_PER_UNIT alignment. */
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x), min_align);
- }
- }
-
- /* Now DECL_INITIAL is null on all members. */
-
- /* Delete all duplicate fields from the fieldlist */
- for (x = fieldlist; x && TREE_CHAIN (x);)
- /* Anonymous fields aren't duplicates. */
- if (DECL_NAME (TREE_CHAIN (x)) == 0)
- x = TREE_CHAIN (x);
- else
- {
- register tree y = fieldlist;
-
- while (1)
- {
- if (DECL_NAME (y) == DECL_NAME (TREE_CHAIN (x)))
- break;
- if (y == x)
- break;
- y = TREE_CHAIN (y);
- }
- if (DECL_NAME (y) == DECL_NAME (TREE_CHAIN (x)))
- {
- error_with_decl (TREE_CHAIN (x), "duplicate member `%s'");
- TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x));
- }
- else x = TREE_CHAIN (x);
- }
-
- /* Now we have the nearly final fieldlist. Record it,
- then lay out the structure or union (including the fields). */
-
- TYPE_FIELDS (t) = fieldlist;
-
- layout_type (t);
-
- /* Delete all zero-width bit-fields from the front of the fieldlist */
- while (fieldlist
- && DECL_INITIAL (fieldlist))
- fieldlist = TREE_CHAIN (fieldlist);
- /* Delete all such members from the rest of the fieldlist */
- for (x = fieldlist; x;)
- {
- if (TREE_CHAIN (x) && DECL_INITIAL (TREE_CHAIN (x)))
- TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x));
- else x = TREE_CHAIN (x);
- }
-
- /* Now we have the truly final field list.
- Store it in this type and in the variants. */
-
- TYPE_FIELDS (t) = fieldlist;
-
- /* If there are lots of fields, sort so we can look through them fast.
- We arbitrarily consider 16 or more elts to be "a lot". */
- {
- int len = 0;
-
- for (x = fieldlist; x; x = TREE_CHAIN (x))
- {
- if (len > 15)
- break;
- len += 1;
- }
- if (len > 15)
- {
- tree *field_array;
- char *space;
-
- len += list_length (x);
- /* Use the same allocation policy here that make_node uses, to
- ensure that this lives as long as the rest of the struct decl.
- All decls in an inline function need to be saved. */
- if (allocation_temporary_p ())
- space = savealloc (sizeof (struct lang_type) + len * sizeof (tree));
- else
- space = oballoc (sizeof (struct lang_type) + len * sizeof (tree));
-
- TYPE_LANG_SPECIFIC (t) = (struct lang_type *) space;
- TYPE_LANG_SPECIFIC (t)->len = len;
-
- field_array = &TYPE_LANG_SPECIFIC (t)->elts[0];
- len = 0;
- for (x = fieldlist; x; x = TREE_CHAIN (x))
- field_array[len++] = x;
-
- qsort (field_array, len, sizeof (tree), field_decl_cmp);
- }
- }
-
- for (x = TYPE_MAIN_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x))
- {
- TYPE_FIELDS (x) = TYPE_FIELDS (t);
- TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t);
- TYPE_ALIGN (x) = TYPE_ALIGN (t);
- }
-
- /* If this was supposed to be a transparent union, but we can't
- make it one, warn and turn off the flag. */
- if (TREE_CODE (t) == UNION_TYPE
- && TYPE_TRANSPARENT_UNION (t)
- && TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t)))
- {
- TYPE_TRANSPARENT_UNION (t) = 0;
- warning ("union cannot be made transparent");
- }
-
- /* If this structure or union completes the type of any previous
- variable declaration, lay it out and output its rtl. */
-
- if (current_binding_level->n_incomplete != 0)
- {
- tree decl;
- for (decl = current_binding_level->names; decl; decl = TREE_CHAIN (decl))
- {
- if (TREE_TYPE (decl) == t
- && TREE_CODE (decl) != TYPE_DECL)
- {
- layout_decl (decl, 0);
- /* This is a no-op in c-lang.c or something real in objc-actions.c. */
- maybe_objc_check_decl (decl);
- rest_of_decl_compilation (decl, NULL_PTR, toplevel, 0);
- if (! toplevel)
- expand_decl (decl);
- --current_binding_level->n_incomplete;
- }
- else if (TYPE_SIZE (TREE_TYPE (decl)) == 0
- && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
- {
- tree element = TREE_TYPE (decl);
- while (TREE_CODE (element) == ARRAY_TYPE)
- element = TREE_TYPE (element);
- if (element == t)
- layout_array_type (TREE_TYPE (decl));
- }
- }
- }
-
- resume_momentary (old_momentary);
-
- /* Finish debugging output for this type. */
- rest_of_type_compilation (t, toplevel);
-
- /* The matching push is in start_struct. */
- pop_obstacks ();
-
- return t;
-}
-
-/* Lay out the type T, and its element type, and so on. */
-
-static void
-layout_array_type (t)
- tree t;
-{
- if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
- layout_array_type (TREE_TYPE (t));
- layout_type (t);
-}
-
-/* Begin compiling the definition of an enumeration type.
- NAME is its name (or null if anonymous).
- Returns the type object, as yet incomplete.
- Also records info about it so that build_enumerator
- may be used to declare the individual values as they are read. */
-
-tree
-start_enum (name)
- tree name;
-{
- register tree enumtype = 0;
-
- /* 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 != 0)
- enumtype = lookup_tag (ENUMERAL_TYPE, name, current_binding_level, 1);
-
- /* The corresponding pop_obstacks is in finish_enum. */
- push_obstacks_nochange ();
- /* If these symbols and types are global, make them permanent. */
- if (current_binding_level == global_binding_level)
- end_temporary_allocation ();
-
- if (enumtype == 0 || TREE_CODE (enumtype) != ENUMERAL_TYPE)
- {
- enumtype = make_node (ENUMERAL_TYPE);
- pushtag (name, enumtype);
- }
-
- C_TYPE_BEING_DEFINED (enumtype) = 1;
-
- if (TYPE_VALUES (enumtype) != 0)
- {
- /* This enum is a named one that has been declared already. */
- error ("redeclaration of `enum %s'", IDENTIFIER_POINTER (name));
-
- /* Completely replace its old definition.
- The old enumerators remain defined, however. */
- TYPE_VALUES (enumtype) = 0;
- }
-
- enum_next_value = integer_zero_node;
- enum_overflow = 0;
-
- if (flag_short_enums)
- TYPE_PACKED (enumtype) = 1;
-
- return enumtype;
-}
-
-/* After processing and defining all the values of an enumeration type,
- install their decls in the enumeration type and finish it off.
- ENUMTYPE is the type object, VALUES a list of decl-value pairs,
- and ATTRIBUTES are the specified attributes.
- Returns ENUMTYPE. */
-
-tree
-finish_enum (enumtype, values, attributes)
- tree enumtype;
- tree values;
- tree attributes;
-{
- register tree pair, tem;
- tree minnode = 0, maxnode = 0;
- int lowprec, highprec, precision;
- int toplevel = global_binding_level == current_binding_level;
-
- if (in_parm_level_p ())
- warning ("enum defined inside parms");
-
- decl_attributes (enumtype, attributes, NULL_TREE);
-
- /* Calculate the maximum value of any enumerator in this type. */
-
- if (values == error_mark_node)
- minnode = maxnode = integer_zero_node;
- else
- for (pair = values; pair; pair = TREE_CHAIN (pair))
- {
- tree value = TREE_VALUE (pair);
- if (pair == values)
- minnode = maxnode = TREE_VALUE (pair);
- else
- {
- if (tree_int_cst_lt (maxnode, value))
- maxnode = value;
- if (tree_int_cst_lt (value, minnode))
- minnode = value;
- }
- }
-
- TYPE_MIN_VALUE (enumtype) = minnode;
- TYPE_MAX_VALUE (enumtype) = maxnode;
-
- /* An enum can have some negative values; then it is signed. */
- TREE_UNSIGNED (enumtype) = tree_int_cst_sgn (minnode) >= 0;
-
- /* Determine the precision this type needs. */
-
- lowprec = min_precision (minnode, TREE_UNSIGNED (enumtype));
- highprec = min_precision (maxnode, TREE_UNSIGNED (enumtype));
- precision = MAX (lowprec, highprec);
-
- if (TYPE_PACKED (enumtype) || precision > TYPE_PRECISION (integer_type_node))
- {
- tree narrowest = type_for_size (precision, 1);
- if (narrowest == 0)
- {
- warning ("enumeration values exceed range of largest integer");
- narrowest = long_long_integer_type_node;
- }
-
- TYPE_PRECISION (enumtype) = TYPE_PRECISION (narrowest);
- }
- else
- TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node);
-
- TYPE_SIZE (enumtype) = 0;
- layout_type (enumtype);
-
- if (values != error_mark_node)
- {
- /* Change the type of the enumerators to be the enum type.
- Formerly this was done only for enums that fit in an int,
- but the comment said it was done only for enums wider than int.
- It seems necessary to do this for wide enums,
- and best not to change what's done for ordinary narrower ones. */
- for (pair = values; pair; pair = TREE_CHAIN (pair))
- {
- TREE_TYPE (TREE_PURPOSE (pair)) = enumtype;
- DECL_SIZE (TREE_PURPOSE (pair)) = TYPE_SIZE (enumtype);
- if (TREE_CODE (TREE_PURPOSE (pair)) != FUNCTION_DECL)
- DECL_ALIGN (TREE_PURPOSE (pair)) = TYPE_ALIGN (enumtype);
- }
-
- /* Replace the decl nodes in VALUES with their names. */
- for (pair = values; pair; pair = TREE_CHAIN (pair))
- TREE_PURPOSE (pair) = DECL_NAME (TREE_PURPOSE (pair));
-
- TYPE_VALUES (enumtype) = values;
- }
-
- /* Fix up all variant types of this enum type. */
- for (tem = TYPE_MAIN_VARIANT (enumtype); tem; tem = TYPE_NEXT_VARIANT (tem))
- {
- TYPE_VALUES (tem) = TYPE_VALUES (enumtype);
- TYPE_MIN_VALUE (tem) = TYPE_MIN_VALUE (enumtype);
- TYPE_MAX_VALUE (tem) = TYPE_MAX_VALUE (enumtype);
- TYPE_SIZE (tem) = TYPE_SIZE (enumtype);
- TYPE_MODE (tem) = TYPE_MODE (enumtype);
- TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype);
- TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype);
- TREE_UNSIGNED (tem) = TREE_UNSIGNED (enumtype);
- }
-
- /* Finish debugging output for this type. */
- rest_of_type_compilation (enumtype, toplevel);
-
- /* This matches a push in start_enum. */
- pop_obstacks ();
-
- return enumtype;
-}
-
-/* Build and install a CONST_DECL for one value of the
- current enumeration type (one that was begun with start_enum).
- Return a tree-list containing the CONST_DECL and its value.
- Assignment of sequential values by default is handled here. */
-
-tree
-build_enumerator (name, value)
- tree name, value;
-{
- register tree decl, type;
-
- /* Validate and default VALUE. */
-
- /* Remove no-op casts from the value. */
- if (value)
- STRIP_TYPE_NOPS (value);
-
- if (value != 0)
- {
- if (TREE_CODE (value) == INTEGER_CST)
- {
- value = default_conversion (value);
- constant_expression_warning (value);
- }
- else
- {
- error ("enumerator value for `%s' not integer constant",
- IDENTIFIER_POINTER (name));
- value = 0;
- }
- }
-
- /* Default based on previous value. */
- /* It should no longer be possible to have NON_LVALUE_EXPR
- in the default. */
- if (value == 0)
- {
- value = enum_next_value;
- if (enum_overflow)
- error ("overflow in enumeration values");
- }
-
- if (pedantic && ! int_fits_type_p (value, integer_type_node))
- {
- pedwarn ("ANSI C restricts enumerator values to range of `int'");
- value = integer_zero_node;
- }
-
- /* Set basis for default for next value. */
- enum_next_value = build_binary_op (PLUS_EXPR, value, integer_one_node, 0);
- enum_overflow = tree_int_cst_lt (enum_next_value, value);
-
- /* Now create a declaration for the enum value name. */
-
- type = TREE_TYPE (value);
- type = type_for_size (MAX (TYPE_PRECISION (type),
- TYPE_PRECISION (integer_type_node)),
- ((flag_traditional
- || TYPE_PRECISION (type) >= TYPE_PRECISION (integer_type_node))
- && TREE_UNSIGNED (type)));
-
- decl = build_decl (CONST_DECL, name, type);
- DECL_INITIAL (decl) = value;
- TREE_TYPE (value) = type;
- pushdecl (decl);
-
- return saveable_tree_cons (decl, value, NULL_TREE);
-}
-
-/* Create the FUNCTION_DECL for a function definition.
- DECLSPECS, DECLARATOR, PREFIX_ATTRIBUTES and ATTRIBUTES are the parts of
- the declaration; they describe the function's name and the type it returns,
- but twisted together in a fashion that parallels the syntax of C.
-
- This function creates a binding context for the function body
- as well as setting up the FUNCTION_DECL in current_function_decl.
-
- Returns 1 on success. If the DECLARATOR is not suitable for a function
- (it defines a datum instead), we return 0, which tells
- yyparse to report a parse error.
-
- NESTED is nonzero for a function nested within another function. */
-
-int
-start_function (declspecs, declarator, prefix_attributes, attributes, nested)
- tree declarator, declspecs, prefix_attributes, attributes;
- int nested;
-{
- tree decl1, old_decl;
- tree restype;
- int old_immediate_size_expand = immediate_size_expand;
-
- current_function_returns_value = 0; /* Assume, until we see it does. */
- current_function_returns_null = 0;
- warn_about_return_type = 0;
- current_extern_inline = 0;
- c_function_varargs = 0;
- named_labels = 0;
- shadowed_labels = 0;
-
- /* Don't expand any sizes in the return type of the function. */
- immediate_size_expand = 0;
-
- decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1);
-
- /* If the declarator is not suitable for a function definition,
- cause a syntax error. */
- if (decl1 == 0)
- return 0;
-
- decl_attributes (decl1, prefix_attributes, attributes);
-
- announce_function (decl1);
-
- if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl1))) == 0)
- {
- error ("return-type is an incomplete type");
- /* Make it return void instead. */
- TREE_TYPE (decl1)
- = build_function_type (void_type_node,
- TYPE_ARG_TYPES (TREE_TYPE (decl1)));
- }
-
- if (warn_about_return_type)
- warning ("return-type defaults to `int'");
-
- /* Save the parm names or decls from this function's declarator
- where store_parm_decls will find them. */
- current_function_parms = last_function_parms;
- current_function_parm_tags = last_function_parm_tags;
-
- /* Make the init_value nonzero so pushdecl knows this is not tentative.
- error_mark_node is replaced below (in poplevel) with the BLOCK. */
- DECL_INITIAL (decl1) = error_mark_node;
-
- /* If this definition isn't a prototype and we had a prototype declaration
- before, copy the arg type info from that prototype.
- But not if what we had before was a builtin function. */
- old_decl = lookup_name_current_level (DECL_NAME (decl1));
- if (old_decl != 0 && TREE_CODE (TREE_TYPE (old_decl)) == FUNCTION_TYPE
- && !DECL_BUILT_IN (old_decl)
- && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
- == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (old_decl))))
- && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0)
- {
- TREE_TYPE (decl1) = TREE_TYPE (old_decl);
- current_function_prototype_file = DECL_SOURCE_FILE (old_decl);
- current_function_prototype_line = DECL_SOURCE_LINE (old_decl);
- }
-
- /* If there is no explicit declaration, look for any out-of-scope implicit
- declarations. */
- if (old_decl == 0)
- old_decl = IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1));
-
- /* Optionally warn of old-fashioned def with no previous prototype. */
- if (warn_strict_prototypes
- && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0
- && !(old_decl != 0 && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0))
- warning ("function declaration isn't a prototype");
- /* Optionally warn of any global def with no previous prototype. */
- else if (warn_missing_prototypes
- && TREE_PUBLIC (decl1)
- && !(old_decl != 0 && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0)
- && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1))))
- warning_with_decl (decl1, "no previous prototype for `%s'");
- /* Optionally warn of any def with no previous prototype
- if the function has already been used. */
- else if (warn_missing_prototypes
- && old_decl != 0 && TREE_USED (old_decl)
- && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0)
- warning_with_decl (decl1,
- "`%s' was used with no prototype before its definition");
- /* Optionally warn of any global def with no previous declaration. */
- else if (warn_missing_declarations
- && TREE_PUBLIC (decl1)
- && old_decl == 0
- && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1))))
- warning_with_decl (decl1, "no previous declaration for `%s'");
- /* Optionally warn of any def with no previous declaration
- if the function has already been used. */
- else if (warn_missing_declarations
- && old_decl != 0 && TREE_USED (old_decl)
- && old_decl == IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)))
- warning_with_decl (decl1,
- "`%s' was used with no declaration before its definition");
-
- /* This is a definition, not a reference.
- So normally clear DECL_EXTERNAL.
- However, `extern inline' acts like a declaration
- except for defining how to inline. So set DECL_EXTERNAL in that case. */
- DECL_EXTERNAL (decl1) = current_extern_inline;
-
- /* This function exists in static storage.
- (This does not mean `static' in the C sense!) */
- TREE_STATIC (decl1) = 1;
-
- /* A nested function is not global. */
- if (current_function_decl != 0)
- TREE_PUBLIC (decl1) = 0;
-
- /* Warn for unlikely, improbable, or stupid declarations of `main'. */
- if (warn_main
- && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1))) == 0)
- {
- tree args;
- int argct = 0;
-
- if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
- != integer_type_node)
- pedwarn_with_decl (decl1, "return type of `%s' is not `int'");
-
- for (args = TYPE_ARG_TYPES (TREE_TYPE (decl1)); args;
- args = TREE_CHAIN (args))
- {
- tree type = args ? TREE_VALUE (args) : 0;
-
- if (type == void_type_node)
- break;
-
- ++argct;
- switch (argct)
- {
- case 1:
- if (TYPE_MAIN_VARIANT (type) != integer_type_node)
- pedwarn_with_decl (decl1,
- "first argument of `%s' should be `int'");
- break;
-
- case 2:
- if (TREE_CODE (type) != POINTER_TYPE
- || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
- || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
- != char_type_node))
- pedwarn_with_decl (decl1,
- "second argument of `%s' should be `char **'");
- break;
-
- case 3:
- if (TREE_CODE (type) != POINTER_TYPE
- || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
- || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
- != char_type_node))
- pedwarn_with_decl (decl1,
- "third argument of `%s' should probably be `char **'");
- break;
- }
- }
-
- /* It is intentional that this message does not mention the third
- argument, which is warned for only pedantically, because it's
- blessed by mention in an appendix of the standard. */
- if (argct > 0 && (argct < 2 || argct > 3))
- pedwarn_with_decl (decl1, "`%s' takes only zero or two arguments");
-
- if (argct == 3 && pedantic)
- pedwarn_with_decl (decl1, "third argument of `%s' is deprecated");
-
- if (! TREE_PUBLIC (decl1))
- pedwarn_with_decl (decl1, "`%s' is normally a non-static function");
- }
-
- /* Record the decl so that the function name is defined.
- If we already have a decl for this name, and it is a FUNCTION_DECL,
- use the old decl. */
-
- current_function_decl = pushdecl (decl1);
-
- pushlevel (0);
- declare_parm_level (1);
- current_binding_level->subblocks_tag_transparent = 1;
-
- make_function_rtl (current_function_decl);
-
- restype = TREE_TYPE (TREE_TYPE (current_function_decl));
- /* Promote the value to int before returning it. */
- if (C_PROMOTING_INTEGER_TYPE_P (restype))
- {
- /* It retains unsignedness if traditional
- or if not really getting wider. */
- if (TREE_UNSIGNED (restype)
- && (flag_traditional
- || (TYPE_PRECISION (restype)
- == TYPE_PRECISION (integer_type_node))))
- restype = unsigned_type_node;
- else
- restype = integer_type_node;
- }
- DECL_RESULT (current_function_decl)
- = build_decl (RESULT_DECL, NULL_TREE, restype);
-
- if (!nested)
- /* Allocate further tree nodes temporarily during compilation
- of this function only. */
- temporary_allocation ();
-
- /* If this fcn was already referenced via a block-scope `extern' decl
- (or an implicit decl), propagate certain information about the usage. */
- if (TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (current_function_decl)))
- TREE_ADDRESSABLE (current_function_decl) = 1;
-
- immediate_size_expand = old_immediate_size_expand;
-
- return 1;
-}
-
-/* Record that this function is going to be a varargs function.
- This is called before store_parm_decls, which is too early
- to call mark_varargs directly. */
-
-void
-c_mark_varargs ()
-{
- c_function_varargs = 1;
-}
-
-/* Store the parameter declarations into the current function declaration.
- This is called after parsing the parameter declarations, before
- digesting the body of the function.
-
- For an old-style definition, modify the function's type
- to specify at least the number of arguments. */
-
-void
-store_parm_decls ()
-{
- register tree fndecl = current_function_decl;
- register tree parm;
-
- /* This is either a chain of PARM_DECLs (if a prototype was used)
- or a list of IDENTIFIER_NODEs (for an old-fashioned C definition). */
- tree specparms = current_function_parms;
-
- /* This is a list of types declared among parms in a prototype. */
- tree parmtags = current_function_parm_tags;
-
- /* This is a chain of PARM_DECLs from old-style parm declarations. */
- register tree parmdecls = getdecls ();
-
- /* This is a chain of any other decls that came in among the parm
- declarations. If a parm is declared with enum {foo, bar} x;
- then CONST_DECLs for foo and bar are put here. */
- tree nonparms = 0;
-
- /* Nonzero if this definition is written with a prototype. */
- int prototype = 0;
-
- if (specparms != 0 && TREE_CODE (specparms) != TREE_LIST)
- {
- /* This case is when the function was defined with an ANSI prototype.
- The parms already have decls, so we need not do anything here
- except record them as in effect
- and complain if any redundant old-style parm decls were written. */
-
- register tree next;
- tree others = 0;
-
- prototype = 1;
-
- if (parmdecls != 0)
- {
- tree decl, link;
-
- error_with_decl (fndecl,
- "parm types given both in parmlist and separately");
- /* Get rid of the erroneous decls; don't keep them on
- the list of parms, since they might not be PARM_DECLs. */
- for (decl = current_binding_level->names;
- decl; decl = TREE_CHAIN (decl))
- if (DECL_NAME (decl))
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) = 0;
- for (link = current_binding_level->shadowed;
- link; link = TREE_CHAIN (link))
- IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
- current_binding_level->names = 0;
- current_binding_level->shadowed = 0;
- }
-
- specparms = nreverse (specparms);
- for (parm = specparms; parm; parm = next)
- {
- next = TREE_CHAIN (parm);
- if (TREE_CODE (parm) == PARM_DECL)
- {
- if (DECL_NAME (parm) == 0)
- error_with_decl (parm, "parameter name omitted");
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == void_type_node)
- {
- error_with_decl (parm, "parameter `%s' declared void");
- /* Change the type to error_mark_node so this parameter
- will be ignored by assign_parms. */
- TREE_TYPE (parm) = error_mark_node;
- }
- pushdecl (parm);
- }
- else
- {
- /* If we find an enum constant or a type tag,
- put it aside for the moment. */
- TREE_CHAIN (parm) = 0;
- others = chainon (others, parm);
- }
- }
-
- /* Get the decls in their original chain order
- and record in the function. */
- DECL_ARGUMENTS (fndecl) = getdecls ();
-
-#if 0
- /* If this function takes a variable number of arguments,
- add a phony parameter to the end of the parm list,
- to represent the position of the first unnamed argument. */
- if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl))))
- != void_type_node)
- {
- tree dummy = build_decl (PARM_DECL, NULL_TREE, void_type_node);
- /* Let's hope the address of the unnamed parm
- won't depend on its type. */
- TREE_TYPE (dummy) = integer_type_node;
- DECL_ARG_TYPE (dummy) = integer_type_node;
- DECL_ARGUMENTS (fndecl)
- = chainon (DECL_ARGUMENTS (fndecl), dummy);
- }
-#endif
-
- /* Now pushdecl the enum constants. */
- for (parm = others; parm; parm = next)
- {
- next = TREE_CHAIN (parm);
- if (DECL_NAME (parm) == 0)
- ;
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == void_type_node)
- ;
- else if (TREE_CODE (parm) != PARM_DECL)
- pushdecl (parm);
- }
-
- storetags (chainon (parmtags, gettags ()));
- }
- else
- {
- /* SPECPARMS is an identifier list--a chain of TREE_LIST nodes
- each with a parm name as the TREE_VALUE.
-
- PARMDECLS is a chain of declarations for parameters.
- Warning! It can also contain CONST_DECLs which are not parameters
- but are names of enumerators of any enum types
- declared among the parameters.
-
- First match each formal parameter name with its declaration.
- Associate decls with the names and store the decls
- into the TREE_PURPOSE slots. */
-
- for (parm = parmdecls; parm; parm = TREE_CHAIN (parm))
- DECL_RESULT (parm) = 0;
-
- for (parm = specparms; parm; parm = TREE_CHAIN (parm))
- {
- register tree tail, found = NULL;
-
- if (TREE_VALUE (parm) == 0)
- {
- error_with_decl (fndecl, "parameter name missing from parameter list");
- TREE_PURPOSE (parm) = 0;
- continue;
- }
-
- /* See if any of the parmdecls specifies this parm by name.
- Ignore any enumerator decls. */
- for (tail = parmdecls; tail; tail = TREE_CHAIN (tail))
- if (DECL_NAME (tail) == TREE_VALUE (parm)
- && TREE_CODE (tail) == PARM_DECL)
- {
- found = tail;
- break;
- }
-
- /* If declaration already marked, we have a duplicate name.
- Complain, and don't use this decl twice. */
- if (found && DECL_RESULT (found) != 0)
- {
- error_with_decl (found, "multiple parameters named `%s'");
- found = 0;
- }
-
- /* If the declaration says "void", complain and ignore it. */
- if (found && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == void_type_node)
- {
- error_with_decl (found, "parameter `%s' declared void");
- TREE_TYPE (found) = integer_type_node;
- DECL_ARG_TYPE (found) = integer_type_node;
- layout_decl (found, 0);
- }
-
- /* Traditionally, a parm declared float is actually a double. */
- if (found && flag_traditional
- && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == float_type_node)
- {
- TREE_TYPE (found) = double_type_node;
- DECL_ARG_TYPE (found) = double_type_node;
- layout_decl (found, 0);
- }
-
- /* If no declaration found, default to int. */
- if (!found)
- {
- found = build_decl (PARM_DECL, TREE_VALUE (parm),
- integer_type_node);
- DECL_ARG_TYPE (found) = TREE_TYPE (found);
- DECL_SOURCE_LINE (found) = DECL_SOURCE_LINE (fndecl);
- DECL_SOURCE_FILE (found) = DECL_SOURCE_FILE (fndecl);
- if (extra_warnings)
- warning_with_decl (found, "type of `%s' defaults to `int'");
- pushdecl (found);
- }
-
- TREE_PURPOSE (parm) = found;
-
- /* Mark this decl as "already found" -- see test, above.
- It is safe to use DECL_RESULT for this
- since it is not used in PARM_DECLs or CONST_DECLs. */
- DECL_RESULT (found) = error_mark_node;
- }
-
- /* Put anything which is on the parmdecls chain and which is
- not a PARM_DECL onto the list NONPARMS. (The types of
- non-parm things which might appear on the list include
- enumerators and NULL-named TYPE_DECL nodes.) Complain about
- any actual PARM_DECLs not matched with any names. */
-
- nonparms = 0;
- for (parm = parmdecls; parm; )
- {
- tree next = TREE_CHAIN (parm);
- TREE_CHAIN (parm) = 0;
-
- if (TREE_CODE (parm) != PARM_DECL)
- nonparms = chainon (nonparms, parm);
- else
- {
- /* Complain about args with incomplete types. */
- if (TYPE_SIZE (TREE_TYPE (parm)) == 0)
- {
- error_with_decl (parm, "parameter `%s' has incomplete type");
- TREE_TYPE (parm) = error_mark_node;
- }
-
- if (DECL_RESULT (parm) == 0)
- {
- error_with_decl (parm,
- "declaration for parameter `%s' but no such parameter");
- /* Pretend the parameter was not missing.
- This gets us to a standard state and minimizes
- further error messages. */
- specparms
- = chainon (specparms,
- tree_cons (parm, NULL_TREE, NULL_TREE));
- }
- }
-
- parm = next;
- }
-
- /* Chain the declarations together in the order of the list of names. */
- /* Store that chain in the function decl, replacing the list of names. */
- parm = specparms;
- DECL_ARGUMENTS (fndecl) = 0;
- {
- register tree last;
- for (last = 0; parm; parm = TREE_CHAIN (parm))
- if (TREE_PURPOSE (parm))
- {
- if (last == 0)
- DECL_ARGUMENTS (fndecl) = TREE_PURPOSE (parm);
- else
- TREE_CHAIN (last) = TREE_PURPOSE (parm);
- last = TREE_PURPOSE (parm);
- TREE_CHAIN (last) = 0;
- }
- }
-
- /* If there was a previous prototype,
- set the DECL_ARG_TYPE of each argument according to
- the type previously specified, and report any mismatches. */
-
- if (TYPE_ARG_TYPES (TREE_TYPE (fndecl)))
- {
- register tree type;
- for (parm = DECL_ARGUMENTS (fndecl),
- type = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
- parm || (type && (TYPE_MAIN_VARIANT (TREE_VALUE (type))
- != void_type_node));
- parm = TREE_CHAIN (parm), type = TREE_CHAIN (type))
- {
- if (parm == 0 || type == 0
- || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)
- {
- error ("number of arguments doesn't match prototype");
- error_with_file_and_line (current_function_prototype_file,
- current_function_prototype_line,
- "prototype declaration");
- break;
- }
- /* Type for passing arg must be consistent
- with that declared for the arg. */
- if (! comptypes (DECL_ARG_TYPE (parm), TREE_VALUE (type)))
- {
- if (TYPE_MAIN_VARIANT (TREE_TYPE (parm))
- == TYPE_MAIN_VARIANT (TREE_VALUE (type)))
- {
- /* Adjust argument to match prototype. E.g. a previous
- `int foo(float);' prototype causes
- `int foo(x) float x; {...}' to be treated like
- `int foo(float x) {...}'. This is particularly
- useful for argument types like uid_t. */
- DECL_ARG_TYPE (parm) = TREE_TYPE (parm);
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (TREE_TYPE (parm)) == INTEGER_TYPE
- || TREE_CODE (TREE_TYPE (parm)) == ENUMERAL_TYPE)
- && TYPE_PRECISION (TREE_TYPE (parm))
- < TYPE_PRECISION (integer_type_node))
- DECL_ARG_TYPE (parm) = integer_type_node;
-#endif
- if (pedantic)
- {
- pedwarn ("promoted argument `%s' doesn't match prototype",
- IDENTIFIER_POINTER (DECL_NAME (parm)));
- warning_with_file_and_line
- (current_function_prototype_file,
- current_function_prototype_line,
- "prototype declaration");
- }
- }
- /* If -traditional, allow `int' argument to match
- `unsigned' prototype. */
- else if (! (flag_traditional
- && TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == integer_type_node
- && TYPE_MAIN_VARIANT (TREE_VALUE (type)) == unsigned_type_node))
- {
- error ("argument `%s' doesn't match prototype",
- IDENTIFIER_POINTER (DECL_NAME (parm)));
- error_with_file_and_line (current_function_prototype_file,
- current_function_prototype_line,
- "prototype declaration");
- }
- }
- }
- TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = 0;
- }
-
- /* Otherwise, create a prototype that would match. */
-
- else
- {
- tree actual = 0, last = 0, type;
-
- for (parm = DECL_ARGUMENTS (fndecl); parm; parm = TREE_CHAIN (parm))
- {
- type = perm_tree_cons (NULL_TREE, DECL_ARG_TYPE (parm),
- NULL_TREE);
- if (last)
- TREE_CHAIN (last) = type;
- else
- actual = type;
- last = type;
- }
- type = perm_tree_cons (NULL_TREE, void_type_node, NULL_TREE);
- if (last)
- TREE_CHAIN (last) = type;
- else
- actual = type;
-
- /* We are going to assign a new value for the TYPE_ACTUAL_ARG_TYPES
- of the type of this function, but we need to avoid having this
- affect the types of other similarly-typed functions, so we must
- first force the generation of an identical (but separate) type
- node for the relevant function type. The new node we create
- will be a variant of the main variant of the original function
- type. */
-
- TREE_TYPE (fndecl) = build_type_copy (TREE_TYPE (fndecl));
-
- TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = actual;
- }
-
- /* Now store the final chain of decls for the arguments
- as the decl-chain of the current lexical scope.
- Put the enumerators in as well, at the front so that
- DECL_ARGUMENTS is not modified. */
-
- storedecls (chainon (nonparms, DECL_ARGUMENTS (fndecl)));
- }
-
- /* Make sure the binding level for the top of the function body
- gets a BLOCK if there are any in the function.
- Otherwise, the dbx output is wrong. */
-
- keep_next_if_subblocks = 1;
-
- /* ??? This might be an improvement,
- but needs to be thought about some more. */
-#if 0
- keep_next_level_flag = 1;
-#endif
-
- /* Write a record describing this function definition to the prototypes
- file (if requested). */
-
- gen_aux_info_record (fndecl, 1, 0, prototype);
-
- /* Initialize the RTL code for the function. */
-
- init_function_start (fndecl, input_filename, lineno);
-
- /* If this is a varargs function, inform function.c. */
-
- if (c_function_varargs)
- mark_varargs ();
-
- /* Declare __FUNCTION__ and __PRETTY_FUNCTION__ for this function. */
-
- declare_function_name ();
-
- /* Set up parameters and prepare for return, for the function. */
-
- expand_function_start (fndecl, 0);
-
- /* If this function is `main', emit a call to `__main'
- to run global initializers, etc. */
- if (DECL_NAME (fndecl)
- && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main") == 0
- && DECL_CONTEXT (fndecl) == NULL_TREE)
- expand_main_function ();
-}
-
-/* SPECPARMS is an identifier list--a chain of TREE_LIST nodes
- each with a parm name as the TREE_VALUE. A null pointer as TREE_VALUE
- stands for an ellipsis in the identifier list.
-
- PARMLIST is the data returned by get_parm_info for the
- parmlist that follows the semicolon.
-
- We return a value of the same sort that get_parm_info returns,
- except that it describes the combination of identifiers and parmlist. */
-
-tree
-combine_parm_decls (specparms, parmlist, void_at_end)
- tree specparms, parmlist;
- int void_at_end;
-{
- register tree fndecl = current_function_decl;
- register tree parm;
-
- tree parmdecls = TREE_PURPOSE (parmlist);
-
- /* This is a chain of any other decls that came in among the parm
- declarations. They were separated already by get_parm_info,
- so we just need to keep them separate. */
- tree nonparms = TREE_VALUE (parmlist);
-
- tree types = 0;
-
- for (parm = parmdecls; parm; parm = TREE_CHAIN (parm))
- DECL_RESULT (parm) = 0;
-
- for (parm = specparms; parm; parm = TREE_CHAIN (parm))
- {
- register tree tail, found = NULL;
-
- /* See if any of the parmdecls specifies this parm by name. */
- for (tail = parmdecls; tail; tail = TREE_CHAIN (tail))
- if (DECL_NAME (tail) == TREE_VALUE (parm))
- {
- found = tail;
- break;
- }
-
- /* If declaration already marked, we have a duplicate name.
- Complain, and don't use this decl twice. */
- if (found && DECL_RESULT (found) != 0)
- {
- error_with_decl (found, "multiple parameters named `%s'");
- found = 0;
- }
-
- /* If the declaration says "void", complain and ignore it. */
- if (found && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == void_type_node)
- {
- error_with_decl (found, "parameter `%s' declared void");
- TREE_TYPE (found) = integer_type_node;
- DECL_ARG_TYPE (found) = integer_type_node;
- layout_decl (found, 0);
- }
-
- /* Traditionally, a parm declared float is actually a double. */
- if (found && flag_traditional
- && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == float_type_node)
- {
- TREE_TYPE (found) = double_type_node;
- DECL_ARG_TYPE (found) = double_type_node;
- layout_decl (found, 0);
- }
-
- /* If no declaration found, default to int. */
- if (!found)
- {
- found = build_decl (PARM_DECL, TREE_VALUE (parm),
- integer_type_node);
- DECL_ARG_TYPE (found) = TREE_TYPE (found);
- DECL_SOURCE_LINE (found) = DECL_SOURCE_LINE (fndecl);
- DECL_SOURCE_FILE (found) = DECL_SOURCE_FILE (fndecl);
- error_with_decl (found, "type of parameter `%s' is not declared");
- pushdecl (found);
- }
-
- TREE_PURPOSE (parm) = found;
-
- /* Mark this decl as "already found" -- see test, above.
- It is safe to use DECL_RESULT for this
- since it is not used in PARM_DECLs or CONST_DECLs. */
- DECL_RESULT (found) = error_mark_node;
- }
-
- /* Complain about any actual PARM_DECLs not matched with any names. */
-
- for (parm = parmdecls; parm; )
- {
- tree next = TREE_CHAIN (parm);
- TREE_CHAIN (parm) = 0;
-
- /* Complain about args with incomplete types. */
- if (TYPE_SIZE (TREE_TYPE (parm)) == 0)
- {
- error_with_decl (parm, "parameter `%s' has incomplete type");
- TREE_TYPE (parm) = error_mark_node;
- }
-
- if (DECL_RESULT (parm) == 0)
- {
- error_with_decl (parm,
- "declaration for parameter `%s' but no such parameter");
- /* Pretend the parameter was not missing.
- This gets us to a standard state and minimizes
- further error messages. */
- specparms
- = chainon (specparms,
- tree_cons (parm, NULL_TREE, NULL_TREE));
- }
-
- parm = next;
- }
-
- /* Chain the declarations together in the order of the list of names.
- At the same time, build up a list of their types, in reverse order. */
-
- parm = specparms;
- parmdecls = 0;
- {
- register tree last;
- for (last = 0; parm; parm = TREE_CHAIN (parm))
- if (TREE_PURPOSE (parm))
- {
- if (last == 0)
- parmdecls = TREE_PURPOSE (parm);
- else
- TREE_CHAIN (last) = TREE_PURPOSE (parm);
- last = TREE_PURPOSE (parm);
- TREE_CHAIN (last) = 0;
-
- types = saveable_tree_cons (NULL_TREE, TREE_TYPE (parm), types);
- }
- }
-
- if (void_at_end)
- return saveable_tree_cons (parmdecls, nonparms,
- nreverse (saveable_tree_cons (NULL_TREE,
- void_type_node,
- types)));
-
- return saveable_tree_cons (parmdecls, nonparms, nreverse (types));
-}
-
-/* Finish up a function declaration and compile that function
- all the way to assembler language output. The free the storage
- for the function definition.
-
- This is called after parsing the body of the function definition.
-
- NESTED is nonzero if the function being finished is nested in another. */
-
-void
-finish_function (nested)
- int nested;
-{
- register tree fndecl = current_function_decl;
-
-/* TREE_READONLY (fndecl) = 1;
- This caused &foo to be of type ptr-to-const-function
- which then got a warning when stored in a ptr-to-function variable. */
-
- poplevel (1, 0, 1);
- BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
-
- /* Must mark the RESULT_DECL as being in this function. */
-
- DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
-
- /* Obey `register' declarations if `setjmp' is called in this fn. */
- if (flag_traditional && current_function_calls_setjmp)
- {
- setjmp_protect (DECL_INITIAL (fndecl));
- setjmp_protect_args ();
- }
-
- if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main"))
- {
- if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl)))
- != integer_type_node)
- {
- /* You would expect the sense of this test to be the other way
- around, but if warn_main is set, we will already have warned,
- so this would be a duplicate. This is the warning you get
- in some environments even if you *don't* ask for it, because
- these are environments where it may be more of a problem than
- usual. */
- if (! warn_main)
- pedwarn_with_decl (fndecl, "return type of `%s' is not `int'");
- }
- else
- {
-#ifdef DEFAULT_MAIN_RETURN
- /* Make it so that `main' always returns success by default. */
- DEFAULT_MAIN_RETURN;
-#endif
- }
- }
-
- /* Generate rtl for function exit. */
- expand_function_end (input_filename, lineno, 0);
-
- /* So we can tell if jump_optimize sets it to 1. */
- can_reach_end = 0;
-
- /* Run the optimizers and output the assembler code for this function. */
- rest_of_compilation (fndecl);
-
- current_function_returns_null |= can_reach_end;
-
- if (TREE_THIS_VOLATILE (fndecl) && current_function_returns_null)
- warning ("`noreturn' function does return");
- else if (warn_return_type && can_reach_end
- && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl))) != void_type_node)
- /* If this function returns non-void and control can drop through,
- complain. */
- warning ("control reaches end of non-void function");
- /* With just -W, complain only if function returns both with
- and without a value. */
- else if (extra_warnings
- && current_function_returns_value && current_function_returns_null)
- warning ("this function may return with or without a value");
-
- /* If requested, warn about function definitions where the function will
- return a value (usually of some struct or union type) which itself will
- take up a lot of stack space. */
-
- if (warn_larger_than && !DECL_EXTERNAL (fndecl) && TREE_TYPE (fndecl))
- {
- register tree ret_type = TREE_TYPE (TREE_TYPE (fndecl));
-
- if (ret_type)
- {
- register tree ret_type_size = TYPE_SIZE (ret_type);
-
- if (TREE_CODE (ret_type_size) == INTEGER_CST)
- {
- unsigned units
- = TREE_INT_CST_LOW (ret_type_size) / BITS_PER_UNIT;
-
- if (units > larger_than_size)
- warning_with_decl (fndecl,
- "size of return value of `%s' is %u bytes",
- units);
- }
- }
- }
-
- /* Free all the tree nodes making up this function. */
- /* Switch back to allocating nodes permanently
- until we start another function. */
- if (! nested)
- permanent_allocation (1);
-
- if (DECL_SAVED_INSNS (fndecl) == 0 && ! nested)
- {
- /* Stop pointing to the local nodes about to be freed. */
- /* But DECL_INITIAL must remain nonzero so we know this
- was an actual function definition. */
- /* For a nested function, this is done in pop_c_function_context. */
- /* If rest_of_compilation set this to 0, leave it 0. */
- if (DECL_INITIAL (fndecl) != 0)
- DECL_INITIAL (fndecl) = error_mark_node;
- DECL_ARGUMENTS (fndecl) = 0;
- }
-
- if (DECL_STATIC_CONSTRUCTOR (fndecl))
- {
-#ifndef ASM_OUTPUT_CONSTRUCTOR
- if (! flag_gnu_linker)
- static_ctors = perm_tree_cons (NULL_TREE, fndecl, static_ctors);
- else
-#endif
- assemble_constructor (IDENTIFIER_POINTER (DECL_NAME (fndecl)));
- }
- if (DECL_STATIC_DESTRUCTOR (fndecl))
- {
-#ifndef ASM_OUTPUT_DESTRUCTOR
- if (! flag_gnu_linker)
- static_dtors = perm_tree_cons (NULL_TREE, fndecl, static_dtors);
- else
-#endif
- assemble_destructor (IDENTIFIER_POINTER (DECL_NAME (fndecl)));
- }
-
- if (! nested)
- {
- /* Let the error reporting routines know that we're outside a
- function. For a nested function, this value is used in
- pop_c_function_context and then reset via pop_function_context. */
- current_function_decl = NULL;
- }
-}
-
-/* Save and restore the variables in this file and elsewhere
- that keep track of the progress of compilation of the current function.
- Used for nested functions. */
-
-struct c_function
-{
- struct c_function *next;
- tree named_labels;
- tree shadowed_labels;
- int returns_value;
- int returns_null;
- int warn_about_return_type;
- int extern_inline;
- struct binding_level *binding_level;
-};
-
-struct c_function *c_function_chain;
-
-/* Save and reinitialize the variables
- used during compilation of a C function. */
-
-void
-push_c_function_context ()
-{
- struct c_function *p
- = (struct c_function *) xmalloc (sizeof (struct c_function));
-
- if (pedantic)
- pedwarn ("ANSI C forbids nested functions");
-
- push_function_context ();
-
- p->next = c_function_chain;
- c_function_chain = p;
-
- p->named_labels = named_labels;
- p->shadowed_labels = shadowed_labels;
- p->returns_value = current_function_returns_value;
- p->returns_null = current_function_returns_null;
- p->warn_about_return_type = warn_about_return_type;
- p->extern_inline = current_extern_inline;
- p->binding_level = current_binding_level;
-}
-
-/* Restore the variables used during compilation of a C function. */
-
-void
-pop_c_function_context ()
-{
- struct c_function *p = c_function_chain;
- tree link;
-
- /* Bring back all the labels that were shadowed. */
- for (link = shadowed_labels; link; link = TREE_CHAIN (link))
- if (DECL_NAME (TREE_VALUE (link)) != 0)
- IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link)))
- = TREE_VALUE (link);
-
- if (DECL_SAVED_INSNS (current_function_decl) == 0)
- {
- /* Stop pointing to the local nodes about to be freed. */
- /* But DECL_INITIAL must remain nonzero so we know this
- was an actual function definition. */
- DECL_INITIAL (current_function_decl) = error_mark_node;
- DECL_ARGUMENTS (current_function_decl) = 0;
- }
-
- pop_function_context ();
-
- c_function_chain = p->next;
-
- named_labels = p->named_labels;
- shadowed_labels = p->shadowed_labels;
- current_function_returns_value = p->returns_value;
- current_function_returns_null = p->returns_null;
- warn_about_return_type = p->warn_about_return_type;
- current_extern_inline = p->extern_inline;
- current_binding_level = p->binding_level;
-
- free (p);
-}
-
-/* integrate_decl_tree calls this function, but since we don't use the
- DECL_LANG_SPECIFIC field, this is a no-op. */
-
-void
-copy_lang_decl (node)
- tree node;
-{
-}
diff --git a/gcc/c-iterate.c b/gcc/c-iterate.c
deleted file mode 100644
index f8dec10b98b..00000000000
--- a/gcc/c-iterate.c
+++ /dev/null
@@ -1,599 +0,0 @@
-/* Build expressions with type checking for C compiler.
- Copyright (C) 1987, 88, 89, 92, 93, 1996 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 is part of the C front end.
- It is responsible for implementing iterators,
- both their declarations and the expansion of statements using them. */
-
-#include "config.h"
-#include <stdio.h>
-#include "tree.h"
-#include "c-tree.h"
-#include "flags.h"
-#include "obstack.h"
-#include "rtl.h"
-
-/*
- KEEPING TRACK OF EXPANSIONS
-
- In order to clean out expansions corresponding to statements inside
- "{(...)}" constructs we have to keep track of all expansions. The
- cleanup is needed when an automatic, or implicit, expansion on
- iterator, say X, happens to a statement which contains a {(...)}
- form with a statement already expanded on X. In this case we have
- to go back and cleanup the inner expansion. This can be further
- complicated by the fact that {(...)} can be nested.
-
- To make this cleanup possible, we keep lists of all expansions, and
- to make it work for nested constructs, we keep a stack. The list at
- the top of the stack (ITER_STACK.CURRENT_LEVEL) corresponds to the
- currently parsed level. All expansions of the levels below the
- current one are kept in one list whose head is pointed to by
- ITER_STACK.SUBLEVEL_FIRST (SUBLEVEL_LAST is there for making merges
- easy). The process works as follows:
-
- -- On "({" a new node is added to the stack by PUSH_ITERATOR_STACK.
- The sublevel list is not changed at this point.
-
- -- On "})" the list for the current level is appended to the sublevel
- list.
-
- -- On ";" sublevel lists are appended to the current level lists.
- The reason is this: if they have not been superseded by the
- expansion at the current level, they still might be
- superseded later by the expansion on the higher level.
- The levels do not have to distinguish levels below, so we
- can merge the lists together. */
-
-struct ixpansion
-{
- tree ixdecl; /* Iterator decl */
- rtx ixprologue_start; /* First insn of epilogue. NULL means */
- /* explicit (FOR) expansion*/
- rtx ixprologue_end;
- rtx ixepilogue_start;
- rtx ixepilogue_end;
- struct ixpansion *next; /* Next in the list */
-};
-
-struct iter_stack_node
-{
- struct ixpansion *first; /* Head of list of ixpansions */
- struct ixpansion *last; /* Last node in list of ixpansions */
- struct iter_stack_node *next; /* Next level iterator stack node */
-};
-
-struct iter_stack_node *iter_stack;
-struct iter_stack_node sublevel_ixpansions;
-
-/* A special obstack, and a pointer to the start of
- all the data in it (so we can free everything easily). */
-static struct obstack ixp_obstack;
-static char *ixp_firstobj;
-
-/* During collect_iterators, a list of SAVE_EXPRs already scanned. */
-static tree save_exprs;
-
-static void expand_stmt_with_iterators_1 PROTO((tree, tree));
-static tree collect_iterators PROTO((tree, tree));
-static void iterator_loop_prologue PROTO((tree, rtx *, rtx *));
-static void iterator_loop_epilogue PROTO((tree, rtx *, rtx *));
-static int top_level_ixpansion_p PROTO((void));
-static void isn_append PROTO((struct iter_stack_node *,
- struct iter_stack_node *));
-static void istack_sublevel_to_current PROTO((void));
-static void add_ixpansion PROTO((tree, rtx, rtx, rtx, rtx));
-static void delete_ixpansion PROTO((tree));
-
-/* Initialize our obstack once per compilation. */
-
-void
-init_iterators ()
-{
- gcc_obstack_init (&ixp_obstack);
- ixp_firstobj = (char *) obstack_alloc (&ixp_obstack, 0);
-}
-
-/* Handle the start of an explicit `for' loop for iterator IDECL. */
-
-void
-iterator_for_loop_start (idecl)
- tree idecl;
-{
- ITERATOR_BOUND_P (idecl) = 1;
- add_ixpansion (idecl, 0, 0, 0, 0);
- iterator_loop_prologue (idecl, 0, 0);
-}
-
-/* Handle the end of an explicit `for' loop for iterator IDECL. */
-
-void
-iterator_for_loop_end (idecl)
- tree idecl;
-{
- iterator_loop_epilogue (idecl, 0, 0);
- ITERATOR_BOUND_P (idecl) = 0;
-}
-
-/*
- ITERATOR RTL EXPANSIONS
-
- Expanding simple statements with iterators is straightforward:
- collect the list of all free iterators in the statement, and
- generate a loop for each of them.
-
- An iterator is "free" if it has not been "bound" by a FOR
- operator. The DECL_RTL of the iterator is the loop counter. */
-
-/* Expand a statement STMT, possibly containing iterator usage, into RTL. */
-
-void
-iterator_expand (stmt)
- tree stmt;
-{
- tree iter_list;
- save_exprs = NULL_TREE;
- iter_list = collect_iterators (stmt, NULL_TREE);
- expand_stmt_with_iterators_1 (stmt, iter_list);
- istack_sublevel_to_current ();
-}
-
-
-static void
-expand_stmt_with_iterators_1 (stmt, iter_list)
- tree stmt, iter_list;
-{
- if (iter_list == 0)
- expand_expr_stmt (stmt);
- else
- {
- tree current_iterator = TREE_VALUE (iter_list);
- tree iter_list_tail = TREE_CHAIN (iter_list);
- rtx p_start, p_end, e_start, e_end;
-
- iterator_loop_prologue (current_iterator, &p_start, &p_end);
- expand_stmt_with_iterators_1 (stmt, iter_list_tail);
- iterator_loop_epilogue (current_iterator, &e_start, &e_end);
-
- /** Delete all inner expansions based on current_iterator **/
- /** before adding the outer one. **/
-
- delete_ixpansion (current_iterator);
- add_ixpansion (current_iterator, p_start, p_end, e_start, e_end);
- }
-}
-
-
-/* Return a list containing all the free (i.e. not bound by a
- containing `for' statement) iterators mentioned in EXP, plus those
- in LIST. Do not add duplicate entries to the list. */
-
-static tree
-collect_iterators (exp, list)
- tree exp, list;
-{
- if (exp == 0) return list;
-
- switch (TREE_CODE (exp))
- {
- case VAR_DECL:
- if (! ITERATOR_P (exp) || ITERATOR_BOUND_P (exp))
- return list;
- if (value_member (exp, list))
- return list;
- return tree_cons (NULL_TREE, exp, list);
-
- case TREE_LIST:
- {
- tree tail;
- for (tail = exp; tail; tail = TREE_CHAIN (tail))
- list = collect_iterators (TREE_VALUE (tail), list);
- return list;
- }
-
- case SAVE_EXPR:
- /* In each scan, scan a given save_expr only once. */
- if (value_member (exp, save_exprs))
- return list;
-
- save_exprs = tree_cons (NULL_TREE, exp, save_exprs);
- return collect_iterators (TREE_OPERAND (exp, 0), list);
-
- /* we do not automatically iterate blocks -- one must */
- /* use the FOR construct to do that */
-
- case BLOCK:
- return list;
-
- default:
- switch (TREE_CODE_CLASS (TREE_CODE (exp)))
- {
- case '1':
- return collect_iterators (TREE_OPERAND (exp, 0), list);
-
- case '2':
- case '<':
- return collect_iterators (TREE_OPERAND (exp, 0),
- collect_iterators (TREE_OPERAND (exp, 1),
- list));
-
- case 'e':
- case 'r':
- {
- int num_args = tree_code_length[(int) TREE_CODE (exp)];
- int i;
-
- /* Some tree codes have RTL, not trees, as operands. */
- switch (TREE_CODE (exp))
- {
- case CALL_EXPR:
- num_args = 2;
- break;
- case METHOD_CALL_EXPR:
- num_args = 3;
- break;
- case WITH_CLEANUP_EXPR:
- num_args = 1;
- break;
- case RTL_EXPR:
- return list;
- }
-
- for (i = 0; i < num_args; i++)
- list = collect_iterators (TREE_OPERAND (exp, i), list);
- return list;
- }
- default:
- return list;
- }
- }
-}
-
-/* Emit rtl for the start of a loop for iterator IDECL.
-
- If necessary, create loop counter rtx and store it as DECL_RTL of IDECL.
-
- The prologue normally starts and ends with notes, which are returned
- by this function in *START_NOTE and *END_NODE.
- If START_NOTE and END_NODE are 0, we don't make those notes. */
-
-static void
-iterator_loop_prologue (idecl, start_note, end_note)
- tree idecl;
- rtx *start_note, *end_note;
-{
- tree expr;
-
- /* Force the save_expr in DECL_INITIAL to be calculated
- if it hasn't been calculated yet. */
- expand_expr (DECL_INITIAL (idecl), const0_rtx, VOIDmode, 0);
-
- if (DECL_RTL (idecl) == 0)
- expand_decl (idecl);
-
- if (start_note)
- *start_note = emit_note (0, NOTE_INSN_DELETED);
-
- /* Initialize counter. */
- expr = build (MODIFY_EXPR, TREE_TYPE (idecl), idecl, integer_zero_node);
- TREE_SIDE_EFFECTS (expr) = 1;
- expand_expr (expr, const0_rtx, VOIDmode, 0);
-
- expand_start_loop_continue_elsewhere (1);
-
- ITERATOR_BOUND_P (idecl) = 1;
-
- if (end_note)
- *end_note = emit_note (0, NOTE_INSN_DELETED);
-}
-
-/* Similar to the previous function, but for the end of the loop.
-
- DECL_RTL is zeroed unless we are inside "({...})". The reason for that is
- described below.
-
- When we create two (or more) loops based on the same IDECL, and
- both inside the same "({...})" construct, we must be prepared to
- delete both of the loops and create a single one on the level
- above, i.e. enclosing the "({...})". The new loop has to use the
- same counter rtl because the references to the iterator decl
- (IDECL) have already been expanded as references to the counter
- rtl.
-
- It is incorrect to use the same counter reg in different functions,
- and it is desirable to use different counters in disjoint loops
- when we know there's no need to combine them (because then they can
- get allocated separately). */
-
-static void
-iterator_loop_epilogue (idecl, start_note, end_note)
- tree idecl;
- rtx *start_note, *end_note;
-{
- tree test, incr;
-
- if (start_note)
- *start_note = emit_note (0, NOTE_INSN_DELETED);
- expand_loop_continue_here ();
- incr = build_binary_op (PLUS_EXPR, idecl, integer_one_node, 0);
- incr = build (MODIFY_EXPR, TREE_TYPE (idecl), idecl, incr);
- TREE_SIDE_EFFECTS (incr) = 1;
- expand_expr (incr, const0_rtx, VOIDmode, 0);
- test = build_binary_op (LT_EXPR, idecl, DECL_INITIAL (idecl), 0);
- expand_exit_loop_if_false (0, test);
- expand_end_loop ();
-
- ITERATOR_BOUND_P (idecl) = 0;
- /* we can reset rtl since there is not chance that this expansion */
- /* would be superseded by a higher level one */
- /* but don't do this if the decl is static, since we need to share */
- /* the same decl in that case. */
- if (top_level_ixpansion_p () && ! TREE_STATIC (idecl))
- DECL_RTL (idecl) = 0;
- if (end_note)
- *end_note = emit_note (0, NOTE_INSN_DELETED);
-}
-
-/* Return true if we are not currently inside a "({...})" construct. */
-
-static int
-top_level_ixpansion_p ()
-{
- return iter_stack == 0;
-}
-
-/* Given two chains of iter_stack_nodes,
- append the nodes in X into Y. */
-
-static void
-isn_append (x, y)
- struct iter_stack_node *x, *y;
-{
- if (x->first == 0)
- return;
-
- if (y->first == 0)
- {
- y->first = x->first;
- y->last = x->last;
- }
- else
- {
- y->last->next = x->first;
- y->last = x->last;
- }
-}
-
-/** Make X empty **/
-
-#define ISN_ZERO(X) (X).first=(X).last=0
-
-/* Move the ixpansions in sublevel_ixpansions into the current
- node on the iter_stack, or discard them if the iter_stack is empty.
- We do this at the end of a statement. */
-
-static void
-istack_sublevel_to_current ()
-{
- /* At the top level we can throw away sublevel's expansions **/
- /* because there is nobody above us to ask for a cleanup **/
- if (iter_stack != 0)
- /** Merging with empty sublevel list is a no-op **/
- if (sublevel_ixpansions.last)
- isn_append (&sublevel_ixpansions, iter_stack);
-
- if (iter_stack == 0)
- obstack_free (&ixp_obstack, ixp_firstobj);
-
- ISN_ZERO (sublevel_ixpansions);
-}
-
-/* Push a new node on the iter_stack, when we enter a ({...}). */
-
-void
-push_iterator_stack ()
-{
- struct iter_stack_node *new_top
- = (struct iter_stack_node *)
- obstack_alloc (&ixp_obstack, sizeof (struct iter_stack_node));
-
- new_top->first = 0;
- new_top->last = 0;
- new_top->next = iter_stack;
- iter_stack = new_top;
-}
-
-/* Pop iter_stack, moving the ixpansions in the node being popped
- into sublevel_ixpansions. */
-
-void
-pop_iterator_stack ()
-{
- if (iter_stack == 0)
- abort ();
-
- isn_append (iter_stack, &sublevel_ixpansions);
- /** Pop current level node: */
- iter_stack = iter_stack->next;
-}
-
-
-/* Record an iterator expansion ("ixpansion") for IDECL.
- The remaining parameters are the notes in the loop entry
- and exit rtl. */
-
-static void
-add_ixpansion (idecl, pro_start, pro_end, epi_start, epi_end)
- tree idecl;
- rtx pro_start, pro_end, epi_start, epi_end;
-{
- struct ixpansion *newix;
-
- /* Do nothing if we are not inside "({...})",
- as in that case this expansion can't need subsequent RTL modification. */
- if (iter_stack == 0)
- return;
-
- newix = (struct ixpansion *) obstack_alloc (&ixp_obstack,
- sizeof (struct ixpansion));
- newix->ixdecl = idecl;
- newix->ixprologue_start = pro_start;
- newix->ixprologue_end = pro_end;
- newix->ixepilogue_start = epi_start;
- newix->ixepilogue_end = epi_end;
-
- newix->next = iter_stack->first;
- iter_stack->first = newix;
- if (iter_stack->last == 0)
- iter_stack->last = newix;
-}
-
-/* Delete the RTL for all ixpansions for iterator IDECL
- in our sublevels. We do this when we make a larger
- containing expansion for IDECL. */
-
-static void
-delete_ixpansion (idecl)
- tree idecl;
-{
- struct ixpansion *previx = 0, *ix;
-
- for (ix = sublevel_ixpansions.first; ix; ix = ix->next)
- if (ix->ixdecl == idecl)
- {
- /** zero means that this is a mark for FOR -- **/
- /** we do not delete anything, just issue an error. **/
-
- if (ix->ixprologue_start == 0)
- error_with_decl (idecl,
- "`for (%s)' appears within implicit iteration");
- else
- {
- rtx insn;
- /* We delete all insns, including notes because leaving loop */
- /* notes and barriers produced by iterator expansion would */
- /* be misleading to other phases */
-
- for (insn = NEXT_INSN (ix->ixprologue_start);
- insn != ix->ixprologue_end;
- insn = NEXT_INSN (insn))
- delete_insn (insn);
- for (insn = NEXT_INSN (ix->ixepilogue_start);
- insn != ix->ixepilogue_end;
- insn = NEXT_INSN (insn))
- delete_insn (insn);
- }
-
- /* Delete this ixpansion from sublevel_ixpansions. */
- if (previx)
- previx->next = ix->next;
- else
- sublevel_ixpansions.first = ix->next;
- if (sublevel_ixpansions.last == ix)
- sublevel_ixpansions.last = previx;
- }
- else
- previx = ix;
-}
-
-#ifdef DEBUG_ITERATORS
-
-/* The functions below are for use from source level debugger.
- They print short forms of iterator lists and the iterator stack. */
-
-/* Print the name of the iterator D. */
-
-void
-prdecl (d)
- tree d;
-{
- if (d)
- {
- if (TREE_CODE (d) == VAR_DECL)
- {
- tree tname = DECL_NAME (d);
- char *dname = IDENTIFIER_POINTER (tname);
- fprintf (stderr, dname);
- }
- else
- fprintf (stderr, "<<Not a Decl!!!>>");
- }
- else
- fprintf (stderr, "<<NULL!!>>");
-}
-
-/* Print Iterator List -- names only */
-
-tree
-pil (head)
- tree head;
-{
- tree current, next;
- for (current = head; current; current = next)
- {
- tree node = TREE_VALUE (current);
- prdecl (node);
- next = TREE_CHAIN (current);
- if (next) fprintf (stderr, ",");
- }
- fprintf (stderr, "\n");
-}
-
-/* Print IXpansion List */
-
-struct ixpansion *
-pixl (head)
- struct ixpansion *head;
-{
- struct ixpansion *current, *next;
- fprintf (stderr, "> ");
- if (head == 0)
- fprintf (stderr, "(empty)");
-
- for (current=head; current; current = next)
- {
- tree node = current->ixdecl;
- prdecl (node);
- next = current->next;
- if (next)
- fprintf (stderr, ",");
- }
- fprintf (stderr, "\n");
- return head;
-}
-
-/* Print Iterator Stack. */
-
-void
-pis ()
-{
- struct iter_stack_node *stack_node;
-
- fprintf (stderr, "--SubLevel: ");
- pixl (sublevel_ixpansions.first);
- fprintf (stderr, "--Stack:--\n");
- for (stack_node = iter_stack;
- stack_node;
- stack_node = stack_node->next)
- pixl (stack_node->first);
-}
-
-#endif /* DEBUG_ITERATORS */
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
deleted file mode 100644
index 2e59e3a15cb..00000000000
--- a/gcc/c-lang.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Language-specific hook definitions for C front end.
- Copyright (C) 1991, 1995 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. */
-
-
-#include "config.h"
-#include "tree.h"
-#include <stdio.h>
-#include "input.h"
-
-/* Each of the functions defined here
- is an alternative to a function in objc-actions.c. */
-
-int
-lang_decode_option (p)
- char *p;
-{
- return c_decode_option (p);
-}
-
-void
-lang_init ()
-{
- /* the beginning of the file is a new line; check for # */
- /* With luck, we discover the real source file's name from that
- and put it in input_filename. */
- ungetc (check_newline (), finput);
-}
-
-void
-lang_finish ()
-{
-}
-
-char *
-lang_identify ()
-{
- return "c";
-}
-
-void
-print_lang_statistics ()
-{
-}
-
-/* Used by c-lex.c, but only for objc. */
-
-tree
-lookup_interface (arg)
- tree arg;
-{
- return 0;
-}
-
-tree
-is_class_name (arg)
- tree arg;
-{
- return 0;
-}
-
-void
-maybe_objc_check_decl (decl)
- tree decl;
-{
-}
-
-int
-maybe_objc_comptypes (lhs, rhs, reflexive)
- tree lhs, rhs;
- int reflexive;
-{
- return -1;
-}
-
-tree
-maybe_objc_method_name (decl)
- tree decl;
-{
- return 0;
-}
-
-tree
-maybe_building_objc_message_expr ()
-{
- return 0;
-}
-
-int
-recognize_objc_keyword ()
-{
- return 0;
-}
-
-tree
-build_objc_string (len, str)
- int len;
- char *str;
-{
- abort ();
- return NULL_TREE;
-}
-
-void
-GNU_xref_begin ()
-{
- fatal ("GCC does not yet support XREF");
-}
-
-void
-GNU_xref_end ()
-{
- fatal ("GCC does not yet support XREF");
-}
-
-/* Called at end of parsing, but before end-of-file processing. */
-
-void
-finish_file ()
-{
- extern tree static_ctors, static_dtors;
- extern tree get_file_function_name ();
- extern tree build_function_call PROTO((tree, tree));
- tree void_list_node = build_tree_list (NULL_TREE, void_type_node);
-#ifndef ASM_OUTPUT_CONSTRUCTOR
- if (static_ctors)
- {
- tree fnname = get_file_function_name ('I');
- start_function (void_list_node,
- build_parse_node (CALL_EXPR, fnname, void_list_node,
- NULL_TREE),
- NULL_TREE, NULL_TREE, 0);
- fnname = DECL_ASSEMBLER_NAME (current_function_decl);
- store_parm_decls ();
-
- for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
- expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
- NULL_TREE));
-
- finish_function (0);
-
- assemble_constructor (IDENTIFIER_POINTER (fnname));
- }
-#endif
-#ifndef ASM_OUTPUT_DESTRUCTOR
- if (static_dtors)
- {
- tree fnname = get_file_function_name ('D');
- start_function (void_list_node,
- build_parse_node (CALL_EXPR, fnname, void_list_node,
- NULL_TREE),
- NULL_TREE, NULL_TREE, 0);
- fnname = DECL_ASSEMBLER_NAME (current_function_decl);
- store_parm_decls ();
-
- for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
- expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
- NULL_TREE));
-
- finish_function (0);
-
- assemble_destructor (IDENTIFIER_POINTER (fnname));
- }
-#endif
-}
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
deleted file mode 100644
index b9c21909152..00000000000
--- a/gcc/c-lex.c
+++ /dev/null
@@ -1,2016 +0,0 @@
-/* Lexical analyzer for C and Objective C.
- Copyright (C) 1987, 88, 89, 92, 94, 95, 1996 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. */
-
-
-#include <stdio.h>
-#include <errno.h>
-#include <setjmp.h>
-
-#include "config.h"
-#include "rtl.h"
-#include "tree.h"
-#include "input.h"
-#include "c-lex.h"
-#include "c-tree.h"
-#include "flags.h"
-#include "c-parse.h"
-#include "c-pragma.h"
-
-#include <ctype.h>
-
-#ifdef MULTIBYTE_CHARS
-#include <stdlib.h>
-#include <locale.h>
-#endif
-
-#ifndef errno
-extern int errno;
-#endif
-
-/* The elements of `ridpointers' are identifier nodes
- for the reserved type names and storage classes.
- It is indexed by a RID_... value. */
-tree ridpointers[(int) RID_MAX];
-
-/* Cause the `yydebug' variable to be defined. */
-#define YYDEBUG 1
-
-/* the declaration found for the last IDENTIFIER token read in.
- yylex must look this up to detect typedefs, which get token type TYPENAME,
- so it is left around in case the identifier is not a typedef but is
- used in a context which makes it a reference to a variable. */
-tree lastiddecl;
-
-/* Nonzero enables objc features. */
-
-int doing_objc_thang;
-
-extern tree is_class_name ();
-
-extern int yydebug;
-
-/* File used for outputting assembler code. */
-extern FILE *asm_out_file;
-
-#ifndef WCHAR_TYPE_SIZE
-#ifdef INT_TYPE_SIZE
-#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
-#else
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-#endif
-#endif
-
-/* Number of bytes in a wide character. */
-#define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
-
-static int maxtoken; /* Current nominal length of token buffer. */
-char *token_buffer; /* Pointer to token buffer.
- Actual allocated length is maxtoken + 2.
- This is not static because objc-parse.y uses it. */
-
-/* Nonzero if end-of-file has been seen on input. */
-static int end_of_file;
-
-/* Buffered-back input character; faster than using ungetc. */
-static int nextchar = -1;
-
-int check_newline ();
-
-/* Do not insert generated code into the source, instead, include it.
- This allows us to build gcc automatically even for targets that
- need to add or modify the reserved keyword lists. */
-#include "c-gperf.h"
-
-/* Return something to represent absolute declarators containing a *.
- TARGET is the absolute declarator that the * contains.
- TYPE_QUALS is a list of modifiers such as const or volatile
- to apply to the pointer type, represented as identifiers.
-
- We return an INDIRECT_REF whose "contents" are TARGET
- and whose type is the modifier list. */
-
-tree
-make_pointer_declarator (type_quals, target)
- tree type_quals, target;
-{
- return build1 (INDIRECT_REF, type_quals, target);
-}
-
-void
-forget_protocol_qualifiers ()
-{
- int i, n = sizeof wordlist / sizeof (struct resword);
-
- for (i = 0; i < n; i++)
- if ((int) wordlist[i].rid >= (int) RID_IN
- && (int) wordlist[i].rid <= (int) RID_ONEWAY)
- wordlist[i].name = "";
-}
-
-void
-remember_protocol_qualifiers ()
-{
- int i, n = sizeof wordlist / sizeof (struct resword);
-
- for (i = 0; i < n; i++)
- if (wordlist[i].rid == RID_IN)
- wordlist[i].name = "in";
- else if (wordlist[i].rid == RID_OUT)
- wordlist[i].name = "out";
- else if (wordlist[i].rid == RID_INOUT)
- wordlist[i].name = "inout";
- else if (wordlist[i].rid == RID_BYCOPY)
- wordlist[i].name = "bycopy";
- else if (wordlist[i].rid == RID_ONEWAY)
- wordlist[i].name = "oneway";
-}
-
-void
-init_lex ()
-{
- /* Make identifier nodes long enough for the language-specific slots. */
- set_identifier_size (sizeof (struct lang_identifier));
-
- /* Start it at 0, because check_newline is called at the very beginning
- and will increment it to 1. */
- lineno = 0;
-
-#ifdef MULTIBYTE_CHARS
- /* Change to the native locale for multibyte conversions. */
- setlocale (LC_CTYPE, "");
-#endif
-
- maxtoken = 40;
- token_buffer = (char *) xmalloc (maxtoken + 2);
-
- ridpointers[(int) RID_INT] = get_identifier ("int");
- ridpointers[(int) RID_CHAR] = get_identifier ("char");
- ridpointers[(int) RID_VOID] = get_identifier ("void");
- ridpointers[(int) RID_FLOAT] = get_identifier ("float");
- ridpointers[(int) RID_DOUBLE] = get_identifier ("double");
- ridpointers[(int) RID_SHORT] = get_identifier ("short");
- ridpointers[(int) RID_LONG] = get_identifier ("long");
- ridpointers[(int) RID_UNSIGNED] = get_identifier ("unsigned");
- ridpointers[(int) RID_SIGNED] = get_identifier ("signed");
- ridpointers[(int) RID_INLINE] = get_identifier ("inline");
- ridpointers[(int) RID_CONST] = get_identifier ("const");
- ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile");
- ridpointers[(int) RID_AUTO] = get_identifier ("auto");
- ridpointers[(int) RID_STATIC] = get_identifier ("static");
- ridpointers[(int) RID_EXTERN] = get_identifier ("extern");
- ridpointers[(int) RID_TYPEDEF] = get_identifier ("typedef");
- ridpointers[(int) RID_REGISTER] = get_identifier ("register");
- ridpointers[(int) RID_ITERATOR] = get_identifier ("iterator");
- ridpointers[(int) RID_COMPLEX] = get_identifier ("complex");
- ridpointers[(int) RID_ID] = get_identifier ("id");
- ridpointers[(int) RID_IN] = get_identifier ("in");
- ridpointers[(int) RID_OUT] = get_identifier ("out");
- ridpointers[(int) RID_INOUT] = get_identifier ("inout");
- ridpointers[(int) RID_BYCOPY] = get_identifier ("bycopy");
- ridpointers[(int) RID_ONEWAY] = get_identifier ("oneway");
- forget_protocol_qualifiers();
-
- /* Some options inhibit certain reserved words.
- Clear those words out of the hash table so they won't be recognized. */
-#define UNSET_RESERVED_WORD(STRING) \
- do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \
- if (s) s->name = ""; } while (0)
-
- if (! doing_objc_thang)
- UNSET_RESERVED_WORD ("id");
-
- if (flag_traditional)
- {
- UNSET_RESERVED_WORD ("const");
- UNSET_RESERVED_WORD ("volatile");
- UNSET_RESERVED_WORD ("typeof");
- UNSET_RESERVED_WORD ("signed");
- UNSET_RESERVED_WORD ("inline");
- UNSET_RESERVED_WORD ("iterator");
- UNSET_RESERVED_WORD ("complex");
- }
- if (flag_no_asm)
- {
- UNSET_RESERVED_WORD ("asm");
- UNSET_RESERVED_WORD ("typeof");
- UNSET_RESERVED_WORD ("inline");
- UNSET_RESERVED_WORD ("iterator");
- UNSET_RESERVED_WORD ("complex");
- }
-}
-
-void
-reinit_parse_for_function ()
-{
-}
-
-/* Function used when yydebug is set, to print a token in more detail. */
-
-void
-yyprint (file, yychar, yylval)
- FILE *file;
- int yychar;
- YYSTYPE yylval;
-{
- tree t;
- switch (yychar)
- {
- case IDENTIFIER:
- case TYPENAME:
- case OBJECTNAME:
- t = yylval.ttype;
- if (IDENTIFIER_POINTER (t))
- fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
- break;
-
- case CONSTANT:
- t = yylval.ttype;
- if (TREE_CODE (t) == INTEGER_CST)
- fprintf (file,
-#if HOST_BITS_PER_WIDE_INT == 64
-#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
- " 0x%lx%016lx",
-#else
- " 0x%x%016x",
-#endif
-#else
-#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
- " 0x%lx%08lx",
-#else
- " 0x%x%08x",
-#endif
-#endif
- TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
- break;
- }
-}
-
-
-/* If C is not whitespace, return C.
- Otherwise skip whitespace and return first nonwhite char read. */
-
-static int
-skip_white_space (c)
- register int c;
-{
- static int newline_warning = 0;
-
- for (;;)
- {
- switch (c)
- {
- /* We don't recognize comments here, because
- cpp output can include / and * consecutively as operators.
- Also, there's no need, since cpp removes all comments. */
-
- case '\n':
- c = check_newline ();
- break;
-
- case ' ':
- case '\t':
- case '\f':
- case '\v':
- case '\b':
- c = getc (finput);
- break;
-
- case '\r':
- /* ANSI C says the effects of a carriage return in a source file
- are undefined. */
- if (pedantic && !newline_warning)
- {
- warning ("carriage return in source file");
- warning ("(we only warn about the first carriage return)");
- newline_warning = 1;
- }
- c = getc (finput);
- break;
-
- case '\\':
- c = getc (finput);
- if (c == '\n')
- lineno++;
- else
- error ("stray '\\' in program");
- c = getc (finput);
- break;
-
- default:
- return (c);
- }
- }
-}
-
-/* Skips all of the white space at the current location in the input file.
- Must use and reset nextchar if it has the next character. */
-
-void
-position_after_white_space ()
-{
- register int c;
-
- if (nextchar != -1)
- c = nextchar, nextchar = -1;
- else
- c = getc (finput);
-
- ungetc (skip_white_space (c), finput);
-}
-
-/* Make the token buffer longer, preserving the data in it.
- P should point to just beyond the last valid character in the old buffer.
- The value we return is a pointer to the new buffer
- at a place corresponding to P. */
-
-static char *
-extend_token_buffer (p)
- char *p;
-{
- int offset = p - token_buffer;
-
- maxtoken = maxtoken * 2 + 10;
- token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2);
-
- return token_buffer + offset;
-}
-
-/* At the beginning of a line, increment the line number
- and process any #-directive on this line.
- If the line is a #-directive, read the entire line and return a newline.
- Otherwise, return the line's first non-whitespace character. */
-
-int
-check_newline ()
-{
- register int c;
- register int token;
-
- lineno++;
-
- /* Read first nonwhite char on the line. */
-
- c = getc (finput);
- while (c == ' ' || c == '\t')
- c = getc (finput);
-
- if (c != '#')
- {
- /* If not #, return it so caller will use it. */
- return c;
- }
-
- /* Read first nonwhite char after the `#'. */
-
- c = getc (finput);
- while (c == ' ' || c == '\t')
- c = getc (finput);
-
- /* If a letter follows, then if the word here is `line', skip
- it and ignore it; otherwise, ignore the line, with an error
- if the word isn't `pragma', `ident', `define', or `undef'. */
-
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
- {
- if (c == 'p')
- {
- if (getc (finput) == 'r'
- && getc (finput) == 'a'
- && getc (finput) == 'g'
- && getc (finput) == 'm'
- && getc (finput) == 'a'
- && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
- {
- while (c == ' ' || c == '\t')
- c = getc (finput);
- if (c == '\n')
- return c;
-#ifdef HANDLE_SYSV_PRAGMA
- ungetc (c, finput);
- token = yylex ();
- if (token != IDENTIFIER)
- goto skipline;
- return handle_sysv_pragma (finput, token);
-#else /* !HANDLE_SYSV_PRAGMA */
-#ifdef HANDLE_PRAGMA
- ungetc (c, finput);
- token = yylex ();
- if (token != IDENTIFIER)
- goto skipline;
- if (HANDLE_PRAGMA (finput, yylval.ttype))
- {
- c = getc (finput);
- return c;
- }
-#endif /* HANDLE_PRAGMA */
-#endif /* !HANDLE_SYSV_PRAGMA */
- goto skipline;
- }
- }
-
- else if (c == 'd')
- {
- if (getc (finput) == 'e'
- && getc (finput) == 'f'
- && getc (finput) == 'i'
- && getc (finput) == 'n'
- && getc (finput) == 'e'
- && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
- {
- if (c != '\n')
- debug_define (lineno, get_directive_line (finput));
- goto skipline;
- }
- }
- else if (c == 'u')
- {
- if (getc (finput) == 'n'
- && getc (finput) == 'd'
- && getc (finput) == 'e'
- && getc (finput) == 'f'
- && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
- {
- if (c != '\n')
- debug_undef (lineno, get_directive_line (finput));
- goto skipline;
- }
- }
- else if (c == 'l')
- {
- if (getc (finput) == 'i'
- && getc (finput) == 'n'
- && getc (finput) == 'e'
- && ((c = getc (finput)) == ' ' || c == '\t'))
- goto linenum;
- }
- else if (c == 'i')
- {
- if (getc (finput) == 'd'
- && getc (finput) == 'e'
- && getc (finput) == 'n'
- && getc (finput) == 't'
- && ((c = getc (finput)) == ' ' || c == '\t'))
- {
- /* #ident. The pedantic warning is now in cccp.c. */
-
- /* Here we have just seen `#ident '.
- A string constant should follow. */
-
- while (c == ' ' || c == '\t')
- c = getc (finput);
-
- /* If no argument, ignore the line. */
- if (c == '\n')
- return c;
-
- ungetc (c, finput);
- token = yylex ();
- if (token != STRING
- || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #ident");
- goto skipline;
- }
-
- if (!flag_no_ident)
- {
-#ifdef ASM_OUTPUT_IDENT
- ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (yylval.ttype));
-#endif
- }
-
- /* Skip the rest of this line. */
- goto skipline;
- }
- }
-
- error ("undefined or invalid # directive");
- goto skipline;
- }
-
-linenum:
- /* Here we have either `#line' or `# <nonletter>'.
- In either case, it should be a line number; a digit should follow. */
-
- while (c == ' ' || c == '\t')
- c = getc (finput);
-
- /* If the # is the only nonwhite char on the line,
- just ignore it. Check the new newline. */
- if (c == '\n')
- return c;
-
- /* Something follows the #; read a token. */
-
- ungetc (c, finput);
- token = yylex ();
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST)
- {
- int old_lineno = lineno;
- int used_up = 0;
- /* subtract one, because it is the following line that
- gets the specified number */
-
- int l = TREE_INT_CST_LOW (yylval.ttype) - 1;
-
- /* Is this the last nonwhite stuff on the line? */
- c = getc (finput);
- while (c == ' ' || c == '\t')
- c = getc (finput);
- if (c == '\n')
- {
- /* No more: store the line number and check following line. */
- lineno = l;
- return c;
- }
- ungetc (c, finput);
-
- /* More follows: it must be a string constant (filename). */
-
- /* Read the string constant. */
- token = yylex ();
-
- if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #line");
- goto skipline;
- }
-
- input_filename
- = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
- strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
- lineno = l;
-
- /* Each change of file name
- reinitializes whether we are now in a system header. */
- in_system_header = 0;
-
- if (main_input_filename == 0)
- main_input_filename = input_filename;
-
- /* Is this the last nonwhite stuff on the line? */
- c = getc (finput);
- while (c == ' ' || c == '\t')
- c = getc (finput);
- if (c == '\n')
- {
- /* Update the name in the top element of input_file_stack. */
- if (input_file_stack)
- input_file_stack->name = input_filename;
-
- return c;
- }
- ungetc (c, finput);
-
- token = yylex ();
- used_up = 0;
-
- /* `1' after file name means entering new file.
- `2' after file name means just left a file. */
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST)
- {
- if (TREE_INT_CST_LOW (yylval.ttype) == 1)
- {
- /* Pushing to a new file. */
- struct file_stack *p
- = (struct file_stack *) xmalloc (sizeof (struct file_stack));
- input_file_stack->line = old_lineno;
- p->next = input_file_stack;
- p->name = input_filename;
- input_file_stack = p;
- input_file_stack_tick++;
- debug_start_source_file (input_filename);
- used_up = 1;
- }
- else if (TREE_INT_CST_LOW (yylval.ttype) == 2)
- {
- /* Popping out of a file. */
- if (input_file_stack->next)
- {
- struct file_stack *p = input_file_stack;
- input_file_stack = p->next;
- free (p);
- input_file_stack_tick++;
- debug_end_source_file (input_file_stack->line);
- }
- else
- error ("#-lines for entering and leaving files don't match");
-
- used_up = 1;
- }
- }
-
- /* Now that we've pushed or popped the input stack,
- update the name in the top element. */
- if (input_file_stack)
- input_file_stack->name = input_filename;
-
- /* If we have handled a `1' or a `2',
- see if there is another number to read. */
- if (used_up)
- {
- /* Is this the last nonwhite stuff on the line? */
- c = getc (finput);
- while (c == ' ' || c == '\t')
- c = getc (finput);
- if (c == '\n')
- return c;
- ungetc (c, finput);
-
- token = yylex ();
- used_up = 0;
- }
-
- /* `3' after file name means this is a system header file. */
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST
- && TREE_INT_CST_LOW (yylval.ttype) == 3)
- in_system_header = 1, used_up = 1;
-
- if (used_up)
- {
- /* Is this the last nonwhite stuff on the line? */
- c = getc (finput);
- while (c == ' ' || c == '\t')
- c = getc (finput);
- if (c == '\n')
- return c;
- ungetc (c, finput);
- }
-
- warning ("unrecognized text at end of #line");
- }
- else
- error ("invalid #-line");
-
- /* skip the rest of this line. */
- skipline:
- while (c != '\n' && c != EOF)
- c = getc (finput);
- return c;
-}
-
-#ifdef HANDLE_SYSV_PRAGMA
-
-/* Handle a #pragma directive. INPUT is the current input stream,
- and TOKEN is the token we read after `#pragma'. Processes the entire input
- line and returns a character for the caller to reread: either \n or EOF. */
-
-/* This function has to be in this file, in order to get at
- the token types. */
-
-int
-handle_sysv_pragma (input, token)
- FILE *input;
- register int token;
-{
- register int c;
-
- for (;;)
- {
- switch (token)
- {
- case IDENTIFIER:
- case TYPENAME:
- case STRING:
- case CONSTANT:
- handle_pragma_token (token_buffer, yylval.ttype);
- break;
- default:
- handle_pragma_token (token_buffer, 0);
- }
-
- if (nextchar >= 0)
- c = nextchar, nextchar = -1;
- else
- c = getc (input);
-
- while (c == ' ' || c == '\t')
- c = getc (input);
- if (c == '\n' || c == EOF)
- {
- handle_pragma_token (0, 0);
- return c;
- }
- ungetc (c, input);
- token = yylex ();
- }
-}
-
-#endif /* HANDLE_SYSV_PRAGMA */
-
-#define ENDFILE -1 /* token that represents end-of-file */
-
-/* Read an escape sequence, returning its equivalent as a character,
- or store 1 in *ignore_ptr if it is backslash-newline. */
-
-static int
-readescape (ignore_ptr)
- int *ignore_ptr;
-{
- register int c = getc (finput);
- register int code;
- register unsigned count;
- unsigned firstdig = 0;
- int nonnull;
-
- switch (c)
- {
- case 'x':
- if (warn_traditional)
- warning ("the meaning of `\\x' varies with -traditional");
-
- if (flag_traditional)
- return c;
-
- code = 0;
- count = 0;
- nonnull = 0;
- while (1)
- {
- c = getc (finput);
- if (!(c >= 'a' && c <= 'f')
- && !(c >= 'A' && c <= 'F')
- && !(c >= '0' && c <= '9'))
- {
- ungetc (c, finput);
- break;
- }
- code *= 16;
- if (c >= 'a' && c <= 'f')
- code += c - 'a' + 10;
- if (c >= 'A' && c <= 'F')
- code += c - 'A' + 10;
- if (c >= '0' && c <= '9')
- code += c - '0';
- if (code != 0 || count != 0)
- {
- if (count == 0)
- firstdig = code;
- count++;
- }
- nonnull = 1;
- }
- if (! nonnull)
- error ("\\x used with no following hex digits");
- else if (count == 0)
- /* Digits are all 0's. Ok. */
- ;
- else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node)
- || (count > 1
- && ((1 << (TYPE_PRECISION (integer_type_node) - (count - 1) * 4))
- <= firstdig)))
- pedwarn ("hex escape out of range");
- return code;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7':
- code = 0;
- count = 0;
- while ((c <= '7') && (c >= '0') && (count++ < 3))
- {
- code = (code * 8) + (c - '0');
- c = getc (finput);
- }
- ungetc (c, finput);
- return code;
-
- case '\\': case '\'': case '"':
- return c;
-
- case '\n':
- lineno++;
- *ignore_ptr = 1;
- return 0;
-
- case 'n':
- return TARGET_NEWLINE;
-
- case 't':
- return TARGET_TAB;
-
- case 'r':
- return TARGET_CR;
-
- case 'f':
- return TARGET_FF;
-
- case 'b':
- return TARGET_BS;
-
- case 'a':
- if (warn_traditional)
- warning ("the meaning of `\\a' varies with -traditional");
-
- if (flag_traditional)
- return c;
- return TARGET_BELL;
-
- case 'v':
-#if 0 /* Vertical tab is present in common usage compilers. */
- if (flag_traditional)
- return c;
-#endif
- return TARGET_VT;
-
- case 'e':
- case 'E':
- if (pedantic)
- pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
- return 033;
-
- case '?':
- return c;
-
- /* `\(', etc, are used at beginning of line to avoid confusing Emacs. */
- case '(':
- case '{':
- case '[':
- /* `\%' is used to prevent SCCS from getting confused. */
- case '%':
- if (pedantic)
- pedwarn ("non-ANSI escape sequence `\\%c'", c);
- return c;
- }
- if (c >= 040 && c < 0177)
- pedwarn ("unknown escape sequence `\\%c'", c);
- else
- pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
- return c;
-}
-
-void
-yyerror (string)
- char *string;
-{
- char buf[200];
-
- strcpy (buf, string);
-
- /* We can't print string and character constants well
- because the token_buffer contains the result of processing escapes. */
- if (end_of_file)
- strcat (buf, " at end of input");
- else if (token_buffer[0] == 0)
- strcat (buf, " at null character");
- else if (token_buffer[0] == '"')
- strcat (buf, " before string constant");
- else if (token_buffer[0] == '\'')
- strcat (buf, " before character constant");
- else if (token_buffer[0] < 040 || (unsigned char) token_buffer[0] >= 0177)
- sprintf (buf + strlen (buf), " before character 0%o",
- (unsigned char) token_buffer[0]);
- else
- strcat (buf, " before `%s'");
-
- error (buf, token_buffer);
-}
-
-#if 0
-
-struct try_type
-{
- tree *node_var;
- char unsigned_flag;
- char long_flag;
- char long_long_flag;
-};
-
-struct try_type type_sequence[] =
-{
- { &integer_type_node, 0, 0, 0},
- { &unsigned_type_node, 1, 0, 0},
- { &long_integer_type_node, 0, 1, 0},
- { &long_unsigned_type_node, 1, 1, 0},
- { &long_long_integer_type_node, 0, 1, 1},
- { &long_long_unsigned_type_node, 1, 1, 1}
-};
-#endif /* 0 */
-
-int
-yylex ()
-{
- register int c;
- register char *p;
- register int value;
- int wide_flag = 0;
- int objc_flag = 0;
-
- if (nextchar >= 0)
- c = nextchar, nextchar = -1;
- else
- c = getc (finput);
-
- /* Effectively do c = skip_white_space (c)
- but do it faster in the usual cases. */
- while (1)
- switch (c)
- {
- case ' ':
- case '\t':
- case '\f':
- case '\v':
- case '\b':
- c = getc (finput);
- break;
-
- case '\r':
- /* Call skip_white_space so we can warn if appropriate. */
-
- case '\n':
- case '/':
- case '\\':
- c = skip_white_space (c);
- default:
- goto found_nonwhite;
- }
- found_nonwhite:
-
- token_buffer[0] = c;
- token_buffer[1] = 0;
-
-/* yylloc.first_line = lineno; */
-
- switch (c)
- {
- case EOF:
- end_of_file = 1;
- token_buffer[0] = 0;
- value = ENDFILE;
- break;
-
- case 'L':
- /* Capital L may start a wide-string or wide-character constant. */
- {
- register int c = getc (finput);
- if (c == '\'')
- {
- wide_flag = 1;
- goto char_constant;
- }
- if (c == '"')
- {
- wide_flag = 1;
- goto string_constant;
- }
- ungetc (c, finput);
- }
- goto letter;
-
- case '@':
- if (!doing_objc_thang)
- {
- value = c;
- break;
- }
- else
- {
- /* '@' may start a constant string object. */
- register int c = getc(finput);
- if (c == '"')
- {
- objc_flag = 1;
- goto string_constant;
- }
- ungetc(c, finput);
- /* Fall through to treat '@' as the start of an identifier. */
- }
-
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F': case 'G': case 'H': case 'I': case 'J':
- case 'K': case 'M': case 'N': case 'O':
- case 'P': case 'Q': case 'R': case 'S': case 'T':
- case 'U': case 'V': case 'W': case 'X': case 'Y':
- case 'Z':
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f': case 'g': case 'h': case 'i': case 'j':
- case 'k': case 'l': case 'm': case 'n': case 'o':
- case 'p': case 'q': case 'r': case 's': case 't':
- case 'u': case 'v': case 'w': case 'x': case 'y':
- case 'z':
- case '_':
- case '$':
- letter:
- p = token_buffer;
- while (isalnum (c) || c == '_' || c == '$' || c == '@')
- {
- /* Make sure this char really belongs in an identifier. */
- if (c == '@' && ! doing_objc_thang)
- break;
- if (c == '$')
- {
- if (! dollars_in_ident)
- error ("`$' in identifier");
- else if (pedantic)
- pedwarn ("`$' in identifier");
- }
-
- if (p >= token_buffer + maxtoken)
- p = extend_token_buffer (p);
-
- *p++ = c;
- c = getc (finput);
- }
-
- *p = 0;
- nextchar = c;
-
- value = IDENTIFIER;
- yylval.itype = 0;
-
- /* Try to recognize a keyword. Uses minimum-perfect hash function */
-
- {
- register struct resword *ptr;
-
- if (ptr = is_reserved_word (token_buffer, p - token_buffer))
- {
- if (ptr->rid)
- yylval.ttype = ridpointers[(int) ptr->rid];
- value = (int) ptr->token;
-
- /* Only return OBJECTNAME if it is a typedef. */
- if (doing_objc_thang && value == OBJECTNAME)
- {
- lastiddecl = lookup_name(yylval.ttype);
-
- if (lastiddecl == NULL_TREE
- || TREE_CODE (lastiddecl) != TYPE_DECL)
- value = IDENTIFIER;
- }
-
- /* Even if we decided to recognize asm, still perhaps warn. */
- if (pedantic
- && (value == ASM_KEYWORD || value == TYPEOF
- || ptr->rid == RID_INLINE)
- && token_buffer[0] != '_')
- pedwarn ("ANSI does not permit the keyword `%s'",
- token_buffer);
- }
- }
-
- /* If we did not find a keyword, look for an identifier
- (or a typename). */
-
- if (value == IDENTIFIER)
- {
- if (token_buffer[0] == '@')
- error("invalid identifier `%s'", token_buffer);
-
- yylval.ttype = get_identifier (token_buffer);
- lastiddecl = lookup_name (yylval.ttype);
-
- if (lastiddecl != 0 && TREE_CODE (lastiddecl) == TYPE_DECL)
- value = TYPENAME;
- /* A user-invisible read-only initialized variable
- should be replaced by its value.
- We handle only strings since that's the only case used in C. */
- else if (lastiddecl != 0 && TREE_CODE (lastiddecl) == VAR_DECL
- && DECL_IGNORED_P (lastiddecl)
- && TREE_READONLY (lastiddecl)
- && DECL_INITIAL (lastiddecl) != 0
- && TREE_CODE (DECL_INITIAL (lastiddecl)) == STRING_CST)
- {
- tree stringval = DECL_INITIAL (lastiddecl);
-
- /* Copy the string value so that we won't clobber anything
- if we put something in the TREE_CHAIN of this one. */
- yylval.ttype = build_string (TREE_STRING_LENGTH (stringval),
- TREE_STRING_POINTER (stringval));
- value = STRING;
- }
- else if (doing_objc_thang)
- {
- tree objc_interface_decl = is_class_name (yylval.ttype);
-
- if (objc_interface_decl)
- {
- value = CLASSNAME;
- yylval.ttype = objc_interface_decl;
- }
- }
- }
-
- break;
-
- case '0': case '1':
- {
- int next_c;
- /* Check first for common special case: single-digit 0 or 1. */
-
- next_c = getc (finput);
- ungetc (next_c, finput); /* Always undo this lookahead. */
- if (!isalnum (next_c) && next_c != '.')
- {
- token_buffer[0] = (char)c, token_buffer[1] = '\0';
- yylval.ttype = (c == '0') ? integer_zero_node : integer_one_node;
- value = CONSTANT;
- break;
- }
- /*FALLTHRU*/
- }
- case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case '.':
- {
- int base = 10;
- int count = 0;
- int largest_digit = 0;
- int numdigits = 0;
- /* for multi-precision arithmetic,
- we actually store only HOST_BITS_PER_CHAR bits in each part.
- The number of parts is chosen so as to be sufficient to hold
- the enough bits to fit into the two HOST_WIDE_INTs that contain
- the integer value (this is always at least as many bits as are
- in a target `long long' value, but may be wider). */
-#define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2 + 2)
- int parts[TOTAL_PARTS];
- int overflow = 0;
-
- enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS} floatflag
- = NOT_FLOAT;
-
- for (count = 0; count < TOTAL_PARTS; count++)
- parts[count] = 0;
-
- p = token_buffer;
- *p++ = c;
-
- if (c == '0')
- {
- *p++ = (c = getc (finput));
- if ((c == 'x') || (c == 'X'))
- {
- base = 16;
- *p++ = (c = getc (finput));
- }
- /* Leading 0 forces octal unless the 0 is the only digit. */
- else if (c >= '0' && c <= '9')
- {
- base = 8;
- numdigits++;
- }
- else
- numdigits++;
- }
-
- /* Read all the digits-and-decimal-points. */
-
- while (c == '.'
- || (isalnum (c) && c != 'l' && c != 'L'
- && c != 'u' && c != 'U'
- && c != 'i' && c != 'I' && c != 'j' && c != 'J'
- && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F')))))
- {
- if (c == '.')
- {
- if (base == 16)
- error ("floating constant may not be in radix 16");
- if (floatflag == TOO_MANY_POINTS)
- /* We have already emitted an error. Don't need another. */
- ;
- else if (floatflag == AFTER_POINT)
- {
- error ("malformed floating constant");
- floatflag = TOO_MANY_POINTS;
- /* Avoid another error from atof by forcing all characters
- from here on to be ignored. */
- p[-1] = '\0';
- }
- else
- floatflag = AFTER_POINT;
-
- base = 10;
- *p++ = c = getc (finput);
- /* Accept '.' as the start of a floating-point number
- only when it is followed by a digit.
- Otherwise, unread the following non-digit
- and use the '.' as a structural token. */
- if (p == token_buffer + 2 && !isdigit (c))
- {
- if (c == '.')
- {
- c = getc (finput);
- if (c == '.')
- {
- *p++ = c;
- *p = 0;
- return ELLIPSIS;
- }
- error ("parse error at `..'");
- }
- ungetc (c, finput);
- token_buffer[1] = 0;
- value = '.';
- goto done;
- }
- }
- else
- {
- /* It is not a decimal point.
- It should be a digit (perhaps a hex digit). */
-
- if (isdigit (c))
- {
- c = c - '0';
- }
- else if (base <= 10)
- {
- if (c == 'e' || c == 'E')
- {
- base = 10;
- floatflag = AFTER_POINT;
- break; /* start of exponent */
- }
- error ("nondigits in number and not hexadecimal");
- c = 0;
- }
- else if (c >= 'a')
- {
- c = c - 'a' + 10;
- }
- else
- {
- c = c - 'A' + 10;
- }
- if (c >= largest_digit)
- largest_digit = c;
- numdigits++;
-
- for (count = 0; count < TOTAL_PARTS; count++)
- {
- parts[count] *= base;
- if (count)
- {
- parts[count]
- += (parts[count-1] >> HOST_BITS_PER_CHAR);
- parts[count-1]
- &= (1 << HOST_BITS_PER_CHAR) - 1;
- }
- else
- parts[0] += c;
- }
-
- /* If the extra highest-order part ever gets anything in it,
- the number is certainly too big. */
- if (parts[TOTAL_PARTS - 1] != 0)
- overflow = 1;
-
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = (c = getc (finput));
- }
- }
-
- if (numdigits == 0)
- error ("numeric constant with no digits");
-
- if (largest_digit >= base)
- error ("numeric constant contains digits beyond the radix");
-
- /* Remove terminating char from the token buffer and delimit the string */
- *--p = 0;
-
- if (floatflag != NOT_FLOAT)
- {
- tree type = double_type_node;
- int exceeds_double = 0;
- int imag = 0;
- REAL_VALUE_TYPE value;
- jmp_buf handler;
-
- /* Read explicit exponent if any, and put it in tokenbuf. */
-
- if ((c == 'e') || (c == 'E'))
- {
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getc (finput);
- if ((c == '+') || (c == '-'))
- {
- *p++ = c;
- c = getc (finput);
- }
- if (! isdigit (c))
- error ("floating constant exponent has no digits");
- while (isdigit (c))
- {
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getc (finput);
- }
- }
-
- *p = 0;
- errno = 0;
-
- /* Convert string to a double, checking for overflow. */
- if (setjmp (handler))
- {
- error ("floating constant out of range");
- value = dconst0;
- }
- else
- {
- int fflag = 0, lflag = 0;
- /* Copy token_buffer now, while it has just the number
- and not the suffixes; once we add `f' or `i',
- REAL_VALUE_ATOF may not work any more. */
- char *copy = (char *) alloca (p - token_buffer + 1);
- bcopy (token_buffer, copy, p - token_buffer + 1);
-
- set_float_handler (handler);
-
- while (1)
- {
- int lose = 0;
-
- /* Read the suffixes to choose a data type. */
- switch (c)
- {
- case 'f': case 'F':
- if (fflag)
- error ("more than one `f' in numeric constant");
- fflag = 1;
- break;
-
- case 'l': case 'L':
- if (lflag)
- error ("more than one `l' in numeric constant");
- lflag = 1;
- break;
-
- case 'i': case 'I':
- if (imag)
- error ("more than one `i' or `j' in numeric constant");
- else if (pedantic)
- pedwarn ("ANSI C forbids imaginary numeric constants");
- imag = 1;
- break;
-
- default:
- lose = 1;
- }
-
- if (lose)
- break;
-
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- *p = 0;
- c = getc (finput);
- }
-
- /* The second argument, machine_mode, of REAL_VALUE_ATOF
- tells the desired precision of the binary result
- of decimal-to-binary conversion. */
-
- if (fflag)
- {
- if (lflag)
- error ("both `f' and `l' in floating constant");
-
- type = float_type_node;
- value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
- /* A diagnostic is required here by some ANSI C testsuites.
- This is not pedwarn, become some people don't want
- an error for this. */
- if (REAL_VALUE_ISINF (value) && pedantic)
- warning ("floating point number exceeds range of `float'");
- }
- else if (lflag)
- {
- type = long_double_type_node;
- value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
- if (REAL_VALUE_ISINF (value) && pedantic)
- warning ("floating point number exceeds range of `long double'");
- }
- else
- {
- value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
- if (REAL_VALUE_ISINF (value) && pedantic)
- warning ("floating point number exceeds range of `double'");
- }
-
- set_float_handler (NULL_PTR);
- }
-#ifdef ERANGE
- if (errno == ERANGE && !flag_traditional && pedantic)
- {
- /* ERANGE is also reported for underflow,
- so test the value to distinguish overflow from that. */
- if (REAL_VALUES_LESS (dconst1, value)
- || REAL_VALUES_LESS (value, dconstm1))
- {
- warning ("floating point number exceeds range of `double'");
- exceeds_double = 1;
- }
- }
-#endif
-
- /* If the result is not a number, assume it must have been
- due to some error message above, so silently convert
- it to a zero. */
- if (REAL_VALUE_ISNAN (value))
- value = dconst0;
-
- /* Create a node with determined type and value. */
- if (imag)
- yylval.ttype = build_complex (NULL_TREE,
- convert (type, integer_zero_node),
- build_real (type, value));
- else
- yylval.ttype = build_real (type, value);
- }
- else
- {
- tree traditional_type, ansi_type, type;
- HOST_WIDE_INT high, low;
- int spec_unsigned = 0;
- int spec_long = 0;
- int spec_long_long = 0;
- int spec_imag = 0;
- int bytes, warn, i;
-
- while (1)
- {
- if (c == 'u' || c == 'U')
- {
- if (spec_unsigned)
- error ("two `u's in integer constant");
- spec_unsigned = 1;
- }
- else if (c == 'l' || c == 'L')
- {
- if (spec_long)
- {
- if (spec_long_long)
- error ("three `l's in integer constant");
- else if (pedantic)
- pedwarn ("ANSI C forbids long long integer constants");
- spec_long_long = 1;
- }
- spec_long = 1;
- }
- else if (c == 'i' || c == 'j' || c == 'I' || c == 'J')
- {
- if (spec_imag)
- error ("more than one `i' or `j' in numeric constant");
- else if (pedantic)
- pedwarn ("ANSI C forbids imaginary numeric constants");
- spec_imag = 1;
- }
- else
- break;
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getc (finput);
- }
-
- /* If the constant is not long long and it won't fit in an
- unsigned long, or if the constant is long long and won't fit
- in an unsigned long long, then warn that the constant is out
- of range. */
-
- /* ??? This assumes that long long and long integer types are
- a multiple of 8 bits. This better than the original code
- though which assumed that long was exactly 32 bits and long
- long was exactly 64 bits. */
-
- if (spec_long_long)
- bytes = TYPE_PRECISION (long_long_integer_type_node) / 8;
- else
- bytes = TYPE_PRECISION (long_integer_type_node) / 8;
-
- warn = overflow;
- for (i = bytes; i < TOTAL_PARTS; i++)
- if (parts[i])
- warn = 1;
- if (warn)
- pedwarn ("integer constant out of range");
-
- /* This is simplified by the fact that our constant
- is always positive. */
-
- high = low = 0;
-
- for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
- {
- high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT
- / HOST_BITS_PER_CHAR)]
- << (i * HOST_BITS_PER_CHAR));
- low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR);
- }
-
- yylval.ttype = build_int_2 (low, high);
- TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node;
-
- /* If warn_traditional, calculate both the ANSI type and the
- traditional type, then see if they disagree.
- Otherwise, calculate only the type for the dialect in use. */
- if (warn_traditional || flag_traditional)
- {
- /* Calculate the traditional type. */
- /* Traditionally, any constant is signed;
- but if unsigned is specified explicitly, obey that.
- Use the smallest size with the right number of bits,
- except for one special case with decimal constants. */
- if (! spec_long && base != 10
- && int_fits_type_p (yylval.ttype, unsigned_type_node))
- traditional_type = (spec_unsigned ? unsigned_type_node
- : integer_type_node);
- /* A decimal constant must be long
- if it does not fit in type int.
- I think this is independent of whether
- the constant is signed. */
- else if (! spec_long && base == 10
- && int_fits_type_p (yylval.ttype, integer_type_node))
- traditional_type = (spec_unsigned ? unsigned_type_node
- : integer_type_node);
- else if (! spec_long_long)
- traditional_type = (spec_unsigned ? long_unsigned_type_node
- : long_integer_type_node);
- else
- traditional_type = (spec_unsigned
- ? long_long_unsigned_type_node
- : long_long_integer_type_node);
- }
- if (warn_traditional || ! flag_traditional)
- {
- /* Calculate the ANSI type. */
- if (! spec_long && ! spec_unsigned
- && int_fits_type_p (yylval.ttype, integer_type_node))
- ansi_type = integer_type_node;
- else if (! spec_long && (base != 10 || spec_unsigned)
- && int_fits_type_p (yylval.ttype, unsigned_type_node))
- ansi_type = unsigned_type_node;
- else if (! spec_unsigned && !spec_long_long
- && int_fits_type_p (yylval.ttype, long_integer_type_node))
- ansi_type = long_integer_type_node;
- else if (! spec_long_long)
- ansi_type = long_unsigned_type_node;
- else if (! spec_unsigned
- /* Verify value does not overflow into sign bit. */
- && TREE_INT_CST_HIGH (yylval.ttype) >= 0
- && int_fits_type_p (yylval.ttype,
- long_long_integer_type_node))
- ansi_type = long_long_integer_type_node;
- else
- ansi_type = long_long_unsigned_type_node;
- }
-
- type = flag_traditional ? traditional_type : ansi_type;
-
- if (warn_traditional && traditional_type != ansi_type)
- {
- if (TYPE_PRECISION (traditional_type)
- != TYPE_PRECISION (ansi_type))
- warning ("width of integer constant changes with -traditional");
- else if (TREE_UNSIGNED (traditional_type)
- != TREE_UNSIGNED (ansi_type))
- warning ("integer constant is unsigned in ANSI C, signed with -traditional");
- else
- warning ("width of integer constant may change on other systems with -traditional");
- }
-
- if (!flag_traditional && !int_fits_type_p (yylval.ttype, type)
- && !warn)
- pedwarn ("integer constant out of range");
-
- if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
- warning ("decimal constant is so large that it is unsigned");
-
- if (spec_imag)
- {
- if (TYPE_PRECISION (type)
- <= TYPE_PRECISION (integer_type_node))
- yylval.ttype
- = build_complex (NULL_TREE, integer_zero_node,
- convert (integer_type_node,
- yylval.ttype));
- else
- error ("complex integer constant is too wide for `complex int'");
- }
- else if (flag_traditional && !int_fits_type_p (yylval.ttype, type))
- /* The traditional constant 0x80000000 is signed
- but doesn't fit in the range of int.
- This will change it to -0x80000000, which does fit. */
- {
- TREE_TYPE (yylval.ttype) = unsigned_type (type);
- yylval.ttype = convert (type, yylval.ttype);
- TREE_OVERFLOW (yylval.ttype)
- = TREE_CONSTANT_OVERFLOW (yylval.ttype) = 0;
- }
- else
- TREE_TYPE (yylval.ttype) = type;
- }
-
- ungetc (c, finput);
- *p = 0;
-
- if (isalnum (c) || c == '.' || c == '_' || c == '$'
- || (!flag_traditional && (c == '-' || c == '+')
- && (p[-1] == 'e' || p[-1] == 'E')))
- error ("missing white space after number `%s'", token_buffer);
-
- value = CONSTANT; break;
- }
-
- case '\'':
- char_constant:
- {
- register int result = 0;
- register int num_chars = 0;
- unsigned width = TYPE_PRECISION (char_type_node);
- int max_chars;
-
- if (wide_flag)
- {
- width = WCHAR_TYPE_SIZE;
-#ifdef MULTIBYTE_CHARS
- max_chars = MB_CUR_MAX;
-#else
- max_chars = 1;
-#endif
- }
- else
- max_chars = TYPE_PRECISION (integer_type_node) / width;
-
- while (1)
- {
- tryagain:
-
- c = getc (finput);
-
- if (c == '\'' || c == EOF)
- break;
-
- if (c == '\\')
- {
- int ignore = 0;
- c = readescape (&ignore);
- if (ignore)
- goto tryagain;
- if (width < HOST_BITS_PER_INT
- && (unsigned) c >= (1 << width))
- pedwarn ("escape sequence out of range for character");
-#ifdef MAP_CHARACTER
- if (isprint (c))
- c = MAP_CHARACTER (c);
-#endif
- }
- else if (c == '\n')
- {
- if (pedantic)
- pedwarn ("ANSI C forbids newline in character constant");
- lineno++;
- }
-#ifdef MAP_CHARACTER
- else
- c = MAP_CHARACTER (c);
-#endif
-
- num_chars++;
- if (num_chars > maxtoken - 4)
- extend_token_buffer (token_buffer);
-
- token_buffer[num_chars] = c;
-
- /* Merge character into result; ignore excess chars. */
- if (num_chars < max_chars + 1)
- {
- if (width < HOST_BITS_PER_INT)
- result = (result << width) | (c & ((1 << width) - 1));
- else
- result = c;
- }
- }
-
- token_buffer[num_chars + 1] = '\'';
- token_buffer[num_chars + 2] = 0;
-
- if (c != '\'')
- error ("malformatted character constant");
- else if (num_chars == 0)
- error ("empty character constant");
- else if (num_chars > max_chars)
- {
- num_chars = max_chars;
- error ("character constant too long");
- }
- else if (num_chars != 1 && ! flag_traditional)
- warning ("multi-character character constant");
-
- /* If char type is signed, sign-extend the constant. */
- if (! wide_flag)
- {
- int num_bits = num_chars * width;
- if (num_bits == 0)
- /* We already got an error; avoid invalid shift. */
- yylval.ttype = build_int_2 (0, 0);
- else if (TREE_UNSIGNED (char_type_node)
- || ((result >> (num_bits - 1)) & 1) == 0)
- yylval.ttype
- = build_int_2 (result & ((unsigned HOST_WIDE_INT) ~0
- >> (HOST_BITS_PER_WIDE_INT - num_bits)),
- 0);
- else
- yylval.ttype
- = build_int_2 (result | ~((unsigned HOST_WIDE_INT) ~0
- >> (HOST_BITS_PER_WIDE_INT - num_bits)),
- -1);
- TREE_TYPE (yylval.ttype) = integer_type_node;
- }
- else
- {
-#ifdef MULTIBYTE_CHARS
- /* Set the initial shift state and convert the next sequence. */
- result = 0;
- /* In all locales L'\0' is zero and mbtowc will return zero,
- so don't use it. */
- if (num_chars > 1
- || (num_chars == 1 && token_buffer[1] != '\0'))
- {
- wchar_t wc;
- (void) mbtowc (NULL_PTR, NULL_PTR, 0);
- if (mbtowc (& wc, token_buffer + 1, num_chars) == num_chars)
- result = wc;
- else
- warning ("Ignoring invalid multibyte character");
- }
-#endif
- yylval.ttype = build_int_2 (result, 0);
- TREE_TYPE (yylval.ttype) = wchar_type_node;
- }
-
- value = CONSTANT;
- break;
- }
-
- case '"':
- string_constant:
- {
- c = getc (finput);
- p = token_buffer + 1;
-
- while (c != '"' && c >= 0)
- {
- if (c == '\\')
- {
- int ignore = 0;
- c = readescape (&ignore);
- if (ignore)
- goto skipnewline;
- if (!wide_flag
- && TYPE_PRECISION (char_type_node) < HOST_BITS_PER_INT
- && c >= (1 << TYPE_PRECISION (char_type_node)))
- pedwarn ("escape sequence out of range for character");
- }
- else if (c == '\n')
- {
- if (pedantic)
- pedwarn ("ANSI C forbids newline in string constant");
- lineno++;
- }
-
- if (p == token_buffer + maxtoken)
- p = extend_token_buffer (p);
- *p++ = c;
-
- skipnewline:
- c = getc (finput);
- }
- *p = 0;
-
- if (c < 0)
- error ("Unterminated string constant");
-
- /* We have read the entire constant.
- Construct a STRING_CST for the result. */
-
- if (wide_flag)
- {
- /* If this is a L"..." wide-string, convert the multibyte string
- to a wide character string. */
- char *widep = (char *) alloca ((p - token_buffer) * WCHAR_BYTES);
- int len;
-
-#ifdef MULTIBYTE_CHARS
- len = mbstowcs ((wchar_t *) widep, token_buffer + 1, p - token_buffer);
- if (len < 0 || len >= (p - token_buffer))
- {
- warning ("Ignoring invalid multibyte string");
- len = 0;
- }
- bzero (widep + (len * WCHAR_BYTES), WCHAR_BYTES);
-#else
- {
- union { long l; char c[sizeof (long)]; } u;
- int big_endian;
- char *wp, *cp;
-
- /* Determine whether host is little or big endian. */
- u.l = 1;
- big_endian = u.c[sizeof (long) - 1];
- wp = widep + (big_endian ? WCHAR_BYTES - 1 : 0);
-
- bzero (widep, (p - token_buffer) * WCHAR_BYTES);
- for (cp = token_buffer + 1; cp < p; cp++)
- *wp = *cp, wp += WCHAR_BYTES;
- len = p - token_buffer - 1;
- }
-#endif
- yylval.ttype = build_string ((len + 1) * WCHAR_BYTES, widep);
- TREE_TYPE (yylval.ttype) = wchar_array_type_node;
- value = STRING;
- }
- else if (objc_flag)
- {
- extern tree build_objc_string();
- /* Return an Objective-C @"..." constant string object. */
- yylval.ttype = build_objc_string (p - token_buffer,
- token_buffer + 1);
- TREE_TYPE (yylval.ttype) = char_array_type_node;
- value = OBJC_STRING;
- }
- else
- {
- yylval.ttype = build_string (p - token_buffer, token_buffer + 1);
- TREE_TYPE (yylval.ttype) = char_array_type_node;
- value = STRING;
- }
-
- *p++ = '"';
- *p = 0;
-
- break;
- }
-
- case '+':
- case '-':
- case '&':
- case '|':
- case ':':
- case '<':
- case '>':
- case '*':
- case '/':
- case '%':
- case '^':
- case '!':
- case '=':
- {
- register int c1;
-
- combine:
-
- switch (c)
- {
- case '+':
- yylval.code = PLUS_EXPR; break;
- case '-':
- yylval.code = MINUS_EXPR; break;
- case '&':
- yylval.code = BIT_AND_EXPR; break;
- case '|':
- yylval.code = BIT_IOR_EXPR; break;
- case '*':
- yylval.code = MULT_EXPR; break;
- case '/':
- yylval.code = TRUNC_DIV_EXPR; break;
- case '%':
- yylval.code = TRUNC_MOD_EXPR; break;
- case '^':
- yylval.code = BIT_XOR_EXPR; break;
- case LSHIFT:
- yylval.code = LSHIFT_EXPR; break;
- case RSHIFT:
- yylval.code = RSHIFT_EXPR; break;
- case '<':
- yylval.code = LT_EXPR; break;
- case '>':
- yylval.code = GT_EXPR; break;
- }
-
- token_buffer[1] = c1 = getc (finput);
- token_buffer[2] = 0;
-
- if (c1 == '=')
- {
- switch (c)
- {
- case '<':
- value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
- case '>':
- value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
- case '!':
- value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
- case '=':
- value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
- }
- value = ASSIGN; goto done;
- }
- else if (c == c1)
- switch (c)
- {
- case '+':
- value = PLUSPLUS; goto done;
- case '-':
- value = MINUSMINUS; goto done;
- case '&':
- value = ANDAND; goto done;
- case '|':
- value = OROR; goto done;
- case '<':
- c = LSHIFT;
- goto combine;
- case '>':
- c = RSHIFT;
- goto combine;
- }
- else
- switch (c)
- {
- case '-':
- if (c1 == '>')
- { value = POINTSAT; goto done; }
- break;
- case ':':
- if (c1 == '>')
- { value = ']'; goto done; }
- break;
- case '<':
- if (c1 == '%')
- { value = '{'; goto done; }
- if (c1 == ':')
- { value = '['; goto done; }
- break;
- case '%':
- if (c1 == '>')
- { value = '}'; goto done; }
- break;
- }
- ungetc (c1, finput);
- token_buffer[1] = 0;
-
- if ((c == '<') || (c == '>'))
- value = ARITHCOMPARE;
- else value = c;
- goto done;
- }
-
- case 0:
- /* Don't make yyparse think this is eof. */
- value = 1;
- break;
-
- default:
- value = c;
- }
-
-done:
-/* yylloc.last_line = lineno; */
-
- return value;
-}
-
-/* Sets the value of the 'yydebug' variable to VALUE.
- This is a function so we don't have to have YYDEBUG defined
- in order to build the compiler. */
-
-void
-set_yydebug (value)
- int value;
-{
-#if YYDEBUG != 0
- yydebug = value;
-#else
- warning ("YYDEBUG not defined.");
-#endif
-}
diff --git a/gcc/c-lex.h b/gcc/c-lex.h
deleted file mode 100644
index c1aed084e5f..00000000000
--- a/gcc/c-lex.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Define constants for communication with c-parse.y.
- Copyright (C) 1987, 1992 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. */
-
-
-
-enum rid
-{
- RID_UNUSED,
- RID_INT,
- RID_CHAR,
- RID_FLOAT,
- RID_DOUBLE,
- RID_VOID,
- RID_UNUSED1,
-
- RID_UNSIGNED,
- RID_SHORT,
- RID_LONG,
- RID_AUTO,
- RID_STATIC,
- RID_EXTERN,
- RID_REGISTER,
- RID_TYPEDEF,
- RID_SIGNED,
- RID_CONST,
- RID_VOLATILE,
- RID_INLINE,
- RID_NOALIAS,
- RID_ITERATOR,
- RID_COMPLEX,
-
- RID_IN,
- RID_OUT,
- RID_INOUT,
- RID_BYCOPY,
- RID_ONEWAY,
- RID_ID,
-
- RID_MAX
-};
-
-#define NORID RID_UNUSED
-
-#define RID_FIRST_MODIFIER RID_UNSIGNED
-
-/* The elements of `ridpointers' are identifier nodes
- for the reserved type names and storage classes.
- It is indexed by a RID_... value. */
-extern tree ridpointers[(int) RID_MAX];
-
-/* the declaration found for the last IDENTIFIER token read in.
- yylex must look this up to detect typedefs, which get token type TYPENAME,
- so it is left around in case the identifier is not a typedef but is
- used in a context which makes it a reference to a variable. */
-extern tree lastiddecl;
-
-extern char *token_buffer; /* Pointer to token buffer. */
-
-extern tree make_pointer_declarator ();
-extern void reinit_parse_for_function ();
-extern int yylex ();
-
-extern char *get_directive_line ();
diff --git a/gcc/c-parse.gperf b/gcc/c-parse.gperf
deleted file mode 100644
index 90cab6ad1d8..00000000000
--- a/gcc/c-parse.gperf
+++ /dev/null
@@ -1,84 +0,0 @@
-%{
-/* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
-%}
-struct resword { char *name; short token; enum rid rid; };
-%%
-@class, CLASS, NORID
-@compatibility_alias, ALIAS, NORID
-@defs, DEFS, NORID
-@encode, ENCODE, NORID
-@end, END, NORID
-@implementation, IMPLEMENTATION, NORID
-@interface, INTERFACE, NORID
-@private, PRIVATE, NORID
-@protected, PROTECTED, NORID
-@protocol, PROTOCOL, NORID
-@public, PUBLIC, NORID
-@selector, SELECTOR, NORID
-__alignof, ALIGNOF, NORID
-__alignof__, ALIGNOF, NORID
-__asm, ASM_KEYWORD, NORID
-__asm__, ASM_KEYWORD, NORID
-__attribute, ATTRIBUTE, NORID
-__attribute__, ATTRIBUTE, NORID
-__complex, TYPESPEC, RID_COMPLEX
-__complex__, TYPESPEC, RID_COMPLEX
-__const, TYPE_QUAL, RID_CONST
-__const__, TYPE_QUAL, RID_CONST
-__extension__, EXTENSION, NORID
-__imag, IMAGPART, NORID
-__imag__, IMAGPART, NORID
-__inline, SCSPEC, RID_INLINE
-__inline__, SCSPEC, RID_INLINE
-__iterator, SCSPEC, RID_ITERATOR
-__iterator__, SCSPEC, RID_ITERATOR
-__label__, LABEL, NORID
-__real, REALPART, NORID
-__real__, REALPART, NORID
-__signed, TYPESPEC, RID_SIGNED
-__signed__, TYPESPEC, RID_SIGNED
-__typeof, TYPEOF, NORID
-__typeof__, TYPEOF, NORID
-__volatile, TYPE_QUAL, RID_VOLATILE
-__volatile__, TYPE_QUAL, RID_VOLATILE
-asm, ASM_KEYWORD, NORID
-auto, SCSPEC, RID_AUTO
-break, BREAK, NORID
-bycopy, TYPE_QUAL, RID_BYCOPY
-case, CASE, NORID
-char, TYPESPEC, RID_CHAR
-const, TYPE_QUAL, RID_CONST
-continue, CONTINUE, NORID
-default, DEFAULT, NORID
-do, DO, NORID
-double, TYPESPEC, RID_DOUBLE
-else, ELSE, NORID
-enum, ENUM, NORID
-extern, SCSPEC, RID_EXTERN
-float, TYPESPEC, RID_FLOAT
-for, FOR, NORID
-goto, GOTO, NORID
-id, OBJECTNAME, RID_ID
-if, IF, NORID
-in, TYPE_QUAL, RID_IN
-inout, TYPE_QUAL, RID_INOUT
-inline, SCSPEC, RID_INLINE
-int, TYPESPEC, RID_INT
-long, TYPESPEC, RID_LONG
-oneway, TYPE_QUAL, RID_ONEWAY
-out, TYPE_QUAL, RID_OUT
-register, SCSPEC, RID_REGISTER
-return, RETURN, NORID
-short, TYPESPEC, RID_SHORT
-signed, TYPESPEC, RID_SIGNED
-sizeof, SIZEOF, NORID
-static, SCSPEC, RID_STATIC
-struct, STRUCT, NORID
-switch, SWITCH, NORID
-typedef, SCSPEC, RID_TYPEDEF
-typeof, TYPEOF, NORID
-union, UNION, NORID
-unsigned, TYPESPEC, RID_UNSIGNED
-void, TYPESPEC, RID_VOID
-volatile, TYPE_QUAL, RID_VOLATILE
-while, WHILE, NORID
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
deleted file mode 100644
index e395f86670e..00000000000
--- a/gcc/c-parse.in
+++ /dev/null
@@ -1,3017 +0,0 @@
-/* YACC parser for C syntax and for Objective C. -*-c-*-
- Copyright (C) 1987, 88, 89, 92-6, 1997 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 defines the grammar of C and that of Objective C.
- ifobjc ... end ifobjc conditionals contain code for Objective C only.
- ifc ... end ifc conditionals contain code for C only.
- Sed commands in Makefile.in are used to convert this file into
- c-parse.y and into objc-parse.y. */
-
-/* To whomever it may concern: I have heard that such a thing was once
- written by AT&T, but I have never seen it. */
-
-ifobjc
-%expect 66
-end ifobjc
-ifc
-%expect 46
-
-/* These are the 23 conflicts you should get in parse.output;
- the state numbers may vary if minor changes in the grammar are made.
-
-State 42 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTE.)
-State 44 contains 1 shift/reduce conflict. (Two ways to recover from error.)
-State 103 contains 1 shift/reduce conflict. (Two ways to recover from error.)
-State 110 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTE.)
-State 111 contains 1 shift/reduce conflict. (Two ways to recover from error.)
-State 115 contains 1 shift/reduce conflict. (Two ways to recover from error.)
-State 132 contains 1 shift/reduce conflict. (See comment at component_decl.)
-State 180 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTE.)
-State 194 contains 2 shift/reduce conflict. (Four ways to parse this.)
-State 202 contains 1 shift/reduce conflict. (Two ways to recover from error.)
-State 214 contains 1 shift/reduce conflict. (Two ways to recover from error.)
-State 220 contains 1 shift/reduce conflict. (Two ways to recover from error.)
-State 304 contains 2 shift/reduce conflicts. (Four ways to parse this.)
-State 335 contains 2 shift/reduce conflicts. (Four ways to parse this.)
-State 347 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTES.)
-State 352 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTES.)
-State 383 contains 2 shift/reduce conflicts. (Four ways to parse this.)
-State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */
-
-end ifc
-
-%{
-#include <stdio.h>
-#include <errno.h>
-#include <setjmp.h>
-
-#include "config.h"
-#include "tree.h"
-#include "input.h"
-#include "c-lex.h"
-#include "c-tree.h"
-#include "flags.h"
-
-#ifdef MULTIBYTE_CHARS
-#include <stdlib.h>
-#include <locale.h>
-#endif
-
-ifobjc
-#include "objc-act.h"
-end ifobjc
-
-/* Since parsers are distinct for each language, put the language string
- definition here. */
-ifobjc
-char *language_string = "GNU Obj-C";
-end ifobjc
-ifc
-char *language_string = "GNU C";
-end ifc
-
-#ifndef errno
-extern int errno;
-#endif
-
-void yyerror ();
-
-/* Like YYERROR but do call yyerror. */
-#define YYERROR1 { yyerror ("syntax error"); YYERROR; }
-
-/* Cause the `yydebug' variable to be defined. */
-#define YYDEBUG 1
-%}
-
-%start program
-
-%union {long itype; tree ttype; enum tree_code code;
- char *filename; int lineno; int ends_in_label; }
-
-/* All identifiers that are not reserved words
- and are not declared typedefs in the current block */
-%token IDENTIFIER
-
-/* All identifiers that are declared typedefs in the current block.
- In some contexts, they are treated just like IDENTIFIER,
- but they can also serve as typespecs in declarations. */
-%token TYPENAME
-
-/* Reserved words that specify storage class.
- yylval contains an IDENTIFIER_NODE which indicates which one. */
-%token SCSPEC
-
-/* Reserved words that specify type.
- yylval contains an IDENTIFIER_NODE which indicates which one. */
-%token TYPESPEC
-
-/* Reserved words that qualify type: "const" or "volatile".
- yylval contains an IDENTIFIER_NODE which indicates which one. */
-%token TYPE_QUAL
-
-/* Character or numeric constants.
- yylval is the node for the constant. */
-%token CONSTANT
-
-/* String constants in raw form.
- yylval is a STRING_CST node. */
-%token STRING
-
-/* "...", used for functions with variable arglists. */
-%token ELLIPSIS
-
-/* the reserved words */
-/* SCO include files test "ASM", so use something else. */
-%token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
-%token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
-%token ATTRIBUTE EXTENSION LABEL
-%token REALPART IMAGPART
-
-/* Add precedence rules to solve dangling else s/r conflict */
-%nonassoc IF
-%nonassoc ELSE
-
-/* Define the operator tokens and their precedences.
- The value is an integer because, if used, it is the tree code
- to use in the expression made from the operator. */
-
-%right <code> ASSIGN '='
-%right <code> '?' ':'
-%left <code> OROR
-%left <code> ANDAND
-%left <code> '|'
-%left <code> '^'
-%left <code> '&'
-%left <code> EQCOMPARE
-%left <code> ARITHCOMPARE
-%left <code> LSHIFT RSHIFT
-%left <code> '+' '-'
-%left <code> '*' '/' '%'
-%right <code> UNARY PLUSPLUS MINUSMINUS
-%left HYPERUNARY
-%left <code> POINTSAT '.' '(' '['
-
-/* The Objective-C keywords. These are included in C and in
- Objective C, so that the token codes are the same in both. */
-%token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE
-%token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS
-
-/* Objective-C string constants in raw form.
- yylval is an OBJC_STRING_CST node. */
-%token OBJC_STRING
-
-
-%type <code> unop
-
-%type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist
-%type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
-%type <ttype> typed_declspecs reserved_declspecs
-%type <ttype> typed_typespecs reserved_typespecquals
-%type <ttype> declmods typespec typespecqual_reserved
-%type <ttype> typed_declspecs_no_prefix_attr reserved_declspecs_no_prefix_attr
-%type <ttype> declmods_no_prefix_attr
-%type <ttype> SCSPEC TYPESPEC TYPE_QUAL nonempty_type_quals maybe_type_qual
-%type <ttype> initdecls notype_initdecls initdcl notype_initdcl
-%type <ttype> init maybeasm
-%type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
-%type <ttype> maybe_attribute attributes attribute attribute_list attrib
-%type <ttype> any_word
-
-%type <ttype> compstmt
-
-%type <ttype> declarator
-%type <ttype> notype_declarator after_type_declarator
-%type <ttype> parm_declarator
-
-%type <ttype> structsp component_decl_list component_decl_list2
-%type <ttype> component_decl components component_declarator
-%type <ttype> enumlist enumerator
-%type <ttype> typename absdcl absdcl1 type_quals
-%type <ttype> xexpr parms parm identifiers
-
-%type <ttype> parmlist parmlist_1 parmlist_2
-%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
-%type <ttype> identifiers_or_typenames
-
-%type <itype> setspecs
-
-%type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
-
-%type <filename> save_filename
-%type <lineno> save_lineno
-
-ifobjc
-/* the Objective-C nonterminals */
-
-%type <ttype> ivar_decl_list ivar_decls ivar_decl ivars ivar_declarator
-%type <ttype> methoddecl unaryselector keywordselector selector
-%type <ttype> keyworddecl receiver objcmessageexpr messageargs
-%type <ttype> keywordexpr keywordarglist keywordarg
-%type <ttype> myparms myparm optparmlist reservedwords objcselectorexpr
-%type <ttype> selectorarg keywordnamelist keywordname objcencodeexpr
-%type <ttype> objc_string non_empty_protocolrefs protocolrefs identifier_list objcprotocolexpr
-
-%type <ttype> CLASSNAME OBJC_STRING OBJECTNAME
-end ifobjc
-
-%{
-/* Number of statements (loosely speaking) seen so far. */
-static int stmt_count;
-
-/* Input file and line number of the end of the body of last simple_if;
- used by the stmt-rule immediately after simple_if returns. */
-static char *if_stmt_file;
-static int if_stmt_line;
-
-/* List of types and structure classes of the current declaration. */
-static tree current_declspecs = NULL_TREE;
-static tree prefix_attributes = NULL_TREE;
-
-/* Stack of saved values of current_declspecs and prefix_attributes. */
-static tree declspec_stack;
-
-/* 1 if we explained undeclared var errors. */
-static int undeclared_variable_notice;
-
-ifobjc
-/* Objective-C specific information */
-
-tree objc_interface_context;
-tree objc_implementation_context;
-tree objc_method_context;
-tree objc_ivar_chain;
-tree objc_ivar_context;
-enum tree_code objc_inherit_code;
-int objc_receiver_context;
-int objc_public_flag;
-
-end ifobjc
-
-/* Tell yyparse how to print a token's value, if yydebug is set. */
-
-#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
-extern void yyprint ();
-%}
-
-%%
-program: /* empty */
- { if (pedantic)
- pedwarn ("ANSI C forbids an empty source file");
- finish_file ();
- }
- | extdefs
- {
- /* In case there were missing closebraces,
- get us back to the global binding level. */
- while (! global_bindings_p ())
- poplevel (0, 0, 0);
- finish_file ();
- }
- ;
-
-/* the reason for the strange actions in this rule
- is so that notype_initdecls when reached via datadef
- can find a valid list of type and sc specs in $0. */
-
-extdefs:
- {$<ttype>$ = NULL_TREE; } extdef
- | extdefs {$<ttype>$ = NULL_TREE; } extdef
- ;
-
-extdef:
- fndef
- | datadef
-ifobjc
- | objcdef
-end ifobjc
- | ASM_KEYWORD '(' expr ')' ';'
- { STRIP_NOPS ($3);
- if ((TREE_CODE ($3) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
- || TREE_CODE ($3) == STRING_CST)
- assemble_asm ($3);
- else
- error ("argument of `asm' is not a constant string"); }
- | extension extdef
- { pedantic = $<itype>1; }
- ;
-
-datadef:
- setspecs notype_initdecls ';'
- { if (pedantic)
- error ("ANSI C forbids data definition with no type or storage class");
- else if (!flag_traditional)
- warning ("data definition has no type or storage class");
-
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($1); }
- | declmods setspecs notype_initdecls ';'
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | typed_declspecs setspecs initdecls ';'
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | declmods ';'
- { pedwarn ("empty declaration"); }
- | typed_declspecs ';'
- { shadow_tag ($1); }
- | error ';'
- | error '}'
- | ';'
- { if (pedantic)
- pedwarn ("ANSI C does not allow extra `;' outside of a function"); }
- ;
-
-fndef:
- typed_declspecs setspecs declarator
- { if (! start_function (current_declspecs, $3,
- prefix_attributes, NULL_TREE, 0))
- YYERROR1;
- reinit_parse_for_function (); }
- old_style_parm_decls
- { store_parm_decls (); }
- compstmt_or_error
- { finish_function (0);
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | typed_declspecs setspecs declarator error
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | declmods setspecs notype_declarator
- { if (! start_function (current_declspecs, $3,
- prefix_attributes, NULL_TREE, 0))
- YYERROR1;
- reinit_parse_for_function (); }
- old_style_parm_decls
- { store_parm_decls (); }
- compstmt_or_error
- { finish_function (0);
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | declmods setspecs notype_declarator error
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | setspecs notype_declarator
- { if (! start_function (NULL_TREE, $2,
- prefix_attributes, NULL_TREE, 0))
- YYERROR1;
- reinit_parse_for_function (); }
- old_style_parm_decls
- { store_parm_decls (); }
- compstmt_or_error
- { finish_function (0);
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($1); }
- | setspecs notype_declarator error
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($1); }
- ;
-
-identifier:
- IDENTIFIER
- | TYPENAME
-ifobjc
- | OBJECTNAME
- | CLASSNAME
-end ifobjc
- ;
-
-unop: '&'
- { $$ = ADDR_EXPR; }
- | '-'
- { $$ = NEGATE_EXPR; }
- | '+'
- { $$ = CONVERT_EXPR; }
- | PLUSPLUS
- { $$ = PREINCREMENT_EXPR; }
- | MINUSMINUS
- { $$ = PREDECREMENT_EXPR; }
- | '~'
- { $$ = BIT_NOT_EXPR; }
- | '!'
- { $$ = TRUTH_NOT_EXPR; }
- ;
-
-expr: nonnull_exprlist
- { $$ = build_compound_expr ($1); }
- ;
-
-exprlist:
- /* empty */
- { $$ = NULL_TREE; }
- | nonnull_exprlist
- ;
-
-nonnull_exprlist:
- expr_no_commas
- { $$ = build_tree_list (NULL_TREE, $1); }
- | nonnull_exprlist ',' expr_no_commas
- { chainon ($1, build_tree_list (NULL_TREE, $3)); }
- ;
-
-unary_expr:
- primary
- | '*' cast_expr %prec UNARY
- { $$ = build_indirect_ref ($2, "unary *"); }
- /* __extension__ turns off -pedantic for following primary. */
- | extension cast_expr %prec UNARY
- { $$ = $2;
- pedantic = $<itype>1; }
- | unop cast_expr %prec UNARY
- { $$ = build_unary_op ($1, $2, 0);
- overflow_warning ($$); }
- /* Refer to the address of a label as a pointer. */
- | ANDAND identifier
- { tree label = lookup_label ($2);
- if (pedantic)
- pedwarn ("ANSI C forbids `&&'");
- if (label == 0)
- $$ = null_pointer_node;
- else
- {
- TREE_USED (label) = 1;
- $$ = build1 (ADDR_EXPR, ptr_type_node, label);
- TREE_CONSTANT ($$) = 1;
- }
- }
-/* This seems to be impossible on some machines, so let's turn it off.
- You can use __builtin_next_arg to find the anonymous stack args.
- | '&' ELLIPSIS
- { tree types = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl));
- $$ = error_mark_node;
- if (TREE_VALUE (tree_last (types)) == void_type_node)
- error ("`&...' used in function with fixed number of arguments");
- else
- {
- if (pedantic)
- pedwarn ("ANSI C forbids `&...'");
- $$ = tree_last (DECL_ARGUMENTS (current_function_decl));
- $$ = build_unary_op (ADDR_EXPR, $$, 0);
- } }
-*/
- | sizeof unary_expr %prec UNARY
- { skip_evaluation--;
- if (TREE_CODE ($2) == COMPONENT_REF
- && DECL_BIT_FIELD (TREE_OPERAND ($2, 1)))
- error ("`sizeof' applied to a bit-field");
- $$ = c_sizeof (TREE_TYPE ($2)); }
- | sizeof '(' typename ')' %prec HYPERUNARY
- { skip_evaluation--;
- $$ = c_sizeof (groktypename ($3)); }
- | alignof unary_expr %prec UNARY
- { skip_evaluation--;
- $$ = c_alignof_expr ($2); }
- | alignof '(' typename ')' %prec HYPERUNARY
- { skip_evaluation--;
- $$ = c_alignof (groktypename ($3)); }
- | REALPART cast_expr %prec UNARY
- { $$ = build_unary_op (REALPART_EXPR, $2, 0); }
- | IMAGPART cast_expr %prec UNARY
- { $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
- ;
-
-sizeof:
- SIZEOF { skip_evaluation++; }
- ;
-
-alignof:
- ALIGNOF { skip_evaluation++; }
- ;
-
-cast_expr:
- unary_expr
- | '(' typename ')' cast_expr %prec UNARY
- { tree type = groktypename ($2);
- $$ = build_c_cast (type, $4); }
- | '(' typename ')' '{'
- { start_init (NULL_TREE, NULL, 0);
- $2 = groktypename ($2);
- really_start_incremental_init ($2); }
- initlist_maybe_comma '}' %prec UNARY
- { char *name;
- tree result = pop_init_level (0);
- tree type = $2;
- finish_init ();
-
- if (pedantic)
- pedwarn ("ANSI C forbids constructor expressions");
- if (TYPE_NAME (type) != 0)
- {
- if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- name = IDENTIFIER_POINTER (TYPE_NAME (type));
- else
- name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
- }
- else
- name = "";
- $$ = result;
- if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
- {
- int failure = complete_array_type (type, $$, 1);
- if (failure)
- abort ();
- }
- }
- ;
-
-expr_no_commas:
- cast_expr
- | expr_no_commas '+' expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas '-' expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas '*' expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas '/' expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas '%' expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas LSHIFT expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas RSHIFT expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas ARITHCOMPARE expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas EQCOMPARE expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas '&' expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas '|' expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas '^' expr_no_commas
- { $$ = parser_build_binary_op ($2, $1, $3); }
- | expr_no_commas ANDAND
- { $1 = truthvalue_conversion (default_conversion ($1));
- skip_evaluation += $1 == boolean_false_node; }
- expr_no_commas
- { skip_evaluation -= $1 == boolean_false_node;
- $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); }
- | expr_no_commas OROR
- { $1 = truthvalue_conversion (default_conversion ($1));
- skip_evaluation += $1 == boolean_true_node; }
- expr_no_commas
- { skip_evaluation -= $1 == boolean_true_node;
- $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); }
- | expr_no_commas '?'
- { $1 = truthvalue_conversion (default_conversion ($1));
- skip_evaluation += $1 == boolean_false_node; }
- expr ':'
- { skip_evaluation += (($1 == boolean_true_node)
- - ($1 == boolean_false_node)); }
- expr_no_commas
- { skip_evaluation -= $1 == boolean_true_node;
- $$ = build_conditional_expr ($1, $4, $7); }
- | expr_no_commas '?'
- { if (pedantic)
- pedwarn ("ANSI C forbids omitting the middle term of a ?: expression");
- /* Make sure first operand is calculated only once. */
- $<ttype>2 = save_expr ($1);
- $1 = truthvalue_conversion (default_conversion ($<ttype>2));
- skip_evaluation += $1 == boolean_true_node; }
- ':' expr_no_commas
- { skip_evaluation -= $1 == boolean_true_node;
- $$ = build_conditional_expr ($1, $<ttype>2, $5); }
- | expr_no_commas '=' expr_no_commas
- { $$ = build_modify_expr ($1, NOP_EXPR, $3);
- C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
- | expr_no_commas ASSIGN expr_no_commas
- { $$ = build_modify_expr ($1, $2, $3);
- /* This inhibits warnings in truthvalue_conversion. */
- C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
- ;
-
-primary:
- IDENTIFIER
- {
- $$ = lastiddecl;
- if (!$$ || $$ == error_mark_node)
- {
- if (yychar == YYEMPTY)
- yychar = YYLEX;
- if (yychar == '(')
- {
-ifobjc
- tree decl;
-
- if (objc_receiver_context
- && ! (objc_receiver_context
- && strcmp (IDENTIFIER_POINTER ($1), "super")))
- /* we have a message to super */
- $$ = get_super_receiver ();
- else if (objc_method_context
- && (decl = is_ivar (objc_ivar_chain, $1)))
- {
- if (is_private (decl))
- $$ = error_mark_node;
- else
- $$ = build_ivar_reference ($1);
- }
- else
-end ifobjc
- {
- /* Ordinary implicit function declaration. */
- $$ = implicitly_declare ($1);
- assemble_external ($$);
- TREE_USED ($$) = 1;
- }
- }
- else if (current_function_decl == 0)
- {
- error ("`%s' undeclared here (not in a function)",
- IDENTIFIER_POINTER ($1));
- $$ = error_mark_node;
- }
- else
- {
-ifobjc
- tree decl;
-
- if (objc_receiver_context
- && ! strcmp (IDENTIFIER_POINTER ($1), "super"))
- /* we have a message to super */
- $$ = get_super_receiver ();
- else if (objc_method_context
- && (decl = is_ivar (objc_ivar_chain, $1)))
- {
- if (is_private (decl))
- $$ = error_mark_node;
- else
- $$ = build_ivar_reference ($1);
- }
- else
-end ifobjc
- {
- if (IDENTIFIER_GLOBAL_VALUE ($1) != error_mark_node
- || IDENTIFIER_ERROR_LOCUS ($1) != current_function_decl)
- {
- error ("`%s' undeclared (first use this function)",
- IDENTIFIER_POINTER ($1));
-
- if (! undeclared_variable_notice)
- {
- error ("(Each undeclared identifier is reported only once");
- error ("for each function it appears in.)");
- undeclared_variable_notice = 1;
- }
- }
- $$ = error_mark_node;
- /* Prevent repeated error messages. */
- IDENTIFIER_GLOBAL_VALUE ($1) = error_mark_node;
- IDENTIFIER_ERROR_LOCUS ($1) = current_function_decl;
- }
- }
- }
- else if (TREE_TYPE ($$) == error_mark_node)
- $$ = error_mark_node;
- else if (C_DECL_ANTICIPATED ($$))
- {
- /* The first time we see a build-in function used,
- if it has not been declared. */
- C_DECL_ANTICIPATED ($$) = 0;
- if (yychar == YYEMPTY)
- yychar = YYLEX;
- if (yychar == '(')
- {
- /* Omit the implicit declaration we
- would ordinarily do, so we don't lose
- the actual built in type.
- But print a diagnostic for the mismatch. */
-ifobjc
- if (objc_method_context
- && is_ivar (objc_ivar_chain, $1))
- error ("Instance variable `%s' implicitly declared as function",
- IDENTIFIER_POINTER (DECL_NAME ($$)));
- else
-end ifobjc
- if (TREE_CODE ($$) != FUNCTION_DECL)
- error ("`%s' implicitly declared as function",
- IDENTIFIER_POINTER (DECL_NAME ($$)));
- else if ((TYPE_MODE (TREE_TYPE (TREE_TYPE ($$)))
- != TYPE_MODE (integer_type_node))
- && (TREE_TYPE (TREE_TYPE ($$))
- != void_type_node))
- pedwarn ("type mismatch in implicit declaration for built-in function `%s'",
- IDENTIFIER_POINTER (DECL_NAME ($$)));
- /* If it really returns void, change that to int. */
- if (TREE_TYPE (TREE_TYPE ($$)) == void_type_node)
- TREE_TYPE ($$)
- = build_function_type (integer_type_node,
- TYPE_ARG_TYPES (TREE_TYPE ($$)));
- }
- else
- pedwarn ("built-in function `%s' used without declaration",
- IDENTIFIER_POINTER (DECL_NAME ($$)));
-
- /* Do what we would ordinarily do when a fn is used. */
- assemble_external ($$);
- TREE_USED ($$) = 1;
- }
- else
- {
- assemble_external ($$);
- TREE_USED ($$) = 1;
-ifobjc
- /* we have a definition - still check if iVariable */
-
- if (!objc_receiver_context
- || (objc_receiver_context
- && strcmp (IDENTIFIER_POINTER ($1), "super")))
- {
- tree decl;
-
- if (objc_method_context
- && (decl = is_ivar (objc_ivar_chain, $1)))
- {
- if (IDENTIFIER_LOCAL_VALUE ($1))
- warning ("local declaration of `%s' hides instance variable",
- IDENTIFIER_POINTER ($1));
- else
- {
- if (is_private (decl))
- $$ = error_mark_node;
- else
- $$ = build_ivar_reference ($1);
- }
- }
- }
- else /* we have a message to super */
- $$ = get_super_receiver ();
-end ifobjc
- }
-
- if (TREE_CODE ($$) == CONST_DECL)
- {
- $$ = DECL_INITIAL ($$);
- /* This is to prevent an enum whose value is 0
- from being considered a null pointer constant. */
- $$ = build1 (NOP_EXPR, TREE_TYPE ($$), $$);
- TREE_CONSTANT ($$) = 1;
- }
- }
- | CONSTANT
- | string
- { $$ = combine_strings ($1); }
- | '(' expr ')'
- { char class = TREE_CODE_CLASS (TREE_CODE ($2));
- if (class == 'e' || class == '1'
- || class == '2' || class == '<')
- C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK);
- $$ = $2; }
- | '(' error ')'
- { $$ = error_mark_node; }
- | '('
- { if (current_function_decl == 0)
- {
- error ("braced-group within expression allowed only inside a function");
- YYERROR;
- }
- /* We must force a BLOCK for this level
- so that, if it is not expanded later,
- there is a way to turn off the entire subtree of blocks
- that are contained in it. */
- keep_next_level ();
- push_iterator_stack ();
- push_label_level ();
- $<ttype>$ = expand_start_stmt_expr (); }
- compstmt ')'
- { tree rtl_exp;
- if (pedantic)
- pedwarn ("ANSI C forbids braced-groups within expressions");
- pop_iterator_stack ();
- pop_label_level ();
- rtl_exp = expand_end_stmt_expr ($<ttype>2);
- /* The statements have side effects, so the group does. */
- TREE_SIDE_EFFECTS (rtl_exp) = 1;
-
- if (TREE_CODE ($3) == BLOCK)
- {
- /* Make a BIND_EXPR for the BLOCK already made. */
- $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
- NULL_TREE, rtl_exp, $3);
- /* Remove the block from the tree at this point.
- It gets put back at the proper place
- when the BIND_EXPR is expanded. */
- delete_block ($3);
- }
- else
- $$ = $3;
- }
- | primary '(' exprlist ')' %prec '.'
- { $$ = build_function_call ($1, $3); }
- | primary '[' expr ']' %prec '.'
- { $$ = build_array_ref ($1, $3); }
- | primary '.' identifier
- {
-ifobjc
- if (doing_objc_thang)
- {
- if (is_public ($1, $3))
- $$ = build_component_ref ($1, $3);
- else
- $$ = error_mark_node;
- }
- else
-end ifobjc
- $$ = build_component_ref ($1, $3);
- }
- | primary POINTSAT identifier
- {
- tree expr = build_indirect_ref ($1, "->");
-
-ifobjc
- if (doing_objc_thang)
- {
- if (is_public (expr, $3))
- $$ = build_component_ref (expr, $3);
- else
- $$ = error_mark_node;
- }
- else
-end ifobjc
- $$ = build_component_ref (expr, $3);
- }
- | primary PLUSPLUS
- { $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
- | primary MINUSMINUS
- { $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); }
-ifobjc
- | objcmessageexpr
- { $$ = build_message_expr ($1); }
- | objcselectorexpr
- { $$ = build_selector_expr ($1); }
- | objcprotocolexpr
- { $$ = build_protocol_expr ($1); }
- | objcencodeexpr
- { $$ = build_encode_expr ($1); }
- | objc_string
- { $$ = build_objc_string_object ($1); }
-end ifobjc
- ;
-
-/* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
-string:
- STRING
- | string STRING
- { $$ = chainon ($1, $2); }
- ;
-
-ifobjc
-/* Produces an OBJC_STRING_CST with perhaps more OBJC_STRING_CSTs chained
- onto it. */
-objc_string:
- OBJC_STRING
- | objc_string OBJC_STRING
- { $$ = chainon ($1, $2); }
- ;
-end ifobjc
-
-old_style_parm_decls:
- /* empty */
- | datadecls
- | datadecls ELLIPSIS
- /* ... is used here to indicate a varargs function. */
- { c_mark_varargs ();
- if (pedantic)
- pedwarn ("ANSI C does not permit use of `varargs.h'"); }
- ;
-
-/* The following are analogous to lineno_decl, decls and decl
- except that they do not allow nested functions.
- They are used for old-style parm decls. */
-lineno_datadecl:
- save_filename save_lineno datadecl
- { }
- ;
-
-datadecls:
- lineno_datadecl
- | errstmt
- | datadecls lineno_datadecl
- | lineno_datadecl errstmt
- ;
-
-/* We don't allow prefix attributes here because they cause reduce/reduce
- conflicts: we can't know whether we're parsing a function decl with
- attribute suffix, or function defn with attribute prefix on first old
- style parm. */
-datadecl:
- typed_declspecs_no_prefix_attr setspecs initdecls ';'
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | declmods_no_prefix_attr setspecs notype_initdecls ';'
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | typed_declspecs_no_prefix_attr ';'
- { shadow_tag_warned ($1, 1);
- pedwarn ("empty declaration"); }
- | declmods_no_prefix_attr ';'
- { pedwarn ("empty declaration"); }
- ;
-
-/* This combination which saves a lineno before a decl
- is the normal thing to use, rather than decl itself.
- This is to avoid shift/reduce conflicts in contexts
- where statement labels are allowed. */
-lineno_decl:
- save_filename save_lineno decl
- { }
- ;
-
-decls:
- lineno_decl
- | errstmt
- | decls lineno_decl
- | lineno_decl errstmt
- ;
-
-/* records the type and storage class specs to use for processing
- the declarators that follow.
- Maintains a stack of outer-level values of current_declspecs,
- for the sake of parm declarations nested in function declarators. */
-setspecs: /* empty */
- { $$ = suspend_momentary ();
- pending_xref_error ();
- declspec_stack = tree_cons (prefix_attributes,
- current_declspecs,
- declspec_stack);
- split_specs_attrs ($<ttype>0,
- &current_declspecs, &prefix_attributes); }
- ;
-
-/* ??? Yuck. See after_type_declarator. */
-setattrs: /* empty */
- { prefix_attributes = chainon (prefix_attributes, $<ttype>0); }
- ;
-
-decl:
- typed_declspecs setspecs initdecls ';'
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | declmods setspecs notype_initdecls ';'
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | typed_declspecs setspecs nested_function
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | declmods setspecs notype_nested_function
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | typed_declspecs ';'
- { shadow_tag ($1); }
- | declmods ';'
- { pedwarn ("empty declaration"); }
- | extension decl
- { pedantic = $<itype>1; }
- ;
-
-/* Declspecs which contain at least one type specifier or typedef name.
- (Just `const' or `volatile' is not enough.)
- A typedef'd name following these is taken as a name to be declared.
- Declspecs have a non-NULL TREE_VALUE, attributes do not. */
-
-typed_declspecs:
- typespec reserved_declspecs
- { $$ = tree_cons (NULL_TREE, $1, $2); }
- | declmods typespec reserved_declspecs
- { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
- ;
-
-reserved_declspecs: /* empty */
- { $$ = NULL_TREE; }
- | reserved_declspecs typespecqual_reserved
- { $$ = tree_cons (NULL_TREE, $2, $1); }
- | reserved_declspecs SCSPEC
- { if (extra_warnings)
- warning ("`%s' is not at beginning of declaration",
- IDENTIFIER_POINTER ($2));
- $$ = tree_cons (NULL_TREE, $2, $1); }
- | reserved_declspecs attributes
- { $$ = tree_cons ($2, NULL_TREE, $1); }
- ;
-
-typed_declspecs_no_prefix_attr:
- typespec reserved_declspecs_no_prefix_attr
- { $$ = tree_cons (NULL_TREE, $1, $2); }
- | declmods_no_prefix_attr typespec reserved_declspecs_no_prefix_attr
- { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
- ;
-
-reserved_declspecs_no_prefix_attr:
- /* empty */
- { $$ = NULL_TREE; }
- | reserved_declspecs_no_prefix_attr typespecqual_reserved
- { $$ = tree_cons (NULL_TREE, $2, $1); }
- | reserved_declspecs_no_prefix_attr SCSPEC
- { if (extra_warnings)
- warning ("`%s' is not at beginning of declaration",
- IDENTIFIER_POINTER ($2));
- $$ = tree_cons (NULL_TREE, $2, $1); }
- ;
-
-/* List of just storage classes, type modifiers, and prefix attributes.
- A declaration can start with just this, but then it cannot be used
- to redeclare a typedef-name.
- Declspecs have a non-NULL TREE_VALUE, attributes do not. */
-
-declmods:
- declmods_no_prefix_attr
- { $$ = $1; }
- | attributes
- { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
- | declmods declmods_no_prefix_attr
- { $$ = chainon ($2, $1); }
- | declmods attributes
- { $$ = tree_cons ($2, NULL_TREE, $1); }
- ;
-
-declmods_no_prefix_attr:
- TYPE_QUAL
- { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);
- TREE_STATIC ($$) = 1; }
- | SCSPEC
- { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
- | declmods_no_prefix_attr TYPE_QUAL
- { $$ = tree_cons (NULL_TREE, $2, $1);
- TREE_STATIC ($$) = 1; }
- | declmods_no_prefix_attr SCSPEC
- { if (extra_warnings && TREE_STATIC ($1))
- warning ("`%s' is not at beginning of declaration",
- IDENTIFIER_POINTER ($2));
- $$ = tree_cons (NULL_TREE, $2, $1);
- TREE_STATIC ($$) = TREE_STATIC ($1); }
- ;
-
-
-/* Used instead of declspecs where storage classes are not allowed
- (that is, for typenames and structure components).
- Don't accept a typedef-name if anything but a modifier precedes it. */
-
-typed_typespecs:
- typespec reserved_typespecquals
- { $$ = tree_cons (NULL_TREE, $1, $2); }
- | nonempty_type_quals typespec reserved_typespecquals
- { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); }
- ;
-
-reserved_typespecquals: /* empty */
- { $$ = NULL_TREE; }
- | reserved_typespecquals typespecqual_reserved
- { $$ = tree_cons (NULL_TREE, $2, $1); }
- ;
-
-/* A typespec (but not a type qualifier).
- Once we have seen one of these in a declaration,
- if a typedef name appears then it is being redeclared. */
-
-typespec: TYPESPEC
- | structsp
- | TYPENAME
- { /* For a typedef name, record the meaning, not the name.
- In case of `foo foo, bar;'. */
- $$ = lookup_name ($1); }
-ifobjc
- | CLASSNAME protocolrefs
- { $$ = get_static_reference ($1, $2); }
- | OBJECTNAME protocolrefs
- { $$ = get_object_reference ($2); }
-
-/* Make "<SomeProtocol>" equivalent to "id <SomeProtocol>"
- - nisse@lysator.liu.se */
- | non_empty_protocolrefs
- { $$ = get_object_reference ($1); }
-end ifobjc
- | TYPEOF '(' expr ')'
- { $$ = TREE_TYPE ($3); }
- | TYPEOF '(' typename ')'
- { $$ = groktypename ($3); }
- ;
-
-/* A typespec that is a reserved word, or a type qualifier. */
-
-typespecqual_reserved: TYPESPEC
- | TYPE_QUAL
- | structsp
- ;
-
-initdecls:
- initdcl
- | initdecls ',' initdcl
- ;
-
-notype_initdecls:
- notype_initdcl
- | notype_initdecls ',' initdcl
- ;
-
-maybeasm:
- /* empty */
- { $$ = NULL_TREE; }
- | ASM_KEYWORD '(' string ')'
- { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
- $$ = $3;
- }
- ;
-
-initdcl:
- declarator maybeasm maybe_attribute '='
- { $<ttype>$ = start_decl ($1, current_declspecs, 1,
- $3, prefix_attributes);
- start_init ($<ttype>$, $2, global_bindings_p ()); }
- init
-/* Note how the declaration of the variable is in effect while its init is parsed! */
- { finish_init ();
- finish_decl ($<ttype>5, $6, $2); }
- | declarator maybeasm maybe_attribute
- { tree d = start_decl ($1, current_declspecs, 0,
- $3, prefix_attributes);
- finish_decl (d, NULL_TREE, $2);
- }
- ;
-
-notype_initdcl:
- notype_declarator maybeasm maybe_attribute '='
- { $<ttype>$ = start_decl ($1, current_declspecs, 1,
- $3, prefix_attributes);
- start_init ($<ttype>$, $2, global_bindings_p ()); }
- init
-/* Note how the declaration of the variable is in effect while its init is parsed! */
- { finish_init ();
- decl_attributes ($<ttype>5, $3, prefix_attributes);
- finish_decl ($<ttype>5, $6, $2); }
- | notype_declarator maybeasm maybe_attribute
- { tree d = start_decl ($1, current_declspecs, 0,
- $3, prefix_attributes);
- finish_decl (d, NULL_TREE, $2); }
- ;
-/* the * rules are dummies to accept the Apollo extended syntax
- so that the header files compile. */
-maybe_attribute:
- /* empty */
- { $$ = NULL_TREE; }
- | attributes
- { $$ = $1; }
- ;
-
-attributes:
- attribute
- { $$ = $1; }
- | attributes attribute
- { $$ = chainon ($1, $2); }
- ;
-
-attribute:
- ATTRIBUTE '(' '(' attribute_list ')' ')'
- { $$ = $4; }
- ;
-
-attribute_list:
- attrib
- { $$ = $1; }
- | attribute_list ',' attrib
- { $$ = chainon ($1, $3); }
- ;
-
-attrib:
- /* empty */
- { $$ = NULL_TREE; }
- | any_word
- { $$ = build_tree_list ($1, NULL_TREE); }
- | any_word '(' IDENTIFIER ')'
- { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
- | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
- { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
- | any_word '(' exprlist ')'
- { $$ = build_tree_list ($1, $3); }
- ;
-
-/* This still leaves out most reserved keywords,
- shouldn't we include them? */
-
-any_word:
- identifier
- | SCSPEC
- | TYPESPEC
- | TYPE_QUAL
- ;
-
-/* Initializers. `init' is the entry point. */
-
-init:
- expr_no_commas
- | '{'
- { really_start_incremental_init (NULL_TREE);
- /* Note that the call to clear_momentary
- is in process_init_element. */
- push_momentary (); }
- initlist_maybe_comma '}'
- { $$ = pop_init_level (0);
- if ($$ == error_mark_node
- && ! (yychar == STRING || yychar == CONSTANT))
- pop_momentary ();
- else
- pop_momentary_nofree (); }
-
- | error
- { $$ = error_mark_node; }
- ;
-
-/* `initlist_maybe_comma' is the guts of an initializer in braces. */
-initlist_maybe_comma:
- /* empty */
- { if (pedantic)
- pedwarn ("ANSI C forbids empty initializer braces"); }
- | initlist1 maybecomma
- ;
-
-initlist1:
- initelt
- | initlist1 ',' initelt
- ;
-
-/* `initelt' is a single element of an initializer.
- It may use braces. */
-initelt:
- expr_no_commas
- { process_init_element ($1); }
- | '{'
- { push_init_level (0); }
- initlist_maybe_comma '}'
- { process_init_element (pop_init_level (0)); }
- | error
- /* These are for labeled elements. The syntax for an array element
- initializer conflicts with the syntax for an Objective-C message,
- so don't include these productions in the Objective-C grammar. */
-ifc
- | '[' expr_no_commas ELLIPSIS expr_no_commas ']' '='
- { set_init_index ($2, $4); }
- initelt
- | '[' expr_no_commas ']' '='
- { set_init_index ($2, NULL_TREE); }
- initelt
- | '[' expr_no_commas ']'
- { set_init_index ($2, NULL_TREE); }
- initelt
-end ifc
- | identifier ':'
- { set_init_label ($1); }
- initelt
- | '.' identifier '='
- { set_init_label ($2); }
- initelt
- ;
-
-nested_function:
- declarator
- { push_c_function_context ();
- if (! start_function (current_declspecs, $1,
- prefix_attributes, NULL_TREE, 1))
- {
- pop_c_function_context ();
- YYERROR1;
- }
- reinit_parse_for_function (); }
- old_style_parm_decls
- { store_parm_decls (); }
-/* This used to use compstmt_or_error.
- That caused a bug with input `f(g) int g {}',
- where the use of YYERROR1 above caused an error
- which then was handled by compstmt_or_error.
- There followed a repeated execution of that same rule,
- which called YYERROR1 again, and so on. */
- compstmt
- { finish_function (1);
- pop_c_function_context (); }
- ;
-
-notype_nested_function:
- notype_declarator
- { push_c_function_context ();
- if (! start_function (current_declspecs, $1,
- prefix_attributes, NULL_TREE, 1))
- {
- pop_c_function_context ();
- YYERROR1;
- }
- reinit_parse_for_function (); }
- old_style_parm_decls
- { store_parm_decls (); }
-/* This used to use compstmt_or_error.
- That caused a bug with input `f(g) int g {}',
- where the use of YYERROR1 above caused an error
- which then was handled by compstmt_or_error.
- There followed a repeated execution of that same rule,
- which called YYERROR1 again, and so on. */
- compstmt
- { finish_function (1);
- pop_c_function_context (); }
- ;
-
-/* Any kind of declarator (thus, all declarators allowed
- after an explicit typespec). */
-
-declarator:
- after_type_declarator
- | notype_declarator
- ;
-
-/* A declarator that is allowed only after an explicit typespec. */
-
-after_type_declarator:
- '(' after_type_declarator ')'
- { $$ = $2; }
- | after_type_declarator '(' parmlist_or_identifiers %prec '.'
- { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
-/* | after_type_declarator '(' error ')' %prec '.'
- { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
- poplevel (0, 0, 0); } */
- | after_type_declarator '[' expr ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, $1, $3); }
- | after_type_declarator '[' ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
- | '*' type_quals after_type_declarator %prec UNARY
- { $$ = make_pointer_declarator ($2, $3); }
- /* ??? Yuck. setattrs is a quick hack. We can't use
- prefix_attributes because $1 only applies to this
- declarator. We assume setspecs has already been done.
- setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple
- attributes could be recognized here or in `attributes'). */
- | attributes setattrs after_type_declarator
- { $$ = $3; }
- | TYPENAME
-ifobjc
- | OBJECTNAME
-end ifobjc
- ;
-
-/* Kinds of declarator that can appear in a parameter list
- in addition to notype_declarator. This is like after_type_declarator
- but does not allow a typedef name in parentheses as an identifier
- (because it would conflict with a function with that typedef as arg). */
-
-parm_declarator:
- parm_declarator '(' parmlist_or_identifiers %prec '.'
- { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
-/* | parm_declarator '(' error ')' %prec '.'
- { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
- poplevel (0, 0, 0); } */
- | parm_declarator '[' expr ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, $1, $3); }
- | parm_declarator '[' ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
- | '*' type_quals parm_declarator %prec UNARY
- { $$ = make_pointer_declarator ($2, $3); }
- /* ??? Yuck. setattrs is a quick hack. We can't use
- prefix_attributes because $1 only applies to this
- declarator. We assume setspecs has already been done.
- setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple
- attributes could be recognized here or in `attributes'). */
- | attributes setattrs parm_declarator
- { $$ = $3; }
- | TYPENAME
- ;
-
-/* A declarator allowed whether or not there has been
- an explicit typespec. These cannot redeclare a typedef-name. */
-
-notype_declarator:
- notype_declarator '(' parmlist_or_identifiers %prec '.'
- { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
-/* | notype_declarator '(' error ')' %prec '.'
- { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
- poplevel (0, 0, 0); } */
- | '(' notype_declarator ')'
- { $$ = $2; }
- | '*' type_quals notype_declarator %prec UNARY
- { $$ = make_pointer_declarator ($2, $3); }
- | notype_declarator '[' expr ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, $1, $3); }
- | notype_declarator '[' ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
- /* ??? Yuck. setattrs is a quick hack. We can't use
- prefix_attributes because $1 only applies to this
- declarator. We assume setspecs has already been done.
- setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple
- attributes could be recognized here or in `attributes'). */
- | attributes setattrs notype_declarator
- { $$ = $3; }
- | IDENTIFIER
- ;
-
-structsp:
- STRUCT identifier '{'
- { $$ = start_struct (RECORD_TYPE, $2);
- /* Start scope of tag before parsing components. */
- }
- component_decl_list '}' maybe_attribute
- { $$ = finish_struct ($<ttype>4, $5, $7); }
- | STRUCT '{' component_decl_list '}' maybe_attribute
- { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),
- $3, $5);
- }
- | STRUCT identifier
- { $$ = xref_tag (RECORD_TYPE, $2); }
- | UNION identifier '{'
- { $$ = start_struct (UNION_TYPE, $2); }
- component_decl_list '}' maybe_attribute
- { $$ = finish_struct ($<ttype>4, $5, $7); }
- | UNION '{' component_decl_list '}' maybe_attribute
- { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),
- $3, $5);
- }
- | UNION identifier
- { $$ = xref_tag (UNION_TYPE, $2); }
- | ENUM identifier '{'
- { $<itype>3 = suspend_momentary ();
- $$ = start_enum ($2); }
- enumlist maybecomma_warn '}' maybe_attribute
- { $$ = finish_enum ($<ttype>4, nreverse ($5), $8);
- resume_momentary ($<itype>3); }
- | ENUM '{'
- { $<itype>2 = suspend_momentary ();
- $$ = start_enum (NULL_TREE); }
- enumlist maybecomma_warn '}' maybe_attribute
- { $$ = finish_enum ($<ttype>3, nreverse ($4), $7);
- resume_momentary ($<itype>2); }
- | ENUM identifier
- { $$ = xref_tag (ENUMERAL_TYPE, $2); }
- ;
-
-maybecomma:
- /* empty */
- | ','
- ;
-
-maybecomma_warn:
- /* empty */
- | ','
- { if (pedantic) pedwarn ("comma at end of enumerator list"); }
- ;
-
-component_decl_list:
- component_decl_list2
- { $$ = $1; }
- | component_decl_list2 component_decl
- { $$ = chainon ($1, $2);
- pedwarn ("no semicolon at end of struct or union"); }
- ;
-
-component_decl_list2: /* empty */
- { $$ = NULL_TREE; }
- | component_decl_list2 component_decl ';'
- { $$ = chainon ($1, $2); }
- | component_decl_list2 ';'
- { if (pedantic)
- pedwarn ("extra semicolon in struct or union specified"); }
-ifobjc
- /* foo(sizeof(struct{ @defs(ClassName)})); */
- | DEFS '(' CLASSNAME ')'
- {
- tree interface = lookup_interface ($3);
-
- if (interface)
- $$ = get_class_ivars (interface);
- else
- {
- error ("Cannot find interface declaration for `%s'",
- IDENTIFIER_POINTER ($3));
- $$ = NULL_TREE;
- }
- }
-end ifobjc
- ;
-
-/* There is a shift-reduce conflict here, because `components' may
- start with a `typename'. It happens that shifting (the default resolution)
- does the right thing, because it treats the `typename' as part of
- a `typed_typespecs'.
-
- It is possible that this same technique would allow the distinction
- between `notype_initdecls' and `initdecls' to be eliminated.
- But I am being cautious and not trying it. */
-
-component_decl:
- typed_typespecs setspecs components
- { $$ = $3;
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | typed_typespecs
- { if (pedantic)
- pedwarn ("ANSI C forbids member declarations with no members");
- shadow_tag($1);
- $$ = NULL_TREE; }
- | nonempty_type_quals setspecs components
- { $$ = $3;
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | nonempty_type_quals
- { if (pedantic)
- pedwarn ("ANSI C forbids member declarations with no members");
- shadow_tag($1);
- $$ = NULL_TREE; }
- | error
- { $$ = NULL_TREE; }
- | extension component_decl
- { $$ = $2;
- pedantic = $<itype>1; }
- ;
-
-components:
- component_declarator
- | components ',' component_declarator
- { $$ = chainon ($1, $3); }
- ;
-
-component_declarator:
- save_filename save_lineno declarator maybe_attribute
- { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);
- decl_attributes ($$, $4, prefix_attributes); }
- | save_filename save_lineno
- declarator ':' expr_no_commas maybe_attribute
- { $$ = grokfield ($1, $2, $3, current_declspecs, $5);
- decl_attributes ($$, $6, prefix_attributes); }
- | save_filename save_lineno ':' expr_no_commas maybe_attribute
- { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);
- decl_attributes ($$, $5, prefix_attributes); }
- ;
-
-/* We chain the enumerators in reverse order.
- They are put in forward order where enumlist is used.
- (The order used to be significant, but no longer is so.
- However, we still maintain the order, just to be clean.) */
-
-enumlist:
- enumerator
- | enumlist ',' enumerator
- { if ($1 == error_mark_node)
- $$ = $1;
- else
- $$ = chainon ($3, $1); }
- | error
- { $$ = error_mark_node; }
- ;
-
-
-enumerator:
- identifier
- { $$ = build_enumerator ($1, NULL_TREE); }
- | identifier '=' expr_no_commas
- { $$ = build_enumerator ($1, $3); }
- ;
-
-typename:
- typed_typespecs absdcl
- { $$ = build_tree_list ($1, $2); }
- | nonempty_type_quals absdcl
- { $$ = build_tree_list ($1, $2); }
- ;
-
-absdcl: /* an absolute declarator */
- /* empty */
- { $$ = NULL_TREE; }
- | absdcl1
- ;
-
-nonempty_type_quals:
- TYPE_QUAL
- { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }
- | nonempty_type_quals TYPE_QUAL
- { $$ = tree_cons (NULL_TREE, $2, $1); }
- ;
-
-type_quals:
- /* empty */
- { $$ = NULL_TREE; }
- | type_quals TYPE_QUAL
- { $$ = tree_cons (NULL_TREE, $2, $1); }
- ;
-
-absdcl1: /* a nonempty absolute declarator */
- '(' absdcl1 ')'
- { $$ = $2; }
- /* `(typedef)1' is `int'. */
- | '*' type_quals absdcl1 %prec UNARY
- { $$ = make_pointer_declarator ($2, $3); }
- | '*' type_quals %prec UNARY
- { $$ = make_pointer_declarator ($2, NULL_TREE); }
- | absdcl1 '(' parmlist %prec '.'
- { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
- | absdcl1 '[' expr ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, $1, $3); }
- | absdcl1 '[' ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }
- | '(' parmlist %prec '.'
- { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }
- | '[' expr ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
- | '[' ']' %prec '.'
- { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }
- /* ??? It appears we have to support attributes here, however
- using prefix_attributes is wrong. */
- ;
-
-/* at least one statement, the first of which parses without error. */
-/* stmts is used only after decls, so an invalid first statement
- is actually regarded as an invalid decl and part of the decls. */
-
-stmts:
- lineno_stmt_or_labels
- {
- if (pedantic && $1)
- pedwarn ("ANSI C forbids label at end of compound statement");
- }
- ;
-
-lineno_stmt_or_labels:
- lineno_stmt_or_label
- | lineno_stmt_or_labels lineno_stmt_or_label
- { $$ = $2; }
- | lineno_stmt_or_labels errstmt
- { $$ = 0; }
- ;
-
-xstmts:
- /* empty */
- | stmts
- ;
-
-errstmt: error ';'
- ;
-
-pushlevel: /* empty */
- { emit_line_note (input_filename, lineno);
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
-ifobjc
- if (objc_method_context)
- add_objc_decls ();
-end ifobjc
- }
- ;
-
-/* Read zero or more forward-declarations for labels
- that nested functions can jump to. */
-maybe_label_decls:
- /* empty */
- | label_decls
- { if (pedantic)
- pedwarn ("ANSI C forbids label declarations"); }
- ;
-
-label_decls:
- label_decl
- | label_decls label_decl
- ;
-
-label_decl:
- LABEL identifiers_or_typenames ';'
- { tree link;
- for (link = $2; link; link = TREE_CHAIN (link))
- {
- tree label = shadow_label (TREE_VALUE (link));
- C_DECLARED_LABEL_FLAG (label) = 1;
- declare_nonlocal_label (label);
- }
- }
- ;
-
-/* This is the body of a function definition.
- It causes syntax errors to ignore to the next openbrace. */
-compstmt_or_error:
- compstmt
- {}
- | error compstmt
- ;
-
-compstmt: '{' '}'
- { $$ = convert (void_type_node, integer_zero_node); }
- | '{' pushlevel maybe_label_decls decls xstmts '}'
- { emit_line_note (input_filename, lineno);
- expand_end_bindings (getdecls (), 1, 0);
- $$ = poplevel (1, 1, 0);
- if (yychar == CONSTANT || yychar == STRING)
- pop_momentary_nofree ();
- else
- pop_momentary (); }
- | '{' pushlevel maybe_label_decls error '}'
- { emit_line_note (input_filename, lineno);
- expand_end_bindings (getdecls (), kept_level_p (), 0);
- $$ = poplevel (kept_level_p (), 0, 0);
- if (yychar == CONSTANT || yychar == STRING)
- pop_momentary_nofree ();
- else
- pop_momentary (); }
- | '{' pushlevel maybe_label_decls stmts '}'
- { emit_line_note (input_filename, lineno);
- expand_end_bindings (getdecls (), kept_level_p (), 0);
- $$ = poplevel (kept_level_p (), 0, 0);
- if (yychar == CONSTANT || yychar == STRING)
- pop_momentary_nofree ();
- else
- pop_momentary (); }
- ;
-
-/* Value is number of statements counted as of the closeparen. */
-simple_if:
- if_prefix lineno_labeled_stmt
-/* Make sure expand_end_cond is run once
- for each call to expand_start_cond.
- Otherwise a crash is likely. */
- | if_prefix error
- ;
-
-if_prefix:
- IF '(' expr ')'
- { emit_line_note ($<filename>-1, $<lineno>0);
- expand_start_cond (truthvalue_conversion ($3), 0);
- $<itype>$ = stmt_count;
- if_stmt_file = $<filename>-1;
- if_stmt_line = $<lineno>0;
- position_after_white_space (); }
- ;
-
-/* This is a subroutine of stmt.
- It is used twice, once for valid DO statements
- and once for catching errors in parsing the end test. */
-do_stmt_start:
- DO
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- /* See comment in `while' alternative, above. */
- emit_nop ();
- expand_start_loop_continue_elsewhere (1);
- position_after_white_space (); }
- lineno_labeled_stmt WHILE
- { expand_loop_continue_here (); }
- ;
-
-save_filename:
- { $$ = input_filename; }
- ;
-
-save_lineno:
- { $$ = lineno; }
- ;
-
-lineno_labeled_stmt:
- save_filename save_lineno stmt
- { }
-/* | save_filename save_lineno error
- { }
-*/
- | save_filename save_lineno label lineno_labeled_stmt
- { }
- ;
-
-lineno_stmt_or_label:
- save_filename save_lineno stmt_or_label
- { $$ = $3; }
- ;
-
-stmt_or_label:
- stmt
- { $$ = 0; }
- | label
- { $$ = 1; }
- ;
-
-/* Parse a single real statement, not including any labels. */
-stmt:
- compstmt
- { stmt_count++; }
- | all_iter_stmt
- | expr ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
-/* It appears that this should not be done--that a non-lvalue array
- shouldn't get an error if the value isn't used.
- Section 3.2.2.1 says that an array lvalue gets converted to a pointer
- if it appears as a top-level expression,
- but says nothing about non-lvalue arrays. */
-#if 0
- /* Call default_conversion to get an error
- on referring to a register array if pedantic. */
- if (TREE_CODE (TREE_TYPE ($1)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE ($1)) == FUNCTION_TYPE)
- $1 = default_conversion ($1);
-#endif
- iterator_expand ($1);
- clear_momentary (); }
- | simple_if ELSE
- { expand_start_else ();
- $<itype>1 = stmt_count;
- position_after_white_space (); }
- lineno_labeled_stmt
- { expand_end_cond ();
- if (extra_warnings && stmt_count == $<itype>1)
- warning ("empty body in an else-statement"); }
- | simple_if %prec IF
- { expand_end_cond ();
- /* This warning is here instead of in simple_if, because we
- do not want a warning if an empty if is followed by an
- else statement. Increment stmt_count so we don't
- give a second error if this is a nested `if'. */
- if (extra_warnings && stmt_count++ == $<itype>1)
- warning_with_file_and_line (if_stmt_file, if_stmt_line,
- "empty body in an if-statement"); }
-/* Make sure expand_end_cond is run once
- for each call to expand_start_cond.
- Otherwise a crash is likely. */
- | simple_if ELSE error
- { expand_end_cond (); }
- | WHILE
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- /* The emit_nop used to come before emit_line_note,
- but that made the nop seem like part of the preceding line.
- And that was confusing when the preceding line was
- inside of an if statement and was not really executed.
- I think it ought to work to put the nop after the line number.
- We will see. --rms, July 15, 1991. */
- emit_nop (); }
- '(' expr ')'
- { /* Don't start the loop till we have succeeded
- in parsing the end test. This is to make sure
- that we end every loop we start. */
- expand_start_loop (1);
- emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (NULL_PTR,
- truthvalue_conversion ($4));
- position_after_white_space (); }
- lineno_labeled_stmt
- { expand_end_loop (); }
- | do_stmt_start
- '(' expr ')' ';'
- { emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (NULL_PTR,
- truthvalue_conversion ($3));
- expand_end_loop ();
- clear_momentary (); }
-/* This rule is needed to make sure we end every loop we start. */
- | do_stmt_start error
- { expand_end_loop ();
- clear_momentary (); }
- | FOR
- '(' xexpr ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- /* See comment in `while' alternative, above. */
- emit_nop ();
- if ($3) c_expand_expr_stmt ($3);
- /* Next step is to call expand_start_loop_continue_elsewhere,
- but wait till after we parse the entire for (...).
- Otherwise, invalid input might cause us to call that
- fn without calling expand_end_loop. */
- }
- xexpr ';'
- /* Can't emit now; wait till after expand_start_loop... */
- { $<lineno>7 = lineno;
- $<filename>$ = input_filename; }
- xexpr ')'
- {
- /* Start the loop. Doing this after parsing
- all the expressions ensures we will end the loop. */
- expand_start_loop_continue_elsewhere (1);
- /* Emit the end-test, with a line number. */
- emit_line_note ($<filename>8, $<lineno>7);
- if ($6)
- expand_exit_loop_if_false (NULL_PTR,
- truthvalue_conversion ($6));
- /* Don't let the tree nodes for $9 be discarded by
- clear_momentary during the parsing of the next stmt. */
- push_momentary ();
- $<lineno>7 = lineno;
- $<filename>8 = input_filename;
- position_after_white_space (); }
- lineno_labeled_stmt
- { /* Emit the increment expression, with a line number. */
- emit_line_note ($<filename>8, $<lineno>7);
- expand_loop_continue_here ();
- if ($9)
- c_expand_expr_stmt ($9);
- if (yychar == CONSTANT || yychar == STRING)
- pop_momentary_nofree ();
- else
- pop_momentary ();
- expand_end_loop (); }
- | SWITCH '(' expr ')'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- c_expand_start_case ($3);
- /* Don't let the tree nodes for $3 be discarded by
- clear_momentary during the parsing of the next stmt. */
- push_momentary ();
- position_after_white_space (); }
- lineno_labeled_stmt
- { expand_end_case ($3);
- if (yychar == CONSTANT || yychar == STRING)
- pop_momentary_nofree ();
- else
- pop_momentary (); }
- | BREAK ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- if ( ! expand_exit_something ())
- error ("break statement not within loop or switch"); }
- | CONTINUE ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- if (! expand_continue_loop (NULL_PTR))
- error ("continue statement not within a loop"); }
- | RETURN ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- c_expand_return (NULL_TREE); }
- | RETURN expr ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- c_expand_return ($2); }
- | ASM_KEYWORD maybe_type_qual '(' expr ')' ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- STRIP_NOPS ($4);
- if ((TREE_CODE ($4) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND ($4, 0)) == STRING_CST)
- || TREE_CODE ($4) == STRING_CST)
- expand_asm ($4);
- else
- error ("argument of `asm' is not a constant string"); }
- /* This is the case with just output operands. */
- | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
- $2 == ridpointers[(int)RID_VOLATILE],
- input_filename, lineno); }
- /* This is the case with input operands as well. */
- | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' asm_operands ')' ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- c_expand_asm_operands ($4, $6, $8, NULL_TREE,
- $2 == ridpointers[(int)RID_VOLATILE],
- input_filename, lineno); }
- /* This is the case with clobbered registers as well. */
- | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
- asm_operands ':' asm_clobbers ')' ';'
- { stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- c_expand_asm_operands ($4, $6, $8, $10,
- $2 == ridpointers[(int)RID_VOLATILE],
- input_filename, lineno); }
- | GOTO identifier ';'
- { tree decl;
- stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- decl = lookup_label ($2);
- if (decl != 0)
- {
- TREE_USED (decl) = 1;
- expand_goto (decl);
- }
- }
- | GOTO '*' expr ';'
- { if (pedantic)
- pedwarn ("ANSI C forbids `goto *expr;'");
- stmt_count++;
- emit_line_note ($<filename>-1, $<lineno>0);
- expand_computed_goto (convert (ptr_type_node, $3)); }
- | ';'
- ;
-
-all_iter_stmt:
- all_iter_stmt_simple
-/* | all_iter_stmt_with_decl */
- ;
-
-all_iter_stmt_simple:
- FOR '(' primary ')'
- {
- /* The value returned by this action is */
- /* 1 if everything is OK */
- /* 0 in case of error or already bound iterator */
-
- $<itype>$ = 0;
- if (TREE_CODE ($3) != VAR_DECL)
- error ("invalid `for (ITERATOR)' syntax");
- else if (! ITERATOR_P ($3))
- error ("`%s' is not an iterator",
- IDENTIFIER_POINTER (DECL_NAME ($3)));
- else if (ITERATOR_BOUND_P ($3))
- error ("`for (%s)' inside expansion of same iterator",
- IDENTIFIER_POINTER (DECL_NAME ($3)));
- else
- {
- $<itype>$ = 1;
- iterator_for_loop_start ($3);
- }
- }
- lineno_labeled_stmt
- {
- if ($<itype>5)
- iterator_for_loop_end ($3);
- }
-
-/* This really should allow any kind of declaration,
- for generality. Fix it before turning it back on.
-
-all_iter_stmt_with_decl:
- FOR '(' ITERATOR pushlevel setspecs iterator_spec ')'
- {
-*/ /* The value returned by this action is */
- /* 1 if everything is OK */
- /* 0 in case of error or already bound iterator */
-/*
- iterator_for_loop_start ($6);
- }
- lineno_labeled_stmt
- {
- iterator_for_loop_end ($6);
- emit_line_note (input_filename, lineno);
- expand_end_bindings (getdecls (), 1, 0);
- $<ttype>$ = poplevel (1, 1, 0);
- if (yychar == CONSTANT || yychar == STRING)
- pop_momentary_nofree ();
- else
- pop_momentary ();
- }
-*/
-
-/* Any kind of label, including jump labels and case labels.
- ANSI C accepts labels only before statements, but we allow them
- also at the end of a compound statement. */
-
-label: CASE expr_no_commas ':'
- { register tree value = check_case_value ($2);
- register tree label
- = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- stmt_count++;
-
- if (value != error_mark_node)
- {
- tree duplicate;
- int success = pushcase (value, convert_and_check,
- label, &duplicate);
- if (success == 1)
- error ("case label not within a switch statement");
- else if (success == 2)
- {
- error ("duplicate case value");
- error_with_decl (duplicate, "this is the first entry for that value");
- }
- else if (success == 3)
- warning ("case value out of range");
- else if (success == 5)
- error ("case label within scope of cleanup or variable array");
- }
- position_after_white_space (); }
- | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
- { register tree value1 = check_case_value ($2);
- register tree value2 = check_case_value ($4);
- register tree label
- = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- if (pedantic)
- pedwarn ("ANSI C forbids case ranges");
- stmt_count++;
-
- if (value1 != error_mark_node && value2 != error_mark_node)
- {
- tree duplicate;
- int success = pushcase_range (value1, value2,
- convert_and_check, label,
- &duplicate);
- if (success == 1)
- error ("case label not within a switch statement");
- else if (success == 2)
- {
- error ("duplicate case value");
- error_with_decl (duplicate, "this is the first entry for that value");
- }
- else if (success == 3)
- warning ("case value out of range");
- else if (success == 4)
- warning ("empty case range");
- else if (success == 5)
- error ("case label within scope of cleanup or variable array");
- }
- position_after_white_space (); }
- | DEFAULT ':'
- {
- tree duplicate;
- register tree label
- = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
- int success = pushcase (NULL_TREE, 0, label, &duplicate);
- stmt_count++;
- if (success == 1)
- error ("default label not within a switch statement");
- else if (success == 2)
- {
- error ("multiple default labels in one switch");
- error_with_decl (duplicate, "this is the first default label");
- }
- position_after_white_space (); }
- | identifier ':'
- { tree label = define_label (input_filename, lineno, $1);
- stmt_count++;
- emit_nop ();
- if (label)
- expand_label (label);
- position_after_white_space (); }
- ;
-
-/* Either a type-qualifier or nothing. First thing in an `asm' statement. */
-
-maybe_type_qual:
- /* empty */
- { emit_line_note (input_filename, lineno);
- $$ = NULL_TREE; }
- | TYPE_QUAL
- { emit_line_note (input_filename, lineno); }
- ;
-
-xexpr:
- /* empty */
- { $$ = NULL_TREE; }
- | expr
- ;
-
-/* These are the operands other than the first string and colon
- in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
-asm_operands: /* empty */
- { $$ = NULL_TREE; }
- | nonnull_asm_operands
- ;
-
-nonnull_asm_operands:
- asm_operand
- | nonnull_asm_operands ',' asm_operand
- { $$ = chainon ($1, $3); }
- ;
-
-asm_operand:
- STRING '(' expr ')'
- { $$ = build_tree_list ($1, $3); }
- ;
-
-asm_clobbers:
- string
- { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE); }
- | asm_clobbers ',' string
- { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
- ;
-
-/* This is what appears inside the parens in a function declarator.
- Its value is a list of ..._TYPE nodes. */
-parmlist:
- { pushlevel (0);
- clear_parm_order ();
- declare_parm_level (0); }
- parmlist_1
- { $$ = $2;
- parmlist_tags_warning ();
- poplevel (0, 0, 0); }
- ;
-
-parmlist_1:
- parmlist_2 ')'
- | parms ';'
- { tree parm;
- if (pedantic)
- pedwarn ("ANSI C forbids forward parameter declarations");
- /* Mark the forward decls as such. */
- for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
- TREE_ASM_WRITTEN (parm) = 1;
- clear_parm_order (); }
- parmlist_1
- { $$ = $4; }
- | error ')'
- { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); }
- ;
-
-/* This is what appears inside the parens in a function declarator.
- Is value is represented in the format that grokdeclarator expects. */
-parmlist_2: /* empty */
- { $$ = get_parm_info (0); }
- | ELLIPSIS
- { $$ = get_parm_info (0);
- /* Gcc used to allow this as an extension. However, it does
- not work for all targets, and thus has been disabled.
- Also, since func (...) and func () are indistinguishable,
- it caused problems with the code in expand_builtin which
- tries to verify that BUILT_IN_NEXT_ARG is being used
- correctly. */
- error ("ANSI C requires a named argument before `...'");
- }
- | parms
- { $$ = get_parm_info (1); }
- | parms ',' ELLIPSIS
- { $$ = get_parm_info (0); }
- ;
-
-parms:
- parm
- { push_parm_decl ($1); }
- | parms ',' parm
- { push_parm_decl ($3); }
- ;
-
-/* A single parameter declaration or parameter type name,
- as found in a parmlist. */
-parm:
- typed_declspecs setspecs parm_declarator maybe_attribute
- { $$ = build_tree_list (build_tree_list (current_declspecs,
- $3),
- build_tree_list (prefix_attributes,
- $4));
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | typed_declspecs setspecs notype_declarator maybe_attribute
- { $$ = build_tree_list (build_tree_list (current_declspecs,
- $3),
- build_tree_list (prefix_attributes,
- $4));
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | typed_declspecs setspecs absdcl maybe_attribute
- { $$ = build_tree_list (build_tree_list (current_declspecs,
- $3),
- build_tree_list (prefix_attributes,
- $4));
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | declmods setspecs notype_declarator maybe_attribute
- { $$ = build_tree_list (build_tree_list (current_declspecs,
- $3),
- build_tree_list (prefix_attributes,
- $4));
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
-
- | declmods setspecs absdcl maybe_attribute
- { $$ = build_tree_list (build_tree_list (current_declspecs,
- $3),
- build_tree_list (prefix_attributes,
- $4));
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- ;
-
-/* This is used in a function definition
- where either a parmlist or an identifier list is ok.
- Its value is a list of ..._TYPE nodes or a list of identifiers. */
-parmlist_or_identifiers:
- { pushlevel (0);
- clear_parm_order ();
- declare_parm_level (1); }
- parmlist_or_identifiers_1
- { $$ = $2;
- parmlist_tags_warning ();
- poplevel (0, 0, 0); }
- ;
-
-parmlist_or_identifiers_1:
- parmlist_1
- | identifiers ')'
- { tree t;
- for (t = $1; t; t = TREE_CHAIN (t))
- if (TREE_VALUE (t) == NULL_TREE)
- error ("`...' in old-style identifier list");
- $$ = tree_cons (NULL_TREE, NULL_TREE, $1); }
- ;
-
-/* A nonempty list of identifiers. */
-identifiers:
- IDENTIFIER
- { $$ = build_tree_list (NULL_TREE, $1); }
- | identifiers ',' IDENTIFIER
- { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
- ;
-
-/* A nonempty list of identifiers, including typenames. */
-identifiers_or_typenames:
- identifier
- { $$ = build_tree_list (NULL_TREE, $1); }
- | identifiers_or_typenames ',' identifier
- { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
- ;
-
-extension:
- EXTENSION
- { $<itype>$ = pedantic;
- pedantic = 0; }
- ;
-
-ifobjc
-/* Objective-C productions. */
-
-objcdef:
- classdef
- | classdecl
- | aliasdecl
- | protocoldef
- | methoddef
- | END
- {
- if (objc_implementation_context)
- {
- finish_class (objc_implementation_context);
- objc_ivar_chain = NULL_TREE;
- objc_implementation_context = NULL_TREE;
- }
- else
- warning ("`@end' must appear in an implementation context");
- }
- ;
-
-/* A nonempty list of identifiers. */
-identifier_list:
- identifier
- { $$ = build_tree_list (NULL_TREE, $1); }
- | identifier_list ',' identifier
- { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
- ;
-
-classdecl:
- CLASS identifier_list ';'
- {
- objc_declare_class ($2);
- }
-
-aliasdecl:
- ALIAS identifier identifier ';'
- {
- objc_declare_alias ($2, $3);
- }
-
-classdef:
- INTERFACE identifier protocolrefs '{'
- {
- objc_interface_context = objc_ivar_context
- = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
- objc_public_flag = 0;
- }
- ivar_decl_list '}'
- {
- continue_class (objc_interface_context);
- }
- methodprotolist
- END
- {
- finish_class (objc_interface_context);
- objc_interface_context = NULL_TREE;
- }
-
- | INTERFACE identifier protocolrefs
- {
- objc_interface_context
- = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3);
- continue_class (objc_interface_context);
- }
- methodprotolist
- END
- {
- finish_class (objc_interface_context);
- objc_interface_context = NULL_TREE;
- }
-
- | INTERFACE identifier ':' identifier protocolrefs '{'
- {
- objc_interface_context = objc_ivar_context
- = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
- objc_public_flag = 0;
- }
- ivar_decl_list '}'
- {
- continue_class (objc_interface_context);
- }
- methodprotolist
- END
- {
- finish_class (objc_interface_context);
- objc_interface_context = NULL_TREE;
- }
-
- | INTERFACE identifier ':' identifier protocolrefs
- {
- objc_interface_context
- = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5);
- continue_class (objc_interface_context);
- }
- methodprotolist
- END
- {
- finish_class (objc_interface_context);
- objc_interface_context = NULL_TREE;
- }
-
- | IMPLEMENTATION identifier '{'
- {
- objc_implementation_context = objc_ivar_context
- = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
- objc_public_flag = 0;
- }
- ivar_decl_list '}'
- {
- objc_ivar_chain
- = continue_class (objc_implementation_context);
- }
-
- | IMPLEMENTATION identifier
- {
- objc_implementation_context
- = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE);
- objc_ivar_chain
- = continue_class (objc_implementation_context);
- }
-
- | IMPLEMENTATION identifier ':' identifier '{'
- {
- objc_implementation_context = objc_ivar_context
- = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
- objc_public_flag = 0;
- }
- ivar_decl_list '}'
- {
- objc_ivar_chain
- = continue_class (objc_implementation_context);
- }
-
- | IMPLEMENTATION identifier ':' identifier
- {
- objc_implementation_context
- = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
- objc_ivar_chain
- = continue_class (objc_implementation_context);
- }
-
- | INTERFACE identifier '(' identifier ')' protocolrefs
- {
- objc_interface_context
- = start_class (CATEGORY_INTERFACE_TYPE, $2, $4, $6);
- continue_class (objc_interface_context);
- }
- methodprotolist
- END
- {
- finish_class (objc_interface_context);
- objc_interface_context = NULL_TREE;
- }
-
- | IMPLEMENTATION identifier '(' identifier ')'
- {
- objc_implementation_context
- = start_class (CATEGORY_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE);
- objc_ivar_chain
- = continue_class (objc_implementation_context);
- }
- ;
-
-protocoldef:
- PROTOCOL identifier protocolrefs
- {
- remember_protocol_qualifiers ();
- objc_interface_context
- = start_protocol(PROTOCOL_INTERFACE_TYPE, $2, $3);
- }
- methodprotolist END
- {
- forget_protocol_qualifiers();
- finish_protocol(objc_interface_context);
- objc_interface_context = NULL_TREE;
- }
- ;
-
-protocolrefs:
- /* empty */
- {
- $$ = NULL_TREE;
- }
- | non_empty_protocolrefs
- ;
-
-non_empty_protocolrefs:
- ARITHCOMPARE identifier_list ARITHCOMPARE
- {
- if ($1 == LT_EXPR && $3 == GT_EXPR)
- $$ = $2;
- else
- YYERROR1;
- }
- ;
-
-ivar_decl_list:
- ivar_decl_list visibility_spec ivar_decls
- | ivar_decls
- ;
-
-visibility_spec:
- PRIVATE { objc_public_flag = 2; }
- | PROTECTED { objc_public_flag = 0; }
- | PUBLIC { objc_public_flag = 1; }
- ;
-
-ivar_decls:
- /* empty */
- {
- $$ = NULL_TREE;
- }
- | ivar_decls ivar_decl ';'
- | ivar_decls ';'
- {
- if (pedantic)
- pedwarn ("extra semicolon in struct or union specified");
- }
- ;
-
-
-/* There is a shift-reduce conflict here, because `components' may
- start with a `typename'. It happens that shifting (the default resolution)
- does the right thing, because it treats the `typename' as part of
- a `typed_typespecs'.
-
- It is possible that this same technique would allow the distinction
- between `notype_initdecls' and `initdecls' to be eliminated.
- But I am being cautious and not trying it. */
-
-ivar_decl:
- typed_typespecs setspecs ivars
- { $$ = $3;
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | nonempty_type_quals setspecs ivars
- { $$ = $3;
- current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | error
- { $$ = NULL_TREE; }
- ;
-
-ivars:
- /* empty */
- { $$ = NULL_TREE; }
- | ivar_declarator
- | ivars ',' ivar_declarator
- ;
-
-ivar_declarator:
- declarator
- {
- $$ = add_instance_variable (objc_ivar_context,
- objc_public_flag,
- $1, current_declspecs,
- NULL_TREE);
- }
- | declarator ':' expr_no_commas
- {
- $$ = add_instance_variable (objc_ivar_context,
- objc_public_flag,
- $1, current_declspecs, $3);
- }
- | ':' expr_no_commas
- {
- $$ = add_instance_variable (objc_ivar_context,
- objc_public_flag,
- NULL_TREE,
- current_declspecs, $2);
- }
- ;
-
-methoddef:
- '+'
- {
- remember_protocol_qualifiers ();
- if (objc_implementation_context)
- objc_inherit_code = CLASS_METHOD_DECL;
- else
- fatal ("method definition not in class context");
- }
- methoddecl
- {
- forget_protocol_qualifiers ();
- add_class_method (objc_implementation_context, $3);
- start_method_def ($3);
- objc_method_context = $3;
- }
- optarglist
- {
- continue_method_def ();
- }
- compstmt_or_error
- {
- finish_method_def ();
- objc_method_context = NULL_TREE;
- }
-
- | '-'
- {
- remember_protocol_qualifiers ();
- if (objc_implementation_context)
- objc_inherit_code = INSTANCE_METHOD_DECL;
- else
- fatal ("method definition not in class context");
- }
- methoddecl
- {
- forget_protocol_qualifiers ();
- add_instance_method (objc_implementation_context, $3);
- start_method_def ($3);
- objc_method_context = $3;
- }
- optarglist
- {
- continue_method_def ();
- }
- compstmt_or_error
- {
- finish_method_def ();
- objc_method_context = NULL_TREE;
- }
- ;
-
-/* the reason for the strange actions in this rule
- is so that notype_initdecls when reached via datadef
- can find a valid list of type and sc specs in $0. */
-
-methodprotolist:
- /* empty */
- | {$<ttype>$ = NULL_TREE; } methodprotolist2
- ;
-
-methodprotolist2: /* eliminates a shift/reduce conflict */
- methodproto
- | datadef
- | methodprotolist2 methodproto
- | methodprotolist2 {$<ttype>$ = NULL_TREE; } datadef
- ;
-
-semi_or_error:
- ';'
- | error
- ;
-
-methodproto:
- '+'
- {
- objc_inherit_code = CLASS_METHOD_DECL;
- }
- methoddecl
- {
- add_class_method (objc_interface_context, $3);
- }
- semi_or_error
-
- | '-'
- {
- objc_inherit_code = INSTANCE_METHOD_DECL;
- }
- methoddecl
- {
- add_instance_method (objc_interface_context, $3);
- }
- semi_or_error
- ;
-
-methoddecl:
- '(' typename ')' unaryselector
- {
- $$ = build_method_decl (objc_inherit_code, $2, $4, NULL_TREE);
- }
-
- | unaryselector
- {
- $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, NULL_TREE);
- }
-
- | '(' typename ')' keywordselector optparmlist
- {
- $$ = build_method_decl (objc_inherit_code, $2, $4, $5);
- }
-
- | keywordselector optparmlist
- {
- $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, $2);
- }
- ;
-
-/* "optarglist" assumes that start_method_def has already been called...
- if it is not, the "xdecls" will not be placed in the proper scope */
-
-optarglist:
- /* empty */
- | ';' myxdecls
- ;
-
-/* to get around the following situation: "int foo (int a) int b; {}" that
- is synthesized when parsing "- a:a b:b; id c; id d; { ... }" */
-
-myxdecls:
- /* empty */
- | mydecls
- ;
-
-mydecls:
- mydecl
- | errstmt
- | mydecls mydecl
- | mydecl errstmt
- ;
-
-mydecl:
- typed_declspecs setspecs myparms ';'
- { current_declspecs = TREE_VALUE (declspec_stack);
- prefix_attributes = TREE_PURPOSE (declspec_stack);
- declspec_stack = TREE_CHAIN (declspec_stack);
- resume_momentary ($2); }
- | typed_declspecs ';'
- { shadow_tag ($1); }
- | declmods ';'
- { pedwarn ("empty declaration"); }
- ;
-
-myparms:
- myparm
- { push_parm_decl ($1); }
- | myparms ',' myparm
- { push_parm_decl ($3); }
- ;
-
-/* A single parameter declaration or parameter type name,
- as found in a parmlist. DOES NOT ALLOW AN INITIALIZER OR ASMSPEC */
-
-myparm:
- parm_declarator maybe_attribute
- { $$ = build_tree_list (build_tree_list (current_declspecs,
- $1),
- build_tree_list (prefix_attributes,
- $2)); }
- | notype_declarator maybe_attribute
- { $$ = build_tree_list (build_tree_list (current_declspecs,
- $1),
- build_tree_list (prefix_attributes,
- $2)); }
- | absdcl maybe_attribute
- { $$ = build_tree_list (build_tree_list (current_declspecs,
- $1),
- build_tree_list (prefix_attributes,
- $2)); }
- ;
-
-optparmlist:
- /* empty */
- {
- $$ = NULL_TREE;
- }
- | ',' ELLIPSIS
- {
- /* oh what a kludge! */
- $$ = (tree)1;
- }
- | ','
- {
- pushlevel (0);
- }
- parmlist_2
- {
- /* returns a tree list node generated by get_parm_info */
- $$ = $3;
- poplevel (0, 0, 0);
- }
- ;
-
-unaryselector:
- selector
- ;
-
-keywordselector:
- keyworddecl
-
- | keywordselector keyworddecl
- {
- $$ = chainon ($1, $2);
- }
- ;
-
-selector:
- IDENTIFIER
- | TYPENAME
- | OBJECTNAME
- | reservedwords
- ;
-
-reservedwords:
- ENUM { $$ = get_identifier (token_buffer); }
- | STRUCT { $$ = get_identifier (token_buffer); }
- | UNION { $$ = get_identifier (token_buffer); }
- | IF { $$ = get_identifier (token_buffer); }
- | ELSE { $$ = get_identifier (token_buffer); }
- | WHILE { $$ = get_identifier (token_buffer); }
- | DO { $$ = get_identifier (token_buffer); }
- | FOR { $$ = get_identifier (token_buffer); }
- | SWITCH { $$ = get_identifier (token_buffer); }
- | CASE { $$ = get_identifier (token_buffer); }
- | DEFAULT { $$ = get_identifier (token_buffer); }
- | BREAK { $$ = get_identifier (token_buffer); }
- | CONTINUE { $$ = get_identifier (token_buffer); }
- | RETURN { $$ = get_identifier (token_buffer); }
- | GOTO { $$ = get_identifier (token_buffer); }
- | ASM_KEYWORD { $$ = get_identifier (token_buffer); }
- | SIZEOF { $$ = get_identifier (token_buffer); }
- | TYPEOF { $$ = get_identifier (token_buffer); }
- | ALIGNOF { $$ = get_identifier (token_buffer); }
- | TYPESPEC | TYPE_QUAL
- ;
-
-keyworddecl:
- selector ':' '(' typename ')' identifier
- {
- $$ = build_keyword_decl ($1, $4, $6);
- }
-
- | selector ':' identifier
- {
- $$ = build_keyword_decl ($1, NULL_TREE, $3);
- }
-
- | ':' '(' typename ')' identifier
- {
- $$ = build_keyword_decl (NULL_TREE, $3, $5);
- }
-
- | ':' identifier
- {
- $$ = build_keyword_decl (NULL_TREE, NULL_TREE, $2);
- }
- ;
-
-messageargs:
- selector
- | keywordarglist
- ;
-
-keywordarglist:
- keywordarg
- | keywordarglist keywordarg
- {
- $$ = chainon ($1, $2);
- }
- ;
-
-
-keywordexpr:
- nonnull_exprlist
- {
- if (TREE_CHAIN ($1) == NULL_TREE)
- /* just return the expr., remove a level of indirection */
- $$ = TREE_VALUE ($1);
- else
- /* we have a comma expr., we will collapse later */
- $$ = $1;
- }
- ;
-
-keywordarg:
- selector ':' keywordexpr
- {
- $$ = build_tree_list ($1, $3);
- }
- | ':' keywordexpr
- {
- $$ = build_tree_list (NULL_TREE, $2);
- }
- ;
-
-receiver:
- expr
- | CLASSNAME
- {
- $$ = get_class_reference ($1);
- }
- ;
-
-objcmessageexpr:
- '['
- { objc_receiver_context = 1; }
- receiver
- { objc_receiver_context = 0; }
- messageargs ']'
- {
- $$ = build_tree_list ($3, $5);
- }
- ;
-
-selectorarg:
- selector
- | keywordnamelist
- ;
-
-keywordnamelist:
- keywordname
- | keywordnamelist keywordname
- {
- $$ = chainon ($1, $2);
- }
- ;
-
-keywordname:
- selector ':'
- {
- $$ = build_tree_list ($1, NULL_TREE);
- }
- | ':'
- {
- $$ = build_tree_list (NULL_TREE, NULL_TREE);
- }
- ;
-
-objcselectorexpr:
- SELECTOR '(' selectorarg ')'
- {
- $$ = $3;
- }
- ;
-
-objcprotocolexpr:
- PROTOCOL '(' identifier ')'
- {
- $$ = $3;
- }
- ;
-
-/* extension to support C-structures in the archiver */
-
-objcencodeexpr:
- ENCODE '(' typename ')'
- {
- $$ = groktypename ($3);
- }
- ;
-
-end ifobjc
-%%
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
deleted file mode 100644
index 886c67b9828..00000000000
--- a/gcc/c-pragma.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack.
- Copyright (C) 1992 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. */
-
-#include <stdio.h>
-#include "config.h"
-#include "tree.h"
-#include "except.h"
-#include "function.h"
-#include "defaults.h"
-#include "c-pragma.h"
-
-#ifdef HANDLE_SYSV_PRAGMA
-
-/* When structure field packing is in effect, this variable is the
- number of bits to use as the maximum alignment. When packing is not
- in effect, this is zero. */
-
-extern int maximum_field_alignment;
-
-/* File used for outputting assembler code. */
-extern FILE *asm_out_file;
-
-/* Handle one token of a pragma directive. TOKEN is the
- current token, and STRING is its printable form. */
-
-void
-handle_pragma_token (string, token)
- char *string;
- tree token;
-{
- static enum pragma_state state = ps_start, type;
- static char *name;
- static char *value;
- static int align;
-
- if (string == 0)
- {
- if (type == ps_pack)
- {
- if (state == ps_right)
- maximum_field_alignment = align * 8;
- else
- warning ("malformed `#pragma pack'");
- }
- else if (type == ps_weak)
- {
-#ifdef HANDLE_PRAGMA_WEAK
- if (HANDLE_PRAGMA_WEAK)
- handle_pragma_weak (state, name, value);
-
-#endif /* HANDLE_PRAMA_WEAK */
- }
-
- type = state = ps_start;
- return;
- }
-
- switch (state)
- {
- case ps_start:
- if (token && TREE_CODE (token) == IDENTIFIER_NODE)
- {
- if (strcmp (IDENTIFIER_POINTER (token), "pack") == 0)
- type = state = ps_pack;
- else if (strcmp (IDENTIFIER_POINTER (token), "weak") == 0)
- type = state = ps_weak;
- else
- type = state = ps_done;
- }
- else
- type = state = ps_done;
- break;
-
- case ps_weak:
- if (token && TREE_CODE (token) == IDENTIFIER_NODE)
- {
- name = IDENTIFIER_POINTER (token);
- state = ps_name;
- }
- else
- state = ps_bad;
- break;
-
- case ps_name:
- state = (strcmp (string, "=") ? ps_bad : ps_equals);
- break;
-
- case ps_equals:
- if (token && TREE_CODE (token) == IDENTIFIER_NODE)
- {
- value = IDENTIFIER_POINTER (token);
- state = ps_value;
- }
- else
- state = ps_bad;
- break;
-
- case ps_value:
- state = ps_bad;
- break;
-
- case ps_pack:
- if (strcmp (string, "(") == 0)
- state = ps_left;
- else
- state = ps_bad;
- break;
-
- case ps_left:
- if (token && TREE_CODE (token) == INTEGER_CST
- && TREE_INT_CST_HIGH (token) == 0)
- switch (TREE_INT_CST_LOW (token))
- {
- case 1:
- case 2:
- case 4:
- align = TREE_INT_CST_LOW (token);
- state = ps_align;
- break;
-
- default:
- state = ps_bad;
- }
- else if (! token && strcmp (string, ")") == 0)
- {
- align = 0;
- state = ps_right;
- }
- else
- state = ps_bad;
- break;
-
- case ps_align:
- if (strcmp (string, ")") == 0)
- state = ps_right;
- else
- state = ps_bad;
- break;
-
- case ps_right:
- state = ps_bad;
- break;
-
- case ps_bad:
- case ps_done:
- break;
-
- default:
- abort ();
- }
-}
-#endif /* HANDLE_SYSV_PRAGMA */
diff --git a/gcc/c-pragma.h b/gcc/c-pragma.h
deleted file mode 100644
index 49c39fa591e..00000000000
--- a/gcc/c-pragma.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Pragma related interfaces.
- Copyright (C) 1995 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. */
-
-/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_DEF are
- defined. */
-#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF)
-#define HANDLE_PRAGMA_WEAK SUPPORTS_WEAK
-#endif
-
-enum pragma_state
-{
- ps_start,
- ps_done,
- ps_bad,
- ps_weak,
- ps_name,
- ps_equals,
- ps_value,
- ps_pack,
- ps_left,
- ps_align,
- ps_right
-};
-
-/* Output asm to handle ``#pragma weak'' */
-extern void handle_pragma_weak PROTO((enum pragma_state, char *, char *));
-
-/* Handle a C style pragma */
-extern void handle_pragma_token PROTO((char *, tree));
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
deleted file mode 100644
index cbbf691db86..00000000000
--- a/gcc/c-tree.h
+++ /dev/null
@@ -1,510 +0,0 @@
-/* Definitions for C parsing and type checking.
- Copyright (C) 1987, 1993, 1994, 1995, 1997 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. */
-
-#ifndef _C_TREE_H
-#define _C_TREE_H
-
-/* Language-dependent contents of an identifier. */
-
-/* The limbo_value is used for block level extern declarations, which need
- to be type checked against subsequent extern declarations. They can't
- be referenced after they fall out of scope, so they can't be global. */
-
-struct lang_identifier
-{
- struct tree_identifier ignore;
- tree global_value, local_value, label_value, implicit_decl;
- tree error_locus, limbo_value;
-};
-
-/* Macros for access to language-specific slots in an identifier. */
-/* Each of these slots contains a DECL node or null. */
-
-/* This represents the value which the identifier has in the
- file-scope namespace. */
-#define IDENTIFIER_GLOBAL_VALUE(NODE) \
- (((struct lang_identifier *) (NODE))->global_value)
-/* This represents the value which the identifier has in the current
- scope. */
-#define IDENTIFIER_LOCAL_VALUE(NODE) \
- (((struct lang_identifier *) (NODE))->local_value)
-/* This represents the value which the identifier has as a label in
- the current label scope. */
-#define IDENTIFIER_LABEL_VALUE(NODE) \
- (((struct lang_identifier *) (NODE))->label_value)
-/* This records the extern decl of this identifier, if it has had one
- at any point in this compilation. */
-#define IDENTIFIER_LIMBO_VALUE(NODE) \
- (((struct lang_identifier *) (NODE))->limbo_value)
-/* This records the implicit function decl of this identifier, if it
- has had one at any point in this compilation. */
-#define IDENTIFIER_IMPLICIT_DECL(NODE) \
- (((struct lang_identifier *) (NODE))->implicit_decl)
-/* This is the last function in which we printed an "undefined variable"
- message for this identifier. Value is a FUNCTION_DECL or null. */
-#define IDENTIFIER_ERROR_LOCUS(NODE) \
- (((struct lang_identifier *) (NODE))->error_locus)
-
-/* In identifiers, C uses the following fields in a special way:
- TREE_PUBLIC to record that there was a previous local extern decl.
- TREE_USED to record that such a decl was used.
- TREE_ADDRESSABLE to record that the address of such a decl was used. */
-
-/* Nonzero means reject anything that ANSI standard C forbids. */
-extern int pedantic;
-
-/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
-#define C_TYPE_FIELDS_READONLY(type) TREE_LANG_FLAG_1 (type)
-
-/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile. */
-#define C_TYPE_FIELDS_VOLATILE(type) TREE_LANG_FLAG_2 (type)
-
-/* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
- nonzero if the definition of the type has already started. */
-#define C_TYPE_BEING_DEFINED(type) TYPE_LANG_FLAG_0 (type)
-
-/* In a RECORD_TYPE, a sorted array of the fields of the type. */
-struct lang_type
-{
- int len;
- tree elts[1];
-};
-
-/* Mark which labels are explicitly declared.
- These may be shadowed, and may be referenced from nested functions. */
-#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
-
-/* Record whether a type or decl was written with nonconstant size.
- Note that TYPE_SIZE may have simplified to a constant. */
-#define C_TYPE_VARIABLE_SIZE(type) TYPE_LANG_FLAG_1 (type)
-#define C_DECL_VARIABLE_SIZE(type) DECL_LANG_FLAG_0 (type)
-
-/* Record in each node resulting from a binary operator
- what operator was specified for it. */
-#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
-
-#if 0 /* Not used. */
-/* Record whether a decl for a function or function pointer has
- already been mentioned (in a warning) because it was called
- but didn't have a prototype. */
-#define C_MISSING_PROTOTYPE_WARNED(decl) DECL_LANG_FLAG_2(decl)
-#endif
-
-/* Store a value in that field. */
-#define C_SET_EXP_ORIGINAL_CODE(exp, code) \
- (TREE_COMPLEXITY (exp) = (int) (code))
-
-/* Record whether a typedef for type `int' was actually `signed int'. */
-#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
-
-/* Nonzero for a declaration of a built in function if there has been no
- occasion that would declare the function in ordinary C.
- Using the function draws a pedantic warning in this case. */
-#define C_DECL_ANTICIPATED(exp) DECL_LANG_FLAG_3 ((exp))
-
-/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
- TYPE_ARG_TYPES for functions with prototypes, but created for functions
- without prototypes. */
-#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_NONCOPIED_PARTS (NODE)
-
-/* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */
-#define DECL_C_BIT_FIELD(NODE) DECL_LANG_FLAG_4 (NODE)
-
-/* Nonzero if the type T promotes to itself.
- ANSI C states explicitly the list of types that promote;
- in particular, short promotes to int even if they have the same width. */
-#define C_PROMOTING_INTEGER_TYPE_P(t) \
- (TREE_CODE ((t)) == INTEGER_TYPE \
- && (TYPE_MAIN_VARIANT (t) == char_type_node \
- || TYPE_MAIN_VARIANT (t) == signed_char_type_node \
- || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \
- || TYPE_MAIN_VARIANT (t) == short_integer_type_node \
- || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
-
-/* In a VAR_DECL, means the variable is really an iterator. */
-#define ITERATOR_P(D) (DECL_LANG_FLAG_4(D))
-
-/* In a VAR_DECL for an iterator, means we are within
- an explicit loop over that iterator. */
-#define ITERATOR_BOUND_P(NODE) ((NODE)->common.readonly_flag)
-
-/* in c-lang.c and objc-act.c */
-extern tree lookup_interface PROTO((tree));
-extern tree is_class_name PROTO((tree));
-extern void maybe_objc_check_decl PROTO((tree));
-extern int maybe_objc_comptypes PROTO((tree, tree, int));
-extern tree maybe_building_objc_message_expr PROTO((void));
-extern tree maybe_objc_method_name PROTO((tree));
-extern int recognize_objc_keyword PROTO((void));
-extern tree build_objc_string PROTO((int, char *));
-
-/* in c-aux-info.c */
-extern void gen_aux_info_record PROTO((tree, int, int, int));
-
-/* in c-common.c */
-extern void declare_function_name PROTO((void));
-extern void decl_attributes PROTO((tree, tree, tree));
-extern void init_function_format_info PROTO((void));
-extern void record_function_format PROTO((tree, tree, int, int, int));
-extern void check_function_format PROTO((tree, tree, tree));
-/* Print an error message for invalid operands to arith operation CODE.
- NOP_EXPR is used as a special case (see truthvalue_conversion). */
-extern void binary_op_error PROTO((enum tree_code));
-extern void c_expand_expr_stmt PROTO((tree));
-/* Validate the expression after `case' and apply default promotions. */
-extern tree check_case_value PROTO((tree));
-/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
-extern tree combine_strings PROTO((tree));
-extern void constant_expression_warning PROTO((tree));
-extern tree convert_and_check PROTO((tree, tree));
-extern void overflow_warning PROTO((tree));
-extern void unsigned_conversion_warning PROTO((tree, tree));
-/* Read the rest of the current #-directive line. */
-extern char *get_directive_line STDIO_PROTO((FILE *));
-/* Subroutine of build_binary_op, used for comparison operations.
- See if the operands have both been converted from subword integer types
- and, if so, perhaps change them both back to their original type. */
-extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
-/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
- or validate its data type for an `if' or `while' statement or ?..: exp. */
-extern tree truthvalue_conversion PROTO((tree));
-extern tree type_for_mode PROTO((enum machine_mode, int));
-extern tree type_for_size PROTO((unsigned, int));
-
-/* in c-convert.c */
-extern tree convert PROTO((tree, tree));
-
-/* in c-decl.c */
-/* Standard named or nameless data types of the C compiler. */
-extern tree char_array_type_node;
-extern tree char_type_node;
-extern tree const_ptr_type_node;
-extern tree const_string_type_node;
-extern tree default_function_type;
-extern tree double_ftype_double;
-extern tree double_ftype_double_double;
-extern tree double_type_node;
-extern tree float_type_node;
-extern tree intDI_type_node;
-extern tree intHI_type_node;
-extern tree intQI_type_node;
-extern tree intSI_type_node;
-extern tree int_array_type_node;
-extern tree int_ftype_cptr_cptr_sizet;
-extern tree int_ftype_int;
-extern tree int_ftype_ptr_ptr_int;
-extern tree int_ftype_string_string;
-extern tree integer_type_node;
-extern tree long_double_type_node;
-extern tree long_ftype_long;
-extern tree long_integer_type_node;
-extern tree long_long_integer_type_node;
-extern tree long_long_unsigned_type_node;
-extern tree long_unsigned_type_node;
-extern tree complex_integer_type_node;
-extern tree complex_float_type_node;
-extern tree complex_double_type_node;
-extern tree complex_long_double_type_node;
-extern tree ptr_type_node;
-extern tree ptrdiff_type_node;
-extern tree short_integer_type_node;
-extern tree short_unsigned_type_node;
-extern tree signed_char_type_node;
-extern tree signed_wchar_type_node;
-extern tree string_ftype_ptr_ptr;
-extern tree string_type_node;
-extern tree unsigned_char_type_node;
-extern tree unsigned_intDI_type_node;
-extern tree unsigned_intHI_type_node;
-extern tree unsigned_intQI_type_node;
-extern tree unsigned_intSI_type_node;
-extern tree unsigned_type_node;
-extern tree unsigned_wchar_type_node;
-extern tree void_ftype_ptr_int_int;
-extern tree void_ftype_ptr_ptr_int;
-extern tree void_type_node;
-extern tree wchar_array_type_node;
-extern tree wchar_type_node;
-extern tree boolean_type_node;
-extern tree boolean_true_node;
-extern tree boolean_false_node;
-
-extern tree build_enumerator PROTO((tree, tree));
-/* Declare a predefined function. Return the declaration. */
-extern tree builtin_function PROTO((char *, tree, enum built_in_function function_, char *));
-/* Add qualifiers to a type, in the fashion for C. */
-extern tree c_build_type_variant PROTO((tree, int, int));
-extern int c_decode_option PROTO((char *));
-extern void c_mark_varargs PROTO((void));
-extern tree check_identifier PROTO((tree, tree));
-extern void clear_parm_order PROTO((void));
-extern tree combine_parm_decls PROTO((tree, tree, int));
-extern int complete_array_type PROTO((tree, tree, int));
-extern void declare_parm_level PROTO((int));
-extern tree define_label PROTO((char *, int, tree));
-extern void delete_block PROTO((tree));
-extern void finish_decl PROTO((tree, tree, tree));
-extern void finish_decl_top_level PROTO((tree, tree, tree));
-extern tree finish_enum PROTO((tree, tree, tree));
-extern void finish_function PROTO((int));
-extern tree finish_struct PROTO((tree, tree, tree));
-extern tree get_parm_info PROTO((int));
-extern tree getdecls PROTO((void));
-extern tree gettags PROTO((void));
-extern int global_bindings_p PROTO((void));
-extern tree grokfield PROTO((char *, int, tree, tree, tree));
-extern tree groktypename PROTO((tree));
-extern tree groktypename_in_parm_context PROTO((tree));
-extern tree implicitly_declare PROTO((tree));
-extern int in_parm_level_p PROTO((void));
-extern void init_decl_processing PROTO((void));
-extern void insert_block PROTO((tree));
-extern void keep_next_level PROTO((void));
-extern int kept_level_p PROTO((void));
-extern tree lookup_label PROTO((tree));
-extern tree lookup_name PROTO((tree));
-extern tree lookup_name_current_level PROTO((tree));
-extern tree lookup_name_current_level_global PROTO((tree));
-extern tree maybe_build_cleanup PROTO((tree));
-extern void parmlist_tags_warning PROTO((void));
-extern void pending_xref_error PROTO((void));
-extern void pop_c_function_context PROTO((void));
-extern void pop_label_level PROTO((void));
-extern tree poplevel PROTO((int, int, int));
-extern void print_lang_decl STDIO_PROTO((FILE *, tree,
- int));
-extern void print_lang_identifier STDIO_PROTO((FILE *, tree,
- int));
-extern void print_lang_type STDIO_PROTO((FILE *, tree,
- int));
-extern void push_c_function_context PROTO((void));
-extern void push_label_level PROTO((void));
-extern void push_parm_decl PROTO((tree));
-extern tree pushdecl PROTO((tree));
-extern tree pushdecl_top_level PROTO((tree));
-extern void pushlevel PROTO((int));
-extern void pushtag PROTO((tree, tree));
-extern void set_block PROTO((tree));
-extern tree shadow_label PROTO((tree));
-extern void shadow_record_fields PROTO((tree));
-extern void shadow_tag PROTO((tree));
-extern void shadow_tag_warned PROTO((tree, int));
-extern tree start_enum PROTO((tree));
-extern int start_function PROTO((tree, tree, tree,
- tree, int));
-extern tree start_decl PROTO((tree, tree, int,
- tree, tree));
-extern tree start_struct PROTO((enum tree_code, tree));
-extern void store_parm_decls PROTO((void));
-extern tree xref_tag PROTO((enum tree_code, tree));
-
-/* in c-typeck.c */
-extern tree require_complete_type PROTO((tree));
-extern void incomplete_type_error PROTO((tree, tree));
-/* Given two integer or real types, return the type for their sum.
- Given two compatible ANSI C types, returns the merged type. */
-extern tree common_type PROTO((tree, tree));
-extern int comptypes PROTO((tree, tree));
-extern int self_promoting_args_p PROTO((tree));
-extern tree c_sizeof PROTO((tree));
-extern tree c_sizeof_nowarn PROTO((tree));
-extern tree c_size_in_bytes PROTO((tree));
-extern tree c_alignof PROTO((tree));
-extern tree c_alignof_expr PROTO((tree));
-extern tree default_conversion PROTO((tree));
-extern tree build_component_ref PROTO((tree, tree));
-extern tree build_indirect_ref PROTO((tree, char *));
-extern tree build_array_ref PROTO((tree, tree));
-extern tree build_function_call PROTO((tree, tree));
-extern tree parser_build_binary_op PROTO((enum tree_code,
- tree, tree));
-extern tree build_binary_op PROTO((enum tree_code,
- tree, tree, int));
-extern tree build_unary_op PROTO((enum tree_code,
- tree, int));
-extern int lvalue_p PROTO((tree));
-extern int lvalue_or_else PROTO((tree, char *));
-extern void readonly_warning PROTO((tree, char *));
-extern int mark_addressable PROTO((tree));
-extern tree build_conditional_expr PROTO((tree, tree, tree));
-extern tree build_compound_expr PROTO((tree));
-extern tree build_c_cast PROTO((tree, tree));
-extern tree build_modify_expr PROTO((tree, enum tree_code,
- tree));
-extern tree initializer_constant_valid_p PROTO((tree, tree));
-extern void store_init_value PROTO((tree, tree));
-extern void error_init PROTO((char *, char *,
- char *));
-extern void pedwarn_init PROTO((char *, char *,
- char *));
-extern void start_init PROTO((tree, tree, int));
-extern void finish_init PROTO((void));
-extern void really_start_incremental_init PROTO((tree));
-extern void push_init_level PROTO((int));
-extern tree pop_init_level PROTO((int));
-extern void set_init_index PROTO((tree, tree));
-extern void set_init_label PROTO((tree));
-extern void process_init_element PROTO((tree));
-extern void c_expand_asm_operands PROTO((tree, tree, tree, tree,
- int, char *, int));
-extern void c_expand_return PROTO((tree));
-extern tree c_expand_start_case PROTO((tree));
-
-/* in c-iterate.c */
-extern void iterator_expand PROTO((tree));
-extern void iterator_for_loop_start PROTO((tree));
-extern void iterator_for_loop_end PROTO((tree));
-extern void iterator_for_loop_record PROTO((tree));
-extern void push_iterator_stack PROTO((void));
-extern void pop_iterator_stack PROTO((void));
-
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement that specifies a return value is seen. */
-
-extern int current_function_returns_value;
-
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement with no argument is seen. */
-
-extern int current_function_returns_null;
-
-/* Nonzero means the expression being parsed will never be evaluated.
- This is a count, since unevaluated expressions can nest. */
-
-extern int skip_evaluation;
-
-/* Nonzero means `$' can be in an identifier. */
-
-extern int dollars_in_ident;
-
-/* Nonzero means allow type mismatches in conditional expressions;
- just make their values `void'. */
-
-extern int flag_cond_mismatch;
-
-/* Nonzero means don't recognize the keyword `asm'. */
-
-extern int flag_no_asm;
-
-/* Nonzero means environment is hosted (i.e., not freestanding) */
-
-extern int flag_hosted;
-
-/* Nonzero means ignore `#ident' directives. */
-
-extern int flag_no_ident;
-
-/* Nonzero means warn about implicit declarations. */
-
-extern int warn_implicit;
-
-/* Nonzero means give string constants the type `const char *'
- to get extra warnings from them. These warnings will be too numerous
- to be useful, except in thoroughly ANSIfied programs. */
-
-extern int warn_write_strings;
-
-/* Nonzero means warn about sizeof (function) or addition/subtraction
- of function pointers. */
-
-extern int warn_pointer_arith;
-
-/* Nonzero means warn for all old-style non-prototype function decls. */
-
-extern int warn_strict_prototypes;
-
-/* Nonzero means warn about multiple (redundant) decls for the same single
- variable or function. */
-
-extern int warn_redundant_decls;
-
-/* Nonzero means warn about extern declarations of objects not at
- file-scope level and about *all* declarations of functions (whether
- extern or static) not at file-scope level. Note that we exclude
- implicit function declarations. To get warnings about those, use
- -Wimplicit. */
-
-extern int warn_nested_externs;
-
-/* Nonzero means warn about pointer casts that can drop a type qualifier
- from the pointer target type. */
-
-extern int warn_cast_qual;
-
-/* Nonzero means warn when casting a function call to a type that does
- not match the return type (e.g. (float)sqrt() or (anything*)malloc()
- when there is no previous declaration of sqrt or malloc. */
-
-extern int warn_bad_function_cast;
-
-/* Warn about traditional constructs whose meanings changed in ANSI C. */
-
-extern int warn_traditional;
-
-/* Warn about *printf or *scanf format/argument anomalies. */
-
-extern int warn_format;
-
-/* Warn about a subscript that has type char. */
-
-extern int warn_char_subscripts;
-
-/* Warn if a type conversion is done that might have confusing results. */
-
-extern int warn_conversion;
-
-/* Warn if main is suspicious. */
-
-extern int warn_main;
-
-/* Nonzero means do some things the same way PCC does. */
-
-extern int flag_traditional;
-
-/* Nonzero means to allow single precision math even if we're generally
- being traditional. */
-extern int flag_allow_single_precision;
-
-/* Nonzero means warn about suggesting putting in ()'s. */
-
-extern int warn_parentheses;
-
-/* Warn if initializer is not completely bracketed. */
-
-extern int warn_missing_braces;
-
-/* Warn about comparison of signed and unsigned values. */
-
-extern int warn_sign_compare;
-
-/* Nonzero means this is a function to call to perform comptypes
- on two record types. */
-
-extern int (*comptypes_record_hook) ();
-
-/* Nonzero means we are reading code that came from a system header file. */
-
-extern int system_header_p;
-
-/* Nonzero enables objc features. */
-
-extern int doing_objc_thang;
-
-#endif /* not _C_TREE_H */
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
deleted file mode 100644
index 32d5c27a0cf..00000000000
--- a/gcc/c-typeck.c
+++ /dev/null
@@ -1,6658 +0,0 @@
-/* Build expressions with type checking for C compiler.
- Copyright (C) 1987, 88, 91, 92-6, 1997 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 is part of the C front end.
- It contains routines to build C expressions given their operands,
- including computing the types of the result, C-specific error checks,
- and some optimization.
-
- There are also routines to build RETURN_STMT nodes and CASE_STMT nodes,
- and to process initializations in declarations (since they work
- like a strange sort of assignment). */
-
-#include "config.h"
-#include <stdio.h>
-#include "tree.h"
-#include "c-tree.h"
-#include "flags.h"
-#include "output.h"
-
-/* Nonzero if we've already printed a "missing braces around initializer"
- message within this initializer. */
-static int missing_braces_mentioned;
-
-extern char *index ();
-extern char *rindex ();
-
-static tree qualify_type PROTO((tree, tree));
-static int comp_target_types PROTO((tree, tree));
-static int function_types_compatible_p PROTO((tree, tree));
-static int type_lists_compatible_p PROTO((tree, tree));
-static int self_promoting_type_p PROTO((tree));
-static tree decl_constant_value PROTO((tree));
-static tree lookup_field PROTO((tree, tree, tree *));
-static tree convert_arguments PROTO((tree, tree, tree, tree));
-static tree pointer_int_sum PROTO((enum tree_code, tree, tree));
-static tree pointer_diff PROTO((tree, tree));
-static tree unary_complex_lvalue PROTO((enum tree_code, tree));
-static void pedantic_lvalue_warning PROTO((enum tree_code));
-static tree internal_build_compound_expr PROTO((tree, int));
-static tree convert_for_assignment PROTO((tree, tree, char *, tree,
- tree, int));
-static void warn_for_assignment PROTO((char *, char *, tree, int));
-static tree valid_compound_expr_initializer PROTO((tree, tree));
-static void push_string PROTO((char *));
-static void push_member_name PROTO((tree));
-static void push_array_bounds PROTO((int));
-static int spelling_length PROTO((void));
-static char *print_spelling PROTO((char *));
-static char *get_spelling PROTO((char *));
-static void warning_init PROTO((char *, char *,
- char *));
-static tree digest_init PROTO((tree, tree, int, int));
-static void check_init_type_bitfields PROTO((tree));
-static void output_init_element PROTO((tree, tree, tree, int));
-static void output_pending_init_elements PROTO((int));
-
-/* Do `exp = require_complete_type (exp);' to make sure exp
- does not have an incomplete type. (That includes void types.) */
-
-tree
-require_complete_type (value)
- tree value;
-{
- tree type = TREE_TYPE (value);
-
- /* First, detect a valid value with a complete type. */
- if (TYPE_SIZE (type) != 0
- && type != void_type_node)
- return value;
-
- incomplete_type_error (value, type);
- return error_mark_node;
-}
-
-/* Print an error message for invalid use of an incomplete type.
- VALUE is the expression that was used (or 0 if that isn't known)
- and TYPE is the type that was invalid. */
-
-void
-incomplete_type_error (value, type)
- tree value;
- tree type;
-{
- char *errmsg;
-
- /* Avoid duplicate error message. */
- if (TREE_CODE (type) == ERROR_MARK)
- return;
-
- if (value != 0 && (TREE_CODE (value) == VAR_DECL
- || TREE_CODE (value) == PARM_DECL))
- error ("`%s' has an incomplete type",
- IDENTIFIER_POINTER (DECL_NAME (value)));
- else
- {
- retry:
- /* We must print an error message. Be clever about what it says. */
-
- switch (TREE_CODE (type))
- {
- case RECORD_TYPE:
- errmsg = "invalid use of undefined type `struct %s'";
- break;
-
- case UNION_TYPE:
- errmsg = "invalid use of undefined type `union %s'";
- break;
-
- case ENUMERAL_TYPE:
- errmsg = "invalid use of undefined type `enum %s'";
- break;
-
- case VOID_TYPE:
- error ("invalid use of void expression");
- return;
-
- case ARRAY_TYPE:
- if (TYPE_DOMAIN (type))
- {
- type = TREE_TYPE (type);
- goto retry;
- }
- error ("invalid use of array with unspecified bounds");
- return;
-
- default:
- abort ();
- }
-
- if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- error (errmsg, IDENTIFIER_POINTER (TYPE_NAME (type)));
- else
- /* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */
- error ("invalid use of incomplete typedef `%s'",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
- }
-}
-
-/* Return a variant of TYPE which has all the type qualifiers of LIKE
- as well as those of TYPE. */
-
-static tree
-qualify_type (type, like)
- tree type, like;
-{
- int constflag = TYPE_READONLY (type) || TYPE_READONLY (like);
- int volflag = TYPE_VOLATILE (type) || TYPE_VOLATILE (like);
- return c_build_type_variant (type, constflag, volflag);
-}
-
-/* Return the common type of two types.
- We assume that comptypes has already been done and returned 1;
- if that isn't so, this may crash. In particular, we assume that qualifiers
- match.
-
- This is the type for the result of most arithmetic operations
- if the operands have the given two types. */
-
-tree
-common_type (t1, t2)
- tree t1, t2;
-{
- register enum tree_code code1;
- register enum tree_code code2;
- tree attributes;
-
- /* Save time if the two types are the same. */
-
- if (t1 == t2) return t1;
-
- /* If one type is nonsense, use the other. */
- if (t1 == error_mark_node)
- return t2;
- if (t2 == error_mark_node)
- return t1;
-
- /* Merge the attributes */
- attributes = merge_attributes (TYPE_ATTRIBUTES (t1), TYPE_ATTRIBUTES (t2));
-
- /* Treat an enum type as the unsigned integer type of the same width. */
-
- if (TREE_CODE (t1) == ENUMERAL_TYPE)
- t1 = type_for_size (TYPE_PRECISION (t1), 1);
- if (TREE_CODE (t2) == ENUMERAL_TYPE)
- t2 = type_for_size (TYPE_PRECISION (t2), 1);
-
- code1 = TREE_CODE (t1);
- code2 = TREE_CODE (t2);
-
- /* If one type is complex, form the common type of the non-complex
- components, then make that complex. Use T1 or T2 if it is the
- required type. */
- if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE)
- {
- tree subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1) : t1;
- tree subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2) : t2;
- tree subtype = common_type (subtype1, subtype2);
-
- if (code1 == COMPLEX_TYPE && TREE_TYPE (t1) == subtype)
- return build_type_attribute_variant (t1, attributes);
- else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2) == subtype)
- return build_type_attribute_variant (t2, attributes);
- else
- return build_type_attribute_variant (build_complex_type (subtype),
- attributes);
- }
-
- switch (code1)
- {
- case INTEGER_TYPE:
- case REAL_TYPE:
- /* If only one is real, use it as the result. */
-
- if (code1 == REAL_TYPE && code2 != REAL_TYPE)
- return build_type_attribute_variant (t1, attributes);
-
- if (code2 == REAL_TYPE && code1 != REAL_TYPE)
- return build_type_attribute_variant (t2, attributes);
-
- /* Both real or both integers; use the one with greater precision. */
-
- if (TYPE_PRECISION (t1) > TYPE_PRECISION (t2))
- return build_type_attribute_variant (t1, attributes);
- else if (TYPE_PRECISION (t2) > TYPE_PRECISION (t1))
- return build_type_attribute_variant (t2, attributes);
-
- /* Same precision. Prefer longs to ints even when same size. */
-
- if (TYPE_MAIN_VARIANT (t1) == long_unsigned_type_node
- || TYPE_MAIN_VARIANT (t2) == long_unsigned_type_node)
- return build_type_attribute_variant (long_unsigned_type_node,
- attributes);
-
- if (TYPE_MAIN_VARIANT (t1) == long_integer_type_node
- || TYPE_MAIN_VARIANT (t2) == long_integer_type_node)
- {
- /* But preserve unsignedness from the other type,
- since long cannot hold all the values of an unsigned int. */
- if (TREE_UNSIGNED (t1) || TREE_UNSIGNED (t2))
- t1 = long_unsigned_type_node;
- else
- t1 = long_integer_type_node;
- return build_type_attribute_variant (t1, attributes);
- }
-
- /* Otherwise prefer the unsigned one. */
-
- if (TREE_UNSIGNED (t1))
- return build_type_attribute_variant (t1, attributes);
- else
- return build_type_attribute_variant (t2, attributes);
-
- case POINTER_TYPE:
- /* For two pointers, do this recursively on the target type,
- and combine the qualifiers of the two types' targets. */
- /* This code was turned off; I don't know why.
- But ANSI C specifies doing this with the qualifiers.
- So I turned it on again. */
- {
- tree target = common_type (TYPE_MAIN_VARIANT (TREE_TYPE (t1)),
- TYPE_MAIN_VARIANT (TREE_TYPE (t2)));
- int constp
- = TYPE_READONLY (TREE_TYPE (t1)) || TYPE_READONLY (TREE_TYPE (t2));
- int volatilep
- = TYPE_VOLATILE (TREE_TYPE (t1)) || TYPE_VOLATILE (TREE_TYPE (t2));
- t1 = build_pointer_type (c_build_type_variant (target, constp,
- volatilep));
- return build_type_attribute_variant (t1, attributes);
- }
-#if 0
- t1 = build_pointer_type (common_type (TREE_TYPE (t1), TREE_TYPE (t2)));
- return build_type_attribute_variant (t1, attributes);
-#endif
-
- case ARRAY_TYPE:
- {
- tree elt = common_type (TREE_TYPE (t1), TREE_TYPE (t2));
- /* Save space: see if the result is identical to one of the args. */
- if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1))
- return build_type_attribute_variant (t1, attributes);
- if (elt == TREE_TYPE (t2) && TYPE_DOMAIN (t2))
- return build_type_attribute_variant (t2, attributes);
- /* Merge the element types, and have a size if either arg has one. */
- t1 = build_array_type (elt, TYPE_DOMAIN (TYPE_DOMAIN (t1) ? t1 : t2));
- return build_type_attribute_variant (t1, attributes);
- }
-
- case FUNCTION_TYPE:
- /* Function types: prefer the one that specified arg types.
- If both do, merge the arg types. Also merge the return types. */
- {
- tree valtype = common_type (TREE_TYPE (t1), TREE_TYPE (t2));
- tree p1 = TYPE_ARG_TYPES (t1);
- tree p2 = TYPE_ARG_TYPES (t2);
- int len;
- tree newargs, n;
- int i;
-
- /* Save space: see if the result is identical to one of the args. */
- if (valtype == TREE_TYPE (t1) && ! TYPE_ARG_TYPES (t2))
- return build_type_attribute_variant (t1, attributes);
- if (valtype == TREE_TYPE (t2) && ! TYPE_ARG_TYPES (t1))
- return build_type_attribute_variant (t2, attributes);
-
- /* Simple way if one arg fails to specify argument types. */
- if (TYPE_ARG_TYPES (t1) == 0)
- {
- t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2));
- return build_type_attribute_variant (t1, attributes);
- }
- if (TYPE_ARG_TYPES (t2) == 0)
- {
- t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1));
- return build_type_attribute_variant (t1, attributes);
- }
-
- /* If both args specify argument types, we must merge the two
- lists, argument by argument. */
-
- len = list_length (p1);
- newargs = 0;
-
- for (i = 0; i < len; i++)
- newargs = tree_cons (NULL_TREE, NULL_TREE, newargs);
-
- n = newargs;
-
- for (; p1;
- p1 = TREE_CHAIN (p1), p2 = TREE_CHAIN (p2), n = TREE_CHAIN (n))
- {
- /* A null type means arg type is not specified.
- Take whatever the other function type has. */
- if (TREE_VALUE (p1) == 0)
- {
- TREE_VALUE (n) = TREE_VALUE (p2);
- goto parm_done;
- }
- if (TREE_VALUE (p2) == 0)
- {
- TREE_VALUE (n) = TREE_VALUE (p1);
- goto parm_done;
- }
-
- /* Given wait (union {union wait *u; int *i} *)
- and wait (union wait *),
- prefer union wait * as type of parm. */
- if (TREE_CODE (TREE_VALUE (p1)) == UNION_TYPE
- && TREE_VALUE (p1) != TREE_VALUE (p2))
- {
- tree memb;
- for (memb = TYPE_FIELDS (TREE_VALUE (p1));
- memb; memb = TREE_CHAIN (memb))
- if (comptypes (TREE_TYPE (memb), TREE_VALUE (p2)))
- {
- TREE_VALUE (n) = TREE_VALUE (p2);
- if (pedantic)
- pedwarn ("function types not truly compatible in ANSI C");
- goto parm_done;
- }
- }
- if (TREE_CODE (TREE_VALUE (p2)) == UNION_TYPE
- && TREE_VALUE (p2) != TREE_VALUE (p1))
- {
- tree memb;
- for (memb = TYPE_FIELDS (TREE_VALUE (p2));
- memb; memb = TREE_CHAIN (memb))
- if (comptypes (TREE_TYPE (memb), TREE_VALUE (p1)))
- {
- TREE_VALUE (n) = TREE_VALUE (p1);
- if (pedantic)
- pedwarn ("function types not truly compatible in ANSI C");
- goto parm_done;
- }
- }
- TREE_VALUE (n) = common_type (TREE_VALUE (p1), TREE_VALUE (p2));
- parm_done: ;
- }
-
- t1 = build_function_type (valtype, newargs);
- /* ... falls through ... */
- }
-
- default:
- return build_type_attribute_variant (t1, attributes);
- }
-
-}
-
-/* Return 1 if TYPE1 and TYPE2 are compatible types for assignment
- or various other operations. Return 2 if they are compatible
- but a warning may be needed if you use them together. */
-
-int
-comptypes (type1, type2)
- tree type1, type2;
-{
- register tree t1 = type1;
- register tree t2 = type2;
- int attrval, val;
-
- /* Suppress errors caused by previously reported errors. */
-
- if (t1 == t2 || TREE_CODE (t1) == ERROR_MARK || TREE_CODE (t2) == ERROR_MARK)
- return 1;
-
- /* Treat an enum type as the integer type of the same width and
- signedness. */
-
- if (TREE_CODE (t1) == ENUMERAL_TYPE)
- t1 = type_for_size (TYPE_PRECISION (t1), TREE_UNSIGNED (t1));
- if (TREE_CODE (t2) == ENUMERAL_TYPE)
- t2 = type_for_size (TYPE_PRECISION (t2), TREE_UNSIGNED (t2));
-
- if (t1 == t2)
- return 1;
-
- /* Different classes of types can't be compatible. */
-
- if (TREE_CODE (t1) != TREE_CODE (t2)) return 0;
-
- /* Qualifiers must match. */
-
- if (TYPE_READONLY (t1) != TYPE_READONLY (t2))
- return 0;
- if (TYPE_VOLATILE (t1) != TYPE_VOLATILE (t2))
- return 0;
-
- /* Allow for two different type nodes which have essentially the same
- definition. Note that we already checked for equality of the type
- type qualifiers (just above). */
-
- if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
- return 1;
-
-#ifndef COMP_TYPE_ATTRIBUTES
-#define COMP_TYPE_ATTRIBUTES(t1,t2) 1
-#endif
-
- /* 1 if no need for warning yet, 2 if warning cause has been seen. */
- if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2)))
- return 0;
-
- /* 1 if no need for warning yet, 2 if warning cause has been seen. */
- val = 0;
-
- switch (TREE_CODE (t1))
- {
- case POINTER_TYPE:
- val = (TREE_TYPE (t1) == TREE_TYPE (t2)
- ? 1 : comptypes (TREE_TYPE (t1), TREE_TYPE (t2)));
- break;
-
- case FUNCTION_TYPE:
- val = function_types_compatible_p (t1, t2);
- break;
-
- case ARRAY_TYPE:
- {
- tree d1 = TYPE_DOMAIN (t1);
- tree d2 = TYPE_DOMAIN (t2);
- val = 1;
-
- /* Target types must match incl. qualifiers. */
- if (TREE_TYPE (t1) != TREE_TYPE (t2)
- && 0 == (val = comptypes (TREE_TYPE (t1), TREE_TYPE (t2))))
- return 0;
-
- /* Sizes must match unless one is missing or variable. */
- if (d1 == 0 || d2 == 0 || d1 == d2
- || TREE_CODE (TYPE_MIN_VALUE (d1)) != INTEGER_CST
- || TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST
- || TREE_CODE (TYPE_MAX_VALUE (d1)) != INTEGER_CST
- || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST)
- break;
-
- if (! ((TREE_INT_CST_LOW (TYPE_MIN_VALUE (d1))
- == TREE_INT_CST_LOW (TYPE_MIN_VALUE (d2)))
- && (TREE_INT_CST_HIGH (TYPE_MIN_VALUE (d1))
- == TREE_INT_CST_HIGH (TYPE_MIN_VALUE (d2)))
- && (TREE_INT_CST_LOW (TYPE_MAX_VALUE (d1))
- == TREE_INT_CST_LOW (TYPE_MAX_VALUE (d2)))
- && (TREE_INT_CST_HIGH (TYPE_MAX_VALUE (d1))
- == TREE_INT_CST_HIGH (TYPE_MAX_VALUE (d2)))))
- val = 0;
- break;
- }
-
- case RECORD_TYPE:
- if (maybe_objc_comptypes (t1, t2, 0) == 1)
- val = 1;
- break;
- }
- return attrval == 2 && val == 1 ? 2 : val;
-}
-
-/* Return 1 if TTL and TTR are pointers to types that are equivalent,
- ignoring their qualifiers. */
-
-static int
-comp_target_types (ttl, ttr)
- tree ttl, ttr;
-{
- int val;
-
- /* Give maybe_objc_comptypes a crack at letting these types through. */
- if (val = maybe_objc_comptypes (ttl, ttr, 1) >= 0)
- return val;
-
- val = comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (ttl)),
- TYPE_MAIN_VARIANT (TREE_TYPE (ttr)));
-
- if (val == 2 && pedantic)
- pedwarn ("types are not quite compatible");
- return val;
-}
-
-/* Subroutines of `comptypes'. */
-
-/* Return 1 if two function types F1 and F2 are compatible.
- If either type specifies no argument types,
- the other must specify a fixed number of self-promoting arg types.
- Otherwise, if one type specifies only the number of arguments,
- the other must specify that number of self-promoting arg types.
- Otherwise, the argument types must match. */
-
-static int
-function_types_compatible_p (f1, f2)
- tree f1, f2;
-{
- tree args1, args2;
- /* 1 if no need for warning yet, 2 if warning cause has been seen. */
- int val = 1;
- int val1;
-
- if (!(TREE_TYPE (f1) == TREE_TYPE (f2)
- || (val = comptypes (TREE_TYPE (f1), TREE_TYPE (f2)))))
- return 0;
-
- args1 = TYPE_ARG_TYPES (f1);
- args2 = TYPE_ARG_TYPES (f2);
-
- /* An unspecified parmlist matches any specified parmlist
- whose argument types don't need default promotions. */
-
- if (args1 == 0)
- {
- if (!self_promoting_args_p (args2))
- return 0;
- /* If one of these types comes from a non-prototype fn definition,
- compare that with the other type's arglist.
- If they don't match, ask for a warning (but no error). */
- if (TYPE_ACTUAL_ARG_TYPES (f1)
- && 1 != type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1)))
- val = 2;
- return val;
- }
- if (args2 == 0)
- {
- if (!self_promoting_args_p (args1))
- return 0;
- if (TYPE_ACTUAL_ARG_TYPES (f2)
- && 1 != type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2)))
- val = 2;
- return val;
- }
-
- /* Both types have argument lists: compare them and propagate results. */
- val1 = type_lists_compatible_p (args1, args2);
- return val1 != 1 ? val1 : val;
-}
-
-/* Check two lists of types for compatibility,
- returning 0 for incompatible, 1 for compatible,
- or 2 for compatible with warning. */
-
-static int
-type_lists_compatible_p (args1, args2)
- tree args1, args2;
-{
- /* 1 if no need for warning yet, 2 if warning cause has been seen. */
- int val = 1;
- int newval = 0;
-
- while (1)
- {
- if (args1 == 0 && args2 == 0)
- return val;
- /* If one list is shorter than the other,
- they fail to match. */
- if (args1 == 0 || args2 == 0)
- return 0;
- /* A null pointer instead of a type
- means there is supposed to be an argument
- but nothing is specified about what type it has.
- So match anything that self-promotes. */
- if (TREE_VALUE (args1) == 0)
- {
- if (! self_promoting_type_p (TREE_VALUE (args2)))
- return 0;
- }
- else if (TREE_VALUE (args2) == 0)
- {
- if (! self_promoting_type_p (TREE_VALUE (args1)))
- return 0;
- }
- else if (! (newval = comptypes (TREE_VALUE (args1), TREE_VALUE (args2))))
- {
- /* Allow wait (union {union wait *u; int *i} *)
- and wait (union wait *) to be compatible. */
- if (TREE_CODE (TREE_VALUE (args1)) == UNION_TYPE
- && (TYPE_NAME (TREE_VALUE (args1)) == 0
- || TYPE_TRANSPARENT_UNION (TREE_VALUE (args1)))
- && TREE_CODE (TYPE_SIZE (TREE_VALUE (args1))) == INTEGER_CST
- && tree_int_cst_equal (TYPE_SIZE (TREE_VALUE (args1)),
- TYPE_SIZE (TREE_VALUE (args2))))
- {
- tree memb;
- for (memb = TYPE_FIELDS (TREE_VALUE (args1));
- memb; memb = TREE_CHAIN (memb))
- if (comptypes (TREE_TYPE (memb), TREE_VALUE (args2)))
- break;
- if (memb == 0)
- return 0;
- }
- else if (TREE_CODE (TREE_VALUE (args2)) == UNION_TYPE
- && (TYPE_NAME (TREE_VALUE (args2)) == 0
- || TYPE_TRANSPARENT_UNION (TREE_VALUE (args2)))
- && TREE_CODE (TYPE_SIZE (TREE_VALUE (args2))) == INTEGER_CST
- && tree_int_cst_equal (TYPE_SIZE (TREE_VALUE (args2)),
- TYPE_SIZE (TREE_VALUE (args1))))
- {
- tree memb;
- for (memb = TYPE_FIELDS (TREE_VALUE (args2));
- memb; memb = TREE_CHAIN (memb))
- if (comptypes (TREE_TYPE (memb), TREE_VALUE (args1)))
- break;
- if (memb == 0)
- return 0;
- }
- else
- return 0;
- }
-
- /* comptypes said ok, but record if it said to warn. */
- if (newval > val)
- val = newval;
-
- args1 = TREE_CHAIN (args1);
- args2 = TREE_CHAIN (args2);
- }
-}
-
-/* Return 1 if PARMS specifies a fixed number of parameters
- and none of their types is affected by default promotions. */
-
-int
-self_promoting_args_p (parms)
- tree parms;
-{
- register tree t;
- for (t = parms; t; t = TREE_CHAIN (t))
- {
- register tree type = TREE_VALUE (t);
-
- if (TREE_CHAIN (t) == 0 && type != void_type_node)
- return 0;
-
- if (type == 0)
- return 0;
-
- if (TYPE_MAIN_VARIANT (type) == float_type_node)
- return 0;
-
- if (C_PROMOTING_INTEGER_TYPE_P (type))
- return 0;
- }
- return 1;
-}
-
-/* Return 1 if TYPE is not affected by default promotions. */
-
-static int
-self_promoting_type_p (type)
- tree type;
-{
- if (TYPE_MAIN_VARIANT (type) == float_type_node)
- return 0;
-
- if (C_PROMOTING_INTEGER_TYPE_P (type))
- return 0;
-
- return 1;
-}
-
-/* Return an unsigned type the same as TYPE in other respects. */
-
-tree
-unsigned_type (type)
- tree type;
-{
- tree type1 = TYPE_MAIN_VARIANT (type);
- if (type1 == signed_char_type_node || type1 == char_type_node)
- return unsigned_char_type_node;
- if (type1 == integer_type_node)
- return unsigned_type_node;
- if (type1 == short_integer_type_node)
- return short_unsigned_type_node;
- if (type1 == long_integer_type_node)
- return long_unsigned_type_node;
- if (type1 == long_long_integer_type_node)
- return long_long_unsigned_type_node;
- if (type1 == intDI_type_node)
- return unsigned_intDI_type_node;
- if (type1 == intSI_type_node)
- return unsigned_intSI_type_node;
- if (type1 == intHI_type_node)
- return unsigned_intHI_type_node;
- if (type1 == intQI_type_node)
- return unsigned_intQI_type_node;
-
- return signed_or_unsigned_type (1, type);
-}
-
-/* Return a signed type the same as TYPE in other respects. */
-
-tree
-signed_type (type)
- tree type;
-{
- tree type1 = TYPE_MAIN_VARIANT (type);
- if (type1 == unsigned_char_type_node || type1 == char_type_node)
- return signed_char_type_node;
- if (type1 == unsigned_type_node)
- return integer_type_node;
- if (type1 == short_unsigned_type_node)
- return short_integer_type_node;
- if (type1 == long_unsigned_type_node)
- return long_integer_type_node;
- if (type1 == long_long_unsigned_type_node)
- return long_long_integer_type_node;
- if (type1 == unsigned_intDI_type_node)
- return intDI_type_node;
- if (type1 == unsigned_intSI_type_node)
- return intSI_type_node;
- if (type1 == unsigned_intHI_type_node)
- return intHI_type_node;
- if (type1 == unsigned_intQI_type_node)
- return intQI_type_node;
-
- return signed_or_unsigned_type (0, type);
-}
-
-/* Return a type the same as TYPE except unsigned or
- signed according to UNSIGNEDP. */
-
-tree
-signed_or_unsigned_type (unsignedp, type)
- int unsignedp;
- tree type;
-{
- if (! INTEGRAL_TYPE_P (type)
- || TREE_UNSIGNED (type) == unsignedp)
- return type;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (signed_char_type_node))
- return unsignedp ? unsigned_char_type_node : signed_char_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
- return unsignedp ? unsigned_type_node : integer_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (short_integer_type_node))
- return unsignedp ? short_unsigned_type_node : short_integer_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (long_integer_type_node))
- return unsignedp ? long_unsigned_type_node : long_integer_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (long_long_integer_type_node))
- return (unsignedp ? long_long_unsigned_type_node
- : long_long_integer_type_node);
- return type;
-}
-
-/* Compute the value of the `sizeof' operator. */
-
-tree
-c_sizeof (type)
- tree type;
-{
- enum tree_code code = TREE_CODE (type);
- tree t;
-
- if (code == FUNCTION_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("sizeof applied to a function type");
- return size_int (1);
- }
- if (code == VOID_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("sizeof applied to a void type");
- return size_int (1);
- }
- if (code == ERROR_MARK)
- return size_int (1);
- if (TYPE_SIZE (type) == 0)
- {
- error ("sizeof applied to an incomplete type");
- return size_int (0);
- }
-
- /* Convert in case a char is more than one unit. */
- t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
- size_int (TYPE_PRECISION (char_type_node)));
- /* size_binop does not put the constant in range, so do it now. */
- if (TREE_CODE (t) == INTEGER_CST && force_fit_type (t, 0))
- TREE_CONSTANT_OVERFLOW (t) = TREE_OVERFLOW (t) = 1;
- return t;
-}
-
-tree
-c_sizeof_nowarn (type)
- tree type;
-{
- enum tree_code code = TREE_CODE (type);
- tree t;
-
- if (code == FUNCTION_TYPE
- || code == VOID_TYPE
- || code == ERROR_MARK)
- return size_int (1);
- if (TYPE_SIZE (type) == 0)
- return size_int (0);
-
- /* Convert in case a char is more than one unit. */
- t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
- size_int (TYPE_PRECISION (char_type_node)));
- force_fit_type (t, 0);
- return t;
-}
-
-/* Compute the size to increment a pointer by. */
-
-tree
-c_size_in_bytes (type)
- tree type;
-{
- enum tree_code code = TREE_CODE (type);
- tree t;
-
- if (code == FUNCTION_TYPE)
- return size_int (1);
- if (code == VOID_TYPE)
- return size_int (1);
- if (code == ERROR_MARK)
- return size_int (1);
- if (TYPE_SIZE (type) == 0)
- {
- error ("arithmetic on pointer to an incomplete type");
- return size_int (1);
- }
-
- /* Convert in case a char is more than one unit. */
- t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
- size_int (BITS_PER_UNIT));
- force_fit_type (t, 0);
- return t;
-}
-
-/* Implement the __alignof keyword: Return the minimum required
- alignment of TYPE, measured in bytes. */
-
-tree
-c_alignof (type)
- tree type;
-{
- enum tree_code code = TREE_CODE (type);
-
- if (code == FUNCTION_TYPE)
- return size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);
-
- if (code == VOID_TYPE || code == ERROR_MARK)
- return size_int (1);
-
- return size_int (TYPE_ALIGN (type) / BITS_PER_UNIT);
-}
-
-/* Implement the __alignof keyword: Return the minimum required
- alignment of EXPR, measured in bytes. For VAR_DECL's and
- FIELD_DECL's return DECL_ALIGN (which can be set from an
- "aligned" __attribute__ specification). */
-
-tree
-c_alignof_expr (expr)
- tree expr;
-{
- if (TREE_CODE (expr) == VAR_DECL)
- return size_int (DECL_ALIGN (expr) / BITS_PER_UNIT);
-
- if (TREE_CODE (expr) == COMPONENT_REF
- && DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1)))
- {
- error ("`__alignof' applied to a bit-field");
- return size_int (1);
- }
- else if (TREE_CODE (expr) == COMPONENT_REF
- && TREE_CODE (TREE_OPERAND (expr, 1)) == FIELD_DECL)
- return size_int (DECL_ALIGN (TREE_OPERAND (expr, 1)) / BITS_PER_UNIT);
-
- if (TREE_CODE (expr) == INDIRECT_REF)
- {
- tree t = TREE_OPERAND (expr, 0);
- tree best = t;
- int bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
-
- while (TREE_CODE (t) == NOP_EXPR
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE)
- {
- int thisalign;
-
- t = TREE_OPERAND (t, 0);
- thisalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
- if (thisalign > bestalign)
- best = t, bestalign = thisalign;
- }
- return c_alignof (TREE_TYPE (TREE_TYPE (best)));
- }
- else
- return c_alignof (TREE_TYPE (expr));
-}
-
-/* Return either DECL or its known constant value (if it has one). */
-
-static tree
-decl_constant_value (decl)
- tree decl;
-{
- if (/* Don't change a variable array bound or initial value to a constant
- in a place where a variable is invalid. */
- current_function_decl != 0
- && ! pedantic
- && ! TREE_THIS_VOLATILE (decl)
- && TREE_READONLY (decl) && ! ITERATOR_P (decl)
- && DECL_INITIAL (decl) != 0
- && TREE_CODE (DECL_INITIAL (decl)) != ERROR_MARK
- /* This is invalid if initial value is not constant.
- If it has either a function call, a memory reference,
- or a variable, then re-evaluating it could give different results. */
- && TREE_CONSTANT (DECL_INITIAL (decl))
- /* Check for cases where this is sub-optimal, even though valid. */
- && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR
- && DECL_MODE (decl) != BLKmode)
- return DECL_INITIAL (decl);
- return decl;
-}
-
-/* Perform default promotions for C data used in expressions.
- Arrays and functions are converted to pointers;
- enumeral types or short or char, to int.
- In addition, manifest constants symbols are replaced by their values. */
-
-tree
-default_conversion (exp)
- tree exp;
-{
- register tree type = TREE_TYPE (exp);
- register enum tree_code code = TREE_CODE (type);
-
- /* Constants can be used directly unless they're not loadable. */
- if (TREE_CODE (exp) == CONST_DECL)
- exp = DECL_INITIAL (exp);
-
- /* Replace a nonvolatile const static variable with its value unless
- it is an array, in which case we must be sure that taking the
- address of the array produces consistent results. */
- else if (optimize && TREE_CODE (exp) == VAR_DECL && code != ARRAY_TYPE)
- {
- exp = decl_constant_value (exp);
- type = TREE_TYPE (exp);
- }
-
- /* Strip NON_LVALUE_EXPRs and no-op conversions, since we aren't using as
- an lvalue. */
- /* Do not use STRIP_NOPS here! It will remove conversions from pointer
- to integer and cause infinite recursion. */
- while (TREE_CODE (exp) == NON_LVALUE_EXPR
- || (TREE_CODE (exp) == NOP_EXPR
- && TREE_TYPE (TREE_OPERAND (exp, 0)) == TREE_TYPE (exp)))
- exp = TREE_OPERAND (exp, 0);
-
- /* Normally convert enums to int,
- but convert wide enums to something wider. */
- if (code == ENUMERAL_TYPE)
- {
- type = type_for_size (MAX (TYPE_PRECISION (type),
- TYPE_PRECISION (integer_type_node)),
- ((flag_traditional
- || TYPE_PRECISION (type) >= TYPE_PRECISION (integer_type_node))
- && TREE_UNSIGNED (type)));
- return convert (type, exp);
- }
-
- if (TREE_CODE (exp) == COMPONENT_REF
- && DECL_BIT_FIELD (TREE_OPERAND (exp, 1)))
- {
- tree width = DECL_SIZE (TREE_OPERAND (exp, 1));
- HOST_WIDE_INT low = TREE_INT_CST_LOW (width);
-
- /* If it's thinner than an int, promote it like a
- C_PROMOTING_INTEGER_TYPE_P, otherwise leave it alone. */
-
- if (low < TYPE_PRECISION (integer_type_node))
- {
- if ( flag_traditional && TREE_UNSIGNED (type))
- return convert (unsigned_type_node, exp);
- else
- return convert (integer_type_node, exp);
- }
- }
-
- if (C_PROMOTING_INTEGER_TYPE_P (type))
- {
- /* Traditionally, unsignedness is preserved in default promotions.
- Also preserve unsignedness if not really getting any wider. */
- if (TREE_UNSIGNED (type)
- && (flag_traditional
- || TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)))
- return convert (unsigned_type_node, exp);
- return convert (integer_type_node, exp);
- }
- if (flag_traditional && !flag_allow_single_precision
- && TYPE_MAIN_VARIANT (type) == float_type_node)
- return convert (double_type_node, exp);
- if (code == VOID_TYPE)
- {
- error ("void value not ignored as it ought to be");
- return error_mark_node;
- }
- if (code == FUNCTION_TYPE)
- {
- return build_unary_op (ADDR_EXPR, exp, 0);
- }
- if (code == ARRAY_TYPE)
- {
- register tree adr;
- tree restype = TREE_TYPE (type);
- tree ptrtype;
- int constp = 0;
- int volatilep = 0;
-
- if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'r'
- || TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
- {
- constp = TREE_READONLY (exp);
- volatilep = TREE_THIS_VOLATILE (exp);
- }
-
- if (TYPE_READONLY (type) || TYPE_VOLATILE (type)
- || constp || volatilep)
- restype = c_build_type_variant (restype,
- TYPE_READONLY (type) || constp,
- TYPE_VOLATILE (type) || volatilep);
-
- if (TREE_CODE (exp) == INDIRECT_REF)
- return convert (TYPE_POINTER_TO (restype),
- TREE_OPERAND (exp, 0));
-
- if (TREE_CODE (exp) == COMPOUND_EXPR)
- {
- tree op1 = default_conversion (TREE_OPERAND (exp, 1));
- return build (COMPOUND_EXPR, TREE_TYPE (op1),
- TREE_OPERAND (exp, 0), op1);
- }
-
- if (!lvalue_p (exp)
- && ! (TREE_CODE (exp) == CONSTRUCTOR && TREE_STATIC (exp)))
- {
- error ("invalid use of non-lvalue array");
- return error_mark_node;
- }
-
- ptrtype = build_pointer_type (restype);
-
- if (TREE_CODE (exp) == VAR_DECL)
- {
- /* ??? This is not really quite correct
- in that the type of the operand of ADDR_EXPR
- is not the target type of the type of the ADDR_EXPR itself.
- Question is, can this lossage be avoided? */
- adr = build1 (ADDR_EXPR, ptrtype, exp);
- if (mark_addressable (exp) == 0)
- return error_mark_node;
- TREE_CONSTANT (adr) = staticp (exp);
- TREE_SIDE_EFFECTS (adr) = 0; /* Default would be, same as EXP. */
- return adr;
- }
- /* This way is better for a COMPONENT_REF since it can
- simplify the offset for a component. */
- adr = build_unary_op (ADDR_EXPR, exp, 1);
- return convert (ptrtype, adr);
- }
- return exp;
-}
-
-/* Look up component name in the structure type definition.
-
- If this component name is found indirectly within an anonymous union,
- store in *INDIRECT the component which directly contains
- that anonymous union. Otherwise, set *INDIRECT to 0. */
-
-static tree
-lookup_field (type, component, indirect)
- tree type, component;
- tree *indirect;
-{
- tree field;
-
- /* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers
- to the field elements. Use a binary search on this array to quickly
- find the element. Otherwise, do a linear search. TYPE_LANG_SPECIFIC
- will always be set for structures which have many elements. */
-
- if (TYPE_LANG_SPECIFIC (type))
- {
- int bot, top, half;
- tree *field_array = &TYPE_LANG_SPECIFIC (type)->elts[0];
-
- field = TYPE_FIELDS (type);
- bot = 0;
- top = TYPE_LANG_SPECIFIC (type)->len;
- while (top - bot > 1)
- {
- half = (top - bot + 1) >> 1;
- field = field_array[bot+half];
-
- if (DECL_NAME (field) == NULL_TREE)
- {
- /* Step through all anon unions in linear fashion. */
- while (DECL_NAME (field_array[bot]) == NULL_TREE)
- {
- tree anon, junk;
-
- field = field_array[bot++];
- anon = lookup_field (TREE_TYPE (field), component, &junk);
- if (anon != NULL_TREE)
- {
- *indirect = field;
- return anon;
- }
- }
-
- /* Entire record is only anon unions. */
- if (bot > top)
- return NULL_TREE;
-
- /* Restart the binary search, with new lower bound. */
- continue;
- }
-
- if (DECL_NAME (field) == component)
- break;
- if (DECL_NAME (field) < component)
- bot += half;
- else
- top = bot + half;
- }
-
- if (DECL_NAME (field_array[bot]) == component)
- field = field_array[bot];
- else if (DECL_NAME (field) != component)
- field = 0;
- }
- else
- {
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- {
- if (DECL_NAME (field) == NULL_TREE)
- {
- tree junk;
- tree anon = lookup_field (TREE_TYPE (field), component, &junk);
- if (anon != NULL_TREE)
- {
- *indirect = field;
- return anon;
- }
- }
-
- if (DECL_NAME (field) == component)
- break;
- }
- }
-
- *indirect = NULL_TREE;
- return field;
-}
-
-/* Make an expression to refer to the COMPONENT field of
- structure or union value DATUM. COMPONENT is an IDENTIFIER_NODE. */
-
-tree
-build_component_ref (datum, component)
- tree datum, component;
-{
- register tree type = TREE_TYPE (datum);
- register enum tree_code code = TREE_CODE (type);
- register tree field = NULL;
- register tree ref;
-
- /* If DATUM is a COMPOUND_EXPR or COND_EXPR, move our reference inside it
- unless we are not to support things not strictly ANSI. */
- switch (TREE_CODE (datum))
- {
- case COMPOUND_EXPR:
- {
- tree value = build_component_ref (TREE_OPERAND (datum, 1), component);
- return build (COMPOUND_EXPR, TREE_TYPE (value),
- TREE_OPERAND (datum, 0), value);
- }
- case COND_EXPR:
- return build_conditional_expr
- (TREE_OPERAND (datum, 0),
- build_component_ref (TREE_OPERAND (datum, 1), component),
- build_component_ref (TREE_OPERAND (datum, 2), component));
- }
-
- /* See if there is a field or component with name COMPONENT. */
-
- if (code == RECORD_TYPE || code == UNION_TYPE)
- {
- tree indirect = 0;
-
- if (TYPE_SIZE (type) == 0)
- {
- incomplete_type_error (NULL_TREE, type);
- return error_mark_node;
- }
-
- field = lookup_field (type, component, &indirect);
-
- if (!field)
- {
- error (code == RECORD_TYPE
- ? "structure has no member named `%s'"
- : "union has no member named `%s'",
- IDENTIFIER_POINTER (component));
- return error_mark_node;
- }
- if (TREE_TYPE (field) == error_mark_node)
- return error_mark_node;
-
- /* If FIELD was found buried within an anonymous union,
- make one COMPONENT_REF to get that anonymous union,
- then fall thru to make a second COMPONENT_REF to get FIELD. */
- if (indirect != 0)
- {
- ref = build (COMPONENT_REF, TREE_TYPE (indirect), datum, indirect);
- if (TREE_READONLY (datum) || TREE_READONLY (indirect))
- TREE_READONLY (ref) = 1;
- if (TREE_THIS_VOLATILE (datum) || TREE_THIS_VOLATILE (indirect))
- TREE_THIS_VOLATILE (ref) = 1;
- datum = ref;
- }
-
- ref = build (COMPONENT_REF, TREE_TYPE (field), datum, field);
-
- if (TREE_READONLY (datum) || TREE_READONLY (field))
- TREE_READONLY (ref) = 1;
- if (TREE_THIS_VOLATILE (datum) || TREE_THIS_VOLATILE (field))
- TREE_THIS_VOLATILE (ref) = 1;
-
- return ref;
- }
- else if (code != ERROR_MARK)
- error ("request for member `%s' in something not a structure or union",
- IDENTIFIER_POINTER (component));
-
- return error_mark_node;
-}
-
-/* Given an expression PTR for a pointer, return an expression
- for the value pointed to.
- ERRORSTRING is the name of the operator to appear in error messages. */
-
-tree
-build_indirect_ref (ptr, errorstring)
- tree ptr;
- char *errorstring;
-{
- register tree pointer = default_conversion (ptr);
- register tree type = TREE_TYPE (pointer);
-
- if (TREE_CODE (type) == POINTER_TYPE)
- {
- if (TREE_CODE (pointer) == ADDR_EXPR
- && !flag_volatile
- && (TREE_TYPE (TREE_OPERAND (pointer, 0))
- == TREE_TYPE (type)))
- return TREE_OPERAND (pointer, 0);
- else
- {
- tree t = TREE_TYPE (type);
- register tree ref = build1 (INDIRECT_REF,
- TYPE_MAIN_VARIANT (t), pointer);
-
- if (TYPE_SIZE (t) == 0 && TREE_CODE (t) != ARRAY_TYPE)
- {
- error ("dereferencing pointer to incomplete type");
- return error_mark_node;
- }
- if (TREE_CODE (t) == VOID_TYPE && skip_evaluation == 0)
- warning ("dereferencing `void *' pointer");
-
- /* We *must* set TREE_READONLY when dereferencing a pointer to const,
- so that we get the proper error message if the result is used
- to assign to. Also, &* is supposed to be a no-op.
- And ANSI C seems to specify that the type of the result
- should be the const type. */
- /* A de-reference of a pointer to const is not a const. It is valid
- to change it via some other pointer. */
- TREE_READONLY (ref) = TYPE_READONLY (t);
- TREE_SIDE_EFFECTS (ref)
- = TYPE_VOLATILE (t) || TREE_SIDE_EFFECTS (pointer) || flag_volatile;
- TREE_THIS_VOLATILE (ref) = TYPE_VOLATILE (t);
- return ref;
- }
- }
- else if (TREE_CODE (pointer) != ERROR_MARK)
- error ("invalid type argument of `%s'", errorstring);
- return error_mark_node;
-}
-
-/* This handles expressions of the form "a[i]", which denotes
- an array reference.
-
- This is logically equivalent in C to *(a+i), but we may do it differently.
- If A is a variable or a member, we generate a primitive ARRAY_REF.
- This avoids forcing the array out of registers, and can work on
- arrays that are not lvalues (for example, members of structures returned
- by functions). */
-
-tree
-build_array_ref (array, index)
- tree array, index;
-{
- if (index == 0)
- {
- error ("subscript missing in array reference");
- return error_mark_node;
- }
-
- if (TREE_TYPE (array) == error_mark_node
- || TREE_TYPE (index) == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE
- && TREE_CODE (array) != INDIRECT_REF)
- {
- tree rval, type;
-
- /* Subscripting with type char is likely to lose
- on a machine where chars are signed.
- So warn on any machine, but optionally.
- Don't warn for unsigned char since that type is safe.
- Don't warn for signed char because anyone who uses that
- must have done so deliberately. */
- if (warn_char_subscripts
- && TYPE_MAIN_VARIANT (TREE_TYPE (index)) == char_type_node)
- warning ("array subscript has type `char'");
-
- /* Apply default promotions *after* noticing character types. */
- index = default_conversion (index);
-
- /* Require integer *after* promotion, for sake of enums. */
- if (TREE_CODE (TREE_TYPE (index)) != INTEGER_TYPE)
- {
- error ("array subscript is not an integer");
- return error_mark_node;
- }
-
- /* An array that is indexed by a non-constant
- cannot be stored in a register; we must be able to do
- address arithmetic on its address.
- Likewise an array of elements of variable size. */
- if (TREE_CODE (index) != INTEGER_CST
- || (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))) != 0
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array)))) != INTEGER_CST))
- {
- if (mark_addressable (array) == 0)
- return error_mark_node;
- }
- /* An array that is indexed by a constant value which is not within
- the array bounds cannot be stored in a register either; because we
- would get a crash in store_bit_field/extract_bit_field when trying
- to access a non-existent part of the register. */
- if (TREE_CODE (index) == INTEGER_CST
- && TYPE_VALUES (TREE_TYPE (array))
- && ! int_fits_type_p (index, TYPE_VALUES (TREE_TYPE (array))))
- {
- if (mark_addressable (array) == 0)
- return error_mark_node;
- }
-
- if (pedantic && !lvalue_p (array))
- {
- if (DECL_REGISTER (array))
- pedwarn ("ANSI C forbids subscripting `register' array");
- else
- pedwarn ("ANSI C forbids subscripting non-lvalue array");
- }
-
- if (pedantic)
- {
- tree foo = array;
- while (TREE_CODE (foo) == COMPONENT_REF)
- foo = TREE_OPERAND (foo, 0);
- if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo))
- pedwarn ("ANSI C forbids subscripting non-lvalue array");
- }
-
- type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (array)));
- rval = build (ARRAY_REF, type, array, index);
- /* Array ref is const/volatile if the array elements are
- or if the array is. */
- TREE_READONLY (rval)
- |= (TYPE_READONLY (TREE_TYPE (TREE_TYPE (array)))
- | TREE_READONLY (array));
- TREE_SIDE_EFFECTS (rval)
- |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array)))
- | TREE_SIDE_EFFECTS (array));
- TREE_THIS_VOLATILE (rval)
- |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array)))
- /* This was added by rms on 16 Nov 91.
- It fixes vol struct foo *a; a->elts[1]
- in an inline function.
- Hope it doesn't break something else. */
- | TREE_THIS_VOLATILE (array));
- return require_complete_type (fold (rval));
- }
-
- {
- tree ar = default_conversion (array);
- tree ind = default_conversion (index);
-
- /* Do the same warning check as above, but only on the part that's
- syntactically the index and only if it is also semantically
- the index. */
- if (warn_char_subscripts
- && TREE_CODE (TREE_TYPE (index)) == INTEGER_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (index)) == char_type_node)
- warning ("subscript has type `char'");
-
- /* Put the integer in IND to simplify error checking. */
- if (TREE_CODE (TREE_TYPE (ar)) == INTEGER_TYPE)
- {
- tree temp = ar;
- ar = ind;
- ind = temp;
- }
-
- if (ar == error_mark_node)
- return ar;
-
- if (TREE_CODE (TREE_TYPE (ar)) != POINTER_TYPE
- || TREE_CODE (TREE_TYPE (TREE_TYPE (ar))) == FUNCTION_TYPE)
- {
- error ("subscripted value is neither array nor pointer");
- return error_mark_node;
- }
- if (TREE_CODE (TREE_TYPE (ind)) != INTEGER_TYPE)
- {
- error ("array subscript is not an integer");
- return error_mark_node;
- }
-
- return build_indirect_ref (build_binary_op (PLUS_EXPR, ar, ind, 0),
- "array indexing");
- }
-}
-
-/* Build a function call to function FUNCTION with parameters PARAMS.
- PARAMS is a list--a chain of TREE_LIST nodes--in which the
- TREE_VALUE of each node is a parameter-expression.
- FUNCTION's data type may be a function type or a pointer-to-function. */
-
-tree
-build_function_call (function, params)
- tree function, params;
-{
- register tree fntype, fundecl = 0;
- register tree coerced_params;
- tree name = NULL_TREE, assembler_name = NULL_TREE;
-
- /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */
- STRIP_TYPE_NOPS (function);
-
- /* Convert anything with function type to a pointer-to-function. */
- if (TREE_CODE (function) == FUNCTION_DECL)
- {
- name = DECL_NAME (function);
- assembler_name = DECL_ASSEMBLER_NAME (function);
-
- /* Differs from default_conversion by not setting TREE_ADDRESSABLE
- (because calling an inline function does not mean the function
- needs to be separately compiled). */
- fntype = build_type_variant (TREE_TYPE (function),
- TREE_READONLY (function),
- TREE_THIS_VOLATILE (function));
- fundecl = function;
- function = build1 (ADDR_EXPR, build_pointer_type (fntype), function);
- }
- else
- function = default_conversion (function);
-
- fntype = TREE_TYPE (function);
-
- if (TREE_CODE (fntype) == ERROR_MARK)
- return error_mark_node;
-
- if (!(TREE_CODE (fntype) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE))
- {
- error ("called object is not a function");
- return error_mark_node;
- }
-
- /* fntype now gets the type of function pointed to. */
- fntype = TREE_TYPE (fntype);
-
- /* Convert the parameters to the types declared in the
- function prototype, or apply default promotions. */
-
- coerced_params
- = convert_arguments (TYPE_ARG_TYPES (fntype), params, name, fundecl);
-
- /* Check for errors in format strings. */
-
- if (warn_format && (name || assembler_name))
- check_function_format (name, assembler_name, coerced_params);
-
- /* Recognize certain built-in functions so we can make tree-codes
- other than CALL_EXPR. We do this when it enables fold-const.c
- to do something useful. */
-
- if (TREE_CODE (function) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL
- && DECL_BUILT_IN (TREE_OPERAND (function, 0)))
- switch (DECL_FUNCTION_CODE (TREE_OPERAND (function, 0)))
- {
- case BUILT_IN_ABS:
- case BUILT_IN_LABS:
- case BUILT_IN_FABS:
- if (coerced_params == 0)
- return integer_zero_node;
- return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0);
- }
-
- {
- register tree result
- = build (CALL_EXPR, TREE_TYPE (fntype),
- function, coerced_params, NULL_TREE);
-
- TREE_SIDE_EFFECTS (result) = 1;
- if (TREE_TYPE (result) == void_type_node)
- return result;
- return require_complete_type (result);
- }
-}
-
-/* Convert the argument expressions in the list VALUES
- to the types in the list TYPELIST. The result is a list of converted
- argument expressions.
-
- If TYPELIST is exhausted, or when an element has NULL as its type,
- perform the default conversions.
-
- PARMLIST is the chain of parm decls for the function being called.
- It may be 0, if that info is not available.
- It is used only for generating error messages.
-
- NAME is an IDENTIFIER_NODE or 0. It is used only for error messages.
-
- This is also where warnings about wrong number of args are generated.
-
- Both VALUES and the returned value are chains of TREE_LIST nodes
- with the elements of the list in the TREE_VALUE slots of those nodes. */
-
-static tree
-convert_arguments (typelist, values, name, fundecl)
- tree typelist, values, name, fundecl;
-{
- register tree typetail, valtail;
- register tree result = NULL;
- int parmnum;
-
- /* Scan the given expressions and types, producing individual
- converted arguments and pushing them on RESULT in reverse order. */
-
- for (valtail = values, typetail = typelist, parmnum = 0;
- valtail;
- valtail = TREE_CHAIN (valtail), parmnum++)
- {
- register tree type = typetail ? TREE_VALUE (typetail) : 0;
- register tree val = TREE_VALUE (valtail);
-
- if (type == void_type_node)
- {
- if (name)
- error ("too many arguments to function `%s'",
- IDENTIFIER_POINTER (name));
- else
- error ("too many arguments to function");
- break;
- }
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- /* Do not use STRIP_NOPS here! We do not want an enumerator with value 0
- to convert automatically to a pointer. */
- if (TREE_CODE (val) == NON_LVALUE_EXPR)
- val = TREE_OPERAND (val, 0);
-
- if (TREE_CODE (TREE_TYPE (val)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (val)) == FUNCTION_TYPE)
- val = default_conversion (val);
-
- val = require_complete_type (val);
-
- if (type != 0)
- {
- /* Formal parm type is specified by a function prototype. */
- tree parmval;
-
- if (TYPE_SIZE (type) == 0)
- {
- error ("type of formal parameter %d is incomplete", parmnum + 1);
- parmval = val;
- }
- else
- {
- /* Optionally warn about conversions that
- differ from the default conversions. */
- if (warn_conversion)
- {
- int formal_prec = TYPE_PRECISION (type);
-
- if (INTEGRAL_TYPE_P (type)
- && TREE_CODE (TREE_TYPE (val)) == REAL_TYPE)
- warn_for_assignment ("%s as integer rather than floating due to prototype", (char *) 0, name, parmnum + 1);
- else if (TREE_CODE (type) == COMPLEX_TYPE
- && TREE_CODE (TREE_TYPE (val)) == REAL_TYPE)
- warn_for_assignment ("%s as complex rather than floating due to prototype", (char *) 0, name, parmnum + 1);
- else if (TREE_CODE (type) == REAL_TYPE
- && INTEGRAL_TYPE_P (TREE_TYPE (val)))
- warn_for_assignment ("%s as floating rather than integer due to prototype", (char *) 0, name, parmnum + 1);
- else if (TREE_CODE (type) == REAL_TYPE
- && TREE_CODE (TREE_TYPE (val)) == COMPLEX_TYPE)
- warn_for_assignment ("%s as floating rather than complex due to prototype", (char *) 0, name, parmnum + 1);
- /* ??? At some point, messages should be written about
- conversions between complex types, but that's too messy
- to do now. */
- else if (TREE_CODE (type) == REAL_TYPE
- && TREE_CODE (TREE_TYPE (val)) == REAL_TYPE)
- {
- /* Warn if any argument is passed as `float',
- since without a prototype it would be `double'. */
- if (formal_prec == TYPE_PRECISION (float_type_node))
- warn_for_assignment ("%s as `float' rather than `double' due to prototype", (char *) 0, name, parmnum + 1);
- }
- /* Detect integer changing in width or signedness. */
- else if (INTEGRAL_TYPE_P (type)
- && INTEGRAL_TYPE_P (TREE_TYPE (val)))
- {
- tree would_have_been = default_conversion (val);
- tree type1 = TREE_TYPE (would_have_been);
-
- if (TREE_CODE (type) == ENUMERAL_TYPE
- && type == TREE_TYPE (val))
- /* No warning if function asks for enum
- and the actual arg is that enum type. */
- ;
- else if (formal_prec != TYPE_PRECISION (type1))
- warn_for_assignment ("%s with different width due to prototype", (char *) 0, name, parmnum + 1);
- else if (TREE_UNSIGNED (type) == TREE_UNSIGNED (type1))
- ;
- /* Don't complain if the formal parameter type
- is an enum, because we can't tell now whether
- the value was an enum--even the same enum. */
- else if (TREE_CODE (type) == ENUMERAL_TYPE)
- ;
- else if (TREE_CODE (val) == INTEGER_CST
- && int_fits_type_p (val, type))
- /* Change in signedness doesn't matter
- if a constant value is unaffected. */
- ;
- /* Likewise for a constant in a NOP_EXPR. */
- else if (TREE_CODE (val) == NOP_EXPR
- && TREE_CODE (TREE_OPERAND (val, 0)) == INTEGER_CST
- && int_fits_type_p (TREE_OPERAND (val, 0), type))
- ;
-#if 0 /* We never get such tree structure here. */
- else if (TREE_CODE (TREE_TYPE (val)) == ENUMERAL_TYPE
- && int_fits_type_p (TYPE_MIN_VALUE (TREE_TYPE (val)), type)
- && int_fits_type_p (TYPE_MAX_VALUE (TREE_TYPE (val)), type))
- /* Change in signedness doesn't matter
- if an enum value is unaffected. */
- ;
-#endif
- /* If the value is extended from a narrower
- unsigned type, it doesn't matter whether we
- pass it as signed or unsigned; the value
- certainly is the same either way. */
- else if (TYPE_PRECISION (TREE_TYPE (val)) < TYPE_PRECISION (type)
- && TREE_UNSIGNED (TREE_TYPE (val)))
- ;
- else if (TREE_UNSIGNED (type))
- warn_for_assignment ("%s as unsigned due to prototype", (char *) 0, name, parmnum + 1);
- else
- warn_for_assignment ("%s as signed due to prototype", (char *) 0, name, parmnum + 1);
- }
- }
-
- parmval = convert_for_assignment (type, val,
- (char *) 0, /* arg passing */
- fundecl, name, parmnum + 1);
-
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
- parmval = default_conversion (parmval);
-#endif
- }
- result = tree_cons (NULL_TREE, parmval, result);
- }
- else if (TREE_CODE (TREE_TYPE (val)) == REAL_TYPE
- && (TYPE_PRECISION (TREE_TYPE (val))
- < TYPE_PRECISION (double_type_node)))
- /* Convert `float' to `double'. */
- result = tree_cons (NULL_TREE, convert (double_type_node, val), result);
- else
- /* Convert `short' and `char' to full-size `int'. */
- result = tree_cons (NULL_TREE, default_conversion (val), result);
-
- if (typetail)
- typetail = TREE_CHAIN (typetail);
- }
-
- if (typetail != 0 && TREE_VALUE (typetail) != void_type_node)
- {
- if (name)
- error ("too few arguments to function `%s'",
- IDENTIFIER_POINTER (name));
- else
- error ("too few arguments to function");
- }
-
- return nreverse (result);
-}
-
-/* This is the entry point used by the parser
- for binary operators in the input.
- In addition to constructing the expression,
- we check for operands that were written with other binary operators
- in a way that is likely to confuse the user. */
-
-tree
-parser_build_binary_op (code, arg1, arg2)
- enum tree_code code;
- tree arg1, arg2;
-{
- tree result = build_binary_op (code, arg1, arg2, 1);
-
- char class;
- char class1 = TREE_CODE_CLASS (TREE_CODE (arg1));
- char class2 = TREE_CODE_CLASS (TREE_CODE (arg2));
- enum tree_code code1 = ERROR_MARK;
- enum tree_code code2 = ERROR_MARK;
-
- if (class1 == 'e' || class1 == '1'
- || class1 == '2' || class1 == '<')
- code1 = C_EXP_ORIGINAL_CODE (arg1);
- if (class2 == 'e' || class2 == '1'
- || class2 == '2' || class2 == '<')
- code2 = C_EXP_ORIGINAL_CODE (arg2);
-
- /* Check for cases such as x+y<<z which users are likely
- to misinterpret. If parens are used, C_EXP_ORIGINAL_CODE
- is cleared to prevent these warnings. */
- if (warn_parentheses)
- {
- if (code == LSHIFT_EXPR || code == RSHIFT_EXPR)
- {
- if (code1 == PLUS_EXPR || code1 == MINUS_EXPR
- || code2 == PLUS_EXPR || code2 == MINUS_EXPR)
- warning ("suggest parentheses around + or - inside shift");
- }
-
- if (code == TRUTH_ORIF_EXPR)
- {
- if (code1 == TRUTH_ANDIF_EXPR
- || code2 == TRUTH_ANDIF_EXPR)
- warning ("suggest parentheses around && within ||");
- }
-
- if (code == BIT_IOR_EXPR)
- {
- if (code1 == BIT_AND_EXPR || code1 == BIT_XOR_EXPR
- || code1 == PLUS_EXPR || code1 == MINUS_EXPR
- || code2 == BIT_AND_EXPR || code2 == BIT_XOR_EXPR
- || code2 == PLUS_EXPR || code2 == MINUS_EXPR)
- warning ("suggest parentheses around arithmetic in operand of |");
- /* Check cases like x|y==z */
- if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')
- warning ("suggest parentheses around comparison in operand of |");
- }
-
- if (code == BIT_XOR_EXPR)
- {
- if (code1 == BIT_AND_EXPR
- || code1 == PLUS_EXPR || code1 == MINUS_EXPR
- || code2 == BIT_AND_EXPR
- || code2 == PLUS_EXPR || code2 == MINUS_EXPR)
- warning ("suggest parentheses around arithmetic in operand of ^");
- /* Check cases like x^y==z */
- if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')
- warning ("suggest parentheses around comparison in operand of ^");
- }
-
- if (code == BIT_AND_EXPR)
- {
- if (code1 == PLUS_EXPR || code1 == MINUS_EXPR
- || code2 == PLUS_EXPR || code2 == MINUS_EXPR)
- warning ("suggest parentheses around + or - in operand of &");
- /* Check cases like x&y==z */
- if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')
- warning ("suggest parentheses around comparison in operand of &");
- }
- }
-
- /* Similarly, check for cases like 1<=i<=10 that are probably errors. */
- if (TREE_CODE_CLASS (code) == '<' && extra_warnings
- && (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<'))
- warning ("comparisons like X<=Y<=Z do not have their mathematical meaning");
-
- unsigned_conversion_warning (result, arg1);
- unsigned_conversion_warning (result, arg2);
- overflow_warning (result);
-
- class = TREE_CODE_CLASS (TREE_CODE (result));
-
- /* Record the code that was specified in the source,
- for the sake of warnings about confusing nesting. */
- if (class == 'e' || class == '1'
- || class == '2' || class == '<')
- C_SET_EXP_ORIGINAL_CODE (result, code);
- else
- {
- int flag = TREE_CONSTANT (result);
- /* We used to use NOP_EXPR rather than NON_LVALUE_EXPR
- so that convert_for_assignment wouldn't strip it.
- That way, we got warnings for things like p = (1 - 1).
- But it turns out we should not get those warnings. */
- result = build1 (NON_LVALUE_EXPR, TREE_TYPE (result), result);
- C_SET_EXP_ORIGINAL_CODE (result, code);
- TREE_CONSTANT (result) = flag;
- }
-
- return result;
-}
-
-/* Build a binary-operation expression without default conversions.
- CODE is the kind of expression to build.
- This function differs from `build' in several ways:
- the data type of the result is computed and recorded in it,
- warnings are generated if arg data types are invalid,
- special handling for addition and subtraction of pointers is known,
- and some optimization is done (operations on narrow ints
- are done in the narrower type when that gives the same result).
- Constant folding is also done before the result is returned.
-
- Note that the operands will never have enumeral types, or function
- or array types, because either they will have the default conversions
- performed or they have both just been converted to some other type in which
- the arithmetic is to be done. */
-
-tree
-build_binary_op (code, orig_op0, orig_op1, convert_p)
- enum tree_code code;
- tree orig_op0, orig_op1;
- int convert_p;
-{
- tree type0, type1;
- register enum tree_code code0, code1;
- tree op0, op1;
-
- /* Expression code to give to the expression when it is built.
- Normally this is CODE, which is what the caller asked for,
- but in some special cases we change it. */
- register enum tree_code resultcode = code;
-
- /* Data type in which the computation is to be performed.
- In the simplest cases this is the common type of the arguments. */
- register tree result_type = NULL;
-
- /* Nonzero means operands have already been type-converted
- in whatever way is necessary.
- Zero means they need to be converted to RESULT_TYPE. */
- int converted = 0;
-
- /* Nonzero means create the expression with this type, rather than
- RESULT_TYPE. */
- tree build_type = 0;
-
- /* Nonzero means after finally constructing the expression
- convert it to this type. */
- tree final_type = 0;
-
- /* Nonzero if this is an operation like MIN or MAX which can
- safely be computed in short if both args are promoted shorts.
- Also implies COMMON.
- -1 indicates a bitwise operation; this makes a difference
- in the exact conditions for when it is safe to do the operation
- in a narrower mode. */
- int shorten = 0;
-
- /* Nonzero if this is a comparison operation;
- if both args are promoted shorts, compare the original shorts.
- Also implies COMMON. */
- int short_compare = 0;
-
- /* Nonzero if this is a right-shift operation, which can be computed on the
- original short and then promoted if the operand is a promoted short. */
- int short_shift = 0;
-
- /* Nonzero means set RESULT_TYPE to the common type of the args. */
- int common = 0;
-
- if (convert_p)
- {
- op0 = default_conversion (orig_op0);
- op1 = default_conversion (orig_op1);
- }
- else
- {
- op0 = orig_op0;
- op1 = orig_op1;
- }
-
- type0 = TREE_TYPE (op0);
- type1 = TREE_TYPE (op1);
-
- /* The expression codes of the data types of the arguments tell us
- whether the arguments are integers, floating, pointers, etc. */
- code0 = TREE_CODE (type0);
- code1 = TREE_CODE (type1);
-
- /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */
- STRIP_TYPE_NOPS (op0);
- STRIP_TYPE_NOPS (op1);
-
- /* If an error was already reported for one of the arguments,
- avoid reporting another error. */
-
- if (code0 == ERROR_MARK || code1 == ERROR_MARK)
- return error_mark_node;
-
- switch (code)
- {
- case PLUS_EXPR:
- /* Handle the pointer + int case. */
- if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
- return pointer_int_sum (PLUS_EXPR, op0, op1);
- else if (code1 == POINTER_TYPE && code0 == INTEGER_TYPE)
- return pointer_int_sum (PLUS_EXPR, op1, op0);
- else
- common = 1;
- break;
-
- case MINUS_EXPR:
- /* Subtraction of two similar pointers.
- We must subtract them as integers, then divide by object size. */
- if (code0 == POINTER_TYPE && code1 == POINTER_TYPE
- && comp_target_types (type0, type1))
- return pointer_diff (op0, op1);
- /* Handle pointer minus int. Just like pointer plus int. */
- else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
- return pointer_int_sum (MINUS_EXPR, op0, op1);
- else
- common = 1;
- break;
-
- case MULT_EXPR:
- common = 1;
- break;
-
- case TRUNC_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case EXACT_DIV_EXPR:
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE
- || code0 == COMPLEX_TYPE)
- && (code1 == INTEGER_TYPE || code1 == REAL_TYPE
- || code1 == COMPLEX_TYPE))
- {
- if (!(code0 == INTEGER_TYPE && code1 == INTEGER_TYPE))
- resultcode = RDIV_EXPR;
- else
- {
- /* Although it would be tempting to shorten always here, that
- loses on some targets, since the modulo instruction is
- undefined if the quotient can't be represented in the
- computation mode. We shorten only if unsigned or if
- dividing by something we know != -1. */
- shorten = (TREE_UNSIGNED (TREE_TYPE (orig_op0))
- || (TREE_CODE (op1) == INTEGER_CST
- && (TREE_INT_CST_LOW (op1) != -1
- || TREE_INT_CST_HIGH (op1) != -1)));
- }
- common = 1;
- }
- break;
-
- case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- shorten = -1;
- /* If one operand is a constant, and the other is a short type
- that has been converted to an int,
- really do the work in the short type and then convert the
- result to int. If we are lucky, the constant will be 0 or 1
- in the short type, making the entire operation go away. */
- if (TREE_CODE (op0) == INTEGER_CST
- && TREE_CODE (op1) == NOP_EXPR
- && TYPE_PRECISION (type1) > TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0)))
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op1, 0))))
- {
- final_type = result_type;
- op1 = TREE_OPERAND (op1, 0);
- result_type = TREE_TYPE (op1);
- }
- if (TREE_CODE (op1) == INTEGER_CST
- && TREE_CODE (op0) == NOP_EXPR
- && TYPE_PRECISION (type0) > TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0)))
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
- {
- final_type = result_type;
- op0 = TREE_OPERAND (op0, 0);
- result_type = TREE_TYPE (op0);
- }
- break;
-
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- {
- /* Although it would be tempting to shorten always here, that loses
- on some targets, since the modulo instruction is undefined if the
- quotient can't be represented in the computation mode. We shorten
- only if unsigned or if dividing by something we know != -1. */
- shorten = (TREE_UNSIGNED (TREE_TYPE (orig_op0))
- || (TREE_CODE (op1) == INTEGER_CST
- && (TREE_INT_CST_LOW (op1) != -1
- || TREE_INT_CST_HIGH (op1) != -1)));
- common = 1;
- }
- break;
-
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case TRUTH_XOR_EXPR:
- if ((code0 == INTEGER_TYPE || code0 == POINTER_TYPE
- || code0 == REAL_TYPE || code0 == COMPLEX_TYPE)
- && (code1 == INTEGER_TYPE || code1 == POINTER_TYPE
- || code1 == REAL_TYPE || code1 == COMPLEX_TYPE))
- {
- /* Result of these operations is always an int,
- but that does not mean the operands should be
- converted to ints! */
- result_type = integer_type_node;
- op0 = truthvalue_conversion (op0);
- op1 = truthvalue_conversion (op1);
- converted = 1;
- }
- break;
-
- /* Shift operations: result has same type as first operand;
- always convert second operand to int.
- Also set SHORT_SHIFT if shifting rightward. */
-
- case RSHIFT_EXPR:
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- {
- if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0)
- {
- if (tree_int_cst_sgn (op1) < 0)
- warning ("right shift count is negative");
- else
- {
- if (TREE_INT_CST_LOW (op1) | TREE_INT_CST_HIGH (op1))
- short_shift = 1;
- if (TREE_INT_CST_HIGH (op1) != 0
- || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
- >= TYPE_PRECISION (type0)))
- warning ("right shift count >= width of type");
- }
- }
- /* Use the type of the value to be shifted.
- This is what most traditional C compilers do. */
- result_type = type0;
- /* Unless traditional, convert the shift-count to an integer,
- regardless of size of value being shifted. */
- if (! flag_traditional)
- {
- if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
- op1 = convert (integer_type_node, op1);
- /* Avoid converting op1 to result_type later. */
- converted = 1;
- }
- }
- break;
-
- case LSHIFT_EXPR:
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- {
- if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0)
- {
- if (tree_int_cst_sgn (op1) < 0)
- warning ("left shift count is negative");
- else if (TREE_INT_CST_HIGH (op1) != 0
- || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
- >= TYPE_PRECISION (type0)))
- warning ("left shift count >= width of type");
- }
- /* Use the type of the value to be shifted.
- This is what most traditional C compilers do. */
- result_type = type0;
- /* Unless traditional, convert the shift-count to an integer,
- regardless of size of value being shifted. */
- if (! flag_traditional)
- {
- if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
- op1 = convert (integer_type_node, op1);
- /* Avoid converting op1 to result_type later. */
- converted = 1;
- }
- }
- break;
-
- case RROTATE_EXPR:
- case LROTATE_EXPR:
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- {
- if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0)
- {
- if (tree_int_cst_sgn (op1) < 0)
- warning ("shift count is negative");
- else if (TREE_INT_CST_HIGH (op1) != 0
- || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
- >= TYPE_PRECISION (type0)))
- warning ("shift count >= width of type");
- }
- /* Use the type of the value to be shifted.
- This is what most traditional C compilers do. */
- result_type = type0;
- /* Unless traditional, convert the shift-count to an integer,
- regardless of size of value being shifted. */
- if (! flag_traditional)
- {
- if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
- op1 = convert (integer_type_node, op1);
- /* Avoid converting op1 to result_type later. */
- converted = 1;
- }
- }
- break;
-
- case EQ_EXPR:
- case NE_EXPR:
- /* Result of comparison is always int,
- but don't convert the args to int! */
- build_type = integer_type_node;
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE
- || code0 == COMPLEX_TYPE)
- && (code1 == INTEGER_TYPE || code1 == REAL_TYPE
- || code1 == COMPLEX_TYPE))
- short_compare = 1;
- else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- {
- register tree tt0 = TREE_TYPE (type0);
- register tree tt1 = TREE_TYPE (type1);
- /* Anything compares with void *. void * compares with anything.
- Otherwise, the targets must be compatible
- and both must be object or both incomplete. */
- if (comp_target_types (type0, type1))
- result_type = common_type (type0, type1);
- else if (TYPE_MAIN_VARIANT (tt0) == void_type_node)
- {
- /* op0 != orig_op0 detects the case of something
- whose value is 0 but which isn't a valid null ptr const. */
- if (pedantic && (!integer_zerop (op0) || op0 != orig_op0)
- && TREE_CODE (tt1) == FUNCTION_TYPE)
- pedwarn ("ANSI C forbids comparison of `void *' with function pointer");
- }
- else if (TYPE_MAIN_VARIANT (tt1) == void_type_node)
- {
- if (pedantic && (!integer_zerop (op1) || op1 != orig_op1)
- && TREE_CODE (tt0) == FUNCTION_TYPE)
- pedwarn ("ANSI C forbids comparison of `void *' with function pointer");
- }
- else
- pedwarn ("comparison of distinct pointer types lacks a cast");
-
- if (result_type == NULL_TREE)
- result_type = ptr_type_node;
- }
- else if (code0 == POINTER_TYPE && TREE_CODE (op1) == INTEGER_CST
- && integer_zerop (op1))
- result_type = type0;
- else if (code1 == POINTER_TYPE && TREE_CODE (op0) == INTEGER_CST
- && integer_zerop (op0))
- result_type = type1;
- else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
- {
- result_type = type0;
- if (! flag_traditional)
- pedwarn ("comparison between pointer and integer");
- }
- else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
- {
- result_type = type1;
- if (! flag_traditional)
- pedwarn ("comparison between pointer and integer");
- }
- break;
-
- case MAX_EXPR:
- case MIN_EXPR:
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
- && (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
- shorten = 1;
- else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- {
- if (comp_target_types (type0, type1))
- {
- result_type = common_type (type0, type1);
- if (pedantic
- && TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE)
- pedwarn ("ANSI C forbids ordered comparisons of pointers to functions");
- }
- else
- {
- result_type = ptr_type_node;
- pedwarn ("comparison of distinct pointer types lacks a cast");
- }
- }
- break;
-
- case LE_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case GT_EXPR:
- build_type = integer_type_node;
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
- && (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
- short_compare = 1;
- else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- {
- if (comp_target_types (type0, type1))
- {
- result_type = common_type (type0, type1);
- if ((TYPE_SIZE (TREE_TYPE (type0)) != 0)
- != (TYPE_SIZE (TREE_TYPE (type1)) != 0))
- pedwarn ("comparison of complete and incomplete pointers");
- else if (pedantic
- && TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE)
- pedwarn ("ANSI C forbids ordered comparisons of pointers to functions");
- }
- else
- {
- result_type = ptr_type_node;
- pedwarn ("comparison of distinct pointer types lacks a cast");
- }
- }
- else if (code0 == POINTER_TYPE && TREE_CODE (op1) == INTEGER_CST
- && integer_zerop (op1))
- {
- result_type = type0;
- if (pedantic || extra_warnings)
- pedwarn ("ordered comparison of pointer with integer zero");
- }
- else if (code1 == POINTER_TYPE && TREE_CODE (op0) == INTEGER_CST
- && integer_zerop (op0))
- {
- result_type = type1;
- if (pedantic)
- pedwarn ("ordered comparison of pointer with integer zero");
- }
- else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
- {
- result_type = type0;
- if (! flag_traditional)
- pedwarn ("comparison between pointer and integer");
- }
- else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
- {
- result_type = type1;
- if (! flag_traditional)
- pedwarn ("comparison between pointer and integer");
- }
- break;
- }
-
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE)
- &&
- (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE))
- {
- int none_complex = (code0 != COMPLEX_TYPE && code1 != COMPLEX_TYPE);
-
- if (shorten || common || short_compare)
- result_type = common_type (type0, type1);
-
- /* For certain operations (which identify themselves by shorten != 0)
- if both args were extended from the same smaller type,
- do the arithmetic in that type and then extend.
-
- shorten !=0 and !=1 indicates a bitwise operation.
- For them, this optimization is safe only if
- both args are zero-extended or both are sign-extended.
- Otherwise, we might change the result.
- Eg, (short)-1 | (unsigned short)-1 is (int)-1
- but calculated in (unsigned short) it would be (unsigned short)-1. */
-
- if (shorten && none_complex)
- {
- int unsigned0, unsigned1;
- tree arg0 = get_narrower (op0, &unsigned0);
- tree arg1 = get_narrower (op1, &unsigned1);
- /* UNS is 1 if the operation to be done is an unsigned one. */
- int uns = TREE_UNSIGNED (result_type);
- tree type;
-
- final_type = result_type;
-
- /* Handle the case that OP0 (or OP1) does not *contain* a conversion
- but it *requires* conversion to FINAL_TYPE. */
-
- if ((TYPE_PRECISION (TREE_TYPE (op0))
- == TYPE_PRECISION (TREE_TYPE (arg0)))
- && TREE_TYPE (op0) != final_type)
- unsigned0 = TREE_UNSIGNED (TREE_TYPE (op0));
- if ((TYPE_PRECISION (TREE_TYPE (op1))
- == TYPE_PRECISION (TREE_TYPE (arg1)))
- && TREE_TYPE (op1) != final_type)
- unsigned1 = TREE_UNSIGNED (TREE_TYPE (op1));
-
- /* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */
-
- /* For bitwise operations, signedness of nominal type
- does not matter. Consider only how operands were extended. */
- if (shorten == -1)
- uns = unsigned0;
-
- /* Note that in all three cases below we refrain from optimizing
- an unsigned operation on sign-extended args.
- That would not be valid. */
-
- /* Both args variable: if both extended in same way
- from same width, do it in that width.
- Do it unsigned if args were zero-extended. */
- if ((TYPE_PRECISION (TREE_TYPE (arg0))
- < TYPE_PRECISION (result_type))
- && (TYPE_PRECISION (TREE_TYPE (arg1))
- == TYPE_PRECISION (TREE_TYPE (arg0)))
- && unsigned0 == unsigned1
- && (unsigned0 || !uns))
- result_type
- = signed_or_unsigned_type (unsigned0,
- common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
- else if (TREE_CODE (arg0) == INTEGER_CST
- && (unsigned1 || !uns)
- && (TYPE_PRECISION (TREE_TYPE (arg1))
- < TYPE_PRECISION (result_type))
- && (type = signed_or_unsigned_type (unsigned1,
- TREE_TYPE (arg1)),
- int_fits_type_p (arg0, type)))
- result_type = type;
- else if (TREE_CODE (arg1) == INTEGER_CST
- && (unsigned0 || !uns)
- && (TYPE_PRECISION (TREE_TYPE (arg0))
- < TYPE_PRECISION (result_type))
- && (type = signed_or_unsigned_type (unsigned0,
- TREE_TYPE (arg0)),
- int_fits_type_p (arg1, type)))
- result_type = type;
- }
-
- /* Shifts can be shortened if shifting right. */
-
- if (short_shift)
- {
- int unsigned_arg;
- tree arg0 = get_narrower (op0, &unsigned_arg);
-
- final_type = result_type;
-
- if (arg0 == op0 && final_type == TREE_TYPE (op0))
- unsigned_arg = TREE_UNSIGNED (TREE_TYPE (op0));
-
- if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)
- /* We can shorten only if the shift count is less than the
- number of bits in the smaller type size. */
- && TREE_INT_CST_HIGH (op1) == 0
- && TYPE_PRECISION (TREE_TYPE (arg0)) > TREE_INT_CST_LOW (op1)
- /* If arg is sign-extended and then unsigned-shifted,
- we can simulate this with a signed shift in arg's type
- only if the extended result is at least twice as wide
- as the arg. Otherwise, the shift could use up all the
- ones made by sign-extension and bring in zeros.
- We can't optimize that case at all, but in most machines
- it never happens because available widths are 2**N. */
- && (!TREE_UNSIGNED (final_type)
- || unsigned_arg
- || 2 * TYPE_PRECISION (TREE_TYPE (arg0)) <= TYPE_PRECISION (result_type)))
- {
- /* Do an unsigned shift if the operand was zero-extended. */
- result_type
- = signed_or_unsigned_type (unsigned_arg,
- TREE_TYPE (arg0));
- /* Convert value-to-be-shifted to that type. */
- if (TREE_TYPE (op0) != result_type)
- op0 = convert (result_type, op0);
- converted = 1;
- }
- }
-
- /* Comparison operations are shortened too but differently.
- They identify themselves by setting short_compare = 1. */
-
- if (short_compare)
- {
- /* Don't write &op0, etc., because that would prevent op0
- from being kept in a register.
- Instead, make copies of the our local variables and
- pass the copies by reference, then copy them back afterward. */
- tree xop0 = op0, xop1 = op1, xresult_type = result_type;
- enum tree_code xresultcode = resultcode;
- tree val
- = shorten_compare (&xop0, &xop1, &xresult_type, &xresultcode);
- if (val != 0)
- return val;
- op0 = xop0, op1 = xop1;
- converted = 1;
- resultcode = xresultcode;
-
- if (warn_sign_compare && skip_evaluation == 0)
- {
- int op0_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op0));
- int op1_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op1));
-
- int unsignedp0, unsignedp1;
- tree primop0 = get_narrower (op0, &unsignedp0);
- tree primop1 = get_narrower (op1, &unsignedp1);
-
- /* Avoid spurious warnings for comparison with enumerators. */
-
- xop0 = orig_op0;
- xop1 = orig_op1;
- STRIP_TYPE_NOPS (xop0);
- STRIP_TYPE_NOPS (xop1);
-
- /* Give warnings for comparisons between signed and unsigned
- quantities that may fail. */
- /* Do the checking based on the original operand trees, so that
- casts will be considered, but default promotions won't be. */
-
- /* Do not warn if the comparison is being done in a signed type,
- since the signed type will only be chosen if it can represent
- all the values of the unsigned type. */
- if (! TREE_UNSIGNED (result_type))
- /* OK */;
- /* Do not warn if both operands are unsigned. */
- else if (op0_signed == op1_signed)
- /* OK */;
- /* Do not warn if the signed quantity is an unsuffixed
- integer literal (or some static constant expression
- involving such literals) and it is non-negative. */
- else if ((op0_signed && TREE_CODE (xop0) == INTEGER_CST
- && tree_int_cst_sgn (xop0) >= 0)
- || (op1_signed && TREE_CODE (xop1) == INTEGER_CST
- && tree_int_cst_sgn (xop1) >= 0))
- /* OK */;
- /* Do not warn if the comparison is an equality operation,
- the unsigned quantity is an integral constant and it does
- not use the most significant bit of result_type. */
- else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
- && ((op0_signed && TREE_CODE (xop1) == INTEGER_CST
- && int_fits_type_p (xop1, signed_type (result_type)))
- || (op1_signed && TREE_CODE (xop0) == INTEGER_CST
- && int_fits_type_p (xop0, signed_type (result_type)))))
- /* OK */;
- else
- warning ("comparison between signed and unsigned");
-
- /* Warn if two unsigned values are being compared in a size
- larger than their original size, and one (and only one) is the
- result of a `~' operator. This comparison will always fail.
-
- Also warn if one operand is a constant, and the constant
- does not have all bits set that are set in the ~ operand
- when it is extended. */
-
- if ((TREE_CODE (primop0) == BIT_NOT_EXPR)
- != (TREE_CODE (primop1) == BIT_NOT_EXPR))
- {
- if (TREE_CODE (primop0) == BIT_NOT_EXPR)
- primop0 = get_narrower (TREE_OPERAND (primop0, 0),
- &unsignedp0);
- else
- primop1 = get_narrower (TREE_OPERAND (primop1, 0),
- &unsignedp1);
-
- if (TREE_CODE (primop0) == INTEGER_CST
- || TREE_CODE (primop1) == INTEGER_CST)
- {
- tree primop;
- long constant, mask;
- int unsignedp, bits;
-
- if (TREE_CODE (primop0) == INTEGER_CST)
- {
- primop = primop1;
- unsignedp = unsignedp1;
- constant = TREE_INT_CST_LOW (primop0);
- }
- else
- {
- primop = primop0;
- unsignedp = unsignedp0;
- constant = TREE_INT_CST_LOW (primop1);
- }
-
- bits = TYPE_PRECISION (TREE_TYPE (primop));
- if (bits < TYPE_PRECISION (result_type)
- && bits < HOST_BITS_PER_LONG && unsignedp)
- {
- mask = (~0L) << bits;
- if ((mask & constant) != mask)
- warning ("comparison of promoted ~unsigned with constant");
- }
- }
- else if (unsignedp0 && unsignedp1
- && (TYPE_PRECISION (TREE_TYPE (primop0))
- < TYPE_PRECISION (result_type))
- && (TYPE_PRECISION (TREE_TYPE (primop1))
- < TYPE_PRECISION (result_type)))
- warning ("comparison of promoted ~unsigned with unsigned");
- }
- }
- }
- }
-
- /* At this point, RESULT_TYPE must be nonzero to avoid an error message.
- If CONVERTED is zero, both args will be converted to type RESULT_TYPE.
- Then the expression will be built.
- It will be given type FINAL_TYPE if that is nonzero;
- otherwise, it will be given type RESULT_TYPE. */
-
- if (!result_type)
- {
- binary_op_error (code);
- return error_mark_node;
- }
-
- if (! converted)
- {
- if (TREE_TYPE (op0) != result_type)
- op0 = convert (result_type, op0);
- if (TREE_TYPE (op1) != result_type)
- op1 = convert (result_type, op1);
- }
-
- if (build_type == NULL_TREE)
- build_type = result_type;
-
- {
- register tree result = build (resultcode, build_type, op0, op1);
- register tree folded;
-
- folded = fold (result);
- if (folded == result)
- TREE_CONSTANT (folded) = TREE_CONSTANT (op0) & TREE_CONSTANT (op1);
- if (final_type != 0)
- return convert (final_type, folded);
- return folded;
- }
-}
-
-/* Return a tree for the sum or difference (RESULTCODE says which)
- of pointer PTROP and integer INTOP. */
-
-static tree
-pointer_int_sum (resultcode, ptrop, intop)
- enum tree_code resultcode;
- register tree ptrop, intop;
-{
- tree size_exp;
-
- register tree result;
- register tree folded;
-
- /* The result is a pointer of the same type that is being added. */
-
- register tree result_type = TREE_TYPE (ptrop);
-
- if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("pointer of type `void *' used in arithmetic");
- size_exp = integer_one_node;
- }
- else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("pointer to a function used in arithmetic");
- size_exp = integer_one_node;
- }
- else
- size_exp = c_size_in_bytes (TREE_TYPE (result_type));
-
- /* If what we are about to multiply by the size of the elements
- contains a constant term, apply distributive law
- and multiply that constant term separately.
- This helps produce common subexpressions. */
-
- if ((TREE_CODE (intop) == PLUS_EXPR || TREE_CODE (intop) == MINUS_EXPR)
- && ! TREE_CONSTANT (intop)
- && TREE_CONSTANT (TREE_OPERAND (intop, 1))
- && TREE_CONSTANT (size_exp)
- /* If the constant comes from pointer subtraction,
- skip this optimization--it would cause an error. */
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (intop, 0))) == INTEGER_TYPE
- /* If the constant is unsigned, and smaller than the pointer size,
- then we must skip this optimization. This is because it could cause
- an overflow error if the constant is negative but INTOP is not. */
- && (! TREE_UNSIGNED (TREE_TYPE (intop))
- || (TYPE_PRECISION (TREE_TYPE (intop))
- == TYPE_PRECISION (TREE_TYPE (ptrop)))))
- {
- enum tree_code subcode = resultcode;
- tree int_type = TREE_TYPE (intop);
- if (TREE_CODE (intop) == MINUS_EXPR)
- subcode = (subcode == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR);
- /* Convert both subexpression types to the type of intop,
- because weird cases involving pointer arithmetic
- can result in a sum or difference with different type args. */
- ptrop = build_binary_op (subcode, ptrop,
- convert (int_type, TREE_OPERAND (intop, 1)), 1);
- intop = convert (int_type, TREE_OPERAND (intop, 0));
- }
-
- /* Convert the integer argument to a type the same size as sizetype
- so the multiply won't overflow spuriously. */
-
- if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype)
- || TREE_UNSIGNED (TREE_TYPE (intop)) != TREE_UNSIGNED (sizetype))
- intop = convert (type_for_size (TYPE_PRECISION (sizetype),
- TREE_UNSIGNED (sizetype)), intop);
-
- /* Replace the integer argument with a suitable product by the object size.
- Do this multiplication as signed, then convert to the appropriate
- pointer type (actually unsigned integral). */
-
- intop = convert (result_type,
- build_binary_op (MULT_EXPR, intop,
- convert (TREE_TYPE (intop), size_exp), 1));
-
- /* Create the sum or difference. */
-
- result = build (resultcode, result_type, ptrop, intop);
-
- folded = fold (result);
- if (folded == result)
- TREE_CONSTANT (folded) = TREE_CONSTANT (ptrop) & TREE_CONSTANT (intop);
- return folded;
-}
-
-/* Return a tree for the difference of pointers OP0 and OP1.
- The resulting tree has type int. */
-
-static tree
-pointer_diff (op0, op1)
- register tree op0, op1;
-{
- register tree result, folded;
- tree restype = ptrdiff_type_node;
-
- tree target_type = TREE_TYPE (TREE_TYPE (op0));
-
- if (pedantic || warn_pointer_arith)
- {
- if (TREE_CODE (target_type) == VOID_TYPE)
- pedwarn ("pointer of type `void *' used in subtraction");
- if (TREE_CODE (target_type) == FUNCTION_TYPE)
- pedwarn ("pointer to a function used in subtraction");
- }
-
- /* First do the subtraction as integers;
- then drop through to build the divide operator.
- Do not do default conversions on the minus operator
- in case restype is a short type. */
-
- op0 = build_binary_op (MINUS_EXPR, convert (restype, op0),
- convert (restype, op1), 0);
- /* This generates an error if op1 is pointer to incomplete type. */
- if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (op1))) == 0)
- error ("arithmetic on pointer to an incomplete type");
-
- /* This generates an error if op0 is pointer to incomplete type. */
- op1 = c_size_in_bytes (target_type);
-
- /* Divide by the size, in easiest possible way. */
-
- result = build (EXACT_DIV_EXPR, restype, op0, convert (restype, op1));
-
- folded = fold (result);
- if (folded == result)
- TREE_CONSTANT (folded) = TREE_CONSTANT (op0) & TREE_CONSTANT (op1);
- return folded;
-}
-
-/* Construct and perhaps optimize a tree representation
- for a unary operation. CODE, a tree_code, specifies the operation
- and XARG is the operand. NOCONVERT nonzero suppresses
- the default promotions (such as from short to int). */
-
-tree
-build_unary_op (code, xarg, noconvert)
- enum tree_code code;
- tree xarg;
- int noconvert;
-{
- /* No default_conversion here. It causes trouble for ADDR_EXPR. */
- register tree arg = xarg;
- register tree argtype = 0;
- register enum tree_code typecode = TREE_CODE (TREE_TYPE (arg));
- char *errstring = NULL;
- tree val;
-
- if (typecode == ERROR_MARK)
- return error_mark_node;
- if (typecode == ENUMERAL_TYPE)
- typecode = INTEGER_TYPE;
-
- switch (code)
- {
- case CONVERT_EXPR:
- /* This is used for unary plus, because a CONVERT_EXPR
- is enough to prevent anybody from looking inside for
- associativity, but won't generate any code. */
- if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE
- || typecode == COMPLEX_TYPE))
- errstring = "wrong type argument to unary plus";
- else if (!noconvert)
- arg = default_conversion (arg);
- break;
-
- case NEGATE_EXPR:
- if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE
- || typecode == COMPLEX_TYPE))
- errstring = "wrong type argument to unary minus";
- else if (!noconvert)
- arg = default_conversion (arg);
- break;
-
- case BIT_NOT_EXPR:
- if (typecode == COMPLEX_TYPE)
- {
- code = CONJ_EXPR;
- if (!noconvert)
- arg = default_conversion (arg);
- }
- else if (typecode != INTEGER_TYPE)
- errstring = "wrong type argument to bit-complement";
- else if (!noconvert)
- arg = default_conversion (arg);
- break;
-
- case ABS_EXPR:
- if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE
- || typecode == COMPLEX_TYPE))
- errstring = "wrong type argument to abs";
- else if (!noconvert)
- arg = default_conversion (arg);
- break;
-
- case CONJ_EXPR:
- /* Conjugating a real value is a no-op, but allow it anyway. */
- if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE
- || typecode == COMPLEX_TYPE))
- errstring = "wrong type argument to conjugation";
- else if (!noconvert)
- arg = default_conversion (arg);
- break;
-
- case TRUTH_NOT_EXPR:
- if (typecode != INTEGER_TYPE
- && typecode != REAL_TYPE && typecode != POINTER_TYPE
- && typecode != COMPLEX_TYPE
- /* These will convert to a pointer. */
- && typecode != ARRAY_TYPE && typecode != FUNCTION_TYPE)
- {
- errstring = "wrong type argument to unary exclamation mark";
- break;
- }
- arg = truthvalue_conversion (arg);
- return invert_truthvalue (arg);
-
- case NOP_EXPR:
- break;
-
- case REALPART_EXPR:
- if (TREE_CODE (arg) == COMPLEX_CST)
- return TREE_REALPART (arg);
- else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE)
- return fold (build1 (REALPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg));
- else
- return arg;
-
- case IMAGPART_EXPR:
- if (TREE_CODE (arg) == COMPLEX_CST)
- return TREE_IMAGPART (arg);
- else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE)
- return fold (build1 (IMAGPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg));
- else
- return convert (TREE_TYPE (arg), integer_zero_node);
-
- case PREINCREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- /* Handle complex lvalues (when permitted)
- by reduction to simpler cases. */
-
- val = unary_complex_lvalue (code, arg);
- if (val != 0)
- return val;
-
- /* Increment or decrement the real part of the value,
- and don't change the imaginary part. */
- if (typecode == COMPLEX_TYPE)
- {
- tree real, imag;
-
- arg = stabilize_reference (arg);
- real = build_unary_op (REALPART_EXPR, arg, 1);
- imag = build_unary_op (IMAGPART_EXPR, arg, 1);
- return build (COMPLEX_EXPR, TREE_TYPE (arg),
- build_unary_op (code, real, 1), imag);
- }
-
- /* Report invalid types. */
-
- if (typecode != POINTER_TYPE
- && typecode != INTEGER_TYPE && typecode != REAL_TYPE)
- {
- if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
- errstring ="wrong type argument to increment";
- else
- errstring ="wrong type argument to decrement";
- break;
- }
-
- {
- register tree inc;
- tree result_type = TREE_TYPE (arg);
-
- arg = get_unwidened (arg, 0);
- argtype = TREE_TYPE (arg);
-
- /* Compute the increment. */
-
- if (typecode == POINTER_TYPE)
- {
- /* If pointer target is an undefined struct,
- we just cannot know how to do the arithmetic. */
- if (TYPE_SIZE (TREE_TYPE (result_type)) == 0)
- error ("%s of pointer to unknown structure",
- ((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? "increment" : "decrement"));
- else if ((pedantic || warn_pointer_arith)
- && (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE))
- pedwarn ("wrong type argument to %s",
- ((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? "increment" : "decrement"));
- inc = c_size_in_bytes (TREE_TYPE (result_type));
- }
- else
- inc = integer_one_node;
-
- inc = convert (argtype, inc);
-
- /* Handle incrementing a cast-expression. */
-
- while (1)
- switch (TREE_CODE (arg))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- pedantic_lvalue_warning (CONVERT_EXPR);
- /* If the real type has the same machine representation
- as the type it is cast to, we can make better output
- by adding directly to the inside of the cast. */
- if ((TREE_CODE (TREE_TYPE (arg))
- == TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))))
- && (TYPE_MODE (TREE_TYPE (arg))
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (arg, 0)))))
- arg = TREE_OPERAND (arg, 0);
- else
- {
- tree incremented, modify, value;
- arg = stabilize_reference (arg);
- if (code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR)
- value = arg;
- else
- value = save_expr (arg);
- incremented = build (((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? PLUS_EXPR : MINUS_EXPR),
- argtype, value, inc);
- TREE_SIDE_EFFECTS (incremented) = 1;
- modify = build_modify_expr (arg, NOP_EXPR, incremented);
- value = build (COMPOUND_EXPR, TREE_TYPE (arg), modify, value);
- TREE_USED (value) = 1;
- return value;
- }
- break;
-
- default:
- goto give_up;
- }
- give_up:
-
- /* Complain about anything else that is not a true lvalue. */
- if (!lvalue_or_else (arg, ((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? "increment" : "decrement")))
- return error_mark_node;
-
- /* Report a read-only lvalue. */
- if (TREE_READONLY (arg))
- readonly_warning (arg,
- ((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? "increment" : "decrement"));
-
- val = build (code, TREE_TYPE (arg), arg, inc);
- TREE_SIDE_EFFECTS (val) = 1;
- val = convert (result_type, val);
- if (TREE_CODE (val) != code)
- TREE_NO_UNUSED_WARNING (val) = 1;
- return val;
- }
-
- case ADDR_EXPR:
- /* Note that this operation never does default_conversion
- regardless of NOCONVERT. */
-
- /* Let &* cancel out to simplify resulting code. */
- if (TREE_CODE (arg) == INDIRECT_REF)
- {
- /* Don't let this be an lvalue. */
- if (lvalue_p (TREE_OPERAND (arg, 0)))
- return non_lvalue (TREE_OPERAND (arg, 0));
- return TREE_OPERAND (arg, 0);
- }
-
- /* For &x[y], return x+y */
- if (TREE_CODE (arg) == ARRAY_REF)
- {
- if (mark_addressable (TREE_OPERAND (arg, 0)) == 0)
- return error_mark_node;
- return build_binary_op (PLUS_EXPR, TREE_OPERAND (arg, 0),
- TREE_OPERAND (arg, 1), 1);
- }
-
- /* Handle complex lvalues (when permitted)
- by reduction to simpler cases. */
- val = unary_complex_lvalue (code, arg);
- if (val != 0)
- return val;
-
-#if 0 /* Turned off because inconsistent;
- float f; *&(int)f = 3.4 stores in int format
- whereas (int)f = 3.4 stores in float format. */
- /* Address of a cast is just a cast of the address
- of the operand of the cast. */
- switch (TREE_CODE (arg))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- if (pedantic)
- pedwarn ("ANSI C forbids the address of a cast expression");
- return convert (build_pointer_type (TREE_TYPE (arg)),
- build_unary_op (ADDR_EXPR, TREE_OPERAND (arg, 0),
- 0));
- }
-#endif
-
- /* Allow the address of a constructor if all the elements
- are constant. */
- if (TREE_CODE (arg) == CONSTRUCTOR && TREE_CONSTANT (arg))
- ;
- /* Anything not already handled and not a true memory reference
- is an error. */
- else if (typecode != FUNCTION_TYPE && !lvalue_or_else (arg, "unary `&'"))
- return error_mark_node;
-
- /* Ordinary case; arg is a COMPONENT_REF or a decl. */
- argtype = TREE_TYPE (arg);
- /* If the lvalue is const or volatile,
- merge that into the type that the address will point to. */
- if (TREE_CODE_CLASS (TREE_CODE (arg)) == 'd'
- || TREE_CODE_CLASS (TREE_CODE (arg)) == 'r')
- {
- if (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg))
- argtype = c_build_type_variant (argtype,
- TREE_READONLY (arg),
- TREE_THIS_VOLATILE (arg));
- }
-
- argtype = build_pointer_type (argtype);
-
- if (mark_addressable (arg) == 0)
- return error_mark_node;
-
- {
- tree addr;
-
- if (TREE_CODE (arg) == COMPONENT_REF)
- {
- tree field = TREE_OPERAND (arg, 1);
-
- addr = build_unary_op (ADDR_EXPR, TREE_OPERAND (arg, 0), 0);
-
- if (DECL_C_BIT_FIELD (field))
- {
- error ("attempt to take address of bit-field structure member `%s'",
- IDENTIFIER_POINTER (DECL_NAME (field)));
- return error_mark_node;
- }
-
- addr = convert (argtype, addr);
-
- if (! integer_zerop (DECL_FIELD_BITPOS (field)))
- {
- tree offset
- = size_binop (EASY_DIV_EXPR, DECL_FIELD_BITPOS (field),
- size_int (BITS_PER_UNIT));
- int flag = TREE_CONSTANT (addr);
- addr = fold (build (PLUS_EXPR, argtype,
- addr, convert (argtype, offset)));
- TREE_CONSTANT (addr) = flag;
- }
- }
- else
- addr = build1 (code, argtype, arg);
-
- /* Address of a static or external variable or
- file-scope function counts as a constant. */
- if (staticp (arg)
- && ! (TREE_CODE (arg) == FUNCTION_DECL
- && DECL_CONTEXT (arg) != 0))
- TREE_CONSTANT (addr) = 1;
- return addr;
- }
- }
-
- if (!errstring)
- {
- if (argtype == 0)
- argtype = TREE_TYPE (arg);
- return fold (build1 (code, argtype, arg));
- }
-
- error (errstring);
- return error_mark_node;
-}
-
-#if 0
-/* If CONVERSIONS is a conversion expression or a nested sequence of such,
- convert ARG with the same conversions in the same order
- and return the result. */
-
-static tree
-convert_sequence (conversions, arg)
- tree conversions;
- tree arg;
-{
- switch (TREE_CODE (conversions))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- return convert (TREE_TYPE (conversions),
- convert_sequence (TREE_OPERAND (conversions, 0),
- arg));
-
- default:
- return arg;
- }
-}
-#endif /* 0 */
-
-/* Return nonzero if REF is an lvalue valid for this language.
- Lvalues can be assigned, unless their type has TYPE_READONLY.
- Lvalues can have their address taken, unless they have DECL_REGISTER. */
-
-int
-lvalue_p (ref)
- tree ref;
-{
- register enum tree_code code = TREE_CODE (ref);
-
- switch (code)
- {
- case REALPART_EXPR:
- case IMAGPART_EXPR:
- case COMPONENT_REF:
- return lvalue_p (TREE_OPERAND (ref, 0));
-
- case STRING_CST:
- return 1;
-
- case INDIRECT_REF:
- case ARRAY_REF:
- case VAR_DECL:
- case PARM_DECL:
- case RESULT_DECL:
- case ERROR_MARK:
- if (TREE_CODE (TREE_TYPE (ref)) != FUNCTION_TYPE
- && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
- return 1;
- break;
- }
- return 0;
-}
-
-/* Return nonzero if REF is an lvalue valid for this language;
- otherwise, print an error message and return zero. */
-
-int
-lvalue_or_else (ref, string)
- tree ref;
- char *string;
-{
- int win = lvalue_p (ref);
- if (! win)
- error ("invalid lvalue in %s", string);
- return win;
-}
-
-/* Apply unary lvalue-demanding operator CODE to the expression ARG
- for certain kinds of expressions which are not really lvalues
- but which we can accept as lvalues.
-
- If ARG is not a kind of expression we can handle, return zero. */
-
-static tree
-unary_complex_lvalue (code, arg)
- enum tree_code code;
- tree arg;
-{
- /* Handle (a, b) used as an "lvalue". */
- if (TREE_CODE (arg) == COMPOUND_EXPR)
- {
- tree real_result = build_unary_op (code, TREE_OPERAND (arg, 1), 0);
- pedantic_lvalue_warning (COMPOUND_EXPR);
- return build (COMPOUND_EXPR, TREE_TYPE (real_result),
- TREE_OPERAND (arg, 0), real_result);
- }
-
- /* Handle (a ? b : c) used as an "lvalue". */
- if (TREE_CODE (arg) == COND_EXPR)
- {
- pedantic_lvalue_warning (COND_EXPR);
- return (build_conditional_expr
- (TREE_OPERAND (arg, 0),
- build_unary_op (code, TREE_OPERAND (arg, 1), 0),
- build_unary_op (code, TREE_OPERAND (arg, 2), 0)));
- }
-
- return 0;
-}
-
-/* If pedantic, warn about improper lvalue. CODE is either COND_EXPR
- COMPOUND_EXPR, or CONVERT_EXPR (for casts). */
-
-static void
-pedantic_lvalue_warning (code)
- enum tree_code code;
-{
- if (pedantic)
- pedwarn ("ANSI C forbids use of %s expressions as lvalues",
- code == COND_EXPR ? "conditional"
- : code == COMPOUND_EXPR ? "compound" : "cast");
-}
-
-/* Warn about storing in something that is `const'. */
-
-void
-readonly_warning (arg, string)
- tree arg;
- char *string;
-{
- char buf[80];
- strcpy (buf, string);
-
- /* Forbid assignments to iterators. */
- if (TREE_CODE (arg) == VAR_DECL && ITERATOR_P (arg))
- {
- strcat (buf, " of iterator `%s'");
- pedwarn (buf, IDENTIFIER_POINTER (DECL_NAME (arg)));
- }
-
- if (TREE_CODE (arg) == COMPONENT_REF)
- {
- if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
- readonly_warning (TREE_OPERAND (arg, 0), string);
- else
- {
- strcat (buf, " of read-only member `%s'");
- pedwarn (buf, IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (arg, 1))));
- }
- }
- else if (TREE_CODE (arg) == VAR_DECL)
- {
- strcat (buf, " of read-only variable `%s'");
- pedwarn (buf, IDENTIFIER_POINTER (DECL_NAME (arg)));
- }
- else
- {
- pedwarn ("%s of read-only location", buf);
- }
-}
-
-/* Mark EXP saying that we need to be able to take the
- address of it; it should not be allocated in a register.
- Value is 1 if successful. */
-
-int
-mark_addressable (exp)
- tree exp;
-{
- register tree x = exp;
- while (1)
- switch (TREE_CODE (x))
- {
- case COMPONENT_REF:
- if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1)))
- {
- error ("cannot take address of bitfield `%s'",
- IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (x, 1))));
- return 0;
- }
-
- /* ... fall through ... */
-
- case ADDR_EXPR:
- case ARRAY_REF:
- case REALPART_EXPR:
- case IMAGPART_EXPR:
- x = TREE_OPERAND (x, 0);
- break;
-
- case CONSTRUCTOR:
- TREE_ADDRESSABLE (x) = 1;
- return 1;
-
- case VAR_DECL:
- case CONST_DECL:
- case PARM_DECL:
- case RESULT_DECL:
- if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
- && DECL_NONLOCAL (x))
- {
- if (TREE_PUBLIC (x))
- {
- error ("global register variable `%s' used in nested function",
- IDENTIFIER_POINTER (DECL_NAME (x)));
- return 0;
- }
- pedwarn ("register variable `%s' used in nested function",
- IDENTIFIER_POINTER (DECL_NAME (x)));
- }
- else if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x))
- {
- if (TREE_PUBLIC (x))
- {
- error ("address of global register variable `%s' requested",
- IDENTIFIER_POINTER (DECL_NAME (x)));
- return 0;
- }
-
- /* If we are making this addressable due to its having
- volatile components, give a different error message. Also
- handle the case of an unnamed parameter by not trying
- to give the name. */
-
- else if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (x)))
- {
- error ("cannot put object with volatile field into register");
- return 0;
- }
-
- pedwarn ("address of register variable `%s' requested",
- IDENTIFIER_POINTER (DECL_NAME (x)));
- }
- put_var_into_stack (x);
-
- /* drops in */
- case FUNCTION_DECL:
- TREE_ADDRESSABLE (x) = 1;
-#if 0 /* poplevel deals with this now. */
- if (DECL_CONTEXT (x) == 0)
- TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (x)) = 1;
-#endif
-
- default:
- return 1;
- }
-}
-
-/* Build and return a conditional expression IFEXP ? OP1 : OP2. */
-
-tree
-build_conditional_expr (ifexp, op1, op2)
- tree ifexp, op1, op2;
-{
- register tree type1;
- register tree type2;
- register enum tree_code code1;
- register enum tree_code code2;
- register tree result_type = NULL;
- tree orig_op1 = op1, orig_op2 = op2;
-
- ifexp = truthvalue_conversion (default_conversion (ifexp));
-
-#if 0 /* Produces wrong result if within sizeof. */
- /* Don't promote the operands separately if they promote
- the same way. Return the unpromoted type and let the combined
- value get promoted if necessary. */
-
- if (TREE_TYPE (op1) == TREE_TYPE (op2)
- && TREE_CODE (TREE_TYPE (op1)) != ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (op1)) != ENUMERAL_TYPE
- && TREE_CODE (TREE_TYPE (op1)) != FUNCTION_TYPE)
- {
- if (TREE_CODE (ifexp) == INTEGER_CST)
- return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1);
-
- return fold (build (COND_EXPR, TREE_TYPE (op1), ifexp, op1, op2));
- }
-#endif
-
- /* Promote both alternatives. */
-
- if (TREE_CODE (TREE_TYPE (op1)) != VOID_TYPE)
- op1 = default_conversion (op1);
- if (TREE_CODE (TREE_TYPE (op2)) != VOID_TYPE)
- op2 = default_conversion (op2);
-
- if (TREE_CODE (ifexp) == ERROR_MARK
- || TREE_CODE (TREE_TYPE (op1)) == ERROR_MARK
- || TREE_CODE (TREE_TYPE (op2)) == ERROR_MARK)
- return error_mark_node;
-
- type1 = TREE_TYPE (op1);
- code1 = TREE_CODE (type1);
- type2 = TREE_TYPE (op2);
- code2 = TREE_CODE (type2);
-
- /* Quickly detect the usual case where op1 and op2 have the same type
- after promotion. */
- if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2))
- {
- if (type1 == type2)
- result_type = type1;
- else
- result_type = TYPE_MAIN_VARIANT (type1);
- }
- else if ((code1 == INTEGER_TYPE || code1 == REAL_TYPE)
- && (code2 == INTEGER_TYPE || code2 == REAL_TYPE))
- {
- result_type = common_type (type1, type2);
- }
- else if (code1 == VOID_TYPE || code2 == VOID_TYPE)
- {
- if (pedantic && (code1 != VOID_TYPE || code2 != VOID_TYPE))
- pedwarn ("ANSI C forbids conditional expr with only one void side");
- result_type = void_type_node;
- }
- else if (code1 == POINTER_TYPE && code2 == POINTER_TYPE)
- {
- if (comp_target_types (type1, type2))
- result_type = common_type (type1, type2);
- else if (integer_zerop (op1) && TREE_TYPE (type1) == void_type_node
- && TREE_CODE (orig_op1) != NOP_EXPR)
- result_type = qualify_type (type2, type1);
- else if (integer_zerop (op2) && TREE_TYPE (type2) == void_type_node
- && TREE_CODE (orig_op2) != NOP_EXPR)
- result_type = qualify_type (type1, type2);
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (type1)) == void_type_node)
- {
- if (pedantic && TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE)
- pedwarn ("ANSI C forbids conditional expr between `void *' and function pointer");
- result_type = qualify_type (type1, type2);
- }
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (type2)) == void_type_node)
- {
- if (pedantic && TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE)
- pedwarn ("ANSI C forbids conditional expr between `void *' and function pointer");
- result_type = qualify_type (type2, type1);
- }
- else
- {
- pedwarn ("pointer type mismatch in conditional expression");
- result_type = build_pointer_type (void_type_node);
- }
- }
- else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE)
- {
- if (! integer_zerop (op2))
- pedwarn ("pointer/integer type mismatch in conditional expression");
- else
- {
- op2 = null_pointer_node;
-#if 0 /* The spec seems to say this is permitted. */
- if (pedantic && TREE_CODE (type1) == FUNCTION_TYPE)
- pedwarn ("ANSI C forbids conditional expr between 0 and function pointer");
-#endif
- }
- result_type = type1;
- }
- else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE)
- {
- if (!integer_zerop (op1))
- pedwarn ("pointer/integer type mismatch in conditional expression");
- else
- {
- op1 = null_pointer_node;
-#if 0 /* The spec seems to say this is permitted. */
- if (pedantic && TREE_CODE (type2) == FUNCTION_TYPE)
- pedwarn ("ANSI C forbids conditional expr between 0 and function pointer");
-#endif
- }
- result_type = type2;
- }
-
- if (!result_type)
- {
- if (flag_cond_mismatch)
- result_type = void_type_node;
- else
- {
- error ("type mismatch in conditional expression");
- return error_mark_node;
- }
- }
-
- /* Merge const and volatile flags of the incoming types. */
- result_type
- = build_type_variant (result_type,
- TREE_READONLY (op1) || TREE_READONLY (op2),
- TREE_THIS_VOLATILE (op1) || TREE_THIS_VOLATILE (op2));
-
- if (result_type != TREE_TYPE (op1))
- op1 = convert_and_check (result_type, op1);
- if (result_type != TREE_TYPE (op2))
- op2 = convert_and_check (result_type, op2);
-
-#if 0
- if (code1 == RECORD_TYPE || code1 == UNION_TYPE)
- {
- result_type = TREE_TYPE (op1);
- if (TREE_CONSTANT (ifexp))
- return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1);
-
- if (TYPE_MODE (result_type) == BLKmode)
- {
- register tree tempvar
- = build_decl (VAR_DECL, NULL_TREE, result_type);
- register tree xop1 = build_modify_expr (tempvar, op1);
- register tree xop2 = build_modify_expr (tempvar, op2);
- register tree result = fold (build (COND_EXPR, result_type,
- ifexp, xop1, xop2));
-
- layout_decl (tempvar, TYPE_ALIGN (result_type));
- /* No way to handle variable-sized objects here.
- I fear that the entire handling of BLKmode conditional exprs
- needs to be redone. */
- if (TREE_CODE (DECL_SIZE (tempvar)) != INTEGER_CST)
- abort ();
- DECL_RTL (tempvar)
- = assign_stack_local (DECL_MODE (tempvar),
- (TREE_INT_CST_LOW (DECL_SIZE (tempvar))
- + BITS_PER_UNIT - 1)
- / BITS_PER_UNIT,
- 0);
-
- TREE_SIDE_EFFECTS (result)
- = TREE_SIDE_EFFECTS (ifexp) | TREE_SIDE_EFFECTS (op1)
- | TREE_SIDE_EFFECTS (op2);
- return build (COMPOUND_EXPR, result_type, result, tempvar);
- }
- }
-#endif /* 0 */
-
- if (TREE_CODE (ifexp) == INTEGER_CST)
- return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1);
-
- return fold (build (COND_EXPR, result_type, ifexp, op1, op2));
-}
-
-/* Given a list of expressions, return a compound expression
- that performs them all and returns the value of the last of them. */
-
-tree
-build_compound_expr (list)
- tree list;
-{
- return internal_build_compound_expr (list, TRUE);
-}
-
-static tree
-internal_build_compound_expr (list, first_p)
- tree list;
- int first_p;
-{
- register tree rest;
-
- if (TREE_CHAIN (list) == 0)
- {
-#if 0 /* If something inside inhibited lvalueness, we should not override. */
- /* Consider (x, y+0), which is not an lvalue since y+0 is not. */
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- if (TREE_CODE (list) == NON_LVALUE_EXPR)
- list = TREE_OPERAND (list, 0);
-#endif
-
- /* Don't let (0, 0) be null pointer constant. */
- if (!first_p && integer_zerop (TREE_VALUE (list)))
- return non_lvalue (TREE_VALUE (list));
- return TREE_VALUE (list);
- }
-
- if (TREE_CHAIN (list) != 0 && TREE_CHAIN (TREE_CHAIN (list)) == 0)
- {
- /* Convert arrays to pointers when there really is a comma operator. */
- if (TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (list)))) == ARRAY_TYPE)
- TREE_VALUE (TREE_CHAIN (list))
- = default_conversion (TREE_VALUE (TREE_CHAIN (list)));
- }
-
- rest = internal_build_compound_expr (TREE_CHAIN (list), FALSE);
-
- if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)))
- {
- /* The left-hand operand of a comma expression is like an expression
- statement: with -W or -Wunused, we should warn if it doesn't have
- any side-effects, unless it was explicitly cast to (void). */
- if ((extra_warnings || warn_unused)
- && ! (TREE_CODE (TREE_VALUE (list)) == CONVERT_EXPR
- && TREE_TYPE (TREE_VALUE (list)) == void_type_node))
- warning ("left-hand operand of comma expression has no effect");
-
- /* When pedantic, a compound expression can be neither an lvalue
- nor an integer constant expression. */
- if (! pedantic)
- return rest;
- }
-
- /* 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)
- warn_if_unused_value (TREE_VALUE (list));
-
- return build (COMPOUND_EXPR, TREE_TYPE (rest), TREE_VALUE (list), rest);
-}
-
-/* Build an expression representing a cast to type TYPE of expression EXPR. */
-
-tree
-build_c_cast (type, expr)
- register tree type;
- tree expr;
-{
- register tree value = expr;
-
- if (type == error_mark_node || expr == error_mark_node)
- return error_mark_node;
- type = TYPE_MAIN_VARIANT (type);
-
-#if 0
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- if (TREE_CODE (value) == NON_LVALUE_EXPR)
- value = TREE_OPERAND (value, 0);
-#endif
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- error ("cast specifies array type");
- return error_mark_node;
- }
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- error ("cast specifies function type");
- return error_mark_node;
- }
-
- if (type == TREE_TYPE (value))
- {
- if (pedantic)
- {
- if (TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE)
- pedwarn ("ANSI C forbids casting nonscalar to the same type");
- }
- }
- else if (TREE_CODE (type) == UNION_TYPE)
- {
- tree field;
- if (TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE)
- value = default_conversion (value);
-
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (field)),
- TYPE_MAIN_VARIANT (TREE_TYPE (value))))
- break;
-
- if (field)
- {
- char *name;
- tree t;
-
- if (pedantic)
- pedwarn ("ANSI C forbids casts to union type");
- if (TYPE_NAME (type) != 0)
- {
- if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- name = IDENTIFIER_POINTER (TYPE_NAME (type));
- else
- name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
- }
- else
- name = "";
- t = digest_init (type, build (CONSTRUCTOR, type, NULL_TREE,
- build_tree_list (field, value)),
- 0, 0);
- TREE_CONSTANT (t) = TREE_CONSTANT (value);
- return t;
- }
- error ("cast to union type from type not present in union");
- return error_mark_node;
- }
- else
- {
- tree otype, ovalue;
-
- /* If casting to void, avoid the error that would come
- from default_conversion in the case of a non-lvalue array. */
- if (type == void_type_node)
- return build1 (CONVERT_EXPR, type, value);
-
- /* Convert functions and arrays to pointers,
- but don't convert any other types. */
- if (TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE)
- value = default_conversion (value);
- otype = TREE_TYPE (value);
-
- /* Optionally warn about potentially worrisome casts. */
-
- if (warn_cast_qual
- && TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (otype) == POINTER_TYPE)
- {
- if (TYPE_VOLATILE (TREE_TYPE (otype))
- && ! TYPE_VOLATILE (TREE_TYPE (type)))
- pedwarn ("cast discards `volatile' from pointer target type");
- if (TYPE_READONLY (TREE_TYPE (otype))
- && ! TYPE_READONLY (TREE_TYPE (type)))
- pedwarn ("cast discards `const' from pointer target type");
- }
-
- /* Warn about possible alignment problems. */
- if (STRICT_ALIGNMENT && warn_cast_align
- && TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (otype) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE
- && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
- /* Don't warn about opaque types, where the actual alignment
- restriction is unknown. */
- && !((TREE_CODE (TREE_TYPE (otype)) == UNION_TYPE
- || TREE_CODE (TREE_TYPE (otype)) == RECORD_TYPE)
- && TYPE_MODE (TREE_TYPE (otype)) == VOIDmode)
- && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
- warning ("cast increases required alignment of target type");
-
- if (TREE_CODE (type) == INTEGER_TYPE
- && TREE_CODE (otype) == POINTER_TYPE
- && TYPE_PRECISION (type) != TYPE_PRECISION (otype)
- && !TREE_CONSTANT (value))
- warning ("cast from pointer to integer of different size");
-
- if (warn_bad_function_cast
- && TREE_CODE (value) == CALL_EXPR
- && TREE_CODE (type) != TREE_CODE (otype))
- warning ("cast does not match function type");
-
- if (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (otype) == INTEGER_TYPE
- && TYPE_PRECISION (type) != TYPE_PRECISION (otype)
-#if 0
- /* Don't warn about converting 0 to pointer,
- provided the 0 was explicit--not cast or made by folding. */
- && !(TREE_CODE (value) == INTEGER_CST && integer_zerop (value))
-#endif
- /* Don't warn about converting any constant. */
- && !TREE_CONSTANT (value))
- warning ("cast to pointer from integer of different size");
-
- ovalue = value;
- value = convert (type, value);
-
- /* Ignore any integer overflow caused by the cast. */
- if (TREE_CODE (value) == INTEGER_CST)
- {
- TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue);
- TREE_CONSTANT_OVERFLOW (value) = TREE_CONSTANT_OVERFLOW (ovalue);
- }
- }
-
- /* Pedantically, don't ley (void *) (FOO *) 0 be a null pointer constant. */
- if (pedantic && TREE_CODE (value) == INTEGER_CST
- && TREE_CODE (expr) == INTEGER_CST
- && TREE_CODE (TREE_TYPE (expr)) != INTEGER_TYPE)
- value = non_lvalue (value);
-
- /* If pedantic, don't let a cast be an lvalue. */
- if (value == expr && pedantic)
- value = non_lvalue (value);
-
- return value;
-}
-
-/* Build an assignment expression of lvalue LHS from value RHS.
- MODIFYCODE is the code for a binary operator that we use
- to combine the old value of LHS with RHS to get the new value.
- Or else MODIFYCODE is NOP_EXPR meaning do a simple assignment. */
-
-tree
-build_modify_expr (lhs, modifycode, rhs)
- tree lhs, rhs;
- enum tree_code modifycode;
-{
- register tree result;
- tree newrhs;
- tree lhstype = TREE_TYPE (lhs);
- tree olhstype = lhstype;
-
- /* Types that aren't fully specified cannot be used in assignments. */
- lhs = require_complete_type (lhs);
-
- /* Avoid duplicate error messages from operands that had errors. */
- if (TREE_CODE (lhs) == ERROR_MARK || TREE_CODE (rhs) == ERROR_MARK)
- return error_mark_node;
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- /* Do not use STRIP_NOPS here. We do not want an enumerator
- whose value is 0 to count as a null pointer constant. */
- if (TREE_CODE (rhs) == NON_LVALUE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
-
- newrhs = rhs;
-
- /* Handle control structure constructs used as "lvalues". */
-
- switch (TREE_CODE (lhs))
- {
- /* Handle (a, b) used as an "lvalue". */
- case COMPOUND_EXPR:
- pedantic_lvalue_warning (COMPOUND_EXPR);
- newrhs = build_modify_expr (TREE_OPERAND (lhs, 1),
- modifycode, rhs);
- if (TREE_CODE (newrhs) == ERROR_MARK)
- return error_mark_node;
- return build (COMPOUND_EXPR, lhstype,
- TREE_OPERAND (lhs, 0), newrhs);
-
- /* Handle (a ? b : c) used as an "lvalue". */
- case COND_EXPR:
- pedantic_lvalue_warning (COND_EXPR);
- rhs = save_expr (rhs);
- {
- /* Produce (a ? (b = rhs) : (c = rhs))
- except that the RHS goes through a save-expr
- so the code to compute it is only emitted once. */
- tree cond
- = build_conditional_expr (TREE_OPERAND (lhs, 0),
- build_modify_expr (TREE_OPERAND (lhs, 1),
- modifycode, rhs),
- build_modify_expr (TREE_OPERAND (lhs, 2),
- modifycode, rhs));
- if (TREE_CODE (cond) == ERROR_MARK)
- return cond;
- /* Make sure the code to compute the rhs comes out
- before the split. */
- return build (COMPOUND_EXPR, TREE_TYPE (lhs),
- /* But cast it to void to avoid an "unused" error. */
- convert (void_type_node, rhs), cond);
- }
- }
-
- /* If a binary op has been requested, combine the old LHS value with the RHS
- producing the value we should actually store into the LHS. */
-
- if (modifycode != NOP_EXPR)
- {
- lhs = stabilize_reference (lhs);
- newrhs = build_binary_op (modifycode, lhs, rhs, 1);
- }
-
- /* Handle a cast used as an "lvalue".
- We have already performed any binary operator using the value as cast.
- Now convert the result to the cast type of the lhs,
- and then true type of the lhs and store it there;
- then convert result back to the cast type to be the value
- of the assignment. */
-
- switch (TREE_CODE (lhs))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- if (TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (newrhs)) == FUNCTION_TYPE)
- newrhs = default_conversion (newrhs);
- {
- tree inner_lhs = TREE_OPERAND (lhs, 0);
- tree result;
- result = build_modify_expr (inner_lhs, NOP_EXPR,
- convert (TREE_TYPE (inner_lhs),
- convert (lhstype, newrhs)));
- if (TREE_CODE (result) == ERROR_MARK)
- return result;
- pedantic_lvalue_warning (CONVERT_EXPR);
- return convert (TREE_TYPE (lhs), result);
- }
- }
-
- /* Now we have handled acceptable kinds of LHS that are not truly lvalues.
- Reject anything strange now. */
-
- if (!lvalue_or_else (lhs, "assignment"))
- return error_mark_node;
-
- /* Warn about storing in something that is `const'. */
-
- if (TREE_READONLY (lhs) || TYPE_READONLY (lhstype)
- || ((TREE_CODE (lhstype) == RECORD_TYPE
- || TREE_CODE (lhstype) == UNION_TYPE)
- && C_TYPE_FIELDS_READONLY (lhstype)))
- readonly_warning (lhs, "assignment");
-
- /* If storing into a structure or union member,
- it has probably been given type `int'.
- Compute the type that would go with
- the actual amount of storage the member occupies. */
-
- if (TREE_CODE (lhs) == COMPONENT_REF
- && (TREE_CODE (lhstype) == INTEGER_TYPE
- || TREE_CODE (lhstype) == REAL_TYPE
- || TREE_CODE (lhstype) == ENUMERAL_TYPE))
- lhstype = TREE_TYPE (get_unwidened (lhs, 0));
-
- /* If storing in a field that is in actuality a short or narrower than one,
- we must store in the field in its actual type. */
-
- if (lhstype != TREE_TYPE (lhs))
- {
- lhs = copy_node (lhs);
- TREE_TYPE (lhs) = lhstype;
- }
-
- /* Convert new value to destination type. */
-
- newrhs = convert_for_assignment (lhstype, newrhs, "assignment",
- NULL_TREE, NULL_TREE, 0);
- if (TREE_CODE (newrhs) == ERROR_MARK)
- return error_mark_node;
-
- result = build (MODIFY_EXPR, lhstype, lhs, newrhs);
- TREE_SIDE_EFFECTS (result) = 1;
-
- /* If we got the LHS in a different type for storing in,
- convert the result back to the nominal type of LHS
- so that the value we return always has the same type
- as the LHS argument. */
-
- if (olhstype == TREE_TYPE (result))
- return result;
- return convert_for_assignment (olhstype, result, "assignment",
- NULL_TREE, NULL_TREE, 0);
-}
-
-/* Convert value RHS to type TYPE as preparation for an assignment
- to an lvalue of type TYPE.
- The real work of conversion is done by `convert'.
- The purpose of this function is to generate error messages
- for assignments that are not allowed in C.
- ERRTYPE is a string to use in error messages:
- "assignment", "return", etc. If it is null, this is parameter passing
- for a function call (and different error messages are output). Otherwise,
- it may be a name stored in the spelling stack and interpreted by
- get_spelling.
-
- FUNNAME is the name of the function being called,
- as an IDENTIFIER_NODE, or null.
- PARMNUM is the number of the argument, for printing in error messages. */
-
-static tree
-convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
- tree type, rhs;
- char *errtype;
- tree fundecl, funname;
- int parmnum;
-{
- register enum tree_code codel = TREE_CODE (type);
- register tree rhstype;
- register enum tree_code coder;
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- /* Do not use STRIP_NOPS here. We do not want an enumerator
- whose value is 0 to count as a null pointer constant. */
- if (TREE_CODE (rhs) == NON_LVALUE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
-
- if (TREE_CODE (TREE_TYPE (rhs)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (rhs)) == FUNCTION_TYPE)
- rhs = default_conversion (rhs);
- else if (optimize && TREE_CODE (rhs) == VAR_DECL)
- rhs = decl_constant_value (rhs);
-
- rhstype = TREE_TYPE (rhs);
- coder = TREE_CODE (rhstype);
-
- if (coder == ERROR_MARK)
- return error_mark_node;
-
- if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype))
- {
- overflow_warning (rhs);
- /* Check for Objective-C protocols. This will issue a warning if
- there are protocol violations. No need to use the return value. */
- maybe_objc_comptypes (type, rhstype, 0);
- return rhs;
- }
-
- if (coder == VOID_TYPE)
- {
- error ("void value not ignored as it ought to be");
- return error_mark_node;
- }
- /* Arithmetic types all interconvert, and enum is treated like int. */
- if ((codel == INTEGER_TYPE || codel == REAL_TYPE || codel == ENUMERAL_TYPE
- || codel == COMPLEX_TYPE)
- && (coder == INTEGER_TYPE || coder == REAL_TYPE || coder == ENUMERAL_TYPE
- || coder == COMPLEX_TYPE))
- return convert_and_check (type, rhs);
-
- /* Conversion to a transparent union from its member types.
- This applies only to function arguments. */
- else if (codel == UNION_TYPE && TYPE_TRANSPARENT_UNION (type) && ! errtype)
- {
- tree memb_types;
- tree marginal_memb_type = 0;
-
- for (memb_types = TYPE_FIELDS (type); memb_types;
- memb_types = TREE_CHAIN (memb_types))
- {
- tree memb_type = TREE_TYPE (memb_types);
-
- if (comptypes (TYPE_MAIN_VARIANT (memb_type),
- TYPE_MAIN_VARIANT (rhstype)))
- break;
-
- if (TREE_CODE (memb_type) != POINTER_TYPE)
- continue;
-
- if (coder == POINTER_TYPE)
- {
- register tree ttl = TREE_TYPE (memb_type);
- register tree ttr = TREE_TYPE (rhstype);
-
- /* Any non-function converts to a [const][volatile] void *
- and vice versa; otherwise, targets must be the same.
- Meanwhile, the lhs target must have all the qualifiers of
- the rhs. */
- if (TYPE_MAIN_VARIANT (ttl) == void_type_node
- || TYPE_MAIN_VARIANT (ttr) == void_type_node
- || comp_target_types (memb_type, rhstype))
- {
- /* If this type won't generate any warnings, use it. */
- if ((TREE_CODE (ttr) == FUNCTION_TYPE
- && TREE_CODE (ttl) == FUNCTION_TYPE)
- ? ((! TYPE_READONLY (ttl) | TYPE_READONLY (ttr))
- & (! TYPE_VOLATILE (ttl) | TYPE_VOLATILE (ttr)))
- : ((TYPE_READONLY (ttl) | ! TYPE_READONLY (ttr))
- & (TYPE_VOLATILE (ttl) | ! TYPE_VOLATILE (ttr))))
- break;
-
- /* Keep looking for a better type, but remember this one. */
- if (! marginal_memb_type)
- marginal_memb_type = memb_type;
- }
- }
-
- /* Can convert integer zero to any pointer type. */
- if (integer_zerop (rhs)
- || (TREE_CODE (rhs) == NOP_EXPR
- && integer_zerop (TREE_OPERAND (rhs, 0))))
- {
- rhs = null_pointer_node;
- break;
- }
- }
-
- if (memb_types || marginal_memb_type)
- {
- if (! memb_types)
- {
- /* We have only a marginally acceptable member type;
- it needs a warning. */
- register tree ttl = TREE_TYPE (marginal_memb_type);
- register tree ttr = TREE_TYPE (rhstype);
-
- /* Const and volatile mean something different for function
- types, so the usual warnings are not appropriate. */
- if (TREE_CODE (ttr) == FUNCTION_TYPE
- && TREE_CODE (ttl) == FUNCTION_TYPE)
- {
- /* Because const and volatile on functions are
- restrictions that say the function will not do
- certain things, it is okay to use a const or volatile
- function where an ordinary one is wanted, but not
- vice-versa. */
- if (TYPE_READONLY (ttl) && ! TYPE_READONLY (ttr))
- warn_for_assignment ("%s makes `const *' function pointer from non-const",
- get_spelling (errtype), funname,
- parmnum);
- if (TYPE_VOLATILE (ttl) && ! TYPE_VOLATILE (ttr))
- warn_for_assignment ("%s makes `volatile *' function pointer from non-volatile",
- get_spelling (errtype), funname,
- parmnum);
- }
- else
- {
- if (! TYPE_READONLY (ttl) && TYPE_READONLY (ttr))
- warn_for_assignment ("%s discards `const' from pointer target type",
- get_spelling (errtype), funname,
- parmnum);
- if (! TYPE_VOLATILE (ttl) && TYPE_VOLATILE (ttr))
- warn_for_assignment ("%s discards `volatile' from pointer target type",
- get_spelling (errtype), funname,
- parmnum);
- }
- }
-
- if (pedantic && ! DECL_IN_SYSTEM_HEADER (fundecl))
- pedwarn ("ANSI C prohibits argument conversion to union type");
-
- return build1 (NOP_EXPR, type, rhs);
- }
- }
-
- /* Conversions among pointers */
- else if (codel == POINTER_TYPE && coder == POINTER_TYPE)
- {
- register tree ttl = TREE_TYPE (type);
- register tree ttr = TREE_TYPE (rhstype);
-
- /* Any non-function converts to a [const][volatile] void *
- and vice versa; otherwise, targets must be the same.
- Meanwhile, the lhs target must have all the qualifiers of the rhs. */
- if (TYPE_MAIN_VARIANT (ttl) == void_type_node
- || TYPE_MAIN_VARIANT (ttr) == void_type_node
- || comp_target_types (type, rhstype)
- || (unsigned_type (TYPE_MAIN_VARIANT (ttl))
- == unsigned_type (TYPE_MAIN_VARIANT (ttr))))
- {
- if (pedantic
- && ((TYPE_MAIN_VARIANT (ttl) == void_type_node
- && TREE_CODE (ttr) == FUNCTION_TYPE)
- ||
- (TYPE_MAIN_VARIANT (ttr) == void_type_node
- /* Check TREE_CODE to catch cases like (void *) (char *) 0
- which are not ANSI null ptr constants. */
- && (!integer_zerop (rhs) || TREE_CODE (rhs) == NOP_EXPR)
- && TREE_CODE (ttl) == FUNCTION_TYPE)))
- warn_for_assignment ("ANSI forbids %s between function pointer and `void *'",
- get_spelling (errtype), funname, parmnum);
- /* Const and volatile mean something different for function types,
- so the usual warnings are not appropriate. */
- else if (TREE_CODE (ttr) != FUNCTION_TYPE
- && TREE_CODE (ttl) != FUNCTION_TYPE)
- {
- if (! TYPE_READONLY (ttl) && TYPE_READONLY (ttr))
- warn_for_assignment ("%s discards `const' from pointer target type",
- get_spelling (errtype), funname, parmnum);
- else if (! TYPE_VOLATILE (ttl) && TYPE_VOLATILE (ttr))
- warn_for_assignment ("%s discards `volatile' from pointer target type",
- get_spelling (errtype), funname, parmnum);
- /* If this is not a case of ignoring a mismatch in signedness,
- no warning. */
- else if (TYPE_MAIN_VARIANT (ttl) == void_type_node
- || TYPE_MAIN_VARIANT (ttr) == void_type_node
- || comp_target_types (type, rhstype))
- ;
- /* If there is a mismatch, do warn. */
- else if (pedantic)
- warn_for_assignment ("pointer targets in %s differ in signedness",
- get_spelling (errtype), funname, parmnum);
- }
- else if (TREE_CODE (ttl) == FUNCTION_TYPE
- && TREE_CODE (ttr) == FUNCTION_TYPE)
- {
- /* Because const and volatile on functions are restrictions
- that say the function will not do certain things,
- it is okay to use a const or volatile function
- where an ordinary one is wanted, but not vice-versa. */
- if (TYPE_READONLY (ttl) && ! TYPE_READONLY (ttr))
- warn_for_assignment ("%s makes `const *' function pointer from non-const",
- get_spelling (errtype), funname, parmnum);
- if (TYPE_VOLATILE (ttl) && ! TYPE_VOLATILE (ttr))
- warn_for_assignment ("%s makes `volatile *' function pointer from non-volatile",
- get_spelling (errtype), funname, parmnum);
- }
- }
- else
- warn_for_assignment ("%s from incompatible pointer type",
- get_spelling (errtype), funname, parmnum);
- return convert (type, rhs);
- }
- else if (codel == POINTER_TYPE && coder == INTEGER_TYPE)
- {
- /* An explicit constant 0 can convert to a pointer,
- or one that results from arithmetic, even including
- a cast to integer type. */
- if (! (TREE_CODE (rhs) == INTEGER_CST && integer_zerop (rhs))
- &&
- ! (TREE_CODE (rhs) == NOP_EXPR
- && TREE_CODE (TREE_TYPE (rhs)) == INTEGER_TYPE
- && TREE_CODE (TREE_OPERAND (rhs, 0)) == INTEGER_CST
- && integer_zerop (TREE_OPERAND (rhs, 0))))
- {
- warn_for_assignment ("%s makes pointer from integer without a cast",
- get_spelling (errtype), funname, parmnum);
- return convert (type, rhs);
- }
- return null_pointer_node;
- }
- else if (codel == INTEGER_TYPE && coder == POINTER_TYPE)
- {
- warn_for_assignment ("%s makes integer from pointer without a cast",
- get_spelling (errtype), funname, parmnum);
- return convert (type, rhs);
- }
-
- if (!errtype)
- {
- if (funname)
- {
- tree selector = maybe_building_objc_message_expr ();
-
- if (selector && parmnum > 2)
- error ("incompatible type for argument %d of `%s'",
- parmnum - 2, IDENTIFIER_POINTER (selector));
- else
- error ("incompatible type for argument %d of `%s'",
- parmnum, IDENTIFIER_POINTER (funname));
- }
- else
- error ("incompatible type for argument %d of indirect function call",
- parmnum);
- }
- else
- error ("incompatible types in %s", get_spelling (errtype));
-
- return error_mark_node;
-}
-
-/* Print a warning using MSG.
- It gets OPNAME as its one parameter.
- If OPNAME is null, it is replaced by "passing arg ARGNUM of `FUNCTION'".
- FUNCTION and ARGNUM are handled specially if we are building an
- Objective-C selector. */
-
-static void
-warn_for_assignment (msg, opname, function, argnum)
- char *msg;
- char *opname;
- tree function;
- int argnum;
-{
- static char argstring[] = "passing arg %d of `%s'";
- static char argnofun[] = "passing arg %d";
-
- if (opname == 0)
- {
- tree selector = maybe_building_objc_message_expr ();
-
- if (selector && argnum > 2)
- {
- function = selector;
- argnum -= 2;
- }
- if (function)
- {
- /* Function name is known; supply it. */
- opname = (char *) alloca (IDENTIFIER_LENGTH (function)
- + sizeof (argstring) + 25 /*%d*/ + 1);
- sprintf (opname, argstring, argnum, IDENTIFIER_POINTER (function));
- }
- else
- {
- /* Function name unknown (call through ptr); just give arg number. */
- opname = (char *) alloca (sizeof (argnofun) + 25 /*%d*/ + 1);
- sprintf (opname, argnofun, argnum);
- }
- }
- pedwarn (msg, opname);
-}
-
-/* Return nonzero if VALUE is a valid constant-valued expression
- for use in initializing a static variable; one that can be an
- element of a "constant" initializer.
-
- Return null_pointer_node if the value is absolute;
- if it is relocatable, return the variable that determines the relocation.
- We assume that VALUE has been folded as much as possible;
- therefore, we do not need to check for such things as
- arithmetic-combinations of integers. */
-
-tree
-initializer_constant_valid_p (value, endtype)
- tree value;
- tree endtype;
-{
- switch (TREE_CODE (value))
- {
- case CONSTRUCTOR:
- if ((TREE_CODE (TREE_TYPE (value)) == UNION_TYPE
- || TREE_CODE (TREE_TYPE (value)) == RECORD_TYPE)
- && TREE_CONSTANT (value)
- && CONSTRUCTOR_ELTS (value))
- return
- initializer_constant_valid_p (TREE_VALUE (CONSTRUCTOR_ELTS (value)),
- endtype);
-
- return TREE_STATIC (value) ? null_pointer_node : 0;
-
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- case COMPLEX_CST:
- return null_pointer_node;
-
- case ADDR_EXPR:
- return TREE_OPERAND (value, 0);
-
- case NON_LVALUE_EXPR:
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- case CONVERT_EXPR:
- case NOP_EXPR:
- /* Allow conversions between pointer types. */
- if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == POINTER_TYPE)
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- /* Allow conversions between real types. */
- if (TREE_CODE (TREE_TYPE (value)) == REAL_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == REAL_TYPE)
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- /* Allow length-preserving conversions between integer types. */
- if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (value))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- /* Allow conversions between other integer types only if
- explicit value. */
- if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE)
- {
- tree inner = initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- if (inner == null_pointer_node)
- return null_pointer_node;
- return 0;
- }
-
- /* Allow (int) &foo provided int is as wide as a pointer. */
- if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == POINTER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (value))
- >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
-
- /* Likewise conversions from int to pointers. */
- if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (value))
- <= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
-
- /* Allow conversions to union types if the value inside is okay. */
- if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE)
- return initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- return 0;
-
- case PLUS_EXPR:
- if (TREE_CODE (endtype) == INTEGER_TYPE
- && TYPE_PRECISION (endtype) < POINTER_SIZE)
- return 0;
- {
- tree valid0 = initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- tree valid1 = initializer_constant_valid_p (TREE_OPERAND (value, 1),
- endtype);
- /* If either term is absolute, use the other terms relocation. */
- if (valid0 == null_pointer_node)
- return valid1;
- if (valid1 == null_pointer_node)
- return valid0;
- return 0;
- }
-
- case MINUS_EXPR:
- if (TREE_CODE (endtype) == INTEGER_TYPE
- && TYPE_PRECISION (endtype) < POINTER_SIZE)
- return 0;
- {
- tree valid0 = initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- tree valid1 = initializer_constant_valid_p (TREE_OPERAND (value, 1),
- endtype);
- /* Win if second argument is absolute. */
- if (valid1 == null_pointer_node)
- return valid0;
- /* Win if both arguments have the same relocation.
- Then the value is absolute. */
- if (valid0 == valid1)
- return null_pointer_node;
- return 0;
- }
- }
-
- return 0;
-}
-
-/* If VALUE is a compound expr all of whose expressions are constant, then
- return its value. Otherwise, return error_mark_node.
-
- This is for handling COMPOUND_EXPRs as initializer elements
- which is allowed with a warning when -pedantic is specified. */
-
-static tree
-valid_compound_expr_initializer (value, endtype)
- tree value;
- tree endtype;
-{
- if (TREE_CODE (value) == COMPOUND_EXPR)
- {
- if (valid_compound_expr_initializer (TREE_OPERAND (value, 0), endtype)
- == error_mark_node)
- return error_mark_node;
- return valid_compound_expr_initializer (TREE_OPERAND (value, 1),
- endtype);
- }
- else if (! TREE_CONSTANT (value)
- && ! initializer_constant_valid_p (value, endtype))
- return error_mark_node;
- else
- return value;
-}
-
-/* Perform appropriate conversions on the initial value of a variable,
- store it in the declaration DECL,
- and print any error messages that are appropriate.
- If the init is invalid, store an ERROR_MARK. */
-
-void
-store_init_value (decl, init)
- tree decl, init;
-{
- register tree value, type;
-
- /* If variable's type was invalidly declared, just ignore it. */
-
- type = TREE_TYPE (decl);
- if (TREE_CODE (type) == ERROR_MARK)
- return;
-
- /* Digest the specified initializer into an expression. */
-
- value = digest_init (type, init, TREE_STATIC (decl),
- TREE_STATIC (decl) || pedantic);
-
- /* Store the expression if valid; else report error. */
-
-#if 0
- /* Note that this is the only place we can detect the error
- in a case such as struct foo bar = (struct foo) { x, y };
- where there is one initial value which is a constructor expression. */
- if (value == error_mark_node)
- ;
- else if (TREE_STATIC (decl) && ! TREE_CONSTANT (value))
- {
- error ("initializer for static variable is not constant");
- value = error_mark_node;
- }
- else if (TREE_STATIC (decl)
- && initializer_constant_valid_p (value, TREE_TYPE (value)) == 0)
- {
- error ("initializer for static variable uses complicated arithmetic");
- value = error_mark_node;
- }
- else
- {
- if (pedantic && TREE_CODE (value) == CONSTRUCTOR)
- {
- if (! TREE_CONSTANT (value))
- pedwarn ("aggregate initializer is not constant");
- else if (! TREE_STATIC (value))
- pedwarn ("aggregate initializer uses complicated arithmetic");
- }
- }
-#endif
-
- DECL_INITIAL (decl) = value;
-
- /* ANSI wants warnings about out-of-range constant initializers. */
- STRIP_TYPE_NOPS (value);
- constant_expression_warning (value);
-}
-
-/* Methods for storing and printing names for error messages. */
-
-/* Implement a spelling stack that allows components of a name to be pushed
- and popped. Each element on the stack is this structure. */
-
-struct spelling
-{
- int kind;
- union
- {
- int i;
- char *s;
- } u;
-};
-
-#define SPELLING_STRING 1
-#define SPELLING_MEMBER 2
-#define SPELLING_BOUNDS 3
-
-static struct spelling *spelling; /* Next stack element (unused). */
-static struct spelling *spelling_base; /* Spelling stack base. */
-static int spelling_size; /* Size of the spelling stack. */
-
-/* Macros to save and restore the spelling stack around push_... functions.
- Alternative to SAVE_SPELLING_STACK. */
-
-#define SPELLING_DEPTH() (spelling - spelling_base)
-#define RESTORE_SPELLING_DEPTH(depth) (spelling = spelling_base + depth)
-
-/* Save and restore the spelling stack around arbitrary C code. */
-
-#define SAVE_SPELLING_DEPTH(code) \
-{ \
- int __depth = SPELLING_DEPTH (); \
- code; \
- RESTORE_SPELLING_DEPTH (__depth); \
-}
-
-/* Push an element on the spelling stack with type KIND and assign VALUE
- to MEMBER. */
-
-#define PUSH_SPELLING(KIND, VALUE, MEMBER) \
-{ \
- int depth = SPELLING_DEPTH (); \
- \
- if (depth >= spelling_size) \
- { \
- spelling_size += 10; \
- if (spelling_base == 0) \
- spelling_base \
- = (struct spelling *) xmalloc (spelling_size * sizeof (struct spelling)); \
- else \
- spelling_base \
- = (struct spelling *) xrealloc (spelling_base, \
- spelling_size * sizeof (struct spelling)); \
- RESTORE_SPELLING_DEPTH (depth); \
- } \
- \
- spelling->kind = (KIND); \
- spelling->MEMBER = (VALUE); \
- spelling++; \
-}
-
-/* Push STRING on the stack. Printed literally. */
-
-static void
-push_string (string)
- char *string;
-{
- PUSH_SPELLING (SPELLING_STRING, string, u.s);
-}
-
-/* Push a member name on the stack. Printed as '.' STRING. */
-
-static void
-push_member_name (decl)
- tree decl;
-
-{
- char *string
- = DECL_NAME (decl) ? IDENTIFIER_POINTER (DECL_NAME (decl)) : "<anonymous>";
- PUSH_SPELLING (SPELLING_MEMBER, string, u.s);
-}
-
-/* Push an array bounds on the stack. Printed as [BOUNDS]. */
-
-static void
-push_array_bounds (bounds)
- int bounds;
-{
- PUSH_SPELLING (SPELLING_BOUNDS, bounds, u.i);
-}
-
-/* Compute the maximum size in bytes of the printed spelling. */
-
-static int
-spelling_length ()
-{
- register int size = 0;
- register struct spelling *p;
-
- for (p = spelling_base; p < spelling; p++)
- {
- if (p->kind == SPELLING_BOUNDS)
- size += 25;
- else
- size += strlen (p->u.s) + 1;
- }
-
- return size;
-}
-
-/* Print the spelling to BUFFER and return it. */
-
-static char *
-print_spelling (buffer)
- register char *buffer;
-{
- register char *d = buffer;
- register char *s;
- register struct spelling *p;
-
- for (p = spelling_base; p < spelling; p++)
- if (p->kind == SPELLING_BOUNDS)
- {
- sprintf (d, "[%d]", p->u.i);
- d += strlen (d);
- }
- else
- {
- if (p->kind == SPELLING_MEMBER)
- *d++ = '.';
- for (s = p->u.s; *d = *s++; d++)
- ;
- }
- *d++ = '\0';
- return buffer;
-}
-
-/* Provide a means to pass component names derived from the spelling stack. */
-
-char initialization_message;
-
-/* Interpret the spelling of the given ERRTYPE message. */
-
-static char *
-get_spelling (errtype)
- char *errtype;
-{
- static char *buffer;
- static int size = -1;
-
- if (errtype == &initialization_message)
- {
- /* Avoid counting chars */
- static char message[] = "initialization of `%s'";
- register int needed = sizeof (message) + spelling_length () + 1;
- char *temp;
-
- if (size < 0)
- buffer = (char *) xmalloc (size = needed);
- if (needed > size)
- buffer = (char *) xrealloc (buffer, size = needed);
-
- temp = (char *) alloca (needed);
- sprintf (buffer, message, print_spelling (temp));
- return buffer;
- }
-
- return errtype;
-}
-
-/* Issue an error message for a bad initializer component.
- FORMAT describes the message. OFWHAT is the name for the component.
- LOCAL is a format string for formatting the insertion of the name
- into the message.
-
- If OFWHAT is null, the component name is stored on the spelling stack.
- If the component name is a null string, then LOCAL is omitted entirely. */
-
-void
-error_init (format, local, ofwhat)
- char *format, *local, *ofwhat;
-{
- char *buffer;
-
- if (ofwhat == 0)
- ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
- buffer = (char *) alloca (strlen (local) + strlen (ofwhat) + 2);
-
- if (*ofwhat)
- sprintf (buffer, local, ofwhat);
- else
- buffer[0] = 0;
-
- error (format, buffer);
-}
-
-/* Issue a pedantic warning for a bad initializer component.
- FORMAT describes the message. OFWHAT is the name for the component.
- LOCAL is a format string for formatting the insertion of the name
- into the message.
-
- If OFWHAT is null, the component name is stored on the spelling stack.
- If the component name is a null string, then LOCAL is omitted entirely. */
-
-void
-pedwarn_init (format, local, ofwhat)
- char *format, *local, *ofwhat;
-{
- char *buffer;
-
- if (ofwhat == 0)
- ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
- buffer = (char *) alloca (strlen (local) + strlen (ofwhat) + 2);
-
- if (*ofwhat)
- sprintf (buffer, local, ofwhat);
- else
- buffer[0] = 0;
-
- pedwarn (format, buffer);
-}
-
-/* Issue a warning for a bad initializer component.
- FORMAT describes the message. OFWHAT is the name for the component.
- LOCAL is a format string for formatting the insertion of the name
- into the message.
-
- If OFWHAT is null, the component name is stored on the spelling stack.
- If the component name is a null string, then LOCAL is omitted entirely. */
-
-static void
-warning_init (format, local, ofwhat)
- char *format, *local, *ofwhat;
-{
- char *buffer;
-
- if (ofwhat == 0)
- ofwhat = print_spelling ((char *) alloca (spelling_length () + 1));
- buffer = (char *) alloca (strlen (local) + strlen (ofwhat) + 2);
-
- if (*ofwhat)
- sprintf (buffer, local, ofwhat);
- else
- buffer[0] = 0;
-
- warning (format, buffer);
-}
-
-/* Digest the parser output INIT as an initializer for type TYPE.
- Return a C expression of type TYPE to represent the initial value.
-
- The arguments REQUIRE_CONSTANT and CONSTRUCTOR_CONSTANT request errors
- if non-constant initializers or elements are seen. CONSTRUCTOR_CONSTANT
- applies only to elements of constructors. */
-
-static tree
-digest_init (type, init, require_constant, constructor_constant)
- tree type, init;
- int require_constant, constructor_constant;
-{
- enum tree_code code = TREE_CODE (type);
- tree inside_init = init;
-
- if (init == error_mark_node)
- return init;
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- /* Do not use STRIP_NOPS here. We do not want an enumerator
- whose value is 0 to count as a null pointer constant. */
- if (TREE_CODE (init) == NON_LVALUE_EXPR)
- inside_init = TREE_OPERAND (init, 0);
-
- /* Initialization of an array of chars from a string constant
- optionally enclosed in braces. */
-
- if (code == ARRAY_TYPE)
- {
- tree typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (type));
- if ((typ1 == char_type_node
- || typ1 == signed_char_type_node
- || typ1 == unsigned_char_type_node
- || typ1 == unsigned_wchar_type_node
- || typ1 == signed_wchar_type_node)
- && ((inside_init && TREE_CODE (inside_init) == STRING_CST)))
- {
- if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
- TYPE_MAIN_VARIANT (type)))
- return inside_init;
-
- if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)))
- != char_type_node)
- && TYPE_PRECISION (typ1) == TYPE_PRECISION (char_type_node))
- {
- error_init ("char-array%s initialized from wide string",
- " `%s'", NULL);
- return error_mark_node;
- }
- if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)))
- == char_type_node)
- && TYPE_PRECISION (typ1) != TYPE_PRECISION (char_type_node))
- {
- error_init ("int-array%s initialized from non-wide string",
- " `%s'", NULL);
- return error_mark_node;
- }
-
- TREE_TYPE (inside_init) = type;
- if (TYPE_DOMAIN (type) != 0
- && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
- {
- register int size = TREE_INT_CST_LOW (TYPE_SIZE (type));
- size = (size + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
- /* Subtract 1 (or sizeof (wchar_t))
- because it's ok to ignore the terminating null char
- that is counted in the length of the constant. */
- if (size < TREE_STRING_LENGTH (inside_init)
- - (TYPE_PRECISION (typ1) != TYPE_PRECISION (char_type_node)
- ? TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT
- : 1))
- pedwarn_init (
- "initializer-string for array of chars%s is too long",
- " `%s'", NULL);
- }
- return inside_init;
- }
- }
-
- /* Any type can be initialized
- from an expression of the same type, optionally with braces. */
-
- if (inside_init && TREE_TYPE (inside_init) != 0
- && (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)),
- TYPE_MAIN_VARIANT (type))
- || (code == ARRAY_TYPE
- && comptypes (TREE_TYPE (inside_init), type))
- || (code == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (inside_init)) == FUNCTION_TYPE)
- && comptypes (TREE_TYPE (TREE_TYPE (inside_init)),
- TREE_TYPE (type)))))
- {
- if (code == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (inside_init)) == FUNCTION_TYPE))
- inside_init = default_conversion (inside_init);
- else if (code == ARRAY_TYPE && TREE_CODE (inside_init) != STRING_CST
- && TREE_CODE (inside_init) != CONSTRUCTOR)
- {
- error_init ("array%s initialized from non-constant array expression",
- " `%s'", NULL);
- return error_mark_node;
- }
-
- if (optimize && TREE_CODE (inside_init) == VAR_DECL)
- inside_init = decl_constant_value (inside_init);
-
- /* Compound expressions can only occur here if -pedantic or
- -pedantic-errors is specified. In the later case, we always want
- an error. In the former case, we simply want a warning. */
- if (require_constant && pedantic
- && TREE_CODE (inside_init) == COMPOUND_EXPR)
- {
- inside_init
- = valid_compound_expr_initializer (inside_init,
- TREE_TYPE (inside_init));
- if (inside_init == error_mark_node)
- error_init ("initializer element%s is not constant",
- " for `%s'", NULL);
- else
- pedwarn_init ("initializer element%s is not constant",
- " for `%s'", NULL);
- if (flag_pedantic_errors)
- inside_init = error_mark_node;
- }
- else if (require_constant && ! TREE_CONSTANT (inside_init))
- {
- error_init ("initializer element%s is not constant",
- " for `%s'", NULL);
- inside_init = error_mark_node;
- }
- else if (require_constant
- && initializer_constant_valid_p (inside_init, TREE_TYPE (inside_init)) == 0)
- {
- error_init ("initializer element%s is not computable at load time",
- " for `%s'", NULL);
- inside_init = error_mark_node;
- }
-
- return inside_init;
- }
-
- /* Handle scalar types, including conversions. */
-
- if (code == INTEGER_TYPE || code == REAL_TYPE || code == POINTER_TYPE
- || code == ENUMERAL_TYPE || code == COMPLEX_TYPE)
- {
- /* Note that convert_for_assignment calls default_conversion
- for arrays and functions. We must not call it in the
- case where inside_init is a null pointer constant. */
- inside_init
- = convert_for_assignment (type, init, "initialization",
- NULL_TREE, NULL_TREE, 0);
-
- if (require_constant && ! TREE_CONSTANT (inside_init))
- {
- error_init ("initializer element%s is not constant",
- " for `%s'", NULL);
- inside_init = error_mark_node;
- }
- else if (require_constant
- && initializer_constant_valid_p (inside_init, TREE_TYPE (inside_init)) == 0)
- {
- error_init ("initializer element%s is not computable at load time",
- " for `%s'", NULL);
- inside_init = error_mark_node;
- }
-
- return inside_init;
- }
-
- /* Come here only for records and arrays. */
-
- if (TYPE_SIZE (type) && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- {
- error_init ("variable-sized object%s may not be initialized",
- " `%s'", NULL);
- return error_mark_node;
- }
-
- /* Traditionally, you can write struct foo x = 0;
- and it initializes the first element of x to 0. */
- if (flag_traditional)
- {
- tree top = 0, prev = 0, otype = type;
- while (TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == ARRAY_TYPE
- || TREE_CODE (type) == QUAL_UNION_TYPE
- || TREE_CODE (type) == UNION_TYPE)
- {
- tree temp = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE);
- if (prev == 0)
- top = temp;
- else
- TREE_OPERAND (prev, 1) = build_tree_list (NULL_TREE, temp);
- prev = temp;
- if (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
- else if (TYPE_FIELDS (type))
- type = TREE_TYPE (TYPE_FIELDS (type));
- else
- {
- error_init ("invalid initializer%s", " for `%s'", NULL);
- return error_mark_node;
- }
- }
-
- if (otype != type)
- {
- TREE_OPERAND (prev, 1)
- = build_tree_list (NULL_TREE,
- digest_init (type, init, require_constant,
- constructor_constant));
- return top;
- }
- else
- return error_mark_node;
- }
- error_init ("invalid initializer%s", " for `%s'", NULL);
- return error_mark_node;
-}
-
-/* Handle initializers that use braces. */
-
-/* Type of object we are accumulating a constructor for.
- This type is always a RECORD_TYPE, UNION_TYPE or ARRAY_TYPE. */
-static tree constructor_type;
-
-/* For a RECORD_TYPE or UNION_TYPE, this is the chain of fields
- left to fill. */
-static tree constructor_fields;
-
-/* For an ARRAY_TYPE, this is the specified index
- at which to store the next element we get.
- This is a special INTEGER_CST node that we modify in place. */
-static tree constructor_index;
-
-/* For an ARRAY_TYPE, this is the end index of the range
- to initialize with the next element, or NULL in the ordinary case
- where the element is used just once. */
-static tree constructor_range_end;
-
-/* For an ARRAY_TYPE, this is the maximum index. */
-static tree constructor_max_index;
-
-/* For a RECORD_TYPE, this is the first field not yet written out. */
-static tree constructor_unfilled_fields;
-
-/* For an ARRAY_TYPE, this is the index of the first element
- not yet written out.
- This is a special INTEGER_CST node that we modify in place. */
-static tree constructor_unfilled_index;
-
-/* In a RECORD_TYPE, the byte index of the next consecutive field.
- This is so we can generate gaps between fields, when appropriate.
- This is a special INTEGER_CST node that we modify in place. */
-static tree constructor_bit_index;
-
-/* If we are saving up the elements rather than allocating them,
- this is the list of elements so far (in reverse order,
- most recent first). */
-static tree constructor_elements;
-
-/* 1 if so far this constructor's elements are all compile-time constants. */
-static int constructor_constant;
-
-/* 1 if so far this constructor's elements are all valid address constants. */
-static int constructor_simple;
-
-/* 1 if this constructor is erroneous so far. */
-static int constructor_erroneous;
-
-/* 1 if have called defer_addressed_constants. */
-static int constructor_subconstants_deferred;
-
-/* List of pending elements at this constructor level.
- These are elements encountered out of order
- which belong at places we haven't reached yet in actually
- writing the output. */
-static tree constructor_pending_elts;
-
-/* The SPELLING_DEPTH of this constructor. */
-static int constructor_depth;
-
-/* 0 if implicitly pushing constructor levels is allowed. */
-int constructor_no_implicit = 0; /* 0 for C; 1 for some other languages. */
-
-/* 1 if this constructor level was entered implicitly. */
-static int constructor_implicit;
-
-static int require_constant_value;
-static int require_constant_elements;
-
-/* 1 if it is ok to output this constructor as we read it.
- 0 means must accumulate a CONSTRUCTOR expression. */
-static int constructor_incremental;
-
-/* DECL node for which an initializer is being read.
- 0 means we are reading a constructor expression
- such as (struct foo) {...}. */
-static tree constructor_decl;
-
-/* start_init saves the ASMSPEC arg here for really_start_incremental_init. */
-static char *constructor_asmspec;
-
-/* Nonzero if this is an initializer for a top-level decl. */
-static int constructor_top_level;
-
-/* When we finish reading a constructor expression
- (constructor_decl is 0), the CONSTRUCTOR goes here. */
-static tree constructor_result;
-
-/* This stack has a level for each implicit or explicit level of
- structuring in the initializer, including the outermost one. It
- saves the values of most of the variables above. */
-
-struct constructor_stack
-{
- struct constructor_stack *next;
- tree type;
- tree fields;
- tree index;
- tree range_end;
- tree max_index;
- tree unfilled_index;
- tree unfilled_fields;
- tree bit_index;
- tree elements;
- int offset;
- tree pending_elts;
- int depth;
- /* If nonzero, this value should replace the entire
- constructor at this level. */
- tree replacement_value;
- char constant;
- char simple;
- char implicit;
- char incremental;
- char erroneous;
- char outer;
-};
-
-struct constructor_stack *constructor_stack;
-
-/* This stack records separate initializers that are nested.
- Nested initializers can't happen in ANSI C, but GNU C allows them
- in cases like { ... (struct foo) { ... } ... }. */
-
-struct initializer_stack
-{
- struct initializer_stack *next;
- tree decl;
- char *asmspec;
- struct constructor_stack *constructor_stack;
- tree elements;
- struct spelling *spelling;
- struct spelling *spelling_base;
- int spelling_size;
- char top_level;
- char incremental;
- char require_constant_value;
- char require_constant_elements;
- char deferred;
-};
-
-struct initializer_stack *initializer_stack;
-
-/* Prepare to parse and output the initializer for variable DECL. */
-
-void
-start_init (decl, asmspec_tree, top_level)
- tree decl;
- tree asmspec_tree;
- int top_level;
-{
- char *locus;
- struct initializer_stack *p
- = (struct initializer_stack *) xmalloc (sizeof (struct initializer_stack));
- char *asmspec = 0;
-
- if (asmspec_tree)
- asmspec = TREE_STRING_POINTER (asmspec_tree);
-
- p->decl = constructor_decl;
- p->asmspec = constructor_asmspec;
- p->incremental = constructor_incremental;
- p->require_constant_value = require_constant_value;
- p->require_constant_elements = require_constant_elements;
- p->constructor_stack = constructor_stack;
- p->elements = constructor_elements;
- p->spelling = spelling;
- p->spelling_base = spelling_base;
- p->spelling_size = spelling_size;
- p->deferred = constructor_subconstants_deferred;
- p->top_level = constructor_top_level;
- p->next = initializer_stack;
- initializer_stack = p;
-
- constructor_decl = decl;
- constructor_incremental = top_level;
- constructor_asmspec = asmspec;
- constructor_subconstants_deferred = 0;
- constructor_top_level = top_level;
-
- if (decl != 0)
- {
- require_constant_value = TREE_STATIC (decl);
- require_constant_elements
- = ((TREE_STATIC (decl) || pedantic)
- /* For a scalar, you can always use any value to initialize,
- even within braces. */
- && (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE
- || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE));
- locus = IDENTIFIER_POINTER (DECL_NAME (decl));
- constructor_incremental |= TREE_STATIC (decl);
- }
- else
- {
- require_constant_value = 0;
- require_constant_elements = 0;
- locus = "(anonymous)";
- }
-
- constructor_stack = 0;
-
- missing_braces_mentioned = 0;
-
- spelling_base = 0;
- spelling_size = 0;
- RESTORE_SPELLING_DEPTH (0);
-
- if (locus)
- push_string (locus);
-}
-
-void
-finish_init ()
-{
- struct initializer_stack *p = initializer_stack;
-
- /* Output subconstants (string constants, usually)
- that were referenced within this initializer and saved up.
- Must do this if and only if we called defer_addressed_constants. */
- if (constructor_subconstants_deferred)
- output_deferred_addressed_constants ();
-
- /* Free the whole constructor stack of this initializer. */
- while (constructor_stack)
- {
- struct constructor_stack *q = constructor_stack;
- constructor_stack = q->next;
- free (q);
- }
-
- /* Pop back to the data of the outer initializer (if any). */
- constructor_decl = p->decl;
- constructor_asmspec = p->asmspec;
- constructor_incremental = p->incremental;
- require_constant_value = p->require_constant_value;
- require_constant_elements = p->require_constant_elements;
- constructor_stack = p->constructor_stack;
- constructor_elements = p->elements;
- spelling = p->spelling;
- spelling_base = p->spelling_base;
- spelling_size = p->spelling_size;
- constructor_subconstants_deferred = p->deferred;
- constructor_top_level = p->top_level;
- initializer_stack = p->next;
- free (p);
-}
-
-/* Call here when we see the initializer is surrounded by braces.
- This is instead of a call to push_init_level;
- it is matched by a call to pop_init_level.
-
- TYPE is the type to initialize, for a constructor expression.
- For an initializer for a decl, TYPE is zero. */
-
-void
-really_start_incremental_init (type)
- tree type;
-{
- struct constructor_stack *p
- = (struct constructor_stack *) xmalloc (sizeof (struct constructor_stack));
-
- if (type == 0)
- type = TREE_TYPE (constructor_decl);
-
- /* Turn off constructor_incremental if type is a struct with bitfields.
- Do this before the first push, so that the corrected value
- is available in finish_init. */
- check_init_type_bitfields (type);
-
- p->type = constructor_type;
- p->fields = constructor_fields;
- p->index = constructor_index;
- p->range_end = constructor_range_end;
- p->max_index = constructor_max_index;
- p->unfilled_index = constructor_unfilled_index;
- p->unfilled_fields = constructor_unfilled_fields;
- p->bit_index = constructor_bit_index;
- p->elements = constructor_elements;
- p->constant = constructor_constant;
- p->simple = constructor_simple;
- p->erroneous = constructor_erroneous;
- p->pending_elts = constructor_pending_elts;
- p->depth = constructor_depth;
- p->replacement_value = 0;
- p->implicit = 0;
- p->incremental = constructor_incremental;
- p->outer = 0;
- p->next = 0;
- constructor_stack = p;
-
- constructor_constant = 1;
- constructor_simple = 1;
- constructor_depth = SPELLING_DEPTH ();
- constructor_elements = 0;
- constructor_pending_elts = 0;
- constructor_type = type;
-
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- {
- constructor_fields = TYPE_FIELDS (constructor_type);
- /* Skip any nameless bit fields at the beginning. */
- while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields)
- && DECL_NAME (constructor_fields) == 0)
- constructor_fields = TREE_CHAIN (constructor_fields);
- constructor_unfilled_fields = constructor_fields;
- constructor_bit_index = copy_node (integer_zero_node);
- }
- else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- constructor_range_end = 0;
- if (TYPE_DOMAIN (constructor_type))
- {
- constructor_max_index
- = TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type));
- constructor_index
- = copy_node (TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
- }
- else
- constructor_index = copy_node (integer_zero_node);
- constructor_unfilled_index = copy_node (constructor_index);
- }
- else
- {
- /* Handle the case of int x = {5}; */
- constructor_fields = constructor_type;
- constructor_unfilled_fields = constructor_type;
- }
-
- if (constructor_incremental)
- {
- int momentary = suspend_momentary ();
- push_obstacks_nochange ();
- if (TREE_PERMANENT (constructor_decl))
- end_temporary_allocation ();
- make_decl_rtl (constructor_decl, constructor_asmspec,
- constructor_top_level);
- assemble_variable (constructor_decl, constructor_top_level, 0, 1);
- pop_obstacks ();
- resume_momentary (momentary);
- }
-
- if (constructor_incremental)
- {
- defer_addressed_constants ();
- constructor_subconstants_deferred = 1;
- }
-}
-
-/* Push down into a subobject, for initialization.
- If this is for an explicit set of braces, IMPLICIT is 0.
- If it is because the next element belongs at a lower level,
- IMPLICIT is 1. */
-
-void
-push_init_level (implicit)
- int implicit;
-{
- struct constructor_stack *p;
-
- /* If we've exhausted any levels that didn't have braces,
- pop them now. */
- while (constructor_stack->implicit)
- {
- if ((TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- && constructor_fields == 0)
- process_init_element (pop_init_level (1));
- else if (TREE_CODE (constructor_type) == ARRAY_TYPE
- && tree_int_cst_lt (constructor_max_index, constructor_index))
- process_init_element (pop_init_level (1));
- else
- break;
- }
-
- /* Structure elements may require alignment. Do this now if necessary
- for the subaggregate, and if it comes next in sequence. Don't do
- this for subaggregates that will go on the pending list. */
- if (constructor_incremental && constructor_type != 0
- && TREE_CODE (constructor_type) == RECORD_TYPE && constructor_fields
- && constructor_fields == constructor_unfilled_fields)
- {
- /* Advance to offset of this element. */
- if (! tree_int_cst_equal (constructor_bit_index,
- DECL_FIELD_BITPOS (constructor_fields)))
- {
- int next = (TREE_INT_CST_LOW
- (DECL_FIELD_BITPOS (constructor_fields))
- / BITS_PER_UNIT);
- int here = (TREE_INT_CST_LOW (constructor_bit_index)
- / BITS_PER_UNIT);
-
- assemble_zeros (next - here);
- }
- /* Indicate that we have now filled the structure up to the current
- field. */
- constructor_unfilled_fields = constructor_fields;
- }
-
- p = (struct constructor_stack *) xmalloc (sizeof (struct constructor_stack));
- p->type = constructor_type;
- p->fields = constructor_fields;
- p->index = constructor_index;
- p->range_end = constructor_range_end;
- p->max_index = constructor_max_index;
- p->unfilled_index = constructor_unfilled_index;
- p->unfilled_fields = constructor_unfilled_fields;
- p->bit_index = constructor_bit_index;
- p->elements = constructor_elements;
- p->constant = constructor_constant;
- p->simple = constructor_simple;
- p->erroneous = constructor_erroneous;
- p->pending_elts = constructor_pending_elts;
- p->depth = constructor_depth;
- p->replacement_value = 0;
- p->implicit = implicit;
- p->incremental = constructor_incremental;
- p->outer = 0;
- p->next = constructor_stack;
- constructor_stack = p;
-
- constructor_constant = 1;
- constructor_simple = 1;
- constructor_depth = SPELLING_DEPTH ();
- constructor_elements = 0;
- constructor_pending_elts = 0;
-
- /* Don't die if an entire brace-pair level is superfluous
- in the containing level. */
- if (constructor_type == 0)
- ;
- else if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- {
- /* Don't die if there are extra init elts at the end. */
- if (constructor_fields == 0)
- constructor_type = 0;
- else
- {
- constructor_type = TREE_TYPE (constructor_fields);
- push_member_name (constructor_fields);
- constructor_depth++;
- if (constructor_fields != constructor_unfilled_fields)
- constructor_incremental = 0;
- }
- }
- else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- constructor_type = TREE_TYPE (constructor_type);
- push_array_bounds (TREE_INT_CST_LOW (constructor_index));
- constructor_depth++;
- if (! tree_int_cst_equal (constructor_index, constructor_unfilled_index)
- || constructor_range_end != 0)
- constructor_incremental = 0;
- }
-
- if (constructor_type == 0)
- {
- error_init ("extra brace group at end of initializer%s",
- " for `%s'", NULL);
- constructor_fields = 0;
- constructor_unfilled_fields = 0;
- return;
- }
-
- /* Turn off constructor_incremental if type is a struct with bitfields. */
- check_init_type_bitfields (constructor_type);
-
- if (implicit && warn_missing_braces && !missing_braces_mentioned)
- {
- missing_braces_mentioned = 1;
- warning_init ("missing braces around initializer%s", " for `%s'", NULL);
- }
-
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- {
- constructor_fields = TYPE_FIELDS (constructor_type);
- /* Skip any nameless bit fields at the beginning. */
- while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields)
- && DECL_NAME (constructor_fields) == 0)
- constructor_fields = TREE_CHAIN (constructor_fields);
- constructor_unfilled_fields = constructor_fields;
- constructor_bit_index = copy_node (integer_zero_node);
- }
- else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- constructor_range_end = 0;
- if (TYPE_DOMAIN (constructor_type))
- {
- constructor_max_index
- = TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type));
- constructor_index
- = copy_node (TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
- }
- else
- constructor_index = copy_node (integer_zero_node);
- constructor_unfilled_index = copy_node (constructor_index);
- }
- else
- {
- warning_init ("braces around scalar initializer%s", " for `%s'", NULL);
- constructor_fields = constructor_type;
- constructor_unfilled_fields = constructor_type;
- }
-}
-
-/* Don't read a struct incrementally if it has any bitfields,
- because the incremental reading code doesn't know how to
- handle bitfields yet. */
-
-static void
-check_init_type_bitfields (type)
- tree type;
-{
- if (TREE_CODE (type) == RECORD_TYPE)
- {
- tree tail;
- for (tail = TYPE_FIELDS (type); tail;
- tail = TREE_CHAIN (tail))
- {
- if (DECL_C_BIT_FIELD (tail)
- /* This catches cases like `int foo : 8;'. */
- || DECL_MODE (tail) != TYPE_MODE (TREE_TYPE (tail)))
- {
- constructor_incremental = 0;
- break;
- }
-
- check_init_type_bitfields (TREE_TYPE (tail));
- }
- }
-
- else if (TREE_CODE (type) == ARRAY_TYPE)
- check_init_type_bitfields (TREE_TYPE (type));
-}
-
-/* At the end of an implicit or explicit brace level,
- finish up that level of constructor.
- If we were outputting the elements as they are read, return 0
- from inner levels (process_init_element ignores that),
- but return error_mark_node from the outermost level
- (that's what we want to put in DECL_INITIAL).
- Otherwise, return a CONSTRUCTOR expression. */
-
-tree
-pop_init_level (implicit)
- int implicit;
-{
- struct constructor_stack *p;
- int size = 0;
- tree constructor = 0;
-
- if (implicit == 0)
- {
- /* When we come to an explicit close brace,
- pop any inner levels that didn't have explicit braces. */
- while (constructor_stack->implicit)
- process_init_element (pop_init_level (1));
- }
-
- p = constructor_stack;
-
- if (constructor_type != 0)
- size = int_size_in_bytes (constructor_type);
-
- /* Now output all pending elements. */
- output_pending_init_elements (1);
-
-#if 0 /* c-parse.in warns about {}. */
- /* In ANSI, each brace level must have at least one element. */
- if (! implicit && pedantic
- && (TREE_CODE (constructor_type) == ARRAY_TYPE
- ? integer_zerop (constructor_unfilled_index)
- : constructor_unfilled_fields == TYPE_FIELDS (constructor_type)))
- pedwarn_init ("empty braces in initializer%s", " for `%s'", NULL);
-#endif
-
- /* Pad out the end of the structure. */
-
- if (p->replacement_value)
- {
- /* If this closes a superfluous brace pair,
- just pass out the element between them. */
- constructor = p->replacement_value;
- /* If this is the top level thing within the initializer,
- and it's for a variable, then since we already called
- assemble_variable, we must output the value now. */
- if (p->next == 0 && constructor_decl != 0
- && constructor_incremental)
- {
- constructor = digest_init (constructor_type, constructor,
- require_constant_value,
- require_constant_elements);
-
- /* If initializing an array of unknown size,
- determine the size now. */
- if (TREE_CODE (constructor_type) == ARRAY_TYPE
- && TYPE_DOMAIN (constructor_type) == 0)
- {
- int failure;
- int momentary_p;
-
- push_obstacks_nochange ();
- if (TREE_PERMANENT (constructor_type))
- end_temporary_allocation ();
-
- momentary_p = suspend_momentary ();
-
- /* We shouldn't have an incomplete array type within
- some other type. */
- if (constructor_stack->next)
- abort ();
-
- failure
- = complete_array_type (constructor_type,
- constructor, 0);
- if (failure)
- abort ();
-
- size = int_size_in_bytes (constructor_type);
- resume_momentary (momentary_p);
- pop_obstacks ();
- }
-
- output_constant (constructor, size);
- }
- }
- else if (constructor_type == 0)
- ;
- else if (TREE_CODE (constructor_type) != RECORD_TYPE
- && TREE_CODE (constructor_type) != UNION_TYPE
- && TREE_CODE (constructor_type) != ARRAY_TYPE
- && ! constructor_incremental)
- {
- /* A nonincremental scalar initializer--just return
- the element, after verifying there is just one. */
- if (constructor_elements == 0)
- {
- error_init ("empty scalar initializer%s",
- " for `%s'", NULL);
- constructor = error_mark_node;
- }
- else if (TREE_CHAIN (constructor_elements) != 0)
- {
- error_init ("extra elements in scalar initializer%s",
- " for `%s'", NULL);
- constructor = TREE_VALUE (constructor_elements);
- }
- else
- constructor = TREE_VALUE (constructor_elements);
- }
- else if (! constructor_incremental)
- {
- if (constructor_erroneous)
- constructor = error_mark_node;
- else
- {
- int momentary = suspend_momentary ();
-
- constructor = build (CONSTRUCTOR, constructor_type, NULL_TREE,
- nreverse (constructor_elements));
- if (constructor_constant)
- TREE_CONSTANT (constructor) = 1;
- if (constructor_constant && constructor_simple)
- TREE_STATIC (constructor) = 1;
-
- resume_momentary (momentary);
- }
- }
- else
- {
- tree filled;
- int momentary = suspend_momentary ();
-
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- {
- /* Find the offset of the end of that field. */
- filled = size_binop (CEIL_DIV_EXPR,
- constructor_bit_index,
- size_int (BITS_PER_UNIT));
- }
- else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- /* If initializing an array of unknown size,
- determine the size now. */
- if (TREE_CODE (constructor_type) == ARRAY_TYPE
- && TYPE_DOMAIN (constructor_type) == 0)
- {
- tree maxindex
- = size_binop (MINUS_EXPR,
- constructor_unfilled_index,
- integer_one_node);
-
- push_obstacks_nochange ();
- if (TREE_PERMANENT (constructor_type))
- end_temporary_allocation ();
- maxindex = copy_node (maxindex);
- TYPE_DOMAIN (constructor_type) = build_index_type (maxindex);
- TREE_TYPE (maxindex) = TYPE_DOMAIN (constructor_type);
-
- /* TYPE_MAX_VALUE is always one less than the number of elements
- in the array, because we start counting at zero. Therefore,
- warn only if the value is less than zero. */
- if (pedantic
- && (tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type)))
- < 0))
- error_with_decl (constructor_decl,
- "zero or negative array size `%s'");
- layout_type (constructor_type);
- size = int_size_in_bytes (constructor_type);
- pop_obstacks ();
- }
-
- filled = size_binop (MULT_EXPR, constructor_unfilled_index,
- size_in_bytes (TREE_TYPE (constructor_type)));
- }
- else
- filled = 0;
-
- if (filled != 0)
- assemble_zeros (size - TREE_INT_CST_LOW (filled));
-
- resume_momentary (momentary);
- }
-
-
- constructor_type = p->type;
- constructor_fields = p->fields;
- constructor_index = p->index;
- constructor_range_end = p->range_end;
- constructor_max_index = p->max_index;
- constructor_unfilled_index = p->unfilled_index;
- constructor_unfilled_fields = p->unfilled_fields;
- constructor_bit_index = p->bit_index;
- constructor_elements = p->elements;
- constructor_constant = p->constant;
- constructor_simple = p->simple;
- constructor_erroneous = p->erroneous;
- constructor_pending_elts = p->pending_elts;
- constructor_depth = p->depth;
- constructor_incremental = p->incremental;
- RESTORE_SPELLING_DEPTH (constructor_depth);
-
- constructor_stack = p->next;
- free (p);
-
- if (constructor == 0)
- {
- if (constructor_stack == 0)
- return error_mark_node;
- return NULL_TREE;
- }
- return constructor;
-}
-
-/* Within an array initializer, specify the next index to be initialized.
- FIRST is that index. If LAST is nonzero, then initialize a range
- of indices, running from FIRST through LAST. */
-
-void
-set_init_index (first, last)
- tree first, last;
-{
- while ((TREE_CODE (first) == NOP_EXPR
- || TREE_CODE (first) == CONVERT_EXPR
- || TREE_CODE (first) == NON_LVALUE_EXPR)
- && (TYPE_MODE (TREE_TYPE (first))
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (first, 0)))))
- (first) = TREE_OPERAND (first, 0);
- if (last)
- while ((TREE_CODE (last) == NOP_EXPR
- || TREE_CODE (last) == CONVERT_EXPR
- || TREE_CODE (last) == NON_LVALUE_EXPR)
- && (TYPE_MODE (TREE_TYPE (last))
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (last, 0)))))
- (last) = TREE_OPERAND (last, 0);
-
- if (TREE_CODE (first) != INTEGER_CST)
- error_init ("nonconstant array index in initializer%s", " for `%s'", NULL);
- else if (last != 0 && TREE_CODE (last) != INTEGER_CST)
- error_init ("nonconstant array index in initializer%s", " for `%s'", NULL);
- else if (! constructor_unfilled_index)
- error_init ("array index in non-array initializer%s", " for `%s'", NULL);
- else if (tree_int_cst_lt (first, constructor_unfilled_index))
- error_init ("duplicate array index in initializer%s", " for `%s'", NULL);
- else
- {
- TREE_INT_CST_LOW (constructor_index) = TREE_INT_CST_LOW (first);
- TREE_INT_CST_HIGH (constructor_index) = TREE_INT_CST_HIGH (first);
-
- if (last != 0 && tree_int_cst_lt (last, first))
- error_init ("empty index range in initializer%s", " for `%s'", NULL);
- else
- {
- if (pedantic)
- pedwarn ("ANSI C forbids specifying element to initialize");
- constructor_range_end = last;
- }
- }
-}
-
-/* Within a struct initializer, specify the next field to be initialized. */
-
-void
-set_init_label (fieldname)
- tree fieldname;
-{
- tree tail;
- int passed = 0;
-
- /* Don't die if an entire brace-pair level is superfluous
- in the containing level. */
- if (constructor_type == 0)
- return;
-
- for (tail = TYPE_FIELDS (constructor_type); tail;
- tail = TREE_CHAIN (tail))
- {
- if (tail == constructor_unfilled_fields)
- passed = 1;
- if (DECL_NAME (tail) == fieldname)
- break;
- }
-
- if (tail == 0)
- error ("unknown field `%s' specified in initializer",
- IDENTIFIER_POINTER (fieldname));
- else if (!passed)
- error ("field `%s' already initialized",
- IDENTIFIER_POINTER (fieldname));
- else
- {
- constructor_fields = tail;
- if (pedantic)
- pedwarn ("ANSI C forbids specifying structure member to initialize");
- }
-}
-
-/* "Output" the next constructor element.
- At top level, really output it to assembler code now.
- Otherwise, collect it in a list from which we will make a CONSTRUCTOR.
- TYPE is the data type that the containing data type wants here.
- FIELD is the field (a FIELD_DECL) or the index that this element fills.
-
- PENDING if non-nil means output pending elements that belong
- right after this element. (PENDING is normally 1;
- it is 0 while outputting pending elements, to avoid recursion.) */
-
-static void
-output_init_element (value, type, field, pending)
- tree value, type, field;
- int pending;
-{
- int duplicate = 0;
-
- if (TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE
- || (TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE
- && !(TREE_CODE (value) == STRING_CST
- && TREE_CODE (type) == ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE)
- && !comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (value)),
- TYPE_MAIN_VARIANT (type))))
- value = default_conversion (value);
-
- if (value == error_mark_node)
- constructor_erroneous = 1;
- else if (!TREE_CONSTANT (value))
- constructor_constant = 0;
- else if (initializer_constant_valid_p (value, TREE_TYPE (value)) == 0
- || ((TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- && DECL_C_BIT_FIELD (field)
- && TREE_CODE (value) != INTEGER_CST))
- constructor_simple = 0;
-
- if (require_constant_value && ! TREE_CONSTANT (value))
- {
- error_init ("initializer element%s is not constant",
- " for `%s'", NULL);
- value = error_mark_node;
- }
- else if (require_constant_elements
- && initializer_constant_valid_p (value, TREE_TYPE (value)) == 0)
- {
- error_init ("initializer element%s is not computable at load time",
- " for `%s'", NULL);
- value = error_mark_node;
- }
-
- /* If this element duplicates one on constructor_pending_elts,
- print a message and ignore it. Don't do this when we're
- processing elements taken off constructor_pending_elts,
- because we'd always get spurious errors. */
- if (pending)
- {
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- {
- if (purpose_member (field, constructor_pending_elts))
- {
- error_init ("duplicate initializer%s", " for `%s'", NULL);
- duplicate = 1;
- }
- }
- if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- tree tail;
- for (tail = constructor_pending_elts; tail;
- tail = TREE_CHAIN (tail))
- if (TREE_PURPOSE (tail) != 0
- && TREE_CODE (TREE_PURPOSE (tail)) == INTEGER_CST
- && tree_int_cst_equal (TREE_PURPOSE (tail), constructor_index))
- break;
-
- if (tail != 0)
- {
- error_init ("duplicate initializer%s", " for `%s'", NULL);
- duplicate = 1;
- }
- }
- }
-
- /* If this element doesn't come next in sequence,
- put it on constructor_pending_elts. */
- if (TREE_CODE (constructor_type) == ARRAY_TYPE
- && !tree_int_cst_equal (field, constructor_unfilled_index))
- {
- if (! duplicate)
- /* The copy_node is needed in case field is actually
- constructor_index, which is modified in place. */
- constructor_pending_elts
- = tree_cons (copy_node (field),
- digest_init (type, value, require_constant_value,
- require_constant_elements),
- constructor_pending_elts);
- }
- else if (TREE_CODE (constructor_type) == RECORD_TYPE
- && field != constructor_unfilled_fields)
- {
- /* We do this for records but not for unions. In a union,
- no matter which field is specified, it can be initialized
- right away since it starts at the beginning of the union. */
- if (!duplicate)
- constructor_pending_elts
- = tree_cons (field,
- digest_init (type, value, require_constant_value,
- require_constant_elements),
- constructor_pending_elts);
- }
- else
- {
- /* Otherwise, output this element either to
- constructor_elements or to the assembler file. */
-
- if (!duplicate)
- {
- if (! constructor_incremental)
- {
- if (field && TREE_CODE (field) == INTEGER_CST)
- field = copy_node (field);
- constructor_elements
- = tree_cons (field, digest_init (type, value,
- require_constant_value,
- require_constant_elements),
- constructor_elements);
- }
- else
- {
- /* Structure elements may require alignment.
- Do this, if necessary. */
- if (TREE_CODE (constructor_type) == RECORD_TYPE)
- {
- /* Advance to offset of this element. */
- if (! tree_int_cst_equal (constructor_bit_index,
- DECL_FIELD_BITPOS (field)))
- {
- int next = (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))
- / BITS_PER_UNIT);
- int here = (TREE_INT_CST_LOW (constructor_bit_index)
- / BITS_PER_UNIT);
-
- assemble_zeros (next - here);
- }
- }
- output_constant (digest_init (type, value,
- require_constant_value,
- require_constant_elements),
- int_size_in_bytes (type));
-
- /* For a record or union,
- keep track of end position of last field. */
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- {
- tree temp = size_binop (PLUS_EXPR, DECL_FIELD_BITPOS (field),
- DECL_SIZE (field));
- TREE_INT_CST_LOW (constructor_bit_index)
- = TREE_INT_CST_LOW (temp);
- TREE_INT_CST_HIGH (constructor_bit_index)
- = TREE_INT_CST_HIGH (temp);
- }
- }
- }
-
- /* Advance the variable that indicates sequential elements output. */
- if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- tree tem = size_binop (PLUS_EXPR, constructor_unfilled_index,
- integer_one_node);
- TREE_INT_CST_LOW (constructor_unfilled_index)
- = TREE_INT_CST_LOW (tem);
- TREE_INT_CST_HIGH (constructor_unfilled_index)
- = TREE_INT_CST_HIGH (tem);
- }
- else if (TREE_CODE (constructor_type) == RECORD_TYPE)
- constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields);
- else if (TREE_CODE (constructor_type) == UNION_TYPE)
- constructor_unfilled_fields = 0;
-
- /* Now output any pending elements which have become next. */
- if (pending)
- output_pending_init_elements (0);
- }
-}
-
-/* Output any pending elements which have become next.
- As we output elements, constructor_unfilled_{fields,index}
- advances, which may cause other elements to become next;
- if so, they too are output.
-
- If ALL is 0, we return when there are
- no more pending elements to output now.
-
- If ALL is 1, we output space as necessary so that
- we can output all the pending elements. */
-
-static void
-output_pending_init_elements (all)
- int all;
-{
- tree tail;
- tree next;
-
- retry:
-
- /* Look thru the whole pending list.
- If we find an element that should be output now,
- output it. Otherwise, set NEXT to the element
- that comes first among those still pending. */
-
- next = 0;
- for (tail = constructor_pending_elts; tail;
- tail = TREE_CHAIN (tail))
- {
- if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- if (tree_int_cst_equal (TREE_PURPOSE (tail),
- constructor_unfilled_index))
- {
- output_init_element (TREE_VALUE (tail),
- TREE_TYPE (constructor_type),
- constructor_unfilled_index, 0);
- goto retry;
- }
- else if (tree_int_cst_lt (TREE_PURPOSE (tail),
- constructor_unfilled_index))
- ;
- else if (next == 0
- || tree_int_cst_lt (TREE_PURPOSE (tail), next))
- next = TREE_PURPOSE (tail);
- }
- else if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- {
- if (TREE_PURPOSE (tail) == constructor_unfilled_fields)
- {
- output_init_element (TREE_VALUE (tail),
- TREE_TYPE (constructor_unfilled_fields),
- constructor_unfilled_fields,
- 0);
- goto retry;
- }
- else if (constructor_unfilled_fields == 0
- || tree_int_cst_lt (DECL_FIELD_BITPOS (TREE_PURPOSE (tail)),
- DECL_FIELD_BITPOS (constructor_unfilled_fields)))
- ;
- else if (next == 0
- || tree_int_cst_lt (DECL_FIELD_BITPOS (TREE_PURPOSE (tail)),
- DECL_FIELD_BITPOS (next)))
- next = TREE_PURPOSE (tail);
- }
- }
-
- /* Ordinarily return, but not if we want to output all
- and there are elements left. */
- if (! (all && next != 0))
- return;
-
- /* Generate space up to the position of NEXT. */
- if (constructor_incremental)
- {
- tree filled;
- tree nextpos_tree = size_int (0);
-
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- {
- /* Find the last field written out, if any. */
- for (tail = TYPE_FIELDS (constructor_type); tail;
- tail = TREE_CHAIN (tail))
- if (TREE_CHAIN (tail) == constructor_unfilled_fields)
- break;
-
- if (tail)
- /* Find the offset of the end of that field. */
- filled = size_binop (CEIL_DIV_EXPR,
- size_binop (PLUS_EXPR,
- DECL_FIELD_BITPOS (tail),
- DECL_SIZE (tail)),
- size_int (BITS_PER_UNIT));
- else
- filled = size_int (0);
-
- nextpos_tree = size_binop (CEIL_DIV_EXPR,
- DECL_FIELD_BITPOS (next),
- size_int (BITS_PER_UNIT));
-
- TREE_INT_CST_HIGH (constructor_bit_index)
- = TREE_INT_CST_HIGH (DECL_FIELD_BITPOS (next));
- TREE_INT_CST_LOW (constructor_bit_index)
- = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (next));
- constructor_unfilled_fields = next;
- }
- else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- filled = size_binop (MULT_EXPR, constructor_unfilled_index,
- size_in_bytes (TREE_TYPE (constructor_type)));
- nextpos_tree
- = size_binop (MULT_EXPR, next,
- size_in_bytes (TREE_TYPE (constructor_type)));
- TREE_INT_CST_LOW (constructor_unfilled_index)
- = TREE_INT_CST_LOW (next);
- TREE_INT_CST_HIGH (constructor_unfilled_index)
- = TREE_INT_CST_HIGH (next);
- }
- else
- filled = 0;
-
- if (filled)
- {
- int nextpos = TREE_INT_CST_LOW (nextpos_tree);
-
- assemble_zeros (nextpos - TREE_INT_CST_LOW (filled));
- }
- }
- else
- {
- /* If it's not incremental, just skip over the gap,
- so that after jumping to retry we will output the next
- successive element. */
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- constructor_unfilled_fields = next;
- else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- TREE_INT_CST_LOW (constructor_unfilled_index)
- = TREE_INT_CST_LOW (next);
- TREE_INT_CST_HIGH (constructor_unfilled_index)
- = TREE_INT_CST_HIGH (next);
- }
- }
-
- goto retry;
-}
-
-/* Add one non-braced element to the current constructor level.
- This adjusts the current position within the constructor's type.
- This may also start or terminate implicit levels
- to handle a partly-braced initializer.
-
- Once this has found the correct level for the new element,
- it calls output_init_element.
-
- Note: if we are incrementally outputting this constructor,
- this function may be called with a null argument
- representing a sub-constructor that was already incrementally output.
- When that happens, we output nothing, but we do the bookkeeping
- to skip past that element of the current constructor. */
-
-void
-process_init_element (value)
- tree value;
-{
- tree orig_value = value;
- int string_flag = value != 0 && TREE_CODE (value) == STRING_CST;
-
- /* Handle superfluous braces around string cst as in
- char x[] = {"foo"}; */
- if (string_flag
- && constructor_type
- && TREE_CODE (constructor_type) == ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (constructor_type)) == INTEGER_TYPE
- && integer_zerop (constructor_unfilled_index))
- {
- constructor_stack->replacement_value = value;
- return;
- }
-
- if (constructor_stack->replacement_value != 0)
- {
- error_init ("excess elements in struct initializer%s",
- " after `%s'", NULL_PTR);
- return;
- }
-
- /* Ignore elements of a brace group if it is entirely superfluous
- and has already been diagnosed. */
- if (constructor_type == 0)
- return;
-
- /* If we've exhausted any levels that didn't have braces,
- pop them now. */
- while (constructor_stack->implicit)
- {
- if ((TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- && constructor_fields == 0)
- process_init_element (pop_init_level (1));
- else if (TREE_CODE (constructor_type) == ARRAY_TYPE
- && (constructor_max_index == 0
- || tree_int_cst_lt (constructor_max_index,
- constructor_index)))
- process_init_element (pop_init_level (1));
- else
- break;
- }
-
- while (1)
- {
- if (TREE_CODE (constructor_type) == RECORD_TYPE)
- {
- tree fieldtype;
- enum tree_code fieldcode;
-
- if (constructor_fields == 0)
- {
- pedwarn_init ("excess elements in struct initializer%s",
- " after `%s'", NULL_PTR);
- break;
- }
-
- fieldtype = TREE_TYPE (constructor_fields);
- if (fieldtype != error_mark_node)
- fieldtype = TYPE_MAIN_VARIANT (fieldtype);
- fieldcode = TREE_CODE (fieldtype);
-
- /* Accept a string constant to initialize a subarray. */
- if (value != 0
- && fieldcode == ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (fieldtype)) == INTEGER_TYPE
- && string_flag)
- value = orig_value;
- /* Otherwise, if we have come to a subaggregate,
- and we don't have an element of its type, push into it. */
- else if (value != 0 && !constructor_no_implicit
- && value != error_mark_node
- && TYPE_MAIN_VARIANT (TREE_TYPE (value)) != fieldtype
- && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE
- || fieldcode == UNION_TYPE))
- {
- push_init_level (1);
- continue;
- }
-
- if (value)
- {
- push_member_name (constructor_fields);
- output_init_element (value, fieldtype, constructor_fields, 1);
- RESTORE_SPELLING_DEPTH (constructor_depth);
- }
- else
- /* Do the bookkeeping for an element that was
- directly output as a constructor. */
- {
- /* For a record, keep track of end position of last field. */
- tree temp = size_binop (PLUS_EXPR,
- DECL_FIELD_BITPOS (constructor_fields),
- DECL_SIZE (constructor_fields));
- TREE_INT_CST_LOW (constructor_bit_index)
- = TREE_INT_CST_LOW (temp);
- TREE_INT_CST_HIGH (constructor_bit_index)
- = TREE_INT_CST_HIGH (temp);
-
- constructor_unfilled_fields = TREE_CHAIN (constructor_fields);
- }
-
- constructor_fields = TREE_CHAIN (constructor_fields);
- /* Skip any nameless bit fields at the beginning. */
- while (constructor_fields != 0
- && DECL_C_BIT_FIELD (constructor_fields)
- && DECL_NAME (constructor_fields) == 0)
- constructor_fields = TREE_CHAIN (constructor_fields);
- break;
- }
- if (TREE_CODE (constructor_type) == UNION_TYPE)
- {
- tree fieldtype;
- enum tree_code fieldcode;
-
- if (constructor_fields == 0)
- {
- pedwarn_init ("excess elements in union initializer%s",
- " after `%s'", NULL_PTR);
- break;
- }
-
- fieldtype = TREE_TYPE (constructor_fields);
- if (fieldtype != error_mark_node)
- fieldtype = TYPE_MAIN_VARIANT (fieldtype);
- fieldcode = TREE_CODE (fieldtype);
-
- /* Accept a string constant to initialize a subarray. */
- if (value != 0
- && fieldcode == ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (fieldtype)) == INTEGER_TYPE
- && string_flag)
- value = orig_value;
- /* Otherwise, if we have come to a subaggregate,
- and we don't have an element of its type, push into it. */
- else if (value != 0 && !constructor_no_implicit
- && value != error_mark_node
- && TYPE_MAIN_VARIANT (TREE_TYPE (value)) != fieldtype
- && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE
- || fieldcode == UNION_TYPE))
- {
- push_init_level (1);
- continue;
- }
-
- if (value)
- {
- push_member_name (constructor_fields);
- output_init_element (value, fieldtype, constructor_fields, 1);
- RESTORE_SPELLING_DEPTH (constructor_depth);
- }
- else
- /* Do the bookkeeping for an element that was
- directly output as a constructor. */
- {
- TREE_INT_CST_LOW (constructor_bit_index)
- = TREE_INT_CST_LOW (DECL_SIZE (constructor_fields));
- TREE_INT_CST_HIGH (constructor_bit_index)
- = TREE_INT_CST_HIGH (DECL_SIZE (constructor_fields));
-
- constructor_unfilled_fields = TREE_CHAIN (constructor_fields);
- }
-
- constructor_fields = 0;
- break;
- }
- if (TREE_CODE (constructor_type) == ARRAY_TYPE)
- {
- tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
- enum tree_code eltcode = TREE_CODE (elttype);
-
- /* Accept a string constant to initialize a subarray. */
- if (value != 0
- && eltcode == ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (elttype)) == INTEGER_TYPE
- && string_flag)
- value = orig_value;
- /* Otherwise, if we have come to a subaggregate,
- and we don't have an element of its type, push into it. */
- else if (value != 0 && !constructor_no_implicit
- && value != error_mark_node
- && TYPE_MAIN_VARIANT (TREE_TYPE (value)) != elttype
- && (eltcode == RECORD_TYPE || eltcode == ARRAY_TYPE
- || eltcode == UNION_TYPE))
- {
- push_init_level (1);
- continue;
- }
-
- if (constructor_max_index != 0
- && tree_int_cst_lt (constructor_max_index, constructor_index))
- {
- pedwarn_init ("excess elements in array initializer%s",
- " after `%s'", NULL_PTR);
- break;
- }
-
- /* In the case of [LO .. HI] = VALUE, only evaluate VALUE once. */
- if (constructor_range_end)
- {
- if (constructor_max_index != 0
- && tree_int_cst_lt (constructor_max_index,
- constructor_range_end))
- {
- pedwarn_init ("excess elements in array initializer%s",
- " after `%s'", NULL_PTR);
- TREE_INT_CST_HIGH (constructor_range_end)
- = TREE_INT_CST_HIGH (constructor_max_index);
- TREE_INT_CST_LOW (constructor_range_end)
- = TREE_INT_CST_LOW (constructor_max_index);
- }
-
- value = save_expr (value);
- }
-
- /* Now output the actual element.
- Ordinarily, output once.
- If there is a range, repeat it till we advance past the range. */
- do
- {
- tree tem;
-
- if (value)
- {
- push_array_bounds (TREE_INT_CST_LOW (constructor_index));
- output_init_element (value, elttype, constructor_index, 1);
- RESTORE_SPELLING_DEPTH (constructor_depth);
- }
-
- tem = size_binop (PLUS_EXPR, constructor_index,
- integer_one_node);
- TREE_INT_CST_LOW (constructor_index) = TREE_INT_CST_LOW (tem);
- TREE_INT_CST_HIGH (constructor_index) = TREE_INT_CST_HIGH (tem);
-
- if (!value)
- /* If we are doing the bookkeeping for an element that was
- directly output as a constructor,
- we must update constructor_unfilled_index. */
- {
- TREE_INT_CST_LOW (constructor_unfilled_index)
- = TREE_INT_CST_LOW (constructor_index);
- TREE_INT_CST_HIGH (constructor_unfilled_index)
- = TREE_INT_CST_HIGH (constructor_index);
- }
- }
- while (! (constructor_range_end == 0
- || tree_int_cst_lt (constructor_range_end,
- constructor_index)));
-
- break;
- }
-
- /* Handle the sole element allowed in a braced initializer
- for a scalar variable. */
- if (constructor_fields == 0)
- {
- pedwarn_init ("excess elements in scalar initializer%s",
- " after `%s'", NULL_PTR);
- break;
- }
-
- if (value)
- output_init_element (value, constructor_type, NULL_TREE, 1);
- constructor_fields = 0;
- break;
- }
-
- /* If the (lexically) previous elments are not now saved,
- we can discard the storage for them. */
- if (constructor_incremental && constructor_pending_elts == 0 && value != 0
- && constructor_stack == 0)
- clear_momentary ();
-}
-
-/* Expand an ASM statement with operands, handling output operands
- that are not variables or INDIRECT_REFS by transforming such
- cases into cases that expand_asm_operands can handle.
-
- Arguments are same as for expand_asm_operands. */
-
-void
-c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
- tree string, outputs, inputs, clobbers;
- int vol;
- char *filename;
- int line;
-{
- int noutputs = list_length (outputs);
- register int i;
- /* o[I] is the place that output number I should be written. */
- register tree *o = (tree *) alloca (noutputs * sizeof (tree));
- register tree tail;
-
- if (TREE_CODE (string) == ADDR_EXPR)
- string = TREE_OPERAND (string, 0);
- if (TREE_CODE (string) != STRING_CST)
- {
- error ("asm template is not a string constant");
- return;
- }
-
- /* Record the contents of OUTPUTS before it is modified. */
- for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
- o[i] = TREE_VALUE (tail);
-
- /* Perform default conversions on array and function inputs. */
- /* Don't do this for other types--
- it would screw up operands expected to be in memory. */
- for (i = 0, tail = inputs; tail; tail = TREE_CHAIN (tail), i++)
- if (TREE_CODE (TREE_TYPE (TREE_VALUE (tail))) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (TREE_VALUE (tail))) == FUNCTION_TYPE)
- TREE_VALUE (tail) = default_conversion (TREE_VALUE (tail));
-
- /* Generate the ASM_OPERANDS insn;
- store into the TREE_VALUEs of OUTPUTS some trees for
- where the values were actually stored. */
- expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line);
-
- /* Copy all the intermediate outputs into the specified outputs. */
- for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
- {
- if (o[i] != TREE_VALUE (tail))
- {
- expand_expr (build_modify_expr (o[i], NOP_EXPR, TREE_VALUE (tail)),
- 0, VOIDmode, 0);
- free_temp_slots ();
- }
- /* Detect modification of read-only values.
- (Otherwise done by build_modify_expr.) */
- else
- {
- tree type = TREE_TYPE (o[i]);
- if (TREE_READONLY (o[i])
- || TYPE_READONLY (type)
- || ((TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE)
- && C_TYPE_FIELDS_READONLY (type)))
- readonly_warning (o[i], "modification by `asm'");
- }
- }
-
- /* Those MODIFY_EXPRs could do autoincrements. */
- emit_queue ();
-}
-
-/* Expand a C `return' statement.
- RETVAL is the expression for what to return,
- or a null pointer for `return;' with no value. */
-
-void
-c_expand_return (retval)
- tree retval;
-{
- tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl));
-
- if (TREE_THIS_VOLATILE (current_function_decl))
- warning ("function declared `noreturn' has a `return' statement");
-
- if (!retval)
- {
- current_function_returns_null = 1;
- if (warn_return_type && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
- warning ("`return' with no value, in function returning non-void");
- expand_null_return ();
- }
- else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE)
- {
- current_function_returns_null = 1;
- if (pedantic || TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE)
- pedwarn ("`return' with a value, in function returning void");
- expand_return (retval);
- }
- else
- {
- tree t = convert_for_assignment (valtype, retval, "return",
- NULL_TREE, NULL_TREE, 0);
- tree res = DECL_RESULT (current_function_decl);
- tree inner;
-
- if (t == error_mark_node)
- return;
-
- inner = t = convert (TREE_TYPE (res), t);
-
- /* Strip any conversions, additions, and subtractions, and see if
- we are returning the address of a local variable. Warn if so. */
- while (1)
- {
- switch (TREE_CODE (inner))
- {
- case NOP_EXPR: case NON_LVALUE_EXPR: case CONVERT_EXPR:
- case PLUS_EXPR:
- inner = TREE_OPERAND (inner, 0);
- continue;
-
- case MINUS_EXPR:
- /* If the second operand of the MINUS_EXPR has a pointer
- type (or is converted from it), this may be valid, so
- don't give a warning. */
- {
- tree op1 = TREE_OPERAND (inner, 1);
-
- while (! POINTER_TYPE_P (TREE_TYPE (op1))
- && (TREE_CODE (op1) == NOP_EXPR
- || TREE_CODE (op1) == NON_LVALUE_EXPR
- || TREE_CODE (op1) == CONVERT_EXPR))
- op1 = TREE_OPERAND (op1, 0);
-
- if (POINTER_TYPE_P (TREE_TYPE (op1)))
- break;
-
- inner = TREE_OPERAND (inner, 0);
- continue;
- }
-
- case ADDR_EXPR:
- inner = TREE_OPERAND (inner, 0);
-
- while (TREE_CODE_CLASS (TREE_CODE (inner)) == 'r')
- inner = TREE_OPERAND (inner, 0);
-
- if (TREE_CODE (inner) == VAR_DECL
- && ! DECL_EXTERNAL (inner)
- && ! TREE_STATIC (inner)
- && DECL_CONTEXT (inner) == current_function_decl)
- warning ("function returns address of local variable");
- break;
- }
-
- break;
- }
-
- t = build (MODIFY_EXPR, TREE_TYPE (res), res, t);
- TREE_SIDE_EFFECTS (t) = 1;
- expand_return (t);
- current_function_returns_value = 1;
- }
-}
-
-/* Start a C switch statement, testing expression EXP.
- Return EXP if it is valid, an error node otherwise. */
-
-tree
-c_expand_start_case (exp)
- tree exp;
-{
- register enum tree_code code = TREE_CODE (TREE_TYPE (exp));
- tree type = TREE_TYPE (exp);
-
- if (code != INTEGER_TYPE && code != ENUMERAL_TYPE && code != ERROR_MARK)
- {
- error ("switch quantity not an integer");
- exp = error_mark_node;
- }
- else
- {
- tree index;
- type = TYPE_MAIN_VARIANT (TREE_TYPE (exp));
-
- if (warn_traditional
- && (type == long_integer_type_node
- || type == long_unsigned_type_node))
- pedwarn ("`long' switch expression not converted to `int' in ANSI C");
-
- exp = default_conversion (exp);
- type = TREE_TYPE (exp);
- index = get_unwidened (exp, NULL_TREE);
- /* We can't strip a conversion from a signed type to an unsigned,
- because if we did, int_fits_type_p would do the wrong thing
- when checking case values for being in range,
- and it's too hard to do the right thing. */
- if (TREE_UNSIGNED (TREE_TYPE (exp))
- == TREE_UNSIGNED (TREE_TYPE (index)))
- exp = index;
- }
-
- expand_start_case (1, exp, type, "switch statement");
-
- return exp;
-}
diff --git a/gcc/caller-save.c b/gcc/caller-save.c
deleted file mode 100644
index ea5923d370d..00000000000
--- a/gcc/caller-save.c
+++ /dev/null
@@ -1,771 +0,0 @@
-/* Save and restore call-clobbered registers which are live across a call.
- Copyright (C) 1989, 1992, 1994, 1995, 1997 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. */
-
-#include "config.h"
-#include "rtl.h"
-#include "insn-config.h"
-#include "flags.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "recog.h"
-#include "basic-block.h"
-#include "reload.h"
-#include "expr.h"
-
-#ifndef MAX_MOVE_MAX
-#define MAX_MOVE_MAX MOVE_MAX
-#endif
-
-#ifndef MIN_UNITS_PER_WORD
-#define MIN_UNITS_PER_WORD UNITS_PER_WORD
-#endif
-
-/* Modes for each hard register that we can save. The smallest mode is wide
- enough to save the entire contents of the register. When saving the
- register because it is live we first try to save in multi-register modes.
- If that is not possible the save is done one register at a time. */
-
-static enum machine_mode
- regno_save_mode[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1];
-
-/* For each hard register, a place on the stack where it can be saved,
- if needed. */
-
-static rtx
- regno_save_mem[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1];
-
-/* We will only make a register eligible for caller-save if it can be
- saved in its widest mode with a simple SET insn as long as the memory
- address is valid. We record the INSN_CODE is those insns here since
- when we emit them, the addresses might not be valid, so they might not
- be recognized. */
-
-static enum insn_code
- reg_save_code[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1];
-static enum insn_code
- reg_restore_code[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1];
-
-/* Set of hard regs currently live (during scan of all insns). */
-
-static HARD_REG_SET hard_regs_live;
-
-/* Set of hard regs currently residing in save area (during insn scan). */
-
-static HARD_REG_SET hard_regs_saved;
-
-/* Set of hard regs which need to be restored before referenced. */
-
-static HARD_REG_SET hard_regs_need_restore;
-
-/* Number of registers currently in hard_regs_saved. */
-
-int n_regs_saved;
-
-static void set_reg_live PROTO((rtx, rtx));
-static void clear_reg_live PROTO((rtx));
-static void restore_referenced_regs PROTO((rtx, rtx, enum machine_mode));
-static int insert_save_restore PROTO((rtx, int, int,
- enum machine_mode, int));
-
-/* Initialize for caller-save.
-
- Look at all the hard registers that are used by a call and for which
- regclass.c has not already excluded from being used across a call.
-
- Ensure that we can find a mode to save the register and that there is a
- simple insn to save and restore the register. This latter check avoids
- problems that would occur if we tried to save the MQ register of some
- machines directly into memory. */
-
-void
-init_caller_save ()
-{
- char *first_obj = (char *) oballoc (0);
- rtx addr_reg;
- int offset;
- rtx address;
- int i, j;
-
- /* First find all the registers that we need to deal with and all
- the modes that they can have. If we can't find a mode to use,
- we can't have the register live over calls. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (call_used_regs[i] && ! call_fixed_regs[i])
- {
- for (j = 1; j <= MOVE_MAX / UNITS_PER_WORD; j++)
- {
- regno_save_mode[i][j] = choose_hard_reg_mode (i, j);
- if (regno_save_mode[i][j] == VOIDmode && j == 1)
- {
- call_fixed_regs[i] = 1;
- SET_HARD_REG_BIT (call_fixed_reg_set, i);
- }
- }
- }
- else
- regno_save_mode[i][1] = VOIDmode;
- }
-
- /* The following code tries to approximate the conditions under which
- we can easily save and restore a register without scratch registers or
- other complexities. It will usually work, except under conditions where
- the validity of an insn operand is dependent on the address offset.
- No such cases are currently known.
-
- We first find a typical offset from some BASE_REG_CLASS register.
- This address is chosen by finding the first register in the class
- and by finding the smallest power of two that is a valid offset from
- that register in every mode we will use to save registers. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (TEST_HARD_REG_BIT (reg_class_contents[(int) BASE_REG_CLASS], i))
- break;
-
- if (i == FIRST_PSEUDO_REGISTER)
- abort ();
-
- addr_reg = gen_rtx (REG, Pmode, i);
-
- for (offset = 1 << (HOST_BITS_PER_INT / 2); offset; offset >>= 1)
- {
- address = gen_rtx (PLUS, Pmode, addr_reg, GEN_INT (offset));
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (regno_save_mode[i][1] != VOIDmode
- && ! strict_memory_address_p (regno_save_mode[i][1], address))
- break;
-
- if (i == FIRST_PSEUDO_REGISTER)
- break;
- }
-
- /* If we didn't find a valid address, we must use register indirect. */
- if (offset == 0)
- address = addr_reg;
-
- /* Next we try to form an insn to save and restore the register. We
- see if such an insn is recognized and meets its constraints. */
-
- start_sequence ();
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- for (j = 1; j <= MOVE_MAX / UNITS_PER_WORD; j++)
- if (regno_save_mode[i][j] != VOIDmode)
- {
- rtx mem = gen_rtx (MEM, regno_save_mode[i][j], address);
- rtx reg = gen_rtx (REG, regno_save_mode[i][j], i);
- rtx savepat = gen_rtx (SET, VOIDmode, mem, reg);
- rtx restpat = gen_rtx (SET, VOIDmode, reg, mem);
- rtx saveinsn = emit_insn (savepat);
- rtx restinsn = emit_insn (restpat);
- int ok;
-
- reg_save_code[i][j] = recog_memoized (saveinsn);
- reg_restore_code[i][j] = recog_memoized (restinsn);
-
- /* Now extract both insns and see if we can meet their
- constraints. */
- ok = (reg_save_code[i][j] != -1 && reg_restore_code[i][j] != -1);
- if (ok)
- {
- insn_extract (saveinsn);
- ok = constrain_operands (reg_save_code[i][j], 1);
- insn_extract (restinsn);
- ok &= constrain_operands (reg_restore_code[i][j], 1);
- }
-
- if (! ok)
- {
- regno_save_mode[i][j] = VOIDmode;
- if (j == 1)
- {
- call_fixed_regs[i] = 1;
- SET_HARD_REG_BIT (call_fixed_reg_set, i);
- }
- }
- }
-
- end_sequence ();
-
- obfree (first_obj);
-}
-
-/* Initialize save areas by showing that we haven't allocated any yet. */
-
-void
-init_save_areas ()
-{
- int i, j;
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- for (j = 1; j <= MOVE_MAX / UNITS_PER_WORD; j++)
- regno_save_mem[i][j] = 0;
-}
-
-/* Allocate save areas for any hard registers that might need saving.
- We take a conservative approach here and look for call-clobbered hard
- registers that are assigned to pseudos that cross calls. This may
- overestimate slightly (especially if some of these registers are later
- used as spill registers), but it should not be significant.
-
- Then perform register elimination in the addresses of the save area
- locations; return 1 if all eliminated addresses are strictly valid.
- We assume that our caller has set up the elimination table to the
- worst (largest) possible offsets.
-
- Set *PCHANGED to 1 if we had to allocate some memory for the save area.
-
- Future work:
-
- In the fallback case we should iterate backwards across all possible
- modes for the save, choosing the largest available one instead of
- falling back to the smallest mode immediately. (eg TF -> DF -> SF).
-
- We do not try to use "move multiple" instructions that exist
- on some machines (such as the 68k moveml). It could be a win to try
- and use them when possible. The hard part is doing it in a way that is
- machine independent since they might be saving non-consecutive
- registers. (imagine caller-saving d0,d1,a0,a1 on the 68k) */
-
-int
-setup_save_areas (pchanged)
- int *pchanged;
-{
- int i, j, k;
- HARD_REG_SET hard_regs_used;
- int ok = 1;
-
-
- /* Allocate space in the save area for the largest multi-register
- pseudos first, then work backwards to single register
- pseudos. */
-
- /* Find and record all call-used hard-registers in this function. */
- CLEAR_HARD_REG_SET (hard_regs_used);
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_renumber[i] >= 0 && reg_n_calls_crossed[i] > 0)
- {
- int regno = reg_renumber[i];
- int endregno
- = regno + HARD_REGNO_NREGS (regno, GET_MODE (regno_reg_rtx[i]));
- int nregs = endregno - regno;
-
- for (j = 0; j < nregs; j++)
- {
- if (call_used_regs[regno+j])
- SET_HARD_REG_BIT (hard_regs_used, regno+j);
- }
- }
-
- /* Now run through all the call-used hard-registers and allocate
- space for them in the caller-save area. Try to allocate space
- in a manner which allows multi-register saves/restores to be done. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- for (j = MOVE_MAX / UNITS_PER_WORD; j > 0; j--)
- {
- int ok = 1;
- int do_save;
-
- /* If no mode exists for this size, try another. Also break out
- if we have already saved this hard register. */
- if (regno_save_mode[i][j] == VOIDmode || regno_save_mem[i][1] != 0)
- continue;
-
- /* See if any register in this group has been saved. */
- do_save = 1;
- for (k = 0; k < j; k++)
- if (regno_save_mem[i + k][1])
- {
- do_save = 0;
- break;
- }
- if (! do_save)
- continue;
-
- for (k = 0; k < j; k++)
- {
- int regno = i + k;
- ok &= (TEST_HARD_REG_BIT (hard_regs_used, regno) != 0);
- }
-
- /* We have found an acceptable mode to store in. */
- if (ok)
- {
-
- regno_save_mem[i][j]
- = assign_stack_local (regno_save_mode[i][j],
- GET_MODE_SIZE (regno_save_mode[i][j]), 0);
-
- /* Setup single word save area just in case... */
- for (k = 0; k < j; k++)
- {
- /* This should not depend on WORDS_BIG_ENDIAN.
- The order of words in regs is the same as in memory. */
- rtx temp = gen_rtx (MEM, regno_save_mode[i+k][1],
- XEXP (regno_save_mem[i][j], 0));
-
- regno_save_mem[i+k][1]
- = adj_offsettable_operand (temp, k * UNITS_PER_WORD);
- }
- *pchanged = 1;
- }
- }
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- for (j = 1; j <= MOVE_MAX / UNITS_PER_WORD; j++)
- if (regno_save_mem[i][j] != 0)
- ok &= strict_memory_address_p (GET_MODE (regno_save_mem[i][j]),
- XEXP (eliminate_regs (regno_save_mem[i][j], 0, NULL_RTX, 1), 0));
-
- return ok;
-}
-
-/* Find the places where hard regs are live across calls and save them.
-
- INSN_MODE is the mode to assign to any insns that we add. This is used
- by reload to determine whether or not reloads or register eliminations
- need be done on these insns. */
-
-void
-save_call_clobbered_regs (insn_mode)
- enum machine_mode insn_mode;
-{
- rtx insn;
- int b;
-
- for (b = 0; b < n_basic_blocks; b++)
- {
- regset regs_live = basic_block_live_at_start[b];
- rtx prev_block_last = PREV_INSN (basic_block_head[b]);
- REGSET_ELT_TYPE bit;
- int offset, i, j;
- int regno;
-
- /* Compute hard regs live at start of block -- this is the
- real hard regs marked live, plus live pseudo regs that
- have been renumbered to hard regs. No registers have yet been
- saved because we restore all of them before the end of the basic
- block. */
-
-#ifdef HARD_REG_SET
- hard_regs_live = *regs_live;
-#else
- COPY_HARD_REG_SET (hard_regs_live, regs_live);
-#endif
-
- CLEAR_HARD_REG_SET (hard_regs_saved);
- CLEAR_HARD_REG_SET (hard_regs_need_restore);
- n_regs_saved = 0;
-
- for (offset = 0, i = 0; offset < regset_size; offset++)
- {
- if (regs_live[offset] == 0)
- i += REGSET_ELT_BITS;
- else
- for (bit = 1; bit && i < max_regno; bit <<= 1, i++)
- if ((regs_live[offset] & bit)
- && (regno = reg_renumber[i]) >= 0)
- for (j = regno;
- j < regno + HARD_REGNO_NREGS (regno,
- PSEUDO_REGNO_MODE (i));
- j++)
- SET_HARD_REG_BIT (hard_regs_live, j);
-
- }
-
- /* Now scan the insns in the block, keeping track of what hard
- regs are live as we go. When we see a call, save the live
- call-clobbered hard regs. */
-
- for (insn = basic_block_head[b]; ; insn = NEXT_INSN (insn))
- {
- RTX_CODE code = GET_CODE (insn);
-
- if (GET_RTX_CLASS (code) == 'i')
- {
- rtx link;
-
- /* If some registers have been saved, see if INSN references
- any of them. We must restore them before the insn if so. */
-
- if (n_regs_saved)
- restore_referenced_regs (PATTERN (insn), insn, insn_mode);
-
- /* NB: the normal procedure is to first enliven any
- registers set by insn, then deaden any registers that
- had their last use at insn. This is incorrect now,
- since multiple pseudos may have been mapped to the
- same hard reg, and the death notes are ambiguous. So
- it must be done in the other, safe, order. */
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_DEAD)
- clear_reg_live (XEXP (link, 0));
-
- /* When we reach a call, we need to save all registers that are
- live, call-used, not fixed, and not already saved. We must
- test at this point because registers that die in a CALL_INSN
- are not live across the call and likewise for registers that
- are born in the CALL_INSN.
-
- If registers are filled with parameters for this function,
- and some of these are also being set by this function, then
- they will not appear to die (no REG_DEAD note for them),
- to check if in fact they do, collect the set registers in
- hard_regs_live first. */
-
- if (code == CALL_INSN)
- {
- HARD_REG_SET this_call_sets;
- {
- HARD_REG_SET old_hard_regs_live;
-
- /* Save the hard_regs_live information. */
- COPY_HARD_REG_SET (old_hard_regs_live, hard_regs_live);
-
- /* Now calculate hard_regs_live for this CALL_INSN
- only. */
- CLEAR_HARD_REG_SET (hard_regs_live);
- note_stores (PATTERN (insn), set_reg_live);
- COPY_HARD_REG_SET (this_call_sets, hard_regs_live);
-
- /* Restore the hard_regs_live information. */
- COPY_HARD_REG_SET (hard_regs_live, old_hard_regs_live);
- }
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (call_used_regs[regno] && ! call_fixed_regs[regno]
- && TEST_HARD_REG_BIT (hard_regs_live, regno)
- /* It must not be set by this instruction. */
- && ! TEST_HARD_REG_BIT (this_call_sets, regno)
- && ! TEST_HARD_REG_BIT (hard_regs_saved, regno))
- regno += insert_save_restore (insn, 1, regno,
- insn_mode, 0);
-
- /* Put the information for this CALL_INSN on top of what
- we already had. */
- IOR_HARD_REG_SET (hard_regs_live, this_call_sets);
- COPY_HARD_REG_SET (hard_regs_need_restore, hard_regs_saved);
-
- /* Must recompute n_regs_saved. */
- n_regs_saved = 0;
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (TEST_HARD_REG_BIT (hard_regs_saved, regno))
- n_regs_saved++;
- }
- else
- {
- note_stores (PATTERN (insn), set_reg_live);
-#ifdef AUTO_INC_DEC
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC)
- set_reg_live (XEXP (link, 0), NULL_RTX);
-#endif
- }
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_UNUSED)
- clear_reg_live (XEXP (link, 0));
- }
-
- if (insn == basic_block_end[b])
- break;
- }
-
- /* At the end of the basic block, we must restore any registers that
- remain saved. If the last insn in the block is a JUMP_INSN, put
- the restore before the insn, otherwise, put it after the insn. */
-
- if (n_regs_saved)
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (TEST_HARD_REG_BIT (hard_regs_need_restore, regno))
- regno += insert_save_restore ((GET_CODE (insn) == JUMP_INSN
- ? insn : NEXT_INSN (insn)), 0,
- regno, insn_mode, MOVE_MAX / UNITS_PER_WORD);
-
- /* If we added any insns at the start of the block, update the start
- of the block to point at those insns. */
- basic_block_head[b] = NEXT_INSN (prev_block_last);
- }
-}
-
-/* Here from note_stores when an insn stores a value in a register.
- Set the proper bit or bits in hard_regs_live. All pseudos that have
- been assigned hard regs have had their register number changed already,
- so we can ignore pseudos. */
-
-static void
-set_reg_live (reg, setter)
- rtx reg, setter;
-{
- register int regno, endregno, i;
- enum machine_mode mode = GET_MODE (reg);
- int word = 0;
-
- if (GET_CODE (reg) == SUBREG)
- {
- word = SUBREG_WORD (reg);
- reg = SUBREG_REG (reg);
- }
-
- if (GET_CODE (reg) != REG || REGNO (reg) >= FIRST_PSEUDO_REGISTER)
- return;
-
- regno = REGNO (reg) + word;
- endregno = regno + HARD_REGNO_NREGS (regno, mode);
-
- for (i = regno; i < endregno; i++)
- {
- SET_HARD_REG_BIT (hard_regs_live, i);
- CLEAR_HARD_REG_BIT (hard_regs_saved, i);
- CLEAR_HARD_REG_BIT (hard_regs_need_restore, i);
- }
-}
-
-/* Here when a REG_DEAD note records the last use of a reg. Clear
- the appropriate bit or bits in hard_regs_live. Again we can ignore
- pseudos. */
-
-static void
-clear_reg_live (reg)
- rtx reg;
-{
- register int regno, endregno, i;
-
- if (GET_CODE (reg) != REG || REGNO (reg) >= FIRST_PSEUDO_REGISTER)
- return;
-
- regno = REGNO (reg);
- endregno= regno + HARD_REGNO_NREGS (regno, GET_MODE (reg));
-
- for (i = regno; i < endregno; i++)
- {
- CLEAR_HARD_REG_BIT (hard_regs_live, i);
- CLEAR_HARD_REG_BIT (hard_regs_need_restore, i);
- CLEAR_HARD_REG_BIT (hard_regs_saved, i);
- }
-}
-
-/* If any register currently residing in the save area is referenced in X,
- which is part of INSN, emit code to restore the register in front of INSN.
- INSN_MODE is the mode to assign to any insns that we add. */
-
-static void
-restore_referenced_regs (x, insn, insn_mode)
- rtx x;
- rtx insn;
- enum machine_mode insn_mode;
-{
- enum rtx_code code = GET_CODE (x);
- char *fmt;
- int i, j;
-
- if (code == CLOBBER)
- return;
-
- if (code == REG)
- {
- int regno = REGNO (x);
-
- /* If this is a pseudo, scan its memory location, since it might
- involve the use of another register, which might be saved. */
-
- if (regno >= FIRST_PSEUDO_REGISTER
- && reg_equiv_mem[regno] != 0)
- restore_referenced_regs (XEXP (reg_equiv_mem[regno], 0),
- insn, insn_mode);
- else if (regno >= FIRST_PSEUDO_REGISTER
- && reg_equiv_address[regno] != 0)
- restore_referenced_regs (reg_equiv_address[regno],
- insn, insn_mode);
-
- /* Otherwise if this is a hard register, restore any piece of it that
- is currently saved. */
-
- else if (regno < FIRST_PSEUDO_REGISTER)
- {
- int numregs = HARD_REGNO_NREGS (regno, GET_MODE (x));
- /* Save at most SAVEREGS at a time. This can not be larger than
- MOVE_MAX, because that causes insert_save_restore to fail. */
- int saveregs = MIN (numregs, MOVE_MAX / UNITS_PER_WORD);
- int endregno = regno + numregs;
-
- for (i = regno; i < endregno; i++)
- if (TEST_HARD_REG_BIT (hard_regs_need_restore, i))
- i += insert_save_restore (insn, 0, i, insn_mode, saveregs);
- }
-
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- restore_referenced_regs (XEXP (x, i), insn, insn_mode);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- restore_referenced_regs (XVECEXP (x, i, j), insn, insn_mode);
- }
-}
-
-/* Insert a sequence of insns to save or restore, SAVE_P says which,
- REGNO. Place these insns in front of INSN. INSN_MODE is the mode
- to assign to these insns. MAXRESTORE is the maximum number of registers
- which should be restored during this call (when SAVE_P == 0). It should
- never be less than 1 since we only work with entire registers.
-
- Note that we have verified in init_caller_save that we can do this
- with a simple SET, so use it. Set INSN_CODE to what we save there
- since the address might not be valid so the insn might not be recognized.
- These insns will be reloaded and have register elimination done by
- find_reload, so we need not worry about that here.
-
- Return the extra number of registers saved. */
-
-static int
-insert_save_restore (insn, save_p, regno, insn_mode, maxrestore)
- rtx insn;
- int save_p;
- int regno;
- enum machine_mode insn_mode;
- int maxrestore;
-{
- rtx pat;
- enum insn_code code;
- int i, numregs;
-
- /* A common failure mode if register status is not correct in the RTL
- is for this routine to be called with a REGNO we didn't expect to
- save. That will cause us to write an insn with a (nil) SET_DEST
- or SET_SRC. Instead of doing so and causing a crash later, check
- for this common case and abort here instead. This will remove one
- step in debugging such problems. */
-
- if (regno_save_mem[regno][1] == 0)
- abort ();
-
-#ifdef HAVE_cc0
- /* If INSN references CC0, put our insns in front of the insn that sets
- CC0. This is always safe, since the only way we could be passed an
- insn that references CC0 is for a restore, and doing a restore earlier
- isn't a problem. We do, however, assume here that CALL_INSNs don't
- reference CC0. Guard against non-INSN's like CODE_LABEL. */
-
- if ((GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN)
- && reg_referenced_p (cc0_rtx, PATTERN (insn)))
- insn = prev_nonnote_insn (insn);
-#endif
-
- /* Get the pattern to emit and update our status. */
- if (save_p)
- {
- int i, j, k;
- int ok;
-
- /* See if we can save several registers with a single instruction.
- Work backwards to the single register case. */
- for (i = MOVE_MAX / UNITS_PER_WORD; i > 0; i--)
- {
- ok = 1;
- if (regno_save_mem[regno][i] != 0)
- for (j = 0; j < i; j++)
- {
- if (! call_used_regs[regno + j] || call_fixed_regs[regno + j]
- || ! TEST_HARD_REG_BIT (hard_regs_live, regno + j)
- || TEST_HARD_REG_BIT (hard_regs_saved, regno + j))
- ok = 0;
- }
- else
- continue;
-
- /* Must do this one save at a time */
- if (! ok)
- continue;
-
- pat = gen_rtx (SET, VOIDmode, regno_save_mem[regno][i],
- gen_rtx (REG, GET_MODE (regno_save_mem[regno][i]), regno));
- code = reg_save_code[regno][i];
-
- /* Set hard_regs_saved for all the registers we saved. */
- for (k = 0; k < i; k++)
- {
- SET_HARD_REG_BIT (hard_regs_saved, regno + k);
- SET_HARD_REG_BIT (hard_regs_need_restore, regno + k);
- n_regs_saved++;
- }
-
- numregs = i;
- break;
- }
- }
- else
- {
- int i, j, k;
- int ok;
-
- /* See if we can restore `maxrestore' registers at once. Work
- backwards to the single register case. */
- for (i = maxrestore; i > 0; i--)
- {
- ok = 1;
- if (regno_save_mem[regno][i])
- for (j = 0; j < i; j++)
- {
- if (! TEST_HARD_REG_BIT (hard_regs_need_restore, regno + j))
- ok = 0;
- }
- else
- continue;
-
- /* Must do this one restore at a time */
- if (! ok)
- continue;
-
- pat = gen_rtx (SET, VOIDmode,
- gen_rtx (REG, GET_MODE (regno_save_mem[regno][i]),
- regno),
- regno_save_mem[regno][i]);
- code = reg_restore_code[regno][i];
-
-
- /* Clear status for all registers we restored. */
- for (k = 0; k < i; k++)
- {
- CLEAR_HARD_REG_BIT (hard_regs_need_restore, regno + k);
- n_regs_saved--;
- }
-
- numregs = i;
- break;
- }
- }
- /* Emit the insn and set the code and mode. */
-
- insn = emit_insn_before (pat, insn);
- PUT_MODE (insn, insn_mode);
- INSN_CODE (insn) = code;
-
- /* Tell our callers how many extra registers we saved/restored */
- return numregs - 1;
-}
diff --git a/gcc/calls.c b/gcc/calls.c
deleted file mode 100644
index d7c4c312c5f..00000000000
--- a/gcc/calls.c
+++ /dev/null
@@ -1,3212 +0,0 @@
-/* Convert function calls to rtl insns, for GNU C compiler.
- Copyright (C) 1989, 92, 93, 94, 95, 96, 1997 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. */
-
-#include "config.h"
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "expr.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "insn-flags.h"
-
-/* Decide whether a function's arguments should be processed
- from first to last or from last to first.
-
- They should if the stack and args grow in opposite directions, but
- only if we have push insns. */
-
-#ifdef PUSH_ROUNDING
-
-#if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD)
-#define PUSH_ARGS_REVERSED /* If it's last to first */
-#endif
-
-#endif
-
-/* Like STACK_BOUNDARY but in units of bytes, not bits. */
-#define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
-
-/* Data structure and subroutines used within expand_call. */
-
-struct arg_data
-{
- /* Tree node for this argument. */
- tree tree_value;
- /* Mode for value; TYPE_MODE unless promoted. */
- enum machine_mode mode;
- /* Current RTL value for argument, or 0 if it isn't precomputed. */
- rtx value;
- /* Initially-compute RTL value for argument; only for const functions. */
- rtx initial_value;
- /* Register to pass this argument in, 0 if passed on stack, or an
- PARALLEL if the arg is to be copied into multiple non-contiguous
- registers. */
- rtx reg;
- /* If REG was promoted from the actual mode of the argument expression,
- indicates whether the promotion is sign- or zero-extended. */
- int unsignedp;
- /* Number of registers to use. 0 means put the whole arg in registers.
- Also 0 if not passed in registers. */
- int partial;
- /* Non-zero if argument must be passed on stack.
- Note that some arguments may be passed on the stack
- even though pass_on_stack is zero, just because FUNCTION_ARG says so.
- pass_on_stack identifies arguments that *cannot* go in registers. */
- int pass_on_stack;
- /* Offset of this argument from beginning of stack-args. */
- struct args_size offset;
- /* Similar, but offset to the start of the stack slot. Different from
- OFFSET if this arg pads downward. */
- struct args_size slot_offset;
- /* Size of this argument on the stack, rounded up for any padding it gets,
- parts of the argument passed in registers do not count.
- If REG_PARM_STACK_SPACE is defined, then register parms
- are counted here as well. */
- struct args_size size;
- /* Location on the stack at which parameter should be stored. The store
- has already been done if STACK == VALUE. */
- rtx stack;
- /* Location on the stack of the start of this argument slot. This can
- differ from STACK if this arg pads downward. This location is known
- to be aligned to FUNCTION_ARG_BOUNDARY. */
- rtx stack_slot;
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* Place that this stack area has been saved, if needed. */
- rtx save_area;
-#endif
- /* If an argument's alignment does not permit direct copying into registers,
- copy in smaller-sized pieces into pseudos. These are stored in a
- block pointed to by this field. The next field says how many
- word-sized pseudos we made. */
- rtx *aligned_regs;
- int n_aligned_regs;
-};
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
-/* A vector of one char per byte of stack space. A byte if non-zero if
- the corresponding stack location has been used.
- This vector is used to prevent a function call within an argument from
- clobbering any stack already set up. */
-static char *stack_usage_map;
-
-/* Size of STACK_USAGE_MAP. */
-static int highest_outgoing_arg_in_use;
-
-/* stack_arg_under_construction is nonzero when an argument may be
- initialized with a constructor call (including a C function that
- returns a BLKmode struct) and expand_call must take special action
- to make sure the object being constructed does not overlap the
- argument list for the constructor call. */
-int stack_arg_under_construction;
-#endif
-
-static int calls_function PROTO((tree, int));
-static int calls_function_1 PROTO((tree, int));
-static void emit_call_1 PROTO((rtx, tree, tree, int, int, rtx, rtx,
- int, rtx, int));
-static void store_one_arg PROTO ((struct arg_data *, rtx, int, int,
- tree, int));
-
-/* If WHICH is 1, return 1 if EXP contains a call to the built-in function
- `alloca'.
-
- If WHICH is 0, return 1 if EXP contains a call to any function.
- Actually, we only need return 1 if evaluating EXP would require pushing
- arguments on the stack, but that is too difficult to compute, so we just
- assume any function call might require the stack. */
-
-static tree calls_function_save_exprs;
-
-static int
-calls_function (exp, which)
- tree exp;
- int which;
-{
- int val;
- calls_function_save_exprs = 0;
- val = calls_function_1 (exp, which);
- calls_function_save_exprs = 0;
- return val;
-}
-
-static int
-calls_function_1 (exp, which)
- tree exp;
- int which;
-{
- register int i;
- enum tree_code code = TREE_CODE (exp);
- int type = TREE_CODE_CLASS (code);
- int length = tree_code_length[(int) code];
-
- /* If this code is language-specific, we don't know what it will do. */
- if ((int) code >= NUM_TREE_CODES)
- return 1;
-
- /* Only expressions and references can contain calls. */
- if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r'
- && type != 'b')
- return 0;
-
- switch (code)
- {
- case CALL_EXPR:
- if (which == 0)
- return 1;
- else if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
- && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
- == FUNCTION_DECL))
- {
- tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
-
- if ((DECL_BUILT_IN (fndecl)
- && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA)
- || (DECL_SAVED_INSNS (fndecl)
- && (FUNCTION_FLAGS (DECL_SAVED_INSNS (fndecl))
- & FUNCTION_FLAGS_CALLS_ALLOCA)))
- return 1;
- }
-
- /* Third operand is RTL. */
- length = 2;
- break;
-
- case SAVE_EXPR:
- if (SAVE_EXPR_RTL (exp) != 0)
- return 0;
- if (value_member (exp, calls_function_save_exprs))
- return 0;
- calls_function_save_exprs = tree_cons (NULL_TREE, exp,
- calls_function_save_exprs);
- return (TREE_OPERAND (exp, 0) != 0
- && calls_function_1 (TREE_OPERAND (exp, 0), which));
-
- case BLOCK:
- {
- register tree local;
-
- for (local = BLOCK_VARS (exp); local; local = TREE_CHAIN (local))
- if (DECL_INITIAL (local) != 0
- && calls_function_1 (DECL_INITIAL (local), which))
- return 1;
- }
- {
- register tree subblock;
-
- for (subblock = BLOCK_SUBBLOCKS (exp);
- subblock;
- subblock = TREE_CHAIN (subblock))
- if (calls_function_1 (subblock, which))
- return 1;
- }
- return 0;
-
- case METHOD_CALL_EXPR:
- length = 3;
- break;
-
- case WITH_CLEANUP_EXPR:
- length = 1;
- break;
-
- case RTL_EXPR:
- return 0;
- }
-
- for (i = 0; i < length; i++)
- if (TREE_OPERAND (exp, i) != 0
- && calls_function_1 (TREE_OPERAND (exp, i), which))
- return 1;
-
- return 0;
-}
-
-/* Force FUNEXP into a form suitable for the address of a CALL,
- and return that as an rtx. Also load the static chain register
- if FNDECL is a nested function.
-
- CALL_FUSAGE points to a variable holding the prospective
- CALL_INSN_FUNCTION_USAGE information. */
-
-rtx
-prepare_call_address (funexp, fndecl, call_fusage, reg_parm_seen)
- rtx funexp;
- tree fndecl;
- rtx *call_fusage;
- int reg_parm_seen;
-{
- rtx static_chain_value = 0;
-
- funexp = protect_from_queue (funexp, 0);
-
- if (fndecl != 0)
- /* Get possible static chain value for nested function in C. */
- static_chain_value = lookup_static_chain (fndecl);
-
- /* Make a valid memory address and copy constants thru pseudo-regs,
- but not for a constant address if -fno-function-cse. */
- if (GET_CODE (funexp) != SYMBOL_REF)
- funexp =
-#ifdef SMALL_REGISTER_CLASSES
- /* If we are using registers for parameters, force the
- function address into a register now. */
- (SMALL_REGISTER_CLASSES && reg_parm_seen)
- ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
- :
-#endif
- memory_address (FUNCTION_MODE, funexp);
- else
- {
-#ifndef NO_FUNCTION_CSE
- if (optimize && ! flag_no_function_cse)
-#ifdef NO_RECURSIVE_FUNCTION_CSE
- if (fndecl != current_function_decl)
-#endif
- funexp = force_reg (Pmode, funexp);
-#endif
- }
-
- if (static_chain_value != 0)
- {
- emit_move_insn (static_chain_rtx, static_chain_value);
-
- if (GET_CODE (static_chain_rtx) == REG)
- use_reg (call_fusage, static_chain_rtx);
- }
-
- return funexp;
-}
-
-/* Generate instructions to call function FUNEXP,
- and optionally pop the results.
- The CALL_INSN is the first insn generated.
-
- FNDECL is the declaration node of the function. This is given to the
- macro RETURN_POPS_ARGS to determine whether this function pops its own args.
-
- FUNTYPE is the data type of the function. This is given to the macro
- RETURN_POPS_ARGS to determine whether this function pops its own args.
- We used to allow an identifier for library functions, but that doesn't
- work when the return type is an aggregate type and the calling convention
- says that the pointer to this aggregate is to be popped by the callee.
-
- STACK_SIZE is the number of bytes of arguments on the stack,
- rounded up to STACK_BOUNDARY; zero if the size is variable.
- This is both to put into the call insn and
- to generate explicit popping code if necessary.
-
- STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value.
- It is zero if this call doesn't want a structure value.
-
- NEXT_ARG_REG is the rtx that results from executing
- FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1)
- just after all the args have had their registers assigned.
- This could be whatever you like, but normally it is the first
- arg-register beyond those used for args in this call,
- or 0 if all the arg-registers are used in this call.
- It is passed on to `gen_call' so you can put this info in the call insn.
-
- VALREG is a hard register in which a value is returned,
- or 0 if the call does not return a value.
-
- OLD_INHIBIT_DEFER_POP is the value that `inhibit_defer_pop' had before
- the args to this call were processed.
- We restore `inhibit_defer_pop' to that value.
-
- CALL_FUSAGE is either empty or an EXPR_LIST of USE expressions that
- denote registers used by the called function.
-
- IS_CONST is true if this is a `const' call. */
-
-static void
-emit_call_1 (funexp, fndecl, funtype, stack_size, struct_value_size,
- next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage,
- is_const)
- rtx funexp;
- tree fndecl;
- tree funtype;
- int stack_size;
- int struct_value_size;
- rtx next_arg_reg;
- rtx valreg;
- int old_inhibit_defer_pop;
- rtx call_fusage;
- int is_const;
-{
- rtx stack_size_rtx = GEN_INT (stack_size);
- rtx struct_value_size_rtx = GEN_INT (struct_value_size);
- rtx call_insn;
- int already_popped = 0;
-
- /* Ensure address is valid. SYMBOL_REF is already valid, so no need,
- 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)
- funexp = memory_address (FUNCTION_MODE, funexp);
-
-#ifndef ACCUMULATE_OUTGOING_ARGS
-#if defined (HAVE_call_pop) && defined (HAVE_call_value_pop)
- if (HAVE_call_pop && HAVE_call_value_pop
- && (RETURN_POPS_ARGS (fndecl, funtype, stack_size) > 0
- || stack_size == 0))
- {
- rtx n_pop = GEN_INT (RETURN_POPS_ARGS (fndecl, funtype, stack_size));
- rtx pat;
-
- /* If this subroutine pops its own args, record that in the call insn
- if possible, for the sake of frame pointer elimination. */
-
- if (valreg)
- pat = gen_call_value_pop (valreg,
- gen_rtx (MEM, FUNCTION_MODE, funexp),
- stack_size_rtx, next_arg_reg, n_pop);
- else
- pat = gen_call_pop (gen_rtx (MEM, FUNCTION_MODE, funexp),
- stack_size_rtx, next_arg_reg, n_pop);
-
- emit_call_insn (pat);
- already_popped = 1;
- }
- else
-#endif
-#endif
-
-#if defined (HAVE_call) && defined (HAVE_call_value)
- if (HAVE_call && HAVE_call_value)
- {
- if (valreg)
- emit_call_insn (gen_call_value (valreg,
- gen_rtx (MEM, FUNCTION_MODE, funexp),
- stack_size_rtx, next_arg_reg,
- NULL_RTX));
- else
- emit_call_insn (gen_call (gen_rtx (MEM, FUNCTION_MODE, funexp),
- stack_size_rtx, next_arg_reg,
- struct_value_size_rtx));
- }
- else
-#endif
- abort ();
-
- /* Find the CALL insn we just emitted. */
- for (call_insn = get_last_insn ();
- call_insn && GET_CODE (call_insn) != CALL_INSN;
- call_insn = PREV_INSN (call_insn))
- ;
-
- if (! call_insn)
- abort ();
-
- /* Put the register usage information on the CALL. If there is already
- some usage information, put ours at the end. */
- if (CALL_INSN_FUNCTION_USAGE (call_insn))
- {
- rtx link;
-
- for (link = CALL_INSN_FUNCTION_USAGE (call_insn); XEXP (link, 1) != 0;
- link = XEXP (link, 1))
- ;
-
- XEXP (link, 1) = call_fusage;
- }
- else
- CALL_INSN_FUNCTION_USAGE (call_insn) = call_fusage;
-
- /* If this is a const call, then set the insn's unchanging bit. */
- if (is_const)
- CONST_CALL_P (call_insn) = 1;
-
- /* Restore this now, so that we do defer pops for this call's args
- if the context of the call as a whole permits. */
- inhibit_defer_pop = old_inhibit_defer_pop;
-
-#ifndef ACCUMULATE_OUTGOING_ARGS
- /* If returning from the subroutine does not automatically pop the args,
- we need an instruction to pop them sooner or later.
- Perhaps do it now; perhaps just record how much space to pop later.
-
- If returning from the subroutine does pop the args, indicate that the
- stack pointer will be changed. */
-
- if (stack_size != 0 && RETURN_POPS_ARGS (fndecl, funtype, stack_size) > 0)
- {
- if (!already_popped)
- CALL_INSN_FUNCTION_USAGE (call_insn) =
- gen_rtx (EXPR_LIST, VOIDmode,
- gen_rtx (CLOBBER, VOIDmode, stack_pointer_rtx),
- CALL_INSN_FUNCTION_USAGE (call_insn));
- stack_size -= RETURN_POPS_ARGS (fndecl, funtype, stack_size);
- stack_size_rtx = GEN_INT (stack_size);
- }
-
- if (stack_size != 0)
- {
- if (flag_defer_pop && inhibit_defer_pop == 0 && !is_const)
- pending_stack_adjust += stack_size;
- else
- adjust_stack (stack_size_rtx);
- }
-#endif
-}
-
-/* Generate all the code for a function call
- and return an rtx for its value.
- Store the value in TARGET (specified as an rtx) if convenient.
- If the value is stored in TARGET then TARGET is returned.
- If IGNORE is nonzero, then we ignore the value of the function call. */
-
-rtx
-expand_call (exp, target, ignore)
- tree exp;
- rtx target;
- int ignore;
-{
- /* List of actual parameters. */
- tree actparms = TREE_OPERAND (exp, 1);
- /* RTX for the function to be called. */
- rtx funexp;
- /* Tree node for the function to be called (not the address!). */
- tree funtree;
- /* Data type of the function. */
- tree funtype;
- /* Declaration of the function being called,
- or 0 if the function is computed (not known by name). */
- tree fndecl = 0;
- char *name = 0;
-
- /* Register in which non-BLKmode value will be returned,
- or 0 if no value or if value is BLKmode. */
- rtx valreg;
- /* Address where we should return a BLKmode value;
- 0 if value not BLKmode. */
- rtx structure_value_addr = 0;
- /* Nonzero if that address is being passed by treating it as
- an extra, implicit first parameter. Otherwise,
- it is passed by being copied directly into struct_value_rtx. */
- int structure_value_addr_parm = 0;
- /* Size of aggregate value wanted, or zero if none wanted
- or if we are using the non-reentrant PCC calling convention
- or expecting the value in registers. */
- int struct_value_size = 0;
- /* Nonzero if called function returns an aggregate in memory PCC style,
- by returning the address of where to find it. */
- int pcc_struct_value = 0;
-
- /* Number of actual parameters in this call, including struct value addr. */
- int num_actuals;
- /* Number of named args. Args after this are anonymous ones
- and they must all go on the stack. */
- int n_named_args;
- /* Count arg position in order args appear. */
- int argpos;
-
- /* Vector of information about each argument.
- Arguments are numbered in the order they will be pushed,
- not the order they are written. */
- struct arg_data *args;
-
- /* Total size in bytes of all the stack-parms scanned so far. */
- struct args_size args_size;
- /* Size of arguments before any adjustments (such as rounding). */
- struct args_size original_args_size;
- /* Data on reg parms scanned so far. */
- CUMULATIVE_ARGS args_so_far;
- /* Nonzero if a reg parm has been scanned. */
- int reg_parm_seen;
- /* Nonzero if this is an indirect function call. */
-
- /* Nonzero if we must avoid push-insns in the args for this call.
- If stack space is allocated for register parameters, but not by the
- caller, then it is preallocated in the fixed part of the stack frame.
- So the entire argument block must then be preallocated (i.e., we
- ignore PUSH_ROUNDING in that case). */
-
-#if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
- int must_preallocate = 1;
-#else
-#ifdef PUSH_ROUNDING
- int must_preallocate = 0;
-#else
- int must_preallocate = 1;
-#endif
-#endif
-
- /* Size of the stack reserved for parameter registers. */
- int reg_parm_stack_space = 0;
-
- /* 1 if scanning parms front to back, -1 if scanning back to front. */
- int inc;
- /* Address of space preallocated for stack parms
- (on machines that lack push insns), or 0 if space not preallocated. */
- rtx argblock = 0;
-
- /* Nonzero if it is plausible that this is a call to alloca. */
- int may_be_alloca;
- /* Nonzero if this is a call to setjmp or a related function. */
- int returns_twice;
- /* Nonzero if this is a call to `longjmp'. */
- int is_longjmp;
- /* Nonzero if this is a call to an inline function. */
- int is_integrable = 0;
- /* Nonzero if this is a call to a `const' function.
- Note that only explicitly named functions are handled as `const' here. */
- int is_const = 0;
- /* Nonzero if this is a call to a `volatile' function. */
- int is_volatile = 0;
-#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
- /* Define the boundary of the register parm stack space that needs to be
- save, if any. */
- int low_to_save = -1, high_to_save;
- rtx save_area = 0; /* Place that it is saved */
-#endif
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
- char *initial_stack_usage_map = stack_usage_map;
-#endif
-
- rtx old_stack_level = 0;
- int old_pending_adj = 0;
- int old_stack_arg_under_construction;
- int old_inhibit_defer_pop = inhibit_defer_pop;
- tree old_cleanups = cleanups_this_call;
- rtx call_fusage = 0;
- register tree p;
- register int i, j;
-
- /* See if we can find a DECL-node for the actual function.
- As a result, decide whether this is a call to an integrable function. */
-
- p = TREE_OPERAND (exp, 0);
- if (TREE_CODE (p) == ADDR_EXPR)
- {
- fndecl = TREE_OPERAND (p, 0);
- if (TREE_CODE (fndecl) != FUNCTION_DECL)
- fndecl = 0;
- else
- {
- if (!flag_no_inline
- && fndecl != current_function_decl
- && DECL_INLINE (fndecl)
- && DECL_SAVED_INSNS (fndecl)
- && RTX_INTEGRATED_P (DECL_SAVED_INSNS (fndecl)))
- is_integrable = 1;
- else if (! TREE_ADDRESSABLE (fndecl))
- {
- /* In case this function later becomes inlinable,
- record that there was already a non-inline call to it.
-
- Use abstraction instead of setting TREE_ADDRESSABLE
- directly. */
- if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline
- && optimize > 0)
- {
- warning_with_decl (fndecl, "can't inline call to `%s'");
- warning ("called from here");
- }
- mark_addressable (fndecl);
- }
-
- if (TREE_READONLY (fndecl) && ! TREE_THIS_VOLATILE (fndecl)
- && TYPE_MODE (TREE_TYPE (exp)) != VOIDmode)
- is_const = 1;
-
- if (TREE_THIS_VOLATILE (fndecl))
- is_volatile = 1;
- }
- }
-
- /* If we don't have specific function to call, see if we have a
- constant or `noreturn' function from the type. */
- if (fndecl == 0)
- {
- is_const = TREE_READONLY (TREE_TYPE (TREE_TYPE (p)));
- is_volatile = TREE_THIS_VOLATILE (TREE_TYPE (TREE_TYPE (p)));
- }
-
-#ifdef REG_PARM_STACK_SPACE
-#ifdef MAYBE_REG_PARM_STACK_SPACE
- reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE;
-#else
- reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
-#endif
-#endif
-
- /* Warn if this value is an aggregate type,
- regardless of which calling convention we are using for it. */
- if (warn_aggregate_return && AGGREGATE_TYPE_P (TREE_TYPE (exp)))
- warning ("function call has aggregate value");
-
- /* Set up a place to return a structure. */
-
- /* Cater to broken compilers. */
- if (aggregate_value_p (exp))
- {
- /* This call returns a big structure. */
- is_const = 0;
-
-#ifdef PCC_STATIC_STRUCT_RETURN
- {
- pcc_struct_value = 1;
- /* Easier than making that case work right. */
- if (is_integrable)
- {
- /* In case this is a static function, note that it has been
- used. */
- if (! TREE_ADDRESSABLE (fndecl))
- mark_addressable (fndecl);
- is_integrable = 0;
- }
- }
-#else /* not PCC_STATIC_STRUCT_RETURN */
- {
- struct_value_size = int_size_in_bytes (TREE_TYPE (exp));
-
- if (target && GET_CODE (target) == MEM)
- structure_value_addr = XEXP (target, 0);
- else
- {
- /* Assign a temporary on the stack to hold the value. */
-
- /* For variable-sized objects, we must be called with a target
- specified. If we were to allocate space on the stack here,
- we would have no way of knowing when to free it. */
-
- if (struct_value_size < 0)
- abort ();
-
- structure_value_addr
- = XEXP (assign_stack_temp (BLKmode, struct_value_size, 1), 0);
- MEM_IN_STRUCT_P (structure_value_addr)
- = AGGREGATE_TYPE_P (TREE_TYPE (exp));
- target = 0;
- }
- }
-#endif /* not PCC_STATIC_STRUCT_RETURN */
- }
-
- /* If called function is inline, try to integrate it. */
-
- if (is_integrable)
- {
- rtx temp;
- rtx before_call = get_last_insn ();
-
- temp = expand_inline_function (fndecl, actparms, target,
- ignore, TREE_TYPE (exp),
- structure_value_addr);
-
- /* If inlining succeeded, return. */
- if ((HOST_WIDE_INT) temp != -1)
- {
- if (flag_short_temps)
- {
- /* Perform all cleanups needed for the arguments of this
- call (i.e. destructors in C++). It is ok if these
- destructors clobber RETURN_VALUE_REG, because the
- only time we care about this is when TARGET is that
- register. But in C++, we take care to never return
- that register directly. */
- expand_cleanups_to (old_cleanups);
- }
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* If the outgoing argument list must be preserved, push
- the stack before executing the inlined function if it
- makes any calls. */
-
- for (i = reg_parm_stack_space - 1; i >= 0; i--)
- if (i < highest_outgoing_arg_in_use && stack_usage_map[i] != 0)
- break;
-
- if (stack_arg_under_construction || i >= 0)
- {
- rtx first_insn
- = before_call ? NEXT_INSN (before_call) : get_insns ();
- rtx insn, seq;
-
- /* Look for a call in the inline function code.
- If OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) is
- nonzero then there is a call and it is not necessary
- to scan the insns. */
-
- if (OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) == 0)
- for (insn = first_insn; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == CALL_INSN)
- break;
-
- if (insn)
- {
- /* Reserve enough stack space so that the largest
- argument list of any function call in the inline
- function does not overlap the argument list being
- evaluated. This is usually an overestimate because
- allocate_dynamic_stack_space reserves space for an
- outgoing argument list in addition to the requested
- space, but there is no way to ask for stack space such
- that an argument list of a certain length can be
- safely constructed. */
-
- int adjust = OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl));
-#ifdef REG_PARM_STACK_SPACE
- /* Add the stack space reserved for register arguments
- in the inline function. What is really needed is the
- largest value of reg_parm_stack_space in the inline
- function, but that is not available. Using the current
- value of reg_parm_stack_space is wrong, but gives
- correct results on all supported machines. */
- adjust += reg_parm_stack_space;
-#endif
- start_sequence ();
- emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
- allocate_dynamic_stack_space (GEN_INT (adjust),
- NULL_RTX, BITS_PER_UNIT);
- seq = get_insns ();
- end_sequence ();
- emit_insns_before (seq, first_insn);
- emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
- }
- }
-#endif
-
- /* If the result is equivalent to TARGET, return TARGET to simplify
- checks in store_expr. They can be equivalent but not equal in the
- case of a function that returns BLKmode. */
- if (temp != target && rtx_equal_p (temp, target))
- return target;
- return temp;
- }
-
- /* If inlining failed, mark FNDECL as needing to be compiled
- separately after all. If function was declared inline,
- give a warning. */
- if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline
- && optimize > 0 && ! TREE_ADDRESSABLE (fndecl))
- {
- warning_with_decl (fndecl, "inlining failed in call to `%s'");
- warning ("called from here");
- }
- mark_addressable (fndecl);
- }
-
- /* When calling a const function, we must pop the stack args right away,
- so that the pop is deleted or moved with the call. */
- if (is_const)
- NO_DEFER_POP;
-
- function_call_count++;
-
- if (fndecl && DECL_NAME (fndecl))
- name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
-
-#if 0
- /* Unless it's a call to a specific function that isn't alloca,
- if it has one argument, we must assume it might be alloca. */
-
- may_be_alloca =
- (!(fndecl != 0 && strcmp (name, "alloca"))
- && actparms != 0
- && TREE_CHAIN (actparms) == 0);
-#else
- /* We assume that alloca will always be called by name. It
- makes no sense to pass it as a pointer-to-function to
- anything that does not understand its behavior. */
- may_be_alloca =
- (name && ((IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 6
- && name[0] == 'a'
- && ! strcmp (name, "alloca"))
- || (IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 16
- && name[0] == '_'
- && ! strcmp (name, "__builtin_alloca"))));
-#endif
-
- /* See if this is a call to a function that can return more than once
- or a call to longjmp. */
-
- returns_twice = 0;
- is_longjmp = 0;
-
- if (name != 0 && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) <= 15)
- {
- char *tname = name;
-
- /* Disregard prefix _, __ or __x. */
- if (name[0] == '_')
- {
- if (name[1] == '_' && name[2] == 'x')
- tname += 3;
- else if (name[1] == '_')
- tname += 2;
- else
- tname += 1;
- }
-
- if (tname[0] == 's')
- {
- returns_twice
- = ((tname[1] == 'e'
- && (! strcmp (tname, "setjmp")
- || ! strcmp (tname, "setjmp_syscall")))
- || (tname[1] == 'i'
- && ! strcmp (tname, "sigsetjmp"))
- || (tname[1] == 'a'
- && ! strcmp (tname, "savectx")));
- if (tname[1] == 'i'
- && ! strcmp (tname, "siglongjmp"))
- is_longjmp = 1;
- }
- else if ((tname[0] == 'q' && tname[1] == 's'
- && ! strcmp (tname, "qsetjmp"))
- || (tname[0] == 'v' && tname[1] == 'f'
- && ! strcmp (tname, "vfork")))
- returns_twice = 1;
-
- else if (tname[0] == 'l' && tname[1] == 'o'
- && ! strcmp (tname, "longjmp"))
- is_longjmp = 1;
- }
-
- if (may_be_alloca)
- current_function_calls_alloca = 1;
-
- /* Don't let pending stack adjusts add up to too much.
- Also, do all pending adjustments now
- if there is any chance this might be a call to alloca. */
-
- if (pending_stack_adjust >= 32
- || (pending_stack_adjust > 0 && may_be_alloca))
- do_pending_stack_adjust ();
-
- /* Operand 0 is a pointer-to-function; get the type of the function. */
- funtype = TREE_TYPE (TREE_OPERAND (exp, 0));
- if (TREE_CODE (funtype) != POINTER_TYPE)
- abort ();
- funtype = TREE_TYPE (funtype);
-
- /* Push the temporary stack slot level so that we can free any temporaries
- we make. */
- push_temp_slots ();
-
- /* Start updating where the next arg would go.
-
- On some machines (such as the PA) indirect calls have a different
- calling convention than normal calls. The last argument in
- INIT_CUMULATIVE_ARGS tells the backend if this is an indirect call
- or not. */
- INIT_CUMULATIVE_ARGS (args_so_far, funtype, NULL_RTX, (fndecl == 0));
-
- /* If struct_value_rtx is 0, it means pass the address
- as if it were an extra parameter. */
- if (structure_value_addr && struct_value_rtx == 0)
- {
- /* If structure_value_addr is a REG other than
- virtual_outgoing_args_rtx, we can use always use it. If it
- is not a REG, we must always copy it into a register.
- If it is virtual_outgoing_args_rtx, we must copy it to another
- register in some cases. */
- rtx temp = (GET_CODE (structure_value_addr) != REG
-#ifdef ACCUMULATE_OUTGOING_ARGS
- || (stack_arg_under_construction
- && structure_value_addr == virtual_outgoing_args_rtx)
-#endif
- ? copy_addr_to_reg (structure_value_addr)
- : structure_value_addr);
-
- actparms
- = tree_cons (error_mark_node,
- make_tree (build_pointer_type (TREE_TYPE (funtype)),
- temp),
- actparms);
- structure_value_addr_parm = 1;
- }
-
- /* Count the arguments and set NUM_ACTUALS. */
- for (p = actparms, i = 0; p; p = TREE_CHAIN (p)) i++;
- num_actuals = i;
-
- /* Compute number of named args.
- Normally, don't include the last named arg if anonymous args follow.
- We do include the last named arg if STRICT_ARGUMENT_NAMING is defined.
- (If no anonymous args follow, the result of list_length is actually
- one too large. This is harmless.)
-
- If SETUP_INCOMING_VARARGS is defined and STRICT_ARGUMENT_NAMING is not,
- this machine will be able to place unnamed args that were passed in
- registers into the stack. So treat all args as named. This allows the
- insns emitting for a specific argument list to be independent of the
- function declaration.
-
- If SETUP_INCOMING_VARARGS is not defined, we do not have any reliable
- way to pass unnamed args in registers, so we must force them into
- memory. */
-#if !defined(SETUP_INCOMING_VARARGS) || defined(STRICT_ARGUMENT_NAMING)
- if (TYPE_ARG_TYPES (funtype) != 0)
- n_named_args
- = (list_length (TYPE_ARG_TYPES (funtype))
-#ifndef STRICT_ARGUMENT_NAMING
- /* Don't include the last named arg. */
- - 1
-#endif
- /* Count the struct value address, if it is passed as a parm. */
- + structure_value_addr_parm);
- else
-#endif
- /* If we know nothing, treat all args as named. */
- n_named_args = num_actuals;
-
- /* Make a vector to hold all the information about each arg. */
- args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data));
- bzero ((char *) args, num_actuals * sizeof (struct arg_data));
-
- args_size.constant = 0;
- args_size.var = 0;
-
- /* In this loop, we consider args in the order they are written.
- We fill up ARGS from the front or from the back if necessary
- so that in any case the first arg to be pushed ends up at the front. */
-
-#ifdef PUSH_ARGS_REVERSED
- i = num_actuals - 1, inc = -1;
- /* In this case, must reverse order of args
- so that we compute and push the last arg first. */
-#else
- i = 0, inc = 1;
-#endif
-
- /* 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;
-
- args[i].tree_value = TREE_VALUE (p);
-
- /* Replace erroneous argument with constant zero. */
- if (type == error_mark_node || TYPE_SIZE (type) == 0)
- args[i].tree_value = integer_zero_node, type = integer_type_node;
-
- /* If TYPE is a transparent union, pass things the way we would
- pass the first field of the union. We have already verified that
- the modes are the same. */
- if (TYPE_TRANSPARENT_UNION (type))
- type = TREE_TYPE (TYPE_FIELDS (type));
-
- /* Decide where to pass this arg.
-
- args[i].reg is nonzero if all or part is passed in registers.
-
- args[i].partial is nonzero if part but not all is passed in registers,
- and the exact value says how many words are passed in registers.
-
- args[i].pass_on_stack is nonzero if the argument must at least be
- computed on the stack. It may then be loaded back into registers
- if args[i].reg is nonzero.
-
- These decisions are driven by the FUNCTION_... macros and must agree
- with those made by function.c. */
-
- /* See if this argument should be passed by invisible reference. */
- if ((TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
- && contains_placeholder_p (TYPE_SIZE (type)))
- || TREE_ADDRESSABLE (type)
-#ifdef FUNCTION_ARG_PASS_BY_REFERENCE
- || FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, TYPE_MODE (type),
- type, argpos < n_named_args)
-#endif
- )
- {
-#ifdef FUNCTION_ARG_CALLEE_COPIES
- if (FUNCTION_ARG_CALLEE_COPIES (args_so_far, TYPE_MODE (type), type,
- argpos < n_named_args)
- /* If it's in a register, we must make a copy of it too. */
- /* ??? Is this a sufficient test? Is there a better one? */
- && !(TREE_CODE (args[i].tree_value) == VAR_DECL
- && REG_P (DECL_RTL (args[i].tree_value)))
- && ! TREE_ADDRESSABLE (type))
- {
- args[i].tree_value = build1 (ADDR_EXPR,
- build_pointer_type (type),
- args[i].tree_value);
- type = build_pointer_type (type);
- }
- else
-#endif
- {
- /* We make a copy of the object and pass the address to the
- function being called. */
- rtx copy;
-
- if (TYPE_SIZE (type) == 0
- || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- {
- /* This is a variable-sized object. Make space on the stack
- for it. */
- rtx size_rtx = expr_size (TREE_VALUE (p));
-
- if (old_stack_level == 0)
- {
- emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
- old_pending_adj = pending_stack_adjust;
- pending_stack_adjust = 0;
- }
-
- copy = gen_rtx (MEM, BLKmode,
- allocate_dynamic_stack_space (size_rtx,
- NULL_RTX,
- TYPE_ALIGN (type)));
- }
- else
- {
- int size = int_size_in_bytes (type);
- copy = assign_stack_temp (TYPE_MODE (type), size, 0);
- }
-
- MEM_IN_STRUCT_P (copy) = AGGREGATE_TYPE_P (type);
-
- store_expr (args[i].tree_value, copy, 0);
- is_const = 0;
-
- args[i].tree_value = build1 (ADDR_EXPR,
- build_pointer_type (type),
- make_tree (type, copy));
- type = build_pointer_type (type);
- }
- }
-
- mode = TYPE_MODE (type);
- unsignedp = TREE_UNSIGNED (type);
-
-#ifdef PROMOTE_FUNCTION_ARGS
- mode = promote_mode (type, mode, &unsignedp, 1);
-#endif
-
- args[i].unsignedp = unsignedp;
- args[i].mode = mode;
- args[i].reg = FUNCTION_ARG (args_so_far, mode, type,
- argpos < n_named_args);
-#ifdef FUNCTION_ARG_PARTIAL_NREGS
- if (args[i].reg)
- args[i].partial
- = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, type,
- argpos < n_named_args);
-#endif
-
- args[i].pass_on_stack = MUST_PASS_IN_STACK (mode, type);
-
- /* If FUNCTION_ARG returned a (parallel [(expr_list (nil) ...) ...]),
- it means that we are to pass this arg in the register(s) designated
- by the PARALLEL, but also to pass it in the stack. */
- if (args[i].reg && GET_CODE (args[i].reg) == PARALLEL
- && XEXP (XVECEXP (args[i].reg, 0, 0), 0) == 0)
- args[i].pass_on_stack = 1;
-
- /* If this is an addressable type, we must preallocate the stack
- since we must evaluate the object into its final location.
-
- If this is to be passed in both registers and the stack, it is simpler
- to preallocate. */
- if (TREE_ADDRESSABLE (type)
- || (args[i].pass_on_stack && args[i].reg != 0))
- must_preallocate = 1;
-
- /* If this is an addressable type, we cannot pre-evaluate it. Thus,
- we cannot consider this function call constant. */
- if (TREE_ADDRESSABLE (type))
- is_const = 0;
-
- /* Compute the stack-size of this argument. */
- if (args[i].reg == 0 || args[i].partial != 0
-#ifdef REG_PARM_STACK_SPACE
- || reg_parm_stack_space > 0
-#endif
- || args[i].pass_on_stack)
- locate_and_pad_parm (mode, type,
-#ifdef STACK_PARMS_IN_REG_PARM_AREA
- 1,
-#else
- args[i].reg != 0,
-#endif
- fndecl, &args_size, &args[i].offset,
- &args[i].size);
-
-#ifndef ARGS_GROW_DOWNWARD
- args[i].slot_offset = args_size;
-#endif
-
-#ifndef REG_PARM_STACK_SPACE
- /* If a part of the arg was put into registers,
- don't include that part in the amount pushed. */
- if (! args[i].pass_on_stack)
- args[i].size.constant -= ((args[i].partial * UNITS_PER_WORD)
- / (PARM_BOUNDARY / BITS_PER_UNIT)
- * (PARM_BOUNDARY / BITS_PER_UNIT));
-#endif
-
- /* Update ARGS_SIZE, the total stack space for args so far. */
-
- args_size.constant += args[i].size.constant;
- if (args[i].size.var)
- {
- ADD_PARM_SIZE (args_size, args[i].size.var);
- }
-
- /* Since the slot offset points to the bottom of the slot,
- we must record it after incrementing if the args grow down. */
-#ifdef ARGS_GROW_DOWNWARD
- args[i].slot_offset = args_size;
-
- args[i].slot_offset.constant = -args_size.constant;
- if (args_size.var)
- {
- SUB_PARM_SIZE (args[i].slot_offset, args_size.var);
- }
-#endif
-
- /* Increment ARGS_SO_FAR, which has info about which arg-registers
- have been used, etc. */
-
- FUNCTION_ARG_ADVANCE (args_so_far, TYPE_MODE (type), type,
- argpos < n_named_args);
- }
-
-#ifdef FINAL_REG_PARM_STACK_SPACE
- reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant,
- args_size.var);
-#endif
-
- /* Compute the actual size of the argument block required. The variable
- and constant sizes must be combined, the size may have to be rounded,
- and there may be a minimum required size. */
-
- original_args_size = args_size;
- if (args_size.var)
- {
- /* If this function requires a variable-sized argument list, don't try to
- make a cse'able block for this call. We may be able to do this
- eventually, but it is too complicated to keep track of what insns go
- in the cse'able block and which don't. */
-
- is_const = 0;
- must_preallocate = 1;
-
- args_size.var = ARGS_SIZE_TREE (args_size);
- args_size.constant = 0;
-
-#ifdef STACK_BOUNDARY
- if (STACK_BOUNDARY != BITS_PER_UNIT)
- args_size.var = round_up (args_size.var, STACK_BYTES);
-#endif
-
-#ifdef REG_PARM_STACK_SPACE
- if (reg_parm_stack_space > 0)
- {
- args_size.var
- = size_binop (MAX_EXPR, args_size.var,
- size_int (REG_PARM_STACK_SPACE (fndecl)));
-
-#ifndef OUTGOING_REG_PARM_STACK_SPACE
- /* The area corresponding to register parameters is not to count in
- the size of the block we need. So make the adjustment. */
- args_size.var
- = size_binop (MINUS_EXPR, args_size.var,
- size_int (reg_parm_stack_space));
-#endif
- }
-#endif
- }
- else
- {
-#ifdef STACK_BOUNDARY
- args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
- / STACK_BYTES) * STACK_BYTES);
-#endif
-
-#ifdef REG_PARM_STACK_SPACE
- args_size.constant = MAX (args_size.constant,
- reg_parm_stack_space);
-#ifdef MAYBE_REG_PARM_STACK_SPACE
- if (reg_parm_stack_space == 0)
- args_size.constant = 0;
-#endif
-#ifndef OUTGOING_REG_PARM_STACK_SPACE
- args_size.constant -= reg_parm_stack_space;
-#endif
-#endif
- }
-
- /* See if we have or want to preallocate stack space.
-
- If we would have to push a partially-in-regs parm
- before other stack parms, preallocate stack space instead.
-
- If the size of some parm is not a multiple of the required stack
- alignment, we must preallocate.
-
- If the total size of arguments that would otherwise create a copy in
- a temporary (such as a CALL) is more than half the total argument list
- size, preallocation is faster.
-
- Another reason to preallocate is if we have a machine (like the m88k)
- where stack alignment is required to be maintained between every
- pair of insns, not just when the call is made. However, we assume here
- that such machines either do not have push insns (and hence preallocation
- would occur anyway) or the problem is taken care of with
- PUSH_ROUNDING. */
-
- if (! must_preallocate)
- {
- int partial_seen = 0;
- int copy_to_evaluate_size = 0;
-
- for (i = 0; i < num_actuals && ! must_preallocate; i++)
- {
- if (args[i].partial > 0 && ! args[i].pass_on_stack)
- partial_seen = 1;
- else if (partial_seen && args[i].reg == 0)
- must_preallocate = 1;
-
- if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
- && (TREE_CODE (args[i].tree_value) == CALL_EXPR
- || TREE_CODE (args[i].tree_value) == TARGET_EXPR
- || TREE_CODE (args[i].tree_value) == COND_EXPR
- || TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value))))
- copy_to_evaluate_size
- += int_size_in_bytes (TREE_TYPE (args[i].tree_value));
- }
-
- if (copy_to_evaluate_size * 2 >= args_size.constant
- && args_size.constant > 0)
- must_preallocate = 1;
- }
-
- /* If the structure value address will reference the stack pointer, we must
- stabilize it. We don't need to do this if we know that we are not going
- to adjust the stack pointer in processing this call. */
-
- if (structure_value_addr
- && (reg_mentioned_p (virtual_stack_dynamic_rtx, structure_value_addr)
- || reg_mentioned_p (virtual_outgoing_args_rtx, structure_value_addr))
- && (args_size.var
-#ifndef ACCUMULATE_OUTGOING_ARGS
- || args_size.constant
-#endif
- ))
- structure_value_addr = copy_to_reg (structure_value_addr);
-
- /* If this function call is cse'able, precompute all the parameters.
- Note that if the parameter is constructed into a temporary, this will
- cause an additional copy because the parameter will be constructed
- into a temporary location and then copied into the outgoing arguments.
- If a parameter contains a call to alloca and this function uses the
- stack, precompute the parameter. */
-
- /* If we preallocated the stack space, and some arguments must be passed
- on the stack, then we must precompute any parameter which contains a
- function call which will store arguments on the stack.
- Otherwise, evaluating the parameter may clobber previous parameters
- which have already been stored into the stack. */
-
- for (i = 0; i < num_actuals; i++)
- if (is_const
- || ((args_size.var != 0 || args_size.constant != 0)
- && calls_function (args[i].tree_value, 1))
- || (must_preallocate && (args_size.var != 0 || args_size.constant != 0)
- && calls_function (args[i].tree_value, 0)))
- {
- /* If this is an addressable type, we cannot pre-evaluate it. */
- if (TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value)))
- abort ();
-
- push_temp_slots ();
-
- args[i].initial_value = args[i].value
- = expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0);
-
- preserve_temp_slots (args[i].value);
- pop_temp_slots ();
-
- /* ANSI doesn't require a sequence point here,
- but PCC has one, so this will avoid some problems. */
- emit_queue ();
-
- args[i].initial_value = args[i].value
- = protect_from_queue (args[i].initial_value, 0);
-
- if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) != args[i].mode)
- args[i].value
- = convert_modes (args[i].mode,
- TYPE_MODE (TREE_TYPE (args[i].tree_value)),
- args[i].value, args[i].unsignedp);
- }
-
- /* Now we are about to start emitting insns that can be deleted
- if a libcall is deleted. */
- if (is_const)
- start_sequence ();
-
- /* If we have no actual push instructions, or shouldn't use them,
- make space for all args right now. */
-
- if (args_size.var != 0)
- {
- if (old_stack_level == 0)
- {
- emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
- old_pending_adj = pending_stack_adjust;
- pending_stack_adjust = 0;
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* stack_arg_under_construction says whether a stack arg is
- being constructed at the old stack level. Pushing the stack
- gets a clean outgoing argument block. */
- old_stack_arg_under_construction = stack_arg_under_construction;
- stack_arg_under_construction = 0;
-#endif
- }
- argblock = push_block (ARGS_SIZE_RTX (args_size), 0, 0);
- }
- else
- {
- /* Note that we must go through the motions of allocating an argument
- block even if the size is zero because we may be storing args
- in the area reserved for register arguments, which may be part of
- the stack frame. */
-
- int needed = args_size.constant;
-
- /* Store the maximum argument space used. It will be pushed by
- the prologue (if ACCUMULATE_OUTGOING_ARGS, or stack overflow
- checking). */
-
- if (needed > current_function_outgoing_args_size)
- current_function_outgoing_args_size = needed;
-
- if (must_preallocate)
- {
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* Since the stack pointer will never be pushed, it is possible for
- the evaluation of a parm to clobber something we have already
- written to the stack. Since most function calls on RISC machines
- do not use the stack, this is uncommon, but must work correctly.
-
- Therefore, we save any area of the stack that was already written
- and that we are using. Here we set up to do this by making a new
- stack usage map from the old one. The actual save will be done
- by store_one_arg.
-
- Another approach might be to try to reorder the argument
- evaluations to avoid this conflicting stack usage. */
-
-#if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
- /* Since we will be writing into the entire argument area, the
- map must be allocated for its entire size, not just the part that
- is the responsibility of the caller. */
- needed += reg_parm_stack_space;
-#endif
-
-#ifdef ARGS_GROW_DOWNWARD
- highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
- needed + 1);
-#else
- highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
- needed);
-#endif
- stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use);
-
- if (initial_highest_arg_in_use)
- bcopy (initial_stack_usage_map, stack_usage_map,
- initial_highest_arg_in_use);
-
- if (initial_highest_arg_in_use != highest_outgoing_arg_in_use)
- bzero (&stack_usage_map[initial_highest_arg_in_use],
- highest_outgoing_arg_in_use - initial_highest_arg_in_use);
- needed = 0;
-
- /* The address of the outgoing argument list must not be copied to a
- register here, because argblock would be left pointing to the
- wrong place after the call to allocate_dynamic_stack_space below.
- */
-
- argblock = virtual_outgoing_args_rtx;
-
-#else /* not ACCUMULATE_OUTGOING_ARGS */
- if (inhibit_defer_pop == 0)
- {
- /* Try to reuse some or all of the pending_stack_adjust
- to get this space. Maybe we can avoid any pushing. */
- if (needed > pending_stack_adjust)
- {
- needed -= pending_stack_adjust;
- pending_stack_adjust = 0;
- }
- else
- {
- pending_stack_adjust -= needed;
- needed = 0;
- }
- }
- /* Special case this because overhead of `push_block' in this
- case is non-trivial. */
- if (needed == 0)
- argblock = virtual_outgoing_args_rtx;
- else
- argblock = push_block (GEN_INT (needed), 0, 0);
-
- /* We only really need to call `copy_to_reg' in the case where push
- insns are going to be used to pass ARGBLOCK to a function
- call in ARGS. In that case, the stack pointer changes value
- from the allocation point to the call point, and hence
- the value of VIRTUAL_OUTGOING_ARGS_RTX changes as well.
- But might as well always do it. */
- argblock = copy_to_reg (argblock);
-#endif /* not ACCUMULATE_OUTGOING_ARGS */
- }
- }
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* The save/restore code in store_one_arg handles all cases except one:
- a constructor call (including a C function returning a BLKmode struct)
- to initialize an argument. */
- if (stack_arg_under_construction)
- {
-#if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
- rtx push_size = GEN_INT (reg_parm_stack_space + args_size.constant);
-#else
- rtx push_size = GEN_INT (args_size.constant);
-#endif
- if (old_stack_level == 0)
- {
- emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
- old_pending_adj = pending_stack_adjust;
- pending_stack_adjust = 0;
- /* stack_arg_under_construction says whether a stack arg is
- being constructed at the old stack level. Pushing the stack
- gets a clean outgoing argument block. */
- old_stack_arg_under_construction = stack_arg_under_construction;
- stack_arg_under_construction = 0;
- /* Make a new map for the new argument list. */
- stack_usage_map = (char *)alloca (highest_outgoing_arg_in_use);
- bzero (stack_usage_map, highest_outgoing_arg_in_use);
- highest_outgoing_arg_in_use = 0;
- }
- allocate_dynamic_stack_space (push_size, NULL_RTX, BITS_PER_UNIT);
- }
- /* If argument evaluation might modify the stack pointer, copy the
- address of the argument list to a register. */
- for (i = 0; i < num_actuals; i++)
- if (args[i].pass_on_stack)
- {
- argblock = copy_addr_to_reg (argblock);
- break;
- }
-#endif
-
-
- /* If we preallocated stack space, compute the address of each argument.
- We need not ensure it is a valid memory address here; it will be
- validized when it is used. */
- if (argblock)
- {
- rtx arg_reg = argblock;
- int arg_offset = 0;
-
- if (GET_CODE (argblock) == PLUS)
- arg_reg = XEXP (argblock, 0), arg_offset = INTVAL (XEXP (argblock, 1));
-
- for (i = 0; i < num_actuals; i++)
- {
- rtx offset = ARGS_SIZE_RTX (args[i].offset);
- rtx slot_offset = ARGS_SIZE_RTX (args[i].slot_offset);
- rtx addr;
-
- /* Skip this parm if it will not be passed on the stack. */
- if (! args[i].pass_on_stack && args[i].reg != 0)
- continue;
-
- if (GET_CODE (offset) == CONST_INT)
- addr = plus_constant (arg_reg, INTVAL (offset));
- else
- addr = gen_rtx (PLUS, Pmode, arg_reg, offset);
-
- addr = plus_constant (addr, arg_offset);
- args[i].stack = gen_rtx (MEM, args[i].mode, addr);
- MEM_IN_STRUCT_P (args[i].stack)
- = AGGREGATE_TYPE_P (TREE_TYPE (args[i].tree_value));
-
- if (GET_CODE (slot_offset) == CONST_INT)
- addr = plus_constant (arg_reg, INTVAL (slot_offset));
- else
- addr = gen_rtx (PLUS, Pmode, arg_reg, slot_offset);
-
- addr = plus_constant (addr, arg_offset);
- args[i].stack_slot = gen_rtx (MEM, args[i].mode, addr);
- }
- }
-
-#ifdef PUSH_ARGS_REVERSED
-#ifdef STACK_BOUNDARY
- /* If we push args individually in reverse order, perform stack alignment
- before the first push (the last arg). */
- if (argblock == 0)
- anti_adjust_stack (GEN_INT (args_size.constant
- - original_args_size.constant));
-#endif
-#endif
-
- /* Don't try to defer pops if preallocating, not even from the first arg,
- since ARGBLOCK probably refers to the SP. */
- if (argblock)
- NO_DEFER_POP;
-
- /* Get the function to call, in the form of RTL. */
- if (fndecl)
- {
- /* If this is the first use of the function, see if we need to
- make an external definition for it. */
- if (! TREE_USED (fndecl))
- {
- assemble_external (fndecl);
- TREE_USED (fndecl) = 1;
- }
-
- /* Get a SYMBOL_REF rtx for the function address. */
- funexp = XEXP (DECL_RTL (fndecl), 0);
- }
- else
- /* Generate an rtx (probably a pseudo-register) for the address. */
- {
- push_temp_slots ();
- funexp = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
- pop_temp_slots (); /* FUNEXP can't be BLKmode */
- emit_queue ();
- }
-
- /* Figure out the register where the value, if any, will come back. */
- valreg = 0;
- if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
- && ! structure_value_addr)
- {
- if (pcc_struct_value)
- valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
- fndecl);
- else
- valreg = hard_function_value (TREE_TYPE (exp), fndecl);
- }
-
- /* Precompute all register parameters. It isn't safe to compute anything
- once we have started filling any specific hard regs. */
- reg_parm_seen = 0;
- for (i = 0; i < num_actuals; i++)
- if (args[i].reg != 0 && ! args[i].pass_on_stack)
- {
- reg_parm_seen = 1;
-
- if (args[i].value == 0)
- {
- push_temp_slots ();
- args[i].value = expand_expr (args[i].tree_value, NULL_RTX,
- VOIDmode, 0);
- preserve_temp_slots (args[i].value);
- pop_temp_slots ();
-
- /* ANSI doesn't require a sequence point here,
- but PCC has one, so this will avoid some problems. */
- emit_queue ();
- }
-
- /* If we are to promote the function arg to a wider mode,
- do it now. */
-
- if (args[i].mode != TYPE_MODE (TREE_TYPE (args[i].tree_value)))
- args[i].value
- = convert_modes (args[i].mode,
- TYPE_MODE (TREE_TYPE (args[i].tree_value)),
- args[i].value, args[i].unsignedp);
-
- /* If the value is expensive, and we are inside an appropriately
- short loop, put the value into a pseudo and then put the pseudo
- into the hard reg.
-
- For small register classes, also do this if this call uses
- register parameters. This is to avoid reload conflicts while
- loading the parameters registers. */
-
- if ((! (GET_CODE (args[i].value) == REG
- || (GET_CODE (args[i].value) == SUBREG
- && GET_CODE (SUBREG_REG (args[i].value)) == REG)))
- && args[i].mode != BLKmode
- && rtx_cost (args[i].value, SET) > 2
-#ifdef SMALL_REGISTER_CLASSES
- && ((SMALL_REGISTER_CLASSES && reg_parm_seen)
- || preserve_subexpressions_p ())
-#else
- && preserve_subexpressions_p ()
-#endif
- )
- args[i].value = copy_to_mode_reg (args[i].mode, args[i].value);
- }
-
-#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE)
- /* The argument list is the property of the called routine and it
- may clobber it. If the fixed area has been used for previous
- parameters, we must save and restore it.
-
- Here we compute the boundary of the that needs to be saved, if any. */
-
-#ifdef ARGS_GROW_DOWNWARD
- for (i = 0; i < reg_parm_stack_space + 1; i++)
-#else
- for (i = 0; i < reg_parm_stack_space; i++)
-#endif
- {
- if (i >= highest_outgoing_arg_in_use
- || stack_usage_map[i] == 0)
- continue;
-
- if (low_to_save == -1)
- low_to_save = i;
-
- high_to_save = i;
- }
-
- if (low_to_save >= 0)
- {
- int num_to_save = high_to_save - low_to_save + 1;
- enum machine_mode save_mode
- = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1);
- rtx stack_area;
-
- /* If we don't have the required alignment, must do this in BLKmode. */
- if ((low_to_save & (MIN (GET_MODE_SIZE (save_mode),
- BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
- save_mode = BLKmode;
-
- stack_area = gen_rtx (MEM, save_mode,
- memory_address (save_mode,
-
-#ifdef ARGS_GROW_DOWNWARD
- plus_constant (argblock,
- - high_to_save)
-#else
- plus_constant (argblock,
- low_to_save)
-#endif
- ));
- if (save_mode == BLKmode)
- {
- save_area = assign_stack_temp (BLKmode, num_to_save, 0);
- MEM_IN_STRUCT_P (save_area) = 0;
- emit_block_move (validize_mem (save_area), stack_area,
- GEN_INT (num_to_save),
- PARM_BOUNDARY / BITS_PER_UNIT);
- }
- else
- {
- save_area = gen_reg_rtx (save_mode);
- emit_move_insn (save_area, stack_area);
- }
- }
-#endif
-
-
- /* Now store (and compute if necessary) all non-register parms.
- These come before register parms, since they can require block-moves,
- which could clobber the registers used for register parms.
- Parms which have partial registers are not stored here,
- but we do preallocate space here if they want that. */
-
- for (i = 0; i < num_actuals; i++)
- if (args[i].reg == 0 || args[i].pass_on_stack)
- store_one_arg (&args[i], argblock, may_be_alloca,
- args_size.var != 0, fndecl, reg_parm_stack_space);
-
- /* If we have a parm that is passed in registers but not in memory
- and whose alignment does not permit a direct copy into registers,
- make a group of pseudos that correspond to each register that we
- will later fill. */
-
- if (STRICT_ALIGNMENT)
- for (i = 0; i < num_actuals; i++)
- if (args[i].reg != 0 && ! args[i].pass_on_stack
- && args[i].mode == BLKmode
- && (TYPE_ALIGN (TREE_TYPE (args[i].tree_value))
- < MIN (BIGGEST_ALIGNMENT, BITS_PER_WORD)))
- {
- int bytes = int_size_in_bytes (TREE_TYPE (args[i].tree_value));
- int big_endian_correction = 0;
-
- args[i].n_aligned_regs
- = args[i].partial ? args[i].partial
- : (bytes + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
-
- args[i].aligned_regs = (rtx *) alloca (sizeof (rtx)
- * args[i].n_aligned_regs);
-
- /* Structures smaller than a word are aligned to the least
- significant byte (to the right). On a BYTES_BIG_ENDIAN machine,
- this means we must skip the empty high order bytes when
- calculating the bit offset. */
- if (BYTES_BIG_ENDIAN && bytes < UNITS_PER_WORD)
- big_endian_correction = (BITS_PER_WORD - (bytes * BITS_PER_UNIT));
-
- for (j = 0; j < args[i].n_aligned_regs; j++)
- {
- rtx reg = gen_reg_rtx (word_mode);
- rtx word = operand_subword_force (args[i].value, j, BLKmode);
- int bitsize = TYPE_ALIGN (TREE_TYPE (args[i].tree_value));
- int bitpos;
-
- args[i].aligned_regs[j] = reg;
-
- /* Clobber REG and move each partword into it. Ensure we don't
- go past the end of the structure. Note that the loop below
- works because we've already verified that padding
- and endianness are compatible. */
-
- emit_insn (gen_rtx (CLOBBER, VOIDmode, reg));
-
- for (bitpos = 0;
- bitpos < BITS_PER_WORD && bytes > 0;
- bitpos += bitsize, bytes -= bitsize / BITS_PER_UNIT)
- {
- int xbitpos = bitpos + big_endian_correction;
-
- store_bit_field (reg, bitsize, xbitpos, word_mode,
- extract_bit_field (word, bitsize, bitpos, 1,
- NULL_RTX, word_mode,
- word_mode,
- bitsize / BITS_PER_UNIT,
- BITS_PER_WORD),
- bitsize / BITS_PER_UNIT, BITS_PER_WORD);
- }
- }
- }
-
- /* Now store any partially-in-registers parm.
- This is the last place a block-move can happen. */
- if (reg_parm_seen)
- for (i = 0; i < num_actuals; i++)
- if (args[i].partial != 0 && ! args[i].pass_on_stack)
- store_one_arg (&args[i], argblock, may_be_alloca,
- args_size.var != 0, fndecl, reg_parm_stack_space);
-
-#ifndef PUSH_ARGS_REVERSED
-#ifdef STACK_BOUNDARY
- /* If we pushed args in forward order, perform stack alignment
- after pushing the last arg. */
- if (argblock == 0)
- anti_adjust_stack (GEN_INT (args_size.constant
- - original_args_size.constant));
-#endif
-#endif
-
- /* If register arguments require space on the stack and stack space
- was not preallocated, allocate stack space here for arguments
- passed in registers. */
-#if ! defined(ACCUMULATE_OUTGOING_ARGS) && defined(OUTGOING_REG_PARM_STACK_SPACE)
- if (must_preallocate == 0 && reg_parm_stack_space > 0)
- anti_adjust_stack (GEN_INT (reg_parm_stack_space));
-#endif
-
- /* Pass the function the address in which to return a structure value. */
- if (structure_value_addr && ! structure_value_addr_parm)
- {
- emit_move_insn (struct_value_rtx,
- force_reg (Pmode,
- force_operand (structure_value_addr,
- NULL_RTX)));
- if (GET_CODE (struct_value_rtx) == REG)
- use_reg (&call_fusage, struct_value_rtx);
- }
-
- funexp = prepare_call_address (funexp, fndecl, &call_fusage, reg_parm_seen);
-
- /* Now do the register loads required for any wholly-register parms or any
- parms which are passed both on the stack and in a register. Their
- expressions were already evaluated.
-
- Mark all register-parms as living through the call, putting these USE
- insns in the CALL_INSN_FUNCTION_USAGE field. */
-
- for (i = 0; i < num_actuals; i++)
- {
- rtx reg = args[i].reg;
- int partial = args[i].partial;
- int nregs;
-
- if (reg)
- {
- /* Set to non-negative if must move a word at a time, even if just
- one word (e.g, partial == 1 && mode == DFmode). Set to -1 if
- we just use a normal move insn. This value can be zero if the
- argument is a zero size structure with no fields. */
- nregs = (partial ? partial
- : (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
- ? ((int_size_in_bytes (TREE_TYPE (args[i].tree_value))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
- : -1));
-
- /* Handle calls that pass values in multiple non-contiguous
- locations. The Irix 6 ABI has examples of this. */
-
- if (GET_CODE (reg) == PARALLEL)
- emit_group_load (reg, args[i].value);
-
- /* If simple case, just do move. If normal partial, store_one_arg
- has already loaded the register for us. In all other cases,
- load the register(s) from memory. */
-
- else if (nregs == -1)
- emit_move_insn (reg, args[i].value);
-
- /* If we have pre-computed the values to put in the registers in
- the case of non-aligned structures, copy them in now. */
-
- else if (args[i].n_aligned_regs != 0)
- for (j = 0; j < args[i].n_aligned_regs; j++)
- emit_move_insn (gen_rtx (REG, word_mode, REGNO (reg) + j),
- args[i].aligned_regs[j]);
-
- else if (partial == 0 || args[i].pass_on_stack)
- move_block_to_reg (REGNO (reg),
- validize_mem (args[i].value), nregs,
- args[i].mode);
-
- /* Handle calls that pass values in multiple non-contiguous
- locations. The Irix 6 ABI has examples of this. */
- if (GET_CODE (reg) == PARALLEL)
- use_group_regs (&call_fusage, reg);
- else if (nregs == -1)
- use_reg (&call_fusage, reg);
- else
- use_regs (&call_fusage, REGNO (reg), nregs == 0 ? 1 : nregs);
- }
- }
-
- /* Perform postincrements before actually calling the function. */
- emit_queue ();
-
- /* All arguments and registers used for the call must be set up by now! */
-
- /* Generate the actual call instruction. */
- emit_call_1 (funexp, fndecl, funtype, args_size.constant, struct_value_size,
- FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
- valreg, old_inhibit_defer_pop, call_fusage, is_const);
-
- /* 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
- we have no way to move such values into a pseudo register. */
- if (is_const && valreg != 0 && GET_CODE (valreg) != PARALLEL)
- {
- rtx note = 0;
- rtx temp = gen_reg_rtx (GET_MODE (valreg));
- rtx insns;
-
- /* Construct an "equal form" for the value which mentions all the
- arguments in order as well as the function name. */
-#ifdef PUSH_ARGS_REVERSED
- for (i = 0; i < num_actuals; i++)
- note = gen_rtx (EXPR_LIST, VOIDmode, args[i].initial_value, note);
-#else
- for (i = num_actuals - 1; i >= 0; i--)
- note = gen_rtx (EXPR_LIST, VOIDmode, args[i].initial_value, note);
-#endif
- note = gen_rtx (EXPR_LIST, VOIDmode, funexp, note);
-
- insns = get_insns ();
- end_sequence ();
-
- emit_libcall_block (insns, temp, valreg, note);
-
- valreg = temp;
- }
- else if (is_const)
- {
- /* Otherwise, just write out the sequence without a note. */
- rtx insns = get_insns ();
-
- end_sequence ();
- emit_insns (insns);
- }
-
- /* For calls to `setjmp', etc., inform flow.c it should complain
- if nonvolatile values are live. */
-
- if (returns_twice)
- {
- emit_note (name, NOTE_INSN_SETJMP);
- current_function_calls_setjmp = 1;
- }
-
- if (is_longjmp)
- current_function_calls_longjmp = 1;
-
- /* Notice functions that cannot return.
- If optimizing, insns emitted below will be dead.
- If not optimizing, they will exist, which is useful
- if the user uses the `return' command in the debugger. */
-
- if (is_volatile || is_longjmp)
- emit_barrier ();
-
- /* If value type not void, return an rtx for the value. */
-
- /* If there are cleanups to be called, don't use a hard reg as target. */
- if (cleanups_this_call != old_cleanups
- && target && REG_P (target)
- && REGNO (target) < FIRST_PSEUDO_REGISTER)
- target = 0;
-
- if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode
- || ignore)
- {
- target = const0_rtx;
- }
- else if (structure_value_addr)
- {
- if (target == 0 || GET_CODE (target) != MEM)
- {
- target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
- memory_address (TYPE_MODE (TREE_TYPE (exp)),
- structure_value_addr));
- MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
- }
- }
- else if (pcc_struct_value)
- {
- if (target == 0)
- {
- /* We used leave the value in the location that it is
- returned in, but that causes problems if it is used more
- than once in one expression. Rather than trying to track
- when a copy is required, we always copy when TARGET is
- not specified. This calling sequence is only used on
- a few machines and TARGET is usually nonzero. */
- if (TYPE_MODE (TREE_TYPE (exp)) == BLKmode)
- {
- target = assign_stack_temp (BLKmode,
- int_size_in_bytes (TREE_TYPE (exp)),
- 0);
-
- MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
-
- /* Save this temp slot around the pop below. */
- preserve_temp_slots (target);
- }
- else
- target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
- }
-
- if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
- emit_move_insn (target, gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
- copy_to_reg (valreg)));
- else
- emit_block_move (target, gen_rtx (MEM, BLKmode, copy_to_reg (valreg)),
- expr_size (exp),
- TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
- }
- /* Handle calls that return values in multiple non-contiguous locations.
- The Irix 6 ABI has examples of this. */
- else if (GET_CODE (valreg) == PARALLEL)
- {
- if (target == 0)
- {
- int bytes = int_size_in_bytes (TREE_TYPE (exp));
- target = assign_stack_temp (TYPE_MODE (TREE_TYPE (exp)), bytes, 0);
- MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
- preserve_temp_slots (target);
- }
-
- emit_group_store (target, valreg);
- }
- else if (target && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp))
- && GET_MODE (target) == GET_MODE (valreg))
- /* TARGET and VALREG cannot be equal at this point because the latter
- would not have REG_FUNCTION_VALUE_P true, while the former would if
- it were referring to the same register.
-
- If they refer to the same register, this move will be a no-op, except
- when function inlining is being done. */
- emit_move_insn (target, valreg);
- else if (TYPE_MODE (TREE_TYPE (exp)) == BLKmode)
- {
- /* Some machines (the PA for example) want to return all small
- structures in registers regardless of the structure's alignment.
-
- Deal with them explicitly by copying from the return registers
- into the target MEM locations. */
- int bytes = int_size_in_bytes (TREE_TYPE (exp));
- int n_regs = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
- int i;
- enum machine_mode tmpmode;
- rtx src, dst;
- int bitsize = MIN (TYPE_ALIGN (TREE_TYPE (exp)), BITS_PER_WORD);
- int bitpos, xbitpos, big_endian_correction = 0;
-
- if (target == 0)
- {
- target = assign_stack_temp (BLKmode, bytes, 0);
- MEM_IN_STRUCT_P (target) = AGGREGATE_TYPE_P (TREE_TYPE (exp));
- preserve_temp_slots (target);
- }
-
- /* This code assumes valreg is at least a full word. If it isn't,
- copy it into a new pseudo which is a full word. */
- if (GET_MODE (valreg) != BLKmode
- && GET_MODE_SIZE (GET_MODE (valreg)) < UNITS_PER_WORD)
- valreg = convert_to_mode (word_mode, valreg,
- TREE_UNSIGNED (TREE_TYPE (exp)));
-
- /* Structures whose size is not a multiple of a word are aligned
- to the least significant byte (to the right). On a BYTES_BIG_ENDIAN
- machine, this means we must skip the empty high order bytes when
- calculating the bit offset. */
- if (BYTES_BIG_ENDIAN && bytes % UNITS_PER_WORD)
- big_endian_correction = (BITS_PER_WORD - ((bytes % UNITS_PER_WORD)
- * BITS_PER_UNIT));
-
- /* Copy the structure BITSIZE bites at a time.
-
- We could probably emit more efficient code for machines
- which do not use strict alignment, but it doesn't seem
- worth the effort at the current time. */
- for (bitpos = 0, xbitpos = big_endian_correction;
- bitpos < bytes * BITS_PER_UNIT;
- bitpos += bitsize, xbitpos += bitsize)
- {
-
- /* We need a new source operand each time xbitpos is on a
- word boundary and when xbitpos == big_endian_correction
- (the first time through). */
- if (xbitpos % BITS_PER_WORD == 0
- || xbitpos == big_endian_correction)
- src = operand_subword_force (valreg,
- xbitpos / BITS_PER_WORD,
- BLKmode);
-
- /* We need a new destination operand each time bitpos is on
- a word boundary. */
- if (bitpos % BITS_PER_WORD == 0)
- dst = operand_subword (target, bitpos / BITS_PER_WORD, 1, BLKmode);
-
- /* Use xbitpos for the source extraction (right justified) and
- xbitpos for the destination store (left justified). */
- store_bit_field (dst, bitsize, bitpos % BITS_PER_WORD, word_mode,
- extract_bit_field (src, bitsize,
- xbitpos % BITS_PER_WORD, 1,
- NULL_RTX, word_mode,
- word_mode,
- bitsize / BITS_PER_UNIT,
- BITS_PER_WORD),
- bitsize / BITS_PER_UNIT, BITS_PER_WORD);
- }
- }
- else
- target = copy_to_reg (valreg);
-
-#ifdef PROMOTE_FUNCTION_RETURN
- /* If we promoted this return value, make the proper SUBREG. TARGET
- might be const0_rtx here, so be careful. */
- if (GET_CODE (target) == REG
- && TYPE_MODE (TREE_TYPE (exp)) != BLKmode
- && GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
- {
- tree type = TREE_TYPE (exp);
- int unsignedp = TREE_UNSIGNED (type);
-
- /* If we don't promote as expected, something is wrong. */
- if (GET_MODE (target)
- != promote_mode (type, TYPE_MODE (type), &unsignedp, 1))
- abort ();
-
- target = gen_rtx (SUBREG, TYPE_MODE (type), target, 0);
- SUBREG_PROMOTED_VAR_P (target) = 1;
- SUBREG_PROMOTED_UNSIGNED_P (target) = unsignedp;
- }
-#endif
-
- if (flag_short_temps)
- {
- /* Perform all cleanups needed for the arguments of this call
- (i.e. destructors in C++). */
- expand_cleanups_to (old_cleanups);
- }
-
- /* If size of args is variable or this was a constructor call for a stack
- argument, restore saved stack-pointer value. */
-
- if (old_stack_level)
- {
- emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
- pending_stack_adjust = old_pending_adj;
-#ifdef ACCUMULATE_OUTGOING_ARGS
- stack_arg_under_construction = old_stack_arg_under_construction;
- highest_outgoing_arg_in_use = initial_highest_arg_in_use;
- stack_usage_map = initial_stack_usage_map;
-#endif
- }
-#ifdef ACCUMULATE_OUTGOING_ARGS
- else
- {
-#ifdef REG_PARM_STACK_SPACE
- if (save_area)
- {
- enum machine_mode save_mode = GET_MODE (save_area);
- rtx stack_area
- = gen_rtx (MEM, save_mode,
- memory_address (save_mode,
-#ifdef ARGS_GROW_DOWNWARD
- plus_constant (argblock, - high_to_save)
-#else
- plus_constant (argblock, low_to_save)
-#endif
- ));
-
- if (save_mode != BLKmode)
- emit_move_insn (stack_area, save_area);
- else
- emit_block_move (stack_area, validize_mem (save_area),
- GEN_INT (high_to_save - low_to_save + 1),
- PARM_BOUNDARY / BITS_PER_UNIT);
- }
-#endif
-
- /* If we saved any argument areas, restore them. */
- for (i = 0; i < num_actuals; i++)
- if (args[i].save_area)
- {
- enum machine_mode save_mode = GET_MODE (args[i].save_area);
- rtx stack_area
- = gen_rtx (MEM, save_mode,
- memory_address (save_mode,
- XEXP (args[i].stack_slot, 0)));
-
- if (save_mode != BLKmode)
- emit_move_insn (stack_area, args[i].save_area);
- else
- emit_block_move (stack_area, validize_mem (args[i].save_area),
- GEN_INT (args[i].size.constant),
- PARM_BOUNDARY / BITS_PER_UNIT);
- }
-
- highest_outgoing_arg_in_use = initial_highest_arg_in_use;
- stack_usage_map = initial_stack_usage_map;
- }
-#endif
-
- /* If this was alloca, record the new stack level for nonlocal gotos.
- Check for the handler slots since we might not have a save area
- for non-local gotos. */
-
- if (may_be_alloca && nonlocal_goto_handler_slot != 0)
- emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level, NULL_RTX);
-
- pop_temp_slots ();
-
- return target;
-}
-
-/* Output a library call to function FUN (a SYMBOL_REF rtx)
- (emitting the queue unless NO_QUEUE is nonzero),
- for a value of mode OUTMODE,
- with NARGS different arguments, passed as alternating rtx values
- and machine_modes to convert them to.
- The rtx values should have been passed through protect_from_queue already.
-
- NO_QUEUE will be true if and only if the library call is a `const' call
- which will be enclosed in REG_LIBCALL/REG_RETVAL notes; it is equivalent
- to the variable is_const in expand_call.
-
- NO_QUEUE must be true for const calls, because if it isn't, then
- any pending increment will be emitted between REG_LIBCALL/REG_RETVAL notes,
- and will be lost if the libcall sequence is optimized away.
-
- NO_QUEUE must be false for non-const calls, because if it isn't, the
- call insn will have its CONST_CALL_P bit set, and it will be incorrectly
- optimized. For instance, the instruction scheduler may incorrectly
- move memory references across the non-const call. */
-
-void
-emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode,
- int nargs, ...))
-{
-#ifndef __STDC__
- rtx orgfun;
- int no_queue;
- enum machine_mode outmode;
- int nargs;
-#endif
- va_list p;
- /* Total size in bytes of all the stack-parms scanned so far. */
- struct args_size args_size;
- /* Size of arguments before any adjustments (such as rounding). */
- struct args_size original_args_size;
- register int argnum;
- rtx fun;
- int inc;
- int count;
- rtx argblock = 0;
- CUMULATIVE_ARGS args_so_far;
- struct arg { rtx value; enum machine_mode mode; rtx reg; int partial;
- struct args_size offset; struct args_size size; };
- struct arg *argvec;
- int old_inhibit_defer_pop = inhibit_defer_pop;
- rtx call_fusage = 0;
-
- VA_START (p, nargs);
-
-#ifndef __STDC__
- orgfun = va_arg (p, rtx);
- no_queue = va_arg (p, int);
- outmode = va_arg (p, enum machine_mode);
- nargs = va_arg (p, int);
-#endif
-
- fun = orgfun;
-
- /* Copy all the libcall-arguments out of the varargs data
- and into a vector ARGVEC.
-
- Compute how to pass each argument. We only support a very small subset
- of the full argument passing conventions to limit complexity here since
- library functions shouldn't have many args. */
-
- argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
-
- INIT_CUMULATIVE_ARGS (args_so_far, NULL_TREE, fun, 0);
-
- args_size.constant = 0;
- args_size.var = 0;
-
- push_temp_slots ();
-
- for (count = 0; count < nargs; count++)
- {
- rtx val = va_arg (p, rtx);
- enum machine_mode mode = va_arg (p, enum machine_mode);
-
- /* We cannot convert the arg value to the mode the library wants here;
- must do it earlier where we know the signedness of the arg. */
- if (mode == BLKmode
- || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode))
- abort ();
-
- /* On some machines, there's no way to pass a float to a library fcn.
- Pass it as a double instead. */
-#ifdef LIBGCC_NEEDS_DOUBLE
- if (LIBGCC_NEEDS_DOUBLE && mode == SFmode)
- val = convert_modes (DFmode, SFmode, val, 0), mode = DFmode;
-#endif
-
- /* There's no need to call protect_from_queue, because
- either emit_move_insn or emit_push_insn will do that. */
-
- /* Make sure it is a reasonable operand for a move or push insn. */
- if (GET_CODE (val) != REG && GET_CODE (val) != MEM
- && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val)))
- val = force_operand (val, NULL_RTX);
-
-#ifdef FUNCTION_ARG_PASS_BY_REFERENCE
- if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
- {
- /* We do not support FUNCTION_ARG_CALLEE_COPIES here since it can
- be viewed as just an efficiency improvement. */
- rtx slot = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
- emit_move_insn (slot, val);
- val = force_operand (XEXP (slot, 0), NULL_RTX);
- mode = Pmode;
- }
-#endif
-
- argvec[count].value = val;
- argvec[count].mode = mode;
-
- argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
- if (argvec[count].reg && GET_CODE (argvec[count].reg) == PARALLEL)
- abort ();
-#ifdef FUNCTION_ARG_PARTIAL_NREGS
- argvec[count].partial
- = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1);
-#else
- argvec[count].partial = 0;
-#endif
-
- locate_and_pad_parm (mode, NULL_TREE,
- argvec[count].reg && argvec[count].partial == 0,
- NULL_TREE, &args_size, &argvec[count].offset,
- &argvec[count].size);
-
- if (argvec[count].size.var)
- abort ();
-
-#ifndef REG_PARM_STACK_SPACE
- if (argvec[count].partial)
- argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD;
-#endif
-
- if (argvec[count].reg == 0 || argvec[count].partial != 0
-#ifdef REG_PARM_STACK_SPACE
- || 1
-#endif
- )
- args_size.constant += argvec[count].size.constant;
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* If this arg is actually passed on the stack, it might be
- clobbering something we already put there (this library call might
- be inside the evaluation of an argument to a function whose call
- requires the stack). This will only occur when the library call
- has sufficient args to run out of argument registers. Abort in
- this case; if this ever occurs, code must be added to save and
- restore the arg slot. */
-
- if (argvec[count].reg == 0 || argvec[count].partial != 0)
- abort ();
-#endif
-
- FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree) 0, 1);
- }
- va_end (p);
-
- /* If this machine requires an external definition for library
- functions, write one out. */
- assemble_external_libcall (fun);
-
- original_args_size = args_size;
-#ifdef STACK_BOUNDARY
- args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
- / STACK_BYTES) * STACK_BYTES);
-#endif
-
-#ifdef REG_PARM_STACK_SPACE
- args_size.constant = MAX (args_size.constant,
- REG_PARM_STACK_SPACE (NULL_TREE));
-#ifndef OUTGOING_REG_PARM_STACK_SPACE
- args_size.constant -= REG_PARM_STACK_SPACE (NULL_TREE);
-#endif
-#endif
-
- if (args_size.constant > current_function_outgoing_args_size)
- current_function_outgoing_args_size = args_size.constant;
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- args_size.constant = 0;
-#endif
-
-#ifndef PUSH_ROUNDING
- argblock = push_block (GEN_INT (args_size.constant), 0, 0);
-#endif
-
-#ifdef PUSH_ARGS_REVERSED
-#ifdef STACK_BOUNDARY
- /* If we push args individually in reverse order, perform stack alignment
- before the first push (the last arg). */
- if (argblock == 0)
- anti_adjust_stack (GEN_INT (args_size.constant
- - original_args_size.constant));
-#endif
-#endif
-
-#ifdef PUSH_ARGS_REVERSED
- inc = -1;
- argnum = nargs - 1;
-#else
- inc = 1;
- argnum = 0;
-#endif
-
- /* Push the args that need to be pushed. */
-
- for (count = 0; count < nargs; count++, argnum += inc)
- {
- register enum machine_mode mode = argvec[argnum].mode;
- register rtx val = argvec[argnum].value;
- rtx reg = argvec[argnum].reg;
- int partial = argvec[argnum].partial;
-
- if (! (reg != 0 && partial == 0))
- emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
- argblock, GEN_INT (argvec[count].offset.constant));
- NO_DEFER_POP;
- }
-
-#ifndef PUSH_ARGS_REVERSED
-#ifdef STACK_BOUNDARY
- /* If we pushed args in forward order, perform stack alignment
- after pushing the last arg. */
- if (argblock == 0)
- anti_adjust_stack (GEN_INT (args_size.constant
- - original_args_size.constant));
-#endif
-#endif
-
-#ifdef PUSH_ARGS_REVERSED
- argnum = nargs - 1;
-#else
- argnum = 0;
-#endif
-
- fun = prepare_call_address (fun, NULL_TREE, &call_fusage, 0);
-
- /* Now load any reg parms into their regs. */
-
- for (count = 0; count < nargs; count++, argnum += inc)
- {
- register enum machine_mode mode = argvec[argnum].mode;
- register rtx val = argvec[argnum].value;
- rtx reg = argvec[argnum].reg;
- int partial = argvec[argnum].partial;
-
- if (reg != 0 && partial == 0)
- emit_move_insn (reg, val);
- NO_DEFER_POP;
- }
-
- /* For version 1.37, try deleting this entirely. */
- if (! no_queue)
- emit_queue ();
-
- /* Any regs containing parms remain in use through the call. */
- for (count = 0; count < nargs; count++)
- if (argvec[count].reg != 0)
- use_reg (&call_fusage, argvec[count].reg);
-
- /* Don't allow popping to be deferred, since then
- cse'ing of library calls could delete a call and leave the pop. */
- NO_DEFER_POP;
-
- /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which
- will set inhibit_defer_pop to that value. */
-
- /* The return type is needed to decide how many bytes the function pops.
- Signedness plays no role in that, so for simplicity, we pretend it's
- always signed. We also assume that the list of arguments passed has
- no impact, so we pretend it is unknown. */
-
- emit_call_1 (fun,
- get_identifier (XSTR (orgfun, 0)),
- build_function_type (outmode == VOIDmode ? void_type_node
- : type_for_mode (outmode, 0), NULL_TREE),
- args_size.constant, 0,
- FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
- outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX,
- old_inhibit_defer_pop + 1, call_fusage, no_queue);
-
- pop_temp_slots ();
-
- /* Now restore inhibit_defer_pop to its actual original value. */
- OK_DEFER_POP;
-}
-
-/* Like emit_library_call except that an extra argument, VALUE,
- comes second and says where to store the result.
- (If VALUE is zero, this function chooses a convenient way
- to return the value.
-
- This function returns an rtx for where the value is to be found.
- If VALUE is nonzero, VALUE is returned. */
-
-rtx
-emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue,
- enum machine_mode outmode, int nargs, ...))
-{
-#ifndef __STDC__
- rtx orgfun;
- rtx value;
- int no_queue;
- enum machine_mode outmode;
- int nargs;
-#endif
- va_list p;
- /* Total size in bytes of all the stack-parms scanned so far. */
- struct args_size args_size;
- /* Size of arguments before any adjustments (such as rounding). */
- struct args_size original_args_size;
- register int argnum;
- rtx fun;
- int inc;
- int count;
- rtx argblock = 0;
- CUMULATIVE_ARGS args_so_far;
- struct arg { rtx value; enum machine_mode mode; rtx reg; int partial;
- struct args_size offset; struct args_size size; };
- struct arg *argvec;
- int old_inhibit_defer_pop = inhibit_defer_pop;
- rtx call_fusage = 0;
- rtx mem_value = 0;
- int pcc_struct_value = 0;
- int struct_value_size = 0;
- int is_const;
-
- VA_START (p, nargs);
-
-#ifndef __STDC__
- orgfun = va_arg (p, rtx);
- value = va_arg (p, rtx);
- no_queue = va_arg (p, int);
- outmode = va_arg (p, enum machine_mode);
- nargs = va_arg (p, int);
-#endif
-
- is_const = no_queue;
- fun = orgfun;
-
- /* If this kind of value comes back in memory,
- decide where in memory it should come back. */
- if (aggregate_value_p (type_for_mode (outmode, 0)))
- {
-#ifdef PCC_STATIC_STRUCT_RETURN
- rtx pointer_reg
- = hard_function_value (build_pointer_type (type_for_mode (outmode, 0)),
- 0);
- mem_value = gen_rtx (MEM, outmode, pointer_reg);
- pcc_struct_value = 1;
- if (value == 0)
- value = gen_reg_rtx (outmode);
-#else /* not PCC_STATIC_STRUCT_RETURN */
- struct_value_size = GET_MODE_SIZE (outmode);
- if (value != 0 && GET_CODE (value) == MEM)
- mem_value = value;
- else
- mem_value = assign_stack_temp (outmode, GET_MODE_SIZE (outmode), 0);
-#endif
-
- /* This call returns a big structure. */
- is_const = 0;
- }
-
- /* ??? Unfinished: must pass the memory address as an argument. */
-
- /* Copy all the libcall-arguments out of the varargs data
- and into a vector ARGVEC.
-
- Compute how to pass each argument. We only support a very small subset
- of the full argument passing conventions to limit complexity here since
- library functions shouldn't have many args. */
-
- argvec = (struct arg *) alloca ((nargs + 1) * sizeof (struct arg));
-
- INIT_CUMULATIVE_ARGS (args_so_far, NULL_TREE, fun, 0);
-
- args_size.constant = 0;
- args_size.var = 0;
-
- count = 0;
-
- push_temp_slots ();
-
- /* If there's a structure value address to be passed,
- either pass it in the special place, or pass it as an extra argument. */
- if (mem_value && struct_value_rtx == 0 && ! pcc_struct_value)
- {
- rtx addr = XEXP (mem_value, 0);
- nargs++;
-
- /* Make sure it is a reasonable operand for a move or push insn. */
- if (GET_CODE (addr) != REG && GET_CODE (addr) != MEM
- && ! (CONSTANT_P (addr) && LEGITIMATE_CONSTANT_P (addr)))
- addr = force_operand (addr, NULL_RTX);
-
- argvec[count].value = addr;
- argvec[count].mode = Pmode;
- argvec[count].partial = 0;
-
- argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1);
-#ifdef FUNCTION_ARG_PARTIAL_NREGS
- if (FUNCTION_ARG_PARTIAL_NREGS (args_so_far, Pmode, NULL_TREE, 1))
- abort ();
-#endif
-
- locate_and_pad_parm (Pmode, NULL_TREE,
- argvec[count].reg && argvec[count].partial == 0,
- NULL_TREE, &args_size, &argvec[count].offset,
- &argvec[count].size);
-
-
- if (argvec[count].reg == 0 || argvec[count].partial != 0
-#ifdef REG_PARM_STACK_SPACE
- || 1
-#endif
- )
- args_size.constant += argvec[count].size.constant;
-
- FUNCTION_ARG_ADVANCE (args_so_far, Pmode, (tree) 0, 1);
-
- count++;
- }
-
- for (; count < nargs; count++)
- {
- rtx val = va_arg (p, rtx);
- enum machine_mode mode = va_arg (p, enum machine_mode);
-
- /* We cannot convert the arg value to the mode the library wants here;
- must do it earlier where we know the signedness of the arg. */
- if (mode == BLKmode
- || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode))
- abort ();
-
- /* On some machines, there's no way to pass a float to a library fcn.
- Pass it as a double instead. */
-#ifdef LIBGCC_NEEDS_DOUBLE
- if (LIBGCC_NEEDS_DOUBLE && mode == SFmode)
- val = convert_modes (DFmode, SFmode, val, 0), mode = DFmode;
-#endif
-
- /* There's no need to call protect_from_queue, because
- either emit_move_insn or emit_push_insn will do that. */
-
- /* Make sure it is a reasonable operand for a move or push insn. */
- if (GET_CODE (val) != REG && GET_CODE (val) != MEM
- && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val)))
- val = force_operand (val, NULL_RTX);
-
-#ifdef FUNCTION_ARG_PASS_BY_REFERENCE
- if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
- {
- /* We do not support FUNCTION_ARG_CALLEE_COPIES here since it can
- be viewed as just an efficiency improvement. */
- rtx slot = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
- emit_move_insn (slot, val);
- val = XEXP (slot, 0);
- mode = Pmode;
- }
-#endif
-
- argvec[count].value = val;
- argvec[count].mode = mode;
-
- argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1);
- if (argvec[count].reg && GET_CODE (argvec[count].reg) == PARALLEL)
- abort ();
-#ifdef FUNCTION_ARG_PARTIAL_NREGS
- argvec[count].partial
- = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1);
-#else
- argvec[count].partial = 0;
-#endif
-
- locate_and_pad_parm (mode, NULL_TREE,
- argvec[count].reg && argvec[count].partial == 0,
- NULL_TREE, &args_size, &argvec[count].offset,
- &argvec[count].size);
-
- if (argvec[count].size.var)
- abort ();
-
-#ifndef REG_PARM_STACK_SPACE
- if (argvec[count].partial)
- argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD;
-#endif
-
- if (argvec[count].reg == 0 || argvec[count].partial != 0
-#ifdef REG_PARM_STACK_SPACE
- || 1
-#endif
- )
- args_size.constant += argvec[count].size.constant;
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* If this arg is actually passed on the stack, it might be
- clobbering something we already put there (this library call might
- be inside the evaluation of an argument to a function whose call
- requires the stack). This will only occur when the library call
- has sufficient args to run out of argument registers. Abort in
- this case; if this ever occurs, code must be added to save and
- restore the arg slot. */
-
- if (argvec[count].reg == 0 || argvec[count].partial != 0)
- abort ();
-#endif
-
- FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree) 0, 1);
- }
- va_end (p);
-
- /* If this machine requires an external definition for library
- functions, write one out. */
- assemble_external_libcall (fun);
-
- original_args_size = args_size;
-#ifdef STACK_BOUNDARY
- args_size.constant = (((args_size.constant + (STACK_BYTES - 1))
- / STACK_BYTES) * STACK_BYTES);
-#endif
-
-#ifdef REG_PARM_STACK_SPACE
- args_size.constant = MAX (args_size.constant,
- REG_PARM_STACK_SPACE (NULL_TREE));
-#ifndef OUTGOING_REG_PARM_STACK_SPACE
- args_size.constant -= REG_PARM_STACK_SPACE (NULL_TREE);
-#endif
-#endif
-
- if (args_size.constant > current_function_outgoing_args_size)
- current_function_outgoing_args_size = args_size.constant;
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- args_size.constant = 0;
-#endif
-
-#ifndef PUSH_ROUNDING
- argblock = push_block (GEN_INT (args_size.constant), 0, 0);
-#endif
-
-#ifdef PUSH_ARGS_REVERSED
-#ifdef STACK_BOUNDARY
- /* If we push args individually in reverse order, perform stack alignment
- before the first push (the last arg). */
- if (argblock == 0)
- anti_adjust_stack (GEN_INT (args_size.constant
- - original_args_size.constant));
-#endif
-#endif
-
-#ifdef PUSH_ARGS_REVERSED
- inc = -1;
- argnum = nargs - 1;
-#else
- inc = 1;
- argnum = 0;
-#endif
-
- /* Push the args that need to be pushed. */
-
- for (count = 0; count < nargs; count++, argnum += inc)
- {
- register enum machine_mode mode = argvec[argnum].mode;
- register rtx val = argvec[argnum].value;
- rtx reg = argvec[argnum].reg;
- int partial = argvec[argnum].partial;
-
- if (! (reg != 0 && partial == 0))
- emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0,
- argblock, GEN_INT (argvec[count].offset.constant));
- NO_DEFER_POP;
- }
-
-#ifndef PUSH_ARGS_REVERSED
-#ifdef STACK_BOUNDARY
- /* If we pushed args in forward order, perform stack alignment
- after pushing the last arg. */
- if (argblock == 0)
- anti_adjust_stack (GEN_INT (args_size.constant
- - original_args_size.constant));
-#endif
-#endif
-
-#ifdef PUSH_ARGS_REVERSED
- argnum = nargs - 1;
-#else
- argnum = 0;
-#endif
-
- fun = prepare_call_address (fun, NULL_TREE, &call_fusage, 0);
-
- /* Now load any reg parms into their regs. */
-
- for (count = 0; count < nargs; count++, argnum += inc)
- {
- register enum machine_mode mode = argvec[argnum].mode;
- register rtx val = argvec[argnum].value;
- rtx reg = argvec[argnum].reg;
- int partial = argvec[argnum].partial;
-
- if (reg != 0 && partial == 0)
- emit_move_insn (reg, val);
- NO_DEFER_POP;
- }
-
-#if 0
- /* For version 1.37, try deleting this entirely. */
- if (! no_queue)
- emit_queue ();
-#endif
-
- /* Any regs containing parms remain in use through the call. */
- for (count = 0; count < nargs; count++)
- if (argvec[count].reg != 0)
- use_reg (&call_fusage, argvec[count].reg);
-
- /* Pass the function the address in which to return a structure value. */
- if (mem_value != 0 && struct_value_rtx != 0 && ! pcc_struct_value)
- {
- emit_move_insn (struct_value_rtx,
- force_reg (Pmode,
- force_operand (XEXP (mem_value, 0),
- NULL_RTX)));
- if (GET_CODE (struct_value_rtx) == REG)
- use_reg (&call_fusage, struct_value_rtx);
- }
-
- /* Don't allow popping to be deferred, since then
- cse'ing of library calls could delete a call and leave the pop. */
- NO_DEFER_POP;
-
- /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which
- will set inhibit_defer_pop to that value. */
- /* See the comment in emit_library_call about the function type we build
- and pass here. */
-
- emit_call_1 (fun,
- get_identifier (XSTR (orgfun, 0)),
- build_function_type (type_for_mode (outmode, 0), NULL_TREE),
- args_size.constant, struct_value_size,
- FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
- mem_value == 0 ? hard_libcall_value (outmode) : NULL_RTX,
- old_inhibit_defer_pop + 1, call_fusage, is_const);
-
- /* Now restore inhibit_defer_pop to its actual original value. */
- OK_DEFER_POP;
-
- pop_temp_slots ();
-
- /* Copy the value to the right place. */
- if (outmode != VOIDmode)
- {
- if (mem_value)
- {
- if (value == 0)
- value = mem_value;
- if (value != mem_value)
- emit_move_insn (value, mem_value);
- }
- else if (value != 0)
- emit_move_insn (value, hard_libcall_value (outmode));
- else
- value = hard_libcall_value (outmode);
- }
-
- return value;
-}
-
-#if 0
-/* Return an rtx which represents a suitable home on the stack
- given TYPE, the type of the argument looking for a home.
- This is called only for BLKmode arguments.
-
- SIZE is the size needed for this target.
- ARGS_ADDR is the address of the bottom of the argument block for this call.
- OFFSET describes this parameter's offset into ARGS_ADDR. It is meaningless
- if this machine uses push insns. */
-
-static rtx
-target_for_arg (type, size, args_addr, offset)
- tree type;
- rtx size;
- rtx args_addr;
- struct args_size offset;
-{
- rtx target;
- rtx offset_rtx = ARGS_SIZE_RTX (offset);
-
- /* We do not call memory_address if possible,
- because we want to address as close to the stack
- as possible. For non-variable sized arguments,
- this will be stack-pointer relative addressing. */
- if (GET_CODE (offset_rtx) == CONST_INT)
- target = plus_constant (args_addr, INTVAL (offset_rtx));
- else
- {
- /* I have no idea how to guarantee that this
- will work in the presence of register parameters. */
- target = gen_rtx (PLUS, Pmode, args_addr, offset_rtx);
- target = memory_address (QImode, target);
- }
-
- return gen_rtx (MEM, BLKmode, target);
-}
-#endif
-
-/* Store a single argument for a function call
- into the register or memory area where it must be passed.
- *ARG describes the argument value and where to pass it.
-
- ARGBLOCK is the address of the stack-block for all the arguments,
- or 0 on a machine where arguments are pushed individually.
-
- MAY_BE_ALLOCA nonzero says this could be a call to `alloca'
- so must be careful about how the stack is used.
-
- VARIABLE_SIZE nonzero says that this was a variable-sized outgoing
- argument stack. This is used if ACCUMULATE_OUTGOING_ARGS to indicate
- that we need not worry about saving and restoring the stack.
-
- FNDECL is the declaration of the function we are calling. */
-
-static void
-store_one_arg (arg, argblock, may_be_alloca, variable_size, fndecl,
- reg_parm_stack_space)
- struct arg_data *arg;
- rtx argblock;
- int may_be_alloca;
- int variable_size;
- tree fndecl;
- int reg_parm_stack_space;
-{
- register tree pval = arg->tree_value;
- rtx reg = 0;
- int partial = 0;
- int used = 0;
- int i, lower_bound, upper_bound;
-
- if (TREE_CODE (pval) == ERROR_MARK)
- return;
-
- /* Push a new temporary level for any temporaries we make for
- this argument. */
- push_temp_slots ();
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* If this is being stored into a pre-allocated, fixed-size, stack area,
- save any previous data at that location. */
- if (argblock && ! variable_size && arg->stack)
- {
-#ifdef ARGS_GROW_DOWNWARD
- /* stack_slot is negative, but we want to index stack_usage_map
- with positive values. */
- if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
- upper_bound = -INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)) + 1;
- else
- abort ();
-
- lower_bound = upper_bound - arg->size.constant;
-#else
- if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
- lower_bound = INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1));
- else
- lower_bound = 0;
-
- upper_bound = lower_bound + arg->size.constant;
-#endif
-
- for (i = lower_bound; i < upper_bound; i++)
- if (stack_usage_map[i]
-#ifdef REG_PARM_STACK_SPACE
- /* Don't store things in the fixed argument area at this point;
- it has already been saved. */
- && i > reg_parm_stack_space
-#endif
- )
- break;
-
- if (i != upper_bound)
- {
- /* We need to make a save area. See what mode we can make it. */
- enum machine_mode save_mode
- = mode_for_size (arg->size.constant * BITS_PER_UNIT, MODE_INT, 1);
- rtx stack_area
- = gen_rtx (MEM, save_mode,
- memory_address (save_mode, XEXP (arg->stack_slot, 0)));
-
- if (save_mode == BLKmode)
- {
- arg->save_area = assign_stack_temp (BLKmode,
- arg->size.constant, 0);
- MEM_IN_STRUCT_P (arg->save_area)
- = AGGREGATE_TYPE_P (TREE_TYPE (arg->tree_value));
- preserve_temp_slots (arg->save_area);
- emit_block_move (validize_mem (arg->save_area), stack_area,
- GEN_INT (arg->size.constant),
- PARM_BOUNDARY / BITS_PER_UNIT);
- }
- else
- {
- arg->save_area = gen_reg_rtx (save_mode);
- emit_move_insn (arg->save_area, stack_area);
- }
- }
- }
-#endif
-
- /* If this isn't going to be placed on both the stack and in registers,
- set up the register and number of words. */
- if (! arg->pass_on_stack)
- reg = arg->reg, partial = arg->partial;
-
- if (reg != 0 && partial == 0)
- /* Being passed entirely in a register. We shouldn't be called in
- this case. */
- abort ();
-
- /* If this arg needs special alignment, don't load the registers
- here. */
- if (arg->n_aligned_regs != 0)
- reg = 0;
-
- /* If this is being passed partially in a register, we can't evaluate
- it directly into its stack slot. Otherwise, we can. */
- if (arg->value == 0)
- {
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* stack_arg_under_construction is nonzero if a function argument is
- being evaluated directly into the outgoing argument list and
- expand_call must take special action to preserve the argument list
- if it is called recursively.
-
- For scalar function arguments stack_usage_map is sufficient to
- determine which stack slots must be saved and restored. Scalar
- arguments in general have pass_on_stack == 0.
-
- If this argument is initialized by a function which takes the
- address of the argument (a C++ constructor or a C function
- returning a BLKmode structure), then stack_usage_map is
- insufficient and expand_call must push the stack around the
- function call. Such arguments have pass_on_stack == 1.
-
- Note that it is always safe to set stack_arg_under_construction,
- but this generates suboptimal code if set when not needed. */
-
- if (arg->pass_on_stack)
- stack_arg_under_construction++;
-#endif
- arg->value = expand_expr (pval,
- (partial
- || TYPE_MODE (TREE_TYPE (pval)) != arg->mode)
- ? NULL_RTX : arg->stack,
- VOIDmode, 0);
-
- /* If we are promoting object (or for any other reason) the mode
- doesn't agree, convert the mode. */
-
- if (arg->mode != TYPE_MODE (TREE_TYPE (pval)))
- arg->value = convert_modes (arg->mode, TYPE_MODE (TREE_TYPE (pval)),
- arg->value, arg->unsignedp);
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- if (arg->pass_on_stack)
- stack_arg_under_construction--;
-#endif
- }
-
- /* Don't allow anything left on stack from computation
- of argument to alloca. */
- if (may_be_alloca)
- do_pending_stack_adjust ();
-
- if (arg->value == arg->stack)
- /* If the value is already in the stack slot, we are done. */
- ;
- else if (arg->mode != BLKmode)
- {
- register int size;
-
- /* Argument is a scalar, not entirely passed in registers.
- (If part is passed in registers, arg->partial says how much
- and emit_push_insn will take care of putting it there.)
-
- Push it, and if its size is less than the
- amount of space allocated to it,
- also bump stack pointer by the additional space.
- Note that in C the default argument promotions
- will prevent such mismatches. */
-
- size = GET_MODE_SIZE (arg->mode);
- /* Compute how much space the push instruction will push.
- On many machines, pushing a byte will advance the stack
- pointer by a halfword. */
-#ifdef PUSH_ROUNDING
- size = PUSH_ROUNDING (size);
-#endif
- used = size;
-
- /* Compute how much space the argument should get:
- round up to a multiple of the alignment for arguments. */
- if (none != FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval)))
- used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
- / (PARM_BOUNDARY / BITS_PER_UNIT))
- * (PARM_BOUNDARY / BITS_PER_UNIT));
-
- /* This isn't already where we want it on the stack, so put it there.
- This can either be done with push or copy insns. */
- emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), NULL_RTX,
- 0, partial, reg, used - size,
- argblock, ARGS_SIZE_RTX (arg->offset));
- }
- else
- {
- /* BLKmode, at least partly to be pushed. */
-
- register int excess;
- rtx size_rtx;
-
- /* Pushing a nonscalar.
- If part is passed in registers, PARTIAL says how much
- and emit_push_insn will take care of putting it there. */
-
- /* Round its size up to a multiple
- of the allocation unit for arguments. */
-
- if (arg->size.var != 0)
- {
- excess = 0;
- size_rtx = ARGS_SIZE_RTX (arg->size);
- }
- else
- {
- /* PUSH_ROUNDING has no effect on us, because
- emit_push_insn for BLKmode is careful to avoid it. */
- excess = (arg->size.constant - int_size_in_bytes (TREE_TYPE (pval))
- + partial * UNITS_PER_WORD);
- size_rtx = expr_size (pval);
- }
-
- emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx,
- TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT, partial,
- reg, excess, argblock, ARGS_SIZE_RTX (arg->offset));
- }
-
-
- /* Unless this is a partially-in-register argument, the argument is now
- in the stack.
-
- ??? Note that this can change arg->value from arg->stack to
- arg->stack_slot and it matters when they are not the same.
- It isn't totally clear that this is correct in all cases. */
- if (partial == 0)
- arg->value = arg->stack_slot;
-
- /* Once we have pushed something, pops can't safely
- be deferred during the rest of the arguments. */
- NO_DEFER_POP;
-
- /* ANSI doesn't require a sequence point here,
- but PCC has one, so this will avoid some problems. */
- emit_queue ();
-
- /* Free any temporary slots made in processing this argument. Show
- that we might have taken the address of something and pushed that
- as an operand. */
- preserve_temp_slots (NULL_RTX);
- free_temp_slots ();
- pop_temp_slots ();
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
- /* Now mark the segment we just used. */
- if (argblock && ! variable_size && arg->stack)
- for (i = lower_bound; i < upper_bound; i++)
- stack_usage_map[i] = 1;
-#endif
-}
diff --git a/gcc/cccp.c b/gcc/cccp.c
deleted file mode 100644
index cd02b59bcad..00000000000
--- a/gcc/cccp.c
+++ /dev/null
@@ -1,10338 +0,0 @@
-/* C Compatible Compiler Preprocessor (CCCP)
- Copyright (C) 1986, 87, 89, 92-96, 1997 Free Software Foundation, Inc.
- Written by Paul Rubin, June 1986
- Adapted to ANSI C, Richard Stallman, Jan 1987
-
-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, 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.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-typedef unsigned char U_CHAR;
-
-#ifdef EMACS
-#define NO_SHORTNAMES
-#include "../src/config.h"
-#ifdef open
-#undef open
-#undef read
-#undef write
-#endif /* open */
-#endif /* EMACS */
-
-/* The macro EMACS is defined when cpp is distributed as part of Emacs,
- for the sake of machines with limited C compilers. */
-#ifndef EMACS
-#include "config.h"
-#endif /* not EMACS */
-
-#ifndef STANDARD_INCLUDE_DIR
-#define STANDARD_INCLUDE_DIR "/usr/include"
-#endif
-
-#include "pcp.h"
-
-/* By default, colon separates directories in a path. */
-#ifndef PATH_SEPARATOR
-#define PATH_SEPARATOR ':'
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <signal.h>
-
-/* The following symbols should be autoconfigured:
- HAVE_FCNTL_H
- HAVE_STDLIB_H
- HAVE_SYS_TIME_H
- HAVE_UNISTD_H
- STDC_HEADERS
- TIME_WITH_SYS_TIME
- In the mean time, we'll get by with approximations based
- on existing GCC configuration symbols. */
-
-#ifdef POSIX
-# ifndef HAVE_STDLIB_H
-# define HAVE_STDLIB_H 1
-# endif
-# ifndef HAVE_UNISTD_H
-# define HAVE_UNISTD_H 1
-# endif
-# ifndef STDC_HEADERS
-# define STDC_HEADERS 1
-# endif
-#endif /* defined (POSIX) */
-
-#if defined (POSIX) || (defined (USG) && !defined (VMS))
-# ifndef HAVE_FCNTL_H
-# define HAVE_FCNTL_H 1
-# endif
-#endif
-
-#ifndef RLIMIT_STACK
-# include <time.h>
-#else
-# if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-# else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-# endif
-# include <sys/resource.h>
-#endif
-
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#include <errno.h>
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#else
-char *getenv ();
-#endif
-
-#if STDC_HEADERS
-# include <string.h>
-# ifndef bcmp
-# define bcmp(a, b, n) memcmp (a, b, n)
-# endif
-# ifndef bcopy
-# define bcopy(s, d, n) memcpy (d, s, n)
-# endif
-# ifndef bzero
-# define bzero(d, n) memset (d, 0, n)
-# endif
-#else /* !STDC_HEADERS */
-char *index ();
-char *rindex ();
-
-# if !defined (BSTRING) && (defined (USG) || defined (VMS))
-
-# ifndef bcmp
-# define bcmp my_bcmp
-static int
-my_bcmp (a, b, n)
- register char *a;
- register char *b;
- register unsigned n;
-{
- while (n-- > 0)
- if (*a++ != *b++)
- return 1;
-
- return 0;
-}
-# endif /* !defined (bcmp) */
-
-# ifndef bcopy
-# define bcopy my_bcopy
-static void
-my_bcopy (s, d, n)
- register char *s;
- register char *d;
- register unsigned n;
-{
- while (n-- > 0)
- *d++ = *s++;
-}
-# endif /* !defined (bcopy) */
-
-# ifndef bzero
-# define bzero my_bzero
-static void
-my_bzero (b, length)
- register char *b;
- register unsigned length;
-{
- while (length-- > 0)
- *b++ = 0;
-}
-# endif /* !defined (bzero) */
-
-# endif /* !defined (BSTRING) && (defined (USG) || defined (VMS)) */
-#endif /* ! STDC_HEADERS */
-
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __attribute__(x)
-#endif
-
-#ifndef PROTO
-# if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-# define PROTO(ARGS) ARGS
-# else
-# define PROTO(ARGS) ()
-# endif
-#endif
-
-#if defined (__STDC__) && defined (HAVE_VPRINTF)
-# include <stdarg.h>
-# define VA_START(va_list, var) va_start (va_list, var)
-# define PRINTF_ALIST(msg) char *msg, ...
-# define PRINTF_DCL(msg)
-# define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
-#else
-# include <varargs.h>
-# define VA_START(va_list, var) va_start (va_list)
-# define PRINTF_ALIST(msg) msg, va_alist
-# define PRINTF_DCL(msg) char *msg; va_dcl
-# define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
-# define vfprintf(file, msg, args) \
- { \
- char *a0 = va_arg(args, char *); \
- char *a1 = va_arg(args, char *); \
- char *a2 = va_arg(args, char *); \
- char *a3 = va_arg(args, char *); \
- fprintf (file, msg, a0, a1, a2, a3); \
- }
-#endif
-
-#define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
-#define PRINTF_PROTO_2(ARGS) PRINTF_PROTO(ARGS, 2, 3)
-#define PRINTF_PROTO_3(ARGS) PRINTF_PROTO(ARGS, 3, 4)
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-/* VMS-specific definitions */
-#ifdef VMS
-#include <descrip.h>
-#define read(fd,buf,size) VMS_read (fd,buf,size)
-#define write(fd,buf,size) VMS_write (fd,buf,size)
-#define open(fname,mode,prot) VMS_open (fname,mode,prot)
-#define fopen(fname,mode) VMS_fopen (fname,mode)
-#define freopen(fname,mode,ofile) VMS_freopen (fname,mode,ofile)
-#define fstat(fd,stbuf) VMS_fstat (fd,stbuf)
-static int VMS_fstat (), VMS_stat ();
-static int VMS_read ();
-static int VMS_write ();
-static int VMS_open ();
-static FILE * VMS_fopen ();
-static FILE * VMS_freopen ();
-static void hack_vms_include_specification ();
-#define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a)))
-#define INO_T_HASH(a) 0
-#define INCLUDE_LEN_FUDGE 12 /* leave room for VMS syntax conversion */
-#endif /* VMS */
-
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-
-#undef MIN
-#undef MAX
-#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
-#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
-
-/* Find the largest host integer type and set its size and type.
- Don't blindly use `long'; on some crazy hosts it is shorter than `int'. */
-
-#ifndef HOST_BITS_PER_WIDE_INT
-
-#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
-#define HOST_WIDE_INT long
-#else
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
-#define HOST_WIDE_INT int
-#endif
-
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-
-#ifndef INO_T_EQ
-#define INO_T_EQ(a, b) ((a) == (b))
-#endif
-
-#ifndef INO_T_HASH
-#define INO_T_HASH(a) (a)
-#endif
-
-/* Define a generic NULL if one hasn't already been defined. */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef GENERIC_PTR
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#define GENERIC_PTR void *
-#else
-#define GENERIC_PTR char *
-#endif
-#endif
-
-#ifndef NULL_PTR
-#define NULL_PTR ((GENERIC_PTR) 0)
-#endif
-
-#ifndef INCLUDE_LEN_FUDGE
-#define INCLUDE_LEN_FUDGE 0
-#endif
-
-/* External declarations. */
-
-extern char *version_string;
-#ifndef VMS
-#ifndef HAVE_STRERROR
-extern int sys_nerr;
-#if defined(bsd4_4)
-extern const char *const sys_errlist[];
-#else
-extern char *sys_errlist[];
-#endif
-#else /* HAVE_STRERROR */
-char *strerror ();
-#endif
-#else /* VMS */
-char *strerror (int,...);
-#endif
-HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
-HOST_WIDE_INT parse_c_expression PROTO((char *));
-
-#ifndef errno
-extern int errno;
-#endif
-
-/* Name under which this program was invoked. */
-
-static char *progname;
-
-/* Nonzero means use extra default include directories for C++. */
-
-static int cplusplus;
-
-/* Nonzero means handle cplusplus style comments */
-
-static int cplusplus_comments;
-
-/* Nonzero means handle #import, for objective C. */
-
-static int objc;
-
-/* Nonzero means this is an assembly file, and allow
- unknown directives, which could be comments. */
-
-static int lang_asm;
-
-/* Current maximum length of directory names in the search path
- for include files. (Altered as we get more of them.) */
-
-static int max_include_len;
-
-/* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */
-
-static int for_lint = 0;
-
-/* Nonzero means copy comments into the output file. */
-
-static int put_out_comments = 0;
-
-/* Nonzero means don't process the ANSI trigraph sequences. */
-
-static int no_trigraphs = 0;
-
-/* Nonzero means print the names of included files rather than
- the preprocessed output. 1 means just the #include "...",
- 2 means #include <...> as well. */
-
-static int print_deps = 0;
-
-/* Nonzero if missing .h files in -M output are assumed to be generated
- files and not errors. */
-
-static int print_deps_missing_files = 0;
-
-/* Nonzero means print names of header files (-H). */
-
-static int print_include_names = 0;
-
-/* Nonzero means don't output line number information. */
-
-static int no_line_directives;
-
-/* Nonzero means output the text in failing conditionals,
- inside #failed ... #endfailed. */
-
-static int output_conditionals;
-
-/* dump_only means inhibit output of the preprocessed text
- and instead output the definitions of all user-defined
- macros in a form suitable for use as input to cccp.
- dump_names means pass #define and the macro name through to output.
- dump_definitions means pass the whole definition (plus #define) through
-*/
-
-static enum {dump_none, dump_only, dump_names, dump_definitions}
- dump_macros = dump_none;
-
-/* Nonzero means pass all #define and #undef directives which we actually
- process through to the output stream. This feature is used primarily
- to allow cc1 to record the #defines and #undefs for the sake of
- debuggers which understand about preprocessor macros, but it may
- also be useful with -E to figure out how symbols are defined, and
- where they are defined. */
-static int debug_output = 0;
-
-/* Nonzero indicates special processing used by the pcp program. The
- special effects of this mode are:
-
- Inhibit all macro expansion, except those inside #if directives.
-
- Process #define directives normally, and output their contents
- to the output file.
-
- Output preconditions to pcp_outfile indicating all the relevant
- preconditions for use of this file in a later cpp run.
-*/
-static FILE *pcp_outfile;
-
-/* Nonzero means we are inside an IF during a -pcp run. In this mode
- macro expansion is done, and preconditions are output for all macro
- uses requiring them. */
-static int pcp_inside_if;
-
-/* Nonzero means never to include precompiled files.
- This is 1 since there's no way now to make precompiled files,
- so it's not worth testing for them. */
-static int no_precomp = 1;
-
-/* Nonzero means give all the error messages the ANSI standard requires. */
-
-int pedantic;
-
-/* Nonzero means try to make failure to fit ANSI C an error. */
-
-static int pedantic_errors;
-
-/* Nonzero means don't print warning messages. -w. */
-
-static int inhibit_warnings = 0;
-
-/* Nonzero means warn if slash-star appears in a slash-star comment,
- or if newline-backslash appears in a slash-slash comment. */
-
-static int warn_comments;
-
-/* Nonzero means warn if a macro argument is (or would be)
- stringified with -traditional. */
-
-static int warn_stringify;
-
-/* Nonzero means warn if there are any trigraphs. */
-
-static int warn_trigraphs;
-
-/* Nonzero means warn if #import is used. */
-
-static int warn_import = 1;
-
-/* Nonzero means turn warnings into errors. */
-
-static int warnings_are_errors;
-
-/* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */
-
-int traditional;
-
-/* Nonzero for the 1989 C Standard, including corrigenda and amendments. */
-
-int c89;
-
-/* Nonzero causes output not to be done,
- but directives such as #define that have side effects
- are still obeyed. */
-
-static int no_output;
-
-/* Nonzero means this file was included with a -imacros or -include
- command line and should not be recorded as an include file. */
-
-static int no_record_file;
-
-/* Nonzero means that we have finished processing the command line options.
- This flag is used to decide whether or not to issue certain errors
- and/or warnings. */
-
-static int done_initializing = 0;
-
-/* Line where a newline was first seen in a string constant. */
-
-static int multiline_string_line = 0;
-
-/* I/O buffer structure.
- The `fname' field is nonzero for source files and #include files
- and for the dummy text used for -D and -U.
- It is zero for rescanning results of macro expansion
- and for expanding macro arguments. */
-#define INPUT_STACK_MAX 400
-static struct file_buf {
- char *fname;
- /* Filename specified with #line directive. */
- char *nominal_fname;
- /* Include file description. */
- struct include_file *inc;
- /* Record where in the search path this file was found.
- For #include_next. */
- struct file_name_list *dir;
- int lineno;
- int length;
- U_CHAR *buf;
- U_CHAR *bufp;
- /* Macro that this level is the expansion of.
- Included so that we can reenable the macro
- at the end of this level. */
- struct hashnode *macro;
- /* Value of if_stack at start of this file.
- Used to prohibit unmatched #endif (etc) in an include file. */
- struct if_stack *if_stack;
- /* Object to be freed at end of input at this level. */
- U_CHAR *free_ptr;
- /* True if this is a header file included using <FILENAME>. */
- char system_header_p;
-} instack[INPUT_STACK_MAX];
-
-static int last_error_tick; /* Incremented each time we print it. */
-static int input_file_stack_tick; /* Incremented when the status changes. */
-
-/* Current nesting level of input sources.
- `instack[indepth]' is the level currently being read. */
-static int indepth = -1;
-#define CHECK_DEPTH(code) \
- if (indepth >= (INPUT_STACK_MAX - 1)) \
- { \
- error_with_line (line_for_error (instack[indepth].lineno), \
- "macro or `#include' recursion too deep"); \
- code; \
- }
-
-/* Current depth in #include directives that use <...>. */
-static int system_include_depth = 0;
-
-typedef struct file_buf FILE_BUF;
-
-/* The output buffer. Its LENGTH field is the amount of room allocated
- for the buffer, not the number of chars actually present. To get
- that, subtract outbuf.buf from outbuf.bufp. */
-
-#define OUTBUF_SIZE 10 /* initial size of output buffer */
-static FILE_BUF outbuf;
-
-/* Grow output buffer OBUF points at
- so it can hold at least NEEDED more chars. */
-
-#define check_expand(OBUF, NEEDED) \
- (((OBUF)->length - ((OBUF)->bufp - (OBUF)->buf) <= (NEEDED)) \
- ? grow_outbuf ((OBUF), (NEEDED)) : 0)
-
-struct file_name_list
- {
- struct file_name_list *next;
- /* If the following is 1, it is a C-language system include
- directory. */
- int c_system_include_path;
- /* Mapping of file names for this directory. */
- struct file_name_map *name_map;
- /* Non-zero if name_map is valid. */
- int got_name_map;
- /* The include directory status. */
- struct stat st;
- /* The include prefix: "" denotes the working directory,
- otherwise fname must end in '/'.
- The actual size is dynamically allocated. */
- char fname[1];
- };
-
-/* #include "file" looks in source file dir, then stack. */
-/* #include <file> just looks in the stack. */
-/* -I directories are added to the end, then the defaults are added. */
-/* The */
-static struct default_include {
- char *fname; /* The name of the directory. */
- int cplusplus; /* Only look here if we're compiling C++. */
- int cxx_aware; /* Includes in this directory don't need to
- be wrapped in extern "C" when compiling
- C++. */
-} include_defaults_array[]
-#ifdef INCLUDE_DEFAULTS
- = INCLUDE_DEFAULTS;
-#else
- = {
- /* Pick up GNU C++ specific include files. */
- { GPLUSPLUS_INCLUDE_DIR, 1, 1 },
- { OLD_GPLUSPLUS_INCLUDE_DIR, 1, 1 },
-#ifdef CROSS_COMPILE
- /* This is the dir for fixincludes. Put it just before
- the files that we fix. */
- { GCC_INCLUDE_DIR, 0, 0 },
- /* For cross-compilation, this dir name is generated
- automatically in Makefile.in. */
- { CROSS_INCLUDE_DIR, 0, 0 },
-#ifdef TOOL_INCLUDE_DIR
- /* This is another place that the target system's headers might be. */
- { TOOL_INCLUDE_DIR, 0, 0 },
-#endif
-#else /* not CROSS_COMPILE */
-#ifdef LOCAL_INCLUDE_DIR
- /* This should be /usr/local/include and should come before
- the fixincludes-fixed header files. */
- { LOCAL_INCLUDE_DIR, 0, 1 },
-#endif
-#ifdef TOOL_INCLUDE_DIR
- /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
- Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */
- { TOOL_INCLUDE_DIR, 0, 0 },
-#endif
- /* This is the dir for fixincludes. Put it just before
- the files that we fix. */
- { GCC_INCLUDE_DIR, 0, 0 },
- /* Some systems have an extra dir of include files. */
-#ifdef SYSTEM_INCLUDE_DIR
- { SYSTEM_INCLUDE_DIR, 0, 0 },
-#endif
- { STANDARD_INCLUDE_DIR, 0, 0 },
-#endif /* not CROSS_COMPILE */
- { 0, 0, 0 }
- };
-#endif /* no INCLUDE_DEFAULTS */
-
-/* The code looks at the defaults through this pointer, rather than through
- the constant structure above. This pointer gets changed if an environment
- variable specifies other defaults. */
-static struct default_include *include_defaults = include_defaults_array;
-
-static struct file_name_list *include = 0; /* First dir to search */
- /* First dir to search for <file> */
-/* This is the first element to use for #include <...>.
- If it is 0, use the entire chain for such includes. */
-static struct file_name_list *first_bracket_include = 0;
-/* This is the first element in the chain that corresponds to
- a directory of system header files. */
-static struct file_name_list *first_system_include = 0;
-static struct file_name_list *last_include = 0; /* Last in chain */
-
-/* Chain of include directories to put at the end of the other chain. */
-static struct file_name_list *after_include = 0;
-static struct file_name_list *last_after_include = 0; /* Last in chain */
-
-/* Chain to put at the start of the system include files. */
-static struct file_name_list *before_system = 0;
-static struct file_name_list *last_before_system = 0; /* Last in chain */
-
-/* Directory prefix that should replace `/usr' in the standard
- include file directories. */
-static char *include_prefix;
-
-/* Maintain and search list of included files. */
-
-struct include_file {
- struct include_file *next; /* for include_hashtab */
- struct include_file *next_ino; /* for include_ino_hashtab */
- char *fname;
- /* If the following is the empty string, it means #pragma once
- was seen in this include file, or #import was applied to the file.
- Otherwise, if it is nonzero, it is a macro name.
- Don't include the file again if that macro is defined. */
- U_CHAR *control_macro;
- /* Nonzero if the dependency on this include file has been output. */
- int deps_output;
- struct stat st;
-};
-
-/* Hash tables of files already included with #include or #import.
- include_hashtab is by full name; include_ino_hashtab is by inode number. */
-
-#define INCLUDE_HASHSIZE 61
-static struct include_file *include_hashtab[INCLUDE_HASHSIZE];
-static struct include_file *include_ino_hashtab[INCLUDE_HASHSIZE];
-
-/* Global list of strings read in from precompiled files. This list
- is kept in the order the strings are read in, with new strings being
- added at the end through stringlist_tailp. We use this list to output
- the strings at the end of the run.
-*/
-static STRINGDEF *stringlist;
-static STRINGDEF **stringlist_tailp = &stringlist;
-
-
-/* Structure returned by create_definition */
-typedef struct macrodef MACRODEF;
-struct macrodef
-{
- struct definition *defn;
- U_CHAR *symnam;
- int symlen;
-};
-
-enum sharp_token_type {
- NO_SHARP_TOKEN = 0, /* token not present */
-
- SHARP_TOKEN = '#', /* token spelled with # only */
- WHITE_SHARP_TOKEN, /* token spelled with # and white space */
-
- PERCENT_COLON_TOKEN = '%', /* token spelled with %: only */
- WHITE_PERCENT_COLON_TOKEN /* token spelled with %: and white space */
-};
-
-/* Structure allocated for every #define. For a simple replacement
- such as
- #define foo bar ,
- nargs = -1, the `pattern' list is null, and the expansion is just
- the replacement text. Nargs = 0 means a functionlike macro with no args,
- e.g.,
- #define getchar() getc (stdin) .
- When there are args, the expansion is the replacement text with the
- args squashed out, and the reflist is a list describing how to
- build the output from the input: e.g., "3 chars, then the 1st arg,
- then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg".
- The chars here come from the expansion. Whatever is left of the
- expansion after the last arg-occurrence is copied after that arg.
- Note that the reflist can be arbitrarily long---
- its length depends on the number of times the arguments appear in
- the replacement text, not how many args there are. Example:
- #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and
- pattern list
- { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL }
- where (x, y) means (nchars, argno). */
-
-typedef struct definition DEFINITION;
-struct definition {
- int nargs;
- int length; /* length of expansion string */
- int predefined; /* True if the macro was builtin or */
- /* came from the command line */
- U_CHAR *expansion;
- int line; /* Line number of definition */
- char *file; /* File of definition */
- char rest_args; /* Nonzero if last arg. absorbs the rest */
- struct reflist {
- struct reflist *next;
-
- enum sharp_token_type stringify; /* set if a # operator before arg */
- enum sharp_token_type raw_before; /* set if a ## operator before arg */
- enum sharp_token_type raw_after; /* set if a ## operator after arg */
-
- char rest_args; /* Nonzero if this arg. absorbs the rest */
- int nchars; /* Number of literal chars to copy before
- this arg occurrence. */
- int argno; /* Number of arg to substitute (origin-0) */
- } *pattern;
- union {
- /* Names of macro args, concatenated in reverse order
- with comma-space between them.
- The only use of this is that we warn on redefinition
- if this differs between the old and new definitions. */
- U_CHAR *argnames;
- } args;
-};
-
-/* different kinds of things that can appear in the value field
- of a hash node. Actually, this may be useless now. */
-union hashval {
- char *cpval;
- DEFINITION *defn;
- KEYDEF *keydef;
-};
-
-/*
- * special extension string that can be added to the last macro argument to
- * allow it to absorb the "rest" of the arguments when expanded. Ex:
- * #define wow(a, b...) process (b, a, b)
- * { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); }
- * { wow (one, two); } -> { process (two, one, two); }
- * if this "rest_arg" is used with the concat token '##' and if it is not
- * supplied then the token attached to with ## will not be outputted. Ex:
- * #define wow (a, b...) process (b ## , a, ## b)
- * { wow (1, 2); } -> { process (2, 1, 2); }
- * { wow (one); } -> { process (one); {
- */
-static char rest_extension[] = "...";
-#define REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1)
-
-/* The structure of a node in the hash table. The hash table
- has entries for all tokens defined by #define directives (type T_MACRO),
- plus some special tokens like __LINE__ (these each have their own
- type, and the appropriate code is run when that type of node is seen.
- It does not contain control words like "#define", which are recognized
- by a separate piece of code. */
-
-/* different flavors of hash nodes --- also used in keyword table */
-enum node_type {
- T_DEFINE = 1, /* the `#define' keyword */
- T_INCLUDE, /* the `#include' keyword */
- T_INCLUDE_NEXT, /* the `#include_next' keyword */
- T_IMPORT, /* the `#import' keyword */
- T_IFDEF, /* the `#ifdef' keyword */
- T_IFNDEF, /* the `#ifndef' keyword */
- T_IF, /* the `#if' keyword */
- T_ELSE, /* `#else' */
- T_PRAGMA, /* `#pragma' */
- T_ELIF, /* `#elif' */
- T_UNDEF, /* `#undef' */
- T_LINE, /* `#line' */
- T_ERROR, /* `#error' */
- T_WARNING, /* `#warning' */
- T_ENDIF, /* `#endif' */
- T_SCCS, /* `#sccs', used on system V. */
- T_IDENT, /* `#ident', used on system V. */
- T_ASSERT, /* `#assert', taken from system V. */
- T_UNASSERT, /* `#unassert', taken from system V. */
- T_SPECLINE, /* special symbol `__LINE__' */
- T_DATE, /* `__DATE__' */
- T_FILE, /* `__FILE__' */
- T_BASE_FILE, /* `__BASE_FILE__' */
- T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
- T_VERSION, /* `__VERSION__' */
- T_SIZE_TYPE, /* `__SIZE_TYPE__' */
- T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */
- T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */
- T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */
- T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */
- T_IMMEDIATE_PREFIX_TYPE, /* `__IMMEDIATE_PREFIX__' */
- T_TIME, /* `__TIME__' */
- T_CONST, /* Constant value, used by `__STDC__' */
- T_MACRO, /* macro defined by `#define' */
- T_DISABLED, /* macro temporarily turned off for rescan */
- T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */
- T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
- T_UNUSED /* Used for something not defined. */
- };
-
-struct hashnode {
- struct hashnode *next; /* double links for easy deletion */
- struct hashnode *prev;
- struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash
- chain is kept, in case the node is the head
- of the chain and gets deleted. */
- enum node_type type; /* type of special token */
- int length; /* length of token, for quick comparison */
- U_CHAR *name; /* the actual name */
- union hashval value; /* pointer to expansion, or whatever */
-};
-
-typedef struct hashnode HASHNODE;
-
-/* Some definitions for the hash table. The hash function MUST be
- computed as shown in hashf () below. That is because the rescan
- loop computes the hash value `on the fly' for most tokens,
- in order to avoid the overhead of a lot of procedure calls to
- the hashf () function. Hashf () only exists for the sake of
- politeness, for use when speed isn't so important. */
-
-#define HASHSIZE 1403
-static HASHNODE *hashtab[HASHSIZE];
-#define HASHSTEP(old, c) ((old << 2) + c)
-#define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
-
-/* Symbols to predefine. */
-
-#ifdef CPP_PREDEFINES
-static char *predefs = CPP_PREDEFINES;
-#else
-static char *predefs = "";
-#endif
-
-/* We let tm.h override the types used here, to handle trivial differences
- such as the choice of unsigned int or long unsigned int for size_t.
- When machines start needing nontrivial differences in the size type,
- it would be best to do something here to figure out automatically
- from other information what type to use. */
-
-/* The string value for __SIZE_TYPE__. */
-
-#ifndef SIZE_TYPE
-#define SIZE_TYPE "long unsigned int"
-#endif
-
-/* The string value for __PTRDIFF_TYPE__. */
-
-#ifndef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-#endif
-
-/* The string value for __WCHAR_TYPE__. */
-
-#ifndef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-#endif
-char * wchar_type = WCHAR_TYPE;
-#undef WCHAR_TYPE
-
-/* The string value for __USER_LABEL_PREFIX__ */
-
-#ifndef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-#endif
-
-/* The string value for __REGISTER_PREFIX__ */
-
-#ifndef REGISTER_PREFIX
-#define REGISTER_PREFIX ""
-#endif
-
-/* The string value for __IMMEDIATE_PREFIX__ */
-
-#ifndef IMMEDIATE_PREFIX
-#define IMMEDIATE_PREFIX ""
-#endif
-
-/* In the definition of a #assert name, this structure forms
- a list of the individual values asserted.
- Each value is itself a list of "tokens".
- These are strings that are compared by name. */
-
-struct tokenlist_list {
- struct tokenlist_list *next;
- struct arglist *tokens;
-};
-
-struct assertion_hashnode {
- struct assertion_hashnode *next; /* double links for easy deletion */
- struct assertion_hashnode *prev;
- /* also, a back pointer to this node's hash
- chain is kept, in case the node is the head
- of the chain and gets deleted. */
- struct assertion_hashnode **bucket_hdr;
- int length; /* length of token, for quick comparison */
- U_CHAR *name; /* the actual name */
- /* List of token-sequences. */
- struct tokenlist_list *value;
-};
-
-typedef struct assertion_hashnode ASSERTION_HASHNODE;
-
-/* Some definitions for the hash table. The hash function MUST be
- computed as shown in hashf below. That is because the rescan
- loop computes the hash value `on the fly' for most tokens,
- in order to avoid the overhead of a lot of procedure calls to
- the hashf function. hashf only exists for the sake of
- politeness, for use when speed isn't so important. */
-
-#define ASSERTION_HASHSIZE 37
-static ASSERTION_HASHNODE *assertion_hashtab[ASSERTION_HASHSIZE];
-
-/* Nonzero means inhibit macroexpansion of what seem to be
- assertion tests, in rescan. For #if. */
-static int assertions_flag;
-
-/* `struct directive' defines one #-directive, including how to handle it. */
-
-#define DO_PROTO PROTO((U_CHAR *, U_CHAR *, FILE_BUF *, struct directive *))
-
-struct directive {
- int length; /* Length of name */
- int (*func) DO_PROTO; /* Function to handle directive */
- char *name; /* Name of directive */
- enum node_type type; /* Code which describes which directive. */
- char angle_brackets; /* Nonzero => <...> is special. */
- char traditional_comments; /* Nonzero: keep comments if -traditional. */
- char pass_thru; /* Copy directive to output:
- if 1, copy if dumping definitions;
- if 2, always copy, after preprocessing. */
-};
-
-/* These functions are declared to return int instead of void since they
- are going to be placed in the table and some old compilers have trouble with
- pointers to functions returning void. */
-
-static int do_assert DO_PROTO;
-static int do_define DO_PROTO;
-static int do_elif DO_PROTO;
-static int do_else DO_PROTO;
-static int do_endif DO_PROTO;
-static int do_error DO_PROTO;
-static int do_ident DO_PROTO;
-static int do_if DO_PROTO;
-static int do_include DO_PROTO;
-static int do_line DO_PROTO;
-static int do_pragma DO_PROTO;
-#ifdef SCCS_DIRECTIVE
-static int do_sccs DO_PROTO;
-#endif
-static int do_unassert DO_PROTO;
-static int do_undef DO_PROTO;
-static int do_warning DO_PROTO;
-static int do_xifdef DO_PROTO;
-
-/* Here is the actual list of #-directives, most-often-used first. */
-
-static struct directive directive_table[] = {
- { 6, do_define, "define", T_DEFINE, 0, 1, 1},
- { 2, do_if, "if", T_IF},
- { 5, do_xifdef, "ifdef", T_IFDEF},
- { 6, do_xifdef, "ifndef", T_IFNDEF},
- { 5, do_endif, "endif", T_ENDIF},
- { 4, do_else, "else", T_ELSE},
- { 4, do_elif, "elif", T_ELIF},
- { 4, do_line, "line", T_LINE},
- { 7, do_include, "include", T_INCLUDE, 1},
- { 12, do_include, "include_next", T_INCLUDE_NEXT, 1},
- { 6, do_include, "import", T_IMPORT, 1},
- { 5, do_undef, "undef", T_UNDEF},
- { 5, do_error, "error", T_ERROR},
- { 7, do_warning, "warning", T_WARNING},
-#ifdef SCCS_DIRECTIVE
- { 4, do_sccs, "sccs", T_SCCS},
-#endif
- { 6, do_pragma, "pragma", T_PRAGMA, 0, 0, 2},
- { 5, do_ident, "ident", T_IDENT},
- { 6, do_assert, "assert", T_ASSERT},
- { 8, do_unassert, "unassert", T_UNASSERT},
- { -1, 0, "", T_UNUSED},
-};
-
-/* When a directive handler is called,
- this points to the # (or the : of the %:) that started the directive. */
-U_CHAR *directive_start;
-
-/* table to tell if char can be part of a C identifier. */
-U_CHAR is_idchar[256];
-/* table to tell if char can be first char of a c identifier. */
-U_CHAR is_idstart[256];
-/* table to tell if c is horizontal space. */
-static U_CHAR is_hor_space[256];
-/* table to tell if c is horizontal or vertical space. */
-U_CHAR is_space[256];
-/* names of some characters */
-static char *char_name[256];
-
-#define SKIP_WHITE_SPACE(p) do { while (is_hor_space[*p]) p++; } while (0)
-#define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[*p]) p++; } while (0)
-
-static int errors = 0; /* Error counter for exit code */
-
-/* Name of output file, for error messages. */
-static char *out_fname;
-
-
-/* Stack of conditionals currently in progress
- (including both successful and failing conditionals). */
-
-struct if_stack {
- struct if_stack *next; /* for chaining to the next stack frame */
- char *fname; /* copied from input when frame is made */
- int lineno; /* similarly */
- int if_succeeded; /* true if a leg of this if-group
- has been passed through rescan */
- U_CHAR *control_macro; /* For #ifndef at start of file,
- this is the macro name tested. */
- enum node_type type; /* type of last directive seen in this group */
-};
-typedef struct if_stack IF_STACK_FRAME;
-static IF_STACK_FRAME *if_stack = NULL;
-
-/* Buffer of -M output. */
-static char *deps_buffer;
-
-/* Number of bytes allocated in above. */
-static int deps_allocated_size;
-
-/* Number of bytes used. */
-static int deps_size;
-
-/* Number of bytes since the last newline. */
-static int deps_column;
-
-/* Nonzero means -I- has been seen,
- so don't look for #include "foo" the source-file directory. */
-static int ignore_srcdir;
-
-static int safe_read PROTO((int, char *, int));
-static void safe_write PROTO((int, char *, int));
-
-int main PROTO((int, char **));
-
-static void path_include PROTO((char *));
-
-static U_CHAR *index0 PROTO((U_CHAR *, int, size_t));
-
-static void trigraph_pcp PROTO((FILE_BUF *));
-
-static void newline_fix PROTO((U_CHAR *));
-static void name_newline_fix PROTO((U_CHAR *));
-
-static char *get_lintcmd PROTO((U_CHAR *, U_CHAR *, U_CHAR **, int *, int *));
-
-static void rescan PROTO((FILE_BUF *, int));
-
-static FILE_BUF expand_to_temp_buffer PROTO((U_CHAR *, U_CHAR *, int, int));
-
-static int handle_directive PROTO((FILE_BUF *, FILE_BUF *));
-
-static struct tm *timestamp PROTO((void));
-static void special_symbol PROTO((HASHNODE *, FILE_BUF *));
-
-static int is_system_include PROTO((char *));
-static char *base_name PROTO((char *));
-static int absolute_filename PROTO((char *));
-static size_t simplify_filename PROTO((char *));
-
-static char *read_filename_string PROTO((int, FILE *));
-static struct file_name_map *read_name_map PROTO((char *));
-static int open_include_file PROTO((char *, struct file_name_list *, U_CHAR *, struct include_file **));
-static char *remap_include_file PROTO((char *, struct file_name_list *));
-static int lookup_ino_include PROTO((struct include_file *));
-
-static void finclude PROTO((int, struct include_file *, FILE_BUF *, int, struct file_name_list *));
-static void record_control_macro PROTO((struct include_file *, U_CHAR *));
-
-static char *check_precompiled PROTO((int, struct stat *, char *, char **));
-static int check_preconditions PROTO((char *));
-static void pcfinclude PROTO((U_CHAR *, U_CHAR *, U_CHAR *, FILE_BUF *));
-static void pcstring_used PROTO((HASHNODE *));
-static void write_output PROTO((void));
-static void pass_thru_directive PROTO((U_CHAR *, U_CHAR *, FILE_BUF *, struct directive *));
-
-static MACRODEF create_definition PROTO((U_CHAR *, U_CHAR *, FILE_BUF *));
-
-static int check_macro_name PROTO((U_CHAR *, char *));
-static int compare_defs PROTO((DEFINITION *, DEFINITION *));
-static int comp_def_part PROTO((int, U_CHAR *, int, U_CHAR *, int, int));
-
-static DEFINITION *collect_expansion PROTO((U_CHAR *, U_CHAR *, int, struct arglist *));
-
-int check_assertion PROTO((U_CHAR *, int, int, struct arglist *));
-static int compare_token_lists PROTO((struct arglist *, struct arglist *));
-
-static struct arglist *read_token_list PROTO((U_CHAR **, U_CHAR *, int *));
-static void free_token_list PROTO((struct arglist *));
-
-static ASSERTION_HASHNODE *assertion_install PROTO((U_CHAR *, int, int));
-static ASSERTION_HASHNODE *assertion_lookup PROTO((U_CHAR *, int, int));
-static void delete_assertion PROTO((ASSERTION_HASHNODE *));
-
-static void do_once PROTO((void));
-
-static HOST_WIDE_INT eval_if_expression PROTO((U_CHAR *, int));
-static void conditional_skip PROTO((FILE_BUF *, int, enum node_type, U_CHAR *, FILE_BUF *));
-static void skip_if_group PROTO((FILE_BUF *, int, FILE_BUF *));
-static void validate_else PROTO((U_CHAR *, U_CHAR *));
-
-static U_CHAR *skip_to_end_of_comment PROTO((FILE_BUF *, int *, int));
-static U_CHAR *skip_quoted_string PROTO((U_CHAR *, U_CHAR *, int, int *, int *, int *));
-static char *quote_string PROTO((char *, char *));
-static U_CHAR *skip_paren_group PROTO((FILE_BUF *));
-
-/* Last arg to output_line_directive. */
-enum file_change_code {same_file, enter_file, leave_file};
-static void output_line_directive PROTO((FILE_BUF *, FILE_BUF *, int, enum file_change_code));
-
-static void macroexpand PROTO((HASHNODE *, FILE_BUF *));
-
-struct argdata;
-static char *macarg PROTO((struct argdata *, int));
-
-static U_CHAR *macarg1 PROTO((U_CHAR *, U_CHAR *, int *, int *, int *, int));
-
-static int discard_comments PROTO((U_CHAR *, int, int));
-
-static int change_newlines PROTO((U_CHAR *, int));
-
-char *my_strerror PROTO((int));
-void error PRINTF_PROTO_1((char *, ...));
-static void verror PROTO((char *, va_list));
-static void error_from_errno PROTO((char *));
-void warning PRINTF_PROTO_1((char *, ...));
-static void vwarning PROTO((char *, va_list));
-static void error_with_line PRINTF_PROTO_2((int, char *, ...));
-static void verror_with_line PROTO((int, char *, va_list));
-static void vwarning_with_line PROTO((int, char *, va_list));
-static void warning_with_line PRINTF_PROTO_2((int, char *, ...));
-void pedwarn PRINTF_PROTO_1((char *, ...));
-void pedwarn_with_line PRINTF_PROTO_2((int, char *, ...));
-static void pedwarn_with_file_and_line PRINTF_PROTO_3((char *, int, char *, ...));
-
-static void print_containing_files PROTO((void));
-
-static int line_for_error PROTO((int));
-static int grow_outbuf PROTO((FILE_BUF *, int));
-
-static HASHNODE *install PROTO((U_CHAR *, int, enum node_type, char *, int));
-HASHNODE *lookup PROTO((U_CHAR *, int, int));
-static void delete_macro PROTO((HASHNODE *));
-static int hashf PROTO((U_CHAR *, int, int));
-
-static void dump_single_macro PROTO((HASHNODE *, FILE *));
-static void dump_all_macros PROTO((void));
-static void dump_defn_1 PROTO((U_CHAR *, int, int, FILE *));
-static void dump_arg_n PROTO((DEFINITION *, int, FILE *));
-
-static void initialize_char_syntax PROTO((void));
-static void initialize_builtins PROTO((FILE_BUF *, FILE_BUF *));
-
-static void make_definition PROTO((char *, FILE_BUF *));
-static void make_undef PROTO((char *, FILE_BUF *));
-
-static void make_assertion PROTO((char *, char *));
-
-static struct file_name_list *new_include_prefix PROTO((struct file_name_list *, char *, char *));
-static void append_include_chain PROTO((struct file_name_list *, struct file_name_list *));
-
-static void deps_output PROTO((char *, int));
-
-static void fatal PRINTF_PROTO_1((char *, ...)) __attribute__ ((noreturn));
-void fancy_abort PROTO((void)) __attribute__ ((noreturn));
-static void perror_with_name PROTO((char *));
-static void pfatal_with_name PROTO((char *)) __attribute__ ((noreturn));
-static void pipe_closed PROTO((int)) __attribute__ ((noreturn));
-
-static void memory_full PROTO((void)) __attribute__ ((noreturn));
-GENERIC_PTR xmalloc PROTO((size_t));
-static GENERIC_PTR xrealloc PROTO((GENERIC_PTR, size_t));
-static GENERIC_PTR xcalloc PROTO((size_t, size_t));
-static char *savestring PROTO((char *));
-
-/* Read LEN bytes at PTR from descriptor DESC, for file FILENAME,
- retrying if necessary. Return a negative value if an error occurs,
- otherwise return the actual number of bytes read,
- which must be LEN unless end-of-file was reached. */
-
-static int
-safe_read (desc, ptr, len)
- int desc;
- char *ptr;
- int len;
-{
- int left = len;
- while (left > 0) {
- int nchars = read (desc, ptr, left);
- if (nchars < 0)
- {
-#ifdef EINTR
- if (errno == EINTR)
- continue;
-#endif
- return nchars;
- }
- if (nchars == 0)
- break;
- ptr += nchars;
- left -= nchars;
- }
- return len - left;
-}
-
-/* Write LEN bytes at PTR to descriptor DESC,
- retrying if necessary, and treating any real error as fatal. */
-
-static void
-safe_write (desc, ptr, len)
- int desc;
- char *ptr;
- int len;
-{
- while (len > 0) {
- int written = write (desc, ptr, len);
- if (written < 0)
- {
-#ifdef EINTR
- if (errno == EINTR)
- continue;
-#endif
- pfatal_with_name (out_fname);
- }
- ptr += written;
- len -= written;
- }
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- struct stat st;
- char *in_fname;
- char *cp;
- int f, i;
- FILE_BUF *fp;
- char **pend_files = (char **) xmalloc (argc * sizeof (char *));
- char **pend_defs = (char **) xmalloc (argc * sizeof (char *));
- char **pend_undefs = (char **) xmalloc (argc * sizeof (char *));
- char **pend_assertions = (char **) xmalloc (argc * sizeof (char *));
- char **pend_includes = (char **) xmalloc (argc * sizeof (char *));
-
- /* Record the option used with each element of pend_assertions.
- This is preparation for supporting more than one option for making
- an assertion. */
- char **pend_assertion_options = (char **) xmalloc (argc * sizeof (char *));
- int inhibit_predefs = 0;
- int no_standard_includes = 0;
- int no_standard_cplusplus_includes = 0;
- int missing_newline = 0;
-
- /* Non-0 means don't output the preprocessed program. */
- int inhibit_output = 0;
- /* Non-0 means -v, so print the full set of include dirs. */
- int verbose = 0;
-
- /* File name which deps are being written to.
- This is 0 if deps are being written to stdout. */
- char *deps_file = 0;
- /* Fopen file mode to open deps_file with. */
- char *deps_mode = "a";
- /* Stream on which to print the dependency information. */
- FILE *deps_stream = 0;
- /* Target-name to write with the dependency information. */
- char *deps_target = 0;
-
-#ifdef RLIMIT_STACK
- /* Get rid of any avoidable limit on stack size. */
- {
- struct rlimit rlim;
-
- /* Set the stack limit huge so that alloca (particularly stringtab
- in dbxread.c) does not fail. */
- getrlimit (RLIMIT_STACK, &rlim);
- rlim.rlim_cur = rlim.rlim_max;
- setrlimit (RLIMIT_STACK, &rlim);
- }
-#endif /* RLIMIT_STACK defined */
-
-#ifdef SIGPIPE
- signal (SIGPIPE, pipe_closed);
-#endif
-
- progname = base_name (argv[0]);
-
-#ifdef VMS
- {
- /* Remove extension from PROGNAME. */
- char *p;
- char *s = progname = savestring (progname);
-
- if ((p = rindex (s, ';')) != 0) *p = '\0'; /* strip version number */
- if ((p = rindex (s, '.')) != 0 /* strip type iff ".exe" */
- && (p[1] == 'e' || p[1] == 'E')
- && (p[2] == 'x' || p[2] == 'X')
- && (p[3] == 'e' || p[3] == 'E')
- && !p[4])
- *p = '\0';
- }
-#endif
-
- in_fname = NULL;
- out_fname = NULL;
-
- /* Initialize is_idchar. */
- initialize_char_syntax ();
-
- no_line_directives = 0;
- no_trigraphs = 1;
- dump_macros = dump_none;
- no_output = 0;
- cplusplus = 0;
- cplusplus_comments = 1;
-
- bzero ((char *) pend_files, argc * sizeof (char *));
- bzero ((char *) pend_defs, argc * sizeof (char *));
- bzero ((char *) pend_undefs, argc * sizeof (char *));
- bzero ((char *) pend_assertions, argc * sizeof (char *));
- bzero ((char *) pend_includes, argc * sizeof (char *));
-
- /* Process switches and find input file name. */
-
- for (i = 1; i < argc; i++) {
- if (argv[i][0] != '-') {
- if (out_fname != NULL)
- fatal ("Usage: %s [switches] input output", argv[0]);
- else if (in_fname != NULL)
- out_fname = argv[i];
- else
- in_fname = argv[i];
- } else {
- switch (argv[i][1]) {
-
- case 'i':
- if (!strcmp (argv[i], "-include")) {
- if (i + 1 == argc)
- fatal ("Filename missing after `-include' option");
- else
- simplify_filename (pend_includes[i] = argv[++i]);
- }
- if (!strcmp (argv[i], "-imacros")) {
- if (i + 1 == argc)
- fatal ("Filename missing after `-imacros' option");
- else
- simplify_filename (pend_files[i] = argv[++i]);
- }
- if (!strcmp (argv[i], "-iprefix")) {
- if (i + 1 == argc)
- fatal ("Filename missing after `-iprefix' option");
- else
- include_prefix = argv[++i];
- }
- if (!strcmp (argv[i], "-ifoutput")) {
- output_conditionals = 1;
- }
- if (!strcmp (argv[i], "-isystem")) {
- struct file_name_list *dirtmp;
-
- if (! (dirtmp = new_include_prefix (NULL_PTR, "", argv[++i])))
- break;
- dirtmp->c_system_include_path = 1;
-
- if (before_system == 0)
- before_system = dirtmp;
- else
- last_before_system->next = dirtmp;
- last_before_system = dirtmp; /* Tail follows the last one */
- }
- /* Add directory to end of path for includes,
- with the default prefix at the front of its name. */
- if (!strcmp (argv[i], "-iwithprefix")) {
- struct file_name_list *dirtmp;
- char *prefix;
-
- if (include_prefix != 0)
- prefix = include_prefix;
- else {
- prefix = savestring (GCC_INCLUDE_DIR);
- /* Remove the `include' from /usr/local/lib/gcc.../include. */
- if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
- prefix[strlen (prefix) - 7] = 0;
- }
-
- if (! (dirtmp = new_include_prefix (NULL_PTR, prefix, argv[++i])))
- break;
-
- if (after_include == 0)
- after_include = dirtmp;
- else
- last_after_include->next = dirtmp;
- last_after_include = dirtmp; /* Tail follows the last one */
- }
- /* Add directory to main path for includes,
- with the default prefix at the front of its name. */
- if (!strcmp (argv[i], "-iwithprefixbefore")) {
- struct file_name_list *dirtmp;
- char *prefix;
-
- if (include_prefix != 0)
- prefix = include_prefix;
- else {
- prefix = savestring (GCC_INCLUDE_DIR);
- /* Remove the `include' from /usr/local/lib/gcc.../include. */
- if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
- prefix[strlen (prefix) - 7] = 0;
- }
-
- dirtmp = new_include_prefix (NULL_PTR, prefix, argv[++i]);
- append_include_chain (dirtmp, dirtmp);
- }
- /* Add directory to end of path for includes. */
- if (!strcmp (argv[i], "-idirafter")) {
- struct file_name_list *dirtmp;
-
- if (! (dirtmp = new_include_prefix (NULL_PTR, "", argv[++i])))
- break;
-
- if (after_include == 0)
- after_include = dirtmp;
- else
- last_after_include->next = dirtmp;
- last_after_include = dirtmp; /* Tail follows the last one */
- }
- break;
-
- case 'o':
- if (out_fname != NULL)
- fatal ("Output filename specified twice");
- if (i + 1 == argc)
- fatal ("Filename missing after -o option");
- out_fname = argv[++i];
- if (!strcmp (out_fname, "-"))
- out_fname = "";
- break;
-
- case 'p':
- if (!strcmp (argv[i], "-pedantic"))
- pedantic = 1;
- else if (!strcmp (argv[i], "-pedantic-errors")) {
- pedantic = 1;
- pedantic_errors = 1;
- } else if (!strcmp (argv[i], "-pcp")) {
- char *pcp_fname;
- if (i + 1 == argc)
- fatal ("Filename missing after -pcp option");
- pcp_fname = argv[++i];
- pcp_outfile =
- ((pcp_fname[0] != '-' || pcp_fname[1] != '\0')
- ? fopen (pcp_fname, "w")
- : stdout);
- if (pcp_outfile == 0)
- pfatal_with_name (pcp_fname);
- no_precomp = 1;
- }
- break;
-
- case 't':
- if (!strcmp (argv[i], "-traditional")) {
- traditional = 1;
- cplusplus_comments = 0;
- } else if (!strcmp (argv[i], "-trigraphs")) {
- no_trigraphs = 0;
- }
- break;
-
- case 'l':
- if (! strcmp (argv[i], "-lang-c"))
- cplusplus = 0, cplusplus_comments = 1, c89 = 0, objc = 0;
- if (! strcmp (argv[i], "-lang-c89"))
- cplusplus = 0, cplusplus_comments = 0, c89 = 1, objc = 0;
- if (! strcmp (argv[i], "-lang-c++"))
- cplusplus = 1, cplusplus_comments = 1, c89 = 0, objc = 0;
- if (! strcmp (argv[i], "-lang-objc"))
- cplusplus = 0, cplusplus_comments = 1, c89 = 0, objc = 1;
- if (! strcmp (argv[i], "-lang-objc++"))
- cplusplus = 1, cplusplus_comments = 1, c89 = 0, objc = 1;
- if (! strcmp (argv[i], "-lang-asm"))
- lang_asm = 1;
- if (! strcmp (argv[i], "-lint"))
- for_lint = 1;
- break;
-
- case '+':
- cplusplus = 1, cplusplus_comments = 1;
- break;
-
- case 'w':
- inhibit_warnings = 1;
- break;
-
- case 'W':
- if (!strcmp (argv[i], "-Wtrigraphs"))
- warn_trigraphs = 1;
- else if (!strcmp (argv[i], "-Wno-trigraphs"))
- warn_trigraphs = 0;
- else if (!strcmp (argv[i], "-Wcomment"))
- warn_comments = 1;
- else if (!strcmp (argv[i], "-Wno-comment"))
- warn_comments = 0;
- else if (!strcmp (argv[i], "-Wcomments"))
- warn_comments = 1;
- else if (!strcmp (argv[i], "-Wno-comments"))
- warn_comments = 0;
- else if (!strcmp (argv[i], "-Wtraditional"))
- warn_stringify = 1;
- else if (!strcmp (argv[i], "-Wno-traditional"))
- warn_stringify = 0;
- else if (!strcmp (argv[i], "-Wimport"))
- warn_import = 1;
- else if (!strcmp (argv[i], "-Wno-import"))
- warn_import = 0;
- else if (!strcmp (argv[i], "-Werror"))
- warnings_are_errors = 1;
- else if (!strcmp (argv[i], "-Wno-error"))
- warnings_are_errors = 0;
- else if (!strcmp (argv[i], "-Wall"))
- {
- warn_trigraphs = 1;
- warn_comments = 1;
- }
- break;
-
- case 'M':
- /* The style of the choices here is a bit mixed.
- The chosen scheme is a hybrid of keeping all options in one string
- and specifying each option in a separate argument:
- -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
- -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
- -M[M][G][D file]. This is awkward to handle in specs, and is not
- as extensible. */
- /* ??? -MG must be specified in addition to one of -M or -MM.
- This can be relaxed in the future without breaking anything.
- The converse isn't true. */
-
- /* -MG isn't valid with -MD or -MMD. This is checked for later. */
- if (!strcmp (argv[i], "-MG"))
- {
- print_deps_missing_files = 1;
- break;
- }
- if (!strcmp (argv[i], "-M"))
- print_deps = 2;
- else if (!strcmp (argv[i], "-MM"))
- print_deps = 1;
- else if (!strcmp (argv[i], "-MD"))
- print_deps = 2;
- else if (!strcmp (argv[i], "-MMD"))
- print_deps = 1;
- /* For -MD and -MMD options, write deps on file named by next arg. */
- if (!strcmp (argv[i], "-MD")
- || !strcmp (argv[i], "-MMD")) {
- if (i + 1 == argc)
- fatal ("Filename missing after %s option", argv[i]);
- i++;
- deps_file = argv[i];
- deps_mode = "w";
- } else {
- /* For -M and -MM, write deps on standard output
- and suppress the usual output. */
- deps_stream = stdout;
- inhibit_output = 1;
- }
- break;
-
- case 'd':
- {
- char *p = argv[i] + 2;
- char c;
- while ((c = *p++)) {
- /* Arg to -d specifies what parts of macros to dump */
- switch (c) {
- case 'M':
- dump_macros = dump_only;
- no_output = 1;
- break;
- case 'N':
- dump_macros = dump_names;
- break;
- case 'D':
- dump_macros = dump_definitions;
- break;
- }
- }
- }
- break;
-
- case 'g':
- if (argv[i][2] == '3')
- debug_output = 1;
- break;
-
- case 'v':
- fprintf (stderr, "GNU CPP version %s", version_string);
-#ifdef TARGET_VERSION
- TARGET_VERSION;
-#endif
- fprintf (stderr, "\n");
- verbose = 1;
- break;
-
- case 'H':
- print_include_names = 1;
- break;
-
- case 'D':
- if (argv[i][2] != 0)
- pend_defs[i] = argv[i] + 2;
- else if (i + 1 == argc)
- fatal ("Macro name missing after -D option");
- else
- i++, pend_defs[i] = argv[i];
- break;
-
- case 'A':
- {
- char *p;
-
- if (argv[i][2] != 0)
- p = argv[i] + 2;
- else if (i + 1 == argc)
- fatal ("Assertion missing after -A option");
- else
- p = argv[++i];
-
- if (!strcmp (p, "-")) {
- /* -A- eliminates all predefined macros and assertions.
- Let's include also any that were specified earlier
- on the command line. That way we can get rid of any
- that were passed automatically in from GCC. */
- int j;
- inhibit_predefs = 1;
- for (j = 0; j < i; j++)
- pend_defs[j] = pend_assertions[j] = 0;
- } else {
- pend_assertions[i] = p;
- pend_assertion_options[i] = "-A";
- }
- }
- break;
-
- case 'U': /* JF #undef something */
- if (argv[i][2] != 0)
- pend_undefs[i] = argv[i] + 2;
- else if (i + 1 == argc)
- fatal ("Macro name missing after -U option");
- else
- pend_undefs[i] = argv[i+1], i++;
- break;
-
- case 'C':
- put_out_comments = 1;
- break;
-
- case 'E': /* -E comes from cc -E; ignore it. */
- break;
-
- case 'P':
- no_line_directives = 1;
- break;
-
- case '$': /* Don't include $ in identifiers. */
- is_idchar['$'] = is_idstart['$'] = 0;
- break;
-
- case 'I': /* Add directory to path for includes. */
- {
- struct file_name_list *dirtmp;
-
- if (! ignore_srcdir && !strcmp (argv[i] + 2, "-")) {
- ignore_srcdir = 1;
- /* Don't use any preceding -I directories for #include <...>. */
- first_bracket_include = 0;
- }
- else {
- dirtmp = new_include_prefix (last_include, "",
- argv[i][2] ? argv[i] + 2 : argv[++i]);
- append_include_chain (dirtmp, dirtmp);
- }
- }
- break;
-
- case 'n':
- if (!strcmp (argv[i], "-nostdinc"))
- /* -nostdinc causes no default include directories.
- You must specify all include-file directories with -I. */
- no_standard_includes = 1;
- else if (!strcmp (argv[i], "-nostdinc++"))
- /* -nostdinc++ causes no default C++-specific include directories. */
- no_standard_cplusplus_includes = 1;
- else if (!strcmp (argv[i], "-noprecomp"))
- no_precomp = 1;
- break;
-
- case 'u':
- /* Sun compiler passes undocumented switch "-undef".
- Let's assume it means to inhibit the predefined symbols. */
- inhibit_predefs = 1;
- break;
-
- case '\0': /* JF handle '-' as file name meaning stdin or stdout */
- if (in_fname == NULL) {
- in_fname = "";
- break;
- } else if (out_fname == NULL) {
- out_fname = "";
- break;
- } /* else fall through into error */
-
- default:
- fatal ("Invalid option `%s'", argv[i]);
- }
- }
- }
-
- /* Add dirs from CPATH after dirs from -I. */
- /* There seems to be confusion about what CPATH should do,
- so for the moment it is not documented. */
- /* Some people say that CPATH should replace the standard include dirs,
- but that seems pointless: it comes before them, so it overrides them
- anyway. */
- cp = getenv ("CPATH");
- if (cp && ! no_standard_includes)
- path_include (cp);
-
- /* Initialize output buffer */
-
- outbuf.buf = (U_CHAR *) xmalloc (OUTBUF_SIZE);
- outbuf.bufp = outbuf.buf;
- outbuf.length = OUTBUF_SIZE;
-
- /* Do partial setup of input buffer for the sake of generating
- early #line directives (when -g is in effect). */
-
- fp = &instack[++indepth];
- if (in_fname == NULL)
- in_fname = "";
- fp->nominal_fname = fp->fname = in_fname;
- fp->lineno = 0;
-
- /* In C++, wchar_t is a distinct basic type, and we can expect
- __wchar_t to be defined by cc1plus. */
- if (cplusplus)
- wchar_type = "__wchar_t";
-
- /* Install __LINE__, etc. Must follow initialize_char_syntax
- and option processing. */
- initialize_builtins (fp, &outbuf);
-
- /* Do standard #defines and assertions
- that identify system and machine type. */
-
- if (!inhibit_predefs) {
- char *p = (char *) alloca (strlen (predefs) + 1);
- strcpy (p, predefs);
- while (*p) {
- char *q;
- while (*p == ' ' || *p == '\t')
- p++;
- /* Handle -D options. */
- if (p[0] == '-' && p[1] == 'D') {
- q = &p[2];
- while (*p && *p != ' ' && *p != '\t')
- p++;
- if (*p != 0)
- *p++= 0;
- if (debug_output)
- output_line_directive (fp, &outbuf, 0, same_file);
- make_definition (q, &outbuf);
- while (*p == ' ' || *p == '\t')
- p++;
- } else if (p[0] == '-' && p[1] == 'A') {
- /* Handle -A options (assertions). */
- char *assertion;
- char *past_name;
- char *value;
- char *past_value;
- char *termination;
- int save_char;
-
- assertion = &p[2];
- past_name = assertion;
- /* Locate end of name. */
- while (*past_name && *past_name != ' '
- && *past_name != '\t' && *past_name != '(')
- past_name++;
- /* Locate `(' at start of value. */
- value = past_name;
- while (*value && (*value == ' ' || *value == '\t'))
- value++;
- if (*value++ != '(')
- abort ();
- while (*value && (*value == ' ' || *value == '\t'))
- value++;
- past_value = value;
- /* Locate end of value. */
- while (*past_value && *past_value != ' '
- && *past_value != '\t' && *past_value != ')')
- past_value++;
- termination = past_value;
- while (*termination && (*termination == ' ' || *termination == '\t'))
- termination++;
- if (*termination++ != ')')
- abort ();
- if (*termination && *termination != ' ' && *termination != '\t')
- abort ();
- /* Temporarily null-terminate the value. */
- save_char = *termination;
- *termination = '\0';
- /* Install the assertion. */
- make_assertion ("-A", assertion);
- *termination = (char) save_char;
- p = termination;
- while (*p == ' ' || *p == '\t')
- p++;
- } else {
- abort ();
- }
- }
- }
-
- /* Now handle the command line options. */
-
- /* Do -U's, -D's and -A's in the order they were seen. */
- for (i = 1; i < argc; i++) {
- if (pend_undefs[i]) {
- if (debug_output)
- output_line_directive (fp, &outbuf, 0, same_file);
- make_undef (pend_undefs[i], &outbuf);
- }
- if (pend_defs[i]) {
- if (debug_output)
- output_line_directive (fp, &outbuf, 0, same_file);
- make_definition (pend_defs[i], &outbuf);
- }
- if (pend_assertions[i])
- make_assertion (pend_assertion_options[i], pend_assertions[i]);
- }
-
- done_initializing = 1;
-
- { /* Read the appropriate environment variable and if it exists
- replace include_defaults with the listed path. */
- char *epath = 0;
- switch ((objc << 1) + cplusplus)
- {
- case 0:
- epath = getenv ("C_INCLUDE_PATH");
- break;
- case 1:
- epath = getenv ("CPLUS_INCLUDE_PATH");
- break;
- case 2:
- epath = getenv ("OBJC_INCLUDE_PATH");
- break;
- case 3:
- epath = getenv ("OBJCPLUS_INCLUDE_PATH");
- break;
- }
- /* If the environment var for this language is set,
- add to the default list of include directories. */
- if (epath) {
- int num_dirs;
- char *startp, *endp;
-
- for (num_dirs = 1, startp = epath; *startp; startp++)
- if (*startp == PATH_SEPARATOR)
- num_dirs++;
- include_defaults
- = (struct default_include *) xmalloc ((num_dirs
- * sizeof (struct default_include))
- + sizeof (include_defaults_array));
- startp = endp = epath;
- num_dirs = 0;
- while (1) {
- char c = *endp++;
- if (c == PATH_SEPARATOR || !c) {
- endp[-1] = 0;
- include_defaults[num_dirs].fname
- = startp == endp ? "." : savestring (startp);
- endp[-1] = c;
- include_defaults[num_dirs].cplusplus = cplusplus;
- include_defaults[num_dirs].cxx_aware = 1;
- num_dirs++;
- if (!c)
- break;
- startp = endp;
- }
- }
- /* Put the usual defaults back in at the end. */
- bcopy ((char *) include_defaults_array,
- (char *) &include_defaults[num_dirs],
- sizeof (include_defaults_array));
- }
- }
-
- append_include_chain (before_system, last_before_system);
- first_system_include = before_system;
-
- /* Unless -fnostdinc,
- tack on the standard include file dirs to the specified list */
- if (!no_standard_includes) {
- struct default_include *p = include_defaults;
- char *specd_prefix = include_prefix;
- char *default_prefix = savestring (GCC_INCLUDE_DIR);
- int default_len = 0;
- /* Remove the `include' from /usr/local/lib/gcc.../include. */
- if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) {
- default_len = strlen (default_prefix) - 7;
- default_prefix[default_len] = 0;
- }
- /* Search "translated" versions of GNU directories.
- These have /usr/local/lib/gcc... replaced by specd_prefix. */
- if (specd_prefix != 0 && default_len != 0)
- for (p = include_defaults; p->fname; p++) {
- /* Some standard dirs are only for C++. */
- if (!p->cplusplus || (cplusplus && !no_standard_cplusplus_includes)) {
- /* Does this dir start with the prefix? */
- if (!strncmp (p->fname, default_prefix, default_len)) {
- /* Yes; change prefix and add to search list. */
- struct file_name_list *new
- = new_include_prefix (NULL_PTR, specd_prefix,
- p->fname + default_len);
- if (new) {
- new->c_system_include_path = !p->cxx_aware;
- append_include_chain (new, new);
- if (first_system_include == 0)
- first_system_include = new;
- }
- }
- }
- }
- /* Search ordinary names for GNU include directories. */
- for (p = include_defaults; p->fname; p++) {
- /* Some standard dirs are only for C++. */
- if (!p->cplusplus || (cplusplus && !no_standard_cplusplus_includes)) {
- struct file_name_list *new
- = new_include_prefix (NULL_PTR, "", p->fname);
- if (new) {
- new->c_system_include_path = !p->cxx_aware;
- append_include_chain (new, new);
- if (first_system_include == 0)
- first_system_include = new;
- }
- }
- }
- }
-
- /* Tack the after_include chain at the end of the include chain. */
- append_include_chain (after_include, last_after_include);
- if (first_system_include == 0)
- first_system_include = after_include;
-
- /* With -v, print the list of dirs to search. */
- if (verbose) {
- struct file_name_list *p;
- fprintf (stderr, "#include \"...\" search starts here:\n");
- for (p = include; p; p = p->next) {
- if (p == first_bracket_include)
- fprintf (stderr, "#include <...> search starts here:\n");
- if (!p->fname[0])
- fprintf (stderr, " .\n");
- else if (!strcmp (p->fname, "/") || !strcmp (p->fname, "//"))
- fprintf (stderr, " %s\n", p->fname);
- else
- /* Omit trailing '/'. */
- fprintf (stderr, " %.*s\n", (int) strlen (p->fname) - 1, p->fname);
- }
- fprintf (stderr, "End of search list.\n");
- }
-
- /* -MG doesn't select the form of output and must be specified with one of
- -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't
- inhibit compilation. */
- if (print_deps_missing_files && (print_deps == 0 || !inhibit_output))
- fatal ("-MG must be specified with one of -M or -MM");
-
- /* Either of two environment variables can specify output of deps.
- Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET",
- where OUTPUT_FILE is the file to write deps info to
- and DEPS_TARGET is the target to mention in the deps. */
-
- if (print_deps == 0
- && (getenv ("SUNPRO_DEPENDENCIES") != 0
- || getenv ("DEPENDENCIES_OUTPUT") != 0)) {
- char *spec = getenv ("DEPENDENCIES_OUTPUT");
- char *s;
- char *output_file;
-
- if (spec == 0) {
- spec = getenv ("SUNPRO_DEPENDENCIES");
- print_deps = 2;
- }
- else
- print_deps = 1;
-
- s = spec;
- /* Find the space before the DEPS_TARGET, if there is one. */
- /* This should use index. (mrs) */
- while (*s != 0 && *s != ' ') s++;
- if (*s != 0) {
- deps_target = s + 1;
- output_file = xmalloc (s - spec + 1);
- bcopy (spec, output_file, s - spec);
- output_file[s - spec] = 0;
- }
- else {
- deps_target = 0;
- output_file = spec;
- }
-
- deps_file = output_file;
- deps_mode = "a";
- }
-
- /* For -M, print the expected object file name
- as the target of this Make-rule. */
- if (print_deps) {
- deps_allocated_size = 200;
- deps_buffer = xmalloc (deps_allocated_size);
- deps_buffer[0] = 0;
- deps_size = 0;
- deps_column = 0;
-
- if (deps_target) {
- deps_output (deps_target, ':');
- } else if (*in_fname == 0) {
- deps_output ("-", ':');
- } else {
- char *p, *q;
- int len;
-
- q = base_name (in_fname);
-
- /* Copy remainder to mungable area. */
- p = (char *) alloca (strlen(q) + 8);
- strcpy (p, q);
-
- /* Output P, but remove known suffixes. */
- len = strlen (p);
- q = p + len;
- if (len >= 2
- && p[len - 2] == '.'
- && index("cCsSm", p[len - 1]))
- q = p + (len - 2);
- else if (len >= 3
- && p[len - 3] == '.'
- && p[len - 2] == 'c'
- && p[len - 1] == 'c')
- q = p + (len - 3);
- else if (len >= 4
- && p[len - 4] == '.'
- && p[len - 3] == 'c'
- && p[len - 2] == 'x'
- && p[len - 1] == 'x')
- q = p + (len - 4);
- else if (len >= 4
- && p[len - 4] == '.'
- && p[len - 3] == 'c'
- && p[len - 2] == 'p'
- && p[len - 1] == 'p')
- q = p + (len - 4);
-
- /* Supply our own suffix. */
-#ifndef VMS
- strcpy (q, ".o");
-#else
- strcpy (q, ".obj");
-#endif
-
- deps_output (p, ':');
- deps_output (in_fname, ' ');
- }
- }
-
- /* Scan the -imacros files before the main input.
- Much like #including them, but with no_output set
- so that only their macro definitions matter. */
-
- no_output++; no_record_file++;
- for (i = 1; i < argc; i++)
- if (pend_files[i]) {
- struct include_file *inc;
- int fd = open_include_file (pend_files[i], NULL_PTR, NULL_PTR, &inc);
- if (fd < 0) {
- perror_with_name (pend_files[i]);
- return FATAL_EXIT_CODE;
- }
- finclude (fd, inc, &outbuf, 0, NULL_PTR);
- }
- no_output--; no_record_file--;
-
- /* Copy the entire contents of the main input file into
- the stacked input buffer previously allocated for it. */
-
- /* JF check for stdin */
- if (in_fname == NULL || *in_fname == 0) {
- in_fname = "";
- f = 0;
- } else if ((f = open (in_fname, O_RDONLY, 0666)) < 0)
- goto perror;
-
- if (fstat (f, &st) != 0)
- pfatal_with_name (in_fname);
- fp->nominal_fname = fp->fname = in_fname;
- fp->lineno = 1;
- fp->system_header_p = 0;
- /* JF all this is mine about reading pipes and ttys */
- if (! S_ISREG (st.st_mode)) {
- /* Read input from a file that is not a normal disk file.
- We cannot preallocate a buffer with the correct size,
- so we must read in the file a piece at the time and make it bigger. */
- int size;
- int bsize;
- int cnt;
-
- if (S_ISDIR (st.st_mode))
- fatal ("Input file `%s' is a directory", in_fname);
-
- bsize = 2000;
- size = 0;
- fp->buf = (U_CHAR *) xmalloc (bsize + 2);
- for (;;) {
- cnt = safe_read (f, (char *) fp->buf + size, bsize - size);
- if (cnt < 0) goto perror; /* error! */
- size += cnt;
- if (size != bsize) break; /* End of file */
- bsize *= 2;
- fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);
- }
- fp->length = size;
- } else {
- /* Read a file whose size we can determine in advance.
- For the sake of VMS, st.st_size is just an upper bound. */
- fp->buf = (U_CHAR *) xmalloc (st.st_size + 2);
- fp->length = safe_read (f, (char *) fp->buf, st.st_size);
- if (fp->length < 0) goto perror;
- }
- fp->bufp = fp->buf;
- fp->if_stack = if_stack;
-
- /* Make sure data ends with a newline. And put a null after it. */
-
- if ((fp->length > 0 && fp->buf[fp->length - 1] != '\n')
- /* Backslash-newline at end is not good enough. */
- || (fp->length > 1 && fp->buf[fp->length - 2] == '\\')) {
- fp->buf[fp->length++] = '\n';
- missing_newline = 1;
- }
- fp->buf[fp->length] = '\0';
-
- /* Unless inhibited, convert trigraphs in the input. */
-
- if (!no_trigraphs)
- trigraph_pcp (fp);
-
- /* Now that we know the input file is valid, open the output. */
-
- if (!out_fname || !strcmp (out_fname, ""))
- out_fname = "stdout";
- else if (! freopen (out_fname, "w", stdout))
- pfatal_with_name (out_fname);
-
- output_line_directive (fp, &outbuf, 0, same_file);
-
- /* Scan the -include files before the main input. */
-
- no_record_file++;
- for (i = 1; i < argc; i++)
- if (pend_includes[i]) {
- struct include_file *inc;
- int fd = open_include_file (pend_includes[i], NULL_PTR, NULL_PTR, &inc);
- if (fd < 0) {
- perror_with_name (pend_includes[i]);
- return FATAL_EXIT_CODE;
- }
- finclude (fd, inc, &outbuf, 0, NULL_PTR);
- }
- no_record_file--;
-
- /* Scan the input, processing macros and directives. */
-
- rescan (&outbuf, 0);
-
- if (missing_newline)
- fp->lineno--;
-
- if (pedantic && missing_newline)
- pedwarn ("file does not end in newline");
-
- /* Now we have processed the entire input
- Write whichever kind of output has been requested. */
-
- if (dump_macros == dump_only)
- dump_all_macros ();
- else if (! inhibit_output) {
- write_output ();
- }
-
- if (print_deps) {
- /* Don't actually write the deps file if compilation has failed. */
- if (errors == 0) {
- if (deps_file && ! (deps_stream = fopen (deps_file, deps_mode)))
- pfatal_with_name (deps_file);
- fputs (deps_buffer, deps_stream);
- putc ('\n', deps_stream);
- if (deps_file) {
- if (ferror (deps_stream) || fclose (deps_stream) != 0)
- fatal ("I/O error on output");
- }
- }
- }
-
- if (pcp_outfile && pcp_outfile != stdout
- && (ferror (pcp_outfile) || fclose (pcp_outfile) != 0))
- fatal ("I/O error on `-pcp' output");
-
- if (ferror (stdout) || fclose (stdout) != 0)
- fatal ("I/O error on output");
-
- if (errors)
- exit (FATAL_EXIT_CODE);
- exit (SUCCESS_EXIT_CODE);
-
- perror:
- pfatal_with_name (in_fname);
- return 0;
-}
-
-/* Given a colon-separated list of file names PATH,
- add all the names to the search path for include files. */
-
-static void
-path_include (path)
- char *path;
-{
- char *p;
-
- p = path;
-
- if (*p)
- while (1) {
- char *q = p;
- char c;
- struct file_name_list *dirtmp;
-
- /* Find the end of this name. */
- while ((c = *q++) != PATH_SEPARATOR && c)
- continue;
-
- q[-1] = 0;
- dirtmp = new_include_prefix (last_include, "", p == q ? "." : p);
- q[-1] = c;
- append_include_chain (dirtmp, dirtmp);
-
- /* Advance past this name. */
- p = q;
- if (! c)
- break;
- }
-}
-
-/* Return the address of the first character in S that equals C.
- S is an array of length N, possibly containing '\0's, and followed by '\0'.
- Return 0 if there is no such character. Assume that C itself is not '\0'.
- If we knew we could use memchr, we could just invoke memchr (S, C, N),
- but unfortunately memchr isn't autoconfigured yet. */
-
-static U_CHAR *
-index0 (s, c, n)
- U_CHAR *s;
- int c;
- size_t n;
-{
- char *p = (char *) s;
- for (;;) {
- char *q = index (p, c);
- if (q)
- return (U_CHAR *) q;
- else {
- size_t l = strlen (p);
- if (l == n)
- return 0;
- l++;
- p += l;
- n -= l;
- }
- }
-}
-
-/* Pre-C-Preprocessor to translate ANSI trigraph idiocy in BUF
- before main CCCP processing. Name `pcp' is also in honor of the
- drugs the trigraph designers must have been on.
-
- Using an extra pass through the buffer takes a little extra time,
- but is infinitely less hairy than trying to handle trigraphs inside
- strings, etc. everywhere, and also makes sure that trigraphs are
- only translated in the top level of processing. */
-
-static void
-trigraph_pcp (buf)
- FILE_BUF *buf;
-{
- register U_CHAR c, *fptr, *bptr, *sptr, *lptr;
- int len;
-
- fptr = bptr = sptr = buf->buf;
- lptr = fptr + buf->length;
- while ((sptr = index0 (sptr, '?', (size_t) (lptr - sptr))) != NULL) {
- if (*++sptr != '?')
- continue;
- switch (*++sptr) {
- case '=':
- c = '#';
- break;
- case '(':
- c = '[';
- break;
- case '/':
- c = '\\';
- break;
- case ')':
- c = ']';
- break;
- case '\'':
- c = '^';
- break;
- case '<':
- c = '{';
- break;
- case '!':
- c = '|';
- break;
- case '>':
- c = '}';
- break;
- case '-':
- c = '~';
- break;
- case '?':
- sptr--;
- continue;
- default:
- continue;
- }
- len = sptr - fptr - 2;
-
- /* BSD doc says bcopy () works right for overlapping strings. In ANSI
- C, this will be memmove (). */
- if (bptr != fptr && len > 0)
- bcopy ((char *) fptr, (char *) bptr, len);
-
- bptr += len;
- *bptr++ = c;
- fptr = ++sptr;
- }
- len = buf->length - (fptr - buf->buf);
- if (bptr != fptr && len > 0)
- bcopy ((char *) fptr, (char *) bptr, len);
- buf->length -= fptr - bptr;
- buf->buf[buf->length] = '\0';
- if (warn_trigraphs && fptr != bptr)
- warning_with_line (0, "%lu trigraph(s) encountered",
- (unsigned long) (fptr - bptr) / 2);
-}
-
-/* Move all backslash-newline pairs out of embarrassing places.
- Exchange all such pairs following BP
- with any potentially-embarrassing characters that follow them.
- Potentially-embarrassing characters are / and *
- (because a backslash-newline inside a comment delimiter
- would cause it not to be recognized). */
-
-static void
-newline_fix (bp)
- U_CHAR *bp;
-{
- register U_CHAR *p = bp;
-
- /* First count the backslash-newline pairs here. */
-
- while (p[0] == '\\' && p[1] == '\n')
- p += 2;
-
- /* What follows the backslash-newlines is not embarrassing. */
-
- if (*p != '/' && *p != '*')
- return;
-
- /* Copy all potentially embarrassing characters
- that follow the backslash-newline pairs
- down to where the pairs originally started. */
-
- while (*p == '*' || *p == '/')
- *bp++ = *p++;
-
- /* Now write the same number of pairs after the embarrassing chars. */
- while (bp < p) {
- *bp++ = '\\';
- *bp++ = '\n';
- }
-}
-
-/* Like newline_fix but for use within a directive-name.
- Move any backslash-newlines up past any following symbol constituents. */
-
-static void
-name_newline_fix (bp)
- U_CHAR *bp;
-{
- register U_CHAR *p = bp;
-
- /* First count the backslash-newline pairs here. */
- while (p[0] == '\\' && p[1] == '\n')
- p += 2;
-
- /* What follows the backslash-newlines is not embarrassing. */
-
- if (!is_idchar[*p])
- return;
-
- /* Copy all potentially embarrassing characters
- that follow the backslash-newline pairs
- down to where the pairs originally started. */
-
- while (is_idchar[*p])
- *bp++ = *p++;
-
- /* Now write the same number of pairs after the embarrassing chars. */
- while (bp < p) {
- *bp++ = '\\';
- *bp++ = '\n';
- }
-}
-
-/* Look for lint commands in comments.
-
- When we come in here, ibp points into a comment. Limit is as one expects.
- scan within the comment -- it should start, after lwsp, with a lint command.
- If so that command is returned as a (constant) string.
-
- Upon return, any arg will be pointed to with argstart and will be
- arglen long. Note that we don't parse that arg since it will just
- be printed out again. */
-
-static char *
-get_lintcmd (ibp, limit, argstart, arglen, cmdlen)
- register U_CHAR *ibp;
- register U_CHAR *limit;
- U_CHAR **argstart; /* point to command arg */
- int *arglen, *cmdlen; /* how long they are */
-{
- HOST_WIDE_INT linsize;
- register U_CHAR *numptr; /* temp for arg parsing */
-
- *arglen = 0;
-
- SKIP_WHITE_SPACE (ibp);
-
- if (ibp >= limit) return NULL;
-
- linsize = limit - ibp;
-
- /* Oh, I wish C had lexical functions... hell, I'll just open-code the set */
- if ((linsize >= 10) && !bcmp (ibp, "NOTREACHED", 10)) {
- *cmdlen = 10;
- return "NOTREACHED";
- }
- if ((linsize >= 8) && !bcmp (ibp, "ARGSUSED", 8)) {
- *cmdlen = 8;
- return "ARGSUSED";
- }
- if ((linsize >= 11) && !bcmp (ibp, "LINTLIBRARY", 11)) {
- *cmdlen = 11;
- return "LINTLIBRARY";
- }
- if ((linsize >= 7) && !bcmp (ibp, "VARARGS", 7)) {
- *cmdlen = 7;
- ibp += 7; linsize -= 7;
- if ((linsize == 0) || ! isdigit (*ibp)) return "VARARGS";
-
- /* OK, read a number */
- for (numptr = *argstart = ibp; (numptr < limit) && isdigit (*numptr);
- numptr++);
- *arglen = numptr - *argstart;
- return "VARARGS";
- }
- return NULL;
-}
-
-/*
- * The main loop of the program.
- *
- * Read characters from the input stack, transferring them to the
- * output buffer OP.
- *
- * Macros are expanded and push levels on the input stack.
- * At the end of such a level it is popped off and we keep reading.
- * At the end of any other kind of level, we return.
- * #-directives are handled, except within macros.
- *
- * If OUTPUT_MARKS is nonzero, keep Newline markers found in the input
- * and insert them when appropriate. This is set while scanning macro
- * arguments before substitution. It is zero when scanning for final output.
- * There are three types of Newline markers:
- * * Newline - follows a macro name that was not expanded
- * because it appeared inside an expansion of the same macro.
- * This marker prevents future expansion of that identifier.
- * When the input is rescanned into the final output, these are deleted.
- * These are also deleted by ## concatenation.
- * * Newline Space (or Newline and any other whitespace character)
- * stands for a place that tokens must be separated or whitespace
- * is otherwise desirable, but where the ANSI standard specifies there
- * is no whitespace. This marker turns into a Space (or whichever other
- * whitespace char appears in the marker) in the final output,
- * but it turns into nothing in an argument that is stringified with #.
- * Such stringified arguments are the only place where the ANSI standard
- * specifies with precision that whitespace may not appear.
- *
- * During this function, IP->bufp is kept cached in IBP for speed of access.
- * Likewise, OP->bufp is kept in OBP. Before calling a subroutine
- * IBP, IP and OBP must be copied back to memory. IP and IBP are
- * copied back with the RECACHE macro. OBP must be copied back from OP->bufp
- * explicitly, and before RECACHE, since RECACHE uses OBP.
- */
-
-static void
-rescan (op, output_marks)
- FILE_BUF *op;
- int output_marks;
-{
- /* Character being scanned in main loop. */
- register U_CHAR c;
-
- /* Length of pending accumulated identifier. */
- register int ident_length = 0;
-
- /* Hash code of pending accumulated identifier. */
- register int hash = 0;
-
- /* Current input level (&instack[indepth]). */
- FILE_BUF *ip;
-
- /* Pointer for scanning input. */
- register U_CHAR *ibp;
-
- /* Pointer to end of input. End of scan is controlled by LIMIT. */
- register U_CHAR *limit;
-
- /* Pointer for storing output. */
- register U_CHAR *obp;
-
- /* REDO_CHAR is nonzero if we are processing an identifier
- after backing up over the terminating character.
- Sometimes we process an identifier without backing up over
- the terminating character, if the terminating character
- is not special. Backing up is done so that the terminating character
- will be dispatched on again once the identifier is dealt with. */
- int redo_char = 0;
-
- /* 1 if within an identifier inside of which a concatenation
- marker (Newline -) has been seen. */
- int concatenated = 0;
-
- /* While scanning a comment or a string constant,
- this records the line it started on, for error messages. */
- int start_line;
-
- /* Record position of last `real' newline. */
- U_CHAR *beg_of_line;
-
-/* Pop the innermost input stack level, assuming it is a macro expansion. */
-
-#define POPMACRO \
-do { ip->macro->type = T_MACRO; \
- if (ip->free_ptr) free (ip->free_ptr); \
- --indepth; } while (0)
-
-/* Reload `rescan's local variables that describe the current
- level of the input stack. */
-
-#define RECACHE \
-do { ip = &instack[indepth]; \
- ibp = ip->bufp; \
- limit = ip->buf + ip->length; \
- op->bufp = obp; \
- check_expand (op, limit - ibp); \
- beg_of_line = 0; \
- obp = op->bufp; } while (0)
-
- if (no_output && instack[indepth].fname != 0)
- skip_if_group (&instack[indepth], 1, NULL);
-
- obp = op->bufp;
- RECACHE;
-
- beg_of_line = ibp;
-
- /* Our caller must always put a null after the end of
- the input at each input stack level. */
- if (*limit != 0)
- abort ();
-
- while (1) {
- c = *ibp++;
- *obp++ = c;
-
- switch (c) {
- case '\\':
- if (*ibp == '\n' && !ip->macro) {
- /* At the top level, always merge lines ending with backslash-newline,
- even in middle of identifier. But do not merge lines in a macro,
- since backslash might be followed by a newline-space marker. */
- ++ibp;
- ++ip->lineno;
- --obp; /* remove backslash from obuf */
- break;
- }
- /* If ANSI, backslash is just another character outside a string. */
- if (!traditional)
- goto randomchar;
- /* Otherwise, backslash suppresses specialness of following char,
- so copy it here to prevent the switch from seeing it.
- But first get any pending identifier processed. */
- if (ident_length > 0)
- goto specialchar;
- if (ibp < limit)
- *obp++ = *ibp++;
- break;
-
- case '%':
- if (ident_length || ip->macro || traditional)
- goto randomchar;
- while (*ibp == '\\' && ibp[1] == '\n') {
- ibp += 2;
- ++ip->lineno;
- }
- if (*ibp != ':')
- break;
- /* Treat this %: digraph as if it were #. */
- /* Fall through. */
-
- case '#':
- if (assertions_flag) {
- if (ident_length)
- goto specialchar;
- /* Copy #foo (bar lose) without macro expansion. */
- obp[-1] = '#'; /* In case it was '%'. */
- SKIP_WHITE_SPACE (ibp);
- while (is_idchar[*ibp])
- *obp++ = *ibp++;
- SKIP_WHITE_SPACE (ibp);
- if (*ibp == '(') {
- ip->bufp = ibp;
- skip_paren_group (ip);
- bcopy ((char *) ibp, (char *) obp, ip->bufp - ibp);
- obp += ip->bufp - ibp;
- ibp = ip->bufp;
- }
- break;
- }
-
- /* If this is expanding a macro definition, don't recognize
- preprocessing directives. */
- if (ip->macro != 0)
- goto randomchar;
- /* If this is expand_into_temp_buffer,
- don't recognize them either. Warn about them
- only after an actual newline at this level,
- not at the beginning of the input level. */
- if (! ip->fname) {
- if (ip->buf != beg_of_line)
- warning ("preprocessing directive not recognized within macro arg");
- goto randomchar;
- }
- if (ident_length)
- goto specialchar;
-
-
- /* # keyword: a # must be first nonblank char on the line */
- if (beg_of_line == 0)
- goto randomchar;
- {
- U_CHAR *bp;
-
- /* Scan from start of line, skipping whitespace, comments
- and backslash-newlines, and see if we reach this #.
- If not, this # is not special. */
- bp = beg_of_line;
- /* If -traditional, require # to be at beginning of line. */
- if (!traditional) {
- while (1) {
- if (is_hor_space[*bp])
- bp++;
- else if (*bp == '\\' && bp[1] == '\n')
- bp += 2;
- else if (*bp == '/' && bp[1] == '*') {
- bp += 2;
- while (!(*bp == '*' && bp[1] == '/'))
- bp++;
- bp += 2;
- }
- /* There is no point in trying to deal with C++ // comments here,
- because if there is one, then this # must be part of the
- comment and we would never reach here. */
- else break;
- }
- if (c == '%') {
- if (bp[0] != '%')
- break;
- while (bp[1] == '\\' && bp[2] == '\n')
- bp += 2;
- if (bp + 1 != ibp)
- break;
- /* %: appears at start of line; skip past the ':' too. */
- bp++;
- ibp++;
- }
- }
- if (bp + 1 != ibp)
- goto randomchar;
- }
-
- /* This # can start a directive. */
-
- --obp; /* Don't copy the '#' */
-
- ip->bufp = ibp;
- op->bufp = obp;
- if (! handle_directive (ip, op)) {
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
- /* Not a known directive: treat it as ordinary text.
- IP, OP, IBP, etc. have not been changed. */
- if (no_output && instack[indepth].fname) {
- /* If not generating expanded output,
- what we do with ordinary text is skip it.
- Discard everything until next # directive. */
- skip_if_group (&instack[indepth], 1, 0);
- RECACHE;
- beg_of_line = ibp;
- break;
- }
- *obp++ = '#'; /* Copy # (even if it was originally %:). */
- /* Don't expand an identifier that could be a macro directive.
- (Section 3.8.3 of the ANSI C standard) */
- SKIP_WHITE_SPACE (ibp);
- if (is_idstart[*ibp])
- {
- *obp++ = *ibp++;
- while (is_idchar[*ibp])
- *obp++ = *ibp++;
- }
- goto randomchar;
- }
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
- /* A # directive has been successfully processed. */
- /* If not generating expanded output, ignore everything until
- next # directive. */
- if (no_output && instack[indepth].fname)
- skip_if_group (&instack[indepth], 1, 0);
- obp = op->bufp;
- RECACHE;
- beg_of_line = ibp;
- break;
-
- case '\"': /* skip quoted string */
- case '\'':
- /* A single quoted string is treated like a double -- some
- programs (e.g., troff) are perverse this way */
-
- /* Handle any pending identifier;
- but the L in L'...' or L"..." is not an identifier. */
- if (ident_length
- && ! (ident_length == 1 && hash == HASHSTEP (0, 'L')))
- goto specialchar;
-
- start_line = ip->lineno;
-
- /* Skip ahead to a matching quote. */
-
- while (1) {
- if (ibp >= limit) {
- if (ip->macro != 0) {
- /* try harder: this string crosses a macro expansion boundary.
- This can happen naturally if -traditional.
- Otherwise, only -D can make a macro with an unmatched quote. */
- POPMACRO;
- RECACHE;
- continue;
- }
- if (!traditional) {
- error_with_line (line_for_error (start_line),
- "unterminated string or character constant");
- error_with_line (multiline_string_line,
- "possible real start of unterminated constant");
- multiline_string_line = 0;
- }
- break;
- }
- *obp++ = *ibp;
- switch (*ibp++) {
- case '\n':
- ++ip->lineno;
- ++op->lineno;
- /* Traditionally, end of line ends a string constant with no error.
- So exit the loop and record the new line. */
- if (traditional) {
- beg_of_line = ibp;
- goto while2end;
- }
- if (c == '\'') {
- error_with_line (line_for_error (start_line),
- "unterminated character constant");
- goto while2end;
- }
- if (multiline_string_line == 0) {
- if (pedantic)
- pedwarn_with_line (line_for_error (start_line),
- "string constant runs past end of line");
- multiline_string_line = ip->lineno - 1;
- }
- break;
-
- case '\\':
- if (ibp >= limit)
- break;
- if (*ibp == '\n') {
- /* Backslash newline is replaced by nothing at all,
- but keep the line counts correct. */
- --obp;
- ++ibp;
- ++ip->lineno;
- } else {
- /* ANSI stupidly requires that in \\ the second \
- is *not* prevented from combining with a newline. */
- while (*ibp == '\\' && ibp[1] == '\n') {
- ibp += 2;
- ++ip->lineno;
- }
- *obp++ = *ibp++;
- }
- break;
-
- case '\"':
- case '\'':
- if (ibp[-1] == c)
- goto while2end;
- break;
- }
- }
- while2end:
- break;
-
- case '/':
- if (*ibp == '\\' && ibp[1] == '\n')
- newline_fix (ibp);
-
- if (*ibp != '*'
- && !(cplusplus_comments && *ibp == '/'))
- goto randomchar;
- if (ip->macro != 0)
- goto randomchar;
- if (ident_length)
- goto specialchar;
-
- if (*ibp == '/') {
- /* C++ style comment... */
- start_line = ip->lineno;
-
- /* Comments are equivalent to spaces. */
- if (! put_out_comments)
- obp[-1] = ' ';
-
- {
- U_CHAR *before_bp = ibp;
-
- while (++ibp < limit) {
- if (*ibp == '\n') {
- if (ibp[-1] != '\\') {
- if (put_out_comments) {
- bcopy ((char *) before_bp, (char *) obp, ibp - before_bp);
- obp += ibp - before_bp;
- }
- break;
- }
- if (warn_comments)
- warning ("multiline `//' comment");
- ++ip->lineno;
- /* Copy the newline into the output buffer, in order to
- avoid the pain of a #line every time a multiline comment
- is seen. */
- if (!put_out_comments)
- *obp++ = '\n';
- ++op->lineno;
- }
- }
- break;
- }
- }
-
- /* Ordinary C comment. Skip it, optionally copying it to output. */
-
- start_line = ip->lineno;
-
- ++ibp; /* Skip the star. */
-
- /* If this cpp is for lint, we peek inside the comments: */
- if (for_lint) {
- U_CHAR *argbp;
- int cmdlen, arglen;
- char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen);
-
- if (lintcmd != NULL) {
- op->bufp = obp;
- check_expand (op, cmdlen + arglen + 14);
- obp = op->bufp;
- /* I believe it is always safe to emit this newline: */
- obp[-1] = '\n';
- bcopy ("#pragma lint ", (char *) obp, 13);
- obp += 13;
- bcopy (lintcmd, (char *) obp, cmdlen);
- obp += cmdlen;
-
- if (arglen != 0) {
- *(obp++) = ' ';
- bcopy (argbp, (char *) obp, arglen);
- obp += arglen;
- }
-
- /* OK, now bring us back to the state we were in before we entered
- this branch. We need #line because the #pragma's newline always
- messes up the line count. */
- op->bufp = obp;
- output_line_directive (ip, op, 0, same_file);
- check_expand (op, limit - ibp + 2);
- obp = op->bufp;
- *(obp++) = '/';
- }
- }
-
- /* Comments are equivalent to spaces.
- Note that we already output the slash; we might not want it.
- For -traditional, a comment is equivalent to nothing. */
- if (! put_out_comments) {
- if (traditional)
- obp--;
- else
- obp[-1] = ' ';
- }
- else
- *obp++ = '*';
-
- {
- U_CHAR *before_bp = ibp;
-
- for (;;) {
- switch (*ibp++) {
- case '*':
- if (ibp[-2] == '/' && warn_comments)
- warning ("`/*' within comment");
- if (*ibp == '\\' && ibp[1] == '\n')
- newline_fix (ibp);
- if (*ibp == '/')
- goto comment_end;
- break;
-
- case '\n':
- ++ip->lineno;
- /* Copy the newline into the output buffer, in order to
- avoid the pain of a #line every time a multiline comment
- is seen. */
- if (!put_out_comments)
- *obp++ = '\n';
- ++op->lineno;
- break;
-
- case 0:
- if (limit < ibp) {
- error_with_line (line_for_error (start_line),
- "unterminated comment");
- goto limit_reached;
- }
- break;
- }
- }
- comment_end:
-
- ibp++;
- if (put_out_comments) {
- bcopy ((char *) before_bp, (char *) obp, ibp - before_bp);
- obp += ibp - before_bp;
- }
- }
- break;
-
- case '$':
- if (! is_idchar['$'])
- goto randomchar;
- if (pedantic)
- pedwarn ("`$' in identifier");
- goto letter;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- /* If digit is not part of identifier, it starts a number,
- which means that following letters are not an identifier.
- "0x5" does not refer to an identifier "x5".
- So copy all alphanumerics that follow without accumulating
- as an identifier. Periods also, for sake of "3.e7". */
-
- if (ident_length == 0) {
- for (;;) {
- while (ibp[0] == '\\' && ibp[1] == '\n') {
- ++ip->lineno;
- ibp += 2;
- }
- c = *ibp++;
- if (!is_idchar[c] && c != '.') {
- --ibp;
- break;
- }
- *obp++ = c;
- /* A sign can be part of a preprocessing number
- if it follows an `e' or `p'. */
- if (c == 'e' || c == 'E' || c == 'p' || c == 'P') {
- while (ibp[0] == '\\' && ibp[1] == '\n') {
- ++ip->lineno;
- ibp += 2;
- }
- if (*ibp == '+' || *ibp == '-') {
- *obp++ = *ibp++;
- /* But traditional C does not let the token go past the sign,
- and C89 does not allow `p'. */
- if (traditional || (c89 && (c == 'p' || c == 'P')))
- break;
- }
- }
- }
- break;
- }
- /* fall through */
-
- case '_':
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
- case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
- case 's': case 't': case 'u': case 'v': case 'w': case 'x':
- case 'y': case 'z':
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
- case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
- case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
- case 'Y': case 'Z':
- letter:
- ident_length++;
- /* Compute step of hash function, to avoid a proc call on every token */
- hash = HASHSTEP (hash, c);
- break;
-
- case '\n':
- if (ip->fname == 0 && *ibp == '-') {
- /* Newline - inhibits expansion of preceding token.
- If expanding a macro arg, we keep the newline -.
- In final output, it is deleted.
- We recognize Newline - in macro bodies and macro args. */
- if (! concatenated) {
- ident_length = 0;
- hash = 0;
- }
- ibp++;
- if (!output_marks) {
- obp--;
- } else {
- /* If expanding a macro arg, keep the newline -. */
- *obp++ = '-';
- }
- break;
- }
-
- /* If reprocessing a macro expansion, newline is a special marker. */
- else if (ip->macro != 0) {
- /* Newline White is a "funny space" to separate tokens that are
- supposed to be separate but without space between.
- Here White means any whitespace character.
- Newline - marks a recursive macro use that is not
- supposed to be expandable. */
-
- if (is_space[*ibp]) {
- /* Newline Space does not prevent expansion of preceding token
- so expand the preceding token and then come back. */
- if (ident_length > 0)
- goto specialchar;
-
- /* If generating final output, newline space makes a space. */
- if (!output_marks) {
- obp[-1] = *ibp++;
- /* And Newline Newline makes a newline, so count it. */
- if (obp[-1] == '\n')
- op->lineno++;
- } else {
- /* If expanding a macro arg, keep the newline space.
- If the arg gets stringified, newline space makes nothing. */
- *obp++ = *ibp++;
- }
- } else abort (); /* Newline followed by something random? */
- break;
- }
-
- /* If there is a pending identifier, handle it and come back here. */
- if (ident_length > 0)
- goto specialchar;
-
- beg_of_line = ibp;
-
- /* Update the line counts and output a #line if necessary. */
- ++ip->lineno;
- ++op->lineno;
- if (ip->lineno != op->lineno) {
- op->bufp = obp;
- output_line_directive (ip, op, 1, same_file);
- check_expand (op, limit - ibp);
- obp = op->bufp;
- }
- break;
-
- /* Come here either after (1) a null character that is part of the input
- or (2) at the end of the input, because there is a null there. */
- case 0:
- if (ibp <= limit)
- /* Our input really contains a null character. */
- goto randomchar;
-
- limit_reached:
- /* At end of a macro-expansion level, pop it and read next level. */
- if (ip->macro != 0) {
- obp--;
- ibp--;
- /* If traditional, and we have an identifier that ends here,
- process it now, so we get the right error for recursion. */
- if (traditional && ident_length
- && ! is_idchar[*instack[indepth - 1].bufp]) {
- redo_char = 1;
- goto randomchar;
- }
- POPMACRO;
- RECACHE;
- break;
- }
-
- /* If we don't have a pending identifier,
- return at end of input. */
- if (ident_length == 0) {
- obp--;
- ibp--;
- op->bufp = obp;
- ip->bufp = ibp;
- goto ending;
- }
-
- /* If we do have a pending identifier, just consider this null
- a special character and arrange to dispatch on it again.
- The second time, IDENT_LENGTH will be zero so we will return. */
-
- /* Fall through */
-
-specialchar:
-
- /* Handle the case of a character such as /, ', " or null
- seen following an identifier. Back over it so that
- after the identifier is processed the special char
- will be dispatched on again. */
-
- ibp--;
- obp--;
- redo_char = 1;
-
- default:
-
-randomchar:
-
- if (ident_length > 0) {
- register HASHNODE *hp;
-
- /* We have just seen an identifier end. If it's a macro, expand it.
-
- IDENT_LENGTH is the length of the identifier
- and HASH is its hash code.
-
- The identifier has already been copied to the output,
- so if it is a macro we must remove it.
-
- If REDO_CHAR is 0, the char that terminated the identifier
- has been skipped in the output and the input.
- OBP-IDENT_LENGTH-1 points to the identifier.
- If the identifier is a macro, we must back over the terminator.
-
- If REDO_CHAR is 1, the terminating char has already been
- backed over. OBP-IDENT_LENGTH points to the identifier. */
-
- if (!pcp_outfile || pcp_inside_if) {
- for (hp = hashtab[MAKE_POS (hash) % HASHSIZE]; hp != NULL;
- hp = hp->next) {
-
- if (hp->length == ident_length) {
- int obufp_before_macroname;
- int op_lineno_before_macroname;
- register int i = ident_length;
- register U_CHAR *p = hp->name;
- register U_CHAR *q = obp - i;
- int disabled;
-
- if (! redo_char)
- q--;
-
- do { /* All this to avoid a strncmp () */
- if (*p++ != *q++)
- goto hashcollision;
- } while (--i);
-
- /* We found a use of a macro name.
- see if the context shows it is a macro call. */
-
- /* Back up over terminating character if not already done. */
- if (! redo_char) {
- ibp--;
- obp--;
- }
-
- /* Save this as a displacement from the beginning of the output
- buffer. We can not save this as a position in the output
- buffer, because it may get realloc'ed by RECACHE. */
- obufp_before_macroname = (obp - op->buf) - ident_length;
- op_lineno_before_macroname = op->lineno;
-
- if (hp->type == T_PCSTRING) {
- pcstring_used (hp); /* Mark the definition of this key
- as needed, ensuring that it
- will be output. */
- break; /* Exit loop, since the key cannot have a
- definition any longer. */
- }
-
- /* Record whether the macro is disabled. */
- disabled = hp->type == T_DISABLED;
-
- /* This looks like a macro ref, but if the macro was disabled,
- just copy its name and put in a marker if requested. */
-
- if (disabled) {
-#if 0
- /* This error check caught useful cases such as
- #define foo(x,y) bar (x (y,0), y)
- foo (foo, baz) */
- if (traditional)
- error ("recursive use of macro `%s'", hp->name);
-#endif
-
- if (output_marks) {
- check_expand (op, limit - ibp + 2);
- *obp++ = '\n';
- *obp++ = '-';
- }
- break;
- }
-
- /* If macro wants an arglist, verify that a '(' follows.
- first skip all whitespace, copying it to the output
- after the macro name. Then, if there is no '(',
- decide this is not a macro call and leave things that way. */
- if ((hp->type == T_MACRO || hp->type == T_DISABLED)
- && hp->value.defn->nargs >= 0)
- {
- U_CHAR *old_ibp = ibp;
- U_CHAR *old_obp = obp;
- int old_iln = ip->lineno;
- int old_oln = op->lineno;
-
- while (1) {
- /* Scan forward over whitespace, copying it to the output. */
- if (ibp == limit && ip->macro != 0) {
- POPMACRO;
- RECACHE;
- old_ibp = ibp;
- old_obp = obp;
- old_iln = ip->lineno;
- old_oln = op->lineno;
- }
- /* A comment: copy it unchanged or discard it. */
- else if (*ibp == '/' && ibp[1] == '*') {
- if (put_out_comments) {
- *obp++ = '/';
- *obp++ = '*';
- } else if (! traditional) {
- *obp++ = ' ';
- }
- ibp += 2;
- while (ibp + 1 != limit
- && !(ibp[0] == '*' && ibp[1] == '/')) {
- /* We need not worry about newline-marks,
- since they are never found in comments. */
- if (*ibp == '\n') {
- /* Newline in a file. Count it. */
- ++ip->lineno;
- ++op->lineno;
- }
- if (put_out_comments)
- *obp++ = *ibp++;
- else
- ibp++;
- }
- ibp += 2;
- if (put_out_comments) {
- *obp++ = '*';
- *obp++ = '/';
- }
- }
- else if (is_space[*ibp]) {
- *obp++ = *ibp++;
- if (ibp[-1] == '\n') {
- if (ip->macro == 0) {
- /* Newline in a file. Count it. */
- ++ip->lineno;
- ++op->lineno;
- } else if (!output_marks) {
- /* A newline mark, and we don't want marks
- in the output. If it is newline-hyphen,
- discard it entirely. Otherwise, it is
- newline-whitechar, so keep the whitechar. */
- obp--;
- if (*ibp == '-')
- ibp++;
- else {
- if (*ibp == '\n')
- ++op->lineno;
- *obp++ = *ibp++;
- }
- } else {
- /* A newline mark; copy both chars to the output. */
- *obp++ = *ibp++;
- }
- }
- }
- else break;
- }
- if (*ibp != '(') {
- /* It isn't a macro call.
- Put back the space that we just skipped. */
- ibp = old_ibp;
- obp = old_obp;
- ip->lineno = old_iln;
- op->lineno = old_oln;
- /* Exit the for loop. */
- break;
- }
- }
-
- /* This is now known to be a macro call.
- Discard the macro name from the output,
- along with any following whitespace just copied,
- but preserve newlines if not outputting marks since this
- is more likely to do the right thing with line numbers. */
- obp = op->buf + obufp_before_macroname;
- if (output_marks)
- op->lineno = op_lineno_before_macroname;
- else {
- int newlines = op->lineno - op_lineno_before_macroname;
- while (0 < newlines--)
- *obp++ = '\n';
- }
-
- /* Prevent accidental token-pasting with a character
- before the macro call. */
- if (!traditional && obp != op->buf) {
- switch (obp[-1]) {
- case '!': case '%': case '&': case '*':
- case '+': case '-': case '.': case '/':
- case ':': case '<': case '=': case '>':
- case '^': case '|':
- /* If we are expanding a macro arg, make a newline marker
- to separate the tokens. If we are making real output,
- a plain space will do. */
- if (output_marks)
- *obp++ = '\n';
- *obp++ = ' ';
- }
- }
-
- /* Expand the macro, reading arguments as needed,
- and push the expansion on the input stack. */
- ip->bufp = ibp;
- op->bufp = obp;
- macroexpand (hp, op);
-
- /* Reexamine input stack, since macroexpand has pushed
- a new level on it. */
- obp = op->bufp;
- RECACHE;
- break;
- }
-hashcollision:
- ;
- } /* End hash-table-search loop */
- }
- ident_length = hash = 0; /* Stop collecting identifier */
- redo_char = 0;
- concatenated = 0;
- } /* End if (ident_length > 0) */
- } /* End switch */
- } /* End per-char loop */
-
- /* Come here to return -- but first give an error message
- if there was an unterminated successful conditional. */
- ending:
- if (if_stack != ip->if_stack)
- {
- char *str;
-
- switch (if_stack->type)
- {
- case T_IF:
- str = "if";
- break;
- case T_IFDEF:
- str = "ifdef";
- break;
- case T_IFNDEF:
- str = "ifndef";
- break;
- case T_ELSE:
- str = "else";
- break;
- case T_ELIF:
- str = "elif";
- break;
- default:
- abort ();
- }
-
- error_with_line (line_for_error (if_stack->lineno),
- "unterminated `#%s' conditional", str);
- }
- if_stack = ip->if_stack;
-}
-
-/*
- * Rescan a string into a temporary buffer and return the result
- * as a FILE_BUF. Note this function returns a struct, not a pointer.
- *
- * OUTPUT_MARKS nonzero means keep Newline markers found in the input
- * and insert such markers when appropriate. See `rescan' for details.
- * OUTPUT_MARKS is 1 for macroexpanding a macro argument separately
- * before substitution; it is 0 for other uses.
- */
-static FILE_BUF
-expand_to_temp_buffer (buf, limit, output_marks, assertions)
- U_CHAR *buf, *limit;
- int output_marks, assertions;
-{
- register FILE_BUF *ip;
- FILE_BUF obuf;
- int length = limit - buf;
- U_CHAR *buf1;
- int odepth = indepth;
- int save_assertions_flag = assertions_flag;
-
- assertions_flag = assertions;
-
- if (length < 0)
- abort ();
-
- /* Set up the input on the input stack. */
-
- buf1 = (U_CHAR *) alloca (length + 1);
- {
- register U_CHAR *p1 = buf;
- register U_CHAR *p2 = buf1;
-
- while (p1 != limit)
- *p2++ = *p1++;
- }
- buf1[length] = 0;
-
- /* Set up to receive the output. */
-
- obuf.length = length * 2 + 100; /* Usually enough. Why be stingy? */
- obuf.bufp = obuf.buf = (U_CHAR *) xmalloc (obuf.length);
- obuf.fname = 0;
- obuf.macro = 0;
- obuf.free_ptr = 0;
-
- CHECK_DEPTH ({return obuf;});
-
- ++indepth;
-
- ip = &instack[indepth];
- ip->fname = 0;
- ip->nominal_fname = 0;
- ip->inc = 0;
- ip->system_header_p = 0;
- ip->macro = 0;
- ip->free_ptr = 0;
- ip->length = length;
- ip->buf = ip->bufp = buf1;
- ip->if_stack = if_stack;
-
- ip->lineno = obuf.lineno = 1;
-
- /* Scan the input, create the output. */
- rescan (&obuf, output_marks);
-
- /* Pop input stack to original state. */
- --indepth;
-
- if (indepth != odepth)
- abort ();
-
- /* Record the output. */
- obuf.length = obuf.bufp - obuf.buf;
-
- assertions_flag = save_assertions_flag;
- return obuf;
-}
-
-/*
- * Process a # directive. Expects IP->bufp to point after the '#', as in
- * `#define foo bar'. Passes to the directive handler
- * (do_define, do_include, etc.): the addresses of the 1st and
- * last chars of the directive (starting immediately after the #
- * keyword), plus op and the keyword table pointer. If the directive
- * contains comments it is copied into a temporary buffer sans comments
- * and the temporary buffer is passed to the directive handler instead.
- * Likewise for backslash-newlines.
- *
- * Returns nonzero if this was a known # directive.
- * Otherwise, returns zero, without advancing the input pointer.
- */
-
-static int
-handle_directive (ip, op)
- FILE_BUF *ip, *op;
-{
- register U_CHAR *bp, *cp;
- register struct directive *kt;
- register int ident_length;
- U_CHAR *resume_p;
-
- /* Nonzero means we must copy the entire directive
- to get rid of comments or backslash-newlines. */
- int copy_directive = 0;
-
- U_CHAR *ident, *after_ident;
-
- bp = ip->bufp;
-
- /* Record where the directive started. do_xifdef needs this. */
- directive_start = bp - 1;
-
- /* Skip whitespace and \-newline. */
- while (1) {
- if (is_hor_space[*bp]) {
- if (*bp != ' ' && *bp != '\t' && pedantic)
- pedwarn ("%s in preprocessing directive", char_name[*bp]);
- bp++;
- } else if (*bp == '/' && (bp[1] == '*'
- || (cplusplus_comments && bp[1] == '/'))) {
- ip->bufp = bp + 2;
- skip_to_end_of_comment (ip, &ip->lineno, 0);
- bp = ip->bufp;
- } else if (*bp == '\\' && bp[1] == '\n') {
- bp += 2; ip->lineno++;
- } else break;
- }
-
- /* Now find end of directive name.
- If we encounter a backslash-newline, exchange it with any following
- symbol-constituents so that we end up with a contiguous name. */
-
- cp = bp;
- while (1) {
- if (is_idchar[*cp])
- cp++;
- else {
- if (*cp == '\\' && cp[1] == '\n')
- name_newline_fix (cp);
- if (is_idchar[*cp])
- cp++;
- else break;
- }
- }
- ident_length = cp - bp;
- ident = bp;
- after_ident = cp;
-
- /* A line of just `#' becomes blank. */
-
- if (ident_length == 0 && *after_ident == '\n') {
- ip->bufp = after_ident;
- return 1;
- }
-
- if (ident_length == 0 || !is_idstart[*ident]) {
- U_CHAR *p = ident;
- while (is_idchar[*p]) {
- if (*p < '0' || *p > '9')
- break;
- p++;
- }
- /* Handle # followed by a line number. */
- if (p != ident && !is_idchar[*p]) {
- static struct directive line_directive_table[] = {
- { 4, do_line, "line", T_LINE},
- };
- if (pedantic)
- pedwarn ("`#' followed by integer");
- after_ident = ident;
- kt = line_directive_table;
- goto old_linenum;
- }
-
- /* Avoid error for `###' and similar cases unless -pedantic. */
- if (p == ident) {
- while (*p == '#' || is_hor_space[*p]) p++;
- if (*p == '\n') {
- if (pedantic && !lang_asm)
- warning ("invalid preprocessing directive");
- return 0;
- }
- }
-
- if (!lang_asm)
- error ("invalid preprocessing directive name");
-
- return 0;
- }
-
- /*
- * Decode the keyword and call the appropriate expansion
- * routine, after moving the input pointer up to the next line.
- */
- for (kt = directive_table; kt->length > 0; kt++) {
- if (kt->length == ident_length && !bcmp (kt->name, ident, ident_length)) {
- register U_CHAR *buf;
- register U_CHAR *limit;
- int unterminated;
- int junk;
- int *already_output;
-
- /* Nonzero means do not delete comments within the directive.
- #define needs this when -traditional. */
- int keep_comments;
-
- old_linenum:
-
- limit = ip->buf + ip->length;
- unterminated = 0;
- already_output = 0;
- keep_comments = traditional && kt->traditional_comments;
- /* #import is defined only in Objective C, or when on the NeXT. */
- if (kt->type == T_IMPORT
- && !(objc || lookup ((U_CHAR *) "__NeXT__", -1, -1)))
- break;
-
- /* Find the end of this directive (first newline not backslashed
- and not in a string or comment).
- Set COPY_DIRECTIVE if the directive must be copied
- (it contains a backslash-newline or a comment). */
-
- buf = bp = after_ident;
- while (bp < limit) {
- register U_CHAR c = *bp++;
- switch (c) {
- case '\\':
- if (bp < limit) {
- if (*bp == '\n') {
- ip->lineno++;
- copy_directive = 1;
- bp++;
- } else if (traditional)
- bp++;
- }
- break;
-
- case '\'':
- case '\"':
- bp = skip_quoted_string (bp - 1, limit, ip->lineno, &ip->lineno, &copy_directive, &unterminated);
- /* Don't bother calling the directive if we already got an error
- message due to unterminated string. Skip everything and pretend
- we called the directive. */
- if (unterminated) {
- if (traditional) {
- /* Traditional preprocessing permits unterminated strings. */
- ip->bufp = bp;
- goto endloop1;
- }
- ip->bufp = bp;
- return 1;
- }
- break;
-
- /* <...> is special for #include. */
- case '<':
- if (!kt->angle_brackets)
- break;
- while (bp < limit && *bp != '>' && *bp != '\n') {
- if (*bp == '\\' && bp[1] == '\n') {
- ip->lineno++;
- copy_directive = 1;
- bp++;
- }
- bp++;
- }
- break;
-
- case '/':
- if (*bp == '\\' && bp[1] == '\n')
- newline_fix (bp);
- if (*bp == '*'
- || (cplusplus_comments && *bp == '/')) {
- U_CHAR *obp = bp - 1;
- ip->bufp = bp + 1;
- skip_to_end_of_comment (ip, &ip->lineno, 0);
- bp = ip->bufp;
- /* No need to copy the directive because of a comment at the end;
- just don't include the comment in the directive. */
- if (!put_out_comments) {
- U_CHAR *p;
- for (p = bp; *p == ' ' || *p == '\t'; p++)
- continue;
- if (*p == '\n') {
- bp = obp;
- goto endloop1;
- }
- }
- /* Don't remove the comments if -traditional. */
- if (! keep_comments)
- copy_directive++;
- }
- break;
-
- case '\f':
- case '\r':
- case '\v':
- if (pedantic)
- pedwarn ("%s in preprocessing directive", char_name[c]);
- break;
-
- case '\n':
- --bp; /* Point to the newline */
- ip->bufp = bp;
- goto endloop1;
- }
- }
- ip->bufp = bp;
-
- endloop1:
- resume_p = ip->bufp;
- /* BP is the end of the directive.
- RESUME_P is the next interesting data after the directive.
- A comment may come between. */
-
- /* If a directive should be copied through, and -E was given,
- pass it through before removing comments. */
- if (!no_output && put_out_comments
- && (dump_macros != dump_definitions) < kt->pass_thru) {
- int len;
-
- /* Output directive name. */
- check_expand (op, kt->length + 2);
- /* Make sure # is at the start of a line */
- if (op->bufp > op->buf && op->bufp[-1] != '\n') {
- op->lineno++;
- *op->bufp++ = '\n';
- }
- *op->bufp++ = '#';
- bcopy (kt->name, op->bufp, kt->length);
- op->bufp += kt->length;
-
- /* Output arguments. */
- len = (bp - buf);
- check_expand (op, len);
- bcopy (buf, (char *) op->bufp, len);
- op->bufp += len;
- /* Take account of any (escaped) newlines just output. */
- while (--len >= 0)
- if (buf[len] == '\n')
- op->lineno++;
-
- already_output = &junk;
- } /* Don't we need a newline or #line? */
-
- if (copy_directive) {
- register U_CHAR *xp = buf;
- /* Need to copy entire directive into temp buffer before dispatching */
-
- cp = (U_CHAR *) alloca (bp - buf + 5); /* room for directive plus
- some slop */
- buf = cp;
-
- /* Copy to the new buffer, deleting comments
- and backslash-newlines (and whitespace surrounding the latter). */
-
- while (xp < bp) {
- register U_CHAR c = *xp++;
- *cp++ = c;
-
- switch (c) {
- case '\n':
- abort (); /* A bare newline should never part of the line. */
- break;
-
- /* <...> is special for #include. */
- case '<':
- if (!kt->angle_brackets)
- break;
- while (xp < bp && c != '>') {
- c = *xp++;
- if (c == '\\' && xp < bp && *xp == '\n')
- xp++;
- else
- *cp++ = c;
- }
- break;
-
- case '\\':
- if (*xp == '\n') {
- xp++;
- cp--;
- if (cp != buf && is_hor_space[cp[-1]]) {
- while (cp - 1 != buf && is_hor_space[cp[-2]])
- cp--;
- SKIP_WHITE_SPACE (xp);
- } else if (is_hor_space[*xp]) {
- *cp++ = *xp++;
- SKIP_WHITE_SPACE (xp);
- }
- } else if (traditional && xp < bp) {
- *cp++ = *xp++;
- }
- break;
-
- case '\'':
- case '\"':
- {
- register U_CHAR *bp1
- = skip_quoted_string (xp - 1, bp, ip->lineno,
- NULL_PTR, NULL_PTR, NULL_PTR);
- while (xp != bp1)
- if (*xp == '\\') {
- if (*++xp != '\n')
- *cp++ = '\\';
- else
- xp++;
- } else
- *cp++ = *xp++;
- }
- break;
-
- case '/':
- if (*xp == '*'
- || (cplusplus_comments && *xp == '/')) {
- ip->bufp = xp + 1;
- /* If we already copied the directive through,
- already_output != 0 prevents outputting comment now. */
- skip_to_end_of_comment (ip, already_output, 0);
- if (keep_comments)
- while (xp != ip->bufp)
- *cp++ = *xp++;
- /* Delete or replace the slash. */
- else if (traditional)
- cp--;
- else
- cp[-1] = ' ';
- xp = ip->bufp;
- }
- }
- }
-
- /* Null-terminate the copy. */
-
- *cp = 0;
- } else
- cp = bp;
-
- ip->bufp = resume_p;
-
- /* Some directives should be written out for cc1 to process,
- just as if they were not defined. And sometimes we're copying
- definitions through. */
-
- if (!no_output && already_output == 0
- && (dump_macros < dump_names) < kt->pass_thru) {
- int len;
-
- /* Output directive name. */
- check_expand (op, kt->length + 1);
- *op->bufp++ = '#';
- bcopy (kt->name, (char *) op->bufp, kt->length);
- op->bufp += kt->length;
-
- if ((dump_macros != dump_definitions) < kt->pass_thru) {
- /* Output arguments. */
- len = (cp - buf);
- check_expand (op, len);
- bcopy (buf, (char *) op->bufp, len);
- op->bufp += len;
- } else if (kt->type == T_DEFINE && dump_macros == dump_names) {
- U_CHAR *xp = buf;
- U_CHAR *yp;
- SKIP_WHITE_SPACE (xp);
- yp = xp;
- while (is_idchar[*xp]) xp++;
- len = (xp - yp);
- check_expand (op, len + 1);
- *op->bufp++ = ' ';
- bcopy (yp, op->bufp, len);
- op->bufp += len;
- }
- } /* Don't we need a newline or #line? */
-
- /* Call the appropriate directive handler. buf now points to
- either the appropriate place in the input buffer, or to
- the temp buffer if it was necessary to make one. cp
- points to the first char after the contents of the (possibly
- copied) directive, in either case. */
- (*kt->func) (buf, cp, op, kt);
- check_expand (op, ip->length - (ip->bufp - ip->buf));
-
- return 1;
- }
- }
-
- /* It is deliberate that we don't warn about undefined directives.
- That is the responsibility of cc1. */
- return 0;
-}
-
-static struct tm *
-timestamp ()
-{
- static struct tm *timebuf;
- if (!timebuf) {
- time_t t = time ((time_t *) 0);
- timebuf = localtime (&t);
- }
- return timebuf;
-}
-
-static char *monthnames[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
- };
-
-/*
- * expand things like __FILE__. Place the expansion into the output
- * buffer *without* rescanning.
- */
-
-static void
-special_symbol (hp, op)
- HASHNODE *hp;
- FILE_BUF *op;
-{
- char *buf;
- int i, len;
- int true_indepth;
- FILE_BUF *ip = NULL;
- struct tm *timebuf;
-
- int paren = 0; /* For special `defined' keyword */
-
- if (pcp_outfile && pcp_inside_if
- && hp->type != T_SPEC_DEFINED && hp->type != T_CONST)
- error ("Predefined macro `%s' used inside `#if' during precompilation",
- hp->name);
-
- for (i = indepth; i >= 0; i--)
- if (instack[i].fname != NULL) {
- ip = &instack[i];
- break;
- }
- if (ip == NULL) {
- error ("cccp error: not in any file?!");
- return; /* the show must go on */
- }
-
- switch (hp->type) {
- case T_FILE:
- case T_BASE_FILE:
- {
- char *string;
- if (hp->type == T_FILE)
- string = ip->nominal_fname;
- else
- string = instack[0].nominal_fname;
-
- if (string)
- {
- buf = (char *) alloca (3 + 4 * strlen (string));
- quote_string (buf, string);
- }
- else
- buf = "\"\"";
-
- break;
- }
-
- case T_INCLUDE_LEVEL:
- true_indepth = 0;
- for (i = indepth; i >= 0; i--)
- if (instack[i].fname != NULL)
- true_indepth++;
-
- buf = (char *) alloca (8); /* Eight bytes ought to be more than enough */
- sprintf (buf, "%d", true_indepth - 1);
- break;
-
- case T_VERSION:
- buf = (char *) alloca (3 + strlen (version_string));
- sprintf (buf, "\"%s\"", version_string);
- break;
-
-#ifndef NO_BUILTIN_SIZE_TYPE
- case T_SIZE_TYPE:
- buf = SIZE_TYPE;
- break;
-#endif
-
-#ifndef NO_BUILTIN_PTRDIFF_TYPE
- case T_PTRDIFF_TYPE:
- buf = PTRDIFF_TYPE;
- break;
-#endif
-
- case T_WCHAR_TYPE:
- buf = wchar_type;
- break;
-
- case T_USER_LABEL_PREFIX_TYPE:
- buf = USER_LABEL_PREFIX;
- break;
-
- case T_REGISTER_PREFIX_TYPE:
- buf = REGISTER_PREFIX;
- break;
-
- case T_IMMEDIATE_PREFIX_TYPE:
- buf = IMMEDIATE_PREFIX;
- break;
-
- case T_CONST:
- buf = hp->value.cpval;
- if (pcp_inside_if && pcp_outfile)
- /* Output a precondition for this macro use */
- fprintf (pcp_outfile, "#define %s %s\n", hp->name, buf);
- break;
-
- case T_SPECLINE:
- buf = (char *) alloca (10);
- sprintf (buf, "%d", ip->lineno);
- break;
-
- case T_DATE:
- case T_TIME:
- buf = (char *) alloca (20);
- timebuf = timestamp ();
- if (hp->type == T_DATE)
- sprintf (buf, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon],
- timebuf->tm_mday, timebuf->tm_year + 1900);
- else
- sprintf (buf, "\"%02d:%02d:%02d\"", timebuf->tm_hour, timebuf->tm_min,
- timebuf->tm_sec);
- break;
-
- case T_SPEC_DEFINED:
- buf = " 0 "; /* Assume symbol is not defined */
- ip = &instack[indepth];
- SKIP_WHITE_SPACE (ip->bufp);
- if (*ip->bufp == '(') {
- paren++;
- ip->bufp++; /* Skip over the paren */
- SKIP_WHITE_SPACE (ip->bufp);
- }
-
- if (!is_idstart[*ip->bufp])
- goto oops;
- if (ip->bufp[0] == 'L' && (ip->bufp[1] == '\'' || ip->bufp[1] == '"'))
- goto oops;
- if ((hp = lookup (ip->bufp, -1, -1))) {
- if (pcp_outfile && pcp_inside_if
- && (hp->type == T_CONST
- || (hp->type == T_MACRO && hp->value.defn->predefined)))
- /* Output a precondition for this macro use. */
- fprintf (pcp_outfile, "#define %s\n", hp->name);
- buf = " 1 ";
- }
- else
- if (pcp_outfile && pcp_inside_if) {
- /* Output a precondition for this macro use */
- U_CHAR *cp = ip->bufp;
- fprintf (pcp_outfile, "#undef ");
- while (is_idchar[*cp]) /* Ick! */
- fputc (*cp++, pcp_outfile);
- putc ('\n', pcp_outfile);
- }
- while (is_idchar[*ip->bufp])
- ++ip->bufp;
- SKIP_WHITE_SPACE (ip->bufp);
- if (paren) {
- if (*ip->bufp != ')')
- goto oops;
- ++ip->bufp;
- }
- break;
-
-oops:
-
- error ("`defined' without an identifier");
- break;
-
- default:
- error ("cccp error: invalid special hash type"); /* time for gdb */
- abort ();
- }
- len = strlen (buf);
- check_expand (op, len);
- bcopy (buf, (char *) op->bufp, len);
- op->bufp += len;
-
- return;
-}
-
-
-/* Routines to handle #directives */
-
-/* Handle #include and #import.
- This function expects to see "fname" or <fname> on the input. */
-
-static int
-do_include (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- U_CHAR *importing = keyword->type == T_IMPORT ? (U_CHAR *) "" : (U_CHAR *) 0;
- int skip_dirs = (keyword->type == T_INCLUDE_NEXT);
- static int import_warning = 0;
- char *fname; /* Dynamically allocated fname buffer */
- char *pcftry;
- char *pcfname;
- char *fbeg, *fend; /* Beginning and end of fname */
- U_CHAR *fin;
-
- struct file_name_list *search_start = include; /* Chain of dirs to search */
- struct file_name_list *dsp; /* First in chain, if #include "..." */
- struct file_name_list *searchptr = 0;
- size_t flen;
-
- int f = -3; /* file number */
- struct include_file *inc = 0;
-
- int retried = 0; /* Have already tried macro
- expanding the include line*/
- int angle_brackets = 0; /* 0 for "...", 1 for <...> */
-#ifdef VMS
- int vaxc_include = 0; /* 1 for token without punctuation */
-#endif
- int pcf = -1;
- char *pcfbuf;
- char *pcfbuflimit;
- int pcfnum;
-
- if (importing && warn_import && !inhibit_warnings
- && !instack[indepth].system_header_p && !import_warning) {
- import_warning = 1;
- warning ("using `#import' is not recommended");
- fprintf (stderr, "The fact that a certain header file need not be processed more than once\n");
- fprintf (stderr, "should be indicated in the header file, not where it is used.\n");
- fprintf (stderr, "The best way to do this is with a conditional of this form:\n\n");
- fprintf (stderr, " #ifndef _FOO_H_INCLUDED\n");
- fprintf (stderr, " #define _FOO_H_INCLUDED\n");
- fprintf (stderr, " ... <real contents of file> ...\n");
- fprintf (stderr, " #endif /* Not _FOO_H_INCLUDED */\n\n");
- fprintf (stderr, "Then users can use `#include' any number of times.\n");
- fprintf (stderr, "GNU C automatically avoids processing the file more than once\n");
- fprintf (stderr, "when it is equipped with such a conditional.\n");
- }
-
-get_filename:
-
- fin = buf;
- SKIP_WHITE_SPACE (fin);
- /* Discard trailing whitespace so we can easily see
- if we have parsed all the significant chars we were given. */
- while (limit != fin && is_hor_space[limit[-1]]) limit--;
- fbeg = fend = (char *) alloca (limit - fin);
-
- switch (*fin++) {
- case '\"':
- {
- FILE_BUF *fp;
- /* Copy the operand text, concatenating the strings. */
- {
- while (fin != limit) {
- while (fin != limit && *fin != '\"')
- *fend++ = *fin++;
- fin++;
- if (fin == limit)
- break;
- /* If not at the end, there had better be another string. */
- /* Skip just horiz space, and don't go past limit. */
- while (fin != limit && is_hor_space[*fin]) fin++;
- if (fin != limit && *fin == '\"')
- fin++;
- else
- goto fail;
- }
- }
-
- /* We have "filename". Figure out directory this source
- file is coming from and put it on the front of the list. */
-
- /* If -I- was specified, don't search current dir, only spec'd ones. */
- if (ignore_srcdir) break;
-
- for (fp = &instack[indepth]; fp >= instack; fp--)
- {
- int n;
- char *nam;
-
- if ((nam = fp->nominal_fname) != NULL) {
- /* Found a named file. Figure out dir of the file,
- and put it in front of the search list. */
- dsp = ((struct file_name_list *)
- alloca (sizeof (struct file_name_list) + strlen (nam)));
- strcpy (dsp->fname, nam);
- simplify_filename (dsp->fname);
- nam = base_name (dsp->fname);
- *nam = 0;
- /* But for efficiency's sake, do not insert the dir
- if it matches the search list's first dir. */
- dsp->next = search_start;
- if (!search_start || strcmp (dsp->fname, search_start->fname)) {
- search_start = dsp;
- n = nam - dsp->fname;
- if (n + INCLUDE_LEN_FUDGE > max_include_len)
- max_include_len = n + INCLUDE_LEN_FUDGE;
- }
- dsp[0].got_name_map = 0;
- break;
- }
- }
- break;
- }
-
- case '<':
- while (fin != limit && *fin != '>')
- *fend++ = *fin++;
- if (*fin == '>' && fin + 1 == limit) {
- angle_brackets = 1;
- /* If -I-, start with the first -I dir after the -I-. */
- search_start = first_bracket_include;
- break;
- }
- goto fail;
-
- default:
-#ifdef VMS
- /*
- * Support '#include xyz' like VAX-C to allow for easy use of all the
- * decwindow include files. It defaults to '#include <xyz.h>' (so the
- * code from case '<' is repeated here) and generates a warning.
- * (Note: macro expansion of `xyz' takes precedence.)
- */
- if (retried && isalpha(*(U_CHAR *) (--fbeg))) {
- while (fin != limit && (!isspace(*fin)))
- *fend++ = *fin++;
- warning ("VAX-C-style include specification found, use '#include <filename.h>' !");
- vaxc_include = 1;
- if (fin == limit) {
- angle_brackets = 1;
- /* If -I-, start with the first -I dir after the -I-. */
- search_start = first_bracket_include;
- break;
- }
- }
-#endif
-
- fail:
- if (retried) {
- error ("`#%s' expects \"FILENAME\" or <FILENAME>", keyword->name);
- return 0;
- } else {
- /* Expand buffer and then remove any newline markers.
- We can't just tell expand_to_temp_buffer to omit the markers,
- since it would put extra spaces in include file names. */
- FILE_BUF trybuf;
- U_CHAR *src;
- trybuf = expand_to_temp_buffer (buf, limit, 1, 0);
- src = trybuf.buf;
- buf = (U_CHAR *) alloca (trybuf.bufp - trybuf.buf + 1);
- limit = buf;
- while (src != trybuf.bufp) {
- switch ((*limit++ = *src++)) {
- case '\n':
- limit--;
- src++;
- break;
-
- case '\'':
- case '\"':
- {
- U_CHAR *src1 = skip_quoted_string (src - 1, trybuf.bufp, 0,
- NULL_PTR, NULL_PTR, NULL_PTR);
- while (src != src1)
- *limit++ = *src++;
- }
- break;
- }
- }
- *limit = 0;
- free (trybuf.buf);
- retried++;
- goto get_filename;
- }
- }
-
- /* For #include_next, skip in the search path
- past the dir in which the containing file was found. */
- if (skip_dirs) {
- FILE_BUF *fp;
- for (fp = &instack[indepth]; fp >= instack; fp--)
- if (fp->fname != NULL) {
- /* fp->dir is null if the containing file was specified
- with an absolute file name. In that case, don't skip anything. */
- if (fp->dir)
- search_start = fp->dir->next;
- break;
- }
- }
-
- *fend = 0;
- flen = simplify_filename (fbeg);
-
- if (flen == 0)
- {
- error ("empty file name in `#%s'", keyword->name);
- return 0;
- }
-
- /* Allocate this permanently, because it gets stored in the definitions
- of macros. */
- fname = xmalloc (max_include_len + flen + 1);
- /* + 1 above for terminating null. */
-
- system_include_depth += angle_brackets;
-
- /* If specified file name is absolute, just open it. */
-
- if (absolute_filename (fbeg)) {
- strcpy (fname, fbeg);
- f = open_include_file (fname, NULL_PTR, importing, &inc);
- } else {
-
- struct bypass_dir {
- struct bypass_dir *next;
- char *fname;
- struct file_name_list *searchptr;
- } **bypass_slot = 0;
-
- /* Search directory path, trying to open the file.
- Copy each filename tried into FNAME. */
-
- for (searchptr = search_start; searchptr; searchptr = searchptr->next) {
-
- if (searchptr == first_bracket_include) {
- /* Go to bypass directory if we know we've seen this file before. */
- static struct bypass_dir *bypass_hashtab[INCLUDE_HASHSIZE];
- struct bypass_dir *p;
- bypass_slot = &bypass_hashtab[hashf ((U_CHAR *) fbeg, flen,
- INCLUDE_HASHSIZE)];
- for (p = *bypass_slot; p; p = p->next)
- if (!strcmp (fbeg, p->fname)) {
- searchptr = p->searchptr;
- bypass_slot = 0;
- break;
- }
- }
-
- strcpy (fname, searchptr->fname);
- strcat (fname, fbeg);
-#ifdef VMS
- /* Change this 1/2 Unix 1/2 VMS file specification into a
- full VMS file specification */
- if (searchptr->fname[0]) {
- /* Fix up the filename */
- hack_vms_include_specification (fname, vaxc_include);
- } else {
- /* This is a normal VMS filespec, so use it unchanged. */
- strcpy (fname, fbeg);
- /* if it's '#include filename', add the missing .h */
- if (vaxc_include && index(fname,'.')==NULL) {
- strcat (fname, ".h");
- }
- }
-#endif /* VMS */
- f = open_include_file (fname, searchptr, importing, &inc);
- if (f != -1) {
- if (bypass_slot && searchptr != first_bracket_include) {
- /* This is the first time we found this include file,
- and we found it after first_bracket_include.
- Record its location so that we can bypass to here next time. */
- struct bypass_dir *p
- = (struct bypass_dir *) xmalloc (sizeof (struct bypass_dir));
- p->next = *bypass_slot;
- p->fname = fname + strlen (searchptr->fname);
- p->searchptr = searchptr;
- *bypass_slot = p;
- }
- break;
- }
-#ifdef VMS
- /* Our VMS hacks can produce invalid filespecs, so don't worry
- about errors other than EACCES. */
- if (errno == EACCES)
- break;
-#else
- if (errno != ENOENT && errno != ENOTDIR)
- break;
-#endif
- }
- }
-
-
- if (f < 0) {
-
- if (f == -2) {
- /* The file was already included. */
-
- /* If generating dependencies and -MG was specified, we assume missing
- files are leaf files, living in the same directory as the source file
- or other similar place; these missing files may be generated from
- other files and may not exist yet (eg: y.tab.h). */
- } else if (print_deps_missing_files
- && (system_include_depth != 0) < print_deps)
- {
- /* If it was requested as a system header file,
- then assume it belongs in the first place to look for such. */
- if (angle_brackets)
- {
- if (search_start) {
- char *p = (char *) alloca (strlen (search_start->fname)
- + strlen (fbeg) + 1);
- strcpy (p, search_start->fname);
- strcat (p, fbeg);
- deps_output (p, ' ');
- }
- }
- else
- {
- /* Otherwise, omit the directory, as if the file existed
- in the directory with the source. */
- deps_output (fbeg, ' ');
- }
- }
- /* If -M was specified, and this header file won't be added to the
- dependency list, then don't count this as an error, because we can
- still produce correct output. Otherwise, we can't produce correct
- output, because there may be dependencies we need inside the missing
- file, and we don't know what directory this missing file exists in. */
- else if (0 < print_deps && print_deps <= (system_include_depth != 0))
- warning ("No include path in which to find %s", fbeg);
- else if (f != -3)
- error_from_errno (fbeg);
- else
- error ("No include path in which to find %s", fbeg);
-
- } else {
-
- /* Actually process the file. */
-
- pcftry = (char *) alloca (strlen (fname) + 30);
- pcfbuf = 0;
- pcfnum = 0;
-
- if (!no_precomp)
- {
- do {
- sprintf (pcftry, "%s%d", fname, pcfnum++);
-
- pcf = open (pcftry, O_RDONLY, 0666);
- if (pcf != -1)
- {
- struct stat s;
-
- if (fstat (pcf, &s) != 0)
- pfatal_with_name (pcftry);
- if (! INO_T_EQ (inc->st.st_ino, s.st_ino)
- || inc->st.st_dev != s.st_dev)
- {
- pcfbuf = check_precompiled (pcf, &s, fname, &pcfbuflimit);
- /* Don't need it any more. */
- close (pcf);
- }
- else
- {
- /* Don't need it at all. */
- close (pcf);
- break;
- }
- }
- } while (pcf != -1 && !pcfbuf);
- }
-
- /* Actually process the file */
- if (pcfbuf) {
- pcfname = xmalloc (strlen (pcftry) + 1);
- strcpy (pcfname, pcftry);
- pcfinclude ((U_CHAR *) pcfbuf, (U_CHAR *) pcfbuflimit,
- (U_CHAR *) fname, op);
- }
- else
- finclude (f, inc, op, is_system_include (fname), searchptr);
- }
-
- system_include_depth -= angle_brackets;
-
- return 0;
-}
-
-/* Return nonzero if the given FILENAME is an absolute pathname which
- designates a file within one of the known "system" include file
- directories. We assume here that if the given FILENAME looks like
- it is the name of a file which resides either directly in a "system"
- include file directory, or within any subdirectory thereof, then the
- given file must be a "system" include file. This function tells us
- if we should suppress pedantic errors/warnings for the given FILENAME.
-
- The value is 2 if the file is a C-language system header file
- for which C++ should (on most systems) assume `extern "C"'. */
-
-static int
-is_system_include (filename)
- register char *filename;
-{
- struct file_name_list *searchptr;
-
- for (searchptr = first_system_include; searchptr;
- searchptr = searchptr->next)
- if (! strncmp (searchptr->fname, filename, strlen (searchptr->fname)))
- return searchptr->c_system_include_path + 1;
- return 0;
-}
-
-/* Yield the non-directory suffix of a file name. */
-
-static char *
-base_name (fname)
- char *fname;
-{
- char *s = fname;
- char *p;
-#if defined (__MSDOS__) || defined (_WIN32)
- if (isalpha (s[0]) && s[1] == ':') s += 2;
-#endif
-#ifdef VMS
- if ((p = rindex (s, ':'))) s = p + 1; /* Skip device. */
- if ((p = rindex (s, ']'))) s = p + 1; /* Skip directory. */
- if ((p = rindex (s, '>'))) s = p + 1; /* Skip alternate (int'n'l) dir. */
- if (s != fname)
- return s;
-#endif
- if ((p = rindex (s, '/'))) s = p + 1;
-#ifdef DIR_SEPARATOR
- if ((p = rindex (s, DIR_SEPARATOR))) s = p + 1;
-#endif
- return s;
-}
-
-/* Yield nonzero if FILENAME is absolute (i.e. not relative). */
-
-static int
-absolute_filename (filename)
- char *filename;
-{
-#if defined (__MSDOS__) || (defined (_WIN32) && !defined (__CYGWIN32__))
- if (isalpha (filename[0]) && filename[1] == ':') filename += 2;
-#endif
-#if defined (__CYGWIN32__)
- /* At present, any path that begins with a drive spec is absolute. */
- if (isalpha (filename[0]) && filename[1] == ':') return 1;
-#endif
- if (filename[0] == '/') return 1;
-#ifdef DIR_SEPARATOR
- if (filename[0] == DIR_SEPARATOR) return 1;
-#endif
- return 0;
-}
-
-/* Remove unnecessary characters from FILENAME in place,
- to avoid unnecessary filename aliasing.
- Return the length of the resulting string.
-
- Do only the simplifications allowed by Posix.
- It is OK to miss simplifications on non-Posix hosts,
- since this merely leads to suboptimial results. */
-
-static size_t
-simplify_filename (filename)
- char *filename;
-{
- register char *from = filename;
- register char *to = filename;
- char *to0;
-
- /* Remove redundant initial /s. */
- if (*from == '/') {
- *to++ = '/';
- if (*++from == '/') {
- if (*++from == '/') {
- /* 3 or more initial /s are equivalent to 1 /. */
- while (*++from == '/')
- continue;
- } else {
- /* On some hosts // differs from /; Posix allows this. */
- static int slashslash_vs_slash;
- if (slashslash_vs_slash == 0) {
- struct stat s1, s2;
- slashslash_vs_slash = ((stat ("/", &s1) == 0 && stat ("//", &s2) == 0
- && INO_T_EQ (s1.st_ino, s2.st_ino)
- && s1.st_dev == s2.st_dev)
- ? 1 : -1);
- }
- if (slashslash_vs_slash < 0)
- *to++ = '/';
- }
- }
- }
- to0 = to;
-
- for (;;) {
- if (from[0] == '.' && from[1] == '/')
- from += 2;
- else {
- /* Copy this component and trailing /, if any. */
- while ((*to++ = *from++) != '/') {
- if (!to[-1]) {
- /* Trim . component at end of nonempty name. */
- to -= filename <= to - 3 && to[-3] == '/' && to[-2] == '.';
-
- /* Trim unnecessary trailing /s. */
- while (to0 < --to && to[-1] == '/')
- continue;
-
- *to = 0;
- return to - filename;
- }
- }
- }
-
- /* Skip /s after a /. */
- while (*from == '/')
- from++;
- }
-}
-
-/* The file_name_map structure holds a mapping of file names for a
- particular directory. This mapping is read from the file named
- FILE_NAME_MAP_FILE in that directory. Such a file can be used to
- map filenames on a file system with severe filename restrictions,
- such as DOS. The format of the file name map file is just a series
- of lines with two tokens on each line. The first token is the name
- to map, and the second token is the actual name to use. */
-
-struct file_name_map
-{
- struct file_name_map *map_next;
- char *map_from;
- char *map_to;
-};
-
-#define FILE_NAME_MAP_FILE "header.gcc"
-
-/* Read a space delimited string of unlimited length from a stdio
- file. */
-
-static char *
-read_filename_string (ch, f)
- int ch;
- FILE *f;
-{
- char *alloc, *set;
- int len;
-
- len = 20;
- set = alloc = xmalloc (len + 1);
- if (! is_space[ch])
- {
- *set++ = ch;
- while ((ch = getc (f)) != EOF && ! is_space[ch])
- {
- if (set - alloc == len)
- {
- len *= 2;
- alloc = xrealloc (alloc, len + 1);
- set = alloc + len / 2;
- }
- *set++ = ch;
- }
- }
- *set = '\0';
- ungetc (ch, f);
- return alloc;
-}
-
-/* Read the file name map file for DIRNAME.
- If DIRNAME is empty, read the map file for the working directory;
- otherwise DIRNAME must end in '/'. */
-
-static struct file_name_map *
-read_name_map (dirname)
- char *dirname;
-{
- /* This structure holds a linked list of file name maps, one per
- directory. */
- struct file_name_map_list
- {
- struct file_name_map_list *map_list_next;
- char *map_list_name;
- struct file_name_map *map_list_map;
- };
- static struct file_name_map_list *map_list;
- register struct file_name_map_list *map_list_ptr;
- char *name;
- FILE *f;
- size_t dirlen;
-
- for (map_list_ptr = map_list; map_list_ptr;
- map_list_ptr = map_list_ptr->map_list_next)
- if (! strcmp (map_list_ptr->map_list_name, dirname))
- return map_list_ptr->map_list_map;
-
- map_list_ptr = ((struct file_name_map_list *)
- xmalloc (sizeof (struct file_name_map_list)));
- map_list_ptr->map_list_name = savestring (dirname);
- map_list_ptr->map_list_map = NULL;
-
- dirlen = strlen (dirname);
- name = (char *) alloca (dirlen + strlen (FILE_NAME_MAP_FILE) + 1);
- strcpy (name, dirname);
- strcat (name, FILE_NAME_MAP_FILE);
- f = fopen (name, "r");
- if (!f)
- map_list_ptr->map_list_map = NULL;
- else
- {
- int ch;
-
- while ((ch = getc (f)) != EOF)
- {
- char *from, *to;
- struct file_name_map *ptr;
- size_t tolen;
-
- if (is_space[ch])
- continue;
- from = read_filename_string (ch, f);
- while ((ch = getc (f)) != EOF && is_hor_space[ch])
- ;
- to = read_filename_string (ch, f);
-
- simplify_filename (from);
- tolen = simplify_filename (to);
-
- ptr = ((struct file_name_map *)
- xmalloc (sizeof (struct file_name_map)));
- ptr->map_from = from;
-
- /* Make the real filename absolute. */
- if (absolute_filename (to))
- ptr->map_to = to;
- else
- {
- ptr->map_to = xmalloc (dirlen + tolen + 1);
- strcpy (ptr->map_to, dirname);
- strcat (ptr->map_to, to);
- free (to);
- }
-
- ptr->map_next = map_list_ptr->map_list_map;
- map_list_ptr->map_list_map = ptr;
-
- while ((ch = getc (f)) != '\n')
- if (ch == EOF)
- break;
- }
- fclose (f);
- }
-
- map_list_ptr->map_list_next = map_list;
- map_list = map_list_ptr;
-
- return map_list_ptr->map_list_map;
-}
-
-/* Try to open include file FILENAME. SEARCHPTR is the directory
- being tried from the include file search path.
- IMPORTING is "" if we are importing, null otherwise.
- Return -2 if found, either a matching name or a matching inode.
- Otherwise, open the file and return a file descriptor if successful
- or -1 if unsuccessful.
- Unless unsuccessful, put a descriptor of the included file into *PINC.
- This function maps filenames on file systems based on information read by
- read_name_map. */
-
-static int
-open_include_file (filename, searchptr, importing, pinc)
- char *filename;
- struct file_name_list *searchptr;
- U_CHAR *importing;
- struct include_file **pinc;
-{
- char *fname = remap_include_file (filename, searchptr);
- int fd = -2;
-
- /* Look up FNAME in include_hashtab. */
- struct include_file **phead = &include_hashtab[hashf ((U_CHAR *) fname,
- strlen (fname),
- INCLUDE_HASHSIZE)];
- struct include_file *inc, *head = *phead;
- for (inc = head; inc; inc = inc->next)
- if (!strcmp (fname, inc->fname))
- break;
-
- if (!inc
- || ! inc->control_macro
- || (inc->control_macro[0] && ! lookup (inc->control_macro, -1, -1))) {
-
- fd = open (fname, O_RDONLY, 0);
-
- if (fd < 0)
- return fd;
-
- if (!inc) {
- /* FNAME was not in include_hashtab; insert a new entry. */
- inc = (struct include_file *) xmalloc (sizeof (struct include_file));
- inc->next = head;
- inc->fname = fname;
- inc->control_macro = 0;
- inc->deps_output = 0;
- if (fstat (fd, &inc->st) != 0)
- pfatal_with_name (fname);
- *phead = inc;
-
- /* Look for another file with the same inode and device. */
- if (lookup_ino_include (inc)
- && inc->control_macro
- && (!inc->control_macro[0] || lookup (inc->control_macro, -1, -1))) {
- close (fd);
- fd = -2;
- }
- }
-
- /* For -M, add this file to the dependencies. */
- if (! inc->deps_output && (system_include_depth != 0) < print_deps) {
- inc->deps_output = 1;
- deps_output (fname, ' ');
- }
-
- /* Handle -H option. */
- if (print_include_names)
- fprintf (stderr, "%*s%s\n", indepth, "", fname);
- }
-
- if (importing)
- inc->control_macro = importing;
-
- *pinc = inc;
- return fd;
-}
-
-/* Return the remapped name of the the include file FILENAME.
- SEARCHPTR is the directory being tried from the include file path. */
-
-static char *
-remap_include_file (filename, searchptr)
- char *filename;
- struct file_name_list *searchptr;
-{
- register struct file_name_map *map;
- register char *from;
-
- if (searchptr)
- {
- if (! searchptr->got_name_map)
- {
- searchptr->name_map = read_name_map (searchptr->fname);
- searchptr->got_name_map = 1;
- }
-
- /* Check the mapping for the directory we are using. */
- from = filename + strlen (searchptr->fname);
- for (map = searchptr->name_map; map; map = map->map_next)
- if (! strcmp (map->map_from, from))
- return map->map_to;
- }
-
- from = base_name (filename);
-
- if (from != filename || !searchptr)
- {
- /* Try to find a mapping file for the particular directory we are
- looking in. Thus #include <sys/types.h> will look up sys/types.h
- in /usr/include/header.gcc and look up types.h in
- /usr/include/sys/header.gcc. */
-
- char *dir = (char *) alloca (from - filename + 1);
- bcopy (filename, dir, from - filename);
- dir[from - filename] = '\0';
-
- for (map = read_name_map (dir); map; map = map->map_next)
- if (! strcmp (map->map_from, from))
- return map->map_to;
- }
-
- return filename;
-}
-
-/* Insert INC into the include file table, hashed by device and inode number.
- If a file with different name but same dev+ino was already in the table,
- return 1 and set INC's control macro to the already-known macro. */
-
-static int
-lookup_ino_include (inc)
- struct include_file *inc;
-{
- int hash = ((unsigned) (inc->st.st_dev + INO_T_HASH (inc->st.st_ino))
- % INCLUDE_HASHSIZE);
- struct include_file *i = include_ino_hashtab[hash];
- inc->next_ino = i;
- include_ino_hashtab[hash] = inc;
-
- for (; i; i = i->next_ino)
- if (INO_T_EQ (inc->st.st_ino, i->st.st_ino)
- && inc->st.st_dev == i->st.st_dev) {
- inc->control_macro = i->control_macro;
- return 1;
- }
-
- return 0;
-}
-
-/* Process file descriptor F, which corresponds to include file INC,
- with output to OP.
- SYSTEM_HEADER_P is 1 if this file resides in any one of the known
- "system" include directories (as decided by the `is_system_include'
- function above).
- DIRPTR is the link in the dir path through which this file was found,
- or 0 if the file name was absolute. */
-
-static void
-finclude (f, inc, op, system_header_p, dirptr)
- int f;
- struct include_file *inc;
- FILE_BUF *op;
- int system_header_p;
- struct file_name_list *dirptr;
-{
- char *fname = inc->fname;
- int i;
- FILE_BUF *fp; /* For input stack frame */
- int missing_newline = 0;
-
- CHECK_DEPTH (return;);
-
- fp = &instack[indepth + 1];
- bzero ((char *) fp, sizeof (FILE_BUF));
- fp->nominal_fname = fp->fname = fname;
- fp->inc = inc;
- fp->length = 0;
- fp->lineno = 1;
- fp->if_stack = if_stack;
- fp->system_header_p = system_header_p;
- fp->dir = dirptr;
-
- if (S_ISREG (inc->st.st_mode)) {
- fp->buf = (U_CHAR *) xmalloc (inc->st.st_size + 2);
- fp->bufp = fp->buf;
-
- /* Read the file contents, knowing that inc->st.st_size is an upper bound
- on the number of bytes we can read. */
- fp->length = safe_read (f, (char *) fp->buf, inc->st.st_size);
- if (fp->length < 0) goto nope;
- }
- else if (S_ISDIR (inc->st.st_mode)) {
- error ("directory `%s' specified in #include", fname);
- close (f);
- return;
- } else {
- /* Cannot count its file size before reading.
- First read the entire file into heap and
- copy them into buffer on stack. */
-
- int bsize = 2000;
- int st_size = 0;
-
- fp->buf = (U_CHAR *) xmalloc (bsize + 2);
-
- for (;;) {
- i = safe_read (f, (char *) fp->buf + st_size, bsize - st_size);
- if (i < 0)
- goto nope; /* error! */
- st_size += i;
- if (st_size != bsize)
- break; /* End of file */
- bsize *= 2;
- fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);
- }
- fp->bufp = fp->buf;
- fp->length = st_size;
- }
-
- if ((fp->length > 0 && fp->buf[fp->length - 1] != '\n')
- /* Backslash-newline at end is not good enough. */
- || (fp->length > 1 && fp->buf[fp->length - 2] == '\\')) {
- fp->buf[fp->length++] = '\n';
- missing_newline = 1;
- }
- fp->buf[fp->length] = '\0';
-
- /* Close descriptor now, so nesting does not use lots of descriptors. */
- close (f);
-
- /* Must do this before calling trigraph_pcp, so that the correct file name
- will be printed in warning messages. */
-
- indepth++;
- input_file_stack_tick++;
-
- if (!no_trigraphs)
- trigraph_pcp (fp);
-
- output_line_directive (fp, op, 0, enter_file);
- rescan (op, 0);
-
- if (missing_newline)
- fp->lineno--;
-
- if (pedantic && missing_newline)
- pedwarn ("file does not end in newline");
-
- indepth--;
- input_file_stack_tick++;
- output_line_directive (&instack[indepth], op, 0, leave_file);
- free (fp->buf);
- return;
-
- nope:
-
- perror_with_name (fname);
- close (f);
- free (fp->buf);
-}
-
-/* Record that inclusion of the include file INC
- should be controlled by the macro named MACRO_NAME.
- This means that trying to include the file again
- will do something if that macro is defined. */
-
-static void
-record_control_macro (inc, macro_name)
- struct include_file *inc;
- U_CHAR *macro_name;
-{
- if (!inc->control_macro || inc->control_macro[0])
- inc->control_macro = macro_name;
-}
-
-/* Load the specified precompiled header into core, and verify its
- preconditions. PCF indicates the file descriptor to read, which must
- be a regular file. *ST is its file status.
- FNAME indicates the file name of the original header.
- *LIMIT will be set to an address one past the end of the file.
- If the preconditions of the file are not satisfied, the buffer is
- freed and we return 0. If the preconditions are satisfied, return
- the address of the buffer following the preconditions. The buffer, in
- this case, should never be freed because various pieces of it will
- be referred to until all precompiled strings are output at the end of
- the run. */
-
-static char *
-check_precompiled (pcf, st, fname, limit)
- int pcf;
- struct stat *st;
- char *fname;
- char **limit;
-{
- int length = 0;
- char *buf;
- char *cp;
-
- if (pcp_outfile)
- return 0;
-
- if (S_ISREG (st->st_mode))
- {
- buf = xmalloc (st->st_size + 2);
- length = safe_read (pcf, buf, st->st_size);
- if (length < 0)
- goto nope;
- }
- else
- abort ();
-
- if (length > 0 && buf[length-1] != '\n')
- buf[length++] = '\n';
- buf[length] = '\0';
-
- *limit = buf + length;
-
- /* File is in core. Check the preconditions. */
- if (!check_preconditions (buf))
- goto nope;
- for (cp = buf; *cp; cp++)
- ;
-#ifdef DEBUG_PCP
- fprintf (stderr, "Using preinclude %s\n", fname);
-#endif
- return cp + 1;
-
- nope:
-#ifdef DEBUG_PCP
- fprintf (stderr, "Cannot use preinclude %s\n", fname);
-#endif
- free (buf);
- return 0;
-}
-
-/* PREC (null terminated) points to the preconditions of a
- precompiled header. These are a series of #define and #undef
- lines which must match the current contents of the hash
- table. */
-
-static int
-check_preconditions (prec)
- char *prec;
-{
- MACRODEF mdef;
- char *lineend;
-
- while (*prec) {
- lineend = index (prec, '\n');
-
- if (*prec++ != '#') {
- error ("Bad format encountered while reading precompiled file");
- return 0;
- }
- if (!strncmp (prec, "define", 6)) {
- HASHNODE *hp;
-
- prec += 6;
- mdef = create_definition ((U_CHAR *) prec, (U_CHAR *) lineend, NULL_PTR);
-
- if (mdef.defn == 0)
- abort ();
-
- if ((hp = lookup (mdef.symnam, mdef.symlen, -1)) == NULL
- || (hp->type != T_MACRO && hp->type != T_CONST)
- || (hp->type == T_MACRO
- && !compare_defs (mdef.defn, hp->value.defn)
- && (mdef.defn->length != 2
- || mdef.defn->expansion[0] != '\n'
- || mdef.defn->expansion[1] != ' ')))
- return 0;
- } else if (!strncmp (prec, "undef", 5)) {
- char *name;
- int len;
-
- prec += 5;
- while (is_hor_space[(U_CHAR) *prec])
- prec++;
- name = prec;
- while (is_idchar[(U_CHAR) *prec])
- prec++;
- len = prec - name;
-
- if (lookup ((U_CHAR *) name, len, -1))
- return 0;
- } else {
- error ("Bad format encountered while reading precompiled file");
- return 0;
- }
- prec = lineend + 1;
- }
- /* They all passed successfully */
- return 1;
-}
-
-/* Process the main body of a precompiled file. BUF points to the
- string section of the file, following the preconditions. LIMIT is one
- character past the end. NAME is the name of the file being read
- in. OP is the main output buffer. */
-
-static void
-pcfinclude (buf, limit, name, op)
- U_CHAR *buf, *limit, *name;
- FILE_BUF *op;
-{
- FILE_BUF tmpbuf;
- int nstrings;
- U_CHAR *cp = buf;
-
- /* First in the file comes 4 bytes indicating the number of strings, */
- /* in network byte order. (MSB first). */
- nstrings = *cp++;
- nstrings = (nstrings << 8) | *cp++;
- nstrings = (nstrings << 8) | *cp++;
- nstrings = (nstrings << 8) | *cp++;
-
- /* Looping over each string... */
- while (nstrings--) {
- U_CHAR *string_start;
- U_CHAR *endofthiskey;
- STRINGDEF *str;
- int nkeys;
-
- /* Each string starts with a STRINGDEF structure (str), followed */
- /* by the text of the string (string_start) */
-
- /* First skip to a longword boundary */
- /* ??? Why a 4-byte boundary? On all machines? */
- /* NOTE: This works correctly even if HOST_WIDE_INT
- is narrower than a pointer.
- Do not try risky measures here to get another type to use!
- Do not include stddef.h--it will fail! */
- if ((HOST_WIDE_INT) cp & 3)
- cp += 4 - ((HOST_WIDE_INT) cp & 3);
-
- /* Now get the string. */
- str = (STRINGDEF *) (GENERIC_PTR) cp;
- string_start = cp += sizeof (STRINGDEF);
-
- for (; *cp; cp++) /* skip the string */
- ;
-
- /* We need to macro expand the string here to ensure that the
- proper definition environment is in place. If it were only
- expanded when we find out it is needed, macros necessary for
- its proper expansion might have had their definitions changed. */
- tmpbuf = expand_to_temp_buffer (string_start, cp++, 0, 0);
- /* Lineno is already set in the precompiled file */
- str->contents = tmpbuf.buf;
- str->len = tmpbuf.length;
- str->writeflag = 0;
- str->filename = name;
- str->output_mark = outbuf.bufp - outbuf.buf;
-
- str->chain = 0;
- *stringlist_tailp = str;
- stringlist_tailp = &str->chain;
-
- /* Next comes a fourbyte number indicating the number of keys
- for this string. */
- nkeys = *cp++;
- nkeys = (nkeys << 8) | *cp++;
- nkeys = (nkeys << 8) | *cp++;
- nkeys = (nkeys << 8) | *cp++;
-
- /* If this number is -1, then the string is mandatory. */
- if (nkeys == -1)
- str->writeflag = 1;
- else
- /* Otherwise, for each key, */
- for (; nkeys--; free (tmpbuf.buf), cp = endofthiskey + 1) {
- KEYDEF *kp = (KEYDEF *) (GENERIC_PTR) cp;
- HASHNODE *hp;
-
- /* It starts with a KEYDEF structure */
- cp += sizeof (KEYDEF);
-
- /* Find the end of the key. At the end of this for loop we
- advance CP to the start of the next key using this variable. */
- endofthiskey = cp + strlen ((char *) cp);
- kp->str = str;
-
- /* Expand the key, and enter it into the hash table. */
- tmpbuf = expand_to_temp_buffer (cp, endofthiskey, 0, 0);
- tmpbuf.bufp = tmpbuf.buf;
-
- while (is_hor_space[*tmpbuf.bufp])
- tmpbuf.bufp++;
- if (!is_idstart[*tmpbuf.bufp]
- || tmpbuf.bufp == tmpbuf.buf + tmpbuf.length) {
- str->writeflag = 1;
- continue;
- }
-
- hp = lookup (tmpbuf.bufp, -1, -1);
- if (hp == NULL) {
- kp->chain = 0;
- install (tmpbuf.bufp, -1, T_PCSTRING, (char *) kp, -1);
- }
- else if (hp->type == T_PCSTRING) {
- kp->chain = hp->value.keydef;
- hp->value.keydef = kp;
- }
- else
- str->writeflag = 1;
- }
- }
- /* This output_line_directive serves to switch us back to the current
- input file in case some of these strings get output (which will
- result in line directives for the header file being output). */
- output_line_directive (&instack[indepth], op, 0, enter_file);
-}
-
-/* Called from rescan when it hits a key for strings. Mark them all
- used and clean up. */
-
-static void
-pcstring_used (hp)
- HASHNODE *hp;
-{
- KEYDEF *kp;
-
- for (kp = hp->value.keydef; kp; kp = kp->chain)
- kp->str->writeflag = 1;
- delete_macro (hp);
-}
-
-/* Write the output, interspersing precompiled strings in their
- appropriate places. */
-
-static void
-write_output ()
-{
- STRINGDEF *next_string;
- U_CHAR *cur_buf_loc;
- int line_directive_len = 80;
- char *line_directive = xmalloc (line_directive_len);
- int len;
-
- /* In each run through the loop, either cur_buf_loc ==
- next_string_loc, in which case we print a series of strings, or
- it is less than next_string_loc, in which case we write some of
- the buffer. */
- cur_buf_loc = outbuf.buf;
- next_string = stringlist;
-
- while (cur_buf_loc < outbuf.bufp || next_string) {
- if (next_string
- && cur_buf_loc - outbuf.buf == next_string->output_mark) {
- if (next_string->writeflag) {
- len = 4 * strlen ((char *) next_string->filename) + 32;
- while (len > line_directive_len)
- line_directive = xrealloc (line_directive,
- line_directive_len *= 2);
- sprintf (line_directive, "\n# %d ", next_string->lineno);
- strcpy (quote_string (line_directive + strlen (line_directive),
- (char *) next_string->filename),
- "\n");
- safe_write (fileno (stdout), line_directive, strlen (line_directive));
- safe_write (fileno (stdout),
- (char *) next_string->contents, next_string->len);
- }
- next_string = next_string->chain;
- }
- else {
- len = (next_string
- ? (next_string->output_mark
- - (cur_buf_loc - outbuf.buf))
- : outbuf.bufp - cur_buf_loc);
-
- safe_write (fileno (stdout), (char *) cur_buf_loc, len);
- cur_buf_loc += len;
- }
- }
- free (line_directive);
-}
-
-/* Pass a directive through to the output file.
- BUF points to the contents of the directive, as a contiguous string.
- LIMIT points to the first character past the end of the directive.
- KEYWORD is the keyword-table entry for the directive. */
-
-static void
-pass_thru_directive (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- register unsigned keyword_length = keyword->length;
-
- check_expand (op, 1 + keyword_length + (limit - buf));
- *op->bufp++ = '#';
- bcopy (keyword->name, (char *) op->bufp, keyword_length);
- op->bufp += keyword_length;
- if (limit != buf && buf[0] != ' ')
- *op->bufp++ = ' ';
- bcopy ((char *) buf, (char *) op->bufp, limit - buf);
- op->bufp += (limit - buf);
-#if 0
- *op->bufp++ = '\n';
- /* Count the line we have just made in the output,
- to get in sync properly. */
- op->lineno++;
-#endif
-}
-
-/* The arglist structure is built by do_define to tell
- collect_definition where the argument names begin. That
- is, for a define like "#define f(x,y,z) foo+x-bar*y", the arglist
- would contain pointers to the strings x, y, and z.
- Collect_definition would then build a DEFINITION node,
- with reflist nodes pointing to the places x, y, and z had
- appeared. So the arglist is just convenience data passed
- between these two routines. It is not kept around after
- the current #define has been processed and entered into the
- hash table. */
-
-struct arglist {
- struct arglist *next;
- U_CHAR *name;
- int length;
- int argno;
- char rest_args;
-};
-
-/* Create a DEFINITION node from a #define directive. Arguments are
- as for do_define. */
-
-static MACRODEF
-create_definition (buf, limit, op)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
-{
- U_CHAR *bp; /* temp ptr into input buffer */
- U_CHAR *symname; /* remember where symbol name starts */
- int sym_length; /* and how long it is */
- int line = instack[indepth].lineno;
- char *file = instack[indepth].nominal_fname;
- int rest_args = 0;
-
- DEFINITION *defn;
- int arglengths = 0; /* Accumulate lengths of arg names
- plus number of args. */
- MACRODEF mdef;
-
- bp = buf;
-
- while (is_hor_space[*bp])
- bp++;
-
- symname = bp; /* remember where it starts */
- sym_length = check_macro_name (bp, "macro");
- bp += sym_length;
-
- /* Lossage will occur if identifiers or control keywords are broken
- across lines using backslash. This is not the right place to take
- care of that. */
-
- if (*bp == '(') {
- struct arglist *arg_ptrs = NULL;
- int argno = 0;
-
- bp++; /* skip '(' */
- SKIP_WHITE_SPACE (bp);
-
- /* Loop over macro argument names. */
- while (*bp != ')') {
- struct arglist *temp;
-
- temp = (struct arglist *) alloca (sizeof (struct arglist));
- temp->name = bp;
- temp->next = arg_ptrs;
- temp->argno = argno++;
- temp->rest_args = 0;
- arg_ptrs = temp;
-
- if (rest_args)
- pedwarn ("another parameter follows `%s'",
- rest_extension);
-
- if (!is_idstart[*bp])
- pedwarn ("invalid character in macro parameter name");
-
- /* Find the end of the arg name. */
- while (is_idchar[*bp]) {
- bp++;
- /* do we have a "special" rest-args extension here? */
- if (limit - bp > REST_EXTENSION_LENGTH &&
- bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) {
- rest_args = 1;
- temp->rest_args = 1;
- break;
- }
- }
- temp->length = bp - temp->name;
- if (rest_args == 1)
- bp += REST_EXTENSION_LENGTH;
- arglengths += temp->length + 2;
- SKIP_WHITE_SPACE (bp);
- if (temp->length == 0 || (*bp != ',' && *bp != ')')) {
- error ("badly punctuated parameter list in `#define'");
- goto nope;
- }
- if (*bp == ',') {
- bp++;
- SKIP_WHITE_SPACE (bp);
- /* A comma at this point can only be followed by an identifier. */
- if (!is_idstart[*bp]) {
- error ("badly punctuated parameter list in `#define'");
- goto nope;
- }
- }
- if (bp >= limit) {
- error ("unterminated parameter list in `#define'");
- goto nope;
- }
- {
- struct arglist *otemp;
-
- for (otemp = temp->next; otemp != NULL; otemp = otemp->next)
- if (temp->length == otemp->length &&
- bcmp (temp->name, otemp->name, temp->length) == 0) {
- error ("duplicate argument name `%.*s' in `#define'",
- temp->length, temp->name);
- goto nope;
- }
- }
- }
-
- ++bp; /* skip paren */
- SKIP_WHITE_SPACE (bp);
- /* now everything from bp before limit is the definition. */
- defn = collect_expansion (bp, limit, argno, arg_ptrs);
- defn->rest_args = rest_args;
-
- /* Now set defn->args.argnames to the result of concatenating
- the argument names in reverse order
- with comma-space between them. */
- defn->args.argnames = (U_CHAR *) xmalloc (arglengths + 1);
- {
- struct arglist *temp;
- int i = 0;
- for (temp = arg_ptrs; temp; temp = temp->next) {
- bcopy (temp->name, &defn->args.argnames[i], temp->length);
- i += temp->length;
- if (temp->next != 0) {
- defn->args.argnames[i++] = ',';
- defn->args.argnames[i++] = ' ';
- }
- }
- defn->args.argnames[i] = 0;
- }
- } else {
- /* Simple expansion or empty definition. */
-
- if (bp < limit)
- {
- if (is_hor_space[*bp]) {
- bp++;
- SKIP_WHITE_SPACE (bp);
- } else if (sym_length) {
- switch (*bp) {
- case '!': case '"': case '#': case '%': case '&': case '\'':
- case ')': case '*': case '+': case ',': case '-': case '.':
- case '/': case ':': case ';': case '<': case '=': case '>':
- case '?': case '[': case '\\': case ']': case '^': case '{':
- case '|': case '}': case '~':
- warning ("missing white space after `#define %.*s'",
- sym_length, symname);
- break;
-
- default:
- pedwarn ("missing white space after `#define %.*s'",
- sym_length, symname);
- break;
- }
- }
- }
- /* Now everything from bp before limit is the definition. */
- defn = collect_expansion (bp, limit, -1, NULL_PTR);
- defn->args.argnames = (U_CHAR *) "";
- }
-
- defn->line = line;
- defn->file = file;
-
- /* OP is null if this is a predefinition */
- defn->predefined = !op;
- mdef.defn = defn;
- mdef.symnam = symname;
- mdef.symlen = sym_length;
-
- return mdef;
-
- nope:
- mdef.defn = 0;
- return mdef;
-}
-
-/* Process a #define directive.
-BUF points to the contents of the #define directive, as a contiguous string.
-LIMIT points to the first character past the end of the definition.
-KEYWORD is the keyword-table entry for #define. */
-
-static int
-do_define (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- int hashcode;
- MACRODEF mdef;
-
- /* If this is a precompiler run (with -pcp) pass thru #define directives. */
- if (pcp_outfile && op)
- pass_thru_directive (buf, limit, op, keyword);
-
- mdef = create_definition (buf, limit, op);
- if (mdef.defn == 0)
- goto nope;
-
- hashcode = hashf (mdef.symnam, mdef.symlen, HASHSIZE);
-
- {
- HASHNODE *hp;
- if ((hp = lookup (mdef.symnam, mdef.symlen, hashcode)) != NULL) {
- int ok = 0;
- /* Redefining a precompiled key is ok. */
- if (hp->type == T_PCSTRING)
- ok = 1;
- /* Redefining a macro is ok if the definitions are the same. */
- else if (hp->type == T_MACRO)
- ok = ! compare_defs (mdef.defn, hp->value.defn);
- /* Redefining a constant is ok with -D. */
- else if (hp->type == T_CONST)
- ok = ! done_initializing;
- /* Print the warning if it's not ok. */
- if (!ok) {
- /* If we are passing through #define and #undef directives, do
- that for this re-definition now. */
- if (debug_output && op)
- pass_thru_directive (buf, limit, op, keyword);
-
- pedwarn ("`%.*s' redefined", mdef.symlen, mdef.symnam);
- if (hp->type == T_MACRO)
- pedwarn_with_file_and_line (hp->value.defn->file, hp->value.defn->line,
- "this is the location of the previous definition");
- }
- /* Replace the old definition. */
- hp->type = T_MACRO;
- hp->value.defn = mdef.defn;
- } else {
- /* If we are passing through #define and #undef directives, do
- that for this new definition now. */
- if (debug_output && op)
- pass_thru_directive (buf, limit, op, keyword);
- install (mdef.symnam, mdef.symlen, T_MACRO,
- (char *) mdef.defn, hashcode);
- }
- }
-
- return 0;
-
-nope:
-
- return 1;
-}
-
-/* Check a purported macro name SYMNAME, and yield its length.
- USAGE is the kind of name this is intended for. */
-
-static int
-check_macro_name (symname, usage)
- U_CHAR *symname;
- char *usage;
-{
- U_CHAR *p;
- int sym_length;
-
- for (p = symname; is_idchar[*p]; p++)
- ;
- sym_length = p - symname;
- if (sym_length == 0
- || (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '"')))
- error ("invalid %s name", usage);
- else if (!is_idstart[*symname]
- || (sym_length == 7 && ! bcmp (symname, "defined", 7)))
- error ("invalid %s name `%.*s'", usage, sym_length, symname);
- return sym_length;
-}
-
-/* Return zero if two DEFINITIONs are isomorphic. */
-
-static int
-compare_defs (d1, d2)
- DEFINITION *d1, *d2;
-{
- register struct reflist *a1, *a2;
- register U_CHAR *p1 = d1->expansion;
- register U_CHAR *p2 = d2->expansion;
- int first = 1;
-
- if (d1->nargs != d2->nargs)
- return 1;
- if (strcmp ((char *)d1->args.argnames, (char *)d2->args.argnames))
- return 1;
- for (a1 = d1->pattern, a2 = d2->pattern; a1 && a2;
- a1 = a1->next, a2 = a2->next) {
- if (!((a1->nchars == a2->nchars && ! bcmp (p1, p2, a1->nchars))
- || ! comp_def_part (first, p1, a1->nchars, p2, a2->nchars, 0))
- || a1->argno != a2->argno
- || a1->stringify != a2->stringify
- || a1->raw_before != a2->raw_before
- || a1->raw_after != a2->raw_after)
- return 1;
- first = 0;
- p1 += a1->nchars;
- p2 += a2->nchars;
- }
- if (a1 != a2)
- return 1;
- if (comp_def_part (first, p1, d1->length - (p1 - d1->expansion),
- p2, d2->length - (p2 - d2->expansion), 1))
- return 1;
- return 0;
-}
-
-/* Return 1 if two parts of two macro definitions are effectively different.
- One of the parts starts at BEG1 and has LEN1 chars;
- the other has LEN2 chars at BEG2.
- Any sequence of whitespace matches any other sequence of whitespace.
- FIRST means these parts are the first of a macro definition;
- so ignore leading whitespace entirely.
- LAST means these parts are the last of a macro definition;
- so ignore trailing whitespace entirely. */
-
-static int
-comp_def_part (first, beg1, len1, beg2, len2, last)
- int first;
- U_CHAR *beg1, *beg2;
- int len1, len2;
- int last;
-{
- register U_CHAR *end1 = beg1 + len1;
- register U_CHAR *end2 = beg2 + len2;
- if (first) {
- while (beg1 != end1 && is_space[*beg1]) beg1++;
- while (beg2 != end2 && is_space[*beg2]) beg2++;
- }
- if (last) {
- while (beg1 != end1 && is_space[end1[-1]]) end1--;
- while (beg2 != end2 && is_space[end2[-1]]) end2--;
- }
- while (beg1 != end1 && beg2 != end2) {
- if (is_space[*beg1] && is_space[*beg2]) {
- while (beg1 != end1 && is_space[*beg1]) beg1++;
- while (beg2 != end2 && is_space[*beg2]) beg2++;
- } else if (*beg1 == *beg2) {
- beg1++; beg2++;
- } else break;
- }
- return (beg1 != end1) || (beg2 != end2);
-}
-
-/* Read a replacement list for a macro with parameters.
- Build the DEFINITION structure.
- Reads characters of text starting at BUF until END.
- ARGLIST specifies the formal parameters to look for
- in the text of the definition; NARGS is the number of args
- in that list, or -1 for a macro name that wants no argument list.
- MACRONAME is the macro name itself (so we can avoid recursive expansion)
- and NAMELEN is its length in characters.
-
-Note that comments, backslash-newlines, and leading white space
-have already been deleted from the argument. */
-
-/* If there is no trailing whitespace, a Newline Space is added at the end
- to prevent concatenation that would be contrary to the standard. */
-
-static DEFINITION *
-collect_expansion (buf, end, nargs, arglist)
- U_CHAR *buf, *end;
- int nargs;
- struct arglist *arglist;
-{
- DEFINITION *defn;
- register U_CHAR *p, *limit, *lastp, *exp_p;
- struct reflist *endpat = NULL;
- /* Pointer to first nonspace after last ## seen. */
- U_CHAR *concat = 0;
- /* Pointer to first nonspace after last single-# seen. */
- U_CHAR *stringify = 0;
- /* How those tokens were spelled. */
- enum sharp_token_type concat_sharp_token_type = NO_SHARP_TOKEN;
- enum sharp_token_type stringify_sharp_token_type = NO_SHARP_TOKEN;
- int maxsize;
- int expected_delimiter = '\0';
-
- /* Scan thru the replacement list, ignoring comments and quoted
- strings, picking up on the macro calls. It does a linear search
- thru the arg list on every potential symbol. Profiling might say
- that something smarter should happen. */
-
- if (end < buf)
- abort ();
-
- /* Find the beginning of the trailing whitespace. */
- limit = end;
- p = buf;
- while (p < limit && is_space[limit[-1]]) limit--;
-
- /* Allocate space for the text in the macro definition.
- Each input char may or may not need 1 byte,
- so this is an upper bound.
- The extra 3 are for invented trailing newline-marker and final null. */
- maxsize = (sizeof (DEFINITION)
- + (limit - p) + 3);
- defn = (DEFINITION *) xcalloc (1, maxsize);
-
- defn->nargs = nargs;
- exp_p = defn->expansion = (U_CHAR *) defn + sizeof (DEFINITION);
- lastp = exp_p;
-
- if (p[0] == '#'
- ? p[1] == '#'
- : p[0] == '%' && p[1] == ':' && p[2] == '%' && p[3] == ':') {
- error ("`##' at start of macro definition");
- p += p[0] == '#' ? 2 : 4;
- }
-
- /* Process the main body of the definition. */
- while (p < limit) {
- int skipped_arg = 0;
- register U_CHAR c = *p++;
-
- *exp_p++ = c;
-
- if (!traditional) {
- switch (c) {
- case '\'':
- case '\"':
- if (expected_delimiter != '\0') {
- if (c == expected_delimiter)
- expected_delimiter = '\0';
- } else
- expected_delimiter = c;
- break;
-
- case '\\':
- if (p < limit && expected_delimiter) {
- /* In a string, backslash goes through
- and makes next char ordinary. */
- *exp_p++ = *p++;
- }
- break;
-
- case '%':
- if (!expected_delimiter && *p == ':') {
- /* %: is not a digraph if preceded by an odd number of '<'s. */
- U_CHAR *p0 = p - 1;
- while (buf < p0 && p0[-1] == '<')
- p0--;
- if ((p - p0) & 1) {
- /* Treat %:%: as ## and %: as #. */
- if (p[1] == '%' && p[2] == ':') {
- p += 2;
- goto sharp_sharp_token;
- }
- if (nargs >= 0) {
- p++;
- goto sharp_token;
- }
- }
- }
- break;
-
- case '#':
- /* # is ordinary inside a string. */
- if (expected_delimiter)
- break;
- if (*p == '#') {
- sharp_sharp_token:
- /* ##: concatenate preceding and following tokens. */
- /* Take out the first #, discard preceding whitespace. */
- exp_p--;
- while (exp_p > lastp && is_hor_space[exp_p[-1]])
- --exp_p;
- /* Skip the second #. */
- p++;
- concat_sharp_token_type = c;
- if (is_hor_space[*p]) {
- concat_sharp_token_type = c + 1;
- p++;
- SKIP_WHITE_SPACE (p);
- }
- concat = p;
- if (p == limit)
- error ("`##' at end of macro definition");
- } else if (nargs >= 0) {
- /* Single #: stringify following argument ref.
- Don't leave the # in the expansion. */
- sharp_token:
- exp_p--;
- stringify_sharp_token_type = c;
- if (is_hor_space[*p]) {
- stringify_sharp_token_type = c + 1;
- p++;
- SKIP_WHITE_SPACE (p);
- }
- if (! is_idstart[*p] || nargs == 0
- || (*p == 'L' && (p[1] == '\'' || p[1] == '"')))
- error ("`#' operator is not followed by a macro argument name");
- else
- stringify = p;
- }
- break;
- }
- } else {
- /* In -traditional mode, recognize arguments inside strings and
- and character constants, and ignore special properties of #.
- Arguments inside strings are considered "stringified", but no
- extra quote marks are supplied. */
- switch (c) {
- case '\'':
- case '\"':
- if (expected_delimiter != '\0') {
- if (c == expected_delimiter)
- expected_delimiter = '\0';
- } else
- expected_delimiter = c;
- break;
-
- case '\\':
- /* Backslash quotes delimiters and itself, but not macro args. */
- if (expected_delimiter != 0 && p < limit
- && (*p == expected_delimiter || *p == '\\')) {
- *exp_p++ = *p++;
- continue;
- }
- break;
-
- case '/':
- if (expected_delimiter != '\0') /* No comments inside strings. */
- break;
- if (*p == '*') {
- /* If we find a comment that wasn't removed by handle_directive,
- this must be -traditional. So replace the comment with
- nothing at all. */
- exp_p--;
- while (++p < limit) {
- if (p[0] == '*' && p[1] == '/') {
- p += 2;
- break;
- }
- }
-#if 0
- /* Mark this as a concatenation-point, as if it had been ##. */
- concat = p;
-#endif
- }
- break;
- }
- }
-
- /* Handle the start of a symbol. */
- if (is_idchar[c] && nargs > 0) {
- U_CHAR *id_beg = p - 1;
- int id_len;
-
- --exp_p;
- while (p != limit && is_idchar[*p]) p++;
- id_len = p - id_beg;
-
- if (is_idstart[c]
- && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '"'))) {
- register struct arglist *arg;
-
- for (arg = arglist; arg != NULL; arg = arg->next) {
- struct reflist *tpat;
-
- if (arg->name[0] == c
- && arg->length == id_len
- && bcmp (arg->name, id_beg, id_len) == 0) {
- enum sharp_token_type tpat_stringify;
- if (expected_delimiter) {
- if (warn_stringify) {
- if (traditional) {
- warning ("macro argument `%.*s' is stringified.",
- id_len, arg->name);
- } else {
- warning ("macro arg `%.*s' would be stringified with -traditional.",
- id_len, arg->name);
- }
- }
- /* If ANSI, don't actually substitute inside a string. */
- if (!traditional)
- break;
- tpat_stringify = SHARP_TOKEN;
- } else {
- tpat_stringify
- = (stringify == id_beg
- ? stringify_sharp_token_type : NO_SHARP_TOKEN);
- }
- /* make a pat node for this arg and append it to the end of
- the pat list */
- tpat = (struct reflist *) xmalloc (sizeof (struct reflist));
- tpat->next = NULL;
- tpat->raw_before
- = concat == id_beg ? concat_sharp_token_type : NO_SHARP_TOKEN;
- tpat->raw_after = NO_SHARP_TOKEN;
- tpat->rest_args = arg->rest_args;
- tpat->stringify = tpat_stringify;
-
- if (endpat == NULL)
- defn->pattern = tpat;
- else
- endpat->next = tpat;
- endpat = tpat;
-
- tpat->argno = arg->argno;
- tpat->nchars = exp_p - lastp;
- {
- register U_CHAR *p1 = p;
- SKIP_WHITE_SPACE (p1);
- if (p1[0]=='#'
- ? p1[1]=='#'
- : p1[0]=='%' && p1[1]==':' && p1[2]=='%' && p1[3]==':')
- tpat->raw_after = p1[0] + (p != p1);
- }
- lastp = exp_p; /* place to start copying from next time */
- skipped_arg = 1;
- break;
- }
- }
- }
-
- /* If this was not a macro arg, copy it into the expansion. */
- if (! skipped_arg) {
- register U_CHAR *lim1 = p;
- p = id_beg;
- while (p != lim1)
- *exp_p++ = *p++;
- if (stringify == id_beg)
- error ("`#' operator should be followed by a macro argument name");
- }
- }
- }
-
- if (!traditional && expected_delimiter == 0) {
- /* If ANSI, put in a newline-space marker to prevent token pasting.
- But not if "inside a string" (which in ANSI mode happens only for
- -D option). */
- *exp_p++ = '\n';
- *exp_p++ = ' ';
- }
-
- *exp_p = '\0';
-
- defn->length = exp_p - defn->expansion;
-
- /* Crash now if we overrun the allocated size. */
- if (defn->length + 1 > maxsize)
- abort ();
-
-#if 0
-/* This isn't worth the time it takes. */
- /* give back excess storage */
- defn->expansion = (U_CHAR *) xrealloc (defn->expansion, defn->length + 1);
-#endif
-
- return defn;
-}
-
-static int
-do_assert (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- U_CHAR *bp; /* temp ptr into input buffer */
- U_CHAR *symname; /* remember where symbol name starts */
- int sym_length; /* and how long it is */
- struct arglist *tokens = NULL;
-
- if (pedantic && done_initializing && !instack[indepth].system_header_p)
- pedwarn ("ANSI C does not allow `#assert'");
-
- bp = buf;
-
- while (is_hor_space[*bp])
- bp++;
-
- symname = bp; /* remember where it starts */
- sym_length = check_macro_name (bp, "assertion");
- bp += sym_length;
- /* #define doesn't do this, but we should. */
- SKIP_WHITE_SPACE (bp);
-
- /* Lossage will occur if identifiers or control tokens are broken
- across lines using backslash. This is not the right place to take
- care of that. */
-
- if (*bp != '(') {
- error ("missing token-sequence in `#assert'");
- return 1;
- }
-
- {
- int error_flag = 0;
-
- bp++; /* skip '(' */
- SKIP_WHITE_SPACE (bp);
-
- tokens = read_token_list (&bp, limit, &error_flag);
- if (error_flag)
- return 1;
- if (tokens == 0) {
- error ("empty token-sequence in `#assert'");
- return 1;
- }
-
- ++bp; /* skip paren */
- SKIP_WHITE_SPACE (bp);
- }
-
- /* If this name isn't already an assertion name, make it one.
- Error if it was already in use in some other way. */
-
- {
- ASSERTION_HASHNODE *hp;
- int hashcode = hashf (symname, sym_length, ASSERTION_HASHSIZE);
- struct tokenlist_list *value
- = (struct tokenlist_list *) xmalloc (sizeof (struct tokenlist_list));
-
- hp = assertion_lookup (symname, sym_length, hashcode);
- if (hp == NULL) {
- if (sym_length == 7 && ! bcmp (symname, "defined", 7))
- error ("`defined' redefined as assertion");
- hp = assertion_install (symname, sym_length, hashcode);
- }
-
- /* Add the spec'd token-sequence to the list of such. */
- value->tokens = tokens;
- value->next = hp->value;
- hp->value = value;
- }
-
- return 0;
-}
-
-static int
-do_unassert (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- U_CHAR *bp; /* temp ptr into input buffer */
- U_CHAR *symname; /* remember where symbol name starts */
- int sym_length; /* and how long it is */
-
- struct arglist *tokens = NULL;
- int tokens_specified = 0;
-
- if (pedantic && done_initializing && !instack[indepth].system_header_p)
- pedwarn ("ANSI C does not allow `#unassert'");
-
- bp = buf;
-
- while (is_hor_space[*bp])
- bp++;
-
- symname = bp; /* remember where it starts */
- sym_length = check_macro_name (bp, "assertion");
- bp += sym_length;
- /* #define doesn't do this, but we should. */
- SKIP_WHITE_SPACE (bp);
-
- /* Lossage will occur if identifiers or control tokens are broken
- across lines using backslash. This is not the right place to take
- care of that. */
-
- if (*bp == '(') {
- int error_flag = 0;
-
- bp++; /* skip '(' */
- SKIP_WHITE_SPACE (bp);
-
- tokens = read_token_list (&bp, limit, &error_flag);
- if (error_flag)
- return 1;
- if (tokens == 0) {
- error ("empty token list in `#unassert'");
- return 1;
- }
-
- tokens_specified = 1;
-
- ++bp; /* skip paren */
- SKIP_WHITE_SPACE (bp);
- }
-
- {
- ASSERTION_HASHNODE *hp;
- int hashcode = hashf (symname, sym_length, ASSERTION_HASHSIZE);
- struct tokenlist_list *tail, *prev;
-
- hp = assertion_lookup (symname, sym_length, hashcode);
- if (hp == NULL)
- return 1;
-
- /* If no token list was specified, then eliminate this assertion
- entirely. */
- if (! tokens_specified) {
- struct tokenlist_list *next;
- for (tail = hp->value; tail; tail = next) {
- next = tail->next;
- free_token_list (tail->tokens);
- free (tail);
- }
- delete_assertion (hp);
- } else {
- /* If a list of tokens was given, then delete any matching list. */
-
- tail = hp->value;
- prev = 0;
- while (tail) {
- struct tokenlist_list *next = tail->next;
- if (compare_token_lists (tail->tokens, tokens)) {
- if (prev)
- prev->next = next;
- else
- hp->value = tail->next;
- free_token_list (tail->tokens);
- free (tail);
- } else {
- prev = tail;
- }
- tail = next;
- }
- }
- }
-
- return 0;
-}
-
-/* Test whether there is an assertion named NAME
- and optionally whether it has an asserted token list TOKENS.
- NAME is not null terminated; its length is SYM_LENGTH.
- If TOKENS_SPECIFIED is 0, then don't check for any token list. */
-
-int
-check_assertion (name, sym_length, tokens_specified, tokens)
- U_CHAR *name;
- int sym_length;
- int tokens_specified;
- struct arglist *tokens;
-{
- ASSERTION_HASHNODE *hp;
- int hashcode = hashf (name, sym_length, ASSERTION_HASHSIZE);
-
- if (pedantic && !instack[indepth].system_header_p)
- pedwarn ("ANSI C does not allow testing assertions");
-
- hp = assertion_lookup (name, sym_length, hashcode);
- if (hp == NULL)
- /* It is not an assertion; just return false. */
- return 0;
-
- /* If no token list was specified, then value is 1. */
- if (! tokens_specified)
- return 1;
-
- {
- struct tokenlist_list *tail;
-
- tail = hp->value;
-
- /* If a list of tokens was given,
- then succeed if the assertion records a matching list. */
-
- while (tail) {
- if (compare_token_lists (tail->tokens, tokens))
- return 1;
- tail = tail->next;
- }
-
- /* Fail if the assertion has no matching list. */
- return 0;
- }
-}
-
-/* Compare two lists of tokens for equality including order of tokens. */
-
-static int
-compare_token_lists (l1, l2)
- struct arglist *l1, *l2;
-{
- while (l1 && l2) {
- if (l1->length != l2->length)
- return 0;
- if (bcmp (l1->name, l2->name, l1->length))
- return 0;
- l1 = l1->next;
- l2 = l2->next;
- }
-
- /* Succeed if both lists end at the same time. */
- return l1 == l2;
-}
-
-/* Read a space-separated list of tokens ending in a close parenthesis.
- Return a list of strings, in the order they were written.
- (In case of error, return 0 and store -1 in *ERROR_FLAG.)
- Parse the text starting at *BPP, and update *BPP.
- Don't parse beyond LIMIT. */
-
-static struct arglist *
-read_token_list (bpp, limit, error_flag)
- U_CHAR **bpp;
- U_CHAR *limit;
- int *error_flag;
-{
- struct arglist *token_ptrs = 0;
- U_CHAR *bp = *bpp;
- int depth = 1;
-
- *error_flag = 0;
-
- /* Loop over the assertion value tokens. */
- while (depth > 0) {
- struct arglist *temp;
- int eofp = 0;
- U_CHAR *beg = bp;
-
- /* Find the end of the token. */
- if (*bp == '(') {
- bp++;
- depth++;
- } else if (*bp == ')') {
- depth--;
- if (depth == 0)
- break;
- bp++;
- } else if (*bp == '"' || *bp == '\'')
- bp = skip_quoted_string (bp, limit, 0, NULL_PTR, NULL_PTR, &eofp);
- else
- while (! is_hor_space[*bp] && *bp != '(' && *bp != ')'
- && *bp != '"' && *bp != '\'' && bp != limit)
- bp++;
-
- temp = (struct arglist *) xmalloc (sizeof (struct arglist));
- temp->name = (U_CHAR *) xmalloc (bp - beg + 1);
- bcopy ((char *) beg, (char *) temp->name, bp - beg);
- temp->name[bp - beg] = 0;
- temp->next = token_ptrs;
- token_ptrs = temp;
- temp->length = bp - beg;
-
- SKIP_WHITE_SPACE (bp);
-
- if (bp >= limit) {
- error ("unterminated token sequence in `#assert' or `#unassert'");
- *error_flag = -1;
- return 0;
- }
- }
- *bpp = bp;
-
- /* We accumulated the names in reverse order.
- Now reverse them to get the proper order. */
- {
- register struct arglist *prev = 0, *this, *next;
- for (this = token_ptrs; this; this = next) {
- next = this->next;
- this->next = prev;
- prev = this;
- }
- return prev;
- }
-}
-
-static void
-free_token_list (tokens)
- struct arglist *tokens;
-{
- while (tokens) {
- struct arglist *next = tokens->next;
- free (tokens->name);
- free (tokens);
- tokens = next;
- }
-}
-
-/* Install a name in the assertion hash table.
-
- If LEN is >= 0, it is the length of the name.
- Otherwise, compute the length by scanning the entire name.
-
- If HASH is >= 0, it is the precomputed hash code.
- Otherwise, compute the hash code. */
-
-static ASSERTION_HASHNODE *
-assertion_install (name, len, hash)
- U_CHAR *name;
- int len;
- int hash;
-{
- register ASSERTION_HASHNODE *hp;
- register int i, bucket;
- register U_CHAR *p, *q;
-
- i = sizeof (ASSERTION_HASHNODE) + len + 1;
- hp = (ASSERTION_HASHNODE *) xmalloc (i);
- bucket = hash;
- hp->bucket_hdr = &assertion_hashtab[bucket];
- hp->next = assertion_hashtab[bucket];
- assertion_hashtab[bucket] = hp;
- hp->prev = NULL;
- if (hp->next != NULL)
- hp->next->prev = hp;
- hp->length = len;
- hp->value = 0;
- hp->name = ((U_CHAR *) hp) + sizeof (ASSERTION_HASHNODE);
- p = hp->name;
- q = name;
- for (i = 0; i < len; i++)
- *p++ = *q++;
- hp->name[len] = 0;
- return hp;
-}
-
-/* Find the most recent hash node for name name (ending with first
- non-identifier char) installed by install
-
- If LEN is >= 0, it is the length of the name.
- Otherwise, compute the length by scanning the entire name.
-
- If HASH is >= 0, it is the precomputed hash code.
- Otherwise, compute the hash code. */
-
-static ASSERTION_HASHNODE *
-assertion_lookup (name, len, hash)
- U_CHAR *name;
- int len;
- int hash;
-{
- register ASSERTION_HASHNODE *bucket;
-
- bucket = assertion_hashtab[hash];
- while (bucket) {
- if (bucket->length == len && bcmp (bucket->name, name, len) == 0)
- return bucket;
- bucket = bucket->next;
- }
- return NULL;
-}
-
-static void
-delete_assertion (hp)
- ASSERTION_HASHNODE *hp;
-{
-
- if (hp->prev != NULL)
- hp->prev->next = hp->next;
- if (hp->next != NULL)
- hp->next->prev = hp->prev;
-
- /* Make sure that the bucket chain header that the deleted guy was
- on points to the right thing afterwards. */
- if (hp == *hp->bucket_hdr)
- *hp->bucket_hdr = hp->next;
-
- free (hp);
-}
-
-/*
- * interpret #line directive. Remembers previously seen fnames
- * in its very own hash table.
- */
-#define FNAME_HASHSIZE 37
-
-static int
-do_line (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- register U_CHAR *bp;
- FILE_BUF *ip = &instack[indepth];
- FILE_BUF tem;
- int new_lineno;
- enum file_change_code file_change = same_file;
-
- /* Expand any macros. */
- tem = expand_to_temp_buffer (buf, limit, 0, 0);
-
- /* Point to macroexpanded line, which is null-terminated now. */
- bp = tem.buf;
- SKIP_WHITE_SPACE (bp);
-
- if (!isdigit (*bp)) {
- error ("invalid format `#line' directive");
- return 0;
- }
-
- /* The Newline at the end of this line remains to be processed.
- To put the next line at the specified line number,
- we must store a line number now that is one less. */
- new_lineno = atoi ((char *) bp) - 1;
-
- /* NEW_LINENO is one less than the actual line number here. */
- if (pedantic && new_lineno < 0)
- pedwarn ("line number out of range in `#line' directive");
-
- /* skip over the line number. */
- while (isdigit (*bp))
- bp++;
-
-#if 0 /* #line 10"foo.c" is supposed to be allowed. */
- if (*bp && !is_space[*bp]) {
- error ("invalid format `#line' directive");
- return;
- }
-#endif
-
- SKIP_WHITE_SPACE (bp);
-
- if (*bp == '\"') {
- static HASHNODE *fname_table[FNAME_HASHSIZE];
- HASHNODE *hp, **hash_bucket;
- U_CHAR *fname, *p;
- int fname_length;
-
- fname = ++bp;
-
- /* Turn the file name, which is a character string literal,
- into a null-terminated string. Do this in place. */
- p = bp;
- for (;;)
- switch ((*p++ = *bp++)) {
- case '\0':
- error ("invalid format `#line' directive");
- return 0;
-
- case '\\':
- {
- char *bpc = (char *) bp;
- HOST_WIDE_INT c = parse_escape (&bpc, (HOST_WIDE_INT) (U_CHAR) (-1));
- bp = (U_CHAR *) bpc;
- if (c < 0)
- p--;
- else
- p[-1] = c;
- }
- break;
-
- case '\"':
- p[-1] = 0;
- goto fname_done;
- }
- fname_done:
- fname_length = p - fname;
-
- SKIP_WHITE_SPACE (bp);
- if (*bp) {
- if (pedantic)
- pedwarn ("garbage at end of `#line' directive");
- if (*bp == '1')
- file_change = enter_file;
- else if (*bp == '2')
- file_change = leave_file;
- else if (*bp == '3')
- ip->system_header_p = 1;
- else if (*bp == '4')
- ip->system_header_p = 2;
- else {
- error ("invalid format `#line' directive");
- return 0;
- }
-
- bp++;
- SKIP_WHITE_SPACE (bp);
- if (*bp == '3') {
- ip->system_header_p = 1;
- bp++;
- SKIP_WHITE_SPACE (bp);
- }
- if (*bp == '4') {
- ip->system_header_p = 2;
- bp++;
- SKIP_WHITE_SPACE (bp);
- }
- if (*bp) {
- error ("invalid format `#line' directive");
- return 0;
- }
- }
-
- hash_bucket =
- &fname_table[hashf (fname, fname_length, FNAME_HASHSIZE)];
- for (hp = *hash_bucket; hp != NULL; hp = hp->next)
- if (hp->length == fname_length &&
- bcmp (hp->value.cpval, fname, fname_length) == 0) {
- ip->nominal_fname = hp->value.cpval;
- break;
- }
- if (hp == 0) {
- /* Didn't find it; cons up a new one. */
- hp = (HASHNODE *) xcalloc (1, sizeof (HASHNODE) + fname_length + 1);
- hp->next = *hash_bucket;
- *hash_bucket = hp;
-
- hp->length = fname_length;
- ip->nominal_fname = hp->value.cpval = ((char *) hp) + sizeof (HASHNODE);
- bcopy (fname, hp->value.cpval, fname_length);
- }
- } else if (*bp) {
- error ("invalid format `#line' directive");
- return 0;
- }
-
- ip->lineno = new_lineno;
- output_line_directive (ip, op, 0, file_change);
- check_expand (op, ip->length - (ip->bufp - ip->buf));
- return 0;
-}
-
-/* Remove the definition of a symbol from the symbol table.
- according to un*x /lib/cpp, it is not an error to undef
- something that has no definitions, so it isn't one here either. */
-
-static int
-do_undef (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- int sym_length;
- HASHNODE *hp;
- U_CHAR *orig_buf = buf;
-
- /* If this is a precompiler run (with -pcp) pass thru #undef directives. */
- if (pcp_outfile && op)
- pass_thru_directive (buf, limit, op, keyword);
-
- SKIP_WHITE_SPACE (buf);
- sym_length = check_macro_name (buf, "macro");
-
- while ((hp = lookup (buf, sym_length, -1)) != NULL) {
- /* If we are generating additional info for debugging (with -g) we
- need to pass through all effective #undef directives. */
- if (debug_output && op)
- pass_thru_directive (orig_buf, limit, op, keyword);
- if (hp->type != T_MACRO)
- warning ("undefining `%s'", hp->name);
- delete_macro (hp);
- }
-
- if (pedantic) {
- buf += sym_length;
- SKIP_WHITE_SPACE (buf);
- if (buf != limit)
- pedwarn ("garbage after `#undef' directive");
- }
- return 0;
-}
-
-/* Report an error detected by the program we are processing.
- Use the text of the line in the error message.
- (We use error because it prints the filename & line#.) */
-
-static int
-do_error (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- int length = limit - buf;
- U_CHAR *copy = (U_CHAR *) alloca (length + 1);
- bcopy ((char *) buf, (char *) copy, length);
- copy[length] = 0;
- SKIP_WHITE_SPACE (copy);
- error ("#error %s", copy);
- return 0;
-}
-
-/* Report a warning detected by the program we are processing.
- Use the text of the line in the warning message, then continue.
- (We use error because it prints the filename & line#.) */
-
-static int
-do_warning (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- int length = limit - buf;
- U_CHAR *copy = (U_CHAR *) alloca (length + 1);
- bcopy ((char *) buf, (char *) copy, length);
- copy[length] = 0;
- SKIP_WHITE_SPACE (copy);
- warning ("#warning %s", copy);
- return 0;
-}
-
-/* Remember the name of the current file being read from so that we can
- avoid ever including it again. */
-
-static void
-do_once ()
-{
- int i;
-
- for (i = indepth; i >= 0; i--)
- if (instack[i].inc) {
- record_control_macro (instack[i].inc, (U_CHAR *) "");
- break;
- }
-}
-
-/* #ident has already been copied to the output file, so just ignore it. */
-
-static int
-do_ident (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- FILE_BUF trybuf;
- int len;
-
- /* Allow #ident in system headers, since that's not user's fault. */
- if (pedantic && !instack[indepth].system_header_p)
- pedwarn ("ANSI C does not allow `#ident'");
-
- trybuf = expand_to_temp_buffer (buf, limit, 0, 0);
- buf = (U_CHAR *) alloca (trybuf.bufp - trybuf.buf + 1);
- bcopy ((char *) trybuf.buf, (char *) buf, trybuf.bufp - trybuf.buf);
- limit = buf + (trybuf.bufp - trybuf.buf);
- len = (limit - buf);
- free (trybuf.buf);
-
- /* Output directive name. */
- check_expand (op, 7);
- bcopy ("#ident ", (char *) op->bufp, 7);
- op->bufp += 7;
-
- /* Output the expanded argument line. */
- check_expand (op, len);
- bcopy ((char *) buf, (char *) op->bufp, len);
- op->bufp += len;
-
- return 0;
-}
-
-/* #pragma and its argument line have already been copied to the output file.
- Just check for some recognized pragmas that need validation here. */
-
-static int
-do_pragma (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- SKIP_WHITE_SPACE (buf);
- if (!strncmp ((char *) buf, "once", 4)) {
- /* Allow #pragma once in system headers, since that's not the user's
- fault. */
- if (!instack[indepth].system_header_p)
- warning ("`#pragma once' is obsolete");
- do_once ();
- }
-
- if (!strncmp ((char *) buf, "implementation", 14)) {
- /* Be quiet about `#pragma implementation' for a file only if it hasn't
- been included yet. */
-
- int h;
- U_CHAR *p = buf + 14, *fname;
- SKIP_WHITE_SPACE (p);
- if (*p == '\n' || *p != '\"')
- return 0;
-
- fname = p + 1;
- if ((p = (U_CHAR *) index ((char *) fname, '\"')))
- *p = '\0';
-
- for (h = 0; h < INCLUDE_HASHSIZE; h++) {
- struct include_file *inc;
- for (inc = include_hashtab[h]; inc; inc = inc->next) {
- if (!strcmp (base_name (inc->fname), (char *) fname)) {
- warning ("`#pragma implementation' for \"%s\" appears after its #include",fname);
- return 0;
- }
- }
- }
- }
- return 0;
-}
-
-#if 0
-/* This was a fun hack, but #pragma seems to start to be useful.
- By failing to recognize it, we pass it through unchanged to cc1. */
-
-/* The behavior of the #pragma directive is implementation defined.
- this implementation defines it as follows. */
-
-static int
-do_pragma ()
-{
- close (0);
- if (open ("/dev/tty", O_RDONLY, 0666) != 0)
- goto nope;
- close (1);
- if (open ("/dev/tty", O_WRONLY, 0666) != 1)
- goto nope;
- execl ("/usr/games/hack", "#pragma", 0);
- execl ("/usr/games/rogue", "#pragma", 0);
- execl ("/usr/new/emacs", "-f", "hanoi", "9", "-kill", 0);
- execl ("/usr/local/emacs", "-f", "hanoi", "9", "-kill", 0);
-nope:
- fatal ("You are in a maze of twisty compiler features, all different");
-}
-#endif
-
-#ifdef SCCS_DIRECTIVE
-
-/* Just ignore #sccs, on systems where we define it at all. */
-
-static int
-do_sccs (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- if (pedantic)
- pedwarn ("ANSI C does not allow `#sccs'");
- return 0;
-}
-
-#endif /* defined (SCCS_DIRECTIVE) */
-
-/* Handle #if directive by
- 1) inserting special `defined' keyword into the hash table
- that gets turned into 0 or 1 by special_symbol (thus,
- if the luser has a symbol called `defined' already, it won't
- work inside the #if directive)
- 2) rescan the input into a temporary output buffer
- 3) pass the output buffer to the yacc parser and collect a value
- 4) clean up the mess left from steps 1 and 2.
- 5) call conditional_skip to skip til the next #endif (etc.),
- or not, depending on the value from step 3. */
-
-static int
-do_if (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- HOST_WIDE_INT value;
- FILE_BUF *ip = &instack[indepth];
-
- value = eval_if_expression (buf, limit - buf);
- conditional_skip (ip, value == 0, T_IF, NULL_PTR, op);
- return 0;
-}
-
-/* Handle a #elif directive by not changing if_stack either.
- see the comment above do_else. */
-
-static int
-do_elif (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- HOST_WIDE_INT value;
- FILE_BUF *ip = &instack[indepth];
-
- if (if_stack == instack[indepth].if_stack) {
- error ("`#elif' not within a conditional");
- return 0;
- } else {
- if (if_stack->type != T_IF && if_stack->type != T_ELIF) {
- error ("`#elif' after `#else'");
- fprintf (stderr, " (matches line %d", if_stack->lineno);
- if (if_stack->fname != NULL && ip->fname != NULL &&
- strcmp (if_stack->fname, ip->nominal_fname) != 0)
- fprintf (stderr, ", file %s", if_stack->fname);
- fprintf (stderr, ")\n");
- }
- if_stack->type = T_ELIF;
- }
-
- if (if_stack->if_succeeded)
- skip_if_group (ip, 0, op);
- else {
- value = eval_if_expression (buf, limit - buf);
- if (value == 0)
- skip_if_group (ip, 0, op);
- else {
- ++if_stack->if_succeeded; /* continue processing input */
- output_line_directive (ip, op, 1, same_file);
- }
- }
- return 0;
-}
-
-/* Evaluate a #if expression in BUF, of length LENGTH, then parse the
- result as a C expression and return the value as an int. */
-
-static HOST_WIDE_INT
-eval_if_expression (buf, length)
- U_CHAR *buf;
- int length;
-{
- FILE_BUF temp_obuf;
- HASHNODE *save_defined;
- HOST_WIDE_INT value;
-
- save_defined = install ((U_CHAR *) "defined", -1, T_SPEC_DEFINED,
- NULL_PTR, -1);
- pcp_inside_if = 1;
- temp_obuf = expand_to_temp_buffer (buf, buf + length, 0, 1);
- pcp_inside_if = 0;
- delete_macro (save_defined); /* clean up special symbol */
-
- temp_obuf.buf[temp_obuf.length] = '\n';
- value = parse_c_expression ((char *) temp_obuf.buf);
-
- free (temp_obuf.buf);
-
- return value;
-}
-
-/* routine to handle ifdef/ifndef. Try to look up the symbol, then do
- or don't skip to the #endif/#else/#elif depending on what directive
- is actually being processed. */
-
-static int
-do_xifdef (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- int skip;
- FILE_BUF *ip = &instack[indepth];
- U_CHAR *end;
- int start_of_file = 0;
- U_CHAR *control_macro = 0;
-
- /* Detect a #ifndef at start of file (not counting comments). */
- if (ip->fname != 0 && keyword->type == T_IFNDEF) {
- U_CHAR *p = ip->buf;
- while (p != directive_start) {
- U_CHAR c = *p++;
- if (is_space[c])
- ;
- /* Make no special provision for backslash-newline here; this is
- slower if backslash-newlines are present, but it's correct,
- and it's not worth it to tune for the rare backslash-newline. */
- else if (c == '/'
- && (*p == '*' || (cplusplus_comments && *p == '/'))) {
- /* Skip this comment. */
- int junk = 0;
- U_CHAR *save_bufp = ip->bufp;
- ip->bufp = p + 1;
- p = skip_to_end_of_comment (ip, &junk, 1);
- ip->bufp = save_bufp;
- } else {
- goto fail;
- }
- }
- /* If we get here, this conditional is the beginning of the file. */
- start_of_file = 1;
- fail: ;
- }
-
- /* Discard leading and trailing whitespace. */
- SKIP_WHITE_SPACE (buf);
- while (limit != buf && is_hor_space[limit[-1]]) limit--;
-
- /* Find the end of the identifier at the beginning. */
- for (end = buf; is_idchar[*end]; end++);
-
- if (end == buf) {
- skip = (keyword->type == T_IFDEF);
- if (! traditional)
- pedwarn (end == limit ? "`#%s' with no argument"
- : "`#%s' argument starts with punctuation",
- keyword->name);
- } else {
- HASHNODE *hp;
-
- if (! traditional) {
- if (isdigit (buf[0]))
- pedwarn ("`#%s' argument starts with a digit", keyword->name);
- else if (end != limit)
- pedwarn ("garbage at end of `#%s' argument", keyword->name);
- }
-
- hp = lookup (buf, end-buf, -1);
-
- if (pcp_outfile) {
- /* Output a precondition for this macro. */
- if (hp &&
- (hp->type == T_CONST
- || (hp->type == T_MACRO && hp->value.defn->predefined)))
- fprintf (pcp_outfile, "#define %s\n", hp->name);
- else {
- U_CHAR *cp = buf;
- fprintf (pcp_outfile, "#undef ");
- while (is_idchar[*cp]) /* Ick! */
- fputc (*cp++, pcp_outfile);
- putc ('\n', pcp_outfile);
- }
- }
-
- skip = (hp == NULL) ^ (keyword->type == T_IFNDEF);
- if (start_of_file && !skip) {
- control_macro = (U_CHAR *) xmalloc (end - buf + 1);
- bcopy ((char *) buf, (char *) control_macro, end - buf);
- control_macro[end - buf] = 0;
- }
- }
-
- conditional_skip (ip, skip, T_IF, control_macro, op);
- return 0;
-}
-
-/* Push TYPE on stack; then, if SKIP is nonzero, skip ahead.
- If this is a #ifndef starting at the beginning of a file,
- CONTROL_MACRO is the macro name tested by the #ifndef.
- Otherwise, CONTROL_MACRO is 0. */
-
-static void
-conditional_skip (ip, skip, type, control_macro, op)
- FILE_BUF *ip;
- int skip;
- enum node_type type;
- U_CHAR *control_macro;
- FILE_BUF *op;
-{
- IF_STACK_FRAME *temp;
-
- temp = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME));
- temp->fname = ip->nominal_fname;
- temp->lineno = ip->lineno;
- temp->next = if_stack;
- temp->control_macro = control_macro;
- if_stack = temp;
-
- if_stack->type = type;
-
- if (skip != 0) {
- skip_if_group (ip, 0, op);
- return;
- } else {
- ++if_stack->if_succeeded;
- output_line_directive (ip, &outbuf, 1, same_file);
- }
-}
-
-/* Skip to #endif, #else, or #elif. adjust line numbers, etc.
- Leaves input ptr at the sharp sign found.
- If ANY is nonzero, return at next directive of any sort. */
-
-static void
-skip_if_group (ip, any, op)
- FILE_BUF *ip;
- int any;
- FILE_BUF *op;
-{
- register U_CHAR *bp = ip->bufp, *cp;
- register U_CHAR *endb = ip->buf + ip->length;
- struct directive *kt;
- IF_STACK_FRAME *save_if_stack = if_stack; /* don't pop past here */
- U_CHAR *beg_of_line = bp;
- register int ident_length;
- U_CHAR *ident, *after_ident;
- /* Save info about where the group starts. */
- U_CHAR *beg_of_group = bp;
- int beg_lineno = ip->lineno;
-
- if (output_conditionals && op != 0) {
- char *ptr = "#failed\n";
- int len = strlen (ptr);
-
- if (op->bufp > op->buf && op->bufp[-1] != '\n')
- {
- *op->bufp++ = '\n';
- op->lineno++;
- }
- check_expand (op, len);
- bcopy (ptr, (char *) op->bufp, len);
- op->bufp += len;
- op->lineno++;
- output_line_directive (ip, op, 1, 0);
- }
-
- while (bp < endb) {
- switch (*bp++) {
- case '/': /* possible comment */
- if (*bp == '\\' && bp[1] == '\n')
- newline_fix (bp);
- if (*bp == '*'
- || (cplusplus_comments && *bp == '/')) {
- ip->bufp = ++bp;
- bp = skip_to_end_of_comment (ip, &ip->lineno, 0);
- }
- break;
- case '\"':
- case '\'':
- bp = skip_quoted_string (bp - 1, endb, ip->lineno, &ip->lineno,
- NULL_PTR, NULL_PTR);
- break;
- case '\\':
- /* Char after backslash loses its special meaning. */
- if (bp < endb) {
- if (*bp == '\n')
- ++ip->lineno; /* But do update the line-count. */
- bp++;
- }
- break;
- case '\n':
- ++ip->lineno;
- beg_of_line = bp;
- break;
- case '%':
- if (beg_of_line == 0 || traditional)
- break;
- ip->bufp = bp - 1;
- while (bp[0] == '\\' && bp[1] == '\n')
- bp += 2;
- if (*bp == ':')
- goto sharp_token;
- break;
- case '#':
- /* # keyword: a # must be first nonblank char on the line */
- if (beg_of_line == 0)
- break;
- ip->bufp = bp - 1;
- sharp_token:
- /* Scan from start of line, skipping whitespace, comments
- and backslash-newlines, and see if we reach this #.
- If not, this # is not special. */
- bp = beg_of_line;
- /* If -traditional, require # to be at beginning of line. */
- if (!traditional) {
- while (1) {
- if (is_hor_space[*bp])
- bp++;
- else if (*bp == '\\' && bp[1] == '\n')
- bp += 2;
- else if (*bp == '/' && bp[1] == '*') {
- bp += 2;
- while (!(*bp == '*' && bp[1] == '/'))
- bp++;
- bp += 2;
- }
- /* There is no point in trying to deal with C++ // comments here,
- because if there is one, then this # must be part of the
- comment and we would never reach here. */
- else break;
- }
- }
- if (bp != ip->bufp) {
- bp = ip->bufp + 1; /* Reset bp to after the #. */
- break;
- }
-
- bp = ip->bufp + 1; /* Point after the '#' */
- if (ip->bufp[0] == '%') {
- /* Skip past the ':' again. */
- while (*bp == '\\') {
- ip->lineno++;
- bp += 2;
- }
- bp++;
- }
-
- /* Skip whitespace and \-newline. */
- while (1) {
- if (is_hor_space[*bp])
- bp++;
- else if (*bp == '\\' && bp[1] == '\n')
- bp += 2;
- else if (*bp == '/') {
- if (bp[1] == '*') {
- for (bp += 2; ; bp++) {
- if (*bp == '\n')
- ip->lineno++;
- else if (*bp == '*') {
- if (bp[-1] == '/' && warn_comments)
- warning ("`/*' within comment");
- if (bp[1] == '/')
- break;
- }
- }
- bp += 2;
- } else if (bp[1] == '/' && cplusplus_comments) {
- for (bp += 2; ; bp++) {
- if (*bp == '\n') {
- if (bp[-1] != '\\')
- break;
- if (warn_comments)
- warning ("multiline `//' comment");
- ip->lineno++;
- }
- }
- } else
- break;
- } else
- break;
- }
-
- cp = bp;
-
- /* Now find end of directive name.
- If we encounter a backslash-newline, exchange it with any following
- symbol-constituents so that we end up with a contiguous name. */
-
- while (1) {
- if (is_idchar[*bp])
- bp++;
- else {
- if (*bp == '\\' && bp[1] == '\n')
- name_newline_fix (bp);
- if (is_idchar[*bp])
- bp++;
- else break;
- }
- }
- ident_length = bp - cp;
- ident = cp;
- after_ident = bp;
-
- /* A line of just `#' becomes blank. */
-
- if (ident_length == 0 && *after_ident == '\n') {
- continue;
- }
-
- if (ident_length == 0 || !is_idstart[*ident]) {
- U_CHAR *p = ident;
- while (is_idchar[*p]) {
- if (*p < '0' || *p > '9')
- break;
- p++;
- }
- /* Handle # followed by a line number. */
- if (p != ident && !is_idchar[*p]) {
- if (pedantic)
- pedwarn ("`#' followed by integer");
- continue;
- }
-
- /* Avoid error for `###' and similar cases unless -pedantic. */
- if (p == ident) {
- while (*p == '#' || is_hor_space[*p]) p++;
- if (*p == '\n') {
- if (pedantic && !lang_asm)
- pedwarn ("invalid preprocessing directive");
- continue;
- }
- }
-
- if (!lang_asm && pedantic)
- pedwarn ("invalid preprocessing directive name");
- continue;
- }
-
- for (kt = directive_table; kt->length >= 0; kt++) {
- IF_STACK_FRAME *temp;
- if (ident_length == kt->length
- && bcmp (cp, kt->name, kt->length) == 0) {
- /* If we are asked to return on next directive, do so now. */
- if (any)
- goto done;
-
- switch (kt->type) {
- case T_IF:
- case T_IFDEF:
- case T_IFNDEF:
- temp = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME));
- temp->next = if_stack;
- if_stack = temp;
- temp->lineno = ip->lineno;
- temp->fname = ip->nominal_fname;
- temp->type = kt->type;
- break;
- case T_ELSE:
- case T_ENDIF:
- if (pedantic && if_stack != save_if_stack)
- validate_else (bp, endb);
- case T_ELIF:
- if (if_stack == instack[indepth].if_stack) {
- error ("`#%s' not within a conditional", kt->name);
- break;
- }
- else if (if_stack == save_if_stack)
- goto done; /* found what we came for */
-
- if (kt->type != T_ENDIF) {
- if (if_stack->type == T_ELSE)
- error ("`#else' or `#elif' after `#else'");
- if_stack->type = kt->type;
- break;
- }
-
- temp = if_stack;
- if_stack = if_stack->next;
- free (temp);
- break;
-
- default:
- break;
- }
- break;
- }
- }
- /* Don't let erroneous code go by. */
- if (kt->length < 0 && !lang_asm && pedantic)
- pedwarn ("invalid preprocessing directive name");
- }
- }
-
- ip->bufp = bp;
- /* after this returns, rescan will exit because ip->bufp
- now points to the end of the buffer.
- rescan is responsible for the error message also. */
-
- done:
- if (output_conditionals && op != 0) {
- char *ptr = "#endfailed\n";
- int len = strlen (ptr);
-
- if (op->bufp > op->buf && op->bufp[-1] != '\n')
- {
- *op->bufp++ = '\n';
- op->lineno++;
- }
- check_expand (op, beg_of_line - beg_of_group);
- bcopy ((char *) beg_of_group, (char *) op->bufp,
- beg_of_line - beg_of_group);
- op->bufp += beg_of_line - beg_of_group;
- op->lineno += ip->lineno - beg_lineno;
- check_expand (op, len);
- bcopy (ptr, (char *) op->bufp, len);
- op->bufp += len;
- op->lineno++;
- }
-}
-
-/* Handle a #else directive. Do this by just continuing processing
- without changing if_stack ; this is so that the error message
- for missing #endif's etc. will point to the original #if. It
- is possible that something different would be better. */
-
-static int
-do_else (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- FILE_BUF *ip = &instack[indepth];
-
- if (pedantic) {
- SKIP_WHITE_SPACE (buf);
- if (buf != limit)
- pedwarn ("text following `#else' violates ANSI standard");
- }
-
- if (if_stack == instack[indepth].if_stack) {
- error ("`#else' not within a conditional");
- return 0;
- } else {
- /* #ifndef can't have its special treatment for containing the whole file
- if it has a #else clause. */
- if_stack->control_macro = 0;
-
- if (if_stack->type != T_IF && if_stack->type != T_ELIF) {
- error ("`#else' after `#else'");
- fprintf (stderr, " (matches line %d", if_stack->lineno);
- if (strcmp (if_stack->fname, ip->nominal_fname) != 0)
- fprintf (stderr, ", file %s", if_stack->fname);
- fprintf (stderr, ")\n");
- }
- if_stack->type = T_ELSE;
- }
-
- if (if_stack->if_succeeded)
- skip_if_group (ip, 0, op);
- else {
- ++if_stack->if_succeeded; /* continue processing input */
- output_line_directive (ip, op, 1, same_file);
- }
- return 0;
-}
-
-/* Unstack after #endif directive. */
-
-static int
-do_endif (buf, limit, op, keyword)
- U_CHAR *buf, *limit;
- FILE_BUF *op;
- struct directive *keyword;
-{
- if (pedantic) {
- SKIP_WHITE_SPACE (buf);
- if (buf != limit)
- pedwarn ("text following `#endif' violates ANSI standard");
- }
-
- if (if_stack == instack[indepth].if_stack)
- error ("unbalanced `#endif'");
- else {
- IF_STACK_FRAME *temp = if_stack;
- if_stack = if_stack->next;
- if (temp->control_macro != 0) {
- /* This #endif matched a #ifndef at the start of the file.
- See if it is at the end of the file. */
- FILE_BUF *ip = &instack[indepth];
- U_CHAR *p = ip->bufp;
- U_CHAR *ep = ip->buf + ip->length;
-
- while (p != ep) {
- U_CHAR c = *p++;
- if (!is_space[c]) {
- if (c == '/'
- && (*p == '*' || (cplusplus_comments && *p == '/'))) {
- /* Skip this comment. */
- int junk = 0;
- U_CHAR *save_bufp = ip->bufp;
- ip->bufp = p + 1;
- p = skip_to_end_of_comment (ip, &junk, 1);
- ip->bufp = save_bufp;
- } else
- goto fail;
- }
- }
- /* If we get here, this #endif ends a #ifndef
- that contains all of the file (aside from whitespace).
- Arrange not to include the file again
- if the macro that was tested is defined.
-
- Do not do this for the top-level file in a -include or any
- file in a -imacros. */
- if (indepth != 0
- && ! (indepth == 1 && no_record_file)
- && ! (no_record_file && no_output))
- record_control_macro (ip->inc, temp->control_macro);
- fail: ;
- }
- free (temp);
- output_line_directive (&instack[indepth], op, 1, same_file);
- }
- return 0;
-}
-
-/* When an #else or #endif is found while skipping failed conditional,
- if -pedantic was specified, this is called to warn about text after
- the directive name. P points to the first char after the directive
- name. */
-
-static void
-validate_else (p, limit)
- register U_CHAR *p;
- register U_CHAR *limit;
-{
- /* Advance P over whitespace and comments. */
- while (1) {
- while (*p == '\\' && p[1] == '\n')
- p += 2;
- if (is_hor_space[*p])
- p++;
- else if (*p == '/') {
- while (p[1] == '\\' && p[2] == '\n')
- p += 2;
- if (p[1] == '*') {
- /* Don't bother warning about unterminated comments
- since that will happen later. Just be sure to exit. */
- for (p += 2; ; p++) {
- if (p == limit)
- return;
- if (*p == '*') {
- while (p[1] == '\\' && p[2] == '\n')
- p += 2;
- if (p[1] == '/') {
- p += 2;
- break;
- }
- }
- }
- }
- else if (cplusplus_comments && p[1] == '/')
- return;
- else break;
- } else break;
- }
- if (*p != '\n')
- pedwarn ("text following `#else' or `#endif' violates ANSI standard");
-}
-
-/* Skip a comment, assuming the input ptr immediately follows the
- initial slash-star. Bump *LINE_COUNTER for each newline.
- (The canonical line counter is &ip->lineno.)
- Don't use this routine (or the next one) if bumping the line
- counter is not sufficient to deal with newlines in the string.
-
- If NOWARN is nonzero, don't warn about slash-star inside a comment.
- This feature is useful when processing a comment that is going to
- be processed or was processed at another point in the preprocessor,
- to avoid a duplicate warning. Likewise for unterminated comment
- errors. */
-
-static U_CHAR *
-skip_to_end_of_comment (ip, line_counter, nowarn)
- register FILE_BUF *ip;
- int *line_counter; /* place to remember newlines, or NULL */
- int nowarn;
-{
- register U_CHAR *limit = ip->buf + ip->length;
- register U_CHAR *bp = ip->bufp;
- FILE_BUF *op = put_out_comments && !line_counter ? &outbuf : (FILE_BUF *) 0;
- int start_line = line_counter ? *line_counter : 0;
-
- /* JF this line_counter stuff is a crock to make sure the
- comment is only put out once, no matter how many times
- the comment is skipped. It almost works */
- if (op) {
- *op->bufp++ = '/';
- *op->bufp++ = bp[-1];
- }
- if (cplusplus_comments && bp[-1] == '/') {
- for (; bp < limit; bp++) {
- if (*bp == '\n') {
- if (bp[-1] != '\\')
- break;
- if (!nowarn && warn_comments)
- warning ("multiline `//' comment");
- if (line_counter)
- ++*line_counter;
- if (op)
- ++op->lineno;
- }
- if (op)
- *op->bufp++ = *bp;
- }
- ip->bufp = bp;
- return bp;
- }
- while (bp < limit) {
- if (op)
- *op->bufp++ = *bp;
- switch (*bp++) {
- case '\n':
- /* If this is the end of the file, we have an unterminated comment.
- Don't swallow the newline. We are guaranteed that there will be a
- trailing newline and various pieces assume it's there. */
- if (bp == limit)
- {
- --bp;
- --limit;
- break;
- }
- if (line_counter != NULL)
- ++*line_counter;
- if (op)
- ++op->lineno;
- break;
- case '*':
- if (bp[-2] == '/' && !nowarn && warn_comments)
- warning ("`/*' within comment");
- if (*bp == '\\' && bp[1] == '\n')
- newline_fix (bp);
- if (*bp == '/') {
- if (op)
- *op->bufp++ = '/';
- ip->bufp = ++bp;
- return bp;
- }
- break;
- }
- }
-
- if (!nowarn)
- error_with_line (line_for_error (start_line), "unterminated comment");
- ip->bufp = bp;
- return bp;
-}
-
-/* Skip over a quoted string. BP points to the opening quote.
- Returns a pointer after the closing quote. Don't go past LIMIT.
- START_LINE is the line number of the starting point (but it need
- not be valid if the starting point is inside a macro expansion).
-
- The input stack state is not changed.
-
- If COUNT_NEWLINES is nonzero, it points to an int to increment
- for each newline passed.
-
- If BACKSLASH_NEWLINES_P is nonzero, store 1 thru it
- if we pass a backslash-newline.
-
- If EOFP is nonzero, set *EOFP to 1 if the string is unterminated. */
-
-static U_CHAR *
-skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p, eofp)
- register U_CHAR *bp;
- register U_CHAR *limit;
- int start_line;
- int *count_newlines;
- int *backslash_newlines_p;
- int *eofp;
-{
- register U_CHAR c, match;
-
- match = *bp++;
- while (1) {
- if (bp >= limit) {
- error_with_line (line_for_error (start_line),
- "unterminated string or character constant");
- error_with_line (multiline_string_line,
- "possible real start of unterminated constant");
- multiline_string_line = 0;
- if (eofp)
- *eofp = 1;
- break;
- }
- c = *bp++;
- if (c == '\\') {
- while (*bp == '\\' && bp[1] == '\n') {
- if (backslash_newlines_p)
- *backslash_newlines_p = 1;
- if (count_newlines)
- ++*count_newlines;
- bp += 2;
- }
- if (*bp == '\n' && count_newlines) {
- if (backslash_newlines_p)
- *backslash_newlines_p = 1;
- ++*count_newlines;
- }
- bp++;
- } else if (c == '\n') {
- if (traditional) {
- /* Unterminated strings and character constants are 'valid'. */
- bp--; /* Don't consume the newline. */
- if (eofp)
- *eofp = 1;
- break;
- }
- if (match == '\'') {
- error_with_line (line_for_error (start_line),
- "unterminated string or character constant");
- bp--;
- if (eofp)
- *eofp = 1;
- break;
- }
- /* If not traditional, then allow newlines inside strings. */
- if (count_newlines)
- ++*count_newlines;
- if (multiline_string_line == 0) {
- if (pedantic)
- pedwarn_with_line (line_for_error (start_line),
- "string constant runs past end of line");
- multiline_string_line = start_line;
- }
- } else if (c == match)
- break;
- }
- return bp;
-}
-
-/* Place into DST a quoted string representing the string SRC.
- Return the address of DST's terminating null. */
-
-static char *
-quote_string (dst, src)
- char *dst, *src;
-{
- U_CHAR c;
-
- *dst++ = '\"';
- for (;;)
- switch ((c = *src++))
- {
- default:
- if (isprint (c))
- *dst++ = c;
- else
- {
- sprintf (dst, "\\%03o", c);
- dst += 4;
- }
- break;
-
- case '\"':
- case '\\':
- *dst++ = '\\';
- *dst++ = c;
- break;
-
- case '\0':
- *dst++ = '\"';
- *dst = '\0';
- return dst;
- }
-}
-
-/* Skip across a group of balanced parens, starting from IP->bufp.
- IP->bufp is updated. Use this with IP->bufp pointing at an open-paren.
-
- This does not handle newlines, because it's used for the arg of #if,
- where there aren't any newlines. Also, backslash-newline can't appear. */
-
-static U_CHAR *
-skip_paren_group (ip)
- register FILE_BUF *ip;
-{
- U_CHAR *limit = ip->buf + ip->length;
- U_CHAR *p = ip->bufp;
- int depth = 0;
- int lines_dummy = 0;
-
- while (p != limit) {
- int c = *p++;
- switch (c) {
- case '(':
- depth++;
- break;
-
- case ')':
- depth--;
- if (depth == 0)
- return ip->bufp = p;
- break;
-
- case '/':
- if (*p == '*') {
- ip->bufp = p;
- p = skip_to_end_of_comment (ip, &lines_dummy, 0);
- p = ip->bufp;
- }
-
- case '"':
- case '\'':
- {
- int eofp = 0;
- p = skip_quoted_string (p - 1, limit, 0, NULL_PTR, NULL_PTR, &eofp);
- if (eofp)
- return ip->bufp = p;
- }
- break;
- }
- }
-
- ip->bufp = p;
- return p;
-}
-
-/* Write out a #line directive, for instance, after an #include file.
- If CONDITIONAL is nonzero, we can omit the #line if it would
- appear to be a no-op, and we can output a few newlines instead
- if we want to increase the line number by a small amount.
- FILE_CHANGE says whether we are entering a file, leaving, or neither. */
-
-static void
-output_line_directive (ip, op, conditional, file_change)
- FILE_BUF *ip, *op;
- int conditional;
- enum file_change_code file_change;
-{
- int len;
- char *line_directive_buf, *line_end;
-
- if (no_line_directives
- || ip->fname == NULL
- || no_output) {
- op->lineno = ip->lineno;
- return;
- }
-
- if (conditional) {
- if (ip->lineno == op->lineno)
- return;
-
- /* If the inherited line number is a little too small,
- output some newlines instead of a #line directive. */
- if (ip->lineno > op->lineno && ip->lineno < op->lineno + 8) {
- check_expand (op, 10);
- while (ip->lineno > op->lineno) {
- *op->bufp++ = '\n';
- op->lineno++;
- }
- return;
- }
- }
-
- /* Output a positive line number if possible. */
- while (ip->lineno <= 0 && ip->bufp - ip->buf < ip->length
- && *ip->bufp == '\n') {
- ip->lineno++;
- ip->bufp++;
- }
-
- line_directive_buf = (char *) alloca (4 * strlen (ip->nominal_fname) + 100);
- sprintf (line_directive_buf, "# %d ", ip->lineno);
- line_end = quote_string (line_directive_buf + strlen (line_directive_buf),
- ip->nominal_fname);
- if (file_change != same_file) {
- *line_end++ = ' ';
- *line_end++ = file_change == enter_file ? '1' : '2';
- }
- /* Tell cc1 if following text comes from a system header file. */
- if (ip->system_header_p) {
- *line_end++ = ' ';
- *line_end++ = '3';
- }
-#ifndef NO_IMPLICIT_EXTERN_C
- /* Tell cc1plus if following text should be treated as C. */
- if (ip->system_header_p == 2 && cplusplus) {
- *line_end++ = ' ';
- *line_end++ = '4';
- }
-#endif
- *line_end++ = '\n';
- len = line_end - line_directive_buf;
- check_expand (op, len + 1);
- if (op->bufp > op->buf && op->bufp[-1] != '\n')
- *op->bufp++ = '\n';
- bcopy ((char *) line_directive_buf, (char *) op->bufp, len);
- op->bufp += len;
- op->lineno = ip->lineno;
-}
-
-/* This structure represents one parsed argument in a macro call.
- `raw' points to the argument text as written (`raw_length' is its length).
- `expanded' points to the argument's macro-expansion
- (its length is `expand_length').
- `stringified_length' is the length the argument would have
- if stringified.
- `use_count' is the number of times this macro arg is substituted
- into the macro. If the actual use count exceeds 10,
- the value stored is 10.
- `free1' and `free2', if nonzero, point to blocks to be freed
- when the macro argument data is no longer needed. */
-
-struct argdata {
- U_CHAR *raw, *expanded;
- int raw_length, expand_length;
- int stringified_length;
- U_CHAR *free1, *free2;
- char newlines;
- char use_count;
-};
-
-/* Expand a macro call.
- HP points to the symbol that is the macro being called.
- Put the result of expansion onto the input stack
- so that subsequent input by our caller will use it.
-
- If macro wants arguments, caller has already verified that
- an argument list follows; arguments come from the input stack. */
-
-static void
-macroexpand (hp, op)
- HASHNODE *hp;
- FILE_BUF *op;
-{
- int nargs;
- DEFINITION *defn = hp->value.defn;
- register U_CHAR *xbuf;
- int xbuf_len;
- int start_line = instack[indepth].lineno;
- int rest_args, rest_zero;
-
- CHECK_DEPTH (return;);
-
- /* it might not actually be a macro. */
- if (hp->type != T_MACRO) {
- special_symbol (hp, op);
- return;
- }
-
- /* This macro is being used inside a #if, which means it must be */
- /* recorded as a precondition. */
- if (pcp_inside_if && pcp_outfile && defn->predefined)
- dump_single_macro (hp, pcp_outfile);
-
- nargs = defn->nargs;
-
- if (nargs >= 0) {
- register int i;
- struct argdata *args;
- char *parse_error = 0;
-
- args = (struct argdata *) alloca ((nargs + 1) * sizeof (struct argdata));
-
- for (i = 0; i < nargs; i++) {
- args[i].raw = (U_CHAR *) "";
- args[i].expanded = 0;
- args[i].raw_length = args[i].expand_length
- = args[i].stringified_length = 0;
- args[i].free1 = args[i].free2 = 0;
- args[i].use_count = 0;
- }
-
- /* Parse all the macro args that are supplied. I counts them.
- The first NARGS args are stored in ARGS.
- The rest are discarded.
- If rest_args is set then we assume macarg absorbed the rest of the args.
- */
- i = 0;
- rest_args = 0;
- do {
- /* Discard the open-parenthesis or comma before the next arg. */
- ++instack[indepth].bufp;
- if (rest_args)
- continue;
- if (i < nargs || (nargs == 0 && i == 0)) {
- /* If we are working on last arg which absorbs rest of args... */
- if (i == nargs - 1 && defn->rest_args)
- rest_args = 1;
- parse_error = macarg (&args[i], rest_args);
- }
- else
- parse_error = macarg (NULL_PTR, 0);
- if (parse_error) {
- error_with_line (line_for_error (start_line), parse_error);
- break;
- }
- i++;
- } while (*instack[indepth].bufp != ')');
-
- /* If we got one arg but it was just whitespace, call that 0 args. */
- if (i == 1) {
- register U_CHAR *bp = args[0].raw;
- register U_CHAR *lim = bp + args[0].raw_length;
- /* cpp.texi says for foo ( ) we provide one argument.
- However, if foo wants just 0 arguments, treat this as 0. */
- if (nargs == 0)
- while (bp != lim && is_space[*bp]) bp++;
- if (bp == lim)
- i = 0;
- }
-
- /* Don't output an error message if we have already output one for
- a parse error above. */
- rest_zero = 0;
- if (nargs == 0 && i > 0) {
- if (! parse_error)
- error ("arguments given to macro `%s'", hp->name);
- } else if (i < nargs) {
- /* traditional C allows foo() if foo wants one argument. */
- if (nargs == 1 && i == 0 && traditional)
- ;
- /* the rest args token is allowed to absorb 0 tokens */
- else if (i == nargs - 1 && defn->rest_args)
- rest_zero = 1;
- else if (parse_error)
- ;
- else if (i == 0)
- error ("macro `%s' used without args", hp->name);
- else if (i == 1)
- error ("macro `%s' used with just one arg", hp->name);
- else
- error ("macro `%s' used with only %d args", hp->name, i);
- } else if (i > nargs) {
- if (! parse_error)
- error ("macro `%s' used with too many (%d) args", hp->name, i);
- }
-
- /* Swallow the closeparen. */
- ++instack[indepth].bufp;
-
- /* If macro wants zero args, we parsed the arglist for checking only.
- Read directly from the macro definition. */
- if (nargs == 0) {
- xbuf = defn->expansion;
- xbuf_len = defn->length;
- } else {
- register U_CHAR *exp = defn->expansion;
- register int offset; /* offset in expansion,
- copied a piece at a time */
- register int totlen; /* total amount of exp buffer filled so far */
-
- register struct reflist *ap, *last_ap;
-
- /* Macro really takes args. Compute the expansion of this call. */
-
- /* Compute length in characters of the macro's expansion.
- Also count number of times each arg is used. */
- xbuf_len = defn->length;
- for (ap = defn->pattern; ap != NULL; ap = ap->next) {
- if (ap->stringify)
- xbuf_len += args[ap->argno].stringified_length;
- else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional)
- /* Add 4 for two newline-space markers to prevent
- token concatenation. */
- xbuf_len += args[ap->argno].raw_length + 4;
- else {
- /* We have an ordinary (expanded) occurrence of the arg.
- So compute its expansion, if we have not already. */
- if (args[ap->argno].expanded == 0) {
- FILE_BUF obuf;
- obuf = expand_to_temp_buffer (args[ap->argno].raw,
- args[ap->argno].raw + args[ap->argno].raw_length,
- 1, 0);
-
- args[ap->argno].expanded = obuf.buf;
- args[ap->argno].expand_length = obuf.length;
- args[ap->argno].free2 = obuf.buf;
- }
-
- /* Add 4 for two newline-space markers to prevent
- token concatenation. */
- xbuf_len += args[ap->argno].expand_length + 4;
- }
- if (args[ap->argno].use_count < 10)
- args[ap->argno].use_count++;
- }
-
- xbuf = (U_CHAR *) xmalloc (xbuf_len + 1);
-
- /* Generate in XBUF the complete expansion
- with arguments substituted in.
- TOTLEN is the total size generated so far.
- OFFSET is the index in the definition
- of where we are copying from. */
- offset = totlen = 0;
- for (last_ap = NULL, ap = defn->pattern; ap != NULL;
- last_ap = ap, ap = ap->next) {
- register struct argdata *arg = &args[ap->argno];
- int count_before = totlen;
-
- /* Add chars to XBUF. */
- for (i = 0; i < ap->nchars; i++, offset++)
- xbuf[totlen++] = exp[offset];
-
- /* If followed by an empty rest arg with concatenation,
- delete the last run of nonwhite chars. */
- if (rest_zero && totlen > count_before
- && ((ap->rest_args && ap->raw_before != 0)
- || (last_ap != NULL && last_ap->rest_args
- && last_ap->raw_after != 0))) {
- /* Delete final whitespace. */
- while (totlen > count_before && is_space[xbuf[totlen - 1]]) {
- totlen--;
- }
-
- /* Delete the nonwhites before them. */
- while (totlen > count_before && ! is_space[xbuf[totlen - 1]]) {
- totlen--;
- }
- }
-
- if (ap->stringify != 0) {
- int arglen = arg->raw_length;
- int escaped = 0;
- int in_string = 0;
- int c;
- i = 0;
- while (i < arglen
- && (c = arg->raw[i], is_space[c]))
- i++;
- while (i < arglen
- && (c = arg->raw[arglen - 1], is_space[c]))
- arglen--;
- if (!traditional)
- xbuf[totlen++] = '\"'; /* insert beginning quote */
- for (; i < arglen; i++) {
- c = arg->raw[i];
-
- /* Special markers Newline Space
- generate nothing for a stringified argument. */
- if (c == '\n' && arg->raw[i+1] != '\n') {
- i++;
- continue;
- }
-
- /* Internal sequences of whitespace are replaced by one space
- except within an string or char token. */
- if (! in_string
- && (c == '\n' ? arg->raw[i+1] == '\n' : is_space[c])) {
- while (1) {
- /* Note that Newline Space does occur within whitespace
- sequences; consider it part of the sequence. */
- if (c == '\n' && is_space[arg->raw[i+1]])
- i += 2;
- else if (c != '\n' && is_space[c])
- i++;
- else break;
- c = arg->raw[i];
- }
- i--;
- c = ' ';
- }
-
- if (escaped)
- escaped = 0;
- else {
- if (c == '\\')
- escaped = 1;
- if (in_string) {
- if (c == in_string)
- in_string = 0;
- } else if (c == '\"' || c == '\'')
- in_string = c;
- }
-
- /* Escape these chars */
- if (c == '\"' || (in_string && c == '\\'))
- xbuf[totlen++] = '\\';
- if (isprint (c))
- xbuf[totlen++] = c;
- else {
- sprintf ((char *) &xbuf[totlen], "\\%03o", (unsigned int) c);
- totlen += 4;
- }
- }
- if (!traditional)
- xbuf[totlen++] = '\"'; /* insert ending quote */
- } else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional) {
- U_CHAR *p1 = arg->raw;
- U_CHAR *l1 = p1 + arg->raw_length;
- if (ap->raw_before != 0) {
- while (p1 != l1 && is_space[*p1]) p1++;
- while (p1 != l1 && is_idchar[*p1])
- xbuf[totlen++] = *p1++;
- /* Delete any no-reexpansion marker that follows
- an identifier at the beginning of the argument
- if the argument is concatenated with what precedes it. */
- if (p1[0] == '\n' && p1[1] == '-')
- p1 += 2;
- } else if (!traditional) {
- /* Ordinary expanded use of the argument.
- Put in newline-space markers to prevent token pasting. */
- xbuf[totlen++] = '\n';
- xbuf[totlen++] = ' ';
- }
- if (ap->raw_after != 0) {
- /* Arg is concatenated after: delete trailing whitespace,
- whitespace markers, and no-reexpansion markers. */
- while (p1 != l1) {
- if (is_space[l1[-1]]) l1--;
- else if (l1[-1] == '-') {
- U_CHAR *p2 = l1 - 1;
- /* If a `-' is preceded by an odd number of newlines then it
- and the last newline are a no-reexpansion marker. */
- while (p2 != p1 && p2[-1] == '\n') p2--;
- if ((l1 - 1 - p2) & 1) {
- l1 -= 2;
- }
- else break;
- }
- else break;
- }
- }
-
- bcopy ((char *) p1, (char *) (xbuf + totlen), l1 - p1);
- totlen += l1 - p1;
- if (!traditional && ap->raw_after == 0) {
- /* Ordinary expanded use of the argument.
- Put in newline-space markers to prevent token pasting. */
- xbuf[totlen++] = '\n';
- xbuf[totlen++] = ' ';
- }
- } else {
- /* Ordinary expanded use of the argument.
- Put in newline-space markers to prevent token pasting. */
- if (!traditional) {
- xbuf[totlen++] = '\n';
- xbuf[totlen++] = ' ';
- }
- bcopy ((char *) arg->expanded, (char *) (xbuf + totlen),
- arg->expand_length);
- totlen += arg->expand_length;
- if (!traditional) {
- xbuf[totlen++] = '\n';
- xbuf[totlen++] = ' ';
- }
- /* If a macro argument with newlines is used multiple times,
- then only expand the newlines once. This avoids creating output
- lines which don't correspond to any input line, which confuses
- gdb and gcov. */
- if (arg->use_count > 1 && arg->newlines > 0) {
- /* Don't bother doing change_newlines for subsequent
- uses of arg. */
- arg->use_count = 1;
- arg->expand_length
- = change_newlines (arg->expanded, arg->expand_length);
- }
- }
-
- if (totlen > xbuf_len)
- abort ();
- }
-
- /* If there is anything left of the definition after handling
- the arg list, copy that in too. */
-
- for (i = offset; i < defn->length; i++) {
- /* if we've reached the end of the macro */
- if (exp[i] == ')')
- rest_zero = 0;
- if (! (rest_zero && last_ap != NULL && last_ap->rest_args
- && last_ap->raw_after != 0))
- xbuf[totlen++] = exp[i];
- }
-
- xbuf[totlen] = 0;
- xbuf_len = totlen;
-
- for (i = 0; i < nargs; i++) {
- if (args[i].free1 != 0)
- free (args[i].free1);
- if (args[i].free2 != 0)
- free (args[i].free2);
- }
- }
- } else {
- xbuf = defn->expansion;
- xbuf_len = defn->length;
- }
-
- /* Now put the expansion on the input stack
- so our caller will commence reading from it. */
- {
- register FILE_BUF *ip2;
-
- ip2 = &instack[++indepth];
-
- ip2->fname = 0;
- ip2->nominal_fname = 0;
- ip2->inc = 0;
- /* This may not be exactly correct, but will give much better error
- messages for nested macro calls than using a line number of zero. */
- ip2->lineno = start_line;
- ip2->buf = xbuf;
- ip2->length = xbuf_len;
- ip2->bufp = xbuf;
- ip2->free_ptr = (nargs > 0) ? xbuf : 0;
- ip2->macro = hp;
- ip2->if_stack = if_stack;
- ip2->system_header_p = 0;
-
- /* Recursive macro use sometimes works traditionally.
- #define foo(x,y) bar (x (y,0), y)
- foo (foo, baz) */
-
- if (!traditional)
- hp->type = T_DISABLED;
- }
-}
-
-/* Parse a macro argument and store the info on it into *ARGPTR.
- REST_ARGS is passed to macarg1 to make it absorb the rest of the args.
- Return nonzero to indicate a syntax error. */
-
-static char *
-macarg (argptr, rest_args)
- register struct argdata *argptr;
- int rest_args;
-{
- FILE_BUF *ip = &instack[indepth];
- int paren = 0;
- int newlines = 0;
- int comments = 0;
- char *result = 0;
-
- /* Try to parse as much of the argument as exists at this
- input stack level. */
- U_CHAR *bp = macarg1 (ip->bufp, ip->buf + ip->length,
- &paren, &newlines, &comments, rest_args);
-
- /* If we find the end of the argument at this level,
- set up *ARGPTR to point at it in the input stack. */
- if (!(ip->fname != 0 && (newlines != 0 || comments != 0))
- && bp != ip->buf + ip->length) {
- if (argptr != 0) {
- argptr->raw = ip->bufp;
- argptr->raw_length = bp - ip->bufp;
- argptr->newlines = newlines;
- }
- ip->bufp = bp;
- } else {
- /* This input stack level ends before the macro argument does.
- We must pop levels and keep parsing.
- Therefore, we must allocate a temporary buffer and copy
- the macro argument into it. */
- int bufsize = bp - ip->bufp;
- int extra = newlines;
- U_CHAR *buffer = (U_CHAR *) xmalloc (bufsize + extra + 1);
- int final_start = 0;
-
- bcopy ((char *) ip->bufp, (char *) buffer, bufsize);
- ip->bufp = bp;
- ip->lineno += newlines;
-
- while (bp == ip->buf + ip->length) {
- if (instack[indepth].macro == 0) {
- result = "unterminated macro call";
- break;
- }
- ip->macro->type = T_MACRO;
- if (ip->free_ptr)
- free (ip->free_ptr);
- ip = &instack[--indepth];
- newlines = 0;
- comments = 0;
- bp = macarg1 (ip->bufp, ip->buf + ip->length, &paren,
- &newlines, &comments, rest_args);
- final_start = bufsize;
- bufsize += bp - ip->bufp;
- extra += newlines;
- buffer = (U_CHAR *) xrealloc (buffer, bufsize + extra + 1);
- bcopy ((char *) ip->bufp, (char *) (buffer + bufsize - (bp - ip->bufp)),
- bp - ip->bufp);
- ip->bufp = bp;
- ip->lineno += newlines;
- }
-
- /* Now, if arg is actually wanted, record its raw form,
- discarding comments and duplicating newlines in whatever
- part of it did not come from a macro expansion.
- EXTRA space has been preallocated for duplicating the newlines.
- FINAL_START is the index of the start of that part. */
- if (argptr != 0) {
- argptr->raw = buffer;
- argptr->raw_length = bufsize;
- argptr->free1 = buffer;
- argptr->newlines = newlines;
- if ((newlines || comments) && ip->fname != 0)
- argptr->raw_length
- = final_start +
- discard_comments (argptr->raw + final_start,
- argptr->raw_length - final_start,
- newlines);
- argptr->raw[argptr->raw_length] = 0;
- if (argptr->raw_length > bufsize + extra)
- abort ();
- }
- }
-
- /* If we are not discarding this argument,
- macroexpand it and compute its length as stringified.
- All this info goes into *ARGPTR. */
-
- if (argptr != 0) {
- register U_CHAR *buf, *lim;
- register int totlen;
-
- buf = argptr->raw;
- lim = buf + argptr->raw_length;
-
- while (buf != lim && is_space[*buf])
- buf++;
- while (buf != lim && is_space[lim[-1]])
- lim--;
- totlen = traditional ? 0 : 2; /* Count opening and closing quote. */
- while (buf != lim) {
- register U_CHAR c = *buf++;
- totlen++;
- /* Internal sequences of whitespace are replaced by one space
- in most cases, but not always. So count all the whitespace
- in case we need to keep it all. */
-#if 0
- if (is_space[c])
- SKIP_ALL_WHITE_SPACE (buf);
- else
-#endif
- if (c == '\"' || c == '\\') /* escape these chars */
- totlen++;
- else if (!isprint (c))
- totlen += 3;
- }
- argptr->stringified_length = totlen;
- }
- return result;
-}
-
-/* Scan text from START (inclusive) up to LIMIT (exclusive),
- counting parens in *DEPTHPTR,
- and return if reach LIMIT
- or before a `)' that would make *DEPTHPTR negative
- or before a comma when *DEPTHPTR is zero.
- Single and double quotes are matched and termination
- is inhibited within them. Comments also inhibit it.
- Value returned is pointer to stopping place.
-
- Increment *NEWLINES each time a newline is passed.
- REST_ARGS notifies macarg1 that it should absorb the rest of the args.
- Set *COMMENTS to 1 if a comment is seen. */
-
-static U_CHAR *
-macarg1 (start, limit, depthptr, newlines, comments, rest_args)
- U_CHAR *start;
- register U_CHAR *limit;
- int *depthptr, *newlines, *comments;
- int rest_args;
-{
- register U_CHAR *bp = start;
-
- while (bp < limit) {
- switch (*bp) {
- case '(':
- (*depthptr)++;
- break;
- case ')':
- if (--(*depthptr) < 0)
- return bp;
- break;
- case '\\':
- /* Traditionally, backslash makes following char not special. */
- if (bp + 1 < limit && traditional)
- {
- bp++;
- /* But count source lines anyway. */
- if (*bp == '\n')
- ++*newlines;
- }
- break;
- case '\n':
- ++*newlines;
- break;
- case '/':
- if (bp[1] == '\\' && bp[2] == '\n')
- newline_fix (bp + 1);
- if (bp[1] == '*') {
- *comments = 1;
- for (bp += 2; bp < limit; bp++) {
- if (*bp == '\n')
- ++*newlines;
- else if (*bp == '*') {
- if (bp[-1] == '/' && warn_comments)
- warning ("`/*' within comment");
- if (bp[1] == '\\' && bp[2] == '\n')
- newline_fix (bp + 1);
- if (bp[1] == '/') {
- bp++;
- break;
- }
- }
- }
- } else if (bp[1] == '/' && cplusplus_comments) {
- *comments = 1;
- for (bp += 2; bp < limit; bp++) {
- if (*bp == '\n') {
- ++*newlines;
- if (bp[-1] != '\\')
- break;
- if (warn_comments)
- warning ("multiline `//' comment");
- }
- }
- }
- break;
- case '\'':
- case '\"':
- {
- int quotec;
- for (quotec = *bp++; bp + 1 < limit && *bp != quotec; bp++) {
- if (*bp == '\\') {
- bp++;
- if (*bp == '\n')
- ++*newlines;
- while (*bp == '\\' && bp[1] == '\n') {
- bp += 2;
- }
- } else if (*bp == '\n') {
- ++*newlines;
- if (quotec == '\'')
- break;
- }
- }
- }
- break;
- case ',':
- /* if we've returned to lowest level and we aren't absorbing all args */
- if ((*depthptr) == 0 && rest_args == 0)
- return bp;
- break;
- }
- bp++;
- }
-
- return bp;
-}
-
-/* Discard comments and duplicate newlines
- in the string of length LENGTH at START,
- except inside of string constants.
- The string is copied into itself with its beginning staying fixed.
-
- NEWLINES is the number of newlines that must be duplicated.
- We assume that that much extra space is available past the end
- of the string. */
-
-static int
-discard_comments (start, length, newlines)
- U_CHAR *start;
- int length;
- int newlines;
-{
- register U_CHAR *ibp;
- register U_CHAR *obp;
- register U_CHAR *limit;
- register int c;
-
- /* If we have newlines to duplicate, copy everything
- that many characters up. Then, in the second part,
- we will have room to insert the newlines
- while copying down.
- NEWLINES may actually be too large, because it counts
- newlines in string constants, and we don't duplicate those.
- But that does no harm. */
- if (newlines > 0) {
- ibp = start + length;
- obp = ibp + newlines;
- limit = start;
- while (limit != ibp)
- *--obp = *--ibp;
- }
-
- ibp = start + newlines;
- limit = start + length + newlines;
- obp = start;
-
- while (ibp < limit) {
- *obp++ = c = *ibp++;
- switch (c) {
- case '\n':
- /* Duplicate the newline. */
- *obp++ = '\n';
- break;
-
- case '\\':
- if (*ibp == '\n') {
- obp--;
- ibp++;
- }
- break;
-
- case '/':
- if (*ibp == '\\' && ibp[1] == '\n')
- newline_fix (ibp);
- /* Delete any comment. */
- if (cplusplus_comments && ibp[0] == '/') {
- /* Comments are equivalent to spaces. */
- obp[-1] = ' ';
- ibp++;
- while (ibp < limit && (*ibp != '\n' || ibp[-1] == '\\'))
- ibp++;
- break;
- }
- if (ibp[0] != '*' || ibp + 1 >= limit)
- break;
- /* Comments are equivalent to spaces.
- For -traditional, a comment is equivalent to nothing. */
- if (traditional)
- obp--;
- else
- obp[-1] = ' ';
- ibp++;
- while (ibp + 1 < limit) {
- if (ibp[0] == '*'
- && ibp[1] == '\\' && ibp[2] == '\n')
- newline_fix (ibp + 1);
- if (ibp[0] == '*' && ibp[1] == '/')
- break;
- ibp++;
- }
- ibp += 2;
- break;
-
- case '\'':
- case '\"':
- /* Notice and skip strings, so that we don't
- think that comments start inside them,
- and so we don't duplicate newlines in them. */
- {
- int quotec = c;
- while (ibp < limit) {
- *obp++ = c = *ibp++;
- if (c == quotec)
- break;
- if (c == '\n' && quotec == '\'')
- break;
- if (c == '\\' && ibp < limit) {
- while (*ibp == '\\' && ibp[1] == '\n')
- ibp += 2;
- *obp++ = *ibp++;
- }
- }
- }
- break;
- }
- }
-
- return obp - start;
-}
-
-/* Turn newlines to spaces in the string of length LENGTH at START,
- except inside of string constants.
- The string is copied into itself with its beginning staying fixed. */
-
-static int
-change_newlines (start, length)
- U_CHAR *start;
- int length;
-{
- register U_CHAR *ibp;
- register U_CHAR *obp;
- register U_CHAR *limit;
- register int c;
-
- ibp = start;
- limit = start + length;
- obp = start;
-
- while (ibp < limit) {
- *obp++ = c = *ibp++;
- switch (c) {
- case '\n':
- /* If this is a NEWLINE NEWLINE, then this is a real newline in the
- string. Skip past the newline and its duplicate.
- Put a space in the output. */
- if (*ibp == '\n')
- {
- ibp++;
- obp--;
- *obp++ = ' ';
- }
- break;
-
- case '\'':
- case '\"':
- /* Notice and skip strings, so that we don't delete newlines in them. */
- {
- int quotec = c;
- while (ibp < limit) {
- *obp++ = c = *ibp++;
- if (c == quotec)
- break;
- if (c == '\n' && quotec == '\'')
- break;
- }
- }
- break;
- }
- }
-
- return obp - start;
-}
-
-/* my_strerror - return the descriptive text associated with an
- `errno' code. */
-
-char *
-my_strerror (errnum)
- int errnum;
-{
- char *result;
-
-#ifndef VMS
-#ifndef HAVE_STRERROR
- result = (char *) ((errnum < sys_nerr) ? sys_errlist[errnum] : 0);
-#else
- result = strerror (errnum);
-#endif
-#else /* VMS */
- /* VAXCRTL's strerror() takes an optional second argument, which only
- matters when the first argument is EVMSERR. However, it's simplest
- just to pass it unconditionally. `vaxc$errno' is declared in
- <errno.h>, and maintained by the library in parallel with `errno'.
- We assume that caller's `errnum' either matches the last setting of
- `errno' by the library or else does not have the value `EVMSERR'. */
-
- result = strerror (errnum, vaxc$errno);
-#endif
-
- if (!result)
- result = "undocumented I/O error";
-
- return result;
-}
-
-/* error - print error message and increment count of errors. */
-
-void
-error (PRINTF_ALIST (msg))
- PRINTF_DCL (msg)
-{
- va_list args;
-
- VA_START (args, msg);
- verror (msg, args);
- va_end (args);
-}
-
-static void
-verror (msg, args)
- char *msg;
- va_list args;
-{
- int i;
- FILE_BUF *ip = NULL;
-
- print_containing_files ();
-
- for (i = indepth; i >= 0; i--)
- if (instack[i].fname != NULL) {
- ip = &instack[i];
- break;
- }
-
- if (ip != NULL)
- fprintf (stderr, "%s:%d: ", ip->nominal_fname, ip->lineno);
- vfprintf (stderr, msg, args);
- fprintf (stderr, "\n");
- errors++;
-}
-
-/* Error including a message from `errno'. */
-
-static void
-error_from_errno (name)
- char *name;
-{
- int i;
- FILE_BUF *ip = NULL;
-
- print_containing_files ();
-
- for (i = indepth; i >= 0; i--)
- if (instack[i].fname != NULL) {
- ip = &instack[i];
- break;
- }
-
- if (ip != NULL)
- fprintf (stderr, "%s:%d: ", ip->nominal_fname, ip->lineno);
-
- fprintf (stderr, "%s: %s\n", name, my_strerror (errno));
-
- errors++;
-}
-
-/* Print error message but don't count it. */
-
-void
-warning (PRINTF_ALIST (msg))
- PRINTF_DCL (msg)
-{
- va_list args;
-
- VA_START (args, msg);
- vwarning (msg, args);
- va_end (args);
-}
-
-static void
-vwarning (msg, args)
- char *msg;
- va_list args;
-{
- int i;
- FILE_BUF *ip = NULL;
-
- if (inhibit_warnings)
- return;
-
- if (warnings_are_errors)
- errors++;
-
- print_containing_files ();
-
- for (i = indepth; i >= 0; i--)
- if (instack[i].fname != NULL) {
- ip = &instack[i];
- break;
- }
-
- if (ip != NULL)
- fprintf (stderr, "%s:%d: ", ip->nominal_fname, ip->lineno);
- fprintf (stderr, "warning: ");
- vfprintf (stderr, msg, args);
- fprintf (stderr, "\n");
-}
-
-static void
-#if defined (__STDC__) && defined (HAVE_VPRINTF)
-error_with_line (int line, PRINTF_ALIST (msg))
-#else
-error_with_line (line, PRINTF_ALIST (msg))
- int line;
- PRINTF_DCL (msg)
-#endif
-{
- va_list args;
-
- VA_START (args, msg);
- verror_with_line (line, msg, args);
- va_end (args);
-}
-
-static void
-verror_with_line (line, msg, args)
- int line;
- char *msg;
- va_list args;
-{
- int i;
- FILE_BUF *ip = NULL;
-
- print_containing_files ();
-
- for (i = indepth; i >= 0; i--)
- if (instack[i].fname != NULL) {
- ip = &instack[i];
- break;
- }
-
- if (ip != NULL)
- fprintf (stderr, "%s:%d: ", ip->nominal_fname, line);
- vfprintf (stderr, msg, args);
- fprintf (stderr, "\n");
- errors++;
-}
-
-static void
-#if defined (__STDC__) && defined (HAVE_VPRINTF)
-warning_with_line (int line, PRINTF_ALIST (msg))
-#else
-warning_with_line (line, PRINTF_ALIST (msg))
- int line;
- PRINTF_DCL (msg)
-#endif
-{
- va_list args;
-
- VA_START (args, msg);
- vwarning_with_line (line, msg, args);
- va_end (args);
-}
-
-static void
-vwarning_with_line (line, msg, args)
- int line;
- char *msg;
- va_list args;
-{
- int i;
- FILE_BUF *ip = NULL;
-
- if (inhibit_warnings)
- return;
-
- if (warnings_are_errors)
- errors++;
-
- print_containing_files ();
-
- for (i = indepth; i >= 0; i--)
- if (instack[i].fname != NULL) {
- ip = &instack[i];
- break;
- }
-
- if (ip != NULL)
- fprintf (stderr, line ? "%s:%d: " : "%s: ", ip->nominal_fname, line);
- fprintf (stderr, "warning: ");
- vfprintf (stderr, msg, args);
- fprintf (stderr, "\n");
-}
-
-/* Print an error message and maybe count it. */
-
-void
-pedwarn (PRINTF_ALIST (msg))
- PRINTF_DCL (msg)
-{
- va_list args;
-
- VA_START (args, msg);
- if (pedantic_errors)
- verror (msg, args);
- else
- vwarning (msg, args);
- va_end (args);
-}
-
-void
-#if defined (__STDC__) && defined (HAVE_VPRINTF)
-pedwarn_with_line (int line, PRINTF_ALIST (msg))
-#else
-pedwarn_with_line (line, PRINTF_ALIST (msg))
- int line;
- PRINTF_DCL (msg)
-#endif
-{
- va_list args;
-
- VA_START (args, msg);
- if (pedantic_errors)
- verror_with_line (line, msg, args);
- else
- vwarning_with_line (line, msg, args);
- va_end (args);
-}
-
-/* Report a warning (or an error if pedantic_errors)
- giving specified file name and line number, not current. */
-
-static void
-#if defined (__STDC__) && defined (HAVE_VPRINTF)
-pedwarn_with_file_and_line (char *file, int line, PRINTF_ALIST (msg))
-#else
-pedwarn_with_file_and_line (file, line, PRINTF_ALIST (msg))
- char *file;
- int line;
- PRINTF_DCL (msg)
-#endif
-{
- va_list args;
-
- if (!pedantic_errors && inhibit_warnings)
- return;
- if (file != NULL)
- fprintf (stderr, "%s:%d: ", file, line);
- if (pedantic_errors)
- errors++;
- if (!pedantic_errors)
- fprintf (stderr, "warning: ");
- VA_START (args, msg);
- vfprintf (stderr, msg, args);
- va_end (args);
- fprintf (stderr, "\n");
-}
-
-/* Print the file names and line numbers of the #include
- directives which led to the current file. */
-
-static void
-print_containing_files ()
-{
- FILE_BUF *ip = NULL;
- int i;
- int first = 1;
-
- /* If stack of files hasn't changed since we last printed
- this info, don't repeat it. */
- if (last_error_tick == input_file_stack_tick)
- return;
-
- for (i = indepth; i >= 0; i--)
- if (instack[i].fname != NULL) {
- ip = &instack[i];
- break;
- }
-
- /* Give up if we don't find a source file. */
- if (ip == NULL)
- return;
-
- /* Find the other, outer source files. */
- for (i--; i >= 0; i--)
- if (instack[i].fname != NULL) {
- ip = &instack[i];
- if (first) {
- first = 0;
- fprintf (stderr, "In file included");
- } else {
- fprintf (stderr, ",\n ");
- }
-
- fprintf (stderr, " from %s:%d", ip->nominal_fname, ip->lineno);
- }
- if (! first)
- fprintf (stderr, ":\n");
-
- /* Record we have printed the status as of this time. */
- last_error_tick = input_file_stack_tick;
-}
-
-/* Return the line at which an error occurred.
- The error is not necessarily associated with the current spot
- in the input stack, so LINE says where. LINE will have been
- copied from ip->lineno for the current input level.
- If the current level is for a file, we return LINE.
- But if the current level is not for a file, LINE is meaningless.
- In that case, we return the lineno of the innermost file. */
-
-static int
-line_for_error (line)
- int line;
-{
- int i;
- int line1 = line;
-
- for (i = indepth; i >= 0; ) {
- if (instack[i].fname != 0)
- return line1;
- i--;
- if (i < 0)
- return 0;
- line1 = instack[i].lineno;
- }
- abort ();
- /*NOTREACHED*/
- return 0;
-}
-
-/*
- * If OBUF doesn't have NEEDED bytes after OPTR, make it bigger.
- *
- * As things stand, nothing is ever placed in the output buffer to be
- * removed again except when it's KNOWN to be part of an identifier,
- * so flushing and moving down everything left, instead of expanding,
- * should work ok.
- */
-
-/* You might think void was cleaner for the return type,
- but that would get type mismatch in check_expand in strict ANSI. */
-
-static int
-grow_outbuf (obuf, needed)
- register FILE_BUF *obuf;
- register int needed;
-{
- register U_CHAR *p;
- int minsize;
-
- if (obuf->length - (obuf->bufp - obuf->buf) > needed)
- return 0;
-
- /* Make it at least twice as big as it is now. */
- obuf->length *= 2;
- /* Make it have at least 150% of the free space we will need. */
- minsize = (3 * needed) / 2 + (obuf->bufp - obuf->buf);
- if (minsize > obuf->length)
- obuf->length = minsize;
-
- if ((p = (U_CHAR *) xrealloc (obuf->buf, obuf->length)) == NULL)
- memory_full ();
-
- obuf->bufp = p + (obuf->bufp - obuf->buf);
- obuf->buf = p;
-
- return 0;
-}
-
-/* Symbol table for macro names and special symbols */
-
-/*
- * install a name in the main hash table, even if it is already there.
- * name stops with first non alphanumeric, except leading '#'.
- * caller must check against redefinition if that is desired.
- * delete_macro () removes things installed by install () in fifo order.
- * this is important because of the `defined' special symbol used
- * in #if, and also if pushdef/popdef directives are ever implemented.
- *
- * If LEN is >= 0, it is the length of the name.
- * Otherwise, compute the length by scanning the entire name.
- *
- * If HASH is >= 0, it is the precomputed hash code.
- * Otherwise, compute the hash code.
- */
-
-static HASHNODE *
-install (name, len, type, value, hash)
- U_CHAR *name;
- int len;
- enum node_type type;
- char *value;
- int hash;
-{
- register HASHNODE *hp;
- register int i, bucket;
- register U_CHAR *p, *q;
-
- if (len < 0) {
- p = name;
- while (is_idchar[*p])
- p++;
- len = p - name;
- }
-
- if (hash < 0)
- hash = hashf (name, len, HASHSIZE);
-
- i = sizeof (HASHNODE) + len + 1;
- hp = (HASHNODE *) xmalloc (i);
- bucket = hash;
- hp->bucket_hdr = &hashtab[bucket];
- hp->next = hashtab[bucket];
- hashtab[bucket] = hp;
- hp->prev = NULL;
- if (hp->next != NULL)
- hp->next->prev = hp;
- hp->type = type;
- hp->length = len;
- hp->value.cpval = value;
- hp->name = ((U_CHAR *) hp) + sizeof (HASHNODE);
- p = hp->name;
- q = name;
- for (i = 0; i < len; i++)
- *p++ = *q++;
- hp->name[len] = 0;
- return hp;
-}
-
-/*
- * find the most recent hash node for name name (ending with first
- * non-identifier char) installed by install
- *
- * If LEN is >= 0, it is the length of the name.
- * Otherwise, compute the length by scanning the entire name.
- *
- * If HASH is >= 0, it is the precomputed hash code.
- * Otherwise, compute the hash code.
- */
-
-HASHNODE *
-lookup (name, len, hash)
- U_CHAR *name;
- int len;
- int hash;
-{
- register U_CHAR *bp;
- register HASHNODE *bucket;
-
- if (len < 0) {
- for (bp = name; is_idchar[*bp]; bp++) ;
- len = bp - name;
- }
-
- if (hash < 0)
- hash = hashf (name, len, HASHSIZE);
-
- bucket = hashtab[hash];
- while (bucket) {
- if (bucket->length == len && bcmp (bucket->name, name, len) == 0)
- return bucket;
- bucket = bucket->next;
- }
- return NULL;
-}
-
-/*
- * Delete a hash node. Some weirdness to free junk from macros.
- * More such weirdness will have to be added if you define more hash
- * types that need it.
- */
-
-/* Note that the DEFINITION of a macro is removed from the hash table
- but its storage is not freed. This would be a storage leak
- except that it is not reasonable to keep undefining and redefining
- large numbers of macros many times.
- In any case, this is necessary, because a macro can be #undef'd
- in the middle of reading the arguments to a call to it.
- If #undef freed the DEFINITION, that would crash. */
-
-static void
-delete_macro (hp)
- HASHNODE *hp;
-{
-
- if (hp->prev != NULL)
- hp->prev->next = hp->next;
- if (hp->next != NULL)
- hp->next->prev = hp->prev;
-
- /* Make sure that the bucket chain header that the deleted guy was
- on points to the right thing afterwards. */
- if (hp == *hp->bucket_hdr)
- *hp->bucket_hdr = hp->next;
-
-#if 0
- if (hp->type == T_MACRO) {
- DEFINITION *d = hp->value.defn;
- struct reflist *ap, *nextap;
-
- for (ap = d->pattern; ap != NULL; ap = nextap) {
- nextap = ap->next;
- free (ap);
- }
- free (d);
- }
-#endif
- free (hp);
-}
-
-/*
- * return hash function on name. must be compatible with the one
- * computed a step at a time, elsewhere
- */
-
-static int
-hashf (name, len, hashsize)
- register U_CHAR *name;
- register int len;
- int hashsize;
-{
- register int r = 0;
-
- while (len--)
- r = HASHSTEP (r, *name++);
-
- return MAKE_POS (r) % hashsize;
-}
-
-
-/* Dump the definition of a single macro HP to OF. */
-
-static void
-dump_single_macro (hp, of)
- register HASHNODE *hp;
- FILE *of;
-{
- register DEFINITION *defn = hp->value.defn;
- struct reflist *ap;
- int offset;
- int concat;
-
-
- /* Print the definition of the macro HP. */
-
- fprintf (of, "#define %s", hp->name);
-
- if (defn->nargs >= 0) {
- int i;
-
- fprintf (of, "(");
- for (i = 0; i < defn->nargs; i++) {
- dump_arg_n (defn, i, of);
- if (i + 1 < defn->nargs)
- fprintf (of, ", ");
- }
- fprintf (of, ")");
- }
-
- fprintf (of, " ");
-
- offset = 0;
- concat = 0;
- for (ap = defn->pattern; ap != NULL; ap = ap->next) {
- dump_defn_1 (defn->expansion, offset, ap->nchars, of);
- offset += ap->nchars;
- if (!traditional) {
- if (ap->nchars != 0)
- concat = 0;
- if (ap->stringify) {
- switch (ap->stringify) {
- case SHARP_TOKEN: fprintf (of, "#"); break;
- case WHITE_SHARP_TOKEN: fprintf (of, "# "); break;
- case PERCENT_COLON_TOKEN: fprintf (of, "%%:"); break;
- case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%: "); break;
- default: abort ();
- }
- }
- if (ap->raw_before != 0) {
- if (concat) {
- switch (ap->raw_before) {
- case WHITE_SHARP_TOKEN:
- case WHITE_PERCENT_COLON_TOKEN:
- fprintf (of, " ");
- break;
- default:
- break;
- }
- } else {
- switch (ap->raw_before) {
- case SHARP_TOKEN: fprintf (of, "##"); break;
- case WHITE_SHARP_TOKEN: fprintf (of, "## "); break;
- case PERCENT_COLON_TOKEN: fprintf (of, "%%:%%:"); break;
- case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%:%%: "); break;
- default: abort ();
- }
- }
- }
- concat = 0;
- }
- dump_arg_n (defn, ap->argno, of);
- if (!traditional && ap->raw_after != 0) {
- switch (ap->raw_after) {
- case SHARP_TOKEN: fprintf (of, "##"); break;
- case WHITE_SHARP_TOKEN: fprintf (of, " ##"); break;
- case PERCENT_COLON_TOKEN: fprintf (of, "%%:%%:"); break;
- case WHITE_PERCENT_COLON_TOKEN: fprintf (of, " %%:%%:"); break;
- default: abort ();
- }
- concat = 1;
- }
- }
- dump_defn_1 (defn->expansion, offset, defn->length - offset, of);
- fprintf (of, "\n");
-}
-
-/* Dump all macro definitions as #defines to stdout. */
-
-static void
-dump_all_macros ()
-{
- int bucket;
-
- for (bucket = 0; bucket < HASHSIZE; bucket++) {
- register HASHNODE *hp;
-
- for (hp = hashtab[bucket]; hp; hp= hp->next) {
- if (hp->type == T_MACRO)
- dump_single_macro (hp, stdout);
- }
- }
-}
-
-/* Output to OF a substring of a macro definition.
- BASE is the beginning of the definition.
- Output characters START thru LENGTH.
- Unless traditional, discard newlines outside of strings, thus
- converting funny-space markers to ordinary spaces. */
-
-static void
-dump_defn_1 (base, start, length, of)
- U_CHAR *base;
- int start;
- int length;
- FILE *of;
-{
- U_CHAR *p = base + start;
- U_CHAR *limit = base + start + length;
-
- if (traditional)
- fwrite (p, sizeof (*p), length, of);
- else {
- while (p < limit) {
- if (*p == '\"' || *p =='\'') {
- U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR,
- NULL_PTR, NULL_PTR);
- fwrite (p, sizeof (*p), p1 - p, of);
- p = p1;
- } else {
- if (*p != '\n')
- putc (*p, of);
- p++;
- }
- }
- }
-}
-
-/* Print the name of argument number ARGNUM of macro definition DEFN
- to OF.
- Recall that DEFN->args.argnames contains all the arg names
- concatenated in reverse order with comma-space in between. */
-
-static void
-dump_arg_n (defn, argnum, of)
- DEFINITION *defn;
- int argnum;
- FILE *of;
-{
- register U_CHAR *p = defn->args.argnames;
- while (argnum + 1 < defn->nargs) {
- p = (U_CHAR *) index ((char *) p, ' ') + 1;
- argnum++;
- }
-
- while (*p && *p != ',') {
- putc (*p, of);
- p++;
- }
-}
-
-/* Initialize syntactic classifications of characters. */
-
-static void
-initialize_char_syntax ()
-{
- register int i;
-
- /*
- * Set up is_idchar and is_idstart tables. These should be
- * faster than saying (is_alpha (c) || c == '_'), etc.
- * Set up these things before calling any routines tthat
- * refer to them.
- */
- for (i = 'a'; i <= 'z'; i++) {
- is_idchar[i - 'a' + 'A'] = 1;
- is_idchar[i] = 1;
- is_idstart[i - 'a' + 'A'] = 1;
- is_idstart[i] = 1;
- }
- for (i = '0'; i <= '9'; i++)
- is_idchar[i] = 1;
- is_idchar['_'] = 1;
- is_idstart['_'] = 1;
- is_idchar['$'] = 1;
- is_idstart['$'] = 1;
-
- /* horizontal space table */
- is_hor_space[' '] = 1;
- is_hor_space['\t'] = 1;
- is_hor_space['\v'] = 1;
- is_hor_space['\f'] = 1;
- is_hor_space['\r'] = 1;
-
- is_space[' '] = 1;
- is_space['\t'] = 1;
- is_space['\v'] = 1;
- is_space['\f'] = 1;
- is_space['\n'] = 1;
- is_space['\r'] = 1;
-
- char_name['\v'] = "vertical tab";
- char_name['\f'] = "formfeed";
- char_name['\r'] = "carriage return";
-}
-
-/* Initialize the built-in macros. */
-
-static void
-initialize_builtins (inp, outp)
- FILE_BUF *inp;
- FILE_BUF *outp;
-{
- install ((U_CHAR *) "__LINE__", -1, T_SPECLINE, NULL_PTR, -1);
- install ((U_CHAR *) "__DATE__", -1, T_DATE, NULL_PTR, -1);
- install ((U_CHAR *) "__FILE__", -1, T_FILE, NULL_PTR, -1);
- install ((U_CHAR *) "__BASE_FILE__", -1, T_BASE_FILE, NULL_PTR, -1);
- install ((U_CHAR *) "__INCLUDE_LEVEL__", -1, T_INCLUDE_LEVEL, NULL_PTR, -1);
- install ((U_CHAR *) "__VERSION__", -1, T_VERSION, NULL_PTR, -1);
-#ifndef NO_BUILTIN_SIZE_TYPE
- install ((U_CHAR *) "__SIZE_TYPE__", -1, T_SIZE_TYPE, NULL_PTR, -1);
-#endif
-#ifndef NO_BUILTIN_PTRDIFF_TYPE
- install ((U_CHAR *) "__PTRDIFF_TYPE__ ", -1, T_PTRDIFF_TYPE, NULL_PTR, -1);
-#endif
- install ((U_CHAR *) "__WCHAR_TYPE__", -1, T_WCHAR_TYPE, NULL_PTR, -1);
- install ((U_CHAR *) "__USER_LABEL_PREFIX__", -1, T_USER_LABEL_PREFIX_TYPE,
- NULL_PTR, -1);
- install ((U_CHAR *) "__REGISTER_PREFIX__", -1, T_REGISTER_PREFIX_TYPE,
- NULL_PTR, -1);
- install ((U_CHAR *) "__IMMEDIATE_PREFIX__", -1, T_IMMEDIATE_PREFIX_TYPE,
- NULL_PTR, -1);
- install ((U_CHAR *) "__TIME__", -1, T_TIME, NULL_PTR, -1);
- if (!traditional) {
- install ((U_CHAR *) "__STDC__", -1, T_CONST, "1", -1);
- install ((U_CHAR *) "__STDC_VERSION__", -1, T_CONST, "199409L", -1);
- }
- if (objc)
- install ((U_CHAR *) "__OBJC__", -1, T_CONST, "1", -1);
-/* This is supplied using a -D by the compiler driver
- so that it is present only when truly compiling with GNU C. */
-/* install ((U_CHAR *) "__GNUC__", -1, T_CONST, "2", -1); */
- install ((U_CHAR *) "__HAVE_BUILTIN_SETJMP__", -1, T_CONST, "1", -1);
-
- if (debug_output)
- {
- char directive[2048];
- U_CHAR *udirective = (U_CHAR *) directive;
- register struct directive *dp = &directive_table[0];
- struct tm *timebuf = timestamp ();
-
- sprintf (directive, " __BASE_FILE__ \"%s\"\n",
- instack[0].nominal_fname);
- output_line_directive (inp, outp, 0, same_file);
- pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
-
- sprintf (directive, " __VERSION__ \"%s\"\n", version_string);
- output_line_directive (inp, outp, 0, same_file);
- pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
-
-#ifndef NO_BUILTIN_SIZE_TYPE
- sprintf (directive, " __SIZE_TYPE__ %s\n", SIZE_TYPE);
- output_line_directive (inp, outp, 0, same_file);
- pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
-#endif
-
-#ifndef NO_BUILTIN_PTRDIFF_TYPE
- sprintf (directive, " __PTRDIFF_TYPE__ %s\n", PTRDIFF_TYPE);
- output_line_directive (inp, outp, 0, same_file);
- pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
-#endif
-
- sprintf (directive, " __WCHAR_TYPE__ %s\n", wchar_type);
- output_line_directive (inp, outp, 0, same_file);
- pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
-
- sprintf (directive, " __DATE__ \"%s %2d %4d\"\n",
- monthnames[timebuf->tm_mon],
- timebuf->tm_mday, timebuf->tm_year + 1900);
- output_line_directive (inp, outp, 0, same_file);
- pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
-
- sprintf (directive, " __TIME__ \"%02d:%02d:%02d\"\n",
- timebuf->tm_hour, timebuf->tm_min, timebuf->tm_sec);
- output_line_directive (inp, outp, 0, same_file);
- pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
-
- if (!traditional)
- {
- sprintf (directive, " __STDC__ 1");
- output_line_directive (inp, outp, 0, same_file);
- pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
- }
- if (objc)
- {
- sprintf (directive, " __OBJC__ 1");
- output_line_directive (inp, outp, 0, same_file);
- pass_thru_directive (udirective, &udirective[strlen (directive)],
- outp, dp);
- }
- }
-}
-
-/*
- * process a given definition string, for initialization
- * If STR is just an identifier, define it with value 1.
- * If STR has anything after the identifier, then it should
- * be identifier=definition.
- */
-
-static void
-make_definition (str, op)
- char *str;
- FILE_BUF *op;
-{
- FILE_BUF *ip;
- struct directive *kt;
- U_CHAR *buf, *p;
-
- p = buf = (U_CHAR *) str;
- if (!is_idstart[*p]) {
- error ("malformed option `-D %s'", str);
- return;
- }
- while (is_idchar[*++p])
- ;
- if (*p == '(') {
- while (is_idchar[*++p] || *p == ',' || is_hor_space[*p])
- ;
- if (*p++ != ')')
- p = (U_CHAR *) str; /* Error */
- }
- if (*p == 0) {
- buf = (U_CHAR *) alloca (p - buf + 4);
- strcpy ((char *)buf, str);
- strcat ((char *)buf, " 1");
- } else if (*p != '=') {
- error ("malformed option `-D %s'", str);
- return;
- } else {
- U_CHAR *q;
- /* Copy the entire option so we can modify it. */
- buf = (U_CHAR *) alloca (2 * strlen (str) + 1);
- strncpy ((char *) buf, str, p - (U_CHAR *) str);
- /* Change the = to a space. */
- buf[p - (U_CHAR *) str] = ' ';
- /* Scan for any backslash-newline and remove it. */
- p++;
- q = &buf[p - (U_CHAR *) str];
- while (*p) {
- if (*p == '\"' || *p == '\'') {
- int unterminated = 0;
- U_CHAR *p1 = skip_quoted_string (p, p + strlen ((char *) p), 0,
- NULL_PTR, NULL_PTR, &unterminated);
- if (unterminated)
- return;
- while (p != p1)
- if (*p == '\\' && p[1] == '\n')
- p += 2;
- else
- *q++ = *p++;
- } else if (*p == '\\' && p[1] == '\n')
- p += 2;
- /* Change newline chars into newline-markers. */
- else if (*p == '\n')
- {
- *q++ = '\n';
- *q++ = '\n';
- p++;
- }
- else
- *q++ = *p++;
- }
- *q = 0;
- }
-
- ip = &instack[++indepth];
- ip->nominal_fname = ip->fname = "*Initialization*";
-
- ip->buf = ip->bufp = buf;
- ip->length = strlen ((char *) buf);
- ip->lineno = 1;
- ip->macro = 0;
- ip->free_ptr = 0;
- ip->if_stack = if_stack;
- ip->system_header_p = 0;
-
- for (kt = directive_table; kt->type != T_DEFINE; kt++)
- ;
-
- /* Pass NULL instead of OP, since this is a "predefined" macro. */
- do_define (buf, buf + strlen ((char *) buf), NULL_PTR, kt);
- --indepth;
-}
-
-/* JF, this does the work for the -U option */
-
-static void
-make_undef (str, op)
- char *str;
- FILE_BUF *op;
-{
- FILE_BUF *ip;
- struct directive *kt;
-
- ip = &instack[++indepth];
- ip->nominal_fname = ip->fname = "*undef*";
-
- ip->buf = ip->bufp = (U_CHAR *) str;
- ip->length = strlen (str);
- ip->lineno = 1;
- ip->macro = 0;
- ip->free_ptr = 0;
- ip->if_stack = if_stack;
- ip->system_header_p = 0;
-
- for (kt = directive_table; kt->type != T_UNDEF; kt++)
- ;
-
- do_undef ((U_CHAR *) str, (U_CHAR *) str + strlen (str), op, kt);
- --indepth;
-}
-
-/* Process the string STR as if it appeared as the body of a #assert.
- OPTION is the option name for which STR was the argument. */
-
-static void
-make_assertion (option, str)
- char *option;
- char *str;
-{
- FILE_BUF *ip;
- struct directive *kt;
- U_CHAR *buf, *p, *q;
-
- /* Copy the entire option so we can modify it. */
- buf = (U_CHAR *) alloca (strlen (str) + 1);
- strcpy ((char *) buf, str);
- /* Scan for any backslash-newline and remove it. */
- p = q = buf;
- while (*p) {
- if (*p == '\\' && p[1] == '\n')
- p += 2;
- else
- *q++ = *p++;
- }
- *q = 0;
-
- p = buf;
- if (!is_idstart[*p]) {
- error ("malformed option `%s %s'", option, str);
- return;
- }
- while (is_idchar[*++p])
- ;
- SKIP_WHITE_SPACE (p);
- if (! (*p == 0 || *p == '(')) {
- error ("malformed option `%s %s'", option, str);
- return;
- }
-
- ip = &instack[++indepth];
- ip->nominal_fname = ip->fname = "*Initialization*";
-
- ip->buf = ip->bufp = buf;
- ip->length = strlen ((char *) buf);
- ip->lineno = 1;
- ip->macro = 0;
- ip->free_ptr = 0;
- ip->if_stack = if_stack;
- ip->system_header_p = 0;
-
- for (kt = directive_table; kt->type != T_ASSERT; kt++)
- ;
-
- /* Pass NULL as output ptr to do_define since we KNOW it never does
- any output.... */
- do_assert (buf, buf + strlen ((char *) buf) , NULL_PTR, kt);
- --indepth;
-}
-
-/* The previous include prefix, if any, is PREV_FILE_NAME.
- Allocate a new include prefix whose name is the
- simplified concatenation of PREFIX and NAME,
- with a trailing / added if needed.
- But return 0 if the include prefix should be ignored,
- e.g. because it is a duplicate of PREV_FILE_NAME. */
-
-static struct file_name_list *
-new_include_prefix (prev_file_name, prefix, name)
- struct file_name_list *prev_file_name;
- char *prefix;
- char *name;
-{
- if (!name)
- fatal ("Directory name missing after command line option");
-
- if (!*name)
- /* Ignore the empty string. */
- return 0;
- else {
- struct file_name_list *dir
- = ((struct file_name_list *)
- xmalloc (sizeof (struct file_name_list)
- + strlen (prefix) + strlen (name) + 1 /* for trailing / */));
- size_t len;
- strcpy (dir->fname, prefix);
- strcat (dir->fname, name);
- len = simplify_filename (dir->fname);
-
- /* Convert directory name to a prefix. */
- if (dir->fname[len - 1] != '/') {
- if (len == 1 && dir->fname[len - 1] == '.')
- len = 0;
- else
- dir->fname[len++] = '/';
- dir->fname[len] = 0;
- }
-
- /* Ignore a directory whose name matches the previous one. */
- if (prev_file_name && !strcmp (prev_file_name->fname, dir->fname)) {
- /* But treat `-Idir -I- -Idir' as `-I- -Idir'. */
- if (!first_bracket_include)
- first_bracket_include = prev_file_name;
- free (dir);
- return 0;
- }
-
-#ifndef VMS
- /* VMS can't stat dir prefixes, so skip these optimizations in VMS. */
-
- /* Ignore a nonexistent directory. */
- if (stat (len ? dir->fname : ".", &dir->st) != 0) {
- if (errno != ENOENT && errno != ENOTDIR)
- error_from_errno (dir->fname);
- free (dir);
- return 0;
- }
-
- /* Ignore a directory whose identity matches the previous one. */
- if (prev_file_name
- && INO_T_EQ (prev_file_name->st.st_ino, dir->st.st_ino)
- && prev_file_name->st.st_dev == dir->st.st_dev) {
- /* But treat `-Idir -I- -Idir' as `-I- -Idir'. */
- if (!first_bracket_include)
- first_bracket_include = prev_file_name;
- free (dir);
- return 0;
- }
-#endif /* ! VMS */
-
- dir->next = 0;
- dir->c_system_include_path = 0;
- dir->got_name_map = 0;
-
- return dir;
- }
-}
-
-/* Append a chain of `struct file_name_list's
- to the end of the main include chain.
- FIRST is the beginning of the chain to append, and LAST is the end. */
-
-static void
-append_include_chain (first, last)
- struct file_name_list *first, *last;
-{
- struct file_name_list *dir;
-
- if (!first || !last)
- return;
-
- if (include == 0)
- include = first;
- else
- last_include->next = first;
-
- if (first_bracket_include == 0)
- first_bracket_include = first;
-
- for (dir = first; ; dir = dir->next) {
- int len = strlen (dir->fname) + INCLUDE_LEN_FUDGE;
- if (len > max_include_len)
- max_include_len = len;
- if (dir == last)
- break;
- }
-
- last->next = NULL;
- last_include = last;
-}
-
-/* Add output to `deps_buffer' for the -M switch.
- STRING points to the text to be output.
- SPACER is ':' for targets, ' ' for dependencies. */
-
-static void
-deps_output (string, spacer)
- char *string;
- int spacer;
-{
- int size = strlen (string);
-
- if (size == 0)
- return;
-
-#ifndef MAX_OUTPUT_COLUMNS
-#define MAX_OUTPUT_COLUMNS 72
-#endif
- if (MAX_OUTPUT_COLUMNS - 1 /*spacer*/ - 2 /*` \'*/ < deps_column + size
- && 1 < deps_column) {
- bcopy (" \\\n ", &deps_buffer[deps_size], 4);
- deps_size += 4;
- deps_column = 1;
- if (spacer == ' ')
- spacer = 0;
- }
-
- if (deps_size + size + 8 > deps_allocated_size) {
- deps_allocated_size = (deps_size + size + 50) * 2;
- deps_buffer = xrealloc (deps_buffer, deps_allocated_size);
- }
- if (spacer == ' ') {
- deps_buffer[deps_size++] = ' ';
- deps_column++;
- }
- bcopy (string, &deps_buffer[deps_size], size);
- deps_size += size;
- deps_column += size;
- if (spacer == ':') {
- deps_buffer[deps_size++] = ':';
- deps_column++;
- }
- deps_buffer[deps_size] = 0;
-}
-
-static void
-fatal (PRINTF_ALIST (msg))
- PRINTF_DCL (msg)
-{
- va_list args;
-
- fprintf (stderr, "%s: ", progname);
- VA_START (args, msg);
- vfprintf (stderr, msg, args);
- va_end (args);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-static void
-perror_with_name (name)
- char *name;
-{
- fprintf (stderr, "%s: ", progname);
- fprintf (stderr, "%s: %s\n", name, my_strerror (errno));
- errors++;
-}
-
-static void
-pfatal_with_name (name)
- char *name;
-{
- perror_with_name (name);
-#ifdef VMS
- exit (vaxc$errno);
-#else
- exit (FATAL_EXIT_CODE);
-#endif
-}
-
-/* Handler for SIGPIPE. */
-
-static void
-pipe_closed (signo)
- /* If this is missing, some compilers complain. */
- int signo;
-{
- fatal ("output pipe has been closed");
-}
-
-static void
-memory_full ()
-{
- fatal ("Memory exhausted.");
-}
-
-
-GENERIC_PTR
-xmalloc (size)
- size_t size;
-{
- register GENERIC_PTR ptr = (GENERIC_PTR) malloc (size);
- if (!ptr)
- memory_full ();
- return ptr;
-}
-
-static GENERIC_PTR
-xrealloc (old, size)
- GENERIC_PTR old;
- size_t size;
-{
- register GENERIC_PTR ptr = (GENERIC_PTR) realloc (old, size);
- if (!ptr)
- memory_full ();
- return ptr;
-}
-
-static GENERIC_PTR
-xcalloc (number, size)
- size_t number, size;
-{
- register size_t total = number * size;
- register GENERIC_PTR ptr = (GENERIC_PTR) malloc (total);
- if (!ptr)
- memory_full ();
- bzero (ptr, total);
- return ptr;
-}
-
-static char *
-savestring (input)
- char *input;
-{
- size_t size = strlen (input);
- char *output = xmalloc (size + 1);
- strcpy (output, input);
- return output;
-}
-
-#ifdef VMS
-
-/* Under VMS we need to fix up the "include" specification filename so
- that everything following the 1st slash is changed into its correct
- VMS file specification. */
-
-static void
-hack_vms_include_specification (fname, vaxc_include)
- char *fname;
- int vaxc_include;
-{
- register char *cp, *cp1, *cp2;
- int f, check_filename_before_returning;
- char Local[512];
-
- check_filename_before_returning = 0;
-
- cp = base_name (fname);
-
- /*
- * Check if we have a vax-c style '#include filename'
- * and add the missing .h
- */
- if (vaxc_include && !index (cp,'.'))
- strcat (cp, ".h");
-
- cp2 = Local; /* initialize */
-
- /* We are trying to do a number of things here. First of all, we are
- trying to hammer the filenames into a standard format, such that later
- processing can handle them.
-
- If the file name contains something like [dir.], then it recognizes this
- as a root, and strips the ".]". Later processing will add whatever is
- needed to get things working properly.
-
- If no device is specified, then the first directory name is taken to be
- a device name (or a rooted logical). */
-
- /* See if we found that 1st slash */
- if (cp == 0) return; /* Nothing to do!!! */
- if (*cp != '/') return; /* Nothing to do!!! */
- /* Point to the UNIX filename part (which needs to be fixed!) */
- cp1 = cp+1;
- /* If the directory spec is not rooted, we can just copy
- the UNIX filename part and we are done */
- if (((cp - fname) > 1) && ((cp[-1] == ']') || (cp[-1] == '>'))) {
- if (cp[-2] != '.') {
- /*
- * The VMS part ends in a `]', and the preceding character is not a `.'.
- * We strip the `]', and then splice the two parts of the name in the
- * usual way. Given the default locations for include files in cccp.c,
- * we will only use this code if the user specifies alternate locations
- * with the /include (-I) switch on the command line. */
- cp -= 1; /* Strip "]" */
- cp1--; /* backspace */
- } else {
- /*
- * The VMS part has a ".]" at the end, and this will not do. Later
- * processing will add a second directory spec, and this would be a syntax
- * error. Thus we strip the ".]", and thus merge the directory specs.
- * We also backspace cp1, so that it points to a '/'. This inhibits the
- * generation of the 000000 root directory spec (which does not belong here
- * in this case).
- */
- cp -= 2; /* Strip ".]" */
- cp1--; }; /* backspace */
- } else {
-
- /* We drop in here if there is no VMS style directory specification yet.
- * If there is no device specification either, we make the first dir a
- * device and try that. If we do not do this, then we will be essentially
- * searching the users default directory (as if they did a #include "asdf.h").
- *
- * Then all we need to do is to push a '[' into the output string. Later
- * processing will fill this in, and close the bracket.
- */
- if (cp[-1] != ':') *cp2++ = ':'; /* dev not in spec. take first dir */
- *cp2++ = '['; /* Open the directory specification */
- }
-
- /* at this point we assume that we have the device spec, and (at least
- the opening "[" for a directory specification. We may have directories
- specified already */
-
- /* If there are no other slashes then the filename will be
- in the "root" directory. Otherwise, we need to add
- directory specifications. */
- if (index (cp1, '/') == 0) {
- /* Just add "000000]" as the directory string */
- strcpy (cp2, "000000]");
- cp2 += strlen (cp2);
- check_filename_before_returning = 1; /* we might need to fool with this later */
- } else {
- /* As long as there are still subdirectories to add, do them. */
- while (index (cp1, '/') != 0) {
- /* If this token is "." we can ignore it */
- if ((cp1[0] == '.') && (cp1[1] == '/')) {
- cp1 += 2;
- continue;
- }
- /* Add a subdirectory spec. Do not duplicate "." */
- if (cp2[-1] != '.' && cp2[-1] != '[' && cp2[-1] != '<')
- *cp2++ = '.';
- /* If this is ".." then the spec becomes "-" */
- if ((cp1[0] == '.') && (cp1[1] == '.') && (cp[2] == '/')) {
- /* Add "-" and skip the ".." */
- *cp2++ = '-';
- cp1 += 3;
- continue;
- }
- /* Copy the subdirectory */
- while (*cp1 != '/') *cp2++= *cp1++;
- cp1++; /* Skip the "/" */
- }
- /* Close the directory specification */
- if (cp2[-1] == '.') /* no trailing periods */
- cp2--;
- *cp2++ = ']';
- }
- /* Now add the filename */
- while (*cp1) *cp2++ = *cp1++;
- *cp2 = 0;
- /* Now append it to the original VMS spec. */
- strcpy (cp, Local);
-
- /* If we put a [000000] in the filename, try to open it first. If this fails,
- remove the [000000], and return that name. This provides flexibility
- to the user in that they can use both rooted and non-rooted logical names
- to point to the location of the file. */
-
- if (check_filename_before_returning) {
- f = open (fname, O_RDONLY, 0666);
- if (f >= 0) {
- /* The file name is OK as it is, so return it as is. */
- close (f);
- return;
- }
- /* The filename did not work. Try to remove the [000000] from the name,
- and return it. */
- cp = index (fname, '[');
- cp2 = index (fname, ']') + 1;
- strcpy (cp, cp2); /* this gets rid of it */
- }
- return;
-}
-#endif /* VMS */
-
-#ifdef VMS
-
-/* These are the read/write replacement routines for
- VAX-11 "C". They make read/write behave enough
- like their UNIX counterparts that CCCP will work */
-
-static int
-read (fd, buf, size)
- int fd;
- char *buf;
- int size;
-{
-#undef read /* Get back the REAL read routine */
- register int i;
- register int total = 0;
-
- /* Read until the buffer is exhausted */
- while (size > 0) {
- /* Limit each read to 32KB */
- i = (size > (32*1024)) ? (32*1024) : size;
- i = read (fd, buf, i);
- if (i <= 0) {
- if (i == 0) return (total);
- return (i);
- }
- /* Account for this read */
- total += i;
- buf += i;
- size -= i;
- }
- return (total);
-}
-
-static int
-write (fd, buf, size)
- int fd;
- char *buf;
- int size;
-{
-#undef write /* Get back the REAL write routine */
- int i;
- int j;
-
- /* Limit individual writes to 32Kb */
- i = size;
- while (i > 0) {
- j = (i > (32*1024)) ? (32*1024) : i;
- if (write (fd, buf, j) < 0) return (-1);
- /* Account for the data written */
- buf += j;
- i -= j;
- }
- return (size);
-}
-
-/* The following wrapper functions supply additional arguments to the VMS
- I/O routines to optimize performance with file handling. The arguments
- are:
- "mbc=16" - Set multi-block count to 16 (use a 8192 byte buffer).
- "deq=64" - When extending the file, extend it in chunks of 32Kbytes.
- "fop=tef"- Truncate unused portions of file when closing file.
- "shr=nil"- Disallow file sharing while file is open. */
-
-static FILE *
-freopen (fname, type, oldfile)
- char *fname;
- char *type;
- FILE *oldfile;
-{
-#undef freopen /* Get back the REAL fopen routine */
- if (strcmp (type, "w") == 0)
- return freopen (fname, type, oldfile, "mbc=16", "deq=64", "fop=tef", "shr=nil");
- return freopen (fname, type, oldfile, "mbc=16");
-}
-
-static FILE *
-fopen (fname, type)
- char *fname;
- char *type;
-{
-#undef fopen /* Get back the REAL fopen routine */
- /* The gcc-vms-1.42 distribution's header files prototype fopen with two
- fixed arguments, which matches ANSI's specification but not VAXCRTL's
- pre-ANSI implementation. This hack circumvents the mismatch problem. */
- FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
-
- if (*type == 'w')
- return (*vmslib_fopen) (fname, type, "mbc=32",
- "deq=64", "fop=tef", "shr=nil");
- else
- return (*vmslib_fopen) (fname, type, "mbc=32");
-}
-
-static int
-open (fname, flags, prot)
- char *fname;
- int flags;
- int prot;
-{
-#undef open /* Get back the REAL open routine */
- return open (fname, flags, prot, "mbc=16", "deq=64", "fop=tef");
-}
-
-/* more VMS hackery */
-#include <fab.h>
-#include <nam.h>
-
-extern unsigned long sys$parse(), sys$search();
-
-/* Work around another library bug. If a file is located via a searchlist,
- and if the device it's on is not the same device as the one specified
- in the first element of that searchlist, then both stat() and fstat()
- will fail to return info about it. `errno' will be set to EVMSERR, and
- `vaxc$errno' will be set to SS$_NORMAL due yet another bug in stat()!
- We can get around this by fully parsing the filename and then passing
- that absolute name to stat().
-
- Without this fix, we can end up failing to find header files, which is
- bad enough, but then compounding the problem by reporting the reason for
- failure as "normal successful completion." */
-
-#undef fstat /* get back to library version */
-
-static int
-VMS_fstat (fd, statbuf)
- int fd;
- struct stat *statbuf;
-{
- int result = fstat (fd, statbuf);
-
- if (result < 0)
- {
- FILE *fp;
- char nambuf[NAM$C_MAXRSS+1];
-
- if ((fp = fdopen (fd, "r")) != 0 && fgetname (fp, nambuf) != 0)
- result = VMS_stat (nambuf, statbuf);
- /* No fclose(fp) here; that would close(fd) as well. */
- }
-
- return result;
-}
-
-static int
-VMS_stat (name, statbuf)
- const char *name;
- struct stat *statbuf;
-{
- int result = stat (name, statbuf);
-
- if (result < 0)
- {
- struct FAB fab;
- struct NAM nam;
- char exp_nam[NAM$C_MAXRSS+1], /* expanded name buffer for sys$parse */
- res_nam[NAM$C_MAXRSS+1]; /* resultant name buffer for sys$search */
-
- fab = cc$rms_fab;
- fab.fab$l_fna = (char *) name;
- fab.fab$b_fns = (unsigned char) strlen (name);
- fab.fab$l_nam = (void *) &nam;
- nam = cc$rms_nam;
- nam.nam$l_esa = exp_nam, nam.nam$b_ess = sizeof exp_nam - 1;
- nam.nam$l_rsa = res_nam, nam.nam$b_rss = sizeof res_nam - 1;
- nam.nam$b_nop = NAM$M_PWD | NAM$M_NOCONCEAL;
- if (sys$parse (&fab) & 1)
- {
- if (sys$search (&fab) & 1)
- {
- res_nam[nam.nam$b_rsl] = '\0';
- result = stat (res_nam, statbuf);
- }
- /* Clean up searchlist context cached by the system. */
- nam.nam$b_nop = NAM$M_SYNCHK;
- fab.fab$l_fna = 0, fab.fab$b_fns = 0;
- (void) sys$parse (&fab);
- }
- }
-
- return result;
-}
-#endif /* VMS */
diff --git a/gcc/cexp.y b/gcc/cexp.y
deleted file mode 100644
index 2d2d34f8b28..00000000000
--- a/gcc/cexp.y
+++ /dev/null
@@ -1,1213 +0,0 @@
-/* Parse C expressions for CCCP.
- Copyright (C) 1987, 1992, 1994, 1995, 1996, 1997 Free Software Foundation.
-
-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, 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.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding!
-
- Adapted from expread.y of GDB by Paul Rubin, July 1986. */
-
-/* Parse a C expression from text in a string */
-
-%{
-#include "config.h"
-#include <setjmp.h>
-/* #define YYDEBUG 1 */
-
-/* The following symbols should be autoconfigured:
- HAVE_STDLIB_H
- STDC_HEADERS
- In the mean time, we'll get by with approximations based
- on existing GCC configuration symbols. */
-
-#ifdef POSIX
-# ifndef HAVE_STDLIB_H
-# define HAVE_STDLIB_H 1
-# endif
-# ifndef STDC_HEADERS
-# define STDC_HEADERS 1
-# endif
-#endif /* defined (POSIX) */
-
-#if STDC_HEADERS
-# include <string.h>
-#endif
-
-#if HAVE_STDLIB_H || defined (MULTIBYTE_CHARS)
-# include <stdlib.h>
-#endif
-
-#ifdef MULTIBYTE_CHARS
-#include <locale.h>
-#endif
-
-#include <stdio.h>
-
-typedef unsigned char U_CHAR;
-
-/* This is used for communicating lists of keywords with cccp.c. */
-struct arglist {
- struct arglist *next;
- U_CHAR *name;
- int length;
- int argno;
-};
-
-/* Define a generic NULL if one hasn't already been defined. */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef GENERIC_PTR
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#define GENERIC_PTR void *
-#else
-#define GENERIC_PTR char *
-#endif
-#endif
-
-#ifndef NULL_PTR
-#define NULL_PTR ((GENERIC_PTR) 0)
-#endif
-
-/* Find the largest host integer type and set its size and type.
- Don't blindly use `long'; on some crazy hosts it is shorter than `int'. */
-
-#ifndef HOST_BITS_PER_WIDE_INT
-
-#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
-#define HOST_WIDE_INT long
-#else
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
-#define HOST_WIDE_INT int
-#endif
-
-#endif
-
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __attribute__(x)
-#endif
-
-#ifndef PROTO
-# if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-# define PROTO(ARGS) ARGS
-# else
-# define PROTO(ARGS) ()
-# endif
-#endif
-
-#if defined (__STDC__) && defined (HAVE_VPRINTF)
-# include <stdarg.h>
-# define VA_START(va_list, var) va_start (va_list, var)
-# define PRINTF_ALIST(msg) char *msg, ...
-# define PRINTF_DCL(msg)
-# define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
-#else
-# include <varargs.h>
-# define VA_START(va_list, var) va_start (va_list)
-# define PRINTF_ALIST(msg) msg, va_alist
-# define PRINTF_DCL(msg) char *msg; va_dcl
-# define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
-# define vfprintf(file, msg, args) \
- { \
- char *a0 = va_arg(args, char *); \
- char *a1 = va_arg(args, char *); \
- char *a2 = va_arg(args, char *); \
- char *a3 = va_arg(args, char *); \
- fprintf (file, msg, a0, a1, a2, a3); \
- }
-#endif
-
-#define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
-
-HOST_WIDE_INT parse_c_expression PROTO((char *));
-
-static int yylex PROTO((void));
-static void yyerror PROTO((char *)) __attribute__ ((noreturn));
-static HOST_WIDE_INT expression_value;
-
-static jmp_buf parse_return_error;
-
-/* Nonzero means count most punctuation as part of a name. */
-static int keyword_parsing = 0;
-
-/* Nonzero means do not evaluate this expression.
- This is a count, since unevaluated expressions can nest. */
-static int skip_evaluation;
-
-/* some external tables of character types */
-extern unsigned char is_idstart[], is_idchar[], is_space[];
-
-/* Flag for -pedantic. */
-extern int pedantic;
-
-/* Flag for -traditional. */
-extern int traditional;
-
-/* Flag for -lang-c89. */
-extern int c89;
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
-#endif
-
-#ifndef MAX_CHAR_TYPE_SIZE
-#define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
-#endif
-
-#ifndef MAX_INT_TYPE_SIZE
-#define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
-#endif
-
-#ifndef MAX_LONG_TYPE_SIZE
-#define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
-#endif
-
-#ifndef MAX_WCHAR_TYPE_SIZE
-#define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
-#endif
-
-#if MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT
-#define MAX_CHAR_TYPE_MASK (~ (~ (HOST_WIDE_INT) 0 << MAX_CHAR_TYPE_SIZE))
-#else
-#define MAX_CHAR_TYPE_MASK (~ (HOST_WIDE_INT) 0)
-#endif
-
-#if MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT
-#define MAX_WCHAR_TYPE_MASK (~ (~ (HOST_WIDE_INT) 0 << MAX_WCHAR_TYPE_SIZE))
-#else
-#define MAX_WCHAR_TYPE_MASK (~ (HOST_WIDE_INT) 0)
-#endif
-
-/* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow.
- Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1.
- Suppose SIGNEDP is negative if the result is signed, zero if unsigned.
- Then this yields nonzero if overflow occurred during the addition.
- Overflow occurs if A and B have the same sign, but A and SUM differ in sign,
- and SIGNEDP is negative.
- Use `^' to test whether signs differ, and `< 0' to isolate the sign. */
-#define overflow_sum_sign(a, b, sum, signedp) \
- ((~((a) ^ (b)) & ((a) ^ (sum)) & (signedp)) < 0)
-
-struct constant;
-
-GENERIC_PTR xmalloc PROTO((size_t));
-HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
-int check_assertion PROTO((U_CHAR *, int, int, struct arglist *));
-struct hashnode *lookup PROTO((U_CHAR *, int, int));
-void error PRINTF_PROTO_1((char *, ...));
-void pedwarn PRINTF_PROTO_1((char *, ...));
-void warning PRINTF_PROTO_1((char *, ...));
-
-static int parse_number PROTO((int));
-static HOST_WIDE_INT left_shift PROTO((struct constant *, unsigned HOST_WIDE_INT));
-static HOST_WIDE_INT right_shift PROTO((struct constant *, unsigned HOST_WIDE_INT));
-static void integer_overflow PROTO((void));
-
-/* `signedp' values */
-#define SIGNED (~0)
-#define UNSIGNED 0
-%}
-
-%union {
- struct constant {HOST_WIDE_INT value; int signedp;} integer;
- struct name {U_CHAR *address; int length;} name;
- struct arglist *keywords;
-}
-
-%type <integer> exp exp1 start
-%type <keywords> keywords
-%token <integer> INT CHAR
-%token <name> NAME
-%token <integer> ERROR
-
-%right '?' ':'
-%left ','
-%left OR
-%left AND
-%left '|'
-%left '^'
-%left '&'
-%left EQUAL NOTEQUAL
-%left '<' '>' LEQ GEQ
-%left LSH RSH
-%left '+' '-'
-%left '*' '/' '%'
-%right UNARY
-
-/* %expect 40 */
-
-%%
-
-start : exp1
- { expression_value = $1.value; }
- ;
-
-/* Expressions, including the comma operator. */
-exp1 : exp
- | exp1 ',' exp
- { if (pedantic)
- pedwarn ("comma operator in operand of `#if'");
- $$ = $3; }
- ;
-
-/* Expressions, not including the comma operator. */
-exp : '-' exp %prec UNARY
- { $$.value = - $2.value;
- $$.signedp = $2.signedp;
- if (($$.value & $2.value & $$.signedp) < 0)
- integer_overflow (); }
- | '!' exp %prec UNARY
- { $$.value = ! $2.value;
- $$.signedp = SIGNED; }
- | '+' exp %prec UNARY
- { $$ = $2; }
- | '~' exp %prec UNARY
- { $$.value = ~ $2.value;
- $$.signedp = $2.signedp; }
- | '#' NAME
- { $$.value = check_assertion ($2.address, $2.length,
- 0, NULL_PTR);
- $$.signedp = SIGNED; }
- | '#' NAME
- { keyword_parsing = 1; }
- '(' keywords ')'
- { $$.value = check_assertion ($2.address, $2.length,
- 1, $5);
- keyword_parsing = 0;
- $$.signedp = SIGNED; }
- | '(' exp1 ')'
- { $$ = $2; }
- ;
-
-/* Binary operators in order of decreasing precedence. */
-exp : exp '*' exp
- { $$.signedp = $1.signedp & $3.signedp;
- if ($$.signedp)
- {
- $$.value = $1.value * $3.value;
- if ($1.value
- && ($$.value / $1.value != $3.value
- || ($$.value & $1.value & $3.value) < 0))
- integer_overflow ();
- }
- else
- $$.value = ((unsigned HOST_WIDE_INT) $1.value
- * $3.value); }
- | exp '/' exp
- { if ($3.value == 0)
- {
- if (!skip_evaluation)
- error ("division by zero in #if");
- $3.value = 1;
- }
- $$.signedp = $1.signedp & $3.signedp;
- if ($$.signedp)
- {
- $$.value = $1.value / $3.value;
- if (($$.value & $1.value & $3.value) < 0)
- integer_overflow ();
- }
- else
- $$.value = ((unsigned HOST_WIDE_INT) $1.value
- / $3.value); }
- | exp '%' exp
- { if ($3.value == 0)
- {
- if (!skip_evaluation)
- error ("division by zero in #if");
- $3.value = 1;
- }
- $$.signedp = $1.signedp & $3.signedp;
- if ($$.signedp)
- $$.value = $1.value % $3.value;
- else
- $$.value = ((unsigned HOST_WIDE_INT) $1.value
- % $3.value); }
- | exp '+' exp
- { $$.value = $1.value + $3.value;
- $$.signedp = $1.signedp & $3.signedp;
- if (overflow_sum_sign ($1.value, $3.value,
- $$.value, $$.signedp))
- integer_overflow (); }
- | exp '-' exp
- { $$.value = $1.value - $3.value;
- $$.signedp = $1.signedp & $3.signedp;
- if (overflow_sum_sign ($$.value, $3.value,
- $1.value, $$.signedp))
- integer_overflow (); }
- | exp LSH exp
- { $$.signedp = $1.signedp;
- if (($3.value & $3.signedp) < 0)
- $$.value = right_shift (&$1, -$3.value);
- else
- $$.value = left_shift (&$1, $3.value); }
- | exp RSH exp
- { $$.signedp = $1.signedp;
- if (($3.value & $3.signedp) < 0)
- $$.value = left_shift (&$1, -$3.value);
- else
- $$.value = right_shift (&$1, $3.value); }
- | exp EQUAL exp
- { $$.value = ($1.value == $3.value);
- $$.signedp = SIGNED; }
- | exp NOTEQUAL exp
- { $$.value = ($1.value != $3.value);
- $$.signedp = SIGNED; }
- | exp LEQ exp
- { $$.signedp = SIGNED;
- if ($1.signedp & $3.signedp)
- $$.value = $1.value <= $3.value;
- else
- $$.value = ((unsigned HOST_WIDE_INT) $1.value
- <= $3.value); }
- | exp GEQ exp
- { $$.signedp = SIGNED;
- if ($1.signedp & $3.signedp)
- $$.value = $1.value >= $3.value;
- else
- $$.value = ((unsigned HOST_WIDE_INT) $1.value
- >= $3.value); }
- | exp '<' exp
- { $$.signedp = SIGNED;
- if ($1.signedp & $3.signedp)
- $$.value = $1.value < $3.value;
- else
- $$.value = ((unsigned HOST_WIDE_INT) $1.value
- < $3.value); }
- | exp '>' exp
- { $$.signedp = SIGNED;
- if ($1.signedp & $3.signedp)
- $$.value = $1.value > $3.value;
- else
- $$.value = ((unsigned HOST_WIDE_INT) $1.value
- > $3.value); }
- | exp '&' exp
- { $$.value = $1.value & $3.value;
- $$.signedp = $1.signedp & $3.signedp; }
- | exp '^' exp
- { $$.value = $1.value ^ $3.value;
- $$.signedp = $1.signedp & $3.signedp; }
- | exp '|' exp
- { $$.value = $1.value | $3.value;
- $$.signedp = $1.signedp & $3.signedp; }
- | exp AND
- { skip_evaluation += !$1.value; }
- exp
- { skip_evaluation -= !$1.value;
- $$.value = ($1.value && $4.value);
- $$.signedp = SIGNED; }
- | exp OR
- { skip_evaluation += !!$1.value; }
- exp
- { skip_evaluation -= !!$1.value;
- $$.value = ($1.value || $4.value);
- $$.signedp = SIGNED; }
- | exp '?'
- { skip_evaluation += !$1.value; }
- exp ':'
- { skip_evaluation += !!$1.value - !$1.value; }
- exp
- { skip_evaluation -= !!$1.value;
- $$.value = $1.value ? $4.value : $7.value;
- $$.signedp = $4.signedp & $7.signedp; }
- | INT
- { $$ = yylval.integer; }
- | CHAR
- { $$ = yylval.integer; }
- | NAME
- { $$.value = 0;
- $$.signedp = SIGNED; }
- ;
-
-keywords :
- { $$ = 0; }
- | '(' keywords ')' keywords
- { struct arglist *temp;
- $$ = (struct arglist *) xmalloc (sizeof (struct arglist));
- $$->next = $2;
- $$->name = (U_CHAR *) "(";
- $$->length = 1;
- temp = $$;
- while (temp != 0 && temp->next != 0)
- temp = temp->next;
- temp->next = (struct arglist *) xmalloc (sizeof (struct arglist));
- temp->next->next = $4;
- temp->next->name = (U_CHAR *) ")";
- temp->next->length = 1; }
- | NAME keywords
- { $$ = (struct arglist *) xmalloc (sizeof (struct arglist));
- $$->name = $1.address;
- $$->length = $1.length;
- $$->next = $2; }
- ;
-%%
-
-/* During parsing of a C expression, the pointer to the next character
- is in this variable. */
-
-static char *lexptr;
-
-/* Take care of parsing a number (anything that starts with a digit).
- Set yylval and return the token type; update lexptr.
- LEN is the number of characters in it. */
-
-/* maybe needs to actually deal with floating point numbers */
-
-static int
-parse_number (olen)
- int olen;
-{
- register char *p = lexptr;
- register int c;
- register unsigned HOST_WIDE_INT n = 0, nd, max_over_base;
- register int base = 10;
- register int len = olen;
- register int overflow = 0;
- register int digit, largest_digit = 0;
- int spec_long = 0;
-
- yylval.integer.signedp = SIGNED;
-
- if (*p == '0') {
- base = 8;
- if (len >= 3 && (p[1] == 'x' || p[1] == 'X')) {
- p += 2;
- base = 16;
- len -= 2;
- }
- }
-
- max_over_base = (unsigned HOST_WIDE_INT) -1 / base;
-
- for (; len > 0; len--) {
- c = *p++;
-
- if (c >= '0' && c <= '9')
- digit = c - '0';
- else if (base == 16 && c >= 'a' && c <= 'f')
- digit = c - 'a' + 10;
- else if (base == 16 && c >= 'A' && c <= 'F')
- digit = c - 'A' + 10;
- else {
- /* `l' means long, and `u' means unsigned. */
- while (1) {
- if (c == 'l' || c == 'L')
- {
- if (!pedantic < spec_long)
- yyerror ("too many `l's in integer constant");
- spec_long++;
- }
- else if (c == 'u' || c == 'U')
- {
- if (! yylval.integer.signedp)
- yyerror ("two `u's in integer constant");
- yylval.integer.signedp = UNSIGNED;
- }
- else {
- if (c == '.' || c == 'e' || c == 'E' || c == 'p' || c == 'P')
- yyerror ("Floating point numbers not allowed in #if expressions");
- else {
- char *buf = (char *) alloca (p - lexptr + 40);
- sprintf (buf, "missing white space after number `%.*s'",
- (int) (p - lexptr - 1), lexptr);
- yyerror (buf);
- }
- }
-
- if (--len == 0)
- break;
- c = *p++;
- }
- /* Don't look for any more digits after the suffixes. */
- break;
- }
- if (largest_digit < digit)
- largest_digit = digit;
- nd = n * base + digit;
- overflow |= (max_over_base < n) | (nd < n);
- n = nd;
- }
-
- if (base <= largest_digit)
- pedwarn ("integer constant contains digits beyond the radix");
-
- if (overflow)
- pedwarn ("integer constant out of range");
-
- /* If too big to be signed, consider it unsigned. */
- if (((HOST_WIDE_INT) n & yylval.integer.signedp) < 0)
- {
- if (base == 10)
- warning ("integer constant is so large that it is unsigned");
- yylval.integer.signedp = UNSIGNED;
- }
-
- lexptr = p;
- yylval.integer.value = n;
- return INT;
-}
-
-struct token {
- char *operator;
- int token;
-};
-
-static struct token tokentab2[] = {
- {"&&", AND},
- {"||", OR},
- {"<<", LSH},
- {">>", RSH},
- {"==", EQUAL},
- {"!=", NOTEQUAL},
- {"<=", LEQ},
- {">=", GEQ},
- {"++", ERROR},
- {"--", ERROR},
- {NULL, ERROR}
-};
-
-/* Read one token, getting characters through lexptr. */
-
-static int
-yylex ()
-{
- register int c;
- register int namelen;
- register unsigned char *tokstart;
- register struct token *toktab;
- int wide_flag;
- HOST_WIDE_INT mask;
-
- retry:
-
- tokstart = (unsigned char *) lexptr;
- c = *tokstart;
- /* See if it is a special token of length 2. */
- if (! keyword_parsing)
- for (toktab = tokentab2; toktab->operator != NULL; toktab++)
- if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) {
- lexptr += 2;
- if (toktab->token == ERROR)
- {
- char *buf = (char *) alloca (40);
- sprintf (buf, "`%s' not allowed in operand of `#if'", toktab->operator);
- yyerror (buf);
- }
- return toktab->token;
- }
-
- switch (c) {
- case '\n':
- return 0;
-
- case ' ':
- case '\t':
- case '\r':
- lexptr++;
- goto retry;
-
- case 'L':
- /* Capital L may start a wide-string or wide-character constant. */
- if (lexptr[1] == '\'')
- {
- lexptr++;
- wide_flag = 1;
- mask = MAX_WCHAR_TYPE_MASK;
- goto char_constant;
- }
- if (lexptr[1] == '"')
- {
- lexptr++;
- wide_flag = 1;
- mask = MAX_WCHAR_TYPE_MASK;
- goto string_constant;
- }
- break;
-
- case '\'':
- wide_flag = 0;
- mask = MAX_CHAR_TYPE_MASK;
- char_constant:
- lexptr++;
- if (keyword_parsing) {
- char *start_ptr = lexptr - 1;
- while (1) {
- c = *lexptr++;
- if (c == '\\')
- c = parse_escape (&lexptr, mask);
- else if (c == '\'')
- break;
- }
- yylval.name.address = tokstart;
- yylval.name.length = lexptr - start_ptr;
- return NAME;
- }
-
- /* This code for reading a character constant
- handles multicharacter constants and wide characters.
- It is mostly copied from c-lex.c. */
- {
- register HOST_WIDE_INT result = 0;
- register num_chars = 0;
- unsigned width = MAX_CHAR_TYPE_SIZE;
- int max_chars;
- char *token_buffer;
-
- if (wide_flag)
- {
- width = MAX_WCHAR_TYPE_SIZE;
-#ifdef MULTIBYTE_CHARS
- max_chars = MB_CUR_MAX;
-#else
- max_chars = 1;
-#endif
- }
- else
- max_chars = MAX_LONG_TYPE_SIZE / width;
-
- token_buffer = (char *) alloca (max_chars + 1);
-
- while (1)
- {
- c = *lexptr++;
-
- if (c == '\'' || c == EOF)
- break;
-
- if (c == '\\')
- {
- c = parse_escape (&lexptr, mask);
- }
-
- num_chars++;
-
- /* Merge character into result; ignore excess chars. */
- if (num_chars <= max_chars)
- {
- if (width < HOST_BITS_PER_WIDE_INT)
- result = (result << width) | c;
- else
- result = c;
- token_buffer[num_chars - 1] = c;
- }
- }
-
- token_buffer[num_chars] = 0;
-
- if (c != '\'')
- error ("malformatted character constant");
- else if (num_chars == 0)
- error ("empty character constant");
- else if (num_chars > max_chars)
- {
- num_chars = max_chars;
- error ("character constant too long");
- }
- else if (num_chars != 1 && ! traditional)
- warning ("multi-character character constant");
-
- /* If char type is signed, sign-extend the constant. */
- if (! wide_flag)
- {
- int num_bits = num_chars * width;
-
- if (lookup ((U_CHAR *) "__CHAR_UNSIGNED__",
- sizeof ("__CHAR_UNSIGNED__") - 1, -1)
- || ((result >> (num_bits - 1)) & 1) == 0)
- yylval.integer.value
- = result & (~ (unsigned HOST_WIDE_INT) 0
- >> (HOST_BITS_PER_WIDE_INT - num_bits));
- else
- yylval.integer.value
- = result | ~(~ (unsigned HOST_WIDE_INT) 0
- >> (HOST_BITS_PER_WIDE_INT - num_bits));
- }
- else
- {
-#ifdef MULTIBYTE_CHARS
- /* Set the initial shift state and convert the next sequence. */
- result = 0;
- /* In all locales L'\0' is zero and mbtowc will return zero,
- so don't use it. */
- if (num_chars > 1
- || (num_chars == 1 && token_buffer[0] != '\0'))
- {
- wchar_t wc;
- (void) mbtowc (NULL_PTR, NULL_PTR, 0);
- if (mbtowc (& wc, token_buffer, num_chars) == num_chars)
- result = wc;
- else
- pedwarn ("Ignoring invalid multibyte character");
- }
-#endif
- yylval.integer.value = result;
- }
- }
-
- /* This is always a signed type. */
- yylval.integer.signedp = SIGNED;
-
- return CHAR;
-
- /* some of these chars are invalid in constant expressions;
- maybe do something about them later */
- case '/':
- case '+':
- case '-':
- case '*':
- case '%':
- case '|':
- case '&':
- case '^':
- case '~':
- case '!':
- case '@':
- case '<':
- case '>':
- case '[':
- case ']':
- case '.':
- case '?':
- case ':':
- case '=':
- case '{':
- case '}':
- case ',':
- case '#':
- if (keyword_parsing)
- break;
- case '(':
- case ')':
- lexptr++;
- return c;
-
- case '"':
- mask = MAX_CHAR_TYPE_MASK;
- string_constant:
- if (keyword_parsing) {
- char *start_ptr = lexptr;
- lexptr++;
- while (1) {
- c = *lexptr++;
- if (c == '\\')
- c = parse_escape (&lexptr, mask);
- else if (c == '"')
- break;
- }
- yylval.name.address = tokstart;
- yylval.name.length = lexptr - start_ptr;
- return NAME;
- }
- yyerror ("string constants not allowed in #if expressions");
- return ERROR;
- }
-
- if (c >= '0' && c <= '9' && !keyword_parsing) {
- /* It's a number */
- for (namelen = 1; ; namelen++) {
- int d = tokstart[namelen];
- if (! ((is_idchar[d] || d == '.')
- || ((d == '-' || d == '+')
- && (c == 'e' || c == 'E'
- || ((c == 'p' || c == 'P') && ! c89))
- && ! traditional)))
- break;
- c = d;
- }
- return parse_number (namelen);
- }
-
- /* It is a name. See how long it is. */
-
- if (keyword_parsing) {
- for (namelen = 0;; namelen++) {
- if (is_space[tokstart[namelen]])
- break;
- if (tokstart[namelen] == '(' || tokstart[namelen] == ')')
- break;
- if (tokstart[namelen] == '"' || tokstart[namelen] == '\'')
- break;
- }
- } else {
- if (!is_idstart[c]) {
- yyerror ("Invalid token in expression");
- return ERROR;
- }
-
- for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++)
- ;
- }
-
- lexptr += namelen;
- yylval.name.address = tokstart;
- yylval.name.length = namelen;
- return NAME;
-}
-
-
-/* Parse a C escape sequence. STRING_PTR points to a variable
- containing a pointer to the string to parse. That pointer
- is updated past the characters we use. The value of the
- escape sequence is returned.
-
- RESULT_MASK is used to mask out the result;
- an error is reported if bits are lost thereby.
-
- A negative value means the sequence \ newline was seen,
- which is supposed to be equivalent to nothing at all.
-
- If \ is followed by a null character, we return a negative
- value and leave the string pointer pointing at the null character.
-
- If \ is followed by 000, we return 0 and leave the string pointer
- after the zeros. A value of 0 does not mean end of string. */
-
-HOST_WIDE_INT
-parse_escape (string_ptr, result_mask)
- char **string_ptr;
- HOST_WIDE_INT result_mask;
-{
- register int c = *(*string_ptr)++;
- switch (c)
- {
- case 'a':
- return TARGET_BELL;
- case 'b':
- return TARGET_BS;
- case 'e':
- case 'E':
- if (pedantic)
- pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
- return 033;
- case 'f':
- return TARGET_FF;
- case 'n':
- return TARGET_NEWLINE;
- case 'r':
- return TARGET_CR;
- case 't':
- return TARGET_TAB;
- case 'v':
- return TARGET_VT;
- case '\n':
- return -2;
- case 0:
- (*string_ptr)--;
- return 0;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- register HOST_WIDE_INT i = c - '0';
- register int count = 0;
- while (++count < 3)
- {
- c = *(*string_ptr)++;
- if (c >= '0' && c <= '7')
- i = (i << 3) + c - '0';
- else
- {
- (*string_ptr)--;
- break;
- }
- }
- if (i != (i & result_mask))
- {
- i &= result_mask;
- pedwarn ("octal escape sequence out of range");
- }
- return i;
- }
- case 'x':
- {
- register unsigned HOST_WIDE_INT i = 0, overflow = 0;
- register int digits_found = 0, digit;
- for (;;)
- {
- c = *(*string_ptr)++;
- if (c >= '0' && c <= '9')
- digit = c - '0';
- else if (c >= 'a' && c <= 'f')
- digit = c - 'a' + 10;
- else if (c >= 'A' && c <= 'F')
- digit = c - 'A' + 10;
- else
- {
- (*string_ptr)--;
- break;
- }
- overflow |= i ^ (i << 4 >> 4);
- i = (i << 4) + digit;
- digits_found = 1;
- }
- if (!digits_found)
- yyerror ("\\x used with no following hex digits");
- if (overflow | (i != (i & result_mask)))
- {
- i &= result_mask;
- pedwarn ("hex escape sequence out of range");
- }
- return i;
- }
- default:
- return c;
- }
-}
-
-static void
-yyerror (s)
- char *s;
-{
- error ("%s", s);
- skip_evaluation = 0;
- longjmp (parse_return_error, 1);
-}
-
-static void
-integer_overflow ()
-{
- if (!skip_evaluation && pedantic)
- pedwarn ("integer overflow in preprocessor expression");
-}
-
-static HOST_WIDE_INT
-left_shift (a, b)
- struct constant *a;
- unsigned HOST_WIDE_INT b;
-{
- /* It's unclear from the C standard whether shifts can overflow.
- The following code ignores overflow; perhaps a C standard
- interpretation ruling is needed. */
- if (b >= HOST_BITS_PER_WIDE_INT)
- return 0;
- else
- return (unsigned HOST_WIDE_INT) a->value << b;
-}
-
-static HOST_WIDE_INT
-right_shift (a, b)
- struct constant *a;
- unsigned HOST_WIDE_INT b;
-{
- if (b >= HOST_BITS_PER_WIDE_INT)
- return a->signedp ? a->value >> (HOST_BITS_PER_WIDE_INT - 1) : 0;
- else if (a->signedp)
- return a->value >> b;
- else
- return (unsigned HOST_WIDE_INT) a->value >> b;
-}
-
-/* This page contains the entry point to this file. */
-
-/* Parse STRING as an expression, and complain if this fails
- to use up all of the contents of STRING. */
-/* STRING may contain '\0' bytes; it is terminated by the first '\n'
- outside a string constant, so that we can diagnose '\0' properly. */
-/* We do not support C comments. They should be removed before
- this function is called. */
-
-HOST_WIDE_INT
-parse_c_expression (string)
- char *string;
-{
- lexptr = string;
-
- /* if there is some sort of scanning error, just return 0 and assume
- the parsing routine has printed an error message somewhere.
- there is surely a better thing to do than this. */
- if (setjmp (parse_return_error))
- return 0;
-
- if (yyparse () != 0)
- abort ();
-
- if (*lexptr != '\n')
- error ("Junk after end of expression.");
-
- return expression_value; /* set by yyparse () */
-}
-
-#ifdef TEST_EXP_READER
-
-#if YYDEBUG
-extern int yydebug;
-#endif
-
-int pedantic;
-int traditional;
-
-int main PROTO((int, char **));
-static void initialize_random_junk PROTO((void));
-
-/* Main program for testing purposes. */
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int n, c;
- char buf[1024];
-
- pedantic = 1 < argc;
- traditional = 2 < argc;
-#if YYDEBUG
- yydebug = 3 < argc;
-#endif
- initialize_random_junk ();
-
- for (;;) {
- printf ("enter expression: ");
- n = 0;
- while ((buf[n] = c = getchar ()) != '\n' && c != EOF)
- n++;
- if (c == EOF)
- break;
- printf ("parser returned %ld\n", (long) parse_c_expression (buf));
- }
-
- return 0;
-}
-
-/* table to tell if char can be part of a C identifier. */
-unsigned char is_idchar[256];
-/* table to tell if char can be first char of a c identifier. */
-unsigned char is_idstart[256];
-/* table to tell if c is horizontal or vertical space. */
-unsigned char is_space[256];
-
-/*
- * initialize random junk in the hash table and maybe other places
- */
-static void
-initialize_random_junk ()
-{
- register int i;
-
- /*
- * Set up is_idchar and is_idstart tables. These should be
- * faster than saying (is_alpha (c) || c == '_'), etc.
- * Must do set up these things before calling any routines tthat
- * refer to them.
- */
- for (i = 'a'; i <= 'z'; i++) {
- ++is_idchar[i - 'a' + 'A'];
- ++is_idchar[i];
- ++is_idstart[i - 'a' + 'A'];
- ++is_idstart[i];
- }
- for (i = '0'; i <= '9'; i++)
- ++is_idchar[i];
- ++is_idchar['_'];
- ++is_idstart['_'];
- ++is_idchar['$'];
- ++is_idstart['$'];
-
- ++is_space[' '];
- ++is_space['\t'];
- ++is_space['\v'];
- ++is_space['\f'];
- ++is_space['\n'];
- ++is_space['\r'];
-}
-
-void
-error (PRINTF_ALIST (msg))
- PRINTF_DCL (msg)
-{
- va_list args;
-
- VA_START (args, msg);
- fprintf (stderr, "error: ");
- vfprintf (stderr, msg, args);
- fprintf (stderr, "\n");
- va_end (args);
-}
-
-void
-pedwarn (PRINTF_ALIST (msg))
- PRINTF_DCL (msg)
-{
- va_list args;
-
- VA_START (args, msg);
- fprintf (stderr, "pedwarn: ");
- vfprintf (stderr, msg, args);
- fprintf (stderr, "\n");
- va_end (args);
-}
-
-void
-warning (PRINTF_ALIST (msg))
- PRINTF_DCL (msg)
-{
- va_list args;
-
- VA_START (args, msg);
- fprintf (stderr, "warning: ");
- vfprintf (stderr, msg, args);
- fprintf (stderr, "\n");
- va_end (args);
-}
-
-int
-check_assertion (name, sym_length, tokens_specified, tokens)
- U_CHAR *name;
- int sym_length;
- int tokens_specified;
- struct arglist *tokens;
-{
- return 0;
-}
-
-struct hashnode *
-lookup (name, len, hash)
- U_CHAR *name;
- int len;
- int hash;
-{
- return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1);
-}
-
-GENERIC_PTR
-xmalloc (size)
- size_t size;
-{
- return (GENERIC_PTR) malloc (size);
-}
-#endif
diff --git a/gcc/choose-temp.c b/gcc/choose-temp.c
deleted file mode 100644
index 798de4822a5..00000000000
--- a/gcc/choose-temp.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Utility to pick a temporary filename prefix.
- Copyright (C) 1996 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This file exports one function: choose_temp_base. */
-
-/* This file lives in at least two places: libiberty and gcc.
- Don't change one without the other. */
-
-#ifndef NO_SYS_FILE_H
-#include <sys/types.h>
-#include <sys/file.h> /* May get R_OK, etc. on some systems. */
-#endif
-
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#endif
-
-#include <stdio.h> /* May get P_tmpdir. */
-
-#ifdef IN_GCC
-#include "config.h"
-#include "gansidecl.h"
-extern char *xmalloc ();
-#else
-#include "ansidecl.h"
-#include "libiberty.h"
-#if defined (__MSDOS__) || defined (_WIN32)
-#define DIR_SEPARATOR '\\'
-#endif
-#endif
-
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-/* On MSDOS, write temp files in current dir
- because there's no place else we can expect to use. */
-/* ??? Although the current directory is tried as a last resort,
- this is left in so that on MSDOS it is prefered to /tmp on the
- off chance that someone requires this, since that was the previous
- behaviour. */
-#ifdef __MSDOS__
-#ifndef P_tmpdir
-#define P_tmpdir "."
-#endif
-#endif
-
-/* Name of temporary file.
- mktemp requires 6 trailing X's. */
-#define TEMP_FILE "ccXXXXXX"
-
-/* Subroutine of choose_temp_base.
- If BASE is non-NULL, returh it.
- Otherwise it checks if DIR is a usable directory.
- If success, DIR is returned.
- Otherwise NULL is returned. */
-
-static char *
-try (dir, base)
- char *dir, *base;
-{
- if (base != 0)
- return base;
- if (dir != 0
- && access (dir, R_OK | W_OK | X_OK) == 0)
- return dir;
- return 0;
-}
-
-/* Return a prefix for temporary file names or NULL if unable to find one.
- The current directory is chosen if all else fails so the program is
- exited if a temporary directory can't be found (mktemp fails).
- The buffer for the result is obtained with xmalloc. */
-
-char *
-choose_temp_base ()
-{
- char *base = 0;
- char *temp_filename;
- int len;
- static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
- static char usrtmp[] = { DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
-
-#ifndef MPW
- base = try (getenv ("TMPDIR"), base);
- base = try (getenv ("TMP"), base);
- base = try (getenv ("TEMP"), base);
-
-#ifdef P_tmpdir
- base = try (P_tmpdir, base);
-#endif
-
- /* Try /usr/tmp, then /tmp. */
- base = try (usrtmp, base);
- base = try (tmp, base);
-
- /* If all else fails, use the current directory! */
- if (base == 0)
-#ifdef VMS
- base = "[";
-#else
- base = ".";
-#endif
-
-#else /* MPW */
- base = ":";
-#endif
-
- len = strlen (base);
- temp_filename = xmalloc (len + 1 /*DIR_SEPARATOR*/
- + strlen (TEMP_FILE) + 1);
- strcpy (temp_filename, base);
-
-#ifndef MPW
- if (len != 0
- && temp_filename[len-1] != '/'
- && temp_filename[len-1] != DIR_SEPARATOR)
- temp_filename[len++] = DIR_SEPARATOR;
-#else /* MPW */
- if (temp_filename[len-1] != ':')
- temp_filename[len++] = ':';
-#endif /* MPW */
- strcpy (temp_filename + len, TEMP_FILE);
-
- mktemp (temp_filename);
- if (strlen (temp_filename) == 0)
- abort ();
- return temp_filename;
-}
diff --git a/gcc/collect2.c b/gcc/collect2.c
deleted file mode 100644
index 341c70ea045..00000000000
--- a/gcc/collect2.c
+++ /dev/null
@@ -1,3358 +0,0 @@
-/* Collect static initialization info into data structures that can be
- traversed by C++ initialization and finalization routines.
- Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Chris Smith (csmith@convex.com).
- Heavily modified by Michael Meissner (meissner@cygnus.com),
- Per Bothner (bothner@cygnus.com), and John Gilmore (gnu@cygnus.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. */
-
-
-/* Build tables of static constructors and destructors and run ld. */
-
-#include "config.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-
-#define COLLECT
-
-#include "demangle.h"
-#include "obstack.h"
-#include "gansidecl.h"
-
-#ifndef errno
-extern int errno;
-#endif
-
-#ifndef HAVE_STRERROR
-#if defined(bsd4_4)
-extern const char *const sys_errlist[];
-#else
-extern char *sys_errlist[];
-#endif
-extern int sys_nerr;
-#else
-char *strerror();
-#endif
-
-/* Obstack allocation and deallocation routines. */
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-#ifdef USG
-#define vfork fork
-#endif
-
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#endif
-
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
-#endif
-#ifndef WTERMSIG
-#define WTERMSIG(S) ((S) & 0x7f)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(S) (((S) & 0xff) == 0)
-#endif
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
-#endif
-
-extern char *choose_temp_base ();
-
-/* On certain systems, we have code that works by scanning the object file
- directly. But this code uses system-specific header files and library
- functions, so turn it off in a cross-compiler. Likewise, the names of
- the utilities aren't correct for a cross-compiler; we have to hope that
- cross-versions are in the proper directories. */
-
-#ifdef CROSS_COMPILE
-#undef SUNOS4_SHARED_LIBRARIES
-#undef OBJECT_FORMAT_COFF
-#undef OBJECT_FORMAT_ROSE
-#undef MD_EXEC_PREFIX
-#undef REAL_LD_FILE_NAME
-#undef REAL_NM_FILE_NAME
-#undef REAL_STRIP_FILE_NAME
-#endif
-
-/* If we can't use a special method, use the ordinary one:
- run nm to find what symbols are present.
- In a cross-compiler, this means you need a cross nm,
- but that isn't quite as unpleasant as special headers. */
-
-#if !defined (OBJECT_FORMAT_COFF) && !defined (OBJECT_FORMAT_ROSE)
-#define OBJECT_FORMAT_NONE
-#endif
-
-#ifdef OBJECT_FORMAT_COFF
-
-#include <a.out.h>
-#include <ar.h>
-
-#ifdef UMAX
-#include <sgs.h>
-#endif
-
-/* Many versions of ldfcn.h define these. */
-#ifdef FREAD
-#undef FREAD
-#undef FWRITE
-#endif
-
-#include <ldfcn.h>
-
-/* Some systems have an ISCOFF macro, but others do not. In some cases
- the macro may be wrong. MY_ISCOFF is defined in tm.h files for machines
- that either do not have an ISCOFF macro in /usr/include or for those
- where it is wrong. */
-
-#ifndef MY_ISCOFF
-#define MY_ISCOFF(X) ISCOFF (X)
-#endif
-
-#ifdef XCOFF_DEBUGGING_INFO
-#define XCOFF_SCAN_LIBS
-#endif
-
-#endif /* OBJECT_FORMAT_COFF */
-
-#ifdef OBJECT_FORMAT_ROSE
-
-#ifdef _OSF_SOURCE
-#define USE_MMAP
-#endif
-
-#ifdef USE_MMAP
-#include <sys/mman.h>
-#endif
-
-#include <unistd.h>
-#include <mach_o_format.h>
-#include <mach_o_header.h>
-#include <mach_o_vals.h>
-#include <mach_o_types.h>
-
-#endif /* OBJECT_FORMAT_ROSE */
-
-#ifdef OBJECT_FORMAT_NONE
-
-/* Default flags to pass to nm. */
-#ifndef NM_FLAGS
-#define NM_FLAGS "-p"
-#endif
-
-#endif /* OBJECT_FORMAT_NONE */
-
-/* Some systems use __main in a way incompatible with its use in gcc, in these
- cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
- give the same symbol without quotes for an alternative entry point. You
- must define both, or neither. */
-#ifndef NAME__MAIN
-#define NAME__MAIN "__main"
-#define SYMBOL__MAIN __main
-#endif
-
-#if defined (LDD_SUFFIX) || SUNOS4_SHARED_LIBRARIES || defined(XCOFF_SCAN_LIBS)
-#define SCAN_LIBRARIES
-#endif
-
-#ifdef USE_COLLECT2
-int do_collecting = 1;
-#else
-int do_collecting = 0;
-#endif
-
-/* Linked lists of constructor and destructor names. */
-
-struct id
-{
- struct id *next;
- int sequence;
- char name[1];
-};
-
-struct head
-{
- struct id *first;
- struct id *last;
- int number;
-};
-
-/* Enumeration giving which pass this is for scanning the program file. */
-
-enum pass {
- PASS_FIRST, /* without constructors */
- PASS_OBJ, /* individual objects */
- PASS_LIB, /* looking for shared libraries */
- PASS_SECOND /* with constructors linked in */
-};
-
-#ifndef NO_SYS_SIGLIST
-#ifndef DONT_DECLARE_SYS_SIGLIST
-extern char *sys_siglist[];
-#endif
-#endif
-extern char *version_string;
-
-int vflag; /* true if -v */
-static int rflag; /* true if -r */
-static int strip_flag; /* true if -s */
-
-int debug; /* true if -debug */
-
-static int shared_obj; /* true if -shared */
-
-static int temp_filename_length; /* Length of temp_filename */
-static char *temp_filename; /* Base of temp filenames */
-static char *c_file; /* <xxx>.c for constructor/destructor list. */
-static char *o_file; /* <xxx>.o for constructor/destructor list. */
-static char *export_file; /* <xxx>.x for AIX export list. */
-char *ldout; /* File for ld errors. */
-static char *output_file; /* Output file for ld. */
-static char *nm_file_name; /* pathname of nm */
-static char *ldd_file_name; /* pathname of ldd (or equivalent) */
-static char *strip_file_name; /* pathname of strip */
-char *c_file_name; /* pathname of gcc */
-static char *initname, *fininame; /* names of init and fini funcs */
-
-static struct head constructors; /* list of constructors found */
-static struct head destructors; /* list of destructors found */
-static struct head exports; /* list of exported symbols */
-
-struct obstack temporary_obstack;
-struct obstack permanent_obstack;
-char * temporary_firstobj;
-
-/* Defined in the automatically-generated underscore.c. */
-extern int prepends_underscore;
-
-extern char *getenv ();
-extern char *mktemp ();
-extern FILE *fdopen ();
-
-/* Structure to hold all the directories in which to search for files to
- execute. */
-
-struct prefix_list
-{
- char *prefix; /* String to prepend to the path. */
- struct prefix_list *next; /* Next in linked list. */
-};
-
-struct path_prefix
-{
- struct prefix_list *plist; /* List of prefixes to try */
- int max_len; /* Max length of a prefix in PLIST */
- char *name; /* Name of this list (used in config stuff) */
-};
-
-void collect_exit PROTO((int));
-void collect_execute PROTO((char *, char **, char *));
-void dump_file PROTO((char *));
-static void handler PROTO((int));
-static int is_ctor_dtor PROTO((char *));
-static int is_in_prefix_list PROTO((struct path_prefix *, char *, int));
-static char *find_a_file PROTO((struct path_prefix *, char *));
-static void add_prefix PROTO((struct path_prefix *, char *));
-static void prefix_from_env PROTO((char *, struct path_prefix *));
-static void prefix_from_string PROTO((char *, struct path_prefix *));
-static void do_wait PROTO((char *));
-static void fork_execute PROTO((char *, char **));
-static void maybe_unlink PROTO((char *));
-static void add_to_list PROTO((struct head *, char *));
-static void write_list PROTO((FILE *, char *, struct id *));
-static void write_list_with_asm PROTO((FILE *, char *, struct id *));
-static void write_c_file PROTO((FILE *, char *));
-static void write_export_file PROTO((FILE *));
-static void scan_prog_file PROTO((char *, enum pass));
-static void scan_libraries PROTO((char *));
-
-char *xcalloc ();
-char *xmalloc ();
-
-extern char *index ();
-extern char *rindex ();
-extern void free ();
-
-#ifdef NO_DUP2
-int
-dup2 (oldfd, newfd)
- int oldfd;
- int newfd;
-{
- int fdtmp[256];
- int fdx = 0;
- int fd;
-
- if (oldfd == newfd)
- return oldfd;
- close (newfd);
- while ((fd = dup (oldfd)) != newfd && fd >= 0) /* good enough for low fd's */
- fdtmp[fdx++] = fd;
- while (fdx > 0)
- close (fdtmp[--fdx]);
-
- return fd;
-}
-#endif
-
-char *
-my_strerror (e)
- int e;
-{
-
-#ifdef HAVE_STRERROR
- return strerror (e);
-
-#else
-
- static char buffer[30];
- if (!e)
- return "";
-
- if (e > 0 && e < sys_nerr)
- return sys_errlist[e];
-
- sprintf (buffer, "Unknown error %d", e);
- return buffer;
-#endif
-}
-
-/* Delete tempfiles and exit function. */
-
-void
-collect_exit (status)
- int status;
-{
- if (c_file != 0 && c_file[0])
- maybe_unlink (c_file);
-
- if (o_file != 0 && o_file[0])
- maybe_unlink (o_file);
-
- if (export_file != 0 && export_file[0])
- maybe_unlink (export_file);
-
- if (ldout != 0 && ldout[0])
- {
- dump_file (ldout);
- maybe_unlink (ldout);
- }
-
- if (status != 0 && output_file != 0 && output_file[0])
- maybe_unlink (output_file);
-
- exit (status);
-}
-
-
-/* Die when sys call fails. */
-
-void
-fatal_perror (string, arg1, arg2, arg3)
- char *string, *arg1, *arg2, *arg3;
-{
- int e = errno;
-
- fprintf (stderr, "collect2: ");
- fprintf (stderr, string, arg1, arg2, arg3);
- fprintf (stderr, ": %s\n", my_strerror (e));
- collect_exit (1);
-}
-
-/* Just die. */
-
-void
-fatal (string, arg1, arg2, arg3)
- char *string, *arg1, *arg2, *arg3;
-{
- fprintf (stderr, "collect2: ");
- fprintf (stderr, string, arg1, arg2, arg3);
- fprintf (stderr, "\n");
- collect_exit (1);
-}
-
-/* Write error message. */
-
-void
-error (string, arg1, arg2, arg3, arg4)
- char *string, *arg1, *arg2, *arg3, *arg4;
-{
- fprintf (stderr, "collect2: ");
- fprintf (stderr, string, arg1, arg2, arg3, arg4);
- fprintf (stderr, "\n");
-}
-
-/* In case obstack is linked in, and abort is defined to fancy_abort,
- provide a default entry. */
-
-void
-fancy_abort ()
-{
- fatal ("internal error");
-}
-
-
-static void
-handler (signo)
- int signo;
-{
- if (c_file != 0 && c_file[0])
- maybe_unlink (c_file);
-
- if (o_file != 0 && o_file[0])
- maybe_unlink (o_file);
-
- if (ldout != 0 && ldout[0])
- maybe_unlink (ldout);
-
- if (export_file != 0 && export_file[0])
- maybe_unlink (export_file);
-
- signal (signo, SIG_DFL);
- kill (getpid (), signo);
-}
-
-
-char *
-xcalloc (size1, size2)
- int size1, size2;
-{
- char *ptr = (char *) calloc (size1, size2);
- if (ptr)
- return ptr;
-
- fatal ("out of memory");
- return (char *) 0;
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- char *ptr = (char *) malloc (size);
- if (ptr)
- return ptr;
-
- fatal ("out of memory");
- return (char *) 0;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- register char *value = (char *) realloc (ptr, size);
- if (value == 0)
- fatal ("virtual memory exhausted");
- return value;
-}
-
-int
-file_exists (name)
- char *name;
-{
- return access (name, R_OK) == 0;
-}
-
-/* Make a copy of a string INPUT with size SIZE. */
-
-char *
-savestring (input, size)
- char *input;
- int size;
-{
- char *output = (char *) xmalloc (size + 1);
- bcopy (input, output, size);
- output[size] = 0;
- return output;
-}
-
-void
-dump_file (name)
- char *name;
-{
- FILE *stream = fopen (name, "r");
- int no_demangle = !! getenv ("COLLECT_NO_DEMANGLE");
-
- if (stream == 0)
- return;
- while (1)
- {
- int c;
- while (c = getc (stream),
- c != EOF && (isalnum (c) || c == '_' || c == '$' || c == '.'))
- obstack_1grow (&temporary_obstack, c);
- if (obstack_object_size (&temporary_obstack) > 0)
- {
- char *word, *p, *result;
- obstack_1grow (&temporary_obstack, '\0');
- word = obstack_finish (&temporary_obstack);
-
- if (*word == '.')
- ++word, putc ('.', stderr);
- p = word;
- if (*p == '_' && prepends_underscore)
- ++p;
-
- if (no_demangle)
- result = 0;
- else
- result = cplus_demangle (p, DMGL_PARAMS | DMGL_ANSI);
-
- if (result)
- {
- int diff;
- fputs (result, stderr);
-
- diff = strlen (word) - strlen (result);
- while (diff > 0)
- --diff, putc (' ', stderr);
- while (diff < 0 && c == ' ')
- ++diff, c = getc (stream);
-
- free (result);
- }
- else
- fputs (word, stderr);
-
- fflush (stderr);
- obstack_free (&temporary_obstack, temporary_firstobj);
- }
- if (c == EOF)
- break;
- putc (c, stderr);
- }
- fclose (stream);
-}
-
-/* Decide whether the given symbol is:
- a constructor (1), a destructor (2), or neither (0). */
-
-static int
-is_ctor_dtor (s)
- char *s;
-{
- struct names { char *name; int len; int ret; int two_underscores; };
-
- register struct names *p;
- register int ch;
- register char *orig_s = s;
-
- static struct names special[] = {
-#ifdef NO_DOLLAR_IN_LABEL
-#ifdef NO_DOT_IN_LABEL
- { "GLOBAL__I_", sizeof ("GLOBAL__I_")-1, 1, 0 },
- { "GLOBAL__D_", sizeof ("GLOBAL__D_")-1, 2, 0 },
-#else
- { "GLOBAL_.I.", sizeof ("GLOBAL_.I.")-1, 1, 0 },
- { "GLOBAL_.D.", sizeof ("GLOBAL_.D.")-1, 2, 0 },
-#endif
-#else
- { "GLOBAL_$I$", sizeof ("GLOBAL_$I$")-1, 1, 0 },
- { "GLOBAL_$D$", sizeof ("GLOBAL_$D$")-1, 2, 0 },
-#endif
- { "GLOBAL__FI_", sizeof ("GLOBAL__FI_")-1, 3, 0 },
- { "GLOBAL__FD_", sizeof ("GLOBAL__FD_")-1, 4, 0 },
-#ifdef CFRONT_LOSSAGE /* Don't collect cfront initialization functions.
- cfront has its own linker procedure to collect them;
- if collect2 gets them too, they get collected twice
- when the cfront procedure is run and the compiler used
- for linking happens to be GCC. */
- { "sti__", sizeof ("sti__")-1, 1, 1 },
- { "std__", sizeof ("std__")-1, 2, 1 },
-#endif /* CFRONT_LOSSAGE */
- { NULL, 0, 0, 0 }
- };
-
- while ((ch = *s) == '_')
- ++s;
-
- if (s == orig_s)
- return 0;
-
- for (p = &special[0]; p->len > 0; p++)
- {
- if (ch == p->name[0]
- && (!p->two_underscores || ((s - orig_s) >= 2))
- && strncmp(s, p->name, p->len) == 0)
- {
- return p->ret;
- }
- }
- return 0;
-}
-
-/* Routine to add variables to the environment. */
-
-#ifndef HAVE_PUTENV
-
-int
-putenv (str)
- char *str;
-{
-#ifndef VMS /* nor about VMS */
-
- extern char **environ;
- char **old_environ = environ;
- char **envp;
- int num_envs = 0;
- int name_len = 1;
- char *p = str;
- int ch;
-
- while ((ch = *p++) != '\0' && ch != '=')
- name_len++;
-
- if (!ch)
- abort ();
-
- /* Search for replacing an existing environment variable, and
- count the number of total environment variables. */
- for (envp = old_environ; *envp; envp++)
- {
- num_envs++;
- if (!strncmp (str, *envp, name_len))
- {
- *envp = str;
- return 0;
- }
- }
-
- /* Add a new environment variable */
- environ = (char **) xmalloc (sizeof (char *) * (num_envs+2));
- *environ = str;
- bcopy ((char *) old_environ, (char *) (environ + 1),
- sizeof (char *) * (num_envs+1));
-
- return 0;
-#endif /* VMS */
-}
-
-#endif /* HAVE_PUTENV */
-
-/* By default, colon separates directories in a path. */
-#ifndef PATH_SEPARATOR
-#define PATH_SEPARATOR ':'
-#endif
-
-/* We maintain two prefix lists: one from COMPILER_PATH environment variable
- and one from the PATH variable. */
-
-static struct path_prefix cpath, path;
-
-#ifdef CROSS_COMPILE
-/* This is the name of the target machine. We use it to form the name
- of the files to execute. */
-
-static char *target_machine = TARGET_MACHINE;
-#endif
-
-/* Names under which we were executed. Never return one of those files in our
- searches. */
-
-static struct path_prefix our_file_names;
-
-/* Determine if STRING is in PPREFIX.
-
- This utility is currently only used to look up file names. Prefix lists
- record directory names. This matters to us because the latter has a
- trailing slash, so I've added a flag to handle both. */
-
-static int
-is_in_prefix_list (pprefix, string, filep)
- struct path_prefix *pprefix;
- char *string;
- int filep;
-{
- struct prefix_list *pl;
-
- if (filep)
- {
- int len = strlen (string);
-
- for (pl = pprefix->plist; pl; pl = pl->next)
- {
- if (strncmp (pl->prefix, string, len) == 0
- && strcmp (pl->prefix + len, "/") == 0)
- return 1;
- }
- }
- else
- {
- for (pl = pprefix->plist; pl; pl = pl->next)
- {
- if (strcmp (pl->prefix, string) == 0)
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Search for NAME using prefix list PPREFIX. We only look for executable
- files.
-
- Return 0 if not found, otherwise return its name, allocated with malloc. */
-
-static char *
-find_a_file (pprefix, name)
- struct path_prefix *pprefix;
- char *name;
-{
- char *temp;
- struct prefix_list *pl;
- int len = pprefix->max_len + strlen (name) + 1;
-
-#ifdef EXECUTABLE_SUFFIX
- len += strlen (EXECUTABLE_SUFFIX);
-#endif
-
- temp = xmalloc (len);
-
- /* Determine the filename to execute (special case for absolute paths). */
-
- if (*name == '/')
- {
- if (access (name, X_OK) == 0)
- {
- strcpy (temp, name);
- return temp;
- }
- }
- else
- for (pl = pprefix->plist; pl; pl = pl->next)
- {
- strcpy (temp, pl->prefix);
- strcat (temp, name);
- if (! is_in_prefix_list (&our_file_names, temp, 1)
- /* This is a kludge, but there seems no way around it. */
- && strcmp (temp, "./ld") != 0
- && access (temp, X_OK) == 0)
- return temp;
-
-#ifdef EXECUTABLE_SUFFIX
- /* Some systems have a suffix for executable files.
- So try appending that. */
- strcat (temp, EXECUTABLE_SUFFIX);
- if (! is_in_prefix_list (&our_file_names, temp, 1)
- && access (temp, X_OK) == 0)
- return temp;
-#endif
- }
-
- free (temp);
- return 0;
-}
-
-/* Add an entry for PREFIX to prefix list PPREFIX. */
-
-static void
-add_prefix (pprefix, prefix)
- struct path_prefix *pprefix;
- char *prefix;
-{
- struct prefix_list *pl, **prev;
- int len;
-
- if (pprefix->plist)
- {
- for (pl = pprefix->plist; pl->next; pl = pl->next)
- ;
- prev = &pl->next;
- }
- else
- prev = &pprefix->plist;
-
- /* Keep track of the longest prefix */
-
- len = strlen (prefix);
- if (len > pprefix->max_len)
- pprefix->max_len = len;
-
- pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list));
- pl->prefix = savestring (prefix, len);
-
- if (*prev)
- pl->next = *prev;
- else
- pl->next = (struct prefix_list *) 0;
- *prev = pl;
-}
-
-/* Take the value of the environment variable ENV, break it into a path, and
- add of the entries to PPREFIX. */
-
-static void
-prefix_from_env (env, pprefix)
- char *env;
- struct path_prefix *pprefix;
-{
- char *p = getenv (env);
-
- if (p)
- prefix_from_string (p, pprefix);
-}
-
-static void
-prefix_from_string (p, pprefix)
- char *p;
- struct path_prefix *pprefix;
-{
- char *startp, *endp;
- char *nstore = (char *) xmalloc (strlen (p) + 3);
-
- startp = endp = p;
- while (1)
- {
- if (*endp == PATH_SEPARATOR || *endp == 0)
- {
- strncpy (nstore, startp, endp-startp);
- if (endp == startp)
- {
- strcpy (nstore, "./");
- }
- else if (endp[-1] != '/')
- {
- nstore[endp-startp] = '/';
- nstore[endp-startp+1] = 0;
- }
- else
- nstore[endp-startp] = 0;
-
- add_prefix (pprefix, nstore);
- if (*endp == 0)
- break;
- endp = startp = endp + 1;
- }
- else
- endp++;
- }
-}
-
-/* Main program. */
-
-int
-main (argc, argv)
- int argc;
- char *argv[];
-{
- char *ld_suffix = "ld";
- char *full_ld_suffix = ld_suffix;
- char *real_ld_suffix = "real-ld";
- char *full_real_ld_suffix = real_ld_suffix;
- char *collect_ld_suffix = "collect-ld";
- char *nm_suffix = "nm";
- char *full_nm_suffix = nm_suffix;
- char *gnm_suffix = "gnm";
- char *full_gnm_suffix = gnm_suffix;
-#ifdef LDD_SUFFIX
- char *ldd_suffix = LDD_SUFFIX;
- char *full_ldd_suffix = ldd_suffix;
-#endif
- char *strip_suffix = "strip";
- char *full_strip_suffix = strip_suffix;
- char *gstrip_suffix = "gstrip";
- char *full_gstrip_suffix = gstrip_suffix;
- char *arg;
- FILE *outf, *exportf;
- char *ld_file_name;
- char *collect_name;
- char *collect_names;
- char *p;
- char **c_argv;
- char **c_ptr;
- char **ld1_argv = (char **) xcalloc (sizeof (char *), argc+3);
- char **ld1 = ld1_argv;
- char **ld2_argv = (char **) xcalloc (sizeof (char *), argc+6);
- char **ld2 = ld2_argv;
- char **object_lst = (char **) xcalloc (sizeof (char *), argc);
- char **object = object_lst;
- int first_file;
- int num_c_args = argc+7;
-
-#ifdef DEBUG
- debug = 1;
- vflag = 1;
-#endif
-
-#ifndef DEFAULT_A_OUT_NAME
- output_file = "a.out";
-#else
- output_file = DEFAULT_A_OUT_NAME;
-#endif
-
- obstack_begin (&temporary_obstack, 0);
- obstack_begin (&permanent_obstack, 0);
- temporary_firstobj = (char *) obstack_alloc (&temporary_obstack, 0);
- current_demangling_style = gnu_demangling;
-
- /* We must check that we do not call ourselves in an infinite
- recursion loop. We append the name used for us to the COLLECT_NAMES
- environment variable.
-
- In practice, collect will rarely invoke itself. This can happen now
- that we are no longer called gld. A perfect example is when running
- gcc in a build directory that has been installed. When looking for
- ld's, we'll find our installed version and believe that's the real ld. */
-
- /* We must also append COLLECT_NAME to COLLECT_NAMES to watch for the
- previous version of collect (the one that used COLLECT_NAME and only
- handled two levels of recursion). If we don't we may mutually recurse
- forever. This can happen (I think) when bootstrapping the old version
- and a new one is installed (rare, but we should handle it).
- ??? Hopefully references to COLLECT_NAME can be removed at some point. */
-
- collect_name = (char *) getenv ("COLLECT_NAME");
- collect_names = (char *) getenv ("COLLECT_NAMES");
-
- p = (char *) xmalloc (strlen ("COLLECT_NAMES=")
- + (collect_name ? strlen (collect_name) + 1 : 0)
- + (collect_names ? strlen (collect_names) + 1 : 0)
- + strlen (argv[0]) + 1);
- strcpy (p, "COLLECT_NAMES=");
- if (collect_name != 0)
- sprintf (p + strlen (p), "%s%c", collect_name, PATH_SEPARATOR);
- if (collect_names != 0)
- sprintf (p + strlen (p), "%s%c", collect_names, PATH_SEPARATOR);
- strcat (p, argv[0]);
- putenv (p);
-
- prefix_from_env ("COLLECT_NAMES", &our_file_names);
-
- /* Set environment variable COLLECT_NAME to our name so the previous version
- of collect won't find us. If it does we'll mutually recurse forever.
- This can happen when bootstrapping the new version and an old version is
- installed.
- ??? Hopefully this bit of code can be removed at some point. */
-
- p = xmalloc (strlen ("COLLECT_NAME=") + strlen (argv[0]) + 1);
- sprintf (p, "COLLECT_NAME=%s", argv[0]);
- putenv (p);
-
- p = (char *) getenv ("COLLECT_GCC_OPTIONS");
- if (p)
- while (*p)
- {
- char *q = p;
- while (*q && *q != ' ') q++;
- if (*p == '-' && p[1] == 'm')
- num_c_args++;
-
- if (*q) q++;
- p = q;
- }
-
- c_ptr = c_argv = (char **) xcalloc (sizeof (char *), num_c_args);
-
- if (argc < 2)
- fatal ("no arguments");
-
-#ifdef SIGQUIT
- if (signal (SIGQUIT, SIG_IGN) != SIG_IGN)
- signal (SIGQUIT, handler);
-#endif
- if (signal (SIGINT, SIG_IGN) != SIG_IGN)
- signal (SIGINT, handler);
-#ifdef SIGALRM
- if (signal (SIGALRM, SIG_IGN) != SIG_IGN)
- signal (SIGALRM, handler);
-#endif
-#ifdef SIGHUP
- if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
- signal (SIGHUP, handler);
-#endif
- if (signal (SIGSEGV, SIG_IGN) != SIG_IGN)
- signal (SIGSEGV, handler);
-#ifdef SIGBUS
- if (signal (SIGBUS, SIG_IGN) != SIG_IGN)
- signal (SIGBUS, handler);
-#endif
-
- /* Extract COMPILER_PATH and PATH into our prefix list. */
- prefix_from_env ("COMPILER_PATH", &cpath);
- prefix_from_env ("PATH", &path);
-
-#ifdef CROSS_COMPILE
- /* If we look for a program in the compiler directories, we just use
- the short name, since these directories are already system-specific.
- But it we look for a took in the system directories, we need to
- qualify the program name with the target machine. */
-
- full_ld_suffix
- = xcalloc (strlen (ld_suffix) + strlen (target_machine) + 2, 1);
- strcpy (full_ld_suffix, target_machine);
- strcat (full_ld_suffix, "-");
- strcat (full_ld_suffix, ld_suffix);
-
- full_real_ld_suffix
- = xcalloc (strlen (real_ld_suffix) + strlen (target_machine) + 2, 1);
- strcpy (full_real_ld_suffix, target_machine);
- strcat (full_real_ld_suffix, "-");
- strcat (full_real_ld_suffix, real_ld_suffix);
-
-#if 0
- full_gld_suffix
- = xcalloc (strlen (gld_suffix) + strlen (target_machine) + 2, 1);
- strcpy (full_gld_suffix, target_machine);
- strcat (full_gld_suffix, "-");
- strcat (full_gld_suffix, gld_suffix);
-#endif
-
- full_nm_suffix
- = xcalloc (strlen (nm_suffix) + strlen (target_machine) + 2, 1);
- strcpy (full_nm_suffix, target_machine);
- strcat (full_nm_suffix, "-");
- strcat (full_nm_suffix, nm_suffix);
-
- full_gnm_suffix
- = xcalloc (strlen (gnm_suffix) + strlen (target_machine) + 2, 1);
- strcpy (full_gnm_suffix, target_machine);
- strcat (full_gnm_suffix, "-");
- strcat (full_gnm_suffix, gnm_suffix);
-
-#ifdef LDD_SUFFIX
- full_ldd_suffix
- = xcalloc (strlen (ldd_suffix) + strlen (target_machine) + 2, 1);
- strcpy (full_ldd_suffix, target_machine);
- strcat (full_ldd_suffix, "-");
- strcat (full_ldd_suffix, ldd_suffix);
-#endif
-
- full_strip_suffix
- = xcalloc (strlen (strip_suffix) + strlen (target_machine) + 2, 1);
- strcpy (full_strip_suffix, target_machine);
- strcat (full_strip_suffix, "-");
- strcat (full_strip_suffix, strip_suffix);
-
- full_gstrip_suffix
- = xcalloc (strlen (gstrip_suffix) + strlen (target_machine) + 2, 1);
- strcpy (full_gstrip_suffix, target_machine);
- strcat (full_gstrip_suffix, "-");
- strcat (full_gstrip_suffix, gstrip_suffix);
-#endif /* CROSS_COMPILE */
-
- /* Try to discover a valid linker/nm/strip to use. */
-
- /* Maybe we know the right file to use (if not cross). */
-#ifdef REAL_LD_FILE_NAME
- ld_file_name = find_a_file (&path, REAL_LD_FILE_NAME);
- if (ld_file_name == 0)
-#endif
- /* Search the (target-specific) compiler dirs for ld'. */
- ld_file_name = find_a_file (&cpath, real_ld_suffix);
- /* Likewise for `collect-ld'. */
- if (ld_file_name == 0)
- ld_file_name = find_a_file (&cpath, collect_ld_suffix);
- /* Search the compiler directories for `ld'. We have protection against
- recursive calls in find_a_file. */
- if (ld_file_name == 0)
- ld_file_name = find_a_file (&cpath, ld_suffix);
- /* Search the ordinary system bin directories
- for `ld' (if native linking) or `TARGET-ld' (if cross). */
- if (ld_file_name == 0)
- ld_file_name = find_a_file (&path, full_ld_suffix);
-
- /* If we've invoked ourselves, try again with LD_FILE_NAME. */
-
- if (collect_names != 0)
- {
- if (ld_file_name != 0)
- {
- argv[0] = ld_file_name;
- execvp (argv[0], argv);
- }
- fatal ("cannot find `ld'");
- }
-
-#ifdef REAL_NM_FILE_NAME
- nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME);
- if (nm_file_name == 0)
-#endif
- nm_file_name = find_a_file (&cpath, gnm_suffix);
- if (nm_file_name == 0)
- nm_file_name = find_a_file (&path, full_gnm_suffix);
- if (nm_file_name == 0)
- nm_file_name = find_a_file (&cpath, nm_suffix);
- if (nm_file_name == 0)
- nm_file_name = find_a_file (&path, full_nm_suffix);
-
-#ifdef LDD_SUFFIX
- ldd_file_name = find_a_file (&cpath, ldd_suffix);
- if (ldd_file_name == 0)
- ldd_file_name = find_a_file (&path, full_ldd_suffix);
-#endif
-
-#ifdef REAL_STRIP_FILE_NAME
- strip_file_name = find_a_file (&path, REAL_STRIP_FILE_NAME);
- if (strip_file_name == 0)
-#endif
- strip_file_name = find_a_file (&cpath, gstrip_suffix);
- if (strip_file_name == 0)
- strip_file_name = find_a_file (&path, full_gstrip_suffix);
- if (strip_file_name == 0)
- strip_file_name = find_a_file (&cpath, strip_suffix);
- if (strip_file_name == 0)
- strip_file_name = find_a_file (&path, full_strip_suffix);
-
- /* Determine the full path name of the C compiler to use. */
- c_file_name = getenv ("COLLECT_GCC");
- if (c_file_name == 0)
- {
-#ifdef CROSS_COMPILE
- c_file_name = xcalloc (sizeof ("gcc-") + strlen (target_machine) + 1, 1);
- strcpy (c_file_name, target_machine);
- strcat (c_file_name, "-gcc");
-#else
- c_file_name = "gcc";
-#endif
- }
-
- p = find_a_file (&cpath, c_file_name);
-
- /* Here it should be safe to use the system search path since we should have
- already qualified the name of the compiler when it is needed. */
- if (p == 0)
- p = find_a_file (&path, c_file_name);
-
- if (p)
- c_file_name = p;
-
- *ld1++ = *ld2++ = ld_file_name;
-
- /* Make temp file names. */
- temp_filename = choose_temp_base ();
- temp_filename_length = strlen (temp_filename);
- c_file = xcalloc (temp_filename_length + sizeof (".c"), 1);
- o_file = xcalloc (temp_filename_length + sizeof (".o"), 1);
- export_file = xmalloc (temp_filename_length + sizeof (".x"));
- ldout = xmalloc (temp_filename_length + sizeof (".ld"));
- sprintf (ldout, "%s.ld", temp_filename);
- sprintf (c_file, "%s.c", temp_filename);
- sprintf (o_file, "%s.o", temp_filename);
- sprintf (export_file, "%s.x", temp_filename);
- *c_ptr++ = c_file_name;
- *c_ptr++ = "-c";
- *c_ptr++ = "-o";
- *c_ptr++ = o_file;
-
- /* !!! When GCC calls collect2,
- it does not know whether it is calling collect2 or ld.
- So collect2 cannot meaningfully understand any options
- except those ld understands.
- If you propose to make GCC pass some other option,
- just imagine what will happen if ld is really ld!!! */
-
- /* Parse arguments. Remember output file spec, pass the rest to ld. */
- /* After the first file, put in the c++ rt0. */
-
- first_file = 1;
- while ((arg = *++argv) != (char *) 0)
- {
- *ld1++ = *ld2++ = arg;
-
- if (arg[0] == '-')
- {
- switch (arg[1])
- {
- case 'd':
- if (!strcmp (arg, "-debug"))
- {
- debug = 1;
- vflag = 1;
- ld1--;
- ld2--;
- }
- break;
-
- case 'l':
- if (first_file)
- {
- /* place o_file BEFORE this argument! */
- first_file = 0;
- ld2--;
- *ld2++ = o_file;
- *ld2++ = arg;
- }
- break;
-
- case 'o':
- if (arg[2] == '\0')
- output_file = *ld1++ = *ld2++ = *++argv;
- else
- output_file = &arg[2];
- break;
-
- case 'r':
- if (arg[2] == '\0')
- rflag = 1;
- break;
-
- case 's':
- if (arg[2] == '\0' && do_collecting)
- {
- /* We must strip after the nm run, otherwise C++ linking
- won't work. Thus we strip in the second ld run, or
- else with strip if there is no second ld run. */
- strip_flag = 1;
- ld1--;
- }
- break;
-
- case 'v':
- if (arg[2] == '\0')
- vflag = 1;
- break;
- }
- }
- else if ((p = rindex (arg, '.')) != (char *) 0
- && (strcmp (p, ".o") == 0 || strcmp (p, ".a") == 0))
- {
- if (first_file)
- {
- first_file = 0;
- if (p[1] == 'o')
- *ld2++ = o_file;
- else
- {
- /* place o_file BEFORE this argument! */
- ld2--;
- *ld2++ = o_file;
- *ld2++ = arg;
- }
- }
- if (p[1] == 'o')
- *object++ = arg;
- }
- }
-
- /* Get any options that the upper GCC wants to pass to the sub-GCC. */
- p = (char *) getenv ("COLLECT_GCC_OPTIONS");
- if (p)
- while (*p)
- {
- char *q = p;
- while (*q && *q != ' ') q++;
- if (*p == '-' && (p[1] == 'm' || p[1] == 'f'))
- *c_ptr++ = savestring (p, q - p);
- if (strncmp (p, "-shared", sizeof ("shared") - 1) == 0)
- shared_obj = 1;
-
- if (*q) q++;
- p = q;
- }
-
-#ifdef COLLECT_EXPORT_LIST
- /* The AIX linker will discard static constructors in object files if
- nothing else in the file is referenced, so look at them first. */
- while (object_lst < object)
- scan_prog_file (*object_lst++, PASS_OBJ);
-
- {
- char *buf = alloca (strlen (export_file) + 5);
- sprintf (buf, "-bE:%s", export_file);
- *ld1++ = buf;
- *ld2++ = buf;
- exportf = fopen (export_file, "w");
- if (exportf == (FILE *) 0)
- fatal_perror ("%s", export_file);
- write_export_file (exportf);
- if (fclose (exportf))
- fatal_perror ("closing %s", export_file);
- }
-#endif
-
- *c_ptr++ = c_file;
- *object = *c_ptr = *ld1 = (char *) 0;
-
- if (vflag)
- {
- fprintf (stderr, "collect2 version %s", version_string);
-#ifdef TARGET_VERSION
- TARGET_VERSION;
-#endif
- fprintf (stderr, "\n");
- }
-
- if (debug)
- {
- char *ptr;
- fprintf (stderr, "ld_file_name = %s\n",
- (ld_file_name ? ld_file_name : "not found"));
- fprintf (stderr, "c_file_name = %s\n",
- (c_file_name ? c_file_name : "not found"));
- fprintf (stderr, "nm_file_name = %s\n",
- (nm_file_name ? nm_file_name : "not found"));
-#ifdef LDD_SUFFIX
- fprintf (stderr, "ldd_file_name = %s\n",
- (ldd_file_name ? ldd_file_name : "not found"));
-#endif
- fprintf (stderr, "strip_file_name = %s\n",
- (strip_file_name ? strip_file_name : "not found"));
- fprintf (stderr, "c_file = %s\n",
- (c_file ? c_file : "not found"));
- fprintf (stderr, "o_file = %s\n",
- (o_file ? o_file : "not found"));
-
- ptr = getenv ("COLLECT_NAMES");
- if (ptr)
- fprintf (stderr, "COLLECT_NAMES = %s\n", ptr);
-
- ptr = getenv ("COLLECT_GCC_OPTIONS");
- if (ptr)
- fprintf (stderr, "COLLECT_GCC_OPTIONS = %s\n", ptr);
-
- ptr = getenv ("COLLECT_GCC");
- if (ptr)
- fprintf (stderr, "COLLECT_GCC = %s\n", ptr);
-
- ptr = getenv ("COMPILER_PATH");
- if (ptr)
- fprintf (stderr, "COMPILER_PATH = %s\n", ptr);
-
- ptr = getenv ("LIBRARY_PATH");
- if (ptr)
- fprintf (stderr, "LIBRARY_PATH = %s\n", ptr);
-
- fprintf (stderr, "\n");
- }
-
- /* Load the program, searching all libraries. */
-
- collect_execute ("ld", ld1_argv, ldout);
- do_wait ("ld");
- dump_file (ldout);
- unlink (ldout);
-
- /* If -r or they'll be run via some other method, don't build the
- constructor or destructor list, just return now. */
- if (rflag || ! do_collecting)
- return 0;
-
- /* Examine the namelist with nm and search it for static constructors
- and destructors to call.
- Write the constructor and destructor tables to a .s file and reload. */
-
- scan_prog_file (output_file, PASS_FIRST);
-
-#ifdef SCAN_LIBRARIES
- scan_libraries (output_file);
-#endif
-
- if (debug)
- {
- fprintf (stderr, "%d constructor(s) found\n", constructors.number);
- fprintf (stderr, "%d destructor(s) found\n", destructors.number);
- }
-
- if (constructors.number == 0 && destructors.number == 0
-#ifdef LDD_SUFFIX
- /* If we will be running these functions ourselves, we want to emit
- stubs into the shared library so that we don't have to relink
- dependent programs when we add static objects. */
- && ! shared_obj
-#endif
- )
- {
- /* Strip now if it was requested on the command line. */
- if (strip_flag)
- {
- char **strip_argv = (char **) xcalloc (sizeof (char *), 3);
- strip_argv[0] = strip_file_name;
- strip_argv[1] = output_file;
- strip_argv[2] = (char *) 0;
- fork_execute ("strip", strip_argv);
- }
-
-#ifdef COLLECT_EXPORT_LIST
- maybe_unlink (export_file);
-#endif
- return 0;
- }
-
- maybe_unlink(output_file);
- outf = fopen (c_file, "w");
- if (outf == (FILE *) 0)
- fatal_perror ("%s", c_file);
-
- write_c_file (outf, c_file);
-
- if (fclose (outf))
- fatal_perror ("closing %s", c_file);
-
- /* Tell the linker that we have initializer and finalizer functions. */
-#ifdef LD_INIT_SWITCH
- *ld2++ = LD_INIT_SWITCH;
- *ld2++ = initname;
- *ld2++ = LD_FINI_SWITCH;
- *ld2++ = fininame;
-#endif
- *ld2 = (char*) 0;
-
-#ifdef COLLECT_EXPORT_LIST
- if (shared_obj)
- {
- add_to_list (&exports, initname);
- add_to_list (&exports, fininame);
- add_to_list (&exports, "_GLOBAL__DI");
- add_to_list (&exports, "_GLOBAL__DD");
- exportf = fopen (export_file, "w");
- if (exportf == (FILE *) 0)
- fatal_perror ("%s", export_file);
- write_export_file (exportf);
- if (fclose (exportf))
- fatal_perror ("closing %s", export_file);
- }
-#endif
-
- if (debug)
- {
- fprintf (stderr, "\n========== output_file = %s, c_file = %s\n",
- output_file, c_file);
- write_c_file (stderr, "stderr");
- fprintf (stderr, "========== end of c_file\n\n");
-#ifdef COLLECT_EXPORT_LIST
- fprintf (stderr, "\n========== export_file = %s\n", export_file);
- write_export_file (stderr);
- fprintf (stderr, "========== end of export_file\n\n");
-#endif
- }
-
- /* Assemble the constructor and destructor tables.
- Link the tables in with the rest of the program. */
-
- fork_execute ("gcc", c_argv);
- fork_execute ("ld", ld2_argv);
-
- /* Let scan_prog_file do any final mods (OSF/rose needs this for
- constructors/destructors in shared libraries. */
- scan_prog_file (output_file, PASS_SECOND);
-
- maybe_unlink (c_file);
- maybe_unlink (o_file);
- maybe_unlink (export_file);
- return 0;
-}
-
-
-/* Wait for a process to finish, and exit if a non-zero status is found. */
-
-int
-collect_wait (prog)
- char *prog;
-{
- int status;
-
- wait (&status);
- if (status)
- {
- if (WIFSIGNALED (status))
- {
- int sig = WTERMSIG (status);
-#ifdef NO_SYS_SIGLIST
- error ("%s terminated with signal %d %s",
- prog,
- sig,
- (status & 0200) ? ", core dumped" : "");
-#else
- error ("%s terminated with signal %d [%s]%s",
- prog,
- sig,
- sys_siglist[sig],
- (status & 0200) ? ", core dumped" : "");
-#endif
-
- collect_exit (127);
- }
-
- if (WIFEXITED (status))
- return WEXITSTATUS (status);
- }
- return 0;
-}
-
-static void
-do_wait (prog)
- char *prog;
-{
- int ret = collect_wait (prog);
- if (ret != 0)
- {
- error ("%s returned %d exit status", prog, ret);
- collect_exit (ret);
- }
-}
-
-
-/* Fork and execute a program, and wait for the reply. */
-
-void
-collect_execute (prog, argv, redir)
- char *prog;
- char **argv;
- char *redir;
-{
- int pid;
-
- if (vflag || debug)
- {
- char **p_argv;
- char *str;
-
- if (argv[0])
- fprintf (stderr, "%s", argv[0]);
- else
- fprintf (stderr, "[cannot find %s]", prog);
-
- for (p_argv = &argv[1]; (str = *p_argv) != (char *) 0; p_argv++)
- fprintf (stderr, " %s", str);
-
- fprintf (stderr, "\n");
- }
-
- fflush (stdout);
- fflush (stderr);
-
- /* If we can't find a program we need, complain error. Do this here
- since we might not end up needing something that we couldn't find. */
-
- if (argv[0] == 0)
- fatal ("cannot find `%s'", prog);
-
- pid = vfork ();
- if (pid == -1)
- {
-#ifdef vfork
- fatal_perror ("fork");
-#else
- fatal_perror ("vfork");
-#endif
- }
-
- if (pid == 0) /* child context */
- {
- if (redir)
- {
- unlink (redir);
- if (freopen (redir, "a", stdout) == NULL)
- fatal_perror ("redirecting stdout");
- if (freopen (redir, "a", stderr) == NULL)
- fatal_perror ("redirecting stderr");
- }
-
- execvp (argv[0], argv);
- fatal_perror ("executing %s", prog);
- }
-}
-
-static void
-fork_execute (prog, argv)
- char *prog;
- char **argv;
-{
- collect_execute (prog, argv, NULL);
- do_wait (prog);
-}
-
-/* Unlink a file unless we are debugging. */
-
-static void
-maybe_unlink (file)
- char *file;
-{
- if (!debug)
- unlink (file);
- else
- fprintf (stderr, "[Leaving %s]\n", file);
-}
-
-
-/* Add a name to a linked list. */
-
-static void
-add_to_list (head_ptr, name)
- struct head *head_ptr;
- char *name;
-{
- struct id *newid
- = (struct id *) xcalloc (sizeof (struct id) + strlen (name), 1);
- struct id *p;
- static long sequence_number = 0;
- strcpy (newid->name, name);
-
- if (head_ptr->first)
- head_ptr->last->next = newid;
- else
- head_ptr->first = newid;
-
- /* Check for duplicate symbols. */
- for (p = head_ptr->first;
- strcmp (name, p->name) != 0;
- p = p->next)
- ;
- if (p != newid)
- {
- head_ptr->last->next = 0;
- free (newid);
- return;
- }
-
- newid->sequence = ++sequence_number;
- head_ptr->last = newid;
- head_ptr->number++;
-}
-
-/* Write: `prefix', the names on list LIST, `suffix'. */
-
-static void
-write_list (stream, prefix, list)
- FILE *stream;
- char *prefix;
- struct id *list;
-{
- while (list)
- {
- fprintf (stream, "%sx%d,\n", prefix, list->sequence);
- list = list->next;
- }
-}
-
-static void
-write_list_with_asm (stream, prefix, list)
- FILE *stream;
- char *prefix;
- struct id *list;
-{
- while (list)
- {
- fprintf (stream, "%sx%d __asm__ (\"%s\");\n",
- prefix, list->sequence, list->name);
- list = list->next;
- }
-}
-
-/* Write out the constructor and destructor tables statically (for a shared
- object), along with the functions to execute them. */
-
-static void
-write_c_file_stat (stream, name)
- FILE *stream;
- char *name;
-{
- char *prefix, *p, *q;
-
- /* Figure out name of output_file, stripping off .so version. */
- p = rindex (output_file, '/');
- if (p == 0)
- p = (char *) output_file;
- else
- p++;
- q = p;
- while (q)
- {
- q = index (q,'.');
- if (q == 0)
- {
- q = p + strlen (p);
- break;
- }
- else
- {
- if (strncmp (q, ".so", 3) == 0)
- {
- q += 3;
- break;
- }
- else
- q++;
- }
- }
- /* q points to null at end of the string (or . of the .so version) */
- prefix = xmalloc (q - p + 1);
- strncpy (prefix, p, q - p);
- prefix[q - p] = 0;
- for (q = prefix; *q; q++)
- if (!isalnum (*q))
- *q = '_';
- if (debug)
- fprintf (stderr, "\nwrite_c_file - output name is %s, prefix is %s\n",
- output_file, prefix);
-
-#define INIT_NAME_FORMAT "_GLOBAL__FI_%s"
- initname = xmalloc (strlen (prefix) + sizeof (INIT_NAME_FORMAT) - 2);
- sprintf (initname, INIT_NAME_FORMAT, prefix);
-
-#define FINI_NAME_FORMAT "_GLOBAL__FD_%s"
- fininame = xmalloc (strlen (prefix) + sizeof (FINI_NAME_FORMAT) - 2);
- sprintf (fininame, FINI_NAME_FORMAT, prefix);
-
- free (prefix);
-
- /* Write the tables as C code */
-
- fprintf (stream, "static int count;\n");
- fprintf (stream, "typedef void entry_pt();\n");
- write_list_with_asm (stream, "extern entry_pt ", constructors.first);
- fprintf (stream, "void %s() {\n", initname);
- if (constructors.number > 0)
- {
- fprintf (stream, "\tstatic entry_pt *ctors[] = {\n");
- write_list (stream, "\t\t", constructors.first);
- fprintf (stream, "\t};\n");
- fprintf (stream, "\tentry_pt **p;\n");
- fprintf (stream, "\tif (count++ != 0) return;\n");
- fprintf (stream, "\tp = ctors + %d;\n", constructors.number);
- fprintf (stream, "\twhile (p > ctors) (*--p)();\n");
- }
- else
- fprintf (stream, "\t++count;\n");
- fprintf (stream, "}\n");
- write_list_with_asm (stream, "extern entry_pt ", destructors.first);
- fprintf (stream, "void %s() {\n", fininame);
- if (destructors.number > 0)
- {
- fprintf (stream, "\tstatic entry_pt *dtors[] = {\n");
- write_list (stream, "\t\t", destructors.first);
- fprintf (stream, "\t};\n");
- fprintf (stream, "\tentry_pt **p;\n");
- fprintf (stream, "\tif (--count != 0) return;\n");
- fprintf (stream, "\tp = dtors;\n");
- fprintf (stream, "\twhile (p < dtors + %d) (*p++)();\n",
- destructors.number);
- }
- fprintf (stream, "}\n");
-
- if (shared_obj)
- {
- fprintf (stream, "void _GLOBAL__DI() {\n\t%s();\n}\n", initname);
- fprintf (stream, "void _GLOBAL__DD() {\n\t%s();\n}\n", fininame);
- }
-}
-
-/* Write the constructor/destructor tables. */
-
-static void
-write_c_file_glob (stream, name)
- FILE *stream;
- char *name;
-{
- /* Write the tables as C code */
-
- fprintf (stream, "typedef void entry_pt();\n\n");
-
- write_list_with_asm (stream, "extern entry_pt ", constructors.first);
-
- fprintf (stream, "\nentry_pt * __CTOR_LIST__[] = {\n");
- fprintf (stream, "\t(entry_pt *) %d,\n", constructors.number);
- write_list (stream, "\t", constructors.first);
- fprintf (stream, "\t0\n};\n\n");
-
- write_list_with_asm (stream, "extern entry_pt ", destructors.first);
-
- fprintf (stream, "\nentry_pt * __DTOR_LIST__[] = {\n");
- fprintf (stream, "\t(entry_pt *) %d,\n", destructors.number);
- write_list (stream, "\t", destructors.first);
- fprintf (stream, "\t0\n};\n\n");
-
- fprintf (stream, "extern entry_pt %s;\n", NAME__MAIN);
- fprintf (stream, "entry_pt *__main_reference = %s;\n\n", NAME__MAIN);
-}
-
-static void
-write_c_file (stream, name)
- FILE *stream;
- char *name;
-{
- fprintf (stream, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
-#ifndef LD_INIT_SWITCH
- if (! shared_obj)
- write_c_file_glob (stream, name);
- else
-#endif
- write_c_file_stat (stream, name);
- fprintf (stream, "#ifdef __cplusplus\n}\n#endif\n");
-}
-
-static void
-write_export_file (stream)
- FILE *stream;
-{
- struct id *list = exports.first;
- for (; list; list = list->next)
- fprintf (stream, "%s\n", list->name);
-}
-
-#ifdef OBJECT_FORMAT_NONE
-
-/* Generic version to scan the name list of the loaded program for
- the symbols g++ uses for static constructors and destructors.
-
- The constructor table begins at __CTOR_LIST__ and contains a count
- of the number of pointers (or -1 if the constructors are built in a
- separate section by the linker), followed by the pointers to the
- constructor functions, terminated with a null pointer. The
- destructor table has the same format, and begins at __DTOR_LIST__. */
-
-static void
-scan_prog_file (prog_name, which_pass)
- char *prog_name;
- enum pass which_pass;
-{
- void (*int_handler) ();
- void (*quit_handler) ();
- char *nm_argv[4];
- int pid;
- int argc = 0;
- int pipe_fd[2];
- char *p, buf[1024];
- FILE *inf;
-
- if (which_pass == PASS_SECOND)
- return;
-
- /* If we don't have an `nm', complain. */
- if (nm_file_name == 0)
- fatal ("cannot find `nm'");
-
- nm_argv[argc++] = nm_file_name;
- if (NM_FLAGS[0] != '\0')
- nm_argv[argc++] = NM_FLAGS;
-
- nm_argv[argc++] = prog_name;
- nm_argv[argc++] = (char *) 0;
-
- if (pipe (pipe_fd) < 0)
- fatal_perror ("pipe");
-
- inf = fdopen (pipe_fd[0], "r");
- if (inf == (FILE *) 0)
- fatal_perror ("fdopen");
-
- /* Trace if needed. */
- if (vflag)
- {
- char **p_argv;
- char *str;
-
- for (p_argv = &nm_argv[0]; (str = *p_argv) != (char *) 0; p_argv++)
- fprintf (stderr, " %s", str);
-
- fprintf (stderr, "\n");
- }
-
- fflush (stdout);
- fflush (stderr);
-
- /* Spawn child nm on pipe */
- pid = vfork ();
- if (pid == -1)
- {
-#ifdef vfork
- fatal_perror ("fork");
-#else
- fatal_perror ("vfork");
-#endif
- }
-
- if (pid == 0) /* child context */
- {
- /* setup stdout */
- if (dup2 (pipe_fd[1], 1) < 0)
- fatal_perror ("dup2 (%d, 1)", pipe_fd[1]);
-
- if (close (pipe_fd[0]) < 0)
- fatal_perror ("close (%d)", pipe_fd[0]);
-
- if (close (pipe_fd[1]) < 0)
- fatal_perror ("close (%d)", pipe_fd[1]);
-
- execv (nm_file_name, nm_argv);
- fatal_perror ("executing %s", nm_file_name);
- }
-
- /* Parent context from here on. */
- int_handler = (void (*) ())signal (SIGINT, SIG_IGN);
-#ifdef SIGQUIT
- quit_handler = (void (*) ())signal (SIGQUIT, SIG_IGN);
-#endif
-
- if (close (pipe_fd[1]) < 0)
- fatal_perror ("close (%d)", pipe_fd[1]);
-
- if (debug)
- fprintf (stderr, "\nnm output with constructors/destructors.\n");
-
- /* Read each line of nm output. */
- while (fgets (buf, sizeof buf, inf) != (char *) 0)
- {
- int ch, ch2;
- char *name, *end;
-
- /* If it contains a constructor or destructor name, add the name
- to the appropriate list. */
-
- for (p = buf; (ch = *p) != '\0' && ch != '\n' && ch != '_'; p++)
- if (ch == ' ' && p[1] == 'U' && p[2] == ' ')
- break;
-
- if (ch != '_')
- continue;
-
- name = p;
- /* Find the end of the symbol name.
- Don't include `|', because Encore nm can tack that on the end. */
- for (end = p; (ch2 = *end) != '\0' && !isspace (ch2) && ch2 != '|';
- end++)
- continue;
-
-
- *end = '\0';
- switch (is_ctor_dtor (name))
- {
- case 1:
- if (which_pass != PASS_LIB)
- add_to_list (&constructors, name);
- break;
-
- case 2:
- if (which_pass != PASS_LIB)
- add_to_list (&destructors, name);
- break;
-
- case 3:
- if (which_pass != PASS_LIB)
- fatal ("init function found in object %s", prog_name);
-#ifndef LD_INIT_SWITCH
- add_to_list (&constructors, name);
-#endif
- break;
-
- case 4:
- if (which_pass != PASS_LIB)
- fatal ("fini function found in object %s", prog_name);
-#ifndef LD_FINI_SWITCH
- add_to_list (&destructors, name);
-#endif
- break;
-
- default: /* not a constructor or destructor */
- continue;
- }
-
- if (debug)
- fprintf (stderr, "\t%s\n", buf);
- }
-
- if (debug)
- fprintf (stderr, "\n");
-
- if (fclose (inf) != 0)
- fatal_perror ("fclose of pipe");
-
- do_wait (nm_file_name);
-
- signal (SIGINT, int_handler);
-#ifdef SIGQUIT
- signal (SIGQUIT, quit_handler);
-#endif
-}
-
-#if SUNOS4_SHARED_LIBRARIES
-
-/* Routines to scan the SunOS 4 _DYNAMIC structure to find shared libraries
- that the output file depends upon and their initialization/finalization
- routines, if any. */
-
-#include <a.out.h>
-#include <fcntl.h>
-#include <link.h>
-#include <sys/mman.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <sys/dir.h>
-
-/* pointers to the object file */
-unsigned object; /* address of memory mapped file */
-unsigned objsize; /* size of memory mapped to file */
-char * code; /* pointer to code segment */
-char * data; /* pointer to data segment */
-struct nlist *symtab; /* pointer to symbol table */
-struct link_dynamic *ld;
-struct link_dynamic_2 *ld_2;
-struct head libraries;
-
-/* Map the file indicated by NAME into memory and store its address. */
-
-static void
-mapfile (name)
- char *name;
-{
- int fp;
- struct stat s;
- if ((fp = open (name, O_RDONLY)) == -1)
- fatal ("unable to open file '%s'", name);
- if (fstat (fp, &s) == -1)
- fatal ("unable to stat file '%s'", name);
-
- objsize = s.st_size;
- object = (unsigned) mmap (0, objsize, PROT_READ|PROT_WRITE, MAP_PRIVATE,
- fp, 0);
- if (object == -1)
- fatal ("unable to mmap file '%s'", name);
-
- close (fp);
-}
-
-/* Helpers for locatelib. */
-
-static char *libname;
-
-static int
-libselect (d)
- struct direct *d;
-{
- return (strncmp (libname, d->d_name, strlen (libname)) == 0);
-}
-
-/* If one file has an additional numeric extension past LIBNAME, then put
- that one first in the sort. If both files have additional numeric
- extensions, then put the one with the higher number first in the sort.
-
- We must verify that the extension is numeric, because Sun saves the
- original versions of patched libraries with a .FCS extension. Files with
- invalid extensions must go last in the sort, so that they won't be used. */
-
-static int
-libcompare (d1, d2)
- struct direct **d1, **d2;
-{
- int i1, i2 = strlen (libname);
- char *e1 = (*d1)->d_name + i2;
- char *e2 = (*d2)->d_name + i2;
-
- while (*e1 && *e2 && *e1 == '.' && *e2 == '.'
- && e1[1] && isdigit (e1[1]) && e2[1] && isdigit (e2[1]))
- {
- ++e1;
- ++e2;
- i1 = strtol (e1, &e1, 10);
- i2 = strtol (e2, &e2, 10);
- if (i1 != i2)
- return i1 - i2;
- }
-
- if (*e1)
- {
- /* It has a valid numeric extension, prefer this one. */
- if (*e1 == '.' && e1[1] && isdigit (e1[1]))
- return 1;
- /* It has a invalid numeric extension, must prefer the other one. */
- else
- return -1;
- }
- else if (*e2)
- {
- /* It has a valid numeric extension, prefer this one. */
- if (*e2 == '.' && e2[1] && isdigit (e2[1]))
- return -1;
- /* It has a invalid numeric extension, must prefer the other one. */
- else
- return 1;
- }
- else
- return 0;
-}
-
-/* Given the name NAME of a dynamic dependency, find its pathname and add
- it to the list of libraries. */
-
-static void
-locatelib (name)
- char *name;
-{
- static char **l;
- static int cnt;
- char buf[MAXPATHLEN];
- char *p, *q;
- char **pp;
-
- if (l == 0)
- {
- char *ld_rules;
- char *ldr = 0;
- /* counting elements in array, need 1 extra for null */
- cnt = 1;
- ld_rules = (char *) (ld_2->ld_rules + code);
- if (ld_rules)
- {
- cnt++;
- for (; *ld_rules != 0; ld_rules++)
- if (*ld_rules == ':')
- cnt++;
- ld_rules = (char *) (ld_2->ld_rules + code);
- ldr = (char *) malloc (strlen (ld_rules) + 1);
- strcpy (ldr, ld_rules);
- }
- p = getenv ("LD_LIBRARY_PATH");
- q = 0;
- if (p)
- {
- cnt++;
- for (q = p ; *q != 0; q++)
- if (*q == ':')
- cnt++;
- q = (char *) malloc (strlen (p) + 1);
- strcpy (q, p);
- }
- l = (char **) malloc ((cnt + 3) * sizeof (char *));
- pp = l;
- if (ldr)
- {
- *pp++ = ldr;
- for (; *ldr != 0; ldr++)
- if (*ldr == ':')
- {
- *ldr++ = 0;
- *pp++ = ldr;
- }
- }
- if (q)
- {
- *pp++ = q;
- for (; *q != 0; q++)
- if (*q == ':')
- {
- *q++ = 0;
- *pp++ = q;
- }
- }
- /* built in directories are /lib, /usr/lib, and /usr/local/lib */
- *pp++ = "/lib";
- *pp++ = "/usr/lib";
- *pp++ = "/usr/local/lib";
- *pp = 0;
- }
- libname = name;
- for (pp = l; *pp != 0 ; pp++)
- {
- struct direct **namelist;
- int entries;
- if ((entries = scandir (*pp, &namelist, libselect, libcompare)) > 0)
- {
- sprintf (buf, "%s/%s", *pp, namelist[entries - 1]->d_name);
- add_to_list (&libraries, buf);
- if (debug)
- fprintf (stderr, "%s\n", buf);
- break;
- }
- }
- if (*pp == 0)
- {
- if (debug)
- fprintf (stderr, "not found\n");
- else
- fatal ("dynamic dependency %s not found", name);
- }
-}
-
-/* Scan the _DYNAMIC structure of the output file to find shared libraries
- that it depends upon and any constructors or destructors they contain. */
-
-static void
-scan_libraries (prog_name)
- char *prog_name;
-{
- struct exec *header;
- char *base;
- struct link_object *lo;
- char buff[MAXPATHLEN];
- struct id *list;
-
- mapfile (prog_name);
- header = (struct exec *)object;
- if (N_BADMAG (*header))
- fatal ("bad magic number in file '%s'", prog_name);
- if (header->a_dynamic == 0)
- return;
-
- code = (char *) (N_TXTOFF (*header) + (long) header);
- data = (char *) (N_DATOFF (*header) + (long) header);
- symtab = (struct nlist *) (N_SYMOFF (*header) + (long) header);
-
- if (header->a_magic == ZMAGIC && header->a_entry == 0x20)
- {
- /* shared object */
- ld = (struct link_dynamic *) (symtab->n_value + code);
- base = code;
- }
- else
- {
- /* executable */
- ld = (struct link_dynamic *) data;
- base = code-PAGSIZ;
- }
-
- if (debug)
- fprintf (stderr, "dynamic dependencies.\n");
-
- ld_2 = (struct link_dynamic_2 *) ((long) ld->ld_un.ld_2 + (long)base);
- for (lo = (struct link_object *) ld_2->ld_need; lo;
- lo = (struct link_object *) lo->lo_next)
- {
- char *name;
- lo = (struct link_object *) ((long) lo + code);
- name = (char *) (code + lo->lo_name);
- if (lo->lo_library)
- {
- if (debug)
- fprintf (stderr, "\t-l%s.%d => ", name, lo->lo_major);
- sprintf (buff, "lib%s.so.%d.%d", name, lo->lo_major, lo->lo_minor);
- locatelib (buff);
- }
- else
- {
- if (debug)
- fprintf (stderr, "\t%s\n", name);
- add_to_list (&libraries, name);
- }
- }
-
- if (debug)
- fprintf (stderr, "\n");
-
- /* now iterate through the library list adding their symbols to
- the list. */
- for (list = libraries.first; list; list = list->next)
- scan_prog_file (list->name, PASS_LIB);
-}
-
-#else /* SUNOS4_SHARED_LIBRARIES */
-#ifdef LDD_SUFFIX
-
-/* Use the List Dynamic Dependencies program to find shared libraries that
- the output file depends upon and their initialization/finalization
- routines, if any. */
-
-static void
-scan_libraries (prog_name)
- char *prog_name;
-{
- static struct head libraries; /* list of shared libraries found */
- struct id *list;
- void (*int_handler) ();
- void (*quit_handler) ();
- char *ldd_argv[4];
- int pid;
- int argc = 0;
- int pipe_fd[2];
- char buf[1024];
- FILE *inf;
-
- /* If we don't have an `ldd', complain. */
- if (ldd_file_name == 0)
- {
- error ("cannot find `ldd'");
- return;
- }
-
- ldd_argv[argc++] = ldd_file_name;
- ldd_argv[argc++] = prog_name;
- ldd_argv[argc++] = (char *) 0;
-
- if (pipe (pipe_fd) < 0)
- fatal_perror ("pipe");
-
- inf = fdopen (pipe_fd[0], "r");
- if (inf == (FILE *) 0)
- fatal_perror ("fdopen");
-
- /* Trace if needed. */
- if (vflag)
- {
- char **p_argv;
- char *str;
-
- for (p_argv = &ldd_argv[0]; (str = *p_argv) != (char *) 0; p_argv++)
- fprintf (stderr, " %s", str);
-
- fprintf (stderr, "\n");
- }
-
- fflush (stdout);
- fflush (stderr);
-
- /* Spawn child ldd on pipe */
- pid = vfork ();
- if (pid == -1)
- {
-#ifdef vfork
- fatal_perror ("fork");
-#else
- fatal_perror ("vfork");
-#endif
- }
-
- if (pid == 0) /* child context */
- {
- /* setup stdout */
- if (dup2 (pipe_fd[1], 1) < 0)
- fatal_perror ("dup2 (%d, 1)", pipe_fd[1]);
-
- if (close (pipe_fd[0]) < 0)
- fatal_perror ("close (%d)", pipe_fd[0]);
-
- if (close (pipe_fd[1]) < 0)
- fatal_perror ("close (%d)", pipe_fd[1]);
-
- execv (ldd_file_name, ldd_argv);
- fatal_perror ("executing %s", ldd_file_name);
- }
-
- /* Parent context from here on. */
- int_handler = (void (*) ()) signal (SIGINT, SIG_IGN);
-#ifdef SIGQUIT
- quit_handler = (void (*) ()) signal (SIGQUIT, SIG_IGN);
-#endif
-
- if (close (pipe_fd[1]) < 0)
- fatal_perror ("close (%d)", pipe_fd[1]);
-
- if (debug)
- fprintf (stderr, "\nldd output with constructors/destructors.\n");
-
- /* Read each line of ldd output. */
- while (fgets (buf, sizeof buf, inf) != (char *) 0)
- {
- int ch, ch2;
- char *name, *end, *p = buf;
-
- /* Extract names of libraries and add to list. */
- PARSE_LDD_OUTPUT (p);
- if (p == 0)
- continue;
-
- name = p;
- if (strncmp (name, "not found", sizeof ("not found") - 1) == 0)
- fatal ("dynamic dependency %s not found", buf);
-
- /* Find the end of the symbol name. */
- for (end = p;
- (ch2 = *end) != '\0' && ch2 != '\n' && !isspace (ch2) && ch2 != '|';
- end++)
- continue;
- *end = '\0';
-
- if (access (name, R_OK) == 0)
- add_to_list (&libraries, name);
- else
- fatal ("unable to open dynamic dependency '%s'", buf);
-
- if (debug)
- fprintf (stderr, "\t%s\n", buf);
- }
- if (debug)
- fprintf (stderr, "\n");
-
- if (fclose (inf) != 0)
- fatal_perror ("fclose of pipe");
-
- do_wait (ldd_file_name);
-
- signal (SIGINT, int_handler);
-#ifdef SIGQUIT
- signal (SIGQUIT, quit_handler);
-#endif
-
- /* now iterate through the library list adding their symbols to
- the list. */
- for (list = libraries.first; list; list = list->next)
- scan_prog_file (list->name, PASS_LIB);
-}
-
-#endif /* LDD_SUFFIX */
-#endif /* SUNOS4_SHARED_LIBRARIES */
-
-#endif /* OBJECT_FORMAT_NONE */
-
-
-/*
- * COFF specific stuff.
- */
-
-#ifdef OBJECT_FORMAT_COFF
-
-#if defined(EXTENDED_COFF)
-# define GCC_SYMBOLS(X) (SYMHEADER(X).isymMax + SYMHEADER(X).iextMax)
-# define GCC_SYMENT SYMR
-# define GCC_OK_SYMBOL(X) ((X).st == stProc && (X).sc == scText)
-# define GCC_SYMINC(X) (1)
-# define GCC_SYMZERO(X) (SYMHEADER(X).isymMax)
-# define GCC_CHECK_HDR(X) (PSYMTAB(X) != 0)
-#else
-# define GCC_SYMBOLS(X) (HEADER(ldptr).f_nsyms)
-# define GCC_SYMENT SYMENT
-# define GCC_OK_SYMBOL(X) \
- (((X).n_sclass == C_EXT) && \
- (((X).n_type & N_TMASK) == (DT_NON << N_BTSHFT) || \
- ((X).n_type & N_TMASK) == (DT_FCN << N_BTSHFT)))
-# define GCC_SYMINC(X) ((X).n_numaux+1)
-# define GCC_SYMZERO(X) 0
-# define GCC_CHECK_HDR(X) (1)
-#endif
-
-extern char *ldgetname ();
-
-/* COFF version to scan the name list of the loaded program for
- the symbols g++ uses for static constructors and destructors.
-
- The constructor table begins at __CTOR_LIST__ and contains a count
- of the number of pointers (or -1 if the constructors are built in a
- separate section by the linker), followed by the pointers to the
- constructor functions, terminated with a null pointer. The
- destructor table has the same format, and begins at __DTOR_LIST__. */
-
-static void
-scan_prog_file (prog_name, which_pass)
- char *prog_name;
- enum pass which_pass;
-{
- LDFILE *ldptr = NULL;
- int sym_index, sym_count;
-
- if (which_pass != PASS_FIRST && which_pass != PASS_OBJ)
- return;
-
- if ((ldptr = ldopen (prog_name, ldptr)) == NULL)
- fatal ("%s: can't open as COFF file", prog_name);
-
- if (!MY_ISCOFF (HEADER (ldptr).f_magic))
- fatal ("%s: not a COFF file", prog_name);
-
- if (GCC_CHECK_HDR (ldptr))
- {
- sym_count = GCC_SYMBOLS (ldptr);
- sym_index = GCC_SYMZERO (ldptr);
- while (sym_index < sym_count)
- {
- GCC_SYMENT symbol;
-
- if (ldtbread (ldptr, sym_index, &symbol) <= 0)
- break;
- sym_index += GCC_SYMINC (symbol);
-
- if (GCC_OK_SYMBOL (symbol))
- {
- char *name;
-
- if ((name = ldgetname (ldptr, &symbol)) == NULL)
- continue; /* should never happen */
-
-#ifdef XCOFF_DEBUGGING_INFO
- /* All AIX function names have a duplicate entry beginning
- with a dot. */
- if (*name == '.')
- ++name;
-#endif
-
- switch (is_ctor_dtor (name))
- {
- case 1:
- add_to_list (&constructors, name);
- if (which_pass == PASS_OBJ)
- add_to_list (&exports, name);
- break;
-
- case 2:
- add_to_list (&destructors, name);
- if (which_pass == PASS_OBJ)
- add_to_list (&exports, name);
- break;
-
- default: /* not a constructor or destructor */
- continue;
- }
-
-#if !defined(EXTENDED_COFF)
- if (debug)
- fprintf (stderr, "\tsec=%d class=%d type=%s%o %s\n",
- symbol.n_scnum, symbol.n_sclass,
- (symbol.n_type ? "0" : ""), symbol.n_type,
- name);
-#else
- if (debug)
- fprintf (stderr, "\tiss = %5d, value = %5d, index = %5d, name = %s\n",
- symbol.iss, symbol.value, symbol.index, name);
-#endif
- }
- }
- }
-
- (void) ldclose(ldptr);
-}
-
-#ifdef XCOFF_SCAN_LIBS
-/* Scan imported AIX libraries for GCC static ctors and dtors.
- FIXME: it is possible to link an executable without the actual import
- library by using an "import file" - a text file listing symbols
- exported by a library. To support this, we would have to scan
- import files as well as actual shared binaries to find GCC ctors.
- TODO: use memory mapping instead of 'ld' routines, files are already
- memory mapped, but we could eliminate the extra in-memory copies.
- Is it worth the effort? */
-
-static void
-scan_libraries (prog_name)
- char *prog_name;
-{
- LDFILE *ldptr;
- SCNHDR ldsh;
- static struct path_prefix libpath; /* we should only do this once */
-
- if ((ldptr = ldopen (prog_name, ldptr)) == NULL)
- fatal ("%s: can't open as COFF file", prog_name);
-
- if (!MY_ISCOFF (HEADER (ldptr).f_magic))
- fatal ("%s: not a COFF file", prog_name);
-
- /* find and read loader section */
- if (ldnshread (ldptr, _LOADER, &ldsh))
- {
- LDHDR ldh;
- char *impbuf;
- int entry;
-
- FSEEK (ldptr, ldsh.s_scnptr, BEGINNING);
- FREAD (&ldh, sizeof (ldh), 1, ldptr);
- /* read import library list */
- impbuf = alloca (ldh.l_istlen);
- FSEEK (ldptr, ldh.l_impoff + ldsh.s_scnptr, BEGINNING);
- FREAD (impbuf, ldh.l_istlen, 1, ldptr);
-
- if (debug)
- fprintf (stderr, "LIBPATH=%s\n", impbuf);
- prefix_from_string (impbuf, &libpath);
-
- /* skip LIBPATH and empty base and member fields */
- impbuf += strlen (impbuf) + 3;
- for (entry = 1; entry < ldh.l_nimpid; ++entry)
- {
- char *impath = impbuf;
- char *implib = impath + strlen (impath) + 1;
- char *impmem = implib + strlen (implib) + 1;
- char *soname = NULL;
- char *trial;
- int pathlen;
- LDFILE *libptr = NULL;
- struct prefix_list *pl;
- ARCHDR ah;
-
- impbuf = impmem + strlen (impmem) + 1;
- if (debug)
- fprintf (stderr, "PATH+BASE=%s%s\n", impath, implib);
- /* Skip AIX kernel exports */
- if (*impath == '/' && *(impath+1) == '\0'
- && strcmp (implib, "unix") == 0)
- continue;
- pathlen = strlen (impath);
- trial = alloca (MAX (pathlen + 1, libpath.max_len)
- + strlen (implib) + 1);
- if (*impath)
- {
- strcpy (trial, impath);
- if (impath[pathlen - 1] != '/')
- trial[pathlen++] = '/';
- strcpy (trial + pathlen, implib);
- if (access (trial, R_OK) == 0)
- soname = trial;
- }
- else
- for (pl = libpath.plist; pl; pl = pl->next)
- {
- strcpy (trial, pl->prefix);
- strcat (trial, implib);
- if (access (trial, R_OK) == 0)
- {
- soname = trial;
- break;
- }
- }
-
- if (! soname)
- fatal ("%s: library not found", implib);
- if (debug)
- if (*impmem)
- fprintf (stderr, "%s (%s)\n", soname, impmem);
- else
- fprintf (stderr, "%s\n", soname);
-
- do
- {
- /* scan imported shared objects for GCC GLOBAL ctors */
- short type;
- if ((libptr = ldopen (soname, libptr)) == NULL)
- fatal ("%s: can't open import library", soname);
- if (TYPE (libptr) == ARTYPE)
- {
- LDFILE *memptr;
- if (! *impmem)
- fatal ("%s: no archive member specified", soname);
- ldahread (libptr, &ah);
- if (strcmp (ah.ar_name, impmem))
- continue;
- }
- type = HEADER (libptr).f_magic;
- if (HEADER (libptr).f_flags & F_SHROBJ)
- {
- SCNHDR soldsh;
- LDHDR soldh;
- long symcnt, i;
- char *ldstrings;
- LDSYM *lsyms;
- if (!ldnshread (libptr, _LOADER, &soldsh))
- fatal ("%s: not an import library", soname);
- FSEEK (libptr, soldsh.s_scnptr, BEGINNING);
- if (FREAD (&soldh, sizeof (soldh), 1, libptr) != 1)
- fatal ("%s: can't read loader section", soname);
- /*fprintf (stderr, "\tscanning %s\n", soname);*/
- symcnt = soldh.l_nsyms;
- lsyms = (LDSYM *) alloca (symcnt * sizeof (*lsyms));
- symcnt = FREAD (lsyms, sizeof (*lsyms), symcnt, libptr);
- ldstrings = alloca (soldh.l_stlen);
- FSEEK (libptr, soldsh.s_scnptr+soldh.l_stoff, BEGINNING);
- FREAD (ldstrings, soldh.l_stlen, 1, libptr);
- for (i = 0; i < symcnt; ++i)
- {
- LDSYM *l = lsyms + i;
- if (LDR_EXPORT (*l))
- {
- char *expname = 0;
- if (l->l_zeroes)
- expname = l->l_name;
- else if (l->l_offset < soldh.l_stlen)
- expname = ldstrings + l->l_offset;
- switch (is_ctor_dtor (expname))
- {
- case 3:
- if (debug)
- fprintf (stderr, "\t%s\n", expname);
- add_to_list (&constructors, expname);
- break;
-
- case 4:
- add_to_list (&destructors, expname);
- break;
-
- default: /* not a constructor or destructor */
- continue;
- }
- }
- }
- }
- else
- fprintf (stderr, "%s: type = %04X flags = %04X\n",
- ah.ar_name, type, HEADER (libptr).f_flags);
- }
- while (ldclose (libptr) == FAILURE);
- /* printf (stderr, "closed %s\n", soname); */
- }
- }
-}
-#endif /* XCOFF_SCAN_LIBS */
-
-#endif /* OBJECT_FORMAT_COFF */
-
-
-/*
- * OSF/rose specific stuff.
- */
-
-#ifdef OBJECT_FORMAT_ROSE
-
-/* Union of the various load commands */
-
-typedef union load_union
-{
- ldc_header_t hdr; /* common header */
- load_cmd_map_command_t map; /* map indexing other load cmds */
- interpreter_command_t iprtr; /* interpreter pathname */
- strings_command_t str; /* load commands strings section */
- region_command_t region; /* region load command */
- reloc_command_t reloc; /* relocation section */
- package_command_t pkg; /* package load command */
- symbols_command_t sym; /* symbol sections */
- entry_command_t ent; /* program start section */
- gen_info_command_t info; /* object information */
- func_table_command_t func; /* function constructors/destructors */
-} load_union_t;
-
-/* Structure to point to load command and data section in memory. */
-
-typedef struct load_all
-{
- load_union_t *load; /* load command */
- char *section; /* pointer to section */
-} load_all_t;
-
-/* Structure to contain information about a file mapped into memory. */
-
-struct file_info
-{
- char *start; /* start of map */
- char *name; /* filename */
- long size; /* size of the file */
- long rounded_size; /* size rounded to page boundary */
- int fd; /* file descriptor */
- int rw; /* != 0 if opened read/write */
- int use_mmap; /* != 0 if mmap'ed */
-};
-
-extern int decode_mach_o_hdr ();
-extern int encode_mach_o_hdr ();
-
-static void add_func_table PROTO((mo_header_t *, load_all_t *,
- symbol_info_t *, int));
-static void print_header PROTO((mo_header_t *));
-static void print_load_command PROTO((load_union_t *, size_t, int));
-static void bad_header PROTO((int));
-static struct file_info *read_file PROTO((char *, int, int));
-static void end_file PROTO((struct file_info *));
-
-/* OSF/rose specific version to scan the name list of the loaded
- program for the symbols g++ uses for static constructors and
- destructors.
-
- The constructor table begins at __CTOR_LIST__ and contains a count
- of the number of pointers (or -1 if the constructors are built in a
- separate section by the linker), followed by the pointers to the
- constructor functions, terminated with a null pointer. The
- destructor table has the same format, and begins at __DTOR_LIST__. */
-
-static void
-scan_prog_file (prog_name, which_pass)
- char *prog_name;
- enum pass which_pass;
-{
- char *obj;
- mo_header_t hdr;
- load_all_t *load_array;
- load_all_t *load_end;
- load_all_t *load_cmd;
- int symbol_load_cmds;
- off_t offset;
- int i;
- int num_syms;
- int status;
- char *str_sect;
- struct file_info *obj_file;
- int prog_fd;
- mo_lcid_t cmd_strings = -1;
- symbol_info_t *main_sym = 0;
- int rw = (which_pass != PASS_FIRST);
-
- prog_fd = open (prog_name, (rw) ? O_RDWR : O_RDONLY);
- if (prog_fd < 0)
- fatal_perror ("can't read %s", prog_name);
-
- obj_file = read_file (prog_name, prog_fd, rw);
- obj = obj_file->start;
-
- status = decode_mach_o_hdr (obj, MO_SIZEOF_RAW_HDR, MOH_HEADER_VERSION, &hdr);
- if (status != MO_HDR_CONV_SUCCESS)
- bad_header (status);
-
-
- /* Do some basic sanity checks. Note we explicitly use the big endian magic number,
- since the hardware will automatically swap bytes for us on loading little endian
- integers. */
-
-#ifndef CROSS_COMPILE
- if (hdr.moh_magic != MOH_MAGIC_MSB
- || hdr.moh_header_version != MOH_HEADER_VERSION
- || hdr.moh_byte_order != OUR_BYTE_ORDER
- || hdr.moh_data_rep_id != OUR_DATA_REP_ID
- || hdr.moh_cpu_type != OUR_CPU_TYPE
- || hdr.moh_cpu_subtype != OUR_CPU_SUBTYPE
- || hdr.moh_vendor_type != OUR_VENDOR_TYPE)
- {
- fatal ("incompatibilities between object file & expected values");
- }
-#endif
-
- if (debug)
- print_header (&hdr);
-
- offset = hdr.moh_first_cmd_off;
- load_end = load_array
- = (load_all_t *) xcalloc (sizeof (load_all_t), hdr.moh_n_load_cmds + 2);
-
- /* Build array of load commands, calculating the offsets */
- for (i = 0; i < hdr.moh_n_load_cmds; i++)
- {
- load_union_t *load_hdr; /* load command header */
-
- load_cmd = load_end++;
- load_hdr = (load_union_t *) (obj + offset);
-
- /* If modifying the program file, copy the header. */
- if (rw)
- {
- load_union_t *ptr = (load_union_t *) xmalloc (load_hdr->hdr.ldci_cmd_size);
- bcopy ((char *)load_hdr, (char *)ptr, load_hdr->hdr.ldci_cmd_size);
- load_hdr = ptr;
-
- /* null out old command map, because we will rewrite at the end. */
- if (ptr->hdr.ldci_cmd_type == LDC_CMD_MAP)
- {
- cmd_strings = ptr->map.lcm_ld_cmd_strings;
- ptr->hdr.ldci_cmd_type = LDC_UNDEFINED;
- }
- }
-
- load_cmd->load = load_hdr;
- if (load_hdr->hdr.ldci_section_off > 0)
- load_cmd->section = obj + load_hdr->hdr.ldci_section_off;
-
- if (debug)
- print_load_command (load_hdr, offset, i);
-
- offset += load_hdr->hdr.ldci_cmd_size;
- }
-
- /* If the last command is the load command map and is not undefined,
- decrement the count of load commands. */
- if (rw && load_end[-1].load->hdr.ldci_cmd_type == LDC_UNDEFINED)
- {
- load_end--;
- hdr.moh_n_load_cmds--;
- }
-
- /* Go through and process each symbol table section. */
- symbol_load_cmds = 0;
- for (load_cmd = load_array; load_cmd < load_end; load_cmd++)
- {
- load_union_t *load_hdr = load_cmd->load;
-
- if (load_hdr->hdr.ldci_cmd_type == LDC_SYMBOLS)
- {
- symbol_load_cmds++;
-
- if (debug)
- {
- char *kind = "unknown";
-
- switch (load_hdr->sym.symc_kind)
- {
- case SYMC_IMPORTS: kind = "imports"; break;
- case SYMC_DEFINED_SYMBOLS: kind = "defined"; break;
- case SYMC_STABS: kind = "stabs"; break;
- }
-
- fprintf (stderr, "\nProcessing symbol table #%d, offset = 0x%.8lx, kind = %s\n",
- symbol_load_cmds, load_hdr->hdr.ldci_section_off, kind);
- }
-
- if (load_hdr->sym.symc_kind != SYMC_DEFINED_SYMBOLS)
- continue;
-
- str_sect = load_array[load_hdr->sym.symc_strings_section].section;
- if (str_sect == (char *) 0)
- fatal ("string section missing");
-
- if (load_cmd->section == (char *) 0)
- fatal ("section pointer missing");
-
- num_syms = load_hdr->sym.symc_nentries;
- for (i = 0; i < num_syms; i++)
- {
- symbol_info_t *sym = ((symbol_info_t *) load_cmd->section) + i;
- char *name = sym->si_name.symbol_name + str_sect;
-
- if (name[0] != '_')
- continue;
-
- if (rw)
- {
- char *n = name + strlen (name) - strlen (NAME__MAIN);
-
- if ((n - name) < 0 || strcmp (n, NAME__MAIN))
- continue;
- while (n != name)
- if (*--n != '_')
- continue;
-
- main_sym = sym;
- }
- else
- {
- switch (is_ctor_dtor (name))
- {
- case 1:
- add_to_list (&constructors, name);
- break;
-
- case 2:
- add_to_list (&destructors, name);
- break;
-
- default: /* not a constructor or destructor */
- continue;
- }
- }
-
- if (debug)
- fprintf (stderr, "\ttype = 0x%.4x, sc = 0x%.2x, flags = 0x%.8x, name = %.30s\n",
- sym->si_type, sym->si_sc_type, sym->si_flags, name);
- }
- }
- }
-
- if (symbol_load_cmds == 0)
- fatal ("no symbol table found");
-
- /* Update the program file now, rewrite header and load commands. At present,
- we assume that there is enough space after the last load command to insert
- one more. Since the first section written out is page aligned, and the
- number of load commands is small, this is ok for the present. */
-
- if (rw)
- {
- load_union_t *load_map;
- size_t size;
-
- if (cmd_strings == -1)
- fatal ("no cmd_strings found");
-
- /* Add __main to initializer list.
- If we are building a program instead of a shared library, don't
- do anything, since in the current version, you cannot do mallocs
- and such in the constructors. */
-
- if (main_sym != (symbol_info_t *) 0
- && ((hdr.moh_flags & MOH_EXECABLE_F) == 0))
- add_func_table (&hdr, load_array, main_sym, FNTC_INITIALIZATION);
-
- if (debug)
- fprintf (stderr, "\nUpdating header and load commands.\n\n");
-
- hdr.moh_n_load_cmds++;
- size = sizeof (load_cmd_map_command_t) + (sizeof (mo_offset_t) * (hdr.moh_n_load_cmds - 1));
-
- /* Create new load command map. */
- if (debug)
- fprintf (stderr, "load command map, %d cmds, new size %ld.\n",
- (int)hdr.moh_n_load_cmds, (long)size);
-
- load_map = (load_union_t *) xcalloc (1, size);
- load_map->map.ldc_header.ldci_cmd_type = LDC_CMD_MAP;
- load_map->map.ldc_header.ldci_cmd_size = size;
- load_map->map.lcm_ld_cmd_strings = cmd_strings;
- load_map->map.lcm_nentries = hdr.moh_n_load_cmds;
- load_array[hdr.moh_n_load_cmds-1].load = load_map;
-
- offset = hdr.moh_first_cmd_off;
- for (i = 0; i < hdr.moh_n_load_cmds; i++)
- {
- load_map->map.lcm_map[i] = offset;
- if (load_array[i].load->hdr.ldci_cmd_type == LDC_CMD_MAP)
- hdr.moh_load_map_cmd_off = offset;
-
- offset += load_array[i].load->hdr.ldci_cmd_size;
- }
-
- hdr.moh_sizeofcmds = offset - MO_SIZEOF_RAW_HDR;
-
- if (debug)
- print_header (&hdr);
-
- /* Write header */
- status = encode_mach_o_hdr (&hdr, obj, MO_SIZEOF_RAW_HDR);
- if (status != MO_HDR_CONV_SUCCESS)
- bad_header (status);
-
- if (debug)
- fprintf (stderr, "writing load commands.\n\n");
-
- /* Write load commands */
- offset = hdr.moh_first_cmd_off;
- for (i = 0; i < hdr.moh_n_load_cmds; i++)
- {
- load_union_t *load_hdr = load_array[i].load;
- size_t size = load_hdr->hdr.ldci_cmd_size;
-
- if (debug)
- print_load_command (load_hdr, offset, i);
-
- bcopy ((char *) load_hdr, (char *) (obj + offset), size);
- offset += size;
- }
- }
-
- end_file (obj_file);
-
- if (close (prog_fd))
- fatal_perror ("closing %s", prog_name);
-
- if (debug)
- fprintf (stderr, "\n");
-}
-
-
-/* Add a function table to the load commands to call a function
- on initiation or termination of the process. */
-
-static void
-add_func_table (hdr_p, load_array, sym, type)
- mo_header_t *hdr_p; /* pointer to global header */
- load_all_t *load_array; /* array of ptrs to load cmds */
- symbol_info_t *sym; /* pointer to symbol entry */
- int type; /* fntc_type value */
-{
- /* Add a new load command. */
- int num_cmds = ++hdr_p->moh_n_load_cmds;
- int load_index = num_cmds - 1;
- size_t size = sizeof (func_table_command_t) + sizeof (mo_addr_t);
- load_union_t *ptr = xcalloc (1, size);
- load_all_t *load_cmd;
- int i;
-
- /* Set the unresolved address bit in the header to force the loader to be
- used, since kernel exec does not call the initialization functions. */
- hdr_p->moh_flags |= MOH_UNRESOLVED_F;
-
- load_cmd = &load_array[load_index];
- load_cmd->load = ptr;
- load_cmd->section = (char *) 0;
-
- /* Fill in func table load command. */
- ptr->func.ldc_header.ldci_cmd_type = LDC_FUNC_TABLE;
- ptr->func.ldc_header.ldci_cmd_size = size;
- ptr->func.ldc_header.ldci_section_off = 0;
- ptr->func.ldc_header.ldci_section_len = 0;
- ptr->func.fntc_type = type;
- ptr->func.fntc_nentries = 1;
-
- /* copy address, turn it from abs. address to (region,offset) if necessary. */
- /* Is the symbol already expressed as (region, offset)? */
- if ((sym->si_flags & SI_ABSOLUTE_VALUE_F) == 0)
- {
- ptr->func.fntc_entry_loc[i].adr_lcid = sym->si_value.def_val.adr_lcid;
- ptr->func.fntc_entry_loc[i].adr_sctoff = sym->si_value.def_val.adr_sctoff;
- }
-
- /* If not, figure out which region it's in. */
- else
- {
- mo_vm_addr_t addr = sym->si_value.abs_val;
- int found = 0;
-
- for (i = 0; i < load_index; i++)
- {
- if (load_array[i].load->hdr.ldci_cmd_type == LDC_REGION)
- {
- region_command_t *region_ptr = &load_array[i].load->region;
-
- if ((region_ptr->regc_flags & REG_ABS_ADDR_F) != 0
- && addr >= region_ptr->regc_addr.vm_addr
- && addr <= region_ptr->regc_addr.vm_addr + region_ptr->regc_vm_size)
- {
- ptr->func.fntc_entry_loc[0].adr_lcid = i;
- ptr->func.fntc_entry_loc[0].adr_sctoff = addr - region_ptr->regc_addr.vm_addr;
- found++;
- break;
- }
- }
- }
-
- if (!found)
- fatal ("could not convert 0x%l.8x into a region", addr);
- }
-
- if (debug)
- fprintf (stderr,
- "%s function, region %d, offset = %ld (0x%.8lx)\n",
- (type == FNTC_INITIALIZATION) ? "init" : "term",
- (int)ptr->func.fntc_entry_loc[i].adr_lcid,
- (long)ptr->func.fntc_entry_loc[i].adr_sctoff,
- (long)ptr->func.fntc_entry_loc[i].adr_sctoff);
-
-}
-
-
-/* Print the global header for an OSF/rose object. */
-
-static void
-print_header (hdr_ptr)
- mo_header_t *hdr_ptr;
-{
- fprintf (stderr, "\nglobal header:\n");
- fprintf (stderr, "\tmoh_magic = 0x%.8lx\n", hdr_ptr->moh_magic);
- fprintf (stderr, "\tmoh_major_version = %d\n", (int)hdr_ptr->moh_major_version);
- fprintf (stderr, "\tmoh_minor_version = %d\n", (int)hdr_ptr->moh_minor_version);
- fprintf (stderr, "\tmoh_header_version = %d\n", (int)hdr_ptr->moh_header_version);
- fprintf (stderr, "\tmoh_max_page_size = %d\n", (int)hdr_ptr->moh_max_page_size);
- fprintf (stderr, "\tmoh_byte_order = %d\n", (int)hdr_ptr->moh_byte_order);
- fprintf (stderr, "\tmoh_data_rep_id = %d\n", (int)hdr_ptr->moh_data_rep_id);
- fprintf (stderr, "\tmoh_cpu_type = %d\n", (int)hdr_ptr->moh_cpu_type);
- fprintf (stderr, "\tmoh_cpu_subtype = %d\n", (int)hdr_ptr->moh_cpu_subtype);
- fprintf (stderr, "\tmoh_vendor_type = %d\n", (int)hdr_ptr->moh_vendor_type);
- fprintf (stderr, "\tmoh_load_map_cmd_off = %d\n", (int)hdr_ptr->moh_load_map_cmd_off);
- fprintf (stderr, "\tmoh_first_cmd_off = %d\n", (int)hdr_ptr->moh_first_cmd_off);
- fprintf (stderr, "\tmoh_sizeofcmds = %d\n", (int)hdr_ptr->moh_sizeofcmds);
- fprintf (stderr, "\tmon_n_load_cmds = %d\n", (int)hdr_ptr->moh_n_load_cmds);
- fprintf (stderr, "\tmoh_flags = 0x%.8lx", (long)hdr_ptr->moh_flags);
-
- if (hdr_ptr->moh_flags & MOH_RELOCATABLE_F)
- fprintf (stderr, ", relocatable");
-
- if (hdr_ptr->moh_flags & MOH_LINKABLE_F)
- fprintf (stderr, ", linkable");
-
- if (hdr_ptr->moh_flags & MOH_EXECABLE_F)
- fprintf (stderr, ", execable");
-
- if (hdr_ptr->moh_flags & MOH_EXECUTABLE_F)
- fprintf (stderr, ", executable");
-
- if (hdr_ptr->moh_flags & MOH_UNRESOLVED_F)
- fprintf (stderr, ", unresolved");
-
- fprintf (stderr, "\n\n");
- return;
-}
-
-
-/* Print a short summary of a load command. */
-
-static void
-print_load_command (load_hdr, offset, number)
- load_union_t *load_hdr;
- size_t offset;
- int number;
-{
- mo_long_t type = load_hdr->hdr.ldci_cmd_type;
- char *type_str = (char *) 0;
-
- switch (type)
- {
- case LDC_UNDEFINED: type_str = "UNDEFINED"; break;
- case LDC_CMD_MAP: type_str = "CMD_MAP"; break;
- case LDC_INTERPRETER: type_str = "INTERPRETER"; break;
- case LDC_STRINGS: type_str = "STRINGS"; break;
- case LDC_REGION: type_str = "REGION"; break;
- case LDC_RELOC: type_str = "RELOC"; break;
- case LDC_PACKAGE: type_str = "PACKAGE"; break;
- case LDC_SYMBOLS: type_str = "SYMBOLS"; break;
- case LDC_ENTRY: type_str = "ENTRY"; break;
- case LDC_FUNC_TABLE: type_str = "FUNC_TABLE"; break;
- case LDC_GEN_INFO: type_str = "GEN_INFO"; break;
- }
-
- fprintf (stderr,
- "cmd %2d, sz: 0x%.2lx, coff: 0x%.3lx, doff: 0x%.6lx, dlen: 0x%.6lx",
- number,
- (long) load_hdr->hdr.ldci_cmd_size,
- (long) offset,
- (long) load_hdr->hdr.ldci_section_off,
- (long) load_hdr->hdr.ldci_section_len);
-
- if (type_str == (char *) 0)
- fprintf (stderr, ", ty: unknown (%ld)\n", (long) type);
-
- else if (type != LDC_REGION)
- fprintf (stderr, ", ty: %s\n", type_str);
-
- else
- {
- char *region = "";
- switch (load_hdr->region.regc_usage_type)
- {
- case REG_TEXT_T: region = ", .text"; break;
- case REG_DATA_T: region = ", .data"; break;
- case REG_BSS_T: region = ", .bss"; break;
- case REG_GLUE_T: region = ", .glue"; break;
-#if defined (REG_RDATA_T) && defined (REG_SDATA_T) && defined (REG_SBSS_T) /*mips*/
- case REG_RDATA_T: region = ", .rdata"; break;
- case REG_SDATA_T: region = ", .sdata"; break;
- case REG_SBSS_T: region = ", .sbss"; break;
-#endif
- }
-
- fprintf (stderr, ", ty: %s, vaddr: 0x%.8lx, vlen: 0x%.6lx%s\n",
- type_str,
- (long) load_hdr->region.regc_vm_addr,
- (long) load_hdr->region.regc_vm_size,
- region);
- }
-
- return;
-}
-
-
-/* Fatal error when {en,de}code_mach_o_header fails. */
-
-static void
-bad_header (status)
- int status;
-{
- char *msg = (char *) 0;
-
- switch (status)
- {
- case MO_ERROR_BAD_MAGIC: msg = "bad magic number"; break;
- case MO_ERROR_BAD_HDR_VERS: msg = "bad header version"; break;
- case MO_ERROR_BAD_RAW_HDR_VERS: msg = "bad raw header version"; break;
- case MO_ERROR_BUF2SML: msg = "raw header buffer too small"; break;
- case MO_ERROR_OLD_RAW_HDR_FILE: msg = "old raw header file"; break;
- case MO_ERROR_UNSUPPORTED_VERS: msg = "unsupported version"; break;
- }
-
- if (msg == (char *) 0)
- fatal ("unknown {de,en}code_mach_o_hdr return value %d", status);
- else
- fatal ("%s", msg);
-}
-
-
-/* Read a file into a memory buffer. */
-
-static struct file_info *
-read_file (name, fd, rw)
- char *name; /* filename */
- int fd; /* file descriptor */
- int rw; /* read/write */
-{
- struct stat stat_pkt;
- struct file_info *p = (struct file_info *) xcalloc (sizeof (struct file_info), 1);
-#ifdef USE_MMAP
- static int page_size;
-#endif
-
- if (fstat (fd, &stat_pkt) < 0)
- fatal_perror ("fstat %s", name);
-
- p->name = name;
- p->size = stat_pkt.st_size;
- p->rounded_size = stat_pkt.st_size;
- p->fd = fd;
- p->rw = rw;
-
-#ifdef USE_MMAP
- if (debug)
- fprintf (stderr, "mmap %s, %s\n", name, (rw) ? "read/write" : "read-only");
-
- if (page_size == 0)
- page_size = sysconf (_SC_PAGE_SIZE);
-
- p->rounded_size = ((p->size + page_size - 1) / page_size) * page_size;
- p->start = mmap ((caddr_t) 0,
- (rw) ? p->rounded_size : p->size,
- (rw) ? (PROT_READ | PROT_WRITE) : PROT_READ,
- MAP_FILE | MAP_VARIABLE | MAP_SHARED,
- fd,
- 0L);
-
- if (p->start != (char *) 0 && p->start != (char *) -1)
- p->use_mmap = 1;
-
- else
-#endif /* USE_MMAP */
- {
- long len;
-
- if (debug)
- fprintf (stderr, "read %s\n", name);
-
- p->use_mmap = 0;
- p->start = xmalloc (p->size);
- if (lseek (fd, 0L, SEEK_SET) < 0)
- fatal_perror ("lseek to 0 on %s", name);
-
- len = read (fd, p->start, p->size);
- if (len < 0)
- fatal_perror ("read %s", name);
-
- if (len != p->size)
- fatal ("read %ld bytes, expected %ld, from %s", len, p->size, name);
- }
-
- return p;
-}
-
-/* Do anything necessary to write a file back from memory. */
-
-static void
-end_file (ptr)
- struct file_info *ptr; /* file information block */
-{
-#ifdef USE_MMAP
- if (ptr->use_mmap)
- {
- if (ptr->rw)
- {
- if (debug)
- fprintf (stderr, "msync %s\n", ptr->name);
-
- if (msync (ptr->start, ptr->rounded_size, MS_ASYNC))
- fatal_perror ("msync %s", ptr->name);
- }
-
- if (debug)
- fprintf (stderr, "munmap %s\n", ptr->name);
-
- if (munmap (ptr->start, ptr->size))
- fatal_perror ("munmap %s", ptr->name);
- }
- else
-#endif /* USE_MMAP */
- {
- if (ptr->rw)
- {
- long len;
-
- if (debug)
- fprintf (stderr, "write %s\n", ptr->name);
-
- if (lseek (ptr->fd, 0L, SEEK_SET) < 0)
- fatal_perror ("lseek to 0 on %s", ptr->name);
-
- len = write (ptr->fd, ptr->start, ptr->size);
- if (len < 0)
- fatal_perror ("write %s", ptr->name);
-
- if (len != ptr->size)
- fatal ("wrote %ld bytes, expected %ld, to %s", len, ptr->size, ptr->name);
- }
-
- free (ptr->start);
- }
-
- free (ptr);
-}
-
-#endif /* OBJECT_FORMAT_ROSE */
diff --git a/gcc/combine.c b/gcc/combine.c
deleted file mode 100644
index a2d63ea82fc..00000000000
--- a/gcc/combine.c
+++ /dev/null
@@ -1,11519 +0,0 @@
-/* Optimize by combining instructions for GNU compiler.
- Copyright (C) 1987, 88, 92-96, 1997 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 module is essentially the "combiner" phase of the U. of Arizona
- Portable Optimizer, but redone to work on our list-structured
- representation for RTL instead of their string representation.
-
- The LOG_LINKS of each insn identify the most recent assignment
- to each REG used in the insn. It is a list of previous insns,
- each of which contains a SET for a REG that is used in this insn
- and not used or set in between. LOG_LINKs never cross basic blocks.
- They were set up by the preceding pass (lifetime analysis).
-
- We try to combine each pair of insns joined by a logical link.
- We also try to combine triples of insns A, B and C when
- C has a link back to B and B has a link back to A.
-
- LOG_LINKS does not have links for use of the CC0. They don't
- need to, because the insn that sets the CC0 is always immediately
- before the insn that tests it. So we always regard a branch
- insn as having a logical link to the preceding insn. The same is true
- for an insn explicitly using CC0.
-
- We check (with use_crosses_set_p) to avoid combining in such a way
- as to move a computation to a place where its value would be different.
-
- Combination is done by mathematically substituting the previous
- insn(s) values for the regs they set into the expressions in
- the later insns that refer to these regs. If the result is a valid insn
- for our target machine, according to the machine description,
- we install it, delete the earlier insns, and update the data flow
- information (LOG_LINKS and REG_NOTES) for what we did.
-
- There are a few exceptions where the dataflow information created by
- flow.c aren't completely updated:
-
- - reg_live_length is not updated
- - reg_n_refs is not adjusted in the rare case when a register is
- no longer required in a computation
- - there are extremely rare cases (see distribute_regnotes) when a
- REG_DEAD note is lost
- - a LOG_LINKS entry that refers to an insn with multiple SETs may be
- removed because there is no way to know which register it was
- linking
-
- To simplify substitution, we combine only when the earlier insn(s)
- consist of only a single assignment. To simplify updating afterward,
- we never combine when a subroutine call appears in the middle.
-
- Since we do not represent assignments to CC0 explicitly except when that
- is all an insn does, there is no LOG_LINKS entry in an insn that uses
- the condition code for the insn that set the condition code.
- Fortunately, these two insns must be consecutive.
- Therefore, every JUMP_INSN is taken to have an implicit logical link
- to the preceding insn. This is not quite right, since non-jumps can
- also use the condition code; but in practice such insns would not
- combine anyway. */
-
-#include "config.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-/* Must precede rtl.h for FFS. */
-#include <stdio.h>
-
-#include "rtl.h"
-#include "flags.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "expr.h"
-#include "basic-block.h"
-#include "insn-config.h"
-#include "insn-flags.h"
-#include "insn-codes.h"
-#include "insn-attr.h"
-#include "recog.h"
-#include "real.h"
-
-/* It is not safe to use ordinary gen_lowpart in combine.
- Use gen_lowpart_for_combine instead. See comments there. */
-#define gen_lowpart dont_use_gen_lowpart_you_dummy
-
-/* Number of attempts to combine instructions in this function. */
-
-static int combine_attempts;
-
-/* Number of attempts that got as far as substitution in this function. */
-
-static int combine_merges;
-
-/* Number of instructions combined with added SETs in this function. */
-
-static int combine_extras;
-
-/* Number of instructions combined in this function. */
-
-static int combine_successes;
-
-/* Totals over entire compilation. */
-
-static int total_attempts, total_merges, total_extras, total_successes;
-
-/* Define a default value for REVERSIBLE_CC_MODE.
- We can never assume that a condition code mode is safe to reverse unless
- the md tells us so. */
-#ifndef REVERSIBLE_CC_MODE
-#define REVERSIBLE_CC_MODE(MODE) 0
-#endif
-
-/* Vector mapping INSN_UIDs to cuids.
- The cuids are like uids but increase monotonically always.
- Combine always uses cuids so that it can compare them.
- But actually renumbering the uids, which we used to do,
- proves to be a bad idea because it makes it hard to compare
- the dumps produced by earlier passes with those from later passes. */
-
-static int *uid_cuid;
-static int max_uid_cuid;
-
-/* Get the cuid of an insn. */
-
-#define INSN_CUID(INSN) \
-(INSN_UID (INSN) > max_uid_cuid ? insn_cuid (INSN) : uid_cuid[INSN_UID (INSN)])
-
-/* Maximum register number, which is the size of the tables below. */
-
-static int combine_max_regno;
-
-/* Record last point of death of (hard or pseudo) register n. */
-
-static rtx *reg_last_death;
-
-/* Record last point of modification of (hard or pseudo) register n. */
-
-static rtx *reg_last_set;
-
-/* Record the cuid of the last insn that invalidated memory
- (anything that writes memory, and subroutine calls, but not pushes). */
-
-static int mem_last_set;
-
-/* Record the cuid of the last CALL_INSN
- so we can tell whether a potential combination crosses any calls. */
-
-static int last_call_cuid;
-
-/* When `subst' is called, this is the insn that is being modified
- (by combining in a previous insn). The PATTERN of this insn
- is still the old pattern partially modified and it should not be
- looked at, but this may be used to examine the successors of the insn
- to judge whether a simplification is valid. */
-
-static rtx subst_insn;
-
-/* This is an insn that belongs before subst_insn, but is not currently
- on the insn chain. */
-
-static rtx subst_prev_insn;
-
-/* This is the lowest CUID that `subst' is currently dealing with.
- get_last_value will not return a value if the register was set at or
- after this CUID. If not for this mechanism, we could get confused if
- I2 or I1 in try_combine were an insn that used the old value of a register
- to obtain a new value. In that case, we might erroneously get the
- new value of the register when we wanted the old one. */
-
-static int subst_low_cuid;
-
-/* This contains any hard registers that are used in newpat; reg_dead_at_p
- must consider all these registers to be always live. */
-
-static HARD_REG_SET newpat_used_regs;
-
-/* This is an insn to which a LOG_LINKS entry has been added. If this
- insn is the earlier than I2 or I3, combine should rescan starting at
- that location. */
-
-static rtx added_links_insn;
-
-/* Basic block number of the block in which we are performing combines. */
-static int this_basic_block;
-
-/* The next group of arrays allows the recording of the last value assigned
- to (hard or pseudo) register n. We use this information to see if a
- operation being processed is redundant given a prior operation performed
- on the register. For example, an `and' with a constant is redundant if
- all the zero bits are already known to be turned off.
-
- We use an approach similar to that used by cse, but change it in the
- following ways:
-
- (1) We do not want to reinitialize at each label.
- (2) It is useful, but not critical, to know the actual value assigned
- to a register. Often just its form is helpful.
-
- Therefore, we maintain the following arrays:
-
- reg_last_set_value the last value assigned
- reg_last_set_label records the value of label_tick when the
- register was assigned
- reg_last_set_table_tick records the value of label_tick when a
- value using the register is assigned
- reg_last_set_invalid set to non-zero when it is not valid
- to use the value of this register in some
- register's value
-
- To understand the usage of these tables, it is important to understand
- the distinction between the value in reg_last_set_value being valid
- and the register being validly contained in some other expression in the
- table.
-
- Entry I in reg_last_set_value is valid if it is non-zero, and either
- reg_n_sets[i] is 1 or reg_last_set_label[i] == label_tick.
-
- Register I may validly appear in any expression returned for the value
- of another register if reg_n_sets[i] is 1. It may also appear in the
- value for register J if reg_last_set_label[i] < reg_last_set_label[j] or
- reg_last_set_invalid[j] is zero.
-
- If an expression is found in the table containing a register which may
- not validly appear in an expression, the register is replaced by
- something that won't match, (clobber (const_int 0)).
-
- reg_last_set_invalid[i] is set non-zero when register I is being assigned
- to and reg_last_set_table_tick[i] == label_tick. */
-
-/* Record last value assigned to (hard or pseudo) register n. */
-
-static rtx *reg_last_set_value;
-
-/* Record the value of label_tick when the value for register n is placed in
- reg_last_set_value[n]. */
-
-static int *reg_last_set_label;
-
-/* Record the value of label_tick when an expression involving register n
- is placed in reg_last_set_value. */
-
-static int *reg_last_set_table_tick;
-
-/* Set non-zero if references to register n in expressions should not be
- used. */
-
-static char *reg_last_set_invalid;
-
-/* Incremented for each label. */
-
-static int label_tick;
-
-/* Some registers that are set more than once and used in more than one
- basic block are nevertheless always set in similar ways. For example,
- a QImode register may be loaded from memory in two places on a machine
- where byte loads zero extend.
-
- We record in the following array what we know about the nonzero
- bits of a register, specifically which bits are known to be zero.
-
- If an entry is zero, it means that we don't know anything special. */
-
-static unsigned HOST_WIDE_INT *reg_nonzero_bits;
-
-/* Mode used to compute significance in reg_nonzero_bits. It is the largest
- integer mode that can fit in HOST_BITS_PER_WIDE_INT. */
-
-static enum machine_mode nonzero_bits_mode;
-
-/* Nonzero if we know that a register has some leading bits that are always
- equal to the sign bit. */
-
-static char *reg_sign_bit_copies;
-
-/* Nonzero when reg_nonzero_bits and reg_sign_bit_copies can be safely used.
- It is zero while computing them and after combine has completed. This
- former test prevents propagating values based on previously set values,
- which can be incorrect if a variable is modified in a loop. */
-
-static int nonzero_sign_valid;
-
-/* These arrays are maintained in parallel with reg_last_set_value
- and are used to store the mode in which the register was last set,
- the bits that were known to be zero when it was last set, and the
- number of sign bits copies it was known to have when it was last set. */
-
-static enum machine_mode *reg_last_set_mode;
-static unsigned HOST_WIDE_INT *reg_last_set_nonzero_bits;
-static char *reg_last_set_sign_bit_copies;
-
-/* Record one modification to rtl structure
- to be undone by storing old_contents into *where.
- is_int is 1 if the contents are an int. */
-
-struct undo
-{
- struct undo *next;
- int is_int;
- union {rtx r; int i;} old_contents;
- union {rtx *r; int *i;} where;
-};
-
-/* Record a bunch of changes to be undone, up to MAX_UNDO of them.
- num_undo says how many are currently recorded.
-
- storage is nonzero if we must undo the allocation of new storage.
- The value of storage is what to pass to obfree.
-
- other_insn is nonzero if we have modified some other insn in the process
- of working on subst_insn. It must be verified too.
-
- previous_undos is the value of undobuf.undos when we started processing
- this substitution. This will prevent gen_rtx_combine from re-used a piece
- from the previous expression. Doing so can produce circular rtl
- structures. */
-
-struct undobuf
-{
- char *storage;
- struct undo *undos;
- struct undo *frees;
- struct undo *previous_undos;
- rtx other_insn;
-};
-
-static struct undobuf undobuf;
-
-/* Substitute NEWVAL, an rtx expression, into INTO, a place in some
- insn. The substitution can be undone by undo_all. If INTO is already
- set to NEWVAL, do not record this change. Because computing NEWVAL might
- also call SUBST, we have to compute it before we put anything into
- the undo table. */
-
-#define SUBST(INTO, NEWVAL) \
- do { rtx _new = (NEWVAL); \
- struct undo *_buf; \
- \
- if (undobuf.frees) \
- _buf = undobuf.frees, undobuf.frees = _buf->next; \
- else \
- _buf = (struct undo *) xmalloc (sizeof (struct undo)); \
- \
- _buf->is_int = 0; \
- _buf->where.r = &INTO; \
- _buf->old_contents.r = INTO; \
- INTO = _new; \
- if (_buf->old_contents.r == INTO) \
- _buf->next = undobuf.frees, undobuf.frees = _buf; \
- else \
- _buf->next = undobuf.undos, undobuf.undos = _buf; \
- } while (0)
-
-/* Similar to SUBST, but NEWVAL is an int expression. Note that substitution
- for the value of a HOST_WIDE_INT value (including CONST_INT) is
- not safe. */
-
-#define SUBST_INT(INTO, NEWVAL) \
- do { struct undo *_buf; \
- \
- if (undobuf.frees) \
- _buf = undobuf.frees, undobuf.frees = _buf->next; \
- else \
- _buf = (struct undo *) xmalloc (sizeof (struct undo)); \
- \
- _buf->is_int = 1; \
- _buf->where.i = (int *) &INTO; \
- _buf->old_contents.i = INTO; \
- INTO = NEWVAL; \
- if (_buf->old_contents.i == INTO) \
- _buf->next = undobuf.frees, undobuf.frees = _buf; \
- else \
- _buf->next = undobuf.undos, undobuf.undos = _buf; \
- } while (0)
-
-/* Number of times the pseudo being substituted for
- was found and replaced. */
-
-static int n_occurrences;
-
-static void init_reg_last_arrays PROTO((void));
-static void setup_incoming_promotions PROTO((void));
-static void set_nonzero_bits_and_sign_copies PROTO((rtx, rtx));
-static int can_combine_p PROTO((rtx, rtx, rtx, rtx, rtx *, rtx *));
-static int combinable_i3pat PROTO((rtx, rtx *, rtx, rtx, int, rtx *));
-static rtx try_combine PROTO((rtx, rtx, rtx));
-static void undo_all PROTO((void));
-static rtx *find_split_point PROTO((rtx *, rtx));
-static rtx subst PROTO((rtx, rtx, rtx, int, int));
-static rtx simplify_rtx PROTO((rtx, enum machine_mode, int, int));
-static rtx simplify_if_then_else PROTO((rtx));
-static rtx simplify_set PROTO((rtx));
-static rtx simplify_logical PROTO((rtx, int));
-static rtx expand_compound_operation PROTO((rtx));
-static rtx expand_field_assignment PROTO((rtx));
-static rtx make_extraction PROTO((enum machine_mode, rtx, int, rtx, int,
- int, int, int));
-static rtx extract_left_shift PROTO((rtx, int));
-static rtx make_compound_operation PROTO((rtx, enum rtx_code));
-static int get_pos_from_mask PROTO((unsigned HOST_WIDE_INT, int *));
-static rtx force_to_mode PROTO((rtx, enum machine_mode,
- unsigned HOST_WIDE_INT, rtx, int));
-static rtx if_then_else_cond PROTO((rtx, rtx *, rtx *));
-static rtx known_cond PROTO((rtx, enum rtx_code, rtx, rtx));
-static int rtx_equal_for_field_assignment_p PROTO((rtx, rtx));
-static rtx make_field_assignment PROTO((rtx));
-static rtx apply_distributive_law PROTO((rtx));
-static rtx simplify_and_const_int PROTO((rtx, enum machine_mode, rtx,
- unsigned HOST_WIDE_INT));
-static unsigned HOST_WIDE_INT nonzero_bits PROTO((rtx, enum machine_mode));
-static int num_sign_bit_copies PROTO((rtx, enum machine_mode));
-static int merge_outer_ops PROTO((enum rtx_code *, HOST_WIDE_INT *,
- enum rtx_code, HOST_WIDE_INT,
- enum machine_mode, int *));
-static rtx simplify_shift_const PROTO((rtx, enum rtx_code, enum machine_mode,
- rtx, int));
-static int recog_for_combine PROTO((rtx *, rtx, rtx *, int *));
-static rtx gen_lowpart_for_combine PROTO((enum machine_mode, rtx));
-static rtx gen_rtx_combine PVPROTO((enum rtx_code code, enum machine_mode mode,
- ...));
-static rtx gen_binary PROTO((enum rtx_code, enum machine_mode,
- rtx, rtx));
-static rtx gen_unary PROTO((enum rtx_code, enum machine_mode,
- enum machine_mode, rtx));
-static enum rtx_code simplify_comparison PROTO((enum rtx_code, rtx *, rtx *));
-static int reversible_comparison_p PROTO((rtx));
-static void update_table_tick PROTO((rtx));
-static void record_value_for_reg PROTO((rtx, rtx, rtx));
-static void record_dead_and_set_regs_1 PROTO((rtx, rtx));
-static void record_dead_and_set_regs PROTO((rtx));
-static int get_last_value_validate PROTO((rtx *, int, int));
-static rtx get_last_value PROTO((rtx));
-static int use_crosses_set_p PROTO((rtx, int));
-static void reg_dead_at_p_1 PROTO((rtx, rtx));
-static int reg_dead_at_p PROTO((rtx, rtx));
-static void move_deaths PROTO((rtx, rtx, int, rtx, rtx *));
-static int reg_bitfield_target_p PROTO((rtx, rtx));
-static void distribute_notes PROTO((rtx, rtx, rtx, rtx, rtx, rtx));
-static void distribute_links PROTO((rtx));
-static void mark_used_regs_combine PROTO((rtx));
-static int insn_cuid PROTO((rtx));
-
-/* Main entry point for combiner. F is the first insn of the function.
- NREGS is the first unused pseudo-reg number. */
-
-void
-combine_instructions (f, nregs)
- rtx f;
- int nregs;
-{
- register rtx insn, next, prev;
- register int i;
- register rtx links, nextlinks;
-
- combine_attempts = 0;
- combine_merges = 0;
- combine_extras = 0;
- combine_successes = 0;
- undobuf.undos = undobuf.previous_undos = 0;
-
- combine_max_regno = nregs;
-
- reg_nonzero_bits
- = (unsigned HOST_WIDE_INT *) alloca (nregs * sizeof (HOST_WIDE_INT));
- reg_sign_bit_copies = (char *) alloca (nregs * sizeof (char));
-
- bzero ((char *) reg_nonzero_bits, nregs * sizeof (HOST_WIDE_INT));
- bzero (reg_sign_bit_copies, nregs * sizeof (char));
-
- reg_last_death = (rtx *) alloca (nregs * sizeof (rtx));
- reg_last_set = (rtx *) alloca (nregs * sizeof (rtx));
- reg_last_set_value = (rtx *) alloca (nregs * sizeof (rtx));
- reg_last_set_table_tick = (int *) alloca (nregs * sizeof (int));
- reg_last_set_label = (int *) alloca (nregs * sizeof (int));
- reg_last_set_invalid = (char *) alloca (nregs * sizeof (char));
- reg_last_set_mode
- = (enum machine_mode *) alloca (nregs * sizeof (enum machine_mode));
- reg_last_set_nonzero_bits
- = (unsigned HOST_WIDE_INT *) alloca (nregs * sizeof (HOST_WIDE_INT));
- reg_last_set_sign_bit_copies
- = (char *) alloca (nregs * sizeof (char));
-
- init_reg_last_arrays ();
-
- init_recog_no_volatile ();
-
- /* Compute maximum uid value so uid_cuid can be allocated. */
-
- for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
- if (INSN_UID (insn) > i)
- i = INSN_UID (insn);
-
- uid_cuid = (int *) alloca ((i + 1) * sizeof (int));
- max_uid_cuid = i;
-
- nonzero_bits_mode = mode_for_size (HOST_BITS_PER_WIDE_INT, MODE_INT, 0);
-
- /* Don't use reg_nonzero_bits when computing it. This can cause problems
- when, for example, we have j <<= 1 in a loop. */
-
- nonzero_sign_valid = 0;
-
- /* Compute the mapping from uids to cuids.
- Cuids are numbers assigned to insns, like uids,
- except that cuids increase monotonically through the code.
-
- Scan all SETs and see if we can deduce anything about what
- bits are known to be zero for some registers and how many copies
- of the sign bit are known to exist for those registers.
-
- Also set any known values so that we can use it while searching
- for what bits are known to be set. */
-
- label_tick = 1;
-
- /* We need to initialize it here, because record_dead_and_set_regs may call
- get_last_value. */
- subst_prev_insn = NULL_RTX;
-
- setup_incoming_promotions ();
-
- for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
- {
- uid_cuid[INSN_UID (insn)] = ++i;
- subst_low_cuid = i;
- subst_insn = insn;
-
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- note_stores (PATTERN (insn), set_nonzero_bits_and_sign_copies);
- record_dead_and_set_regs (insn);
-
-#ifdef AUTO_INC_DEC
- for (links = REG_NOTES (insn); links; links = XEXP (links, 1))
- if (REG_NOTE_KIND (links) == REG_INC)
- set_nonzero_bits_and_sign_copies (XEXP (links, 0), NULL_RTX);
-#endif
- }
-
- if (GET_CODE (insn) == CODE_LABEL)
- label_tick++;
- }
-
- nonzero_sign_valid = 1;
-
- /* Now scan all the insns in forward order. */
-
- this_basic_block = -1;
- label_tick = 1;
- last_call_cuid = 0;
- mem_last_set = 0;
- init_reg_last_arrays ();
- setup_incoming_promotions ();
-
- for (insn = f; insn; insn = next ? next : NEXT_INSN (insn))
- {
- next = 0;
-
- /* If INSN starts a new basic block, update our basic block number. */
- if (this_basic_block + 1 < n_basic_blocks
- && basic_block_head[this_basic_block + 1] == insn)
- this_basic_block++;
-
- if (GET_CODE (insn) == CODE_LABEL)
- label_tick++;
-
- else if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- /* Try this insn with each insn it links back to. */
-
- for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
- if ((next = try_combine (insn, XEXP (links, 0), NULL_RTX)) != 0)
- goto retry;
-
- /* Try each sequence of three linked insns ending with this one. */
-
- for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
- for (nextlinks = LOG_LINKS (XEXP (links, 0)); nextlinks;
- nextlinks = XEXP (nextlinks, 1))
- if ((next = try_combine (insn, XEXP (links, 0),
- XEXP (nextlinks, 0))) != 0)
- goto retry;
-
-#ifdef HAVE_cc0
- /* Try to combine a jump insn that uses CC0
- with a preceding insn that sets CC0, and maybe with its
- logical predecessor as well.
- This is how we make decrement-and-branch insns.
- We need this special code because data flow connections
- via CC0 do not get entered in LOG_LINKS. */
-
- if (GET_CODE (insn) == JUMP_INSN
- && (prev = prev_nonnote_insn (insn)) != 0
- && GET_CODE (prev) == INSN
- && sets_cc0_p (PATTERN (prev)))
- {
- if ((next = try_combine (insn, prev, NULL_RTX)) != 0)
- goto retry;
-
- for (nextlinks = LOG_LINKS (prev); nextlinks;
- nextlinks = XEXP (nextlinks, 1))
- if ((next = try_combine (insn, prev,
- XEXP (nextlinks, 0))) != 0)
- goto retry;
- }
-
- /* Do the same for an insn that explicitly references CC0. */
- if (GET_CODE (insn) == INSN
- && (prev = prev_nonnote_insn (insn)) != 0
- && GET_CODE (prev) == INSN
- && sets_cc0_p (PATTERN (prev))
- && GET_CODE (PATTERN (insn)) == SET
- && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (insn))))
- {
- if ((next = try_combine (insn, prev, NULL_RTX)) != 0)
- goto retry;
-
- for (nextlinks = LOG_LINKS (prev); nextlinks;
- nextlinks = XEXP (nextlinks, 1))
- if ((next = try_combine (insn, prev,
- XEXP (nextlinks, 0))) != 0)
- goto retry;
- }
-
- /* Finally, see if any of the insns that this insn links to
- explicitly references CC0. If so, try this insn, that insn,
- and its predecessor if it sets CC0. */
- for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
- if (GET_CODE (XEXP (links, 0)) == INSN
- && GET_CODE (PATTERN (XEXP (links, 0))) == SET
- && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (XEXP (links, 0))))
- && (prev = prev_nonnote_insn (XEXP (links, 0))) != 0
- && GET_CODE (prev) == INSN
- && sets_cc0_p (PATTERN (prev))
- && (next = try_combine (insn, XEXP (links, 0), prev)) != 0)
- goto retry;
-#endif
-
- /* Try combining an insn with two different insns whose results it
- uses. */
- for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
- for (nextlinks = XEXP (links, 1); nextlinks;
- nextlinks = XEXP (nextlinks, 1))
- if ((next = try_combine (insn, XEXP (links, 0),
- XEXP (nextlinks, 0))) != 0)
- goto retry;
-
- if (GET_CODE (insn) != NOTE)
- record_dead_and_set_regs (insn);
-
- retry:
- ;
- }
- }
-
- total_attempts += combine_attempts;
- total_merges += combine_merges;
- total_extras += combine_extras;
- total_successes += combine_successes;
-
- nonzero_sign_valid = 0;
-}
-
-/* Wipe the reg_last_xxx arrays in preparation for another pass. */
-
-static void
-init_reg_last_arrays ()
-{
- int nregs = combine_max_regno;
-
- bzero ((char *) reg_last_death, nregs * sizeof (rtx));
- bzero ((char *) reg_last_set, nregs * sizeof (rtx));
- bzero ((char *) reg_last_set_value, nregs * sizeof (rtx));
- bzero ((char *) reg_last_set_table_tick, nregs * sizeof (int));
- bzero ((char *) reg_last_set_label, nregs * sizeof (int));
- bzero (reg_last_set_invalid, nregs * sizeof (char));
- bzero ((char *) reg_last_set_mode, nregs * sizeof (enum machine_mode));
- bzero ((char *) reg_last_set_nonzero_bits, nregs * sizeof (HOST_WIDE_INT));
- bzero (reg_last_set_sign_bit_copies, nregs * sizeof (char));
-}
-
-/* Set up any promoted values for incoming argument registers. */
-
-static void
-setup_incoming_promotions ()
-{
-#ifdef PROMOTE_FUNCTION_ARGS
- int regno;
- rtx reg;
- enum machine_mode mode;
- int unsignedp;
- rtx first = get_insns ();
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (FUNCTION_ARG_REGNO_P (regno)
- && (reg = promoted_input_arg (regno, &mode, &unsignedp)) != 0)
- record_value_for_reg (reg, first,
- gen_rtx (unsignedp ? ZERO_EXTEND : SIGN_EXTEND,
- GET_MODE (reg),
- gen_rtx (CLOBBER, mode, const0_rtx)));
-#endif
-}
-
-/* Called via note_stores. If X is a pseudo that is narrower than
- HOST_BITS_PER_WIDE_INT and is being set, record what bits are known zero.
-
- If we are setting only a portion of X and we can't figure out what
- portion, assume all bits will be used since we don't know what will
- be happening.
-
- Similarly, set how many bits of X are known to be copies of the sign bit
- at all locations in the function. This is the smallest number implied
- by any set of X. */
-
-static void
-set_nonzero_bits_and_sign_copies (x, set)
- rtx x;
- rtx set;
-{
- int num;
-
- if (GET_CODE (x) == REG
- && REGNO (x) >= FIRST_PSEUDO_REGISTER
- /* If this register is undefined at the start of the file, we can't
- say what its contents were. */
- && ! (basic_block_live_at_start[0][REGNO (x) / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (REGNO (x) % REGSET_ELT_BITS)))
- && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT)
- {
- if (set == 0 || GET_CODE (set) == CLOBBER)
- {
- reg_nonzero_bits[REGNO (x)] = GET_MODE_MASK (GET_MODE (x));
- reg_sign_bit_copies[REGNO (x)] = 1;
- return;
- }
-
- /* If this is a complex assignment, see if we can convert it into a
- simple assignment. */
- set = expand_field_assignment (set);
-
- /* If this is a simple assignment, or we have a paradoxical SUBREG,
- set what we know about X. */
-
- if (SET_DEST (set) == x
- || (GET_CODE (SET_DEST (set)) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (SET_DEST (set)))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (set)))))
- && SUBREG_REG (SET_DEST (set)) == x))
- {
- rtx src = SET_SRC (set);
-
-#ifdef SHORT_IMMEDIATES_SIGN_EXTEND
- /* If X is narrower than a word and SRC is a non-negative
- constant that would appear negative in the mode of X,
- sign-extend it for use in reg_nonzero_bits because some
- machines (maybe most) will actually do the sign-extension
- and this is the conservative approach.
-
- ??? For 2.5, try to tighten up the MD files in this regard
- instead of this kludge. */
-
- if (GET_MODE_BITSIZE (GET_MODE (x)) < BITS_PER_WORD
- && GET_CODE (src) == CONST_INT
- && INTVAL (src) > 0
- && 0 != (INTVAL (src)
- & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (x)) - 1))))
- src = GEN_INT (INTVAL (src)
- | ((HOST_WIDE_INT) (-1)
- << GET_MODE_BITSIZE (GET_MODE (x))));
-#endif
-
- reg_nonzero_bits[REGNO (x)]
- |= nonzero_bits (src, nonzero_bits_mode);
- num = num_sign_bit_copies (SET_SRC (set), GET_MODE (x));
- if (reg_sign_bit_copies[REGNO (x)] == 0
- || reg_sign_bit_copies[REGNO (x)] > num)
- reg_sign_bit_copies[REGNO (x)] = num;
- }
- else
- {
- reg_nonzero_bits[REGNO (x)] = GET_MODE_MASK (GET_MODE (x));
- reg_sign_bit_copies[REGNO (x)] = 1;
- }
- }
-}
-
-/* See if INSN can be combined into I3. PRED and SUCC are optionally
- insns that were previously combined into I3 or that will be combined
- into the merger of INSN and I3.
-
- Return 0 if the combination is not allowed for any reason.
-
- If the combination is allowed, *PDEST will be set to the single
- destination of INSN and *PSRC to the single source, and this function
- will return 1. */
-
-static int
-can_combine_p (insn, i3, pred, succ, pdest, psrc)
- rtx insn;
- rtx i3;
- rtx pred, succ;
- rtx *pdest, *psrc;
-{
- int i;
- rtx set = 0, src, dest;
- rtx p, link;
- int all_adjacent = (succ ? (next_active_insn (insn) == succ
- && next_active_insn (succ) == i3)
- : next_active_insn (insn) == i3);
-
- /* Can combine only if previous insn is a SET of a REG, a SUBREG or CC0.
- or a PARALLEL consisting of such a SET and CLOBBERs.
-
- If INSN has CLOBBER parallel parts, ignore them for our processing.
- By definition, these happen during the execution of the insn. When it
- is merged with another insn, all bets are off. If they are, in fact,
- needed and aren't also supplied in I3, they may be added by
- recog_for_combine. Otherwise, it won't match.
-
- We can also ignore a SET whose SET_DEST is mentioned in a REG_UNUSED
- note.
-
- Get the source and destination of INSN. If more than one, can't
- combine. */
-
- if (GET_CODE (PATTERN (insn)) == SET)
- set = PATTERN (insn);
- else if (GET_CODE (PATTERN (insn)) == PARALLEL
- && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET)
- {
- for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
- {
- rtx elt = XVECEXP (PATTERN (insn), 0, i);
-
- switch (GET_CODE (elt))
- {
- /* We can ignore CLOBBERs. */
- case CLOBBER:
- break;
-
- case SET:
- /* Ignore SETs whose result isn't used but not those that
- have side-effects. */
- if (find_reg_note (insn, REG_UNUSED, SET_DEST (elt))
- && ! side_effects_p (elt))
- break;
-
- /* If we have already found a SET, this is a second one and
- so we cannot combine with this insn. */
- if (set)
- return 0;
-
- set = elt;
- break;
-
- default:
- /* Anything else means we can't combine. */
- return 0;
- }
- }
-
- if (set == 0
- /* If SET_SRC is an ASM_OPERANDS we can't throw away these CLOBBERs,
- so don't do anything with it. */
- || GET_CODE (SET_SRC (set)) == ASM_OPERANDS)
- return 0;
- }
- else
- return 0;
-
- if (set == 0)
- return 0;
-
- set = expand_field_assignment (set);
- src = SET_SRC (set), dest = SET_DEST (set);
-
- /* Don't eliminate a store in the stack pointer. */
- if (dest == stack_pointer_rtx
- /* If we couldn't eliminate a field assignment, we can't combine. */
- || GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == STRICT_LOW_PART
- /* Don't combine with an insn that sets a register to itself if it has
- a REG_EQUAL note. This may be part of a REG_NO_CONFLICT sequence. */
- || (rtx_equal_p (src, dest) && find_reg_note (insn, REG_EQUAL, NULL_RTX))
- /* Can't merge a function call. */
- || GET_CODE (src) == CALL
- /* Don't eliminate a function call argument. */
- || (GET_CODE (i3) == CALL_INSN
- && (find_reg_fusage (i3, USE, dest)
- || (GET_CODE (dest) == REG
- && REGNO (dest) < FIRST_PSEUDO_REGISTER
- && global_regs[REGNO (dest)])))
- /* Don't substitute into an incremented register. */
- || FIND_REG_INC_NOTE (i3, dest)
- || (succ && FIND_REG_INC_NOTE (succ, dest))
- /* Don't combine the end of a libcall into anything. */
- || find_reg_note (insn, REG_RETVAL, NULL_RTX)
- /* Make sure that DEST is not used after SUCC but before I3. */
- || (succ && ! all_adjacent
- && reg_used_between_p (dest, succ, i3))
- /* Make sure that the value that is to be substituted for the register
- does not use any registers whose values alter in between. However,
- If the insns are adjacent, a use can't cross a set even though we
- think it might (this can happen for a sequence of insns each setting
- the same destination; reg_last_set of that register might point to
- a NOTE). If INSN has a REG_EQUIV note, the register is always
- equivalent to the memory so the substitution is valid even if there
- are intervening stores. Also, don't move a volatile asm or
- UNSPEC_VOLATILE across any other insns. */
- || (! all_adjacent
- && (((GET_CODE (src) != MEM
- || ! find_reg_note (insn, REG_EQUIV, src))
- && use_crosses_set_p (src, INSN_CUID (insn)))
- || (GET_CODE (src) == ASM_OPERANDS && MEM_VOLATILE_P (src))
- || GET_CODE (src) == UNSPEC_VOLATILE))
- /* If there is a REG_NO_CONFLICT note for DEST in I3 or SUCC, we get
- better register allocation by not doing the combine. */
- || find_reg_note (i3, REG_NO_CONFLICT, dest)
- || (succ && find_reg_note (succ, REG_NO_CONFLICT, dest))
- /* Don't combine across a CALL_INSN, because that would possibly
- change whether the life span of some REGs crosses calls or not,
- and it is a pain to update that information.
- Exception: if source is a constant, moving it later can't hurt.
- Accept that special case, because it helps -fforce-addr a lot. */
- || (INSN_CUID (insn) < last_call_cuid && ! CONSTANT_P (src)))
- return 0;
-
- /* DEST must either be a REG or CC0. */
- if (GET_CODE (dest) == REG)
- {
- /* If register alignment is being enforced for multi-word items in all
- cases except for parameters, it is possible to have a register copy
- insn referencing a hard register that is not allowed to contain the
- mode being copied and which would not be valid as an operand of most
- insns. Eliminate this problem by not combining with such an insn.
-
- Also, on some machines we don't want to extend the life of a hard
- register.
-
- This is the same test done in can_combine except that we don't test
- if SRC is a CALL operation to permit a hard register with
- SMALL_REGISTER_CLASSES, and that we have to take all_adjacent
- into account. */
-
- if (GET_CODE (src) == REG
- && ((REGNO (dest) < FIRST_PSEUDO_REGISTER
- && ! HARD_REGNO_MODE_OK (REGNO (dest), GET_MODE (dest)))
- /* Don't extend the life of a hard register unless it is
- user variable (if we have few registers) or it can't
- fit into the desired register (meaning something special
- is going on).
- Also avoid substituting a return register into I3, because
- reload can't handle a conflict with constraints of other
- inputs. */
- || (REGNO (src) < FIRST_PSEUDO_REGISTER
- && (! HARD_REGNO_MODE_OK (REGNO (src), GET_MODE (src))
-#ifdef SMALL_REGISTER_CLASSES
- || (SMALL_REGISTER_CLASSES
- && ((! all_adjacent && ! REG_USERVAR_P (src))
- || (FUNCTION_VALUE_REGNO_P (REGNO (src))
- && ! REG_USERVAR_P (src))))
-#endif
- ))))
- return 0;
- }
- else if (GET_CODE (dest) != CC0)
- return 0;
-
- /* Don't substitute for a register intended as a clobberable operand.
- Similarly, don't substitute an expression containing a register that
- will be clobbered in I3. */
- if (GET_CODE (PATTERN (i3)) == PARALLEL)
- for (i = XVECLEN (PATTERN (i3), 0) - 1; i >= 0; i--)
- if (GET_CODE (XVECEXP (PATTERN (i3), 0, i)) == CLOBBER
- && (reg_overlap_mentioned_p (XEXP (XVECEXP (PATTERN (i3), 0, i), 0),
- src)
- || rtx_equal_p (XEXP (XVECEXP (PATTERN (i3), 0, i), 0), dest)))
- return 0;
-
- /* If INSN contains anything volatile, or is an `asm' (whether volatile
- or not), reject, unless nothing volatile comes between it and I3,
- with the exception of SUCC. */
-
- if (GET_CODE (src) == ASM_OPERANDS || volatile_refs_p (src))
- for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p))
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
- && p != succ && volatile_refs_p (PATTERN (p)))
- return 0;
-
- /* If there are any volatile insns between INSN and I3, reject, because
- they might affect machine state. */
-
- for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p))
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
- && p != succ && volatile_insn_p (PATTERN (p)))
- return 0;
-
- /* If INSN or I2 contains an autoincrement or autodecrement,
- make sure that register is not used between there and I3,
- and not already used in I3 either.
- Also insist that I3 not be a jump; if it were one
- and the incremented register were spilled, we would lose. */
-
-#ifdef AUTO_INC_DEC
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC
- && (GET_CODE (i3) == JUMP_INSN
- || reg_used_between_p (XEXP (link, 0), insn, i3)
- || reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i3))))
- return 0;
-#endif
-
-#ifdef HAVE_cc0
- /* Don't combine an insn that follows a CC0-setting insn.
- An insn that uses CC0 must not be separated from the one that sets it.
- We do, however, allow I2 to follow a CC0-setting insn if that insn
- is passed as I1; in that case it will be deleted also.
- We also allow combining in this case if all the insns are adjacent
- because that would leave the two CC0 insns adjacent as well.
- It would be more logical to test whether CC0 occurs inside I1 or I2,
- but that would be much slower, and this ought to be equivalent. */
-
- p = prev_nonnote_insn (insn);
- if (p && p != pred && GET_CODE (p) == INSN && sets_cc0_p (PATTERN (p))
- && ! all_adjacent)
- return 0;
-#endif
-
- /* If we get here, we have passed all the tests and the combination is
- to be allowed. */
-
- *pdest = dest;
- *psrc = src;
-
- return 1;
-}
-
-/* LOC is the location within I3 that contains its pattern or the component
- of a PARALLEL of the pattern. We validate that it is valid for combining.
-
- One problem is if I3 modifies its output, as opposed to replacing it
- entirely, we can't allow the output to contain I2DEST or I1DEST as doing
- so would produce an insn that is not equivalent to the original insns.
-
- Consider:
-
- (set (reg:DI 101) (reg:DI 100))
- (set (subreg:SI (reg:DI 101) 0) <foo>)
-
- This is NOT equivalent to:
-
- (parallel [(set (subreg:SI (reg:DI 100) 0) <foo>)
- (set (reg:DI 101) (reg:DI 100))])
-
- Not only does this modify 100 (in which case it might still be valid
- if 100 were dead in I2), it sets 101 to the ORIGINAL value of 100.
-
- We can also run into a problem if I2 sets a register that I1
- uses and I1 gets directly substituted into I3 (not via I2). In that
- case, we would be getting the wrong value of I2DEST into I3, so we
- must reject the combination. This case occurs when I2 and I1 both
- feed into I3, rather than when I1 feeds into I2, which feeds into I3.
- If I1_NOT_IN_SRC is non-zero, it means that finding I1 in the source
- of a SET must prevent combination from occurring.
-
- On machines where SMALL_REGISTER_CLASSES is defined, we don't combine
- if the destination of a SET is a hard register that isn't a user
- variable.
-
- Before doing the above check, we first try to expand a field assignment
- into a set of logical operations.
-
- If PI3_DEST_KILLED is non-zero, it is a pointer to a location in which
- we place a register that is both set and used within I3. If more than one
- such register is detected, we fail.
-
- Return 1 if the combination is valid, zero otherwise. */
-
-static int
-combinable_i3pat (i3, loc, i2dest, i1dest, i1_not_in_src, pi3dest_killed)
- rtx i3;
- rtx *loc;
- rtx i2dest;
- rtx i1dest;
- int i1_not_in_src;
- rtx *pi3dest_killed;
-{
- rtx x = *loc;
-
- if (GET_CODE (x) == SET)
- {
- rtx set = expand_field_assignment (x);
- rtx dest = SET_DEST (set);
- rtx src = SET_SRC (set);
- rtx inner_dest = dest, inner_src = src;
-
- SUBST (*loc, set);
-
- while (GET_CODE (inner_dest) == STRICT_LOW_PART
- || GET_CODE (inner_dest) == SUBREG
- || GET_CODE (inner_dest) == ZERO_EXTRACT)
- inner_dest = XEXP (inner_dest, 0);
-
- /* We probably don't need this any more now that LIMIT_RELOAD_CLASS
- was added. */
-#if 0
- while (GET_CODE (inner_src) == STRICT_LOW_PART
- || GET_CODE (inner_src) == SUBREG
- || GET_CODE (inner_src) == ZERO_EXTRACT)
- inner_src = XEXP (inner_src, 0);
-
- /* If it is better that two different modes keep two different pseudos,
- avoid combining them. This avoids producing the following pattern
- on a 386:
- (set (subreg:SI (reg/v:QI 21) 0)
- (lshiftrt:SI (reg/v:SI 20)
- (const_int 24)))
- If that were made, reload could not handle the pair of
- reg 20/21, since it would try to get any GENERAL_REGS
- but some of them don't handle QImode. */
-
- if (rtx_equal_p (inner_src, i2dest)
- && GET_CODE (inner_dest) == REG
- && ! MODES_TIEABLE_P (GET_MODE (i2dest), GET_MODE (inner_dest)))
- return 0;
-#endif
-
- /* Check for the case where I3 modifies its output, as
- discussed above. */
- if ((inner_dest != dest
- && (reg_overlap_mentioned_p (i2dest, inner_dest)
- || (i1dest && reg_overlap_mentioned_p (i1dest, inner_dest))))
- /* This is the same test done in can_combine_p except that we
- allow a hard register with SMALL_REGISTER_CLASSES if SRC is a
- CALL operation.
- Moreover, we can't test all_adjacent; we don't have to, since
- this instruction will stay in place, thus we are not considering
- to increase the lifetime of INNER_DEST. */
- || (GET_CODE (inner_dest) == REG
- && REGNO (inner_dest) < FIRST_PSEUDO_REGISTER
- && (! HARD_REGNO_MODE_OK (REGNO (inner_dest),
- GET_MODE (inner_dest))
-#ifdef SMALL_REGISTER_CLASSES
- || (SMALL_REGISTER_CLASSES
- && GET_CODE (src) != CALL && ! REG_USERVAR_P (inner_dest)
- && FUNCTION_VALUE_REGNO_P (REGNO (inner_dest)))
-#endif
- ))
- || (i1_not_in_src && reg_overlap_mentioned_p (i1dest, src)))
- return 0;
-
- /* If DEST is used in I3, it is being killed in this insn,
- so record that for later.
- Never add REG_DEAD notes for the FRAME_POINTER_REGNUM or the
- STACK_POINTER_REGNUM, since these are always considered to be
- live. Similarly for ARG_POINTER_REGNUM if it is fixed. */
- if (pi3dest_killed && GET_CODE (dest) == REG
- && reg_referenced_p (dest, PATTERN (i3))
- && REGNO (dest) != FRAME_POINTER_REGNUM
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && REGNO (dest) != HARD_FRAME_POINTER_REGNUM
-#endif
-#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && (REGNO (dest) != ARG_POINTER_REGNUM
- || ! fixed_regs [REGNO (dest)])
-#endif
- && REGNO (dest) != STACK_POINTER_REGNUM)
- {
- if (*pi3dest_killed)
- return 0;
-
- *pi3dest_killed = dest;
- }
- }
-
- else if (GET_CODE (x) == PARALLEL)
- {
- int i;
-
- for (i = 0; i < XVECLEN (x, 0); i++)
- if (! combinable_i3pat (i3, &XVECEXP (x, 0, i), i2dest, i1dest,
- i1_not_in_src, pi3dest_killed))
- return 0;
- }
-
- return 1;
-}
-
-/* Try to combine the insns I1 and I2 into I3.
- Here I1 and I2 appear earlier than I3.
- I1 can be zero; then we combine just I2 into I3.
-
- It we are combining three insns and the resulting insn is not recognized,
- try splitting it into two insns. If that happens, I2 and I3 are retained
- and I1 is pseudo-deleted by turning it into a NOTE. Otherwise, I1 and I2
- are pseudo-deleted.
-
- Return 0 if the combination does not work. Then nothing is changed.
- If we did the combination, return the insn at which combine should
- resume scanning. */
-
-static rtx
-try_combine (i3, i2, i1)
- register rtx i3, i2, i1;
-{
- /* New patterns for I3 and I3, respectively. */
- rtx newpat, newi2pat = 0;
- /* Indicates need to preserve SET in I1 or I2 in I3 if it is not dead. */
- int added_sets_1, added_sets_2;
- /* Total number of SETs to put into I3. */
- int total_sets;
- /* Nonzero is I2's body now appears in I3. */
- int i2_is_used;
- /* INSN_CODEs for new I3, new I2, and user of condition code. */
- int insn_code_number, i2_code_number, other_code_number;
- /* Contains I3 if the destination of I3 is used in its source, which means
- that the old life of I3 is being killed. If that usage is placed into
- I2 and not in I3, a REG_DEAD note must be made. */
- rtx i3dest_killed = 0;
- /* SET_DEST and SET_SRC of I2 and I1. */
- rtx i2dest, i2src, i1dest = 0, i1src = 0;
- /* PATTERN (I2), or a copy of it in certain cases. */
- rtx i2pat;
- /* Indicates if I2DEST or I1DEST is in I2SRC or I1_SRC. */
- int i2dest_in_i2src = 0, i1dest_in_i1src = 0, i2dest_in_i1src = 0;
- int i1_feeds_i3 = 0;
- /* Notes that must be added to REG_NOTES in I3 and I2. */
- rtx new_i3_notes, new_i2_notes;
- /* Notes that we substituted I3 into I2 instead of the normal case. */
- int i3_subst_into_i2 = 0;
- /* Notes that I1, I2 or I3 is a MULT operation. */
- int have_mult = 0;
- /* Number of clobbers of SCRATCH we had to add. */
- int i3_scratches = 0, i2_scratches = 0, other_scratches = 0;
-
- int maxreg;
- rtx temp;
- register rtx link;
- int i;
-
- /* If any of I1, I2, and I3 isn't really an insn, we can't do anything.
- This can occur when flow deletes an insn that it has merged into an
- auto-increment address. We also can't do anything if I3 has a
- REG_LIBCALL note since we don't want to disrupt the contiguity of a
- libcall. */
-
- if (GET_RTX_CLASS (GET_CODE (i3)) != 'i'
- || GET_RTX_CLASS (GET_CODE (i2)) != 'i'
- || (i1 && GET_RTX_CLASS (GET_CODE (i1)) != 'i')
- || find_reg_note (i3, REG_LIBCALL, NULL_RTX))
- return 0;
-
- combine_attempts++;
-
- undobuf.undos = undobuf.previous_undos = 0;
- undobuf.other_insn = 0;
-
- /* Save the current high-water-mark so we can free storage if we didn't
- accept this combination. */
- undobuf.storage = (char *) oballoc (0);
-
- /* Reset the hard register usage information. */
- CLEAR_HARD_REG_SET (newpat_used_regs);
-
- /* If I1 and I2 both feed I3, they can be in any order. To simplify the
- code below, set I1 to be the earlier of the two insns. */
- if (i1 && INSN_CUID (i1) > INSN_CUID (i2))
- temp = i1, i1 = i2, i2 = temp;
-
- added_links_insn = 0;
-
- /* First check for one important special-case that the code below will
- not handle. Namely, the case where I1 is zero, I2 has multiple sets,
- and I3 is a SET whose SET_SRC is a SET_DEST in I2. In that case,
- we may be able to replace that destination with the destination of I3.
- This occurs in the common code where we compute both a quotient and
- remainder into a structure, in which case we want to do the computation
- directly into the structure to avoid register-register copies.
-
- We make very conservative checks below and only try to handle the
- most common cases of this. For example, we only handle the case
- where I2 and I3 are adjacent to avoid making difficult register
- usage tests. */
-
- if (i1 == 0 && GET_CODE (i3) == INSN && GET_CODE (PATTERN (i3)) == SET
- && GET_CODE (SET_SRC (PATTERN (i3))) == REG
- && REGNO (SET_SRC (PATTERN (i3))) >= FIRST_PSEUDO_REGISTER
-#ifdef SMALL_REGISTER_CLASSES
- && (! SMALL_REGISTER_CLASSES
- || GET_CODE (SET_DEST (PATTERN (i3))) != REG
- || REGNO (SET_DEST (PATTERN (i3))) >= FIRST_PSEUDO_REGISTER
- || REG_USERVAR_P (SET_DEST (PATTERN (i3))))
-#endif
- && find_reg_note (i3, REG_DEAD, SET_SRC (PATTERN (i3)))
- && GET_CODE (PATTERN (i2)) == PARALLEL
- && ! side_effects_p (SET_DEST (PATTERN (i3)))
- /* If the dest of I3 is a ZERO_EXTRACT or STRICT_LOW_PART, the code
- below would need to check what is inside (and reg_overlap_mentioned_p
- doesn't support those codes anyway). Don't allow those destinations;
- the resulting insn isn't likely to be recognized anyway. */
- && GET_CODE (SET_DEST (PATTERN (i3))) != ZERO_EXTRACT
- && GET_CODE (SET_DEST (PATTERN (i3))) != STRICT_LOW_PART
- && ! reg_overlap_mentioned_p (SET_SRC (PATTERN (i3)),
- SET_DEST (PATTERN (i3)))
- && next_real_insn (i2) == i3)
- {
- rtx p2 = PATTERN (i2);
-
- /* Make sure that the destination of I3,
- which we are going to substitute into one output of I2,
- is not used within another output of I2. We must avoid making this:
- (parallel [(set (mem (reg 69)) ...)
- (set (reg 69) ...)])
- which is not well-defined as to order of actions.
- (Besides, reload can't handle output reloads for this.)
-
- The problem can also happen if the dest of I3 is a memory ref,
- if another dest in I2 is an indirect memory ref. */
- for (i = 0; i < XVECLEN (p2, 0); i++)
- if ((GET_CODE (XVECEXP (p2, 0, i)) == SET
- || GET_CODE (XVECEXP (p2, 0, i)) == CLOBBER)
- && reg_overlap_mentioned_p (SET_DEST (PATTERN (i3)),
- SET_DEST (XVECEXP (p2, 0, i))))
- break;
-
- if (i == XVECLEN (p2, 0))
- for (i = 0; i < XVECLEN (p2, 0); i++)
- if (SET_DEST (XVECEXP (p2, 0, i)) == SET_SRC (PATTERN (i3)))
- {
- combine_merges++;
-
- subst_insn = i3;
- subst_low_cuid = INSN_CUID (i2);
-
- added_sets_2 = added_sets_1 = 0;
- i2dest = SET_SRC (PATTERN (i3));
-
- /* Replace the dest in I2 with our dest and make the resulting
- insn the new pattern for I3. Then skip to where we
- validate the pattern. Everything was set up above. */
- SUBST (SET_DEST (XVECEXP (p2, 0, i)),
- SET_DEST (PATTERN (i3)));
-
- newpat = p2;
- i3_subst_into_i2 = 1;
- goto validate_replacement;
- }
- }
-
-#ifndef HAVE_cc0
- /* If we have no I1 and I2 looks like:
- (parallel [(set (reg:CC X) (compare:CC OP (const_int 0)))
- (set Y OP)])
- make up a dummy I1 that is
- (set Y OP)
- and change I2 to be
- (set (reg:CC X) (compare:CC Y (const_int 0)))
-
- (We can ignore any trailing CLOBBERs.)
-
- This undoes a previous combination and allows us to match a branch-and-
- decrement insn. */
-
- if (i1 == 0 && GET_CODE (PATTERN (i2)) == PARALLEL
- && XVECLEN (PATTERN (i2), 0) >= 2
- && GET_CODE (XVECEXP (PATTERN (i2), 0, 0)) == SET
- && (GET_MODE_CLASS (GET_MODE (SET_DEST (XVECEXP (PATTERN (i2), 0, 0))))
- == MODE_CC)
- && GET_CODE (SET_SRC (XVECEXP (PATTERN (i2), 0, 0))) == COMPARE
- && XEXP (SET_SRC (XVECEXP (PATTERN (i2), 0, 0)), 1) == const0_rtx
- && GET_CODE (XVECEXP (PATTERN (i2), 0, 1)) == SET
- && GET_CODE (SET_DEST (XVECEXP (PATTERN (i2), 0, 1))) == REG
- && rtx_equal_p (XEXP (SET_SRC (XVECEXP (PATTERN (i2), 0, 0)), 0),
- SET_SRC (XVECEXP (PATTERN (i2), 0, 1))))
- {
- for (i = XVECLEN (PATTERN (i2), 0) - 1; i >= 2; i--)
- if (GET_CODE (XVECEXP (PATTERN (i2), 0, i)) != CLOBBER)
- break;
-
- if (i == 1)
- {
- /* We make I1 with the same INSN_UID as I2. This gives it
- the same INSN_CUID for value tracking. Our fake I1 will
- never appear in the insn stream so giving it the same INSN_UID
- as I2 will not cause a problem. */
-
- subst_prev_insn = i1
- = gen_rtx (INSN, VOIDmode, INSN_UID (i2), 0, i2,
- XVECEXP (PATTERN (i2), 0, 1), -1, 0, 0);
-
- SUBST (PATTERN (i2), XVECEXP (PATTERN (i2), 0, 0));
- SUBST (XEXP (SET_SRC (PATTERN (i2)), 0),
- SET_DEST (PATTERN (i1)));
- }
- }
-#endif
-
- /* Verify that I2 and I1 are valid for combining. */
- if (! can_combine_p (i2, i3, i1, NULL_RTX, &i2dest, &i2src)
- || (i1 && ! can_combine_p (i1, i3, NULL_RTX, i2, &i1dest, &i1src)))
- {
- undo_all ();
- return 0;
- }
-
- /* Record whether I2DEST is used in I2SRC and similarly for the other
- cases. Knowing this will help in register status updating below. */
- i2dest_in_i2src = reg_overlap_mentioned_p (i2dest, i2src);
- i1dest_in_i1src = i1 && reg_overlap_mentioned_p (i1dest, i1src);
- i2dest_in_i1src = i1 && reg_overlap_mentioned_p (i2dest, i1src);
-
- /* See if I1 directly feeds into I3. It does if I1DEST is not used
- in I2SRC. */
- i1_feeds_i3 = i1 && ! reg_overlap_mentioned_p (i1dest, i2src);
-
- /* Ensure that I3's pattern can be the destination of combines. */
- if (! combinable_i3pat (i3, &PATTERN (i3), i2dest, i1dest,
- i1 && i2dest_in_i1src && i1_feeds_i3,
- &i3dest_killed))
- {
- undo_all ();
- return 0;
- }
-
- /* See if any of the insns is a MULT operation. Unless one is, we will
- reject a combination that is, since it must be slower. Be conservative
- here. */
- if (GET_CODE (i2src) == MULT
- || (i1 != 0 && GET_CODE (i1src) == MULT)
- || (GET_CODE (PATTERN (i3)) == SET
- && GET_CODE (SET_SRC (PATTERN (i3))) == MULT))
- have_mult = 1;
-
- /* If I3 has an inc, then give up if I1 or I2 uses the reg that is inc'd.
- We used to do this EXCEPT in one case: I3 has a post-inc in an
- output operand. However, that exception can give rise to insns like
- mov r3,(r3)+
- which is a famous insn on the PDP-11 where the value of r3 used as the
- source was model-dependent. Avoid this sort of thing. */
-
-#if 0
- if (!(GET_CODE (PATTERN (i3)) == SET
- && GET_CODE (SET_SRC (PATTERN (i3))) == REG
- && GET_CODE (SET_DEST (PATTERN (i3))) == MEM
- && (GET_CODE (XEXP (SET_DEST (PATTERN (i3)), 0)) == POST_INC
- || GET_CODE (XEXP (SET_DEST (PATTERN (i3)), 0)) == POST_DEC)))
- /* It's not the exception. */
-#endif
-#ifdef AUTO_INC_DEC
- for (link = REG_NOTES (i3); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC
- && (reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i2))
- || (i1 != 0
- && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i1)))))
- {
- undo_all ();
- return 0;
- }
-#endif
-
- /* See if the SETs in I1 or I2 need to be kept around in the merged
- instruction: whenever the value set there is still needed past I3.
- For the SETs in I2, this is easy: we see if I2DEST dies or is set in I3.
-
- For the SET in I1, we have two cases: If I1 and I2 independently
- feed into I3, the set in I1 needs to be kept around if I1DEST dies
- or is set in I3. Otherwise (if I1 feeds I2 which feeds I3), the set
- in I1 needs to be kept around unless I1DEST dies or is set in either
- I2 or I3. We can distinguish these cases by seeing if I2SRC mentions
- I1DEST. If so, we know I1 feeds into I2. */
-
- added_sets_2 = ! dead_or_set_p (i3, i2dest);
-
- added_sets_1
- = i1 && ! (i1_feeds_i3 ? dead_or_set_p (i3, i1dest)
- : (dead_or_set_p (i3, i1dest) || dead_or_set_p (i2, i1dest)));
-
- /* If the set in I2 needs to be kept around, we must make a copy of
- PATTERN (I2), so that when we substitute I1SRC for I1DEST in
- PATTERN (I2), we are only substituting for the original I1DEST, not into
- an already-substituted copy. This also prevents making self-referential
- rtx. If I2 is a PARALLEL, we just need the piece that assigns I2SRC to
- I2DEST. */
-
- i2pat = (GET_CODE (PATTERN (i2)) == PARALLEL
- ? gen_rtx (SET, VOIDmode, i2dest, i2src)
- : PATTERN (i2));
-
- if (added_sets_2)
- i2pat = copy_rtx (i2pat);
-
- combine_merges++;
-
- /* Substitute in the latest insn for the regs set by the earlier ones. */
-
- maxreg = max_reg_num ();
-
- subst_insn = i3;
-
- /* It is possible that the source of I2 or I1 may be performing an
- unneeded operation, such as a ZERO_EXTEND of something that is known
- to have the high part zero. Handle that case by letting subst look at
- the innermost one of them.
-
- Another way to do this would be to have a function that tries to
- simplify a single insn instead of merging two or more insns. We don't
- do this because of the potential of infinite loops and because
- of the potential extra memory required. However, doing it the way
- we are is a bit of a kludge and doesn't catch all cases.
-
- But only do this if -fexpensive-optimizations since it slows things down
- and doesn't usually win. */
-
- if (flag_expensive_optimizations)
- {
- /* Pass pc_rtx so no substitutions are done, just simplifications.
- The cases that we are interested in here do not involve the few
- cases were is_replaced is checked. */
- if (i1)
- {
- subst_low_cuid = INSN_CUID (i1);
- i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0);
- }
- else
- {
- subst_low_cuid = INSN_CUID (i2);
- i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0);
- }
-
- undobuf.previous_undos = undobuf.undos;
- }
-
-#ifndef HAVE_cc0
- /* Many machines that don't use CC0 have insns that can both perform an
- arithmetic operation and set the condition code. These operations will
- be represented as a PARALLEL with the first element of the vector
- being a COMPARE of an arithmetic operation with the constant zero.
- The second element of the vector will set some pseudo to the result
- of the same arithmetic operation. If we simplify the COMPARE, we won't
- match such a pattern and so will generate an extra insn. Here we test
- for this case, where both the comparison and the operation result are
- needed, and make the PARALLEL by just replacing I2DEST in I3SRC with
- I2SRC. Later we will make the PARALLEL that contains I2. */
-
- if (i1 == 0 && added_sets_2 && GET_CODE (PATTERN (i3)) == SET
- && GET_CODE (SET_SRC (PATTERN (i3))) == COMPARE
- && XEXP (SET_SRC (PATTERN (i3)), 1) == const0_rtx
- && rtx_equal_p (XEXP (SET_SRC (PATTERN (i3)), 0), i2dest))
- {
- rtx *cc_use;
- enum machine_mode compare_mode;
-
- newpat = PATTERN (i3);
- SUBST (XEXP (SET_SRC (newpat), 0), i2src);
-
- i2_is_used = 1;
-
-#ifdef EXTRA_CC_MODES
- /* See if a COMPARE with the operand we substituted in should be done
- with the mode that is currently being used. If not, do the same
- processing we do in `subst' for a SET; namely, if the destination
- is used only once, try to replace it with a register of the proper
- mode and also replace the COMPARE. */
- if (undobuf.other_insn == 0
- && (cc_use = find_single_use (SET_DEST (newpat), i3,
- &undobuf.other_insn))
- && ((compare_mode = SELECT_CC_MODE (GET_CODE (*cc_use),
- i2src, const0_rtx))
- != GET_MODE (SET_DEST (newpat))))
- {
- int regno = REGNO (SET_DEST (newpat));
- rtx new_dest = gen_rtx (REG, compare_mode, regno);
-
- if (regno < FIRST_PSEUDO_REGISTER
- || (reg_n_sets[regno] == 1 && ! added_sets_2
- && ! REG_USERVAR_P (SET_DEST (newpat))))
- {
- if (regno >= FIRST_PSEUDO_REGISTER)
- SUBST (regno_reg_rtx[regno], new_dest);
-
- SUBST (SET_DEST (newpat), new_dest);
- SUBST (XEXP (*cc_use, 0), new_dest);
- SUBST (SET_SRC (newpat),
- gen_rtx_combine (COMPARE, compare_mode,
- i2src, const0_rtx));
- }
- else
- undobuf.other_insn = 0;
- }
-#endif
- }
- else
-#endif
- {
- n_occurrences = 0; /* `subst' counts here */
-
- /* If I1 feeds into I2 (not into I3) and I1DEST is in I1SRC, we
- need to make a unique copy of I2SRC each time we substitute it
- to avoid self-referential rtl. */
-
- subst_low_cuid = INSN_CUID (i2);
- newpat = subst (PATTERN (i3), i2dest, i2src, 0,
- ! i1_feeds_i3 && i1dest_in_i1src);
- undobuf.previous_undos = undobuf.undos;
-
- /* Record whether i2's body now appears within i3's body. */
- i2_is_used = n_occurrences;
- }
-
- /* If we already got a failure, don't try to do more. Otherwise,
- try to substitute in I1 if we have it. */
-
- if (i1 && GET_CODE (newpat) != CLOBBER)
- {
- /* Before we can do this substitution, we must redo the test done
- above (see detailed comments there) that ensures that I1DEST
- isn't mentioned in any SETs in NEWPAT that are field assignments. */
-
- if (! combinable_i3pat (NULL_RTX, &newpat, i1dest, NULL_RTX,
- 0, NULL_PTR))
- {
- undo_all ();
- return 0;
- }
-
- n_occurrences = 0;
- subst_low_cuid = INSN_CUID (i1);
- newpat = subst (newpat, i1dest, i1src, 0, 0);
- undobuf.previous_undos = undobuf.undos;
- }
-
- /* Fail if an autoincrement side-effect has been duplicated. Be careful
- to count all the ways that I2SRC and I1SRC can be used. */
- if ((FIND_REG_INC_NOTE (i2, NULL_RTX) != 0
- && i2_is_used + added_sets_2 > 1)
- || (i1 != 0 && FIND_REG_INC_NOTE (i1, NULL_RTX) != 0
- && (n_occurrences + added_sets_1 + (added_sets_2 && ! i1_feeds_i3)
- > 1))
- /* Fail if we tried to make a new register (we used to abort, but there's
- really no reason to). */
- || max_reg_num () != maxreg
- /* Fail if we couldn't do something and have a CLOBBER. */
- || GET_CODE (newpat) == CLOBBER
- /* Fail if this new pattern is a MULT and we didn't have one before
- at the outer level. */
- || (GET_CODE (newpat) == SET && GET_CODE (SET_SRC (newpat)) == MULT
- && ! have_mult))
- {
- undo_all ();
- return 0;
- }
-
- /* If the actions of the earlier insns must be kept
- in addition to substituting them into the latest one,
- we must make a new PARALLEL for the latest insn
- to hold additional the SETs. */
-
- if (added_sets_1 || added_sets_2)
- {
- combine_extras++;
-
- if (GET_CODE (newpat) == PARALLEL)
- {
- rtvec old = XVEC (newpat, 0);
- total_sets = XVECLEN (newpat, 0) + added_sets_1 + added_sets_2;
- newpat = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (total_sets));
- bcopy ((char *) &old->elem[0], (char *) XVEC (newpat, 0)->elem,
- sizeof (old->elem[0]) * old->num_elem);
- }
- else
- {
- rtx old = newpat;
- total_sets = 1 + added_sets_1 + added_sets_2;
- newpat = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (total_sets));
- XVECEXP (newpat, 0, 0) = old;
- }
-
- if (added_sets_1)
- XVECEXP (newpat, 0, --total_sets)
- = (GET_CODE (PATTERN (i1)) == PARALLEL
- ? gen_rtx (SET, VOIDmode, i1dest, i1src) : PATTERN (i1));
-
- if (added_sets_2)
- {
- /* If there is no I1, use I2's body as is. We used to also not do
- the subst call below if I2 was substituted into I3,
- but that could lose a simplification. */
- if (i1 == 0)
- XVECEXP (newpat, 0, --total_sets) = i2pat;
- else
- /* See comment where i2pat is assigned. */
- XVECEXP (newpat, 0, --total_sets)
- = subst (i2pat, i1dest, i1src, 0, 0);
- }
- }
-
- /* We come here when we are replacing a destination in I2 with the
- destination of I3. */
- validate_replacement:
-
- /* Note which hard regs this insn has as inputs. */
- mark_used_regs_combine (newpat);
-
- /* Is the result of combination a valid instruction? */
- insn_code_number
- = recog_for_combine (&newpat, i3, &new_i3_notes, &i3_scratches);
-
- /* If the result isn't valid, see if it is a PARALLEL of two SETs where
- the second SET's destination is a register that is unused. In that case,
- we just need the first SET. This can occur when simplifying a divmod
- insn. We *must* test for this case here because the code below that
- splits two independent SETs doesn't handle this case correctly when it
- updates the register status. Also check the case where the first
- SET's destination is unused. That would not cause incorrect code, but
- does cause an unneeded insn to remain. */
-
- if (insn_code_number < 0 && GET_CODE (newpat) == PARALLEL
- && XVECLEN (newpat, 0) == 2
- && GET_CODE (XVECEXP (newpat, 0, 0)) == SET
- && GET_CODE (XVECEXP (newpat, 0, 1)) == SET
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) == REG
- && find_reg_note (i3, REG_UNUSED, SET_DEST (XVECEXP (newpat, 0, 1)))
- && ! side_effects_p (SET_SRC (XVECEXP (newpat, 0, 1)))
- && asm_noperands (newpat) < 0)
- {
- newpat = XVECEXP (newpat, 0, 0);
- insn_code_number
- = recog_for_combine (&newpat, i3, &new_i3_notes, &i3_scratches);
- }
-
- else if (insn_code_number < 0 && GET_CODE (newpat) == PARALLEL
- && XVECLEN (newpat, 0) == 2
- && GET_CODE (XVECEXP (newpat, 0, 0)) == SET
- && GET_CODE (XVECEXP (newpat, 0, 1)) == SET
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) == REG
- && find_reg_note (i3, REG_UNUSED, SET_DEST (XVECEXP (newpat, 0, 0)))
- && ! side_effects_p (SET_SRC (XVECEXP (newpat, 0, 0)))
- && asm_noperands (newpat) < 0)
- {
- newpat = XVECEXP (newpat, 0, 1);
- insn_code_number
- = recog_for_combine (&newpat, i3, &new_i3_notes, &i3_scratches);
- }
-
- /* If we were combining three insns and the result is a simple SET
- with no ASM_OPERANDS that wasn't recognized, try to split it into two
- insns. There are two ways to do this. It can be split using a
- machine-specific method (like when you have an addition of a large
- constant) or by combine in the function find_split_point. */
-
- if (i1 && insn_code_number < 0 && GET_CODE (newpat) == SET
- && asm_noperands (newpat) < 0)
- {
- rtx m_split, *split;
- rtx ni2dest = i2dest;
-
- /* See if the MD file can split NEWPAT. If it can't, see if letting it
- use I2DEST as a scratch register will help. In the latter case,
- convert I2DEST to the mode of the source of NEWPAT if we can. */
-
- m_split = split_insns (newpat, i3);
-
- /* We can only use I2DEST as a scratch reg if it doesn't overlap any
- inputs of NEWPAT. */
-
- /* ??? If I2DEST is not safe, and I1DEST exists, then it would be
- possible to try that as a scratch reg. This would require adding
- more code to make it work though. */
-
- if (m_split == 0 && ! reg_overlap_mentioned_p (ni2dest, newpat))
- {
- /* If I2DEST is a hard register or the only use of a pseudo,
- we can change its mode. */
- if (GET_MODE (SET_DEST (newpat)) != GET_MODE (i2dest)
- && GET_MODE (SET_DEST (newpat)) != VOIDmode
- && GET_CODE (i2dest) == REG
- && (REGNO (i2dest) < FIRST_PSEUDO_REGISTER
- || (reg_n_sets[REGNO (i2dest)] == 1 && ! added_sets_2
- && ! REG_USERVAR_P (i2dest))))
- ni2dest = gen_rtx (REG, GET_MODE (SET_DEST (newpat)),
- REGNO (i2dest));
-
- m_split = split_insns (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (2, newpat,
- gen_rtx (CLOBBER,
- VOIDmode,
- ni2dest))),
- i3);
- }
-
- if (m_split && GET_CODE (m_split) == SEQUENCE
- && XVECLEN (m_split, 0) == 2
- && (next_real_insn (i2) == i3
- || ! use_crosses_set_p (PATTERN (XVECEXP (m_split, 0, 0)),
- INSN_CUID (i2))))
- {
- rtx i2set, i3set;
- rtx newi3pat = PATTERN (XVECEXP (m_split, 0, 1));
- newi2pat = PATTERN (XVECEXP (m_split, 0, 0));
-
- i3set = single_set (XVECEXP (m_split, 0, 1));
- i2set = single_set (XVECEXP (m_split, 0, 0));
-
- /* In case we changed the mode of I2DEST, replace it in the
- pseudo-register table here. We can't do it above in case this
- code doesn't get executed and we do a split the other way. */
-
- if (REGNO (i2dest) >= FIRST_PSEUDO_REGISTER)
- SUBST (regno_reg_rtx[REGNO (i2dest)], ni2dest);
-
- i2_code_number = recog_for_combine (&newi2pat, i2, &new_i2_notes,
- &i2_scratches);
-
- /* If I2 or I3 has multiple SETs, we won't know how to track
- register status, so don't use these insns. If I2's destination
- is used between I2 and I3, we also can't use these insns. */
-
- if (i2_code_number >= 0 && i2set && i3set
- && (next_real_insn (i2) == i3
- || ! reg_used_between_p (SET_DEST (i2set), i2, i3)))
- insn_code_number = recog_for_combine (&newi3pat, i3, &new_i3_notes,
- &i3_scratches);
- if (insn_code_number >= 0)
- newpat = newi3pat;
-
- /* It is possible that both insns now set the destination of I3.
- If so, we must show an extra use of it. */
-
- if (insn_code_number >= 0)
- {
- rtx new_i3_dest = SET_DEST (i3set);
- rtx new_i2_dest = SET_DEST (i2set);
-
- while (GET_CODE (new_i3_dest) == ZERO_EXTRACT
- || GET_CODE (new_i3_dest) == STRICT_LOW_PART
- || GET_CODE (new_i3_dest) == SUBREG)
- new_i3_dest = XEXP (new_i3_dest, 0);
-
- while (GET_CODE (new_i2_dest) == ZERO_EXTRACT
- || GET_CODE (new_i2_dest) == STRICT_LOW_PART
- || GET_CODE (new_i2_dest) == SUBREG)
- new_i2_dest = XEXP (new_i2_dest, 0);
-
- if (GET_CODE (new_i3_dest) == REG
- && GET_CODE (new_i2_dest) == REG
- && REGNO (new_i3_dest) == REGNO (new_i2_dest))
- reg_n_sets[REGNO (new_i2_dest)]++;
- }
- }
-
- /* If we can split it and use I2DEST, go ahead and see if that
- helps things be recognized. Verify that none of the registers
- are set between I2 and I3. */
- if (insn_code_number < 0 && (split = find_split_point (&newpat, i3)) != 0
-#ifdef HAVE_cc0
- && GET_CODE (i2dest) == REG
-#endif
- /* We need I2DEST in the proper mode. If it is a hard register
- or the only use of a pseudo, we can change its mode. */
- && (GET_MODE (*split) == GET_MODE (i2dest)
- || GET_MODE (*split) == VOIDmode
- || REGNO (i2dest) < FIRST_PSEUDO_REGISTER
- || (reg_n_sets[REGNO (i2dest)] == 1 && ! added_sets_2
- && ! REG_USERVAR_P (i2dest)))
- && (next_real_insn (i2) == i3
- || ! use_crosses_set_p (*split, INSN_CUID (i2)))
- /* We can't overwrite I2DEST if its value is still used by
- NEWPAT. */
- && ! reg_referenced_p (i2dest, newpat))
- {
- rtx newdest = i2dest;
- enum rtx_code split_code = GET_CODE (*split);
- enum machine_mode split_mode = GET_MODE (*split);
-
- /* Get NEWDEST as a register in the proper mode. We have already
- validated that we can do this. */
- if (GET_MODE (i2dest) != split_mode && split_mode != VOIDmode)
- {
- newdest = gen_rtx (REG, split_mode, REGNO (i2dest));
-
- if (REGNO (i2dest) >= FIRST_PSEUDO_REGISTER)
- SUBST (regno_reg_rtx[REGNO (i2dest)], newdest);
- }
-
- /* If *SPLIT is a (mult FOO (const_int pow2)), convert it to
- an ASHIFT. This can occur if it was inside a PLUS and hence
- appeared to be a memory address. This is a kludge. */
- if (split_code == MULT
- && GET_CODE (XEXP (*split, 1)) == CONST_INT
- && (i = exact_log2 (INTVAL (XEXP (*split, 1)))) >= 0)
- {
- SUBST (*split, gen_rtx_combine (ASHIFT, split_mode,
- XEXP (*split, 0), GEN_INT (i)));
- /* Update split_code because we may not have a multiply
- anymore. */
- split_code = GET_CODE (*split);
- }
-
-#ifdef INSN_SCHEDULING
- /* If *SPLIT is a paradoxical SUBREG, when we split it, it should
- be written as a ZERO_EXTEND. */
- if (split_code == SUBREG && GET_CODE (SUBREG_REG (*split)) == MEM)
- SUBST (*split, gen_rtx_combine (ZERO_EXTEND, split_mode,
- XEXP (*split, 0)));
-#endif
-
- newi2pat = gen_rtx_combine (SET, VOIDmode, newdest, *split);
- SUBST (*split, newdest);
- i2_code_number
- = recog_for_combine (&newi2pat, i2, &new_i2_notes, &i2_scratches);
-
- /* If the split point was a MULT and we didn't have one before,
- don't use one now. */
- if (i2_code_number >= 0 && ! (split_code == MULT && ! have_mult))
- insn_code_number
- = recog_for_combine (&newpat, i3, &new_i3_notes, &i3_scratches);
- }
- }
-
- /* Check for a case where we loaded from memory in a narrow mode and
- then sign extended it, but we need both registers. In that case,
- we have a PARALLEL with both loads from the same memory location.
- We can split this into a load from memory followed by a register-register
- copy. This saves at least one insn, more if register allocation can
- eliminate the copy.
-
- We cannot do this if the destination of the second assignment is
- a register that we have already assumed is zero-extended. Similarly
- for a SUBREG of such a register. */
-
- else if (i1 && insn_code_number < 0 && asm_noperands (newpat) < 0
- && GET_CODE (newpat) == PARALLEL
- && XVECLEN (newpat, 0) == 2
- && GET_CODE (XVECEXP (newpat, 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (newpat, 0, 0))) == SIGN_EXTEND
- && GET_CODE (XVECEXP (newpat, 0, 1)) == SET
- && rtx_equal_p (SET_SRC (XVECEXP (newpat, 0, 1)),
- XEXP (SET_SRC (XVECEXP (newpat, 0, 0)), 0))
- && ! use_crosses_set_p (SET_SRC (XVECEXP (newpat, 0, 1)),
- INSN_CUID (i2))
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != ZERO_EXTRACT
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != STRICT_LOW_PART
- && ! (temp = SET_DEST (XVECEXP (newpat, 0, 1)),
- (GET_CODE (temp) == REG
- && reg_nonzero_bits[REGNO (temp)] != 0
- && GET_MODE_BITSIZE (GET_MODE (temp)) < BITS_PER_WORD
- && GET_MODE_BITSIZE (GET_MODE (temp)) < HOST_BITS_PER_INT
- && (reg_nonzero_bits[REGNO (temp)]
- != GET_MODE_MASK (word_mode))))
- && ! (GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) == SUBREG
- && (temp = SUBREG_REG (SET_DEST (XVECEXP (newpat, 0, 1))),
- (GET_CODE (temp) == REG
- && reg_nonzero_bits[REGNO (temp)] != 0
- && GET_MODE_BITSIZE (GET_MODE (temp)) < BITS_PER_WORD
- && GET_MODE_BITSIZE (GET_MODE (temp)) < HOST_BITS_PER_INT
- && (reg_nonzero_bits[REGNO (temp)]
- != GET_MODE_MASK (word_mode)))))
- && ! reg_overlap_mentioned_p (SET_DEST (XVECEXP (newpat, 0, 1)),
- SET_SRC (XVECEXP (newpat, 0, 1)))
- && ! find_reg_note (i3, REG_UNUSED,
- SET_DEST (XVECEXP (newpat, 0, 0))))
- {
- rtx ni2dest;
-
- newi2pat = XVECEXP (newpat, 0, 0);
- ni2dest = SET_DEST (XVECEXP (newpat, 0, 0));
- newpat = XVECEXP (newpat, 0, 1);
- SUBST (SET_SRC (newpat),
- gen_lowpart_for_combine (GET_MODE (SET_SRC (newpat)), ni2dest));
- i2_code_number
- = recog_for_combine (&newi2pat, i2, &new_i2_notes, &i2_scratches);
-
- if (i2_code_number >= 0)
- insn_code_number
- = recog_for_combine (&newpat, i3, &new_i3_notes, &i3_scratches);
-
- if (insn_code_number >= 0)
- {
- rtx insn;
- rtx link;
-
- /* If we will be able to accept this, we have made a change to the
- destination of I3. This can invalidate a LOG_LINKS pointing
- to I3. No other part of combine.c makes such a transformation.
-
- The new I3 will have a destination that was previously the
- destination of I1 or I2 and which was used in i2 or I3. Call
- distribute_links to make a LOG_LINK from the next use of
- that destination. */
-
- PATTERN (i3) = newpat;
- distribute_links (gen_rtx (INSN_LIST, VOIDmode, i3, NULL_RTX));
-
- /* I3 now uses what used to be its destination and which is
- now I2's destination. That means we need a LOG_LINK from
- I3 to I2. But we used to have one, so we still will.
-
- However, some later insn might be using I2's dest and have
- a LOG_LINK pointing at I3. We must remove this link.
- The simplest way to remove the link is to point it at I1,
- which we know will be a NOTE. */
-
- for (insn = NEXT_INSN (i3);
- insn && (this_basic_block == n_basic_blocks - 1
- || insn != basic_block_head[this_basic_block + 1]);
- insn = NEXT_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_referenced_p (ni2dest, PATTERN (insn)))
- {
- for (link = LOG_LINKS (insn); link;
- link = XEXP (link, 1))
- if (XEXP (link, 0) == i3)
- XEXP (link, 0) = i1;
-
- break;
- }
- }
- }
- }
-
- /* Similarly, check for a case where we have a PARALLEL of two independent
- SETs but we started with three insns. In this case, we can do the sets
- as two separate insns. This case occurs when some SET allows two
- other insns to combine, but the destination of that SET is still live. */
-
- else if (i1 && insn_code_number < 0 && asm_noperands (newpat) < 0
- && GET_CODE (newpat) == PARALLEL
- && XVECLEN (newpat, 0) == 2
- && GET_CODE (XVECEXP (newpat, 0, 0)) == SET
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) != ZERO_EXTRACT
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) != STRICT_LOW_PART
- && GET_CODE (XVECEXP (newpat, 0, 1)) == SET
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != ZERO_EXTRACT
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != STRICT_LOW_PART
- && ! use_crosses_set_p (SET_SRC (XVECEXP (newpat, 0, 1)),
- INSN_CUID (i2))
- /* Don't pass sets with (USE (MEM ...)) dests to the following. */
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != USE
- && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) != USE
- && ! reg_referenced_p (SET_DEST (XVECEXP (newpat, 0, 1)),
- XVECEXP (newpat, 0, 0))
- && ! reg_referenced_p (SET_DEST (XVECEXP (newpat, 0, 0)),
- XVECEXP (newpat, 0, 1)))
- {
- newi2pat = XVECEXP (newpat, 0, 1);
- newpat = XVECEXP (newpat, 0, 0);
-
- i2_code_number
- = recog_for_combine (&newi2pat, i2, &new_i2_notes, &i2_scratches);
-
- if (i2_code_number >= 0)
- insn_code_number
- = recog_for_combine (&newpat, i3, &new_i3_notes, &i3_scratches);
- }
-
- /* If it still isn't recognized, fail and change things back the way they
- were. */
- if ((insn_code_number < 0
- /* Is the result a reasonable ASM_OPERANDS? */
- && (! check_asm_operands (newpat) || added_sets_1 || added_sets_2)))
- {
- undo_all ();
- return 0;
- }
-
- /* If we had to change another insn, make sure it is valid also. */
- if (undobuf.other_insn)
- {
- rtx other_pat = PATTERN (undobuf.other_insn);
- rtx new_other_notes;
- rtx note, next;
-
- CLEAR_HARD_REG_SET (newpat_used_regs);
-
- other_code_number
- = recog_for_combine (&other_pat, undobuf.other_insn,
- &new_other_notes, &other_scratches);
-
- if (other_code_number < 0 && ! check_asm_operands (other_pat))
- {
- undo_all ();
- return 0;
- }
-
- PATTERN (undobuf.other_insn) = other_pat;
-
- /* If any of the notes in OTHER_INSN were REG_UNUSED, ensure that they
- are still valid. Then add any non-duplicate notes added by
- recog_for_combine. */
- for (note = REG_NOTES (undobuf.other_insn); note; note = next)
- {
- next = XEXP (note, 1);
-
- if (REG_NOTE_KIND (note) == REG_UNUSED
- && ! reg_set_p (XEXP (note, 0), PATTERN (undobuf.other_insn)))
- {
- if (GET_CODE (XEXP (note, 0)) == REG)
- reg_n_deaths[REGNO (XEXP (note, 0))]--;
-
- remove_note (undobuf.other_insn, note);
- }
- }
-
- for (note = new_other_notes; note; note = XEXP (note, 1))
- if (GET_CODE (XEXP (note, 0)) == REG)
- reg_n_deaths[REGNO (XEXP (note, 0))]++;
-
- distribute_notes (new_other_notes, undobuf.other_insn,
- undobuf.other_insn, NULL_RTX, NULL_RTX, NULL_RTX);
- }
-
- /* We now know that we can do this combination. Merge the insns and
- update the status of registers and LOG_LINKS. */
-
- {
- rtx i3notes, i2notes, i1notes = 0;
- rtx i3links, i2links, i1links = 0;
- rtx midnotes = 0;
- register int regno;
- /* Compute which registers we expect to eliminate. */
- rtx elim_i2 = (newi2pat || i2dest_in_i2src || i2dest_in_i1src
- ? 0 : i2dest);
- rtx elim_i1 = i1 == 0 || i1dest_in_i1src ? 0 : i1dest;
-
- /* Get the old REG_NOTES and LOG_LINKS from all our insns and
- clear them. */
- i3notes = REG_NOTES (i3), i3links = LOG_LINKS (i3);
- i2notes = REG_NOTES (i2), i2links = LOG_LINKS (i2);
- if (i1)
- i1notes = REG_NOTES (i1), i1links = LOG_LINKS (i1);
-
- /* Ensure that we do not have something that should not be shared but
- occurs multiple times in the new insns. Check this by first
- resetting all the `used' flags and then copying anything is shared. */
-
- reset_used_flags (i3notes);
- reset_used_flags (i2notes);
- reset_used_flags (i1notes);
- reset_used_flags (newpat);
- reset_used_flags (newi2pat);
- if (undobuf.other_insn)
- reset_used_flags (PATTERN (undobuf.other_insn));
-
- i3notes = copy_rtx_if_shared (i3notes);
- i2notes = copy_rtx_if_shared (i2notes);
- i1notes = copy_rtx_if_shared (i1notes);
- newpat = copy_rtx_if_shared (newpat);
- newi2pat = copy_rtx_if_shared (newi2pat);
- if (undobuf.other_insn)
- reset_used_flags (PATTERN (undobuf.other_insn));
-
- INSN_CODE (i3) = insn_code_number;
- PATTERN (i3) = newpat;
- if (undobuf.other_insn)
- INSN_CODE (undobuf.other_insn) = other_code_number;
-
- /* We had one special case above where I2 had more than one set and
- we replaced a destination of one of those sets with the destination
- of I3. In that case, we have to update LOG_LINKS of insns later
- in this basic block. Note that this (expensive) case is rare.
-
- Also, in this case, we must pretend that all REG_NOTEs for I2
- actually came from I3, so that REG_UNUSED notes from I2 will be
- properly handled. */
-
- if (i3_subst_into_i2)
- {
- for (i = 0; i < XVECLEN (PATTERN (i2), 0); i++)
- if (GET_CODE (SET_DEST (XVECEXP (PATTERN (i2), 0, i))) == REG
- && SET_DEST (XVECEXP (PATTERN (i2), 0, i)) != i2dest
- && ! find_reg_note (i2, REG_UNUSED,
- SET_DEST (XVECEXP (PATTERN (i2), 0, i))))
- for (temp = NEXT_INSN (i2);
- temp && (this_basic_block == n_basic_blocks - 1
- || basic_block_head[this_basic_block] != temp);
- temp = NEXT_INSN (temp))
- if (temp != i3 && GET_RTX_CLASS (GET_CODE (temp)) == 'i')
- for (link = LOG_LINKS (temp); link; link = XEXP (link, 1))
- if (XEXP (link, 0) == i2)
- XEXP (link, 0) = i3;
-
- if (i3notes)
- {
- rtx link = i3notes;
- while (XEXP (link, 1))
- link = XEXP (link, 1);
- XEXP (link, 1) = i2notes;
- }
- else
- i3notes = i2notes;
- i2notes = 0;
- }
-
- LOG_LINKS (i3) = 0;
- REG_NOTES (i3) = 0;
- LOG_LINKS (i2) = 0;
- REG_NOTES (i2) = 0;
-
- if (newi2pat)
- {
- INSN_CODE (i2) = i2_code_number;
- PATTERN (i2) = newi2pat;
- }
- else
- {
- PUT_CODE (i2, NOTE);
- NOTE_LINE_NUMBER (i2) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (i2) = 0;
- }
-
- if (i1)
- {
- LOG_LINKS (i1) = 0;
- REG_NOTES (i1) = 0;
- PUT_CODE (i1, NOTE);
- NOTE_LINE_NUMBER (i1) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (i1) = 0;
- }
-
- /* Get death notes for everything that is now used in either I3 or
- I2 and used to die in a previous insn. If we built two new
- patterns, move from I1 to I2 then I2 to I3 so that we get the
- proper movement on registers that I2 modifies. */
-
- if (newi2pat)
- {
- move_deaths (newi2pat, NULL_RTX, INSN_CUID (i1), i2, &midnotes);
- move_deaths (newpat, newi2pat, INSN_CUID (i1), i3, &midnotes);
- }
- else
- move_deaths (newpat, NULL_RTX, i1 ? INSN_CUID (i1) : INSN_CUID (i2),
- i3, &midnotes);
-
- /* Distribute all the LOG_LINKS and REG_NOTES from I1, I2, and I3. */
- if (i3notes)
- distribute_notes (i3notes, i3, i3, newi2pat ? i2 : NULL_RTX,
- elim_i2, elim_i1);
- if (i2notes)
- distribute_notes (i2notes, i2, i3, newi2pat ? i2 : NULL_RTX,
- elim_i2, elim_i1);
- if (i1notes)
- distribute_notes (i1notes, i1, i3, newi2pat ? i2 : NULL_RTX,
- elim_i2, elim_i1);
- if (midnotes)
- distribute_notes (midnotes, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
- elim_i2, elim_i1);
-
- /* Distribute any notes added to I2 or I3 by recog_for_combine. We
- know these are REG_UNUSED and want them to go to the desired insn,
- so we always pass it as i3. We have not counted the notes in
- reg_n_deaths yet, so we need to do so now. */
-
- if (newi2pat && new_i2_notes)
- {
- for (temp = new_i2_notes; temp; temp = XEXP (temp, 1))
- if (GET_CODE (XEXP (temp, 0)) == REG)
- reg_n_deaths[REGNO (XEXP (temp, 0))]++;
-
- distribute_notes (new_i2_notes, i2, i2, NULL_RTX, NULL_RTX, NULL_RTX);
- }
-
- if (new_i3_notes)
- {
- for (temp = new_i3_notes; temp; temp = XEXP (temp, 1))
- if (GET_CODE (XEXP (temp, 0)) == REG)
- reg_n_deaths[REGNO (XEXP (temp, 0))]++;
-
- distribute_notes (new_i3_notes, i3, i3, NULL_RTX, NULL_RTX, NULL_RTX);
- }
-
- /* If I3DEST was used in I3SRC, it really died in I3. We may need to
- put a REG_DEAD note for it somewhere. Similarly for I2 and I1.
- Show an additional death due to the REG_DEAD note we make here. If
- we discard it in distribute_notes, we will decrement it again. */
-
- if (i3dest_killed)
- {
- if (GET_CODE (i3dest_killed) == REG)
- reg_n_deaths[REGNO (i3dest_killed)]++;
-
- distribute_notes (gen_rtx (EXPR_LIST, REG_DEAD, i3dest_killed,
- NULL_RTX),
- NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
- NULL_RTX, NULL_RTX);
- }
-
- /* For I2 and I1, we have to be careful. If NEWI2PAT exists and sets
- I2DEST or I1DEST, the death must be somewhere before I2, not I3. If
- we passed I3 in that case, it might delete I2. */
-
- if (i2dest_in_i2src)
- {
- if (GET_CODE (i2dest) == REG)
- reg_n_deaths[REGNO (i2dest)]++;
-
- if (newi2pat && reg_set_p (i2dest, newi2pat))
- distribute_notes (gen_rtx (EXPR_LIST, REG_DEAD, i2dest, NULL_RTX),
- NULL_RTX, i2, NULL_RTX, NULL_RTX, NULL_RTX);
- else
- distribute_notes (gen_rtx (EXPR_LIST, REG_DEAD, i2dest, NULL_RTX),
- NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
- NULL_RTX, NULL_RTX);
- }
-
- if (i1dest_in_i1src)
- {
- if (GET_CODE (i1dest) == REG)
- reg_n_deaths[REGNO (i1dest)]++;
-
- if (newi2pat && reg_set_p (i1dest, newi2pat))
- distribute_notes (gen_rtx (EXPR_LIST, REG_DEAD, i1dest, NULL_RTX),
- NULL_RTX, i2, NULL_RTX, NULL_RTX, NULL_RTX);
- else
- distribute_notes (gen_rtx (EXPR_LIST, REG_DEAD, i1dest, NULL_RTX),
- NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
- NULL_RTX, NULL_RTX);
- }
-
- distribute_links (i3links);
- distribute_links (i2links);
- distribute_links (i1links);
-
- if (GET_CODE (i2dest) == REG)
- {
- rtx link;
- rtx i2_insn = 0, i2_val = 0, set;
-
- /* The insn that used to set this register doesn't exist, and
- this life of the register may not exist either. See if one of
- I3's links points to an insn that sets I2DEST. If it does,
- that is now the last known value for I2DEST. If we don't update
- this and I2 set the register to a value that depended on its old
- contents, we will get confused. If this insn is used, thing
- will be set correctly in combine_instructions. */
-
- for (link = LOG_LINKS (i3); link; link = XEXP (link, 1))
- if ((set = single_set (XEXP (link, 0))) != 0
- && rtx_equal_p (i2dest, SET_DEST (set)))
- i2_insn = XEXP (link, 0), i2_val = SET_SRC (set);
-
- record_value_for_reg (i2dest, i2_insn, i2_val);
-
- /* If the reg formerly set in I2 died only once and that was in I3,
- zero its use count so it won't make `reload' do any work. */
- if (! added_sets_2
- && (newi2pat == 0 || ! reg_mentioned_p (i2dest, newi2pat))
- && ! i2dest_in_i2src)
- {
- regno = REGNO (i2dest);
- reg_n_sets[regno]--;
- if (reg_n_sets[regno] == 0
- && ! (basic_block_live_at_start[0][regno / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS))))
- reg_n_refs[regno] = 0;
- }
- }
-
- if (i1 && GET_CODE (i1dest) == REG)
- {
- rtx link;
- rtx i1_insn = 0, i1_val = 0, set;
-
- for (link = LOG_LINKS (i3); link; link = XEXP (link, 1))
- if ((set = single_set (XEXP (link, 0))) != 0
- && rtx_equal_p (i1dest, SET_DEST (set)))
- i1_insn = XEXP (link, 0), i1_val = SET_SRC (set);
-
- record_value_for_reg (i1dest, i1_insn, i1_val);
-
- regno = REGNO (i1dest);
- if (! added_sets_1 && ! i1dest_in_i1src)
- {
- reg_n_sets[regno]--;
- if (reg_n_sets[regno] == 0
- && ! (basic_block_live_at_start[0][regno / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS))))
- reg_n_refs[regno] = 0;
- }
- }
-
- /* Update reg_nonzero_bits et al for any changes that may have been made
- to this insn. */
-
- note_stores (newpat, set_nonzero_bits_and_sign_copies);
- if (newi2pat)
- note_stores (newi2pat, set_nonzero_bits_and_sign_copies);
-
- /* If we added any (clobber (scratch)), add them to the max for a
- block. This is a very pessimistic calculation, since we might
- have had them already and this might not be the worst block, but
- it's not worth doing any better. */
- max_scratch += i3_scratches + i2_scratches + other_scratches;
-
- /* If I3 is now an unconditional jump, ensure that it has a
- BARRIER following it since it may have initially been a
- conditional jump. It may also be the last nonnote insn. */
-
- if ((GET_CODE (newpat) == RETURN || simplejump_p (i3))
- && ((temp = next_nonnote_insn (i3)) == NULL_RTX
- || GET_CODE (temp) != BARRIER))
- emit_barrier_after (i3);
- }
-
- combine_successes++;
-
- /* Clear this here, so that subsequent get_last_value calls are not
- affected. */
- subst_prev_insn = NULL_RTX;
-
- if (added_links_insn
- && (newi2pat == 0 || INSN_CUID (added_links_insn) < INSN_CUID (i2))
- && INSN_CUID (added_links_insn) < INSN_CUID (i3))
- return added_links_insn;
- else
- return newi2pat ? i2 : i3;
-}
-
-/* Undo all the modifications recorded in undobuf. */
-
-static void
-undo_all ()
-{
- struct undo *undo, *next;
-
- for (undo = undobuf.undos; undo; undo = next)
- {
- next = undo->next;
- if (undo->is_int)
- *undo->where.i = undo->old_contents.i;
- else
- *undo->where.r = undo->old_contents.r;
-
- undo->next = undobuf.frees;
- undobuf.frees = undo;
- }
-
- obfree (undobuf.storage);
- undobuf.undos = undobuf.previous_undos = 0;
-
- /* Clear this here, so that subsequent get_last_value calls are not
- affected. */
- subst_prev_insn = NULL_RTX;
-}
-
-/* Find the innermost point within the rtx at LOC, possibly LOC itself,
- where we have an arithmetic expression and return that point. LOC will
- be inside INSN.
-
- try_combine will call this function to see if an insn can be split into
- two insns. */
-
-static rtx *
-find_split_point (loc, insn)
- rtx *loc;
- rtx insn;
-{
- rtx x = *loc;
- enum rtx_code code = GET_CODE (x);
- rtx *split;
- int len = 0, pos, unsignedp;
- rtx inner;
-
- /* First special-case some codes. */
- switch (code)
- {
- case SUBREG:
-#ifdef INSN_SCHEDULING
- /* If we are making a paradoxical SUBREG invalid, it becomes a split
- point. */
- if (GET_CODE (SUBREG_REG (x)) == MEM)
- return loc;
-#endif
- return find_split_point (&SUBREG_REG (x), insn);
-
- case MEM:
-#ifdef HAVE_lo_sum
- /* If we have (mem (const ..)) or (mem (symbol_ref ...)), split it
- using LO_SUM and HIGH. */
- if (GET_CODE (XEXP (x, 0)) == CONST
- || GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
- {
- SUBST (XEXP (x, 0),
- gen_rtx_combine (LO_SUM, Pmode,
- gen_rtx_combine (HIGH, Pmode, XEXP (x, 0)),
- XEXP (x, 0)));
- return &XEXP (XEXP (x, 0), 0);
- }
-#endif
-
- /* If we have a PLUS whose second operand is a constant and the
- address is not valid, perhaps will can split it up using
- the machine-specific way to split large constants. We use
- the first pseudo-reg (one of the virtual regs) as a placeholder;
- it will not remain in the result. */
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && ! memory_address_p (GET_MODE (x), XEXP (x, 0)))
- {
- rtx reg = regno_reg_rtx[FIRST_PSEUDO_REGISTER];
- rtx seq = split_insns (gen_rtx (SET, VOIDmode, reg, XEXP (x, 0)),
- subst_insn);
-
- /* This should have produced two insns, each of which sets our
- placeholder. If the source of the second is a valid address,
- we can make put both sources together and make a split point
- in the middle. */
-
- if (seq && XVECLEN (seq, 0) == 2
- && GET_CODE (XVECEXP (seq, 0, 0)) == INSN
- && GET_CODE (PATTERN (XVECEXP (seq, 0, 0))) == SET
- && SET_DEST (PATTERN (XVECEXP (seq, 0, 0))) == reg
- && ! reg_mentioned_p (reg,
- SET_SRC (PATTERN (XVECEXP (seq, 0, 0))))
- && GET_CODE (XVECEXP (seq, 0, 1)) == INSN
- && GET_CODE (PATTERN (XVECEXP (seq, 0, 1))) == SET
- && SET_DEST (PATTERN (XVECEXP (seq, 0, 1))) == reg
- && memory_address_p (GET_MODE (x),
- SET_SRC (PATTERN (XVECEXP (seq, 0, 1)))))
- {
- rtx src1 = SET_SRC (PATTERN (XVECEXP (seq, 0, 0)));
- rtx src2 = SET_SRC (PATTERN (XVECEXP (seq, 0, 1)));
-
- /* Replace the placeholder in SRC2 with SRC1. If we can
- find where in SRC2 it was placed, that can become our
- split point and we can replace this address with SRC2.
- Just try two obvious places. */
-
- src2 = replace_rtx (src2, reg, src1);
- split = 0;
- if (XEXP (src2, 0) == src1)
- split = &XEXP (src2, 0);
- else if (GET_RTX_FORMAT (GET_CODE (XEXP (src2, 0)))[0] == 'e'
- && XEXP (XEXP (src2, 0), 0) == src1)
- split = &XEXP (XEXP (src2, 0), 0);
-
- if (split)
- {
- SUBST (XEXP (x, 0), src2);
- return split;
- }
- }
-
- /* If that didn't work, perhaps the first operand is complex and
- needs to be computed separately, so make a split point there.
- This will occur on machines that just support REG + CONST
- and have a constant moved through some previous computation. */
-
- else if (GET_RTX_CLASS (GET_CODE (XEXP (XEXP (x, 0), 0))) != 'o'
- && ! (GET_CODE (XEXP (XEXP (x, 0), 0)) == SUBREG
- && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (XEXP (x, 0), 0))))
- == 'o')))
- return &XEXP (XEXP (x, 0), 0);
- }
- break;
-
- case SET:
-#ifdef HAVE_cc0
- /* If SET_DEST is CC0 and SET_SRC is not an operand, a COMPARE, or a
- ZERO_EXTRACT, the most likely reason why this doesn't match is that
- we need to put the operand into a register. So split at that
- point. */
-
- if (SET_DEST (x) == cc0_rtx
- && GET_CODE (SET_SRC (x)) != COMPARE
- && GET_CODE (SET_SRC (x)) != ZERO_EXTRACT
- && GET_RTX_CLASS (GET_CODE (SET_SRC (x))) != 'o'
- && ! (GET_CODE (SET_SRC (x)) == SUBREG
- && GET_RTX_CLASS (GET_CODE (SUBREG_REG (SET_SRC (x)))) == 'o'))
- return &SET_SRC (x);
-#endif
-
- /* See if we can split SET_SRC as it stands. */
- split = find_split_point (&SET_SRC (x), insn);
- if (split && split != &SET_SRC (x))
- return split;
-
- /* See if we can split SET_DEST as it stands. */
- split = find_split_point (&SET_DEST (x), insn);
- if (split && split != &SET_DEST (x))
- return split;
-
- /* See if this is a bitfield assignment with everything constant. If
- so, this is an IOR of an AND, so split it into that. */
- if (GET_CODE (SET_DEST (x)) == ZERO_EXTRACT
- && (GET_MODE_BITSIZE (GET_MODE (XEXP (SET_DEST (x), 0)))
- <= HOST_BITS_PER_WIDE_INT)
- && GET_CODE (XEXP (SET_DEST (x), 1)) == CONST_INT
- && GET_CODE (XEXP (SET_DEST (x), 2)) == CONST_INT
- && GET_CODE (SET_SRC (x)) == CONST_INT
- && ((INTVAL (XEXP (SET_DEST (x), 1))
- + INTVAL (XEXP (SET_DEST (x), 2)))
- <= GET_MODE_BITSIZE (GET_MODE (XEXP (SET_DEST (x), 0))))
- && ! side_effects_p (XEXP (SET_DEST (x), 0)))
- {
- int pos = INTVAL (XEXP (SET_DEST (x), 2));
- int len = INTVAL (XEXP (SET_DEST (x), 1));
- int src = INTVAL (SET_SRC (x));
- rtx dest = XEXP (SET_DEST (x), 0);
- enum machine_mode mode = GET_MODE (dest);
- unsigned HOST_WIDE_INT mask = ((HOST_WIDE_INT) 1 << len) - 1;
-
- if (BITS_BIG_ENDIAN)
- pos = GET_MODE_BITSIZE (mode) - len - pos;
-
- if (src == mask)
- SUBST (SET_SRC (x),
- gen_binary (IOR, mode, dest, GEN_INT (src << pos)));
- else
- SUBST (SET_SRC (x),
- gen_binary (IOR, mode,
- gen_binary (AND, mode, dest,
- GEN_INT (~ (mask << pos)
- & GET_MODE_MASK (mode))),
- GEN_INT (src << pos)));
-
- SUBST (SET_DEST (x), dest);
-
- split = find_split_point (&SET_SRC (x), insn);
- if (split && split != &SET_SRC (x))
- return split;
- }
-
- /* Otherwise, see if this is an operation that we can split into two.
- If so, try to split that. */
- code = GET_CODE (SET_SRC (x));
-
- switch (code)
- {
- case AND:
- /* If we are AND'ing with a large constant that is only a single
- bit and the result is only being used in a context where we
- need to know if it is zero or non-zero, replace it with a bit
- extraction. This will avoid the large constant, which might
- have taken more than one insn to make. If the constant were
- not a valid argument to the AND but took only one insn to make,
- this is no worse, but if it took more than one insn, it will
- be better. */
-
- if (GET_CODE (XEXP (SET_SRC (x), 1)) == CONST_INT
- && GET_CODE (XEXP (SET_SRC (x), 0)) == REG
- && (pos = exact_log2 (INTVAL (XEXP (SET_SRC (x), 1)))) >= 7
- && GET_CODE (SET_DEST (x)) == REG
- && (split = find_single_use (SET_DEST (x), insn, NULL_PTR)) != 0
- && (GET_CODE (*split) == EQ || GET_CODE (*split) == NE)
- && XEXP (*split, 0) == SET_DEST (x)
- && XEXP (*split, 1) == const0_rtx)
- {
- rtx extraction = make_extraction (GET_MODE (SET_DEST (x)),
- XEXP (SET_SRC (x), 0),
- pos, NULL_RTX, 1, 1, 0, 0);
- if (extraction != 0)
- {
- SUBST (SET_SRC (x), extraction);
- return find_split_point (loc, insn);
- }
- }
- break;
-
- case NE:
- /* if STORE_FLAG_VALUE is -1, this is (NE X 0) and only one bit of X
- is known to be on, this can be converted into a NEG of a shift. */
- if (STORE_FLAG_VALUE == -1 && XEXP (SET_SRC (x), 1) == const0_rtx
- && GET_MODE (SET_SRC (x)) == GET_MODE (XEXP (SET_SRC (x), 0))
- && 1 <= (pos = exact_log2
- (nonzero_bits (XEXP (SET_SRC (x), 0),
- GET_MODE (XEXP (SET_SRC (x), 0))))))
- {
- enum machine_mode mode = GET_MODE (XEXP (SET_SRC (x), 0));
-
- SUBST (SET_SRC (x),
- gen_rtx_combine (NEG, mode,
- gen_rtx_combine (LSHIFTRT, mode,
- XEXP (SET_SRC (x), 0),
- GEN_INT (pos))));
-
- split = find_split_point (&SET_SRC (x), insn);
- if (split && split != &SET_SRC (x))
- return split;
- }
- break;
-
- case SIGN_EXTEND:
- inner = XEXP (SET_SRC (x), 0);
-
- /* We can't optimize if either mode is a partial integer
- mode as we don't know how many bits are significant
- in those modes. */
- if (GET_MODE_CLASS (GET_MODE (inner)) == MODE_PARTIAL_INT
- || GET_MODE_CLASS (GET_MODE (SET_SRC (x))) == MODE_PARTIAL_INT)
- break;
-
- pos = 0;
- len = GET_MODE_BITSIZE (GET_MODE (inner));
- unsignedp = 0;
- break;
-
- case SIGN_EXTRACT:
- case ZERO_EXTRACT:
- if (GET_CODE (XEXP (SET_SRC (x), 1)) == CONST_INT
- && GET_CODE (XEXP (SET_SRC (x), 2)) == CONST_INT)
- {
- inner = XEXP (SET_SRC (x), 0);
- len = INTVAL (XEXP (SET_SRC (x), 1));
- pos = INTVAL (XEXP (SET_SRC (x), 2));
-
- if (BITS_BIG_ENDIAN)
- pos = GET_MODE_BITSIZE (GET_MODE (inner)) - len - pos;
- unsignedp = (code == ZERO_EXTRACT);
- }
- break;
- }
-
- if (len && pos >= 0 && pos + len <= GET_MODE_BITSIZE (GET_MODE (inner)))
- {
- enum machine_mode mode = GET_MODE (SET_SRC (x));
-
- /* For unsigned, we have a choice of a shift followed by an
- AND or two shifts. Use two shifts for field sizes where the
- constant might be too large. We assume here that we can
- always at least get 8-bit constants in an AND insn, which is
- true for every current RISC. */
-
- if (unsignedp && len <= 8)
- {
- SUBST (SET_SRC (x),
- gen_rtx_combine
- (AND, mode,
- gen_rtx_combine (LSHIFTRT, mode,
- gen_lowpart_for_combine (mode, inner),
- GEN_INT (pos)),
- GEN_INT (((HOST_WIDE_INT) 1 << len) - 1)));
-
- split = find_split_point (&SET_SRC (x), insn);
- if (split && split != &SET_SRC (x))
- return split;
- }
- else
- {
- SUBST (SET_SRC (x),
- gen_rtx_combine
- (unsignedp ? LSHIFTRT : ASHIFTRT, mode,
- gen_rtx_combine (ASHIFT, mode,
- gen_lowpart_for_combine (mode, inner),
- GEN_INT (GET_MODE_BITSIZE (mode)
- - len - pos)),
- GEN_INT (GET_MODE_BITSIZE (mode) - len)));
-
- split = find_split_point (&SET_SRC (x), insn);
- if (split && split != &SET_SRC (x))
- return split;
- }
- }
-
- /* See if this is a simple operation with a constant as the second
- operand. It might be that this constant is out of range and hence
- could be used as a split point. */
- if ((GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '2'
- || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == 'c'
- || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '<')
- && CONSTANT_P (XEXP (SET_SRC (x), 1))
- && (GET_RTX_CLASS (GET_CODE (XEXP (SET_SRC (x), 0))) == 'o'
- || (GET_CODE (XEXP (SET_SRC (x), 0)) == SUBREG
- && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (SET_SRC (x), 0))))
- == 'o'))))
- return &XEXP (SET_SRC (x), 1);
-
- /* Finally, see if this is a simple operation with its first operand
- not in a register. The operation might require this operand in a
- register, so return it as a split point. We can always do this
- because if the first operand were another operation, we would have
- already found it as a split point. */
- if ((GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '2'
- || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == 'c'
- || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '<'
- || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '1')
- && ! register_operand (XEXP (SET_SRC (x), 0), VOIDmode))
- return &XEXP (SET_SRC (x), 0);
-
- return 0;
-
- case AND:
- case IOR:
- /* We write NOR as (and (not A) (not B)), but if we don't have a NOR,
- it is better to write this as (not (ior A B)) so we can split it.
- Similarly for IOR. */
- if (GET_CODE (XEXP (x, 0)) == NOT && GET_CODE (XEXP (x, 1)) == NOT)
- {
- SUBST (*loc,
- gen_rtx_combine (NOT, GET_MODE (x),
- gen_rtx_combine (code == IOR ? AND : IOR,
- GET_MODE (x),
- XEXP (XEXP (x, 0), 0),
- XEXP (XEXP (x, 1), 0))));
- return find_split_point (loc, insn);
- }
-
- /* Many RISC machines have a large set of logical insns. If the
- second operand is a NOT, put it first so we will try to split the
- other operand first. */
- if (GET_CODE (XEXP (x, 1)) == NOT)
- {
- rtx tem = XEXP (x, 0);
- SUBST (XEXP (x, 0), XEXP (x, 1));
- SUBST (XEXP (x, 1), tem);
- }
- break;
- }
-
- /* Otherwise, select our actions depending on our rtx class. */
- switch (GET_RTX_CLASS (code))
- {
- case 'b': /* This is ZERO_EXTRACT and SIGN_EXTRACT. */
- case '3':
- split = find_split_point (&XEXP (x, 2), insn);
- if (split)
- return split;
- /* ... fall through ... */
- case '2':
- case 'c':
- case '<':
- split = find_split_point (&XEXP (x, 1), insn);
- if (split)
- return split;
- /* ... fall through ... */
- case '1':
- /* Some machines have (and (shift ...) ...) insns. If X is not
- an AND, but XEXP (X, 0) is, use it as our split point. */
- if (GET_CODE (x) != AND && GET_CODE (XEXP (x, 0)) == AND)
- return &XEXP (x, 0);
-
- split = find_split_point (&XEXP (x, 0), insn);
- if (split)
- return split;
- return loc;
- }
-
- /* Otherwise, we don't have a split point. */
- return 0;
-}
-
-/* Throughout X, replace FROM with TO, and return the result.
- The result is TO if X is FROM;
- otherwise the result is X, but its contents may have been modified.
- If they were modified, a record was made in undobuf so that
- undo_all will (among other things) return X to its original state.
-
- If the number of changes necessary is too much to record to undo,
- the excess changes are not made, so the result is invalid.
- The changes already made can still be undone.
- undobuf.num_undo is incremented for such changes, so by testing that
- the caller can tell whether the result is valid.
-
- `n_occurrences' is incremented each time FROM is replaced.
-
- IN_DEST is non-zero if we are processing the SET_DEST of a SET.
-
- UNIQUE_COPY is non-zero if each substitution must be unique. We do this
- by copying if `n_occurrences' is non-zero. */
-
-static rtx
-subst (x, from, to, in_dest, unique_copy)
- register rtx x, from, to;
- int in_dest;
- int unique_copy;
-{
- register enum rtx_code code = GET_CODE (x);
- enum machine_mode op0_mode = VOIDmode;
- register char *fmt;
- register int len, i;
- rtx new;
-
-/* Two expressions are equal if they are identical copies of a shared
- RTX or if they are both registers with the same register number
- and mode. */
-
-#define COMBINE_RTX_EQUAL_P(X,Y) \
- ((X) == (Y) \
- || (GET_CODE (X) == REG && GET_CODE (Y) == REG \
- && REGNO (X) == REGNO (Y) && GET_MODE (X) == GET_MODE (Y)))
-
- if (! in_dest && COMBINE_RTX_EQUAL_P (x, from))
- {
- n_occurrences++;
- return (unique_copy && n_occurrences > 1 ? copy_rtx (to) : to);
- }
-
- /* If X and FROM are the same register but different modes, they will
- not have been seen as equal above. However, flow.c will make a
- LOG_LINKS entry for that case. If we do nothing, we will try to
- rerecognize our original insn and, when it succeeds, we will
- delete the feeding insn, which is incorrect.
-
- So force this insn not to match in this (rare) case. */
- if (! in_dest && code == REG && GET_CODE (from) == REG
- && REGNO (x) == REGNO (from))
- return gen_rtx (CLOBBER, GET_MODE (x), const0_rtx);
-
- /* If this is an object, we are done unless it is a MEM or LO_SUM, both
- of which may contain things that can be combined. */
- if (code != MEM && code != LO_SUM && GET_RTX_CLASS (code) == 'o')
- return x;
-
- /* It is possible to have a subexpression appear twice in the insn.
- Suppose that FROM is a register that appears within TO.
- Then, after that subexpression has been scanned once by `subst',
- the second time it is scanned, TO may be found. If we were
- to scan TO here, we would find FROM within it and create a
- self-referent rtl structure which is completely wrong. */
- if (COMBINE_RTX_EQUAL_P (x, to))
- return to;
-
- len = GET_RTX_LENGTH (code);
- fmt = GET_RTX_FORMAT (code);
-
- /* We don't need to process a SET_DEST that is a register, CC0, or PC, so
- set up to skip this common case. All other cases where we want to
- suppress replacing something inside a SET_SRC are handled via the
- IN_DEST operand. */
- if (code == SET
- && (GET_CODE (SET_DEST (x)) == REG
- || GET_CODE (SET_DEST (x)) == CC0
- || GET_CODE (SET_DEST (x)) == PC))
- fmt = "ie";
-
- /* Get the mode of operand 0 in case X is now a SIGN_EXTEND of a
- constant. */
- if (fmt[0] == 'e')
- op0_mode = GET_MODE (XEXP (x, 0));
-
- for (i = 0; i < len; i++)
- {
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- {
- if (COMBINE_RTX_EQUAL_P (XVECEXP (x, i, j), from))
- {
- new = (unique_copy && n_occurrences ? copy_rtx (to) : to);
- n_occurrences++;
- }
- else
- {
- new = subst (XVECEXP (x, i, j), from, to, 0, unique_copy);
-
- /* If this substitution failed, this whole thing fails. */
- if (GET_CODE (new) == CLOBBER && XEXP (new, 0) == const0_rtx)
- return new;
- }
-
- SUBST (XVECEXP (x, i, j), new);
- }
- }
- else if (fmt[i] == 'e')
- {
- if (COMBINE_RTX_EQUAL_P (XEXP (x, i), from))
- {
- /* In general, don't install a subreg involving two modes not
- tieable. It can worsen register allocation, and can even
- make invalid reload insns, since the reg inside may need to
- be copied from in the outside mode, and that may be invalid
- if it is an fp reg copied in integer mode.
-
- We allow two exceptions to this: It is valid if it is inside
- another SUBREG and the mode of that SUBREG and the mode of
- the inside of TO is tieable and it is valid if X is a SET
- that copies FROM to CC0. */
- if (GET_CODE (to) == SUBREG
- && ! MODES_TIEABLE_P (GET_MODE (to),
- GET_MODE (SUBREG_REG (to)))
- && ! (code == SUBREG
- && MODES_TIEABLE_P (GET_MODE (x),
- GET_MODE (SUBREG_REG (to))))
-#ifdef HAVE_cc0
- && ! (code == SET && i == 1 && XEXP (x, 0) == cc0_rtx)
-#endif
- )
- return gen_rtx (CLOBBER, VOIDmode, const0_rtx);
-
- new = (unique_copy && n_occurrences ? copy_rtx (to) : to);
- n_occurrences++;
- }
- else
- /* If we are in a SET_DEST, suppress most cases unless we
- have gone inside a MEM, in which case we want to
- simplify the address. We assume here that things that
- are actually part of the destination have their inner
- parts in the first expression. This is true for SUBREG,
- STRICT_LOW_PART, and ZERO_EXTRACT, which are the only
- things aside from REG and MEM that should appear in a
- SET_DEST. */
- new = subst (XEXP (x, i), from, to,
- (((in_dest
- && (code == SUBREG || code == STRICT_LOW_PART
- || code == ZERO_EXTRACT))
- || code == SET)
- && i == 0), unique_copy);
-
- /* If we found that we will have to reject this combination,
- indicate that by returning the CLOBBER ourselves, rather than
- an expression containing it. This will speed things up as
- well as prevent accidents where two CLOBBERs are considered
- to be equal, thus producing an incorrect simplification. */
-
- if (GET_CODE (new) == CLOBBER && XEXP (new, 0) == const0_rtx)
- return new;
-
- SUBST (XEXP (x, i), new);
- }
- }
-
- /* Try to simplify X. If the simplification changed the code, it is likely
- that further simplification will help, so loop, but limit the number
- of repetitions that will be performed. */
-
- for (i = 0; i < 4; i++)
- {
- /* If X is sufficiently simple, don't bother trying to do anything
- with it. */
- if (code != CONST_INT && code != REG && code != CLOBBER)
- x = simplify_rtx (x, op0_mode, i == 3, in_dest);
-
- if (GET_CODE (x) == code)
- break;
-
- code = GET_CODE (x);
-
- /* We no longer know the original mode of operand 0 since we
- have changed the form of X) */
- op0_mode = VOIDmode;
- }
-
- return x;
-}
-
-/* Simplify X, a piece of RTL. We just operate on the expression at the
- outer level; call `subst' to simplify recursively. Return the new
- expression.
-
- OP0_MODE is the original mode of XEXP (x, 0); LAST is nonzero if this
- will be the iteration even if an expression with a code different from
- X is returned; IN_DEST is nonzero if we are inside a SET_DEST. */
-
-static rtx
-simplify_rtx (x, op0_mode, last, in_dest)
- rtx x;
- enum machine_mode op0_mode;
- int last;
- int in_dest;
-{
- enum rtx_code code = GET_CODE (x);
- enum machine_mode mode = GET_MODE (x);
- rtx temp;
- int i;
-
- /* If this is a commutative operation, put a constant last and a complex
- expression first. We don't need to do this for comparisons here. */
- if (GET_RTX_CLASS (code) == 'c'
- && ((CONSTANT_P (XEXP (x, 0)) && GET_CODE (XEXP (x, 1)) != CONST_INT)
- || (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == 'o'
- && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o')
- || (GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) == 'o'
- && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o')))
- {
- temp = XEXP (x, 0);
- SUBST (XEXP (x, 0), XEXP (x, 1));
- SUBST (XEXP (x, 1), temp);
- }
-
- /* If this is a PLUS, MINUS, or MULT, and the first operand is the
- sign extension of a PLUS with a constant, reverse the order of the sign
- extension and the addition. Note that this not the same as the original
- code, but overflow is undefined for signed values. Also note that the
- PLUS will have been partially moved "inside" the sign-extension, so that
- the first operand of X will really look like:
- (ashiftrt (plus (ashift A C4) C5) C4).
- We convert this to
- (plus (ashiftrt (ashift A C4) C2) C4)
- and replace the first operand of X with that expression. Later parts
- of this function may simplify the expression further.
-
- For example, if we start with (mult (sign_extend (plus A C1)) C2),
- we swap the SIGN_EXTEND and PLUS. Later code will apply the
- distributive law to produce (plus (mult (sign_extend X) C1) C3).
-
- We do this to simplify address expressions. */
-
- if ((code == PLUS || code == MINUS || code == MULT)
- && GET_CODE (XEXP (x, 0)) == ASHIFTRT
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == PLUS
- && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == ASHIFT
- && GET_CODE (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 1)) == CONST_INT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 1) == XEXP (XEXP (x, 0), 1)
- && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == CONST_INT
- && (temp = simplify_binary_operation (ASHIFTRT, mode,
- XEXP (XEXP (XEXP (x, 0), 0), 1),
- XEXP (XEXP (x, 0), 1))) != 0)
- {
- rtx new
- = simplify_shift_const (NULL_RTX, ASHIFT, mode,
- XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 0),
- INTVAL (XEXP (XEXP (x, 0), 1)));
-
- new = simplify_shift_const (NULL_RTX, ASHIFTRT, mode, new,
- INTVAL (XEXP (XEXP (x, 0), 1)));
-
- SUBST (XEXP (x, 0), gen_binary (PLUS, mode, new, temp));
- }
-
- /* If this is a simple operation applied to an IF_THEN_ELSE, try
- applying it to the arms of the IF_THEN_ELSE. This often simplifies
- things. Check for cases where both arms are testing the same
- condition.
-
- Don't do anything if all operands are very simple. */
-
- if (((GET_RTX_CLASS (code) == '2' || GET_RTX_CLASS (code) == 'c'
- || GET_RTX_CLASS (code) == '<')
- && ((GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) != 'o'
- && ! (GET_CODE (XEXP (x, 0)) == SUBREG
- && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0))))
- == 'o')))
- || (GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o'
- && ! (GET_CODE (XEXP (x, 1)) == SUBREG
- && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 1))))
- == 'o')))))
- || (GET_RTX_CLASS (code) == '1'
- && ((GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) != 'o'
- && ! (GET_CODE (XEXP (x, 0)) == SUBREG
- && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0))))
- == 'o'))))))
- {
- rtx cond, true, false;
-
- cond = if_then_else_cond (x, &true, &false);
- if (cond != 0
- /* If everything is a comparison, what we have is highly unlikely
- to be simpler, so don't use it. */
- && ! (GET_RTX_CLASS (code) == '<'
- && (GET_RTX_CLASS (GET_CODE (true)) == '<'
- || GET_RTX_CLASS (GET_CODE (false)) == '<')))
- {
- rtx cop1 = const0_rtx;
- enum rtx_code cond_code = simplify_comparison (NE, &cond, &cop1);
-
- if (cond_code == NE && GET_RTX_CLASS (GET_CODE (cond)) == '<')
- return x;
-
- /* Simplify the alternative arms; this may collapse the true and
- false arms to store-flag values. */
- true = subst (true, pc_rtx, pc_rtx, 0, 0);
- false = subst (false, pc_rtx, pc_rtx, 0, 0);
-
- /* Restarting if we generate a store-flag expression will cause
- us to loop. Just drop through in this case. */
-
- /* If the result values are STORE_FLAG_VALUE and zero, we can
- just make the comparison operation. */
- if (true == const_true_rtx && false == const0_rtx)
- x = gen_binary (cond_code, mode, cond, cop1);
- else if (true == const0_rtx && false == const_true_rtx)
- x = gen_binary (reverse_condition (cond_code), mode, cond, cop1);
-
- /* Likewise, we can make the negate of a comparison operation
- if the result values are - STORE_FLAG_VALUE and zero. */
- else if (GET_CODE (true) == CONST_INT
- && INTVAL (true) == - STORE_FLAG_VALUE
- && false == const0_rtx)
- x = gen_unary (NEG, mode, mode,
- gen_binary (cond_code, mode, cond, cop1));
- else if (GET_CODE (false) == CONST_INT
- && INTVAL (false) == - STORE_FLAG_VALUE
- && true == const0_rtx)
- x = gen_unary (NEG, mode, mode,
- gen_binary (reverse_condition (cond_code),
- mode, cond, cop1));
- else
- return gen_rtx (IF_THEN_ELSE, mode,
- gen_binary (cond_code, VOIDmode, cond, cop1),
- true, false);
-
- code = GET_CODE (x);
- op0_mode = VOIDmode;
- }
- }
-
- /* Try to fold this expression in case we have constants that weren't
- present before. */
- temp = 0;
- switch (GET_RTX_CLASS (code))
- {
- case '1':
- temp = simplify_unary_operation (code, mode, XEXP (x, 0), op0_mode);
- break;
- case '<':
- temp = simplify_relational_operation (code, op0_mode,
- XEXP (x, 0), XEXP (x, 1));
-#ifdef FLOAT_STORE_FLAG_VALUE
- if (temp != 0 && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- temp = ((temp == const0_rtx) ? CONST0_RTX (GET_MODE (x))
- : immed_real_const_1 (FLOAT_STORE_FLAG_VALUE, GET_MODE (x)));
-#endif
- break;
- case 'c':
- case '2':
- temp = simplify_binary_operation (code, mode, XEXP (x, 0), XEXP (x, 1));
- break;
- case 'b':
- case '3':
- temp = simplify_ternary_operation (code, mode, op0_mode, XEXP (x, 0),
- XEXP (x, 1), XEXP (x, 2));
- break;
- }
-
- if (temp)
- x = temp, code = GET_CODE (temp);
-
- /* First see if we can apply the inverse distributive law. */
- if (code == PLUS || code == MINUS
- || code == AND || code == IOR || code == XOR)
- {
- x = apply_distributive_law (x);
- code = GET_CODE (x);
- }
-
- /* If CODE is an associative operation not otherwise handled, see if we
- can associate some operands. This can win if they are constants or
- if they are logically related (i.e. (a & b) & a. */
- if ((code == PLUS || code == MINUS
- || code == MULT || code == AND || code == IOR || code == XOR
- || code == DIV || code == UDIV
- || code == SMAX || code == SMIN || code == UMAX || code == UMIN)
- && INTEGRAL_MODE_P (mode))
- {
- if (GET_CODE (XEXP (x, 0)) == code)
- {
- rtx other = XEXP (XEXP (x, 0), 0);
- rtx inner_op0 = XEXP (XEXP (x, 0), 1);
- rtx inner_op1 = XEXP (x, 1);
- rtx inner;
-
- /* Make sure we pass the constant operand if any as the second
- one if this is a commutative operation. */
- if (CONSTANT_P (inner_op0) && GET_RTX_CLASS (code) == 'c')
- {
- rtx tem = inner_op0;
- inner_op0 = inner_op1;
- inner_op1 = tem;
- }
- inner = simplify_binary_operation (code == MINUS ? PLUS
- : code == DIV ? MULT
- : code == UDIV ? MULT
- : code,
- mode, inner_op0, inner_op1);
-
- /* For commutative operations, try the other pair if that one
- didn't simplify. */
- if (inner == 0 && GET_RTX_CLASS (code) == 'c')
- {
- other = XEXP (XEXP (x, 0), 1);
- inner = simplify_binary_operation (code, mode,
- XEXP (XEXP (x, 0), 0),
- XEXP (x, 1));
- }
-
- if (inner)
- return gen_binary (code, mode, other, inner);
- }
- }
-
- /* A little bit of algebraic simplification here. */
- switch (code)
- {
- case MEM:
- /* Ensure that our address has any ASHIFTs converted to MULT in case
- address-recognizing predicates are called later. */
- temp = make_compound_operation (XEXP (x, 0), MEM);
- SUBST (XEXP (x, 0), temp);
- break;
-
- case SUBREG:
- /* (subreg:A (mem:B X) N) becomes a modified MEM unless the SUBREG
- is paradoxical. If we can't do that safely, then it becomes
- something nonsensical so that this combination won't take place. */
-
- if (GET_CODE (SUBREG_REG (x)) == MEM
- && (GET_MODE_SIZE (mode)
- <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))))
- {
- rtx inner = SUBREG_REG (x);
- int endian_offset = 0;
- /* Don't change the mode of the MEM
- if that would change the meaning of the address. */
- if (MEM_VOLATILE_P (SUBREG_REG (x))
- || mode_dependent_address_p (XEXP (inner, 0)))
- return gen_rtx (CLOBBER, mode, const0_rtx);
-
- if (BYTES_BIG_ENDIAN)
- {
- if (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
- endian_offset += UNITS_PER_WORD - GET_MODE_SIZE (mode);
- if (GET_MODE_SIZE (GET_MODE (inner)) < UNITS_PER_WORD)
- endian_offset -= (UNITS_PER_WORD
- - GET_MODE_SIZE (GET_MODE (inner)));
- }
- /* Note if the plus_constant doesn't make a valid address
- then this combination won't be accepted. */
- x = gen_rtx (MEM, mode,
- plus_constant (XEXP (inner, 0),
- (SUBREG_WORD (x) * UNITS_PER_WORD
- + endian_offset)));
- MEM_VOLATILE_P (x) = MEM_VOLATILE_P (inner);
- RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (inner);
- MEM_IN_STRUCT_P (x) = MEM_IN_STRUCT_P (inner);
- return x;
- }
-
- /* If we are in a SET_DEST, these other cases can't apply. */
- if (in_dest)
- return x;
-
- /* Changing mode twice with SUBREG => just change it once,
- or not at all if changing back to starting mode. */
- if (GET_CODE (SUBREG_REG (x)) == SUBREG)
- {
- if (mode == GET_MODE (SUBREG_REG (SUBREG_REG (x)))
- && SUBREG_WORD (x) == 0 && SUBREG_WORD (SUBREG_REG (x)) == 0)
- return SUBREG_REG (SUBREG_REG (x));
-
- SUBST_INT (SUBREG_WORD (x),
- SUBREG_WORD (x) + SUBREG_WORD (SUBREG_REG (x)));
- SUBST (SUBREG_REG (x), SUBREG_REG (SUBREG_REG (x)));
- }
-
- /* SUBREG of a hard register => just change the register number
- and/or mode. If the hard register is not valid in that mode,
- suppress this combination. If the hard register is the stack,
- frame, or argument pointer, leave this as a SUBREG. */
-
- if (GET_CODE (SUBREG_REG (x)) == REG
- && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER
- && REGNO (SUBREG_REG (x)) != FRAME_POINTER_REGNUM
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && REGNO (SUBREG_REG (x)) != HARD_FRAME_POINTER_REGNUM
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- && REGNO (SUBREG_REG (x)) != ARG_POINTER_REGNUM
-#endif
- && REGNO (SUBREG_REG (x)) != STACK_POINTER_REGNUM)
- {
- if (HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (x)) + SUBREG_WORD (x),
- mode))
- return gen_rtx (REG, mode,
- REGNO (SUBREG_REG (x)) + SUBREG_WORD (x));
- else
- return gen_rtx (CLOBBER, mode, const0_rtx);
- }
-
- /* For a constant, try to pick up the part we want. Handle a full
- word and low-order part. Only do this if we are narrowing
- the constant; if it is being widened, we have no idea what
- the extra bits will have been set to. */
-
- if (CONSTANT_P (SUBREG_REG (x)) && op0_mode != VOIDmode
- && GET_MODE_SIZE (mode) == UNITS_PER_WORD
- && GET_MODE_SIZE (op0_mode) > UNITS_PER_WORD
- && GET_MODE_CLASS (mode) == MODE_INT)
- {
- temp = operand_subword (SUBREG_REG (x), SUBREG_WORD (x),
- 0, op0_mode);
- if (temp)
- return temp;
- }
-
- /* If we want a subreg of a constant, at offset 0,
- take the low bits. On a little-endian machine, that's
- always valid. On a big-endian machine, it's valid
- only if the constant's mode fits in one word. Note that we
- cannot use subreg_lowpart_p since SUBREG_REG may be VOIDmode. */
- if (CONSTANT_P (SUBREG_REG (x))
- && ((GET_MODE_SIZE (op0_mode) <= UNITS_PER_WORD
- || ! WORDS_BIG_ENDIAN)
- ? SUBREG_WORD (x) == 0
- : (SUBREG_WORD (x)
- == ((GET_MODE_SIZE (op0_mode)
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD))
- / UNITS_PER_WORD)))
- && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (op0_mode)
- && (! WORDS_BIG_ENDIAN
- || GET_MODE_BITSIZE (op0_mode) <= BITS_PER_WORD))
- return gen_lowpart_for_combine (mode, SUBREG_REG (x));
-
- /* A paradoxical SUBREG of a VOIDmode constant is the same constant,
- since we are saying that the high bits don't matter. */
- if (CONSTANT_P (SUBREG_REG (x)) && GET_MODE (SUBREG_REG (x)) == VOIDmode
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (op0_mode))
- return SUBREG_REG (x);
-
- /* Note that we cannot do any narrowing for non-constants since
- we might have been counting on using the fact that some bits were
- zero. We now do this in the SET. */
-
- break;
-
- case NOT:
- /* (not (plus X -1)) can become (neg X). */
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && XEXP (XEXP (x, 0), 1) == constm1_rtx)
- return gen_rtx_combine (NEG, mode, XEXP (XEXP (x, 0), 0));
-
- /* Similarly, (not (neg X)) is (plus X -1). */
- if (GET_CODE (XEXP (x, 0)) == NEG)
- return gen_rtx_combine (PLUS, mode, XEXP (XEXP (x, 0), 0),
- constm1_rtx);
-
- /* (not (xor X C)) for C constant is (xor X D) with D = ~ C. */
- if (GET_CODE (XEXP (x, 0)) == XOR
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && (temp = simplify_unary_operation (NOT, mode,
- XEXP (XEXP (x, 0), 1),
- mode)) != 0)
- return gen_binary (XOR, mode, XEXP (XEXP (x, 0), 0), temp);
-
- /* (not (ashift 1 X)) is (rotate ~1 X). We used to do this for operands
- other than 1, but that is not valid. We could do a similar
- simplification for (not (lshiftrt C X)) where C is just the sign bit,
- but this doesn't seem common enough to bother with. */
- if (GET_CODE (XEXP (x, 0)) == ASHIFT
- && XEXP (XEXP (x, 0), 0) == const1_rtx)
- return gen_rtx (ROTATE, mode, gen_unary (NOT, mode, mode, const1_rtx),
- XEXP (XEXP (x, 0), 1));
-
- if (GET_CODE (XEXP (x, 0)) == SUBREG
- && subreg_lowpart_p (XEXP (x, 0))
- && (GET_MODE_SIZE (GET_MODE (XEXP (x, 0)))
- < GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (x, 0)))))
- && GET_CODE (SUBREG_REG (XEXP (x, 0))) == ASHIFT
- && XEXP (SUBREG_REG (XEXP (x, 0)), 0) == const1_rtx)
- {
- enum machine_mode inner_mode = GET_MODE (SUBREG_REG (XEXP (x, 0)));
-
- x = gen_rtx (ROTATE, inner_mode,
- gen_unary (NOT, inner_mode, inner_mode, const1_rtx),
- XEXP (SUBREG_REG (XEXP (x, 0)), 1));
- return gen_lowpart_for_combine (mode, x);
- }
-
- /* If STORE_FLAG_VALUE is -1, (not (comparison foo bar)) can be done by
- reversing the comparison code if valid. */
- if (STORE_FLAG_VALUE == -1
- && GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<'
- && reversible_comparison_p (XEXP (x, 0)))
- return gen_rtx_combine (reverse_condition (GET_CODE (XEXP (x, 0))),
- mode, XEXP (XEXP (x, 0), 0),
- XEXP (XEXP (x, 0), 1));
-
- /* (ashiftrt foo C) where C is the number of bits in FOO minus 1
- is (lt foo (const_int 0)) if STORE_FLAG_VALUE is -1, so we can
- perform the above simplification. */
-
- if (STORE_FLAG_VALUE == -1
- && XEXP (x, 1) == const1_rtx
- && GET_CODE (XEXP (x, 0)) == ASHIFTRT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (x, 0), 1)) == GET_MODE_BITSIZE (mode) - 1)
- return gen_rtx_combine (GE, mode, XEXP (XEXP (x, 0), 0), const0_rtx);
-
- /* Apply De Morgan's laws to reduce number of patterns for machines
- with negating logical insns (and-not, nand, etc.). If result has
- only one NOT, put it first, since that is how the patterns are
- coded. */
-
- if (GET_CODE (XEXP (x, 0)) == IOR || GET_CODE (XEXP (x, 0)) == AND)
- {
- rtx in1 = XEXP (XEXP (x, 0), 0), in2 = XEXP (XEXP (x, 0), 1);
-
- if (GET_CODE (in1) == NOT)
- in1 = XEXP (in1, 0);
- else
- in1 = gen_rtx_combine (NOT, GET_MODE (in1), in1);
-
- if (GET_CODE (in2) == NOT)
- in2 = XEXP (in2, 0);
- else if (GET_CODE (in2) == CONST_INT
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
- in2 = GEN_INT (GET_MODE_MASK (mode) & ~ INTVAL (in2));
- else
- in2 = gen_rtx_combine (NOT, GET_MODE (in2), in2);
-
- if (GET_CODE (in2) == NOT)
- {
- rtx tem = in2;
- in2 = in1; in1 = tem;
- }
-
- return gen_rtx_combine (GET_CODE (XEXP (x, 0)) == IOR ? AND : IOR,
- mode, in1, in2);
- }
- break;
-
- case NEG:
- /* (neg (plus X 1)) can become (not X). */
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && XEXP (XEXP (x, 0), 1) == const1_rtx)
- return gen_rtx_combine (NOT, mode, XEXP (XEXP (x, 0), 0));
-
- /* Similarly, (neg (not X)) is (plus X 1). */
- if (GET_CODE (XEXP (x, 0)) == NOT)
- return plus_constant (XEXP (XEXP (x, 0), 0), 1);
-
- /* (neg (minus X Y)) can become (minus Y X). */
- if (GET_CODE (XEXP (x, 0)) == MINUS
- && (! FLOAT_MODE_P (mode)
- /* x-y != -(y-x) with IEEE floating point. */
- || TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || flag_fast_math))
- return gen_binary (MINUS, mode, XEXP (XEXP (x, 0), 1),
- XEXP (XEXP (x, 0), 0));
-
- /* (neg (xor A 1)) is (plus A -1) if A is known to be either 0 or 1. */
- if (GET_CODE (XEXP (x, 0)) == XOR && XEXP (XEXP (x, 0), 1) == const1_rtx
- && nonzero_bits (XEXP (XEXP (x, 0), 0), mode) == 1)
- return gen_binary (PLUS, mode, XEXP (XEXP (x, 0), 0), constm1_rtx);
-
- /* NEG commutes with ASHIFT since it is multiplication. Only do this
- if we can then eliminate the NEG (e.g.,
- if the operand is a constant). */
-
- if (GET_CODE (XEXP (x, 0)) == ASHIFT)
- {
- temp = simplify_unary_operation (NEG, mode,
- XEXP (XEXP (x, 0), 0), mode);
- if (temp)
- {
- SUBST (XEXP (XEXP (x, 0), 0), temp);
- return XEXP (x, 0);
- }
- }
-
- temp = expand_compound_operation (XEXP (x, 0));
-
- /* For C equal to the width of MODE minus 1, (neg (ashiftrt X C)) can be
- replaced by (lshiftrt X C). This will convert
- (neg (sign_extract X 1 Y)) to (zero_extract X 1 Y). */
-
- if (GET_CODE (temp) == ASHIFTRT
- && GET_CODE (XEXP (temp, 1)) == CONST_INT
- && INTVAL (XEXP (temp, 1)) == GET_MODE_BITSIZE (mode) - 1)
- return simplify_shift_const (temp, LSHIFTRT, mode, XEXP (temp, 0),
- INTVAL (XEXP (temp, 1)));
-
- /* If X has only a single bit that might be nonzero, say, bit I, convert
- (neg X) to (ashiftrt (ashift X C-I) C-I) where C is the bitsize of
- MODE minus 1. This will convert (neg (zero_extract X 1 Y)) to
- (sign_extract X 1 Y). But only do this if TEMP isn't a register
- or a SUBREG of one since we'd be making the expression more
- complex if it was just a register. */
-
- if (GET_CODE (temp) != REG
- && ! (GET_CODE (temp) == SUBREG
- && GET_CODE (SUBREG_REG (temp)) == REG)
- && (i = exact_log2 (nonzero_bits (temp, mode))) >= 0)
- {
- rtx temp1 = simplify_shift_const
- (NULL_RTX, ASHIFTRT, mode,
- simplify_shift_const (NULL_RTX, ASHIFT, mode, temp,
- GET_MODE_BITSIZE (mode) - 1 - i),
- GET_MODE_BITSIZE (mode) - 1 - i);
-
- /* If all we did was surround TEMP with the two shifts, we
- haven't improved anything, so don't use it. Otherwise,
- we are better off with TEMP1. */
- if (GET_CODE (temp1) != ASHIFTRT
- || GET_CODE (XEXP (temp1, 0)) != ASHIFT
- || XEXP (XEXP (temp1, 0), 0) != temp)
- return temp1;
- }
- break;
-
- case TRUNCATE:
- /* We can't handle truncation to a partial integer mode here
- because we don't know the real bitsize of the partial
- integer mode. */
- if (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
- break;
-
- if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
- SUBST (XEXP (x, 0),
- force_to_mode (XEXP (x, 0), GET_MODE (XEXP (x, 0)),
- GET_MODE_MASK (mode), NULL_RTX, 0));
-
- /* (truncate:SI ({sign,zero}_extend:DI foo:SI)) == foo:SI. */
- if ((GET_CODE (XEXP (x, 0)) == SIGN_EXTEND
- || GET_CODE (XEXP (x, 0)) == ZERO_EXTEND)
- && GET_MODE (XEXP (XEXP (x, 0), 0)) == mode)
- return XEXP (XEXP (x, 0), 0);
-
- /* (truncate:SI (OP:DI ({sign,zero}_extend:DI foo:SI))) is
- (OP:SI foo:SI) if OP is NEG or ABS. */
- if ((GET_CODE (XEXP (x, 0)) == ABS
- || GET_CODE (XEXP (x, 0)) == NEG)
- && (GET_CODE (XEXP (XEXP (x, 0), 0)) == SIGN_EXTEND
- || GET_CODE (XEXP (XEXP (x, 0), 0)) == ZERO_EXTEND)
- && GET_MODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == mode)
- return gen_unary (GET_CODE (XEXP (x, 0)), mode, mode,
- XEXP (XEXP (XEXP (x, 0), 0), 0));
-
- /* (truncate:SI (subreg:DI (truncate:SI X) 0)) is
- (truncate:SI x). */
- if (GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_CODE (SUBREG_REG (XEXP (x, 0))) == TRUNCATE
- && subreg_lowpart_p (XEXP (x, 0)))
- return SUBREG_REG (XEXP (x, 0));
-
- /* If we know that the value is already truncated, we can
- replace the TRUNCATE with a SUBREG. */
- if (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (XEXP (x, 0), GET_MODE (XEXP (x, 0)))
- &~ GET_MODE_MASK (mode)) == 0)
- return gen_lowpart_for_combine (mode, XEXP (x, 0));
-
- /* A truncate of a comparison can be replaced with a subreg if
- STORE_FLAG_VALUE permits. This is like the previous test,
- but it works even if the comparison is done in a mode larger
- than HOST_BITS_PER_WIDE_INT. */
- if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<'
- && ((HOST_WIDE_INT) STORE_FLAG_VALUE &~ GET_MODE_MASK (mode)) == 0)
- return gen_lowpart_for_combine (mode, XEXP (x, 0));
-
- /* Similarly, a truncate of a register whose value is a
- comparison can be replaced with a subreg if STORE_FLAG_VALUE
- permits. */
- if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && ((HOST_WIDE_INT) STORE_FLAG_VALUE &~ GET_MODE_MASK (mode)) == 0
- && (temp = get_last_value (XEXP (x, 0)))
- && GET_RTX_CLASS (GET_CODE (temp)) == '<')
- return gen_lowpart_for_combine (mode, XEXP (x, 0));
-
- break;
-
- case FLOAT_TRUNCATE:
- /* (float_truncate:SF (float_extend:DF foo:SF)) = foo:SF. */
- if (GET_CODE (XEXP (x, 0)) == FLOAT_EXTEND
- && GET_MODE (XEXP (XEXP (x, 0), 0)) == mode)
- return XEXP (XEXP (x, 0), 0);
-
- /* (float_truncate:SF (OP:DF (float_extend:DF foo:sf))) is
- (OP:SF foo:SF) if OP is NEG or ABS. */
- if ((GET_CODE (XEXP (x, 0)) == ABS
- || GET_CODE (XEXP (x, 0)) == NEG)
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == FLOAT_EXTEND
- && GET_MODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == mode)
- return gen_unary (GET_CODE (XEXP (x, 0)), mode, mode,
- XEXP (XEXP (XEXP (x, 0), 0), 0));
-
- /* (float_truncate:SF (subreg:DF (float_truncate:SF X) 0))
- is (float_truncate:SF x). */
- if (GET_CODE (XEXP (x, 0)) == SUBREG
- && subreg_lowpart_p (XEXP (x, 0))
- && GET_CODE (SUBREG_REG (XEXP (x, 0))) == FLOAT_TRUNCATE)
- return SUBREG_REG (XEXP (x, 0));
- break;
-
-#ifdef HAVE_cc0
- case COMPARE:
- /* Convert (compare FOO (const_int 0)) to FOO unless we aren't
- using cc0, in which case we want to leave it as a COMPARE
- so we can distinguish it from a register-register-copy. */
- if (XEXP (x, 1) == const0_rtx)
- return XEXP (x, 0);
-
- /* In IEEE floating point, x-0 is not the same as x. */
- if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || ! FLOAT_MODE_P (GET_MODE (XEXP (x, 0)))
- || flag_fast_math)
- && XEXP (x, 1) == CONST0_RTX (GET_MODE (XEXP (x, 0))))
- return XEXP (x, 0);
- break;
-#endif
-
- case CONST:
- /* (const (const X)) can become (const X). Do it this way rather than
- returning the inner CONST since CONST can be shared with a
- REG_EQUAL note. */
- if (GET_CODE (XEXP (x, 0)) == CONST)
- SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0));
- break;
-
-#ifdef HAVE_lo_sum
- case LO_SUM:
- /* Convert (lo_sum (high FOO) FOO) to FOO. This is necessary so we
- can add in an offset. find_split_point will split this address up
- again if it doesn't match. */
- if (GET_CODE (XEXP (x, 0)) == HIGH
- && rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1)))
- return XEXP (x, 1);
- break;
-#endif
-
- case PLUS:
- /* If we have (plus (plus (A const) B)), associate it so that CONST is
- outermost. That's because that's the way indexed addresses are
- supposed to appear. This code used to check many more cases, but
- they are now checked elsewhere. */
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
- return gen_binary (PLUS, mode,
- gen_binary (PLUS, mode, XEXP (XEXP (x, 0), 0),
- XEXP (x, 1)),
- XEXP (XEXP (x, 0), 1));
-
- /* (plus (xor (and <foo> (const_int pow2 - 1)) <c>) <-c>)
- when c is (const_int (pow2 + 1) / 2) is a sign extension of a
- bit-field and can be replaced by either a sign_extend or a
- sign_extract. The `and' may be a zero_extend. */
- if (GET_CODE (XEXP (x, 0)) == XOR
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) == - INTVAL (XEXP (XEXP (x, 0), 1))
- && (i = exact_log2 (INTVAL (XEXP (XEXP (x, 0), 1)))) >= 0
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && ((GET_CODE (XEXP (XEXP (x, 0), 0)) == AND
- && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == CONST_INT
- && (INTVAL (XEXP (XEXP (XEXP (x, 0), 0), 1))
- == ((HOST_WIDE_INT) 1 << (i + 1)) - 1))
- || (GET_CODE (XEXP (XEXP (x, 0), 0)) == ZERO_EXTEND
- && (GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (XEXP (x, 0), 0), 0)))
- == i + 1))))
- return simplify_shift_const
- (NULL_RTX, ASHIFTRT, mode,
- simplify_shift_const (NULL_RTX, ASHIFT, mode,
- XEXP (XEXP (XEXP (x, 0), 0), 0),
- GET_MODE_BITSIZE (mode) - (i + 1)),
- GET_MODE_BITSIZE (mode) - (i + 1));
-
- /* (plus (comparison A B) C) can become (neg (rev-comp A B)) if
- C is 1 and STORE_FLAG_VALUE is -1 or if C is -1 and STORE_FLAG_VALUE
- is 1. This produces better code than the alternative immediately
- below. */
- if (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<'
- && reversible_comparison_p (XEXP (x, 0))
- && ((STORE_FLAG_VALUE == -1 && XEXP (x, 1) == const1_rtx)
- || (STORE_FLAG_VALUE == 1 && XEXP (x, 1) == constm1_rtx)))
- return
- gen_unary (NEG, mode, mode,
- gen_binary (reverse_condition (GET_CODE (XEXP (x, 0))),
- mode, XEXP (XEXP (x, 0), 0),
- XEXP (XEXP (x, 0), 1)));
-
- /* If only the low-order bit of X is possibly nonzero, (plus x -1)
- can become (ashiftrt (ashift (xor x 1) C) C) where C is
- the bitsize of the mode - 1. This allows simplification of
- "a = (b & 8) == 0;" */
- if (XEXP (x, 1) == constm1_rtx
- && GET_CODE (XEXP (x, 0)) != REG
- && ! (GET_CODE (XEXP (x,0)) == SUBREG
- && GET_CODE (SUBREG_REG (XEXP (x, 0))) == REG)
- && nonzero_bits (XEXP (x, 0), mode) == 1)
- return simplify_shift_const (NULL_RTX, ASHIFTRT, mode,
- simplify_shift_const (NULL_RTX, ASHIFT, mode,
- gen_rtx_combine (XOR, mode,
- XEXP (x, 0), const1_rtx),
- GET_MODE_BITSIZE (mode) - 1),
- GET_MODE_BITSIZE (mode) - 1);
-
- /* If we are adding two things that have no bits in common, convert
- the addition into an IOR. This will often be further simplified,
- for example in cases like ((a & 1) + (a & 2)), which can
- become a & 3. */
-
- if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (XEXP (x, 0), mode)
- & nonzero_bits (XEXP (x, 1), mode)) == 0)
- return gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1));
- break;
-
- case MINUS:
- /* If STORE_FLAG_VALUE is 1, (minus 1 (comparison foo bar)) can be done
- by reversing the comparison code if valid. */
- if (STORE_FLAG_VALUE == 1
- && XEXP (x, 0) == const1_rtx
- && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) == '<'
- && reversible_comparison_p (XEXP (x, 1)))
- return gen_binary (reverse_condition (GET_CODE (XEXP (x, 1))),
- mode, XEXP (XEXP (x, 1), 0),
- XEXP (XEXP (x, 1), 1));
-
- /* (minus <foo> (and <foo> (const_int -pow2))) becomes
- (and <foo> (const_int pow2-1)) */
- if (GET_CODE (XEXP (x, 1)) == AND
- && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT
- && exact_log2 (- INTVAL (XEXP (XEXP (x, 1), 1))) >= 0
- && rtx_equal_p (XEXP (XEXP (x, 1), 0), XEXP (x, 0)))
- return simplify_and_const_int (NULL_RTX, mode, XEXP (x, 0),
- - INTVAL (XEXP (XEXP (x, 1), 1)) - 1);
-
- /* Canonicalize (minus A (plus B C)) to (minus (minus A B) C) for
- integers. */
- if (GET_CODE (XEXP (x, 1)) == PLUS && INTEGRAL_MODE_P (mode))
- return gen_binary (MINUS, mode,
- gen_binary (MINUS, mode, XEXP (x, 0),
- XEXP (XEXP (x, 1), 0)),
- XEXP (XEXP (x, 1), 1));
- break;
-
- case MULT:
- /* If we have (mult (plus A B) C), apply the distributive law and then
- the inverse distributive law to see if things simplify. This
- occurs mostly in addresses, often when unrolling loops. */
-
- if (GET_CODE (XEXP (x, 0)) == PLUS)
- {
- x = apply_distributive_law
- (gen_binary (PLUS, mode,
- gen_binary (MULT, mode,
- XEXP (XEXP (x, 0), 0), XEXP (x, 1)),
- gen_binary (MULT, mode,
- XEXP (XEXP (x, 0), 1), XEXP (x, 1))));
-
- if (GET_CODE (x) != MULT)
- return x;
- }
- break;
-
- case UDIV:
- /* If this is a divide by a power of two, treat it as a shift if
- its first operand is a shift. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && (i = exact_log2 (INTVAL (XEXP (x, 1)))) >= 0
- && (GET_CODE (XEXP (x, 0)) == ASHIFT
- || GET_CODE (XEXP (x, 0)) == LSHIFTRT
- || GET_CODE (XEXP (x, 0)) == ASHIFTRT
- || GET_CODE (XEXP (x, 0)) == ROTATE
- || GET_CODE (XEXP (x, 0)) == ROTATERT))
- return simplify_shift_const (NULL_RTX, LSHIFTRT, mode, XEXP (x, 0), i);
- break;
-
- case EQ: case NE:
- case GT: case GTU: case GE: case GEU:
- case LT: case LTU: case LE: case LEU:
- /* If the first operand is a condition code, we can't do anything
- with it. */
- if (GET_CODE (XEXP (x, 0)) == COMPARE
- || (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC
-#ifdef HAVE_cc0
- && XEXP (x, 0) != cc0_rtx
-#endif
- ))
- {
- rtx op0 = XEXP (x, 0);
- rtx op1 = XEXP (x, 1);
- enum rtx_code new_code;
-
- if (GET_CODE (op0) == COMPARE)
- op1 = XEXP (op0, 1), op0 = XEXP (op0, 0);
-
- /* Simplify our comparison, if possible. */
- new_code = simplify_comparison (code, &op0, &op1);
-
- /* If STORE_FLAG_VALUE is 1, we can convert (ne x 0) to simply X
- if only the low-order bit is possibly nonzero in X (such as when
- X is a ZERO_EXTRACT of one bit). Similarly, we can convert EQ to
- (xor X 1) or (minus 1 X); we use the former. Finally, if X is
- known to be either 0 or -1, NE becomes a NEG and EQ becomes
- (plus X 1).
-
- Remove any ZERO_EXTRACT we made when thinking this was a
- comparison. It may now be simpler to use, e.g., an AND. If a
- ZERO_EXTRACT is indeed appropriate, it will be placed back by
- the call to make_compound_operation in the SET case. */
-
- if (STORE_FLAG_VALUE == 1
- && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
- && op1 == const0_rtx && nonzero_bits (op0, mode) == 1)
- return gen_lowpart_for_combine (mode,
- expand_compound_operation (op0));
-
- else if (STORE_FLAG_VALUE == 1
- && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
- && op1 == const0_rtx
- && (num_sign_bit_copies (op0, mode)
- == GET_MODE_BITSIZE (mode)))
- {
- op0 = expand_compound_operation (op0);
- return gen_unary (NEG, mode, mode,
- gen_lowpart_for_combine (mode, op0));
- }
-
- else if (STORE_FLAG_VALUE == 1
- && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT
- && op1 == const0_rtx
- && nonzero_bits (op0, mode) == 1)
- {
- op0 = expand_compound_operation (op0);
- return gen_binary (XOR, mode,
- gen_lowpart_for_combine (mode, op0),
- const1_rtx);
- }
-
- else if (STORE_FLAG_VALUE == 1
- && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT
- && op1 == const0_rtx
- && (num_sign_bit_copies (op0, mode)
- == GET_MODE_BITSIZE (mode)))
- {
- op0 = expand_compound_operation (op0);
- return plus_constant (gen_lowpart_for_combine (mode, op0), 1);
- }
-
- /* If STORE_FLAG_VALUE is -1, we have cases similar to
- those above. */
- if (STORE_FLAG_VALUE == -1
- && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
- && op1 == const0_rtx
- && (num_sign_bit_copies (op0, mode)
- == GET_MODE_BITSIZE (mode)))
- return gen_lowpart_for_combine (mode,
- expand_compound_operation (op0));
-
- else if (STORE_FLAG_VALUE == -1
- && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
- && op1 == const0_rtx
- && nonzero_bits (op0, mode) == 1)
- {
- op0 = expand_compound_operation (op0);
- return gen_unary (NEG, mode, mode,
- gen_lowpart_for_combine (mode, op0));
- }
-
- else if (STORE_FLAG_VALUE == -1
- && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT
- && op1 == const0_rtx
- && (num_sign_bit_copies (op0, mode)
- == GET_MODE_BITSIZE (mode)))
- {
- op0 = expand_compound_operation (op0);
- return gen_unary (NOT, mode, mode,
- gen_lowpart_for_combine (mode, op0));
- }
-
- /* If X is 0/1, (eq X 0) is X-1. */
- else if (STORE_FLAG_VALUE == -1
- && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT
- && op1 == const0_rtx
- && nonzero_bits (op0, mode) == 1)
- {
- op0 = expand_compound_operation (op0);
- return plus_constant (gen_lowpart_for_combine (mode, op0), -1);
- }
-
- /* If STORE_FLAG_VALUE says to just test the sign bit and X has just
- one bit that might be nonzero, we can convert (ne x 0) to
- (ashift x c) where C puts the bit in the sign bit. Remove any
- AND with STORE_FLAG_VALUE when we are done, since we are only
- going to test the sign bit. */
- if (new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && ((STORE_FLAG_VALUE & GET_MODE_MASK (mode))
- == (HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (mode) - 1))
- && op1 == const0_rtx
- && mode == GET_MODE (op0)
- && (i = exact_log2 (nonzero_bits (op0, mode))) >= 0)
- {
- x = simplify_shift_const (NULL_RTX, ASHIFT, mode,
- expand_compound_operation (op0),
- GET_MODE_BITSIZE (mode) - 1 - i);
- if (GET_CODE (x) == AND && XEXP (x, 1) == const_true_rtx)
- return XEXP (x, 0);
- else
- return x;
- }
-
- /* If the code changed, return a whole new comparison. */
- if (new_code != code)
- return gen_rtx_combine (new_code, mode, op0, op1);
-
- /* Otherwise, keep this operation, but maybe change its operands.
- This also converts (ne (compare FOO BAR) 0) to (ne FOO BAR). */
- SUBST (XEXP (x, 0), op0);
- SUBST (XEXP (x, 1), op1);
- }
- break;
-
- case IF_THEN_ELSE:
- return simplify_if_then_else (x);
-
- case ZERO_EXTRACT:
- case SIGN_EXTRACT:
- case ZERO_EXTEND:
- case SIGN_EXTEND:
- /* If we are processing SET_DEST, we are done. */
- if (in_dest)
- return x;
-
- return expand_compound_operation (x);
-
- case SET:
- return simplify_set (x);
-
- case AND:
- case IOR:
- case XOR:
- return simplify_logical (x, last);
-
- case ABS:
- /* (abs (neg <foo>)) -> (abs <foo>) */
- if (GET_CODE (XEXP (x, 0)) == NEG)
- SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0));
-
- /* If operand is something known to be positive, ignore the ABS. */
- if (GET_CODE (XEXP (x, 0)) == FFS || GET_CODE (XEXP (x, 0)) == ABS
- || ((GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))
- <= HOST_BITS_PER_WIDE_INT)
- && ((nonzero_bits (XEXP (x, 0), GET_MODE (XEXP (x, 0)))
- & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - 1)))
- == 0)))
- return XEXP (x, 0);
-
-
- /* If operand is known to be only -1 or 0, convert ABS to NEG. */
- if (num_sign_bit_copies (XEXP (x, 0), mode) == GET_MODE_BITSIZE (mode))
- return gen_rtx_combine (NEG, mode, XEXP (x, 0));
-
- break;
-
- case FFS:
- /* (ffs (*_extend <X>)) = (ffs <X>) */
- if (GET_CODE (XEXP (x, 0)) == SIGN_EXTEND
- || GET_CODE (XEXP (x, 0)) == ZERO_EXTEND)
- SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0));
- break;
-
- case FLOAT:
- /* (float (sign_extend <X>)) = (float <X>). */
- if (GET_CODE (XEXP (x, 0)) == SIGN_EXTEND)
- SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0));
- break;
-
- case ASHIFT:
- case LSHIFTRT:
- case ASHIFTRT:
- case ROTATE:
- case ROTATERT:
- /* If this is a shift by a constant amount, simplify it. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- return simplify_shift_const (x, code, mode, XEXP (x, 0),
- INTVAL (XEXP (x, 1)));
-
-#ifdef SHIFT_COUNT_TRUNCATED
- else if (SHIFT_COUNT_TRUNCATED && GET_CODE (XEXP (x, 1)) != REG)
- SUBST (XEXP (x, 1),
- force_to_mode (XEXP (x, 1), GET_MODE (x),
- ((HOST_WIDE_INT) 1
- << exact_log2 (GET_MODE_BITSIZE (GET_MODE (x))))
- - 1,
- NULL_RTX, 0));
-#endif
-
- break;
- }
-
- return x;
-}
-
-/* Simplify X, an IF_THEN_ELSE expression. Return the new expression. */
-
-static rtx
-simplify_if_then_else (x)
- rtx x;
-{
- enum machine_mode mode = GET_MODE (x);
- rtx cond = XEXP (x, 0);
- rtx true = XEXP (x, 1);
- rtx false = XEXP (x, 2);
- enum rtx_code true_code = GET_CODE (cond);
- int comparison_p = GET_RTX_CLASS (true_code) == '<';
- rtx temp;
- int i;
-
- /* Simplify storing of the truth value. */
- if (comparison_p && true == const_true_rtx && false == const0_rtx)
- return gen_binary (true_code, mode, XEXP (cond, 0), XEXP (cond, 1));
-
- /* Also when the truth value has to be reversed. */
- if (comparison_p && reversible_comparison_p (cond)
- && true == const0_rtx && false == const_true_rtx)
- return gen_binary (reverse_condition (true_code),
- mode, XEXP (cond, 0), XEXP (cond, 1));
-
- /* Sometimes we can simplify the arm of an IF_THEN_ELSE if a register used
- in it is being compared against certain values. Get the true and false
- comparisons and see if that says anything about the value of each arm. */
-
- if (comparison_p && reversible_comparison_p (cond)
- && GET_CODE (XEXP (cond, 0)) == REG)
- {
- HOST_WIDE_INT nzb;
- rtx from = XEXP (cond, 0);
- enum rtx_code false_code = reverse_condition (true_code);
- rtx true_val = XEXP (cond, 1);
- rtx false_val = true_val;
- int swapped = 0;
-
- /* If FALSE_CODE is EQ, swap the codes and arms. */
-
- if (false_code == EQ)
- {
- swapped = 1, true_code = EQ, false_code = NE;
- temp = true, true = false, false = temp;
- }
-
- /* If we are comparing against zero and the expression being tested has
- only a single bit that might be nonzero, that is its value when it is
- not equal to zero. Similarly if it is known to be -1 or 0. */
-
- if (true_code == EQ && true_val == const0_rtx
- && exact_log2 (nzb = nonzero_bits (from, GET_MODE (from))) >= 0)
- false_code = EQ, false_val = GEN_INT (nzb);
- else if (true_code == EQ && true_val == const0_rtx
- && (num_sign_bit_copies (from, GET_MODE (from))
- == GET_MODE_BITSIZE (GET_MODE (from))))
- false_code = EQ, false_val = constm1_rtx;
-
- /* Now simplify an arm if we know the value of the register in the
- branch and it is used in the arm. Be careful due to the potential
- of locally-shared RTL. */
-
- if (reg_mentioned_p (from, true))
- true = subst (known_cond (copy_rtx (true), true_code, from, true_val),
- pc_rtx, pc_rtx, 0, 0);
- if (reg_mentioned_p (from, false))
- false = subst (known_cond (copy_rtx (false), false_code,
- from, false_val),
- pc_rtx, pc_rtx, 0, 0);
-
- SUBST (XEXP (x, 1), swapped ? false : true);
- SUBST (XEXP (x, 2), swapped ? true : false);
-
- true = XEXP (x, 1), false = XEXP (x, 2), true_code = GET_CODE (cond);
- }
-
- /* If we have (if_then_else FOO (pc) (label_ref BAR)) and FOO can be
- reversed, do so to avoid needing two sets of patterns for
- subtract-and-branch insns. Similarly if we have a constant in the true
- arm, the false arm is the same as the first operand of the comparison, or
- the false arm is more complicated than the true arm. */
-
- if (comparison_p && reversible_comparison_p (cond)
- && (true == pc_rtx
- || (CONSTANT_P (true)
- && GET_CODE (false) != CONST_INT && false != pc_rtx)
- || true == const0_rtx
- || (GET_RTX_CLASS (GET_CODE (true)) == 'o'
- && GET_RTX_CLASS (GET_CODE (false)) != 'o')
- || (GET_CODE (true) == SUBREG
- && GET_RTX_CLASS (GET_CODE (SUBREG_REG (true))) == 'o'
- && GET_RTX_CLASS (GET_CODE (false)) != 'o')
- || reg_mentioned_p (true, false)
- || rtx_equal_p (false, XEXP (cond, 0))))
- {
- true_code = reverse_condition (true_code);
- SUBST (XEXP (x, 0),
- gen_binary (true_code, GET_MODE (cond), XEXP (cond, 0),
- XEXP (cond, 1)));
-
- SUBST (XEXP (x, 1), false);
- SUBST (XEXP (x, 2), true);
-
- temp = true, true = false, false = temp, cond = XEXP (x, 0);
-
- /* It is possible that the conditional has been simplified out. */
- true_code = GET_CODE (cond);
- comparison_p = GET_RTX_CLASS (true_code) == '<';
- }
-
- /* If the two arms are identical, we don't need the comparison. */
-
- if (rtx_equal_p (true, false) && ! side_effects_p (cond))
- return true;
-
- /* Convert a == b ? b : a to "a". */
- if (true_code == EQ && ! side_effects_p (cond)
- && rtx_equal_p (XEXP (cond, 0), false)
- && rtx_equal_p (XEXP (cond, 1), true))
- return false;
- else if (true_code == NE && ! side_effects_p (cond)
- && rtx_equal_p (XEXP (cond, 0), true)
- && rtx_equal_p (XEXP (cond, 1), false))
- return true;
-
- /* Look for cases where we have (abs x) or (neg (abs X)). */
-
- if (GET_MODE_CLASS (mode) == MODE_INT
- && GET_CODE (false) == NEG
- && rtx_equal_p (true, XEXP (false, 0))
- && comparison_p
- && rtx_equal_p (true, XEXP (cond, 0))
- && ! side_effects_p (true))
- switch (true_code)
- {
- case GT:
- case GE:
- return gen_unary (ABS, mode, mode, true);
- case LT:
- case LE:
- return gen_unary (NEG, mode, mode, gen_unary (ABS, mode, mode, true));
- }
-
- /* Look for MIN or MAX. */
-
- if ((! FLOAT_MODE_P (mode) || flag_fast_math)
- && comparison_p
- && rtx_equal_p (XEXP (cond, 0), true)
- && rtx_equal_p (XEXP (cond, 1), false)
- && ! side_effects_p (cond))
- switch (true_code)
- {
- case GE:
- case GT:
- return gen_binary (SMAX, mode, true, false);
- case LE:
- case LT:
- return gen_binary (SMIN, mode, true, false);
- case GEU:
- case GTU:
- return gen_binary (UMAX, mode, true, false);
- case LEU:
- case LTU:
- return gen_binary (UMIN, mode, true, false);
- }
-
- /* If we have (if_then_else COND (OP Z C1) Z) and OP is an identity when its
- second operand is zero, this can be done as (OP Z (mult COND C2)) where
- C2 = C1 * STORE_FLAG_VALUE. Similarly if OP has an outer ZERO_EXTEND or
- SIGN_EXTEND as long as Z is already extended (so we don't destroy it).
- We can do this kind of thing in some cases when STORE_FLAG_VALUE is
- neither 1 or -1, but it isn't worth checking for. */
-
- if ((STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1)
- && comparison_p && mode != VOIDmode && ! side_effects_p (x))
- {
- rtx t = make_compound_operation (true, SET);
- rtx f = make_compound_operation (false, SET);
- rtx cond_op0 = XEXP (cond, 0);
- rtx cond_op1 = XEXP (cond, 1);
- enum rtx_code op, extend_op = NIL;
- enum machine_mode m = mode;
- rtx z = 0, c1;
-
- if ((GET_CODE (t) == PLUS || GET_CODE (t) == MINUS
- || GET_CODE (t) == IOR || GET_CODE (t) == XOR
- || GET_CODE (t) == ASHIFT
- || GET_CODE (t) == LSHIFTRT || GET_CODE (t) == ASHIFTRT)
- && rtx_equal_p (XEXP (t, 0), f))
- c1 = XEXP (t, 1), op = GET_CODE (t), z = f;
-
- /* If an identity-zero op is commutative, check whether there
- would be a match if we swapped the operands. */
- else if ((GET_CODE (t) == PLUS || GET_CODE (t) == IOR
- || GET_CODE (t) == XOR)
- && rtx_equal_p (XEXP (t, 1), f))
- c1 = XEXP (t, 0), op = GET_CODE (t), z = f;
- else if (GET_CODE (t) == SIGN_EXTEND
- && (GET_CODE (XEXP (t, 0)) == PLUS
- || GET_CODE (XEXP (t, 0)) == MINUS
- || GET_CODE (XEXP (t, 0)) == IOR
- || GET_CODE (XEXP (t, 0)) == XOR
- || GET_CODE (XEXP (t, 0)) == ASHIFT
- || GET_CODE (XEXP (t, 0)) == LSHIFTRT
- || GET_CODE (XEXP (t, 0)) == ASHIFTRT)
- && GET_CODE (XEXP (XEXP (t, 0), 0)) == SUBREG
- && subreg_lowpart_p (XEXP (XEXP (t, 0), 0))
- && rtx_equal_p (SUBREG_REG (XEXP (XEXP (t, 0), 0)), f)
- && (num_sign_bit_copies (f, GET_MODE (f))
- > (GET_MODE_BITSIZE (mode)
- - GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (t, 0), 0))))))
- {
- c1 = XEXP (XEXP (t, 0), 1); z = f; op = GET_CODE (XEXP (t, 0));
- extend_op = SIGN_EXTEND;
- m = GET_MODE (XEXP (t, 0));
- }
- else if (GET_CODE (t) == SIGN_EXTEND
- && (GET_CODE (XEXP (t, 0)) == PLUS
- || GET_CODE (XEXP (t, 0)) == IOR
- || GET_CODE (XEXP (t, 0)) == XOR)
- && GET_CODE (XEXP (XEXP (t, 0), 1)) == SUBREG
- && subreg_lowpart_p (XEXP (XEXP (t, 0), 1))
- && rtx_equal_p (SUBREG_REG (XEXP (XEXP (t, 0), 1)), f)
- && (num_sign_bit_copies (f, GET_MODE (f))
- > (GET_MODE_BITSIZE (mode)
- - GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (t, 0), 1))))))
- {
- c1 = XEXP (XEXP (t, 0), 0); z = f; op = GET_CODE (XEXP (t, 0));
- extend_op = SIGN_EXTEND;
- m = GET_MODE (XEXP (t, 0));
- }
- else if (GET_CODE (t) == ZERO_EXTEND
- && (GET_CODE (XEXP (t, 0)) == PLUS
- || GET_CODE (XEXP (t, 0)) == MINUS
- || GET_CODE (XEXP (t, 0)) == IOR
- || GET_CODE (XEXP (t, 0)) == XOR
- || GET_CODE (XEXP (t, 0)) == ASHIFT
- || GET_CODE (XEXP (t, 0)) == LSHIFTRT
- || GET_CODE (XEXP (t, 0)) == ASHIFTRT)
- && GET_CODE (XEXP (XEXP (t, 0), 0)) == SUBREG
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && subreg_lowpart_p (XEXP (XEXP (t, 0), 0))
- && rtx_equal_p (SUBREG_REG (XEXP (XEXP (t, 0), 0)), f)
- && ((nonzero_bits (f, GET_MODE (f))
- & ~ GET_MODE_MASK (GET_MODE (XEXP (XEXP (t, 0), 0))))
- == 0))
- {
- c1 = XEXP (XEXP (t, 0), 1); z = f; op = GET_CODE (XEXP (t, 0));
- extend_op = ZERO_EXTEND;
- m = GET_MODE (XEXP (t, 0));
- }
- else if (GET_CODE (t) == ZERO_EXTEND
- && (GET_CODE (XEXP (t, 0)) == PLUS
- || GET_CODE (XEXP (t, 0)) == IOR
- || GET_CODE (XEXP (t, 0)) == XOR)
- && GET_CODE (XEXP (XEXP (t, 0), 1)) == SUBREG
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && subreg_lowpart_p (XEXP (XEXP (t, 0), 1))
- && rtx_equal_p (SUBREG_REG (XEXP (XEXP (t, 0), 1)), f)
- && ((nonzero_bits (f, GET_MODE (f))
- & ~ GET_MODE_MASK (GET_MODE (XEXP (XEXP (t, 0), 1))))
- == 0))
- {
- c1 = XEXP (XEXP (t, 0), 0); z = f; op = GET_CODE (XEXP (t, 0));
- extend_op = ZERO_EXTEND;
- m = GET_MODE (XEXP (t, 0));
- }
-
- if (z)
- {
- temp = subst (gen_binary (true_code, m, cond_op0, cond_op1),
- pc_rtx, pc_rtx, 0, 0);
- temp = gen_binary (MULT, m, temp,
- gen_binary (MULT, m, c1, const_true_rtx));
- temp = subst (temp, pc_rtx, pc_rtx, 0, 0);
- temp = gen_binary (op, m, gen_lowpart_for_combine (m, z), temp);
-
- if (extend_op != NIL)
- temp = gen_unary (extend_op, mode, m, temp);
-
- return temp;
- }
- }
-
- /* If we have (if_then_else (ne A 0) C1 0) and either A is known to be 0 or
- 1 and C1 is a single bit or A is known to be 0 or -1 and C1 is the
- negation of a single bit, we can convert this operation to a shift. We
- can actually do this more generally, but it doesn't seem worth it. */
-
- if (true_code == NE && XEXP (cond, 1) == const0_rtx
- && false == const0_rtx && GET_CODE (true) == CONST_INT
- && ((1 == nonzero_bits (XEXP (cond, 0), mode)
- && (i = exact_log2 (INTVAL (true))) >= 0)
- || ((num_sign_bit_copies (XEXP (cond, 0), mode)
- == GET_MODE_BITSIZE (mode))
- && (i = exact_log2 (- INTVAL (true))) >= 0)))
- return
- simplify_shift_const (NULL_RTX, ASHIFT, mode,
- gen_lowpart_for_combine (mode, XEXP (cond, 0)), i);
-
- return x;
-}
-
-/* Simplify X, a SET expression. Return the new expression. */
-
-static rtx
-simplify_set (x)
- rtx x;
-{
- rtx src = SET_SRC (x);
- rtx dest = SET_DEST (x);
- enum machine_mode mode
- = GET_MODE (src) != VOIDmode ? GET_MODE (src) : GET_MODE (dest);
- rtx other_insn;
- rtx *cc_use;
-
- /* (set (pc) (return)) gets written as (return). */
- if (GET_CODE (dest) == PC && GET_CODE (src) == RETURN)
- return src;
-
- /* Now that we know for sure which bits of SRC we are using, see if we can
- simplify the expression for the object knowing that we only need the
- low-order bits. */
-
- if (GET_MODE_CLASS (mode) == MODE_INT)
- src = force_to_mode (src, mode, GET_MODE_MASK (mode), NULL_RTX, 0);
-
- /* If we are setting CC0 or if the source is a COMPARE, look for the use of
- the comparison result and try to simplify it unless we already have used
- undobuf.other_insn. */
- if ((GET_CODE (src) == COMPARE
-#ifdef HAVE_cc0
- || dest == cc0_rtx
-#endif
- )
- && (cc_use = find_single_use (dest, subst_insn, &other_insn)) != 0
- && (undobuf.other_insn == 0 || other_insn == undobuf.other_insn)
- && GET_RTX_CLASS (GET_CODE (*cc_use)) == '<'
- && rtx_equal_p (XEXP (*cc_use, 0), dest))
- {
- enum rtx_code old_code = GET_CODE (*cc_use);
- enum rtx_code new_code;
- rtx op0, op1;
- int other_changed = 0;
- enum machine_mode compare_mode = GET_MODE (dest);
-
- if (GET_CODE (src) == COMPARE)
- op0 = XEXP (src, 0), op1 = XEXP (src, 1);
- else
- op0 = src, op1 = const0_rtx;
-
- /* Simplify our comparison, if possible. */
- new_code = simplify_comparison (old_code, &op0, &op1);
-
-#ifdef EXTRA_CC_MODES
- /* If this machine has CC modes other than CCmode, check to see if we
- need to use a different CC mode here. */
- compare_mode = SELECT_CC_MODE (new_code, op0, op1);
-#endif /* EXTRA_CC_MODES */
-
-#if !defined (HAVE_cc0) && defined (EXTRA_CC_MODES)
- /* If the mode changed, we have to change SET_DEST, the mode in the
- compare, and the mode in the place SET_DEST is used. If SET_DEST is
- a hard register, just build new versions with the proper mode. If it
- is a pseudo, we lose unless it is only time we set the pseudo, in
- which case we can safely change its mode. */
- if (compare_mode != GET_MODE (dest))
- {
- int regno = REGNO (dest);
- rtx new_dest = gen_rtx (REG, compare_mode, regno);
-
- if (regno < FIRST_PSEUDO_REGISTER
- || (reg_n_sets[regno] == 1 && ! REG_USERVAR_P (dest)))
- {
- if (regno >= FIRST_PSEUDO_REGISTER)
- SUBST (regno_reg_rtx[regno], new_dest);
-
- SUBST (SET_DEST (x), new_dest);
- SUBST (XEXP (*cc_use, 0), new_dest);
- other_changed = 1;
-
- dest = new_dest;
- }
- }
-#endif
-
- /* If the code changed, we have to build a new comparison in
- undobuf.other_insn. */
- if (new_code != old_code)
- {
- unsigned HOST_WIDE_INT mask;
-
- SUBST (*cc_use, gen_rtx_combine (new_code, GET_MODE (*cc_use),
- dest, const0_rtx));
-
- /* If the only change we made was to change an EQ into an NE or
- vice versa, OP0 has only one bit that might be nonzero, and OP1
- is zero, check if changing the user of the condition code will
- produce a valid insn. If it won't, we can keep the original code
- in that insn by surrounding our operation with an XOR. */
-
- if (((old_code == NE && new_code == EQ)
- || (old_code == EQ && new_code == NE))
- && ! other_changed && op1 == const0_rtx
- && GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT
- && exact_log2 (mask = nonzero_bits (op0, GET_MODE (op0))) >= 0)
- {
- rtx pat = PATTERN (other_insn), note = 0;
- int scratches;
-
- if ((recog_for_combine (&pat, other_insn, &note, &scratches) < 0
- && ! check_asm_operands (pat)))
- {
- PUT_CODE (*cc_use, old_code);
- other_insn = 0;
-
- op0 = gen_binary (XOR, GET_MODE (op0), op0, GEN_INT (mask));
- }
- }
-
- other_changed = 1;
- }
-
- if (other_changed)
- undobuf.other_insn = other_insn;
-
-#ifdef HAVE_cc0
- /* If we are now comparing against zero, change our source if
- needed. If we do not use cc0, we always have a COMPARE. */
- if (op1 == const0_rtx && dest == cc0_rtx)
- {
- SUBST (SET_SRC (x), op0);
- src = op0;
- }
- else
-#endif
-
- /* Otherwise, if we didn't previously have a COMPARE in the
- correct mode, we need one. */
- if (GET_CODE (src) != COMPARE || GET_MODE (src) != compare_mode)
- {
- SUBST (SET_SRC (x),
- gen_rtx_combine (COMPARE, compare_mode, op0, op1));
- src = SET_SRC (x);
- }
- else
- {
- /* Otherwise, update the COMPARE if needed. */
- SUBST (XEXP (src, 0), op0);
- SUBST (XEXP (src, 1), op1);
- }
- }
- else
- {
- /* Get SET_SRC in a form where we have placed back any
- compound expressions. Then do the checks below. */
- src = make_compound_operation (src, SET);
- SUBST (SET_SRC (x), src);
- }
-
- /* If we have (set x (subreg:m1 (op:m2 ...) 0)) with OP being some operation,
- and X being a REG or (subreg (reg)), we may be able to convert this to
- (set (subreg:m2 x) (op)).
-
- We can always do this if M1 is narrower than M2 because that means that
- we only care about the low bits of the result.
-
- However, on machines without WORD_REGISTER_OPERATIONS defined, we cannot
- perform a narrower operation that requested since the high-order bits will
- be undefined. On machine where it is defined, this transformation is safe
- as long as M1 and M2 have the same number of words. */
-
- if (GET_CODE (src) == SUBREG && subreg_lowpart_p (src)
- && GET_RTX_CLASS (GET_CODE (SUBREG_REG (src))) != 'o'
- && (((GET_MODE_SIZE (GET_MODE (src)) + (UNITS_PER_WORD - 1))
- / UNITS_PER_WORD)
- == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (src)))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD))
-#ifndef WORD_REGISTER_OPERATIONS
- && (GET_MODE_SIZE (GET_MODE (src))
- < GET_MODE_SIZE (GET_MODE (SUBREG_REG (src))))
-#endif
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- && ! (GET_CODE (dest) == REG && REGNO (dest) < FIRST_PSEUDO_REGISTER
- && (TEST_HARD_REG_BIT
- (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE],
- REGNO (dest)))
- && (GET_MODE_SIZE (GET_MODE (src))
- != GET_MODE_SIZE (GET_MODE (SUBREG_REG (src)))))
-#endif
- && (GET_CODE (dest) == REG
- || (GET_CODE (dest) == SUBREG
- && GET_CODE (SUBREG_REG (dest)) == REG)))
- {
- SUBST (SET_DEST (x),
- gen_lowpart_for_combine (GET_MODE (SUBREG_REG (src)),
- dest));
- SUBST (SET_SRC (x), SUBREG_REG (src));
-
- src = SET_SRC (x), dest = SET_DEST (x);
- }
-
-#ifdef LOAD_EXTEND_OP
- /* If we have (set FOO (subreg:M (mem:N BAR) 0)) with M wider than N, this
- would require a paradoxical subreg. Replace the subreg with a
- zero_extend to avoid the reload that would otherwise be required. */
-
- if (GET_CODE (src) == SUBREG && subreg_lowpart_p (src)
- && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (src))) != NIL
- && SUBREG_WORD (src) == 0
- && (GET_MODE_SIZE (GET_MODE (src))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (src))))
- && GET_CODE (SUBREG_REG (src)) == MEM)
- {
- SUBST (SET_SRC (x),
- gen_rtx_combine (LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (src))),
- GET_MODE (src), XEXP (src, 0)));
-
- src = SET_SRC (x);
- }
-#endif
-
- /* If we don't have a conditional move, SET_SRC is an IF_THEN_ELSE, and we
- are comparing an item known to be 0 or -1 against 0, use a logical
- operation instead. Check for one of the arms being an IOR of the other
- arm with some value. We compute three terms to be IOR'ed together. In
- practice, at most two will be nonzero. Then we do the IOR's. */
-
- if (GET_CODE (dest) != PC
- && GET_CODE (src) == IF_THEN_ELSE
- && GET_MODE_CLASS (GET_MODE (src)) == MODE_INT
- && (GET_CODE (XEXP (src, 0)) == EQ || GET_CODE (XEXP (src, 0)) == NE)
- && XEXP (XEXP (src, 0), 1) == const0_rtx
- && GET_MODE (src) == GET_MODE (XEXP (XEXP (src, 0), 0))
-#ifdef HAVE_conditional_move
- && ! can_conditionally_move_p (GET_MODE (src))
-#endif
- && (num_sign_bit_copies (XEXP (XEXP (src, 0), 0),
- GET_MODE (XEXP (XEXP (src, 0), 0)))
- == GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (src, 0), 0))))
- && ! side_effects_p (src))
- {
- rtx true = (GET_CODE (XEXP (src, 0)) == NE
- ? XEXP (src, 1) : XEXP (src, 2));
- rtx false = (GET_CODE (XEXP (src, 0)) == NE
- ? XEXP (src, 2) : XEXP (src, 1));
- rtx term1 = const0_rtx, term2, term3;
-
- if (GET_CODE (true) == IOR && rtx_equal_p (XEXP (true, 0), false))
- term1 = false, true = XEXP (true, 1), false = const0_rtx;
- else if (GET_CODE (true) == IOR
- && rtx_equal_p (XEXP (true, 1), false))
- term1 = false, true = XEXP (true, 0), false = const0_rtx;
- else if (GET_CODE (false) == IOR
- && rtx_equal_p (XEXP (false, 0), true))
- term1 = true, false = XEXP (false, 1), true = const0_rtx;
- else if (GET_CODE (false) == IOR
- && rtx_equal_p (XEXP (false, 1), true))
- term1 = true, false = XEXP (false, 0), true = const0_rtx;
-
- term2 = gen_binary (AND, GET_MODE (src), XEXP (XEXP (src, 0), 0), true);
- term3 = gen_binary (AND, GET_MODE (src),
- gen_unary (NOT, GET_MODE (src), GET_MODE (src),
- XEXP (XEXP (src, 0), 0)),
- false);
-
- SUBST (SET_SRC (x),
- gen_binary (IOR, GET_MODE (src),
- gen_binary (IOR, GET_MODE (src), term1, term2),
- term3));
-
- src = SET_SRC (x);
- }
-
- /* If either SRC or DEST is a CLOBBER of (const_int 0), make this
- whole thing fail. */
- if (GET_CODE (src) == CLOBBER && XEXP (src, 0) == const0_rtx)
- return src;
- else if (GET_CODE (dest) == CLOBBER && XEXP (dest, 0) == const0_rtx)
- return dest;
- else
- /* Convert this into a field assignment operation, if possible. */
- return make_field_assignment (x);
-}
-
-/* Simplify, X, and AND, IOR, or XOR operation, and return the simplified
- result. LAST is nonzero if this is the last retry. */
-
-static rtx
-simplify_logical (x, last)
- rtx x;
- int last;
-{
- enum machine_mode mode = GET_MODE (x);
- rtx op0 = XEXP (x, 0);
- rtx op1 = XEXP (x, 1);
-
- switch (GET_CODE (x))
- {
- case AND:
- /* Convert (A ^ B) & A to A & (~ B) since the latter is often a single
- insn (and may simplify more). */
- if (GET_CODE (op0) == XOR
- && rtx_equal_p (XEXP (op0, 0), op1)
- && ! side_effects_p (op1))
- x = gen_binary (AND, mode,
- gen_unary (NOT, mode, mode, XEXP (op0, 1)), op1);
-
- if (GET_CODE (op0) == XOR
- && rtx_equal_p (XEXP (op0, 1), op1)
- && ! side_effects_p (op1))
- x = gen_binary (AND, mode,
- gen_unary (NOT, mode, mode, XEXP (op0, 0)), op1);
-
- /* Similarly for (~ (A ^ B)) & A. */
- if (GET_CODE (op0) == NOT
- && GET_CODE (XEXP (op0, 0)) == XOR
- && rtx_equal_p (XEXP (XEXP (op0, 0), 0), op1)
- && ! side_effects_p (op1))
- x = gen_binary (AND, mode, XEXP (XEXP (op0, 0), 1), op1);
-
- if (GET_CODE (op0) == NOT
- && GET_CODE (XEXP (op0, 0)) == XOR
- && rtx_equal_p (XEXP (XEXP (op0, 0), 1), op1)
- && ! side_effects_p (op1))
- x = gen_binary (AND, mode, XEXP (XEXP (op0, 0), 0), op1);
-
- if (GET_CODE (op1) == CONST_INT)
- {
- x = simplify_and_const_int (x, mode, op0, INTVAL (op1));
-
- /* If we have (ior (and (X C1) C2)) and the next restart would be
- the last, simplify this by making C1 as small as possible
- and then exit. */
- if (last
- && GET_CODE (x) == IOR && GET_CODE (op0) == AND
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && GET_CODE (op1) == CONST_INT)
- return gen_binary (IOR, mode,
- gen_binary (AND, mode, XEXP (op0, 0),
- GEN_INT (INTVAL (XEXP (op0, 1))
- & ~ INTVAL (op1))), op1);
-
- if (GET_CODE (x) != AND)
- return x;
-
- if (GET_RTX_CLASS (GET_CODE (x)) == 'c'
- || GET_RTX_CLASS (GET_CODE (x)) == '2')
- op0 = XEXP (x, 0), op1 = XEXP (x, 1);
- }
-
- /* Convert (A | B) & A to A. */
- if (GET_CODE (op0) == IOR
- && (rtx_equal_p (XEXP (op0, 0), op1)
- || rtx_equal_p (XEXP (op0, 1), op1))
- && ! side_effects_p (XEXP (op0, 0))
- && ! side_effects_p (XEXP (op0, 1)))
- return op1;
-
- /* In the following group of tests (and those in case IOR below),
- we start with some combination of logical operations and apply
- the distributive law followed by the inverse distributive law.
- Most of the time, this results in no change. However, if some of
- the operands are the same or inverses of each other, simplifications
- will result.
-
- For example, (and (ior A B) (not B)) can occur as the result of
- expanding a bit field assignment. When we apply the distributive
- law to this, we get (ior (and (A (not B))) (and (B (not B)))),
- which then simplifies to (and (A (not B))).
-
- If we have (and (ior A B) C), apply the distributive law and then
- the inverse distributive law to see if things simplify. */
-
- if (GET_CODE (op0) == IOR || GET_CODE (op0) == XOR)
- {
- x = apply_distributive_law
- (gen_binary (GET_CODE (op0), mode,
- gen_binary (AND, mode, XEXP (op0, 0), op1),
- gen_binary (AND, mode, XEXP (op0, 1), op1)));
- if (GET_CODE (x) != AND)
- return x;
- }
-
- if (GET_CODE (op1) == IOR || GET_CODE (op1) == XOR)
- return apply_distributive_law
- (gen_binary (GET_CODE (op1), mode,
- gen_binary (AND, mode, XEXP (op1, 0), op0),
- gen_binary (AND, mode, XEXP (op1, 1), op0)));
-
- /* Similarly, taking advantage of the fact that
- (and (not A) (xor B C)) == (xor (ior A B) (ior A C)) */
-
- if (GET_CODE (op0) == NOT && GET_CODE (op1) == XOR)
- return apply_distributive_law
- (gen_binary (XOR, mode,
- gen_binary (IOR, mode, XEXP (op0, 0), XEXP (op1, 0)),
- gen_binary (IOR, mode, XEXP (op0, 0), XEXP (op1, 1))));
-
- else if (GET_CODE (op1) == NOT && GET_CODE (op0) == XOR)
- return apply_distributive_law
- (gen_binary (XOR, mode,
- gen_binary (IOR, mode, XEXP (op1, 0), XEXP (op0, 0)),
- gen_binary (IOR, mode, XEXP (op1, 0), XEXP (op0, 1))));
- break;
-
- case IOR:
- /* (ior A C) is C if all bits of A that might be nonzero are on in C. */
- if (GET_CODE (op1) == CONST_INT
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (op0, mode) & ~ INTVAL (op1)) == 0)
- return op1;
-
- /* Convert (A & B) | A to A. */
- if (GET_CODE (op0) == AND
- && (rtx_equal_p (XEXP (op0, 0), op1)
- || rtx_equal_p (XEXP (op0, 1), op1))
- && ! side_effects_p (XEXP (op0, 0))
- && ! side_effects_p (XEXP (op0, 1)))
- return op1;
-
- /* If we have (ior (and A B) C), apply the distributive law and then
- the inverse distributive law to see if things simplify. */
-
- if (GET_CODE (op0) == AND)
- {
- x = apply_distributive_law
- (gen_binary (AND, mode,
- gen_binary (IOR, mode, XEXP (op0, 0), op1),
- gen_binary (IOR, mode, XEXP (op0, 1), op1)));
-
- if (GET_CODE (x) != IOR)
- return x;
- }
-
- if (GET_CODE (op1) == AND)
- {
- x = apply_distributive_law
- (gen_binary (AND, mode,
- gen_binary (IOR, mode, XEXP (op1, 0), op0),
- gen_binary (IOR, mode, XEXP (op1, 1), op0)));
-
- if (GET_CODE (x) != IOR)
- return x;
- }
-
- /* Convert (ior (ashift A CX) (lshiftrt A CY)) where CX+CY equals the
- mode size to (rotate A CX). */
-
- if (((GET_CODE (op0) == ASHIFT && GET_CODE (op1) == LSHIFTRT)
- || (GET_CODE (op1) == ASHIFT && GET_CODE (op0) == LSHIFTRT))
- && rtx_equal_p (XEXP (op0, 0), XEXP (op1, 0))
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && GET_CODE (XEXP (op1, 1)) == CONST_INT
- && (INTVAL (XEXP (op0, 1)) + INTVAL (XEXP (op1, 1))
- == GET_MODE_BITSIZE (mode)))
- return gen_rtx (ROTATE, mode, XEXP (op0, 0),
- (GET_CODE (op0) == ASHIFT
- ? XEXP (op0, 1) : XEXP (op1, 1)));
-
- /* If OP0 is (ashiftrt (plus ...) C), it might actually be
- a (sign_extend (plus ...)). If so, OP1 is a CONST_INT, and the PLUS
- does not affect any of the bits in OP1, it can really be done
- as a PLUS and we can associate. We do this by seeing if OP1
- can be safely shifted left C bits. */
- if (GET_CODE (op1) == CONST_INT && GET_CODE (op0) == ASHIFTRT
- && GET_CODE (XEXP (op0, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT)
- {
- int count = INTVAL (XEXP (op0, 1));
- HOST_WIDE_INT mask = INTVAL (op1) << count;
-
- if (mask >> count == INTVAL (op1)
- && (mask & nonzero_bits (XEXP (op0, 0), mode)) == 0)
- {
- SUBST (XEXP (XEXP (op0, 0), 1),
- GEN_INT (INTVAL (XEXP (XEXP (op0, 0), 1)) | mask));
- return op0;
- }
- }
- break;
-
- case XOR:
- /* Convert (XOR (NOT x) (NOT y)) to (XOR x y).
- Also convert (XOR (NOT x) y) to (NOT (XOR x y)), similarly for
- (NOT y). */
- {
- int num_negated = 0;
-
- if (GET_CODE (op0) == NOT)
- num_negated++, op0 = XEXP (op0, 0);
- if (GET_CODE (op1) == NOT)
- num_negated++, op1 = XEXP (op1, 0);
-
- if (num_negated == 2)
- {
- SUBST (XEXP (x, 0), op0);
- SUBST (XEXP (x, 1), op1);
- }
- else if (num_negated == 1)
- return gen_unary (NOT, mode, mode, gen_binary (XOR, mode, op0, op1));
- }
-
- /* Convert (xor (and A B) B) to (and (not A) B). The latter may
- correspond to a machine insn or result in further simplifications
- if B is a constant. */
-
- if (GET_CODE (op0) == AND
- && rtx_equal_p (XEXP (op0, 1), op1)
- && ! side_effects_p (op1))
- return gen_binary (AND, mode,
- gen_unary (NOT, mode, mode, XEXP (op0, 0)),
- op1);
-
- else if (GET_CODE (op0) == AND
- && rtx_equal_p (XEXP (op0, 0), op1)
- && ! side_effects_p (op1))
- return gen_binary (AND, mode,
- gen_unary (NOT, mode, mode, XEXP (op0, 1)),
- op1);
-
- /* (xor (comparison foo bar) (const_int 1)) can become the reversed
- comparison if STORE_FLAG_VALUE is 1. */
- if (STORE_FLAG_VALUE == 1
- && op1 == const1_rtx
- && GET_RTX_CLASS (GET_CODE (op0)) == '<'
- && reversible_comparison_p (op0))
- return gen_rtx_combine (reverse_condition (GET_CODE (op0)),
- mode, XEXP (op0, 0), XEXP (op0, 1));
-
- /* (lshiftrt foo C) where C is the number of bits in FOO minus 1
- is (lt foo (const_int 0)), so we can perform the above
- simplification if STORE_FLAG_VALUE is 1. */
-
- if (STORE_FLAG_VALUE == 1
- && op1 == const1_rtx
- && GET_CODE (op0) == LSHIFTRT
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && INTVAL (XEXP (op0, 1)) == GET_MODE_BITSIZE (mode) - 1)
- return gen_rtx_combine (GE, mode, XEXP (op0, 0), const0_rtx);
-
- /* (xor (comparison foo bar) (const_int sign-bit))
- when STORE_FLAG_VALUE is the sign bit. */
- if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && ((STORE_FLAG_VALUE & GET_MODE_MASK (mode))
- == (HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (mode) - 1))
- && op1 == const_true_rtx
- && GET_RTX_CLASS (GET_CODE (op0)) == '<'
- && reversible_comparison_p (op0))
- return gen_rtx_combine (reverse_condition (GET_CODE (op0)),
- mode, XEXP (op0, 0), XEXP (op0, 1));
- break;
- }
-
- return x;
-}
-
-/* We consider ZERO_EXTRACT, SIGN_EXTRACT, and SIGN_EXTEND as "compound
- operations" because they can be replaced with two more basic operations.
- ZERO_EXTEND is also considered "compound" because it can be replaced with
- an AND operation, which is simpler, though only one operation.
-
- The function expand_compound_operation is called with an rtx expression
- and will convert it to the appropriate shifts and AND operations,
- simplifying at each stage.
-
- The function make_compound_operation is called to convert an expression
- consisting of shifts and ANDs into the equivalent compound expression.
- It is the inverse of this function, loosely speaking. */
-
-static rtx
-expand_compound_operation (x)
- rtx x;
-{
- int pos = 0, len;
- int unsignedp = 0;
- int modewidth;
- rtx tem;
-
- switch (GET_CODE (x))
- {
- case ZERO_EXTEND:
- unsignedp = 1;
- case SIGN_EXTEND:
- /* We can't necessarily use a const_int for a multiword mode;
- it depends on implicitly extending the value.
- Since we don't know the right way to extend it,
- we can't tell whether the implicit way is right.
-
- Even for a mode that is no wider than a const_int,
- we can't win, because we need to sign extend one of its bits through
- the rest of it, and we don't know which bit. */
- if (GET_CODE (XEXP (x, 0)) == CONST_INT)
- return x;
-
- /* Return if (subreg:MODE FROM 0) is not a safe replacement for
- (zero_extend:MODE FROM) or (sign_extend:MODE FROM). It is for any MEM
- because (SUBREG (MEM...)) is guaranteed to cause the MEM to be
- reloaded. If not for that, MEM's would very rarely be safe.
-
- Reject MODEs bigger than a word, because we might not be able
- to reference a two-register group starting with an arbitrary register
- (and currently gen_lowpart might crash for a SUBREG). */
-
- if (GET_MODE_SIZE (GET_MODE (XEXP (x, 0))) > UNITS_PER_WORD)
- return x;
-
- len = GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)));
- /* If the inner object has VOIDmode (the only way this can happen
- is if it is a ASM_OPERANDS), we can't do anything since we don't
- know how much masking to do. */
- if (len == 0)
- return x;
-
- break;
-
- case ZERO_EXTRACT:
- unsignedp = 1;
- case SIGN_EXTRACT:
- /* If the operand is a CLOBBER, just return it. */
- if (GET_CODE (XEXP (x, 0)) == CLOBBER)
- return XEXP (x, 0);
-
- if (GET_CODE (XEXP (x, 1)) != CONST_INT
- || GET_CODE (XEXP (x, 2)) != CONST_INT
- || GET_MODE (XEXP (x, 0)) == VOIDmode)
- return x;
-
- len = INTVAL (XEXP (x, 1));
- pos = INTVAL (XEXP (x, 2));
-
- /* If this goes outside the object being extracted, replace the object
- with a (use (mem ...)) construct that only combine understands
- and is used only for this purpose. */
- if (len + pos > GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))))
- SUBST (XEXP (x, 0), gen_rtx (USE, GET_MODE (x), XEXP (x, 0)));
-
- if (BITS_BIG_ENDIAN)
- pos = GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - len - pos;
-
- break;
-
- default:
- return x;
- }
-
- /* We can optimize some special cases of ZERO_EXTEND. */
- if (GET_CODE (x) == ZERO_EXTEND)
- {
- /* (zero_extend:DI (truncate:SI foo:DI)) is just foo:DI if we
- know that the last value didn't have any inappropriate bits
- set. */
- if (GET_CODE (XEXP (x, 0)) == TRUNCATE
- && GET_MODE (XEXP (XEXP (x, 0), 0)) == GET_MODE (x)
- && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (XEXP (XEXP (x, 0), 0), GET_MODE (x))
- & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0)
- return XEXP (XEXP (x, 0), 0);
-
- /* Likewise for (zero_extend:DI (subreg:SI foo:DI 0)). */
- if (GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_MODE (SUBREG_REG (XEXP (x, 0))) == GET_MODE (x)
- && subreg_lowpart_p (XEXP (x, 0))
- && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (SUBREG_REG (XEXP (x, 0)), GET_MODE (x))
- & ~ GET_MODE_MASK (GET_MODE (SUBREG_REG (x)))) == 0)
- return SUBREG_REG (XEXP (x, 0));
-
- /* (zero_extend:DI (truncate:SI foo:DI)) is just foo:DI when foo
- is a comparison and STORE_FLAG_VALUE permits. This is like
- the first case, but it works even when GET_MODE (x) is larger
- than HOST_WIDE_INT. */
- if (GET_CODE (XEXP (x, 0)) == TRUNCATE
- && GET_MODE (XEXP (XEXP (x, 0), 0)) == GET_MODE (x)
- && GET_RTX_CLASS (GET_CODE (XEXP (XEXP (x, 0), 0))) == '<'
- && (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))
- <= HOST_BITS_PER_WIDE_INT)
- && ((HOST_WIDE_INT) STORE_FLAG_VALUE
- & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0)
- return XEXP (XEXP (x, 0), 0);
-
- /* Likewise for (zero_extend:DI (subreg:SI foo:DI 0)). */
- if (GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_MODE (SUBREG_REG (XEXP (x, 0))) == GET_MODE (x)
- && subreg_lowpart_p (XEXP (x, 0))
- && GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) == '<'
- && (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))
- <= HOST_BITS_PER_WIDE_INT)
- && ((HOST_WIDE_INT) STORE_FLAG_VALUE
- & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0)
- return SUBREG_REG (XEXP (x, 0));
-
- /* If sign extension is cheaper than zero extension, then use it
- if we know that no extraneous bits are set, and that the high
- bit is not set. */
- if (flag_expensive_optimizations
- && ((GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT
- && ((nonzero_bits (XEXP (x, 0), GET_MODE (x))
- & ~ (((unsigned HOST_WIDE_INT)
- GET_MODE_MASK (GET_MODE (XEXP (x, 0))))
- >> 1))
- == 0))
- || (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<'
- && (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))
- <= HOST_BITS_PER_WIDE_INT)
- && (((HOST_WIDE_INT) STORE_FLAG_VALUE
- & ~ (((unsigned HOST_WIDE_INT)
- GET_MODE_MASK (GET_MODE (XEXP (x, 0))))
- >> 1))
- == 0))))
- {
- rtx temp = gen_rtx (SIGN_EXTEND, GET_MODE (x), XEXP (x, 0));
-
- if (rtx_cost (temp, SET) < rtx_cost (x, SET))
- return expand_compound_operation (temp);
- }
- }
-
- /* If we reach here, we want to return a pair of shifts. The inner
- shift is a left shift of BITSIZE - POS - LEN bits. The outer
- shift is a right shift of BITSIZE - LEN bits. It is arithmetic or
- logical depending on the value of UNSIGNEDP.
-
- If this was a ZERO_EXTEND or ZERO_EXTRACT, this pair of shifts will be
- converted into an AND of a shift.
-
- We must check for the case where the left shift would have a negative
- count. This can happen in a case like (x >> 31) & 255 on machines
- that can't shift by a constant. On those machines, we would first
- combine the shift with the AND to produce a variable-position
- extraction. Then the constant of 31 would be substituted in to produce
- a such a position. */
-
- modewidth = GET_MODE_BITSIZE (GET_MODE (x));
- if (modewidth >= pos - len)
- tem = simplify_shift_const (NULL_RTX, unsignedp ? LSHIFTRT : ASHIFTRT,
- GET_MODE (x),
- simplify_shift_const (NULL_RTX, ASHIFT,
- GET_MODE (x),
- XEXP (x, 0),
- modewidth - pos - len),
- modewidth - len);
-
- else if (unsignedp && len < HOST_BITS_PER_WIDE_INT)
- tem = simplify_and_const_int (NULL_RTX, GET_MODE (x),
- simplify_shift_const (NULL_RTX, LSHIFTRT,
- GET_MODE (x),
- XEXP (x, 0), pos),
- ((HOST_WIDE_INT) 1 << len) - 1);
- else
- /* Any other cases we can't handle. */
- return x;
-
-
- /* If we couldn't do this for some reason, return the original
- expression. */
- if (GET_CODE (tem) == CLOBBER)
- return x;
-
- return tem;
-}
-
-/* X is a SET which contains an assignment of one object into
- a part of another (such as a bit-field assignment, STRICT_LOW_PART,
- or certain SUBREGS). If possible, convert it into a series of
- logical operations.
-
- We half-heartedly support variable positions, but do not at all
- support variable lengths. */
-
-static rtx
-expand_field_assignment (x)
- rtx x;
-{
- rtx inner;
- rtx pos; /* Always counts from low bit. */
- int len;
- rtx mask;
- enum machine_mode compute_mode;
-
- /* Loop until we find something we can't simplify. */
- while (1)
- {
- if (GET_CODE (SET_DEST (x)) == STRICT_LOW_PART
- && GET_CODE (XEXP (SET_DEST (x), 0)) == SUBREG)
- {
- inner = SUBREG_REG (XEXP (SET_DEST (x), 0));
- len = GET_MODE_BITSIZE (GET_MODE (XEXP (SET_DEST (x), 0)));
- pos = GEN_INT (BITS_PER_WORD * SUBREG_WORD (XEXP (SET_DEST (x), 0)));
- }
- else if (GET_CODE (SET_DEST (x)) == ZERO_EXTRACT
- && GET_CODE (XEXP (SET_DEST (x), 1)) == CONST_INT)
- {
- inner = XEXP (SET_DEST (x), 0);
- len = INTVAL (XEXP (SET_DEST (x), 1));
- pos = XEXP (SET_DEST (x), 2);
-
- /* If the position is constant and spans the width of INNER,
- surround INNER with a USE to indicate this. */
- if (GET_CODE (pos) == CONST_INT
- && INTVAL (pos) + len > GET_MODE_BITSIZE (GET_MODE (inner)))
- inner = gen_rtx (USE, GET_MODE (SET_DEST (x)), inner);
-
- if (BITS_BIG_ENDIAN)
- {
- if (GET_CODE (pos) == CONST_INT)
- pos = GEN_INT (GET_MODE_BITSIZE (GET_MODE (inner)) - len
- - INTVAL (pos));
- else if (GET_CODE (pos) == MINUS
- && GET_CODE (XEXP (pos, 1)) == CONST_INT
- && (INTVAL (XEXP (pos, 1))
- == GET_MODE_BITSIZE (GET_MODE (inner)) - len))
- /* If position is ADJUST - X, new position is X. */
- pos = XEXP (pos, 0);
- else
- pos = gen_binary (MINUS, GET_MODE (pos),
- GEN_INT (GET_MODE_BITSIZE (GET_MODE (inner))
- - len),
- pos);
- }
- }
-
- /* A SUBREG between two modes that occupy the same numbers of words
- can be done by moving the SUBREG to the source. */
- else if (GET_CODE (SET_DEST (x)) == SUBREG
- && (((GET_MODE_SIZE (GET_MODE (SET_DEST (x)))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
- == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (x))))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)))
- {
- x = gen_rtx (SET, VOIDmode, SUBREG_REG (SET_DEST (x)),
- gen_lowpart_for_combine (GET_MODE (SUBREG_REG (SET_DEST (x))),
- SET_SRC (x)));
- continue;
- }
- else
- break;
-
- while (GET_CODE (inner) == SUBREG && subreg_lowpart_p (inner))
- inner = SUBREG_REG (inner);
-
- compute_mode = GET_MODE (inner);
-
- /* Compute a mask of LEN bits, if we can do this on the host machine. */
- if (len < HOST_BITS_PER_WIDE_INT)
- mask = GEN_INT (((HOST_WIDE_INT) 1 << len) - 1);
- else
- break;
-
- /* Now compute the equivalent expression. Make a copy of INNER
- for the SET_DEST in case it is a MEM into which we will substitute;
- we don't want shared RTL in that case. */
- x = gen_rtx (SET, VOIDmode, copy_rtx (inner),
- gen_binary (IOR, compute_mode,
- gen_binary (AND, compute_mode,
- gen_unary (NOT, compute_mode,
- compute_mode,
- gen_binary (ASHIFT,
- compute_mode,
- mask, pos)),
- inner),
- gen_binary (ASHIFT, compute_mode,
- gen_binary (AND, compute_mode,
- gen_lowpart_for_combine
- (compute_mode,
- SET_SRC (x)),
- mask),
- pos)));
- }
-
- return x;
-}
-
-/* Return an RTX for a reference to LEN bits of INNER. If POS_RTX is nonzero,
- it is an RTX that represents a variable starting position; otherwise,
- POS is the (constant) starting bit position (counted from the LSB).
-
- INNER may be a USE. This will occur when we started with a bitfield
- that went outside the boundary of the object in memory, which is
- allowed on most machines. To isolate this case, we produce a USE
- whose mode is wide enough and surround the MEM with it. The only
- code that understands the USE is this routine. If it is not removed,
- it will cause the resulting insn not to match.
-
- UNSIGNEDP is non-zero for an unsigned reference and zero for a
- signed reference.
-
- IN_DEST is non-zero if this is a reference in the destination of a
- SET. This is used when a ZERO_ or SIGN_EXTRACT isn't needed. If non-zero,
- a STRICT_LOW_PART will be used, if zero, ZERO_EXTEND or SIGN_EXTEND will
- be used.
-
- IN_COMPARE is non-zero if we are in a COMPARE. This means that a
- ZERO_EXTRACT should be built even for bits starting at bit 0.
-
- MODE is the desired mode of the result (if IN_DEST == 0).
-
- The result is an RTX for the extraction or NULL_RTX if the target
- can't handle it. */
-
-static rtx
-make_extraction (mode, inner, pos, pos_rtx, len,
- unsignedp, in_dest, in_compare)
- enum machine_mode mode;
- rtx inner;
- int pos;
- rtx pos_rtx;
- int len;
- int unsignedp;
- int in_dest, in_compare;
-{
- /* This mode describes the size of the storage area
- to fetch the overall value from. Within that, we
- ignore the POS lowest bits, etc. */
- enum machine_mode is_mode = GET_MODE (inner);
- enum machine_mode inner_mode;
- enum machine_mode wanted_inner_mode = byte_mode;
- enum machine_mode wanted_inner_reg_mode = word_mode;
- enum machine_mode pos_mode = word_mode;
- enum machine_mode extraction_mode = word_mode;
- enum machine_mode tmode = mode_for_size (len, MODE_INT, 1);
- int spans_byte = 0;
- rtx new = 0;
- rtx orig_pos_rtx = pos_rtx;
- int orig_pos;
-
- /* Get some information about INNER and get the innermost object. */
- if (GET_CODE (inner) == USE)
- /* (use:SI (mem:QI foo)) stands for (mem:SI foo). */
- /* We don't need to adjust the position because we set up the USE
- to pretend that it was a full-word object. */
- spans_byte = 1, inner = XEXP (inner, 0);
- else if (GET_CODE (inner) == SUBREG && subreg_lowpart_p (inner))
- {
- /* If going from (subreg:SI (mem:QI ...)) to (mem:QI ...),
- consider just the QI as the memory to extract from.
- The subreg adds or removes high bits; its mode is
- irrelevant to the meaning of this extraction,
- since POS and LEN count from the lsb. */
- if (GET_CODE (SUBREG_REG (inner)) == MEM)
- is_mode = GET_MODE (SUBREG_REG (inner));
- inner = SUBREG_REG (inner);
- }
-
- inner_mode = GET_MODE (inner);
-
- if (pos_rtx && GET_CODE (pos_rtx) == CONST_INT)
- pos = INTVAL (pos_rtx), pos_rtx = 0;
-
- /* See if this can be done without an extraction. We never can if the
- width of the field is not the same as that of some integer mode. For
- registers, we can only avoid the extraction if the position is at the
- low-order bit and this is either not in the destination or we have the
- appropriate STRICT_LOW_PART operation available.
-
- For MEM, we can avoid an extract if the field starts on an appropriate
- boundary and we can change the mode of the memory reference. However,
- we cannot directly access the MEM if we have a USE and the underlying
- MEM is not TMODE. This combination means that MEM was being used in a
- context where bits outside its mode were being referenced; that is only
- valid in bit-field insns. */
-
- if (tmode != BLKmode
- && ! (spans_byte && inner_mode != tmode)
- && ((pos_rtx == 0 && (pos % BITS_PER_WORD) == 0
- && GET_CODE (inner) != MEM
- && (! in_dest
- || (GET_CODE (inner) == REG
- && (movstrict_optab->handlers[(int) tmode].insn_code
- != CODE_FOR_nothing))))
- || (GET_CODE (inner) == MEM && pos_rtx == 0
- && (pos
- % (STRICT_ALIGNMENT ? GET_MODE_ALIGNMENT (tmode)
- : BITS_PER_UNIT)) == 0
- /* We can't do this if we are widening INNER_MODE (it
- may not be aligned, for one thing). */
- && GET_MODE_BITSIZE (inner_mode) >= GET_MODE_BITSIZE (tmode)
- && (inner_mode == tmode
- || (! mode_dependent_address_p (XEXP (inner, 0))
- && ! MEM_VOLATILE_P (inner))))))
- {
- /* If INNER is a MEM, make a new MEM that encompasses just the desired
- field. If the original and current mode are the same, we need not
- adjust the offset. Otherwise, we do if bytes big endian.
-
- If INNER is not a MEM, get a piece consisting of just the field
- of interest (in this case POS % BITS_PER_WORD must be 0). */
-
- if (GET_CODE (inner) == MEM)
- {
- int offset;
- /* POS counts from lsb, but make OFFSET count in memory order. */
- if (BYTES_BIG_ENDIAN)
- offset = (GET_MODE_BITSIZE (is_mode) - len - pos) / BITS_PER_UNIT;
- else
- offset = pos / BITS_PER_UNIT;
-
- new = gen_rtx (MEM, tmode, plus_constant (XEXP (inner, 0), offset));
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (inner);
- MEM_VOLATILE_P (new) = MEM_VOLATILE_P (inner);
- MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (inner);
- }
- else if (GET_CODE (inner) == REG)
- {
- /* We can't call gen_lowpart_for_combine here since we always want
- a SUBREG and it would sometimes return a new hard register. */
- if (tmode != inner_mode)
- new = gen_rtx (SUBREG, tmode, inner,
- (WORDS_BIG_ENDIAN
- && GET_MODE_SIZE (inner_mode) > UNITS_PER_WORD
- ? (((GET_MODE_SIZE (inner_mode)
- - GET_MODE_SIZE (tmode))
- / UNITS_PER_WORD)
- - pos / BITS_PER_WORD)
- : pos / BITS_PER_WORD));
- else
- new = inner;
- }
- else
- new = force_to_mode (inner, tmode,
- len >= HOST_BITS_PER_WIDE_INT
- ? GET_MODE_MASK (tmode)
- : ((HOST_WIDE_INT) 1 << len) - 1,
- NULL_RTX, 0);
-
- /* If this extraction is going into the destination of a SET,
- make a STRICT_LOW_PART unless we made a MEM. */
-
- if (in_dest)
- return (GET_CODE (new) == MEM ? new
- : (GET_CODE (new) != SUBREG
- ? gen_rtx (CLOBBER, tmode, const0_rtx)
- : gen_rtx_combine (STRICT_LOW_PART, VOIDmode, new)));
-
- /* Otherwise, sign- or zero-extend unless we already are in the
- proper mode. */
-
- return (mode == tmode ? new
- : gen_rtx_combine (unsignedp ? ZERO_EXTEND : SIGN_EXTEND,
- mode, new));
- }
-
- /* Unless this is a COMPARE or we have a funny memory reference,
- don't do anything with zero-extending field extracts starting at
- the low-order bit since they are simple AND operations. */
- if (pos_rtx == 0 && pos == 0 && ! in_dest
- && ! in_compare && ! spans_byte && unsignedp)
- return 0;
-
- /* Unless we are allowed to span bytes, reject this if we would be
- spanning bytes or if the position is not a constant and the length
- is not 1. In all other cases, we would only be going outside
- out object in cases when an original shift would have been
- undefined. */
- if (! spans_byte
- && ((pos_rtx == 0 && pos + len > GET_MODE_BITSIZE (is_mode))
- || (pos_rtx != 0 && len != 1)))
- return 0;
-
- /* Get the mode to use should INNER not be a MEM, the mode for the position,
- and the mode for the result. */
-#ifdef HAVE_insv
- if (in_dest)
- {
- wanted_inner_reg_mode = insn_operand_mode[(int) CODE_FOR_insv][0];
- pos_mode = insn_operand_mode[(int) CODE_FOR_insv][2];
- extraction_mode = insn_operand_mode[(int) CODE_FOR_insv][3];
- }
-#endif
-
-#ifdef HAVE_extzv
- if (! in_dest && unsignedp)
- {
- wanted_inner_reg_mode = insn_operand_mode[(int) CODE_FOR_extzv][1];
- pos_mode = insn_operand_mode[(int) CODE_FOR_extzv][3];
- extraction_mode = insn_operand_mode[(int) CODE_FOR_extzv][0];
- }
-#endif
-
-#ifdef HAVE_extv
- if (! in_dest && ! unsignedp)
- {
- wanted_inner_reg_mode = insn_operand_mode[(int) CODE_FOR_extv][1];
- pos_mode = insn_operand_mode[(int) CODE_FOR_extv][3];
- extraction_mode = insn_operand_mode[(int) CODE_FOR_extv][0];
- }
-#endif
-
- /* Never narrow an object, since that might not be safe. */
-
- if (mode != VOIDmode
- && GET_MODE_SIZE (extraction_mode) < GET_MODE_SIZE (mode))
- extraction_mode = mode;
-
- if (pos_rtx && GET_MODE (pos_rtx) != VOIDmode
- && GET_MODE_SIZE (pos_mode) < GET_MODE_SIZE (GET_MODE (pos_rtx)))
- pos_mode = GET_MODE (pos_rtx);
-
- /* If this is not from memory, the desired mode is wanted_inner_reg_mode;
- if we have to change the mode of memory and cannot, the desired mode is
- EXTRACTION_MODE. */
- if (GET_CODE (inner) != MEM)
- wanted_inner_mode = wanted_inner_reg_mode;
- else if (inner_mode != wanted_inner_mode
- && (mode_dependent_address_p (XEXP (inner, 0))
- || MEM_VOLATILE_P (inner)))
- wanted_inner_mode = extraction_mode;
-
- orig_pos = pos;
-
- if (BITS_BIG_ENDIAN)
- {
- /* POS is passed as if BITS_BIG_ENDIAN == 0, so we need to convert it to
- BITS_BIG_ENDIAN style. If position is constant, compute new
- position. Otherwise, build subtraction.
- Note that POS is relative to the mode of the original argument.
- If it's a MEM we need to recompute POS relative to that.
- However, if we're extracting from (or inserting into) a register,
- we want to recompute POS relative to wanted_inner_mode. */
- int width = (GET_CODE (inner) == MEM
- ? GET_MODE_BITSIZE (is_mode)
- : GET_MODE_BITSIZE (wanted_inner_mode));
-
- if (pos_rtx == 0)
- pos = width - len - pos;
- else
- pos_rtx
- = gen_rtx_combine (MINUS, GET_MODE (pos_rtx),
- GEN_INT (width - len), pos_rtx);
- /* POS may be less than 0 now, but we check for that below.
- Note that it can only be less than 0 if GET_CODE (inner) != MEM. */
- }
-
- /* If INNER has a wider mode, make it smaller. If this is a constant
- extract, try to adjust the byte to point to the byte containing
- the value. */
- if (wanted_inner_mode != VOIDmode
- && GET_MODE_SIZE (wanted_inner_mode) < GET_MODE_SIZE (is_mode)
- && ((GET_CODE (inner) == MEM
- && (inner_mode == wanted_inner_mode
- || (! mode_dependent_address_p (XEXP (inner, 0))
- && ! MEM_VOLATILE_P (inner))))))
- {
- int offset = 0;
-
- /* The computations below will be correct if the machine is big
- endian in both bits and bytes or little endian in bits and bytes.
- If it is mixed, we must adjust. */
-
- /* If bytes are big endian and we had a paradoxical SUBREG, we must
- adjust OFFSET to compensate. */
- if (BYTES_BIG_ENDIAN
- && ! spans_byte
- && GET_MODE_SIZE (inner_mode) < GET_MODE_SIZE (is_mode))
- offset -= GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (inner_mode);
-
- /* If this is a constant position, we can move to the desired byte. */
- if (pos_rtx == 0)
- {
- offset += pos / BITS_PER_UNIT;
- pos %= GET_MODE_BITSIZE (wanted_inner_mode);
- }
-
- if (BYTES_BIG_ENDIAN != BITS_BIG_ENDIAN
- && ! spans_byte
- && is_mode != wanted_inner_mode)
- offset = (GET_MODE_SIZE (is_mode)
- - GET_MODE_SIZE (wanted_inner_mode) - offset);
-
- if (offset != 0 || inner_mode != wanted_inner_mode)
- {
- rtx newmem = gen_rtx (MEM, wanted_inner_mode,
- plus_constant (XEXP (inner, 0), offset));
- RTX_UNCHANGING_P (newmem) = RTX_UNCHANGING_P (inner);
- MEM_VOLATILE_P (newmem) = MEM_VOLATILE_P (inner);
- MEM_IN_STRUCT_P (newmem) = MEM_IN_STRUCT_P (inner);
- inner = newmem;
- }
- }
-
- /* If INNER is not memory, we can always get it into the proper mode. If we
- are changing its mode, POS must be a constant and smaller than the size
- of the new mode. */
- else if (GET_CODE (inner) != MEM)
- {
- if (GET_MODE (inner) != wanted_inner_mode
- && (pos_rtx != 0
- || orig_pos + len > GET_MODE_BITSIZE (wanted_inner_mode)))
- return 0;
-
- inner = force_to_mode (inner, wanted_inner_mode,
- pos_rtx
- || len + orig_pos >= HOST_BITS_PER_WIDE_INT
- ? GET_MODE_MASK (wanted_inner_mode)
- : (((HOST_WIDE_INT) 1 << len) - 1) << orig_pos,
- NULL_RTX, 0);
- }
-
- /* Adjust mode of POS_RTX, if needed. If we want a wider mode, we
- have to zero extend. Otherwise, we can just use a SUBREG. */
- if (pos_rtx != 0
- && GET_MODE_SIZE (pos_mode) > GET_MODE_SIZE (GET_MODE (pos_rtx)))
- pos_rtx = gen_rtx_combine (ZERO_EXTEND, pos_mode, pos_rtx);
- else if (pos_rtx != 0
- && GET_MODE_SIZE (pos_mode) < GET_MODE_SIZE (GET_MODE (pos_rtx)))
- pos_rtx = gen_lowpart_for_combine (pos_mode, pos_rtx);
-
- /* Make POS_RTX unless we already have it and it is correct. If we don't
- have a POS_RTX but we do have an ORIG_POS_RTX, the latter must
- be a CONST_INT. */
- if (pos_rtx == 0 && orig_pos_rtx != 0 && INTVAL (orig_pos_rtx) == pos)
- pos_rtx = orig_pos_rtx;
-
- else if (pos_rtx == 0)
- pos_rtx = GEN_INT (pos);
-
- /* Make the required operation. See if we can use existing rtx. */
- new = gen_rtx_combine (unsignedp ? ZERO_EXTRACT : SIGN_EXTRACT,
- extraction_mode, inner, GEN_INT (len), pos_rtx);
- if (! in_dest)
- new = gen_lowpart_for_combine (mode, new);
-
- return new;
-}
-
-/* See if X contains an ASHIFT of COUNT or more bits that can be commuted
- with any other operations in X. Return X without that shift if so. */
-
-static rtx
-extract_left_shift (x, count)
- rtx x;
- int count;
-{
- enum rtx_code code = GET_CODE (x);
- enum machine_mode mode = GET_MODE (x);
- rtx tem;
-
- switch (code)
- {
- case ASHIFT:
- /* This is the shift itself. If it is wide enough, we will return
- either the value being shifted if the shift count is equal to
- COUNT or a shift for the difference. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) >= count)
- return simplify_shift_const (NULL_RTX, ASHIFT, mode, XEXP (x, 0),
- INTVAL (XEXP (x, 1)) - count);
- break;
-
- case NEG: case NOT:
- if ((tem = extract_left_shift (XEXP (x, 0), count)) != 0)
- return gen_unary (code, mode, mode, tem);
-
- break;
-
- case PLUS: case IOR: case XOR: case AND:
- /* If we can safely shift this constant and we find the inner shift,
- make a new operation. */
- if (GET_CODE (XEXP (x,1)) == CONST_INT
- && (INTVAL (XEXP (x, 1)) & (((HOST_WIDE_INT) 1 << count)) - 1) == 0
- && (tem = extract_left_shift (XEXP (x, 0), count)) != 0)
- return gen_binary (code, mode, tem,
- GEN_INT (INTVAL (XEXP (x, 1)) >> count));
-
- break;
- }
-
- return 0;
-}
-
-/* Look at the expression rooted at X. Look for expressions
- equivalent to ZERO_EXTRACT, SIGN_EXTRACT, ZERO_EXTEND, SIGN_EXTEND.
- Form these expressions.
-
- Return the new rtx, usually just X.
-
- Also, for machines like the Vax that don't have logical shift insns,
- try to convert logical to arithmetic shift operations in cases where
- they are equivalent. This undoes the canonicalizations to logical
- shifts done elsewhere.
-
- We try, as much as possible, to re-use rtl expressions to save memory.
-
- IN_CODE says what kind of expression we are processing. Normally, it is
- SET. In a memory address (inside a MEM, PLUS or minus, the latter two
- being kludges), it is MEM. When processing the arguments of a comparison
- or a COMPARE against zero, it is COMPARE. */
-
-static rtx
-make_compound_operation (x, in_code)
- rtx x;
- enum rtx_code in_code;
-{
- enum rtx_code code = GET_CODE (x);
- enum machine_mode mode = GET_MODE (x);
- int mode_width = GET_MODE_BITSIZE (mode);
- rtx rhs, lhs;
- enum rtx_code next_code;
- int i;
- rtx new = 0;
- rtx tem;
- char *fmt;
-
- /* Select the code to be used in recursive calls. Once we are inside an
- address, we stay there. If we have a comparison, set to COMPARE,
- but once inside, go back to our default of SET. */
-
- next_code = (code == MEM || code == PLUS || code == MINUS ? MEM
- : ((code == COMPARE || GET_RTX_CLASS (code) == '<')
- && XEXP (x, 1) == const0_rtx) ? COMPARE
- : in_code == COMPARE ? SET : in_code);
-
- /* Process depending on the code of this operation. If NEW is set
- non-zero, it will be returned. */
-
- switch (code)
- {
- case ASHIFT:
- /* Convert shifts by constants into multiplications if inside
- an address. */
- if (in_code == MEM && GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT
- && INTVAL (XEXP (x, 1)) >= 0)
- {
- new = make_compound_operation (XEXP (x, 0), next_code);
- new = gen_rtx_combine (MULT, mode, new,
- GEN_INT ((HOST_WIDE_INT) 1
- << INTVAL (XEXP (x, 1))));
- }
- break;
-
- case AND:
- /* If the second operand is not a constant, we can't do anything
- with it. */
- if (GET_CODE (XEXP (x, 1)) != CONST_INT)
- break;
-
- /* If the constant is a power of two minus one and the first operand
- is a logical right shift, make an extraction. */
- if (GET_CODE (XEXP (x, 0)) == LSHIFTRT
- && (i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0)
- {
- new = make_compound_operation (XEXP (XEXP (x, 0), 0), next_code);
- new = make_extraction (mode, new, 0, XEXP (XEXP (x, 0), 1), i, 1,
- 0, in_code == COMPARE);
- }
-
- /* Same as previous, but for (subreg (lshiftrt ...)) in first op. */
- else if (GET_CODE (XEXP (x, 0)) == SUBREG
- && subreg_lowpart_p (XEXP (x, 0))
- && GET_CODE (SUBREG_REG (XEXP (x, 0))) == LSHIFTRT
- && (i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0)
- {
- new = make_compound_operation (XEXP (SUBREG_REG (XEXP (x, 0)), 0),
- next_code);
- new = make_extraction (GET_MODE (SUBREG_REG (XEXP (x, 0))), new, 0,
- XEXP (SUBREG_REG (XEXP (x, 0)), 1), i, 1,
- 0, in_code == COMPARE);
- }
- /* Same as previous, but for (xor/ior (lshiftrt...) (lshiftrt...)). */
- else if ((GET_CODE (XEXP (x, 0)) == XOR
- || GET_CODE (XEXP (x, 0)) == IOR)
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == LSHIFTRT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == LSHIFTRT
- && (i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0)
- {
- /* Apply the distributive law, and then try to make extractions. */
- new = gen_rtx_combine (GET_CODE (XEXP (x, 0)), mode,
- gen_rtx (AND, mode, XEXP (XEXP (x, 0), 0),
- XEXP (x, 1)),
- gen_rtx (AND, mode, XEXP (XEXP (x, 0), 1),
- XEXP (x, 1)));
- new = make_compound_operation (new, in_code);
- }
-
- /* If we are have (and (rotate X C) M) and C is larger than the number
- of bits in M, this is an extraction. */
-
- else if (GET_CODE (XEXP (x, 0)) == ROTATE
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && (i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0
- && i <= INTVAL (XEXP (XEXP (x, 0), 1)))
- {
- new = make_compound_operation (XEXP (XEXP (x, 0), 0), next_code);
- new = make_extraction (mode, new,
- (GET_MODE_BITSIZE (mode)
- - INTVAL (XEXP (XEXP (x, 0), 1))),
- NULL_RTX, i, 1, 0, in_code == COMPARE);
- }
-
- /* On machines without logical shifts, if the operand of the AND is
- a logical shift and our mask turns off all the propagated sign
- bits, we can replace the logical shift with an arithmetic shift. */
- else if (ashr_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing
- && (lshr_optab->handlers[(int) mode].insn_code
- == CODE_FOR_nothing)
- && GET_CODE (XEXP (x, 0)) == LSHIFTRT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (x, 0), 1)) >= 0
- && INTVAL (XEXP (XEXP (x, 0), 1)) < HOST_BITS_PER_WIDE_INT
- && mode_width <= HOST_BITS_PER_WIDE_INT)
- {
- unsigned HOST_WIDE_INT mask = GET_MODE_MASK (mode);
-
- mask >>= INTVAL (XEXP (XEXP (x, 0), 1));
- if ((INTVAL (XEXP (x, 1)) & ~mask) == 0)
- SUBST (XEXP (x, 0),
- gen_rtx_combine (ASHIFTRT, mode,
- make_compound_operation (XEXP (XEXP (x, 0), 0),
- next_code),
- XEXP (XEXP (x, 0), 1)));
- }
-
- /* If the constant is one less than a power of two, this might be
- representable by an extraction even if no shift is present.
- If it doesn't end up being a ZERO_EXTEND, we will ignore it unless
- we are in a COMPARE. */
- else if ((i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0)
- new = make_extraction (mode,
- make_compound_operation (XEXP (x, 0),
- next_code),
- 0, NULL_RTX, i, 1, 0, in_code == COMPARE);
-
- /* If we are in a comparison and this is an AND with a power of two,
- convert this into the appropriate bit extract. */
- else if (in_code == COMPARE
- && (i = exact_log2 (INTVAL (XEXP (x, 1)))) >= 0)
- new = make_extraction (mode,
- make_compound_operation (XEXP (x, 0),
- next_code),
- i, NULL_RTX, 1, 1, 0, 1);
-
- break;
-
- case LSHIFTRT:
- /* If the sign bit is known to be zero, replace this with an
- arithmetic shift. */
- if (ashr_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing
- && lshr_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing
- && mode_width <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (XEXP (x, 0), mode) & (1 << (mode_width - 1))) == 0)
- {
- new = gen_rtx_combine (ASHIFTRT, mode,
- make_compound_operation (XEXP (x, 0),
- next_code),
- XEXP (x, 1));
- break;
- }
-
- /* ... fall through ... */
-
- case ASHIFTRT:
- lhs = XEXP (x, 0);
- rhs = XEXP (x, 1);
-
- /* If we have (ashiftrt (ashift foo C1) C2) with C2 >= C1,
- this is a SIGN_EXTRACT. */
- if (GET_CODE (rhs) == CONST_INT
- && GET_CODE (lhs) == ASHIFT
- && GET_CODE (XEXP (lhs, 1)) == CONST_INT
- && INTVAL (rhs) >= INTVAL (XEXP (lhs, 1)))
- {
- new = make_compound_operation (XEXP (lhs, 0), next_code);
- new = make_extraction (mode, new,
- INTVAL (rhs) - INTVAL (XEXP (lhs, 1)),
- NULL_RTX, mode_width - INTVAL (rhs),
- code == LSHIFTRT, 0, in_code == COMPARE);
- }
-
- /* See if we have operations between an ASHIFTRT and an ASHIFT.
- If so, try to merge the shifts into a SIGN_EXTEND. We could
- also do this for some cases of SIGN_EXTRACT, but it doesn't
- seem worth the effort; the case checked for occurs on Alpha. */
-
- if (GET_RTX_CLASS (GET_CODE (lhs)) != 'o'
- && ! (GET_CODE (lhs) == SUBREG
- && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (lhs))) == 'o'))
- && GET_CODE (rhs) == CONST_INT
- && INTVAL (rhs) < HOST_BITS_PER_WIDE_INT
- && (new = extract_left_shift (lhs, INTVAL (rhs))) != 0)
- new = make_extraction (mode, make_compound_operation (new, next_code),
- 0, NULL_RTX, mode_width - INTVAL (rhs),
- code == LSHIFTRT, 0, in_code == COMPARE);
-
- break;
-
- case SUBREG:
- /* Call ourselves recursively on the inner expression. If we are
- narrowing the object and it has a different RTL code from
- what it originally did, do this SUBREG as a force_to_mode. */
-
- tem = make_compound_operation (SUBREG_REG (x), in_code);
- if (GET_CODE (tem) != GET_CODE (SUBREG_REG (x))
- && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (tem))
- && subreg_lowpart_p (x))
- {
- rtx newer = force_to_mode (tem, mode,
- GET_MODE_MASK (mode), NULL_RTX, 0);
-
- /* If we have something other than a SUBREG, we might have
- done an expansion, so rerun outselves. */
- if (GET_CODE (newer) != SUBREG)
- newer = make_compound_operation (newer, in_code);
-
- return newer;
- }
- }
-
- if (new)
- {
- x = gen_lowpart_for_combine (mode, new);
- code = GET_CODE (x);
- }
-
- /* Now recursively process each operand of this operation. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- if (fmt[i] == 'e')
- {
- new = make_compound_operation (XEXP (x, i), next_code);
- SUBST (XEXP (x, i), new);
- }
-
- return x;
-}
-
-/* Given M see if it is a value that would select a field of bits
- within an item, but not the entire word. Return -1 if not.
- Otherwise, return the starting position of the field, where 0 is the
- low-order bit.
-
- *PLEN is set to the length of the field. */
-
-static int
-get_pos_from_mask (m, plen)
- unsigned HOST_WIDE_INT m;
- int *plen;
-{
- /* Get the bit number of the first 1 bit from the right, -1 if none. */
- int pos = exact_log2 (m & - m);
-
- if (pos < 0)
- return -1;
-
- /* Now shift off the low-order zero bits and see if we have a power of
- two minus 1. */
- *plen = exact_log2 ((m >> pos) + 1);
-
- if (*plen <= 0)
- return -1;
-
- return pos;
-}
-
-/* See if X can be simplified knowing that we will only refer to it in
- MODE and will only refer to those bits that are nonzero in MASK.
- If other bits are being computed or if masking operations are done
- that select a superset of the bits in MASK, they can sometimes be
- ignored.
-
- Return a possibly simplified expression, but always convert X to
- MODE. If X is a CONST_INT, AND the CONST_INT with MASK.
-
- Also, if REG is non-zero and X is a register equal in value to REG,
- replace X with REG.
-
- If JUST_SELECT is nonzero, don't optimize by noticing that bits in MASK
- are all off in X. This is used when X will be complemented, by either
- NOT, NEG, or XOR. */
-
-static rtx
-force_to_mode (x, mode, mask, reg, just_select)
- rtx x;
- enum machine_mode mode;
- unsigned HOST_WIDE_INT mask;
- rtx reg;
- int just_select;
-{
- enum rtx_code code = GET_CODE (x);
- int next_select = just_select || code == XOR || code == NOT || code == NEG;
- enum machine_mode op_mode;
- unsigned HOST_WIDE_INT fuller_mask, nonzero;
- rtx op0, op1, temp;
-
- /* If this is a CALL, don't do anything. Some of the code below
- will do the wrong thing since the mode of a CALL is VOIDmode. */
- if (code == CALL)
- return x;
-
- /* We want to perform the operation is its present mode unless we know
- that the operation is valid in MODE, in which case we do the operation
- in MODE. */
- op_mode = ((GET_MODE_CLASS (mode) == GET_MODE_CLASS (GET_MODE (x))
- && code_to_optab[(int) code] != 0
- && (code_to_optab[(int) code]->handlers[(int) mode].insn_code
- != CODE_FOR_nothing))
- ? mode : GET_MODE (x));
-
- /* It is not valid to do a right-shift in a narrower mode
- than the one it came in with. */
- if ((code == LSHIFTRT || code == ASHIFTRT)
- && GET_MODE_BITSIZE (mode) < GET_MODE_BITSIZE (GET_MODE (x)))
- op_mode = GET_MODE (x);
-
- /* Truncate MASK to fit OP_MODE. */
- if (op_mode)
- mask &= GET_MODE_MASK (op_mode);
-
- /* When we have an arithmetic operation, or a shift whose count we
- do not know, we need to assume that all bit the up to the highest-order
- bit in MASK will be needed. This is how we form such a mask. */
- if (op_mode)
- fuller_mask = (GET_MODE_BITSIZE (op_mode) >= HOST_BITS_PER_WIDE_INT
- ? GET_MODE_MASK (op_mode)
- : ((HOST_WIDE_INT) 1 << (floor_log2 (mask) + 1)) - 1);
- else
- fuller_mask = ~ (HOST_WIDE_INT) 0;
-
- /* Determine what bits of X are guaranteed to be (non)zero. */
- nonzero = nonzero_bits (x, mode);
-
- /* If none of the bits in X are needed, return a zero. */
- if (! just_select && (nonzero & mask) == 0)
- return const0_rtx;
-
- /* If X is a CONST_INT, return a new one. Do this here since the
- test below will fail. */
- if (GET_CODE (x) == CONST_INT)
- {
- HOST_WIDE_INT cval = INTVAL (x) & mask;
- int width = GET_MODE_BITSIZE (mode);
-
- /* If MODE is narrower that HOST_WIDE_INT and CVAL is a negative
- number, sign extend it. */
- if (width > 0 && width < HOST_BITS_PER_WIDE_INT
- && (cval & ((HOST_WIDE_INT) 1 << (width - 1))) != 0)
- cval |= (HOST_WIDE_INT) -1 << width;
-
- return GEN_INT (cval);
- }
-
- /* If X is narrower than MODE and we want all the bits in X's mode, just
- get X in the proper mode. */
- if (GET_MODE_SIZE (GET_MODE (x)) < GET_MODE_SIZE (mode)
- && (GET_MODE_MASK (GET_MODE (x)) & ~ mask) == 0)
- return gen_lowpart_for_combine (mode, x);
-
- /* If we aren't changing the mode, X is not a SUBREG, and all zero bits in
- MASK are already known to be zero in X, we need not do anything. */
- if (GET_MODE (x) == mode && code != SUBREG && (~ mask & nonzero) == 0)
- return x;
-
- switch (code)
- {
- case CLOBBER:
- /* If X is a (clobber (const_int)), return it since we know we are
- generating something that won't match. */
- return x;
-
- case USE:
- /* X is a (use (mem ..)) that was made from a bit-field extraction that
- spanned the boundary of the MEM. If we are now masking so it is
- within that boundary, we don't need the USE any more. */
- if (! BITS_BIG_ENDIAN
- && (mask & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0)
- return force_to_mode (XEXP (x, 0), mode, mask, reg, next_select);
- break;
-
- case SIGN_EXTEND:
- case ZERO_EXTEND:
- case ZERO_EXTRACT:
- case SIGN_EXTRACT:
- x = expand_compound_operation (x);
- if (GET_CODE (x) != code)
- return force_to_mode (x, mode, mask, reg, next_select);
- break;
-
- case REG:
- if (reg != 0 && (rtx_equal_p (get_last_value (reg), x)
- || rtx_equal_p (reg, get_last_value (x))))
- x = reg;
- break;
-
- case SUBREG:
- if (subreg_lowpart_p (x)
- /* We can ignore the effect of this SUBREG if it narrows the mode or
- if the constant masks to zero all the bits the mode doesn't
- have. */
- && ((GET_MODE_SIZE (GET_MODE (x))
- < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- || (0 == (mask
- & GET_MODE_MASK (GET_MODE (x))
- & ~ GET_MODE_MASK (GET_MODE (SUBREG_REG (x)))))))
- return force_to_mode (SUBREG_REG (x), mode, mask, reg, next_select);
- break;
-
- case AND:
- /* If this is an AND with a constant, convert it into an AND
- whose constant is the AND of that constant with MASK. If it
- remains an AND of MASK, delete it since it is redundant. */
-
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- {
- x = simplify_and_const_int (x, op_mode, XEXP (x, 0),
- mask & INTVAL (XEXP (x, 1)));
-
- /* If X is still an AND, see if it is an AND with a mask that
- is just some low-order bits. If so, and it is MASK, we don't
- need it. */
-
- if (GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) == mask)
- x = XEXP (x, 0);
-
- /* If it remains an AND, try making another AND with the bits
- in the mode mask that aren't in MASK turned on. If the
- constant in the AND is wide enough, this might make a
- cheaper constant. */
-
- if (GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT
- && GET_MODE_MASK (GET_MODE (x)) != mask
- && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT)
- {
- HOST_WIDE_INT cval = (INTVAL (XEXP (x, 1))
- | (GET_MODE_MASK (GET_MODE (x)) & ~ mask));
- int width = GET_MODE_BITSIZE (GET_MODE (x));
- rtx y;
-
- /* If MODE is narrower that HOST_WIDE_INT and CVAL is a negative
- number, sign extend it. */
- if (width > 0 && width < HOST_BITS_PER_WIDE_INT
- && (cval & ((HOST_WIDE_INT) 1 << (width - 1))) != 0)
- cval |= (HOST_WIDE_INT) -1 << width;
-
- y = gen_binary (AND, GET_MODE (x), XEXP (x, 0), GEN_INT (cval));
- if (rtx_cost (y, SET) < rtx_cost (x, SET))
- x = y;
- }
-
- break;
- }
-
- goto binop;
-
- case PLUS:
- /* In (and (plus FOO C1) M), if M is a mask that just turns off
- low-order bits (as in an alignment operation) and FOO is already
- aligned to that boundary, mask C1 to that boundary as well.
- This may eliminate that PLUS and, later, the AND. */
-
- {
- int width = GET_MODE_BITSIZE (mode);
- unsigned HOST_WIDE_INT smask = mask;
-
- /* If MODE is narrower than HOST_WIDE_INT and mask is a negative
- number, sign extend it. */
-
- if (width < HOST_BITS_PER_WIDE_INT
- && (smask & ((HOST_WIDE_INT) 1 << (width - 1))) != 0)
- smask |= (HOST_WIDE_INT) -1 << width;
-
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && exact_log2 (- smask) >= 0
- && (nonzero_bits (XEXP (x, 0), mode) & ~ mask) == 0
- && (INTVAL (XEXP (x, 1)) & ~ mask) != 0)
- return force_to_mode (plus_constant (XEXP (x, 0),
- INTVAL (XEXP (x, 1)) & mask),
- mode, mask, reg, next_select);
- }
-
- /* ... fall through ... */
-
- case MINUS:
- case MULT:
- /* For PLUS, MINUS and MULT, we need any bits less significant than the
- most significant bit in MASK since carries from those bits will
- affect the bits we are interested in. */
- mask = fuller_mask;
- goto binop;
-
- case IOR:
- case XOR:
- /* If X is (ior (lshiftrt FOO C1) C2), try to commute the IOR and
- LSHIFTRT so we end up with an (and (lshiftrt (ior ...) ...) ...)
- operation which may be a bitfield extraction. Ensure that the
- constant we form is not wider than the mode of X. */
-
- if (GET_CODE (XEXP (x, 0)) == LSHIFTRT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (x, 0), 1)) >= 0
- && INTVAL (XEXP (XEXP (x, 0), 1)) < HOST_BITS_PER_WIDE_INT
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && ((INTVAL (XEXP (XEXP (x, 0), 1))
- + floor_log2 (INTVAL (XEXP (x, 1))))
- < GET_MODE_BITSIZE (GET_MODE (x)))
- && (INTVAL (XEXP (x, 1))
- & ~ nonzero_bits (XEXP (x, 0), GET_MODE (x))) == 0)
- {
- temp = GEN_INT ((INTVAL (XEXP (x, 1)) & mask)
- << INTVAL (XEXP (XEXP (x, 0), 1)));
- temp = gen_binary (GET_CODE (x), GET_MODE (x),
- XEXP (XEXP (x, 0), 0), temp);
- x = gen_binary (LSHIFTRT, GET_MODE (x), temp,
- XEXP (XEXP (x, 0), 1));
- return force_to_mode (x, mode, mask, reg, next_select);
- }
-
- binop:
- /* For most binary operations, just propagate into the operation and
- change the mode if we have an operation of that mode. */
-
- op0 = gen_lowpart_for_combine (op_mode,
- force_to_mode (XEXP (x, 0), mode, mask,
- reg, next_select));
- op1 = gen_lowpart_for_combine (op_mode,
- force_to_mode (XEXP (x, 1), mode, mask,
- reg, next_select));
-
- /* If OP1 is a CONST_INT and X is an IOR or XOR, clear bits outside
- MASK since OP1 might have been sign-extended but we never want
- to turn on extra bits, since combine might have previously relied
- on them being off. */
- if (GET_CODE (op1) == CONST_INT && (code == IOR || code == XOR)
- && (INTVAL (op1) & mask) != 0)
- op1 = GEN_INT (INTVAL (op1) & mask);
-
- if (op_mode != GET_MODE (x) || op0 != XEXP (x, 0) || op1 != XEXP (x, 1))
- x = gen_binary (code, op_mode, op0, op1);
- break;
-
- case ASHIFT:
- /* For left shifts, do the same, but just for the first operand.
- However, we cannot do anything with shifts where we cannot
- guarantee that the counts are smaller than the size of the mode
- because such a count will have a different meaning in a
- wider mode. */
-
- if (! (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) >= 0
- && INTVAL (XEXP (x, 1)) < GET_MODE_BITSIZE (mode))
- && ! (GET_MODE (XEXP (x, 1)) != VOIDmode
- && (nonzero_bits (XEXP (x, 1), GET_MODE (XEXP (x, 1)))
- < (unsigned HOST_WIDE_INT) GET_MODE_BITSIZE (mode))))
- break;
-
- /* If the shift count is a constant and we can do arithmetic in
- the mode of the shift, refine which bits we need. Otherwise, use the
- conservative form of the mask. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) >= 0
- && INTVAL (XEXP (x, 1)) < GET_MODE_BITSIZE (op_mode)
- && GET_MODE_BITSIZE (op_mode) <= HOST_BITS_PER_WIDE_INT)
- mask >>= INTVAL (XEXP (x, 1));
- else
- mask = fuller_mask;
-
- op0 = gen_lowpart_for_combine (op_mode,
- force_to_mode (XEXP (x, 0), op_mode,
- mask, reg, next_select));
-
- if (op_mode != GET_MODE (x) || op0 != XEXP (x, 0))
- x = gen_binary (code, op_mode, op0, XEXP (x, 1));
- break;
-
- case LSHIFTRT:
- /* Here we can only do something if the shift count is a constant,
- this shift constant is valid for the host, and we can do arithmetic
- in OP_MODE. */
-
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT
- && GET_MODE_BITSIZE (op_mode) <= HOST_BITS_PER_WIDE_INT)
- {
- rtx inner = XEXP (x, 0);
-
- /* Select the mask of the bits we need for the shift operand. */
- mask <<= INTVAL (XEXP (x, 1));
-
- /* We can only change the mode of the shift if we can do arithmetic
- in the mode of the shift and MASK is no wider than the width of
- OP_MODE. */
- if (GET_MODE_BITSIZE (op_mode) > HOST_BITS_PER_WIDE_INT
- || (mask & ~ GET_MODE_MASK (op_mode)) != 0)
- op_mode = GET_MODE (x);
-
- inner = force_to_mode (inner, op_mode, mask, reg, next_select);
-
- if (GET_MODE (x) != op_mode || inner != XEXP (x, 0))
- x = gen_binary (LSHIFTRT, op_mode, inner, XEXP (x, 1));
- }
-
- /* If we have (and (lshiftrt FOO C1) C2) where the combination of the
- shift and AND produces only copies of the sign bit (C2 is one less
- than a power of two), we can do this with just a shift. */
-
- if (GET_CODE (x) == LSHIFTRT
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && ((INTVAL (XEXP (x, 1))
- + num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0))))
- >= GET_MODE_BITSIZE (GET_MODE (x)))
- && exact_log2 (mask + 1) >= 0
- && (num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0)))
- >= exact_log2 (mask + 1)))
- x = gen_binary (LSHIFTRT, GET_MODE (x), XEXP (x, 0),
- GEN_INT (GET_MODE_BITSIZE (GET_MODE (x))
- - exact_log2 (mask + 1)));
- break;
-
- case ASHIFTRT:
- /* If we are just looking for the sign bit, we don't need this shift at
- all, even if it has a variable count. */
- if (GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT
- && (mask == ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (x)) - 1))))
- return force_to_mode (XEXP (x, 0), mode, mask, reg, next_select);
-
- /* If this is a shift by a constant, get a mask that contains those bits
- that are not copies of the sign bit. We then have two cases: If
- MASK only includes those bits, this can be a logical shift, which may
- allow simplifications. If MASK is a single-bit field not within
- those bits, we are requesting a copy of the sign bit and hence can
- shift the sign bit to the appropriate location. */
-
- if (GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) >= 0
- && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT)
- {
- int i = -1;
-
- /* If the considered data is wider then HOST_WIDE_INT, we can't
- represent a mask for all its bits in a single scalar.
- But we only care about the lower bits, so calculate these. */
-
- if (GET_MODE_BITSIZE (GET_MODE (x)) > HOST_BITS_PER_WIDE_INT)
- {
- nonzero = ~ (HOST_WIDE_INT) 0;
-
- /* GET_MODE_BITSIZE (GET_MODE (x)) - INTVAL (XEXP (x, 1))
- is the number of bits a full-width mask would have set.
- We need only shift if these are fewer than nonzero can
- hold. If not, we must keep all bits set in nonzero. */
-
- if (GET_MODE_BITSIZE (GET_MODE (x)) - INTVAL (XEXP (x, 1))
- < HOST_BITS_PER_WIDE_INT)
- nonzero >>= INTVAL (XEXP (x, 1))
- + HOST_BITS_PER_WIDE_INT
- - GET_MODE_BITSIZE (GET_MODE (x)) ;
- }
- else
- {
- nonzero = GET_MODE_MASK (GET_MODE (x));
- nonzero >>= INTVAL (XEXP (x, 1));
- }
-
- if ((mask & ~ nonzero) == 0
- || (i = exact_log2 (mask)) >= 0)
- {
- x = simplify_shift_const
- (x, LSHIFTRT, GET_MODE (x), XEXP (x, 0),
- i < 0 ? INTVAL (XEXP (x, 1))
- : GET_MODE_BITSIZE (GET_MODE (x)) - 1 - i);
-
- if (GET_CODE (x) != ASHIFTRT)
- return force_to_mode (x, mode, mask, reg, next_select);
- }
- }
-
- /* If MASK is 1, convert this to a LSHIFTRT. This can be done
- even if the shift count isn't a constant. */
- if (mask == 1)
- x = gen_binary (LSHIFTRT, GET_MODE (x), XEXP (x, 0), XEXP (x, 1));
-
- /* If this is a sign-extension operation that just affects bits
- we don't care about, remove it. Be sure the call above returned
- something that is still a shift. */
-
- if ((GET_CODE (x) == LSHIFTRT || GET_CODE (x) == ASHIFTRT)
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) >= 0
- && (INTVAL (XEXP (x, 1))
- <= GET_MODE_BITSIZE (GET_MODE (x)) - (floor_log2 (mask) + 1))
- && GET_CODE (XEXP (x, 0)) == ASHIFT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (x, 0), 1)) == INTVAL (XEXP (x, 1)))
- return force_to_mode (XEXP (XEXP (x, 0), 0), mode, mask,
- reg, next_select);
-
- break;
-
- case ROTATE:
- case ROTATERT:
- /* If the shift count is constant and we can do computations
- in the mode of X, compute where the bits we care about are.
- Otherwise, we can't do anything. Don't change the mode of
- the shift or propagate MODE into the shift, though. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) >= 0)
- {
- temp = simplify_binary_operation (code == ROTATE ? ROTATERT : ROTATE,
- GET_MODE (x), GEN_INT (mask),
- XEXP (x, 1));
- if (temp && GET_CODE(temp) == CONST_INT)
- SUBST (XEXP (x, 0),
- force_to_mode (XEXP (x, 0), GET_MODE (x),
- INTVAL (temp), reg, next_select));
- }
- break;
-
- case NEG:
- /* If we just want the low-order bit, the NEG isn't needed since it
- won't change the low-order bit. */
- if (mask == 1)
- return force_to_mode (XEXP (x, 0), mode, mask, reg, just_select);
-
- /* We need any bits less significant than the most significant bit in
- MASK since carries from those bits will affect the bits we are
- interested in. */
- mask = fuller_mask;
- goto unop;
-
- case NOT:
- /* (not FOO) is (xor FOO CONST), so if FOO is an LSHIFTRT, we can do the
- same as the XOR case above. Ensure that the constant we form is not
- wider than the mode of X. */
-
- if (GET_CODE (XEXP (x, 0)) == LSHIFTRT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (x, 0), 1)) >= 0
- && (INTVAL (XEXP (XEXP (x, 0), 1)) + floor_log2 (mask)
- < GET_MODE_BITSIZE (GET_MODE (x)))
- && INTVAL (XEXP (XEXP (x, 0), 1)) < HOST_BITS_PER_WIDE_INT)
- {
- temp = GEN_INT (mask << INTVAL (XEXP (XEXP (x, 0), 1)));
- temp = gen_binary (XOR, GET_MODE (x), XEXP (XEXP (x, 0), 0), temp);
- x = gen_binary (LSHIFTRT, GET_MODE (x), temp, XEXP (XEXP (x, 0), 1));
-
- return force_to_mode (x, mode, mask, reg, next_select);
- }
-
- /* (and (not FOO) CONST) is (not (or FOO (not CONST))), so we must
- use the full mask inside the NOT. */
- mask = fuller_mask;
-
- unop:
- op0 = gen_lowpart_for_combine (op_mode,
- force_to_mode (XEXP (x, 0), mode, mask,
- reg, next_select));
- if (op_mode != GET_MODE (x) || op0 != XEXP (x, 0))
- x = gen_unary (code, op_mode, op_mode, op0);
- break;
-
- case NE:
- /* (and (ne FOO 0) CONST) can be (and FOO CONST) if CONST is included
- in STORE_FLAG_VALUE and FOO has a single bit that might be nonzero,
- which is equal to STORE_FLAG_VALUE. */
- if ((mask & ~ STORE_FLAG_VALUE) == 0 && XEXP (x, 1) == const0_rtx
- && exact_log2 (nonzero_bits (XEXP (x, 0), mode)) >= 0
- && nonzero_bits (XEXP (x, 0), mode) == STORE_FLAG_VALUE)
- return force_to_mode (XEXP (x, 0), mode, mask, reg, next_select);
-
- break;
-
- case IF_THEN_ELSE:
- /* We have no way of knowing if the IF_THEN_ELSE can itself be
- written in a narrower mode. We play it safe and do not do so. */
-
- SUBST (XEXP (x, 1),
- gen_lowpart_for_combine (GET_MODE (x),
- force_to_mode (XEXP (x, 1), mode,
- mask, reg, next_select)));
- SUBST (XEXP (x, 2),
- gen_lowpart_for_combine (GET_MODE (x),
- force_to_mode (XEXP (x, 2), mode,
- mask, reg,next_select)));
- break;
- }
-
- /* Ensure we return a value of the proper mode. */
- return gen_lowpart_for_combine (mode, x);
-}
-
-/* Return nonzero if X is an expression that has one of two values depending on
- whether some other value is zero or nonzero. In that case, we return the
- value that is being tested, *PTRUE is set to the value if the rtx being
- returned has a nonzero value, and *PFALSE is set to the other alternative.
-
- If we return zero, we set *PTRUE and *PFALSE to X. */
-
-static rtx
-if_then_else_cond (x, ptrue, pfalse)
- rtx x;
- rtx *ptrue, *pfalse;
-{
- enum machine_mode mode = GET_MODE (x);
- enum rtx_code code = GET_CODE (x);
- int size = GET_MODE_BITSIZE (mode);
- rtx cond0, cond1, true0, true1, false0, false1;
- unsigned HOST_WIDE_INT nz;
-
- /* If this is a unary operation whose operand has one of two values, apply
- our opcode to compute those values. */
- if (GET_RTX_CLASS (code) == '1'
- && (cond0 = if_then_else_cond (XEXP (x, 0), &true0, &false0)) != 0)
- {
- *ptrue = gen_unary (code, mode, GET_MODE (XEXP (x, 0)), true0);
- *pfalse = gen_unary (code, mode, GET_MODE (XEXP (x, 0)), false0);
- return cond0;
- }
-
- /* If this is a COMPARE, do nothing, since the IF_THEN_ELSE we would
- make can't possibly match and would suppress other optimizations. */
- else if (code == COMPARE)
- ;
-
- /* If this is a binary operation, see if either side has only one of two
- values. If either one does or if both do and they are conditional on
- the same value, compute the new true and false values. */
- else if (GET_RTX_CLASS (code) == 'c' || GET_RTX_CLASS (code) == '2'
- || GET_RTX_CLASS (code) == '<')
- {
- cond0 = if_then_else_cond (XEXP (x, 0), &true0, &false0);
- cond1 = if_then_else_cond (XEXP (x, 1), &true1, &false1);
-
- if ((cond0 != 0 || cond1 != 0)
- && ! (cond0 != 0 && cond1 != 0 && ! rtx_equal_p (cond0, cond1)))
- {
- /* If if_then_else_cond returned zero, then true/false are the
- same rtl. We must copy one of them to prevent invalid rtl
- sharing. */
- if (cond0 == 0)
- true0 = copy_rtx (true0);
- else if (cond1 == 0)
- true1 = copy_rtx (true1);
-
- *ptrue = gen_binary (code, mode, true0, true1);
- *pfalse = gen_binary (code, mode, false0, false1);
- return cond0 ? cond0 : cond1;
- }
-
- /* See if we have PLUS, IOR, XOR, MINUS or UMAX, where one of the
- operands is zero when the other is non-zero, and vice-versa,
- and STORE_FLAG_VALUE is 1 or -1. */
-
- if ((STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1)
- && (code == PLUS || code == IOR || code == XOR || code == MINUS
- || code == UMAX)
- && GET_CODE (XEXP (x, 0)) == MULT && GET_CODE (XEXP (x, 1)) == MULT)
- {
- rtx op0 = XEXP (XEXP (x, 0), 1);
- rtx op1 = XEXP (XEXP (x, 1), 1);
-
- cond0 = XEXP (XEXP (x, 0), 0);
- cond1 = XEXP (XEXP (x, 1), 0);
-
- if (GET_RTX_CLASS (GET_CODE (cond0)) == '<'
- && GET_RTX_CLASS (GET_CODE (cond1)) == '<'
- && reversible_comparison_p (cond1)
- && ((GET_CODE (cond0) == reverse_condition (GET_CODE (cond1))
- && rtx_equal_p (XEXP (cond0, 0), XEXP (cond1, 0))
- && rtx_equal_p (XEXP (cond0, 1), XEXP (cond1, 1)))
- || ((swap_condition (GET_CODE (cond0))
- == reverse_condition (GET_CODE (cond1)))
- && rtx_equal_p (XEXP (cond0, 0), XEXP (cond1, 1))
- && rtx_equal_p (XEXP (cond0, 1), XEXP (cond1, 0))))
- && ! side_effects_p (x))
- {
- *ptrue = gen_binary (MULT, mode, op0, const_true_rtx);
- *pfalse = gen_binary (MULT, mode,
- (code == MINUS
- ? gen_unary (NEG, mode, mode, op1) : op1),
- const_true_rtx);
- return cond0;
- }
- }
-
- /* Similarly for MULT, AND and UMIN, execpt that for these the result
- is always zero. */
- if ((STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1)
- && (code == MULT || code == AND || code == UMIN)
- && GET_CODE (XEXP (x, 0)) == MULT && GET_CODE (XEXP (x, 1)) == MULT)
- {
- cond0 = XEXP (XEXP (x, 0), 0);
- cond1 = XEXP (XEXP (x, 1), 0);
-
- if (GET_RTX_CLASS (GET_CODE (cond0)) == '<'
- && GET_RTX_CLASS (GET_CODE (cond1)) == '<'
- && reversible_comparison_p (cond1)
- && ((GET_CODE (cond0) == reverse_condition (GET_CODE (cond1))
- && rtx_equal_p (XEXP (cond0, 0), XEXP (cond1, 0))
- && rtx_equal_p (XEXP (cond0, 1), XEXP (cond1, 1)))
- || ((swap_condition (GET_CODE (cond0))
- == reverse_condition (GET_CODE (cond1)))
- && rtx_equal_p (XEXP (cond0, 0), XEXP (cond1, 1))
- && rtx_equal_p (XEXP (cond0, 1), XEXP (cond1, 0))))
- && ! side_effects_p (x))
- {
- *ptrue = *pfalse = const0_rtx;
- return cond0;
- }
- }
- }
-
- else if (code == IF_THEN_ELSE)
- {
- /* If we have IF_THEN_ELSE already, extract the condition and
- canonicalize it if it is NE or EQ. */
- cond0 = XEXP (x, 0);
- *ptrue = XEXP (x, 1), *pfalse = XEXP (x, 2);
- if (GET_CODE (cond0) == NE && XEXP (cond0, 1) == const0_rtx)
- return XEXP (cond0, 0);
- else if (GET_CODE (cond0) == EQ && XEXP (cond0, 1) == const0_rtx)
- {
- *ptrue = XEXP (x, 2), *pfalse = XEXP (x, 1);
- return XEXP (cond0, 0);
- }
- else
- return cond0;
- }
-
- /* If X is a normal SUBREG with both inner and outer modes integral,
- we can narrow both the true and false values of the inner expression,
- if there is a condition. */
- else if (code == SUBREG && GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_CLASS (GET_MODE (SUBREG_REG (x))) == MODE_INT
- && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))
- && 0 != (cond0 = if_then_else_cond (SUBREG_REG (x),
- &true0, &false0)))
- {
- *ptrue = force_to_mode (true0, mode, GET_MODE_MASK (mode), NULL_RTX, 0);
- *pfalse
- = force_to_mode (false0, mode, GET_MODE_MASK (mode), NULL_RTX, 0);
-
- return cond0;
- }
-
- /* If X is a constant, this isn't special and will cause confusions
- if we treat it as such. Likewise if it is equivalent to a constant. */
- else if (CONSTANT_P (x)
- || ((cond0 = get_last_value (x)) != 0 && CONSTANT_P (cond0)))
- ;
-
- /* If X is known to be either 0 or -1, those are the true and
- false values when testing X. */
- else if (num_sign_bit_copies (x, mode) == size)
- {
- *ptrue = constm1_rtx, *pfalse = const0_rtx;
- return x;
- }
-
- /* Likewise for 0 or a single bit. */
- else if (exact_log2 (nz = nonzero_bits (x, mode)) >= 0)
- {
- *ptrue = GEN_INT (nz), *pfalse = const0_rtx;
- return x;
- }
-
- /* Otherwise fail; show no condition with true and false values the same. */
- *ptrue = *pfalse = x;
- return 0;
-}
-
-/* Return the value of expression X given the fact that condition COND
- is known to be true when applied to REG as its first operand and VAL
- as its second. X is known to not be shared and so can be modified in
- place.
-
- We only handle the simplest cases, and specifically those cases that
- arise with IF_THEN_ELSE expressions. */
-
-static rtx
-known_cond (x, cond, reg, val)
- rtx x;
- enum rtx_code cond;
- rtx reg, val;
-{
- enum rtx_code code = GET_CODE (x);
- rtx temp;
- char *fmt;
- int i, j;
-
- if (side_effects_p (x))
- return x;
-
- if (cond == EQ && rtx_equal_p (x, reg))
- return val;
-
- /* If X is (abs REG) and we know something about REG's relationship
- with zero, we may be able to simplify this. */
-
- if (code == ABS && rtx_equal_p (XEXP (x, 0), reg) && val == const0_rtx)
- switch (cond)
- {
- case GE: case GT: case EQ:
- return XEXP (x, 0);
- case LT: case LE:
- return gen_unary (NEG, GET_MODE (XEXP (x, 0)), GET_MODE (XEXP (x, 0)),
- XEXP (x, 0));
- }
-
- /* The only other cases we handle are MIN, MAX, and comparisons if the
- operands are the same as REG and VAL. */
-
- else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == 'c')
- {
- if (rtx_equal_p (XEXP (x, 0), val))
- cond = swap_condition (cond), temp = val, val = reg, reg = temp;
-
- if (rtx_equal_p (XEXP (x, 0), reg) && rtx_equal_p (XEXP (x, 1), val))
- {
- if (GET_RTX_CLASS (code) == '<')
- return (comparison_dominates_p (cond, code) ? const_true_rtx
- : (comparison_dominates_p (cond,
- reverse_condition (code))
- ? const0_rtx : x));
-
- else if (code == SMAX || code == SMIN
- || code == UMIN || code == UMAX)
- {
- int unsignedp = (code == UMIN || code == UMAX);
-
- if (code == SMAX || code == UMAX)
- cond = reverse_condition (cond);
-
- switch (cond)
- {
- case GE: case GT:
- return unsignedp ? x : XEXP (x, 1);
- case LE: case LT:
- return unsignedp ? x : XEXP (x, 0);
- case GEU: case GTU:
- return unsignedp ? XEXP (x, 1) : x;
- case LEU: case LTU:
- return unsignedp ? XEXP (x, 0) : x;
- }
- }
- }
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- SUBST (XEXP (x, i), known_cond (XEXP (x, i), cond, reg, val));
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- SUBST (XVECEXP (x, i, j), known_cond (XVECEXP (x, i, j),
- cond, reg, val));
- }
-
- return x;
-}
-
-/* See if X and Y are equal for the purposes of seeing if we can rewrite an
- assignment as a field assignment. */
-
-static int
-rtx_equal_for_field_assignment_p (x, y)
- rtx x;
- rtx y;
-{
- rtx last_x, last_y;
-
- if (x == y || rtx_equal_p (x, y))
- return 1;
-
- if (x == 0 || y == 0 || GET_MODE (x) != GET_MODE (y))
- return 0;
-
- /* Check for a paradoxical SUBREG of a MEM compared with the MEM.
- Note that all SUBREGs of MEM are paradoxical; otherwise they
- would have been rewritten. */
- if (GET_CODE (x) == MEM && GET_CODE (y) == SUBREG
- && GET_CODE (SUBREG_REG (y)) == MEM
- && rtx_equal_p (SUBREG_REG (y),
- gen_lowpart_for_combine (GET_MODE (SUBREG_REG (y)), x)))
- return 1;
-
- if (GET_CODE (y) == MEM && GET_CODE (x) == SUBREG
- && GET_CODE (SUBREG_REG (x)) == MEM
- && rtx_equal_p (SUBREG_REG (x),
- gen_lowpart_for_combine (GET_MODE (SUBREG_REG (x)), y)))
- return 1;
-
- last_x = get_last_value (x);
- last_y = get_last_value (y);
-
- return ((last_x != 0
- && GET_CODE (last_x) != CLOBBER
- && rtx_equal_for_field_assignment_p (last_x, y))
- || (last_y != 0
- && GET_CODE (last_y) != CLOBBER
- && rtx_equal_for_field_assignment_p (x, last_y))
- || (last_x != 0 && last_y != 0
- && GET_CODE (last_x) != CLOBBER
- && GET_CODE (last_y) != CLOBBER
- && rtx_equal_for_field_assignment_p (last_x, last_y)));
-}
-
-/* See if X, a SET operation, can be rewritten as a bit-field assignment.
- Return that assignment if so.
-
- We only handle the most common cases. */
-
-static rtx
-make_field_assignment (x)
- rtx x;
-{
- rtx dest = SET_DEST (x);
- rtx src = SET_SRC (x);
- rtx assign;
- rtx rhs, lhs;
- HOST_WIDE_INT c1;
- int pos, len;
- rtx other;
- enum machine_mode mode;
-
- /* If SRC was (and (not (ashift (const_int 1) POS)) DEST), this is
- a clear of a one-bit field. We will have changed it to
- (and (rotate (const_int -2) POS) DEST), so check for that. Also check
- for a SUBREG. */
-
- if (GET_CODE (src) == AND && GET_CODE (XEXP (src, 0)) == ROTATE
- && GET_CODE (XEXP (XEXP (src, 0), 0)) == CONST_INT
- && INTVAL (XEXP (XEXP (src, 0), 0)) == -2
- && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1)))
- {
- assign = make_extraction (VOIDmode, dest, 0, XEXP (XEXP (src, 0), 1),
- 1, 1, 1, 0);
- if (assign != 0)
- return gen_rtx (SET, VOIDmode, assign, const0_rtx);
- return x;
- }
-
- else if (GET_CODE (src) == AND && GET_CODE (XEXP (src, 0)) == SUBREG
- && subreg_lowpart_p (XEXP (src, 0))
- && (GET_MODE_SIZE (GET_MODE (XEXP (src, 0)))
- < GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (src, 0)))))
- && GET_CODE (SUBREG_REG (XEXP (src, 0))) == ROTATE
- && INTVAL (XEXP (SUBREG_REG (XEXP (src, 0)), 0)) == -2
- && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1)))
- {
- assign = make_extraction (VOIDmode, dest, 0,
- XEXP (SUBREG_REG (XEXP (src, 0)), 1),
- 1, 1, 1, 0);
- if (assign != 0)
- return gen_rtx (SET, VOIDmode, assign, const0_rtx);
- return x;
- }
-
- /* If SRC is (ior (ashift (const_int 1) POS) DEST), this is a set of a
- one-bit field. */
- else if (GET_CODE (src) == IOR && GET_CODE (XEXP (src, 0)) == ASHIFT
- && XEXP (XEXP (src, 0), 0) == const1_rtx
- && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1)))
- {
- assign = make_extraction (VOIDmode, dest, 0, XEXP (XEXP (src, 0), 1),
- 1, 1, 1, 0);
- if (assign != 0)
- return gen_rtx (SET, VOIDmode, assign, const1_rtx);
- return x;
- }
-
- /* The other case we handle is assignments into a constant-position
- field. They look like (ior/xor (and DEST C1) OTHER). If C1 represents
- a mask that has all one bits except for a group of zero bits and
- OTHER is known to have zeros where C1 has ones, this is such an
- assignment. Compute the position and length from C1. Shift OTHER
- to the appropriate position, force it to the required mode, and
- make the extraction. Check for the AND in both operands. */
-
- if (GET_CODE (src) != IOR && GET_CODE (src) != XOR)
- return x;
-
- rhs = expand_compound_operation (XEXP (src, 0));
- lhs = expand_compound_operation (XEXP (src, 1));
-
- if (GET_CODE (rhs) == AND
- && GET_CODE (XEXP (rhs, 1)) == CONST_INT
- && rtx_equal_for_field_assignment_p (XEXP (rhs, 0), dest))
- c1 = INTVAL (XEXP (rhs, 1)), other = lhs;
- else if (GET_CODE (lhs) == AND
- && GET_CODE (XEXP (lhs, 1)) == CONST_INT
- && rtx_equal_for_field_assignment_p (XEXP (lhs, 0), dest))
- c1 = INTVAL (XEXP (lhs, 1)), other = rhs;
- else
- return x;
-
- pos = get_pos_from_mask ((~ c1) & GET_MODE_MASK (GET_MODE (dest)), &len);
- if (pos < 0 || pos + len > GET_MODE_BITSIZE (GET_MODE (dest))
- || (GET_MODE_BITSIZE (GET_MODE (other)) <= HOST_BITS_PER_WIDE_INT
- && (c1 & nonzero_bits (other, GET_MODE (other))) != 0))
- return x;
-
- assign = make_extraction (VOIDmode, dest, pos, NULL_RTX, len, 1, 1, 0);
- if (assign == 0)
- return x;
-
- /* The mode to use for the source is the mode of the assignment, or of
- what is inside a possible STRICT_LOW_PART. */
- mode = (GET_CODE (assign) == STRICT_LOW_PART
- ? GET_MODE (XEXP (assign, 0)) : GET_MODE (assign));
-
- /* Shift OTHER right POS places and make it the source, restricting it
- to the proper length and mode. */
-
- src = force_to_mode (simplify_shift_const (NULL_RTX, LSHIFTRT,
- GET_MODE (src), other, pos),
- mode,
- GET_MODE_BITSIZE (mode) >= HOST_BITS_PER_WIDE_INT
- ? GET_MODE_MASK (mode)
- : ((HOST_WIDE_INT) 1 << len) - 1,
- dest, 0);
-
- return gen_rtx_combine (SET, VOIDmode, assign, src);
-}
-
-/* See if X is of the form (+ (* a c) (* b c)) and convert to (* (+ a b) c)
- if so. */
-
-static rtx
-apply_distributive_law (x)
- rtx x;
-{
- enum rtx_code code = GET_CODE (x);
- rtx lhs, rhs, other;
- rtx tem;
- enum rtx_code inner_code;
-
- /* Distributivity is not true for floating point.
- It can change the value. So don't do it.
- -- rms and moshier@world.std.com. */
- if (FLOAT_MODE_P (GET_MODE (x)))
- return x;
-
- /* The outer operation can only be one of the following: */
- if (code != IOR && code != AND && code != XOR
- && code != PLUS && code != MINUS)
- return x;
-
- lhs = XEXP (x, 0), rhs = XEXP (x, 1);
-
- /* If either operand is a primitive we can't do anything, so get out
- fast. */
- if (GET_RTX_CLASS (GET_CODE (lhs)) == 'o'
- || GET_RTX_CLASS (GET_CODE (rhs)) == 'o')
- return x;
-
- lhs = expand_compound_operation (lhs);
- rhs = expand_compound_operation (rhs);
- inner_code = GET_CODE (lhs);
- if (inner_code != GET_CODE (rhs))
- return x;
-
- /* See if the inner and outer operations distribute. */
- switch (inner_code)
- {
- case LSHIFTRT:
- case ASHIFTRT:
- case AND:
- case IOR:
- /* These all distribute except over PLUS. */
- if (code == PLUS || code == MINUS)
- return x;
- break;
-
- case MULT:
- if (code != PLUS && code != MINUS)
- return x;
- break;
-
- case ASHIFT:
- /* This is also a multiply, so it distributes over everything. */
- break;
-
- case SUBREG:
- /* Non-paradoxical SUBREGs distributes over all operations, provided
- the inner modes and word numbers are the same, this is an extraction
- of a low-order part, we don't convert an fp operation to int or
- vice versa, and we would not be converting a single-word
- operation into a multi-word operation. The latter test is not
- required, but it prevents generating unneeded multi-word operations.
- Some of the previous tests are redundant given the latter test, but
- are retained because they are required for correctness.
-
- We produce the result slightly differently in this case. */
-
- if (GET_MODE (SUBREG_REG (lhs)) != GET_MODE (SUBREG_REG (rhs))
- || SUBREG_WORD (lhs) != SUBREG_WORD (rhs)
- || ! subreg_lowpart_p (lhs)
- || (GET_MODE_CLASS (GET_MODE (lhs))
- != GET_MODE_CLASS (GET_MODE (SUBREG_REG (lhs))))
- || (GET_MODE_SIZE (GET_MODE (lhs))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (lhs))))
- || GET_MODE_SIZE (GET_MODE (SUBREG_REG (lhs))) > UNITS_PER_WORD)
- return x;
-
- tem = gen_binary (code, GET_MODE (SUBREG_REG (lhs)),
- SUBREG_REG (lhs), SUBREG_REG (rhs));
- return gen_lowpart_for_combine (GET_MODE (x), tem);
-
- default:
- return x;
- }
-
- /* Set LHS and RHS to the inner operands (A and B in the example
- above) and set OTHER to the common operand (C in the example).
- These is only one way to do this unless the inner operation is
- commutative. */
- if (GET_RTX_CLASS (inner_code) == 'c'
- && rtx_equal_p (XEXP (lhs, 0), XEXP (rhs, 0)))
- other = XEXP (lhs, 0), lhs = XEXP (lhs, 1), rhs = XEXP (rhs, 1);
- else if (GET_RTX_CLASS (inner_code) == 'c'
- && rtx_equal_p (XEXP (lhs, 0), XEXP (rhs, 1)))
- other = XEXP (lhs, 0), lhs = XEXP (lhs, 1), rhs = XEXP (rhs, 0);
- else if (GET_RTX_CLASS (inner_code) == 'c'
- && rtx_equal_p (XEXP (lhs, 1), XEXP (rhs, 0)))
- other = XEXP (lhs, 1), lhs = XEXP (lhs, 0), rhs = XEXP (rhs, 1);
- else if (rtx_equal_p (XEXP (lhs, 1), XEXP (rhs, 1)))
- other = XEXP (lhs, 1), lhs = XEXP (lhs, 0), rhs = XEXP (rhs, 0);
- else
- return x;
-
- /* Form the new inner operation, seeing if it simplifies first. */
- tem = gen_binary (code, GET_MODE (x), lhs, rhs);
-
- /* There is one exception to the general way of distributing:
- (a ^ b) | (a ^ c) -> (~a) & (b ^ c) */
- if (code == XOR && inner_code == IOR)
- {
- inner_code = AND;
- other = gen_unary (NOT, GET_MODE (x), GET_MODE (x), other);
- }
-
- /* We may be able to continuing distributing the result, so call
- ourselves recursively on the inner operation before forming the
- outer operation, which we return. */
- return gen_binary (inner_code, GET_MODE (x),
- apply_distributive_law (tem), other);
-}
-
-/* We have X, a logical `and' of VAROP with the constant CONSTOP, to be done
- in MODE.
-
- Return an equivalent form, if different from X. Otherwise, return X. If
- X is zero, we are to always construct the equivalent form. */
-
-static rtx
-simplify_and_const_int (x, mode, varop, constop)
- rtx x;
- enum machine_mode mode;
- rtx varop;
- unsigned HOST_WIDE_INT constop;
-{
- unsigned HOST_WIDE_INT nonzero;
- int width = GET_MODE_BITSIZE (mode);
- int i;
-
- /* Simplify VAROP knowing that we will be only looking at some of the
- bits in it. */
- varop = force_to_mode (varop, mode, constop, NULL_RTX, 0);
-
- /* If VAROP is a CLOBBER, we will fail so return it; if it is a
- CONST_INT, we are done. */
- if (GET_CODE (varop) == CLOBBER || GET_CODE (varop) == CONST_INT)
- return varop;
-
- /* See what bits may be nonzero in VAROP. Unlike the general case of
- a call to nonzero_bits, here we don't care about bits outside
- MODE. */
-
- nonzero = nonzero_bits (varop, mode) & GET_MODE_MASK (mode);
-
- /* If this would be an entire word for the target, but is not for
- the host, then sign-extend on the host so that the number will look
- the same way on the host that it would on the target.
-
- For example, when building a 64 bit alpha hosted 32 bit sparc
- targeted compiler, then we want the 32 bit unsigned value -1 to be
- represented as a 64 bit value -1, and not as 0x00000000ffffffff.
- The later confuses the sparc backend. */
-
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
- && (nonzero & ((HOST_WIDE_INT) 1 << (width - 1))))
- nonzero |= ((HOST_WIDE_INT) (-1) << width);
-
- /* Turn off all bits in the constant that are known to already be zero.
- Thus, if the AND isn't needed at all, we will have CONSTOP == NONZERO_BITS
- which is tested below. */
-
- constop &= nonzero;
-
- /* If we don't have any bits left, return zero. */
- if (constop == 0)
- return const0_rtx;
-
- /* If VAROP is a NEG of something known to be zero or 1 and CONSTOP is
- a power of two, we can replace this with a ASHIFT. */
- if (GET_CODE (varop) == NEG && nonzero_bits (XEXP (varop, 0), mode) == 1
- && (i = exact_log2 (constop)) >= 0)
- return simplify_shift_const (NULL_RTX, ASHIFT, mode, XEXP (varop, 0), i);
-
- /* If VAROP is an IOR or XOR, apply the AND to both branches of the IOR
- or XOR, then try to apply the distributive law. This may eliminate
- operations if either branch can be simplified because of the AND.
- It may also make some cases more complex, but those cases probably
- won't match a pattern either with or without this. */
-
- if (GET_CODE (varop) == IOR || GET_CODE (varop) == XOR)
- return
- gen_lowpart_for_combine
- (mode,
- apply_distributive_law
- (gen_binary (GET_CODE (varop), GET_MODE (varop),
- simplify_and_const_int (NULL_RTX, GET_MODE (varop),
- XEXP (varop, 0), constop),
- simplify_and_const_int (NULL_RTX, GET_MODE (varop),
- XEXP (varop, 1), constop))));
-
- /* Get VAROP in MODE. Try to get a SUBREG if not. Don't make a new SUBREG
- if we already had one (just check for the simplest cases). */
- if (x && GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_MODE (XEXP (x, 0)) == mode
- && SUBREG_REG (XEXP (x, 0)) == varop)
- varop = XEXP (x, 0);
- else
- varop = gen_lowpart_for_combine (mode, varop);
-
- /* If we can't make the SUBREG, try to return what we were given. */
- if (GET_CODE (varop) == CLOBBER)
- return x ? x : varop;
-
- /* If we are only masking insignificant bits, return VAROP. */
- if (constop == nonzero)
- x = varop;
-
- /* Otherwise, return an AND. See how much, if any, of X we can use. */
- else if (x == 0 || GET_CODE (x) != AND || GET_MODE (x) != mode)
- x = gen_binary (AND, mode, varop, GEN_INT (constop));
-
- else
- {
- if (GET_CODE (XEXP (x, 1)) != CONST_INT
- || INTVAL (XEXP (x, 1)) != constop)
- SUBST (XEXP (x, 1), GEN_INT (constop));
-
- SUBST (XEXP (x, 0), varop);
- }
-
- return x;
-}
-
-/* We let num_sign_bit_copies recur into nonzero_bits as that is useful.
- We don't let nonzero_bits recur into num_sign_bit_copies, because that
- is less useful. We can't allow both, because that results in exponential
- run time recusion. There is a nullstone testcase that triggered
- this. This macro avoids accidental uses of num_sign_bit_copies. */
-#define num_sign_bit_copies()
-
-/* Given an expression, X, compute which bits in X can be non-zero.
- We don't care about bits outside of those defined in MODE.
-
- For most X this is simply GET_MODE_MASK (GET_MODE (MODE)), but if X is
- a shift, AND, or zero_extract, we can do better. */
-
-static unsigned HOST_WIDE_INT
-nonzero_bits (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- unsigned HOST_WIDE_INT nonzero = GET_MODE_MASK (mode);
- unsigned HOST_WIDE_INT inner_nz;
- enum rtx_code code;
- int mode_width = GET_MODE_BITSIZE (mode);
- rtx tem;
-
- /* For floating-point values, assume all bits are needed. */
- if (FLOAT_MODE_P (GET_MODE (x)) || FLOAT_MODE_P (mode))
- return nonzero;
-
- /* If X is wider than MODE, use its mode instead. */
- if (GET_MODE_BITSIZE (GET_MODE (x)) > mode_width)
- {
- mode = GET_MODE (x);
- nonzero = GET_MODE_MASK (mode);
- mode_width = GET_MODE_BITSIZE (mode);
- }
-
- if (mode_width > HOST_BITS_PER_WIDE_INT)
- /* Our only callers in this case look for single bit values. So
- just return the mode mask. Those tests will then be false. */
- return nonzero;
-
-#ifndef WORD_REGISTER_OPERATIONS
- /* If MODE is wider than X, but both are a single word for both the host
- and target machines, we can compute this from which bits of the
- object might be nonzero in its own mode, taking into account the fact
- that on many CISC machines, accessing an object in a wider mode
- causes the high-order bits to become undefined. So they are
- not known to be zero. */
-
- if (GET_MODE (x) != VOIDmode && GET_MODE (x) != mode
- && GET_MODE_BITSIZE (GET_MODE (x)) <= BITS_PER_WORD
- && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT
- && GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (GET_MODE (x)))
- {
- nonzero &= nonzero_bits (x, GET_MODE (x));
- nonzero |= GET_MODE_MASK (mode) & ~ GET_MODE_MASK (GET_MODE (x));
- return nonzero;
- }
-#endif
-
- code = GET_CODE (x);
- switch (code)
- {
- case REG:
-#ifdef POINTERS_EXTEND_UNSIGNED
- /* If pointers extend unsigned and this is a pointer in Pmode, say that
- all the bits above ptr_mode are known to be zero. */
- if (POINTERS_EXTEND_UNSIGNED && GET_MODE (x) == Pmode
- && REGNO_POINTER_FLAG (REGNO (x)))
- nonzero &= GET_MODE_MASK (ptr_mode);
-#endif
-
-#ifdef STACK_BOUNDARY
- /* If this is the stack pointer, we may know something about its
- alignment. If PUSH_ROUNDING is defined, it is possible for the
- stack to be momentarily aligned only to that amount, so we pick
- the least alignment. */
-
- /* We can't check for arg_pointer_rtx here, because it is not
- guaranteed to have as much alignment as the stack pointer.
- In particular, in the Irix6 n64 ABI, the stack has 128 bit
- alignment but the argument pointer has only 64 bit alignment. */
-
- if (x == stack_pointer_rtx || x == frame_pointer_rtx
- || x == hard_frame_pointer_rtx
- || (REGNO (x) >= FIRST_VIRTUAL_REGISTER
- && REGNO (x) <= LAST_VIRTUAL_REGISTER))
- {
- int sp_alignment = STACK_BOUNDARY / BITS_PER_UNIT;
-
-#ifdef PUSH_ROUNDING
- if (REGNO (x) == STACK_POINTER_REGNUM)
- sp_alignment = MIN (PUSH_ROUNDING (1), sp_alignment);
-#endif
-
- /* We must return here, otherwise we may get a worse result from
- one of the choices below. There is nothing useful below as
- far as the stack pointer is concerned. */
- return nonzero &= ~ (sp_alignment - 1);
- }
-#endif
-
- /* If X is a register whose nonzero bits value is current, use it.
- Otherwise, if X is a register whose value we can find, use that
- value. Otherwise, use the previously-computed global nonzero bits
- for this register. */
-
- if (reg_last_set_value[REGNO (x)] != 0
- && reg_last_set_mode[REGNO (x)] == mode
- && (reg_n_sets[REGNO (x)] == 1
- || reg_last_set_label[REGNO (x)] == label_tick)
- && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
- return reg_last_set_nonzero_bits[REGNO (x)];
-
- tem = get_last_value (x);
-
- if (tem)
- {
-#ifdef SHORT_IMMEDIATES_SIGN_EXTEND
- /* If X is narrower than MODE and TEM is a non-negative
- constant that would appear negative in the mode of X,
- sign-extend it for use in reg_nonzero_bits because some
- machines (maybe most) will actually do the sign-extension
- and this is the conservative approach.
-
- ??? For 2.5, try to tighten up the MD files in this regard
- instead of this kludge. */
-
- if (GET_MODE_BITSIZE (GET_MODE (x)) < mode_width
- && GET_CODE (tem) == CONST_INT
- && INTVAL (tem) > 0
- && 0 != (INTVAL (tem)
- & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (x)) - 1))))
- tem = GEN_INT (INTVAL (tem)
- | ((HOST_WIDE_INT) (-1)
- << GET_MODE_BITSIZE (GET_MODE (x))));
-#endif
- return nonzero_bits (tem, mode);
- }
- else if (nonzero_sign_valid && reg_nonzero_bits[REGNO (x)])
- return reg_nonzero_bits[REGNO (x)] & nonzero;
- else
- return nonzero;
-
- case CONST_INT:
-#ifdef SHORT_IMMEDIATES_SIGN_EXTEND
- /* If X is negative in MODE, sign-extend the value. */
- if (INTVAL (x) > 0 && mode_width < BITS_PER_WORD
- && 0 != (INTVAL (x) & ((HOST_WIDE_INT) 1 << (mode_width - 1))))
- return (INTVAL (x) | ((HOST_WIDE_INT) (-1) << mode_width));
-#endif
-
- return INTVAL (x);
-
- case MEM:
-#ifdef LOAD_EXTEND_OP
- /* In many, if not most, RISC machines, reading a byte from memory
- zeros the rest of the register. Noticing that fact saves a lot
- of extra zero-extends. */
- if (LOAD_EXTEND_OP (GET_MODE (x)) == ZERO_EXTEND)
- nonzero &= GET_MODE_MASK (GET_MODE (x));
-#endif
- break;
-
- case EQ: case NE:
- case GT: case GTU:
- case LT: case LTU:
- case GE: case GEU:
- case LE: case LEU:
-
- /* If this produces an integer result, we know which bits are set.
- Code here used to clear bits outside the mode of X, but that is
- now done above. */
-
- if (GET_MODE_CLASS (mode) == MODE_INT
- && mode_width <= HOST_BITS_PER_WIDE_INT)
- nonzero = STORE_FLAG_VALUE;
- break;
-
- case NEG:
-#if 0
- /* Disabled to avoid exponential mutual recursion between nonzero_bits
- and num_sign_bit_copies. */
- if (num_sign_bit_copies (XEXP (x, 0), GET_MODE (x))
- == GET_MODE_BITSIZE (GET_MODE (x)))
- nonzero = 1;
-#endif
-
- if (GET_MODE_SIZE (GET_MODE (x)) < mode_width)
- nonzero |= (GET_MODE_MASK (mode) & ~ GET_MODE_MASK (GET_MODE (x)));
- break;
-
- case ABS:
-#if 0
- /* Disabled to avoid exponential mutual recursion between nonzero_bits
- and num_sign_bit_copies. */
- if (num_sign_bit_copies (XEXP (x, 0), GET_MODE (x))
- == GET_MODE_BITSIZE (GET_MODE (x)))
- nonzero = 1;
-#endif
- break;
-
- case TRUNCATE:
- nonzero &= (nonzero_bits (XEXP (x, 0), mode) & GET_MODE_MASK (mode));
- break;
-
- case ZERO_EXTEND:
- nonzero &= nonzero_bits (XEXP (x, 0), mode);
- if (GET_MODE (XEXP (x, 0)) != VOIDmode)
- nonzero &= GET_MODE_MASK (GET_MODE (XEXP (x, 0)));
- break;
-
- case SIGN_EXTEND:
- /* If the sign bit is known clear, this is the same as ZERO_EXTEND.
- Otherwise, show all the bits in the outer mode but not the inner
- may be non-zero. */
- inner_nz = nonzero_bits (XEXP (x, 0), mode);
- if (GET_MODE (XEXP (x, 0)) != VOIDmode)
- {
- inner_nz &= GET_MODE_MASK (GET_MODE (XEXP (x, 0)));
- if (inner_nz &
- (((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - 1))))
- inner_nz |= (GET_MODE_MASK (mode)
- & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0))));
- }
-
- nonzero &= inner_nz;
- break;
-
- case AND:
- nonzero &= (nonzero_bits (XEXP (x, 0), mode)
- & nonzero_bits (XEXP (x, 1), mode));
- break;
-
- case XOR: case IOR:
- case UMIN: case UMAX: case SMIN: case SMAX:
- nonzero &= (nonzero_bits (XEXP (x, 0), mode)
- | nonzero_bits (XEXP (x, 1), mode));
- break;
-
- case PLUS: case MINUS:
- case MULT:
- case DIV: case UDIV:
- case MOD: case UMOD:
- /* We can apply the rules of arithmetic to compute the number of
- high- and low-order zero bits of these operations. We start by
- computing the width (position of the highest-order non-zero bit)
- and the number of low-order zero bits for each value. */
- {
- unsigned HOST_WIDE_INT nz0 = nonzero_bits (XEXP (x, 0), mode);
- unsigned HOST_WIDE_INT nz1 = nonzero_bits (XEXP (x, 1), mode);
- int width0 = floor_log2 (nz0) + 1;
- int width1 = floor_log2 (nz1) + 1;
- int low0 = floor_log2 (nz0 & -nz0);
- int low1 = floor_log2 (nz1 & -nz1);
- HOST_WIDE_INT op0_maybe_minusp
- = (nz0 & ((HOST_WIDE_INT) 1 << (mode_width - 1)));
- HOST_WIDE_INT op1_maybe_minusp
- = (nz1 & ((HOST_WIDE_INT) 1 << (mode_width - 1)));
- int result_width = mode_width;
- int result_low = 0;
-
- switch (code)
- {
- case PLUS:
- result_width = MAX (width0, width1) + 1;
- result_low = MIN (low0, low1);
- break;
- case MINUS:
- result_low = MIN (low0, low1);
- break;
- case MULT:
- result_width = width0 + width1;
- result_low = low0 + low1;
- break;
- case DIV:
- if (! op0_maybe_minusp && ! op1_maybe_minusp)
- result_width = width0;
- break;
- case UDIV:
- result_width = width0;
- break;
- case MOD:
- if (! op0_maybe_minusp && ! op1_maybe_minusp)
- result_width = MIN (width0, width1);
- result_low = MIN (low0, low1);
- break;
- case UMOD:
- result_width = MIN (width0, width1);
- result_low = MIN (low0, low1);
- break;
- }
-
- if (result_width < mode_width)
- nonzero &= ((HOST_WIDE_INT) 1 << result_width) - 1;
-
- if (result_low > 0)
- nonzero &= ~ (((HOST_WIDE_INT) 1 << result_low) - 1);
- }
- break;
-
- case ZERO_EXTRACT:
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT)
- nonzero &= ((HOST_WIDE_INT) 1 << INTVAL (XEXP (x, 1))) - 1;
- break;
-
- case SUBREG:
- /* If this is a SUBREG formed for a promoted variable that has
- been zero-extended, we know that at least the high-order bits
- are zero, though others might be too. */
-
- if (SUBREG_PROMOTED_VAR_P (x) && SUBREG_PROMOTED_UNSIGNED_P (x))
- nonzero = (GET_MODE_MASK (GET_MODE (x))
- & nonzero_bits (SUBREG_REG (x), GET_MODE (x)));
-
- /* If the inner mode is a single word for both the host and target
- machines, we can compute this from which bits of the inner
- object might be nonzero. */
- if (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) <= BITS_PER_WORD
- && (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x)))
- <= HOST_BITS_PER_WIDE_INT))
- {
- nonzero &= nonzero_bits (SUBREG_REG (x), mode);
-
-#ifndef WORD_REGISTER_OPERATIONS
- /* On many CISC machines, accessing an object in a wider mode
- causes the high-order bits to become undefined. So they are
- not known to be zero. */
- if (GET_MODE_SIZE (GET_MODE (x))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- nonzero |= (GET_MODE_MASK (GET_MODE (x))
- & ~ GET_MODE_MASK (GET_MODE (SUBREG_REG (x))));
-#endif
- }
- break;
-
- case ASHIFTRT:
- case LSHIFTRT:
- case ASHIFT:
- case ROTATE:
- /* The nonzero bits are in two classes: any bits within MODE
- that aren't in GET_MODE (x) are always significant. The rest of the
- nonzero bits are those that are significant in the operand of
- the shift when shifted the appropriate number of bits. This
- shows that high-order bits are cleared by the right shift and
- low-order bits by left shifts. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) >= 0
- && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT)
- {
- enum machine_mode inner_mode = GET_MODE (x);
- int width = GET_MODE_BITSIZE (inner_mode);
- int count = INTVAL (XEXP (x, 1));
- unsigned HOST_WIDE_INT mode_mask = GET_MODE_MASK (inner_mode);
- unsigned HOST_WIDE_INT op_nonzero = nonzero_bits (XEXP (x, 0), mode);
- unsigned HOST_WIDE_INT inner = op_nonzero & mode_mask;
- unsigned HOST_WIDE_INT outer = 0;
-
- if (mode_width > width)
- outer = (op_nonzero & nonzero & ~ mode_mask);
-
- if (code == LSHIFTRT)
- inner >>= count;
- else if (code == ASHIFTRT)
- {
- inner >>= count;
-
- /* If the sign bit may have been nonzero before the shift, we
- need to mark all the places it could have been copied to
- by the shift as possibly nonzero. */
- if (inner & ((HOST_WIDE_INT) 1 << (width - 1 - count)))
- inner |= (((HOST_WIDE_INT) 1 << count) - 1) << (width - count);
- }
- else if (code == ASHIFT)
- inner <<= count;
- else
- inner = ((inner << (count % width)
- | (inner >> (width - (count % width)))) & mode_mask);
-
- nonzero &= (outer | inner);
- }
- break;
-
- case FFS:
- /* This is at most the number of bits in the mode. */
- nonzero = ((HOST_WIDE_INT) 1 << (floor_log2 (mode_width) + 1)) - 1;
- break;
-
- case IF_THEN_ELSE:
- nonzero &= (nonzero_bits (XEXP (x, 1), mode)
- | nonzero_bits (XEXP (x, 2), mode));
- break;
- }
-
- return nonzero;
-}
-
-/* See the macro definition above. */
-#undef num_sign_bit_copies
-
-/* Return the number of bits at the high-order end of X that are known to
- be equal to the sign bit. X will be used in mode MODE; if MODE is
- VOIDmode, X will be used in its own mode. The returned value will always
- be between 1 and the number of bits in MODE. */
-
-static int
-num_sign_bit_copies (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (x);
- int bitwidth;
- int num0, num1, result;
- unsigned HOST_WIDE_INT nonzero;
- rtx tem;
-
- /* If we weren't given a mode, use the mode of X. If the mode is still
- VOIDmode, we don't know anything. Likewise if one of the modes is
- floating-point. */
-
- if (mode == VOIDmode)
- mode = GET_MODE (x);
-
- if (mode == VOIDmode || FLOAT_MODE_P (mode) || FLOAT_MODE_P (GET_MODE (x)))
- return 1;
-
- bitwidth = GET_MODE_BITSIZE (mode);
-
- /* For a smaller object, just ignore the high bits. */
- if (bitwidth < GET_MODE_BITSIZE (GET_MODE (x)))
- return MAX (1, (num_sign_bit_copies (x, GET_MODE (x))
- - (GET_MODE_BITSIZE (GET_MODE (x)) - bitwidth)));
-
-#ifndef WORD_REGISTER_OPERATIONS
- /* If this machine does not do all register operations on the entire
- register and MODE is wider than the mode of X, we can say nothing
- at all about the high-order bits. */
- if (GET_MODE (x) != VOIDmode && bitwidth > GET_MODE_BITSIZE (GET_MODE (x)))
- return 1;
-#endif
-
- switch (code)
- {
- case REG:
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- /* If pointers extend signed and this is a pointer in Pmode, say that
- all the bits above ptr_mode are known to be sign bit copies. */
- if (! POINTERS_EXTEND_UNSIGNED && GET_MODE (x) == Pmode && mode == Pmode
- && REGNO_POINTER_FLAG (REGNO (x)))
- return GET_MODE_BITSIZE (Pmode) - GET_MODE_BITSIZE (ptr_mode) + 1;
-#endif
-
- if (reg_last_set_value[REGNO (x)] != 0
- && reg_last_set_mode[REGNO (x)] == mode
- && (reg_n_sets[REGNO (x)] == 1
- || reg_last_set_label[REGNO (x)] == label_tick)
- && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
- return reg_last_set_sign_bit_copies[REGNO (x)];
-
- tem = get_last_value (x);
- if (tem != 0)
- return num_sign_bit_copies (tem, mode);
-
- if (nonzero_sign_valid && reg_sign_bit_copies[REGNO (x)] != 0)
- return reg_sign_bit_copies[REGNO (x)];
- break;
-
- case MEM:
-#ifdef LOAD_EXTEND_OP
- /* Some RISC machines sign-extend all loads of smaller than a word. */
- if (LOAD_EXTEND_OP (GET_MODE (x)) == SIGN_EXTEND)
- return MAX (1, bitwidth - GET_MODE_BITSIZE (GET_MODE (x)) + 1);
-#endif
- break;
-
- case CONST_INT:
- /* If the constant is negative, take its 1's complement and remask.
- Then see how many zero bits we have. */
- nonzero = INTVAL (x) & GET_MODE_MASK (mode);
- if (bitwidth <= HOST_BITS_PER_WIDE_INT
- && (nonzero & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)
- nonzero = (~ nonzero) & GET_MODE_MASK (mode);
-
- return (nonzero == 0 ? bitwidth : bitwidth - floor_log2 (nonzero) - 1);
-
- case SUBREG:
- /* If this is a SUBREG for a promoted object that is sign-extended
- and we are looking at it in a wider mode, we know that at least the
- high-order bits are known to be sign bit copies. */
-
- if (SUBREG_PROMOTED_VAR_P (x) && ! SUBREG_PROMOTED_UNSIGNED_P (x))
- return MAX (bitwidth - GET_MODE_BITSIZE (GET_MODE (x)) + 1,
- num_sign_bit_copies (SUBREG_REG (x), mode));
-
- /* For a smaller object, just ignore the high bits. */
- if (bitwidth <= GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))))
- {
- num0 = num_sign_bit_copies (SUBREG_REG (x), VOIDmode);
- return MAX (1, (num0
- - (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x)))
- - bitwidth)));
- }
-
-#ifdef WORD_REGISTER_OPERATIONS
-#ifdef LOAD_EXTEND_OP
- /* For paradoxical SUBREGs on machines where all register operations
- affect the entire register, just look inside. Note that we are
- passing MODE to the recursive call, so the number of sign bit copies
- will remain relative to that mode, not the inner mode. */
-
- /* This works only if loads sign extend. Otherwise, if we get a
- reload for the inner part, it may be loaded from the stack, and
- then we lose all sign bit copies that existed before the store
- to the stack. */
-
- if ((GET_MODE_SIZE (GET_MODE (x))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) == SIGN_EXTEND)
- return num_sign_bit_copies (SUBREG_REG (x), mode);
-#endif
-#endif
- break;
-
- case SIGN_EXTRACT:
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- return MAX (1, bitwidth - INTVAL (XEXP (x, 1)));
- break;
-
- case SIGN_EXTEND:
- return (bitwidth - GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))
- + num_sign_bit_copies (XEXP (x, 0), VOIDmode));
-
- case TRUNCATE:
- /* For a smaller object, just ignore the high bits. */
- num0 = num_sign_bit_copies (XEXP (x, 0), VOIDmode);
- return MAX (1, (num0 - (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))
- - bitwidth)));
-
- case NOT:
- return num_sign_bit_copies (XEXP (x, 0), mode);
-
- case ROTATE: case ROTATERT:
- /* If we are rotating left by a number of bits less than the number
- of sign bit copies, we can just subtract that amount from the
- number. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) >= 0 && INTVAL (XEXP (x, 1)) < bitwidth)
- {
- num0 = num_sign_bit_copies (XEXP (x, 0), mode);
- return MAX (1, num0 - (code == ROTATE ? INTVAL (XEXP (x, 1))
- : bitwidth - INTVAL (XEXP (x, 1))));
- }
- break;
-
- case NEG:
- /* In general, this subtracts one sign bit copy. But if the value
- is known to be positive, the number of sign bit copies is the
- same as that of the input. Finally, if the input has just one bit
- that might be nonzero, all the bits are copies of the sign bit. */
- nonzero = nonzero_bits (XEXP (x, 0), mode);
- if (nonzero == 1)
- return bitwidth;
-
- num0 = num_sign_bit_copies (XEXP (x, 0), mode);
- if (num0 > 1
- && bitwidth <= HOST_BITS_PER_WIDE_INT
- && (((HOST_WIDE_INT) 1 << (bitwidth - 1)) & nonzero))
- num0--;
-
- return num0;
-
- case IOR: case AND: case XOR:
- case SMIN: case SMAX: case UMIN: case UMAX:
- /* Logical operations will preserve the number of sign-bit copies.
- MIN and MAX operations always return one of the operands. */
- num0 = num_sign_bit_copies (XEXP (x, 0), mode);
- num1 = num_sign_bit_copies (XEXP (x, 1), mode);
- return MIN (num0, num1);
-
- case PLUS: case MINUS:
- /* For addition and subtraction, we can have a 1-bit carry. However,
- if we are subtracting 1 from a positive number, there will not
- be such a carry. Furthermore, if the positive number is known to
- be 0 or 1, we know the result is either -1 or 0. */
-
- if (code == PLUS && XEXP (x, 1) == constm1_rtx
- && bitwidth <= HOST_BITS_PER_WIDE_INT)
- {
- nonzero = nonzero_bits (XEXP (x, 0), mode);
- if ((((HOST_WIDE_INT) 1 << (bitwidth - 1)) & nonzero) == 0)
- return (nonzero == 1 || nonzero == 0 ? bitwidth
- : bitwidth - floor_log2 (nonzero) - 1);
- }
-
- num0 = num_sign_bit_copies (XEXP (x, 0), mode);
- num1 = num_sign_bit_copies (XEXP (x, 1), mode);
- return MAX (1, MIN (num0, num1) - 1);
-
- case MULT:
- /* The number of bits of the product is the sum of the number of
- bits of both terms. However, unless one of the terms if known
- to be positive, we must allow for an additional bit since negating
- a negative number can remove one sign bit copy. */
-
- num0 = num_sign_bit_copies (XEXP (x, 0), mode);
- num1 = num_sign_bit_copies (XEXP (x, 1), mode);
-
- result = bitwidth - (bitwidth - num0) - (bitwidth - num1);
- if (result > 0
- && bitwidth <= HOST_BITS_PER_WIDE_INT
- && ((nonzero_bits (XEXP (x, 0), mode)
- & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)
- && ((nonzero_bits (XEXP (x, 1), mode)
- & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0))
- result--;
-
- return MAX (1, result);
-
- case UDIV:
- /* The result must be <= the first operand. */
- return num_sign_bit_copies (XEXP (x, 0), mode);
-
- case UMOD:
- /* The result must be <= the scond operand. */
- return num_sign_bit_copies (XEXP (x, 1), mode);
-
- case DIV:
- /* Similar to unsigned division, except that we have to worry about
- the case where the divisor is negative, in which case we have
- to add 1. */
- result = num_sign_bit_copies (XEXP (x, 0), mode);
- if (result > 1
- && bitwidth <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (XEXP (x, 1), mode)
- & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)
- result --;
-
- return result;
-
- case MOD:
- result = num_sign_bit_copies (XEXP (x, 1), mode);
- if (result > 1
- && bitwidth <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (XEXP (x, 1), mode)
- & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)
- result --;
-
- return result;
-
- case ASHIFTRT:
- /* Shifts by a constant add to the number of bits equal to the
- sign bit. */
- num0 = num_sign_bit_copies (XEXP (x, 0), mode);
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) > 0)
- num0 = MIN (bitwidth, num0 + INTVAL (XEXP (x, 1)));
-
- return num0;
-
- case ASHIFT:
- /* Left shifts destroy copies. */
- if (GET_CODE (XEXP (x, 1)) != CONST_INT
- || INTVAL (XEXP (x, 1)) < 0
- || INTVAL (XEXP (x, 1)) >= bitwidth)
- return 1;
-
- num0 = num_sign_bit_copies (XEXP (x, 0), mode);
- return MAX (1, num0 - INTVAL (XEXP (x, 1)));
-
- case IF_THEN_ELSE:
- num0 = num_sign_bit_copies (XEXP (x, 1), mode);
- num1 = num_sign_bit_copies (XEXP (x, 2), mode);
- return MIN (num0, num1);
-
- case EQ: case NE: case GE: case GT: case LE: case LT:
- case GEU: case GTU: case LEU: case LTU:
- if (STORE_FLAG_VALUE == -1)
- return bitwidth;
- }
-
- /* If we haven't been able to figure it out by one of the above rules,
- see if some of the high-order bits are known to be zero. If so,
- count those bits and return one less than that amount. If we can't
- safely compute the mask for this mode, always return BITWIDTH. */
-
- if (bitwidth > HOST_BITS_PER_WIDE_INT)
- return 1;
-
- nonzero = nonzero_bits (x, mode);
- return (nonzero & ((HOST_WIDE_INT) 1 << (bitwidth - 1))
- ? 1 : bitwidth - floor_log2 (nonzero) - 1);
-}
-
-/* Return the number of "extended" bits there are in X, when interpreted
- as a quantity in MODE whose signedness is indicated by UNSIGNEDP. For
- unsigned quantities, this is the number of high-order zero bits.
- For signed quantities, this is the number of copies of the sign bit
- minus 1. In both case, this function returns the number of "spare"
- bits. For example, if two quantities for which this function returns
- at least 1 are added, the addition is known not to overflow.
-
- This function will always return 0 unless called during combine, which
- implies that it must be called from a define_split. */
-
-int
-extended_count (x, mode, unsignedp)
- rtx x;
- enum machine_mode mode;
- int unsignedp;
-{
- if (nonzero_sign_valid == 0)
- return 0;
-
- return (unsignedp
- ? (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && (GET_MODE_BITSIZE (mode) - 1
- - floor_log2 (nonzero_bits (x, mode))))
- : num_sign_bit_copies (x, mode) - 1);
-}
-
-/* This function is called from `simplify_shift_const' to merge two
- outer operations. Specifically, we have already found that we need
- to perform operation *POP0 with constant *PCONST0 at the outermost
- position. We would now like to also perform OP1 with constant CONST1
- (with *POP0 being done last).
-
- Return 1 if we can do the operation and update *POP0 and *PCONST0 with
- the resulting operation. *PCOMP_P is set to 1 if we would need to
- complement the innermost operand, otherwise it is unchanged.
-
- MODE is the mode in which the operation will be done. No bits outside
- the width of this mode matter. It is assumed that the width of this mode
- is smaller than or equal to HOST_BITS_PER_WIDE_INT.
-
- If *POP0 or OP1 are NIL, it means no operation is required. Only NEG, PLUS,
- IOR, XOR, and AND are supported. We may set *POP0 to SET if the proper
- result is simply *PCONST0.
-
- If the resulting operation cannot be expressed as one operation, we
- return 0 and do not change *POP0, *PCONST0, and *PCOMP_P. */
-
-static int
-merge_outer_ops (pop0, pconst0, op1, const1, mode, pcomp_p)
- enum rtx_code *pop0;
- HOST_WIDE_INT *pconst0;
- enum rtx_code op1;
- HOST_WIDE_INT const1;
- enum machine_mode mode;
- int *pcomp_p;
-{
- enum rtx_code op0 = *pop0;
- HOST_WIDE_INT const0 = *pconst0;
- int width = GET_MODE_BITSIZE (mode);
-
- const0 &= GET_MODE_MASK (mode);
- const1 &= GET_MODE_MASK (mode);
-
- /* If OP0 is an AND, clear unimportant bits in CONST1. */
- if (op0 == AND)
- const1 &= const0;
-
- /* If OP0 or OP1 is NIL, this is easy. Similarly if they are the same or
- if OP0 is SET. */
-
- if (op1 == NIL || op0 == SET)
- return 1;
-
- else if (op0 == NIL)
- op0 = op1, const0 = const1;
-
- else if (op0 == op1)
- {
- switch (op0)
- {
- case AND:
- const0 &= const1;
- break;
- case IOR:
- const0 |= const1;
- break;
- case XOR:
- const0 ^= const1;
- break;
- case PLUS:
- const0 += const1;
- break;
- case NEG:
- op0 = NIL;
- break;
- }
- }
-
- /* Otherwise, if either is a PLUS or NEG, we can't do anything. */
- else if (op0 == PLUS || op1 == PLUS || op0 == NEG || op1 == NEG)
- return 0;
-
- /* If the two constants aren't the same, we can't do anything. The
- remaining six cases can all be done. */
- else if (const0 != const1)
- return 0;
-
- else
- switch (op0)
- {
- case IOR:
- if (op1 == AND)
- /* (a & b) | b == b */
- op0 = SET;
- else /* op1 == XOR */
- /* (a ^ b) | b == a | b */
- ;
- break;
-
- case XOR:
- if (op1 == AND)
- /* (a & b) ^ b == (~a) & b */
- op0 = AND, *pcomp_p = 1;
- else /* op1 == IOR */
- /* (a | b) ^ b == a & ~b */
- op0 = AND, *pconst0 = ~ const0;
- break;
-
- case AND:
- if (op1 == IOR)
- /* (a | b) & b == b */
- op0 = SET;
- else /* op1 == XOR */
- /* (a ^ b) & b) == (~a) & b */
- *pcomp_p = 1;
- break;
- }
-
- /* Check for NO-OP cases. */
- const0 &= GET_MODE_MASK (mode);
- if (const0 == 0
- && (op0 == IOR || op0 == XOR || op0 == PLUS))
- op0 = NIL;
- else if (const0 == 0 && op0 == AND)
- op0 = SET;
- else if (const0 == GET_MODE_MASK (mode) && op0 == AND)
- op0 = NIL;
-
- /* If this would be an entire word for the target, but is not for
- the host, then sign-extend on the host so that the number will look
- the same way on the host that it would on the target.
-
- For example, when building a 64 bit alpha hosted 32 bit sparc
- targeted compiler, then we want the 32 bit unsigned value -1 to be
- represented as a 64 bit value -1, and not as 0x00000000ffffffff.
- The later confuses the sparc backend. */
-
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
- && (const0 & ((HOST_WIDE_INT) 1 << (width - 1))))
- const0 |= ((HOST_WIDE_INT) (-1) << width);
-
- *pop0 = op0;
- *pconst0 = const0;
-
- return 1;
-}
-
-/* Simplify a shift of VAROP by COUNT bits. CODE says what kind of shift.
- The result of the shift is RESULT_MODE. X, if non-zero, is an expression
- that we started with.
-
- The shift is normally computed in the widest mode we find in VAROP, as
- long as it isn't a different number of words than RESULT_MODE. Exceptions
- are ASHIFTRT and ROTATE, which are always done in their original mode, */
-
-static rtx
-simplify_shift_const (x, code, result_mode, varop, count)
- rtx x;
- enum rtx_code code;
- enum machine_mode result_mode;
- rtx varop;
- int count;
-{
- enum rtx_code orig_code = code;
- int orig_count = count;
- enum machine_mode mode = result_mode;
- enum machine_mode shift_mode, tmode;
- int mode_words
- = (GET_MODE_SIZE (mode) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
- /* We form (outer_op (code varop count) (outer_const)). */
- enum rtx_code outer_op = NIL;
- HOST_WIDE_INT outer_const = 0;
- rtx const_rtx;
- int complement_p = 0;
- rtx new;
-
- /* If we were given an invalid count, don't do anything except exactly
- what was requested. */
-
- if (count < 0 || count > GET_MODE_BITSIZE (mode))
- {
- if (x)
- return x;
-
- return gen_rtx (code, mode, varop, GEN_INT (count));
- }
-
- /* Unless one of the branches of the `if' in this loop does a `continue',
- we will `break' the loop after the `if'. */
-
- while (count != 0)
- {
- /* If we have an operand of (clobber (const_int 0)), just return that
- value. */
- if (GET_CODE (varop) == CLOBBER)
- return varop;
-
- /* If we discovered we had to complement VAROP, leave. Making a NOT
- here would cause an infinite loop. */
- if (complement_p)
- break;
-
- /* Convert ROTATERT to ROTATE. */
- if (code == ROTATERT)
- code = ROTATE, count = GET_MODE_BITSIZE (result_mode) - count;
-
- /* We need to determine what mode we will do the shift in. If the
- shift is a right shift or a ROTATE, we must always do it in the mode
- it was originally done in. Otherwise, we can do it in MODE, the
- widest mode encountered. */
- shift_mode
- = (code == ASHIFTRT || code == LSHIFTRT || code == ROTATE
- ? result_mode : mode);
-
- /* Handle cases where the count is greater than the size of the mode
- minus 1. For ASHIFT, use the size minus one as the count (this can
- occur when simplifying (lshiftrt (ashiftrt ..))). For rotates,
- take the count modulo the size. For other shifts, the result is
- zero.
-
- Since these shifts are being produced by the compiler by combining
- multiple operations, each of which are defined, we know what the
- result is supposed to be. */
-
- if (count > GET_MODE_BITSIZE (shift_mode) - 1)
- {
- if (code == ASHIFTRT)
- count = GET_MODE_BITSIZE (shift_mode) - 1;
- else if (code == ROTATE || code == ROTATERT)
- count %= GET_MODE_BITSIZE (shift_mode);
- else
- {
- /* We can't simply return zero because there may be an
- outer op. */
- varop = const0_rtx;
- count = 0;
- break;
- }
- }
-
- /* Negative counts are invalid and should not have been made (a
- programmer-specified negative count should have been handled
- above). */
- else if (count < 0)
- abort ();
-
- /* An arithmetic right shift of a quantity known to be -1 or 0
- is a no-op. */
- if (code == ASHIFTRT
- && (num_sign_bit_copies (varop, shift_mode)
- == GET_MODE_BITSIZE (shift_mode)))
- {
- count = 0;
- break;
- }
-
- /* If we are doing an arithmetic right shift and discarding all but
- the sign bit copies, this is equivalent to doing a shift by the
- bitsize minus one. Convert it into that shift because it will often
- allow other simplifications. */
-
- if (code == ASHIFTRT
- && (count + num_sign_bit_copies (varop, shift_mode)
- >= GET_MODE_BITSIZE (shift_mode)))
- count = GET_MODE_BITSIZE (shift_mode) - 1;
-
- /* We simplify the tests below and elsewhere by converting
- ASHIFTRT to LSHIFTRT if we know the sign bit is clear.
- `make_compound_operation' will convert it to a ASHIFTRT for
- those machines (such as Vax) that don't have a LSHIFTRT. */
- if (GET_MODE_BITSIZE (shift_mode) <= HOST_BITS_PER_WIDE_INT
- && code == ASHIFTRT
- && ((nonzero_bits (varop, shift_mode)
- & ((HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (shift_mode) - 1)))
- == 0))
- code = LSHIFTRT;
-
- switch (GET_CODE (varop))
- {
- case SIGN_EXTEND:
- case ZERO_EXTEND:
- case SIGN_EXTRACT:
- case ZERO_EXTRACT:
- new = expand_compound_operation (varop);
- if (new != varop)
- {
- varop = new;
- continue;
- }
- break;
-
- case MEM:
- /* If we have (xshiftrt (mem ...) C) and C is MODE_WIDTH
- minus the width of a smaller mode, we can do this with a
- SIGN_EXTEND or ZERO_EXTEND from the narrower memory location. */
- if ((code == ASHIFTRT || code == LSHIFTRT)
- && ! mode_dependent_address_p (XEXP (varop, 0))
- && ! MEM_VOLATILE_P (varop)
- && (tmode = mode_for_size (GET_MODE_BITSIZE (mode) - count,
- MODE_INT, 1)) != BLKmode)
- {
- if (BYTES_BIG_ENDIAN)
- new = gen_rtx (MEM, tmode, XEXP (varop, 0));
- else
- new = gen_rtx (MEM, tmode,
- plus_constant (XEXP (varop, 0),
- count / BITS_PER_UNIT));
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (varop);
- MEM_VOLATILE_P (new) = MEM_VOLATILE_P (varop);
- MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (varop);
- varop = gen_rtx_combine (code == ASHIFTRT ? SIGN_EXTEND
- : ZERO_EXTEND, mode, new);
- count = 0;
- continue;
- }
- break;
-
- case USE:
- /* Similar to the case above, except that we can only do this if
- the resulting mode is the same as that of the underlying
- MEM and adjust the address depending on the *bits* endianness
- because of the way that bit-field extract insns are defined. */
- if ((code == ASHIFTRT || code == LSHIFTRT)
- && (tmode = mode_for_size (GET_MODE_BITSIZE (mode) - count,
- MODE_INT, 1)) != BLKmode
- && tmode == GET_MODE (XEXP (varop, 0)))
- {
- if (BITS_BIG_ENDIAN)
- new = XEXP (varop, 0);
- else
- {
- new = copy_rtx (XEXP (varop, 0));
- SUBST (XEXP (new, 0),
- plus_constant (XEXP (new, 0),
- count / BITS_PER_UNIT));
- }
-
- varop = gen_rtx_combine (code == ASHIFTRT ? SIGN_EXTEND
- : ZERO_EXTEND, mode, new);
- count = 0;
- continue;
- }
- break;
-
- case SUBREG:
- /* If VAROP is a SUBREG, strip it as long as the inner operand has
- the same number of words as what we've seen so far. Then store
- the widest mode in MODE. */
- if (subreg_lowpart_p (varop)
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (varop)))
- > GET_MODE_SIZE (GET_MODE (varop)))
- && (((GET_MODE_SIZE (GET_MODE (SUBREG_REG (varop)))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
- == mode_words))
- {
- varop = SUBREG_REG (varop);
- if (GET_MODE_SIZE (GET_MODE (varop)) > GET_MODE_SIZE (mode))
- mode = GET_MODE (varop);
- continue;
- }
- break;
-
- case MULT:
- /* Some machines use MULT instead of ASHIFT because MULT
- is cheaper. But it is still better on those machines to
- merge two shifts into one. */
- if (GET_CODE (XEXP (varop, 1)) == CONST_INT
- && exact_log2 (INTVAL (XEXP (varop, 1))) >= 0)
- {
- varop = gen_binary (ASHIFT, GET_MODE (varop), XEXP (varop, 0),
- GEN_INT (exact_log2 (INTVAL (XEXP (varop, 1)))));;
- continue;
- }
- break;
-
- case UDIV:
- /* Similar, for when divides are cheaper. */
- if (GET_CODE (XEXP (varop, 1)) == CONST_INT
- && exact_log2 (INTVAL (XEXP (varop, 1))) >= 0)
- {
- varop = gen_binary (LSHIFTRT, GET_MODE (varop), XEXP (varop, 0),
- GEN_INT (exact_log2 (INTVAL (XEXP (varop, 1)))));
- continue;
- }
- break;
-
- case ASHIFTRT:
- /* If we are extracting just the sign bit of an arithmetic right
- shift, that shift is not needed. */
- if (code == LSHIFTRT && count == GET_MODE_BITSIZE (result_mode) - 1)
- {
- varop = XEXP (varop, 0);
- continue;
- }
-
- /* ... fall through ... */
-
- case LSHIFTRT:
- case ASHIFT:
- case ROTATE:
- /* Here we have two nested shifts. The result is usually the
- AND of a new shift with a mask. We compute the result below. */
- if (GET_CODE (XEXP (varop, 1)) == CONST_INT
- && INTVAL (XEXP (varop, 1)) >= 0
- && INTVAL (XEXP (varop, 1)) < GET_MODE_BITSIZE (GET_MODE (varop))
- && GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
- {
- enum rtx_code first_code = GET_CODE (varop);
- int first_count = INTVAL (XEXP (varop, 1));
- unsigned HOST_WIDE_INT mask;
- rtx mask_rtx;
-
- /* We have one common special case. We can't do any merging if
- the inner code is an ASHIFTRT of a smaller mode. However, if
- we have (ashift:M1 (subreg:M1 (ashiftrt:M2 FOO C1) 0) C2)
- with C2 == GET_MODE_BITSIZE (M1) - GET_MODE_BITSIZE (M2),
- we can convert it to
- (ashiftrt:M1 (ashift:M1 (and:M1 (subreg:M1 FOO 0 C2) C3) C1).
- This simplifies certain SIGN_EXTEND operations. */
- if (code == ASHIFT && first_code == ASHIFTRT
- && (GET_MODE_BITSIZE (result_mode)
- - GET_MODE_BITSIZE (GET_MODE (varop))) == count)
- {
- /* C3 has the low-order C1 bits zero. */
-
- mask = (GET_MODE_MASK (mode)
- & ~ (((HOST_WIDE_INT) 1 << first_count) - 1));
-
- varop = simplify_and_const_int (NULL_RTX, result_mode,
- XEXP (varop, 0), mask);
- varop = simplify_shift_const (NULL_RTX, ASHIFT, result_mode,
- varop, count);
- count = first_count;
- code = ASHIFTRT;
- continue;
- }
-
- /* If this was (ashiftrt (ashift foo C1) C2) and FOO has more
- than C1 high-order bits equal to the sign bit, we can convert
- this to either an ASHIFT or a ASHIFTRT depending on the
- two counts.
-
- We cannot do this if VAROP's mode is not SHIFT_MODE. */
-
- if (code == ASHIFTRT && first_code == ASHIFT
- && GET_MODE (varop) == shift_mode
- && (num_sign_bit_copies (XEXP (varop, 0), shift_mode)
- > first_count))
- {
- count -= first_count;
- if (count < 0)
- count = - count, code = ASHIFT;
- varop = XEXP (varop, 0);
- continue;
- }
-
- /* There are some cases we can't do. If CODE is ASHIFTRT,
- we can only do this if FIRST_CODE is also ASHIFTRT.
-
- We can't do the case when CODE is ROTATE and FIRST_CODE is
- ASHIFTRT.
-
- If the mode of this shift is not the mode of the outer shift,
- we can't do this if either shift is a right shift or ROTATE.
-
- Finally, we can't do any of these if the mode is too wide
- unless the codes are the same.
-
- Handle the case where the shift codes are the same
- first. */
-
- if (code == first_code)
- {
- if (GET_MODE (varop) != result_mode
- && (code == ASHIFTRT || code == LSHIFTRT
- || code == ROTATE))
- break;
-
- count += first_count;
- varop = XEXP (varop, 0);
- continue;
- }
-
- if (code == ASHIFTRT
- || (code == ROTATE && first_code == ASHIFTRT)
- || GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT
- || (GET_MODE (varop) != result_mode
- && (first_code == ASHIFTRT || first_code == LSHIFTRT
- || first_code == ROTATE
- || code == ROTATE)))
- break;
-
- /* To compute the mask to apply after the shift, shift the
- nonzero bits of the inner shift the same way the
- outer shift will. */
-
- mask_rtx = GEN_INT (nonzero_bits (varop, GET_MODE (varop)));
-
- mask_rtx
- = simplify_binary_operation (code, result_mode, mask_rtx,
- GEN_INT (count));
-
- /* Give up if we can't compute an outer operation to use. */
- if (mask_rtx == 0
- || GET_CODE (mask_rtx) != CONST_INT
- || ! merge_outer_ops (&outer_op, &outer_const, AND,
- INTVAL (mask_rtx),
- result_mode, &complement_p))
- break;
-
- /* If the shifts are in the same direction, we add the
- counts. Otherwise, we subtract them. */
- if ((code == ASHIFTRT || code == LSHIFTRT)
- == (first_code == ASHIFTRT || first_code == LSHIFTRT))
- count += first_count;
- else
- count -= first_count;
-
- /* If COUNT is positive, the new shift is usually CODE,
- except for the two exceptions below, in which case it is
- FIRST_CODE. If the count is negative, FIRST_CODE should
- always be used */
- if (count > 0
- && ((first_code == ROTATE && code == ASHIFT)
- || (first_code == ASHIFTRT && code == LSHIFTRT)))
- code = first_code;
- else if (count < 0)
- code = first_code, count = - count;
-
- varop = XEXP (varop, 0);
- continue;
- }
-
- /* If we have (A << B << C) for any shift, we can convert this to
- (A << C << B). This wins if A is a constant. Only try this if
- B is not a constant. */
-
- else if (GET_CODE (varop) == code
- && GET_CODE (XEXP (varop, 1)) != CONST_INT
- && 0 != (new
- = simplify_binary_operation (code, mode,
- XEXP (varop, 0),
- GEN_INT (count))))
- {
- varop = gen_rtx_combine (code, mode, new, XEXP (varop, 1));
- count = 0;
- continue;
- }
- break;
-
- case NOT:
- /* Make this fit the case below. */
- varop = gen_rtx_combine (XOR, mode, XEXP (varop, 0),
- GEN_INT (GET_MODE_MASK (mode)));
- continue;
-
- case IOR:
- case AND:
- case XOR:
- /* If we have (xshiftrt (ior (plus X (const_int -1)) X) C)
- with C the size of VAROP - 1 and the shift is logical if
- STORE_FLAG_VALUE is 1 and arithmetic if STORE_FLAG_VALUE is -1,
- we have an (le X 0) operation. If we have an arithmetic shift
- and STORE_FLAG_VALUE is 1 or we have a logical shift with
- STORE_FLAG_VALUE of -1, we have a (neg (le X 0)) operation. */
-
- if (GET_CODE (varop) == IOR && GET_CODE (XEXP (varop, 0)) == PLUS
- && XEXP (XEXP (varop, 0), 1) == constm1_rtx
- && (STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1)
- && (code == LSHIFTRT || code == ASHIFTRT)
- && count == GET_MODE_BITSIZE (GET_MODE (varop)) - 1
- && rtx_equal_p (XEXP (XEXP (varop, 0), 0), XEXP (varop, 1)))
- {
- count = 0;
- varop = gen_rtx_combine (LE, GET_MODE (varop), XEXP (varop, 1),
- const0_rtx);
-
- if (STORE_FLAG_VALUE == 1 ? code == ASHIFTRT : code == LSHIFTRT)
- varop = gen_rtx_combine (NEG, GET_MODE (varop), varop);
-
- continue;
- }
-
- /* If we have (shift (logical)), move the logical to the outside
- to allow it to possibly combine with another logical and the
- shift to combine with another shift. This also canonicalizes to
- what a ZERO_EXTRACT looks like. Also, some machines have
- (and (shift)) insns. */
-
- if (GET_CODE (XEXP (varop, 1)) == CONST_INT
- && (new = simplify_binary_operation (code, result_mode,
- XEXP (varop, 1),
- GEN_INT (count))) != 0
- && GET_CODE(new) == CONST_INT
- && merge_outer_ops (&outer_op, &outer_const, GET_CODE (varop),
- INTVAL (new), result_mode, &complement_p))
- {
- varop = XEXP (varop, 0);
- continue;
- }
-
- /* If we can't do that, try to simplify the shift in each arm of the
- logical expression, make a new logical expression, and apply
- the inverse distributive law. */
- {
- rtx lhs = simplify_shift_const (NULL_RTX, code, shift_mode,
- XEXP (varop, 0), count);
- rtx rhs = simplify_shift_const (NULL_RTX, code, shift_mode,
- XEXP (varop, 1), count);
-
- varop = gen_binary (GET_CODE (varop), shift_mode, lhs, rhs);
- varop = apply_distributive_law (varop);
-
- count = 0;
- }
- break;
-
- case EQ:
- /* convert (lshiftrt (eq FOO 0) C) to (xor FOO 1) if STORE_FLAG_VALUE
- says that the sign bit can be tested, FOO has mode MODE, C is
- GET_MODE_BITSIZE (MODE) - 1, and FOO has only its low-order bit
- that may be nonzero. */
- if (code == LSHIFTRT
- && XEXP (varop, 1) == const0_rtx
- && GET_MODE (XEXP (varop, 0)) == result_mode
- && count == GET_MODE_BITSIZE (result_mode) - 1
- && GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT
- && ((STORE_FLAG_VALUE
- & ((HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (result_mode) - 1))))
- && nonzero_bits (XEXP (varop, 0), result_mode) == 1
- && merge_outer_ops (&outer_op, &outer_const, XOR,
- (HOST_WIDE_INT) 1, result_mode,
- &complement_p))
- {
- varop = XEXP (varop, 0);
- count = 0;
- continue;
- }
- break;
-
- case NEG:
- /* (lshiftrt (neg A) C) where A is either 0 or 1 and C is one less
- than the number of bits in the mode is equivalent to A. */
- if (code == LSHIFTRT && count == GET_MODE_BITSIZE (result_mode) - 1
- && nonzero_bits (XEXP (varop, 0), result_mode) == 1)
- {
- varop = XEXP (varop, 0);
- count = 0;
- continue;
- }
-
- /* NEG commutes with ASHIFT since it is multiplication. Move the
- NEG outside to allow shifts to combine. */
- if (code == ASHIFT
- && merge_outer_ops (&outer_op, &outer_const, NEG,
- (HOST_WIDE_INT) 0, result_mode,
- &complement_p))
- {
- varop = XEXP (varop, 0);
- continue;
- }
- break;
-
- case PLUS:
- /* (lshiftrt (plus A -1) C) where A is either 0 or 1 and C
- is one less than the number of bits in the mode is
- equivalent to (xor A 1). */
- if (code == LSHIFTRT && count == GET_MODE_BITSIZE (result_mode) - 1
- && XEXP (varop, 1) == constm1_rtx
- && nonzero_bits (XEXP (varop, 0), result_mode) == 1
- && merge_outer_ops (&outer_op, &outer_const, XOR,
- (HOST_WIDE_INT) 1, result_mode,
- &complement_p))
- {
- count = 0;
- varop = XEXP (varop, 0);
- continue;
- }
-
- /* If we have (xshiftrt (plus FOO BAR) C), and the only bits
- that might be nonzero in BAR are those being shifted out and those
- bits are known zero in FOO, we can replace the PLUS with FOO.
- Similarly in the other operand order. This code occurs when
- we are computing the size of a variable-size array. */
-
- if ((code == ASHIFTRT || code == LSHIFTRT)
- && count < HOST_BITS_PER_WIDE_INT
- && nonzero_bits (XEXP (varop, 1), result_mode) >> count == 0
- && (nonzero_bits (XEXP (varop, 1), result_mode)
- & nonzero_bits (XEXP (varop, 0), result_mode)) == 0)
- {
- varop = XEXP (varop, 0);
- continue;
- }
- else if ((code == ASHIFTRT || code == LSHIFTRT)
- && count < HOST_BITS_PER_WIDE_INT
- && GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT
- && 0 == (nonzero_bits (XEXP (varop, 0), result_mode)
- >> count)
- && 0 == (nonzero_bits (XEXP (varop, 0), result_mode)
- & nonzero_bits (XEXP (varop, 1),
- result_mode)))
- {
- varop = XEXP (varop, 1);
- continue;
- }
-
- /* (ashift (plus foo C) N) is (plus (ashift foo N) C'). */
- if (code == ASHIFT
- && GET_CODE (XEXP (varop, 1)) == CONST_INT
- && (new = simplify_binary_operation (ASHIFT, result_mode,
- XEXP (varop, 1),
- GEN_INT (count))) != 0
- && GET_CODE(new) == CONST_INT
- && merge_outer_ops (&outer_op, &outer_const, PLUS,
- INTVAL (new), result_mode, &complement_p))
- {
- varop = XEXP (varop, 0);
- continue;
- }
- break;
-
- case MINUS:
- /* If we have (xshiftrt (minus (ashiftrt X C)) X) C)
- with C the size of VAROP - 1 and the shift is logical if
- STORE_FLAG_VALUE is 1 and arithmetic if STORE_FLAG_VALUE is -1,
- we have a (gt X 0) operation. If the shift is arithmetic with
- STORE_FLAG_VALUE of 1 or logical with STORE_FLAG_VALUE == -1,
- we have a (neg (gt X 0)) operation. */
-
- if ((STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1)
- && GET_CODE (XEXP (varop, 0)) == ASHIFTRT
- && count == GET_MODE_BITSIZE (GET_MODE (varop)) - 1
- && (code == LSHIFTRT || code == ASHIFTRT)
- && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (varop, 0), 1)) == count
- && rtx_equal_p (XEXP (XEXP (varop, 0), 0), XEXP (varop, 1)))
- {
- count = 0;
- varop = gen_rtx_combine (GT, GET_MODE (varop), XEXP (varop, 1),
- const0_rtx);
-
- if (STORE_FLAG_VALUE == 1 ? code == ASHIFTRT : code == LSHIFTRT)
- varop = gen_rtx_combine (NEG, GET_MODE (varop), varop);
-
- continue;
- }
- break;
- }
-
- break;
- }
-
- /* We need to determine what mode to do the shift in. If the shift is
- a right shift or ROTATE, we must always do it in the mode it was
- originally done in. Otherwise, we can do it in MODE, the widest mode
- encountered. The code we care about is that of the shift that will
- actually be done, not the shift that was originally requested. */
- shift_mode
- = (code == ASHIFTRT || code == LSHIFTRT || code == ROTATE
- ? result_mode : mode);
-
- /* We have now finished analyzing the shift. The result should be
- a shift of type CODE with SHIFT_MODE shifting VAROP COUNT places. If
- OUTER_OP is non-NIL, it is an operation that needs to be applied
- to the result of the shift. OUTER_CONST is the relevant constant,
- but we must turn off all bits turned off in the shift.
-
- If we were passed a value for X, see if we can use any pieces of
- it. If not, make new rtx. */
-
- if (x && GET_RTX_CLASS (GET_CODE (x)) == '2'
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) == count)
- const_rtx = XEXP (x, 1);
- else
- const_rtx = GEN_INT (count);
-
- if (x && GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_MODE (XEXP (x, 0)) == shift_mode
- && SUBREG_REG (XEXP (x, 0)) == varop)
- varop = XEXP (x, 0);
- else if (GET_MODE (varop) != shift_mode)
- varop = gen_lowpart_for_combine (shift_mode, varop);
-
- /* If we can't make the SUBREG, try to return what we were given. */
- if (GET_CODE (varop) == CLOBBER)
- return x ? x : varop;
-
- new = simplify_binary_operation (code, shift_mode, varop, const_rtx);
- if (new != 0)
- x = new;
- else
- {
- if (x == 0 || GET_CODE (x) != code || GET_MODE (x) != shift_mode)
- x = gen_rtx_combine (code, shift_mode, varop, const_rtx);
-
- SUBST (XEXP (x, 0), varop);
- SUBST (XEXP (x, 1), const_rtx);
- }
-
- /* If we have an outer operation and we just made a shift, it is
- possible that we could have simplified the shift were it not
- for the outer operation. So try to do the simplification
- recursively. */
-
- if (outer_op != NIL && GET_CODE (x) == code
- && GET_CODE (XEXP (x, 1)) == CONST_INT)
- x = simplify_shift_const (x, code, shift_mode, XEXP (x, 0),
- INTVAL (XEXP (x, 1)));
-
- /* If we were doing a LSHIFTRT in a wider mode than it was originally,
- turn off all the bits that the shift would have turned off. */
- if (orig_code == LSHIFTRT && result_mode != shift_mode)
- x = simplify_and_const_int (NULL_RTX, shift_mode, x,
- GET_MODE_MASK (result_mode) >> orig_count);
-
- /* Do the remainder of the processing in RESULT_MODE. */
- x = gen_lowpart_for_combine (result_mode, x);
-
- /* If COMPLEMENT_P is set, we have to complement X before doing the outer
- operation. */
- if (complement_p)
- x = gen_unary (NOT, result_mode, result_mode, x);
-
- if (outer_op != NIL)
- {
- if (GET_MODE_BITSIZE (result_mode) < HOST_BITS_PER_WIDE_INT)
- {
- int width = GET_MODE_BITSIZE (result_mode);
-
- outer_const &= GET_MODE_MASK (result_mode);
-
- /* If this would be an entire word for the target, but is not for
- the host, then sign-extend on the host so that the number will
- look the same way on the host that it would on the target.
-
- For example, when building a 64 bit alpha hosted 32 bit sparc
- targeted compiler, then we want the 32 bit unsigned value -1 to be
- represented as a 64 bit value -1, and not as 0x00000000ffffffff.
- The later confuses the sparc backend. */
-
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
- && (outer_const & ((HOST_WIDE_INT) 1 << (width - 1))))
- outer_const |= ((HOST_WIDE_INT) (-1) << width);
- }
-
- if (outer_op == AND)
- x = simplify_and_const_int (NULL_RTX, result_mode, x, outer_const);
- else if (outer_op == SET)
- /* This means that we have determined that the result is
- equivalent to a constant. This should be rare. */
- x = GEN_INT (outer_const);
- else if (GET_RTX_CLASS (outer_op) == '1')
- x = gen_unary (outer_op, result_mode, result_mode, x);
- else
- x = gen_binary (outer_op, result_mode, x, GEN_INT (outer_const));
- }
-
- return x;
-}
-
-/* Like recog, but we receive the address of a pointer to a new pattern.
- We try to match the rtx that the pointer points to.
- If that fails, we may try to modify or replace the pattern,
- storing the replacement into the same pointer object.
-
- Modifications include deletion or addition of CLOBBERs.
-
- PNOTES is a pointer to a location where any REG_UNUSED notes added for
- the CLOBBERs are placed.
-
- PADDED_SCRATCHES is set to the number of (clobber (scratch)) patterns
- we had to add.
-
- The value is the final insn code from the pattern ultimately matched,
- or -1. */
-
-static int
-recog_for_combine (pnewpat, insn, pnotes, padded_scratches)
- rtx *pnewpat;
- rtx insn;
- rtx *pnotes;
- int *padded_scratches;
-{
- register rtx pat = *pnewpat;
- int insn_code_number;
- int num_clobbers_to_add = 0;
- int i;
- rtx notes = 0;
-
- *padded_scratches = 0;
-
- /* If PAT is a PARALLEL, check to see if it contains the CLOBBER
- we use to indicate that something didn't match. If we find such a
- thing, force rejection. */
- if (GET_CODE (pat) == PARALLEL)
- for (i = XVECLEN (pat, 0) - 1; i >= 0; i--)
- if (GET_CODE (XVECEXP (pat, 0, i)) == CLOBBER
- && XEXP (XVECEXP (pat, 0, i), 0) == const0_rtx)
- return -1;
-
- /* Is the result of combination a valid instruction? */
- insn_code_number = recog (pat, insn, &num_clobbers_to_add);
-
- /* If it isn't, there is the possibility that we previously had an insn
- that clobbered some register as a side effect, but the combined
- insn doesn't need to do that. So try once more without the clobbers
- unless this represents an ASM insn. */
-
- if (insn_code_number < 0 && ! check_asm_operands (pat)
- && GET_CODE (pat) == PARALLEL)
- {
- int pos;
-
- for (pos = 0, i = 0; i < XVECLEN (pat, 0); i++)
- if (GET_CODE (XVECEXP (pat, 0, i)) != CLOBBER)
- {
- if (i != pos)
- SUBST (XVECEXP (pat, 0, pos), XVECEXP (pat, 0, i));
- pos++;
- }
-
- SUBST_INT (XVECLEN (pat, 0), pos);
-
- if (pos == 1)
- pat = XVECEXP (pat, 0, 0);
-
- insn_code_number = recog (pat, insn, &num_clobbers_to_add);
- }
-
- /* If we had any clobbers to add, make a new pattern than contains
- them. Then check to make sure that all of them are dead. */
- if (num_clobbers_to_add)
- {
- rtx newpat = gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (GET_CODE (pat) == PARALLEL
- ? XVECLEN (pat, 0) + num_clobbers_to_add
- : num_clobbers_to_add + 1));
-
- if (GET_CODE (pat) == PARALLEL)
- for (i = 0; i < XVECLEN (pat, 0); i++)
- XVECEXP (newpat, 0, i) = XVECEXP (pat, 0, i);
- else
- XVECEXP (newpat, 0, 0) = pat;
-
- add_clobbers (newpat, insn_code_number);
-
- for (i = XVECLEN (newpat, 0) - num_clobbers_to_add;
- i < XVECLEN (newpat, 0); i++)
- {
- if (GET_CODE (XEXP (XVECEXP (newpat, 0, i), 0)) == REG
- && ! reg_dead_at_p (XEXP (XVECEXP (newpat, 0, i), 0), insn))
- return -1;
- else if (GET_CODE (XEXP (XVECEXP (newpat, 0, i), 0)) == SCRATCH)
- (*padded_scratches)++;
- notes = gen_rtx (EXPR_LIST, REG_UNUSED,
- XEXP (XVECEXP (newpat, 0, i), 0), notes);
- }
- pat = newpat;
- }
-
- *pnewpat = pat;
- *pnotes = notes;
-
- return insn_code_number;
-}
-
-/* Like gen_lowpart but for use by combine. In combine it is not possible
- to create any new pseudoregs. However, it is safe to create
- invalid memory addresses, because combine will try to recognize
- them and all they will do is make the combine attempt fail.
-
- If for some reason this cannot do its job, an rtx
- (clobber (const_int 0)) is returned.
- An insn containing that will not be recognized. */
-
-#undef gen_lowpart
-
-static rtx
-gen_lowpart_for_combine (mode, x)
- enum machine_mode mode;
- register rtx x;
-{
- rtx result;
-
- if (GET_MODE (x) == mode)
- return x;
-
- /* We can only support MODE being wider than a word if X is a
- constant integer or has a mode the same size. */
-
- if (GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && ! ((GET_MODE (x) == VOIDmode
- && (GET_CODE (x) == CONST_INT
- || GET_CODE (x) == CONST_DOUBLE))
- || GET_MODE_SIZE (GET_MODE (x)) == GET_MODE_SIZE (mode)))
- return gen_rtx (CLOBBER, GET_MODE (x), const0_rtx);
-
- /* X might be a paradoxical (subreg (mem)). In that case, gen_lowpart
- won't know what to do. So we will strip off the SUBREG here and
- process normally. */
- if (GET_CODE (x) == SUBREG && GET_CODE (SUBREG_REG (x)) == MEM)
- {
- x = SUBREG_REG (x);
- if (GET_MODE (x) == mode)
- return x;
- }
-
- result = gen_lowpart_common (mode, x);
- if (result != 0
- && GET_CODE (result) == SUBREG
- && GET_CODE (SUBREG_REG (result)) == REG
- && REGNO (SUBREG_REG (result)) >= FIRST_PSEUDO_REGISTER
- && (GET_MODE_SIZE (GET_MODE (result))
- != GET_MODE_SIZE (GET_MODE (SUBREG_REG (result)))))
- reg_changes_size[REGNO (SUBREG_REG (result))] = 1;
-
- if (result)
- return result;
-
- if (GET_CODE (x) == MEM)
- {
- register int offset = 0;
- rtx new;
-
- /* Refuse to work on a volatile memory ref or one with a mode-dependent
- address. */
- if (MEM_VOLATILE_P (x) || mode_dependent_address_p (XEXP (x, 0)))
- return gen_rtx (CLOBBER, GET_MODE (x), const0_rtx);
-
- /* If we want to refer to something bigger than the original memref,
- generate a perverse subreg instead. That will force a reload
- of the original memref X. */
- if (GET_MODE_SIZE (GET_MODE (x)) < GET_MODE_SIZE (mode))
- return gen_rtx (SUBREG, mode, x, 0);
-
- if (WORDS_BIG_ENDIAN)
- offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
- if (BYTES_BIG_ENDIAN)
- {
- /* Adjust the address so that the address-after-the-data is
- unchanged. */
- offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
- }
- new = gen_rtx (MEM, mode, plus_constant (XEXP (x, 0), offset));
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (x);
- MEM_VOLATILE_P (new) = MEM_VOLATILE_P (x);
- MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (x);
- return new;
- }
-
- /* If X is a comparison operator, rewrite it in a new mode. This
- probably won't match, but may allow further simplifications. */
- else if (GET_RTX_CLASS (GET_CODE (x)) == '<')
- return gen_rtx_combine (GET_CODE (x), mode, XEXP (x, 0), XEXP (x, 1));
-
- /* If we couldn't simplify X any other way, just enclose it in a
- SUBREG. Normally, this SUBREG won't match, but some patterns may
- include an explicit SUBREG or we may simplify it further in combine. */
- else
- {
- int word = 0;
-
- if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
- word = ((GET_MODE_SIZE (GET_MODE (x))
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD))
- / UNITS_PER_WORD);
- return gen_rtx (SUBREG, mode, x, word);
- }
-}
-
-/* Make an rtx expression. This is a subset of gen_rtx and only supports
- expressions of 1, 2, or 3 operands, each of which are rtx expressions.
-
- If the identical expression was previously in the insn (in the undobuf),
- it will be returned. Only if it is not found will a new expression
- be made. */
-
-/*VARARGS2*/
-static rtx
-gen_rtx_combine VPROTO((enum rtx_code code, enum machine_mode mode, ...))
-{
-#ifndef __STDC__
- enum rtx_code code;
- enum machine_mode mode;
-#endif
- va_list p;
- int n_args;
- rtx args[3];
- int i, j;
- char *fmt;
- rtx rt;
- struct undo *undo;
-
- VA_START (p, mode);
-
-#ifndef __STDC__
- code = va_arg (p, enum rtx_code);
- mode = va_arg (p, enum machine_mode);
-#endif
-
- n_args = GET_RTX_LENGTH (code);
- fmt = GET_RTX_FORMAT (code);
-
- if (n_args == 0 || n_args > 3)
- abort ();
-
- /* Get each arg and verify that it is supposed to be an expression. */
- for (j = 0; j < n_args; j++)
- {
- if (*fmt++ != 'e')
- abort ();
-
- args[j] = va_arg (p, rtx);
- }
-
- /* See if this is in undobuf. Be sure we don't use objects that came
- from another insn; this could produce circular rtl structures. */
-
- for (undo = undobuf.undos; undo != undobuf.previous_undos; undo = undo->next)
- if (!undo->is_int
- && GET_CODE (undo->old_contents.r) == code
- && GET_MODE (undo->old_contents.r) == mode)
- {
- for (j = 0; j < n_args; j++)
- if (XEXP (undo->old_contents.r, j) != args[j])
- break;
-
- if (j == n_args)
- return undo->old_contents.r;
- }
-
- /* Otherwise make a new rtx. We know we have 1, 2, or 3 args.
- Use rtx_alloc instead of gen_rtx because it's faster on RISC. */
- rt = rtx_alloc (code);
- PUT_MODE (rt, mode);
- XEXP (rt, 0) = args[0];
- if (n_args > 1)
- {
- XEXP (rt, 1) = args[1];
- if (n_args > 2)
- XEXP (rt, 2) = args[2];
- }
- return rt;
-}
-
-/* These routines make binary and unary operations by first seeing if they
- fold; if not, a new expression is allocated. */
-
-static rtx
-gen_binary (code, mode, op0, op1)
- enum rtx_code code;
- enum machine_mode mode;
- rtx op0, op1;
-{
- rtx result;
- rtx tem;
-
- if (GET_RTX_CLASS (code) == 'c'
- && (GET_CODE (op0) == CONST_INT
- || (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)))
- tem = op0, op0 = op1, op1 = tem;
-
- if (GET_RTX_CLASS (code) == '<')
- {
- enum machine_mode op_mode = GET_MODE (op0);
-
- /* Strip the COMPARE from (REL_OP (compare X Y) 0) to get
- just (REL_OP X Y). */
- if (GET_CODE (op0) == COMPARE && op1 == const0_rtx)
- {
- op1 = XEXP (op0, 1);
- op0 = XEXP (op0, 0);
- op_mode = GET_MODE (op0);
- }
-
- if (op_mode == VOIDmode)
- op_mode = GET_MODE (op1);
- result = simplify_relational_operation (code, op_mode, op0, op1);
- }
- else
- result = simplify_binary_operation (code, mode, op0, op1);
-
- if (result)
- return result;
-
- /* Put complex operands first and constants second. */
- if (GET_RTX_CLASS (code) == 'c'
- && ((CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)
- || (GET_RTX_CLASS (GET_CODE (op0)) == 'o'
- && GET_RTX_CLASS (GET_CODE (op1)) != 'o')
- || (GET_CODE (op0) == SUBREG
- && GET_RTX_CLASS (GET_CODE (SUBREG_REG (op0))) == 'o'
- && GET_RTX_CLASS (GET_CODE (op1)) != 'o')))
- return gen_rtx_combine (code, mode, op1, op0);
-
- return gen_rtx_combine (code, mode, op0, op1);
-}
-
-static rtx
-gen_unary (code, mode, op0_mode, op0)
- enum rtx_code code;
- enum machine_mode mode, op0_mode;
- rtx op0;
-{
- rtx result = simplify_unary_operation (code, mode, op0, op0_mode);
-
- if (result)
- return result;
-
- return gen_rtx_combine (code, mode, op0);
-}
-
-/* Simplify a comparison between *POP0 and *POP1 where CODE is the
- comparison code that will be tested.
-
- The result is a possibly different comparison code to use. *POP0 and
- *POP1 may be updated.
-
- It is possible that we might detect that a comparison is either always
- true or always false. However, we do not perform general constant
- folding in combine, so this knowledge isn't useful. Such tautologies
- should have been detected earlier. Hence we ignore all such cases. */
-
-static enum rtx_code
-simplify_comparison (code, pop0, pop1)
- enum rtx_code code;
- rtx *pop0;
- rtx *pop1;
-{
- rtx op0 = *pop0;
- rtx op1 = *pop1;
- rtx tem, tem1;
- int i;
- enum machine_mode mode, tmode;
-
- /* Try a few ways of applying the same transformation to both operands. */
- while (1)
- {
-#ifndef WORD_REGISTER_OPERATIONS
- /* The test below this one won't handle SIGN_EXTENDs on these machines,
- so check specially. */
- if (code != GTU && code != GEU && code != LTU && code != LEU
- && GET_CODE (op0) == ASHIFTRT && GET_CODE (op1) == ASHIFTRT
- && GET_CODE (XEXP (op0, 0)) == ASHIFT
- && GET_CODE (XEXP (op1, 0)) == ASHIFT
- && GET_CODE (XEXP (XEXP (op0, 0), 0)) == SUBREG
- && GET_CODE (XEXP (XEXP (op1, 0), 0)) == SUBREG
- && (GET_MODE (SUBREG_REG (XEXP (XEXP (op0, 0), 0)))
- == GET_MODE (SUBREG_REG (XEXP (XEXP (op1, 0), 0))))
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && GET_CODE (XEXP (op1, 1)) == CONST_INT
- && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT
- && GET_CODE (XEXP (XEXP (op1, 0), 1)) == CONST_INT
- && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (op1, 1))
- && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (XEXP (op0, 0), 1))
- && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (XEXP (op1, 0), 1))
- && (INTVAL (XEXP (op0, 1))
- == (GET_MODE_BITSIZE (GET_MODE (op0))
- - (GET_MODE_BITSIZE
- (GET_MODE (SUBREG_REG (XEXP (XEXP (op0, 0), 0))))))))
- {
- op0 = SUBREG_REG (XEXP (XEXP (op0, 0), 0));
- op1 = SUBREG_REG (XEXP (XEXP (op1, 0), 0));
- }
-#endif
-
- /* If both operands are the same constant shift, see if we can ignore the
- shift. We can if the shift is a rotate or if the bits shifted out of
- this shift are known to be zero for both inputs and if the type of
- comparison is compatible with the shift. */
- if (GET_CODE (op0) == GET_CODE (op1)
- && GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT
- && ((GET_CODE (op0) == ROTATE && (code == NE || code == EQ))
- || ((GET_CODE (op0) == LSHIFTRT || GET_CODE (op0) == ASHIFT)
- && (code != GT && code != LT && code != GE && code != LE))
- || (GET_CODE (op0) == ASHIFTRT
- && (code != GTU && code != LTU
- && code != GEU && code != GEU)))
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && INTVAL (XEXP (op0, 1)) >= 0
- && INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT
- && XEXP (op0, 1) == XEXP (op1, 1))
- {
- enum machine_mode mode = GET_MODE (op0);
- unsigned HOST_WIDE_INT mask = GET_MODE_MASK (mode);
- int shift_count = INTVAL (XEXP (op0, 1));
-
- if (GET_CODE (op0) == LSHIFTRT || GET_CODE (op0) == ASHIFTRT)
- mask &= (mask >> shift_count) << shift_count;
- else if (GET_CODE (op0) == ASHIFT)
- mask = (mask & (mask << shift_count)) >> shift_count;
-
- if ((nonzero_bits (XEXP (op0, 0), mode) & ~ mask) == 0
- && (nonzero_bits (XEXP (op1, 0), mode) & ~ mask) == 0)
- op0 = XEXP (op0, 0), op1 = XEXP (op1, 0);
- else
- break;
- }
-
- /* If both operands are AND's of a paradoxical SUBREG by constant, the
- SUBREGs are of the same mode, and, in both cases, the AND would
- be redundant if the comparison was done in the narrower mode,
- do the comparison in the narrower mode (e.g., we are AND'ing with 1
- and the operand's possibly nonzero bits are 0xffffff01; in that case
- if we only care about QImode, we don't need the AND). This case
- occurs if the output mode of an scc insn is not SImode and
- STORE_FLAG_VALUE == 1 (e.g., the 386).
-
- Similarly, check for a case where the AND's are ZERO_EXTEND
- operations from some narrower mode even though a SUBREG is not
- present. */
-
- else if (GET_CODE (op0) == AND && GET_CODE (op1) == AND
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && GET_CODE (XEXP (op1, 1)) == CONST_INT)
- {
- rtx inner_op0 = XEXP (op0, 0);
- rtx inner_op1 = XEXP (op1, 0);
- HOST_WIDE_INT c0 = INTVAL (XEXP (op0, 1));
- HOST_WIDE_INT c1 = INTVAL (XEXP (op1, 1));
- int changed = 0;
-
- if (GET_CODE (inner_op0) == SUBREG && GET_CODE (inner_op1) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (inner_op0))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (inner_op0))))
- && (GET_MODE (SUBREG_REG (inner_op0))
- == GET_MODE (SUBREG_REG (inner_op1)))
- && (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0)))
- <= HOST_BITS_PER_WIDE_INT)
- && (0 == ((~c0) & nonzero_bits (SUBREG_REG (inner_op0),
- GET_MODE (SUBREG_REG (op0)))))
- && (0 == ((~c1) & nonzero_bits (SUBREG_REG (inner_op1),
- GET_MODE (SUBREG_REG (inner_op1))))))
- {
- op0 = SUBREG_REG (inner_op0);
- op1 = SUBREG_REG (inner_op1);
-
- /* The resulting comparison is always unsigned since we masked
- off the original sign bit. */
- code = unsigned_condition (code);
-
- changed = 1;
- }
-
- else if (c0 == c1)
- for (tmode = GET_CLASS_NARROWEST_MODE
- (GET_MODE_CLASS (GET_MODE (op0)));
- tmode != GET_MODE (op0); tmode = GET_MODE_WIDER_MODE (tmode))
- if (c0 == GET_MODE_MASK (tmode))
- {
- op0 = gen_lowpart_for_combine (tmode, inner_op0);
- op1 = gen_lowpart_for_combine (tmode, inner_op1);
- code = unsigned_condition (code);
- changed = 1;
- break;
- }
-
- if (! changed)
- break;
- }
-
- /* If both operands are NOT, we can strip off the outer operation
- and adjust the comparison code for swapped operands; similarly for
- NEG, except that this must be an equality comparison. */
- else if ((GET_CODE (op0) == NOT && GET_CODE (op1) == NOT)
- || (GET_CODE (op0) == NEG && GET_CODE (op1) == NEG
- && (code == EQ || code == NE)))
- op0 = XEXP (op0, 0), op1 = XEXP (op1, 0), code = swap_condition (code);
-
- else
- break;
- }
-
- /* If the first operand is a constant, swap the operands and adjust the
- comparison code appropriately, but don't do this if the second operand
- is already a constant integer. */
- if (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)
- {
- tem = op0, op0 = op1, op1 = tem;
- code = swap_condition (code);
- }
-
- /* We now enter a loop during which we will try to simplify the comparison.
- For the most part, we only are concerned with comparisons with zero,
- but some things may really be comparisons with zero but not start
- out looking that way. */
-
- while (GET_CODE (op1) == CONST_INT)
- {
- enum machine_mode mode = GET_MODE (op0);
- int mode_width = GET_MODE_BITSIZE (mode);
- unsigned HOST_WIDE_INT mask = GET_MODE_MASK (mode);
- int equality_comparison_p;
- int sign_bit_comparison_p;
- int unsigned_comparison_p;
- HOST_WIDE_INT const_op;
-
- /* We only want to handle integral modes. This catches VOIDmode,
- CCmode, and the floating-point modes. An exception is that we
- can handle VOIDmode if OP0 is a COMPARE or a comparison
- operation. */
-
- if (GET_MODE_CLASS (mode) != MODE_INT
- && ! (mode == VOIDmode
- && (GET_CODE (op0) == COMPARE
- || GET_RTX_CLASS (GET_CODE (op0)) == '<')))
- break;
-
- /* Get the constant we are comparing against and turn off all bits
- not on in our mode. */
- const_op = INTVAL (op1);
- if (mode_width <= HOST_BITS_PER_WIDE_INT)
- const_op &= mask;
-
- /* If we are comparing against a constant power of two and the value
- being compared can only have that single bit nonzero (e.g., it was
- `and'ed with that bit), we can replace this with a comparison
- with zero. */
- if (const_op
- && (code == EQ || code == NE || code == GE || code == GEU
- || code == LT || code == LTU)
- && mode_width <= HOST_BITS_PER_WIDE_INT
- && exact_log2 (const_op) >= 0
- && nonzero_bits (op0, mode) == const_op)
- {
- code = (code == EQ || code == GE || code == GEU ? NE : EQ);
- op1 = const0_rtx, const_op = 0;
- }
-
- /* Similarly, if we are comparing a value known to be either -1 or
- 0 with -1, change it to the opposite comparison against zero. */
-
- if (const_op == -1
- && (code == EQ || code == NE || code == GT || code == LE
- || code == GEU || code == LTU)
- && num_sign_bit_copies (op0, mode) == mode_width)
- {
- code = (code == EQ || code == LE || code == GEU ? NE : EQ);
- op1 = const0_rtx, const_op = 0;
- }
-
- /* Do some canonicalizations based on the comparison code. We prefer
- comparisons against zero and then prefer equality comparisons.
- If we can reduce the size of a constant, we will do that too. */
-
- switch (code)
- {
- case LT:
- /* < C is equivalent to <= (C - 1) */
- if (const_op > 0)
- {
- const_op -= 1;
- op1 = GEN_INT (const_op);
- code = LE;
- /* ... fall through to LE case below. */
- }
- else
- break;
-
- case LE:
- /* <= C is equivalent to < (C + 1); we do this for C < 0 */
- if (const_op < 0)
- {
- const_op += 1;
- op1 = GEN_INT (const_op);
- code = LT;
- }
-
- /* If we are doing a <= 0 comparison on a value known to have
- a zero sign bit, we can replace this with == 0. */
- else if (const_op == 0
- && mode_width <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (op0, mode)
- & ((HOST_WIDE_INT) 1 << (mode_width - 1))) == 0)
- code = EQ;
- break;
-
- case GE:
- /* >= C is equivalent to > (C - 1). */
- if (const_op > 0)
- {
- const_op -= 1;
- op1 = GEN_INT (const_op);
- code = GT;
- /* ... fall through to GT below. */
- }
- else
- break;
-
- case GT:
- /* > C is equivalent to >= (C + 1); we do this for C < 0*/
- if (const_op < 0)
- {
- const_op += 1;
- op1 = GEN_INT (const_op);
- code = GE;
- }
-
- /* If we are doing a > 0 comparison on a value known to have
- a zero sign bit, we can replace this with != 0. */
- else if (const_op == 0
- && mode_width <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (op0, mode)
- & ((HOST_WIDE_INT) 1 << (mode_width - 1))) == 0)
- code = NE;
- break;
-
- case LTU:
- /* < C is equivalent to <= (C - 1). */
- if (const_op > 0)
- {
- const_op -= 1;
- op1 = GEN_INT (const_op);
- code = LEU;
- /* ... fall through ... */
- }
-
- /* (unsigned) < 0x80000000 is equivalent to >= 0. */
- else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
- && (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1)))
- {
- const_op = 0, op1 = const0_rtx;
- code = GE;
- break;
- }
- else
- break;
-
- case LEU:
- /* unsigned <= 0 is equivalent to == 0 */
- if (const_op == 0)
- code = EQ;
-
- /* (unsigned) <= 0x7fffffff is equivalent to >= 0. */
- else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
- && (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1))
- {
- const_op = 0, op1 = const0_rtx;
- code = GE;
- }
- break;
-
- case GEU:
- /* >= C is equivalent to < (C - 1). */
- if (const_op > 1)
- {
- const_op -= 1;
- op1 = GEN_INT (const_op);
- code = GTU;
- /* ... fall through ... */
- }
-
- /* (unsigned) >= 0x80000000 is equivalent to < 0. */
- else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
- && (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1)))
- {
- const_op = 0, op1 = const0_rtx;
- code = LT;
- break;
- }
- else
- break;
-
- case GTU:
- /* unsigned > 0 is equivalent to != 0 */
- if (const_op == 0)
- code = NE;
-
- /* (unsigned) > 0x7fffffff is equivalent to < 0. */
- else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
- && (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1))
- {
- const_op = 0, op1 = const0_rtx;
- code = LT;
- }
- break;
- }
-
- /* Compute some predicates to simplify code below. */
-
- equality_comparison_p = (code == EQ || code == NE);
- sign_bit_comparison_p = ((code == LT || code == GE) && const_op == 0);
- unsigned_comparison_p = (code == LTU || code == LEU || code == GTU
- || code == LEU);
-
- /* If this is a sign bit comparison and we can do arithmetic in
- MODE, say that we will only be needing the sign bit of OP0. */
- if (sign_bit_comparison_p
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
- op0 = force_to_mode (op0, mode,
- ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (mode) - 1)),
- NULL_RTX, 0);
-
- /* Now try cases based on the opcode of OP0. If none of the cases
- does a "continue", we exit this loop immediately after the
- switch. */
-
- switch (GET_CODE (op0))
- {
- case ZERO_EXTRACT:
- /* If we are extracting a single bit from a variable position in
- a constant that has only a single bit set and are comparing it
- with zero, we can convert this into an equality comparison
- between the position and the location of the single bit. */
-
- if (GET_CODE (XEXP (op0, 0)) == CONST_INT
- && XEXP (op0, 1) == const1_rtx
- && equality_comparison_p && const_op == 0
- && (i = exact_log2 (INTVAL (XEXP (op0, 0)))) >= 0)
- {
- if (BITS_BIG_ENDIAN)
-#ifdef HAVE_extzv
- i = (GET_MODE_BITSIZE
- (insn_operand_mode[(int) CODE_FOR_extzv][1]) - 1 - i);
-#else
- i = BITS_PER_WORD - 1 - i;
-#endif
-
- op0 = XEXP (op0, 2);
- op1 = GEN_INT (i);
- const_op = i;
-
- /* Result is nonzero iff shift count is equal to I. */
- code = reverse_condition (code);
- continue;
- }
-
- /* ... fall through ... */
-
- case SIGN_EXTRACT:
- tem = expand_compound_operation (op0);
- if (tem != op0)
- {
- op0 = tem;
- continue;
- }
- break;
-
- case NOT:
- /* If testing for equality, we can take the NOT of the constant. */
- if (equality_comparison_p
- && (tem = simplify_unary_operation (NOT, mode, op1, mode)) != 0)
- {
- op0 = XEXP (op0, 0);
- op1 = tem;
- continue;
- }
-
- /* If just looking at the sign bit, reverse the sense of the
- comparison. */
- if (sign_bit_comparison_p)
- {
- op0 = XEXP (op0, 0);
- code = (code == GE ? LT : GE);
- continue;
- }
- break;
-
- case NEG:
- /* If testing for equality, we can take the NEG of the constant. */
- if (equality_comparison_p
- && (tem = simplify_unary_operation (NEG, mode, op1, mode)) != 0)
- {
- op0 = XEXP (op0, 0);
- op1 = tem;
- continue;
- }
-
- /* The remaining cases only apply to comparisons with zero. */
- if (const_op != 0)
- break;
-
- /* When X is ABS or is known positive,
- (neg X) is < 0 if and only if X != 0. */
-
- if (sign_bit_comparison_p
- && (GET_CODE (XEXP (op0, 0)) == ABS
- || (mode_width <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (XEXP (op0, 0), mode)
- & ((HOST_WIDE_INT) 1 << (mode_width - 1))) == 0)))
- {
- op0 = XEXP (op0, 0);
- code = (code == LT ? NE : EQ);
- continue;
- }
-
- /* If we have NEG of something whose two high-order bits are the
- same, we know that "(-a) < 0" is equivalent to "a > 0". */
- if (num_sign_bit_copies (op0, mode) >= 2)
- {
- op0 = XEXP (op0, 0);
- code = swap_condition (code);
- continue;
- }
- break;
-
- case ROTATE:
- /* If we are testing equality and our count is a constant, we
- can perform the inverse operation on our RHS. */
- if (equality_comparison_p && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && (tem = simplify_binary_operation (ROTATERT, mode,
- op1, XEXP (op0, 1))) != 0)
- {
- op0 = XEXP (op0, 0);
- op1 = tem;
- continue;
- }
-
- /* If we are doing a < 0 or >= 0 comparison, it means we are testing
- a particular bit. Convert it to an AND of a constant of that
- bit. This will be converted into a ZERO_EXTRACT. */
- if (const_op == 0 && sign_bit_comparison_p
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && mode_width <= HOST_BITS_PER_WIDE_INT)
- {
- op0 = simplify_and_const_int (NULL_RTX, mode, XEXP (op0, 0),
- ((HOST_WIDE_INT) 1
- << (mode_width - 1
- - INTVAL (XEXP (op0, 1)))));
- code = (code == LT ? NE : EQ);
- continue;
- }
-
- /* ... fall through ... */
-
- case ABS:
- /* ABS is ignorable inside an equality comparison with zero. */
- if (const_op == 0 && equality_comparison_p)
- {
- op0 = XEXP (op0, 0);
- continue;
- }
- break;
-
-
- case SIGN_EXTEND:
- /* Can simplify (compare (zero/sign_extend FOO) CONST)
- to (compare FOO CONST) if CONST fits in FOO's mode and we
- are either testing inequality or have an unsigned comparison
- with ZERO_EXTEND or a signed comparison with SIGN_EXTEND. */
- if (! unsigned_comparison_p
- && (GET_MODE_BITSIZE (GET_MODE (XEXP (op0, 0)))
- <= HOST_BITS_PER_WIDE_INT)
- && ((unsigned HOST_WIDE_INT) const_op
- < (((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (XEXP (op0, 0))) - 1)))))
- {
- op0 = XEXP (op0, 0);
- continue;
- }
- break;
-
- case SUBREG:
- /* Check for the case where we are comparing A - C1 with C2,
- both constants are smaller than 1/2 the maximum positive
- value in MODE, and the comparison is equality or unsigned.
- In that case, if A is either zero-extended to MODE or has
- sufficient sign bits so that the high-order bit in MODE
- is a copy of the sign in the inner mode, we can prove that it is
- safe to do the operation in the wider mode. This simplifies
- many range checks. */
-
- if (mode_width <= HOST_BITS_PER_WIDE_INT
- && subreg_lowpart_p (op0)
- && GET_CODE (SUBREG_REG (op0)) == PLUS
- && GET_CODE (XEXP (SUBREG_REG (op0), 1)) == CONST_INT
- && INTVAL (XEXP (SUBREG_REG (op0), 1)) < 0
- && (- INTVAL (XEXP (SUBREG_REG (op0), 1))
- < GET_MODE_MASK (mode) / 2)
- && (unsigned HOST_WIDE_INT) const_op < GET_MODE_MASK (mode) / 2
- && (0 == (nonzero_bits (XEXP (SUBREG_REG (op0), 0),
- GET_MODE (SUBREG_REG (op0)))
- & ~ GET_MODE_MASK (mode))
- || (num_sign_bit_copies (XEXP (SUBREG_REG (op0), 0),
- GET_MODE (SUBREG_REG (op0)))
- > (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0)))
- - GET_MODE_BITSIZE (mode)))))
- {
- op0 = SUBREG_REG (op0);
- continue;
- }
-
- /* If the inner mode is narrower and we are extracting the low part,
- we can treat the SUBREG as if it were a ZERO_EXTEND. */
- if (subreg_lowpart_p (op0)
- && GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0))) < mode_width)
- /* Fall through */ ;
- else
- break;
-
- /* ... fall through ... */
-
- case ZERO_EXTEND:
- if ((unsigned_comparison_p || equality_comparison_p)
- && (GET_MODE_BITSIZE (GET_MODE (XEXP (op0, 0)))
- <= HOST_BITS_PER_WIDE_INT)
- && ((unsigned HOST_WIDE_INT) const_op
- < GET_MODE_MASK (GET_MODE (XEXP (op0, 0)))))
- {
- op0 = XEXP (op0, 0);
- continue;
- }
- break;
-
- case PLUS:
- /* (eq (plus X A) B) -> (eq X (minus B A)). We can only do
- this for equality comparisons due to pathological cases involving
- overflows. */
- if (equality_comparison_p
- && 0 != (tem = simplify_binary_operation (MINUS, mode,
- op1, XEXP (op0, 1))))
- {
- op0 = XEXP (op0, 0);
- op1 = tem;
- continue;
- }
-
- /* (plus (abs X) (const_int -1)) is < 0 if and only if X == 0. */
- if (const_op == 0 && XEXP (op0, 1) == constm1_rtx
- && GET_CODE (XEXP (op0, 0)) == ABS && sign_bit_comparison_p)
- {
- op0 = XEXP (XEXP (op0, 0), 0);
- code = (code == LT ? EQ : NE);
- continue;
- }
- break;
-
- case MINUS:
- /* (eq (minus A B) C) -> (eq A (plus B C)) or
- (eq B (minus A C)), whichever simplifies. We can only do
- this for equality comparisons due to pathological cases involving
- overflows. */
- if (equality_comparison_p
- && 0 != (tem = simplify_binary_operation (PLUS, mode,
- XEXP (op0, 1), op1)))
- {
- op0 = XEXP (op0, 0);
- op1 = tem;
- continue;
- }
-
- if (equality_comparison_p
- && 0 != (tem = simplify_binary_operation (MINUS, mode,
- XEXP (op0, 0), op1)))
- {
- op0 = XEXP (op0, 1);
- op1 = tem;
- continue;
- }
-
- /* The sign bit of (minus (ashiftrt X C) X), where C is the number
- of bits in X minus 1, is one iff X > 0. */
- if (sign_bit_comparison_p && GET_CODE (XEXP (op0, 0)) == ASHIFTRT
- && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (op0, 0), 1)) == mode_width - 1
- && rtx_equal_p (XEXP (XEXP (op0, 0), 0), XEXP (op0, 1)))
- {
- op0 = XEXP (op0, 1);
- code = (code == GE ? LE : GT);
- continue;
- }
- break;
-
- case XOR:
- /* (eq (xor A B) C) -> (eq A (xor B C)). This is a simplification
- if C is zero or B is a constant. */
- if (equality_comparison_p
- && 0 != (tem = simplify_binary_operation (XOR, mode,
- XEXP (op0, 1), op1)))
- {
- op0 = XEXP (op0, 0);
- op1 = tem;
- continue;
- }
- break;
-
- case EQ: case NE:
- case LT: case LTU: case LE: case LEU:
- case GT: case GTU: case GE: case GEU:
- /* We can't do anything if OP0 is a condition code value, rather
- than an actual data value. */
- if (const_op != 0
-#ifdef HAVE_cc0
- || XEXP (op0, 0) == cc0_rtx
-#endif
- || GET_MODE_CLASS (GET_MODE (XEXP (op0, 0))) == MODE_CC)
- break;
-
- /* Get the two operands being compared. */
- if (GET_CODE (XEXP (op0, 0)) == COMPARE)
- tem = XEXP (XEXP (op0, 0), 0), tem1 = XEXP (XEXP (op0, 0), 1);
- else
- tem = XEXP (op0, 0), tem1 = XEXP (op0, 1);
-
- /* Check for the cases where we simply want the result of the
- earlier test or the opposite of that result. */
- if (code == NE
- || (code == EQ && reversible_comparison_p (op0))
- || (GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT
- && GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT
- && (STORE_FLAG_VALUE
- & (((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (op0)) - 1))))
- && (code == LT
- || (code == GE && reversible_comparison_p (op0)))))
- {
- code = (code == LT || code == NE
- ? GET_CODE (op0) : reverse_condition (GET_CODE (op0)));
- op0 = tem, op1 = tem1;
- continue;
- }
- break;
-
- case IOR:
- /* The sign bit of (ior (plus X (const_int -1)) X) is non-zero
- iff X <= 0. */
- if (sign_bit_comparison_p && GET_CODE (XEXP (op0, 0)) == PLUS
- && XEXP (XEXP (op0, 0), 1) == constm1_rtx
- && rtx_equal_p (XEXP (XEXP (op0, 0), 0), XEXP (op0, 1)))
- {
- op0 = XEXP (op0, 1);
- code = (code == GE ? GT : LE);
- continue;
- }
- break;
-
- case AND:
- /* Convert (and (xshift 1 X) Y) to (and (lshiftrt Y X) 1). This
- will be converted to a ZERO_EXTRACT later. */
- if (const_op == 0 && equality_comparison_p
- && GET_CODE (XEXP (op0, 0)) == ASHIFT
- && XEXP (XEXP (op0, 0), 0) == const1_rtx)
- {
- op0 = simplify_and_const_int
- (op0, mode, gen_rtx_combine (LSHIFTRT, mode,
- XEXP (op0, 1),
- XEXP (XEXP (op0, 0), 1)),
- (HOST_WIDE_INT) 1);
- continue;
- }
-
- /* If we are comparing (and (lshiftrt X C1) C2) for equality with
- zero and X is a comparison and C1 and C2 describe only bits set
- in STORE_FLAG_VALUE, we can compare with X. */
- if (const_op == 0 && equality_comparison_p
- && mode_width <= HOST_BITS_PER_WIDE_INT
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && GET_CODE (XEXP (op0, 0)) == LSHIFTRT
- && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (op0, 0), 1)) >= 0
- && INTVAL (XEXP (XEXP (op0, 0), 1)) < HOST_BITS_PER_WIDE_INT)
- {
- mask = ((INTVAL (XEXP (op0, 1)) & GET_MODE_MASK (mode))
- << INTVAL (XEXP (XEXP (op0, 0), 1)));
- if ((~ STORE_FLAG_VALUE & mask) == 0
- && (GET_RTX_CLASS (GET_CODE (XEXP (XEXP (op0, 0), 0))) == '<'
- || ((tem = get_last_value (XEXP (XEXP (op0, 0), 0))) != 0
- && GET_RTX_CLASS (GET_CODE (tem)) == '<')))
- {
- op0 = XEXP (XEXP (op0, 0), 0);
- continue;
- }
- }
-
- /* If we are doing an equality comparison of an AND of a bit equal
- to the sign bit, replace this with a LT or GE comparison of
- the underlying value. */
- if (equality_comparison_p
- && const_op == 0
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && mode_width <= HOST_BITS_PER_WIDE_INT
- && ((INTVAL (XEXP (op0, 1)) & GET_MODE_MASK (mode))
- == (HOST_WIDE_INT) 1 << (mode_width - 1)))
- {
- op0 = XEXP (op0, 0);
- code = (code == EQ ? GE : LT);
- continue;
- }
-
- /* If this AND operation is really a ZERO_EXTEND from a narrower
- mode, the constant fits within that mode, and this is either an
- equality or unsigned comparison, try to do this comparison in
- the narrower mode. */
- if ((equality_comparison_p || unsigned_comparison_p)
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && (i = exact_log2 ((INTVAL (XEXP (op0, 1))
- & GET_MODE_MASK (mode))
- + 1)) >= 0
- && const_op >> i == 0
- && (tmode = mode_for_size (i, MODE_INT, 1)) != BLKmode)
- {
- op0 = gen_lowpart_for_combine (tmode, XEXP (op0, 0));
- continue;
- }
- break;
-
- case ASHIFT:
- /* If we have (compare (ashift FOO N) (const_int C)) and
- the high order N bits of FOO (N+1 if an inequality comparison)
- are known to be zero, we can do this by comparing FOO with C
- shifted right N bits so long as the low-order N bits of C are
- zero. */
- if (GET_CODE (XEXP (op0, 1)) == CONST_INT
- && INTVAL (XEXP (op0, 1)) >= 0
- && ((INTVAL (XEXP (op0, 1)) + ! equality_comparison_p)
- < HOST_BITS_PER_WIDE_INT)
- && ((const_op
- & (((HOST_WIDE_INT) 1 << INTVAL (XEXP (op0, 1))) - 1)) == 0)
- && mode_width <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (XEXP (op0, 0), mode)
- & ~ (mask >> (INTVAL (XEXP (op0, 1))
- + ! equality_comparison_p))) == 0)
- {
- const_op >>= INTVAL (XEXP (op0, 1));
- op1 = GEN_INT (const_op);
- op0 = XEXP (op0, 0);
- continue;
- }
-
- /* If we are doing a sign bit comparison, it means we are testing
- a particular bit. Convert it to the appropriate AND. */
- if (sign_bit_comparison_p && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && mode_width <= HOST_BITS_PER_WIDE_INT)
- {
- op0 = simplify_and_const_int (NULL_RTX, mode, XEXP (op0, 0),
- ((HOST_WIDE_INT) 1
- << (mode_width - 1
- - INTVAL (XEXP (op0, 1)))));
- code = (code == LT ? NE : EQ);
- continue;
- }
-
- /* If this an equality comparison with zero and we are shifting
- the low bit to the sign bit, we can convert this to an AND of the
- low-order bit. */
- if (const_op == 0 && equality_comparison_p
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && INTVAL (XEXP (op0, 1)) == mode_width - 1)
- {
- op0 = simplify_and_const_int (NULL_RTX, mode, XEXP (op0, 0),
- (HOST_WIDE_INT) 1);
- continue;
- }
- break;
-
- case ASHIFTRT:
- /* If this is an equality comparison with zero, we can do this
- as a logical shift, which might be much simpler. */
- if (equality_comparison_p && const_op == 0
- && GET_CODE (XEXP (op0, 1)) == CONST_INT)
- {
- op0 = simplify_shift_const (NULL_RTX, LSHIFTRT, mode,
- XEXP (op0, 0),
- INTVAL (XEXP (op0, 1)));
- continue;
- }
-
- /* If OP0 is a sign extension and CODE is not an unsigned comparison,
- do the comparison in a narrower mode. */
- if (! unsigned_comparison_p
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && GET_CODE (XEXP (op0, 0)) == ASHIFT
- && XEXP (op0, 1) == XEXP (XEXP (op0, 0), 1)
- && (tmode = mode_for_size (mode_width - INTVAL (XEXP (op0, 1)),
- MODE_INT, 1)) != BLKmode
- && ((unsigned HOST_WIDE_INT) const_op <= GET_MODE_MASK (tmode)
- || ((unsigned HOST_WIDE_INT) - const_op
- <= GET_MODE_MASK (tmode))))
- {
- op0 = gen_lowpart_for_combine (tmode, XEXP (XEXP (op0, 0), 0));
- continue;
- }
-
- /* ... fall through ... */
- case LSHIFTRT:
- /* If we have (compare (xshiftrt FOO N) (const_int C)) and
- the low order N bits of FOO are known to be zero, we can do this
- by comparing FOO with C shifted left N bits so long as no
- overflow occurs. */
- if (GET_CODE (XEXP (op0, 1)) == CONST_INT
- && INTVAL (XEXP (op0, 1)) >= 0
- && INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT
- && mode_width <= HOST_BITS_PER_WIDE_INT
- && (nonzero_bits (XEXP (op0, 0), mode)
- & (((HOST_WIDE_INT) 1 << INTVAL (XEXP (op0, 1))) - 1)) == 0
- && (const_op == 0
- || (floor_log2 (const_op) + INTVAL (XEXP (op0, 1))
- < mode_width)))
- {
- const_op <<= INTVAL (XEXP (op0, 1));
- op1 = GEN_INT (const_op);
- op0 = XEXP (op0, 0);
- continue;
- }
-
- /* If we are using this shift to extract just the sign bit, we
- can replace this with an LT or GE comparison. */
- if (const_op == 0
- && (equality_comparison_p || sign_bit_comparison_p)
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && INTVAL (XEXP (op0, 1)) == mode_width - 1)
- {
- op0 = XEXP (op0, 0);
- code = (code == NE || code == GT ? LT : GE);
- continue;
- }
- break;
- }
-
- break;
- }
-
- /* Now make any compound operations involved in this comparison. Then,
- check for an outmost SUBREG on OP0 that isn't doing anything or is
- paradoxical. The latter case can only occur when it is known that the
- "extra" bits will be zero. Therefore, it is safe to remove the SUBREG.
- We can never remove a SUBREG for a non-equality comparison because the
- sign bit is in a different place in the underlying object. */
-
- op0 = make_compound_operation (op0, op1 == const0_rtx ? COMPARE : SET);
- op1 = make_compound_operation (op1, SET);
-
- if (GET_CODE (op0) == SUBREG && subreg_lowpart_p (op0)
- && GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT
- && (code == NE || code == EQ)
- && ((GET_MODE_SIZE (GET_MODE (op0))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0))))))
- {
- op0 = SUBREG_REG (op0);
- op1 = gen_lowpart_for_combine (GET_MODE (op0), op1);
- }
-
- else if (GET_CODE (op0) == SUBREG && subreg_lowpart_p (op0)
- && GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT
- && (code == NE || code == EQ)
- && (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0)))
- <= HOST_BITS_PER_WIDE_INT)
- && (nonzero_bits (SUBREG_REG (op0), GET_MODE (SUBREG_REG (op0)))
- & ~ GET_MODE_MASK (GET_MODE (op0))) == 0
- && (tem = gen_lowpart_for_combine (GET_MODE (SUBREG_REG (op0)),
- op1),
- (nonzero_bits (tem, GET_MODE (SUBREG_REG (op0)))
- & ~ GET_MODE_MASK (GET_MODE (op0))) == 0))
- op0 = SUBREG_REG (op0), op1 = tem;
-
- /* We now do the opposite procedure: Some machines don't have compare
- insns in all modes. If OP0's mode is an integer mode smaller than a
- word and we can't do a compare in that mode, see if there is a larger
- mode for which we can do the compare. There are a number of cases in
- which we can use the wider mode. */
-
- mode = GET_MODE (op0);
- if (mode != VOIDmode && GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_SIZE (mode) < UNITS_PER_WORD
- && cmp_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing)
- for (tmode = GET_MODE_WIDER_MODE (mode);
- (tmode != VOIDmode
- && GET_MODE_BITSIZE (tmode) <= HOST_BITS_PER_WIDE_INT);
- tmode = GET_MODE_WIDER_MODE (tmode))
- if (cmp_optab->handlers[(int) tmode].insn_code != CODE_FOR_nothing)
- {
- /* If the only nonzero bits in OP0 and OP1 are those in the
- narrower mode and this is an equality or unsigned comparison,
- we can use the wider mode. Similarly for sign-extended
- values, in which case it is true for all comparisons. */
- if (((code == EQ || code == NE
- || code == GEU || code == GTU || code == LEU || code == LTU)
- && (nonzero_bits (op0, tmode) & ~ GET_MODE_MASK (mode)) == 0
- && (nonzero_bits (op1, tmode) & ~ GET_MODE_MASK (mode)) == 0)
- || ((num_sign_bit_copies (op0, tmode)
- > GET_MODE_BITSIZE (tmode) - GET_MODE_BITSIZE (mode))
- && (num_sign_bit_copies (op1, tmode)
- > GET_MODE_BITSIZE (tmode) - GET_MODE_BITSIZE (mode))))
- {
- op0 = gen_lowpart_for_combine (tmode, op0);
- op1 = gen_lowpart_for_combine (tmode, op1);
- break;
- }
-
- /* If this is a test for negative, we can make an explicit
- test of the sign bit. */
-
- if (op1 == const0_rtx && (code == LT || code == GE)
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
- {
- op0 = gen_binary (AND, tmode,
- gen_lowpart_for_combine (tmode, op0),
- GEN_INT ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (mode) - 1)));
- code = (code == LT) ? NE : EQ;
- break;
- }
- }
-
-#ifdef CANONICALIZE_COMPARISON
- /* If this machine only supports a subset of valid comparisons, see if we
- can convert an unsupported one into a supported one. */
- CANONICALIZE_COMPARISON (code, op0, op1);
-#endif
-
- *pop0 = op0;
- *pop1 = op1;
-
- return code;
-}
-
-/* Return 1 if we know that X, a comparison operation, is not operating
- on a floating-point value or is EQ or NE, meaning that we can safely
- reverse it. */
-
-static int
-reversible_comparison_p (x)
- rtx x;
-{
- if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || flag_fast_math
- || GET_CODE (x) == NE || GET_CODE (x) == EQ)
- return 1;
-
- switch (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))))
- {
- case MODE_INT:
- case MODE_PARTIAL_INT:
- case MODE_COMPLEX_INT:
- return 1;
-
- case MODE_CC:
- /* If the mode of the condition codes tells us that this is safe,
- we need look no further. */
- if (REVERSIBLE_CC_MODE (GET_MODE (XEXP (x, 0))))
- return 1;
-
- /* Otherwise try and find where the condition codes were last set and
- use that. */
- x = get_last_value (XEXP (x, 0));
- return (x && GET_CODE (x) == COMPARE
- && ! FLOAT_MODE_P (GET_MODE (XEXP (x, 0))));
- }
-
- return 0;
-}
-
-/* Utility function for following routine. Called when X is part of a value
- being stored into reg_last_set_value. Sets reg_last_set_table_tick
- for each register mentioned. Similar to mention_regs in cse.c */
-
-static void
-update_table_tick (x)
- rtx x;
-{
- register enum rtx_code code = GET_CODE (x);
- register char *fmt = GET_RTX_FORMAT (code);
- register int i;
-
- if (code == REG)
- {
- int regno = REGNO (x);
- int endregno = regno + (regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
-
- for (i = regno; i < endregno; i++)
- reg_last_set_table_tick[i] = label_tick;
-
- return;
- }
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- /* Note that we can't have an "E" in values stored; see
- get_last_value_validate. */
- if (fmt[i] == 'e')
- update_table_tick (XEXP (x, i));
-}
-
-/* Record that REG is set to VALUE in insn INSN. If VALUE is zero, we
- are saying that the register is clobbered and we no longer know its
- value. If INSN is zero, don't update reg_last_set; this is only permitted
- with VALUE also zero and is used to invalidate the register. */
-
-static void
-record_value_for_reg (reg, insn, value)
- rtx reg;
- rtx insn;
- rtx value;
-{
- int regno = REGNO (reg);
- int endregno = regno + (regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (reg)) : 1);
- int i;
-
- /* If VALUE contains REG and we have a previous value for REG, substitute
- the previous value. */
- if (value && insn && reg_overlap_mentioned_p (reg, value))
- {
- rtx tem;
-
- /* Set things up so get_last_value is allowed to see anything set up to
- our insn. */
- subst_low_cuid = INSN_CUID (insn);
- tem = get_last_value (reg);
-
- if (tem)
- value = replace_rtx (copy_rtx (value), reg, tem);
- }
-
- /* For each register modified, show we don't know its value, that
- we don't know about its bitwise content, that its value has been
- updated, and that we don't know the location of the death of the
- register. */
- for (i = regno; i < endregno; i ++)
- {
- if (insn)
- reg_last_set[i] = insn;
- reg_last_set_value[i] = 0;
- reg_last_set_mode[i] = 0;
- reg_last_set_nonzero_bits[i] = 0;
- reg_last_set_sign_bit_copies[i] = 0;
- reg_last_death[i] = 0;
- }
-
- /* Mark registers that are being referenced in this value. */
- if (value)
- update_table_tick (value);
-
- /* Now update the status of each register being set.
- If someone is using this register in this block, set this register
- to invalid since we will get confused between the two lives in this
- basic block. This makes using this register always invalid. In cse, we
- scan the table to invalidate all entries using this register, but this
- is too much work for us. */
-
- for (i = regno; i < endregno; i++)
- {
- reg_last_set_label[i] = label_tick;
- if (value && reg_last_set_table_tick[i] == label_tick)
- reg_last_set_invalid[i] = 1;
- else
- reg_last_set_invalid[i] = 0;
- }
-
- /* The value being assigned might refer to X (like in "x++;"). In that
- case, we must replace it with (clobber (const_int 0)) to prevent
- infinite loops. */
- if (value && ! get_last_value_validate (&value,
- reg_last_set_label[regno], 0))
- {
- value = copy_rtx (value);
- if (! get_last_value_validate (&value, reg_last_set_label[regno], 1))
- value = 0;
- }
-
- /* For the main register being modified, update the value, the mode, the
- nonzero bits, and the number of sign bit copies. */
-
- reg_last_set_value[regno] = value;
-
- if (value)
- {
- subst_low_cuid = INSN_CUID (insn);
- reg_last_set_mode[regno] = GET_MODE (reg);
- reg_last_set_nonzero_bits[regno] = nonzero_bits (value, GET_MODE (reg));
- reg_last_set_sign_bit_copies[regno]
- = num_sign_bit_copies (value, GET_MODE (reg));
- }
-}
-
-/* Used for communication between the following two routines. */
-static rtx record_dead_insn;
-
-/* Called via note_stores from record_dead_and_set_regs to handle one
- SET or CLOBBER in an insn. */
-
-static void
-record_dead_and_set_regs_1 (dest, setter)
- rtx dest, setter;
-{
- if (GET_CODE (dest) == SUBREG)
- dest = SUBREG_REG (dest);
-
- if (GET_CODE (dest) == REG)
- {
- /* If we are setting the whole register, we know its value. Otherwise
- show that we don't know the value. We can handle SUBREG in
- some cases. */
- if (GET_CODE (setter) == SET && dest == SET_DEST (setter))
- record_value_for_reg (dest, record_dead_insn, SET_SRC (setter));
- else if (GET_CODE (setter) == SET
- && GET_CODE (SET_DEST (setter)) == SUBREG
- && SUBREG_REG (SET_DEST (setter)) == dest
- && GET_MODE_BITSIZE (GET_MODE (dest)) <= BITS_PER_WORD
- && subreg_lowpart_p (SET_DEST (setter)))
- record_value_for_reg (dest, record_dead_insn,
- gen_lowpart_for_combine (GET_MODE (dest),
- SET_SRC (setter)));
- else
- record_value_for_reg (dest, record_dead_insn, NULL_RTX);
- }
- else if (GET_CODE (dest) == MEM
- /* Ignore pushes, they clobber nothing. */
- && ! push_operand (dest, GET_MODE (dest)))
- mem_last_set = INSN_CUID (record_dead_insn);
-}
-
-/* Update the records of when each REG was most recently set or killed
- for the things done by INSN. This is the last thing done in processing
- INSN in the combiner loop.
-
- We update reg_last_set, reg_last_set_value, reg_last_set_mode,
- reg_last_set_nonzero_bits, reg_last_set_sign_bit_copies, reg_last_death,
- and also the similar information mem_last_set (which insn most recently
- modified memory) and last_call_cuid (which insn was the most recent
- subroutine call). */
-
-static void
-record_dead_and_set_regs (insn)
- rtx insn;
-{
- register rtx link;
- int i;
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- {
- if (REG_NOTE_KIND (link) == REG_DEAD
- && GET_CODE (XEXP (link, 0)) == REG)
- {
- int regno = REGNO (XEXP (link, 0));
- int endregno
- = regno + (regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (XEXP (link, 0)))
- : 1);
-
- for (i = regno; i < endregno; i++)
- reg_last_death[i] = insn;
- }
- else if (REG_NOTE_KIND (link) == REG_INC)
- record_value_for_reg (XEXP (link, 0), insn, NULL_RTX);
- }
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i])
- {
- reg_last_set_value[i] = 0;
- reg_last_set_mode[i] = 0;
- reg_last_set_nonzero_bits[i] = 0;
- reg_last_set_sign_bit_copies[i] = 0;
- reg_last_death[i] = 0;
- }
-
- last_call_cuid = mem_last_set = INSN_CUID (insn);
- }
-
- record_dead_insn = insn;
- note_stores (PATTERN (insn), record_dead_and_set_regs_1);
-}
-
-/* Utility routine for the following function. Verify that all the registers
- mentioned in *LOC are valid when *LOC was part of a value set when
- label_tick == TICK. Return 0 if some are not.
-
- If REPLACE is non-zero, replace the invalid reference with
- (clobber (const_int 0)) and return 1. This replacement is useful because
- we often can get useful information about the form of a value (e.g., if
- it was produced by a shift that always produces -1 or 0) even though
- we don't know exactly what registers it was produced from. */
-
-static int
-get_last_value_validate (loc, tick, replace)
- rtx *loc;
- int tick;
- int replace;
-{
- rtx x = *loc;
- char *fmt = GET_RTX_FORMAT (GET_CODE (x));
- int len = GET_RTX_LENGTH (GET_CODE (x));
- int i;
-
- if (GET_CODE (x) == REG)
- {
- int regno = REGNO (x);
- int endregno = regno + (regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
- int j;
-
- for (j = regno; j < endregno; j++)
- if (reg_last_set_invalid[j]
- /* If this is a pseudo-register that was only set once, it is
- always valid. */
- || (! (regno >= FIRST_PSEUDO_REGISTER && reg_n_sets[regno] == 1)
- && reg_last_set_label[j] > tick))
- {
- if (replace)
- *loc = gen_rtx (CLOBBER, GET_MODE (x), const0_rtx);
- return replace;
- }
-
- return 1;
- }
-
- for (i = 0; i < len; i++)
- if ((fmt[i] == 'e'
- && get_last_value_validate (&XEXP (x, i), tick, replace) == 0)
- /* Don't bother with these. They shouldn't occur anyway. */
- || fmt[i] == 'E')
- return 0;
-
- /* If we haven't found a reason for it to be invalid, it is valid. */
- return 1;
-}
-
-/* Get the last value assigned to X, if known. Some registers
- in the value may be replaced with (clobber (const_int 0)) if their value
- is known longer known reliably. */
-
-static rtx
-get_last_value (x)
- rtx x;
-{
- int regno;
- rtx value;
-
- /* If this is a non-paradoxical SUBREG, get the value of its operand and
- then convert it to the desired mode. If this is a paradoxical SUBREG,
- we cannot predict what values the "extra" bits might have. */
- if (GET_CODE (x) == SUBREG
- && subreg_lowpart_p (x)
- && (GET_MODE_SIZE (GET_MODE (x))
- <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- && (value = get_last_value (SUBREG_REG (x))) != 0)
- return gen_lowpart_for_combine (GET_MODE (x), value);
-
- if (GET_CODE (x) != REG)
- return 0;
-
- regno = REGNO (x);
- value = reg_last_set_value[regno];
-
- /* If we don't have a value or if it isn't for this basic block,
- return 0. */
-
- if (value == 0
- || (reg_n_sets[regno] != 1
- && reg_last_set_label[regno] != label_tick))
- return 0;
-
- /* If the value was set in a later insn than the ones we are processing,
- we can't use it even if the register was only set once, but make a quick
- check to see if the previous insn set it to something. This is commonly
- the case when the same pseudo is used by repeated insns.
-
- This does not work if there exists an instruction which is temporarily
- not on the insn chain. */
-
- if (INSN_CUID (reg_last_set[regno]) >= subst_low_cuid)
- {
- rtx insn, set;
-
- /* We can not do anything useful in this case, because there is
- an instruction which is not on the insn chain. */
- if (subst_prev_insn)
- return 0;
-
- /* Skip over USE insns. They are not useful here, and they may have
- been made by combine, in which case they do not have a INSN_CUID
- value. We can't use prev_real_insn, because that would incorrectly
- take us backwards across labels. Skip over BARRIERs also, since
- they could have been made by combine. If we see one, we must be
- optimizing dead code, so it doesn't matter what we do. */
- for (insn = prev_nonnote_insn (subst_insn);
- insn && ((GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == USE)
- || GET_CODE (insn) == BARRIER
- || INSN_CUID (insn) >= subst_low_cuid);
- insn = prev_nonnote_insn (insn))
- ;
-
- if (insn
- && (set = single_set (insn)) != 0
- && rtx_equal_p (SET_DEST (set), x))
- {
- value = SET_SRC (set);
-
- /* Make sure that VALUE doesn't reference X. Replace any
- explicit references with a CLOBBER. If there are any remaining
- references (rare), don't use the value. */
-
- if (reg_mentioned_p (x, value))
- value = replace_rtx (copy_rtx (value), x,
- gen_rtx (CLOBBER, GET_MODE (x), const0_rtx));
-
- if (reg_overlap_mentioned_p (x, value))
- return 0;
- }
- else
- return 0;
- }
-
- /* If the value has all its registers valid, return it. */
- if (get_last_value_validate (&value, reg_last_set_label[regno], 0))
- return value;
-
- /* Otherwise, make a copy and replace any invalid register with
- (clobber (const_int 0)). If that fails for some reason, return 0. */
-
- value = copy_rtx (value);
- if (get_last_value_validate (&value, reg_last_set_label[regno], 1))
- return value;
-
- return 0;
-}
-
-/* Return nonzero if expression X refers to a REG or to memory
- that is set in an instruction more recent than FROM_CUID. */
-
-static int
-use_crosses_set_p (x, from_cuid)
- register rtx x;
- int from_cuid;
-{
- register char *fmt;
- register int i;
- register enum rtx_code code = GET_CODE (x);
-
- if (code == REG)
- {
- register int regno = REGNO (x);
- int endreg = regno + (regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
-
-#ifdef PUSH_ROUNDING
- /* Don't allow uses of the stack pointer to be moved,
- because we don't know whether the move crosses a push insn. */
- if (regno == STACK_POINTER_REGNUM)
- return 1;
-#endif
- for (;regno < endreg; regno++)
- if (reg_last_set[regno]
- && INSN_CUID (reg_last_set[regno]) > from_cuid)
- return 1;
- return 0;
- }
-
- if (code == MEM && mem_last_set > from_cuid)
- return 1;
-
- fmt = GET_RTX_FORMAT (code);
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (use_crosses_set_p (XVECEXP (x, i, j), from_cuid))
- return 1;
- }
- else if (fmt[i] == 'e'
- && use_crosses_set_p (XEXP (x, i), from_cuid))
- return 1;
- }
- return 0;
-}
-
-/* Define three variables used for communication between the following
- routines. */
-
-static int reg_dead_regno, reg_dead_endregno;
-static int reg_dead_flag;
-
-/* Function called via note_stores from reg_dead_at_p.
-
- If DEST is within [reg_dead_regno, reg_dead_endregno), set
- reg_dead_flag to 1 if X is a CLOBBER and to -1 it is a SET. */
-
-static void
-reg_dead_at_p_1 (dest, x)
- rtx dest;
- rtx x;
-{
- int regno, endregno;
-
- if (GET_CODE (dest) != REG)
- return;
-
- regno = REGNO (dest);
- endregno = regno + (regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (dest)) : 1);
-
- if (reg_dead_endregno > regno && reg_dead_regno < endregno)
- reg_dead_flag = (GET_CODE (x) == CLOBBER) ? 1 : -1;
-}
-
-/* Return non-zero if REG is known to be dead at INSN.
-
- We scan backwards from INSN. If we hit a REG_DEAD note or a CLOBBER
- referencing REG, it is dead. If we hit a SET referencing REG, it is
- live. Otherwise, see if it is live or dead at the start of the basic
- block we are in. Hard regs marked as being live in NEWPAT_USED_REGS
- must be assumed to be always live. */
-
-static int
-reg_dead_at_p (reg, insn)
- rtx reg;
- rtx insn;
-{
- int block, i;
-
- /* Set variables for reg_dead_at_p_1. */
- reg_dead_regno = REGNO (reg);
- reg_dead_endregno = reg_dead_regno + (reg_dead_regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (reg_dead_regno,
- GET_MODE (reg))
- : 1);
-
- reg_dead_flag = 0;
-
- /* Check that reg isn't mentioned in NEWPAT_USED_REGS. */
- if (reg_dead_regno < FIRST_PSEUDO_REGISTER)
- {
- for (i = reg_dead_regno; i < reg_dead_endregno; i++)
- if (TEST_HARD_REG_BIT (newpat_used_regs, i))
- return 0;
- }
-
- /* Scan backwards until we find a REG_DEAD note, SET, CLOBBER, label, or
- beginning of function. */
- for (; insn && GET_CODE (insn) != CODE_LABEL && GET_CODE (insn) != BARRIER;
- insn = prev_nonnote_insn (insn))
- {
- note_stores (PATTERN (insn), reg_dead_at_p_1);
- if (reg_dead_flag)
- return reg_dead_flag == 1 ? 1 : 0;
-
- if (find_regno_note (insn, REG_DEAD, reg_dead_regno))
- return 1;
- }
-
- /* Get the basic block number that we were in. */
- if (insn == 0)
- block = 0;
- else
- {
- for (block = 0; block < n_basic_blocks; block++)
- if (insn == basic_block_head[block])
- break;
-
- if (block == n_basic_blocks)
- return 0;
- }
-
- for (i = reg_dead_regno; i < reg_dead_endregno; i++)
- if (basic_block_live_at_start[block][i / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS)))
- return 0;
-
- return 1;
-}
-
-/* Note hard registers in X that are used. This code is similar to
- that in flow.c, but much simpler since we don't care about pseudos. */
-
-static void
-mark_used_regs_combine (x)
- rtx x;
-{
- register RTX_CODE code = GET_CODE (x);
- register int regno;
- int i;
-
- switch (code)
- {
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST_INT:
- case CONST:
- case CONST_DOUBLE:
- case PC:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case ASM_INPUT:
-#ifdef HAVE_cc0
- /* CC0 must die in the insn after it is set, so we don't need to take
- special note of it here. */
- case CC0:
-#endif
- return;
-
- case CLOBBER:
- /* If we are clobbering a MEM, mark any hard registers inside the
- address as used. */
- if (GET_CODE (XEXP (x, 0)) == MEM)
- mark_used_regs_combine (XEXP (XEXP (x, 0), 0));
- return;
-
- case REG:
- regno = REGNO (x);
- /* A hard reg in a wide mode may really be multiple registers.
- If so, mark all of them just like the first. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- /* None of this applies to the stack, frame or arg pointers */
- if (regno == STACK_POINTER_REGNUM
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- || regno == HARD_FRAME_POINTER_REGNUM
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
-#endif
- || regno == FRAME_POINTER_REGNUM)
- return;
-
- i = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (i-- > 0)
- SET_HARD_REG_BIT (newpat_used_regs, regno + i);
- }
- return;
-
- case SET:
- {
- /* If setting a MEM, or a SUBREG of a MEM, then note any hard regs in
- the address. */
- register rtx testreg = SET_DEST (x);
-
- while (GET_CODE (testreg) == SUBREG
- || GET_CODE (testreg) == ZERO_EXTRACT
- || GET_CODE (testreg) == SIGN_EXTRACT
- || GET_CODE (testreg) == STRICT_LOW_PART)
- testreg = XEXP (testreg, 0);
-
- if (GET_CODE (testreg) == MEM)
- mark_used_regs_combine (XEXP (testreg, 0));
-
- mark_used_regs_combine (SET_SRC (x));
- return;
- }
- }
-
- /* Recursively scan the operands of this expression. */
-
- {
- register char *fmt = GET_RTX_FORMAT (code);
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- mark_used_regs_combine (XEXP (x, i));
- else if (fmt[i] == 'E')
- {
- register int j;
-
- for (j = 0; j < XVECLEN (x, i); j++)
- mark_used_regs_combine (XVECEXP (x, i, j));
- }
- }
- }
-}
-
-
-/* Remove register number REGNO from the dead registers list of INSN.
-
- Return the note used to record the death, if there was one. */
-
-rtx
-remove_death (regno, insn)
- int regno;
- rtx insn;
-{
- register rtx note = find_regno_note (insn, REG_DEAD, regno);
-
- if (note)
- {
- reg_n_deaths[regno]--;
- remove_note (insn, note);
- }
-
- return note;
-}
-
-/* For each register (hardware or pseudo) used within expression X, if its
- death is in an instruction with cuid between FROM_CUID (inclusive) and
- TO_INSN (exclusive), put a REG_DEAD note for that register in the
- list headed by PNOTES.
-
- That said, don't move registers killed by maybe_kill_insn.
-
- This is done when X is being merged by combination into TO_INSN. These
- notes will then be distributed as needed. */
-
-static void
-move_deaths (x, maybe_kill_insn, from_cuid, to_insn, pnotes)
- rtx x;
- rtx maybe_kill_insn;
- int from_cuid;
- rtx to_insn;
- rtx *pnotes;
-{
- register char *fmt;
- register int len, i;
- register enum rtx_code code = GET_CODE (x);
-
- if (code == REG)
- {
- register int regno = REGNO (x);
- register rtx where_dead = reg_last_death[regno];
- register rtx before_dead, after_dead;
-
- /* Don't move the register if it gets killed in between from and to */
- if (maybe_kill_insn && reg_set_p (x, maybe_kill_insn)
- && !reg_referenced_p (x, maybe_kill_insn))
- return;
-
- /* WHERE_DEAD could be a USE insn made by combine, so first we
- make sure that we have insns with valid INSN_CUID values. */
- before_dead = where_dead;
- while (before_dead && INSN_UID (before_dead) > max_uid_cuid)
- before_dead = PREV_INSN (before_dead);
- after_dead = where_dead;
- while (after_dead && INSN_UID (after_dead) > max_uid_cuid)
- after_dead = NEXT_INSN (after_dead);
-
- if (before_dead && after_dead
- && INSN_CUID (before_dead) >= from_cuid
- && (INSN_CUID (after_dead) < INSN_CUID (to_insn)
- || (where_dead != after_dead
- && INSN_CUID (after_dead) == INSN_CUID (to_insn))))
- {
- rtx note = remove_death (regno, where_dead);
-
- /* It is possible for the call above to return 0. This can occur
- when reg_last_death points to I2 or I1 that we combined with.
- In that case make a new note.
-
- We must also check for the case where X is a hard register
- and NOTE is a death note for a range of hard registers
- including X. In that case, we must put REG_DEAD notes for
- the remaining registers in place of NOTE. */
-
- if (note != 0 && regno < FIRST_PSEUDO_REGISTER
- && (GET_MODE_SIZE (GET_MODE (XEXP (note, 0)))
- > GET_MODE_SIZE (GET_MODE (x))))
- {
- int deadregno = REGNO (XEXP (note, 0));
- int deadend
- = (deadregno + HARD_REGNO_NREGS (deadregno,
- GET_MODE (XEXP (note, 0))));
- int ourend = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
- int i;
-
- for (i = deadregno; i < deadend; i++)
- if (i < regno || i >= ourend)
- REG_NOTES (where_dead)
- = gen_rtx (EXPR_LIST, REG_DEAD,
- gen_rtx (REG, reg_raw_mode[i], i),
- REG_NOTES (where_dead));
- }
- /* If we didn't find any note, or if we found a REG_DEAD note that
- covers only part of the given reg, and we have a multi-reg hard
- register, then to be safe we must check for REG_DEAD notes
- for each register other than the first. They could have
- their own REG_DEAD notes lying around. */
- else if ((note == 0
- || (note != 0
- && (GET_MODE_SIZE (GET_MODE (XEXP (note, 0)))
- < GET_MODE_SIZE (GET_MODE (x)))))
- && regno < FIRST_PSEUDO_REGISTER
- && HARD_REGNO_NREGS (regno, GET_MODE (x)) > 1)
- {
- int ourend = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
- int i, offset;
- rtx oldnotes = 0;
-
- if (note)
- offset = HARD_REGNO_NREGS (regno, GET_MODE (XEXP (note, 0)));
- else
- offset = 1;
-
- for (i = regno + offset; i < ourend; i++)
- move_deaths (gen_rtx (REG, reg_raw_mode[i], i),
- maybe_kill_insn, from_cuid, to_insn, &oldnotes);
- }
-
- if (note != 0 && GET_MODE (XEXP (note, 0)) == GET_MODE (x))
- {
- XEXP (note, 1) = *pnotes;
- *pnotes = note;
- }
- else
- *pnotes = gen_rtx (EXPR_LIST, REG_DEAD, x, *pnotes);
-
- reg_n_deaths[regno]++;
- }
-
- return;
- }
-
- else if (GET_CODE (x) == SET)
- {
- rtx dest = SET_DEST (x);
-
- move_deaths (SET_SRC (x), maybe_kill_insn, from_cuid, to_insn, pnotes);
-
- /* In the case of a ZERO_EXTRACT, a STRICT_LOW_PART, or a SUBREG
- that accesses one word of a multi-word item, some
- piece of everything register in the expression is used by
- this insn, so remove any old death. */
-
- if (GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == STRICT_LOW_PART
- || (GET_CODE (dest) == SUBREG
- && (((GET_MODE_SIZE (GET_MODE (dest))
- + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
- == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest)))
- + UNITS_PER_WORD - 1) / UNITS_PER_WORD))))
- {
- move_deaths (dest, maybe_kill_insn, from_cuid, to_insn, pnotes);
- return;
- }
-
- /* If this is some other SUBREG, we know it replaces the entire
- value, so use that as the destination. */
- if (GET_CODE (dest) == SUBREG)
- dest = SUBREG_REG (dest);
-
- /* If this is a MEM, adjust deaths of anything used in the address.
- For a REG (the only other possibility), the entire value is
- being replaced so the old value is not used in this insn. */
-
- if (GET_CODE (dest) == MEM)
- move_deaths (XEXP (dest, 0), maybe_kill_insn, from_cuid,
- to_insn, pnotes);
- return;
- }
-
- else if (GET_CODE (x) == CLOBBER)
- return;
-
- len = GET_RTX_LENGTH (code);
- fmt = GET_RTX_FORMAT (code);
-
- for (i = 0; i < len; i++)
- {
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- move_deaths (XVECEXP (x, i, j), maybe_kill_insn, from_cuid,
- to_insn, pnotes);
- }
- else if (fmt[i] == 'e')
- move_deaths (XEXP (x, i), maybe_kill_insn, from_cuid, to_insn, pnotes);
- }
-}
-
-/* Return 1 if X is the target of a bit-field assignment in BODY, the
- pattern of an insn. X must be a REG. */
-
-static int
-reg_bitfield_target_p (x, body)
- rtx x;
- rtx body;
-{
- int i;
-
- if (GET_CODE (body) == SET)
- {
- rtx dest = SET_DEST (body);
- rtx target;
- int regno, tregno, endregno, endtregno;
-
- if (GET_CODE (dest) == ZERO_EXTRACT)
- target = XEXP (dest, 0);
- else if (GET_CODE (dest) == STRICT_LOW_PART)
- target = SUBREG_REG (XEXP (dest, 0));
- else
- return 0;
-
- if (GET_CODE (target) == SUBREG)
- target = SUBREG_REG (target);
-
- if (GET_CODE (target) != REG)
- return 0;
-
- tregno = REGNO (target), regno = REGNO (x);
- if (tregno >= FIRST_PSEUDO_REGISTER || regno >= FIRST_PSEUDO_REGISTER)
- return target == x;
-
- endtregno = tregno + HARD_REGNO_NREGS (tregno, GET_MODE (target));
- endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
-
- return endregno > tregno && regno < endtregno;
- }
-
- else if (GET_CODE (body) == PARALLEL)
- for (i = XVECLEN (body, 0) - 1; i >= 0; i--)
- if (reg_bitfield_target_p (x, XVECEXP (body, 0, i)))
- return 1;
-
- return 0;
-}
-
-/* Given a chain of REG_NOTES originally from FROM_INSN, try to place them
- as appropriate. I3 and I2 are the insns resulting from the combination
- insns including FROM (I2 may be zero).
-
- ELIM_I2 and ELIM_I1 are either zero or registers that we know will
- not need REG_DEAD notes because they are being substituted for. This
- saves searching in the most common cases.
-
- Each note in the list is either ignored or placed on some insns, depending
- on the type of note. */
-
-static void
-distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
- rtx notes;
- rtx from_insn;
- rtx i3, i2;
- rtx elim_i2, elim_i1;
-{
- rtx note, next_note;
- rtx tem;
-
- for (note = notes; note; note = next_note)
- {
- rtx place = 0, place2 = 0;
-
- /* If this NOTE references a pseudo register, ensure it references
- the latest copy of that register. */
- if (XEXP (note, 0) && GET_CODE (XEXP (note, 0)) == REG
- && REGNO (XEXP (note, 0)) >= FIRST_PSEUDO_REGISTER)
- XEXP (note, 0) = regno_reg_rtx[REGNO (XEXP (note, 0))];
-
- next_note = XEXP (note, 1);
- switch (REG_NOTE_KIND (note))
- {
- case REG_BR_PROB:
- case REG_EXEC_COUNT:
- /* Doesn't matter much where we put this, as long as it's somewhere.
- It is preferable to keep these notes on branches, which is most
- likely to be i3. */
- place = i3;
- break;
-
- case REG_UNUSED:
- /* Any clobbers for i3 may still exist, and so we must process
- REG_UNUSED notes from that insn.
-
- Any clobbers from i2 or i1 can only exist if they were added by
- recog_for_combine. In that case, recog_for_combine created the
- necessary REG_UNUSED notes. Trying to keep any original
- REG_UNUSED notes from these insns can cause incorrect output
- if it is for the same register as the original i3 dest.
- In that case, we will notice that the register is set in i3,
- and then add a REG_UNUSED note for the destination of i3, which
- is wrong. However, it is possible to have REG_UNUSED notes from
- i2 or i1 for register which were both used and clobbered, so
- we keep notes from i2 or i1 if they will turn into REG_DEAD
- notes. */
-
- /* If this register is set or clobbered in I3, put the note there
- unless there is one already. */
- if (reg_set_p (XEXP (note, 0), PATTERN (i3)))
- {
- if (from_insn != i3)
- break;
-
- if (! (GET_CODE (XEXP (note, 0)) == REG
- ? find_regno_note (i3, REG_UNUSED, REGNO (XEXP (note, 0)))
- : find_reg_note (i3, REG_UNUSED, XEXP (note, 0))))
- place = i3;
- }
- /* Otherwise, if this register is used by I3, then this register
- now dies here, so we must put a REG_DEAD note here unless there
- is one already. */
- else if (reg_referenced_p (XEXP (note, 0), PATTERN (i3))
- && ! (GET_CODE (XEXP (note, 0)) == REG
- ? find_regno_note (i3, REG_DEAD, REGNO (XEXP (note, 0)))
- : find_reg_note (i3, REG_DEAD, XEXP (note, 0))))
- {
- PUT_REG_NOTE_KIND (note, REG_DEAD);
- place = i3;
- }
- break;
-
- case REG_EQUAL:
- case REG_EQUIV:
- case REG_NONNEG:
- /* These notes say something about results of an insn. We can
- only support them if they used to be on I3 in which case they
- remain on I3. Otherwise they are ignored.
-
- If the note refers to an expression that is not a constant, we
- must also ignore the note since we cannot tell whether the
- equivalence is still true. It might be possible to do
- slightly better than this (we only have a problem if I2DEST
- or I1DEST is present in the expression), but it doesn't
- seem worth the trouble. */
-
- if (from_insn == i3
- && (XEXP (note, 0) == 0 || CONSTANT_P (XEXP (note, 0))))
- place = i3;
- break;
-
- case REG_INC:
- case REG_NO_CONFLICT:
- case REG_LABEL:
- /* These notes say something about how a register is used. They must
- be present on any use of the register in I2 or I3. */
- if (reg_mentioned_p (XEXP (note, 0), PATTERN (i3)))
- place = i3;
-
- if (i2 && reg_mentioned_p (XEXP (note, 0), PATTERN (i2)))
- {
- if (place)
- place2 = i2;
- else
- place = i2;
- }
- break;
-
- case REG_WAS_0:
- /* It is too much trouble to try to see if this note is still
- correct in all situations. It is better to simply delete it. */
- break;
-
- case REG_RETVAL:
- /* If the insn previously containing this note still exists,
- put it back where it was. Otherwise move it to the previous
- insn. Adjust the corresponding REG_LIBCALL note. */
- if (GET_CODE (from_insn) != NOTE)
- place = from_insn;
- else
- {
- tem = find_reg_note (XEXP (note, 0), REG_LIBCALL, NULL_RTX);
- place = prev_real_insn (from_insn);
- if (tem && place)
- XEXP (tem, 0) = place;
- }
- break;
-
- case REG_LIBCALL:
- /* This is handled similarly to REG_RETVAL. */
- if (GET_CODE (from_insn) != NOTE)
- place = from_insn;
- else
- {
- tem = find_reg_note (XEXP (note, 0), REG_RETVAL, NULL_RTX);
- place = next_real_insn (from_insn);
- if (tem && place)
- XEXP (tem, 0) = place;
- }
- break;
-
- case REG_DEAD:
- /* If the register is used as an input in I3, it dies there.
- Similarly for I2, if it is non-zero and adjacent to I3.
-
- If the register is not used as an input in either I3 or I2
- and it is not one of the registers we were supposed to eliminate,
- there are two possibilities. We might have a non-adjacent I2
- or we might have somehow eliminated an additional register
- from a computation. For example, we might have had A & B where
- we discover that B will always be zero. In this case we will
- eliminate the reference to A.
-
- In both cases, we must search to see if we can find a previous
- use of A and put the death note there. */
-
- if (from_insn
- && GET_CODE (from_insn) == CALL_INSN
- && find_reg_fusage (from_insn, USE, XEXP (note, 0)))
- place = from_insn;
- else if (reg_referenced_p (XEXP (note, 0), PATTERN (i3)))
- place = i3;
- else if (i2 != 0 && next_nonnote_insn (i2) == i3
- && reg_referenced_p (XEXP (note, 0), PATTERN (i2)))
- place = i2;
-
- if (XEXP (note, 0) == elim_i2 || XEXP (note, 0) == elim_i1)
- break;
-
- /* If the register is used in both I2 and I3 and it dies in I3,
- we might have added another reference to it. If reg_n_refs
- was 2, bump it to 3. This has to be correct since the
- register must have been set somewhere. The reason this is
- done is because local-alloc.c treats 2 references as a
- special case. */
-
- if (place == i3 && i2 != 0 && GET_CODE (XEXP (note, 0)) == REG
- && reg_n_refs[REGNO (XEXP (note, 0))]== 2
- && reg_referenced_p (XEXP (note, 0), PATTERN (i2)))
- reg_n_refs[REGNO (XEXP (note, 0))] = 3;
-
- if (place == 0)
- {
- for (tem = prev_nonnote_insn (i3);
- place == 0 && tem
- && (GET_CODE (tem) == INSN || GET_CODE (tem) == CALL_INSN);
- tem = prev_nonnote_insn (tem))
- {
- /* If the register is being set at TEM, see if that is all
- TEM is doing. If so, delete TEM. Otherwise, make this
- into a REG_UNUSED note instead. */
- if (reg_set_p (XEXP (note, 0), PATTERN (tem)))
- {
- rtx set = single_set (tem);
-
- /* Verify that it was the set, and not a clobber that
- modified the register. */
-
- if (set != 0 && ! side_effects_p (SET_SRC (set))
- && (rtx_equal_p (XEXP (note, 0), SET_DEST (set))
- || (GET_CODE (SET_DEST (set)) == SUBREG
- && rtx_equal_p (XEXP (note, 0),
- XEXP (SET_DEST (set), 0)))))
- {
- /* Move the notes and links of TEM elsewhere.
- This might delete other dead insns recursively.
- First set the pattern to something that won't use
- any register. */
-
- PATTERN (tem) = pc_rtx;
-
- distribute_notes (REG_NOTES (tem), tem, tem,
- NULL_RTX, NULL_RTX, NULL_RTX);
- distribute_links (LOG_LINKS (tem));
-
- PUT_CODE (tem, NOTE);
- NOTE_LINE_NUMBER (tem) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (tem) = 0;
- }
- else
- {
- PUT_REG_NOTE_KIND (note, REG_UNUSED);
-
- /* If there isn't already a REG_UNUSED note, put one
- here. */
- if (! find_regno_note (tem, REG_UNUSED,
- REGNO (XEXP (note, 0))))
- place = tem;
- break;
- }
- }
- else if (reg_referenced_p (XEXP (note, 0), PATTERN (tem))
- || (GET_CODE (tem) == CALL_INSN
- && find_reg_fusage (tem, USE, XEXP (note, 0))))
- {
- place = tem;
-
- /* If we are doing a 3->2 combination, and we have a
- register which formerly died in i3 and was not used
- by i2, which now no longer dies in i3 and is used in
- i2 but does not die in i2, and place is between i2
- and i3, then we may need to move a link from place to
- i2. */
- if (i2 && INSN_UID (place) <= max_uid_cuid
- && INSN_CUID (place) > INSN_CUID (i2)
- && from_insn && INSN_CUID (from_insn) > INSN_CUID (i2)
- && reg_referenced_p (XEXP (note, 0), PATTERN (i2)))
- {
- rtx links = LOG_LINKS (place);
- LOG_LINKS (place) = 0;
- distribute_links (links);
- }
- break;
- }
- }
-
- /* If we haven't found an insn for the death note and it
- is still a REG_DEAD note, but we have hit a CODE_LABEL,
- insert a USE insn for the register at that label and
- put the death node there. This prevents problems with
- call-state tracking in caller-save.c. */
- if (REG_NOTE_KIND (note) == REG_DEAD && place == 0 && tem != 0)
- {
- place
- = emit_insn_after (gen_rtx (USE, VOIDmode, XEXP (note, 0)),
- tem);
-
- /* If this insn was emitted between blocks, then update
- basic_block_head of the current block to include it. */
- if (basic_block_end[this_basic_block - 1] == tem)
- basic_block_head[this_basic_block] = place;
- }
- }
-
- /* If the register is set or already dead at PLACE, we needn't do
- anything with this note if it is still a REG_DEAD note.
-
- Note that we cannot use just `dead_or_set_p' here since we can
- convert an assignment to a register into a bit-field assignment.
- Therefore, we must also omit the note if the register is the
- target of a bitfield assignment. */
-
- if (place && REG_NOTE_KIND (note) == REG_DEAD)
- {
- int regno = REGNO (XEXP (note, 0));
-
- if (dead_or_set_p (place, XEXP (note, 0))
- || reg_bitfield_target_p (XEXP (note, 0), PATTERN (place)))
- {
- /* Unless the register previously died in PLACE, clear
- reg_last_death. [I no longer understand why this is
- being done.] */
- if (reg_last_death[regno] != place)
- reg_last_death[regno] = 0;
- place = 0;
- }
- else
- reg_last_death[regno] = place;
-
- /* If this is a death note for a hard reg that is occupying
- multiple registers, ensure that we are still using all
- parts of the object. If we find a piece of the object
- that is unused, we must add a USE for that piece before
- PLACE and put the appropriate REG_DEAD note on it.
-
- An alternative would be to put a REG_UNUSED for the pieces
- on the insn that set the register, but that can't be done if
- it is not in the same block. It is simpler, though less
- efficient, to add the USE insns. */
-
- if (place && regno < FIRST_PSEUDO_REGISTER
- && HARD_REGNO_NREGS (regno, GET_MODE (XEXP (note, 0))) > 1)
- {
- int endregno
- = regno + HARD_REGNO_NREGS (regno,
- GET_MODE (XEXP (note, 0)));
- int all_used = 1;
- int i;
-
- for (i = regno; i < endregno; i++)
- if (! refers_to_regno_p (i, i + 1, PATTERN (place), 0)
- && ! find_regno_fusage (place, USE, i))
- {
- rtx piece = gen_rtx (REG, reg_raw_mode[i], i);
- rtx p;
-
- /* See if we already placed a USE note for this
- register in front of PLACE. */
- for (p = place;
- GET_CODE (PREV_INSN (p)) == INSN
- && GET_CODE (PATTERN (PREV_INSN (p))) == USE;
- p = PREV_INSN (p))
- if (rtx_equal_p (piece,
- XEXP (PATTERN (PREV_INSN (p)), 0)))
- {
- p = 0;
- break;
- }
-
- if (p)
- {
- rtx use_insn
- = emit_insn_before (gen_rtx (USE, VOIDmode,
- piece),
- p);
- REG_NOTES (use_insn)
- = gen_rtx (EXPR_LIST, REG_DEAD, piece,
- REG_NOTES (use_insn));
- }
-
- all_used = 0;
- }
-
- /* Check for the case where the register dying partially
- overlaps the register set by this insn. */
- if (all_used)
- for (i = regno; i < endregno; i++)
- if (dead_or_set_regno_p (place, i))
- {
- all_used = 0;
- break;
- }
-
- if (! all_used)
- {
- /* Put only REG_DEAD notes for pieces that are
- still used and that are not already dead or set. */
-
- for (i = regno; i < endregno; i++)
- {
- rtx piece = gen_rtx (REG, reg_raw_mode[i], i);
-
- if ((reg_referenced_p (piece, PATTERN (place))
- || (GET_CODE (place) == CALL_INSN
- && find_reg_fusage (place, USE, piece)))
- && ! dead_or_set_p (place, piece)
- && ! reg_bitfield_target_p (piece,
- PATTERN (place)))
- REG_NOTES (place) = gen_rtx (EXPR_LIST, REG_DEAD,
- piece,
- REG_NOTES (place));
- }
-
- place = 0;
- }
- }
- }
- break;
-
- default:
- /* Any other notes should not be present at this point in the
- compilation. */
- abort ();
- }
-
- if (place)
- {
- XEXP (note, 1) = REG_NOTES (place);
- REG_NOTES (place) = note;
- }
- else if ((REG_NOTE_KIND (note) == REG_DEAD
- || REG_NOTE_KIND (note) == REG_UNUSED)
- && GET_CODE (XEXP (note, 0)) == REG)
- reg_n_deaths[REGNO (XEXP (note, 0))]--;
-
- if (place2)
- {
- if ((REG_NOTE_KIND (note) == REG_DEAD
- || REG_NOTE_KIND (note) == REG_UNUSED)
- && GET_CODE (XEXP (note, 0)) == REG)
- reg_n_deaths[REGNO (XEXP (note, 0))]++;
-
- REG_NOTES (place2) = gen_rtx (GET_CODE (note), REG_NOTE_KIND (note),
- XEXP (note, 0), REG_NOTES (place2));
- }
- }
-}
-
-/* Similarly to above, distribute the LOG_LINKS that used to be present on
- I3, I2, and I1 to new locations. This is also called in one case to
- add a link pointing at I3 when I3's destination is changed. */
-
-static void
-distribute_links (links)
- rtx links;
-{
- rtx link, next_link;
-
- for (link = links; link; link = next_link)
- {
- rtx place = 0;
- rtx insn;
- rtx set, reg;
-
- next_link = XEXP (link, 1);
-
- /* If the insn that this link points to is a NOTE or isn't a single
- set, ignore it. In the latter case, it isn't clear what we
- can do other than ignore the link, since we can't tell which
- register it was for. Such links wouldn't be used by combine
- anyway.
-
- It is not possible for the destination of the target of the link to
- have been changed by combine. The only potential of this is if we
- replace I3, I2, and I1 by I3 and I2. But in that case the
- destination of I2 also remains unchanged. */
-
- if (GET_CODE (XEXP (link, 0)) == NOTE
- || (set = single_set (XEXP (link, 0))) == 0)
- continue;
-
- reg = SET_DEST (set);
- while (GET_CODE (reg) == SUBREG || GET_CODE (reg) == ZERO_EXTRACT
- || GET_CODE (reg) == SIGN_EXTRACT
- || GET_CODE (reg) == STRICT_LOW_PART)
- reg = XEXP (reg, 0);
-
- /* A LOG_LINK is defined as being placed on the first insn that uses
- a register and points to the insn that sets the register. Start
- searching at the next insn after the target of the link and stop
- when we reach a set of the register or the end of the basic block.
-
- Note that this correctly handles the link that used to point from
- I3 to I2. Also note that not much searching is typically done here
- since most links don't point very far away. */
-
- for (insn = NEXT_INSN (XEXP (link, 0));
- (insn && (this_basic_block == n_basic_blocks - 1
- || basic_block_head[this_basic_block + 1] != insn));
- insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_overlap_mentioned_p (reg, PATTERN (insn)))
- {
- if (reg_referenced_p (reg, PATTERN (insn)))
- place = insn;
- break;
- }
- else if (GET_CODE (insn) == CALL_INSN
- && find_reg_fusage (insn, USE, reg))
- {
- place = insn;
- break;
- }
-
- /* If we found a place to put the link, place it there unless there
- is already a link to the same insn as LINK at that point. */
-
- if (place)
- {
- rtx link2;
-
- for (link2 = LOG_LINKS (place); link2; link2 = XEXP (link2, 1))
- if (XEXP (link2, 0) == XEXP (link, 0))
- break;
-
- if (link2 == 0)
- {
- XEXP (link, 1) = LOG_LINKS (place);
- LOG_LINKS (place) = link;
-
- /* Set added_links_insn to the earliest insn we added a
- link to. */
- if (added_links_insn == 0
- || INSN_CUID (added_links_insn) > INSN_CUID (place))
- added_links_insn = place;
- }
- }
- }
-}
-
-/* Compute INSN_CUID for INSN, which is an insn made by combine. */
-
-static int
-insn_cuid (insn)
- rtx insn;
-{
- while (insn != 0 && INSN_UID (insn) > max_uid_cuid
- && GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == USE)
- insn = NEXT_INSN (insn);
-
- if (INSN_UID (insn) > max_uid_cuid)
- abort ();
-
- return INSN_CUID (insn);
-}
-
-void
-dump_combine_stats (file)
- FILE *file;
-{
- fprintf
- (file,
- ";; Combiner statistics: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n\n",
- combine_attempts, combine_merges, combine_extras, combine_successes);
-}
-
-void
-dump_combine_total_stats (file)
- FILE *file;
-{
- fprintf
- (file,
- "\n;; Combiner totals: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n",
- total_attempts, total_merges, total_extras, total_successes);
-}
diff --git a/gcc/conditions.h b/gcc/conditions.h
deleted file mode 100644
index 80d604790cc..00000000000
--- a/gcc/conditions.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Definitions for condition code handling in final.c and output routines.
- Copyright (C) 1987 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. */
-
-/* None of the things in the files exist if we don't use CC0. */
-
-#ifdef HAVE_cc0
-
-/* The variable cc_status says how to interpret the condition code.
- It is set by output routines for an instruction that sets the cc's
- and examined by output routines for jump instructions.
-
- cc_status contains two components named `value1' and `value2'
- that record two equivalent expressions for the values that the
- condition codes were set from. (Either or both may be null if
- there is no useful expression to record.) These fields are
- used for eliminating redundant test and compare instructions
- in the cases where the condition codes were already set by the
- previous instruction.
-
- cc_status.flags contains flags which say that the condition codes
- were set in a nonstandard manner. The output of jump instructions
- uses these flags to compensate and produce the standard result
- with the nonstandard condition codes. Standard flags are defined here.
- The tm.h file can also define other machine-dependent flags.
-
- cc_status also contains a machine-dependent component `mdep'
- whose type, `CC_STATUS_MDEP', may be defined as a macro in the
- tm.h file. */
-
-#ifndef CC_STATUS_MDEP
-#define CC_STATUS_MDEP int
-#endif
-
-#ifndef CC_STATUS_MDEP_INIT
-#define CC_STATUS_MDEP_INIT 0
-#endif
-
-typedef struct {int flags; rtx value1, value2; CC_STATUS_MDEP mdep;} CC_STATUS;
-
-/* While outputting an insn as assembler code,
- this is the status BEFORE that insn. */
-extern CC_STATUS cc_prev_status;
-
-/* While outputting an insn as assembler code,
- this is being altered to the status AFTER that insn. */
-extern CC_STATUS cc_status;
-
-/* These are the machine-independent flags: */
-
-/* Set if the sign of the cc value is inverted:
- output a following jump-if-less as a jump-if-greater, etc. */
-#define CC_REVERSED 1
-
-/* This bit means that the current setting of the N bit is bogus
- and conditional jumps should use the Z bit in its place.
- This state obtains when an extraction of a signed single-bit field
- or an arithmetic shift right of a byte by 7 bits
- is turned into a btst, because btst does not set the N bit. */
-#define CC_NOT_POSITIVE 2
-
-/* This bit means that the current setting of the N bit is bogus
- and conditional jumps should pretend that the N bit is clear.
- Used after extraction of an unsigned bit
- or logical shift right of a byte by 7 bits is turned into a btst.
- The btst does not alter the N bit, but the result of that shift
- or extract is never negative. */
-#define CC_NOT_NEGATIVE 4
-
-/* This bit means that the current setting of the overflow flag
- is bogus and conditional jumps should pretend there is no overflow. */
-/* ??? Note that for most targets this macro is misnamed as it applies
- to the carry flag, not the overflow flag. */
-#define CC_NO_OVERFLOW 010
-
-/* This bit means that what ought to be in the Z bit
- should be tested as the complement of the N bit. */
-#define CC_Z_IN_NOT_N 020
-
-/* This bit means that what ought to be in the Z bit
- should be tested as the N bit. */
-#define CC_Z_IN_N 040
-
-/* Nonzero if we must invert the sense of the following branch, i.e.
- change EQ to NE. This is not safe for IEEE floating point operations!
- It is intended for use only when a combination of arithmetic
- or logical insns can leave the condition codes set in a fortuitous
- (though inverted) state. */
-#define CC_INVERTED 0100
-
-/* Nonzero if we must convert signed condition operators to unsigned.
- This is only used by machine description files. */
-#define CC_NOT_SIGNED 0200
-
-/* This is how to initialize the variable cc_status.
- final does this at appropriate moments. */
-
-#define CC_STATUS_INIT \
- (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0, \
- CC_STATUS_MDEP_INIT)
-
-#endif
diff --git a/gcc/config/1750a/1750a.c b/gcc/config/1750a/1750a.c
deleted file mode 100644
index 839df51cd2c..00000000000
--- a/gcc/config/1750a/1750a.c
+++ /dev/null
@@ -1,749 +0,0 @@
-/* Subroutines for insn-output.c for MIL-STD-1750.
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by O.M.Kellogg, DASA (kellogg@space.otn.dasa.de)
-
-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 1, 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 FILE
-#include <stdio.h>
-#endif
-#include <string.h>
-
-#define __datalbl
-#include "config.h"
-#include "rtl.h"
-#include "tree.h"
-#include "expr.h"
-#define HAVE_cc0
-#include "conditions.h"
-#include "real.h"
-#include "regs.h"
-
-struct datalabel_array datalbl[DATALBL_ARRSIZ];
-int datalbl_ndx = -1;
-struct jumplabel_array jmplbl[JMPLBL_ARRSIZ];
-int jmplbl_ndx = -1;
-int label_pending = 0, program_counter = 0;
-enum section current_section = Normal;
-char *sectname[4] =
-{"Init", "Normal", "Konst", "Static"};
-
-int
-notice_update_cc (exp)
- rtx exp;
-{
- if (GET_CODE (exp) == SET)
- {
- enum rtx_code src_code = GET_CODE (SET_SRC (exp));
- /* Jumps do not alter the cc's. */
- if (SET_DEST (exp) == pc_rtx)
- return;
- /* Moving a register or constant into memory doesn't alter the cc's. */
- if (GET_CODE (SET_DEST (exp)) == MEM
- && (src_code == REG || src_code == CONST_INT))
- return;
- /* Function calls clobber the cc's. */
- if (src_code == CALL)
- {
- CC_STATUS_INIT;
- return;
- }
- /* Emulated longword bit-ops leave cc's incorrect */
- if (GET_MODE (SET_DEST (exp)) == HImode ?
- src_code == AND || src_code == IOR ||
- src_code == XOR || src_code == NOT : 0)
- {
- CC_STATUS_INIT;
- return;
- }
- /* Tests and compares set the cc's in predictable ways. */
- if (SET_DEST (exp) == cc0_rtx)
- {
- CC_STATUS_INIT;
- cc_status.value1 = SET_SRC (exp);
- return;
- }
- /* Anything else will set cc_status. */
- cc_status.flags = CC_NO_OVERFLOW;
- cc_status.value1 = SET_SRC (exp);
- cc_status.value2 = SET_DEST (exp);
- return;
- }
- else if (GET_CODE (exp) == PARALLEL
- && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
- {
- if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx)
- return;
- if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx)
- {
- CC_STATUS_INIT;
- cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0));
- return;
- }
- CC_STATUS_INIT;
- }
- else
- {
- CC_STATUS_INIT;
- }
-}
-
-
-rtx
-function_arg (cum, mode, type, named)
- int cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- int size;
-
- if (MUST_PASS_IN_STACK (mode, type))
- return (rtx) 0;
- if (mode == BLKmode)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
- if (cum + size < 12)
- return gen_rtx (REG, mode, cum);
- else
- return (rtx) 0;
-}
-
-
-double
-get_double (x)
- rtx x;
-{
- union
- {
- double d;
- long i[2];
- }
- du;
-
- du.i[0] = CONST_DOUBLE_LOW (x);
- du.i[1] = CONST_DOUBLE_HIGH (x);
- return du.d;
-}
-
-char *
-float_label (code, value)
- char code;
- double value;
-{
- int i = 1;
- static char label[32];
- char *p;
-
- label[0] = code;
- p = label + 1;
- sprintf (p, "%lf", value);
- while (*p)
- {
- *p = (*p == '+') ? 'p' :
- (*p == '-') ? 'm' : *p;
- p++;
- }
- return xstrdup (label);
-}
-
-
-char *
-movcnt_regno_adjust (op)
- rtx *op;
-{
- static char outstr[80];
- int op0r = REGNO (op[0]), op1r = REGNO (op[1]), op2r = REGNO (op[2]);
-#define dstreg op0r
-#define srcreg op1r
-#define cntreg op2r
-#define cntreg_1750 (op0r + 1)
-
- if (cntreg == cntreg_1750)
- sprintf (outstr, "mov r%d,r%d", op0r, op1r);
- else if (dstreg + 1 == srcreg && cntreg > srcreg)
- sprintf (outstr, "xwr r%d,r%d\n\tmov r%d,r%d", op2r, op1r, op0r, op2r);
- else if (dstreg == cntreg + 1)
- sprintf (outstr, "xwr r%d,r%d\n\tmov r%d,r%d", op0r, op2r, op2r, op1r);
- else if (dstreg == srcreg + 1)
- sprintf (outstr, "xwr r%d,r%d\n\txwr r%d,r%d\n\tmov r%d,r%d",
- op0r, op1r, op0r, op2r, op1r, op2r);
- else if (cntreg + 1 == srcreg)
- sprintf (outstr, "xwr r%d,r%d\n\txwr r%d,r%d\n\tmov r%d,r%d",
- op2r, op1r, op0r, op2r, op2r, op0r);
- else if (cntreg == srcreg + 1)
- sprintf (outstr, "xwr r%d,r%d\n\tmov r%d,r%d", op0r, op1r, op1r, op0r);
- else
- sprintf (outstr, "xwr r%d,r%d\n\tmov r%d,r%d\n\txwr r%d,r%d",
- op2r, cntreg_1750, op0r, op1r, op2r, cntreg_1750);
- return outstr;
-}
-
-char *
-mod_regno_adjust (instr, op)
- char *instr;
- rtx *op;
-{
- static char outstr[40];
- char *r = (!strncmp (instr, "dvr", 3) ? "r" : "");
- int modregno_gcc = REGNO (op[3]), modregno_1750 = REGNO (op[0]) + 1;
-
- if (modregno_gcc == modregno_1750
- || (reg_renumber != NULL
- && reg_renumber[modregno_gcc] >= 0
- && reg_renumber[modregno_gcc] == reg_renumber[modregno_1750]))
- sprintf (outstr, "%s r%%0,%s%%2", instr, r);
- else
- sprintf (outstr, "lr r%d,r%d\n\t%s r%%0,%s%%2\n\txwr r%d,r%d",
- modregno_gcc, modregno_1750, instr, r, modregno_1750,
- modregno_gcc);
- return outstr;
-}
-
-
-/* Auxiliary to `nonindirect_operand':
- Check if op is a valid memory operand for 1750A arith./logic (non-move)
- instructions. */
-int
-memop_valid (op)
- rtx op;
-{
- if (GET_MODE (op) != Pmode && GET_MODE (op) != VOIDmode)
- return 0;
- switch (GET_CODE (op))
- {
- case MEM:
- case MINUS:
- case MULT:
- case DIV:
- return 0;
- case PLUS:
- if (!memop_valid (XEXP (op, 0)))
- return 0;
- return memop_valid (XEXP (op, 1));
- case REG:
- if (REGNO (op) > 0)
- return 1;
- return 0;
- case CONST:
- case CONST_INT:
- case SYMBOL_REF:
- case SUBREG:
- return 1;
- default:
- printf ("memop_valid: code=%d\n", (int) GET_CODE (op));
- return 1;
- }
-}
-
-/* extra predicate for recog: */
-int
-nonindirect_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int retval;
-
- switch (GET_CODE (op))
- {
- case MEM:
- retval = memop_valid (XEXP (op, 0));
- return retval;
- case REG:
- return 1;
- default:
- if (!CONSTANT_P (op))
- return 0;
- }
- return 1;
-}
-
-/* predicate for the MOV instruction: */
-int
-mov_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == REG);
-}
-
-/* predicate for the STC instruction: */
-int
-small_nonneg_const (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT && INTVAL (op) >= 0 && INTVAL (op) <= 15)
- return 1;
- return 0;
-}
-
-/* predicate for constant zero: */
-int
-zero_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return op == CONST0_RTX (mode);
-}
-
-
-/* predicate for 1750 `B' addressing mode (Base Register with Offset)
- memory operand */
-int
-b_mode_operand (op)
- rtx op;
-{
- if (GET_CODE (op) == MEM)
- {
- rtx inner = XEXP (op, 0);
- if (GET_CODE (inner) == REG && REG_OK_FOR_INDEX_P (inner))
- return 1;
- if (GET_CODE (inner) == PLUS)
- {
- rtx plus_op0 = XEXP (inner, 0);
- if (GET_CODE (plus_op0) == REG && REG_OK_FOR_INDEX_P (plus_op0))
- {
- rtx plus_op1 = XEXP (inner, 1);
- if (GET_CODE (plus_op1) == CONST_INT
- && INTVAL (plus_op1) >= 0
- && INTVAL (plus_op1) <= 255)
- return 1;
- }
- }
- }
- return 0;
-}
-
-
-/* Decide whether to output a conditional jump as a "Jump Conditional"
- or as a "Branch Conditional": */
-
-int
-find_jmplbl (labelnum)
- int labelnum;
-{
- int i, found = 0;
-
- for (i = 0; i <= jmplbl_ndx; i++)
- if (labelnum == jmplbl[i].num)
- {
- found = 1;
- break;
- }
- if (found)
- return i;
- return -1;
-}
-
-char *
-branch_or_jump (condition, targetlabel_number)
- char *condition;
- int targetlabel_number;
-{
- static char buf[30];
- int index;
-
- if ((index = find_jmplbl (targetlabel_number)) >= 0)
- if (program_counter - jmplbl[index].pc < 128)
- {
- sprintf (buf, "b%s %%l0", condition);
- return buf;
- }
- sprintf (buf, "jc %s,%%l0", condition);
- return buf;
-}
-
-
-int
-unsigned_comparison_operator (insn)
- rtx insn;
-{
- switch (GET_CODE (insn))
- {
- case GEU:
- case GTU:
- case LEU:
- case LTU:
- return 1;
- default:
- return 0;
- }
-}
-
-int
-next_cc_user_is_unsigned (insn)
- rtx insn;
-{
- if ( !(insn = next_cc0_user (insn)))
- abort ();
- else if (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) == SET
- && GET_CODE (SET_SRC (PATTERN (insn))) == IF_THEN_ELSE)
- return unsigned_comparison_operator (XEXP (SET_SRC (PATTERN (insn)), 0));
- else if (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SET)
- return unsigned_comparison_operator (SET_SRC (PATTERN (insn)));
- else
- abort ();
-}
-
-
-static int addr_inc;
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand X. X is an RTL
- expression.
-
- CODE is a value that can be used to specify one of several ways
- of printing the operand. It is used when identical operands
- must be printed differently depending on the context. CODE
- comes from the `%' specification that was used to request
- printing of the operand. If the specification was just `%DIGIT'
- then CODE is 0; if the specification was `%LTR DIGIT' then CODE
- is the ASCII code for LTR.
-
- If X is a register, this macro should print the register's name.
- The names can be found in an array `reg_names' whose type is
- `char *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
-
- When the machine description has a specification `%PUNCT' (a `%'
- followed by a punctuation character), this macro is called with
- a null pointer for X and the punctuation character for CODE.
-
- The 1750 specific codes are:
- 'J' for the negative of a constant
- 'Q' for printing addresses in B mode syntax
- 'd' for the second register in a pair
- 't' for the third register in a triple
- 'b' for the bit number (using 1750 test bit convention)
- 'B' for the bit number of the 1's complement (for bit clear)
- 'w' for int - 16
-*/
-
-print_operand (file, x, letter)
- FILE *file;
- rtx x;
- int letter;
-{
- switch (GET_CODE (x))
- {
- case REG:
- if (letter == 'd')
- fprintf (file, "%d", REGNO (x) + 1);
- else if (letter == 't')
- fprintf (file, "%d", REGNO (x) + 2);
- else
- fprintf (file, "%d", REGNO (x));
- break;
-
- case SYMBOL_REF:
- fprintf (file, "%s", XSTR (x, 0));
- if (letter == 'A')
- fprintf (file, "+1");
- break;
-
- case LABEL_REF:
- case CONST:
- case MEM:
- if (letter == 'Q')
- {
- rtx inner = XEXP (x, 0);
- switch (GET_CODE (inner))
- {
- case REG:
- fprintf (file, "r%d,0", REGNO (inner));
- break;
- case PLUS:
- fprintf (file, "r%d,%d", REGNO (XEXP (inner, 0)),
- INTVAL (XEXP (inner, 1)));
- break;
- default:
- fprintf (file, "[ill Q code=%d]", GET_CODE (inner));
- }
- }
- else
- {
- addr_inc = (letter == 'A' ? 1 : 0);
- output_address (XEXP (x, 0));
- }
- break;
-
- case CONST_DOUBLE:
-/* {
- double value = get_double (x);
- char fltstr[32];
- sprintf (fltstr, "%lf", value);
-
- if (letter == 'D' || letter == 'E')
- {
- int i, found = 0;
- for (i = 0; i <= datalbl_ndx; i++)
- if (strcmp (fltstr, datalbl[i].value) == 0)
- {
- found = 1;
- break;
- }
- if (!found)
- {
- strcpy (datalbl[i = ++datalbl_ndx].value, fltstr);
- datalbl[i].name = float_label (letter, value);
- datalbl[i].size = (letter == 'E') ? 3 : 2;
- check_section (Konst);
- fprintf (file, "K%s \tdata%s %s ;p_o\n", datalbl[i].name,
- (letter == 'E' ? "ef" : "f"), fltstr);
- check_section (Normal);
- }
- }
- else if (letter == 'F' || letter == 'G')
- {
- int i, found = 0;
- for (i = 0; i <= datalbl_ndx; i++)
- if (strcmp (fltstr, datalbl[i].value) == 0)
- {
- found = 1;
- break;
- }
- if (!found)
- {
- fprintf (stderr,
- "float value %lfnot found upon label reference\n", value);
- strcpy (datalbl[i = ++datalbl_ndx].value, fltstr);
- datalbl[i].name = float_label (letter, value);
- datalbl[i].size = (letter == 'G') ? 3 : 2;
- check_section (Konst);
- fprintf (file, "K%s \tdata%s %s ;p_o\n", datalbl[i].name,
- (letter == 'G' ? "ef" : "f"), fltstr);
- check_section (Normal);
- }
- fprintf (file, "%s ;P_O 'F'", datalbl[i].name);
- }
- else
- fprintf (file, " %s ;P_O cst_dbl ", fltstr);
- }
- */
- fprintf (file, "%lf", get_double (x));
- break;
-
- case CONST_INT:
- if (letter == 'J')
- fprintf (file, "%d", -INTVAL (x));
- if (letter == 'b')
- fprintf (file, "%d", which_bit (INTVAL (x)));
- else if (letter == 'B')
- fprintf (file, "%d", which_bit (~INTVAL (x)));
- else if (letter == 'w')
- fprintf (file, "%d", INTVAL (x) - 16);
- else
- fprintf (file, "%d", INTVAL (x));
- break;
-
- case CODE_LABEL:
- fprintf (file, "L%d", XINT (x, 3));
- break;
-
- case CALL:
- fprintf (file, "CALL nargs=%d, func is either '%s' or '%s'",
- XEXP (x, 1), XSTR (XEXP (XEXP (x, 0), 1), 0), XSTR (XEXP (x, 0), 1));
- break;
-
- case PLUS:
- {
- rtx op0 = XEXP (x, 0), op1 = XEXP (x, 1);
- int op0code = GET_CODE (op0), op1code = GET_CODE (op1);
- if (op1code == CONST_INT)
- switch (op0code)
- {
- case REG:
- fprintf (file, "%d,r%d ; p_o_PLUS for REG and CONST_INT",
- INTVAL (op1), REGNO (op0));
- break;
- case SYMBOL_REF:
- fprintf (file, "%d+%s", INTVAL (op1), XSTR (op0, 0));
- break;
- case MEM:
- fprintf (file, "%d,[mem:", INTVAL (op1));
- output_address (XEXP (op0, 0));
- fprintf (file, "] ;P_O plus");
- break;
- default:
- fprintf (file, "p_o_PLUS UFO, code=%d, with CONST=%d",
- (int) op0code, INTVAL (op1));
- }
- else if (op1code == SYMBOL_REF && op0code == REG)
- fprintf (file, "%s,r%d ; P_O: (plus reg sym)",
- XSTR (op1, 0), REGNO (op0));
- else
- fprintf (file, "p_o_+: op0code=%d, op1code=%d", op0code, op1code);
- }
- break;
-
- default:
- fprintf (file, "p_o_UFO code=%d", GET_CODE (x));
- }
-
- addr_inc = 0;
-}
-
-print_operand_address (file, addr)
- FILE *file;
- rtx addr;
-{
- switch (GET_CODE (addr))
- {
- case REG:
- fprintf (file, "%d,r%d ; P_O_A", addr_inc, REGNO (addr));
- break;
- case PLUS:
- {
- register rtx x = XEXP (addr, 0), y = XEXP (addr, 1);
- switch (GET_CODE (x))
- {
- case REG:
- switch (GET_CODE (y))
- {
- case CONST:
- output_address (XEXP (y, 0));
- fprintf (file, ",r%d ;P_O_A reg + const expr", REGNO (x));
- break;
- case CONST_INT:
- fprintf (file, "%d,r%d", INTVAL (y) + addr_inc, REGNO (x));
- break;
- case SYMBOL_REF:
- fprintf (file, "%s", XSTR (y, 0));
- if (addr_inc)
- fprintf (file, "+%d", addr_inc);
- fprintf (file, ",r%d ; P_O_A reg + sym", REGNO (x));
- break;
- case LABEL_REF:
- output_address (XEXP (y, 0));
- fprintf (file, ",r%d ; P_O_A reg + label", REGNO (x));
- break;
- default:
- fprintf (file, "[P_O_A reg%d+UFO code=%d]",
- REGNO (x), GET_CODE (y));
- }
- break;
- case LABEL_REF:
- output_address (XEXP (x, 0));
- break;
- case SYMBOL_REF:
- switch (GET_CODE (y))
- {
- case CONST_INT:
- fprintf (file, "%d+%s", INTVAL (y) + addr_inc, XSTR (x, 0));
- break;
- case REG:
- fprintf (file, "%s,r%d ;P_O_A sym + reg",
- XSTR (x, 0), REGNO (y));
- break;
- default:
- fprintf (file, "P_O_A sym/lab+UFO[sym=%s,code(y)=%d]",
- XSTR (x, 0), GET_CODE (y));
- }
- break;
- case CONST:
- output_address (XEXP (x, 0));
- if (GET_CODE (y) == REG)
- fprintf (file, ",r%d ;P_O_A const + reg", REGNO (x));
- else
- fprintf (file, "P_O_A const+UFO code(y)=%d]", GET_CODE (y));
- break;
- case MEM:
- output_address (y);
- fprintf (file, ",[mem:");
- output_address (XEXP (x, 0));
- fprintf (file, "] ;P_O_A plus");
- break;
- default:
- fprintf (file, "P_O_A plus op1_UFO[code1=%d,code2=%d]",
- GET_CODE (x), GET_CODE (y));
- }
- }
- break;
- case CONST_INT:
- if (INTVAL (addr) < 0x10000 && INTVAL (addr) >= -0x10000)
- fprintf (file, "%d ; p_o_a const addr?!", INTVAL (addr));
- else
- {
- fprintf (file, "[p_o_a=ILLEGAL_CONST]");
- output_addr_const (file, addr);
- }
- break;
- case LABEL_REF:
- case SYMBOL_REF:
- fprintf (file, "%s", XSTR (addr, 0));
- if (addr_inc)
- fprintf (file, "+%d", addr_inc);
- break;
- case MEM:
- fprintf (file, "[memUFO:");
- output_address (XEXP (addr, 0));
- fprintf (file, "]");
- break;
- case CONST:
- output_address (XEXP (addr, 0));
- fprintf (file, " ;P_O_A const");
- break;
- case CODE_LABEL:
- fprintf (file, "L%d", XINT (addr, 3));
- break;
- default:
- fprintf (file, " p_o_a UFO, code=%d val=0x%x",
- (int) GET_CODE (addr), INTVAL (addr));
- break;
- }
- addr_inc = 0;
-}
-
-
-/*
- * Return non zero if the LS 16 bits of the given value has just one bit set,
- * otherwise return zero. Note this function may be used to detect one
- * bit clear by inverting the param.
- */
-int
-one_bit_set_p (x)
- int x;
-{
- x &= 0xffff;
- return x && (x & (x - 1)) == 0;
-}
-
-
-/*
- * Return the number of the least significant bit set, using the same
- * convention for bit numbering as in the MIL-STD-1750 sb instruction.
- */
-int
-which_bit (x)
- int x;
-{
- int b = 15;
-
- while (b > 0 && (x & 1) == 0)
- {
- b--;
- x >>= 1;
- }
-
- return b;
-}
-
-
diff --git a/gcc/config/1750a/1750a.h b/gcc/config/1750a/1750a.h
deleted file mode 100644
index 889121ce711..00000000000
--- a/gcc/config/1750a/1750a.h
+++ /dev/null
@@ -1,1323 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by O.M.Kellogg, DASA (oliver.kellogg@space.otn.dasa.de)
-
-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 1, 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. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-/* See tm-sun3.h, tm-sun2.h, tm-isi68.h for different CPP_PREDEFINES. */
-#define CPP_PREDEFINES ""
-
-/* Print subsidiary information on the compiler version in use. */
-#ifdef IEEE
-#define TARGET_VERSION fprintf (stderr, " (1750A, IEEE syntax)");
-#else
-#define TARGET_VERSION fprintf (stderr, " (MIL-STD-1750A)");
-#endif
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-#define TARGET_SWITCHES \
- { {"vaxc-alignment", 2}, \
- { "", TARGET_DEFAULT}}
-
-/* Default target_flags if no switches specified. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 1
-#endif
-
-/*****************************************************************************/
-
-/* SPECIAL ADDITION FOR MIL-STD-1750A by O.M.Kellogg, 15-Apr-1993 */
-/* See file aux-output.c for the actual data instances. */
-struct datalabel_array {
- char *name;
- char value[14];
- int size;
-};
-struct jumplabel_array {
- int pc;
- int num;
-};
-enum section { Init, Normal, Konst, Static };
-#define DATALBL_ARRSIZ 256
-#define JMPLBL_ARRSIZ 256
-#ifndef __datalbl
-extern struct datalabel_array datalbl[];
-extern struct jumplabel_array jmplbl[];
-extern int datalbl_ndx, jmplbl_ndx, label_pending, program_counter;
-extern enum section current_section;
-extern char *sectname[4];
-extern char *xstrdup(), *float_label();
-extern struct rtx_def *function_arg ();
-extern char *movcnt_regno_adjust ();
-extern char *mod_regno_adjust ();
-extern char *branch_or_jump ();
-#endif
-/*--------------------------------------------------------------------*/
-
-/* target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- Though 1750 actually counts bits in big-endian fashion, the sign bit
- is still the most significant bit, which is leftmost. Therefore leaving
- this little-endian. Adjust short before assembler output when needed:
- e.g. in QImode, a GCC bit n is a 1750 bit (15-n). */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* For 1750 we can decide arbitrarily
- since there are no machine instructions for them. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword value is lowest
- numbered.
- True for 1750. */
-#define WORDS_BIG_ENDIAN 1
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 16
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 16
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 1
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 16
-
-#define PTRDIFF_TYPE "int"
-
-/* Type to use for `size_t'. If undefined, uses `long unsigned int'. */
-#define SIZE_TYPE "int"
-
-/* 1750a preliminary
- #define TARGET_FLOAT_FORMAT UNKNOWN_FLOAT_FORMAT
-*/
-
-/* Allocation boundary (in *bits*) for storing pointers in memory. */
-#define POINTER_BOUNDARY 16
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-/* 1750: should have had to make this 32 when BITS_PER_WORD is 32. */
-#define PARM_BOUNDARY 16
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 16
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 16
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 16
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 16
-
-/* Define this to 1 if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 0
-
-/* Define number of bits in most basic integer type.
- (If undefined, default is BITS_PER_WORD).
- #define INT_TYPE_SIZE 16 */
-
-/* Define number of bits in short integer type.
- (If undefined, default is half of BITS_PER_WORD). */
-#define SHORT_TYPE_SIZE 16
-
-/* Define number of bits in long integer type.
- (If undefined, default is BITS_PER_WORD). */
-#define LONG_TYPE_SIZE 32
-
-/* Define number of bits in long long integer type.
- (If undefined, default is twice BITS_PER_WORD). */
-/* 1750 PRELIMINARY : no processor support for `long long', therefore
- need to check out the long-long opencodings ! */
-#define LONG_LONG_TYPE_SIZE 64
-
-/* Define number of bits in char type.
- (If undefined, default is one fourth of BITS_PER_WORD). */
-#define CHAR_TYPE_SIZE 16
-
-/* Define number of bits in float type.
- (If undefined, default is BITS_PER_WORD). */
-#define FLOAT_TYPE_SIZE 32
-
-/* Define number of bits in double type.
- (If undefined, default is twice BITS_PER_WORD). */
-#define DOUBLE_TYPE_SIZE 48
-
-/*****************************************************************************/
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-#define FIRST_PSEUDO_REGISTER 16
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- R15 is the 1750A stack pointer. R14 is the frame pointer. */
-
-#define FIXED_REGISTERS \
- { 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 1, 1 }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like.
- 1750: return value in R0 foll. (depending on size of retval).
- Should be possible to refine this (how many regs are actually used) */
-
-#define CALL_USED_REGISTERS \
- { 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1 }
-
-/* Order in which to allocate registers. Each register must be
- listed once, even those in FIXED_REGISTERS. List frame pointer
- late and fixed registers last. Note that, in general, we prefer
- registers listed in CALL_USED_REGISTERS, keeping the others
- available for storage of persistent values. */
-
-/* #define REG_ALLOC_ORDER \
- { 2, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
- */
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
- All 1750 registers are one word long. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) 1
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* 1750A pc isn't overloaded on a register. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 15
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 14
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 1
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 14
-
-/* Define this if successive args to a function occupy decreasing addresses
- on the stack.
- #define ARGS_GROW_DOWNWARD
-*/
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 13
-
-/* Place in which caller passes the structure value address.
- 0 means push the value on the stack like an argument.
- #define STRUCT_VALUE 0
-*/
-
-/* Register in which address to store a structure value
- arrives in the function.
- #define STRUCT_VALUE_INCOMING 0
-*/
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 12
-
-/* Define this to be 1 if all structure return values must be in memory. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/*****************************************************************************/
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* 1750 note: The names (BASE_REGS/INDEX_REGS) are used in their *gcc sense*
- (i.e. *opposite* to the MIL-STD-1750A defined meanings). This means that
- R1..R15 are called "base" regs and R12..R15 are "index" regs.
- Index reg mode (in the gcc sense) is not yet implemented (these are the
- 1750 "Base with Index Reg" instructions, LBX etc. See 1750.md)
-
- Here's an example to drive this point home: in "LBX B12,R5"
- B12 shall be called the "index" reg and R5 shall be the "base" reg.
- This naming inversion is due to the GCC defined capabilities of
- "Base" vs. "Index" regs. */
-
-enum reg_class { NO_REGS, R2, R0_1, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Since GENERAL_REGS is the same class as ALL_REGS,
- don't give it a different class number; just make it an alias. */
-#define GENERAL_REGS ALL_REGS
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- { "NO_REGS", "R2", "R0_1", "INDEX_REGS", "BASE_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES.
- 1750 "index" (remember, in the *GCC* sense!) regs are R12 through R15.
- The only 1750 register not usable as BASE_REG is R0. */
-
-#define REG_CLASS_CONTENTS {0, 0x0004, 0x0003, 0xf000, 0xfffe, 0xffff}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-#define REGNO_REG_CLASS(REGNO) ((REGNO) == 2 ? R2 : (REGNO) == 0 ? R0_1 : \
- (REGNO) >= 12 ? INDEX_REGS : (REGNO) > 0 ? BASE_REGS : ALL_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-
-#define BASE_REG_CLASS BASE_REGS
-#define INDEX_REG_CLASS INDEX_REGS
-
-/* Get reg_class from a letter such as appears in the machine description.
- For the 1750, we have 'z' for R0_1, 't' for R2, 'b' for gcc Base regs
- and 'x' for gcc Index regs. */
-
-#define REG_CLASS_FROM_LETTER(C) ((C) == 't' ? R2 : \
- (C) == 'z' ? R0_1 : \
- (C) == 'b' ? BASE_REGS : \
- (C) == 'x' ? INDEX_REGS : NO_REGS)
-
-/* The letters I,J,K,.. to P in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For the 1750A,
- `I' is used for ISP mode instructions,
- `J' is used for ISN mode instructions,
- `K' is used for the STC instruction's constant range,
- `L' is used for unsigned 8-bit address displacements in instructions
- of addressing mode "Base Relative",
- `M' is for IM mode instructions et al.,
- `O' is a synonym for (const_int 0). */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 16 : \
- (C) == 'J' ? (VALUE) < 0 && (VALUE) >= -16 : \
- (C) == 'K' ? (VALUE) >= 0 && (VALUE) <= 15 : \
- (C) == 'L' ? (VALUE) >= 0 && (VALUE) <= 0xFF : \
- (C) == 'M' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
- (C) == 'O' ? (VALUE) == 0 : 0)
-
-/* Similar, but for floating constants, and defining letter 'G'.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? ((VALUE) == CONST0_RTX (HFmode) \
- || (VALUE) == CONST0_RTX (TQFmode)) : 0)
-
-/* Optional extra constraints for this machine.
-
- For the 1750, `Q' means that this is a memory operand consisting
- of the sum of an Index Register (in the GCC sense, i.e. R12..R15)
- and a constant in the range 0..255. This constraint is used for
- the Base Register with Offset address mode instructions (LB,STB,AB,..) */
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' && b_mode_operand (OP))
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
- For the 1750A, we force an immediate CONST_DOUBLE value to memory. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- (GET_CODE(X) == CONST_DOUBLE ? NO_REGS : CLASS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS.
- On the 1750A, this is the size of MODE in words,
- since class doesn't make any difference. */
-#define CLASS_MAX_NREGS(CLASS,MODE) GET_MODE_SIZE(MODE)
-
-/*****************************************************************************/
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD 1
-
-/* Define this if the nominal address of the stack frame
- is at the high-address end of the local variables;
- goes at a more negative offset in the frame.
- #define FRAME_GROWS_DOWNWARD
-*/
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated.
-*/
-#define STARTING_FRAME_OFFSET 1
-
-/* This is the default anyway:
- #define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) FRAMEADDR
-*/
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- 1750 note: what GCC calls a "byte" is really a 16-bit word,
- because BITS_PER_UNIT is 16. */
-
-#define PUSH_ROUNDING(BYTES) (BYTES)
-
-/* Define this macro if functions should assume that stack space has
- been allocated for arguments even when their values are passed in
- registers.
- Size, in bytes, of the area reserved for arguments passed in
- registers for the function represented by FNDECL.
- #define REG_PARM_STACK_SPACE(FNDECL) 14 */
-
-/* Define this if it is the responsibility of the caller to allocate
- the area reserved for arguments passed in registers.
- #define OUTGOING_REG_PARM_STACK_SPACE */
-
-/* Offset of first parameter from the argument pointer register value.
- 1750 note:
- Parameters appear in reversed order on the frame (so when they are
- popped, they come off in the normal left-to-right order.)
- Computed as follows:
- one word for the caller's (PC+1) (i.e. the return address)
- plus total size of called function's "auto" variables
- plus one word for the caller's frame pointer (i.e. the old FP) */
-
-#define FIRST_PARM_OFFSET(FNDECL) \
- (1 + get_frame_size() + 1)
-
-/* Value is 1 if returning from a function call automatically
- pops the arguments described by the number-of-args field in the call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
-*/
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx(REG,TYPE_MODE(VALTYPE),0)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-/* 1750 note: no libcalls yet */
-
-#define LIBCALL_VALUE(MODE) printf("LIBCALL_VALUE called!\n"), \
- gen_rtx(REG,MODE,0)
-
-/* 1 if N is a possible register number for a function value. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* 1 if the tree TYPE should be returned in memory instead of in regs.
- #define RETURN_IN_MEMORY(TYPE) \
- (int_size_in_bytes(TYPE) > 12)
-*/
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values.
- #define PCC_STATIC_STRUCT_RETURN */
-
-/* 1 if N is a possible register number for function argument passing. */
-
-#define FUNCTION_ARG_REGNO_P(N) ((N) < 12)
-
-/*****************************************************************************/
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- For 1750A, this is a single integer, which is a number of words
- of arguments scanned so far. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- For 1750A, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.)
-
- 1750 note: "int_size_in_bytes()" returns a unit relative to
- BITS_PER_UNIT, so in our case not bytes, but 16-bit words. */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += (MODE) == BLKmode ? int_size_in_bytes(TYPE) : GET_MODE_SIZE(MODE))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) function_arg (CUM,MODE,TYPE,NAMED)
-
-/* Define the following macro if function calls on the target machine
- do not preserve any registers; in other words, if `CALL_USED_REGISTERS'
- has 1 for all registers. This macro enables `-fcaller-saves' by
- default. Eventually that option will be enabled by default on all
- machines and both the option and this macro will be eliminated. */
-
-#define DEFAULT_CALLER_SAVES
-
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) { \
- register int regno, none_used=1; \
- extern char call_used_regs[]; \
- fprintf(FILE, "; regs used in this function: "); \
- for (regno = 0; regno < 15; regno++) \
- if (regs_ever_live[regno]) { \
- fprintf(FILE," %s",reg_names[regno]); \
- none_used = 0; \
- } \
- if (none_used) \
- fprintf(FILE," (none)"); \
- fprintf(FILE,"\n"); \
- if (SIZE > 0) \
- fprintf(FILE,"\t%s\tr15,%d ; reserve local-variable space\n",\
- (SIZE <= 16 ? "sisp" : "sim"),SIZE); \
- fprintf(FILE,"\tpshm\tr14,r14 ; push old frame\n"); \
- fprintf(FILE,"\tlr\tr14,r15 ; set new frame\n"); \
- program_counter = 0; jmplbl_ndx = -1; \
-}
-
-/************* 1750: PROFILER HANDLING NOT YET DONE !!!!!!! *************/
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "; got into FUNCTION_PROFILER with label # %d\n", (LABELNO))
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "; got into FUNCTION_BLOCK_PROFILER with label # %d\n",LABELNO)
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. */
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
- fprintf (FILE, "; got into BLOCK_PROFILER with block # %d\n",BLOCKNO)
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 0
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) { \
- fprintf(FILE,"\tlr\tr15,r14 ; set stack ptr to frame ptr\n"); \
- fprintf(FILE,"\tpopm\tr14,r14 ; restore previous frame ptr\n"); \
- if (SIZE > 0) \
- fprintf(FILE,"\t%s\tr15,%d ; free up local-var space\n", \
- (SIZE <= 16 ? "aisp" : "aim"),SIZE); \
- fprintf(FILE,"\turs\tr15\n"); }
-
-/* If the memory address ADDR is relative to the frame pointer,
- correct it to be relative to the stack pointer instead.
- This is for when we don't use a frame pointer.
- ADDR should be a variable name. */
-
-#define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \
- fprintf(stderr,"FIX_FRAME_POINTER_ADDRESS called, depth=%d\n"), \
- DEPTH), abort()
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved.
-*/
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) DEPTH = 0
-
-/* 1750: not needed 'cause we have INITIAL_FRAME_POINTER_OFFSET.
- #define ELIMINABLE_REGS { \
- { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \
- { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM } }
-
- #define CAN_ELIMINATE(FROM, TO) 1
-
- #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) { OFFSET = 0; }
-*/
-
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-#define TRAMPOLINE_TEMPLATE(FILE) fprintf(FILE,"TRAMPOLINE_TEMPLATE called\n")
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 2
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) printf("INITIALIZE_TRAMPO called\n")
-/* { \
- emit_move_insn (gen_rtx (MEM, QImode, plus_constant (TRAMP, 1)), CXT); \
- emit_move_insn (gen_rtx (MEM, QImode, plus_constant (TRAMP, 6)), FNADDR); \
-} */
-
-
-/*****************************************************************************/
-
-/* Addressing modes, and classification of registers for them. */
-
-/* 1750 doesn't have a lot of auto-incr./decr. - just for the stack ptr. */
-
-/* #define HAVE_POST_INCREMENT just for R15 (stack pointer) */
-/* #define HAVE_POST_DECREMENT */
-/* #define HAVE_PRE_DECREMENT just for R15 (stack pointer) */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c.
- 1750 note: The words BASE and INDEX are used in their GCC senses:
- The "Index Registers", R12 through R15, are used in the 1750
- instructions LB,STB,AB,SBB,MB,DB,LBX,STBX,...
- */
-
-#define REGNO_OK_FOR_BASE_P(REGNO) \
- ((REGNO) > 0 && (REGNO) <= 15 || \
- reg_renumber[REGNO] > 0 && reg_renumber[REGNO] <= 15)
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
- ((REGNO) >= 12 && (REGNO) <= 15 || \
- reg_renumber[REGNO] >= 12 && reg_renumber[REGNO] <= 15)
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-
-/* 1 if X is an address register */
-
-#define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
-
-/* Maximum number of registers that can appear in a valid memory address. */
-#define MAX_REGS_PER_ADDRESS 1
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) CONSTANT_P(X)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifdef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P(REGNO(X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P(REGNO(X))
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) (REGNO (X) >= 12)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) (REGNO (X) > 0)
-
-#endif
-
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS.
-
- 1750 note: Currently we don't implement address expressions that use
- GCC "Index"-class regs. To be expanded to handle the 1750 "Base with Index"
- instructions (see also MAX_REGS_PER_ADDRESS and others). */
-
-#define GO_IF_BASED_ADDRESS(X, ADDR) { \
- if ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P(X))) \
- goto ADDR; \
- if (GET_CODE (X) == PLUS) \
- { register rtx x0 = XEXP(X,0), x1 = XEXP(X,1); \
- if ((REG_P(x0) && REG_OK_FOR_BASE_P(x0) && CONSTANT_ADDRESS_P(x1)) \
- || (REG_P(x1) && REG_OK_FOR_BASE_P(x1) && CONSTANT_ADDRESS_P(x0))) \
- goto ADDR; } }
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) { \
- if (CONSTANT_ADDRESS_P(X)) goto ADDR; \
- GO_IF_BASED_ADDRESS(X,ADDR) }
-
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the 68000, only predecrement and postincrement address depend thus
- (the amount of decrement or increment being the length of the operand). */
-/* 1750: not used. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
-/*****************************************************************************/
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE QImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 65536
-
-/* MOVE_RATIO is the number of move instructions that is better than a
- block move. */
-#define MOVE_RATIO 4
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-/* #define SHIFT_COUNT_TRUNCATED 1 */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE 1
-
-/* When a prototype says `char' or `short', really pass an `int'.
- 1750: for now, `char' is 16 bits wide anyway.
- #define PROMOTE_PROTOTYPES */
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode QImode
-
-/* A function address in a call instruction
- is a 16-bit address (for indexing purposes) */
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-/* 1750 note: haven't paid attention to this yet. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- return (INTVAL(RTX) >= -16 && INTVAL(RTX) <= 16) ? 1 : 3; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 5; \
- case CONST_DOUBLE: \
- return 7;
-
-#define ADDRESS_COST(ADDRESS) (memop_valid(ADDRESS) ? 3 : 1000)
-
-#define REGISTER_MOVE_COST(FROM,TO) 2
-
-#define MEMORY_MOVE_COST(M) 5
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-/* MIL-STD-1750: none -- just has the garden variety C,P,Z,N flags. */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's.
- 1750: See file out-1750a.c for notice_update_cc(). */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP)
-
-/**********************************************/
-/* Produce debugging info in the DWARF format
- #define DWARF_DEBUGGING_INFO
-*/
-
-/*****************************************************************************/
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) { \
- char *p, name[40]; \
- if ((p = (char *)strrchr(main_input_filename,'/')) != NULL ? 1 : \
- (p = (char *)strrchr(main_input_filename,']')) != NULL) \
- p++; \
- else \
- p = main_input_filename; \
- strcpy(name,p); \
- if (p = (char *)strchr(name,'.')) \
- *p = '\0'; \
- fprintf(FILE,"\tname %s\n",name); \
- fprintf(FILE,"\tnolist\n\tinclude \"ms1750.inc\"\n\tlist\n\n"); \
- fprintf(FILE,"\tglobal\t__main\n\n"); }
-
-/* Output at end of assembler file.
- For 1750, we copy the data labels accrued in datalbl[] from the Constants
- section (Konst) to the Writable-Data section (Static). */
-
-#define ASM_FILE_END(FILE) \
- do { \
- if (datalbl_ndx >= 0) { \
- int i, cum_size=0; \
- fprintf(FILE,"\n\tstatic\ninit_srel\n"); \
- for (i = 0; i <= datalbl_ndx; i++) { \
- if (datalbl[i].name == NULL) \
- { \
- fprintf(stderr, "asm_file_end internal datalbl err\n"); \
- exit (0); \
- } \
- fprintf(FILE,"%s \tblock %d\n", \
- datalbl[i].name,datalbl[i].size); \
- cum_size += datalbl[i].size; \
- } \
- fprintf(FILE,"\n\tinit\n"); \
- fprintf(FILE,"\tlim\tr0,init_srel\n"); /* destin. */ \
- fprintf(FILE,"\tlim\tr1,%d\n",cum_size); /* count */ \
- fprintf(FILE,"\tlim\tr2,K%s\n",datalbl[0].name); /* source */ \
- fprintf(FILE,"\tmov\tr0,r2\n"); \
- fprintf(FILE,"\n\tnormal\n"); \
- datalbl_ndx = -1; /* reset stuff */ \
- for (i = 0; i < DATALBL_ARRSIZ; i++) \
- datalbl[i].size = 0; \
- } \
- fprintf(FILE,"\n\tend\n"); \
- } while (0)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "\n\tif 0\n; by ASM_APP_ON\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "\n\tendif\n"
-
-
-#define EXTRA_SECTIONS in_readonly_data
-
-#define EXTRA_SECTION_FUNCTIONS \
- void const_section() \
- { \
- fprintf(asm_out_file,"\tkonst\n"); \
- current_section = Konst; \
- } \
- check_section(sect) \
- enum section sect; \
- { \
- if (current_section != sect) { \
- fprintf(asm_out_file,"\t%s\n",sectname[(int)sect]); \
- current_section = sect; \
- } \
- switch (sect) { \
- case Init: \
- case Normal: \
- in_section = in_text; \
- break; \
- case Static: \
- in_section = in_data; \
- break; \
- case Konst: \
- in_section = in_readonly_data; \
- break; \
- } \
- }
-
-
-/* Function that switches to the read-only data section (optional) */
-#define READONLY_DATA_SECTION const_section
-
-/* Output before program init section */
-#define INIT_SECTION_ASM_OP "\n\tinit ; init_section\n"
-
-/* Output before program text section */
-#define TEXT_SECTION_ASM_OP "\n\tnormal ; text_section\n"
-
-/* Output before writable data.
- 1750 Note: This is actually read-only data. The copying from read-only
- to writable memory is done elsewhere (in ASM_FILE_END.)
- */
-#define DATA_SECTION_ASM_OP "\n\tkonst ; data_section\n"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
- { "0", "1", "2", "3", "4", "5", "6", "7", \
- "8", "9","10","11","12","13","14","15" }
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/****************** Assembler output formatting **********************/
-
-#define ASM_IDENTIFY_GCC(FILE) fputs ("; gcc2_compiled:\n", FILE)
-
-#define ASM_COMMENT_START ";"
-
-#define ASM_OUTPUT_FUNNAM(FILE,NAME) \
- fprintf(FILE,"%s\n",NAME)
-
-#define ASM_OUTPUT_OPCODE(FILE,PTR) do { \
- while (*(PTR) != '\0' && *(PTR) != ' ') { \
- putc (*(PTR), FILE); \
- (PTR)++; \
- } \
- while (*(PTR) == ' ') \
- (PTR)++; \
- putc ('\t', FILE); \
- program_counter += 2; \
- } while (0)
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
- fprintf(FILE,"%s\n",NAME)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-/* 1750 note: Labels are prefixed with a 'K'. This is because handling
- has been changed for labels to be output in the "Constants" section
- (named "Konst"), and special initialization code takes care of copying
- the Const-section data into the writable data section (named "Static").
- In the Static section we therefore have the true label names (i.e.
- not prefixed with 'K'). */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { if (NAME[0] == '.') { \
- fprintf(stderr,"Oops! label %s can't begin with '.'\n",NAME); \
- abort(); \
- } \
- else { \
- check_section(Konst); \
- fprintf(FILE,"K%s\n",NAME); \
- fflush(FILE); \
- datalbl[++datalbl_ndx].name = (char *)xstrdup (NAME);\
- datalbl[datalbl_ndx].size = 0; \
- label_pending = 1; \
- } \
- } while (0)
-
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) do { \
- fprintf (FILE, "\tglobal %s\t; export\n", NAME); \
- } while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX ""
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- do { \
- if (strcmp(PREFIX,"LC") == 0) { \
- label_pending = 1; \
- datalbl[++datalbl_ndx].name = (char *) malloc (9); \
- sprintf(datalbl[datalbl_ndx].name,"LC%d",NUM); \
- datalbl[datalbl_ndx].size = 0; \
- check_section(Konst); \
- fprintf(FILE,"K%s%d\n",PREFIX,NUM); \
- } \
- else if (find_jmplbl(NUM) < 0) { \
- jmplbl[++jmplbl_ndx].num = NUM; \
- jmplbl[jmplbl_ndx].pc = program_counter; \
- fprintf(FILE, "%s%d\n", PREFIX, NUM); \
- } \
- fflush(FILE); \
- } while (0)
-
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "%s%d", PREFIX, NUM)
-
-/* Output at the end of a jump table.
- 1750: To be uncommented when we can put jump tables in Konst.
- #define ASM_OUTPUT_CASE_END(FILE,NUM,INSN) \
- fprintf (FILE, "\tnormal\t; case_end\n")
- */
-
-/* Currently, it is not possible to put jump tables in section Konst.
- This is because there is a one-to-one relation between sections Konst
- and Static (i.e., all Konst data are copied to Static, and the order
- of data is the same between the two sections.) However, jump tables are
- not copied to Static, which destroys the equivalence between Konst and
- Static. When a more intelligent Konst-to-Static copying mechanism is
- implemented (i.e. one that excludes the copying of jumptables), then
- ASM_OUTPUT_CASE_END shall be defined, and JUMP_LABELS_IN_TEXT_SECTION
- shall be undefined. */
-
-#define JUMP_TABLES_IN_TEXT_SECTION 1
-
-/* This is how to output an assembler line defining a 1750A `float'
- constant. */
-
-#define ASM_OUTPUT_SHORT_FLOAT(FILE,VALUE) \
- do { \
- if (label_pending) { \
- label_pending = 0; \
- sprintf (datalbl[datalbl_ndx].value, "%lf", (double) VALUE); \
- } \
- datalbl[datalbl_ndx].size += 2; \
- fprintf (FILE, "\tdataf\t%lf\n",VALUE); \
- } while(0)
-
-/* This is how to output an assembler line defining a 1750A `double'
- constant. */
-
-#define ASM_OUTPUT_THREE_QUARTER_FLOAT(FILE,VALUE) \
- do { \
- if (label_pending) { \
- label_pending = 0; \
- sprintf (datalbl[datalbl_ndx].value, "%lf", VALUE); \
- } \
- datalbl[datalbl_ndx].size += 3; \
- fprintf(FILE,"\tdataef\t%lf\n",VALUE); \
- } while (0)
-
-/* This is how to output an assembler line defining a string constant. */
-
-#define ASM_OUTPUT_ASCII(FILE, PTR, LEN) do { \
- int i; \
- if (label_pending) \
- label_pending = 0; \
- datalbl[datalbl_ndx].size += LEN; \
- for (i = 0; i < LEN; i++) { \
- if ((i % 15) == 0) { \
- if (i != 0) \
- fprintf(FILE,"\n"); \
- fprintf(FILE,"\tdata\t"); \
- } \
- else \
- fprintf(FILE,","); \
- if (PTR[i] >= 32 && PTR[i] < 127) \
- fprintf(FILE,"'%c'",PTR[i]); \
- else \
- fprintf(FILE,"%d",PTR[i]); \
- } \
- fprintf(FILE,"\n"); \
- } while (0)
-
-/* This is how to output an assembler line defining a `char', `short', or
- `int' constant.
- 1750 NOTE: The reason why this macro also outputs `short' and `int'
- constants is that for the 1750, BITS_PER_UNIT is 16 (as opposed to the
- usual 8.) This behavior is different from the usual, where
- ASM_OUTPUT_CHAR only outputs character constants. The name
- of this macro should perhaps be `ASM_OUTPUT_QUARTER_INT' or so.
- */
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) do { \
- if (label_pending) \
- label_pending = 0; \
- datalbl[datalbl_ndx].size++; \
- fprintf(FILE, "\tdata\t"); \
- output_addr_const(FILE, VALUE); \
- fprintf(FILE, "\n"); \
- } while (0)
-
-/* This is how to output an assembler line defining a `long int' constant.
- 1750 NOTE: The reason why this macro outputs `long' instead of `short'
- constants is that for the 1750, BITS_PER_UNIT is 16 (as opposed to the
- usual 8.) The name of this macro should perhaps be `ASM_OUTPUT_HALF_INT'.
- */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) do { \
- if (label_pending) \
- label_pending = 0; \
- datalbl[datalbl_ndx].size += 2; \
- fprintf(FILE, "\tdatal\t%d\n",INTVAL(VALUE)); \
- } while (0)
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) do { \
- if (label_pending) \
- label_pending = 0; \
- datalbl[datalbl_ndx].size++; \
- fprintf(FILE, "\tdata\t#%x\n", VALUE); \
- } while (0)
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tPSHM R%s,R%s\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tPOPM R%s,R%s\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\tdata\tL%d ;addr_vec_elt\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\tdata\tL%d-L%d ;addr_diff_elt\n", VALUE,REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf(FILE,"; in ASM_OUTPUT_ALIGN: pwr_of_2_bytcnt=%d\n",LOG)
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf(FILE,"; in ASM_OUTPUT_SKIP: size=%d\n",SIZE)
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) do { \
- check_section(Static); \
- fprintf (FILE, "\tcommon %s,%d\n", NAME, SIZE); \
- } while (0)
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) do { \
- fprintf (FILE, "\tglobal %s\t; import\n", NAME); \
- } while (0)
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) do { \
- check_section (Static); \
- fprintf(FILE,"%s \tblock %d\t; local common\n",NAME,SIZE); \
- } while (0)
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) do { \
- fprintf(FILE, "\tinit\n\t"); assemble_name(FILE, NAME); \
- fprintf(FILE," ;constructor\n"); } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE, NAME) do { \
- fprintf(FILE, "\tinit\n\t"); assemble_name(FILE, NAME); \
- fprintf(FILE," ;destructor\n"); } while (0)
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
- 1750 note: there are three special CODE characters:
- 'D', 'E': print a reference to a floating point constant (D=double,
- E=single precision) label name
- 'F': print a label defining a floating-point constant value
- 'J': print the absolute value of a negative INT_CONST
- (this is used in LISN/CISN/MISN/SISP and others)
- 'Q': print a 1750 Base-Register-with-offset instruction's operands
- */
-
-/* 1750A: see file aux-output.c */
-#define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE,X,CODE)
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE,ADDR)
-
diff --git a/gcc/config/1750a/1750a.md b/gcc/config/1750a/1750a.md
deleted file mode 100644
index 09b4211ca96..00000000000
--- a/gcc/config/1750a/1750a.md
+++ /dev/null
@@ -1,1359 +0,0 @@
-;;- Machine description for GNU compiler
-;;- MIL-STD-1750A version.
-;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
-;; Contributed by O.M.Kellogg, DASA (oliver.kellogg@space.otn.dasa.de).
-
-;; 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 1, 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.
-
-
-;;- instruction definitions
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;;- When naming insn's (operand 0 of define_insn) be careful about using
-;;- names from other targets machine descriptions.
-
-;; MIL-STD-1750 specific remarks:
-;;
-;; 1) BITS_PER_UNIT = 16
-;;
-;; 2) GCC to MIL-STD-1750 data type mappings:
-;; QImode => single integer (16 bits or 1 reg).
-;; HImode => double integer (32 bits or 2 regs).
-;; HFmode => single precision float (32 bits or 2 regs).
-;; TQFmode => extended precision float (48 bits or 3 regs).
-;;
-;; 3) Immediate integer operands Constraints:
-;; 'I' 1 .. 16
-;; 'J' -1 ..-16
-;; 'K' 0 .. 15
-;; 'L' 0 .. 255
-;; 'M' -32768 .. 32767
-;; 'O' => 0 (for optimizations and GCC quirks)
-;;
-;; Further notes:
-;;- Assembly output ending in ".M" are macros in file M1750.INC
-
-
-;; stackpush
-(define_insn ""
- [(set (match_operand:QI 0 "push_operand" "=<")
- (match_operand:QI 1 "general_operand" "r"))]
- ""
- "pshm r%1,r%1")
-
-(define_insn ""
- [(set (match_operand:HI 0 "push_operand" "=<")
- (match_operand:HI 1 "general_operand" "r"))]
- ""
- "pshm r%1,r%d1")
-
-(define_insn ""
- [(set (match_operand:HF 0 "push_operand" "=<")
- (match_operand:HF 1 "general_operand" "r"))]
- ""
- "pshm r%1,r%d1")
-
-(define_insn ""
- [(set (match_operand:TQF 0 "push_operand" "=<")
- (match_operand:TQF 1 "general_operand" "r"))]
- ""
- "pshm r%1,r%t1")
-
-;; stackpop
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=r")
- (match_operand:QI 1 "push_operand" ">"))]
- ""
- "popm r%1,r%1")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=r")
- (match_operand:HI 1 "push_operand" ">"))]
- ""
- "popm r%1,r%d1")
-
-(define_insn ""
- [(set (match_operand:HF 0 "general_operand" "=r")
- (match_operand:HF 1 "push_operand" ">"))]
- ""
- "popm r%1,r%d1")
-
-(define_insn ""
- [(set (match_operand:TQF 0 "general_operand" "=r")
- (match_operand:TQF 1 "push_operand" ">"))]
- ""
- "popm r%1,r%t1")
-
-
-;; Test operations.
-
-(define_insn "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "register_operand" "r"))]
- ""
- "lr r%0,r%0 ; from tstqi")
-
-(define_insn "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "register_operand" "r"))]
- ""
- "dlr r%0,r%0 ; from tsthi")
-
-; With 1750A floats, testing the most significant word suffices.
-
-(define_insn "tsthf"
- [(set (cc0)
- (match_operand:HF 0 "register_operand" "r"))]
- ""
- "lr r%0,r%0 ; tsthf")
-
-(define_insn "tsttqf"
- [(set (cc0)
- (match_operand:TQF 0 "register_operand" "r"))]
- ""
- "lr r%0,r%0 ; tsttqf")
-
-
-;; block move.
-
-(define_insn "movstrqi"
- [(set (match_operand:BLK 0 "mov_memory_operand" "m")
- (match_operand:BLK 1 "mov_memory_operand" "m"))
- (use (match_operand:QI 2 "general_operand" "r"))
- (match_operand 3 "" "")
- (clobber (match_dup 0))
- (clobber (match_dup 1))
- (clobber (match_dup 2))]
- ""
- "*
- {
- rtx regops[3];
-
- regops[0] = XEXP (operands[0], 0);
- regops[1] = XEXP (operands[1], 0);
- regops[2] = operands[2];
-
- return movcnt_regno_adjust (regops);
- } ")
-
-
-;; compare instructions.
-
-(define_insn "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "register_operand" "r,r,r,r,r")
- (match_operand:QI 1 "general_operand" "I,J,i,r,m")))]
- ""
- "*
- {
- if (next_cc_user_is_unsigned (insn))
- switch (which_alternative)
- {
- case 0:
- case 1:
- case 2:
- return \"ucim.m %0,%1\";
- case 3:
- return \"ucr.m %0,%1\";
- case 4:
- return \"uc.m %0,%1\";
- }
- else
- switch (which_alternative)
- {
- case 0:
- return \"cisp r%0,%1\";
- case 1:
- return \"cisn r%0,%J1\";
- case 2:
- return \"cim r%0,%1\";
- case 3:
- return \"cr r%0,r%1\";
- case 4:
- return \"c r%0,%1\";
- }
- } ")
-
-(define_insn "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "general_operand" "r,r")
- (match_operand:HI 1 "general_operand" "r,m")))]
- ""
- "@
- dcr r%0,r%1
- dc r%0,%1 ")
-
-(define_insn "cmphf"
- [(set (cc0)
- (compare (match_operand:HF 0 "general_operand" "r,r")
- (match_operand:HF 1 "general_operand" "r,m")))]
- ""
- "@
- fcr r%0,r%1
- fc r%0,%1 ")
-
-(define_insn "cmptqf"
- [(set (cc0)
- (compare (match_operand:TQF 0 "general_operand" "r,r")
- (match_operand:TQF 1 "general_operand" "r,m")))]
- ""
- "@
- efcr r%0,r%1
- efc r%0,%1 ")
-
-
-;; truncation instructions
-;;- 1750: any needed?
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (truncate:QI (match_operand:HI 1 "register_operand" "r")))]
- ""
- "lr r%0,r%d1")
-
-
-;; zero extension instructions: not defined, GCC can synthesize
-
-;; sign extension instructions
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (sign_extend:HI (match_operand:QI 1 "general_operand" "r,m")) )]
- ""
- "*
- if (which_alternative == 0)
- {
- if (REGNO (operands [0]) != REGNO (operands [1]))
- output_asm_insn (\"lr r%0,r%1\", operands);
- }
- else
- output_asm_insn (\"l r%0,%1\", operands);
- return \"dsra r%0,16 ;extendqihi2\";
- ")
-
-
-;; Conversions between float and double.
-
-; 1750 HF-to-TQF extend: just append 16 bits (least signif.) with all bits zero
-(define_insn "extendhftqf2"
- [(set (match_operand:TQF 0 "register_operand" "=r,r")
- (float_extend:TQF (match_operand:HF 1 "general_operand" "r,m")))]
- ""
- "*
- output_asm_insn(\"xorr r%t0,r%t0 ;extendhftqf2\", operands);
- if (which_alternative == 0)
- {
- if (REGNO (operands[1]) != REGNO (operands[0]))
- return \"dlr r%0,r%1\";
- else
- return \";\";
- }
- else
- return \"dl r%0,%1\";
- ")
-
-; 1750 TQF-to-HF truncate is a no-op: just leave away the least signif. 16 bits
-(define_insn "trunctqfhf2"
- [(set (match_operand:HF 0 "register_operand" "=r,r")
- (float_truncate:HF
- (match_operand:TQF 1 "general_operand" "r,m")))]
- ""
- "@
- dlr r%0,r%1 ;trunctqfhf2
- dl r%0,%1 ;trunctqfhf2 ")
-
-
-;; Conversion between fixed point and floating point.
-
-(define_insn "floatqihf2"
- [(set (match_operand:HF 0 "register_operand" "=r")
- (float:HF (match_operand:QI 1 "register_operand" "r")))]
- ""
- "flt r%0,r%1")
-
-(define_insn "floathitqf2"
- [(set (match_operand:TQF 0 "register_operand" "=r")
- (float:TQF (match_operand:HI 1 "register_operand" "r")))]
- ""
- "eflt r%0,r%1")
-
-
-;; Convert floats to ints
-
-(define_insn "fix_trunchfqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (fix:QI (fix:HF (match_operand:HF 1 "register_operand" "r"))))]
- ""
- "fix r%0,r%1")
-
-(define_insn "fix_trunctqfhi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (fix:HI (fix:TQF (match_operand:TQF 1 "register_operand" "r"))))]
- ""
- "efix r%0,r%1")
-
-
-;; Move instructions
-
-;; We can't deal with normal byte-size characters, only with WIDE characters!
-;; This may appear as a serious restriction, but it also opens the doors
-;; for ISO 10646 :-)
-
-;; 16-bit moves
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=r,r,r,r,r,r,m,m")
- (match_operand:QI 1 "general_operand" "O,I,J,i,r,m,r,K"))]
- ""
- "@
- xorr r%0,r%0
- lisp r%0,%1
- lisn r%0,%J1
- lim r%0,%1
- lr r%0,r%1
- l r%0,%1
- st r%1,%0
- stc %1,%0 ")
-
-;; 32-bit moves
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=r,r,r,r,r,m,m")
- (match_operand:HI 1 "general_operand" "O,I,J,r,m,r,K"))]
- ""
- "@
- xorr r%0,r%0\;xorr r%d0,r%d0
- xorr r%0,r%0\;lisp r%d0,%1
- lisn r%0,1 \;lisn r%d0,%J1
- dlr r%0,r%1
- dl r%0,%1
- dst r%1,%0
- stc 0,%0 \;stc %1,%A0 ")
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (match_operand:HI 1 "general_operand" "g"))]
- ""
- "
- {
- rtx op1 = operands[1];
- if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (op1) == MEM
- || (GET_CODE (op1) == CONST_INT
- && (INTVAL (op1) < 0 || INTVAL (op1) > 15)))
- operands[1] = force_reg (HImode, operands[1]);
- }
- else if (GET_CODE (op1) == CONST_INT
- && (INTVAL (op1) < -16 || INTVAL (op1) > 16))
- operands[1] = force_const_mem (HImode, operands[1]);
- }")
-
-
-;; Single-Float moves
-
-(define_insn "movhf"
- [(set (match_operand:HF 0 "general_operand" "=r,r,m,m")
- (match_operand:HF 1 "general_operand" "r,m,r,G"))]
- ""
- "@
- dlr r%0,r%1
- dl r%0,%1
- dst r%1,%0
- stc 0,%0 \;stc 0,%A0 ")
-
-
-;; Longfloat moves
-
-(define_insn "movtqf"
- [(set (match_operand:TQF 0 "general_operand" "=r,r,m")
- (match_operand:TQF 1 "general_operand" "r,m,r"))]
- ""
- "@
- eflr.m %0,%1
- efl r%0,%1
- efst r%1,%0 ")
-
-
-;; add instructions
-
-;; single integer
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "general_operand" "=r,r,r,r,r,m,m")
- (plus:QI (match_operand:QI 1 "general_operand" "%0,0,0,0,0,0,0")
- (match_operand:QI 2 "general_operand" "I,J,i,r,m,I,J")))]
- ""
- "*
- switch (which_alternative)
- {
- case 0:
- return \"aisp r%0,%2\";
- case 1:
- return \"sisp r%0,%J2\";
- case 2:
- if (INTVAL(operands[2]) < 0)
- return \"sim r%0,%J2\";
- else
- return \"aim r%0,%2\";
- case 3:
- return \"ar r%0,r%2\";
- case 4:
- return \"a r%0,%2\";
- case 5:
- return \"incm %2,%0\";
- case 6:
- return \"decm %J2,%0\";
- } ")
-
-;; double integer
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (plus:HI (match_operand:HI 1 "register_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "r,m")))]
- ""
- "@
- dar r%0,r%2
- da r%0,%2 ")
-
-(define_insn "addhf3"
- [(set (match_operand:HF 0 "register_operand" "=r,r")
- (plus:HF (match_operand:HF 1 "register_operand" "%0,0")
- (match_operand:HF 2 "general_operand" "r,m")))]
- ""
- "@
- far r%0,r%2
- fa r%0,%2 ")
-
-(define_insn "addtqf3"
- [(set (match_operand:TQF 0 "register_operand" "=r,r")
- (plus:TQF (match_operand:TQF 1 "register_operand" "%0,0")
- (match_operand:TQF 2 "general_operand" "r,m")))]
- ""
- "@
- efar r%0,r%2
- efa r%0,%2 ")
-
-
-;; subtract instructions
-
-;; single integer
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "general_operand" "=r,r,r,r,m")
- (minus:QI (match_operand:QI 1 "general_operand" "0,0,0,0,0")
- (match_operand:QI 2 "general_operand" "I,i,r,m,I")))]
- ""
- "@
- sisp r%0,%2
- sim r%0,%2
- sr r%0,r%2
- s r%0,%2
- decm %2,%0 ")
-
-;; double integer
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (minus:HI (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:HI 2 "general_operand" "r,m")))]
- ""
- "@
- dsr r%0,r%2
- ds r%0,%2 ")
-
-(define_insn "subhf3"
- [(set (match_operand:HF 0 "register_operand" "=r,r")
- (minus:HF (match_operand:HF 1 "register_operand" "0,0")
- (match_operand:HF 2 "general_operand" "r,m")))]
- ""
- "@
- fsr r%0,r%2
- fs r%0,%2 ")
-
-(define_insn "subtqf3"
- [(set (match_operand:TQF 0 "register_operand" "=r,r")
- (minus:TQF (match_operand:TQF 1 "register_operand" "0,0")
- (match_operand:TQF 2 "general_operand" "r,m")))]
- ""
- "@
- efsr r%0,r%2
- efs r%0,%2 ")
-
-
-;; multiply instructions
-
-(define_insn "mulqi3"
- [(set (match_operand:QI 0 "register_operand" "=r,r,r,r,r")
- (mult:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0")
- (match_operand:QI 2 "general_operand" "I,J,M,r,m")))]
- ""
- "@
- misp r%0,%2
- misn r%0,%J2
- msim r%0,%2
- msr r%0,r%2
- ms r%0,%2 ")
-
-
-; 32-bit product
-(define_insn "mulqihi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r,r")
- (mult:HI (sign_extend:HI (match_operand:QI 1 "register_operand" "%r,r,r"))
- (sign_extend:HI (match_operand:QI 2 "general_operand" "r,m,i"))))]
- ""
- "*
- if (REGNO (operands[1]) != REGNO (operands[0]))
- output_asm_insn (\"lr r%0,r%1\", operands);
-
- switch (which_alternative)
- {
- case 0:
- return \"mr r%0,r%2\";
- case 1:
- return \"m r%0,%2\";
- case 2:
- return \"mim r%0,%2\";
- }
- ")
-
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (mult:HI (match_operand:HI 1 "register_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "r,m")))]
- ""
- "@
- dmr r%0,r%2
- dm r%0,%2 ")
-
-; not available on 1750: "umulhi3","umulhisi3","umulsi3" (unsigned multiply's)
-
-(define_insn "mulhf3"
- [(set (match_operand:HF 0 "register_operand" "=r,r")
- (mult:HF (match_operand:HF 1 "register_operand" "%0,0")
- (match_operand:HF 2 "general_operand" "r,m")))]
- ""
- "@
- fmr r%0,r%2
- fm r%0,%2 ")
-
-(define_insn "multqf3"
- [(set (match_operand:TQF 0 "register_operand" "=r,r")
- (mult:TQF (match_operand:TQF 1 "register_operand" "%0,0")
- (match_operand:TQF 2 "general_operand" "r,m")))]
- ""
- "@
- efmr r%0,r%2
- efm r%0,%2 ")
-
-
-;; divide instructions
-;; The 1750 16bit integer division instructions deliver a 16-bit
-;; quotient and a 16-bit remainder, where the remainder is in the next higher
-;; register number above the quotient. For now, we haven't found a way
-;; to give the reload pass knowledge of this property. So we make do with
-;; whatever registers the allocator wants, and willy-nilly output a pair of
-;; register-copy ops when needed. (See mod_regno_adjust() in file aux-output.c)
-;; A comment in the description of `divmodM4' suggests that one leave the divM3
-;; undefined when there is a divmodM4 available.
-
-(define_insn "divmodqi4"
- [(set (match_operand:QI 0 "register_operand" "=r,r,r,r,r")
- (div:QI (match_operand:QI 1 "register_operand" "0,0,0,0,0")
- (match_operand:QI 2 "general_operand" "I,J,M,r,m")))
- (set (match_operand:QI 3 "register_operand" "=r,r,r,r,r")
- (mod:QI (match_dup 1) (match_dup 2)))]
- ""
- "*
- {
- char *istr;
- switch(which_alternative)
- {
- case 0:
- istr = \"disp\";
- break;
- case 1:
- {
- rtx new_opnds[4];
- new_opnds[0] = operands[0];
- new_opnds[1] = operands[1];
- new_opnds[2] = gen_rtx (CONST_INT, VOIDmode, -INTVAL(operands[2]));
- new_opnds[3] = operands[3];
- istr = \"disn\";
- return mod_regno_adjust (istr, new_opnds);
- }
- break;
- case 2:
- istr = \"dvim\";
- break;
- case 3:
- istr = \"dvr \";
- break;
- case 4:
- istr = \"dv \";
- break;
- }
- return mod_regno_adjust (istr, operands);
- }")
-
-;; Division for other types is straightforward.
-
-(define_insn "divhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (div:HI (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:HI 2 "general_operand" "r,m")))]
- ""
- "@
- ddr r%0,r%2
- dd r%0,%2 ")
-
-(define_insn "divhf3"
- [(set (match_operand:HF 0 "register_operand" "=r,r")
- (div:HF (match_operand:HF 1 "register_operand" "0,0")
- (match_operand:HF 2 "general_operand" "r,m")))]
- ""
- "@
- fdr r%0,r%2
- fd r%0,%2 ")
-
-(define_insn "divtqf3"
- [(set (match_operand:TQF 0 "register_operand" "=r,r")
- (div:TQF (match_operand:TQF 1 "register_operand" "0,0")
- (match_operand:TQF 2 "general_operand" "r,m")))]
- ""
- "@
- efdr r%0,r%2
- efd r%0,%2 ")
-
-
-;; Other arithmetic instructions:
-
-;; Absolute value
-
-(define_insn "absqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (abs:QI (match_operand:QI 1 "register_operand" "r")))]
- ""
- "abs r%0,r%1")
-
-(define_insn "abshi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (abs:HI (match_operand:HI 1 "register_operand" "r")))]
- ""
- "dabs r%0,r%1")
-
-(define_insn "abshf2"
- [(set (match_operand:HF 0 "register_operand" "=r")
- (abs:HF (match_operand:HF 1 "register_operand" "r")))]
- ""
- "fabs r%0,r%1")
-
-
-;; Negation
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (neg:QI (match_operand:QI 1 "register_operand" "r")))]
- ""
- "neg r%0,r%1")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (neg:HI (match_operand:HI 1 "register_operand" "r")))]
- ""
- "dneg r%0,r%1")
-
-(define_insn "neghf2"
- [(set (match_operand:HF 0 "register_operand" "=r")
- (neg:HF (match_operand:HF 1 "register_operand" "r")))]
- ""
- "fneg r%0,r%1")
-
-; The 1750A does not have an extended float negate instruction, so simulate.
-(define_expand "negtqf2"
- [(set (match_operand:TQF 0 "register_operand" "=&r")
- (neg:TQF (match_operand:TQF 1 "register_operand" "r")))]
- ""
- "
- emit_insn(gen_rtx(SET,VOIDmode,operands[0],CONST0_RTX(TQFmode)));
- emit_insn(gen_rtx(SET,VOIDmode,operands[0],
- gen_rtx(MINUS,TQFmode,operands[0],operands[1])));
- DONE;
- ")
-
-
-;; bit-logical instructions
-
-;; Set Bit
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=r,m")
- (ior:QI (match_operand:QI 1 "general_operand" "0,0")
- (match_operand:QI 2 "const_int_operand" "i,i")))]
- "one_bit_set_p (INTVAL (operands [2]))"
- "@
- sbr %b2,r%0
- sb %b2,%0")
-
-;; Reset Bit
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=r,m")
- (and:QI (match_operand:QI 1 "general_operand" "0,0")
- (match_operand:QI 2 "const_int_operand" "i,i")))]
- "one_bit_set_p ((~INTVAL (operands [2])) & 0xffff)"
- "@
- rbr %B2,r%0
- rb %B2,%0")
-
-;; Set Variable Bit
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (ior:QI (match_operand:QI 1 "register_operand" "0")
- (lshiftrt:QI (const_int 0x8000)
- (match_operand:QI 2 "register_operand" "r"))))]
- ""
- "svbr r%2,%r0")
-
-;; Reset Variable Bit
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=r")
- (and:QI (match_operand:QI 1 "general_operand" "0")
- (not:QI (lshiftrt:QI (const_int 0x8000)
- (match_operand:QI 2 "register_operand" "r")))))]
- ""
- "rvbr r%2,%r0")
-
-
-;; AND
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "general_operand" "=r,r,r")
- (and:QI (match_operand:QI 1 "general_operand" "%0,0,0")
- (match_operand:QI 2 "general_operand" "M,r,m")))]
- ""
- "@
- andm r%0,%2
- andr r%0,r%2
- and r%0,%2 ")
-
-; This sets incorrect condition codes. See notice_update_cc()
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (and:HI (match_operand:HI 1 "register_operand" "%0")
- (match_operand:HI 2 "register_operand" "r")))]
- ""
- "danr.m %0,%2")
-
-;; OR
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "general_operand" "=r,r,r")
- (ior:QI (match_operand:QI 1 "general_operand" "%0,0,0")
- (match_operand:QI 2 "general_operand" "M,r,m")))]
- ""
- "@
- orim r%0,%2
- orr r%0,r%2
- or r%0,%2 ")
-
-; This sets incorrect condition codes. See notice_update_cc()
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ior:HI (match_operand:HI 1 "register_operand" "%0")
- (match_operand:HI 2 "register_operand" "r")))]
- ""
- "dorr.m %0,%2")
-
-;; XOR
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "register_operand" "=r,r,r")
- (xor:QI (match_operand:QI 1 "register_operand" "%0,0,0")
- (match_operand:QI 2 "general_operand" "M,r,m")))]
- ""
- "@
- xorm r%0,%2
- xorr r%0,r%2
- xor r%0,%2 ")
-
-; This sets incorrect condition codes. See notice_update_cc()
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (xor:HI (match_operand:HI 1 "register_operand" "%0")
- (match_operand:HI 2 "register_operand" "r")))]
- ""
- "dxrr.m %0,%2")
-
-;; NAND
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r,r,r")
- (ior:QI (not:QI (match_operand:QI 1 "register_operand" "%0,0,0"))
- (not:QI (match_operand:QI 2 "general_operand" "M,r,m"))))]
- ""
- "@
- nim r%0,%2
- nr r%0,r%2
- n r%0,%2 ")
-
-; This sets incorrect condition codes. See notice_update_cc()
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ior:HI (not:HI (match_operand:HI 1 "register_operand" "%0"))
- (not:HI (match_operand:HI 2 "register_operand" "r"))))]
- ""
- "dnr.m %0,%2")
-
-;; NOT
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (not:QI (match_operand:QI 1 "register_operand" "0")))]
- ""
- "nr r%0,r%0")
-
-; This sets incorrect condition codes. See notice_update_cc()
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (not:HI (match_operand:HI 1 "register_operand" "0")))]
- ""
- "dnr.m %0,%0")
-
-
-;; Shift instructions
-
-; (What to the 1750 is logical-shift-left, GCC likes to call "arithmetic")
-(define_insn "ashlqi3"
- [(set (match_operand:QI 0 "register_operand" "=r,r")
- (ashift:QI (match_operand:QI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "I,r")))]
- ""
- "@
- sll r%0,%2
- slr r%0,r%2 ")
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (ashift:HI (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "L,r")))]
- "" ; the 'L' constraint is a slight imprecise...
- "*
- if (which_alternative == 1)
- return \"dslr r%0,r%2\";
- else if (INTVAL(operands[2]) <= 16)
- return \"dsll r%0,%2\";
- else
- {
- output_asm_insn (\"dsll r%0,16 ; ashlhi3 shiftcnt > 16\", operands);
- return \"sll r%0,%w2\";
- }
- ")
-
-
-;; Right shift by a variable shiftcount works by negating the shift count,
-;; then emitting a right shift with the shift count negated. This means
-;; that all actual shift counts in the RTL will be positive. This
-;; prevents converting shifts to ZERO_EXTRACTs with negative positions,
-;; which isn't valid.
-(define_expand "lshrqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "immediate_operand" "I")))]
- ""
- "srl r%0,%2")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
- (neg:QI (match_operand:QI 2 "register_operand" "r"))))]
- ""
- "slr r%0,r%2 ")
-
-;; Same thing for HImode.
-
-(define_expand "lshrhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "g")))]
- ""
- "
- {
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
- }")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:QI 2 "immediate_operand" "L")))]
- ""
- "*
- if (INTVAL (operands[2]) <= 16)
- return \"dsrl r%0,%2\";
- output_asm_insn (\"dsrl r%0,16 ; lshrhi3 shiftcount > 16\", operands);
- return \"srl r%d0,%w2\";
- ")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
- (neg:QI (match_operand:QI 2 "register_operand" "r"))))]
- ""
- "dslr r%0,r%2 ")
-
-;; Same applies for arithmetic shift right.
-(define_expand "ashrqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "g")))]
- ""
- "
- {
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
- }")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "immediate_operand" "I")))]
- ""
- "sra r%0,%2")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
- (neg:QI (match_operand:QI 2 "register_operand" "r"))))]
- ""
- "sar r%0,r%2 ")
-
-;; HImode arithmetic shift right.
-(define_expand "ashrhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "g")))]
- ""
- "
- {
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
- }")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:QI 2 "immediate_operand" "L")))]
- ""
- "*
- if (INTVAL (operands[2]) <= 16)
- return \"dsra r%0,%2\";
- output_asm_insn (\"dsra r%0,16 ; ashrhi3 shiftcount > 16\", operands);
- return \"sra r%d0,%w2\";
- ")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
- (neg:QI (match_operand:QI 2 "register_operand" "r"))))]
- ""
- "dsar r%0,r%2 ")
-
-
-;; rotate instructions
-
-(define_insn "rotlqi3"
- [(set (match_operand:QI 0 "register_operand" "=r,r")
- (rotate:QI (match_operand:QI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "I,r")))]
- ""
- "@
- slc r%0,%2
- scr r%0,r%2 ")
-
-(define_insn "rotlhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (rotate:HI (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "I,r")))]
- ""
- "@
- dslc r%0,%2
- dscr r%0,r%2 ")
-
-(define_insn "rotrqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (rotatert:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "register_operand" "r")))]
- ""
- "neg r%2,r%2\;scr r%0,r%2 ")
-
-(define_insn "rotrhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (rotatert:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "r")))]
- ""
- "neg r%2,r%2\;dscr r%0,r%2 ")
-
-
-
-;; Special cases of bit-field insns which we should
-;; recognize in preference to the general case.
-;; These handle aligned 8-bit and 16-bit fields,
-;; which can usually be done with move instructions.
-; 1750: t.b.d.
-;********************
-
-;; Bit field instructions, general cases.
-;; "o,d" constraint causes a nonoffsetable memref to match the "o"
-;; so that its address is reloaded.
-
-;; (define_insn "extv" ...
-
-;; (define_insn "extzv" ...
-
-;; (define_insn "insv" ...
-
-;; Now recognize bit field insns that operate on registers
-;; (or at least were intended to do so).
-;[unnamed only]
-
-;; Special patterns for optimizing bit-field instructions.
-;**************************************
-
-; cc status test ops n.a. on 1750 ......... e.g. "sleu" on 68k:
-; [(set (match_operand:QI 0 "general_operand" "=d")
-; (leu (cc0) (const_int 0)))]
-; ""
-; "* cc_status = cc_prev_status;
-; return \"sls %0\"; ")
-
-
-;; Basic conditional jump instructions.
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return branch_or_jump (\"ez\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return branch_or_jump (\"nz\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return branch_or_jump (\"gt\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return branch_or_jump (\"lt\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return branch_or_jump (\"ge\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return branch_or_jump (\"le\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-
-; no unsigned branches available on 1750. But GCC still needs them, so faking:
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jc gt,%l0 ; Warning: this should be an *unsigned* test!")
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jc lt,%l0 ; Warning: this should be an *unsigned* test!")
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jc ge,%l0 ; Warning: this should be an *unsigned* test!")
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jc le,%l0 ; Warning: this should be an *unsigned* test!")
-
-
-;; Negated conditional jump instructions.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return branch_or_jump (\"nz\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return branch_or_jump (\"ez\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return branch_or_jump (\"le\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return branch_or_jump (\"ge\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return branch_or_jump (\"lt\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return branch_or_jump (\"gt\", CODE_LABEL_NUMBER (operands[0]));
- ")
-
-
-;; Negated unsigned conditional jump instructions (faked for 1750).
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jc le,%l0 ;inv.cond. ;Warning: this should be an *unsigned* test!")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jc ge,%l0 ;inv.cond. ;Warning: this should be an *unsigned* test!")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jc lt,%l0 ;inv.cond. ;Warning: this should be an *unsigned* test!")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jc gt,%l0 ;inv.cond. ;Warning: this should be an *unsigned* test!")
-
-;; Tablejump
-;; 1750 note: CASE_VECTOR_PC_RELATIVE is not defined
-(define_insn "tablejump"
- [(set (pc)
- (match_operand:QI 0 "register_operand" "b"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jc 15,0,r%0 ; tablejump label_ref=%1")
-
-
-;; Unconditional jump
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jc 15,%0")
-
-;; Call subroutine, returning value in operand 0
-;; (which must be a hard register).
-(define_insn "call_value"
- [(set (match_operand 0 "register_operand" "r")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:QI 2 "general_operand" "g")))]
- ;; Operand 2 not really used for 1750.
- ""
- "sjs r15,%1 ; return value in R0")
-
-;; Call subroutine with no return value.
-
-;; Operand 1 not really used in MIL-STD-1750.
-(define_insn ""
- [(call (match_operand:QI 0 "memory_operand" "mp")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "sjs r15,%0 ; no return value")
-
-;;;;;;;;;;;; 1750: NOT READY YET.
-(define_insn "call"
- [(call (match_operand:QI 0 "" "")
- (match_operand:QI 1 "" ""))]
- ""
- "ANYCALL %0")
-
-
-; (define_insn "return"
-; [(return)]
-; ""
-; "*
-; {
-; rtx oprnd = gen_rtx(CONST_INT,VOIDmode,get_frame_size());
-; output_asm_insn(\"ret.m %0\",&oprnd);
-; return \"\;\";
-; } ")
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:QI 0 "address_operand" "p"))]
- ""
- "jci 15,%0")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-
-;; Subtract One and Jump (if non-zero)
-(define_peephole
- [(set (match_operand:QI 0 "register_operand" "=r")
- (plus:QI (match_operand:QI 1 "register_operand" "%0")
- (match_operand:QI 2 "immediate_operand" "J")))
- (set (cc0) (match_dup 0))
- (set (pc)
- (if_then_else (ne (cc0) (const_int 0))
- (label_ref (match_operand 3 "" ""))
- (pc)))
- ]
- "INTVAL(operands[2]) == -1"
- "soj r%0,%3")
-
-;; Combine a Load Register with subsequent increment/decrement into a LIM
-(define_peephole
- [(set (match_operand:QI 0 "register_operand" "=r")
- (match_operand:QI 1 "register_operand" "b"))
- (set (match_dup 0)
- (plus:QI (match_dup 0)
- (match_operand:QI 2 "immediate_operand" "i")))]
- "REGNO(operands[1]) > 0"
- "lim r%0,%2,r%1 ; LR,inc/dec peephole")
-
-;; Eliminate the redundant load in a store/load sequence
-(define_peephole
- [(set (mem:QI (plus:QI (match_operand:QI 0 "register_operand" "r")
- (match_operand:QI 1 "immediate_operand" "i")))
- (match_operand:QI 2 "register_operand" "r"))
- (set (match_operand:QI 3 "register_operand" "=r")
- (mem:QI (plus:QI (match_dup 0)
- (match_dup 1))))
- ]
- "REGNO(operands[2]) == REGNO(operands[3])"
- "st r%2,%1,r%0 ; eliminated previous redundant load")
-
-;;;End.
diff --git a/gcc/config/1750a/ms1750.inc b/gcc/config/1750a/ms1750.inc
deleted file mode 100644
index da2f5a57871..00000000000
--- a/gcc/config/1750a/ms1750.inc
+++ /dev/null
@@ -1,114 +0,0 @@
-;; GCC assembler includefile for AS1750
-;;
-;; Macros defined:
-;; EFLR.M #d,#s Load the three regs starting at R#s to R#d following.
-;; RET.M #fs Return from function (uses the framesize #fs)
-
-
-UC SET 15
-
-; Return from function ; parameter: framesize
- MACRO RET.M
- IF `1` > 0
- IF `1` <= 16
- AISP R14,`1`
- ELSE
- AIM R14,`1`
- ENDIF
- ENDIF
- LR R15,R14
- URS R15
- ENDMACRO
-
-; Useful instructions missing from the 1750A standard:
-
-; Extended Float Load from Registers
- MACRO EFLR.M ; args : #1=dest-regno, #2=source-regno
-ONE SET `1` + 2
-TWO SET `2` + 2
- IF `1` >= `2` || `1`+2 < `2`
- LR R`ONE`,R`TWO`
- DLR R`1`,R`2`
- ELSE
- DLR R`1`,R`2`
- LR R`ONE`,R`TWO`
- DLR R`1`,R`1` ; Just to update condition codes
- ENDIF
- ENDMACRO
-
-; The following leave the condition codes haywire. But that is
-; accounted for (see notice_update_cc in config/1750a.c.)
-
-; Double ANd Register with Register
- MACRO DANR.M
-ONE SET `1` + 1
-TWO SET `2` + 1
- ANDR R`1`,R`2`
- ANDR R`ONE`,R`TWO`
- ENDMACRO
-
-; Double OR Register with Register
- MACRO DORR.M
-ONE SET `1` + 1
-TWO SET `2` + 1
- ORR R`1`,R`2`
- ORR R`ONE`,R`TWO`
- ENDMACRO
-
-; Double eXoR Register with Register
- MACRO DXRR.M
-ONE SET `1` + 1
-TWO SET `2` + 1
- XORR R`1`,R`2`
- XORR R`ONE`,R`TWO`
- ENDMACRO
-
-; Double Nand Register with register
- MACRO DNR.M
-ONE SET `1` + 1
-TWO SET `2` + 1
- NR R`1`,R`2`
- NR R`ONE`,R`TWO`
- ENDMACRO
-
-; Unsigned Compare Immediate
-
- MACRO UCIM.M
-LAST SET `1` + 3
- PSHM R`1`,R`LAST`
-LO SET `1` + 1
- LR R`LO`,R`1`
- XORR R`1`,R`1`
-HI SET `1` + 2
- XORR R`HI`,R`HI`
- LIM R`LAST`,`2`
- DCR R`1`,R`HI`
- POPM R`1`,R`LAST`
- ENDMACRO
-
-
-; Unsigned Compare Register with register
-
- MACRO UCR.M
- PSHM R10,R13 ; R12 and R13 are assumed not to be input parameters
- LR R13,R`2`
- LR R11,R`1`
- XORR R12,R12
- XORR R10,R10
- DCR R10,R12
- POPM R10,R13
- ENDMACRO
-
-
-; Unsigned Compare register with memory
-
- MACRO UC.M
- PSHM R10,R13
- L R13,`2`
- LR R11,R`1`
- XORR R12,R12
- XORR R10,R10
- DCR R10,R12
- POPM R10,R13
- ENDMACRO
-
diff --git a/gcc/config/1750a/xm-1750a.h b/gcc/config/1750a/xm-1750a.h
deleted file mode 100644
index 81f5e69203e..00000000000
--- a/gcc/config/1750a/xm-1750a.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Configuration for GNU C-compiler for MIL-STD-1750a.
- Copyright (C) 1995 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 1, 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.
-
-*/
-
-#error Gcc cannot run on a 1750a due to size problems!
diff --git a/gcc/config/README b/gcc/config/README
deleted file mode 100644
index 60328ec5b82..00000000000
--- a/gcc/config/README
+++ /dev/null
@@ -1,5 +0,0 @@
-This directory contains machine-specific files for the GNU C compiler.
-It has a subdirectory for each basic CPU type.
-The only files in this directory itself
-are some .h files that pertain to particular operating systems
-and are used for more than one CPU type.
diff --git a/gcc/config/a29k/a29k.c b/gcc/config/a29k/a29k.c
deleted file mode 100644
index d6588f23573..00000000000
--- a/gcc/config/a29k/a29k.c
+++ /dev/null
@@ -1,1536 +0,0 @@
-/* Subroutines used for code generation on AMD Am29000.
- Copyright (C) 1987, 88, 90-94, 1995 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@nyu.edu)
-
-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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "recog.h"
-#include "expr.h"
-#include "obstack.h"
-#include "tree.h"
-#include "reload.h"
-
-#define min(A,B) ((A) < (B) ? (A) : (B))
-
-/* This gives the size in words of the register stack for the current
- procedure. */
-
-static int a29k_regstack_size;
-
-/* True if the current procedure has a call instruction. */
-
-static int a29k_makes_calls;
-
-/* This points to the last insn of the insn prologue. It is set when
- an insn without a filled delay slot is found near the start of the
- function. */
-
-static char *a29k_last_prologue_insn;
-
-/* This points to the first insn that will be in the epilogue. It is null if
- no epilogue is required. */
-
-static char *a29k_first_epilogue_insn;
-
-/* This is nonzero if a a29k_first_epilogue_insn was put in a delay slot. It
- indicates that an intermediate label needs to be written. */
-
-static int a29k_first_epilogue_insn_used;
-
-/* Location to hold the name of the current function. We need this prolog to
- contain the tag words prior to the declaration. So the name must be stored
- away. */
-
-char *a29k_function_name;
-
-/* Mapping of registers to debug register numbers. The only change is
- for the frame pointer and the register numbers used for the incoming
- arguments. */
-
-int a29k_debug_reg_map[FIRST_PSEUDO_REGISTER];
-
-/* Save information from a "cmpxx" operation until the branch or scc is
- emitted. */
-
-rtx a29k_compare_op0, a29k_compare_op1;
-int a29k_compare_fp_p;
-
-/* Gives names for registers. */
-extern char *reg_names[];
-
-/* Returns 1 if OP is a 8-bit constant. */
-
-int
-cint_8_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == CONST_INT && (INTVAL (op) & 0xffffff00) == 0;
-}
-
-/* Returns 1 if OP is a 16-bit constant. */
-
-int
-cint_16_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == CONST_INT && (INTVAL (op) & 0xffff0000) == 0;
-}
-
-/* Returns 1 if OP is a constant that cannot be moved in a single insn. */
-
-int
-long_const_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (! CONSTANT_P (op))
- return 0;
-
- if (TARGET_29050 && GET_CODE (op) == CONST_INT
- && (INTVAL (op) & 0xffff) == 0)
- return 0;
-
- return (GET_CODE (op) != CONST_INT
- || ((INTVAL (op) & 0xffff0000) != 0
- && (INTVAL (op) & 0xffff0000) != 0xffff0000
- && INTVAL (op) != 0x80000000));
-}
-
-/* The following four functions detect constants of 0, 8, 16, and 24 used as
- a position in ZERO_EXTRACT operations. They can either be the appropriate
- constant integer or a shift (which will be produced by combine). */
-
-static int
-shift_constant_operand (op, mode, val)
- rtx op;
- enum machine_mode mode;
- int val;
-{
- return ((GET_CODE (op) == CONST_INT && INTVAL (op) == val)
- || (GET_CODE (op) == ASHIFT
- && GET_CODE (XEXP (op, 0)) == CONST_INT
- && INTVAL (XEXP (op, 0)) == val / 8
- && GET_CODE (XEXP (op, 1)) == CONST_INT
- && INTVAL (XEXP (op, 1)) == 3));
-}
-
-int
-const_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return shift_constant_operand (op, mode, 0);
-}
-
-int
-const_8_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return shift_constant_operand (op, mode, 8);
-}
-
-int
-const_16_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return shift_constant_operand (op, mode, 16);
-}
-
-int
-const_24_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return shift_constant_operand (op, mode, 24);
-}
-
-/* Returns 1 if OP is a floating-point constant of the proper mode. */
-
-int
-float_const_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == mode;
-}
-
-/* Returns 1 if OP is a floating-point constant of the proper mode or a
- general-purpose register. */
-
-int
-gpc_reg_or_float_constant_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return float_const_operand (op, mode) || gpc_reg_operand (op, mode);
-}
-
-/* Returns 1 if OP is an integer constant of the proper mode or a
- general-purpose register. */
-
-int
-gpc_reg_or_integer_constant_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ((GET_MODE (op) == VOIDmode
- && (GET_CODE (op) == CONST_INT || GET_CODE (op) == CONST_DOUBLE))
- || gpc_reg_operand (op, mode));
-}
-
-/* Returns 1 if OP is a special machine register. */
-
-int
-spec_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != REG || GET_MODE (op) != mode)
- return 0;
-
- switch (GET_MODE_CLASS (mode))
- {
- case MODE_PARTIAL_INT:
- return REGNO (op) >= R_BP && REGNO (op) <= R_CR;
- case MODE_INT:
- return REGNO (op) >= R_Q && REGNO (op) <= R_EXO;
- default:
- return 0;
- }
-}
-
-/* Returns 1 if OP is an accumulator register. */
-
-int
-accum_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == REG
- && REGNO (op) >= R_ACU (0) && REGNO (op) <= R_ACU (3));
-}
-
-/* Returns 1 if OP is a normal data register. */
-
-int
-gpc_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int regno;
-
- if (GET_MODE (op) != mode && mode != VOIDmode)
- return 0;
-
- if (GET_CODE (op) == REG)
- regno = REGNO (op);
- else if (GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == REG)
- {
- regno = REGNO (SUBREG_REG (op));
- if (regno < FIRST_PSEUDO_REGISTER)
- regno += SUBREG_WORD (op);
- }
- else
- return 0;
-
- return (regno >= FIRST_PSEUDO_REGISTER || regno < R_BP
- || (regno >= R_KR (0) && regno <= R_KR (31)));
-}
-
-/* Returns 1 if OP is either an 8-bit constant integer or a general register.
- If a register, it must be in the proper mode unless MODE is VOIDmode. */
-
-int
-srcb_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT
- && (mode == QImode
- || (INTVAL (op) & 0xffffff00) == 0))
- return 1;
-
- if (GET_MODE (op) != mode && mode != VOIDmode)
- return 0;
-
- return gpc_reg_operand (op, mode);
-}
-
-int
-cmplsrcb_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT
- && (mode == QImode
- || (INTVAL (op) & 0xffffff00) == 0xffffff00))
- return 1;
-
- if (GET_MODE (op) != mode && mode != VOIDmode)
- return 0;
-
- return gpc_reg_operand (op, mode);
-}
-
-/* Return 1 if OP is either an immediate or a general register. This is used
- for the input operand of mtsr/mtrsim. */
-
-int
-gpc_reg_or_immediate_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return gpc_reg_operand (op, mode) || immediate_operand (op, mode);
-}
-
-/* Return 1 if OP can be used as the second operand of and AND insn. This
- includes srcb_operand and a constant whose complement fits in 8 bits. */
-
-int
-and_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (srcb_operand (op, mode)
- || (GET_CODE (op) == CONST_INT
- && ((unsigned) ((~ INTVAL (op)) & GET_MODE_MASK (mode)) < 256)));
-}
-
-/* Return 1 if OP can be used as the second operand of an ADD insn.
- This is the same as above, except we use negative, rather than
- complement. */
-
-int
-add_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (srcb_operand (op, mode)
- || (GET_CODE (op) == CONST_INT
- && ((unsigned) ((- INTVAL (op)) & GET_MODE_MASK (mode)) < 256)));
-}
-
-/* Return 1 if OP is a valid address in a CALL_INSN. These are a SYMBOL_REF
- to the current function, all SYMBOL_REFs if TARGET_SMALL_MEMORY, or
- a sufficiently-small constant. */
-
-int
-call_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- return (TARGET_SMALL_MEMORY
- || (! TARGET_LARGE_MEMORY
- && ((GET_CODE (op) == SYMBOL_REF && SYMBOL_REF_FLAG (op))
- || ! strcmp (XSTR (op, 0), current_function_name))));
-
- case CONST_INT:
- return (unsigned HOST_WIDE_INT) INTVAL (op) < 0x40000;
-
- default:
- return 0;
- }
-}
-
-/* Return 1 if OP can be used as the input operand for a move insn. */
-
-int
-in_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- rtx orig_op = op;
-
- if (! general_operand (op, mode))
- return 0;
-
- while (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
-
- switch (GET_CODE (op))
- {
- case REG:
- return 1;
-
- case MEM:
- return (GET_MODE_SIZE (mode) >= UNITS_PER_WORD || TARGET_DW_ENABLE);
-
- case CONST_INT:
- if (GET_MODE_CLASS (mode) != MODE_INT
- && GET_MODE_CLASS (mode) != MODE_PARTIAL_INT)
- return 0;
-
- return 1;
-
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- return (GET_MODE (op) == mode
- || mode == SImode || mode == HImode || mode == QImode);
-
- case CONST_DOUBLE:
- return ((GET_MODE_CLASS (mode) == MODE_FLOAT
- && mode == GET_MODE (op))
- || (GET_MODE (op) == VOIDmode
- && GET_MODE_CLASS (mode) == MODE_INT));
-
- default:
- return 0;
- }
-}
-
-/* Return 1 if OP can be used as the output operand for a move insn. */
-
-int
-out_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- rtx orig_op = op;
-
- if (! general_operand (op, mode))
- return 0;
-
- while (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
-
- if (GET_CODE (op) == REG)
- return (gpc_reg_operand (orig_op, mode)
- || spec_reg_operand (orig_op, mode)
- || (GET_MODE_CLASS (mode) == MODE_FLOAT
- && accum_reg_operand (orig_op, mode)));
-
- else if (GET_CODE (op) == MEM)
- return (GET_MODE_SIZE (mode) >= UNITS_PER_WORD || TARGET_DW_ENABLE);
- else
- return 0;
-}
-
-/* Return 1 if OP is an item in memory, given that we are in reload. */
-
-int
-reload_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int regno = true_regnum (op);
-
- return (! CONSTANT_P (op)
- && (regno == -1
- || (GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER)));
-}
-
-/* Given an object for which reload_memory_operand is true, return the address
- of the operand, taking into account anything that reload may do. */
-
-rtx
-a29k_get_reloaded_address (op)
- rtx op;
-{
- if (GET_CODE (op) == SUBREG)
- {
- if (SUBREG_WORD (op) != 0)
- abort ();
-
- op = SUBREG_REG (op);
- }
-
- if (GET_CODE (op) == REG)
- op = reg_equiv_mem[REGNO (op)];
-
- return find_replacement (&XEXP (op, 0));
-}
-
-/* Subfunction of the following function. Update the flags of any MEM
- found in part of X. */
-
-static void
-a29k_set_memflags_1 (x, in_struct_p, volatile_p, unchanging_p)
- rtx x;
- int in_struct_p, volatile_p, unchanging_p;
-{
- int i;
-
- switch (GET_CODE (x))
- {
- case SEQUENCE:
- case PARALLEL:
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- a29k_set_memflags_1 (XVECEXP (x, 0, i), in_struct_p, volatile_p,
- unchanging_p);
- break;
-
- case INSN:
- a29k_set_memflags_1 (PATTERN (x), in_struct_p, volatile_p,
- unchanging_p);
- break;
-
- case SET:
- a29k_set_memflags_1 (SET_DEST (x), in_struct_p, volatile_p,
- unchanging_p);
- a29k_set_memflags_1 (SET_SRC (x), in_struct_p, volatile_p, unchanging_p);
- break;
-
- case MEM:
- MEM_IN_STRUCT_P (x) = in_struct_p;
- MEM_VOLATILE_P (x) = volatile_p;
- RTX_UNCHANGING_P (x) = unchanging_p;
- break;
- }
-}
-
-/* Given INSN, which is either an INSN or a SEQUENCE generated to
- perform a memory operation, look for any MEMs in either a SET_DEST or
- a SET_SRC and copy the in-struct, unchanging, and volatile flags from
- REF into each of the MEMs found. If REF is not a MEM, don't do
- anything. */
-
-void
-a29k_set_memflags (insn, ref)
- rtx insn;
- rtx ref;
-{
- /* Note that it is always safe to get these flags, though they won't
- be what we think if REF is not a MEM. */
- int in_struct_p = MEM_IN_STRUCT_P (ref);
- int volatile_p = MEM_VOLATILE_P (ref);
- int unchanging_p = RTX_UNCHANGING_P (ref);
-
- if (GET_CODE (ref) != MEM
- || (! in_struct_p && ! volatile_p && ! unchanging_p))
- return;
-
- a29k_set_memflags_1 (insn, in_struct_p, volatile_p, unchanging_p);
-}
-
-/* Return 1 if OP is a comparison operator that we have in floating-point. */
-
-int
-fp_comparison_operator (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ((mode == VOIDmode || mode == GET_MODE (op))
- && (GET_CODE (op) == EQ || GET_CODE (op) == GT ||
- GET_CODE (op) == GE));
-}
-
-/* Return 1 if OP is a valid branch comparison. */
-
-int
-branch_operator (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ((mode == VOIDmode || mode == GET_MODE (op))
- && (GET_CODE (op) == GE || GET_CODE (op) == LT));
-}
-
-/* Return 1 if OP is a load multiple operation. It is known to be a
- PARALLEL and the first three sections will be tested. */
-
-int
-load_multiple_operation (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int count = XVECLEN (op, 0) - 2;
- int dest_regno;
- rtx src_addr;
- int i;
-
- /* Perform a quick check so we don't blow up below. */
- if (count <= 1
- || GET_CODE (XVECEXP (op, 0, 0)) != SET
- || GET_CODE (SET_DEST (XVECEXP (op, 0, 0))) != REG
- || GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != MEM)
- return 0;
-
- dest_regno = REGNO (SET_DEST (XVECEXP (op, 0, 0)));
- src_addr = XEXP (SET_SRC (XVECEXP (op, 0, 0)), 0);
-
- for (i = 1; i < count; i++)
- {
- rtx elt = XVECEXP (op, 0, i + 2);
-
- if (GET_CODE (elt) != SET
- || GET_CODE (SET_DEST (elt)) != REG
- || GET_MODE (SET_DEST (elt)) != SImode
- || REGNO (SET_DEST (elt)) != dest_regno + i
- || GET_CODE (SET_SRC (elt)) != MEM
- || GET_MODE (SET_SRC (elt)) != SImode
- || GET_CODE (XEXP (SET_SRC (elt), 0)) != PLUS
- || ! rtx_equal_p (XEXP (XEXP (SET_SRC (elt), 0), 0), src_addr)
- || GET_CODE (XEXP (XEXP (SET_SRC (elt), 0), 1)) != CONST_INT
- || INTVAL (XEXP (XEXP (SET_SRC (elt), 0), 1)) != i * 4)
- return 0;
- }
-
- return 1;
-}
-
-/* Similar, but tests for store multiple. */
-
-int
-store_multiple_operation (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int num_special = TARGET_NO_STOREM_BUG ? 2 : 1;
- int count = XVECLEN (op, 0) - num_special;
- int src_regno;
- rtx dest_addr;
- int i;
-
- /* Perform a quick check so we don't blow up below. */
- if (count <= 1
- || GET_CODE (XVECEXP (op, 0, 0)) != SET
- || GET_CODE (SET_DEST (XVECEXP (op, 0, 0))) != MEM
- || GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != REG)
- return 0;
-
- src_regno = REGNO (SET_SRC (XVECEXP (op, 0, 0)));
- dest_addr = XEXP (SET_DEST (XVECEXP (op, 0, 0)), 0);
-
- for (i = 1; i < count; i++)
- {
- rtx elt = XVECEXP (op, 0, i + num_special);
-
- if (GET_CODE (elt) != SET
- || GET_CODE (SET_SRC (elt)) != REG
- || GET_MODE (SET_SRC (elt)) != SImode
- || REGNO (SET_SRC (elt)) != src_regno + i
- || GET_CODE (SET_DEST (elt)) != MEM
- || GET_MODE (SET_DEST (elt)) != SImode
- || GET_CODE (XEXP (SET_DEST (elt), 0)) != PLUS
- || ! rtx_equal_p (XEXP (XEXP (SET_DEST (elt), 0), 0), dest_addr)
- || GET_CODE (XEXP (XEXP (SET_DEST (elt), 0), 1)) != CONST_INT
- || INTVAL (XEXP (XEXP (SET_DEST (elt), 0), 1)) != i * 4)
- return 0;
- }
-
- return 1;
-}
-
-/* Given a special register REG and MASK, a value being masked against a
- quantity to which the special register is set, return 1 if the masking
- operation is built-in to the setting of that special register. */
-
-int
-masks_bits_for_special (reg, mask)
- rtx reg;
- rtx mask;
-{
- int needed_mask_value;
-
- if (GET_CODE (reg) != REG || GET_CODE (mask) != CONST_INT)
- abort ();
-
- switch (REGNO (reg))
- {
- case R_BP:
- case R_INT:
- needed_mask_value = 3;
- break;
-
- case R_FC:
- needed_mask_value = 31;
- break;
-
- case R_CR:
- case R_LRU:
- needed_mask_value = 255;
- break;
-
- case R_FPE:
- needed_mask_value = 511;
- break;
-
- case R_MMU:
- needed_mask_value = 0x3ff;
- break;
-
- case R_OPS:
- case R_CPS:
- case R_RBP:
- case R_FPS:
- needed_mask_value = 0xffff;
- break;
-
- case R_VAB:
- needed_mask_value = 0xffff0000;
- break;
-
- case R_Q:
- case R_CFG:
- case R_CHA:
- case R_CHD:
- case R_CHC:
- case R_TMC:
- case R_TMR:
- case R_PC0:
- case R_PC1:
- case R_PC2:
- return 0;
-
- default:
- abort ();
- }
-
- return (INTVAL (mask) & ~ needed_mask_value) == 0;
-}
-
-/* Return nonzero if this label is that of the return point, but there is
- a non-null epilogue. */
-
-int
-epilogue_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return next_active_insn (op) == 0 && a29k_first_epilogue_insn != 0;
-}
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
- NO_REGS is returned. */
-
-enum reg_class
-secondary_reload_class (class, mode, in)
- enum reg_class class;
- enum machine_mode mode;
- rtx in;
-{
- int regno = -1;
- enum rtx_code code = GET_CODE (in);
-
- if (! CONSTANT_P (in))
- {
- regno = true_regnum (in);
-
- /* A pseudo is the same as memory. */
- if (regno == -1 || regno >= FIRST_PSEUDO_REGISTER)
- code = MEM;
- }
-
- /* If we are transferring between memory and a multi-word mode, we need
- CR. */
-
- if (code == MEM && GET_MODE_SIZE (mode) > UNITS_PER_WORD)
- return CR_REGS;
-
- /* If between memory and a mode smaller than a word without DW being
- enabled, we need BP. */
-
- if (code == MEM && ! TARGET_DW_ENABLE
- && GET_MODE_SIZE (mode) < UNITS_PER_WORD)
- return BP_REGS;
-
- /* Otherwise, we can place anything into GENERAL_REGS and can put
- GENERAL_REGS into anything. */
- if (class == GENERAL_REGS
- || (regno != -1
- && (regno < R_BP
- || (regno >= R_KR (0) && regno <= R_KR (31)))))
- return NO_REGS;
-
- /* We can place 16-bit constants into a special register. */
- if (code == CONST_INT
- && (GET_MODE_BITSIZE (mode) <= 16 || (unsigned) INTVAL (in) <= 65535)
- && (class == BP_REGS || class == Q_REGS || class == SPECIAL_REGS))
- return NO_REGS;
-
- /* Otherwise, we need GENERAL_REGS. */
- return GENERAL_REGS;
-}
-
-/* START is the zero-based incoming argument register index used (0 is 160,
- i.e., the first incoming argument register) and COUNT is the number used.
-
- Mark the corresponding incoming registers as neither fixed nor call used.
- For each register used for incoming arguments, we have one less local
- register that can be used. So also mark some high-numbered registers as
- fixed.
-
- Return the first register number to use for the argument. */
-
-int
-incoming_reg (start, count)
- int start;
- int count;
-{
- int i;
-
- /* We only use 16 argument registers, so truncate at the end of the
- area. */
- if (start + count > 16)
- count = 16 - start;
-
- if (! TARGET_NO_REUSE_ARGS)
- /* Mark all the used registers as not fixed and saved over calls. */
- for (i = R_AR (start); i < R_AR (start + count); i++)
- {
- fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 0;
- CLEAR_HARD_REG_BIT (fixed_reg_set, i);
- CLEAR_HARD_REG_BIT (call_used_reg_set, i);
- CLEAR_HARD_REG_BIT (call_fixed_reg_set, i);
- }
-
- /* Shorten the maximum size of the frame.
- Remember that R_AR(-1,-2) are place holders for the caller's lr0,lr1.
- Make sure to keep the frame rounded to an even boundary. Rounding up
- to an 8 byte boundary will use a slot. Otherwise a frame with 121 local
- regs and 5 arguments will overrun the stack (121+1 + 5 + 2 > 128). */
- /* ??? An alternative would be to never allocate one reg. */
- for (i = (R_AR (0) - 2 - start - count) & ~1; i < R_AR (0) - 2 - start; i++)
- {
- fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 1;
- SET_HARD_REG_BIT (fixed_reg_set, i);
- SET_HARD_REG_BIT (call_used_reg_set, i);
- SET_HARD_REG_BIT (call_fixed_reg_set, i);
- }
-
- return R_AR (start);
-}
-
-/* Add CLOBBERs to CALL_INSN_FUNCTION_USAGE chain of INSN indicating
- that LR2 up to, but not including, OP are clobbered. If OP is
- zero, indicate all parameter registers are clobbered. */
-
-void
-a29k_clobbers_to (insn, op)
- rtx insn;
- rtx op;
-{
- int i;
- int high_regno;
-
- if (op == 0)
- high_regno = R_LR (18);
- else if (GET_CODE (op) != REG || REGNO (op) < R_LR (0)
- || REGNO (op) > R_LR (18))
- abort ();
- else
- high_regno = REGNO (op);
-
- for (i = R_LR (2); i < high_regno; i++)
- CALL_INSN_FUNCTION_USAGE (insn)
- = gen_rtx (EXPR_LIST, VOIDmode,
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (REG, SImode, i)),
- CALL_INSN_FUNCTION_USAGE (insn));
-}
-
-/* These routines are used in finding insns to fill delay slots in the
- epilogue. */
-
-/* Return 1 if the current function will adjust the register stack. */
-
-int
-needs_regstack_p ()
-{
- int i;
- rtx insn;
-
- if (frame_pointer_needed)
- return 1;
-
- /* If any local register is used, we need to adjust the regstack. */
- for (i = R_LR (127); i >= R_LR (0); i --)
- if (regs_ever_live[i])
- return 1;
-
- /* We need a register stack if we make any calls. */
- for (insn = get_insns (); insn; insn = next_insn (insn))
- if (GET_CODE (insn) == CALL_INSN
- || (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SEQUENCE
- && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == CALL_INSN))
- return 1;
-
- /* Otherwise, we don't. */
- return 0;
-}
-
-/* Return 1 if X uses a local register. */
-
-int
-uses_local_reg_p (x)
- rtx x;
-{
- char *fmt;
- int i, j;
-
- switch (GET_CODE (x))
- {
- case REG:
- return REGNO (x) >= R_LR (0) && REGNO (x) <= R_FP;
-
- case CONST_INT:
- case CONST:
- case PC:
- case CC0:
- case LABEL_REF:
- case SYMBOL_REF:
- return 0;
- }
-
- fmt = GET_RTX_FORMAT (GET_CODE (x));
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- if (uses_local_reg_p (XEXP (x, i)))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (uses_local_reg_p (XVECEXP (x, i, j)))
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Returns 1 if this function is known to have a null epilogue. */
-
-int
-null_epilogue ()
-{
- return (reload_completed && ! needs_regstack_p ()
- && get_frame_size () == 0
- && current_function_pretend_args_size == 0);
-}
-
-/* Write out the assembler form of an operand. Recognize the following
- special options:
-
- %N means write the low-order 8 bits of the negative of the constant
- %Q means write a QImode operand (truncate constants to 8 bits)
- %M means write the low-order 16 bits of the constant
- %m means write the low-order 16 bits shifted left 16 bits
- %C means write the low-order 8 bits of the complement of the constant
- %b means write `f' is this is a reversed condition, `t' otherwise
- %B means write `t' is this is a reversed condition, `f' otherwise
- %J means write the 29k opcode part for a comparison operation
- %e means write the label with an extra `X' is this is the epilogue
- otherwise the normal label name
- %E means write nothing if this insn has a delay slot,
- a nop unless this is the epilogue label, in which case
- write the first epilogue insn
- %F means write just the normal operand if the insn has a delay slot;
- otherwise, this is a recursive call so output the
- symbol + 4 and write the first prologue insn in the
- delay slot.
- %L means write the register number plus one ("low order" register)
- or the low-order part of a multi-word constant
- %O means write the register number plus two
- %P means write the register number plus three ("low order" of TImode)
- %S means write the number of words in the mode of the operand,
- minus one (for CR)
- %V means write the number of elements in a PARALLEL minus 1
- %# means write nothing if we have a delay slot, "\n\tnop" otherwise
- %* means write the register name for TPC. */
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- char code;
-{
- char buf[100];
-
- /* These macros test for integers and extract the low-order bits. */
-#define INT_P(X) \
-((GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE) \
- && GET_MODE (X) == VOIDmode)
-
-#define INT_LOWPART(X) \
- (GET_CODE (X) == CONST_INT ? INTVAL (X) : CONST_DOUBLE_LOW (X))
-
- switch (code)
- {
- case 'Q':
- if (GET_CODE (x) == REG)
- break;
- else if (! INT_P (x))
- output_operand_lossage ("invalid %%Q value");
- fprintf (file, "%d", INT_LOWPART (x) & 0xff);
- return;
-
- case 'C':
- if (! INT_P (x))
- output_operand_lossage ("invalid %%C value");
- fprintf (file, "%d", (~ INT_LOWPART (x)) & 0xff);
- return;
-
- case 'N':
- if (! INT_P (x))
- output_operand_lossage ("invalid %%N value");
- fprintf (file, "%d", (- INT_LOWPART (x)) & 0xff);
- return;
-
- case 'M':
- if (! INT_P (x))
- output_operand_lossage ("invalid %%M value");
- fprintf (file, "%d", INT_LOWPART (x) & 0xffff);
- return;
-
- case 'm':
- if (! INT_P (x))
- output_operand_lossage ("invalid %%m value");
- fprintf (file, "%d", (INT_LOWPART (x) & 0xffff) << 16);
- return;
-
- case 'b':
- if (GET_CODE (x) == GE)
- fprintf (file, "f");
- else
- fprintf (file, "t");
- return;
-
- case 'B':
- if (GET_CODE (x) == GE)
- fprintf (file, "t");
- else
- fprintf (file, "f");
- return;
-
- case 'J':
- /* It so happens that the RTX names for the conditions are the same as
- the 29k's insns except for "ne", which requires "neq". */
- fprintf (file, GET_RTX_NAME (GET_CODE (x)));
- if (GET_CODE (x) == NE)
- fprintf (file, "q");
- return;
-
- case 'e':
- if (optimize && flag_delayed_branch
- && a29k_last_prologue_insn == 0 && epilogue_operand (x, VOIDmode)
- && dbr_sequence_length () == 0)
- {
- /* We need to output the label number of the last label in the
- function, which is not necessarily X since there might be
- a USE insn in between. First go forward to the last insn, then
- back up to a label. */
- while (NEXT_INSN (x) != 0)
- x = NEXT_INSN (x);
-
- while (GET_CODE (x) != CODE_LABEL)
- x = PREV_INSN (x);
-
- ASM_GENERATE_INTERNAL_LABEL (buf, "LX", CODE_LABEL_NUMBER (x));
- assemble_name (file, buf);
- }
- else
- output_asm_label (x);
- return;
-
- case 'E':
- if (dbr_sequence_length ())
- ;
- else if (a29k_last_prologue_insn)
- {
- fprintf (file, "\n\t%s", a29k_last_prologue_insn);
- a29k_last_prologue_insn = 0;
- }
- else if (optimize && flag_delayed_branch
- && epilogue_operand (x, VOIDmode))
- {
- fprintf (file, "\n\t%s", a29k_first_epilogue_insn);
- a29k_first_epilogue_insn_used = 1;
- }
- else
- fprintf (file, "\n\tnop");
- return;
-
- case 'F':
- output_addr_const (file, x);
- if (dbr_sequence_length () == 0)
- {
- /* If this doesn't have its delay slot filled, see if we need to
- put the last insn of the prolog in it. If not, see if this is
- a recursive call. If so, we can put the first insn of its
- prolog in the delay slot. Otherwise, write a nop. */
- if (a29k_last_prologue_insn)
- {
- fprintf (file, "\n\t%s", a29k_last_prologue_insn);
- a29k_last_prologue_insn = 0;
- }
- else if (GET_CODE (x) == SYMBOL_REF
- && ! strcmp (XSTR (x, 0), current_function_name))
- fprintf (file, "+4\n\t%s,%d",
- a29k_regstack_size >= 64 ? "const gr121" : "sub gr1,gr1",
- a29k_regstack_size * 4);
- else
- fprintf (file, "\n\tnop");
- }
- return;
-
- case 'L':
- if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == DFmode)
- {
- union real_extract u;
-
- bcopy ((char *) &CONST_DOUBLE_LOW (x), (char *) &u, sizeof u);
- fprintf (file, "$double1(%.20e)", u.d);
- }
- else if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x) + 1]);
- else
- output_operand_lossage ("invalid %%L value");
- return;
-
- case 'O':
- if (GET_CODE (x) != REG)
- output_operand_lossage ("invalid %%O value");
- fprintf (file, "%s", reg_names[REGNO (x) + 2]);
- return;
-
- case 'P':
- if (GET_CODE (x) != REG)
- output_operand_lossage ("invalid %%P value");
- fprintf (file, "%s", reg_names[REGNO (x) + 3]);
- return;
-
- case 'S':
- fprintf (file, "%d", (GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD)-1);
- return;
-
- case 'V':
- if (GET_CODE (x) != PARALLEL)
- output_operand_lossage ("invalid %%V value");
- fprintf (file, "%d", XVECLEN (x, 0) - 2);
- return;
-
- case '#':
- if (dbr_sequence_length () == 0)
- {
- if (a29k_last_prologue_insn)
- {
- fprintf (file, "\n\t%s", a29k_last_prologue_insn);
- a29k_last_prologue_insn = 0;
- }
- else
- fprintf (file, "\n\tnop");
- }
- return;
-
- case '*':
- fprintf (file, "%s", reg_names [R_TPC]);
- return;
- }
-
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names [REGNO (x)]);
-
- else if (GET_CODE (x) == MEM)
- output_address (XEXP (x, 0));
-
- else if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_CODE (SUBREG_REG (XEXP (x, 0))) == CONST_DOUBLE)
- {
- union real_extract u;
-
- if (GET_MODE (SUBREG_REG (XEXP (x, 0))) == SFmode)
- fprintf (file, "$float");
- else
- fprintf (file, "$double%d", SUBREG_WORD (XEXP (x, 0)));
- bcopy ((char *) &CONST_DOUBLE_LOW (SUBREG_REG (XEXP (x, 0))),
- (char *) &u, sizeof u);
- fprintf (file, "(%.20e)", u.d);
- }
-
- else if (GET_CODE (x) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- {
- union real_extract u;
-
- bcopy ((char *) &CONST_DOUBLE_LOW (x), (char *) &u, sizeof u);
- fprintf (file, "$%s(%.20e)",
- GET_MODE (x) == SFmode ? "float" : "double0", u.d);
- }
-
- else
- output_addr_const (file, x);
-}
-
-/* This page contains routines to output function prolog and epilog code. */
-
-/* Compute the size of the register stack, and determine if there are any
- call instructions. */
-
-static void
-compute_regstack_size ()
-{
- int i;
- rtx insn;
-
- /* See if we make any calls. We need to set lr1 if so. */
- a29k_makes_calls = 0;
- for (insn = get_insns (); insn; insn = next_insn (insn))
- if (GET_CODE (insn) == CALL_INSN
- || (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SEQUENCE
- && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == CALL_INSN))
- {
- a29k_makes_calls = 1;
- break;
- }
-
- /* Find the highest local register used. */
- for (i = R_LR (127); i >= R_LR (0); i--)
- if (regs_ever_live[i])
- break;
-
- a29k_regstack_size = i - (R_LR (0) - 1);
-
- /* If calling routines, ensure we count lr0 & lr1. */
- if (a29k_makes_calls && a29k_regstack_size < 2)
- a29k_regstack_size = 2;
-
- /* Count frame pointer and align to 8 byte boundary (even number of
- registers). */
- a29k_regstack_size += frame_pointer_needed;
- if (a29k_regstack_size & 1) a29k_regstack_size++;
-}
-
-/* Sets register names for incoming arguments and frame pointer.
- This can't be computed until after register allocation. */
-
-void
-a29k_compute_reg_names ()
-{
- int i;
-
- compute_regstack_size ();
-
- /* Set the names and numbers of the frame pointer and incoming argument
- registers. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- a29k_debug_reg_map[i] = i;
-
- reg_names[FRAME_POINTER_REGNUM] = reg_names[R_LR (a29k_regstack_size - 1)];
- a29k_debug_reg_map[FRAME_POINTER_REGNUM] = R_LR (a29k_regstack_size - 1);
-
- for (i = 0; i < 16; i++)
- {
- reg_names[R_AR (i)] = reg_names[R_LR (a29k_regstack_size + i + 2)];
- a29k_debug_reg_map[R_AR (i)] = R_LR (a29k_regstack_size + i + 2);
- }
-
- /* If using kernel register map, swap numbers for kernel and user
- registers. */
- if (TARGET_KERNEL_REGISTERS)
- for (i = 0; i < 32; i++)
- {
- int tem = a29k_debug_reg_map[i];
- a29k_debug_reg_map[i] = a29k_debug_reg_map[R_KR (i)];
- a29k_debug_reg_map[R_KR (i)] = tem;
- }
-}
-
-/* Output function prolog code to file FILE. Memory stack size is SIZE. */
-
-void
-output_prolog (file, size)
- FILE *file;
- int size;
-{
- int i;
- int arg_count = 0;
- rtx insn;
- unsigned int tag_word;
-
- /* See how many incoming arguments we have in registers. */
- for (i = R_AR (0); i < R_AR (16); i++)
- if (! fixed_regs[i])
- arg_count++;
-
- /* The argument count includes the caller's lr0 and lr1. */
- arg_count += 2;
-
- /* Compute memory stack size. Add in number of bytes that the we should
- push and pretend the caller did and the size of outgoing arguments.
- Then round to a doubleword boundary. */
- size += (current_function_pretend_args_size
- + current_function_outgoing_args_size);
- size = (size + 7) & ~7;
-
- /* Write header words. See if one or two word form. */
- tag_word = (frame_pointer_needed ? 0x400000 : 0) + (arg_count << 16);
-
- if (size / 8 > 0xff)
- fprintf (file, "\t.word %d, 0x%0x\n", (size / 8) << 2,
- 0x800000 + tag_word);
- else
- fprintf (file, "\t.word 0x%0x\n", tag_word + ((size / 8) << 3));
-
- /* Define the function name. */
- assemble_name (file, a29k_function_name);
- fprintf (file, ":\n");
-
- /* Push the register stack by the proper amount. There are two possible
- ways to do this. */
- if (a29k_regstack_size >= 256/4)
- fprintf (file, "\tconst %s,%d\n\tsub gr1,gr1,%s\n",
- reg_names[R_TAV], a29k_regstack_size * 4, reg_names[R_TAV]);
- else if (a29k_regstack_size)
- fprintf (file, "\tsub gr1,gr1,%d\n", a29k_regstack_size * 4);
-
- /* Test that the registers are available. */
- if (a29k_regstack_size)
- fprintf (file, "\tasgeu V_%sSPILL,gr1,%s\n",
- TARGET_KERNEL_REGISTERS ? "K" : "", reg_names[R_RAB]);
-
- /* Set up frame pointer, if one is needed. */
- if (frame_pointer_needed)
- fprintf (file, "\tsll %s,%s,0\n", reg_names[FRAME_POINTER_REGNUM],
- reg_names[R_MSP]);
-
- /* Make room for any frame space. There are three ways to do this. */
- if (size >= 256)
- {
- fprintf (file, "\tconst %s,%d\n", reg_names[R_TAV], size);
- if (size >= 65536)
- fprintf (file, "\tconsth %s,%d\n", reg_names[R_TAV], size);
- if (TARGET_STACK_CHECK)
- fprintf (file, "\tcall %s,__msp_check\n", reg_names[R_TPC]);
- fprintf (file, "\tsub %s,%s,%s\n",
- reg_names[R_MSP], reg_names[R_MSP], reg_names[R_TAV]);
- }
- else if (size)
- {
- if (TARGET_STACK_CHECK)
- fprintf (file, "\tcall %s,__msp_check\n", reg_names[R_TPC]);
- fprintf (file, "\tsub %s,%s,%d\n",
- reg_names[R_MSP], reg_names[R_MSP], size);
- }
-
- /* If this routine will make calls, set lr1. If we see an insn that
- can use a delay slot before a call or jump, save this insn for that
- slot (this condition is equivalent to seeing if we have an insn that
- needs delay slots before an insn that has a filled delay slot). */
- a29k_last_prologue_insn = 0;
- if (a29k_makes_calls)
- {
- i = (a29k_regstack_size + arg_count) * 4;
- if (i >= 256)
- fprintf (file, "\tconst %s,%d\n\tadd lr1,gr1,%s\n",
- reg_names[R_TAV], i, reg_names[R_TAV]);
- else
- {
- if (optimize && flag_delayed_branch)
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL
- || (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SEQUENCE))
- break;
-
- if (GET_CODE (insn) == NOTE
- || (GET_CODE (insn) == INSN
- && (GET_CODE (PATTERN (insn)) == USE
- || GET_CODE (PATTERN (insn)) == CLOBBER)))
- continue;
-
- if (num_delay_slots (insn) > 0)
- {
- a29k_last_prologue_insn = (char *) oballoc (100);
- sprintf (a29k_last_prologue_insn, "add lr1,gr1,%d", i);
- break;
- }
- }
-
- if (a29k_last_prologue_insn == 0)
- fprintf (file, "\tadd lr1,gr1,%d\n", i);
- }
- }
-
- /* Compute the first insn of the epilogue. */
- a29k_first_epilogue_insn_used = 0;
-
- if (size == 0 && a29k_regstack_size == 0 && ! frame_pointer_needed)
- a29k_first_epilogue_insn = 0;
- else
- a29k_first_epilogue_insn = (char *) oballoc (100);
-
- if (frame_pointer_needed)
- sprintf (a29k_first_epilogue_insn, "sll %s,%s,0",
- reg_names[R_MSP], reg_names[FRAME_POINTER_REGNUM]);
- else if (a29k_regstack_size)
- {
- if (a29k_regstack_size >= 256 / 4)
- sprintf (a29k_first_epilogue_insn, "const %s,%d",
- reg_names[R_TAV], a29k_regstack_size * 4);
- else
- sprintf (a29k_first_epilogue_insn, "add gr1,gr1,%d",
- a29k_regstack_size * 4);
- }
- else if (size)
- {
- if (size >= 256)
- sprintf (a29k_first_epilogue_insn, "const %s,%d",
- reg_names[R_TAV], size);
- else
- sprintf (a29k_first_epilogue_insn, "add %s,%s,%d",
- reg_names[R_MSP], reg_names[R_MSP], size);
- }
-}
-
-/* Call this after writing what might be the first instruction of the
- epilogue. If that first insn was used in a delay slot, an intermediate
- label is written. */
-
-static void
-check_epilogue_internal_label (file)
- FILE *file;
-{
- rtx insn;
-
- if (! a29k_first_epilogue_insn_used)
- return;
-
- for (insn = get_last_insn ();
- GET_CODE (insn) != CODE_LABEL;
- insn = PREV_INSN (insn))
- ;
-
- ASM_OUTPUT_INTERNAL_LABEL (file, "LX", CODE_LABEL_NUMBER (insn));
- a29k_first_epilogue_insn_used = 0;
-}
-
-/* Output the epilog of the last procedure to file FILE. SIZE is the memory
- stack size. The register stack size is in the variable
- A29K_REGSTACK_SIZE. */
-
-void
-output_epilog (file, size)
- FILE *file;
- int size;
-{
- rtx insn;
- int locals_unavailable = 0; /* True until after first insn
- after gr1 update. */
-
- /* If we hit a BARRIER before a real insn or CODE_LABEL, we don't
- need to do anything because we are never jumped to. */
- insn = get_last_insn ();
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
-
- if (insn && GET_CODE (insn) == BARRIER)
- return;
-
- /* If a frame pointer was needed we must restore the memory stack pointer
- before adjusting the register stack. */
- if (frame_pointer_needed)
- {
- fprintf (file, "\tsll %s,%s,0\n",
- reg_names[R_MSP], reg_names[FRAME_POINTER_REGNUM]);
- check_epilogue_internal_label (file);
- }
-
- /* Restore the register stack. There are two ways to do this. */
- if (a29k_regstack_size)
- {
- if (a29k_regstack_size >= 256/4)
- {
- fprintf (file, "\tconst %s,%d\n",
- reg_names[R_TAV], a29k_regstack_size * 4);
- check_epilogue_internal_label (file);
- fprintf (file, "\tadd gr1,gr1,%s\n", reg_names[R_TAV]);
- }
- else
- {
- fprintf (file, "\tadd gr1,gr1,%d\n", a29k_regstack_size * 4);
- check_epilogue_internal_label (file);
- }
- locals_unavailable = 1;
- }
-
- /* Restore the memory stack pointer if there is no frame pointer.
- Adjust the size to include any pretend arguments and pushed
- arguments and round to doubleword boundary. */
- size += (current_function_pretend_args_size
- + current_function_outgoing_args_size);
- size = (size + 7) & ~7;
-
- if (size && ! frame_pointer_needed)
- {
- if (size >= 256)
- {
- fprintf (file, "\tconst %s,%d\n", reg_names[R_TAV], size);
- check_epilogue_internal_label (file);
- locals_unavailable = 0;
- if (size >= 65536)
- fprintf (file, "\tconsth %s,%d\n", reg_names[R_TAV], size);
- fprintf (file, "\tadd %s,%s,%s\n",
- reg_names[R_MSP], reg_names[R_MSP], reg_names[R_TAV]);
- }
- else
- {
- fprintf (file, "\tadd %s,%s,%d\n",
- reg_names[R_MSP], reg_names[R_MSP], size);
- check_epilogue_internal_label (file);
- locals_unavailable = 0;
- }
- }
-
- if (locals_unavailable)
- {
- /* If we have an insn for this delay slot, write it. */
- if (current_function_epilogue_delay_list)
- final_scan_insn (XEXP (current_function_epilogue_delay_list, 0),
- file, 1, -2, 1);
- else
- fprintf (file, "\tnop\n");
- }
-
- fprintf (file, "\tjmpi lr0\n");
- if (a29k_regstack_size)
- fprintf (file, "\tasleu V_%sFILL,lr1,%s\n",
- TARGET_KERNEL_REGISTERS ? "K" : "", reg_names[R_RFB]);
- else if (current_function_epilogue_delay_list)
- final_scan_insn (XEXP (current_function_epilogue_delay_list, 0),
- file, 1, -2, 1);
- else
- fprintf (file, "\tnop\n");
-}
diff --git a/gcc/config/a29k/a29k.h b/gcc/config/a29k/a29k.h
deleted file mode 100644
index 2b607e786e9..00000000000
--- a/gcc/config/a29k/a29k.h
+++ /dev/null
@@ -1,1666 +0,0 @@
-/* Definitions of target machine for GNU compiler, for AMD Am29000 CPU.
- Copyright (C) 1988, 90-96, 1997 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@nyu.edu)
-
-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. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-D_AM29K -D_AM29000 -D_EPI -Acpu(a29k) -Amachine(a29k)"
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION
-
-/* Pass -w to assembler. */
-#define ASM_SPEC "-w"
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-/* This means that the DW bit will be enabled, to allow direct loads
- of bytes. */
-
-#define TARGET_DW_ENABLE (target_flags & 1)
-
-/* This means that the external hardware does supports byte writes. */
-
-#define TARGET_BYTE_WRITES (target_flags & 2)
-
-/* This means that a "small memory model" has been selected where all
- function addresses are known to be within 256K. This allows CALL to be
- used. */
-
-#define TARGET_SMALL_MEMORY (target_flags & 4)
-
-/* This means that we must always used on indirect call, even when
- calling a function in the same file, since the file might be > 256KB. */
-
-#define TARGET_LARGE_MEMORY (target_flags & 8)
-
-/* This means that we are compiling for a 29050. */
-
-#define TARGET_29050 (target_flags & 16)
-
-/* This means that we are compiling for the kernel which means that we use
- gr64-gr95 instead of gr96-126. */
-
-#define TARGET_KERNEL_REGISTERS (target_flags & 32)
-
-/* This means that a call to "__msp_check" should be inserted after each stack
- adjustment to check for stack overflow. */
-
-#define TARGET_STACK_CHECK (target_flags & 64)
-
-/* This handles 29k processors which cannot handle the separation
- of a mtsrim insns and a storem insn (most 29000 chips to date, but
- not the 29050. */
-
-#define TARGET_NO_STOREM_BUG (target_flags & 128)
-
-/* This forces the compiler not to use incoming argument registers except
- for copying out arguments. It helps detect problems when a function is
- called with fewer arguments than it is declared with. */
-
-#define TARGET_NO_REUSE_ARGS (target_flags & 256)
-
-/* This means that neither builtin nor emulated float operations are
- available, and that GCC should generate libcalls instead. */
-
-#define TARGET_SOFT_FLOAT (target_flags & 512)
-
-/* This means that we should not emit the multm or mutmu instructions
- that some embedded systems' trap handlers don't support. */
-
-#define TARGET_MULTM ((target_flags & 1024) == 0)
-
-#define TARGET_SWITCHES \
- { {"dw", 1}, \
- {"ndw", -1}, \
- {"bw", 2}, \
- {"nbw", - (1|2)}, \
- {"small", 4}, \
- {"normal", - (4|8)}, \
- {"large", 8}, \
- {"29050", 16+128}, \
- {"29000", -16}, \
- {"kernel-registers", 32}, \
- {"user-registers", -32}, \
- {"stack-check", 64}, \
- {"no-stack-check", - 74}, \
- {"storem-bug", -128}, \
- {"no-storem-bug", 128}, \
- {"reuse-arg-regs", -256}, \
- {"no-reuse-arg-regs", 256}, \
- {"soft-float", 512}, \
- {"no-multm", 1024}, \
- {"", TARGET_DEFAULT}}
-
-#define TARGET_DEFAULT 3
-
-/* Show we can debug even without a frame pointer. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* target machine storage layout */
-
-/* Define the types for size_t, ptrdiff_t, and wchar_t. These are the
- same as those used by EPI. The type for wchar_t does not make much
- sense, but is what is used. */
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-#define WCHAR_TYPE "char"
-#define WCHAR_TYPE_SIZE BITS_PER_UNIT
-
-/* Define this macro if it is advisable to hold scalars in registers
- in a wider mode than that declared by the program. In such cases,
- the value is constrained to be within the bounds of the declared
- type, but kept valid in the wider mode. The signedness of the
- extension may differ from that of the type. */
-
-#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < 4) \
- (MODE) = SImode;
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is arbitrary on the 29k since it has no actual bit-field insns.
- It is better to define this as TRUE because BYTES_BIG_ENDIAN is TRUE
- and we want to be able to convert BP position to bit position with
- just a shift. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered.
- This is true on 29k. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is lowest
- numbered.
-
- For 29k we can decide arbitrarily since there are no machine instructions
- for them. Might as well be consistent with bytes. */
-#define WORDS_BIG_ENDIAN 1
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 64
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* Make strings word-aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- (TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Set this non-zero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 0
-
-/* Set this non-zero if unaligned move instructions are extremely slow.
-
- On the 29k, they trap. */
-#define SLOW_UNALIGNED_ACCESS 1
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- 29k has 256 registers, of which 62 are not defined. gr0 and gr1 are
- not produced in generated RTL so we can start at gr96, and call it
- register zero.
-
- So 0-31 are gr96-gr127, lr0-lr127 are 32-159. To represent the input
- arguments, whose register numbers we won't know until we are done,
- use register 160-175. They cannot be modified. Similarly, 176 is used
- for the frame pointer. It is assigned the last local register number
- once the number of registers used is known.
-
- We use 177, 178, 179, and 180 for the special registers BP, FC, CR, and Q,
- respectively. Registers 181 through 199 are used for the other special
- registers that may be used by the programmer, but are never used by the
- compiler.
-
- Registers 200-203 are the four floating-point accumulator register in
- the 29050.
-
- Registers 204-235 are the 32 global registers for kernel mode when
- -mkernel-registers is not specified, and the 32 global user registers
- when it is.
-
- When -mkernel-registers is specified, we still use the same register
- map but change the names so 0-31 print as gr64-gr95. */
-
-#define FIRST_PSEUDO_REGISTER 236
-
-/* Because of the large number of registers on the 29k, we define macros
- to refer to each group of registers and then define the number for some
- registers used in the calling sequence. */
-
-#define R_GR(N) ((N) - 96) /* gr96 is register number 0 */
-#define R_LR(N) ((N) + 32) /* lr0 is register number 32 */
-#define R_FP 176 /* frame pointer is register 176 */
-#define R_AR(N) ((N) + 160) /* first incoming arg reg is 160 */
-#define R_KR(N) ((N) + 204) /* kernel registers (gr64 to gr95) */
-
-/* Define the numbers of the special registers. */
-#define R_BP 177
-#define R_FC 178
-#define R_CR 179
-#define R_Q 180
-
-/* These special registers are not used by the compiler, but may be referenced
- by the programmer via asm declarations. */
-
-#define R_VAB 181
-#define R_OPS 182
-#define R_CPS 183
-#define R_CFG 184
-#define R_CHA 185
-#define R_CHD 186
-#define R_CHC 187
-#define R_RBP 188
-#define R_TMC 189
-#define R_TMR 190
-#define R_PC0 191
-#define R_PC1 192
-#define R_PC2 193
-#define R_MMU 194
-#define R_LRU 195
-#define R_FPE 196
-#define R_INT 197
-#define R_FPS 198
-#define R_EXO 199
-
-/* Define the number for floating-point accumulator N. */
-#define R_ACU(N) ((N) + 200)
-
-/* Now define the registers used in the calling sequence. */
-#define R_TAV R_GR (121)
-#define R_TPC R_GR (122)
-#define R_LRP R_GR (123)
-#define R_SLP R_GR (124)
-#define R_MSP R_GR (125)
-#define R_RAB R_GR (126)
-#define R_RFB R_GR (127)
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator. */
-
-#define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, \
- 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
-
-/* List the order in which to allocate registers. Each register must be
- listed once, even those in FIXED_REGISTERS.
-
- We allocate in the following order:
- gr116-gr120 (not used for anything but temps)
- gr96-gr111 (function return values, reverse order)
- argument registers (160-175)
- lr0-lr127 (locals, saved)
- acc3-0 (acc0 special)
- everything else */
-
-#define REG_ALLOC_ORDER \
- {R_GR (116), R_GR (117), R_GR (118), R_GR (119), R_GR (120), \
- R_GR (111), R_GR (110), R_GR (109), R_GR (108), R_GR (107), \
- R_GR (106), R_GR (105), R_GR (104), R_GR (103), R_GR (102), \
- R_GR (101), R_GR (100), R_GR (99), R_GR (98), R_GR (97), R_GR (96), \
- R_AR (0), R_AR (1), R_AR (2), R_AR (3), R_AR (4), R_AR (5), \
- R_AR (6), R_AR (7), R_AR (8), R_AR (9), R_AR (10), R_AR (11), \
- R_AR (12), R_AR (13), R_AR (14), R_AR (15), \
- R_LR (0), R_LR (1), R_LR (2), R_LR (3), R_LR (4), R_LR (5), \
- R_LR (6), R_LR (7), R_LR (8), R_LR (9), R_LR (10), R_LR (11), \
- R_LR (12), R_LR (13), R_LR (14), R_LR (15), R_LR (16), R_LR (17), \
- R_LR (18), R_LR (19), R_LR (20), R_LR (21), R_LR (22), R_LR (23), \
- R_LR (24), R_LR (25), R_LR (26), R_LR (27), R_LR (28), R_LR (29), \
- R_LR (30), R_LR (31), R_LR (32), R_LR (33), R_LR (34), R_LR (35), \
- R_LR (36), R_LR (37), R_LR (38), R_LR (39), R_LR (40), R_LR (41), \
- R_LR (42), R_LR (43), R_LR (44), R_LR (45), R_LR (46), R_LR (47), \
- R_LR (48), R_LR (49), R_LR (50), R_LR (51), R_LR (52), R_LR (53), \
- R_LR (54), R_LR (55), R_LR (56), R_LR (57), R_LR (58), R_LR (59), \
- R_LR (60), R_LR (61), R_LR (62), R_LR (63), R_LR (64), R_LR (65), \
- R_LR (66), R_LR (67), R_LR (68), R_LR (69), R_LR (70), R_LR (71), \
- R_LR (72), R_LR (73), R_LR (74), R_LR (75), R_LR (76), R_LR (77), \
- R_LR (78), R_LR (79), R_LR (80), R_LR (81), R_LR (82), R_LR (83), \
- R_LR (84), R_LR (85), R_LR (86), R_LR (87), R_LR (88), R_LR (89), \
- R_LR (90), R_LR (91), R_LR (92), R_LR (93), R_LR (94), R_LR (95), \
- R_LR (96), R_LR (97), R_LR (98), R_LR (99), R_LR (100), R_LR (101), \
- R_LR (102), R_LR (103), R_LR (104), R_LR (105), R_LR (106), \
- R_LR (107), R_LR (108), R_LR (109), R_LR (110), R_LR (111), \
- R_LR (112), R_LR (113), R_LR (114), R_LR (115), R_LR (116), \
- R_LR (117), R_LR (118), R_LR (119), R_LR (120), R_LR (121), \
- R_LR (122), R_LR (123), R_LR (124), R_LR (124), R_LR (126), \
- R_LR (127), \
- R_ACU (3), R_ACU (2), R_ACU (1), R_ACU (0), \
- R_GR (112), R_GR (113), R_GR (114), R_GR (115), R_GR (121), \
- R_GR (122), R_GR (123), R_GR (124), R_GR (125), R_GR (126), \
- R_GR (127), \
- R_FP, R_BP, R_FC, R_CR, R_Q, \
- R_VAB, R_OPS, R_CPS, R_CFG, R_CHA, R_CHD, R_CHC, R_RBP, R_TMC, \
- R_TMR, R_PC0, R_PC1, R_PC2, R_MMU, R_LRU, R_FPE, R_INT, R_FPS, \
- R_EXO, \
- R_KR (0), R_KR (1), R_KR (2), R_KR (3), R_KR (4), R_KR (5), \
- R_KR (6), R_KR (7), R_KR (8), R_KR (9), R_KR (10), R_KR (11), \
- R_KR (12), R_KR (13), R_KR (14), R_KR (15), R_KR (16), R_KR (17), \
- R_KR (18), R_KR (19), R_KR (20), R_KR (21), R_KR (22), R_KR (23), \
- R_KR (24), R_KR (25), R_KR (26), R_KR (27), R_KR (28), R_KR (29), \
- R_KR (30), R_KR (31) }
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((REGNO) >= R_ACU (0) && (REGNO) <= R_ACU (3)? 1 \
- : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On 29k, the cpu registers can hold any mode. But a double-precision
- floating-point value should start at an even register. The special
- registers cannot hold floating-point values, BP, CR, and FC cannot
- hold integer or floating-point values, and the accumulators cannot
- hold integer values.
-
- DImode and larger values should start at an even register just like
- DFmode values, even though the instruction set doesn't require it, in order
- to prevent reload from aborting due to a modes_equiv_for_class_p failure.
-
- (I'd like to use the "?:" syntax to make this more readable, but Sun's
- compiler doesn't seem to accept it.) */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-(((REGNO) >= R_ACU (0) && (REGNO) <= R_ACU (3) \
- && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)) \
- || ((REGNO) >= R_BP && (REGNO) <= R_CR \
- && GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT) \
- || ((REGNO) >= R_Q && (REGNO) < R_ACU (0) \
- && GET_MODE_CLASS (MODE) != MODE_FLOAT \
- && GET_MODE_CLASS (MODE) != MODE_COMPLEX_FLOAT) \
- || (((REGNO) < R_BP || (REGNO) >= R_KR (0)) \
- && ((((REGNO) & 1) == 0) \
- || GET_MODE_UNIT_SIZE (MODE) <= UNITS_PER_WORD)))
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output.
-
- On the 29k, normally we'd just have problems with DFmode because of the
- even alignment. However, we also have to be a bit concerned about
- the special register's restriction to non-floating and the floating-point
- accumulator's restriction to only floating. This probably won't
- cause any great inefficiencies in practice. */
-
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- ((MODE1) == (MODE2) \
- || (GET_MODE_CLASS (MODE1) == MODE_INT \
- && GET_MODE_CLASS (MODE2) == MODE_INT))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* 29k pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM R_GR (125)
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM R_FP
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 0
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM R_FP
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM R_SLP
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM R_LRP
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union.
-
- The 29k has nine registers classes: LR0_REGS, GENERAL_REGS, SPECIAL_REGS,
- BP_REGS, FC_REGS, CR_REGS, Q_REGS, ACCUM_REGS, and ACCUM0_REGS.
- LR0_REGS, BP_REGS, FC_REGS, CR_REGS, and Q_REGS contain just the single
- register. The latter two classes are used to represent the floating-point
- accumulator registers in the 29050. We also define the union class
- FLOAT_REGS to represent any register that can be used to hold a
- floating-point value. The union of SPECIAL_REGS and ACCUM_REGS isn't
- useful as the former cannot contain floating-point and the latter can only
- contain floating-point. */
-
-enum reg_class { NO_REGS, LR0_REGS, GENERAL_REGS, BP_REGS, FC_REGS, CR_REGS,
- Q_REGS, SPECIAL_REGS, ACCUM0_REGS, ACCUM_REGS, FLOAT_REGS,
- ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "LR0_REGS", "GENERAL_REGS", "BP_REGS", "FC_REGS", "CR_REGS", \
- "Q_REGS", "SPECIAL_REGS", "ACCUM0_REGS", "ACCUM_REGS", "FLOAT_REGS", \
- "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
- { {0, 0, 0, 0, 0, 0, 0, 0}, \
- {0, 1, 0, 0, 0, 0, 0, 0}, \
- {~0, ~0, ~0, ~0, ~0, ~ 0xfffe0000, ~ 0xfff, 0xfff}, \
- {0, 0, 0, 0, 0, 0x20000, 0, 0}, \
- {0, 0, 0, 0, 0, 0x40000, 0, 0}, \
- {0, 0, 0, 0, 0, 0x80000, 0, 0}, \
- {0, 0, 0, 0, 0, 0x100000, 0, 0}, \
- {0, 0, 0, 0, 0, 0xfffe0000, 0xff, 0}, \
- {0, 0, 0, 0, 0, 0, 0x100, 0}, \
- {0, 0, 0, 0, 0, 0, 0xf00, 0}, \
- {~0, ~0, ~0, ~0, ~0, ~ 0xfffe0000, ~ 0xff, 0xfff}, \
- {~0, ~0, ~0, ~0, ~0, ~0, ~0, 0xfff} }
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) == R_BP ? BP_REGS \
- : (REGNO) == R_FC ? FC_REGS \
- : (REGNO) == R_CR ? CR_REGS \
- : (REGNO) == R_Q ? Q_REGS \
- : (REGNO) > R_BP && (REGNO) <= R_EXO ? SPECIAL_REGS \
- : (REGNO) == R_ACU (0) ? ACCUM0_REGS \
- : (REGNO) >= R_KR (0) ? GENERAL_REGS \
- : (REGNO) > R_ACU (0) ? ACCUM_REGS \
- : (REGNO) == R_LR (0) ? LR0_REGS \
- : GENERAL_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS NO_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'r' ? GENERAL_REGS \
- : (C) == 'l' ? LR0_REGS \
- : (C) == 'b' ? BP_REGS \
- : (C) == 'f' ? FC_REGS \
- : (C) == 'c' ? CR_REGS \
- : (C) == 'q' ? Q_REGS \
- : (C) == 'h' ? SPECIAL_REGS \
- : (C) == 'a' ? ACCUM_REGS \
- : (C) == 'A' ? ACCUM0_REGS \
- : (C) == 'f' ? FLOAT_REGS \
- : NO_REGS)
-
-/* Define this macro to change register usage conditional on target flags.
-
- On the 29k, we use this to change the register names for kernel mapping. */
-
-#define CONDITIONAL_REGISTER_USAGE \
- { \
- char *p; \
- int i; \
- \
- if (TARGET_KERNEL_REGISTERS) \
- for (i = 0; i < 32; i++) \
- { \
- p = reg_names[i]; \
- reg_names[i] = reg_names[R_KR (i)]; \
- reg_names[R_KR (i)] = p; \
- } \
- }
-
-/* The letters I, J, K, L, M, N, O, and P in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For 29k:
- `I' is used for the range of constants most insns can contain.
- `J' is for the few 16-bit insns.
- `K' is a constant whose high-order 24 bits are all one
- `L' is a HImode constant whose high-order 8 bits are all one
- `M' is a 32-bit constant whose high-order 16 bits are all one (for CONSTN)
- `N' is a 32-bit constant whose negative is 8 bits
- `O' is the 32-bit constant 0x80000000, any constant with low-order
- 16 bits zero for 29050.
- `P' is a HImode constant whose negative is 8 bits */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (unsigned) (VALUE) < 0x100 \
- : (C) == 'J' ? (unsigned) (VALUE) < 0x10000 \
- : (C) == 'K' ? ((VALUE) & 0xffffff00) == 0xffffff00 \
- : (C) == 'L' ? ((VALUE) & 0xff00) == 0xff00 \
- : (C) == 'M' ? ((VALUE) & 0xffff0000) == 0xffff0000 \
- : (C) == 'N' ? ((VALUE) < 0 && (VALUE) > -256) \
- : (C) == 'O' ? ((VALUE) == 0x80000000 \
- || (TARGET_29050 && ((VALUE) & 0xffff) == 0)) \
- : (C) == 'P' ? (((VALUE) | 0xffff0000) < 0 \
- && ((VALUE) | 0xffff0000) > -256) \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself.
- All floating-point constants are valid on 29k. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
- NO_REGS is returned. */
-
-#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
- secondary_reload_class (CLASS, MODE, IN)
-
-/* This function is used to get the address of an object. */
-
-extern struct rtx_def *a29k_get_reloaded_address ();
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS.
-
- On 29k, this is the size of MODE in words except that the floating-point
- accumulators only require one word for anything they can hold. */
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- (((CLASS) == ACCUM_REGS || (CLASS) == ACCUM0_REGS) ? 1 \
- : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Define the cost of moving between registers of various classes. Everything
- involving a general register is cheap, but moving between the other types
- (even within a class) is two insns. */
-
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- ((CLASS1) == GENERAL_REGS || (CLASS2) == GENERAL_REGS ? 2 : 4)
-
-/* A C expressions returning the cost of moving data of MODE from a register to
- or from memory.
-
- It takes extra insns on the 29k to form addresses, so we want to make
- this higher. In addition, we need to keep it more expensive than the
- most expensive register-register copy. */
-
-#define MEMORY_MOVE_COST(MODE) 6
-
-/* A C statement (sans semicolon) to update the integer variable COST
- based on the relationship between INSN that is dependent on
- DEP_INSN through the dependence LINK. The default is to make no
- adjustment to COST. On the a29k, ignore the cost of anti- and
- output-dependencies. */
-#define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \
- if (REG_NOTE_KIND (LINK) != 0) \
- (COST) = 0; /* Anti or output dependence. */
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-
-#define STARTING_FRAME_OFFSET (- current_function_pretend_args_size)
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On 29k, don't define this because there are no push insns. */
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* Define this if the maximum size of all the outgoing args is to be
- accumulated and pushed during the prologue. The amount can be
- found in the variable current_function_outgoing_args_size. */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Offset of first parameter from the argument pointer register value. */
-
-#define FIRST_PARM_OFFSET(FNDECL) (- current_function_pretend_args_size)
-
-/* Define this if stack space is still allocated for a parameter passed
- in a register. */
-/* #define REG_PARM_STACK_SPACE */
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0.
-
- On 29k the value is found in gr96. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), R_GR (96))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, R_GR (96))
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller.
- On 29k, gr96-gr111 are used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == R_GR (96))
-
-/* 1 if N is a possible register number for function argument passing.
- On 29k, these are lr2-lr17. */
-
-#define FUNCTION_ARG_REGNO_P(N) ((N) <= R_LR (17) && (N) >= R_LR (2))
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On 29k, this is a single integer, which is a number of words
- of arguments scanned so far.
- Thus 16 or more means all following args should go on the stack. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0
-
-/* Same, but called for incoming args.
-
- On the 29k, we use this to set all argument registers to fixed and
- set the last 16 local regs, less two, (lr110-lr125) to available. Some
- will later be changed to call-saved by FUNCTION_INCOMING_ARG.
- lr126,lr127 are always fixed, they are place holders for the caller's
- lr0,lr1. */
-
-#define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE) \
-{ int i; \
- for (i = R_AR (0) - 2; i < R_AR (16); i++) \
- { \
- fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 1; \
- SET_HARD_REG_BIT (fixed_reg_set, i); \
- SET_HARD_REG_BIT (call_used_reg_set, i); \
- SET_HARD_REG_BIT (call_fixed_reg_set, i); \
- } \
- for (i = R_LR (110); i < R_LR (126); i++) \
- { \
- fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 0; \
- CLEAR_HARD_REG_BIT (fixed_reg_set, i); \
- CLEAR_HARD_REG_BIT (call_used_reg_set, i); \
- CLEAR_HARD_REG_BIT (call_fixed_reg_set, i); \
- } \
- (CUM) = 0; \
- }
-
-/* Define intermediate macro to compute the size (in registers) of an argument
- for the 29k. */
-
-#define A29K_ARG_SIZE(MODE, TYPE, NAMED) \
-(! (NAMED) ? 0 \
- : (MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
- : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- if (MUST_PASS_IN_STACK (MODE, TYPE)) \
- (CUM) = 16; \
- else \
- (CUM) += A29K_ARG_SIZE (MODE, TYPE, NAMED)
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- On 29k the first 16 words of args are normally in registers
- and the rest are pushed. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-((CUM) < 16 && (NAMED) && ! MUST_PASS_IN_STACK (MODE, TYPE) \
- ? gen_rtx(REG, (MODE), R_LR (2) + (CUM)) : 0)
-
-/* Define where a function finds its arguments.
- This is different from FUNCTION_ARG because of register windows.
-
- On the 29k, we hack this to call a function that sets the used registers
- as non-fixed and not used by calls. */
-
-#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
-((CUM) < 16 && (NAMED) && ! MUST_PASS_IN_STACK (MODE, TYPE) \
- ? gen_rtx (REG, MODE, \
- incoming_reg (CUM, A29K_ARG_SIZE (MODE, TYPE, NAMED))) \
- : 0)
-
-/* This indicates that an argument is to be passed with an invisible reference
- (i.e., a pointer to the object is passed).
-
- On the 29k, we do this if it must be passed on the stack. */
-
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
- (MUST_PASS_IN_STACK (MODE, TYPE))
-
-/* Specify the padding direction of arguments.
-
- On the 29k, we must pad upwards in order to be able to pass args in
- registers. */
-
-#define FUNCTION_ARG_PADDING(MODE, TYPE) upward
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
-((CUM) < 16 && 16 < (CUM) + A29K_ARG_SIZE (MODE, TYPE, NAMED) && (NAMED) \
- ? 16 - (CUM) : 0)
-
-/* Perform any needed actions needed for a function that is receiving a
- variable number of arguments.
-
- CUM is as above.
-
- MODE and TYPE are the mode and type of the current parameter.
-
- PRETEND_SIZE is a variable that should be set to the amount of stack
- that must be pushed by the prolog to pretend that our caller pushed
- it.
-
- Normally, this macro will push all remaining incoming registers on the
- stack and set PRETEND_SIZE to the length of the registers pushed. */
-
-#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
-{ if ((CUM) < 16) \
- { \
- int first_reg_offset = (CUM); \
- \
- if (MUST_PASS_IN_STACK (MODE, TYPE)) \
- first_reg_offset += A29K_ARG_SIZE (TYPE_MODE (TYPE), TYPE, 1); \
- \
- if (first_reg_offset > 16) \
- first_reg_offset = 16; \
- \
- if (! (NO_RTL) && first_reg_offset != 16) \
- move_block_from_reg \
- (R_AR (0) + first_reg_offset, \
- gen_rtx (MEM, BLKmode, virtual_incoming_args_rtx), \
- 16 - first_reg_offset, (16 - first_reg_offset) * UNITS_PER_WORD); \
- PRETEND_SIZE = (16 - first_reg_offset) * UNITS_PER_WORD; \
- } \
-}
-
-/* Define the information needed to generate branch and scc insns. This is
- stored from the compare operation. Note that we can't use "rtx" here
- since it hasn't been defined! */
-
-extern struct rtx_def *a29k_compare_op0, *a29k_compare_op1;
-extern int a29k_compare_fp_p;
-
-/* This macro produces the initial definition of a function name.
-
- For the 29k, we need the prolog to contain one or two words prior to
- the declaration of the function name. So just store away the name and
- write it as part of the prolog. This also computes the register names,
- which can't be done until after register allocation, but must be done
- before final_start_function is called. */
-
-extern char *a29k_function_name;
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
- a29k_function_name = NAME; \
- a29k_compute_reg_names ();
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO)
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)
-
-/* Define the number of delay slots needed for the function epilogue.
-
- On the 29k, we need a slot except when we have a register stack adjustment,
- have a memory stack adjustment, and have no frame pointer. */
-
-#define DELAY_SLOTS_FOR_EPILOGUE \
- (! (needs_regstack_p () \
- && (get_frame_size () + current_function_pretend_args_size \
- + current_function_outgoing_args_size) != 0 \
- && ! frame_pointer_needed))
-
-/* Define whether INSN can be placed in delay slot N for the epilogue.
-
- On the 29k, we must be able to place it in a delay slot, it must
- not use sp if the frame pointer cannot be eliminated, and it cannot
- use local regs if we need to push the register stack. */
-
-#define ELIGIBLE_FOR_EPILOGUE_DELAY(INSN,N) \
- (get_attr_in_delay_slot (INSN) == IN_DELAY_SLOT_YES \
- && ! (frame_pointer_needed \
- && reg_mentioned_p (stack_pointer_rtx, PATTERN (INSN))) \
- && ! (needs_regstack_p () && uses_local_reg_p (PATTERN (INSN))))
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- The trampoline should set the static chain pointer to value placed
- into the trampoline and should branch to the specified routine. We
- use gr121 (tav) as a temporary. */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\tconst %s,0\n", reg_names[R_TAV]); \
- fprintf (FILE, "\tconsth %s,0\n", reg_names[R_TAV]); \
- fprintf (FILE, "\tconst %s,0\n", reg_names[R_SLP]); \
- fprintf (FILE, "\tjmpi %s\n", reg_names[R_TAV]); \
- fprintf (FILE, "\tconsth %s,0\n", reg_names[R_SLP]); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 20
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function.
-
- We do this on the 29k by writing the bytes of the addresses into the
- trampoline one byte at a time. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- INITIALIZE_TRAMPOLINE_VALUE (TRAMP, FNADDR, 0, 4); \
- INITIALIZE_TRAMPOLINE_VALUE (TRAMP, CXT, 8, 16); \
-}
-
-/* Define a sub-macro to initialize one value into the trampoline.
- We specify the offsets of the CONST and CONSTH instructions, respectively
- and copy the value a byte at a time into these instructions. */
-
-#define INITIALIZE_TRAMPOLINE_VALUE(TRAMP, VALUE, CONST, CONSTH) \
-{ \
- rtx _addr, _temp; \
- rtx _val = force_reg (SImode, VALUE); \
- \
- _addr = memory_address (QImode, plus_constant (TRAMP, (CONST) + 3)); \
- emit_move_insn (gen_rtx (MEM, QImode, _addr), \
- gen_lowpart (QImode, _val)); \
- \
- _temp = expand_shift (RSHIFT_EXPR, SImode, _val, \
- build_int_2 (8, 0), 0, 1); \
- _addr = memory_address (QImode, plus_constant (TRAMP, (CONST) + 1)); \
- emit_move_insn (gen_rtx (MEM, QImode, _addr), \
- gen_lowpart (QImode, _temp)); \
- \
- _temp = expand_shift (RSHIFT_EXPR, SImode, _temp, \
- build_int_2 (8, 0), _temp, 1); \
- _addr = memory_address (QImode, plus_constant (TRAMP, (CONSTH) + 3)); \
- emit_move_insn (gen_rtx (MEM, QImode, _addr), \
- gen_lowpart (QImode, _temp)); \
- \
- _temp = expand_shift (RSHIFT_EXPR, SImode, _temp, \
- build_int_2 (8, 0), _temp, 1); \
- _addr = memory_address (QImode, plus_constant (TRAMP, (CONSTH) + 1)); \
- emit_move_insn (gen_rtx (MEM, QImode, _addr), \
- gen_lowpart (QImode, _temp)); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) 0
-#define REGNO_OK_FOR_BASE_P(REGNO) 1
-
-/* Given the value returned from get_frame_size, compute the actual size
- of the frame we will allocate. We include the pretend and outgoing
- arg sizes and round to a doubleword. */
-
-#define ACTUAL_FRAME_SIZE(SIZE) \
- (((SIZE) + current_function_pretend_args_size \
- + current_function_outgoing_args_size + 7) & ~7)
-
-/* Define the initial offset between the frame and stack pointer. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
- (DEPTH) = ACTUAL_FRAME_SIZE (get_frame_size ())
-
-/* Maximum number of registers that can appear in a valid memory address. */
-#define MAX_REGS_PER_ADDRESS 1
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
-(GET_CODE (X) == CONST_INT && (unsigned) INTVAL (X) < 0x100)
-
-/* Include all constant integers and constant doubles */
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) 0
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) 1
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On the 29k, a legitimate address is a register and so is a
- constant of less than 256. */
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ if (REG_P (X) && REG_OK_FOR_BASE_P (X)) \
- goto ADDR; \
- if (GET_CODE (X) == CONST_INT \
- && (unsigned) INTVAL (X) < 0x100) \
- goto ADDR; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the 29k, we need not do anything. However, if we don't,
- `memory_address' will try lots of things to get a valid address, most of
- which will result in dead code and extra pseudos. So we make the address
- valid here.
-
- This is easy: The only valid addresses are an offset from a register
- and we know the address isn't valid. So just call either `force_operand'
- or `force_reg' unless this is a (plus (reg ...) (const_int 0)). */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ if (GET_CODE (X) == PLUS && XEXP (X, 1) == const0_rtx) \
- X = XEXP (x, 0); \
- if (GET_CODE (X) == MULT || GET_CODE (X) == PLUS) \
- X = force_operand (X, 0); \
- else \
- X = force_reg (Pmode, X); \
- goto WIN; \
-}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the 29k this is never true. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
-/* Compute the cost of an address. For the 29k, all valid addresses are
- the same cost. */
-
-#define ADDRESS_COST(X) 0
-
-/* Define this if some processing needs to be done immediately before
- emitting code for an insn. */
-
-/* #define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) */
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 0
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one.
-
- We actually lie a bit here as overflow conditions are different. But
- they aren't being checked anyway. */
-
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* Max number of bytes we can move to of from memory
- in one reasonably fast instruction.
-
- For the 29k, we will define movti, so put this at 4 words. */
-#define MOVE_MAX 16
-
-/* Largest number of bytes of an object that can be placed in a register.
- On the 29k we have plenty of registers, so use TImode. */
-#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode)
-
-/* Nonzero if access to memory by bytes is no faster than for words.
- Also non-zero if doing byte operations (specifically shifts) in registers
- is undesirable.
-
- On the 29k, large masks are expensive, so we want to use bytes to
- manipulate fields. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-
-/* Define if the object format being used is COFF or a superset. */
-#define OBJECT_FORMAT_COFF
-
-/* This uses COFF, so it wants SDB format. */
-#define SDB_DEBUGGING_INFO
-
-/* Define this to be the delimiter between SDB sub-sections. The default
- is ";". */
-#define SDB_DELIM "\n"
-
-/* Do not break .stabs pseudos into continuations. */
-#define DBX_CONTIN_LENGTH 0
-
-/* Don't try to use the `x' type-cross-reference character in DBX data.
- Also has the consequence of putting each struct, union or enum
- into a separate .stabs, containing only cross-refs to the others. */
-#define DBX_NO_XREFS
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true, which
- is just the sign bit. */
-
-#define STORE_FLAG_VALUE (-2147483647 - 1)
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* Mode of a function address in a call instruction (for indexing purposes).
-
- Doesn't matter on 29k. */
-#define FUNCTION_MODE SImode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-#define NO_FUNCTION_CSE
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch.
-
- We only care about the cost if it is valid in an insn. The only
- constants that cause an insn to generate more than one machine
- instruction are those involving floating-point or address. So
- only these need be expensive. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- return 0; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 6; \
- case CONST_DOUBLE: \
- return GET_MODE (RTX) == SFmode ? 6 : 8;
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE.
-
- All MEMs cost the same if they are valid. This is used to ensure
- that (mem (symbol_ref ...)) is placed into a CALL when valid.
-
- The multiply cost depends on whether this is a 29050 or not. */
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MULT: \
- return TARGET_29050 ? COSTS_N_INSNS (2) : COSTS_N_INSNS (40); \
- case DIV: \
- case UDIV: \
- case MOD: \
- case UMOD: \
- return COSTS_N_INSNS (50); \
- case MEM: \
- return COSTS_N_INSNS (2);
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) \
-{ char *p, *after_dir = main_input_filename; \
- if (TARGET_29050) \
- fprintf (FILE, "\t.cputype 29050\n"); \
- for (p = main_input_filename; *p; p++) \
- if (*p == '/') \
- after_dir = p + 1; \
- fprintf (FILE, "\t.file "); \
- output_quoted_string (FILE, after_dir); \
- fprintf (FILE, "\n"); \
- fprintf (FILE, "\t.sect .lit,lit\n"); }
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* The next few macros don't have tabs on most machines, but
- at least one 29K assembler wants them. */
-
-/* Output before instructions. */
-
-#define TEXT_SECTION_ASM_OP "\t.text"
-
-/* Output before read-only data. */
-
-#define READONLY_DATA_SECTION_ASM_OP "\t.use .lit"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP "\t.data"
-
-/* Define an extra section for read-only data, a routine to enter it, and
- indicate that it is for read-only data. */
-
-#define EXTRA_SECTIONS readonly_data
-
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-literal_section () \
-{ \
- if (in_section != readonly_data) \
- { \
- fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \
- in_section = readonly_data; \
- } \
-} \
-
-#define READONLY_DATA_SECTION literal_section
-
-/* If we are referencing a function that is static or is known to be
- in this file, make the SYMBOL_REF special. We can use this to indicate
- that we can branch to this function without emitting a no-op after the
- call. */
-
-#define ENCODE_SECTION_INFO(DECL) \
- if (TREE_CODE (DECL) == FUNCTION_DECL \
- && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL))) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"gr96", "gr97", "gr98", "gr99", "gr100", "gr101", "gr102", "gr103", "gr104", \
- "gr105", "gr106", "gr107", "gr108", "gr109", "gr110", "gr111", "gr112", \
- "gr113", "gr114", "gr115", "gr116", "gr117", "gr118", "gr119", "gr120", \
- "gr121", "gr122", "gr123", "gr124", "gr125", "gr126", "gr127", \
- "lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", "lr8", "lr9", \
- "lr10", "lr11", "lr12", "lr13", "lr14", "lr15", "lr16", "lr17", "lr18", \
- "lr19", "lr20", "lr21", "lr22", "lr23", "lr24", "lr25", "lr26", "lr27", \
- "lr28", "lr29", "lr30", "lr31", "lr32", "lr33", "lr34", "lr35", "lr36", \
- "lr37", "lr38", "lr39", "lr40", "lr41", "lr42", "lr43", "lr44", "lr45", \
- "lr46", "lr47", "lr48", "lr49", "lr50", "lr51", "lr52", "lr53", "lr54", \
- "lr55", "lr56", "lr57", "lr58", "lr59", "lr60", "lr61", "lr62", "lr63", \
- "lr64", "lr65", "lr66", "lr67", "lr68", "lr69", "lr70", "lr71", "lr72", \
- "lr73", "lr74", "lr75", "lr76", "lr77", "lr78", "lr79", "lr80", "lr81", \
- "lr82", "lr83", "lr84", "lr85", "lr86", "lr87", "lr88", "lr89", "lr90", \
- "lr91", "lr92", "lr93", "lr94", "lr95", "lr96", "lr97", "lr98", "lr99", \
- "lr100", "lr101", "lr102", "lr103", "lr104", "lr105", "lr106", "lr107", \
- "lr108", "lr109", "lr110", "lr111", "lr112", "lr113", "lr114", "lr115", \
- "lr116", "lr117", "lr118", "lr119", "lr120", "lr121", "lr122", "lr123", \
- "lr124", "lr125", "lr126", "lr127", \
- "AI0", "AI1", "AI2", "AI3", "AI4", "AI5", "AI6", "AI7", "AI8", "AI9", \
- "AI10", "AI11", "AI12", "AI13", "AI14", "AI15", "FP", \
- "bp", "fc", "cr", "q", \
- "vab", "ops", "cps", "cfg", "cha", "chd", "chc", "rbp", "tmc", "tmr", \
- "pc0", "pc1", "pc2", "mmu", "lru", "fpe", "int", "fps", "exo", \
- "0", "1", "2", "3", \
- "gr64", "gr65", "gr66", "gr67", "gr68", "gr69", "gr70", "gr71", \
- "gr72", "gr73", "gr74", "gr75", "gr76", "gr77", "gr78", "gr79", \
- "gr80", "gr81", "gr82", "gr83", "gr84", "gr85", "gr86", "gr87", \
- "gr88", "gr89", "gr90", "gr91", "gr92", "gr93", "gr94", "gr95" }
-
-/* How to renumber registers for dbx and gdb. */
-
-extern int a29k_debug_reg_map[];
-#define DBX_REGISTER_NUMBER(REGNO) a29k_debug_reg_map[REGNO]
-
-/* This how to write an assembler directive to FILE to switch to
- section NAME for DECL. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- fprintf (FILE, "\t.sect %s, bss\n\t.use %s\n", NAME, NAME)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to output a label for a jump table. Arguments are the same as
- for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
- passed. */
-
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
-{ ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.double %.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- fprintf (FILE, "\t.float %.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.hword "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tsub %s,%s,4\n\tstore 0,0,%s,%s\n", \
- reg_names[R_MSP], reg_names[R_MSP], reg_names[REGNO], \
- reg_names[R_MSP]);
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tload 0,0,%s,%s\n\tadd %s,%s,4\n", \
- reg_names[REGNO], reg_names[R_MSP], reg_names[R_MSP], \
- reg_names[R_MSP]);
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.word L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative.
- Don't define this if it is not supported. */
-
-/* #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) */
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", 1 << (LOG))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.block %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
-( fputs ("\t.lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-/* Determine which codes are valid without a following integer. These must
- not be alphabetic.
-
- We support `#' which is null if a delay slot exists, otherwise
- "\n\tnop" and `*' which prints the register name for TPC (gr122). */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '#' || (CODE) == '*')
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx addr = ADDR; \
- if (!REG_P (addr) \
- && ! (GET_CODE (addr) == CONST_INT \
- && INTVAL (addr) >= 0 && INTVAL (addr) < 256)) \
- abort (); \
- output_operand (addr, 0); \
-}
-/* Define the codes that are matched by predicates in a29k.c. */
-
-#define PREDICATE_CODES \
- {"cint_8_operand", {CONST_INT}}, \
- {"cint_16_operand", {CONST_INT}}, \
- {"long_const_operand", {CONST_INT, CONST, CONST_DOUBLE, \
- LABEL_REF, SYMBOL_REF}}, \
- {"shift_constant_operand", {CONST_INT, ASHIFT}}, \
- {"const_0_operand", {CONST_INT, ASHIFT}}, \
- {"const_8_operand", {CONST_INT, ASHIFT}}, \
- {"const_16_operand", {CONST_INT, ASHIFT}}, \
- {"const_24_operand", {CONST_INT, ASHIFT}}, \
- {"float_const_operand", {CONST_DOUBLE}}, \
- {"gpc_reg_operand", {SUBREG, REG}}, \
- {"gpc_reg_or_float_constant_operand", {SUBREG, REG, CONST_DOUBLE}}, \
- {"gpc_reg_or_integer_constant_operand", {SUBREG, REG, \
- CONST_INT, CONST_DOUBLE}}, \
- {"gpc_reg_or_immediate_operand", {SUBREG, REG, CONST_INT, \
- CONST_DOUBLE, CONST, \
- SYMBOL_REF, LABEL_REF}}, \
- {"spec_reg_operand", {REG}}, \
- {"accum_reg_operand", {REG}}, \
- {"srcb_operand", {SUBREG, REG, CONST_INT}}, \
- {"cmplsrcb_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_immediate_operand", {SUBREG, REG, CONST_INT, CONST, \
- CONST_DOUBLE, CONST, SYMBOL_REF, LABEL_REF}}, \
- {"reg_or_u_short_operand", {SUBREG, REG, CONST_INT}}, \
- {"and_operand", {SUBREG, REG, CONST_INT}}, \
- {"add_operand", {SUBREG, REG, CONST_INT}}, \
- {"call_operand", {SYMBOL_REF, CONST_INT}}, \
- {"in_operand", {SUBREG, MEM, REG, CONST_INT, CONST, SYMBOL_REF, \
- LABEL_REF, CONST_DOUBLE}}, \
- {"out_operand", {SUBREG, REG, MEM}}, \
- {"reload_memory_operand", {SUBREG, REG, MEM}}, \
- {"fp_comparison_operator", {EQ, GT, GE}}, \
- {"branch_operator", {GE, LT}}, \
- {"load_multiple_operation", {PARALLEL}}, \
- {"store_multiple_operation", {PARALLEL}}, \
- {"epilogue_operand", {CODE_LABEL}},
diff --git a/gcc/config/a29k/a29k.md b/gcc/config/a29k/a29k.md
deleted file mode 100644
index cc4f422b0f2..00000000000
--- a/gcc/config/a29k/a29k.md
+++ /dev/null
@@ -1,2874 +0,0 @@
-;;- Machine description for AMD Am29000 for GNU C compiler
-;; Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
-;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-;; 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.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; The insns in this file are presented in the same order as the AMD 29000
-;; User's Manual (i.e., alphabetical by machine op-code).
-;;
-;; DEFINE_EXPAND's are located near the first occurrence of the major insn
-;; that they generate.
-
-;; The only attribute we have is the type. We only care about calls, branches,
-;; loads, stores, floating-point operations, and multi-word insns.
-;; Everything else is miscellaneous.
-
-(define_attr "type"
- "call,branch,load,store,fadd,fmul,fam,fdiv,fsqrt,dmul,dam,ddiv,dsqrt,multi,misc"
- (const_string "misc"))
-
-;; ASM insns cannot go into a delay slot, so call them "multi".
-(define_asm_attributes [(set_attr "type" "multi")])
-
-(define_attr "in_delay_slot" "yes,no"
- (if_then_else (eq_attr "type" "call,branch,multi") (const_string "no")
- (const_string "yes")))
-
-;; Branch and call insns require a single delay slot. Annulling is not
-;; supported.
-(define_delay (eq_attr "type" "call,branch")
- [(eq_attr "in_delay_slot" "yes") (nil) (nil)])
-
-;; Define the function unit usages. We first define memory as a unit.
-(define_function_unit "memory" 1 0 (eq_attr "type" "load") 6 5
- [(eq_attr "type" "load")])
-(define_function_unit "memory" 1 0 (eq_attr "type" "load") 6 6
- [(eq_attr "type" "store")])
-(define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
-
-;; Now define the function units for the floating-point support. Most
-;; units are pipelined and can accept an input every cycle.
-;;
-;; Note that we have an inaccuracy here. If a fmac insn is issued, followed
-;; 2 cycles later by a fadd, there will be a conflict for the floating
-;; adder that we can't represent. Also, all insns will conflict for the
-;; floating-point rounder. It isn't clear how to represent this.
-
-(define_function_unit "multiplier" 1 0 (eq_attr "type" "fmul") 3 0)
-(define_function_unit "multiplier" 1 0 (eq_attr "type" "dmul") 6 4)
-(define_function_unit "multiplier" 1 0 (eq_attr "type" "fam") 6 0)
-(define_function_unit "multiplier" 1 0 (eq_attr "type" "dam") 9 4)
-
-(define_function_unit "adder" 1 0 (eq_attr "type" "fadd,fam,dam") 3 0)
-
-(define_function_unit "divider" 1 0 (eq_attr "type" "fdiv") 11 10)
-(define_function_unit "divider" 1 0 (eq_attr "type" "fsqrt") 28 27)
-(define_function_unit "divider" 1 0 (eq_attr "type" "ddiv") 18 17)
-(define_function_unit "divider" 1 0 (eq_attr "type" "dsqrt") 57 56)
-
-;; ADD
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
- (match_operand:SI 2 "add_operand" "rI,N")))]
- ""
- "@
- add %0,%1,%2
- sub %0,%1,%n2")
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
- (match_operand:DI 2 "gpc_reg_operand" "r")))]
- ""
- "add %L0,%L1,%L2\;addc %0,%1,%2"
- [(set_attr "type" "multi")])
-
-;; AND/ANDN
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
- (match_operand:SI 2 "and_operand" "rI,K")))]
- ""
- "@
- and %0,%1,%2
- andn %0,%1,%C2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
- (match_operand:SI 2 "cmplsrcb_operand" "r,K")))]
- ""
- "@
- andn %0,%2,%1
- nor %0,%1,%C2")
-
-;; CALLI
-;;
-;; Each call pattern is duplicated so that we can add CLOBBERs to the
-;; resulting insn.
-;;
-;; We indicate that LR0 is clobbered in the CALL_INSN itself. Otherwise,
-;; reorg will think it is just clobbered by the called function.
-
-(define_expand "call"
- [(use (match_operand:SI 0 "" ""))
- (use (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))]
- ""
- "
-{ rtx insn = emit_call_insn (gen_call_internal (operands[0], operands[1]));
- a29k_clobbers_to (insn, operands[2]);
-
- DONE;
-}")
-
-(define_expand "call_internal"
- [(parallel [(call (match_operand:SI 0 "" "")
- (match_operand 1 "" ""))
- (clobber (scratch:SI))])]
- ""
- "
-{
- if (GET_CODE (operands[0]) != MEM)
- abort ();
-
- /* We tell here whether this is a recursive call, since this insn may
- later be inlined into another function. */
- if (! TARGET_SMALL_MEMORY
- && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
- operands[0] = gen_rtx (MEM, SImode,
- force_reg (Pmode, XEXP (operands[0], 0)));
-}")
-
-(define_expand "call_value"
- [(use (match_operand:SI 0 "gpc_reg_operand" ""))
- (use (match_operand:SI 1 "" ""))
- (use (match_operand 2 "" ""))
- (use (match_operand 3 "" ""))]
- ""
- "
-{ rtx insn = emit_call_insn (gen_call_value_internal (operands[0], operands[1],
- operands[2]));
-
- a29k_clobbers_to (insn, operands[3]);
- DONE;
-}")
-
-(define_expand "call_value_internal"
- [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (call (match_operand:SI 1 "" "")
- (match_operand 2 "" "")))
- (clobber (scratch:SI))])]
- ""
- "
-{
- if (GET_CODE (operands[1]) != MEM)
- abort ();
-
- /* We tell here whether this is a recursive call, since this insn may
- later be inlined into another function. */
- if (! TARGET_SMALL_MEMORY
- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
- operands[1] = gen_rtx (MEM, SImode,
- force_reg (Pmode, XEXP (operands[1], 0)));
-
-}")
-
-(define_insn ""
- [(call (match_operand:SI 0 "memory_operand" "m")
- (match_operand 1 "" ""))
- (clobber (match_scratch:SI 2 "=&l"))]
- "GET_CODE (XEXP (operands[0], 0)) != CONST_INT"
- "calli lr0,%0%#"
- [(set_attr "type" "call")])
-
-(define_insn ""
- [(call (mem:SI (match_operand:SI 0 "call_operand" "i"))
- (match_operand:SI 1 "general_operand" "g"))
- (clobber (match_scratch:SI 2 "=&l"))]
- ""
- "call lr0,%F0"
- [(set_attr "type" "call")])
-
-(define_insn ""
- [(set (match_operand 0 "gpc_reg_operand" "=r")
- (call (match_operand:SI 1 "memory_operand" "m")
- (match_operand 2 "" "")))
- (clobber (match_scratch:SI 3 "=&l"))]
- "GET_CODE (XEXP (operands[1], 0)) != CONST_INT"
- "calli lr0,%1%#"
- [(set_attr "type" "call")])
-
-(define_insn ""
- [(set (match_operand 0 "gpc_reg_operand" "=r")
- (call (mem:SI (match_operand:SI 1 "call_operand" "i"))
- (match_operand:SI 2 "general_operand" "g")))
- (clobber (match_scratch:SI 3 "=&l"))]
- ""
- "call lr0,%F1"
- [(set_attr "type" "call")])
-
-(define_expand "probe"
- [(call (mem:SI (symbol_ref:SI "_msp_check"))
- (const_int 1))]
- "TARGET_STACK_CHECK"
- "")
-
-;; This is used for internal routine calls via TPC. Currently used only
-;; in probe, above.
-(define_insn ""
- [(call (mem:SI (match_operand:SI 0 "immediate_operand" "s"))
- (const_int 1))]
- ""
- "call %*,%0"
- [(set_attr "type" "call")])
-
-;; CONST, CONSTH, CONSTN
-;;
-;; Many of these are generated from move insns.
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (match_operand:SI 1 "immediate_operand" "i")
- (const_int 65535)))]
- ""
- "const %0,%1")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (const_int 16)
- (match_operand:SI 1 "const_0_operand" ""))
- (ashiftrt:SI (match_operand:SI 2 "immediate_operand" "i")
- (const_int 16)))]
- ""
- "consth %0,%2")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (const_int 16)
- (match_operand:SI 1 "const_0_operand" ""))
- (match_operand:SI 2 "cint_16_operand" "J"))]
- ""
- "consth %0,%m2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "0"))
- (match_operand:SI 2 "const_int_operand" "n")))]
- "(INTVAL (operands[2]) & 0xffff) == 0"
- "consth %0,%2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "0"))
- (and:SI (match_operand:SI 2 "immediate_operand" "i")
- (const_int -65536))))]
- ""
- "consth %0,%2")
-
-;; CONVERT
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (fix:SI (match_operand:SF 1 "register_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,0,3,0,1")
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (fix:SI (match_operand:DF 1 "register_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,0,3,0,2")
-
-(define_insn "fixuns_truncsfsi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (unsigned_fix:SI (match_operand:SF 1 "register_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,1,3,0,1")
-
-(define_insn "fixuns_truncdfsi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (unsigned_fix:SI (match_operand:DF 1 "register_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,1,3,0,2")
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (float_truncate:SF (match_operand:DF 1 "register_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,0,4,1,2")
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (float_extend:DF (match_operand:SF 1 "register_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,0,4,2,1")
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (float:SF (match_operand:SI 1 "gpc_reg_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,0,4,1,0")
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,0,4,2,0")
-
-(define_insn "floatunssisf2"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,1,4,1,0")
-
-(define_insn "floatunssidf2"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "convert %0,%1,1,4,2,0")
-
-;; CPxxx, DEQ, DGT, DGE, FEQ, FGT, FGE
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (match_operator 3 "comparison_operator"
- [(match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "srcb_operand" "rI")]))]
- ""
- "cp%J3 %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (match_operator 3 "fp_comparison_operator"
- [(match_operand:SF 1 "register_operand" "r")
- (match_operand:SF 2 "register_operand" "r")]))]
- "! TARGET_SOFT_FLOAT"
- "f%J3 %0,%1,%2"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (match_operator 3 "fp_comparison_operator"
- [(match_operand:DF 1 "register_operand" "r")
- (match_operand:DF 2 "register_operand" "r")]))]
- "! TARGET_SOFT_FLOAT"
- "d%J3 %0,%1,%2"
- [(set_attr "type" "fadd")])
-
-;; DADD
-(define_expand "adddf3"
- [(set (match_operand:DF 0 "register_operand" "")
- (plus:DF (match_operand:DF 1 "register_operand" "")
- (match_operand:DF 2 "register_operand" "")))]
- "! TARGET_SOFT_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r")
- (plus:DF (match_operand:DF 1 "register_operand" "%r")
- (match_operand:DF 2 "register_operand" "r")))]
- "! TARGET_29050 "
- "dadd %0,%1,%2"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,a")
- (plus:DF (match_operand:DF 1 "register_operand" "%r,r")
- (match_operand:DF 2 "register_operand" "r,0")))]
- "TARGET_29050"
- "@
- dadd %0,%1,%2
- dmac 8,%0,%1,%1"
- [(set_attr "type" "fadd,dam")])
-
-;; DDIV
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (div:DF (match_operand:DF 1 "register_operand" "=r")
- (match_operand:DF 2 "register_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "ddiv %0,%1,%2"
- [(set_attr "type" "ddiv")])
-
-;; DIVIDE
-;;
-;; We must set Q to the sign extension of the dividend first. For MOD, we
-;; must get the remainder from Q.
-;;
-;; For divmod: operand 1 is divided by operand 2; quotient goes to operand
-;; 0 and remainder to operand 3.
-(define_expand "divmodsi4"
- [(set (match_dup 4)
- (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (const_int 31)))
- (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (div:SI (match_dup 1)
- (match_operand:SI 2 "gpc_reg_operand" "")))
- (set (match_operand:SI 3 "gpc_reg_operand" "")
- (mod:SI (match_dup 1)
- (match_dup 2)))
- (use (match_dup 4))])]
- ""
- "
-{
- operands[4] = gen_reg_rtx (SImode);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (set (match_operand:SI 3 "register_operand" "=q")
- (mod:SI (match_dup 1)
- (match_dup 2)))
- (use (match_operand:SI 4 "register_operand" "3"))]
- ""
- "divide %0,%1,%2")
-
-;; DIVIDU
-;;
-;; Similar to DIVIDE.
-(define_expand "udivmodsi4"
- [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "gpc_reg_operand" "")))
- (set (match_operand:SI 3 "gpc_reg_operand" "")
- (umod:SI (match_dup 1)
- (match_dup 2)))
- (use (const_int 0))])]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (set (match_operand:SI 3 "register_operand" "=q")
- (umod:SI (match_dup 1)
- (match_dup 2)))
- (use (match_operand:SI 4 "const_int_operand" "3"))]
- ""
- "dividu %0,%1,%2")
-
-;; DMAC/DMSM
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=a,*r")
- (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "%r,A")
- (match_operand:DF 2 "register_operand" "r,r"))
- (match_operand:DF 3 "register_operand" "0,*r")))]
- "TARGET_29050"
- "@
- dmac 0,%0,%1,%2
- dmsm %0,%2,%3"
- [(set_attr "type" "dam")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=a")
- (plus:DF (mult:DF (neg:DF (match_operand:DF 1 "register_operand" "r"))
- (match_operand:DF 2 "register_operand" "r"))
- (match_operand:DF 3 "register_operand" "0")))]
- "TARGET_29050"
- "dmac 1,%0,%2,%1"
- [(set_attr "type" "dam")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=a")
- (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "%r")
- (match_operand:DF 2 "register_operand" "r"))
- (match_operand:DF 3 "register_operand" "0")))]
- "TARGET_29050"
- "dmac 2,%0,%1,%2"
- [(set_attr "type" "dam")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=a")
- (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "r")
- (neg:DF (match_operand:DF 2 "register_operand" "r")))
- (match_operand:DF 3 "register_operand" "0")))]
- "TARGET_29050"
- "dmac 3,%0,%1,%2"
- [(set_attr "type" "dam")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=a")
- (mult:DF (neg:DF (match_operand:DF 1 "register_operand" "r"))
- (match_operand:DF 2 "register_operand" "r")))]
- "TARGET_29050"
- "dmac 5,%0,%2,%1"
- [(set_attr "type" "dam")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=a")
- (minus:DF (neg:DF (match_operand:DF 1 "register_operand" "r"))
- (match_operand:DF 2 "register_operand" "0")))]
- "TARGET_29050"
- "dmac 11,%0,%1,%1"
- [(set_attr "type" "dam")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=a")
- (neg:DF (plus:DF (match_operand:DF 1 "register_operand" "%r")
- (match_operand:DF 2 "register_operand" "0"))))]
- "TARGET_29050"
- "dmac 11,%0,%1,%1"
- [(set_attr "type" "dam")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,r,a")
- (neg:DF (match_operand:DF 1 "register_operand" "0,r,r")))
- (clobber (match_scratch:SI 2 "=&r,&r,X"))]
- "TARGET_29050"
- "@
- cpeq %2,gr1,gr1\;xor %0,%1,%2
- cpeq %2,gr1,gr1\;xor %0,%1,%2\;sll %L0,%L1,0
- dmac 13,%0,%1,%1"
- [(set_attr "type" "multi,multi,dam")])
-
-;; DMUL
-(define_expand "muldf3"
- [(set (match_operand:DF 0 "register_operand" "")
- (mult:DF (match_operand:DF 1 "register_operand" "")
- (match_operand:DF 2 "register_operand" "")))]
- "! TARGET_SOFT_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r")
- (mult:DF (match_operand:DF 1 "register_operand" "%r")
- (match_operand:DF 2 "register_operand" "r")))]
- "! TARGET_29050"
- "dmul %0,%1,%2"
- [(set_attr "type" "dmul")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,a")
- (mult:DF (match_operand:DF 1 "register_operand" "%r,r")
- (match_operand:DF 2 "register_operand" "r,r")))]
- "TARGET_29050"
- "@
- dmul %0,%1,%2
- dmac 4,%0,%1,%2"
- [(set_attr "type" "dmul,dam")])
-
-;; DSUB
-(define_expand "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (minus:DF (match_operand:DF 1 "register_operand" "r")
- (match_operand:DF 2 "register_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r")
- (minus:DF (match_operand:DF 1 "register_operand" "r")
- (match_operand:DF 2 "register_operand" "r")))]
- "! TARGET_29050"
- "dsub %0,%1,%2"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,a,a")
- (minus:DF (match_operand:DF 1 "register_operand" "r,0,r")
- (match_operand:DF 2 "register_operand" "r,r,0")))]
- "TARGET_29050"
- "@
- dsub %0,%1,%2
- dmac 9,%0,%2,%2
- dmac 10,%0,%1,%1"
- [(set_attr "type" "fadd,dam,dam")])
-
-;; EXBYTE
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (match_operand:SI 1 "srcb_operand" "rI")
- (const_int -256))
- (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
- (const_int 8)
- (ashift:PSI
- (match_operand:PSI 3 "register_operand" "b")
- (const_int 3)))))]
- ""
- "exbyte %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 8)
- (ashift:PSI
- (match_operand:PSI 2 "register_operand" "b")
- (const_int 3))))]
- ""
- "exbyte %0,%1,0")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (const_int 8)
- (match_operand:PSI 1 "const_24_operand" ""))
- (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
- (const_int 8)
- (ashift:PSI
- (match_operand:PSI 3 "register_operand" "b")
- (const_int 3))))]
- ""
- "exbyte %0,%2,%0")
-
-(define_expand "extzv"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))]
- ""
- "
-{
- int size, pos;
-
- if (GET_CODE (operands[2]) != CONST_INT
- || GET_CODE (operands[3]) != CONST_INT)
- FAIL;
-
- size = INTVAL (operands[2]);
- pos = INTVAL (operands[3]);
-
- /* Can't do this unless a byte extraction. If extracting the high
- or low byte, don't do this because a shift or AND is shorter.
- Don't do 16-bit extracts, since the only two are the high and low
- ends, and it is faster to do them with CONSTH and SRL. */
-
- if (size != 8 || (pos != 8 && pos != 16))
- FAIL;
-
- operands[3] = gen_rtx (ASHIFT, PSImode,
- force_reg (PSImode, GEN_INT (pos / 8)),
- GEN_INT (3));
-
-}")
-
-;; EXHW
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (match_operand:SI 1 "srcb_operand" "rI")
- (const_int -65536))
- (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
- (const_int 16)
- (ashift:PSI
- (match_operand:PSI 3 "register_operand" "b")
- (const_int 3)))))]
- ""
- "exhw %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 16)
- (ashift:PSI
- (match_operand:PSI 2 "register_operand" "b")
- (const_int 3))))]
- ""
- "exhw %0,%1,0")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (const_int 16)
- (match_operand:PSI 1 "const_16_operand" ""))
- (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
- (const_int 16)
- (ashift:PSI
- (match_operand:PSI 3 "register_operand" "b")
- (const_int 3))))]
- ""
- "exhw %0,%2,%0")
-
-;; EXHWS
-;;
-;; This is probably unused. The high-order 16-bits are obtained with an SRA
-;; insn. The low-order 16 bits are a sign-extend, which is a pair of
-;; shifts. Setting BP followed by the insn is equivalent, so we don't
-;; bother going to any trouble to generate this insn.
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (sign_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 16)
- (ashift:PSI
- (match_operand:PSI 2 "register_operand" "b")
- (const_int 3))))]
- ""
- "exhws %0,%1")
-
-;; EXTRACT
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:PSI 2 "register_operand" "f")))]
- ""
- "extract %0,%1,%1")
-
-(define_expand "rotlsi3"
- [(set (match_dup 3)
- (match_operand:SI 2 "gpc_reg_or_immediate_operand" ""))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_dup 3)))]
- ""
- "
-{ operands[2] = gen_lowpart (PSImode, operands[2]);
- operands[3] = gen_reg_rtx (PSImode);
-}")
-
-;; It would be nice to be able to have a define_split corresponding to the
-;; above, but there is no way to tell combine we need a PSImode temporary.
-;; If we put a (clobber (scratch:PSI)) there, combine would merge the above
-;; two insns. This is bad because it then thinks only one insn is needed.
-
-;; FADD
-(define_expand "addsf3"
- [(set (match_operand:SF 0 "register_operand" "")
- (plus:SF (match_operand:SF 1 "register_operand" "")
- (match_operand:SF 2 "register_operand" "")))]
- "! TARGET_SOFT_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r")
- (plus:SF (match_operand:SF 1 "register_operand" "%r")
- (match_operand:SF 2 "register_operand" "r")))]
- "! TARGET_29050"
- "fadd %0,%1,%2"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r,a")
- (plus:SF (match_operand:SF 1 "register_operand" "%r,r")
- (match_operand:SF 2 "register_operand" "r,0")))]
- "TARGET_29050"
- "@
- fadd %0,%1,%2
- fmac 8,%0,%1,%1"
- [(set_attr "type" "fadd,fam")])
-
-;; FDIV
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (div:SF (match_operand:SF 1 "register_operand" "=r")
- (match_operand:SF 2 "register_operand" "r")))]
- "! TARGET_SOFT_FLOAT"
- "fdiv %0,%1,%2"
- [(set_attr "type" "fdiv")])
-
-;; FDMUL
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r")
- (mult:DF (float_extend:DF (match_operand:SF 1 "register_operand" "%r"))
- (float_extend:DF (match_operand:SF 2 "register_operand" "r"))))]
- "! TARGET_SOFT_FLOAT"
- "fdmul %0,%1,%2")
-
-;; FMAC/FMSM
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=a,*r")
- (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%r,A")
- (match_operand:SF 2 "register_operand" "r,r"))
- (match_operand:SF 3 "register_operand" "0,*r")))]
- "TARGET_29050"
- "@
- fmac 0,%0,%1,%2
- fmsm %0,%2,%3"
- [(set_attr "type" "fam")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=a")
- (plus:SF (mult:SF (neg:SF (match_operand:SF 1 "register_operand" "r"))
- (match_operand:SF 2 "register_operand" "r"))
- (match_operand:SF 3 "register_operand" "0")))]
- "TARGET_29050"
- "fmac 1,%0,%2,%1"
- [(set_attr "type" "fam")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=a")
- (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "%r")
- (match_operand:SF 2 "register_operand" "r"))
- (match_operand:SF 3 "register_operand" "0")))]
- "TARGET_29050"
- "fmac 2,%0,%1,%2"
- [(set_attr "type" "fam")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=a")
- (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "register_operand" "r"))
- (match_operand:SF 2 "register_operand" "r"))
- (match_operand:SF 3 "register_operand" "0")))]
- "TARGET_29050"
- "fmac 3,%0,%2,%1"
- [(set_attr "type" "fam")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=a")
- (mult:SF (neg:SF (match_operand:SF 1 "register_operand" "r"))
- (match_operand:SF 2 "register_operand" "r")))]
- "TARGET_29050"
- "fmac 5,%0,%2,%1"
- [(set_attr "type" "fam")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=a")
- (minus:SF (neg:SF (match_operand:SF 1 "register_operand" "%r"))
- (match_operand:SF 2 "register_operand" "0")))]
- "TARGET_29050"
- "fmac 11,%0,%1,%1"
- [(set_attr "type" "fam")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=a")
- (neg:SF (plus:SF (match_operand:SF 1 "register_operand" "%r")
- (match_operand:SF 2 "register_operand" "0"))))]
- "TARGET_29050"
- "fmac 11,%0,%1,%1"
- [(set_attr "type" "fam")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r,a")
- (neg:SF (match_operand:SF 1 "register_operand" "r,r")))
- (clobber (match_scratch:SI 2 "=&r,X"))]
- "TARGET_29050"
- "@
- cpeq %2,gr1,gr1\;xor %0,%1,%2
- fmac 13,%0,%1,%1"
- [(set_attr "type" "multi,fam")])
-
-;; FMUL
-(define_expand "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "")
- (mult:SF (match_operand:SF 1 "register_operand" "")
- (match_operand:SF 2 "register_operand" "")))]
- "! TARGET_SOFT_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r")
- (mult:SF (match_operand:SF 1 "register_operand" "%r")
- (match_operand:SF 2 "register_operand" "r")))]
- "! TARGET_29050"
- "fmul %0,%1,%2"
- [(set_attr "type" "fmul")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r,a")
- (mult:SF (match_operand:SF 1 "register_operand" "%r,r")
- (match_operand:SF 2 "register_operand" "r,r")))]
- "TARGET_29050"
- "@
- fmul %0,%1,%2
- fmac 4,%0,%1,%2"
- [(set_attr "type" "fmul,fam")])
-
-;; FSUB
-(define_expand "subsf3"
- [(set (match_operand:SF 0 "register_operand" "")
- (minus:SF (match_operand:SF 1 "register_operand" "")
- (match_operand:SF 2 "register_operand" "")))]
- "! TARGET_SOFT_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r")
- (minus:SF (match_operand:SF 1 "register_operand" "r")
- (match_operand:SF 2 "register_operand" "r")))]
- "! TARGET_29050"
- "fsub %0,%1,%2"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r,a,a")
- (minus:SF (match_operand:SF 1 "register_operand" "r,0,r")
- (match_operand:SF 2 "register_operand" "r,r,0")))]
- "TARGET_29050"
- "@
- fsub %0,%1,%2
- fmac 9,%0,%2,%2
- fmac 10,%0,%1,%1"
- [(set_attr "type" "fadd,fam,fam")])
-
-;; INBYTE
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (const_int 8)
- (ashift:PSI
- (match_operand:PSI 2 "register_operand" "b")
- (const_int 3)))
- (match_operand:SI 1 "srcb_operand" "rI"))]
- ""
- "inbyte %0,%0,%1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI
- (not:SI
- (ashift:SI (const_int 255)
- (ashift:PSI
- (match_operand:PSI 3 "register_operand" "b")
- (const_int 3))))
- (match_operand:SI 1 "gpc_reg_operand" "r"))
- (ashift:SI (zero_extend:SI
- (match_operand:QI 2 "srcb_operand" "rI"))
- (ashift:PSI (match_dup 3) (const_int 3)))))]
- ""
- "inbyte %0,%1,%2")
-
-;; INHW
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (const_int 16)
- (ashift:PSI
- (match_operand:PSI 2 "register_operand" "b")
- (const_int 3)))
- (match_operand:SI 1 "srcb_operand" "rI"))]
- ""
- "inhw %0,%0,%1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI
- (not:SI
- (ashift:SI (const_int 65535)
- (ashift:PSI
- (match_operand:PSI 3 "register_operand" "b")
- (const_int 3))))
- (match_operand:SI 1 "gpc_reg_operand" "r"))
- (ashift:SI (zero_extend:SI
- (match_operand:HI 2 "srcb_operand" "rI"))
- (ashift:PSI (match_dup 3) (const_int 3)))))]
- ""
- "inhw %0,%1,%2")
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "")
- (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" ""))
- (match_operand:SI 3 "srcb_operand" ""))]
- ""
- "
-{
- int size, pos;
-
- if (GET_CODE (operands[1]) != CONST_INT
- || GET_CODE (operands[2]) != CONST_INT)
- FAIL;
-
- size = INTVAL (operands[1]);
- pos = INTVAL (operands[2]);
- if ((size != 8 && size != 16) || pos % size != 0)
- FAIL;
-
- operands[2] = gen_rtx (ASHIFT, PSImode,
- force_reg (PSImode, GEN_INT (pos / 8)),
- GEN_INT (3));
-}")
-
-;; LOAD (also used by move insn).
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (mem:SI (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int -4))))
- (set (match_operand:PSI 2 "register_operand" "=b")
- (truncate:PSI (match_dup 1)))]
- "! TARGET_DW_ENABLE"
- "load 0,16,%0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
- "TARGET_DW_ENABLE"
- "load 0,1,%0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
- (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
- "TARGET_DW_ENABLE"
- "load 0,1,%0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
- "TARGET_DW_ENABLE"
- "load 0,2,%0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))
- (clobber (match_scratch:PSI 2 "=&b"))]
- "TARGET_DW_ENABLE"
- "load 0,17,%0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
- (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))
- (clobber (match_scratch:PSI 2 "=&b"))]
- "TARGET_DW_ENABLE"
- "load 0,17,%0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))
- (clobber (match_scratch:PSI 2 "=&b"))]
- "TARGET_DW_ENABLE"
- "load 0,18,%0,%1"
- [(set_attr "type" "load")])
-
-;; LOADM
-(define_expand "load_multiple"
- [(set (match_dup 4)
- (match_operand:PSI 2 "const_int_operand" ""))
- (match_par_dup 3 [(set (match_operand:SI 0 "" "")
- (match_operand:SI 1 "" ""))])]
- ""
- "
-{
- int regno;
- int count;
- rtx from;
- int i;
-
- /* Support only loading a constant number of hard registers from memory. */
- if (GET_CODE (operands[2]) != CONST_INT
- || operands[2] == const1_rtx
- || GET_CODE (operands[1]) != MEM
- || GET_CODE (operands[0]) != REG
- || REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
- FAIL;
-
- count = INTVAL (operands[2]);
- regno = REGNO (operands[0]);
-
- /* CR gets set to the number of registers minus one. */
- operands[2] = GEN_INT(count - 1);
-
- operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 2));
- from = memory_address (SImode, XEXP (operands[1], 0));
- XVECEXP (operands[3], 0, 0) = gen_rtx (SET, VOIDmode,
- gen_rtx (REG, SImode, regno),
- gen_rtx (MEM, SImode, from));
- operands[4] = gen_reg_rtx (PSImode);
-
- XVECEXP (operands[3], 0, 1) = gen_rtx (USE, VOIDmode, operands[4]);
- XVECEXP (operands[3], 0, 2) = gen_rtx (CLOBBER, VOIDmode, operands[4]);
-
- for (i = 1; i < count; i++)
- XVECEXP (operands[3], 0, i + 2)
- = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
- gen_rtx (MEM, SImode, plus_constant (from, i * 4)));
-}")
-
-;; Indicate that CR is used and is then clobbered.
-(define_insn ""
- [(set (match_operand 0 "gpc_reg_operand" "=r")
- (match_operand 1 "memory_operand" "m"))
- (use (match_operand:PSI 2 "register_operand" "+c"))
- (clobber (match_dup 2))]
- "GET_MODE (operands[0]) == GET_MODE (operands[1])
- && GET_MODE_SIZE (GET_MODE (operands[0])) > UNITS_PER_WORD"
- "loadm 0,0,%0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(match_parallel 0 "load_multiple_operation"
- [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
- (match_operand:SI 2 "memory_operand" "m"))
- (use (match_operand:PSI 3 "register_operand" "+c"))
- (clobber (match_dup 3))])]
- ""
- "loadm 0,0,%1,%2"
- [(set_attr "type" "load")])
-
-;; MTSR (used also by move insn)
-(define_insn ""
- [(set (match_operand:SI 0 "spec_reg_operand" "=*h,*h")
- (and:SI (match_operand:SI 1 "gpc_reg_or_immediate_operand" "r,i")
- (match_operand:SI 2 "const_int_operand" "n,n")))]
- "masks_bits_for_special (operands[0], operands[2])"
- "@
- mtsr %0,%1
- mtsrim %0,%1")
-
-(define_insn ""
- [(set (match_operand:PSI 0 "register_operand" "=h,h")
- (truncate:PSI
- (match_operand:SI 1 "gpc_reg_or_immediate_operand" "r,i")))]
- ""
- "@
- mtsr %0,%1
- mtsrim %0,%1")
-
-;; MULTIPLY, MULTM, MULTMU
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (clobber (match_scratch:SI 3 "=&q"))]
- ""
- "multiply %0,%1,%2")
-
-(define_insn "mulsidi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
- (clobber (match_scratch:SI 3 "=&q"))]
- "TARGET_MULTM"
- "multiply %L0,%1,%2\;multm %0,%1,%2"
- [(set_attr "type" "multi")])
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
- (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))
- (clobber (reg:SI 180))]
- "reload_completed"
- [(parallel [(set (match_dup 3)
- (mult:SI (match_dup 1) (match_dup 2)))
- (clobber (reg:SI 180))])
- (parallel [(set (match_dup 4)
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (sign_extend:DI (match_dup 1))
- (sign_extend:DI (match_dup 2)))
- (const_int 32))))
- (clobber (reg:SI 180))])]
- "
-{ operands[3] = operand_subword (operands[0], 1, 1, DImode);
- operands[4] = operand_subword (operands[0], 0, 1, DImode); } ")
-
-(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
- (clobber (match_scratch:SI 3 "=&q"))]
- "TARGET_MULTM"
- "multiplu %L0,%1,%2\;multmu %0,%1,%2"
- [(set_attr "type" "multi")])
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
- (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))
- (clobber (reg:SI 180))]
- "reload_completed"
- [(parallel [(set (match_dup 3)
- (mult:SI (match_dup 1) (match_dup 2)))
- (clobber (reg:SI 180))])
- (parallel [(set (match_dup 4)
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (zero_extend:DI (match_dup 1))
- (zero_extend:DI (match_dup 2)))
- (const_int 32))))
- (clobber (reg:SI 180))])]
- "
-{ operands[3] = operand_subword (operands[0], 1, 1, DImode);
- operands[4] = operand_subword (operands[0], 0, 1, DImode); } ")
-
-(define_insn "smulsi3_highpart"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 32))))
- (clobber (match_scratch:SI 3 "=&q"))]
- "TARGET_MULTM"
- "multm %0,%1,%2")
-
-(define_insn "umulsi3_highpart"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 32))))
- (clobber (match_scratch:SI 3 "=&q"))]
- "TARGET_MULTM"
- "multmu %0,%1,%2")
-
-;; NAND
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
- ""
- "nand %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (match_operand:SI 2 "const_int_operand" "K")))]
- ; Match TARGET_29050 in "orn" pattern for slightly better reload.
- "! TARGET_29050 && ((unsigned) ~ INTVAL (operands[2])) < 256"
- "nand %0,%1,%C2")
-
-;; NOR
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
- ""
- "nor %0,%1,%2")
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
- ""
- "nor %0,%1,0")
-
-;; OR/ORN
-(define_expand "iorsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "srcb_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "srcb_operand" "rI")))]
- "! TARGET_29050"
- "or %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
- (match_operand:SI 2 "and_operand" "rI,K")))]
- "TARGET_29050"
- "@
- or %0,%1,%2
- orn %0,%1,%C2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
- (match_operand:SI 2 "cmplsrcb_operand" "r,K")))]
- "TARGET_29050"
- "@
- orn %0,%2,%1
- nand %0,%1,%C2")
-
-
-;; SLL (also used by move insn)
-(define_insn "nop"
- [(const_int 0)]
- ""
- "aseq 0x40,gr1,gr1")
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:QI 2 "srcb_operand" "rn")))]
- ""
- "sll %0,%1,%Q2")
-
-;; SQRT
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=r")
- (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "r")))]
- "TARGET_29050"
- "sqrt %0,%1,1"
- [(set_attr "type" "fsqrt")])
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=r")
- (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "r")))]
- "TARGET_29050"
- "sqrt %0,%1,2"
- [(set_attr "type" "dsqrt")])
-
-;; SRA
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:QI 2 "srcb_operand" "rn")))]
- ""
- "sra %0,%1,%Q2")
-
-;; SRL
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:QI 2 "srcb_operand" "rn")))]
- ""
- "srl %0,%1,%Q2")
-
-;; STORE
-;;
-;; These somewhat bogus patterns exist to set OPT = 001/010 for partial-word
-;; stores on systems with DW not set.
-(define_insn ""
- [(set (mem:SI (and:SI (match_operand:SI 0 "gpc_reg_operand" "r")
- (const_int -4)))
- (match_operand:SI 1 "gpc_reg_operand" "r"))]
- "! TARGET_DW_ENABLE"
- "store 0,1,%1,%0"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(set (mem:SI (and:SI (match_operand:SI 0 "gpc_reg_operand" "r")
- (const_int -3)))
- (match_operand:SI 1 "gpc_reg_operand" "r"))]
- "! TARGET_DW_ENABLE"
- "store 0,2,%1,%0"
- [(set_attr "type" "store")])
-
-;; STOREM
-(define_expand "store_multiple"
- [(use (match_operand 0 "" ""))
- (use (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))]
- ""
- "
-{ rtx pat;
-
- if (TARGET_NO_STOREM_BUG)
- pat = gen_store_multiple_no_bug (operands[0], operands[1], operands[2]);
- else
- pat = gen_store_multiple_bug (operands[0], operands[1], operands[2]);
-
- if (pat)
- emit_insn (pat);
- else
- FAIL;
-
- DONE;
-}")
-
-(define_expand "store_multiple_no_bug"
- [(set (match_dup 4)
- (match_operand:PSI 2 "const_int_operand" ""))
- (match_par_dup 3 [(set (match_operand:SI 0 "" "")
- (match_operand:SI 1 "" ""))])]
- ""
- "
-{
- int regno;
- int count;
- rtx from;
- int i;
-
- /* Support only storing a constant number of hard registers to memory. */
- if (GET_CODE (operands[2]) != CONST_INT
- || operands[2] == const1_rtx
- || GET_CODE (operands[0]) != MEM
- || GET_CODE (operands[1]) != REG
- || REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
- FAIL;
-
- count = INTVAL (operands[2]);
- regno = REGNO (operands[1]);
-
- /* CR gets set to the number of registers minus one. */
- operands[2] = GEN_INT(count - 1);
-
- operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 2));
- from = memory_address (SImode, XEXP (operands[0], 0));
- XVECEXP (operands[3], 0, 0) = gen_rtx (SET, VOIDmode,
- gen_rtx (MEM, SImode, from),
- gen_rtx (REG, SImode, regno));
- operands[4] = gen_reg_rtx (PSImode);
- XVECEXP (operands[3], 0, 1) = gen_rtx (USE, VOIDmode, operands[4]);
- XVECEXP (operands[3], 0, 2) = gen_rtx (CLOBBER, VOIDmode, operands[4]);
-
- for (i = 1; i < count; i++)
- XVECEXP (operands[3], 0, i + 2)
- = gen_rtx (SET, VOIDmode,
- gen_rtx (MEM, SImode, plus_constant (from, i * 4)),
- gen_rtx (REG, SImode, regno + i));
-}")
-
-(define_expand "store_multiple_bug"
- [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
- (match_operand:SI 1 "" ""))
- (use (match_operand:SI 2 "" ""))])]
- ""
- "
-{
- int regno;
- int count;
- rtx from;
- int i;
-
- /* Support only storing a constant number of hard registers to memory. */
- if (GET_CODE (operands[2]) != CONST_INT
- || operands[2] == const1_rtx
- || GET_CODE (operands[0]) != MEM
- || GET_CODE (operands[1]) != REG
- || REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
- FAIL;
-
- count = INTVAL (operands[2]);
- regno = REGNO (operands[1]);
-
- operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
- from = memory_address (SImode, XEXP (operands[0], 0));
- XVECEXP (operands[3], 0, 0) = gen_rtx (SET, VOIDmode,
- gen_rtx (MEM, SImode, from),
- gen_rtx (REG, SImode, regno));
- XVECEXP (operands[3], 0, 1)
- = gen_rtx (CLOBBER, VOIDmode, gen_rtx (SCRATCH, PSImode));
-
- for (i = 1; i < count; i++)
- XVECEXP (operands[3], 0, i + 1)
- = gen_rtx (SET, VOIDmode,
- gen_rtx (MEM, SImode, plus_constant (from, i * 4)),
- gen_rtx (REG, SImode, regno + i));
-}")
-
-(define_insn ""
- [(set (match_operand 0 "memory_operand" "=m")
- (match_operand 1 "gpc_reg_operand" "r"))
- (clobber (match_scratch:PSI 2 "=&c"))]
- "!TARGET_NO_STOREM_BUG
- && GET_MODE (operands[0]) == GET_MODE (operands[1])
- && GET_MODE_SIZE (GET_MODE (operands[0])) > UNITS_PER_WORD"
- "mtsrim cr,%S1\;storem 0,0,%1,%0"
- [(set_attr "type" "multi")])
-
-(define_insn ""
- [(match_parallel 0 "store_multiple_operation"
- [(set (match_operand:SI 1 "memory_operand" "=m")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (clobber (match_scratch:PSI 3 "=&c"))])]
- "!TARGET_NO_STOREM_BUG"
- "mtsrim cr,%V0\;storem 0,0,%2,%1"
- [(set_attr "type" "multi")])
-
-(define_insn ""
- [(set (match_operand 0 "memory_operand" "=m")
- (match_operand 1 "gpc_reg_operand" "r"))
- (use (match_operand:PSI 2 "register_operand" "+c"))
- (clobber (match_dup 2))]
- "TARGET_NO_STOREM_BUG
- && GET_MODE (operands[0]) == GET_MODE (operands[1])
- && GET_MODE_SIZE (GET_MODE (operands[0])) > UNITS_PER_WORD"
- "storem 0,0,%1,%0"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(match_parallel 0 "store_multiple_operation"
- [(set (match_operand:SI 1 "memory_operand" "=m")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (use (match_operand:PSI 3 "register_operand" "+c"))
- (clobber (match_dup 3))])]
- "TARGET_NO_STOREM_BUG"
- "storem 0,0,%2,%1"
- [(set_attr "type" "store")])
-
-;; SUB
-;;
-;; Either operand can be a register or an 8-bit constant, but both cannot be
-;; constants (can't usually occur anyway).
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (minus:SI (match_operand:SI 1 "srcb_operand" "")
- (match_operand:SI 2 "srcb_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == CONST_INT
- && GET_CODE (operands[1]) == CONST_INT)
- operands[1] = force_reg (SImode, operands[1]);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (minus:SI (match_operand:SI 1 "srcb_operand" "r,I")
- (match_operand:SI 2 "srcb_operand" "rI,r")))]
- "register_operand (operands[1], SImode)
- || register_operand (operands[2], SImode)"
- "@
- sub %0,%1,%2
- subr %0,%2,%1")
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "gpc_reg_operand" "r")))]
- ""
- "sub %L0,%L1,%L2\;subc %0,%1,%2"
- [(set_attr "type" "multi")])
-
-;; SUBR (also used above in SUB)
-(define_insn "negdi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
- ""
- "subr %L0,%L1,0\;subrc %0,%1,0"
- [(set_attr "type" "multi")])
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
- ""
- "subr %0,%1,0")
-
-;; XNOR
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))))]
- ""
- "xnor %0,%1,%2")
-
-;; XOR
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
- (match_operand:SI 2 "and_operand" "rI,K")))]
- ""
- "@
- xor %0,%1,%2
- xnor %0,%1,%C2")
-
-;; Can use XOR to negate floating-point values, but we are better off not doing
-;; it that way on the 29050 so it can combine with the fmac insns.
-(define_expand "negsf2"
- [(parallel [(set (match_operand:SF 0 "register_operand" "")
- (neg:SF (match_operand:SF 1 "register_operand" "")))
- (clobber (match_scratch:SI 2 ""))])]
- "! TARGET_SOFT_FLOAT"
- "
-{
- rtx result;
- rtx target;
-
- if (! TARGET_29050)
- {
- target = operand_subword_force (operands[0], 0, SFmode);
- result = expand_binop (SImode, xor_optab,
- operand_subword_force (operands[1], 0, SFmode),
- GEN_INT(0x80000000), target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- /* Make a place for REG_EQUAL. */
- emit_move_insn (operands[0], operands[0]);
- DONE;
- }
-}")
-
-(define_expand "negdf2"
- [(parallel [(set (match_operand:DF 0 "register_operand" "")
- (neg:DF (match_operand:DF 1 "register_operand" "")))
- (clobber (match_scratch:SI 2 ""))])]
- "! TARGET_SOFT_FLOAT"
- "
-{
- rtx result;
- rtx target;
- rtx insns;
-
- if (! TARGET_29050)
- {
- start_sequence ();
- target = operand_subword (operands[0], 0, 1, DFmode);
- result = expand_binop (SImode, xor_optab,
- operand_subword_force (operands[1], 0, DFmode),
- GEN_INT(0x80000000), target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
- operand_subword_force (operands[1], 1, DFmode));
-
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
- DONE;
- }
-}")
-
-;; Sign extend and truncation operations.
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
- (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
- ""
- "and %0,%1,255")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
- ""
- "and %0,%1,255")
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "0")))]
- ""
- "consth %0,0")
-
-(define_expand "extendqihi2"
- [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
- (const_int 24)))
- (set (match_operand:HI 0 "gpc_reg_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))]
- ""
- "
-{ operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode); }")
-
-(define_expand "extendqisi2"
- [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
- (const_int 24)))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))]
- ""
- "
-{ operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode); }")
-
-(define_expand "extendhisi2"
- [(set (match_dup 2)
- (ashift:SI (match_operand:HI 1 "gpc_reg_operand" "")
- (const_int 16)))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 16)))]
- ""
- "
-{ operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode); }")
-
-;; Define the methods used to move data around.
-;;
-;; movsi:
-;;
-;; If storing into memory, force source into register.
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM && ! gpc_reg_operand (operands[1], SImode))
- operands[1] = copy_to_mode_reg (SImode, operands[1]);
- else if (spec_reg_operand (operands[0], SImode)
- && ! (register_operand (operands[1], SImode)
- || cint_16_operand (operands[1], SImode)))
- operands[1] = force_reg (SImode, operands[1]);
-}")
-
-(define_expand "movpsi"
- [(set (match_operand:PSI 0 "general_operand" "")
- (match_operand:PSI 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM
- && ! gpc_reg_operand (operands[1], PSImode))
- operands[1] = copy_to_mode_reg (PSImode, operands[1]);
- else if (spec_reg_operand (operands[0], PSImode)
- && ! (register_operand (operands[1], PSImode)
- || cint_16_operand (operands[1], PSImode)))
- operands[1] = force_reg (PSImode, operands[1]);
-}")
-
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (match_operand:SI 1 "long_const_operand" ""))]
- ""
- [(set (match_dup 0)
- (and:SI (match_dup 1)
- (const_int 65535)))
- (set (match_dup 0)
- (ior:SI (zero_extend:SI (match_dup 2))
- (and:SI (match_dup 1)
- (const_int -65536))))]
- " operands[2] = gen_lowpart (HImode, operands[0]); ")
-
-;; Subroutines to load/store halfwords. Operands 0 and 1 are the output and
-;; input, respectively, except that the address is passed for a MEM instead
-;; of the MEM itself and the short item is passed in QImode.
-;;
-;; Operand 2 is a scratch general register and operand 3 is a scratch register
-;; used for BP. When called before reload, pseudos are passed for both
-;; operands. During reload, R_TAV is used for the general register, and
-;; a reload register of class BR_REGS (R_VP) for BP.
-;;
-;; We have two versions of the store operations, for when halfword writes are
-;; supported and when they are not.
-(define_expand "loadhi"
- [(parallel [(set (match_operand:SI 2 "gpc_reg_operand" "")
- (mem:SI (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (const_int -4))))
- (set (match_operand:PSI 3 "register_operand" "")
- (truncate:PSI (match_dup 1)))])
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (zero_extract:SI (match_dup 2)
- (const_int 16)
- (ashift:PSI (match_dup 3) (const_int 3))))]
- ""
- "")
-
-(define_expand "storehinhww"
- [(parallel [(set (match_operand:SI 2 "gpc_reg_operand" "")
- (mem:SI (and:SI (match_operand:SI 0 "gpc_reg_operand" "")
- (const_int -4))))
- (set (match_operand:PSI 3 "register_operand" "")
- (truncate:PSI (match_dup 0)))])
- (set (zero_extract:SI (match_dup 2)
- (const_int 16)
- (ashift:PSI (match_dup 3) (const_int 3)))
- (match_operand:SI 1 "gpc_reg_operand" ""))
- (set (mem:SI (match_dup 0))
- (match_dup 2))]
- ""
- "")
-
-(define_expand "storehihww"
- [(set (match_operand:PSI 3 "register_operand" "")
- (truncate:PSI (match_operand:SI 0 "gpc_reg_operand" "")))
- (set (match_operand:SI 2 "gpc_reg_operand" "")
- (ior:SI (and:SI (not:SI (ashift:SI (const_int 65535)
- (ashift:PSI (match_dup 3)
- (const_int 3))))
- (match_operand:SI 1 "gpc_reg_operand" ""))
- (ashift:SI (zero_extend:SI (match_dup 4))
- (ashift:PSI (match_dup 3) (const_int 3)))))
- (set (mem:SI (and:SI (match_dup 0)
- (const_int -3)))
- (match_dup 2))]
- ""
- "
-{ operands[4] = gen_lowpart (HImode, operands[1]); }")
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{ if (GET_CODE (operands[0]) == MEM)
- {
- if (! gpc_reg_operand (operands[1], HImode))
- operands[1] = copy_to_mode_reg (HImode, operands[1]);
- if (! TARGET_DW_ENABLE)
- {
- rtx general = gen_reg_rtx (SImode);
- rtx bp = gen_reg_rtx (PSImode);
- rtx (*fcn) ()
- = TARGET_BYTE_WRITES ? gen_storehihww : gen_storehinhww;
- rtx seq = (*fcn) (XEXP (operands[0], 0),
- gen_lowpart (SImode, operands[1]),
- general, bp);
-
- a29k_set_memflags (seq, operands[0]);
- emit_insn (seq);
- DONE;
- }
- }
- else if (GET_CODE (operands[1]) == MEM)
- {
- if (! TARGET_DW_ENABLE)
- {
- rtx general = gen_reg_rtx (SImode);
- rtx bp = gen_reg_rtx (PSImode);
- rtx seq = gen_loadhi (gen_lowpart (SImode, operands[0]),
- XEXP (operands[1], 0), general, bp);
-
- a29k_set_memflags (seq, operands[1]);
- emit_insn (seq);
- DONE;
- }
- }
-}")
-
-(define_expand "reload_inhi"
- [(parallel [(match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "reload_memory_operand" "m")
- (match_operand:PSI 2 "register_operand" "=b")])]
- "! TARGET_DW_ENABLE"
- "
-{ rtx seq = gen_loadhi (gen_lowpart (SImode, operands[0]),
- a29k_get_reloaded_address (operands[1]),
- gen_rtx (REG, SImode, R_TAV),
- operands[2]);
-
- a29k_set_memflags (seq, operands[1]);
- emit_insn (seq);
- DONE;
-}")
-
-(define_expand "reload_outhi"
- [(parallel [(match_operand:SI 0 "reload_memory_operand" "=m")
- (match_operand:SI 1 "register_operand" "m")
- (match_operand:PSI 2 "register_operand" "=b")])]
- "! TARGET_DW_ENABLE"
- "
-{ rtx (*fcn) () = TARGET_BYTE_WRITES ? gen_storehihww : gen_storehinhww;
- rtx seq = (*fcn) (a29k_get_reloaded_address (operands[0]),
- gen_lowpart (SImode, operands[1]),
- gen_rtx (REG, SImode, R_TAV), operands[2]);
-
- a29k_set_memflags (seq, operands[0]);
- emit_insn (seq);
- DONE;
-}")
-
-;; Subroutines to load/store bytes. Operands 0 and 1 are the output and
-;; input, respectively, except that the address is passed for a MEM instead
-;; of the MEM itself and the short item is passed in QImode.
-;;
-;; Operand 2 is a scratch general register and operand 3 is a scratch register
-;; used for BP. When called before reload, pseudos are passed for both
-;; operands. During reload, R_TAV is used for the general register, and
-;; a reload register of class BR_REGS (R_VP) for BP.
-;;
-;; We have two versions of the store operations, for when byte writes are
-;; supported and when they are not.
-(define_expand "loadqi"
- [(parallel [(set (match_operand:SI 2 "gpc_reg_operand" "")
- (mem:SI (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (const_int -4))))
- (set (match_operand:PSI 3 "register_operand" "")
- (truncate:PSI (match_dup 1)))])
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (zero_extract:SI (match_dup 2)
- (const_int 8)
- (ashift:PSI (match_dup 3) (const_int 3))))]
- ""
- "")
-
-(define_expand "storeqinhww"
- [(parallel [(set (match_operand:SI 2 "gpc_reg_operand" "")
- (mem:SI (and:SI (match_operand:SI 0 "gpc_reg_operand" "")
- (const_int -4))))
- (set (match_operand:PSI 3 "register_operand" "")
- (truncate:PSI (match_dup 0)))])
- (set (zero_extract:SI (match_dup 2)
- (const_int 8)
- (ashift:PSI (match_dup 3)
- (const_int 3)))
- (match_operand:SI 1 "gpc_reg_operand" ""))
- (set (mem:SI (match_dup 0))
- (match_dup 2))]
- ""
- "")
-
-(define_expand "storeqihww"
- [(set (match_operand:PSI 3 "register_operand" "")
- (truncate:PSI (match_operand:SI 0 "gpc_reg_operand" "")))
- (set (match_operand:SI 2 "gpc_reg_operand" "")
- (ior:SI (and:SI (not:SI (ashift:SI (const_int 255)
- (ashift:PSI (match_dup 3)
- (const_int 3))))
- (match_operand:SI 1 "gpc_reg_operand" ""))
- (ashift:SI (zero_extend:SI (match_dup 4))
- (ashift:PSI (match_dup 3)
- (const_int 3)))))
- (set (mem:SI (and:SI (match_dup 0)
- (const_int -4)))
- (match_dup 2))]
- ""
- "
-{ operands[4] = gen_lowpart (QImode, operands[1]); }")
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{ if (GET_CODE (operands[0]) == MEM)
- {
- if (! gpc_reg_operand (operands[1], QImode))
- operands[1] = copy_to_mode_reg (QImode, operands[1]);
- if (! TARGET_DW_ENABLE)
- {
- rtx general = gen_reg_rtx (SImode);
- rtx bp = gen_reg_rtx (PSImode);
- rtx (*fcn) ()
- = TARGET_BYTE_WRITES ? gen_storeqihww : gen_storeqinhww;
- rtx seq = (*fcn) (XEXP (operands[0], 0),
- gen_lowpart (SImode, operands[1]),
- general, bp);
-
- a29k_set_memflags (seq, operands[0]);
- emit_insn (seq);
- DONE;
- }
- }
- else if (GET_CODE (operands[1]) == MEM)
- {
- if (! TARGET_DW_ENABLE)
- {
- rtx general = gen_reg_rtx (SImode);
- rtx bp = gen_reg_rtx (PSImode);
- rtx seq = gen_loadqi (gen_lowpart (SImode, operands[0]),
- XEXP (operands[1], 0), general, bp);
-
- a29k_set_memflags (seq, operands[1]);
- emit_insn (seq);
- DONE;
- }
- }
-}")
-
-(define_expand "reload_inqi"
- [(parallel [(match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "reload_memory_operand" "m")
- (match_operand:PSI 2 "register_operand" "=b")])]
- "! TARGET_DW_ENABLE"
- "
-{ rtx seq = gen_loadqi (gen_lowpart (SImode, operands[0]),
- a29k_get_reloaded_address (operands[1]),
- gen_rtx (REG, SImode, R_TAV),
- operands[2]);
-
- a29k_set_memflags (seq, operands[1]);
- emit_insn (seq);
- DONE;
-}")
-
-(define_expand "reload_outqi"
- [(parallel [(match_operand:SI 0 "reload_memory_operand" "=m")
- (match_operand:SI 1 "register_operand" "m")
- (match_operand:PSI 2 "register_operand" "=b")])]
- "! TARGET_DW_ENABLE"
- "
-{ rtx (*fcn) () = TARGET_BYTE_WRITES ? gen_storeqihww : gen_storeqinhww;
- rtx seq = (*fcn) (a29k_get_reloaded_address (operands[0]),
- gen_lowpart (SImode, operands[1]),
- gen_rtx (REG, SImode, R_TAV), operands[2]);
-
- a29k_set_memflags (seq, operands[0]);
- emit_insn (seq);
- DONE;
-}")
-
-;; Now the actual insns used to move data around. We include here the
-;; DEFINE_SPLITs that may be needed. In some cases these will be
-;; split again. For floating-point, if we can look inside the constant,
-;; always split it. This can eliminate unnecessary insns.
-(define_insn ""
- [(set (match_operand:SF 0 "out_operand" "=r,r,r,r,m")
- (match_operand:SF 1 "in_operand" "r,E,F,m,r"))]
- "(gpc_reg_operand (operands[0], SFmode)
- || gpc_reg_operand (operands[1], SFmode))
- && ! TARGET_29050"
- "@
- sll %0,%1,0
- #
- const %0,%1\;consth %0,%1
- load 0,0,%0,%1
- store 0,0,%1,%0"
- [(set_attr "type" "misc,multi,multi,load,store")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "out_operand" "=r,r,r,r,m,*a,r")
- (match_operand:SF 1 "in_operand" "r,E,F,m,r,r,*a"))]
- "(gpc_reg_operand (operands[0], SFmode)
- || gpc_reg_operand (operands[1], SFmode))
- && TARGET_29050"
- "@
- sll %0,%1,0
- #
- const %0,%1\;consth %0,%1
- load 0,0,%0,%1
- store 0,0,%1,%0
- mtacc %1,1,%0
- mfacc %0,1,%1"
- [(set_attr "type" "misc,multi,multi,load,store,fadd,fadd")])
-
-;; Turn this into SImode. It will then be split up that way.
-(define_split
- [(set (match_operand:SF 0 "register_operand" "")
- (match_operand:SF 1 "float_const_operand" ""))]
- "HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT"
- [(set (match_dup 0)
- (match_dup 1))]
- "
-{ operands[0] = operand_subword (operands[0], 0, 0, SFmode);
- operands[1] = operand_subword (operands[1], 0, 0, SFmode);
-
- if (operands[0] == 0 || operands[1] == 0)
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "out_operand" "=?r,?r,r,m")
- (match_operand:DF 1 "in_operand" "rE,F,m,r"))
- (clobber (match_scratch:PSI 2 "=X,X,&c,&c"))]
- "(gpc_reg_operand (operands[0], DFmode)
- || gpc_reg_operand (operands[1], DFmode))
- && ! TARGET_29050"
- "@
- #
- const %0,%1\;consth %0,%1\;const %L0,%L1\;consth %L0,%L1
- mtsrim cr,1\;loadm 0,0,%0,%1
- mtsrim cr,1\;storem 0,0,%1,%0"
- [(set_attr "type" "multi")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "out_operand" "=?r,?r,r,m,?*a,?r")
- (match_operand:DF 1 "in_operand" "rE,F,m,r,r,*a"))
- (clobber (match_scratch:PSI 2 "=X,X,&c,&c,X,X"))]
- "(gpc_reg_operand (operands[0], DFmode)
- || gpc_reg_operand (operands[1], DFmode))
- && TARGET_29050"
- "@
- #
- const %0,%1\;consth %0,%1\;const %L0,%L1\;consth %L0,%L1
- mtsrim cr,1\;loadm 0,0,%0,%1
- mtsrim cr,1\;storem 0,0,%1,%0
- mtacc %1,2,%0
- mfacc %0,2,%1"
- [(set_attr "type" "multi,multi,multi,multi,fadd,fadd")])
-
-;; Split register-register copies and constant loads into two SImode loads,
-;; one for each word. In the constant case, they will get further split.
-;; Don't so this until register allocation, though, since it will
-;; interfere with register allocation. Normally copy the lowest-addressed
-;; word first; the exception is if we are copying register to register and
-;; the lowest register of the first operand is the highest register of the
-;; second operand.
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (match_operand:DF 1 "gpc_reg_or_float_constant_operand" ""))
- (clobber (match_scratch:PSI 2 ""))]
- "reload_completed"
- [(set (match_dup 3) (match_dup 4))
- (set (match_dup 5) (match_dup 6))]
- "
-{ if (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1]) + 1)
- {
- operands[3] = operand_subword (operands[0], 1, 1, DFmode);
- operands[4] = operand_subword (operands[1], 1, 1, DFmode);
- operands[5] = operand_subword (operands[0], 0, 1, DFmode);
- operands[6] = operand_subword (operands[1], 0, 1, DFmode);
- }
- else
- {
- operands[3] = operand_subword (operands[0], 0, 1, DFmode);
- operands[4] = operand_subword (operands[1], 0, 1, DFmode);
- operands[5] = operand_subword (operands[0], 1, 1, DFmode);
- operands[6] = operand_subword (operands[1], 1, 1, DFmode);
- }
-
- if (operands[3] == 0 || operands[4] == 0
- || operands[5] == 0 || operands[6] == 0)
- FAIL;
-}")
-
-;; Split memory loads and stores into the MTSR and LOADM/STOREM.
-(define_split
- [(set (match_operand:DF 0 "out_operand" "")
- (match_operand:DF 1 "in_operand" ""))
- (clobber (reg:PSI 179))]
- "TARGET_NO_STOREM_BUG
- && (memory_operand (operands[0], DFmode)
- || memory_operand (operands[1], DFmode))"
- [(set (reg:PSI 179) (const_int 1))
- (parallel [(set (match_dup 0) (match_dup 1))
- (use (reg:PSI 179))
- (clobber (reg:PSI 179))])]
- "")
-
-;; DI move is similar to DF move.
-(define_insn ""
- [(set (match_operand:DI 0 "out_operand" "=?r,r,m")
- (match_operand:DI 1 "in_operand" "rn,m,r"))
- (clobber (match_scratch:PSI 2 "=X,&c,&c"))]
- "(gpc_reg_operand (operands[0], DImode)
- || gpc_reg_operand (operands[1], DImode))"
- "@
- #
- mtsrim cr,1\;loadm 0,0,%0,%1
- mtsrim cr,1\;storem 0,0,%1,%0"
- [(set_attr "type" "multi")])
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (match_operand:DI 1 "gpc_reg_or_integer_constant_operand" ""))
- (clobber (match_scratch:PSI 2 ""))]
- "reload_completed"
- [(set (match_dup 3) (match_dup 4))
- (set (match_dup 5) (match_dup 6))]
- "
-{ if (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1]) + 1)
- {
- operands[3] = operand_subword (operands[0], 1, 1, DImode);
- operands[4] = operand_subword (operands[1], 1, 1, DImode);
- operands[5] = operand_subword (operands[0], 0, 1, DImode);
- operands[6] = operand_subword (operands[1], 0, 1, DImode);
- }
- else
- {
- operands[3] = operand_subword (operands[0], 0, 1, DImode);
- operands[4] = operand_subword (operands[1], 0, 1, DImode);
- operands[5] = operand_subword (operands[0], 1, 1, DImode);
- operands[6] = operand_subword (operands[1], 1, 1, DImode);
- }
-}")
-
-(define_split
- [(set (match_operand:DI 0 "out_operand" "")
- (match_operand:DI 1 "in_operand" ""))
- (clobber (reg:PSI 179))]
- "TARGET_NO_STOREM_BUG
- && (memory_operand (operands[0], DImode)
- || memory_operand (operands[1], DImode))"
- [(set (reg:PSI 179) (const_int 1))
- (parallel [(set (match_dup 0) (match_dup 1))
- (use (reg:PSI 179))
- (clobber (reg:PSI 179))])]
- "")
-
-;; TImode moves are very similar to DImode moves, except that we can't
-;; have constants.
-(define_insn ""
- [(set (match_operand:TI 0 "out_operand" "=?r,r,m")
- (match_operand:TI 1 "in_operand" "r,m,r"))
- (clobber (match_scratch:PSI 2 "=X,&c,&c"))]
- "(gpc_reg_operand (operands[0], TImode)
- || gpc_reg_operand (operands[1], TImode))"
- "@
- #
- mtsrim cr,3\;loadm 0,0,%0,%1
- mtsrim cr,3\;storem 0,0,%1,%0"
- [(set_attr "type" "multi,multi,multi")])
-
-(define_split
- [(set (match_operand:TI 0 "gpc_reg_operand" "")
- (match_operand:TI 1 "gpc_reg_operand" ""))
- (clobber (match_scratch:PSI 2 ""))]
- "reload_completed"
- [(set (match_dup 3) (match_dup 4))
- (set (match_dup 5) (match_dup 6))
- (set (match_dup 7) (match_dup 8))
- (set (match_dup 9) (match_dup 10))]
- "
-{
- if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
- && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
- {
- operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 3);
- operands[4] = gen_rtx (REG, SImode, REGNO (operands[1]) + 3);
- operands[5] = gen_rtx (REG, SImode, REGNO (operands[0]) + 2);
- operands[6] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
- operands[7] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- operands[8] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- operands[9] = gen_rtx (REG, SImode, REGNO (operands[0]));
- operands[10] = gen_rtx (REG, SImode, REGNO (operands[1]));
- }
- else
- {
- operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]));
- operands[4] = gen_rtx (REG, SImode, REGNO (operands[1]));
- operands[5] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- operands[6] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- operands[7] = gen_rtx (REG, SImode, REGNO (operands[0]) + 2);
- operands[8] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
- operands[9] = gen_rtx (REG, SImode, REGNO (operands[0]) + 3);
- operands[10] = gen_rtx (REG, SImode, REGNO (operands[1]) + 3);
- }
-}")
-
-(define_split
- [(set (match_operand:TI 0 "out_operand" "")
- (match_operand:TI 1 "in_operand" ""))
- (clobber (reg:PSI 179))]
- "TARGET_NO_STOREM_BUG
- && (memory_operand (operands[0], TImode)
- || memory_operand (operands[1], TImode))"
- [(set (reg:PSI 179) (const_int 3))
- (parallel [(set (match_dup 0) (match_dup 1))
- (use (reg:PSI 179))
- (clobber (reg:PSI 179))])]
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "out_operand" "=r,r,r,r,r,r,r,m,*h,*h")
- (match_operand:SI 1 "in_operand" "r,J,M,O,i,m,*h,r,r,J"))]
- "(gpc_reg_operand (operands[0], SImode)
- || gpc_reg_operand (operands[1], SImode)
- || (spec_reg_operand (operands[0], SImode)
- && cint_16_operand (operands[1], SImode)))
- && ! TARGET_29050"
- "@
- sll %0,%1,0
- const %0,%1
- constn %0,%M1
- cpeq %0,gr1,gr1
- #
- load 0,0,%0,%1
- mfsr %0,%1
- store 0,0,%1,%0
- mtsr %0,%1
- mtsrim %0,%1"
- [(set_attr "type" "misc,misc,misc,misc,multi,load,misc,store,misc,misc")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "out_operand" "=r,r,r,r,r,r,r,m,*h,*h")
- (match_operand:SI 1 "in_operand" "r,J,M,O,i,m,*h,r,r,J"))]
- "(gpc_reg_operand (operands[0], SImode)
- || gpc_reg_operand (operands[1], SImode)
- || (spec_reg_operand (operands[0], SImode)
- && cint_16_operand (operands[1], SImode)))
- && TARGET_29050"
- "@
- sll %0,%1,0
- const %0,%1
- constn %0,%M1
- consthz %0,%1
- #
- load 0,0,%0,%1
- mfsr %0,%1
- store 0,0,%1,%0
- mtsr %0,%1
- mtsrim %0,%1"
- [(set_attr "type" "misc,misc,misc,misc,multi,load,misc,store,misc,misc")])
-
-(define_insn ""
- [(set (match_operand:PSI 0 "out_operand" "=*r,*r,*r,*r,m,h,h")
- (match_operand:PSI 1 "in_operand" "r,i,m,h,r,r,J"))]
- "(gpc_reg_operand (operands[0], PSImode)
- || gpc_reg_operand (operands[1], PSImode)
- || (spec_reg_operand (operands[0], PSImode)
- && cint_16_operand (operands[1], PSImode)))"
- "@
- sll %0,%1,0
- const %0,%1
- load 0,0,%0,%1
- mfsr %0,%1
- store 0,0,%1,%0
- mtsr %0,%1
- mtsrim %0,%1"
- [(set_attr "type" "misc,multi,load,misc,store,misc,misc")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "out_operand" "=r,r,r,m,r,*h,*h")
- (match_operand:HI 1 "in_operand" "r,i,m,r,*h,r,i"))]
- "gpc_reg_operand (operands[0], HImode)
- || gpc_reg_operand (operands[1], HImode)
- || (spec_reg_operand (operands[0], HImode)
- && cint_16_operand (operands[1], HImode))"
- "@
- sll %0,%1,0
- const %0,%1
- load 0,2,%0,%1
- store 0,2,%1,%0
- mfsr %0,%1
- mtsr %0,%1
- mtsrim %0,%1"
- [(set_attr "type" "misc,misc,load,store,misc,misc,misc")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "out_operand" "=r,r,r,m,r,*h,*h")
- (match_operand:QI 1 "in_operand" "r,i,m,r,*h,r,i"))]
- "gpc_reg_operand (operands[0], QImode)
- || gpc_reg_operand (operands[1], QImode)
- || (spec_reg_operand (operands[0], HImode)
- && cint_16_operand (operands[1], HImode))"
- "@
- sll %0,%1,0
- const %0,%1
- load 0,1,%0,%1
- store 0,1,%1,%0
- mfsr %0,%1
- mtsr %0,%1
- mtsrim %0,%1"
- [(set_attr "type" "misc,misc,load,store,misc,misc,misc")])
-
-;; Define move insns for DI, TI, SF, and DF.
-;;
-;; In no case do we support mem->mem directly.
-;;
-;; For DI move of constant to register, split apart at this time since these
-;; can require anywhere from 2 to 4 insns and determining which is complex.
-;;
-;; In other cases, handle similarly to SImode moves.
-;;
-;; However, indicate that DI, TI, and DF moves may clobber CR (reg 179).
-(define_expand "movdi"
- [(parallel [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))
- (clobber (scratch:PSI))])]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (DImode, operands[1]);
-}")
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{ if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (SFmode, operands[1]);
-}")
-
-(define_expand "movdf"
- [(parallel [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))
- (clobber (scratch:PSI))])]
- ""
- "
-{ if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (DFmode, operands[1]);
-}")
-
-(define_expand "movti"
- [(parallel [(set (match_operand:TI 0 "general_operand" "")
- (match_operand:TI 1 "general_operand" ""))
- (clobber (scratch:PSI))])]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (TImode, operands[1]);
-
- /* We can't handle constants in general because there is no rtl to represent
- 128 bit constants. Splitting happens to work for CONST_INTs so we split
- them for good code. Other constants will get forced to memory. */
-
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- rtx part0, part1, part2, part3;
-
- part0 = operand_subword (operands[0], 0, 1, TImode);
- part1 = operand_subword (operands[0], 1, 1, TImode);
- part2 = operand_subword (operands[0], 2, 1, TImode);
- part3 = operand_subword (operands[0], 3, 1, TImode);
-
- emit_move_insn (part0, const0_rtx);
- emit_move_insn (part1, const0_rtx);
- emit_move_insn (part2, const0_rtx);
- emit_move_insn (part3, const0_rtx);
-
- DONE;
- }
- else if (CONSTANT_P (operands[1]))
- {
- operands[1] = force_const_mem (TImode, operands[1]);
- if (! memory_address_p (TImode, XEXP (operands[1], 0))
- && ! reload_in_progress)
- operands[1] = change_address (operands[1], TImode,
- XEXP (operands[1], 0));
- }
-}")
-
-;; Here are the variants of the above for use during reload.
-
-(define_expand "reload_indf"
- [(parallel [(set (match_operand:DF 0 "register_operand" "=r")
- (match_operand:DF 1 "reload_memory_operand" "m"))
- (clobber (match_operand:PSI 2 "register_operand" "=&c"))])]
- ""
- "")
-
-(define_expand "reload_outdf"
- [(parallel [(set (match_operand:DF 0 "reload_memory_operand" "=m")
- (match_operand:DF 1 "register_operand" "r"))
- (clobber (match_operand:PSI 2 "register_operand" "=&c"))])]
- ""
- "")
-
-(define_expand "reload_indi"
- [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:DI 1 "reload_memory_operand" "m"))
- (clobber (match_operand:PSI 2 "register_operand" "=&c"))])]
- ""
- "")
-
-(define_expand "reload_outdi"
- [(parallel [(set (match_operand:DI 0 "reload_memory_operand" "=m")
- (match_operand:DI 1 "register_operand" "r"))
- (clobber (match_operand:PSI 2 "register_operand" "=&c"))])]
- ""
- "")
-
-(define_expand "reload_inti"
- [(parallel [(set (match_operand:TI 0 "register_operand" "=r")
- (match_operand:TI 1 "reload_memory_operand" "m"))
- (clobber (match_operand:PSI 2 "register_operand" "=&c"))])]
- ""
- "")
-
-(define_expand "reload_outti"
- [(parallel [(set (match_operand:TI 0 "reload_memory_operand" "=m")
- (match_operand:TI 1 "register_operand" "r"))
- (clobber (match_operand:PSI 2 "register_operand" "=&c"))])]
- ""
- "")
-
-;; For compare operations, we simply store the comparison operands and
-;; do nothing else. The following branch or scc insn will output whatever
-;; is needed.
-(define_expand "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "gpc_reg_operand" "")
- (match_operand:SI 1 "srcb_operand" "")))]
- ""
- "
-{
- a29k_compare_op0 = operands[0];
- a29k_compare_op1 = operands[1];
- a29k_compare_fp_p = 0;
- DONE;
-}")
-
-(define_expand "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "gpc_reg_operand" "")
- (match_operand:SF 1 "gpc_reg_operand" "")))]
- "! TARGET_SOFT_FLOAT"
- "
-{
- a29k_compare_op0 = operands[0];
- a29k_compare_op1 = operands[1];
- a29k_compare_fp_p = 1;
- DONE;
-}")
-
-(define_expand "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "gpc_reg_operand" "")
- (match_operand:DF 1 "gpc_reg_operand" "")))]
- "! TARGET_SOFT_FLOAT"
- "
-{
- a29k_compare_op0 = operands[0];
- a29k_compare_op1 = operands[1];
- a29k_compare_fp_p = 1;
- DONE;
-}")
-
-;; We can generate bit-tests better if we use NE instead of EQ, but we
-;; don't have an NE for floating-point. So we have to have two patterns
-;; for EQ and two for NE.
-
-(define_expand "beq"
- [(set (match_dup 1) (ne:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (ge (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (a29k_compare_op0)) == MODE_FLOAT)
- {
- emit_insn (gen_beq_fp (operands[0]));
- DONE;
- }
-
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-(define_expand "beq_fp"
- [(set (match_dup 1) (eq:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-(define_expand "bne"
- [(set (match_dup 1) (ne:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (a29k_compare_op0)) == MODE_FLOAT)
- {
- emit_insn (gen_bne_fp (operands[0]));
- DONE;
- }
-
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-(define_expand "bne_fp"
- [(set (match_dup 1) (eq:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (ge (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-;; We don't have a floating-point "lt" insn, so we have to use "gt" in that
-;; case with the operands swapped. The operands must both be registers in
-;; the floating-point case, so we know that swapping them is OK.
-(define_expand "blt"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- if (a29k_compare_fp_p)
- operands[2] = gen_rtx (GT, SImode, a29k_compare_op1, a29k_compare_op0);
- else
- operands[2] = gen_rtx (LT, SImode, a29k_compare_op0, a29k_compare_op1);
-}")
-
-;; Similarly for "le".
-(define_expand "ble"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- if (a29k_compare_fp_p)
- operands[2] = gen_rtx (GE, SImode, a29k_compare_op1, a29k_compare_op0);
- else
- operands[2] = gen_rtx (LE, SImode, a29k_compare_op0, a29k_compare_op1);
-}")
-
-(define_expand "bltu"
- [(set (match_dup 1) (ltu:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-(define_expand "bleu"
- [(set (match_dup 1) (leu:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-(define_expand "bgt"
- [(set (match_dup 1) (gt:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-(define_expand "bge"
- [(set (match_dup 1) (ge:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-(define_expand "bgtu"
- [(set (match_dup 1) (gtu:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-(define_expand "bgeu"
- [(set (match_dup 1) (geu:SI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (SImode);
- operands[2] = a29k_compare_op0;
- operands[3] = a29k_compare_op1;
-}")
-
-(define_expand "seq"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (eq:SI (match_dup 1) (match_dup 2)))]
- ""
- "
-{
- operands[1] = a29k_compare_op0;
- operands[2] = a29k_compare_op1;
-}")
-
-;; This is the most complicated case, because we don't have a floating-point
-;; "ne" insn. If integer, handle normally. If floating-point, write the
-;; compare and then write an insn to reverse the test.
-(define_expand "sne_fp"
- [(set (match_dup 3)
- (eq:SI (match_operand 1 "gpc_reg_operand" "")
- (match_operand 2 "gpc_reg_operand" "")))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (ge:SI (match_dup 3) (const_int 0)))]
- "! TARGET_SOFT_FLOAT"
- "
-{ operands[3] = gen_reg_rtx (SImode);
-}");
-
-(define_expand "sne"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (ne:SI (match_dup 1) (match_dup 2)))]
- ""
- "
-{
- operands[1] = a29k_compare_op0;
- operands[2] = a29k_compare_op1;
-
- if (a29k_compare_fp_p)
- {
- emit_insn (gen_sne_fp (operands[0], operands[1], operands[2]));
- DONE;
- }
-}")
-
-;; We don't have a floating-point "lt" insn, so use "gt" and swap the
-;; operands, the same as we do "blt".
-(define_expand "slt"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (a29k_compare_fp_p)
- operands[1] = gen_rtx (GT, SImode, a29k_compare_op1, a29k_compare_op0);
- else
- operands[1] = gen_rtx (LT, SImode, a29k_compare_op0, a29k_compare_op1);
-}")
-
-;; Similarly for "le"
-(define_expand "sle"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (a29k_compare_fp_p)
- operands[1] = gen_rtx (GE, SImode, a29k_compare_op1, a29k_compare_op0);
- else
- operands[1] = gen_rtx (LE, SImode, a29k_compare_op0, a29k_compare_op1);
-}")
-
-(define_expand "sltu"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (ltu:SI (match_dup 1) (match_dup 2)))]
- ""
- "
-{
- operands[1] = a29k_compare_op0;
- operands[2] = a29k_compare_op1;
-}")
-
-(define_expand "sleu"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (leu:SI (match_dup 1) (match_dup 2)))]
- ""
- "
-{
- operands[1] = a29k_compare_op0;
- operands[2] = a29k_compare_op1;
-}")
-
-(define_expand "sgt"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (gt:SI (match_dup 1) (match_dup 2)))]
- ""
- "
-{
- operands[1] = a29k_compare_op0;
- operands[2] = a29k_compare_op1;
-}")
-
-(define_expand "sge"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (ge:SI (match_dup 1) (match_dup 2)))]
- ""
- "
-{
- operands[1] = a29k_compare_op0;
- operands[2] = a29k_compare_op1;
-}")
-
-(define_expand "sgtu"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (gtu:SI (match_dup 1) (match_dup 2)))]
- ""
- "
-{
- operands[1] = a29k_compare_op0;
- operands[2] = a29k_compare_op1;
-}")
-
-(define_expand "sgeu"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (geu:SI (match_dup 1) (match_dup 2)))]
- ""
- "
-{
- operands[1] = a29k_compare_op0;
- operands[2] = a29k_compare_op1;
-}")
-
-;; Now define the actual jump insns.
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "branch_operator"
- [(match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0)])
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "jmp%b0 %1,%l2%#"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "branch_operator"
- [(match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0)])
- (return)
- (pc)))]
- "null_epilogue ()"
- "jmp%b0i %1,lr0%#"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "branch_operator"
- [(match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0)])
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "jmp%B0 %1,%l2%#"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "branch_operator"
- [(match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0)])
- (pc)
- (return)))]
- "null_epilogue ()"
- "jmp%B0i %1,lr0%#"
- [(set_attr "type" "branch")])
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jmp %e0%E0"
- [(set_attr "type" "branch")])
-
-(define_insn "return"
- [(return)]
- "null_epilogue ()"
- "jmpi lr0%#"
- [(set_attr "type" "branch")])
-
-(define_insn "indirect_jump"
- [(set (pc)
- (match_operand:SI 0 "gpc_reg_operand" "r"))]
- ""
- "jmpi %0%#"
- [(set_attr "type" "branch")])
-
-(define_insn "tablejump"
- [(set (pc)
- (match_operand:SI 0 "gpc_reg_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jmpi %0%#"
- [(set_attr "type" "branch")])
-
-;; JMPFDEC
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (match_operand:SI 0 "gpc_reg_operand" "r")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- ""
- "jmpfdec %0,%l1%#"
- [(set_attr "type" "branch")])
diff --git a/gcc/config/a29k/t-a29k b/gcc/config/a29k/t-a29k
deleted file mode 100644
index 74684229a13..00000000000
--- a/gcc/config/a29k/t-a29k
+++ /dev/null
@@ -1,5 +0,0 @@
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# We need crt0.o.
-LIBGCC1_TEST =
diff --git a/gcc/config/a29k/t-a29kbare b/gcc/config/a29k/t-a29kbare
deleted file mode 100644
index 21ba24f86e8..00000000000
--- a/gcc/config/a29k/t-a29kbare
+++ /dev/null
@@ -1,19 +0,0 @@
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# We need crt0.o.
-LIBGCC1_TEST =
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-
diff --git a/gcc/config/a29k/t-vx29k b/gcc/config/a29k/t-vx29k
deleted file mode 100644
index 6cf4d9f7b2a..00000000000
--- a/gcc/config/a29k/t-vx29k
+++ /dev/null
@@ -1,17 +0,0 @@
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# We need crt0.o.
-LIBGCC1_TEST =
-
-# We don't want to put exit in libgcc.a for VxWorks, because VxWorks
-# does not have _exit.
-LIBGCC2_CFLAGS = -O2 $(GCC_CFLAGS) -g1 -Dexit=unused_exit
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
diff --git a/gcc/config/a29k/udi.h b/gcc/config/a29k/udi.h
deleted file mode 100644
index 400ffbbe985..00000000000
--- a/gcc/config/a29k/udi.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Definitions of target machine for GNU compiler, for AMD Am29000 CPU
- running over UDI using COFF.
- Copyright (C) 1994, 1996 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. */
-
-/* Support the ctors and dtors sections for g++. */
-
-#define CTORS_SECTION_ASM_OP "\t.use .ctors"
-#define DTORS_SECTION_ASM_OP "\t.use .dtors"
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS readonly_data, in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- READONLY_DATA_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define READONLY_DATA_FUNCTION \
-void \
-literal_section () \
-{ \
- if (in_section != readonly_data) \
- { \
- fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \
- in_section = readonly_data; \
- } \
-} \
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-#define INT_ASM_OP ".word"
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
diff --git a/gcc/config/a29k/unix.h b/gcc/config/a29k/unix.h
deleted file mode 100644
index f05f258e94e..00000000000
--- a/gcc/config/a29k/unix.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Definitions of target machine for GNU compiler, for AMD Am29000 CPU, Unix.
- Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-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. */
-
-
-/* We define unix instead of EPI and define unix-style machine names. */
-
-/* Set our default target to be the 29050; that is the more interesting chip
- for Unix systems. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (1+2+16+128)
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dam29k -Da29k -Dam29000 -Asystem(unix) -Acpu(a29k) -Amachine(a29k)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{!m29000:-Dam29050 -D__am29050__}"
-
-/* Use a default linker configuration file. */
-#undef LINK_SPEC
-#define LINK_SPEC "-T default.gld%s"
-
-/* Define the magic numbers that we recognize as COFF. */
-
-#define MY_ISCOFF(magic) ((magic) == SIPFBOMAGIC || (magic) == SIPRBOMAGIC)
-
-/* For some systems, it is best if double-word objects are aligned on a
- doubleword boundary. We want to maintain compatibility with MetaWare in
- a29k.h, but do not feel constrained to do so here. */
-
-#undef BIGGEST_ALIGNMENT
-#define BIGGEST_ALIGNMENT 64
-
-/* Add shared data as a kludge for now. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-{ char *p, *after_dir = main_input_filename; \
- if (TARGET_29050) \
- fprintf (FILE, "\t.cputype 29050\n"); \
- for (p = main_input_filename; *p; p++) \
- if (*p == '/') \
- after_dir = p + 1; \
- fprintf (FILE, "\t.file "); \
- output_quoted_string (FILE, after_dir); \
- fprintf (FILE, "\n"); \
- if (flag_shared_data) \
- fprintf (FILE, "\t.sect .shdata,data\n"); \
- fprintf (FILE, "\t.sect .lit,lit\n"); }
-
-/* Output before shared data. */
-
-#define SHARED_SECTION_ASM_OP "\t.use .shdata"
-
-/* If we want shared data, we have to turn off commons. */
-
-#define OVERRIDE_OPTIONS if (flag_shared_data) flag_no_common = 1;
-
-/* Default to -fno-pcc-struct-return, since we don't have to worry about
- compatibility. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-#if 0 /* This would be needed except that the 29k doesn't have strict
- alignment requirements. */
-
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
- (((TYPE) != 0) \
- ? ((TYPE_ALIGN(TYPE) <= PARM_BOUNDARY) \
- ? PARM_BOUNDARY \
- : TYPE_ALIGN(TYPE)) \
- : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
- ? PARM_BOUNDARY \
- : GET_MODE_ALIGNMENT(MODE)))
-#endif
diff --git a/gcc/config/a29k/vx29k.h b/gcc/config/a29k/vx29k.h
deleted file mode 100644
index 8739b1ba7e2..00000000000
--- a/gcc/config/a29k/vx29k.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Definitions of target machine for GNU compiler. Vxworks 29k version.
- Copyright (C) 1994, 1995, 1996 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 just exists to give specs for the 29k running on VxWorks. */
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D_AM29K -D_AM29000 -Acpu(a29k) -Amachine(a29k) -D__vxworks -D__vxworks_5"
-
-/* Vxworks header files require that the macro CPU be set.
- We could define it in CPP_PREDEFINES, but the value is (or will be)
- dependent upon GCC options. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "-DCPU=AM29200"
-
-/* VxWorks does all the library stuff itself. */
-
-#undef LIB_SPEC
-#define LIB_SPEC ""
-
-/* VxWorks provides the functionality of crt0.o and friends itself. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "crtbegin.o%s"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s"
diff --git a/gcc/config/a29k/x-unix b/gcc/config/a29k/x-unix
deleted file mode 100644
index ed85ea32a9e..00000000000
--- a/gcc/config/a29k/x-unix
+++ /dev/null
@@ -1,2 +0,0 @@
-# Needed for missing functions in Sym1.
-CLIB=-liberty -lld
diff --git a/gcc/config/a29k/xm-a29k.h b/gcc/config/a29k/xm-a29k.h
deleted file mode 100644
index 774e34b38a8..00000000000
--- a/gcc/config/a29k/xm-a29k.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Configuration for GNU C-compiler for AMD Am29000 processor.
- Copyright (C) 1987, 1988, 1993 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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
deleted file mode 100644
index 3203eb847fe..00000000000
--- a/gcc/config/alpha/alpha.c
+++ /dev/null
@@ -1,3172 +0,0 @@
-/* Subroutines used for code generation on the DEC Alpha.
- Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "recog.h"
-#include "reload.h"
-#include "expr.h"
-#include "obstack.h"
-#include "tree.h"
-
-/* Specify which cpu to schedule for. */
- enum processor_type alpha_cpu;
-
-/* Specify how accurate floating-point traps need to be. */
-
-enum alpha_trap_precision alpha_tp;
-
-/* Specify the floating-point rounding mode. */
-
-enum alpha_fp_rounding_mode alpha_fprm;
-
-/* Specify which things cause traps. */
-
-enum alpha_fp_trap_mode alpha_fptm;
-
-/* Strings decoded into the above options. */
-char *alpha_cpu_string; /* -mcpu=ev[4|5] */
-char *alpha_tp_string; /* -mtrap-precision=[p|s|i] */
-char *alpha_fprm_string; /* -mfp-rounding-mode=[n|m|c|d] */
-char *alpha_fptm_string; /* -mfp-trap-mode=[n|u|su|sui] */
-
-/* Save information from a "cmpxx" operation until the branch or scc is
- emitted. */
-
-rtx alpha_compare_op0, alpha_compare_op1;
-int alpha_compare_fp_p;
-
-/* Save the name of the current function as used by the assembler. This
- is used by the epilogue. */
-
-char *alpha_function_name;
-
-/* Non-zero if inside of a function, because the Alpha asm can't
- handle .files inside of functions. */
-
-static int inside_function = FALSE;
-
-/* Non-zero if an instruction that may cause a trap is pending. */
-
-static int trap_pending = 0;
-
-/* Nonzero if the current function needs gp. */
-
-int alpha_function_needs_gp;
-
-extern char *version_string;
-extern int rtx_equal_function_value_matters;
-
-/* Declarations of static functions. */
-static void alpha_set_memflags_1 PROTO((rtx, int, int, int));
-static rtx alpha_emit_set_const_1 PROTO((rtx, enum machine_mode,
- HOST_WIDE_INT, int));
-static void add_long_const PROTO((FILE *, HOST_WIDE_INT, int, int, int));
-
-/* Compute the size of the save area in the stack. */
-static void alpha_sa_mask PROTO((unsigned long *imaskP,
- unsigned long *fmaskP));
-/* Strip type information. */
-#define CURRENT_FUNCTION_ARGS_INFO \
-(TARGET_OPEN_VMS ? current_function_args_info & 0xff \
- : current_function_args_info)
-
-/* Parse target option strings. */
-
-void
-override_options ()
-{
- alpha_cpu = PROCESSOR_EV4;
-
- if (alpha_cpu_string)
- {
- if (! strcmp (alpha_cpu_string, "ev4")
- || ! strcmp (alpha_cpu_string, "21064"))
- alpha_cpu = PROCESSOR_EV4;
- else if (! strcmp (alpha_cpu_string, "ev5")
- || ! strcmp (alpha_cpu_string, "21164"))
- alpha_cpu = PROCESSOR_EV5;
- else
- error ("bad value `%s' for -mcpu switch", alpha_cpu_string);
- }
-
- alpha_tp = ALPHA_TP_PROG;
- alpha_fprm = ALPHA_FPRM_NORM;
- alpha_fptm = ALPHA_FPTM_N;
-
- if (TARGET_IEEE)
- {
- alpha_tp = ALPHA_TP_INSN;
- alpha_fptm = ALPHA_FPTM_SU;
- }
-
- if (TARGET_IEEE_WITH_INEXACT)
- {
- alpha_tp = ALPHA_TP_INSN;
- alpha_fptm = ALPHA_FPTM_SUI;
- }
-
- if (alpha_tp_string)
- {
- if (! strcmp (alpha_tp_string, "p"))
- alpha_tp = ALPHA_TP_PROG;
- else if (! strcmp (alpha_tp_string, "f"))
- alpha_tp = ALPHA_TP_FUNC;
- else if (! strcmp (alpha_tp_string, "i"))
- alpha_tp = ALPHA_TP_INSN;
- else
- error ("bad value `%s' for -mtrap-precision switch", alpha_tp_string);
- }
-
- if (alpha_fprm_string)
- {
- if (! strcmp (alpha_fprm_string, "n"))
- alpha_fprm = ALPHA_FPRM_NORM;
- else if (! strcmp (alpha_fprm_string, "m"))
- alpha_fprm = ALPHA_FPRM_MINF;
- else if (! strcmp (alpha_fprm_string, "c"))
- alpha_fprm = ALPHA_FPRM_CHOP;
- else if (! strcmp (alpha_fprm_string,"d"))
- alpha_fprm = ALPHA_FPRM_DYN;
- else
- error ("bad value `%s' for -mfp-rounding-mode switch",
- alpha_fprm_string);
- }
-
- if (alpha_fptm_string)
- {
- if (strcmp (alpha_fptm_string, "n") == 0)
- alpha_fptm = ALPHA_FPTM_N;
- else if (strcmp (alpha_fptm_string, "u") == 0)
- alpha_fptm = ALPHA_FPTM_U;
- else if (strcmp (alpha_fptm_string, "su") == 0)
- alpha_fptm = ALPHA_FPTM_SU;
- else if (strcmp (alpha_fptm_string, "sui") == 0)
- alpha_fptm = ALPHA_FPTM_SUI;
- else
- error ("bad value `%s' for -mfp-trap-mode switch", alpha_fptm_string);
- }
-
- /* Do some sanity checks on the above option. */
-
- if ((alpha_fptm == ALPHA_FPTM_SU || alpha_fptm == ALPHA_FPTM_SUI)
- && alpha_tp != ALPHA_TP_INSN)
- {
- warning ("fp software completion requires -mtrap-precision=i");
- alpha_tp = ALPHA_TP_INSN;
- }
-
- if (TARGET_FLOAT_VAX)
- {
- if (alpha_fprm == ALPHA_FPRM_MINF || alpha_fprm == ALPHA_FPRM_DYN)
- {
- warning ("rounding mode not supported for VAX floats");
- alpha_fprm = ALPHA_FPRM_NORM;
- }
- if (alpha_fptm == ALPHA_FPTM_SUI)
- {
- warning ("trap mode not supported for VAX floats");
- alpha_fptm = ALPHA_FPTM_SU;
- }
- }
-}
-
-/* Returns 1 if VALUE is a mask that contains full bytes of zero or ones. */
-
-int
-zap_mask (value)
- HOST_WIDE_INT value;
-{
- int i;
-
- for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR;
- i++, value >>= 8)
- if ((value & 0xff) != 0 && (value & 0xff) != 0xff)
- return 0;
-
- return 1;
-}
-
-/* Returns 1 if OP is either the constant zero or a register. If a
- register, it must be in the proper mode unless MODE is VOIDmode. */
-
-int
-reg_or_0_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return op == const0_rtx || register_operand (op, mode);
-}
-
-/* Return 1 if OP is a constant in the range of 0-63 (for a shift) or
- any register. */
-
-int
-reg_or_6bit_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return ((GET_CODE (op) == CONST_INT
- && (unsigned HOST_WIDE_INT) INTVAL (op) < 64)
- || register_operand (op, mode));
-}
-
-
-/* Return 1 if OP is an 8-bit constant or any register. */
-
-int
-reg_or_8bit_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return ((GET_CODE (op) == CONST_INT
- && (unsigned HOST_WIDE_INT) INTVAL (op) < 0x100)
- || register_operand (op, mode));
-}
-
-/* Return 1 if OP is an 8-bit constant. */
-
-int
-cint8_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && (unsigned HOST_WIDE_INT) INTVAL (op) < 0x100);
-}
-
-/* Return 1 if the operand is a valid second operand to an add insn. */
-
-int
-add_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return (CONST_OK_FOR_LETTER_P (INTVAL (op), 'K')
- || CONST_OK_FOR_LETTER_P (INTVAL (op), 'L')
- || CONST_OK_FOR_LETTER_P (INTVAL (op), 'O'));
-
- return register_operand (op, mode);
-}
-
-/* Return 1 if the operand is a valid second operand to a sign-extending
- add insn. */
-
-int
-sext_add_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return ((unsigned HOST_WIDE_INT) INTVAL (op) < 255
- || (unsigned HOST_WIDE_INT) (- INTVAL (op)) < 255);
-
- return register_operand (op, mode);
-}
-
-/* Return 1 if OP is the constant 4 or 8. */
-
-int
-const48_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && (INTVAL (op) == 4 || INTVAL (op) == 8));
-}
-
-/* Return 1 if OP is a valid first operand to an AND insn. */
-
-int
-and_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode)
- return (zap_mask (CONST_DOUBLE_LOW (op))
- && zap_mask (CONST_DOUBLE_HIGH (op)));
-
- if (GET_CODE (op) == CONST_INT)
- return ((unsigned HOST_WIDE_INT) INTVAL (op) < 0x100
- || (unsigned HOST_WIDE_INT) ~ INTVAL (op) < 0x100
- || zap_mask (INTVAL (op)));
-
- return register_operand (op, mode);
-}
-
-/* Return 1 if OP is a valid first operand to an IOR or XOR insn. */
-
-int
-or_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return ((unsigned HOST_WIDE_INT) INTVAL (op) < 0x100
- || (unsigned HOST_WIDE_INT) ~ INTVAL (op) < 0x100);
-
- return register_operand (op, mode);
-}
-
-/* Return 1 if OP is a constant that is the width, in bits, of an integral
- mode smaller than DImode. */
-
-int
-mode_width_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && (INTVAL (op) == 8 || INTVAL (op) == 16 || INTVAL (op) == 32));
-}
-
-/* Return 1 if OP is a constant that is the width of an integral machine mode
- smaller than an integer. */
-
-int
-mode_mask_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
-#if HOST_BITS_PER_WIDE_INT == 32
- if (GET_CODE (op) == CONST_DOUBLE)
- return CONST_DOUBLE_HIGH (op) == 0 && CONST_DOUBLE_LOW (op) == -1;
-#endif
-
- return (GET_CODE (op) == CONST_INT
- && (INTVAL (op) == 0xff
- || INTVAL (op) == 0xffff
-#if HOST_BITS_PER_WIDE_INT == 64
- || INTVAL (op) == 0xffffffff
-#endif
- ));
-}
-
-/* Return 1 if OP is a multiple of 8 less than 64. */
-
-int
-mul8_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && (unsigned HOST_WIDE_INT) INTVAL (op) < 64
- && (INTVAL (op) & 7) == 0);
-}
-
-/* Return 1 if OP is the constant zero in floating-point. */
-
-int
-fp0_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_MODE (op) == mode
- && GET_MODE_CLASS (mode) == MODE_FLOAT && op == CONST0_RTX (mode));
-}
-
-/* Return 1 if OP is the floating-point constant zero or a register. */
-
-int
-reg_or_fp0_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return fp0_operand (op, mode) || register_operand (op, mode);
-}
-
-/* Return 1 if OP is a register or a constant integer. */
-
-
-int
-reg_or_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == CONST_INT || register_operand (op, mode);
-}
-
-/* Return 1 if OP is something that can be reloaded into a register;
- if it is a MEM, it need not be valid. */
-
-int
-some_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op))
- return 0;
-
- switch (GET_CODE (op))
- {
- case REG: case MEM: case CONST_DOUBLE:
- case CONST_INT: case LABEL_REF: case SYMBOL_REF: case CONST:
- return 1;
-
- case SUBREG:
- return some_operand (SUBREG_REG (op), VOIDmode);
- }
-
- return 0;
-}
-
-/* Return 1 if OP is a valid operand for the source of a move insn. */
-
-int
-input_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op))
- return 0;
-
- if (GET_MODE_CLASS (mode) == MODE_FLOAT && GET_MODE (op) != mode)
- return 0;
-
- switch (GET_CODE (op))
- {
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST:
- /* This handles both the Windows/NT and OSF cases. */
- return mode == ptr_mode || mode == DImode;
-
- case REG:
- return 1;
-
- case SUBREG:
- if (register_operand (op, mode))
- return 1;
- /* ... fall through ... */
- case MEM:
- return (TARGET_BYTE_OPS || (mode != HImode && mode != QImode)
- && general_operand (op, mode));
-
- case CONST_DOUBLE:
- return GET_MODE_CLASS (mode) == MODE_FLOAT && op == CONST0_RTX (mode);
-
- case CONST_INT:
- return mode == QImode || mode == HImode || add_operand (op, mode);
- }
-
- return 0;
-}
-
-/* Return 1 if OP is a SYMBOL_REF for a function known to be in this
- file. */
-
-int
-current_file_function_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == SYMBOL_REF
- && ! profile_flag && ! profile_block_flag
- && (SYMBOL_REF_FLAG (op)
- || op == XEXP (DECL_RTL (current_function_decl), 0)));
-}
-
-/* Return 1 if OP is a valid operand for the MEM of a CALL insn. */
-
-int
-call_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (mode != Pmode)
- return 0;
-
- return (GET_CODE (op) == SYMBOL_REF
- || (GET_CODE (op) == REG && (TARGET_OPEN_VMS || REGNO (op) == 27)));
-}
-
-/* Return 1 if OP is a valid Alpha comparison operator. Here we know which
- comparisons are valid in which insn. */
-
-int
-alpha_comparison_operator (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (op);
-
- if (mode != GET_MODE (op) || GET_RTX_CLASS (code) != '<')
- return 0;
-
- return (code == EQ || code == LE || code == LT
- || (mode == DImode && (code == LEU || code == LTU)));
-}
-
-/* Return 1 if OP is a valid Alpha swapped comparison operator. */
-
-int
-alpha_swapped_comparison_operator (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (op);
-
- if (mode != GET_MODE (op) || GET_RTX_CLASS (code) != '<')
- return 0;
-
- code = swap_condition (code);
- return (code == EQ || code == LE || code == LT
- || (mode == DImode && (code == LEU || code == LTU)));
-}
-
-/* Return 1 if OP is a signed comparison operation. */
-
-int
-signed_comparison_operator (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case EQ: case NE: case LE: case LT: case GE: case GT:
- return 1;
- }
-
- return 0;
-}
-
-/* Return 1 if this is a divide or modulus operator. */
-
-int
-divmod_operator (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case DIV: case MOD: case UDIV: case UMOD:
- return 1;
- }
-
- return 0;
-}
-
-/* Return 1 if this memory address is a known aligned register plus
- a constant. It must be a valid address. This means that we can do
- this as an aligned reference plus some offset.
-
- Take into account what reload will do.
-
- We could say that out-of-range stack slots are alignable, but that would
- complicate get_aligned_mem and it isn't worth the trouble since few
- functions have large stack space. */
-
-int
-aligned_memory_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == SUBREG)
- {
- if (GET_MODE (op) != mode)
- return 0;
- op = SUBREG_REG (op);
- mode = GET_MODE (op);
- }
-
- if (reload_in_progress && GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER)
- op = reg_equiv_mem[REGNO (op)];
-
- if (GET_CODE (op) != MEM || GET_MODE (op) != mode
- || ! memory_address_p (mode, XEXP (op, 0)))
- return 0;
-
- op = XEXP (op, 0);
-
- if (GET_CODE (op) == PLUS)
- op = XEXP (op, 0);
-
- return (GET_CODE (op) == REG
- && REGNO_POINTER_ALIGN (REGNO (op)) >= 4);
-}
-
-/* Similar, but return 1 if OP is a MEM which is not alignable. */
-
-int
-unaligned_memory_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == SUBREG)
- {
- if (GET_MODE (op) != mode)
- return 0;
- op = SUBREG_REG (op);
- mode = GET_MODE (op);
- }
-
- if (reload_in_progress && GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER)
- op = reg_equiv_mem[REGNO (op)];
-
- if (GET_CODE (op) != MEM || GET_MODE (op) != mode)
- return 0;
-
- op = XEXP (op, 0);
-
- if (! memory_address_p (mode, op))
- return 1;
-
- if (GET_CODE (op) == PLUS)
- op = XEXP (op, 0);
-
- return (GET_CODE (op) != REG
- || REGNO_POINTER_ALIGN (REGNO (op)) < 4);
-}
-
-/* Return 1 if OP is either a register or an unaligned memory location. */
-
-int
-reg_or_unaligned_mem_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return register_operand (op, mode) || unaligned_memory_operand (op, mode);
-}
-
-/* Return 1 if OP is any memory location. During reload a pseudo matches. */
-
-int
-any_memory_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == MEM
- || (GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == REG)
- || (reload_in_progress && GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER)
- || (reload_in_progress && GET_CODE (op) == SUBREG
- && GET_CODE (SUBREG_REG (op)) == REG
- && REGNO (SUBREG_REG (op)) >= FIRST_PSEUDO_REGISTER));
-}
-
-/* REF is an alignable memory location. Place an aligned SImode
- reference into *PALIGNED_MEM and the number of bits to shift into
- *PBITNUM. */
-
-void
-get_aligned_mem (ref, paligned_mem, pbitnum)
- rtx ref;
- rtx *paligned_mem, *pbitnum;
-{
- rtx base;
- HOST_WIDE_INT offset = 0;
-
- if (GET_CODE (ref) == SUBREG)
- {
- offset = SUBREG_WORD (ref) * UNITS_PER_WORD;
- if (BYTES_BIG_ENDIAN)
- offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (ref)))
- - MIN (UNITS_PER_WORD,
- GET_MODE_SIZE (GET_MODE (SUBREG_REG (ref)))));
- ref = SUBREG_REG (ref);
- }
-
- if (GET_CODE (ref) == REG)
- ref = reg_equiv_mem[REGNO (ref)];
-
- if (reload_in_progress)
- base = find_replacement (&XEXP (ref, 0));
- else
- base = XEXP (ref, 0);
-
- if (GET_CODE (base) == PLUS)
- offset += INTVAL (XEXP (base, 1)), base = XEXP (base, 0);
-
- *paligned_mem = gen_rtx (MEM, SImode,
- plus_constant (base, offset & ~3));
- MEM_IN_STRUCT_P (*paligned_mem) = MEM_IN_STRUCT_P (ref);
- MEM_VOLATILE_P (*paligned_mem) = MEM_VOLATILE_P (ref);
- RTX_UNCHANGING_P (*paligned_mem) = RTX_UNCHANGING_P (ref);
-
- *pbitnum = GEN_INT ((offset & 3) * 8);
-}
-
-/* Similar, but just get the address. Handle the two reload cases.
- Add EXTRA_OFFSET to the address we return. */
-
-rtx
-get_unaligned_address (ref, extra_offset)
- rtx ref;
- int extra_offset;
-{
- rtx base;
- HOST_WIDE_INT offset = 0;
-
- if (GET_CODE (ref) == SUBREG)
- {
- offset = SUBREG_WORD (ref) * UNITS_PER_WORD;
- if (BYTES_BIG_ENDIAN)
- offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (ref)))
- - MIN (UNITS_PER_WORD,
- GET_MODE_SIZE (GET_MODE (SUBREG_REG (ref)))));
- ref = SUBREG_REG (ref);
- }
-
- if (GET_CODE (ref) == REG)
- ref = reg_equiv_mem[REGNO (ref)];
-
- if (reload_in_progress)
- base = find_replacement (&XEXP (ref, 0));
- else
- base = XEXP (ref, 0);
-
- if (GET_CODE (base) == PLUS)
- offset += INTVAL (XEXP (base, 1)), base = XEXP (base, 0);
-
- return plus_constant (base, offset + extra_offset);
-}
-
-/* Subfunction of the following function. Update the flags of any MEM
- found in part of X. */
-
-static void
-alpha_set_memflags_1 (x, in_struct_p, volatile_p, unchanging_p)
- rtx x;
- int in_struct_p, volatile_p, unchanging_p;
-{
- int i;
-
- switch (GET_CODE (x))
- {
- case SEQUENCE:
- case PARALLEL:
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- alpha_set_memflags_1 (XVECEXP (x, 0, i), in_struct_p, volatile_p,
- unchanging_p);
- break;
-
- case INSN:
- alpha_set_memflags_1 (PATTERN (x), in_struct_p, volatile_p,
- unchanging_p);
- break;
-
- case SET:
- alpha_set_memflags_1 (SET_DEST (x), in_struct_p, volatile_p,
- unchanging_p);
- alpha_set_memflags_1 (SET_SRC (x), in_struct_p, volatile_p,
- unchanging_p);
- break;
-
- case MEM:
- MEM_IN_STRUCT_P (x) = in_struct_p;
- MEM_VOLATILE_P (x) = volatile_p;
- RTX_UNCHANGING_P (x) = unchanging_p;
- break;
- }
-}
-
-/* Given INSN, which is either an INSN or a SEQUENCE generated to
- perform a memory operation, look for any MEMs in either a SET_DEST or
- a SET_SRC and copy the in-struct, unchanging, and volatile flags from
- REF into each of the MEMs found. If REF is not a MEM, don't do
- anything. */
-
-void
-alpha_set_memflags (insn, ref)
- rtx insn;
- rtx ref;
-{
- /* Note that it is always safe to get these flags, though they won't
- be what we think if REF is not a MEM. */
- int in_struct_p = MEM_IN_STRUCT_P (ref);
- int volatile_p = MEM_VOLATILE_P (ref);
- int unchanging_p = RTX_UNCHANGING_P (ref);
-
- if (GET_CODE (ref) != MEM
- || (! in_struct_p && ! volatile_p && ! unchanging_p))
- return;
-
- alpha_set_memflags_1 (insn, in_struct_p, volatile_p, unchanging_p);
-}
-
-/* Try to output insns to set TARGET equal to the constant C if it can be
- done in less than N insns. Do all computations in MODE. Returns the place
- where the output has been placed if it can be done and the insns have been
- emitted. If it would take more than N insns, zero is returned and no
- insns and emitted. */
-
-rtx
-alpha_emit_set_const (target, mode, c, n)
- rtx target;
- enum machine_mode mode;
- HOST_WIDE_INT c;
- int n;
-{
- rtx pat;
- int i;
-
- /* Try 1 insn, then 2, then up to N. */
- for (i = 1; i <= n; i++)
- if ((pat = alpha_emit_set_const_1 (target, mode, c, i)) != 0)
- return pat;
-
- return 0;
-}
-
-/* Internal routine for the above to check for N or below insns. */
-
-static rtx
-alpha_emit_set_const_1 (target, mode, c, n)
- rtx target;
- enum machine_mode mode;
- HOST_WIDE_INT c;
- int n;
-{
- HOST_WIDE_INT new = c;
- int i, bits;
- /* Use a pseudo if highly optimizing and still generating RTL. */
- rtx subtarget
- = (flag_expensive_optimizations && rtx_equal_function_value_matters
- ? 0 : target);
- rtx temp;
-
-#if HOST_BITS_PER_WIDE_INT == 64
- /* We are only called for SImode and DImode. If this is SImode, ensure that
- we are sign extended to a full word. This does not make any sense when
- cross-compiling on a narrow machine. */
-
- if (mode == SImode)
- c = (c & 0xffffffff) - 2 * (c & 0x80000000);
-#endif
-
- /* If this is a sign-extended 32-bit constant, we can do this in at most
- three insns, so do it if we have enough insns left. We always have
- a sign-extended 32-bit constant when compiling on a narrow machine.
- Note that we cannot handle the constant 0x80000000. */
-
- if ((HOST_BITS_PER_WIDE_INT != 64
- || c >> 31 == -1 || c >> 31 == 0)
- && c != 0x80000000U)
- {
- HOST_WIDE_INT low = (c & 0xffff) - 2 * (c & 0x8000);
- HOST_WIDE_INT tmp1 = c - low;
- HOST_WIDE_INT high
- = ((tmp1 >> 16) & 0xffff) - 2 * ((tmp1 >> 16) & 0x8000);
- HOST_WIDE_INT extra = 0;
-
- /* If HIGH will be interpreted as negative but the constant is
- positive, we must adjust it to do two ldha insns. */
-
- if ((high & 0x8000) != 0 && c >= 0)
- {
- extra = 0x4000;
- tmp1 -= 0x40000000;
- high = ((tmp1 >> 16) & 0xffff) - 2 * ((tmp1 >> 16) & 0x8000);
- }
-
- if (c == low || (low == 0 && extra == 0))
- return copy_to_suggested_reg (GEN_INT (c), target, mode);
- else if (n >= 2 + (extra != 0))
- {
- temp = copy_to_suggested_reg (GEN_INT (low), subtarget, mode);
-
- if (extra != 0)
- temp = expand_binop (mode, add_optab, temp, GEN_INT (extra << 16),
- subtarget, 0, OPTAB_WIDEN);
-
- return expand_binop (mode, add_optab, temp, GEN_INT (high << 16),
- target, 0, OPTAB_WIDEN);
- }
- }
-
- /* If we couldn't do it that way, try some other methods. But if we have
- no instructions left, don't bother. Likewise, if this is SImode and
- we can't make pseudos, we can't do anything since the expand_binop
- and expand_unop calls will widen and try to make pseudos. */
-
- if (n == 1
- || (mode == SImode && ! rtx_equal_function_value_matters))
- return 0;
-
-#if HOST_BITS_PER_WIDE_INT == 64
- /* First, see if can load a value into the target that is the same as the
- constant except that all bytes that are 0 are changed to be 0xff. If we
- can, then we can do a ZAPNOT to obtain the desired constant. */
-
- for (i = 0; i < 64; i += 8)
- if ((new & ((HOST_WIDE_INT) 0xff << i)) == 0)
- new |= (HOST_WIDE_INT) 0xff << i;
-
- /* We are only called for SImode and DImode. If this is SImode, ensure that
- we are sign extended to a full word. */
-
- if (mode == SImode)
- new = (new & 0xffffffff) - 2 * (new & 0x80000000);
-
- if (new != c
- && (temp = alpha_emit_set_const (subtarget, mode, new, n - 1)) != 0)
- return expand_binop (mode, and_optab, temp, GEN_INT (c | ~ new),
- target, 0, OPTAB_WIDEN);
-#endif
-
- /* Next, see if we can load a related constant and then shift and possibly
- negate it to get the constant we want. Try this once each increasing
- numbers of insns. */
-
- for (i = 1; i < n; i++)
- {
- /* First try complementing. */
- if ((temp = alpha_emit_set_const (subtarget, mode, ~ c, i)) != 0)
- return expand_unop (mode, one_cmpl_optab, temp, target, 0);
-
- /* Next try to form a constant and do a left shift. We can do this
- if some low-order bits are zero; the exact_log2 call below tells
- us that information. The bits we are shifting out could be any
- value, but here we'll just try the 0- and sign-extended forms of
- the constant. To try to increase the chance of having the same
- constant in more than one insn, start at the highest number of
- bits to shift, but try all possibilities in case a ZAPNOT will
- be useful. */
-
- if ((bits = exact_log2 (c & - c)) > 0)
- for (; bits > 0; bits--)
- if ((temp = (alpha_emit_set_const
- (subtarget, mode,
- (unsigned HOST_WIDE_INT) c >> bits, i))) != 0
- || ((temp = (alpha_emit_set_const
- (subtarget, mode,
- ((unsigned HOST_WIDE_INT) c) >> bits, i)))
- != 0))
- return expand_binop (mode, ashl_optab, temp, GEN_INT (bits),
- target, 0, OPTAB_WIDEN);
-
- /* Now try high-order zero bits. Here we try the shifted-in bits as
- all zero and all ones. Be careful to avoid shifting outside the
- mode and to avoid shifting outside the host wide int size. */
-
- if ((bits = (MIN (HOST_BITS_PER_WIDE_INT, GET_MODE_SIZE (mode) * 8)
- - floor_log2 (c) - 1)) > 0)
- for (; bits > 0; bits--)
- if ((temp = alpha_emit_set_const (subtarget, mode,
- c << bits, i)) != 0
- || ((temp = (alpha_emit_set_const
- (subtarget, mode,
- ((c << bits) | (((HOST_WIDE_INT) 1 << bits) - 1)),
- i)))
- != 0))
- return expand_binop (mode, lshr_optab, temp, GEN_INT (bits),
- target, 1, OPTAB_WIDEN);
-
- /* Now try high-order 1 bits. We get that with a sign-extension.
- But one bit isn't enough here. Be careful to avoid shifting outside
- the mode and to avoid shifting outside the host wide int size. */
-
- if ((bits = (MIN (HOST_BITS_PER_WIDE_INT, GET_MODE_SIZE (mode) * 8)
- - floor_log2 (~ c) - 2)) > 0)
- for (; bits > 0; bits--)
- if ((temp = alpha_emit_set_const (subtarget, mode,
- c << bits, i)) != 0
- || ((temp = (alpha_emit_set_const
- (subtarget, mode,
- ((c << bits) | (((HOST_WIDE_INT) 1 << bits) - 1)),
- i)))
- != 0))
- return expand_binop (mode, ashr_optab, temp, GEN_INT (bits),
- target, 0, OPTAB_WIDEN);
- }
-
- return 0;
-}
-
-#if HOST_BITS_PER_WIDE_INT == 64
-/* Having failed to find a 3 insn sequence in alpha_emit_set_const,
- fall back to a straight forward decomposition. We do this to avoid
- exponential run times encountered when looking for longer sequences
- with alpha_emit_set_const. */
-
-rtx
-alpha_emit_set_long_const (target, c)
- rtx target;
- HOST_WIDE_INT c;
-{
- /* Use a pseudo if highly optimizing and still generating RTL. */
- rtx subtarget
- = (flag_expensive_optimizations && rtx_equal_function_value_matters
- ? 0 : target);
- HOST_WIDE_INT d1, d2, d3, d4;
- rtx r1, r2;
-
- /* Decompose the entire word */
- d1 = ((c & 0xffff) ^ 0x8000) - 0x8000;
- c -= d1;
- d2 = ((c & 0xffffffff) ^ 0x80000000) - 0x80000000;
- c = (c - d2) >> 32;
- d3 = ((c & 0xffff) ^ 0x8000) - 0x8000;
- c -= d3;
- d4 = ((c & 0xffffffff) ^ 0x80000000) - 0x80000000;
-
- if (c - d4 != 0)
- abort();
-
- /* Construct the high word */
- if (d3 == 0)
- r1 = copy_to_suggested_reg (GEN_INT (d4), subtarget, DImode);
- else if (d4 == 0)
- r1 = copy_to_suggested_reg (GEN_INT (d3), subtarget, DImode);
- else
- r1 = expand_binop (DImode, add_optab, GEN_INT (d3), GEN_INT (d4),
- subtarget, 0, OPTAB_WIDEN);
-
- /* Shift it into place */
- r2 = expand_binop (DImode, ashl_optab, r1, GEN_INT (32),
- subtarget, 0, OPTAB_WIDEN);
-
- if (subtarget == 0 && d1 == d3 && d2 == d4)
- r1 = expand_binop (DImode, add_optab, r1, r2, subtarget, 0, OPTAB_WIDEN);
- else
- {
- r1 = r2;
-
- /* Add in the low word */
- if (d2 != 0)
- r1 = expand_binop (DImode, add_optab, r1, GEN_INT (d2),
- subtarget, 0, OPTAB_WIDEN);
- if (d1 != 0)
- r1 = expand_binop (DImode, add_optab, r1, GEN_INT (d1),
- subtarget, 0, OPTAB_WIDEN);
- }
-
- if (subtarget == 0)
- r1 = copy_to_suggested_reg(r1, target, DImode);
-
- return r1;
-}
-#endif /* HOST_BITS_PER_WIDE_INT == 64 */
-
-/* Rewrite a comparison against zero CMP of the form
- (CODE (cc0) (const_int 0)) so it can be written validly in
- a conditional move (if_then_else CMP ...).
- If both of the operands that set cc0 are non-zero we must emit
- an insn to perform the compare (it can't be done within
- the conditional move). */
-rtx
-alpha_emit_conditional_move (cmp, mode)
- rtx cmp;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (cmp);
- enum rtx_code cmov_code = NE;
- rtx op0 = alpha_compare_op0;
- rtx op1 = alpha_compare_op1;
- enum machine_mode cmp_mode
- = (GET_MODE (op0) == VOIDmode ? DImode : GET_MODE (op0));
- enum machine_mode cmp_op_mode = alpha_compare_fp_p ? DFmode : DImode;
- rtx tem;
-
- if (alpha_compare_fp_p != FLOAT_MODE_P (mode))
- return 0;
-
- /* We may be able to use a conditional move directly.
- This avoids emitting spurious compares. */
- if (signed_comparison_operator (cmp, cmp_op_mode)
- && (op0 == CONST0_RTX (cmp_mode) || op1 == CONST0_RTX (cmp_mode)))
- return gen_rtx (code, VOIDmode, op0, op1);
-
- /* We can't put the comparison insides a conditional move;
- emit a compare instruction and put that inside the
- conditional move. Make sure we emit only comparisons we have;
- swap or reverse as necessary. */
-
- switch (code)
- {
- case EQ: case LE: case LT: case LEU: case LTU:
- /* We have these compares: */
- break;
-
- case NE:
- /* This must be reversed. */
- code = reverse_condition (code);
- cmov_code = EQ;
- break;
-
- case GE: case GT: case GEU: case GTU:
- /* These must be swapped. Make sure the new first operand is in
- a register. */
- code = swap_condition (code);
- tem = op0, op0 = op1, op1 = tem;
- op0 = force_reg (cmp_mode, op0);
- break;
-
- default:
- abort ();
- }
-
- tem = gen_reg_rtx (cmp_op_mode);
- emit_move_insn (tem, gen_rtx (code, cmp_op_mode, op0, op1));
- return gen_rtx (cmov_code, VOIDmode, tem, CONST0_RTX (cmp_op_mode));
-}
-
-/* Adjust the cost of a scheduling dependency. Return the new cost of
- a dependency LINK or INSN on DEP_INSN. COST is the current cost. */
-
-int
-alpha_adjust_cost (insn, link, dep_insn, cost)
- rtx insn;
- rtx link;
- rtx dep_insn;
- int cost;
-{
- rtx set;
-
- /* If the dependence is an anti-dependence, there is no cost. For an
- output dependence, there is sometimes a cost, but it doesn't seem
- worth handling those few cases. */
-
- if (REG_NOTE_KIND (link) != 0)
- return 0;
-
- /* EV5 costs are as given in alpha.md; exceptions are given here. */
- if (alpha_cpu == PROCESSOR_EV5)
- {
- /* And the lord DEC sayeth: "A special bypass provides an effective
- latency of 0 cycles for an ICMP or ILOG insn producing the test
- operand of an IBR or CMOV insn." */
- if (recog_memoized (dep_insn) >= 0
- && (get_attr_type (dep_insn) == TYPE_ICMP
- || get_attr_type (dep_insn) == TYPE_ILOG)
- && recog_memoized (insn) >= 0
- && (get_attr_type (insn) == TYPE_IBR
- || (get_attr_type (insn) == TYPE_CMOV
- && !((set = single_set (dep_insn)) != 0
- && GET_CODE (PATTERN (insn)) == SET
- && GET_CODE (SET_SRC (PATTERN (insn))) == IF_THEN_ELSE
- && (rtx_equal_p (SET_DEST (set),
- XEXP (SET_SRC (PATTERN (insn)), 1))
- || rtx_equal_p (SET_DEST (set),
- XEXP (SET_SRC (PATTERN (insn)), 2)))))))
- return 1;
- return cost;
- }
-
- /* If INSN is a store insn and DEP_INSN is setting the data being stored,
- we can sometimes lower the cost. */
-
- if (recog_memoized (insn) >= 0 && get_attr_type (insn) == TYPE_ST
- && (set = single_set (dep_insn)) != 0
- && GET_CODE (PATTERN (insn)) == SET
- && rtx_equal_p (SET_DEST (set), SET_SRC (PATTERN (insn))))
- switch (get_attr_type (dep_insn))
- {
- case TYPE_LD:
- /* No savings here. */
- return cost;
-
- case TYPE_IMULL:
- case TYPE_IMULQ:
- /* In these cases, we save one cycle. */
- return cost - 2;
-
- default:
- /* In all other cases, we save two cycles. */
- return MAX (0, cost - 4);
- }
-
- /* Another case that needs adjustment is an arithmetic or logical
- operation. It's cost is usually one cycle, but we default it to
- two in the MD file. The only case that it is actually two is
- for the address in loads and stores. */
-
- if (recog_memoized (dep_insn) >= 0
- && (get_attr_type (dep_insn) == TYPE_IADD
- || get_attr_type (dep_insn) == TYPE_ILOG))
- switch (get_attr_type (insn))
- {
- case TYPE_LD:
- case TYPE_ST:
- return cost;
-
- default:
- return 2;
- }
-
- /* The final case is when a compare feeds into an integer branch. The cost
- is only one cycle in that case. */
-
- if (recog_memoized (dep_insn) >= 0
- && get_attr_type (dep_insn) == TYPE_ICMP
- && recog_memoized (insn) >= 0
- && get_attr_type (insn) == TYPE_IBR)
- return 2;
-
- /* Otherwise, return the default cost. */
-
- return cost;
-}
-
-/* Print an operand. Recognize special options, documented below. */
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- char code;
-{
- int i;
-
- switch (code)
- {
- case '&':
- /* Generates fp-rounding mode suffix: nothing for normal, 'c' for
- chopped, 'm' for minus-infinity, and 'd' for dynamic rounding
- mode. alpha_fprm controls which suffix is generated. */
- switch (alpha_fprm)
- {
- case ALPHA_FPRM_NORM:
- break;
- case ALPHA_FPRM_MINF:
- fputc ('m', file);
- break;
- case ALPHA_FPRM_CHOP:
- fputc ('c', file);
- break;
- case ALPHA_FPRM_DYN:
- fputc ('d', file);
- break;
- }
- break;
-
- case '\'':
- /* Generates trap-mode suffix for instructions that accept the su
- suffix only (cmpt et al). */
- if (alpha_tp == ALPHA_TP_INSN)
- fputs ("su", file);
- break;
-
- case ')':
- /* Generates trap-mode suffix for instructions that accept the u, su,
- and sui suffix. This is the bulk of the IEEE floating point
- instructions (addt et al). */
- switch (alpha_fptm)
- {
- case ALPHA_FPTM_N:
- break;
- case ALPHA_FPTM_U:
- fputc ('u', file);
- break;
- case ALPHA_FPTM_SU:
- fputs ("su", file);
- break;
- case ALPHA_FPTM_SUI:
- fputs ("sui", file);
- break;
- }
- break;
-
- case '+':
- /* Generates trap-mode suffix for instructions that accept the sui
- suffix (cvtqt and cvtqs). */
- switch (alpha_fptm)
- {
- case ALPHA_FPTM_N: case ALPHA_FPTM_U:
- case ALPHA_FPTM_SU: /* cvtqt/cvtqs can't cause underflow */
- break;
- case ALPHA_FPTM_SUI:
- fputs ("sui", file);
- break;
- }
- break;
-
- case ',':
- /* Generates single precision instruction suffix. */
- fprintf (file, "%c", (TARGET_FLOAT_VAX?'f':'s'));
- break;
-
- case '-':
- /* Generates double precision instruction suffix. */
- fprintf (file, "%c", (TARGET_FLOAT_VAX?'g':'t'));
- break;
-
- case 'r':
- /* If this operand is the constant zero, write it as "$31". */
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x)]);
- else if (x == CONST0_RTX (GET_MODE (x)))
- fprintf (file, "$31");
- else
- output_operand_lossage ("invalid %%r value");
-
- break;
-
- case 'R':
- /* Similar, but for floating-point. */
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x)]);
- else if (x == CONST0_RTX (GET_MODE (x)))
- fprintf (file, "$f31");
- else
- output_operand_lossage ("invalid %%R value");
-
- break;
-
- case 'N':
- /* Write the 1's complement of a constant. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%N value");
-
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, ~ INTVAL (x));
- break;
-
- case 'P':
- /* Write 1 << C, for a constant C. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%P value");
-
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) 1 << INTVAL (x));
- break;
-
- case 'h':
- /* Write the high-order 16 bits of a constant, sign-extended. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%h value");
-
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) >> 16);
- break;
-
- case 'L':
- /* Write the low-order 16 bits of a constant, sign-extended. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%L value");
-
- fprintf (file, HOST_WIDE_INT_PRINT_DEC,
- (INTVAL (x) & 0xffff) - 2 * (INTVAL (x) & 0x8000));
- break;
-
- case 'm':
- /* Write mask for ZAP insn. */
- if (GET_CODE (x) == CONST_DOUBLE)
- {
- HOST_WIDE_INT mask = 0;
- HOST_WIDE_INT value;
-
- value = CONST_DOUBLE_LOW (x);
- for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR;
- i++, value >>= 8)
- if (value & 0xff)
- mask |= (1 << i);
-
- value = CONST_DOUBLE_HIGH (x);
- for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR;
- i++, value >>= 8)
- if (value & 0xff)
- mask |= (1 << (i + sizeof (int)));
-
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, mask & 0xff);
- }
-
- else if (GET_CODE (x) == CONST_INT)
- {
- HOST_WIDE_INT mask = 0, value = INTVAL (x);
-
- for (i = 0; i < 8; i++, value >>= 8)
- if (value & 0xff)
- mask |= (1 << i);
-
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, mask);
- }
- else
- output_operand_lossage ("invalid %%m value");
- break;
-
- case 'M':
- /* 'b', 'w', or 'l' as the value of the constant. */
- if (GET_CODE (x) != CONST_INT
- || (INTVAL (x) != 8 && INTVAL (x) != 16 && INTVAL (x) != 32))
- output_operand_lossage ("invalid %%M value");
-
- fprintf (file, "%s",
- INTVAL (x) == 8 ? "b" : INTVAL (x) == 16 ? "w" : "l");
- break;
-
- case 'U':
- /* Similar, except do it from the mask. */
- if (GET_CODE (x) == CONST_INT && INTVAL (x) == 0xff)
- fprintf (file, "b");
- else if (GET_CODE (x) == CONST_INT && INTVAL (x) == 0xffff)
- fprintf (file, "w");
-#if HOST_BITS_PER_WIDE_INT == 32
- else if (GET_CODE (x) == CONST_DOUBLE
- && CONST_DOUBLE_HIGH (x) == 0
- && CONST_DOUBLE_LOW (x) == -1)
- fprintf (file, "l");
-#else
- else if (GET_CODE (x) == CONST_INT && INTVAL (x) == 0xffffffff)
- fprintf (file, "l");
-#endif
- else
- output_operand_lossage ("invalid %%U value");
- break;
-
- case 's':
- /* Write the constant value divided by 8. */
- if (GET_CODE (x) != CONST_INT
- && (unsigned HOST_WIDE_INT) INTVAL (x) >= 64
- && (INTVAL (x) & 7) != 8)
- output_operand_lossage ("invalid %%s value");
-
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) / 8);
- break;
-
- case 'S':
- /* Same, except compute (64 - c) / 8 */
-
- if (GET_CODE (x) != CONST_INT
- && (unsigned HOST_WIDE_INT) INTVAL (x) >= 64
- && (INTVAL (x) & 7) != 8)
- output_operand_lossage ("invalid %%s value");
-
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, (64 - INTVAL (x)) / 8);
- break;
-
- case 'C': case 'D': case 'c': case 'd':
- /* Write out comparison name. */
- {
- enum rtx_code c = GET_CODE (x);
-
- if (GET_RTX_CLASS (c) != '<')
- output_operand_lossage ("invalid %%C value");
-
- if (code == 'D')
- c = reverse_condition (c);
- else if (code == 'c')
- c = swap_condition (c);
- else if (code == 'd')
- c = swap_condition (reverse_condition (c));
-
- if (c == LEU)
- fprintf (file, "ule");
- else if (c == LTU)
- fprintf (file, "ult");
- else
- fprintf (file, "%s", GET_RTX_NAME (c));
- }
- break;
-
- case 'E':
- /* Write the divide or modulus operator. */
- switch (GET_CODE (x))
- {
- case DIV:
- fprintf (file, "div%s", GET_MODE (x) == SImode ? "l" : "q");
- break;
- case UDIV:
- fprintf (file, "div%su", GET_MODE (x) == SImode ? "l" : "q");
- break;
- case MOD:
- fprintf (file, "rem%s", GET_MODE (x) == SImode ? "l" : "q");
- break;
- case UMOD:
- fprintf (file, "rem%su", GET_MODE (x) == SImode ? "l" : "q");
- break;
- default:
- output_operand_lossage ("invalid %%E value");
- break;
- }
- break;
-
- case 'A':
- /* Write "_u" for unaligned access. */
- if (GET_CODE (x) == MEM && GET_CODE (XEXP (x, 0)) == AND)
- fprintf (file, "_u");
- break;
-
- case 0:
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x)]);
- else if (GET_CODE (x) == MEM)
- output_address (XEXP (x, 0));
- else
- output_addr_const (file, x);
- break;
-
- default:
- output_operand_lossage ("invalid %%xn code");
- }
-}
-
-/* Do what is necessary for `va_start'. The argument is ignored;
- We look at the current function to determine if stdarg or varargs
- is used and fill in an initial va_list. A pointer to this constructor
- is returned. */
-
-struct rtx_def *
-alpha_builtin_saveregs (arglist)
- tree arglist;
-{
- rtx block, addr, argsize;
- tree fntype = TREE_TYPE (current_function_decl);
- int stdarg = (TYPE_ARG_TYPES (fntype) != 0
- && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
- != void_type_node));
-
- /* Compute the current position into the args, taking into account
- both registers and memory. Both of these are already included in
- current_function_args_info. */
-
- argsize = GEN_INT (CURRENT_FUNCTION_ARGS_INFO * UNITS_PER_WORD);
-
- /* For Unix, SETUP_INCOMING_VARARGS moves the starting address base up by 48,
- storing fp arg registers in the first 48 bytes, and the integer arg
- registers in the next 48 bytes. This is only done, however, if any
- integer registers need to be stored.
-
- If no integer registers need be stored, then we must subtract 48 in
- order to account for the integer arg registers which are counted in
- argsize above, but which are not actually stored on the stack. */
-
- if (TARGET_OPEN_VMS)
- addr = plus_constant (virtual_incoming_args_rtx,
- CURRENT_FUNCTION_ARGS_INFO <= 5 + stdarg
- ? UNITS_PER_WORD : - 6 * UNITS_PER_WORD);
- else
- addr = (CURRENT_FUNCTION_ARGS_INFO <= 5 + stdarg
- ? plus_constant (virtual_incoming_args_rtx,
- 6 * UNITS_PER_WORD)
- : plus_constant (virtual_incoming_args_rtx,
- - (6 * UNITS_PER_WORD)));
-
- /* For VMS, we include the argsize, while on Unix, it's handled as
- a separate field. */
- if (TARGET_OPEN_VMS)
- addr = plus_constant (addr, INTVAL (argsize));
-
- addr = force_operand (addr, NULL_RTX);
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- addr = convert_memory_address (ptr_mode, addr);
-#endif
-
- if (TARGET_OPEN_VMS)
- return addr;
- else
- {
- /* Allocate the va_list constructor */
- block = assign_stack_local (BLKmode, 2 * UNITS_PER_WORD, BITS_PER_WORD);
- RTX_UNCHANGING_P (block) = 1;
- RTX_UNCHANGING_P (XEXP (block, 0)) = 1;
-
- /* Store the address of the first integer register in the __base
- member. */
-
- emit_move_insn (change_address (block, ptr_mode, XEXP (block, 0)), addr);
-
- /* Store the argsize as the __va_offset member. */
- emit_move_insn
- (change_address (block, TYPE_MODE (integer_type_node),
- plus_constant (XEXP (block, 0),
- POINTER_SIZE/BITS_PER_UNIT)),
- argsize);
-
- /* Return the address of the va_list constructor, but don't put it in a
- register. Doing so would fail when not optimizing and produce worse
- code when optimizing. */
- return XEXP (block, 0);
- }
-}
-
-/* This page contains routines that are used to determine what the function
- prologue and epilogue code will do and write them out. */
-
-/* Compute the size of the save area in the stack. */
-
-#if OPEN_VMS
-
-#define REG_PV 27
-#define REG_RA 26
-
-/* These variables are used for communication between the following functions.
- They indicate various things about the current function being compiled
- that are used to tell what kind of prologue, epilogue and procedure
- descriptior to generate. */
-
-/* Nonzero if we need a stack procedure. */
-static int is_stack_procedure;
-
-/* Register number (either FP or SP) that is used to unwind the frame. */
-static int unwind_regno;
-
-/* Register number used to save FP. We need not have one for RA since
- we don't modify it for register procedures. This is only defined
- for register frame procedures. */
-static int save_fp_regno;
-
-/* Register number used to reference objects off our PV. */
-static int base_regno;
-
-/* Compute register masks for saved registers. */
-
-static void
-alpha_sa_mask (imaskP, fmaskP)
- unsigned long *imaskP;
- unsigned long *fmaskP;
-{
- unsigned long imask = 0;
- unsigned long fmask = 0;
- int i;
-
- if (is_stack_procedure)
- imask |= (1L << HARD_FRAME_POINTER_REGNUM);
-
- /* One for every register we have to save. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (! fixed_regs[i] && ! call_used_regs[i] && regs_ever_live[i])
- {
- if (i < 32)
- imask |= (1L << i);
- else
- fmask |= (1L << (i - 32));
- }
-
- *imaskP = imask;
- *fmaskP = fmask;
-
- return;
-}
-
-int
-alpha_sa_size ()
-{
- int sa_size = 0;
- HOST_WIDE_INT stack_needed;
- int i;
-
- /* One for every register we have to save. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (! fixed_regs[i] && ! call_used_regs[i] && regs_ever_live[i])
- sa_size++;
-
- /* Start by assuming we can use a register procedure if we don't make any
- calls (REG_RA not used) or need to save any registers and a stack
- procedure if we do. */
- is_stack_procedure = regs_ever_live[REG_RA] || sa_size != 0;
-
- /* Decide whether to refer to objects off our PV via FP or PV.
- If we need need FP for something else or if we receive a nonlocal
- goto (which expects PV to contain the value), we must use PV.
- Otherwise, start by assuming we can use FP. */
- base_regno = (frame_pointer_needed || current_function_has_nonlocal_label
- || is_stack_procedure
- || current_function_outgoing_args_size
- ? REG_PV : HARD_FRAME_POINTER_REGNUM);
-
- /* If we want to copy PV into FP, we need to find some register in which to
- save FP. */
-
- save_fp_regno = -1;
-
- if (base_regno == HARD_FRAME_POINTER_REGNUM)
- for (i = 0; i < 32; i++)
- if (! fixed_regs[i] && call_used_regs[i] && ! regs_ever_live[i])
- save_fp_regno = i;
-
- if (save_fp_regno == -1)
- base_regno = REG_PV, is_stack_procedure = 1;
-
- /* Stack unwinding should be done via FP unless we use it for PV. */
- unwind_regno
- = base_regno == REG_PV ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM;
-
- /* If this is a stack procedure, allow space for saving FP and RA. */
- if (is_stack_procedure)
- sa_size += 2;
-
- return sa_size * 8;
-}
-
-int
-alpha_pv_save_size ()
-{
- alpha_sa_size ();
- return is_stack_procedure ? 8 : 0;
-}
-
-int
-alpha_using_fp ()
-{
- alpha_sa_size ();
- return unwind_regno == HARD_FRAME_POINTER_REGNUM;
-}
-
-#else /* ! OPEN_VMS */
-
-int
-alpha_sa_size ()
-{
- int size = 0;
- int i;
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (! fixed_regs[i] && ! call_used_regs[i] && regs_ever_live[i])
- size++;
-
- /* If some registers were saved but not reg 26, reg 26 must also
- be saved, so leave space for it. */
- if (size != 0 && ! regs_ever_live[26])
- size++;
-
- /* Our size must be even (multiple of 16 bytes). */
- if (size & 1)
- size ++;
-
- return size * 8;
-}
-
-#endif /* ! OPEN_VMS */
-
-/* Return 1 if this function can directly return via $26. */
-
-int
-direct_return ()
-{
- return (! TARGET_OPEN_VMS && reload_completed && alpha_sa_size () == 0
- && get_frame_size () == 0
- && current_function_outgoing_args_size == 0
- && current_function_pretend_args_size == 0);
-}
-
-/* Write a version stamp. Don't write anything if we are running as a
- cross-compiler. Otherwise, use the versions in /usr/include/stamp.h. */
-
-#if !defined(CROSS_COMPILE) && !defined(_WIN32) && !defined(__linux__) && !defined(VMS)
-#include <stamp.h>
-#endif
-
-void
-alpha_write_verstamp (file)
- FILE *file;
-{
-#ifdef MS_STAMP
- fprintf (file, "\t.verstamp %d %d\n", MS_STAMP, LS_STAMP);
-#endif
-}
-
-/* Write code to add constant C to register number IN_REG (possibly 31)
- and put the result into OUT_REG. Use TEMP_REG as a scratch register;
- usually this will be OUT_REG, but should not be if OUT_REG is
- STACK_POINTER_REGNUM, since it must be updated in a single instruction.
- Write the code to FILE. */
-
-static void
-add_long_const (file, c, in_reg, out_reg, temp_reg)
- FILE *file;
- HOST_WIDE_INT c;
- int in_reg, out_reg, temp_reg;
-{
- HOST_WIDE_INT low = (c & 0xffff) - 2 * (c & 0x8000);
- HOST_WIDE_INT tmp1 = c - low;
- HOST_WIDE_INT high = ((tmp1 >> 16) & 0xffff) - 2 * ((tmp1 >> 16) & 0x8000);
- HOST_WIDE_INT extra = 0;
-
- /* We don't have code to write out constants larger than 32 bits. */
-#if HOST_BITS_PER_LONG_INT == 64
- if ((unsigned HOST_WIDE_INT) c >> 32 != 0)
- abort ();
-#endif
-
- /* If HIGH will be interpreted as negative, we must adjust it to do two
- ldha insns. Note that we will never be building a negative constant
- here. */
-
- if (high & 0x8000)
- {
- extra = 0x4000;
- tmp1 -= 0x40000000;
- high = ((tmp1 >> 16) & 0xffff) - 2 * ((tmp1 >> 16) & 0x8000);
- }
-
- if (low != 0)
- {
- int result_reg = (extra == 0 && high == 0) ? out_reg : temp_reg;
-
- if (low >= 0 && low < 255)
- fprintf (file, "\taddq $%d,%d,$%d\n", in_reg, low, result_reg);
- else
- fprintf (file, "\tlda $%d,%d($%d)\n", result_reg, low, in_reg);
-
- in_reg = result_reg;
- }
-
- if (extra)
- {
- int result_reg = (high == 0) ? out_reg : temp_reg;
-
- fprintf (file, "\tldah $%d,%d($%d)\n", result_reg, extra, in_reg);
- in_reg = result_reg;
- }
-
- if (high)
- fprintf (file, "\tldah $%d,%d($%d)\n", out_reg, high, in_reg);
-}
-
-/* Write function prologue. */
-
-#if OPEN_VMS
-
-/*
- Quick and dirty vmskrunch routine to ensure symbols are within the
- 64 bytes limit imposed by VMS.
-
- This is written specifically for GNAT, and may not work for C++.
-
- This routine duplicates every symbol passed to it whether it is too
- long or not, which is a waste of space, fix later.
-*/
-#include <string.h>
-char*
-vmskrunch (name)
- char *name;
-{
- char *foo;
- int max = 60; /* Allow for the ..xx extension */
- int len, tlen;
-
- if (name[0] == '*')
- return (&name[1]);
-
- len = tlen = strlen (name);
- foo = xstrdup (name);
-
- /* Don't muck with the ..xx extenstion */
- if ((foo [tlen-4] == '.') && (foo [tlen-3] == '.'))
- {
- max = max + 4;
- if (tlen > max)
- {
- foo [tlen-4] = 0;
- len = len - 4;
- max = max - 4;
- }
- }
-
- if (len > max)
- {
- char *bar;
- int i, j, slen, nlen, xlen, chopchar;
-
- nlen = len;
-
- /* Change all _ and . characters to spaces, if thats enough then quit.
- For example: "foobar__foo__bar" becomes "foobar foo bar" */
-
- for (i = 0; bar = index (foo, '_'); i++)
- *bar = ' ';
- nlen = nlen - i;
-
- for (i = 0; bar = index (foo, '.'); i++)
- *bar = ' ';
- nlen = nlen - i;
-
- for (i = 0; bar = index (foo, '$'); i++)
- *bar = ' ';
- nlen = nlen - i;
-
- /* Iteratively make blank the rightmost non-blank character on the
- longest leftmost substring delmited by blanks, until it's short
- enough. For example: "foobar foo bar" becomes, successively:
- "fooba foo bar"
- "foob foo bar"
- "foo foo bar"
- "fo foo bar"
- "fo fo bar"
- "fo fo ba "
- "f fo ba "
- "f f ba "
- "f f b "
- etc. */
-
- while (nlen > max)
- {
- j = 0;
- xlen = 0;
-
- while (foo[j])
- {
- /* Find first non-blank */
- if (foo[j])
- for (i = j; foo[i]==' ' && foo[i]; i++)
- ;
-
- /* Find the first blank */
- j = i;
- if (foo[j])
- for (i = j + 1; foo[i] != ' ' && foo[i]; i++)
- ;
-
- /* If this substring is the longest so far, remember the
- position of the character to chop off. */
- slen = i - j;
- if (slen > xlen)
- {
- chopchar = i - 1;
- xlen = slen;
- }
-
- j = i;
- }
-
- /* Try to avoid chopping uppercase suffix letters */
- if (isupper (foo [chopchar]))
- {
- for (i = chopchar;
- isupper (foo[i]) && foo[i] != ' ' && i >= 0;
- i--)
- ;
- if (islower (foo[i]))
- chopchar = i;
- }
- foo [chopchar] = ' ';
- nlen--;
- }
-
- /* Put the ..xx extension back */
- if (len != tlen)
- {
- foo [len] = '.';
- len = len + 4;
- }
-
- /* Collapse all the blanks */
- j = 0;
- for (i = 0; foo[i]; i++)
- if (foo[i] != ' ')
- foo[j++] = foo[i];
- foo[j] = 0;
-
- return foo;
- }
-
- /* Put back the ..xx extension */
- if (len != tlen)
- {
- foo [len] = '.';
- len = len + 4;
- }
-
- free (foo);
- return name;
-}
-
-/* On vms we have two kinds of functions:
-
- - stack frame (PROC_STACK)
- these are 'normal' functions with local vars and which are
- calling other functions
- - register frame (PROC_REGISTER)
- keeps all data in registers, needs no stack
-
- We must pass this to the assembler so it can generate the
- proper pdsc (procedure descriptor)
- This is done with the '.pdesc' command.
-
- size is the stack size needed for local variables. */
-
-void
-output_prolog (file, size)
- FILE *file;
- HOST_WIDE_INT size;
-{
- unsigned long imask = 0;
- unsigned long fmask = 0;
- /* Stack space needed for pushing registers clobbered by us. */
- HOST_WIDE_INT sa_size;
- /* Complete stack size needed. */
- HOST_WIDE_INT frame_size;
- /* Offset from base reg to register save area. */
- int rsa_offset = 8;
- /* Offset during register save. */
- int reg_offset;
- /* Label for the procedure entry. */
- char entry_label[70];
- int i;
-
- sa_size = alpha_sa_size ();
- frame_size
- = ALPHA_ROUND (sa_size
- + (is_stack_procedure ? 8 : 0)
- + size + current_function_pretend_args_size);
-
- /* Issue function start and label. */
- fprintf (file, "\t.ent ");
- assemble_name (file, alpha_function_name);
- fprintf (file, "\n");
- sprintf (entry_label, "%.64s..en", alpha_function_name);
- ASM_OUTPUT_LABEL (file, entry_label);
- inside_function = TRUE;
-
- fprintf (file, "\t.base $%d\n", base_regno);
-
- /* Calculate register masks for clobbered registers. */
-
- if (is_stack_procedure)
- alpha_sa_mask (&imask, &fmask);
-
- /* Adjust the stack by the frame size. If the frame size is > 4096
- bytes, we need to be sure we probe somewhere in the first and last
- 4096 bytes (we can probably get away without the latter test) and
- every 8192 bytes in between. If the frame size is > 32768, we
- do this in a loop. Otherwise, we generate the explicit probe
- instructions.
-
- Note that we are only allowed to adjust sp once in the prologue. */
-
- if (frame_size < 32768)
- {
- if (frame_size > 4096)
- {
- int probed = 4096;
-
- fprintf (file, "\tstq $31,-%d($30)\n", probed);
-
- while (probed + 8192 < frame_size)
- fprintf (file, "\tstq $31,-%d($30)\n", probed += 8192);
-
- /* We only have to do this probe if we aren't saving registers. */
- if (sa_size == 0 && probed + 4096 < frame_size)
- fprintf (file, "\tstq $31,-%d($30)\n", frame_size);
- }
-
- if (frame_size != 0)
- fprintf (file, "\tlda $30,-%d($30)\n", frame_size);
- }
- else
- {
- /* Here we generate code to set R4 to SP + 4096 and set R23 to the
- number of 8192 byte blocks to probe. We then probe each block
- in the loop and then set SP to the proper location. If the
- amount remaining is > 4096, we have to do one more probe if we
- are not saving any registers. */
-
- HOST_WIDE_INT blocks = (frame_size + 4096) / 8192;
- HOST_WIDE_INT leftover = frame_size + 4096 - blocks * 8192;
-
- add_long_const (file, blocks, 31, 23, 23);
-
- fprintf (file, "\tlda $22,4096($30)\n");
-
- assemble_name (file, alpha_function_name);
- fprintf (file, "..sc:\n");
-
- fprintf (file, "\tstq $31,-8192($22)\n");
- fprintf (file, "\tsubq $23,1,$23\n");
- fprintf (file, "\tlda $22,-8192($22)\n");
-
- fprintf (file, "\tbne $23,");
- assemble_name (file, alpha_function_name);
- fprintf (file, "..sc\n");
-
- if (leftover > 4096 && sa_size == 0)
- fprintf (file, "\tstq $31,-%d($22)\n", leftover);
-
- fprintf (file, "\tlda $30,-%d($22)\n", leftover);
- }
-
- if (is_stack_procedure)
- {
- int reg_offset = rsa_offset;
-
- /* Store R26 (RA) first. */
- fprintf (file, "\tstq $26,%d($30)\n", reg_offset);
- reg_offset += 8;
-
- /* Store integer regs. according to mask. */
- for (i = 0; i < 32; i++)
- if (imask & (1L<<i))
- {
- fprintf (file, "\tstq $%d,%d($30)\n", i, reg_offset);
- reg_offset += 8;
- }
-
- /* Print the register mask and do floating-point saves. */
-
- if (imask)
- fprintf (file, "\t.mask 0x%x,0\n", imask);
-
- for (i = 0; i < 32; i++)
- {
- if (fmask & (1L << i))
- {
- fprintf (file, "\tstt $f%d,%d($30)\n", i, reg_offset);
- reg_offset += 8;
- }
- }
-
- /* Print the floating-point mask, if we've saved any fp register. */
- if (fmask)
- fprintf (file, "\t.fmask 0x%x,0\n", fmask);
-
- fprintf (file, "\tstq $27,0($30)\n");
- }
- else
- {
- fprintf (file, "\t.fp_save $%d\n", save_fp_regno);
- fprintf (file, "\tbis $%d,$%d,$%d\n", HARD_FRAME_POINTER_REGNUM,
- HARD_FRAME_POINTER_REGNUM, save_fp_regno);
- }
-
- if (base_regno != REG_PV)
- fprintf (file, "\tbis $%d,$%d,$%d\n", REG_PV, REG_PV, base_regno);
-
- if (unwind_regno == HARD_FRAME_POINTER_REGNUM)
- fprintf (file, "\tbis $%d,$%d,$%d\n", STACK_POINTER_REGNUM,
- STACK_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM);
-
- /* Describe our frame. */
- fprintf (file, "\t.frame $%d,%d,$26,%d\n",
- unwind_regno, frame_size, rsa_offset);
-
- /* If we have to allocate space for outgoing args, do it now. */
- if (current_function_outgoing_args_size != 0)
- fprintf (file, "\tlda $%d,%d($%d)\n", STACK_POINTER_REGNUM,
- - ALPHA_ROUND (current_function_outgoing_args_size),
- HARD_FRAME_POINTER_REGNUM);
-
- fprintf (file, "\t.prologue\n");
-
- link_section ();
- fprintf (file, "\t.align 3\n");
- ASM_OUTPUT_LABEL (file, alpha_function_name);
- fprintf (file, "\t.pdesc ");
- assemble_name (file, alpha_function_name);
- fprintf (file, "..en,%s\n", is_stack_procedure ? "stack" : "reg");
- alpha_need_linkage (alpha_function_name, 1);
- text_section ();
-
- return;
-}
-
-/* Write function epilogue. */
-
-void
-output_epilog (file, size)
- FILE *file;
- int size;
-{
- unsigned long imask = 0;
- unsigned long fmask = 0;
- /* Stack space needed for pushing registers clobbered by us. */
- HOST_WIDE_INT sa_size = alpha_sa_size ();
- /* Complete stack size needed. */
- HOST_WIDE_INT frame_size
- = ALPHA_ROUND (sa_size
- + (is_stack_procedure ? 8 : 0)
- + size + current_function_pretend_args_size);
- int i;
- rtx insn = get_last_insn ();
-
- /* If the last insn was a BARRIER, we don't have to write anything except
- the .end pseudo-op. */
-
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
-
- if (insn == 0 || GET_CODE (insn) != BARRIER)
- {
- /* Restore clobbered registers, load FP last. */
-
- if (is_stack_procedure)
- {
- int rsa_offset = 8;
- int reg_offset;
- int fp_offset;
-
- if (unwind_regno == HARD_FRAME_POINTER_REGNUM)
- fprintf (file, "\tbis $%d,$%d,$%d\n", HARD_FRAME_POINTER_REGNUM,
- HARD_FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM);
-
- alpha_sa_mask (&imask, &fmask);
-
- /* Start reloading registers after RA. */
- reg_offset = rsa_offset + 8;
-
- for (i = 0; i < 32; i++)
- if (imask & (1L<<i))
- {
- if (i == HARD_FRAME_POINTER_REGNUM)
- fp_offset = reg_offset;
- else
- fprintf (file, "\tldq $%d,%d($30)\n",
- i, reg_offset);
- reg_offset += 8;
- }
-
- for (i = 0; i < 32; i++)
- if (fmask & (1L << i))
- {
- fprintf (file, "\tldt $f%d,%d($30)\n", i, reg_offset);
- reg_offset += 8;
- }
-
- /* Restore R26 (RA). */
- fprintf (file, "\tldq $26,%d($30)\n", rsa_offset);
-
- /* Restore R29 (FP). */
- fprintf (file, "\tldq $29,%d($30)\n", fp_offset);
- }
- else
- fprintf (file, "\tbis $%d,$%d,$%d\n", save_fp_regno, save_fp_regno,
- HARD_FRAME_POINTER_REGNUM);
-
- if (frame_size != 0)
- {
- if (frame_size < 32768)
- fprintf (file, "\tlda $30,%d($30)\n", frame_size);
- else
- {
- long high = frame_size >> 16;
- long low = frame_size & 0xffff;
- if (low & 0x8000)
- {
- high++;
- low = -32768 + (low & 0x7fff);
- }
- fprintf (file, "\tldah $2,%ld($31)\n", high);
- fprintf (file, "\tlda $2,%ld($2)\n", low);
- fprintf (file, "\taddq $30,$2,$30\n");
- }
- }
-
- /* Finally return to the caller. */
- fprintf (file, "\tret $31,($26),1\n");
- }
-
- /* End the function. */
- fprintf (file, "\t.end ");
- assemble_name (file, alpha_function_name);
- fprintf (file, "\n");
- inside_function = FALSE;
-
- /* Show that we know this function if it is called again. */
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (current_function_decl), 0)) = 1;
-}
-
-#else /* !OPEN_VMS */
-
-void
-output_prolog (file, size)
- FILE *file;
- int size;
-{
- HOST_WIDE_INT out_args_size
- = ALPHA_ROUND (current_function_outgoing_args_size);
- HOST_WIDE_INT sa_size = alpha_sa_size ();
- HOST_WIDE_INT frame_size
- = (out_args_size + sa_size
- + ALPHA_ROUND (size + current_function_pretend_args_size));
- HOST_WIDE_INT reg_offset = out_args_size;
- HOST_WIDE_INT start_reg_offset = reg_offset;
- HOST_WIDE_INT actual_start_reg_offset = start_reg_offset;
- int int_reg_save_area_size = 0;
- rtx insn;
- unsigned reg_mask = 0;
- int i;
-
- /* Ecoff can handle multiple .file directives, so put out file and lineno.
- We have to do that before the .ent directive as we cannot switch
- files within procedures with native ecoff because line numbers are
- linked to procedure descriptors.
- Outputting the lineno helps debugging of one line functions as they
- would otherwise get no line number at all. Please note that we would
- like to put out last_linenum from final.c, but it is not accessible. */
-
- if (write_symbols == SDB_DEBUG)
- {
- ASM_OUTPUT_SOURCE_FILENAME (file,
- DECL_SOURCE_FILE (current_function_decl));
- if (debug_info_level != DINFO_LEVEL_TERSE)
- ASM_OUTPUT_SOURCE_LINE (file,
- DECL_SOURCE_LINE (current_function_decl));
- }
-
- /* The assembly language programmer's guide states that the second argument
- to the .ent directive, the lex_level, is ignored by the assembler,
- so we might as well omit it. */
-
- if (!flag_inhibit_size_directive)
- {
- fprintf (file, "\t.ent ");
- assemble_name (file, alpha_function_name);
- fprintf (file, "\n");
- }
- ASM_OUTPUT_LABEL (file, alpha_function_name);
- inside_function = TRUE;
-
- if (TARGET_IEEE_CONFORMANT && !flag_inhibit_size_directive)
- /* Set flags in procedure descriptor to request IEEE-conformant
- math-library routines. The value we set it to is PDSC_EXC_IEEE
- (/usr/include/pdsc.h). */
- fprintf (file, "\t.eflag 48\n");
-
- /* Set up offsets to alpha virtual arg/local debugging pointer. */
-
- alpha_auto_offset = -frame_size + current_function_pretend_args_size;
- alpha_arg_offset = -frame_size + 48;
-
- /* If we need a GP (we have a LDSYM insn or a CALL_INSN), load it first.
- Even if we are a static function, we still need to do this in case
- our address is taken and passed to something like qsort.
-
- We never need a GP for Windows/NT. */
-
- alpha_function_needs_gp = 0;
-
-#ifdef TARGET_PROFILING_NEEDS_GP
- if (profile_flag)
- alpha_function_needs_gp = 1;
-#endif
-
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if ((GET_CODE (insn) == CALL_INSN)
- || (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && GET_CODE (PATTERN (insn)) != USE
- && GET_CODE (PATTERN (insn)) != CLOBBER
- && (get_attr_type (insn) == TYPE_LDSYM
- || get_attr_type (insn) == TYPE_ISUBR)))
- {
- alpha_function_needs_gp = 1;
- break;
- }
-
- if (TARGET_WINDOWS_NT == 0)
- {
- if (alpha_function_needs_gp)
- fprintf (file, "\tldgp $29,0($27)\n");
-
- /* Put a label after the GP load so we can enter the function at it. */
- assemble_name (file, alpha_function_name);
- fprintf (file, "..ng:\n");
- }
-
- /* Adjust the stack by the frame size. If the frame size is > 4096
- bytes, we need to be sure we probe somewhere in the first and last
- 4096 bytes (we can probably get away without the latter test) and
- every 8192 bytes in between. If the frame size is > 32768, we
- do this in a loop. Otherwise, we generate the explicit probe
- instructions.
-
- Note that we are only allowed to adjust sp once in the prologue. */
-
- if (frame_size < 32768)
- {
- if (frame_size > 4096)
- {
- int probed = 4096;
-
- fprintf (file, "\tstq $31,-%d($30)\n", probed);
-
- while (probed + 8192 < frame_size)
- fprintf (file, "\tstq $31,-%d($30)\n", probed += 8192);
-
- /* We only have to do this probe if we aren't saving registers. */
- if (sa_size == 0 && probed + 4096 < frame_size)
- fprintf (file, "\tstq $31,-%d($30)\n", frame_size);
- }
-
- if (frame_size != 0)
- fprintf (file, "\tlda $30,-%d($30)\n", frame_size);
- }
- else
- {
- /* Here we generate code to set R4 to SP + 4096 and set R5 to the
- number of 8192 byte blocks to probe. We then probe each block
- in the loop and then set SP to the proper location. If the
- amount remaining is > 4096, we have to do one more probe if we
- are not saving any registers. */
-
- HOST_WIDE_INT blocks = (frame_size + 4096) / 8192;
- HOST_WIDE_INT leftover = frame_size + 4096 - blocks * 8192;
-
- add_long_const (file, blocks, 31, 5, 5);
-
- fprintf (file, "\tlda $4,4096($30)\n");
-
- assemble_name (file, alpha_function_name);
- fprintf (file, "..sc:\n");
-
- fprintf (file, "\tstq $31,-8192($4)\n");
- fprintf (file, "\tsubq $5,1,$5\n");
- fprintf (file, "\tlda $4,-8192($4)\n");
-
- fprintf (file, "\tbne $5,");
- assemble_name (file, alpha_function_name);
- fprintf (file, "..sc\n");
-
- if (leftover > 4096 && sa_size == 0)
- fprintf (file, "\tstq $31,-%d($4)\n", leftover);
-
- fprintf (file, "\tlda $30,-%d($4)\n", leftover);
- }
-
- /* Describe our frame. */
- if (!flag_inhibit_size_directive)
- {
- fprintf (file, "\t.frame $%d,%d,$26,%d\n",
- (frame_pointer_needed
- ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM),
- frame_size, current_function_pretend_args_size);
- }
-
- /* Save register 26 if any other register needs to be saved. */
- if (sa_size != 0)
- {
- reg_mask |= 1 << 26;
- fprintf (file, "\tstq $26,%d($30)\n", reg_offset);
- reg_offset += 8;
- int_reg_save_area_size += 8;
- }
-
- /* Now save any other used integer registers required to be saved. */
- for (i = 0; i < 32; i++)
- if (! fixed_regs[i] && ! call_used_regs[i] && regs_ever_live[i] && i != 26)
- {
- reg_mask |= 1 << i;
- fprintf (file, "\tstq $%d,%d($30)\n", i, reg_offset);
- reg_offset += 8;
- int_reg_save_area_size += 8;
- }
-
- /* Print the register mask and do floating-point saves. */
- if (reg_mask && !flag_inhibit_size_directive)
- fprintf (file, "\t.mask 0x%x,%d\n", reg_mask,
- actual_start_reg_offset - frame_size);
-
- start_reg_offset = reg_offset;
- reg_mask = 0;
-
- for (i = 0; i < 32; i++)
- if (! fixed_regs[i + 32] && ! call_used_regs[i + 32]
- && regs_ever_live[i + 32])
- {
- reg_mask |= 1 << i;
- fprintf (file, "\tstt $f%d,%d($30)\n", i, reg_offset);
- reg_offset += 8;
- }
-
- /* Print the floating-point mask, if we've saved any fp register. */
- if (reg_mask && !flag_inhibit_size_directive)
- fprintf (file, "\t.fmask 0x%x,%d\n", reg_mask,
- actual_start_reg_offset - frame_size + int_reg_save_area_size);
-
- /* If we need a frame pointer, set it from the stack pointer. Note that
- this must always be the last instruction in the prologue. */
- if (frame_pointer_needed)
- fprintf (file, "\tbis $30,$30,$15\n");
-
- /* End the prologue and say if we used gp. */
- if (!flag_inhibit_size_directive)
- fprintf (file, "\t.prologue %d\n", alpha_function_needs_gp);
-}
-
-/* Write function epilogue. */
-
-void
-output_epilog (file, size)
- FILE *file;
- int size;
-{
- rtx insn = get_last_insn ();
- HOST_WIDE_INT out_args_size
- = ALPHA_ROUND (current_function_outgoing_args_size);
- HOST_WIDE_INT sa_size = alpha_sa_size ();
- HOST_WIDE_INT frame_size
- = (out_args_size + sa_size
- + ALPHA_ROUND (size + current_function_pretend_args_size));
- HOST_WIDE_INT reg_offset = out_args_size;
- HOST_WIDE_INT frame_size_from_reg_save = frame_size - reg_offset;
- int restore_fp
- = frame_pointer_needed && regs_ever_live[HARD_FRAME_POINTER_REGNUM];
- int i;
-
- /* If the last insn was a BARRIER, we don't have to write anything except
- the .end pseudo-op. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
- if (insn == 0 || GET_CODE (insn) != BARRIER)
- {
- int fp_offset = 0;
-
- final_prescan_insn (NULL_RTX, NULL_PTR, 0);
-
- /* If we have a frame pointer, restore SP from it. */
- if (frame_pointer_needed)
- fprintf (file, "\tbis $15,$15,$30\n");
-
- /* Restore all the registers, starting with the return address
- register. */
- if (sa_size != 0)
- {
- fprintf (file, "\tldq $26,%d($30)\n", reg_offset);
- reg_offset += 8;
- }
-
- /* Now restore any other used integer registers that that we saved,
- except for FP if it is being used as FP, since it must be
- restored last. */
-
- for (i = 0; i < 32; i++)
- if (! fixed_regs[i] && ! call_used_regs[i] && regs_ever_live[i]
- && i != 26)
- {
- if (i == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed)
- fp_offset = reg_offset;
- else
- fprintf (file, "\tldq $%d,%d($30)\n", i, reg_offset);
- reg_offset += 8;
- }
-
- for (i = 0; i < 32; i++)
- if (! fixed_regs[i + 32] && ! call_used_regs[i + 32]
- && regs_ever_live[i + 32])
- {
- fprintf (file, "\tldt $f%d,%d($30)\n", i, reg_offset);
- reg_offset += 8;
- }
-
- /* If the stack size is large and we have a frame pointer, compute the
- size of the stack into a register because the old FP restore, stack
- pointer adjust, and return are required to be consecutive
- instructions. */
- if (frame_size > 32767 && restore_fp)
- add_long_const (file, frame_size, 31, 1, 1);
-
- /* If we needed a frame pointer and we have to restore it, do it
- now. This must be done in one instruction immediately
- before the SP update. */
- if (restore_fp && fp_offset)
- fprintf (file, "\tldq $15,%d($30)\n", fp_offset);
-
- /* Now update the stack pointer, if needed. Only one instruction must
- modify the stack pointer. It must be the last instruction in the
- sequence and must be an ADDQ or LDA instruction. If the frame
- pointer was loaded above, we may only put one instruction here. */
-
- if (frame_size > 32768 && restore_fp)
- fprintf (file, "\taddq $1,$30,$30\n");
- else
- add_long_const (file, frame_size, 30, 30, 1);
-
- /* Finally return to the caller. */
- fprintf (file, "\tret $31,($26),1\n");
- }
-
- /* End the function. */
- if (!flag_inhibit_size_directive)
- {
- fprintf (file, "\t.end ");
- assemble_name (file, alpha_function_name);
- fprintf (file, "\n");
- }
- inside_function = FALSE;
-
- /* Show that we know this function if it is called again. */
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (current_function_decl), 0)) = 1;
-}
-#endif /* !OPEN_VMS */
-
-/* Debugging support. */
-
-#include "gstab.h"
-
-/* Count the number of sdb related labels are generated (to find block
- start and end boundaries). */
-
-int sdb_label_count = 0;
-
-/* Next label # for each statement. */
-
-static int sym_lineno = 0;
-
-/* Count the number of .file directives, so that .loc is up to date. */
-
-static int num_source_filenames = 0;
-
-/* Name of the file containing the current function. */
-
-static char *current_function_file = "";
-
-/* Offsets to alpha virtual arg/local debugging pointers. */
-
-long alpha_arg_offset;
-long alpha_auto_offset;
-
-/* Emit a new filename to a stream. */
-
-void
-alpha_output_filename (stream, name)
- FILE *stream;
- char *name;
-{
- static int first_time = TRUE;
- char ltext_label_name[100];
-
- if (first_time)
- {
- first_time = FALSE;
- ++num_source_filenames;
- current_function_file = name;
- fprintf (stream, "\t.file\t%d ", num_source_filenames);
- output_quoted_string (stream, name);
- fprintf (stream, "\n");
- if (!TARGET_GAS && write_symbols == DBX_DEBUG)
- fprintf (stream, "\t#@stabs\n");
- }
-
- else if (write_symbols == DBX_DEBUG)
- {
- ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
- fprintf (stream, "%s ", ASM_STABS_OP);
- output_quoted_string (stream, name);
- fprintf (stream, ",%d,0,0,%s\n", N_SOL, &ltext_label_name[1]);
- }
-
- else if (name != current_function_file
- && strcmp (name, current_function_file) != 0)
- {
- if (inside_function && ! TARGET_GAS)
- fprintf (stream, "\t#.file\t%d ", num_source_filenames);
- else
- {
- ++num_source_filenames;
- current_function_file = name;
- fprintf (stream, "\t.file\t%d ", num_source_filenames);
- }
-
- output_quoted_string (stream, name);
- fprintf (stream, "\n");
- }
-}
-
-/* Emit a linenumber to a stream. */
-
-void
-alpha_output_lineno (stream, line)
- FILE *stream;
- int line;
-{
- if (write_symbols == DBX_DEBUG)
- {
- /* mips-tfile doesn't understand .stabd directives. */
- ++sym_lineno;
- fprintf (stream, "$LM%d:\n\t%s %d,0,%d,$LM%d\n",
- sym_lineno, ASM_STABN_OP, N_SLINE, line, sym_lineno);
- }
- else
- fprintf (stream, "\n\t.loc\t%d %d\n", num_source_filenames, line);
-}
-
-/* Structure to show the current status of registers and memory. */
-
-struct shadow_summary
-{
- struct {
- unsigned long i : 32; /* Mask of int regs */
- unsigned long fp : 32; /* Mask of fp regs */
- unsigned long mem : 1; /* mem == imem | fpmem */
- } used, defd;
-};
-
-/* Summary the effects of expression X on the machine. Update SUM, a pointer
- to the summary structure. SET is nonzero if the insn is setting the
- object, otherwise zero. */
-
-static void
-summarize_insn (x, sum, set)
- rtx x;
- struct shadow_summary *sum;
- int set;
-{
- char *format_ptr;
- int i, j;
-
- if (x == 0)
- return;
-
- switch (GET_CODE (x))
- {
- /* ??? Note that this case would be incorrect if the Alpha had a
- ZERO_EXTRACT in SET_DEST. */
- case SET:
- summarize_insn (SET_SRC (x), sum, 0);
- summarize_insn (SET_DEST (x), sum, 1);
- break;
-
- case CLOBBER:
- summarize_insn (XEXP (x, 0), sum, 1);
- break;
-
- case USE:
- summarize_insn (XEXP (x, 0), sum, 0);
- break;
-
- case PARALLEL:
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- summarize_insn (XVECEXP (x, 0, i), sum, 0);
- break;
-
- case REG:
- {
- int regno = REGNO (x);
- unsigned long mask = 1UL << (regno % 32);
-
- if (regno == 31 || regno == 63)
- break;
-
- if (set)
- {
- if (regno < 32)
- sum->defd.i |= mask;
- else
- sum->defd.fp |= mask;
- }
- else
- {
- if (regno < 32)
- sum->used.i |= mask;
- else
- sum->used.fp |= mask;
- }
- }
- break;
-
- case MEM:
- if (set)
- sum->defd.mem = 1;
- else
- sum->used.mem = 1;
-
- /* Find the regs used in memory address computation: */
- summarize_insn (XEXP (x, 0), sum, 0);
- break;
-
- case SUBREG:
- summarize_insn (SUBREG_REG (x), sum, 0);
- break;
-
- case CONST_INT: case CONST_DOUBLE:
- case SYMBOL_REF: case LABEL_REF: case CONST:
- break;
-
- /* Handle common unary and binary ops for efficiency. */
- case COMPARE: case PLUS: case MINUS: case MULT: case DIV:
- case MOD: case UDIV: case UMOD: case AND: case IOR:
- case XOR: case ASHIFT: case ROTATE: case ASHIFTRT: case LSHIFTRT:
- case ROTATERT: case SMIN: case SMAX: case UMIN: case UMAX:
- case NE: case EQ: case GE: case GT: case LE:
- case LT: case GEU: case GTU: case LEU: case LTU:
- summarize_insn (XEXP (x, 0), sum, 0);
- summarize_insn (XEXP (x, 1), sum, 0);
- break;
-
- case NEG: case NOT: case SIGN_EXTEND: case ZERO_EXTEND:
- case TRUNCATE: case FLOAT_EXTEND: case FLOAT_TRUNCATE: case FLOAT:
- case FIX: case UNSIGNED_FLOAT: case UNSIGNED_FIX: case ABS:
- case SQRT: case FFS:
- summarize_insn (XEXP (x, 0), sum, 0);
- break;
-
- default:
- format_ptr = GET_RTX_FORMAT (GET_CODE (x));
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
- switch (format_ptr[i])
- {
- case 'e':
- summarize_insn (XEXP (x, i), sum, 0);
- break;
-
- case 'E':
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- summarize_insn (XVECEXP (x, i, j), sum, 0);
- break;
-
- default:
- abort ();
- }
- }
-}
-
-/* This function is executed just prior to the output of assembler code for
- INSN to modify the extracted operands so they will be output differently.
-
- OPVEC is the vector containing the operands extracted from INSN, and
- NOPERANDS is the number of elements of the vector which contain meaningful
- data for this insn. The contents of this vector are what will be used to
- convert the insn template into assembler code, so you can change the
- assembler output by changing the contents of the vector.
-
- We use this function to ensure a sufficient number of `trapb' instructions
- are in the code when the user requests code with a trap precision of
- functions or instructions.
-
- In naive mode, when the user requests a trap-precision of "instruction", a
- trapb is needed after every instruction that may generate a trap (and after
- jsr/bsr instructions, because called functions may import a trap from the
- caller). This ensures that the code is resumption safe but it is also slow.
-
- When optimizations are turned on, we delay issuing a trapb as long as
- possible. In this context, a trap shadow is the sequence of instructions
- that starts with a (potentially) trap generating instruction and extends to
- the next trapb or call_pal instruction (but GCC never generates call_pal by
- itself). We can delay (and therefore sometimes omit) a trapb subject to the
- following conditions:
-
- (a) On entry to the trap shadow, if any Alpha register or memory location
- contains a value that is used as an operand value by some instruction in
- the trap shadow (live on entry), then no instruction in the trap shadow
- may modify the register or memory location.
-
- (b) Within the trap shadow, the computation of the base register for a
- memory load or store instruction may not involve using the result
- of an instruction that might generate an UNPREDICTABLE result.
-
- (c) Within the trap shadow, no register may be used more than once as a
- destination register. (This is to make life easier for the trap-handler.)
-
- (d) The trap shadow may not include any branch instructions.
-
- */
-
-void
-final_prescan_insn (insn, opvec, noperands)
- rtx insn;
- rtx *opvec;
- int noperands;
-{
- static struct shadow_summary shadow = {0, 0, 0, 0, 0};
-
-#define CLOSE_SHADOW \
- do \
- { \
- fputs ("\ttrapb\n", asm_out_file); \
- trap_pending = 0; \
- bzero ((char *) &shadow, sizeof shadow); \
- } \
- while (0)
-
- if (alpha_tp == ALPHA_TP_PROG)
- return;
-
- if (trap_pending)
- switch (alpha_tp)
- {
- case ALPHA_TP_FUNC:
- /* Generate one trapb before epilogue (indicated by INSN==0) */
- if (insn == 0)
- CLOSE_SHADOW;
- break;
-
- case ALPHA_TP_INSN:
- if (optimize && insn != 0)
- {
- struct shadow_summary sum = {0, 0, 0};
-
- switch (GET_CODE(insn))
- {
- case INSN:
- summarize_insn (PATTERN (insn), &sum, 0);
-
- if ((sum.defd.i & shadow.defd.i)
- || (sum.defd.fp & shadow.defd.fp))
- {
- /* (c) would be violated */
- CLOSE_SHADOW;
- break;
- }
-
- /* Combine shadow with summary of current insn: */
- shadow.used.i |= sum.used.i;
- shadow.used.fp |= sum.used.fp;
- shadow.used.mem |= sum.used.mem;
- shadow.defd.i |= sum.defd.i;
- shadow.defd.fp |= sum.defd.fp;
- shadow.defd.mem |= sum.defd.mem;
-
- if ((sum.defd.i & shadow.used.i)
- || (sum.defd.fp & shadow.used.fp)
- || (sum.defd.mem & shadow.used.mem))
- {
- /* (a) would be violated (also takes care of (b)). */
- if (get_attr_trap (insn) == TRAP_YES
- && ((sum.defd.i & sum.used.i)
- || (sum.defd.fp & sum.used.fp)))
- abort ();
-
- CLOSE_SHADOW;
- break;
- }
- break;
-
- case JUMP_INSN:
- case CALL_INSN:
- case CODE_LABEL:
- CLOSE_SHADOW;
- break;
-
- default:
- abort ();
- }
- }
- else
- CLOSE_SHADOW;
- break;
- }
-
- if (insn != 0 && get_attr_trap (insn) == TRAP_YES)
- {
- if (optimize && !trap_pending && GET_CODE (insn) == INSN)
- summarize_insn (PATTERN (insn), &shadow, 0);
- trap_pending = 1;
- }
-}
-
-/* Check a floating-point value for validity for a particular machine mode. */
-
-static char *float_strings[] =
-{
- "1.70141173319264430e+38", /* 2^127 (2^24 - 1) / 2^24 */
- "-1.70141173319264430e+38",
- "2.93873587705571877e-39", /* 2^-128 */
- "-2.93873587705571877e-39"
-};
-
-static REAL_VALUE_TYPE float_values[4];
-static int inited_float_values = 0;
-
-int
-check_float_value (mode, d, overflow)
- enum machine_mode mode;
- REAL_VALUE_TYPE *d;
- int overflow;
-{
-
- if (TARGET_IEEE || TARGET_IEEE_CONFORMANT || TARGET_IEEE_WITH_INEXACT)
- return 0;
-
- if (TARGET_FLOAT_VAX)
- return 0;
-
- if (inited_float_values == 0)
- {
- int i;
- for (i = 0; i < 4; i++)
- float_values[i] = REAL_VALUE_ATOF (float_strings[i], DFmode);
-
- inited_float_values = 1;
- }
-
- if (mode == SFmode)
- {
- REAL_VALUE_TYPE r;
-
- bcopy ((char *) d, (char *) &r, sizeof (REAL_VALUE_TYPE));
- if (REAL_VALUES_LESS (float_values[0], r))
- {
- bcopy ((char *) &float_values[0], (char *) d,
- sizeof (REAL_VALUE_TYPE));
- return 1;
- }
- else if (REAL_VALUES_LESS (r, float_values[1]))
- {
- bcopy ((char *) &float_values[1], (char *) d,
- sizeof (REAL_VALUE_TYPE));
- return 1;
- }
- else if (REAL_VALUES_LESS (dconst0, r)
- && REAL_VALUES_LESS (r, float_values[2]))
- {
- bcopy ((char *) &dconst0, (char *) d, sizeof (REAL_VALUE_TYPE));
- return 1;
- }
- else if (REAL_VALUES_LESS (r, dconst0)
- && REAL_VALUES_LESS (float_values[3], r))
- {
- bcopy ((char *) &dconst0, (char *) d, sizeof (REAL_VALUE_TYPE));
- return 1;
- }
- }
-
- return 0;
-}
-
-#if OPEN_VMS
-
-void *
-function_arg (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- int arg;
-
- if (mode == VOIDmode) /* final call, return argument information */
- {
- return GEN_INT (*cum);
- }
-
- arg = *cum & 0xff;
-
- switch (mode)
- {
- case SFmode:
- *cum |= (((TARGET_FLOAT_VAX)?1:4) << ((arg * 3)+8)); /* 4 = AI$K_AR_FS, IEEE single */
- break;
- case DFmode:
- *cum |= (((TARGET_FLOAT_VAX)?3:5) << ((arg * 3)+8)); /* 5 = AI$K_AR_FT, IEEE double */
- break;
- case TFmode:
- *cum |= (7 << ((arg * 3)+8)); /* 5 = AI$K_AR_FT, IEEE double */
- break;
- default:
- break;
- }
-
- return (arg < 6 && ! MUST_PASS_IN_STACK (mode, type)
- ? gen_rtx(REG, mode,
- (*cum & 0xff) + 16 + ((TARGET_FPREGS
- && (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
- || GET_MODE_CLASS (mode) == MODE_FLOAT))
- * 32))
- : 0);
-}
-
-/* Structure to collect function names for final output
- in link section. */
-
-enum links_kind {KIND_UNUSED, KIND_LOCAL, KIND_EXTERN};
-
-
-struct alpha_links {
- struct alpha_links *next;
- char *name;
- enum links_kind kind;
-};
-
-static struct alpha_links *alpha_links_base = 0;
-
-/* Make (or fake) .linkage entry for function call.
-
- IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */
-
-void
-alpha_need_linkage (name, is_local)
- char *name;
- int is_local;
-{
- rtx x;
- struct alpha_links *lptr, *nptr;
-
- if (name[0] == '*')
- name++;
-
- /* Is this name already defined ? */
-
- for (lptr = alpha_links_base; lptr; lptr = lptr->next)
- if (strcmp (lptr->name, name) == 0)
- {
- if (is_local)
- {
- /* defined here but external assumed. */
- if (lptr->kind == KIND_EXTERN)
- lptr->kind = KIND_LOCAL;
- }
- else
- {
- /* used here but unused assumed. */
- if (lptr->kind == KIND_UNUSED)
- lptr->kind = KIND_LOCAL;
- }
- return;
- }
-
- nptr = (struct alpha_links *) xmalloc (sizeof (struct alpha_links));
- nptr->next = alpha_links_base;
- nptr->name = xstrdup (name);
-
- /* Assume external if no definition. */
- nptr->kind = (is_local ? KIND_UNUSED : KIND_EXTERN);
-
- alpha_links_base = nptr;
-
- return;
-}
-
-
-void
-alpha_write_linkage (stream)
- FILE *stream;
-{
- struct alpha_links *lptr, *nptr;
-
- readonly_section ();
-
- fprintf (stream, "\t.align 3\n");
-
- for (lptr = alpha_links_base; lptr; lptr = nptr)
- {
- nptr = lptr->next;
-
- if (lptr->kind == KIND_UNUSED
- || ! TREE_SYMBOL_REFERENCED (get_identifier (lptr->name)))
- continue;
-
- fprintf (stream, "%s..lk:\n", lptr->name);
- if (lptr->kind == KIND_LOCAL)
- {
- /* Local and used, build linkage pair. */
- fprintf (stream, "\t.quad %s..en\n", lptr->name);
- fprintf (stream, "\t.quad %s\n", lptr->name);
- }
- else
- /* External and used, request linkage pair. */
- fprintf (stream, "\t.linkage %s\n", lptr->name);
- }
-}
-
-#else
-
-void
-alpha_need_linkage (name, is_local)
- char *name;
- int is_local;
-{
-}
-
-#endif /* OPEN_VMS */
-
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
deleted file mode 100644
index 9fbd818b778..00000000000
--- a/gcc/config/alpha/alpha.h
+++ /dev/null
@@ -1,2296 +0,0 @@
-/* Definitions of target machine for GNU compiler, for DEC Alpha.
- Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-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. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "\
--Dunix -D__osf__ -D__alpha -D__alpha__ -D_LONGLONG -DSYSTYPE_BSD \
--D_SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4) -Acpu(alpha) -Amachine(alpha)"
-
-/* Write out the correct language type definition for the header files.
- Unless we have assembler language, write out the symbols for C. */
-#define CPP_SPEC "\
-%{!.S: -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}} \
-%{.S: -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
-%{.cc: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
-%{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
-%{.C: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
-%{.m: -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C} \
-%{mieee:-D_IEEE_FP} \
-%{mieee-with-inexact:-D_IEEE_FP -D_IEEE_FP_INEXACT}"
-
-/* Set the spec to use for signed char. The default tests the above macro
- but DEC's compiler can't handle the conditional in a "constant"
- operand. */
-
-#define SIGNED_CHAR_SPEC "%{funsigned-char:-D__CHAR_UNSIGNED__}"
-
-/* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */
-
-#define LIB_SPEC "%{p:-lprof1 -lpdf} %{pg:-lprof1 -lpdf} %{a:-lprof2} -lc"
-
-/* Pass "-G 8" to ld because Alpha's CC does. Pass -O3 if we are
- optimizing, -O1 if we are not. Pass -shared, -non_shared or
- -call_shared as appropriate. Also pass -pg. */
-#define LINK_SPEC \
- "-G 8 %{O*:-O3} %{!O*:-O1} %{static:-non_shared} \
- %{!static:%{shared:-shared} %{!shared:-call_shared}} %{pg} %{taso} \
- %{rpath*}"
-
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (!strcmp (STR, "rpath") || !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"))
-
-#define STARTFILE_SPEC \
- "%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}"
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION
-
-/* Define the location for the startup file on OSF/1 for Alpha. */
-
-#define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-/* Which processor to schedule for. The cpu attribute defines a list that
- mirrors this list, so changes to alpha.md must be made at the same time. */
-
-enum processor_type
- {PROCESSOR_EV4, /* 2106[46]{a,} */
- PROCESSOR_EV5}; /* 21164{a,} */
-
-extern enum processor_type alpha_cpu;
-
-enum alpha_trap_precision
-{
- ALPHA_TP_PROG, /* No precision (default). */
- ALPHA_TP_FUNC, /* Trap contained within originating function. */
- ALPHA_TP_INSN /* Instruction accuracy and code is resumption safe. */
-};
-
-enum alpha_fp_rounding_mode
-{
- ALPHA_FPRM_NORM, /* Normal rounding mode. */
- ALPHA_FPRM_MINF, /* Round towards minus-infinity. */
- ALPHA_FPRM_CHOP, /* Chopped rounding mode (towards 0). */
- ALPHA_FPRM_DYN /* Dynamic rounding mode. */
-};
-
-enum alpha_fp_trap_mode
-{
- ALPHA_FPTM_N, /* Normal trap mode. */
- ALPHA_FPTM_U, /* Underflow traps enabled. */
- ALPHA_FPTM_SU, /* Software completion, w/underflow traps */
- ALPHA_FPTM_SUI /* Software completion, w/underflow & inexact traps */
-};
-
-extern int target_flags;
-
-extern enum alpha_trap_precision alpha_tp;
-extern enum alpha_fp_rounding_mode alpha_fprm;
-extern enum alpha_fp_trap_mode alpha_fptm;
-
-/* This means that floating-point support exists in the target implementation
- of the Alpha architecture. This is usually the default. */
-
-#define MASK_FP 1
-#define TARGET_FP (target_flags & MASK_FP)
-
-/* This means that floating-point registers are allowed to be used. Note
- that Alpha implementations without FP operations are required to
- provide the FP registers. */
-
-#define MASK_FPREGS 2
-#define TARGET_FPREGS (target_flags & MASK_FPREGS)
-
-/* This means that gas is used to process the assembler file. */
-
-#define MASK_GAS 4
-#define TARGET_GAS (target_flags & MASK_GAS)
-
-/* This means that we should mark procedures as IEEE conformant. */
-
-#define MASK_IEEE_CONFORMANT 8
-#define TARGET_IEEE_CONFORMANT (target_flags & MASK_IEEE_CONFORMANT)
-
-/* This means we should be IEEE-compliant except for inexact. */
-
-#define MASK_IEEE 16
-#define TARGET_IEEE (target_flags & MASK_IEEE)
-
-/* This means we should be fully IEEE-compliant. */
-
-#define MASK_IEEE_WITH_INEXACT 32
-#define TARGET_IEEE_WITH_INEXACT (target_flags & MASK_IEEE_WITH_INEXACT)
-
-/* This means we are compiling for Windows NT. */
-
-#define MASK_WINDOWS_NT 64
-#define TARGET_WINDOWS_NT (target_flags & MASK_WINDOWS_NT)
-
-/* This means we must construct all constants rather than emitting
- them as literal data. */
-
-#define MASK_BUILD_CONSTANTS 128
-#define TARGET_BUILD_CONSTANTS (target_flags & MASK_BUILD_CONSTANTS)
-
-/* This means we are compiling for openVMS. */
-
-#define MASK_OPEN_VMS 256
-#define TARGET_OPEN_VMS (target_flags & MASK_OPEN_VMS)
-
-/* This means we handle floating points in VAX F- (float)
- or G- (double) Format. */
-
-#define MASK_FLOAT_VAX 512
-#define TARGET_FLOAT_VAX (target_flags & MASK_FLOAT_VAX)
-
-/* This means that the processor has byte and half word loads and stores. */
-
-#define MASK_BYTE_OPS 1024
-#define TARGET_BYTE_OPS (target_flags & MASK_BYTE_OPS)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { {"no-soft-float", MASK_FP}, \
- {"soft-float", - MASK_FP}, \
- {"fp-regs", MASK_FPREGS}, \
- {"no-fp-regs", - (MASK_FP|MASK_FPREGS)}, \
- {"alpha-as", -MASK_GAS}, \
- {"gas", MASK_GAS}, \
- {"ieee-conformant", MASK_IEEE_CONFORMANT}, \
- {"ieee", MASK_IEEE|MASK_IEEE_CONFORMANT}, \
- {"ieee-with-inexact", MASK_IEEE_WITH_INEXACT|MASK_IEEE_CONFORMANT}, \
- {"build-constants", MASK_BUILD_CONSTANTS}, \
- {"float-vax", MASK_FLOAT_VAX}, \
- {"float-ieee", -MASK_FLOAT_VAX}, \
- {"byte", MASK_BYTE_OPS}, \
- {"", TARGET_DEFAULT | TARGET_CPU_DEFAULT} }
-
-#define TARGET_DEFAULT MASK_FP|MASK_FPREGS
-
-#ifndef TARGET_CPU_DEFAULT
-#define TARGET_CPU_DEFAULT 0
-#endif
-
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
- command options that have values. Its definition is an initializer
- with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the fixed
- part of the option name, and the address of a variable. The
- variable, type `char *', is set to the variable part of the given
- option if the fixed part matches. The actual option name is made
- by appending `-m' to the specified name.
-
- Here is an example which defines `-mshort-data-NUMBER'. If the
- given option is `-mshort-data-512', the variable `m88k_short_data'
- will be set to the string `"512"'.
-
- extern char *m88k_short_data;
- #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
-
-extern char *alpha_cpu_string; /* For -mcpu=ev[4|5] */
-extern char *alpha_fprm_string; /* For -mfp-rounding-mode=[n|m|c|d] */
-extern char *alpha_fptm_string; /* For -mfp-trap-mode=[n|u|su|sui] */
-extern char *alpha_tp_string; /* For -mtrap-precision=[p|f|i] */
-
-#define TARGET_OPTIONS \
-{ \
- {"cpu=", &alpha_cpu_string}, \
- {"fp-rounding-mode=", &alpha_fprm_string}, \
- {"fp-trap-mode=", &alpha_fptm_string}, \
- {"trap-precision=", &alpha_tp_string}, \
-}
-
-/* Sometimes certain combinations of command options do not make sense
- on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed.
-
- On the Alpha, it is used to translate target-option strings into
- numeric values. */
-
-extern void override_options ();
-#define OVERRIDE_OPTIONS override_options ()
-
-
-/* Define this macro to change register usage conditional on target flags.
-
- On the Alpha, we use this to disable the floating-point registers when
- they don't exist. */
-
-#define CONDITIONAL_REGISTER_USAGE \
- if (! TARGET_FPREGS) \
- for (i = 32; i < 63; i++) \
- fixed_regs[i] = call_used_regs[i] = 1;
-
-/* Show we can debug even without a frame pointer. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* target machine storage layout */
-
-/* Define to enable software floating point emulation. */
-#define REAL_ARITHMETIC
-
-/* Define the size of `int'. The default is the same as the word size. */
-#define INT_TYPE_SIZE 32
-
-/* Define the size of `long long'. The default is the twice the word size. */
-#define LONG_LONG_TYPE_SIZE 64
-
-/* The two floating-point formats we support are S-floating, which is
- 4 bytes, and T-floating, which is 8 bytes. `float' is S and `double'
- and `long double' are T. */
-
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-#define WCHAR_TYPE "unsigned int"
-#define WCHAR_TYPE_SIZE 32
-
-/* Define this macro if it is advisable to hold scalars in registers
- in a wider mode than that declared by the program. In such cases,
- the value is constrained to be within the bounds of the declared
- type, but kept valid in the wider mode. The signedness of the
- extension may differ from that of the type.
-
- For Alpha, we always store objects in a full register. 32-bit objects
- are always sign-extended, but smaller objects retain their signedness. */
-
-#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
- { \
- if ((MODE) == SImode) \
- (UNSIGNEDP) = 0; \
- (MODE) = DImode; \
- }
-
-/* Define this if function arguments should also be promoted using the above
- procedure. */
-
-#define PROMOTE_FUNCTION_ARGS
-
-/* Likewise, if the function return value is promoted. */
-
-#define PROMOTE_FUNCTION_RETURN
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
-
- There are no such instructions on the Alpha, but the documentation
- is little endian. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered.
- This is false on the Alpha. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is lowest
- numbered.
-
- For Alpha we can decide arbitrarily since there are no machine instructions
- for them. Might as well be consistent with bytes. */
-#define WORDS_BIG_ENDIAN 0
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 64
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 8
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 64
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 64
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 64
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 64
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 64
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Align loop starts for optimal branching.
-
- ??? Kludge this and the next macro for the moment by not doing anything if
- we don't optimize and also if we are writing ECOFF symbols to work around
- a bug in DEC's assembler. */
-
-#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
- if (optimize > 0 && write_symbols != SDB_DEBUG) \
- ASM_OUTPUT_ALIGN (FILE, 5)
-
-/* This is how to align an instruction for optimal branching.
- On Alpha we'll get better performance by aligning on a quadword
- boundary. */
-
-#define ASM_OUTPUT_ALIGN_CODE(FILE) \
- if (optimize > 0 && write_symbols != SDB_DEBUG) \
- ASM_OUTPUT_ALIGN ((FILE), 4)
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 64
-
-/* For atomic access to objects, must have at least 32-bit alignment
- unless the machine has byte operations. */
-#define MINIMUM_ATOMIC_ALIGNMENT (TARGET_BYTE_OPS ? 8 : 32)
-
-/* Align all constants and variables to at least a word boundary so
- we can pick up pieces of them faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)
-#define DATA_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)
-
-/* Set this non-zero if move instructions will actually fail to work
- when given unaligned data.
-
- Since we get an error message when we do one, call them invalid. */
-
-#define STRICT_ALIGNMENT 1
-
-/* Set this non-zero if unaligned move instructions are extremely slow.
-
- On the Alpha, they trap. */
-
-#define SLOW_UNALIGNED_ACCESS 1
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- We define all 32 integer registers, even though $31 is always zero,
- and all 32 floating-point registers, even though $f31 is also
- always zero. We do not bother defining the FP status register and
- there are no other registers.
-
- Since $31 is always zero, we will use register number 31 as the
- argument pointer. It will never appear in the generated code
- because we will always be eliminating it in favor of the stack
- pointer or hardware frame pointer.
-
- Likewise, we use $f31 for the frame pointer, which will always
- be eliminated in favor of the hardware frame pointer or the
- stack pointer. */
-
-#define FIRST_PSEUDO_REGISTER 64
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator. */
-
-#define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, \
- 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
-
-/* List the order in which to allocate registers. Each register must be
- listed once, even those in FIXED_REGISTERS.
-
- We allocate in the following order:
- $f1 (nonsaved floating-point register)
- $f10-$f15 (likewise)
- $f22-$f30 (likewise)
- $f21-$f16 (likewise, but input args)
- $f0 (nonsaved, but return value)
- $f2-$f9 (saved floating-point registers)
- $1-$8 (nonsaved integer registers)
- $22-$25 (likewise)
- $28 (likewise)
- $0 (likewise, but return value)
- $21-$16 (likewise, but input args)
- $27 (procedure value in OSF, nonsaved in NT)
- $9-$14 (saved integer registers)
- $26 (return PC)
- $15 (frame pointer)
- $29 (global pointer)
- $30, $31, $f31 (stack pointer and always zero/ap & fp) */
-
-#define REG_ALLOC_ORDER \
- {33, \
- 42, 43, 44, 45, 46, 47, \
- 54, 55, 56, 57, 58, 59, 60, 61, 62, \
- 53, 52, 51, 50, 49, 48, \
- 32, \
- 34, 35, 36, 37, 38, 39, 40, 41, \
- 1, 2, 3, 4, 5, 6, 7, 8, \
- 22, 23, 24, 25, \
- 28, \
- 0, \
- 21, 20, 19, 18, 17, 16, \
- 27, \
- 9, 10, 11, 12, 13, 14, \
- 26, \
- 15, \
- 29, \
- 30, 31, 63 }
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On Alpha, the integer registers can hold any mode. The floating-point
- registers can hold 32-bit and 64-bit integers as well, but not 16-bit
- or 8-bit values. If we only allowed the larger integers into FP registers,
- we'd have to say that QImode and SImode aren't tiable, which is a
- pain. So say all registers can hold everything and see how that works. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-
-#define MODES_TIEABLE_P(MODE1, MODE2) 1
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* Alpha pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 30
-
-/* Base register for access to local variables of the function. */
-#define HARD_FRAME_POINTER_REGNUM 15
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 0
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 31
-
-/* Base register for access to local variables of function. */
-#define FRAME_POINTER_REGNUM 63
-
-/* Register in which static-chain is passed to a function.
-
- For the Alpha, this is based on an example; the calling sequence
- doesn't seem to specify this. */
-#define STATIC_CHAIN_REGNUM 1
-
-/* Register in which address to store a structure value
- arrives in the function. On the Alpha, the address is passed
- as a hidden argument. */
-#define STRUCT_VALUE 0
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS,
- LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
- { {0, 0}, {~0, 0x80000000}, {0, 0x7fffffff}, {~0, ~0} }
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) >= 32 && (REGNO) <= 62 ? FLOAT_REGS : GENERAL_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS NO_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'f' ? FLOAT_REGS : NO_REGS)
-
-/* Define this macro to change register usage conditional on target flags. */
-/* #define CONDITIONAL_REGISTER_USAGE */
-
-/* The letters I, J, K, L, M, N, O, and P in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For Alpha:
- `I' is used for the range of constants most insns can contain.
- `J' is the constant zero.
- `K' is used for the constant in an LDA insn.
- `L' is used for the constant in a LDAH insn.
- `M' is used for the constants that can be AND'ed with using a ZAP insn.
- `N' is used for complemented 8-bit constants.
- `O' is used for negated 8-bit constants.
- `P' is used for the constants 1, 2 and 3. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (unsigned HOST_WIDE_INT) (VALUE) < 0x100 \
- : (C) == 'J' ? (VALUE) == 0 \
- : (C) == 'K' ? (unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000 \
- : (C) == 'L' ? (((VALUE) & 0xffff) == 0 \
- && (((VALUE)) >> 31 == -1 || (VALUE) >> 31 == 0) \
- && ((HOST_BITS_PER_WIDE_INT == 64 \
- || (unsigned) (VALUE) != 0x80000000U))) \
- : (C) == 'M' ? zap_mask (VALUE) \
- : (C) == 'N' ? (unsigned HOST_WIDE_INT) (~ (VALUE)) < 0x100 \
- : (C) == 'O' ? (unsigned HOST_WIDE_INT) (- (VALUE)) < 0x100 \
- : (C) == 'P' ? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 3 \
- : 0)
-
-/* Similar, but for floating or large integer constants, and defining letters
- G and H. Here VALUE is the CONST_DOUBLE rtx itself.
-
- For Alpha, `G' is the floating-point constant zero. `H' is a CONST_DOUBLE
- that is the operand of a ZAP insn. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
- && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
- : (C) == 'H' ? (GET_MODE (VALUE) == VOIDmode \
- && zap_mask (CONST_DOUBLE_LOW (VALUE)) \
- && zap_mask (CONST_DOUBLE_HIGH (VALUE))) \
- : 0)
-
-/* Optional extra constraints for this machine.
-
- For the Alpha, `Q' means that this is a memory operand but not a
- reference to an unaligned location.
- `R' is a SYMBOL_REF that has SYMBOL_REF_FLAG set or is the current
- function. */
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' ? GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) != AND \
- : (C) == 'R' ? current_file_function_operand (OP, Pmode) \
- : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
-
- On the Alpha, all constants except zero go into a floating-point
- register via memory. */
-
-#define PREFERRED_RELOAD_CLASS(X, CLASS) \
- (CONSTANT_P (X) && (X) != const0_rtx && (X) != CONST0_RTX (GET_MODE (X)) \
- ? ((CLASS) == FLOAT_REGS ? NO_REGS : GENERAL_REGS) \
- : (CLASS))
-
-/* Loading and storing HImode or QImode values to and from memory
- usually requires a scratch register. The exceptions are loading
- QImode and HImode from an aligned address to a general register.
- We also cannot load an unaligned address or a paradoxical SUBREG into an
- FP register. */
-
-#define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,IN) \
-(((GET_CODE (IN) == MEM \
- || (GET_CODE (IN) == REG && REGNO (IN) >= FIRST_PSEUDO_REGISTER) \
- || (GET_CODE (IN) == SUBREG \
- && (GET_CODE (SUBREG_REG (IN)) == MEM \
- || (GET_CODE (SUBREG_REG (IN)) == REG \
- && REGNO (SUBREG_REG (IN)) >= FIRST_PSEUDO_REGISTER)))) \
- && (((CLASS) == FLOAT_REGS \
- && ((MODE) == SImode || (MODE) == HImode || (MODE) == QImode)) \
- || (((MODE) == QImode || (MODE) == HImode) \
- && unaligned_memory_operand (IN, MODE)))) \
- ? GENERAL_REGS \
- : ((CLASS) == FLOAT_REGS && GET_CODE (IN) == MEM \
- && GET_CODE (XEXP (IN, 0)) == AND) ? GENERAL_REGS \
- : ((CLASS) == FLOAT_REGS && GET_CODE (IN) == SUBREG \
- && (GET_MODE_SIZE (GET_MODE (IN)) \
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (IN))))) ? GENERAL_REGS \
- : NO_REGS)
-
-#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,OUT) \
-(((GET_CODE (OUT) == MEM \
- || (GET_CODE (OUT) == REG && REGNO (OUT) >= FIRST_PSEUDO_REGISTER) \
- || (GET_CODE (OUT) == SUBREG \
- && (GET_CODE (SUBREG_REG (OUT)) == MEM \
- || (GET_CODE (SUBREG_REG (OUT)) == REG \
- && REGNO (SUBREG_REG (OUT)) >= FIRST_PSEUDO_REGISTER)))) \
- && (((MODE) == HImode || (MODE) == QImode \
- || ((MODE) == SImode && (CLASS) == FLOAT_REGS)))) \
- ? GENERAL_REGS \
- : ((CLASS) == FLOAT_REGS && GET_CODE (OUT) == MEM \
- && GET_CODE (XEXP (OUT, 0)) == AND) ? GENERAL_REGS \
- : ((CLASS) == FLOAT_REGS && GET_CODE (OUT) == SUBREG \
- && (GET_MODE_SIZE (GET_MODE (OUT)) \
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (OUT))))) ? GENERAL_REGS \
- : NO_REGS)
-
-/* If we are copying between general and FP registers, we need a memory
- location. */
-
-#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) ((CLASS1) != (CLASS2))
-
-/* Specify the mode to be used for memory when a secondary memory
- location is needed. If MODE is floating-point, use it. Otherwise,
- widen to a word like the default. This is needed because we always
- store integers in FP registers in quadword format. This whole
- area is very tricky! */
-#define SECONDARY_MEMORY_NEEDED_MODE(MODE) \
- (GET_MODE_CLASS (MODE) == MODE_FLOAT ? (MODE) \
- : GET_MODE_SIZE (MODE) >= 4 ? (MODE) \
- : mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0))
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* If defined, gives a class of registers that cannot be used as the
- operand of a SUBREG that changes the size of the object. */
-
-#define CLASS_CANNOT_CHANGE_SIZE FLOAT_REGS
-
-/* Define the cost of moving between registers of various classes. Moving
- between FLOAT_REGS and anything else except float regs is expensive.
- In fact, we make it quite expensive because we really don't want to
- do these moves unless it is clearly worth it. Optimizations may
- reduce the impact of not being able to allocate a pseudo to a
- hard register. */
-
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- (((CLASS1) == FLOAT_REGS) == ((CLASS2) == FLOAT_REGS) ? 2 : 20)
-
-/* A C expressions returning the cost of moving data of MODE from a register to
- or from memory.
-
- On the Alpha, bump this up a bit. */
-
-#define MEMORY_MOVE_COST(MODE) 6
-
-/* Provide the cost of a branch. Exact meaning under development. */
-#define BRANCH_COST 5
-
-/* Adjust the cost of dependencies. */
-
-#define ADJUST_COST(INSN,LINK,DEP,COST) \
- (COST) = alpha_adjust_cost (INSN, LINK, DEP, COST)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-/* #define FRAME_GROWS_DOWNWARD */
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On Alpha, don't define this because there are no push insns. */
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* Define this if the maximum size of all the outgoing args is to be
- accumulated and pushed during the prologue. The amount can be
- found in the variable current_function_outgoing_args_size. */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Offset of first parameter from the argument pointer register value. */
-
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Definitions for register eliminations.
-
- We have two registers that can be eliminated on the Alpha. First, the
- frame pointer register can often be eliminated in favor of the stack
- pointer register. Secondly, the argument pointer register can always be
- eliminated; it is replaced with either the stack or frame pointer. */
-
-/* This is an array of structures. Each structure initializes one pair
- of eliminable registers. The "from" register number is given first,
- followed by "to". Eliminations of the same "from" register are listed
- in order of preference. */
-
-#define ELIMINABLE_REGS \
-{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
- { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
-
-/* Given FROM and TO register numbers, say whether this elimination is allowed.
- Frame pointer elimination is automatically handled.
-
- All eliminations are valid since the cases where FP can't be
- eliminated are already handled. */
-
-#define CAN_ELIMINATE(FROM, TO) 1
-
-/* Round up to a multiple of 16 bytes. */
-#define ALPHA_ROUND(X) (((X) + 15) & ~ 15)
-
-/* Define the offset between two registers, one to be eliminated, and the other
- its replacement, at the start of a routine. */
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ if ((FROM) == FRAME_POINTER_REGNUM) \
- (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \
- + alpha_sa_size ()); \
- else if ((FROM) == ARG_POINTER_REGNUM) \
- (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \
- + alpha_sa_size () \
- + (ALPHA_ROUND (get_frame_size () \
- + current_function_pretend_args_size) \
- - current_function_pretend_args_size)); \
-}
-
-/* Define this if stack space is still allocated for a parameter passed
- in a register. */
-/* #define REG_PARM_STACK_SPACE */
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0.
-
- On Alpha the value is found in $0 for integer functions and
- $f0 for floating-point functions. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, \
- (INTEGRAL_MODE_P (TYPE_MODE (VALTYPE)) \
- && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \
- ? word_mode : TYPE_MODE (VALTYPE), \
- ((TARGET_FPREGS \
- && (TREE_CODE (VALTYPE) == REAL_TYPE \
- || TREE_CODE (VALTYPE) == COMPLEX_TYPE)) \
- ? 32 : 0))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, MODE, \
- (TARGET_FPREGS \
- && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
- ? 32 : 0))
-
-/* The definition of this macro implies that there are cases where
- a scalar value cannot be returned in registers.
-
- For the Alpha, any structure or union type is returned in memory, as
- are integers whose size is larger than 64 bits. */
-
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE (TYPE) == BLKmode \
- || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_PRECISION (TYPE) > 64))
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller. */
-
-#define FUNCTION_VALUE_REGNO_P(N) \
- ((N) == 0 || (N) == 1 || (N) == 32 || (N) == 33)
-
-/* 1 if N is a possible register number for function argument passing.
- On Alpha, these are $16-$21 and $f16-$f21. */
-
-#define FUNCTION_ARG_REGNO_P(N) \
- (((N) >= 16 && (N) <= 21) || ((N) >= 16 + 32 && (N) <= 21 + 32))
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On Alpha, this is a single integer, which is a number of words
- of arguments scanned so far.
- Thus 6 or more means all following args should go on the stack. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0
-
-/* Define intermediate macro to compute the size (in registers) of an argument
- for the Alpha. */
-
-#define ALPHA_ARG_SIZE(MODE, TYPE, NAMED) \
-((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
- : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- if (MUST_PASS_IN_STACK (MODE, TYPE)) \
- (CUM) = 6; \
- else \
- (CUM) += ALPHA_ARG_SIZE (MODE, TYPE, NAMED)
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- On Alpha the first 6 words of args are normally in registers
- and the rest are pushed. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-((CUM) < 6 && ! MUST_PASS_IN_STACK (MODE, TYPE) \
- ? gen_rtx(REG, (MODE), \
- (CUM) + 16 + ((TARGET_FPREGS \
- && (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_FLOAT)) \
- * 32)) \
- : 0)
-
-/* Specify the padding direction of arguments.
-
- On the Alpha, we must pad upwards in order to be able to pass args in
- registers. */
-
-#define FUNCTION_ARG_PADDING(MODE, TYPE) upward
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
-((CUM) < 6 && 6 < (CUM) + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
- ? 6 - (CUM) : 0)
-
-/* Perform any needed actions needed for a function that is receiving a
- variable number of arguments.
-
- CUM is as above.
-
- MODE and TYPE are the mode and type of the current parameter.
-
- PRETEND_SIZE is a variable that should be set to the amount of stack
- that must be pushed by the prolog to pretend that our caller pushed
- it.
-
- Normally, this macro will push all remaining incoming registers on the
- stack and set PRETEND_SIZE to the length of the registers pushed.
-
- On the Alpha, we allocate space for all 12 arg registers, but only
- push those that are remaining.
-
- However, if NO registers need to be saved, don't allocate any space.
- This is not only because we won't need the space, but because AP includes
- the current_pretend_args_size and we don't want to mess up any
- ap-relative addresses already made.
-
- If we are not to use the floating-point registers, save the integer
- registers where we would put the floating-point registers. This is
- not the most efficient way to implement varargs with just one register
- class, but it isn't worth doing anything more efficient in this rare
- case. */
-
-
-#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
-{ if ((CUM) < 6) \
- { \
- if (! (NO_RTL)) \
- { \
- move_block_from_reg \
- (16 + CUM, \
- gen_rtx (MEM, BLKmode, \
- plus_constant (virtual_incoming_args_rtx, \
- ((CUM) + 6)* UNITS_PER_WORD)), \
- 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \
- move_block_from_reg \
- (16 + (TARGET_FPREGS ? 32 : 0) + CUM, \
- gen_rtx (MEM, BLKmode, \
- plus_constant (virtual_incoming_args_rtx, \
- (CUM) * UNITS_PER_WORD)), \
- 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \
- } \
- PRETEND_SIZE = 12 * UNITS_PER_WORD; \
- } \
-}
-
-/* Try to output insns to set TARGET equal to the constant C if it can be
- done in less than N insns. Do all computations in MODE. Returns the place
- where the output has been placed if it can be done and the insns have been
- emitted. If it would take more than N insns, zero is returned and no
- insns and emitted. */
-extern struct rtx_def *alpha_emit_set_const ();
-extern struct rtx_def *alpha_emit_set_long_const ();
-extern struct rtx_def *alpha_emit_conditional_move ();
-
-/* Generate necessary RTL for __builtin_saveregs().
- ARGLIST is the argument list; see expr.c. */
-extern struct rtx_def *alpha_builtin_saveregs ();
-#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) alpha_builtin_saveregs (ARGLIST)
-
-/* Define the information needed to generate branch and scc insns. This is
- stored from the compare operation. Note that we can't use "rtx" here
- since it hasn't been defined! */
-
-extern struct rtx_def *alpha_compare_op0, *alpha_compare_op1;
-extern int alpha_compare_fp_p;
-
-/* Make (or fake) .linkage entry for function call.
-
- IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */
-extern void alpha_need_linkage ();
-
-/* This macro produces the initial definition of a function name. On the
- Alpha, we need to save the function name for the prologue and epilogue. */
-
-extern char *alpha_function_name;
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
-{ \
- alpha_function_name = NAME; \
-}
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. Under OSF/1, profiling is enabled
- by simply passing -pg to the assembler and linker. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO)
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done.
- This assumes that __bb_init_func doesn't garble a1-a5. */
-
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- do { \
- ASM_OUTPUT_REG_PUSH (FILE, 16); \
- fputs ("\tlda $16,$PBX32\n", (FILE)); \
- fputs ("\tldq $26,0($16)\n", (FILE)); \
- fputs ("\tbne $26,1f\n", (FILE)); \
- fputs ("\tlda $27,__bb_init_func\n", (FILE)); \
- fputs ("\tjsr $26,($27),__bb_init_func\n", (FILE)); \
- fputs ("\tldgp $29,0($26)\n", (FILE)); \
- fputs ("1:\n", (FILE)); \
- ASM_OUTPUT_REG_POP (FILE, 16); \
- } while (0);
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. */
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
- do { \
- int blockn = (BLOCKNO); \
- fputs ("\tsubq $30,16,$30\n", (FILE)); \
- fputs ("\tstq $26,0($30)\n", (FILE)); \
- fputs ("\tstq $27,8($30)\n", (FILE)); \
- fputs ("\tlda $26,$PBX34\n", (FILE)); \
- fprintf ((FILE), "\tldq $27,%d($26)\n", 8*blockn); \
- fputs ("\taddq $27,1,$27\n", (FILE)); \
- fprintf ((FILE), "\tstq $27,%d($26)\n", 8*blockn); \
- fputs ("\tldq $26,0($30)\n", (FILE)); \
- fputs ("\tldq $27,8($30)\n", (FILE)); \
- fputs ("\taddq $30,16,$30\n", (FILE)); \
- } while (0)
-
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)
-
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- The trampoline should set the static chain pointer to value placed
- into the trampoline and should branch to the specified routine.
- Note that $27 has been set to the address of the trampoline, so we can
- use it for addressability of the two data items. Trampolines are always
- aligned to FUNCTION_BOUNDARY, which is 64 bits. */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\tldq $1,24($27)\n"); \
- fprintf (FILE, "\tldq $27,16($27)\n"); \
- fprintf (FILE, "\tjmp $31,($27),0\n"); \
- fprintf (FILE, "\tnop\n"); \
- fprintf (FILE, "\t.quad 0,0\n"); \
-}
-
-/* Section in which to place the trampoline. On Alpha, instructions
- may only be placed in a text segment. */
-
-#define TRAMPOLINE_SECTION text_section
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 32
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. We assume
- here that a function will be called many more times than its address
- is taken (e.g., it might be passed to qsort), so we take the trouble
- to initialize the "hint" field in the JMP insn. Note that the hint
- field is PC (new) + 4 * bits 13:0. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- rtx _temp, _temp1, _addr; \
- \
- _addr = memory_address (Pmode, plus_constant ((TRAMP), 16)); \
- emit_move_insn (gen_rtx (MEM, Pmode, _addr), (FNADDR)); \
- _addr = memory_address (Pmode, plus_constant ((TRAMP), 24)); \
- emit_move_insn (gen_rtx (MEM, Pmode, _addr), (CXT)); \
- \
- _temp = force_operand (plus_constant ((TRAMP), 12), NULL_RTX); \
- _temp = expand_binop (DImode, sub_optab, (FNADDR), _temp, _temp, 1, \
- OPTAB_WIDEN); \
- _temp = expand_shift (RSHIFT_EXPR, Pmode, _temp, \
- build_int_2 (2, 0), NULL_RTX, 1); \
- _temp = expand_and (gen_lowpart (SImode, _temp), \
- GEN_INT (0x3fff), 0); \
- \
- _addr = memory_address (SImode, plus_constant ((TRAMP), 8)); \
- _temp1 = force_reg (SImode, gen_rtx (MEM, SImode, _addr)); \
- _temp1 = expand_and (_temp1, GEN_INT (0xffffc000), NULL_RTX); \
- _temp1 = expand_binop (SImode, ior_optab, _temp1, _temp, _temp1, 1, \
- OPTAB_WIDEN); \
- \
- emit_move_insn (gen_rtx (MEM, SImode, _addr), _temp1); \
- \
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, \
- "__enable_execute_stack"), \
- 0, VOIDmode, 1,_addr, Pmode); \
- \
- emit_insn (gen_rtx (UNSPEC_VOLATILE, VOIDmode, \
- gen_rtvec (1, const0_rtx), 0)); \
-}
-
-/* Attempt to turn on access permissions for the stack. */
-
-#define TRANSFER_FROM_TRAMPOLINE \
- \
-void \
-__enable_execute_stack (addr) \
- void *addr; \
-{ \
- long size = getpagesize (); \
- long mask = ~(size-1); \
- char *page = (char *) (((long) addr) & mask); \
- char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
- \
- /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \
- if (mprotect (page, end - page, 7) < 0) \
- perror ("mprotect of trampoline code"); \
-}
-
-/* A C expression whose value is RTL representing the value of the return
- address for the frame COUNT steps up from the current frame.
- FRAMEADDR is the frame pointer of the COUNT frame, or the frame pointer of
- the COUNT-1 frame if RETURN_ADDR_IN_PREVIOUS_FRAME} is defined.
-
- This definition for Alpha is broken, but is put in at the request of
- Mike Stump. */
-
-#define RETURN_ADDR_RTX(COUNT, FRAME) \
-((COUNT == 0 && alpha_sa_size () == 0 && 0 /* not right. */) \
- ? gen_rtx (REG, Pmode, 26) \
- : gen_rtx (MEM, Pmode, \
- memory_address (Pmode, FRAME)))
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) 0
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32 \
- || (REGNO) == 63 || reg_renumber[REGNO] == 63)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-#define MAX_REGS_PER_ADDRESS 1
-
-/* Recognize any constant value that is a valid address. For the Alpha,
- there are only constants none since we want to use LDA to load any
- symbolic addresses into registers. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == CONST_INT \
- && (unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)
-
-/* Include all constant integers and constant doubles, but not
- floating-point, except for floating-point zero. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- (GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
- || (X) == CONST0_RTX (GET_MODE (X)))
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) 0
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- (REGNO (X) < 32 || REGNO (X) == 63 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- For Alpha, we have either a constant address or the sum of a register
- and a constant address, or just a register. For DImode, any of those
- forms can be surrounded with an AND that clear the low-order three bits;
- this is an "unaligned" access.
-
- First define the basic valid address. */
-
-#define GO_IF_LEGITIMATE_SIMPLE_ADDRESS(MODE, X, ADDR) \
-{ if (REG_P (X) && REG_OK_FOR_BASE_P (X)) \
- goto ADDR; \
- if (CONSTANT_ADDRESS_P (X)) \
- goto ADDR; \
- if (GET_CODE (X) == PLUS \
- && REG_P (XEXP (X, 0)) \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- goto ADDR; \
-}
-
-/* Now accept the simple address, or, for DImode only, an AND of a simple
- address that turns off the low three bits. */
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ GO_IF_LEGITIMATE_SIMPLE_ADDRESS (MODE, X, ADDR); \
- if ((MODE) == DImode \
- && GET_CODE (X) == AND \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && INTVAL (XEXP (X, 1)) == -8) \
- GO_IF_LEGITIMATE_SIMPLE_ADDRESS (MODE, XEXP (X, 0), ADDR); \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the Alpha, there are three cases we handle:
-
- (1) If the address is (plus reg const_int) and the CONST_INT is not a
- valid offset, compute the high part of the constant and add it to the
- register. Then our address is (plus temp low-part-const).
- (2) If the address is (const (plus FOO const_int)), find the low-order
- part of the CONST_INT. Then load FOO plus any high-order part of the
- CONST_INT into a register. Our address is (plus reg low-part-const).
- This is done to reduce the number of GOT entries.
- (3) If we have a (plus reg const), emit the load as in (2), then add
- the two registers, and finally generate (plus reg low-part-const) as
- our address. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && ! CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- { \
- HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \
- HOST_WIDE_INT lowpart = (val & 0xffff) - 2 * (val & 0x8000); \
- HOST_WIDE_INT highpart = val - lowpart; \
- rtx high = GEN_INT (highpart); \
- rtx temp = expand_binop (Pmode, add_optab, XEXP (x, 0), \
- high, NULL_RTX, 1, OPTAB_LIB_WIDEN); \
- \
- (X) = plus_constant (temp, lowpart); \
- goto WIN; \
- } \
- else if (GET_CODE (X) == CONST \
- && GET_CODE (XEXP (X, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT) \
- { \
- HOST_WIDE_INT val = INTVAL (XEXP (XEXP (X, 0), 1)); \
- HOST_WIDE_INT lowpart = (val & 0xffff) - 2 * (val & 0x8000); \
- HOST_WIDE_INT highpart = val - lowpart; \
- rtx high = XEXP (XEXP (X, 0), 0); \
- \
- if (highpart) \
- high = plus_constant (high, highpart); \
- \
- (X) = plus_constant (force_reg (Pmode, high), lowpart); \
- goto WIN; \
- } \
- else if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
- && GET_CODE (XEXP (X, 1)) == CONST \
- && GET_CODE (XEXP (XEXP (X, 1), 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (XEXP (X, 1), 0), 1)) == CONST_INT) \
- { \
- HOST_WIDE_INT val = INTVAL (XEXP (XEXP (XEXP (X, 1), 0), 1)); \
- HOST_WIDE_INT lowpart = (val & 0xffff) - 2 * (val & 0x8000); \
- HOST_WIDE_INT highpart = val - lowpart; \
- rtx high = XEXP (XEXP (XEXP (X, 1), 0), 0); \
- \
- if (highpart) \
- high = plus_constant (high, highpart); \
- \
- high = expand_binop (Pmode, add_optab, XEXP (X, 0), \
- force_reg (Pmode, high), \
- high, 1, OPTAB_LIB_WIDEN); \
- (X) = plus_constant (high, lowpart); \
- goto WIN; \
- } \
-}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the Alpha this is true only for the unaligned modes. We can
- simplify this test since we know that the address must be valid. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
-{ if (GET_CODE (ADDR) == AND) goto LABEL; }
-
-/* Compute the cost of an address. For the Alpha, all valid addresses are
- the same cost. */
-
-#define ADDRESS_COST(X) 0
-
-/* Define this if some processing needs to be done immediately before
- emitting code for an insn. */
-
-extern void final_prescan_insn ();
-#define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) \
- final_prescan_insn ((INSN), (OPERANDS), (NOPERANDS))
-
-/* Define this if FINAL_PRESCAN_INSN should be called for a CODE_LABEL. */
-#define FINAL_PRESCAN_LABEL
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses.
- On the Alpha, the table is really GP-relative, not relative to the PC
- of the table, but we pretend that it is PC-relative; this should be OK,
- but we should try to find some better way sometime. */
-#define CASE_VECTOR_PC_RELATIVE
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one.
-
- We actually lie a bit here as overflow conditions are different. But
- they aren't being checked anyway. */
-
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* Max number of bytes we can move to or from memory
- in one reasonably fast instruction. */
-
-#define MOVE_MAX 8
-
-/* Largest number of bytes of an object that can be placed in a register.
- On the Alpha we have plenty of registers, so use TImode. */
-#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode)
-
-/* Nonzero if access to memory by bytes is no faster than for words.
- Also non-zero if doing byte operations (specifically shifts) in registers
- is undesirable.
-
- On the Alpha, we want to not use the byte operation and instead use
- masking operations to access fields; these will save instructions. */
-
-#define SLOW_BYTE_ACCESS 1
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) ((MODE) == SImode ? SIGN_EXTEND : ZERO_EXTEND)
-
-/* Define if loading short immediate values into registers sign extends. */
-#define SHORT_IMMEDIATES_SIGN_EXTEND
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE 1
-
-/* Define the value returned by a floating-point comparison instruction. */
-
-#define FLOAT_STORE_FLAG_VALUE 0.5
-
-/* Canonicalize a comparison from one we don't have to one we do have. */
-
-#define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \
- do { \
- if (((CODE) == GE || (CODE) == GT || (CODE) == GEU || (CODE) == GTU) \
- && (GET_CODE (OP1) == REG || (OP1) == const0_rtx)) \
- { \
- rtx tem = (OP0); \
- (OP0) = (OP1); \
- (OP1) = tem; \
- (CODE) = swap_condition (CODE); \
- } \
- if (((CODE) == LT || (CODE) == LTU) \
- && GET_CODE (OP1) == CONST_INT && INTVAL (OP1) == 256) \
- { \
- (CODE) = (CODE) == LT ? LE : LEU; \
- (OP1) = GEN_INT (255); \
- } \
- } while (0)
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode DImode
-
-/* Mode of a function address in a call instruction (for indexing purposes). */
-
-#define FUNCTION_MODE Pmode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap.
-
- We define this on the Alpha so that gen_call and gen_call_value
- get to see the SYMBOL_REF (for the hint field of the jsr). It will
- then copy it into a register, thus actually letting the address be
- cse'ed. */
-
-#define NO_FUNCTION_CSE
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch.
-
- If this is an 8-bit constant, return zero since it can be used
- nearly anywhere with no cost. If it is a valid operand for an
- ADD or AND, likewise return 0 if we know it will be used in that
- context. Otherwise, return 2 since it might be used there later.
- All other constants take at least two insns. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) >= 0 && INTVAL (RTX) < 256) \
- return 0; \
- case CONST_DOUBLE: \
- if (((OUTER_CODE) == PLUS && add_operand (RTX, VOIDmode)) \
- || ((OUTER_CODE) == AND && and_operand (RTX, VOIDmode))) \
- return 0; \
- else if (add_operand (RTX, VOIDmode) || and_operand (RTX, VOIDmode)) \
- return 2; \
- else \
- return COSTS_N_INSNS (2); \
- case CONST: \
- case SYMBOL_REF: \
- case LABEL_REF: \
- switch (alpha_cpu) \
- { \
- case PROCESSOR_EV4: \
- return COSTS_N_INSNS (3); \
- case PROCESSOR_EV5: \
- return COSTS_N_INSNS (2); \
- }
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. */
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case PLUS: case MINUS: \
- if (FLOAT_MODE_P (GET_MODE (X))) \
- switch (alpha_cpu) \
- { \
- case PROCESSOR_EV4: \
- return COSTS_N_INSNS (6); \
- case PROCESSOR_EV5: \
- return COSTS_N_INSNS (4); \
- } \
- else if (GET_CODE (XEXP (X, 0)) == MULT \
- && const48_operand (XEXP (XEXP (X, 0), 1), VOIDmode)) \
- return (2 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \
- + rtx_cost (XEXP (X, 1), OUTER_CODE)); \
- break; \
- case MULT: \
- switch (alpha_cpu) \
- { \
- case PROCESSOR_EV4: \
- if (FLOAT_MODE_P (GET_MODE (X))) \
- return COSTS_N_INSNS (6); \
- return COSTS_N_INSNS (23); \
- case PROCESSOR_EV5: \
- if (FLOAT_MODE_P (GET_MODE (X))) \
- return COSTS_N_INSNS (4); \
- else if (GET_MODE (X) == DImode) \
- return COSTS_N_INSNS (12); \
- else \
- return COSTS_N_INSNS (8); \
- } \
- case ASHIFT: \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && INTVAL (XEXP (X, 1)) <= 3) \
- break; \
- /* ... fall through ... */ \
- case ASHIFTRT: case LSHIFTRT: case IF_THEN_ELSE: \
- switch (alpha_cpu) \
- { \
- case PROCESSOR_EV4: \
- return COSTS_N_INSNS (2); \
- case PROCESSOR_EV5: \
- return COSTS_N_INSNS (1); \
- } \
- case DIV: case UDIV: case MOD: case UMOD: \
- switch (alpha_cpu) \
- { \
- case PROCESSOR_EV4: \
- if (GET_MODE (X) == SFmode) \
- return COSTS_N_INSNS (34); \
- else if (GET_MODE (X) == DFmode) \
- return COSTS_N_INSNS (63); \
- else \
- return COSTS_N_INSNS (70); \
- case PROCESSOR_EV5: \
- if (GET_MODE (X) == SFmode) \
- return COSTS_N_INSNS (15); \
- else if (GET_MODE (X) == DFmode) \
- return COSTS_N_INSNS (22); \
- else \
- return COSTS_N_INSNS (70); /* EV5 ??? */ \
- } \
- case MEM: \
- switch (alpha_cpu) \
- { \
- case PROCESSOR_EV4: \
- return COSTS_N_INSNS (3); \
- case PROCESSOR_EV5: \
- return COSTS_N_INSNS (2); \
- } \
- case NEG: case ABS: \
- if (! FLOAT_MODE_P (GET_MODE (X))) \
- break; \
- /* ... fall through ... */ \
- case FLOAT: case UNSIGNED_FLOAT: case FIX: case UNSIGNED_FIX: \
- case FLOAT_EXTEND: case FLOAT_TRUNCATE: \
- switch (alpha_cpu) \
- { \
- case PROCESSOR_EV4: \
- return COSTS_N_INSNS (6); \
- case PROCESSOR_EV5: \
- return COSTS_N_INSNS (4); \
- }
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) \
-{ \
- alpha_write_verstamp (FILE); \
- fprintf (FILE, "\t.set noreorder\n"); \
- fprintf (FILE, "\t.set volatile\n"); \
- fprintf (FILE, "\t.set noat\n"); \
- ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
-}
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before read-only data. */
-
-#define READONLY_DATA_SECTION_ASM_OP ".rdata"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* Define an extra section for read-only data, a routine to enter it, and
- indicate that it is for read-only data.
-
- The first time we enter the readonly data section for a file, we write
- eight bytes of zero. This works around a bug in DEC's assembler in
- some versions of OSF/1 V3.x. */
-
-#define EXTRA_SECTIONS readonly_data
-
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-literal_section () \
-{ \
- if (in_section != readonly_data) \
- { \
- static int firsttime = 1; \
- \
- fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \
- if (firsttime) \
- { \
- firsttime = 0; \
- ASM_OUTPUT_DOUBLE_INT (asm_out_file, const0_rtx); \
- } \
- \
- in_section = readonly_data; \
- } \
-} \
-
-#define READONLY_DATA_SECTION literal_section
-
-/* If we are referencing a function that is static, make the SYMBOL_REF
- special. We use this to see indicate we can branch to this function
- without setting PV or restoring GP. */
-
-#define ENCODE_SECTION_INFO(DECL) \
- if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
- "$9", "$10", "$11", "$12", "$13", "$14", "$15", \
- "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", \
- "$24", "$25", "$26", "$27", "$28", "$29", "$30", "AP", \
- "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", \
- "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", \
- "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",\
- "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "FP"}
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs ("\t.globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX ""
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- if ((PREFIX)[0] == 'L') \
- fprintf (FILE, "$%s%d:\n", & (PREFIX)[1], NUM + 32); \
- else \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM);
-
-/* This is how to output a label for a jump table. Arguments are the same as
- for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
- passed. */
-
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
-{ ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- if ((PREFIX)[0] == 'L') \
- sprintf (LABEL, "*$%s%d", & (PREFIX)[1], NUM + 32); \
- else \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* Check a floating-point value for validity for a particular machine mode. */
-
-#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
- ((OVERFLOW) = check_float_value (MODE, &D, OVERFLOW))
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
- fprintf (FILE, "\t.quad 0x%lx%08lx\n", \
- t[1] & 0xffffffff, t[0] & 0xffffffff); \
- } \
- else \
- { \
- char str[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
- fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'g':'t', str); \
- } \
- }
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { \
- long t; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
- fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
-} while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line defining a `long' constant. */
-
-#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.quad "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
- fprintf (FILE, "\t.word %d\n", \
- (GET_CODE (VALUE) == CONST_INT \
- ? INTVAL (VALUE) & 0xffff : (abort (), 0)))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
- fprintf (FILE, "\t.byte %d\n", \
- (GET_CODE (VALUE) == CONST_INT \
- ? INTVAL (VALUE) & 0xff : (abort (), 0)))
-
-/* We use the default ASCII-output routine, except that we don't write more
- than 50 characters since the assembler doesn't support very long lines. */
-
-#define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
- do { \
- FILE *_hide_asm_out_file = (MYFILE); \
- unsigned char *_hide_p = (unsigned char *) (MYSTRING); \
- int _hide_thissize = (MYLENGTH); \
- int _size_so_far = 0; \
- { \
- FILE *asm_out_file = _hide_asm_out_file; \
- unsigned char *p = _hide_p; \
- int thissize = _hide_thissize; \
- int i; \
- fprintf (asm_out_file, "\t.ascii \""); \
- \
- for (i = 0; i < thissize; i++) \
- { \
- register int c = p[i]; \
- \
- if (_size_so_far ++ > 50 && i < thissize - 4) \
- _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \
- \
- if (c == '\"' || c == '\\') \
- putc ('\\', asm_out_file); \
- if (c >= ' ' && c < 0177) \
- putc (c, asm_out_file); \
- else \
- { \
- fprintf (asm_out_file, "\\%o", c); \
- /* After an octal-escape, if a digit follows, \
- terminate one string constant and start another. \
- The Vax assembler fails to stop reading the escape \
- after three digits, so this is the only way we \
- can get it to parse the data properly. */ \
- if (i < thissize - 1 \
- && p[i + 1] >= '0' && p[i + 1] <= '9') \
- _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \
- } \
- } \
- fprintf (asm_out_file, "\"\n"); \
- } \
- } \
- while (0)
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tsubq $30,8,$30\n\tst%s $%s%d,0($30)\n", \
- (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \
- (REGNO) & 31);
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tld%s $%s%d,0($30)\n\taddq $30,8,$30\n", \
- (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \
- (REGNO) & 31);
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE) & 0xff)
-
-/* This is how to output an element of a case-vector that is absolute.
- (Alpha does not use such vectors, but we must define this macro anyway.) */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) abort ()
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.%s $%d\n", TARGET_WINDOWS_NT ? "long" : "gprel32", \
- (VALUE) + 32)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", LOG);
-
-/* This is how to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
-( fputs ("\t.lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-/* Determine which codes are valid without a following integer. These must
- not be alphabetic (the characters are chosen so that
- PRINT_OPERAND_PUNCT_VALID_P translates into a simple range change when
- using ASCII).
-
- & Generates fp-rounding mode suffix: nothing for normal, 'c' for
- chopped, 'm' for minus-infinity, and 'd' for dynamic rounding
- mode. alpha_fprm controls which suffix is generated.
-
- ' Generates trap-mode suffix for instructions that accept the
- su suffix only (cmpt et al).
-
- ) Generates trap-mode suffix for instructions that accept the
- u, su, and sui suffix. This is the bulk of the IEEE floating
- point instructions (addt et al).
-
- + Generates trap-mode suffix for instructions that accept the
- sui suffix (cvtqt and cvtqs).
-
- , Generates single precision suffix for floating point
- instructions (s for IEEE, f for VAX)
-
- - Generates double precision suffix for floating point
- instructions (t for IEEE, g for VAX)
- */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '&' || (CODE) == '\'' || (CODE) == ')' || (CODE) == '+' \
- || (CODE) == ',' || (CODE) == '-')
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ rtx addr = (ADDR); \
- int basereg = 31; \
- HOST_WIDE_INT offset = 0; \
- \
- if (GET_CODE (addr) == AND) \
- addr = XEXP (addr, 0); \
- \
- if (GET_CODE (addr) == REG) \
- basereg = REGNO (addr); \
- else if (GET_CODE (addr) == CONST_INT) \
- offset = INTVAL (addr); \
- else if (GET_CODE (addr) == PLUS \
- && GET_CODE (XEXP (addr, 0)) == REG \
- && GET_CODE (XEXP (addr, 1)) == CONST_INT) \
- basereg = REGNO (XEXP (addr, 0)), offset = INTVAL (XEXP (addr, 1)); \
- else \
- abort (); \
- \
- fprintf (FILE, "%d($%d)", offset, basereg); \
-}
-/* Define the codes that are matched by predicates in alpha.c. */
-
-#define PREDICATE_CODES \
- {"reg_or_0_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_6bit_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_8bit_operand", {SUBREG, REG, CONST_INT}}, \
- {"cint8_operand", {CONST_INT}}, \
- {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
- {"add_operand", {SUBREG, REG, CONST_INT}}, \
- {"sext_add_operand", {SUBREG, REG, CONST_INT}}, \
- {"const48_operand", {CONST_INT}}, \
- {"and_operand", {SUBREG, REG, CONST_INT}}, \
- {"or_operand", {SUBREG, REG, CONST_INT}}, \
- {"mode_mask_operand", {CONST_INT}}, \
- {"mul8_operand", {CONST_INT}}, \
- {"mode_width_operand", {CONST_INT}}, \
- {"reg_or_fp0_operand", {SUBREG, REG, CONST_DOUBLE}}, \
- {"alpha_comparison_operator", {EQ, LE, LT, LEU, LTU}}, \
- {"alpha_swapped_comparison_operator", {EQ, GE, GT, GEU, GTU}}, \
- {"signed_comparison_operator", {EQ, NE, LE, LT, GE, GT}}, \
- {"divmod_operator", {DIV, MOD, UDIV, UMOD}}, \
- {"fp0_operand", {CONST_DOUBLE}}, \
- {"current_file_function_operand", {SYMBOL_REF}}, \
- {"call_operand", {REG, SYMBOL_REF}}, \
- {"input_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
- SYMBOL_REF, CONST, LABEL_REF}}, \
- {"some_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \
- SYMBOL_REF, CONST, LABEL_REF}}, \
- {"aligned_memory_operand", {MEM}}, \
- {"unaligned_memory_operand", {MEM}}, \
- {"reg_or_unaligned_mem_operand", {SUBREG, REG, MEM}}, \
- {"any_memory_operand", {MEM}},
-
-/* Tell collect that the object format is ECOFF. */
-#define OBJECT_FORMAT_COFF
-#define EXTENDED_COFF
-
-/* If we use NM, pass -g to it so it only lists globals. */
-#define NM_FLAGS "-pg"
-
-/* Definitions for debugging. */
-
-#define SDB_DEBUGGING_INFO /* generate info for mips-tfile */
-#define DBX_DEBUGGING_INFO /* generate embedded stabs */
-#define MIPS_DEBUGGING_INFO /* MIPS specific debugging info */
-
-#ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */
-#define PREFERRED_DEBUGGING_TYPE \
- ((len > 1 && !strncmp (str, "ggdb", len)) ? DBX_DEBUG : SDB_DEBUG)
-#endif
-
-
-/* Correct the offset of automatic variables and arguments. Note that
- the Alpha debug format wants all automatic variables and arguments
- to be in terms of two different offsets from the virtual frame pointer,
- which is the stack pointer before any adjustment in the function.
- The offset for the argument pointer is fixed for the native compiler,
- it is either zero (for the no arguments case) or large enough to hold
- all argument registers.
- The offset for the auto pointer is the fourth argument to the .frame
- directive (local_offset).
- To stay compatible with the native tools we use the same offsets
- from the virtual frame pointer and adjust the debugger arg/auto offsets
- accordingly. These debugger offsets are set up in output_prolog. */
-
-extern long alpha_arg_offset;
-extern long alpha_auto_offset;
-#define DEBUGGER_AUTO_OFFSET(X) \
- ((GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) + alpha_auto_offset)
-#define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET + alpha_arg_offset)
-
-
-#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
- alpha_output_lineno (STREAM, LINE)
-extern void alpha_output_lineno ();
-
-#define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
- alpha_output_filename (STREAM, NAME)
-extern void alpha_output_filename ();
-
-
-/* mips-tfile.c limits us to strings of one page. */
-#define DBX_CONTIN_LENGTH 4000
-
-/* By default, turn on GDB extensions. */
-#define DEFAULT_GDB_EXTENSIONS 1
-
-/* Stabs-in-ECOFF can't handle dbxout_function_end(). */
-#define NO_DBX_FUNCTION_END 1
-
-/* If we are smuggling stabs through the ALPHA ECOFF object
- format, put a comment in front of the .stab<x> operation so
- that the ALPHA assembler does not choke. The mips-tfile program
- will correctly put the stab into the object file. */
-
-#define ASM_STABS_OP ((TARGET_GAS) ? ".stabs" : " #.stabs")
-#define ASM_STABN_OP ((TARGET_GAS) ? ".stabn" : " #.stabn")
-#define ASM_STABD_OP ((TARGET_GAS) ? ".stabd" : " #.stabd")
-
-/* Forward references to tags are allowed. */
-#define SDB_ALLOW_FORWARD_REFERENCES
-
-/* Unknown tags are also allowed. */
-#define SDB_ALLOW_UNKNOWN_REFERENCES
-
-#define PUT_SDB_DEF(a) \
-do { \
- fprintf (asm_out_file, "\t%s.def\t", \
- (TARGET_GAS) ? "" : "#"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fputc (';', asm_out_file); \
-} while (0)
-
-#define PUT_SDB_PLAIN_DEF(a) \
-do { \
- fprintf (asm_out_file, "\t%s.def\t.%s;", \
- (TARGET_GAS) ? "" : "#", (a)); \
-} while (0)
-
-#define PUT_SDB_TYPE(a) \
-do { \
- fprintf (asm_out_file, "\t.type\t0x%x;", (a)); \
-} while (0)
-
-/* For block start and end, we create labels, so that
- later we can figure out where the correct offset is.
- The normal .ent/.end serve well enough for functions,
- so those are just commented out. */
-
-extern int sdb_label_count; /* block start/end next label # */
-
-#define PUT_SDB_BLOCK_START(LINE) \
-do { \
- fprintf (asm_out_file, \
- "$Lb%d:\n\t%s.begin\t$Lb%d\t%d\n", \
- sdb_label_count, \
- (TARGET_GAS) ? "" : "#", \
- sdb_label_count, \
- (LINE)); \
- sdb_label_count++; \
-} while (0)
-
-#define PUT_SDB_BLOCK_END(LINE) \
-do { \
- fprintf (asm_out_file, \
- "$Le%d:\n\t%s.bend\t$Le%d\t%d\n", \
- sdb_label_count, \
- (TARGET_GAS) ? "" : "#", \
- sdb_label_count, \
- (LINE)); \
- sdb_label_count++; \
-} while (0)
-
-#define PUT_SDB_FUNCTION_START(LINE)
-
-#define PUT_SDB_FUNCTION_END(LINE)
-
-#define PUT_SDB_EPILOGUE_END(NAME)
-
-/* No point in running CPP on our assembler output. */
-#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GAS) != 0
-/* Don't pass -g to GNU as, because some versions don't accept this option. */
-#define ASM_SPEC "%{malpha-as:-g} -nocpp %{pg}"
-#else
-/* In OSF/1 v3.2c, the assembler by default does not output file names which
- causes mips-tfile to fail. Passing -g to the assembler fixes this problem.
- ??? Stricly speaking, we only need -g if the user specifies -g. Passing
- it always means that we get slightly larger than necessary object files
- if the user does not specify -g. If we don't pass -g, then mips-tfile
- will need to be fixed to work in this case. */
-#define ASM_SPEC "%{!mgas:-g} -nocpp %{pg}"
-#endif
-
-/* Specify to run a post-processor, mips-tfile after the assembler
- has run to stuff the ecoff debug information into the object file.
- This is needed because the Alpha assembler provides no way
- of specifying such information in the assembly file. */
-
-#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GAS) != 0
-
-#define ASM_FINAL_SPEC "\
-%{malpha-as: %{!mno-mips-tfile: \
- \n mips-tfile %{v*: -v} \
- %{K: -I %b.o~} \
- %{!K: %{save-temps: -I %b.o~}} \
- %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \
- %{.s:%i} %{!.s:%g.s}}}"
-
-#else
-#define ASM_FINAL_SPEC "\
-%{!mgas: %{!mno-mips-tfile: \
- \n mips-tfile %{v*: -v} \
- %{K: -I %b.o~} \
- %{!K: %{save-temps: -I %b.o~}} \
- %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \
- %{.s:%i} %{!.s:%g.s}}}"
-
-#endif
-
-/* Macros for mips-tfile.c to encapsulate stabs in ECOFF, and for
- mips-tdump.c to print them out.
-
- These must match the corresponding definitions in gdb/mipsread.c.
- Unfortunately, gcc and gdb do not currently share any directories. */
-
-#define CODE_MASK 0x8F300
-#define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
-#define MIPS_MARK_STAB(code) ((code)+CODE_MASK)
-#define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
-
-/* Override some mips-tfile definitions. */
-
-#define SHASH_SIZE 511
-#define THASH_SIZE 55
-
-/* Align ecoff symbol tables to avoid OSF1/1.3 nm complaints. */
-
-#define ALIGN_SYMTABLE_OFFSET(OFFSET) (((OFFSET) + 7) & ~7)
-
-/* The system headers under OSF/1 are C++-aware. */
-#define NO_IMPLICIT_EXTERN_C
-
-/* The linker will stick __main into the .init section. */
-#define HAS_INIT_SECTION
-#define LD_INIT_SWITCH "-init"
-#define LD_FINI_SWITCH "-fini"
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
deleted file mode 100644
index 61e0738e054..00000000000
--- a/gcc/config/alpha/alpha.md
+++ /dev/null
@@ -1,4414 +0,0 @@
-;; Machine description for DEC Alpha for GNU C compiler
-;; Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
-;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-;; 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.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; Processor type -- this attribute must exactly match the processor_type
-;; enumeration in alpha.h.
-
-(define_attr "cpu" "ev4,ev5"
- (const (symbol_ref "alpha_cpu")))
-
-;; Define an insn type attribute. This is used in function unit delay
-;; computations, among other purposes. For the most part, we use the names
-;; defined in the EV4 documentation, but add a few that we have to know about
-;; separately.
-
-(define_attr "type"
- "ld,st,ibr,fbr,jsr,iadd,ilog,shift,cmov,icmp,imull,imulq,fadd,fmul,fcpys,fdivs,fdivt,ldsym,isubr"
- (const_string "iadd"))
-
-;; The TRAP_TYPE attribute marks instructions that may generate traps
-;; (which are imprecise and may need a trapb if software complention
-;; is desired).
-(define_attr "trap" "yes,no" (const_string "no"))
-
-;; For the EV4 we include four function units: ABOX, which computes the address,
-;; BBOX, used for branches, EBOX, used for integer operations, and FBOX,
-;; used for FP operations.
-;;
-;; We assume that we have been successful in getting double issues and
-;; hence multiply all costs by two insns per cycle. The minimum time in
-;; a function unit is 2 cycle, which will tend to produce the double
-;; issues.
-
-;; Memory delivers its result in three cycles.
-(define_function_unit "ev4_abox" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "ld,st"))
- 6 2)
-
-;; Branches have no delay cost, but do tie up the unit for two cycles.
-(define_function_unit "ev4_bbox" 1 1
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "ibr,fbr,jsr"))
- 4 4)
-
-;; Arithmetic insns are normally have their results available after two
-;; cycles. There are a number of exceptions. They are encoded in
-;; ADJUST_COST. Some of the other insns have similar exceptions.
-
-(define_function_unit "ev4_ebox" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "iadd,ilog,ldsym,shift,cmov,icmp"))
- 4 2)
-
-;; These really don't take up the integer pipeline, but they do occupy
-;; IBOX1; we approximate here.
-
-(define_function_unit "ev4_ebox" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "imull"))
- 42 2)
-
-(define_function_unit "ev4_ebox" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "imulq"))
- 46 2)
-
-(define_function_unit "ev4_imult" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "imull"))
- 42 38)
-
-(define_function_unit "ev4_imult" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "imulq"))
- 46 42)
-
-(define_function_unit "ev4_fbox" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "fadd,fmul,fcpys"))
- 12 2)
-
-(define_function_unit "ev4_fbox" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "fdivs"))
- 68 0)
-
-(define_function_unit "ev4_fbox" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "fdivt"))
- 126 0)
-
-(define_function_unit "ev4_divider" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "fdivs"))
- 68 60)
-
-(define_function_unit "ev4_divider" 1 0
- (and (eq_attr "cpu" "ev4")
- (eq_attr "type" "fdivt"))
- 126 118)
-
-;; EV5 scheduling. EV5 can issue 4 insns per clock.
-;; Multiply all costs by 4.
-
-;; EV5 has two integer units.
-(define_function_unit "ev5_ebox" 2 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "iadd,ilog,icmp,ldsym"))
- 4 4)
-
-;; Memory takes at least 2 clocks.
-;; Conditional moves always take 2 ticks.
-(define_function_unit "ev5_ebox" 2 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "ld,cmov"))
- 8 4)
-
-;; Loads can dual issue. Store cannot; nor can loads + stores.
-;; Model this with a mythical load/store unit.
-(define_function_unit "ev5_ldst" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "ld"))
- 8 4 [(eq_attr "type" "st")])
-
-(define_function_unit "ev5_ldst" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "st"))
- 4 4)
-
-(define_function_unit "ev5_ebox" 2 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "imull"))
- 32 4)
-
-(define_function_unit "ev5_ebox" 2 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "imulq"))
- 48 4)
-
-;; Multiplies also use the integer multiplier.
-(define_function_unit "ev5_imult" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "imull"))
- 16 8)
-
-(define_function_unit "ev5_imult" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "imulq"))
- 48 32)
-
-;; There is only 1 shifter/zapper.
-(define_function_unit "ev5_shift" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "shift"))
- 4 4)
-
-;; We pretend EV5 has symmetrical 2 fpus,
-;; even though cpys is the only insn that can issue on either unit.
-(define_function_unit "ev5_fpu" 2 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "fadd,fmul,fcpys"))
- 16 4)
-
-;; Multiplies (resp. adds) also use the fmul (resp. fadd) units.
-(define_function_unit "ev5_fpmul" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "fmul"))
- 16 4)
-
-(define_function_unit "ev5_fpadd" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "fadd"))
- 16 4)
-
-(define_function_unit "ev5_fpadd" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "fbr"))
- 4 4)
-
-(define_function_unit "ev5_fpadd" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "fdivs"))
- 60 4)
-
-(define_function_unit "ev5_fpadd" 1 0
- (and (eq_attr "cpu" "ev5")
- (eq_attr "type" "fdivt"))
- 88 4)
-
-;; First define the arithmetic insns. Note that the 32-bit forms also
-;; sign-extend.
-
-;; Note that we can do sign extensions in both FP and integer registers.
-;; However, the result must be in the same type of register as the input.
-;; The register preferencing code can't handle this case very well, so, for
-;; now, don't let the FP case show up here for preferencing. Also,
-;; sign-extends in FP registers take two instructions.
-(define_insn "extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "=r,r,*f")
- (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,*f")))]
- ""
- "@
- addl %1,$31,%0
- ldl %0,%1
- cvtql %1,%0\;cvtlq %0,%0"
- [(set_attr "type" "iadd,ld,fadd")])
-
-;; Do addsi3 the way expand_binop would do if we didn't have one. This
-;; generates better code. We have the anonymous addsi3 pattern below in
-;; case combine wants to make it.
-(define_expand "addsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
- (match_operand:SI 2 "add_operand" "")))]
- ""
- "
-{ emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
- gen_rtx (PLUS, DImode,
- gen_lowpart (DImode, operands[1]),
- gen_lowpart (DImode, operands[2]))));
- DONE;
-} ")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
- (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
- (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
- ""
- "@
- addl %r1,%2,%0
- subl %r1,%n2,%0
- lda %0,%2(%r1)
- ldah %0,%h2(%r1)")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "const_int_operand" "")))]
- "! add_operand (operands[2], SImode)"
- [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
- "
-{
- HOST_WIDE_INT val = INTVAL (operands[2]);
- HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
- HOST_WIDE_INT rest = val - low;
-
- operands[3] = GEN_INT (rest);
- operands[4] = GEN_INT (low);
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (sign_extend:DI
- (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
- (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
- ""
- "@
- addl %r1,%2,%0
- subl %r1,%n2,%0")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI
- (plus:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "const_int_operand" ""))))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
- && INTVAL (operands[2]) % 4 == 0"
- [(set (match_dup 3) (match_dup 4))
- (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
- (match_dup 5))
- (match_dup 1))))]
- "
-{
- HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
- int mult = 4;
-
- if (val % 2 == 0)
- val /= 2, mult = 8;
-
- operands[4] = GEN_INT (val);
- operands[5] = GEN_INT (mult);
-}")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI
- (plus:SI (match_operator:SI 1 "comparison_operator"
- [(match_operand 2 "" "")
- (match_operand 3 "" "")])
- (match_operand:SI 4 "add_operand" ""))))
- (clobber (match_operand:DI 5 "register_operand" ""))]
- ""
- [(set (match_dup 5) (match_dup 6))
- (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
- "
-{
- operands[6] = gen_rtx (GET_CODE (operands[1]), DImode,
- operands[2], operands[3]);
- operands[7] = gen_lowpart (SImode, operands[5]);
-}")
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
- (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
- (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
- ""
- "@
- addq %r1,%2,%0
- subq %r1,%n2,%0
- lda %0,%2(%r1)
- ldah %0,%h2(%r1)")
-
-;; Don't do this if we are adjusting SP since we don't want to do
-;; it in two steps.
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (plus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "const_int_operand" "")))]
- "! add_operand (operands[2], DImode)
- && REGNO (operands[0]) != STACK_POINTER_REGNUM"
- [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
- "
-{
- HOST_WIDE_INT val = INTVAL (operands[2]);
- HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
- HOST_WIDE_INT rest = val - low;
-
- operands[3] = GEN_INT (rest);
- operands[4] = GEN_INT (low);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
- (match_operand:SI 2 "const48_operand" "I,I"))
- (match_operand:SI 3 "sext_add_operand" "rI,O")))]
- ""
- "@
- s%2addl %r1,%3,%0
- s%2subl %r1,%n3,%0")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (sign_extend:DI
- (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
- (match_operand:SI 2 "const48_operand" "I,I"))
- (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
- ""
- "@
- s%2addl %r1,%3,%0
- s%2subl %r1,%n3,%0")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI
- (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
- [(match_operand 2 "" "")
- (match_operand 3 "" "")])
- (match_operand:SI 4 "const48_operand" ""))
- (match_operand:SI 5 "add_operand" ""))))
- (clobber (match_operand:DI 6 "register_operand" ""))]
- ""
- [(set (match_dup 6) (match_dup 7))
- (set (match_dup 0)
- (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
- (match_dup 5))))]
- "
-{
- operands[7] = gen_rtx (GET_CODE (operands[1]), DImode,
- operands[2], operands[3]);
- operands[8] = gen_lowpart (SImode, operands[6]);
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
- (match_operand:DI 2 "const48_operand" "I,I"))
- (match_operand:DI 3 "reg_or_8bit_operand" "rI,O")))]
- ""
- "@
- s%2addq %r1,%3,%0
- s%2subq %1,%n3,%0")
-
-;; These variants of the above insns can occur if the third operand
-;; is the frame pointer. This is a kludge, but there doesn't
-;; seem to be a way around it. Only recognize them while reloading.
-
-(define_insn ""
- [(set (match_operand:DI 0 "some_operand" "=&r")
- (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r")
- (match_operand:DI 2 "some_operand" "r"))
- (match_operand:DI 3 "some_operand" "rIOKL")))]
- "reload_in_progress"
- "#")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" ""))
- (match_operand:DI 3 "add_operand" "")))]
- "reload_completed"
- [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "some_operand" "=&r")
- (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ")
- (match_operand:SI 2 "const48_operand" "I"))
- (match_operand:SI 3 "some_operand" "r"))
- (match_operand:SI 4 "some_operand" "rIOKL")))]
- "reload_in_progress"
- "#")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "r")
- (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
- (match_operand:SI 2 "const48_operand" ""))
- (match_operand:SI 3 "register_operand" ""))
- (match_operand:SI 4 "add_operand" "rIOKL")))]
- "reload_completed"
- [(set (match_dup 0)
- (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "some_operand" "=&r")
- (sign_extend:DI
- (plus:SI (plus:SI
- (mult:SI (match_operand:SI 1 "some_operand" "rJ")
- (match_operand:SI 2 "const48_operand" "I"))
- (match_operand:SI 3 "some_operand" "r"))
- (match_operand:SI 4 "some_operand" "rIOKL"))))]
- "reload_in_progress"
- "#")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI
- (plus:SI (plus:SI
- (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
- (match_operand:SI 2 "const48_operand" ""))
- (match_operand:SI 3 "register_operand" ""))
- (match_operand:SI 4 "add_operand" ""))))]
- "reload_completed"
- [(set (match_dup 5)
- (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))]
- "
-{ operands[5] = gen_lowpart (SImode, operands[0]);
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "some_operand" "=&r")
- (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ")
- (match_operand:DI 2 "const48_operand" "I"))
- (match_operand:DI 3 "some_operand" "r"))
- (match_operand:DI 4 "some_operand" "rIOKL")))]
- "reload_in_progress"
- "#")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "=")
- (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "")
- (match_operand:DI 2 "const48_operand" ""))
- (match_operand:DI 3 "register_operand" ""))
- (match_operand:DI 4 "add_operand" "")))]
- "reload_completed"
- [(set (match_dup 0)
- (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
- "")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
- ""
- "subl $31,%1,%0")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (sign_extend:DI (neg:SI
- (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
- ""
- "subl $31,%1,%0")
-
-(define_insn "negdi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
- ""
- "subq $31,%1,%0")
-
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
- (match_operand:SI 2 "reg_or_8bit_operand" "")))]
- ""
- "
-{ emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
- gen_rtx (MINUS, DImode,
- gen_lowpart (DImode, operands[1]),
- gen_lowpart (DImode, operands[2]))));
- DONE;
-
-} ")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
- (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
- ""
- "subl %r1,%2,%0")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
- (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
- ""
- "subl %r1,%2,%0")
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
- ""
- "subq %r1,%2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
- (match_operand:SI 2 "const48_operand" "I"))
- (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
- ""
- "s%2subl %r1,%3,%0")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (sign_extend:DI
- (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
- (match_operand:SI 2 "const48_operand" "I"))
- (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
- ""
- "s%2subl %r1,%3,%0")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (match_operand:DI 2 "const48_operand" "I"))
- (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
- ""
- "s%2subq %r1,%3,%0")
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
- (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
- ""
- "mull %r1,%r2,%0"
- [(set_attr "type" "imull")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (sign_extend:DI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
- (match_operand:SI 2 "reg_or_0_operand" "rJ"))))]
- ""
- "mull %r1,%r2,%0"
- [(set_attr "type" "imull")])
-
-(define_insn "muldi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
- (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
- ""
- "mulq %r1,%r2,%0"
- [(set_attr "type" "imulq")])
-
-(define_insn "umuldi3_highpart"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (truncate:DI
- (lshiftrt:TI
- (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
- (zero_extend:TI (match_operand:DI 2 "register_operand" "r")))
- (const_int 64))))]
- ""
- "umulh %1,%2,%0"
- [(set_attr "type" "imulq")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (truncate:DI
- (lshiftrt:TI
- (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
- (match_operand:TI 2 "cint8_operand" "I"))
- (const_int 64))))]
- ""
- "umulh %1,%2,%0"
- [(set_attr "type" "imulq")])
-
-;; The divide and remainder operations always take their inputs from
-;; r24 and r25, put their output in r27, and clobber r23 and r28.
-
-(define_expand "divsi3"
- [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
- (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
- (parallel [(set (reg:SI 27)
- (div:SI (reg:SI 24)
- (reg:SI 25)))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))])
- (set (match_operand:SI 0 "general_operand" "")
- (reg:SI 27))]
- "!TARGET_OPEN_VMS"
- "")
-
-(define_expand "udivsi3"
- [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
- (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
- (parallel [(set (reg:SI 27)
- (udiv:SI (reg:SI 24)
- (reg:SI 25)))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))])
- (set (match_operand:SI 0 "general_operand" "")
- (reg:SI 27))]
- "!TARGET_OPEN_VMS"
- "")
-
-(define_expand "modsi3"
- [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
- (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
- (parallel [(set (reg:SI 27)
- (mod:SI (reg:SI 24)
- (reg:SI 25)))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))])
- (set (match_operand:SI 0 "general_operand" "")
- (reg:SI 27))]
- "!TARGET_OPEN_VMS"
- "")
-
-(define_expand "umodsi3"
- [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
- (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
- (parallel [(set (reg:SI 27)
- (umod:SI (reg:SI 24)
- (reg:SI 25)))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))])
- (set (match_operand:SI 0 "general_operand" "")
- (reg:SI 27))]
- "!TARGET_OPEN_VMS"
- "")
-
-(define_expand "divdi3"
- [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
- (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
- (parallel [(set (reg:DI 27)
- (div:DI (reg:DI 24)
- (reg:DI 25)))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))])
- (set (match_operand:DI 0 "general_operand" "")
- (reg:DI 27))]
- "!TARGET_OPEN_VMS"
- "")
-
-(define_expand "udivdi3"
- [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
- (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
- (parallel [(set (reg:DI 27)
- (udiv:DI (reg:DI 24)
- (reg:DI 25)))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))])
- (set (match_operand:DI 0 "general_operand" "")
- (reg:DI 27))]
- "!TARGET_OPEN_VMS"
- "")
-
-(define_expand "moddi3"
- [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
- (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
- (parallel [(set (reg:DI 27)
- (mod:DI (reg:DI 24)
- (reg:DI 25)))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))])
- (set (match_operand:DI 0 "general_operand" "")
- (reg:DI 27))]
- "!TARGET_OPEN_VMS"
- "")
-
-(define_expand "umoddi3"
- [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
- (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
- (parallel [(set (reg:DI 27)
- (umod:DI (reg:DI 24)
- (reg:DI 25)))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))])
- (set (match_operand:DI 0 "general_operand" "")
- (reg:DI 27))]
- "!TARGET_OPEN_VMS"
- "")
-
-(define_insn ""
- [(set (reg:SI 27)
- (match_operator:SI 1 "divmod_operator"
- [(reg:SI 24) (reg:SI 25)]))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))]
- "!TARGET_OPEN_VMS"
- "%E1 $24,$25,$27"
- [(set_attr "type" "isubr")])
-
-(define_insn ""
- [(set (reg:DI 27)
- (match_operator:DI 1 "divmod_operator"
- [(reg:DI 24) (reg:DI 25)]))
- (clobber (reg:DI 23))
- (clobber (reg:DI 28))]
- "!TARGET_OPEN_VMS"
- "%E1 $24,$25,$27"
- [(set_attr "type" "isubr")])
-
-;; Next are the basic logical operations. These only exist in DImode.
-
-(define_insn "anddi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r,r")
- (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
- (match_operand:DI 2 "and_operand" "rI,N,MH")))]
- ""
- "@
- and %r1,%2,%0
- bic %r1,%N2,%0
- zapnot %r1,%m2,%0"
- [(set_attr "type" "ilog,ilog,shift")])
-
-;; There are times when we can split an AND into two AND insns. This occurs
-;; when we can first clear any bytes and then clear anything else. For
-;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
-;; Only do this when running on 64-bit host since the computations are
-;; too messy otherwise.
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (and:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "const_int_operand" "")))]
- "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
- [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
- "
-{
- unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
- unsigned HOST_WIDE_INT mask2 = mask1;
- int i;
-
- /* For each byte that isn't all zeros, make it all ones. */
- for (i = 0; i < 64; i += 8)
- if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
- mask1 |= (HOST_WIDE_INT) 0xff << i;
-
- /* Now turn on any bits we've just turned off. */
- mask2 |= ~ mask1;
-
- operands[3] = GEN_INT (mask1);
- operands[4] = GEN_INT (mask2);
-}")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
- ""
- "zapnot %1,1,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
- "TARGET_BYTE_OPS"
- "@
- zapnot %1,1,%0
- ldbu %0,%1"
- [(set_attr "type" "shift,ld")])
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
- ""
- "zapnot %1,1,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
- "TARGET_BYTE_OPS"
- "@
- zapnot %1,1,%0
- ldbu %0,%1"
- [(set_attr "type" "shift,ld")])
-
-(define_insn "zero_extendqidi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
- ""
- "zapnot %1,1,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
- "TARGET_BYTE_OPS"
- "@
- zapnot %1,3,%0
- ldwu %0,%1"
- [(set_attr "type" "shift,ld")])
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
- ""
- "zapnot %1,3,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
- "TARGET_BYTE_OPS"
- "@
- zapnot %1,3,%0
- ldwu %0,%1"
- [(set_attr "type" "shift,ld")])
-
-(define_insn "zero_extendhidi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
- ""
- "zapnot %1,3,%0"
- [(set_attr "type" "shift")])
-
-(define_insn "zero_extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "zapnot %1,15,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
- (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
- ""
- "bic %r2,%1,%0"
- [(set_attr "type" "ilog")])
-
-(define_insn "iordi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
- (match_operand:DI 2 "or_operand" "rI,N")))]
- ""
- "@
- bis %r1,%2,%0
- ornot %r1,%N2,%0"
- [(set_attr "type" "ilog")])
-
-(define_insn "one_cmpldi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
- ""
- "ornot $31,%1,%0"
- [(set_attr "type" "ilog")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
- (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
- ""
- "ornot %r2,%1,%0"
- [(set_attr "type" "ilog")])
-
-(define_insn "xordi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
- (match_operand:DI 2 "or_operand" "rI,N")))]
- ""
- "@
- xor %r1,%2,%0
- eqv %r1,%N2,%0"
- [(set_attr "type" "ilog")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
- (match_operand:DI 2 "register_operand" "rI"))))]
- ""
- "eqv %r1,%2,%0"
- [(set_attr "type" "ilog")])
-
-;; Next come the shifts and the various extract and insert operations.
-
-(define_insn "ashldi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
- (match_operand:DI 2 "reg_or_6bit_operand" "P,rI")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (operands[2] == const1_rtx)
- return \"addq %r1,%r1,%0\";
- else
- return \"s%P2addq %r1,0,%0\";
- case 1:
- return \"sll %r1,%2,%0\";
- }
-}"
- [(set_attr "type" "iadd,shift")])
-
-;; ??? The following pattern is made by combine, but earlier phases
-;; (specifically flow) can't handle it. This occurs in jump.c. Deal
-;; with this in a better way at some point.
-;;(define_insn ""
-;; [(set (match_operand:DI 0 "register_operand" "=r")
-;; (sign_extend:DI
-;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
-;; (match_operand:DI 2 "const_int_operand" "P"))
-;; 0)))]
-;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
-;; "*
-;;{
-;; if (operands[2] == const1_rtx)
-;; return \"addl %r1,%r1,%0\";
-;; else
-;; return \"s%P2addl %r1,0,%0\";
-;; }"
-;; [(set_attr "type" "iadd")])
-
-(define_insn "lshrdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
- ""
- "srl %r1,%2,%0"
- [(set_attr "type" "shift")])
-
-(define_insn "ashrdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
- ""
- "sra %r1,%2,%0"
- [(set_attr "type" "shift")])
-
-(define_expand "extendqihi2"
- [(set (match_dup 2)
- (ashift:DI (match_operand:QI 1 "reg_or_unaligned_mem_operand" "")
- (const_int 56)))
- (set (match_operand:HI 0 "register_operand" "")
- (ashiftrt:DI (match_dup 2)
- (const_int 56)))]
- ""
- "
-{
- /* If we have a MEM (must be unaligned), extend to DImode (which we do
- specially) and then copy to the result. */
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx temp = gen_reg_rtx (DImode);
-
- emit_insn (gen_extendqidi2 (temp, operands[1]));
- emit_move_insn (operands[0], gen_lowpart (HImode, temp));
- DONE;
- }
-
- operands[0] = gen_lowpart (DImode, operands[0]);
- operands[1] = gen_lowpart (DImode, operands[1]);
- operands[2] = gen_reg_rtx (DImode);
-}")
-
-(define_insn "extendqidi2x"
- [(set (match_operand:DI 0 "register_operand" "r")
- (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
- "TARGET_BYTE_OPS"
- "sextb %1,%0"
- [(set_attr "type" "shift")]) ;; not sure what class this belongs to
-
-(define_insn "extendhidi2x"
- [(set (match_operand:DI 0 "register_operand" "r")
- (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
- "TARGET_BYTE_OPS"
- "sextw %1,%0"
- [(set_attr "type" "shift")])
-
-(define_expand "extendqisi2"
- [(set (match_dup 2)
- (ashift:DI (match_operand:QI 1 "reg_or_unaligned_mem_operand" "")
- (const_int 56)))
- (set (match_operand:SI 0 "register_operand" "")
- (ashiftrt:DI (match_dup 2)
- (const_int 56)))]
- ""
- "
-{
- /* If we have a MEM (must be unaligned), extend to a DImode form of
- the result (which we do specially). */
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx temp = gen_reg_rtx (DImode);
-
- emit_insn (gen_extendqidi2 (temp, operands[1]));
- emit_move_insn (operands[0], gen_lowpart (SImode, temp));
- DONE;
- }
-
- operands[0] = gen_lowpart (DImode, operands[0]);
- operands[1] = gen_lowpart (DImode, operands[1]);
- operands[2] = gen_reg_rtx (DImode);
-}")
-
-(define_expand "extendqidi2"
- [(set (match_dup 2)
- (ashift:DI (match_operand:QI 1 "reg_or_unaligned_mem_operand" "")
- (const_int 56)))
- (set (match_operand:DI 0 "register_operand" "")
- (ashiftrt:DI (match_dup 2)
- (const_int 56)))]
- ""
- "
-{ extern rtx get_unaligned_address ();
-
- if (TARGET_BYTE_OPS)
- {
- rtx temp = operands[1];
-
- if (GET_CODE (operands[1]) == MEM)
- {
- temp = gen_reg_rtx (QImode);
- emit_insn (gen_movqi (temp, operands[1]));
- }
-
- emit_insn (gen_extendqidi2x (operands[0], temp));
- DONE;
- }
-
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx seq
- = gen_unaligned_extendqidi (operands[0],
- get_unaligned_address (operands[1], 1));
-
- alpha_set_memflags (seq, operands[1]);
- emit_insn (seq);
- DONE;
- }
-
- operands[1] = gen_lowpart (DImode, operands[1]);
- operands[2] = gen_reg_rtx (DImode);
-}")
-
-(define_expand "extendhisi2"
- [(set (match_dup 2)
- (ashift:DI (match_operand:HI 1 "reg_or_unaligned_mem_operand" "")
- (const_int 48)))
- (set (match_operand:SI 0 "register_operand" "")
- (ashiftrt:DI (match_dup 2)
- (const_int 48)))]
- ""
- "
-{
- /* If we have a MEM (must be unaligned), extend to a DImode form of
- the result (which we do specially). */
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx temp = gen_reg_rtx (DImode);
-
- emit_insn (gen_extendhidi2 (temp, operands[1]));
- emit_move_insn (operands[0], gen_lowpart (SImode, temp));
- DONE;
- }
-
- operands[0] = gen_lowpart (DImode, operands[0]);
- operands[1] = gen_lowpart (DImode, operands[1]);
- operands[2] = gen_reg_rtx (DImode);
-}")
-
-(define_expand "extendhidi2"
- [(set (match_dup 2)
- (ashift:DI (match_operand:HI 1 "reg_or_unaligned_mem_operand" "")
- (const_int 48)))
- (set (match_operand:DI 0 "register_operand" "")
- (ashiftrt:DI (match_dup 2)
- (const_int 48)))]
- ""
- "
-{ extern rtx get_unaligned_address ();
-
- if (TARGET_BYTE_OPS)
- {
- rtx temp = operands[1];
-
- if (GET_CODE (operands[1]) == MEM)
- {
- temp = gen_reg_rtx (HImode);
- emit_insn (gen_movhi (temp, operands[1]));
- }
-
- emit_insn (gen_extendhidi2x (operands[0], temp));
- DONE;
- }
-
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx seq
- = gen_unaligned_extendhidi (operands[0],
- get_unaligned_address (operands[1], 2));
-
- alpha_set_memflags (seq, operands[1]);
- emit_insn (seq);
- DONE;
- }
-
- operands[1] = gen_lowpart (DImode, operands[1]);
- operands[2] = gen_reg_rtx (DImode);
-}")
-
-;; Here's how we sign extend an unaligned byte and halfword. Doing this
-;; as a pattern saves one instruction. The code is similar to that for
-;; the unaligned loads (see below).
-;;
-;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
-(define_expand "unaligned_extendqidi"
- [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
- (set (match_dup 3)
- (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
- (const_int -8))))
- (set (match_dup 4)
- (ashift:DI (match_dup 3)
- (minus:DI (const_int 56)
- (ashift:DI
- (and:DI (plus:DI (match_dup 2) (const_int -1))
- (const_int 7))
- (const_int 3)))))
- (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
- (ashiftrt:DI (match_dup 4) (const_int 56)))]
- ""
- "
-{ operands[2] = gen_reg_rtx (DImode);
- operands[3] = gen_reg_rtx (DImode);
- operands[4] = gen_reg_rtx (DImode);
-}")
-
-(define_expand "unaligned_extendhidi"
- [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
- (set (match_dup 3)
- (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
- (const_int -8))))
- (set (match_dup 4)
- (ashift:DI (match_dup 3)
- (minus:DI (const_int 56)
- (ashift:DI
- (and:DI (plus:DI (match_dup 2) (const_int -1))
- (const_int 7))
- (const_int 3)))))
- (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
- (ashiftrt:DI (match_dup 4) (const_int 48)))]
- ""
- "
-{ operands[2] = gen_reg_rtx (DImode);
- operands[3] = gen_reg_rtx (DImode);
- operands[4] = gen_reg_rtx (DImode);
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (match_operand:DI 2 "mode_width_operand" "n")
- (match_operand:DI 3 "mul8_operand" "I")))]
- ""
- "ext%M2l %r1,%s3,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (match_operand:DI 2 "mode_width_operand" "n")
- (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
- (const_int 3))))]
- ""
- "ext%M2l %r1,%3,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI
- (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (minus:DI (const_int 56)
- (ashift:DI
- (and:DI
- (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
- (const_int -1))
- (const_int 7))
- (const_int 3)))))]
- ""
- "extqh %r1,%2,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI
- (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (const_int 2147483647))
- (minus:DI (const_int 56)
- (ashift:DI
- (and:DI
- (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
- (const_int -1))
- (const_int 7))
- (const_int 3)))))]
- ""
- "extlh %r1,%2,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI
- (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (const_int 65535))
- (minus:DI (const_int 56)
- (ashift:DI
- (and:DI
- (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
- (const_int -1))
- (const_int 7))
- (const_int 3)))))]
- ""
- "extwh %r1,%2,%0"
- [(set_attr "type" "shift")])
-
-;; This converts an extXl into an extXh with an appropriate adjustment
-;; to the address calculation.
-
-;;(define_split
-;; [(set (match_operand:DI 0 "register_operand" "")
-;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
-;; (match_operand:DI 2 "mode_width_operand" "")
-;; (ashift:DI (match_operand:DI 3 "" "")
-;; (const_int 3)))
-;; (match_operand:DI 4 "const_int_operand" "")))
-;; (clobber (match_operand:DI 5 "register_operand" ""))]
-;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
-;; [(set (match_dup 5) (match_dup 6))
-;; (set (match_dup 0)
-;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
-;; (ashift:DI (plus:DI (match_dup 5)
-;; (match_dup 7))
-;; (const_int 3)))
-;; (match_dup 4)))]
-;; "
-;;{
-;; operands[6] = plus_constant (operands[3],
-;; INTVAL (operands[2]) / BITS_PER_UNIT);
-;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
-;;}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
- (match_operand:DI 2 "mul8_operand" "I")))]
- ""
- "insbl %1,%s2,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
- (match_operand:DI 2 "mul8_operand" "I")))]
- ""
- "inswl %1,%s2,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:DI 2 "mul8_operand" "I")))]
- ""
- "insll %1,%s2,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
- (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
- (const_int 3))))]
- ""
- "insbl %1,%2,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
- (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
- (const_int 3))))]
- ""
- "inswl %1,%2,%0"
- [(set_attr "type" "shift")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
- (const_int 3))))]
- ""
- "insll %1,%2,%0"
- [(set_attr "type" "shift")])
-
-;; We do not include the insXh insns because they are complex to express
-;; and it does not appear that we would ever want to generate them.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (not:DI (ashift:DI
- (match_operand:DI 2 "mode_mask_operand" "n")
- (ashift:DI
- (match_operand:DI 3 "reg_or_8bit_operand" "rI")
- (const_int 3))))
- (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
- ""
- "msk%U2l %r1,%3,%0"
- [(set_attr "type" "shift")])
-
-;; We do not include the mskXh insns because it does not appear we would ever
-;; generate one.
-
-;; Floating-point operations. All the double-precision insns can extend
-;; from single, so indicate that. The exception are the ones that simply
-;; play with the sign bits; it's not clear what to do there.
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "cpys $f31,%R1,%0"
- [(set_attr "type" "fcpys")])
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "cpys $f31,%R1,%0"
- [(set_attr "type" "fcpys")])
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "cpysn %R1,%R1,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "cpysn %R1,%R1,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=&f")
- (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
- (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "add%,%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
- (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "add%,%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=&f")
- (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "add%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "add%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (plus:DF (float_extend:DF
- (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "add%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (plus:DF (float_extend:DF
- (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
- (float_extend:DF
- (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "add%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn "fix_truncdfdi2"
- [(set (match_operand:DI 0 "register_operand" "=f")
- (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "cvt%-qc %R1,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn "fix_truncsfdi2"
- [(set (match_operand:DI 0 "register_operand" "=f")
- (fix:DI (float_extend:DF
- (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
- "TARGET_FP"
- "cvt%-qc %R1,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn "floatdisf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:DI 1 "register_operand" "f")))]
- "TARGET_FP"
- "cvtq%,%+%& %1,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=&f")
- (float:DF (match_operand:DI 1 "register_operand" "f")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "cvtq%-%+%& %1,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn "floatdidf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:DI 1 "register_operand" "f")))]
- "TARGET_FP"
- "cvtq%-%+%& %1,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_expand "extendsfdf2"
- [(use (match_operand:DF 0 "register_operand" ""))
- (use (match_operand:SF 1 "nonimmediate_operand" ""))]
- "TARGET_FP"
-"
-{
- if (alpha_tp == ALPHA_TP_INSN)
- emit_insn (gen_extendsfdf2_tp (operands[0],
- force_reg (SFmode, operands[1])));
- else
- emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1]));
-
- DONE;
-}")
-;; FIXME
-(define_insn "extendsfdf2_tp"
- [(set (match_operand:DF 0 "register_operand" "=&f")
- (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "cvtsts %1,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn "extendsfdf2_no_tp"
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "@
- add%-%)%& $f31,%1,%0
- ld%, %0,%1"
- [(set_attr "type" "fadd,ld")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=&f")
- (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "cvt%-%,%)%& %R1,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "cvt%-%,%)%& %R1,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=&f")
- (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
- (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "div%,%)%& %R1,%R2,%0"
- [(set_attr "type" "fdivs")
- (set_attr "trap" "yes")])
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
- (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "div%,%)%& %R1,%R2,%0"
- [(set_attr "type" "fdivs")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=&f")
- (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "div%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fdivt")
- (set_attr "trap" "yes")])
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "div%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fdivt")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "div%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fdivt")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
- (float_extend:DF
- (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "div%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fdivt")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
- (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "div%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fdivt")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=&f")
- (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
- (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "mul%,%)%& %R1,%R2,%0"
- [(set_attr "type" "fmul")
- (set_attr "trap" "yes")])
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
- (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "mul%,%)%& %R1,%R2,%0"
- [(set_attr "type" "fmul")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=&f")
- (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "mul%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fmul")
- (set_attr "trap" "yes")])
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "mul%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fmul")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (float_extend:DF
- (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "mul%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fmul")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (float_extend:DF
- (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
- (float_extend:DF
- (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "mul%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fmul")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=&f")
- (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
- (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "sub%,%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
- (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "sub%,%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=&f")
- (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "sub%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP"
- "sub%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (float_extend:DF
- (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
- (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "sub%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
- (float_extend:DF
- (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "sub%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (float_extend:DF
- (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
- (float_extend:DF
- (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "sub%-%)%& %R1,%R2,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-;; Next are all the integer comparisons, and conditional moves and branches
-;; and some of the related define_expand's and define_split's.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operator:DI 1 "alpha_comparison_operator"
- [(match_operand:DI 2 "reg_or_0_operand" "rJ")
- (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
- ""
- "cmp%C1 %r2,%3,%0"
- [(set_attr "type" "icmp")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operator:DI 1 "alpha_swapped_comparison_operator"
- [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
- (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
- ""
- "cmp%c1 %r3,%2,%0"
- [(set_attr "type" "icmp")])
-
-;; This pattern exists so conditional moves of SImode values are handled.
-;; Comparisons are still done in DImode though.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
- (if_then_else:DI
- (match_operator 2 "signed_comparison_operator"
- [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
- (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
- (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
- (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
- "operands[3] == const0_rtx || operands[4] == const0_rtx"
- "@
- cmov%C2 %r3,%1,%0
- cmov%D2 %r3,%5,%0
- cmov%c2 %r4,%1,%0
- cmov%d2 %r4,%5,%0"
- [(set_attr "type" "cmov")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
- (if_then_else:DI
- (match_operator 2 "signed_comparison_operator"
- [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
- (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
- (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
- (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
- "operands[3] == const0_rtx || operands[4] == const0_rtx"
- "@
- cmov%C2 %r3,%1,%0
- cmov%D2 %r3,%5,%0
- cmov%c2 %r4,%1,%0
- cmov%d2 %r4,%5,%0"
- [(set_attr "type" "cmov")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (if_then_else:DI
- (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
- (const_int 1)
- (const_int 0))
- (const_int 0))
- (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
- (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
- ""
- "@
- cmovlbc %r2,%1,%0
- cmovlbs %r2,%3,%0"
- [(set_attr "type" "cmov")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (if_then_else:DI
- (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
- (const_int 1)
- (const_int 0))
- (const_int 0))
- (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
- (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
- ""
- "@
- cmovlbs %r2,%1,%0
- cmovlbc %r2,%3,%0"
- [(set_attr "type" "cmov")])
-
-;; This form is added since combine thinks that an IF_THEN_ELSE with both
-;; arms constant is a single insn, so it won't try to form it if combine
-;; knows they are really two insns. This occurs in divides by powers
-;; of two.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (if_then_else:DI
- (match_operator 2 "signed_comparison_operator"
- [(match_operand:DI 3 "reg_or_0_operand" "rJ")
- (const_int 0)])
- (plus:DI (match_dup 0)
- (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
- (match_dup 0)))
- (clobber (match_scratch:DI 4 "=&r"))]
- ""
- "addq %0,%1,%4\;cmov%C2 %r3,%4,%0"
- [(set_attr "type" "cmov")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI
- (match_operator 2 "signed_comparison_operator"
- [(match_operand:DI 3 "reg_or_0_operand" "")
- (const_int 0)])
- (plus:DI (match_dup 0)
- (match_operand:DI 1 "reg_or_8bit_operand" ""))
- (match_dup 0)))
- (clobber (match_operand:DI 4 "register_operand" ""))]
- ""
- [(set (match_dup 4) (plus:DI (match_dup 0) (match_dup 1)))
- (set (match_dup 0) (if_then_else:DI (match_op_dup 2
- [(match_dup 3)
- (const_int 0)])
- (match_dup 4) (match_dup 0)))]
- "")
-
-(define_split
- [(parallel
- [(set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI
- (match_operator 1 "comparison_operator"
- [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
- (const_int 1)
- (match_operand:DI 3 "const_int_operand" ""))
- (const_int 0)])
- (match_operand:DI 4 "reg_or_8bit_operand" "")
- (match_operand:DI 5 "reg_or_8bit_operand" "")))
- (clobber (match_operand:DI 6 "register_operand" ""))])]
- "INTVAL (operands[3]) != 0"
- [(set (match_dup 6)
- (lshiftrt:DI (match_dup 2) (match_dup 3)))
- (set (match_dup 0)
- (if_then_else:DI (match_op_dup 1
- [(zero_extract:DI (match_dup 6)
- (const_int 1)
- (const_int 0))
- (const_int 0)])
- (match_dup 4)
- (match_dup 5)))]
- "")
-
-;; For ABS, we have two choices, depending on whether the input and output
-;; registers are the same or not.
-(define_expand "absdi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (abs:DI (match_operand:DI 1 "register_operand" "")))]
- ""
- "
-{ if (rtx_equal_p (operands[0], operands[1]))
- emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
- else
- emit_insn (gen_absdi2_diff (operands[0], operands[1]));
-
- DONE;
-}")
-
-(define_expand "absdi2_same"
- [(set (match_operand:DI 1 "register_operand" "")
- (neg:DI (match_operand:DI 0 "register_operand" "")))
- (set (match_dup 0)
- (if_then_else:DI (ge (match_dup 0) (const_int 0))
- (match_dup 0)
- (match_dup 1)))]
- ""
- "")
-
-(define_expand "absdi2_diff"
- [(set (match_operand:DI 0 "register_operand" "")
- (neg:DI (match_operand:DI 1 "register_operand" "")))
- (set (match_dup 0)
- (if_then_else:DI (lt (match_dup 1) (const_int 0))
- (match_dup 0)
- (match_dup 1)))]
- ""
- "")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (abs:DI (match_dup 0)))
- (clobber (match_operand:DI 2 "register_operand" ""))]
- ""
- [(set (match_dup 1) (neg:DI (match_dup 0)))
- (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
- (match_dup 0) (match_dup 1)))]
- "")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (abs:DI (match_operand:DI 1 "register_operand" "")))]
- "! rtx_equal_p (operands[0], operands[1])"
- [(set (match_dup 0) (neg:DI (match_dup 1)))
- (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
- (match_dup 0) (match_dup 1)))]
- "")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (neg:DI (abs:DI (match_dup 0))))
- (clobber (match_operand:DI 2 "register_operand" ""))]
- ""
- [(set (match_dup 1) (neg:DI (match_dup 0)))
- (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
- (match_dup 0) (match_dup 1)))]
- "")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
- "! rtx_equal_p (operands[0], operands[1])"
- [(set (match_dup 0) (neg:DI (match_dup 1)))
- (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
- (match_dup 0) (match_dup 1)))]
- "")
-
-(define_expand "smaxdi3"
- [(set (match_dup 3)
- (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
- (match_operand:DI 2 "reg_or_8bit_operand" "")))
- (set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI (eq (match_dup 3) (const_int 0))
- (match_dup 1) (match_dup 2)))]
- ""
- "
-{ operands[3] = gen_reg_rtx (DImode);
-}")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
- (match_operand:DI 2 "reg_or_8bit_operand" "")))
- (clobber (match_operand:DI 3 "register_operand" ""))]
- "operands[2] != const0_rtx"
- [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
- (match_dup 1) (match_dup 2)))]
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (smax:DI (match_operand:DI 1 "register_operand" "0")
- (const_int 0)))]
- ""
- "cmovlt %0,0,%0"
- [(set_attr "type" "cmov")])
-
-(define_expand "smindi3"
- [(set (match_dup 3)
- (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
- (match_operand:DI 2 "reg_or_8bit_operand" "")))
- (set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI (ne (match_dup 3) (const_int 0))
- (match_dup 1) (match_dup 2)))]
- ""
- "
-{ operands[3] = gen_reg_rtx (DImode);
-}")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
- (match_operand:DI 2 "reg_or_8bit_operand" "")))
- (clobber (match_operand:DI 3 "register_operand" ""))]
- "operands[2] != const0_rtx"
- [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
- (match_dup 1) (match_dup 2)))]
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (smin:DI (match_operand:DI 1 "register_operand" "0")
- (const_int 0)))]
- ""
- "cmovgt %0,0,%0"
- [(set_attr "type" "cmov")])
-
-(define_expand "umaxdi3"
- [(set (match_dup 3)
- (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
- (match_operand:DI 2 "reg_or_8bit_operand" "")))
- (set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI (eq (match_dup 3) (const_int 0))
- (match_dup 1) (match_dup 2)))]
- ""
- "
-{ operands[3] = gen_reg_rtx (DImode);
-}")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
- (match_operand:DI 2 "reg_or_8bit_operand" "")))
- (clobber (match_operand:DI 3 "register_operand" ""))]
- "operands[2] != const0_rtx"
- [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
- (match_dup 1) (match_dup 2)))]
- "")
-
-(define_expand "umindi3"
- [(set (match_dup 3)
- (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
- (match_operand:DI 2 "reg_or_8bit_operand" "")))
- (set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI (ne (match_dup 3) (const_int 0))
- (match_dup 1) (match_dup 2)))]
- ""
- "
-{ operands[3] = gen_reg_rtx (DImode);
-}")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
- (match_operand:DI 2 "reg_or_8bit_operand" "")))
- (clobber (match_operand:DI 3 "register_operand" ""))]
- "operands[2] != const0_rtx"
- [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
- (match_dup 1) (match_dup 2)))]
- "")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 1 "signed_comparison_operator"
- [(match_operand:DI 2 "reg_or_0_operand" "rJ")
- (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "b%C1 %r2,%0"
- [(set_attr "type" "ibr")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 1 "signed_comparison_operator"
- [(const_int 0)
- (match_operand:DI 2 "register_operand" "r")])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "b%c1 %2,%0"
- [(set_attr "type" "ibr")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (const_int 1)
- (const_int 0))
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "blbs %r1,%0"
- [(set_attr "type" "ibr")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (const_int 1)
- (const_int 0))
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "blbc %r1,%0"
- [(set_attr "type" "ibr")])
-
-(define_split
- [(parallel
- [(set (pc)
- (if_then_else
- (match_operator 1 "comparison_operator"
- [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
- (const_int 1)
- (match_operand:DI 3 "const_int_operand" ""))
- (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))
- (clobber (match_operand:DI 4 "register_operand" ""))])]
- "INTVAL (operands[3]) != 0"
- [(set (match_dup 4)
- (lshiftrt:DI (match_dup 2) (match_dup 3)))
- (set (pc)
- (if_then_else (match_op_dup 1
- [(zero_extract:DI (match_dup 4)
- (const_int 1)
- (const_int 0))
- (const_int 0)])
- (label_ref (match_dup 0))
- (pc)))]
- "")
-
-;; The following are the corresponding floating-point insns. Recall
-;; we need to have variants that expand the arguments from SF mode
-;; to DFmode.
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=&f")
- (match_operator:DF 1 "alpha_comparison_operator"
- [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
- (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "cmp%-%C1%' %R2,%R3,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (match_operator:DF 1 "alpha_comparison_operator"
- [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
- (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "cmp%-%C1%' %R2,%R3,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (match_operator:DF 1 "alpha_comparison_operator"
- [(float_extend:DF
- (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
- (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "cmp%-%C1%' %R2,%R3,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (match_operator:DF 1 "alpha_comparison_operator"
- [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
- (float_extend:DF
- (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "cmp%-%C1%' %R2,%R3,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (match_operator:DF 1 "alpha_comparison_operator"
- [(float_extend:DF
- (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
- (float_extend:DF
- (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "cmp%-%C1%' %R2,%R3,%0"
- [(set_attr "type" "fadd")
- (set_attr "trap" "yes")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=&f,f")
- (if_then_else:DF
- (match_operator 3 "signed_comparison_operator"
- [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
- (match_operand:DF 2 "fp0_operand" "G,G")])
- (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
- (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "@
- fcmov%C3 %R4,%R1,%0
- fcmov%D3 %R4,%R5,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (if_then_else:DF
- (match_operator 3 "signed_comparison_operator"
- [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
- (match_operand:DF 2 "fp0_operand" "G,G")])
- (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
- (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "@
- fcmov%C3 %R4,%R1,%0
- fcmov%D3 %R4,%R5,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=&f,f")
- (if_then_else:SF
- (match_operator 3 "signed_comparison_operator"
- [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
- (match_operand:DF 2 "fp0_operand" "G,G")])
- (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
- (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
- "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
- "@
- fcmov%C3 %R4,%R1,%0
- fcmov%D3 %R4,%R5,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f,f")
- (if_then_else:SF
- (match_operator 3 "signed_comparison_operator"
- [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
- (match_operand:DF 2 "fp0_operand" "G,G")])
- (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
- (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "@
- fcmov%C3 %R4,%R1,%0
- fcmov%D3 %R4,%R5,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (if_then_else:DF
- (match_operator 3 "signed_comparison_operator"
- [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
- (match_operand:DF 2 "fp0_operand" "G,G")])
- (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
- (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "@
- fcmov%C3 %R4,%R1,%0
- fcmov%D3 %R4,%R5,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (if_then_else:DF
- (match_operator 3 "signed_comparison_operator"
- [(float_extend:DF
- (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
- (match_operand:DF 2 "fp0_operand" "G,G")])
- (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
- (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "@
- fcmov%C3 %R4,%R1,%0
- fcmov%D3 %R4,%R5,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f,f")
- (if_then_else:SF
- (match_operator 3 "signed_comparison_operator"
- [(float_extend:DF
- (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
- (match_operand:DF 2 "fp0_operand" "G,G")])
- (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
- (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "@
- fcmov%C3 %R4,%R1,%0
- fcmov%D3 %R4,%R5,%0"
- [(set_attr "type" "fadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (if_then_else:DF
- (match_operator 3 "signed_comparison_operator"
- [(float_extend:DF
- (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
- (match_operand:DF 2 "fp0_operand" "G,G")])
- (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
- (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
- "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
- "@
- fcmov%C3 %R4,%R1,%0
- fcmov%D3 %R4,%R5,%0"
- [(set_attr "type" "fadd")])
-
-(define_expand "maxdf3"
- [(set (match_dup 3)
- (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
- (match_operand:DF 2 "reg_or_fp0_operand" "")))
- (set (match_operand:DF 0 "register_operand" "")
- (if_then_else:DF (eq (match_dup 3) (match_dup 4))
- (match_dup 1) (match_dup 2)))]
- "TARGET_FP"
- "
-{ operands[3] = gen_reg_rtx (DFmode);
- operands[4] = CONST0_RTX (DFmode);
-}")
-
-(define_expand "mindf3"
- [(set (match_dup 3)
- (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
- (match_operand:DF 2 "reg_or_fp0_operand" "")))
- (set (match_operand:DF 0 "register_operand" "")
- (if_then_else:DF (ne (match_dup 3) (match_dup 4))
- (match_dup 1) (match_dup 2)))]
- "TARGET_FP"
- "
-{ operands[3] = gen_reg_rtx (DFmode);
- operands[4] = CONST0_RTX (DFmode);
-}")
-
-(define_expand "maxsf3"
- [(set (match_dup 3)
- (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
- (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
- (set (match_operand:SF 0 "register_operand" "")
- (if_then_else:SF (eq (match_dup 3) (match_dup 4))
- (match_dup 1) (match_dup 2)))]
- "TARGET_FP"
- "
-{ operands[3] = gen_reg_rtx (DFmode);
- operands[4] = CONST0_RTX (DFmode);
-}")
-
-(define_expand "minsf3"
- [(set (match_dup 3)
- (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
- (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
- (set (match_operand:SF 0 "register_operand" "")
- (if_then_else:SF (ne (match_dup 3) (match_dup 4))
- (match_dup 1) (match_dup 2)))]
- "TARGET_FP"
- "
-{ operands[3] = gen_reg_rtx (DFmode);
- operands[4] = CONST0_RTX (DFmode);
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 1 "signed_comparison_operator"
- [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
- (match_operand:DF 3 "fp0_operand" "G")])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- "TARGET_FP"
- "fb%C1 %R2,%0"
- [(set_attr "type" "fbr")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 1 "signed_comparison_operator"
- [(float_extend:DF
- (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
- (match_operand:DF 3 "fp0_operand" "G")])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- "TARGET_FP"
- "fb%C1 %R2,%0"
- [(set_attr "type" "fbr")])
-
-;; These are the main define_expand's used to make conditional branches
-;; and compares.
-
-(define_expand "cmpdf"
- [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
- (match_operand:DF 1 "reg_or_fp0_operand" "")))]
- "TARGET_FP"
- "
-{
- alpha_compare_op0 = operands[0];
- alpha_compare_op1 = operands[1];
- alpha_compare_fp_p = 1;
- DONE;
-}")
-
-(define_expand "cmpdi"
- [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
- (match_operand:DI 1 "reg_or_8bit_operand" "")))]
- ""
- "
-{
- alpha_compare_op0 = operands[0];
- alpha_compare_op1 = operands[1];
- alpha_compare_fp_p = 0;
- DONE;
-}")
-
-(define_expand "beq"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- enum machine_mode mode;
- enum rtx_code compare_code, branch_code;
-
- if (alpha_compare_fp_p)
- mode = DFmode, compare_code = EQ, branch_code = NE;
- else
- {
- mode = DImode, compare_code = MINUS, branch_code = EQ;
- if (GET_CODE (alpha_compare_op1) == CONST_INT)
- {
- compare_code = PLUS;
- alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
- }
- }
-
- operands[1] = gen_reg_rtx (mode);
- operands[2] = gen_rtx (compare_code, mode,
- alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (branch_code, VOIDmode,
- operands[1], CONST0_RTX (mode));
-}")
-
-(define_expand "bne"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- enum machine_mode mode;
- enum rtx_code compare_code, branch_code;
-
- if (alpha_compare_fp_p)
- mode = DFmode, compare_code = EQ, branch_code = EQ;
- else
- {
- mode = DImode, compare_code = MINUS, branch_code = NE;
- if (GET_CODE (alpha_compare_op1) == CONST_INT)
- {
- compare_code = PLUS;
- alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
- }
- }
-
- operands[1] = gen_reg_rtx (mode);
- operands[2] = gen_rtx (compare_code, mode,
- alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (branch_code, VOIDmode,
- operands[1], CONST0_RTX (mode));
-}")
-
-(define_expand "blt"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
- operands[1] = gen_reg_rtx (mode);
- operands[2] = gen_rtx (LT, mode, alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
-}")
-
-(define_expand "ble"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
- operands[1] = gen_reg_rtx (mode);
- operands[2] = gen_rtx (LE, mode, alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
-}")
-
-(define_expand "bgt"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- {
- operands[1] = gen_reg_rtx (DFmode);
- operands[2] = gen_rtx (LT, DFmode, alpha_compare_op1, alpha_compare_op0);
- operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
- }
- else
- {
- operands[1] = gen_reg_rtx (DImode);
- operands[2] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
- }
-}")
-
-(define_expand "bge"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- {
- operands[1] = gen_reg_rtx (DFmode);
- operands[2] = gen_rtx (LE, DFmode, alpha_compare_op1, alpha_compare_op0);
- operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
- }
- else
- {
- operands[1] = gen_reg_rtx (DImode);
- operands[2] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
- }
-}")
-
-(define_expand "bltu"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (DImode);
- operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
-}")
-
-(define_expand "bleu"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (DImode);
- operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
-}")
-
-(define_expand "bgtu"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (DImode);
- operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
-}")
-
-(define_expand "bgeu"
- [(set (match_dup 1) (match_dup 2))
- (set (pc)
- (if_then_else (match_dup 3)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_reg_rtx (DImode);
- operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
- operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
-}")
-
-(define_expand "seq"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
-}")
-
-(define_expand "sne"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))
- (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
-}")
-
-(define_expand "slt"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
-}")
-
-(define_expand "sle"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
-}")
-
-(define_expand "sgt"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (LT, DImode, force_reg (DImode, alpha_compare_op1),
- alpha_compare_op0);
-}")
-
-(define_expand "sge"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (LE, DImode, force_reg (DImode, alpha_compare_op1),
- alpha_compare_op0);
-}")
-
-(define_expand "sltu"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
-}")
-
-(define_expand "sleu"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
-}")
-
-(define_expand "sgtu"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (LTU, DImode, force_reg (DImode, alpha_compare_op1),
- alpha_compare_op0);
-}")
-
-(define_expand "sgeu"
- [(set (match_operand:DI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (alpha_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (LEU, DImode, force_reg (DImode, alpha_compare_op1),
- alpha_compare_op0);
-}")
-
-;; These are the main define_expand's used to make conditional moves.
-
-(define_expand "movsicc"
- [(set (match_operand:SI 0 "register_operand" "")
- (if_then_else:DI (match_operand 1 "comparison_operator" "")
- (match_operand:SI 2 "reg_or_8bit_operand" "")
- (match_operand:SI 3 "reg_or_8bit_operand" "")))]
- ""
- "
-{
- if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
- FAIL;
-}")
-
-(define_expand "movdicc"
- [(set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI (match_operand 1 "comparison_operator" "")
- (match_operand:DI 2 "reg_or_8bit_operand" "")
- (match_operand:DI 3 "reg_or_8bit_operand" "")))]
- ""
- "
-{
- if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
- FAIL;
-}")
-
-(define_expand "movsfcc"
- [(set (match_operand:SF 0 "register_operand" "")
- (if_then_else:SF (match_operand 1 "comparison_operator" "")
- (match_operand:SF 2 "reg_or_8bit_operand" "")
- (match_operand:SF 3 "reg_or_8bit_operand" "")))]
- ""
- "
-{
- if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
- FAIL;
-}")
-
-(define_expand "movdfcc"
- [(set (match_operand:DF 0 "register_operand" "")
- (if_then_else:DF (match_operand 1 "comparison_operator" "")
- (match_operand:DF 2 "reg_or_8bit_operand" "")
- (match_operand:DF 3 "reg_or_8bit_operand" "")))]
- ""
- "
-{
- if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
- FAIL;
-}")
-
-;; These define_split definitions are used in cases when comparisons have
-;; not be stated in the correct way and we need to reverse the second
-;; comparison. For example, x >= 7 has to be done as x < 6 with the
-;; comparison that tests the result being reversed. We have one define_split
-;; for each use of a comparison. They do not match valid insns and need
-;; not generate valid insns.
-;;
-;; We can also handle equality comparisons (and inequality comparisons in
-;; cases where the resulting add cannot overflow) by doing an add followed by
-;; a comparison with zero. This is faster since the addition takes one
-;; less cycle than a compare when feeding into a conditional move.
-;; For this case, we also have an SImode pattern since we can merge the add
-;; and sign extend and the order doesn't matter.
-;;
-;; We do not do this for floating-point, since it isn't clear how the "wrong"
-;; operation could have been generated.
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI
- (match_operator 1 "comparison_operator"
- [(match_operand:DI 2 "reg_or_0_operand" "")
- (match_operand:DI 3 "reg_or_cint_operand" "")])
- (match_operand:DI 4 "reg_or_cint_operand" "")
- (match_operand:DI 5 "reg_or_cint_operand" "")))
- (clobber (match_operand:DI 6 "register_operand" ""))]
- "operands[3] != const0_rtx"
- [(set (match_dup 6) (match_dup 7))
- (set (match_dup 0)
- (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
- "
-{ enum rtx_code code = GET_CODE (operands[1]);
- int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
-
- /* If we are comparing for equality with a constant and that constant
- appears in the arm when the register equals the constant, use the
- register since that is more likely to match (and to produce better code
- if both would). */
-
- if (code == EQ && GET_CODE (operands[3]) == CONST_INT
- && rtx_equal_p (operands[4], operands[3]))
- operands[4] = operands[2];
-
- else if (code == NE && GET_CODE (operands[3]) == CONST_INT
- && rtx_equal_p (operands[5], operands[3]))
- operands[5] = operands[2];
-
- if (code == NE || code == EQ
- || (extended_count (operands[2], DImode, unsignedp) >= 1
- && extended_count (operands[3], DImode, unsignedp) >= 1))
- {
- if (GET_CODE (operands[3]) == CONST_INT)
- operands[7] = gen_rtx (PLUS, DImode, operands[2],
- GEN_INT (- INTVAL (operands[3])));
- else
- operands[7] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
-
- operands[8] = gen_rtx (code, VOIDmode, operands[6], const0_rtx);
- }
-
- else if (code == EQ || code == LE || code == LT
- || code == LEU || code == LTU)
- {
- operands[7] = gen_rtx (code, DImode, operands[2], operands[3]);
- operands[8] = gen_rtx (NE, VOIDmode, operands[6], const0_rtx);
- }
- else
- {
- operands[7] = gen_rtx (reverse_condition (code), DImode, operands[2],
- operands[3]);
- operands[8] = gen_rtx (EQ, VOIDmode, operands[6], const0_rtx);
- }
-}")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI
- (match_operator 1 "comparison_operator"
- [(match_operand:SI 2 "reg_or_0_operand" "")
- (match_operand:SI 3 "reg_or_cint_operand" "")])
- (match_operand:DI 4 "reg_or_8bit_operand" "")
- (match_operand:DI 5 "reg_or_8bit_operand" "")))
- (clobber (match_operand:DI 6 "register_operand" ""))]
- "operands[3] != const0_rtx
- && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
- [(set (match_dup 6) (match_dup 7))
- (set (match_dup 0)
- (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
- "
-{ enum rtx_code code = GET_CODE (operands[1]);
- int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
- rtx tem;
-
- if ((code != NE && code != EQ
- && ! (extended_count (operands[2], DImode, unsignedp) >= 1
- && extended_count (operands[3], DImode, unsignedp) >= 1)))
- FAIL;
-
- if (GET_CODE (operands[3]) == CONST_INT)
- tem = gen_rtx (PLUS, SImode, operands[2],
- GEN_INT (- INTVAL (operands[3])));
- else
- tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
-
- operands[7] = gen_rtx (SIGN_EXTEND, DImode, tem);
- operands[8] = gen_rtx (GET_CODE (operands[1]), VOIDmode, operands[6],
- const0_rtx);
-}")
-
-(define_split
- [(set (pc)
- (if_then_else
- (match_operator 1 "comparison_operator"
- [(match_operand:DI 2 "reg_or_0_operand" "")
- (match_operand:DI 3 "reg_or_cint_operand" "")])
- (label_ref (match_operand 0 "" ""))
- (pc)))
- (clobber (match_operand:DI 4 "register_operand" ""))]
- "operands[3] != const0_rtx"
- [(set (match_dup 4) (match_dup 5))
- (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
- "
-{ enum rtx_code code = GET_CODE (operands[1]);
- int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
-
- if (code == NE || code == EQ
- || (extended_count (operands[2], DImode, unsignedp) >= 1
- && extended_count (operands[3], DImode, unsignedp) >= 1))
- {
- if (GET_CODE (operands[3]) == CONST_INT)
- operands[5] = gen_rtx (PLUS, DImode, operands[2],
- GEN_INT (- INTVAL (operands[3])));
- else
- operands[5] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
-
- operands[6] = gen_rtx (code, VOIDmode, operands[4], const0_rtx);
- }
-
- else if (code == EQ || code == LE || code == LT
- || code == LEU || code == LTU)
- {
- operands[5] = gen_rtx (code, DImode, operands[2], operands[3]);
- operands[6] = gen_rtx (NE, VOIDmode, operands[4], const0_rtx);
- }
- else
- {
- operands[5] = gen_rtx (reverse_condition (code), DImode, operands[2],
- operands[3]);
- operands[6] = gen_rtx (EQ, VOIDmode, operands[4], const0_rtx);
- }
-}")
-
-(define_split
- [(set (pc)
- (if_then_else
- (match_operator 1 "comparison_operator"
- [(match_operand:SI 2 "reg_or_0_operand" "")
- (match_operand:SI 3 "const_int_operand" "")])
- (label_ref (match_operand 0 "" ""))
- (pc)))
- (clobber (match_operand:DI 4 "register_operand" ""))]
- "operands[3] != const0_rtx
- && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
- [(set (match_dup 4) (match_dup 5))
- (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
- "
-{ rtx tem;
-
- if (GET_CODE (operands[3]) == CONST_INT)
- tem = gen_rtx (PLUS, SImode, operands[2],
- GEN_INT (- INTVAL (operands[3])));
- else
- tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
-
- operands[5] = gen_rtx (SIGN_EXTEND, DImode, tem);
- operands[6] = gen_rtx (GET_CODE (operands[1]), VOIDmode,
- operands[4], const0_rtx);
-}")
-
-;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
-;; This eliminates one, and sometimes two, insns when the AND can be done
-;; with a ZAP.
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (match_operator 1 "comparison_operator"
- [(match_operand:DI 2 "register_operand" "")
- (match_operand:DI 3 "const_int_operand" "")]))
- (clobber (match_operand:DI 4 "register_operand" ""))]
- "exact_log2 (INTVAL (operands[3]) + 1) >= 0
- && (GET_CODE (operands[1]) == GTU
- || GET_CODE (operands[1]) == LEU
- || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
- && extended_count (operands[2], DImode, 1) > 0))"
- [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
- (set (match_dup 0) (match_dup 6))]
- "
-{
- operands[5] = GEN_INT (~ INTVAL (operands[3]));
- operands[6] = gen_rtx (((GET_CODE (operands[1]) == GTU
- || GET_CODE (operands[1]) == GT)
- ? NE : EQ),
- DImode, operands[4], const0_rtx);
-}")
-
-;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
-;; work differently, so we have different patterns for each.
-
-(define_expand "call"
- [(use (match_operand:DI 0 "" ""))
- (use (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))
- (use (match_operand 3 "" ""))]
- ""
- "
-{ if (TARGET_WINDOWS_NT)
- emit_call_insn (gen_call_nt (operands[0], operands[1]));
- else if (TARGET_OPEN_VMS)
- emit_call_insn (gen_call_vms (operands[0], operands[2]));
- else
- emit_call_insn (gen_call_osf (operands[0], operands[1]));
-
- DONE;
-}")
-
-(define_expand "call_osf"
- [(parallel [(call (mem:DI (match_operand 0 "" ""))
- (match_operand 1 "" ""))
- (clobber (reg:DI 27))
- (clobber (reg:DI 26))])]
- ""
- "
-{ if (GET_CODE (operands[0]) != MEM)
- abort ();
-
- operands[0] = XEXP (operands[0], 0);
-
- if (GET_CODE (operands[0]) != SYMBOL_REF
- && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
- {
- rtx tem = gen_rtx (REG, DImode, 27);
- emit_move_insn (tem, operands[0]);
- operands[0] = tem;
- }
-}")
-
-(define_expand "call_nt"
- [(parallel [(call (mem:DI (match_operand:DI 0 "" ""))
- (match_operand 1 "" ""))
- (clobber (reg:DI 26))])]
- ""
- "
-{ if (GET_CODE (operands[0]) != MEM)
- abort ();
- operands[0] = XEXP (operands[0], 0);
-
- if (GET_CODE (operands[1]) != SYMBOL_REF
- && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
- {
- rtx tem = gen_rtx (REG, DImode, 27);
- emit_move_insn (tem, operands[1]);
- operands[1] = tem;
- }
-}")
-
-;;
-;; call openvms/alpha
-;; op 0: symbol ref for called function
-;; op 1: next_arg_reg (argument information value for R25)
-;;
-(define_expand "call_vms"
- [(parallel [(call (mem:DI (match_operand 0 "" ""))
- (match_operand 1 "" ""))
- (use (match_dup 2))
- (use (reg:DI 25))
- (use (reg:DI 26))
- (clobber (reg:DI 27))])]
- ""
- "
-{ if (GET_CODE (operands[0]) != MEM)
- abort ();
-
- operands[0] = XEXP (operands[0], 0);
-
- /* Always load AI with argument information, then handle symbolic and
- indirect call differently. Load RA and set operands[2] to PV in
- both cases. */
-
- emit_move_insn (gen_rtx (REG, DImode, 25), operands[1]);
- if (GET_CODE (operands[0]) == SYMBOL_REF)
- {
- extern char *savealloc ();
- char *symbol = XSTR (operands[0], 0);
- char *linksym = savealloc (strlen (symbol) + 5);
- rtx linkage;
-
- alpha_need_linkage (symbol, 0);
-
- strcpy (linksym, symbol);
- strcat (linksym, \"..lk\");
- linkage = gen_rtx (SYMBOL_REF, Pmode, linksym);
-
- emit_move_insn (gen_rtx (REG, Pmode, 26), gen_rtx (MEM, Pmode, linkage));
-
- operands[2]
- = validize_mem (gen_rtx (MEM, Pmode, plus_constant (linkage, 8)));
- }
- else
- {
- emit_move_insn (gen_rtx (REG, Pmode, 26),
- gen_rtx (MEM, Pmode, plus_constant (operands[0], 8)));
-
- operands[2] = operands[0];
- }
-
-}")
-
-(define_expand "call_value"
- [(use (match_operand 0 "" ""))
- (use (match_operand:DI 1 "" ""))
- (use (match_operand 2 "" ""))
- (use (match_operand 3 "" ""))
- (use (match_operand 4 "" ""))]
- ""
- "
-{ if (TARGET_WINDOWS_NT)
- emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
- else if (TARGET_OPEN_VMS)
- emit_call_insn (gen_call_value_vms (operands[0], operands[1],
- operands[3]));
- else
- emit_call_insn (gen_call_value_osf (operands[0], operands[1],
- operands[2]));
- DONE;
-}")
-
-(define_expand "call_value_osf"
- [(parallel [(set (match_operand 0 "" "")
- (call (mem:DI (match_operand 1 "" ""))
- (match_operand 2 "" "")))
- (clobber (reg:DI 27))
- (clobber (reg:DI 26))])]
- ""
- "
-{ if (GET_CODE (operands[1]) != MEM)
- abort ();
-
- operands[1] = XEXP (operands[1], 0);
-
- if (GET_CODE (operands[1]) != SYMBOL_REF
- && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
- {
- rtx tem = gen_rtx (REG, DImode, 27);
- emit_move_insn (tem, operands[1]);
- operands[1] = tem;
- }
-}")
-
-(define_expand "call_value_nt"
- [(parallel [(set (match_operand 0 "" "")
- (call (mem:DI (match_operand:DI 1 "" ""))
- (match_operand 2 "" "")))
- (clobber (reg:DI 26))])]
- ""
- "
-{ if (GET_CODE (operands[1]) != MEM)
- abort ();
-
- operands[1] = XEXP (operands[1], 0);
- if (GET_CODE (operands[1]) != SYMBOL_REF
- && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
- {
- rtx tem = gen_rtx (REG, DImode, 27);
- emit_move_insn (tem, operands[1]);
- operands[1] = tem;
- }
-}")
-
-(define_expand "call_value_vms"
- [(parallel [(set (match_operand 0 "" "")
- (call (mem:DI (match_operand:DI 1 "" ""))
- (match_operand 2 "" "")))
- (use (match_dup 3))
- (use (reg:DI 25))
- (use (reg:DI 26))
- (clobber (reg:DI 27))])]
- ""
- "
-{ if (GET_CODE (operands[1]) != MEM)
- abort ();
-
- operands[1] = XEXP (operands[1], 0);
-
- /* Always load AI with argument information, then handle symbolic and
- indirect call differently. Load RA and set operands[3] to PV in
- both cases. */
-
- emit_move_insn (gen_rtx (REG, DImode, 25), operands[2]);
- if (GET_CODE (operands[1]) == SYMBOL_REF)
- {
- extern char *savealloc ();
- char *symbol = XSTR (operands[1], 0);
- char *linksym = savealloc (strlen (symbol) + 5);
- rtx linkage;
-
- alpha_need_linkage (symbol, 0);
- strcpy (linksym, symbol);
- strcat (linksym, \"..lk\");
- linkage = gen_rtx (SYMBOL_REF, Pmode, linksym);
-
- emit_move_insn (gen_rtx (REG, Pmode, 26), gen_rtx (MEM, Pmode, linkage));
-
- operands[3]
- = validize_mem (gen_rtx (MEM, Pmode, plus_constant (linkage, 8)));
- }
- else
- {
- emit_move_insn (gen_rtx (REG, Pmode, 26),
- gen_rtx (MEM, Pmode, plus_constant (operands[1], 8)));
-
- operands[3] = operands[1];
- }
-}")
-
-(define_insn ""
- [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
- (match_operand 1 "" ""))
- (clobber (reg:DI 27))
- (clobber (reg:DI 26))]
- "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && alpha_tp == ALPHA_TP_INSN"
- "@
- jsr $26,($27),0\;trapb\;ldgp $29,4($26)
- bsr $26,%0..ng\;trapb
- jsr $26,%0\;trapb\;ldgp $29,4($26)"
- [(set_attr "type" "jsr,jsr,ibr")])
-
-(define_insn ""
- [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
- (match_operand 1 "" ""))
- (clobber (reg:DI 27))
- (clobber (reg:DI 26))]
- "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
- "@
- jsr $26,($27),0\;ldgp $29,0($26)
- bsr $26,%0..ng
- jsr $26,%0\;ldgp $29,0($26)"
- [(set_attr "type" "jsr,jsr,ibr")])
-
-(define_insn ""
- [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
- (match_operand 1 "" ""))
- (clobber (reg:DI 26))]
- "TARGET_WINDOWS_NT"
- "@
- jsr $26,(%0)
- bsr $26,%0"
- [(set_attr "type" "jsr")])
-
-(define_insn ""
- [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
- (match_operand 1 "" ""))
- (use (match_operand:DI 2 "general_operand" "r,m"))
- (use (reg:DI 25))
- (use (reg:DI 26))
- (clobber (reg:DI 27))]
- "TARGET_OPEN_VMS"
- "@
- bis %2,%2,$27\;jsr $26,0\;ldq $27,0($29)
- ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
- [(set_attr "type" "jsr")])
-
-(define_insn ""
- [(set (match_operand 0 "register_operand" "=rf,rf,rf")
- (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
- (match_operand 2 "" "")))
- (clobber (reg:DI 27))
- (clobber (reg:DI 26))]
- "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && alpha_tp == ALPHA_TP_INSN"
- "@
- jsr $26,($27),0\;trapb\;ldgp $29,4($26)
- bsr $26,%1..ng\;trapb
- jsr $26,%1\;trapb\;ldgp $29,4($26)"
- [(set_attr "type" "jsr,jsr,ibr")])
-
-(define_insn ""
- [(set (match_operand 0 "register_operand" "=rf,rf,rf")
- (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
- (match_operand 2 "" "")))
- (clobber (reg:DI 27))
- (clobber (reg:DI 26))]
- "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
- "@
- jsr $26,($27),0\;ldgp $29,0($26)
- bsr $26,%1..ng
- jsr $26,%1\;ldgp $29,0($26)"
- [(set_attr "type" "jsr,jsr,ibr")])
-
-(define_insn ""
- [(set (match_operand 0 "register_operand" "=rf,rf")
- (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
- (match_operand 2 "" "")))
- (clobber (reg:DI 26))]
- "TARGET_WINDOWS_NT"
- "@
- jsr $26,(%1)
- bsr $26,%1"
- [(set_attr "type" "jsr")])
-
-(define_insn ""
- [(set (match_operand 0 "register_operand" "")
- (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
- (match_operand 2 "" "")))
- (use (match_operand:DI 3 "general_operand" "r,m"))
- (use (reg:DI 25))
- (use (reg:DI 26))
- (clobber (reg:DI 27))]
- "TARGET_OPEN_VMS"
- "@
- bis %3,%3,$27\;jsr $26,0\;ldq $27,0($29)
- ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
- [(set_attr "type" "jsr")])
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 1)]
- ""
- "")
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "br $31,%l0"
- [(set_attr "type" "ibr")])
-
-(define_insn "return"
- [(return)]
- "direct_return ()"
- "ret $31,($26),1"
- [(set_attr "type" "ibr")])
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
- ""
- "jmp $31,(%0),0"
- [(set_attr "type" "ibr")])
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "bis $31,$31,$31"
- [(set_attr "type" "ilog")])
-
-(define_expand "tablejump"
- [(use (match_operand:SI 0 "register_operand" ""))
- (use (match_operand:SI 1 "" ""))]
- ""
- "
-{
- if (TARGET_WINDOWS_NT)
- emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
- else if (TARGET_OPEN_VMS)
- emit_jump_insn (gen_tablejump_vms (operands[0], operands[1]));
- else
- emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
-
- DONE;
-}")
-
-(define_expand "tablejump_osf"
- [(set (match_dup 3)
- (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
- (parallel [(set (pc)
- (plus:DI (match_dup 3)
- (label_ref:DI (match_operand 1 "" ""))))
- (clobber (match_scratch:DI 2 "=r"))])]
- ""
- "
-{ operands[3] = gen_reg_rtx (DImode); }")
-
-(define_expand "tablejump_nt"
- [(set (match_dup 3)
- (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
- (parallel [(set (pc)
- (match_dup 3))
- (use (label_ref (match_operand 1 "" "")))])]
- ""
- "
-{ operands[3] = gen_reg_rtx (DImode); }")
-
-;;
-;; tablejump, openVMS way
-;; op 0: offset
-;; op 1: label preceding jump-table
-;;
-(define_expand "tablejump_vms"
- [(set (match_dup 2)
- (match_operand:DI 0 "register_operand" ""))
- (set (pc)
- (plus:DI (match_dup 2)
- (label_ref:DI (match_operand 1 "" ""))))]
- ""
- "
-{ operands[2] = gen_reg_rtx (DImode); }")
-
-(define_insn ""
- [(set (pc)
- (plus:DI (match_operand:DI 0 "register_operand" "r")
- (label_ref:DI (match_operand 1 "" ""))))
- (clobber (match_scratch:DI 2 "=r"))]
- "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && next_active_insn (insn) != 0
- && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
- && PREV_INSN (next_active_insn (insn)) == operands[1]"
- "*
-{ rtx best_label = 0;
- rtx jump_table_insn = next_active_insn (operands[1]);
-
- if (GET_CODE (jump_table_insn) == JUMP_INSN
- && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
- {
- rtx jump_table = PATTERN (jump_table_insn);
- int n_labels = XVECLEN (jump_table, 1);
- int best_count = -1;
- int i, j;
-
- for (i = 0; i < n_labels; i++)
- {
- int count = 1;
-
- for (j = i + 1; j < n_labels; j++)
- if (XEXP (XVECEXP (jump_table, 1, i), 0)
- == XEXP (XVECEXP (jump_table, 1, j), 0))
- count++;
-
- if (count > best_count)
- best_count = count, best_label = XVECEXP (jump_table, 1, i);
- }
- }
-
- if (best_label)
- {
- operands[3] = best_label;
- return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
- }
- else
- return \"addq %0,$29,%2\;jmp $31,(%2),0\";
-}"
- [(set_attr "type" "ibr")])
-
-(define_insn ""
- [(set (pc)
- (match_operand:DI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- "TARGET_WINDOWS_NT && next_active_insn (insn) != 0
- && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
- && PREV_INSN (next_active_insn (insn)) == operands[1]"
- "*
-{ rtx best_label = 0;
- rtx jump_table_insn = next_active_insn (operands[1]);
-
- if (GET_CODE (jump_table_insn) == JUMP_INSN
- && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
- {
- rtx jump_table = PATTERN (jump_table_insn);
- int n_labels = XVECLEN (jump_table, 1);
- int best_count = -1;
- int i, j;
-
- for (i = 0; i < n_labels; i++)
- {
- int count = 1;
-
- for (j = i + 1; j < n_labels; j++)
- if (XEXP (XVECEXP (jump_table, 1, i), 0)
- == XEXP (XVECEXP (jump_table, 1, j), 0))
- count++;
-
- if (count > best_count)
- best_count = count, best_label = XVECEXP (jump_table, 1, i);
- }
- }
-
- if (best_label)
- {
- operands[2] = best_label;
- return \"jmp $31,(%0),%2\";
- }
- else
- return \"jmp $31,(%0),0\";
-}"
- [(set_attr "type" "ibr")])
-
-;;
-;; op 0 is table offset
-;; op 1 is table label
-;;
-
-(define_insn ""
- [(set (pc)
- (plus:DI (match_operand 0 "register_operand" "r")
- (label_ref (match_operand 1 "" ""))))]
- "TARGET_OPEN_VMS"
- "jmp $31,(%0),0"
- [(set_attr "type" "ibr")])
-
-;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
-;; want to have to include pal.h in our .s file.
-(define_insn ""
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "call_pal 0x86"
- [(set_attr "type" "isubr")])
-
-;; Finally, we have the basic data motion insns. The byte and word insns
-;; are done via define_expand. Start with the floating-point insns, since
-;; they are simpler.
-
-(define_insn ""
- [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
- (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
- "register_operand (operands[0], SFmode)
- || reg_or_fp0_operand (operands[1], SFmode)"
- "@
- bis %r1,%r1,%0
- ldl %0,%1
- stl %r1,%0
- cpys %1,%1,%0
- cpys $f31,$f31,%0
- ld%, %0,%1
- st%, %R1,%0"
- [(set_attr "type" "ilog,ld,st,fcpys,fcpys,ld,st")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
- (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
- "register_operand (operands[0], DFmode)
- || reg_or_fp0_operand (operands[1], DFmode)"
- "@
- bis %r1,%r1,%0
- ldq %0,%1
- stq %r1,%0
- cpys %1,%1,%0
- cpys $f31,$f31,%0
- ld%- %0,%1
- st%- %R1,%0"
- [(set_attr "type" "ilog,ld,st,fcpys,fcpys,ld,st")])
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "nonimmediate_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM
- && ! reg_or_fp0_operand (operands[1], SFmode))
- operands[1] = force_reg (SFmode, operands[1]);
-}")
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "nonimmediate_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM
- && ! reg_or_fp0_operand (operands[1], DFmode))
- operands[1] = force_reg (DFmode, operands[1]);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m")
- (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG"))]
- "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS
- && (register_operand (operands[0], SImode)
- || reg_or_0_operand (operands[1], SImode))"
- "@
- bis %1,%1,%0
- bis $31,$31,%0
- bis $31,%1,%0
- lda %0,%1
- ldah %0,%h1
- ldl %0,%1
- stl %r1,%0
- cpys %1,%1,%0
- cpys $f31,$f31,%0
- lds %0,%1
- sts %R1,%0"
- [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ld,st,fcpys,fcpys,ld,st")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,f,f,f,m")
- (match_operand:SI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,m,fG"))]
- "(TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
- && (register_operand (operands[0], SImode)
- || reg_or_0_operand (operands[1], SImode))"
- "@
- bis %1,%1,%0
- bis $31,$31,%0
- bis $31,%1,%0
- lda %0,%1
- ldah %0,%h1
- lda %0,%1
- ldl %0,%1
- stl %r1,%0
- cpys %1,%1,%0
- cpys $f31,$f31,%0
- lds %0,%1
- sts %R1,%0"
- [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ld,st,fcpys,fcpys,ld,st")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
- (match_operand:HI 1 "input_operand" "r,J,I,n,f,J"))]
- "! TARGET_BYTE_OPS
- && (register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode))"
- "@
- bis %1,%1,%0
- bis $31,$31,%0
- bis $31,%1,%0
- lda %0,%L1
- cpys %1,%1,%0
- cpys $f31,$f31,%0"
- [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
- (match_operand:HI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
- "TARGET_BYTE_OPS
- && (register_operand (operands[0], HImode)
- || reg_or_0_operand (operands[1], HImode))"
- "@
- bis %1,%1,%0
- bis $31,$31,%0
- bis $31,%1,%0
- lda %0,%L1
- ldwu %0,%1
- stw %r1,%0
- cpys %1,%1,%0
- cpys $f31,$f31,%0"
- [(set_attr "type" "ilog,ilog,ilog,iadd,ld,st,fcpys,fcpys")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
- (match_operand:QI 1 "input_operand" "r,J,I,n,f,J"))]
- "! TARGET_BYTE_OPS
- && (register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode))"
- "@
- bis %1,%1,%0
- bis $31,$31,%0
- bis $31,%1,%0
- lda %0,%L1
- cpys %1,%1,%0
- cpys $f31,$f31,%0"
- [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
- (match_operand:QI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
- "TARGET_BYTE_OPS
- && (register_operand (operands[0], QImode)
- || reg_or_0_operand (operands[1], QImode))"
- "@
- bis %1,%1,%0
- bis $31,$31,%0
- bis $31,%1,%0
- lda %0,%L1
- ldbu %0,%1
- stb %r1,%0
- cpys %1,%1,%0
- cpys $f31,$f31,%0"
- [(set_attr "type" "ilog,ilog,ilog,iadd,ld,st,fcpys,fcpys")])
-
-;; We do two major things here: handle mem->mem and construct long
-;; constants.
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM
- && ! reg_or_0_operand (operands[1], SImode))
- operands[1] = force_reg (SImode, operands[1]);
-
- if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
- ;
- else if (GET_CODE (operands[1]) == CONST_INT)
- {
- operands[1]
- = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
- if (rtx_equal_p (operands[0], operands[1]))
- DONE;
- }
-}")
-
-;; Split a load of a large constant into the appropriate two-insn
-;; sequence.
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "const_int_operand" ""))]
- "! add_operand (operands[1], SImode)"
- [(set (match_dup 0) (match_dup 2))
- (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
- "
-{ rtx tem
- = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
-
- if (tem == operands[0])
- DONE;
- else
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q")
- (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG"))]
- "register_operand (operands[0], DImode)
- || reg_or_0_operand (operands[1], DImode)"
- "@
- bis %1,%1,%0
- bis $31,$31,%0
- bis $31,%1,%0
- lda %0,%1
- ldah %0,%h1
- lda %0,%1
- ldq%A1 %0,%1
- stq%A0 %r1,%0
- cpys %1,%1,%0
- cpys $f31,$f31,%0
- ldt %0,%1
- stt %R1,%0"
- [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ld,st,fcpys,fcpys,ld,st")])
-
-;; We do three major things here: handle mem->mem, put 64-bit constants in
-;; memory, and construct long 32-bit constants.
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{
- rtx tem;
-
- if (GET_CODE (operands[0]) == MEM
- && ! reg_or_0_operand (operands[1], DImode))
- operands[1] = force_reg (DImode, operands[1]);
-
- if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
- ;
- else if (GET_CODE (operands[1]) == CONST_INT
- && (tem = alpha_emit_set_const (operands[0], DImode,
- INTVAL (operands[1]), 3)) != 0)
- {
- if (rtx_equal_p (tem, operands[0]))
- DONE;
- else
- operands[1] = tem;
- }
- else if (TARGET_BUILD_CONSTANTS
- && GET_CODE (operands[1]) == CONST_INT)
- {
-#if HOST_BITS_PER_WIDE_INT == 64
- tem = alpha_emit_set_long_const (operands[0], INTVAL (operands[1]));
- if (rtx_equal_p (tem, operands[0]))
- DONE;
- else
- operands[1] = tem;
-#else
- abort();
-#endif
- }
- else if (CONSTANT_P (operands[1]))
- {
- operands[1] = force_const_mem (DImode, operands[1]);
- if (reload_in_progress)
- {
- emit_move_insn (operands[0], XEXP (operands[1], 0));
- operands[1] = copy_rtx (operands[1]);
- XEXP (operands[1], 0) = operands[0];
- }
- else
- operands[1] = validize_mem (operands[1]);
- }
- else
- abort ();
-}")
-
-;; Split a load of a large constant into the appropriate two-insn
-;; sequence.
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (match_operand:DI 1 "const_int_operand" ""))]
- "! add_operand (operands[1], DImode)"
- [(set (match_dup 0) (match_dup 2))
- (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
- "
-{ rtx tem
- = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
-
- if (tem == operands[0])
- DONE;
- else
- FAIL;
-}")
-
-;; These are the partial-word cases.
-;;
-;; First we have the code to load an aligned word. Operand 0 is the register
-;; in which to place the result. It's mode is QImode or HImode. Operand 1
-;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
-;; number of bits within the word that the value is. Operand 3 is an SImode
-;; scratch register. If operand 0 is a hard register, operand 3 may be the
-;; same register. It is allowed to conflict with operand 1 as well.
-
-(define_expand "aligned_loadqi"
- [(set (match_operand:SI 3 "register_operand" "")
- (match_operand:SI 1 "memory_operand" ""))
- (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
- (zero_extract:DI (subreg:DI (match_dup 3) 0)
- (const_int 8)
- (match_operand:DI 2 "const_int_operand" "")))]
-
- ""
- "")
-
-(define_expand "aligned_loadhi"
- [(set (match_operand:SI 3 "register_operand" "")
- (match_operand:SI 1 "memory_operand" ""))
- (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
- (zero_extract:DI (subreg:DI (match_dup 3) 0)
- (const_int 16)
- (match_operand:DI 2 "const_int_operand" "")))]
-
- ""
- "")
-
-;; Similar for unaligned loads, where we use the sequence from the
-;; Alpha Architecture manual.
-;;
-;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
-;; operand 3 can overlap the input and output registers.
-
-(define_expand "unaligned_loadqi"
- [(set (match_operand:DI 2 "register_operand" "")
- (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
- (const_int -8))))
- (set (match_operand:DI 3 "register_operand" "")
- (match_dup 1))
- (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
- (zero_extract:DI (match_dup 2)
- (const_int 8)
- (ashift:DI (match_dup 3) (const_int 3))))]
- ""
- "")
-
-(define_expand "unaligned_loadhi"
- [(set (match_operand:DI 2 "register_operand" "")
- (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
- (const_int -8))))
- (set (match_operand:DI 3 "register_operand" "")
- (match_dup 1))
- (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
- (zero_extract:DI (match_dup 2)
- (const_int 16)
- (ashift:DI (match_dup 3) (const_int 3))))]
- ""
- "")
-
-;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
-;; aligned SImode MEM. Operand 1 is the register containing the
-;; byte or word to store. Operand 2 is the number of bits within the word that
-;; the value should be placed. Operands 3 and 4 are SImode temporaries.
-
-(define_expand "aligned_store"
- [(set (match_operand:SI 3 "register_operand" "")
- (match_operand:SI 0 "memory_operand" ""))
- (set (subreg:DI (match_dup 3) 0)
- (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
- (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
- (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
- (match_operand:DI 2 "const_int_operand" "")))
- (set (subreg:DI (match_dup 4) 0)
- (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
- (set (match_dup 0) (match_dup 4))]
- ""
- "
-{ operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
- << INTVAL (operands[2])));
-}")
-
-;; For the unaligned byte and halfword cases, we use code similar to that
-;; in the ;; Architecture book, but reordered to lower the number of registers
-;; required. Operand 0 is the address. Operand 1 is the data to store.
-;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
-;; be the same temporary, if desired. If the address is in a register,
-;; operand 2 can be that register.
-
-(define_expand "unaligned_storeqi"
- [(set (match_operand:DI 3 "register_operand" "")
- (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
- (const_int -8))))
- (set (match_operand:DI 2 "register_operand" "")
- (match_dup 0))
- (set (match_dup 3)
- (and:DI (not:DI (ashift:DI (const_int 255)
- (ashift:DI (match_dup 2) (const_int 3))))
- (match_dup 3)))
- (set (match_operand:DI 4 "register_operand" "")
- (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
- (ashift:DI (match_dup 2) (const_int 3))))
- (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
- (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
- (match_dup 4))]
- ""
- "")
-
-(define_expand "unaligned_storehi"
- [(set (match_operand:DI 3 "register_operand" "")
- (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
- (const_int -8))))
- (set (match_operand:DI 2 "register_operand" "")
- (match_dup 0))
- (set (match_dup 3)
- (and:DI (not:DI (ashift:DI (const_int 65535)
- (ashift:DI (match_dup 2) (const_int 3))))
- (match_dup 3)))
- (set (match_operand:DI 4 "register_operand" "")
- (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
- (ashift:DI (match_dup 2) (const_int 3))))
- (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
- (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
- (match_dup 4))]
- ""
- "")
-
-;; Here are the define_expand's for QI and HI moves that use the above
-;; patterns. We have the normal sets, plus the ones that need scratch
-;; registers for reload.
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{ extern rtx get_unaligned_address ();
-
- if (TARGET_BYTE_OPS)
- {
- if (GET_CODE (operands[0]) == MEM
- && ! reg_or_0_operand (operands[1], QImode))
- operands[1] = force_reg (QImode, operands[1]);
-
- if (! CONSTANT_P (operands[1]) || input_operand (operands[1], QImode))
- ;
- else if (GET_CODE (operands[1]) == CONST_INT)
- {
- operands[1]
- = alpha_emit_set_const (operands[0], QImode, INTVAL (operands[1]), 3);
- if (rtx_equal_p (operands[0], operands[1]))
- DONE;
- }
- goto def;
- }
-
- /* If the output is not a register, the input must be. */
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (QImode, operands[1]);
-
- /* Handle four memory cases, unaligned and aligned for either the input
- or the output. The only case where we can be called during reload is
- for aligned loads; all other cases require temporaries. */
-
- if (GET_CODE (operands[1]) == MEM
- || (GET_CODE (operands[1]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[1])) == MEM)
- || (reload_in_progress && GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
- || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[1])) == REG
- && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
- {
- if (aligned_memory_operand (operands[1], QImode))
- {
- rtx aligned_mem, bitnum;
- rtx scratch = (reload_in_progress
- ? gen_rtx (REG, SImode, REGNO (operands[0]))
- : gen_reg_rtx (SImode));
-
- get_aligned_mem (operands[1], &aligned_mem, &bitnum);
-
- emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
- scratch));
- }
- else
- {
- /* Don't pass these as parameters since that makes the generated
- code depend on parameter evaluation order which will cause
- bootstrap failures. */
-
- rtx temp1 = gen_reg_rtx (DImode);
- rtx temp2 = gen_reg_rtx (DImode);
- rtx seq
- = gen_unaligned_loadqi (operands[0],
- get_unaligned_address (operands[1], 0),
- temp1, temp2);
-
- alpha_set_memflags (seq, operands[1]);
- emit_insn (seq);
- }
-
- DONE;
- }
-
- else if (GET_CODE (operands[0]) == MEM
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == MEM)
- || (reload_in_progress && GET_CODE (operands[0]) == REG
- && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
- || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
- {
- if (aligned_memory_operand (operands[0], QImode))
- {
- rtx aligned_mem, bitnum;
- rtx temp1 = gen_reg_rtx (SImode);
- rtx temp2 = gen_reg_rtx (SImode);
-
- get_aligned_mem (operands[0], &aligned_mem, &bitnum);
-
- emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
- temp1, temp2));
- }
- else
- {
- rtx temp1 = gen_reg_rtx (DImode);
- rtx temp2 = gen_reg_rtx (DImode);
- rtx temp3 = gen_reg_rtx (DImode);
- rtx seq
- = gen_unaligned_storeqi (get_unaligned_address (operands[0], 0),
- operands[1], temp1, temp2, temp3);
-
- alpha_set_memflags (seq, operands[0]);
- emit_insn (seq);
- }
- DONE;
- }
- def:;
-}")
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{ extern rtx get_unaligned_address ();
-
- if (TARGET_BYTE_OPS)
- {
- if (GET_CODE (operands[0]) == MEM
- && ! reg_or_0_operand (operands[1], HImode))
- operands[1] = force_reg (HImode, operands[1]);
-
- if (! CONSTANT_P (operands[1]) || input_operand (operands[1], HImode))
- ;
- else if (GET_CODE (operands[1]) == CONST_INT)
- {
- operands[1]
- = alpha_emit_set_const (operands[0], HImode, INTVAL (operands[1]), 3);
- if (rtx_equal_p (operands[0], operands[1]))
- DONE;
- }
- goto def;
- }
-
-
- /* If the output is not a register, the input must be. */
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (HImode, operands[1]);
-
- /* Handle four memory cases, unaligned and aligned for either the input
- or the output. The only case where we can be called during reload is
- for aligned loads; all other cases require temporaries. */
-
- if (GET_CODE (operands[1]) == MEM
- || (GET_CODE (operands[1]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[1])) == MEM)
- || (reload_in_progress && GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
- || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[1])) == REG
- && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
- {
- if (aligned_memory_operand (operands[1], HImode))
- {
- rtx aligned_mem, bitnum;
- rtx scratch = (reload_in_progress
- ? gen_rtx (REG, SImode, REGNO (operands[0]))
- : gen_reg_rtx (SImode));
-
- get_aligned_mem (operands[1], &aligned_mem, &bitnum);
-
- emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
- scratch));
- }
- else
- {
- /* Don't pass these as parameters since that makes the generated
- code depend on parameter evaluation order which will cause
- bootstrap failures. */
-
- rtx temp1 = gen_reg_rtx (DImode);
- rtx temp2 = gen_reg_rtx (DImode);
- rtx seq
- = gen_unaligned_loadhi (operands[0],
- get_unaligned_address (operands[1], 0),
- temp1, temp2);
-
- alpha_set_memflags (seq, operands[1]);
- emit_insn (seq);
- }
-
- DONE;
- }
-
- else if (GET_CODE (operands[0]) == MEM
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == MEM)
- || (reload_in_progress && GET_CODE (operands[0]) == REG
- && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
- || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
- {
- if (aligned_memory_operand (operands[0], HImode))
- {
- rtx aligned_mem, bitnum;
- rtx temp1 = gen_reg_rtx (SImode);
- rtx temp2 = gen_reg_rtx (SImode);
-
- get_aligned_mem (operands[0], &aligned_mem, &bitnum);
-
- emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
- temp1, temp2));
- }
- else
- {
- rtx temp1 = gen_reg_rtx (DImode);
- rtx temp2 = gen_reg_rtx (DImode);
- rtx temp3 = gen_reg_rtx (DImode);
- rtx seq
- = gen_unaligned_storehi (get_unaligned_address (operands[0], 0),
- operands[1], temp1, temp2, temp3);
-
- alpha_set_memflags (seq, operands[0]);
- emit_insn (seq);
- }
-
- DONE;
- }
- def:;
-}")
-
-;; Here are the versions for reload. Note that in the unaligned cases
-;; we know that the operand must not be a pseudo-register because stack
-;; slots are always aligned references.
-
-(define_expand "reload_inqi"
- [(parallel [(match_operand:QI 0 "register_operand" "=r")
- (match_operand:QI 1 "unaligned_memory_operand" "m")
- (match_operand:TI 2 "register_operand" "=&r")])]
- ""
- "
-{ extern rtx get_unaligned_address ();
- rtx addr = get_unaligned_address (operands[1], 0);
- /* It is possible that one of the registers we got for operands[2]
- might coincide with that of operands[0] (which is why we made
- it TImode). Pick the other one to use as our scratch. */
- rtx scratch = gen_rtx (REG, DImode,
- REGNO (operands[0]) == REGNO (operands[2])
- ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
- rtx seq = gen_unaligned_loadqi (operands[0], addr, scratch,
- gen_rtx (REG, DImode, REGNO (operands[0])));
-
- alpha_set_memflags (seq, operands[1]);
- emit_insn (seq);
- DONE;
-}")
-
-(define_expand "reload_inhi"
- [(parallel [(match_operand:HI 0 "register_operand" "=r")
- (match_operand:HI 1 "unaligned_memory_operand" "m")
- (match_operand:TI 2 "register_operand" "=&r")])]
- ""
- "
-{ extern rtx get_unaligned_address ();
- rtx addr = get_unaligned_address (operands[1], 0);
- /* It is possible that one of the registers we got for operands[2]
- might coincide with that of operands[0] (which is why we made
- it TImode). Pick the other one to use as our scratch. */
- rtx scratch = gen_rtx (REG, DImode,
- REGNO (operands[0]) == REGNO (operands[2])
- ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
- rtx seq = gen_unaligned_loadhi (operands[0], addr, scratch,
- gen_rtx (REG, DImode, REGNO (operands[0])));
-
- alpha_set_memflags (seq, operands[1]);
- emit_insn (seq);
- DONE;
-}")
-
-(define_expand "reload_outqi"
- [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
- (match_operand:QI 1 "register_operand" "r")
- (match_operand:TI 2 "register_operand" "=&r")])]
- ""
- "
-{ extern rtx get_unaligned_address ();
-
- if (aligned_memory_operand (operands[0], QImode))
- {
- rtx aligned_mem, bitnum;
-
- get_aligned_mem (operands[0], &aligned_mem, &bitnum);
-
- emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
- gen_rtx (REG, SImode, REGNO (operands[2])),
- gen_rtx (REG, SImode,
- REGNO (operands[2]) + 1)));
- }
- else
- {
- rtx addr = get_unaligned_address (operands[0], 0);
- rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
- rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
- rtx scratch3 = scratch1;
- rtx seq;
-
- if (GET_CODE (addr) == REG)
- scratch1 = addr;
-
- seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
- scratch2, scratch3);
- alpha_set_memflags (seq, operands[0]);
- emit_insn (seq);
- }
-
- DONE;
-}")
-
-(define_expand "reload_outhi"
- [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
- (match_operand:HI 1 "register_operand" "r")
- (match_operand:TI 2 "register_operand" "=&r")])]
- ""
- "
-{ extern rtx get_unaligned_address ();
-
- if (aligned_memory_operand (operands[0], HImode))
- {
- rtx aligned_mem, bitnum;
-
- get_aligned_mem (operands[0], &aligned_mem, &bitnum);
-
- emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
- gen_rtx (REG, SImode, REGNO (operands[2])),
- gen_rtx (REG, SImode,
- REGNO (operands[2]) + 1)));
- }
- else
- {
- rtx addr = get_unaligned_address (operands[0], 0);
- rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
- rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
- rtx scratch3 = scratch1;
- rtx seq;
-
- if (GET_CODE (addr) == REG)
- scratch1 = addr;
-
- seq = gen_unaligned_storehi (addr, operands[1], scratch1,
- scratch2, scratch3);
- alpha_set_memflags (seq, operands[0]);
- emit_insn (seq);
- }
-
- DONE;
-}")
-
-;; Subroutine of stack space allocation. Perform a stack probe.
-(define_expand "probe_stack"
- [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
- ""
- "
-{
- operands[1] = gen_rtx (MEM, DImode, plus_constant (stack_pointer_rtx,
- INTVAL (operands[0])));
- MEM_VOLATILE_P (operands[1]) = 1;
-
- operands[0] = const0_rtx;
-}")
-
-;; This is how we allocate stack space. If we are allocating a
-;; constant amount of space and we know it is less than 4096
-;; bytes, we need do nothing.
-;;
-;; If it is more than 4096 bytes, we need to probe the stack
-;; periodically.
-(define_expand "allocate_stack"
- [(set (reg:DI 30)
- (plus:DI (reg:DI 30)
- (match_operand:DI 0 "reg_or_cint_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == CONST_INT
- && INTVAL (operands[0]) < 32768)
- {
- if (INTVAL (operands[0]) >= 4096)
- {
- /* We do this the same way as in the prologue and generate explicit
- probes. Then we update the stack by the constant. */
-
- int probed = 4096;
-
- emit_insn (gen_probe_stack (GEN_INT (- probed)));
- while (probed + 8192 < INTVAL (operands[0]))
- emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
-
- if (probed + 4096 < INTVAL (operands[0]))
- emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[0]))));
- }
-
- operands[0] = GEN_INT (- INTVAL (operands[0]));
- }
- else
- {
- rtx out_label = 0;
- rtx loop_label = gen_label_rtx ();
- rtx want = gen_reg_rtx (Pmode);
- rtx tmp = gen_reg_rtx (Pmode);
- rtx memref;
-
- emit_insn (gen_subdi3 (want, stack_pointer_rtx,
- force_reg (Pmode, operands[0])));
- emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
-
- if (GET_CODE (operands[0]) != CONST_INT)
- {
- out_label = gen_label_rtx ();
- emit_insn (gen_cmpdi (want, tmp));
- emit_jump_insn (gen_bgeu (out_label));
- }
-
- emit_label (loop_label);
- memref = gen_rtx (MEM, DImode, tmp);
- MEM_VOLATILE_P (memref) = 1;
- emit_move_insn (memref, const0_rtx);
- emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
- emit_insn (gen_cmpdi (tmp, want));
- emit_jump_insn (gen_bgtu (loop_label));
- memref = gen_rtx (MEM, DImode, want);
- MEM_VOLATILE_P (memref) = 1;
- emit_move_insn (memref, const0_rtx);
-
- if (out_label)
- emit_label (out_label);
-
- emit_move_insn (stack_pointer_rtx, want);
-
- DONE;
- }
-}")
-
-(define_expand "nonlocal_goto_receiver"
- [(unspec_volatile [(const_int 0)] 1)
- (set (reg:DI 27) (mem:DI (reg:DI 29)))
- (unspec_volatile [(const_int 0)] 1)
- (use (reg:DI 27))]
- "TARGET_OPEN_VMS"
- "")
-
-(define_insn "arg_home"
- [(unspec [(const_int 0)] 0)
- (use (reg:DI 1))
- (use (reg:DI 25))
- (use (reg:DI 16))
- (use (reg:DI 17))
- (use (reg:DI 18))
- (use (reg:DI 19))
- (use (reg:DI 20))
- (use (reg:DI 21))
- (use (reg:DI 48))
- (use (reg:DI 49))
- (use (reg:DI 50))
- (use (reg:DI 51))
- (use (reg:DI 52))
- (use (reg:DI 53))
- (clobber (mem:BLK (const_int 0)))
- (clobber (reg:DI 24))
- (clobber (reg:DI 25))
- (clobber (reg:DI 0))]
- "TARGET_OPEN_VMS"
- "lda $0,ots$home_args\;ldq $0,8($0)\;jsr $0,ots$home_args")
diff --git a/gcc/config/alpha/config-nt.sed b/gcc/config/alpha/config-nt.sed
deleted file mode 100644
index 62a85fbc286..00000000000
--- a/gcc/config/alpha/config-nt.sed
+++ /dev/null
@@ -1,33 +0,0 @@
-/^Makefile/,/^ rm -f config.run/d
-s/rm -f/del/
-s/|| cp/|| copy/
-/^config.status/,/ fi/d
-s/config.status//g
-s/\/dev\/null/NUL/g
-s/$(srcdir)\/c-parse/c-parse/g
-s/$(srcdir)\/c-gperf/c-gperf/g
-/^multilib.h/ s/multilib/not-multilib/
-/^target=/ c\
-target=winnt3.5
-/^xmake_file=/ d
-/^tmake_file=/ d
-/^out_file/ c\
-out_file=config/alpha/alpha.c
-/^out_object_file/ c\
-out_object_file=alpha.obj
-/^md_file/ c\
-md_file=config/alpha/alpha.md
-/^tm_file/ c\
-tm_file=config/alpha/alpha.h config/alpha/winnt.h
-/^build_xm_file/ c\
-build_xm_file=config/alpha/xm-alpha.h config/winnt/xm-winnt.h config/alpha/xm-winnt.h
-/^host_xm_file/ c\
-host_xm_file=config/alpha/xm-alpha.h config/winnt/xm-winnt.h config/alpha/xm-winnt.h
-/^####target/ i\
-CC = cl \
-CLIB = libc.lib kernel32.lib \
-CFLAGS = -Dalpha -DWIN32 -D_WIN32 -D_ALPHA_ -D_M_ALPHA \\\
- -DALMOST_STDC \
-LDFLAGS = -subsystem:console -entry:mainCRTStartup \\\
- -stack:1000000,1000 \
-
diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
deleted file mode 100644
index 62d00adeb61..00000000000
--- a/gcc/config/alpha/elf.h
+++ /dev/null
@@ -1,496 +0,0 @@
-/* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Richard Henderson (rth@tamu.edu).
-
-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 used on Alpha platforms that use the ELF format.
-Currently only Linux uses this. */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (Alpha Linux/ELF)");
-
-#undef OBJECT_FORMAT_COFF
-#undef EXTENDED_COFF
-#define OBJECT_FORMAT_ELF
-
-#define SDB_DEBUGGING_INFO
-
-#undef ASM_FINAL_SPEC
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "\
--D__alpha -D__alpha__ -D__linux__ -D__linux -D_LONGLONG -Dlinux -Dunix \
--Asystem(linux) -Acpu(alpha) -Amachine(alpha) -D__ELF__"
-
-#undef LINK_SPEC
-#define LINK_SPEC "-m elf64alpha -G 8 %{O*:-O3} %{!O*:-O1} \
- %{shared:-shared} \
- %{!shared: \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib/ld-gnu.so.1}} \
- %{static:-static}}"
-
-/* Output at beginning of assembler file. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-{ \
- alpha_write_verstamp (FILE); \
- output_file_directive (FILE, main_input_filename); \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- fprintf (FILE, "\t.set noat\n"); \
-}
-
-#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
- alpha_output_lineno (STREAM, LINE)
-extern void alpha_output_lineno ();
-
-extern void output_file_directive ();
-
-/* Attach a special .ident directive to the end of the file to identify
- the version of GCC which compiled this code. The format of the
- .ident string is patterned after the ones produced by native svr4
- C compilers. */
-
-#define IDENT_ASM_OP ".ident"
-
-#ifdef IDENTIFY_WITH_IDENT
-#define ASM_IDENTIFY_GCC(FILE) /* nothing */
-#define ASM_IDENTIFY_LANGUAGE(FILE) \
- fprintf(FILE, "\t%s \"GCC (%s) %s\"\n", IDENT_ASM_OP, \
- lang_identify(), version_string)
-#else
-#define ASM_FILE_END(FILE) \
-do { \
- fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \
- IDENT_ASM_OP, version_string); \
- } while (0)
-#endif
-
-/* Allow #sccs in preprocessor. */
-
-#define SCCS_DIRECTIVE
-
-/* Output #ident as a .ident. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
-
-/* This is how to allocate empty space in some section. The .zero
- pseudo-op is used for this on most svr4 assemblers. */
-
-#define SKIP_ASM_OP ".zero"
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE))
-
-/* Output the label which precedes a jumptable. Note that for all svr4
- systems where we actually generate jumptables (which is to say every
- svr4 target except i386, where we use casesi instead) we put the jump-
- tables into the .rodata section and since other stuff could have been
- put into the .rodata section prior to any given jumptable, we have to
- make sure that the location counter for the .rodata section gets pro-
- perly re-aligned prior to the actual beginning of the jump table. */
-
-#define ALIGN_ASM_OP ".align"
-
-#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
-#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- ASM_OUTPUT_ALIGN ((FILE), 2);
-#endif
-
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
- do { \
- ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \
- } while (0)
-
-/* The standard SVR4 assembler seems to require that certain builtin
- library routines (e.g. .udiv) be explicitly declared as .globl
- in each assembly file where they are referenced. */
-
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
- ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
-
-/* This says how to output assembler code to declare an
- uninitialized external linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here. */
-
-#define COMMON_ASM_OP ".comm"
-
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
-} while (0)
-
-/* This says how to output assembler code to declare an
- uninitialized internal linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here. */
-
-#define LOCAL_ASM_OP ".local"
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), "\n"); \
- ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
-} while (0)
-
-/* This is the pseudo-op used to generate a 64-bit word of data with a
- specific value in some section. */
-
-#define INT_ASM_OP ".quad"
-
-/* This is the pseudo-op used to generate a contiguous sequence of byte
- values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
- AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */
-
-#undef ASCII_DATA_ASM_OP
-#define ASCII_DATA_ASM_OP ".ascii"
-
-/* Support const sections and the ctors and dtors sections for g++.
- Note that there appears to be two different ways to support const
- sections at the moment. You can either #define the symbol
- READONLY_DATA_SECTION (giving it some code which switches to the
- readonly data section) or else you can #define the symbols
- EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
- SELECT_RTX_SECTION. We do both here just to be on the safe side. */
-
-#define USE_CONST_SECTION 1
-
-#define CONST_SECTION_ASM_OP ".section\t.rodata"
-
-/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
-
- Note that we want to give these sections the SHF_WRITE attribute
- because these sections will actually contain data (i.e. tables of
- addresses of functions in the current root executable or shared library
- file) and, in the case of a shared library, the relocatable addresses
- will have to be properly resolved/relocated (and then written into) by
- the dynamic linker when it actually attaches the given shared library
- to the executing process. (Note that on SVR4, you may wish to use the
- `-z text' option to the ELF linker, when building a shared library, as
- an additional check that you are doing everything right. But if you do
- use the `-z text' option when building a shared library, you will get
- errors unless the .ctors and .dtors sections are marked as writable
- via the SHF_WRITE attribute.) */
-
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
-
-/* On svr4, we *do* have support for the .init and .fini sections, and we
- can put stuff in there to be executed before and after `main'. We let
- crtstuff.c and other files know this by defining the following symbols.
- The definitions say how to change sections to the .init and .fini
- sections. This is the same for all known svr4 assemblers. */
-
-#define INIT_SECTION_ASM_OP ".section\t.init"
-#define FINI_SECTION_ASM_OP ".section\t.fini"
-
-/* A default list of other sections which we might be "in" at any given
- time. For targets that use additional sections (e.g. .tdesc) you
- should override this definition in the target-specific file which
- includes this file. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
-
-/* A default list of extra section function definitions. For targets
- that use additional sections (e.g. .tdesc) you should override this
- definition in the target-specific file which includes this file. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#undef READONLY_DATA_SECTION
-#define READONLY_DATA_SECTION() const_section ()
-
-extern void text_section ();
-
-#define CONST_SECTION_FUNCTION \
-void \
-const_section () \
-{ \
- if (!USE_CONST_SECTION) \
- text_section(); \
- else if (in_section != in_const) \
- { \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
- in_section = in_const; \
- } \
-}
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-/* Switch into a generic section.
- This is currently only used to support section attributes.
-
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
- (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
- (DECL) && TREE_READONLY (DECL) ? "a" : "aw")
-
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement or statements to switch to the appropriate
- section for output of DECL. DECL is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether forming
- the initial value of DECL requires link-time relocations. */
-
-#define SELECT_SECTION(DECL,RELOC) \
-{ \
- if (TREE_CODE (DECL) == STRING_CST) \
- { \
- if (! flag_writable_strings) \
- const_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
- if ((flag_pic && RELOC) \
- || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
- || !DECL_INITIAL (DECL) \
- || (DECL_INITIAL (DECL) != error_mark_node \
- && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
- data_section (); \
- else \
- const_section (); \
- } \
- else \
- const_section (); \
-}
-
-/* A C statement or statements to switch to the appropriate
- section for output of RTX in mode MODE. RTX is some kind
- of constant in RTL. The argument MODE is redundant except
- in the case of a `const_int' rtx. Currently, these always
- go into the const section. */
-
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE,RTX) const_section()
-
-/* Define the strings used for the special svr4 .type and .size directives.
- These strings generally do not vary from one system running svr4 to
- another, but if a given system (e.g. m88k running svr) needs to use
- different pseudo-op names for these, they may be overridden in the
- file which includes this one. */
-
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#define ASM_WEAKEN_LABEL(FILE,NAME) \
- do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
- fputc ('\n', FILE); } while (0)
-
-/* This is how we tell the assembler that two symbols have the same value. */
-
-#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
- do { assemble_name(FILE, NAME1); \
- fputs(" = ", FILE); \
- assemble_name(FILE, NAME2); \
- fputc('\n', FILE); } while (0)
-
-/* The following macro defines the format used to output the second
- operand of the .type assembler directive. Different svr4 assemblers
- expect various different forms for this operand. The one given here
- is just a default. You may need to override it in your machine-
- specific tm.h file (depending upon the particulars of your assembler). */
-
-#define TYPE_OPERAND_FMT "@%s"
-
-/* Write the extra assembler code needed to declare a function's result.
- Most svr4 assemblers don't require any special declaration of the
- result value, but there are exceptions. */
-
-#ifndef ASM_DECLARE_RESULT
-#define ASM_DECLARE_RESULT(FILE, RESULT)
-#endif
-
-/* These macros generate the special .type and .size directives which
- are used to set the corresponding fields of the linker symbol table
- entries in an ELF object file under SVR4. These macros also output
- the starting labels for the relevant functions/objects. */
-
-/* Write the extra assembler code needed to declare an object properly. */
-
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', FILE); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } while (0)
-
-/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
- ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
- corresponds to a particular byte value [0..255]. For any
- given byte value, if the value in the corresponding table
- position is zero, the given character can be output directly.
- If the table value is 1, the byte must be output as a \ooo
- octal escape. If the tables value is anything else, then the
- byte value should be output as a \ followed by the value
- in the table. Note that we can use standard UN*X escape
- sequences for many control characters, but we don't use
- \a to represent BEL because some svr4 assemblers (e.g. on
- the i386) don't know about that. Also, we don't use \v
- since some versions of gas, such as 2.2 did not accept it. */
-
-#define ESCAPES \
-"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
-
-/* Some svr4 assemblers have a limit on the number of characters which
- can appear in the operand of a .string directive. If your assembler
- has such a limitation, you should define STRING_LIMIT to reflect that
- limit. Note that at least some svr4 assemblers have a limit on the
- actual number of bytes in the double-quoted string, and that they
- count each character in an escape sequence as one byte. Thus, an
- escape sequence like \377 would count as four bytes.
-
- If your target assembler doesn't support the .string directive, you
- should define this to zero.
-*/
-
-#define STRING_LIMIT ((unsigned) 256)
-
-#define STRING_ASM_OP ".string"
-
-/*
- * We always use gas here, so we don't worry about ECOFF assembler problems.
- */
-#undef TARGET_GAS
-#define TARGET_GAS (1)
-
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* Provide a STARTFILE_SPEC appropriate for Linux. Here we add
- the Linux magical crtbegin.o file (see crtstuff.c) which
- provides part of the support for getting C++ file-scope static
- object constructed before entering `main'. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!shared: \
- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
-
-/* Provide a ENDFILE_SPEC appropriate for Linux. Here we tack on
- the Linux magical crtend.o file (see crtstuff.c) which
- provides part of the support for getting C++ file-scope static
- object constructed before entering `main', followed by a normal
- Linux "finalizer" file, `crtn.o'. */
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
deleted file mode 100644
index 4dbc65025cf..00000000000
--- a/gcc/config/alpha/linux.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Definitions of target machine for GNU compiler, for Alpha Linux,
- using ECOFF.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Bob Manson.
-
-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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (3 | MASK_GAS)
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (Linux/Alpha)");
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "\
--D__alpha -D__alpha__ -D__linux__ -D__linux -D_LONGLONG -Dlinux -Dunix \
--Asystem(linux) -Acpu(alpha) -Amachine(alpha)"
-
-/* We don't actually need any of these; the MD_ vars are ignored
- anyway for cross-compilers, and the other specs won't get picked up
- because the user is supposed to do ld -r (hmm, perhaps that should be
- the default). In any case, setting them thus will catch some
- common user errors. */
-
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{pg:-lgmon} %{pg:-lc_p} %{!pg:-lc}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "-G 8 %{O*:-O3} %{!O*:-O1}"
-
-#undef ASM_SPEC
-#define ASM_SPEC "-nocpp"
-
-/* Can't do stabs */
-#undef SDB_DEBUGGING_INFO
-
-/* Prefer dbx. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fputs ("\tjsr $28,_mcount\n", (FILE))
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Show that we need a GP when profiling. */
-#define TARGET_PROFILING_NEEDS_GP
-
-#undef ASM_FINAL_SPEC
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function.
-
- This differs from the standard version in that:
-
- We do not initialize the "hint" field because it only has an 8k
- range and so the target is in range of something on the stack.
- Omitting the hint saves a bogus branch-prediction cache line load.
-
- Linux always has an executable stack -- no need for a system call.
- */
-
-#undef INITIALIZE_TRAMPOLINE
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- rtx _addr; \
- \
- _addr = memory_address (Pmode, plus_constant ((TRAMP), 16)); \
- emit_move_insn (gen_rtx (MEM, Pmode, _addr), (FNADDR)); \
- _addr = memory_address (Pmode, plus_constant ((TRAMP), 24)); \
- emit_move_insn (gen_rtx (MEM, Pmode, _addr), (CXT)); \
- \
- emit_insn (gen_rtx (UNSPEC_VOLATILE, VOIDmode, \
- gen_rtvec (1, const0_rtx), 0)); \
-}
diff --git a/gcc/config/alpha/osf12.h b/gcc/config/alpha/osf12.h
deleted file mode 100644
index 87e21111f4d..00000000000
--- a/gcc/config/alpha/osf12.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Definitions of target machine for GNU compiler, for DEC Alpha.
- Copyright (C) 1992, 1993, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@nyu.edu)
-
-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. */
-
-/* In OSF 1.2, there is a linker bug that prevents use of -O3 to
- the linker. */
-
-#undef LINK_SPEC
-#define LINK_SPEC \
- "-G 8 -O1 %{static:-non_shared} %{rpath*} \
- %{!static:%{shared:-shared} %{!shared:-call_shared}} %{taso}"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 16
diff --git a/gcc/config/alpha/osf2or3.h b/gcc/config/alpha/osf2or3.h
deleted file mode 100644
index 03bc58a61e3..00000000000
--- a/gcc/config/alpha/osf2or3.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Definitions of target machine for GNU compiler, for DEC Alpha, osf[23].
- Copyright (C) 1997 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. */
-
-/* In OSF 2 or 3, linking with -lprof1 doesn't require -lpdf. */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} %{a:-lprof2} -lc"
diff --git a/gcc/config/alpha/t-vms b/gcc/config/alpha/t-vms
deleted file mode 100644
index 12ac24098ce..00000000000
--- a/gcc/config/alpha/t-vms
+++ /dev/null
@@ -1,6 +0,0 @@
-# Do not build libgcc1.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-LIB2FUNCS_EXTRA = tramp.s
-
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
deleted file mode 100644
index ab762ca2770..00000000000
--- a/gcc/config/alpha/vms.h
+++ /dev/null
@@ -1,377 +0,0 @@
-/* Output variables, constants and external declarations, for GNU compiler.
- Copyright (C) 1996, 1997 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. */
-
-#define OPEN_VMS 1
-
-/* This enables certain macros in alpha.h, which will make an indirect
- reference to an external symbol an invalid address. This needs to be
- defined before we include alpha.h, since it determines which macros
- are used for GO_IF_*. */
-
-#define NO_EXTERNAL_INDIRECT_ADDRESS
-
-#include "alpha/alpha.h"
-
-/* Predefine this in CPP because VMS limits the size of command options
- and GNU CPP is not used on VMS except with GNU C. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
-"-Dalpha -D__ALPHA -Dvms -DVMS -D__alpha__ -D__alpha -D__vms__ -D__VMS__\
- -D__VMS_VER=70000022 \
- -D__GNUC__=2 -D__GNUC_MINOR__=7 -Asystem(vms) -Acpu(alpha) -Amachine(alpha)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "\
-%{mfloat-ieee:-D__IEEE_FLOAT} \
-%{mfloat-vax:-D__G_FLOAT} \
-%{!mfloat-vax:-D__IEEE_FLOAT} \
-%{!.S: -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}} \
-%{.S: -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
-%{.cc: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
-%{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
-%{.C: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \
-%{.m: -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C}"
-
-/* We allow $'s in identifiers unless -ansi is used .. */
-
-#define DOLLARS_IN_IDENTIFIERS 2
-
-/* These match the definitions used in DECCRTL, the VMS C run-time library
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-*/
-
-/* Use memcpy for structure copying, and so forth. */
-#define TARGET_MEM_FUNCTIONS
-
-/* By default, allow $ to be part of an identifier. */
-#define DOLLARS_IN_IDENTIFIERS 2
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS|MASK_OPEN_VMS)
-#undef TARGET_NAME
-#define TARGET_NAME "OpenVMS/Alpha"
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
-
-/* The structure return address arrives as an "argument" on VMS. */
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE 0
-#undef PCC_STATIC_STRUCT_RETURN
-
-/* no floating emulation. */
-#undef REAL_ARITHMETIC
-
-/* "long" is 32 bits. */
-#undef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE 32
-
-/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
-#undef POINTER_SIZE
-#define POINTER_SIZE 32
-#define POINTERS_EXTEND_UNSIGNED 0
-
-/* No data type wants to be aligned rounder than this. */
-#undef BIGGEST_ALIGNMENT
-#define BIGGEST_ALIGNMENT 128 /* X Complex */
-#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Test CD40VRA */
-
-#undef FIXED_REGISTERS
-#define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
-
-#undef CALL_USED_REGISTERS
-#define CALL_USED_REGISTERS \
- {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
-
-#undef HARD_FRAME_POINTER_REGNUM
-#define HARD_FRAME_POINTER_REGNUM 29
-
-#undef CAN_ELIMINATE
-#define CAN_ELIMINATE(FROM, TO) \
-((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
-
-#undef INITIAL_ELIMINATION_OFFSET
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ if ((FROM) == FRAME_POINTER_REGNUM) \
- (OFFSET) = alpha_sa_size () + alpha_pv_save_size (); \
- else if ((FROM) == ARG_POINTER_REGNUM) \
- (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size () \
- + get_frame_size () \
- + current_function_pretend_args_size) \
- - current_function_pretend_args_size); \
- if ((TO) == STACK_POINTER_REGNUM) \
- (OFFSET) += ALPHA_ROUND (current_function_outgoing_args_size); \
-}
-
-#undef FUNCTION_ARG_ADVANCE
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- if (MUST_PASS_IN_STACK (MODE, TYPE)) \
- (CUM) = (CUM & ~0xff) + 6; \
- else \
- (CUM) += ALPHA_ARG_SIZE (MODE, TYPE, NAMED)
-
-#undef FUNCTION_ARG_PARTIAL_NREGS
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
-((CUM & 0xff) < 6 && 6 < (CUM & 0xff) \
- + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
- ? 6 - (CUM & 0xff) : 0)
-
-extern char *vmskrunch ();
-#undef ENCODE_SECTION_INFO
-#define ENCODE_SECTION_INFO(DECL) \
-do { \
- if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
- \
- if (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd' \
- && GET_CODE (DECL_RTL (DECL)) == MEM \
- && GET_CODE (XEXP (DECL_RTL (DECL), 0)) == SYMBOL_REF) \
- XSTR (XEXP (DECL_RTL (DECL), 0), 0) \
- = vmskrunch (XSTR (XEXP (DECL_RTL (DECL), 0), 0)); \
-} while (0)
-
-/* Perform any needed actions needed for a function that is receiving a
- variable number of arguments.
-
- CUM is as for INIT_CUMULATIVE_ARGS.
-
- MODE and TYPE are the mode and type of the current parameter.
-
- PRETEND_SIZE is a variable that should be set to the amount of stack
- that must be pushed by the prolog to pretend that our caller pushed
- it.
-
- Normally, this macro will push all remaining incoming registers on the
- stack and set PRETEND_SIZE to the length of the registers pushed.
-
- For VMS, we allocate space for all 6 arg registers plus a count.
-
- However, if NO registers need to be saved, don't allocate any space.
- This is not only because we won't need the space, but because AP includes
- the current_pretend_args_size and we don't want to mess up any
- ap-relative addresses already made. */
-
-#undef SETUP_INCOMING_VARARGS
-#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
-{ if ((CUM) < 6) \
- { \
- if (! (NO_RTL)) \
- { \
- emit_move_insn (gen_rtx (REG, DImode, 1), \
- virtual_incoming_args_rtx); \
- emit_insn (gen_arg_home ()); \
- } \
- \
- PRETEND_SIZE = 7 * UNITS_PER_WORD; \
- } \
-}
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
-{ \
- alpha_function_name = vmskrunch (NAME); \
-}
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-{ \
- alpha_write_verstamp (FILE); \
- fprintf (FILE, "\t.set noreorder\n"); \
- fprintf (FILE, "\t.set volatile\n"); \
- ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
-}
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
- fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
- } \
- else \
- { \
- char str[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
- fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \
- } \
- }
-
-#define LINK_SECTION_ASM_OP ".link"
-
-#define READONLY_SECTION_ASM_OP ".rdata"
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_link, in_rdata
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-readonly_section () \
-{ \
- if (in_section != in_rdata) \
- { \
- fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \
- in_section = in_rdata; \
- } \
-} \
-void \
-link_section () \
-{ \
- if (in_section != in_link) \
- { \
- fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \
- in_section = in_link; \
- } \
-}
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) abort ()
-
-#undef ASM_OUTPUT_ADDR_VEC_ELT
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.quad $%d\n", (VALUE) + 32)
-
-#undef READONLY_DATA_SECTION
-#define READONLY_DATA_SECTION readonly_section
-
-#define ASM_FILE_END(FILE) alpha_write_linkage (FILE);
-
-#undef FUNCTION_ARG
-void *function_arg ();
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) function_arg (&CUM, MODE, TYPE, NAMED)
-
-#undef CASE_VECTOR_MODE
-#define CASE_VECTOR_MODE DImode
-#undef CASE_VECTOR_PC_RELATIVE
-
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
-{ ASM_OUTPUT_ALIGN (FILE, 3); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
-
-#define NO_MD_PROTOTYPES
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- The trampoline should set the static chain pointer to value placed
- into the trampoline and should branch to the specified routine.
- Note that $27 has been set to the address of the trampoline, so we can
- use it for addressability of the two data items. Trampolines are always
- aligned to FUNCTION_BOUNDARY, which is 64 bits. */
-
-#undef TRAMPOLINE_TEMPLATE
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\t.quad 0\n"); \
- fprintf (FILE, "\t.linkage __tramp\n"); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#undef TRAMPOLINE_SIZE
-#define TRAMPOLINE_SIZE 24
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#undef INITIALIZE_TRAMPOLINE
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, Pmode, (TRAMP)), (FNADDR)); \
- emit_move_insn (gen_rtx (MEM, Pmode, \
- memory_address (Pmode, \
- plus_constant ((TRAMP), 16))), \
- (CXT)); \
-}
-
-#undef TRANSFER_FROM_TRAMPOLINE
-
-#undef SDB_DEBUGGING_INFO
-#undef MIPS_DEBUGGING_INFO
-
-#ifndef DBX_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-#endif
-
-#ifdef PREFERRED_DEBUGGING_TYPE
-#undef PREFERRED_DEBUGGING_TYPE
-#endif
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#ifdef ASM_FORMAT_PRIVATE_NAME
-#undef ASM_FORMAT_PRIVATE_NAME
-#endif
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
- sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
-
-#undef ASM_SPEC
-#define ASM_SPEC "-nocpp %{pg}"
-
-#undef ASM_FINAL_SPEC
-
-#undef LIBGCC_SPEC
-#define LIBGCC_SPEC "-lgcc2 -lgcclib"
-
-#define OPTIMIZATION_OPTIONS \
-{ \
- write_symbols = PREFERRED_DEBUGGING_TYPE; \
- debug_info_level = (enum debug_info_level) 2; \
-}
-
-#undef OVERRIDE_OPTIONS
-#define OVERRIDE_OPTIONS \
-{ \
- if (write_symbols == NO_DEBUG) \
- debug_info_level = (enum debug_info_level) 0; \
- override_options (); \
-}
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{g3:-g3} %{g0:-g0}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "gnu:[000000]crt0.obj"
-
-/* Define the names of the division and modulus functions. */
-#define DIVSI3_LIBCALL "ots$div_i"
-#define DIVDI3_LIBCALL "ots$div_l"
-#define UDIVSI3_LIBCALL "ots$div_ui"
-#define UDIVDI3_LIBCALL "ots$div_ul"
-#define MODSI3_LIBCALL "ots$mod_i"
-#define MODDI3_LIBCALL "ots$mod_l"
-#define UMODSI3_LIBCALL "ots$rem_ui"
-#define UMODDI3_LIBCALL "ots$rem_ul"
diff --git a/gcc/config/alpha/win-nt.h b/gcc/config/alpha/win-nt.h
deleted file mode 100644
index c831da482a4..00000000000
--- a/gcc/config/alpha/win-nt.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Definitions of target machine for GNU compiler, for DEC Alpha
- running Windows/NT.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-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. */
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-DWIN32 -D_WIN32 -DWINNT -D__STDC__=0 -DALMOST_STDC\
- -D_M_ALPHA -D_ALPHA_ -D__alpha -D__alpha__\
- -D_LONGLONG -D__unaligned= -D__stdcall= \
- -Asystem(winnt) -Acpu(alpha) -Amachine(alpha)"
-
-#undef ASM_SPEC
-#undef ASM_FINAL_SPEC
-#define ASM_SPEC "-nopp -nologo %{g:-Zi}"
-
-/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
-#undef POINTER_SIZE
-#define POINTER_SIZE 32
-#define POINTERS_EXTEND_UNSIGNED 0
-
-/* "long" is 32 bits. */
-#undef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE 32
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 16
-
-/* We can't do any debugging. */
-#undef SDB_DEBUGGING_INFO
-#undef DBX_DEBUGGING_INFO
-#undef MIPS_DEBUGGING_INFO
-
-#include "winnt/win-nt.h"
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-{ \
- alpha_write_verstamp (FILE); \
- fprintf (FILE, "\t.set noreorder\n"); \
- fprintf (FILE, "\t.set volatile\n"); \
- fprintf (FILE, "\t.set noat\n"); \
- fprintf (FILE, "\t.globl\t__fltused\n"); \
- ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
-}
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{mwindows:-subsystem windows -e _WinMainCRTStartup \
- USER32.LIB%s GDI32.LIB%s COMDLG32.LIB%s WINSPOOL.LIB%s} \
- %{!mwindows:-subsystem console -e _mainCRTStartup} \
- %{mcrtmt:LIBCMT.LIB%s KERNEL32.LIB%s} %{!mcrtmt:LIBC.LIB%s KERNEL32.LIB%s} \
- %{v}"
diff --git a/gcc/config/alpha/x-alpha b/gcc/config/alpha/x-alpha
deleted file mode 100644
index 99197479798..00000000000
--- a/gcc/config/alpha/x-alpha
+++ /dev/null
@@ -1 +0,0 @@
-CLIB=-lmld
diff --git a/gcc/config/alpha/xm-alpha.h b/gcc/config/alpha/xm-alpha.h
deleted file mode 100644
index 642e1cf1a6e..00000000000
--- a/gcc/config/alpha/xm-alpha.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Configuration for GNU C-compiler for DEC Alpha.
- Copyright (C) 1990, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu).
-
-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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 64
-#define HOST_BITS_PER_LONGLONG 64
-
-/* #define HOST_WORDS_BIG_ENDIAN */
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* If not compiled with GNU C, use the builtin alloca. */
-#if !defined(__GNUC__) && !defined(_WIN32)
-#include <alloca.h>
-#else
-extern void *alloca ();
-#endif
-
-/* The host compiler has problems with enum bitfields since it makes
- them signed so we can't fit all our codes in. */
-
-#ifndef __GNUC__
-#define ONLY_INT_FIELDS
-#endif
-
-/* Declare some functions needed for this machine. We don't want to
- include these in the sources since other machines might define them
- differently. */
-
-extern void *malloc (), *realloc (), *calloc ();
-
-#ifndef inhibit_libc
-#include "string.h"
-#endif
-
-/* OSF/1 has vprintf. */
-
-#define HAVE_VPRINTF
-
-/* OSF/1 has putenv. */
-
-#define HAVE_PUTENV
-
-/* OSF/1 is POSIX.1 compliant. */
-
-#define POSIX
diff --git a/gcc/config/alpha/xm-vms.h b/gcc/config/alpha/xm-vms.h
deleted file mode 100644
index c96423a6e5a..00000000000
--- a/gcc/config/alpha/xm-vms.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Configuration for GNU C-compiler for openVMS/Alpha.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Klaus Kaempf (kkaempf@progis.de).
-
-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. */
-
-/* If compiling with DECC, need to fix problem with <stdio.h>
- which defines a macro called FILE_TYPE that breaks "tree.h".
- Fortunately it uses #ifndef to suppress multiple inclusions.
- Three possible cases:
- 1) <stdio.h> has already been included -- ours will be no-op;
- 2) <stdio.h> will be included after us -- "theirs" will be no-op;
- 3) <stdio.h> isn't needed -- including it here shouldn't hurt.
- In all three cases, the problem macro will be removed here. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef __DECC
-#undef FILE_TYPE
-#endif
-
-#undef HOST_BITS_PER_LONG
-#define HOST_BITS_PER_LONG 32
-
-#define HOST_WIDE_INT long long
-#define HOST_BITS_PER_WIDE_INT 64
-
-#undef SUCCESS_EXIT_CODE
-#define SUCCESS_EXIT_CODE 1
-#undef FATAL_EXIT_CODE
-#define FATAL_EXIT_CODE (44 | 0x10000000) /* Abort, and no DCL message. */
-
-/* A couple of conditionals for execution machine are controlled here. */
-#ifndef VMS
-#define VMS
-#endif
-
-/* Define a local equivalent (sort of) for unlink */
-#define unlink remove
-#define NEED_ATEXIT
-
-#define NO_SYS_PARAMS_H /* Don't have <sys/params.h> */
-#define NO_STAB_H /* Don't have <stab.h> */
-#define USE_C_ALLOCA /* Using alloca.c */
-
-#define HAVE_FCNTL_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_STRING_H 1
-#define STDC_HEADERS 1
-
-/* Use ANSI/SYSV style byte manipulation routines instead of BSD ones. */
-
-#define bcopy(s,d,n) memcpy((d),(s),(n))
-#define bzero(d,n) memset((d),0,(n))
-#define bcmp(l,r,n) memcmp((l),(r),(n))
-
-#define index strchr
-#define rindex strrchr
-
-#if __STDC__
-extern void *alloca (size_t);
-#else
-extern char *alloca (unsigned int);
-#endif
-
-#define OBJECT_SUFFIX ".obj"
-#define EXECUTABLE_SUFFIX ".exe"
-#define DIR_SEPARATOR ']'
-#define PATH_SEPARATOR ','
diff --git a/gcc/config/alpha/xm-winnt.h b/gcc/config/alpha/xm-winnt.h
deleted file mode 100644
index 2f2a5a8ea1c..00000000000
--- a/gcc/config/alpha/xm-winnt.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Configuration for GNU compiler for an Alpha running Windows NT 3.x.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (drupp@cs.washington.edu)
-
-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. */
-
-#undef HOST_BITS_PER_LONG
-#define HOST_BITS_PER_LONG 32
-
-#undef POSIX
-
-#define access _access
-#define close _close
-#define mktemp _mktemp
-#define open _open
-#define read _read
-#define write _write
diff --git a/gcc/config/aoutos.h b/gcc/config/aoutos.h
deleted file mode 100644
index e9caa719905..00000000000
--- a/gcc/config/aoutos.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* aoutos.h -- operating system specific defines to be used when
- targeting GCC for some system that uses a.out file format.
- Copyright (C) 1992 Free Software Foundation, Inc.
-
- Written by Ron Guilmette (rfg@netcom.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. */
-
-/* To use this file, make up a file with a name like:
-
- ?????aout.h
-
- where ????? is replaced by the name of the basic hardware that you
- are targeting for. Then, in the file ?????aout.h, put something
- like:
-
- #include "?????.h"
- #include "aoutos.h"
-
- followed by any really system-specific defines (or overrides of
- defines) which you find that you need. Now, modify the configure
- or configure.in script to properly use the new ?????aout.h file
- when configuring for the system. */
-
-/* Define a symbol indicating that we are using aoutos.h. */
-#define USING_AOUTOS_H
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors.
- If using GNU LD, tell it that this is part of the static destructor set.
- This code works for any machine provided you use GNU as/ld.
- If not using GNU LD, rely on a "collect" program to look for names defined
- in the particular form we choose as global constructor function names. */
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- if (flag_gnu_linker) \
- { \
- /* Output an N_SETT (0x16, 22.) for the name. */ \
- fprintf (FILE, "%s \"___CTOR_LIST__\",22,0,0,", ASM_STABS_OP); \
- assemble_name (FILE, NAME); \
- fputc ('\n', FILE); \
- } \
- } while (0)
-
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- if (flag_gnu_linker) \
- { \
- /* Output an N_SETT (0x16, 22.) for the name. */ \
- fprintf (FILE, "%s \"___DTOR_LIST__\",22,0,0,", ASM_STABS_OP); \
- assemble_name (FILE, NAME); \
- fputc ('\n', FILE); \
- } \
- } while (0)
-
-/* Likewise for entries we want to record for garbage collection.
- Garbage collection is still under development. */
-
-#define ASM_OUTPUT_GC_ENTRY(FILE,NAME) \
- do { \
- if (flag_gnu_linker) \
- { \
- /* Output an N_SETT (0x16, 22.) for the name. */ \
- fprintf (FILE, "%s \"___PTR_LIST__\",22,0,0,", ASM_STABS_OP); \
- assemble_name (FILE, NAME); \
- fputc ('\n', FILE); \
- } \
- } while (0)
diff --git a/gcc/config/arm/aof.h b/gcc/config/arm/aof.h
deleted file mode 100644
index ab9093d068c..00000000000
--- a/gcc/config/arm/aof.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/* Definitions of target machine for GNU compiler, for Advanced RISC Machines
- ARM compilation, AOF Assembler.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Richard Earnshaw (rearnsha@armltd.co.uk)
-
-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. */
-
-
-
-#define AOF_ASSEMBLER
-
-#define LINK_LIBGCC_SPECIAL 1
-
-#define LINK_SPEC "%{aof} %{bin} %{aif} %{ihf} %{shl,*} %{reent*} %{split} \
- %{ov*,*} %{reloc*} -nodebug"
-
-#define STARTFILE_SPEC "crtbegin.o%s"
-
-#define ENDFILE_SPEC "crtend.o%s"
-
-#ifndef ASM_SPEC
-#define ASM_SPEC "%{g -g} -arch 4 \
--apcs 3%{mapcs-32:/32bit}%{mapcs-26:/26bit}%{!mapcs-26:%{!macps-32:/26bit}}"
-#endif
-
-#ifndef LIB_SPEC
-#define LIB_SPEC "%{Eb: armlib_h.32b%s}%{!Eb: armlib_h.32l%s}"
-#endif
-
-#define LIBGCC_SPEC "libgcc.a%s"
-
-/* Dividing the Output into Sections (Text, Data, ...) */
-/* AOF Assembler syntax is a nightmare when it comes to areas, since once
- we change from one area to another, we can't go back again. Instead,
- we must create a new area with the same attributes and add the new output
- to that. Unfortunately, there is nothing we can do here to guarantee that
- two areas with the same attributes will be linked adjacently in the
- resulting executable, so we have to be careful not to do pc-relative
- addressing across such boundaries. */
-char *aof_text_section ();
-#define TEXT_SECTION_ASM_OP aof_text_section ()
-
-#define SELECT_RTX_SECTION(MODE,RTX) text_section ();
-
-char *aof_data_section ();
-#define DATA_SECTION_ASM_OP aof_data_section ()
-
-#define EXTRA_SECTIONS in_zero_init, in_ctor, in_dtor
-
-#define EXTRA_SECTION_FUNCTIONS \
-ZERO_INIT_SECTION \
-CTOR_SECTION \
-DTOR_SECTION
-
-#define ZERO_INIT_SECTION \
-void \
-zero_init_section () \
-{ \
- static int zero_init_count = 1; \
- if (in_section != in_zero_init) \
- { \
- fprintf (asm_out_file, "\tAREA |C$$zidata%d|,NOINIT\n", \
- zero_init_count++); \
- in_section = in_zero_init; \
- } \
-}
-
-#define CTOR_SECTION \
-void \
-ctor_section () \
-{ \
- static int ctors_once = 0; \
- if (in_section != in_ctor) \
- { \
- if (ctors_once) \
- { \
- fprintf (stderr, \
- "Attempt to output more than one ctor section\n"); \
- abort (); \
- } \
- fprintf (asm_out_file, "\t%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctor; \
- ctors_once = 1; \
- } \
-}
-
-#define DTOR_SECTION \
-void \
-dtor_section () \
-{ \
- static int dtors_once = 0; \
- if (in_section != in_dtor) \
- { \
- if (dtors_once) \
- { \
- fprintf (stderr, \
- "Attempt to output more than one dtor section\n"); \
- abort (); \
- } \
- fprintf (asm_out_file, "\t%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtor; \
- dtors_once = 1; \
- } \
-}
-
-#define CTOR_LIST_BEGIN \
-asm (CTORS_SECTION_ASM_OP); \
-extern func_ptr __CTOR_END__[1]; \
-func_ptr __CTOR_LIST__[1] = {__CTOR_END__};
-
-#define CTOR_LIST_END \
-asm (CTORS_SECTION_ASM_OP); \
-func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
-
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *ptr = __CTOR_LIST__ + 1; \
- while (*ptr) \
- (*ptr++) (); \
-} while (0)
-
-#define DTOR_LIST_BEGIN \
-asm (DTORS_SECTION_ASM_OP); \
-extern func_ptr __DTOR_END__[1]; \
-func_ptr __DTOR_LIST__[1] = {__DTOR_END__};
-
-#define DTOR_LIST_END \
-asm (DTORS_SECTION_ASM_OP); \
-func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
-
-#define DO_GLOBAL_DTORS_BODY \
-do { \
- func_ptr *ptr = __DTOR_LIST__ + 1; \
- while (*ptr) \
- (*ptr++) (); \
-} while (0)
-
-#define JUMP_TABLES_IN_TEXT_SECTION 1
-
-#ifndef ARM_OS_NAME
-#define ARM_OS_NAME "(generic)"
-#endif
-
-/* For the AOF linker, we need to reference __main to force the standard
- library to get linked in. */
-
-#define ASM_FILE_START(STREAM) \
-{ \
- extern char *version_string; \
- fprintf ((STREAM), "%s Generated by gcc %s for ARM/%s\n", \
- ASM_COMMENT_START, version_string, ARM_OS_NAME); \
- fprintf ((STREAM), "__a1\tRN\t0\n"); \
- fprintf ((STREAM), "__a2\tRN\t1\n"); \
- fprintf ((STREAM), "__a3\tRN\t2\n"); \
- fprintf ((STREAM), "__a4\tRN\t3\n"); \
- fprintf ((STREAM), "__v1\tRN\t4\n"); \
- fprintf ((STREAM), "__v2\tRN\t5\n"); \
- fprintf ((STREAM), "__v3\tRN\t6\n"); \
- fprintf ((STREAM), "__v4\tRN\t7\n"); \
- fprintf ((STREAM), "__v5\tRN\t8\n"); \
- fprintf ((STREAM), "__v6\tRN\t9\n"); \
- fprintf ((STREAM), "__sl\tRN\t10\n"); \
- fprintf ((STREAM), "__fp\tRN\t11\n"); \
- fprintf ((STREAM), "__ip\tRN\t12\n"); \
- fprintf ((STREAM), "__sp\tRN\t13\n"); \
- fprintf ((STREAM), "__lr\tRN\t14\n"); \
- fprintf ((STREAM), "__pc\tRN\t15\n"); \
- fprintf ((STREAM), "__f0\tFN\t0\n"); \
- fprintf ((STREAM), "__f1\tFN\t1\n"); \
- fprintf ((STREAM), "__f2\tFN\t2\n"); \
- fprintf ((STREAM), "__f3\tFN\t3\n"); \
- fprintf ((STREAM), "__f4\tFN\t4\n"); \
- fprintf ((STREAM), "__f5\tFN\t5\n"); \
- fprintf ((STREAM), "__f6\tFN\t6\n"); \
- fprintf ((STREAM), "__f7\tFN\t7\n"); \
- text_section (); \
-}
-
-/* Some systems use __main in a way incompatible with its use in gcc, in these
- cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
- give the same symbol without quotes for an alternative entry point. You
- must define both, or niether. */
-#define NAME__MAIN "__gccmain"
-#define SYMBOL__MAIN __gccmain
-
-#define ASM_FILE_END(STREAM) \
-do \
-{ \
- if (flag_pic) \
- aof_dump_pic_table (STREAM); \
- aof_dump_imports (STREAM); \
- fputs ("\tEND\n", (STREAM)); \
-} while (0);
-
-#define ASM_IDENTIFY_GCC(STREAM) fputs ("|gcc2_compiled.|\n", (STREAM))
-
-#define ASM_COMMENT_START ";"
-
-#define ASM_APP_ON ""
-
-#define ASM_APP_OFF ""
-
-#define ASM_OUTPUT_LONG_DOUBLE(STREAM,VALUE) \
- ASM_OUTPUT_DOUBLE((STREAM),(VALUE))
-
-#define ASM_OUTPUT_DOUBLE(STREAM,VALUE) \
-do { \
- char dstr[30]; \
- long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), l); \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.14g", dstr); \
- fprintf ((STREAM), "\tDCD &%lx, &%lx\t%s double %s\n", \
- l[0], l[1], ASM_COMMENT_START, dstr); \
-} while (0)
-
-#define ASM_OUTPUT_FLOAT(STREAM,VALUE) \
-do { \
- char dstr[30]; \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), l); \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.7g", dstr); \
- fprintf ((STREAM), "\tDCD &%lx\t%s double %s\n", \
- l, ASM_COMMENT_START, dstr); \
-} while (0)
-
-#define ASM_OUTPUT_INT(STREAM,VALUE) \
- (fprintf ((STREAM), "\tDCD\t"), \
- output_addr_const ((STREAM), (VALUE)), \
- fputc ('\n', (STREAM)))
-
-#define ASM_OUTPUT_SHORT(STREAM,VALUE) \
- (fprintf ((STREAM), "\tDCW\t"), \
- output_addr_const ((STREAM), (VALUE)), \
- fputc ('\n', (STREAM)))
-
-#define ASM_OUTPUT_CHAR(STREAM,VALUE) \
- (fprintf ((STREAM), "\tDCB\t"), \
- output_addr_const ((STREAM), (VALUE)), \
- fputc ('\n', (STREAM)))
-
-#define ASM_OUTPUT_BYTE(STREAM,VALUE) \
- fprintf ((STREAM), "\tDCB\t%d\n", (VALUE))
-
-#define ASM_OUTPUT_ASCII(STREAM,PTR,LEN) \
-{ \
- int i; \
- char *ptr = (PTR); \
- fprintf ((STREAM), "\tDCB"); \
- for (i = 0; i < (LEN); i++) \
- fprintf ((STREAM), " &%02x%s", \
- (unsigned ) *(ptr++), \
- (i + 1 < (LEN) \
- ? ((i & 3) == 3 ? "\n\tDCB" : ",") \
- : "\n")); \
-}
-
-#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n')
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Output of Uninitialized Variables */
-
-#define ASM_OUTPUT_COMMON(STREAM,NAME,SIZE,ROUNDED) \
- (fprintf ((STREAM), "\tAREA "), \
- assemble_name ((STREAM), (NAME)), \
- fprintf ((STREAM), ", DATA, COMMON\n\t%% %d\t%s size=%d\n", \
- (ROUNDED), ASM_COMMENT_START, SIZE))
-
-#define ASM_OUTPUT_LOCAL(STREAM,NAME,SIZE,ROUNDED) \
- (zero_init_section (), \
- assemble_name ((STREAM), (NAME)), \
- fprintf ((STREAM), "\n"), \
- fprintf ((STREAM), "\t%% %d\t%s size=%d\n", \
- (ROUNDED), ASM_COMMENT_START, SIZE))
-
-/* Output and Generation of Labels */
-
-extern int arm_main_function;
-
-#define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
-do { \
- fprintf ((STREAM), "\tEXPORT\t"); \
- assemble_name ((STREAM), (NAME)); \
- fputc ('\n', (STREAM)); \
- if ((NAME)[0] == 'm' && ! strcmp ((NAME), "main")) \
- arm_main_function = 1; \
-} while (0)
-
-#define ARM_OUTPUT_LABEL(STREAM,NAME) \
-do { \
- assemble_name (STREAM,NAME); \
- fputs ("\n", STREAM); \
-} while (0)
-
-#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
-{ \
- ASM_OUTPUT_LABEL (STREAM, NAME); \
- if (! TREE_PUBLIC (DECL)) \
- { \
- fputs ("\tKEEP ", STREAM); \
- ASM_OUTPUT_LABEL (STREAM, NAME); \
- } \
- aof_delete_import ((NAME)); \
-}
-
-#define ASM_DECLARE_OBJECT_NAME(STREAM,NAME,DECL) \
-{ \
- ASM_OUTPUT_LABEL (STREAM, NAME); \
- if (! TREE_PUBLIC (DECL)) \
- { \
- fputs ("\tKEEP ", STREAM); \
- ASM_OUTPUT_LABEL (STREAM, NAME); \
- } \
- aof_delete_import ((NAME)); \
-}
-
-#define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
- aof_add_import ((NAME))
-
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(STREAM,SYMREF) \
- (fprintf ((STREAM), "\tIMPORT\t"), \
- assemble_name ((STREAM), XSTR ((SYMREF), 0)), \
- fputc ('\n', (STREAM)))
-
-#define ASM_OUTPUT_LABELREF(STREAM,NAME) \
- fprintf ((STREAM), "|%s|", NAME)
-
-#define ASM_GENERATE_INTERNAL_LABEL(STRING,PREFIX,NUM) \
- sprintf ((STRING), "*|%s..%d|", (PREFIX), (NUM))
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTVAR,NAME,NUMBER) \
- ((OUTVAR) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER)))
-
-/* How initialization functions are handled */
-
-#define CTORS_SECTION_ASM_OP "AREA\t|C$$gnu_ctorsvec|, DATA, READONLY"
-#define DTORS_SECTION_ASM_OP "AREA\t|C$$gnu_dtorsvec|, DATA, READONLY"
-
-#define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \
-do { \
- ctor_section (); \
- fprintf ((STREAM), "\tDCD\t"); \
- assemble_name ((STREAM), (NAME)); \
- fputc ('\n', (STREAM)); \
-} while (0);
-
-#define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \
-do { \
- dtor_section (); \
- fprintf ((STREAM), "\tDCD\t"); \
- assemble_name ((STREAM), (NAME)); \
- fputc ('\n', (STREAM)); \
-} while (0);
-
-/* Output of Assembler Instructions */
-
-#define REGISTER_NAMES \
-{ \
- "a1", "a2", "a3", "a4", \
- "v1", "v2", "v3", "v4", \
- "v5", "v6", "sl", "fp", \
- "ip", "sp", "lr", "pc", \
- "f0", "f1", "f2", "f3", \
- "f4", "f5", "f6", "f7", \
- "cc", "sfp", "afp" \
-}
-
-#define ADDITIONAL_REGISTER_NAMES \
-{ \
- {"r0", 0}, {"a1", 0}, \
- {"r1", 1}, {"a2", 1}, \
- {"r2", 2}, {"a3", 2}, \
- {"r3", 3}, {"a4", 3}, \
- {"r4", 4}, {"v1", 4}, \
- {"r5", 5}, {"v2", 5}, \
- {"r6", 6}, {"v3", 6}, \
- {"r7", 7}, {"wr", 7}, \
- {"r8", 8}, {"v5", 8}, \
- {"r9", 9}, {"v6", 9}, \
- {"r10", 10}, {"sl", 10}, {"v7", 10}, \
- {"r11", 11}, {"fp", 11}, \
- {"r12", 12}, {"ip", 12}, \
- {"r13", 13}, {"sp", 13}, \
- {"r14", 14}, {"lr", 14}, \
- {"r15", 15}, {"pc", 15} \
-}
-
-#define REGISTER_PREFIX "__"
-#define USER_LABEL_PREFIX ""
-#define LOCAL_LABEL_PREFIX ""
-
-/* Output of Dispatch Tables */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,VALUE,REL) \
- fprintf ((STREAM), "\tb\t|L..%d|\n", (VALUE))
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \
- fprintf ((STREAM), "\tDCD\t|L..%d|\n", (VALUE))
-
-/* A label marking the start of a jump table is a data label. */
-#define ASM_OUTPUT_CASE_LABEL(STREAM,PREFIX,NUM,TABLE) \
- fprintf ((STREAM), "\tALIGN\n|%s..%d|\n", (PREFIX), (NUM))
-
-/* Assembler Commands for Alignment */
-
-#define ASM_OUTPUT_SKIP(STREAM,NBYTES) \
- fprintf ((STREAM), "\t%%\t%d\n", (NBYTES))
-
-#define ASM_OUTPUT_ALIGN(STREAM,POWER) \
-do { \
- register int amount = 1 << (POWER); \
- if (amount == 2) \
- fprintf ((STREAM), "\tALIGN 2\n"); \
- else if (amount == 4) \
- fprintf ((STREAM), "\tALIGN\n"); \
- else \
- fprintf ((STREAM), "\tALIGN %d\n", amount); \
-} while (0)
-
-#include "arm/arm.h"
-
-#undef DBX_DEBUGGING_INFO
diff --git a/gcc/config/arm/aout.h b/gcc/config/arm/aout.h
deleted file mode 100644
index fbf1ea4660c..00000000000
--- a/gcc/config/arm/aout.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/* Definitions of target machine for GNU compiler, for ARM with a.out
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Richard Earnshaw (rearnsha@armltd.co.uk).
-
-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 ARM_OS_NAME
-#define ARM_OS_NAME "(generic)"
-#endif
-
-/* The text to go at the start of the assembler file */
-#define ASM_FILE_START(STREAM) \
-{ \
- fprintf (STREAM,"%srfp\t.req\t%sr9\n", REGISTER_PREFIX, REGISTER_PREFIX); \
- fprintf (STREAM,"%ssl\t.req\t%sr10\n", REGISTER_PREFIX, REGISTER_PREFIX); \
- fprintf (STREAM,"%sfp\t.req\t%sr11\n", REGISTER_PREFIX, REGISTER_PREFIX); \
- fprintf (STREAM,"%sip\t.req\t%sr12\n", REGISTER_PREFIX, REGISTER_PREFIX); \
- fprintf (STREAM,"%ssp\t.req\t%sr13\n", REGISTER_PREFIX, REGISTER_PREFIX); \
- fprintf (STREAM,"%slr\t.req\t%sr14\n", REGISTER_PREFIX, REGISTER_PREFIX); \
- fprintf (STREAM,"%spc\t.req\t%sr15\n", REGISTER_PREFIX, REGISTER_PREFIX); \
-}
-
-#define ASM_APP_ON ""
-#define ASM_APP_OFF ""
-
-/* Switch to the text or data segment. */
-#define TEXT_SECTION_ASM_OP ".text"
-#define DATA_SECTION_ASM_OP ".data"
-#define BSS_SECTION_ASM_OP ".bss"
-
-#define REGISTER_PREFIX ""
-#define USER_LABEL_PREFIX "_"
-#define LOCAL_LABEL_PREFIX ""
-
-/* The assembler's names for the registers. */
-#ifndef REGISTER_NAMES
-#define REGISTER_NAMES \
-{ \
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
- "cc", "sfp", "afp" \
-}
-#endif
-
-#ifndef ADDITIONAL_REGISTER_NAMES
-#define ADDITIONAL_REGISTER_NAMES \
-{ \
- {"a1", 0}, \
- {"a2", 1}, \
- {"a3", 2}, \
- {"a4", 3}, \
- {"v1", 4}, \
- {"v2", 5}, \
- {"v3", 6}, \
- {"v4", 7}, \
- {"v5", 8}, \
- {"v6", 9}, \
- {"rfp", 9}, /* Gcc used to call it this */ \
- {"sb", 9}, \
- {"v7", 10}, \
- {"r10", 10}, /* sl */ \
- {"r11", 11}, /* fp */ \
- {"r12", 12}, /* ip */ \
- {"r13", 13}, /* sp */ \
- {"r14", 14}, /* lr */ \
- {"r15", 15} /* pc */ \
-}
-#endif
-
-/* Arm Assembler barfs on dollars */
-#define DOLLARS_IN_IDENTIFIERS 0
-
-#define NO_DOLLAR_IN_LABEL
-
-/* DBX register number for a given compiler register number */
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Generate DBX debugging information. riscix.h will undefine this because
- the native assembler does not support stabs. */
-#define DBX_DEBUGGING_INFO 1
-
-/* Acorn dbx moans about continuation chars, so don't use any. */
-#ifndef DBX_CONTIN_LENGTH
-#define DBX_CONTIN_LENGTH 0
-#endif
-
-/* Output a source filename for the debugger. RISCiX dbx insists that the
- ``desc'' field is set to compiler version number >= 315 (sic). */
-#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(STREAM,NAME) \
-do { \
- fprintf (STREAM, ".stabs \"%s\",%d,0,315,%s\n", (NAME), N_SO, \
- &ltext_label_name[1]); \
- text_section (); \
- ASM_OUTPUT_INTERNAL_LABEL (STREAM, "Ltext", 0); \
-} while (0)
-
-/* Output a function label definition. */
-#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
- ASM_OUTPUT_LABEL(STREAM, NAME)
-
-#define ARM_OUTPUT_LABEL(STREAM,NAME) \
-do { \
- assemble_name (STREAM,NAME); \
- fputs (":\n", STREAM); \
-} while (0)
-
-/* Output a globalising directive for a label. */
-#define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
- (fprintf (STREAM, "\t.global\t"), \
- assemble_name (STREAM, NAME), \
- fputc ('\n',STREAM)) \
-
-/* Make an internal label into a string. */
-#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
- sprintf (STRING, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
-
-/* Nothing special is done about jump tables */
-/* #define ASM_OUTPUT_CASE_LABEL(STREAM,PREFIX,NUM,TABLE) */
-/* #define ASM_OUTPUT_CASE_END(STREAM,NUM,TABLE) */
-
-/* Construct a private name. */
-#define ASM_FORMAT_PRIVATE_NAME(OUTVAR,NAME,NUMBER) \
- ((OUTVAR) = (char *) alloca (strlen (NAME) + 10), \
- sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER)))
-
-/* Output an element of a dispatch table. */
-#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \
- fprintf (STREAM, "\t.word\t%sL%d\n", LOCAL_LABEL_PREFIX, VALUE)
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,VALUE,REL) \
- fprintf (STREAM, "\tb\t%sL%d\n", LOCAL_LABEL_PREFIX, (VALUE))
-
-/* Output various types of constants. For real numbers we output hex, with
- a comment containing the "human" value, this allows us to pass NaN's which
- the riscix assembler doesn't understand (it also makes cross-assembling
- less likely to fail). */
-
-#define ASM_OUTPUT_LONG_DOUBLE(STREAM,VALUE) \
-do { char dstr[30]; \
- long l[3]; \
- arm_increase_location (12); \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- fprintf (STREAM, "\t.long 0x%lx,0x%lx,0x%lx\t%s long double %s\n", \
- l[0], l[1], l[2], ASM_COMMENT_START, dstr); \
- } while (0)
-
-
-#define ASM_OUTPUT_DOUBLE(STREAM, VALUE) \
-do { char dstr[30]; \
- long l[2]; \
- arm_increase_location (8); \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.14g", dstr); \
- fprintf (STREAM, "\t.long 0x%lx, 0x%lx\t%s double %s\n", l[0], \
- l[1], ASM_COMMENT_START, dstr); \
- } while (0)
-
-#define ASM_OUTPUT_FLOAT(STREAM, VALUE) \
-do { char dstr[30]; \
- long l; \
- arm_increase_location (4); \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.7g", dstr); \
- fprintf (STREAM, "\t.word 0x%lx\t%s float %s\n", l, \
- ASM_COMMENT_START, dstr); \
- } while (0);
-
-#define ASM_OUTPUT_INT(STREAM, EXP) \
- (fprintf (STREAM, "\t.word\t"), \
- output_addr_const (STREAM, (EXP)), \
- arm_increase_location (4), \
- fputc ('\n', STREAM))
-
-#define ASM_OUTPUT_SHORT(STREAM, EXP) \
- (fprintf (STREAM, "\t.short\t"), \
- output_addr_const (STREAM, (EXP)), \
- arm_increase_location (2), \
- fputc ('\n', STREAM))
-
-#define ASM_OUTPUT_CHAR(STREAM, EXP) \
- (fprintf (STREAM, "\t.byte\t"), \
- output_addr_const (STREAM, (EXP)), \
- arm_increase_location (1), \
- fputc ('\n', STREAM))
-
-#define ASM_OUTPUT_BYTE(STREAM, VALUE) \
- (fprintf (STREAM, "\t.byte\t%d\n", VALUE), \
- arm_increase_location (1))
-
-#define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
- output_ascii_pseudo_op ((STREAM), (unsigned char *)(PTR), (LEN))
-
-/* Output a gap. In fact we fill it with nulls. */
-#define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
- (arm_increase_location (NBYTES), \
- fprintf (STREAM, "\t.space\t%d\n", NBYTES))
-
-/* Align output to a power of two. Horrible /bin/as. */
-#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
- do \
- { \
- register int amount = 1 << (POWER); \
- extern int arm_text_location; \
- \
- if (amount == 2) \
- fprintf (STREAM, "\t.even\n"); \
- else if (amount != 1) \
- fprintf (STREAM, "\t.align\t%d\n", amount - 4); \
- \
- if (in_text_section ()) \
- arm_text_location = ((arm_text_location + amount - 1) \
- & ~(amount - 1)); \
- } while (0)
-
-/* Output a common block */
-#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
- (fprintf (STREAM, "\t.comm\t"), \
- assemble_name ((STREAM), (NAME)), \
- fprintf(STREAM, ", %d\t%s %d\n", ROUNDED, ASM_COMMENT_START, SIZE))
-
-/* Output a local common block. /bin/as can't do this, so hack a `.space' into
- the bss segment. Note that this is *bad* practice. */
-#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM,NAME,SIZE,ALIGN) \
- output_lcomm_directive (STREAM, NAME, SIZE, ALIGN)
-
-/* Output a zero-initialized block. */
-#define ASM_OUTPUT_ALIGNED_BSS(STREAM,DECL,NAME,SIZE,ALIGN) \
- asm_output_aligned_bss(STREAM, DECL, NAME, SIZE, ALIGN)
-
-/* Output a source line for the debugger. */
-/* #define ASM_OUTPUT_SOURCE_LINE(STREAM,LINE) */
-
-/* Output a #ident directive. */
-#define ASM_OUTPUT_IDENT(STREAM,STRING) \
- fprintf (STREAM,"- - - ident %s\n",STRING)
-
-/* The assembler's parentheses characters. */
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-#ifndef ASM_COMMENT_START
-#define ASM_COMMENT_START "@"
-#endif
-
-#include "arm/arm.h"
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
deleted file mode 100644
index fb4705cf405..00000000000
--- a/gcc/config/arm/arm.c
+++ /dev/null
@@ -1,5518 +0,0 @@
-/* Output routines for GCC for ARM/RISCiX.
- Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
- and Martin Simmons (@harleqn.co.uk).
- More major hacks by Richard Earnshaw (rwe11@cl.cam.ac.uk)
-
-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 <stdio.h>
-#include <string.h>
-#include "assert.h"
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "reload.h"
-#include "tree.h"
-#include "expr.h"
-
-/* The maximum number of insns skipped which will be conditionalised if
- possible. */
-#define MAX_INSNS_SKIPPED 5
-
-/* Some function declarations. */
-extern FILE *asm_out_file;
-extern char *output_multi_immediate ();
-extern void arm_increase_location ();
-
-HOST_WIDE_INT int_log2 PROTO ((HOST_WIDE_INT));
-static int get_prologue_size PROTO ((void));
-static int arm_gen_constant PROTO ((enum rtx_code, enum machine_mode,
- HOST_WIDE_INT, rtx, rtx, int, int));
-
-/* Define the information needed to generate branch insns. This is
- stored from the compare operation. */
-
-rtx arm_compare_op0, arm_compare_op1;
-int arm_compare_fp;
-
-/* What type of cpu are we compiling for? */
-enum processor_type arm_cpu;
-
-/* What type of floating point are we compiling for? */
-enum floating_point_type arm_fpu;
-
-/* What program mode is the cpu running in? 26-bit mode or 32-bit mode */
-enum prog_mode_type arm_prgmode;
-
-char *target_cpu_name = ARM_CPU_NAME;
-char *target_fpe_name = NULL;
-
-/* Nonzero if this is an "M" variant of the processor. */
-int arm_fast_multiply = 0;
-
-/* Nonzero if this chip support the ARM Architecture 4 extensions */
-int arm_arch4 = 0;
-
-/* In case of a PRE_INC, POST_INC, PRE_DEC, POST_DEC memory reference, we
- must report the mode of the memory reference from PRINT_OPERAND to
- PRINT_OPERAND_ADDRESS. */
-enum machine_mode output_memory_reference_mode;
-
-/* Nonzero if the prologue must setup `fp'. */
-int current_function_anonymous_args;
-
-/* Location counter of .text segment. */
-int arm_text_location = 0;
-
-/* Set to one if we think that lr is only saved because of subroutine calls,
- but all of these can be `put after' return insns */
-int lr_save_eliminated;
-
-/* A hash table is used to store text segment labels and their associated
- offset from the start of the text segment. */
-struct label_offset
-{
- char *name;
- int offset;
- struct label_offset *cdr;
-};
-
-#define LABEL_HASH_SIZE 257
-
-static struct label_offset *offset_table[LABEL_HASH_SIZE];
-
-/* Set to 1 when a return insn is output, this means that the epilogue
- is not needed. */
-
-static int return_used_this_function;
-
-static int arm_constant_limit = 3;
-
-/* For an explanation of these variables, see final_prescan_insn below. */
-int arm_ccfsm_state;
-enum arm_cond_code arm_current_cc;
-rtx arm_target_insn;
-int arm_target_label;
-
-/* The condition codes of the ARM, and the inverse function. */
-char *arm_condition_codes[] =
-{
- "eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc",
- "hi", "ls", "ge", "lt", "gt", "le", "al", "nv"
-};
-
-static enum arm_cond_code get_arm_condition_code ();
-
-
-/* Initialization code */
-
-struct arm_cpu_select arm_select[3] =
-{
- /* switch name, tune arch */
- { (char *)0, "--with-cpu=", 1, 1 },
- { (char *)0, "-mcpu=", 1, 1 },
- { (char *)0, "-mtune=", 1, 0 },
-};
-
-#define FL_CO_PROC 0x01 /* Has external co-processor bus */
-#define FL_FAST_MULT 0x02 /* Fast multiply */
-#define FL_MODE26 0x04 /* 26-bit mode support */
-#define FL_MODE32 0x08 /* 32-bit mode support */
-#define FL_ARCH4 0x10 /* Architecture rel 4 */
-#define FL_THUMB 0x20 /* Thumb aware */
-struct processors
-{
- char *name;
- enum processor_type type;
- unsigned int flags;
-};
-
-/* Not all of these give usefully different compilation alternatives,
- but there is no simple way of generalizing them. */
-static struct processors all_procs[] =
-{
- {"arm2", PROCESSOR_ARM2, FL_CO_PROC | FL_MODE26},
- {"arm250", PROCESSOR_ARM2, FL_CO_PROC | FL_MODE26},
- {"arm3", PROCESSOR_ARM2, FL_CO_PROC | FL_MODE26},
- {"arm6", PROCESSOR_ARM6, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm60", PROCESSOR_ARM6, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm600", PROCESSOR_ARM6, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm610", PROCESSOR_ARM6, FL_MODE32 | FL_MODE26},
- {"arm620", PROCESSOR_ARM6, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm7", PROCESSOR_ARM7, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm70", PROCESSOR_ARM7, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm7d", PROCESSOR_ARM7, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm7di", PROCESSOR_ARM7, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm7dm", PROCESSOR_ARM7, (FL_CO_PROC | FL_FAST_MULT | FL_MODE32
- | FL_MODE26)},
- {"arm7dmi", PROCESSOR_ARM7, (FL_CO_PROC | FL_FAST_MULT | FL_MODE32
- | FL_MODE26)},
- {"arm700", PROCESSOR_ARM7, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm700i", PROCESSOR_ARM7, FL_CO_PROC | FL_MODE32 | FL_MODE26},
- {"arm710", PROCESSOR_ARM7, FL_MODE32 | FL_MODE26},
- {"arm710c", PROCESSOR_ARM7, FL_MODE32 | FL_MODE26},
- {"arm7100", PROCESSOR_ARM7, FL_MODE32 | FL_MODE26},
- {"arm7500", PROCESSOR_ARM7, FL_MODE32 | FL_MODE26},
- {"arm7tdmi", PROCESSOR_ARM7, (FL_CO_PROC | FL_FAST_MULT | FL_MODE32
- | FL_ARCH4 | FL_THUMB)},
- {NULL, 0, 0}
-};
-
-/* Fix up any incompatible options that the user has specified.
- This has now turned into a maze. */
-void
-arm_override_options ()
-{
- int arm_thumb_aware = 0;
- int flags = 0;
- int i;
- struct arm_cpu_select *ptr;
-
- arm_cpu = PROCESSOR_DEFAULT;
- arm_select[0].string = TARGET_CPU_DEFAULT;
-
- for (i = 0; i < sizeof (arm_select) / sizeof (arm_select[0]); i++)
- {
- ptr = &arm_select[i];
- if (ptr->string != (char *)0 && ptr->string[0] != '\0')
- {
- struct processors *sel;
-
- for (sel = all_procs; sel->name != NULL; sel++)
- if (! strcmp (ptr->string, sel->name))
- {
- if (ptr->set_tune_p)
- arm_cpu = sel->type;
-
- if (ptr->set_arch_p)
- flags = sel->flags;
- break;
- }
-
- if (sel->name == NULL)
- error ("bad value (%s) for %s switch", ptr->string, ptr->name);
- }
- }
-
- if (write_symbols != NO_DEBUG && flag_omit_frame_pointer)
- warning ("-g with -fomit-frame-pointer may not give sensible debugging");
-
- if (TARGET_POKE_FUNCTION_NAME)
- target_flags |= ARM_FLAG_APCS_FRAME;
-
- if (TARGET_6)
- {
- warning ("Option '-m6' deprecated. Use: '-mapcs-32' or -mcpu=<proc>");
- target_flags |= ARM_FLAG_APCS_32;
- arm_cpu = PROCESSOR_ARM6;
- }
-
- if (TARGET_3)
- {
- warning ("Option '-m3' deprecated. Use: '-mapcs-26' or -mcpu=<proc>");
- target_flags &= ~ARM_FLAG_APCS_32;
- arm_cpu = PROCESSOR_ARM2;
- }
-
- if (TARGET_APCS_REENT && flag_pic)
- fatal ("-fpic and -mapcs-reent are incompatible");
-
- if (TARGET_APCS_REENT)
- warning ("APCS reentrant code not supported. Ignored");
-
- if (flag_pic)
- warning ("Position independent code not supported. Ignored");
-
- if (TARGET_APCS_FLOAT)
- warning ("Passing floating point arguments in fp regs not yet supported");
-
- if (TARGET_APCS_STACK && ! TARGET_APCS)
- {
- warning ("-mapcs-stack-check incompatible with -mno-apcs-frame");
- target_flags |= ARM_FLAG_APCS_FRAME;
- }
-
- arm_fpu = FP_HARD;
-
- /* Default value for floating point code... if no co-processor
- bus, then schedule for emulated floating point. Otherwise,
- assume the user has an FPA, unless overridden with -mfpe-... */
- if (flags & FL_CO_PROC == 0)
- arm_fpu = FP_SOFT3;
- else
- arm_fpu = FP_HARD;
- arm_fast_multiply = (flags & FL_FAST_MULT) != 0;
- arm_arch4 = (flags & FL_ARCH4) != 0;
- arm_thumb_aware = (flags & FL_THUMB) != 0;
-
- if (target_fpe_name)
- {
- if (strcmp (target_fpe_name, "2") == 0)
- arm_fpu = FP_SOFT2;
- else if (strcmp (target_fpe_name, "3") == 0)
- arm_fpu = FP_SOFT3;
- else
- fatal ("Invalid floating point emulation option: -mfpe-%s",
- target_fpe_name);
- }
-
- if (TARGET_THUMB_INTERWORK && ! arm_thumb_aware)
- {
- warning ("This processor variant does not support Thumb interworking");
- target_flags &= ~ARM_FLAG_THUMB;
- }
-
- if (TARGET_FPE && arm_fpu != FP_HARD)
- arm_fpu = FP_SOFT2;
-
- /* For arm2/3 there is no need to do any scheduling if there is only
- a floating point emulator, or we are doing software floating-point. */
- if ((TARGET_SOFT_FLOAT || arm_fpu != FP_HARD) && arm_cpu == PROCESSOR_ARM2)
- flag_schedule_insns = flag_schedule_insns_after_reload = 0;
-
- arm_prog_mode = TARGET_APCS_32 ? PROG_MODE_PROG32 : PROG_MODE_PROG26;
-}
-
-/* Return 1 if it is possible to return using a single instruction */
-
-int
-use_return_insn ()
-{
- int regno;
-
- if (!reload_completed ||current_function_pretend_args_size
- || current_function_anonymous_args
- || (get_frame_size () && !(TARGET_APCS || frame_pointer_needed)))
- return 0;
-
- /* Can't be done if any of the FPU regs are pushed, since this also
- requires an insn */
- for (regno = 20; regno < 24; regno++)
- if (regs_ever_live[regno])
- return 0;
-
- /* If a function is naked, don't use the "return" insn. */
- if (arm_naked_function_p (current_function_decl))
- return 0;
-
- return 1;
-}
-
-/* Return TRUE if int I is a valid immediate ARM constant. */
-
-int
-const_ok_for_arm (i)
- HOST_WIDE_INT i;
-{
- unsigned HOST_WIDE_INT mask = ~0xFF;
-
- /* Fast return for 0 and powers of 2 */
- if ((i & (i - 1)) == 0)
- return TRUE;
-
- do
- {
- if ((i & mask & (unsigned HOST_WIDE_INT) 0xffffffff) == 0)
- return TRUE;
- mask =
- (mask << 2) | ((mask & (unsigned HOST_WIDE_INT) 0xffffffff)
- >> (32 - 2)) | ~((unsigned HOST_WIDE_INT) 0xffffffff);
- } while (mask != ~0xFF);
-
- return FALSE;
-}
-
-/* Return true if I is a valid constant for the operation CODE. */
-int
-const_ok_for_op (i, code, mode)
- HOST_WIDE_INT i;
- enum rtx_code code;
- enum machine_mode mode;
-{
- if (const_ok_for_arm (i))
- return 1;
-
- switch (code)
- {
- case PLUS:
- return const_ok_for_arm (ARM_SIGN_EXTEND (-i));
-
- case MINUS: /* Should only occur with (MINUS I reg) => rsb */
- case XOR:
- case IOR:
- return 0;
-
- case AND:
- return const_ok_for_arm (ARM_SIGN_EXTEND (~i));
-
- default:
- abort ();
- }
-}
-
-/* Emit a sequence of insns to handle a large constant.
- CODE is the code of the operation required, it can be any of SET, PLUS,
- IOR, AND, XOR, MINUS;
- MODE is the mode in which the operation is being performed;
- VAL is the integer to operate on;
- SOURCE is the other operand (a register, or a null-pointer for SET);
- SUBTARGETS means it is safe to create scratch registers if that will
- either produce a simpler sequence, or we will want to cse the values.
- Return value is the number of insns emitted. */
-
-int
-arm_split_constant (code, mode, val, target, source, subtargets)
- enum rtx_code code;
- enum machine_mode mode;
- HOST_WIDE_INT val;
- rtx target;
- rtx source;
- int subtargets;
-{
- if (subtargets || code == SET
- || (GET_CODE (target) == REG && GET_CODE (source) == REG
- && REGNO (target) != REGNO (source)))
- {
- rtx temp;
-
- if (arm_gen_constant (code, mode, val, target, source, 1, 0)
- > arm_constant_limit + (code != SET))
- {
- if (code == SET)
- {
- /* Currently SET is the only monadic value for CODE, all
- the rest are diadic. */
- emit_insn (gen_rtx (SET, VOIDmode, target, GEN_INT (val)));
- return 1;
- }
- else
- {
- rtx temp = subtargets ? gen_reg_rtx (mode) : target;
-
- emit_insn (gen_rtx (SET, VOIDmode, temp, GEN_INT (val)));
- /* For MINUS, the value is subtracted from, since we never
- have subtraction of a constant. */
- if (code == MINUS)
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (code, mode, temp, source)));
- else
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (code, mode, source, temp)));
- return 2;
- }
- }
- }
-
- return arm_gen_constant (code, mode, val, target, source, subtargets, 1);
-}
-
-/* As above, but extra parameter GENERATE which, if clear, suppresses
- RTL generation. */
-int
-arm_gen_constant (code, mode, val, target, source, subtargets, generate)
- enum rtx_code code;
- enum machine_mode mode;
- HOST_WIDE_INT val;
- rtx target;
- rtx source;
- int subtargets;
- int generate;
-{
- int can_add = 0;
- int can_invert = 0;
- int can_negate = 0;
- int can_negate_initial = 0;
- int can_shift = 0;
- int i;
- int num_bits_set = 0;
- int set_sign_bit_copies = 0;
- int clear_sign_bit_copies = 0;
- int clear_zero_bit_copies = 0;
- int set_zero_bit_copies = 0;
- int insns = 0;
- rtx new_src;
- unsigned HOST_WIDE_INT temp1, temp2;
- unsigned HOST_WIDE_INT remainder = val & 0xffffffff;
-
- /* find out which operations are safe for a given CODE. Also do a quick
- check for degenerate cases; these can occur when DImode operations
- are split. */
- switch (code)
- {
- case SET:
- can_invert = 1;
- can_shift = 1;
- can_negate = 1;
- break;
-
- case PLUS:
- can_negate = 1;
- can_negate_initial = 1;
- break;
-
- case IOR:
- if (remainder == 0xffffffff)
- {
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target,
- GEN_INT (ARM_SIGN_EXTEND (val))));
- return 1;
- }
- if (remainder == 0)
- {
- if (reload_completed && rtx_equal_p (target, source))
- return 0;
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target, source));
- return 1;
- }
- break;
-
- case AND:
- if (remainder == 0)
- {
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target, const0_rtx));
- return 1;
- }
- if (remainder == 0xffffffff)
- {
- if (reload_completed && rtx_equal_p (target, source))
- return 0;
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target, source));
- return 1;
- }
- can_invert = 1;
- break;
-
- case XOR:
- if (remainder == 0)
- {
- if (reload_completed && rtx_equal_p (target, source))
- return 0;
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target, source));
- return 1;
- }
- if (remainder == 0xffffffff)
- {
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (NOT, mode, source)));
- return 1;
- }
-
- /* We don't know how to handle this yet below. */
- abort ();
-
- case MINUS:
- /* We treat MINUS as (val - source), since (source - val) is always
- passed as (source + (-val)). */
- if (remainder == 0)
- {
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (NEG, mode, source)));
- return 1;
- }
- if (const_ok_for_arm (val))
- {
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (MINUS, mode, GEN_INT (val), source)));
- return 1;
- }
- can_negate = 1;
-
- break;
-
- default:
- abort ();
- }
-
- /* If we can do it in one insn get out quickly */
- if (const_ok_for_arm (val)
- || (can_negate_initial && const_ok_for_arm (-val))
- || (can_invert && const_ok_for_arm (~val)))
- {
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target,
- (source ? gen_rtx (code, mode, source,
- GEN_INT (val))
- : GEN_INT (val))));
- return 1;
- }
-
-
- /* Calculate a few attributes that may be useful for specific
- optimizations. */
-
- for (i = 31; i >= 0; i--)
- {
- if ((remainder & (1 << i)) == 0)
- clear_sign_bit_copies++;
- else
- break;
- }
-
- for (i = 31; i >= 0; i--)
- {
- if ((remainder & (1 << i)) != 0)
- set_sign_bit_copies++;
- else
- break;
- }
-
- for (i = 0; i <= 31; i++)
- {
- if ((remainder & (1 << i)) == 0)
- clear_zero_bit_copies++;
- else
- break;
- }
-
- for (i = 0; i <= 31; i++)
- {
- if ((remainder & (1 << i)) != 0)
- set_zero_bit_copies++;
- else
- break;
- }
-
- switch (code)
- {
- case SET:
- /* See if we can do this by sign_extending a constant that is known
- to be negative. This is a good, way of doing it, since the shift
- may well merge into a subsequent insn. */
- if (set_sign_bit_copies > 1)
- {
- if (const_ok_for_arm
- (temp1 = ARM_SIGN_EXTEND (remainder
- << (set_sign_bit_copies - 1))))
- {
- if (generate)
- {
- new_src = subtargets ? gen_reg_rtx (mode) : target;
- emit_insn (gen_rtx (SET, VOIDmode, new_src,
- GEN_INT (temp1)));
- emit_insn (gen_ashrsi3 (target, new_src,
- GEN_INT (set_sign_bit_copies - 1)));
- }
- return 2;
- }
- /* For an inverted constant, we will need to set the low bits,
- these will be shifted out of harm's way. */
- temp1 |= (1 << (set_sign_bit_copies - 1)) - 1;
- if (const_ok_for_arm (~temp1))
- {
- if (generate)
- {
- new_src = subtargets ? gen_reg_rtx (mode) : target;
- emit_insn (gen_rtx (SET, VOIDmode, new_src,
- GEN_INT (temp1)));
- emit_insn (gen_ashrsi3 (target, new_src,
- GEN_INT (set_sign_bit_copies - 1)));
- }
- return 2;
- }
- }
-
- /* See if we can generate this by setting the bottom (or the top)
- 16 bits, and then shifting these into the other half of the
- word. We only look for the simplest cases, to do more would cost
- too much. Be careful, however, not to generate this when the
- alternative would take fewer insns. */
- if (val & 0xffff0000)
- {
- temp1 = remainder & 0xffff0000;
- temp2 = remainder & 0x0000ffff;
-
- /* Overlaps outside this range are best done using other methods. */
- for (i = 9; i < 24; i++)
- {
- if ((((temp2 | (temp2 << i)) & 0xffffffff) == remainder)
- && ! const_ok_for_arm (temp2))
- {
- insns = arm_gen_constant (code, mode, temp2,
- new_src = (subtargets
- ? gen_reg_rtx (mode)
- : target),
- source, subtargets, generate);
- source = new_src;
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (IOR, mode,
- gen_rtx (ASHIFT, mode, source,
- GEN_INT (i)),
- source)));
- return insns + 1;
- }
- }
-
- /* Don't duplicate cases already considered. */
- for (i = 17; i < 24; i++)
- {
- if (((temp1 | (temp1 >> i)) == remainder)
- && ! const_ok_for_arm (temp1))
- {
- insns = arm_gen_constant (code, mode, temp1,
- new_src = (subtargets
- ? gen_reg_rtx (mode)
- : target),
- source, subtargets, generate);
- source = new_src;
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (IOR, mode,
- gen_rtx (LSHIFTRT, mode,
- source, GEN_INT (i)),
- source)));
- return insns + 1;
- }
- }
- }
- break;
-
- case IOR:
- case XOR:
- /* If we have IOR or XOR, and the constant can be loaded in a
- single instruction, and we can find a temporary to put it in,
- then this can be done in two instructions instead of 3-4. */
- if (subtargets
- || (reload_completed && ! reg_mentioned_p (target, source)))
- {
- if (const_ok_for_arm (ARM_SIGN_EXTEND (~ val)))
- {
- if (generate)
- {
- rtx sub = subtargets ? gen_reg_rtx (mode) : target;
-
- emit_insn (gen_rtx (SET, VOIDmode, sub, GEN_INT (val)));
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (code, mode, source, sub)));
- }
- return 2;
- }
- }
-
- if (code == XOR)
- break;
-
- if (set_sign_bit_copies > 8
- && (val & (-1 << (32 - set_sign_bit_copies))) == val)
- {
- if (generate)
- {
- rtx sub = subtargets ? gen_reg_rtx (mode) : target;
- rtx shift = GEN_INT (set_sign_bit_copies);
-
- emit_insn (gen_rtx (SET, VOIDmode, sub,
- gen_rtx (NOT, mode,
- gen_rtx (ASHIFT, mode, source,
- shift))));
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (NOT, mode,
- gen_rtx (LSHIFTRT, mode, sub,
- shift))));
- }
- return 2;
- }
-
- if (set_zero_bit_copies > 8
- && (remainder & ((1 << set_zero_bit_copies) - 1)) == remainder)
- {
- if (generate)
- {
- rtx sub = subtargets ? gen_reg_rtx (mode) : target;
- rtx shift = GEN_INT (set_zero_bit_copies);
-
- emit_insn (gen_rtx (SET, VOIDmode, sub,
- gen_rtx (NOT, mode,
- gen_rtx (LSHIFTRT, mode, source,
- shift))));
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (NOT, mode,
- gen_rtx (ASHIFT, mode, sub,
- shift))));
- }
- return 2;
- }
-
- if (const_ok_for_arm (temp1 = ARM_SIGN_EXTEND (~ val)))
- {
- if (generate)
- {
- rtx sub = subtargets ? gen_reg_rtx (mode) : target;
- emit_insn (gen_rtx (SET, VOIDmode, sub,
- gen_rtx (NOT, mode, source)));
- source = sub;
- if (subtargets)
- sub = gen_reg_rtx (mode);
- emit_insn (gen_rtx (SET, VOIDmode, sub,
- gen_rtx (AND, mode, source,
- GEN_INT (temp1))));
- emit_insn (gen_rtx (SET, VOIDmode, target,
- gen_rtx (NOT, mode, sub)));
- }
- return 3;
- }
- break;
-
- case AND:
- /* See if two shifts will do 2 or more insn's worth of work. */
- if (clear_sign_bit_copies >= 16 && clear_sign_bit_copies < 24)
- {
- HOST_WIDE_INT shift_mask = ((0xffffffff
- << (32 - clear_sign_bit_copies))
- & 0xffffffff);
- rtx new_source;
- rtx shift;
-
- if ((remainder | shift_mask) != 0xffffffff)
- {
- if (generate)
- {
- new_source = subtargets ? gen_reg_rtx (mode) : target;
- insns = arm_gen_constant (AND, mode, remainder | shift_mask,
- new_source, source, subtargets, 1);
- source = new_source;
- }
- else
- insns = arm_gen_constant (AND, mode, remainder | shift_mask,
- new_source, source, subtargets, 0);
- }
-
- if (generate)
- {
- shift = GEN_INT (clear_sign_bit_copies);
- new_source = subtargets ? gen_reg_rtx (mode) : target;
- emit_insn (gen_ashlsi3 (new_source, source, shift));
- emit_insn (gen_lshrsi3 (target, new_source, shift));
- }
-
- return insns + 2;
- }
-
- if (clear_zero_bit_copies >= 16 && clear_zero_bit_copies < 24)
- {
- HOST_WIDE_INT shift_mask = (1 << clear_zero_bit_copies) - 1;
- rtx new_source;
- rtx shift;
-
- if ((remainder | shift_mask) != 0xffffffff)
- {
- if (generate)
- {
- new_source = subtargets ? gen_reg_rtx (mode) : target;
- insns = arm_gen_constant (AND, mode, remainder | shift_mask,
- new_source, source, subtargets, 1);
- source = new_source;
- }
- else
- insns = arm_gen_constant (AND, mode, remainder | shift_mask,
- new_source, source, subtargets, 0);
- }
-
- if (generate)
- {
- shift = GEN_INT (clear_zero_bit_copies);
- new_source = subtargets ? gen_reg_rtx (mode) : target;
- emit_insn (gen_lshrsi3 (new_source, source, shift));
- emit_insn (gen_ashlsi3 (target, new_source, shift));
- }
-
- return insns + 2;
- }
-
- break;
-
- default:
- break;
- }
-
- for (i = 0; i < 32; i++)
- if (remainder & (1 << i))
- num_bits_set++;
-
- if (code == AND || (can_invert && num_bits_set > 16))
- remainder = (~remainder) & 0xffffffff;
- else if (code == PLUS && num_bits_set > 16)
- remainder = (-remainder) & 0xffffffff;
- else
- {
- can_invert = 0;
- can_negate = 0;
- }
-
- /* Now try and find a way of doing the job in either two or three
- instructions.
- We start by looking for the largest block of zeros that are aligned on
- a 2-bit boundary, we then fill up the temps, wrapping around to the
- top of the word when we drop off the bottom.
- In the worst case this code should produce no more than four insns. */
- {
- int best_start = 0;
- int best_consecutive_zeros = 0;
-
- for (i = 0; i < 32; i += 2)
- {
- int consecutive_zeros = 0;
-
- if (! (remainder & (3 << i)))
- {
- while ((i < 32) && ! (remainder & (3 << i)))
- {
- consecutive_zeros += 2;
- i += 2;
- }
- if (consecutive_zeros > best_consecutive_zeros)
- {
- best_consecutive_zeros = consecutive_zeros;
- best_start = i - consecutive_zeros;
- }
- i -= 2;
- }
- }
-
- /* Now start emitting the insns, starting with the one with the highest
- bit set: we do this so that the smallest number will be emitted last;
- this is more likely to be combinable with addressing insns. */
- i = best_start;
- do
- {
- int end;
-
- if (i <= 0)
- i += 32;
- if (remainder & (3 << (i - 2)))
- {
- end = i - 8;
- if (end < 0)
- end += 32;
- temp1 = remainder & ((0x0ff << end)
- | ((i < end) ? (0xff >> (32 - end)) : 0));
- remainder &= ~temp1;
-
- if (code == SET)
- {
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode,
- new_src = (subtargets
- ? gen_reg_rtx (mode)
- : target),
- GEN_INT (can_invert ? ~temp1 : temp1)));
- can_invert = 0;
- code = PLUS;
- }
- else if (code == MINUS)
- {
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode,
- new_src = (subtargets
- ? gen_reg_rtx (mode)
- : target),
- gen_rtx (code, mode, GEN_INT (temp1),
- source)));
- code = PLUS;
- }
- else
- {
- if (generate)
- emit_insn (gen_rtx (SET, VOIDmode,
- new_src = (remainder
- ? (subtargets
- ? gen_reg_rtx (mode)
- : target)
- : target),
- gen_rtx (code, mode, source,
- GEN_INT (can_invert ? ~temp1
- : (can_negate
- ? -temp1
- : temp1)))));
- }
-
- insns++;
- source = new_src;
- i -= 6;
- }
- i -= 2;
- } while (remainder);
- }
- return insns;
-}
-
-/* Canonicalize a comparison so that we are more likely to recognize it.
- This can be done for a few constant compares, where we can make the
- immediate value easier to load. */
-enum rtx_code
-arm_canonicalize_comparison (code, op1)
- enum rtx_code code;
- rtx *op1;
-{
- HOST_WIDE_INT i = INTVAL (*op1);
-
- switch (code)
- {
- case EQ:
- case NE:
- return code;
-
- case GT:
- case LE:
- if (i != (1 << (HOST_BITS_PER_WIDE_INT - 1) - 1)
- && (const_ok_for_arm (i+1) || const_ok_for_arm (- (i+1))))
- {
- *op1 = GEN_INT (i+1);
- return code == GT ? GE : LT;
- }
- break;
-
- case GE:
- case LT:
- if (i != (1 << (HOST_BITS_PER_WIDE_INT - 1))
- && (const_ok_for_arm (i-1) || const_ok_for_arm (- (i-1))))
- {
- *op1 = GEN_INT (i-1);
- return code == GE ? GT : LE;
- }
- break;
-
- case GTU:
- case LEU:
- if (i != ~0
- && (const_ok_for_arm (i+1) || const_ok_for_arm (- (i+1))))
- {
- *op1 = GEN_INT (i + 1);
- return code == GTU ? GEU : LTU;
- }
- break;
-
- case GEU:
- case LTU:
- if (i != 0
- && (const_ok_for_arm (i - 1) || const_ok_for_arm (- (i - 1))))
- {
- *op1 = GEN_INT (i - 1);
- return code == GEU ? GTU : LEU;
- }
- break;
-
- default:
- abort ();
- }
-
- return code;
-}
-
-
-/* Handle aggregates that are not laid out in a BLKmode element.
- This is a sub-element of RETURN_IN_MEMORY. */
-int
-arm_return_in_memory (type)
- tree type;
-{
- if (TREE_CODE (type) == RECORD_TYPE)
- {
- tree field;
-
- /* For a struct, we can return in a register if every element was a
- bit-field. */
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- if (TREE_CODE (field) != FIELD_DECL
- || ! DECL_BIT_FIELD_TYPE (field))
- return 1;
-
- return 0;
- }
- else if (TREE_CODE (type) == UNION_TYPE)
- {
- tree field;
-
- /* Unions can be returned in registers if every element is
- integral, or can be returned in an integer register. */
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- {
- if (TREE_CODE (field) != FIELD_DECL
- || (AGGREGATE_TYPE_P (TREE_TYPE (field))
- && RETURN_IN_MEMORY (TREE_TYPE (field)))
- || FLOAT_TYPE_P (TREE_TYPE (field)))
- return 1;
- }
- return 0;
- }
- /* XXX Not sure what should be done for other aggregates, so put them in
- memory. */
- return 1;
-}
-
-#define REG_OR_SUBREG_REG(X) \
- (GET_CODE (X) == REG \
- || (GET_CODE (X) == SUBREG && GET_CODE (SUBREG_REG (X)) == REG))
-
-#define REG_OR_SUBREG_RTX(X) \
- (GET_CODE (X) == REG ? (X) : SUBREG_REG (X))
-
-#define ARM_FRAME_RTX(X) \
- ((X) == frame_pointer_rtx || (X) == stack_pointer_rtx \
- || (X) == arg_pointer_rtx)
-
-int
-arm_rtx_costs (x, code, outer_code)
- rtx x;
- enum rtx_code code, outer_code;
-{
- enum machine_mode mode = GET_MODE (x);
- enum rtx_code subcode;
- int extra_cost;
-
- switch (code)
- {
- case MEM:
- /* Memory costs quite a lot for the first word, but subsequent words
- load at the equivalent of a single insn each. */
- return (10 + 4 * ((GET_MODE_SIZE (mode) - 1) / UNITS_PER_WORD)
- + (CONSTANT_POOL_ADDRESS_P (x) ? 4 : 0));
-
- case DIV:
- case MOD:
- return 100;
-
- case ROTATE:
- if (mode == SImode && GET_CODE (XEXP (x, 1)) == REG)
- return 4;
- /* Fall through */
- case ROTATERT:
- if (mode != SImode)
- return 8;
- /* Fall through */
- case ASHIFT: case LSHIFTRT: case ASHIFTRT:
- if (mode == DImode)
- return (8 + (GET_CODE (XEXP (x, 1)) == CONST_INT ? 0 : 8)
- + ((GET_CODE (XEXP (x, 0)) == REG
- || (GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_CODE (SUBREG_REG (XEXP (x, 0))) == REG))
- ? 0 : 8));
- return (1 + ((GET_CODE (XEXP (x, 0)) == REG
- || (GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_CODE (SUBREG_REG (XEXP (x, 0))) == REG))
- ? 0 : 4)
- + ((GET_CODE (XEXP (x, 1)) == REG
- || (GET_CODE (XEXP (x, 1)) == SUBREG
- && GET_CODE (SUBREG_REG (XEXP (x, 1))) == REG)
- || (GET_CODE (XEXP (x, 1)) == CONST_INT))
- ? 0 : 4));
-
- case MINUS:
- if (mode == DImode)
- return (4 + (REG_OR_SUBREG_REG (XEXP (x, 1)) ? 0 : 8)
- + ((REG_OR_SUBREG_REG (XEXP (x, 0))
- || (GET_CODE (XEXP (x, 0)) == CONST_INT
- && const_ok_for_arm (INTVAL (XEXP (x, 0)))))
- ? 0 : 8));
-
- if (GET_MODE_CLASS (mode) == MODE_FLOAT)
- return (2 + ((REG_OR_SUBREG_REG (XEXP (x, 1))
- || (GET_CODE (XEXP (x, 1)) == CONST_DOUBLE
- && const_double_rtx_ok_for_fpu (XEXP (x, 1))))
- ? 0 : 8)
- + ((REG_OR_SUBREG_REG (XEXP (x, 0))
- || (GET_CODE (XEXP (x, 0)) == CONST_DOUBLE
- && const_double_rtx_ok_for_fpu (XEXP (x, 0))))
- ? 0 : 8));
-
- if (((GET_CODE (XEXP (x, 0)) == CONST_INT
- && const_ok_for_arm (INTVAL (XEXP (x, 0)))
- && REG_OR_SUBREG_REG (XEXP (x, 1))))
- || (((subcode = GET_CODE (XEXP (x, 1))) == ASHIFT
- || subcode == ASHIFTRT || subcode == LSHIFTRT
- || subcode == ROTATE || subcode == ROTATERT
- || (subcode == MULT
- && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT
- && ((INTVAL (XEXP (XEXP (x, 1), 1)) &
- (INTVAL (XEXP (XEXP (x, 1), 1)) - 1)) == 0)))
- && REG_OR_SUBREG_REG (XEXP (XEXP (x, 1), 0))
- && (REG_OR_SUBREG_REG (XEXP (XEXP (x, 1), 1))
- || GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT)
- && REG_OR_SUBREG_REG (XEXP (x, 0))))
- return 1;
- /* Fall through */
-
- case PLUS:
- if (GET_MODE_CLASS (mode) == MODE_FLOAT)
- return (2 + (REG_OR_SUBREG_REG (XEXP (x, 0)) ? 0 : 8)
- + ((REG_OR_SUBREG_REG (XEXP (x, 1))
- || (GET_CODE (XEXP (x, 1)) == CONST_DOUBLE
- && const_double_rtx_ok_for_fpu (XEXP (x, 1))))
- ? 0 : 8));
-
- /* Fall through */
- case AND: case XOR: case IOR:
- extra_cost = 0;
-
- /* Normally the frame registers will be spilt into reg+const during
- reload, so it is a bad idea to combine them with other instructions,
- since then they might not be moved outside of loops. As a compromise
- we allow integration with ops that have a constant as their second
- operand. */
- if ((REG_OR_SUBREG_REG (XEXP (x, 0))
- && ARM_FRAME_RTX (REG_OR_SUBREG_RTX (XEXP (x, 0)))
- && GET_CODE (XEXP (x, 1)) != CONST_INT)
- || (REG_OR_SUBREG_REG (XEXP (x, 0))
- && ARM_FRAME_RTX (REG_OR_SUBREG_RTX (XEXP (x, 0)))))
- extra_cost = 4;
-
- if (mode == DImode)
- return (4 + extra_cost + (REG_OR_SUBREG_REG (XEXP (x, 0)) ? 0 : 8)
- + ((REG_OR_SUBREG_REG (XEXP (x, 1))
- || (GET_CODE (XEXP (x, 1)) == CONST_INT
- && const_ok_for_op (INTVAL (XEXP (x, 1)), code, mode)))
- ? 0 : 8));
-
- if (REG_OR_SUBREG_REG (XEXP (x, 0)))
- return (1 + (GET_CODE (XEXP (x, 1)) == CONST_INT ? 0 : extra_cost)
- + ((REG_OR_SUBREG_REG (XEXP (x, 1))
- || (GET_CODE (XEXP (x, 1)) == CONST_INT
- && const_ok_for_op (INTVAL (XEXP (x, 1)), code, mode)))
- ? 0 : 4));
-
- else if (REG_OR_SUBREG_REG (XEXP (x, 1)))
- return (1 + extra_cost
- + ((((subcode = GET_CODE (XEXP (x, 0))) == ASHIFT
- || subcode == LSHIFTRT || subcode == ASHIFTRT
- || subcode == ROTATE || subcode == ROTATERT
- || (subcode == MULT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && ((INTVAL (XEXP (XEXP (x, 0), 1)) &
- (INTVAL (XEXP (XEXP (x, 0), 1)) - 1)) == 0))
- && (REG_OR_SUBREG_REG (XEXP (XEXP (x, 0), 0)))
- && ((REG_OR_SUBREG_REG (XEXP (XEXP (x, 0), 1)))
- || GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)))
- ? 0 : 4));
-
- return 8;
-
- case MULT:
- if (arm_fast_multiply && mode == DImode
- && (GET_CODE (XEXP (x, 0)) == GET_CODE (XEXP (x, 1)))
- && (GET_CODE (XEXP (x, 0)) == ZERO_EXTEND
- || GET_CODE (XEXP (x, 0)) == SIGN_EXTEND))
- return 8;
-
- if (GET_MODE_CLASS (mode) == MODE_FLOAT
- || mode == DImode)
- return 30;
-
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- {
- unsigned HOST_WIDE_INT i = (INTVAL (XEXP (x, 1))
- & (unsigned HOST_WIDE_INT) 0xffffffff);
- int add_cost = const_ok_for_arm (i) ? 4 : 8;
- int j;
- int booth_unit_size = (arm_fast_multiply ? 8 : 2);
-
- for (j = 0; i && j < 32; j += booth_unit_size)
- {
- i >>= booth_unit_size;
- add_cost += 2;
- }
-
- return add_cost;
- }
-
- return ((arm_fast_multiply ? 8 : 30)
- + (REG_OR_SUBREG_REG (XEXP (x, 0)) ? 0 : 4)
- + (REG_OR_SUBREG_REG (XEXP (x, 1)) ? 0 : 4));
-
- case NEG:
- if (GET_MODE_CLASS (mode) == MODE_FLOAT)
- return 4 + (REG_OR_SUBREG_REG (XEXP (x, 0)) ? 0 : 6);
- /* Fall through */
- case NOT:
- if (mode == DImode)
- return 4 + (REG_OR_SUBREG_REG (XEXP (x, 0)) ? 0 : 4);
-
- return 1 + (REG_OR_SUBREG_REG (XEXP (x, 0)) ? 0 : 4);
-
- case IF_THEN_ELSE:
- if (GET_CODE (XEXP (x, 1)) == PC || GET_CODE (XEXP (x, 2)) == PC)
- return 14;
- return 2;
-
- case COMPARE:
- return 1;
-
- case ABS:
- return 4 + (mode == DImode ? 4 : 0);
-
- case SIGN_EXTEND:
- if (GET_MODE (XEXP (x, 0)) == QImode)
- return (4 + (mode == DImode ? 4 : 0)
- + (GET_CODE (XEXP (x, 0)) == MEM ? 10 : 0));
- /* Fall through */
- case ZERO_EXTEND:
- switch (GET_MODE (XEXP (x, 0)))
- {
- case QImode:
- return (1 + (mode == DImode ? 4 : 0)
- + (GET_CODE (XEXP (x, 0)) == MEM ? 10 : 0));
-
- case HImode:
- return (4 + (mode == DImode ? 4 : 0)
- + (GET_CODE (XEXP (x, 0)) == MEM ? 10 : 0));
-
- case SImode:
- return (1 + (GET_CODE (XEXP (x, 0)) == MEM ? 10 : 0));
- }
- abort ();
-
- default:
- return 99;
- }
-}
-
-/* This code has been fixed for cross compilation. */
-
-static int fpa_consts_inited = 0;
-
-char *strings_fpa[8] = {
- "0", "1", "2", "3",
- "4", "5", "0.5", "10"
-};
-
-static REAL_VALUE_TYPE values_fpa[8];
-
-static void
-init_fpa_table ()
-{
- int i;
- REAL_VALUE_TYPE r;
-
- for (i = 0; i < 8; i++)
- {
- r = REAL_VALUE_ATOF (strings_fpa[i], DFmode);
- values_fpa[i] = r;
- }
-
- fpa_consts_inited = 1;
-}
-
-/* Return TRUE if rtx X is a valid immediate FPU constant. */
-
-int
-const_double_rtx_ok_for_fpu (x)
- rtx x;
-{
- REAL_VALUE_TYPE r;
- int i;
-
- if (!fpa_consts_inited)
- init_fpa_table ();
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
- if (REAL_VALUE_MINUS_ZERO (r))
- return 0;
-
- for (i = 0; i < 8; i++)
- if (REAL_VALUES_EQUAL (r, values_fpa[i]))
- return 1;
-
- return 0;
-}
-
-/* Return TRUE if rtx X is a valid immediate FPU constant. */
-
-int
-neg_const_double_rtx_ok_for_fpu (x)
- rtx x;
-{
- REAL_VALUE_TYPE r;
- int i;
-
- if (!fpa_consts_inited)
- init_fpa_table ();
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
- r = REAL_VALUE_NEGATE (r);
- if (REAL_VALUE_MINUS_ZERO (r))
- return 0;
-
- for (i = 0; i < 8; i++)
- if (REAL_VALUES_EQUAL (r, values_fpa[i]))
- return 1;
-
- return 0;
-}
-
-/* Predicates for `match_operand' and `match_operator'. */
-
-/* s_register_operand is the same as register_operand, but it doesn't accept
- (SUBREG (MEM)...).
-
- This function exists because at the time it was put in it led to better
- code. SUBREG(MEM) always needs a reload in the places where
- s_register_operand is used, and this seemed to lead to excessive
- reloading. */
-
-int
-s_register_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_MODE (op) != mode && mode != VOIDmode)
- return 0;
-
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
-
- /* We don't consider registers whose class is NO_REGS
- to be a register operand. */
- return (GET_CODE (op) == REG
- && (REGNO (op) >= FIRST_PSEUDO_REGISTER
- || REGNO_REG_CLASS (REGNO (op)) != NO_REGS));
-}
-
-/* Only accept reg, subreg(reg), const_int. */
-
-int
-reg_or_int_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return 1;
-
- if (GET_MODE (op) != mode && mode != VOIDmode)
- return 0;
-
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
-
- /* We don't consider registers whose class is NO_REGS
- to be a register operand. */
- return (GET_CODE (op) == REG
- && (REGNO (op) >= FIRST_PSEUDO_REGISTER
- || REGNO_REG_CLASS (REGNO (op)) != NO_REGS));
-}
-
-/* Return 1 if OP is an item in memory, given that we are in reload. */
-
-int
-reload_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int regno = true_regnum (op);
-
- return (! CONSTANT_P (op)
- && (regno == -1
- || (GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER)));
-}
-
-/* Return TRUE for valid operands for the rhs of an ARM instruction. */
-
-int
-arm_rhs_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (s_register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && const_ok_for_arm (INTVAL (op))));
-}
-
-/* Return TRUE for valid operands for the rhs of an ARM instruction, or a load.
- */
-
-int
-arm_rhsm_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (s_register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && const_ok_for_arm (INTVAL (op)))
- || memory_operand (op, mode));
-}
-
-/* Return TRUE for valid operands for the rhs of an ARM instruction, or if a
- constant that is valid when negated. */
-
-int
-arm_add_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (s_register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT
- && (const_ok_for_arm (INTVAL (op))
- || const_ok_for_arm (-INTVAL (op)))));
-}
-
-int
-arm_not_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (s_register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT
- && (const_ok_for_arm (INTVAL (op))
- || const_ok_for_arm (~INTVAL (op)))));
-}
-
-/* Return TRUE if the operand is a memory reference which contains an
- offsettable address. */
-int
-offsettable_memory_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (mode == VOIDmode)
- mode = GET_MODE (op);
-
- return (mode == GET_MODE (op)
- && GET_CODE (op) == MEM
- && offsettable_address_p (reload_completed | reload_in_progress,
- mode, XEXP (op, 0)));
-}
-
-/* Return TRUE if the operand is a memory reference which is, or can be
- made word aligned by adjusting the offset. */
-int
-alignable_memory_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- rtx reg;
-
- if (mode == VOIDmode)
- mode = GET_MODE (op);
-
- if (mode != GET_MODE (op) || GET_CODE (op) != MEM)
- return 0;
-
- op = XEXP (op, 0);
-
- return ((GET_CODE (reg = op) == REG
- || (GET_CODE (op) == SUBREG
- && GET_CODE (reg = SUBREG_REG (op)) == REG)
- || (GET_CODE (op) == PLUS
- && GET_CODE (XEXP (op, 1)) == CONST_INT
- && (GET_CODE (reg = XEXP (op, 0)) == REG
- || (GET_CODE (XEXP (op, 0)) == SUBREG
- && GET_CODE (reg = SUBREG_REG (XEXP (op, 0))) == REG))))
- && REGNO_POINTER_ALIGN (REGNO (reg)) >= 4);
-}
-
-/* Return TRUE for valid operands for the rhs of an FPU instruction. */
-
-int
-fpu_rhs_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (s_register_operand (op, mode))
- return TRUE;
- else if (GET_CODE (op) == CONST_DOUBLE)
- return (const_double_rtx_ok_for_fpu (op));
-
- return FALSE;
-}
-
-int
-fpu_add_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (s_register_operand (op, mode))
- return TRUE;
- else if (GET_CODE (op) == CONST_DOUBLE)
- return (const_double_rtx_ok_for_fpu (op)
- || neg_const_double_rtx_ok_for_fpu (op));
-
- return FALSE;
-}
-
-/* Return nonzero if OP is a constant power of two. */
-
-int
-power_of_two_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- {
- HOST_WIDE_INT value = INTVAL(op);
- return value != 0 && (value & (value - 1)) == 0;
- }
- return FALSE;
-}
-
-/* Return TRUE for a valid operand of a DImode operation.
- Either: REG, CONST_DOUBLE or MEM(DImode_address).
- Note that this disallows MEM(REG+REG), but allows
- MEM(PRE/POST_INC/DEC(REG)). */
-
-int
-di_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (s_register_operand (op, mode))
- return TRUE;
-
- switch (GET_CODE (op))
- {
- case CONST_DOUBLE:
- case CONST_INT:
- return TRUE;
-
- case MEM:
- return memory_address_p (DImode, XEXP (op, 0));
-
- default:
- return FALSE;
- }
-}
-
-/* Return TRUE for a valid operand of a DFmode operation when -msoft-float.
- Either: REG, CONST_DOUBLE or MEM(DImode_address).
- Note that this disallows MEM(REG+REG), but allows
- MEM(PRE/POST_INC/DEC(REG)). */
-
-int
-soft_df_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (s_register_operand (op, mode))
- return TRUE;
-
- switch (GET_CODE (op))
- {
- case CONST_DOUBLE:
- return TRUE;
-
- case MEM:
- return memory_address_p (DFmode, XEXP (op, 0));
-
- default:
- return FALSE;
- }
-}
-
-/* Return TRUE for valid index operands. */
-
-int
-index_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (s_register_operand(op, mode)
- || (immediate_operand (op, mode)
- && INTVAL (op) < 4096 && INTVAL (op) > -4096));
-}
-
-/* Return TRUE for valid shifts by a constant. This also accepts any
- power of two on the (somewhat overly relaxed) assumption that the
- shift operator in this case was a mult. */
-
-int
-const_shift_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (power_of_two_operand (op, mode)
- || (immediate_operand (op, mode)
- && (INTVAL (op) < 32 && INTVAL (op) > 0)));
-}
-
-/* Return TRUE for arithmetic operators which can be combined with a multiply
- (shift). */
-
-int
-shiftable_operator (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- if (GET_MODE (x) != mode)
- return FALSE;
- else
- {
- enum rtx_code code = GET_CODE (x);
-
- return (code == PLUS || code == MINUS
- || code == IOR || code == XOR || code == AND);
- }
-}
-
-/* Return TRUE for shift operators. */
-
-int
-shift_operator (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- if (GET_MODE (x) != mode)
- return FALSE;
- else
- {
- enum rtx_code code = GET_CODE (x);
-
- if (code == MULT)
- return power_of_two_operand (XEXP (x, 1));
-
- return (code == ASHIFT || code == ASHIFTRT || code == LSHIFTRT
- || code == ROTATERT);
- }
-}
-
-int equality_operator (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- return GET_CODE (x) == EQ || GET_CODE (x) == NE;
-}
-
-/* Return TRUE for SMIN SMAX UMIN UMAX operators. */
-
-int
-minmax_operator (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (x);
-
- if (GET_MODE (x) != mode)
- return FALSE;
-
- return code == SMIN || code == SMAX || code == UMIN || code == UMAX;
-}
-
-/* return TRUE if x is EQ or NE */
-
-/* Return TRUE if this is the condition code register, if we aren't given
- a mode, accept any class CCmode register */
-
-int
-cc_register (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- if (mode == VOIDmode)
- {
- mode = GET_MODE (x);
- if (GET_MODE_CLASS (mode) != MODE_CC)
- return FALSE;
- }
-
- if (mode == GET_MODE (x) && GET_CODE (x) == REG && REGNO (x) == 24)
- return TRUE;
-
- return FALSE;
-}
-
-/* Return TRUE if this is the condition code register, if we aren't given
- a mode, accept any class CCmode register which indicates a dominance
- expression. */
-
-int
-dominant_cc_register (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- if (mode == VOIDmode)
- {
- mode = GET_MODE (x);
- if (GET_MODE_CLASS (mode) != MODE_CC)
- return FALSE;
- }
-
- if (mode != CC_DNEmode && mode != CC_DEQmode
- && mode != CC_DLEmode && mode != CC_DLTmode
- && mode != CC_DGEmode && mode != CC_DGTmode
- && mode != CC_DLEUmode && mode != CC_DLTUmode
- && mode != CC_DGEUmode && mode != CC_DGTUmode)
- return FALSE;
-
- if (mode == GET_MODE (x) && GET_CODE (x) == REG && REGNO (x) == 24)
- return TRUE;
-
- return FALSE;
-}
-
-/* Return TRUE if X references a SYMBOL_REF. */
-int
-symbol_mentioned_p (x)
- rtx x;
-{
- register char *fmt;
- register int i;
-
- if (GET_CODE (x) == SYMBOL_REF)
- return 1;
-
- fmt = GET_RTX_FORMAT (GET_CODE (x));
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
-
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (symbol_mentioned_p (XVECEXP (x, i, j)))
- return 1;
- }
- else if (fmt[i] == 'e' && symbol_mentioned_p (XEXP (x, i)))
- return 1;
- }
-
- return 0;
-}
-
-/* Return TRUE if X references a LABEL_REF. */
-int
-label_mentioned_p (x)
- rtx x;
-{
- register char *fmt;
- register int i;
-
- if (GET_CODE (x) == LABEL_REF)
- return 1;
-
- fmt = GET_RTX_FORMAT (GET_CODE (x));
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
-
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (label_mentioned_p (XVECEXP (x, i, j)))
- return 1;
- }
- else if (fmt[i] == 'e' && label_mentioned_p (XEXP (x, i)))
- return 1;
- }
-
- return 0;
-}
-
-enum rtx_code
-minmax_code (x)
- rtx x;
-{
- enum rtx_code code = GET_CODE (x);
-
- if (code == SMAX)
- return GE;
- else if (code == SMIN)
- return LE;
- else if (code == UMIN)
- return LEU;
- else if (code == UMAX)
- return GEU;
-
- abort ();
-}
-
-/* Return 1 if memory locations are adjacent */
-
-int
-adjacent_mem_locations (a, b)
- rtx a, b;
-{
- int val0 = 0, val1 = 0;
- int reg0, reg1;
-
- if ((GET_CODE (XEXP (a, 0)) == REG
- || (GET_CODE (XEXP (a, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (a, 0), 1)) == CONST_INT))
- && (GET_CODE (XEXP (b, 0)) == REG
- || (GET_CODE (XEXP (b, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (b, 0), 1)) == CONST_INT)))
- {
- if (GET_CODE (XEXP (a, 0)) == PLUS)
- {
- reg0 = REGNO (XEXP (XEXP (a, 0), 0));
- val0 = INTVAL (XEXP (XEXP (a, 0), 1));
- }
- else
- reg0 = REGNO (XEXP (a, 0));
- if (GET_CODE (XEXP (b, 0)) == PLUS)
- {
- reg1 = REGNO (XEXP (XEXP (b, 0), 0));
- val1 = INTVAL (XEXP (XEXP (b, 0), 1));
- }
- else
- reg1 = REGNO (XEXP (b, 0));
- return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4);
- }
- return 0;
-}
-
-/* Return 1 if OP is a load multiple operation. It is known to be
- parallel and the first section will be tested. */
-
-int
-load_multiple_operation (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- HOST_WIDE_INT count = XVECLEN (op, 0);
- int dest_regno;
- rtx src_addr;
- HOST_WIDE_INT i = 1, base = 0;
- rtx elt;
-
- if (count <= 1
- || GET_CODE (XVECEXP (op, 0, 0)) != SET)
- return 0;
-
- /* Check to see if this might be a write-back */
- if (GET_CODE (SET_SRC (elt = XVECEXP (op, 0, 0))) == PLUS)
- {
- i++;
- base = 1;
-
- /* Now check it more carefully */
- if (GET_CODE (SET_DEST (elt)) != REG
- || GET_CODE (XEXP (SET_SRC (elt), 0)) != REG
- || REGNO (XEXP (SET_SRC (elt), 0)) != REGNO (SET_DEST (elt))
- || GET_CODE (XEXP (SET_SRC (elt), 1)) != CONST_INT
- || INTVAL (XEXP (SET_SRC (elt), 1)) != (count - 2) * 4
- || GET_CODE (XVECEXP (op, 0, count - 1)) != CLOBBER
- || GET_CODE (XEXP (XVECEXP (op, 0, count - 1), 0)) != REG
- || REGNO (XEXP (XVECEXP (op, 0, count - 1), 0))
- != REGNO (SET_DEST (elt)))
- return 0;
-
- count--;
- }
-
- /* Perform a quick check so we don't blow up below. */
- if (count <= i
- || GET_CODE (XVECEXP (op, 0, i - 1)) != SET
- || GET_CODE (SET_DEST (XVECEXP (op, 0, i - 1))) != REG
- || GET_CODE (SET_SRC (XVECEXP (op, 0, i - 1))) != MEM)
- return 0;
-
- dest_regno = REGNO (SET_DEST (XVECEXP (op, 0, i - 1)));
- src_addr = XEXP (SET_SRC (XVECEXP (op, 0, i - 1)), 0);
-
- for (; i < count; i++)
- {
- rtx elt = XVECEXP (op, 0, i);
-
- if (GET_CODE (elt) != SET
- || GET_CODE (SET_DEST (elt)) != REG
- || GET_MODE (SET_DEST (elt)) != SImode
- || REGNO (SET_DEST (elt)) != dest_regno + i - base
- || GET_CODE (SET_SRC (elt)) != MEM
- || GET_MODE (SET_SRC (elt)) != SImode
- || GET_CODE (XEXP (SET_SRC (elt), 0)) != PLUS
- || ! rtx_equal_p (XEXP (XEXP (SET_SRC (elt), 0), 0), src_addr)
- || GET_CODE (XEXP (XEXP (SET_SRC (elt), 0), 1)) != CONST_INT
- || INTVAL (XEXP (XEXP (SET_SRC (elt), 0), 1)) != (i - base) * 4)
- return 0;
- }
-
- return 1;
-}
-
-/* Return 1 if OP is a store multiple operation. It is known to be
- parallel and the first section will be tested. */
-
-int
-store_multiple_operation (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- HOST_WIDE_INT count = XVECLEN (op, 0);
- int src_regno;
- rtx dest_addr;
- HOST_WIDE_INT i = 1, base = 0;
- rtx elt;
-
- if (count <= 1
- || GET_CODE (XVECEXP (op, 0, 0)) != SET)
- return 0;
-
- /* Check to see if this might be a write-back */
- if (GET_CODE (SET_SRC (elt = XVECEXP (op, 0, 0))) == PLUS)
- {
- i++;
- base = 1;
-
- /* Now check it more carefully */
- if (GET_CODE (SET_DEST (elt)) != REG
- || GET_CODE (XEXP (SET_SRC (elt), 0)) != REG
- || REGNO (XEXP (SET_SRC (elt), 0)) != REGNO (SET_DEST (elt))
- || GET_CODE (XEXP (SET_SRC (elt), 1)) != CONST_INT
- || INTVAL (XEXP (SET_SRC (elt), 1)) != (count - 2) * 4
- || GET_CODE (XVECEXP (op, 0, count - 1)) != CLOBBER
- || GET_CODE (XEXP (XVECEXP (op, 0, count - 1), 0)) != REG
- || REGNO (XEXP (XVECEXP (op, 0, count - 1), 0))
- != REGNO (SET_DEST (elt)))
- return 0;
-
- count--;
- }
-
- /* Perform a quick check so we don't blow up below. */
- if (count <= i
- || GET_CODE (XVECEXP (op, 0, i - 1)) != SET
- || GET_CODE (SET_DEST (XVECEXP (op, 0, i - 1))) != MEM
- || GET_CODE (SET_SRC (XVECEXP (op, 0, i - 1))) != REG)
- return 0;
-
- src_regno = REGNO (SET_SRC (XVECEXP (op, 0, i - 1)));
- dest_addr = XEXP (SET_DEST (XVECEXP (op, 0, i - 1)), 0);
-
- for (; i < count; i++)
- {
- elt = XVECEXP (op, 0, i);
-
- if (GET_CODE (elt) != SET
- || GET_CODE (SET_SRC (elt)) != REG
- || GET_MODE (SET_SRC (elt)) != SImode
- || REGNO (SET_SRC (elt)) != src_regno + i - base
- || GET_CODE (SET_DEST (elt)) != MEM
- || GET_MODE (SET_DEST (elt)) != SImode
- || GET_CODE (XEXP (SET_DEST (elt), 0)) != PLUS
- || ! rtx_equal_p (XEXP (XEXP (SET_DEST (elt), 0), 0), dest_addr)
- || GET_CODE (XEXP (XEXP (SET_DEST (elt), 0), 1)) != CONST_INT
- || INTVAL (XEXP (XEXP (SET_DEST (elt), 0), 1)) != (i - base) * 4)
- return 0;
- }
-
- return 1;
-}
-
-int
-load_multiple_sequence (operands, nops, regs, base, load_offset)
- rtx *operands;
- int nops;
- int *regs;
- int *base;
- HOST_WIDE_INT *load_offset;
-{
- int unsorted_regs[4];
- HOST_WIDE_INT unsorted_offsets[4];
- int order[4];
- int base_reg;
- int i;
-
- /* Can only handle 2, 3, or 4 insns at present, though could be easily
- extended if required. */
- if (nops < 2 || nops > 4)
- abort ();
-
- /* Loop over the operands and check that the memory references are
- suitable (ie immediate offsets from the same base register). At
- the same time, extract the target register, and the memory
- offsets. */
- for (i = 0; i < nops; i++)
- {
- rtx reg;
- rtx offset;
-
- if (GET_CODE (operands[nops + i]) != MEM)
- abort ();
-
- /* Don't reorder volatile memory references; it doesn't seem worth
- looking for the case where the order is ok anyway. */
- if (MEM_VOLATILE_P (operands[nops + i]))
- return 0;
-
- offset = const0_rtx;
-
- if ((GET_CODE (reg = XEXP (operands[nops + i], 0)) == REG
- || (GET_CODE (reg) == SUBREG
- && GET_CODE (reg = SUBREG_REG (reg)) == REG))
- || (GET_CODE (XEXP (operands[nops + i], 0)) == PLUS
- && ((GET_CODE (reg = XEXP (XEXP (operands[nops + i], 0), 0))
- == REG)
- || (GET_CODE (reg) == SUBREG
- && GET_CODE (reg = SUBREG_REG (reg)) == REG))
- && (GET_CODE (offset = XEXP (XEXP (operands[nops + i], 0), 1))
- == CONST_INT)))
- {
- if (i == 0)
- {
- base_reg = REGNO(reg);
- unsorted_regs[0] = (GET_CODE (operands[i]) == REG
- ? REGNO (operands[i])
- : REGNO (SUBREG_REG (operands[i])));
- order[0] = 0;
- }
- else
- {
- if (base_reg != REGNO (reg))
- /* Not addressed from the same base register. */
- return 0;
-
- unsorted_regs[i] = (GET_CODE (operands[i]) == REG
- ? REGNO (operands[i])
- : REGNO (SUBREG_REG (operands[i])));
- if (unsorted_regs[i] < unsorted_regs[order[0]])
- order[0] = i;
- }
-
- /* If it isn't an integer register, or if it overwrites the
- base register but isn't the last insn in the list, then
- we can't do this. */
- if (unsorted_regs[i] < 0 || unsorted_regs[i] > 14
- || (i != nops - 1 && unsorted_regs[i] == base_reg))
- return 0;
-
- unsorted_offsets[i] = INTVAL (offset);
- }
- else
- /* Not a suitable memory address. */
- return 0;
- }
-
- /* All the useful information has now been extracted from the
- operands into unsorted_regs and unsorted_offsets; additionally,
- order[0] has been set to the lowest numbered register in the
- list. Sort the registers into order, and check that the memory
- offsets are ascending and adjacent. */
-
- for (i = 1; i < nops; i++)
- {
- int j;
-
- order[i] = order[i - 1];
- for (j = 0; j < nops; j++)
- if (unsorted_regs[j] > unsorted_regs[order[i - 1]]
- && (order[i] == order[i - 1]
- || unsorted_regs[j] < unsorted_regs[order[i]]))
- order[i] = j;
-
- /* Have we found a suitable register? if not, one must be used more
- than once. */
- if (order[i] == order[i - 1])
- return 0;
-
- /* Is the memory address adjacent and ascending? */
- if (unsorted_offsets[order[i]] != unsorted_offsets[order[i - 1]] + 4)
- return 0;
- }
-
- if (base)
- {
- *base = base_reg;
-
- for (i = 0; i < nops; i++)
- regs[i] = unsorted_regs[order[i]];
-
- *load_offset = unsorted_offsets[order[0]];
- }
-
- if (unsorted_offsets[order[0]] == 0)
- return 1; /* ldmia */
-
- if (unsorted_offsets[order[0]] == 4)
- return 2; /* ldmib */
-
- if (unsorted_offsets[order[nops - 1]] == 0)
- return 3; /* ldmda */
-
- if (unsorted_offsets[order[nops - 1]] == -4)
- return 4; /* ldmdb */
-
- /* Can't do it without setting up the offset, only do this if it takes
- no more than one insn. */
- return (const_ok_for_arm (unsorted_offsets[order[0]])
- || const_ok_for_arm (-unsorted_offsets[order[0]])) ? 5 : 0;
-}
-
-char *
-emit_ldm_seq (operands, nops)
- rtx *operands;
- int nops;
-{
- int regs[4];
- int base_reg;
- HOST_WIDE_INT offset;
- char buf[100];
- int i;
-
- switch (load_multiple_sequence (operands, nops, regs, &base_reg, &offset))
- {
- case 1:
- strcpy (buf, "ldm%?ia\t");
- break;
-
- case 2:
- strcpy (buf, "ldm%?ib\t");
- break;
-
- case 3:
- strcpy (buf, "ldm%?da\t");
- break;
-
- case 4:
- strcpy (buf, "ldm%?db\t");
- break;
-
- case 5:
- if (offset >= 0)
- sprintf (buf, "add%%?\t%s%s, %s%s, #%ld", REGISTER_PREFIX,
- reg_names[regs[0]], REGISTER_PREFIX, reg_names[base_reg],
- (long) offset);
- else
- sprintf (buf, "sub%%?\t%s%s, %s%s, #%ld", REGISTER_PREFIX,
- reg_names[regs[0]], REGISTER_PREFIX, reg_names[base_reg],
- (long) -offset);
- output_asm_insn (buf, operands);
- base_reg = regs[0];
- strcpy (buf, "ldm%?ia\t");
- break;
-
- default:
- abort ();
- }
-
- sprintf (buf + strlen (buf), "%s%s, {%s%s", REGISTER_PREFIX,
- reg_names[base_reg], REGISTER_PREFIX, reg_names[regs[0]]);
-
- for (i = 1; i < nops; i++)
- sprintf (buf + strlen (buf), ", %s%s", REGISTER_PREFIX,
- reg_names[regs[i]]);
-
- strcat (buf, "}\t%@ phole ldm");
-
- output_asm_insn (buf, operands);
- return "";
-}
-
-int
-store_multiple_sequence (operands, nops, regs, base, load_offset)
- rtx *operands;
- int nops;
- int *regs;
- int *base;
- HOST_WIDE_INT *load_offset;
-{
- int unsorted_regs[4];
- HOST_WIDE_INT unsorted_offsets[4];
- int order[4];
- int base_reg;
- int i;
-
- /* Can only handle 2, 3, or 4 insns at present, though could be easily
- extended if required. */
- if (nops < 2 || nops > 4)
- abort ();
-
- /* Loop over the operands and check that the memory references are
- suitable (ie immediate offsets from the same base register). At
- the same time, extract the target register, and the memory
- offsets. */
- for (i = 0; i < nops; i++)
- {
- rtx reg;
- rtx offset;
-
- if (GET_CODE (operands[nops + i]) != MEM)
- abort ();
-
- /* Don't reorder volatile memory references; it doesn't seem worth
- looking for the case where the order is ok anyway. */
- if (MEM_VOLATILE_P (operands[nops + i]))
- return 0;
-
- offset = const0_rtx;
-
- if ((GET_CODE (reg = XEXP (operands[nops + i], 0)) == REG
- || (GET_CODE (reg) == SUBREG
- && GET_CODE (reg = SUBREG_REG (reg)) == REG))
- || (GET_CODE (XEXP (operands[nops + i], 0)) == PLUS
- && ((GET_CODE (reg = XEXP (XEXP (operands[nops + i], 0), 0))
- == REG)
- || (GET_CODE (reg) == SUBREG
- && GET_CODE (reg = SUBREG_REG (reg)) == REG))
- && (GET_CODE (offset = XEXP (XEXP (operands[nops + i], 0), 1))
- == CONST_INT)))
- {
- if (i == 0)
- {
- base_reg = REGNO(reg);
- unsorted_regs[0] = (GET_CODE (operands[i]) == REG
- ? REGNO (operands[i])
- : REGNO (SUBREG_REG (operands[i])));
- order[0] = 0;
- }
- else
- {
- if (base_reg != REGNO (reg))
- /* Not addressed from the same base register. */
- return 0;
-
- unsorted_regs[i] = (GET_CODE (operands[i]) == REG
- ? REGNO (operands[i])
- : REGNO (SUBREG_REG (operands[i])));
- if (unsorted_regs[i] < unsorted_regs[order[0]])
- order[0] = i;
- }
-
- /* If it isn't an integer register, then we can't do this. */
- if (unsorted_regs[i] < 0 || unsorted_regs[i] > 14)
- return 0;
-
- unsorted_offsets[i] = INTVAL (offset);
- }
- else
- /* Not a suitable memory address. */
- return 0;
- }
-
- /* All the useful information has now been extracted from the
- operands into unsorted_regs and unsorted_offsets; additionally,
- order[0] has been set to the lowest numbered register in the
- list. Sort the registers into order, and check that the memory
- offsets are ascending and adjacent. */
-
- for (i = 1; i < nops; i++)
- {
- int j;
-
- order[i] = order[i - 1];
- for (j = 0; j < nops; j++)
- if (unsorted_regs[j] > unsorted_regs[order[i - 1]]
- && (order[i] == order[i - 1]
- || unsorted_regs[j] < unsorted_regs[order[i]]))
- order[i] = j;
-
- /* Have we found a suitable register? if not, one must be used more
- than once. */
- if (order[i] == order[i - 1])
- return 0;
-
- /* Is the memory address adjacent and ascending? */
- if (unsorted_offsets[order[i]] != unsorted_offsets[order[i - 1]] + 4)
- return 0;
- }
-
- if (base)
- {
- *base = base_reg;
-
- for (i = 0; i < nops; i++)
- regs[i] = unsorted_regs[order[i]];
-
- *load_offset = unsorted_offsets[order[0]];
- }
-
- if (unsorted_offsets[order[0]] == 0)
- return 1; /* stmia */
-
- if (unsorted_offsets[order[0]] == 4)
- return 2; /* stmib */
-
- if (unsorted_offsets[order[nops - 1]] == 0)
- return 3; /* stmda */
-
- if (unsorted_offsets[order[nops - 1]] == -4)
- return 4; /* stmdb */
-
- return 0;
-}
-
-char *
-emit_stm_seq (operands, nops)
- rtx *operands;
- int nops;
-{
- int regs[4];
- int base_reg;
- HOST_WIDE_INT offset;
- char buf[100];
- int i;
-
- switch (store_multiple_sequence (operands, nops, regs, &base_reg, &offset))
- {
- case 1:
- strcpy (buf, "stm%?ia\t");
- break;
-
- case 2:
- strcpy (buf, "stm%?ib\t");
- break;
-
- case 3:
- strcpy (buf, "stm%?da\t");
- break;
-
- case 4:
- strcpy (buf, "stm%?db\t");
- break;
-
- default:
- abort ();
- }
-
- sprintf (buf + strlen (buf), "%s%s, {%s%s", REGISTER_PREFIX,
- reg_names[base_reg], REGISTER_PREFIX, reg_names[regs[0]]);
-
- for (i = 1; i < nops; i++)
- sprintf (buf + strlen (buf), ", %s%s", REGISTER_PREFIX,
- reg_names[regs[i]]);
-
- strcat (buf, "}\t%@ phole stm");
-
- output_asm_insn (buf, operands);
- return "";
-}
-
-int
-multi_register_push (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != PARALLEL
- || (GET_CODE (XVECEXP (op, 0, 0)) != SET)
- || (GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != UNSPEC)
- || (XINT (SET_SRC (XVECEXP (op, 0, 0)), 1) != 2))
- return 0;
-
- return 1;
-}
-
-
-/* Routines for use with attributes */
-
-int
-const_pool_offset (symbol)
- rtx symbol;
-{
- return get_pool_offset (symbol) - get_pool_size () - get_prologue_size ();
-}
-
-/* Return nonzero if ATTR is a valid attribute for DECL.
- ATTRIBUTES are any existing attributes and ARGS are the arguments
- supplied with ATTR.
-
- Supported attributes:
-
- naked: don't output any prologue or epilogue code, the user is assumed
- to do the right thing. */
-
-int
-arm_valid_machine_decl_attribute (decl, attributes, attr, args)
- tree decl;
- tree attributes;
- tree attr;
- tree args;
-{
- if (args != NULL_TREE)
- return 0;
-
- if (is_attribute_p ("naked", attr))
- return TREE_CODE (decl) == FUNCTION_DECL;
- return 0;
-}
-
-/* Return non-zero if FUNC is a naked function. */
-
-static int
-arm_naked_function_p (func)
- tree func;
-{
- tree a;
-
- if (TREE_CODE (func) != FUNCTION_DECL)
- abort ();
-
- a = lookup_attribute ("naked", DECL_MACHINE_ATTRIBUTES (func));
- return a != NULL_TREE;
-}
-
-/* Routines for use in generating RTL */
-
-rtx
-arm_gen_load_multiple (base_regno, count, from, up, write_back)
- int base_regno;
- int count;
- rtx from;
- int up;
- int write_back;
-{
- int i = 0, j;
- rtx result;
- int sign = up ? 1 : -1;
-
- result = gen_rtx (PARALLEL, VOIDmode,
- rtvec_alloc (count + (write_back ? 2 : 0)));
- if (write_back)
- {
- XVECEXP (result, 0, 0)
- = gen_rtx (SET, GET_MODE (from), from,
- plus_constant (from, count * 4 * sign));
- i = 1;
- count++;
- }
-
- for (j = 0; i < count; i++, j++)
- {
- XVECEXP (result, 0, i)
- = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, base_regno + j),
- gen_rtx (MEM, SImode,
- plus_constant (from, j * 4 * sign)));
- }
-
- if (write_back)
- XVECEXP (result, 0, i) = gen_rtx (CLOBBER, SImode, from);
-
- return result;
-}
-
-rtx
-arm_gen_store_multiple (base_regno, count, to, up, write_back)
- int base_regno;
- int count;
- rtx to;
- int up;
- int write_back;
-{
- int i = 0, j;
- rtx result;
- int sign = up ? 1 : -1;
-
- result = gen_rtx (PARALLEL, VOIDmode,
- rtvec_alloc (count + (write_back ? 2 : 0)));
- if (write_back)
- {
- XVECEXP (result, 0, 0)
- = gen_rtx (SET, GET_MODE (to), to,
- plus_constant (to, count * 4 * sign));
- i = 1;
- count++;
- }
-
- for (j = 0; i < count; i++, j++)
- {
- XVECEXP (result, 0, i)
- = gen_rtx (SET, VOIDmode,
- gen_rtx (MEM, SImode, plus_constant (to, j * 4 * sign)),
- gen_rtx (REG, SImode, base_regno + j));
- }
-
- if (write_back)
- XVECEXP (result, 0, i) = gen_rtx (CLOBBER, SImode, to);
-
- return result;
-}
-
-int
-arm_gen_movstrqi (operands)
- rtx *operands;
-{
- HOST_WIDE_INT in_words_to_go, out_words_to_go, last_bytes;
- int i, r;
- rtx src, dst;
- rtx st_src, st_dst, end_src, end_dst, fin_src, fin_dst;
- rtx part_bytes_reg = NULL;
- extern int optimize;
-
- if (GET_CODE (operands[2]) != CONST_INT
- || GET_CODE (operands[3]) != CONST_INT
- || INTVAL (operands[2]) > 64
- || INTVAL (operands[3]) & 3)
- return 0;
-
- st_dst = XEXP (operands[0], 0);
- st_src = XEXP (operands[1], 0);
- fin_dst = dst = copy_to_mode_reg (SImode, st_dst);
- fin_src = src = copy_to_mode_reg (SImode, st_src);
-
- in_words_to_go = (INTVAL (operands[2]) + 3) / 4;
- out_words_to_go = INTVAL (operands[2]) / 4;
- last_bytes = INTVAL (operands[2]) & 3;
-
- if (out_words_to_go != in_words_to_go && ((in_words_to_go - 1) & 3) != 0)
- part_bytes_reg = gen_rtx (REG, SImode, (in_words_to_go - 1) & 3);
-
- for (i = 0; in_words_to_go >= 2; i+=4)
- {
- if (in_words_to_go > 4)
- emit_insn (arm_gen_load_multiple (0, 4, src, TRUE, TRUE));
- else
- emit_insn (arm_gen_load_multiple (0, in_words_to_go, src, TRUE,
- FALSE));
-
- if (out_words_to_go)
- {
- if (out_words_to_go > 4)
- emit_insn (arm_gen_store_multiple (0, 4, dst, TRUE, TRUE));
- else if (out_words_to_go != 1)
- emit_insn (arm_gen_store_multiple (0, out_words_to_go,
- dst, TRUE,
- (last_bytes == 0
- ? FALSE : TRUE)));
- else
- {
- emit_move_insn (gen_rtx (MEM, SImode, dst),
- gen_rtx (REG, SImode, 0));
- if (last_bytes != 0)
- emit_insn (gen_addsi3 (dst, dst, GEN_INT (4)));
- }
- }
-
- in_words_to_go -= in_words_to_go < 4 ? in_words_to_go : 4;
- out_words_to_go -= out_words_to_go < 4 ? out_words_to_go : 4;
- }
-
- /* OUT_WORDS_TO_GO will be zero here if there are byte stores to do. */
- if (out_words_to_go)
- {
- rtx sreg;
-
- emit_move_insn (sreg = gen_reg_rtx (SImode), gen_rtx (MEM, SImode, src));
- emit_move_insn (fin_src = gen_reg_rtx (SImode), plus_constant (src, 4));
- emit_move_insn (gen_rtx (MEM, SImode, dst), sreg);
- emit_move_insn (fin_dst = gen_reg_rtx (SImode), plus_constant (dst, 4));
- in_words_to_go--;
-
- if (in_words_to_go) /* Sanity check */
- abort ();
- }
-
- if (in_words_to_go)
- {
- if (in_words_to_go < 0)
- abort ();
-
- part_bytes_reg = copy_to_mode_reg (SImode, gen_rtx (MEM, SImode, src));
- }
-
- if (BYTES_BIG_ENDIAN && last_bytes)
- {
- rtx tmp = gen_reg_rtx (SImode);
-
- if (part_bytes_reg == NULL)
- abort ();
-
- /* The bytes we want are in the top end of the word */
- emit_insn (gen_lshrsi3 (tmp, part_bytes_reg,
- GEN_INT (8 * (4 - last_bytes))));
- part_bytes_reg = tmp;
-
- while (last_bytes)
- {
- emit_move_insn (gen_rtx (MEM, QImode,
- plus_constant (dst, last_bytes - 1)),
- gen_rtx (SUBREG, QImode, part_bytes_reg, 0));
- if (--last_bytes)
- {
- tmp = gen_reg_rtx (SImode);
- emit_insn (gen_lshrsi3 (tmp, part_bytes_reg, GEN_INT (8)));
- part_bytes_reg = tmp;
- }
- }
-
- }
- else
- {
- while (last_bytes)
- {
- if (part_bytes_reg == NULL)
- abort ();
-
- emit_move_insn (gen_rtx (MEM, QImode, dst),
- gen_rtx (SUBREG, QImode, part_bytes_reg, 0));
- if (--last_bytes)
- {
- rtx tmp = gen_reg_rtx (SImode);
-
- emit_insn (gen_addsi3 (dst, dst, const1_rtx));
- emit_insn (gen_lshrsi3 (tmp, part_bytes_reg, GEN_INT (8)));
- part_bytes_reg = tmp;
- }
- }
- }
-
- return 1;
-}
-
-/* Generate a memory reference for a half word, such that it will be loaded
- into the top 16 bits of the word. We can assume that the address is
- known to be alignable and of the form reg, or plus (reg, const). */
-rtx
-gen_rotated_half_load (memref)
- rtx memref;
-{
- HOST_WIDE_INT offset = 0;
- rtx base = XEXP (memref, 0);
-
- if (GET_CODE (base) == PLUS)
- {
- offset = INTVAL (XEXP (base, 1));
- base = XEXP (base, 0);
- }
-
- /* If we aren't allowed to generate unalligned addresses, then fail. */
- if (TARGET_SHORT_BY_BYTES
- && ((BYTES_BIG_ENDIAN ? 1 : 0) ^ ((offset & 2) == 0)))
- return NULL;
-
- base = gen_rtx (MEM, SImode, plus_constant (base, offset & ~2));
-
- if ((BYTES_BIG_ENDIAN ? 1 : 0) ^ ((offset & 2) == 2))
- return base;
-
- return gen_rtx (ROTATE, SImode, base, GEN_INT (16));
-}
-
-static enum machine_mode
-select_dominance_cc_mode (op, x, y, cond_or)
- enum rtx_code op;
- rtx x;
- rtx y;
- HOST_WIDE_INT cond_or;
-{
- enum rtx_code cond1, cond2;
- int swapped = 0;
-
- /* Currently we will probably get the wrong result if the individual
- comparisons are not simple. This also ensures that it is safe to
- reverse a comparions if necessary. */
- if ((arm_select_cc_mode (cond1 = GET_CODE (x), XEXP (x, 0), XEXP (x, 1))
- != CCmode)
- || (arm_select_cc_mode (cond2 = GET_CODE (y), XEXP (y, 0), XEXP (y, 1))
- != CCmode))
- return CCmode;
-
- if (cond_or)
- cond1 = reverse_condition (cond1);
-
- /* If the comparisons are not equal, and one doesn't dominate the other,
- then we can't do this. */
- if (cond1 != cond2
- && ! comparison_dominates_p (cond1, cond2)
- && (swapped = 1, ! comparison_dominates_p (cond2, cond1)))
- return CCmode;
-
- if (swapped)
- {
- enum rtx_code temp = cond1;
- cond1 = cond2;
- cond2 = temp;
- }
-
- switch (cond1)
- {
- case EQ:
- if (cond2 == EQ || ! cond_or)
- return CC_DEQmode;
-
- switch (cond2)
- {
- case LE: return CC_DLEmode;
- case LEU: return CC_DLEUmode;
- case GE: return CC_DGEmode;
- case GEU: return CC_DGEUmode;
- }
-
- break;
-
- case LT:
- if (cond2 == LT || ! cond_or)
- return CC_DLTmode;
- if (cond2 == LE)
- return CC_DLEmode;
- if (cond2 == NE)
- return CC_DNEmode;
- break;
-
- case GT:
- if (cond2 == GT || ! cond_or)
- return CC_DGTmode;
- if (cond2 == GE)
- return CC_DGEmode;
- if (cond2 == NE)
- return CC_DNEmode;
- break;
-
- case LTU:
- if (cond2 == LTU || ! cond_or)
- return CC_DLTUmode;
- if (cond2 == LEU)
- return CC_DLEUmode;
- if (cond2 == NE)
- return CC_DNEmode;
- break;
-
- case GTU:
- if (cond2 == GTU || ! cond_or)
- return CC_DGTUmode;
- if (cond2 == GEU)
- return CC_DGEUmode;
- if (cond2 == NE)
- return CC_DNEmode;
- break;
-
- /* The remaining cases only occur when both comparisons are the
- same. */
- case NE:
- return CC_DNEmode;
-
- case LE:
- return CC_DLEmode;
-
- case GE:
- return CC_DGEmode;
-
- case LEU:
- return CC_DLEUmode;
-
- case GEU:
- return CC_DGEUmode;
- }
-
- abort ();
-}
-
-enum machine_mode
-arm_select_cc_mode (op, x, y)
- enum rtx_code op;
- rtx x;
- rtx y;
-{
- /* All floating point compares return CCFP if it is an equality
- comparison, and CCFPE otherwise. */
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- return (op == EQ || op == NE) ? CCFPmode : CCFPEmode;
-
- /* A compare with a shifted operand. Because of canonicalization, the
- comparison will have to be swapped when we emit the assembler. */
- if (GET_MODE (y) == SImode && GET_CODE (y) == REG
- && (GET_CODE (x) == ASHIFT || GET_CODE (x) == ASHIFTRT
- || GET_CODE (x) == LSHIFTRT || GET_CODE (x) == ROTATE
- || GET_CODE (x) == ROTATERT))
- return CC_SWPmode;
-
- /* This is a special case, that is used by combine to alow a
- comarison of a shifted byte load to be split into a zero-extend
- followed by a comparison of the shifted integer (only valid for
- equalities and unsigned inequalites. */
- if (GET_MODE (x) == SImode
- && GET_CODE (x) == ASHIFT
- && GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 24
- && GET_CODE (XEXP (x, 0)) == SUBREG
- && GET_CODE (SUBREG_REG (XEXP (x, 0))) == MEM
- && GET_MODE (SUBREG_REG (XEXP (x, 0))) == QImode
- && (op == EQ || op == NE
- || op == GEU || op == GTU || op == LTU || op == LEU)
- && GET_CODE (y) == CONST_INT)
- return CC_Zmode;
-
- /* An operation that sets the condition codes as a side-effect, the
- V flag is not set correctly, so we can only use comparisons where
- this doesn't matter. (For LT and GE we can use "mi" and "pl"
- instead. */
- if (GET_MODE (x) == SImode
- && y == const0_rtx
- && (op == EQ || op == NE || op == LT || op == GE)
- && (GET_CODE (x) == PLUS || GET_CODE (x) == MINUS
- || GET_CODE (x) == AND || GET_CODE (x) == IOR
- || GET_CODE (x) == XOR || GET_CODE (x) == MULT
- || GET_CODE (x) == NOT || GET_CODE (x) == NEG
- || GET_CODE (x) == LSHIFTRT
- || GET_CODE (x) == ASHIFT || GET_CODE (x) == ASHIFTRT
- || GET_CODE (x) == ROTATERT || GET_CODE (x) == ZERO_EXTRACT))
- return CC_NOOVmode;
-
- /* A construct for a conditional compare, if the false arm contains
- 0, then both conditions must be true, otherwise either condition
- must be true. Not all conditions are possible, so CCmode is
- returned if it can't be done. */
- if (GET_CODE (x) == IF_THEN_ELSE
- && (XEXP (x, 2) == const0_rtx
- || XEXP (x, 2) == const1_rtx)
- && GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<'
- && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) == '<')
- return select_dominance_cc_mode (op, XEXP (x, 0), XEXP (x, 1),
- INTVAL (XEXP (x, 2)));
-
- if (GET_MODE (x) == QImode && (op == EQ || op == NE))
- return CC_Zmode;
-
- if (GET_MODE (x) == SImode && (op == LTU || op == GEU)
- && GET_CODE (x) == PLUS
- && (rtx_equal_p (XEXP (x, 0), y) || rtx_equal_p (XEXP (x, 1), y)))
- return CC_Cmode;
-
- return CCmode;
-}
-
-/* X and Y are two things to compare using CODE. Emit the compare insn and
- return the rtx for register 0 in the proper mode. FP means this is a
- floating point compare: I don't think that it is needed on the arm. */
-
-rtx
-gen_compare_reg (code, x, y, fp)
- enum rtx_code code;
- rtx x, y;
-{
- enum machine_mode mode = SELECT_CC_MODE (code, x, y);
- rtx cc_reg = gen_rtx (REG, mode, 24);
-
- emit_insn (gen_rtx (SET, VOIDmode, cc_reg,
- gen_rtx (COMPARE, mode, x, y)));
-
- return cc_reg;
-}
-
-void
-arm_reload_in_hi (operands)
- rtx *operands;
-{
- rtx base = find_replacement (&XEXP (operands[1], 0));
-
- emit_insn (gen_zero_extendqisi2 (operands[2], gen_rtx (MEM, QImode, base)));
- emit_insn (gen_zero_extendqisi2 (gen_rtx (SUBREG, SImode, operands[0], 0),
- gen_rtx (MEM, QImode,
- plus_constant (base, 1))));
- if (BYTES_BIG_ENDIAN)
- emit_insn (gen_rtx (SET, VOIDmode, gen_rtx (SUBREG, SImode,
- operands[0], 0),
- gen_rtx (IOR, SImode,
- gen_rtx (ASHIFT, SImode,
- gen_rtx (SUBREG, SImode,
- operands[0], 0),
- GEN_INT (8)),
- operands[2])));
- else
- emit_insn (gen_rtx (SET, VOIDmode, gen_rtx (SUBREG, SImode,
- operands[0], 0),
- gen_rtx (IOR, SImode,
- gen_rtx (ASHIFT, SImode,
- operands[2],
- GEN_INT (8)),
- gen_rtx (SUBREG, SImode, operands[0], 0))));
-}
-
-void
-arm_reload_out_hi (operands)
- rtx *operands;
-{
- rtx base = find_replacement (&XEXP (operands[0], 0));
-
- if (BYTES_BIG_ENDIAN)
- {
- emit_insn (gen_movqi (gen_rtx (MEM, QImode, plus_constant (base, 1)),
- gen_rtx (SUBREG, QImode, operands[1], 0)));
- emit_insn (gen_lshrsi3 (operands[2],
- gen_rtx (SUBREG, SImode, operands[1], 0),
- GEN_INT (8)));
- emit_insn (gen_movqi (gen_rtx (MEM, QImode, base),
- gen_rtx (SUBREG, QImode, operands[2], 0)));
- }
- else
- {
- emit_insn (gen_movqi (gen_rtx (MEM, QImode, base),
- gen_rtx (SUBREG, QImode, operands[1], 0)));
- emit_insn (gen_lshrsi3 (operands[2],
- gen_rtx (SUBREG, SImode, operands[1], 0),
- GEN_INT (8)));
- emit_insn (gen_movqi (gen_rtx (MEM, QImode, plus_constant (base, 1)),
- gen_rtx (SUBREG, QImode, operands[2], 0)));
- }
-}
-
-/* Check to see if a branch is forwards or backwards. Return TRUE if it
- is backwards. */
-
-int
-arm_backwards_branch (from, to)
- int from, to;
-{
- return insn_addresses[to] <= insn_addresses[from];
-}
-
-/* Check to see if a branch is within the distance that can be done using
- an arithmetic expression. */
-int
-short_branch (from, to)
- int from, to;
-{
- int delta = insn_addresses[from] + 8 - insn_addresses[to];
-
- return abs (delta) < 980; /* A small margin for safety */
-}
-
-/* Check to see that the insn isn't the target of the conditionalizing
- code */
-int
-arm_insn_not_targeted (insn)
- rtx insn;
-{
- return insn != arm_target_insn;
-}
-
-
-/* Routines for manipulation of the constant pool. */
-/* This is unashamedly hacked from the version in sh.c, since the problem is
- extremely similar. */
-
-/* Arm instructions cannot load a large constant into a register,
- constants have to come from a pc relative load. The reference of a pc
- relative load instruction must be less than 1k infront of the instruction.
- This means that we often have to dump a constant inside a function, and
- generate code to branch around it.
-
- It is important to minimize this, since the branches will slow things
- down and make things bigger.
-
- Worst case code looks like:
-
- ldr rn, L1
- b L2
- align
- L1: .long value
- L2:
- ..
-
- ldr rn, L3
- b L4
- align
- L3: .long value
- L4:
- ..
-
- We fix this by performing a scan before scheduling, which notices which
- instructions need to have their operands fetched from the constant table
- and builds the table.
-
-
- The algorithm is:
-
- scan, find an instruction which needs a pcrel move. Look forward, find th
- last barrier which is within MAX_COUNT bytes of the requirement.
- If there isn't one, make one. Process all the instructions between
- the find and the barrier.
-
- In the above example, we can tell that L3 is within 1k of L1, so
- the first move can be shrunk from the 2 insn+constant sequence into
- just 1 insn, and the constant moved to L3 to make:
-
- ldr rn, L1
- ..
- ldr rn, L3
- b L4
- align
- L1: .long value
- L3: .long value
- L4:
-
- Then the second move becomes the target for the shortening process.
-
- */
-
-typedef struct
-{
- rtx value; /* Value in table */
- HOST_WIDE_INT next_offset;
- enum machine_mode mode; /* Mode of value */
-} pool_node;
-
-/* The maximum number of constants that can fit into one pool, since
- the pc relative range is 0...1020 bytes and constants are at least 4
- bytes long */
-
-#define MAX_POOL_SIZE (1020/4)
-static pool_node pool_vector[MAX_POOL_SIZE];
-static int pool_size;
-static rtx pool_vector_label;
-
-/* Add a constant to the pool and return its label. */
-static HOST_WIDE_INT
-add_constant (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- int i;
- rtx lab;
- HOST_WIDE_INT offset;
-
- if (mode == SImode && GET_CODE (x) == MEM && CONSTANT_P (XEXP (x, 0))
- && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)))
- x = get_pool_constant (XEXP (x, 0));
-#ifndef AOF_ASSEMBLER
- else if (GET_CODE (x) == UNSPEC && XINT (x, 1) == 3)
- x = XVECEXP (x, 0, 0);
-#endif
-
- /* First see if we've already got it */
- for (i = 0; i < pool_size; i++)
- {
- if (GET_CODE (x) == pool_vector[i].value->code
- && mode == pool_vector[i].mode)
- {
- if (GET_CODE (x) == CODE_LABEL)
- {
- if (XINT (x, 3) != XINT (pool_vector[i].value, 3))
- continue;
- }
- if (rtx_equal_p (x, pool_vector[i].value))
- return pool_vector[i].next_offset - GET_MODE_SIZE (mode);
- }
- }
-
- /* Need a new one */
- pool_vector[pool_size].next_offset = GET_MODE_SIZE (mode);
- offset = 0;
- if (pool_size == 0)
- pool_vector_label = gen_label_rtx ();
- else
- pool_vector[pool_size].next_offset
- += (offset = pool_vector[pool_size - 1].next_offset);
-
- pool_vector[pool_size].value = x;
- pool_vector[pool_size].mode = mode;
- pool_size++;
- return offset;
-}
-
-/* Output the literal table */
-static void
-dump_table (scan)
- rtx scan;
-{
- int i;
-
- scan = emit_label_after (gen_label_rtx (), scan);
- scan = emit_insn_after (gen_align_4 (), scan);
- scan = emit_label_after (pool_vector_label, scan);
-
- for (i = 0; i < pool_size; i++)
- {
- pool_node *p = pool_vector + i;
-
- switch (GET_MODE_SIZE (p->mode))
- {
- case 4:
- scan = emit_insn_after (gen_consttable_4 (p->value), scan);
- break;
-
- case 8:
- scan = emit_insn_after (gen_consttable_8 (p->value), scan);
- break;
-
- default:
- abort ();
- break;
- }
- }
-
- scan = emit_insn_after (gen_consttable_end (), scan);
- scan = emit_barrier_after (scan);
- pool_size = 0;
-}
-
-/* Non zero if the src operand needs to be fixed up */
-static int
-fixit (src, mode, destreg)
- rtx src;
- enum machine_mode mode;
- int destreg;
-{
- if (CONSTANT_P (src))
- {
- if (GET_CODE (src) == CONST_INT)
- return (! const_ok_for_arm (INTVAL (src))
- && ! const_ok_for_arm (~INTVAL (src)));
- if (GET_CODE (src) == CONST_DOUBLE)
- return (GET_MODE (src) == VOIDmode
- || destreg < 16
- || (! const_double_rtx_ok_for_fpu (src)
- && ! neg_const_double_rtx_ok_for_fpu (src)));
- return symbol_mentioned_p (src);
- }
-#ifndef AOF_ASSEMBLER
- else if (GET_CODE (src) == UNSPEC && XINT (src, 1) == 3)
- return 1;
-#endif
- else
- return (mode == SImode && GET_CODE (src) == MEM
- && GET_CODE (XEXP (src, 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (src, 0)));
-}
-
-/* Find the last barrier less than MAX_COUNT bytes from FROM, or create one. */
-static rtx
-find_barrier (from, max_count)
- rtx from;
- int max_count;
-{
- int count = 0;
- rtx found_barrier = 0;
-
- while (from && count < max_count)
- {
- if (GET_CODE (from) == BARRIER)
- found_barrier = from;
-
- /* Count the length of this insn */
- if (GET_CODE (from) == INSN
- && GET_CODE (PATTERN (from)) == SET
- && CONSTANT_P (SET_SRC (PATTERN (from)))
- && CONSTANT_POOL_ADDRESS_P (SET_SRC (PATTERN (from))))
- {
- rtx src = SET_SRC (PATTERN (from));
- count += 2;
- }
- else
- count += get_attr_length (from);
-
- from = NEXT_INSN (from);
- }
-
- if (!found_barrier)
- {
- /* We didn't find a barrier in time to
- dump our stuff, so we'll make one */
- rtx label = gen_label_rtx ();
-
- if (from)
- from = PREV_INSN (from);
- else
- from = get_last_insn ();
-
- /* Walk back to be just before any jump */
- while (GET_CODE (from) == JUMP_INSN
- || GET_CODE (from) == NOTE
- || GET_CODE (from) == CODE_LABEL)
- from = PREV_INSN (from);
-
- from = emit_jump_insn_after (gen_jump (label), from);
- JUMP_LABEL (from) = label;
- found_barrier = emit_barrier_after (from);
- emit_label_after (label, found_barrier);
- return found_barrier;
- }
-
- return found_barrier;
-}
-
-/* Non zero if the insn is a move instruction which needs to be fixed. */
-static int
-broken_move (insn)
- rtx insn;
-{
- if (!INSN_DELETED_P (insn)
- && GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SET)
- {
- rtx pat = PATTERN (insn);
- rtx src = SET_SRC (pat);
- rtx dst = SET_DEST (pat);
- int destreg;
- enum machine_mode mode = GET_MODE (dst);
- if (dst == pc_rtx)
- return 0;
-
- if (GET_CODE (dst) == REG)
- destreg = REGNO (dst);
- else if (GET_CODE (dst) == SUBREG && GET_CODE (SUBREG_REG (dst)) == REG)
- destreg = REGNO (SUBREG_REG (dst));
-
- return fixit (src, mode, destreg);
- }
- return 0;
-}
-
-void
-arm_reorg (first)
- rtx first;
-{
- rtx insn;
- int count_size;
- int regno;
-
-#if 0
- /* The ldr instruction can work with up to a 4k offset, and most constants
- will be loaded with one of these instructions; however, the adr
- instruction and the ldf instructions only work with a 1k offset. This
- code needs to be rewritten to use the 4k offset when possible, and to
- adjust when a 1k offset is needed. For now we just use a 1k offset
- from the start. */
- count_size = 4000;
-
- /* Floating point operands can't work further than 1024 bytes from the
- PC, so to make things simple we restrict all loads for such functions.
- */
- if (TARGET_HARD_FLOAT)
- for (regno = 16; regno < 24; regno++)
- if (regs_ever_live[regno])
- {
- count_size = 1000;
- break;
- }
-#else
- count_size = 1000;
-#endif /* 0 */
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- if (broken_move (insn))
- {
- /* This is a broken move instruction, scan ahead looking for
- a barrier to stick the constant table behind */
- rtx scan;
- rtx barrier = find_barrier (insn, count_size);
-
- /* Now find all the moves between the points and modify them */
- for (scan = insn; scan != barrier; scan = NEXT_INSN (scan))
- {
- if (broken_move (scan))
- {
- /* This is a broken move instruction, add it to the pool */
- rtx pat = PATTERN (scan);
- rtx src = SET_SRC (pat);
- rtx dst = SET_DEST (pat);
- enum machine_mode mode = GET_MODE (dst);
- HOST_WIDE_INT offset;
- rtx newinsn = scan;
- rtx newsrc;
- rtx addr;
- int scratch;
-
- /* If this is an HImode constant load, convert it into
- an SImode constant load. Since the register is always
- 32 bits this is safe. We have to do this, since the
- load pc-relative instruction only does a 32-bit load. */
- if (mode == HImode)
- {
- mode = SImode;
- if (GET_CODE (dst) != REG)
- abort ();
- PUT_MODE (dst, SImode);
- }
-
- offset = add_constant (src, mode);
- addr = plus_constant (gen_rtx (LABEL_REF, VOIDmode,
- pool_vector_label),
- offset);
-
- /* For wide moves to integer regs we need to split the
- address calculation off into a separate insn, so that
- the load can then be done with a load-multiple. This is
- safe, since we have already noted the length of such
- insns to be 8, and we are immediately over-writing the
- scratch we have grabbed with the final result. */
- if (GET_MODE_SIZE (mode) > 4
- && (scratch = REGNO (dst)) < 16)
- {
- rtx reg = gen_rtx (REG, SImode, scratch);
- newinsn = emit_insn_after (gen_movaddr (reg, addr),
- newinsn);
- addr = reg;
- }
-
- newsrc = gen_rtx (MEM, mode, addr);
-
- /* Build a jump insn wrapper around the move instead
- of an ordinary insn, because we want to have room for
- the target label rtx in fld[7], which an ordinary
- insn doesn't have. */
- newinsn = emit_jump_insn_after (gen_rtx (SET, VOIDmode,
- dst, newsrc),
- newinsn);
- JUMP_LABEL (newinsn) = pool_vector_label;
-
- /* But it's still an ordinary insn */
- PUT_CODE (newinsn, INSN);
-
- /* Kill old insn */
- delete_insn (scan);
- scan = newinsn;
- }
- }
- dump_table (barrier);
- insn = scan;
- }
- }
-}
-
-
-/* Routines to output assembly language. */
-
-/* If the rtx is the correct value then return the string of the number.
- In this way we can ensure that valid double constants are generated even
- when cross compiling. */
-char *
-fp_immediate_constant (x)
- rtx x;
-{
- REAL_VALUE_TYPE r;
- int i;
-
- if (!fpa_consts_inited)
- init_fpa_table ();
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
- for (i = 0; i < 8; i++)
- if (REAL_VALUES_EQUAL (r, values_fpa[i]))
- return strings_fpa[i];
-
- abort ();
-}
-
-/* As for fp_immediate_constant, but value is passed directly, not in rtx. */
-static char *
-fp_const_from_val (r)
- REAL_VALUE_TYPE *r;
-{
- int i;
-
- if (! fpa_consts_inited)
- init_fpa_table ();
-
- for (i = 0; i < 8; i++)
- if (REAL_VALUES_EQUAL (*r, values_fpa[i]))
- return strings_fpa[i];
-
- abort ();
-}
-
-/* Output the operands of a LDM/STM instruction to STREAM.
- MASK is the ARM register set mask of which only bits 0-15 are important.
- INSTR is the possibly suffixed base register. HAT unequals zero if a hat
- must follow the register list. */
-
-void
-print_multi_reg (stream, instr, mask, hat)
- FILE *stream;
- char *instr;
- int mask, hat;
-{
- int i;
- int not_first = FALSE;
-
- fputc ('\t', stream);
- fprintf (stream, instr, REGISTER_PREFIX);
- fputs (", {", stream);
- for (i = 0; i < 16; i++)
- if (mask & (1 << i))
- {
- if (not_first)
- fprintf (stream, ", ");
- fprintf (stream, "%s%s", REGISTER_PREFIX, reg_names[i]);
- not_first = TRUE;
- }
-
- fprintf (stream, "}%s\n", hat ? "^" : "");
-}
-
-/* Output a 'call' insn. */
-
-char *
-output_call (operands)
- rtx *operands;
-{
- /* Handle calls to lr using ip (which may be clobbered in subr anyway). */
-
- if (REGNO (operands[0]) == 14)
- {
- operands[0] = gen_rtx (REG, SImode, 12);
- output_asm_insn ("mov%?\t%0, %|lr", operands);
- }
- output_asm_insn ("mov%?\t%|lr, %|pc", operands);
- output_asm_insn ("mov%?\t%|pc, %0", operands);
- return "";
-}
-
-static int
-eliminate_lr2ip (x)
- rtx *x;
-{
- int something_changed = 0;
- rtx x0 = *x;
- int code = GET_CODE (x0);
- register int i, j;
- register char *fmt;
-
- switch (code)
- {
- case REG:
- if (REGNO (x0) == 14)
- {
- *x = gen_rtx (REG, SImode, 12);
- return 1;
- }
- return 0;
- default:
- /* Scan through the sub-elements and change any references there */
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- something_changed |= eliminate_lr2ip (&XEXP (x0, i));
- else if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x0, i); j++)
- something_changed |= eliminate_lr2ip (&XVECEXP (x0, i, j));
- return something_changed;
- }
-}
-
-/* Output a 'call' insn that is a reference in memory. */
-
-char *
-output_call_mem (operands)
- rtx *operands;
-{
- operands[0] = copy_rtx (operands[0]); /* Be ultra careful */
- /* Handle calls using lr by using ip (which may be clobbered in subr anyway).
- */
- if (eliminate_lr2ip (&operands[0]))
- output_asm_insn ("mov%?\t%|ip, %|lr", operands);
-
- output_asm_insn ("mov%?\t%|lr, %|pc", operands);
- output_asm_insn ("ldr%?\t%|pc, %0", operands);
- return "";
-}
-
-
-/* Output a move from arm registers to an fpu registers.
- OPERANDS[0] is an fpu register.
- OPERANDS[1] is the first registers of an arm register pair. */
-
-char *
-output_mov_long_double_fpu_from_arm (operands)
- rtx *operands;
-{
- int arm_reg0 = REGNO (operands[1]);
- rtx ops[3];
-
- if (arm_reg0 == 12)
- abort();
-
- ops[0] = gen_rtx (REG, SImode, arm_reg0);
- ops[1] = gen_rtx (REG, SImode, 1 + arm_reg0);
- ops[2] = gen_rtx (REG, SImode, 2 + arm_reg0);
-
- output_asm_insn ("stm%?fd\t%|sp!, {%0, %1, %2}", ops);
- output_asm_insn ("ldf%?e\t%0, [%|sp], #12", operands);
- return "";
-}
-
-/* Output a move from an fpu register to arm registers.
- OPERANDS[0] is the first registers of an arm register pair.
- OPERANDS[1] is an fpu register. */
-
-char *
-output_mov_long_double_arm_from_fpu (operands)
- rtx *operands;
-{
- int arm_reg0 = REGNO (operands[0]);
- rtx ops[3];
-
- if (arm_reg0 == 12)
- abort();
-
- ops[0] = gen_rtx (REG, SImode, arm_reg0);
- ops[1] = gen_rtx (REG, SImode, 1 + arm_reg0);
- ops[2] = gen_rtx (REG, SImode, 2 + arm_reg0);
-
- output_asm_insn ("stf%?e\t%1, [%|sp, #-12]!", operands);
- output_asm_insn ("ldm%?fd\t%|sp!, {%0, %1, %2}", ops);
- return "";
-}
-
-/* Output a move from arm registers to arm registers of a long double
- OPERANDS[0] is the destination.
- OPERANDS[1] is the source. */
-char *
-output_mov_long_double_arm_from_arm (operands)
- rtx *operands;
-{
- /* We have to be careful here because the two might overlap */
- int dest_start = REGNO (operands[0]);
- int src_start = REGNO (operands[1]);
- rtx ops[2];
- int i;
-
- if (dest_start < src_start)
- {
- for (i = 0; i < 3; i++)
- {
- ops[0] = gen_rtx (REG, SImode, dest_start + i);
- ops[1] = gen_rtx (REG, SImode, src_start + i);
- output_asm_insn ("mov%?\t%0, %1", ops);
- }
- }
- else
- {
- for (i = 2; i >= 0; i--)
- {
- ops[0] = gen_rtx (REG, SImode, dest_start + i);
- ops[1] = gen_rtx (REG, SImode, src_start + i);
- output_asm_insn ("mov%?\t%0, %1", ops);
- }
- }
-
- return "";
-}
-
-
-/* Output a move from arm registers to an fpu registers.
- OPERANDS[0] is an fpu register.
- OPERANDS[1] is the first registers of an arm register pair. */
-
-char *
-output_mov_double_fpu_from_arm (operands)
- rtx *operands;
-{
- int arm_reg0 = REGNO (operands[1]);
- rtx ops[2];
-
- if (arm_reg0 == 12)
- abort();
- ops[0] = gen_rtx (REG, SImode, arm_reg0);
- ops[1] = gen_rtx (REG, SImode, 1 + arm_reg0);
- output_asm_insn ("stm%?fd\t%|sp!, {%0, %1}", ops);
- output_asm_insn ("ldf%?d\t%0, [%|sp], #8", operands);
- return "";
-}
-
-/* Output a move from an fpu register to arm registers.
- OPERANDS[0] is the first registers of an arm register pair.
- OPERANDS[1] is an fpu register. */
-
-char *
-output_mov_double_arm_from_fpu (operands)
- rtx *operands;
-{
- int arm_reg0 = REGNO (operands[0]);
- rtx ops[2];
-
- if (arm_reg0 == 12)
- abort();
-
- ops[0] = gen_rtx (REG, SImode, arm_reg0);
- ops[1] = gen_rtx (REG, SImode, 1 + arm_reg0);
- output_asm_insn ("stf%?d\t%1, [%|sp, #-8]!", operands);
- output_asm_insn ("ldm%?fd\t%|sp!, {%0, %1}", ops);
- return "";
-}
-
-/* Output a move between double words.
- It must be REG<-REG, REG<-CONST_DOUBLE, REG<-CONST_INT, REG<-MEM
- or MEM<-REG and all MEMs must be offsettable addresses. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum rtx_code code0 = GET_CODE (operands[0]);
- enum rtx_code code1 = GET_CODE (operands[1]);
- rtx otherops[2];
-
- if (code0 == REG)
- {
- int reg0 = REGNO (operands[0]);
-
- otherops[0] = gen_rtx (REG, SImode, 1 + reg0);
- if (code1 == REG)
- {
- int reg1 = REGNO (operands[1]);
- if (reg1 == 12)
- abort();
-
- /* Ensure the second source is not overwritten */
- if (reg1 == reg0 + (WORDS_BIG_ENDIAN ? -1 : 1))
- output_asm_insn("mov%?\t%Q0, %Q1\n\tmov%?\t%R0, %R1", operands);
- else
- output_asm_insn("mov%?\t%R0, %R1\n\tmov%?\t%Q0, %Q1", operands);
- }
- else if (code1 == CONST_DOUBLE)
- {
- if (GET_MODE (operands[1]) == DFmode)
- {
- long l[2];
- union real_extract u;
-
- bcopy ((char *) &CONST_DOUBLE_LOW (operands[1]), (char *) &u,
- sizeof (u));
- REAL_VALUE_TO_TARGET_DOUBLE (u.d, l);
- otherops[1] = GEN_INT(l[1]);
- operands[1] = GEN_INT(l[0]);
- }
- else if (GET_MODE (operands[1]) != VOIDmode)
- abort ();
- else if (WORDS_BIG_ENDIAN)
- {
-
- otherops[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
- operands[1] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
- }
- else
- {
-
- otherops[1] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
- operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
- }
- output_mov_immediate (operands);
- output_mov_immediate (otherops);
- }
- else if (code1 == CONST_INT)
- {
- /* sign extend the intval into the high-order word */
- if (WORDS_BIG_ENDIAN)
- {
- otherops[1] = operands[1];
- operands[1] = (INTVAL (operands[1]) < 0
- ? constm1_rtx : const0_rtx);
- }
- else
- otherops[1] = INTVAL (operands[1]) < 0 ? constm1_rtx : const0_rtx;
- output_mov_immediate (otherops);
- output_mov_immediate (operands);
- }
- else if (code1 == MEM)
- {
- switch (GET_CODE (XEXP (operands[1], 0)))
- {
- case REG:
- output_asm_insn ("ldm%?ia\t%m1, %M0", operands);
- break;
-
- case PRE_INC:
- abort (); /* Should never happen now */
- break;
-
- case PRE_DEC:
- output_asm_insn ("ldm%?db\t%m1!, %M0", operands);
- break;
-
- case POST_INC:
- output_asm_insn ("ldm%?ia\t%m1!, %M0", operands);
- break;
-
- case POST_DEC:
- abort (); /* Should never happen now */
- break;
-
- case LABEL_REF:
- case CONST:
- output_asm_insn ("adr%?\t%0, %1", operands);
- output_asm_insn ("ldm%?ia\t%0, %M0", operands);
- break;
-
- default:
- if (arm_add_operand (XEXP (XEXP (operands[1], 0), 1)))
- {
- otherops[0] = operands[0];
- otherops[1] = XEXP (XEXP (operands[1], 0), 0);
- otherops[2] = XEXP (XEXP (operands[1], 0), 1);
- if (GET_CODE (XEXP (operands[1], 0)) == PLUS)
- {
- if (GET_CODE (otherops[2]) == CONST_INT)
- {
- switch (INTVAL (otherops[2]))
- {
- case -8:
- output_asm_insn ("ldm%?db\t%1, %M0", otherops);
- return "";
- case -4:
- output_asm_insn ("ldm%?da\t%1, %M0", otherops);
- return "";
- case 4:
- output_asm_insn ("ldm%?ib\t%1, %M0", otherops);
- return "";
- }
- if (!(const_ok_for_arm (INTVAL (otherops[2]))))
- output_asm_insn ("sub%?\t%0, %1, #%n2", otherops);
- else
- output_asm_insn ("add%?\t%0, %1, %2", otherops);
- }
- else
- output_asm_insn ("add%?\t%0, %1, %2", otherops);
- }
- else
- output_asm_insn ("sub%?\t%0, %1, %2", otherops);
- return "ldm%?ia\t%0, %M0";
- }
- else
- {
- otherops[1] = adj_offsettable_operand (operands[1], 4);
- /* Take care of overlapping base/data reg. */
- if (reg_mentioned_p (operands[0], operands[1]))
- {
- output_asm_insn ("ldr%?\t%0, %1", otherops);
- output_asm_insn ("ldr%?\t%0, %1", operands);
- }
- else
- {
- output_asm_insn ("ldr%?\t%0, %1", operands);
- output_asm_insn ("ldr%?\t%0, %1", otherops);
- }
- }
- }
- }
- else
- abort(); /* Constraints should prevent this */
- }
- else if (code0 == MEM && code1 == REG)
- {
- if (REGNO (operands[1]) == 12)
- abort();
-
- switch (GET_CODE (XEXP (operands[0], 0)))
- {
- case REG:
- output_asm_insn ("stm%?ia\t%m0, %M1", operands);
- break;
-
- case PRE_INC:
- abort (); /* Should never happen now */
- break;
-
- case PRE_DEC:
- output_asm_insn ("stm%?db\t%m0!, %M1", operands);
- break;
-
- case POST_INC:
- output_asm_insn ("stm%?ia\t%m0!, %M1", operands);
- break;
-
- case POST_DEC:
- abort (); /* Should never happen now */
- break;
-
- case PLUS:
- if (GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == CONST_INT)
- {
- switch (INTVAL (XEXP (XEXP (operands[0], 0), 1)))
- {
- case -8:
- output_asm_insn ("stm%?db\t%m0, %M1", operands);
- return "";
-
- case -4:
- output_asm_insn ("stm%?da\t%m0, %M1", operands);
- return "";
-
- case 4:
- output_asm_insn ("stm%?ib\t%m0, %M1", operands);
- return "";
- }
- }
- /* Fall through */
-
- default:
- otherops[0] = adj_offsettable_operand (operands[0], 4);
- otherops[1] = gen_rtx (REG, SImode, 1 + REGNO (operands[1]));
- output_asm_insn ("str%?\t%1, %0", operands);
- output_asm_insn ("str%?\t%1, %0", otherops);
- }
- }
- else
- abort(); /* Constraints should prevent this */
-
- return "";
-}
-
-
-/* Output an arbitrary MOV reg, #n.
- OPERANDS[0] is a register. OPERANDS[1] is a const_int. */
-
-char *
-output_mov_immediate (operands)
- rtx *operands;
-{
- HOST_WIDE_INT n = INTVAL (operands[1]);
- int n_ones = 0;
- int i;
-
- /* Try to use one MOV */
- if (const_ok_for_arm (n))
- {
- output_asm_insn ("mov%?\t%0, %1", operands);
- return "";
- }
-
- /* Try to use one MVN */
- if (const_ok_for_arm (~n))
- {
- operands[1] = GEN_INT (~n);
- output_asm_insn ("mvn%?\t%0, %1", operands);
- return "";
- }
-
- /* If all else fails, make it out of ORRs or BICs as appropriate. */
-
- for (i=0; i < 32; i++)
- if (n & 1 << i)
- n_ones++;
-
- if (n_ones > 16) /* Shorter to use MVN with BIC in this case. */
- output_multi_immediate(operands, "mvn%?\t%0, %1", "bic%?\t%0, %0, %1", 1,
- ~n);
- else
- output_multi_immediate(operands, "mov%?\t%0, %1", "orr%?\t%0, %0, %1", 1,
- n);
-
- return "";
-}
-
-
-/* Output an ADD r, s, #n where n may be too big for one instruction. If
- adding zero to one register, output nothing. */
-
-char *
-output_add_immediate (operands)
- rtx *operands;
-{
- HOST_WIDE_INT n = INTVAL (operands[2]);
-
- if (n != 0 || REGNO (operands[0]) != REGNO (operands[1]))
- {
- if (n < 0)
- output_multi_immediate (operands,
- "sub%?\t%0, %1, %2", "sub%?\t%0, %0, %2", 2,
- -n);
- else
- output_multi_immediate (operands,
- "add%?\t%0, %1, %2", "add%?\t%0, %0, %2", 2,
- n);
- }
-
- return "";
-}
-
-/* Output a multiple immediate operation.
- OPERANDS is the vector of operands referred to in the output patterns.
- INSTR1 is the output pattern to use for the first constant.
- INSTR2 is the output pattern to use for subsequent constants.
- IMMED_OP is the index of the constant slot in OPERANDS.
- N is the constant value. */
-
-char *
-output_multi_immediate (operands, instr1, instr2, immed_op, n)
- rtx *operands;
- char *instr1, *instr2;
- int immed_op;
- HOST_WIDE_INT n;
-{
-#if HOST_BITS_PER_WIDE_INT > 32
- n &= 0xffffffff;
-#endif
-
- if (n == 0)
- {
- operands[immed_op] = const0_rtx;
- output_asm_insn (instr1, operands); /* Quick and easy output */
- }
- else
- {
- int i;
- char *instr = instr1;
-
- /* Note that n is never zero here (which would give no output) */
- for (i = 0; i < 32; i += 2)
- {
- if (n & (3 << i))
- {
- operands[immed_op] = GEN_INT (n & (255 << i));
- output_asm_insn (instr, operands);
- instr = instr2;
- i += 6;
- }
- }
- }
- return "";
-}
-
-
-/* Return the appropriate ARM instruction for the operation code.
- The returned result should not be overwritten. OP is the rtx of the
- operation. SHIFT_FIRST_ARG is TRUE if the first argument of the operator
- was shifted. */
-
-char *
-arithmetic_instr (op, shift_first_arg)
- rtx op;
- int shift_first_arg;
-{
- switch (GET_CODE (op))
- {
- case PLUS:
- return "add";
-
- case MINUS:
- return shift_first_arg ? "rsb" : "sub";
-
- case IOR:
- return "orr";
-
- case XOR:
- return "eor";
-
- case AND:
- return "and";
-
- default:
- abort ();
- }
-}
-
-
-/* Ensure valid constant shifts and return the appropriate shift mnemonic
- for the operation code. The returned result should not be overwritten.
- OP is the rtx code of the shift.
- On exit, *AMOUNTP will be -1 if the shift is by a register, or a constant
- shift. */
-
-static char *
-shift_op (op, amountp)
- rtx op;
- HOST_WIDE_INT *amountp;
-{
- char *mnem;
- enum rtx_code code = GET_CODE (op);
-
- if (GET_CODE (XEXP (op, 1)) == REG || GET_CODE (XEXP (op, 1)) == SUBREG)
- *amountp = -1;
- else if (GET_CODE (XEXP (op, 1)) == CONST_INT)
- *amountp = INTVAL (XEXP (op, 1));
- else
- abort ();
-
- switch (code)
- {
- case ASHIFT:
- mnem = "asl";
- break;
-
- case ASHIFTRT:
- mnem = "asr";
- break;
-
- case LSHIFTRT:
- mnem = "lsr";
- break;
-
- case ROTATERT:
- mnem = "ror";
- break;
-
- case MULT:
- /* We never have to worry about the amount being other than a
- power of 2, since this case can never be reloaded from a reg. */
- if (*amountp != -1)
- *amountp = int_log2 (*amountp);
- else
- abort ();
- return "asl";
-
- default:
- abort ();
- }
-
- if (*amountp != -1)
- {
- /* This is not 100% correct, but follows from the desire to merge
- multiplication by a power of 2 with the recognizer for a
- shift. >=32 is not a valid shift for "asl", so we must try and
- output a shift that produces the correct arithmetical result.
- Using lsr #32 is identical except for the fact that the carry bit
- is not set correctly if we set the flags; but we never use the
- carry bit from such an operation, so we can ignore that. */
- if (code == ROTATERT)
- *amountp &= 31; /* Rotate is just modulo 32 */
- else if (*amountp != (*amountp & 31))
- {
- if (code == ASHIFT)
- mnem = "lsr";
- *amountp = 32;
- }
-
- /* Shifts of 0 are no-ops. */
- if (*amountp == 0)
- return NULL;
- }
-
- return mnem;
-}
-
-
-/* Obtain the shift from the POWER of two. */
-
-HOST_WIDE_INT
-int_log2 (power)
- HOST_WIDE_INT power;
-{
- HOST_WIDE_INT shift = 0;
-
- while (((((HOST_WIDE_INT) 1) << shift) & power) == 0)
- {
- if (shift > 31)
- abort ();
- shift++;
- }
-
- return shift;
-}
-
-/* Output a .ascii pseudo-op, keeping track of lengths. This is because
- /bin/as is horribly restrictive. */
-
-void
-output_ascii_pseudo_op (stream, p, len)
- FILE *stream;
- unsigned char *p;
- int len;
-{
- int i;
- int len_so_far = 1000;
- int chars_so_far = 0;
-
- for (i = 0; i < len; i++)
- {
- register int c = p[i];
-
- if (len_so_far > 50)
- {
- if (chars_so_far)
- fputs ("\"\n", stream);
- fputs ("\t.ascii\t\"", stream);
- len_so_far = 0;
- arm_increase_location (chars_so_far);
- chars_so_far = 0;
- }
-
- if (c == '\"' || c == '\\')
- {
- putc('\\', stream);
- len_so_far++;
- }
-
- if (c >= ' ' && c < 0177)
- {
- putc (c, stream);
- len_so_far++;
- }
- else
- {
- fprintf (stream, "\\%03o", c);
- len_so_far +=4;
- }
-
- chars_so_far++;
- }
-
- fputs ("\"\n", stream);
- arm_increase_location (chars_so_far);
-}
-
-
-/* Try to determine whether a pattern really clobbers the link register.
- This information is useful when peepholing, so that lr need not be pushed
- if we combine a call followed by a return.
- NOTE: This code does not check for side-effect expressions in a SET_SRC:
- such a check should not be needed because these only update an existing
- value within a register; the register must still be set elsewhere within
- the function. */
-
-static int
-pattern_really_clobbers_lr (x)
- rtx x;
-{
- int i;
-
- switch (GET_CODE (x))
- {
- case SET:
- switch (GET_CODE (SET_DEST (x)))
- {
- case REG:
- return REGNO (SET_DEST (x)) == 14;
-
- case SUBREG:
- if (GET_CODE (XEXP (SET_DEST (x), 0)) == REG)
- return REGNO (XEXP (SET_DEST (x), 0)) == 14;
-
- if (GET_CODE (XEXP (SET_DEST (x), 0)) == MEM)
- return 0;
- abort ();
-
- default:
- return 0;
- }
-
- case PARALLEL:
- for (i = 0; i < XVECLEN (x, 0); i++)
- if (pattern_really_clobbers_lr (XVECEXP (x, 0, i)))
- return 1;
- return 0;
-
- case CLOBBER:
- switch (GET_CODE (XEXP (x, 0)))
- {
- case REG:
- return REGNO (XEXP (x, 0)) == 14;
-
- case SUBREG:
- if (GET_CODE (XEXP (XEXP (x, 0), 0)) == REG)
- return REGNO (XEXP (XEXP (x, 0), 0)) == 14;
- abort ();
-
- default:
- return 0;
- }
-
- case UNSPEC:
- return 1;
-
- default:
- return 0;
- }
-}
-
-static int
-function_really_clobbers_lr (first)
- rtx first;
-{
- rtx insn, next;
-
- for (insn = first; insn; insn = next_nonnote_insn (insn))
- {
- switch (GET_CODE (insn))
- {
- case BARRIER:
- case NOTE:
- case CODE_LABEL:
- case JUMP_INSN: /* Jump insns only change the PC (and conds) */
- case INLINE_HEADER:
- break;
-
- case INSN:
- if (pattern_really_clobbers_lr (PATTERN (insn)))
- return 1;
- break;
-
- case CALL_INSN:
- /* Don't yet know how to handle those calls that are not to a
- SYMBOL_REF */
- if (GET_CODE (PATTERN (insn)) != PARALLEL)
- abort ();
-
- switch (GET_CODE (XVECEXP (PATTERN (insn), 0, 0)))
- {
- case CALL:
- if (GET_CODE (XEXP (XEXP (XVECEXP (PATTERN (insn), 0, 0), 0), 0))
- != SYMBOL_REF)
- return 1;
- break;
-
- case SET:
- if (GET_CODE (XEXP (XEXP (SET_SRC (XVECEXP (PATTERN (insn),
- 0, 0)), 0), 0))
- != SYMBOL_REF)
- return 1;
- break;
-
- default: /* Don't recognize it, be safe */
- return 1;
- }
-
- /* A call can be made (by peepholing) not to clobber lr iff it is
- followed by a return. There may, however, be a use insn iff
- we are returning the result of the call.
- If we run off the end of the insn chain, then that means the
- call was at the end of the function. Unfortunately we don't
- have a return insn for the peephole to recognize, so we
- must reject this. (Can this be fixed by adding our own insn?) */
- if ((next = next_nonnote_insn (insn)) == NULL)
- return 1;
-
- if (GET_CODE (next) == INSN && GET_CODE (PATTERN (next)) == USE
- && (GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET)
- && (REGNO (SET_DEST (XVECEXP (PATTERN (insn), 0, 0)))
- == REGNO (XEXP (PATTERN (next), 0))))
- if ((next = next_nonnote_insn (next)) == NULL)
- return 1;
-
- if (GET_CODE (next) == JUMP_INSN
- && GET_CODE (PATTERN (next)) == RETURN)
- break;
- return 1;
-
- default:
- abort ();
- }
- }
-
- /* We have reached the end of the chain so lr was _not_ clobbered */
- return 0;
-}
-
-char *
-output_return_instruction (operand, really_return, reverse)
- rtx operand;
- int really_return;
- int reverse;
-{
- char instr[100];
- int reg, live_regs = 0;
- int volatile_func = (optimize > 0
- && TREE_THIS_VOLATILE (current_function_decl));
-
- return_used_this_function = 1;
-
- if (volatile_func)
- {
- rtx ops[2];
- /* If this function was declared non-returning, and we have found a tail
- call, then we have to trust that the called function won't return. */
- if (! really_return)
- return "";
-
- /* Otherwise, trap an attempted return by aborting. */
- ops[0] = operand;
- ops[1] = gen_rtx (SYMBOL_REF, Pmode, "abort");
- assemble_external_libcall (ops[1]);
- output_asm_insn (reverse ? "bl%D0\t%a1" : "bl%d0\t%a1", ops);
- return "";
- }
-
- if (current_function_calls_alloca && ! really_return)
- abort();
-
- for (reg = 0; reg <= 10; reg++)
- if (regs_ever_live[reg] && ! call_used_regs[reg])
- live_regs++;
-
- if (live_regs || (regs_ever_live[14] && ! lr_save_eliminated))
- live_regs++;
-
- if (frame_pointer_needed)
- live_regs += 4;
-
- if (live_regs)
- {
- if (lr_save_eliminated || ! regs_ever_live[14])
- live_regs++;
-
- if (frame_pointer_needed)
- strcpy (instr,
- reverse ? "ldm%?%D0ea\t%|fp, {" : "ldm%?%d0ea\t%|fp, {");
- else
- strcpy (instr,
- reverse ? "ldm%?%D0fd\t%|sp!, {" : "ldm%?%d0fd\t%|sp!, {");
-
- for (reg = 0; reg <= 10; reg++)
- if (regs_ever_live[reg] && ! call_used_regs[reg])
- {
- strcat (instr, "%|");
- strcat (instr, reg_names[reg]);
- if (--live_regs)
- strcat (instr, ", ");
- }
-
- if (frame_pointer_needed)
- {
- strcat (instr, "%|");
- strcat (instr, reg_names[11]);
- strcat (instr, ", ");
- strcat (instr, "%|");
- strcat (instr, reg_names[13]);
- strcat (instr, ", ");
- strcat (instr, "%|");
- strcat (instr, really_return ? reg_names[15] : reg_names[14]);
- }
- else
- {
- strcat (instr, "%|");
- strcat (instr, really_return ? reg_names[15] : reg_names[14]);
- }
- strcat (instr, (TARGET_APCS_32 || !really_return) ? "}" : "}^");
- output_asm_insn (instr, &operand);
- }
- else if (really_return)
- {
- sprintf (instr, "mov%%?%%%s0%s\t%%|pc, %%|lr",
- reverse ? "D" : "d", TARGET_APCS_32 ? "" : "s");
- output_asm_insn (instr, &operand);
- }
-
- return "";
-}
-
-/* Return nonzero if optimizing and the current function is volatile.
- Such functions never return, and many memory cycles can be saved
- by not storing register values that will never be needed again.
- This optimization was added to speed up context switching in a
- kernel application. */
-
-int
-arm_volatile_func ()
-{
- return (optimize > 0 && TREE_THIS_VOLATILE (current_function_decl));
-}
-
-/* Return the size of the prologue. It's not too bad if we slightly
- over-estimate. */
-
-static int
-get_prologue_size ()
-{
- return profile_flag ? 12 : 0;
-}
-
-/* The amount of stack adjustment that happens here, in output_return and in
- output_epilogue must be exactly the same as was calculated during reload,
- or things will point to the wrong place. The only time we can safely
- ignore this constraint is when a function has no arguments on the stack,
- no stack frame requirement and no live registers execpt for `lr'. If we
- can guarantee that by making all function calls into tail calls and that
- lr is not clobbered in any other way, then there is no need to push lr
- onto the stack. */
-
-void
-output_func_prologue (f, frame_size)
- FILE *f;
- int frame_size;
-{
- int reg, live_regs_mask = 0;
- rtx operands[3];
- int volatile_func = (optimize > 0
- && TREE_THIS_VOLATILE (current_function_decl));
-
- /* Nonzero if we must stuff some register arguments onto the stack as if
- they were passed there. */
- int store_arg_regs = 0;
-
- if (arm_ccfsm_state || arm_target_insn)
- abort (); /* Sanity check */
-
- if (arm_naked_function_p (current_function_decl))
- return;
-
- return_used_this_function = 0;
- lr_save_eliminated = 0;
-
- fprintf (f, "\t%s args = %d, pretend = %d, frame = %d\n",
- ASM_COMMENT_START, current_function_args_size,
- current_function_pretend_args_size, frame_size);
- fprintf (f, "\t%s frame_needed = %d, current_function_anonymous_args = %d\n",
- ASM_COMMENT_START, frame_pointer_needed,
- current_function_anonymous_args);
-
- if (volatile_func)
- fprintf (f, "\t%s Volatile function.\n", ASM_COMMENT_START);
-
- if (current_function_anonymous_args && current_function_pretend_args_size)
- store_arg_regs = 1;
-
- for (reg = 0; reg <= 10; reg++)
- if (regs_ever_live[reg] && ! call_used_regs[reg])
- live_regs_mask |= (1 << reg);
-
- if (frame_pointer_needed)
- live_regs_mask |= 0xD800;
- else if (regs_ever_live[14])
- {
- if (! current_function_args_size
- && ! function_really_clobbers_lr (get_insns ()))
- lr_save_eliminated = 1;
- else
- live_regs_mask |= 0x4000;
- }
-
- if (live_regs_mask)
- {
- /* if a di mode load/store multiple is used, and the base register
- is r3, then r4 can become an ever live register without lr
- doing so, in this case we need to push lr as well, or we
- will fail to get a proper return. */
-
- live_regs_mask |= 0x4000;
- lr_save_eliminated = 0;
-
- }
-
- if (lr_save_eliminated)
- fprintf (f,"\t%s I don't think this function clobbers lr\n",
- ASM_COMMENT_START);
-}
-
-
-void
-output_func_epilogue (f, frame_size)
- FILE *f;
- int frame_size;
-{
- int reg, live_regs_mask = 0, code_size = 0;
- /* If we need this then it will always be at lesat this much */
- int floats_offset = 24;
- rtx operands[3];
- int volatile_func = (optimize > 0
- && TREE_THIS_VOLATILE (current_function_decl));
-
- if (use_return_insn() && return_used_this_function)
- {
- if (frame_size && !(frame_pointer_needed || TARGET_APCS))
- {
- abort ();
- }
- goto epilogue_done;
- }
-
- /* Naked functions don't have epilogues. */
- if (arm_naked_function_p (current_function_decl))
- goto epilogue_done;
-
- /* A volatile function should never return. Call abort. */
- if (volatile_func)
- {
- rtx op = gen_rtx (SYMBOL_REF, Pmode, "abort");
- assemble_external_libcall (op);
- output_asm_insn ("bl\t%a0", &op);
- code_size = 4;
- goto epilogue_done;
- }
-
- for (reg = 0; reg <= 10; reg++)
- if (regs_ever_live[reg] && ! call_used_regs[reg])
- {
- live_regs_mask |= (1 << reg);
- floats_offset += 4;
- }
-
- if (frame_pointer_needed)
- {
- for (reg = 23; reg > 15; reg--)
- if (regs_ever_live[reg] && ! call_used_regs[reg])
- {
- fprintf (f, "\tldfe\t%s%s, [%sfp, #-%d]\n", REGISTER_PREFIX,
- reg_names[reg], REGISTER_PREFIX, floats_offset);
- floats_offset += 12;
- code_size += 4;
- }
-
- live_regs_mask |= 0xA800;
- print_multi_reg (f, "ldmea\t%sfp", live_regs_mask,
- TARGET_APCS_32 ? FALSE : TRUE);
- code_size += 4;
- }
- else
- {
- /* Restore stack pointer if necessary. */
- if (frame_size)
- {
- operands[0] = operands[1] = stack_pointer_rtx;
- operands[2] = gen_rtx (CONST_INT, VOIDmode, frame_size);
- output_add_immediate (operands);
- }
-
- for (reg = 16; reg < 24; reg++)
- if (regs_ever_live[reg] && ! call_used_regs[reg])
- {
- fprintf (f, "\tldfe\t%s%s, [%ssp], #12\n", REGISTER_PREFIX,
- reg_names[reg], REGISTER_PREFIX);
- code_size += 4;
- }
- if (current_function_pretend_args_size == 0 && regs_ever_live[14])
- {
- print_multi_reg (f, "ldmfd\t%ssp!", live_regs_mask | 0x8000,
- TARGET_APCS_32 ? FALSE : TRUE);
- code_size += 4;
- }
- else
- {
- if (live_regs_mask || regs_ever_live[14])
- {
- live_regs_mask |= 0x4000;
- print_multi_reg (f, "ldmfd\t%ssp!", live_regs_mask, FALSE);
- code_size += 4;
- }
- if (current_function_pretend_args_size)
- {
- operands[0] = operands[1] = stack_pointer_rtx;
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- current_function_pretend_args_size);
- output_add_immediate (operands);
- }
- fprintf (f, (TARGET_APCS_32 ? "\tmov\t%spc, %slr\n"
- : "\tmovs\t%spc, %slr\n"),
- REGISTER_PREFIX, REGISTER_PREFIX, f);
- code_size += 4;
- }
- }
-
- epilogue_done:
-
- /* insn_addresses isn't allocated when not optimizing */
- /* ??? The previous comment is incorrect. Clarify. */
-
- if (optimize > 0)
- arm_increase_location (code_size
- + insn_addresses[INSN_UID (get_last_insn ())]
- + get_prologue_size ());
-
- current_function_anonymous_args = 0;
-}
-
-static void
-emit_multi_reg_push (mask)
- int mask;
-{
- int num_regs = 0;
- int i, j;
- rtx par;
-
- for (i = 0; i < 16; i++)
- if (mask & (1 << i))
- num_regs++;
-
- if (num_regs == 0 || num_regs > 16)
- abort ();
-
- par = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (num_regs));
-
- for (i = 0; i < 16; i++)
- {
- if (mask & (1 << i))
- {
- XVECEXP (par, 0, 0)
- = gen_rtx (SET, VOIDmode, gen_rtx (MEM, BLKmode,
- gen_rtx (PRE_DEC, BLKmode,
- stack_pointer_rtx)),
- gen_rtx (UNSPEC, BLKmode,
- gen_rtvec (1, gen_rtx (REG, SImode, i)),
- 2));
- break;
- }
- }
-
- for (j = 1, i++; j < num_regs; i++)
- {
- if (mask & (1 << i))
- {
- XVECEXP (par, 0, j)
- = gen_rtx (USE, VOIDmode, gen_rtx (REG, SImode, i));
- j++;
- }
- }
- emit_insn (par);
-}
-
-void
-arm_expand_prologue ()
-{
- int reg;
- rtx amount = GEN_INT (- get_frame_size ());
- rtx push_insn;
- int num_regs;
- int live_regs_mask = 0;
- int store_arg_regs = 0;
- int volatile_func = (optimize > 0
- && TREE_THIS_VOLATILE (current_function_decl));
-
- /* Naked functions don't have prologues. */
- if (arm_naked_function_p (current_function_decl))
- return;
-
- if (current_function_anonymous_args && current_function_pretend_args_size)
- store_arg_regs = 1;
-
- if (! volatile_func)
- for (reg = 0; reg <= 10; reg++)
- if (regs_ever_live[reg] && ! call_used_regs[reg])
- live_regs_mask |= 1 << reg;
-
- if (! volatile_func && regs_ever_live[14])
- live_regs_mask |= 0x4000;
-
- if (frame_pointer_needed)
- {
- live_regs_mask |= 0xD800;
- emit_insn (gen_movsi (gen_rtx (REG, SImode, 12),
- stack_pointer_rtx));
- }
-
- if (current_function_pretend_args_size)
- {
- if (store_arg_regs)
- emit_multi_reg_push ((0xf0 >> (current_function_pretend_args_size / 4))
- & 0xf);
- else
- emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (-current_function_pretend_args_size)));
- }
-
- if (live_regs_mask)
- {
- /* If we have to push any regs, then we must push lr as well, or
- we won't get a proper return. */
- live_regs_mask |= 0x4000;
- emit_multi_reg_push (live_regs_mask);
- }
-
- /* For now the integer regs are still pushed in output_func_epilogue (). */
-
- if (! volatile_func)
- for (reg = 23; reg > 15; reg--)
- if (regs_ever_live[reg] && ! call_used_regs[reg])
- emit_insn (gen_rtx (SET, VOIDmode,
- gen_rtx (MEM, XFmode,
- gen_rtx (PRE_DEC, XFmode,
- stack_pointer_rtx)),
- gen_rtx (REG, XFmode, reg)));
-
- if (frame_pointer_needed)
- emit_insn (gen_addsi3 (hard_frame_pointer_rtx, gen_rtx (REG, SImode, 12),
- (GEN_INT
- (-(4 + current_function_pretend_args_size)))));
-
- if (amount != const0_rtx)
- {
- emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, amount));
- emit_insn (gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (MEM, BLKmode, stack_pointer_rtx)));
- }
-
- /* If we are profiling, make sure no instructions are scheduled before
- the call to mcount. */
- if (profile_flag || profile_block_flag)
- emit_insn (gen_blockage ());
-}
-
-
-/* If CODE is 'd', then the X is a condition operand and the instruction
- should only be executed if the condition is true.
- if CODE is 'D', then the X is a condition operand and the instruction
- should only be executed if the condition is false: however, if the mode
- of the comparison is CCFPEmode, then always execute the instruction -- we
- do this because in these circumstances !GE does not necessarily imply LT;
- in these cases the instruction pattern will take care to make sure that
- an instruction containing %d will follow, thereby undoing the effects of
- doing this instruction unconditionally.
- If CODE is 'N' then X is a floating point operand that must be negated
- before output.
- If CODE is 'B' then output a bitwise inverted value of X (a const int).
- If X is a REG and CODE is `M', output a ldm/stm style multi-reg. */
-
-void
-arm_print_operand (stream, x, code)
- FILE *stream;
- rtx x;
- int code;
-{
- switch (code)
- {
- case '@':
- fputs (ASM_COMMENT_START, stream);
- return;
-
- case '|':
- fputs (REGISTER_PREFIX, stream);
- return;
-
- case '?':
- if (arm_ccfsm_state == 3 || arm_ccfsm_state == 4)
- fputs (arm_condition_codes[arm_current_cc], stream);
- return;
-
- case 'N':
- {
- REAL_VALUE_TYPE r;
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
- r = REAL_VALUE_NEGATE (r);
- fprintf (stream, "%s", fp_const_from_val (&r));
- }
- return;
-
- case 'B':
- if (GET_CODE (x) == CONST_INT)
- fprintf (stream,
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- "%d",
-#else
- "%ld",
-#endif
- ARM_SIGN_EXTEND (~ INTVAL (x)));
- else
- {
- putc ('~', stream);
- output_addr_const (stream, x);
- }
- return;
-
- case 'i':
- fprintf (stream, "%s", arithmetic_instr (x, 1));
- return;
-
- case 'I':
- fprintf (stream, "%s", arithmetic_instr (x, 0));
- return;
-
- case 'S':
- {
- HOST_WIDE_INT val;
- char *shift = shift_op (x, &val);
-
- if (shift)
- {
- fprintf (stream, ", %s ", shift_op (x, &val));
- if (val == -1)
- arm_print_operand (stream, XEXP (x, 1), 0);
- else
- fprintf (stream,
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- "#%d",
-#else
- "#%ld",
-#endif
- val);
- }
- }
- return;
-
- case 'Q':
- if (REGNO (x) > 15)
- abort ();
- fputs (REGISTER_PREFIX, stream);
- fputs (reg_names[REGNO (x) + (WORDS_BIG_ENDIAN ? 1 : 0)], stream);
- return;
-
- case 'R':
- if (REGNO (x) > 15)
- abort ();
- fputs (REGISTER_PREFIX, stream);
- fputs (reg_names[REGNO (x) + (WORDS_BIG_ENDIAN ? 0 : 1)], stream);
- return;
-
- case 'm':
- fputs (REGISTER_PREFIX, stream);
- if (GET_CODE (XEXP (x, 0)) == REG)
- fputs (reg_names[REGNO (XEXP (x, 0))], stream);
- else
- fputs (reg_names[REGNO (XEXP (XEXP (x, 0), 0))], stream);
- return;
-
- case 'M':
- fprintf (stream, "{%s%s-%s%s}", REGISTER_PREFIX, reg_names[REGNO (x)],
- REGISTER_PREFIX, reg_names[REGNO (x) - 1
- + ((GET_MODE_SIZE (GET_MODE (x))
- + GET_MODE_SIZE (SImode) - 1)
- / GET_MODE_SIZE (SImode))]);
- return;
-
- case 'd':
- if (x)
- fputs (arm_condition_codes[get_arm_condition_code (x)],
- stream);
- return;
-
- case 'D':
- if (x)
- fputs (arm_condition_codes[ARM_INVERSE_CONDITION_CODE
- (get_arm_condition_code (x))],
- stream);
- return;
-
- default:
- if (x == 0)
- abort ();
-
- if (GET_CODE (x) == REG)
- {
- fputs (REGISTER_PREFIX, stream);
- fputs (reg_names[REGNO (x)], stream);
- }
- else if (GET_CODE (x) == MEM)
- {
- output_memory_reference_mode = GET_MODE (x);
- output_address (XEXP (x, 0));
- }
- else if (GET_CODE (x) == CONST_DOUBLE)
- fprintf (stream, "#%s", fp_immediate_constant (x));
- else if (GET_CODE (x) == NEG)
- abort (); /* This should never happen now. */
- else
- {
- fputc ('#', stream);
- output_addr_const (stream, x);
- }
- }
-}
-
-/* Increase the `arm_text_location' by AMOUNT if we're in the text
- segment. */
-
-void
-arm_increase_location (amount)
- int amount;
-{
- if (in_text_section ())
- arm_text_location += amount;
-}
-
-
-/* Output a label definition. If this label is within the .text segment, it
- is stored in OFFSET_TABLE, to be used when building `llc' instructions.
- Maybe GCC remembers names not starting with a `*' for a long time, but this
- is a minority anyway, so we just make a copy. Do not store the leading `*'
- if the name starts with one. */
-
-void
-arm_asm_output_label (stream, name)
- FILE *stream;
- char *name;
-{
- char *real_name, *s;
- struct label_offset *cur;
- int hash = 0;
-
- ARM_OUTPUT_LABEL (stream, name);
- if (! in_text_section ())
- return;
-
- if (name[0] == '*')
- {
- real_name = xmalloc (1 + strlen (&name[1]));
- strcpy (real_name, &name[1]);
- }
- else
- {
- real_name = xmalloc (2 + strlen (name));
- strcpy (real_name, USER_LABEL_PREFIX);
- strcat (real_name, name);
- }
- for (s = real_name; *s; s++)
- hash += *s;
-
- hash = hash % LABEL_HASH_SIZE;
- cur = (struct label_offset *) xmalloc (sizeof (struct label_offset));
- cur->name = real_name;
- cur->offset = arm_text_location;
- cur->cdr = offset_table[hash];
- offset_table[hash] = cur;
-}
-
-/* Output code resembling an .lcomm directive. /bin/as doesn't have this
- directive hence this hack, which works by reserving some `.space' in the
- bss segment directly.
-
- XXX This is a severe hack, which is guaranteed NOT to work since it doesn't
- define STATIC COMMON space but merely STATIC BSS space. */
-
-void
-output_lcomm_directive (stream, name, size, align)
- FILE *stream;
- char *name;
- int size, align;
-{
- bss_section ();
- ASM_OUTPUT_ALIGN (stream, floor_log2 (align / BITS_PER_UNIT));
- ARM_OUTPUT_LABEL (stream, name);
- fprintf (stream, "\t.space\t%d\n", size);
-}
-
-/* A finite state machine takes care of noticing whether or not instructions
- can be conditionally executed, and thus decrease execution time and code
- size by deleting branch instructions. The fsm is controlled by
- final_prescan_insn, and controls the actions of ASM_OUTPUT_OPCODE. */
-
-/* The state of the fsm controlling condition codes are:
- 0: normal, do nothing special
- 1: make ASM_OUTPUT_OPCODE not output this instruction
- 2: make ASM_OUTPUT_OPCODE not output this instruction
- 3: make instructions conditional
- 4: make instructions conditional
-
- State transitions (state->state by whom under condition):
- 0 -> 1 final_prescan_insn if the `target' is a label
- 0 -> 2 final_prescan_insn if the `target' is an unconditional branch
- 1 -> 3 ASM_OUTPUT_OPCODE after not having output the conditional branch
- 2 -> 4 ASM_OUTPUT_OPCODE after not having output the conditional branch
- 3 -> 0 ASM_OUTPUT_INTERNAL_LABEL if the `target' label is reached
- (the target label has CODE_LABEL_NUMBER equal to arm_target_label).
- 4 -> 0 final_prescan_insn if the `target' unconditional branch is reached
- (the target insn is arm_target_insn).
-
- If the jump clobbers the conditions then we use states 2 and 4.
-
- A similar thing can be done with conditional return insns.
-
- XXX In case the `target' is an unconditional branch, this conditionalising
- of the instructions always reduces code size, but not always execution
- time. But then, I want to reduce the code size to somewhere near what
- /bin/cc produces. */
-
-/* Returns the index of the ARM condition code string in
- `arm_condition_codes'. COMPARISON should be an rtx like
- `(eq (...) (...))'. */
-
-static enum arm_cond_code
-get_arm_condition_code (comparison)
- rtx comparison;
-{
- enum machine_mode mode = GET_MODE (XEXP (comparison, 0));
- register int code;
- register enum rtx_code comp_code = GET_CODE (comparison);
-
- if (GET_MODE_CLASS (mode) != MODE_CC)
- mode = SELECT_CC_MODE (comp_code, XEXP (comparison, 0),
- XEXP (comparison, 1));
-
- switch (mode)
- {
- case CC_DNEmode: code = ARM_NE; goto dominance;
- case CC_DEQmode: code = ARM_EQ; goto dominance;
- case CC_DGEmode: code = ARM_GE; goto dominance;
- case CC_DGTmode: code = ARM_GT; goto dominance;
- case CC_DLEmode: code = ARM_LE; goto dominance;
- case CC_DLTmode: code = ARM_LT; goto dominance;
- case CC_DGEUmode: code = ARM_CS; goto dominance;
- case CC_DGTUmode: code = ARM_HI; goto dominance;
- case CC_DLEUmode: code = ARM_LS; goto dominance;
- case CC_DLTUmode: code = ARM_CC;
-
- dominance:
- if (comp_code != EQ && comp_code != NE)
- abort ();
-
- if (comp_code == EQ)
- return ARM_INVERSE_CONDITION_CODE (code);
- return code;
-
- case CC_NOOVmode:
- switch (comp_code)
- {
- case NE: return ARM_NE;
- case EQ: return ARM_EQ;
- case GE: return ARM_PL;
- case LT: return ARM_MI;
- default: abort ();
- }
-
- case CC_Zmode:
- case CCFPmode:
- switch (comp_code)
- {
- case NE: return ARM_NE;
- case EQ: return ARM_EQ;
- default: abort ();
- }
-
- case CCFPEmode:
- switch (comp_code)
- {
- case GE: return ARM_GE;
- case GT: return ARM_GT;
- case LE: return ARM_LS;
- case LT: return ARM_MI;
- default: abort ();
- }
-
- case CC_SWPmode:
- switch (comp_code)
- {
- case NE: return ARM_NE;
- case EQ: return ARM_EQ;
- case GE: return ARM_LE;
- case GT: return ARM_LT;
- case LE: return ARM_GE;
- case LT: return ARM_GT;
- case GEU: return ARM_LS;
- case GTU: return ARM_CC;
- case LEU: return ARM_CS;
- case LTU: return ARM_HI;
- default: abort ();
- }
-
- case CC_Cmode:
- switch (comp_code)
- {
- case LTU: return ARM_CS;
- case GEU: return ARM_CC;
- default: abort ();
- }
-
- case CCmode:
- switch (comp_code)
- {
- case NE: return ARM_NE;
- case EQ: return ARM_EQ;
- case GE: return ARM_GE;
- case GT: return ARM_GT;
- case LE: return ARM_LE;
- case LT: return ARM_LT;
- case GEU: return ARM_CS;
- case GTU: return ARM_HI;
- case LEU: return ARM_LS;
- case LTU: return ARM_CC;
- default: abort ();
- }
-
- default: abort ();
- }
-
- abort ();
-}
-
-
-void
-final_prescan_insn (insn, opvec, noperands)
- rtx insn;
- rtx *opvec;
- int noperands;
-{
- /* BODY will hold the body of INSN. */
- register rtx body = PATTERN (insn);
-
- /* This will be 1 if trying to repeat the trick, and things need to be
- reversed if it appears to fail. */
- int reverse = 0;
-
- /* JUMP_CLOBBERS will be one implies that the conditions if a branch is
- taken are clobbered, even if the rtl suggests otherwise. It also
- means that we have to grub around within the jump expression to find
- out what the conditions are when the jump isn't taken. */
- int jump_clobbers = 0;
-
- /* If we start with a return insn, we only succeed if we find another one. */
- int seeking_return = 0;
-
- /* START_INSN will hold the insn from where we start looking. This is the
- first insn after the following code_label if REVERSE is true. */
- rtx start_insn = insn;
-
- /* If in state 4, check if the target branch is reached, in order to
- change back to state 0. */
- if (arm_ccfsm_state == 4)
- {
- if (insn == arm_target_insn)
- {
- arm_target_insn = NULL;
- arm_ccfsm_state = 0;
- }
- return;
- }
-
- /* If in state 3, it is possible to repeat the trick, if this insn is an
- unconditional branch to a label, and immediately following this branch
- is the previous target label which is only used once, and the label this
- branch jumps to is not too far off. */
- if (arm_ccfsm_state == 3)
- {
- if (simplejump_p (insn))
- {
- start_insn = next_nonnote_insn (start_insn);
- if (GET_CODE (start_insn) == BARRIER)
- {
- /* XXX Isn't this always a barrier? */
- start_insn = next_nonnote_insn (start_insn);
- }
- if (GET_CODE (start_insn) == CODE_LABEL
- && CODE_LABEL_NUMBER (start_insn) == arm_target_label
- && LABEL_NUSES (start_insn) == 1)
- reverse = TRUE;
- else
- return;
- }
- else if (GET_CODE (body) == RETURN)
- {
- start_insn = next_nonnote_insn (start_insn);
- if (GET_CODE (start_insn) == BARRIER)
- start_insn = next_nonnote_insn (start_insn);
- if (GET_CODE (start_insn) == CODE_LABEL
- && CODE_LABEL_NUMBER (start_insn) == arm_target_label
- && LABEL_NUSES (start_insn) == 1)
- {
- reverse = TRUE;
- seeking_return = 1;
- }
- else
- return;
- }
- else
- return;
- }
-
- if (arm_ccfsm_state != 0 && !reverse)
- abort ();
- if (GET_CODE (insn) != JUMP_INSN)
- return;
-
- /* This jump might be paralleled with a clobber of the condition codes
- the jump should always come first */
- if (GET_CODE (body) == PARALLEL && XVECLEN (body, 0) > 0)
- body = XVECEXP (body, 0, 0);
-
-#if 0
- /* If this is a conditional return then we don't want to know */
- if (GET_CODE (body) == SET && GET_CODE (SET_DEST (body)) == PC
- && GET_CODE (SET_SRC (body)) == IF_THEN_ELSE
- && (GET_CODE (XEXP (SET_SRC (body), 1)) == RETURN
- || GET_CODE (XEXP (SET_SRC (body), 2)) == RETURN))
- return;
-#endif
-
- if (reverse
- || (GET_CODE (body) == SET && GET_CODE (SET_DEST (body)) == PC
- && GET_CODE (SET_SRC (body)) == IF_THEN_ELSE))
- {
- int insns_skipped;
- int fail = FALSE, succeed = FALSE;
- /* Flag which part of the IF_THEN_ELSE is the LABEL_REF. */
- int then_not_else = TRUE;
- rtx this_insn = start_insn, label = 0;
-
- if (get_attr_conds (insn) == CONDS_JUMP_CLOB)
- {
- /* The code below is wrong for these, and I haven't time to
- fix it now. So we just do the safe thing and return. This
- whole function needs re-writing anyway. */
- jump_clobbers = 1;
- return;
- }
-
- /* Register the insn jumped to. */
- if (reverse)
- {
- if (!seeking_return)
- label = XEXP (SET_SRC (body), 0);
- }
- else if (GET_CODE (XEXP (SET_SRC (body), 1)) == LABEL_REF)
- label = XEXP (XEXP (SET_SRC (body), 1), 0);
- else if (GET_CODE (XEXP (SET_SRC (body), 2)) == LABEL_REF)
- {
- label = XEXP (XEXP (SET_SRC (body), 2), 0);
- then_not_else = FALSE;
- }
- else if (GET_CODE (XEXP (SET_SRC (body), 1)) == RETURN)
- seeking_return = 1;
- else if (GET_CODE (XEXP (SET_SRC (body), 2)) == RETURN)
- {
- seeking_return = 1;
- then_not_else = FALSE;
- }
- else
- abort ();
-
- /* See how many insns this branch skips, and what kind of insns. If all
- insns are okay, and the label or unconditional branch to the same
- label is not too far away, succeed. */
- for (insns_skipped = 0;
- !fail && !succeed && insns_skipped++ < MAX_INSNS_SKIPPED;)
- {
- rtx scanbody;
-
- this_insn = next_nonnote_insn (this_insn);
- if (!this_insn)
- break;
-
- scanbody = PATTERN (this_insn);
-
- switch (GET_CODE (this_insn))
- {
- case CODE_LABEL:
- /* Succeed if it is the target label, otherwise fail since
- control falls in from somewhere else. */
- if (this_insn == label)
- {
- if (jump_clobbers)
- {
- arm_ccfsm_state = 2;
- this_insn = next_nonnote_insn (this_insn);
- }
- else
- arm_ccfsm_state = 1;
- succeed = TRUE;
- }
- else
- fail = TRUE;
- break;
-
- case BARRIER:
- /* Succeed if the following insn is the target label.
- Otherwise fail.
- If return insns are used then the last insn in a function
- will be a barrier. */
- this_insn = next_nonnote_insn (this_insn);
- if (this_insn && this_insn == label)
- {
- if (jump_clobbers)
- {
- arm_ccfsm_state = 2;
- this_insn = next_nonnote_insn (this_insn);
- }
- else
- arm_ccfsm_state = 1;
- succeed = TRUE;
- }
- else
- fail = TRUE;
- break;
-
- case CALL_INSN:
- /* If using 32-bit addresses the cc is not preserved over
- calls */
- if (TARGET_APCS_32)
- {
- /* Succeed if the following insn is the target label,
- or if the following two insns are a barrier and
- the target label. */
- this_insn = next_nonnote_insn (this_insn);
- if (this_insn && GET_CODE (this_insn) == BARRIER)
- this_insn = next_nonnote_insn (this_insn);
-
- if (this_insn && this_insn == label
- && insns_skipped < MAX_INSNS_SKIPPED)
- {
- if (jump_clobbers)
- {
- arm_ccfsm_state = 2;
- this_insn = next_nonnote_insn (this_insn);
- }
- else
- arm_ccfsm_state = 1;
- succeed = TRUE;
- }
- else
- fail = TRUE;
- }
- break;
-
- case JUMP_INSN:
- /* If this is an unconditional branch to the same label, succeed.
- If it is to another label, do nothing. If it is conditional,
- fail. */
- /* XXX Probably, the test for the SET and the PC are unnecessary. */
-
- if (GET_CODE (scanbody) == SET
- && GET_CODE (SET_DEST (scanbody)) == PC)
- {
- if (GET_CODE (SET_SRC (scanbody)) == LABEL_REF
- && XEXP (SET_SRC (scanbody), 0) == label && !reverse)
- {
- arm_ccfsm_state = 2;
- succeed = TRUE;
- }
- else if (GET_CODE (SET_SRC (scanbody)) == IF_THEN_ELSE)
- fail = TRUE;
- }
- else if (GET_CODE (scanbody) == RETURN
- && seeking_return)
- {
- arm_ccfsm_state = 2;
- succeed = TRUE;
- }
- else if (GET_CODE (scanbody) == PARALLEL)
- {
- switch (get_attr_conds (this_insn))
- {
- case CONDS_NOCOND:
- break;
- default:
- fail = TRUE;
- break;
- }
- }
- break;
-
- case INSN:
- /* Instructions using or affecting the condition codes make it
- fail. */
- if ((GET_CODE (scanbody) == SET
- || GET_CODE (scanbody) == PARALLEL)
- && get_attr_conds (this_insn) != CONDS_NOCOND)
- fail = TRUE;
- break;
-
- default:
- break;
- }
- }
- if (succeed)
- {
- if ((!seeking_return) && (arm_ccfsm_state == 1 || reverse))
- arm_target_label = CODE_LABEL_NUMBER (label);
- else if (seeking_return || arm_ccfsm_state == 2)
- {
- while (this_insn && GET_CODE (PATTERN (this_insn)) == USE)
- {
- this_insn = next_nonnote_insn (this_insn);
- if (this_insn && (GET_CODE (this_insn) == BARRIER
- || GET_CODE (this_insn) == CODE_LABEL))
- abort ();
- }
- if (!this_insn)
- {
- /* Oh, dear! we ran off the end.. give up */
- recog (PATTERN (insn), insn, NULL_PTR);
- arm_ccfsm_state = 0;
- arm_target_insn = NULL;
- return;
- }
- arm_target_insn = this_insn;
- }
- else
- abort ();
- if (jump_clobbers)
- {
- if (reverse)
- abort ();
- arm_current_cc =
- get_arm_condition_code (XEXP (XEXP (XEXP (SET_SRC (body),
- 0), 0), 1));
- if (GET_CODE (XEXP (XEXP (SET_SRC (body), 0), 0)) == AND)
- arm_current_cc = ARM_INVERSE_CONDITION_CODE (arm_current_cc);
- if (GET_CODE (XEXP (SET_SRC (body), 0)) == NE)
- arm_current_cc = ARM_INVERSE_CONDITION_CODE (arm_current_cc);
- }
- else
- {
- /* If REVERSE is true, ARM_CURRENT_CC needs to be inverted from
- what it was. */
- if (!reverse)
- arm_current_cc = get_arm_condition_code (XEXP (SET_SRC (body),
- 0));
- }
-
- if (reverse || then_not_else)
- arm_current_cc = ARM_INVERSE_CONDITION_CODE (arm_current_cc);
- }
- /* restore recog_operand (getting the attributes of other insns can
- destroy this array, but final.c assumes that it remains intact
- across this call; since the insn has been recognized already we
- call recog direct). */
- recog (PATTERN (insn), insn, NULL_PTR);
- }
-}
-
-#ifdef AOF_ASSEMBLER
-/* Special functions only needed when producing AOF syntax assembler. */
-
-int arm_text_section_count = 1;
-
-char *
-aof_text_section ()
-{
- static char buf[100];
- sprintf (buf, "\tAREA |C$$code%d|, CODE, READONLY",
- arm_text_section_count++);
- if (flag_pic)
- strcat (buf, ", PIC, REENTRANT");
- return buf;
-}
-
-static int arm_data_section_count = 1;
-
-char *
-aof_data_section ()
-{
- static char buf[100];
- sprintf (buf, "\tAREA |C$$data%d|, DATA", arm_data_section_count++);
- return buf;
-}
-
-/* The AOF assembler is religiously strict about declarations of
- imported and exported symbols, so that it is impossible to declare
- a function as imported near the begining of the file, and then to
- export it later on. It is, however, possible to delay the decision
- until all the functions in the file have been compiled. To get
- around this, we maintain a list of the imports and exports, and
- delete from it any that are subsequently defined. At the end of
- compilation we spit the remainder of the list out before the END
- directive. */
-
-struct import
-{
- struct import *next;
- char *name;
-};
-
-static struct import *imports_list = NULL;
-
-void
-aof_add_import (name)
- char *name;
-{
- struct import *new;
-
- for (new = imports_list; new; new = new->next)
- if (new->name == name)
- return;
-
- new = (struct import *) xmalloc (sizeof (struct import));
- new->next = imports_list;
- imports_list = new;
- new->name = name;
-}
-
-void
-aof_delete_import (name)
- char *name;
-{
- struct import **old;
-
- for (old = &imports_list; *old; old = & (*old)->next)
- {
- if ((*old)->name == name)
- {
- *old = (*old)->next;
- return;
- }
- }
-}
-
-int arm_main_function = 0;
-
-void
-aof_dump_imports (f)
- FILE *f;
-{
- /* The AOF assembler needs this to cause the startup code to be extracted
- from the library. Brining in __main causes the whole thing to work
- automagically. */
- if (arm_main_function)
- {
- text_section ();
- fputs ("\tIMPORT __main\n", f);
- fputs ("\tDCD __main\n", f);
- }
-
- /* Now dump the remaining imports. */
- while (imports_list)
- {
- fprintf (f, "\tIMPORT\t");
- assemble_name (f, imports_list->name);
- fputc ('\n', f);
- imports_list = imports_list->next;
- }
-}
-#endif /* AOF_ASSEMBLER */
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
deleted file mode 100644
index 520e61bdd77..00000000000
--- a/gcc/config/arm/arm.h
+++ /dev/null
@@ -1,1739 +0,0 @@
-/* Definitions of target machine for GNU compiler, for Acorn RISC Machine.
- Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
- and Martin Simmons (@harleqn.co.uk).
- More major hacks by Richard Earnshaw (rwe11@cl.cam.ac.uk)
-
-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. */
-
-/* Configuration triples for ARM ports work as follows:
- arm-*-*: little endian
- armel-*-*: little endian
- armeb-*-*: big endian
- If a non-embedded environment (ie: "real" OS) is specified, `arm'
- should default to that used by the OS.
-*/
-
-extern void output_func_prologue ();
-extern void output_func_epilogue ();
-extern char *output_add_immediate ();
-extern char *output_call ();
-extern char *output_call_mem ();
-extern char *output_move_double ();
-extern char *output_mov_double_fpu_from_arm ();
-extern char *output_mov_double_arm_from_fpu ();
-extern char *output_mov_long_double_fpu_from_arm ();
-extern char *output_mov_long_double_arm_from_fpu ();
-extern char *output_mov_long_double_arm_from_arm ();
-extern char *output_mov_immediate ();
-extern char *output_multi_immediate ();
-extern char *output_return_instruction ();
-extern char *output_load_symbol ();
-extern char *emit_ldm_seq ();
-extern char *emit_stm_seq ();
-extern char *fp_immediate_constant ();
-extern struct rtx_def *gen_compare_reg ();
-extern struct rtx_def *arm_gen_store_multiple ();
-extern struct rtx_def *arm_gen_load_multiple ();
-extern struct rtx_def *gen_rotated_half_load ();
-
-enum arm_cond_code
-{
- ARM_EQ = 0, ARM_NE, ARM_CS, ARM_CC, ARM_MI, ARM_PL, ARM_VS, ARM_VC,
- ARM_HI, ARM_LS, ARM_GE, ARM_LT, ARM_GT, ARM_LE, ARM_AL, ARM_NV
-};
-extern enum arm_cond_code arm_current_cc;
-extern char *arm_condition_codes[];
-
-#define ARM_INVERSE_CONDITION_CODE(X) ((enum arm_cond_code) (((int)X) ^ 1))
-
-/* This is needed by the tail-calling peepholes */
-extern int frame_pointer_needed;
-
-
-#ifndef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Darm -Acpu(arm) -Amachine(arm)"
-#endif
-
-#ifndef CPP_SPEC
-#define CPP_SPEC "%{m6:-D__arm6__} \
-%{mcpu-*:-D__%*} \
-%{mcpu=*:-D__%*} \
-%{mapcs-32:-D__APCS_32__ -U__APCS_26__} \
-%{mapcs-26:-D__APCS_26__ -U__APCS_32__} \
-%{!mapcs-32: %{!mapcs-26:-D__APCS_26__}} \
-%{msoft-float:-D__SOFTFP__} \
-%{mhard-float:-U__SOFTFP__} \
-%{!mhard-float: %{!msoft-float:-U__SOFTFP__}} \
-%{mbig-endian:-D__ARMEB__ %{mwords-little-endian:-D__ARMWEL__}} \
-%{mbe:-D__ARMEB__ %{mwords-little-endian:-D__ARMWEL__}} \
-%{!mbe: %{!mbig-endian:-D__ARMEL__}} \
-"
-#endif
-
-/* Run-time Target Specification. */
-#ifndef TARGET_VERSION
-#define TARGET_VERSION \
- fputs (" (ARM/generic)", stderr);
-#endif
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-extern int target_flags;
-
-/* These two are used by TARGET_OPTIONS, they are parsed in OVERRIDE_OPTIONS */
-extern char *target_fpe_name;
-
-/* Nonzero if the function prologue (and epilogue) should obey
- the ARM Procedure Call Standard. */
-#define ARM_FLAG_APCS_FRAME (0x0001)
-
-/* Nonzero if the function prologue should output the function name to enable
- the post mortem debugger to print a backtrace (very useful on RISCOS,
- unused on RISCiX). Specifying this flag also enables
- -fno-omit-frame-pointer.
- XXX Must still be implemented in the prologue. */
-#define ARM_FLAG_POKE (0x0002)
-
-/* Nonzero if floating point instructions are emulated by the FPE, in which
- case instruction scheduling becomes very uninteresting. */
-#define ARM_FLAG_FPE (0x0004)
-
-/* Nonzero if destined for an ARM6xx. Takes out bits that assume restoration
- of condition flags when returning from a branch & link (ie. a function) */
-/* ********* DEPRECATED ******** */
-#define ARM_FLAG_ARM6 (0x0008)
-
-/* ********* DEPRECATED ******** */
-#define ARM_FLAG_ARM3 (0x0010)
-
-/* Nonzero if destined for a processor in 32-bit program mode. Takes out bit
- that assume restoration of the condition flags when returning from a
- branch and link (ie a function). */
-#define ARM_FLAG_APCS_32 (0x0020)
-
-/* Nonzero if stack checking should be performed on entry to each function
- which allocates temporary variables on the stack. */
-#define ARM_FLAG_APCS_STACK (0x0040)
-
-/* Nonzero if floating point parameters should be passed to functions in
- floating point registers. */
-#define ARM_FLAG_APCS_FLOAT (0x0080)
-
-/* Nonzero if re-entrant, position independent code should be generated.
- This is equivalent to -fpic. */
-#define ARM_FLAG_APCS_REENT (0x0100)
-
-/* Nonzero if the MMU will trap unaligned word accesses, so shorts must be
- loaded byte-at-a-time. */
-#define ARM_FLAG_SHORT_BYTE (0x0200)
-
-/* Nonzero if all floating point instructions are missing (and there is no
- emulator either). Generate function calls for all ops in this case. */
-#define ARM_FLAG_SOFT_FLOAT (0x0400)
-
-/* Nonzero if we should compile with BYTES_BIG_ENDIAN set to 1. */
-#define ARM_FLAG_BIG_END (0x0800)
-
-/* Nonzero if we should compile for Thumb interworking. */
-#define ARM_FLAG_THUMB (0x1000)
-
-/* Nonzero if we should have little-endian words even when compiling for
- big-endian (for backwards compatibility with older versions of GCC). */
-#define ARM_FLAG_LITTLE_WORDS (0x2000)
-
-#define TARGET_APCS (target_flags & ARM_FLAG_APCS_FRAME)
-#define TARGET_POKE_FUNCTION_NAME (target_flags & ARM_FLAG_POKE)
-#define TARGET_FPE (target_flags & ARM_FLAG_FPE)
-#define TARGET_6 (target_flags & ARM_FLAG_ARM6)
-#define TARGET_3 (target_flags & ARM_FLAG_ARM3)
-#define TARGET_APCS_32 (target_flags & ARM_FLAG_APCS_32)
-#define TARGET_APCS_STACK (target_flags & ARM_FLAG_APCS_STACK)
-#define TARGET_APCS_FLOAT (target_flags & ARM_FLAG_APCS_FLOAT)
-#define TARGET_APCS_REENT (target_flags & ARM_FLAG_APCS_REENT)
-#define TARGET_SHORT_BY_BYTES (target_flags & ARM_FLAG_SHORT_BYTE)
-#define TARGET_SOFT_FLOAT (target_flags & ARM_FLAG_SOFT_FLOAT)
-#define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
-#define TARGET_BIG_END (target_flags & ARM_FLAG_BIG_END)
-#define TARGET_THUMB_INTERWORK (target_flags & ARM_FLAG_THUMB)
-#define TARGET_LITTLE_WORDS (target_flags & ARM_FLAG_LITTLE_WORDS)
-
-/* SUBTARGET_SWITCHES is used to add flags on a per-config basis.
- Bit 31 is reserved. See riscix.h. */
-#ifndef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES
-#endif
-
-#define TARGET_SWITCHES \
-{ \
- {"apcs", ARM_FLAG_APCS_FRAME}, \
- {"apcs-frame", ARM_FLAG_APCS_FRAME}, \
- {"no-apcs-frame", -ARM_FLAG_APCS_FRAME}, \
- {"poke-function-name", ARM_FLAG_POKE}, \
- {"fpe", ARM_FLAG_FPE}, \
- {"6", ARM_FLAG_ARM6}, \
- {"2", ARM_FLAG_ARM3}, \
- {"3", ARM_FLAG_ARM3}, \
- {"apcs-32", ARM_FLAG_APCS_32}, \
- {"apcs-26", -ARM_FLAG_APCS_32}, \
- {"apcs-stack-check", ARM_FLAG_APCS_STACK}, \
- {"no-apcs-stack-check", -ARM_FLAG_APCS_STACK}, \
- {"apcs-float", ARM_FLAG_APCS_FLOAT}, \
- {"no-apcs-float", -ARM_FLAG_APCS_FLOAT}, \
- {"apcs-reentrant", ARM_FLAG_APCS_REENT}, \
- {"no-apcs-rentrant", -ARM_FLAG_APCS_REENT}, \
- {"short-load-bytes", ARM_FLAG_SHORT_BYTE}, \
- {"no-short-load-bytes", -ARM_FLAG_SHORT_BYTE}, \
- {"short-load-words", -ARM_FLAG_SHORT_BYTE}, \
- {"no-short-load-words", ARM_FLAG_SHORT_BYTE}, \
- {"soft-float", ARM_FLAG_SOFT_FLOAT}, \
- {"hard-float", -ARM_FLAG_SOFT_FLOAT}, \
- {"big-endian", ARM_FLAG_BIG_END}, \
- {"little-endian", -ARM_FLAG_BIG_END}, \
- {"thumb-interwork", ARM_FLAG_THUMB}, \
- {"no-thumb-interwork", -ARM_FLAG_THUMB}, \
- {"words-little-endian", ARM_FLAG_LITTLE_WORDS}, \
- SUBTARGET_SWITCHES \
- {"", TARGET_DEFAULT } \
-}
-
-#define TARGET_OPTIONS \
-{ \
- {"cpu=", &arm_select[1].string}, \
- {"tune=", &arm_select[2].string}, \
- {"fpe=", &target_fpe_name} \
-}
-
-/* arm_select[0] is reserved for the default cpu. */
-struct arm_cpu_select
-{
- char *string;
- char *name;
- int set_tune_p;
- int set_arch_p;
-};
-
-extern struct arm_cpu_select arm_select[];
-
-#ifndef PROCESSOR_DEFAULT
-#define PROCESSOR_DEFAULT PROCESSOR_ARM2
-#endif
-
-#ifndef TARGET_CPU_DEFAULT
-#define TARGET_CPU_DEFAULT ((char *) 0)
-#endif
-
-/* Which processor we are running on. */
-enum processor_type
-{
- PROCESSOR_ARM2,
- PROCESSOR_ARM3,
- PROCESSOR_ARM6,
- PROCESSOR_ARM7
-};
-
-/* Recast the cpu class to be the cpu attribute. */
-
-/* Recast the cpu class to be the cpu attribute. */
-#define arm_cpu_attr ((enum attr_cpu)arm_cpu)
-
-extern enum processor_type arm_cpu;
-
-enum prog_mode_type
-{
- prog_mode26,
- prog_mode32
-};
-
-/* Recast the program mode class to be the prog_mode attribute */
-#define arm_prog_mode ((enum attr_prog_mode) arm_prgmode)
-
-extern enum prog_mode_type arm_prgmode;
-
-/* What sort of floating point unit do we have? Hardware or software.
- If software, is it issue 2 or issue 3? */
-enum floating_point_type
-{
- FP_HARD,
- FP_SOFT2,
- FP_SOFT3
-};
-
-/* Recast the floating point class to be the floating point attribute. */
-#define arm_fpu_attr ((enum attr_fpu) arm_fpu)
-
-extern enum floating_point_type arm_fpu;
-
-/* Nonzero if the processor has a fast multiply insn, and one that does
- a 64-bit multiply of two 32-bit values. */
-extern int arm_fast_multiply;
-
-/* Nonzero if this chip support the ARM Architecture 4 extensions */
-extern int arm_arch4;
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 0
-#endif
-
-/* A particular target can define this to a particular cpu name, eg "arm710dmi"
- and the code generated should then be appropriate for that processor. */
-#ifndef ARM_CPU_NAME
-#define ARM_CPU_NAME NULL
-#endif
-
-/* The frame pointer register used in gcc has nothing to do with debugging;
- that is controlled by the APCS-FRAME option. */
-/* Not fully implemented yet */
-/* #define CAN_DEBUG_WITHOUT_FP 1 */
-
-#define TARGET_MEM_FUNCTIONS 1
-
-#define OVERRIDE_OPTIONS arm_override_options ()
-
-/* Target machine storage Layout. */
-
-
-/* Define this macro if it is advisable to hold scalars in registers
- in a wider mode than that declared by the program. In such cases,
- the value is constrained to be within the bounds of the declared
- type, but kept valid in the wider mode. The signedness of the
- extension may differ from that of the type. */
-
-/* It is far faster to zero extend chars than to sign extend them */
-
-#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < 4) \
- { \
- if (MODE == QImode) \
- UNSIGNEDP = 1; \
- else if (MODE == HImode) \
- UNSIGNEDP = TARGET_SHORT_BY_BYTES != 0; \
- (MODE) = SImode; \
- }
-
-/* Define for XFmode extended real floating point support.
- This will automatically cause REAL_ARITHMETIC to be defined. */
-/* For the ARM:
- I think I have added all the code to make this work. Unfortunately,
- early releases of the floating point emulation code on RISCiX used a
- different format for extended precision numbers. On my RISCiX box there
- is a bug somewhere which causes the machine to lock up when running enquire
- with long doubles. There is the additional aspect that Norcroft C
- treats long doubles as doubles and we ought to remain compatible.
- Perhaps someone with an FPA coprocessor and not running RISCiX would like
- to try this someday. */
-/* #define LONG_DOUBLE_TYPE_SIZE 96 */
-
-/* Disable XFmode patterns in md file */
-#define ENABLE_XF_PATTERNS 0
-
-/* Define if you don't want extended real, but do want to use the
- software floating point emulator for REAL_ARITHMETIC and
- decimal <-> binary conversion. */
-/* See comment above */
-#define REAL_ARITHMETIC
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered.
- Most ARM processors are run in little endian mode, so that is the default.
- If you want to have it run-time selectable, change the definition in a
- cover file to be TARGET_BIG_ENDIAN. */
-#define BYTES_BIG_ENDIAN (TARGET_BIG_END != 0)
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered.
- This is always false, even when in big-endian mode. */
-#define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN && ! TARGET_LITTLE_WORDS)
-
-/* LIBGCC2_WORDS_BIG_ENDIAN has to be a constant, so we define this based
- on processor pre-defineds when compiling libgcc2.c. */
-#if defined(__ARMEB__) && !defined(__ARMWEL__)
-#define LIBGCC2_WORDS_BIG_ENDIAN 1
-#else
-#define LIBGCC2_WORDS_BIG_ENDIAN 0
-#endif
-
-/* Define this if most significant word of doubles is the lowest numbered.
- This is always true, even when in little-endian mode. */
-#define FLOAT_WORDS_BIG_ENDIAN 1
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-#define BITS_PER_WORD 32
-
-#define UNITS_PER_WORD 4
-
-#define POINTER_SIZE 32
-
-#define PARM_BOUNDARY 32
-
-#define STACK_BOUNDARY 32
-
-#define FUNCTION_BOUNDARY 32
-
-#define EMPTY_FIELD_BOUNDARY 32
-
-#define BIGGEST_ALIGNMENT 32
-
-/* Make strings word-aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- (TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Every structures size must be a multiple of 32 bits. */
-/* This is for compatibility with ARMCC. ARM SDT Reference Manual
- (ARM DUI 0020D) page 2-20 says "Structures are aligned on word
- boundaries". */
-#define STRUCTURE_SIZE_BOUNDARY 32
-
-/* Non-zero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
-
-/* Standard register usage. */
-
-/* Register allocation in ARM Procedure Call Standard (as used on RISCiX):
- (S - saved over call).
-
- r0 * argument word/integer result
- r1-r3 argument word
-
- r4-r8 S register variable
- r9 S (rfp) register variable (real frame pointer)
-
- r10 F S (sl) stack limit (not currently used)
- r11 F S (fp) argument pointer
- r12 (ip) temp workspace
- r13 F S (sp) lower end of current stack frame
- r14 (lr) link address/workspace
- r15 F (pc) program counter
-
- f0 floating point result
- f1-f3 floating point scratch
-
- f4-f7 S floating point variable
-
- cc This is NOT a real register, but is used internally
- to represent things that use or set the condition
- codes.
- sfp This isn't either. It is used during rtl generation
- since the offset between the frame pointer and the
- auto's isn't known until after register allocation.
- afp Nor this, we only need this because of non-local
- goto. Without it fp appears to be used and the
- elimination code won't get rid of sfp. It tracks
- fp exactly at all times.
-
- *: See CONDITIONAL_REGISTER_USAGE */
-
-/* The stack backtrace structure is as follows:
- fp points to here: | save code pointer | [fp]
- | return link value | [fp, #-4]
- | return sp value | [fp, #-8]
- | return fp value | [fp, #-12]
- [| saved r10 value |]
- [| saved r9 value |]
- [| saved r8 value |]
- [| saved r7 value |]
- [| saved r6 value |]
- [| saved r5 value |]
- [| saved r4 value |]
- [| saved r3 value |]
- [| saved r2 value |]
- [| saved r1 value |]
- [| saved r0 value |]
- [| saved f7 value |] three words
- [| saved f6 value |] three words
- [| saved f5 value |] three words
- [| saved f4 value |] three words
- r0-r3 are not normally saved in a C function. */
-
-/* The number of hard registers is 16 ARM + 8 FPU + 1 CC + 1 SFP. */
-#define FIRST_PSEUDO_REGISTER 27
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator. */
-#define FIXED_REGISTERS \
-{ \
- 0,0,0,0,0,0,0,0, \
- 0,0,1,1,0,1,0,1, \
- 0,0,0,0,0,0,0,0, \
- 1,1,1 \
-}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like.
- The CC is not preserved over function calls on the ARM 6, so it is
- easier to assume this for all. SFP is preserved, since FP is. */
-#define CALL_USED_REGISTERS \
-{ \
- 1,1,1,1,0,0,0,0, \
- 0,0,1,1,1,1,1,1, \
- 1,1,1,1,0,0,0,0, \
- 1,1,1 \
-}
-
-/* If doing stupid life analysis, avoid a bug causing a return value r0 to be
- trampled. This effectively reduces the number of available registers by 1.
- XXX It is a hack, I know.
- XXX Is this still needed? */
-#define CONDITIONAL_REGISTER_USAGE \
-{ \
- if (obey_regdecls) \
- fixed_regs[0] = 1; \
- if (TARGET_SOFT_FLOAT) \
- { \
- int regno; \
- for (regno = 16; regno < 24; ++regno) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- } \
-}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On the ARM regs are UNITS_PER_WORD bits wide; FPU regs can hold any FP
- mode. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (((REGNO) >= 16 && REGNO != FRAME_POINTER_REGNUM \
- && (REGNO) != ARG_POINTER_REGNUM) ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- This is TRUE for ARM regs since they can hold anything, and TRUE for FPU
- regs holding FP. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((GET_MODE_CLASS (MODE) == MODE_CC) ? (REGNO == CC_REGNUM) : \
- ((REGNO) < 16 || REGNO == FRAME_POINTER_REGNUM \
- || REGNO == ARG_POINTER_REGNUM \
- || GET_MODE_CLASS (MODE) == MODE_FLOAT))
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* Define this if the program counter is overloaded on a register. */
-#define PC_REGNUM 15
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 13
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 25
-
-/* Define this to be where the real frame pointer is if it is not possible to
- work out the offset between the frame pointer and the automatic variables
- until after register allocation has taken place. FRAME_POINTER_REGNUM
- should point to a special register that we will make sure is eliminated. */
-#define HARD_FRAME_POINTER_REGNUM 11
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms may be accessed
- via the stack pointer) in functions that seem suitable.
- If we have to have a frame pointer we might as well make use of it.
- APCS says that the frame pointer does not need to be pushed in leaf
- functions. */
-#define FRAME_POINTER_REQUIRED \
- (current_function_has_nonlocal_label || (TARGET_APCS && !leaf_function_p ()))
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 26
-
-/* The native (Norcroft) Pascal compiler for the ARM passes the static chain
- as an invisible last argument (possible since varargs don't exist in
- Pascal), so the following is not true. */
-#define STATIC_CHAIN_REGNUM 8
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 0
-
-/* Internal, so that we don't need to refer to a raw number */
-#define CC_REGNUM 24
-
-/* The order in which register should be allocated. It is good to use ip
- since no saving is required (though calls clobber it) and it never contains
- function parameters. It is quite good to use lr since other calls may
- clobber it anyway. Allocate r0 through r3 in reverse order since r3 is
- least likely to contain a function parameter; in addition results are
- returned in r0.
- */
-#define REG_ALLOC_ORDER \
-{ \
- 3, 2, 1, 0, 12, 14, 4, 5, \
- 6, 7, 8, 10, 9, 11, 13, 15, \
- 16, 17, 18, 19, 20, 21, 22, 23, \
- 24, 25 \
-}
-
-/* Register and constant classes. */
-
-/* Register classes: all ARM regs or all FPU regs---simple! */
-enum reg_class
-{
- NO_REGS,
- FPU_REGS,
- GENERAL_REGS,
- ALL_REGS,
- LIM_REG_CLASSES
-};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-#define REG_CLASS_NAMES \
-{ \
- "NO_REGS", \
- "FPU_REGS", \
- "GENERAL_REGS", \
- "ALL_REGS", \
-}
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-#define REG_CLASS_CONTENTS \
-{ \
- 0x0000000, /* NO_REGS */ \
- 0x0FF0000, /* FPU_REGS */ \
- 0x200FFFF, /* GENERAL_REGS */ \
- 0x2FFFFFF /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-#define REGNO_REG_CLASS(REGNO) \
- (((REGNO) < 16 || REGNO == FRAME_POINTER_REGNUM \
- || REGNO == ARG_POINTER_REGNUM) \
- ? GENERAL_REGS : (REGNO) == CC_REGNUM \
- ? NO_REGS : FPU_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description.
- We only need constraint `f' for FPU_REGS (`r' == GENERAL_REGS). */
-#define REG_CLASS_FROM_LETTER(C) \
- ((C)=='f' ? FPU_REGS : NO_REGS)
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
- I: immediate arithmetic operand (i.e. 8 bits shifted as required).
- J: valid indexing constants.
- K: ~value ok in rhs argument of data operand.
- L: -value ok in rhs argument of data operand.
- M: 0..32, or a power of 2 (for shifts, or mult done by shift). */
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? const_ok_for_arm (VALUE) : \
- (C) == 'J' ? ((VALUE) < 4096 && (VALUE) > -4096) : \
- (C) == 'K' ? (const_ok_for_arm (~(VALUE))) : \
- (C) == 'L' ? (const_ok_for_arm (-(VALUE))) : \
- (C) == 'M' ? (((VALUE >= 0 && VALUE <= 32)) \
- || (((VALUE) & ((VALUE) - 1)) == 0)) \
- : 0)
-
-/* For the ARM, `Q' means that this is a memory operand that is just
- an offset from a register.
- `S' means any symbol that has the SYMBOL_REF_FLAG set or a CONSTANT_POOL
- address. This means that the symbol is in the text segment and can be
- accessed without using a load. */
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' ? GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
- : (C) == 'R' ? (GET_CODE (OP) == MEM \
- && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
- && CONSTANT_POOL_ADDRESS_P (XEXP (OP, 0))) \
- : (C) == 'S' ? (optimize > 0 && CONSTANT_ADDRESS_P (OP)) : 0)
-
-/* Constant letter 'G' for the FPU immediate constants.
- 'H' means the same constant negated. */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(X,C) \
- ((C) == 'G' ? const_double_rtx_ok_for_fpu (X) \
- : (C) == 'H' ? neg_const_double_rtx_ok_for_fpu (X) : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-#define PREFERRED_RELOAD_CLASS(X, CLASS) (CLASS)
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
- NO_REGS is returned. */
-#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,X) \
- (((MODE) == HImode && ! arm_arch4 && true_regnum (X) == -1) \
- ? GENERAL_REGS : NO_REGS)
-
-/* If we need to load shorts byte-at-a-time, then we need a scratch. */
-#define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,X) \
- (((MODE) == HImode && TARGET_SHORT_BY_BYTES && true_regnum (X) == -1) \
- ? GENERAL_REGS : NO_REGS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS.
- ARM regs are UNITS_PER_WORD bits while FPU regs can hold any FP mode */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FPU_REGS ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Moves between FPU_REGS and GENERAL_REGS are two memory insns. */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- ((((CLASS1) == FPU_REGS && (CLASS2) != FPU_REGS) \
- || ((CLASS2) == FPU_REGS && (CLASS1) != FPU_REGS)) \
- ? 20 : 2)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD 1
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD 1
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by. */
-#define PUSH_ROUNDING(NPUSHED) (((NPUSHED) + 3) & ~3)
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 4
-
-/* Value is the number of byte of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the ARM, the caller does not pop any of its arguments that were passed
- on the stack. */
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- (GET_MODE_CLASS (TYPE_MODE (VALTYPE)) == MODE_FLOAT && TARGET_HARD_FLOAT \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
- : gen_rtx (REG, TYPE_MODE (VALTYPE), 0))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-#define LIBCALL_VALUE(MODE) \
- (GET_MODE_CLASS (MODE) == MODE_FLOAT && TARGET_HARD_FLOAT \
- ? gen_rtx (REG, MODE, 16) \
- : gen_rtx (REG, MODE, 0))
-
-/* 1 if N is a possible register number for a function value.
- On the ARM, only r0 and f0 can return results. */
-#define FUNCTION_VALUE_REGNO_P(REGNO) \
- ((REGNO) == 0 || ((REGNO) == 16) && TARGET_HARD_FLOAT)
-
-/* How large values are returned */
-/* A C expression which can inhibit the returning of certain function values
- in registers, based on the type of value. */
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE ((TYPE)) == BLKmode || \
- (AGGREGATE_TYPE_P ((TYPE)) && arm_return_in_memory ((TYPE))))
-
-/* Define DEFAULT_PCC_STRUCT_RETURN to 1 if all structure and union return
- values must be in memory. On the ARM, they need only do so if larger
- than a word, or if they contain elements offset from zero in the struct. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- On the ARM, normally the first 16 bytes are passed in registers r0-r3; all
- other arguments are passed on the stack. If (NAMED == 0) (which happens
- only in assign_parms, since SETUP_INCOMING_VARARGS is defined), say it is
- passed in the stack (function_prologue will indeed make it pass in the
- stack if necessary). */
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- ((NAMED) \
- ? ((CUM) >= 16 ? 0 : gen_rtx (REG, MODE, (CUM) / 4)) \
- : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
- ((CUM) < 16 && 16 < (CUM) + ((MODE) != BLKmode \
- ? GET_MODE_SIZE (MODE) \
- : int_size_in_bytes (TYPE)) \
- ? 4 - (CUM) / 4 : 0)
-
-/* A C type for declaring a variable that is used as the first argument of
- `FUNCTION_ARG' and other related values. For some target machines, the
- type `int' suffices and can hold the number of bytes of argument so far.
-
- On the ARM, this is the number of bytes of arguments scanned so far. */
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
- On the ARM, the offset starts at 0. */
-#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
- ((CUM) = (((FNTYPE) && aggregate_value_p (TREE_TYPE ((FNTYPE)))) ? 4 : 0))
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- (CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3) \
-
-/* 1 if N is a possible register number for function argument passing.
- On the ARM, r0-r3 are used to pass args. */
-#define FUNCTION_ARG_REGNO_P(REGNO) \
- ((REGNO) >= 0 && (REGNO) <= 3)
-
-/* Perform any actions needed for a function that is receiving a variable
- number of arguments. CUM is as above. MODE and TYPE are the mode and type
- of the current parameter. PRETEND_SIZE is a variable that should be set to
- the amount of stack that must be pushed by the prolog to pretend that our
- caller pushed it.
-
- Normally, this macro will push all remaining incoming registers on the
- stack and set PRETEND_SIZE to the length of the registers pushed.
-
- On the ARM, PRETEND_SIZE is set in order to have the prologue push the last
- named arg and all anonymous args onto the stack.
- XXX I know the prologue shouldn't be pushing registers, but it is faster
- that way. */
-#define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PRETEND_SIZE, NO_RTL) \
-{ \
- extern int current_function_anonymous_args; \
- current_function_anonymous_args = 1; \
- if ((CUM) < 16) \
- (PRETEND_SIZE) = 16 - (CUM); \
-}
-
-/* Generate assembly output for the start of a function. */
-#define FUNCTION_PROLOGUE(STREAM, SIZE) \
- output_func_prologue ((STREAM), (SIZE))
-
-/* Call the function profiler with a given profile label. The Acorn compiler
- puts this BEFORE the prolog but gcc pust it afterwards. The ``mov ip,lr''
- seems like a good idea to stick with cc convention. ``prof'' doesn't seem
- to mind about this! */
-#define FUNCTION_PROFILER(STREAM,LABELNO) \
-{ \
- fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, REGISTER_PREFIX); \
- fprintf(STREAM, "\tbl\tmcount\n"); \
- fprintf(STREAM, "\t.word\tLP%d\n", (LABELNO)); \
-}
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero.
-
- On the ARM, the function epilogue recovers the stack pointer from the
- frame. */
-#define EXIT_IGNORE_STACK 1
-
-/* Generate the assembly code for function exit. */
-#define FUNCTION_EPILOGUE(STREAM, SIZE) \
- output_func_epilogue ((STREAM), (SIZE))
-
-/* Determine if the epilogue should be output as RTL.
- You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
-#define USE_RETURN_INSN use_return_insn ()
-
-/* Definitions for register eliminations.
-
- This is an array of structures. Each structure initializes one pair
- of eliminable registers. The "from" register number is given first,
- followed by "to". Eliminations of the same "from" register are listed
- in order of preference.
-
- We have two registers that can be eliminated on the ARM. First, the
- arg pointer register can often be eliminated in favor of the stack
- pointer register. Secondly, the pseudo frame pointer register can always
- be eliminated; it is replaced with either the stack or the real frame
- pointer. */
-
-#define ELIMINABLE_REGS \
-{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- {ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
- {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- {FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
-
-/* Given FROM and TO register numbers, say whether this elimination is allowed.
- Frame pointer elimination is automatically handled.
-
- All eliminations are permissible. Note that ARG_POINTER_REGNUM and
- HARD_FRAME_POINTER_REGNUM are in fact the same thing. If we need a frame
- pointer, we must eliminate FRAME_POINTER_REGNUM into
- HARD_FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM. */
-#define CAN_ELIMINATE(FROM, TO) \
- (((TO) == STACK_POINTER_REGNUM && frame_pointer_needed) ? 0 : 1)
-
-/* Define the offset between two registers, one to be eliminated, and the other
- its replacement, at the start of a routine. */
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ \
- int volatile_func = arm_volatile_func (); \
- if ((FROM) == ARG_POINTER_REGNUM && (TO) == HARD_FRAME_POINTER_REGNUM)\
- (OFFSET) = 0; \
- else if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM)\
- (OFFSET) = (get_frame_size () + 3 & ~3); \
- else \
- { \
- int regno; \
- int offset = 12; \
- int saved_hard_reg = 0; \
- \
- if (! volatile_func) \
- { \
- for (regno = 0; regno <= 10; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- saved_hard_reg = 1, offset += 4; \
- for (regno = 16; regno <=23; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 12; \
- } \
- if ((FROM) == FRAME_POINTER_REGNUM) \
- (OFFSET) = -offset; \
- else \
- { \
- if (! frame_pointer_needed) \
- offset -= 16; \
- if (! volatile_func && (regs_ever_live[14] || saved_hard_reg)) \
- offset += 4; \
- (OFFSET) = (get_frame_size () + 3 & ~3) + offset; \
- } \
- } \
-}
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- On the ARM, (if r8 is the static chain regnum, and remembering that
- referencing pc adds an offset of 8) the trampoline looks like:
- ldr r8, [pc, #0]
- ldr pc, [pc]
- .word static chain value
- .word function's address
- ??? FIXME: When the trampoline returns, r8 will be clobbered. */
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf ((FILE), "\tldr\t%sr8, [%spc, #0]\n", \
- REGISTER_PREFIX, REGISTER_PREFIX); \
- fprintf ((FILE), "\tldr\t%spc, [%spc, #0]\n", \
- REGISTER_PREFIX, REGISTER_PREFIX); \
- fprintf ((FILE), "\t.word\t0\n"); \
- fprintf ((FILE), "\t.word\t0\n"); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-#define TRAMPOLINE_SIZE 16
-
-/* Alignment required for a trampoline in units. */
-#define TRAMPOLINE_ALIGN 4
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 8)), \
- (CXT)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 12)), \
- (FNADDR)); \
-}
-
-
-/* Addressing modes, and classification of registers for them. */
-
-#define HAVE_POST_INCREMENT 1
-#define HAVE_PRE_INCREMENT 1
-#define HAVE_POST_DECREMENT 1
-#define HAVE_PRE_DECREMENT 1
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c.
-
- On the ARM, don't allow the pc to be used. */
-#define REGNO_OK_FOR_BASE_P(REGNO) \
- ((REGNO) < 15 || (REGNO) == FRAME_POINTER_REGNUM \
- || (REGNO) == ARG_POINTER_REGNUM \
- || (unsigned) reg_renumber[(REGNO)] < 15 \
- || (unsigned) reg_renumber[(REGNO)] == FRAME_POINTER_REGNUM \
- || (unsigned) reg_renumber[(REGNO)] == ARG_POINTER_REGNUM)
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
- REGNO_OK_FOR_BASE_P(REGNO)
-
-/* Maximum number of registers that can appear in a valid memory address.
- Shifts in addresses can't be by a register. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-/* XXX We can address any constant, eventually... */
-
-#ifdef AOF_ASSEMBLER
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == SYMBOL_REF \
- && CONSTANT_POOL_ADDRESS_P (X))
-
-#else
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == SYMBOL_REF \
- && (CONSTANT_POOL_ADDRESS_P (X) \
- || (optimize > 0 && SYMBOL_REF_FLAG (X))))
-
-#endif /* AOF_ASSEMBLER */
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
-
- On the ARM, allow any integer (invalid ones are removed later by insn
- patterns), nice doubles and symbol_refs which refer to the function's
- constant pool XXX. */
-#define LEGITIMATE_CONSTANT_P(X) (! label_mentioned_p (X))
-
-/* Symbols in the text segment can be accessed without indirecting via the
- constant pool; it may take an extra binary operation, but this is still
- faster than indirecting via memory. Don't do this when not optimizing,
- since we won't be calculating al of the offsets necessary to do this
- simplification. */
-/* This doesn't work with AOF syntax, since the string table may be in
- a different AREA. */
-#ifndef AOF_ASSEMBLER
-#define ENCODE_SECTION_INFO(decl) \
-{ \
- if (optimize > 0 && TREE_CONSTANT (decl) \
- && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) \
- { \
- rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' \
- ? TREE_CST_RTL (decl) : DECL_RTL (decl)); \
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; \
- } \
-}
-#endif
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used. */
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- (REGNO (X) < 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER \
- || REGNO (X) == FRAME_POINTER_REGNUM || REGNO (X) == ARG_POINTER_REGNUM)
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) \
- REG_OK_FOR_BASE_P(X)
-
-#define REG_OK_FOR_PRE_POST_P(X) \
- (REGNO (X) < 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER \
- || REGNO (X) == FRAME_POINTER_REGNUM || REGNO (X) == ARG_POINTER_REGNUM)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-
-#define REG_OK_FOR_PRE_POST_P(X) \
- (REGNO (X) < 16 || (unsigned) reg_renumber[REGNO (X)] < 16 \
- || REGNO (X) == FRAME_POINTER_REGNUM || REGNO (X) == ARG_POINTER_REGNUM \
- || (unsigned) reg_renumber[REGNO (X)] == FRAME_POINTER_REGNUM \
- || (unsigned) reg_renumber[REGNO (X)] == ARG_POINTER_REGNUM)
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
-#define BASE_REGISTER_RTX_P(X) \
- (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
-
-#define INDEX_REGISTER_RTX_P(X) \
- (GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))
-
-/* A C statement (sans semicolon) to jump to LABEL for legitimate index RTXs
- used by the macro GO_IF_LEGITIMATE_ADDRESS. Floating point indices can
- only be small constants. */
-#define GO_IF_LEGITIMATE_INDEX(MODE, BASE_REGNO, INDEX, LABEL) \
-do \
-{ \
- HOST_WIDE_INT range; \
- enum rtx_code code = GET_CODE (INDEX); \
- \
- if (TARGET_HARD_FLOAT && GET_MODE_CLASS (MODE) == MODE_FLOAT) \
- { \
- if (code == CONST_INT && INTVAL (INDEX) < 1024 \
- && INTVAL (INDEX) > -1024 \
- && (INTVAL (INDEX) & 3) == 0) \
- goto LABEL; \
- } \
- else \
- { \
- if (INDEX_REGISTER_RTX_P (INDEX) && GET_MODE_SIZE (MODE) <= 4) \
- goto LABEL; \
- if (GET_MODE_SIZE (MODE) <= 4 && code == MULT \
- && (! arm_arch4 || (MODE) != HImode)) \
- { \
- rtx xiop0 = XEXP (INDEX, 0); \
- rtx xiop1 = XEXP (INDEX, 1); \
- if (INDEX_REGISTER_RTX_P (xiop0) \
- && power_of_two_operand (xiop1, SImode)) \
- goto LABEL; \
- if (INDEX_REGISTER_RTX_P (xiop1) \
- && power_of_two_operand (xiop0, SImode)) \
- goto LABEL; \
- } \
- if (GET_MODE_SIZE (MODE) <= 4 \
- && (code == LSHIFTRT || code == ASHIFTRT \
- || code == ASHIFT || code == ROTATERT) \
- && (! arm_arch4 || (MODE) != HImode)) \
- { \
- rtx op = XEXP (INDEX, 1); \
- if (INDEX_REGISTER_RTX_P (XEXP (INDEX, 0)) \
- && GET_CODE (op) == CONST_INT && INTVAL (op) > 0 \
- && INTVAL (op) <= 31) \
- goto LABEL; \
- } \
- range = (MODE) == HImode ? (arm_arch4 ? 256 : 4095) : 4096; \
- if (code == CONST_INT && INTVAL (INDEX) < range \
- && INTVAL (INDEX) > -range) \
- goto LABEL; \
- } \
-} while (0)
-
-/* Jump to LABEL if X is a valid address RTX. This must also take
- REG_OK_STRICT into account when deciding about valid registers, but it uses
- the above macros so we are in luck. Allow REG, REG+REG, REG+INDEX,
- INDEX+REG, REG-INDEX, and non floating SYMBOL_REF to the constant pool.
- Allow REG-only and AUTINC-REG if handling TImode or HImode. Other symbol
- refs must be forced though a static cell to ensure addressability. */
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
-{ \
- if (BASE_REGISTER_RTX_P (X)) \
- goto LABEL; \
- else if ((GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC) \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_PRE_POST_P (XEXP (X, 0))) \
- goto LABEL; \
- else if (GET_MODE_SIZE (MODE) >= 4 && reload_completed \
- && (GET_CODE (X) == LABEL_REF \
- || (GET_CODE (X) == CONST \
- && GET_CODE (XEXP ((X), 0)) == PLUS \
- && GET_CODE (XEXP (XEXP ((X), 0), 0)) == LABEL_REF \
- && GET_CODE (XEXP (XEXP ((X), 0), 1)) == CONST_INT)))\
- goto LABEL; \
- else if ((MODE) == TImode) \
- ; \
- else if ((MODE) == DImode || (TARGET_SOFT_FLOAT && (MODE) == DFmode)) \
- { \
- if (GET_CODE (X) == PLUS && BASE_REGISTER_RTX_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 1)) == CONST_INT) \
- { \
- HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \
- if (val == 4 || val == -4 || val == -8) \
- goto LABEL; \
- } \
- } \
- else if (GET_CODE (X) == PLUS) \
- { \
- rtx xop0 = XEXP(X,0); \
- rtx xop1 = XEXP(X,1); \
- \
- if (BASE_REGISTER_RTX_P (xop0)) \
- GO_IF_LEGITIMATE_INDEX (MODE, REGNO (xop0), xop1, LABEL); \
- else if (BASE_REGISTER_RTX_P (xop1)) \
- GO_IF_LEGITIMATE_INDEX (MODE, REGNO (xop1), xop0, LABEL); \
- } \
- else if (GET_CODE (X) == MINUS) \
- { \
- rtx xop0 = XEXP (X,0); \
- rtx xop1 = XEXP (X,1); \
- \
- if (BASE_REGISTER_RTX_P (xop0)) \
- GO_IF_LEGITIMATE_INDEX (MODE, -1, xop1, LABEL); \
- } \
- else if (GET_MODE_CLASS (MODE) != MODE_FLOAT \
- && GET_CODE (X) == SYMBOL_REF \
- && CONSTANT_POOL_ADDRESS_P (X)) \
- goto LABEL; \
- else if ((GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_DEC) \
- && (GET_MODE_SIZE (MODE) <= 4) \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_PRE_POST_P (XEXP (X, 0))) \
- goto LABEL; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- On the ARM, try to convert [REG, #BIGCONST]
- into ADD BASE, REG, #UPPERCONST and [BASE, #VALIDCONST],
- where VALIDCONST == 0 in case of TImode. */
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-{ \
- if (GET_CODE (X) == PLUS) \
- { \
- rtx xop0 = XEXP (X, 0); \
- rtx xop1 = XEXP (X, 1); \
- \
- if (CONSTANT_P (xop0) && ! symbol_mentioned_p (xop0)) \
- xop0 = force_reg (SImode, xop0); \
- if (CONSTANT_P (xop1) && ! symbol_mentioned_p (xop1)) \
- xop1 = force_reg (SImode, xop1); \
- if (BASE_REGISTER_RTX_P (xop0) && GET_CODE (xop1) == CONST_INT) \
- { \
- HOST_WIDE_INT n, low_n; \
- rtx base_reg, val; \
- n = INTVAL (xop1); \
- \
- if (MODE == DImode || (TARGET_SOFT_FLOAT && MODE == DFmode)) \
- { \
- low_n = n & 0x0f; \
- n &= ~0x0f; \
- if (low_n > 4) \
- { \
- n += 16; \
- low_n -= 16; \
- } \
- } \
- else \
- { \
- low_n = ((MODE) == TImode ? 0 \
- : n >= 0 ? (n & 0xfff) : -((-n) & 0xfff)); \
- n -= low_n; \
- } \
- base_reg = gen_reg_rtx (SImode); \
- val = force_operand (gen_rtx (PLUS, SImode, xop0, \
- GEN_INT (n)), NULL_RTX); \
- emit_move_insn (base_reg, val); \
- (X) = (low_n == 0 ? base_reg \
- : gen_rtx (PLUS, SImode, base_reg, GEN_INT (low_n))); \
- } \
- else if (xop0 != XEXP (X, 0) || xop1 != XEXP (x, 1)) \
- (X) = gen_rtx (PLUS, SImode, xop0, xop1); \
- } \
- else if (GET_CODE (X) == MINUS) \
- { \
- rtx xop0 = XEXP (X, 0); \
- rtx xop1 = XEXP (X, 1); \
- \
- if (CONSTANT_P (xop0)) \
- xop0 = force_reg (SImode, xop0); \
- if (CONSTANT_P (xop1) && ! symbol_mentioned_p (xop1)) \
- xop1 = force_reg (SImode, xop1); \
- if (xop0 != XEXP (X, 0) || xop1 != XEXP (X, 1)) \
- (X) = gen_rtx (MINUS, SImode, xop0, xop1); \
- } \
- if (memory_address_p (MODE, X)) \
- goto WIN; \
-}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for. */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
-{ \
- if (GET_CODE(ADDR) == PRE_DEC || GET_CODE(ADDR) == POST_DEC \
- || GET_CODE(ADDR) == PRE_INC || GET_CODE(ADDR) == POST_INC) \
- goto LABEL; \
-}
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* signed 'char' is most compatible, but RISC OS wants it unsigned.
- unsigned is probably best, but may break some code. */
-#ifndef DEFAULT_SIGNED_CHAR
-#define DEFAULT_SIGNED_CHAR 0
-#endif
-
-/* Don't cse the address of the function being compiled. */
-#define NO_RECURSIVE_FUNCTION_CSE 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) \
- ((arm_arch4 || (MODE) == QImode) ? ZERO_EXTEND \
- : ((BYTES_BIG_ENDIAN && (MODE) == HImode) ? SIGN_EXTEND : NIL))
-
-/* Define this if zero-extension is slow (more than one real instruction).
- On the ARM, it is more than one instruction only if not fetching from
- memory. */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Immediate shift counts are truncated by the output routines (or was it
- the assembler?). Shift counts in a register are truncated by ARM. Note
- that the native compiler puts too large (> 32) immediate shift counts
- into a register and shifts by the register, letting the ARM decide what
- to do instead of doing that itself. */
-/* This is all wrong. Defining SHIFT_COUNT_TRUNCATED tells combine that
- code like (X << (Y % 32)) for register X, Y is equivalent to (X << Y).
- On the arm, Y in a register is used modulo 256 for the shift. Only for
- rotates is modulo 32 used. */
-/* #define SHIFT_COUNT_TRUNCATED 1 */
-
-/* All integers have the same format so truncation is easy. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) 1
-
-/* Calling from registers is a massive pain. */
-#define NO_FUNCTION_CSE 1
-
-/* Chars and shorts should be passed as ints. */
-#define PROMOTE_PROTOTYPES 1
-
-/* The machine modes of pointers and functions */
-#define Pmode SImode
-#define FUNCTION_MODE Pmode
-
-/* The structure type of the machine dependent info field of insns
- No uses for this yet. */
-/* #define INSN_MACHINE_INFO struct machine_info */
-
-/* The relative costs of various types of constants. Note that cse.c defines
- REG = 1, SUBREG = 2, any node = (2 + sum of subnodes). */
-#define CONST_COSTS(RTX, CODE, OUTER_CODE) \
- case CONST_INT: \
- if (const_ok_for_arm (INTVAL (RTX))) \
- return (OUTER_CODE) == SET ? 2 : -1; \
- else if (OUTER_CODE == AND \
- && const_ok_for_arm (~INTVAL (RTX))) \
- return -1; \
- else if ((OUTER_CODE == COMPARE \
- || OUTER_CODE == PLUS || OUTER_CODE == MINUS) \
- && const_ok_for_arm (-INTVAL (RTX))) \
- return -1; \
- else \
- return 5; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 6; \
- case CONST_DOUBLE: \
- if (const_double_rtx_ok_for_fpu (RTX)) \
- return (OUTER_CODE) == SET ? 2 : -1; \
- else if (((OUTER_CODE) == COMPARE || (OUTER_CODE) == PLUS) \
- && neg_const_double_rtx_ok_for_fpu (RTX)) \
- return -1; \
- return(7);
-
-#define ARM_FRAME_RTX(X) \
- ((X) == frame_pointer_rtx || (X) == stack_pointer_rtx \
- || (X) == arg_pointer_rtx)
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- default: \
- return arm_rtx_costs (X, CODE, OUTER_CODE);
-
-/* Moves to and from memory are quite expensive */
-#define MEMORY_MOVE_COST(MODE) 10
-
-/* All address computations that can be done are free, but rtx cost returns
- the same for practically all of them. So we weight the different types
- of address here in the order (most pref first):
- PRE/POST_INC/DEC, SHIFT or NON-INT sum, INT sum, REG, MEM or LABEL. */
-#define ADDRESS_COST(X) \
- (10 - ((GET_CODE (X) == MEM || GET_CODE (X) == LABEL_REF \
- || GET_CODE (X) == SYMBOL_REF) \
- ? 0 \
- : ((GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC \
- || GET_CODE (X) == POST_INC || GET_CODE (X) == POST_DEC) \
- ? 10 \
- : (((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS) \
- ? 6 + (GET_CODE (XEXP (X, 1)) == CONST_INT ? 2 \
- : ((GET_RTX_CLASS (GET_CODE (XEXP (X, 0))) == '2' \
- || GET_RTX_CLASS (GET_CODE (XEXP (X, 0))) == 'c' \
- || GET_RTX_CLASS (GET_CODE (XEXP (X, 1))) == '2' \
- || GET_RTX_CLASS (GET_CODE (XEXP (X, 1))) == 'c') \
- ? 1 : 0)) \
- : 4)))))
-
-
-
-/* Try to generate sequences that don't involve branches, we can then use
- conditional instructions */
-#define BRANCH_COST 4
-
-/* Condition code information. */
-/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
- return the mode to be used for the comparison.
- CCFPEmode should be used with floating inequalities,
- CCFPmode should be used with floating equalities.
- CC_NOOVmode should be used with SImode integer equalities.
- CC_Zmode should be used if only the Z flag is set correctly
- CCmode should be used otherwise. */
-
-#define EXTRA_CC_MODES CC_NOOVmode, CC_Zmode, CC_SWPmode, \
- CCFPmode, CCFPEmode, CC_DNEmode, CC_DEQmode, CC_DLEmode, \
- CC_DLTmode, CC_DGEmode, CC_DGTmode, CC_DLEUmode, CC_DLTUmode, \
- CC_DGEUmode, CC_DGTUmode, CC_Cmode
-
-#define EXTRA_CC_NAMES "CC_NOOV", "CC_Z", "CC_SWP", "CCFP", "CCFPE", \
- "CC_DNE", "CC_DEQ", "CC_DLE", "CC_DLT", "CC_DGE", "CC_DGT", "CC_DLEU", \
- "CC_DLTU", "CC_DGEU", "CC_DGTU", "CC_C"
-
-enum machine_mode arm_select_cc_mode ();
-#define SELECT_CC_MODE(OP,X,Y) arm_select_cc_mode ((OP), (X), (Y))
-
-#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
-
-enum rtx_code arm_canonicalize_comparison ();
-#define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \
-do \
-{ \
- if (GET_CODE (OP1) == CONST_INT \
- && ! (const_ok_for_arm (INTVAL (OP1)) \
- || (const_ok_for_arm (- INTVAL (OP1))))) \
- { \
- rtx const_op = OP1; \
- CODE = arm_canonicalize_comparison ((CODE), &const_op); \
- } \
-} while (0)
-
-#define STORE_FLAG_VALUE 1
-
-/* Define the information needed to generate branch insns. This is
- stored from the compare operation. Note that we can't use "rtx" here
- since it hasn't been defined! */
-
-extern struct rtx_def *arm_compare_op0, *arm_compare_op1;
-extern int arm_compare_fp;
-
-/* Define the codes that are matched by predicates in arm.c */
-#define PREDICATE_CODES \
- {"s_register_operand", {SUBREG, REG}}, \
- {"arm_add_operand", {SUBREG, REG, CONST_INT}}, \
- {"fpu_add_operand", {SUBREG, REG, CONST_DOUBLE}}, \
- {"arm_rhs_operand", {SUBREG, REG, CONST_INT}}, \
- {"fpu_rhs_operand", {SUBREG, REG, CONST_DOUBLE}}, \
- {"arm_not_operand", {SUBREG, REG, CONST_INT}}, \
- {"offsettable_memory_operand", {MEM}}, \
- {"alignable_memory_operand", {MEM}}, \
- {"shiftable_operator", {PLUS, MINUS, AND, IOR, XOR}}, \
- {"minmax_operator", {SMIN, SMAX, UMIN, UMAX}}, \
- {"shift_operator", {ASHIFT, ASHIFTRT, LSHIFTRT, ROTATERT, MULT}}, \
- {"di_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE, MEM}}, \
- {"soft_df_operand", {SUBREG, REG, CONST_DOUBLE, MEM}}, \
- {"load_multiple_operation", {PARALLEL}}, \
- {"store_multiple_operation", {PARALLEL}}, \
- {"equality_operator", {EQ, NE}}, \
- {"arm_rhsm_operand", {SUBREG, REG, CONST_INT, MEM}}, \
- {"const_shift_operand", {CONST_INT}}, \
- {"index_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_int_operand", {SUBREG, REG, CONST_INT}}, \
- {"multi_register_push", {PARALLEL}}, \
- {"cc_register", {REG}}, \
- {"dominant_cc_register", {REG}},
-
-
-
-/* Gcc puts the pool in the wrong place for ARM, since we can only
- load addresses a limited distance around the pc. We do some
- special munging to move the constant pool values to the correct
- point in the code. */
-#define MACHINE_DEPENDENT_REORG(INSN) arm_reorg ((INSN))
-
-/* The pool is empty, since we have moved everything into the code. */
-#define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE,X,MODE,ALIGN,LABELNO,JUMPTO) \
- goto JUMPTO
-
-/* Output an internal label definition. */
-#define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \
- do \
- { \
- char *s = (char *) alloca (40 + strlen (PREFIX)); \
- extern int arm_target_label, arm_ccfsm_state; \
- extern rtx arm_target_insn; \
- \
- if (arm_ccfsm_state == 3 && arm_target_label == (NUM) \
- && !strcmp (PREFIX, "L")) \
- { \
- arm_ccfsm_state = 0; \
- arm_target_insn = NULL; \
- } \
- ASM_GENERATE_INTERNAL_LABEL (s, (PREFIX), (NUM)); \
- arm_asm_output_label (STREAM, s); \
- } while (0)
-
-/* Output a label definition. */
-#define ASM_OUTPUT_LABEL(STREAM,NAME) \
- arm_asm_output_label ((STREAM), (NAME))
-
-/* Output a push or a pop instruction (only used when profiling). */
-#define ASM_OUTPUT_REG_PUSH(STREAM,REGNO) \
- fprintf(STREAM,"\tstmfd\t%ssp!,{%s%s}\n", \
- REGISTER_PREFIX, REGISTER_PREFIX, reg_names[REGNO])
-
-#define ASM_OUTPUT_REG_POP(STREAM,REGNO) \
- fprintf(STREAM,"\tldmfd\t%ssp!,{%s%s}\n", \
- REGISTER_PREFIX, REGISTER_PREFIX, reg_names[REGNO])
-
-/* Target characters. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Only perform branch elimination (by making instructions conditional) if
- we're optimising. Otherwise it's of no use anyway. */
-#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
- if (optimize) \
- final_prescan_insn (INSN, OPVEC, NOPERANDS)
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '?' || (CODE) == '|' || (CODE) == '@')
-/* Output an operand of an instruction. */
-#define PRINT_OPERAND(STREAM, X, CODE) \
- arm_print_operand (STREAM, X, CODE)
-
-#define ARM_SIGN_EXTEND(x) ((HOST_WIDE_INT) \
- (HOST_BITS_PER_WIDE_INT <= 32 ? (x) \
- : (((x) & (unsigned HOST_WIDE_INT) 0xffffffff) | \
- (((x) & (unsigned HOST_WIDE_INT) 0x80000000) \
- ? ((~ (HOST_WIDE_INT) 0) \
- & ~ (unsigned HOST_WIDE_INT) 0xffffffff) \
- : 0))))
-
-/* Output the address of an operand. */
-#define PRINT_OPERAND_ADDRESS(STREAM,X) \
-{ \
- int is_minus = GET_CODE (X) == MINUS; \
- \
- if (GET_CODE (X) == REG) \
- fprintf (STREAM, "[%s%s, #0]", REGISTER_PREFIX, \
- reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == PLUS || is_minus) \
- { \
- rtx base = XEXP (X, 0); \
- rtx index = XEXP (X, 1); \
- char *base_reg_name; \
- HOST_WIDE_INT offset = 0; \
- if (GET_CODE (base) != REG) \
- { \
- /* Ensure that BASE is a register (one of them must be). */ \
- rtx temp = base; \
- base = index; \
- index = temp; \
- } \
- base_reg_name = reg_names[REGNO (base)]; \
- switch (GET_CODE (index)) \
- { \
- case CONST_INT: \
- offset = INTVAL (index); \
- if (is_minus) \
- offset = -offset; \
- fprintf (STREAM, "[%s%s, #%d]", REGISTER_PREFIX, \
- base_reg_name, offset); \
- break; \
- \
- case REG: \
- fprintf (STREAM, "[%s%s, %s%s%s]", REGISTER_PREFIX, \
- base_reg_name, is_minus ? "-" : "", \
- REGISTER_PREFIX, reg_names[REGNO (index)] ); \
- break; \
- \
- case MULT: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- case ASHIFT: \
- case ROTATERT: \
- { \
- fprintf (STREAM, "[%s%s, %s%s%s", REGISTER_PREFIX, \
- base_reg_name, is_minus ? "-" : "", REGISTER_PREFIX,\
- reg_names[REGNO (XEXP (index, 0))]); \
- arm_print_operand (STREAM, index, 'S'); \
- fputs ("]", STREAM); \
- break; \
- } \
- \
- default: \
- abort(); \
- } \
- } \
- else if (GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_INC \
- || GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_DEC) \
- { \
- extern int output_memory_reference_mode; \
- \
- if (GET_CODE (XEXP (X, 0)) != REG) \
- abort (); \
- \
- if (GET_CODE (X) == PRE_DEC || GET_CODE (X) == PRE_INC) \
- fprintf (STREAM, "[%s%s, #%s%d]!", REGISTER_PREFIX, \
- reg_names[REGNO (XEXP (X, 0))], \
- GET_CODE (X) == PRE_DEC ? "-" : "", \
- GET_MODE_SIZE (output_memory_reference_mode)); \
- else \
- fprintf (STREAM, "[%s%s], #%s%d", REGISTER_PREFIX, \
- reg_names[REGNO (XEXP (X, 0))], \
- GET_CODE (X) == POST_DEC ? "-" : "", \
- GET_MODE_SIZE (output_memory_reference_mode)); \
- } \
- else output_addr_const(STREAM, X); \
-}
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
- Used for C++ multiple inheritance. */
-#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
-do { \
- int mi_delta = (DELTA); \
- char *mi_op = mi_delta < 0 ? "sub" : "add"; \
- int shift = 0; \
- int this_regno = (aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) \
- ? 1 : 0); \
- if (mi_delta < 0) mi_delta = -mi_delta; \
- while (mi_delta != 0) \
- { \
- if (mi_delta & (3 << shift) == 0) \
- shift += 2; \
- else \
- { \
- fprintf (FILE, "\t%s\t%s%s, %s%s, #%d\n", \
- mi_op, REGISTER_PREFIX, reg_names[this_regno], \
- REGISTER_PREFIX, reg_names[this_regno], \
- mi_delta & (0xff << shift)); \
- arm_increase_location (4); \
- mi_delta &= ~(0xff << shift); \
- shift += 8; \
- } \
- } \
- fprintf (FILE, "\tldr\t%spc, [%spc, #-4]\n", REGISTER_PREFIX, \
- REGISTER_PREFIX); \
- arm_increase_location (4); \
- ASM_OUTPUT_INT (FILE, XEXP (DECL_RTL (FUNCTION), 0)); \
-} while (0)
-
-/* A C expression whose value is RTL representing the value of the return
- address for the frame COUNT steps up from the current frame. */
-
-#define RETURN_ADDR_RTX(COUNT, FRAME) \
- ((COUNT == 0) \
- ? gen_rtx (MEM, Pmode, plus_constant (FRAME, -4)) \
- : (rtx) 0)
-
-/* Used to mask out junk bits from the return address, such as
- processor state, interrupt status, condition codes and the like. */
-#define MASK_RETURN_ADDR \
- /* If we are generating code for an ARM2/ARM3 machine or for an ARM6 \
- in 26 bit mode, the condition codes must be masked out of the \
- return address. This does not apply to ARM6 and later processors \
- when running in 32 bit mode. */ \
- ((!TARGET_6) ? (GEN_INT (0x03fffffc)) : (GEN_INT (0xffffffff)))
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
deleted file mode 100644
index 444e9adcc17..00000000000
--- a/gcc/config/arm/arm.md
+++ /dev/null
@@ -1,6068 +0,0 @@
-;;- Machine description for Advanced RISC Machines' ARM for GNU compiler
-;; Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
-;; Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
-;; and Martin Simmons (@harleqn.co.uk).
-;; More major hacks by Richard Earnshaw (rwe11@cl.cam.ac.uk)
-
-;; 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.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; There are patterns in this file to support XFmode arithmetic.
-;; Unfortunately RISC iX doesn't work well with these so they are disabled.
-;; (See arm.h)
-
-;; UNSPEC Usage:
-;; 0 `sin' operation: operand 0 is the result, operand 1 the parameter,
-;; the mode is MODE_FLOAT
-;; 1 `cos' operation: operand 0 is the result, operand 1 the parameter,
-;; the mode is MODE_FLOAT
-;; 2 `push multiple' operation: operand 0 is the first register. Subsequent
-;; registers are in parallel (use...) expressions.
-;; 3 A symbol that has been treated properly for pic usage, that is, we
-;; will add the pic_register value to it before trying to dereference it.
-;; Note: sin and cos are no-longer used.
-
-;; Attributes
-
-; PROG_MODE attribute is used to determine whether condition codes are
-; clobbered by a call insn: they are if in prog32 mode. This is controlled
-; by the -mapcs-{32,26} flag, and possibly the -mcpu=... option.
-(define_attr "prog_mode" "prog26,prog32" (const (symbol_ref "arm_prog_mode")))
-
-; CPU attribute is used to determine whether condition codes are clobbered
-; by a call insn: on the arm6 they are if in 32-bit addressing mode; on the
-; arm2 and arm3 the condition codes are restored by the return.
-
-(define_attr "cpu" "arm2,arm3,arm6,arm7"
- (const (symbol_ref "arm_cpu_attr")))
-
-; Floating Point Unit. If we only have floating point emulation, then there
-; is no point in scheduling the floating point insns. (Well, for best
-; performance we should try and group them together).
-
-(define_attr "fpu" "fpa,fpe2,fpe3" (const (symbol_ref "arm_fpu_attr")))
-
-; LENGTH of an instruction (in bytes)
-(define_attr "length" "" (const_int 4))
-
-; An assembler sequence may clobber the condition codes without us knowing
-(define_asm_attributes
- [(set_attr "conds" "clob")
- (set_attr "length" "4")])
-
-; TYPE attribute is used to detect floating point instructions which, if
-; running on a co-processor can run in parallel with other, basic instructions
-; If write-buffer scheduling is enabled then it can also be used in the
-; scheduling of writes.
-
-; Classification of each insn
-; normal any data instruction that doesn't hit memory or fp regs
-; mult a multiply instruction
-; block blockage insn, this blocks all functional units
-; float a floating point arithmetic operation (subject to expansion)
-; fdivx XFmode floating point division
-; fdivd DFmode floating point division
-; fdivs SFmode floating point division
-; fmul Floating point multiply
-; ffmul Fast floating point multiply
-; farith Floating point arithmetic (4 cycle)
-; ffarith Fast floating point arithmetic (2 cycle)
-; float_em a floating point arithmetic operation that is normally emulated
-; even on a machine with an fpa.
-; f_load a floating point load from memory
-; f_store a floating point store to memory
-; f_mem_r a transfer of a floating point register to a real reg via mem
-; r_mem_f the reverse of f_mem_r
-; f_2_r fast transfer float to arm (no memory needed)
-; r_2_f fast transfer arm to float
-; call a subroutine call
-; load any load from memory
-; store1 store 1 word to memory from arm registers
-; store2 store 2 words
-; store3 store 3 words
-; store4 store 4 words
-;
-(define_attr "type"
- "normal,mult,block,float,fdivx,fdivd,fdivs,fmul,ffmul,farith,ffarith,float_em,f_load,f_store,f_mem_r,r_mem_f,f_2_r,r_2_f,call,load,store1,store2,store3,store4"
- (const_string "normal"))
-
-; condition codes: this one is used by final_prescan_insn to speed up
-; conditionalizing instructions. It saves having to scan the rtl to see if
-; it uses or alters the condition codes.
-
-; USE means that the condition codes are used by the insn in the process of
-; outputting code, this means (at present) that we can't use the insn in
-; inlined branches
-
-; SET means that the purpose of the insn is to set the condition codes in a
-; well defined manner.
-
-; CLOB means that the condition codes are altered in an undefined manner, if
-; they are altered at all
-
-; JUMP_CLOB is used when the conditions are not defined if a branch is taken,
-; but are if the branch wasn't taken; the effect is to limit the branch
-; elimination scanning.
-
-; NOCOND means that the condition codes are neither altered nor affect the
-; output of this insn
-
-(define_attr "conds" "use,set,clob,jump_clob,nocond"
- (if_then_else (eq_attr "type" "call")
- (if_then_else (eq_attr "prog_mode" "prog32")
- (const_string "clob") (const_string "nocond"))
- (const_string "nocond")))
-
-(define_attr "write_conflict" "no,yes"
- (if_then_else (eq_attr "type"
- "block,float_em,f_load,f_store,f_mem_r,r_mem_f,call,load")
- (const_string "yes")
- (const_string "no")))
-
-(define_attr "core_cycles" "single,multi"
- (if_then_else (eq_attr "type"
- "normal,float,fdivx,fdivd,fdivs,fmul,ffmul,farith,ffarith")
- (const_string "single")
- (const_string "multi")))
-
-; The write buffer on some of the arm6 processors is hard to model exactly.
-; There is room in the buffer for up to two addresses and up to eight words
-; of memory, but the two needn't be split evenly. When writing the two
-; addresses are fully pipelined. However, a read from memory that is not
-; currently in the cache will block until the writes have completed.
-; It is normally the case that FCLK and MCLK will be in the ratio 2:1, so
-; writes will take 2 FCLK cycles per word, if FCLK and MCLK are asynchronous
-; (they aren't allowed to be at present) then there is a startup cost of 1MCLK
-; cycle to add as well.
-
-;; (define_function_unit {name} {num-units} {n-users} {test}
-;; {ready-delay} {issue-delay} [{conflict-list}])
-(define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "fdivx")) 71 69)
-
-(define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "fdivd")) 59 57)
-
-(define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "fdivs")) 31 29)
-
-(define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "fmul")) 9 7)
-
-(define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "ffmul")) 6 4)
-
-(define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "farith")) 4 2)
-
-(define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "ffarith")) 2 2)
-
-(define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "r_2_f")) 5 3)
-
-(define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "f_2_r")) 1 2)
-
-;; The fpa10 doesn't really have a memory read unit, but it can start to
-;; speculatively execute the instruction in the pipeline, provided the data
-;; is already loaded, so pretend reads have a delay of 2 (and that the
-;; pipeline is infinite.
-
-(define_function_unit "fpa_mem" 1 0 (and (eq_attr "fpu" "fpa")
- (eq_attr "type" "f_load")) 3 1)
-
-(define_function_unit "write_buf" 1 2 (eq_attr "type" "store1") 5 3)
-(define_function_unit "write_buf" 1 2 (eq_attr "type" "store2") 7 4)
-(define_function_unit "write_buf" 1 2 (eq_attr "type" "store3") 9 5)
-(define_function_unit "write_buf" 1 2 (eq_attr "type" "store4") 11 6)
-(define_function_unit "write_buf" 1 2 (eq_attr "type" "r_mem_f") 5 3)
-
-;; The write_blockage unit models (partially), the fact that writes will stall
-;; until the write buffer empties.
-
-(define_function_unit "write_blockage" 1 0 (eq_attr "type" "store1") 5 5
- [(eq_attr "write_conflict" "yes")])
-(define_function_unit "write_blockage" 1 0 (eq_attr "type" "store2") 7 7
- [(eq_attr "write_conflict" "yes")])
-(define_function_unit "write_blockage" 1 0 (eq_attr "type" "store3") 9 9
- [(eq_attr "write_conflict" "yes")])
-(define_function_unit "write_blockage" 1 0 (eq_attr "type" "store4") 11 11
- [(eq_attr "write_conflict" "yes")])
-(define_function_unit "write_blockage" 1 0 (eq_attr "type" "r_mem_f") 5 5
- [(eq_attr "write_conflict" "yes")])
-(define_function_unit "write_blockage" 1 0
- (eq_attr "write_conflict" "yes") 1 1)
-
-(define_function_unit "core" 1 1 (eq_attr "core_cycles" "single") 1 1)
-
-(define_function_unit "core" 1 1 (eq_attr "type" "load") 2 2)
-
-(define_function_unit "core" 1 1 (eq_attr "type" "mult") 16 16)
-
-(define_function_unit "core" 1 1 (eq_attr "type" "store1") 2 2)
-
-(define_function_unit "core" 1 1 (eq_attr "type" "store2") 3 3)
-
-(define_function_unit "core" 1 1 (eq_attr "type" "store3") 4 4)
-
-(define_function_unit "core" 1 1 (eq_attr "type" "store4") 5 5)
-
-(define_function_unit "core" 1 1
- (and (eq_attr "core_cycles" "multi")
- (eq_attr "type" "!mult,load,store2,store3,store4")) 32 32)
-
-
-;; Note: For DImode insns, there is normally no reason why operands should
-;; not be in the same register, what we don't want is for something being
-;; written to partially overlap something that is an input.
-
-;; Addition insns.
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (plus:DI (match_operand:DI 1 "s_register_operand" "%0,0")
- (match_operand:DI 2 "s_register_operand" "r,0")))
- (clobber (reg:CC 24))]
- ""
- "adds\\t%Q0, %Q1, %Q2\;adc\\t%R0, %R1, %R2"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_insn "*adddi_sesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (plus:DI (sign_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "r,0")))
- (clobber (reg:CC 24))]
- ""
- "adds\\t%Q0, %Q1, %2\;adc\\t%R0, %R1, %2, asr #31"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_insn "*adddi_zesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (plus:DI (zero_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "r,0")))
- (clobber (reg:CC 24))]
- ""
- "adds\\t%Q0, %Q1, %2\;adc\\t%R0, %R1, #0"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_expand "addsi3"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (plus:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "reg_or_int_operand" "")))]
- ""
- "
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- arm_split_constant (PLUS, SImode, INTVAL (operands[2]), operands[0],
- operands[1],
- (reload_in_progress || reload_completed ? 0
- : preserve_subexpressions_p ()));
- DONE;
- }
-")
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (plus:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "const_int_operand" "")))]
- "! (const_ok_for_arm (INTVAL (operands[2]))
- || const_ok_for_arm (-INTVAL (operands[2])))"
- [(clobber (const_int 0))]
- "
- arm_split_constant (PLUS, SImode, INTVAL (operands[2]), operands[0],
- operands[1], 0);
- DONE;
-")
-
-(define_insn "*addsi3_insn"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (plus:SI (match_operand:SI 1 "s_register_operand" "r,r,r")
- (match_operand:SI 2 "reg_or_int_operand" "rI,L,?n")))]
- ""
- "@
- add%?\\t%0, %1, %2
- sub%?\\t%0, %1, #%n2
- #"
-[(set_attr "length" "4,4,16")])
-
-(define_insn "*addsi3_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV
- (plus:SI (match_operand:SI 1 "s_register_operand" "r,r")
- (match_operand:SI 2 "arm_add_operand" "rI,L"))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r,r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- add%?s\\t%0, %1, %2
- sub%?s\\t%0, %1, #%n2"
-[(set_attr "conds" "set")])
-
-(define_insn "*addsi3_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV
- (plus:SI (match_operand:SI 0 "s_register_operand" "r,r")
- (match_operand:SI 1 "arm_add_operand" "rI,L"))
- (const_int 0)))]
- ""
- "@
- cmn%?\\t%0, %1
- cmp%?\\t%0, #%n1"
-[(set_attr "conds" "set")])
-
-;; The next four insns work because they compare the result with one of
-;; the operands, and we know that the use of the condition code is
-;; either GEU or LTU, so we can use the carry flag from the addition
-;; instead of doing the compare a second time.
-(define_insn "*addsi3_compare_op1"
- [(set (reg:CC_C 24)
- (compare:CC_C
- (plus:SI (match_operand:SI 1 "s_register_operand" "r,r")
- (match_operand:SI 2 "arm_add_operand" "rI,L"))
- (match_dup 1)))
- (set (match_operand:SI 0 "s_register_operand" "=r,r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- add%?s\\t%0, %1, %2
- sub%?s\\t%0, %1, #%n2"
-[(set_attr "conds" "set")])
-
-(define_insn "*addsi3_compare_op2"
- [(set (reg:CC_C 24)
- (compare:CC_C
- (plus:SI (match_operand:SI 1 "s_register_operand" "r,r")
- (match_operand:SI 2 "arm_add_operand" "rI,L"))
- (match_dup 2)))
- (set (match_operand:SI 0 "s_register_operand" "=r,r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- add%?s\\t%0, %1, %2
- sub%?s\\t%0, %1, #%n2"
-[(set_attr "conds" "set")])
-
-(define_insn "*compare_addsi2_op0"
- [(set (reg:CC_C 24)
- (compare:CC_C
- (plus:SI (match_operand:SI 0 "s_register_operand" "r,r")
- (match_operand:SI 1 "arm_add_operand" "rI,L"))
- (match_dup 0)))]
- ""
- "@
- cmn%?\\t%0, %1
- cmp%?\\t%0, #%n1"
-[(set_attr "conds" "set")])
-
-(define_insn "*compare_addsi2_op1"
- [(set (reg:CC_C 24)
- (compare:CC_C
- (plus:SI (match_operand:SI 0 "s_register_operand" "r,r")
- (match_operand:SI 1 "arm_add_operand" "rI,L"))
- (match_dup 1)))]
- ""
- "@
- cmn%?\\t%0, %1
- cmp%?\\t%0, #%n1"
-[(set_attr "conds" "set")])
-
-(define_insn "*addsi3_carryin"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (ltu:SI (reg:CC_C 24) (const_int 0))
- (plus:SI (match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rI"))))]
- ""
- "adc%?\\t%0, %1, %2"
-[(set_attr "conds" "use")])
-
-(define_insn "*addsi3_carryin_alt1"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (plus:SI (match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rI"))
- (ltu:SI (reg:CC_C 24) (const_int 0))))]
- ""
- "adc%?\\t%0, %1, %2"
-[(set_attr "conds" "use")])
-
-(define_insn "*addsi3_carryin_alt2"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (plus:SI (ltu:SI (reg:CC_C 24) (const_int 0))
- (match_operand:SI 1 "s_register_operand" "r"))
- (match_operand:SI 2 "arm_rhs_operand" "rI")))]
- ""
- "adc%?\\t%0, %1, %2"
-[(set_attr "conds" "use")])
-
-(define_insn "*addsi3_carryin_alt3"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (plus:SI (ltu:SI (reg:CC_C 24) (const_int 0))
- (match_operand:SI 2 "arm_rhs_operand" "rI"))
- (match_operand:SI 1 "s_register_operand" "r")))]
- ""
- "adc%?\\t%0, %1, %2"
-[(set_attr "conds" "use")])
-
-(define_insn "incscc"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (plus:SI (match_operator:SI 2 "comparison_operator"
- [(match_operand 3 "cc_register" "") (const_int 0)])
- (match_operand:SI 1 "s_register_operand" "0,?r")))]
- ""
- "@
- add%d2\\t%0, %1, #1
- mov%D2\\t%0, %1\;add%d2\\t%0, %1, #1"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8")])
-
-; If a constant is too big to fit in a single instruction then the constant
-; will be pre-loaded into a register taking at least two insns, we might be
-; able to merge it with an add, but it depends on the exact value.
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "const_int_operand" "n")))]
- "!(const_ok_for_arm (INTVAL (operands[2]))
- || const_ok_for_arm (-INTVAL (operands[2])))"
- [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
- "
-{
- unsigned int val = (unsigned) INTVAL (operands[2]);
- int i;
- unsigned int temp;
-
- /* this code is similar to the approach followed in movsi, but it must
- generate exactly two insns */
-
- for (i = 30; i >= 0; i -= 2)
- {
- if (val & (3 << i))
- {
- i -= 6;
- if (i < 0) i = 0;
- if (const_ok_for_arm (temp = (val & ~(255 << i))))
- {
- val &= 255 << i;
- break;
- }
- /* we might be able to do this as (larger number - small number) */
- temp = ((val >> i) & 255) + 1;
- if (temp > 255 && i < 24)
- {
- i += 2;
- temp = ((val >> i) & 255) + 1;
- }
- if (const_ok_for_arm ((temp << i) - val))
- {
- i = temp << i;
- temp = (unsigned) - (int) (i - val);
- val = i;
- break;
- }
- FAIL;
- }
- }
- /* if we got here, we have found a way of doing it in two instructions.
- the two constants are in val and temp */
- operands[2] = GEN_INT ((int)val);
- operands[3] = GEN_INT ((int)temp);
-}
-")
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "s_register_operand" "=f,f")
- (plus:SF (match_operand:SF 1 "s_register_operand" "f,f")
- (match_operand:SF 2 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- adf%?s\\t%0, %1, %2
- suf%?s\\t%0, %1, #%N2"
-[(set_attr "type" "farith")])
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "s_register_operand" "=f,f")
- (plus:DF (match_operand:DF 1 "s_register_operand" "f,f")
- (match_operand:DF 2 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- adf%?d\\t%0, %1, %2
- suf%?d\\t%0, %1, #%N2"
-[(set_attr "type" "farith")])
-
-(define_insn "*adddf_df_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f,f")
- (plus:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f,f"))
- (match_operand:DF 2 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- adf%?d\\t%0, %1, %2
- suf%?d\\t%0, %1, #%N2"
-[(set_attr "type" "farith")])
-
-(define_insn "*adddf_df_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (plus:DF (match_operand:DF 1 "s_register_operand" "f")
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "adf%?d\\t%0, %1, %2"
-[(set_attr "type" "farith")])
-
-(define_insn "*adddf_esfdf_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (plus:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "adf%?d\\t%0, %1, %2"
-[(set_attr "type" "farith")])
-
-(define_insn "addxf3"
- [(set (match_operand:XF 0 "s_register_operand" "=f,f")
- (plus:XF (match_operand:XF 1 "s_register_operand" "f,f")
- (match_operand:XF 2 "fpu_add_operand" "fG,H")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "@
- adf%?e\\t%0, %1, %2
- suf%?e\\t%0, %1, #%N2"
-[(set_attr "type" "farith")])
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r,&r")
- (minus:DI (match_operand:DI 1 "s_register_operand" "0,r,0")
- (match_operand:DI 2 "s_register_operand" "r,0,0")))
- (clobber (reg:CC 24))]
- ""
- "subs\\t%Q0, %Q1, %Q2\;sbc\\t%R0, %R1, %R2"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_insn "*subdi_di_zesidi"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (minus:DI (match_operand:DI 1 "s_register_operand" "?r,0")
- (zero_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))))
- (clobber (reg:CC 24))]
- ""
- "subs\\t%Q0, %Q1, %2\;sbc\\t%R0, %R1, #0"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_insn "*subdi_di_sesidi"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (minus:DI (match_operand:DI 1 "s_register_operand" "r,0")
- (sign_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))))
- (clobber (reg:CC 24))]
- ""
- "subs\\t%Q0, %Q1, %2\;sbc\\t%R0, %R1, %2, asr #31"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_insn "*subdi_zesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (minus:DI (zero_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "?r,0")))
- (clobber (reg:CC 24))]
- ""
- "rsbs\\t%Q0, %Q1, %2\;rsc\\t%R0, %R1, #0"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_insn "*subdi_sesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (minus:DI (sign_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "?r,0")))
- (clobber (reg:CC 24))]
- ""
- "rsbs\\t%Q0, %Q1, %2\;rsc\\t%R0, %R1, %2, asr #31"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_insn "*subdi_zesidi_zesidi"
- [(set (match_operand:DI 0 "s_register_operand" "=r")
- (minus:DI (zero_extend:DI
- (match_operand:SI 1 "s_register_operand" "r"))
- (zero_extend:DI
- (match_operand:SI 2 "s_register_operand" "r"))))
- (clobber (reg:CC 24))]
- ""
- "subs\\t%Q0, %1, %2\;rsc\\t%R0, %1, %1"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (minus:SI (match_operand:SI 1 "reg_or_int_operand" "")
- (match_operand:SI 2 "s_register_operand" "")))]
- ""
- "
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- arm_split_constant (MINUS, SImode, INTVAL (operands[1]), operands[0],
- operands[2],
- (reload_in_progress || reload_completed ? 0
- : preserve_subexpressions_p ()));
- DONE;
- }
-")
-
-(define_insn "*subsi3_insn"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (minus:SI (match_operand:SI 1 "reg_or_int_operand" "rI,?n")
- (match_operand:SI 2 "s_register_operand" "r,r")))]
- ""
- "@
- rsb%?\\t%0, %2, %1
- #"
-[(set_attr "length" "4,16")])
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (minus:SI (match_operand:SI 1 "const_int_operand" "")
- (match_operand:SI 2 "s_register_operand" "")))]
- "! const_ok_for_arm (INTVAL (operands[1]))"
- [(clobber (const_int 0))]
- "
- arm_split_constant (MINUS, SImode, INTVAL (operands[1]), operands[0],
- operands[2], 0);
- DONE;
-")
-
-(define_insn "*subsi3_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (minus:SI (match_operand:SI 1 "arm_rhs_operand" "r,I")
- (match_operand:SI 2 "arm_rhs_operand" "rI,r"))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r,r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- sub%?s\\t%0, %1, %2
- rsb%?s\\t%0, %2, %1"
-[(set_attr "conds" "set")])
-
-(define_insn "decscc"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (minus:SI (match_operand:SI 1 "s_register_operand" "0,?r")
- (match_operator:SI 2 "comparison_operator"
- [(match_operand 3 "cc_register" "") (const_int 0)])))]
- ""
- "@
- sub%d2\\t%0, %1, #1
- mov%D2\\t%0, %1\;sub%d2\\t%0, %1, #1"
-[(set_attr "conds" "use")
- (set_attr "length" "*,8")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "s_register_operand" "=f,f")
- (minus:SF (match_operand:SF 1 "fpu_rhs_operand" "f,G")
- (match_operand:SF 2 "fpu_rhs_operand" "fG,f")))]
- "TARGET_HARD_FLOAT"
- "@
- suf%?s\\t%0, %1, %2
- rsf%?s\\t%0, %2, %1"
-[(set_attr "type" "farith")])
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "s_register_operand" "=f,f")
- (minus:DF (match_operand:DF 1 "fpu_rhs_operand" "f,G")
- (match_operand:DF 2 "fpu_rhs_operand" "fG,f")))]
- "TARGET_HARD_FLOAT"
- "@
- suf%?d\\t%0, %1, %2
- rsf%?d\\t%0, %2, %1"
-[(set_attr "type" "farith")])
-
-(define_insn "*subdf_esfdf_df"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (minus:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))
- (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
- "TARGET_HARD_FLOAT"
- "suf%?d\\t%0, %1, %2"
-[(set_attr "type" "farith")])
-
-(define_insn "*subdf_df_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f,f")
- (minus:DF (match_operand:DF 1 "fpu_rhs_operand" "f,G")
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f,f"))))]
- "TARGET_HARD_FLOAT"
- "@
- suf%?d\\t%0, %1, %2
- rsf%?d\\t%0, %2, %1"
-[(set_attr "type" "farith")])
-
-(define_insn "*subdf_esfdf_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (minus:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "suf%?d\\t%0, %1, %2"
-[(set_attr "type" "farith")])
-
-(define_insn "subxf3"
- [(set (match_operand:XF 0 "s_register_operand" "=f,f")
- (minus:XF (match_operand:XF 1 "fpu_rhs_operand" "f,G")
- (match_operand:XF 2 "fpu_rhs_operand" "fG,f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "@
- suf%?e\\t%0, %1, %2
- rsf%?e\\t%0, %2, %1"
-[(set_attr "type" "farith")])
-
-;; Multiplication insns
-
-;; Use `&' and then `0' to prevent the operands 0 and 1 being the same
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "s_register_operand" "=&r,&r")
- (mult:SI (match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 1 "s_register_operand" "%?r,0")))]
- ""
- "mul%?\\t%0, %2, %1"
-[(set_attr "type" "mult")])
-
-(define_insn "*mulsi3_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (mult:SI
- (match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 1 "s_register_operand" "%?r,0"))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=&r,&r")
- (mult:SI (match_dup 2) (match_dup 1)))]
- ""
- "mul%?s\\t%0, %2, %1"
-[(set_attr "conds" "set")
- (set_attr "type" "mult")])
-
-(define_insn "*mulsi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (mult:SI
- (match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 1 "s_register_operand" "%?r,0"))
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=&r,&r"))]
- ""
- "mul%?s\\t%0, %2, %1"
-[(set_attr "conds" "set")
- (set_attr "type" "mult")])
-
-;; Unnamed templates to match MLA instruction.
-
-(define_insn "*mulsi3addsi"
- [(set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r,&r")
- (plus:SI
- (mult:SI (match_operand:SI 2 "s_register_operand" "r,r,r,r")
- (match_operand:SI 1 "s_register_operand" "%r,0,r,0"))
- (match_operand:SI 3 "s_register_operand" "?r,r,0,0")))]
- ""
- "mla%?\\t%0, %2, %1, %3"
-[(set_attr "type" "mult")])
-
-(define_insn "*mulsi3addsi_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (plus:SI
- (mult:SI
- (match_operand:SI 2 "s_register_operand" "r,r,r,r")
- (match_operand:SI 1 "s_register_operand" "%r,0,r,0"))
- (match_operand:SI 3 "s_register_operand" "?r,r,0,0"))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r,&r")
- (plus:SI (mult:SI (match_dup 2) (match_dup 1))
- (match_dup 3)))]
- ""
- "mla%?s\\t%0, %2, %1, %3"
-[(set_attr "conds" "set")
- (set_attr "type" "mult")])
-
-(define_insn "*mulsi3addsi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (plus:SI
- (mult:SI
- (match_operand:SI 2 "s_register_operand" "r,r,r,r")
- (match_operand:SI 1 "s_register_operand" "%r,0,r,0"))
- (match_operand:SI 3 "s_register_operand" "?r,r,0,0"))
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=&r,&r,&r,&r"))]
- ""
- "mla%?s\\t%0, %2, %1, %3"
-[(set_attr "conds" "set")
- (set_attr "type" "mult")])
-
-(define_insn "mulsidi3"
- [(set (match_operand:DI 0 "s_register_operand" "=&r")
- (mult:DI (sign_extend:DI
- (match_operand:SI 1 "s_register_operand" "%r"))
- (sign_extend:DI
- (match_operand:SI 2 "s_register_operand" "r"))))]
- "arm_fast_multiply"
- "smull%?\\t%Q0, %R0, %1, %2"
-[(set_attr "type" "mult")])
-
-(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "s_register_operand" "=&r")
- (mult:DI (zero_extend:DI
- (match_operand:SI 1 "s_register_operand" "%r"))
- (zero_extend:DI
- (match_operand:SI 2 "s_register_operand" "r"))))]
- "arm_fast_multiply"
- "umull%?\\t%Q0, %R0, %1, %2"
-[(set_attr "type" "mult")])
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "s_register_operand" "=f")
- (mult:SF (match_operand:SF 1 "s_register_operand" "f")
- (match_operand:SF 2 "fpu_rhs_operand" "fG")))]
- "TARGET_HARD_FLOAT"
- "fml%?s\\t%0, %1, %2"
-[(set_attr "type" "ffmul")])
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (mult:DF (match_operand:DF 1 "s_register_operand" "f")
- (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
- "TARGET_HARD_FLOAT"
- "muf%?d\\t%0, %1, %2"
-[(set_attr "type" "fmul")])
-
-(define_insn "*muldf_esfdf_df"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (mult:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))
- (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
- "TARGET_HARD_FLOAT"
- "muf%?d\\t%0, %1, %2"
-[(set_attr "type" "fmul")])
-
-(define_insn "*muldf_df_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (mult:DF (match_operand:DF 1 "s_register_operand" "f")
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "muf%?d\\t%0, %1, %2"
-[(set_attr "type" "fmul")])
-
-(define_insn "*muldf_esfdf_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (mult:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "muf%?d\\t%0, %1, %2"
-[(set_attr "type" "fmul")])
-
-(define_insn "mulxf3"
- [(set (match_operand:XF 0 "s_register_operand" "=f")
- (mult:XF (match_operand:XF 1 "s_register_operand" "f")
- (match_operand:XF 2 "fpu_rhs_operand" "fG")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "muf%?e\\t%0, %1, %2"
-[(set_attr "type" "fmul")])
-
-;; Division insns
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "s_register_operand" "=f,f")
- (div:SF (match_operand:SF 1 "fpu_rhs_operand" "f,G")
- (match_operand:SF 2 "fpu_rhs_operand" "fG,f")))]
- "TARGET_HARD_FLOAT"
- "@
- fdv%?s\\t%0, %1, %2
- frd%?s\\t%0, %2, %1"
-[(set_attr "type" "fdivs")])
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "s_register_operand" "=f,f")
- (div:DF (match_operand:DF 1 "fpu_rhs_operand" "f,G")
- (match_operand:DF 2 "fpu_rhs_operand" "fG,f")))]
- "TARGET_HARD_FLOAT"
- "@
- dvf%?d\\t%0, %1, %2
- rdf%?d\\t%0, %2, %1"
-[(set_attr "type" "fdivd")])
-
-(define_insn "*divdf_esfdf_df"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (div:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))
- (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
- "TARGET_HARD_FLOAT"
- "dvf%?d\\t%0, %1, %2"
-[(set_attr "type" "fdivd")])
-
-(define_insn "*divdf_df_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (div:DF (match_operand:DF 1 "fpu_rhs_operand" "fG")
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "rdf%?d\\t%0, %2, %1"
-[(set_attr "type" "fdivd")])
-
-(define_insn "*divdf_esfdf_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (div:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "dvf%?d\\t%0, %1, %2"
-[(set_attr "type" "fdivd")])
-
-(define_insn "divxf3"
- [(set (match_operand:XF 0 "s_register_operand" "=f,f")
- (div:XF (match_operand:XF 1 "fpu_rhs_operand" "f,G")
- (match_operand:XF 2 "fpu_rhs_operand" "fG,f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "@
- dvf%?e\\t%0, %1, %2
- rdf%?e\\t%0, %2, %1"
-[(set_attr "type" "fdivx")])
-
-;; Modulo insns
-
-(define_insn "modsf3"
- [(set (match_operand:SF 0 "s_register_operand" "=f")
- (mod:SF (match_operand:SF 1 "s_register_operand" "f")
- (match_operand:SF 2 "fpu_rhs_operand" "fG")))]
- "TARGET_HARD_FLOAT"
- "rmf%?s\\t%0, %1, %2"
-[(set_attr "type" "fdivs")])
-
-(define_insn "moddf3"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (mod:DF (match_operand:DF 1 "s_register_operand" "f")
- (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
- "TARGET_HARD_FLOAT"
- "rmf%?d\\t%0, %1, %2"
-[(set_attr "type" "fdivd")])
-
-(define_insn "*moddf_esfdf_df"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (mod:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))
- (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
- "TARGET_HARD_FLOAT"
- "rmf%?d\\t%0, %1, %2"
-[(set_attr "type" "fdivd")])
-
-(define_insn "*moddf_df_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (mod:DF (match_operand:DF 1 "s_register_operand" "f")
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "rmf%?d\\t%0, %1, %2"
-[(set_attr "type" "fdivd")])
-
-(define_insn "*moddf_esfdf_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (mod:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))
- (float_extend:DF
- (match_operand:SF 2 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "rmf%?d\\t%0, %1, %2"
-[(set_attr "type" "fdivd")])
-
-(define_insn "modxf3"
- [(set (match_operand:XF 0 "s_register_operand" "=f")
- (mod:XF (match_operand:XF 1 "s_register_operand" "f")
- (match_operand:XF 2 "fpu_rhs_operand" "fG")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "rmf%?e\\t%0, %1, %2"
-[(set_attr "type" "fdivx")])
-
-;; Boolean and,ior,xor insns
-
-(define_insn "anddi3"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (and:DI (match_operand:DI 1 "s_register_operand" "%0,0")
- (match_operand:DI 2 "s_register_operand" "r,0")))]
- ""
- "and%?\\t%Q0, %Q1, %Q2\;and%?\\t%R0, %R1, %R2"
-[(set_attr "length" "8")])
-
-(define_insn "*anddi_zesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (and:DI (zero_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "?r,0")))]
- ""
- "and%?\\t%Q0, %Q1, %2\;mov%?\\t%R0, #0"
-[(set_attr "length" "8")])
-
-(define_insn "*anddi_sesdi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (and:DI (sign_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "?r,0")))]
- ""
- "and%?\\t%Q0, %Q1, %2\;and%?\\t%R0, %R1, %2, asr #31"
-[(set_attr "length" "8")])
-
-(define_expand "andsi3"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (and:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "reg_or_int_operand" "")))]
- ""
- "
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- arm_split_constant (AND, SImode, INTVAL (operands[2]), operands[0],
- operands[1],
- (reload_in_progress || reload_completed
- ? 0 : preserve_subexpressions_p ()));
- DONE;
- }
-")
-
-(define_insn "*andsi3_insn"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (and:SI (match_operand:SI 1 "s_register_operand" "r,r,r")
- (match_operand:SI 2 "reg_or_int_operand" "rI,K,?n")))]
- ""
- "@
- and%?\\t%0, %1, %2
- bic%?\\t%0, %1, #%B2
- #"
-[(set_attr "length" "4,4,16")])
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (and:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "const_int_operand" "")))]
- "! (const_ok_for_arm (INTVAL (operands[2]))
- || const_ok_for_arm (~ INTVAL (operands[2])))"
- [(clobber (const_int 0))]
- "
- arm_split_constant (AND, SImode, INTVAL (operands[2]), operands[0],
- operands[1], 0);
- DONE;
-")
-
-(define_insn "*andsi3_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV
- (and:SI (match_operand:SI 1 "s_register_operand" "r,r")
- (match_operand:SI 2 "arm_not_operand" "rI,K"))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r,r")
- (and:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- and%?s\\t%0, %1, %2
- bic%?s\\t%0, %1, #%B2"
-[(set_attr "conds" "set")])
-
-(define_insn "*andsi3_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV
- (and:SI (match_operand:SI 0 "s_register_operand" "r,r")
- (match_operand:SI 1 "arm_not_operand" "rI,K"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=X,r"))]
- ""
- "@
- tst%?\\t%0, %1
- bic%?s\\t%3, %0, #%B1"
-[(set_attr "conds" "set")])
-
-(define_insn "*zeroextractsi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (zero_extract:SI
- (match_operand:SI 0 "s_register_operand" "r")
- (match_operand 1 "const_int_operand" "n")
- (match_operand 2 "const_int_operand" "n"))
- (const_int 0)))]
- "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 32
- && INTVAL (operands[1]) > 0
- && INTVAL (operands[1]) + (INTVAL (operands[2]) & 1) <= 8
- && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32"
- "*
-{
- unsigned int mask = 0;
- int cnt = INTVAL (operands[1]);
-
- while (cnt--)
- mask = (mask << 1) | 1;
- operands[1] = GEN_INT (mask << INTVAL (operands[2]));
- output_asm_insn (\"tst%?\\t%0, %1\", operands);
- return \"\";
-}
-"
-[(set_attr "conds" "set")])
-
-(define_insn "*zeroextractqi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (zero_extract:SI
- (match_operand:QI 0 "memory_operand" "m")
- (match_operand 1 "const_int_operand" "n")
- (match_operand 2 "const_int_operand" "n"))
- (const_int 0)))
- (clobber (match_scratch:QI 3 "=r"))]
- "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 8
- && INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8"
- "*
-{
- unsigned int mask = 0;
- int cnt = INTVAL (operands[1]);
-
- while (cnt--)
- mask = (mask << 1) | 1;
- operands[1] = GEN_INT (mask << INTVAL (operands[2]));
- output_asm_insn (\"ldr%?b\\t%3, %0\", operands);
- output_asm_insn (\"tst%?\\t%3, %1\", operands);
- return \"\";
-}
-"
-[(set_attr "conds" "set")
- (set_attr "length" "8")])
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "s_register_operand" "")
- (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" ""))
- (match_operand:SI 3 "nonmemory_operand" ""))]
- ""
- "
-{
- HOST_WIDE_INT mask = (((HOST_WIDE_INT)1) << INTVAL (operands[1])) - 1;
-
- if (GET_CODE (operands[3]) == CONST_INT)
- {
- /* Since we are inserting a known constant, we may be able to
- reduce the number of bits that we have to clear so that
- the mask becomes simple. */
- rtx op1 = gen_reg_rtx (SImode);
- HOST_WIDE_INT mask2 = ((mask & ~INTVAL (operands[3]))
- << INTVAL (operands[2]));
-
- emit_insn (gen_andsi3 (op1, operands[0], GEN_INT (~mask2)));
- emit_insn (gen_iorsi3 (operands[0], op1,
- GEN_INT (INTVAL (operands[3])
- << INTVAL (operands[2]))));
- }
- else if (INTVAL (operands[2]) == 0
- && ! (const_ok_for_arm (mask)
- || const_ok_for_arm (~mask)))
- {
- /* A Trick, since we are setting the bottom bits in the word,
- we can shift operand[3] up, operand[0] down, OR them together
- and rotate the result back again. This takes 3 insns, and
- the third might be mergable into another op. */
-
- rtx op0 = gen_reg_rtx (SImode);
- rtx op1 = gen_reg_rtx (SImode);
-
- emit_insn (gen_ashlsi3 (op0, operands[3],
- GEN_INT (32 - INTVAL (operands[1]))));
- emit_insn (gen_iorsi3 (op1, gen_rtx (LSHIFTRT, SImode, operands[0],
- operands[1]),
- op0));
- emit_insn (gen_rotlsi3 (operands[0], op1, operands[1]));
- }
- else if ((INTVAL (operands[1]) + INTVAL (operands[2]) == 32)
- && ! (const_ok_for_arm (mask)
- || const_ok_for_arm (~mask)))
- {
- /* Similar trick, but slightly less efficient. */
-
- rtx op0 = gen_reg_rtx (SImode);
- rtx op1 = gen_reg_rtx (SImode);
-
- emit_insn (gen_ashlsi3 (op0, operands[3],
- GEN_INT (32 - INTVAL (operands[1]))));
- emit_insn (gen_ashlsi3 (op1, operands[0], operands[1]));
- emit_insn (gen_iorsi3 (operands[0], gen_rtx (LSHIFTRT, SImode, op1,
- operands[1]), op0));
- }
- else
- {
- rtx op0 = GEN_INT (mask);
- rtx op1 = gen_reg_rtx (SImode);
- rtx op2 = gen_reg_rtx (SImode);
-
- if (! (const_ok_for_arm (mask) || const_ok_for_arm (~mask)))
- {
- rtx tmp = gen_reg_rtx (SImode);
-
- emit_insn (gen_movsi (tmp, op0));
- op0 = tmp;
- }
-
- emit_insn (gen_andsi3 (op1, operands[3], op0));
-
- if (GET_CODE (op0) == CONST_INT
- && (const_ok_for_arm (mask << INTVAL (operands[2]))
- || const_ok_for_arm (~ (mask << INTVAL (operands[2])))))
- {
- op0 = GEN_INT (~(mask << INTVAL (operands[2])));
- emit_insn (gen_andsi3 (op2, operands[0], op0));
- }
- else
- {
- if (GET_CODE (op0) == CONST_INT)
- {
- rtx tmp = gen_reg_rtx (SImode);
-
- emit_insn (gen_movsi (tmp, op0));
- op0 = tmp;
- }
-
- if (INTVAL (operands[2]) != 0)
- op0 = gen_rtx (ASHIFT, SImode, op0, operands[2]);
- emit_insn (gen_andsi_notsi_si (op2, operands[0], op0));
- }
-
- if (INTVAL (operands[2]) != 0)
- op1 = gen_rtx (ASHIFT, SImode, op1, operands[2]);
-
- emit_insn (gen_iorsi3 (operands[0], op1, op2));
- }
-
- DONE;
-}
-")
-
-;; constants for op 2 will never be given to these patterns.
-(define_insn "*anddi_notdi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (and:DI (not:DI (match_operand:DI 2 "s_register_operand" "r,0"))
- (match_operand:DI 1 "s_register_operand" "0,r")))]
- ""
- "bic%?\\t%Q0, %Q1, %Q2\;bic%?\\t%R0, %R1, %R2"
-[(set_attr "length" "8")])
-
-(define_insn "*anddi_notzesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (and:DI (not:DI (zero_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r")))
- (match_operand:DI 1 "s_register_operand" "0,?r")))]
- ""
- "@
- bic%?\\t%Q0, %Q1, %2
- bic%?\\t%Q0, %Q1, %2\;mov%?\\t%R0, %R1"
-[(set_attr "length" "4,8")])
-
-(define_insn "*anddi_notsesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (and:DI (not:DI (sign_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r")))
- (match_operand:DI 1 "s_register_operand" "?r,0")))]
- ""
- "bic%?\\t%Q0, %Q1, %2\;bic%?\\t%R0, %R1, %2, asr #31"
-[(set_attr "length" "8")])
-
-(define_insn "andsi_notsi_si"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r"))
- (match_operand:SI 1 "s_register_operand" "r")))]
- ""
- "bic%?\\t%0, %1, %2")
-
-(define_insn "andsi_not_shiftsi_si"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (and:SI (not:SI (match_operator:SI 4 "shift_operator"
- [(match_operand:SI 2 "s_register_operand" "r")
- (match_operand:SI 3 "arm_rhs_operand" "rM")]))
- (match_operand:SI 1 "s_register_operand" "r")))]
- ""
- "bic%?\\t%0, %1, %2%S4")
-
-(define_insn "*andsi_notsi_si_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV
- (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r"))
- (match_operand:SI 1 "s_register_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (and:SI (not:SI (match_dup 2)) (match_dup 1)))]
- ""
- "bic%?s\\t%0, %1, %2"
-[(set_attr "conds" "set")])
-
-(define_insn "*andsi_notsi_si_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV
- (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r"))
- (match_operand:SI 1 "s_register_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=r"))]
- ""
- "bic%?s\\t%0, %1, %2"
-[(set_attr "conds" "set")])
-
-(define_insn "iordi3"
- [(set (match_operand:DI 0 "s_register_operand" "=&r")
- (ior:DI (match_operand:DI 1 "s_register_operand" "%0")
- (match_operand:DI 2 "s_register_operand" "r")))]
- ""
- "orr%?\\t%Q0, %Q1, %Q2\;orr%?\\t%R0, %R1, %R2"
-[(set_attr "length" "8")])
-
-(define_insn "*iordi_zesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (ior:DI (zero_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "0,?r")))]
- ""
- "@
- orr%?\\t%Q0, %Q1, %2
- orr%?\\t%Q0, %Q1, %2\;mov%?\\t%R0, %R1"
-[(set_attr "length" "4,8")])
-
-(define_insn "*iordi_sesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (ior:DI (sign_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "?r,0")))]
- ""
- "orr%?\\t%Q0, %Q1, %2\;orr%?\\t%R0, %R1, %2, asr #31"
-[(set_attr "length" "8")])
-
-(define_expand "iorsi3"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (ior:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "reg_or_int_operand" "")))]
- ""
- "
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- arm_split_constant (IOR, SImode, INTVAL (operands[2]), operands[0],
- operands[1],
- (reload_in_progress || reload_completed
- ? 0 : preserve_subexpressions_p ()));
- DONE;
- }
-")
-
-(define_insn "*iorsi3_insn"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (ior:SI (match_operand:SI 1 "s_register_operand" "r,r")
- (match_operand:SI 2 "reg_or_int_operand" "rI,?n")))]
- ""
- "@
- orr%?\\t%0, %1, %2
- #"
-[(set_attr "length" "4,16")])
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (ior:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "const_int_operand" "")))]
- "! const_ok_for_arm (INTVAL (operands[2]))"
- [(clobber (const_int 0))]
- "
- arm_split_constant (IOR, SImode, INTVAL (operands[2]), operands[0],
- operands[1], 0);
- DONE;
-")
-
-(define_insn "*iorsi3_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (ior:SI (match_operand:SI 1 "s_register_operand" "%r")
- (match_operand:SI 2 "arm_rhs_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (ior:SI (match_dup 1) (match_dup 2)))]
- ""
- "orr%?s\\t%0, %1, %2"
-[(set_attr "conds" "set")])
-
-(define_insn "*iorsi3_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (ior:SI (match_operand:SI 1 "s_register_operand" "%r")
- (match_operand:SI 2 "arm_rhs_operand" "rI"))
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=r"))]
- ""
- "orr%?s\\t%0, %1, %2"
-[(set_attr "conds" "set")])
-
-(define_insn "xordi3"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (xor:DI (match_operand:DI 1 "s_register_operand" "%0,0")
- (match_operand:DI 2 "s_register_operand" "r,0")))]
- ""
- "eor%?\\t%Q0, %Q1, %Q2\;eor%?\\t%R0, %R1, %R2"
-[(set_attr "length" "8")])
-
-(define_insn "*xordi_zesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (xor:DI (zero_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "0,?r")))]
- ""
- "@
- eor%?\\t%Q0, %Q1, %2
- eor%?\\t%Q0, %Q1, %2\;mov%?\\t%R0, %R1"
-[(set_attr "length" "4,8")])
-
-(define_insn "*xordi_sesidi_di"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (xor:DI (sign_extend:DI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:DI 1 "s_register_operand" "?r,0")))]
- ""
- "eor%?\\t%Q0, %Q1, %2\;eor%?\\t%R0, %R1, %2, asr #31"
-[(set_attr "length" "8")])
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (xor:SI (match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rI")))]
- ""
- "eor%?\\t%0, %1, %2")
-
-(define_insn "*xorsi3_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (xor:SI (match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (xor:SI (match_dup 1) (match_dup 2)))]
- ""
- "eor%?s\\t%0, %1, %2"
-[(set_attr "conds" "set")])
-
-(define_insn "*xorsi3_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (xor:SI (match_operand:SI 0 "s_register_operand" "r")
- (match_operand:SI 1 "arm_rhs_operand" "rI"))
- (const_int 0)))]
- ""
- "teq%?\\t%0, %1"
-[(set_attr "conds" "set")])
-
-;; by splitting (IOR (AND (NOT A) (NOT B)) C) as D = AND (IOR A B) (NOT C),
-;; (NOT D) we can sometimes merge the final NOT into one of the following
-;; insns
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (ior:SI (and:SI (not:SI (match_operand:SI 1 "s_register_operand" "r"))
- (not:SI (match_operand:SI 2 "arm_rhs_operand" "rI")))
- (match_operand:SI 3 "arm_rhs_operand" "rI")))
- (clobber (match_operand:SI 4 "s_register_operand" "=r"))]
- ""
- [(set (match_dup 4) (and:SI (ior:SI (match_dup 1) (match_dup 2))
- (not:SI (match_dup 3))))
- (set (match_dup 0) (not:SI (match_dup 4)))]
- ""
-)
-
-(define_insn "*andsi_iorsi3_notsi"
- [(set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r")
- (and:SI (ior:SI (match_operand:SI 1 "s_register_operand" "r,r,0")
- (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI"))
- (not:SI (match_operand:SI 3 "arm_rhs_operand" "rI,rI,rI"))))]
- ""
- "orr%?\\t%0, %1, %2\;bic%?\\t%0, %0, %3"
-[(set_attr "length" "8")])
-
-
-
-;; Minimum and maximum insns
-
-(define_insn "smaxsi3"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (smax:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
- (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
- (clobber (reg:CC 24))]
- ""
- "@
- cmp\\t%1, %2\;movlt\\t%0, %2
- cmp\\t%1, %2\;movge\\t%0, %1
- cmp\\t%1, %2\;movge\\t%0, %1\;movlt\\t%0, %2"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,8,12")])
-
-(define_insn "sminsi3"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (smin:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
- (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
- (clobber (reg:CC 24))]
- ""
- "@
- cmp\\t%1, %2\;movge\\t%0, %2
- cmp\\t%1, %2\;movlt\\t%0, %1
- cmp\\t%1, %2\;movlt\\t%0, %1\;movge\\t%0, %2"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,8,12")])
-
-(define_insn "umaxsi3"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (umax:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
- (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
- (clobber (reg:CC 24))]
- ""
- "@
- cmp\\t%1, %2\;movcc\\t%0, %2
- cmp\\t%1, %2\;movcs\\t%0, %1
- cmp\\t%1, %2\;movcs\\t%0, %1\;movcc\\t%0, %2"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,8,12")])
-
-(define_insn "uminsi3"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (umin:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
- (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
- (clobber (reg:CC 24))]
- ""
- "@
- cmp\\t%1, %2\;movcs\\t%0, %2
- cmp\\t%1, %2\;movcc\\t%0, %1
- cmp\\t%1, %2\;movcc\\t%0, %1\;movcs\\t%0, %2"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,8,12")])
-
-(define_insn "*store_minmaxsi"
- [(set (match_operand:SI 0 "memory_operand" "=m")
- (match_operator:SI 3 "minmax_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "s_register_operand" "r")]))
- (clobber (reg:CC 24))]
- ""
- "*
- operands[3] = gen_rtx (minmax_code (operands[3]), SImode, operands[1],
- operands[2]);
- output_asm_insn (\"cmp\\t%1, %2\", operands);
- output_asm_insn (\"str%d3\\t%1, %0\", operands);
- output_asm_insn (\"str%D3\\t%2, %0\", operands);
- return \"\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")
- (set_attr "type" "store1")])
-
-; Reject the frame pointer in operand[1], since reloading this after
-; it has been eliminated can cause carnage.
-(define_insn "*minmax_arithsi"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (match_operator:SI 4 "shiftable_operator"
- [(match_operator:SI 5 "minmax_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])
- (match_operand:SI 1 "s_register_operand" "0,?r")]))
- (clobber (reg:CC 24))]
- "GET_CODE (operands[1]) != REG
- || (REGNO(operands[1]) != FRAME_POINTER_REGNUM
- && REGNO(operands[1]) != ARG_POINTER_REGNUM)"
- "*
-{
- enum rtx_code code = GET_CODE (operands[4]);
-
- operands[5] = gen_rtx (minmax_code (operands[5]), SImode, operands[2],
- operands[3]);
- output_asm_insn (\"cmp\\t%2, %3\", operands);
- output_asm_insn (\"%i4%d5\\t%0, %1, %2\", operands);
- if (which_alternative != 0 || operands[3] != const0_rtx
- || (code != PLUS && code != MINUS && code != IOR && code != XOR))
- output_asm_insn (\"%i4%D5\\t%0, %1, %3\", operands);
- return \"\";
-}
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-
-;; Shift and rotation insns
-
-(define_expand "ashlsi3"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (ashift:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "arm_rhs_operand" "")))]
- ""
- "
- if (GET_CODE (operands[2]) == CONST_INT
- && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
- {
- emit_insn (gen_movsi (operands[0], const0_rtx));
- DONE;
- }
-")
-
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (ashiftrt:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "arm_rhs_operand" "")))]
- ""
- "
- if (GET_CODE (operands[2]) == CONST_INT
- && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
- operands[2] = GEN_INT (31);
-")
-
-(define_expand "lshrsi3"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (lshiftrt:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "arm_rhs_operand" "")))]
- ""
- "
- if (GET_CODE (operands[2]) == CONST_INT
- && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
- {
- emit_insn (gen_movsi (operands[0], const0_rtx));
- DONE;
- }
-")
-
-(define_expand "rotlsi3"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (rotatert:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "reg_or_int_operand" "")))]
- ""
- "
- if (GET_CODE (operands[2]) == CONST_INT)
- operands[2] = GEN_INT ((32 - INTVAL (operands[2])) % 32);
- else
- {
- rtx reg = gen_reg_rtx (SImode);
- emit_insn (gen_subsi3 (reg, GEN_INT (32), operands[2]));
- operands[2] = reg;
- }
-")
-
-(define_expand "rotrsi3"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (rotatert:SI (match_operand:SI 1 "s_register_operand" "")
- (match_operand:SI 2 "arm_rhs_operand" "")))]
- ""
- "
- if (GET_CODE (operands[2]) == CONST_INT
- && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
- operands[2] = GEN_INT (INTVAL (operands[2]) % 32);
-")
-
-(define_insn "*shiftsi3"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "reg_or_int_operand" "rM")]))]
- ""
- "mov%?\\t%0, %1%S3")
-
-(define_insn "*shiftsi3_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rM")])
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (match_op_dup 3 [(match_dup 1) (match_dup 2)]))]
- ""
- "mov%?s\\t%0, %1%S3"
-[(set_attr "conds" "set")])
-
-(define_insn "*shiftsi3_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rM")])
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=r"))]
- ""
- "mov%?s\\t%0, %1%S3"
-[(set_attr "conds" "set")])
-
-(define_insn "*notsi_shiftsi"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (not:SI (match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rM")])))]
- ""
- "mvn%?\\t%0, %1%S3")
-
-(define_insn "*notsi_shiftsi_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (not:SI (match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rM")]))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (not:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)])))]
- ""
- "mvn%?s\\t%0, %1%S3"
-[(set_attr "conds" "set")])
-
-(define_insn "*not_shiftsi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (not:SI (match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rM")]))
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=r"))]
- ""
- "mvn%?s\\t%0, %1%S3"
-[(set_attr "conds" "set")])
-
-
-;; Unary arithmetic insns
-
-(define_insn "negdi2"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (neg:DI (match_operand:DI 1 "s_register_operand" "?r,0")))]
- ""
- "rsbs\\t%Q0, %Q1, #0\;rsc\\t%R0, %R1, #0"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (neg:SI (match_operand:SI 1 "s_register_operand" "r")))]
- ""
- "rsb%?\\t%0, %1, #0")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "s_register_operand" "=f")
- (neg:SF (match_operand:SF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "mnf%?s\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (neg:DF (match_operand:DF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "mnf%?d\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "*negdf_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (neg:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "mnf%?d\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "negxf2"
- [(set (match_operand:XF 0 "s_register_operand" "=f")
- (neg:XF (match_operand:XF 1 "s_register_operand" "f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "mnf%?e\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-;; abssi2 doesn't really clobber the condition codes if a different register
-;; is being set. To keep things simple, assume during rtl manipulations that
-;; it does, but tell the final scan operator the truth. Similarly for
-;; (neg (abs...))
-
-(define_insn "abssi2"
- [(set (match_operand:SI 0 "s_register_operand" "=r,&r")
- (abs:SI (match_operand:SI 1 "s_register_operand" "0,r")))
- (clobber (reg 24))]
- ""
- "@
- cmp\\t%0, #0\;rsblt\\t%0, %0, #0
- eor%?\\t%0, %1, %1, asr #31\;sub%?\\t%0, %0, %1, asr #31"
-[(set_attr "conds" "clob,*")
- (set_attr "length" "8")])
-
-(define_insn "*neg_abssi2"
- [(set (match_operand:SI 0 "s_register_operand" "=r,&r")
- (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "0,r"))))
- (clobber (reg 24))]
- ""
- "@
- cmp\\t%0, #0\;rsbgt\\t%0, %0, #0
- eor%?\\t%0, %1, %1, asr #31\;rsb%?\\t%0, %0, %1, asr #31"
-[(set_attr "conds" "clob,*")
- (set_attr "length" "8")])
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "s_register_operand" "=f")
- (abs:SF (match_operand:SF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "abs%?s\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (abs:DF (match_operand:DF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "abs%?d\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "*absdf_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (abs:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "abs%?d\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "absxf2"
- [(set (match_operand:XF 0 "s_register_operand" "=f")
- (abs:XF (match_operand:XF 1 "s_register_operand" "f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "abs%?e\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "s_register_operand" "=f")
- (sqrt:SF (match_operand:SF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "sqt%?s\\t%0, %1"
-[(set_attr "type" "float_em")])
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (sqrt:DF (match_operand:DF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "sqt%?d\\t%0, %1"
-[(set_attr "type" "float_em")])
-
-(define_insn "*sqrtdf_esfdf"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (sqrt:DF (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "sqt%?d\\t%0, %1"
-[(set_attr "type" "float_em")])
-
-(define_insn "sqrtxf2"
- [(set (match_operand:XF 0 "s_register_operand" "=f")
- (sqrt:XF (match_operand:XF 1 "s_register_operand" "f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "sqt%?e\\t%0, %1"
-[(set_attr "type" "float_em")])
-
-;; SIN COS TAN and family are always emulated, so it's probably better
-;; to always call a library function.
-;(define_insn "sinsf2"
-; [(set (match_operand:SF 0 "s_register_operand" "=f")
-; (unspec:SF [(match_operand:SF 1 "s_register_operand" "f")] 0))]
-; "TARGET_HARD_FLOAT"
-; "sin%?s\\t%0, %1"
-;[(set_attr "type" "float_em")])
-;
-;(define_insn "sindf2"
-; [(set (match_operand:DF 0 "s_register_operand" "=f")
-; (unspec:DF [(match_operand:DF 1 "s_register_operand" "f")] 0))]
-; "TARGET_HARD_FLOAT"
-; "sin%?d\\t%0, %1"
-;[(set_attr "type" "float_em")])
-;
-;(define_insn "*sindf_esfdf"
-; [(set (match_operand:DF 0 "s_register_operand" "=f")
-; (unspec:DF [(float_extend:DF
-; (match_operand:SF 1 "s_register_operand" "f"))] 0))]
-; "TARGET_HARD_FLOAT"
-; "sin%?d\\t%0, %1"
-;[(set_attr "type" "float_em")])
-;
-;(define_insn "sinxf2"
-; [(set (match_operand:XF 0 "s_register_operand" "=f")
-; (unspec:XF [(match_operand:XF 1 "s_register_operand" "f")] 0))]
-; "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
-; "sin%?e\\t%0, %1"
-;[(set_attr "type" "float_em")])
-;
-;(define_insn "cossf2"
-; [(set (match_operand:SF 0 "s_register_operand" "=f")
-; (unspec:SF [(match_operand:SF 1 "s_register_operand" "f")] 1))]
-; "TARGET_HARD_FLOAT"
-; "cos%?s\\t%0, %1"
-;[(set_attr "type" "float_em")])
-;
-;(define_insn "cosdf2"
-; [(set (match_operand:DF 0 "s_register_operand" "=f")
-; (unspec:DF [(match_operand:DF 1 "s_register_operand" "f")] 1))]
-; "TARGET_HARD_FLOAT"
-; "cos%?d\\t%0, %1"
-;[(set_attr "type" "float_em")])
-;
-;(define_insn "*cosdf_esfdf"
-; [(set (match_operand:DF 0 "s_register_operand" "=f")
-; (unspec:DF [(float_extend:DF
-; (match_operand:SF 1 "s_register_operand" "f"))] 1))]
-; "TARGET_HARD_FLOAT"
-; "cos%?d\\t%0, %1"
-;[(set_attr "type" "float_em")])
-;
-;(define_insn "cosxf2"
-; [(set (match_operand:XF 0 "s_register_operand" "=f")
-; (unspec:XF [(match_operand:XF 1 "s_register_operand" "f")] 1))]
-; "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
-; "cos%?e\\t%0, %1"
-;[(set_attr "type" "float_em")])
-
-(define_insn "one_cmpldi2"
- [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
- (not:DI (match_operand:DI 1 "s_register_operand" "?r,0")))]
- ""
- "mvn%?\\t%Q0, %Q1\;mvn%?\\t%R0, %R1"
-[(set_attr "length" "8")])
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (not:SI (match_operand:SI 1 "s_register_operand" "r")))]
- ""
- "mvn%?\\t%0, %1")
-
-(define_insn "*notsi_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (not:SI (match_operand:SI 1 "s_register_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (not:SI (match_dup 1)))]
- ""
- "mvn%?s\\t%0, %1"
-[(set_attr "conds" "set")])
-
-(define_insn "*notsi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (not:SI (match_operand:SI 1 "s_register_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=r"))]
- ""
- "mvn%?s\\t%0, %1"
-[(set_attr "conds" "set")])
-
-;; Fixed <--> Floating conversion insns
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "s_register_operand" "=f")
- (float:SF (match_operand:SI 1 "s_register_operand" "r")))]
- "TARGET_HARD_FLOAT"
- "flt%?s\\t%0, %1"
-[(set_attr "type" "r_2_f")])
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (float:DF (match_operand:SI 1 "s_register_operand" "r")))]
- "TARGET_HARD_FLOAT"
- "flt%?d\\t%0, %1"
-[(set_attr "type" "r_2_f")])
-
-(define_insn "floatsixf2"
- [(set (match_operand:XF 0 "s_register_operand" "=f")
- (float:XF (match_operand:SI 1 "s_register_operand" "r")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "flt%?e\\t%0, %1"
-[(set_attr "type" "r_2_f")])
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (fix:SI (match_operand:SF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "fix%?z\\t%0, %1"
-[(set_attr "type" "f_2_r")])
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (fix:SI (match_operand:DF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "fix%?z\\t%0, %1"
-[(set_attr "type" "f_2_r")])
-
-(define_insn "fix_truncxfsi2"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (fix:SI (match_operand:XF 1 "s_register_operand" "f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "fix%?z\\t%0, %1"
-[(set_attr "type" "f_2_r")])
-
-;; Truncation insns
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "s_register_operand" "=f")
- (float_truncate:SF
- (match_operand:DF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "mvf%?s\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "truncxfsf2"
- [(set (match_operand:SF 0 "s_register_operand" "=f")
- (float_truncate:SF
- (match_operand:XF 1 "s_register_operand" "f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "mvf%?s\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "truncxfdf2"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (float_truncate:DF
- (match_operand:XF 1 "s_register_operand" "f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "mvf%?d\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-;; Zero and sign extension instructions.
-
-(define_insn "zero_extendsidi2"
- [(set (match_operand:DI 0 "s_register_operand" "=r")
- (zero_extend:DI (match_operand:SI 1 "s_register_operand" "r")))]
- ""
- "*
- if (REGNO (operands[1]) != REGNO (operands[0]) + (WORDS_BIG_ENDIAN ? 1 : 0))
- output_asm_insn (\"mov%?\\t%Q0, %1\", operands);
- return \"mov%?\\t%R0, #0\";
-"
-[(set_attr "length" "8")])
-
-(define_insn "zero_extendqidi2"
- [(set (match_operand:DI 0 "s_register_operand" "=r,r")
- (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
- ""
- "@
- and%?\\t%Q0, %1, #255\;mov%?\\t%R0, #0
- ldr%?b\\t%Q0, %1\;mov%?\\t%R0, #0"
-[(set_attr "length" "8")
- (set_attr "type" "*,load")])
-
-(define_insn "extendsidi2"
- [(set (match_operand:DI 0 "s_register_operand" "=r")
- (sign_extend:DI (match_operand:SI 1 "s_register_operand" "r")))]
- ""
- "*
- if (REGNO (operands[1]) != REGNO (operands[0]) + (WORDS_BIG_ENDIAN ? 1 : 0))
- output_asm_insn (\"mov%?\\t%Q0, %1\", operands);
- return \"mov%?\\t%R0, %Q0, asr #31\";
-"
-[(set_attr "length" "8")])
-
-(define_expand "zero_extendhisi2"
- [(set (match_dup 2) (ashift:SI (match_operand:HI 1 "nonimmediate_operand" "")
- (const_int 16)))
- (set (match_operand:SI 0 "s_register_operand" "")
- (lshiftrt:SI (match_dup 2) (const_int 16)))]
- ""
- "
-{
- if (arm_arch4 && GET_CODE (operands[1]) == MEM)
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (ZERO_EXTEND, SImode, operands[1])));
- DONE;
- }
- if (TARGET_SHORT_BY_BYTES && GET_CODE (operands[1]) == MEM)
- {
- emit_insn (gen_movhi_bytes (operands[0], operands[1]));
- DONE;
- }
- if (! s_register_operand (operands[1], HImode))
- operands[1] = copy_to_mode_reg (HImode, operands[1]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "*zero_extendhisi_insn"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
- "arm_arch4"
- "ldr%?h\\t%0, %1"
-[(set_attr "type" "load")])
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (zero_extend:SI (match_operand:HI 1 "alignable_memory_operand" "")))
- (clobber (match_operand:SI 2 "s_register_operand" ""))]
- "! arm_arch4"
- [(set (match_dup 2) (match_dup 1))
- (set (match_dup 0) (lshiftrt:SI (match_dup 2) (const_int 16)))]
- "
-{
- if ((operands[1] = gen_rotated_half_load (operands[1])) == NULL)
- FAIL;
-}")
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (match_operator:SI 3 "shiftable_operator"
- [(zero_extend:SI (match_operand:HI 1 "alignable_memory_operand" ""))
- (match_operand:SI 4 "s_register_operand" "")]))
- (clobber (match_operand:SI 2 "s_register_operand" ""))]
- "! arm_arch4"
- [(set (match_dup 2) (match_dup 1))
- (set (match_dup 0)
- (match_op_dup 3
- [(lshiftrt:SI (match_dup 2) (const_int 16)) (match_dup 4)]))]
- "
-{
- if ((operands[1] = gen_rotated_half_load (operands[1])) == NULL)
- FAIL;
-}")
-
-(define_expand "zero_extendqisi2"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (zero_extend:SI
- (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
- ""
- "
- if (GET_CODE (operands[1]) != MEM)
- {
- emit_insn (gen_andsi3 (operands[0], gen_lowpart (SImode, operands[1]),
- GEN_INT (255)));
- DONE;
- }
-")
-
-(define_insn "*load_extendqisi"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
- ""
- "ldr%?b\\t%0, %1\\t%@ zero_extendqisi2"
-[(set_attr "type" "load")])
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (zero_extend:SI (subreg:QI (match_operand:SI 1 "" "") 0)))
- (clobber (match_operand:SI 2 "s_register_operand" ""))]
- "GET_CODE (operands[1]) != MEM"
- [(set (match_dup 2) (match_dup 1))
- (set (match_dup 0) (and:SI (match_dup 2) (const_int 255)))]
- "")
-
-(define_insn "*compareqi_eq0"
- [(set (reg:CC_Z 24)
- (compare:CC_Z (match_operand:QI 0 "s_register_operand" "r")
- (const_int 0)))]
- ""
- "tst\\t%0, #255"
-[(set_attr "conds" "set")])
-
-(define_expand "extendhisi2"
- [(set (match_dup 2)
- (ashift:SI (match_operand:HI 1 "nonimmediate_operand" "")
- (const_int 16)))
- (set (match_operand:SI 0 "s_register_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 16)))]
- ""
- "
-{
- if (arm_arch4 && GET_CODE (operands[1]) == MEM)
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (SIGN_EXTEND, SImode, operands[1])));
- DONE;
- }
-
- if (TARGET_SHORT_BY_BYTES && GET_CODE (operands[1]) == MEM)
- {
- emit_insn (gen_extendhisi2_mem (operands[0], operands[1]));
- DONE;
- }
- if (! s_register_operand (operands[1], HImode))
- operands[1] = copy_to_mode_reg (HImode, operands[1]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode);
-}")
-
-(define_expand "extendhisi2_mem"
- [(set (match_dup 2) (zero_extend:SI (mem:QI (match_operand:HI 1 "" ""))))
- (set (match_dup 3)
- (zero_extend:SI (mem:QI (plus:SI (match_dup 1) (const_int 1)))))
- (set (match_dup 6) (ashift:SI (match_dup 4) (const_int 24)))
- (set (match_operand:SI 0 "" "")
- (ior:SI (ashiftrt:SI (match_dup 6) (const_int 16)) (match_dup 5)))]
- ""
- "
- operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = copy_to_mode_reg (SImode, XEXP (operands[1], 0));
- operands[2] = gen_reg_rtx (SImode);
- operands[3] = gen_reg_rtx (SImode);
- operands[6] = gen_reg_rtx (SImode);
-
- if (BYTES_BIG_ENDIAN)
- {
- operands[4] = operands[2];
- operands[5] = operands[3];
- }
- else
- {
- operands[4] = operands[3];
- operands[5] = operands[2];
- }
-")
-
-(define_insn "*extendhisi_insn"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
- "arm_arch4"
- "ldr%?sh\\t%0, %1"
-[(set_attr "type" "load")])
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (sign_extend:SI (match_operand:HI 1 "alignable_memory_operand" "")))
- (clobber (match_operand:SI 2 "s_register_operand" ""))]
- "! arm_arch4"
- [(set (match_dup 2) (match_dup 1))
- (set (match_dup 0) (ashiftrt:SI (match_dup 2) (const_int 16)))]
- "
-{
- if ((operands[1] = gen_rotated_half_load (operands[1])) == NULL)
- FAIL;
-}")
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (match_operator:SI 3 "shiftable_operator"
- [(sign_extend:SI (match_operand:HI 1 "alignable_memory_operand" ""))
- (match_operand:SI 4 "s_register_operand" "")]))
- (clobber (match_operand:SI 2 "s_register_operand" ""))]
- "! arm_arch4"
- [(set (match_dup 2) (match_dup 1))
- (set (match_dup 0)
- (match_op_dup 3
- [(ashiftrt:SI (match_dup 2) (const_int 16)) (match_dup 4)]))]
- "
-{
- if ((operands[1] = gen_rotated_half_load (operands[1])) == NULL)
- FAIL;
-}")
-
-(define_expand "extendqihi2"
- [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "general_operand" "")
- (const_int 24)))
- (set (match_operand:HI 0 "s_register_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))]
- ""
- "
-{
- if (arm_arch4 && GET_CODE (operands[1]) == MEM)
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (SIGN_EXTEND, HImode, operands[1])));
- DONE;
- }
- if (! s_register_operand (operands[1], QImode))
- operands[1] = copy_to_mode_reg (QImode, operands[1]);
- operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "*extendqihi_insn"
- [(set (match_operand:HI 0 "s_register_operand" "=r")
- (sign_extend:HI (match_operand:QI 1 "memory_operand" "o<>")))]
- "arm_arch4"
- "ldr%?sb\\t%0, %1"
-[(set_attr "type" "load")])
-
-(define_expand "extendqisi2"
- [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "s_register_operand" "")
- (const_int 24)))
- (set (match_operand:SI 0 "s_register_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))]
- ""
- "
-{
- if (arm_arch4 && GET_CODE (operands[1]) == MEM)
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (SIGN_EXTEND, SImode, operands[1])));
- DONE;
- }
- if (! s_register_operand (operands[1], QImode))
- operands[1] = copy_to_mode_reg (QImode, operands[1]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "*extendqisi_insn"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (sign_extend:SI (match_operand:QI 1 "memory_operand" "o<>")))]
- "arm_arch4"
- "ldr%?sb\\t%0, %1"
-[(set_attr "type" "load")])
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "s_register_operand" "=f")
- (float_extend:DF (match_operand:SF 1 "s_register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "mvf%?d\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "extendsfxf2"
- [(set (match_operand:XF 0 "s_register_operand" "=f")
- (float_extend:XF (match_operand:SF 1 "s_register_operand" "f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "mvf%?e\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-(define_insn "extenddfxf2"
- [(set (match_operand:XF 0 "s_register_operand" "=f")
- (float_extend:XF (match_operand:DF 1 "s_register_operand" "f")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "mvf%?e\\t%0, %1"
-[(set_attr "type" "ffarith")])
-
-
-;; Move insns (including loads and stores)
-
-;; XXX Just some ideas about movti.
-;; I don't think these are a good idea on the arm, there just aren't enough
-;; registers
-;;(define_expand "loadti"
-;; [(set (match_operand:TI 0 "s_register_operand" "")
-;; (mem:TI (match_operand:SI 1 "address_operand" "")))]
-;; "" "")
-
-;;(define_expand "storeti"
-;; [(set (mem:TI (match_operand:TI 0 "address_operand" ""))
-;; (match_operand:TI 1 "s_register_operand" ""))]
-;; "" "")
-
-;;(define_expand "movti"
-;; [(set (match_operand:TI 0 "general_operand" "")
-;; (match_operand:TI 1 "general_operand" ""))]
-;; ""
-;; "
-;;{
-;; rtx insn;
-;;
-;; if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
-;; operands[1] = copy_to_reg (operands[1]);
-;; if (GET_CODE (operands[0]) == MEM)
-;; insn = gen_storeti (XEXP (operands[0], 0), operands[1]);
-;; else if (GET_CODE (operands[1]) == MEM)
-;; insn = gen_loadti (operands[0], XEXP (operands[1], 0));
-;; else
-;; FAIL;
-;;
-;; emit_insn (insn);
-;; DONE;
-;;}")
-
-;; Recognise garbage generated above.
-
-;;(define_insn ""
-;; [(set (match_operand:TI 0 "general_operand" "=r,r,r,<,>,m")
-;; (match_operand:TI 1 "general_operand" "<,>,m,r,r,r"))]
-;; ""
-;; "*
-;; {
-;; register mem = (which_alternative < 3);
-;; register char *template;
-;;
-;; operands[mem] = XEXP (operands[mem], 0);
-;; switch (which_alternative)
-;; {
-;; case 0: template = \"ldmdb\\t%1!, %M0\"; break;
-;; case 1: template = \"ldmia\\t%1!, %M0\"; break;
-;; case 2: template = \"ldmia\\t%1, %M0\"; break;
-;; case 3: template = \"stmdb\\t%0!, %M1\"; break;
-;; case 4: template = \"stmia\\t%0!, %M1\"; break;
-;; case 5: template = \"stmia\\t%0, %M1\"; break;
-;; }
-;; output_asm_insn (template, operands);
-;; return \"\";
-;; }")
-
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "di_operand" "=r,r,o<>")
- (match_operand:DI 1 "di_operand" "rIK,mi,r"))]
- ""
- "*
- return (output_move_double (operands));
-"
-[(set_attr "length" "8,8,8")
- (set_attr "type" "*,load,store2")])
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
- /* Everything except mem = const or mem = mem can be done easily */
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (SImode, operands[1]);
- if (GET_CODE (operands[1]) == CONST_INT
- && !(const_ok_for_arm (INTVAL (operands[1]))
- || const_ok_for_arm (~INTVAL (operands[1]))))
- {
- arm_split_constant (SET, SImode, INTVAL (operands[1]), operands[0],
- NULL_RTX,
- (reload_in_progress || reload_completed ? 0
- : preserve_subexpressions_p ()));
- DONE;
- }
-")
-
-(define_insn "*movsi_insn"
- [(set (match_operand:SI 0 "general_operand" "=r,r,r,m")
- (match_operand:SI 1 "general_operand" "rI,K,mi,r"))]
- "register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)"
- "@
- mov%?\\t%0, %1
- mvn%?\\t%0, #%B1
- ldr%?\\t%0, %1
- str%?\\t%1, %0"
-[(set_attr "type" "*,*,load,store1")])
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (match_operand:SI 1 "const_int_operand" ""))]
- "! (const_ok_for_arm (INTVAL (operands[1]))
- || const_ok_for_arm (~INTVAL (operands[1])))"
- [(clobber (const_int 0))]
- "
- arm_split_constant (SET, SImode, INTVAL (operands[1]), operands[0],
- NULL_RTX, 0);
- DONE;
-")
-
-(define_expand "movaddr"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (match_operand:DI 1 "address_operand" ""))]
- ""
- "")
-
-(define_insn "*movaddr_insn"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (match_operand:DI 1 "address_operand" "p"))]
- "reload_completed
- && (GET_CODE (operands[1]) == LABEL_REF
- || (GET_CODE (operands[1]) == CONST
- && GET_CODE (XEXP (operands[1], 0)) == PLUS
- && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
- && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT))"
- "adr%?\\t%0, %a1")
-
-;; If copying one reg to another we can set the condition codes according to
-;; its value. Such a move is common after a return from subroutine and the
-;; result is being tested against zero.
-
-(define_insn "*movsi_compare0"
- [(set (reg:CC 24) (compare:CC (match_operand:SI 1 "s_register_operand" "0,r")
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r,r") (match_dup 1))]
- ""
- "@
- cmp%?\\t%0, #0
- sub%?s\\t%0, %1, #0"
-[(set_attr "conds" "set")])
-
-;; Subroutine to store a half word from a register into memory.
-;; Operand 0 is the source register (HImode)
-;; Operand 1 is the destination address in a register (SImode)
-
-;; In both this routine and the next, we must be careful not to spill
-;; a memory address of reg+large_const into a separate PLUS insn, since this
-;; can generate unrecognizable rtl.
-
-(define_expand "storehi"
- [;; store the low byte
- (set (mem:QI (match_operand:SI 1 "" "")) (match_dup 3))
- ;; extract the high byte
- (set (match_dup 2)
- (ashiftrt:SI (match_operand 0 "" "") (const_int 8)))
- ;; store the high byte
- (set (mem:QI (match_dup 4))
- (subreg:QI (match_dup 2) 0))] ;explicit subreg safe
- ""
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
-
- if ((code == PLUS || code == MINUS)
- && (GET_CODE (XEXP (operands[1], 1)) == REG
- || GET_CODE (XEXP (operands[1], 0)) != REG))
- operands[1] = force_reg (SImode, operands[1]);
- operands[4] = plus_constant (operands[1], 1);
- operands[3] = gen_lowpart (QImode, operands[0]);
- operands[0] = gen_lowpart (SImode, operands[0]);
- operands[2] = gen_reg_rtx (SImode);
-}
-")
-
-(define_expand "storehi_bigend"
- [(set (mem:QI (match_dup 4)) (match_dup 3))
- (set (match_dup 2)
- (ashiftrt:SI (match_operand 0 "" "") (const_int 8)))
- (set (mem:QI (match_operand 1 "" ""))
- (subreg:QI (match_dup 2) 0))]
- ""
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
- if ((code == PLUS || code == MINUS)
- && (GET_CODE (XEXP (operands[1], 1)) == REG
- || GET_CODE (XEXP (operands[1], 0)) != REG))
- operands[1] = force_reg (SImode, operands[1]);
-
- operands[4] = plus_constant (operands[1], 1);
- operands[3] = gen_lowpart (QImode, operands[0]);
- operands[0] = gen_lowpart (SImode, operands[0]);
- operands[2] = gen_reg_rtx (SImode);
-}
-")
-
-;; Subroutine to store a half word integer constant into memory.
-(define_expand "storeinthi"
- [(set (mem:QI (match_operand:SI 0 "" ""))
- (subreg:QI (match_operand 1 "" "") 0))
- (set (mem:QI (match_dup 3)) (subreg:QI (match_dup 2) 0))]
- ""
- "
-{
- HOST_WIDE_INT value = INTVAL (operands[1]);
- enum rtx_code code = GET_CODE (operands[0]);
-
- if ((code == PLUS || code == MINUS)
- && (GET_CODE (XEXP (operands[0], 1)) == REG
- || GET_CODE (XEXP (operands[0], 0)) != REG))
- operands[0] = force_reg (SImode, operands[0]);
-
- operands[1] = gen_reg_rtx (SImode);
- if (BYTES_BIG_ENDIAN)
- {
- emit_insn (gen_movsi (operands[1], GEN_INT ((value >> 8) & 255)));
- if ((value & 255) == ((value >> 8) & 255))
- operands[2] = operands[1];
- else
- {
- operands[2] = gen_reg_rtx (SImode);
- emit_insn (gen_movsi (operands[2], GEN_INT (value & 255)));
- }
- }
- else
- {
- emit_insn (gen_movsi (operands[1], GEN_INT (value & 255)));
- if ((value & 255) == ((value >> 8) & 255))
- operands[2] = operands[1];
- else
- {
- operands[2] = gen_reg_rtx (SImode);
- emit_insn (gen_movsi (operands[2], GEN_INT ((value >> 8) & 255)));
- }
- }
-
- operands[3] = plus_constant (operands[0], 1);
-}
-")
-
-(define_expand "storehi_single_op"
- [(set (match_operand:HI 0 "memory_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- "arm_arch4"
- "
- if (! s_register_operand (operands[1], HImode))
- operands[1] = copy_to_mode_reg (HImode, operands[1]);
-")
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- rtx insn;
-
- if (! (reload_in_progress || reload_completed))
- {
- if (GET_CODE (operands[0]) == MEM)
- {
- if (arm_arch4)
- {
- emit_insn (gen_storehi_single_op (operands[0], operands[1]));
- DONE;
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- emit_insn (gen_storeinthi (XEXP (operands[0], 0), operands[1]));
- else
- {
- if (GET_CODE (operands[1]) == MEM)
- operands[1] = force_reg (HImode, operands[1]);
- if (BYTES_BIG_ENDIAN)
- emit_insn (gen_storehi_bigend (operands[1],
- XEXP (operands[0], 0)));
- else
- emit_insn (gen_storehi (operands[1], XEXP (operands[0], 0)));
- }
- DONE;
- }
- /* Sign extend a constant, and keep it in an SImode reg. */
- else if (GET_CODE (operands[1]) == CONST_INT)
- {
- rtx reg = gen_reg_rtx (SImode);
- HOST_WIDE_INT val = INTVAL (operands[1]) & 0xffff;
-
- /* If the constant is already valid, leave it alone. */
- if (! const_ok_for_arm (val))
- {
- /* If setting all the top bits will make the constant
- loadable in a single instruction, then set them.
- Otherwise, sign extend the number. */
-
- if (const_ok_for_arm (~ (val | ~0xffff)))
- val |= ~0xffff;
- else if (val & 0x8000)
- val |= ~0xffff;
- }
-
- emit_insn (gen_movsi (reg, GEN_INT (val)));
- operands[1] = gen_rtx (SUBREG, HImode, reg, 0);
- }
- else if (! arm_arch4)
- {
- if (GET_CODE (operands[1]) == MEM)
- {
- if (TARGET_SHORT_BY_BYTES)
- {
- rtx base;
- rtx offset = const0_rtx;
- rtx reg = gen_reg_rtx (SImode);
-
- if ((GET_CODE (base = XEXP (operands[1], 0)) == REG
- || (GET_CODE (base) == PLUS
- && GET_CODE (offset = XEXP (base, 1)) == CONST_INT
- && GET_CODE (base = XEXP (base, 0)) == REG))
- && REGNO_POINTER_ALIGN (REGNO (base)) >= 4)
- {
- HOST_WIDE_INT new_offset = INTVAL (offset) & ~2;
-
- emit_insn (gen_movsi (reg, gen_rtx (MEM, SImode,
- plus_constant (base, new_offset))));
- if (((INTVAL (offset) & 2) != 0)
- ^ (BYTES_BIG_ENDIAN ? 1 : 0))
- {
- rtx reg2 = gen_reg_rtx (SImode);
-
- emit_insn (gen_lshrsi3 (reg2, reg, GEN_INT (16)));
- reg = reg2;
- }
- }
- else
- emit_insn (gen_movhi_bytes (reg, operands[1]));
-
- operands[1] = gen_lowpart (HImode, reg);
- }
- else if (BYTES_BIG_ENDIAN)
- {
- rtx base;
- rtx offset = const0_rtx;
-
- if ((GET_CODE (base = XEXP (operands[1], 0)) == REG
- || (GET_CODE (base) == PLUS
- && GET_CODE (offset = XEXP (base, 1)) == CONST_INT
- && GET_CODE (base = XEXP (base, 0)) == REG))
- && REGNO_POINTER_ALIGN (REGNO (base)) >= 4)
- {
- rtx reg = gen_reg_rtx (SImode);
- rtx new_mem;
-
- if ((INTVAL (offset) & 2) == 2)
- {
- HOST_WIDE_INT new_offset = INTVAL (offset) ^ 2;
- new_mem = gen_rtx (MEM, SImode,
- plus_constant (base, new_offset));
-
- emit_insn (gen_movsi (reg, new_mem));
- }
- else
- {
- new_mem = gen_rtx (MEM, SImode,
- XEXP (operands[1], 0));
- emit_insn (gen_rotated_loadsi (reg, new_mem));
- }
-
- operands[1] = gen_lowpart (HImode, reg);
- }
- else
- {
- emit_insn (gen_movhi_bigend (operands[0], operands[1]));
- DONE;
- }
- }
- }
- }
- }
- /* Handle loading a large integer during reload */
- else if (GET_CODE (operands[1]) == CONST_INT
- && ! const_ok_for_arm (INTVAL (operands[1]))
- && ! const_ok_for_arm (~INTVAL (operands[1])))
- {
- /* Writing a constant to memory needs a scratch, which should
- be handled with SECONDARY_RELOADs. */
- if (GET_CODE (operands[0]) != REG)
- abort ();
-
- operands[0] = gen_rtx (SUBREG, SImode, operands[0], 0);
- emit_insn (gen_movsi (operands[0], operands[1]));
- DONE;
- }
-}
-")
-
-(define_insn "rotated_loadsi"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (rotate:SI (match_operand:SI 1 "offsettable_memory_operand" "o")
- (const_int 16)))]
- "! TARGET_SHORT_BY_BYTES"
- "*
-{
- rtx ops[2];
-
- ops[0] = operands[0];
- ops[1] = gen_rtx (MEM, SImode, plus_constant (XEXP (operands[1], 0), 2));
- output_asm_insn (\"ldr%?\\t%0, %1\\t%@ load-rotate\", ops);
- return \"\";
-}"
-[(set_attr "type" "load")])
-
-(define_expand "movhi_bytes"
- [(set (match_dup 2) (zero_extend:SI (mem:QI (match_operand:HI 1 "" ""))))
- (set (match_dup 3)
- (zero_extend:SI (mem:QI (plus:SI (match_dup 1) (const_int 1)))))
- (set (match_operand:SI 0 "" "")
- (ior:SI (ashift:SI (match_dup 4) (const_int 8)) (match_dup 5)))]
- ""
- "
- operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = copy_to_mode_reg (SImode, XEXP (operands[1], 0));
- operands[2] = gen_reg_rtx (SImode);
- operands[3] = gen_reg_rtx (SImode);
-
- if (BYTES_BIG_ENDIAN)
- {
- operands[4] = operands[2];
- operands[5] = operands[3];
- }
- else
- {
- operands[4] = operands[3];
- operands[5] = operands[2];
- }
-")
-
-(define_expand "movhi_bigend"
- [(set (match_dup 2)
- (rotate:SI (subreg:SI (match_operand:HI 1 "memory_operand" "") 0)
- (const_int 16)))
- (set (match_dup 3)
- (ashiftrt:SI (match_dup 2) (const_int 16)))
- (set (match_operand:HI 0 "s_register_operand" "")
- (subreg:HI (match_dup 3) 0))]
- ""
- "
- operands[2] = gen_reg_rtx (SImode);
- operands[3] = gen_reg_rtx (SImode);
-")
-
-;; Pattern to recognise insn generated default case above
-
-(define_insn "*movhi_insn_arch4"
- [(set (match_operand:HI 0 "general_operand" "=r,r,r,m")
- (match_operand:HI 1 "general_operand" "rI,K,m,r"))]
- "arm_arch4
- && (GET_CODE (operands[1]) != CONST_INT
- || const_ok_for_arm (INTVAL (operands[1]))
- || const_ok_for_arm (~INTVAL (operands[1])))"
- "@
- mov%?\\t%0, %1\\t%@ movhi
- mvn%?\\t%0, #%B1\\t%@ movhi
- ldr%?h\\t%0, %1\\t%@ movhi
- str%?h\\t%1, %0\\t%@ movhi"
-[(set_attr "type" "*,*,load,store1")])
-
-(define_insn "*movhi_insn_littleend"
- [(set (match_operand:HI 0 "general_operand" "=r,r,r")
- (match_operand:HI 1 "general_operand" "rI,K,m"))]
- "! arm_arch4
- && ! BYTES_BIG_ENDIAN
- && ! TARGET_SHORT_BY_BYTES
- && (GET_CODE (operands[1]) != CONST_INT
- || const_ok_for_arm (INTVAL (operands[1]))
- || const_ok_for_arm (~INTVAL (operands[1])))"
- "@
- mov%?\\t%0, %1\\t%@ movhi
- mvn%?\\t%0, #%B1\\t%@ movhi
- ldr%?\\t%0, %1\\t%@ movhi"
-[(set_attr "type" "*,*,load")])
-
-(define_insn "*movhi_insn_bigend"
- [(set (match_operand:HI 0 "s_register_operand" "=r,r,r")
- (match_operand:HI 1 "general_operand" "rI,K,m"))]
- "! arm_arch4
- && BYTES_BIG_ENDIAN
- && ! TARGET_SHORT_BY_BYTES
- && (GET_CODE (operands[1]) != CONST_INT
- || const_ok_for_arm (INTVAL (operands[1]))
- || const_ok_for_arm (~INTVAL (operands[1])))"
- "@
- mov%?\\t%0, %1\\t%@ movhi
- mvn%?\\t%0, #%B1\\t%@ movhi
- ldr%?\\t%0, %1\\t%@ movhi_bigend\;mov%?\\t%0, %0, asr #16"
-[(set_attr "type" "*,*,load")
- (set_attr "length" "4,4,8")])
-
-(define_insn "*loadhi_si_bigend"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (rotate:SI (subreg:SI (match_operand:HI 1 "memory_operand" "m") 0)
- (const_int 16)))]
- "BYTES_BIG_ENDIAN
- && ! TARGET_SHORT_BY_BYTES"
- "ldr%?\\t%0, %1\\t%@ movhi_bigend"
-[(set_attr "type" "load")])
-
-(define_insn "*movhi_bytes"
- [(set (match_operand:HI 0 "s_register_operand" "=r,r")
- (match_operand:HI 1 "arm_rhs_operand" "rI,K"))]
- "TARGET_SHORT_BY_BYTES"
- "@
- mov%?\\t%0, %1\\t%@ movhi
- mvn%?\\t%0, #%B1\\t%@ movhi")
-
-
-(define_expand "reload_outhi"
- [(parallel [(match_operand:HI 0 "reload_memory_operand" "=o")
- (match_operand:HI 1 "s_register_operand" "r")
- (match_operand:SI 2 "s_register_operand" "=&r")])]
- ""
- "
- arm_reload_out_hi (operands);
- DONE;
-")
-
-(define_expand "reload_inhi"
- [(parallel [(match_operand:HI 0 "s_register_operand" "=r")
- (match_operand:HI 1 "reload_memory_operand" "o")
- (match_operand:SI 2 "s_register_operand" "=&r")])]
- "TARGET_SHORT_BY_BYTES"
- "
- arm_reload_in_hi (operands);
- DONE;
-")
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
- /* Everything except mem = const or mem = mem can be done easily */
-
- if (!(reload_in_progress || reload_completed))
- {
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- rtx reg = gen_reg_rtx (SImode);
-
- emit_insn (gen_movsi (reg, operands[1]));
- operands[1] = gen_rtx (SUBREG, QImode, reg, 0);
- }
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (QImode, operands[1]);
- }
-")
-
-
-(define_insn "*movqi_insn"
- [(set (match_operand:QI 0 "general_operand" "=r,r,r,m")
- (match_operand:QI 1 "general_operand" "rI,K,m,r"))]
- "register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode)"
- "@
- mov%?\\t%0, %1
- mvn%?\\t%0, #%B1
- ldr%?b\\t%0, %1
- str%?b\\t%1, %0"
-[(set_attr "type" "*,*,load,store1")])
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (SFmode, operands[1]);
-")
-
-(define_insn "*movsf_hard_insn"
- [(set (match_operand:SF 0 "general_operand" "=f,f,f,m,f,r,r,r,m")
- (match_operand:SF 1 "general_operand" "fG,H,mE,f,r,f,r,mE,r"))]
- "TARGET_HARD_FLOAT
- && (GET_CODE (operands[0]) != MEM || register_operand (operands[1], SFmode))"
- "@
- mvf%?s\\t%0, %1
- mnf%?s\\t%0, #%N1
- ldf%?s\\t%0, %1
- stf%?s\\t%1, %0
- str%?\\t%1, [%|sp, #-4]!\;ldf%?s\\t%0, [%|sp], #4
- stf%?s\\t%1, [%|sp, #-4]!\;ldr%?\\t%0, [%|sp], #4
- mov%?\\t%0, %1
- ldr%?\\t%0, %1\\t%@ float
- str%?\\t%1, %0\\t%@ float"
-[(set_attr "length" "4,4,4,4,8,8,4,4,4")
- (set_attr "type"
- "ffarith,ffarith,f_load,f_store,r_mem_f,f_mem_r,*,load,store1")])
-
-;; Exactly the same as above, except that all `f' cases are deleted.
-;; This is necessary to prevent reload from ever trying to use a `f' reg
-;; when -msoft-float.
-
-(define_insn "*movsf_soft_insn"
- [(set (match_operand:SF 0 "general_operand" "=r,r,m")
- (match_operand:SF 1 "general_operand" "r,mE,r"))]
- "TARGET_SOFT_FLOAT
- && (GET_CODE (operands[0]) != MEM || register_operand (operands[1], SFmode))"
- "@
- mov%?\\t%0, %1
- ldr%?\\t%0, %1\\t%@ float
- str%?\\t%1, %0\\t%@ float"
-[(set_attr "length" "4,4,4")
- (set_attr "type" "*,load,store1")])
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (DFmode, operands[1]);
-")
-
-;; Reloading a df mode value stored in integer regs to memory can require a
-;; scratch reg.
-(define_expand "reload_outdf"
- [(match_operand:DF 0 "reload_memory_operand" "=o")
- (match_operand:DF 1 "s_register_operand" "r")
- (match_operand:SI 2 "s_register_operand" "=&r")]
- ""
- "
-{
- enum rtx_code code = GET_CODE (XEXP (operands[0], 0));
-
- if (code == REG)
- operands[2] = XEXP (operands[0], 0);
- else if (code == POST_INC || code == PRE_DEC)
- {
- operands[0] = gen_rtx (SUBREG, DImode, operands[0], 0);
- operands[1] = gen_rtx (SUBREG, DImode, operands[1], 0);
- emit_insn (gen_movdi (operands[0], operands[1]));
- DONE;
- }
- else if (code == PRE_INC)
- {
- rtx reg = XEXP (XEXP (operands[0], 0), 0);
- emit_insn (gen_addsi3 (reg, reg, GEN_INT (8)));
- operands[2] = reg;
- }
- else if (code == POST_DEC)
- operands[2] = XEXP (XEXP (operands[0], 0), 0);
- else
- emit_insn (gen_addsi3 (operands[2], XEXP (XEXP (operands[0], 0), 0),
- XEXP (XEXP (operands[0], 0), 1)));
-
- emit_insn (gen_rtx (SET, VOIDmode, gen_rtx (MEM, DFmode, operands[2]),
- operands[1]));
-
- if (code == POST_DEC)
- emit_insn (gen_addsi3 (operands[2], operands[2], GEN_INT (-8)));
-
- DONE;
-}
-")
-
-(define_insn "*movdf_hard_insn"
- [(set (match_operand:DF 0 "general_operand" "=r,Q,r,m,r,f,f,f,m,!f,!r")
- (match_operand:DF 1 "general_operand" "Q,r,r,r,mF,fG,H,mF,f,r,f"))]
- "TARGET_HARD_FLOAT
- && (GET_CODE (operands[0]) != MEM
- || register_operand (operands[1], DFmode))"
- "*
-{
- rtx ops[3];
-
- switch (which_alternative)
- {
- case 0: return \"ldm%?ia\\t%m1, %M0\\t%@ double\";
- case 1: return \"stm%?ia\\t%m0, %M1\\t%@ double\";
- case 2: case 3: case 4: return output_move_double (operands);
- case 5: return \"mvf%?d\\t%0, %1\";
- case 6: return \"mnf%?d\\t%0, #%N1\";
- case 7: return \"ldf%?d\\t%0, %1\";
- case 8: return \"stf%?d\\t%1, %0\";
- case 9: return output_mov_double_fpu_from_arm (operands);
- case 10: return output_mov_double_arm_from_fpu (operands);
- }
-}
-"
-[(set_attr "length" "4,4,8,8,8,4,4,4,4,8,8")
- (set_attr "type"
-"load,store2,*,store2,load,ffarith,ffarith,f_load,f_store,r_mem_f,f_mem_r")])
-
-;; Software floating point version. This is essentially the same as movdi.
-;; Do not use `f' as a constraint to prevent reload from ever trying to use
-;; an `f' reg.
-
-(define_insn "*movdf_soft_insn"
- [(set (match_operand:DF 0 "soft_df_operand" "=r,r,m")
- (match_operand:DF 1 "soft_df_operand" "r,mF,r"))]
- "TARGET_SOFT_FLOAT"
- "* return output_move_double (operands);"
-[(set_attr "length" "8,8,8")
- (set_attr "type" "*,load,store2")])
-
-(define_expand "movxf"
- [(set (match_operand:XF 0 "general_operand" "")
- (match_operand:XF 1 "general_operand" ""))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "")
-
-;; Even when the XFmode patterns aren't enabled, we enable this after
-;; reloading so that we can push floating point registers in the prologue.
-
-(define_insn "*movxf_hard_insn"
- [(set (match_operand:XF 0 "general_operand" "=f,f,f,m,f,r,r")
- (match_operand:XF 1 "general_operand" "fG,H,m,f,r,f,r"))]
- "TARGET_HARD_FLOAT && (ENABLE_XF_PATTERNS || reload_completed)"
- "*
- switch (which_alternative)
- {
- case 0: return \"mvf%?e\\t%0, %1\";
- case 1: return \"mnf%?e\\t%0, #%N1\";
- case 2: return \"ldf%?e\\t%0, %1\";
- case 3: return \"stf%?e\\t%1, %0\";
- case 4: return output_mov_long_double_fpu_from_arm (operands);
- case 5: return output_mov_long_double_arm_from_fpu (operands);
- case 6: return output_mov_long_double_arm_from_arm (operands);
- }
-"
-[(set_attr "length" "4,4,4,4,8,8,12")
- (set_attr "type" "ffarith,ffarith,f_load,f_store,r_mem_f,f_mem_r,*")])
-
-
-;; load- and store-multiple insns
-;; The arm can load/store any set of registers, provided that they are in
-;; ascending order; but that is beyond GCC so stick with what it knows.
-
-(define_expand "load_multiple"
- [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
- (match_operand:SI 1 "" ""))
- (use (match_operand:SI 2 "" ""))])]
- ""
- "
- /* Support only fixed point registers */
- if (GET_CODE (operands[2]) != CONST_INT
- || INTVAL (operands[2]) > 14
- || INTVAL (operands[2]) < 2
- || GET_CODE (operands[1]) != MEM
- || GET_CODE (operands[0]) != REG
- || REGNO (operands[0]) > 14
- || REGNO (operands[0]) + INTVAL (operands[2]) > 15)
- FAIL;
-
- operands[3]
- = arm_gen_load_multiple (REGNO (operands[0]), INTVAL (operands[2]),
- force_reg (SImode, XEXP (operands[1], 0)),
- TRUE, FALSE);
-")
-
-;; Load multiple with write-back
-
-(define_insn "*ldmsi_postinc"
- [(match_parallel 0 "load_multiple_operation"
- [(set (match_operand:SI 1 "s_register_operand" "+r")
- (plus:SI (match_dup 1)
- (match_operand:SI 2 "const_int_operand" "n")))
- (set (match_operand:SI 3 "s_register_operand" "=r")
- (mem:SI (match_dup 1)))])]
- "(INTVAL (operands[2]) == 4 * (XVECLEN (operands[0], 0) - 2))"
- "*
-{
- rtx ops[3];
- int count = XVECLEN (operands[0], 0);
-
- ops[0] = XEXP (SET_SRC (XVECEXP (operands[0], 0, 0)), 0);
- ops[1] = SET_DEST (XVECEXP (operands[0], 0, 1));
- ops[2] = SET_DEST (XVECEXP (operands[0], 0, count - 2));
-
- output_asm_insn (\"ldm%?ia\\t%0!, {%1-%2}\\t%@ load multiple\", ops);
- return \"\";
-}
-"
-[(set_attr "type" "load")])
-
-;; Ordinary load multiple
-
-(define_insn "*ldmsi"
- [(match_parallel 0 "load_multiple_operation"
- [(set (match_operand:SI 1 "s_register_operand" "=r")
- (mem:SI (match_operand:SI 2 "s_register_operand" "r")))])]
- ""
- "*
-{
- rtx ops[3];
- int count = XVECLEN (operands[0], 0);
-
- ops[0] = XEXP (SET_SRC (XVECEXP (operands[0], 0, 0)), 0);
- ops[1] = SET_DEST (XVECEXP (operands[0], 0, 0));
- ops[2] = SET_DEST (XVECEXP (operands[0], 0, count - 1));
-
- output_asm_insn (\"ldm%?ia\\t%0, {%1-%2}\\t%@ load multiple\", ops);
- return \"\";
-}
-"
-[(set_attr "type" "load")])
-
-(define_expand "store_multiple"
- [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
- (match_operand:SI 1 "" ""))
- (use (match_operand:SI 2 "" ""))])]
- ""
- "
- /* Support only fixed point registers */
- if (GET_CODE (operands[2]) != CONST_INT
- || INTVAL (operands[2]) > 14
- || INTVAL (operands[2]) < 2
- || GET_CODE (operands[1]) != REG
- || GET_CODE (operands[0]) != MEM
- || REGNO (operands[1]) > 14
- || REGNO (operands[1]) + INTVAL (operands[2]) > 15)
- FAIL;
-
- operands[3]
- = arm_gen_store_multiple (REGNO (operands[1]), INTVAL (operands[2]),
- force_reg (SImode, XEXP (operands[0], 0)),
- TRUE, FALSE);
-")
-
-;; Store multiple with write-back
-
-(define_insn "*stmsi_postinc"
- [(match_parallel 0 "store_multiple_operation"
- [(set (match_operand:SI 1 "s_register_operand" "+r")
- (plus:SI (match_dup 1)
- (match_operand:SI 2 "const_int_operand" "n")))
- (set (mem:SI (match_dup 1))
- (match_operand:SI 3 "s_register_operand" "r"))])]
- "(INTVAL (operands[2]) == 4 * (XVECLEN (operands[0], 0) - 2))"
- "*
-{
- rtx ops[3];
- int count = XVECLEN (operands[0], 0);
-
- ops[0] = XEXP (SET_SRC (XVECEXP (operands[0], 0, 0)), 0);
- ops[1] = SET_SRC (XVECEXP (operands[0], 0, 1));
- ops[2] = SET_SRC (XVECEXP (operands[0], 0, count - 2));
-
- output_asm_insn (\"stm%?ia\\t%0!, {%1-%2}\\t%@ str multiple\", ops);
- return \"\";
-}
-"
-[(set (attr "type")
- (cond [(eq (symbol_ref "XVECLEN (operands[0],0)") (const_int 4))
- (const_string "store2")
- (eq (symbol_ref "XVECLEN (operands[0],0)") (const_int 5))
- (const_string "store3")]
- (const_string "store4")))])
-
-;; Ordinary store multiple
-
-(define_insn "*stmsi"
- [(match_parallel 0 "store_multiple_operation"
- [(set (mem:SI (match_operand:SI 2 "s_register_operand" "r"))
- (match_operand:SI 1 "s_register_operand" "r"))])]
- ""
- "*
-{
- rtx ops[3];
- int count = XVECLEN (operands[0], 0);
-
- ops[0] = XEXP (SET_DEST (XVECEXP (operands[0], 0, 0)), 0);
- ops[1] = SET_SRC (XVECEXP (operands[0], 0, 0));
- ops[2] = SET_SRC (XVECEXP (operands[0], 0, count - 1));
-
- output_asm_insn (\"stm%?ia\\t%0, {%1-%2}\\t%@ str multiple\", ops);
- return \"\";
-}
-"
-[(set (attr "type")
- (cond [(eq (symbol_ref "XVECLEN (operands[0],0)") (const_int 3))
- (const_string "store2")
- (eq (symbol_ref "XVECLEN (operands[0],0)") (const_int 4))
- (const_string "store3")]
- (const_string "store4")))])
-
-;; Move a block of memory if it is word aligned and MORE than 2 words long.
-;; We could let this apply for blocks of less than this, but it clobbers so
-;; many registers that there is then probably a better way.
-
-(define_expand "movstrqi"
- [(match_operand:BLK 0 "general_operand" "")
- (match_operand:BLK 1 "general_operand" "")
- (match_operand:SI 2 "const_int_operand" "")
- (match_operand:SI 3 "const_int_operand" "")]
- ""
- "
- if (arm_gen_movstrqi (operands))
- DONE;
- FAIL;
-")
-
-
-;; Comparison and test insns
-
-(define_expand "cmpsi"
- [(match_operand:SI 0 "s_register_operand" "")
- (match_operand:SI 1 "arm_add_operand" "")]
- ""
- "
-{
- arm_compare_op0 = operands[0];
- arm_compare_op1 = operands[1];
- arm_compare_fp = 0;
- DONE;
-}
-")
-
-(define_expand "cmpsf"
- [(match_operand:SF 0 "s_register_operand" "")
- (match_operand:SF 1 "fpu_rhs_operand" "")]
- "TARGET_HARD_FLOAT"
- "
-{
- arm_compare_op0 = operands[0];
- arm_compare_op1 = operands[1];
- arm_compare_fp = 1;
- DONE;
-}
-")
-
-(define_expand "cmpdf"
- [(match_operand:DF 0 "s_register_operand" "")
- (match_operand:DF 1 "fpu_rhs_operand" "")]
- "TARGET_HARD_FLOAT"
- "
-{
- arm_compare_op0 = operands[0];
- arm_compare_op1 = operands[1];
- arm_compare_fp = 1;
- DONE;
-}
-")
-
-(define_expand "cmpxf"
- [(match_operand:XF 0 "s_register_operand" "")
- (match_operand:XF 1 "fpu_rhs_operand" "")]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "
-{
- arm_compare_op0 = operands[0];
- arm_compare_op1 = operands[1];
- arm_compare_fp = 1;
- DONE;
-}
-")
-
-(define_insn "*cmpsi_insn"
- [(set (reg:CC 24)
- (compare:CC (match_operand:SI 0 "s_register_operand" "r,r")
- (match_operand:SI 1 "arm_add_operand" "rI,L")))]
- ""
- "@
- cmp%?\\t%0, %1
- cmn%?\\t%0, #%n1"
-[(set_attr "conds" "set")])
-
-(define_insn "*cmpsi_shiftsi"
- [(set (reg:CC 24)
- (compare:CC (match_operand:SI 0 "s_register_operand" "r")
- (match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rM")])))]
- ""
- "cmp%?\\t%0, %1%S3"
-[(set_attr "conds" "set")])
-
-(define_insn "*cmpsi_shiftsi_swp"
- [(set (reg:CC_SWP 24)
- (compare:CC_SWP (match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "reg_or_int_operand" "rM")])
- (match_operand:SI 0 "s_register_operand" "r")))]
- ""
- "cmp%?\\t%0, %1%S3"
-[(set_attr "conds" "set")])
-
-(define_insn "*cmpsi_neg_shiftsi"
- [(set (reg:CC 24)
- (compare:CC (match_operand:SI 0 "s_register_operand" "r")
- (neg:SI (match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rM")]))))]
- ""
- "cmn%?\\t%0, %1%S3"
-[(set_attr "conds" "set")])
-
-(define_insn "*cmpsf_insn"
- [(set (reg:CCFP 24)
- (compare:CCFP (match_operand:SF 0 "s_register_operand" "f,f")
- (match_operand:SF 1 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- cmf%?\\t%0, %1
- cnf%?\\t%0, #%N1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-(define_insn "*cmpdf_insn"
- [(set (reg:CCFP 24)
- (compare:CCFP (match_operand:DF 0 "s_register_operand" "f,f")
- (match_operand:DF 1 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- cmf%?\\t%0, %1
- cnf%?\\t%0, #%N1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-(define_insn "*cmpesfdf_df"
- [(set (reg:CCFP 24)
- (compare:CCFP (float_extend:DF
- (match_operand:SF 0 "s_register_operand" "f,f"))
- (match_operand:DF 1 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- cmf%?\\t%0, %1
- cnf%?\\t%0, #%N1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-(define_insn "*cmpdf_esfdf"
- [(set (reg:CCFP 24)
- (compare:CCFP (match_operand:DF 0 "s_register_operand" "f")
- (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "cmf%?\\t%0, %1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-(define_insn "*cmpxf_insn"
- [(set (reg:CCFP 24)
- (compare:CCFP (match_operand:XF 0 "s_register_operand" "f,f")
- (match_operand:XF 1 "fpu_add_operand" "fG,H")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "@
- cmf%?\\t%0, %1
- cnf%?\\t%0, #%N1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-(define_insn "*cmpsf_trap"
- [(set (reg:CCFPE 24)
- (compare:CCFPE (match_operand:SF 0 "s_register_operand" "f,f")
- (match_operand:SF 1 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- cmf%?e\\t%0, %1
- cnf%?e\\t%0, #%N1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-(define_insn "*cmpdf_trap"
- [(set (reg:CCFPE 24)
- (compare:CCFPE (match_operand:DF 0 "s_register_operand" "f,f")
- (match_operand:DF 1 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- cmf%?e\\t%0, %1
- cnf%?e\\t%0, #%N1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-(define_insn "*cmp_esfdf_df_trap"
- [(set (reg:CCFPE 24)
- (compare:CCFPE (float_extend:DF
- (match_operand:SF 0 "s_register_operand" "f,f"))
- (match_operand:DF 1 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- cmf%?e\\t%0, %1
- cnf%?e\\t%0, #%N1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-(define_insn "*cmp_df_esfdf_trap"
- [(set (reg:CCFPE 24)
- (compare:CCFPE (match_operand:DF 0 "s_register_operand" "f")
- (float_extend:DF
- (match_operand:SF 1 "s_register_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "cmf%?e\\t%0, %1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-(define_insn "*cmpxf_trap"
- [(set (reg:CCFPE 24)
- (compare:CCFPE (match_operand:XF 0 "s_register_operand" "f,f")
- (match_operand:XF 1 "fpu_add_operand" "fG,H")))]
- "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
- "@
- cmf%?e\\t%0, %1
- cnf%?e\\t%0, #%N1"
-[(set_attr "conds" "set")
- (set_attr "type" "f_2_r")])
-
-; This insn allows redundant compares to be removed by cse, nothing should
-; ever appear in the output file since (set (reg x) (reg x)) is a no-op that
-; is deleted later on. The match_dup will match the mode here, so that
-; mode changes of the condition codes aren't lost by this even though we don't
-; specify what they are.
-
-(define_insn "*deleted_compare"
- [(set (match_operand 0 "cc_register" "") (match_dup 0))]
- ""
- "\\t%@ deleted compare"
-[(set_attr "conds" "set")
- (set_attr "length" "0")])
-
-
-;; Conditional branch insns
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (EQ, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (NE, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GT, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LE, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GE, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LT, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GTU, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LTU, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-;; patterns to match conditional branch insns
-
-(define_insn "*condbranch"
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(match_operand 2 "cc_register" "") (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- extern int arm_ccfsm_state;
-
- if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2)
- {
- arm_ccfsm_state += 2;
- return \"\";
- }
- return \"b%d1\\t%l0\";
-}"
-[(set_attr "conds" "use")])
-
-(define_insn "*condbranch_reversed"
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(match_operand 2 "cc_register" "") (const_int 0)])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- extern int arm_ccfsm_state;
-
- if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2)
- {
- arm_ccfsm_state += 2;
- return \"\";
- }
- return \"b%D1\\t%l0\";
-}"
-[(set_attr "conds" "use")])
-
-
-; scc insns
-
-(define_expand "seq"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (eq:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (EQ, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "sne"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (ne:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (NE, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "sgt"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (gt:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GT, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "sle"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (le:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LE, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "sge"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (ge:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GE, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "slt"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (lt:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LT, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "sgtu"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (gtu:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GTU, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "sleu"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (leu:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "sgeu"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (geu:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_expand "sltu"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (ltu:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LTU, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-}
-")
-
-(define_insn "*mov_scc"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (match_operator:SI 1 "comparison_operator"
- [(match_operand 2 "cc_register" "") (const_int 0)]))]
- ""
- "mov%D1\\t%0, #0\;mov%d1\\t%0, #1"
-[(set_attr "conds" "use")
- (set_attr "length" "8")])
-
-(define_insn "*mov_negscc"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (neg:SI (match_operator:SI 1 "comparison_operator"
- [(match_operand 2 "cc_register" "") (const_int 0)])))]
- ""
- "mov%D1\\t%0, #0\;mvn%d1\\t%0, #0"
-[(set_attr "conds" "use")
- (set_attr "length" "8")])
-
-(define_insn "*mov_notscc"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (not:SI (match_operator:SI 1 "comparison_operator"
- [(match_operand 2 "cc_register" "") (const_int 0)])))]
- ""
- "mov%D1\\t%0, #0\;mvn%d1\\t%0, #1"
-[(set_attr "conds" "use")
- (set_attr "length" "8")])
-
-
-;; Conditional move insns
-
-(define_expand "movsicc"
- [(set (match_operand:SI 0 "s_register_operand" "")
- (if_then_else:SI (match_operand 1 "comparison_operator" "")
- (match_operand:SI 2 "arm_not_operand" "")
- (match_operand:SI 3 "arm_not_operand" "")))]
- ""
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
- rtx ccreg = gen_compare_reg (code, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-
- operands[1] = gen_rtx (code, VOIDmode, ccreg, const0_rtx);
-}")
-
-(define_expand "movsfcc"
- [(set (match_operand:SF 0 "s_register_operand" "")
- (if_then_else:SF (match_operand 1 "comparison_operator" "")
- (match_operand:SF 2 "s_register_operand" "")
- (match_operand:SF 3 "nonmemory_operand" "")))]
- ""
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
- rtx ccreg = gen_compare_reg (code, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-
- operands[1] = gen_rtx (code, VOIDmode, ccreg, const0_rtx);
-}")
-
-(define_expand "movdfcc"
- [(set (match_operand:DF 0 "s_register_operand" "")
- (if_then_else:DF (match_operand 1 "comparison_operator" "")
- (match_operand:DF 2 "s_register_operand" "")
- (match_operand:DF 3 "nonmemory_operand" "")))]
- "TARGET_HARD_FLOAT"
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
- rtx ccreg = gen_compare_reg (code, arm_compare_op0, arm_compare_op1,
- arm_compare_fp);
-
- operands[1] = gen_rtx (code, VOIDmode, ccreg, const0_rtx);
-}")
-
-(define_insn "*movsicc_insn"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r,r,r")
- (if_then_else:SI
- (match_operator 3 "comparison_operator"
- [(match_operand 4 "cc_register" "") (const_int 0)])
- (match_operand:SI 1 "arm_not_operand" "0,0,?rI,?rI,K,K")
- (match_operand:SI 2 "arm_not_operand" "rI,K,rI,K,rI,K")))]
- ""
- "@
- mov%D3\\t%0, %2
- mvn%D3\\t%0, #%B2
- mov%d3\\t%0, %1\;mov%D3\\t%0, %2
- mov%d3\\t%0, %1\;mvn%D3\\t%0, #%B2
- mvn%d3\\t%0, #%B1\;mov%D3\\t%0, %2
- mvn%d3\\t%0, #%B1\;mvn%D3\\t%0, #%B2"
- [(set_attr "length" "4,4,8,8,8,8")
- (set_attr "conds" "use")])
-
-(define_insn "*movsfcc_hard_insn"
- [(set (match_operand:SF 0 "s_register_operand" "=f,f")
- (if_then_else:SF (match_operator 3 "comparison_operator"
- [(match_operand 4 "cc_register" "") (const_int 0)])
- (match_operand:SF 1 "s_register_operand" "0,0")
- (match_operand:SF 2 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- mvf%D3s\\t%0, %2
- mnf%D3s\\t%0, #%N2"
- [(set_attr "type" "ffarith")
- (set_attr "conds" "use")])
-
-(define_insn "*movsfcc_soft_insn"
- [(set (match_operand:SF 0 "s_register_operand" "=r")
- (if_then_else:SF (match_operator 3 "comparison_operator"
- [(match_operand 4 "cc_register" "") (const_int 0)])
- (match_operand:SF 1 "s_register_operand" "0")
- (match_operand:SF 2 "s_register_operand" "r")))]
- "TARGET_SOFT_FLOAT"
- "mov%D3\\t%0, %2"
- [(set_attr "conds" "use")])
-
-(define_insn "*movdfcc_insn"
- [(set (match_operand:DF 0 "s_register_operand" "=f,f")
- (if_then_else:DF (match_operator 3 "comparison_operator"
- [(match_operand 4 "cc_register" "") (const_int 0)])
- (match_operand:DF 1 "s_register_operand" "0,0")
- (match_operand:DF 2 "fpu_add_operand" "fG,H")))]
- "TARGET_HARD_FLOAT"
- "@
- mvf%D3d\\t%0, %2
- mnf%D3d\\t%0, #%N2"
- [(set_attr "type" "ffarith")
- (set_attr "conds" "use")])
-
-;; Jump and linkage insns
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
-{
- extern int arm_ccfsm_state;
-
- if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2)
- {
- arm_ccfsm_state += 2;
- return \"\";
- }
- return \"b%?\\t%l0\";
-}")
-
-(define_expand "call"
- [(parallel [(call (match_operand 0 "memory_operand" "")
- (match_operand 1 "general_operand" ""))
- (clobber (reg:SI 14))])]
- ""
- "")
-
-(define_insn "*call_reg"
- [(call (mem:SI (match_operand:SI 0 "s_register_operand" "r"))
- (match_operand 1 "" "g"))
- (clobber (reg:SI 14))]
- ""
- "*
- return output_call (operands);
-"
-;; length is worst case, normally it is only two
-[(set_attr "length" "12")
- (set_attr "type" "call")])
-
-(define_insn "*call_mem"
- [(call (mem:SI (match_operand 0 "memory_operand" "m"))
- (match_operand 1 "general_operand" "g"))
- (clobber (reg:SI 14))]
- ""
- "*
- return output_call_mem (operands);
-"
-[(set_attr "length" "12")
- (set_attr "type" "call")])
-
-(define_expand "call_value"
- [(parallel [(set (match_operand 0 "" "=rf")
- (call (match_operand 1 "memory_operand" "m")
- (match_operand 2 "general_operand" "g")))
- (clobber (reg:SI 14))])]
- ""
- "")
-
-(define_insn "*call_value_reg"
- [(set (match_operand 0 "" "=rf")
- (call (mem:SI (match_operand:SI 1 "s_register_operand" "r"))
- (match_operand 2 "general_operand" "g")))
- (clobber (reg:SI 14))]
- ""
- "*
- return output_call (&operands[1]);
-"
-[(set_attr "length" "12")
- (set_attr "type" "call")])
-
-(define_insn "*call_value_mem"
- [(set (match_operand 0 "" "=rf")
- (call (mem:SI (match_operand 1 "memory_operand" "m"))
- (match_operand 2 "general_operand" "g")))
- (clobber (reg:SI 14))]
- "! CONSTANT_ADDRESS_P (XEXP (operands[1], 0))"
- "*
- return output_call_mem (&operands[1]);
-"
-[(set_attr "length" "12")
- (set_attr "type" "call")])
-
-;; Allow calls to SYMBOL_REFs specially as they are not valid general addresses
-;; The 'a' causes the operand to be treated as an address, i.e. no '#' output.
-
-(define_insn "*call_symbol"
- [(call (mem:SI (match_operand:SI 0 "" "X"))
- (match_operand:SI 1 "general_operand" "g"))
- (clobber (reg:SI 14))]
- "GET_CODE (operands[0]) == SYMBOL_REF"
- "bl%?\\t%a0"
-[(set_attr "type" "call")])
-
-(define_insn "*call_value_symbol"
- [(set (match_operand 0 "s_register_operand" "=rf")
- (call (mem:SI (match_operand:SI 1 "" "X"))
- (match_operand:SI 2 "general_operand" "g")))
- (clobber (reg:SI 14))]
- "GET_CODE(operands[1]) == SYMBOL_REF"
- "bl%?\\t%a1"
-[(set_attr "type" "call")])
-
-;; Often the return insn will be the same as loading from memory, so set attr
-(define_insn "return"
- [(return)]
- "USE_RETURN_INSN"
- "*
-{
- extern int arm_ccfsm_state;
-
- if (arm_ccfsm_state == 2)
- {
- arm_ccfsm_state += 2;
- return \"\";
- }
- return output_return_instruction (NULL, TRUE, FALSE);
-}"
-[(set_attr "type" "load")])
-
-(define_insn "*cond_return"
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(match_operand 1 "cc_register" "") (const_int 0)])
- (return)
- (pc)))]
- "USE_RETURN_INSN"
- "*
-{
- extern int arm_ccfsm_state;
-
- if (arm_ccfsm_state == 2)
- {
- arm_ccfsm_state += 2;
- return \"\";
- }
- return output_return_instruction (operands[0], TRUE, FALSE);
-}"
-[(set_attr "conds" "use")
- (set_attr "type" "load")])
-
-(define_insn "*cond_return_inverted"
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(match_operand 1 "cc_register" "") (const_int 0)])
- (pc)
- (return)))]
- "USE_RETURN_INSN"
- "*
-{
- extern int arm_ccfsm_state;
-
- if (arm_ccfsm_state == 2)
- {
- arm_ccfsm_state += 2;
- return \"\";
- }
- return output_return_instruction (operands[0], TRUE, TRUE);
-}"
-[(set_attr "conds" "use")
- (set_attr "type" "load")])
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- ""
-[(set_attr "length" "0")
- (set_attr "type" "block")])
-
-(define_expand "casesi"
- [(match_operand:SI 0 "s_register_operand" "") ; index to jump on
- (match_operand:SI 1 "const_int_operand" "") ; lower bound
- (match_operand:SI 2 "const_int_operand" "") ; total range
- (match_operand:SI 3 "" "") ; table label
- (match_operand:SI 4 "" "")] ; Out of range label
- ""
- "
-{
- rtx reg;
- if (operands[1] != const0_rtx)
- {
- reg = gen_reg_rtx (SImode);
- emit_insn (gen_addsi3 (reg, operands[0],
- GEN_INT (-INTVAL (operands[1]))));
- operands[0] = reg;
- }
-
- if (! const_ok_for_arm (INTVAL (operands[2])))
- operands[2] = force_reg (SImode, operands[2]);
-
- emit_jump_insn (gen_casesi_internal (operands[0], operands[2], operands[3],
- operands[4]));
- DONE;
-}")
-
-(define_insn "casesi_internal"
- [(set (pc)
- (if_then_else
- (leu (match_operand:SI 0 "s_register_operand" "r")
- (match_operand:SI 1 "arm_rhs_operand" "rI"))
- (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
- (label_ref (match_operand 2 "" ""))))
- (label_ref (match_operand 3 "" ""))))]
- ""
- "*
- if (flag_pic)
- return \"cmp\\t%0, %1\;addls\\t%|pc, %|pc, %0, asl #2\;b\\t%l3\";
- return \"cmp\\t%0, %1\;ldrls\\t%|pc, [%|pc, %0, asl #2]\;b\\t%l3\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-(define_insn "indirect_jump"
- [(set (pc)
- (match_operand:SI 0 "s_register_operand" "r"))]
- ""
- "mov%?\\t%|pc, %0\\t%@ indirect jump")
-
-(define_insn "*load_indirect_jump"
- [(set (pc)
- (match_operand:SI 0 "memory_operand" "m"))]
- ""
- "ldr%?\\t%|pc, %0\\t%@ indirect jump"
-[(set_attr "type" "load")])
-
-;; Misc insns
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "mov%?\\tr0, r0\\t%@ nop")
-
-;; Patterns to allow combination of arithmetic, cond code and shifts
-
-(define_insn "*arith_shiftsi"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (match_operator:SI 1 "shiftable_operator"
- [(match_operator:SI 3 "shift_operator"
- [(match_operand:SI 4 "s_register_operand" "r")
- (match_operand:SI 5 "reg_or_int_operand" "rI")])
- (match_operand:SI 2 "s_register_operand" "r")]))]
- ""
- "%i1%?\\t%0, %2, %4%S3")
-
-(define_insn "*arith_shiftsi_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (match_operator:SI 1 "shiftable_operator"
- [(match_operator:SI 3 "shift_operator"
- [(match_operand:SI 4 "s_register_operand" "r")
- (match_operand:SI 5 "reg_or_int_operand" "rI")])
- (match_operand:SI 2 "s_register_operand" "r")])
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (match_op_dup 1 [(match_op_dup 3 [(match_dup 4) (match_dup 5)])
- (match_dup 2)]))]
- ""
- "%i1%?s\\t%0, %2, %4%S3"
-[(set_attr "conds" "set")])
-
-(define_insn "*arith_shiftsi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (match_operator:SI 1 "shiftable_operator"
- [(match_operator:SI 3 "shift_operator"
- [(match_operand:SI 4 "s_register_operand" "r")
- (match_operand:SI 5 "reg_or_int_operand" "rI")])
- (match_operand:SI 2 "s_register_operand" "r")])
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=r"))]
- ""
- "%i1%?s\\t%0, %2, %4%S3"
-[(set_attr "conds" "set")])
-
-(define_insn "*sub_shiftsi"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_operand:SI 1 "s_register_operand" "r")
- (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "reg_or_int_operand" "rM")])))]
- ""
- "sub%?\\t%0, %1, %3%S2")
-
-(define_insn "*sub_shiftsi_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV
- (minus:SI (match_operand:SI 1 "s_register_operand" "r")
- (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "reg_or_int_operand" "rM")]))
- (const_int 0)))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
- (match_dup 4)])))]
- ""
- "sub%?s\\t%0, %1, %3%S2"
-[(set_attr "conds" "set")])
-
-(define_insn "*sub_shiftsi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV
- (minus:SI (match_operand:SI 1 "s_register_operand" "r")
- (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "reg_or_int_operand" "rM")]))
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=r"))]
- ""
- "sub%?s\\t%0, %1, %3%S2"
-[(set_attr "conds" "set")])
-
-;; These variants of the above insns can occur if the first operand is the
-;; frame pointer and we eliminate that. This is a kludge, but there doesn't
-;; seem to be a way around it. Most of the predicates have to be null
-;; because the format can be generated part way through reload, so
-;; if we don't match it as soon as it becomes available, reload doesn't know
-;; how to reload pseudos that haven't got hard registers; the constraints will
-;; sort everything out.
-
-(define_insn "*reload_mulsi3"
- [(set (match_operand:SI 0 "" "=&r")
- (plus:SI (plus:SI (match_operator:SI 5 "shift_operator"
- [(match_operand:SI 3 "" "r")
- (match_operand:SI 4 "" "rM")])
- (match_operand:SI 2 "" "r"))
- (match_operand:SI 1 "const_int_operand" "n")))]
- "reload_in_progress"
- "*
- output_asm_insn (\"add%?\\t%0, %2, %3%S5\", operands);
- operands[2] = operands[1];
- operands[1] = operands[0];
- return output_add_immediate (operands);
-"
-; we have no idea how long the add_immediate is, it could be up to 4.
-[(set_attr "length" "20")])
-
-(define_insn "*reload_mulsi_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (plus:SI
- (plus:SI
- (match_operator:SI 5 "shift_operator"
- [(match_operand:SI 3 "" "r")
- (match_operand:SI 4 "" "rM")])
- (match_operand:SI 1 "" "r"))
- (match_operand:SI 2 "const_int_operand" "n"))
- (const_int 0)))
- (set (match_operand:SI 0 "" "=&r")
- (plus:SI (plus:SI (match_op_dup 5 [(match_dup 3) (match_dup 4)])
- (match_dup 1))
- (match_dup 2)))]
- "reload_in_progress"
- "*
- output_add_immediate (operands);
- return \"add%?s\\t%0, %0, %3%S5\";
-"
-[(set_attr "conds" "set")
- (set_attr "length" "20")])
-
-(define_insn "*reload_mulsi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (plus:SI
- (plus:SI
- (match_operator:SI 5 "shift_operator"
- [(match_operand:SI 3 "" "r")
- (match_operand:SI 4 "" "rM")])
- (match_operand:SI 1 "" "r"))
- (match_operand:SI 2 "const_int_operand" "n"))
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=&r"))]
- "reload_in_progress"
- "*
- output_add_immediate (operands);
- return \"add%?s\\t%0, %0, %3%S5\";
-"
-[(set_attr "conds" "set")
- (set_attr "length" "20")])
-
-;; These are similar, but are needed when the mla pattern contains the
-;; eliminated register as operand 3.
-
-(define_insn "*reload_muladdsi"
- [(set (match_operand:SI 0 "" "=&r,&r")
- (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "" "%0,r")
- (match_operand:SI 2 "" "r,r"))
- (match_operand:SI 3 "" "r,r"))
- (match_operand:SI 4 "const_int_operand" "n,n")))]
- "reload_in_progress"
- "*
- output_asm_insn (\"mla%?\\t%0, %2, %1, %3\", operands);
- operands[2] = operands[4];
- operands[1] = operands[0];
- return output_add_immediate (operands);
-"
-[(set_attr "length" "20")
- (set_attr "type" "mult")])
-
-(define_insn "*reload_muladdsi_compare0"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (plus:SI (plus:SI (mult:SI
- (match_operand:SI 3 "" "r")
- (match_operand:SI 4 "" "r"))
- (match_operand:SI 1 "" "r"))
- (match_operand:SI 2 "const_int_operand" "n"))
- (const_int 0)))
- (set (match_operand:SI 0 "" "=&r")
- (plus:SI (plus:SI (mult:SI (match_dup 3) (match_dup 4)) (match_dup 1))
- (match_dup 2)))]
- "reload_in_progress"
- "*
- output_add_immediate (operands);
- output_asm_insn (\"mla%?s\\t%0, %3, %4, %0\", operands);
- return \"\";
-"
-[(set_attr "length" "20")
- (set_attr "conds" "set")
- (set_attr "type" "mult")])
-
-(define_insn "*reload_muladdsi_compare0_scratch"
- [(set (reg:CC_NOOV 24)
- (compare:CC_NOOV (plus:SI (plus:SI (mult:SI
- (match_operand:SI 3 "" "r")
- (match_operand:SI 4 "" "r"))
- (match_operand:SI 1 "" "r"))
- (match_operand:SI 2 "const_int_operand" "n"))
- (const_int 0)))
- (clobber (match_scratch:SI 0 "=&r"))]
- "reload_in_progress"
- "*
- output_add_immediate (operands);
- return \"mla%?s\\t%0, %3, %4, %0\";
-"
-[(set_attr "length" "20")
- (set_attr "conds" "set")
- (set_attr "type" "mult")])
-
-
-
-(define_insn "*and_scc"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (and:SI (match_operator 1 "comparison_operator"
- [(match_operand 3 "cc_register" "") (const_int 0)])
- (match_operand:SI 2 "s_register_operand" "r")))]
- ""
- "mov%D1\\t%0, #0\;and%d1\\t%0, %2, #1"
-[(set_attr "conds" "use")
- (set_attr "length" "8")])
-
-(define_insn "*ior_scc"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (ior:SI (match_operator 2 "comparison_operator"
- [(match_operand 3 "cc_register" "") (const_int 0)])
- (match_operand:SI 1 "s_register_operand" "0,?r")))]
- ""
- "@
- orr%d2\\t%0, %1, #1
- mov%D2\\t%0, %1\;orr%d2\\t%0, %1, #1"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8")])
-
-(define_insn "*compare_scc"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (match_operator 1 "comparison_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_add_operand" "rI,L")]))
- (clobber (reg 24))]
- ""
- "*
- if (GET_CODE (operands[1]) == LT && operands[3] == const0_rtx)
- return \"mov\\t%0, %2, lsr #31\";
-
- if (GET_CODE (operands[1]) == GE && operands[3] == const0_rtx)
- return \"mvn\\t%0, %2\;mov\\t%0, %0, lsr #31\";
-
- if (GET_CODE (operands[1]) == NE)
- {
- if (which_alternative == 1)
- return \"adds\\t%0, %2, #%n3\;movne\\t%0, #1\";
- return \"subs\\t%0, %2, %3\;movne\\t%0, #1\";
- }
- if (which_alternative == 1)
- output_asm_insn (\"cmn\\t%2, #%n3\", operands);
- else
- output_asm_insn (\"cmp\\t%2, %3\", operands);
- return \"mov%D1\\t%0, #0\;mov%d1\\t%0, #1\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-(define_insn "*cond_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI (match_operator 3 "equality_operator"
- [(match_operator 4 "comparison_operator"
- [(match_operand 5 "cc_register" "") (const_int 0)])
- (const_int 0)])
- (match_operand:SI 1 "arm_rhs_operand" "0,rI,?rI")
- (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))]
- ""
- "*
- if (GET_CODE (operands[3]) == NE)
- {
- if (which_alternative != 1)
- output_asm_insn (\"mov%D4\\t%0, %2\", operands);
- if (which_alternative != 0)
- output_asm_insn (\"mov%d4\\t%0, %1\", operands);
- return \"\";
- }
- if (which_alternative != 0)
- output_asm_insn (\"mov%D4\\t%0, %1\", operands);
- if (which_alternative != 1)
- output_asm_insn (\"mov%d4\\t%0, %2\", operands);
- return \"\";
-"
-[(set_attr "conds" "use")
- (set_attr "length" "4,4,8")])
-
-(define_insn "*cond_arith"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (match_operator:SI 5 "shiftable_operator"
- [(match_operator:SI 4 "comparison_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])
- (match_operand:SI 1 "s_register_operand" "0,?r")]))
- (clobber (reg 24))]
- ""
- "*
- if (GET_CODE (operands[4]) == LT && operands[3] == const0_rtx)
- return \"%i5\\t%0, %1, %2, lsr #31\";
-
- output_asm_insn (\"cmp\\t%2, %3\", operands);
- if (GET_CODE (operands[5]) == AND)
- output_asm_insn (\"mov%D4\\t%0, #0\", operands);
- else if (GET_CODE (operands[5]) == MINUS)
- output_asm_insn (\"rsb%D4\\t%0, %1, #0\", operands);
- else if (which_alternative != 0)
- output_asm_insn (\"mov%D4\\t%0, %1\", operands);
- return \"%i5%d4\\t%0, %1, #1\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-(define_insn "*cond_sub"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (minus:SI (match_operand:SI 1 "s_register_operand" "0,?r")
- (match_operator:SI 4 "comparison_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])))
- (clobber (reg 24))]
- ""
- "*
- output_asm_insn (\"cmp\\t%2, %3\", operands);
- if (which_alternative != 0)
- output_asm_insn (\"mov%D4\\t%0, %1\", operands);
- return \"sub%d4\\t%0, %1, #1\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*cmp_ite0"
- [(set (match_operand 6 "dominant_cc_register" "")
- (compare
- (if_then_else:SI
- (match_operator 4 "comparison_operator"
- [(match_operand:SI 0 "s_register_operand" "r,r,r,r")
- (match_operand:SI 1 "arm_add_operand" "rI,L,rI,L")])
- (match_operator:SI 5 "comparison_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r,r,r")
- (match_operand:SI 3 "arm_add_operand" "rI,rI,L,L")])
- (const_int 0))
- (const_int 0)))]
- ""
- "*
-{
- char* opcodes[4][2] =
- {
- {\"cmp\\t%2, %3\;cmp%d5\\t%0, %1\",\"cmp\\t%0, %1\;cmp%d4\\t%2, %3\"},
- {\"cmp\\t%2, %3\;cmn%d5\\t%0, #%n1\", \"cmn\\t%0, #%n1\;cmp%d4\\t%2, %3\"},
- {\"cmn\\t%2, #%n3\;cmp%d5\\t%0, %1\", \"cmp\\t%0, %1\;cmn%d4\\t%2, #%n3\"},
- {\"cmn\\t%2, #%n3\;cmn%d5\\t%0, #%n1\",
- \"cmn\\t%0, #%n1\;cmn%d4\\t%2, #%n3\"}
- };
- int swap =
- comparison_dominates_p (GET_CODE (operands[5]), GET_CODE (operands[4]));
-
- return opcodes[which_alternative][swap];
-}
-"
-[(set_attr "conds" "set")
- (set_attr "length" "8")])
-
-(define_insn "*cmp_ite1"
- [(set (match_operand 6 "dominant_cc_register" "")
- (compare
- (if_then_else:SI
- (match_operator 4 "comparison_operator"
- [(match_operand:SI 0 "s_register_operand" "r,r,r,r")
- (match_operand:SI 1 "arm_add_operand" "rI,L,rI,L")])
- (match_operator:SI 5 "comparison_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r,r,r")
- (match_operand:SI 3 "arm_add_operand" "rI,rI,L,L")])
- (const_int 1))
- (const_int 0)))]
- ""
- "*
-{
- char* opcodes[4][2] =
- {
- {\"cmp\\t%0, %1\;cmp%d4\\t%2, %3\", \"cmp\\t%2, %3\;cmp%D5\\t%0, %1\"},
- {\"cmn\\t%0, #%n1\;cmp%d4\\t%2, %3\", \"cmp\\t%2, %3\;cmn%D5\\t%0, #%n1\"},
- {\"cmp\\t%0, %1\;cmn%d4\\t%2, #%n3\", \"cmn\\t%2, #%n3\;cmp%D5\\t%0, %1\"},
- {\"cmn\\t%0, #%n1\;cmn%d4\\t%2, #%n3\",
- \"cmn\\t%2, #%n3\;cmn%D5\\t%0, #%n1\"}
- };
- int swap =
- comparison_dominates_p (GET_CODE (operands[5]),
- reverse_condition (GET_CODE (operands[4])));
-
- return opcodes[which_alternative][swap];
-}
-"
-[(set_attr "conds" "set")
- (set_attr "length" "8")])
-
-(define_insn "*negscc"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (neg:SI (match_operator 3 "comparison_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rI")])))
- (clobber (reg 24))]
- ""
- "*
- if (GET_CODE (operands[3]) == LT && operands[3] == const0_rtx)
- return \"mov\\t%0, %1, asr #31\";
-
- if (GET_CODE (operands[3]) == NE)
- return \"subs\\t%0, %1, %2\;mvnne\\t%0, #0\";
-
- if (GET_CODE (operands[3]) == GT)
- return \"subs\\t%0, %1, %2\;mvnne\\t%0, %0, asr #31\";
-
- output_asm_insn (\"cmp\\t%1, %2\", operands);
- output_asm_insn (\"mov%D3\\t%0, #0\", operands);
- return \"mvn%d3\\t%0, #0\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-(define_insn "movcond"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand:SI 3 "s_register_operand" "r,r,r")
- (match_operand:SI 4 "arm_add_operand" "rIL,rIL,rIL")])
- (match_operand:SI 1 "arm_rhs_operand" "0,rI,?rI")
- (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
- (clobber (reg 24))]
- ""
- "*
- if (GET_CODE (operands[5]) == LT
- && (operands[4] == const0_rtx))
- {
- if (which_alternative != 1 && GET_CODE (operands[1]) == REG)
- {
- if (operands[2] == const0_rtx)
- return \"and\\t%0, %1, %3, asr #31\";
- return \"ands\\t%0, %1, %3, asr #32\;movcc\\t%0, %2\";
- }
- else if (which_alternative != 0 && GET_CODE (operands[2]) == REG)
- {
- if (operands[1] == const0_rtx)
- return \"bic\\t%0, %2, %3, asr #31\";
- return \"bics\\t%0, %2, %3, asr #32\;movcs\\t%0, %1\";
- }
- /* The only case that falls through to here is when both ops 1 & 2
- are constants */
- }
-
- if (GET_CODE (operands[5]) == GE
- && (operands[4] == const0_rtx))
- {
- if (which_alternative != 1 && GET_CODE (operands[1]) == REG)
- {
- if (operands[2] == const0_rtx)
- return \"bic\\t%0, %1, %3, asr #31\";
- return \"bics\\t%0, %1, %3, asr #32\;movcs\\t%0, %2\";
- }
- else if (which_alternative != 0 && GET_CODE (operands[2]) == REG)
- {
- if (operands[1] == const0_rtx)
- return \"and\\t%0, %2, %3, asr #31\";
- return \"ands\\t%0, %2, %3, asr #32\;movcc\\t%0, %1\";
- }
- /* The only case that falls through to here is when both ops 1 & 2
- are constants */
- }
- if (GET_CODE (operands[4]) == CONST_INT
- && !const_ok_for_arm (INTVAL (operands[4])))
- output_asm_insn (\"cmn\\t%3, #%n4\", operands);
- else
- output_asm_insn (\"cmp\\t%3, %4\", operands);
- if (which_alternative != 0)
- output_asm_insn (\"mov%d5\\t%0, %1\", operands);
- if (which_alternative != 1)
- output_asm_insn (\"mov%D5\\t%0, %2\", operands);
- return \"\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,8,12")])
-
-(define_insn "*ifcompare_plus_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI (match_operator 6 "comparison_operator"
- [(match_operand:SI 4 "s_register_operand" "r,r")
- (match_operand:SI 5 "arm_add_operand" "rIL,rIL")])
- (plus:SI
- (match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_add_operand" "rIL,rIL"))
- (match_operand:SI 1 "arm_rhsm_operand" "0,?rIm")))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_plus_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r,r,r")
- (if_then_else:SI
- (match_operator 4 "comparison_operator"
- [(match_operand 5 "cc_register" "") (const_int 0)])
- (plus:SI
- (match_operand:SI 2 "s_register_operand" "r,r,r,r,r,r")
- (match_operand:SI 3 "arm_add_operand" "rI,L,rI,L,rI,L"))
- (match_operand:SI 1 "arm_rhsm_operand" "0,0,?rI,?rI,m,m")))]
- ""
- "@
- add%d4\\t%0, %2, %3
- sub%d4\\t%0, %2, #%n3
- add%d4\\t%0, %2, %3\;mov%D4\\t%0, %1
- sub%d4\\t%0, %2, #%n3\;mov%D4\\t%0, %1
- add%d4\\t%0, %2, %3\;ldr%D4\\t%0, %1
- sub%d4\\t%0, %2, #%n3\;ldr%D4\\t%0, %1"
-[(set_attr "conds" "use")
- (set_attr "length" "4,4,8,8,8,8")
- (set_attr "type" "*,*,*,*,load,load")])
-
-(define_insn "*ifcompare_move_plus"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI (match_operator 6 "comparison_operator"
- [(match_operand:SI 4 "s_register_operand" "r,r")
- (match_operand:SI 5 "arm_add_operand" "rIL,rIL")])
- (match_operand:SI 1 "arm_rhsm_operand" "0,?rIm")
- (plus:SI
- (match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_add_operand" "rIL,rIL"))))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_move_plus"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r,r,r")
- (if_then_else:SI
- (match_operator 4 "comparison_operator"
- [(match_operand 5 "cc_register" "") (const_int 0)])
- (match_operand:SI 1 "arm_rhsm_operand" "0,0,?rI,?rI,m,m")
- (plus:SI
- (match_operand:SI 2 "s_register_operand" "r,r,r,r,r,r")
- (match_operand:SI 3 "arm_add_operand" "rI,L,rI,L,rI,L"))))]
- ""
- "@
- add%D4\\t%0, %2, %3
- sub%D4\\t%0, %2, #%n3
- add%D4\\t%0, %2, %3\;mov%d4\\t%0, %1
- sub%D4\\t%0, %2, #%n3\;mov%d4\\t%0, %1
- add%D4\\t%0, %2, %3\;ldr%d4\\t%0, %1
- sub%D4\\t%0, %2, #%n3\;ldr%d4\\t%0, %1"
-[(set_attr "conds" "use")
- (set_attr "length" "4,4,8,8,8,8")
- (set_attr "type" "*,*,*,*,load,load")])
-
-(define_insn "*ifcompare_arith_arith"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (if_then_else:SI (match_operator 9 "comparison_operator"
- [(match_operand:SI 5 "s_register_operand" "r")
- (match_operand:SI 6 "arm_add_operand" "rIL")])
- (match_operator:SI 8 "shiftable_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rI")])
- (match_operator:SI 7 "shiftable_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "arm_rhs_operand" "rI")])))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-(define_insn "*if_arith_arith"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (if_then_else:SI (match_operator 5 "comparison_operator"
- [(match_operand 8 "cc_register" "") (const_int 0)])
- (match_operator:SI 6 "shiftable_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rI")])
- (match_operator:SI 7 "shiftable_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "arm_rhs_operand" "rI")])))]
- ""
- "%I6%d5\\t%0, %1, %2\;%I7%D5\\t%0, %3, %4"
-[(set_attr "conds" "use")
- (set_attr "length" "8")])
-
-(define_insn "*ifcompare_arith_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI (match_operator 6 "comparison_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_add_operand" "rIL,rIL")])
- (match_operator:SI 7 "shiftable_operator"
- [(match_operand:SI 4 "s_register_operand" "r,r")
- (match_operand:SI 5 "arm_rhs_operand" "rI,rI")])
- (match_operand:SI 1 "arm_rhsm_operand" "0,?rIm")))
- (clobber (reg 24))]
- ""
- "*
- /* If we have an operation where (op x 0) is the identity operation and
- the conditional operator is LT or GE and we are comparing against zero and
- everything is in registers then we can do this in two instructions */
- if (operands[3] == const0_rtx
- && GET_CODE (operands[7]) != AND
- && GET_CODE (operands[5]) == REG
- && GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) == REGNO (operands[4])
- && REGNO (operands[4]) != REGNO (operands[0]))
- {
- if (GET_CODE (operands[6]) == LT)
- return \"and\\t%0, %5, %2, asr #31\;%I7\\t%0, %4, %0\";
- else if (GET_CODE (operands[6]) == GE)
- return \"bic\\t%0, %5, %2, asr #31\;%I7\\t%0, %4, %0\";
- }
- if (GET_CODE (operands[3]) == CONST_INT
- && !const_ok_for_arm (INTVAL (operands[3])))
- output_asm_insn (\"cmn\\t%2, #%n3\", operands);
- else
- output_asm_insn (\"cmp\\t%2, %3\", operands);
- output_asm_insn (\"%I7%d6\\t%0, %4, %5\", operands);
- if (which_alternative != 0)
- {
- if (GET_CODE (operands[1]) == MEM)
- return \"ldr%D6\\t%0, %1\";
- else
- return \"mov%D6\\t%0, %1\";
- }
- return \"\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_arith_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI (match_operator 4 "comparison_operator"
- [(match_operand 6 "cc_register" "") (const_int 0)])
- (match_operator:SI 5 "shiftable_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rI,rI,rI")])
- (match_operand:SI 1 "arm_rhsm_operand" "0,?rI,m")))]
- ""
- "@
- %I5%d4\\t%0, %2, %3
- %I5%d4\\t%0, %2, %3\;mov%D4\\t%0, %1
- %I5%d4\\t%0, %2, %3\;ldr%D4\\t%0, %1"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8,8")
- (set_attr "type" "*,*,load")])
-
-(define_insn "*ifcompare_move_arith"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI (match_operator 6 "comparison_operator"
- [(match_operand:SI 4 "s_register_operand" "r,r")
- (match_operand:SI 5 "arm_add_operand" "rIL,rIL")])
- (match_operand:SI 1 "arm_rhsm_operand" "0,?rIm")
- (match_operator:SI 7 "shiftable_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])))
- (clobber (reg 24))]
- ""
- "*
- /* If we have an operation where (op x 0) is the identity operation and
- the conditional operator is LT or GE and we are comparing against zero and
- everything is in registers then we can do this in two instructions */
- if (operands[5] == const0_rtx
- && GET_CODE (operands[7]) != AND
- && GET_CODE (operands[3]) == REG
- && GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) == REGNO (operands[2])
- && REGNO (operands[2]) != REGNO (operands[0]))
- {
- if (GET_CODE (operands[6]) == GE)
- return \"and\\t%0, %3, %4, asr #31\;%I7\\t%0, %2, %0\";
- else if (GET_CODE (operands[6]) == LT)
- return \"bic\\t%0, %3, %4, asr #31\;%I7\\t%0, %2, %0\";
- }
-
- if (GET_CODE (operands[5]) == CONST_INT
- && !const_ok_for_arm (INTVAL (operands[5])))
- output_asm_insn (\"cmn\\t%4, #%n5\", operands);
- else
- output_asm_insn (\"cmp\\t%4, %5\", operands);
-
- if (which_alternative != 0)
- {
- if (GET_CODE (operands[1]) == MEM)
- output_asm_insn (\"ldr%d6\\t%0, %1\", operands);
- else
- output_asm_insn (\"mov%d6\\t%0, %1\", operands);
- }
- return \"%I7%D6\\t%0, %2, %3\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_move_arith"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI
- (match_operator 4 "comparison_operator"
- [(match_operand 6 "cc_register" "") (const_int 0)])
- (match_operand:SI 1 "arm_rhsm_operand" "0,?rI,m")
- (match_operator:SI 5 "shiftable_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rI,rI,rI")])))]
- ""
- "@
- %I5%D4\\t%0, %2, %3
- %I5%D4\\t%0, %2, %3\;mov%d4\\t%0, %1
- %I5%D4\\t%0, %2, %3\;ldr%d4\\t%0, %1"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8,8")
- (set_attr "type" "*,*,load")])
-
-(define_insn "*ifcompare_move_not"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand:SI 3 "s_register_operand" "r,r")
- (match_operand:SI 4 "arm_add_operand" "rIL,rIL")])
- (match_operand:SI 1 "arm_not_operand" "0,?rIK")
- (not:SI
- (match_operand:SI 2 "s_register_operand" "r,r"))))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_move_not"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI
- (match_operator 4 "comparison_operator"
- [(match_operand 3 "cc_register" "") (const_int 0)])
- (match_operand:SI 1 "arm_not_operand" "0,?rI,K")
- (not:SI (match_operand:SI 2 "s_register_operand" "r,r,r"))))]
- ""
- "@
- mvn%D4\\t%0, %2
- mov%d4\\t%0, %1\;mvn%D4\\t%0, %2
- mvn%d4\\t%0, #%B1\;mvn%D4\\t%0, %2"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8,8")])
-
-(define_insn "*ifcompare_not_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand:SI 3 "s_register_operand" "r,r")
- (match_operand:SI 4 "arm_add_operand" "rIL,rIL")])
- (not:SI
- (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:SI 1 "arm_not_operand" "0,?rIK")))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_not_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI
- (match_operator 4 "comparison_operator"
- [(match_operand 3 "cc_register" "") (const_int 0)])
- (not:SI (match_operand:SI 2 "s_register_operand" "r,r,r"))
- (match_operand:SI 1 "arm_not_operand" "0,?rI,K")))]
- ""
- "@
- mvn%d4\\t%0, %2
- mov%D4\\t%0, %1\;mvn%d4\\t%0, %2
- mvn%D4\\t%0, #%B1\;mvn%d4\\t%0, %2"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8,8")])
-
-(define_insn "*ifcompare_shift_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI
- (match_operator 6 "comparison_operator"
- [(match_operand:SI 4 "s_register_operand" "r,r")
- (match_operand:SI 5 "arm_add_operand" "rIL,rIL")])
- (match_operator:SI 7 "shift_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rM,rM")])
- (match_operand:SI 1 "arm_not_operand" "0,?rIK")))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_shift_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand 6 "cc_register" "") (const_int 0)])
- (match_operator:SI 4 "shift_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rM,rM,rM")])
- (match_operand:SI 1 "arm_not_operand" "0,?rI,K")))]
- ""
- "@
- mov%d5\\t%0, %2%S4
- mov%D5\\t%0, %1\;mov%d5\\t%0, %2%S4
- mvn%D5\\t%0, #%B1\;mov%d5\\t%0, %2%S4"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8,8")])
-
-(define_insn "*ifcompare_move_shift"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI
- (match_operator 6 "comparison_operator"
- [(match_operand:SI 4 "s_register_operand" "r,r")
- (match_operand:SI 5 "arm_add_operand" "rIL,rIL")])
- (match_operand:SI 1 "arm_not_operand" "0,?rIK")
- (match_operator:SI 7 "shift_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rM,rM")])))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_move_shift"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand 6 "cc_register" "") (const_int 0)])
- (match_operand:SI 1 "arm_not_operand" "0,?rI,K")
- (match_operator:SI 4 "shift_operator"
- [(match_operand:SI 2 "s_register_operand" "r,r,r")
- (match_operand:SI 3 "arm_rhs_operand" "rM,rM,rM")])))]
- ""
- "@
- mov%D5\\t%0, %2%S4
- mov%d5\\t%0, %1\;mov%D5\\t%0, %2%S4
- mvn%d5\\t%0, #%B1\;mov%D5\\t%0, %2%S4"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8,8")])
-
-(define_insn "*ifcompare_shift_shift"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (if_then_else:SI
- (match_operator 7 "comparison_operator"
- [(match_operand:SI 5 "s_register_operand" "r")
- (match_operand:SI 6 "arm_add_operand" "rIL")])
- (match_operator:SI 8 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rM")])
- (match_operator:SI 9 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "arm_rhs_operand" "rM")])))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-(define_insn "*if_shift_shift"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand 8 "cc_register" "") (const_int 0)])
- (match_operator:SI 6 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "r")
- (match_operand:SI 2 "arm_rhs_operand" "rM")])
- (match_operator:SI 7 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "arm_rhs_operand" "rM")])))]
- ""
- "mov%d5\\t%0, %1%S6\;mov%D5\\t%0, %3%S7"
-[(set_attr "conds" "use")
- (set_attr "length" "8")])
-
-(define_insn "*ifcompare_not_arith"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (if_then_else:SI
- (match_operator 6 "comparison_operator"
- [(match_operand:SI 4 "s_register_operand" "r")
- (match_operand:SI 5 "arm_add_operand" "rIL")])
- (not:SI (match_operand:SI 1 "s_register_operand" "r"))
- (match_operator:SI 7 "shiftable_operator"
- [(match_operand:SI 2 "s_register_operand" "r")
- (match_operand:SI 3 "arm_rhs_operand" "rI")])))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-(define_insn "*if_not_arith"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand 4 "cc_register" "") (const_int 0)])
- (not:SI (match_operand:SI 1 "s_register_operand" "r"))
- (match_operator:SI 6 "shiftable_operator"
- [(match_operand:SI 2 "s_register_operand" "r")
- (match_operand:SI 3 "arm_rhs_operand" "rI")])))]
- ""
- "mvn%d5\\t%0, %1\;%I6%D5\\t%0, %2, %3"
-[(set_attr "conds" "use")
- (set_attr "length" "8")])
-
-(define_insn "*ifcompare_arith_not"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (if_then_else:SI
- (match_operator 6 "comparison_operator"
- [(match_operand:SI 4 "s_register_operand" "r")
- (match_operand:SI 5 "arm_add_operand" "rIL")])
- (match_operator:SI 7 "shiftable_operator"
- [(match_operand:SI 2 "s_register_operand" "r")
- (match_operand:SI 3 "arm_rhs_operand" "rI")])
- (not:SI (match_operand:SI 1 "s_register_operand" "r"))))
- (clobber (reg 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-(define_insn "*if_arith_not"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand 4 "cc_register" "") (const_int 0)])
- (match_operator:SI 6 "shiftable_operator"
- [(match_operand:SI 2 "s_register_operand" "r")
- (match_operand:SI 3 "arm_rhs_operand" "rI")])
- (not:SI (match_operand:SI 1 "s_register_operand" "r"))))]
- ""
- "mvn%D5\\t%0, %1\;%I6%d5\\t%0, %2, %3"
-[(set_attr "conds" "use")
- (set_attr "length" "8")])
-
-(define_insn "*ifcompare_neg_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand:SI 3 "s_register_operand" "r,r")
- (match_operand:SI 4 "arm_add_operand" "rIL,rIL")])
- (neg:SI (match_operand:SI 2 "s_register_operand" "r,r"))
- (match_operand:SI 1 "arm_not_operand" "0,?rIK")))
- (clobber (reg:CC 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_neg_move"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI
- (match_operator 4 "comparison_operator"
- [(match_operand 3 "cc_register" "") (const_int 0)])
- (neg:SI (match_operand:SI 2 "s_register_operand" "r,r,r"))
- (match_operand:SI 1 "arm_not_operand" "0,?rI,K")))]
- ""
- "@
- rsb%d4\\t%0, %2, #0
- mov%D4\\t%0, %1\;rsb%d4\\t%0, %2, #0
- mvn%D4\\t%0, #%B1\;rsb%d4\\t%0, %2, #0"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8,8")])
-
-(define_insn "*ifcompare_move_neg"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand:SI 3 "s_register_operand" "r,r")
- (match_operand:SI 4 "arm_add_operand" "rIL,rIL")])
- (match_operand:SI 1 "arm_not_operand" "0,?rIK")
- (neg:SI (match_operand:SI 2 "s_register_operand" "r,r"))))
- (clobber (reg:CC 24))]
- ""
- "#"
-[(set_attr "conds" "clob")
- (set_attr "length" "8,12")])
-
-(define_insn "*if_move_neg"
- [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
- (if_then_else:SI
- (match_operator 4 "comparison_operator"
- [(match_operand 3 "cc_register" "") (const_int 0)])
- (match_operand:SI 1 "arm_not_operand" "0,?rI,K")
- (neg:SI (match_operand:SI 2 "s_register_operand" "r,r,r"))))]
- ""
- "@
- rsb%D4\\t%0, %2, #0
- mov%d4\\t%0, %1\;rsb%D4\\t%0, %2, #0
- mvn%d4\\t%0, #%B1\;rsb%D4\\t%0, %2, #0"
-[(set_attr "conds" "use")
- (set_attr "length" "4,8,8")])
-
-(define_insn "*arith_adjacentmem"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (match_operator:SI 1 "shiftable_operator"
- [(match_operand:SI 2 "memory_operand" "m")
- (match_operand:SI 3 "memory_operand" "m")]))
- (clobber (match_scratch:SI 4 "=r"))]
- "adjacent_mem_locations (operands[2], operands[3])"
- "*
-{
- rtx ldm[3];
- rtx arith[4];
- int val1 = 0, val2 = 0;
-
- if (REGNO (operands[0]) > REGNO (operands[4]))
- {
- ldm[1] = operands[4];
- ldm[2] = operands[0];
- }
- else
- {
- ldm[1] = operands[0];
- ldm[2] = operands[4];
- }
- if (GET_CODE (XEXP (operands[2], 0)) != REG)
- val1 = INTVAL (XEXP (XEXP (operands[2], 0), 1));
- if (GET_CODE (XEXP (operands[3], 0)) != REG)
- val2 = INTVAL (XEXP (XEXP (operands[3], 0), 1));
- arith[0] = operands[0];
- arith[3] = operands[1];
- if (val1 < val2)
- {
- arith[1] = ldm[1];
- arith[2] = ldm[2];
- }
- else
- {
- arith[1] = ldm[2];
- arith[2] = ldm[1];
- }
- if (val1 && val2)
- {
- rtx ops[3];
- ldm[0] = ops[0] = operands[4];
- ops[1] = XEXP (XEXP (operands[2], 0), 0);
- ops[2] = XEXP (XEXP (operands[2], 0), 1);
- output_add_immediate (ops);
- if (val1 < val2)
- output_asm_insn (\"ldm%?ia\\t%0, {%1, %2}\", ldm);
- else
- output_asm_insn (\"ldm%?da\\t%0, {%1, %2}\", ldm);
- }
- else if (val1)
- {
- ldm[0] = XEXP (operands[3], 0);
- if (val1 < val2)
- output_asm_insn (\"ldm%?da\\t%0, {%1, %2}\", ldm);
- else
- output_asm_insn (\"ldm%?ia\\t%0, {%1, %2}\", ldm);
- }
- else
- {
- ldm[0] = XEXP (operands[2], 0);
- if (val1 < val2)
- output_asm_insn (\"ldm%?ia\\t%0, {%1, %2}\", ldm);
- else
- output_asm_insn (\"ldm%?da\\t%0, {%1, %2}\", ldm);
- }
- output_asm_insn (\"%I3%?\\t%0, %1, %2\", arith);
- return \"\";
-}
-"
-[(set_attr "length" "12")
- (set_attr "type" "load")])
-
-;; the arm can support extended pre-inc instructions
-
-;; In all these cases, we use operands 0 and 1 for the register being
-;; incremented because those are the operands that local-alloc will
-;; tie and these are the pair most likely to be tieable (and the ones
-;; that will benefit the most).
-
-;; We reject the frame pointer if it occurs anywhere in these patterns since
-;; elimination will cause too many headaches.
-
-(define_insn "*strqi_preinc"
- [(set (mem:QI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
- (match_operand:SI 2 "index_operand" "rJ")))
- (match_operand:QI 3 "s_register_operand" "r"))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "str%?b\\t%3, [%0, %2]!"
-[(set_attr "type" "store1")])
-
-(define_insn "*strqi_predec"
- [(set (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operand:SI 2 "s_register_operand" "r")))
- (match_operand:QI 3 "s_register_operand" "r"))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "str%?b\\t%3, [%0, -%2]!"
-[(set_attr "type" "store1")])
-
-(define_insn "*loadqi_preinc"
- [(set (match_operand:QI 3 "s_register_operand" "=r")
- (mem:QI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
- (match_operand:SI 2 "index_operand" "rJ"))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "ldr%?b\\t%3, [%0, %2]!"
-[(set_attr "type" "load")])
-
-(define_insn "*loadqi_predec"
- [(set (match_operand:QI 3 "s_register_operand" "=r")
- (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operand:SI 2 "s_register_operand" "r"))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "ldr%?b\\t%3, [%0, -%2]!"
-[(set_attr "type" "load")])
-
-(define_insn "*loadqisi_preinc"
- [(set (match_operand:SI 3 "s_register_operand" "=r")
- (zero_extend:SI
- (mem:QI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
- (match_operand:SI 2 "index_operand" "rJ")))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "ldr%?b\\t%3, [%0, %2]!\\t%@ z_extendqisi"
-[(set_attr "type" "load")])
-
-(define_insn "*loadqisi_predec"
- [(set (match_operand:SI 3 "s_register_operand" "=r")
- (zero_extend:SI
- (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operand:SI 2 "s_register_operand" "r")))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "ldr%?b\\t%3, [%0, -%2]!\\t%@ z_extendqisi"
-[(set_attr "type" "load")])
-
-(define_insn "*strsi_preinc"
- [(set (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
- (match_operand:SI 2 "index_operand" "rJ")))
- (match_operand:SI 3 "s_register_operand" "r"))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "str%?\\t%3, [%0, %2]!"
-[(set_attr "type" "store1")])
-
-(define_insn "*strqi_predec"
- [(set (mem:SI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operand:SI 2 "s_register_operand" "r")))
- (match_operand:SI 3 "s_register_operand" "r"))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "str%?\\t%3, [%0, -%2]!"
-[(set_attr "type" "store1")])
-
-(define_insn "*loadsi_preinc"
- [(set (match_operand:SI 3 "s_register_operand" "=r")
- (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
- (match_operand:SI 2 "index_operand" "rJ"))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "ldr%?\\t%3, [%0, %2]!"
-[(set_attr "type" "load")])
-
-(define_insn "*loadsi_predec"
- [(set (match_operand:SI 3 "s_register_operand" "=r")
- (mem:SI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operand:SI 2 "s_register_operand" "r"))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "ldr%?\\t%3, [%0, -%2]!"
-[(set_attr "type" "load")])
-
-(define_insn "*loadhi_preinc"
- [(set (match_operand:HI 3 "s_register_operand" "=r")
- (mem:HI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
- (match_operand:SI 2 "index_operand" "rJ"))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "(! BYTES_BIG_ENDIAN)
- && ! TARGET_SHORT_BY_BYTES
- && REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "ldr%?\\t%3, [%0, %2]!\\t%@ loadhi"
-[(set_attr "type" "load")])
-
-(define_insn "*loadhi_predec"
- [(set (match_operand:HI 3 "s_register_operand" "=r")
- (mem:HI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operand:SI 2 "s_register_operand" "r"))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- "(!BYTES_BIG_ENDIAN)
- && ! TARGET_SHORT_BY_BYTES
- && REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && (GET_CODE (operands[2]) != REG
- || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
- "ldr%?\\t%3, [%0, -%2]!\\t%@ loadhi"
-[(set_attr "type" "load")])
-
-(define_insn "*strqi_shiftpreinc"
- [(set (mem:QI (plus:SI (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")])
- (match_operand:SI 1 "s_register_operand" "0")))
- (match_operand:QI 5 "s_register_operand" "r"))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_op_dup 2 [(match_dup 3) (match_dup 4)])
- (match_dup 1)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "str%?b\\t%5, [%0, %3%S2]!"
-[(set_attr "type" "store1")])
-
-(define_insn "*strqi_shiftpredec"
- [(set (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")])))
- (match_operand:QI 5 "s_register_operand" "r"))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
- (match_dup 4)])))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "str%?b\\t%5, [%0, -%3%S2]!"
-[(set_attr "type" "store1")])
-
-(define_insn "*loadqi_shiftpreinc"
- [(set (match_operand:QI 5 "s_register_operand" "=r")
- (mem:QI (plus:SI (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")])
- (match_operand:SI 1 "s_register_operand" "0"))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_op_dup 2 [(match_dup 3) (match_dup 4)])
- (match_dup 1)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "ldr%?b\\t%5, [%0, %3%S2]!"
-[(set_attr "type" "load")])
-
-(define_insn "*loadqi_shiftpredec"
- [(set (match_operand:QI 5 "s_register_operand" "=r")
- (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")]))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
- (match_dup 4)])))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "ldr%?b\\t%5, [%0, -%3%S2]!"
-[(set_attr "type" "load")])
-
-(define_insn "*strsi_shiftpreinc"
- [(set (mem:SI (plus:SI (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")])
- (match_operand:SI 1 "s_register_operand" "0")))
- (match_operand:SI 5 "s_register_operand" "r"))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_op_dup 2 [(match_dup 3) (match_dup 4)])
- (match_dup 1)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "str%?\\t%5, [%0, %3%S2]!"
-[(set_attr "type" "store1")])
-
-(define_insn "*strsi_shiftpredec"
- [(set (mem:SI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")])))
- (match_operand:SI 5 "s_register_operand" "r"))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
- (match_dup 4)])))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "str%?\\t%5, [%0, -%3%S2]!"
-[(set_attr "type" "store1")])
-
-(define_insn "*loadqi_shiftpreinc"
- [(set (match_operand:SI 5 "s_register_operand" "=r")
- (mem:SI (plus:SI (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")])
- (match_operand:SI 1 "s_register_operand" "0"))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_op_dup 2 [(match_dup 3) (match_dup 4)])
- (match_dup 1)))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "ldr%?\\t%5, [%0, %3%S2]!"
-[(set_attr "type" "load")])
-
-(define_insn "*loadqi_shiftpredec"
- [(set (match_operand:SI 5 "s_register_operand" "=r")
- (mem:SI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")]))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
- (match_dup 4)])))]
- "REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "ldr%?\\t%5, [%0, -%3%S2]!"
-[(set_attr "type" "load")])
-
-(define_insn "*loadhi_shiftpreinc"
- [(set (match_operand:HI 5 "s_register_operand" "=r")
- (mem:HI (plus:SI (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")])
- (match_operand:SI 1 "s_register_operand" "0"))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (plus:SI (match_op_dup 2 [(match_dup 3) (match_dup 4)])
- (match_dup 1)))]
- "(! BYTES_BIG_ENDIAN)
- && ! TARGET_SHORT_BY_BYTES
- && REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "ldr%?\\t%5, [%0, %3%S2]!\\t%@ loadhi"
-[(set_attr "type" "load")])
-
-(define_insn "*loadhi_shiftpredec"
- [(set (match_operand:HI 5 "s_register_operand" "=r")
- (mem:HI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
- (match_operator:SI 2 "shift_operator"
- [(match_operand:SI 3 "s_register_operand" "r")
- (match_operand:SI 4 "const_shift_operand" "n")]))))
- (set (match_operand:SI 0 "s_register_operand" "=r")
- (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
- (match_dup 4)])))]
- "(! BYTES_BIG_ENDIAN)
- && ! TARGET_SHORT_BY_BYTES
- && REGNO (operands[0]) != FRAME_POINTER_REGNUM
- && REGNO (operands[1]) != FRAME_POINTER_REGNUM
- && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
- "ldr%?\\t%5, [%0, -%3%S2]!\\t%@ loadhi"
-[(set_attr "type" "load")])
-
-; It can also support extended post-inc expressions, but combine doesn't
-; try these....
-; It doesn't seem worth adding peepholes for anything but the most common
-; cases since, unlike combine, the increment must immediately follow the load
-; for this pattern to match.
-; When loading we must watch to see that the base register isn't trampled by
-; the load. In such cases this isn't a post-inc expression.
-
-(define_peephole
- [(set (mem:QI (match_operand:SI 0 "s_register_operand" "+r"))
- (match_operand:QI 2 "s_register_operand" "r"))
- (set (match_dup 0)
- (plus:SI (match_dup 0) (match_operand:SI 1 "index_operand" "rJ")))]
- ""
- "str%?b\\t%2, [%0], %1")
-
-(define_peephole
- [(set (match_operand:QI 0 "s_register_operand" "=r")
- (mem:QI (match_operand:SI 1 "s_register_operand" "+r")))
- (set (match_dup 1)
- (plus:SI (match_dup 1) (match_operand:SI 2 "index_operand" "rJ")))]
- "REGNO(operands[0]) != REGNO(operands[1])
- && (GET_CODE (operands[2]) != REG
- || REGNO(operands[0]) != REGNO (operands[2]))"
- "ldr%?b\\t%0, [%1], %2")
-
-(define_peephole
- [(set (mem:SI (match_operand:SI 0 "s_register_operand" "+r"))
- (match_operand:SI 2 "s_register_operand" "r"))
- (set (match_dup 0)
- (plus:SI (match_dup 0) (match_operand:SI 1 "index_operand" "rJ")))]
- ""
- "str%?\\t%2, [%0], %1")
-
-(define_peephole
- [(set (match_operand:HI 0 "s_register_operand" "=r")
- (mem:HI (match_operand:SI 1 "s_register_operand" "+r")))
- (set (match_dup 1)
- (plus:SI (match_dup 1) (match_operand:SI 2 "index_operand" "rJ")))]
- "(! BYTES_BIG_ENDIAN)
- && ! TARGET_SHORT_BY_BYTES
- && REGNO(operands[0]) != REGNO(operands[1])
- && (GET_CODE (operands[2]) != REG
- || REGNO(operands[0]) != REGNO (operands[2]))"
- "ldr%?\\t%0, [%1], %2\\t%@ loadhi")
-
-(define_peephole
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (mem:SI (match_operand:SI 1 "s_register_operand" "+r")))
- (set (match_dup 1)
- (plus:SI (match_dup 1) (match_operand:SI 2 "index_operand" "rJ")))]
- "REGNO(operands[0]) != REGNO(operands[1])
- && (GET_CODE (operands[2]) != REG
- || REGNO(operands[0]) != REGNO (operands[2]))"
- "ldr%?\\t%0, [%1], %2")
-
-(define_peephole
- [(set (mem:QI (plus:SI (match_operand:SI 0 "s_register_operand" "+r")
- (match_operand:SI 1 "index_operand" "rJ")))
- (match_operand:QI 2 "s_register_operand" "r"))
- (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))]
- ""
- "str%?b\\t%2, [%0, %1]!")
-
-(define_peephole
- [(set (mem:QI (plus:SI (match_operator:SI 4 "shift_operator"
- [(match_operand:SI 0 "s_register_operand" "r")
- (match_operand:SI 1 "const_int_operand" "n")])
- (match_operand:SI 2 "s_register_operand" "+r")))
- (match_operand:QI 3 "s_register_operand" "r"))
- (set (match_dup 2) (plus:SI (match_op_dup 4 [(match_dup 0) (match_dup 1)])
- (match_dup 2)))]
- ""
- "str%?b\\t%3, [%2, %0%S4]!")
-
-; This pattern is never tried by combine, so do it as a peephole
-
-(define_peephole
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (match_operand:SI 1 "s_register_operand" "r"))
- (set (reg:CC 24)
- (compare:CC (match_dup 1) (const_int 0)))]
- ""
- "sub%?s\\t%0, %1, #0"
-[(set_attr "conds" "set")])
-
-; Peepholes to spot possible load- and store-multiples, if the ordering is
-; reversed, check that the memory references aren't volatile.
-
-(define_peephole
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (match_operand:SI 4 "memory_operand" "m"))
- (set (match_operand:SI 1 "s_register_operand" "=r")
- (match_operand:SI 5 "memory_operand" "m"))
- (set (match_operand:SI 2 "s_register_operand" "=r")
- (match_operand:SI 6 "memory_operand" "m"))
- (set (match_operand:SI 3 "s_register_operand" "=r")
- (match_operand:SI 7 "memory_operand" "m"))]
- "load_multiple_sequence (operands, 4, NULL, NULL, NULL)"
- "*
- return emit_ldm_seq (operands, 4);
-")
-
-(define_peephole
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (match_operand:SI 3 "memory_operand" "m"))
- (set (match_operand:SI 1 "s_register_operand" "=r")
- (match_operand:SI 4 "memory_operand" "m"))
- (set (match_operand:SI 2 "s_register_operand" "=r")
- (match_operand:SI 5 "memory_operand" "m"))]
- "load_multiple_sequence (operands, 3, NULL, NULL, NULL)"
- "*
- return emit_ldm_seq (operands, 3);
-")
-
-(define_peephole
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (match_operand:SI 2 "memory_operand" "m"))
- (set (match_operand:SI 1 "s_register_operand" "=r")
- (match_operand:SI 3 "memory_operand" "m"))]
- "load_multiple_sequence (operands, 2, NULL, NULL, NULL)"
- "*
- return emit_ldm_seq (operands, 2);
-")
-
-(define_peephole
- [(set (match_operand:SI 4 "memory_operand" "=m")
- (match_operand:SI 0 "s_register_operand" "r"))
- (set (match_operand:SI 5 "memory_operand" "=m")
- (match_operand:SI 1 "s_register_operand" "r"))
- (set (match_operand:SI 6 "memory_operand" "=m")
- (match_operand:SI 2 "s_register_operand" "r"))
- (set (match_operand:SI 7 "memory_operand" "=m")
- (match_operand:SI 3 "s_register_operand" "r"))]
- "store_multiple_sequence (operands, 4, NULL, NULL, NULL)"
- "*
- return emit_stm_seq (operands, 4);
-")
-
-(define_peephole
- [(set (match_operand:SI 3 "memory_operand" "=m")
- (match_operand:SI 0 "s_register_operand" "r"))
- (set (match_operand:SI 4 "memory_operand" "=m")
- (match_operand:SI 1 "s_register_operand" "r"))
- (set (match_operand:SI 5 "memory_operand" "=m")
- (match_operand:SI 2 "s_register_operand" "r"))]
- "store_multiple_sequence (operands, 3, NULL, NULL, NULL)"
- "*
- return emit_stm_seq (operands, 3);
-")
-
-(define_peephole
- [(set (match_operand:SI 2 "memory_operand" "=m")
- (match_operand:SI 0 "s_register_operand" "r"))
- (set (match_operand:SI 3 "memory_operand" "=m")
- (match_operand:SI 1 "s_register_operand" "r"))]
- "store_multiple_sequence (operands, 2, NULL, NULL, NULL)"
- "*
- return emit_stm_seq (operands, 2);
-")
-
-;; A call followed by return can be replaced by restoring the regs and
-;; jumping to the subroutine, provided we aren't passing the address of
-;; any of our local variables. If we call alloca then this is unsafe
-;; since restoring the frame frees the memory, which is not what we want.
-;; Sometimes the return might have been targeted by the final prescan:
-;; if so then emit a proper return insn as well.
-;; Unfortunately, if the frame pointer is required, we don't know if the
-;; current function has any implicit stack pointer adjustments that will
-;; be restored by the return: we can't therefore do a tail call.
-;; Another unfortunate that we can't handle is if current_function_args_size
-;; is non-zero: in this case elimination of the argument pointer assumed
-;; that lr was pushed onto the stack, so eliminating upsets the offset
-;; calculations.
-
-(define_peephole
- [(parallel [(call (mem:SI (match_operand:SI 0 "" "X"))
- (match_operand:SI 1 "general_operand" "g"))
- (clobber (reg:SI 14))])
- (return)]
- "(GET_CODE (operands[0]) == SYMBOL_REF && USE_RETURN_INSN
- && !get_frame_size () && !current_function_calls_alloca
- && !frame_pointer_needed && !current_function_args_size)"
- "*
-{
- extern rtx arm_target_insn;
- extern int arm_ccfsm_state;
-
- if (arm_ccfsm_state && arm_target_insn && INSN_DELETED_P (arm_target_insn))
- {
- arm_current_cc = ARM_INVERSE_CONDITION_CODE (arm_current_cc);
- output_return_instruction (NULL, TRUE, FALSE);
- arm_ccfsm_state = 0;
- arm_target_insn = NULL;
- }
-
- output_return_instruction (NULL, FALSE, FALSE);
- return \"b%?\\t%a0\";
-}"
-[(set_attr "type" "call")
- (set_attr "length" "8")])
-
-(define_peephole
- [(parallel [(set (match_operand 0 "s_register_operand" "=rf")
- (call (mem:SI (match_operand:SI 1 "" "X"))
- (match_operand:SI 2 "general_operand" "g")))
- (clobber (reg:SI 14))])
- (return)]
- "(GET_CODE (operands[1]) == SYMBOL_REF && USE_RETURN_INSN
- && !get_frame_size () && !current_function_calls_alloca
- && !frame_pointer_needed && !current_function_args_size)"
- "*
-{
- extern rtx arm_target_insn;
- extern int arm_ccfsm_state;
-
- if (arm_ccfsm_state && arm_target_insn && INSN_DELETED_P (arm_target_insn))
- {
- arm_current_cc = ARM_INVERSE_CONDITION_CODE (arm_current_cc);
- output_return_instruction (NULL, TRUE, FALSE);
- arm_ccfsm_state = 0;
- arm_target_insn = NULL;
- }
-
- output_return_instruction (NULL, FALSE, FALSE);
- return \"b%?\\t%a1\";
-}"
-[(set_attr "type" "call")
- (set_attr "length" "8")])
-
-;; As above but when this function is not void, we must be returning the
-;; result of the called subroutine.
-
-(define_peephole
- [(parallel [(set (match_operand 0 "s_register_operand" "=rf")
- (call (mem:SI (match_operand:SI 1 "" "X"))
- (match_operand:SI 2 "general_operand" "g")))
- (clobber (reg:SI 14))])
- (use (match_dup 0))
- (return)]
- "(GET_CODE (operands[1]) == SYMBOL_REF && USE_RETURN_INSN
- && !get_frame_size () && !current_function_calls_alloca
- && !frame_pointer_needed && !current_function_args_size)"
- "*
-{
- extern rtx arm_target_insn;
- extern int arm_ccfsm_state;
-
- if (arm_ccfsm_state && arm_target_insn && INSN_DELETED_P (arm_target_insn))
- {
- arm_current_cc = ARM_INVERSE_CONDITION_CODE (arm_current_cc);
- output_return_instruction (NULL, TRUE, FALSE);
- arm_ccfsm_state = 0;
- arm_target_insn = NULL;
- }
-
- output_return_instruction (NULL, FALSE, FALSE);
- return \"b%?\\t%a1\";
-}"
-[(set_attr "type" "call")
- (set_attr "length" "8")])
-
-;; If calling a subroutine and then jumping back to somewhere else, but not
-;; too far away, then we can set the link register with the branch address
-;; and jump direct to the subroutine. On return from the subroutine
-;; execution continues at the branch; this avoids a prefetch stall.
-;; We use the length attribute (via short_branch ()) to establish whether or
-;; not this is possible, this is the same as the sparc does.
-
-(define_peephole
- [(parallel[(call (mem:SI (match_operand:SI 0 "" "X"))
- (match_operand:SI 1 "general_operand" "g"))
- (clobber (reg:SI 14))])
- (set (pc)
- (label_ref (match_operand 2 "" "")))]
- "0 && GET_CODE (operands[0]) == SYMBOL_REF
- && short_branch (INSN_UID (insn), INSN_UID (operands[2]))
- && arm_insn_not_targeted (insn)"
- "*
-{
- int backward = arm_backwards_branch (INSN_UID (insn),
- INSN_UID (operands[2]));
-
-#if 0
- /* Putting this in means that TARGET_6 code will ONLY run on an arm6 or
- * above, leaving it out means that the code will still run on an arm 2 or 3
- */
- if (TARGET_6)
- {
- if (backward)
- output_asm_insn (\"sub%?\\t%|lr, %|pc, #(8 + . -%l2)\", operands);
- else
- output_asm_insn (\"add%?\\t%|lr, %|pc, #(%l2 - . -8)\", operands);
- }
- else
-#endif
- {
- output_asm_insn (\"mov%?\\t%|lr, %|pc\\t%@ protect cc\", operands);
- if (backward)
- output_asm_insn (\"sub%?\\t%|lr, %|lr, #(4 + . -%l2)\", operands);
- else
- output_asm_insn (\"add%?\\t%|lr, %|lr, #(%l2 - . -4)\", operands);
- }
- return \"b%?\\t%a0\";
-}"
-[(set_attr "type" "call")
- (set (attr "length")
- (if_then_else (eq_attr "prog_mode" "prog32")
- (const_int 8)
- (const_int 12)))])
-
-(define_peephole
- [(parallel[(set (match_operand:SI 0 "s_register_operand" "=r")
- (call (mem:SI (match_operand:SI 1 "" "X"))
- (match_operand:SI 2 "general_operand" "g")))
- (clobber (reg:SI 14))])
- (set (pc)
- (label_ref (match_operand 3 "" "")))]
- "0 && GET_CODE (operands[0]) == SYMBOL_REF
- && short_branch (INSN_UID (insn), INSN_UID (operands[3]))
- && arm_insn_not_targeted (insn)"
- "*
-{
- int backward = arm_backwards_branch (INSN_UID (insn),
- INSN_UID (operands[3]));
-
-#if 0
- /* Putting this in means that TARGET_6 code will ONLY run on an arm6 or
- * above, leaving it out means that the code will still run on an arm 2 or 3
- */
- if (TARGET_6)
- {
- if (backward)
- output_asm_insn (\"sub%?\\t%|lr, %|pc, #(8 + . -%l3)\", operands);
- else
- output_asm_insn (\"add%?\\t%|lr, %|pc, #(%l3 - . -8)\", operands);
- }
- else
-#endif
- {
- output_asm_insn (\"mov%?\\t%|lr, %|pc\\t%@ protect cc\", operands);
- if (backward)
- output_asm_insn (\"sub%?\\t%|lr, %|lr, #(4 + . -%l3)\", operands);
- else
- output_asm_insn (\"add%?\\t%|lr, %|lr, #(%l3 - . -4)\", operands);
- }
- return \"b%?\\t%a1\";
-}"
-[(set_attr "type" "call")
- (set (attr "length")
- (if_then_else (eq_attr "prog_mode" "prog32")
- (const_int 8)
- (const_int 12)))])
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (and:SI (ge:SI (match_operand:SI 1 "s_register_operand" "")
- (const_int 0))
- (neg:SI (match_operator:SI 2 "comparison_operator"
- [(match_operand:SI 3 "s_register_operand" "")
- (match_operand:SI 4 "arm_rhs_operand" "")]))))
- (clobber (match_operand:SI 5 "s_register_operand" ""))]
- ""
- [(set (match_dup 5) (not:SI (ashiftrt:SI (match_dup 1) (const_int 31))))
- (set (match_dup 0) (and:SI (match_op_dup 2 [(match_dup 3) (match_dup 4)])
- (match_dup 5)))]
- "")
-
-;; This split can be used because CC_Z mode implies that the following
-;; branch will be an equality, or an unsigned inequality, so the sign
-;; extension is not needed.
-
-(define_split
- [(set (reg:CC_Z 24)
- (compare:CC_Z
- (ashift:SI (subreg:SI (match_operand:QI 0 "memory_operand" "") 0)
- (const_int 24))
- (match_operand 1 "const_int_operand" "")))
- (clobber (match_scratch:SI 2 ""))]
- "((unsigned HOST_WIDE_INT) INTVAL (operands[1]))
- == (((unsigned HOST_WIDE_INT) INTVAL (operands[1])) >> 24) << 24"
- [(set (match_dup 2) (zero_extend:SI (match_dup 0)))
- (set (reg:CC 24) (compare:CC (match_dup 2) (match_dup 1)))]
- "
- operands[1] = GEN_INT (((unsigned long) INTVAL (operands[1])) >> 24);
-")
-
-(define_expand "prologue"
- [(clobber (const_int 0))]
- ""
- "
- arm_expand_prologue ();
- DONE;
-")
-
-;; This split is only used during output to reduce the number of patterns
-;; that need assembler instructions adding to them. We allowed the setting
-;; of the conditions to be implicit during rtl generation so that
-;; the conditional compare patterns would work. However this conflicts to
-;; some extent with the conditional data operations, so we have to split them
-;; up again here.
-
-(define_split
- [(set (match_operand:SI 0 "s_register_operand" "")
- (if_then_else:SI (match_operator 1 "comparison_operator"
- [(match_operand 2 "" "") (match_operand 3 "" "")])
- (match_operand 4 "" "")
- (match_operand 5 "" "")))
- (clobber (reg 24))]
- "reload_completed"
- [(set (match_dup 6) (match_dup 7))
- (set (match_dup 0)
- (if_then_else:SI (match_op_dup 1 [(match_dup 6) (const_int 0)])
- (match_dup 4)
- (match_dup 5)))]
- "
-{
- enum machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[1]), operands[2],
- operands[3]);
-
- operands[6] = gen_rtx (REG, mode, 24);
- operands[7] = gen_rtx (COMPARE, mode, operands[2], operands[3]);
-}
-")
-
-
-;; The next two patterns occur when an AND operation is followed by a
-;; scc insn sequence
-
-(define_insn "*sign_extract_onebit"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (sign_extract:SI (match_operand:SI 1 "s_register_operand" "r")
- (const_int 1)
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "*
- operands[2] = GEN_INT (1 << INTVAL (operands[2]));
- output_asm_insn (\"ands\\t%0, %1, %2\", operands);
- return \"mvnne\\t%0, #0\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "8")])
-
-(define_insn "*not_signextract_onebit"
- [(set (match_operand:SI 0 "s_register_operand" "=r")
- (not:SI
- (sign_extract:SI (match_operand:SI 1 "s_register_operand" "r")
- (const_int 1)
- (match_operand:SI 2 "const_int_operand" "n"))))]
- ""
- "*
- operands[2] = GEN_INT (1 << INTVAL (operands[2]));
- output_asm_insn (\"tst\\t%1, %2\", operands);
- output_asm_insn (\"mvneq\\t%0, #0\", operands);
- return \"movne\\t%0, #0\";
-"
-[(set_attr "conds" "clob")
- (set_attr "length" "12")])
-
-;; Push multiple registers to the stack. The first register is in the
-;; unspec part of the insn; subsequent registers are in parallel (use ...)
-;; expressions.
-(define_insn "*push_multi"
- [(match_parallel 2 "multi_register_push"
- [(set (match_operand:BLK 0 "memory_operand" "=m")
- (unspec:BLK [(match_operand:SI 1 "s_register_operand" "r")] 2))])]
- ""
- "*
-{
- char pattern[100];
- int i;
- extern int lr_save_eliminated;
-
- if (lr_save_eliminated)
- {
- if (XVECLEN (operands[2], 0) > 1)
- abort ();
- return \"\";
- }
- strcpy (pattern, \"stmfd\\t%m0!, {%1\");
- for (i = 1; i < XVECLEN (operands[2], 0); i++)
- {
- strcat (pattern, \", %|\");
- strcat (pattern, reg_names[REGNO (XEXP (XVECEXP (operands[2], 0, i),
- 0))]);
- }
- strcat (pattern, \"}\");
- output_asm_insn (pattern, operands);
- return \"\";
-}"
-[(set_attr "type" "store4")])
-
-;; Special patterns for dealing with the constant pool
-
-(define_insn "consttable_4"
- [(unspec_volatile [(match_operand 0 "" "")] 2)]
- ""
- "*
-{
- switch (GET_MODE_CLASS (GET_MODE (operands[0])))
- {
- case MODE_FLOAT:
- {
- union real_extract u;
- bcopy ((char *) &CONST_DOUBLE_LOW (operands[0]), (char *) &u, sizeof u);
- assemble_real (u.d, GET_MODE (operands[0]));
- break;
- }
- default:
- assemble_integer (operands[0], 4, 1);
- break;
- }
- return \"\";
-}"
-[(set_attr "length" "4")])
-
-(define_insn "consttable_8"
- [(unspec_volatile [(match_operand 0 "" "")] 3)]
- ""
- "*
-{
- switch (GET_MODE_CLASS (GET_MODE (operands[0])))
- {
- case MODE_FLOAT:
- {
- union real_extract u;
- bcopy ((char *) &CONST_DOUBLE_LOW (operands[0]), (char *) &u, sizeof u);
- assemble_real (u.d, GET_MODE (operands[0]));
- break;
- }
- default:
- assemble_integer (operands[0], 8, 1);
- break;
- }
- return \"\";
-}"
-[(set_attr "length" "8")])
-
-(define_insn "consttable_end"
- [(unspec_volatile [(const_int 0)] 4)]
- ""
- "*
- /* Nothing to do (currently). */
- return \"\";
-")
-
-(define_insn "align_4"
- [(unspec_volatile [(const_int 0)] 5)]
- ""
- "*
- assemble_align (32);
- return \"\";
-")
diff --git a/gcc/config/arm/coff.h b/gcc/config/arm/coff.h
deleted file mode 100644
index ebc8a8c6ca0..00000000000
--- a/gcc/config/arm/coff.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* Definitions of target machine for GNU compiler,
- for ARM with COFF obj format.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Doug Evans (dje@cygnus.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 "arm/semi.h"
-
-/* Run-time Target Specification. */
-#undef TARGET_VERSION
-#define TARGET_VERSION fputs (" (ARM/coff)", stderr)
-
-/* ??? Maybe use --with{enable?}-fpu or some such to make hardware floating
- point the default. NOT --nfp! --with{enable?} is supposed to replace it
- (right?), so let's stop using it. */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT /*+ TARGET_CPU_DEFAULT*/)
-
-/* ??? Is a big-endian default intended to be supported? */
-#if 0 /*TARGET_CPU_DEFAULT & ARM_FLAG_BIG_END*/
-#define MULTILIB_DEFAULTS { "mbe", "mbig-endian" }
-#else
-#define MULTILIB_DEFAULTS { "mle", "mlittle-endian" }
-#endif
-
-/* ??? Does arm.h really need to set this to 32? */
-#undef STRUCTURE_SIZE_BOUNDARY
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
- is a valid machine specific attribute for DECL.
- The attributes in ATTRIBUTES have previously been assigned to DECL. */
-extern int arm_valid_machine_decl_attribute ();
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-arm_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-
-/* This is COFF, but prefer stabs. */
-#define SDB_DEBUGGING_INFO
-
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#include "dbxcoff.h"
-
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* A C statement to output assembler commands which will identify the
- object file as having been compiled with GNU CC (or another GNU
- compiler). */
-/* Define this to NULL so we don't get anything.
- We have ASM_IDENTIFY_LANGUAGE.
- Also, when using stabs, gcc2_compiled must be a stabs entry, not an
- ordinary symbol, or gdb won't see it. The stabs entry must be
- before the N_SO in order for gdb to find it. */
-#define ASM_IDENTIFY_GCC(STREAM)
-
-/* This outputs a lot of .req's to define alias for various registers.
- Let's try to avoid this. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(STREAM) \
-do { \
- extern char *version_string; \
- fprintf (STREAM, "%s Generated by gcc %s for ARM/coff\n", \
- ASM_COMMENT_START, version_string); \
-} while (0)
-
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME) \
-do { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME)); \
- else if ((DECL) && TREE_READONLY (DECL)) \
- fprintf (STREAM, "\t.section %s,\"\"\n", (NAME)); \
- else \
- fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME)); \
-} while (0)
-
-/* Support the ctors/dtors and other sections. */
-
-#undef INIT_SECTION_ASM_OP
-
-/* Define this macro if jump tables (for `tablejump' insns) should be
- output in the text section, along with the assembler instructions.
- Otherwise, the readonly data section is used. */
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-#undef READONLY_DATA_SECTION
-#define READONLY_DATA_SECTION rdata_section
-#undef RDATA_SECTION_ASM_OP
-#define RDATA_SECTION_ASM_OP "\t.section .rdata"
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\t.section .ctors,\"x\""
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\t.section .dtors,\"x\""
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_rdata, in_ctors, in_dtors
-
-#define SUBTARGET_EXTRA_SECTIONS
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- RDATA_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
- SUBTARGET_EXTRA_SECTION_FUNCTIONS
-
-#define SUBTARGET_EXTRA_SECTION_FUNCTIONS
-
-#define RDATA_SECTION_FUNCTION \
-void \
-rdata_section () \
-{ \
- if (in_section != in_rdata) \
- { \
- fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
- in_section = in_rdata; \
- } \
-}
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-/* Support the ctors/dtors sections for g++. */
-
-#define INT_ASM_OP ".word"
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \
-do { \
- ctors_section (); \
- fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \
- assemble_name (STREAM, NAME); \
- fprintf (STREAM, "\n"); \
-} while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \
-do { \
- dtors_section (); \
- fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \
- assemble_name (STREAM, NAME); \
- fprintf (STREAM, "\n"); \
-} while (0)
-
-/* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script. */
-#define CTOR_LISTS_DEFINED_EXTERNALLY
-
-#undef DO_GLOBAL_CTORS_BODY
-#undef DO_GLOBAL_DTORS_BODY
-
-/* The ARM development system has atexit and doesn't have _exit,
- so define this for now. */
-#define HAVE_ATEXIT
-
-/* The ARM development system defines __main. */
-#define NAME__MAIN "__gccmain"
-#define SYMBOL__MAIN __gccmain
diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm
deleted file mode 100644
index c2db824738f..00000000000
--- a/gcc/config/arm/lib1funcs.asm
+++ /dev/null
@@ -1,404 +0,0 @@
-@ libgcc1 routines for ARM cpu.
-@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk)
-
-/* Copyright (C) 1995, 1996 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, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file 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; 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 link this library with other files,
- some of which are compiled with GCC, to produce an executable,
- this library 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. */
-
-#ifdef __APCS_26__
-#define RET movs
-#define RETc(x) mov##x##s
-#define RETCOND ^
-#else
-#define RET mov
-#define RETc(x) mov##x
-#define RETCOND
-#endif
-
-#ifndef __USER_LABEL_PREFIX__
-#define __USER_LABEL_PREFIX__ _
-#endif
-
-/* ANSI concatenation macros. */
-
-#define CONCAT1(a, b) CONCAT2(a, b)
-#define CONCAT2(a, b) a ## b
-
-/* Use the right prefix for global labels. */
-
-#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
-
-#ifdef L_udivsi3
-
-dividend .req r0
-divisor .req r1
-result .req r2
-curbit .req r3
-ip .req r12
-sp .req r13
-lr .req r14
-pc .req r15
- .text
- .globl SYM (__udivsi3)
- .align 0
-
-SYM (__udivsi3):
- cmp divisor, #0
- beq Ldiv0
- mov curbit, #1
- mov result, #0
- cmp dividend, divisor
- bcc Lgot_result
-Loop1:
- @ Unless the divisor is very big, shift it up in multiples of
- @ four bits, since this is the amount of unwinding in the main
- @ division loop. Continue shifting until the divisor is
- @ larger than the dividend.
- cmp divisor, #0x10000000
- cmpcc divisor, dividend
- movcc divisor, divisor, lsl #4
- movcc curbit, curbit, lsl #4
- bcc Loop1
-
-Lbignum:
- @ For very big divisors, we must shift it a bit at a time, or
- @ we will be in danger of overflowing.
- cmp divisor, #0x80000000
- cmpcc divisor, dividend
- movcc divisor, divisor, lsl #1
- movcc curbit, curbit, lsl #1
- bcc Lbignum
-
-Loop3:
- @ Test for possible subtractions, and note which bits
- @ are done in the result. On the final pass, this may subtract
- @ too much from the dividend, but the result will be ok, since the
- @ "bit" will have been shifted out at the bottom.
- cmp dividend, divisor
- subcs dividend, dividend, divisor
- orrcs result, result, curbit
- cmp dividend, divisor, lsr #1
- subcs dividend, dividend, divisor, lsr #1
- orrcs result, result, curbit, lsr #1
- cmp dividend, divisor, lsr #2
- subcs dividend, dividend, divisor, lsr #2
- orrcs result, result, curbit, lsr #2
- cmp dividend, divisor, lsr #3
- subcs dividend, dividend, divisor, lsr #3
- orrcs result, result, curbit, lsr #3
- cmp dividend, #0 @ Early termination?
- movnes curbit, curbit, lsr #4 @ No, any more bits to do?
- movne divisor, divisor, lsr #4
- bne Loop3
-Lgot_result:
- mov r0, result
- RET pc, lr
-
-Ldiv0:
- str lr, [sp, #-4]!
- bl SYM (__div0)
- mov r0, #0 @ about as wrong as it could be
- ldmia sp!, {pc}RETCOND
-
-#endif /* L_udivsi3 */
-
-#ifdef L_umodsi3
-
-dividend .req r0
-divisor .req r1
-overdone .req r2
-curbit .req r3
-ip .req r12
-sp .req r13
-lr .req r14
-pc .req r15
- .text
- .globl SYM (__umodsi3)
- .align 0
-
-SYM (__umodsi3):
- cmp divisor, #0
- beq Ldiv0
- mov curbit, #1
- cmp dividend, divisor
- RETc(cc) pc, lr
-Loop1:
- @ Unless the divisor is very big, shift it up in multiples of
- @ four bits, since this is the amount of unwinding in the main
- @ division loop. Continue shifting until the divisor is
- @ larger than the dividend.
- cmp divisor, #0x10000000
- cmpcc divisor, dividend
- movcc divisor, divisor, lsl #4
- movcc curbit, curbit, lsl #4
- bcc Loop1
-
-Lbignum:
- @ For very big divisors, we must shift it a bit at a time, or
- @ we will be in danger of overflowing.
- cmp divisor, #0x80000000
- cmpcc divisor, dividend
- movcc divisor, divisor, lsl #1
- movcc curbit, curbit, lsl #1
- bcc Lbignum
-
-Loop3:
- @ Test for possible subtractions. On the final pass, this may
- @ subtract too much from the dividend, so keep track of which
- @ subtractions are done, we can fix them up afterwards...
- mov overdone, #0
- cmp dividend, divisor
- subcs dividend, dividend, divisor
- cmp dividend, divisor, lsr #1
- subcs dividend, dividend, divisor, lsr #1
- orrcs overdone, overdone, curbit, ror #1
- cmp dividend, divisor, lsr #2
- subcs dividend, dividend, divisor, lsr #2
- orrcs overdone, overdone, curbit, ror #2
- cmp dividend, divisor, lsr #3
- subcs dividend, dividend, divisor, lsr #3
- orrcs overdone, overdone, curbit, ror #3
- mov ip, curbit
- cmp dividend, #0 @ Early termination?
- movnes curbit, curbit, lsr #4 @ No, any more bits to do?
- movne divisor, divisor, lsr #4
- bne Loop3
-
- @ Any subtractions that we should not have done will be recorded in
- @ the top three bits of "overdone". Exactly which were not needed
- @ are governed by the position of the bit, stored in ip.
- @ If we terminated early, because dividend became zero,
- @ then none of the below will match, since the bit in ip will not be
- @ in the bottom nibble.
- ands overdone, overdone, #0xe0000000
- RETc(eq) pc, lr @ No fixups needed
- tst overdone, ip, ror #3
- addne dividend, dividend, divisor, lsr #3
- tst overdone, ip, ror #2
- addne dividend, dividend, divisor, lsr #2
- tst overdone, ip, ror #1
- addne dividend, dividend, divisor, lsr #1
- RET pc, lr
-
-Ldiv0:
- str lr, [sp, #-4]!
- bl SYM (__div0)
- mov r0, #0 @ about as wrong as it could be
- ldmia sp!, {pc}RETCOND
-
-#endif /* L_umodsi3 */
-
-#ifdef L_divsi3
-
-dividend .req r0
-divisor .req r1
-result .req r2
-curbit .req r3
-ip .req r12
-sp .req r13
-lr .req r14
-pc .req r15
- .text
- .globl SYM (__divsi3)
- .align 0
-
-SYM (__divsi3):
- eor ip, dividend, divisor @ Save the sign of the result.
- mov curbit, #1
- mov result, #0
- cmp divisor, #0
- rsbmi divisor, divisor, #0 @ Loops below use unsigned.
- beq Ldiv0
- cmp dividend, #0
- rsbmi dividend, dividend, #0
- cmp dividend, divisor
- bcc Lgot_result
-
-Loop1:
- @ Unless the divisor is very big, shift it up in multiples of
- @ four bits, since this is the amount of unwinding in the main
- @ division loop. Continue shifting until the divisor is
- @ larger than the dividend.
- cmp divisor, #0x10000000
- cmpcc divisor, dividend
- movcc divisor, divisor, lsl #4
- movcc curbit, curbit, lsl #4
- bcc Loop1
-
-Lbignum:
- @ For very big divisors, we must shift it a bit at a time, or
- @ we will be in danger of overflowing.
- cmp divisor, #0x80000000
- cmpcc divisor, dividend
- movcc divisor, divisor, lsl #1
- movcc curbit, curbit, lsl #1
- bcc Lbignum
-
-Loop3:
- @ Test for possible subtractions, and note which bits
- @ are done in the result. On the final pass, this may subtract
- @ too much from the dividend, but the result will be ok, since the
- @ "bit" will have been shifted out at the bottom.
- cmp dividend, divisor
- subcs dividend, dividend, divisor
- orrcs result, result, curbit
- cmp dividend, divisor, lsr #1
- subcs dividend, dividend, divisor, lsr #1
- orrcs result, result, curbit, lsr #1
- cmp dividend, divisor, lsr #2
- subcs dividend, dividend, divisor, lsr #2
- orrcs result, result, curbit, lsr #2
- cmp dividend, divisor, lsr #3
- subcs dividend, dividend, divisor, lsr #3
- orrcs result, result, curbit, lsr #3
- cmp dividend, #0 @ Early termination?
- movnes curbit, curbit, lsr #4 @ No, any more bits to do?
- movne divisor, divisor, lsr #4
- bne Loop3
-Lgot_result:
- mov r0, result
- cmp ip, #0
- rsbmi r0, r0, #0
- RET pc, lr
-
-Ldiv0:
- str lr, [sp, #-4]!
- bl SYM (__div0)
- mov r0, #0 @ about as wrong as it could be
- ldmia sp!, {pc}RETCOND
-
-#endif /* L_divsi3 */
-
-#ifdef L_modsi3
-
-dividend .req r0
-divisor .req r1
-overdone .req r2
-curbit .req r3
-ip .req r12
-sp .req r13
-lr .req r14
-pc .req r15
- .text
- .globl SYM (__modsi3)
- .align 0
-
-SYM (__modsi3):
- mov curbit, #1
- cmp divisor, #0
- rsbmi divisor, divisor, #0 @ Loops below use unsigned.
- beq Ldiv0
- @ Need to save the sign of the dividend, unfortunately, we need
- @ ip later on; this is faster than pushing lr and using that.
- str dividend, [sp, #-4]!
- cmp dividend, #0
- rsbmi dividend, dividend, #0
- cmp dividend, divisor
- bcc Lgot_result
-
-Loop1:
- @ Unless the divisor is very big, shift it up in multiples of
- @ four bits, since this is the amount of unwinding in the main
- @ division loop. Continue shifting until the divisor is
- @ larger than the dividend.
- cmp divisor, #0x10000000
- cmpcc divisor, dividend
- movcc divisor, divisor, lsl #4
- movcc curbit, curbit, lsl #4
- bcc Loop1
-
-Lbignum:
- @ For very big divisors, we must shift it a bit at a time, or
- @ we will be in danger of overflowing.
- cmp divisor, #0x80000000
- cmpcc divisor, dividend
- movcc divisor, divisor, lsl #1
- movcc curbit, curbit, lsl #1
- bcc Lbignum
-
-Loop3:
- @ Test for possible subtractions. On the final pass, this may
- @ subtract too much from the dividend, so keep track of which
- @ subtractions are done, we can fix them up afterwards...
- mov overdone, #0
- cmp dividend, divisor
- subcs dividend, dividend, divisor
- cmp dividend, divisor, lsr #1
- subcs dividend, dividend, divisor, lsr #1
- orrcs overdone, overdone, curbit, ror #1
- cmp dividend, divisor, lsr #2
- subcs dividend, dividend, divisor, lsr #2
- orrcs overdone, overdone, curbit, ror #2
- cmp dividend, divisor, lsr #3
- subcs dividend, dividend, divisor, lsr #3
- orrcs overdone, overdone, curbit, ror #3
- mov ip, curbit
- cmp dividend, #0 @ Early termination?
- movnes curbit, curbit, lsr #4 @ No, any more bits to do?
- movne divisor, divisor, lsr #4
- bne Loop3
-
- @ Any subtractions that we should not have done will be recorded in
- @ the top three bits of "overdone". Exactly which were not needed
- @ are governed by the position of the bit, stored in ip.
- @ If we terminated early, because dividend became zero,
- @ then none of the below will match, since the bit in ip will not be
- @ in the bottom nibble.
- ands overdone, overdone, #0xe0000000
- beq Lgot_result
- tst overdone, ip, ror #3
- addne dividend, dividend, divisor, lsr #3
- tst overdone, ip, ror #2
- addne dividend, dividend, divisor, lsr #2
- tst overdone, ip, ror #1
- addne dividend, dividend, divisor, lsr #1
-Lgot_result:
- ldr ip, [sp], #4
- cmp ip, #0
- rsbmi dividend, dividend, #0
- RET pc, lr
-
-Ldiv0:
- str lr, [sp, #-4]!
- bl SYM (__div0)
- mov r0, #0 @ about as wrong as it could be
- ldmia sp!, {pc}RETCOND
-
-#endif /* L_modsi3 */
-
-#ifdef L_dvmd_tls
-
- .globl SYM (__div0)
- .align 0
-SYM (__div0):
- RET pc, lr
-
-#endif /* L_divmodsi_tools */
diff --git a/gcc/config/arm/riscix.h b/gcc/config/arm/riscix.h
deleted file mode 100644
index 9c1af465b03..00000000000
--- a/gcc/config/arm/riscix.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Definitions of target machine for GNU compiler. ARM RISCiX version.
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
- Contributed by Richard Earnshaw (rwe11@cl.cam.ac.uk), based on original
- work by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
- and Martin Simmons (@harleqn.co.uk).
-
-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. */
-
-/* Translation to find startup files. On RISC iX boxes,
- crt0, mcrt0 and gcrt0.o are in /usr/lib. */
-#define STARTFILE_SPEC "\
- %{pg:/usr/lib/gcrt0.o%s}\
- %{!pg:%{p:/usr/lib/mcrt0.o%s}\
- %{!p:/usr/lib/crt0.o%s}}"
-
-/* RISC iX has no concept of -lg */
-/* If -static is specified then link with -lc_n */
-
-#ifndef LIB_SPEC
-#define LIB_SPEC "\
- %{g*:-lg}\
- %{!p:%{!pg:%{!static:-lc}%{static:-lc_n}}}\
- %{p:-lc_p}\
- %{pg:-lc_p}"
-#endif
-
-/* The RISC iX assembler never deletes any symbols from the object module;
- and, by default, ld doesn't either. -X causes local symbols starting
- with 'L' to be deleted, which is what we want. */
-#ifndef LINK_SPEC
-#define LINK_SPEC "-X"
-#endif
-
-#ifndef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Darm -Driscix -Dunix -Asystem(unix) -Acpu(arm) -Amachine(arm)"
-#endif
-
-#ifndef CPP_SPEC
-#define CPP_SPEC "%{m6:-D__arm6__} \
- %{mbsd:%{pedantic:%e-mbsd and -pedantic incompatible} -D_BSD_C} \
- %{mxopen:%{mbsd:%e-mbsd and -mxopen incompatible} \
- %{pedantic:%e-mxopen and -pedantic incompatible} -D_XOPEN_C} \
- %{!mbsd:%{!mxopen:%{!ansi: -D_BSD_C}}}"
-#endif
-
-/* RISCiX has some weird symbol name munging, that is done to the object module
- after assembly, which enables multiple libraries to be supported within
- one (possibly shared) library. It basically changes the symbol name of
- certain symbols (for example _bcopy is converted to _$bcopy if using BSD)
- Symrename's parameters are determined as follows:
- -mno-symrename Don't run symrename
- -mbsd symrename -BSD <file>
- -mxopen symrename -XOPEN <file>
- -ansi symrename - <file>
- <none> symrename -BSD <file>
- */
-
-#ifndef ASM_FINAL_SPEC
-#if !defined (CROSS_COMPILE)
-#define ASM_FINAL_SPEC "\
-%{!mno-symrename: \
- \n /usr/bin/symrename \
- -%{mbsd:%{pedantic:%e-mbsd and -pedantic incompatible}BSD}\
-%{mxopen:%{mbsd:%e-mbsd and -mxopen incompatible}\
-%{pedantic:%e-mxopen and -pedantic incompatible}XOPEN}\
-%{!mbsd:%{!mxopen:%{!ansi:BSD}}} %{c:%{o*:%*}%{!o*:%b.o}}%{!c:%U.o}}"
-#endif
-#endif
-
-/* None of these is actually used in cc1. If we don't define them in target
- switches cc1 complains about them. For the sake of argument lets allocate
- bit 31 of target flags for such options. */
-#define SUBTARGET_SWITCHES \
-{"bsd", 0x80000000}, {"xopen", 0x80000000}, {"no-symrename", 0x80000000},
-
-
-/* Run-time Target Specification. */
-#define TARGET_VERSION \
- fputs (" (ARM/RISCiX)", stderr);
-
-/* This is used in ASM_FILE_START */
-#define ARM_OS_NAME "RISCiX"
-
-/* Unsigned chars produces much better code than signed. */
-#define DEFAULT_SIGNED_CHAR 0
-
-/* Define this if the target system supports the function atexit from the
- ANSI C standard. If this is not defined, and INIT_SECTION_ASM_OP is not
- defined, a default exit function will be provided to support C++.
- The man page only describes on_exit, but atexit is also there. */
-#define HAVE_ATEXIT 1
-
-/* Some systems use __main in a way incompatible with its use in gcc, in these
- cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
- give the same symbol without quotes for an alternative entry point. You
- must define both, or neither. */
-#ifndef NAME__MAIN
-#define NAME__MAIN "__gccmain"
-#define SYMBOL__MAIN __gccmain
-#endif
-
-/* size_t is "unsigned int" in RISCiX */
-#define SIZE_TYPE "unsigned int"
-
-/* ptrdiff_t is "int" in RISCiX */
-#define PTRDIFF_TYPE "int"
-
-/* Maths operation domain error number, EDOM */
-#define TARGET_EDOM 33
-#include "arm/aout.h"
-
-/* The native RISCiX assembler does not support stabs of any kind; because
- the native assembler is not used by the compiler, Acorn didn't feel it was
- necessary to put them in! */
-
-#ifdef DBX_DEBUGGING_INFO
-#undef DBX_DEBUGGING_INFO
-#endif
diff --git a/gcc/config/arm/riscix1-1.h b/gcc/config/arm/riscix1-1.h
deleted file mode 100644
index 748638137cb..00000000000
--- a/gcc/config/arm/riscix1-1.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Definitions of target machine for GNU compiler. ARM RISCiX 1.1x version.
- Copyright (C) 1993, 1995 Free Software Foundation, Inc.
- Contributed by Richard Earnshaw (rwe11@cl.cam.ac.uk), based on original
- work by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
- and Martin Simmons (@harleqn.co.uk).
-
-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. */
-
-/* RISCix 1.1x is basically the same as 1.2x except that it doesn't have
- symrename or atexit. */
-
-/* Translation to find startup files. On RISCiX boxes, gcrt0.o is in
- /usr/lib. */
-#define STARTFILE_SPEC \
- "%{pg:/usr/lib/gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
-
-#ifndef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Darm -Driscix -Dunix -Asystem(unix) -Acpu(arm) -Amachine(arm)"
-#endif
-
-#ifndef CPP_SPEC
-#define CPP_SPEC "%{m6:-D__arm6__} %{!ansi: -D_BSD_C}"
-#endif
-
-/* Riscix 1.1 doesn't have X/OPEN support, so only accept -mbsd (but ignore
- it).
- By not having -mxopen and -mno-symrename, we get warning messages,
- but everything still compiles. */
-/* None of these is actually used in cc1, so they modify bit 31 */
-#define SUBTARGET_SWITCHES \
-{"bsd", 0x80000000},
-
-
-/* Run-time Target Specification. */
-#define TARGET_VERSION \
- fputs (" (ARM/RISCiX)", stderr);
-
-/* This is used in ASM_FILE_START */
-#define ARM_OS_NAME "RISCiX"
-
-#ifdef riscos
-#define TARGET_WHEN_DEBUGGING 3
-#else
-#define TARGET_WHEN_DEBUGGING 1
-#endif
-
-/* 'char' is signed by default on RISCiX, unsigned on RISCOS. */
-#ifdef riscos
-#define DEFAULT_SIGNED_CHAR 0
-#else
-#define DEFAULT_SIGNED_CHAR 1
-#endif
-
-/* Define this if the target system supports the function atexit form the
- ANSI C standard. If this is not defined, and INIT_SECTION_ASM_OP is not
- defined, a default exit function will be provided to support C++.
- The man page only describes on_exit, but atexit is also there.
- This seems to be missing in early versions. */
-/*#define HAVE_ATEXIT 1 */
-/* Some systems use __main in a way incompatible with its use in gcc, in these
- cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
- give the same symbol without quotes for an alternative entry point. You
- must define both, or neither. */
-#ifndef NAME__MAIN
-#define NAME__MAIN "__gccmain"
-#define SYMBOL__MAIN __gccmain
-#endif
-
-#include "arm/aout.h"
-
-/* The native RISCiX assembler does not support stabs of any kind; because
- the native assembler is not used by the compiler, Acorn didn't feel it was
- necessary to put them in! */
-
-#ifdef DBX_DEBUGGING_INFO
-#undef DBX_DEBUGGING_INFO
-#endif
diff --git a/gcc/config/arm/rix-gas.h b/gcc/config/arm/rix-gas.h
deleted file mode 100644
index dae16d023ea..00000000000
--- a/gcc/config/arm/rix-gas.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Definitions of target machine for GNU compiler. ARM RISCiX(stabs) version.
- Copyright (C) 1993 Free Software Foundation, Inc.
- Contributed by Richard Earnshaw (rwe11@cl.cam.ac.uk), based on original
- work by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
- and Martin Simmons (@harleqn.co.uk).
-
-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. */
-
-/* Limit the length of a stabs entry (for the broken Acorn assembler) */
-#define DBX_CONTIN_LENGTH 80
-
-#include "arm/riscix.h"
-
-/* The native RISCiX assembler does not support stabs of any kind; because
- the native assembler is not used by the compiler, Acorn didn't feel it was
- necessary to put them in!
- However, this file assumes that we have an assembler that does have stabs,
- so we put them back in. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Unfortunately dbx doesn't understand these */
-/* Dbx on RISCiX is so broken that I've given up trying to support it.
- lets just support gdb. */
-/* #define DEFAULT_GDB_EXTENSIONS 0 */
-/* RISCiX dbx doesn't accept xrefs */
-/* #define DBX_NO_XREFS 1 */
-
diff --git a/gcc/config/arm/semi.h b/gcc/config/arm/semi.h
deleted file mode 100644
index 1540bbf0952..00000000000
--- a/gcc/config/arm/semi.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Definitions of target machine for GNU compiler. ARM on semi-hosted platform
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Richard Earnshaw (richard.earnshaw@armltd.co.uk)
-
-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. */
-
-#define STARTFILE_SPEC "crt0.o%s"
-
-#define LIB_SPEC "-lc"
-
-#define CPP_PREDEFINES \
- "-Darm -D__semi__ -Acpu(arm) -Amachine(arm)"
-
-#define CPP_SPEC "%{m6:-D__arm6__} \
-%{mcpu-*:-D__%*} \
-%{mcpu=*:-D__%*} \
-%{mapcs-32:-D__APCS_32__ -U__APCS_26__} \
-%{mapcs-26:-D__APCS_26__ -U__APCS_32__} \
-%{!mapcs-32: %{!mapcs-26:-D__APCS_32__}} \
-%{msoft-float:-D__SOFTFP__} \
-%{mhard-float:-U__SOFTFP__} \
-%{!mhard-float: %{!msoft-float:-U__SOFTFP__}} \
-%{mbig-endian:-D__ARMEB__ %{mwords-little-endian:-D__ARMWEL__}} \
-%{mbe:-D__ARMEB__ %{mwords-little-endian:-D__ARMWEL__}} \
-%{!mbe: %{!mbig-endian:-D__ARMEL__}} \
-"
-
-#define ASM_SPEC "%{mbig-endian:-EB}"
-
-#define LINK_SPEC "%{mbig-endian:-EB} -X"
-
-#define TARGET_VERSION fputs (" (ARM/semi-hosted)", stderr);
-
-#define TARGET_DEFAULT ARM_FLAG_APCS_32
-
-#ifndef PROCESSOR_DEFAULT
-#define PROCESSOR_DEFAULT PROCESSOR_ARM6
-#endif
-
-#include "arm/aout.h"
diff --git a/gcc/config/arm/semiaof.h b/gcc/config/arm/semiaof.h
deleted file mode 100644
index ab6c8b29ce1..00000000000
--- a/gcc/config/arm/semiaof.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Definitions of target machine for GNU compiler. ARM on semi-hosted platform
- AOF Syntax assembler.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Richard Earnshaw (richard.earnshaw@armltd.co.uk)
-
-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. */
-
-#define CPP_PREDEFINES \
- "-Darm -Dsemi -Acpu(arm) -Amachine(arm)"
-
-#define CPP_SPEC "%{m6:-D__arm6__} \
-%{mcpu-*:-D__%*} \
-%{mcpu=*:-D__%*} \
-%{mapcs-32:-D__APCS_32__ -U__APCS_26__} \
-%{mapcs-26:-D__APCS_26__ -U__APCS_32__} \
-%{!mapcs-32: %{!mapcs-26:-D__APCS_32__}} \
-%{msoft-float:-D__SOFTFP__} \
-%{mhard-float:-U__SOFTFP__} \
-%{!mhard-float: %{!msoft-float:-U__SOFTFP__}} \
-%{mbig-endian:-D__ARMEB__ %{mwords-little-endian:-D__ARMWEL__}} \
-%{mbe:-D__ARMEB__ %{mwords-little-endian:-D__ARMWEL__}} \
-%{!mbe: %{!mbig-endian:-D__ARMEL__}} \
-"
-
-#define ASM_SPEC "%{g -g} -arch 4 \
--apcs 3%{mapcs-32:/32bit}%{mapcs-26:/26bit}%{!mapcs-26:%{!macps-32:/32bit}}"
-
-#define LIB_SPEC "%{Eb: armlib_h.32b%s}%{!Eb: armlib_h.32l%s}"
-
-#define TARGET_VERSION fputs (" (ARM/semi-hosted)", stderr);
-
-#define TARGET_DEFAULT ARM_FLAG_APCS_32
-
-/* The Norcroft C library defines size_t as "unsigned int" */
-#define SIZE_TYPE "unsigned int"
-
-#include "arm/aof.h"
diff --git a/gcc/config/arm/t-bare b/gcc/config/arm/t-bare
deleted file mode 100644
index 4f1d84ace62..00000000000
--- a/gcc/config/arm/t-bare
+++ /dev/null
@@ -1,30 +0,0 @@
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- echo '#ifndef __ARMEB__' >> fp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
- echo '#endif' >> fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#ifndef __ARMEB__' > dp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c
- echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c
- echo '#endif' >> dp-bit.c
- cat $(srcdir)/config/fp-bit.c >> dp-bit.c
-
-# Avoid building a duplicate set of libraries for the default endian-ness.
-MULTILIB_OPTIONS = mle/mbe mhard-float
-MULTILIB_DIRNAMES = le be fpu
-MULTILIB_MATCHES = mbe=mbig-endian mle=mlittle-endian
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/arm/t-riscix b/gcc/config/arm/t-riscix
deleted file mode 100644
index e5a2213b83c..00000000000
--- a/gcc/config/arm/t-riscix
+++ /dev/null
@@ -1,3 +0,0 @@
-# Just for these, we omit the frame pointer since it makes such a big
-# difference. It is then pointless adding debugging.
-LIBGCC2_CFLAGS=-O2 -fomit-frame-pointer $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g0
diff --git a/gcc/config/arm/t-semi b/gcc/config/arm/t-semi
deleted file mode 100644
index 2299eada54b..00000000000
--- a/gcc/config/arm/t-semi
+++ /dev/null
@@ -1,10 +0,0 @@
-# Just for these, we omit the frame pointer since it makes such a big
-# difference. It is then pointless adding debugging.
-LIBGCC2_CFLAGS=-O2 -fomit-frame-pointer $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g0
-
-# Don't build enquire
-ENQUIRE=
-
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls
diff --git a/gcc/config/arm/t-semiaof b/gcc/config/arm/t-semiaof
deleted file mode 100644
index 6f1dfca081c..00000000000
--- a/gcc/config/arm/t-semiaof
+++ /dev/null
@@ -1,63 +0,0 @@
-OLDCC = armcc -w
-# Don't build enquire
-ENQUIRE=
-CROSS_LIBGCC1 = libgcc1-aof.a
-LIBGCC2 = libgcc2-aof.a
-LIBGCC = libgcc-aof.a
-LIBGCC2_CFLAGS = -O2 -fomit-frame-pointer
-LIBGCC1_TEST = #libgcc1-atest
-EXTRA_PARTS = crtbegin.o crtend.o
-
-# Rule to build libgcc1.a and libgcc2.a and libgcc.a, since the librarian
-# for the ARM tools is somewhat quirky, and needs a special rule to use it.
-libgcc1-aof.a: libgcc1.c $(CONFIG_H) config.status
- -rm -rf tmplib libgcc1.a libgcc1-aof.a tmplibgcc1.a
- mkdir tmplib
- for name in $(LIB1FUNCS); \
- do \
- echo $${name}; \
- rm -f $${name}$(objext); \
- $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- mv libgcc1$(objext) tmplib/$${name}$(objext); \
- done
- (cd tmplib; \
- armlib -c tmplibgcc1.a *; \
- mv tmplibgcc1.a ..)
- mv tmplibgcc1.a libgcc1-aof.a
- rm -rf tmplib
-
-libgcc2-aof.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
- machmode.h longlong.h gbl-ctors.h config.status
- -rm -f tmplibgcc2.a
- -rm -rf tmplib
- mkdir tmplib
- for name in $(LIB2FUNCS); \
- do \
- echo $${name}; \
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
- $(srcdir)/libgcc2.c -o tmplib/$${name}$(objext); \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- done
- (cd tmplib; \
- armlib -c tmplibgcc2.a *; \
- mv tmplibgcc2.a ..)
- mv tmplibgcc2.a libgcc2-aof.a
- rm -rf tmplib
-
-# Combine the various libraries into a single library, libgcc.a.
-libgcc-aof.a: $(CROSS_LIBGCC1) $(LIBGCC2)
- -rm -rf tmplibgcc.a libgcc.a tmpcopy libgcc-aof.a
- mkdir tmpcopy
- (cd tmpcopy; armlib -e ../$(LIBGCC1) \*)
- -(cd tmpcopy; chmod +w * > /dev/null 2>&1)
- (cd tmpcopy; armlib -e ../$(LIBGCC2) \*)
- (cd tmpcopy; armlib -co ../tmplibgcc.a *$(objext))
- rm -rf tmpcopy
- mv tmplibgcc.a libgcc.a
- ln libgcc.a libgcc-aof.a
-
-libgcc1-atest: libgcc1-test.o native $(GCC_PARTS) $(EXTRA_PARTS)
- @echo "Testing libgcc1. Ignore linker warning messages."
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \
- -v
diff --git a/gcc/config/arm/x-riscix b/gcc/config/arm/x-riscix
deleted file mode 100644
index 7ab40649816..00000000000
--- a/gcc/config/arm/x-riscix
+++ /dev/null
@@ -1,9 +0,0 @@
-# Define new names for the getopt library, so that we don't have to statically
-# link [un]protoize. We have dirent.h not sys/dir.h, so define POSIX.
-X_CFLAGS= -DPOSIX -Dopterr=gcc_opterr -Doptind=gcc_optind \
- -Dgetopt=gcc_getopt -Doptarg=gcc_optarg
-# Compile in BSD mode.
-OLDCC=/usr/ucb/cc
-CC=$(OLDCC)
-FIXPROTO_DEFINES= -D_POSIX_SOURCE -D_XOPEN_C -D_BSD_C -D_XOPEN_SOURCE
-INSTALL=$(srcdir)/install.sh -c
diff --git a/gcc/config/arm/xm-arm.h b/gcc/config/arm/xm-arm.h
deleted file mode 100644
index 00818e75eab..00000000000
--- a/gcc/config/arm/xm-arm.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Configuration for GNU C-compiler for Acorn RISC Machine.
- Copyright (C) 1991, 1993 Free Software Foundation, Inc.
- Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
- and Martin Simmons (@harleqn.co.uk).
- More major hacks by Richard Earnshaw (rwe11@cl.cam.ac.uk)
-
-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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-
-/* A code distinguishing the floating point format of the host
- machine. There are three defined values: IEEE_FLOAT_FORMAT,
- VAX_FLOAT_FORMAT, and UNKNOWN_FLOAT_FORMAT. */
-
-#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
-#define HOST_FLOAT_WORDS_BIG_ENDIAN 1
-
-/* If not compiled with GNU C, use C alloca. */
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-#endif
-
-/* Define this if the library function putenv is available on your machine */
-#define HAVE_PUTENV 1
-
-/* Define this if the library function vprintf is available on your machine */
-#define HAVE_VPRINTF 1
-
-/* Define this to be 1 if you know the host compiler supports prototypes, even
- if it doesn't define __STDC__, or define it to be 0 if you do not want any
- prototypes when compiling GNU CC. */
-#define USE_PROTOTYPES 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* If we have defined POSIX, but are compiling in the BSD environment, then
- we need to define getcwd in terms of getwd. */
-#if defined (POSIX) && defined (_BSD_C)
-#define HAVE_GETWD 1
-#endif
-
-/* EOF xm-arm.h */
-
-
diff --git a/gcc/config/clipper/clipper.c b/gcc/config/clipper/clipper.c
deleted file mode 100644
index 9ee6f444981..00000000000
--- a/gcc/config/clipper/clipper.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/* Subroutines for insn-output.c for Clipper
- Copyright (C) 1987, 1988, 1991 Free Software Foundation, Inc.
-
- Contributed by Holger Teutsch (holger@hotbso.rhein-main.de)
-
-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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "tree.h"
-#include "c-tree.h"
-#include "expr.h"
-#include "flags.h"
-#include "machmode.h"
-
-extern char regs_ever_live[];
-
-extern int frame_pointer_needed;
-
-static int frame_size;
-
-/*
- * compute size of a clipper stack frame where 'lsize' is the required
- * space for local variables.
- */
-
-int
-clipper_frame_size (lsize)
- int lsize;
-{
- int i,size; /* total size of frame */
- int save_size;
- save_size = 0; /* compute size for reg saves */
-
- for (i = 16; i < 32; i++)
- if (regs_ever_live[i] && !call_used_regs[i])
- save_size += 8;
-
- for (i = 0; i < 16; i++)
- if (regs_ever_live[i] && !call_used_regs[i])
- save_size += 4;
-
- size = lsize + save_size;
-
- size = (size + 7) & ~7; /* align to 64 Bit */
- return size;
-}
-
-/*
- * prologue and epilogue output
- * function is entered with pc pushed, i.e. stack is 32 bit aligned
- *
- * current_function_args_size == 0 means that the current function's args
- * are passed totally in registers i.e fp is not used as ap.
- * If frame_size is also 0 the current function does not push anything and
- * can run with misaligned stack -> subq $4,sp / add $4,sp on entry and exit
- * can be omitted.
- *
- */
-void
-output_function_prologue (file, lsize)
- FILE *file;
- int lsize; /* size for locals */
-{
- int i, offset;
- int size;
-
- frame_size = size = clipper_frame_size (lsize);
-
- if (frame_pointer_needed)
- {
- fputs ("\tpushw fp,sp\n", file);
- fputs ("\tmovw sp,fp\n", file);
- }
- else if (size != 0 || current_function_args_size != 0)
- {
- size += 4; /* keep stack aligned */
- frame_size = size; /* must push data or access args */
- }
-
- if (size)
- {
- if (size < 16)
- fprintf (file, "\tsubq $%d,sp\n", size);
- else
- fprintf (file, "\tsubi $%d,sp\n", size);
-
- /* register save slots are relative to sp, because we have small positive
- displacements and this works whether we have a frame pointer or not */
-
- offset = 0;
- for (i = 16; i < 32; i++)
- if (regs_ever_live[i] && !call_used_regs[i])
- {
- if (offset == 0)
- fprintf (file, "\tstord f%d,(sp)\n", i-16);
- else
- fprintf (file, "\tstord f%d,%d(sp)\n", i-16, offset);
- offset += 8;
- }
-
- for (i = 0; i < 16; i++)
- if (regs_ever_live[i] && !call_used_regs[i])
- {
- if (offset == 0)
- fprintf (file, "\tstorw r%d,(sp)\n", i);
- else
- fprintf (file, "\tstorw r%d,%d(sp)\n", i, offset);
- offset += 4;
- }
- }
-}
-
-void
-output_function_epilogue (file, size)
- FILE *file;
- int size; /* ignored */
-{
- int i, offset;
-
- if (frame_pointer_needed)
- {
- offset = -frame_size;
-
- for (i = 16; i < 32; i++)
- if (regs_ever_live[i] && !call_used_regs[i])
- {
- fprintf (file, "\tloadd %d(fp),f%d\n", offset, i-16);
- offset += 8;
- }
-
- for (i = 0; i < 16; i++)
- if (regs_ever_live[i] && !call_used_regs[i])
- {
- fprintf (file, "\tloadw %d(fp),r%d\n", offset, i);
- offset += 4;
- }
-
- fputs ("\tmovw fp,sp\n\tpopw sp,fp\n\tret sp\n",
- file);
- }
-
- else /* no frame pointer */
- {
- offset = 0;
-
- for (i = 16; i < 32; i++)
- if (regs_ever_live[i] && !call_used_regs[i])
- {
- if (offset == 0)
- fprintf (file, "\tloadd (sp),f%d\n", i-16);
- else
- fprintf (file, "\tloadd %d(sp),f%d\n", offset, i-16);
- offset += 8;
- }
-
- for (i = 0; i < 16; i++)
- if (regs_ever_live[i] && !call_used_regs[i])
- {
- if (offset == 0)
- fprintf (file, "\tloadw (sp),r%d\n", i);
- else
- fprintf (file, "\tloadw %d(sp),r%d\n", offset, i);
- offset += 4;
- }
-
- if (frame_size > 0)
- {
- if (frame_size < 16)
- fprintf (file, "\taddq $%d,sp\n", frame_size);
- else
- fprintf (file, "\taddi $%d,sp\n", frame_size);
- }
-
- fputs ("\tret sp\n", file);
- }
-}
-
-/*
- * blockmove
- *
- * clipper_movstr ()
- */
-void
-clipper_movstr (operands)
- rtx *operands;
-{
- rtx dst,src,cnt,tmp,top,bottom,xops[3];
- int align;
- int fixed;
-
- extern FILE *asm_out_file;
-
- dst = operands[0];
- src = operands[1];
- /* don't change this operands[2]; gcc 2.3.3 doesn't honor clobber note */
- align = INTVAL (operands[3]);
- tmp = operands[4];
- cnt = operands[5];
-
- if (GET_CODE (operands[2]) == CONST_INT) /* fixed size move */
- {
- if ((fixed = INTVAL (operands[2])) <= 0)
- abort ();
-
- if (fixed <16)
- output_asm_insn ("loadq %2,%5", operands);
- else
- output_asm_insn ("loadi %2,%5", operands);
- }
- else
- {
- fixed = 0;
- bottom = (rtx)gen_label_rtx (); /* need a bottom label */
- xops[0] = cnt; xops[1] = bottom;
- output_asm_insn ("movw %2,%5", operands); /* count is scratch reg 5 */
- output_asm_insn ("brle %l1", xops);
- }
-
-
- top = (rtx)gen_label_rtx (); /* top of loop label */
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (top));
-
-
- xops[0] = src; xops[1] = tmp; xops[2] = dst;
-
- if (fixed && (align & 0x3) == 0) /* word aligned move with known size */
- {
- if (fixed >= 4)
- {
- rtx xops1[2];
- output_asm_insn(
- "loadw %a0,%1\n\taddq $4,%0\n\tstorw %1,%a2\n\taddq $4,%2",
- xops);
-
- xops1[0] = cnt; xops1[1] = top;
- output_asm_insn ("subq $4,%0\n\tbrgt %l1", xops1);
- }
-
- if (fixed & 0x2)
- {
- output_asm_insn ("loadh %a0,%1\n\tstorh %1,%a2", xops);
- if (fixed & 0x1)
- output_asm_insn ("loadb 2%a0,%1\n\tstorb %1,2%a2", xops);
- }
- else
- if (fixed & 0x1)
- output_asm_insn ("loadb %a0,%1\n\tstorb %1,%a2", xops);
- }
- else
- {
- output_asm_insn(
- "loadb %a0,%1\n\taddq $1,%0\n\tstorb %1,%a2\n\taddq $1,%2",
- xops);
-
- xops[0] = cnt; xops[1] = top;
- output_asm_insn ("subq $1,%0\n\tbrgt %l1", xops);
- }
-
- if (fixed == 0)
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (bottom));
-}
-
-
-print_operand_address (file, addr)
- FILE *file;
- register rtx addr;
-{
- rtx op0,op1;
-
- retry:
- switch (GET_CODE (addr))
- {
- case REG:
- fprintf (file, "(%s)", reg_names[REGNO (addr)]);
- break;
-
- case PLUS:
- /* can be 'symbol + reg' or 'reg + reg' */
-
- op0 = XEXP (addr, 0);
- op1 = XEXP (addr, 1);
-
- if (GET_CODE (op0) == REG && GET_CODE (op1) == REG)
- {
- fprintf (file, "[%s](%s)",
- reg_names[REGNO (op0)], reg_names[REGNO (op1)]);
- break;
- }
-
- if (GET_CODE (op0) == REG && CONSTANT_ADDRESS_P (op1))
- {
- output_addr_const (file, op1);
- fprintf (file, "(%s)", reg_names[REGNO (op0)]);
- break;
- }
-
- if (GET_CODE (op1) == REG && CONSTANT_ADDRESS_P (op0))
- {
- output_addr_const (file, op0);
- fprintf (file, "(%s)", reg_names[REGNO (op1)]);
- break;
- }
- abort (); /* Oh no */
-
- default:
- output_addr_const (file, addr);
- }
-}
-
-
-char *
-rev_cond_name (op)
- rtx op;
-{
- switch (GET_CODE (op))
- {
- case EQ:
- return "ne";
- case NE:
- return "eq";
- case LT:
- return "ge";
- case LE:
- return "gt";
- case GT:
- return "le";
- case GE:
- return "lt";
- case LTU:
- return "geu";
- case LEU:
- return "gtu";
- case GTU:
- return "leu";
- case GEU:
- return "ltu";
-
- default:
- abort ();
- }
-}
-
-
-/* Do what is necessary for `va_start'. The argument is ignored;
- We fill in an initial va_list. A pointer to this constructor
- is returned. */
-
-
-struct rtx_def *
-clipper_builtin_saveregs (arglist)
- tree arglist;
-{
- extern int current_function_varargs;
- rtx block, addr, argsize, scratch, r0_addr,r1_addr,f0_addr,f1_addr;
-
- /* Allocate the va_list constructor + save area for r0,r1,f0,f1 */
-
- block = assign_stack_local (BLKmode,
- (6 + 6) * UNITS_PER_WORD, 2 * BITS_PER_WORD);
-
- RTX_UNCHANGING_P (block) = 1;
- RTX_UNCHANGING_P (XEXP (block, 0)) = 1;
-
- addr = copy_to_reg (XEXP (block, 0));
-
- f0_addr = gen_rtx (PLUS, Pmode, addr, gen_rtx (CONST_INT, Pmode, 24));
- f1_addr = gen_rtx (PLUS, Pmode, addr, gen_rtx (CONST_INT, Pmode, 32));
- r0_addr = gen_rtx (PLUS, Pmode, addr, gen_rtx (CONST_INT, Pmode, 40));
- r1_addr = gen_rtx (PLUS, Pmode, addr, gen_rtx (CONST_INT, Pmode, 44));
-
-
- /* Store float regs */
-
- emit_move_insn (gen_rtx (MEM, DFmode, f0_addr), gen_rtx (REG, DFmode, 16));
- emit_move_insn (gen_rtx (MEM, DFmode, f1_addr), gen_rtx (REG, DFmode, 17));
-
- /* Store int regs */
-
- emit_move_insn (gen_rtx (MEM, SImode, r0_addr), gen_rtx (REG, SImode, 0));
- emit_move_insn (gen_rtx (MEM, SImode, r1_addr), gen_rtx (REG, SImode, 1));
-
- /* Store the arg pointer in the __va_stk member. */
-
- emit_move_insn (gen_rtx (MEM, SImode, addr),
- copy_to_reg (virtual_incoming_args_rtx));
-
-
- /* now move addresses of the saved regs into the pointer array */
-
- scratch = gen_reg_rtx (Pmode);
-
- emit_move_insn (scratch, r0_addr);
- emit_move_insn (gen_rtx (MEM, SImode,
- gen_rtx (PLUS, Pmode, addr,
- gen_rtx (CONST_INT, Pmode, 4))),
- scratch);
-
- emit_move_insn (scratch, f0_addr);
- emit_move_insn (gen_rtx (MEM, SImode,
- gen_rtx (PLUS, Pmode, addr,
- gen_rtx (CONST_INT, Pmode, 8))),
- scratch);
-
- emit_move_insn (scratch, r1_addr);
- emit_move_insn (gen_rtx (MEM, SImode,
- gen_rtx (PLUS, Pmode, addr,
- gen_rtx (CONST_INT, Pmode, 12))),
- scratch);
-
- emit_move_insn (scratch, f1_addr);
- emit_move_insn (gen_rtx (MEM, SImode,
- gen_rtx (PLUS, Pmode, addr,
- gen_rtx (CONST_INT, Pmode, 16))),
- scratch);
-
- /* Return the address of the va_list constructor, but don't put it in a
- register. This fails when not optimizing and produces worse code when
- optimizing. */
-
- return XEXP (block, 0);
-}
-
-
-/* Return truth value of whether OP can be used as an word register
- operand. Reject (SUBREG:SI (REG:SF )) */
-
-int
-int_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode) &&
- (GET_CODE (op) != SUBREG ||
- GET_MODE_CLASS (GET_MODE (SUBREG_REG (op))) == MODE_INT));
-}
-
-/* Return truth value of whether OP can be used as a float register
- operand. Reject (SUBREG:SF (REG:SI )) )) */
-
-int
-fp_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode) &&
- (GET_CODE (op) != SUBREG ||
- GET_MODE_CLASS (GET_MODE (SUBREG_REG (op))) == MODE_FLOAT));
-}
-
diff --git a/gcc/config/clipper/clipper.h b/gcc/config/clipper/clipper.h
deleted file mode 100644
index 9600df34177..00000000000
--- a/gcc/config/clipper/clipper.h
+++ /dev/null
@@ -1,1122 +0,0 @@
-/* Definitions of target machine for GNU compiler. Clipper version.
- Copyright (C) 1987, 88, 91, 93-95, 1996 Free Software Foundation, Inc.
- Contributed by Holger Teutsch (holger@hotbso.rhein-main.de)
-
-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. */
-
-extern struct rtx_def *clipper_builtin_saveregs ();
-extern int clipper_frame_size ();
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fprintf (stderr, " (clipper)");
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { { "c400", 1 }, \
- { "c300", -1 }, \
- { "", TARGET_DEFAULT} }
-
-#define TARGET_C400 1
-#define TARGET_C300 0
-
-/* Default target_flags if no switches specified. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT TARGET_C300
-#endif
-
-/* Show that we can debug generated code without a frame pointer. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* Target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-
-#define WORDS_BIG_ENDIAN 0
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Largest alignment for stack parameters (if greater than PARM_BOUNDARY). */
-#define MAX_PARM_BOUNDARY 64
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 128
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 64
-
-/* No structure field wants to be aligned rounder than this. */
-#define BIGGEST_FIELD_ALIGNMENT 64
-
-/* Make strcpy of constants fast. */
-#define CONSTANT_ALIGNMENT(CODE, TYPEALIGN) \
- ((TYPEALIGN) < 32 ? 32 : (TYPEALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Let's keep the stack somewhat aligned. */
-#define STACK_BOUNDARY 64
-
-/* Define this macro if it is advisable to hold scalars in registers
- in a wider mode than that declared by the program. In such cases,
- the value is constrained to be within the bounds of the declared
- type, but kept valid in the wider mode. The signedness of the
- extension may differ from that of the type.
-
- For Clipper, we always store objects in a full register. */
-
-#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
- { \
- (UNSIGNEDP) = 0; \
- (MODE) = SImode; \
- }
-
-
-/* Define this if function arguments should also be promoted using the above
- procedure. */
-
-/* FIXME: do we loose compatibility to acc if we define this? */
-
-/* #define PROMOTE_FUNCTION_ARGS */
-
-/* Likewise, if the function return value is promoted. */
-
-/* #define PROMOTE_FUNCTION_RETURN */
-
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-#define FIRST_PSEUDO_REGISTER 32
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the clipper, these are the FP and SP . */
-#define FIXED_REGISTERS \
-{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,\
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} /* Default: C300 */
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
-{1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,\
- 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1} /* default: C300 */
-
-/* Zero or more C statements that may conditionally modify two
- variables `fixed_regs' and `call_used_regs' (both of type `char
- []') after they have been initialized from the two preceding
- macros. A C400 has additional floating registers f8 -> f15 */
-
-#define CONDITIONAL_REGISTER_USAGE \
- if (target_flags & TARGET_C400) \
- { int i; \
- for (i = 24; i < 32; i++) fixed_regs[i] = call_used_regs[i] = 0; }
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
- On the clipper, fp registers are 64 bits. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((REGNO) >= 16 ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the clipper 0-15 may hold any mode but DImode and DFmode must be even.
- Registers 16-31 hold SFmode and DFmode */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((REGNO) < 16 \
- ? ((MODE) != DImode && (MODE) != DFmode || ((REGNO) & 1) == 0) \
- : ((MODE) == SFmode || (MODE) == DFmode))
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) == (MODE2))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* clipper has extra PC */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 15
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 14
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED \
- (! leaf_function_p ())
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 2
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 0
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The clipper has general and FP regs. */
-
-enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS, LIM_REG_CLASSES};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS {0, 0x0000ffff, 0xffff0000, 0xffffffff}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) ((REGNO) >= 16 ? FLOAT_REGS : GENERAL_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'r' ? GENERAL_REGS : ((C) == 'f' ? FLOAT_REGS: NO_REGS))
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) 0
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
-
-/* Optional extra constraints for this machine. */
-
-/* #define EXTRA_CONSTRAINT(OP, C) */
-
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FLOAT_REGS \
- ? 1 \
- : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* Define this if longjmp restores from saved registers
- rather than from what setjmp saved. */
-/* #define LONGJMP_RESTORE_FROM_STACK */
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* Given an rtx for the address of a frame,
- return an rtx for the address of the word in the frame
- that holds the dynamic chain--the previous frame's address. */
-#define DYNAMIC_CHAIN_ADDRESS(frame) (frame)
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by. */
-
-/* #define PUSH_ROUNDING(BYTES) (BYTES) */
-
-/* Keep the stack pointer constant throughout the function. */
-/* we can't set this for clipper as library calls may have 3 args and we pass
- only 2 args in regs. */
-
-/* #define ACCUMULATE_OUTGOING_ARGS */
-
-
-/* Offset of first parameter from the argument pointer register value.
- size of PC + FP */
-
-#define FIRST_PARM_OFFSET(FNDECL) 8
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), ((TYPE_MODE (VALTYPE) == SFmode ||\
- TYPE_MODE (VALTYPE) == DFmode) ? \
- 16 : 0))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, (MODE), ((MODE) == SFmode || (MODE) == DFmode ? 16 : 0))
-
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N) == 16)
-
-/* 1 if N is a possible register number for function argument passing. */
-
-#define FUNCTION_ARG_REGNO_P(N) \
- ((N) == 0 || (N) == 1 || (N) == 16 || (N) == 17)
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. Old Green Hills C-Clipper returns static
- structs but the newer Apogee compiler passes structs as hidden arg 0.
- Structs etc are always passed in memory */
-
-/* #define PCC_STATIC_STRUCT_RETURN */
-
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- Clipper uses 2 register 'slots' that pass arguments in r0/r1 or f0/f1.
- An argument that must be passed in memory (struct... ) leaves that slot
- free.
- We pass 'long long' only in registers when both slots are free.
- Returned structs must be allocated by the caller, the address is passed
- in r0.
-
- struct ss {..}
-
- fun (i,j,k) i in r0, j in r1, k on stack
- fun (s,j,k) s on stack, j in r1, k on stack
- fun (i,s,k) i in r0, s on stack, k on stack
- s1 = fun (i,s,k) &s1 in r0, i in r1, s on stack, k on stack
-
- We must keep enough information for varargs/stdargs.
-
- _clipper_cum_args is a struct of 2 integers, with
- num = slots used
- size = size of all stack args = offset to next arg without alignment
-
- If we use stdarg.h, size points to the first unnamed arg,
- see va-clipper.h */
-
-struct _clipper_cum_args { int num; int size; };
-
-#define CUMULATIVE_ARGS struct _clipper_cum_args
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- clipper passes the address of a struct in r0, set num = 1 in this case */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM).num = ((FNTYPE) != 0 && aggregate_value_p (TREE_TYPE (FNTYPE))), \
- (CUM).size = 0)
-
-/* internal helper : size of an argument */
-
-#define CLIPPER_ARG_SIZE(MODE, TYPE) \
-(((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
- : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD) \
- * UNITS_PER_WORD)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
-do \
-{ \
- int reg = 0; \
- \
- if ((CUM).num < 2 \
- && (GET_MODE_CLASS(MODE)==MODE_INT || GET_MODE_CLASS(MODE)==MODE_FLOAT) \
- && (GET_MODE_SIZE (MODE) <= 8) \
- && ((TYPE) == NULL || !AGGREGATE_TYPE_P(TYPE)) \
- && ((MODE) != DImode || (CUM).num == 0)) \
- { \
- reg = 1; \
- if ((MODE) == DImode) \
- (CUM).num = 1; \
- } \
- \
- (CUM).num++; \
- \
- if (! reg) \
- { \
- int align = FUNCTION_ARG_BOUNDARY (MODE, TYPE) / BITS_PER_UNIT; \
- (CUM).size += align - 1; \
- (CUM).size &= ~(align - 1); \
- (CUM).size += CLIPPER_ARG_SIZE (MODE, TYPE); \
- } \
-} while (0)
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- 2 args may go into regs. These must be MODE_INT or MODE_FLOAT but only
- if they really fit into ONE register. The exception is a DImode arg
- that occupies both register slots. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- (((CUM).num < 2 \
- && (GET_MODE_CLASS(MODE)==MODE_INT || GET_MODE_CLASS(MODE)==MODE_FLOAT) \
- && (GET_MODE_SIZE (MODE) <= 8) \
- && ((TYPE) == NULL || !AGGREGATE_TYPE_P(TYPE)) \
- && ((MODE) != DImode || (CUM).num == 0)) \
- ? gen_rtx (REG, (MODE), \
- GET_MODE_CLASS(MODE) == MODE_FLOAT ? (CUM).num+16 : (CUM).num) \
- : 0)
-
-/* If defined, a C expression that gives the alignment boundary, in bits,
- of an argument with the specified mode and type. If it is not defined,
- `PARM_BOUNDARY' is used for all arguments. */
-
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
- (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_SIZE (MODE)) <= PARM_BOUNDARY \
- ? PARM_BOUNDARY : 2 * PARM_BOUNDARY)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero.
- Clipper never passed args partially in regs/mem. */
-
-/* #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0 */
-
-/* Generate necessary RTL for __builtin_saveregs().
- ARGLIST is the argument list; see expr.c. */
-
-#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) clipper_builtin_saveregs (ARGLIST)
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) output_function_prologue (FILE,SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) /* FIXME */
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) /* FIXME */
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. */
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) /* FIXME */
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) output_function_epilogue(FILE,SIZE)
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
- DEPTH = clipper_frame_size (get_frame_size ())
-
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fputs ("\t.word 0x459F,0x0004\t# call sp,.+4\n", FILE); \
- fputs ("\tmovw (sp),r3\n", FILE); \
- fputs ("\taddq $4,sp\n", FILE); \
- fputs ("\tloadw 20(r3),r2\n", FILE); \
- fputs ("\tloadw 24(r3),r3\n", FILE); \
- fputs ("\tb (r3)\n", FILE); \
- fputs ("\t.long 0,0\n", FILE); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 32
-
-/* Alignment required for a trampoline. 128 is used to find the
- beginning of a line in the instruction cache and to allow for
- instruction cache lines of up to 128 bytes. */
-
-#define TRAMPOLINE_ALIGNMENT 128
-
-/* Section in which to place the trampoline. */
-
-#define TRAMPOLINE_SECTION text_section
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 24)), CXT); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 28)), FNADDR); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(regno) \
-((regno) < 16 || (unsigned)reg_renumber[regno] < 16)
-#define REGNO_OK_FOR_BASE_P(regno) \
-((regno) < 16 || (unsigned)reg_renumber[regno] < 16)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* 1 if X is an rtx for a constant that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
- /* clipper doesn't have true indexing */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-
-#define REG_OK_FOR_INDEX_P(X) \
- (REGNO (X) < 16 || REGNO(X) >= FIRST_PSEUDO_REGISTER)
-
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-
-#define REG_OK_FOR_BASE_P(X) \
- (REGNO (X) < 16 || REGNO(X) >= FIRST_PSEUDO_REGISTER)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) (REGNO(X) < 16)
-
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) (REGNO(X) < 16)
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
- except for CONSTANT_ADDRESS_P which is actually machine-independent. */
-
-/* Non-zero if X is an address which can be indirected. */
-
-#define INDIRECTABLE_CONSTANT_ADDRESS_P(X) 0
-
-#define INDIRECTABLE_ADDRESS_P(X) \
- (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
-
-/* Go to ADDR if X is a valid address not using indexing.
- (This much is the easy part.) */
-
-#define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
-{ if (CONSTANT_ADDRESS_P (X)) goto ADDR; \
- if (INDIRECTABLE_ADDRESS_P (X)) goto ADDR; }
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ register rtx xfoo = (X); \
- GO_IF_NONINDEXED_ADDRESS (xfoo, ADDR); \
- if (GET_CODE (xfoo) == PLUS) \
- { register rtx xfoo0, xfoo1; \
- xfoo0 = XEXP (xfoo, 0); \
- xfoo1 = XEXP (xfoo, 1); \
- /* handle reg + reg -> [r1](r0) */ \
- if (INDIRECTABLE_ADDRESS_P (xfoo0) && INDIRECTABLE_ADDRESS_P (xfoo1)) \
- goto ADDR; \
- /* Handle <symbol>(reg) -> xxx(r0) */ \
- if (INDIRECTABLE_ADDRESS_P (xfoo0) && CONSTANT_ADDRESS_P (xfoo1)) \
- goto ADDR; \
- if (INDIRECTABLE_ADDRESS_P (xfoo1) && CONSTANT_ADDRESS_P (xfoo0)) \
- goto ADDR; }}
-
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the clipper, nothing needs to be done. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
-
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the case instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Define this if the case instruction drops through after the table
- when the index is out of range. Don't define it if the case insn
- jumps to the default label instead. */
-/* #define CASE_DROPS_THROUGH */
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* MOVE_RATIO is the number of move instructions that is better than a
- block move. Make this large on clipper, since the block move is very
- inefficient with small blocks, and the hard register needs of the
- block move require much reload work. */
-
-#define MOVE_RATIO 20
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* This machine uses IEEE floats. */
-
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
-/* Check a `double' value for validity for a particular machine mode.
- This is defined to avoid crashes outputting certain constants.
- Since we output the number in hex, the assembler won't choke on it. */
-/* #define CHECK_FLOAT_VALUE(MODE,VALUE) */
-
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-/* On a Clipper, constants from 0..15 are cheap because they can use the
- 'quick' mode. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (0 <= INTVAL (RTX) && INTVAL(RTX) <= 15 ) return 0; \
- return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 3; \
- case CONST_DOUBLE: \
- return 5;
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. */
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MULT: \
- return COSTS_N_INSNS (4); \
- case DIV: \
- case UDIV: \
- case MOD: \
- case UMOD: \
- return COSTS_N_INSNS (40); \
- case ASHIFT: \
- case LSHIFTRT: \
- case ASHIFTRT: \
- return COSTS_N_INSNS (2); \
- case SIGN_EXTEND: \
- return (GET_CODE (XEXP (X,0)) == REG ? COSTS_N_INSNS (3) : 4);
-
-/* Specify the cost of a branch insn; roughly the number of extra insns that
- should be added to avoid a branch */
-
-/* #define BRANCH_COST 0 */
-
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). No extra ones are needed for the clipper. */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ \
- enum attr_cc cc = get_attr_cc (INSN); \
- rtx dest = SET_DEST (EXP); \
- switch (cc) \
- { \
- case CC_CHANGE0: \
- if (GET_CODE (EXP) == PARALLEL) abort(); \
- if (cc_status.value1 && rtx_equal_p (dest, cc_status.value1) || \
- cc_status.value2 && rtx_equal_p (dest, cc_status.value2)) \
- CC_STATUS_INIT; \
- break; \
- \
- case CC_SET1: \
- if (GET_CODE (EXP) == PARALLEL) abort(); \
- cc_status.flags = 0; \
- cc_status.value1 = dest; \
- cc_status.value2 = 0; \
- break; \
- \
- case CC_SET2: \
- if (GET_CODE (EXP) == PARALLEL) abort(); \
- cc_status.flags = 0; \
- cc_status.value1 = dest; \
- cc_status.value2 = SET_SRC (EXP); \
- break; \
- \
- case CC_UNCHANGED: \
- break; \
- \
- case CC_CLOBBER: \
- CC_STATUS_INIT; \
- break; \
- \
- default: \
- abort (); \
- } \
-}
-
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n");
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "#APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
- "r9", "r10", "r11", "r12", "r13", "fp", "sp", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", \
- "f9", "f10", "f11", "f12", "f13", "f14", "f15" }
-
-/* How to renumber registers for dbx and gdb.
- Clipper needs no change in the numeration. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tsubq $8,sp\n\t%s %s,(sp)\n", \
- (REGNO) < 16 ? "storw" : "stord", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\t%s (sp),%s\n\t\addq $8,sp\n", \
- (REGNO) < 16 ? "loadw" : "loadd", reg_names[REGNO])
-/* This is how to output an element of a case-vector that is absolute */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.long .L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-/* ??? The use of .bss here seems odd. */
-
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE,NAME,SIZE,ALIGN) \
-( data_section (), \
- fputs ("\t.bss\t", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN)/BITS_PER_UNIT))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print an instruction operand X on file FILE.
- CODE is the code from the %-spec that requested printing this operand;
- if `%z3' was used to print operand 3, then CODE is 'z'.
-
-Clipper operand formatting codes:
-
- letter print
- C reverse branch condition
-*/
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == 'C')
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ extern char *rev_cond_name (); \
- if (CODE == 'C') \
- fputs (rev_cond_name (X), FILE); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else { putc ('$', FILE); output_addr_const (FILE, X); }}
-
-/* Print a memory operand whose address is X, on file FILE.
- This uses a function in output-clipper.c. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address (FILE, ADDR)
-
-/* Define the codes that are matched by predicates in clipper.c */
-
-#define PREDICATE_CODES \
- {"int_reg_operand", {SUBREG, REG}}, \
- {"fp_reg_operand", {SUBREG, REG}},
diff --git a/gcc/config/clipper/clipper.md b/gcc/config/clipper/clipper.md
deleted file mode 100644
index 6790240184c..00000000000
--- a/gcc/config/clipper/clipper.md
+++ /dev/null
@@ -1,1423 +0,0 @@
-;;- Machine description for GNU compiler, Clipper Version
-;; Copyright (C) 1987, 1988, 1991, 1993, 1994 Free Software Foundation, Inc.
-;; Contributed by Holger Teutsch (holger@hotbso.rhein-main.de)
-
-;; 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.
-
-
-;;- Instruction patterns. When multiple patterns apply,
-;;- the first one in the file is chosen.
-;;-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-;;-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-;;
-;; define attributes
-;;
-;; instruction type
-;;
-;; unknown is temporary in order to generate 'cc clobber' until attribute
-;; assignment is consistent
-;;
-(define_attr "type" "load,store,arith,fp,branch,unknown"
- (const_string "unknown"))
-
-;; condition code setting
-;;
-;; clobber destroyed
-;; unchanged
-;; set1 set cc_status.value1, e.g. sub r0,r1
-;; set2 set value1 and value2, e.g. mov r0,r1
-;; change0 may be side effect, i.e. load mem,r0
-;;
-;; note: loadi and loadq are 'arith' instructions that set the condition codes
-;; mul,div,mod do NOT set the condition codes
-;;
-(define_attr "cc" "clobber,unchanged,set1,set2,change0"
- (cond [(eq_attr "type" "load") (const_string "change0")
- (eq_attr "type" "store,branch") (const_string "unchanged")
- (eq_attr "type" "arith") (if_then_else (match_operand:SI 0 "" "")
- (const_string "set1")
- (const_string "clobber"))
- ]
- (const_string "clobber")))
-
-;;
-;; clipper seems to be a traditional risc processor
-;; we define a functional unit 'memory'
-;;
-(define_function_unit "memory" 1 1 (eq_attr "type" "load") 4 0)
-
-
-;; We don't want to allow a constant operand for test insns because
-;; (set (cc0) (const_int foo)) has no mode information. Such insns will
-;; be folded while optimizing anyway.
-
-(define_insn "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "int_reg_operand" "r"))]
- ""
- "cmpq $0,%0")
-
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "r,r,n")
- (match_operand:SI 1 "nonmemory_operand" "r,n,r")))]
- ""
- "*
-{
- int val;
-
- if (which_alternative == 0)
- return \"cmpw %1,%0\";
-
- if (which_alternative == 1)
- {
- val = INTVAL (operands[1]);
- if (0 <= val && val < 16)
- return \"cmpq %1,%0\";
- return \"cmpi %1,%0\";
- }
-
- cc_status.flags |= CC_REVERSED; /* immediate must be first */
-
- val = INTVAL (operands[0]);
-
- if (0 <= val && val < 16)
- return \"cmpq %0,%1\";
-
- return \"cmpi %0,%1\";
-}")
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "fp_reg_operand" "f")
- (match_operand:DF 1 "fp_reg_operand" "f")))]
- ""
- "cmpd %1,%0")
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "fp_reg_operand" "f")
- (match_operand:SF 1 "fp_reg_operand" "f")))]
- ""
- "cmps %1,%0")
-
-
-;;
-;; double and single float move
-;;
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- operands[1] = force_reg (DFmode,
- force_const_mem (DFmode, operands[1]));
- else if (GET_CODE (operands[1]) != REG)
- operands[1] = force_reg (DFmode, operands[1]);
- }
-
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- operands[1] = force_const_mem (DFmode, operands[1]);
-}")
-
-;;
-;; provide two patterns with different predicates as we don't want combine
-;; to recombine a mem -> mem move
-;;
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=*rf")
- (match_operand:DF 1 "nonimmediate_operand" "*rfo"))]
- ""
- "*
-{
-#define FP_REG_P(X) (GET_CODE (X) == REG && REGNO (X) >= 16)
-
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1])) /* f -> f */
- return \"movd %1,%0\";
-
- if (GET_CODE (operands[1]) == REG) /* r -> f */
- return \"movld %1,%0\";
-
- return \"loadd %1,%0\"; /* m -> f */
- }
-
- if (FP_REG_P (operands[1]))
- {
- if (GET_CODE (operands[0]) == REG) /* f -> r */
- return \"movdl %1,%0\";
-
- abort ();
- }
-
- if (GET_CODE (operands[1]) == MEM) /* m -> r */
- {
- rtx xops[4];
- xops[0] = operands[0];
- xops[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- xops[2] = operands[1];
- xops[3] = adj_offsettable_operand (operands[1], 4);
- output_asm_insn (\"loadw %2,%0\;loadw %3,%1\", xops);
- return \"\";
- }
-
- if (GET_CODE (operands[1]) == REG) /* r -> r */
- {
- rtx xops[4];
- xops[0] = operands[0];
- xops[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- xops[2] = operands[1];
- xops[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"movw %2,%0\;movw %3,%1\", xops);
- return \"\";
- }
-
- abort ();
-#undef FP_REG_P
-}")
-
-
-(define_insn ""
- [(set (match_operand:DF 0 "memory_operand" "=o,m")
- (match_operand:DF 1 "register_operand" "*rf,f"))]
- ""
- "*
-{
- rtx xops[4];
-
- if (REGNO (operands[1]) >= 16) /* f -> m */
- return \"stord %1,%0\";
-
- xops[0] = operands[0]; /* r -> o */
- xops[1] = adj_offsettable_operand (operands[0], 4);
- xops[2] = operands[1];
- xops[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"storw %2,%0\;storw %3,%1\", xops);
- return \"\";
-}"
-[(set_attr "type" "store,store")
- (set_attr "cc" "clobber,unchanged")])
-
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- operands[1] = force_reg (SFmode,
- force_const_mem (SFmode, operands[1]));
- else if (GET_CODE (operands[1]) != REG)
- operands[1] = force_reg (SFmode, operands[1]);
- }
-
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- operands[1] = force_const_mem (SFmode, operands[1]);
-}")
-
-;;
-;; provide two patterns with different predicates as we don't want combine
-;; to recombine a mem -> mem move
-;;
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=*rf")
- (match_operand:SF 1 "nonimmediate_operand" "*rfm"))]
- ""
- "*
-{
-#define FP_REG_P(X) (GET_CODE (X) == REG && REGNO (X) >= 16)
-
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1])) /* f -> f */
- return \"movs %1,%0\";
- if (GET_CODE (operands[1]) == REG) /* r -> f */
- return
- \"subq $8,sp\;storw %1,(sp)\;loads (sp),%0\;addq $8,sp\";
- return \"loads %1,%0\"; /* m -> f */
- }
-
- if (FP_REG_P (operands[1]))
- {
- if (GET_CODE (operands[0]) == REG) /* f -> r */
- return
- \"subq $8,sp\;stors %1,(sp)\;loadw (sp),%0\;addq $8,sp\";
- abort ();
- }
-
- if (GET_CODE (operands[1]) == MEM) /* m -> r */
- return \"loadw %1,%0\";
-
- if (GET_CODE (operands[1]) == REG) /* r -> r */
- return \"movw %1,%0\";
-
- abort ();
-#undef FP_REG_P
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "memory_operand" "=m")
- (match_operand:SF 1 "register_operand" "*rf"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) >= 16)
- return \"stors %1,%0\"; /* f-> m */
-
- return \"storw %1,%0\"; /* r -> m */
-}"
-[(set_attr "type" "store")])
-
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) != REG)
- operands[1] = force_reg (DImode, operands[1]);
-}")
-
-;; If an operand is a MEM but not offsettable, we can't load it into
-;; a register, so we must force the third alternative to be the one
-;; reloaded. Hence we show the first as more expensive.
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=?r,r,r")
- (match_operand:DI 1 "general_operand" "r,n,o"))]
- ""
- "*
-{
- rtx xoperands[2],yoperands[2];
-
- xoperands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
-
- if (which_alternative == 0) /* r -> r */
- {
- output_asm_insn (\"movw %1,%0\", operands);
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"movw %1,%0\", xoperands);
- return \"\";
- }
-
- if (which_alternative == 1) /* n -> r */
- {
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- output_asm_insn (\"loadi %1,%0\", operands);
- output_asm_insn (\"loadq $0,%0\", xoperands);
- return \"\";
- }
-
- if (GET_CODE (operands[1]) != CONST_DOUBLE)
- abort ();
-
- yoperands[0] = operands[0];
- yoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[1]));
- output_asm_insn (\"loadi %1,%0\", yoperands);
-
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[1]));
- output_asm_insn (\"loadi %1,%0\", xoperands);
- return \"\";
- }
- /* m -> r */
- output_asm_insn (\"loadw %1,%0\", operands);
- xoperands[1] = adj_offsettable_operand (operands[1], 4);
- output_asm_insn (\"loadw %1,%0\", xoperands);
- return \"\";
-}"
-[(set_attr "type" "arith,arith,load")
- (set_attr "cc" "clobber,clobber,clobber")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "memory_operand" "=o")
- (match_operand:DI 1 "register_operand" "r"))]
- ""
- "*
-{
- rtx xops[4];
- xops[0] = operands[0];
- xops[1] = adj_offsettable_operand (operands[0], 4);
- xops[2] = operands[1];
- xops[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"storw %2,%0\;storw %3,%1\", xops);
- return \"\";
-}"
-[(set_attr "type" "store")
- (set_attr "cc" "clobber")])
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM &&
- GET_CODE (operands[1]) != REG)
- operands[1] = force_reg (SImode, operands[1]);
-}")
-
-;; Reject both args with `general_operand' if not reloading because a
-;; mem -> mem move that was split by 'movsi' can be recombined to
-;; mem -> mem by the combiner.
-;;
-;; As a pseudo register can end up in a stack slot during reloading we must
-;; allow a r->m move for the next pattern.
-;; The first predicate must be `general_operand' because a predicate must
-;; be true for each constraint.
-;;
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r,r,r,r,m")
- (match_operand:SI 1 "general_operand" "r,m,n,i,r"))]
- "reload_in_progress || register_operand (operands[0], SImode)"
- "*
-{
- int val;
-
- if (which_alternative == 0)
- return \"movw %1,%0\"; /* reg -> reg */
-
- if (which_alternative == 1)
- return \"loadw %1,%0\"; /* mem -> reg */
-
- if (which_alternative == 2)
- {
- val = INTVAL (operands[1]); /* known const ->reg */
-
- if (val == -1)
- return \"notq $0,%0\";
-
- if (val < 0 || val >= 16)
- return \"loadi %1,%0\";
-
- return \"loadq %1,%0\";
- }
-
- if (which_alternative == 3) /* unknown const */
- return \"loada %a1,%0\";
-
- return \"storw %1,%0\";
-}"
-[(set_attr "type" "arith,load,arith,load,store")
- (set_attr "cc" "set2,change0,set1,change0,unchanged")])
-
-
-(define_insn ""
- [(set (match_operand:SI 0 "memory_operand" "=m")
- (match_operand:SI 1 "int_reg_operand" "r"))]
- ""
- "storw %1,%0"
-[(set_attr "type" "store")])
-
-;; movhi
-;;
-;; loadh mem to reg
-;; storh reg to mem
-;;
-;;
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM
- && ! register_operand (operands[1], HImode))
- operands[1] = force_reg (HImode, operands[1]);
-}")
-
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,r,r")
- (match_operand:HI 1 "general_operand" "r,m,n"))]
- ""
- "@
- movw %1,%0
- loadh %1,%0
- loadi %1,%0"
-[(set_attr "type" "arith,load,arith")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "memory_operand" "=m")
- (match_operand:HI 1 "register_operand" "r"))]
- ""
- "storh %1,%0"
- [(set_attr "type" "store")])
-
-;; movqi
-;;
-;; loadb mem to reg
-;; storb reg to mem
-;;
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM &&
- ! register_operand (operands[1], QImode))
- operands[1] = force_reg (QImode, operands[1]);
-}")
-
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r,r,r")
- (match_operand:QI 1 "general_operand" "r,m,n"))]
- ""
- "@
- movw %1,%0
- loadb %1,%0
- loadi %1,%0"
-[(set_attr "type" "arith,load,arith")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "memory_operand" "=m")
- (match_operand:QI 1 "register_operand" "r"))]
- ""
- "storb %1,%0"
-[(set_attr "type" "store")])
-
-
-;;
-;; block move
-;;
-(define_expand "movstrsi"
- [(parallel
- [(set (match_operand:BLK 0 "memory_operand" "")
- (match_operand:BLK 1 "memory_operand" ""))
- (use (match_operand:SI 2 "general_operand" ""))
- (use (match_operand:SI 3 "const_int_operand" ""))
- (clobber (match_scratch:SI 4 ""))
- (clobber (match_scratch:SI 5 ""))
- (clobber (match_dup 6))
- (clobber (match_dup 7))])]
- ""
- "
-{
- rtx addr0, addr1;
-
- addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
- addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
-
- operands[6] = addr0;
- operands[7] = addr1;
-
- operands[0] = gen_rtx (MEM, BLKmode, addr0);
- operands[1] = gen_rtx (MEM, BLKmode, addr1);
-
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = force_reg (SImode, operands[2]);
-}")
-
-;;
-;; there is a problem with this insn in gcc-2.2.3
-;; (clobber (match_dup 2)) does not prevent use of this operand later
-;; we always use a scratch register and leave operand 2 unchanged
-;;
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "r"))
- (mem:BLK (match_operand:SI 1 "register_operand" "r")))
- (use (match_operand:SI 2 "nonmemory_operand" "rn"))
- (use (match_operand:SI 3 "const_int_operand" "n"))
- (clobber (match_scratch:SI 4 "=r"))
- (clobber (match_scratch:SI 5 "=r"))
- (clobber (match_dup 0))
- (clobber (match_dup 1))]
- ""
- "*
-{
- extern void clipper_movstr ();
- clipper_movstr (operands);
- return \"\";
-}"
-[(set_attr "cc" "clobber")])
-
-
-
-;; Extension and truncation insns.
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
- (sign_extend:SI (match_operand:HI 1 "general_operand" "0,m")))]
- ""
- "@
- andi $65535,%0\;xori $32768,%0\;subi $32768,%0
- loadh %1,%0"
-[(set_attr "type" "arith,load")])
-
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "int_reg_operand" "=r,r")
- (sign_extend:HI (match_operand:QI 1 "general_operand" "0,m")))]
- ""
- "@
- andi $255,%0\;xori $128,%0\;subi $128,%0
- loadb %1,%0"
-[(set_attr "type" "arith,load")
- (set_attr "cc" "set1,change0")])
-
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
- (sign_extend:SI (match_operand:QI 1 "general_operand" "0,m")))]
- ""
- "@
- andi $255,%0\;xori $128,%0\;subi $128,%0
- loadb %1,%0"
-[(set_attr "type" "arith,load")])
-
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "fp_reg_operand" "=f")
- (float_extend:DF (match_operand:SF 1 "fp_reg_operand" "f")))]
- ""
- "cnvsd %1,%0")
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "fp_reg_operand" "=f")
- (float_truncate:SF (match_operand:DF 1 "fp_reg_operand" "f")))]
- ""
- "cnvds %1,%0")
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
- (zero_extend:SI (match_operand:HI 1 "general_operand" "0,m")))]
- ""
- "@
- andi $65535,%0
- loadhu %1,%0"
-[(set_attr "type" "arith,load")])
-
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "int_reg_operand" "=r,r")
- (zero_extend:HI (match_operand:QI 1 "general_operand" "0,m")))]
- ""
- "@
- andi $255,%0
- loadbu %1,%0"
-[(set_attr "type" "arith,load")
- (set_attr "cc" "clobber,clobber")])
-
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
- (zero_extend:SI (match_operand:QI 1 "general_operand" "0,m")))]
- ""
- "@
- andi $255,%0
- loadbu %1,%0"
-[(set_attr "type" "arith,load")])
-
-
-
-;; Fix-to-float conversion insns.
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "fp_reg_operand" "=f")
- (float:SF (match_operand:SI 1 "int_reg_operand" "r")))]
- ""
- "cnvws %1,%0")
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "fp_reg_operand" "=f")
- (float:DF (match_operand:SI 1 "int_reg_operand" "r")))]
- ""
- "cnvwd %1,%0")
-
-
-;; Float-to-fix conversion insns.
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (fix:SI (fix:SF (match_operand:SF 1 "fp_reg_operand" "f"))))]
- ""
- "cnvtsw %1,%0")
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (fix:SI (fix:DF (match_operand:DF 1 "fp_reg_operand" "f"))))]
- ""
- "cnvtdw %1,%0")
-
-;;- All kinds of add instructions.
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "fp_reg_operand" "=f")
- (plus:DF (match_operand:DF 1 "fp_reg_operand" "0")
- (match_operand:DF 2 "fp_reg_operand" "f")))]
- ""
- "addd %2,%0"
- [(set_attr "type" "fp")])
-
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "fp_reg_operand" "=f")
- (plus:SF (match_operand:SF 1 "fp_reg_operand" "0")
- (match_operand:SF 2 "fp_reg_operand" "f")))]
- ""
- "adds %2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (plus:DI (match_operand:DI 1 "int_reg_operand" "%0")
- (match_operand:DI 2 "int_reg_operand" "r")))]
- ""
- "*
-{
- rtx xoperands[4];
-
- xoperands[0] = operands[0];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- xoperands[2] = operands[2];
- xoperands[3] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
- output_asm_insn (\"addw %2,%0\;addwc %3,%1\", xoperands);
- return \"\";
-}"
-[(set_attr "type" "arith")
- (set_attr "cc" "clobber")])
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r,r")
- (plus:SI (match_operand:SI 1 "int_reg_operand" "%0,r,r")
- (match_operand:SI 2 "nonmemory_operand" "rn,0,rn")))]
- ""
- "*
-{
- if (which_alternative == 2) /* 3 address version */
- {
- if (GET_CODE (operands[2]) == CONST_INT)
- return \"loada %a2(%1),%0\";
- return \"loada [%2](%1),%0\";
- }
- /* 2 address version */
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int val = INTVAL (operands[2]);
-
- if (val >= 16 || val == 0x80000000)
- return \"addi %2,%0\";
-
- if (val < 0) /* change to sub */
- {
- rtx xops[2];
-
- val = -val;
-
- xops[0] = operands[0];
- xops[1] = gen_rtx (CONST_INT, VOIDmode, val);
-
- if (val >= 16)
- output_asm_insn (\"subi %1,%0\", xops);
- else
- output_asm_insn (\"subq %1,%0\", xops);
-
- return \"\";
- }
-
- return \"addq %2,%0\";
- }
-
- if (which_alternative == 0)
- return \"addw %2,%0\";
-
- return \"addw %1,%0\";
-}"
-[(set_attr "type" "arith,arith,arith")
- (set_attr "cc" "set1,set1,change0")])
-
-
-;;- All kinds of subtract instructions.
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (minus:DI (match_operand:DI 1 "int_reg_operand" "0")
- (match_operand:DI 2 "int_reg_operand" "r")))]
- ""
- "*
-{
- rtx xoperands[4];
-
- xoperands[0] = operands[0];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- xoperands[2] = operands[2];
- xoperands[3] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
- output_asm_insn (\"subw %2,%0\;subwc %3,%1\", xoperands);
- return \"\";
-}"
-[(set_attr "type" "arith")
- (set_attr "cc" "clobber")])
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (minus:SI (match_operand:SI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "nonmemory_operand" "rn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int val = INTVAL (operands[2]);
-
- if (val < 0 || val >= 16)
- return \"subi %2,%0\";
- else
- return \"subq %2,%0\";
- }
-
- return \"subw %2,%0\";
-}"
-[(set_attr "type" "arith")])
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "fp_reg_operand" "=f")
- (minus:DF (match_operand:DF 1 "fp_reg_operand" "0")
- (match_operand:DF 2 "fp_reg_operand" "f")))]
- ""
- "subd %2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "fp_reg_operand" "=f")
- (minus:SF (match_operand:SF 1 "fp_reg_operand" "0")
- (match_operand:SF 2 "fp_reg_operand" "f")))]
- ""
- "subs %2,%0"
- [(set_attr "type" "fp")])
-
-
-;;- Multiply instructions.
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "fp_reg_operand" "=f")
- (mult:DF (match_operand:DF 1 "fp_reg_operand" "0")
- (match_operand:DF 2 "fp_reg_operand" "f")))]
- ""
- "muld %2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "fp_reg_operand" "=f")
- (mult:SF (match_operand:SF 1 "fp_reg_operand" "0")
- (match_operand:SF 2 "fp_reg_operand" "f")))]
- ""
- "muls %2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "mulsidi3"
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "int_reg_operand" "%0"))
- (sign_extend:DI (match_operand:SI 2 "int_reg_operand" "r"))))]
- ""
- "mulwx %2,%0"
-[(set_attr "type" "arith")
- (set_attr "cc" "clobber")])
-
-(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "int_reg_operand" "%0"))
- (zero_extend:DI (match_operand:SI 2 "int_reg_operand" "r"))))]
- ""
- "mulwux %2,%0"
-[(set_attr "type" "arith")
- (set_attr "cc" "clobber")])
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (mult:SI (match_operand:SI 1 "int_reg_operand" "%0")
- (match_operand:SI 2 "int_reg_operand" "r")))]
- ""
- "mulw %2,%0"
- [(set_attr "type" "arith")
- (set_attr "cc" "clobber")])
-
-
-;;- Divide and mod instructions.
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "fp_reg_operand" "=f")
- (div:DF (match_operand:DF 1 "fp_reg_operand" "0")
- (match_operand:DF 2 "fp_reg_operand" "f")))]
- ""
- "divd %2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "fp_reg_operand" "=f")
- (div:SF (match_operand:SF 1 "fp_reg_operand" "0")
- (match_operand:SF 2 "fp_reg_operand" "f")))]
- ""
- "divs %2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (div:SI (match_operand:SI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "int_reg_operand" "r")))]
- ""
- "divw %2,%0"
- [(set_attr "type" "arith")
- (set_attr "cc" "clobber")])
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (udiv:SI (match_operand:SI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "int_reg_operand" "r")))]
- ""
- "divwu %2,%0"
- [(set_attr "type" "arith")
- (set_attr "cc" "clobber")])
-
-
-(define_insn "modsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (mod:SI (match_operand:SI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "int_reg_operand" "r")))]
- ""
- "modw %2,%0"
- [(set_attr "type" "arith")
- (set_attr "cc" "clobber")])
-
-(define_insn "umodsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (umod:SI (match_operand:SI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "int_reg_operand" "r")))]
- ""
- "modwu %2,%0"
- [(set_attr "type" "arith")
- (set_attr "cc" "clobber")])
-
-;;
-;; bit and/or instructions
-;;
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
- (and:SI (match_operand:SI 1 "int_reg_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "r,n")))]
- ""
- "@
- andw %2,%0
- andi %2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
- (ior:SI (match_operand:SI 1 "int_reg_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "r,n")))]
- ""
- "@
- orw %2,%0
- ori %2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
- (xor:SI (match_operand:SI 1 "int_reg_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "r,n")))]
- ""
- "@
- xorw %2,%0
- xori %2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "fp_reg_operand" "=f")
- (neg:DF (match_operand:DF 1 "fp_reg_operand" "f")))]
- ""
- "negd %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "fp_reg_operand" "=f")
- (neg:SF (match_operand:SF 1 "fp_reg_operand" "f")))]
- ""
- "negs %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (neg:SI (match_operand:SI 1 "int_reg_operand" "r")))]
- ""
- "negw %1,%0"
- [(set_attr "type" "arith")])
-
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (not:SI (match_operand:SI 1 "int_reg_operand" "r")))]
- ""
- "notw %1,%0"
- [(set_attr "type" "arith")])
-
-
-
-;; Right shift on the clipper works by negating the shift count,
-;; then emitting a right shift with the shift count negated. This means
-;; that all actual shift counts in the RTL will be positive.
-
-(define_expand "ashrdi3"
- [(set (match_operand:DI 0 "int_reg_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "int_reg_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (ashiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "shali $%n2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (ashiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
- ""
- "shal %2,%0"
- [(set_attr "type" "arith")])
-
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "")
- (ashiftrt:SI (match_operand:SI 1 "int_reg_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "shai $%n2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
- ""
- "shaw %2,%0"
- [(set_attr "type" "arith")])
-
-;;
-;; left shift
-;;
-
-(define_insn "ashldi3"
- [(set (match_operand:DI 0 "int_reg_operand" "=r,r")
- (ashift:DI (match_operand:DI 1 "int_reg_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "r,n")))]
- ""
- "@
- shal %2,%0
- shali %2,%0"
- [(set_attr "type" "arith")])
-
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
- (ashift:SI (match_operand:SI 1 "int_reg_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "r,n")))]
- ""
- "*
-{
- int val;
-
- if (which_alternative == 0)
- return \"shaw %2,%0\";
-
- val = INTVAL (operands[2]);
-
- if (val == 2)
- return \"addw %0,%0\;addw %0,%0\";
-
- if (val == 1)
- return \"addw %0,%0\";
-
- return \"shai %2,%0\";
-}"
-[(set_attr "type" "arith")])
-
-;;
-;; logical shift
-;;
-
-(define_expand "lshrdi3"
- [(set (match_operand:DI 0 "int_reg_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "int_reg_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (lshiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "shlli $%n2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (lshiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
- ""
- "shll %2,%0"
- [(set_attr "type" "arith")])
-
-(define_expand "lshrsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "")
- (lshiftrt:SI (match_operand:SI 1 "int_reg_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "shli $%n2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
- ""
- "shlw %2,%0"
- [(set_attr "type" "arith")])
-
-
-;;
-;; rotate insn
-;;
-(define_expand "rotrdi3"
- [(set (match_operand:DI 0 "int_reg_operand" "")
- (rotatert:DI (match_operand:DI 1 "int_reg_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (rotatert:DI (match_operand:DI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "rotli $%n2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "int_reg_operand" "=r")
- (rotatert:DI (match_operand:DI 1 "int_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
- ""
- "rotl %2,%0"
- [(set_attr "type" "arith")])
-
-(define_expand "rotrsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "")
- (rotatert:SI (match_operand:SI 1 "int_reg_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (rotatert:SI (match_operand:SI 1 "int_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "roti $%n2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "int_reg_operand" "=r")
- (rotatert:SI (match_operand:SI 1 "int_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
- ""
- "rotw %2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn "rotldi3"
- [(set (match_operand:DI 0 "int_reg_operand" "=r,r")
- (rotate:DI (match_operand:DI 1 "int_reg_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "r,n")))]
- ""
- "@
- rotl %2,%0
- rotli %2,%0"
- [(set_attr "type" "arith")])
-
-(define_insn "rotlsi3"
- [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
- (rotate:SI (match_operand:SI 1 "int_reg_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "r,n")))]
- ""
- "@
- rotw %2,%0
- roti %2,%0"
- [(set_attr "type" "arith")])
-
-
-;;
-;; jump and branch insns
-;;
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "b %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "b (%0)"
- [(set_attr "type" "branch")])
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "breq %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "brne %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "brgt %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "brgtu %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "brlt %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "brltu %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "brge %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "brgeu %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "brle %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "brleu %l0"
- [(set_attr "type" "branch")])
-
-;; Recognize reversed jumps.
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(cc0)
- (const_int 0)])
- (pc)
- (label_ref (match_operand 1 "" ""))))]
- ""
- "br%C0 %l1" ; %C0 negates condition
- [(set_attr "type" "branch")])
-
-;;
-;; call instructions
-;;
-(define_insn "call"
- [(call (match_operand:QI 0 "general_operand" "m")
- (match_operand:SI 1 "general_operand" ""))]
- ;; Operand 1 not used on the clipper.
- ""
- "call sp,%0")
-
-(define_insn "call_value"
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "general_operand" "m")
- (match_operand:SI 2 "general_operand" "g")))]
- ;; Operand 2 not used on the clipper
- ""
- "call sp,%1")
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
- ""
- "b (%0)"
- [(set_attr "type" "branch")])
-
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "noop"
- [(set_attr "type" "arith")
- (set_attr "cc" "unchanged")])
-
-
-
-;; while (--foo >= 0)
-;;
-;; Combiners for 'decrement test and branch' do not work for clipper.
-;; These patters are jump_insns that do not allow output reloads and clipper
-;; can only decrement and test registers.
-;;
diff --git a/gcc/config/clipper/clix.h b/gcc/config/clipper/clix.h
deleted file mode 100644
index d08e2203ff0..00000000000
--- a/gcc/config/clipper/clix.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Definitions of target machine for GNU compiler. Clipper/Clix version.
- Copyright (C) 1988, 1993, 1996 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. */
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dclipper -Dunix -Asystem(unix) -Asystem(svr3) -Acpu(clipper) -Amachine(clipper)"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} crtbegin.o%s"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
-
-#undef LIB_SPEC
-
-#undef HAVE_ATEXIT
-#define HAVE_ATEXIT
-
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- unsigned char *s; \
- int i; \
- for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++) \
- { \
- if ((i % 8) == 0) \
- fputs ("\n\t.byte\t", (FILE)); \
- fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
- } \
- fputs ("\n", (FILE)); \
-} while (0)
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-{ \
- union { int i[2]; double d; } _d_; \
- _d_.d = VALUE; \
- fprintf (FILE, "\t.long 0x%08x,0x%08x\n", _d_.i[0],_d_.i[1]); \
-}
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-{ \
- union { int i; float f; } _f_; \
- _f_.f = VALUE; \
- fprintf (FILE, "\t.long 0x%08x\n", _f_.i); \
-}
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf(FILE, "\t.align %d\n", 1 << (LOG))
-
-
-#define ASM_LONG ".long"
-#define BSS_SECTION_ASM_OP ".bss"
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP ".section .init,\"x\""
-
-
-/* Define a few machine-specific details of the implementation of
- constructors.
-
- The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
- and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the
- constructor. */
-
-#define CTOR_LIST_BEGIN \
- asm (INIT_SECTION_ASM_OP); \
- asm ("subq $8,sp"); \
- asm ("loadq $0,r0"); \
- asm ("storw r0,(sp)")
-
-/* don't need end marker */
-
-#undef CTOR_LIST_END
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fputs ("\tloada ", FILE); \
- assemble_name (FILE, NAME); \
- fputs (",r0\n\tsubq $8,sp\n\tstorw r0,(sp)\n", FILE); \
- } while (0)
-
-
-/* fini psect is 8 aligned */
-
-#define DTOR_LIST_BEGIN \
- asm (DTORS_SECTION_ASM_OP); \
- func_ptr __DTOR_LIST__[2] = { (func_ptr) (-1), 0 };
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- fini_section (); \
- fprintf (FILE, "%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",0\n"); \
- } while (0)
-
-
-/* On clix crt1.o first calls init code and then sets environ and a valid
- chrclass. Unfortunately stdio routines bomb with unset chrclass.
- Therefore we set chrclass prior to calling global constructors. */
-
-#undef DO_GLOBAL_CTORS_BODY
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *p, *beg = alloca (0); \
- _setchrclass (0); \
- for (p = beg; *p; p+=2) \
- ; \
- while (p != beg) \
- { p-= 2; (*p) (); } \
-} while (0)
-
-
-#undef DO_GLOBAL_DTORS_BODY
-#define DO_GLOBAL_DTORS_BODY \
- func_ptr *f = &__DTOR_LIST__[2]; /* 0,1 contains -1,0 */ \
- int n = 0; \
- while (*f) \
- { \
- f+= 2; /* skip over alignment 0 */ \
- n++; \
- } \
- f -= 2; \
- while (--n >= 0) \
- { \
- (*f) (); \
- f-= 2; /* skip over alignment 0 */ \
- }
-
-
diff --git a/gcc/config/clipper/x-clix b/gcc/config/clipper/x-clix
deleted file mode 100644
index 155161f94aa..00000000000
--- a/gcc/config/clipper/x-clix
+++ /dev/null
@@ -1 +0,0 @@
-ALLOCA = alloca.o
diff --git a/gcc/config/clipper/xm-clix.h b/gcc/config/clipper/xm-clix.h
deleted file mode 100644
index 5485c242539..00000000000
--- a/gcc/config/clipper/xm-clix.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Config file for Clipper running Clix, system V. 3.2 clone */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-
-#include "tm.h"
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* This machine uses IEEE floats. */
-/* #define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT */
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* isinf isn't there, but finite is. */
-#define isinf(x) (!finite(x))
-
-
-#define USG
-
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-#define index strchr
-#define rindex strrchr
-
-#define TARGET_MEM_FUNCTIONS
diff --git a/gcc/config/convex/convex.c b/gcc/config/convex/convex.c
deleted file mode 100644
index f642fb07c86..00000000000
--- a/gcc/config/convex/convex.c
+++ /dev/null
@@ -1,677 +0,0 @@
-/* Subroutines for insn-output.c for Convex.
- Copyright (C) 1988, 1993, 1994 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 1, 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 "tree.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "insn-attr.h"
-#include "output.h"
-#include "expr.h"
-
-#undef NULL
-#include <stdio.h>
-
-/* Tables used in convex.h */
-
-char regno_ok_for_index_p_base[1 + LAST_VIRTUAL_REGISTER + 1];
-enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
-enum reg_class reg_class_from_letter[256];
-
-/* Target cpu index. */
-
-int target_cpu;
-
-/* Boolean to keep track of whether the current section is .text or not.
- Used by .align handler in convex.h. */
-
-int current_section_is_text;
-
-/* Communication between output_compare and output_condjump. */
-
-static rtx cmp_operand0, cmp_operand1;
-static char cmp_modech;
-
-/* Forwards */
-
-static rtx frame_argblock;
-static int frame_argblock_size;
-static rtx convert_arg_pushes ();
-static void expand_movstr_call ();
-
-/* Here from OVERRIDE_OPTIONS at startup. Initialize constant tables. */
-
-init_convex ()
-{
- int regno;
-
- /* Set A and S reg classes. */
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (A_REGNO_P (regno))
- {
- regno_ok_for_index_p[regno] = 1;
- regno_reg_class[regno] = INDEX_REGS;
- }
- else
- {
- regno_ok_for_index_p[regno] = 0;
- regno_reg_class[regno] = S_REGS;
- }
-
- /* Can't index off the stack pointer, register 0. */
- regno_ok_for_index_p[STACK_POINTER_REGNUM] = 0;
- regno_reg_class[STACK_POINTER_REGNUM] = SP_REGS;
-
- /* Can't index off aliases of the stack pointer. */
- regno_ok_for_index_p[VIRTUAL_INCOMING_ARGS_REGNUM] = 1;
- regno_ok_for_index_p[VIRTUAL_STACK_VARS_REGNUM] = 1;
- regno_ok_for_index_p[VIRTUAL_STACK_DYNAMIC_REGNUM] = 0;
- regno_ok_for_index_p[VIRTUAL_OUTGOING_ARGS_REGNUM] = 0;
-
- /* Can't index off hard reg -1 == pseudos not assigned */
- regno_ok_for_index_p[-1] = 0;
-
- /* Set reg class letters */
- reg_class_from_letter['a'] = A_REGS;
- reg_class_from_letter['A'] = INDEX_REGS;
- reg_class_from_letter['d'] = S_REGS;
-
- /* Turn off floating point exception enables in the psw. */
- psw_disable_float ();
-}
-
-psw_disable_float ()
-{
-#if __convex__ && __GNUC__
- register int *p;
- asm ("mov fp,%0" : "=a" (p));
- while (p)
- {
- p[1] &= ~0x1000c400;
- p = (int *) p[2];
- }
-#endif
-}
-
-/* Here to output code for a compare insn. Output nothing, just
- record the operands and their mode. */
-
-char *
-output_cmp (operand0, operand1, modech)
- rtx operand0, operand1;
- char modech;
-{
- cmp_operand0 = operand0;
- cmp_operand1 = operand1;
- cmp_modech = modech;
- return "";
-}
-
-/* Output code for a conditional jump. The preceding instruction
- is necessarily a compare. Output two instructions, for example
- eq.w a1,a2
- jbra.t L5
- for
- (cmpsi a1 a2)
- (beq L5)
- */
-
-char *
-output_condjump (label, cond, jbr_sense)
- rtx label;
- char *cond;
- char jbr_sense;
-{
- rtx operands[3];
- char cmp_op[4];
- char buf[80];
- char jbr_regch;
-
- strcpy (cmp_op, cond);
-
- /* [BL] mean the value is being compared against immediate 0.
- Use neg.x, which produces the same carry that eq.x #0 would if it
- existed. In this case operands[1] is a scratch register, not a
- compare operand. */
-
- if (cmp_modech == 'B' || cmp_modech == 'L')
- {
- cmp_modech = cmp_modech - 'A' + 'a';
- strcpy (cmp_op, "neg");
- }
-
- /* [WH] mean the value being compared resulted from "add.[wh] #-1,rk"
- when rk was nonnegative -- we can omit equality compares against -1
- or inequality compares against 0. */
-
- else if (cmp_modech == 'W' || cmp_modech == 'H')
- {
- if (! strcmp (cmp_op, "eq") && cmp_operand1 == constm1_rtx)
- jbr_sense ^= 't' ^ 'f';
- else if (! strcmp (cmp_op, "lt") && cmp_operand1 == const0_rtx)
- ;
- else
- cmp_modech = cmp_modech - 'A' + 'a';
- }
-
- /* Constant must be first; swap operands if necessary.
- If lt, le, ltu, leu are swapped, change to le, lt, leu, ltu
- and reverse the sense of the jump. */
-
- if (! REG_P (cmp_operand1))
- {
- operands[0] = cmp_operand1;
- operands[1] = cmp_operand0;
- if (cmp_op[0] == 'l')
- {
- cmp_op[1] ^= 'e' ^ 't';
- jbr_sense ^= 't' ^ 'f';
- }
- }
- else
- {
- operands[0] = cmp_operand0;
- operands[1] = cmp_operand1;
- }
-
- operands[2] = label;
-
- if (S_REG_P (operands[1]))
- jbr_regch = 's';
- else if (A_REG_P (operands[1]))
- jbr_regch = 'a';
- else
- abort ();
-
- if (cmp_modech == 'W' || cmp_modech == 'H')
- sprintf (buf, "jbr%c.%c %%l2", jbr_regch, jbr_sense);
- else
- sprintf (buf, "%s.%c %%0,%%1\n\tjbr%c.%c %%l2",
- cmp_op, cmp_modech, jbr_regch, jbr_sense);
- output_asm_insn (buf, operands);
- return "";
-}
-
-/* Return 1 if OP is valid for cmpsf.
- In IEEE mode, +/- zero compares are not handled by
- the immediate versions of eq.s and on some machines, lt.s, and le.s.
- So disallow 0.0 as the immediate operand of xx.s compares in IEEE mode. */
-
-int
-nonmemory_cmpsf_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
-#if _IEEE_FLOAT_
- if (op == CONST0_RTX (SFmode))
- return 0;
-#endif
-
- return nonmemory_operand (op, mode);
-}
-
-/* Convex /bin/as does not like unary minus in some contexts.
- Simplify CONST addresses to remove it. */
-
-rtx
-simplify_for_convex (x)
- rtx x;
-{
- switch (GET_CODE (x))
- {
- case MINUS:
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) < 0)
- {
- PUT_CODE (x, PLUS);
- XEXP (x, 1) = GEN_INT (- INTVAL (XEXP (x, 1)));
- }
- break;
-
- case CONST:
- return simplify_for_convex (XEXP (x, 0));
- }
-
- return x;
-}
-
-/* Routines to separate CONST_DOUBLEs into component parts. */
-
-int
-const_double_high_int (x)
- rtx x;
-{
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- return CONST_DOUBLE_LOW (x);
- else
- return CONST_DOUBLE_HIGH (x);
-}
-
-int
-const_double_low_int (x)
- rtx x;
-{
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- return CONST_DOUBLE_HIGH (x);
- else
- return CONST_DOUBLE_LOW (x);
-}
-
-/* Inline block copy. */
-
-void
-expand_movstr (operands)
- rtx *operands;
-{
- rtx dest = operands[0];
- rtx src = operands[1];
- int align = INTVAL (operands[3]);
- int nregs, maxsize;
- unsigned len;
- enum machine_mode mode;
- rtx reg, load, store, prev_store, prev_store_2;
- int size;
-
- /* Decide how many regs to use, depending on load latency, and what
- size pieces to move, depending on whether machine does unaligned
- loads and stores efficiently. */
-
- if (TARGET_C1)
- {
- /* ld.l latency is 4, no alignment problems. */
- nregs = 3, maxsize = 8;
- }
- else if (TARGET_C2)
- {
- /* loads are latency 2 if we avoid ld.l not at least word aligned. */
- if (align >= 4)
- nregs = 2, maxsize = 8;
- else
- nregs = 2, maxsize = 4;
- }
- else if (TARGET_C34)
- {
- /* latency is 4 if aligned, horrible if not. */
- nregs = 3, maxsize = align;
- }
- else if (TARGET_C38)
- {
- /* latency is 2 if at least word aligned, 3 or 4 if unaligned. */
- if (align >= 4)
- nregs = 2, maxsize = 8;
- else
- nregs = 3, maxsize = 8;
- }
- else
- abort ();
-
- /* Caller is not necessarily prepared for us to fail in this
- expansion. So fall back by generating memcpy call here. */
-
- if (GET_CODE (operands[2]) != CONST_INT
- || (len = INTVAL (operands[2])) > (unsigned) 32 * maxsize)
- {
- expand_movstr_call (operands);
- return;
- }
-
- reg = 0;
- prev_store = prev_store_2 = 0;
-
- while (len > 0)
- {
- if (len >= 8 && maxsize >= 8)
- mode = DImode;
- else if (len >= 4 && maxsize >= 4)
- mode = SImode;
- else if (len >= 2 && maxsize >= 2)
- mode = HImode;
- else
- mode = QImode;
-
- /* If no temp pseudo to reuse, or not the right mode, make one */
- if (! reg || GET_MODE (reg) != mode)
- reg = gen_reg_rtx (mode);
-
- /* Get src and dest in the right mode */
- if (GET_MODE (src) != mode)
- src = change_address (src, mode, 0),
- dest = change_address (dest, mode, 0);
-
- /* Make load and store patterns for this piece */
- load = gen_rtx (SET, VOIDmode, reg, src);
- store = gen_rtx (SET, VOIDmode, dest, reg);
-
- /* Emit the load and the store from last time.
- When we emit a store, we can reuse its temp reg. */
- emit_insn (load);
- if (prev_store)
- {
- reg = SET_SRC (prev_store);
- emit_insn (prev_store);
- }
- else
- reg = 0;
-
- /* Queue up the store, for next time or the time after that. */
- if (nregs == 2)
- prev_store = store;
- else
- prev_store = prev_store_2, prev_store_2 = store;
-
- /* Advance to next piece. */
- size = GET_MODE_SIZE (mode);
- src = adj_offsettable_operand (src, size);
- dest = adj_offsettable_operand (dest, size);
- len -= size;
- }
-
- /* Finally, emit the last stores. */
- if (prev_store)
- emit_insn (prev_store);
- if (prev_store_2)
- emit_insn (prev_store_2);
-}
-
-static void
-expand_movstr_call (operands)
- rtx *operands;
-{
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"), 0,
- VOIDmode, 3,
- XEXP (operands[0], 0), Pmode,
- XEXP (operands[1], 0), Pmode,
- convert_to_mode (TYPE_MODE (sizetype), operands[2],
- TREE_UNSIGNED (sizetype)),
- TYPE_MODE (sizetype));
-}
-
-#if _IEEE_FLOAT_
-#define MAX_FLOAT 3.4028234663852886e+38
-#define MIN_FLOAT 1.1754943508222875e-38
-#else
-#define MAX_FLOAT 1.7014117331926443e+38
-#define MIN_FLOAT 2.9387358770557188e-39
-#endif
-
-int
-check_float_value (mode, dp, overflow)
- enum machine_mode mode;
- REAL_VALUE_TYPE *dp;
- int overflow;
-{
- REAL_VALUE_TYPE d = *dp;
-
- if (overflow)
- {
- *dp = MAX_FLOAT;
- return 1;
- }
-
- if (mode == SFmode)
- {
- if (d > MAX_FLOAT)
- {
- *dp = MAX_FLOAT;
- return 1;
- }
- else if (d < -MAX_FLOAT)
- {
- *dp = -MAX_FLOAT;
- return 1;
- }
- else if ((d > 0 && d < MIN_FLOAT) || (d < 0 && d > -MIN_FLOAT))
- {
- *dp = 0.0;
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Output the label at the start of a function.
- Precede it with the number of formal args so debuggers will have
- some idea of how many args to print. */
-
-void
-asm_declare_function_name (file, name, decl)
- FILE *file;
- char *name;
- tree decl;
-{
- tree parms;
- int nargs = list_length (DECL_ARGUMENTS (decl));
-
- char *p, c;
- extern char *version_string;
- static char vers[4];
- int i;
-
- p = version_string;
- for (i = 0; i < 3; ) {
- c = *p;
- if (c - '0' < (unsigned) 10)
- vers[i++] = c;
- if (c == 0 || c == ' ')
- vers[i++] = '0';
- else
- p++;
- }
- fprintf (file, "\tds.b \"g%s\"\n", vers);
-
- if (nargs < 100)
- fprintf (file, "\tds.b \"+%02d\\0\"\n", nargs);
- else
- fprintf (file, "\tds.b \"+00\\0\"\n");
-
- ASM_OUTPUT_LABEL (file, name);
-}
-
-/* Print an instruction operand X on file FILE.
- CODE is the code from the %-spec that requested printing this operand;
- if `%z3' was used to print operand 3, then CODE is 'z'. */
-/* Convex codes:
- %u prints a CONST_DOUBLE's high word
- %v prints a CONST_DOUBLE's low word
- %z prints a CONST_INT shift count as a multiply operand -- viz. 1 << n.
- */
-
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- char code;
-{
- long u[2];
- REAL_VALUE_TYPE d;
-
- switch (GET_CODE (x))
- {
- case REG:
- fprintf (file, "%s", reg_names[REGNO (x)]);
- break;
-
- case MEM:
- output_address (XEXP (x, 0));
- break;
-
- case CONST_DOUBLE:
- REAL_VALUE_FROM_CONST_DOUBLE (d, x);
- switch (GET_MODE (x)) {
- case DFmode:
-#if 0 /* doesn't work, produces dfloats */
- REAL_VALUE_TO_TARGET_DOUBLE (d, u);
-#else
- {
- union { double d; int i[2]; } t;
- t.d = d;
- u[0] = t.i[0];
- u[1] = t.i[1];
- }
-#endif
- if (code == 'u')
- fprintf (file, "#%#x", u[0]);
- else if (code == 'v')
- fprintf (file, "#%#x", u[1]);
- else
- outfloat (file, d, "%.17e", "#", "");
- break;
- case SFmode:
- outfloat (file, d, "%.9e", "#", "");
- break;
- default:
- if (code == 'u')
- fprintf (file, "#%d", CONST_DOUBLE_HIGH (x));
- else
- fprintf (file, "#%d", CONST_DOUBLE_LOW (x));
- }
- break;
-
- default:
- if (code == 'z')
- {
- if (GET_CODE (x) != CONST_INT)
- abort ();
- fprintf (file, "#%d", 1 << INTVAL (x));
- }
- else
- {
- putc ('#', file);
- output_addr_const (file, x);
- }
- }
-}
-
-/* Print a memory operand whose address is X, on file FILE. */
-
-print_operand_address (file, addr)
- FILE *file;
- rtx addr;
-{
- rtx index = 0;
- rtx offset = 0;
-
- if (GET_CODE (addr) == MEM)
- {
- fprintf (file, "@");
- addr = XEXP (addr, 0);
- }
-
- switch (GET_CODE (addr))
- {
- case REG:
- index = addr;
- break;
-
- case PLUS:
- index = XEXP (addr, 0);
- if (REG_P (index))
- offset = XEXP (addr, 1);
- else
- {
- offset = XEXP (addr, 0);
- index = XEXP (addr, 1);
- if (! REG_P (index))
- abort ();
- }
- break;
-
- default:
- offset = addr;
- break;
- }
-
- if (offset)
- output_addr_const (file, offset);
-
- if (index)
- fprintf (file, "(%s)", reg_names[REGNO (index)]);
-}
-
-/* Output a float to FILE, value VALUE, format FMT, preceded by PFX
- and followed by SFX. */
-
-outfloat (file, value, fmt, pfx, sfx)
- FILE *file;
- REAL_VALUE_TYPE value;
- char *fmt, *pfx, *sfx;
-{
- char buf[64];
- fputs (pfx, file);
- REAL_VALUE_TO_DECIMAL (value, fmt, buf);
- fputs (buf, file);
- fputs (sfx, file);
-}
-
-/* Here during RTL generation of return. If we are at the final return
- in a function, go through the function and replace pushes with stores
- into a frame arg block. This is similar to what ACCUMULATE_OUTGOING_ARGS
- does, but we must index off the frame pointer, not the stack pointer,
- and the calling sequence does not require the arg block to be at the
- top of the stack. */
-
-replace_arg_pushes ()
-{
- /* Doesn't work yet. */
-}
-
-/* Output the insns needed to do a call. operands[] are
- 0 - MEM, the place to call
- 1 - CONST_INT, the number of bytes in the arg list
- 2 - CONST_INT, the number of arguments
- 3 - CONST_INT, the number of bytes to pop
- 4 - address of the arg list.
- */
-
-char *
-output_call (insn, operands)
- rtx insn, *operands;
-{
- if (operands[4] == stack_pointer_rtx)
- output_asm_insn ("mov sp,ap", operands);
- else
- abort ();
-
- if (TARGET_ARGCOUNT)
- output_asm_insn ("pshea %a2", operands);
-
- output_asm_insn ("calls %0", operands);
-
- output_asm_insn ("ld.w 12(fp),ap", operands);
-
- if (operands[4] == stack_pointer_rtx && operands[3] != const0_rtx)
- output_asm_insn ("add.w %3,sp", operands);
-
- return "";
-}
-
-
-/* Here after reloading, before the second scheduling pass. */
-
-emit_ap_optimizations ()
-{
- /* Removed for now. */
-}
-
diff --git a/gcc/config/convex/convex.h b/gcc/config/convex/convex.h
deleted file mode 100644
index 0d598edd76d..00000000000
--- a/gcc/config/convex/convex.h
+++ /dev/null
@@ -1,1502 +0,0 @@
-/* Definitions of target machine for GNU compiler. Convex version.
- Copyright (C) 1988, 1994, 1995, 1996 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. */
-
-
-/* Standard GCC variables that we reference. */
-
-extern int target_flags;
-
-/* Convex machine-specific flags
- -mc1 target instruction set, libraries, scheduling
- -mc2
- -mc32
- -mc34
- -mc38
- -margcount use standard calling sequence, with arg count word
- -mno-argcount don't push arg count, depend on symbol table
- -margcount-nop place arg count in a nop instruction (faster than push)
- -mvolatile-cache use data cache for volatile mem refs (default)
- -mvolatile-nocache bypass data cache for volatile mem refs
- -mlong32 cc- and libc-compatible 32-bit longs
- -mlong64 64-bit longs
-*/
-
-/* Macro to define tables used to set -mXXX flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 0
-#endif
-
-#define TARGET_SWITCHES \
- { { "c1", 001 }, \
- { "c2", 002 }, \
- { "c32", 004 }, \
- { "c34", 010 }, \
- { "c38", 020 }, \
- { "argcount", 0100 }, \
- { "argcount-nop", 0200 }, \
- { "no-argcount", -0300 }, \
- { "volatile-cache", -0400 }, \
- { "no-volatile-cache", 0400 }, \
- { "volatile-nocache", 0400 }, \
- { "long64", 01000 }, \
- { "long32", -01000 }, \
- { "", TARGET_DEFAULT | TARGET_CPU_DEFAULT}}
-
-/* Macros used in the machine description to test the flags. */
-
-#define TARGET_C1 (target_cpu == 0)
-#define TARGET_C2 (target_cpu == 1)
-#define TARGET_C34 (target_cpu == 2)
-#define TARGET_C38 (target_cpu == 3)
-#define TARGET_ARGCOUNT (target_flags & 0100)
-#define TARGET_ARGCOUNT_NOP (target_flags & 0200)
-#define TARGET_LONG64 (target_flags & 01000)
-#define TARGET_VOLATILE_NOCACHE (target_flags & 0400)
-
-#define OVERRIDE_OPTIONS \
-{ \
- init_convex (); \
- if ((target_flags & 077) != ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 077)) \
- target_flags &= ~ (TARGET_DEFAULT | TARGET_CPU_DEFAULT); \
- if (target_flags & 001) \
- target_cpu = 0; \
- else if (target_flags & 006) \
- target_cpu = 1; \
- else if (target_flags & 010) \
- target_cpu = 2; \
- else if (target_flags & 020) \
- target_cpu = 3; \
-}
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dconvex -Dunix -Asystem(unix) -Acpu(convex) -Amachine(convex)"
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fprintf (stderr, " (convex)");
-
-/* Target-dependent specs.
- Some libraries come in c1 and c2+ versions; use the appropriate ones.
- Make a target-dependent __convex_cxx__ define to relay the target cpu
- to the program being compiled. */
-
-#if (TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 1
-
-/* C1 default */
-
-#if _IEEE_FLOAT_
-
-#define CPP_SPEC \
-"%{!mc2:%{!mc32:%{!mc34:%{!mc38:-D__convex_c1__}}}} \
- %{mc2:-D__convex_c2__} \
- %{mc32:-D__convex_c32__} \
- %{mc34:-D__convex_c34__} \
- %{mc38:-D__convex_c38__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_IEEE_FLOAT_ \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#else
-
-#define CPP_SPEC \
-"%{!mc2:%{!mc32:%{!mc34:%{!mc38:-D__convex_c1__}}}} \
- %{mc2:-D__convex_c2__} \
- %{mc32:-D__convex_c32__} \
- %{mc34:-D__convex_c34__} \
- %{mc38:-D__convex_c38__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_CONVEX_FLOAT_ \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#endif
-
-#define LIB_SPEC \
-"%{!mc2:%{!mc32:%{!mc34:%{!mc38:-lC1%{traditional:_old}%{p:_p}%{pg:_p}}}}} \
- %{mc2:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc32:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc34:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc38:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- -lc%{traditional:_old}%{p:_p}%{pg:_p}"
-
-#endif
-
-#if (TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 2
-
-/* C2 default */
-
-#if _IEEE_FLOAT_
-
-#define CPP_SPEC \
-"%{mc1:-D__convex_c1__} \
- %{!mc1:%{!mc32:%{!mc34:%{!mc38:-D__convex_c2__}}}} \
- %{mc32:-D__convex_c32__} \
- %{mc34:-D__convex_c34__} \
- %{mc38:-D__convex_c38__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_IEEE_FLOAT_ \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#else
-
-#define CPP_SPEC \
-"%{mc1:-D__convex_c1__} \
- %{!mc1:%{!mc32:%{!mc34:%{!mc38:-D__convex_c2__}}}} \
- %{mc32:-D__convex_c32__} \
- %{mc34:-D__convex_c34__} \
- %{mc38:-D__convex_c38__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_CONVEX_FLOAT_ \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#endif
-
-#define LIB_SPEC \
-"%{mc1:-lC1%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{!mc1:%{!mc32:%{!mc34:%{!mc38:-lC2%{traditional:_old}%{p:_p}%{pg:_p}}}}} \
- %{mc32:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc34:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc38:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- -lc%{traditional:_old}%{p:_p}%{pg:_p}"
-
-#endif
-
-#if (TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 4
-
-/* C32 default */
-
-#if _IEEE_FLOAT_
-
-#define CPP_SPEC \
-"%{mc1:-D__convex_c1__} \
- %{mc2:-D__convex_c2__} \
- %{!mc1:%{!mc2:%{!mc34:%{!mc38:-D__convex_c32__}}}} \
- %{mc34:-D__convex_c34__} \
- %{mc38:-D__convex_c38__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_IEEE_FLOAT_ \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#else
-
-#define CPP_SPEC \
-"%{mc1:-D__convex_c1__} \
- %{mc2:-D__convex_c2__} \
- %{!mc1:%{!mc2:%{!mc34:%{!mc38:-D__convex_c32__}}}} \
- %{mc34:-D__convex_c34__} \
- %{mc38:-D__convex_c38__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_CONVEX_FLOAT_ \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#endif
-
-#define LIB_SPEC \
-"%{mc1:-lC1%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc2:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{!mc1:%{!mc2:%{!mc34:%{!mc38:-lC2%{traditional:_old}%{p:_p}%{pg:_p}}}}} \
- %{mc34:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc38:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- -lc%{traditional:_old}%{p:_p}%{pg:_p}"
-
-#endif
-
-#if (TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 010
-
-/* C34 default */
-
-#if _IEEE_FLOAT_
-
-#define CPP_SPEC \
-"%{mc1:-D__convex_c1__} \
- %{mc2:-D__convex_c2__} \
- %{mc32:-D__convex_c32__} \
- %{!mc1:%{!mc2:%{!mc32:%{!mc38:-D__convex_c34__}}}} \
- %{mc38:-D__convex_c38__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_IEEE_FLOAT_ \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#else
-
-#define CPP_SPEC \
-"%{mc1:-D__convex_c1__} \
- %{mc2:-D__convex_c2__} \
- %{mc32:-D__convex_c32__} \
- %{!mc1:%{!mc2:%{!mc32:%{!mc38:-D__convex_c34__}}}} \
- %{mc38:-D__convex_c38__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_CONVEX_FLOAT_ \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#endif
-
-#define LIB_SPEC \
-"%{mc1:-lC1%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc2:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc32:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{!mc1:%{!mc2:%{!mc32:%{!mc38:-lC2%{traditional:_old}%{p:_p}%{pg:_p}}}}} \
- %{mc38:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- -lc%{traditional:_old}%{p:_p}%{pg:_p}"
-
-#endif
-
-#if (TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 020
-
-/* C38 default */
-
-#if _IEEE_FLOAT_
-
-#define CPP_SPEC \
-"%{mc1:-D__convex_c1__} \
- %{mc2:-D__convex_c2__} \
- %{mc32:-D__convex_c32__} \
- %{mc34:-D__convex_c34__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_IEEE_FLOAT_ \
- %{!mc1:%{!mc2:%{!mc32:%{!mc34:-D__convex_c38__}}}} \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#else
-
-#define CPP_SPEC \
-"%{mc1:-D__convex_c1__} \
- %{mc2:-D__convex_c2__} \
- %{mc32:-D__convex_c32__} \
- %{mc34:-D__convex_c34__} \
- %{fno-builtin:-D__NO_INLINE} \
- -D__NO_INLINE_MATH -D__NO_INLINE_STDLIB \
- -D_CONVEX_FLOAT_ \
- %{!mc1:%{!mc2:%{!mc32:%{!mc34:-D__convex_c38__}}}} \
- %{.S:-P} \
- %{!traditional:-D__stdc__} \
- %{!traditional:-D_LONGLONG} \
- %{!traditional:-Ds64_t=long\\ long -Du64_t=unsigned\\ long\\ long} \
- %{!ansi:-D_POSIX_SOURCE} \
- %{!ansi:-D_CONVEX_SOURCE}"
-
-#endif
-
-#define LIB_SPEC \
-"%{mc1:-lC1%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc2:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc32:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{mc34:-lC2%{traditional:_old}%{p:_p}%{pg:_p}} \
- %{!mc1:%{!mc2:%{!mc32:%{!mc34:-lC2%{traditional:_old}%{p:_p}%{pg:_p}}}}} \
- -lc%{traditional:_old}%{p:_p}%{pg:_p}"
-
-#endif
-
-#if _IEEE_FLOAT_
-
-/* ieee default */
-
-#define ASM_SPEC "-fi"
-
-#define LINK_SPEC \
-"-E%{traditional:no}posix \
- -X \
- %{F} %{M*} %{y*} \
- -fi \
- -A__iob=___ap$iob \
- -A_use_libc_sema=___ap$use_libc_sema \
- %{traditional:-A___gcc_cleanup=__cleanup} \
- %{!traditional:-A___gcc_cleanup=___ap$do_registered_functions} \
- -L/usr/lib"
-
-#define STARTFILE_SPEC \
-"%{!pg:%{!p:/usr/lib/crt/crt0.o}} \
- %{!pg:%{p:/usr/lib/crt/mcrt0.o}} \
- %{pg:/usr/lib/crt/gcrt0.o} \
- /usr/lib/crt/fpmode_i.o"
-
-#else
-
-/* native default */
-
-#define ASM_SPEC "-fn"
-
-#define LINK_SPEC \
-"-E%{traditional:no}posix \
- -X \
- %{F} %{M*} %{y*} \
- -fn \
- -A__iob=___ap$iob \
- -A_use_libc_sema=___ap$use_libc_sema \
- %{traditional:-A___gcc_cleanup=__cleanup} \
- %{!traditional:-A___gcc_cleanup=___ap$do_registered_functions} \
- -L/usr/lib"
-
-#define STARTFILE_SPEC \
-"%{!pg:%{!p:/usr/lib/crt/crt0.o}} \
- %{!pg:%{p:/usr/lib/crt/mcrt0.o}} \
- %{pg:/usr/lib/crt/gcrt0.o}"
-
-#endif
-
-/* Use /path/libgcc.a instead of -lgcc, makes bootstrap work more smoothly. */
-
-#define LINK_LIBGCC_SPECIAL_1
-
-/* Since IEEE support was added to gcc, most things seem to like it
- better if we disable exceptions and check afterward for infinity. */
-
-#if __convex__
-#if _IEEE_FLOAT_
-#define REAL_VALUE_ISNAN(x) 0
-#define REAL_VALUE_ISINF(x) ((*(short *) &(x) & 0x7ff0) == 0x7ff0)
-#else
-#define REAL_VALUE_ISNAN(x) 0
-#define REAL_VALUE_ISINF(x) ((*(short *) &(x) & 0xfff0) == 0x8000)
-#endif
-#endif
-
-/* Target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is numbered. */
-#define WORDS_BIG_ENDIAN 1
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 64
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 8
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 64
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 16
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* No data type wants to be aligned rounder than this. */
-/* beware of doubles in structs -- 64 is incompatible with cc */
-#define BIGGEST_ALIGNMENT 32
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 0
-
-/* Define sizes of basic C types to conform to ordinary usage -- these
- types depend on BITS_PER_WORD otherwise. */
-#define CHAR_TYPE_SIZE 8
-#define SHORT_TYPE_SIZE 16
-#define INT_TYPE_SIZE 32
-#define LONG_TYPE_SIZE (TARGET_LONG64 ? 64 : 32)
-#define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
-/* This prevents cexp.c from depending on LONG_TYPE_SIZE. */
-#define MAX_LONG_TYPE_SIZE 64
-
-/* Declare the standard types used by builtins to match convex stddef.h --
- with int rather than long. */
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-#define FIRST_PSEUDO_REGISTER 16
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- For Convex, these are AP, FP, and SP. */
-#define FIXED_REGISTERS \
- { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1 }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
-
-/* List the order in which to allocate registers. Each register must be
- listed once, even those in FIXED_REGISTERS.
- For Convex, put S0 (the return register) last. */
-#define REG_ALLOC_ORDER \
- { 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 0, 8, 14, 15 }
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On Convex, S registers can hold any type, A registers any nonfloat. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (S_REGNO_P (REGNO) \
- || (GET_MODE_SIZE (MODE) <= 4 && (MODE) != SFmode))
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- ((GET_MODE_SIZE (MODE1) <= 4 && (MODE1) != SFmode) \
- == (GET_MODE_SIZE (MODE2) <= 4 && (MODE2) != SFmode))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-#define S0_REGNUM 0
-#define A0_REGNUM 8
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM A0_REGNUM
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM (A0_REGNUM + 7)
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 1
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM (A0_REGNUM + 6)
-
-/* Register in which static-chain is passed to a function.
- Use S0, not an A reg, because this rare use would otherwise prevent
- an A reg from being available to global-alloc across calls. */
-#define STATIC_CHAIN_REGNUM S0_REGNUM
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM (A0_REGNUM + 1)
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* Convex has classes A (address) and S (scalar).
- A is further divided into SP_REGS (stack pointer) and INDEX_REGS.
- SI_REGS is S_REGS + INDEX_REGS -- all the regs except SP. */
-
-enum reg_class {
- NO_REGS, S_REGS, INDEX_REGS, SP_REGS, A_REGS, SI_REGS,
- ALL_REGS, LIM_REG_CLASSES
-};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Since GENERAL_REGS is the same class as ALL_REGS,
- don't give it a different class number; just make it an alias. */
-
-#define GENERAL_REGS ALL_REGS
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "S_REGS", "INDEX_REGS", "SP_REGS", "A_REGS", "SI_REGS", \
- "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
- { 0, 0x00ff, 0xfe00, 0x0100, 0xff00, 0xfeff, 0xffff }
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) (regno_reg_class[REGNO])
-
-#define S_REGNO_P(REGNO) (((REGNO) - S0_REGNUM) < (unsigned) 8)
-#define A_REGNO_P(REGNO) (((REGNO) - A0_REGNUM) < (unsigned) 8)
-
-#define S_REG_P(X) (REG_P (X) && S_REGNO_P (REGNO (X)))
-#define A_REG_P(X) (REG_P (X) && A_REGNO_P (REGNO (X)))
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS INDEX_REGS
-#define BASE_REG_CLASS INDEX_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-/* a => A_REGS
- d => S_REGS ('s' is taken)
- A => INDEX_REGS (i.e., A_REGS except sp) */
-
-#define REG_CLASS_FROM_LETTER(C) \
- reg_class_from_letter[(unsigned char) (C)]
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C. */
-/* 'I' is used to pass any CONST_INT and reject any CONST_DOUBLE.
- CONST_DOUBLE integers are handled by G and H constraint chars. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) 1
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-/* Convex uses G, H:
- value usable in ld.d (low word 0) or ld.l (high word all sign) */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- (((C) == 'G' && LD_D_P (VALUE)) || \
- ((C) == 'H' && LD_L_P (VALUE)) || \
- 0)
-
-#define LD_D_P(X) (const_double_low_int (X) == 0)
-
-#define LD_L_P(X) (const_double_low_int (X) >= 0 \
- ? const_double_high_int (X) == 0 \
- : const_double_high_int (X) == -1)
-
-/* Optional extra constraints for this machine.
- For Convex, 'Q' means that OP is a volatile MEM.
- For volatile scalars, we use instructions that bypass the data cache. */
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' ? (GET_CODE (OP) == MEM && MEM_VOLATILE_P (OP) \
- && ! TARGET_C1 && TARGET_VOLATILE_NOCACHE) \
- : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-/* Put 2-word constants that can't be immediate operands into memory. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- ((GET_CODE (X) != CONST_DOUBLE \
- || GET_MODE (X) == SFmode \
- || LD_L_P (X) || LD_D_P (X)) ? (CLASS) : NO_REGS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-#define CLASS_MAX_NREGS(CLASS, MODE) ((GET_MODE_SIZE (MODE) + 7) / 8)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Define this if should default to -fcaller-saves. */
-#define DEFAULT_CALLER_SAVES
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by. */
-#define PUSH_ROUNDING(BYTES) (((BYTES) + 3) & ~3)
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (SIZE)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), S0_REGNUM)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, S0_REGNUM)
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-#define PCC_STATIC_STRUCT_RETURN
-
-/* 1 if N is a possible register number for a function value.
- On the Convex, S0 is the only register thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == S0_REGNUM)
-
-/* 1 if N is a possible register number for function argument passing. */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go. */
-/* On convex, simply count the arguments in case TARGET_ARGCOUNT is set. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += 1)
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- Convex: all args go on the stack. But return the arg count
- as the "next arg register" to be passed to gen_call. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- ((MODE) == VOIDmode ? gen_rtx (CONST_INT, VOIDmode, (CUM)) : 0)
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ \
- int size = ((SIZE) + 7) & -8; \
- if (size != 0) \
- fprintf (FILE, "\tsub.w #%d,sp\n", size); \
-}
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ \
- /* Follow function with a zero to stop c34 icache prefetching. */ \
- fprintf (FILE, "\tds.h 0\n"); \
-}
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On convex, the code for a trampoline is
- ld.w #<link>,s0
- jmp <func> */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\tld.w #69696969,s0\n"); \
- fprintf (FILE, "\tjmp 52525252\n"); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 12
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 2)), CXT); \
- emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 8)), FNADDR); \
- emit_call_insn (gen_call_pop (gen_rtx (MEM, QImode, \
- gen_rtx (SYMBOL_REF, Pmode, \
- "__enable_execute_stack")), \
- const0_rtx, const0_rtx, const0_rtx)); \
-}
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tldea LP%d,a1\n\tcallq mcount\n", (LABELNO));
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved. */
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
-{ (DEPTH) = (get_frame_size () + 7) & -8; }
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(regno) \
- ((regno) <= LAST_VIRTUAL_REGISTER \
- ? regno_ok_for_index_p[regno] \
- : regno_ok_for_index_p[reg_renumber[regno]])
-
-#define REGNO_OK_FOR_BASE_P(regno) REGNO_OK_FOR_INDEX_P (regno)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 1
-
-/* 1 if X is an rtx for a constant that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-/* For convex, bounce 2-word constants that can't be immediate operands. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- (GET_CODE (X) != CONST_DOUBLE \
- || GET_MODE (X) == SFmode \
- || LD_L_P (X) || LD_D_P (X))
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) \
- (REGNO (X) > LAST_VIRTUAL_REGISTER || regno_ok_for_index_p[REGNO (X)])
-
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_INDEX_P (X)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- For Convex, valid addresses are
- indirectable or (MEM indirectable)
- where indirectable is
- const, reg, (PLUS reg const)
-
- We don't use indirection since with insn scheduling, load + indexing
- is better. */
-
-/* 1 if X is an address that we could indirect through. */
-#define INDIRECTABLE_ADDRESS_P(X) \
- (CONSTANT_ADDRESS_P (X) \
- || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- || (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 1)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 1)) \
- && CONSTANT_ADDRESS_P (XEXP (X, 0))))
-
-/* Go to ADDR if X is a valid address. */
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ register rtx xfoob = (X); \
- if (INDIRECTABLE_ADDRESS_P (xfoob)) \
- goto ADDR; \
- if (GET_CODE (xfoob) == PRE_DEC && XEXP (xfoob, 0) == stack_pointer_rtx) \
- goto ADDR; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For Convex, nothing needs to be done. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the case instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Define this if the case instruction drops through after the table
- when the index is out of range. Don't define it if the case insn
- jumps to the default label instead. */
-/* #define CASE_DROPS_THROUGH */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 8
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS (! TARGET_C2)
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* On Convex, it is as good to call a constant function address as to
- call an address kept in a register. */
-#define NO_FUNCTION_CSE
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- case CONST_INT: \
- case CONST_DOUBLE: \
- return 0;
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. */
-
-#define RTX_COSTS(RTX,CODE,OUTER_CODE) \
- case PLUS: \
- if (regno_pointer_flag != 0 \
- && GET_CODE (XEXP (RTX, 0)) == REG \
- && REGNO_POINTER_FLAG (REGNO (XEXP (RTX, 0))) \
- && GET_CODE (XEXP (RTX, 1)) == CONST_INT) \
- return 0; \
- else break; \
- case MULT: \
- return 4 * (char) (0x03060403 >> target_cpu * 8); \
- case ASHIFT: \
- case LSHIFTRT: \
- case ASHIFTRT: \
- return 4 * (char) (0x03010403 >> target_cpu * 8); \
- case MEM: \
- return 5;
-
-/* Compute the cost of an address. This is meant to approximate the size
- and/or execution delay of an insn using that address. If the cost is
- approximated by the RTL complexity, including CONST_COSTS above, as
- is usually the case for CISC machines, this macro should not be defined.
- For aggressively RISCy machines, only one insn format is allowed, so
- this macro should be a constant. The value of this macro only matters
- for valid addresses. */
-
-#define ADDRESS_COST(RTX) 0
-
-/* Specify the cost of a branch insn; roughly the number of extra insns that
- should be added to avoid a branch. */
-
-#define BRANCH_COST 0
-
-/* Adjust the cost of dependences. */
-
-#define ADJUST_COST(INSN,LINK,DEP,COST) \
-{ \
- /* Antidependencies don't block issue. */ \
- if (REG_NOTE_KIND (LINK) != 0) \
- (COST) = 0; \
- /* C38 situations where delay depends on context */ \
- else if (TARGET_C38 \
- && GET_CODE (PATTERN (INSN)) == SET \
- && GET_CODE (PATTERN (DEP)) == SET) \
- { \
- enum attr_type insn_type = get_attr_type (INSN); \
- enum attr_type dep_type = get_attr_type (DEP); \
- /* index register must be ready one cycle early */ \
- if (insn_type == TYPE_MLDW || insn_type == TYPE_MLDL \
- || (insn_type == TYPE_MST \
- && reg_mentioned_p (SET_DEST (PATTERN (DEP)), \
- SET_SRC (PATTERN (INSN))))) \
- (COST) += 1; \
- /* alu forwarding off alu takes two */ \
- if (dep_type == TYPE_ALU \
- && insn_type != TYPE_ALU \
- && ! (insn_type == TYPE_MST \
- && SET_DEST (PATTERN (DEP)) == SET_SRC (PATTERN (INSN)))) \
- (COST) += 1; \
- } \
-}
-
-/* Convex uses Vax or IEEE floats.
- Follow the host format. */
-#define TARGET_FLOAT_FORMAT HOST_FLOAT_FORMAT
-
-/* But must prevent real.c from constructing Vax dfloats */
-#define REAL_VALUE_ATOF(X,S) atof (X)
-extern double atof();
-
-/* Check a `double' value for validity for a particular machine mode. */
-#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
- overflow = check_float_value (MODE, &D, OVERFLOW)
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). No extra ones are needed for convex. */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(EXP,INSN) {}
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#if _IEEE_FLOAT_
-#define ASM_FILE_START(FILE) fprintf (FILE, ";NO_APP\n.fpmode ieee\n")
-#else
-#define ASM_FILE_START(FILE) fprintf (FILE, ";NO_APP\n.fpmode native\n")
-#endif
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ";APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ";NO_APP\n"
-
-/* Alignment with Convex's assembler goes like this:
- .text can be .aligned up to a halfword.
- .data and .bss can be .aligned up to a longword.
- .lcomm is not supported, explicit declarations in .bss must be used instead.
- We get alignment for word and longword .text data by conventionally
- using .text 2 for word-aligned data and .text 3 for longword-aligned
- data. This requires that the data's size be a multiple of its alignment,
- which seems to be always true. */
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP (current_section_is_text = 1, ".text")
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP (current_section_is_text = 0, ".data")
-
-/* Output before uninitialized data. */
-
-#define BSS_SECTION_ASM_OP (current_section_is_text = 0, ".bss")
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if (current_section_is_text && (LOG) > 1) \
- fprintf (FILE, ".text %d\n", LOG); \
- else if (current_section_is_text) \
- fprintf (FILE, ".text\n.align %d\n", 1 << (LOG)); \
- else \
- fprintf (FILE, ".align %d\n", 1 << (LOG))
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{ \
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
- "sp", "a1", "a2", "a3", "a4", "a5", "ap", "fp", \
-}
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Do not break .stabs pseudos into continuations. */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* This is the char to use for continuation (in case we need to turn
- continuation back on). */
-
-#define DBX_CONTIN_CHAR '?'
-
-/* Don't use stab extensions until GDB v4 port is available for convex. */
-
-#define DEFAULT_GDB_EXTENSIONS 0
-#define DBX_NO_XREFS
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* Put case tables in .text 2, where they will be word-aligned */
-
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- ASM_OUTPUT_ALIGN (FILE, 2); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM)
-
-#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
- ASM_OUTPUT_ALIGN (FILE, 1)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- outfloat (FILE, VALUE, "%.17e", "\tds.d ", "\n")
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- outfloat (FILE, VALUE, "%.9e", "\tds.s ", "\n")
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-{ \
- fprintf (FILE, "\tds.w "); \
- output_addr_const (FILE, simplify_for_convex (VALUE)); \
- fprintf (FILE, "\n"); \
-}
-
-/* Likewise for a `long long int' constant. */
-
-#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
-{ \
- if (GET_CODE (VALUE) == CONST_DOUBLE) \
- fprintf (FILE, "\tds.w %d,%d\n", \
- const_double_high_int (VALUE), const_double_low_int (VALUE)); \
- else if (GET_CODE (VALUE) == CONST_INT) \
- { \
- int val = INTVAL (VALUE); \
- fprintf (FILE, "\tds.w %d,%d\n", val < 0 ? -1 : 0, val); \
- } \
- else \
- abort (); \
-}
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\tds.h "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\tds.b "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\tds.b %#x\n", (VALUE))
-
-/* This is how to output a string */
-
-#define ASM_OUTPUT_ASCII(FILE,STR,SIZE) do { \
- int i; \
- fprintf ((FILE), "\tds.b \""); \
- for (i = 0; i < (SIZE); i++) { \
- register int c = (STR)[i] & 0377; \
- if (c >= ' ' && c < 0177 && c != '\\' && c != '"') \
- putc (c, (FILE)); \
- else \
- fprintf ((FILE), "\\%03o", c);} \
- fprintf ((FILE), "\"\n");} while (0)
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tpsh.%c %s\n", \
- S_REGNO_P (REGNO) ? 'l' : 'w', \
- reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tpop.%c %s\n", \
- S_REGNO_P (REGNO) ? 'l' : 'w', \
- reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\tds.w L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative.
- (not used on Convex) */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\tds.w L%d-L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\tds.b %u(0)\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( bss_section (), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ":\tbs.b %u\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Output an arg count before function entries. */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- asm_declare_function_name (FILE, NAME, DECL)
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print an instruction operand X on file FILE.
- CODE is the code from the %-spec that requested printing this operand;
- if `%z3' was used to print operand 3, then CODE is 'z'. */
-
-#define PRINT_OPERAND(FILE, X, CODE) \
- print_operand (FILE, X, CODE)
-
-/* Print a memory operand whose address is X, on file FILE. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address (FILE, ADDR)
-
-/* Do not put out GNU stabs for constructors and destructors.
- ld bounces them. */
-
-#define FASCIST_ASSEMBLER
-
-/* __gcc_cleanup is loader-aliased to __ap$do_registered_functions if we
- are linking against standard libc, 0 if old (-traditional) libc. */
-
-#define EXIT_BODY \
-{ \
- extern void __gcc_cleanup (); \
- if (__gcc_cleanup != _cleanup) \
- __gcc_cleanup (); \
- _cleanup (); \
-}
-
-/* Header for convex.c.
- Here at the end so we can use types defined above. */
-
-extern int target_cpu;
-extern int current_section_is_text;
-extern enum reg_class regno_reg_class[];
-extern enum reg_class reg_class_from_letter[];
-extern char regno_ok_for_index_p_base[];
-#define regno_ok_for_index_p (regno_ok_for_index_p_base + 1)
-
-extern int const_double_low_int ();
-extern int const_double_high_int ();
-extern char *output_cmp ();
-extern char *output_condjump ();
-extern char *output_call ();
-extern void gen_ap_for_call ();
-extern int check_float_value ();
-extern void asm_declare_function_name ();
diff --git a/gcc/config/convex/convex.md b/gcc/config/convex/convex.md
deleted file mode 100644
index cb6f64dc39b..00000000000
--- a/gcc/config/convex/convex.md
+++ /dev/null
@@ -1,1885 +0,0 @@
-;;- Machine description for GNU compiler, Convex Version
-;; Copyright (C) 1988, 1994, 1995 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.
-
-;; Attribute specifications
-
-; Target CPU
-(define_attr "cpu" "c1,c32,c34,c38"
- (const (symbol_ref "(enum attr_cpu) target_cpu")))
-
-;; Instruction classification
-
-(define_attr "type"
- "alu,xalu,mldw,mldl,mldb,mst,adds,addd,mulw,mull,muls,muld,divw,divl,divs,divd,shfw,shfl,cvts,cvtd"
- (const_string "alu"))
-
-;; Instruction times
-
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "mldw")) 2 0)
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "mldl")) 4 0)
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "mldw,mldl")) 2 0)
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "mldw,mldl")) 4 0)
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "mldw,mldl")) 2 0)
-
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "mldb")) 9 0)
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "mldb")) 36 0)
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "mldb")) 21 0)
-
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "xalu")) 1 0)
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "xalu")) 1 0)
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "xalu")) 5 0)
-(define_function_unit "mem" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "xalu")) 2 0)
-
-(define_function_unit "add" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "adds,addd")) 3 2)
-(define_function_unit "add" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "adds,addd")) 2 1)
-(define_function_unit "add" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "adds,addd")) 5 2)
-(define_function_unit "add" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "adds,addd")) 2 1)
-
-(define_function_unit "mul" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "mulw,muls")) 3 2)
-(define_function_unit "mul" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "mulw,muls")) 4 2)
-(define_function_unit "mul" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "mulw,muls")) 6 2)
-(define_function_unit "mul" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "mulw,muls")) 3 2)
-
-(define_function_unit "mul" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "mull,muld")) 4 3)
-(define_function_unit "mul" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "mull")) 10 7)
-(define_function_unit "mul" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "muld")) 5 2)
-(define_function_unit "mul" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "mull,muld")) 7 3)
-(define_function_unit "mul" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "mull,muld")) 4 3)
-
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "divw")) 24 24)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "divw")) 44 6)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "divw")) 14 10)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "divw")) 11 10)
-
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "divl")) 41 42)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "divl")) 76 5)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "divl")) 22 18)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "divl")) 19 18)
-
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "divs")) 22 22)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "divs")) 8 6)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "divs")) 13 9)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "divs")) 10 9)
-
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "divd")) 37 38)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "divd")) 12 8)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "divd")) 20 16)
-(define_function_unit "div" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "divd")) 17 16)
-
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "cvts,cvtd")) 4 3)
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "cvts")) 9 7)
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "cvtd")) 9 6)
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "cvts")) 6 2)
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c34") (eq_attr "type" "cvtd")) 6 1)
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "cvts,cvtd")) 3 1)
-
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c1") (eq_attr "type" "shfw,shfl")) 3 2)
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "shfw")) 7 5)
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c32") (eq_attr "type" "shfl")) 7 4)
-(define_function_unit "misc" 1 0
- (and (eq_attr "cpu" "c38") (eq_attr "type" "shfw,shfl")) 3 1)
-
-(define_function_unit "mystery_latch" 1 1
- (and (eq_attr "type" "!alu,mldw,mldl,adds,addd") (eq_attr "cpu" "c32")) 2 2)
-
-;(define_function_unit "ip" 1 1
-; (and (eq_attr "cpu" "c1")
-; (eq_attr "type" "divw,divl,divs,divd,xalu")) 2 2)
-;(define_function_unit "ip" 1 1
-; (and (eq_attr "cpu" "c1")
-; (eq_attr "type" "!divw,divl,divs,divd,xalu")) 1 1)
-;(define_function_unit "ip" 1 1
-; (and (eq_attr "cpu" "c32")
-; (eq_attr "type" "mull,muld,divl,divd,shfl,cvtd,xalu")) 2 2)
-;(define_function_unit "ip" 1 1
-; (and (eq_attr "cpu" "c32")
-; (eq_attr "type" "!mull,muld,divl,divd,shfl,cvtd,xalu")) 1 1)
-;(define_function_unit "ip" 1 1
-; (and (eq_attr "cpu" "c34")
-; (eq_attr "type" "addd,mull,muld,divl,divd,cvtd,xalu")) 2 2)
-;(define_function_unit "ip" 1 1
-; (and (eq_attr "cpu" "c34")
-; (eq_attr "type" "!addd,mull,muld,divl,divd,cvtd,xalu")) 1 1)
-
-;; Make the first thing a real insn in case of genattrtab bug
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-;; Moves
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (DFmode, operands[1]);")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=d,d,d,d,d,<,m")
- (match_operand:DF 1 "general_operand" "d,Q,m,G,H,d,d"))]
- "register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode)"
- "@
- mov %1,%0
- ldb.d %1,%0
- ld.d %1,%0
- ld.d %u1,%0
- ld.l %v1,%0
- psh.l %1
- st.d %1,%0"
- [(set_attr "type" "alu,mldb,mldl,alu,alu,alu,mst")])
-
-;; This is here so we can load any result of RTL constant folding
-;; but do not use it on constants that can be loaded from memory.
-;; It is never better and can be worse.
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=d")
- (match_operand:DF 1 "const_double_operand" "F"))]
- "CONST_DOUBLE_MEM (operands[1]) == const0_rtx"
- "ld.u %u1,%0\;ld.w %v1,%0"
- [(set_attr "type" "xalu")])
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (SFmode, operands[1]);")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=d,d,d,d,<,m")
- (match_operand:SF 1 "general_operand" "d,Q,m,F,d,d"))]
- "register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode)"
- "@
- mov.s %1,%0
- ldb.s %1,%0
- ld.s %1,%0
- ld.s %1,%0
- psh.w %1
- st.s %1,%0"
- [(set_attr "type" "alu,mldb,mldw,alu,alu,mst")])
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (DImode, operands[1]);")
-
-(define_insn ""
- [(set (match_operand:DI 0 "general_operand" "=d,d,d,d,d,<,m")
- (match_operand:DI 1 "general_operand" "d,Q,m,G,HI,d,d"))]
- "register_operand (operands[0], DImode)
- || register_operand (operands[1], DImode)"
- "@
- mov %1,%0
- ldb.l %1,%0
- ld.l %1,%0
- ld.d %u1,%0
- ld.l %1,%0
- psh.l %1
- st.l %1,%0"
- [(set_attr "type" "alu,mldb,mldl,alu,alu,alu,mst")])
-
-;; This is here so we can load any result of RTL constant folding
-;; but do not use it on constants that can be loaded from memory.
-;; It is never better and can be worse.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (match_operand:DI 1 "const_double_operand" "F"))]
- "CONST_DOUBLE_MEM (operands[1]) == const0_rtx"
- "ld.u %u1,%0\;ld.w %v1,%0"
- [(set_attr "type" "xalu")])
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (SImode, operands[1]);")
-
-(define_insn ""
- [(set (match_operand:SI 0 "push_operand" "=<,<")
- (match_operand:SI 1 "nonmemory_operand" "Ad,i"))]
- ""
- "@
- psh.w %1
- pshea %a1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d,r,d,r,r,m")
- (match_operand:SI 1 "general_operand" "d,r,Q,m,i,r"))]
- "register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)"
- "@
- mov.w %1,%0
- mov %1,%0
- ldb.w %1,%0
- ld.w %1,%0
- ld.w %1,%0
- st.w %1,%0"
- [(set_attr "type" "alu,alu,mldb,mldw,alu,mst")])
-
-(define_expand "movstrictsi"
- [(set (strict_low_part (match_operand:SI 0 "general_operand" ""))
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (SImode, operands[1]);")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:SI 0 "general_operand" "=d,r,d,r,r,m"))
- (match_operand:SI 1 "general_operand" "d,r,Q,m,i,r"))]
- "register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)"
- "@
- mov.w %1,%0
- mov %1,%0
- ldb.w %1,%0
- ld.w %1,%0
- ld.w %1,%0
- st.w %1,%0"
- [(set_attr "type" "alu,alu,mldb,mldw,alu,mst")])
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (HImode, operands[1]);")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d,r,d,r,r,<,m")
- (match_operand:HI 1 "general_operand" "d,r,Q,m,i,Ad,r"))]
- "register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode)"
- "@
- mov.w %1,%0
- mov %1,%0
- ldb.h %1,%0
- ld.h %1,%0
- ld.w %1,%0
- psh.w %1
- st.h %1,%0"
- [(set_attr "type" "alu,alu,mldb,mldw,alu,alu,mst")])
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (QImode, operands[1]);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=d,r,d,r,r,<,m")
- (match_operand:QI 1 "general_operand" "d,r,Q,m,i,Ad,r"))]
- "register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode)"
- "@
- mov.w %1,%0
- mov %1,%0
- ldb.b %1,%0
- ld.b %1,%0
- ld.w %1,%0
- psh.w %1
- st.b %1,%0"
- [(set_attr "type" "alu,alu,mldb,mldw,alu,alu,mst")])
-
-;; Expand block moves manually to get code that pipelines the loads.
-
-(define_expand "movstrsi"
- [(set (match_operand:BLK 0 "memory_operand" "=m")
- (match_operand:BLK 1 "memory_operand" "m"))
- (use (match_operand:SI 2 "const_int_operand" "i"))
- (use (match_operand:SI 3 "const_int_operand" "i"))]
- ""
- " expand_movstr (operands); DONE; ")
-
-;; Extension and truncation insns.
-;; Those for integer source operand
-;; are ordered widest source type first.
-
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "register_operand" "=d,a")
- (truncate:QI (match_operand:SI 1 "register_operand" "d,a")))]
- ""
- "cvtw.b %1,%0")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (truncate:HI (match_operand:SI 1 "register_operand" "d,a")))]
- ""
- "cvtw.h %1,%0")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (truncate:QI (match_operand:HI 1 "register_operand" "0")))]
- ""
- "")
-
-(define_insn "truncdisi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI (match_operand:DI 1 "register_operand" "d")))]
- ""
- "cvtl.w %1,%0")
-
-(define_insn "extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (sign_extend:DI (match_operand:SI 1 "register_operand" "d")))]
- ""
- "cvtw.l %1,%0")
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (sign_extend:SI (match_operand:HI 1 "register_operand" "d,a")))]
- ""
- "cvth.w %1,%0")
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (sign_extend:HI (match_operand:QI 1 "register_operand" "d,a")))]
- ""
- "cvtb.w %1,%0")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (sign_extend:SI (match_operand:QI 1 "register_operand" "d,a")))]
- ""
- "cvtb.w %1,%0")
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (float_extend:DF (match_operand:SF 1 "register_operand" "d")))]
- ""
- "cvts.d %1,%0"
- [(set_attr "type" "cvts")])
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (float_truncate:SF (match_operand:DF 1 "register_operand" "d")))]
- ""
- "cvtd.s %1,%0"
- [(set_attr "type" "cvtd")])
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (match_operand:HI 1 "register_operand" "0")))]
- ""
- "and #0xffff,%0")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (zero_extend:HI (match_operand:QI 1 "register_operand" "0")))]
- ""
- "and #0xff,%0")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (match_operand:QI 1 "register_operand" "0")))]
- ""
- "and #0xff,%0")
-
-(define_insn "zero_extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (zero_extend:DI (match_operand:SI 1 "register_operand" "0")))]
- ""
- "ld.u #0,%0")
-
-;; Fix-to-float conversion insns.
-;; Note that the ones that start with SImode come first.
-;; That is so that an operand that is a CONST_INT
-;; (and therefore lacks a specific machine mode).
-;; will be recognized as SImode (which is always valid)
-;; rather than as QImode or HImode.
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (float:SF (match_operand:SI 1 "register_operand" "d")))]
- ""
- "cvtw.s %1,%0"
- [(set_attr "type" "cvts")])
-
-(define_insn "floatdisf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (float:SF (match_operand:DI 1 "register_operand" "d")))]
- ""
- "cvtl.s %1,%0"
- [(set_attr "type" "cvtd")])
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (float:DF (match_operand:SI 1 "register_operand" "d")))]
- "! TARGET_C1"
- "cvtw.d %1,%0"
- [(set_attr "type" "cvts")])
-
-(define_insn "floatdidf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (float:DF (match_operand:DI 1 "register_operand" "d")))]
- ""
- "cvtl.d %1,%0"
- [(set_attr "type" "cvtd")])
-
-;; These are a little slower than gcc's normal way of doing unsigned
-;; DI floats (if the DI number is "negative") but they avoid double
-;; rounding and they avoid explicit constants.
-
-(define_expand "floatunsdidf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (float:DF (match_operand:DI 1 "register_operand" "d")))
- (set (cc0) (compare:DI (match_dup 3) (match_dup 1)))
- (set (pc)
- (if_then_else (le (cc0) (const_int 0))
- (label_ref (match_dup 4))
- (pc)))
- (set (match_dup 2) (lshiftrt:DI (match_dup 1) (const_int 1)))
- (set (match_dup 0) (float:DF (match_dup 2)))
- (set (match_dup 0) (plus:DF (match_dup 0) (match_dup 0)))
- (match_dup 4)
- (set (match_dup 0) (match_dup 0))]
- ""
- "
-{
- operands[2] = gen_reg_rtx (DImode);
- operands[3] = force_reg (DImode, const0_rtx);
- operands[4] = gen_label_rtx ();
-}")
-
-(define_expand "floatunsdisf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (float:SF (match_operand:DI 1 "register_operand" "d")))
- (set (cc0) (compare:DI (match_dup 3) (match_dup 1)))
- (set (pc)
- (if_then_else (le (cc0) (const_int 0))
- (label_ref (match_dup 4))
- (pc)))
- (set (match_dup 2) (lshiftrt:DI (match_dup 1) (const_int 1)))
- (set (match_dup 0) (float:SF (match_dup 2)))
- (set (match_dup 0) (plus:SF (match_dup 0) (match_dup 0)))
- (match_dup 4)
- (set (match_dup 0) (match_dup 0))]
- ""
- "
-{
- operands[2] = gen_reg_rtx (DImode);
- operands[3] = force_reg (DImode, const0_rtx);
- operands[4] = gen_label_rtx ();
-}")
-
-;; These patterns are identical to gcc's default action
-;; if DI->DF and DI->SF are not present. There are here
-;; only to prevent SI->*F from promoting to DI->*F.
-
-(define_expand "floatunssidf2"
- [(set (match_dup 2)
- (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
- (set (match_operand:DF 0 "register_operand" "")
- (float:DF (match_dup 2)))]
- ""
- "operands[2] = gen_reg_rtx (DImode);")
-
-(define_expand "floatunssisf2"
- [(set (match_dup 2)
- (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
- (set (match_operand:SF 0 "register_operand" "")
- (float:SF (match_dup 2)))]
- ""
- "operands[2] = gen_reg_rtx (DImode);")
-
-;; Float-to-fix conversion insns.
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "d"))))]
- ""
- "cvts.w %1,%0"
- [(set_attr "type" "cvts")])
-
-(define_insn "fix_truncsfdi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "d"))))]
- ""
- "cvts.l %1,%0"
- [(set_attr "type" "cvts")])
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "d"))))]
- ""
- "cvtd.l %1,%0"
- [(set_attr "type" "cvtd")])
-
-(define_insn "fix_truncdfdi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "d"))))]
- ""
- "cvtd.l %1,%0"
- [(set_attr "type" "cvtd")])
-
-;;- All kinds of add instructions.
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (plus:DF (match_operand:DF 1 "register_operand" "%0")
- (match_operand:DF 2 "register_operand" "d")))]
- ""
- "add.d %2,%0"
- [(set_attr "type" "addd")])
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (plus:SF (match_operand:SF 1 "register_operand" "%0")
- (match_operand:SF 2 "nonmemory_operand" "dF")))]
- ""
- "add.s %2,%0"
- [(set_attr "type" "adds")])
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (plus:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "register_operand" "d")))]
- ""
- "add.l %2,%0")
-
-(define_expand "addsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=a")
- (plus:SI (match_operand:SI 1 "register_operand" "%A")
- (match_operand:SI 2 "immediate_operand" "i")))]
- "operands[1] == frame_pointer_rtx || operands[1] == arg_pointer_rtx"
- "ldea %a2(%1),%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=a")
- (plus:SI (match_operand:SI 1 "register_operand" "%a")
- (match_operand:SI 2 "nonmemory_operand" "ri")))]
- "operands[1] == stack_pointer_rtx && operands[0] != stack_pointer_rtx"
- "mov %1,%0\;add.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "push_operand" "=<")
- (plus:SI (match_operand:SI 1 "register_operand" "A")
- (match_operand:SI 2 "immediate_operand" "i")))]
- "operands[1] != stack_pointer_rtx"
- "pshea %a2(%1)"
- [(set_attr "type" "mst")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,a,a")
- (plus:SI (match_operand:SI 1 "register_operand" "%0,0,A")
- (match_operand:SI 2 "nonmemory_operand" "di,ri,i")))]
- "TARGET_C1"
- "@
- add.w %2,%0
- add.w %2,%0
- ldea %a2(%1),%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,a,r")
- (plus:SI (match_operand:SI 1 "register_operand" "%0,0,A")
- (match_operand:SI 2 "nonmemory_operand" "di,ri,i")))]
- ""
- "@
- add.w %2,%0
- add.w %2,%0
- ldea %a2(%1),%0")
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (plus:HI (match_operand:HI 1 "register_operand" "%0,0")
- (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
- ""
- "add.h %2,%0")
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "register_operand" "=d,d")
- (plus:QI (match_operand:QI 1 "register_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "d,i")))]
- ""
- "@
- add.b %2,%0
- add.w %2,%0")
-
-;;- All kinds of subtract instructions.
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (minus:DF (match_operand:DF 1 "register_operand" "0")
- (match_operand:DF 2 "register_operand" "d")))]
- ""
- "sub.d %2,%0"
- [(set_attr "type" "addd")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (minus:SF (match_operand:SF 1 "register_operand" "0")
- (match_operand:SF 2 "nonmemory_operand" "dF")))]
- ""
- "sub.s %2,%0"
- [(set_attr "type" "adds")])
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (minus:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:DI 2 "register_operand" "d")))]
- ""
- "sub.l %2,%0")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,a,?d,?a")
- (minus:SI (match_operand:SI 1 "nonmemory_operand" "0,0,di,ai")
- (match_operand:SI 2 "nonmemory_operand" "di,ai,0,0")))]
- ""
- "@
- sub.w %2,%0
- sub.w %2,%0
- sub.w %1,%0\;neg.w %0,%0
- sub.w %1,%0\;neg.w %0,%0")
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (minus:HI (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
- ""
- "sub.h %2,%0")
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "register_operand" "=d,d")
- (minus:QI (match_operand:QI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "d,i")))]
- ""
- "@
- sub.b %2,%0
- sub.w %2,%0")
-
-;;- Multiply instructions.
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (mult:DF (match_operand:DF 1 "register_operand" "%0")
- (match_operand:DF 2 "register_operand" "d")))]
- ""
- "mul.d %2,%0"
- [(set_attr "type" "muld")])
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (mult:SF (match_operand:SF 1 "register_operand" "%0")
- (match_operand:SF 2 "nonmemory_operand" "dF")))]
- ""
- "mul.s %2,%0"
- [(set_attr "type" "muls")])
-
-(define_insn "muldi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (mult:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "register_operand" "d")))]
- ""
- "mul.l %2,%0"
- [(set_attr "type" "mull")])
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (mult:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
- ""
- "mul.w %2,%0"
- [(set_attr "type" "mulw")])
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (mult:HI (match_operand:HI 1 "register_operand" "%0,0")
- (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
- ""
- "mul.h %2,%0"
- [(set_attr "type" "mulw")])
-
-(define_insn "mulqi3"
- [(set (match_operand:QI 0 "register_operand" "=d,d")
- (mult:QI (match_operand:QI 1 "register_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "d,i")))]
- ""
- "@
- mul.b %2,%0
- mul.w %2,%0"
- [(set_attr "type" "mulw,mulw")])
-
-;;- Divide instructions.
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (div:DF (match_operand:DF 1 "register_operand" "0")
- (match_operand:DF 2 "register_operand" "d")))]
- ""
- "div.d %2,%0"
- [(set_attr "type" "divd")])
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (div:SF (match_operand:SF 1 "register_operand" "0")
- (match_operand:SF 2 "nonmemory_operand" "dF")))]
- ""
- "div.s %2,%0"
- [(set_attr "type" "divs")])
-
-(define_insn "divdi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (div:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:DI 2 "register_operand" "d")))]
- ""
- "div.l %2,%0"
- [(set_attr "type" "divl")])
-
-(define_expand "udivsi3"
- [(set (match_dup 3)
- (zero_extend:DI (match_operand:SI 1 "register_operand" "")))
- (set (match_dup 4)
- (zero_extend:DI (match_operand:SI 2 "register_operand" "")))
- (set (match_dup 3)
- (div:DI (match_dup 3) (match_dup 4)))
- (set (match_operand:SI 0 "register_operand" "")
- (subreg:SI (match_dup 3) 0))]
- ""
- "operands[3] = gen_reg_rtx (DImode);
- operands[4] = gen_reg_rtx (DImode); ")
-
-(define_insn "udivdi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (udiv:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:DI 2 "register_operand" "d")))]
- ""
- "psh.l %2\;psh.l %1\;callq udiv64\;pop.l %0\;add.w #8,sp")
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (div:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
- ""
- "div.w %2,%0"
- [(set_attr "type" "divw")])
-
-(define_insn "divhi3"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (div:HI (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
- ""
- "div.h %2,%0"
- [(set_attr "type" "divw")])
-
-(define_insn "divqi3"
- [(set (match_operand:QI 0 "register_operand" "=d")
- (div:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "register_operand" "d")))]
- ""
- "div.b %2,%0"
- [(set_attr "type" "divw")])
-
-;;- Bit clear instructions.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (and:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "" "")))]
- "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- || (GET_CODE (operands[2]) == CONST_DOUBLE
- && CONST_DOUBLE_HIGH (operands[2]) == -1)"
- "and %2,%0")
-
-(define_insn "anddi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (and:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "register_operand" "d")))]
- ""
- "and %2,%0")
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (and:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
- ""
- "and %2,%0")
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (and:HI (match_operand:HI 1 "register_operand" "%0,0")
- (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
- ""
- "and %2,%0")
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "register_operand" "=d,a")
- (and:QI (match_operand:QI 1 "register_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "di,ai")))]
- ""
- "and %2,%0")
-
-;;- Bit set instructions.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ior:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "" "")))]
- "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0)
- || (GET_CODE (operands[2]) == CONST_DOUBLE
- && CONST_DOUBLE_HIGH (operands[2]) == 0)"
- "or %2,%0")
-
-(define_insn "iordi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ior:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "register_operand" "d")))]
- ""
- "or %2,%0")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (ior:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
- ""
- "or %2,%0")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (ior:HI (match_operand:HI 1 "register_operand" "%0,0")
- (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
- ""
- "or %2,%0")
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "register_operand" "=d,a")
- (ior:QI (match_operand:QI 1 "register_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "di,ai")))]
- ""
- "or %2,%0")
-
-;;- xor instructions.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (xor:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "" "")))]
- "(GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0)
- || (GET_CODE (operands[2]) == CONST_DOUBLE
- && CONST_DOUBLE_HIGH (operands[2]) == 0)"
- "xor %2,%0")
-
-(define_insn "xordi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (xor:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "register_operand" "d")))]
- ""
- "xor %2,%0")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (xor:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
- ""
- "xor %2,%0")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (xor:HI (match_operand:HI 1 "register_operand" "%0,0")
- (match_operand:HI 2 "nonmemory_operand" "di,ai")))]
- ""
- "xor %2,%0")
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "register_operand" "=d,a")
- (xor:QI (match_operand:QI 1 "register_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "di,ai")))]
- ""
- "xor %2,%0")
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (neg:DF (match_operand:DF 1 "register_operand" "d")))]
- ""
- "neg.d %1,%0"
- [(set_attr "type" "addd")])
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (neg:SF (match_operand:SF 1 "register_operand" "d")))]
- ""
- "neg.s %1,%0"
- [(set_attr "type" "adds")])
-
-(define_insn "negdi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (neg:DI (match_operand:DI 1 "register_operand" "d")))]
- ""
- "neg.l %1,%0")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (neg:SI (match_operand:SI 1 "register_operand" "d,a")))]
- ""
- "neg.w %1,%0")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (neg:HI (match_operand:HI 1 "register_operand" "d,a")))]
- ""
- "neg.h %1,%0")
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "register_operand" "=d")
- (neg:QI (match_operand:QI 1 "register_operand" "d")))]
- ""
- "neg.b %1,%0")
-
-(define_insn "one_cmpldi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (not:DI (match_operand:DI 1 "register_operand" "d")))]
- ""
- "not %1,%0")
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (not:SI (match_operand:SI 1 "register_operand" "d,a")))]
- ""
- "not %1,%0")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "register_operand" "=d,a")
- (not:HI (match_operand:HI 1 "register_operand" "d,a")))]
- ""
- "not %1,%0")
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "register_operand" "=d,a")
- (not:QI (match_operand:QI 1 "register_operand" "d,a")))]
- ""
- "not %1,%0")
-
-;;- Shifts
-;;
-;; The extreme profusion of patterns here is due to the different-speed
-;; shifts on different machines, and the C1's lack of word shift S-register
-;; instructions.
-
-;; SImode
-
-;; Arithmetic left 1, 1 cycle on all machines via add
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (const_int 1)))]
- ""
- "add.w %0,%0")
-
-;; C34 general shift is 1 cycle
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
- "TARGET_C34"
- "@
- shf.w %2,%0
- shf %2,%0"
- [(set_attr "type" "shfw,shfw")])
-
-;; else shift left 0..7 is 1 cycle if we use an A register
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=a,?d")
- (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "immediate_operand" "ai,di")))]
- "TARGET_C1 && INTVAL (operands[2]) < (unsigned) 8"
- "@
- shf %2,%0
- shf %2,%0"
- [(set_attr "type" "alu,shfl")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=a,?d")
- (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "immediate_operand" "ai,di")))]
- "INTVAL (operands[2]) < (unsigned) 8"
- "@
- shf %2,%0
- shf.w %2,%0"
- [(set_attr "type" "alu,shfw")])
-
-;; else general left shift
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
- "TARGET_C1"
- "@
- shf %2,%0
- shf %2,%0"
- [(set_attr "type" "shfl,shfw")])
-
-;; but C2 left shift by a constant is faster via multiply
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "const_int_operand" "i")))]
- "TARGET_C2 && INTVAL (operands[2]) < (unsigned) 32"
- "mul.w %z2,%0"
- [(set_attr "type" "mulw")])
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,a")
- (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "di,ai")))]
- ""
- "@
- shf.w %2,%0
- shf %2,%0"
- [(set_attr "type" "shfw,shfw")])
-
-;; Logical right, general
-;; The hardware wants the negative of the shift count
-
-(define_expand "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" ""))))]
- ""
- "operands[2] = negate_rtx (SImode, operands[2]);")
-
-;; C1 lacks word shift S reg
-
-(define_insn ""
- [(set
- (match_operand:SI 0 "register_operand" "=a,?d")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" "ai,di"))))]
- "TARGET_C1"
- "@
- shf %2,%0
- ld.u #0,%0\;shf %2,%0"
- [(set_attr "type" "shfw,shfl")])
-
-;; general case
-
-(define_insn ""
- [(set
- (match_operand:SI 0 "register_operand" "=d,a")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" "di,ai"))))]
- ""
- "@
- shf.w %2,%0
- shf %2,%0"
- [(set_attr "type" "shfw,shfw")])
-
-;; Patterns without neg produced by constant folding
-
-(define_insn ""
- [(set
- (match_operand:SI 0 "register_operand" "=a,?d")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "immediate_operand" "i,i")))]
- "TARGET_C1"
- "@
- shf #%n2,%0
- ld.u #0,%0\;shf #%n2,%0"
- [(set_attr "type" "shfw,shfl")])
-
-(define_insn ""
- [(set
- (match_operand:SI 0 "register_operand" "=d,a")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "immediate_operand" "i,i")))]
- ""
- "@
- shf.w #%n2,%0
- shf #%n2,%0"
- [(set_attr "type" "shfw,shfw")])
-
-;; Arithmetic right, general
-;; Sign-extend to 64 bits, then shift that. Works for 0..32.
-
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" ""))))]
- ""
- "operands[2] = negate_rtx (SImode, operands[2]);")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,&d")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,d")
- (neg:SI
- (match_operand:SI 2 "nonmemory_operand" "di,di"))))]
- ""
- "cvtw.l %1,%0\;shf %2,%0"
- [(set_attr "type" "shfl,shfl")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "cvtw.l %1,%0\;shf #%n2,%0"
- [(set_attr "type" "shfl")])
-
-;; DImode
-;; Arithmetic left, 1-cycle
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashift:DI (match_operand:DI 1 "register_operand" "0")
- (const_int 1)))]
- ""
- "add.l %0,%0")
-
-;; Arithmetic left, general
-
-(define_insn "ashldi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashift:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:SI 2 "nonmemory_operand" "di")))]
- ""
- "shf %2,%0"
- [(set_attr "type" "shfl")])
-
-;; Can omit zero- or sign-extend if shift is 32 or more.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "0"))
- (match_operand:SI 2 "const_int_operand" "i")))]
- "INTVAL (operands[2]) >= 32"
- "shf %2,%0"
- [(set_attr "type" "shfl")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashift:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "0"))
- (match_operand:SI 2 "const_int_operand" "i")))]
- "INTVAL (operands[2]) >= 32"
- "shf %2,%0"
- [(set_attr "type" "shfl")])
-
-;; Logical right, general
-
-(define_expand "lshrdi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" ""))))]
- ""
- "operands[2] = negate_rtx (SImode, operands[2]);")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" "di"))))]
- ""
- "shf %2,%0"
- [(set_attr "type" "shfl")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "shf #%n2,%0"
- [(set_attr "type" "shfl")])
-
-;; Arithmetic right, general
-;; Use
-;; ((a >> b) ^ signbit) - signbit
-;; where signbit is (1 << 63) >> b
-;; Works for 0..63. Does not work for 64; unfortunate but valid.
-
-(define_expand "ashrdi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
- (neg:SI (match_operand:SI 2 "nonmemory_operand" ""))))
- (set (match_dup 3) (lshiftrt:DI (match_dup 3) (neg:SI (match_dup 2))))
- (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 3)))
- (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 3)))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- switch (INTVAL (operands[2]))
- {
- case 32:
- emit_insn (gen_ashrdi3_32 (operands[0], operands[1]));
- DONE;
- }
-
- operands[2] = negate_rtx (SImode, operands[2]);
- operands[3] = force_reg (DImode, immed_double_const (0, 1 << 31, DImode));
-}")
-
-;; Arithmetic right 32, a common case that can save a couple of insns.
-
-(define_expand "ashrdi3_32"
- [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
- (const_int 32)))
- (set (match_dup 0)
- (sign_extend:DI (subreg:SI (match_dup 0) 0)))]
- ""
- "")
-
-;; __builtin instructions
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
- "! TARGET_C1 && flag_fast_math"
- "sqrt.d %0"
- [(set_attr "type" "divd")])
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
- "! TARGET_C1 && flag_fast_math"
- "sqrt.s %0"
- [(set_attr "type" "divs")])
-
-(define_insn "sindf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 1))]
- "! TARGET_C1 && flag_fast_math"
- "sin.d %0")
-
-(define_insn "sinsf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 1))]
- "! TARGET_C1 && flag_fast_math"
- "sin.s %0")
-
-(define_insn "cosdf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 2))]
- "! TARGET_C1 && flag_fast_math"
- "cos.d %0")
-
-(define_insn "cossf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 2))]
- "! TARGET_C1 && flag_fast_math"
- "cos.s %0")
-
-(define_insn "ftruncdf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (fix:DF (match_operand:DF 1 "register_operand" "d")))]
- "! TARGET_C1"
- "frint.d %1,%0"
- [(set_attr "type" "cvtd")])
-
-(define_insn "ftruncsf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (fix:SF (match_operand:SF 1 "register_operand" "d")))]
- "! TARGET_C1"
- "frint.s %1,%0"
- [(set_attr "type" "cvts")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (minus:SI (ffs:SI (match_operand:SI 1 "register_operand" "d"))
- (const_int 1)))]
- ""
- "tzc %1,%0\;le.w #32,%0\;jbrs.f L0%=\;ld.w #-1,%0\\nL0%=:")
-
-(define_expand "ffssi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (minus:SI (ffs:SI (match_operand:SI 1 "register_operand" "d"))
- (const_int 1)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- ""
- "")
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (abs:SF (match_operand:SF 1 "register_operand" "0")))]
- ""
- "and #0x7fffffff,%0")
-
-(define_expand "absdf2"
- [(set (subreg:DI (match_operand:DF 0 "register_operand" "=d") 0)
- (and:DI (subreg:DI (match_operand:DF 1 "register_operand" "d") 0)
- (match_dup 2)))]
- ""
- "operands[2] = force_reg (DImode,
- immed_double_const (-1, 0x7fffffff, DImode));")
-
-;;- Compares
-
-(define_insn "cmpdi"
- [(set (cc0)
- (compare (match_operand:DI 0 "register_operand" "d")
- (match_operand:DI 1 "register_operand" "d")))]
- ""
- "* return output_cmp (operands[0], operands[1], 'l');")
-
-(define_insn ""
- [(set (cc0) (match_operand:DI 0 "register_operand" "d"))
- (clobber (match_scratch:DI 1 "=d"))]
- "next_insn_tests_no_inequality (insn)"
- "* return output_cmp (operands[0], operands[1], 'L');")
-
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "register_operand" "d,a")
- (match_operand:SI 1 "nonmemory_operand" "di,ai")))]
- ""
- "* return output_cmp (operands[0], operands[1], 'w');")
-
-(define_insn "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "register_operand" "d,a")
- (match_operand:HI 1 "nonmemory_operand" "di,ai")))]
- ""
- "* return output_cmp (operands[0], operands[1], 'h');")
-
-; cmpqi is intentionally omitted.
-;
-; gcc will sign-extend or zero-extend the operands to the next
-; wider mode, HImode.
-;
-; For reg .cmp. constant, we just go with the halfword immediate
-; instruction. Perhaps the widening insn can be cse'd or combined away.
-; If not, we're still as good as loading a byte constant into a register
-; to do a reg-reg byte compare.
-;
-; The following patterns pick up cases that can use reg .cmp. reg after all.
-
-(define_insn ""
- [(set (cc0)
- (compare
- (sign_extend:HI (match_operand:QI 0 "register_operand" "d"))
- (sign_extend:HI (match_operand:QI 1 "register_operand" "d"))))]
- ""
- "* return output_cmp (operands[0], operands[1], 'b');")
-
-(define_insn ""
- [(set (cc0)
- (compare
- (ashift:HI (subreg:HI (match_operand:QI 0 "register_operand" "d") 0)
- (const_int 8))
- (ashift:HI (subreg:HI (match_operand:QI 1 "register_operand" "d") 0)
- (const_int 8))))]
- ""
- "* return output_cmp (operands[0], operands[1], 'b');")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:QI 0 "register_operand" "d")
- (match_operand:QI 1 "register_operand" "d")))]
- ""
- "* return output_cmp (operands[0], operands[1], 'b');")
-
-(define_insn ""
- [(set (cc0) (match_operand:QI 0 "register_operand" "d"))
- (clobber (match_scratch:QI 1 "=d"))]
- "next_insn_tests_no_inequality (insn)"
- "* return output_cmp (operands[0], operands[1], 'B');")
-
-(define_insn ""
- [(set (cc0) (subreg (match_operand:QI 0 "register_operand" "d") 0))
- (clobber (match_scratch:QI 1 "=d"))]
- "next_insn_tests_no_inequality (insn)"
- "* return output_cmp (operands[0], operands[1], 'B');")
-
-(define_insn ""
- [(set (cc0)
- (zero_extend (subreg (match_operand:QI 0 "register_operand" "d") 0)))
- (clobber (match_scratch:QI 1 "=d"))]
- "next_insn_tests_no_inequality (insn)"
- "* return output_cmp (operands[0], operands[1], 'B');")
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "register_operand" "d")
- (match_operand:DF 1 "register_operand" "d")))]
- ""
- "* return output_cmp (operands[0], operands[1], 'd');")
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "register_operand" "d")
- (match_operand:SF 1 "nonmemory_cmpsf_operand" "dF")))]
- ""
- "* return output_cmp (operands[0], operands[1], 's');")
-
-;; decrement-and-set-cc0 insns.
-;;
-;; The most important case where we can use the carry bit from an
-;; arithmetic insn to eliminate a redundant compare is the decrement in
-;; constructs like while (n--) and while (--n >= 0).
-;;
-;; We do it with combine patterns instead of NOTICE_UPDATE_CC because
-;; the decrement needs to be kept at the end of the block during scheduling.
-;;
-;; These patterns must have memory alternatives because reload refuses
-;; to do output reloads for an insn that sets cc0 (since it does not
-;; want to clobber cc0 with its moves). Convex moves do not clobber
-;; cc0, but there is no evident way to get reload to know that.
-
-(define_insn ""
- [(set (cc0)
- (match_operand:SI 0 "register_operand" "+r,*m"))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- "next_insn_tests_no_inequality (insn)"
- "*
-{
- if (which_alternative == 0)
- {
- output_cmp (operands[0], constm1_rtx, 'W');
- return \"add.w #-1,%0\";
- }
- else
- {
- output_cmp (gen_rtx (REG, SImode, 7), constm1_rtx, 'W');
- return \"psh.w s7\;ld.w %0,s7\;add.w #-1,s7\;st.w s7,%0\;pop.w s7\";
- }
-}")
-
-(define_insn ""
- [(set (cc0)
- (plus:SI (match_operand:SI 0 "register_operand" "+r,*m")
- (const_int -1)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- "find_reg_note (next_cc0_user (insn), REG_NONNEG, 0)"
- "*
-{
- if (which_alternative == 0)
- {
- output_cmp (operands[0], const0_rtx, 'W');
- return \"add.w #-1,%0\";
- }
- else
- {
- output_cmp (gen_rtx (REG, SImode, 7), const0_rtx, 'W');
- return \"psh.w s7\;ld.w %0,s7\;add.w #-1,s7\;st.w s7,%0\;pop.w s7\";
- }
-}")
-
-(define_insn ""
- [(set (cc0)
- (match_operand:HI 0 "register_operand" "+r,*m"))
- (set (match_dup 0)
- (plus:HI (match_dup 0)
- (const_int -1)))]
- "next_insn_tests_no_inequality (insn)"
- "*
-{
- if (which_alternative == 0)
- {
- output_cmp (operands[0], constm1_rtx, 'H');
- return \"add.h #-1,%0\";
- }
- else
- {
- output_cmp (gen_rtx (REG, HImode, 7), constm1_rtx, 'H');
- return \"psh.w s7\;ld.h %0,s7\;add.h #-1,s7\;st.h s7,%0\;pop.w s7\";
- }
-}")
-
-(define_insn ""
- [(set (cc0)
- (plus:HI (match_operand:HI 0 "register_operand" "+r,*m")
- (const_int -1)))
- (set (match_dup 0)
- (plus:HI (match_dup 0)
- (const_int -1)))]
- "find_reg_note (next_cc0_user (insn), REG_NONNEG, 0)"
- "*
-{
- if (which_alternative == 0)
- {
- output_cmp (operands[0], const0_rtx, 'H');
- return \"add.h #-1,%0\";
- }
- else
- {
- output_cmp (gen_rtx (REG, HImode, 7), const0_rtx, 'H');
- return \"psh.w s7\;ld.h %0,s7\;add.h #-1,s7\;st.h s7,%0\;pop.w s7\";
- }
-}")
-
-;;- Jumps
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jbr %l0")
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"eq\", 't'); ")
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"eq\", 'f'); ")
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"le\", 'f'); ")
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"leu\", 'f'); ")
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"lt\", 't'); ")
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"ltu\", 't'); ")
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"lt\", 'f'); ")
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"ltu\", 'f'); ")
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"le\", 't'); ")
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_condjump (operands[0], \"leu\", 't'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"eq\", 'f'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"eq\", 't'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"le\", 't'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"leu\", 't'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"lt\", 'f'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"ltu\", 'f'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"lt\", 't'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"ltu\", 't'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"le\", 'f'); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_condjump (operands[0], \"leu\", 'f'); ")
-
-;;- Calls
-
-(define_expand "call_pop"
- [(parallel [(call (match_operand:QI 0 "memory_operand" "m")
- (match_operand:SI 1 "const_int_operand" "i"))
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "const_int_operand" "i")
- (reg:SI 8)])]
- ""
- "")
-
-(define_insn ""
- [(call (match_operand:QI 0 "memory_operand" "m")
- (match_operand:SI 1 "const_int_operand" "i"))
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "const_int_operand" "i")
- (match_operand:SI 4 "" "")]
- ""
- "* return output_call (insn, &operands[0]);")
-
-(define_expand "call_value_pop"
- [(parallel [(set (match_operand 0 "" "=g")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:SI 2 "const_int_operand" "i")))
- (match_operand:SI 3 "const_int_operand" "i")
- (match_operand:SI 4 "const_int_operand" "i")
- (reg:SI 8)])]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand 0 "" "=g")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:SI 2 "const_int_operand" "i")))
- (match_operand:SI 3 "const_int_operand" "i")
- (match_operand:SI 4 "const_int_operand" "i")
- (match_operand:SI 5 "" "")]
- ""
- "* return output_call (insn, &operands[1]); ")
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call_pop (operands[0], const0_rtx,
- const0_rtx, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-(define_expand "return"
- [(return)]
- ""
- " replace_arg_pushes (); ")
-
-(define_insn ""
- [(return)]
- ""
- "rtn")
-
-(define_expand "prologue"
- [(const_int 0)]
- ""
- "
-{
- emit_ap_optimizations ();
- DONE;
-}")
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "address_operand" "p"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jmp %a0")
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
- ""
- "jmp %a0")
diff --git a/gcc/config/convex/fixinc.convex b/gcc/config/convex/fixinc.convex
deleted file mode 100644
index 0dc5f302c8c..00000000000
--- a/gcc/config/convex/fixinc.convex
+++ /dev/null
@@ -1,416 +0,0 @@
-
-# This is a shell archive. Remove anything before this line,
-# then unpack it by saving it in a file and typing "sh file".
-#
-# Wrapped by on Fri Mar 12 08:41:28 CST 1993
-# Contents: include/ include/limits.h include/math.h include/stddef.h
-# include/stdlib.h
-
-echo mkdir - include
-mkdir include
-chmod u=rwx,g=rwx,o=rx include
-
-echo x - include/limits.h
-sed 's/^@//' > "include/limits.h" <<'@//E*O*F include/limits.h//'
-#ifndef _LIMITS_H
-#define _LIMITS_H
-
-#include_next <limits.h>
-
-/* Minimum and maximum values a `char' can hold. */
-#ifdef __CHAR_UNSIGNED__
-#undef CHAR_MIN
-#define CHAR_MIN 0
-#undef CHAR_MAX
-#define CHAR_MAX 255
-#endif
-
-#endif /* _LIMITS_H */
-@//E*O*F include/limits.h//
-chmod u=rw,g=rw,o=r include/limits.h
-
-echo x - include/math.h
-sed 's/^@//' > "include/math.h" <<'@//E*O*F include/math.h//'
-#ifndef _MATH_H
-#define _MATH_H
-
-#include_next <math.h>
-
-#undef HUGE_VAL
-
-#if _IEEE_FLOAT_
-#define HUGE_VAL 1.79769313486231570e+308
-#else
-#define HUGE_VAL 8.98846567431157854e+307
-#endif
-
-#if __OPTIMIZE__ && ! __NO_INLINE
-
-#define frexp(x,y) __inline_frexp ((x), (y))
-#define ldexp(x,y) __inline_ldexp ((x), (y))
-#define irint(x) __inline_irint (x)
-#define frexpf(x,y) __inline_frexpf ((x), (y))
-#define ldexpf(x,y) __inline_ldexpf ((x), (y))
-#define irintf(x) __inline_irintf (x)
-
-#if __convex_c2__ || __convex_c32__ || __convex_c34__ || __convex_c38__
-
-#define atan(x) __inline_atan (x)
-#define ceil(x) __inline_ceil (x)
-#define cos(x) __inline_cos (x)
-#define exp(x) __inline_exp (x)
-#define floor(x) __inline_floor (x)
-#define log(x) __inline_log (x)
-#define log10(x) __inline_log10 (x)
-#define modf(x,y) __inline_modf ((x), (y))
-#define rint(x) __inline_rint (x)
-#define sin(x) __inline_sin (x)
-#define sqrt(x) __inline_sqrt (x)
-
-#define atanf(x) __inline_atanf (x)
-#define ceilf(x) __inline_ceilf (x)
-#define cosf(x) __inline_cosf (x)
-#define expf(x) __inline_expf (x)
-#define floorf(x) __inline_floorf (x)
-#define logf(x) __inline_logf (x)
-#define log10f(x) __inline_log10f (x)
-#define modff(x,y) __inline_modff ((x), (y))
-#define rintf(x) __inline_rintf (x)
-#define sinf(x) __inline_sinf (x)
-#define sqrtf(x) __inline_sqrtf (x)
-
-#endif /* __convex_c[23*]__ */
-
-#endif /* __OPTIMIZE__ */
-
-static __inline__ __const__ double __inline_atan (double x)
-{
- double z;
- __asm__ ("atan.d %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ float __inline_atanf (float x)
-{
- float z;
- __asm__ ("atan.s %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ double __inline_cos (double x)
-{
- double z;
- __asm__ ("cos.d %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ float __inline_cosf (float x)
-{
- float z;
- __asm__ ("cos.s %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ double __inline_exp (double x)
-{
- double z;
- __asm__ ("exp.d %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ float __inline_expf (float x)
-{
- float z;
- __asm__ ("exp.s %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ double __inline_log (double x)
-{
- double z;
- __asm__ ("ln.d %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ float __inline_logf (float x)
-{
- float z;
- __asm__ ("ln.s %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ double __inline_sin (double x)
-{
- double z;
- __asm__ ("sin.d %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ float __inline_sinf (float x)
-{
- float z;
- __asm__ ("sin.s %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ double __inline_sqrt (double x)
-{
- double z;
- __asm__ ("sqrt.d %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ float __inline_sqrtf (float x)
-{
- float z;
- __asm__ ("sqrt.s %0" : "=d" (z) : "0" (x));
- return z;
-}
-
-static __inline__ __const__ double __inline_ceil (double x)
-{
- double z;
- __asm__ ("frint.d %1,%0" : "=d" (z) : "d" (x));
- if (z < x) z += 1.0;
- return z;
-}
-
-static __inline__ __const__ float __inline_ceilf (float x)
-{
- float z;
- __asm__ ("frint.s %1,%0" : "=d" (z) : "d" (x));
- if (z < x) z += 1.0F;
- return z;
-}
-
-static __inline__ __const__ double __inline_floor (double x)
-{
- double z;
- __asm__ ("frint.d %1,%0" : "=d" (z) : "d" (x));
- if (z > x) z -= 1.0;
- return z;
-}
-
-static __inline__ __const__ float __inline_floorf (float x)
-{
- float z;
- __asm__ ("frint.s %1,%0" : "=d" (z) : "d" (x));
- if (z > x) z -= 1.0F;
- return z;
-}
-
-static __inline__ __const__ double __inline_log10 (double x)
-{
- return 0.43429448190325182765 * __inline_log (x);
-}
-
-static __inline__ __const__ float __inline_log10f (float x)
-{
- return 0.43429448190325182765F * __inline_logf (x);
-}
-
-static __inline__ double __inline_modf (double x, double *np)
-{
- double intpart;
- __asm__ ("frint.d %1,%0" : "=d" (intpart) : "d" (x));
- *np = intpart;
- return x - intpart;
-}
-
-static __inline__ float __inline_modff (float x, float *np)
-{
- float intpart;
- __asm__ ("frint.s %1,%0" : "=d" (intpart) : "d" (x));
- *np = intpart;
- return x - intpart;
-}
-
-static __inline__ double __inline_frexp (double x, int *np)
-{
- union u { double d; unsigned long long ll; } u;
- if ((u.d = x) == 0)
- *np = 0;
- else
- {
-#if _IEEE_FLOAT_
- *np = ((u.ll >> 52) & 03777) - 01776;
- u.ll = (u.ll & 0x800fffffffffffffLL) | 0x3fe0000000000000LL;
-#else
- *np = ((u.ll >> 52) & 03777) - 02000;
- u.ll = (u.ll & 0x800fffffffffffffLL) | 0x4000000000000000LL;
-#endif
- }
- return u.d;
-}
-
-static __inline__ float __inline_frexpf (float x, int *np)
-{
- union u { float f; unsigned int i; } u;
- if ((u.f = x) == 0)
- *np = 0;
- else
- {
-#if _IEEE_FLOAT_
- *np = ((u.i >> 23) & 0377) - 0176;
- u.i = (u.i & 0x807fffff) | 0x3f000000;
-#else
- *np = ((u.i >> 23) & 0377) - 0200;
- u.i = (u.i & 0x807fffff) | 0x40000000;
-#endif
- }
- return u.f;
-}
-
-static __inline__ double __inline_ldexp (double x, int n)
-{
- extern int errno;
- union { double d; long long ll; unsigned sexp : 12; } u;
- if ((u.d = x) != 0)
- {
- int exp = n + (u.sexp & 03777);
- long long nn = (long long) n << 52;
-#if _IEEE_FLOAT_
- if (exp <= 0)
- u.ll &= 0x8000000000000000LL, errno = 34;
- else if (exp > 03776)
- u.ll = u.ll & 0x8000000000000000LL | 0x7fefffffffffffffLL, errno = 34;
-#else
- if (exp <= 0)
- u.ll = 0, errno = 34;
- else if (exp > 03777)
- u.ll |= 0x7fffffffffffffffLL, errno = 34;
-#endif
- else
- u.ll += nn;
- }
- return u.d;
-}
-
-static __inline__ float __inline_ldexpf (float x, int n)
-{
- extern int errno;
- union { float f; int i; unsigned sexp : 9; } u;
- if ((u.f = x) != 0)
- {
- int exp = n + (u.sexp & 0377);
- int nn = n << 23;
-#if _IEEE_FLOAT_
- if (exp <= 0)
- u.i &= 0x80000000, errno = 34;
- else if (exp > 0376)
- u.i = u.i & 0x80000000 | 0x7f7fffff, errno = 34;
-#else
- if (exp <= 0)
- u.i = 0, errno = 34;
- else if (exp > 0377)
- u.i |= 0x7fffffff, errno = 34;
-#endif
- else
- u.i += nn;
- }
- return u.f;
-}
-
-static __inline__ __const__ double __inline_rint (double x)
-{
- double z;
- union { double d; unsigned long long ll; } u;
- u.d = x;
-#if _IEEE_FLOAT_
- u.ll = (u.ll & 0x8000000000000000LL) | 0x3fe0000000000000LL;
-#else
- u.ll = (u.ll & 0x8000000000000000LL) | 0x4000000000000000LL;
-#endif
- __asm__ ("frint.d %1,%0" : "=d" (z) : "d" (x + u.d));
- return z;
-}
-
-static __inline__ __const__ float __inline_rintf (float x)
-{
- float z;
- union { float f; unsigned int i; } u;
- u.f = x;
-#if _IEEE_FLOAT_
- u.i = (u.i & 0x80000000) | 0x3f000000;
-#else
- u.i = (u.i & 0x80000000) | 0x40000000;
-#endif
- __asm__ ("frint.s %1,%0" : "=d" (z) : "d" (x + u.f));
- return z;
-}
-
-static __inline__ __const__ int __inline_irint (double x)
-{
- union { double d; unsigned long long ll; } u;
- u.d = x;
-#if _IEEE_FLOAT_
- u.ll = (u.ll & 0x8000000000000000LL) | 0x3fe0000000000000LL;
-#else
- u.ll = (u.ll & 0x8000000000000000LL) | 0x4000000000000000LL;
-#endif
- return x + u.d;
-}
-
-static __inline__ __const__ int __inline_irintf (float x)
-{
- union { float f; unsigned int i; } u;
- u.f = x;
-#if _IEEE_FLOAT_
- u.i = (u.i & 0x80000000) | 0x3f000000;
-#else
- u.i = (u.i & 0x80000000) | 0x40000000;
-#endif
- return x + u.f;
-}
-
-#endif /* _MATH_H */
-@//E*O*F include/math.h//
-chmod u=rw,g=rw,o=r include/math.h
-
-echo x - include/stddef.h
-sed 's/^@//' > "include/stddef.h" <<'@//E*O*F include/stddef.h//'
-#ifndef _STDDEF_H
-#define _STDDEF_H
-
-#ifndef __WCHAR_T
-#define __WCHAR_T
-
-#ifdef __GNUG__
-/* In C++, wchar_t is a distinct basic type,
- and we can expect __wchar_t to be defined by cc1plus. */
-typedef __wchar_t wchar_t;
-#else
-/* In C, cpp tells us which type to make an alias for. */
-typedef __WCHAR_TYPE__ wchar_t;
-#endif
-
-#endif /* __WCHAR_T */
-
-#include_next <stddef.h>
-
-#endif /* _STDDEF_H */
-@//E*O*F include/stddef.h//
-chmod u=rw,g=rw,o=r include/stddef.h
-
-echo x - include/stdlib.h
-sed 's/^@//' > "include/stdlib.h" <<'@//E*O*F include/stdlib.h//'
-#ifndef _STDLIB_H
-#define _STDLIB_H
-
-#if _CONVEX_SOURCE
-
-#define alloca __non_builtin_alloca
-#include_next <stdlib.h>
-#undef alloca
-
-#else
-
-#include_next <stdlib.h>
-
-#endif /* _CONVEX_SOURCE */
-
-#endif /* _STDLIB_H */
-@//E*O*F include/stdlib.h//
-chmod u=rw,g=rw,o=r include/stdlib.h
-
-exit 0
diff --git a/gcc/config/convex/x-convex b/gcc/config/convex/x-convex
deleted file mode 100644
index e1fbe742d03..00000000000
--- a/gcc/config/convex/x-convex
+++ /dev/null
@@ -1,5 +0,0 @@
-# ld can make exe's c2-only if this lib is searched even though not loaded
-CCLIBFLAGS = -tm c1
-
-# Use -pcc to avoid surprises.
-CC = cc -pcc
diff --git a/gcc/config/convex/xm-convex.h b/gcc/config/convex/xm-convex.h
deleted file mode 100644
index ebe334579ec..00000000000
--- a/gcc/config/convex/xm-convex.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Configuration for GNU C-compiler for Convex.
- Copyright (C) 1989, 1993 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* Convex ships /tmp as a separate file system - thus it
- usually has more free space than /usr/tmp */
-
-#define P_tmpdir "/tmp/"
-
-/* Use memcpy and memset -- either would work but these get inlined. */
-
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-
-/* Convex uses Vax or IEEE floats.
- Both formats have Vax semantics. */
-
-#define HOST_FLOAT_FORMAT VAX_FLOAT_FORMAT
diff --git a/gcc/config/dbx.h b/gcc/config/dbx.h
deleted file mode 100644
index c5cd3b5f2d0..00000000000
--- a/gcc/config/dbx.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Prefer DBX (stabs) debugging information.
- Copyright (C) 1996 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 causes gcc to prefer using DBX (stabs) debugging
- information. The configure script will add a #include of this file
- to tm.h when --with-stabs is used for certain targets. */
-
-#ifndef DBX_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-#endif
-
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
diff --git a/gcc/config/dbxcoff.h b/gcc/config/dbxcoff.h
deleted file mode 100644
index 1ee6dd576ba..00000000000
--- a/gcc/config/dbxcoff.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Definitions needed when using stabs embedded in COFF sections.
- Copyright (C) 1996 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 may be included by any COFF target which wishes to
- support -gstabs generating stabs in sections, as produced by gas
- and understood by gdb. */
-
-/* Output DBX (stabs) debugging information if doing -gstabs. */
-
-#undef DBX_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-
-/* Generate SDB debugging information by default. */
-
-#ifndef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
-#endif
-
-/* Be function-relative for block and source line stab directives. */
-
-#undef DBX_BLOCKS_FUNCTION_RELATIVE
-#define DBX_BLOCKS_FUNCTION_RELATIVE 1
-
-/* but, to make this work, functions must appear prior to line info. */
-
-#undef DBX_FUNCTION_FIRST
-#define DBX_FUNCTION_FIRST
-
-/* Generate a blank trailing N_SO to mark the end of the .o file, since
- we can't depend upon the linker to mark .o file boundaries with
- embedded stabs. */
-
-#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
- fprintf (FILE, \
- "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO)
-
-/* Like block addresses, stabs line numbers are relative to the
- current function. */
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
-{ if (write_symbols == SDB_DEBUG) { \
- fprintf ((FILE), "\t.ln\t%d\n", \
- ((sdb_begin_function_line > -1) \
- ? (LINE) - sdb_begin_function_line : 1)); \
- } else if (write_symbols == DBX_DEBUG) { \
- static int sym_lineno = 1; \
- fprintf (FILE, ".stabn 68,0,%d,.LM%d-", \
- LINE, sym_lineno); \
- assemble_name (FILE, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- fprintf (FILE, "\n.LM%d:\n", sym_lineno); \
- sym_lineno += 1; \
- } }
-
-/* When generating stabs debugging, use N_BINCL entries. */
-
-#undef DBX_USE_BINCL
-#define DBX_USE_BINCL
-
-/* There is no limit to the length of stabs strings. */
-
-#ifndef DBX_CONTIN_LENGTH
-#define DBX_CONTIN_LENGTH 0
-#endif
diff --git a/gcc/config/dsp16xx/dsp16xx.c b/gcc/config/dsp16xx/dsp16xx.c
deleted file mode 100644
index 90b316d5a1c..00000000000
--- a/gcc/config/dsp16xx/dsp16xx.c
+++ /dev/null
@@ -1,2226 +0,0 @@
-/* Subroutines for assembler code output on the DSP1610.
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
- Contributed by Michael Collison (collison@world.std.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. */
-
-/* Some output-actions in dsp1600.md need these. */
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "tree.h"
-#include "expr.h"
-#include "flags.h"
-
-char *text_seg_name;
-char *rsect_text;
-char *data_seg_name;
-char *rsect_data;
-char *bss_seg_name;
-char *rsect_bss;
-char *const_seg_name;
-char *rsect_const;
-
-char *chip_name;
-char *save_chip_name;
-
-/* Save the operands of a compare. The 16xx has not lt or gt, so
- in these cases we swap the operands and reverse the condition */
-
-rtx dsp16xx_compare_op0;
-rtx dsp16xx_compare_op1;
-struct rtx_def *(*dsp16xx_compare_gen)();
-
-static char *fp;
-static char *sp;
-static char *rr;
-static char *a1h;
-
-struct dsp16xx_frame_info current_frame_info;
-struct dsp16xx_frame_info zero_frame_info;
-
-rtx dsp16xx_addhf3_libcall = (rtx) 0;
-rtx dsp16xx_subhf3_libcall = (rtx) 0;
-rtx dsp16xx_mulhf3_libcall = (rtx) 0;
-rtx dsp16xx_divhf3_libcall = (rtx) 0;
-rtx dsp16xx_cmphf3_libcall = (rtx) 0;
-rtx dsp16xx_fixhfhi2_libcall = (rtx) 0;
-rtx dsp16xx_floathihf2_libcall = (rtx) 0;
-rtx dsp16xx_neghf2_libcall = (rtx) 0;
-
-rtx dsp16xx_mulhi3_libcall = (rtx) 0;
-rtx dsp16xx_udivqi3_libcall = (rtx) 0;
-rtx dsp16xx_udivhi3_libcall = (rtx) 0;
-rtx dsp16xx_divqi3_libcall = (rtx) 0;
-rtx dsp16xx_divhi3_libcall = (rtx) 0;
-rtx dsp16xx_modqi3_libcall = (rtx) 0;
-rtx dsp16xx_modhi3_libcall = (rtx) 0;
-rtx dsp16xx_umodqi3_libcall = (rtx) 0;
-rtx dsp16xx_umodhi3_libcall = (rtx) 0;
-rtx dsp16xx_ashrhi3_libcall = (rtx) 0;
-rtx dsp16xx_ashlhi3_libcall = (rtx) 0;
-rtx dsp16xx_ucmphi2_libcall = (rtx) 0;
-rtx dsp16xx_lshrhi3_libcall = (rtx) 0;
-
-char *himode_reg_name[] = HIMODE_REGISTER_NAMES;
-
-#define SHIFT_INDEX_1 0
-#define SHIFT_INDEX_4 1
-#define SHIFT_INDEX_8 2
-#define SHIFT_INDEX_16 3
-
-static char *ashift_right_asm[] =
-{
- "%0=%0>>1",
- "%0=%0>>4",
- "%0=%0>>8",
- "%0=%0>>16"
-};
-
-static char *ashift_right_asm_first[] =
-{
- "%0=%1>>1",
- "%0=%1>>4",
- "%0=%1>>8",
- "%0=%1>>16"
-};
-
-static char *ashift_left_asm[] =
-{
- "%0=%0<<1",
- "%0=%0<<4",
- "%0=%0<<8",
- "%0=%0<<16"
-};
-
-static char *ashift_left_asm_first[] =
-{
- "%0=%1<<1",
- "%0=%1<<4",
- "%0=%1<<8",
- "%0=%1<<16"
-};
-
-static char *lshift_right_asm[] =
-{
- "%0=%0>>1\n\t%0=%b0&0x7fff",
- "%0=%0>>4\n\t%0=%b0&0x0fff",
- "%0=%0>>8\n\t%0=%b0&0x00ff",
- "%0=%0>>16\n\t%0=%b0&0x0000"
-};
-
-static char *lshift_right_asm_first[] =
-{
- "%0=%1>>1\n\t%0=%b0&0x7fff",
- "%0=%1>>4\n\t%0=%b0&0x0fff",
- "%0=%1>>8\n\t%0=%b0&0x00ff",
- "%0=%1>>16\n\t%0=%b0&0x0000"
-};
-
-int
-hard_regno_mode_ok (regno, mode)
-int regno;
-enum machine_mode mode;
-{
- switch ((int) mode)
- {
- case VOIDmode:
- return 1;
-
- /*
- We can't use the c0-c2 for QImode, since they are only
- 8 bits in length */
-
- case QImode:
- if (regno != REG_C0 && regno != REG_C1 && regno != REG_C2)
- return 1;
- else
- return 0;
-
- /* We only allow a0, a1, y, and p to be allocated for 32-bit modes.
- Additionally we allow the virtual ybase registers to be used for 32-bit
- modes. */
-
- case HFmode:
- case SFmode:
- case DFmode:
- case XFmode:
- case HImode:
- case SImode:
- case DImode:
- if (regno == REG_A0 || regno == REG_A1 || regno == REG_Y || regno == REG_PROD
- || (IS_YBASE_REGISTER_WINDOW(regno) && ((regno & 1) == 0)))
- return 1;
- else
- return 0;
-
- default:
- return 0;
- }
-}
-
-enum reg_class
-dsp16xx_reg_class_from_letter (c)
-int c;
-{
- switch (c)
- {
- case 'A':
- return ACCUM_REGS;
-
- case 'h':
- return ACCUM_HIGH_REGS;
-
- case 'j':
- return A0H_REG;
-
- case 'k':
- return A0L_REG;
-
- case 'q':
- return A1H_REG;
-
- case 'u':
- return A1L_REG;
-
- case 'x':
- return X_REG;
-
- case 'y':
- return YH_REG;
-
- case 'z':
- return YL_REG;
-
- case 't':
- return P_REG;
-
- case 'Z':
- return Y_OR_P_REGS;
-
- case 'd':
- return ACCUM_Y_OR_P_REGS;
-
- case 'C':
- return NO_FRAME_Y_ADDR_REGS;
-
- case 'a':
- return Y_ADDR_REGS;
-
- case 'B':
- return (TARGET_BMU ? BMU_REGS : NO_REGS);
-
- case 'Y':
- return YBASE_VIRT_REGS;
-
- case 'v':
- return PH_REG;
-
- case 'w':
- return PL_REG;
-
- case 'W':
- return J_REG;
-
- case 'e':
- return YBASE_ELIGIBLE_REGS;
-
- case 'b':
- return ACCUM_LOW_REGS;
-
- case 'c':
- return NON_YBASE_REGS;
-
- case 'f':
- return Y_REG;
-
- case 'D':
- return SLOW_MEM_LOAD_REGS;
-
- default:
- fatal ("Invalid register class letter %c", c);
- return NO_REGS;
- }
-}
-/* Return the class number of the smallest class containing
- reg number REGNO. */
-
-int
-regno_reg_class(regno)
-int regno;
-{
- switch (regno)
- {
- case REG_A0L:
- return (int) A0L_REG;
- case REG_A1L:
- return (int) A1L_REG;
-
- case REG_A0:
- return (int) A0H_REG;
- case REG_A1:
- return (int) A1H_REG;
-
- case REG_X:
- return (int) X_REG;
-
- case REG_Y:
- return (int) YH_REG;
- case REG_YL:
- return (int) YL_REG;
-
- case REG_PROD:
- return (int) PH_REG;
- case REG_PRODL:
- return (int) PL_REG;
-
- case REG_R0: case REG_R1: case REG_R2: case REG_R3:
- return (int) Y_ADDR_REGS;
-
- case REG_J:
- return (int) J_REG;
- case REG_K:
- return (int) GENERAL_REGS;
-
- case REG_YBASE:
- return (int) GENERAL_REGS;
-
- case REG_PT:
- return (int) GENERAL_REGS;
-
- case REG_AR0: case REG_AR1: case REG_AR2: case REG_AR3:
- return (int) BMU_REGS;
-
- case REG_C0: case REG_C1: case REG_C2:
- return (int) GENERAL_REGS;
-
- case REG_PR:
- return (int) GENERAL_REGS;
-
- case REG_RB:
- return (int) GENERAL_REGS;
-
- case REG_YBASE0: case REG_YBASE1: case REG_YBASE2: case REG_YBASE3:
- case REG_YBASE4: case REG_YBASE5: case REG_YBASE6: case REG_YBASE7:
- case REG_YBASE8: case REG_YBASE9: case REG_YBASE10: case REG_YBASE11:
- case REG_YBASE12: case REG_YBASE13: case REG_YBASE14: case REG_YBASE15:
- case REG_YBASE16: case REG_YBASE17: case REG_YBASE18: case REG_YBASE19:
- case REG_YBASE20: case REG_YBASE21: case REG_YBASE22: case REG_YBASE23:
- case REG_YBASE24: case REG_YBASE25: case REG_YBASE26: case REG_YBASE27:
- case REG_YBASE28: case REG_YBASE29: case REG_YBASE30: case REG_YBASE31:
- return (int) YBASE_VIRT_REGS;
-
- default:
- return (int) NO_REGS;
- }
-}
-
-/* A C expression for the maximum number of consecutive registers of class CLASS
- needed to hold a value of mode MODE */
-
-int
-class_max_nregs(class, mode)
-enum reg_class class;
-enum machine_mode mode;
-{
- return (GET_MODE_SIZE(mode));
-}
-
-enum reg_class
-limit_reload_class (mode, class)
-enum machine_mode mode;
-enum reg_class class;
-{
- switch ((int) class)
- {
- case NO_REGS:
- case A0H_REG:
- case A0L_REG:
- case A0_REG:
- case A1H_REG:
- return class;
-
- case ACCUM_HIGH_REGS:
- fatal ("ACCUM_HIGH_REGS class in limit_reload_class");
-
- case A1L_REG:
- case ACCUM_LOW_REGS:
- case A1_REG:
- return class;
-
- case ACCUM_REGS:
- if (GET_MODE_SIZE(mode) == 1)
- return ACCUM_LOW_REGS;
- else
- return class;
-
- case X_REG:
- case X_OR_ACCUM_LOW_REGS:
- return class;
-
- case X_OR_ACCUM_REGS:
- if (GET_MODE_SIZE(mode) == 1)
- return X_OR_ACCUM_LOW_REGS;
- else
- return class;
-
- case YH_REG:
- return class;
-
- case YH_OR_ACCUM_HIGH_REGS:
- fatal ("YH_OR_ACCUM_HIGH_REGS found in limit_reload_class");
-
- case X_OR_YH_REGS:
- return class;
-
- case YL_REG:
- /* Register 'yl' is invalid for QImode, so we should never
- see it. */
-
- fatal ("YL found in limit_reload_class");
-
- case YL_OR_ACCUM_LOW_REGS:
- case X_OR_YL_REGS:
- return class;
-
- case Y_REG:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return YH_REG;
-
- case ACCUM_OR_Y_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return YL_OR_ACCUM_LOW_REGS;
-
- case PH_REG:
- case X_OR_PH_REGS:
- case PL_REG:
- case PL_OR_ACCUM_LOW_REGS:
- case X_OR_PL_REGS:
- return class;
-
- case P_REG:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return PL_REG;
-
- case ACCUM_OR_P_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return PL_OR_ACCUM_LOW_REGS;
-
- case YL_OR_P_REGS:
- case ACCUM_LOW_OR_YL_OR_P_REGS:
- return class;
-
- case Y_OR_P_REGS:
- return class;
-
- case ACCUM_Y_OR_P_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return ACCUM_LOW_OR_YL_OR_P_REGS;
-
- case NO_FRAME_Y_ADDR_REGS:
- case Y_ADDR_REGS:
- case ACCUM_LOW_OR_Y_ADDR_REGS:
- return class;
-
- case ACCUM_OR_Y_ADDR_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return ACCUM_REGS;
- else
- return ACCUM_LOW_OR_Y_ADDR_REGS;
-
- case X_OR_Y_ADDR_REGS:
- return class;
-
- case Y_OR_Y_ADDR_REGS:
- case P_OR_Y_ADDR_REGS:
- case NON_HIGH_YBASE_ELIGIBLE_REGS:
-
- case J_REG:
- return class;
-
- case YBASE_ELIGIBLE_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return ACCUM_Y_P_OR_YBASE_REGS;
- else
- return NON_HIGH_YBASE_ELIGIBLE_REGS;
-
- case J_OR_DAU_16_BIT_REGS:
- if (GET_MODE_SIZE(mode) == 1)
- return J_REG;
- else
- return class;
-
- case BMU_REGS:
- case NOHIGH_NON_ADDR_REGS:
- return class;
-
- case NON_ADDR_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return NOHIGH_NON_ADDR_REGS;
-
- case NOHIGH_NON_YBASE_REGS:
- return class;
-
- case NON_YBASE_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return NOHIGH_NON_YBASE_REGS;
-
- case YBASE_VIRT_REGS:
- case ACCUM_LOW_OR_YBASE_REGS:
- return class;
-
- case ACCUM_OR_YBASE_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return ACCUM_LOW_OR_YBASE_REGS;
-
- case X_OR_YBASE_REGS:
- return class;
-
- case Y_OR_YBASE_REGS:
- case ACCUM_LOW_YL_PL_OR_YBASE_REGS:
- case P_OR_YBASE_REGS:
- return class;
-
- case ACCUM_Y_P_OR_YBASE_REGS:
- return ACCUM_LOW_YL_PL_OR_YBASE_REGS;
-
- case Y_ADDR_OR_YBASE_REGS:
- case YBASE_OR_NOHIGH_YBASE_ELIGIBLE_REGS:
- return class;
-
- case YBASE_OR_YBASE_ELIGIBLE_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return YBASE_OR_NOHIGH_YBASE_ELIGIBLE_REGS;
-
- case NO_HIGH_ALL_REGS:
- return class;
-
- case ALL_REGS:
- if (GET_MODE_SIZE(mode) > 1)
- return class;
- else
- return NO_HIGH_ALL_REGS;
-
- default:
- return class;
- }
-}
-
-int
-dsp16xx_register_move_cost (from, to)
-enum reg_class from, to;
-{
-#if 0
- if (from == NO_REGS || to == NO_REGS || (from == to))
- return 2;
-#endif
-
- if (from == A0H_REG || from == A0L_REG || from == A0_REG ||
- from == A1H_REG || from == ACCUM_HIGH_REGS || from == A1L_REG ||
- from == ACCUM_LOW_REGS || from == A1_REG || from == ACCUM_REGS)
- {
- if (to == Y_REG || to == P_REG)
- return 4;
- else
- return 2;
- }
-
- if (to == A0H_REG || to == A0L_REG || to == A0_REG ||
- to == A1H_REG || to == ACCUM_HIGH_REGS || to == A1L_REG ||
- to == ACCUM_LOW_REGS || to == A1_REG || to == ACCUM_REGS)
- {
- return 2;
- }
-
-#if 0
- if (from == YBASE_VIRT_REGS)
- {
- if (to == X_REG || to == YH_REG || to == YL_REG ||
- to == Y_REG || to == PL_REG || to == PH_REG ||
- to == P_REG || to == Y_ADDR_REGS || to == YBASE_ELIGIBLE_REGS ||
- to == Y_OR_P_REGS)
- {
- return 2;
- }
- else
- return 4;
- }
-
- if (to == YBASE_VIRT_REGS)
- {
- if (from == X_REG || from == YH_REG || from == YL_REG ||
- from == Y_REG || from == PL_REG || from == PH_REG ||
- from == P_REG || from == Y_ADDR_REGS || from == YBASE_ELIGIBLE_REGS ||
- from == Y_OR_P_REGS)
- {
- return 2;
- }
- else
- return 4;
- }
-#endif
- return 4;
-}
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
- Also, we must ensure that a PLUS is reloaded either
- into an accumulator or an address register. */
-
-enum reg_class
-preferred_reload_class (x, class)
- rtx x;
- enum reg_class class;
-{
- /* The ybase registers cannot have constants copied directly
- to them. */
-
- if (CONSTANT_P (x))
- {
- if (class == ALL_REGS)
- return NON_YBASE_REGS;
- }
-
- if (class == ALL_REGS && REG_P (x) && !TARGET_RESERVE_YBASE
- && IS_YBASE_REGISTER_WINDOW (REGNO(x)))
- return YBASE_ELIGIBLE_REGS;
-
- if (GET_CODE (x) == PLUS)
- {
- if (GET_MODE (x) == QImode
- && REG_P (XEXP (x,0))
- && (XEXP (x,0) == frame_pointer_rtx
- || XEXP (x,0) == stack_pointer_rtx)
- && (GET_CODE (XEXP (x,1)) == CONST_INT))
- {
- if (class == ACCUM_HIGH_REGS)
- return class;
-
- if (reg_class_subset_p (ACCUM_HIGH_REGS, class))
- return ACCUM_HIGH_REGS;
-
- /* We will use accumulator 'a1l' for reloading a
- PLUS. We can only use one accumulator because
- 'reload_inqi' only allows one alternative to be
- used. */
-
- else if (class == ACCUM_LOW_REGS)
- return A1L_REG;
- else if (class == A0L_REG)
- return NO_REGS;
- else
- return class;
- }
-
- if (class == NON_YBASE_REGS || class == YBASE_ELIGIBLE_REGS)
- return Y_ADDR_REGS;
- else
- return class;
- }
- else if (GET_CODE (x) == MEM)
- {
- if (class == ALL_REGS)
- {
-#if 0
- if (GET_MODE(x) == HImode)
- return NO_ACCUM_NON_YBASE_REGS;
- else
-#endif
- return NON_YBASE_REGS;
- }
- else
- return class;
- }
- else
- return class;
-}
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
- NO_REGS is returned. */
-
-enum reg_class
-secondary_reload_class (class, mode, in)
- enum reg_class class;
- enum machine_mode mode;
- rtx in;
-{
- int regno = -1;
-
- if (GET_CODE (in) == REG || GET_CODE (in) == SUBREG)
- regno = true_regnum (in);
-
- if (class == ACCUM_HIGH_REGS
- || class == ACCUM_LOW_REGS
- || class == A1L_REG
- || class == A0L_REG
- || class == A1H_REG
- || class == A0H_REG)
- {
- if (GET_CODE (in) == PLUS && mode == QImode)
- {
- rtx addr0 = XEXP (in, 0);
- rtx addr1 = XEXP (in, 1);
-
- /* If we are reloading a plus (reg:QI) (reg:QI)
- we need an additional register. */
- if (REG_P (addr0) && REG_P (addr1))
- return NO_REGS;
- }
- }
-
- /* We can place anything into ACCUM_REGS and can put ACCUM_REGS
- into anything. */
-
- if ((class == ACCUM_REGS || class == ACCUM_HIGH_REGS ||
- class == ACCUM_LOW_REGS || class == A0H_REG || class == A0L_REG ||
- class == A1H_REG || class == A1_REG) ||
- (regno >= REG_A0 && regno < REG_A1L + 1))
- return NO_REGS;
-
- /* We can copy the ybase registers into:
- r0-r3, a0-a1, y, p, & x or the union of
- any of these. */
-
- if (!TARGET_RESERVE_YBASE && IS_YBASE_REGISTER_WINDOW(regno))
- {
- switch ((int) class)
- {
- case (int) X_REG:
- case (int) X_OR_ACCUM_LOW_REGS:
- case (int) X_OR_ACCUM_REGS:
- case (int) YH_REG:
- case (int) YH_OR_ACCUM_HIGH_REGS:
- case (int) X_OR_YH_REGS:
- case (int) YL_REG:
- case (int) YL_OR_ACCUM_LOW_REGS:
- case (int) X_OR_Y_REGS:
- case (int) X_OR_YL_REGS:
- case (int) Y_REG:
- case (int) ACCUM_OR_Y_REGS:
- case (int) PH_REG:
- case (int) X_OR_PH_REGS:
- case (int) PL_REG:
- case (int) PL_OR_ACCUM_LOW_REGS:
- case (int) X_OR_PL_REGS:
- case (int) YL_OR_PL_OR_ACCUM_LOW_REGS:
- case (int) P_REG:
- case (int) ACCUM_OR_P_REGS:
- case (int) YL_OR_P_REGS:
- case (int) ACCUM_LOW_OR_YL_OR_P_REGS:
- case (int) Y_OR_P_REGS:
- case (int) ACCUM_Y_OR_P_REGS:
- case (int) Y_ADDR_REGS:
- case (int) ACCUM_LOW_OR_Y_ADDR_REGS:
- case (int) ACCUM_OR_Y_ADDR_REGS:
- case (int) X_OR_Y_ADDR_REGS:
- case (int) Y_OR_Y_ADDR_REGS:
- case (int) P_OR_Y_ADDR_REGS:
- case (int) YBASE_ELIGIBLE_REGS:
- return NO_REGS;
-
- default:
- return ACCUM_HIGH_REGS;
- }
- }
-
- /* We can copy r0-r3, a0-a1, y, & p
- directly to the ybase registers. In addition
- we can use any of the ybase virtual registers
- as the secondary reload registers when copying
- between any of these registers. */
-
- if (!TARGET_RESERVE_YBASE && regno != -1)
- {
- switch (regno)
- {
- case REG_A0:
- case REG_A0L:
- case REG_A1:
- case REG_A1L:
- case REG_X:
- case REG_Y:
- case REG_YL:
- case REG_PROD:
- case REG_PRODL:
- case REG_R0:
- case REG_R1:
- case REG_R2:
- case REG_R3:
- if (class == YBASE_VIRT_REGS)
- return NO_REGS;
- else
- {
- switch ((int) class)
- {
- case (int) X_REG:
- case (int) X_OR_ACCUM_LOW_REGS:
- case (int) X_OR_ACCUM_REGS:
- case (int) YH_REG:
- case (int) YH_OR_ACCUM_HIGH_REGS:
- case (int) X_OR_YH_REGS:
- case (int) YL_REG:
- case (int) YL_OR_ACCUM_LOW_REGS:
- case (int) X_OR_Y_REGS:
- case (int) X_OR_YL_REGS:
- case (int) Y_REG:
- case (int) ACCUM_OR_Y_REGS:
- case (int) PH_REG:
- case (int) X_OR_PH_REGS:
- case (int) PL_REG:
- case (int) PL_OR_ACCUM_LOW_REGS:
- case (int) X_OR_PL_REGS:
- case (int) YL_OR_PL_OR_ACCUM_LOW_REGS:
- case (int) P_REG:
- case (int) ACCUM_OR_P_REGS:
- case (int) YL_OR_P_REGS:
- case (int) ACCUM_LOW_OR_YL_OR_P_REGS:
- case (int) Y_OR_P_REGS:
- case (int) ACCUM_Y_OR_P_REGS:
- case (int) Y_ADDR_REGS:
- case (int) ACCUM_LOW_OR_Y_ADDR_REGS:
- case (int) ACCUM_OR_Y_ADDR_REGS:
- case (int) X_OR_Y_ADDR_REGS:
- case (int) Y_OR_Y_ADDR_REGS:
- case (int) P_OR_Y_ADDR_REGS:
- case (int) YBASE_ELIGIBLE_REGS:
- return YBASE_VIRT_REGS;
-
- default:
- break;
- }
- }
- }
- }
-
- /* Memory or constants can be moved from or to any register
- except the ybase virtual registers */
- if (regno == -1 && GET_CODE(in) != PLUS)
- {
- if (class == YBASE_VIRT_REGS)
- return NON_YBASE_REGS;
- else
- return NO_REGS;
- }
-
- if (GET_CODE (in) == PLUS && mode == QImode)
- {
- rtx addr0 = XEXP (in, 0);
- rtx addr1 = XEXP (in, 1);
-
- /* If we are reloading a plus (reg:QI) (reg:QI)
- we need a low accumulator, not a high one. */
- if (REG_P (addr0) && REG_P (addr1))
- return ACCUM_LOW_REGS;
- }
-
-#if 0
- if (REG_P(in))
- return ACCUM_REGS;
-#endif
-
- /* Otherwise, we need a high accumulator(s). */
- return ACCUM_HIGH_REGS;
-}
-
-int
-symbolic_address_operand (op, mode)
-rtx op;
-enum machine_mode mode;
-{
- return (symbolic_address_p (op));
-
-}
-
-int symbolic_address_p (op)
-rtx op;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- return 1;
-
- case CONST:
- op = XEXP (op, 0);
- return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (op, 0)) == LABEL_REF)
- && GET_CODE (XEXP (op, 1)) == CONST_INT
- && INTVAL (XEXP (op,1)) < 0x20);
-
- default:
- return 0;
- }
-}
-
-/* For a Y address space operand we allow only *rn, *rn++, *rn--.
- This routine only recognizes *rn, the '<>' constraints recognize
- *rn++, *rn-- */
-
-int
-Y_address_operand (op, mode)
-rtx op;
-enum machine_mode mode;
-{
- return (memory_address_p (mode, op) && !symbolic_address_p (op));
-}
-
-int
-sp_operand (op, mode)
-rtx op;
-enum machine_mode mode;
-{
- return (GET_CODE (op) == PLUS
- && (XEXP (op, 0) == stack_pointer_rtx
- || XEXP (op, 0) == frame_pointer_rtx)
- && GET_CODE (XEXP (op,1)) == CONST_INT);
-}
-
-int
-sp_operand2 (op, mode)
-rtx op;
-enum machine_mode mode;
-{
- if ((GET_CODE (op) == PLUS
- && (XEXP (op, 0) == stack_pointer_rtx
- || XEXP (op, 0) == frame_pointer_rtx)
- && (REG_P (XEXP (op,1))
- && IS_ADDRESS_REGISTER (REGNO (XEXP(op, 1))))))
- return 1;
- else if ((GET_CODE (op) == PLUS
- && (XEXP (op, 1) == stack_pointer_rtx
- || XEXP (op, 1) == frame_pointer_rtx)
- && (REG_P (XEXP (op,0))
- && IS_ADDRESS_REGISTER (REGNO (XEXP(op, 1))))))
- return 1;
- else
- return 0;
-}
-
-int
-nonmemory_arith_operand (op, mode)
-rtx op;
-enum machine_mode mode;
-{
- return (immediate_operand (op, mode) || arith_reg_operand (op, mode));
-}
-
-int
-arith_reg_operand (op, mode)
-rtx op;
-enum machine_mode mode;
-{
- return (register_operand (op, mode)
- && (GET_CODE (op) != REG
- || REGNO (op) >= FIRST_PSEUDO_REGISTER
- || (!(IS_YBASE_REGISTER_WINDOW (REGNO (op)))
- && REGNO (op) != FRAME_POINTER_REGNUM)));
-}
-
-int
-call_address_operand (op, mode)
-rtx op;
-enum machine_mode mode;
-{
- if (symbolic_address_p (op) || REG_P(op))
- {
- return 1;
- }
-
- return 0;
-}
-
-int
-dsp16xx_comparison_operator (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return ((mode == VOIDmode || GET_MODE (op) == mode)
- && GET_RTX_CLASS (GET_CODE (op)) == '<'
- && (GET_CODE(op) != GE && GET_CODE (op) != LT &&
- GET_CODE (op) != GEU && GET_CODE (op) != LTU));
-}
-
-void
-notice_update_cc(exp)
-rtx exp;
-{
- if (GET_CODE (exp) == SET)
- {
- /* Jumps do not alter the cc's. */
-
- if (SET_DEST (exp) == pc_rtx)
- return;
-
- /* Moving register or memory into a register:
- it doesn't alter the cc's, but it might invalidate
- the RTX's which we remember the cc's came from.
- (Note that moving a constant 0 or 1 MAY set the cc's). */
- if (REG_P (SET_DEST (exp))
- && (REG_P (SET_SRC (exp)) || GET_CODE (SET_SRC (exp)) == MEM))
- {
- if (cc_status.value1
- && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value1))
- cc_status.value1 = 0;
- if (cc_status.value2
- && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2))
- cc_status.value2 = 0;
- return;
- }
- /* Moving register into memory doesn't alter the cc's.
- It may invalidate the RTX's which we remember the cc's came from. */
- if (GET_CODE (SET_DEST (exp)) == MEM && REG_P (SET_SRC (exp)))
- {
- if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM)
- cc_status.value1 = 0;
- if (cc_status.value2 && GET_CODE (cc_status.value2) == MEM)
- cc_status.value2 = 0;
- return;
- }
- /* Function calls clobber the cc's. */
- else if (GET_CODE (SET_SRC (exp)) == CALL)
- {
- CC_STATUS_INIT;
- return;
- }
- /* Tests and compares set the cc's in predictable ways. */
- else if (SET_DEST (exp) == cc0_rtx)
- {
- CC_STATUS_INIT;
- cc_status.value1 = SET_SRC (exp);
- return;
- }
- /* Certain instructions effect the condition codes. */
- else if (GET_MODE_CLASS (GET_MODE (SET_SRC (exp))) == MODE_INT)
- switch( GET_CODE (SET_SRC (exp)) )
- {
- case PLUS:
- case MINUS:
- if (REG_P (SET_DEST (exp)))
- {
- /* Address registers don't set the condition codes */
- if (IS_ADDRESS_REGISTER (REGNO (SET_DEST (exp))))
- {
- CC_STATUS_INIT;
- break;
- }
- }
- case ASHIFTRT:
- case LSHIFTRT:
- case ASHIFT:
- case AND:
- case IOR:
- case XOR:
- case MULT:
- case NEG:
- case NOT:
- cc_status.value1 = SET_SRC (exp);
- cc_status.value2 = SET_DEST (exp);
- break;
-
- default:
- CC_STATUS_INIT;
- }
- else
- {
- CC_STATUS_INIT;
- }
- }
- else if (GET_CODE (exp) == PARALLEL
- && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
- {
- if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx)
- return;
-
- if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx)
- {
- CC_STATUS_INIT;
- cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0));
- return;
- }
-
- CC_STATUS_INIT;
- }
- else
- {
- CC_STATUS_INIT;
- }
-}
-
-int
-dsp16xx_makes_calls ()
-{
- rtx insn;
-
- for (insn = get_insns (); insn; insn = next_insn (insn))
- if (GET_CODE (insn) == CALL_INSN)
- return (1);
-
- return 0;
-}
-
-long compute_frame_size (size)
-int size;
-{
- long total_size;
- long var_size;
- long args_size;
- long extra_size;
- long reg_size;
-
- reg_size = 0;
- extra_size = 0;
- var_size = size;
- args_size = current_function_outgoing_args_size;
- reg_size = reg_save_size ();
-
- total_size = var_size + args_size + extra_size + reg_size;
-
-
- /* Save other computed information. */
- current_frame_info.total_size = total_size;
- current_frame_info.var_size = var_size;
- current_frame_info.args_size = args_size;
- current_frame_info.extra_size = extra_size;
- current_frame_info.reg_size = reg_size;
- current_frame_info.initialized = reload_completed;
- current_frame_info.reg_size = reg_size / UNITS_PER_WORD;
- current_frame_info.function_makes_calls = dsp16xx_makes_calls ();
-
- if (reg_size)
- {
- unsigned long offset = args_size + var_size + reg_size;
- current_frame_info.sp_save_offset = offset;
- current_frame_info.fp_save_offset = offset - total_size;
- }
-
- return total_size;
-}
-
-int
-dsp16xx_call_saved_register (regno)
-int regno;
-{
- return (regs_ever_live[regno] && !call_used_regs[regno] &&
- !IS_YBASE_REGISTER_WINDOW(regno));
-
-}
-
-int
-ybase_regs_ever_used ()
-{
- int regno;
- int live = 0;
-
- for (regno = REG_YBASE0; regno <= REG_YBASE31; regno++)
- if (regs_ever_live[regno])
- {
- live = 1;
- break;
- }
-
- return live;
-}
-
-void
-function_prologue (file, size)
-FILE *file;
-int size;
-{
- int regno;
- long total_size;
- fp = reg_names[FRAME_POINTER_REGNUM];
- sp = reg_names[STACK_POINTER_REGNUM];
- rr = reg_names[RETURN_ADDRESS_REGNUM]; /* return address register */
- a1h = reg_names[REG_A1];
-
- total_size = compute_frame_size (size);
-
- fprintf( file, "\t/* FUNCTION PROLOGUE: */\n" );
- fprintf (file, "\t/* total=%d, vars= %d, regs= %d, args=%d, extra= %d */\n",
- current_frame_info.total_size,
- current_frame_info.var_size,
- current_frame_info.reg_size,
- current_function_outgoing_args_size,
- current_frame_info.extra_size);
-
- fprintf (file, "\t/* fp save offset= %d, sp save_offset= %d */\n\n",
- current_frame_info.fp_save_offset,
- current_frame_info.sp_save_offset);
- /* Set up the 'ybase' register window. */
-
- if (ybase_regs_ever_used())
- {
- fprintf (file, "\t%s=%s\n", a1h, reg_names[REG_YBASE]);
- if (TARGET_YBASE_HIGH)
- fprintf (file, "\t%s=%sh-32\n", reg_names[REG_A1], a1h);
- else
- fprintf (file, "\t%s=%sh+32\n", reg_names[REG_A1], a1h);
- fprintf (file, "\t%s=%s\n", reg_names[REG_YBASE], a1h);
- }
-
-#if 0
- if (current_frame_info.function_makes_calls)
- fprintf( file, "\t*%s++=%s\n", sp, rr ); /* Push return address */
-#endif
-
-
- if (current_frame_info.var_size)
- {
- if (current_frame_info.var_size == 1)
- fprintf (file, "\t*%s++\n", sp);
- else
- {
- if(SMALL_INTVAL(current_frame_info.var_size) && ((current_frame_info.var_size & 0x8000) == 0))
- fprintf (file, "\t%s=%d\n\t*%s++%s\n", reg_names[REG_J], current_frame_info.var_size, sp, reg_names[REG_J]);
- else
- fatal ("Stack size > 32k");
- }
- }
-
- /* Save any registers this function uses, unless they are
- * used in a call, in which case we don't need to
- */
-
- for( regno = 0; regno < FIRST_PSEUDO_REGISTER; ++ regno )
- if (dsp16xx_call_saved_register (regno))
- {
-#if OLD_REGISTER_SAVE
- fprintf( file, "\t*%s++=%s\n", sp, reg_names[regno] );
-#else
- fprintf( file, "\tpush(*%s)=%s\n", sp, reg_names[regno] );
-#endif
- }
-
- if (current_frame_info.args_size)
- {
- if (current_frame_info.args_size == 1)
- fprintf (file, "\t*%s++\n", sp);
- else
- {
- if(SMALL_INTVAL(current_frame_info.args_size) && ((current_frame_info.args_size & 0x8000) == 0))
- fprintf (file, "\t%s=%d\n\t*%s++%s\n", reg_names[REG_J], current_frame_info.args_size, sp, reg_names[REG_J]);
- else
- fatal ("Stack size > 32k");
- }
- }
-
- if (frame_pointer_needed)
- {
- fprintf( file, "\t%s=%s\n", a1h, sp );
- fprintf( file, "\t%s=%s\n", fp, a1h ); /* Establish new base frame */
- fprintf( file, "\t%s=%d\n", reg_names[REG_J], -total_size);
- fprintf( file, "\t*%s++%s\n", fp, reg_names[REG_J]);
- }
-
- fprintf( file, "\t/* END FUNCTION PROLOGUE: */\n\n" );
-}
-
-void
-init_emulation_routines ()
-{
- dsp16xx_addhf3_libcall = (rtx) 0;
- dsp16xx_subhf3_libcall = (rtx) 0;
- dsp16xx_mulhf3_libcall = (rtx) 0;
- dsp16xx_divhf3_libcall = (rtx) 0;
- dsp16xx_cmphf3_libcall = (rtx) 0;
- dsp16xx_fixhfhi2_libcall = (rtx) 0;
- dsp16xx_floathihf2_libcall = (rtx) 0;
- dsp16xx_neghf2_libcall = (rtx) 0;
-
- dsp16xx_mulhi3_libcall = (rtx) 0;
- dsp16xx_udivqi3_libcall = (rtx) 0;
- dsp16xx_udivhi3_libcall = (rtx) 0;
- dsp16xx_divqi3_libcall = (rtx) 0;
- dsp16xx_divhi3_libcall = (rtx) 0;
- dsp16xx_modqi3_libcall = (rtx) 0;
- dsp16xx_modhi3_libcall = (rtx) 0;
- dsp16xx_umodqi3_libcall = (rtx) 0;
- dsp16xx_umodhi3_libcall = (rtx) 0;
- dsp16xx_ashrhi3_libcall = (rtx) 0;
- dsp16xx_ashlhi3_libcall = (rtx) 0;
- dsp16xx_ucmphi2_libcall = (rtx) 0;
- dsp16xx_lshrhi3_libcall = (rtx) 0;
-
-}
-void
-function_epilogue (file, size)
-FILE *file;
-int size;
-{
- int regno;
- int initial_stack_dec = 0;
-
- fp = reg_names[FRAME_POINTER_REGNUM];
- sp = reg_names[STACK_POINTER_REGNUM];
- rr = reg_names[RETURN_ADDRESS_REGNUM]; /* return address register */
- a1h = reg_names[REG_A1];
-
- fprintf( file, "\n\t/* FUNCTION EPILOGUE: */\n" );
-
- if (current_frame_info.args_size)
- {
- if (current_frame_info.args_size == 1)
- fprintf (file, "\t*%s--\n", sp);
- else
- {
- fprintf (file, "\t%s=%d\n\t*%s++%s\n",
- reg_names[REG_J], -current_frame_info.args_size, sp, reg_names[REG_J]);
- }
- }
-
- if (ybase_regs_ever_used())
- {
- fprintf (file, "\t%s=%s\n", a1h, reg_names[REG_YBASE]);
- if (TARGET_YBASE_HIGH)
- fprintf (file, "\t%s=%sh+32\n", reg_names[REG_A1], a1h);
- else
- fprintf (file, "\t%s=%sh-32\n", reg_names[REG_A1], a1h);
- fprintf (file, "\t%s=%s\n", reg_names[REG_YBASE], a1h);
- }
-
- for (regno = FIRST_PSEUDO_REGISTER - 1; regno >= 0; --regno)
- if (dsp16xx_call_saved_register(regno))
- {
-#if OLD_REGISTER_SAVE
- if (!initial_stack_dec)
- {
- initial_stack_dec = 1;
- fprintf (file, "\t*%s--\n", sp);
- }
-#endif
-
-#if OLD_REGISTER_SAVE
- fprintf( file, "\t%s=*%s--\n", reg_names[regno], sp );
-#else
- fprintf( file, "\t%s=pop(*%s)\n", reg_names[regno], sp );
-#endif
- }
-
- /* If we restored any registers we have to account for the
- initial pre-decrement. But only if we had any local variables
- or spills. */
-#if OLD_REGISTER_SAVE
- if (initial_stack_dec)
- fprintf (file, "\t*%s++\n", sp);
-#endif
-
- if (current_frame_info.var_size)
- {
- if (current_frame_info.var_size == 1)
- fprintf (file, "\t*%s--\n", sp);
- else
- {
- fprintf (file, "\t%s=%d\n\t*%s++%s\n",
- reg_names[REG_J], -current_frame_info.var_size, sp, reg_names[REG_J]);
- }
- }
-
- fprintf (file, "\treturn\n");
- /* Reset the frame info for the next function */
- current_frame_info = zero_frame_info;
- init_emulation_routines ();
-}
-
-/* Emit insns to move operands[1] into operands[0].
-
- Return 1 if we have written out everything that needs to be done to
- do the move. Otherwise, return 0 and the caller will emit the move
- normally. */
-
-int
-emit_move_sequence (operands, mode)
- rtx *operands;
- enum machine_mode mode;
-{
- register rtx operand0 = operands[0];
- register rtx operand1 = operands[1];
-
- /* We can only store registers to memory. */
-
- if (GET_CODE (operand0) == MEM && GET_CODE (operand1) != REG)
- operands[1] = force_reg (mode, operand1);
-
- return 0;
-}
-
-void
-double_reg_from_memory (operands)
-rtx operands[];
-{
- rtx xoperands[4];
-
- if (GET_CODE(XEXP(operands[1],0)) == POST_INC)
- {
- output_asm_insn ("%u0=%1", operands);
- output_asm_insn ("%w0=%1", operands);
- }
- else if (GET_CODE(XEXP(operands[1],0)) == POST_DEC)
- {
- xoperands[1] = XEXP (XEXP (operands[1], 0), 0);
- xoperands[0] = operands[0];
-
- /* We can't use j anymore since the compiler can allocate it. */
-/* output_asm_insn ("j=-3\n\t%u0=*%1++\n\t%w0=*%1++j", xoperands); */
- output_asm_insn ("%u0=*%1++\n\t%w0=*%1--\n\t*%1--\n\t*%1--", xoperands);
- }
- else if (GET_CODE(XEXP(operands[1],0)) == PLUS)
- {
- rtx addr;
- rtx base;
- int offset;
-
- output_asm_insn ("%u0=%1", operands);
-
-
- /* In order to print out the least significant word we must
- use 'offset + 1'. */
- addr = XEXP (operands[1], 0);
- if (GET_CODE (XEXP(addr,0)) == CONST_INT)
- offset = INTVAL(XEXP(addr,0)) + 1;
- else if (GET_CODE (XEXP(addr,1)) == CONST_INT)
- offset = INTVAL(XEXP(addr,1)) + 1;
-
- fprintf (asm_out_file, "\t%s=*(%d)\n", reg_names[REGNO(operands[0]) + 1], offset + 31);
- }
- else
- {
- xoperands[1] = XEXP(operands[1],0);
- xoperands[0] = operands[0];
-
- output_asm_insn ("%u0=*%1++\n\t%w0=*%1--", xoperands);
- }
-}
-
-
-void
-double_reg_to_memory (operands)
-rtx operands[];
-{
- rtx xoperands[4];
-
- if (GET_CODE(XEXP(operands[0],0)) == POST_INC)
- {
- output_asm_insn ("%0=%u1", operands);
- output_asm_insn ("%0=%w1", operands);
- }
- else if (GET_CODE(XEXP(operands[0],0)) == POST_DEC)
- {
- xoperands[0] = XEXP (XEXP (operands[0], 0), 0);
- xoperands[1] = operands[1];
-
- /* We can't use j anymore since the compiler can allocate it. */
-
-/* output_asm_insn ("j=-3\n\t*%0++=%u1\n\t*%0++j=%w1", xoperands); */
- output_asm_insn ("*%0++=%u1\n\t*%0--=%w1\n\t*%0--\n\t*%0--", xoperands);
-
- }
- else if (GET_CODE(XEXP(operands[0],0)) == PLUS)
- {
- rtx addr;
- int offset;
-
- output_asm_insn ("%0=%u1", operands);
-
- /* In order to print out the least significant word we must
- use 'offset + 1'. */
- addr = XEXP (operands[0], 0);
- if (GET_CODE (XEXP(addr,0)) == CONST_INT)
- offset = INTVAL(XEXP(addr,0)) + 1;
- else if (GET_CODE (XEXP(addr,1)) == CONST_INT)
- offset = INTVAL(XEXP(addr,1)) + 1;
- else
- fatal ("Invalid addressing mode");
-
- fprintf (asm_out_file, "\t*(%d)=%s\n", offset + 31, reg_names[REGNO(operands[1]) + 1]);
- }
- else
- {
- xoperands[0] = XEXP(operands[0],0);
- xoperands[1] = operands[1];
-
- output_asm_insn ("*%0++=%u1\n\t*%0--=%w1", xoperands);
- }
-}
-
-void
-override_options ()
-{
- if (chip_name == (char *) 0)
- chip_name = DEFAULT_CHIP_NAME;
-
- if (text_seg_name == (char *) 0)
- text_seg_name = DEFAULT_TEXT_SEG_NAME;
-
- if (data_seg_name == (char *) 0)
- data_seg_name = DEFAULT_DATA_SEG_NAME;
-
- if (bss_seg_name == (char *) 0)
- bss_seg_name = DEFAULT_BSS_SEG_NAME;
-
- if (const_seg_name == (char *) 0)
- const_seg_name = DEFAULT_CONST_SEG_NAME;
-
- save_chip_name = (char *) xmalloc (strlen(chip_name) + 1);
- strcpy (save_chip_name, chip_name);
-
- rsect_text = (char *) xmalloc (strlen(".rsect ") +
- strlen(text_seg_name) + 3);
- rsect_data = (char *) xmalloc (strlen(".rsect ") +
- strlen(data_seg_name) + 3);
- rsect_bss = (char *) xmalloc (strlen(".rsect ") +
- strlen(bss_seg_name) + 3);
- rsect_const = (char *) xmalloc (strlen(".rsect ") +
- strlen(const_seg_name) + 3);
-
- sprintf (rsect_text, ".rsect \"%s\"", text_seg_name);
- sprintf (rsect_data, ".rsect \"%s\"", data_seg_name);
- sprintf (rsect_bss, ".rsect \"%s\"", bss_seg_name);
- sprintf (rsect_const, ".rsect \"%s\"", const_seg_name);
-
- if (optimize)
- {
- if (TARGET_OPTIMIZE_SPEED)
- {
- flag_unroll_loops = 1;
- flag_inline_functions = 1;
- }
- }
-}
-
-enum rtx_code save_next_cc_user_code;
-
-enum rtx_code
-next_cc_user_code (insn)
-rtx insn;
-{
- if ( !(insn = next_cc0_user (insn)))
- abort ();
- else if (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) == SET
- && GET_CODE (SET_SRC (PATTERN (insn))) == IF_THEN_ELSE)
- return GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 0));
- else if (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SET
- && comparison_operator (SET_SRC (PATTERN (insn)), VOIDmode))
- return GET_CODE (SET_SRC (PATTERN (insn)));
- else
- abort ();
-}
-
-void
-print_operand(file, op, letter)
-FILE *file;
-rtx op;
-int letter;
-{
- enum rtx_code code;
-
- code = GET_CODE(op);
-
- switch (letter)
- {
- case 'I':
- code = reverse_condition (code);
- /* Fallthrough */
-
- case 'C':
- if (code == EQ)
- {
- fputs ("eq", file);
- return;
- }
- else if (code == NE)
- {
- fputs ("ne", file);
- return;
- }
- else if (code == GT || code == GTU)
- {
- fputs ("gt", file);
- return;
- }
- else if (code == LT || code == LTU)
- {
- fputs ("mi", file);
- return;
- }
- else if (code == GE || code == GEU)
- {
- fputs ("pl", file);
- return;
- }
- else if (code == LE || code == LEU)
- {
- fputs ("le", file);
- return;
- }
- else
- abort ();
- break;
-
- default:
- break;
- }
-
- if( code == REG )
- {
- /* Print the low half of a 32-bit register pair */
- if (letter == 'w')
- fprintf( file, "%s", reg_names[REGNO(op)+1] );
- else if (letter == 'u' || !letter)
- fprintf( file, "%s", reg_names[REGNO(op)]);
- else if (letter == 'b')
- fprintf ( file, "%sh", reg_names[REGNO(op)]);
- else if (letter == 'm')
- fprintf (file, "%s", himode_reg_name[REGNO(op)]);
- else
- fatal("Bad register extension code");
- }
- else if( code == MEM )
- output_address( XEXP(op,0) );
- else if( code == CONST_INT )
- {
- if( letter == 'H' )
- fprintf( file, "0x%x", (INTVAL(op) & 0xffff) );
- else if (letter == 'h')
- fprintf( file, "%d", INTVAL (op) );
- else if( letter == 'U' )
- fprintf( file, "0x%x", ((INTVAL(op) & 0xffff0000) >> 16) & 0xffff );
- else
- output_addr_const( file, op );
- }
- else if( code == CONST_DOUBLE && GET_MODE(op) != DImode )
- {
- union { double d; int i[2]; } u;
- union { float f; int i; } u1;
- u.i[0] = CONST_DOUBLE_LOW (op);
- u.i[1] = CONST_DOUBLE_HIGH (op);
- u1.f = u.d;
- fprintf( file, "0x%x", u1.i );
- }
- else output_addr_const( file, op);
-}
-
-
-void
-print_operand_address(file, addr)
-FILE *file;
-rtx addr;
-{
- rtx base;
- int offset;
-
- switch (GET_CODE (addr))
- {
- case REG:
- fprintf (file, "*%s", reg_names[REGNO (addr)]);
- break;
- case POST_DEC:
- fprintf (file, "*%s--", reg_names[REGNO (XEXP (addr, 0))]);
- break;
- case POST_INC:
- fprintf (file, "*%s++", reg_names[REGNO (XEXP (addr, 0))]);
- break;
- case PLUS:
- if (GET_CODE (XEXP(addr,0)) == CONST_INT)
- offset = INTVAL(XEXP(addr,0)), base = XEXP(addr,1);
- else if (GET_CODE (XEXP(addr,1)) == CONST_INT)
- offset = INTVAL(XEXP(addr,1)), base = XEXP(addr,0);
- if (GET_CODE (base) == REG && REGNO(base) == STACK_POINTER_REGNUM)
- {
- if (offset >= -31 && offset <= 0)
- offset = 31 + offset;
- else
- fatal ("Invalid offset in ybase addressing");
- }
- else
- fatal ("Invalid register in ybase addressing");
-
- fprintf (file, "*(%d)", offset);
- break;
-
- default:
- if( FITS_5_BITS( addr ) )
- fprintf( file, "*(0x%x)", (INTVAL(addr) & 0x20) );
- else
- output_addr_const(file, addr);
- }
-}
-
-void
-output_dsp16xx_float_const(operands)
-rtx *operands;
-{
- rtx dst = operands[0];
- rtx src = operands[1];
-
-#if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- REAL_VALUE_TYPE d;
- long value;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, src);
- REAL_VALUE_TO_TARGET_SINGLE (d, value);
-
- operands[1] = gen_rtx (CONST_INT, VOIDmode, value);
- output_asm_insn ("%u0=%U1\n\t%w0=%H1", operands);
-#else
- fatal ("inline float constants not supported on this host");
-#endif
-}
-
-int
-reg_save_size ()
-{
- int reg_save_size = 0;
- int regno;
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (dsp16xx_call_saved_register (regno))
- {
- reg_save_size += UNITS_PER_WORD;
- }
-
- return (reg_save_size);
-}
-
-int
-dsp16xx_starting_frame_offset()
-{
- int reg_save_size = 0;
- int regno;
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (dsp16xx_call_saved_register (regno))
- {
- reg_save_size += UNITS_PER_WORD;
- }
-
- return (reg_save_size);
-}
-
-int
-initial_frame_pointer_offset()
-{
- int frame_size;
- int regno;
- int offset = 0;
-
- offset = compute_frame_size (get_frame_size());
-
-#ifdef STACK_GROWS_DOWNWARD
- return (offset);
-#else
- return (-offset);
-#endif
-}
-
-/* Generate the minimum number of 1600 core shift instructions
- to shift by 'shift_amount'. */
-
-#if 0
-void
-emit_1600_core_shift (shift_op, operands, shift_amount, mode)
-enum rtx_code shift_op;
-rtx *operands;
-int shift_amount;
-enum machine_mode mode;
-{
- int quotient;
- int i;
- int first_shift_emitted = 0;
-
- while (shift_amount != 0)
- {
- if (shift_amount/16)
- {
- quotient = shift_amount/16;
- shift_amount = shift_amount - (quotient * 16);
- for (i = 0; i < quotient; i++)
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (shift_op, mode,
- first_shift_emitted ? operands[0] : operands[1],
- gen_rtx (CONST_INT, VOIDmode, 16))));
- first_shift_emitted = 1;
- }
- else if (shift_amount/8)
- {
- quotient = shift_amount/8;
- shift_amount = shift_amount - (quotient * 8);
- for (i = 0; i < quotient; i++)
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (shift_op, mode,
- first_shift_emitted ? operands[0] : operands[1],
- gen_rtx (CONST_INT, VOIDmode, 8))));
- first_shift_emitted = 1;
- }
- else if (shift_amount/4)
- {
- quotient = shift_amount/4;
- shift_amount = shift_amount - (quotient * 4);
- for (i = 0; i < quotient; i++)
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (shift_op, mode,
- first_shift_emitted ? operands[0] : operands[1],
- gen_rtx (CONST_INT, VOIDmode, 4))));
- first_shift_emitted = 1;
- }
- else if (shift_amount/1)
- {
- quotient = shift_amount/1;
- shift_amount = shift_amount - (quotient * 1);
- for (i = 0; i < quotient; i++)
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (shift_op, mode,
- first_shift_emitted ? operands[0] : operands[1],
- gen_rtx (CONST_INT, VOIDmode, 1))));
- first_shift_emitted = 1;
- }
- }
-}
-#else
-void
-emit_1600_core_shift (shift_op, operands, shift_amount)
-enum rtx_code shift_op;
-rtx *operands;
-int shift_amount;
-{
- int quotient;
- int i;
- int first_shift_emitted = 0;
- char **shift_asm_ptr;
- char **shift_asm_ptr_first;
-
- if (shift_op == ASHIFT)
- {
- shift_asm_ptr = ashift_left_asm;
- shift_asm_ptr_first = ashift_left_asm_first;
- }
- else if (shift_op == ASHIFTRT)
- {
- shift_asm_ptr = ashift_right_asm;
- shift_asm_ptr_first = ashift_right_asm_first;
- }
- else if (shift_op == LSHIFTRT)
- {
- shift_asm_ptr = lshift_right_asm;
- shift_asm_ptr_first = lshift_right_asm_first;
- }
- else
- fatal ("Invalid shift operator in emit_1600_core_shift");
-
- while (shift_amount != 0)
- {
- if (shift_amount/16)
- {
- quotient = shift_amount/16;
- shift_amount = shift_amount - (quotient * 16);
- for (i = 0; i < quotient; i++)
- output_asm_insn ((first_shift_emitted ? shift_asm_ptr[SHIFT_INDEX_16]
- : shift_asm_ptr_first[SHIFT_INDEX_16]), operands);
- first_shift_emitted = 1;
- }
- else if (shift_amount/8)
- {
- quotient = shift_amount/8;
- shift_amount = shift_amount - (quotient * 8);
- for (i = 0; i < quotient; i++)
- output_asm_insn ((first_shift_emitted ? shift_asm_ptr[SHIFT_INDEX_8]
- : shift_asm_ptr_first[SHIFT_INDEX_8]), operands);
- first_shift_emitted = 1;
- }
- else if (shift_amount/4)
- {
- quotient = shift_amount/4;
- shift_amount = shift_amount - (quotient * 4);
- for (i = 0; i < quotient; i++)
- output_asm_insn ((first_shift_emitted ? shift_asm_ptr[SHIFT_INDEX_4]
- : shift_asm_ptr_first[SHIFT_INDEX_4]), operands);
- first_shift_emitted = 1;
- }
- else if (shift_amount/1)
- {
- quotient = shift_amount/1;
- shift_amount = shift_amount - (quotient * 1);
- for (i = 0; i < quotient; i++)
- output_asm_insn ((first_shift_emitted ? shift_asm_ptr[SHIFT_INDEX_1]
- : shift_asm_ptr_first[SHIFT_INDEX_1]), operands);
- first_shift_emitted = 1;
- }
- }
-}
-#endif
-void
- asm_output_common(file, name, size, rounded)
-FILE *file;
-char *name;
-int size;
-int rounded;
-{
- bss_section ();
- ASM_GLOBALIZE_LABEL (file, name);
- assemble_name (file, name);
- fputs (":", file);
- if (rounded > 1)
- fprintf (file, "%d * int\n", rounded);
- else
- fprintf (file, "int\n");
-}
-
-void
-asm_output_local(file, name, size, rounded)
-FILE *file;
-char *name;
-int size;
-int rounded;
-{
- bss_section ();
- assemble_name (file, name);
- fputs (":", file);
- if (rounded > 1)
- fprintf (file, "%d * int\n", rounded);
- else
- fprintf (file, "int\n");
-}
-
-void
-asm_output_float (file, fp_const)
-FILE *file;
-double fp_const;
-{
-#if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- REAL_VALUE_TYPE d = fp_const;
- long value;
-
- REAL_VALUE_TO_TARGET_SINGLE (d, value);
- fputs ("\tint ", file);
-#ifdef WORDS_BIG_ENDIAN
- fprintf (file, "0x%-4.4x, 0x%-4.4x", (value >> 16) & 0xffff, (value & 0xffff));
-#else
- fprintf (file, "0x%-4.4x, 0x%-4.4x", (value & 0xffff), (value >> 16) & 0xffff);
-#endif
- fputs ("\n", file);
-#else
- fatal ("inline float constants not supported on this host");
-#endif
-}
-
-void
-asm_output_long (file, value)
-FILE *file;
-long value;
-{
- fputs ("\tint ", file);
-#ifdef WORDS_BIG_ENDIAN
- fprintf (file, "0x%-4.4x, 0x%-4.4x", (value >> 16) & 0xffff, (value & 0xffff));
-#else
- fprintf (file, "0x%-4.4x, 0x%-4.4x", (value & 0xffff), (value >> 16) & 0xffff);
-#endif
- fputs ("\n", file);
-}
-
-int
-dsp16xx_address_cost (addr)
-rtx addr;
-{
- switch (GET_CODE (addr))
- {
- default:
- break;
-
- case REG:
- return 1;
-
- case CONST:
- {
- rtx offset = const0_rtx;
- addr = eliminate_constant_term (addr, &offset);
-
- if (GET_CODE (addr) == LABEL_REF)
- return 2;
-
- if (GET_CODE (addr) != SYMBOL_REF)
- return 4;
-
- if (INTVAL (offset) == 0)
- return 2;
- }
- /* fall through */
-
- case POST_INC: case POST_DEC:
- return (GET_MODE (addr) == QImode ? 1 : 2);
-
- case SYMBOL_REF: case LABEL_REF:
- return 2;
-
- case PLUS:
- {
- register rtx plus0 = XEXP (addr, 0);
- register rtx plus1 = XEXP (addr, 1);
-
- if (GET_CODE (plus0) != REG && GET_CODE (plus1) == REG)
- {
- plus0 = XEXP (addr, 1);
- plus1 = XEXP (addr, 0);
- }
-
- if (GET_CODE (plus0) != REG)
- break;
-
- switch (GET_CODE (plus1))
- {
- default:
- break;
-
- case CONST_INT:
- return 4;
-
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- return dsp16xx_address_cost (plus1) + 1;
- }
- }
- }
-
- return 4;
-}
-
-
-/* Determine whether a function argument is passed in a register, and
- which register.
-
- The arguments are CUM, which summarizes all the previous
- arguments; MODE, the machine mode of the argument; TYPE,
- the data type of the argument as a tree node or 0 if that is not known
- (which happens for C support library functions); and NAMED,
- which is 1 for an ordinary argument and 0 for nameless arguments that
- correspond to `...' in the called function's prototype.
-
- The value of the expression should either be a `reg' RTX for the
- hard register in which to pass the argument, or zero to pass the
- argument on the stack.
-
- On the dsp1610 the first four words of args are normally in registers
- and the rest are pushed. If we a long or on float mode, the argument
- must begin on a even register boundary
-
- Note that FUNCTION_ARG and FUNCTION_INCOMING_ARG were different.
- For structures that are passed in memory, but could have been
- passed in registers, we first load the structure into the
- register, and then when the last argument is passed, we store
- the registers into the stack locations. This fixes some bugs
- where GCC did not expect to have register arguments, followed */
-
-
-struct rtx_def *
-dsp16xx_function_arg (args_so_far, mode, type, named)
- CUMULATIVE_ARGS args_so_far;
- enum machine_mode mode;
- tree type;
- int named;
-{
- if (TARGET_REGPARM)
- {
- if ((args_so_far & 1) != 0
- && (mode == HImode || GET_MODE_CLASS(mode) == MODE_FLOAT))
- args_so_far++;
-
- if (named && args_so_far < 4 && !MUST_PASS_IN_STACK (mode,type))
- return gen_rtx (REG, mode, args_so_far + FIRST_REG_FOR_FUNCTION_ARG);
- else
- return (struct rtx_def *) 0;
- }
- else
- return (struct rtx_def *) 0;
-}
-
-/* Advance the argument to the next argument position. */
-
-void
-dsp16xx_function_arg_advance (cum, mode, type, named)
- CUMULATIVE_ARGS *cum; /* current arg information */
- enum machine_mode mode; /* current arg mode */
- tree type; /* type of the argument or 0 if lib support */
- int named; /* whether or not the argument was named */
-{
- if (TARGET_REGPARM)
- {
- if ((*cum & 1) != 0
- && (mode == HImode || GET_MODE_CLASS(mode) == MODE_FLOAT))
- *cum += 1;
-
- if (mode != BLKmode)
- *cum += GET_MODE_SIZE (mode);
- else
- *cum += int_size_in_bytes (type);
- }
-}
-
-void
-dsp16xx_file_start ()
-{
- fprintf (asm_out_file, "#include <%s.h>\n", save_chip_name);
-#if 0
- if (TARGET_BMU)
- fprintf (asm_out_file, "#include <1610.h>\n");
-#endif
-}
-
-rtx
-gen_tst_reg (x)
- rtx x;
-{
- enum machine_mode mode;
-
- mode = GET_MODE (x);
-
- if (mode == QImode)
- {
- emit_insn (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (2,
- gen_rtx (SET, VOIDmode, cc0_rtx, x),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (SCRATCH, QImode, 0)))));
- }
- else if (mode == HImode)
- emit_insn (gen_rtx (SET, VOIDmode, cc0_rtx, x));
- else
- fatal ("Invalid mode for gen_tst_reg");
-
- return cc0_rtx;
-}
-
-rtx
-gen_compare_reg (code, x, y)
- enum rtx_code code;
- rtx x, y;
-{
- enum machine_mode mode;
-
- mode = GET_MODE (x);
- /* For floating point compare insns, a call is generated so don't
- do anything here. */
-
- if (GET_MODE_CLASS (mode) == MODE_FLOAT)
- return cc0_rtx;
-
- if (mode == QImode)
- {
- if (code == GTU || code == GEU ||
- code == LTU || code == LEU)
- {
- emit_insn (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (3,
- gen_rtx (SET, VOIDmode, cc0_rtx,
- gen_rtx (COMPARE, mode, x, y)),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (SCRATCH, QImode, 0)),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (SCRATCH, QImode, 0)))));
- }
- else
- {
- emit_insn (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (3,
- gen_rtx (SET, VOIDmode, cc0_rtx,
- gen_rtx (COMPARE, mode, x, y)),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (SCRATCH, QImode, 0)),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (SCRATCH, QImode, 0)))));
- }
- }
- else if (mode == HImode)
- {
- if (code == GTU || code == GEU ||
- code == LTU || code == LEU)
- {
-#if 1
- emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (5,
- gen_rtx (SET, VOIDmode, cc0_rtx, gen_rtx (COMPARE, VOIDmode, x, y)),
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (SCRATCH, QImode, 0)),
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (SCRATCH, QImode, 0)),
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (SCRATCH, QImode, 0)),
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (SCRATCH, QImode, 0)))));
-#else
- if (!dsp16xx_ucmphi2_libcall)
- dsp16xx_ucmphi2_libcall = gen_rtx (SYMBOL_REF, Pmode, UCMPHI2_LIBCALL);
- emit_library_call (dsp16xx_ucmphi2_libcall, 1, HImode, 2,
- x, HImode, y, HImode);
- emit_insn (gen_tsthi_1 (copy_to_reg(hard_libcall_value (HImode))));
-#endif
- }
- else
- emit_insn (gen_rtx (SET, VOIDmode, cc0_rtx,
- gen_rtx (COMPARE, VOIDmode, force_reg(HImode, x),
- force_reg(HImode,y))));
- }
- else
- fatal ("Invalid mode for integer comparison in gen_compare_reg");
-
- return cc0_rtx;
-}
-
-char *
-output_block_move (operands)
- rtx operands[];
-{
- int loop_count = INTVAL(operands[2]);
- rtx xoperands[4];
-
- fprintf (asm_out_file, "\tdo %d {\n", loop_count);
- xoperands[0] = operands[4];
- xoperands[1] = operands[1];
- output_asm_insn ("%0=*%1++", xoperands);
-
- xoperands[0] = operands[0];
- xoperands[1] = operands[4];
- output_asm_insn ("*%0++=%1", xoperands);
-
- fprintf (asm_out_file, "\t}\n");
- return "";
-}
diff --git a/gcc/config/dsp16xx/dsp16xx.h b/gcc/config/dsp16xx/dsp16xx.h
deleted file mode 100644
index 83a97f8979c..00000000000
--- a/gcc/config/dsp16xx/dsp16xx.h
+++ /dev/null
@@ -1,1980 +0,0 @@
-/* Definitions of target machine for GNU compiler. AT&T DSP1600.
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Michael Collison (collison@world.std.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 1, 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. */
-
-extern char *low_reg_names[];
-extern char *text_seg_name;
-extern char *rsect_text;
-extern char *data_seg_name;
-extern char *rsect_data;
-extern char *bss_seg_name;
-extern char *rsect_bss;
-extern char *const_seg_name;
-extern char *rsect_const;
-extern char *chip_name;
-extern char *save_chip_name;
-extern struct rtx_def *dsp16xx_compare_op0, *dsp16xx_compare_op1;
-extern struct rtx_def *(*dsp16xx_compare_gen)();
-extern struct rtx_def *gen_compare_reg();
-extern struct rtx_def *dsp16xx_addhf3_libcall;
-extern struct rtx_def *dsp16xx_subhf3_libcall;
-extern struct rtx_def *dsp16xx_mulhf3_libcall;
-extern struct rtx_def *dsp16xx_divhf3_libcall;
-extern struct rtx_def *dsp16xx_cmphf3_libcall;
-extern struct rtx_def *dsp16xx_fixhfhi2_libcall;
-extern struct rtx_def *dsp16xx_floathihf2_libcall;
-extern struct rtx_def *dsp16xx_neghf2_libcall;
-extern struct rtx_def *dsp16xx_umulhi3_libcall;
-extern struct rtx_def *dsp16xx_mulhi3_libcall;
-extern struct rtx_def *dsp16xx_udivqi3_libcall;
-extern struct rtx_def *dsp16xx_udivhi3_libcall;
-extern struct rtx_def *dsp16xx_divqi3_libcall;
-extern struct rtx_def *dsp16xx_divhi3_libcall;
-extern struct rtx_def *dsp16xx_modqi3_libcall;
-extern struct rtx_def *dsp16xx_modhi3_libcall;
-extern struct rtx_def *dsp16xx_umodqi3_libcall;
-extern struct rtx_def *dsp16xx_umodhi3_libcall;
-
-extern struct rtx_def *dsp16xx_ashrhi3_libcall;
-extern struct rtx_def *dsp16xx_ashlhi3_libcall;
-extern struct rtx_def *dsp16xx_lshrhi3_libcall;
-
-
-extern int hard_regno_mode_ok ();
-extern enum reg_class dsp16xx_reg_class_from_letter ();
-extern enum reg_class dsp16xx_limit_reload_class ();
-extern int hard_regno_nregs ();
-extern int regno_reg_class ();
-extern int move_operand ();
-extern int symbolic_address_p ();
-extern int Y_address ();
-extern int call_address_operand ();
-extern void notice_update_cc();
-extern void function_prologue ();
-extern void function_epilogue ();
-extern int dsp1600_comparison_reverse ();
-extern void double_reg_from_memory ();
-extern void double_reg_to_memory ();
-extern void bss_section ();
-extern struct rtx_def *dsp16xx_function_arg ();
-extern void dsp16xx_function_arg_advance ();
-extern enum rtx_code next_cc_user_code ();
-extern enum rtx_code save_next_cc_user_code;
-extern struct rtx_def *gen_tst_reg ();
-extern char *output_block_move();
-
-/* RUN-TIME TARGET SPECIFICATION */
-#define DSP16XX 1
-
-/* Name of the AT&T assembler */
-
-#define ASM_PROG "as1600"
-
-/* Name of the AT&T linker */
-
-#define LD_PROG "ld1600"
-
-/* Define which switches take word arguments */
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (!strcmp (STR, "ifile") ? 1 : \
- 0)
-
-#ifdef CC1_SPEC
-#undef CC1_SPEC
-#endif
-#define CC1_SPEC ""
-
-/* Define this as a spec to call the AT&T assembler */
-
-#define CROSS_ASM_SPEC "%{!S:as1600 %a %i\n }"
-
-/* Define this as a spec to call the AT&T linker */
-
-#define CROSS_LINK_SPEC "%{!c:%{!M:%{!MM:%{!E:%{!S:ld1600 %l %X %{o*} %{m} \
- %{r} %{s} %{t} %{u*} %{x}\
- %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:}\
- %{L*} %D %o %{!nostdlib:-le1600 %L -le1600}\
- %{!A:%{!nostdlib:%{!nostartfiles:%E}}}\n }}}}}"
-
-/* Nothing complicated here, just link with libc.a under normal
- circumstances */
-#define LIB_SPEC "-lc"
-
-/* Specify the startup file to link with. */
-#define STARTFILE_SPEC "%{mmap1:m1_crt0.o%s} \
-%{mmap2:m2_crt0.o%s} \
-%{mmap3:m3_crt0.o%s} \
-%{mmap4:m4_crt0.o%s} \
-%{!mmap*: %{!ifile*: m4_crt0.o%s} %{ifile*: \
-%eA -ifile option requires a -map option}}"
-
-/* Specify the end file to link with */
-
-#define ENDFILE_SPEC "%{mmap1:m1_crtn.o%s} \
-%{mmap2:m2_crtn.o%s} \
-%{mmap3:m3_crtn.o%s} \
-%{mmap4:m4_crtn.o%s} \
-%{!mmap*: %{!ifile*: m4_crtn.o%s} %{ifile*: \
-%eA -ifile option requires a -map option}}"
-
-
-/* Tell gcc where to look for the startfile */
-#define STANDARD_STARTFILE_PREFIX "/d1600/lib"
-
-/* Tell gcc where to look for it's executables */
-#define STANDARD_EXEC_PREFIX "/d1600/bin"
-
-/* Command line options to the AT&T assembler */
-#define ASM_SPEC "%{v:-V} %{g*:-g}"
-
-/* Command line options for the AT&T linker */
-#define LINK_SPEC "%{v:-V} %{minit:-i} \
-%{!ifile*:%{mmap1:-ifile m1_deflt.if%s} \
- %{mmap2:-ifile m2_deflt.if%s} \
- %{mmap3:-ifile m3_deflt.if%s} \
- %{mmap4:-ifile m4_deflt.if%s} \
- %{!mmap*:-ifile m4_deflt.if%s}} \
-%{ifile*} %{!r:-a}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-#ifdef __MSDOS__
-#define CPP_PREDEFINES "-Ddsp1600 -DDSP1600 -DMSDOS"
-#else
-#define CPP_PREDEFINES "-Ddsp1600 -DDSP1600 -Ddsp1610 -DDSP1610"
-#endif
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-#define MASK_REGPARM 0x00000001 /* Pass parameters in registers */
-#define MASK_NEAR_CALL 0x00000002 /* The call is on the same 4k page */
-#define MASK_NEAR_JUMP 0x00000004 /* The jump is on the same 4k page */
-#define MASK_BMU 0x00000008 /* Use the 'bmu' shift instructions */
-#define MASK_OPTIMIZE_MEMORY 0x00000010 /* Optimize to conserve memory */
-#define MASK_OPTIMIZE_SPEED 0x00000020 /* Optimize for speed */
-#define MASK_MAP1 0x00000040 /* Link with map1 */
-#define MASK_MAP2 0x00000080 /* Link with map2 */
-#define MASK_MAP3 0x00000100 /* Link with map3 */
-#define MASK_MAP4 0x00000200 /* Link with map4 */
-#define MASK_YBASE_HIGH 0x00000400 /* The ybase register window starts high */
-#define MASK_INIT 0x00000800 /* Have the linker generate tables to
- initialize data at startup */
-#define MASK_INLINE_MULT 0x00001000 /* Inline 32 bit multiplies */
-#define MASK_RESERVE_YBASE 0x00002000 /* Reserved the ybase registers */
-
-/* Compile passing first two args in regs 0 and 1.
- This exists only to test compiler features that will
- be needed for RISC chips. It is not usable
- and is not intended to be usable on this cpu. */
-#define TARGET_REGPARM (target_flags & MASK_REGPARM)
-
-/* The call is on the same 4k page, so instead of loading
- the 'pt' register and branching, we can branch directly */
-
-#define TARGET_NEAR_CALL (target_flags & MASK_NEAR_CALL)
-
-/* The jump is on the same 4k page, so instead of loading
- the 'pt' register and branching, we can branch directly */
-
-#define TARGET_NEAR_JUMP (target_flags & MASK_NEAR_JUMP)
-
-/* Generate shift instructions to use the 1610 Bit Manipulation
- Unit. */
-#define TARGET_BMU (target_flags & MASK_BMU)
-
-/* Optimize to conserve memory */
-#define TARGET_OPTIMIZE_MEMORY (target_flags & MASK_OPTIMIZE_MEMORY)
-
-/* Optimize for maximum speed */
-#define TARGET_OPTIMIZE_SPEED (target_flags & MASK_OPTIMIZE_SPEED)
-
-#define TARGET_YBASE_HIGH (target_flags & MASK_YBASE_HIGH)
-
-/* Direct the linker to output extra info for initialized data */
-#define TARGET_MASK_INIT (target_flags & MASK_INIT)
-
-#define TARGET_INLINE_MULT (target_flags & MASK_INLINE_MULT)
-
-/* Reserve the ybase registers *(0) - *(31) */
-#define TARGET_RESERVE_YBASE (target_flags & MASK_RESERVE_YBASE)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-
-#define TARGET_SWITCHES \
- { \
- { "regparm", MASK_REGPARM}, \
- { "no-regparm", -MASK_REGPARM}, \
- { "no-near-call", -MASK_NEAR_CALL}, \
- { "near-jump", MASK_NEAR_JUMP}, \
- { "no-near-jump", -MASK_NEAR_JUMP}, \
- { "bmu", MASK_BMU}, \
- { "no-bmu", -MASK_BMU}, \
- { "Om", MASK_OPTIMIZE_MEMORY}, \
- { "Os", MASK_OPTIMIZE_SPEED}, \
- { "map1", MASK_MAP1}, \
- { "map2", MASK_MAP2}, \
- { "map3", MASK_MAP3}, \
- { "map4", MASK_MAP4}, \
- { "ybase-high", MASK_YBASE_HIGH}, \
- { "init", MASK_INIT}, \
- { "inline-mult", MASK_INLINE_MULT}, \
- { "reserve-ybase", MASK_RESERVE_YBASE}, \
- { "", TARGET_DEFAULT} \
- }
-
-/* Default target_flags if no switches are specified */
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT MASK_OPTIMIZE_MEMORY|MASK_REGPARM|MASK_YBASE_HIGH
-#endif
-
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
- command options that have values. Its definition is an
- initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- fixed part of the option name, and the address of a variable.
- The variable, type `char *', is set to the variable part of the
- given option if the fixed part matches. The actual option name
- is made by appending `-m' to the specified name.
-
- Here is an example which defines `-mshort-data-NUMBER'. If the
- given option is `-mshort-data-512', the variable `m88k_short_data'
- will be set to the string `"512"'.
-
- extern char *m88k_short_data;
- #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
-
-#define TARGET_OPTIONS \
-{ \
- { "text=", &text_seg_name }, \
- { "data=", &data_seg_name }, \
- { "bss=", &bss_seg_name }, \
- { "const=", &const_seg_name }, \
- { "chip=", &chip_name } \
-}
-
-/* Sometimes certain combinations of command options do not make sense
- on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed. */
-
-#define OVERRIDE_OPTIONS override_options ()
-
-#define OPTIMIZATION_OPTIONS(LEVEL) \
-{ \
- flag_gnu_linker = FALSE; \
- \
- if (LEVEL) \
- { \
- flag_omit_frame_pointer = TRUE; \
- flag_thread_jumps = TRUE; \
- } \
- \
- if (LEVEL >= 2) \
- { \
- flag_strength_reduce = TRUE; \
- flag_cse_follow_jumps = TRUE; \
- flag_cse_skip_blocks = TRUE; \
- flag_expensive_optimizations = TRUE; \
- flag_rerun_cse_after_loop = TRUE; \
- } \
- \
- if (LEVEL >= 3) \
- { \
- flag_inline_functions = 1; \
- } \
-}
-
-/* STORAGE LAYOUT */
-
-/* Define if you don't want extended real, but do want to use the
- software floating point emulator for REAL_ARITHMETIC and
- decimal <-> binary conversion. */
-#define REAL_ARITHMETIC
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered.
- We define big-endian, but since the 1600 series cannot address bytes
- it does not matter. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is numbered.
- For the 1600 we can decide arbitrarily since there are no machine instructions for them. */
-#define WORDS_BIG_ENDIAN 1
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 16
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 16
-
-/* Maximum number of bits in a word. */
-#define MAX_BITS_PER_WORD 16
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 1
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 16
-
-/* Allocation boundary (in *bits*) for storing pointers in memory. */
-#define POINTER_BOUNDARY 16
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 16
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 16
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 16
-
-/* Biggest alignment that any data type can require on this machine, in bits. */
-#define BIGGEST_ALIGNMENT 16
-
-/* Biggest alignment that any structure field can require on this machine, in bits */
-#define BIGGEST_FIELD_ALIGNMENT 16
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 16
-
-/* Number of bits which any structure or union's size must be a multiple of. Each structure
- or union's size is rounded up to a multiple of this */
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* Define this if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* An integer expression for the size in bits of the largest integer machine mode that
- should actually be used. All integer machine modes of this size or smaller can be
- used for structures and unions with the appropriate sizes. */
-#define MAX_FIXED_MODE_SIZE 32
-
-/* LAYOUT OF SOURCE LANGUAGE DATA TYPES */
-
-#define CHAR_TYPE_SIZE 16
-#define SHORT_TYPE_SIZE 16
-#define INT_TYPE_SIZE 16
-#define LONG_TYPE_SIZE 32
-#define LONG_LONG_TYPE_SIZE 32
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 32
-#define LONG_DOUBLE_TYPE_SIZE 32
-
-/* An expression whose value is 1 or 0, according to whether the type char should be
- signed or unsigned by default. */
-
-#define DEFAULT_SIGNED_CHAR 1
-
-/* A C expression to determine whether to give an enum type only as many bytes
- as it takes to represent the range of possible values of that type. A nonzero
- value means to do that; a zero value means all enum types should be allocated
- like int. */
-
-#define DEFAULT_SHORT_ENUMS 0
-
-/* A C expression for a string describing the name of the data type to use for
- size values. */
-
-#define SIZE_TYPE "long unsigned int"
-
-/* A C expression for a string describing the name of the datat type to use for the
- result of subtracting two pointers */
-
-#define PTRDIFF_TYPE "long int"
-
-#define TARGET_BELL '\a'
-#define TARGET_BS '\b'
-#define TARGET_TAB '\t'
-#define TARGET_NEWLINE '\n'
-#define TARGET_VT '\v'
-#define TARGET_FF '\f'
-#define TARGET_CR '\r'
-
-
-/* REGISTER USAGE. */
-
-#define ALL_16_BIT_REGISTERS 1
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to FIRST_PSEUDO_REGISTER-1 */
-
-#define FIRST_PSEUDO_REGISTER REG_YBASE31 + 1
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
-
- The registers are layed out as follows:
-
- {a0,a0l,a1,a1l,x,y,yl,p,pl} - Data Arithmetic Unit
- {r0,r1,r2,r3,j,k,ybase} - Y Space Address Arithmetic Unit
- {pt} - X Space Address Arithmetic Unit
- {ar0,ar1,ar2,ar3} - Bit Manipulation UNit
- {pr} - Return Address Register
-
- We reserve r2 for the Stack Pointer.
- We specify r3 for the Frame Pointer but allow the compiler
- to omit it when possible since we have so few pointer registers. */
-
-#define REG_A0 0
-#define REG_A0L 1
-#define REG_A1 2
-#define REG_A1L 3
-#define REG_X 4
-#define REG_Y 5
-#define REG_YL 6
-#define REG_PROD 7
-#define REG_PRODL 8
-#define REG_R0 9
-#define REG_R1 10
-#define REG_R2 11
-#define REG_R3 12
-#define REG_J 13
-#define REG_K 14
-#define REG_YBASE 15
-#define REG_PT 16
-#define REG_AR0 17
-#define REG_AR1 18
-#define REG_AR2 19
-#define REG_AR3 20
-#define REG_C0 21
-#define REG_C1 22
-#define REG_C2 23
-#define REG_PR 24
-#define REG_RB 25
-#define REG_YBASE0 26
-#define REG_YBASE1 27
-#define REG_YBASE2 28
-#define REG_YBASE3 29
-#define REG_YBASE4 30
-#define REG_YBASE5 31
-#define REG_YBASE6 32
-#define REG_YBASE7 33
-#define REG_YBASE8 34
-#define REG_YBASE9 35
-#define REG_YBASE10 36
-#define REG_YBASE11 37
-#define REG_YBASE12 38
-#define REG_YBASE13 39
-#define REG_YBASE14 40
-#define REG_YBASE15 41
-#define REG_YBASE16 42
-#define REG_YBASE17 43
-#define REG_YBASE18 44
-#define REG_YBASE19 45
-#define REG_YBASE20 46
-#define REG_YBASE21 47
-#define REG_YBASE22 48
-#define REG_YBASE23 49
-#define REG_YBASE24 50
-#define REG_YBASE25 51
-#define REG_YBASE26 52
-#define REG_YBASE27 53
-#define REG_YBASE28 54
-#define REG_YBASE29 55
-#define REG_YBASE30 56
-#define REG_YBASE31 57
-
-/* Do we have a accumulator register? */
-#define IS_ACCUM_REG(REGNO) ((REGNO) >= REG_A0 && (REGNO) <= REG_A1L)
-#define IS_ACCUM_LOW_REG(REGNO) ((REGNO) == REG_A0L || (REGNO) == REG_A1L)
-
-/* Do we have a virtual ybase register */
-#define IS_YBASE_REGISTER_WINDOW(REGNO) ((REGNO) >= REG_YBASE0 && (REGNO) <= REG_YBASE31)
-
-#define IS_ADDRESS_REGISTER(REGNO) ((REGNO) >= REG_R0 && (REGNO) <= REG_R3)
-
-#define FIXED_REGISTERS \
-{0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 1, 0, 0, 1, \
- 1, \
- 0, 0, 0, 0, \
- 1, 1, 1, \
- 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- On the 1610 'a0' holds return values from functions. 'r0' holds
- structure-value addresses.
-
- In addition we don't save either j, k, ybase or any of the
- bit manipulation registers. */
-
-
-#define CALL_USED_REGISTERS \
-{1, 1, 1, 1, 0, 1, 1, 1, 1, \
- 1, 0, 0, 1, 1, 1, 1, \
- 1, \
- 0, 0, 1, 1, \
- 1, 1, 1, \
- 0, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0}
-
-/* List the order in which to allocate registers. Each register must be
- listed once, even those in FIXED_REGISTERS.
-
- We allocate in the following order:
- */
-
-#define REG_ALLOC_ORDER \
-{ REG_R0, REG_R1, REG_R2, REG_PROD, REG_Y, REG_X, \
- REG_PRODL, REG_YL, REG_AR0, REG_AR1, \
- REG_RB, REG_A0, REG_A1, REG_A0L, \
- REG_A1L, REG_AR2, REG_AR3, \
- REG_YBASE, REG_J, REG_K, REG_PR, REG_PT, REG_C0, \
- REG_C1, REG_C2, REG_R3, \
- REG_YBASE0, REG_YBASE1, REG_YBASE2, REG_YBASE3, \
- REG_YBASE4, REG_YBASE5, REG_YBASE6, REG_YBASE7, \
- REG_YBASE8, REG_YBASE9, REG_YBASE10, REG_YBASE11, \
- REG_YBASE12, REG_YBASE13, REG_YBASE14, REG_YBASE15, \
- REG_YBASE16, REG_YBASE17, REG_YBASE18, REG_YBASE19, \
- REG_YBASE20, REG_YBASE21, REG_YBASE22, REG_YBASE23, \
- REG_YBASE24, REG_YBASE25, REG_YBASE26, REG_YBASE27, \
- REG_YBASE28, REG_YBASE29, REG_YBASE30, REG_YBASE31 }
-
-/* Zero or more C statements that may conditionally modify two
- variables `fixed_regs' and `call_used_regs' (both of type `char
- []') after they have been initialized from the two preceding
- macros.
-
- This is necessary in case the fixed or call-clobbered registers
- depend on target flags.
-
- You need not define this macro if it has no work to do.
-
- If the usage of an entire class of registers depends on the target
- flags, you may indicate this to GCC by using this macro to modify
- `fixed_regs' and `call_used_regs' to 1 for each of the registers in
- the classes which should not be used by GCC. Also define the macro
- `REG_CLASS_FROM_LETTER' to return `NO_REGS' if it is called with a
- letter for a class that shouldn't be used.
-
- (However, if this class is not included in `GENERAL_REGS' and all
- of the insn patterns whose constraints permit this class are
- controlled by target switches, then GCC will automatically avoid
- using these registers when the target switches are opposed to
- them.) If the user tells us there is no BMU, we can't use
- ar0-ar3 for register allocation */
-
-#define CONDITIONAL_REGISTER_USAGE \
-do \
- { \
- if (!TARGET_BMU) \
- { \
- int regno; \
- \
- for (regno = REG_AR0; regno <= REG_AR3; regno++) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- } \
- if (TARGET_RESERVE_YBASE) \
- { \
- int regno; \
- \
- for (regno = REG_YBASE0; regno <= REG_YBASE31; regno++) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- } \
- } \
-while (0)
-
-/* Determine which register classes are very likely used by spill registers.
- local-alloc.c won't allocate pseudos that have these classes as their
- preferred class unless they are "preferred or nothing". */
-
-#define CLASS_LIKELY_SPILLED_P(CLASS) \
- ((CLASS) != ALL_REGS && (CLASS) != YBASE_VIRT_REGS)
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (GET_MODE_SIZE(MODE))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok(REGNO, MODE)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (((MODE1) == (MODE2)) || \
- (GET_MODE_CLASS((MODE1)) == MODE_FLOAT) \
- == (GET_MODE_CLASS((MODE2)) == MODE_FLOAT))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* DSP1600 pc isn't overloaded on a register. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments.
- This is r3 in our case */
-#define STACK_POINTER_REGNUM REG_R3
-
-/* Base register for access to local variables of the function.
- This is r2 in our case */
-#define FRAME_POINTER_REGNUM REG_R2
-
-/* We can debug without the frame pointer */
-#define CAN_DEBUG_WITHOUT_FP 1
-
-/* The 1610 saves the return address in this register */
-#define RETURN_ADDRESS_REGNUM REG_PR
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
-
-/* Register in which static-chain is passed to a function. */
-
-#define STATIC_CHAIN_REGNUM 4
-
-/* Register in which address to store a structure value
- is passed to a function. This is 'r0' in our case */
-#define STRUCT_VALUE_REGNUM REG_R0
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-
-enum reg_class
-{
- NO_REGS,
- A0H_REG,
- A0L_REG,
- A0_REG,
- A1H_REG,
- ACCUM_HIGH_REGS,
- A1L_REG,
- ACCUM_LOW_REGS,
- A1_REG,
- ACCUM_REGS,
- X_REG,
- X_OR_ACCUM_LOW_REGS,
- X_OR_ACCUM_REGS,
- YH_REG,
- YH_OR_ACCUM_HIGH_REGS,
- X_OR_YH_REGS,
- YL_REG,
- YL_OR_ACCUM_LOW_REGS,
- X_OR_YL_REGS,
- X_OR_Y_REGS,
- Y_REG,
- ACCUM_OR_Y_REGS,
- PH_REG,
- X_OR_PH_REGS,
- PL_REG,
- PL_OR_ACCUM_LOW_REGS,
- X_OR_PL_REGS,
- YL_OR_PL_OR_ACCUM_LOW_REGS,
- P_REG,
- ACCUM_OR_P_REGS,
- YL_OR_P_REGS,
- ACCUM_LOW_OR_YL_OR_P_REGS,
- Y_OR_P_REGS,
- ACCUM_Y_OR_P_REGS,
- NO_FRAME_Y_ADDR_REGS,
- Y_ADDR_REGS,
- ACCUM_LOW_OR_Y_ADDR_REGS,
- ACCUM_OR_Y_ADDR_REGS,
- X_OR_Y_ADDR_REGS,
- Y_OR_Y_ADDR_REGS,
- P_OR_Y_ADDR_REGS,
- NON_HIGH_YBASE_ELIGIBLE_REGS,
- YBASE_ELIGIBLE_REGS,
- J_REG,
- J_OR_DAU_16_BIT_REGS,
- BMU_REGS,
- NOHIGH_NON_ADDR_REGS,
- NON_ADDR_REGS,
- SLOW_MEM_LOAD_REGS,
- NOHIGH_NON_YBASE_REGS,
- NO_ACCUM_NON_YBASE_REGS,
- NON_YBASE_REGS,
- YBASE_VIRT_REGS,
- ACCUM_LOW_OR_YBASE_REGS,
- ACCUM_OR_YBASE_REGS,
- X_OR_YBASE_REGS,
- Y_OR_YBASE_REGS,
- ACCUM_LOW_YL_PL_OR_YBASE_REGS,
- P_OR_YBASE_REGS,
- ACCUM_Y_P_OR_YBASE_REGS,
- Y_ADDR_OR_YBASE_REGS,
- YBASE_OR_NOHIGH_YBASE_ELIGIBLE_REGS,
- YBASE_OR_YBASE_ELIGIBLE_REGS,
- NO_HIGH_ALL_REGS,
- ALL_REGS,
- LIM_REG_CLASSES
-};
-
-/* GENERAL_REGS must be the name of a register class */
-#define GENERAL_REGS ALL_REGS
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
-{ \
- "NO_REGS", \
- "A0H_REG", \
- "A0L_REG", \
- "A0_REG", \
- "A1H_REG", \
- "ACCUM_HIGH_REGS", \
- "A1L_REG", \
- "ACCUM_LOW_REGS", \
- "A1_REG", \
- "ACCUM_REGS", \
- "X_REG", \
- "X_OR_ACCUM_LOW_REGS", \
- "X_OR_ACCUM_REGS", \
- "YH_REG", \
- "YH_OR_ACCUM_HIGH_REGS", \
- "X_OR_YH_REGS", \
- "YL_REG", \
- "YL_OR_ACCUM_LOW_REGS", \
- "X_OR_YL_REGS", \
- "X_OR_Y_REGS", \
- "Y_REG", \
- "ACCUM_OR_Y_REGS", \
- "PH_REG", \
- "X_OR_PH_REGS", \
- "PL_REG", \
- "PL_OR_ACCUM_LOW_REGS", \
- "X_OR_PL_REGS", \
- "PL_OR_YL_OR_ACCUM_LOW_REGS", \
- "P_REG", \
- "ACCUM_OR_P_REGS", \
- "YL_OR_P_REGS", \
- "ACCUM_LOW_OR_YL_OR_P_REGS", \
- "Y_OR_P_REGS", \
- "ACCUM_Y_OR_P_REGS", \
- "NO_FRAME_Y_ADDR_REGS", \
- "Y_ADDR_REGS", \
- "ACCUM_LOW_OR_Y_ADDR_REGS", \
- "ACCUM_OR_Y_ADDR_REGS", \
- "X_OR_Y_ADDR_REGS", \
- "Y_OR_Y_ADDR_REGS", \
- "P_OR_Y_ADDR_REGS", \
- "NON_HIGH_YBASE_ELIGIBLE_REGS", \
- "YBASE_ELIGIBLE_REGS", \
- "J_REG", \
- "J_OR_DAU_16_BIT_REGS", \
- "BMU_REGS", \
- "NOHIGH_NON_ADDR_REGS", \
- "NON_ADDR_REGS", \
- "SLOW_MEM_LOAD_REGS", \
- "NOHIGH_NON_YBASE_REGS", \
- "NO_ACCUM_NON_YBASE_REGS", \
- "NON_YBASE_REGS", \
- "YBASE_VIRT_REGS", \
- "ACCUM_LOW_OR_YBASE_REGS", \
- "ACCUM_OR_YBASE_REGS", \
- "X_OR_YBASE_REGS", \
- "Y_OR_YBASE_REGS", \
- "ACCUM_LOW_YL_PL_OR_YBASE_REGS", \
- "P_OR_YBASE_REGS", \
- "ACCUM_Y_P_OR_YBASE_REGS", \
- "Y_ADDR_OR_YBASE_REGS", \
- "YBASE_OR_NOHIGH_YBASE_ELIGIBLE_REGS", \
- "YBASE_OR_YBASE_ELIGIBLE_REGS", \
- "NO_HIGH_ALL_REGS", \
- "ALL_REGS" \
-}
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ \
- {0x00000000, 0x00000000}, /* no reg */ \
- {0x00000001, 0x00000000}, /* a0h */ \
- {0x00000002, 0x00000000}, /* a0l */ \
- {0x00000003, 0x00000000}, /* a0h:a0l */ \
- {0x00000004, 0x00000000}, /* a1h */ \
- {0x00000005, 0x00000000}, /* accum high */ \
- {0x00000008, 0x00000000}, /* a1l */ \
- {0x0000000A, 0x00000000}, /* accum low */ \
- {0x0000000c, 0x00000000}, /* a1h:a1l */ \
- {0x0000000f, 0x00000000}, /* accum regs */ \
- {0x00000010, 0x00000000}, /* x reg */ \
- {0x0000001A, 0x00000000}, /* x & accum_low_regs */ \
- {0x0000001f, 0x00000000}, /* x & accum regs */ \
- {0x00000020, 0x00000000}, /* y high */ \
- {0x00000025, 0x00000000}, /* yh, accum high */ \
- {0x00000030, 0x00000000}, /* x & yh */ \
- {0x00000040, 0x00000000}, /* y low */ \
- {0x0000004A, 0x00000000}, /* y low, accum_low */ \
- {0x00000050, 0x00000000}, /* x & yl */ \
- {0x00000060, 0x00000000}, /* yl:yh */ \
- {0x00000070, 0x00000000}, /* x, yh,a nd yl */ \
- {0x0000006F, 0x00000000}, /* accum, y */ \
- {0x00000080, 0x00000000}, /* p high */ \
- {0x00000090, 0x00000000}, /* x & ph */ \
- {0x00000100, 0x00000000}, /* p low */ \
- {0x0000010A, 0x00000000}, /* p_low and accum_low */ \
- {0x00000110, 0x00000000}, /* x & pl */ \
- {0x0000014A, 0x00000000}, /* pl,yl,a1l,a0l */ \
- {0x00000180, 0x00000000}, /* pl:ph */ \
- {0x0000018F, 0x00000000}, /* accum, p */ \
- {0x000001C0, 0x00000000}, /* pl:ph and yl */ \
- {0x000001CA, 0x00000000}, /* pl:ph, yl, a0l, a1l */ \
- {0x000001E0, 0x00000000}, /* y or p */ \
- {0x000001EF, 0x00000000}, /* accum, y or p */ \
- {0x00000E00, 0x00000000}, /* r0-r2 */ \
- {0x00001E00, 0x00000000}, /* r0-r3 */ \
- {0x00001E0A, 0x00000000}, /* r0-r3, accum_low */ \
- {0x00001E0F, 0x00000000}, /* accum,r0-r3 */ \
- {0x00001E10, 0x00000000}, /* x,r0-r3 */ \
- {0x00001E60, 0x00000000}, /* y,r0-r3 */ \
- {0x00001F80, 0x00000000}, /* p,r0-r3 */ \
- {0x00001FDA, 0x00000000}, /* ph:pl, r0-r3, x,a0l,a1l */ \
- {0x00001fff, 0x00000000}, /* accum,x,y,p,r0-r3 */ \
- {0x00002000, 0x00000000}, /* j */ \
- {0x00002025, 0x00000000}, /* j, yh, a1h, a0h */ \
- {0x001E0000, 0x00000000}, /* ar0-ar3 */ \
- {0x03FFE1DA, 0x00000000}, /* non_addr except yh,a0h,a1h */ \
- {0x03FFE1FF, 0x00000000}, /* non_addr regs */ \
- {0x03FFFF8F, 0x00000000}, /* non ybase except yh, yl, and x */ \
- {0x03FFFFDA, 0x00000000}, /* non ybase regs except yh,a0h,a1h */ \
- {0x03FFFFF0, 0x00000000}, /* non ybase except a0,a0l,a1,a1l */ \
- {0x03FFFFFF, 0x00000000}, /* non ybase regs */ \
- {0xFC000000, 0x03FFFFFF}, /* virt ybase regs */ \
- {0xFC00000A, 0x03FFFFFF}, /* accum_low, virt ybase regs */ \
- {0xFC00000F, 0x03FFFFFF}, /* accum, virt ybase regs */ \
- {0xFC000010, 0x03FFFFFF}, /* x,virt ybase regs */ \
- {0xFC000060, 0x03FFFFFF}, /* y,virt ybase regs */ \
- {0xFC00014A, 0x03FFFFFF}, /* accum_low, yl, pl, ybase */ \
- {0xFC000180, 0x03FFFFFF}, /* p,virt ybase regs */ \
- {0xFC0001EF, 0x03FFFFFF}, /* accum,y,p,ybase regs */ \
- {0xFC001E00, 0x03FFFFFF}, /* r0-r3, ybase regs */ \
- {0xFC001FDA, 0x03FFFFFF}, /* r0-r3, pl:ph,yl,x,a1l,a0l */ \
- {0xFC001FFF, 0x03FFFFFF}, /* virt ybase, ybase eligible regs */ \
- {0xFCFFFFDA, 0x03FFFFFF}, /* all regs except yh,a0h,a1h */ \
- {0xFFFFFFFF, 0x03FFFFFF} /* all regs */ \
-}
-
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) regno_reg_class(REGNO)
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS NO_REGS
-#define BASE_REG_CLASS Y_ADDR_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- dsp16xx_reg_class_from_letter(C)
-
-#define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) \
- secondary_reload_class(CLASS, MODE, X)
-
-/* When defined, the compiler allows registers explicitly used in the
- rtl to be used as spill registers but prevents the compiler from
- extending the lifetime of these registers. */
-
-#define SMALL_REGISTER_CLASSES 1
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-/* A C expression which is nonzero if register REGNO is suitable for use
- as a base register in operand addresses. It may be either a suitable
- hard register or a pseudo register that has been allocated such a
- hard register.
-
- On the 1610 the Y address pointers can be used as a base registers */
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-(((REGNO) >= REG_R0 && (REGNO) < REG_R3 + 1) || ((unsigned) reg_renumber[REGNO] >= REG_R0 \
- && (unsigned) reg_renumber[REGNO] < REG_R3 + 1))
-
-#define REGNO_OK_FOR_YBASE_P(REGNO) \
- (((REGNO) == REG_YBASE) || ((unsigned) reg_renumber[REGNO] == REG_YBASE))
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) 0
-
-#ifdef ALL_16_BIT_REGISTERS
-#define IS_32_BIT_REG(REGNO) 0
-#else
-#define IS_32_BIT_REG(REGNO) \
- ((REGNO) == REG_A0 || (REGNO) == REG_A1 || (REGNO) == REG_Y || (REGNO) == REG_PROD)
-#endif
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
- Also, we must ensure that a PLUS is reloaded either
- into an accumulator or an address register. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) preferred_reload_class (X, CLASS)
-
-/* A C expression that places additional restrictions on the register
- class to use when it is necessary to be able to hold a value of
- mode MODE in a reload register for which class CLASS would
- ordinarily be used.
-
- Unlike `PREFERRED_RELOAD_CLASS', this macro should be used when
- there are certain modes that simply can't go in certain reload
- classes.
-
- The value is a register class; perhaps CLASS, or perhaps another,
- smaller class.
-
- Don't define this macro unless the target machine has limitations
- which require the macro to do something nontrivial. */
-
-#if 0
-#define LIMIT_RELOAD_CLASS(MODE, CLASS) dsp16xx_limit_reload_class (MODE, CLASS)
-#endif
-
-/* A C expression for the maximum number of consecutive registers of class CLASS
- needed to hold a value of mode MODE */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- class_max_nregs(CLASS, MODE)
-
-/* The letters 'I' through 'P' in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For the 16xx, the following constraints are used:
- 'I' requires a non-negative 16-bit value.
- 'J' requires a non-negative 9-bit value
- 'K' requires a constant 0 operand.
- 'L' requires 16-bit value
- 'M' 32-bit value -- low 16-bits zero
- */
-
-#define SMALL_INT(X) (SMALL_INTVAL (INTVAL (X)))
-#define SMALL_INTVAL(I) ((unsigned) (I) < 0x10000)
-#define SHORT_IMMEDIATE(X) (SHORT_INTVAL (INTVAL(X)))
-#define SHORT_INTVAL(I) ((unsigned) (I) < 0x100)
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (SMALL_INTVAL(VALUE)) \
- : (C) == 'J' ? (SHORT_INTVAL(VALUE)) \
- : (C) == 'K' ? ((VALUE) == 0) \
- : (C) == 'L' ? ! ((VALUE) & ~0x0000ffff) \
- : (C) == 'M' ? ! ((VALUE) & ~0xffff0000) \
- : (C) == 'N' ? ((VALUE) == -1 || (VALUE) == 1 || \
- (VALUE) == -2 || (VALUE) == 2) \
- : 0)
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
-
-/* Optional extra constraints for this machine */
-#define EXTRA_CONSTRAINT(OP,C) \
- ((C) == 'R' ? symbolic_address_p (OP) \
- : 0)
-
-/* DESCRIBING STACK LAYOUT AND CALLING CONVENTIONS */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-/* #define STACK_GROWS_DOWNWARD */
-
-/* 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
- goes at a more negative offset in the frame. */
-/* #define FRAME_GROWS_DOWNWARD */
-
-#define ARGS_GROW_DOWNWARD
-
-/* We use post decrement on the 1600 because there isn't
- a pre-decrement addressing mode. This means that we
- assume the stack pointer always points at the next
- FREE location on the stack. */
-#define STACK_PUSH_CODE POST_INC
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* Offset from the stack pointer register to the first
- location at which outgoing arguments are placed. */
-#define STACK_POINTER_OFFSET (0)
-
-struct dsp16xx_frame_info
-{
- unsigned long total_size; /* # bytes that the entire frame takes up */
- unsigned long var_size; /* # bytes that variables take up */
- unsigned long args_size; /* # bytes that outgoing arguments take up */
- unsigned long extra_size; /* # bytes of extra gunk */
- unsigned int reg_size; /* # bytes needed to store regs */
- long fp_save_offset; /* offset from vfp to store registers */
- unsigned long sp_save_offset; /* offset from new sp to store registers */
- int initialized; /* != 0 if frame size already calculated */
- int num_regs; /* number of registers saved */
- int function_makes_calls; /* Does the function make calls */
-};
-
-extern struct dsp16xx_frame_info current_frame_info;
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by. */
-/* #define PUSH_ROUNDING(BYTES) ((BYTES)) */
-
-/* If defined, the maximum amount of space required for outgoing
- arguments will be computed and placed into the variable
- 'current_function_outgoing_args_size'. No space will be pushed
- onto the stack for each call; instead, the function prologue should
- increase the stack frame size by this amount.
-
- It is not proper to define both 'PUSH_ROUNDING' and
- 'ACCUMULATE_OUTGOING_ARGS'. */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Offset of first parameter from the argument pointer
- register value. */
-
-#define FIRST_PARM_OFFSET(FNDECL) (0)
-
-/* Value is 1 if returning from a function call automatically
- pops the arguments described by the number-of-args field in the call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. On the 1610 all function return their values
- in a0 (i.e. the upper 16 bits). If the return value is 32-bits the
- entire register is significant. */
-
-#define VALUE_REGNO(MODE) (REG_Y)
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), VALUE_REGNO(TYPE_MODE(VALTYPE)))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, VALUE_REGNO(MODE))
-
-/* 1 if N is a possible register number for a function value. */
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == REG_Y)
-
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the 1610 all args are pushed, except if -mregparm is specified
- then the first two words of arguments are passed in a0, a1. */
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- dsp16xx_function_arg (CUM, MODE, TYPE, NAMED)
-
-/* Define the first register to be used for argument passing */
-#define FIRST_REG_FOR_FUNCTION_ARG REG_Y
-
-/* Define the profitability of saving registers around calls.
- NOTE: For now we turn this off because of a bug in the
- caller-saves code and also because i'm not sure it is helpful
- on the 1610. */
-
-#define CALLER_SAVE_PROFITABLE(REFS,CALLS) 0
-
-/* This indicates that an argument is to be passed with an invisible reference
- (i.e., a pointer to the object is passed).
-
- On the dsp16xx, we do this if it must be passed on the stack. */
-
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
- (MUST_PASS_IN_STACK (MODE, TYPE))
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) (0)
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go. */
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- dsp16xx_function_arg_advance (&CUM, MODE,TYPE, NAMED)
-
-/* 1 if N is a possible register number for function argument passing. */
-#define FUNCTION_ARG_REGNO_P(N) \
- ((N) == REG_Y || (N) == REG_YL || (N) == REG_PROD || (N) == REG_PRODL)
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) function_prologue(FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) fatal("Profiling not implemented yet.")
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) fatal("Profiling not implemented yet.")
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. */
-#define BLOCK_PROFILER(FILE, BLOCKNO) fatal("Profiling not implemented yet.")
-
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK (0)
-
-#define TRAMPOLINE_TEMPLATE(FILE) fatal ("Trampolines not yet implemented");
-
-/* Length in units of the trampoline for entering a nested function.
- This is a dummy value */
-
-#define TRAMPOLINE_SIZE 20
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
- fatal ("Trampolines not yet implemented");
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) function_epilogue(FILE, SIZE)
-
-/* A C expression which is nonzero if a function must have and use a
- frame pointer. If its value is nonzero the functions will have a
- frame pointer. */
-#define FRAME_POINTER_REQUIRED (current_function_calls_alloca)
-
-/* A C statement to store in the variable 'DEPTH' the difference
- between the frame pointer and the stack pointer values immediately
- after the function prologue. */
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
-{ (DEPTH) = initial_frame_pointer_offset(); \
-}
-
-/* IMPLICIT CALLS TO LIBRARY ROUTINES */
-
-#define ADDHF3_LIBCALL "__Emulate_addhf3"
-#define SUBHF3_LIBCALL "__Emulate_subhf3"
-#define MULHF3_LIBCALL "__Emulate_mulhf3"
-#define DIVHF3_LIBCALL "__Emulate_divhf3"
-#define CMPHF3_LIBCALL "__Emulate_cmphf3"
-#define FIXHFHI2_LIBCALL "__Emulate_fixhfhi2"
-#define FLOATHIHF2_LIBCALL "__Emulate_floathihf2"
-#define NEGHF2_LIBCALL "__Emulate_neghf2"
-
-#define UMULHI3_LIBCALL "__Emulate_umulhi3"
-#define MULHI3_LIBCALL "__Emulate_mulhi3"
-#define UDIVQI3_LIBCALL "__Emulate_udivqi3"
-#define UDIVHI3_LIBCALL "__Emulate_udivhi3"
-#define DIVQI3_LIBCALL "__Emulate_divqi3"
-#define DIVHI3_LIBCALL "__Emulate_divhi3"
-#define MODQI3_LIBCALL "__Emulate_modqi3"
-#define MODHI3_LIBCALL "__Emulate_modhi3"
-#define UMODQI3_LIBCALL "__Emulate_umodqi3"
-#define UMODHI3_LIBCALL "__Emulate_umodhi3"
-#define ASHRHI3_LIBCALL "__Emulate_ashrhi3"
-#define LSHRHI3_LIBCALL "__Emulate_lshrhi3"
-#define ASHLHI3_LIBCALL "__Emulate_ashlhi3"
-#define LSHLHI3_LIBCALL "__Emulate_lshlhi3" /* NOT USED */
-
-/* Define this macro if calls to the ANSI C library functions memcpy and
- memset should be generated instead of the BSD function bcopy & bzero. */
-#define TARGET_MEM_FUNCTIONS
-
-
-/* ADDRESSING MODES */
-
-/* The 1610 has post-increment and decrement, but no pre-modify */
-#define HAVE_POST_INCREMENT
-#define HAVE_POST_DECREMENT
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Recognize any constant value that is a valid address. */
-#define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-#define MAX_REGS_PER_ADDRESS 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) 0
-
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- ((REGNO (X) >= REG_R0 && REGNO (X) < REG_R3 + 1 ) \
- || (REGNO (X) >= FIRST_PSEUDO_REGISTER))
-
-/* Nonzero if X is the 'ybase' register */
-#define REG_OK_FOR_YBASE_P(X) \
- (REGNO(X) == REG_YBASE || (REGNO (X) >= FIRST_PSEUDO_REGISTER))
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-/* Nonzero if X is the 'ybase' register */
-#define REG_OK_FOR_YBASE_P(X) REGNO_OK_FOR_YBASE_P (REGNO(X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On the 1610, the actual legitimate addresses must be N (N must fit in
- 5 bits), *rn (register indirect), *rn++, or *rn-- */
-
-#define INT_FITS_5_BITS(I) ((unsigned long) (I) < 0x20)
-#define INT_FITS_16_BITS(I) ((unsigned long) (I) < 0x10000)
-#define YBASE_CONST_OFFSET(I) ((I) >= -31 && (I) <= 0)
-#define YBASE_OFFSET(X) (GET_CODE (X) == CONST_INT && YBASE_CONST_OFFSET (INTVAL(X)))
-
-#define FITS_16_BITS(X) (GET_CODE (X) == CONST_INT && INT_FITS_16_BITS(INTVAL(X)))
-#define FITS_5_BITS(X) (GET_CODE (X) == CONST_INT && INT_FITS_5_BITS(INTVAL(X)))
-#define ILLEGAL_HIMODE_ADDR(MODE, CONST) ((MODE) == HImode && CONST == -31)
-
-#define INDIRECTABLE_ADDRESS_P(X) \
- ((GET_CODE(X) == REG && REG_OK_FOR_BASE_P(X)) \
- || ((GET_CODE(X) == POST_DEC || GET_CODE(X) == POST_INC) \
- && REG_P(XEXP(X,0)) && REG_OK_FOR_BASE_P(XEXP(X,0))) \
- || (GET_CODE(X) == CONST_INT && (unsigned long) (X) < 0x20))
-
-
-#define INDEXABLE_ADDRESS_P(X,MODE) \
- ((GET_CODE(X) == PLUS && GET_CODE (XEXP (X,0)) == REG && \
- XEXP(X,0) == stack_pointer_rtx && YBASE_OFFSET(XEXP(X,1)) && \
- !ILLEGAL_HIMODE_ADDR(MODE, INTVAL(XEXP(X,1)))) || \
- (GET_CODE(X) == PLUS && GET_CODE (XEXP (X,1)) == REG && \
- XEXP(X,1) == stack_pointer_rtx && YBASE_OFFSET(XEXP(X,0)) && \
- !ILLEGAL_HIMODE_ADDR(MODE, INTVAL(XEXP(X,0)))))
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ \
- if (INDIRECTABLE_ADDRESS_P(X)) \
- goto ADDR; \
-}
-
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the 1610, we need not do anything. However, if we don't,
- `memory_address' will try lots of things to get a valid address, most of
- which will result in dead code and extra pseudos. So we make the address
- valid here.
-
- This is easy: The only valid addresses are an offset from a register
- and we know the address isn't valid. So just call either `force_operand'
- or `force_reg' unless this is a (plus (reg ...) (const_int 0)). */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ if (GET_CODE (X) == PLUS && XEXP (X, 1) == const0_rtx) \
- X = XEXP (x, 0); \
- if (GET_CODE (X) == MULT || GET_CODE (X) == PLUS) \
- X = force_operand (X, 0); \
- else \
- X = force_reg (Pmode, X); \
- goto WIN; \
-}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the 1610, only postdecrement and postincrement address depend thus
- (the amount of decrement or increment being the length of the operand). */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-#define LEGITIMATE_CONSTANT_P(X) (1)
-
-
-/* CONDITION CODE INFORMATION */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
- notice_update_cc( (EXP) )
-
-/* DESCRIBING RELATIVE COSTS OF OPERATIONS */
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. */
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- return 0; \
- case LABEL_REF: \
- case SYMBOL_REF: \
- case CONST: \
- return COSTS_N_INSNS (1); \
- \
- case CONST_DOUBLE: \
- return COSTS_N_INSNS (2);
-
-/* Like CONST_COSTS but applies to nonconstant RTL expressions.
- This can be used, for example to indicate how costly a multiply
- instruction is. */
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MEM: \
- return GET_MODE (X) == QImode ? COSTS_N_INSNS (2) : \
- COSTS_N_INSNS (4); \
- case DIV: \
- case MOD: \
- return COSTS_N_INSNS (38); \
- case MULT: \
- if (GET_MODE (X) == QImode) \
- return COSTS_N_INSNS (2); \
- else \
- return COSTS_N_INSNS (38); \
- case PLUS: \
- if (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT) \
- { \
- if (GET_CODE (XEXP (X,1)) == CONST_INT) \
- { \
- int number = INTVAL(XEXP (X,1)); \
- if (number == 1) \
- return COSTS_N_INSNS (1); \
- if (INT_FITS_16_BITS(number)) \
- return COSTS_N_INSNS (2); \
- else \
- return COSTS_N_INSNS (4); \
- } \
- return COSTS_N_INSNS (1); \
- } \
- else \
- return COSTS_N_INSNS (38); \
- case MINUS: \
- if (GET_MODE_CLASS (GET_MODE (X)) == MODE_INT) \
- { \
- if (GET_CODE (XEXP (X,1)) == CONST_INT) \
- { \
- if (INT_FITS_16_BITS(INTVAL(XEXP(X,1)))) \
- return COSTS_N_INSNS (2); \
- else \
- return COSTS_N_INSNS (4); \
- } \
- return COSTS_N_INSNS (1); \
- } \
- else \
- return COSTS_N_INSNS (38); \
- case AND: case IOR: case XOR: \
- if (GET_CODE (XEXP (X,1)) == CONST_INT) \
- { \
- if (INT_FITS_16_BITS(INTVAL(XEXP(X,1)))) \
- return COSTS_N_INSNS (2); \
- else \
- return COSTS_N_INSNS (4); \
- } \
- return COSTS_N_INSNS (1); \
- case NEG: case NOT: \
- return COSTS_N_INSNS (1); \
- case ASHIFT: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- if (GET_CODE (XEXP (X,1)) == CONST_INT) \
- { \
- int number = INTVAL(XEXP (X,1)); \
- if (number == 1 || number == 4 || number == 8 || \
- number == 16) \
- return COSTS_N_INSNS (1); \
- else \
- return COSTS_N_INSNS (2); \
- } \
- return COSTS_N_INSNS (1);
-
-/* An expression giving the cost of an addressing mode that contains
- address. */
-#define ADDRESS_COST(ADDR) dsp16xx_address_cost (ADDR)
-
-/* A c expression for the cost of moving data from a register in
- class FROM to one in class TO. The classes are expressed using
- the enumeration values such as GENERAL_REGS. A value of 2 is
- the default. */
-#define REGISTER_MOVE_COST(FROM,TO) dsp16xx_register_move_cost (FROM, TO)
-
-/* A C expression for the cost of moving data of mode MODE between
- a register and memory. A value of 2 is the default. */
-#define MEMORY_MOVE_COST(MODE) \
- (GET_MODE_CLASS(MODE) == MODE_INT && MODE == QImode ? 12 \
- : 16)
-
-/* A C expression for the cost of a branch instruction. A value of
- 1 is the default; */
-#define BRANCH_COST 2
-
-
-/* Define this because otherwise gcc will try to put the function address
- in any old pseudo register. We can only use pt. */
-#define NO_FUNCTION_CSE
-
-/* Define this macro as a C expression which is nonzero if accessing less
- than a word of memory (i.e a char or short) is no faster than accessing
- a word of memory, i.e if such access require more than one instruction
- or if ther is no difference in cost between byte and (aligned) word
- loads. */
-#define SLOW_BYTE_ACCESS 1
-
-/* Define this macro if zero-extension (of a char or short to an int) can
- be done faster if the destination is a register that is know to be zero. */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Define this macro if unaligned accesses have a cost many times greater than
- aligned accesses, for example if they are emulated in a trap handler */
-/* define SLOW_UNALIGNED_ACCESS */
-
-/* Define this macro to inhibit strength reduction of memory addresses */
-/* #define DONT_REDUCE_ADDR */
-
-
-/* DIVIDING THE OUTPUT IN SECTIONS */
-/* Output before read-only data. */
-
-#define DEFAULT_TEXT_SEG_NAME ".text"
-#define TEXT_SECTION_ASM_OP rsect_text
-
-/* Output before constants and strings */
-#define DEFAULT_CONST_SEG_NAME ".const"
-#define READONLY_SECTION_ASM_OP rsect_const
-#define READONLY_DATA_SECTION const_section
-
-/* Output before writable data. */
-#define DEFAULT_DATA_SEG_NAME ".data"
-#define DATA_SECTION_ASM_OP rsect_data
-
-#define DEFAULT_BSS_SEG_NAME ".bss"
-#define BSS_SECTION_ASM_OP rsect_bss
-
-/* We will default to using 1610 if the user doesn't
- specify it. */
-#define DEFAULT_CHIP_NAME "1610"
-
-/* A list of names for sections other than the standard ones, which are
- 'in_text' and 'in_data' (and .bss if BSS_SECTION_ASM_OP is defined). */
-#define EXTRA_SECTIONS in_const
-
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-const_section () \
-{ \
- if (in_section != in_const) \
- { \
- fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \
- in_section = in_const; \
- } \
-}
-
-/* THE OVERALL FRAMEWORK OF AN ASSEMBLER FILE */
-
-/* Output at beginning of assembler file. */
-#define ASM_FILE_START(FILE) dsp16xx_file_start ()
-
-/* Prevent output of .gcc_compiled */
-#define ASM_IDENTIFY_GCC(FILE)
-
-/* A C string constant describing how to begin a comment in the target
- assembler language. */
-/* define ASM_COMMENT_START */
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-#define ASM_APP_OFF ""
-
-/* OUTPUT OF DATA */
-
-/* This is how to output an assembler line defining a `double' constant. */
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) asm_output_float (FILE,VALUE)
-
-/* This is how to output an assembler line defining a `float' constant. */
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) asm_output_float (FILE, VALUE)
-
-/* This is how to output and assembler line defininf a 'float' constant of
- size HFmode. */
-#define ASM_OUTPUT_SHORT_FLOAT(FILE,VALUE) asm_output_float (FILE, VALUE)
-
-/* This is how to output an assembler line defining an `char' constant. */
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\tint "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line defining an `short' constant. */
-#define ASM_OUTPUT_SHORT(FILE,EXP) asm_output_long(FILE,INTVAL(EXP))
-
-/* This is how to output an assembler line defining a 'int' constant. */
-#define ASM_OUTPUT_INT(FILE, EXP) asm_output_long(FILE,INTVAL(EXP))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf ((FILE), "\tint %ld\n", (long)(VALUE))
-
-
-/* This is how we output a 'c' character string. For the 16xx
- assembler we have to do it one letter at a time */
-
-#define ASCII_LENGTH 10
-
-#define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
- do { \
- FILE *_hide_asm_out_file = (MYFILE); \
- unsigned char *_hide_p = (unsigned char *) (MYSTRING); \
- int _hide_thissize = (MYLENGTH); \
- { \
- FILE *asm_out_file = _hide_asm_out_file; \
- unsigned char *p = _hide_p; \
- int thissize = _hide_thissize; \
- int i; \
- \
- for (i = 0; i < thissize; i++) \
- { \
- register int c = p[i]; \
- \
- if (i % ASCII_LENGTH == 0) \
- fprintf (asm_out_file, "\tint "); \
- \
- if (c >= ' ' && c < 0177 && c != '\'') \
- { \
- putc ('\'', asm_out_file); \
- putc (c, asm_out_file); \
- putc ('\'', asm_out_file); \
- } \
- else \
- { \
- fprintf (asm_out_file, "%d", c); \
- /* After an octal-escape, if a digit follows, \
- terminate one string constant and start another. \
- The Vax assembler fails to stop reading the escape \
- after three digits, so this is the only way we \
- can get it to parse the data properly. \
- if (i < thissize - 1 \
- && p[i + 1] >= '0' && p[i + 1] <= '9') \
- fprintf (asm_out_file, "\'\n\tint \'"); \
- */ \
- } \
- /* if: \
- we are not at the last char (i != thissize -1) \
- and (we are not at a line break multiple \
- but i == 0) (it will be the very first time) \
- then put out a comma to extend. \
- */ \
- if ((i != thissize - 1) && ((i + 1) % ASCII_LENGTH)) \
- fprintf(asm_out_file, ","); \
- if (!((i + 1) % ASCII_LENGTH)) \
- fprintf (asm_out_file, "\n"); \
- } \
- fprintf (asm_out_file, "\n"); \
- } \
- } \
- while (0)
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable or function
- named NAME. LABELNO is an integer which is different for
- each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
- do { \
- int len = strlen (NAME); \
- char *temp = (char *) alloca (len + 3); \
- temp[0] = 'L'; \
- strcpy (&temp[1], (NAME)); \
- temp[len + 1] = '_'; \
- temp[len + 2] = 0; \
- (OUTPUT) = (char *) alloca (strlen (NAME) + 11); \
- ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO); \
- } while (0)
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-
-/* OUTPUT OF UNINITIALIZED VARIABLES */
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
- asm_output_common (FILE, NAME, SIZE, ROUNDED);
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- asm_output_local (FILE, NAME, SIZE, ROUNDED);
-
-/* OUTPUT AND GENERATION OF LABELS */
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* A C statement to output to the stdio stream any text necessary
- for declaring the name of an external symbol named name which
- is referenced in this compilation but not defined. */
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
-{ \
- fprintf (FILE, ".extern "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
-}
-/* A C statement to output on stream an assembler pseudo-op to
- declare a library function named external. */
-
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
-{ \
- fprintf (FILE, ".extern "); \
- assemble_name (FILE, XSTR (FUN, 0)); \
- fprintf (FILE, "\n"); \
-}
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-
-/* OUTPUT OF ASSEMBLER INSTRUCTIONS */
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"a0", "a0l", "a1", "a1l", "x", "y", "yl", "p", "pl", \
- "r0", "r1", "r2", "r3", "j", "k", "ybase", "pt", \
- "ar0", "ar1", "ar2", "ar3", \
- "c0", "c1", "c2", "pr", "rb", \
- "*(0)", "*(1)", "*(2)", "*(3)", "*(4)", "*(5)", \
- "*(6)", "*(7)", "*(8)", "*(9)", "*(10)", "*(11)", \
- "*(12)", "*(13)", "*(14)", "*(15)", "*(16)", "*(17)", \
- "*(18)", "*(19)", "*(20)", "*(21)", "*(22)", "*(23)", \
- "*(24)", "*(25)", "*(26)", "*(27)", "*(28)", "*(29)", \
- "*(30)", "*(31)" }
-
-#define HIMODE_REGISTER_NAMES \
-{"a0", "a0", "a1", "a1", "x", "y", "y", "p", "p", \
- "r0", "r1", "r2", "r3", "j", "k", "ybase", "pt", \
- "ar0", "ar1", "ar2", "ar3", \
- "c0", "c1", "c2", "pr", "rb", \
- "*(0)", "*(1)", "*(2)", "*(3)", "*(4)", "*(5)", \
- "*(6)", "*(7)", "*(8)", "*(9)", "*(10)", "*(11)", \
- "*(12)", "*(13)", "*(14)", "*(15)", "*(16)", "*(17)", \
- "*(18)", "*(19)", "*(20)", "*(21)", "*(22)", "*(23)", \
- "*(24)", "*(25)", "*(26)", "*(27)", "*(28)", "*(29)", \
- "*(30)", "*(31)" }
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) 0
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
-
- DSP1610 extensions for operand codes:
-
- %H - print lower 16 bits of constant
- %U - print upper 16 bits of constant
- %w - print low half of register (e.g 'a0l')
- %u - print upper half of register (e.g 'a0')
- %b - print high half of accumulator for F3 ALU instructions
- %h - print constant in decimal */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE, X, CODE)
-
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code since it is used only for profiling */
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) fatal("Profiling not implemented yet.");
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code since it is used only for profiling */
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) fatal("Profiling not implemented yet.");
-
-/* OUTPUT OF DISPATCH TABLES */
-
-/* This macro should be provided on machines where the addresses in a dispatch
- table are relative to the table's own address. */
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\tint L%d-L%d\n", VALUE, REL)
-
-/* This macro should be provided on machines where the addresses in a dispatch
- table are absolute. */
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\tint L%d\n", VALUE)
-
-/* ASSEMBLER COMMANDS FOR ALIGNMENT */
-
-/* This is how to output an assembler line that says to advance
- the location counter to a multiple of 2**LOG bytes. We should
- not have to do any alignment since the 1610 is a word machine. */
-#define ASM_OUTPUT_ALIGN(FILE,LOG)
-
-/* Define this macro if ASM_OUTPUT_SKIP should not be used in the text section
- because it fails to put zero1 in the bytes that are skipped. */
-#define ASM_NO_SKIP_IN_TEXT 1
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t%d * int 0\n", (SIZE))
-
-/* CONTROLLING DEBUGGING INFORMATION FORMAT */
-
-/* Define this macro if GCC should produce COFF-style debugging output
- for SDB in response to the '-g' option */
-#define SDB_DEBUGGING_INFO
-
-/* Support generating stabs for the listing file generator */
-#define DBX_DEBUGGING_INFO
-
-/* The default format when -g is given is still COFF debug info */
-#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* MISCELLANEOUS PARAMETERS */
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE QImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 1
-
-/* Defining this macro causes the compiler to omit a sign-extend, zero-extend,
- or bitwise 'and' instruction that truncates the count of a shift operation
- to a width equal to the number of bits needed to represent the size of the
- object being shifted. Do not define this macro unless the truncation applies
- to both shift operations and bit-field operations (if any). */
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
-
-/* An alias for the machine mode used for pointers */
-#define Pmode QImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-#if !defined(__DATE__)
-#define TARGET_VERSION fprintf (stderr, " (%s)", VERSION_INFO1)
-#else
-#define TARGET_VERSION fprintf (stderr, " (%s, %s)", VERSION_INFO1, __DATE__)
-#endif
-
-#define VERSION_INFO1 "AT&T DSP16xx C Cross Compiler, version 1.2.0"
-
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* If this macro is defined, GNU CC gathers statistics about the number and
- kind of tree node it allocates during each run. The option '-fstats' will
- tell the compiler to print these statistics about the sizes of it obstacks. */
-#define GATHER_STATISTICS
-
-/* Define this so gcc does not output a call to __main, since we
- are not currently supporting c++. */
-#define INIT_SECTION_ASM_OP 1
diff --git a/gcc/config/dsp16xx/dsp16xx.md b/gcc/config/dsp16xx/dsp16xx.md
deleted file mode 100644
index 4e8f31dfe6a..00000000000
--- a/gcc/config/dsp16xx/dsp16xx.md
+++ /dev/null
@@ -1,2181 +0,0 @@
-;;- Machine description for the AT&T DSP1600 for GNU C compiler
-;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
-;; Contributed by Michael Collison (collison@world.std.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.
-
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; Attribute specifications
-
-; Type of each instruction. Default is arithmetic.
-; I'd like to write the list as this, but genattrtab won't accept it.
-;
-; "jump,cond_jump,call, ; flow-control instructions
-; load_i,load, store, move ; Y space address arithmetic instructions
-; malu,special,f3_alu,f3_alu_i ; data arithmetic unit instructions
-; shift_i,shift, bfield_i, bfield ; bit manipulation unit instructions
-; arith, ; integer unit instructions
-; nop
-
-; Classification of each insn. Some insns of TYPE_BRANCH are multi-word.
-(define_attr "type"
- "jump,cond_jump,call,load_i,load,move,store,malu,malu_mul,special,f3_alu,f3_alu_i,shift_i,shift,bfield_i,bfield,nop,ld_short_i"
- (const_string "malu"))
-
-; Length in # of instructions of each insn. The values are not exact, but
-; are safe.
-(define_attr "length" ""
- (cond [(eq_attr "type" "cond_jump,f3_alu_i,shift_i,bfield_i,load_i")
- (const_int 2)]
- (const_int 1)))
-
-
-;; ....................
-;;
-;; Test against 0 instructions
-;;
-;; ....................
-
-(define_expand "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "register_operand" ""))]
- ""
- "
-{
- dsp16xx_compare_gen = gen_tst_reg;
- dsp16xx_compare_op0 = operands[0];
- dsp16xx_compare_op1 = const0_rtx;
- DONE;
-}")
-
-(define_insn "tsthi_1"
- [(set (cc0)
- (match_operand:HI 0 "register_operand" "A"))]
- ""
- "%0=%0"
- [(set_attr "type" "malu")])
-
-(define_expand "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "register_operand" ""))]
- ""
- "
-{
- dsp16xx_compare_gen = gen_tst_reg;
- dsp16xx_compare_op0 = operands[0];
- dsp16xx_compare_op1 = const0_rtx;
- DONE;
-}")
-
-(define_insn "tstqi_1"
- [(set (cc0)
- (match_operand:QI 0 "register_operand" "j,q"))
- (clobber (match_scratch:QI 1 "=k,u"))]
- ""
- "@
- %1=0\;%b0-0
- %1=0\;%b0-0"
- [(set_attr "type" "malu,malu")])
-
-
-;;
-;; ....................
-;;
-;; Bit test instructions
-;;
-;; ....................
-
-(define_insn ""
- [(set (cc0)
- (and:HI (match_operand:HI 0 "register_operand" "A,!A,A")
- (match_operand:HI 1 "nonmemory_operand" "Z,A,I")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- return \"%0&%1\";
-
- case 2:
- return \"%0&%H1\";
- }
-}"
- [(set_attr "type" "f3_alu,malu,f3_alu_i")])
-
-
-;;(define_insn ""
-;; [(set (cc0)
-;; (and:QI (match_operand:QI 0 "register_operand" "h")
-;; (match_operand:QI 1 "const_int_operand" "I")))]
-;; ""
-;; "%b0&%H1"
-;; [(set_attr "type" "f3_alu_i")])
-
-;;
-;;
-;; Compare Instructions
-;;
-
-(define_expand "cmphi"
- [(parallel [(set (cc0)
- (compare (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" "")))
- (clobber (match_scratch:QI 2 ""))
- (clobber (match_scratch:QI 3 ""))
- (clobber (match_scratch:QI 4 ""))
- (clobber (match_scratch:QI 5 ""))])]
- ""
- "
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- operands[1] = force_reg (HImode, operands[1]);
-
- if (operands[0]) /* Avoid unused code warning */
- {
- dsp16xx_compare_gen = gen_compare_reg;
- dsp16xx_compare_op0 = operands[0];
- dsp16xx_compare_op1 = operands[1];
- DONE;
- }
-
-}")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:HI 0 "general_operand" "Z*r*m*i")
- (match_operand:HI 1 "general_operand" "Z*r*m*i")))
- (clobber (match_scratch:QI 2 "=&A"))
- (clobber (match_scratch:QI 3 "=&A"))
- (clobber (match_scratch:QI 4 "=&A"))
- (clobber (match_scratch:QI 5 "=&A"))]
- "(save_next_cc_user_code = next_cc_user_code (insn)) == GTU \
- || save_next_cc_user_code == GEU \
- || save_next_cc_user_code == LTU \
- || save_next_cc_user_code == LEU"
- "*
-{
- if (GET_CODE(operands[0]) == REG)
- {
- if (REGNO (operands[0]) == REG_Y ||
- REGNO (operands[0]) == REG_PROD)
- {
- output_asm_insn (\"a0=%0\", operands);
- }
- else if (IS_YBASE_REGISTER_WINDOW (REGNO(operands[0])))
- {
- output_asm_insn (\"a0=%u0\;a0l=%w0\", operands);
- }
- else
- fatal (\"Invalid register for compare\");
- }
- else if (GET_CODE(operands[0]) == CONST_INT)
- {
- output_asm_insn (\"a0=%U0\;a0l=%H0\", operands);
- }
- else if (GET_CODE (operands[0]) == MEM)
- {
- rtx xoperands[2];
-
- xoperands[0] = gen_rtx (REG, HImode, REG_A0);
- xoperands[1] = operands[0];
- double_reg_from_memory (xoperands);
- }
-
- if (GET_CODE(operands[1]) == REG)
- {
- if (REGNO (operands[1]) == REG_Y ||
- REGNO (operands[1]) == REG_PROD)
- {
- output_asm_insn (\"a1=%1\", operands);
- }
- else if (IS_YBASE_REGISTER_WINDOW (REGNO(operands[1])))
- {
- output_asm_insn (\"a1=%u1\;a1l=%w1\", operands);
- }
- else
- fatal (\"Invalid register for compare\");
- }
- else if (GET_CODE (operands[1]) == MEM)
- {
- rtx xoperands[2];
-
- xoperands[0] = gen_rtx (REG, HImode, REG_A1);
- xoperands[1] = operands[1];
- double_reg_from_memory (xoperands);
- }
- else if (GET_CODE(operands[1]) == CONST_INT)
- {
- output_asm_insn (\"a1=%U1\;a1l=%H1\", operands);
- }
-
- return \"psw = 0\;a0 - a1\";
-}")
-
-(define_insn ""
- [(set (cc0) (compare (match_operand:HI 0 "register_operand" "A,!A")
- (match_operand:HI 1 "register_operand" "Z,*A")))]
- ""
- "@
- %0-%1
- %0-%1"
- [(set_attr "type" "malu,f3_alu")])
-
-(define_expand "cmpqi"
- [(parallel [(set (cc0)
- (compare (match_operand:QI 0 "register_operand" "")
- (match_operand:QI 1 "nonmemory_operand" "")))
- (clobber (match_operand:QI 2 "register_operand" ""))
- (clobber (match_operand:QI 3 "register_operand" ""))])]
- ""
- "
- {
- if (operands[0]) /* Avoid unused code warning */
- {
- dsp16xx_compare_gen = gen_compare_reg;
- dsp16xx_compare_op0 = operands[0];
- dsp16xx_compare_op1 = operands[1];
- DONE;
- }
- }")
-
-(define_insn ""
- [(set (cc0) (compare (match_operand:QI 0 "register_operand" "k,k,!k,k,u,u,!u,u")
- (match_operand:QI 1 "nonmemory_operand" "w,z,u,i,w,z,k,i")))
- (clobber (match_scratch:QI 2 "=j,j,j,j,q,q,q,q"))
- (clobber (match_scratch:QI 3 "=v,y,q,X,v,y,j,X"))]
- "(save_next_cc_user_code = next_cc_user_code (insn)) == GTU \
- || save_next_cc_user_code == GEU \
- || save_next_cc_user_code == LTU \
- || save_next_cc_user_code == LEU"
- "@
- %2=0\;%3=0\;%2-%3
- %2=0\;%3=0\;%2-%3
- %2=0\;%3=0\;%2-%3
- %2=0\;%0-%H1
- %2=0\;%3=0\;%2-%3
- %2=0\;%3=0\;%2-%3
- %2=0\;%3=0\;%2-%3
- %2=0\;%0-%H1")
-
-
-(define_insn ""
- [(set (cc0) (compare (match_operand:QI 0 "register_operand" "j,j,!j,j,q,q,!q,q")
- (match_operand:QI 1 "nonmemory_operand" "v,y,q,i,v,y,j,i")))
- (clobber (match_scratch:QI 2 "=k,k,k,k,u,u,u,u"))
- (clobber (match_scratch:QI 3 "=w,z,u,X,w,z,k,X"))]
- ""
- "@
- %2=0\;%3=0\;%0-%1
- %2=0\;%3=0\;%0-%1
- %2=0\;%3=0\;%0-%1
- %2=0\;%b0-%H1
- %2=0\;%3=0\;%0-%1
- %2=0\;%3=0\;%0-%1
- %2=0\;%3=0\;%0-%1
- %2=0\;%b0-%H1")
-
-
-(define_expand "cmphf"
- [(set (cc0)
- (compare (match_operand:HF 0 "register_operand" "")
- (match_operand:HF 1 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_cmphf3_libcall)
- dsp16xx_cmphf3_libcall = gen_rtx (SYMBOL_REF, Pmode, CMPHF3_LIBCALL);
-
- dsp16xx_compare_gen = gen_compare_reg;
- dsp16xx_compare_op0 = operands[0];
- dsp16xx_compare_op1 = operands[1];
- emit_library_call (dsp16xx_cmphf3_libcall, 1, HImode, 2,
- operands[0], HFmode,
- operands[1], HFmode);
- emit_insn (gen_tsthi_1 (copy_to_reg(hard_libcall_value (HImode))));
- DONE;
-}")
-
-
-;; ....................
-;;
-;; Add instructions
-;;
-;; ....................
-
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "register_operand" "=A,A,A")
- (plus:HI (match_operand:HI 1 "register_operand" "%A,A,A")
- (match_operand:HI 2 "nonmemory_operand" "Z,d,i")))]
- ""
- "@
- %0=%1+%2
- %0=%1+%2
- %0=%w1+%H2\;%0=%b0+%U2"
- [(set_attr "type" "malu,malu,f3_alu_i")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=k,u,!k,!u")
- (plus:QI (plus:QI (match_operand:QI 1 "register_operand" "uk,uk,uk,uk")
- (match_operand:QI 2 "register_operand" "wz,wz,uk,uk"))
- (match_operand:QI 3 "immediate_operand" "i,i,i,i")))
- (clobber (match_scratch:QI 4 "=j,q,j,q"))]
- ""
- "@
- %m0=%m1+%m2\;%m0=%0+%H3
- %m0=%m1+%m2\;%m0=%0+%H3
- %m0=%m1+%m2\;%m0=%0+%H3
- %m0=%m1+%m2\;%m0=%0+%H3")
-
-(define_expand "addqi3"
- [(parallel [(set (match_operand:QI 0 "register_operand" "")
- (plus:QI (match_operand:QI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))
- (clobber (match_scratch:QI 3 ""))])]
- ""
- "
-{
- if (reload_in_progress)
- {
- if (REG_P (operands[1]) &&
- (REGNO(operands[1]) == STACK_POINTER_REGNUM ||
- REGNO(operands[1]) == FRAME_POINTER_REGNUM) &&
- GET_CODE (operands[2]) == CONST_INT)
- {
- if (REG_P (operands[0]) && IS_ACCUM_REG(REGNO(operands[0])))
- emit_move_insn (operands[0], operands[1]);
-
- operands[1] = operands[0];
- }
- }
-}")
-
-
-(define_insn "match_addqi3"
- [(set (match_operand:QI 0 "register_operand" "=!a,!a,k,u,!k,!u,h,!a")
- (plus:QI (match_operand:QI 1 "register_operand" "0,0,uk,uk,uk,uk,h,0")
- (match_operand:QI 2 "nonmemory_operand" "W,N,wzi,wzi,uk,uk,i,n")))
- (clobber (match_scratch:QI 3 "=X,X,j,q,j,q,X,W"))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0:
- return \"*%0++%2\";
-
- case 1:
- switch (INTVAL (operands[2]))
- {
- case -1:
- return \"*%0--\";
-
- case 1:
- return \"*%0++\";
-
- case -2:
- return \"*%0--\;*%0--\";
-
- case 2:
- return \"*%0++\;*%0++\";
- }
-
- case 2:
- case 3:
- if (!CONSTANT_P(operands[2]))
- return \"%m0=%m1+%m2\";
- else
- return \"%m0=%1+%H2\";
-
- case 4:
- case 5:
- return \"%m0=%m1+%m2\";
-
- case 6:
- return \"%0=%b1+%H2\";
-
- case 7:
- return \"%3=%2\;*%0++%3\";
- }
-}")
-
-(define_expand "addhf3"
- [(set (match_operand:HF 0 "register_operand" "")
- (plus:HF (match_operand:HF 1 "register_operand" "")
- (match_operand:HF 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_addhf3_libcall)
- dsp16xx_addhf3_libcall = gen_rtx (SYMBOL_REF, Pmode, ADDHF3_LIBCALL);
-
- emit_library_call (dsp16xx_addhf3_libcall, 1, HFmode, 2,
- operands[1], HFmode,
- operands[2], HFmode);
- emit_move_insn (operands[0], hard_libcall_value(HFmode));
- DONE;
-}")
-
-
-;;
-;; ....................
-;;
-;; Subtract instructions
-;;
-;; ....................
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "register_operand" "=A,A,A")
- (minus:HI (match_operand:HI 1 "register_operand" "A,A,A")
- (match_operand:HI 2 "nonmemory_operand" "Z,d,i")))]
- ""
- "@
- %0=%1-%2
- %0=%1-%2
- %0=%w1-%H2\;%0=%b0-%U2"
- [(set_attr "type" "malu,malu,f3_alu_i")])
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "register_operand" "=?*a,k,u,!k,!u")
- (minus:QI (match_operand:QI 1 "register_operand" "0,uk,uk,uk,uk")
- (match_operand:QI 2 "nonmemory_operand" "n,wzi,wzi,uk,uk")))
- (clobber (match_scratch:QI 3 "=W,j,q,j,q"))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0:
- switch (INTVAL (operands[2]))
- {
- case 0:
- return \"\";
-
- case 1:
- return \"*%0--\";
-
- case -1:
- return \"*%0++\";
-
- default:
- operands[2] = GEN_INT (-INTVAL (operands[2]));
-
- if (SHORT_IMMEDIATE(operands[2]))
- return \"set %3=%H2\;*%0++%3\";
- else
- return \"%3=%H2\;*%0++%3\";
- }
-
- case 1:
- case 2:
- if (!CONSTANT_P(operands[2]))
- return \"%m0=%m1-%m2\";
- else
- return \"%m0=%1-%H2\";
-
- case 3:
- case 4:
- return \"%m0=%m1-%m2\";
- }
-}")
-
-(define_expand "subhf3"
- [(set (match_operand:HF 0 "register_operand" "")
- (minus:HF (match_operand:HF 1 "register_operand" "")
- (match_operand:HF 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_subhf3_libcall)
- dsp16xx_subhf3_libcall = gen_rtx (SYMBOL_REF, Pmode, SUBHF3_LIBCALL);
-
- emit_library_call (dsp16xx_subhf3_libcall, 1, HFmode, 2,
- operands[1], HFmode,
- operands[2], HFmode);
- emit_move_insn (operands[0], hard_libcall_value(HFmode));
- DONE;
-}")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "register_operand" "=A")
- (neg:HI (match_operand:HI 1 "register_operand" "A")))]
- ""
- "%0=-%1"
- [(set_attr "type" "special")])
-
-(define_expand "neghf2"
- [(set (match_operand:HF 0 "general_operand" "")
- (neg:HF (match_operand:HF 1 "general_operand" "")))]
- ""
-"
-{
- if (!dsp16xx_neghf2_libcall)
- dsp16xx_neghf2_libcall = gen_rtx (SYMBOL_REF, Pmode, NEGHF2_LIBCALL);
-
- emit_library_call (dsp16xx_neghf2_libcall, 1, HFmode, 1,
- operands[1], HFmode);
- emit_move_insn (operands[0], hard_libcall_value(HFmode));
- DONE;
-}")
-
-
-
-;;
-;; ....................
-;;
-;; Multiply instructions
-;;
-
-(define_expand "mulhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (mult:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:HI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_mulhi3_libcall)
- dsp16xx_mulhi3_libcall = gen_rtx (SYMBOL_REF, Pmode, MULHI3_LIBCALL);
-
- emit_library_call (dsp16xx_mulhi3_libcall, 1, HImode, 2,
- operands[1], HImode,
- operands[2], HImode);
- emit_move_insn (operands[0], hard_libcall_value(HImode));
- DONE;
-}")
-
-(define_insn "mulqi3"
- [(set (match_operand:QI 0 "register_operand" "=w")
- (mult:QI (match_operand:QI 1 "register_operand" "%x")
- (match_operand:QI 2 "register_operand" "y")))
- (clobber (match_scratch:QI 3 "=v"))]
- ""
- "%m0=%1*%2"
- [(set_attr "type" "malu_mul")])
-
-(define_insn "mulqihi3"
- [(set (match_operand:HI 0 "register_operand" "=t")
- (mult:HI (sign_extend:HI (match_operand:QI 1 "register_operand" "%x"))
- (sign_extend:HI (match_operand:QI 2 "register_operand" "y"))))]
- ""
- "%0=%1*%2"
- [(set_attr "type" "malu_mul")])
-
-(define_insn "umulqihi3"
- [(set (match_operand:HI 0 "register_operand" "=t")
- (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%x"))
- (zero_extend:HI (match_operand:QI 2 "register_operand" "y"))))]
- ""
- "%0=%1*%2"
- [(set_attr "type" "malu_mul")])
-
-(define_expand "mulhf3"
- [(set (match_operand:HF 0 "register_operand" "")
- (mult:HF (match_operand:HF 1 "register_operand" "")
- (match_operand:HF 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_mulhf3_libcall)
- dsp16xx_mulhf3_libcall = gen_rtx (SYMBOL_REF, Pmode, MULHF3_LIBCALL);
-
- emit_library_call (dsp16xx_mulhf3_libcall, 1, HFmode, 2,
- operands[1], HFmode,
- operands[2], HFmode);
- emit_move_insn (operands[0], hard_libcall_value(HFmode));
- DONE;
-}")
-
-
-
-;;
-;; *******************
-;;
-;; Divide Instructions
-;;
-
-(define_expand "divhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (div:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:HI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_divhi3_libcall)
- dsp16xx_divhi3_libcall = gen_rtx (SYMBOL_REF, Pmode, DIVHI3_LIBCALL);
-
- emit_library_call (dsp16xx_divhi3_libcall, 1, HImode, 2,
- operands[1], HImode,
- operands[2], HImode);
- emit_move_insn (operands[0], hard_libcall_value(HImode));
- DONE;
-}")
-
-(define_expand "udivhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (udiv:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:HI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_udivhi3_libcall)
- dsp16xx_udivhi3_libcall = gen_rtx (SYMBOL_REF, Pmode, UDIVHI3_LIBCALL);
-
- emit_library_call (dsp16xx_udivhi3_libcall, 1, HImode, 2,
- operands[1], HImode,
- operands[2], HImode);
- emit_move_insn (operands[0], hard_libcall_value(HImode));
- DONE;
-}")
-
-(define_expand "divqi3"
- [(set (match_operand:QI 0 "register_operand" "")
- (div:QI (match_operand:QI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_divqi3_libcall)
- dsp16xx_divqi3_libcall = gen_rtx (SYMBOL_REF, Pmode, DIVQI3_LIBCALL);
-
- emit_library_call (dsp16xx_divqi3_libcall, 1, QImode, 2,
- operands[1], QImode,
- operands[2], QImode);
- emit_move_insn (operands[0], hard_libcall_value(QImode));
- DONE;
-}")
-
-(define_expand "udivqi3"
- [(set (match_operand:QI 0 "register_operand" "")
- (udiv:QI (match_operand:QI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_udivqi3_libcall)
- dsp16xx_udivqi3_libcall = gen_rtx (SYMBOL_REF, Pmode, UDIVQI3_LIBCALL);
-
- emit_library_call (dsp16xx_udivqi3_libcall, 1, QImode, 2,
- operands[1], QImode,
- operands[2], QImode);
- emit_move_insn (operands[0], hard_libcall_value(QImode));
- DONE;
-}")
-
-;;
-;; ....................
-;;
-;; Modulo instructions
-;;
-;; ....................
-
-(define_expand "modhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (mod:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:HI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_modhi3_libcall)
- dsp16xx_modhi3_libcall = gen_rtx (SYMBOL_REF, Pmode, MODHI3_LIBCALL);
-
- emit_library_call (dsp16xx_modhi3_libcall, 1, HImode, 2,
- operands[1], HImode,
- operands[2], HImode);
- emit_move_insn (operands[0], hard_libcall_value(HImode));
- DONE;
-}")
-
-(define_expand "umodhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (umod:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:HI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_umodhi3_libcall)
- dsp16xx_umodhi3_libcall = gen_rtx (SYMBOL_REF, Pmode, UMODHI3_LIBCALL);
-
- emit_library_call (dsp16xx_umodhi3_libcall, 1, HImode, 2,
- operands[1], HImode,
- operands[2], HImode);
- emit_move_insn (operands[0], hard_libcall_value(HImode));
- DONE;
-}")
-
-(define_expand "modqi3"
- [(set (match_operand:QI 0 "register_operand" "")
- (mod:QI (match_operand:QI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_modqi3_libcall)
- dsp16xx_modqi3_libcall = gen_rtx (SYMBOL_REF, Pmode, MODQI3_LIBCALL);
-
- emit_library_call (dsp16xx_modqi3_libcall, 1, QImode, 2,
- operands[1], QImode,
- operands[2], QImode);
- emit_move_insn (operands[0], hard_libcall_value(QImode));
- DONE;
-}")
-
-(define_expand "umodqi3"
- [(set (match_operand:QI 0 "register_operand" "")
- (umod:QI (match_operand:QI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_umodqi3_libcall)
- dsp16xx_umodqi3_libcall = gen_rtx (SYMBOL_REF, Pmode, UMODQI3_LIBCALL);
-
- emit_library_call (dsp16xx_umodqi3_libcall, 1, QImode, 2,
- operands[1], QImode,
- operands[2], QImode);
- emit_move_insn (operands[0], hard_libcall_value(QImode));
- DONE;
-}")
-
-(define_expand "divhf3"
- [(set (match_operand:HF 0 "register_operand" "")
- (div:HF (match_operand:HF 1 "register_operand" "")
- (match_operand:HF 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_divhf3_libcall)
- dsp16xx_divhf3_libcall = gen_rtx (SYMBOL_REF, Pmode, DIVHF3_LIBCALL);
-
- emit_library_call (dsp16xx_divhf3_libcall, 1, HFmode, 2,
- operands[1], HFmode,
- operands[2], HFmode);
- emit_move_insn (operands[0], hard_libcall_value(HFmode));
- DONE;
-}")
-
-
-
-;;
-;; ********************
-;;
-;; Logical Instructions
-;;
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "register_operand" "=A,A,?A")
- (and:HI (match_operand:HI 1 "register_operand" "%A,!A,A")
- (match_operand:HI 2 "nonmemory_operand" "Z,A,i")))]
- ""
- "@
- %0=%1&%2
- %0=%1&%2
- %0=%w1&%H2\;%0=%b0&%U2"
- [(set_attr "type" "f3_alu,f3_alu,f3_alu_i")])
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "register_operand" "=k,u,uk,!k,!u,j,q,jq,!j,!q")
- (and:QI (match_operand:QI 1 "register_operand" "uk,uk,uk,uk,uk,jq,jq,jq,jq,jq")
- (match_operand:QI 2 "nonmemory_operand" "wz,wz,i,uk,uk,yv,yv,i,jq,jq")))
- (clobber (match_scratch:QI 3 "=j,q,X,j,q,k,u,X,k,u"))]
- ""
- "@
- %m0=%m1&%m2
- %m0=%m1&%m2
- %m0=%1&%H2
- %m0=%m1&%m2
- %m0=%m1&%m2
- %m0=%m1&%m2
- %m0=%m1&%m2
- %m0=%b1&%H2
- %m0=%m1&%m2
- %m0=%m1&%m2")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "register_operand" "=A,A,A,?A")
- (ior:HI (match_operand:HI 1 "register_operand" "%A,!A,A,A")
- (match_operand:HI 2 "nonmemory_operand" "Z,A,I,i")))]
- ""
- "@
- %0=%u1|%u2
- %0=%u1|%u2
- %0=%w1|%H2
- %0=%w1|%H2\;%0=%b0|%U2"
- [(set_attr "type" "f3_alu,f3_alu,f3_alu_i,f3_alu_i")])
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "register_operand" "=k,u,uk,!k,!u,j,q,jq,!j,!q")
- (ior:QI (match_operand:QI 1 "register_operand" "uk,uk,uk,uk,uk,jq,jq,jq,jq,jq")
- (match_operand:QI 2 "nonmemory_operand" "wz,wz,i,uk,uk,yv,yv,i,jq,jq")))
- (clobber (match_scratch:QI 3 "=j,q,X,j,q,k,u,X,k,u"))]
- ""
- "@
- %m0=%m1|%m2
- %m0=%m1|%m2
- %m0=%1|%H2
- %m0=%m1|%m2
- %m0=%m1|%m2
- %m0=%m1|%m2
- %m0=%m1|%m2
- %m0=%b1|%H2
- %m0=%m1|%m2
- %m0=%m1|%m2")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "register_operand" "=A,A,A,?A")
- (xor:HI (match_operand:HI 1 "register_operand" "%A,!A,A,A")
- (match_operand:HI 2 "nonmemory_operand" "Z,A,I,i")))]
- ""
- "@
- %0=%1^%2
- %0=%1^%2
- %0=%w1^%H2
- %0=%w1^%H2\;%0=%b0^%U2"
- [(set_attr "type" "f3_alu,f3_alu,f3_alu_i,f3_alu_i")])
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "register_operand" "=k,u,uk,!k,!u,j,q,jq,!j,!q")
- (xor:QI (match_operand:QI 1 "register_operand" "uk,uk,uk,uk,uk,jq,jq,jq,jq,jq")
- (match_operand:QI 2 "nonmemory_operand" "wz,wz,i,uk,uk,yv,yv,i,jq,jq")))
- (clobber (match_scratch:QI 3 "=j,q,X,j,q,k,u,X,k,u"))]
- ""
- "@
- %m0=%m1^%m2
- %m0=%m1^%m2
- %m0=%1^%H2
- %m0=%m1^%m2
- %m0=%m1^%m2
- %m0=%m1^%m2
- %m0=%m1^%m2
- %m0=%b1^%H2
- %m0=%m1^%m2
- %m0=%m1^%m2")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "register_operand" "=A")
- (not:HI (match_operand:HI 1 "register_operand" "A")))]
- ""
- "%0= ~%1"
- [(set_attr "type" "special")])
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "register_operand" "=ku,jq")
- (not:QI (match_operand:QI 1 "register_operand" "ku,jq")))]
- ""
- "@
- %m0= %1 ^ 0xffff
- %m0= %b1 ^ 0xffff"
- [(set_attr "type" "special")])
-
-
-;;
-;; MOVE INSTRUCTIONS
-;;
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, HImode))
- DONE;
-}")
-
-
-(define_insn "match_movhi1"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=A,Z,A,d,d,m,?d,*Y,t,f")
- (match_operand:HI 1 "general_operand" "d,A,K,i,m,d,*Y,?d,t,f"))]
- "register_operand(operands[0], HImode)
- || register_operand(operands[1], HImode)"
- "*
-{
- switch (which_alternative)
- {
- /* register to accumulator */
- case 0:
- return \"%0=%1\";
- case 1:
- return \"%u0=%u1\;%w0=%w1\";
- case 2:
- return \"%0=%0^%0\";
- case 3:
- return \"%u0=%U1\;%w0=%H1\";
- case 4:
- double_reg_from_memory(operands);
- return \"\";
- case 5:
- double_reg_to_memory(operands);
- return \"\";
- case 6:
- case 7:
- return \"%u0=%u1\;%w0=%w1\";
- case 8:
- case 9:
- return \"\";
- }
-}"
-[(set_attr "type" "move,move,load_i,load_i,load,store,load,store,move,move")])
-
-
-;; NOTE: It is cheaper to do 'y = *r0', than 'r0 = *r0'.
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "nonimmediate_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, QImode))
- DONE;
-}")
-
-;; The movqi pattern with the parallel is used for addqi insns (which have a parallel)
-;; that are turned into moveqi insns by the flow phase. This happens when a auto-increment
-;; is detected.
-
-(define_insn "match_movqi1"
- [(parallel [(set (match_operand:QI 0 "nonimmediate_operand" "=A,r,aW,c,?D,m<>,e,Y,r,xyz,m<>")
- (match_operand:QI 1 "general_operand" "r,A,J,i,m<>,D,Y,e,0,m<>,xyz"))
- (clobber (match_scratch:QI 2 "=X,X,X,X,X,X,X,X,X,X,X"))])]
- "register_operand(operands[0], QImode)
- || register_operand(operands[1], QImode)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- /* We have to use the move mnemonic otherwise the 1610 will
- attempt to transfer all 32-bits of 'y', 'p' or an accumulator
- , which we don't want */
- if (REGNO(operands[1]) == REG_Y || REGNO(operands[1]) == REG_PROD
- || IS_ACCUM_REG(REGNO(operands[1])))
- return \"move %0=%1\";
- else
- return \"%0=%1\";
-
- case 1:
- return \"%0=%1\";
-
- case 2:
- return \"set %0=%H1\";
-
- case 3:
- return \"%0=%H1\";
-
- case 4:
- return \"%0=%1\";
-
- case 5:
- case 6:
- return \"%0=%1\";
-
- case 7:
- return \"%0=%1\";
-
- case 8:
- return \"\";
-
- case 9: case 10:
- return \"%0=%1\";
- }
-}")
-
-(define_insn "match_movqi2"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=A,r,aW,c,?D,m<>,e,Y,r,xyz,m<>")
- (match_operand:QI 1 "general_operand" "r,A,J,i,m<>,D,Y,e,0,m<>,xyz"))]
- "register_operand(operands[0], QImode)
- || register_operand(operands[1], QImode)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- /* We have to use the move mnemonic otherwise the 1610 will
- attempt to transfer all 32-bits of 'y', 'p' or an accumulator
- , which we don't want */
- if (REGNO(operands[1]) == REG_Y || REGNO(operands[1]) == REG_PROD
- || IS_ACCUM_REG(REGNO(operands[1])))
- return \"move %0=%1\";
- else
- return \"%0=%1\";
-
- case 1:
- return \"%0=%1\";
-
- case 2:
- return \"set %0=%H1\";
-
- case 3:
- return \"%0=%H1\";
-
- case 4:
- return \"%0=%1\";
-
- case 5:
- case 6:
- return \"%0=%1\";
-
- case 7:
- return \"%0=%1\";
-
- case 8:
- return \"\";
-
- case 9: case 10:
- return \"%0=%1\";
- }
-}")
-
-(define_expand "reload_inqi"
- [(set (match_operand:QI 0 "register_operand" "=u")
- (match_operand:QI 1 "sp_operand" ""))
- (clobber (match_operand:QI 2 "register_operand" "=&q"))]
- ""
- "
-{
- rtx addr_reg = XEXP (operands[1], 0);
- rtx offset = XEXP (operands[1], 1);
-
- /* First, move the frame or stack pointer to the accumulator */
- emit_move_insn (operands[0], addr_reg);
-
- /* Then generate the add insn */
- emit_insn (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (2,
- gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (PLUS, QImode, operands[0], offset)),
- gen_rtx (CLOBBER, VOIDmode, operands[2]))));
- DONE;
-}")
-
-(define_expand "reload_inhi"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (match_operand:HI 1 "register_operand" "r"))
- (clobber (match_operand:QI 2 "register_operand" "=&h"))]
- ""
- "
-{
- /* Check for an overlap of operand 2 (an accumulator) with
- the msw of operand 0. If we have an overlap we must reverse
- the order of the moves. */
-
- if (REGNO(operands[2]) == REGNO(operands[0]))
- {
- emit_move_insn (operands[2], operand_subword (operands[1], 1, 0, HImode));
- emit_move_insn (operand_subword (operands[0], 1, 0, HImode), operands[2]);
- emit_move_insn (operands[2], operand_subword (operands[1], 0, 0, HImode));
- emit_move_insn (operand_subword (operands[0], 0, 0, HImode), operands[2]);
- }
- else
- {
- emit_move_insn (operands[2], operand_subword (operands[1], 0, 0, HImode));
- emit_move_insn (operand_subword (operands[0], 0, 0, HImode), operands[2]);
- emit_move_insn (operands[2], operand_subword (operands[1], 1, 0, HImode));
- emit_move_insn (operand_subword (operands[0], 1, 0, HImode), operands[2]);
- }
-
- DONE;
-}")
-
-
-(define_expand "reload_outhi"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (match_operand:HI 1 "register_operand" "r"))
- (clobber (match_operand:QI 2 "register_operand" "=&h"))]
- ""
- "
-{
- emit_move_insn (operands[2], operand_subword (operands[1], 0, 0, HImode));
- emit_move_insn (operand_subword (operands[0], 0, 0, HImode), operands[2]);
- emit_move_insn (operands[2], operand_subword (operands[1], 1, 0, HImode));
- emit_move_insn (operand_subword (operands[0], 1, 0, HImode), operands[2]);
- DONE;
-}")
-
-(define_expand "movstrqi"
- [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
- (match_operand:BLK 1 "memory_operand" ""))
- (use (match_operand:QI 2 "const_int_operand" ""))
- (use (match_operand:QI 3 "const_int_operand" ""))
- (clobber (match_scratch:QI 4 ""))
- (clobber (match_dup 5))
- (clobber (match_dup 6))])]
- ""
- "
-{
- rtx addr0, addr1;
-
- if (GET_CODE (operands[2]) != CONST_INT)
- FAIL;
-
- if (INTVAL(operands[2]) > 127)
- FAIL;
-
- addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
- addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
-
- operands[5] = addr0;
- operands[6] = addr1;
-
- operands[0] = gen_rtx (MEM, BLKmode, addr0);
- operands[1] = gen_rtx (MEM, BLKmode, addr1);
-}")
-
-(define_insn ""
- [(set (mem:BLK (match_operand:QI 0 "register_operand" "a"))
- (mem:BLK (match_operand:QI 1 "register_operand" "a")))
- (use (match_operand:QI 2 "const_int_operand" "n"))
- (use (match_operand:QI 3 "immediate_operand" "i"))
- (clobber (match_scratch:QI 4 "=x"))
- (clobber (match_dup 0))
- (clobber (match_dup 1))]
- ""
- "*
-{ return output_block_move (operands); }")
-
-
-;; Floating point move insns
-
-
-(define_expand "movhf"
- [(set (match_operand:HF 0 "general_operand" "")
- (match_operand:HF 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, HFmode))
- DONE;
-}")
-
-(define_insn "match_movhf"
- [(set (match_operand:HF 0 "nonimmediate_operand" "=A,Z,d,d,m,d,Y")
- (match_operand:HF 1 "general_operand" "d,A,F,m,d,Y,d"))]
- ""
- "*
-{
- /* NOTE: When loading the register 16 bits at a time we
- MUST load the high half FIRST (because the 1610 zeros
- the low half) and then load the low half */
-
- switch (which_alternative)
- {
- /* register to accumulator */
- case 0:
- return \"%0=%1\";
- case 1:
- return \"%u0=%u1\;%w0=%w1\";
- case 2:
- output_dsp16xx_float_const(operands);
- return \"\";
- case 3:
- double_reg_from_memory(operands);
- return \"\";
- case 4:
- double_reg_to_memory(operands);
- return \"\";
- case 5:
- case 6:
- return \"%u0=%u1\;%w0=%w1\";
- }
-}"
-[(set_attr "type" "move,move,load_i,load,store,load,store")])
-
-
-
-(define_expand "reload_inhf"
- [(set (match_operand:HF 0 "register_operand" "=r")
- (match_operand:HF 1 "register_operand" "r"))
- (clobber (match_operand:QI 2 "register_operand" "=&h"))]
- ""
- "
-{
- /* Check for an overlap of operand 2 (an accumulator) with
- the msw of operand 0. If we have an overlap we must reverse
- the order of the moves. */
-
- if (REGNO(operands[2]) == REGNO(operands[0]))
- {
- emit_move_insn (operands[2], operand_subword (operands[1], 1, 0, HFmode));
- emit_move_insn (operand_subword (operands[0], 1, 0, HFmode), operands[2]);
- emit_move_insn (operands[2], operand_subword (operands[1], 0, 0, HFmode));
- emit_move_insn (operand_subword (operands[0], 0, 0, HFmode), operands[2]);
- }
- else
- {
- emit_move_insn (operands[2], operand_subword (operands[1], 0, 0, HFmode));
- emit_move_insn (operand_subword (operands[0], 0, 0, HFmode), operands[2]);
- emit_move_insn (operands[2], operand_subword (operands[1], 1, 0, HFmode));
- emit_move_insn (operand_subword (operands[0], 1, 0, HFmode), operands[2]);
- }
-
- DONE;
-}")
-
-(define_expand "reload_outhf"
- [(set (match_operand:HF 0 "register_operand" "=r")
- (match_operand:HF 1 "register_operand" "r"))
- (clobber (match_operand:QI 2 "register_operand" "=&h"))]
- ""
- "
-{
- emit_move_insn (operands[2], operand_subword (operands[1], 0, 0, HFmode));
- emit_move_insn (operand_subword (operands[0], 0, 0, HFmode), operands[2]);
- emit_move_insn (operands[2], operand_subword (operands[1], 1, 0, HFmode));
- emit_move_insn (operand_subword (operands[0], 1, 0, HFmode), operands[2]);
- DONE;
-}")
-
-
-;;
-;; CONVERSION INSTRUCTIONS
-;;
-
-(define_expand "extendqihi2"
- [(clobber (match_dup 2))
- (set (match_dup 3) (match_operand:QI 1 "register_operand" ""))
- (set (match_operand:HI 0 "register_operand" "")
- (ashift:HI (match_dup 2)
- (const_int 16)))
- (set (match_dup 0)
- (ashiftrt:HI (match_dup 0) (const_int 16)))]
- ""
- "
-{
- operands[2] = gen_reg_rtx (HImode);
- operands[3] = gen_rtx (SUBREG, QImode, operands[2], 1);
-}")
-
-;;(define_insn "extendqihi2"
-;; [(set (match_operand:HI 0 "register_operand" "=A")
-;; (sign_extend:HI (match_operand:QI 1 "register_operand" "h")))]
-;; ""
-;; "%0 = %1 >> 16")
-
-;;(define_insn "zero_extendqihi2"
-;; [(set (match_operand:HI 0 "register_operand" "=t,f,A,?d,?A")
-;; (zero_extend:HI (match_operand:QI 1 "register_operand" "w,z,ku,A,r")))]
-;; ""
-;; "*
-;; {
-;; switch (which_alternative)
-;; {
-;; case 0:
-;; case 1:
-;; return \"%0=0\";
-;;
-;; case 2:
-;; if (REGNO(operands[1]) == (REGNO(operands[0]) + 1))
-;; return \"%0=0\";
-;; else
-;; return \"%w0=%1\;%0=0\";
-;; case 3:
-;; return \"%w0=%1\;%0=0\";
-;;
-;; case 4:
-;; if (REGNO(operands[1]) == REG_Y || REGNO(operands[1]) == REG_PROD
-;; || IS_ACCUM_REG(REGNO(operands[1])))
-;; return \"move %w0=%1\;%0=0\";
-;; else
-;; return \"%w0=%1\;%0=0\";
-;; }
-;; }")
-
-(define_expand "zero_extendqihi2"
- [(clobber (match_dup 2))
- (set (match_dup 3) (match_operand:QI 1 "register_operand" ""))
- (set (match_operand:HI 0 "register_operand" "")
- (ashift:HI (match_dup 2)
- (const_int 16)))
- (set (match_dup 0)
- (lshiftrt:HI (match_dup 0) (const_int 16)))]
- ""
- "
-{
- operands[2] = gen_reg_rtx (HImode);
- operands[3] = gen_rtx (SUBREG, QImode, operands[2], 1);
-}")
-
-
-(define_expand "floathihf2"
- [(set (match_operand:HF 0 "register_operand" "")
- (float:HF (match_operand:HI 1 "register_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_floathihf2_libcall)
- dsp16xx_floathihf2_libcall = gen_rtx (SYMBOL_REF, Pmode, FLOATHIHF2_LIBCALL);
-
- emit_library_call (dsp16xx_floathihf2_libcall, 1, HFmode, 1,
- operands[1], HImode);
- emit_move_insn (operands[0], hard_libcall_value(HFmode));
- DONE;
-}")
-
-(define_expand "fix_trunchfhi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (fix:HI (match_operand:HF 1 "register_operand" "")))]
- ""
- "
-{
- if (!dsp16xx_fixhfhi2_libcall)
- dsp16xx_fixhfhi2_libcall = gen_rtx (SYMBOL_REF, Pmode, FIXHFHI2_LIBCALL);
-
- emit_library_call (dsp16xx_fixhfhi2_libcall, 1, HImode, 1,
- operands[1], HFmode);
- emit_move_insn (operands[0], hard_libcall_value(HImode));
- DONE;
-}")
-
-(define_expand "fixuns_trunchfhi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (unsigned_fix:HI (match_operand:HF 1 "register_operand" "")))]
- ""
- "
-{
- rtx reg1 = gen_reg_rtx (HFmode);
- rtx reg2 = gen_reg_rtx (HFmode);
- rtx reg3 = gen_reg_rtx (HImode);
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
- REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
-
- if (reg1) /* turn off complaints about unreached code */
- {
- emit_move_insn (reg1, immed_real_const_1 (offset, HFmode));
- do_pending_stack_adjust ();
-
- emit_insn (gen_cmphf (operands[1], reg1));
- emit_jump_insn (gen_bge (label1));
-
- emit_insn (gen_fix_trunchfhi2 (operands[0], operands[1]));
- emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
- gen_rtx (LABEL_REF, VOIDmode, label2)));
- emit_barrier ();
-
- emit_label (label1);
- emit_insn (gen_subhf3 (reg2, operands[1], reg1));
- emit_move_insn (reg3, GEN_INT (0x80000000));;
-
- emit_insn (gen_fix_trunchfhi2 (operands[0], reg2));
- emit_insn (gen_iorhi3 (operands[0], operands[0], reg3));
-
- emit_label (label2);
-
- /* allow REG_NOTES to be set on last insn (labels don't have enough
- fields, and can't be used for REG_NOTES anyway). */
- emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
- DONE;
- }
-}")
-
-;;
-;; SHIFT INSTRUCTIONS
-;;
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 1)))]
- ""
- "%0=%1>>1"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 4)))]
- ""
- "%0=%1>>4"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 8)))]
- ""
- "%0=%1>>8"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 16)))]
- ""
- "%0=%1>>16"
- [(set_attr "type" "special")])
-
-;;
-;; Arithmetic Right shift
-
-(define_expand "ashrhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!TARGET_BMU)
- {
- /* If we are shifting by a constant we can do it in 1 or more
- 1600 core shift instructions. The core instructions can
- shift by 1, 4, 8, or 16. */
-
- if (GET_CODE(operands[2]) == CONST_INT)
- ;
- else
- {
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
-
-#if 0
- if (!dsp16xx_ashrhi3_libcall)
- dsp16xx_ashrhi3_libcall = gen_rtx (SYMBOL_REF, Pmode, ASHRHI3_LIBCALL);
-
- emit_library_call (dsp16xx_ashrhi3_libcall, 1, HImode, 2,
- operands[1], HImode,
- operands[2], QImode);
- emit_move_insn (operands[0], hard_libcall_value(HImode));
- DONE;
-#else
- do_pending_stack_adjust ();
- emit_insn (gen_tstqi (operands[2]));
- emit_jump_insn (gen_bne (label1));
- emit_move_insn (operands[0], operands[1]);
- emit_jump_insn (gen_jump (label2));
- emit_barrier ();
- emit_label (label1);
-
- if (GET_CODE(operands[2]) != MEM)
- {
- rtx stack_slot;
-
- stack_slot = assign_stack_temp (QImode, GET_MODE_SIZE(QImode), 0);
- stack_slot = change_address (stack_slot, VOIDmode, XEXP (stack_slot, 0));
- emit_move_insn (stack_slot, operands[2]);
- operands[2] = stack_slot;
- }
-
- emit_insn (gen_match_ashrhi3_nobmu (operands[0], operands[1], operands[2]));
- emit_label (label2);
- DONE;
-#endif
- }
- }
-}")
-
-(define_insn "match_ashrhi3_bmu"
- [(set (match_operand:HI 0 "register_operand" "=A,A,A")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "A,A,!A")
- (match_operand:QI 2 "nonmemory_operand" "B,I,h")))]
- "TARGET_BMU"
- "@
- %0=%1>>%2
- %0=%1>>%H2
- %0=%1>>%2"
- [(set_attr "type" "shift,shift_i,shift")])
-
-(define_insn "match_ashrhi3_nobmu"
- [(set (match_operand:HI 0 "register_operand" "=A,A")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "A,0")
- (match_operand:QI 2 "general_operand" "n,m")))]
- "!TARGET_BMU"
- "*
-{
- if (which_alternative == 0)
- {
- emit_1600_core_shift (ASHIFTRT, operands, INTVAL(operands[2]));
- return \"\";
- }
- else
- {
- output_asm_insn (\"cloop=%2\", operands);
- output_asm_insn (\"do 0 \{\", operands);
- output_asm_insn (\"%0=%0>>1\", operands);
- return \"\}\";
- }
-}")
-
-
-
-;;
-;; Logical Right Shift
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 1)))]
- ""
- "%0=%1>>1\;%0=%b0&0x7fff"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 4)))]
- ""
- "%0=%1>>4\;%0=%b0&0x0fff"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 8)))]
- ""
- "%0=%1>>8\;%0=%b0&0x00ff"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 16)))]
- ""
- "%0=%1>>16\;%0=%b0&0x0000"
- [(set_attr "type" "special")])
-
-(define_expand "lshrhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!TARGET_BMU)
- {
- /* If we are shifting by a constant we can do it in 1 or more
- 1600 core shift instructions. The core instructions can
- shift by 1, 4, 8, or 16. */
-
- if (GET_CODE(operands[2]) == CONST_INT)
- emit_insn (gen_match_lshrhi3_nobmu (operands[0], operands[1], operands[2]));
- else
- {
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
-#if 0
- if (!dsp16xx_lshrhi3_libcall)
- dsp16xx_lshrhi3_libcall = gen_rtx (SYMBOL_REF, Pmode, LSHRHI3_LIBCALL);
-
- emit_library_call (dsp16xx_lshrhi3_libcall, 1, HImode, 2,
- operands[1], HImode,
- operands[2], QImode);
- emit_move_insn (operands[0], hard_libcall_value(HImode));
- DONE;
-#else
- do_pending_stack_adjust ();
- emit_insn (gen_tstqi (operands[2]));
- emit_jump_insn (gen_bne (label1));
- emit_move_insn (operands[0], operands[1]);
- emit_jump_insn (gen_jump (label2));
- emit_barrier ();
- emit_label (label1);
-
- if (GET_CODE(operands[2]) != MEM)
- {
- rtx stack_slot;
-
- stack_slot = assign_stack_temp (QImode, GET_MODE_SIZE(QImode), 0);
- stack_slot = change_address (stack_slot, VOIDmode, XEXP (stack_slot, 0));
- emit_move_insn (stack_slot, operands[2]);
- operands[2] = stack_slot;
- }
-
- emit_insn (gen_match_lshrhi3_nobmu (operands[0], operands[1], operands[2]));
- emit_label (label2);
- DONE;
-#endif
- }
- }
-}")
-
-(define_insn "match_lshrhi3"
- [(set (match_operand:HI 0 "register_operand" "=A,A,A")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "A,A,!A")
- (match_operand:QI 2 "nonmemory_operand" "B,I,h")))]
- "TARGET_BMU"
- "@
- %0=%1>>>%2
- %0=%1>>>%H2
- %0=%1>>>%2"
- [(set_attr "type" "shift,shift_i,shift")])
-
-(define_insn "match_lshrhi3_nobmu"
- [(set (match_operand:HI 0 "register_operand" "=A,A")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "A,0")
- (match_operand:QI 2 "general_operand" "n,m")))
- (clobber (match_scratch:QI 3 "=X,Y"))]
- "!TARGET_BMU"
- "*
-{
- if (which_alternative == 0)
- {
- emit_1600_core_shift (LSHIFTRT, operands, INTVAL(operands[2]));
- return \"\";
- }
- else
- {
- output_asm_insn (\"%3=psw\;psw=0\",operands);
- output_asm_insn (\"cloop=%2\", operands);
- output_asm_insn (\"do 0 \{\", operands);
- output_asm_insn (\"%0=%0>>1\", operands);
- output_asm_insn (\"\}\", operands);
- return \"psw=%3\";
- }
-}")
-
-
-;;
-;; Arithmetic Left shift
-
-;; Start off with special case arithmetic left shift by 1,4,8 or 16.
-
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashift:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 1)))]
- ""
- "%0=%1<<1"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashift:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 4)))]
- ""
- "%0=%1<<4"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashift:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 8)))]
- ""
- "%0=%1<<8"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashift:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "A"))
- (const_int 16)))]
- ""
- "%0=%1<<16"
- [(set_attr "type" "special")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashift:HI (match_operand:HI 1 "general_operand" "A")
- (const_int 16)))]
- ""
- "%0=%1<<16"
- [(set_attr "type" "special")])
-
-
-
-;; Normal Arithmetic Shift Left
-
-
-(define_expand "ashlhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (ashift:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (!TARGET_BMU)
- {
- /* If we are shifting by a constant we can do it in 1 or more
- 1600 core shift instructions. The core instructions can
- shift by 1, 4, 8, or 16. */
-
- if (GET_CODE(operands[2]) == CONST_INT)
- ;
- else
- {
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
-#if 0
- if (!dsp16xx_ashlhi3_libcall)
- dsp16xx_ashlhi3_libcall = gen_rtx (SYMBOL_REF, Pmode, ASHLHI3_LIBCALL);
-
- emit_library_call (dsp16xx_ashlhi3_libcall, 1, HImode, 2,
- operands[1], HImode,
- operands[2], QImode);
- emit_move_insn (operands[0], hard_libcall_value(HImode));
- DONE;
-#else
- do_pending_stack_adjust ();
- emit_insn (gen_tstqi (operands[2]));
- emit_jump_insn (gen_bne (label1));
- emit_move_insn (operands[0], operands[1]);
- emit_jump_insn (gen_jump (label2));
- emit_barrier ();
- emit_label (label1);
-
- if (GET_CODE(operands[2]) != MEM)
- {
- rtx stack_slot;
-
- stack_slot = assign_stack_temp (QImode, GET_MODE_SIZE(QImode), 0);
- stack_slot = change_address (stack_slot, VOIDmode, XEXP (stack_slot, 0));
- emit_move_insn (stack_slot, operands[2]);
- operands[2] = stack_slot;
- }
- emit_insn (gen_match_ashlhi3_nobmu (operands[0], operands[1], operands[2]));
- emit_label (label2);
- DONE;
-#endif
- }
- }
-}")
-
-(define_insn "match_ashlhi3"
- [(set (match_operand:HI 0 "register_operand" "=A,A,A")
- (ashift:HI (match_operand:HI 1 "register_operand" "A,A,A")
- (match_operand:QI 2 "nonmemory_operand" "B,I,!h")))]
- "TARGET_BMU"
- "@
- %0=%1<<%2\;move %u0=%u0
- %0=%1<<%H2\;move %u0=%u0
- %0=%1<<%2\;move %u0=%u0"
- [(set_attr "type" "shift,shift_i,shift")])
-
-(define_insn "match_ashlhi3_nobmu"
- [(set (match_operand:HI 0 "register_operand" "=A,A")
- (ashift:HI (match_operand:HI 1 "register_operand" "A,0")
- (match_operand:QI 2 "general_operand" "n,m")))]
- "!TARGET_BMU"
- "*
-{
- if (which_alternative == 0)
- {
- emit_1600_core_shift (ASHIFT, operands, INTVAL(operands[2]));
- return \"\";
- }
- else
- {
- output_asm_insn (\"cloop=%2\", operands);
- output_asm_insn (\"do 0 \{\", operands);
- output_asm_insn (\"%0=%0<<1\", operands);
- return \"\}\";
- }
-}")
-
-
-
-;;
-;; Jump Instructions
-;;
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(EQ, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(NE, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(GT, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(GE, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(LT, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(LE, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(GTU, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(GEU, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(LTU, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (dsp16xx_compare_gen == gen_compare_reg)
- operands[1] = (*dsp16xx_compare_gen)(LEU, dsp16xx_compare_op0, dsp16xx_compare_op1);
- else
- operands[1] = (*dsp16xx_compare_gen)(dsp16xx_compare_op0);
-}")
-
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- "!TARGET_NEAR_JUMP"
- "pt=%l0\;if %C1 goto pt"
- [(set_attr "type" "cond_jump")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- "TARGET_NEAR_JUMP"
- "if %C1 goto %l0"
- [(set_attr "type" "cond_jump")])
-
-;;
-;; Negated conditional jump instructions.
-;; These are necessary because jump optimization can turn
-;; direct-conditional branches into reverse-conditional
-;; branches.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- "!TARGET_NEAR_JUMP"
- "pt=%l0\;if %I1 goto pt"
- [(set_attr "type" "cond_jump")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- "TARGET_NEAR_JUMP"
- "if %I1 goto %l0"
- [(set_attr "type" "cond_jump")])
-
-
-;;
-;; JUMPS
-;;
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
- {
- if (TARGET_NEAR_JUMP)
- return \"goto %l0\";
- else
- return \"pt=%l0\;goto pt\";
- }"
- [(set_attr "type" "jump")])
-
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:QI 0 "register_operand" "A"))]
- ""
- "pt=%0\;goto pt"
- [(set_attr "type" "jump")])
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:QI 0 "register_operand" "A"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "pt=%0\;goto pt"
- [(set_attr "type" "jump")])
-
-;;
-;; FUNCTION CALLS
-;;
-
-;; Call subroutine with no return value.
-
-
-(define_expand "call"
- [(parallel [(call (match_operand:QI 0 "" "")
- (match_operand 1 "" ""))
- (clobber (reg:QI 24))])]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM
- && ! call_address_operand (XEXP (operands[0], 0), QImode))
- operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
- force_reg (Pmode, XEXP (operands[0], 0)));
-}")
-
-(define_insn ""
- [(parallel [(call (mem:QI (match_operand:QI 0 "call_address_operand" "hR"))
- (match_operand 1 "" ""))
- (clobber (reg:QI 24))])]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == REG ||
- (GET_CODE(operands[0]) == SYMBOL_REF && !TARGET_NEAR_CALL))
- return \"pt=%0\;call pt\";
- else
- return \"call %0\";
-}"
-[(set_attr "type" "call")])
-
-;; Call subroutine with return value.
-
-(define_expand "call_value"
- [(parallel [(set (match_operand 0 "register_operand" "=f")
- (call (match_operand:QI 1 "call_address_operand" "hR")
- (match_operand:QI 2 "" "")))
- (clobber (reg:QI 24))])]
- ""
- "
-{
- if (GET_CODE (operands[1]) == MEM
- && ! call_address_operand (XEXP (operands[1], 0), QImode))
- operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
- force_reg (Pmode, XEXP (operands[1], 0)));
-}")
-
-(define_insn ""
- [(parallel [(set (match_operand 0 "register_operand" "=f")
- (call (mem:QI (match_operand:QI 1 "call_address_operand" "hR"))
- (match_operand:QI 2 "" "")))
- (clobber (reg:QI 24))])]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == REG ||
- (GET_CODE(operands[1]) == SYMBOL_REF && !TARGET_NEAR_CALL))
- return \"pt=%1\;call pt\";
- else
- return \"call %1\";
-}"
-[(set_attr "type" "call")])
-
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop"
- [(set_attr "type" "nop")])
-
-;;
-;; PEEPHOLE PATTERNS
-;;
-
-
-(define_peephole
- [(set (match_operand:QI 0 "register_operand" "=A")
- (reg:QI 16))
- (call (mem:QI (match_dup 0))
- (match_operand 1 "" "i"))]
- ""
- "call pt")
-
-
-(define_peephole
- [(set (match_operand:QI 0 "register_operand" "=A")
- (reg:QI 16))
- (set (match_operand 1 "" "")
- (call (mem:QI (match_dup 0))
- (match_operand 2 "" "i")))]
- ""
- "call pt")
-
-(define_peephole
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashift:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 16)))
- (set (match_operand:HI 2 "register_operand" "")
- (match_dup 0))
- (set (match_dup 0)
- (ashiftrt:HI (match_dup 0) (const_int 16)))
- (set (match_dup 2)
- (match_dup 0))]
- ""
- "%0=%1<<16\;%0=%0>>16\;%u2=%u0\;%w2=%w0")
-
-(define_peephole
- [(set (match_operand:HI 0 "register_operand" "=A")
- (ashift:HI (match_operand:HI 1 "register_operand" "A")
- (const_int 16)))
- (set (match_operand:HI 2 "register_operand" "")
- (match_dup 0))
- (set (match_dup 0)
- (lshiftrt:HI (match_dup 0) (const_int 16)))
- (set (match_dup 2)
- (match_dup 0))]
- ""
- "%0=%1<<16\;%0=%0>>16\;%0=%b0&0x0000\;%u2=%u0\;%w2=%w0")
diff --git a/gcc/config/dsp16xx/xm-dsp16xx.h b/gcc/config/dsp16xx/xm-dsp16xx.h
deleted file mode 100644
index 00f86b4b76f..00000000000
--- a/gcc/config/dsp16xx/xm-dsp16xx.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Configuration file for GNU CC for AT&T DSP1600.
- Copyright (C) 1993 Free Software Foundation, Inc.
- Contributed by Michael Collison (collison@world.std.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 1, 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 16
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* If compiled with GNU C, use the built-in alloca */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#define USE_C_ALLOCA
-#endif
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
diff --git a/gcc/config/elxsi/elxsi.c b/gcc/config/elxsi/elxsi.c
deleted file mode 100644
index e2dadb99a39..00000000000
--- a/gcc/config/elxsi/elxsi.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Subroutines for insn-output.c for GNU compiler. Elxsi version.
- Copyright (C) 1987, 1992 Free Software Foundation, Inc
- This port, done by Mike Stump <mrs@cygnus.com> in 1988, and is the first
- 64 bit port of GNU CC.
- Based upon the VAX port.
-
-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 1, 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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-
-extern char *reg_names[];
-rtx cmp_op0=0, cmp_op1=0;
-
-/* table of relations for compares and branches */
-char *cmp_tab[] = {
- "gt", "gt", "eq", "eq", "ge", "ge", "lt", "lt", "ne", "ne",
- "le", "le" };
-
-/* type is the index into the above table */
-/* s is "" for signed, or "u" for unsigned */
-char *cmp_jmp(s, type, where) char *s; rtx where; {
- rtx br_ops[3];
- char template[50];
- char *f = "";
- char *bits = "64";
- if (GET_MODE (cmp_op0) == SFmode) f = "f", bits = "32";
- if (GET_MODE (cmp_op0) == DFmode) f = "f";
- br_ops[0] = where;
- br_ops[1] = cmp_op0;
- br_ops[2] = cmp_op1;
- if (cmp_op1)
- sprintf(template, "%scmp%s.br.%s\t%%1,%%2:j%s\t%%l0",
- f, s, bits, cmp_tab[type]);
- else if (*f)
- sprintf(template, "fcmp.br.%s\t%%1,=0:j%s\t%%l0",
- bits, cmp_tab[type]);
- else if (*s) /* can turn the below in to a jmp ... */
- sprintf(template, "cmpu.br.64\t%%1,=0:j%s\t%%l0", s, cmp_tab[type]);
- else
- sprintf(template, "jmp.%s\t%%1,%%l0", cmp_tab[type+1]);
- output_asm_insn(template, br_ops);
- return "";
-}
-
-char *cmp_set(s, type, reg) char *s, *type; rtx reg; {
- rtx br_ops[3];
- char template[50];
- char *f = "";
- char *bits = "64";
- if (GET_MODE (cmp_op0) == SFmode) f = "f", bits = "32";
- else if (GET_MODE (cmp_op0) == DFmode) f = "f";
- else if (GET_MODE (cmp_op0) == SImode) bits = "32";
- else if (GET_MODE (cmp_op0) == HImode) bits = "16";
- else if (GET_MODE (cmp_op0) == QImode) bits = "8";
- br_ops[0] = reg;
- br_ops[1] = cmp_op0;
- br_ops[2] = cmp_op1;
- if (cmp_op1)
- sprintf(template, "%scmp%s.%s\t%%0,%%1,%%2:%s",
- f, s, bits, type);
- else
- sprintf(template, "%scmp%s.%s\t%%0,%%1,=0:%s",
- f, s, bits, type);
- output_asm_insn(template, br_ops);
- return "";
-}
-
-print_operand_address (file, addr)
- FILE *file;
- register rtx addr;
-{
- register rtx reg1, reg2, breg, ireg;
- rtx offset;
-
- retry:
- switch (GET_CODE (addr))
- {
-
- case MEM:
- if (GET_CODE (XEXP (addr, 0)) == REG)
- fprintf (file, "%s", reg_names[REGNO (addr)]);
- else abort();
- break;
-
- case REG:
- fprintf (file, "[%s]", reg_names[REGNO (addr)]);
- break;
-
- case PLUS:
- reg1 = 0; reg2 = 0;
- ireg = 0; breg = 0;
- offset = 0;
- if (GET_CODE (XEXP (addr, 0)) == REG)
- {
- offset = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- {
- offset = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- fprintf (file, "[%s]", reg_names[REGNO (addr)]);
- output_address (offset);
- break;
-
- default:
- output_addr_const (file, addr);
- }
-}
diff --git a/gcc/config/elxsi/elxsi.h b/gcc/config/elxsi/elxsi.h
deleted file mode 100644
index d0d4c73807d..00000000000
--- a/gcc/config/elxsi/elxsi.h
+++ /dev/null
@@ -1,966 +0,0 @@
-/* Definitions of target machine for GNU compiler. Elxsi version.
- Copyright (C) 1987, 1988, 1992, 1995, 1996 Free Software Foundation, Inc.
- This port, contributed by Mike Stump <mrs@cygnus.com> in 1988, is the first
- 64 bit port of GNU CC.
- Based upon the VAX port.
-
-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 1, 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. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Delxsi -Dunix -Asystem(unix) -Acpu(elxsi) -Amachine(elxsi)"
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fprintf (stderr, " (elxsi)");
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Nonzero if compiling code that Unix assembler can assemble. */
-#define TARGET_UNIX_ASM (target_flags & 1)
-
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { {"unix", 1}, \
- {"embos", -1}, \
- { "", TARGET_DEFAULT}}
-
-/* Default target_flags if no switches specified. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 1
-#endif
-
-/* Target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is not true on the vax. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is numbered. */
-#define WORDS_BIG_ENDIAN 1
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 64
-#define Rmode DImode
-
-#define INT_TYPE_SIZE 32
-
-#define LONG_TYPE_SIZE 32
-
-#define LONG_LONG_TYPE_SIZE 64
-
-#define FLOAT_TYPE_SIZE 32
-
-#define DOUBLE_TYPE_SIZE 64
-
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 8
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing pointers in memory. */
-#define POINTER_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 8
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 8
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 32
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* Define this if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 0
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-#define FIRST_PSEUDO_REGISTER 16
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the elxsi, these is the .r15 (aka .sp). */
-#define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
- On the vax, all registers are one word long. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) 1
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 15
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 14
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 0
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
-{ int regno; \
- int offset = 0; \
- for( regno=0; regno < FIRST_PSEUDO_REGISTER; regno++ ) \
- if( regs_ever_live[regno] && !call_used_regs[regno] ) \
- offset += 8; \
- (DEPTH) = (offset + ((get_frame_size() + 3) & ~3) ); \
- (DEPTH) = 0; \
-}
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 14
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 0
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 1
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The vax has only one kind of registers, so NO_REGS and ALL_REGS
- are the only classes. */
-
-enum reg_class { NO_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "GENERAL_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS {0, 0x07fff, 0xffff}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) (REGNO == 15 ? ALL_REGS : GENERAL_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) NO_REGS
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (VALUE) >=-16 && (VALUE) <=15 : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On the vax, this is always the size of MODE in words,
- since all registers are the same size. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET -4
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 4
-
-/* Value is 1 if returning from a function call automatically
- pops the arguments described by the number-of-args field in the call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
-
- On the Vax, the RET insn always pops all the args for any function. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (SIZE)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On the Vax the return value is in R0 regardless. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-/* On the Vax the return value is in R0 regardless. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-#define PCC_STATIC_STRUCT_RETURN
-
-/* 1 if N is a possible register number for a function value.
- On the Vax, R0 is the only register thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* 1 if N is a possible register number for function argument passing.
- On the Vax, no registers are used in this way. */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the vax, this is a single integer, which is a number of bytes
- of arguments scanned so far. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the vax, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,x,INDIRECT) \
- ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the vax all args are pushed. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int regno; \
- register int cnt = 0; \
- extern char call_used_regs[]; \
- /* the below two lines are a HACK, and should be deleted, but \
- for now are very much needed (1.35) */ \
- if (frame_pointer_needed) \
- regs_ever_live[14]=1, call_used_regs[14]=0; \
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- cnt+=8; \
- if ((SIZE)+cnt) \
- fprintf (FILE, "\tadd.64\t.sp,=%d\n", -(SIZE)-cnt); \
- cnt = 0; \
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- fprintf (FILE, "\tst.64\t.r%d,[.sp]%d\n", regno, (cnt+=8)-12); \
- if (frame_pointer_needed) \
- fprintf (FILE, "\tadd.64\t.r14,.sp,=%d\n", (SIZE)+cnt); \
-}
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tld.64\t.r0,.LP%d\n\tcall\tmcount\n", (LABELNO));
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 0
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ register int regno; \
- register int cnt = 0; \
- extern char call_used_regs[]; \
- extern int current_function_calls_alloca; \
- /* this conditional is ONLY here because there is a BUG; \
- EXIT_IGNORE_STACK is ignored itself when the first part of \
- the condition is true! (at least in version 1.35) */ \
- /* the 8*10 is for 64 bits of .r5 - .r14 */ \
- if (current_function_calls_alloca || (SIZE)>=(256-8*10)) { \
- /* use .r4 as a temporary! Ok for now.... */ \
- fprintf (FILE, "\tld.64\t.r4,.r14\n"); \
- for (regno = FIRST_PSEUDO_REGISTER-1; regno >= 0; --regno) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- cnt+=8; \
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- fprintf (FILE, "\tld.64\t.r%d,[.r14]%d\n", regno, \
- -((cnt-=8) + 8)-4-(SIZE)); \
- fprintf (FILE, "\tld.64\t.sp,.r4\n\texit\t0\n"); \
- } else { \
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- fprintf (FILE, "\tld.64\t.r%d,[.sp]%d\n", regno, (cnt+=8)-12); \
- fprintf (FILE, "\texit\t%d\n", (SIZE)+cnt); \
- } }
-
-/* If the memory address ADDR is relative to the frame pointer,
- correct it to be relative to the stack pointer instead.
- This is for when we don't use a frame pointer.
- ADDR should be a variable name. */
-
-#define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \
-{ int offset = -1; \
- rtx regs = stack_pointer_rtx; \
- if (ADDR == frame_pointer_rtx) \
- offset = 0; \
- else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 1) == frame_pointer_rtx \
- && GET_CODE (XEXP (ADDR, 0)) == CONST_INT) \
- offset = INTVAL (XEXP (ADDR, 0)); \
- else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx \
- && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \
- offset = INTVAL (XEXP (ADDR, 1)); \
- else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx) \
- { rtx other_reg = XEXP (ADDR, 1); \
- offset = 0; \
- regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); } \
- else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 1) == frame_pointer_rtx) \
- { rtx other_reg = XEXP (ADDR, 0); \
- offset = 0; \
- regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); } \
- if (offset >= 0) \
- { int regno; \
- extern char call_used_regs[]; \
- offset += 4; /* I don't know why??? */ \
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 8; \
- ADDR = plus_constant (regs, offset + (DEPTH)); } }
-
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(regno) \
-((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
-#define REGNO_OK_FOR_BASE_P(regno) \
-((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* 1 if X is an rtx for a constant that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- (GET_CODE (X) != CONST_DOUBLE)
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) 1
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) 1
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- CONSTANT_ADDRESS_P is actually machine-independent. */
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ \
- if (GET_CODE (X) == REG) goto ADDR; \
- if (CONSTANT_ADDRESS_P (X)) goto ADDR; \
- if (GET_CODE (X) == PLUS) \
- { \
- /* Handle [index]<address> represented with index-sum outermost */\
- if (GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 1)) == CONST_INT) \
- goto ADDR; \
- if (GET_CODE (XEXP (X, 1)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 0)) == CONST_INT) \
- goto ADDR; \
- } \
- }
-
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the vax, nothing needs to be done. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for. */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the case instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 8
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- /* Constant zero is super cheap due to clr instruction. */ \
- if (RTX == const0_rtx) return 0; \
- if ((unsigned) INTVAL (RTX) < 077) return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 3; \
- case CONST_DOUBLE: \
- return 5;
-
-/*
- * We can use the BSD C library routines for the gnulib calls that are
- * still generated, since that's what they boil down to anyways.
- */
-
-/* #define UDIVSI3_LIBCALL "*udiv" */
-/* #define UMODSI3_LIBCALL "*urem" */
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). No extra ones are needed for the vax. */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
- CC_STATUS_INIT;
-
-
-/* Control the assembler format that we output. */
-
-/* Output the name of the file we are compiling. */
-#define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
- do { fprintf (STREAM, "\t.file\t"); \
- output_quoted_string (STREAM, NAME); \
- fprintf (STREAM, "\n"); \
- } while (0)
-
-/* Output at beginning of assembler file. */
-#define ASM_FILE_START(FILE) fprintf (FILE, "");
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP "\t.inst"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP "\t.var"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{".r0", ".r1", ".r2", ".r3", ".r4", ".r5", ".r6", ".r7", ".r8", \
- ".r9", ".r10", ".r11", ".r12", ".r13", ".r14", ".sp"}
-
-/* This is BSD, so it wants DBX format. */
-
-/* #define DBX_DEBUGGING_INFO */
-
-/* How to renumber registers for dbx and gdb.
- Vax needs no change in the numeration. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Do not break .stabs pseudos into continuations. */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* This is the char to use for continuation (in case we need to turn
- continuation back on). */
-
-#define DBX_CONTIN_CHAR '?'
-
-/* Don't use the `xsfoo;' construct in DBX output; this system
- doesn't support it. */
-
-#define DBX_NO_XREFS
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs ("\t.extdef\t", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX ""
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, ".%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant.
- It is .dfloat or .gfloat, depending. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-{ union {double d; int i[2]; } tem; \
- tem.d = (VALUE); \
- fprintf (FILE, "\t.data\t%d{32}, %d{32}\n", tem.i[0], tem.i[1]); }
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-{ union {float f; int i; } tem; \
- tem.f = (VALUE); \
- fprintf (FILE, "\t.data %d{32}\n", tem.i); }
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( \
- fprintf (FILE, "\t.data\t"), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "{32}\n"))
-
-#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
-{ \
- fprintf (FILE, "\t.data\t"); \
- if (GET_CODE (VALUE) == CONST_DOUBLE) \
- { \
- fprintf (FILE, "%d", CONST_DOUBLE_HIGH (VALUE)); \
- fprintf (FILE, "{32}, "); \
- fprintf (FILE, "%d", CONST_DOUBLE_LOW (VALUE)); \
- fprintf (FILE, "{32}\n"); \
- } else if (GET_CODE (VALUE) == CONST_INT) \
- { \
- int val = INTVAL (VALUE); \
- fprintf (FILE, "%d", val < 0 ? -1 : 0); \
- fprintf (FILE, "{32}, "); \
- fprintf (FILE, "%d", val); \
- fprintf (FILE, "{32}\n"); \
- } else abort (); \
-}
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.data\t"), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "{16}\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.data\t"), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "{8}\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.data\t%d{8}\n", (VALUE))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tsubi.64\t4,.sp\n\tst.32\t%s,[.sp]\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tld.32\t%s,[.sp]\n\taddi.64\t4,.sp\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute.
- (The Vax does not use such vectors,
- but we must define this macro anyway.) */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.data .L%d{32}\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.data .L%d-.L%d{32}\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if (LOG!=0) fprintf (FILE, "\t.align\t%d\n", (LOG)); else 0
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".bss ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d,%d\n", (SIZE),(ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print an instruction operand X on file FILE.
- CODE is the code from the %-spec that requested printing this operand;
- if `%z3' was used to print operand 3, then CODE is 'z'. */
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ \
- if (CODE == 'r' && GET_CODE (X) == MEM && GET_CODE (XEXP (X, 0)) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (XEXP (X, 0))]); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else \
- { \
- /*debug_rtx(X);*/ \
- putc ('=', FILE); \
- output_addr_const (FILE, X); } \
- }
-
-/* Print a memory operand whose address is X, on file FILE.
- This uses a function in output-vax.c. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address (FILE, ADDR)
-
-/* Functions used in the md file. */
-
-extern char *cmp_set();
-extern char *cmp_jmp();
-
-/* These are stubs, and have yet to bee written. */
-
-#define TRAMPOLINE_SIZE 26
-#define TRAMPOLINE_TEMPLATE(FILE)
-#define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT)
diff --git a/gcc/config/elxsi/elxsi.md b/gcc/config/elxsi/elxsi.md
deleted file mode 100644
index b6969e956c4..00000000000
--- a/gcc/config/elxsi/elxsi.md
+++ /dev/null
@@ -1,1420 +0,0 @@
-;;- Machine description for GNU compiler, Elxsi Version
-;; Copyright (C) 1987, 1988, 1992, 1994 Free Software Foundation, Inc.
-;; Contributed by Mike Stump <mrs@cygnus.com> in 1988, and is the first
-;; 64 bit port of GNU CC.
-;; Based upon the VAX port.
-
-;; 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 1, 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.
-
-
-;;- Instruction patterns. When multiple patterns apply,
-;;- the first one in the file is chosen.
-;;-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-;;-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-
-(define_insn ""
- [(set (reg:SI 15)
- (plus:SI (reg:SI 15)
- (match_operand:SI 0 "general_operand" "g")))]
- ""
- "add.64\\t.sp,%0")
-
-(define_insn ""
- [(set (reg:SI 15)
- (plus:SI (match_operand:SI 0 "general_operand" "g")
- (reg:SI 15)))]
- ""
- "add.64\\t.sp,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "r")
- (plus:SI (reg:SI 15)
- (match_operand:SI 1 "general_operand" "g")))]
- ""
- "ld.32\\t%0,.sp\;add.64\\t%0,%1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "r")
- (plus:SI (match_operand:SI 1 "general_operand" "g")
- (reg:SI 15)))]
- ""
- "ld.32\\t%0,.sp\;add.64\\t%0,%1")
-
-(define_insn ""
- [(set (reg:SI 15)
- (minus:SI (reg:SI 15)
- (match_operand:SI 0 "general_operand" "g")))]
- ""
- "sub.64\\t.sp,%0")
-
-(define_insn ""
- [(set (reg:SI 15)
- (match_operand:SI 0 "general_operand" "rm"))]
- ""
- "ld.32\\t.sp,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "m,r")
- (reg:SI 15))]
- ""
- "*
- if (which_alternative == 0)
- return \"st.32\\t.sp,%0\";
- return \"ld.32\\t%0,.sp\";
-")
-
-; tstdi is first test insn so that it is the one to match
-; a constant argument.
-
-(define_insn "tstdi"
- [(set (cc0)
- (match_operand:DI 0 "register_operand" "r"))]
- ""
- "*
- extern rtx cmp_op0, cmp_op1;
- cmp_op0=operands[0]; cmp_op1=0;
- return \";\\ttstdi\\t%0\";
-")
-
-(define_insn "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "register_operand" "r"))]
- ""
- "*
- extern rtx cmp_op0, cmp_op1;
- cmp_op0=operands[0]; cmp_op1=0;
- return \";\\ttstdf\\t%0\";
-")
-
-(define_insn "tstsf"
- [(set (cc0)
- (match_operand:SF 0 "register_operand" "r"))]
- ""
- "*
- extern rtx cmp_op0, cmp_op1;
- cmp_op0=operands[0]; cmp_op1=0;
- return \";\\ttstsf\\t%0\";
-")
-
-(define_insn "cmpdi"
- [(set (cc0)
- (compare (match_operand:DI 0 "register_operand" "r")
- (match_operand:DI 1 "general_operand" "rm")))]
- ""
- "*
- extern rtx cmp_op0, cmp_op1;
- cmp_op0=operands[0]; cmp_op1=operands[1];
- return \";\\tcmpdi\\t%0,%1\";
-")
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "register_operand" "r")
- (match_operand:DF 1 "general_operand" "rm")))]
- ""
- "*
- extern rtx cmp_op0, cmp_op1;
- cmp_op0=operands[0]; cmp_op1=operands[1];
- return \";\\tcmpdf\\t%0,%1\";
-")
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "register_operand" "r")
- (match_operand:SF 1 "general_operand" "rm")))]
- ""
- "*
- extern rtx cmp_op0, cmp_op1;
- cmp_op0=operands[0]; cmp_op1=operands[1];
- return \";\\tcmpsf\\t%0,%1\";
-")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (eq (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmp.64\\t%0,%1,%2:eq")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ne (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmp.64\\t%0,%1,%2:ne")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (le (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmp.64\\t%0,%1,%2:le")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (leu (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmpu.64\\t%0,%1,%2:le")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (lt (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmp.64\\t%0,%1,%2:lt")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ltu (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmpu.64\\t%0,%1,%2:lt")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ge (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmp.64\\t%0,%1,%2:ge")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (geu (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmpu.64\\t%0,%1,%2:ge")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (gt (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmp.64\\t%0,%1,%2:gt")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (gtu (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "general_operand" "g")))]
- ""
- "cmpu.64\\t%0,%1,%2:gt")
-
-(define_insn "seq"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (eq (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"\", \"eq\", operands[0]); ")
-
-(define_insn "sne"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ne (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"\", \"ne\", operands[0]); ")
-
-(define_insn "sle"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (le (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"\", \"le\", operands[0]); ")
-
-(define_insn "sleu"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (leu (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"u\", \"le\", operands[0]); ")
-
-(define_insn "slt"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (lt (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"\", \"lt\", operands[0]); ")
-
-(define_insn "sltu"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ltu (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"u\", \"lt\", operands[0]); ")
-
-(define_insn "sge"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ge (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"\", \"ge\", operands[0]); ")
-
-(define_insn "sgeu"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (geu (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"u\", \"ge\", operands[0]); ")
-
-(define_insn "sgt"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (gt (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"\", \"gt\", operands[0]); ")
-
-(define_insn "sgtu"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (gtu (cc0) (const_int 0)))]
- ""
- "* return cmp_set(\"u\", \"gt\", operands[0]); ")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (eq (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmp.32\\t%0,%1,%2:eq")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ne (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmp.32\\t%0,%1,%2:ne")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (le (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmp.32\\t%0,%1,%2:le")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (leu (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmpu.32\\t%0,%1,%2:le")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lt (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmp.32\\t%0,%1,%2:lt")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ltu (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmpu.32\\t%0,%1,%2:lt")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ge (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmp.32\\t%0,%1,%2:ge")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (geu (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmpu.32\\t%0,%1,%2:ge")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (gt (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmp.32\\t%0,%1,%2:gt")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (gtu (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "m")))]
- ""
- "cmpu.32\\t%0,%1,%2:gt")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (eq (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmp.16\\t%0,%1,%2:eq")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ne (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmp.16\\t%0,%1,%2:ne")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (le (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmp.16\\t%0,%1,%2:le")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (leu (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmpu.16\\t%0,%1,%2:le")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (lt (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmp.16\\t%0,%1,%2:lt")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ltu (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmpu.16\\t%0,%1,%2:lt")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ge (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmp.16\\t%0,%1,%2:ge")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (geu (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmpu.16\\t%0,%1,%2:ge")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (gt (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmp.16\\t%0,%1,%2:gt")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (gtu (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "general_operand" "m")))]
- ""
- "cmpu.16\\t%0,%1,%2:gt")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (eq (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmp.8\\t%0,%1,%2:eq")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (ne (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmp.8\\t%0,%1,%2:ne")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (le (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmp.8\\t%0,%1,%2:le")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (leu (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmpu.8\\t%0,%1,%2:le")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (lt (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmp.8\\t%0,%1,%2:lt")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (ltu (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmpu.8\\t%0,%1,%2:lt")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (ge (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmp.8\\t%0,%1,%2:ge")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (geu (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmpu.8\\t%0,%1,%2:ge")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (gt (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmp.8\\t%0,%1,%2:gt")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (gtu (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "general_operand" "m")))]
- ""
- "cmpu.8\\t%0,%1,%2:gt")
-
-
-
-(define_insn "movdf" [(set (match_operand:DF 0 "general_operand" "=r,m")
- (match_operand:DF 1 "general_operand" "rm,r"))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.64\\t%0,%1\";
- return \"st.64\\t%1,%0\";
-}")
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=r,m")
- (match_operand:SF 1 "general_operand" "rm,r"))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.32\\t%0,%1\";
- return \"st.32\\t%1,%0\";
-}")
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=r,m,rm")
- (match_operand:DI 1 "general_operand" "g,r,I"))]
- ""
- "*
- if (which_alternative == 0)
- return \"ld.64\\t%0,%1\";
- else if (which_alternative == 1)
- return \"st.64\\t%1,%0\";
- else
- if (GET_CODE(operands[1])==CONST_INT) {
- if (INTVAL(operands[1]) >= 0)
- return \"sti.64\\t%c1,%0\";
- else
- return \"stin.64\\t%n1,%0\";
- }
-")
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=r,m,r")
- (match_operand:SI 1 "general_operand" "rm,rI,i"))]
- ""
- "*
- if (which_alternative == 0)
- return \"ld.32\\t%0,%1\";
- else if (which_alternative == 1) {
- if (GET_CODE(operands[1])==CONST_INT) {
- if (INTVAL(operands[1]) >= 0)
- return \"sti.32\\t%c1,%0\";
- else
- return \"stin.32\\t%n1,%0\";
- }
- return \"st.32\\t%1,%0\";
- } else
- return \"ld.64\\t%0,%1 ; I only want 32\";
-")
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=r,m,r")
- (match_operand:HI 1 "general_operand" "m,rI,ri"))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.16\\t%0,%1\";
- if (which_alternative == 2)
- return \"ld.64\\t%0,%1\\t; I only want 16\";
- if (GET_CODE(operands[1])==CONST_INT) {
- if (INTVAL(operands[1]) >= 0)
- return \"sti.16\\t%c1,%0\";
- else
- return \"stin.16\\t%n1,%0\";
- }
- return \"st.16\\t%1,%0\";
-}")
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=r,m,r")
- (match_operand:QI 1 "general_operand" "m,rI,ri"))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.8\\t%0,%1\";
- if (which_alternative == 2)
- return \"ld.64\\t%0,%1\\t; I only want 8\";
- if (GET_CODE(operands[1])==CONST_INT) {
- if (INTVAL(operands[1]) >= 0)
- return \"sti.8\\t%c1,%0\";
- else
- return \"stin.8\\t%n1,%0\";
- }
- return \"st.8\\t%1,%0\";
-}")
-
-;; Extension and truncation insns.
-;; Those for integer source operand
-;; are ordered widest source type first.
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (truncate:SF (match_operand:DF 1 "general_operand" "rm")))]
- ""
- "cvt.ds\\t%0,%1")
-
-(define_insn "truncdiqi2"
- [(set (match_operand:QI 0 "general_operand" "=r,m,r")
- (truncate:QI (match_operand:DI 1 "general_operand" "m,r,0")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.8\\t%0,%1\";
- else if (which_alternative == 1)
- return \"st.8\\t%1,%0\";
- return \"\";
-}")
-
-(define_insn "truncdihi2"
- [(set (match_operand:HI 0 "general_operand" "=r,m,r")
- (truncate:HI (match_operand:DI 1 "general_operand" "m,r,0")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.16\\t%0,%1\";
- if (which_alternative == 1)
- return \"st.16\\t%1,%0\";
- return \"\";
-}")
-
-(define_insn "truncdisi2"
- [(set (match_operand:SI 0 "general_operand" "=r,m")
- (truncate:SI (match_operand:DI 1 "general_operand" "rm,r")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.32\\t%0,%1\";
- return \"st.32\\t%1,%0\";
-}")
-
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "general_operand" "=r,m,r")
- (truncate:QI (match_operand:SI 1 "general_operand" "m,r,0")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.8\\t%0,%1\";
- if (which_alternative == 1)
- return \"st.8\\t%1,%0\";
- return \"\";
-}")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=r,m,r")
- (truncate:HI (match_operand:SI 1 "general_operand" "m,r,0")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.16\\t%0,%1\";
- if (which_alternative == 1)
- return \"st.16\\t%1,%0\";
- return \"\";
-}")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "general_operand" "=r,m,r")
- (truncate:QI (match_operand:HI 1 "general_operand" "m,r,0")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"ld.8\\t%0,%1\";
- if (which_alternative == 1)
- return \"st.8\\t%1,%0\";
- return \"\";
-}")
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (sign_extend:DF (match_operand:SF 1 "general_operand" "rm")))]
- ""
- "cvt.sd\\t%0,%1")
-
-(define_insn "extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (sign_extend:DI (match_operand:SI 1 "general_operand" "rm")))]
- ""
- "ld.32\\t%0,%1")
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (sign_extend:SI (match_operand:HI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ld.16\\t%0,%1\";
- return \"extract\\t%0,%1:bit 48,16\";
-")
-
-(define_insn "extendhidi2"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (sign_extend:DI (match_operand:HI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ld.16\\t%0,%1\";
- return \"extract\\t%0,%1:bit 48,16\";
-")
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (sign_extend:HI (match_operand:QI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ld.8\\t%0,%1\";
- return \"extract\\t%0,%1:bit 56,8\";
-")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (sign_extend:SI (match_operand:QI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ld.8\\t%0,%1\";
- return \"extract\\t%0,%1:bit 56,8\";
-")
-
-(define_insn "extendqidi2"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (sign_extend:DI (match_operand:QI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ld.8\\t%0,%1\";
- return \"extract\\t%0,%1:bit 56,8\";
-")
-
-(define_insn "zero_extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (zero_extend:DI (match_operand:SI 1 "general_operand" "rm")))]
- ""
- "ldz.32\\t%0,%1")
-
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:HI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ldz.16\\t%0,%1\";
- return \"extractz\\t%0,%1:bit 48,16\";
-")
-
-(define_insn "zero_extendhidi2"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (zero_extend:DI (match_operand:HI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ldz.16\\t%0,%1\";
- return \"extractz\\t%0,%1:bit 48,16\";
-")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (zero_extend:HI (match_operand:QI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ldz.8\\t%0,%1\";
- return \"extractz\\t%0,%1:bit 56,8\";
-")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:QI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ldz.8\\t%0,%1\";
- return \"extractz\\t%0,%1:bit 56,8\";
-")
-
-(define_insn "zero_extendqidi2"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (zero_extend:DI (match_operand:QI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative==0)
- return \"ldz.8\\t%0,%1\";
- return \"extractz\\t%0,%1:bit 56,8\";
-")
-
-
-(define_insn "ashrdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "rn")))]
- ""
- "sra\\t%0,%1,%2")
-
-(define_insn "lshrdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "rn")))]
- ""
- "srl\\t%0,%1,%2")
-
-(define_insn "ashldi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:SI 2 "general_operand" "rn")))]
- ""
- "sla\\t%0,%1,%2")
-
-(define_insn "anddi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (and:DI (match_operand:DI 1 "general_operand" "%0,r")
- (match_operand:DI 2 "general_operand" "g,g")))]
- "1 /*which_alternative == 0 || check356(operands[2])*/"
- "*
- if (which_alternative == 0)
- return \"and\\t%0,%2\";
- return \"and\\t%0,%1,%2\";
-")
-
-(define_insn "iordi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (ior:DI (match_operand:DI 1 "general_operand" "%0,r")
- (match_operand:DI 2 "general_operand" "g,g")))]
- "1 /*which_alternative == 0 || check356(operands[2])*/"
- "*
- if (which_alternative == 0)
- return \"or\\t%0,%2\";
- return \"or\\t%0,%1,%2\";
-")
-
-(define_insn "xordi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (xor:DI (match_operand:DI 1 "general_operand" "%0,r")
- (match_operand:DI 2 "general_operand" "g,g")))]
- "1 /*which_alternative == 0 || check356(operands[2])*/"
- "*
- if (which_alternative == 0)
- return \"xor\\t%0,%2\";
- return \"xor\\t%0,%1,%2\";
-")
-
-(define_insn "one_cmpldi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (match_operand:DI 1 "general_operand" "rm")))]
- ""
- "not\\t%0,%1")
-
-;; gcc 2.1 does not widen ~si into ~di.
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "not\\t%0,%1")
-
-(define_insn "negdi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (match_operand:DI 1 "general_operand" "rm")))]
- ""
- "neg.64\\t%0,%1")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (neg:SI (match_operand:SI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative == 0)
- return \"neg.32\\t%0,%1\";
- return \"neg.64\\t%0,%1 ; I only want 32\";
-")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (neg:HI (match_operand:HI 1 "general_operand" "m,r")))]
- ""
- "*
- if (which_alternative == 0)
- return \"neg.16\\t%0,%1\";
- return \"neg.64\\t%0,%1 ; I only want 16\";
-")
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (plus:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "rm")))]
- ""
- "fadd.64\\t%0,%2")
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (plus:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "rm")))]
- ""
- "fadd.32\\t%0,%2")
-
-;; There is also an addi.64 4,.r0'' optimization
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (plus:DI (match_operand:DI 1 "general_operand" "%0,r")
- (match_operand:DI 2 "general_operand" "g,g")))]
- "1 /*which_alternative == 0 || check356(operands[2])*/"
- "*
- if (which_alternative == 0)
- return \"add.64\\t%0,%2\";
- return \"add.64\\t%0,%1,%2\";
-")
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (plus:SI (match_operand:SI 1 "general_operand" "%0,r,0")
- (match_operand:SI 2 "general_operand" "m,m,g")))]
- "1 /*which_alternative != 1 || check356(operands[2])*/"
- "*
- if (which_alternative == 0)
- return \"add.32\\t%0,%2\";
- if (which_alternative == 1)
- return \"add.32\\t%0,%1,%2\";
- return \"add.64\\t%0,%2 ; I only want 32\";
-")
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r,r")
- (plus:HI (match_operand:HI 1 "general_operand" "%0,r,0")
- (match_operand:HI 2 "general_operand" "m,m,g")))]
- "1 /*which_alternative != 1 || check356(operands[2])*/"
- "*
- if (which_alternative == 0)
- return \"add.16\\t%0,%2\";
- if (which_alternative == 1)
- return \"add.16\\t%0,%1,%2\";
- return \"add.64\\t%0,%2 ; I only want 16\";
-")
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (minus:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "rm")))]
- ""
- "fsub.64\\t%0,%2")
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (minus:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "rm")))]
- ""
- "fsub.32\\t%0,%2")
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r,r")
- (minus:DI (match_operand:DI 1 "general_operand" "0,g,r")
- (match_operand:DI 2 "general_operand" "g,r,g")))]
- "1 /*which_alternative == 0 || check356(operands[which_alternative])*/"
- "*
- if (which_alternative == 0)
- return \"sub.64\\t%0,%2\";
- else if (which_alternative == 1)
- return \"subr.64\\t%0,%2,%1\";
- else
- return \"sub.64\\t%0,%1,%2\";
-")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
- (minus:SI (match_operand:SI 1 "general_operand" "0,m,r,0")
- (match_operand:SI 2 "general_operand" "m,r,m,g")))]
- "1 /*which_alternative == 0 || check356(operands[which_alternative])*/"
- "*
- if (which_alternative == 0)
- return \"sub.32\\t%0,%2\";
- else if (which_alternative == 1)
- return \"subr.32\\t%0,%2,%1\";
- else if (which_alternative == 2)
- return \"sub.32\\t%0,%1,%2\";
- else
- return \"sub.64\\t%0,%2 ; I only want 32\";
-")
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
- (minus:HI (match_operand:HI 1 "general_operand" "0,m,r,0")
- (match_operand:HI 2 "general_operand" "m,r,m,g")))]
- "1 /*which_alternative == 0 || check356(operands[which_alternative])*/"
- "*
- if (which_alternative == 0)
- return \"sub.16\\t%0,%2\";
- else if (which_alternative == 1)
- return \"subr.16\\t%0,%2,%1\";
- else if (which_alternative == 2)
- return \"sub.16\\t%0,%1,%2\";
- else
- return \"sub.64\\t%0,%2 ; I only want 16\";
-")
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (mult:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "rm")))]
- ""
- "fmul.64\\t%0,%2")
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (mult:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "rm")))]
- ""
- "fmul.32\\t%0,%2")
-
-(define_insn "muldi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (mult:DI (match_operand:DI 1 "general_operand" "%0,r")
- (match_operand:DI 2 "general_operand" "g,g")))]
- "1 /*which_alternative == 0 || check356(operands[2])*/"
- "*
- if (which_alternative == 0)
- return \"mul.64\\t%0,%2\";
- return \"mul.64\\t%0,%1,%2\";
-")
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (mult:SI (match_operand:SI 1 "general_operand" "%0,r,0")
- (match_operand:SI 2 "general_operand" "m,m,g")))]
- "1 /*which_alternative == 0 || check356(operands[2])*/"
- "*
- if (which_alternative == 0)
- return \"mul.32\\t%0,%2\";
- else if (which_alternative == 1)
- return \"mul.32\\t%0,%1,%2\";
- else
- return \"mul.64\\t%0,%2 ; I only want 32\";
-")
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r,r")
- (mult:HI (match_operand:HI 1 "general_operand" "%0,r,0")
- (match_operand:HI 2 "general_operand" "m,m,g")))]
- "1 /*which_alternative == 0 || check356(operands[2])*/"
- "*
- if (which_alternative == 0)
- return \"mul.16\\t%0,%2\";
- else if (which_alternative == 1)
- return \"mul.16\\t%0,%1,%2\";
- else
- return \"mul.64\\t%0,%2 ; I only want 16\";
-")
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (div:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "rm")))]
- ""
- "fdiv.64\\t%0,%2")
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (div:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "rm")))]
- ""
- "fdiv.32\\t%0,%2")
-
-(define_insn "divdi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r,r")
- (div:DI (match_operand:DI 1 "general_operand" "0,g,r")
- (match_operand:DI 2 "general_operand" "g,r,g")))]
- "1 /*which_alternative == 0 || check356(operands[which_alternative])*/"
- "*
- if (which_alternative == 0)
- return \"div.64\\t%0,%2\";
- else if (which_alternative == 1)
- return \"divr.64\\t%0,%2,%1\";
- else
- return \"div.64\\t%0,%1,%2\";
-")
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
- (div:SI (match_operand:SI 1 "general_operand" "0,m,r,0")
- (match_operand:SI 2 "general_operand" "m,r,m,g")))]
- "1 /*which_alternative == 0 || check356(operands[which_alternative])*/"
- "*
-/* We don't ignore high bits. */
-if (0) {
- if (which_alternative == 0)
- return \"div.32\\t%0,%2\";
- else if (which_alternative == 1)
- return \"divr.32\\t%0,%2,%1\";
- else if (which_alternative == 2)
- return \"div.32\\t%0,%1,%2\";
- else
- return \"ld.32\\t%0,%0\;div.64\\t%0,%2 ; I only want 32\";
-} else {
- if (which_alternative == 0)
- return \"ld.32\\t%0,%0\;div.32\\t%0,%2\";
- else if (which_alternative == 1)
- return \"ld.32\\t%2,%2\;divr.32\\t%0,%2,%1\";
- else if (which_alternative == 2)
- return \"ld.32\\t%1,%1\;div.32\\t%0,%1,%2\";
- else
- return \"ld.32\\t%0,%0\;div.64\\t%0,%2 ; I only want 32\";
-}
-")
-
-(define_insn "divhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
- (div:HI (match_operand:HI 1 "general_operand" "0,m,r,0,0")
- (match_operand:HI 2 "general_operand" "m,r,m,r,i")))]
- "1 /*which_alternative == 0 || check356(operands[which_alternative])*/"
- "*
- if (which_alternative == 0)
- return \"extract\\t%0,%0:bit 48,16\;div.16\\t%0,%2\";
- else if (which_alternative == 1)
- return \"extract\\t%2,%2:bit 48,16\;divr.16\\t%0,%2,%1\";
- else if (which_alternative == 2)
- return \"extract\\t%1,%1:bit 48,16\;div.16\\t%0,%1,%2\";
- else if (which_alternative == 3)
- return \"extract\\t%0,%0:bit 48,16\;extract\\t%2,%2:bit 48,16\;div.64\\t%0,%2 ; I only want 16\";
- else
- return \"extract\\t%0,%0:bit 48,16\;div.64\\t%0,%2 ; I only want 16\";
-")
-
-(define_insn "modhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
- (mod:HI (match_operand:HI 1 "general_operand" "0,m,r,0,0")
- (match_operand:HI 2 "general_operand" "m,r,m,r,i")))]
- "1 /*which_alternative == 0 || check356(operands[which_alternative])*/"
- "*
- if (which_alternative == 0)
- return \"extract\\t%0,%0:bit 48,16\;rem.16\\t%0,%2\";
- else if (which_alternative == 1)
- return \"extract\\t%2,%2:bit 48,16\;remr.16\\t%0,%2,%1\";
- else if (which_alternative == 2)
- return \"extract\\t%1,%1:bit 48,16\;rem.16\\t%0,%1,%2\";
- else if (which_alternative == 3)
- return \"extract\\t%0,%0:bit 48,16\;extract\\t%2,%2:bit 48,16\;rem.64\\t%0,%2 ; I only want 16\";
- else
- return \"extract\\t%0,%0:bit 48,16\;rem.64\\t%0,%2 ; I only want 16\";
-")
-
-(define_insn "moddi3"
- [(set (match_operand:DI 0 "register_operand" "=r,r,r")
- (mod:DI (match_operand:DI 1 "general_operand" "0,g,r")
- (match_operand:DI 2 "general_operand" "g,r,g")))]
- "1 /*which_alternative == 0 || check356(operands[which_alternative])*/"
- "*
- if (which_alternative == 0)
- return \"rem.64\\t%0,%2\";
- else if (which_alternative == 1)
- return \"remr.64\\t%0,%2,%1\";
- else
- return \"rem.64\\t%0,%1,%2\";
-")
-
-(define_insn "modsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
- (mod:SI (match_operand:SI 1 "general_operand" "0,m,r,0")
- (match_operand:SI 2 "general_operand" "m,r,m,g")))]
- "1 /*which_alternative == 0 || check356(operands[which_alternative])*/"
- "*
-/* There is a micro code bug with the below... */
-if (0) {
- if (which_alternative == 0)
- return \"rem.32\\t%0,%2\";
- else if (which_alternative == 1)
- return \"remr.32\\t%0,%2,%1\";
- else if (which_alternative == 2)
- return \"rem.32\\t%0,%1,%2\";
- else
- return \"ld.32\\t%0,%0\;rem.64\\t%0,%2 ; I only want 32\";
-} else {
- if (which_alternative == 0)
- return \"ld.32\\t%0,%0\;rem.32\\t%0,%2\";
- else if (which_alternative == 1)
- return \"ld.32\\t%2,%2\;remr.32\\t%0,%2,%1\";
- else if (which_alternative == 2)
- return \"ld.32\\t%1,%1\;rem.32\\t%0,%1,%2\";
- else
- return \"ld.32\\t%0,%0\;rem.64\\t%0,%2 ; I only want 32\";
-}
-")
-
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jmp\\t%l0")
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
- ""
-;; Maybe %l0 is better, maybe we can relax register only.
- "verify this before use ld.32\\t.r0,%0\;br.reg\\t.r0")
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"\", 2, operands[0]); ")
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"\", 8, operands[0]); ")
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"\", 0, operands[0]); ")
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"u\", 0, operands[0]); ")
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"\", 6, operands[0]); ")
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"u\", 6, operands[0]); ")
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"\", 4, operands[0]); ")
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"u\", 4, operands[0]); ")
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"\", 10, operands[0]); ")
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return cmp_jmp(\"u\", 10, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"\", 8, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"\", 2, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"\", 10, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"u\", 10, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"\", 4, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"u\", 4, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"\", 6, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"u\", 6, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"\", 0, operands[0]); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return cmp_jmp(\"u\", 0, operands[0]); ")
-
-;; Note that operand 1 is total size of args, in bytes,
-;; and what the call insn wants is the number of words.
-(define_insn "call"
- [(call (match_operand:QI 0 "general_operand" "m")
- (match_operand:QI 1 "general_operand" "g"))]
- ""
- "*
- if (GET_CODE (operands[0]) == MEM && GET_CODE (XEXP (operands[0], 0)) == REG)
- if (REGNO (XEXP (operands[0], 0)) != 0)
- return \"add.64\\t.sp,=-4\;ld.64\\t.r0,=.+11\;st.32\\t.r0,[.sp]\;br.reg\\t%r0\;add.64\\t.sp,=4\;add.64\\t.sp,%1\";
- else
- return \"add.64\\t.sp,=-4\;ld.64\\t.r1,=.+11\;st.32\\t.r1,[.sp]\;br.reg\\t%r0\;add.64\\t.sp,=4\;add.64\\t.sp,%1\";
- else
- return \"add.64\\t.sp,=-4\;call\\t%0\;add.64\\t.sp,=4\;add.64\\t.sp,%1\";
- ")
-
-(define_insn "call_value"
- [(set (match_operand 0 "" "g")
- (call (match_operand:QI 1 "general_operand" "m")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
- if (GET_CODE (operands[1]) == MEM && GET_CODE (XEXP (operands[1], 0)) == REG)
- if (REGNO (XEXP (operands[1], 0)) != 0)
- return \"add.64\\t.sp,=-4\;ld.64\\t.r0,=.+11\;st.32\\t.r0,[.sp]\;br.reg\\t%r1\;add.64\\t.sp,=4\;add.64\\t.sp,%2\";
- else
- return \"add.64\\t.sp,=-4\;ld.64\\t.r1,=.+11\;st.32\\t.r1,[.sp]\;br.reg\\t%r1\;add.64\\t.sp,=4\;add.64\\t.sp,%2\";
- else
- return \"add.64\\t.sp,=-4\;call\\t%1\;add.64\\t.sp,=4\;add.64\\t.sp,%2\";
- ")
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "br.reg\\t%0")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
diff --git a/gcc/config/elxsi/x-elxsi b/gcc/config/elxsi/x-elxsi
deleted file mode 100644
index 30a458d87b4..00000000000
--- a/gcc/config/elxsi/x-elxsi
+++ /dev/null
@@ -1,9 +0,0 @@
-# Our make needs a little help...
-MAKE=make
-
-# We don't support -g yet, so don't try and use it.
-CFLAGS =
-LIBGCC2_CFLAGS = -O2 $(GCC_CFLAGS)
-
-# Hide xmalloc so that it does not conflict with the one in libc.a, Ick!
-X_CFLAGS = -Dxmalloc=my_xmalloc
diff --git a/gcc/config/elxsi/xm-elxsi.h b/gcc/config/elxsi/xm-elxsi.h
deleted file mode 100644
index ab35a68ef6b..00000000000
--- a/gcc/config/elxsi/xm-elxsi.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Configuration for GNU C-compiler for Elxsi.
- Copyright (C) 1987, 1993 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 1, 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
diff --git a/gcc/config/float-i32.h b/gcc/config/float-i32.h
deleted file mode 100644
index c834926b085..00000000000
--- a/gcc/config/float-i32.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* float.h for target with only IEEE 32 bit floating point format */
-#ifndef _FLOAT_H_
-#define _FLOAT_H_
-/* Produced by enquire version 4.3, CWI, Amsterdam */
-
- /* Radix of exponent representation */
-#undef FLT_RADIX
-#define FLT_RADIX 2
- /* Number of base-FLT_RADIX digits in the significand of a float */
-#undef FLT_MANT_DIG
-#define FLT_MANT_DIG 24
- /* Number of decimal digits of precision in a float */
-#undef FLT_DIG
-#define FLT_DIG 6
- /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */
-#undef FLT_ROUNDS
-#define FLT_ROUNDS 1
- /* Difference between 1.0 and the minimum float greater than 1.0 */
-#undef FLT_EPSILON
-#define FLT_EPSILON 1.19209290e-07F
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
-#undef FLT_MIN_EXP
-#define FLT_MIN_EXP (-125)
- /* Minimum normalised float */
-#undef FLT_MIN
-#define FLT_MIN 1.17549435e-38F
- /* Minimum int x such that 10**x is a normalised float */
-#undef FLT_MIN_10_EXP
-#define FLT_MIN_10_EXP (-37)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
-#undef FLT_MAX_EXP
-#define FLT_MAX_EXP 128
- /* Maximum float */
-#undef FLT_MAX
-#define FLT_MAX 3.40282347e+38F
- /* Maximum int x such that 10**x is a representable float */
-#undef FLT_MAX_10_EXP
-#define FLT_MAX_10_EXP 38
-
- /* Number of base-FLT_RADIX digits in the significand of a double */
-#undef DBL_MANT_DIG
-#define DBL_MANT_DIG 24
- /* Number of decimal digits of precision in a double */
-#undef DBL_DIG
-#define DBL_DIG 6
- /* Difference between 1.0 and the minimum double greater than 1.0 */
-#undef DBL_EPSILON
-#define DBL_EPSILON 1.19209290e-07F
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
-#undef DBL_MIN_EXP
-#define DBL_MIN_EXP (-125)
- /* Minimum normalised double */
-#undef DBL_MIN
-#define DBL_MIN 1.17549435e-38F
- /* Minimum int x such that 10**x is a normalised double */
-#undef DBL_MIN_10_EXP
-#define DBL_MIN_10_EXP (-37)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
-#undef DBL_MAX_EXP
-#define DBL_MAX_EXP 128
- /* Maximum double */
-#undef DBL_MAX
-#define DBL_MAX 3.40282347e+38F
- /* Maximum int x such that 10**x is a representable double */
-#undef DBL_MAX_10_EXP
-#define DBL_MAX_10_EXP 38
-
- /* Number of base-FLT_RADIX digits in the significand of a long double */
-#undef LDBL_MANT_DIG
-#define LDBL_MANT_DIG 24
- /* Number of decimal digits of precision in a long double */
-#undef LDBL_DIG
-#define LDBL_DIG 6
- /* Difference between 1.0 and the minimum long double greater than 1.0 */
-#undef LDBL_EPSILON
-#define LDBL_EPSILON 1.19209290e-07F
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
-#undef LDBL_MIN_EXP
-#define LDBL_MIN_EXP (-125)
- /* Minimum normalised long double */
-#undef LDBL_MIN
-#define LDBL_MIN 1.17549435e-38F
- /* Minimum int x such that 10**x is a normalised long double */
-#undef LDBL_MIN_10_EXP
-#define LDBL_MIN_10_EXP (-37)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
-#undef LDBL_MAX_EXP
-#define LDBL_MAX_EXP 128
- /* Maximum long double */
-#undef LDBL_MAX
-#define LDBL_MAX 3.40282347e+38F
- /* Maximum int x such that 10**x is a representable long double */
-#undef LDBL_MAX_10_EXP
-#define LDBL_MAX_10_EXP 38
-
-#endif /* _FLOAT_H_ */
diff --git a/gcc/config/float-i64.h b/gcc/config/float-i64.h
deleted file mode 100644
index 7dbe4e92a10..00000000000
--- a/gcc/config/float-i64.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* float.h for target with IEEE 32 bit and 64 bit floating point formats */
-#ifndef _FLOAT_H_
-#define _FLOAT_H_
-/* Produced by enquire version 4.3, CWI, Amsterdam */
-
- /* Radix of exponent representation */
-#undef FLT_RADIX
-#define FLT_RADIX 2
- /* Number of base-FLT_RADIX digits in the significand of a float */
-#undef FLT_MANT_DIG
-#define FLT_MANT_DIG 24
- /* Number of decimal digits of precision in a float */
-#undef FLT_DIG
-#define FLT_DIG 6
- /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */
-#undef FLT_ROUNDS
-#define FLT_ROUNDS 1
- /* Difference between 1.0 and the minimum float greater than 1.0 */
-#undef FLT_EPSILON
-#define FLT_EPSILON 1.19209290e-07F
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
-#undef FLT_MIN_EXP
-#define FLT_MIN_EXP (-125)
- /* Minimum normalised float */
-#undef FLT_MIN
-#define FLT_MIN 1.17549435e-38F
- /* Minimum int x such that 10**x is a normalised float */
-#undef FLT_MIN_10_EXP
-#define FLT_MIN_10_EXP (-37)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
-#undef FLT_MAX_EXP
-#define FLT_MAX_EXP 128
- /* Maximum float */
-#undef FLT_MAX
-#define FLT_MAX 3.40282347e+38F
- /* Maximum int x such that 10**x is a representable float */
-#undef FLT_MAX_10_EXP
-#define FLT_MAX_10_EXP 38
-
- /* Number of base-FLT_RADIX digits in the significand of a double */
-#undef DBL_MANT_DIG
-#define DBL_MANT_DIG 53
- /* Number of decimal digits of precision in a double */
-#undef DBL_DIG
-#define DBL_DIG 15
- /* Difference between 1.0 and the minimum double greater than 1.0 */
-#undef DBL_EPSILON
-#define DBL_EPSILON 2.2204460492503131e-16
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
-#undef DBL_MIN_EXP
-#define DBL_MIN_EXP (-1021)
- /* Minimum normalised double */
-#undef DBL_MIN
-#define DBL_MIN 2.2250738585072014e-308
- /* Minimum int x such that 10**x is a normalised double */
-#undef DBL_MIN_10_EXP
-#define DBL_MIN_10_EXP (-307)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
-#undef DBL_MAX_EXP
-#define DBL_MAX_EXP 1024
- /* Maximum double */
-#undef DBL_MAX
-#define DBL_MAX 1.7976931348623157e+308
- /* Maximum int x such that 10**x is a representable double */
-#undef DBL_MAX_10_EXP
-#define DBL_MAX_10_EXP 308
-
- /* Number of base-FLT_RADIX digits in the significand of a long double */
-#undef LDBL_MANT_DIG
-#define LDBL_MANT_DIG 53
- /* Number of decimal digits of precision in a long double */
-#undef LDBL_DIG
-#define LDBL_DIG 15
- /* Difference between 1.0 and the minimum long double greater than 1.0 */
-#undef LDBL_EPSILON
-#define LDBL_EPSILON 2.2204460492503131e-16L
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
-#undef LDBL_MIN_EXP
-#define LDBL_MIN_EXP (-1021)
- /* Minimum normalised long double */
-#undef LDBL_MIN
-#define LDBL_MIN 2.2250738585072014e-308L
- /* Minimum int x such that 10**x is a normalised long double */
-#undef LDBL_MIN_10_EXP
-#define LDBL_MIN_10_EXP (-307)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
-#undef LDBL_MAX_EXP
-#define LDBL_MAX_EXP 1024
- /* Maximum long double */
-#undef LDBL_MAX
-#define LDBL_MAX 1.7976931348623157e+308L
- /* Maximum int x such that 10**x is a representable long double */
-#undef LDBL_MAX_10_EXP
-#define LDBL_MAX_10_EXP 308
-
-#endif /* _FLOAT_H_ */
diff --git a/gcc/config/float-sh.h b/gcc/config/float-sh.h
deleted file mode 100644
index 9a942987920..00000000000
--- a/gcc/config/float-sh.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* float.h for target sh3e with optional IEEE 32 bit double format */
-#ifndef _FLOAT_H_
-#define _FLOAT_H_
-/* Produced by enquire version 4.3, CWI, Amsterdam */
-
- /* Radix of exponent representation */
-#undef FLT_RADIX
-#define FLT_RADIX 2
- /* Number of base-FLT_RADIX digits in the significand of a float */
-#undef FLT_MANT_DIG
-#define FLT_MANT_DIG 24
- /* Number of decimal digits of precision in a float */
-#undef FLT_DIG
-#define FLT_DIG 6
- /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */
-#undef FLT_ROUNDS
-#define FLT_ROUNDS 1
- /* Difference between 1.0 and the minimum float greater than 1.0 */
-#undef FLT_EPSILON
-#define FLT_EPSILON 1.19209290e-07F
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
-#undef FLT_MIN_EXP
-#define FLT_MIN_EXP (-125)
- /* Minimum normalised float */
-#undef FLT_MIN
-#define FLT_MIN 1.17549435e-38F
- /* Minimum int x such that 10**x is a normalised float */
-#undef FLT_MIN_10_EXP
-#define FLT_MIN_10_EXP (-37)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
-#undef FLT_MAX_EXP
-#define FLT_MAX_EXP 128
- /* Maximum float */
-#undef FLT_MAX
-#define FLT_MAX 3.40282347e+38F
- /* Maximum int x such that 10**x is a representable float */
-#undef FLT_MAX_10_EXP
-#define FLT_MAX_10_EXP 38
-
-#ifdef __SH3E__
-
- /* Number of base-FLT_RADIX digits in the significand of a double */
-#undef DBL_MANT_DIG
-#define DBL_MANT_DIG 24
- /* Number of decimal digits of precision in a double */
-#undef DBL_DIG
-#define DBL_DIG 6
- /* Difference between 1.0 and the minimum double greater than 1.0 */
-#undef DBL_EPSILON
-#define DBL_EPSILON 1.19209290e-07F
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
-#undef DBL_MIN_EXP
-#define DBL_MIN_EXP (-125)
- /* Minimum normalised double */
-#undef DBL_MIN
-#define DBL_MIN 1.17549435e-38F
- /* Minimum int x such that 10**x is a normalised double */
-#undef DBL_MIN_10_EXP
-#define DBL_MIN_10_EXP (-37)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
-#undef DBL_MAX_EXP
-#define DBL_MAX_EXP 128
- /* Maximum double */
-#undef DBL_MAX
-#define DBL_MAX 3.40282347e+38F
- /* Maximum int x such that 10**x is a representable double */
-#undef DBL_MAX_10_EXP
-#define DBL_MAX_10_EXP 38
-
-#else
-
- /* Number of base-FLT_RADIX digits in the significand of a double */
-#undef DBL_MANT_DIG
-#define DBL_MANT_DIG 53
- /* Number of decimal digits of precision in a double */
-#undef DBL_DIG
-#define DBL_DIG 15
- /* Difference between 1.0 and the minimum double greater than 1.0 */
-#undef DBL_EPSILON
-#define DBL_EPSILON 2.2204460492503131e-16
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
-#undef DBL_MIN_EXP
-#define DBL_MIN_EXP (-1021)
- /* Minimum normalised double */
-#undef DBL_MIN
-#define DBL_MIN 2.2250738585072014e-308
- /* Minimum int x such that 10**x is a normalised double */
-#undef DBL_MIN_10_EXP
-#define DBL_MIN_10_EXP (-307)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
-#undef DBL_MAX_EXP
-#define DBL_MAX_EXP 1024
- /* Maximum double */
-#undef DBL_MAX
-#define DBL_MAX 1.7976931348623157e+308
- /* Maximum int x such that 10**x is a representable double */
-#undef DBL_MAX_10_EXP
-#define DBL_MAX_10_EXP 308
-
-#endif
-
- /* Number of base-FLT_RADIX digits in the significand of a long double */
-#undef LDBL_MANT_DIG
-#define LDBL_MANT_DIG 53
- /* Number of decimal digits of precision in a long double */
-#undef LDBL_DIG
-#define LDBL_DIG 15
- /* Difference between 1.0 and the minimum long double greater than 1.0 */
-#undef LDBL_EPSILON
-#define LDBL_EPSILON 2.2204460492503131e-16
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
-#undef LDBL_MIN_EXP
-#define LDBL_MIN_EXP (-1021)
- /* Minimum normalised long double */
-#undef LDBL_MIN
-#define LDBL_MIN 2.2250738585072014e-308
- /* Minimum int x such that 10**x is a normalised long double */
-#undef LDBL_MIN_10_EXP
-#define LDBL_MIN_10_EXP (-307)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
-#undef LDBL_MAX_EXP
-#define LDBL_MAX_EXP 1024
- /* Maximum long double */
-#undef LDBL_MAX
-#define LDBL_MAX 1.7976931348623157e+308
- /* Maximum int x such that 10**x is a representable long double */
-#undef LDBL_MAX_10_EXP
-#define LDBL_MAX_10_EXP 308
-
-#endif /* _FLOAT_H_ */
diff --git a/gcc/config/float-vax.h b/gcc/config/float-vax.h
deleted file mode 100644
index 3c87f795ef2..00000000000
--- a/gcc/config/float-vax.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* float.h for target with VAX floating point formats */
-#ifndef _FLOAT_H_
-#define _FLOAT_H_
-/* Produced by enquire version 4.3, CWI, Amsterdam */
-
- /* Radix of exponent representation */
-#undef FLT_RADIX
-#define FLT_RADIX 2
- /* Number of base-FLT_RADIX digits in the significand of a float */
-#undef FLT_MANT_DIG
-#define FLT_MANT_DIG 24
- /* Number of decimal digits of precision in a float */
-#undef FLT_DIG
-#define FLT_DIG 6
- /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */
-#undef FLT_ROUNDS
-#define FLT_ROUNDS 1
- /* Difference between 1.0 and the minimum float greater than 1.0 */
-#undef FLT_EPSILON
-#define FLT_EPSILON 1.19209290e-07F
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
-#undef FLT_MIN_EXP
-#define FLT_MIN_EXP (-127)
- /* Minimum normalised float */
-#undef FLT_MIN
-#define FLT_MIN 2.93873588e-39F
- /* Minimum int x such that 10**x is a normalised float */
-#undef FLT_MIN_10_EXP
-#define FLT_MIN_10_EXP (-38)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
-#undef FLT_MAX_EXP
-#define FLT_MAX_EXP 127
- /* Maximum float */
-#undef FLT_MAX
-#define FLT_MAX 1.70141173e+38F
- /* Maximum int x such that 10**x is a representable float */
-#undef FLT_MAX_10_EXP
-#define FLT_MAX_10_EXP 38
-
- /* Number of base-FLT_RADIX digits in the significand of a double */
-#undef DBL_MANT_DIG
-#define DBL_MANT_DIG 56
- /* Number of decimal digits of precision in a double */
-#undef DBL_DIG
-#define DBL_DIG 16
- /* Difference between 1.0 and the minimum double greater than 1.0 */
-#undef DBL_EPSILON
-#define DBL_EPSILON 2.77555756156289135e-17
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
-#undef DBL_MIN_EXP
-#define DBL_MIN_EXP (-127)
- /* Minimum normalised double */
-#undef DBL_MIN
-#define DBL_MIN 2.93873587705571877e-39
- /* Minimum int x such that 10**x is a normalised double */
-#undef DBL_MIN_10_EXP
-#define DBL_MIN_10_EXP (-38)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
-#undef DBL_MAX_EXP
-#define DBL_MAX_EXP 127
- /* Maximum double */
-#undef DBL_MAX
-#define DBL_MAX 1.70141183460469229e+38
- /* Maximum int x such that 10**x is a representable double */
-#undef DBL_MAX_10_EXP
-#define DBL_MAX_10_EXP 38
-
- /* Number of base-FLT_RADIX digits in the significand of a long double */
-#undef LDBL_MANT_DIG
-#define LDBL_MANT_DIG 56
- /* Number of decimal digits of precision in a long double */
-#undef LDBL_DIG
-#define LDBL_DIG 16
- /* Difference between 1.0 and the minimum long double greater than 1.0 */
-#undef LDBL_EPSILON
-#define LDBL_EPSILON 2.77555756156289135e-17
- /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
-#undef LDBL_MIN_EXP
-#define LDBL_MIN_EXP (-127)
- /* Minimum normalised long double */
-#undef LDBL_MIN
-#define LDBL_MIN 2.93873587705571877e-39
- /* Minimum int x such that 10**x is a normalised long double */
-#undef LDBL_MIN_10_EXP
-#define LDBL_MIN_10_EXP (-38)
- /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
-#undef LDBL_MAX_EXP
-#define LDBL_MAX_EXP 127
- /* Maximum long double */
-#undef LDBL_MAX
-#define LDBL_MAX 1.70141183460469229e+38
- /* Maximum int x such that 10**x is a representable long double */
-#undef LDBL_MAX_10_EXP
-#define LDBL_MAX_10_EXP 38
-
-#endif /* _FLOAT_H_ */
diff --git a/gcc/config/fp-bit.c b/gcc/config/fp-bit.c
deleted file mode 100644
index b8bf9cd3d02..00000000000
--- a/gcc/config/fp-bit.c
+++ /dev/null
@@ -1,1406 +0,0 @@
-/* This is a software floating point library which can be used instead of
- the floating point routines in libgcc1.c for targets without hardware
- floating point. */
-
-/* Copyright (C) 1994, 1995, 1996 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, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file 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; 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 link this library with other files,
- some of which are compiled with GCC, to produce an executable,
- this library 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. */
-
-/* This implements IEEE 754 format arithmetic, but does not provide a
- mechanism for setting the rounding mode, or for generating or handling
- exceptions.
-
- The original code by Steve Chamberlain, hacked by Mark Eichin and Jim
- Wilson, all of Cygnus Support. */
-
-/* The intended way to use this file is to make two copies, add `#define FLOAT'
- to one copy, then compile both copies and add them to libgcc.a. */
-
-/* The following macros can be defined to change the behaviour of this file:
- FLOAT: Implement a `float', aka SFmode, fp library. If this is not
- defined, then this file implements a `double', aka DFmode, fp library.
- FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e.
- don't include float->double conversion which requires the double library.
- This is useful only for machines which can't support doubles, e.g. some
- 8-bit processors.
- CMPtype: Specify the type that floating point compares should return.
- This defaults to SItype, aka int.
- US_SOFTWARE_GOFAST: This makes all entry points use the same names as the
- US Software goFast library. If this is not defined, the entry points use
- the same names as libgcc1.c.
- _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding
- two integers to the FLO_union_type.
- NO_NANS: Disable nan and infinity handling
- SMALL_MACHINE: Useful when operations on QIs and HIs are faster
- than on an SI */
-
-/* We don't currently support extended floats (long doubles) on machines
- without hardware to deal with them.
-
- These stubs are just to keep the linker from complaining about unresolved
- references which can be pulled in from libio & libstdc++, even if the
- user isn't using long doubles. However, they may generate an unresolved
- external to abort if abort is not used by the function, and the stubs
- are referenced from within libc, since libgcc goes before and after the
- system library. */
-
-#ifdef EXTENDED_FLOAT_STUBS
-__truncxfsf2 (){ abort(); }
-__extendsfxf2 (){ abort(); }
-__addxf3 (){ abort(); }
-__divxf3 (){ abort(); }
-__eqxf2 (){ abort(); }
-__extenddfxf2 (){ abort(); }
-__gtxf2 (){ abort(); }
-__lexf2 (){ abort(); }
-__ltxf2 (){ abort(); }
-__mulxf3 (){ abort(); }
-__negxf2 (){ abort(); }
-__nexf2 (){ abort(); }
-__subxf3 (){ abort(); }
-__truncxfdf2 (){ abort(); }
-
-__trunctfsf2 (){ abort(); }
-__extendsftf2 (){ abort(); }
-__addtf3 (){ abort(); }
-__divtf3 (){ abort(); }
-__eqtf2 (){ abort(); }
-__extenddftf2 (){ abort(); }
-__gttf2 (){ abort(); }
-__letf2 (){ abort(); }
-__lttf2 (){ abort(); }
-__multf3 (){ abort(); }
-__negtf2 (){ abort(); }
-__netf2 (){ abort(); }
-__subtf3 (){ abort(); }
-__trunctfdf2 (){ abort(); }
-#else /* !EXTENDED_FLOAT_STUBS, rest of file */
-
-
-typedef SFtype __attribute__ ((mode (SF)));
-typedef DFtype __attribute__ ((mode (DF)));
-
-typedef int HItype __attribute__ ((mode (HI)));
-typedef int SItype __attribute__ ((mode (SI)));
-typedef int DItype __attribute__ ((mode (DI)));
-
-/* The type of the result of a fp compare */
-#ifndef CMPtype
-#define CMPtype SItype
-#endif
-
-typedef unsigned int UHItype __attribute__ ((mode (HI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-typedef unsigned int UDItype __attribute__ ((mode (DI)));
-
-#define MAX_SI_INT ((SItype) ((unsigned) (~0)>>1))
-#define MAX_USI_INT ((USItype) ~0)
-
-
-#ifdef FLOAT_ONLY
-#define NO_DI_MODE
-#endif
-
-#ifdef FLOAT
-# define NGARDS 7L
-# define GARDROUND 0x3f
-# define GARDMASK 0x7f
-# define GARDMSB 0x40
-# define EXPBITS 8
-# define EXPBIAS 127
-# define FRACBITS 23
-# define EXPMAX (0xff)
-# define QUIET_NAN 0x100000L
-# define FRAC_NBITS 32
-# define FRACHIGH 0x80000000L
-# define FRACHIGH2 0xc0000000L
-# define pack_d pack_f
-# define unpack_d unpack_f
- typedef USItype fractype;
- typedef UHItype halffractype;
- typedef SFtype FLO_type;
- typedef SItype intfrac;
-
-#else
-# define PREFIXFPDP dp
-# define PREFIXSFDF df
-# define NGARDS 8L
-# define GARDROUND 0x7f
-# define GARDMASK 0xff
-# define GARDMSB 0x80
-# define EXPBITS 11
-# define EXPBIAS 1023
-# define FRACBITS 52
-# define EXPMAX (0x7ff)
-# define QUIET_NAN 0x8000000000000LL
-# define FRAC_NBITS 64
-# define FRACHIGH 0x8000000000000000LL
-# define FRACHIGH2 0xc000000000000000LL
- typedef UDItype fractype;
- typedef USItype halffractype;
- typedef DFtype FLO_type;
- typedef DItype intfrac;
-#endif
-
-#ifdef US_SOFTWARE_GOFAST
-# ifdef FLOAT
-# define add fpadd
-# define sub fpsub
-# define multiply fpmul
-# define divide fpdiv
-# define compare fpcmp
-# define si_to_float sitofp
-# define float_to_si fptosi
-# define float_to_usi fptoui
-# define negate __negsf2
-# define sf_to_df fptodp
-# define dptofp dptofp
-#else
-# define add dpadd
-# define sub dpsub
-# define multiply dpmul
-# define divide dpdiv
-# define compare dpcmp
-# define si_to_float litodp
-# define float_to_si dptoli
-# define float_to_usi dptoul
-# define negate __negdf2
-# define df_to_sf dptofp
-#endif
-#else
-# ifdef FLOAT
-# define add __addsf3
-# define sub __subsf3
-# define multiply __mulsf3
-# define divide __divsf3
-# define compare __cmpsf2
-# define _eq_f2 __eqsf2
-# define _ne_f2 __nesf2
-# define _gt_f2 __gtsf2
-# define _ge_f2 __gesf2
-# define _lt_f2 __ltsf2
-# define _le_f2 __lesf2
-# define si_to_float __floatsisf
-# define float_to_si __fixsfsi
-# define float_to_usi __fixunssfsi
-# define negate __negsf2
-# define sf_to_df __extendsfdf2
-#else
-# define add __adddf3
-# define sub __subdf3
-# define multiply __muldf3
-# define divide __divdf3
-# define compare __cmpdf2
-# define _eq_f2 __eqdf2
-# define _ne_f2 __nedf2
-# define _gt_f2 __gtdf2
-# define _ge_f2 __gedf2
-# define _lt_f2 __ltdf2
-# define _le_f2 __ledf2
-# define si_to_float __floatsidf
-# define float_to_si __fixdfsi
-# define float_to_usi __fixunsdfsi
-# define negate __negdf2
-# define df_to_sf __truncdfsf2
-# endif
-#endif
-
-
-#define INLINE __inline__
-
-/* Preserve the sticky-bit when shifting fractions to the right. */
-#define LSHIFT(a) { a = (a & 1) | (a >> 1); }
-
-/* numeric parameters */
-/* F_D_BITOFF is the number of bits offset between the MSB of the mantissa
- of a float and of a double. Assumes there are only two float types.
- (double::FRAC_BITS+double::NGARGS-(float::FRAC_BITS-float::NGARDS))
- */
-#define F_D_BITOFF (52+8-(23+7))
-
-
-#define NORMAL_EXPMIN (-(EXPBIAS)+1)
-#define IMPLICIT_1 (1LL<<(FRACBITS+NGARDS))
-#define IMPLICIT_2 (1LL<<(FRACBITS+1+NGARDS))
-
-/* common types */
-
-typedef enum
-{
- CLASS_SNAN,
- CLASS_QNAN,
- CLASS_ZERO,
- CLASS_NUMBER,
- CLASS_INFINITY
-} fp_class_type;
-
-typedef struct
-{
-#ifdef SMALL_MACHINE
- char class;
- unsigned char sign;
- short normal_exp;
-#else
- fp_class_type class;
- unsigned int sign;
- int normal_exp;
-#endif
-
- union
- {
- fractype ll;
- halffractype l[2];
- } fraction;
-} fp_number_type;
-
-typedef union
-{
- FLO_type value;
- fractype value_raw;
-
-#ifndef FLOAT
- halffractype words[2];
-#endif
-
-#ifdef FLOAT_BIT_ORDER_MISMATCH
- struct
- {
- fractype fraction:FRACBITS __attribute__ ((packed));
- unsigned int exp:EXPBITS __attribute__ ((packed));
- unsigned int sign:1 __attribute__ ((packed));
- }
- bits;
-#endif
-
-#ifdef _DEBUG_BITFLOAT
- struct
- {
- unsigned int sign:1 __attribute__ ((packed));
- unsigned int exp:EXPBITS __attribute__ ((packed));
- fractype fraction:FRACBITS __attribute__ ((packed));
- }
- bits_big_endian;
-
- struct
- {
- fractype fraction:FRACBITS __attribute__ ((packed));
- unsigned int exp:EXPBITS __attribute__ ((packed));
- unsigned int sign:1 __attribute__ ((packed));
- }
- bits_little_endian;
-#endif
-}
-FLO_union_type;
-
-
-/* end of header */
-
-/* IEEE "special" number predicates */
-
-#ifdef NO_NANS
-
-#define nan() 0
-#define isnan(x) 0
-#define isinf(x) 0
-#else
-
-INLINE
-static fp_number_type *
-nan ()
-{
- static fp_number_type thenan;
-
- return &thenan;
-}
-
-INLINE
-static int
-isnan ( fp_number_type * x)
-{
- return x->class == CLASS_SNAN || x->class == CLASS_QNAN;
-}
-
-INLINE
-static int
-isinf ( fp_number_type * x)
-{
- return x->class == CLASS_INFINITY;
-}
-
-#endif
-
-INLINE
-static int
-iszero ( fp_number_type * x)
-{
- return x->class == CLASS_ZERO;
-}
-
-INLINE
-static void
-flip_sign ( fp_number_type * x)
-{
- x->sign = !x->sign;
-}
-
-static FLO_type
-pack_d ( fp_number_type * src)
-{
- FLO_union_type dst;
- fractype fraction = src->fraction.ll; /* wasn't unsigned before? */
- int sign = src->sign;
- int exp = 0;
-
- if (isnan (src))
- {
- exp = EXPMAX;
- if (src->class == CLASS_QNAN || 1)
- {
- fraction |= QUIET_NAN;
- }
- }
- else if (isinf (src))
- {
- exp = EXPMAX;
- fraction = 0;
- }
- else if (iszero (src))
- {
- exp = 0;
- fraction = 0;
- }
- else if (fraction == 0)
- {
- exp = 0;
- sign = 0;
- }
- else
- {
- if (src->normal_exp < NORMAL_EXPMIN)
- {
- /* This number's exponent is too low to fit into the bits
- available in the number, so we'll store 0 in the exponent and
- shift the fraction to the right to make up for it. */
-
- int shift = NORMAL_EXPMIN - src->normal_exp;
-
- exp = 0;
-
- if (shift > FRAC_NBITS - NGARDS)
- {
- /* No point shifting, since it's more that 64 out. */
- fraction = 0;
- }
- else
- {
- /* Shift by the value */
- fraction >>= shift;
- }
- fraction >>= NGARDS;
- }
- else if (src->normal_exp > EXPBIAS)
- {
- exp = EXPMAX;
- fraction = 0;
- }
- else
- {
- exp = src->normal_exp + EXPBIAS;
- /* IF the gard bits are the all zero, but the first, then we're
- half way between two numbers, choose the one which makes the
- lsb of the answer 0. */
- if ((fraction & GARDMASK) == GARDMSB)
- {
- if (fraction & (1 << NGARDS))
- fraction += GARDROUND + 1;
- }
- else
- {
- /* Add a one to the guards to round up */
- fraction += GARDROUND;
- }
- if (fraction >= IMPLICIT_2)
- {
- fraction >>= 1;
- exp += 1;
- }
- fraction >>= NGARDS;
- }
- }
-
- /* We previously used bitfields to store the number, but this doesn't
- handle little/big endian systems conviently, so use shifts and
- masks */
-#ifdef FLOAT_BIT_ORDER_MISMATCH
- dst.bits.fraction = fraction;
- dst.bits.exp = exp;
- dst.bits.sign = sign;
-#else
- dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1);
- dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS;
- dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS);
-#endif
-
-#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT)
- {
- halffractype tmp = dst.words[0];
- dst.words[0] = dst.words[1];
- dst.words[1] = tmp;
- }
-#endif
-
- return dst.value;
-}
-
-static void
-unpack_d (FLO_union_type * src, fp_number_type * dst)
-{
- /* We previously used bitfields to store the number, but this doesn't
- handle little/big endian systems conviently, so use shifts and
- masks */
- fractype fraction;
- int exp;
- int sign;
-
-#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT)
- FLO_union_type swapped;
-
- swapped.words[0] = src->words[1];
- swapped.words[1] = src->words[0];
- src = &swapped;
-#endif
-
-#ifdef FLOAT_BIT_ORDER_MISMATCH
- fraction = src->bits.fraction;
- exp = src->bits.exp;
- sign = src->bits.sign;
-#else
- fraction = src->value_raw & ((((fractype)1) << FRACBITS) - (fractype)1);
- exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1);
- sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1;
-#endif
-
- dst->sign = sign;
- if (exp == 0)
- {
- /* Hmm. Looks like 0 */
- if (fraction == 0)
- {
- /* tastes like zero */
- dst->class = CLASS_ZERO;
- }
- else
- {
- /* Zero exponent with non zero fraction - it's denormalized,
- so there isn't a leading implicit one - we'll shift it so
- it gets one. */
- dst->normal_exp = exp - EXPBIAS + 1;
- fraction <<= NGARDS;
-
- dst->class = CLASS_NUMBER;
-#if 1
- while (fraction < IMPLICIT_1)
- {
- fraction <<= 1;
- dst->normal_exp--;
- }
-#endif
- dst->fraction.ll = fraction;
- }
- }
- else if (exp == EXPMAX)
- {
- /* Huge exponent*/
- if (fraction == 0)
- {
- /* Attached to a zero fraction - means infinity */
- dst->class = CLASS_INFINITY;
- }
- else
- {
- /* Non zero fraction, means nan */
- if (sign)
- {
- dst->class = CLASS_SNAN;
- }
- else
- {
- dst->class = CLASS_QNAN;
- }
- /* Keep the fraction part as the nan number */
- dst->fraction.ll = fraction;
- }
- }
- else
- {
- /* Nothing strange about this number */
- dst->normal_exp = exp - EXPBIAS;
- dst->class = CLASS_NUMBER;
- dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1;
- }
-}
-
-static fp_number_type *
-_fpadd_parts (fp_number_type * a,
- fp_number_type * b,
- fp_number_type * tmp)
-{
- intfrac tfraction;
-
- /* Put commonly used fields in local variables. */
- int a_normal_exp;
- int b_normal_exp;
- fractype a_fraction;
- fractype b_fraction;
-
- if (isnan (a))
- {
- return a;
- }
- if (isnan (b))
- {
- return b;
- }
- if (isinf (a))
- {
- /* Adding infinities with opposite signs yields a NaN. */
- if (isinf (b) && a->sign != b->sign)
- return nan ();
- return a;
- }
- if (isinf (b))
- {
- return b;
- }
- if (iszero (b))
- {
- return a;
- }
- if (iszero (a))
- {
- return b;
- }
-
- /* Got two numbers. shift the smaller and increment the exponent till
- they're the same */
- {
- int diff;
-
- a_normal_exp = a->normal_exp;
- b_normal_exp = b->normal_exp;
- a_fraction = a->fraction.ll;
- b_fraction = b->fraction.ll;
-
- diff = a_normal_exp - b_normal_exp;
-
- if (diff < 0)
- diff = -diff;
- if (diff < FRAC_NBITS)
- {
- /* ??? This does shifts one bit at a time. Optimize. */
- while (a_normal_exp > b_normal_exp)
- {
- b_normal_exp++;
- LSHIFT (b_fraction);
- }
- while (b_normal_exp > a_normal_exp)
- {
- a_normal_exp++;
- LSHIFT (a_fraction);
- }
- }
- else
- {
- /* Somethings's up.. choose the biggest */
- if (a_normal_exp > b_normal_exp)
- {
- b_normal_exp = a_normal_exp;
- b_fraction = 0;
- }
- else
- {
- a_normal_exp = b_normal_exp;
- a_fraction = 0;
- }
- }
- }
-
- if (a->sign != b->sign)
- {
- if (a->sign)
- {
- tfraction = -a_fraction + b_fraction;
- }
- else
- {
- tfraction = a_fraction - b_fraction;
- }
- if (tfraction > 0)
- {
- tmp->sign = 0;
- tmp->normal_exp = a_normal_exp;
- tmp->fraction.ll = tfraction;
- }
- else
- {
- tmp->sign = 1;
- tmp->normal_exp = a_normal_exp;
- tmp->fraction.ll = -tfraction;
- }
- /* and renormalize it */
-
- while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll)
- {
- tmp->fraction.ll <<= 1;
- tmp->normal_exp--;
- }
- }
- else
- {
- tmp->sign = a->sign;
- tmp->normal_exp = a_normal_exp;
- tmp->fraction.ll = a_fraction + b_fraction;
- }
- tmp->class = CLASS_NUMBER;
- /* Now the fraction is added, we have to shift down to renormalize the
- number */
-
- if (tmp->fraction.ll >= IMPLICIT_2)
- {
- LSHIFT (tmp->fraction.ll);
- tmp->normal_exp++;
- }
- return tmp;
-
-}
-
-FLO_type
-add (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
- fp_number_type tmp;
- fp_number_type *res;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- res = _fpadd_parts (&a, &b, &tmp);
-
- return pack_d (res);
-}
-
-FLO_type
-sub (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
- fp_number_type tmp;
- fp_number_type *res;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- b.sign ^= 1;
-
- res = _fpadd_parts (&a, &b, &tmp);
-
- return pack_d (res);
-}
-
-static fp_number_type *
-_fpmul_parts ( fp_number_type * a,
- fp_number_type * b,
- fp_number_type * tmp)
-{
- fractype low = 0;
- fractype high = 0;
-
- if (isnan (a))
- {
- a->sign = a->sign != b->sign;
- return a;
- }
- if (isnan (b))
- {
- b->sign = a->sign != b->sign;
- return b;
- }
- if (isinf (a))
- {
- if (iszero (b))
- return nan ();
- a->sign = a->sign != b->sign;
- return a;
- }
- if (isinf (b))
- {
- if (iszero (a))
- {
- return nan ();
- }
- b->sign = a->sign != b->sign;
- return b;
- }
- if (iszero (a))
- {
- a->sign = a->sign != b->sign;
- return a;
- }
- if (iszero (b))
- {
- b->sign = a->sign != b->sign;
- return b;
- }
-
- /* Calculate the mantissa by multiplying both 64bit numbers to get a
- 128 bit number */
- {
- fractype x = a->fraction.ll;
- fractype ylow = b->fraction.ll;
- fractype yhigh = 0;
- int bit;
-
-#if defined(NO_DI_MODE)
- {
- /* ??? This does multiplies one bit at a time. Optimize. */
- for (bit = 0; bit < FRAC_NBITS; bit++)
- {
- int carry;
-
- if (x & 1)
- {
- carry = (low += ylow) < ylow;
- high += yhigh + carry;
- }
- yhigh <<= 1;
- if (ylow & FRACHIGH)
- {
- yhigh |= 1;
- }
- ylow <<= 1;
- x >>= 1;
- }
- }
-#elif defined(FLOAT)
- {
- /* Multiplying two 32 bit numbers to get a 64 bit number on
- a machine with DI, so we're safe */
-
- DItype answer = (DItype)(a->fraction.ll) * (DItype)(b->fraction.ll);
-
- high = answer >> 32;
- low = answer;
- }
-#else
- /* Doing a 64*64 to 128 */
- {
- UDItype nl = a->fraction.ll & 0xffffffff;
- UDItype nh = a->fraction.ll >> 32;
- UDItype ml = b->fraction.ll & 0xffffffff;
- UDItype mh = b->fraction.ll >>32;
- UDItype pp_ll = ml * nl;
- UDItype pp_hl = mh * nl;
- UDItype pp_lh = ml * nh;
- UDItype pp_hh = mh * nh;
- UDItype res2 = 0;
- UDItype res0 = 0;
- UDItype ps_hh__ = pp_hl + pp_lh;
- if (ps_hh__ < pp_hl)
- res2 += 0x100000000LL;
- pp_hl = (ps_hh__ << 32) & 0xffffffff00000000LL;
- res0 = pp_ll + pp_hl;
- if (res0 < pp_ll)
- res2++;
- res2 += ((ps_hh__ >> 32) & 0xffffffffL) + pp_hh;
- high = res2;
- low = res0;
- }
-#endif
- }
-
- tmp->normal_exp = a->normal_exp + b->normal_exp;
- tmp->sign = a->sign != b->sign;
-#ifdef FLOAT
- tmp->normal_exp += 2; /* ??????????????? */
-#else
- tmp->normal_exp += 4; /* ??????????????? */
-#endif
- while (high >= IMPLICIT_2)
- {
- tmp->normal_exp++;
- if (high & 1)
- {
- low >>= 1;
- low |= FRACHIGH;
- }
- high >>= 1;
- }
- while (high < IMPLICIT_1)
- {
- tmp->normal_exp--;
-
- high <<= 1;
- if (low & FRACHIGH)
- high |= 1;
- low <<= 1;
- }
- /* rounding is tricky. if we only round if it won't make us round later. */
-#if 0
- if (low & FRACHIGH2)
- {
- if (((high & GARDMASK) != GARDMSB)
- && (((high + 1) & GARDMASK) == GARDMSB))
- {
- /* don't round, it gets done again later. */
- }
- else
- {
- high++;
- }
- }
-#endif
- if ((high & GARDMASK) == GARDMSB)
- {
- if (high & (1 << NGARDS))
- {
- /* half way, so round to even */
- high += GARDROUND + 1;
- }
- else if (low)
- {
- /* but we really weren't half way */
- high += GARDROUND + 1;
- }
- }
- tmp->fraction.ll = high;
- tmp->class = CLASS_NUMBER;
- return tmp;
-}
-
-FLO_type
-multiply (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
- fp_number_type tmp;
- fp_number_type *res;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- res = _fpmul_parts (&a, &b, &tmp);
-
- return pack_d (res);
-}
-
-static fp_number_type *
-_fpdiv_parts (fp_number_type * a,
- fp_number_type * b,
- fp_number_type * tmp)
-{
- fractype low = 0;
- fractype high = 0;
- fractype r0, r1, y0, y1, bit;
- fractype q;
- fractype numerator;
- fractype denominator;
- fractype quotient;
- fractype remainder;
-
- if (isnan (a))
- {
- return a;
- }
- if (isnan (b))
- {
- return b;
- }
-
- a->sign = a->sign ^ b->sign;
-
- if (isinf (a) || iszero (a))
- {
- if (a->class == b->class)
- return nan ();
- return a;
- }
-
- if (isinf (b))
- {
- a->fraction.ll = 0;
- a->normal_exp = 0;
- return a;
- }
- if (iszero (b))
- {
- a->class = CLASS_INFINITY;
- return b;
- }
-
- /* Calculate the mantissa by multiplying both 64bit numbers to get a
- 128 bit number */
- {
- int carry;
- intfrac d0, d1; /* weren't unsigned before ??? */
-
- /* quotient =
- ( numerator / denominator) * 2^(numerator exponent - denominator exponent)
- */
-
- a->normal_exp = a->normal_exp - b->normal_exp;
- numerator = a->fraction.ll;
- denominator = b->fraction.ll;
-
- if (numerator < denominator)
- {
- /* Fraction will be less than 1.0 */
- numerator *= 2;
- a->normal_exp--;
- }
- bit = IMPLICIT_1;
- quotient = 0;
- /* ??? Does divide one bit at a time. Optimize. */
- while (bit)
- {
- if (numerator >= denominator)
- {
- quotient |= bit;
- numerator -= denominator;
- }
- bit >>= 1;
- numerator *= 2;
- }
-
- if ((quotient & GARDMASK) == GARDMSB)
- {
- if (quotient & (1 << NGARDS))
- {
- /* half way, so round to even */
- quotient += GARDROUND + 1;
- }
- else if (numerator)
- {
- /* but we really weren't half way, more bits exist */
- quotient += GARDROUND + 1;
- }
- }
-
- a->fraction.ll = quotient;
- return (a);
- }
-}
-
-FLO_type
-divide (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
- fp_number_type tmp;
- fp_number_type *res;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- res = _fpdiv_parts (&a, &b, &tmp);
-
- return pack_d (res);
-}
-
-/* according to the demo, fpcmp returns a comparison with 0... thus
- a<b -> -1
- a==b -> 0
- a>b -> +1
- */
-
-static int
-_fpcmp_parts (fp_number_type * a, fp_number_type * b)
-{
-#if 0
- /* either nan -> unordered. Must be checked outside of this routine. */
- if (isnan (a) && isnan (b))
- {
- return 1; /* still unordered! */
- }
-#endif
-
- if (isnan (a) || isnan (b))
- {
- return 1; /* how to indicate unordered compare? */
- }
- if (isinf (a) && isinf (b))
- {
- /* +inf > -inf, but +inf != +inf */
- /* b \a| +inf(0)| -inf(1)
- ______\+--------+--------
- +inf(0)| a==b(0)| a<b(-1)
- -------+--------+--------
- -inf(1)| a>b(1) | a==b(0)
- -------+--------+--------
- So since unordered must be non zero, just line up the columns...
- */
- return b->sign - a->sign;
- }
- /* but not both... */
- if (isinf (a))
- {
- return a->sign ? -1 : 1;
- }
- if (isinf (b))
- {
- return b->sign ? 1 : -1;
- }
- if (iszero (a) && iszero (b))
- {
- return 0;
- }
- if (iszero (a))
- {
- return b->sign ? 1 : -1;
- }
- if (iszero (b))
- {
- return a->sign ? -1 : 1;
- }
- /* now both are "normal". */
- if (a->sign != b->sign)
- {
- /* opposite signs */
- return a->sign ? -1 : 1;
- }
- /* same sign; exponents? */
- if (a->normal_exp > b->normal_exp)
- {
- return a->sign ? -1 : 1;
- }
- if (a->normal_exp < b->normal_exp)
- {
- return a->sign ? 1 : -1;
- }
- /* same exponents; check size. */
- if (a->fraction.ll > b->fraction.ll)
- {
- return a->sign ? -1 : 1;
- }
- if (a->fraction.ll < b->fraction.ll)
- {
- return a->sign ? 1 : -1;
- }
- /* after all that, they're equal. */
- return 0;
-}
-
-CMPtype
-compare (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- return _fpcmp_parts (&a, &b);
-}
-
-#ifndef US_SOFTWARE_GOFAST
-
-/* These should be optimized for their specific tasks someday. */
-
-CMPtype
-_eq_f2 (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- if (isnan (&a) || isnan (&b))
- return 1; /* false, truth == 0 */
-
- return _fpcmp_parts (&a, &b) ;
-}
-
-CMPtype
-_ne_f2 (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- if (isnan (&a) || isnan (&b))
- return 1; /* true, truth != 0 */
-
- return _fpcmp_parts (&a, &b) ;
-}
-
-CMPtype
-_gt_f2 (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- if (isnan (&a) || isnan (&b))
- return -1; /* false, truth > 0 */
-
- return _fpcmp_parts (&a, &b);
-}
-
-CMPtype
-_ge_f2 (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- if (isnan (&a) || isnan (&b))
- return -1; /* false, truth >= 0 */
- return _fpcmp_parts (&a, &b) ;
-}
-
-CMPtype
-_lt_f2 (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- if (isnan (&a) || isnan (&b))
- return 1; /* false, truth < 0 */
-
- return _fpcmp_parts (&a, &b);
-}
-
-CMPtype
-_le_f2 (FLO_type arg_a, FLO_type arg_b)
-{
- fp_number_type a;
- fp_number_type b;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- unpack_d ((FLO_union_type *) & arg_b, &b);
-
- if (isnan (&a) || isnan (&b))
- return 1; /* false, truth <= 0 */
-
- return _fpcmp_parts (&a, &b) ;
-}
-
-#endif /* ! US_SOFTWARE_GOFAST */
-
-FLO_type
-si_to_float (SItype arg_a)
-{
- fp_number_type in;
-
- in.class = CLASS_NUMBER;
- in.sign = arg_a < 0;
- if (!arg_a)
- {
- in.class = CLASS_ZERO;
- }
- else
- {
- in.normal_exp = FRACBITS + NGARDS;
- if (in.sign)
- {
- /* Special case for minint, since there is no +ve integer
- representation for it */
- if (arg_a == 0x80000000)
- {
- return -2147483648.0;
- }
- in.fraction.ll = (-arg_a);
- }
- else
- in.fraction.ll = arg_a;
-
- while (in.fraction.ll < (1LL << (FRACBITS + NGARDS)))
- {
- in.fraction.ll <<= 1;
- in.normal_exp -= 1;
- }
- }
- return pack_d (&in);
-}
-
-SItype
-float_to_si (FLO_type arg_a)
-{
- fp_number_type a;
- SItype tmp;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- if (iszero (&a))
- return 0;
- if (isnan (&a))
- return 0;
- /* get reasonable MAX_SI_INT... */
- if (isinf (&a))
- return a.sign ? MAX_SI_INT : (-MAX_SI_INT)-1;
- /* it is a number, but a small one */
- if (a.normal_exp < 0)
- return 0;
- if (a.normal_exp > 30)
- return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT;
- tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp);
- return a.sign ? (-tmp) : (tmp);
-}
-
-#ifdef US_SOFTWARE_GOFAST
-/* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines,
- we also define them for GOFAST because the ones in libgcc2.c have the
- wrong names and I'd rather define these here and keep GOFAST CYG-LOC's
- out of libgcc2.c. We can't define these here if not GOFAST because then
- there'd be duplicate copies. */
-
-USItype
-float_to_usi (FLO_type arg_a)
-{
- fp_number_type a;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- if (iszero (&a))
- return 0;
- if (isnan (&a))
- return 0;
- /* get reasonable MAX_USI_INT... */
- if (isinf (&a))
- return a.sign ? MAX_USI_INT : 0;
- /* it is a negative number */
- if (a.sign)
- return 0;
- /* it is a number, but a small one */
- if (a.normal_exp < 0)
- return 0;
- if (a.normal_exp > 31)
- return MAX_USI_INT;
- else if (a.normal_exp > (FRACBITS + NGARDS))
- return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS));
- else
- return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp);
-}
-#endif
-
-FLO_type
-negate (FLO_type arg_a)
-{
- fp_number_type a;
-
- unpack_d ((FLO_union_type *) & arg_a, &a);
- flip_sign (&a);
- return pack_d (&a);
-}
-
-#ifdef FLOAT
-
-SFtype
-__make_fp(fp_class_type class,
- unsigned int sign,
- int exp,
- USItype frac)
-{
- fp_number_type in;
-
- in.class = class;
- in.sign = sign;
- in.normal_exp = exp;
- in.fraction.ll = frac;
- return pack_d (&in);
-}
-
-#ifndef FLOAT_ONLY
-
-/* This enables one to build an fp library that supports float but not double.
- Otherwise, we would get an undefined reference to __make_dp.
- This is needed for some 8-bit ports that can't handle well values that
- are 8-bytes in size, so we just don't support double for them at all. */
-
-extern DFtype __make_dp (fp_class_type, unsigned int, int, UDItype frac);
-
-DFtype
-sf_to_df (SFtype arg_a)
-{
- fp_number_type in;
-
- unpack_d ((FLO_union_type *) & arg_a, &in);
- return __make_dp (in.class, in.sign, in.normal_exp,
- ((UDItype) in.fraction.ll) << F_D_BITOFF);
-}
-
-#endif
-#endif
-
-#ifndef FLOAT
-
-extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype);
-
-DFtype
-__make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac)
-{
- fp_number_type in;
-
- in.class = class;
- in.sign = sign;
- in.normal_exp = exp;
- in.fraction.ll = frac;
- return pack_d (&in);
-}
-
-SFtype
-df_to_sf (DFtype arg_a)
-{
- fp_number_type in;
- USItype sffrac;
-
- unpack_d ((FLO_union_type *) & arg_a, &in);
-
- sffrac = in.fraction.ll >> F_D_BITOFF;
-
- /* We set the lowest guard bit in SFFRAC if we discarded any non
- zero bits. */
- if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0)
- sffrac |= 1;
-
- return __make_fp (in.class, in.sign, in.normal_exp, sffrac);
-}
-
-#endif
-#endif /* !EXTENDED_FLOAT_STUBS */
diff --git a/gcc/config/fx80/fx80.c b/gcc/config/fx80/fx80.c
deleted file mode 100644
index a87be41e5e8..00000000000
--- a/gcc/config/fx80/fx80.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/* Subroutines for insn-output.c for Alliant FX computers.
- Copyright (C) 1989,1991 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. */
-
-
-/* Some output-actions in alliant.md need these. */
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-
-/* Index into this array by (register number >> 3) to find the
- smallest class which contains that register. */
-enum reg_class regno_reg_class[]
- = { DATA_REGS, ADDR_REGS, FP_REGS };
-
-static rtx find_addr_reg ();
-
-char *
-output_btst (operands, countop, dataop, insn, signpos)
- rtx *operands;
- rtx countop, dataop;
- rtx insn;
- int signpos;
-{
- operands[0] = countop;
- operands[1] = dataop;
-
- if (GET_CODE (countop) == CONST_INT)
- {
- register int count = INTVAL (countop);
- /* If COUNT is bigger than size of storage unit in use,
- advance to the containing unit of same size. */
- if (count > signpos)
- {
- int offset = (count & ~signpos) / 8;
- count = count & signpos;
- operands[1] = dataop = adj_offsettable_operand (dataop, offset);
- }
- if (count == signpos)
- cc_status.flags = CC_NOT_POSITIVE | CC_Z_IN_NOT_N;
- else
- cc_status.flags = CC_NOT_NEGATIVE | CC_Z_IN_NOT_N;
-
- /* These three statements used to use next_insns_test_no...
- but it appears that this should do the same job. */
- if (count == 31
- && next_insn_tests_no_inequality (insn))
- return "tst%.l %1";
- if (count == 15
- && next_insn_tests_no_inequality (insn))
- return "tst%.w %1";
- if (count == 7
- && next_insn_tests_no_inequality (insn))
- return "tst%.b %1";
-
- cc_status.flags = CC_NOT_NEGATIVE;
- }
- return "btst %0,%1";
-}
-
-/* Return the best assembler insn template
- for moving operands[1] into operands[0] as a fullword. */
-
-static char *
-singlemove_string (operands)
- rtx *operands;
-{
- if (operands[1] != const0_rtx)
- return "mov%.l %1,%0";
- if (! ADDRESS_REG_P (operands[0]))
- return "clr%.l %0";
- return "sub%.l %0,%0";
-}
-
-/* Output assembler code to perform a doubleword move insn
- with operands OPERANDS. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum { REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP } optype0, optype1;
- rtx latehalf[2];
- rtx addreg0 = 0, addreg1 = 0;
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- optype0 = POPOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- optype0 = PUSHOP;
- else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1]))
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC)
- optype1 = POPOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- optype1 = PUSHOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP)
- abort ();
-
- /* If one operand is decrementing and one is incrementing
- decrement the former register explicitly
- and change that operand into ordinary indexing. */
-
- if (optype0 == PUSHOP && optype1 == POPOP)
- {
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
- output_asm_insn ("subq%.l %#8,%0", operands);
- operands[0] = gen_rtx (MEM, DImode, operands[0]);
- optype0 = OFFSOP;
- }
- if (optype0 == POPOP && optype1 == PUSHOP)
- {
- operands[1] = XEXP (XEXP (operands[1], 0), 0);
- output_asm_insn ("subq%.l %#8,%1", operands);
- operands[1] = gen_rtx (MEM, DImode, operands[1]);
- optype1 = OFFSOP;
- }
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (operands[0], 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (operands[1], 0));
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first,
- but if either operand is autodecrementing then we
- do the high-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], 4);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- else if (optype1 == CNSTOP)
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- split_double (operands[1], &operands[1], &latehalf[1]);
- else if (CONSTANT_P (operands[1]))
- {
- latehalf[1] = operands[1];
- operands[1] = const0_rtx;
- }
- }
- else
- latehalf[1] = operands[1];
-
- /* If insn is effectively movd N(sp),-(sp) then we will do the
- high word first. We should use the adjusted operand 1 (which is N+4(sp))
- for the low word as well, to compensate for the first decrement of sp. */
- if (optype0 == PUSHOP
- && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM
- && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1]))
- operands[1] = latehalf[1];
-
- /* If one or both operands autodecrementing,
- do the two words, high-numbered first. */
-
- /* Likewise, the first move would clobber the source of the second one,
- do them in the other order. This happens only for registers;
- such overlap can't happen in memory unless the user explicitly
- sets it up, and that is an undefined circumstance. */
-
- if (optype0 == PUSHOP || optype1 == PUSHOP
- || (optype0 == REGOP && optype1 == REGOP
- && REGNO (operands[0]) == REGNO (latehalf[1])))
- {
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("addql %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("addql %#4,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("subql %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("subql %#4,%0", &addreg1);
-
- /* Do low-numbered word. */
- return singlemove_string (operands);
- }
-
- /* Normal case: do the two words, low-numbered first. */
-
- output_asm_insn (singlemove_string (operands), operands);
-
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("addql %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("addql %#4,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("subql %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("subql %#4,%0", &addreg1);
-
- return "";
-}
-
-/* Return a REG that occurs in ADDR with coefficient 1.
- ADDR can be effectively incremented by incrementing REG. */
-
-static rtx
-find_addr_reg (addr)
- rtx addr;
-{
- while (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG)
- addr = XEXP (addr, 0);
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 0)))
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 1)))
- addr = XEXP (addr, 0);
- else
- abort ();
- }
- if (GET_CODE (addr) == REG)
- return addr;
- abort ();
-}
-
-int
-standard_SunFPA_constant_p (x)
- rtx x;
-{
- return( 0 );
-}
-
diff --git a/gcc/config/fx80/fx80.h b/gcc/config/fx80/fx80.h
deleted file mode 100644
index b56834a372c..00000000000
--- a/gcc/config/fx80/fx80.h
+++ /dev/null
@@ -1,1445 +0,0 @@
-/* Definitions of target machine for GNU compiler. Alliant FX version.
- Copyright (C) 1989, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Adapted from m68k.h by Paul Petersen (petersen@uicsrd.csrd.uiuc.edu)
- and Joe Weening (weening@gang-of-four.stanford.edu).
-
-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 is based on m68k.h, simplified by removing support for
- the Sun FPA and other things not applicable to the Alliant. Some
- remnants of these features remain. */
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dmc68000 -Dalliant -Dunix -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fprintf (stderr, " (Alliant)");
-
-/* Run-time compilation parameters selecting different hardware
- subsets. The Alliant IP is an mc68020. (Older mc68010-based IPs
- are no longer supported.) The Alliant CE is 68020-compatible, and
- also has floating point, vector and concurrency instructions.
-
- Although the IP doesn't have floating point, it emulates it in the
- operating system. Using this generally is faster than running code
- compiled with -msoft-float, because the soft-float code still uses
- (simulated) FP registers and ends up emulating several fmove{s,d}
- instructions per call. So I don't recommend using soft-float for
- any Alliant code. -- JSW
-*/
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Compile for a 68020 (not a 68000 or 68010). */
-#define TARGET_68020 (target_flags & 1)
-/* Compile CE insns for floating point (not library calls). */
-#define TARGET_CE (target_flags & 2)
-/* Compile using 68020 bitfield insns. */
-#define TARGET_BITFIELD (target_flags & 4)
-/* Compile with 16-bit `int'. */
-#define TARGET_SHORT (target_flags & 040)
-
-/* Default 3 means compile 68020 and CE instructions. We don't use
- bitfield instructions because there appears to be a bug in the
- implementation of bfins on the CE. */
-
-#define TARGET_DEFAULT 3
-
-/* Define __HAVE_CE__ in preprocessor according to the -m flags.
- This will control the use of inline FP insns in certain macros.
- Also inform the program which CPU this is for. */
-
-#if TARGET_DEFAULT & 02
-
-/* -mce is the default */
-#define CPP_SPEC \
-"%{!msoft-float:-D__HAVE_CE__ }\
-%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}"
-
-#else
-
-/* -msoft-float is the default */
-#define CPP_SPEC \
-"%{mce:-D__HAVE_CE__ }\
-%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}"
-
-#endif
-
-/* Link with libg.a when debugging, for dbx's sake. */
-
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
-
-/* Make the linker remove temporary labels, since the Alliant assembler
- doesn't. */
-
-#define LINK_SPEC "-X"
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { { "68020", 5}, \
- { "c68020", 5}, \
- { "bitfield", 4}, \
- { "68000", -7}, \
- { "c68000", -7}, \
- { "soft-float", -2}, \
- { "nobitfield", -4}, \
- { "short", 040}, \
- { "noshort", -040}, \
- { "", TARGET_DEFAULT}}
-
-/* target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is true for 68020 insns such as bfins and bfexts.
- We make it true always by avoiding using the single-bit insns
- except in special cases with constant bit numbers. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is true on the 68000. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-/* For 68000 we can decide arbitrarily
- since there are no machine instructions for them. */
-#define WORDS_BIG_ENDIAN 0
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY (TARGET_SHORT ? 16 : 32)
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 16
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 16
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 16
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 16
-
-/* Set this non-zero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Define number of bits in most basic integer type.
- (If undefined, default is BITS_PER_WORD). */
-
-#define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
-
-/* Define these to avoid dependence on meaning of `int'.
- Note that WCHAR_TYPE_SIZE is used in cexp.y,
- where TARGET_SHORT is not available. */
-
-#define WCHAR_TYPE "long int"
-#define WCHAR_TYPE_SIZE 32
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
- For the Alliant, we give the data registers numbers 0-7,
- the address registers numbers 010-017,
- and the floating point registers numbers 020-027. */
-#define FIRST_PSEUDO_REGISTER 24
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the Alliant, these are a0 (argument pointer),
- a6 (frame pointer) and a7 (stack pointer). */
-#define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 0, 0, 0, 0, 0, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0 }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like.
- The Alliant calling sequence allows a function to use any register,
- so we include them all here. */
-
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1 }
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On the Alliant, ordinary registers hold 32 bits worth;
- for the FP registers, a single register is always enough for
- any floating-point value. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((REGNO) >= 16 ? GET_MODE_NUNITS (MODE) \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the Alliant, the cpu registers can hold any mode but the FP registers
- can hold only floating point. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((REGNO) < 16 || GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (((MODE1) == SFmode || (MODE1) == DFmode \
- || (MODE1) == SCmode || (MODE1) == DCmode) \
- == ((MODE2) == SFmode || (MODE2) == DFmode \
- || (MODE2) == SCmode || (MODE2) == DCmode))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* m68000 pc isn't overloaded on a register. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 15
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 14
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-/* Set for now on Alliant until we find a way to make this work with
- their calling sequence. */
-#define FRAME_POINTER_REQUIRED 1
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 8
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 10
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 9
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The Alliant has three kinds of registers, so eight classes would be
- a complete set. One of them is not needed. */
-
-enum reg_class { NO_REGS, FP_REGS, DATA_REGS, DATA_OR_FP_REGS,
- ADDR_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- { "NO_REGS", "FP_REGS", "DATA_REGS", "DATA_OR_FP_REGS", \
- "ADDR_REGS", "GENERAL_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ \
- 0, /* NO_REGS */ \
- 0x00ff0000, /* FP_REGS */ \
- 0x000000ff, /* DATA_REGS */ \
- 0x00ff00ff, /* DATA_OR_FP_REGS */ \
- 0x0000ff00, /* ADDR_REGS */ \
- 0x0000ffff, /* GENERAL_REGS */ \
- 0x00ffffff /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-extern enum reg_class regno_reg_class[];
-#define REGNO_REG_CLASS(REGNO) (regno_reg_class[(REGNO)>>3])
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS ADDR_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'a' ? ADDR_REGS : \
- ((C) == 'd' ? DATA_REGS : \
- ((C) == 'f' ? FP_REGS : \
- NO_REGS)))
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For the 68000, `I' is used for the range 1 to 8
- allowed as immediate shift counts and in addq.
- `J' is used for the range of signed numbers that fit in 16 bits.
- `K' is for numbers that moveq can't handle.
- `L' is for range -8 to -1, range of values that can be added with subq. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 : \
- (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
- (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 : \
- (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 : 0)
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
- On the 68000 series, use a data reg if possible when the
- value is a constant in the range where moveq could be used
- and we ensure that QImodes are reloaded into data regs. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- ((GET_CODE (X) == CONST_INT \
- && (unsigned) (INTVAL (X) + 0x80) < 0x100 \
- && (CLASS) != ADDR_REGS) \
- ? DATA_REGS \
- : GET_MODE (X) == QImode \
- ? DATA_REGS \
- : (CLASS))
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On the 68000, this is the size of MODE in words,
- except in the FP regs, where a single reg is always enough. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FP_REGS ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Moves between fp regs and other regs are two insns. */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- ((((CLASS1) == FP_REGS && (CLASS2) != FP_REGS) \
- || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS)) \
- ? 4 : 2)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* The Alliant uses -fcaller-saves by default. */
-#define DEFAULT_CALLER_SAVES
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET -4
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On the 68000, sp@- in a byte insn really pushes a word. */
-#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the Alliant we define this as SIZE and make the calling sequence
- (in alliant.md) pop the args. This wouldn't be necessary if we
- could add to the pending stack adjustment the size of the argument
- descriptors that are pushed after the arguments. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (SIZE)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On the Alliant the return value is in FP0 if real, else D0. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- (TREE_CODE (VALTYPE) == REAL_TYPE \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
- : gen_rtx (REG, TYPE_MODE (VALTYPE), 0))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-/* On the Alliant the return value is in FP0 if real, else D0. The
- Alliant library functions for floating-point emulation return their
- values both in FP0 and in D0/D1. But since not all libgcc functions
- return the results of these directly, we cannot assume that D0/D1
- contain the values we expect on return from a libgcc function. */
-
-#define LIBCALL_VALUE(MODE) \
- (((MODE) == DFmode || (MODE) == SFmode) \
- ? gen_rtx (REG, MODE, 16) \
- : gen_rtx (REG, MODE, 0))
-
-/* 1 if N is a possible register number for a function value.
- On the Alliant, D0 and FP0 are the only registers thus used.
- (No need to mention D1 when used as a pair with D0.) */
-
-#define FUNCTION_VALUE_REGNO_P(N) (((N) & ~16) == 0)
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-#define PCC_STATIC_STRUCT_RETURN
-
-/* 1 if N is a possible register number for function argument passing.
- On the Alliant, no registers are used in this way. */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the Alliant, this is a single integer, which is a number of bytes
- of arguments scanned so far. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the Alliant, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the Alliant all args are pushed. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used.
- The Alliant uses caller-saves, so this macro is very simple. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ int fsize = ((SIZE) - STARTING_FRAME_OFFSET + 3) & -4; \
- if (frame_pointer_needed) \
- { \
- if (fsize < 0x8000) \
- fprintf(FILE,"\tlinkw a6,#%d\n", -fsize); \
- else if (TARGET_68020) \
- fprintf(FILE,"\tlinkl a6,#%d\n", -fsize); \
- else \
- fprintf(FILE,"\tlinkw a6,#0\n\tsubl #%d,sp\n", fsize); \
- fprintf(FILE, "\tmovl a0,a6@(-4)\n" ); }}
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tjbsr __mcount_\n")
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ if (frame_pointer_needed) \
- fprintf (FILE, "\tunlk a6\n"); \
- fprintf (FILE, "\trts\n"); }
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
-{ \
- int regno; \
- int offset = -4; \
- for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 12; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 4; \
- (DEPTH) = offset - ((get_frame_size () + 3) & -4); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-#define HAVE_POST_INCREMENT
-/* #define HAVE_POST_DECREMENT */
-
-#define HAVE_PRE_DECREMENT
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
-((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-(((REGNO) ^ 010) < 8 || (unsigned) (reg_renumber[REGNO] ^ 010) < 8)
-#define REGNO_OK_FOR_DATA_P(REGNO) \
-((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
-#define REGNO_OK_FOR_FP_P(REGNO) \
-(((REGNO) ^ 020) < 8 || (unsigned) (reg_renumber[REGNO] ^ 020) < 8)
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-
- These macros are specific to the 68000, and may be used only
- in code for printing assembler insns and in conditions for
- define_optimization. */
-
-/* 1 if X is a data register. */
-
-#define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
-
-/* 1 if X is an fp register. */
-
-#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
-
-/* 1 if X is an address register */
-
-#define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-/* Alliant FP instructions don't take immediate operands, so this
- forces them into memory. */
-#define LEGITIMATE_CONSTANT_P(X) (GET_CODE (X) != CONST_DOUBLE)
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) ((REGNO (X) ^ 020) >= 8)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~027) != 0)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
-
-#define INDIRECTABLE_1_ADDRESS_P(X) \
- (CONSTANT_ADDRESS_P (X) \
- || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
- && REG_P (XEXP (X, 0)) \
- && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
- || (GET_CODE (X) == PLUS \
- && REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))
-
-#define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
-{ if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; }
-
-#define GO_IF_INDEXABLE_BASE(X, ADDR) \
-{ if (GET_CODE (X) == LABEL_REF) goto ADDR; \
- if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; }
-
-#define GO_IF_INDEXING(X, ADDR) \
-{ if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0))) \
- { GO_IF_INDEXABLE_BASE (XEXP (X, 1), ADDR); } \
- if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1))) \
- { GO_IF_INDEXABLE_BASE (XEXP (X, 0), ADDR); } }
-
-#define GO_IF_INDEXED_ADDRESS(X, ADDR) \
-{ GO_IF_INDEXING (X, ADDR); \
- if (GET_CODE (X) == PLUS) \
- { if (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100) \
- { rtx go_temp = XEXP (X, 0); GO_IF_INDEXING (go_temp, ADDR); } \
- if (GET_CODE (XEXP (X, 0)) == CONST_INT \
- && (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100) \
- { rtx go_temp = XEXP (X, 1); GO_IF_INDEXING (go_temp, ADDR); } } }
-
-#define LEGITIMATE_INDEX_REG_P(X) \
- ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
- || (GET_CODE (X) == SIGN_EXTEND \
- && GET_CODE (XEXP (X, 0)) == REG \
- && GET_MODE (XEXP (X, 0)) == HImode \
- && REG_OK_FOR_INDEX_P (XEXP (X, 0))))
-
-#define LEGITIMATE_INDEX_P(X) \
- (LEGITIMATE_INDEX_REG_P (X) \
- || (TARGET_68020 && GET_CODE (X) == MULT \
- && LEGITIMATE_INDEX_REG_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (INTVAL (XEXP (X, 1)) == 2 \
- || INTVAL (XEXP (X, 1)) == 4 \
- || INTVAL (XEXP (X, 1)) == 8)))
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
- GO_IF_INDEXED_ADDRESS (X, ADDR); }
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the 68000, we handle X+REG by loading X into a register R and
- using R+REG. R will go in an address reg and indexing will be used.
- However, if REG is a broken-out memory address or multiplication,
- nothing needs to be done because REG can certainly go in an address reg. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ register int ch = (X) != (OLDX); \
- if (GET_CODE (X) == PLUS) \
- { if (GET_CODE (XEXP (X, 0)) == MULT) \
- ch = 1, XEXP (X, 0) = force_operand (XEXP (X, 0), 0); \
- if (GET_CODE (XEXP (X, 1)) == MULT) \
- ch = 1, XEXP (X, 1) = force_operand (XEXP (X, 1), 0); \
- if (ch && GET_CODE (XEXP (X, 1)) == REG \
- && GET_CODE (XEXP (X, 0)) == REG) \
- goto WIN; \
- if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); } \
- if (GET_CODE (XEXP (X, 0)) == REG \
- || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
- && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode)) \
- { register rtx temp = gen_reg_rtx (Pmode); \
- register rtx val = force_operand (XEXP (X, 1), 0); \
- emit_move_insn (temp, val); \
- XEXP (X, 1) = temp; \
- goto WIN; } \
- else if (GET_CODE (XEXP (X, 1)) == REG \
- || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND \
- && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \
- && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode)) \
- { register rtx temp = gen_reg_rtx (Pmode); \
- register rtx val = force_operand (XEXP (X, 0), 0); \
- emit_move_insn (temp, val); \
- XEXP (X, 0) = temp; \
- goto WIN; }}}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the 68000, only predecrement and postincrement address depend thus
- (the amount of decrement or increment being the length of the operand). */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE HImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-#define CASE_VECTOR_PC_RELATIVE
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-#define SLOW_ZERO_EXTEND
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE -1
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- /* Constant zero is super cheap due to clr instruction. */ \
- if (RTX == const0_rtx) return 0; \
- if ((unsigned) INTVAL (RTX) < 077) return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 3; \
- case CONST_DOUBLE: \
- return 5;
-
-/* Check a `double' value for validity for a particular machine mode.
- This is defined to avoid crashes outputting certain constants. */
-
-#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
- if (OVERFLOW) \
- (D) = 3.4028234663852890e+38; \
- else if ((MODE) == SFmode) \
- { \
- if ((d) > 3.4028234663852890e+38) \
- (OVERFLOW) = 1, (D) = 3.4028234663852890e+38; \
- else if ((D) < -3.4028234663852890e+38) \
- (OVERFLOW) = 1, (D) = -3.4028234663852890e+38; \
- else if (((D) > 0) && ((D) < 1.1754943508222873e-38)) \
- (OVERFLOW) = 1, (D) = 0.0; \
- else if (((d) < 0) && ((d) > -1.1754943508222873e-38)) \
- (OVERFLOW) = 1, (D) = 0.0; \
- }
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-/* On the Alliant, floating-point instructions do not modify the
- ordinary CC register. Only fcmp and ftest instructions modify the
- floating-point CC register. We should actually keep track of what
- both kinds of CC registers contain, but for now we only consider
- the most recent instruction that has set either register. */
-
-/* Set if the cc value came from a floating point test, so a floating
- point conditional branch must be output. */
-#define CC_IN_FP 04000
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-/* On the 68000, all the insns to store in an address register
- fail to set the cc's. However, in some cases these instructions
- can make it possibly invalid to use the saved cc's. In those
- cases we clear out some or all of the saved cc's so they won't be used. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ \
- if (GET_CODE (EXP) == SET) \
- { if (ADDRESS_REG_P (SET_DEST (EXP)) || FP_REG_P (SET_DEST (EXP))) \
- { if (cc_status.value1 \
- && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value1)) \
- cc_status.value1 = 0; \
- if (cc_status.value2 \
- && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value2)) \
- cc_status.value2 = 0; } \
- else if (GET_CODE (SET_SRC (EXP)) == MOD \
- || GET_CODE (SET_SRC (EXP)) == UMOD \
- || (GET_CODE (SET_SRC (EXP)) == TRUNCATE \
- && (GET_CODE (XEXP (SET_SRC (EXP))) == MOD \
- || GET_CODE (XEXP (SET_SRC (EXP))) == UMOD))) \
- /* The swap insn produces cc's that don't correspond to the \
- result. */ \
- CC_STATUS_INIT; \
- else if (SET_DEST (EXP) != cc0_rtx \
- && (FP_REG_P (SET_SRC (EXP)) \
- || GET_CODE (SET_SRC (EXP)) == FIX \
- || GET_CODE (SET_SRC (EXP)) == FLOAT_TRUNCATE \
- || GET_CODE (SET_SRC (EXP)) == FLOAT_EXTEND)) \
- { CC_STATUS_INIT; } \
- /* A pair of move insns doesn't produce a useful overall cc. */ \
- else if (!FP_REG_P (SET_DEST (EXP)) \
- && !FP_REG_P (SET_SRC (EXP)) \
- && GET_MODE_SIZE (GET_MODE (SET_SRC (EXP))) > 4 \
- && (GET_CODE (SET_SRC (EXP)) == REG \
- || GET_CODE (SET_SRC (EXP)) == MEM \
- || GET_CODE (SET_SRC (EXP)) == CONST_DOUBLE))\
- { CC_STATUS_INIT; } \
- else if (GET_CODE (SET_SRC (EXP)) == CALL) \
- { CC_STATUS_INIT; } \
- else if (XEXP (EXP, 0) != pc_rtx) \
- { cc_status.flags = 0; \
- cc_status.value1 = XEXP (EXP, 0); \
- cc_status.value2 = XEXP (EXP, 1); } } \
- else if (GET_CODE (EXP) == PARALLEL \
- && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
- { \
- if (ADDRESS_REG_P (XEXP (XVECEXP (EXP, 0, 0), 0))) \
- CC_STATUS_INIT; \
- else if (XEXP (XVECEXP (EXP, 0, 0), 0) != pc_rtx) \
- { cc_status.flags = 0; \
- cc_status.value1 = XEXP (XVECEXP (EXP, 0, 0), 0); \
- cc_status.value2 = XEXP (XVECEXP (EXP, 0, 0), 1); } } \
- else CC_STATUS_INIT; \
- if (cc_status.value2 != 0 \
- && ADDRESS_REG_P (cc_status.value2) \
- && GET_MODE (cc_status.value2) == QImode) \
- CC_STATUS_INIT; \
- if (cc_status.value2 != 0) \
- switch (GET_CODE (cc_status.value2)) \
- { case PLUS: case MINUS: case MULT: \
- case DIV: case UDIV: case MOD: case UMOD: case NEG: \
- case ASHIFT: case ASHIFTRT: case LSHIFTRT: \
- case ROTATE: case ROTATERT: \
- if (GET_MODE (cc_status.value2) != VOIDmode) \
- cc_status.flags |= CC_NO_OVERFLOW; \
- break; \
- case ZERO_EXTEND: \
- /* (SET r1 (ZERO_EXTEND r2)) on this machine
- ends with a move insn moving r2 in r2's mode.
- Thus, the cc's are set for r2.
- This can set N bit spuriously. */ \
- cc_status.flags |= CC_NOT_NEGATIVE; } \
- if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
- && cc_status.value2 \
- && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
- cc_status.value2 = 0; \
- if ((cc_status.value1 && FP_REG_P (cc_status.value1)) \
- || (cc_status.value2 && FP_REG_P (cc_status.value2))) \
- cc_status.flags = CC_IN_FP; }
-
-#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
-{ if (cc_prev_status.flags & CC_IN_FP) \
- return FLOAT; \
- if (cc_prev_status.flags & CC_NO_OVERFLOW) \
- return NO_OV; \
- return NORMAL; }
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) \
- fprintf (FILE, "#NO_APP\n");
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "#APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
- "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
- "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7" }
-
-/* How to renumber registers for dbx and gdb.
- On the Sun-3, the floating point registers have numbers
- 18 to 25, not 16 to 23 as they do in the compiler. */
-/* (On the Alliant, dbx isn't working yet at all. */
-
-#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs ("\t.globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { union { double d; long v[2];} tem; \
- tem.d = (VALUE); \
- fprintf (FILE, "\t.long 0x%x,0x%x\n", tem.v[0], tem.v[1]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { union { float f; long l;} tem; \
- tem.f = (VALUE); \
- fprintf (FILE, "\t.long 0x%x\n", tem.l); \
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_ASCII(FILE,PTR,SIZE) \
-do { int i; unsigned char *pp = (unsigned char *) (PTR); \
- fprintf((FILE), "\t.byte %d", (unsigned int)*pp++); \
- for (i = 1; i < (SIZE); ++i, ++pp) { \
- if ((i % 8) == 0) \
- fprintf((FILE), "\n\t.byte %d", (unsigned int) *pp); \
- else \
- fprintf((FILE), ",%d", (unsigned int) *pp); } \
- fprintf ((FILE), "\n"); } while (0)
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tmovl %s,sp@-\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmovl sp@+,%s\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute.
- (The 68000 does not use such vectors,
- but we must define this macro anyway.) */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.long L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) == 1) \
- fprintf (FILE, "\t.even\n"); \
- else if ((LOG) != 0) \
- fprintf (FILE, "\t.align %dn", (LOG));
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t. = . + %u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
-
- On the Alliant, we use several CODE characters:
- '.' for dot needed in Motorola-style opcode names.
- '-' for an operand pushing on the stack:
- sp@-, -(sp) or -(%sp) depending on the style of syntax.
- '+' for an operand pushing on the stack:
- sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
- '@' for a reference to the top word on the stack:
- sp@, (sp) or (%sp) depending on the style of syntax.
- '#' for an immediate operand prefix (# in MIT and Motorola syntax
- but & in SGS syntax).
- '!' for the cc register (used in an `and to cc' insn).
-
- 'b' for byte insn (no effect, on the Sun; this is for the ISI).
- 'd' to force memory addressing to be absolute, not relative.
- 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
- 'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
- or print pair of registers as rx:ry. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '.' || (CODE) == '#' || (CODE) == '-' \
- || (CODE) == '+' || (CODE) == '@' || (CODE) == '!')
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ int i; \
- if (CODE == '.') ; \
- else if (CODE == '#') fprintf (FILE, "#"); \
- else if (CODE == '-') fprintf (FILE, "sp@-"); \
- else if (CODE == '+') fprintf (FILE, "sp@+"); \
- else if (CODE == '@') fprintf (FILE, "sp@"); \
- else if (CODE == '!') fprintf (FILE, "cc"); \
- else if ((X) == 0 ) ; \
- else if (GET_CODE (X) == REG) \
- { if (REGNO (X) < 16 && (CODE == 'y' || CODE == 'x') && GET_MODE (X) == DFmode) \
- fprintf (FILE, "%s,%s", reg_names[REGNO (X)], reg_names[REGNO (X)+1]); \
- else \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- } \
- else if (GET_CODE (X) == MEM) \
- { \
- output_address (XEXP (X, 0)); \
- if (CODE == 'd' && ! TARGET_68020 \
- && CONSTANT_ADDRESS_P (XEXP (X, 0)) \
- && !(GET_CODE (XEXP (X, 0)) == CONST_INT \
- && INTVAL (XEXP (X, 0)) < 0x8000 \
- && INTVAL (XEXP (X, 0)) >= -0x8000)) \
- fprintf (FILE, ":l"); \
- } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
- { union { double d; int i[2]; } u; \
- union { float f; int i; } u1; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- u1.f = u.d; \
- if (CODE == 'f') \
- fprintf (FILE, "#0r%.9g", u1.f); \
- else \
- fprintf (FILE, "#0x%x", u1.i); } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode) \
- { union { double d; int i[2]; } u; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- fprintf (FILE, "#0r%.20g", u.d); } \
- else { putc ('#', FILE); output_addr_const (FILE, X); }}
-
-/* Note that this contains a kludge that knows that the only reason
- we have an address (plus (label_ref...) (reg...))
- is in the insn before a tablejump, and we know that m68k.md
- generates a label LInnn: on such an insn. */
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx reg1, reg2, breg, ireg; \
- register rtx addr = ADDR; \
- static char *sz = ".BW.L...D"; \
- rtx offset; \
- switch (GET_CODE (addr)) \
- { \
- case REG: \
- fprintf (FILE, "%s@", reg_names[REGNO (addr)]); \
- break; \
- case PRE_DEC: \
- fprintf (FILE, "%s@-", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case POST_INC: \
- fprintf (FILE, "%s@+", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case PLUS: \
- reg1 = 0; reg2 = 0; \
- ireg = 0; breg = 0; \
- offset = 0; \
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
- { \
- offset = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
- { \
- offset = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) != PLUS) ; \
- else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == MULT) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == MULT) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
- || GET_CODE (addr) == SIGN_EXTEND) \
- { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
-/* for OLD_INDEXING \
- else if (GET_CODE (addr) == PLUS) \
- { \
- if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg2 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg2 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- } \
- */ \
- if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
- if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
- || GET_CODE (reg1) == MULT)) \
- || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
- { breg = reg2; ireg = reg1; } \
- else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
- { breg = reg1; ireg = reg2; } \
- if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
- { int scale = 1; \
- if (GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "pc@(L%d-LI%d-2:B)[%s:W", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (XEXP (ireg, 0))]); \
- else \
- fprintf (FILE, "pc@(L%d-LI%d-2:B)[%s:L", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (ireg)]); \
- fprintf (FILE, ":%c", sz[scale]); \
- putc (']', FILE); \
- break; } \
- if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "pc@(L%d-LI%d-2:B)[%s:L:B]", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (breg)]); \
- break; } \
- if (ireg != 0 || breg != 0) \
- { int scale = 1; \
- if (breg == 0) \
- abort (); \
- if (addr && GET_CODE (addr) == LABEL_REF) abort (); \
- fprintf (FILE, "%s@", reg_names[REGNO (breg)]); \
- if (addr != 0) { \
- putc( '(', FILE ); \
- output_addr_const (FILE, addr); \
- if (ireg != 0) { \
- if (GET_CODE(addr) == CONST_INT) { \
- int size_of = 1, val = INTVAL(addr); \
- if (val < -0x8000 || val >= 0x8000) \
- size_of = 4; \
- else if (val < -0x80 || val >= 0x80) \
- size_of = 2; \
- fprintf(FILE, ":%c", sz[size_of]); \
- } \
- else \
- fprintf(FILE, ":L"); } \
- putc( ')', FILE ); } \
- if (ireg != 0) { \
- putc ('[', FILE); \
- if (ireg != 0 && GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "%s:W", reg_names[REGNO (XEXP (ireg, 0))]); \
- else if (ireg != 0) \
- fprintf (FILE, "%s:L", reg_names[REGNO (ireg)]); \
- fprintf (FILE, ":%c", sz[scale]); \
- putc (']', FILE); \
- } \
- break; \
- } \
- else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "pc@(L%d-LI%d-2:B)[%s:L:B]", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (reg1)]); \
- break; } \
- default: \
- if (GET_CODE (addr) == CONST_INT \
- && INTVAL (addr) < 0x8000 \
- && INTVAL (addr) >= -0x8000) \
- fprintf (FILE, "%d:W", INTVAL (addr)); \
- else \
- output_addr_const (FILE, addr); \
- }}
-
-/*
-Local variables:
-version-control: t
-End:
-*/
-
diff --git a/gcc/config/fx80/fx80.md b/gcc/config/fx80/fx80.md
deleted file mode 100644
index 6862767d764..00000000000
--- a/gcc/config/fx80/fx80.md
+++ /dev/null
@@ -1,2522 +0,0 @@
-;;- Machine description for GNU C compiler for Alliant FX systems
-;; Copyright (C) 1989, 1994, 1996 Free Software Foundation, Inc.
-;; Adapted from m68k.md by Paul Petersen (petersen@uicsrd.csrd.uiuc.edu)
-;; and Joe Weening (weening@gang-of-four.stanford.edu).
-
-;; 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.
-
-
-;;- instruction definitions
-
-;;- @@The original PO technology requires these to be ordered by speed,
-;;- @@ so that assigner will pick the fastest.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;;- When naming insn's (operand 0 of define_insn) be careful about using
-;;- names from other targets machine descriptions.
-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-;;- Operand classes for the register allocator:
-;;- 'a' one of the address registers can be used.
-;;- 'd' one of the data registers can be used.
-;;- 'f' one of the CE floating point registers can be used
-;;- 'r' either a data or an address register can be used.
-
-;;- Immediate integer operand constraints:
-;;- 'I' 1 .. 8
-;;- 'J' -32768 .. 32767
-;;- 'K' -128 .. 127
-;;- 'L' -8 .. -1
-
-;;- Some remnants of constraint codes for the m68k ('x','y','G','H')
-;;- may remain in the insn definitions.
-
-;;- Some of these insn's are composites of several Alliant op codes.
-;;- The assembler (or final @@??) insures that the appropriate one is
-;;- selected.
-
-;; We don't want to allow a constant operand for test insns because
-;; (set (cc0) (const_int foo)) has no mode information. Such insns will
-;; be folded while optimizing anyway.
-
-(define_insn "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" "rm"))]
- ""
- "*
-{
- if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
- return \"tst%.l %0\";
- /* If you think that the 68020 does not support tstl a0,
- reread page B-167 of the 68020 manual more carefully. */
- /* On an address reg, cmpw may replace cmpl. */
- return \"cmp%.w %#0,%0\";
-}")
-
-(define_insn "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "nonimmediate_operand" "rm"))]
- ""
- "*
-{
- if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
- return \"tst%.w %0\";
- return \"cmp%.w %#0,%0\";
-}")
-
-(define_insn "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "nonimmediate_operand" "dm"))]
- ""
- "tst%.b %0")
-
-(define_insn "tstsf"
- [(set (cc0)
- (match_operand:SF 0 "nonimmediate_operand" "fm"))]
- "TARGET_CE"
- "*
-{
- cc_status.flags = CC_IN_FP;
- return \"ftest%.s %0\";
-}")
-
-(define_insn "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "nonimmediate_operand" "fm"))]
- "TARGET_CE"
- "*
-{
- cc_status.flags = CC_IN_FP;
- return \"ftest%.d %0\";
-}")
-
-;; compare instructions.
-
-;; A composite of the cmp, cmpa, & cmpi m68000 op codes.
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "rKs,mr,>")
- (match_operand:SI 1 "general_operand" "mr,Ksr,>")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- return \"cmpm%.l %1,%0\";
- if (REG_P (operands[1])
- || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
- {
- cc_status.flags |= CC_REVERSED;
- return \"cmp%.l %d0,%d1\";
- }
- return \"cmp%.l %d1,%d0\";
-}")
-
-(define_insn "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "rnm,d,n,m")
- (match_operand:HI 1 "general_operand" "d,rnm,m,n")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- return \"cmpm%.w %1,%0\";
- if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
- || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
- { cc_status.flags |= CC_REVERSED;
- return \"cmp%.w %d0,%d1\";
- }
- return \"cmp%.w %d1,%d0\";
-}")
-
-(define_insn "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "dn,md,>")
- (match_operand:QI 1 "general_operand" "dm,nd,>")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- return \"cmpm%.b %1,%0\";
- if (REG_P (operands[1])
- || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
- {
- cc_status.flags |= CC_REVERSED;
- return \"cmp%.b %d0,%d1\";
- }
- return \"cmp%.b %d1,%d0\";
-}")
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "nonimmediate_operand" "f,m")
- (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
- "TARGET_CE"
- "*
-{
- cc_status.flags = CC_IN_FP;
- if (FP_REG_P (operands[0]))
- return \"fcmp%.d %1,%0\";
- cc_status.flags |= CC_REVERSED;
- return \"fcmp%.d %0,%1\";
-}")
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "nonimmediate_operand" "f,m")
- (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
- "TARGET_CE"
- "*
-{
- cc_status.flags = CC_IN_FP;
- if (FP_REG_P (operands[0]))
- return \"fcmp%.s %1,%0\";
- cc_status.flags |= CC_REVERSED;
- return \"fcmp%.s %0,%1\";
-}")
-
-;; Recognizers for btst instructions.
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
- (const_int 1)
- (minus:SI (const_int 7)
- (match_operand:SI 1 "general_operand" "di"))))]
- ""
- "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
- (const_int 1)
- (minus:SI (const_int 31)
- (match_operand:SI 1 "general_operand" "di"))))]
- ""
- "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
-
-;; The following two patterns are like the previous two
-;; except that they use the fact that bit-number operands
-;; are automatically masked to 3 or 5 bits.
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
- (const_int 1)
- (minus:SI (const_int 7)
- (and:SI
- (match_operand:SI 1 "general_operand" "d")
- (const_int 7)))))]
- ""
- "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
- (const_int 1)
- (minus:SI (const_int 31)
- (and:SI
- (match_operand:SI 1 "general_operand" "d")
- (const_int 31)))))]
- ""
- "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
-
-;; Nonoffsettable mem refs are ok in this one pattern
-;; since we don't try to adjust them.
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "i")))]
- "GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) < 8"
- "*
-{
- operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - INTVAL (operands[1]));
- return output_btst (operands, operands[1], operands[0], insn, 7);
-}")
-
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "i")))]
- "GET_CODE (operands[1]) == CONST_INT"
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- {
- operands[0] = adj_offsettable_operand (operands[0],
- INTVAL (operands[1]) / 8);
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- 7 - INTVAL (operands[1]) % 8);
- return output_btst (operands, operands[1], operands[0], insn, 7);
- }
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- 31 - INTVAL (operands[1]));
- return output_btst (operands, operands[1], operands[0], insn, 31);
-}")
-
-
-;; move instructions
-
-;; A special case in which it is not desirable
-;; to reload the constant into a data register.
-(define_insn ""
- [(set (match_operand:SI 0 "push_operand" "=m")
- (match_operand:SI 1 "general_operand" "J"))]
- "GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) >= -0x8000
- && INTVAL (operands[1]) < 0x8000"
- "*
-{
- if (operands[1] == const0_rtx)
- return \"clr%.l %0\";
- return \"pea %a1\";
-}")
-
-;This is never used.
-;(define_insn "swapsi"
-; [(set (match_operand:SI 0 "general_operand" "r")
-; (match_operand:SI 1 "general_operand" "r"))
-; (set (match_dup 1) (match_dup 0))]
-; ""
-; "exg %1,%0")
-
-;; Special case of fullword move when source is zero.
-;; The reason this is special is to avoid loading a zero
-;; into a data reg with moveq in order to store it elsewhere.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=a,g")
- (const_int 0))]
- ""
- "@
- sub%.l %0,%0
- clr%.l %0")
-
-;; General case of fullword move. The register constraints
-;; force integer constants in range for a moveq to be reloaded
-;; if they are headed for memory.
-(define_insn "movsi"
- ;; Notes: make sure no alternative allows g vs g.
- ;; We don't allow f-regs since fixed point cannot go in them.
- ;; We do allow y and x regs since fixed point is allowed in them.
- [(set (match_operand:SI 0 "general_operand" "=g,da,y,!*x*r*m")
- (match_operand:SI 1 "general_operand" "daymKs,i,g,*x*r*m"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (operands[1] == const0_rtx
- && (DATA_REG_P (operands[0])
- || GET_CODE (operands[0]) == MEM))
- return \"clr%.l %0\";
- else if (DATA_REG_P (operands[0])
- && INTVAL (operands[1]) < 128
- && INTVAL (operands[1]) >= -128)
- return \"moveq %1,%0\";
- else if (ADDRESS_REG_P (operands[0])
- && INTVAL (operands[1]) < 0x8000
- && INTVAL (operands[1]) >= -0x8000)
- return \"mov%.w %1,%0\";
- else if (push_operand (operands[0], SImode)
- && INTVAL (operands[1]) < 0x8000
- && INTVAL (operands[1]) >= -0x8000)
- return \"pea %a1\";
- }
- else if ((GET_CODE (operands[1]) == SYMBOL_REF
- || GET_CODE (operands[1]) == CONST)
- && push_operand (operands[0], SImode))
- return \"pea %a1\";
- else if ((GET_CODE (operands[1]) == SYMBOL_REF
- || GET_CODE (operands[1]) == CONST)
- && ADDRESS_REG_P (operands[0]))
- return \"lea %a1,%0\";
- return \"mov%.l %1,%0\";
-}")
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (match_operand:HI 1 "general_operand" "g"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (operands[1] == const0_rtx
- && (DATA_REG_P (operands[0])
- || GET_CODE (operands[0]) == MEM))
- return \"clr%.w %0\";
- else if (DATA_REG_P (operands[0])
- && INTVAL (operands[1]) < 128
- && INTVAL (operands[1]) >= -128)
- {
- return \"moveq %1,%0\";
- }
- else if (INTVAL (operands[1]) < 0x8000
- && INTVAL (operands[1]) >= -0x8000)
- return \"mov%.w %1,%0\";
- }
- else if (CONSTANT_P (operands[1]))
- return \"mov%.l %1,%0\";
- /* Recognize the insn before a tablejump, one that refers
- to a table of offsets. Such an insn will need to refer
- to a label on the insn. So output one. Use the label-number
- of the table of offsets to generate this label. */
- if (GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1], 0)) == PLUS
- && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
- || GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == LABEL_REF)
- && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS
- && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) != PLUS)
- {
- rtx labelref;
- if (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF)
- labelref = XEXP (XEXP (operands[1], 0), 0);
- else
- labelref = XEXP (XEXP (operands[1], 0), 1);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\",
- CODE_LABEL_NUMBER (XEXP (labelref, 0)));
- }
- return \"mov%.w %1,%0\";
-}")
-
-(define_insn "movstricthi"
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
- (match_operand:HI 1 "general_operand" "rmn"))]
- ""
- "*
-{
- if (operands[1] == const0_rtx)
- return \"clr%.w %0\";
- return \"mov%.w %1,%0\";
-}")
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=d,*a,m,m,?*a")
- (match_operand:QI 1 "general_operand" "dmi*a,d*a,dmi,?*a,m"))]
- ""
- "*
-{
- rtx xoperands[4];
- if (ADDRESS_REG_P (operands[0]) && GET_CODE (operands[1]) == MEM)
- {
- xoperands[1] = operands[1];
- xoperands[2]
- = gen_rtx (MEM, QImode,
- gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
- xoperands[3] = stack_pointer_rtx;
- /* Just pushing a byte puts it in the high byte of the halfword. */
- /* We must put it in the low half, the second byte. */
- output_asm_insn (\"subq%.w %#2,%3\;mov%.b %1,%2\", xoperands);
- return \"mov%.w %+,%0\";
- }
- if (ADDRESS_REG_P (operands[1]) && GET_CODE (operands[0]) == MEM)
- {
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- xoperands[2]
- = gen_rtx (MEM, QImode,
- gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
- xoperands[3] = stack_pointer_rtx;
- output_asm_insn (\"mov%.w %1,%-\;mov%.b %2,%0\;addq%.w %#2,%3\", xoperands);
- return \"\";
- }
- if (operands[1] == const0_rtx)
- return \"clr%.b %0\";
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) == -1)
- return \"st %0\";
- if (GET_CODE (operands[1]) != CONST_INT && CONSTANT_P (operands[1]))
- return \"mov%.l %1,%0\";
- if (ADDRESS_REG_P (operands[0]) || ADDRESS_REG_P (operands[1]))
- return \"mov%.w %1,%0\";
- return \"mov%.b %1,%0\";
-}")
-
-(define_insn "movstrictqi"
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
- (match_operand:QI 1 "general_operand" "dmn"))]
- ""
- "*
-{
- if (operands[1] == const0_rtx)
- return \"clr%.b %0\";
- return \"mov%.b %1,%0\";
-}")
-
-;; Floating-point moves on a CE are faster using an FP register than
-;; with movl instructions. (Especially for double floats, but also
-;; for single floats, even though it takes an extra instruction.) But
-;; on an IP, the FP registers are simulated and so should be avoided.
-;; We do this by using define_expand for movsf and movdf, and using
-;; different constraints for each target type. The constraints for
-;; TARGET_CE allow general registers because they sometimes need to
-;; hold floats, but they are not preferable.
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "nonimmediate_operand" ""))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f,m,!*r,!f*m")
- (match_operand:SF 1 "nonimmediate_operand" "fm,f,f*r*m,*r"))]
- "TARGET_CE"
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fmove%.s %1,%0\";
- if (REG_P (operands[1]))
- return \"mov%.l %1,%-\;fmove%.s %+,%0\";
- return \"fmove%.s %1,%0\";
- }
- if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- return \"fmove%.s %1,%-\;mov%.l %+,%0\";
- return \"fmove%.s %1,%0\";
- }
- return \"mov%.l %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=frm")
- (match_operand:SF 1 "nonimmediate_operand" "frm"))]
- "!TARGET_CE"
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fmove%.s %1,%0\";
- if (REG_P (operands[1]))
- return \"mov%.l %1,%-\;fmove%.s %+,%0\";
- return \"fmove%.s %1,%0\";
- }
- if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- return \"fmove%.s %1,%-\;mov%.l %+,%0\";
- return \"fmove%.s %1,%0\";
- }
- return \"mov%.l %1,%0\";
-}")
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "nonimmediate_operand" ""))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f,m,!*r,!f*m")
- (match_operand:DF 1 "nonimmediate_operand" "fm,f,f*r*m,*r"))]
- "TARGET_CE"
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fmove%.d %1,%0\";
- if (REG_P (operands[1]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"mov%.l %1,%-\", xoperands);
- output_asm_insn (\"mov%.l %1,%-\", operands);
- return \"fmove%.d %+,%0\";
- }
- return \"fmove%.d %1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"fmove%.d %1,%-\;mov%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"mov%.l %+,%0\";
- }
- return \"fmove%.d %1,%0\";
- }
- return output_move_double (operands);
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=frm")
- (match_operand:DF 1 "nonimmediate_operand" "frm"))]
- "!TARGET_CE"
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fmove%.d %1,%0\";
- if (REG_P (operands[1]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"mov%.l %1,%-\", xoperands);
- output_asm_insn (\"mov%.l %1,%-\", operands);
- return \"fmove%.d %+,%0\";
- }
- return \"fmove%.d %1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"fmove%.d %1,%-\;mov%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"mov%.l %+,%0\";
- }
- return \"fmove%.d %1,%0\";
- }
- return output_move_double (operands);
-}")
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=rm,&r,&ro<>")
- (match_operand:DI 1 "general_operand" "r,m,roi<>"))]
- ""
- "*
-{
- return output_move_double (operands);
-}
-")
-
-;; This goes after the move instructions
-;; because the move instructions are better (require no spilling)
-;; when they can apply. It goes before the add/sub insns
-;; so we will prefer it to them.
-
-(define_insn "pushasi"
- [(set (match_operand:SI 0 "push_operand" "=m")
- (match_operand:SI 1 "address_operand" "p"))]
- ""
- "pea %a1")
-
-;; truncation instructions
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm,d")
- (truncate:QI
- (match_operand:SI 1 "general_operand" "doJ,i")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == REG)
- return \"mov%.l %1,%0\";
- if (GET_CODE (operands[1]) == MEM)
- operands[1] = adj_offsettable_operand (operands[1], 3);
- return \"mov%.b %1,%0\";
-}")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm,d")
- (truncate:QI
- (match_operand:HI 1 "general_operand" "doJ,i")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == REG
- && (GET_CODE (operands[1]) == MEM
- || GET_CODE (operands[1]) == CONST_INT))
- return \"mov%.w %1,%0\";
- if (GET_CODE (operands[0]) == REG)
- return \"mov%.l %1,%0\";
- if (GET_CODE (operands[1]) == MEM)
- operands[1] = adj_offsettable_operand (operands[1], 1);
- return \"mov%.b %1,%0\";
-}")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=dm,d")
- (truncate:HI
- (match_operand:SI 1 "general_operand" "roJ,i")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == REG)
- return \"mov%.l %1,%0\";
- if (GET_CODE (operands[1]) == MEM)
- operands[1] = adj_offsettable_operand (operands[1], 2);
- return \"mov%.w %1,%0\";
-}")
-
-;; zero extension instructions
-
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (const_int 0))
- (set (strict_low_part (subreg:HI (match_dup 0) 0))
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "operands[1] = make_safe_from (operands[1], operands[0]);")
-
-(define_expand "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (const_int 0))
- (set (strict_low_part (subreg:QI (match_dup 0) 0))
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "operands[1] = make_safe_from (operands[1], operands[0]);")
-
-(define_expand "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (const_int 0))
- (set (strict_low_part (subreg:QI (match_dup 0) 0))
- (match_operand:QI 1 "general_operand" ""))]
- ""
- " operands[1] = make_safe_from (operands[1], operands[0]); ")
-
-;; Patterns to recognize zero-extend insns produced by the combiner.
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=do<>")
- (zero_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "rm")))]
- ""
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1]))
- return \"and%.l %#0xFFFF,%0\";
- if (reg_mentioned_p (operands[0], operands[1]))
- return \"mov%.w %1,%0\;and%.l %#0xFFFF,%0\";
- return \"clr%.l %0\;mov%.w %1,%0\";
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- return \"mov%.w %1,%0\;clr%.w %0\";
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- return \"clr%.w %0\;mov%.w %1,%0\";
- else
- {
- output_asm_insn (\"clr%.w %0\", operands);
- operands[0] = adj_offsettable_operand (operands[0], 2);
- return \"mov%.w %1,%0\";
- }
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=do<>")
- (zero_extend:HI
- (match_operand:QI 1 "nonimmediate_operand" "dm")))]
- ""
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1]))
- return \"and%.w %#0xFF,%0\";
- if (reg_mentioned_p (operands[0], operands[1]))
- return \"mov%.b %1,%0\;and%.w %#0xFF,%0\";
- return \"clr%.w %0\;mov%.b %1,%0\";
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- {
- if (REGNO (XEXP (XEXP (operands[0], 0), 0))
- == STACK_POINTER_REGNUM)
- return \"clr%.w %-\;mov%.b %1,%0\";
- else
- return \"mov%.b %1,%0\;clr%.b %0\";
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- return \"clr%.b %0\;mov%.b %1,%0\";
- else
- {
- output_asm_insn (\"clr%.b %0\", operands);
- operands[0] = adj_offsettable_operand (operands[0], 1);
- return \"mov%.b %1,%0\";
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=do<>")
- (zero_extend:SI
- (match_operand:QI 1 "nonimmediate_operand" "dm")))]
- ""
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1]))
- return \"and%.l %#0xFF,%0\";
- if (reg_mentioned_p (operands[0], operands[1]))
- return \"mov%.b %1,%0\;and%.l %#0xFF,%0\";
- return \"clr%.l %0\;mov%.b %1,%0\";
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- {
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
- return \"clr%.l %0@-\;mov%.b %1,%0@(3)\";
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- {
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
- return \"clr%.l %0@+\;mov%.b %1,%0@(-1)\";
- }
- else
- {
- output_asm_insn (\"clr%.l %0\", operands);
- operands[0] = adj_offsettable_operand (operands[0], 3);
- return \"mov%.b %1,%0\";
- }
-}")
-
-;; sign extension instructions
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=*d,a")
- (sign_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "0,rmn")))]
- ""
- "@
- ext%.l %0
- mov%.w %1,%0")
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (sign_extend:HI
- (match_operand:QI 1 "nonimmediate_operand" "0")))]
- ""
- "ext%.w %0")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (sign_extend:SI
- (match_operand:QI 1 "nonimmediate_operand" "0")))]
- "TARGET_68020"
- "extb%.l %0")
-
-;; Conversions between float and double.
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "general_operand" "=f,m")
- (float_extend:DF
- (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
- "TARGET_CE"
- "fmovesd %1,%0")
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "general_operand" "=f,m")
- (float_truncate:SF
- (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
- "TARGET_CE"
- "fmoveds %1,%0")
-
-;; Conversion between fixed point and floating point.
-;; Note that among the fix-to-float insns
-;; the ones that start with SImode come first.
-;; That is so that an operand that is a CONST_INT
-;; (and therefore lacks a specific machine mode).
-;; will be recognized as SImode (which is always valid)
-;; rather than as QImode or HImode.
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:SI 1 "nonimmediate_operand" "dm")))]
- "TARGET_CE"
- "fmovels %1,%0")
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:SI 1 "nonimmediate_operand" "dm")))]
- "TARGET_CE"
- "fmoveld %1,%0")
-
-(define_insn "floathisf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:HI 1 "nonimmediate_operand" "dm")))]
- "TARGET_CE"
- "fmovews %1,%0")
-
-(define_insn "floathidf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:HI 1 "nonimmediate_operand" "dm")))]
- "TARGET_CE"
- "fmovewd %1,%0")
-
-(define_insn "floatqisf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:QI 1 "nonimmediate_operand" "dm")))]
- "TARGET_CE"
- "fmovebs %1,%0")
-
-(define_insn "floatqidf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:QI 1 "nonimmediate_operand" "dm")))]
- "TARGET_CE"
- "fmovebd %1,%0")
-
-;; Float-to-fix conversion insns.
-
-(define_insn "fix_truncsfqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (fix:QI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
- "TARGET_CE"
- "fmovesb %1,%0")
-
-(define_insn "fix_truncsfhi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (fix:HI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
- "TARGET_CE"
- "fmovesw %1,%0")
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
- "TARGET_CE"
- "fmovesl %1,%0")
-
-(define_insn "fix_truncdfqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
- "TARGET_CE"
- "fmovedb %1,%0")
-
-(define_insn "fix_truncdfhi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
- "TARGET_CE"
- "fmovedw %1,%0")
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
- "TARGET_CE"
- "fmovedl %1,%0")
-
-;; add instructions
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "general_operand" "=m,r,!a,!a")
- (plus:SI (match_operand:SI 1 "general_operand" "%0,0,a,rJK")
- (match_operand:SI 2 "general_operand" "dIKLs,mrIKLs,rJK,a")))]
- ""
- "*
-{
- if (! operands_match_p (operands[0], operands[1]))
- {
- if (!ADDRESS_REG_P (operands[1]))
- {
- rtx tmp = operands[1];
-
- operands[1] = operands[2];
- operands[2] = tmp;
- }
-
- /* These insns can result from reloads to access
- stack slots over 64k from the frame pointer. */
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) + 0x8000 >= (unsigned) 0x10000)
- return \"mov%.l %2,%0\;add%.l %1,%0\";
- if (GET_CODE (operands[2]) == REG)
- return \"lea %1@[%2:L:B],%0\";
- else
- return \"lea %1@(%c2),%0\";
- }
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) > 0
- && INTVAL (operands[2]) <= 8)
- return (ADDRESS_REG_P (operands[0])
- ? \"addq%.w %2,%0\"
- : \"addq%.l %2,%0\");
- if (INTVAL (operands[2]) < 0
- && INTVAL (operands[2]) >= -8)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- - INTVAL (operands[2]));
- return (ADDRESS_REG_P (operands[0])
- ? \"subq%.w %2,%0\"
- : \"subq%.l %2,%0\");
- }
- if (ADDRESS_REG_P (operands[0])
- && INTVAL (operands[2]) >= -0x8000
- && INTVAL (operands[2]) < 0x8000)
- return \"add%.w %2,%0\";
- }
- return \"add%.l %2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=a")
- (plus:SI (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "rmn"))))]
- ""
- "add%.w %2,%0")
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "general_operand" "=mr,mr,m,r")
- (plus:HI (match_operand:HI 1 "general_operand" "%0,0,0,0")
- (match_operand:HI 2 "general_operand" "I,L,dn,rmn")))]
- ""
- "@
- addq%.w %2,%0
- subq%.w #%n2,%0
- add%.w %2,%0
- add%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
- (plus:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dn,rmn")))]
- ""
- "add%.w %1,%0")
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "general_operand" "=md,mr,m,d")
- (plus:QI (match_operand:QI 1 "general_operand" "%0,0,0,0")
- (match_operand:QI 2 "general_operand" "I,L,dn,dmn")))]
- ""
- "@
- addq%.b %2,%0
- subq%.b #%n2,%0
- add%.b %2,%0
- add%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
- (plus:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dn,dmn")))]
- ""
- "add%.b %1,%0")
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%f")
- (match_operand:DF 2 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fadd%.d %2,%1,%0")
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%f")
- (match_operand:SF 2 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fadd%.s %2,%1,%0")
-
-;; subtract instructions
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "general_operand" "=m,r,!a,?d")
- (minus:SI (match_operand:SI 1 "general_operand" "0,0,a,mrIKs")
- (match_operand:SI 2 "general_operand" "dIKs,mrIKs,J,0")))]
- ""
- "*
-{
- if (! operands_match_p (operands[0], operands[1]))
- {
- if (operands_match_p (operands[0], operands[2]))
- {
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (INTVAL (operands[1]) > 0
- && INTVAL (operands[1]) <= 8)
- return \"subq%.l %1,%0\;neg%.l %0\";
- }
- return \"sub%.l %1,%0\;neg%.l %0\";
- }
- /* This case is matched by J, but negating -0x8000
- in an lea would give an invalid displacement.
- So do this specially. */
- if (INTVAL (operands[2]) == -0x8000)
- return \"mov%.l %1,%0\;sub%.l %2,%0\";
- return \"lea %1@(%n2),%0\";
- }
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) > 0
- && INTVAL (operands[2]) <= 8)
- return \"subq%.l %2,%0\";
- if (ADDRESS_REG_P (operands[0])
- && INTVAL (operands[2]) >= -0x8000
- && INTVAL (operands[2]) < 0x8000)
- return \"sub%.w %2,%0\";
- }
- return \"sub%.l %2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=a")
- (minus:SI (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "rmn"))))]
- ""
- "sub%.w %2,%0")
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "general_operand" "=m,r")
- (minus:HI (match_operand:HI 1 "general_operand" "0,0")
- (match_operand:HI 2 "general_operand" "dn,rmn")))]
- ""
- "sub%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
- (minus:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dn,rmn")))]
- ""
- "sub%.w %1,%0")
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "general_operand" "=m,d")
- (minus:QI (match_operand:QI 1 "general_operand" "0,0")
- (match_operand:QI 2 "general_operand" "dn,dmn")))]
- ""
- "sub%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
- (minus:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dn,dmn")))]
- ""
- "sub%.b %1,%0")
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=f,f,f")
- (minus:DF (match_operand:DF 1 "nonimmediate_operand" "f,f,m")
- (match_operand:DF 2 "nonimmediate_operand" "f,m,f")))]
- "TARGET_CE"
- "@
- fsub%.d %2,%1,%0
- fsub%.d %2,%1,%0
- frsub%.d %1,%2,%0")
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=f,f,f")
- (minus:SF (match_operand:SF 1 "nonimmediate_operand" "f,f,m")
- (match_operand:SF 2 "nonimmediate_operand" "f,m,f")))]
- "TARGET_CE"
- "@
- fsub%.s %2,%1,%0
- fsub%.s %2,%1,%0
- frsub%.s %1,%2,%0")
-
-;; multiply instructions
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (mult:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "dmn")))]
- ""
- "muls %2,%0")
-
-(define_insn "mulhisi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "%0"))
- (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
- ""
- "muls %2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "%0"))
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "muls %2,%0")
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "dmsK")))]
- "TARGET_68020"
- "muls%.l %2,%0")
-
-(define_insn "umulhisi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (zero_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "%0"))
- (zero_extend:SI
- (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
- ""
- "mulu %2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (zero_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "%0"))
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "mulu %2,%0")
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%f")
- (match_operand:DF 2 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fmul%.d %2,%1,%0")
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%f")
- (match_operand:SF 2 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fmul%.s %2,%1,%0")
-
-;; divide instructions
-
-(define_insn "divhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (div:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dmn")))]
- ""
- "extl %0\;divs %2,%0")
-
-(define_insn "divhisi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI
- (div:SI
- (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
- ""
- "divs %2,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))))]
- ""
- "divs %2,%0")
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dmsK")))]
- "TARGET_68020"
- "divs%.l %2,%0,%0")
-
-(define_insn "udivhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (udiv:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dmn")))]
- ""
- "and%.l %#0xFFFF,%0\;divu %2,%0")
-
-(define_insn "udivhisi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI
- (udiv:SI
- (match_operand:SI 1 "general_operand" "0")
- (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
- ""
- "divu %2,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI (udiv:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "const_int_operand" "n"))))]
- ""
- "divu %2,%0")
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (udiv:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dmsK")))]
- "TARGET_68020"
- "divu%.l %2,%0,%0")
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=f,f,f")
- (div:DF (match_operand:DF 1 "nonimmediate_operand" "f,f,m")
- (match_operand:DF 2 "nonimmediate_operand" "f,m,f")))]
- "TARGET_CE"
- "@
- fdiv%.d %2,%1,%0
- fdiv%.d %2,%1,%0
- frdiv%.d %1,%2,%0")
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=f,f,f")
- (div:SF (match_operand:SF 1 "nonimmediate_operand" "f,f,m")
- (match_operand:SF 2 "nonimmediate_operand" "f,m,f")))]
- "TARGET_CE"
- "@
- fdiv%.s %2,%1,%0
- fdiv%.s %2,%1,%0
- frdiv%.s %1,%2,%0")
-
-;; Remainder instructions.
-
-(define_insn "modhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (mod:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dmn")))]
- ""
- "extl %0\;divs %2,%0\;swap %0")
-
-(define_insn "modhisi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI
- (mod:SI
- (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
- ""
- "divs %2,%0\;swap %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI (mod:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))))]
- ""
- "divs %2,%0\;swap %0")
-
-(define_insn "umodhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (umod:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dmn")))]
- ""
- "and%.l %#0xFFFF,%0\;divu %2,%0\;swap %0")
-
-(define_insn "umodhisi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI
- (umod:SI
- (match_operand:SI 1 "general_operand" "0")
- (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
- ""
- "divu %2,%0\;swap %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d")
- (truncate:HI (umod:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))))]
- ""
- "divu %2,%0\;swap %0")
-
-(define_insn "divmodsi4"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dmsK")))
- (set (match_operand:SI 3 "general_operand" "=d")
- (mod:SI (match_dup 1) (match_dup 2)))]
- "TARGET_68020"
- "divs%.l %2,%0,%3")
-
-(define_insn "udivmodsi4"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (udiv:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dmsK")))
- (set (match_operand:SI 3 "general_operand" "=d")
- (umod:SI (match_dup 1) (match_dup 2)))]
- "TARGET_68020"
- "divu%.l %2,%0,%3")
-
-;; logical-and instructions
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "general_operand" "=m,d")
- (and:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
- && (DATA_REG_P (operands[0])
- || offsettable_memref_p (operands[0])))
- {
- if (GET_CODE (operands[0]) != REG)
- operands[0] = adj_offsettable_operand (operands[0], 2);
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & 0xffff);
- /* Do not delete a following tstl %0 insn; that would be incorrect. */
- CC_STATUS_INIT;
- if (operands[2] == const0_rtx)
- return \"clr%.w %0\";
- return \"and%.w %2,%0\";
- }
- return \"and%.l %2,%0\";
-}")
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "general_operand" "=m,d")
- (and:HI (match_operand:HI 1 "general_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "dn,dmn")))]
- ""
- "and%.w %2,%0")
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "general_operand" "=m,d")
- (and:QI (match_operand:QI 1 "general_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "dn,dmn")))]
- ""
- "and%.b %2,%0")
-
-
-;; inclusive-or instructions
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "general_operand" "=m,d")
- (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
- ""
- "*
-{
- register int logval;
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) >> 16 == 0
- && (DATA_REG_P (operands[0])
- || offsettable_memref_p (operands[0])))
- {
- if (GET_CODE (operands[0]) != REG)
- operands[0] = adj_offsettable_operand (operands[0], 2);
- /* Do not delete a following tstl %0 insn; that would be incorrect. */
- CC_STATUS_INIT;
- return \"or%.w %2,%0\";
- }
- if (GET_CODE (operands[2]) == CONST_INT
- && (logval = exact_log2 (INTVAL (operands[2]))) >= 0
- && (DATA_REG_P (operands[0])
- || offsettable_memref_p (operands[0])))
- {
- if (DATA_REG_P (operands[0]))
- operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
- else
- {
- operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
- operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
- }
- return \"bset %1,%0\";
- }
- return \"or%.l %2,%0\";
-}")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "general_operand" "=m,d")
- (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "dn,dmn")))]
- ""
- "or%.w %2,%0")
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "general_operand" "=m,d")
- (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "dn,dmn")))]
- ""
- "or%.b %2,%0")
-
-;; xor instructions
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "general_operand" "=do,m")
- (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "di,dKs")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) >> 16 == 0
- && (offsettable_memref_p (operands[0]) || DATA_REG_P (operands[0])))
- {
- if (! DATA_REG_P (operands[0]))
- operands[0] = adj_offsettable_operand (operands[0], 2);
- /* Do not delete a following tstl %0 insn; that would be incorrect. */
- CC_STATUS_INIT;
- return \"eor%.w %2,%0\";
- }
- return \"eor%.l %2,%0\";
-}")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (xor:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "dn")))]
- ""
- "eor%.w %2,%0")
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (xor:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "dn")))]
- ""
- "eor%.b %2,%0")
-
-;; negation instructions
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (neg:SI (match_operand:SI 1 "general_operand" "0")))]
- ""
- "neg%.l %0")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (neg:HI (match_operand:HI 1 "general_operand" "0")))]
- ""
- "neg%.w %0")
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (neg:QI (match_operand:QI 1 "general_operand" "0")))]
- ""
- "neg%.b %0")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (neg:SF (match_operand:SF 1 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fneg%.s %1,%0")
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (neg:DF (match_operand:DF 1 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fneg%.d %1,%0")
-
-;; Absolute value instructions
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (abs:SF (match_operand:SF 1 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fabs%.s %1,%0")
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (abs:DF (match_operand:DF 1 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fabs%.d %1,%0")
-
-;; Square root instructions
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fsqrt%.s %1,%0")
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "fm")))]
- "TARGET_CE"
- "fsqrt%.d %1,%0")
-
-;; one complement instructions
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (not:SI (match_operand:SI 1 "general_operand" "0")))]
- ""
- "not%.l %0")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (not:HI (match_operand:HI 1 "general_operand" "0")))]
- ""
- "not%.w %0")
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (not:QI (match_operand:QI 1 "general_operand" "0")))]
- ""
- "not%.b %0")
-
-
-;; arithmetic shift instructions
-;; We don't need the shift memory by 1 bit instruction
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (ashift:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dI")))]
- ""
- "asl%.l %2,%0")
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (ashift:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dI")))]
- ""
- "asl%.w %2,%0")
-
-(define_insn "ashlqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (ashift:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- ""
- "asl%.b %2,%0")
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dI")))]
- ""
- "asr%.l %2,%0")
-
-(define_insn "ashrhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dI")))]
- ""
- "asr%.w %2,%0")
-
-(define_insn "ashrqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- ""
- "asr%.b %2,%0")
-
-;; logical shift instructions
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dI")))]
- ""
- "lsr%.l %2,%0")
-
-(define_insn "lshrhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dI")))]
- ""
- "lsr%.w %2,%0")
-
-(define_insn "lshrqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- ""
- "lsr%.b %2,%0")
-
-;; rotate instructions
-
-(define_insn "rotlsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (rotate:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dI")))]
- ""
- "rol%.l %2,%0")
-
-(define_insn "rotlhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (rotate:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dI")))]
- ""
- "rol%.w %2,%0")
-
-(define_insn "rotlqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (rotate:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- ""
- "rol%.b %2,%0")
-
-(define_insn "rotrsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (rotatert:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dI")))]
- ""
- "ror%.l %2,%0")
-
-(define_insn "rotrhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (rotatert:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dI")))]
- ""
- "ror%.w %2,%0")
-
-(define_insn "rotrqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (rotatert:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- ""
- "ror%.b %2,%0")
-
-;; Special cases of bit-field insns which we should
-;; recognize in preference to the general case.
-;; These handle aligned 8-bit and 16-bit fields,
-;; which can usually be done with move instructions.
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "const_int_operand" "i"))
- (match_operand:SI 3 "general_operand" "d"))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
- && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
- && (GET_CODE (operands[0]) == REG
- || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
- "*
-{
- if (REG_P (operands[0]))
- {
- if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
- return \"bfins %3,[%c2,%c1]%0\";
- }
- else
- operands[0]
- = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
-
- if (GET_CODE (operands[3]) == MEM)
- operands[3] = adj_offsettable_operand (operands[3],
- (32 - INTVAL (operands[1])) / 8);
- if (INTVAL (operands[1]) == 8)
- return \"mov%.b %3,%0\";
- return \"mov%.w %3,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=&d")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "const_int_operand" "i")))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
- && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
- && (GET_CODE (operands[1]) == REG
- || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
- "*
-{
- if (REG_P (operands[1]))
- {
- if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
- return \"bfextu [%c3,%c2]%1,%0\";
- }
- else
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- output_asm_insn (\"clrl %0\", operands);
- if (GET_CODE (operands[0]) == MEM)
- operands[0] = adj_offsettable_operand (operands[0],
- (32 - INTVAL (operands[1])) / 8);
- if (INTVAL (operands[2]) == 8)
- return \"mov%.b %1,%0\";
- return \"mov%.w %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "const_int_operand" "i")))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
- && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
- && (GET_CODE (operands[1]) == REG
- || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
- "*
-{
- if (REG_P (operands[1]))
- {
- if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
- return \"bfexts [%c3,%c2]%1,%0\";
- }
- else
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- if (INTVAL (operands[2]) == 8)
- return \"mov%.b %1,%0\;extb%.l %0\";
- return \"mov%.w %1,%0\;ext%.l %0\";
-}")
-
-;; Bit field instructions, general cases.
-;; "o,d" constraint causes a nonoffsettable memref to match the "o"
-;; so that its address is reloaded.
-
-(define_expand "extv"
- [(set (match_operand:SI 0 "general_operand" "")
- (sign_extract:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
- (match_operand:SI 2 "general_operand" "di")
- (match_operand:SI 3 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "bfexts [%c3,%c2]%1,%0")
-
-(define_expand "extzv"
- [(set (match_operand:SI 0 "general_operand" "")
- (zero_extract:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (zero_extract:SI (match_operand:QI 1 "memory_operand" "o")
- (match_operand:SI 2 "general_operand" "di")
- (match_operand:SI 3 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "bfextu [%c3,%c2]%1,%0")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
- (match_operand:SI 3 "const_int_operand" "i,i")))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[3]) == -1
- || (GET_CODE (operands[1]) == CONST_INT
- && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
- "*
-{
- CC_STATUS_INIT;
- return \"bfchg [%c2,%c1]%0\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (const_int 0))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- CC_STATUS_INIT;
- return \"bfclr [%c2,%c1]%0\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (const_int -1))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- CC_STATUS_INIT;
- return \"bfset [%c2,%c1]%0\";
-}")
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" ""))
- (match_operand:SI 3 "general_operand" ""))]
- "TARGET_68020 && TARGET_BITFIELD"
- "")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (match_operand:SI 3 "general_operand" "d"))]
- "TARGET_68020 && TARGET_BITFIELD"
- "bfins %3,[%c2,%c1]%0")
-
-;; Now recognize bit field insns that operate on registers
-;; (or at least were intended to do so).
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "general_operand" "di")
- (match_operand:SI 3 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "bfexts [%c3,%c2]%1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "general_operand" "di")
- (match_operand:SI 3 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "bfextu [%c3,%c2]%1,%0")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (const_int 0))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- CC_STATUS_INIT;
- return \"bfclr [%c2,%c1]%0\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (const_int -1))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- CC_STATUS_INIT;
- return \"bfset [%c2,%c1]%0\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (match_operand:SI 3 "general_operand" "d"))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- return \"bfins %3,[%c2,%c1]%0\";
-}")
-
-;; Special patterns for optimizing bit-field instructions.
-
-(define_insn ""
- [(set (cc0)
- (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- if (operands[1] == const1_rtx
- && GET_CODE (operands[2]) == CONST_INT)
- {
- int width = GET_CODE (operands[0]) == REG ? 31 : 7;
- return output_btst (operands,
- gen_rtx (CONST_INT, VOIDmode,
- width - INTVAL (operands[2])),
- operands[0],
- insn, 1000);
- /* Pass 1000 as SIGNPOS argument so that btst will
- not think we are testing the sign bit for an `and'
- and assume that nonzero implies a negative result. */
- }
- if (INTVAL (operands[1]) != 32)
- cc_status.flags = CC_NOT_NEGATIVE;
- return \"bftst [%c2,%c1]%0\";
-}")
-
-;;; now handle the register cases
-(define_insn ""
- [(set (cc0)
- (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- if (operands[1] == const1_rtx
- && GET_CODE (operands[2]) == CONST_INT)
- {
- int width = GET_CODE (operands[0]) == REG ? 31 : 7;
- return output_btst (operands,
- gen_rtx (CONST_INT, VOIDmode,
- width - INTVAL (operands[2])),
- operands[0],
- insn, 1000);
- /* Pass 1000 as SIGNPOS argument so that btst will
- not think we are testing the sign bit for an `and'
- and assume that nonzero implies a negative result. */
- }
- if (INTVAL (operands[1]) != 32)
- cc_status.flags = CC_NOT_NEGATIVE;
- return \"bftst [%c2,%c1]%0\";
-}")
-
-
-(define_insn "seq"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (eq:QI (cc0) (const_int 0)))]
- ""
- "*
- cc_status = cc_prev_status;
- OUTPUT_JUMP (\"seq %0\", \"fseq %0\", \"seq %0\");
-")
-
-(define_insn "sne"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (ne:QI (cc0) (const_int 0)))]
- ""
- "*
- cc_status = cc_prev_status;
- OUTPUT_JUMP (\"sne %0\", \"fsneq %0\", \"sne %0\");
-")
-
-(define_insn "sgt"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (gt:QI (cc0) (const_int 0)))]
- ""
- "*
- cc_status = cc_prev_status;
- OUTPUT_JUMP (\"sgt %0\", \"fsgt %0\", \"and%.b %#0xc,%!\;sgt %0\");
-")
-
-(define_insn "sgtu"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (gtu:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- return \"shi %0\"; ")
-
-(define_insn "slt"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (lt:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- OUTPUT_JUMP (\"slt %0\", \"fslt %0\", \"smi %0\"); ")
-
-(define_insn "sltu"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (ltu:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- return \"scs %0\"; ")
-
-(define_insn "sge"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (ge:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- OUTPUT_JUMP (\"sge %0\", \"fsge %0\", \"spl %0\"); ")
-
-(define_insn "sgeu"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (geu:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- return \"scc %0\"; ")
-
-(define_insn "sle"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (le:QI (cc0) (const_int 0)))]
- ""
- "*
- cc_status = cc_prev_status;
- OUTPUT_JUMP (\"sle %0\", \"fsle %0\", \"and%.b %#0xc,%!\;sle %0\");
-")
-
-(define_insn "sleu"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (leu:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- return \"sls %0\"; ")
-
-;; Basic conditional jump instructions.
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- OUTPUT_JUMP (\"jeq %l0\", \"fbeq %l0\", \"jeq %l0\");
-}")
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- OUTPUT_JUMP (\"jne %l0\", \"fbneq %l0\", \"jne %l0\");
-}")
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- OUTPUT_JUMP (\"jgt %l0\", \"fbgt %l0\", \"and%.b %#0xc,%!\;jgt %l0\");
-")
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- return \"jhi %l0\";
-")
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- OUTPUT_JUMP (\"jlt %l0\", \"fblt %l0\", \"jmi %l0\");
-")
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- return \"jcs %l0\";
-")
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- OUTPUT_JUMP (\"jge %l0\", \"fbge %l0\", \"jpl %l0\");
-")
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- return \"jcc %l0\";
-")
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- OUTPUT_JUMP (\"jle %l0\", \"fble %l0\", \"and%.b %#0xc,%!\;jle %l0\");
-")
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- return \"jls %l0\";
-")
-
-;; Negated conditional jump instructions.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- OUTPUT_JUMP (\"jne %l0\", \"fbneq %l0\", \"jne %l0\");
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- OUTPUT_JUMP (\"jeq %l0\", \"fbeq %l0\", \"jeq %l0\");
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- OUTPUT_JUMP (\"jle %l0\", \"fbngt %l0\", \"and%.b %#0xc,%!\;jle %l0\");
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- return \"jls %l0\";
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- OUTPUT_JUMP (\"jge %l0\", \"fbnlt %l0\", \"jpl %l0\");
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- return \"jcc %l0\";
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- OUTPUT_JUMP (\"jlt %l0\", \"fbnge %l0\", \"jmi %l0\");
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- return \"jcs %l0\";
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- OUTPUT_JUMP (\"jgt %l0\", \"fbnle %l0\", \"and%.b %#0xc,%!\;jgt %l0\");
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- return \"jhi %l0\";
-")
-
-;; Subroutines of "casesi".
-
-(define_expand "casesi_1"
- [(set (match_operand:SI 3 "general_operand" "")
- (plus:SI (match_operand:SI 0 "general_operand" "")
- ;; Note operand 1 has been negated!
- (match_operand:SI 1 "immediate_operand" "")))
- (set (cc0) (compare (match_operand:SI 2 "nonimmediate_operand" "")
- (match_dup 3)))
- (set (pc) (if_then_else (ltu (cc0) (const_int 0))
- (label_ref (match_operand 4 "" "")) (pc)))]
- ""
- "")
-
-(define_expand "casesi_2"
- [(set (match_operand:HI 0 "" "") (mem:HI (match_operand:SI 1 "" "")))
- ;; The USE here is so that at least one jump-insn will refer to the label,
- ;; to keep it alive in jump_optimize.
- (parallel [(set (pc)
- (plus:SI (pc) (sign_extend:SI (match_dup 0))))
- (use (label_ref (match_operand 2 "" "")))])]
- ""
- "")
-
-;; Operand 0 is index (in bytes); operand 1 is minimum, operand 2 the maximum;
-;; operand 3 is CODE_LABEL for the table;
-;; operand 4 is the CODE_LABEL to go to if index out of range.
-(define_expand "casesi"
- ;; We don't use these for generating the RTL, but we must describe
- ;; the operands here.
- [(match_operand:HI 0 "general_operand" "")
- (match_operand:SI 1 "immediate_operand" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand 3 "" "")
- (match_operand 4 "" "")]
- ""
- "
-{
- rtx table_elt_addr;
- rtx index_diff;
-
- operands[1] = negate_rtx (SImode, operands[1]);
- index_diff = gen_reg_rtx (SImode);
- /* Emit the first few insns. */
- emit_insn (gen_casesi_1 (operands[0], operands[1], operands[2],
- index_diff, operands[4]));
- /* Construct a memory address. This may emit some insns. */
- table_elt_addr
- = memory_address_noforce
- (HImode,
- gen_rtx (PLUS, Pmode,
- gen_rtx (MULT, Pmode, index_diff,
- gen_rtx (CONST_INT, VOIDmode, 2)),
- gen_rtx (LABEL_REF, VOIDmode, operands[3])));
- /* Emit the last few insns. */
- emit_insn (gen_casesi_2 (gen_reg_rtx (HImode), table_elt_addr, operands[3]));
- DONE;
-}")
-
-;; Recognize one of the insns resulting from casesi_2.
-(define_insn ""
- [(set (pc)
- (plus:SI (pc)
- (sign_extend:SI (match_operand:HI 0 "general_operand" "r"))))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "*
- return \"jmp pc@(2:B)[%0:W:B]\";
-")
-
-;; Unconditional and other jump instructions
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
- return \"jra %l0\";
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operand:HI 0 "general_operand" "d,m,g")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:HI (match_dup 0)
- (const_int -1)))]
- ""
- "@
- dbra %0,%l1
- subq%.w %#1,%0\;jcc %l1
- subq%.w %#1,%0\;cmp%.w %#-1,%0\;jne %l1")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operand:SI 0 "general_operand" "d,m,g")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- ""
- "@
- dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jcc %l1
- subq%.l %#1,%0\;jcc %l1
- subq%.l %#1,%0\;cmp%.l %#-1,%0\;jne %l1")
-
-;; dbra patterns that use REG_NOTES info generated by strength_reduce.
-
-(define_expand "decrement_and_branch_until_zero"
- [(parallel [(set (pc)
- (if_then_else
- (ge (match_operand:SI 0 "general_operand" "")
- (const_int 1))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))])]
- ""
- "")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ge (match_operand:SI 0 "general_operand" "d,m,g")
- (const_int 1))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- "find_reg_note (insn, REG_NONNEG, 0)"
- "@
- dbra %0,%l1\;clrw %0\;subql %#1,%0\;jcc %l1
- subq%.l %#1,%0\;jcc %l1
- subq%.l %#1,%0\;cmp%.l %#-1,%0\;jne %l1")
-
-;; Call subroutine with no return value.
-(define_insn "call"
- [(call (match_operand:QI 0 "memory_operand" "o")
- (match_operand:SI 1 "general_operand" "g"))]
- ""
- "*
-{
- rtx xoperands[2];
- int size = XINT(operands[1],0);
-
- if (size == 0)
- output_asm_insn (\"sub%.l a0,a0\;jbsr %0\", operands);
- else
- {
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode, size/4);
- output_asm_insn (\"mov%.l sp,a0\;pea %a1\", xoperands);
- output_asm_insn (\"jbsr %0\", operands);
- size = size + 4;
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode, size);
- if (size <= 8)
- output_asm_insn (\"addq%.l %1,sp\", xoperands);
- else if (size < 0x8000)
- output_asm_insn (\"add%.w %1,sp\", xoperands);
- else
- output_asm_insn (\"add%.l %1,sp\", xoperands);
- }
- return \"mov%.l a6@(-4),a0\";
-}")
-
-;; Call subroutine, returning value in operand 0
-;; (which must be a hard register).
-(define_insn "call_value"
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "memory_operand" "o")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- rtx xoperands[3];
- int size = XINT(operands[2],0);
-
- if (size == 0)
- output_asm_insn(\"sub%.l a0,a0\;jbsr %1\", operands);
- else
- {
- xoperands[2] = gen_rtx (CONST_INT, VOIDmode, size/4);
- output_asm_insn (\"mov%.l sp,a0\;pea %a2\", xoperands);
- output_asm_insn (\"jbsr %1\", operands);
- size = size + 4;
- xoperands[2] = gen_rtx (CONST_INT, VOIDmode, size);
- if (size <= 8)
- output_asm_insn (\"addq%.l %2,sp\", xoperands);
- else if (size < 0x8000)
- output_asm_insn (\"add%.w %2,sp\", xoperands);
- else
- output_asm_insn (\"add%.l %2,sp\", xoperands);
- }
- return \"mov%.l a6@(-4),a0\";
-}")
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-;; This should not be used unless the add/sub insns can't be.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=a")
- (match_operand:QI 1 "address_operand" "p"))]
- ""
- "lea %a1,%0")
-
-;; This is the first machine-dependent peephole optimization.
-;; It is useful when a floating value is returned from a function call
-;; and then is moved into an FP register.
-;; But it is mainly intended to test the support for these optimizations.
-
-;Not applicable to Alliant -- floating results are returned in fp0
-;(define_peephole
-; [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
-; (set (match_operand:DF 0 "register_operand" "f")
-; (match_operand:DF 1 "register_operand" "ad"))]
-; "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
-; "*
-;{
-; rtx xoperands[2];
-; xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
-; output_asm_insn (\"mov%.l %1,%@\", xoperands);
-; output_asm_insn (\"mov%.l %1,%-\", operands);
-; return \"fmove%.d %+,%0\";
-;}
-;")
diff --git a/gcc/config/fx80/xm-fx80.h b/gcc/config/fx80/xm-fx80.h
deleted file mode 100644
index 178d76253f5..00000000000
--- a/gcc/config/fx80/xm-fx80.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Configuration for GNU C-compiler for Alliant FX computers.
- Copyright (C) 1989, 1993 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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
diff --git a/gcc/config/gmicro/gmicro.c b/gcc/config/gmicro/gmicro.c
deleted file mode 100644
index 866c6c4a672..00000000000
--- a/gcc/config/gmicro/gmicro.c
+++ /dev/null
@@ -1,984 +0,0 @@
-/* Subroutines for insn-output.c for the Gmicro.
- Ported by Masanobu Yuhara, Fujitsu Laboratories LTD.
- (yuhara@flab.fujitsu.co.jp)
-
- Copyright (C) 1990, 1991 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.
-
-Among other things, the copyright
-notice and this notice must be preserved on all copies.
-
-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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-
-extern char *rtx_name[];
-
-mypr (s, a1, a2, a3, a4, a5)
- char *s;
- int a1, a2, a3, a4, a5;
-{
- fprintf (stderr, s, a1, a2, a3, a4, a5);
-}
-
-myprcode (i)
- int i;
-{
- if (i < 0 || i > 90)
- fprintf (stderr, "code = %d\n", i);
- else
- fprintf (stderr, "code = %s\n", rtx_name[i]);
-}
-
-myabort (i)
- int i;
-{
- fprintf (stderr, "myabort");
- myprcode (i);
-}
-
-
-/* This is how to output an ascii string. */
-/* See ASM_OUTPUT_ASCII in gmicro.h. */
-output_ascii (file, p, size)
- FILE *file;
- char *p;
- int size;
-{
- int i;
- int in_quote = 0;
- register int c;
-
- fprintf (file, "\t.sdata ");
-
- for (i = 0; i < size; i++)
- {
- c = p[i];
- if (c >= ' ' && c < 0x7f)
- {
- if (!in_quote)
- {
- putc ('"', file);
- in_quote = 1;
- }
- putc (c, file);
- }
- else
- {
- if (in_quote)
- {
- putc ('"', file);
- in_quote = 0;
- }
- fprintf (file, "<%d>", c);
- }
- }
- if (in_quote)
- putc ('"', file);
- putc ('\n', file);
-}
-
-
-/* call this when GET_CODE (index) is MULT. */
-print_scaled_index (file, index)
- FILE *file;
- register rtx index;
-{
- register rtx ireg;
- int scale;
-
- if (GET_CODE (XEXP (index, 0)) == REG)
- {
- ireg = XEXP (index, 0);
- scale = INTVAL (XEXP (index, 1));
- }
- else
- {
- ireg = XEXP (index, 1);
- scale = INTVAL (XEXP (index, 0));
- }
- if (scale == 1)
- fprintf (file, "%s", reg_names[REGNO (ireg)]);
- else
- fprintf (file, "%s*%d", reg_names[REGNO (ireg)], scale);
-}
-
-
-print_operand_address (file, addr)
- FILE *file;
- register rtx addr;
-{
- register rtx xtmp0, xtmp1, breg, ixreg;
- int scale;
- int needcomma = 0;
- rtx offset;
-
- fprintf (file, "@");
- retry:
- switch (GET_CODE (addr))
- {
- case MEM:
- fprintf (file, "@");
- addr = XEXP (addr, 0);
- goto retry;
-
- case REG:
- fprintf (file, "%s", reg_names[REGNO (addr)]);
- break;
-
- case MULT:
- print_scaled_index (file, addr);
- break;
-
- case PRE_DEC:
- fprintf (file, "-%s", reg_names[REGNO (XEXP (addr, 0))]);
- break;
-
- case POST_INC:
- fprintf (file, "%s+", reg_names[REGNO (XEXP (addr, 0))]);
- break;
-
- case PLUS:
- xtmp0 = XEXP (addr, 0);
- xtmp1 = XEXP (addr, 1);
- ixreg = 0; breg = 0;
- offset = 0;
- if (CONSTANT_ADDRESS_P (xtmp0))
- {
- offset = xtmp0;
- breg = xtmp1;
- }
- else if (CONSTANT_ADDRESS_P (xtmp1))
- {
- offset = xtmp1;
- breg = xtmp0;
- }
- else
- {
- goto NOT_DISP;
- }
-
- if (REG_CODE_BASE_P (breg))
- goto PRINT_MEM;
-
- if (GET_CODE (breg) == MULT)
- {
- if (REG_CODE_INDEX_P (XEXP (breg, 0)))
- {
- ixreg = XEXP (breg, 0);
- scale = INTVAL (XEXP (breg, 1));
- breg = 0;
- }
- else
- {
- ixreg = XEXP (breg, 1);
- scale = INTVAL (XEXP (breg, 0));
- breg = 0;
- }
- goto PRINT_MEM;
- }
-
- /* GET_CODE (breg) must be PLUS here. */
- xtmp0 = XEXP (breg, 0);
- xtmp1 = XEXP (breg, 1);
- if (REG_CODE_BASE_P (xtmp0))
- {
- breg = xtmp0;
- xtmp0 = xtmp1;
- }
- else
- {
- breg = xtmp1;
- /* xtmp0 = xtmp0; */
- }
-
- if (GET_CODE (xtmp0) == MULT)
- {
- if (REG_CODE_INDEX_P (XEXP (xtmp0, 0)))
- {
- ixreg = XEXP (xtmp0, 0);
- scale = INTVAL (XEXP (xtmp0, 1));
- }
- else
- {
- ixreg = XEXP (xtmp0, 1);
- scale = INTVAL (XEXP (xtmp0, 0));
- }
- }
- else
- {
- ixreg = xtmp0;
- scale = 1;
- }
- goto PRINT_MEM;
-
- NOT_DISP:
- if (REG_CODE_BASE_P (xtmp0))
- {
- breg = xtmp0;
- xtmp0 = xtmp1;
- }
- else if (REG_CODE_BASE_P (xtmp1))
- {
- breg = xtmp1;
- /* xtmp0 = xtmp0; */
- }
- else
- goto NOT_BASE;
-
- if (REG_CODE_INDEX_P (xtmp0))
- {
- ixreg = xtmp0;
- scale = 1;
- goto PRINT_MEM;
- }
- else if (CONSTANT_ADDRESS_P (xtmp0))
- {
- offset = xtmp0;
- goto PRINT_MEM;
- }
- else if (GET_CODE (xtmp0) == MULT)
- {
- if (REG_CODE_INDEX_P (XEXP (xtmp0, 0)))
- {
- ixreg = XEXP (xtmp0, 0);
- scale = INTVAL (XEXP (xtmp0, 1));
- }
- else
- {
- ixreg = XEXP (xtmp0, 1);
- scale = INTVAL (XEXP (xtmp0, 0));
- }
- goto PRINT_MEM;
- }
-
- /* GET_CODE (xtmp0) must be PLUS. */
- xtmp1 = XEXP (xtmp0, 1);
- xtmp0 = XEXP (xtmp0, 0);
-
- if (CONSTANT_ADDRESS_P (xtmp0))
- {
- offset = xtmp0;
- xtmp0 = xtmp1;
- }
- else
- {
- offset = xtmp1;
- /* xtmp0 = xtmp0; */
- }
-
- if (REG_CODE_INDEX_P (xtmp0))
- {
- ixreg = xtmp0;
- }
- else
- { /* GET_CODE (xtmp0) must be MULT. */
- if (REG_CODE_INDEX_P (XEXP (xtmp0, 0)))
- {
- ixreg = XEXP (xtmp0, 0);
- scale = INTVAL (XEXP (xtmp0, 1));
- }
- else
- {
- ixreg = XEXP (xtmp0, 1);
- scale = INTVAL (XEXP (xtmp0, 0));
- }
- }
- goto PRINT_MEM;
-
- NOT_BASE:
- if (GET_CODE (xtmp0) == PLUS)
- {
- ixreg = xtmp1;
- /* xtmp0 = xtmp0; */
- }
- else
- {
- ixreg = xtmp0;
- xtmp0 = xtmp1;
- }
-
- if (REG_CODE_INDEX_P (ixreg))
- {
- scale = 1;
- }
- else if (REG_CODE_INDEX_P (XEXP (ixreg, 0)))
- {
- scale = INTVAL (XEXP (ixreg, 1));
- ixreg = XEXP (ixreg, 0);
- }
- else
- { /* was else if with no condition. OK ??? */
- scale = INTVAL (XEXP (ixreg, 0));
- ixreg = XEXP (ixreg, 1);
- }
-
- if (REG_CODE_BASE_P (XEXP (xtmp0, 0)))
- {
- breg = XEXP (xtmp0, 0);
- offset = XEXP (xtmp0, 1);
- }
- else
- {
- breg = XEXP (xtmp0, 1);
- offset = XEXP (xtmp0, 0);
- }
-
- PRINT_MEM:
- if (breg == 0 && ixreg == 0)
- {
- output_address (offset);
- break;
- }
- else if (ixreg == 0 && offset == 0)
- {
- fprintf (file, "%s", reg_names[REGNO (breg)]);
- break;
- }
- else
- {
- fprintf (file, "(");
- if (offset != 0)
- {
- output_addr_const (file, offset);
- needcomma = 1;
- }
- if (breg != 0)
- {
- if (needcomma)
- fprintf (file, ",");
- fprintf (file, "%s", reg_names[REGNO (breg)]);
- needcomma = 1;
- }
- if (ixreg != 0)
- {
- if (needcomma)
- fprintf (file, ",");
- fprintf (file, "%s", reg_names[REGNO (ixreg)]);
- if (scale != 1)
- fprintf (file,"*%d", scale);
- }
- fprintf (file, ")");
-
- break;
- }
-
- default:
- output_addr_const (file, addr);
- }
-}
-
-
-
-/* Return a REG that occurs in ADDR with coefficient 1.
- ADDR can be effectively incremented by incrementing REG. */
-
-static rtx
-find_addr_reg (addr)
- rtx addr;
-{
- while (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG)
- addr = XEXP (addr, 0);
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- addr = XEXP (addr, 1);
- else if (GET_CODE (XEXP (addr, 0)) == PLUS)
- addr = XEXP (addr, 0);
- else if (GET_CODE (XEXP (addr, 1)) == PLUS)
- addr = XEXP (addr, 1);
- }
- if (GET_CODE (addr) == REG)
- return addr;
- return 0;
-}
-
-
- /* Return the best assembler insn template
- for moving operands[1] into operands[0] as a fullword. */
-
-static char *
-singlemove_string (operands)
- rtx *operands;
-{
- if (FPU_REG_P (operands[0]) || FPU_REG_P (operands[1]))
- {
- if (GREG_P (operands[0]) || GREG_P (operands[1]))
- {
- myabort (101); /* Not Supported yet !! */
- }
- else
- {
- return "fmov.s %1,%0";
- }
- }
- return "mov.w %1,%0";
-}
-
-
-/* Output assembler code to perform a doubleword move insn
- with operands OPERANDS. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum
- { REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP }
- optype0, optype1;
- rtx latehalf[2];
- rtx addreg0 = 0, addreg1 = 0;
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- optype0 = POPOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- optype0 = PUSHOP;
- else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1]))
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC)
- optype1 = POPOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- optype1 = PUSHOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP)
- myabort (102);
-
- /* If one operand is decrementing and one is incrementing
- decrement the former register explicitly
- and change that operand into ordinary indexing. */
-
- if (optype0 == PUSHOP && optype1 == POPOP)
- {
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
- output_asm_insn ("sub.w %#8,%0", operands);
- operands[0] = gen_rtx (MEM, DImode, operands[0]);
- optype0 = OFFSOP;
- }
- if (optype0 == POPOP && optype1 == PUSHOP)
- {
- operands[1] = XEXP (XEXP (operands[1], 0), 0);
- output_asm_insn ("sub.w %#8,%1", operands);
- operands[1] = gen_rtx (MEM, DImode, operands[1]);
- optype1 = OFFSOP;
- }
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (operands[0]);
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (operands[1]);
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first,
- but if either operand is autodecrementing then we
- do the high-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], 4);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- else if (optype1 == CNSTOP)
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- split_double (operands[1], &operands[1], &latehalf[1]);
- else if (CONSTANT_P (operands[1]))
- latehalf[1] = const0_rtx;
- }
- else
- latehalf[1] = operands[1];
-
- /* If insn is effectively movd N(sp),-(sp) then we will do the
- high word first. We should use the adjusted operand 1 (which is N+4(sp))
- for the low word as well, to compensate for the first decrement of sp. */
- if (optype0 == PUSHOP
- && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM
- && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1]))
- operands[1] = latehalf[1];
-
- /* If one or both operands autodecrementing,
- do the two words, high-numbered first. */
-
- /* Likewise, the first move would clobber the source of the second one,
- do them in the other order. This happens only for registers;
- such overlap can't happen in memory unless the user explicitly
- sets it up, and that is an undefined circumstance. */
-
- if (optype0 == PUSHOP || optype1 == PUSHOP
- || (optype0 == REGOP && optype1 == REGOP
- && REGNO (operands[0]) == REGNO (latehalf[1])))
- {
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("add.w %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add.w %#4,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("sub.w %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("sub.w %#4,%0", &addreg1);
-
- /* Do low-numbered word. */
- return singlemove_string (operands);
- }
-
- /* Normal case: do the two words, low-numbered first. */
-
- output_asm_insn (singlemove_string (operands), operands);
-
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("add.w %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add.w %#4,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("sub.w %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("sub.w %#4,%0", &addreg1);
-
- return "";
-}
-
-/* Move const_double to floating point register (DF) */
-char *
-output_move_const_double (operands)
- rtx *operands;
-{
- int code = standard_fpu_constant_p (operands[1]);
-
- if (FPU_REG_P (operands[0]))
- {
- if (code != 0)
- {
- static char buf[40];
-
- sprintf (buf, "fmvr from%d,%%0.d", code);
- return buf;
- }
- else
- {
- return "fmov %1,%0.d";
- }
- }
- else if (GREG_P (operands[0]))
- {
- rtx xoperands[2];
- xoperands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[1]));
- output_asm_insn ("mov.w %1,%0", xoperands);
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[1]));
- return "mov.w %1,%0";
- }
- else
- {
- return output_move_double (operands); /* ?????? */
- }
-}
-
-char *
-output_move_const_single (operands)
- rtx *operands;
-{
- int code = standard_fpu_constant_p (operands[1]);
- static char buf[40];
-
- if (FPU_REG_P (operands[0]))
- {
- if (code != 0)
- {
- sprintf (buf, "fmvr from%d,%%0.s", code);
- return buf;
- }
- return "fmov.s %f1,%0";
- }
- else
- return "mov.w %f1,%0";
-}
-
-
-/* Return nonzero if X, a CONST_DOUBLE, has a value that we can get
- from the "fmvr" instruction of the Gmicro FPU.
- The value, anded with 0xff, gives the code to use in fmovecr
- to get the desired constant. */
-
- u.i[0] = CONST_DOUBLE_LOW (x);
- u.i[1] = CONST_DOUBLE_HIGH (x);
- d = u.d;
-
- if (d == 0.0) /* +0.0 */
- return 0x0;
- /* Note: there are various other constants available
- but it is a nuisance to put in their values here. */
- if (d == 1.0) /* +1.0 */
- return 0x1;
-
- /*
- * Stuff that looks different if it's single or double
- */
- if (GET_MODE (x) == SFmode)
- {
- if (d == S_PI)
- return 0x2;
- if (d == (S_PI / 2.0))
- return 0x3;
- if (d == S_E)
- return 0x4;
- if (d == S_LOGEof2)
- return 0x5;
- if (d == S_LOGEof10)
- return 0x6;
- if (d == S_LOG10of2)
- return 0x7;
- if (d == S_LOG10ofE)
- return 0x8;
- if (d == S_LOG2ofE)
- return 0x9;
- }
- else
- {
- if (d == D_PI)
- return 0x2;
- if (d == (D_PI / 2.0))
- return 0x3;
- if (d == D_E)
- return 0x4;
- if (d == D_LOGEof2)
- return 0x5;
- if (d == D_LOGEof10)
- return 0x6;
- if (d == D_LOG10of2)
- return 0x7;
- if (d == D_LOG10ofE)
- return 0x8;
- if (d == D_LOG2ofE)
- return 0x9;
- }
-
- return 0;
-}
-
-#undef S_PI
-#undef D_PI
-#undef S_E
-#undef D_E
-#undef S_LOGEof2
-#undef D_LOGEof2
-#undef S_LOGEof10
-#undef D_LOGEof10
-#undef S_LOG10of2
-#undef D_LOG10of2
-#undef S_LOG10ofE
-#undef D_LOG10ofE
-#undef S_LOG2ofE
-#undef D_LOG2ofE
-
-/* dest should be operand 0 */
-/* imm should be operand 1 */
-
-extern char *sub_imm_word ();
-
-char *
-add_imm_word (imm, dest, immp)
- int imm;
- rtx dest, *immp;
-{
- int is_reg, short_ok;
-
-
- if (imm < 0)
- {
- *immp = gen_rtx (CONST_INT, VOIDmode, -imm);
- return sub_imm_word (-imm, dest);
- }
-
- if (imm == 0)
- return "mov:l.w #0,%0";
-
- short_ok = short_format_ok (dest);
-
- if (short_ok && imm <= 8)
- return "add:q %1,%0.w";
-
- if (imm < 128)
- return "add:e %1,%0.w";
-
- is_reg = (GET_CODE (dest) == REG);
-
- if (is_reg)
- return "add:l %1,%0.w";
-
- if (short_ok)
- return "add:i %1,%0.w";
-
- return "add %1,%0.w";
-}
-
-char *
-sub_imm_word (imm, dest, immp)
- int imm;
- rtx dest, *immp;
-{
- int is_reg, short_ok;
-
- if (imm < 0 && imm != 0x80000000)
- {
- *immp = gen_rtx (CONST_INT, VOIDmode, -imm);
- return add_imm_word (-imm, dest);
- }
-
- if (imm == 0)
- return "mov:z.w #0,%0";
-
- short_ok = short_format_ok (dest);
-
- if (short_ok && imm <= 8)
- return "sub:q %1,%0.w";
-
- if (imm < 128)
- return "sub:e %1,%0.w";
-
- is_reg = (GET_CODE (dest) == REG);
-
- if (is_reg)
- return "sub:l %1,%0.w";
-
- if (short_ok)
- return "sub:i %1,%0.w";
-
- return "sub %1,%0.w";
-}
-
-int
-short_format_ok (x)
- rtx x;
-{
- rtx x0, x1;
-
- if (GET_CODE (x) == REG)
- return 1;
-
- if (GET_CODE (x) == MEM
- && GET_CODE (XEXP (x, 0)) == PLUS)
- {
- x0 = XEXP (XEXP (x, 0), 0);
- x1 = XEXP (XEXP (x, 0), 1);
- return ((GET_CODE (x0) == REG
- && CONSTANT_P (x1)
- && ((unsigned) (INTVAL (x1) + 0x8000) < 0x10000))
- ||
- (GET_CODE (x1) == REG
- && CONSTANT_P (x0)
- && ((unsigned) (INTVAL (x0) + 0x8000) < 0x10000)));
- }
-
- return 0;
-}
-
-myoutput_sp_adjust (file, op, fsize)
- FILE *file;
- char *op;
- int fsize;
-{
- if (fsize == 0)
- ;
- else if (fsize < 8)
- fprintf (file, "\t%s:q #%d,sp.w\n", op, fsize);
- else if (fsize < 128)
- fprintf (file, "\t%s:e #%d,sp.w\n", op, fsize);
- else
- fprintf (file, "\t%s:l #%d,sp.w\n", op, fsize);
-}
-
-
-char *
-mov_imm_word (imm, dest)
- int imm;
- rtx dest;
-{
- int is_reg, short_ok;
-
- if (imm == 0)
- return "mov:z.w #0,%0";
-
- short_ok = short_format_ok (dest);
-
- if (short_ok && imm > 0 && imm <= 8)
- return "mov:q %1,%0.w";
-
- if (-128 <= imm && imm < 128)
- return "mov:e %1,%0.w";
-
- is_reg = (GET_CODE (dest) == REG);
-
- if (is_reg)
- return "mov:l %1,%0.w";
-
- if (short_ok)
- return "mov:i %1,%0.w";
-
- return "mov %1,%0.w";
-}
-
-char *
-cmp_imm_word (imm, dest)
- int imm;
- rtx dest;
-{
- int is_reg, short_ok;
-
- if (imm == 0)
- return "cmp:z.w #0,%0";
-
- short_ok = short_format_ok (dest);
-
- if (short_ok && imm >0 && imm <= 8)
- return "cmp:q %1,%0.w";
-
- if (-128 <= imm && imm < 128)
- return "cmp:e %1,%0.w";
-
- is_reg = (GET_CODE (dest) == REG);
-
- if (is_reg)
- return "cmp:l %1,%0.w";
-
- if (short_ok)
- return "cmp:i %1,%0.w";
-
- return "cmp %1,%0.w";
-}
-
-char *
-push_imm_word (imm)
- int imm;
-{
- if (imm == 0)
- return "mov:z.w #0,%-";
-
- if (imm > 0 && imm <= 8)
- return "mov:q %1,%-.w";
-
- if (-128 <= imm && imm < 128)
- return "mov:e %1,%-.w";
-
- return "mov:g %1,%-.w";
-
- /* In some cases, g-format may be better than I format.??
- return "mov %1,%0.w";
- */
-}
-
-my_signed_comp (insn)
- rtx insn;
-{
- rtx my_insn;
-
- my_insn = NEXT_INSN (insn);
- if (GET_CODE (my_insn) != JUMP_INSN)
- {
- fprintf (stderr, "my_signed_comp: Not Jump_insn ");
- myabort (GET_CODE (my_insn));
- }
- my_insn = PATTERN (my_insn);
- if (GET_CODE (my_insn) != SET)
- {
- fprintf (stderr, "my_signed_comp: Not Set ");
- myabort (GET_CODE (my_insn));
- }
- my_insn = SET_SRC (my_insn);
- if (GET_CODE (my_insn) != IF_THEN_ELSE)
- {
- fprintf (stderr, "my_signed_comp: Not if_then_else ");
- myabort (GET_CODE (my_insn));
- }
- switch (GET_CODE (XEXP (my_insn, 0)))
- {
- case NE:
- case EQ:
- case GE:
- case GT:
- case LE:
- case LT:
- return 1;
- case GEU:
- case GTU:
- case LEU:
- case LTU:
- return 0;
- }
- fprintf (stderr, "my_signed_comp: Not cccc ");
- myabort (GET_CODE (XEXP (my_insn, 0)));
-}
diff --git a/gcc/config/gmicro/gmicro.h b/gcc/config/gmicro/gmicro.h
deleted file mode 100644
index 29701f25fd7..00000000000
--- a/gcc/config/gmicro/gmicro.h
+++ /dev/null
@@ -1,1588 +0,0 @@
-/* Definitions of target machine for GNU compiler. Gmicro (TRON) version.
- Copyright (C) 1987, 88, 89, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Masanobu Yuhara, Fujitsu Laboratories LTD.
- (yuhara@flab.fujitsu.co.jp)
-
-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. */
-
-
-/* Note that some other tm.h files include this one and then override
- many of the definitions that relate to assembler syntax. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dgmicro -Acpu(tron) -Amachine(tron)"
-
-/* #define CPP_SPEC ** currently not defined **/
-
-/* #define CC1_SPEC ** currently not defined **/
-
-
-/* Print subsidiary information on the compiler version in use. */
-/*
-#define TARGET_VERSION fprintf (stderr, " (Gmicro syntax)");
-*/
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Compile for a Gmicro/300. */
-#define TARGET_G300 (target_flags & 1)
-/* Compile for a Gmicro/200. */
-#define TARGET_G200 (target_flags & 2)
-/* Compile for a Gmicro/100. */
-#define TARGET_G100 (target_flags & 4)
-
-/* Compile FPU insns for floating point (not library calls). */
-#define TARGET_FPU (target_flags & 8)
-
-/* Pop up arguments by called function. */
-#define TARGET_RTD (target_flags & 0x10)
-
-/* Compile passing first args in regs 0 and 1.
- This exists only to test compiler features that will be needed for
- RISC chips. It is not usable and is not intended to be usable on
- this cpu ;-< */
-#define TARGET_REGPARM (target_flags & 0x20)
-
-#define TARGET_BITFIELD (target_flags & 0x40)
-
-#define TARGET_NEWRETURN (target_flags & 0x80)
-
-/* Do not expand __builtin_smov (strcpy) to multiple movs.
- Use the smov instruction. */
-#define TARGET_FORCE_SMOV (target_flags & 0x100)
-
-/* default options are -m300, -mFPU,
- with bitfield instructions added because it won't always work otherwise.
- If there are versions of the gmicro that don't support bitfield instructions
- then it will take some thinking to figure out how to make them work. */
-#define TARGET_DEFAULT 0x49
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { { "g300", 1}, \
- { "g200", 2}, \
- { "g100", 4}, \
- { "fpu", 8}, \
- { "soft-float", -8}, \
- { "rtd", 0x10}, \
- { "no-rtd", -0x10}, \
- { "regparm", 0x20}, \
- { "no-regparm", -0x20}, \
-#if 0 /* Since we don't define PCC_BITFIELD_TYPE_MATTERS or use a large
- STRUCTURE_SIZE_BOUNDARY, we must have bitfield instructions. */
- { "bitfield", 0x40}, \
- { "no-bitfield", -0x40}, \
-#endif
- { "newreturn", 0x80}, \
- { "no-newreturn", -0x80}, \
- { "force-smov", 0x100}, \
- { "no-force-smov", -0x100}, \
- { "", TARGET_DEFAULT}}
-
-
-/* Blow away G100 flag silently off TARGET_fpu (since we can't clear
- any bits in TARGET_SWITCHES above) */
-#define OVERRIDE_OPTIONS \
-{ \
- if (TARGET_G100) target_flags &= ~8; \
-}
-
-/* target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is true for Gmicro insns.
- We make it true always by avoiding using the single-bit insns
- except in special cases with constant bit numbers. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is true on the Gmicro. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-/* For Gmicro we can decide arbitrarily
- since there are no machine instructions for them. ????? */
-#define WORDS_BIG_ENDIAN 0
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-/* Instructions of the Gmicro should be on half-word boundary */
-/* But word boundary gets better performance */
-#define FUNCTION_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* No data type wants to be aligned rounder than this. */
-/* This is not necessarily 32 on the Gmicro */
-#define BIGGEST_ALIGNMENT 32
-
-/* Set this non-zero if move instructions will actually fail to work
- when given unaligned data.
- Unaligned data is allowed on Gmicro, though the access is slow. */
-
-#define STRICT_ALIGNMENT 1
-#define SLOW_UNALIGNED_ACCESS 1
-
-/* Make strings word-aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- (TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Define number of bits in most basic integer type.
- (If undefined, default is BITS_PER_WORD). */
-#define INT_TYPE_SIZE 32
-
-/* #define PCC_BITFIELD_TYPE_MATTERS 1 ????? */
-
-/* #define CHECK_FLOAT_VALUE (MODE, VALUE) ????? */
-
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
- For the Gmicro, we give the general registers numbers 0-15,
- and the FPU floating point registers numbers 16-31. */
-#define FIRST_PSEUDO_REGISTER 32
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the Gmicro, the stack pointer and the frame pointer are
- such registers. */
-/* frame pointer is not indicated as fixed, because fp may be used freely
- when a frame is not built. */
-#define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 1, \
- /* FPU registers. */ \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 1, \
- /* FPU registers. */ \
- 1, 1, 1, 1, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, }
-
-
-/* Make sure everything's fine if we *don't* have a given processor.
- This assumes that putting a register in fixed_regs will keep the
- compilers mitt's completely off it. We don't bother to zero it out
- of register classes. If TARGET_FPU is not set,
- the compiler won't touch since no instructions that use these
- registers will be valid. */
-/* This Macro is not defined now.
- #define CONDITIONAL_REGISTER_USAGE */
-
-/* The Gmicro has no overlapping register */
-/* #define OVERLAPPING_REGNO_P(REGNO) */
-
-/* #define INSN_CLOBBERS_REGNO_P(INSN,REGNO) */
-/* #define PRESERVE_DEATH_INFO_REGNO_P(REGNO) */
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On the Gmicro, ordinary registers hold 32 bits worth;
- for the Gmicro/FPU registers, a single register is always enough for
- anything that can be stored in them at all. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((REGNO) >= 16 ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the Gmicro, the cpu registers can hold any mode but the FPU registers
- can hold only SFmode or DFmode. And the FPU registers can't hold anything
- if FPU use is disabled. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((REGNO) < 16 \
- || ((REGNO) < 32 \
- ? TARGET_FPU && (GET_MODE_CLASS (MODE) == MODE_FLOAT || \
- GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
- : 0 ))
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (! TARGET_FPU \
- || ((GET_MODE_CLASS (MODE1) == MODE_FLOAT || \
- GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
- == ((MODE2) == SFmode || (MODE2) == DFmode)))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* Gmicro pc isn't overloaded on a register. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 15
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 14
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 0
-
-/* Base register for access to arguments of the function. */
-/* The Gmicro does not have hardware ap. Fp is treated as ap */
-#define ARG_POINTER_REGNUM 14
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 0
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 1
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The Gmicro has two kinds of registers, so four classes would be
- a complete set. */
-
-enum reg_class { NO_REGS, FPU_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- { "NO_REGS", "FPU_REGS", "GENERAL_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ \
- 0, /* NO_REGS */ \
- 0xffff0000, /* FPU_REGS */ \
- 0x0000ffff, /* GENERAL_REGS */ \
- 0xffffffff /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-extern enum reg_class regno_reg_class[];
-#define REGNO_REG_CLASS(REGNO) ( (REGNO < 16) ? GENERAL_REGS : FPU_REGS )
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description.
- We do a trick here to modify the effective constraints on the
- machine description; we zorch the constraint letters that aren't
- appropriate for a specific target. This allows us to guarantee
- that a specific kind of register will not be used for a given target
- without fiddling with the register classes above. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'r' ? GENERAL_REGS : \
- ((C) == 'f' ? (TARGET_FPU ? FPU_REGS : NO_REGS) : \
- NO_REGS))
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For the Gmicro, all immediate value optimizations are done
- by assembler, so no machine dependent definition is necessary ??? */
-
-/* #define CONST_OK_FOR_LETTER_P(VALUE, C) ((C) == 'I') */
-#define CONST_OK_FOR_LETTER_P(VALUE, C) 0
-
-/*
- * The letters G defines all of the floating constants tha are *NOT*
- * Gmicro-FPU constant.
- */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'F' || \
- (C) == 'G' && !(TARGET_FPU && standard_fpu_constant_p (VALUE)))
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-/* On the Gmicro series, there is no restriction on GENERAL_REGS,
- so CLASS is returned. I do not know whether I should treat FPU_REGS
- specially or not (at least, m68k does not). */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On the Gmicro, this is the size of MODE in words,
- except in the FPU regs, where a single reg is always enough. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FPU_REGS ? \
- 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-/* On the Gmicro, FP points to the old FP and the first local variables are
- at (FP - 4). */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by. */
-/* On the Gmicro, sp is decremented by the exact size of the operand */
-#define PUSH_ROUNDING(BYTES) (BYTES)
-
-/* Offset of first parameter from the argument pointer register value. */
-/* On the Gmicro, the first argument is found at (ap + 8) where ap is fp. */
-#define FIRST_PARM_OFFSET(FNDECL) 8
-
-/* Value is the number of byte of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the Gmicro, the EXITD insn may be used to pop them if the number
- of args is fixed, but if the number is variable then the caller must pop
- them all. The adjsp operand of the EXITD insn can't be used for library
- calls now because the library is compiled with the standard compiler.
- Use of adjsp operand is a selectable option, since it is incompatible with
- standard Unix calling sequences. If the option is not selected,
- the caller must always pop the args.
- On the m68k this is an RTD option, so I use the same name
- for the Gmicro. The option name may be changed in the future. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((TARGET_RTD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE) \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) \
- ? (SIZE) : 0)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On the Gmicro the floating return value is in fr0 not r0. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- (gen_rtx (REG, (MODE), \
- ((TARGET_FPU && ((MODE) == SFmode || (MODE) == DFmode)) ? 16 : 0)))
-
-
-/* 1 if N is a possible register number for a function value.
- On the Gmicro, r0 and fp0 are the possible registers. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N) == 16)
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-#define PCC_STATIC_STRUCT_RETURN
-
-/* 1 if N is a possible register number for function argument passing.
- On the Gmicro, no registers are used in this way. */
-/* Really? For the performance improvement, registers should be used !! */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the Gmicro, this is a single integer, which is a number of bytes
- of arguments scanned so far. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the Gmicro, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the Gmicro all args are pushed, except if -mregparm is specified
- then the first two words of arguments are passed in d0, d1.
- *NOTE* -mregparm does not work.
- It exists only to test register calling conventions. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-((TARGET_REGPARM && (CUM) < 8) ? gen_rtx (REG, (MODE), (CUM) / 4) : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
-((TARGET_REGPARM && (CUM) < 8 \
- && 8 < ((CUM) + ((MODE) == BLKmode \
- ? int_size_in_bytes (TYPE) \
- : GET_MODE_SIZE (MODE)))) \
- ? 2 - (CUM) / 4 : 0)
-
-/* The following macro is defined to output register list.
- The LSB of Mask is the lowest number register.
- Regoff is MY_GREG_OFF or MY_FREG_OFF.
- Do NOT use <i> in File, Mask, Regoff !!
- Should be changed from macros to functions. M.Yuhara */
-
-#define MY_GREG_OFF 0
-#define MY_FREG_OFF 16
-
-#define MY_PRINT_MASK(File, Mask, Regoff) \
-{ \
- int i, first = -1; \
- if ((Mask) == 0) { \
- fprintf(File, "#0"); \
- } else { \
- fprintf(File, "("); \
- for (i = 0; i < 16; i++) { \
- if ( (Mask) & (1 << i) ) { \
- if (first < 0) { \
- if (first == -2) { \
- fprintf(File, ","); \
- } \
- first = i; \
- fprintf(File, "%s", reg_names[Regoff + i]); \
- } \
- } else if (first >= 0) { \
- if (i > first + 1) { \
- fprintf(File, "-%s", reg_names[Regoff + i - 1]); \
- } \
- first = -2; \
- } \
- } \
- if ( (first >= 0) && (first != 15) ) \
- fprintf(File, "-%s", reg_names[Regoff + 15]);\
- fprintf(File, ")"); \
- } \
-}
-
-
-#define MY_PRINT_ONEREG_L(FILE,MASK) \
-{ register int i; \
- for (i = 0; i < 16; i++) \
- if ( (1 << i) & (MASK)) { \
- fprintf(FILE, "%s", reg_names[i]); \
- (MASK) &= ~(1 << i); \
- break; \
- } \
-}
-
-
-#define MY_PRINT_ONEREG_H(FILE,MASK) \
-{ register int i; \
- for (i = 15; i >= 0; i--) \
- if ( (1 << i) & (MASK)) { \
- fprintf(FILE, "%s", reg_names[i]); \
- (MASK) &= ~(1 << i); \
- break; \
- } \
-}
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-/* The next macro needs much optimization !!
- M.Yuhara */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int regno; \
- register int mask = 0; \
- register int nregs = 0; \
- static char *reg_names[] = REGISTER_NAMES; \
- extern char call_used_regs[]; \
- int fsize = ((SIZE) + 3) & -4; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) { \
- mask |= (1 << regno); \
- nregs++; \
- } \
- if (frame_pointer_needed) { \
- mask &= ~(1 << FRAME_POINTER_REGNUM); \
- if (nregs > 4) { \
- fprintf(FILE, "\tenter.w #%d,", fsize); \
- MY_PRINT_MASK(FILE, mask, MY_GREG_OFF); \
- fprintf(FILE,"\n"); \
- } else { \
- fprintf(FILE, "\tmov.w fp,@-sp\n"); \
- fprintf(FILE, "\tmov.w sp,fp\n"); \
- if (fsize > 0) \
- myoutput_sp_adjust(FILE, "sub", fsize); \
- while (nregs--) { \
- fprintf(FILE, "\tmov.w "); \
- MY_PRINT_ONEREG_H(FILE, mask); \
- fprintf(FILE, ",@-sp\n"); \
- } \
- } \
- } else { \
- if (fsize > 0) \
- myoutput_sp_adjust(FILE, "sub", fsize); \
- if (mask != 0) { \
- if (nregs > 4) { \
- fprintf(FILE, "\tstm.w "); \
- MY_PRINT_MASK(FILE, mask, MY_GREG_OFF); \
- fprintf(FILE, ",@-sp\n"); \
- } else { \
- while (nregs--) { \
- fprintf(FILE, "\tmov.w "); \
- MY_PRINT_ONEREG_H(FILE, mask); \
- fprintf(FILE, ",@-sp\n"); \
- } \
- } \
- } \
- } \
- mask = 0; \
- for (regno = 16; regno < 32; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- mask |= 1 << (regno - 16); \
- if (mask != 0) { \
- fprintf(FILE, "\tfstm.w "); \
- MY_PRINT_MASK(FILE, mask, MY_FREG_OFF); \
- fprintf(FILE, ",@-sp\n", mask); \
- } \
-}
-
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-/* ??? M.Yuhara */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tmova @LP%d,r0\n\tjsr mcount\n", (LABELNO))
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tcmp #0,@LPBX0\n\tbne LPI%d\n\tpusha @LPBX0\n\tjsr ___bb_init_func\n\tadd #4,sp\nLPI%d:\n", \
- LABELNO, LABELNO);
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. */
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
- fprintf (FILE, "\tadd #1,@(LPBX2+%d)\n", 4 * BLOCKNO)
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer (when
- frame_pinter_needed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-/* The Gmicro FPU seems to be unable to fldm/fstm double or single
- floating. It only allows extended !! */
-/* Optimization is not enough, especially FREGs load !! M.Yuhara */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ register int regno; \
- register int mask, fmask; \
- register int nregs, nfregs; \
- int offset, foffset; \
- extern char call_used_regs[]; \
- static char *reg_names[] = REGISTER_NAMES; \
- int fsize = ((SIZE) + 3) & -4; \
- FUNCTION_EXTRA_EPILOGUE (FILE, SIZE); \
- nfregs = 0; fmask = 0; \
- for (regno = 16; regno < 31; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- { nfregs++; fmask |= 1 << (regno - 16); } \
- foffset = nfregs * 12; \
- nregs = 0; mask = 0; \
- if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- { nregs++; mask |= 1 << regno; } \
- if (frame_pointer_needed) { \
- offset = nregs * 4 + fsize; \
- if (nfregs > 0) { \
- fprintf(FILE, "\tfldm.x @(%d,fp),", -(foffset + offset));\
- MY_PRINT_MASK(FILE, fmask, MY_FREG_OFF); \
- fprintf(FILE, "\n"); \
- } \
- if (nregs > 4 \
- || current_function_pops_args) { \
- fprintf(FILE, "\tmova @(%d,fp),sp\n", -offset); \
- fprintf(FILE, "\texitd "); \
- MY_PRINT_MASK(FILE, mask, MY_GREG_OFF); \
- fprintf(FILE, ",#%d\n", current_function_pops_args); \
- } else { \
- while (nregs--) { \
- fprintf(FILE, "\tmov:l.w @(%d,fp),", -offset); \
- MY_PRINT_ONEREG_L(FILE, mask); \
- fprintf(FILE, "\n"); \
- offset -= 4; \
- } \
- if (TARGET_NEWRETURN) { \
- fprintf(FILE, "\tmova.w @(4,fp),sp\n"); \
- fprintf(FILE, "\tmov:l.w @fp,fp\n"); \
- } else { \
- fprintf(FILE, "\tmov.w fp,sp\n"); \
- fprintf(FILE, "\tmov.w @sp+,fp\n"); \
- } \
- fprintf(FILE, "\trts\n"); \
- } \
- } else { \
- if (nfregs > 0) { \
- fprintf(FILE, "\tfldm.w @sp+,"); \
- MY_PRINT_MASK(FILE, fmask, MY_FREG_OFF); \
- fprintf(FILE, "\n"); \
- } \
- if (nregs > 4) { \
- fprintf(FILE, "\tldm.w @sp+,"); \
- MY_PRINT_MASK(FILE, mask, MY_GREG_OFF); \
- fprintf(FILE, "\n"); \
- } else { \
- while (nregs--) { \
- fprintf(FILE, "\tmov.w @sp+,"); \
- MY_PRINT_ONEREG_L(FILE,mask); \
- fprintf(FILE, "\n"); \
- } \
- } \
- if (current_function_pops_args) { \
- myoutput_sp_adjust(FILE, "add", \
- (fsize + 4 + current_function_pops_args)); \
- fprintf(FILE, "\tjmp @(%d,sp)\n", current_function_pops_args);\
- } else { \
- if (fsize > 0) \
- myoutput_sp_adjust(FILE, "add", fsize); \
- fprintf(FILE, "\trts\n"); \
- } \
- } \
-}
-
-/* This is a hook for other tm files to change. */
-#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE)
-
-/* If the memory address ADDR is relative to the frame pointer,
- correct it to be relative to the stack pointer instead.
- This is for when we don't use a frame pointer.
- ADDR should be a variable name. */
-
-/* You have to change the next macro if you want to use more complex
- addressing modes (such as double indirection and more than one
- chain-addressing stages). */
-
-#define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \
-{ int offset = -1; \
- rtx regs = stack_pointer_rtx; \
- if (ADDR == frame_pointer_rtx) \
- offset = 0; \
- else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx \
- && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \
- offset = INTVAL (XEXP (ADDR, 1)); \
- else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx) \
- { rtx other_reg = XEXP (ADDR, 1); \
- offset = 0; \
- regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); } \
- else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 1) == frame_pointer_rtx) \
- { rtx other_reg = XEXP (ADDR, 0); \
- offset = 0; \
- regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); } \
- else if (GET_CODE (ADDR) == PLUS \
- && GET_CODE (XEXP (ADDR, 0)) == PLUS \
- && XEXP (XEXP (ADDR, 0), 0) == frame_pointer_rtx \
- && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \
- { rtx other_reg = XEXP (XEXP (ADDR, 0), 1); \
- offset = INTVAL (XEXP (ADDR, 1)); \
- regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); } \
- else if (GET_CODE (ADDR) == PLUS \
- && GET_CODE (XEXP (ADDR, 0)) == PLUS \
- && XEXP (XEXP (ADDR, 0), 1) == frame_pointer_rtx \
- && GET_CODE (XEXP (ADDR, 1)) == CONST_INT) \
- { rtx other_reg = XEXP (XEXP (ADDR, 0), 0); \
- offset = INTVAL (XEXP (ADDR, 1)); \
- regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); } \
- if (offset >= 0) \
- { int regno; \
- extern char call_used_regs[]; \
- for (regno = 16; regno < 32; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 12; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 4; \
- offset -= 4; \
- ADDR = plus_constant (regs, offset + (DEPTH)); } }
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-/* Gmicro */
-#define REGNO_OK_FOR_GREG_P(REGNO) \
-((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
-#define REGNO_OK_FOR_FPU_P(REGNO) \
-(((REGNO) ^ 0x10) < 16 || (unsigned) (reg_renumber[REGNO] ^ 0x10) < 16)
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_GREG_P(REGNO)
-#define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_GREG_P(REGNO)
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-
- These macros are specific to the Gmicro, and may be used only
- in code for printing assembler insns and in conditions for
- define_optimization. */
-
-/* 1 if X is an fpu register. */
-
-#define FPU_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FPU_P (REGNO (X)))
-
-/* I used GREG_P in the gmicro.md file. */
-
-#ifdef REG_OK_STRICT
-#define GREG_P(X) (REG_P (X) && REGNO_OK_FOR_GREG_P (REGNO(X)))
-#else
-#define GREG_P(X) (REG_P (X) && ((REGNO (X) & ~0xf) != 0x10))
-#endif
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-/* The Gmicro allows more registers in the chained addressing mode.
- But I do not know gcc supports such an architecture. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) ((REGNO (X) & ~0xf) != 0x10)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~0xf) != 0x10)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* The gcc uses the following effective address of the Gmicro.
- (without using PC!!).
- {@} ( {Rbase} + {Disp} + {Rindex * [1,2,4,8]} )
- where
- @: memory indirection.
- Rbase: Base Register = General Register.
- Disp: Displacement (up to 32bits)
- Rindex: Index Register = General Register.
- [1,2,4,8]: Scale of Index. 1 or 2 or 4 or 8.
- The inside of { } can be omitted.
- This restricts the chained addressing up to 1 stage. */
-
-
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
- except for CONSTANT_ADDRESS_P which is actually machine-independent. */
-
-#define REG_CODE_BASE_P(X) \
- (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
-
-#define REG_CODE_INDEX_P(X) \
- (GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))
-
-/* GET_CODE(X) must be PLUS. This macro does not check for PLUS! */
-#define BASE_PLUS_DISP_P(X) \
- ( REG_CODE_BASE_P (XEXP (X, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (X, 1)) \
- || \
- REG_CODE_BASE_P (XEXP (X, 1)) \
- && CONSTANT_ADDRESS_P (XEXP (X, 0)) )
-
-/* 1 if X is {0,Rbase} + {0,disp}. */
-#define BASED_ADDRESS_P(X) \
- (CONSTANT_ADDRESS_P (X) \
- || REG_CODE_BASE_P (X) \
- || (GET_CODE (X) == PLUS) \
- && BASE_PLUS_DISP_P (X))
-
-/* 1 if X is 1 or 2 or 4 or 8. GET_CODE(X) must be CONST_INT. */
-#define SCALE_OF_INDEX_P(X) \
- ( INTVAL(X) == 4 \
- || INTVAL(X) == 2 \
- || INTVAL(X) == 8 \
- || INTVAL(X) == 1 )
-
-/* #define INDEX_TERM_P(X,MODE) */
-#define INDEX_TERM_P(X) \
- ( REG_CODE_INDEX_P(X) \
- || (GET_CODE (X) == MULT \
- && ( (xfoo0 = XEXP (X, 0)), (xfoo1 = XEXP(X, 1)), \
- ( ( (GET_CODE (xfoo0) == CONST_INT) \
- && SCALE_OF_INDEX_P (xfoo0) \
- && REG_CODE_INDEX_P (xfoo1) ) \
- || \
- ( (GET_CODE (xfoo1) == CONST_INT) \
- && SCALE_OF_INDEX_P (xfoo1) \
- && REG_CODE_INDEX_P (xfoo0) ) ))))
-
-/* Assumes there are no cases such that X = (Ireg + Disp) + Disp */
-#define BASE_DISP_INDEX_P(X) \
- ( BASED_ADDRESS_P (X) \
- || ( (GET_CODE (X) == PLUS) \
- && ( ( (xboo0 = XEXP (X, 0)), (xboo1 = XEXP (X, 1)), \
- (REG_CODE_BASE_P (xboo0) \
- && (GET_CODE (xboo1) == PLUS) \
- && ( ( CONSTANT_ADDRESS_P (XEXP (xboo1, 0)) \
- && INDEX_TERM_P (XEXP (xboo1, 1)) ) \
- || ( CONSTANT_ADDRESS_P (XEXP (xboo1, 1)) \
- && INDEX_TERM_P (XEXP (xboo1, 0))) ))) \
- || \
- (CONSTANT_ADDRESS_P (xboo0) \
- && (GET_CODE (xboo1) == PLUS) \
- && ( ( REG_CODE_BASE_P (XEXP (xboo1, 0)) \
- && INDEX_TERM_P (XEXP (xboo1, 1)) ) \
- || ( REG_CODE_BASE_P (XEXP (xboo1, 1)) \
- && INDEX_TERM_P (XEXP (xboo1, 0))) )) \
- || \
- (INDEX_TERM_P (xboo0) \
- && ( ( (GET_CODE (xboo1) == PLUS) \
- && ( ( REG_CODE_BASE_P (XEXP (xboo1, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (xboo1, 1)) ) \
- || ( REG_CODE_BASE_P (XEXP (xboo1, 1)) \
- && CONSTANT_ADDRESS_P (XEXP (xboo1, 0))) )) \
- || \
- (CONSTANT_ADDRESS_P (xboo1)) \
- || \
- (REG_CODE_BASE_P (xboo1)) )))))
-
-/*
- If you want to allow double-indirection,
- you have to change the <fp-relative> => <sp-relative> conversion
- routine. M.Yuhara
-
-#ifdef REG_OK_STRICT
-#define DOUBLE_INDIRECTION(X,ADDR) {\
- if (BASE_DISP_INDEX_P (XEXP (XEXP (X, 0), 0) )) goto ADDR; \
- }
-#else
-#define DOUBLE_INDIRECTION(X,ADDR) { }
-#endif
-*/
-
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) {\
- register rtx xboo0, xboo1, xfoo0, xfoo1; \
- if (GET_CODE (X) == MEM) { \
- /* \
- if (GET_CODE (XEXP (X,0)) == MEM) { \
- DOUBLE_INDIRECTION(X,ADDR); \
- } else { \
- if (BASE_DISP_INDEX_P (XEXP (X, 0))) goto ADDR; \
- } \
- */ \
- } else { \
- if (BASE_DISP_INDEX_P (X)) goto ADDR; \
- if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
- && REG_P (XEXP (X, 0)) \
- && (REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM)) \
- goto ADDR; \
- } \
-}
-
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the Gmicro, nothing is done now. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the VAX, the predecrement and postincrement address depend thus
- (the amount of decrement or increment being the length of the operand)
- and all indexed address depend thus (because the index scale factor
- is the length of the operand).
- The Gmicro mimics the VAX now. Since ADDE is legitimate, it cannot
- include auto-inc/dec. */
-
-/* Unnecessary ??? */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
- goto LABEL; }
-
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-/* #define CASE_VECTOR_MODE HImode */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-#define CASE_VECTOR_PC_RELATIVE
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-/* #define STORE_FLAG_VALUE -1 */
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if ((unsigned) INTVAL (RTX) < 8) return 0; \
- if ((unsigned) (INTVAL (RTX) + 0x80) < 0x100) return 1; \
- if ((unsigned) (INTVAL (RTX) + 0x8000) < 0x10000) return 2; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 3; \
- case CONST_DOUBLE: \
- return 5;
-
-/* Define subroutines to call to handle multiply and divide.
- The `*' prevents an underscore from being prepended by the compiler. */
-/* Use libgcc on Gmicro */
-/* #define UDIVSI3_LIBCALL "*udiv" */
-/* #define UMODSI3_LIBCALL "*urem" */
-
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-/* Set if the cc value is actually in the FPU, so a floating point
- conditional branch must be output. */
-#define CC_IN_FPU 04000
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-/* Since Gmicro's compare instructions depend on the branch condition,
- all branch should be kept.
- More work must be done to optimize condition code !! M.Yuhara */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) {CC_STATUS_INIT;}
-
-/* The skeleton of the next macro is taken from "vax.h".
- FPU-reg manipulation is added. M.Yuhara */
-/* Now comment out.
-#define NOTICE_UPDATE_CC(EXP, INSN) { \
- if (GET_CODE (EXP) == SET) { \
- if ( !FPU_REG_P (XEXP (EXP, 0)) \
- && (XEXP (EXP, 0) != cc0_rtx) \
- && (FPU_REG_P (XEXP (EXP, 1)) \
- || GET_CODE (XEXP (EXP, 1)) == FIX \
- || GET_CODE (XEXP (EXP, 1)) == FLOAT_TRUNCATE \
- || GET_CODE (XEXP (EXP, 1)) == FLOAT_EXTEND)) { \
- CC_STATUS_INIT; \
- } else if (GET_CODE (SET_SRC (EXP)) == CALL) { \
- CC_STATUS_INIT; \
- } else if (GET_CODE (SET_DEST (EXP)) != PC) { \
- cc_status.flags = 0; \
- cc_status.value1 = SET_DEST (EXP); \
- cc_status.value2 = SET_SRC (EXP); \
- } \
- } else if (GET_CODE (EXP) == PARALLEL \
- && GET_CODE (XVECEXP (EXP, 0, 0)) == SET \
- && GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) != PC) {\
- cc_status.flags = 0; \
- cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
- cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); \
- /* PARALLELs whose first element sets the PC are aob, sob VAX insns. \
- They do change the cc's. So drop through and forget the cc's. * / \
- } else CC_STATUS_INIT; \
- if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
- && cc_status.value2 \
- && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
- cc_status.value2 = 0; \
- if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM \
- && cc_status.value2 \
- && GET_CODE (cc_status.value2) == MEM) \
- cc_status.value2 = 0; \
- if ( (cc_status.value1 && FPU_REG_P (cc_status.value1)) \
- || (cc_status.value2 && FPU_REG_P (cc_status.value2))) \
- cc_status.flags = CC_IN_FPU; \
-}
-*/
-
-#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
-{ if (cc_prev_status.flags & CC_IN_FPU) \
- return FLOAT; \
- if (cc_prev_status.flags & CC_NO_OVERFLOW) \
- return NO_OV; \
- return NORMAL; }
-
-/* Control the assembler format that we output. */
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".section text,code,align=4"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".section data,data,align=4"
-
-/* Output before uninitialized data. */
-
-#define BSS_SECTION_ASM_OP ".section bss,data,align=4"
-
-/* Output at beginning of assembler file.
- It is not appropriate for this to print a list of the options used,
- since that's not the convention that we use. */
-
-#define ASM_FILE_START(FILE)
-
-/* Output at the end of assembler file. */
-
-#define ASM_FILE_END(FILE) fprintf (FILE, "\t.end\n");
-
-
-/* Don't try to define `gcc_compiled.' since the assembler do not
- accept symbols with periods and GDB doesn't run on this machine anyway. */
-#define ASM_IDENTIFY_GCC(FILE)
-
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-/* #define ASM_APP_ON "#APP\n" */
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-/* #define ASM_APP_OFF ";#NO_APP\n" */
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", "r12", "r13", "fp", "sp", \
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", \
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15"}
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Define this if gcc should produce debugging output for dbx in response
- to the -g flag. This does not work for the Gmicro now */
-
-#define DBX_DEBUGGING_INFO
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) { \
- assemble_name (FILE, NAME); \
- fputs (":\n", FILE); \
-}
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) {\
- fputs ("\t.global ", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
-}
-
-/* This is how to output a command to make the external label named NAME
- which are not defined in the file to be referable */
-/* ".import" does not work ??? */
-
-#define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME) { \
- fputs ("\t.global ", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
-}
-
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-/* do {...} while(0) is necessary, because these macros are used as
- if (xxx) MACRO; else ....
- ^
-*/
-
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { union { double d; long l[2];} tem; \
- tem.d = (VALUE); \
- fprintf (FILE, "\t.fdata.d h'%x%08x.d\n", tem.l[0], tem.l[1]); \
-} while(0)
-
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { union { float f; long l;} tem; \
- tem.f = (VALUE); \
- fprintf (FILE, "\t.fdata.s h'%x.s\n", tem.l); \
-} while(0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.data.w "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.data.h "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.data.b "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.data.b h'%x\n", (VALUE))
-
-#define ASM_OUTPUT_ASCII(FILE,P,SIZE) \
- output_ascii ((FILE), (P), (SIZE))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tmov %s,@-sp\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmov @sp+,%s\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute.
- (The Gmicro does not use such vectors,
- but we must define this macro anyway.) */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.data.w L%d\n", VALUE)
-
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.data.w L%d-L%d\n", VALUE, REL)
-
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf (FILE, "\t.align %d\n", (1 << (LOG)));
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.res.b %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( bss_section (), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ":\t.res.b %d\n", (ROUNDED)),\
- fprintf ((FILE), "\t.export "), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), "\n") )
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( bss_section (), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ":\t.res.b %d\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-/* $__ is unique ????? M.Yuhara */
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
- sprintf ((OUTPUT), "$__%s%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Output a float value (represented as a C double) as an immediate operand.
- This macro is a Gmicro/68k-specific macro. */
-
-#define ASM_OUTPUT_FLOAT_OPERAND(FILE,VALUE) \
-do { union { float f; long l;} tem; \
- tem.f = (VALUE); \
- fprintf (FILE, "#h'%x.s", tem.l); \
-} while(0)
-
-
-/* Output a double value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
-do { union { double d; long l[2];} tem; \
- tem.d = (VALUE); \
- fprintf (FILE, "#h'%x%08x.d", tem.l[0], tem.l[1]); \
-} while(0)
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
-
- On the Gmicro, we use several CODE characters:
- 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
- 'b' for branch target label.
- '-' for an operand pushing on the stack.
- '+' for an operand pushing on the stack.
- '#' for an immediate operand prefix
-*/
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ( (CODE) == '#' || (CODE) == '-' \
- || (CODE) == '+' || (CODE) == '@' || (CODE) == '!')
-
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ int i; \
- static char *reg_name[] = REGISTER_NAMES; \
-/* fprintf (stderr, "PRINT_OPERAND CODE=%c(0x%x), ", CODE, CODE);\
-myprcode(GET_CODE(X)); */ \
- if (CODE == '#') fprintf (FILE, "#"); \
- else if (CODE == '-') fprintf (FILE, "@-sp"); \
- else if (CODE == '+') fprintf (FILE, "@sp+"); \
- else if (CODE == 's') fprintf (stderr, "err: PRINT_OPERAND <s>\n"); \
- else if (CODE == '!') fprintf (stderr, "err: PRINT_OPERAND <!>\n"); \
- else if (CODE == '.') fprintf (stderr, "err: PRINT_OPERAND <.>\n"); \
- else if (CODE == 'b') { \
- if (GET_CODE (X) == MEM) \
- output_addr_const (FILE, XEXP (X, 0)); /* for bsr */ \
- else \
- output_addr_const (FILE, X); /* for bcc */ \
- } \
- else if (CODE == 'p') \
- print_operand_address (FILE, X); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_name[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
- { union { double d; int i[2]; } u; \
- union { float f; int i; } u1; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- u1.f = u.d; \
- if (CODE == 'f') \
- ASM_OUTPUT_FLOAT_OPERAND (FILE, u1.f); \
- else \
- fprintf (FILE, "#h'%x", u1.i); } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
- { union { double d; int i[2]; } u; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- ASM_OUTPUT_DOUBLE_OPERAND (FILE, u.d); } \
- else { putc ('#', FILE); \
-output_addr_const (FILE, X); }}
-
-/* Note that this contains a kludge that knows that the only reason
- we have an address (plus (label_ref...) (reg...))
- is in the insn before a tablejump, and we know that m68k.md
- generates a label LInnn: on such an insn. */
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- { print_operand_address (FILE, ADDR); }
-
-/*
-Local variables:
-version-control: t
-End:
-*/
diff --git a/gcc/config/gmicro/gmicro.md b/gcc/config/gmicro/gmicro.md
deleted file mode 100644
index 0fc44875b6d..00000000000
--- a/gcc/config/gmicro/gmicro.md
+++ /dev/null
@@ -1,2740 +0,0 @@
-;;- Machine description for GNU compiler, Fujitsu Gmicro Version
-;; Copyright (C) 1990, 1994, 1996 Free Software Foundation, Inc.
-;; Contributed by M.Yuhara, Fujitsu Laboratories LTD.
-
-;; 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.
-;; Among other things, the copyright
-;; notice and this notice must be preserved on all copies.
-
-
-;; 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.
-
-
-;;- instruction definitions
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;;- When naming insn's (operand 0 of define_insn) be careful about using
-;;- names from other targets machine descriptions.
-
-;;- cpp macro #define NOTICE_UPDATE_CC is essentially a no-op for the
-;;- gmicro; no compares are eliminated.
-
-;;- The original structure of this file is m68k.md.
-
-;; ??? Work to be done:
-;; Add patterns for ACB and SCB instructions.
-;; Add define_insn patterns to recognize the insns that extend a byte
-;; to a word and add it into a word, etc.
-
-;;- Some of these insn's are composites of several Gmicro op codes.
-;;- The assembler (or final @@??) insures that the appropriate one is
-;;- selected.
-
-(define_insn ""
- [(set (match_operand:DF 0 "push_operand" "=m")
- (match_operand:DF 1 "general_operand" "rmfF"))]
- ""
- "*
-{
- if (FPU_REG_P (operands[1]))
- return \"fmov.d %f1,%0\";
- return output_move_double (operands);
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "push_operand" "=m")
- (match_operand:DF 1 "general_operand" "rmF"))]
- ""
- "*
-{
- return output_move_double (operands);
-}")
-
-;; We don't want to allow a constant operand for test insns because
-;; (set (cc0) (const_int foo)) has no mode information. Such insns will
-;; be folded while optimizing anyway.
-
-(define_insn "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" "rm"))]
- ""
- "cmp:z.w #0,%0")
-
-(define_insn "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "nonimmediate_operand" "rm"))]
- ""
- "cmp:z.h #0,%0")
-
-(define_insn "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "nonimmediate_operand" "rm"))]
- ""
- "cmp:z.b #0,%0")
-
-
-(define_insn "tstsf"
- [(set (cc0)
- (match_operand:SF 0 "general_operand" "fmF"))]
- "TARGET_FPU"
- "*
-{
- cc_status.flags = CC_IN_FPU;
- return \"ftst.s %0\";
-}")
-
-
-(define_insn "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "general_operand" "fmF"))]
- "TARGET_FPU"
- "*
-{
- cc_status.flags = CC_IN_FPU;
- return \"ftst.d %0\";
-}")
-
-;; compare instructions.
-
-;; (operand0 - operand1)
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "ri,rm")
- (match_operand:SI 1 "general_operand" "rm,rmi")))]
- ""
- "*
-{
- int signed_flag = my_signed_comp (insn);
-
- if (which_alternative == 0)
- {
- cc_status.flags |= CC_REVERSED;
- if (signed_flag && GET_CODE (operands[0]) == CONST_INT)
- {
- register rtx xfoo;
- xfoo = operands[1];
- operands[0] = operands[1];
- operands[1] = xfoo;
- return cmp_imm_word (INTVAL (operands[1]), operands[0]);
- }
- if (signed_flag)
- return \"cmp.w %0,%1\";
- return \"cmpu.w %0,%1\";
- }
- if (signed_flag)
- {
- if (GET_CODE (operands[1]) == CONST_INT)
- return cmp_imm_word (INTVAL (operands[1]), operands[0]);
- return \"cmp.w %1,%0\";
- }
- else
- return \"cmpu.w %1,%0\";
-}")
-
-(define_insn "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "ri,rm")
- (match_operand:HI 1 "general_operand" "rm,rmi")))]
- ""
- "*
-{
- int signed_flag = my_signed_comp (insn);
-
- if (which_alternative == 0)
- {
- cc_status.flags |= CC_REVERSED;
- if (signed_flag)
- return \"cmp.h %0,%1\";
- return \"cmpu.h %0,%1\";
- }
- if (signed_flag)
- return \"cmp.h %1,%0\";
- return \"cmpu.h %1,%0\";
-}")
-
-(define_insn "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "ri,rm")
- (match_operand:QI 1 "general_operand" "rm,rmi")))]
- ""
- "*
-{
- int signed_flag = my_signed_comp (insn);
-
- if (which_alternative == 0)
- {
- cc_status.flags |= CC_REVERSED;
- if (signed_flag)
- return \"cmp.b %0,%1\";
- return \"cmpu.b %0,%1\";
- }
- if (signed_flag)
- return \"cmp.b %1,%0\";
- return \"cmpu.b %1,%0\";
-}")
-
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "general_operand" "f,mG")
- (match_operand:DF 1 "general_operand" "fmG,f")))]
- "TARGET_FPU"
- "*
-{
- cc_status.flags = CC_IN_FPU;
-
- if (FPU_REG_P (operands[0]))
- return \"fcmp.d %f1,%f0\";
- cc_status.flags |= CC_REVERSED;
- return \"fcmp.d %f0,%f1\";
-}")
-
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "general_operand" "f,mG")
- (match_operand:SF 1 "general_operand" "fmG,f")))]
- "TARGET_FPU"
- "*
-{
- cc_status.flags = CC_IN_FPU;
- if (FPU_REG_P (operands[0]))
- return \"fcmp.s %f1,%0\";
- cc_status.flags |= CC_REVERSED;
- return \"fcmp.s %f0,%1\";
-}")
-
-;; Recognizers for btst instructions.
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "rmi")))]
- ""
- "btst %1.w,%0.b")
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "rm")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "rmi")))]
- ""
- "btst %1.w,%0.w")
-
-;; The following two patterns are like the previous two
-;; except that they use the fact that bit-number operands (offset)
-;; are automatically masked to 3 or 5 bits when the base is a register.
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
- (const_int 1)
- (and:SI
- (match_operand:SI 1 "general_operand" "rmi")
- (const_int 7))))]
- ""
- "btst %1.w,%0.b")
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (and:SI
- (match_operand:SI 1 "general_operand" "rmi")
- (const_int 31))))]
- ""
- "btst %1.w,%0.w")
-
-; More various size-patterns are allowed for btst, but not
-; included yet. M.Yuhara
-
-
-(define_insn ""
- [(set (cc0) (and:SI (sign_extend:SI
- (sign_extend:HI
- (match_operand:QI 0 "nonimmediate_operand" "rm")))
- (match_operand:SI 1 "general_operand" "i")))]
- "(GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) < 0x100
- && exact_log2 (INTVAL (operands[1])) >= 0)"
- "*
-{
- register int log = exact_log2 (INTVAL (operands[1]));
- operands[1] = gen_rtx (CONST_INT, VOIDmode, log);
- return \"btst %1,%0.b\";
-}")
-
-; I can add more patterns like above. But not yet. M.Yuhara
-
-
-; mtst is supported only by G/300.
-
-(define_insn ""
- [(set (cc0)
- (and:SI (match_operand:SI 0 "general_operand" "%rmi")
- (match_operand:SI 1 "general_operand" "rm")))]
- "TARGET_G300"
- "*
-{
- if (GET_CODE (operands[0]) == CONST_INT)
- return \"mtst.w %0,%1\";
- return \"mtst.w %1,%0\";
-}")
-
-(define_insn ""
- [(set (cc0)
- (and:HI (match_operand:HI 0 "general_operand" "%rmi")
- (match_operand:HI 1 "general_operand" "rm")))]
- "TARGET_G300"
- "*
-{
- if (GET_CODE (operands[0]) == CONST_INT)
- return \"mtst.h %0,%1\";
- return \"mtst.h %1,%0\";
-}")
-
-(define_insn ""
- [(set (cc0)
- (and:QI (match_operand:QI 0 "general_operand" "%rmi")
- (match_operand:QI 1 "general_operand" "rm")))]
- "TARGET_G300"
- "*
-{
- if (GET_CODE (operands[0]) == CONST_INT)
- return \"mtst.b %0,%1\";
- return \"mtst.b %1,%0\";
-}")
-
-
-
-;; move instructions
-
-/* added by M.Yuhara */
-;; 1.35.04 89.08.28 modification start
-;; register_operand -> general_operand
-;; ashift -> mult
-
-(define_insn ""
- [(set (mem:SI (plus:SI
- (match_operand:SI 0 "general_operand" "r")
- (ashift:SI
- (match_operand:SI 1 "general_operand" "r")
- (const_int 2))))
- (match_operand:SI 2 "general_operand" "rmi"))]
- ""
- "*
-{
- return \"mov.w %2,@(%0:b,%1*4)\";
-}")
-
-(define_insn ""
- [(set (mem:SI (plus:SI
- (ashift:SI
- (match_operand:SI 0 "general_operand" "r")
- (const_int 2))
- (match_operand:SI 1 "general_operand" "r")))
- (match_operand:SI 2 "general_operand" "rmi"))]
- ""
- "*
-{
- return \"mov.w %2,@(%1:b,%0*4)\";
-}")
-
-
-(define_insn ""
- [(set (mem:SI (plus:SI
- (match_operand:SI 0 "register_operand" "r")
- (mult:SI
- (match_operand:SI 1 "register_operand" "r")
- (const_int 4))))
- (match_operand:SI 2 "general_operand" "rmi"))]
- ""
- "*
-{
- return \"mov.w %2,@(%0:b,%1*4)\";
-}")
-
-(define_insn ""
- [(set (mem:SI (plus:SI
- (mult:SI
- (match_operand:SI 0 "register_operand" "r")
- (const_int 4))
- (match_operand:SI 1 "register_operand" "r")))
- (match_operand:SI 2 "general_operand" "rmi"))]
- ""
- "*
-{
- return \"mov.w %2,@(%1:b,%0*4)\";
-}")
-
-
-(define_insn ""
- [(set (mem:SI (plus:SI
- (match_operand:SI 0 "general_operand" "r")
- (plus:SI
- (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "register_operand" "i"))))
- (match_operand:SI 3 "general_operand" "rmi"))]
- ""
- "*
-{
- return \"mov.w %3,@(%c2,%0,%1)\";
-}")
-
-(define_insn ""
- [(set (mem:SI (plus:SI
- (plus:SI
- (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "general_operand" "i")))
- (match_operand:SI 3 "general_operand" "rmi"))]
- ""
- "*
-{
- return \"mov.w %3,@(%c2,%0,%1)\";
-}")
-
-
-(define_insn ""
- [(set (mem:SI (plus:SI
- (match_operand:SI 0 "general_operand" "i")
- (plus:SI
- (match_operand:SI 1 "register_operand" "r")
- (mult:SI
- (match_operand:SI 2 "register_operand" "r")
- (const_int 4)))))
- (match_operand:SI 3 "general_operand" "rmi"))]
- ""
- "*
-{
- return \"mov.w %3,@(%1:b,%0,%2*4)\";
-}")
-
-;; 89.08.28 1.35.04 modification end
-
-;; Should add "!" to op2 ??
-
-;; General move-address-to-operand should handle these.
-;; If that does not work, please figure out why.
-
-;(define_insn ""
-; [(set (match_operand:SI 0 "push_operand" "=m")
-; (plus:SI
-; (match_operand:SI 1 "immediate_operand" "i")
-; (match_operand:SI 2 "general_operand" "r")))]
-; ""
-; "mova.w @(%c1,%2),%-")
-
-;(define_insn ""
-; [(set (match_operand:SI 0 "push_operand" "=m")
-; (plus:SI
-; (match_operand:SI 1 "general_operand" "r")
-; (match_operand:SI 2 "immediate_operand" "i")))]
-; ""
-; "mova.w @(%c2,%1),%-")
-
-
-(define_insn ""
- [(set (match_operand:SI 0 "push_operand" "=m")
- (minus:SI
- (match_operand:SI 1 "general_operand" "r")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "mova.w @(%n2,%1),%-")
-
-
-
-;; General case of fullword move.
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (match_operand:SI 1 "general_operand" "rmi"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- return mov_imm_word (INTVAL (operands[1]), operands[0]);
- /* if (address_operand (operands[1], SImode))
- return \"mova.w %1,%0\"; */
- if (push_operand (operands[0], SImode))
- return \"mov.w %1,%-\";
- return \"mov.w %1,%0\";
-}")
-
-/* pushsi 89.08.10 for test M.Yuhara */
-/*
-(define_insn ""
- [(set (match_operand:SI 0 "push_operand" "=m")
- (match_operand:SI 1 "general_operand" "rmi"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- return mov_imm_word (INTVAL (operands[1]), operands[0]);
- if (push_operand (operands[0], SImode))
- return \"mov.w %1,%-\";
- return \"mov.w %1,%0\";
-}")
-*/
-
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (match_operand:HI 1 "general_operand" "rmi"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"mov.h %1,%-\";
- return \"mov.h %1,%0\";
-}")
-
-;; Is the operand constraint "+" necessary ????
-;; Should I check push_operand ????
-
-(define_insn "movstricthi"
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+rm"))
- (match_operand:HI 1 "general_operand" "rmi"))]
- ""
- "mov.h %1,%0");
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (match_operand:QI 1 "general_operand" "rmi"))]
- ""
- "*
-{
- if (GREG_P (operands[0]))
- {
- if (CONSTANT_P (operands[1]))
- return \"mov:l %1,%0.w\";
- else
- return \"mov:l %1.b,%0.w\";
- }
- if (GREG_P (operands[1]))
- return \"mov:s %1.w,%0.b\";
- return \"mov.b %1,%0\";
-}")
-
-(define_insn "movstrictqi"
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+rm"))
- (match_operand:QI 1 "general_operand" "rmi"))]
- ""
- "mov.b %1,%0")
-
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=f,mf,rm,fr")
- (match_operand:SF 1 "general_operand" "mfF,f,rmF,fr"))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_single (operands);
- return \"fmov.s %1,%0\";
- case 1:
- return \"fmov.s %1,%0\";
- case 2:
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_single (operands);
- return \"mov.w %1,%0\";
- case 3:
- if (FPU_REG_P (operands[0]))
- return \"mov.w %1,%-\\n\\tfmov.s %+,%0\";
- return \"fmov.s %1,%-\\n\\tmov.w %+,%0\";
- }
-}")
-
-(define_insn "movdf"
- [(set (match_operand:DF 0 "general_operand" "=f,mf,rm,fr")
- (match_operand:DF 1 "general_operand" "mfF,f,rmF,fr"))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_double (operands);
- return \"fmov.d %1,%0\";
- case 1:
- return \"fmov.d %1,%0\";
- case 2:
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_double (operands);
- return output_move_double (operands);
- case 3:
- if (FPU_REG_P (operands[0]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"mov.w %1,%-\", xoperands);
- output_asm_insn (\"mov.w %1,%-\", operands);
- return \"fmov.d %+,%0\";
- }
- else
- {
- output_asm_insn (\"fmov.d %f1,%-\", operands);
- output_asm_insn (\"mov.w %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"mov.w %+,%0\";
- }
- }
-}")
-
-
-;; movdi can apply to fp regs in some cases
-;; Must check again. you can use fsti/fldi, etc.
-;; FPU reg should be included ??
-;; 89.12.13 for test
-
-(define_insn "movdi"
- ;; Let's see if it really still needs to handle fp regs, and, if so, why.
- [(set (match_operand:DI 0 "general_operand" "=rm,&r,&ro")
- (match_operand:DI 1 "general_operand" "rF,m,roiF"))]
- ""
- "*
-{
- if (FPU_REG_P (operands[0]))
- {
- if (FPU_REG_P (operands[1]))
- return \"fmov.d %1,%0\";
- if (REG_P (operands[1]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"mov.w %1,%-\", xoperands);
- output_asm_insn (\"mov.w %1,%-\", operands);
- return \"fmov.d %+,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_double (operands);
- return \"fmov.d %f1,%0\";
- }
- else if (FPU_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"fmov.d %f1,%-\;mov.w %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"mov.w %+,%0\";
- }
- else
- return \"fmov.d %f1,%0\";
- }
- return output_move_double (operands);
-}
-")
-
-
-;; The definition of this insn does not really explain what it does,
-;; but it should suffice
-;; that anything generated as this insn will be recognized as one
-;; and that it won't successfully combine with anything.
-
-;; This is dangerous when %0 and %1 overlapped !!!!!
-;; Ugly code...
-
-(define_insn "movstrhi"
- [(set (match_operand:BLK 0 "general_operand" "=m")
- (match_operand:BLK 1 "general_operand" "m"))
- (use (match_operand:HI 2 "general_operand" "rmi"))
- (clobber (reg:SI 0))
- (clobber (reg:SI 1))
- (clobber (reg:SI 2))]
- ""
- "*
-{
- int op2const;
- rtx tmpx;
-
- if (CONSTANT_P (operands[1]))
- {
- fprintf (stderr, \"smov 1 const err \");
- abort ();
- }
- else if (GET_CODE (operands[1]) == REG)
- {
- fprintf (stderr, \"smov 1 reg err \");
- abort ();
- }
- else if (GET_CODE (operands[1]) == MEM)
- {
- tmpx = XEXP (operands[1], 0);
- if (CONSTANT_ADDRESS_P (tmpx) || GREG_P (tmpx))
- {
- operands[1] = tmpx;
- output_asm_insn (\"mov.w %1,r0\", operands);
- }
- else
- {
- output_asm_insn (\"mova %1,r0\", operands);
- }
- }
- else
- {
- fprintf (stderr, \"smov 1 else err \");
- abort ();
- output_asm_insn (\"mova.w %p1,r0\", operands);
- }
-
- if (CONSTANT_P (operands[0]))
- {
- fprintf (stderr, \"smov 0 const err \");
- abort ();
- }
- else if (GET_CODE (operands[0]) == REG)
- {
- fprintf (stderr, \"smov 0 reg err \");
- abort ();
- }
- else if (GET_CODE (operands[0]) == MEM)
- {
- tmpx = XEXP (operands[0], 0);
- if (CONSTANT_ADDRESS_P (tmpx) || GREG_P (tmpx))
- {
- operands[0] = tmpx;
- output_asm_insn (\"mov.w %0,r1\", operands);
- }
- else
- {
- output_asm_insn (\"mova %0,r1\", operands);
- }
- }
- else
- {
- fprintf (stderr, \"smov 0 else err \");
- abort ();
- }
-
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- op2const = INTVAL (operands[2]);
- if (op2const % 4 != 0)
- {
- output_asm_insn (\"mov.w %2,r2\", operands);
- return \"smov/n/f.b\";
- }
- op2const = op2const / 4;
- if (op2const <= 4)
- {
- if (op2const == 0)
- abort (0);
- if (op2const == 1)
- return \"mov.w @r0,@r1\";
- output_asm_insn (\"mov.w @r0,@r1\", operands);
- if (op2const == 2)
- return \"mov.w @(4,r0),@(4,r1)\";
- output_asm_insn (\"mov.w @(4,r0),@(4,r1)\", operands);
- if (op2const == 3)
- return \"mov.w @(8,r0),@(8,r1)\";
- output_asm_insn (\"mov.w @(8,r0),@(8,r1)\", operands);
- return \"mov.w @(12,r0),@(12,r1)\";
- }
-
- operands[2] =
- gen_rtx (CONST_INT, VOIDmode, op2const);
- output_asm_insn (\"mov.w %2,r2\", operands);
- return \"smov/n/f.w\";
- }
- else
- {
- fprintf (stderr, \"smov 0 else err \");
- abort ();
- output_asm_insn (\"mov %2.h,r2.w\", operands);
- return \"smov/n/f.b\";
- }
-
-}")
-
-;; M.Yuhara 89.08.24
-;; experiment on the built-in strcpy (__builtin_smov)
-;;
-;; len = 0 means unknown string length.
-;;
-;; mem:SI is dummy. Necessary so as not to be deleted by optimization.
-;; Use of BLKmode would be better...
-;;
-;;
-(define_insn "smovsi"
- [(set (mem:SI (match_operand:SI 0 "general_operand" "=rm"))
- (mem:SI (match_operand:SI 1 "general_operand" "rm")))
- (use (match_operand:SI 2 "general_operand" "i"))
- (clobber (reg:SI 0))
- (clobber (reg:SI 1))
- (clobber (reg:SI 2))
- (clobber (reg:SI 3))]
- ""
- "*
-{
- int len, wlen, blen, offset;
- char tmpstr[128];
- rtx xoperands[1];
-
- len = INTVAL (operands[2]);
- output_asm_insn (\"mov.w %1,r0\\t; begin built-in strcpy\", operands);
- output_asm_insn (\"mov.w %0,r1\", operands);
-
- if (len == 0)
- {
- output_asm_insn (\"mov:z.w #0,r2\", operands);
- output_asm_insn (\"mov:z.w #0,r3\", operands);
- return \"smov/eq/f.b\\t; end built-in strcpy\";
- }
-
- wlen = len / 4;
- blen = len - wlen * 4;
-
- if (wlen > 0)
- {
- if (len <= 40 && !TARGET_FORCE_SMOV)
- {
- output_asm_insn (\"mov.w @r0,@r1\", operands);
- offset = 4;
- while ( (blen = len - offset) > 0)
- {
- if (blen >= 4)
- {
- sprintf (tmpstr, \"mov.w @(%d,r0),@(%d,r1)\",
- offset, offset);
- output_asm_insn (tmpstr, operands);
- offset += 4;
- }
- else if (blen >= 2)
- {
- sprintf (tmpstr, \"mov.h @(%d,r0),@(%d,r1)\",
- offset, offset);
- output_asm_insn (tmpstr, operands);
- offset += 2;
- }
- else
- {
- sprintf (tmpstr, \"mov.b @(%d,r0),@(%d,r1)\",
- offset, offset);
- output_asm_insn (tmpstr, operands);
- offset++;
- }
- }
- return \"\\t\\t; end built-in strcpy\";
- }
- else
- {
- xoperands[0] = gen_rtx (CONST_INT, VOIDmode, wlen);
- output_asm_insn (\"mov.w %0,r2\", xoperands);
- output_asm_insn (\"smov/n/f.w\", operands);
- }
- }
-
- if (blen >= 2)
- {
- output_asm_insn (\"mov.h @r0,@r1\", operands);
- if (blen == 3)
- output_asm_insn (\"mov.b @(2,r0),@(2,r1)\", operands);
- }
- else if (blen == 1)
- {
- output_asm_insn (\"mov.b @r0,@r1\", operands);
- }
-
- return \"\\t\\t; end built-in strcpy\";
-}")
-
-;; truncation instructions
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (truncate:QI
- (match_operand:SI 1 "general_operand" "rmi")))]
- ""
- "mov %1.w,%0.b")
-; "*
-;{
-; if (GET_CODE (operands[0]) == REG)
-; return \"mov.w %1,%0\";
-; if (GET_CODE (operands[1]) == MEM)
-; operands[1] = adj_offsettable_operand (operands[1], 3);
-; return \"mov.b %1,%0\";
-;}")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (truncate:QI
- (match_operand:HI 1 "general_operand" "rmi")))]
- ""
- "mov %1.h,%0.b")
-; "*
-;{
-; if (GET_CODE (operands[0]) == REG)
-; return \"mov.h %1,%0\";
-; if (GET_CODE (operands[1]) == MEM)
-; operands[1] = adj_offsettable_operand (operands[1], 1);
-; return \"mov.b %1,%0\";
-;}")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (truncate:HI
- (match_operand:SI 1 "general_operand" "rmi")))]
- ""
- "mov %1.w,%0.h")
-; "*
-;{
-; if (GET_CODE (operands[0]) == REG)
-; return \"mov.w %1,%0\";
-; if (GET_CODE (operands[1]) == MEM)
-; operands[1] = adj_offsettable_operand (operands[1], 2);
-; return \"mov.h %1,%0\";
-;}")
-
-;; zero extension instructions
-;; define_expand (68k) -> define_insn (Gmicro)
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
- ""
- "movu %1.h,%0.w")
-
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "rm")))]
- ""
- "movu %1.b,%0.h")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rm")))]
- ""
- "movu %1.b,%0.w")
-
-
-;; sign extension instructions
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
- ""
- "mov %1.h,%0.w")
-
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "rm")))]
- ""
- "mov %1.b,%0.h")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rm")))]
- ""
- "mov %1.b,%0.w")
-
-
-
-;; Conversions between float and double.
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "general_operand" "=*frm,f")
- (float_extend:DF
- (match_operand:SF 1 "general_operand" "f,rmF")))]
- "TARGET_FPU"
- "*
-{
- if (FPU_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_double (operands);
- if (GREG_P (operands[1]))
- {
- output_asm_insn (\"mov.w %1,%-\", operands);
- return \"fmov %+.s,%0.d\";
- }
- return \"fmov %1.s,%0.d\";
- }
- else
- {
- if (GREG_P (operands[0]))
- {
- output_asm_insn (\"fmov %1.s,%-.d\", operands);
- output_asm_insn (\"mov.w %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"mov.w %+,%0\";
- }
- return \"fmov %1.s,%0.d\";
- }
-}")
-
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "general_operand" "=rfm")
- (float_truncate:SF
- (match_operand:DF 1 "general_operand" "f")))]
- "TARGET_FPU"
- "*
-{
- if (GREG_P (operands[0]))
- {
- output_asm_insn (\"fmov %1.d,%-.s\", operands);
- return \"mov.w %+,%0\";
- }
- return \"fmov %1.d,%0.s\";
-}")
-
-;; Conversion between fixed point and floating point.
-;; Note that among the fix-to-float insns
-;; the ones that start with SImode come first.
-;; That is so that an operand that is a CONST_INT
-;; (and therefore lacks a specific machine mode).
-;; will be recognized as SImode (which is always valid)
-;; rather than as QImode or HImode.
-
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (float:SF (match_operand:SI 1 "general_operand" "rmi")))]
- "TARGET_FPU"
- "fldi %1.w,%0.s")
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (float:DF (match_operand:SI 1 "general_operand" "rmi")))]
- "TARGET_FPU"
- "fldi %1.w,%0.d")
-
-(define_insn "floathisf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (float:SF (match_operand:HI 1 "general_operand" "rmi")))]
- "TARGET_FPU"
- "fldi %1.h,%0.s")
-
-(define_insn "floathidf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (float:DF (match_operand:HI 1 "general_operand" "rmi")))]
- "TARGET_FPU"
- "fldi %1.h,%0.d")
-
-(define_insn "floatqisf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (float:SF (match_operand:QI 1 "general_operand" "rmi")))]
- "TARGET_FPU"
- "fldi %1.b,%0.s")
-
-(define_insn "floatqidf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (float:DF (match_operand:QI 1 "general_operand" "rmi")))]
- "TARGET_FPU"
- "fldi %1.b,%0.d")
-
-;;; Convert a float to a float whose value is an integer.
-;;; This is the first stage of converting it to an integer type.
-;
-;(define_insn "ftruncdf2"
-; [(set (match_operand:DF 0 "general_operand" "=f")
-; (fix:DF (match_operand:DF 1 "general_operand" "fFm")))]
-; "TARGET_FPU"
-; "*
-;{
-; return \"fintrz.d %f1,%0\";
-;}")
-;
-;(define_insn "ftruncsf2"
-; [(set (match_operand:SF 0 "general_operand" "=f")
-; (fix:SF (match_operand:SF 1 "general_operand" "fFm")))]
-; "TARGET_FPU"
-; "*
-;{
-; return \"fintrz.s %f1,%0\";
-;}")
-
-;; Convert a float to an integer.
-
-(define_insn "fix_truncsfqi2"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (fix:QI (fix:SF (match_operand:SF 1 "general_operand" "f"))))]
- "TARGET_FPU"
- "fsti %1.s,%0.b")
-
-(define_insn "fix_truncsfhi2"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (fix:HI (fix:SF (match_operand:SF 1 "general_operand" "f"))))]
- "TARGET_FPU"
- "fsti %1.s,%0.h")
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "f"))))]
- "TARGET_FPU"
- "fsti %1.s,%0.w")
-
-(define_insn "fix_truncdfqi2"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (fix:QI (fix:DF (match_operand:DF 1 "general_operand" "f"))))]
- "TARGET_FPU"
- "fsti %1.d,%0.b")
-
-(define_insn "fix_truncdfhi2"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (fix:HI (fix:DF (match_operand:DF 1 "general_operand" "f"))))]
- "TARGET_FPU"
- "fsti %1.d,%0.h")
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "f"))))]
- "TARGET_FPU"
- "fsti %1.d,%0.w")
-
-
-;;; Special add patterns
-;;; 89.09.28
-
-;; This should be redundant; please find out why regular addsi3
-;; fails to match this case.
-
-;(define_insn ""
-; [(set (mem:SI (plus:SI
-; (plus:SI (match_operand 0 "general_operand" "r")
-; (match_operand 1 "general_operand" "r"))
-; (match_operand 2 "general_operand" "i")))
-; (plus:SI
-; (mem:SI (plus:SI
-; (plus:SI (match_dup 0)
-; (match_dup 1))
-; (match_dup 2)))
-; (match_operand 3 "general_operand" "rmi")))]
-; ""
-; "add.w %3,@(%c2,%0,%1)")
-
-
-;; add instructions
-
-;; Note that the last two alternatives are near-duplicates
-;; in order to handle insns generated by reload.
-;; This is needed since they are not themselves reloaded,
-;; so commutativity won't apply to them.
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm,!r,!r")
- (plus:SI (match_operand:SI 1 "general_operand" "%0,r,ri")
- (match_operand:SI 2 "general_operand" "rmi,ri,r")))]
- ""
- "*
-{
- if (which_alternative == 0)
- {
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- operands[1] = operands[2];
- return add_imm_word (INTVAL (operands[1]), operands[0], &operands[1]);
- }
- else
- return \"add.w %2,%0\";
- }
- else
- {
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1]))
- return \"add.w %2,%0\";
- if (GET_CODE (operands[2]) == REG
- && REGNO (operands[0]) == REGNO (operands[2]))
- return \"add.w %1,%0\";
-
- if (GET_CODE (operands[1]) == REG)
- {
- if (GET_CODE (operands[2]) == REG)
- return \"mova.w @(%1,%2),%0\";
- else
- return \"mova.w @(%c2,%1),%0\";
- }
- else
- return \"mova.w @(%c1,%2),%0\";
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (plus:SI (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "rmi"))))]
- ""
- "*
-{
- if (CONSTANT_P (operands[2]))
- {
- operands[1] = operands[2];
- return add_imm_word (INTVAL (operands[1]), operands[0], &operands[1]);
- }
- else
- return \"add %2.h,%0.w\";
-}")
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (plus:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) < 0)
- return \"sub.h #%n2,%0\";
- if (GREG_P (operands[0]))
- {
- if (CONSTANT_P (operands[2]))
- return \"add:l %2,%0.w\";
- else
- return \"add:l %2.h,%0.w\";
- }
- return \"add.h %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+rm"))
- (plus:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "rmi")))]
- ""
- "add.h %1,%0")
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (plus:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) < 0)
- return \"sub.b #%n2,%0\";
- if (GREG_P (operands[0]))
- {
- if (CONSTANT_P (operands[2]))
- return \"add:l %2,%0.w\";
- else
- return \"add:l %2.b,%0.w\";
- }
- return \"add.b %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+rm"))
- (plus:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "rmi")))]
- ""
- "add.b %1,%0")
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (plus:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "fmG")))]
- "TARGET_FPU"
- "fadd.d %f2,%0")
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (plus:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "fmG")))]
- "TARGET_FPU"
- "fadd.s %f2,%0")
-
-;; subtract instructions
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm,!r")
- (minus:SI (match_operand:SI 1 "general_operand" "0,r")
- (match_operand:SI 2 "general_operand" "rmi,i")))]
- ""
- "*
-{
- if (which_alternative == 0
- || (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1])))
- {
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- operands[1] = operands[2];
- return sub_imm_word (INTVAL (operands[1]),
- operands[0], &operands[1]);
- }
- else
- return \"sub.w %2,%0\";
- }
- else
- return \"mova.w @(%n2,%1),%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (minus:SI (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "rmi"))))]
- ""
- "sub %2.h,%0.w")
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (minus:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) < 0
- && INTVAL (operands[2]) != 0x8000)
- return \"add.h #%n2,%0\";
- return \"sub.h %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+rm"))
- (minus:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "rmi")))]
- ""
- "sub.h %1,%0")
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (minus:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) < 0
- && INTVAL (operands[2]) != 0x80)
- return \"add.b #%n2,%0\";
- return \"sub.b %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+rm"))
- (minus:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "rmi")))]
- ""
- "sub.b %1,%0")
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (minus:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "fmG")))]
- "TARGET_FPU"
- "fsub.d %f2,%0")
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (minus:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "fmG")))]
- "TARGET_FPU"
- "fsub.s %f2,%0")
-
-
-;; multiply instructions
-
-(define_insn "mulqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (mult:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "mul.b %2,%0")
-
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (mult:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "mul.h %2,%0")
-
-;; define_insn "mulhisi3"
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (mult:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "mul.w %2,%0")
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (mult:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "fmG")))]
- "TARGET_FPU"
- "fmul.d %f2,%0")
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (mult:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "fmG")))]
- "TARGET_FPU"
- "fmul.s %f2,%0")
-
-
-;; divide instructions
-
-(define_insn "divqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (div:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "div.b %2,%0")
-
-(define_insn "divhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (div:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "div.h %2,%0")
-
-(define_insn "divhisi3"
- [(set (match_operand:HI 0 "general_operand" "=r")
- (div:HI (match_operand:SI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "div %2.h,%0.w")
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "div.w %2,%0")
-
-(define_insn "udivqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (udiv:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "divu.b %2,%0")
-
-(define_insn "udivhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (udiv:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "divu.h %2,%0")
-
-(define_insn "udivhisi3"
- [(set (match_operand:HI 0 "general_operand" "=r")
- (udiv:HI (match_operand:SI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "divu %2.h,%0.w")
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (udiv:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "divu.w %2,%0")
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (div:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "fmG")))]
- "TARGET_FPU"
- "fdiv.d %f2,%0")
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (div:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "fmG")))]
- "TARGET_FPU"
- "fdiv.s %f2,%0")
-
-;; Remainder instructions.
-
-(define_insn "modqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (mod:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "rem.b %2,%0")
-
-(define_insn "modhisi3"
- [(set (match_operand:HI 0 "general_operand" "=r")
- (mod:HI (match_operand:SI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "rem.h %2,%0")
-
-(define_insn "umodqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (umod:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "remu.b %2,%0")
-
-(define_insn "umodhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (umod:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "remu.h %2,%0")
-
-(define_insn "umodhisi3"
- [(set (match_operand:HI 0 "general_operand" "=r")
- (umod:HI (match_operand:SI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "remu %2.h,%0.w")
-
-;; define_insn "divmodsi4"
-
-(define_insn "udivmodsi4"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (udiv:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmi")))
- (set (match_operand:SI 3 "general_operand" "=r")
- (umod:SI (match_dup 1) (match_dup 2)))]
- ""
- "mov.w #0,%3;divx.w %2,%0,%3")
-
-;; logical-and instructions
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (and:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
- && (GREG_P (operands[0])
- || offsettable_memref_p (operands[0])))
-
- {
- if (GET_CODE (operands[0]) != REG)
- operands[0] = adj_offsettable_operand (operands[0], 2);
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & 0xffff);
- /* Do not delete a following tstl %0 insn; that would be incorrect. */
- CC_STATUS_INIT;
- return \"and.h %2,%0\";
- }
- return \"and.w %2,%0\";
-}")
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (and:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "and.h %2,%0")
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (and:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "and.b %2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (and:SI (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm"))
- (match_operand:SI 2 "general_operand" "0")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- return \"and %1,%0.w\";
- return \"and %1.h,%0.w\";
-}")
-
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (and:SI (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rm"))
- (match_operand:SI 2 "general_operand" "0")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- return \"and %1,%0.w\";
- return \"and %1.b,%0.w\";
-}")
-
-;; inclusive-or instructions
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (ior:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "*
-{
- register int logval;
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) >> 16 == 0
- && (GREG_P (operands[0])
- || offsettable_memref_p (operands[0])))
- {
- if (GET_CODE (operands[0]) != REG)
- operands[0] = adj_offsettable_operand (operands[0], 2);
- /* Do not delete a following tstl %0 insn; that would be incorrect. */
- CC_STATUS_INIT;
- return \"or.h %2,%0\";
- }
- if (GET_CODE (operands[2]) == CONST_INT
- && (logval = exact_log2 (INTVAL (operands[2]))) >= 0
- && (GREG_P (operands[0])
- || offsettable_memref_p (operands[0])))
- {
- if (GREG_P (operands[0]))
- {
- if (logval < 7)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - logval);
- return \"bset.b %1,%0\";
- }
- operands[1] = gen_rtx (CONST_INT, VOIDmode, 31 - logval);
- return \"bset.w %1,%0\";
- }
- else
- {
- operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
- operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - (logval % 8));
- }
- return \"bset.b %1,%0\";
- }
- return \"or.w %2,%0\";
-}")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (ior:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "or.h %2,%0")
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (ior:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "or.b %2,%0")
-
-;; xor instructions
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (xor:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) >> 16 == 0
- && (offsettable_memref_p (operands[0]) || GREG_P (operands[0])))
- {
- if (! GREG_P (operands[0]))
- operands[0] = adj_offsettable_operand (operands[0], 2);
- /* Do not delete a following tstl %0 insn; that would be incorrect. */
- CC_STATUS_INIT;
- return \"xor.h %2,%0\";
- }
- return \"xor.w %2,%0\";
-}")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (xor:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "xor.h %2,%0")
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (xor:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "xor.b %2,%0")
-
-;; negation instructions
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (neg:SI (match_operand:SI 1 "general_operand" "0")))]
- ""
- "neg.w %0")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (neg:HI (match_operand:HI 1 "general_operand" "0")))]
- ""
- "neg.h %0")
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (neg:QI (match_operand:QI 1 "general_operand" "0")))]
- ""
- "neg.b %0")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (neg:SF (match_operand:SF 1 "general_operand" "fmF")))]
- "TARGET_FPU"
- "fneg.s %f1,%0")
-
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (neg:DF (match_operand:DF 1 "general_operand" "fmF")))]
- "TARGET_FPU"
- "fneg.d %f1,%0")
-
-
-;; Absolute value instructions
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (abs:SF (match_operand:SF 1 "general_operand" "fmF")))]
- "TARGET_FPU"
- "fabs.s %f1,%0")
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (abs:DF (match_operand:DF 1 "general_operand" "fmF")))]
- "TARGET_FPU"
- "fabs.d %f1,%0")
-
-
-;; one complement instructions
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (not:SI (match_operand:SI 1 "general_operand" "0")))]
- ""
- "not.w %0")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (not:HI (match_operand:HI 1 "general_operand" "0")))]
- ""
- "not.h %0")
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (not:QI (match_operand:QI 1 "general_operand" "0")))]
- ""
- "not.b %0")
-
-;; Optimized special case of shifting.
-;; Must precede the general case.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 24)))]
- "GET_CODE (XEXP (operands[1], 0)) != POST_INC
- && GET_CODE (XEXP (operands[1], 0)) != PRE_DEC"
- "mov:l %1.b,%0.w")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 24)))]
- "GET_CODE (XEXP (operands[1], 0)) != POST_INC
- && GET_CODE (XEXP (operands[1], 0)) != PRE_DEC"
- "movu %1.b,%0.w")
-
-(define_insn ""
- [(set (cc0) (compare (match_operand:QI 0 "general_operand" "i")
- (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 24))))]
- "(GET_CODE (operands[0]) == CONST_INT
- && (INTVAL (operands[0]) & ~0xff) == 0)"
- "*
-{
- cc_status.flags |= CC_REVERSED;
- if (my_signed_comp (insn))
- return \"cmp.b %0,%1\";
- return \"cmpu.b %0,%1\";
-}")
-
-(define_insn ""
- [(set (cc0) (compare (lshiftrt:SI (match_operand:SI 0 "memory_operand" "m")
- (const_int 24))
- (match_operand:QI 1 "general_operand" "i")))]
- "(GET_CODE (operands[1]) == CONST_INT
- && (INTVAL (operands[1]) & ~0xff) == 0)"
- "*
- if (my_signed_comp (insn))
- return \"cmp.b %1,%0\";
- return \"cmpu.b %1,%0\";
-")
-
-(define_insn ""
- [(set (cc0) (compare (match_operand:QI 0 "general_operand" "i")
- (ashiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 24))))]
- "(GET_CODE (operands[0]) == CONST_INT
- && ((INTVAL (operands[0]) + 0x80) & ~0xff) == 0)"
- "*
- cc_status.flags |= CC_REVERSED;
- if (my_signed_comp (insn))
- return \"cmp.b %0,%1\";
- return \"cmpu.b %0,%1\";
-")
-
-(define_insn ""
- [(set (cc0) (compare (ashiftrt:SI (match_operand:SI 0 "memory_operand" "m")
- (const_int 24))
- (match_operand:QI 1 "general_operand" "i")))]
- "(GET_CODE (operands[1]) == CONST_INT
- && ((INTVAL (operands[1]) + 0x80) & ~0xff) == 0)"
- "*
- if (my_signed_comp (insn))
- return \"cmp.b %1,%0\";
- return \"cmpu.b %1,%0\";
-")
-
-;; arithmetic shift instructions
-;; We don't need the shift memory by 1 bit instruction
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (ashift:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "sha.w %2,%0")
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (ashift:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "sha.h %2,%0")
-
-(define_insn "ashlqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (ashift:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "sha.b %2,%0")
-
-;; Arithmetic right shift on the Gmicro works by negating the shift count
-
-;; ashiftrt -> ashift
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (ashift:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "{ operands[2] = negate_rtx (SImode, operands[2]); }")
-
-;; ashiftrt -> ashift
-(define_expand "ashrhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (ashift:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- " { operands[2] = negate_rtx (HImode, operands[2]); }")
-
-;; ashiftrt -> ashift
-(define_expand "ashrqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (ashift:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- " { operands[2] = negate_rtx (QImode, operands[2]); }")
-
-;; logical shift instructions
-
-;; Logical right shift on the gmicro works by negating the shift count,
-;; then emitting a right shift with the shift count negated. This means
-;; that all actual shift counts in the RTL will be positive. This
-;; prevents converting shifts to ZERO_EXTRACTs with negative positions,
-;; which isn't valid.
-
-(define_expand "lshrsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "shl.w %n2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "rm"))))]
- ""
- "shl.w %2,%0")
-
-(define_expand "lshrhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (lshiftrt:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, HImode, negate_rtx (HImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "const_int_operand" "n")))]
- ""
- "shl.h %n2,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (neg:HI (match_operand:HI 2 "general_operand" "rm"))))]
- ""
- "shl.h %2,%0")
-
-(define_expand "lshrqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (lshiftrt:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "const_int_operand" "n")))]
- ""
- "shl.b %n2,%0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (neg:QI (match_operand:QI 2 "general_operand" "rm"))))]
- ""
- "shl.b %2,%0")
-
-;; rotate instructions
-
-(define_insn "rotlsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (rotate:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- "rol.w %2,%0")
-
-(define_insn "rotlhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (rotate:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- "rol.h %2,%0")
-
-(define_insn "rotlqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (rotate:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- "rol.b %2,%0")
-
-(define_expand "rotrsi3"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (rotatert:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ""
- " { operands[2] = negate_rtx (SImode, operands[2]); }")
-
-(define_expand "rotrhi3"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (rotatert:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "rmi")))]
- ""
- " { operands[2] = negate_rtx (HImode, operands[2]); }")
-
-(define_expand "rotrqi3"
- [(set (match_operand:QI 0 "general_operand" "=rm")
- (rotatert:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "rmi")))]
- ""
- " { operands[2] = negate_rtx (QImode, operands[2]); }")
-
-;; Special cases of bit-field insns which we should
-;; recognize in preference to the general case.
-;; These handle aligned 8-bit and 16-bit fields,
-;; which can usually be done with move instructions.
-
-;; Should I add mode_dependent_address_p ????
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+rm")
- (match_operand:SI 1 "immediate_operand" "i")
- (match_operand:SI 2 "immediate_operand" "i"))
- (match_operand:SI 3 "general_operand" "rm"))]
- "TARGET_BITFIELD
- && GET_CODE (operands[1]) == CONST_INT
- && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
- && GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
- && (GET_CODE (operands[0]) != REG
- || ( INTVAL (operands[1]) + INTVAL (operands[2]) == 32))"
- "*
-{
- if (GET_CODE (operands[3]) == MEM)
- operands[3] = adj_offsettable_operand (operands[3],
- (32 - INTVAL (operands[1])) / 8);
-
- if (GET_CODE (operands[0]) == REG)
- {
- if (INTVAL (operands[1]) == 8)
- return \"movu %3.b,%0.w\";
- return \"movu %3.h,%0.w\";
- }
- else
- {
- operands[0]
- = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
- if (INTVAL (operands[1]) == 8)
- return \"mov.b %3,%0\";
- return \"mov.h %3,%0\";
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=&r")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "rm")
- (match_operand:SI 2 "immediate_operand" "i")
- (match_operand:SI 3 "immediate_operand" "i")))]
- "TARGET_BITFIELD
- && GET_CODE (operands[2]) == CONST_INT
- && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
- && GET_CODE (operands[3]) == CONST_INT
- && INTVAL (operands[3]) % INTVAL (operands[2]) == 0"
- "*
-{
- if (!REG_P (operands[1]))
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- {
- if (INTVAL (operands[2]) == 8)
- { /* width == 8 */
- switch (INTVAL (operands[3]))
- {
- case 0:
- return \"mov.w %1,%0;shl.w #-24,%0\";
- break;
- case 8:
- return \"mov.w %1,%0;shl.w #8,%0;shl.w #-24,%0\";
- break;
- case 16:
- return \"mov.w %1,%0;shl.w #16,%0;shl.w #-24,%0\";
- break;
- case 24:
- return \"movu %1.b,%0.w\";
- break;
- default:
- myabort (2);
- }
- }
- else
- {
- switch (INTVAL (operands[3]))
- {
- case 0:
- return \"mov.w %1,%0;shl.w #-16,%0\";
- break;
- case 16:
- return \"movu %1.h,%0.w\";
- break;
- default:
- myabort (3);
- }
- }
- }
- else
- {
- if (INTVAL (operands[2]) == 8)
- return \"movu %1.h,%0.w\";
- else
- return \"movu %1.b,%0.w\";
- }
- }
- else
- { /* op[0] == MEM */
- if (INTVAL (operands[2]) == 8)
- return \"movu %1.b,%0.w\";
- return \"movu %1.h,%0.w\";
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "ro")
- (match_operand:SI 2 "immediate_operand" "i")
- (match_operand:SI 3 "immediate_operand" "i")))]
- "TARGET_BITFIELD
- && GET_CODE (operands[2]) == CONST_INT
- && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
- && GET_CODE (operands[3]) == CONST_INT
- && INTVAL (operands[3]) % INTVAL (operands[2]) == 0"
- "*
-{
- if (!REG_P (operands[1]))
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- {
- if (INTVAL (operands[2]) == 8)
- { /* width == 8 */
- switch (INTVAL (operands[3]))
- {
- case 0:
- return \"mov.w %1,%0;sha.w #-24,%0\";
- break;
- case 8:
- return \"mov.w %1,%0;shl.w #8,%0;sha.w #-24,%0\";
- break;
- case 16:
- return \"mov.w %1,%0;shl.w #16,%0;sha.w #-24,%0\";
- break;
- case 24:
- return \"mov %1.b,%0.w\";
- break;
- default:
- myabort (4);
- }
- }
- else
- {
- switch (INTVAL (operands[3]))
- {
- case 0:
- return \"mov.w %1,%0;sha.w #-16,%0\";
- break;
- case 16:
- return \"mov %1.h,%0.w\";
- break;
- default:
- myabort (5);
- }
- }
- }
- else
- {
- if (INTVAL (operands[2]) == 8)
- return \"mov %1.h,%0.w\";
- else
- return \"mov %1.b,%0.w\";
- }
- }
- else
- { /* op[0] == MEM */
- if (INTVAL (operands[2]) == 8)
- return \"mov %1.b,%0.w\";
- return \"mov %1.h,%0.w\";
- }
-}")
-
-;; Bit field instructions, general cases.
-;; "o,d" constraint causes a nonoffsettable memref to match the "o"
-;; so that its address is reloaded.
-
-;; extv dest:SI src(:QI/:SI) width:SI pos:SI
-;; r.w m r.w/# rmi
-;; %0 %1 %2 %3
-
-(define_expand "extv"
- [(set (match_operand:SI 0 "general_operand" "")
- (sign_extract:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))]
- "TARGET_BITFIELD"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (sign_extract:SI (match_operand:QI 1 "memory_operand" "m")
- (match_operand:SI 2 "general_operand" "ri")
- (match_operand:SI 3 "general_operand" "rmi")))]
- "TARGET_BITFIELD"
- "bfext %3,%2,%1,%0")
-
-
-(define_expand "extzv"
- [(set (match_operand:SI 0 "general_operand" "")
- (zero_extract:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))]
- "TARGET_BITFIELD"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (zero_extract:SI (match_operand:QI 1 "memory_operand" "m")
- (match_operand:SI 2 "general_operand" "ri")
- (match_operand:SI 3 "general_operand" "rmi")))]
- "TARGET_BITFIELD"
- "bfextu %3,%2,%1,%0")
-
-;; There is no insn on the Gmicro to NOT/SET/CLR bitfield.
-
-
-;; insv dest(BF):QI/SI width:SI pos:SI src:SI
-;; m r.w rmi r.w/i
-;; 0 1 2 3
-
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" ""))
- (match_operand:SI 3 "general_operand" ""))]
- "TARGET_BITFIELD"
- "")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m,m")
- (match_operand:SI 1 "general_operand" "r,i")
- (match_operand:SI 2 "general_operand" "rmi,i"))
- (match_operand:SI 3 "general_operand" "ri,ri"))]
- "TARGET_BITFIELD"
- "bfinsu %3,%2,%1,%0")
-
-;;; bfins/bfinsu ????????
-
-;; == == == == == == == == == == == == ==
-
-;; Now recognize bit field insns that operate on registers
-;; (or at least were intended to do so).
-
-;; On the Gmicro/300,
-;; bitfield instructions are not applicable to registers ;-<
-;; But I write the register cases, because without them the gcc
-;; seems to use "and" instruction with some other instructions
-;; instead of using a shift instruction.
-;; It is because on many processors shift instructions are slower.
-;; On the Gmicro/300 which has a barrel shifter,
-;; it is faster to use a shift instruction.
-;;
-;; Restricts width and offset to be immediates.
-;;
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "i")
- (match_operand:SI 3 "immediate_operand" "i")))]
- "TARGET_BITFIELD"
- "*
-{
- if (REGNO (operands[0]) != REGNO (operands[1]))
- output_asm_insn (\"mov.w %1,%0\", operands);
- if (INTVAL (operands[3]) != 0)
- output_asm_insn (\"shl.w %3,%0\", operands);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, -(32 - INTVAL (operands[2])));
- return \"sha.w %3,%0\";
-}")
-
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "i")
- (match_operand:SI 3 "immediate_operand" "i")))]
- "TARGET_BITFIELD"
- "*
-{
- if (REGNO (operands[0]) != REGNO (operands[1]))
- output_asm_insn (\"mov.w %1,%0\", operands);
- if (INTVAL (operands[3]) != 0)
- output_asm_insn (\"shl.w %3,%0\", operands);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, -(32 - INTVAL (operands[2])));
- return \"shl.w %3,%0\";
-}")
-
-
-;; There are more descriptions for m68k, but not yet for the Gmicro.
-;;
-
-;; Basic conditional jump instructions.
-
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- OUTPUT_JUMP (\"beq %b0\", \"fbeq %b0\", \"beq %b0\");
-}")
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- OUTPUT_JUMP (\"bne %b0\", \"fbne %b0\", \"bne %b0\");
-}")
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- OUTPUT_JUMP (\"bgt %b0\", \"fbgt %b0\", 0);
-")
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "bgt %b0")
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- OUTPUT_JUMP (\"blt %b0\", \"fblt %b0\", \"bms %b0\");
-")
-
-;; bms ?????
-;;
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "blt %b0")
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
- OUTPUT_JUMP (\"bge %b0\", \"fbge %b0\", \"bmc %b0\");
-")
-
-;; bmc ??
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "bge %b0")
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "ble %b0")
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "ble %b0")
-
-;; Negated conditional jump instructions.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- OUTPUT_JUMP (\"bne %b0\", \"fbne %b0\", \"bne %b0\");
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- OUTPUT_JUMP (\"beq %b0\", \"fbeq %b0\", \"beq %b0\");
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- OUTPUT_JUMP (\"ble %b0\", \"fbngt %b0\", 0);
-")
-;; fbngt ???
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "ble %b0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- OUTPUT_JUMP (\"bge %b0\", \"fbnlt %b0\", \"jbmc %b0\");
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "blt %b0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- OUTPUT_JUMP (\"blt %b0\", \"fbnge %b0\", \"jbms %b0\");
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "blt %b0")
-;; ????
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
- OUTPUT_JUMP (\"bgt %b0\", \"fbnle %b0\", 0);
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "bgt %b0")
-
-;; Unconditional and other jump instructions
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "bra %b0")
-
-(define_insn "tablejump"
- [(set (pc)
- (plus:SI (pc) (match_operand:SI 0 "general_operand" "r")))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jmp @(pc:b,4:4,%0)")
-
-;;
-;; Should Add code for "ACB", "SCB". !!! ????
-;; See m68k.h (dbra)
-;;
-
-;; Call subroutine with no return value.
-(define_insn "call"
- [(call (match_operand:QI 0 "general_operand" "m")
- (match_operand:SI 1 "general_operand" "rmi"))]
- ;; Operand 1 not really used on the Gmicro.
-
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0],0)) == SYMBOL_REF)
- return \"bsr %b0\";
- return \"jsr %0\";
-}")
-
-;; Call subroutine, returning value in operand 0
-;; (which must be a hard register).
-(define_insn "call_value"
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "general_operand" "m")
- (match_operand:SI 2 "general_operand" "rmi")))]
- ;; Operand 2 not really used on the Gmicro.
- ""
- "*
-{
- if (GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1],0)) == SYMBOL_REF)
- return \"bsr %b1\";
- return \"jsr %1\";
-}")
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-;; Turned off because the general move-an-address pattern handles it.
-;;
-;; Thus goes after the move instructions
-;; because the move instructions are better (require no spilling)
-;; when they can apply.
-;; After add/sub now !!
-
-;(define_insn "pushasi"
-; [(set (match_operand:SI 0 "push_operand" "=m")
-; (match_operand:SI 1 "address_operand" "p"))]
-; ""
-; "*
-;{
-; if (GET_CODE (operands[1]) == CONST_INT)
-; return push_imm_word (INTVAL (operands[1]), operands[0]);
-; if (CONSTANT_P (operands[1]))
-; return \"mov.w %1,%-\";
-; if (GET_CODE (operands[1]) == REG)
-; return \"mov.w %1,%-\";
-; else if (GET_CODE (operands[1]) == MEM)
-; {
-; return \"mov.w %1,%-\";
-; }
-; else
-; return \"mova.w %p1,%-\";
-;}")
-
-;; This should not be used unless the add/sub insns can't be.
-
-/* mova.[whq] 89.08.11 for test M.Yuhara */
-;(define_insn ""
-; [(set (match_operand:SI 0 "general_operand" "=rm")
-; (address (match_operand:SI 1 "address_operand" "p")))]
-; ""
-; "*
-;{
-; if (GET_CODE (operands[1]) == CONST_INT)
-; return mov_imm_word (INTVAL (operands[1]), operands[0]);
-; if (CONSTANT_P (operands[1]))
-; return \"mov.w %1,%0\";
-; if (GET_CODE (operands[1]) == REG)
-; return \"mov.w %1,%0\";
-; else if (GET_CODE (operands[1]) == MEM) {
-; operands[1] = XEXP (operands[1],0);
-; return \"mov.w %1,%0\";
-; }
-; else
-; return \"mova.w %p1,%0\";
-;}")
-
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (address (match_operand:HI 1 "address_operand" "")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- return mov_imm_word (INTVAL (operands[1]), operands[0]);
- if (CONSTANT_P (operands[1]))
- return \"mov.w %1,%0\";
- if (GET_CODE (operands[1]) == REG)
- return \"mov.w %1,%0\";
- else if (GET_CODE (operands[1]) == MEM)
- {
- operands[1] = XEXP (operands[1],0);
- return \"mov.w %1,%0\"; /* OK ? */
- }
- else
- return \"mova.w %p1,%0\";
-}")
-
-;(define_insn ""
-; [(set (match_operand:SI 0 "general_operand" "=rm")
-; (match_operand:QI 1 "address_operand" "p"))]
-; ""
-; "*
-;{
-; if (push_operand (operands[0], SImode))
-; return \"mova %1,%-\";
-; return \"mova %1,%0\";
-;}")
-
-;(define_insn ""
-; [(set (match_operand:SI 0 "general_operand" "=rm")
-; (match_operand:QI 1 "address_operand" "p"))]
-; ""
-; "*
-;{
-; if (CONSTANT_P (operands[1]))
-; return \"mov.w %1,%0\";
-; else if (GET_CODE (operands[1]) == REG)
-; return \"mov.w %1,%0\";
-; else if (GET_CODE (operands[1]) == MEM)
-; {
-; operands[1] = XEXP (operands[1],0);
-; return \"mov.w %1,%0 ; OK?\";
-; }
-; else if (GET_CODE (operands[0]) == REG
-; && GET_CODE (operands[1]) == PLUS)
-; {
-; rtx xreg, xdisp;
-;
-; if (GET_CODE (XEXP (operands[1], 0)) == REG
-; && REGNO (XEXP (operands[1], 0)) == REGNO (operands[0]))
-; {
-; xreg = XEXP (operands[1], 0);
-; xdisp = XEXP (operands[1],1);
-; }
-; else
-; {
-; xreg = XEXP (operands[1], 1);
-; xdisp = XEXP (operands[1],0);
-; }
-;
-; if (GET_CODE (xreg) == REG
-; && REGNO (xreg) == REGNO (operands[0])
-; && (CONSTANT_P (xdisp) || GET_CODE (xdisp) == REG))
-; {
-; operands[1] = xdisp;
-; if (CONSTANT_P (xdisp))
-; return add_imm_word (INTVAL (xdisp), xreg, &operands[1]);
-; else
-; return \"add.w %1,%0\";
-; }
-; }
-; return \"mova.w %p1,%0\";
-;}")
-
-;; This is the first machine-dependent peephole optimization.
-;; It is useful when a floating value is returned from a function call
-;; and then is moved into an FP register.
-;; But it is mainly intended to test the support for these optimizations.
-
-(define_peephole
- [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
- (set (match_operand:DF 0 "register_operand" "=f")
- (match_operand:DF 1 "register_operand" "r"))]
- "FPU_REG_P (operands[0]) && ! FPU_REG_P (operands[1])"
- "*
-{
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"mov.w %1,@sp\", xoperands);
- output_asm_insn (\"mov.w %1,%-\", operands);
- return \"fmov.d %+,%0\";
-}
-")
diff --git a/gcc/config/gnu.h b/gcc/config/gnu.h
deleted file mode 100644
index ce0fb867eb1..00000000000
--- a/gcc/config/gnu.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Configuration common to all targets running the GNU system. */
-
-/* Macro to produce CPP_PREDEFINES for GNU on a given machine. */
-#define GNU_CPP_PREDEFINES(machine) \
-"-D" machine " -Acpu(" machine ") -Amachine(" machine ") \
--Dunix -Asystem(unix) \
--DMACH -Asystem(mach) \
--D__GNU__ -Asystem(gnu)"
-
-/* Provide GCC options for standard feature-test macros. */
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{bsd:-D_BSD_SOURCE}"
-
-/* Default C library spec. Use -lbsd-compat for gcc -bsd. */
-#undef LIB_SPEC
-#define LIB_SPEC "%{bsd:-lbsd-compat} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-/* Standard include directory. In GNU, "/usr" is a four-letter word. */
-#undef STANDARD_INCLUDE_DIR
-#define STANDARD_INCLUDE_DIR "/include"
-
-
-/* We have atexit. */
-#define HAVE_ATEXIT
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-/* The system headers under GNU are C++-aware. */
-#define NO_IMPLICIT_EXTERN_C
diff --git a/gcc/config/gofast.h b/gcc/config/gofast.h
deleted file mode 100644
index 84bea516758..00000000000
--- a/gcc/config/gofast.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* US Software GOFAST floating point library support.
- Copyright (C) 1994 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 used by fp-bit.c. */
-#define US_SOFTWARE_GOFAST
-
-/* The US Software GOFAST library requires special optabs support.
- There is no negation libcall, and several others have names different
- from gcc. This file consolidates the support in one place.
-
- The basic plan is to leave gcc proper alone and via some hook fix things
- after the optabs have been set up. Our main entry point is
- INIT_GOFAST_OPTABS. */
-
-#define INIT_GOFAST_OPTABS \
- do { \
- GOFAST_CLEAR_NEG_FLOAT_OPTAB; \
- GOFAST_RENAME_LIBCALLS; \
- } while (0)
-
-#define GOFAST_CLEAR_NEG_FLOAT_OPTAB \
- do { \
- int mode; \
- for (mode = SFmode; (int) mode <= (int) TFmode; \
- mode = (enum machine_mode) ((int) mode + 1)) \
- neg_optab->handlers[(int) mode].libfunc = NULL_RTX; \
- } while (0)
-
-#define GOFAST_RENAME_LIBCALLS \
- add_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpadd"); \
- add_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpadd"); \
- sub_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpsub"); \
- sub_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpsub"); \
- smul_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpmul"); \
- smul_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpmul"); \
- flodiv_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpdiv"); \
- flodiv_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpdiv"); \
- cmp_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \
- cmp_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \
-\
- extendsfdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fptodp"); \
- truncdfsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dptofp"); \
-\
- eqsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \
- nesf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \
- gtsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \
- gesf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \
- ltsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \
- lesf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \
-\
- eqdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \
- nedf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \
- gtdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \
- gedf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \
- ltdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \
- ledf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \
-\
- eqxf2_libfunc = NULL_RTX; \
- nexf2_libfunc = NULL_RTX; \
- gtxf2_libfunc = NULL_RTX; \
- gexf2_libfunc = NULL_RTX; \
- ltxf2_libfunc = NULL_RTX; \
- lexf2_libfunc = NULL_RTX; \
-\
- eqtf2_libfunc = NULL_RTX; \
- netf2_libfunc = NULL_RTX; \
- gttf2_libfunc = NULL_RTX; \
- getf2_libfunc = NULL_RTX; \
- lttf2_libfunc = NULL_RTX; \
- letf2_libfunc = NULL_RTX; \
-\
- floatsisf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "sitofp"); \
- floatsidf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "litodp"); \
- fixsfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fptosi"); \
- fixdfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dptoli"); \
- fixunssfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fptoui"); \
- fixunsdfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dptoul"); \
-
-/* End of GOFAST_RENAME_LIBCALLS */
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
deleted file mode 100644
index a8f973606e7..00000000000
--- a/gcc/config/h8300/h8300.c
+++ /dev/null
@@ -1,3092 +0,0 @@
-/* Subroutines for insn-output.c for Hitachi H8/300.
- Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Steve Chamberlain (sac@cygnus.com),
- Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "recog.h"
-#include "expr.h"
-#include "tree.h"
-#include "obstack.h"
-
-/* Forward declarations. */
-void print_operand_address ();
-char *index ();
-
-static int h8300_interrupt_function_p PROTO ((tree));
-static int h8300_monitor_function_p PROTO ((tree));
-static int h8300_os_task_function_p PROTO ((tree));
-
-/* CPU_TYPE, says what cpu we're compiling for. */
-int cpu_type;
-
-/* True if the current function is an interrupt handler
- (either via #pragma or an attribute specification). */
-int interrupt_handler;
-
-/* True if the current fucntion is an OS Task
- (via an attribute specification). */
-int os_task;
-
-/* True if the current function is a monitor
- (via an attribute specification). */
-int monitor;
-
-/* True if a #pragma saveall has been seen for the current function. */
-int pragma_saveall;
-
-static char *names_big[] =
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7"};
-
-static char *names_extended[] =
-{"er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7"};
-
-static char *names_upper_extended[] =
-{"e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7"};
-
-/* Points to one of the above. */
-/* ??? The above could be put in an array indexed by CPU_TYPE. */
-char **h8_reg_names;
-
-/* Various operations needed by the following, indexed by CPU_TYPE. */
-
-static char *h8_push_ops[2] =
-{"push", "push.l"};
-static char *h8_pop_ops[2] =
-{"pop", "pop.l"};
-static char *h8_mov_ops[2] =
-{"mov.w", "mov.l"};
-
-char *h8_push_op, *h8_pop_op, *h8_mov_op;
-
-/* Initialize various cpu specific globals at start up. */
-
-void
-h8300_init_once ()
-{
- if (TARGET_H8300)
- {
- cpu_type = (int) CPU_H8300;
- h8_reg_names = names_big;
- }
- else
- {
- /* For this we treat the H8/300 and H8/S the same. */
- cpu_type = (int) CPU_H8300H;
- h8_reg_names = names_extended;
- }
- h8_push_op = h8_push_ops[cpu_type];
- h8_pop_op = h8_pop_ops[cpu_type];
- h8_mov_op = h8_mov_ops[cpu_type];
-}
-
-char *
-byte_reg (x, b)
- rtx x;
- int b;
-{
- static char *names_small[] =
- {"r0l", "r0h", "r1l", "r1h", "r2l", "r2h", "r3l", "r3h",
- "r4l", "r4h", "r5l", "r5h", "r6l", "r6h", "r7l", "r7h"};
-
- return names_small[REGNO (x) * 2 + b];
-}
-
-/* REGNO must be saved/restored across calls if this macro is true. */
-
-#define WORD_REG_USED(regno) \
- (regno < 7 && \
- (interrupt_handler \
- || pragma_saveall \
- || (regno == FRAME_POINTER_REGNUM && regs_ever_live[regno]) \
- || (regs_ever_live[regno] & !call_used_regs[regno])))
-
-/* Output assembly language to FILE for the operation OP with operand size
- SIZE to adjust the stack pointer. */
-
-static void
-dosize (file, op, size)
- FILE *file;
- char *op;
- unsigned int size;
-{
- /* On the h8300h and h8300s, for sizes <= 8 bytes it is as good or
- better to use adds/subs insns rather than add.l/sub.l
- with an immediate value. */
- if (size > 4 && size <= 8 && (TARGET_H8300H || TARGET_H8300S))
- {
- /* Crank the size down to <= 4 */
- fprintf (file, "\t%ss\t#%d,sp\n", op, 4);
- size -= 4;
- }
-
- switch (size)
- {
- case 4:
- if (TARGET_H8300H || TARGET_H8300S)
- {
- fprintf (file, "\t%ss\t#%d,sp\n", op, 4);
- size = 0;
- break;
- }
- case 3:
- fprintf (file, "\t%ss\t#%d,sp\n", op, 2);
- size -= 2;
- /* Fall through... */
- case 2:
- case 1:
- fprintf (file, "\t%ss\t#%d,sp\n", op, size);
- size = 0;
- break;
- case 0:
- break;
- default:
- if (TARGET_H8300)
- {
- if (current_function_needs_context
- && strcmp (op, "sub") == 0)
- {
- /* Egad. We don't have a temporary to hold the
- size of the frame in the prologue! Just inline
- the bastard since this shouldn't happen often. */
- while (size >= 2)
- {
- fprintf (file, "\tsubs\t#2,sp\n");
- size -= 2;
- }
-
- if (size)
- fprintf (file, "\tsubs\t#1,sp\n");
-
- size = 0;
- }
- else
- fprintf (file, "\tmov.w\t#%d,r3\n\t%s.w\tr3,sp\n", size, op);
- }
- else
- fprintf (file, "\t%s\t#%d,sp\n", op, size);
- size = 0;
- break;
- }
-}
-
-/* Output assembly language code for the function prologue. */
-static int push_order[FIRST_PSEUDO_REGISTER] =
-{0, 1, 2, 3, 4, 5, 6, -1, -1};
-static int pop_order[FIRST_PSEUDO_REGISTER] =
-{6, 5, 4, 3, 2, 1, 0, -1, -1};
-
-/* This is what the stack looks like after the prolog of
- a function with a frame has been set up:
-
- <args>
- PC
- FP <- fp
- <locals>
- <saved registers> <- sp
-
- This is what the stack looks like after the prolog of
- a function which doesn't have a frame:
-
- <args>
- PC
- <locals>
- <saved registers> <- sp
-*/
-
-void
-function_prologue (file, size)
- FILE *file;
- int size;
-{
- register int mask = 0;
- int fsize = (size + STACK_BOUNDARY / 8 - 1) & -STACK_BOUNDARY / 8;
- int idx;
-
- /* Note a function with the interrupt attribute and set interrupt_handler
- accordingly. */
- if (h8300_interrupt_function_p (current_function_decl))
- interrupt_handler = 1;
-
- /* If the current function has the OS_Task attribute set, then
- we have a naked prologue. */
- if (h8300_os_task_function_p (current_function_decl))
- {
- fprintf (file, ";OS_Task prologue\n");
- os_task = 1;
- return;
- }
-
- if (h8300_monitor_function_p (current_function_decl))
- {
- /* My understanding of monitor functions is they act just
- like interrupt functions, except the prologue must
- mask interrupts. */
- fprintf (file, ";monitor prologue\n");
- interrupt_handler = 1;
- monitor = 1;
- if (TARGET_H8300)
- {
- fprintf (file, "\tsubs\t#2,sp\n");
- fprintf (file, "\tpush\tr0\n");
- fprintf (file, "\tstc\tccr,r0l\n");
- fprintf (file, "\torc\t#128,ccr\n");
- fprintf (file, "\tmov.b\tr0l,@(4,sp)\n");
- }
- else
- {
- fprintf (file, "\tpush\ter0\n");
- fprintf (file, "\tstc\tccr,r0l\n");
- fprintf (file, "\torc\t#128,ccr\n");
- fprintf (file, "\tmov.b\tr0l,@(4,sp)\n");
- }
- }
-
- if (frame_pointer_needed)
- {
- /* Push fp */
- fprintf (file, "\t%s\t%s\n", h8_push_op,
- h8_reg_names[FRAME_POINTER_REGNUM]);
- fprintf (file, "\t%s\t%s,%s\n", h8_mov_op,
- h8_reg_names[STACK_POINTER_REGNUM],
- h8_reg_names[FRAME_POINTER_REGNUM]);
- }
-
- /* leave room for locals */
- dosize (file, "sub", fsize);
-
- /* Push the rest of the registers */
- for (idx = 0; idx < FIRST_PSEUDO_REGISTER; idx++)
- {
- int regno = push_order[idx];
-
- if (regno >= 0
- && WORD_REG_USED (regno)
- && (!frame_pointer_needed || regno != FRAME_POINTER_REGNUM))
- {
- if (TARGET_H8300S)
- {
- /* Try to push multiple registers. */
- if (regno == 0 || regno == 4)
- {
- int second_regno = push_order[idx + 1];
- int third_regno = push_order[idx + 2];
- int fourth_regno = push_order[idx + 3];
-
- if (fourth_regno >= 0
- && WORD_REG_USED (fourth_regno)
- && (!frame_pointer_needed
- || fourth_regno != FRAME_POINTER_REGNUM)
- && third_regno >= 0
- && WORD_REG_USED (third_regno)
- && (!frame_pointer_needed
- || third_regno != FRAME_POINTER_REGNUM)
- && second_regno >= 0
- && WORD_REG_USED (second_regno)
- && (!frame_pointer_needed
- || second_regno != FRAME_POINTER_REGNUM))
- {
- fprintf (file, "\tstm.l %s-%s,@-sp\n",
- h8_reg_names[regno],
- h8_reg_names[fourth_regno]);
- idx += 3;
- continue;
- }
- }
- if (regno == 0 || regno == 4)
- {
- int second_regno = push_order[idx + 1];
- int third_regno = push_order[idx + 2];
-
- if (third_regno >= 0
- && WORD_REG_USED (third_regno)
- && (!frame_pointer_needed
- || third_regno != FRAME_POINTER_REGNUM)
- && second_regno >= 0
- && WORD_REG_USED (second_regno)
- && (!frame_pointer_needed
- || second_regno != FRAME_POINTER_REGNUM))
- {
- fprintf (file, "\tstm.l %s-%s,@-sp\n",
- h8_reg_names[regno],
- h8_reg_names[third_regno]);
- idx += 2;
- continue;
- }
- }
- if (regno == 0 || regno == 2 || regno == 4 || regno == 6)
- {
- int second_regno = push_order[idx + 1];
-
- if (second_regno >= 0
- && WORD_REG_USED (second_regno)
- && (!frame_pointer_needed
- || second_regno != FRAME_POINTER_REGNUM))
- {
- fprintf (file, "\tstm.l %s-%s,@-sp\n",
- h8_reg_names[regno],
- h8_reg_names[second_regno]);
- idx += 1;
- continue;
- }
- }
- }
- fprintf (file, "\t%s\t%s\n", h8_push_op, h8_reg_names[regno]);
- }
- }
-}
-
-/* Output assembly language code for the function epilogue. */
-
-void
-function_epilogue (file, size)
- FILE *file;
- int size;
-{
- register int regno;
- register int mask = 0;
- int fsize = (size + STACK_BOUNDARY / 8 - 1) & -STACK_BOUNDARY / 8;
- int idx;
- rtx insn = get_last_insn ();
-
- if (os_task)
- {
- /* OS_Task epilogues are nearly naked -- they just have an
- rts instruction. */
- fprintf (file, ";OS_task epilogue\n");
- fprintf (file, "\trts\n");
- goto out;
- }
-
- /* monitor epilogues are the same as interrupt function epilogues.
- Just make a note that we're in an monitor epilogue. */
- if (monitor)
- fprintf(file, ";monitor epilogue\n");
-
- /* If the last insn was a BARRIER, we don't have to write any code. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
- if (insn && GET_CODE (insn) == BARRIER)
- return;
-
- /* Pop the saved registers. */
- for (idx = 0; idx < FIRST_PSEUDO_REGISTER; idx++)
- {
- int regno = pop_order[idx];
-
- if (regno >= 0
- && WORD_REG_USED (regno)
- && (!frame_pointer_needed || regno != FRAME_POINTER_REGNUM))
- {
- if (TARGET_H8300S)
- {
- /* Try to pop multiple registers. */
- if (regno == 7 || regno == 3)
- {
- int second_regno = pop_order[idx + 1];
- int third_regno = pop_order[idx + 2];
- int fourth_regno = pop_order[idx + 3];
-
- if (fourth_regno >= 0
- && WORD_REG_USED (fourth_regno)
- && (!frame_pointer_needed
- || fourth_regno != FRAME_POINTER_REGNUM)
- && third_regno >= 0
- && WORD_REG_USED (third_regno)
- && (!frame_pointer_needed
- || third_regno != FRAME_POINTER_REGNUM)
- && second_regno >= 0
- && WORD_REG_USED (second_regno)
- && (!frame_pointer_needed
- || second_regno != FRAME_POINTER_REGNUM))
- {
- fprintf (file, "\tldm.l @sp+,%s-%s\n",
- h8_reg_names[fourth_regno],
- h8_reg_names[regno]);
- idx += 3;
- continue;
- }
- }
- if (regno == 6 || regno == 2)
- {
- int second_regno = pop_order[idx + 1];
- int third_regno = pop_order[idx + 2];
-
- if (third_regno >= 0
- && WORD_REG_USED (third_regno)
- && (!frame_pointer_needed
- || third_regno != FRAME_POINTER_REGNUM)
- && second_regno >= 0
- && WORD_REG_USED (second_regno)
- && (!frame_pointer_needed
- || second_regno != FRAME_POINTER_REGNUM))
- {
- fprintf (file, "\tldm.l @sp+,%s-%s\n",
- h8_reg_names[third_regno],
- h8_reg_names[regno]);
- idx += 2;
- continue;
- }
- }
- if (regno == 7 || regno == 5 || regno == 3 || regno == 1)
- {
- int second_regno = pop_order[idx + 1];
-
- if (second_regno >= 0
- && WORD_REG_USED (second_regno)
- && (!frame_pointer_needed
- || second_regno != FRAME_POINTER_REGNUM))
- {
- fprintf (file, "\tldm.l @sp+,%s-%s\n",
- h8_reg_names[second_regno],
- h8_reg_names[regno]);
- idx += 1;
- continue;
- }
- }
- }
- fprintf (file, "\t%s\t%s\n", h8_pop_op, h8_reg_names[regno]);
- }
- }
-
- /* deallocate locals */
- dosize (file, "add", fsize);
-
- /* pop frame pointer if we had one. */
- if (frame_pointer_needed)
- fprintf (file, "\t%s\t%s\n", h8_pop_op, h8_reg_names[FRAME_POINTER_REGNUM]);
-
- /* If this is a monitor function, there is one register still left on
- the stack. */
- if (monitor)
- fprintf (file, "\t%s\t%s\n", h8_pop_op, h8_reg_names[0]);
-
- if (interrupt_handler)
- fprintf (file, "\trte\n");
- else
- fprintf (file, "\trts\n");
-
-out:
- interrupt_handler = 0;
- os_task = 0;
- monitor = 0;
- pragma_saveall = 0;
-}
-
-/* Output assembly code for the start of the file. */
-
-asm_file_start (file)
- FILE *file;
-{
- fprintf (file, ";\tGCC For the Hitachi H8/300\n");
- fprintf (file, ";\tBy Hitachi America Ltd and Cygnus Support\n");
- fprintf (file, ";\trelease F-1\n");
- if (optimize)
- fprintf (file, "; -O%d\n", optimize);
- if (TARGET_H8300H)
- fprintf (file, "\n\t.h8300h\n");
- else if (TARGET_H8300S)
- fprintf (file, "\n\t.h8300s\n");
- else
- fprintf (file, "\n\n");
- output_file_directive (file, main_input_filename);
-}
-
-/* Output assembly language code for the end of file. */
-
-void
-asm_file_end (file)
- FILE *file;
-{
- fprintf (file, "\t.end\n");
-}
-
-/* Return true if VALUE is a valid constant for constraint 'P'.
- IE: VALUE is a power of two <= 2**15. */
-
-int
-small_power_of_two (value)
- int value;
-{
- switch (value)
- {
- case 1:
- case 2:
- case 4:
- case 8:
- case 16:
- case 32:
- case 64:
- case 128:
- case 256:
- case 512:
- case 1024:
- case 2048:
- case 4096:
- case 8192:
- case 16384:
- case 32768:
- return 1;
- }
- return 0;
-}
-
-/* Return true if VALUE is a valid constant for constraint 'O', which
- means that the constant would be ok to use as a bit for a bclr
- instruction. */
-
-int
-ok_for_bclr (value)
- int value;
-{
- return small_power_of_two ((~value) & 0xff);
-}
-
-/* Return true is OP is a valid source operand for an integer move
- instruction. */
-
-int
-general_operand_src (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == POST_INC)
- return 1;
- return general_operand (op, mode);
-}
-
-/* Return true if OP is a valid destination operand for an integer move
- instruction. */
-
-int
-general_operand_dst (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == PRE_DEC)
- return 1;
- return general_operand (op, mode);
-}
-
-/* Return true if OP is a const valid for a bit clear instruction. */
-
-int
-o_operand (operand, mode)
- rtx operand;
- enum machine_mode mode;
-{
- return (GET_CODE (operand) == CONST_INT
- && CONST_OK_FOR_O (INTVAL (operand)));
-}
-
-/* Return true if OP is a const valid for a bit set or bit xor instruction. */
-
-int
-p_operand (operand, mode)
- rtx operand;
- enum machine_mode mode;
-{
- return (GET_CODE (operand) == CONST_INT
- && CONST_OK_FOR_P (INTVAL (operand)));
-}
-
-/* Return true if OP is a valid call operand. */
-
-int
-call_insn_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == MEM)
- {
- rtx inside = XEXP (op, 0);
- if (register_operand (inside, Pmode))
- return 1;
- if (CONSTANT_ADDRESS_P (inside))
- return 1;
- }
- return 0;
-}
-
-int
-adds_subs_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- {
- if (INTVAL (op) <= 4 && INTVAL (op) >= 0)
- return 1;
- if (INTVAL (op) >= -4 && INTVAL (op) <= 0)
- return 1;
- if ((TARGET_H8300H || TARGET_H8300S)
- && INTVAL (op) != 7
- && (INTVAL (op) <= 8 && INTVAL (op) >= 0))
- return 1;
- if ((TARGET_H8300H || TARGET_H8300S)
- && INTVAL (op) != -7
- && (INTVAL (op) >= -8 && INTVAL (op) <= 0))
- return 1;
- }
- return 0;
-}
-
-/* Return nonzero if op is an adds/subs operand which only requires
- one insn to implement. It is assumed that OP is already an adds/subs
- operand. */
-int
-one_insn_adds_subs_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int val = INTVAL (op);
-
- if (val == 1 || val == -1
- || val == 2 || val == -2
- || ((TARGET_H8300H || TARGET_H8300S)
- && (val == 4 || val == -4)))
- return 1;
- return 0;
-}
-
-char *
-output_adds_subs (operands)
- rtx *operands;
-{
- int val = INTVAL (operands[2]);
-
- /* First get the value into the range -4..4 inclusive.
-
- The only way it can be out of this range is when TARGET_H8300H
- or TARGET_H8300S is true, thus it is safe to use adds #4 and subs #4. */
- if (val > 4)
- {
- output_asm_insn ("adds #4,%A0", operands);
- val -= 4;
- }
-
- if (val < -4)
- {
- output_asm_insn ("subs #4,%A0", operands);
- val += 4;
- }
-
- /* Handle case were val == 4 or val == -4 and we're compiling
- for TARGET_H8300H or TARGET_H8300S. */
- if ((TARGET_H8300H || TARGET_H8300S)
- && val == 4)
- return "adds #4,%A0";
-
- if ((TARGET_H8300H || TARGET_H8300S)
- && val == -4)
- return "subs #4,%A0";
-
- if (val > 2)
- {
- output_asm_insn ("adds #2,%A0", operands);
- val -= 2;
- }
-
- if (val < -2)
- {
- output_asm_insn ("subs #2,%A0", operands);
- val += 2;
- }
-
- /* val should be one or two now. */
- if (val == 2)
- return "adds #2,%A0";
-
- if (val == -2)
- return "subs #2,%A0";
-
- /* val should be one now. */
- if (val == 1)
- return "adds #1,%A0";
-
- if (val == -1)
- return "subs #1,%A0";
-
- /* In theory, this can't happen. */
- abort ();
-}
-
-/* Return true if OP is a valid call operand, and OP represents
- an operand for a small call (4 bytes instead of 6 bytes). */
-
-int
-small_call_insn_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == MEM)
- {
- rtx inside = XEXP (op, 0);
-
- /* Register indirect is a small call. */
- if (register_operand (inside, Pmode))
- return 1;
-
- /* A call through the function vector is a small
- call too. */
- if (GET_CODE (inside) == SYMBOL_REF
- && SYMBOL_REF_FLAG (inside))
- return 1;
- }
- /* Otherwise it's a large call. */
- return 0;
-}
-
-/* Return true if OP is a valid jump operand. */
-
-int
-jump_address_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == REG)
- return mode == Pmode;
-
- if (GET_CODE (op) == MEM)
- {
- rtx inside = XEXP (op, 0);
- if (register_operand (inside, Pmode))
- return 1;
- if (CONSTANT_ADDRESS_P (inside))
- return 1;
- }
- return 0;
-}
-
-/* Recognize valid operands for bitfield instructions. */
-
-extern int rtx_equal_function_value_matters;
-
-int
-bit_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- /* We can except any general operand, expept that MEM operands must
- be limited to those that use addresses valid for the 'U' constraint. */
- if (!general_operand (op, mode))
- return 0;
-
- /* Accept any mem during RTL generation. Otherwise, the code that does
- insv and extzv will think that we can not handle memory. However,
- to avoid reload problems, we only accept 'U' MEM operands after RTL
- generation. This means that any named pattern which uses this predicate
- must force its operands to match 'U' before emitting RTL. */
-
- if (GET_CODE (op) == REG)
- return 1;
- if (GET_CODE (op) == SUBREG)
- return 1;
- if (!rtx_equal_function_value_matters)
- {
- /* We're building rtl */
- return GET_CODE (op) == MEM;
- }
- else
- {
- return (GET_CODE (op) == MEM
- && EXTRA_CONSTRAINT (op, 'U'));
- }
-}
-
-int
-bit_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == MEM
- && EXTRA_CONSTRAINT (op, 'U'));
-}
-
-/* Recognize valid operators for bit test. */
-
-int
-eq_operator (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- return (GET_CODE (x) == EQ || GET_CODE (x) == NE);
-}
-
-/* Handle machine specific pragmas for compatibility with existing
- compilers for the H8/300.
-
- pragma saveall generates prolog/epilog code which saves and
- restores all the registers on function entry.
-
- pragma interrupt saves and restores all registers, and exits with
- an rte instruction rather than an rts. A pointer to a function
- with this attribute may be safely used in an interrupt vector. */
-
-int
-handle_pragma (file, t)
- FILE *file;
- tree t;
-{
- int retval = 0;
- register char *pname;
-
- if (TREE_CODE (t) != IDENTIFIER_NODE)
- return 0;
-
- pname = IDENTIFIER_POINTER (t);
- if (strcmp (pname, "interrupt") == 0)
- interrupt_handler = retval = 1;
- else if (strcmp (pname, "saveall") == 0)
- pragma_saveall = retval = 1;
-
- return retval;
-}
-
-/* If the next arg with MODE and TYPE is to be passed in a register, return
- the rtx to represent where it is passed. CUM represents the state after
- the last argument. NAMED is not used. */
-
-static char *hand_list[] =
-{
- "__main",
- "__cmpsi2",
- "__divhi3",
- "__modhi3",
- "__udivhi3",
- "__umodhi3",
- "__divsi3",
- "__modsi3",
- "__udivsi3",
- "__umodsi3",
- "__mulhi3",
- "__mulsi3",
- "__reg_memcpy",
- "__reg_memset",
- "__ucmpsi2",
- 0,
-};
-
-/* Return an RTX to represent where a value with mode MODE will be returned
- from a function. If the result is 0, the argument is pushed. */
-
-rtx
-function_arg (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- rtx result = 0;
- char *fname;
- int regpass = 0;
-
- /* Never pass unnamed arguments in registers. */
- if (!named)
- return 0;
-
- /* Pass 3 regs worth of data in regs when user asked on the command line. */
- if (TARGET_QUICKCALL)
- regpass = 3;
-
- /* If calling hand written assembler, use 4 regs of args. */
-
- if (cum->libcall)
- {
- char **p;
-
- fname = XSTR (cum->libcall, 0);
-
- /* See if this libcall is one of the hand coded ones. */
-
- for (p = hand_list; *p && strcmp (*p, fname) != 0; p++)
- ;
-
- if (*p)
- regpass = 4;
- }
-
- if (regpass)
- {
- int size;
-
- if (mode == BLKmode)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
- if (size + cum->nbytes > regpass * UNITS_PER_WORD)
- {
- result = 0;
- }
- else
- {
- switch (cum->nbytes / UNITS_PER_WORD)
- {
- case 0:
- result = gen_rtx (REG, mode, 0);
- break;
- case 1:
- result = gen_rtx (REG, mode, 1);
- break;
- case 2:
- result = gen_rtx (REG, mode, 2);
- break;
- case 3:
- result = gen_rtx (REG, mode, 3);
- break;
- default:
- result = 0;
- }
- }
- }
-
- return result;
-}
-
-/* Return the cost of the rtx R with code CODE. */
-
-int
-const_costs (r, c)
- rtx r;
- enum rtx_code c;
-{
- switch (c)
- {
- case CONST_INT:
- switch (INTVAL (r))
- {
- case 0:
- case 1:
- case 2:
- case -1:
- case -2:
- return 0;
- case 4:
- case -4:
- if (TARGET_H8300H || TARGET_H8300S)
- return 0;
- else
- return 1;
- default:
- return 1;
- }
-
- case CONST:
- case LABEL_REF:
- case SYMBOL_REF:
- return 3;
-
- case CONST_DOUBLE:
- return 20;
-
- default:
- return 4;
- }
-}
-
-/* Documentation for the machine specific operand escapes:
-
- 'A' print rn in h8/300 mode, erN in H8/300H mode
- 'C' print (operand - 2).
- 'E' like s but negative.
- 'F' like t but negative.
- 'G' constant just the negative
- 'L' fake label, changed after used twice.
- 'M' turn a 'M' constant into its negative mod 2.
- 'P' if operand is incing/decing sp, print .w, otherwise .b.
- 'R' print operand as a byte:8 address if appropriate, else fall back to
- 'X' handling.
- 'S' print operand as a long word
- 'T' print operand as a word
- 'U' if operand is incing/decing sp, print l, otherwise nothing.
- 'V' find the set bit, and print its number.
- 'W' find the clear bit, and print its number.
- 'X' print operand as a byte
- 'Y' print either l or h depending on whether last 'Z' operand < 8 or >= 8.
- If this operand isn't a register, fall back to 'R' handling.
- 'Z' print int & 7.
- 'b' print the bit opcode
- 'c' print the ibit opcode
- 'd' bcc if EQ, bcs if NE
- 'e' first word of 32 bit value - if reg, then least reg. if mem
- then least. if const then most sig word
- 'f' second word of 32 bit value - if reg, then biggest reg. if mem
- then +2. if const then least sig word
- 'g' bcs if EQ, bcc if NE
- 'j' print operand as condition code.
- 'k' print operand as reverse condition code.
- 's' print as low byte of 16 bit value
- 't' print as high byte of 16 bit value
- 'w' print as low byte of 32 bit value
- 'x' print as 2nd byte of 32 bit value
- 'y' print as 3rd byte of 32 bit value
- 'z' print as msb of 32 bit value
-*/
-
-/* Return assembly language string which identifies a comparison type. */
-
-static char *
-cond_string (code)
- enum rtx_code code;
-{
- switch (code)
- {
- case NE:
- return "ne";
- case EQ:
- return "eq";
- case GE:
- return "ge";
- case GT:
- return "gt";
- case LE:
- return "le";
- case LT:
- return "lt";
- case GEU:
- return "hs";
- case GTU:
- return "hi";
- case LEU:
- return "ls";
- case LTU:
- return "lo";
- default:
- abort ();
- }
-}
-
-/* Print operand X using operand code CODE to assembly language output file
- FILE. */
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- int code;
-{
- /* This is used to general unique labels for the 'L' code. */
- static int lab = 1000;
-
- /* This is used for communication between the 'P' and 'U' codes. */
- static char *last_p;
-
- /* This is used for communication between codes V,W,Z and Y. */
- static int bitint;
-
- switch (code)
- {
- case 'A':
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", h8_reg_names[REGNO (x)]);
- else
- goto def;
- break;
- case 'C':
- fprintf (file, "#%d", INTVAL (x) - 2);
- break;
- case 'E':
- switch (GET_CODE (x))
- {
- case REG:
- fprintf (file, "%sl", names_big[REGNO (x)]);
- break;
- case CONST_INT:
- fprintf (file, "#%d", (-INTVAL (x)) & 0xff);
- break;
- default:
- abort ();
- }
- break;
- case 'F':
- switch (GET_CODE (x))
- {
- case REG:
- fprintf (file, "%sh", names_big[REGNO (x)]);
- break;
- case CONST_INT:
- fprintf (file, "#%d", ((-INTVAL (x)) & 0xff00) >> 8);
- break;
- default:
- abort ();
- }
- break;
- case 'G':
- if (GET_CODE (x) != CONST_INT)
- abort ();
- fprintf (file, "#%d", 0xff & (-INTVAL (x)));
- break;
- case 'L':
- /* 'L' must always be used twice in a single pattern. It generates
- the same label twice, and then will generate a unique label the
- next time it is used. */
- asm_fprintf (file, "tl%d", (lab++) / 2);
- break;
- case 'M':
- /* For 3/-3 and 4/-4, the other 2 is handled separately. */
- switch (INTVAL (x))
- {
- case 2:
- case 4:
- case -2:
- case -4:
- fprintf (file, "#2");
- break;
- case 1:
- case 3:
- case -1:
- case -3:
- fprintf (file, "#1");
- break;
- default:
- abort ();
- }
- break;
- case 'P':
- if (REGNO (XEXP (XEXP (x, 0), 0)) == STACK_POINTER_REGNUM)
- {
- last_p = "";
- fprintf (file, ".w");
- }
- else
- {
- last_p = "l";
- fprintf (file, ".b");
- }
- break;
- case 'S':
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", names_extended[REGNO (x)]);
- else
- goto def;
- break;
- case 'T':
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", names_big[REGNO (x)]);
- else
- goto def;
- break;
- case 'U':
- fprintf (file, "%s%s", names_big[REGNO (x)], last_p);
- break;
- case 'V':
- bitint = exact_log2 (INTVAL (x));
- if (bitint == -1)
- abort ();
- fprintf (file, "#%d", bitint & 7);
- break;
- case 'W':
- bitint = exact_log2 ((~INTVAL (x)) & 0xff);
- if (bitint == -1)
- abort ();
- fprintf (file, "#%d", bitint & 7);
- break;
- case 'R':
- case 'X':
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", byte_reg (x, 0));
- else
- goto def;
- break;
- case 'Y':
- if (bitint == -1)
- abort ();
- if (GET_CODE (x) == REG)
- fprintf (file, "%s%c", names_big[REGNO (x)], bitint > 7 ? 'h' : 'l');
- else
- print_operand (file, x, 'R');
- bitint = -1;
- break;
- case 'Z':
- bitint = INTVAL (x);
- fprintf (file, "#%d", bitint & 7);
- break;
- case 'b':
- switch (GET_CODE (x))
- {
- case IOR:
- fprintf (file, "bor");
- break;
- case XOR:
- fprintf (file, "bxor");
- break;
- case AND:
- fprintf (file, "band");
- break;
- }
- break;
- case 'c':
- switch (GET_CODE (x))
- {
- case IOR:
- fprintf (file, "bior");
- break;
- case XOR:
- fprintf (file, "bixor");
- break;
- case AND:
- fprintf (file, "biand");
- break;
- }
- break;
- case 'd':
- switch (GET_CODE (x))
- {
- case EQ:
- fprintf (file, "bcc");
- break;
- case NE:
- fprintf (file, "bcs");
- break;
- default:
- abort ();
- }
- break;
- case 'e':
- switch (GET_CODE (x))
- {
- case REG:
- if (TARGET_H8300)
- fprintf (file, "%s", names_big[REGNO (x)]);
- else
- fprintf (file, "%s", names_upper_extended[REGNO (x)]);
- break;
- case MEM:
- x = adj_offsettable_operand (x, 0);
- print_operand (file, x, 0);
- break;
- case CONST_INT:
- fprintf (file, "#%d", ((INTVAL (x) >> 16) & 0xffff));
- break;
- default:
- abort ();
- break;
- }
- break;
- case 'f':
- switch (GET_CODE (x))
- {
- case REG:
- if (TARGET_H8300)
- fprintf (file, "%s", names_big[REGNO (x) + 1]);
- else
- fprintf (file, "%s", names_big[REGNO (x)]);
- break;
- case MEM:
- x = adj_offsettable_operand (x, 2);
- print_operand (file, x, 0);
- break;
- case CONST_INT:
- fprintf (file, "#%d", INTVAL (x) & 0xffff);
- break;
- default:
- abort ();
- }
- break;
- case 'g':
- switch (GET_CODE (x))
- {
- case NE:
- fprintf (file, "bcc");
- break;
- case EQ:
- fprintf (file, "bcs");
- break;
- default:
- abort ();
- }
- break;
- case 'j':
- asm_fprintf (file, cond_string (GET_CODE (x)));
- break;
- case 'k':
- asm_fprintf (file, cond_string (reverse_condition (GET_CODE (x))));
- break;
- case 's':
- if (GET_CODE (x) == CONST_INT)
- fprintf (file, "#%d", (INTVAL (x)) & 0xff);
- else
- fprintf (file, "%s", byte_reg (x, 0));
- break;
- case 't':
- if (GET_CODE (x) == CONST_INT)
- fprintf (file, "#%d", (INTVAL (x) >> 8) & 0xff);
- else
- fprintf (file, "%s", byte_reg (x, 1));
- break;
- case 'u':
- if (GET_CODE (x) != CONST_INT)
- abort ();
- fprintf (file, "%d", INTVAL (x));
- break;
- case 'w':
- if (GET_CODE (x) == CONST_INT)
- fprintf (file, "#%d", INTVAL (x) & 0xff);
- else
- fprintf (file, "%s",
- byte_reg (x, TARGET_H8300 ? 2 : 0));
- break;
- case 'x':
- if (GET_CODE (x) == CONST_INT)
- fprintf (file, "#%d", (INTVAL (x) >> 8) & 0xff);
- else
- fprintf (file, "%s",
- byte_reg (x, TARGET_H8300 ? 3 : 1));
- break;
- case 'y':
- if (GET_CODE (x) == CONST_INT)
- fprintf (file, "#%d", (INTVAL (x) >> 16) & 0xff);
- else
- fprintf (file, "%s", byte_reg (x, 0));
- break;
- case 'z':
- if (GET_CODE (x) == CONST_INT)
- fprintf (file, "#%d", (INTVAL (x) >> 24) & 0xff);
- else
- fprintf (file, "%s", byte_reg (x, 1));
- break;
-
- default:
- def:
- switch (GET_CODE (x))
- {
- case REG:
- switch (GET_MODE (x))
- {
- case QImode:
-#if 0 /* Is it asm ("mov.b %0,r2l", ...) */
- fprintf (file, "%s", byte_reg (x, 0));
-#else /* ... or is it asm ("mov.b %0l,r2l", ...) */
- fprintf (file, "%s", names_big[REGNO (x)]);
-#endif
- break;
- case HImode:
- fprintf (file, "%s", names_big[REGNO (x)]);
- break;
- case SImode:
- case SFmode:
- fprintf (file, "%s", names_extended[REGNO (x)]);
- break;
- default:
- abort ();
- }
- break;
-
- case MEM:
- fprintf (file, "@");
- output_address (XEXP (x, 0));
-
- /* If this is an 'R' operand (reference into the 8-bit area),
- then specify a symbolic address as "foo:8". */
- if (code == 'R'
- && GET_CODE (XEXP (x, 0)) == SYMBOL_REF
- && SYMBOL_REF_FLAG (XEXP (x, 0)))
- fprintf (file, ":8");
- if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
- && TINY_DATA_NAME_P (XSTR (XEXP (x, 0), 0)))
- fprintf (file, ":16");
- break;
-
- case CONST_INT:
- case SYMBOL_REF:
- case CONST:
- case LABEL_REF:
- fprintf (file, "#");
- print_operand_address (file, x);
- break;
- }
- }
-}
-
-/* Output assembly language output for the address ADDR to FILE. */
-
-void
-print_operand_address (file, addr)
- FILE *file;
- rtx addr;
-{
- switch (GET_CODE (addr))
- {
- case REG:
- fprintf (file, "%s", h8_reg_names[REGNO (addr)]);
- break;
-
- case PRE_DEC:
- fprintf (file, "-%s", h8_reg_names[REGNO (XEXP (addr, 0))]);
- break;
-
- case POST_INC:
- fprintf (file, "%s+", h8_reg_names[REGNO (XEXP (addr, 0))]);
- break;
-
- case PLUS:
- fprintf (file, "(");
- if (GET_CODE (XEXP (addr, 0)) == REG)
- {
- /* reg,foo */
- print_operand_address (file, XEXP (addr, 1));
- fprintf (file, ",");
- print_operand_address (file, XEXP (addr, 0));
- }
- else
- {
- /* foo+k */
- print_operand_address (file, XEXP (addr, 0));
- fprintf (file, "+");
- print_operand_address (file, XEXP (addr, 1));
- }
- fprintf (file, ")");
- break;
-
- case CONST_INT:
- {
- /* Since the h8/300 only has 16 bit pointers, negative values are also
- those >= 32768. This happens for example with pointer minus a
- constant. We don't want to turn (char *p - 2) into
- (char *p + 65534) because loop unrolling can build upon this
- (IE: char *p + 131068). */
- int n = INTVAL (addr);
- if (TARGET_H8300)
- n = (int) (short) n;
- if (n < 0)
- /* ??? Why the special case for -ve values? */
- fprintf (file, "-%d", -n);
- else
- fprintf (file, "%d", n);
- break;
- }
-
- default:
- output_addr_const (file, addr);
- break;
- }
-}
-
-/* Output all insn addresses and their sizes into the assembly language
- output file. This is helpful for debugging whether the length attributes
- in the md file are correct. This is not meant to be a user selectable
- option. */
-
-void
-final_prescan_insn (insn, operand, num_operands)
- rtx insn, *operand;
- int num_operands;
-{
- /* This holds the last insn address. */
- static int last_insn_address = 0;
-
- int uid = INSN_UID (insn);
-
- if (TARGET_RTL_DUMP)
- {
- fprintf (asm_out_file, "\n****************");
- print_rtl (asm_out_file, PATTERN (insn));
- fprintf (asm_out_file, "\n");
- }
-
- if (TARGET_ADDRESSES)
- {
- fprintf (asm_out_file, "; 0x%x %d\n", insn_addresses[uid],
- insn_addresses[uid] - last_insn_address);
- last_insn_address = insn_addresses[uid];
- }
-}
-
-/* Prepare for an SI sized move. */
-
-int
-do_movsi (operands)
- rtx operands[];
-{
- rtx src = operands[1];
- rtx dst = operands[0];
- if (!reload_in_progress && !reload_completed)
- {
- if (!register_operand (dst, GET_MODE (dst)))
- {
- rtx tmp = gen_reg_rtx (GET_MODE (dst));
- emit_move_insn (tmp, src);
- operands[1] = tmp;
- }
- }
- return 0;
-}
-
-/* Function for INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET).
- Define the offset between two registers, one to be eliminated, and the other
- its replacement, at the start of a routine. */
-
-int
-initial_offset (from, to)
-{
- int offset = 0;
-
- if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
- offset = UNITS_PER_WORD + frame_pointer_needed * UNITS_PER_WORD;
- else
- {
- int regno;
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if ((regs_ever_live[regno]
- && (!call_used_regs[regno] || regno == FRAME_POINTER_REGNUM)))
- offset += UNITS_PER_WORD;
-
- /* See the comments for get_frame_size. We need to round it up to
- STACK_BOUNDARY. */
-
- offset += ((get_frame_size () + STACK_BOUNDARY / BITS_PER_UNIT - 1)
- & ~(STACK_BOUNDARY / BITS_PER_UNIT - 1));
-
- if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- offset += UNITS_PER_WORD; /* Skip saved PC */
- }
- return offset;
-}
-
-/* Update the condition code from the insn. */
-
-int
-notice_update_cc (body, insn)
- rtx body;
- rtx insn;
-{
- switch (get_attr_cc (insn))
- {
- case CC_NONE:
- /* Insn does not affect CC at all. */
- break;
-
- case CC_NONE_0HIT:
- /* Insn does not change CC, but the 0'th operand has been changed. */
- if (cc_status.value1 != 0
- && reg_overlap_mentioned_p (recog_operand[0], cc_status.value1))
- cc_status.value1 = 0;
- break;
-
- case CC_SET:
- /* Insn sets the Z,N,V flags of CC to recog_operand[0].
- C may or may not be set to 0 but that's ok
- because alter_cond will change tests to use EQ/NE. */
- CC_STATUS_INIT;
- cc_status.value1 = recog_operand[0];
- break;
-
- case CC_SET_ZN_C0:
- /* Insn sets the Z,N flags of CC to recog_operand[0].
- The V flag is unusable. The C flag may or may not be known but
- that's ok because alter_cond will change tests to use EQ/NE. */
- CC_STATUS_INIT;
- cc_status.flags |= CC_OVERFLOW_UNUSABLE | CC_NO_CARRY;
- cc_status.value1 = recog_operand[0];
- break;
-
- case CC_COMPARE:
- /* The insn is a compare instruction. */
- CC_STATUS_INIT;
- cc_status.value1 = SET_SRC (body);
- break;
-
- case CC_CLOBBER:
- /* Insn doesn't leave CC in a usable state. */
- CC_STATUS_INIT;
- break;
- }
-}
-
-/* Recognize valid operators for bit instructions */
-
-int
-bit_operator (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (x);
-
- return (code == XOR
- || code == AND
- || code == IOR);
-}
-
-/* Shifts.
-
- We devote a fair bit of code to getting efficient shifts since we can only
- shift one bit at a time on the H8/300 and H8/300H and only one or two
- bits at a time on the H8/S.
-
- The basic shift methods:
-
- * loop shifts -- emit a loop using one (or two on H8/S) bit shifts;
- this is the default. SHIFT_LOOP
-
- * inlined shifts -- emit straight line code for the shift; this is
- used when a straight line shift is about the same size or smaller
- than a loop. We allow the inline version to be slightly longer in
- some cases as it saves a register. SHIFT_INLINE
-
- * rotate + and -- rotate the value the opposite direction, then
- mask off the values we don't need. This is used when only a few
- of the bits in the original value will survive in the shifted value.
- Again, this is used when it's about the same size or smaller than
- a loop. We allow this version to be slightly longer as it is usually
- much faster than a loop. SHIFT_ROT_AND
-
- * swap (+ shifts) -- often it's possible to swap bytes/words to
- simulate a shift by 8/16. Once swapped a few inline shifts can be
- added if the shift count is slightly more than 8 or 16. This is used
- when it's about the same size or smaller than a loop. We allow this
- version to be slightly longer as it is usually much faster than a loop.
- SHIFT_SPECIAL
-
- * There other oddballs. Not worth explaining. SHIFT_SPECIAL
-
-
- Here are some thoughts on what the absolutely positively best code is.
- "Best" here means some rational trade-off between code size and speed,
- where speed is more preferred but not at the expense of generating 20 insns.
-
- A trailing '*' after the shift count indicates the "best" mode isn't
- implemented.
-
- H8/300 QImode shifts
- 1-4 - do them inline
- 5-6 - ASHIFT | LSHIFTRT: rotate, mask off other bits
- ASHIFTRT: loop
- 7 - ASHIFT | LSHIFTRT: rotate, mask off other bits
- ASHIFTRT: shll, subx (propagate carry bit to all bits)
-
- H8/300 HImode shifts
- 1-4 - do them inline
- 5-6 - loop
- 7 - shift 2nd half other way into carry.
- copy 1st half into 2nd half
- rotate 2nd half other way with carry
- rotate 1st half other way (no carry)
- mask off bits in 1st half (ASHIFT | LSHIFTRT).
- sign extend 1st half (ASHIFTRT)
- 8 - move byte, zero (ASHIFT | LSHIFTRT) or sign extend other (ASHIFTRT)
- 9-12 - do shift by 8, inline remaining shifts
- 13-14* - ASHIFT | LSHIFTRT: rotate 3/2, mask, move byte, set other byte to 0
- - ASHIFTRT: loop
- 15 - ASHIFT | LSHIFTRT: rotate 1, mask, move byte, set other byte to 0
- - ASHIFTRT: shll, subx, set other byte
-
- H8/300 SImode shifts
- 1-2 - do them inline
- 3-6 - loop
- 7* - shift other way once, move bytes into place,
- move carry into place (possibly with sign extension)
- 8 - move bytes into place, zero or sign extend other
- 9-14 - loop
- 15* - shift other way once, move word into place, move carry into place
- 16 - move word, zero or sign extend other
- 17-23 - loop
- 24* - move bytes into place, zero or sign extend other
- 25-27 - loop
- 28-30* - ASHIFT | LSHIFTRT: rotate top byte, mask, move byte into place,
- zero others
- ASHIFTRT: loop
- 31 - ASHIFT | LSHIFTRT: rotate top byte, mask, byte byte into place,
- zero others
- ASHIFTRT: shll top byte, subx, copy to other bytes
-
- H8/300H QImode shifts (same as H8/300 QImode shifts)
- 1-4 - do them inline
- 5-6 - ASHIFT | LSHIFTRT: rotate, mask off other bits
- ASHIFTRT: loop
- 7 - ASHIFT | LSHIFTRT: rotate, mask off other bits
- ASHIFTRT: shll, subx (propagate carry bit to all bits)
-
-
- H8/300H HImode shifts
- 1-4 - do them inline
- 5-6 - loop
- 7 - shift 2nd half other way into carry.
- copy 1st half into 2nd half
- rotate entire word other way using carry
- mask off remaining bits (ASHIFT | LSHIFTRT)
- sign extend remaining bits (ASHIFTRT)
- 8 - move byte, zero (ASHIFT | LSHIFTRT) or sign extend other (ASHIFTRT)
- 9-12 - do shift by 8, inline remaining shifts
- 13-14 - ASHIFT | LSHIFTRT: rotate 3/2, mask, move byte, set other byte to 0
- - ASHIFTRT: loop
- 15 - ASHIFT | LSHIFTRT: rotate 1, mask, move byte, set other byte to 0
- - ASHIFTRT: shll, subx, set other byte
-
- H8/300H SImode shifts
- (These are complicated by the fact that we don't have byte level access to
- the top word.)
- A word is: bytes 3,2,1,0 (msb -> lsb), word 1,0 (msw -> lsw)
- 1-4 - do them inline
- 5-14 - loop
- 15* - shift other way once, move word into place, move carry into place
- (with sign extension for ASHIFTRT)
- 16 - move word into place, zero or sign extend other
- 17-20 - do 16bit shift, then inline remaining shifts
- 20-23 - loop
- 24* - ASHIFT: move byte 0(msb) to byte 1, zero byte 0,
- move word 0 to word 1, zero word 0
- LSHIFTRT: move word 1 to word 0, move byte 1 to byte 0,
- zero word 1, zero byte 1
- ASHIFTRT: move word 1 to word 0, move byte 1 to byte 0,
- sign extend byte 0, sign extend word 0
- 25-27* - either loop, or
- do 24 bit shift, inline rest
- 28-30 - ASHIFT: rotate 4/3/2, mask
- LSHIFTRT: rotate 4/3/2, mask
- ASHIFTRT: loop
- 31 - shll, subx byte 0, sign extend byte 0, sign extend word 0
-
- H8/S QImode shifts
- 1-6 - do them inline
- 7 - ASHIFT | LSHIFTRT: rotate, mask off other bits
- ASHIFTRT: shll, subx (propagate carry bit to all bits)
-
- H8/S HImode shifts
- 1-7 - do them inline
- 8 - move byte, zero (ASHIFT | LSHIFTRT) or sign extend other (ASHIFTRT)
- 9-12 - do shift by 8, inline remaining shifts
- 13-14 - ASHIFT | LSHIFTRT: rotate 3/2, mask, move byte, set other byte to 0
- - ASHIFTRT: loop
- 15 - ASHIFT | LSHIFTRT: rotate 1, mask, move byte, set other byte to 0
- - ASHIFTRT: shll, subx, set other byte
-
- H8/S SImode shifts
- (These are complicated by the fact that we don't have byte level access to
- the top word.)
- A word is: bytes 3,2,1,0 (msb -> lsb), word 1,0 (msw -> lsw)
- 1-10 - do them inline
- 11-14 - loop
- 15* - shift other way once, move word into place, move carry into place
- (with sign extension for ASHIFTRT)
- 16 - move word into place, zero or sign extend other
- 17-20 - do 16bit shift, then inline remaining shifts
- 20-23 - loop
- 24* - ASHIFT: move byte 0(msb) to byte 1, zero byte 0,
- move word 0 to word 1, zero word 0
- LSHIFTRT: move word 1 to word 0, move byte 1 to byte 0,
- zero word 1, zero byte 1
- ASHIFTRT: move word 1 to word 0, move byte 1 to byte 0,
- sign extend byte 0, sign extend word 0
- 25-27* - either loop, or
- do 24 bit shift, inline rest
- 28-30 - ASHIFT: rotate 4/3/2, mask
- LSHIFTRT: rotate 4/3/2, mask
- ASHIFTRT: loop
- 31 - shll, subx byte 0, sign extend byte 0, sign extend word 0
-
- Panic!!! */
-
-int
-nshift_operator (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- switch (GET_CODE (x))
- {
- case ASHIFTRT:
- case LSHIFTRT:
- case ASHIFT:
- return 1;
-
- default:
- return 0;
- }
-}
-
-/* Called from the .md file to emit code to do shifts.
- Returns a boolean indicating success
- (currently this is always TRUE). */
-
-int
-expand_a_shift (mode, code, operands)
- enum machine_mode mode;
- int code;
- rtx operands[];
-{
- emit_move_insn (operands[0], operands[1]);
-
- /* need a loop to get all the bits we want - we generate the
- code at emit time, but need to allocate a scratch reg now */
-
- emit_insn (gen_rtx
- (PARALLEL, VOIDmode,
- gen_rtvec (2,
- gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (code, mode, operands[0], operands[2])),
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (SCRATCH, QImode, 0)))));
-
- return 1;
-}
-
-/* Shift algorithm determination.
-
- There are various ways of doing a shift:
- SHIFT_INLINE: If the amount is small enough, just generate as many one-bit
- shifts as we need.
- SHIFT_ROT_AND: If the amount is large but close to either end, rotate the
- necessary bits into position and then set the rest to zero.
- SHIFT_SPECIAL: Hand crafted assembler.
- SHIFT_LOOP: If the above methods fail, just loop. */
-
-enum shift_alg
-{
- SHIFT_INLINE,
- SHIFT_ROT_AND,
- SHIFT_SPECIAL,
- SHIFT_LOOP,
- SHIFT_MAX
-};
-
-/* Symbols of the various shifts which can be used as indices. */
-
-enum shift_type
- {
- SHIFT_ASHIFT, SHIFT_LSHIFTRT, SHIFT_ASHIFTRT
- };
-
-/* Symbols of the various modes which can be used as indices. */
-
-enum shift_mode
- {
- QIshift, HIshift, SIshift
- };
-
-/* For single bit shift insns, record assembler and what bits of the
- condition code are valid afterwards (represented as various CC_FOO
- bits, 0 means CC isn't left in a usable state). */
-
-struct shift_insn
-{
- char *assembler;
- int cc_valid;
-};
-
-/* Assembler instruction shift table.
-
- These tables are used to look up the basic shifts.
- They are indexed by cpu, shift_type, and mode.
-*/
-
-static const struct shift_insn shift_one[2][3][3] =
-{
-/* H8/300 */
- {
-/* SHIFT_ASHIFT */
- {
- { "shll\t%X0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "add.w\t%T0,%T0", CC_OVERFLOW_UNUSABLE | CC_NO_CARRY },
- { "add.w\t%f0,%f0\n\taddx\t%y0,%y0\n\taddx\t%z0,%z0", 0 }
- },
-/* SHIFT_LSHIFTRT */
- {
- { "shlr\t%X0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "shlr\t%t0\n\trotxr\t%s0", 0 },
- { "shlr\t%z0\n\trotxr\t%y0\n\trotxr\t%x0\n\trotxr\t%w0", 0 }
- },
-/* SHIFT_ASHIFTRT */
- {
- { "shar\t%X0", CC_OVERFLOW_UNUSABLE | CC_NO_CARRY },
- { "shar\t%t0\n\trotxr\t%s0", 0 },
- { "shar\t%z0\n\trotxr\t%y0\n\trotxr\t%x0\n\trotxr\t%w0", 0 }
- }
- },
-/* H8/300H */
- {
-/* SHIFT_ASHIFT */
- {
- { "shll.b\t%X0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "shll.w\t%T0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "shll.l\t%S0", CC_OVERFLOW_0 | CC_NO_CARRY }
- },
-/* SHIFT_LSHIFTRT */
- {
- { "shlr.b\t%X0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "shlr.w\t%T0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "shlr.l\t%S0", CC_OVERFLOW_0 | CC_NO_CARRY }
- },
-/* SHIFT_ASHIFTRT */
- {
- { "shar.b\t%X0", CC_OVERFLOW_UNUSABLE | CC_NO_CARRY },
- { "shar.w\t%T0", CC_OVERFLOW_UNUSABLE | CC_NO_CARRY },
- { "shar.l\t%S0", CC_OVERFLOW_UNUSABLE | CC_NO_CARRY }
- }
- }
-};
-
-static const struct shift_insn shift_two[3][3] =
-{
-/* SHIFT_ASHIFT */
- {
- { "shll.b\t#2,%X0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "shll.w\t#2,%T0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "shll.l\t#2,%S0", CC_OVERFLOW_0 | CC_NO_CARRY }
- },
-/* SHIFT_LSHIFTRT */
- {
- { "shlr.b\t#2,%X0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "shlr.w\t#2,%T0", CC_OVERFLOW_0 | CC_NO_CARRY },
- { "shlr.l\t#2,%S0", CC_OVERFLOW_0 | CC_NO_CARRY }
- },
-/* SHIFT_ASHIFTRT */
- {
- { "shar.b\t#2,%X0", CC_OVERFLOW_UNUSABLE | CC_NO_CARRY },
- { "shar.w\t#2,%T0", CC_OVERFLOW_UNUSABLE | CC_NO_CARRY },
- { "shar.l\t#2,%S0", CC_OVERFLOW_UNUSABLE | CC_NO_CARRY }
- }
-};
-
-/* Rotates are organized by which shift they'll be used in implementing.
- There's no need to record whether the cc is valid afterwards because
- it is the AND insn that will decide this. */
-
-static const char *const rotate_one[2][3][3] =
-{
-/* H8/300 */
- {
-/* SHIFT_ASHIFT */
- {
- "rotr\t%X0",
- "shlr\t%t0\n\trotxr\t%s0\n\tbst\t#7,%t0",
- 0
- },
-/* SHIFT_LSHIFTRT */
- {
- "rotl\t%X0",
- "shll\t%s0\n\trotxl\t%t0\n\tbst\t#0,%s0",
- 0
- },
-/* SHIFT_ASHIFTRT */
- {
- "rotl\t%X0",
- "shll\t%s0\n\trotxl\t%t0\n\tbst\t#0,%s0",
- 0
- }
- },
-/* H8/300H */
- {
-/* SHIFT_ASHIFT */
- {
- "rotr.b\t%X0",
- "rotr.w\t%T0",
- "rotr.l\t%S0"
- },
-/* SHIFT_LSHIFTRT */
- {
- "rotl.b\t%X0",
- "rotl.w\t%T0",
- "rotl.l\t%S0"
- },
-/* SHIFT_ASHIFTRT */
- {
- "rotl.b\t%X0",
- "rotl.w\t%T0",
- "rotl.l\t%S0"
- }
- }
-};
-
-static const char *const rotate_two[3][3] =
-{
-/* SHIFT_ASHIFT */
- {
- "rotr.b\t#2,%X0",
- "rotr.w\t#2,%T0",
- "rotr.l\t#2,%S0"
- },
-/* SHIFT_LSHIFTRT */
- {
- "rotl.b\t#2,%X0",
- "rotl.w\t#2,%T0",
- "rotl.l\t#2,%S0"
- },
-/* SHIFT_ASHIFTRT */
- {
- "rotl.b\t#2,%X0",
- "rotl.w\t#2,%T0",
- "rotl.l\t#2,%S0"
- }
-};
-
-/* Given CPU, MODE, SHIFT_TYPE, and shift count COUNT, determine the best
- algorithm for doing the shift. The assembler code is stored in ASSEMBLER.
- We don't achieve maximum efficiency in all cases, but the hooks are here
- to do so.
-
- For now we just use lots of switch statements. Since we don't even come
- close to supporting all the cases, this is simplest. If this function ever
- gets too big, perhaps resort to a more table based lookup. Of course,
- at this point you may just wish to do it all in rtl.
-
- WARNING: The constraints on insns shiftbyn_QI/HI/SI assume shifts of
- 1,2,3,4 will be inlined (1,2 for SI). */
-
-static enum shift_alg
-get_shift_alg (cpu, shift_type, mode, count, assembler_p,
- assembler2_p, cc_valid_p)
- enum attr_cpu cpu;
- enum shift_type shift_type;
- enum machine_mode mode;
- int count;
- const char **assembler_p;
- const char **assembler2_p;
- int *cc_valid_p;
-{
- /* The default is to loop. */
- enum shift_alg alg = SHIFT_LOOP;
- enum shift_mode shift_mode;
-
- /* We don't handle negative shifts or shifts greater than the word size,
- they should have been handled already. */
-
- if (count < 0 || count > GET_MODE_BITSIZE (mode))
- abort ();
-
- switch (mode)
- {
- case QImode:
- shift_mode = QIshift;
- break;
- case HImode:
- shift_mode = HIshift;
- break;
- case SImode:
- shift_mode = SIshift;
- break;
- default:
- abort ();
- }
-
- /* Assume either SHIFT_LOOP or SHIFT_INLINE.
- It is up to the caller to know that looping clobbers cc. */
- *assembler_p = shift_one[cpu][shift_type][shift_mode].assembler;
- if (TARGET_H8300S)
- *assembler2_p = shift_two[shift_type][shift_mode].assembler;
- else
- *assembler2_p = NULL;
- *cc_valid_p = shift_one[cpu][shift_type][shift_mode].cc_valid;
-
- /* Now look for cases we want to optimize. */
-
- switch (shift_mode)
- {
- case QIshift:
- if (count <= 4)
- return SHIFT_INLINE;
- else
- {
- /* Shift by 5/6 are only 3 insns on the H8/S, so it's just as
- fast as SHIFT_ROT_AND, plus CC is valid. */
- if (TARGET_H8300S && count <= 6)
- return SHIFT_INLINE;
-
- /* For ASHIFTRT by 7 bits, the sign bit is simply replicated
- through the entire value. */
- if (shift_type == SHIFT_ASHIFTRT && count == 7)
- {
- *assembler_p = "shll\t%X0\n\tsubx\t%X0,%X0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
-
- /* Other ASHIFTRTs are too much of a pain. */
- if (shift_type == SHIFT_ASHIFTRT)
- return SHIFT_LOOP;
-
- /* Other shifts by 5, 6, or 7 bits use SHIFT_ROT_AND. */
- *assembler_p = rotate_one[cpu][shift_type][shift_mode];
- if (TARGET_H8300S)
- *assembler2_p = rotate_two[shift_type][shift_mode];
- *cc_valid_p = 0;
- return SHIFT_ROT_AND;
- }
-
- case HIshift:
- if (count <= 4)
- return SHIFT_INLINE;
- else if (TARGET_H8300S && count <= 7)
- return SHIFT_INLINE;
- else if (count == 7)
- {
- if (shift_type == SHIFT_ASHIFT && TARGET_H8300)
- {
- *assembler_p = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.b\t%t0\n\trotr.b\t%s0\n\tand.b\t#0x80,%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
-
- if (shift_type == SHIFT_ASHIFT && TARGET_H8300H)
- {
- *assembler_p = "shar.b\t%t0\n\tmov.b\t%s0,%t0\n\trotxr.w\t%T0\n\tand.b\t#0x80,%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
-
- if (shift_type == SHIFT_LSHIFTRT && TARGET_H8300)
- {
- *assembler_p = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\trotl.b\t%t0\n\tand.b\t#0x01,%t0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
-
- if (shift_type == SHIFT_LSHIFTRT && TARGET_H8300H)
- {
- *assembler_p = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.w\t%T0\n\tand.b\t#0x01,%t0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
-
- if (shift_type == SHIFT_ASHIFTRT)
- {
- *assembler_p = "shal.b\t%s0\n\tmov.b\t%t0,%s0\n\trotxl.b\t%s0\n\tsubx\t%t0,%t0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 8)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- *assembler_p = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- *assembler_p = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- if (TARGET_H8300)
- *assembler_p = "mov.b\t%t0,%s0\n\tshll\t%t0\n\tsubx\t%t0,%t0\t";
- else
- *assembler_p = "mov.b\t%t0,%s0\n\texts.w\t%T0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 9)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- *assembler_p = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- *assembler_p = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- if (TARGET_H8300)
- *assembler_p = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0";
- else
- *assembler_p = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 10)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- if (TARGET_H8300S)
- *assembler_p = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t#2,%t0\n\t";
- else
- *assembler_p = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0\n\tshal.b\t%t0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- if (TARGET_H8300S)
- *assembler_p = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t#2,%s0";
- else
- *assembler_p = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0\n\tshlr.b\t%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- if (TARGET_H8300)
- *assembler_p = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0\n\tshar.b\t%s0";
- else if (TARGET_H8300H)
- *assembler_p = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0\n\tshar.b\t%s0";
- else if (TARGET_H8300S)
- *assembler_p = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t#2,%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 11)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- if (TARGET_H8300S)
- *assembler_p = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t#2,%t0\n\tshal.b\t%t0";
- else
- *assembler_p = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0\n\tshal.b\t%t0\n\tshal.b\t%t0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- if (TARGET_H8300S)
- *assembler_p = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t#2,%s0\n\tshlr.b\t%s0";
- else
- *assembler_p = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0\n\tshlr.b\t%s0\n\tshlr.b\t%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- if (TARGET_H8300)
- *assembler_p = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0";
- else if (TARGET_H8300H)
- *assembler_p = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0";
- else if (TARGET_H8300S)
- *assembler_p = "mov.b\t%t0,%s0\n\texts.w\t%T0\n\tshar.b\t#2,%s0\n\tshar.b\t%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 12)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- if (TARGET_H8300S)
- *assembler_p = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t#2,%t0\n\tshal.b\t#2,%t0";
- else
- *assembler_p = "mov.b\t%s0,%t0\n\tsub.b\t%s0,%s0\n\tshal.b\t%t0\n\tshal.b\t%t0\n\tshal.b\t%t0\n\tshal.b\t%t0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- if (TARGET_H8300S)
- *assembler_p = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t#2,%s0\n\tshlr.b\t#2,%s0";
- else
- *assembler_p = "mov.b\t%t0,%s0\n\tsub.b\t%t0,%t0\n\tshlr.b\t%s0\n\tshlr.b\t%s0\n\tshlr.b\t%s0\n\tshlr.b\t%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- if (TARGET_H8300)
- *assembler_p = "mov.b\t%t0,%s0\n\tbld\t#7,%s0\n\tsubx\t%t0,%t0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0";
- else if (TARGET_H8300H)
- *assembler_p = "mov.b\t%t0,%s0\n\textw.w\t%T0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0\n\tshar.b\t%s0";
- else if (TARGET_H8300S)
- *assembler_p = "mov.b\t%t0,%s0\n\textw.w\t%T0\n\tshar.b\t#2,%s0\n\tshar.b\t#2,%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (!TARGET_H8300 && (count == 13 || count == 14)
- || count == 15)
- {
- if (count == 15 && shift_type == SHIFT_ASHIFTRT)
- {
- *assembler_p = "shll\t%t0,%t0\n\tsubx\t%t0,%t0\n\tmov.b\t%t0,%s0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- else if (shift_type != SHIFT_ASHIFTRT)
- {
- *assembler_p = rotate_one[cpu][shift_type][shift_mode];
- if (TARGET_H8300S)
- *assembler2_p = rotate_two[shift_type][shift_mode];
- else
- *assembler2_p = NULL;
- *cc_valid_p = 0;
- return SHIFT_ROT_AND;
- }
- }
- break;
-
- case SIshift:
- if (count <= (TARGET_H8300 ? 2 : 4))
- return SHIFT_INLINE;
- else if (TARGET_H8300S && count <= 10)
- return SHIFT_INLINE;
- else if (count == 8 && TARGET_H8300)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- *assembler_p = "mov.b\t%y0,%z0n\tmov.b\t%x0,%y0\n\tmov.b\t%w0,%x0\n\tsub.b\t%w0,%w0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- *assembler_p = "mov.b\t%x0,%w0\n\tmov.b\t%y0,%x0\n\tmov.b\t%z0,%y0\n\tsub.b\t%z0,%z0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- *assembler_p = "mov.b\t%x0,%w0\n\tmov.b\t%y0,%x0\n\tmov.b\t%z0,%y0\n\tshll\t%z0\n\tsubx\t%z0,%z0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 16)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- *assembler_p = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- *assembler_p = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- if (TARGET_H8300)
- *assembler_p = "mov.w\t%e0,%f0\n\tshll\t%z0\n\tsubx\t%z0,%z0\n\tmov.b\t%z0,%y0";
- else
- *assembler_p = "mov.w\t%e0,%f0\n\texts.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 17 && !TARGET_H8300)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- *assembler_p = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- *assembler_p = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- *assembler_p = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 18 && !TARGET_H8300)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- if (TARGET_H8300S)
- *assembler_p = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t#2,%S0";
- else
- *assembler_p = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t%S0\n\tshll.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- if (TARGET_H8300S)
- *assembler_p = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t#2,%S0";
- else
- *assembler_p = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t%S0\n\tshlr.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- if (TARGET_H8300S)
- *assembler_p = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t#2,%S0";
- else
- *assembler_p = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t%S0\n\tshar.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 19 && !TARGET_H8300)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- if (TARGET_H8300S)
- *assembler_p = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t#2,%S0\n\tshll.l\t%S0";
- else
- *assembler_p = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t%S0\n\tshll.l\t%S0\n\tshll.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- if (TARGET_H8300S)
- *assembler_p = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t#2,%S0\n\tshlr.l\t%S0";
- else
- *assembler_p = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t%S0\n\tshlr.l\t%S0\n\tshlr.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- if (TARGET_H8300S)
- *assembler_p = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t#2,%S0\n\tshar.l\t%S0";
- else
- *assembler_p = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t%S0\n\tshar.l\t%S0\n\tshar.l\t%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count == 20 && TARGET_H8300S)
- {
- switch (shift_type)
- {
- case SHIFT_ASHIFT:
- *assembler_p = "mov.w\t%f0,%e0\n\tsub.w\t%f0,%f0\n\tshll.l\t#2,%S0\n\tshll.l\t#2,%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_LSHIFTRT:
- *assembler_p = "mov.w\t%e0,%f0\n\tsub.w\t%e0,%e0\n\tshlr.l\t#2,%S0\n\tshlr.l\t#2,%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- case SHIFT_ASHIFTRT:
- *assembler_p = "mov.w\t%e0,%f0\n\texts.l\t%S0\n\tshar.l\t#2,%S0\n\tshar.l\t#2,%S0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- }
- else if (count >= 28 && count <= 30 && !TARGET_H8300)
- {
- if (shift_type == SHIFT_ASHIFTRT)
- {
- return SHIFT_LOOP;
- }
- else
- {
- *assembler_p = rotate_one[cpu][shift_type][shift_mode];
- if (TARGET_H8300S)
- *assembler2_p = rotate_two[shift_type][shift_mode];
- else
- *assembler2_p = NULL;
- *cc_valid_p = 0;
- return SHIFT_ROT_AND;
- }
- }
- else if (count == 31)
- {
- if (shift_type == SHIFT_ASHIFTRT)
- {
- if (TARGET_H8300)
- *assembler_p = "shll\t%z0\n\tsubx %w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0";
- else
- *assembler_p = "shll\t%e0\n\tsubx\t%w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- else
- {
- if (TARGET_H8300)
- {
- if (shift_type == SHIFT_ASHIFT)
- *assembler_p = "sub.w\t%e0,%e0\n\tshlr\t%w0\n\tmov.w\t%e0,%f0\n\trotxr\t%z0";
- else
- *assembler_p = "sub.w\t%f0,%f0\n\tshll\t%z0\n\tmov.w\t%f0,%e0\n\trotxl\t%w0";
- *cc_valid_p = 0;
- return SHIFT_SPECIAL;
- }
- else
- {
- *assembler_p = rotate_one[cpu][shift_type][shift_mode];
- if (TARGET_H8300S)
- *assembler2_p = rotate_two[shift_type][shift_mode];
- else
- *assembler2_p = NULL;
- *cc_valid_p = 0;
- return SHIFT_ROT_AND;
- }
- }
- }
- break;
-
- default:
- abort ();
- }
-
- return alg;
-}
-
-/* Emit the assembler code for doing shifts. */
-
-char *
-emit_a_shift (insn, operands)
- rtx insn;
- rtx *operands;
-{
- static int loopend_lab;
- char *assembler;
- char *assembler2;
- int cc_valid;
- rtx inside = PATTERN (insn);
- rtx shift = operands[3];
- enum machine_mode mode = GET_MODE (shift);
- enum rtx_code code = GET_CODE (shift);
- enum shift_type shift_type;
- enum shift_mode shift_mode;
-
- loopend_lab++;
-
- switch (mode)
- {
- case QImode:
- shift_mode = QIshift;
- break;
- case HImode:
- shift_mode = HIshift;
- break;
- case SImode:
- shift_mode = SIshift;
- break;
- default:
- abort ();
- }
-
- switch (code)
- {
- case ASHIFTRT:
- shift_type = SHIFT_ASHIFTRT;
- break;
- case LSHIFTRT:
- shift_type = SHIFT_LSHIFTRT;
- break;
- case ASHIFT:
- shift_type = SHIFT_ASHIFT;
- break;
- default:
- abort ();
- }
-
- if (GET_CODE (operands[2]) != CONST_INT)
- {
- /* Indexing by reg, so have to loop and test at top */
- output_asm_insn ("mov.b %X2,%X4", operands);
- fprintf (asm_out_file, "\tble .Lle%d\n", loopend_lab);
-
- /* Get the assembler code to do one shift. */
- get_shift_alg (cpu_type, shift_type, mode, 1, &assembler,
- &assembler2, &cc_valid);
- }
- else
- {
- int n = INTVAL (operands[2]);
- enum shift_alg alg;
-
- /* If the count is negative, make it 0. */
- if (n < 0)
- n = 0;
- /* If the count is too big, truncate it.
- ANSI says shifts of GET_MODE_BITSIZE are undefined - we choose to
- do the intuitive thing. */
- else if (n > GET_MODE_BITSIZE (mode))
- n = GET_MODE_BITSIZE (mode);
-
- alg = get_shift_alg (cpu_type, shift_type, mode, n, &assembler,
- &assembler2, &cc_valid);
-
- switch (alg)
- {
- case SHIFT_INLINE:
- /* Emit two bit shifts first. */
- while (n > 1 && assembler2 != NULL)
- {
- output_asm_insn (assembler2, operands);
- n -= 2;
- }
-
- /* Now emit one bit shifts for any residual. */
- while (n > 0)
- {
- output_asm_insn (assembler, operands);
- n -= 1;
- }
-
- /* Keep track of CC. */
- if (cc_valid)
- {
- cc_status.value1 = operands[0];
- cc_status.flags |= cc_valid;
- }
- return "";
-
- case SHIFT_ROT_AND:
- {
- int m = GET_MODE_BITSIZE (mode) - n;
- int mask = (shift_type == SHIFT_ASHIFT
- ? ((1 << GET_MODE_BITSIZE (mode) - n) - 1) << n
- : (1 << GET_MODE_BITSIZE (mode) - n) - 1);
- char insn_buf[200];
- /* Not all possibilities of rotate are supported. They shouldn't
- be generated, but let's watch for 'em. */
- if (assembler == 0)
- abort ();
-
- /* Emit two bit rotates first. */
- while (m > 1 && assembler2 != NULL)
- {
- output_asm_insn (assembler2, operands);
- m -= 2;
- }
-
- /* Now single bit rotates for any residual. */
- while (m > 0)
- {
- output_asm_insn (assembler, operands);
- m -= 1;
- }
-
- /* Now mask off the high bits. */
- if (TARGET_H8300)
- {
- switch (mode)
- {
- case QImode:
- sprintf (insn_buf, "and #%d,%%X0",
- mask, n);
- cc_status.value1 = operands[0];
- cc_status.flags |= CC_OVERFLOW_0 | CC_NO_CARRY;
- break;
- case HImode:
- sprintf (insn_buf, "and #%d,%%s0\n\tand #%d,%%t0",
- mask & 255, mask >> 8, n);
- break;
- case SImode:
- abort ();
- }
- }
- else
- {
- sprintf (insn_buf, "and.%c #%d,%%%c0",
- "bwl"[shift_mode], mask,
- mode == QImode ? 'X' : mode == HImode ? 'T' : 'S');
- cc_status.value1 = operands[0];
- cc_status.flags |= CC_OVERFLOW_0 | CC_NO_CARRY;
- }
- output_asm_insn (insn_buf, operands);
- return "";
- }
- case SHIFT_SPECIAL:
- output_asm_insn (assembler, operands);
- return "";
- }
-
- /* A loop to shift by a "large" constant value.
- If we have shift-by-2 insns, use them. */
- if (assembler2 != NULL)
- {
- fprintf (asm_out_file, "\tmov.b #%d,%sl\n", n / 2,
- names_big[REGNO (operands[4])]);
- fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
- output_asm_insn (assembler2, operands);
- output_asm_insn ("add #0xff,%X4", operands);
- fprintf (asm_out_file, "\tbne .Llt%d\n", loopend_lab);
- if (n % 2)
- output_asm_insn (assembler, operands);
- return "";
- }
- else
- {
- fprintf (asm_out_file, "\tmov.b #%d,%sl\n", n,
- names_big[REGNO (operands[4])]);
- fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
- output_asm_insn (assembler, operands);
- output_asm_insn ("add #0xff,%X4", operands);
- fprintf (asm_out_file, "\tbne .Llt%d\n", loopend_lab);
- return "";
- }
- }
-
- fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
- output_asm_insn (assembler, operands);
- output_asm_insn ("add #0xff,%X4", operands);
- fprintf (asm_out_file, "\tbne .Llt%d\n", loopend_lab);
- fprintf (asm_out_file, ".Lle%d:\n", loopend_lab);
-
- return "";
-}
-
-/* Fix the operands of a gen_xxx so that it could become a bit
- operating insn. */
-
-int
-fix_bit_operand (operands, what, type)
- rtx *operands;
- char what;
- enum rtx_code type;
-{
- /* The bit_operand predicate accepts any memory during RTL generation, but
- only 'U' memory afterwards, so if this is a MEM operand, we must force
- it to be valid for 'U' by reloading the address. */
-
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), what))
- {
- /* Ok to have a memory dest. */
- if (GET_CODE (operands[0]) == MEM && !EXTRA_CONSTRAINT (operands[0], 'U'))
- {
- rtx mem;
- mem = gen_rtx (MEM, GET_MODE (operands[0]),
- copy_to_mode_reg (Pmode, XEXP (operands[0], 0)));
- RTX_UNCHANGING_P (mem) = RTX_UNCHANGING_P (operands[0]);
- MEM_IN_STRUCT_P (mem) = MEM_IN_STRUCT_P (operands[0]);
- MEM_VOLATILE_P (mem) = MEM_VOLATILE_P (operands[0]);
- operands[0] = mem;
- }
-
- if (GET_CODE (operands[1]) == MEM && !EXTRA_CONSTRAINT (operands[1], 'U'))
- {
- rtx mem;
- mem = gen_rtx (MEM, GET_MODE (operands[1]),
- copy_to_mode_reg (Pmode, XEXP (operands[1], 0)));
- RTX_UNCHANGING_P (mem) = RTX_UNCHANGING_P (operands[1]);
- MEM_IN_STRUCT_P (mem) = MEM_IN_STRUCT_P (operands[1]);
- MEM_VOLATILE_P (mem) = MEM_VOLATILE_P (operands[1]);
- operands[1] = mem;
- }
- return 0;
- }
- }
-
- /* Dest and src op must be register. */
-
- operands[1] = force_reg (QImode, operands[1]);
- {
- rtx res = gen_reg_rtx (QImode);
- emit_insn (gen_rtx (SET, VOIDmode, res, gen_rtx (type, QImode, operands[1], operands[2])));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], res));
- }
- return 1;
-}
-
-/* Return nonzero if FUNC is an interrupt function as specified
- by the "interrupt" attribute. */
-
-static int
-h8300_interrupt_function_p (func)
- tree func;
-{
- tree a;
-
- if (TREE_CODE (func) != FUNCTION_DECL)
- return 0;
-
- a = lookup_attribute ("interrupt_handler", DECL_MACHINE_ATTRIBUTES (func));
- return a != NULL_TREE;
-}
-
-/* Return nonzero if FUNC is an OS_Task function as specified
- by the "OS_Task" attribute. */
-
-static int
-h8300_os_task_function_p (func)
- tree func;
-{
- tree a;
-
- if (TREE_CODE (func) != FUNCTION_DECL)
- return 0;
-
- a = lookup_attribute ("OS_Task", DECL_MACHINE_ATTRIBUTES (func));
- return a != NULL_TREE;
-}
-
-/* Return nonzero if FUNC is a monitor function as specified
- by the "monitor" attribute. */
-
-static int
-h8300_monitor_function_p (func)
- tree func;
-{
- tree a;
-
- if (TREE_CODE (func) != FUNCTION_DECL)
- return 0;
-
- a = lookup_attribute ("monitor", DECL_MACHINE_ATTRIBUTES (func));
- return a != NULL_TREE;
-}
-
-/* Return nonzero if FUNC is a function that should be called
- through the function vector. */
-
-int
-h8300_funcvec_function_p (func)
- tree func;
-{
- tree a;
-
- if (TREE_CODE (func) != FUNCTION_DECL)
- return 0;
-
- a = lookup_attribute ("function_vector", DECL_MACHINE_ATTRIBUTES (func));
- return a != NULL_TREE;
-}
-
-/* Return nonzero if DECL is a variable that's in the eight bit
- data area. */
-
-int
-h8300_eightbit_data_p (decl)
- tree decl;
-{
- tree a;
-
- if (TREE_CODE (decl) != VAR_DECL)
- return 0;
-
- a = lookup_attribute ("eightbit_data", DECL_MACHINE_ATTRIBUTES (decl));
- return a != NULL_TREE;
-}
-
-/* Return nonzero if DECL is a variable that's in the tiny
- data area. */
-
-int
-h8300_tiny_data_p (decl)
- tree decl;
-{
- tree a;
-
- if (TREE_CODE (decl) != VAR_DECL)
- return 0;
-
- a = lookup_attribute ("tiny_data", DECL_MACHINE_ATTRIBUTES (decl));
- return a != NULL_TREE;
-}
-
-/* Return nonzero if ATTR is a valid attribute for DECL.
- ATTRIBUTES are any existing attributes and ARGS are the arguments
- supplied with ATTR.
-
- Supported attributes:
-
- interrupt_handler: output a prologue and epilogue suitable for an
- interrupt handler.
-
- function_vector: This function should be called through the
- function vector.
-
- eightbit_data: This variable lives in the 8-bit data area and can
- be referenced with 8-bit absolute memory addresses.
-
- tiny_data: This variable lives in the tiny data area and can be
- referenced with 16-bit absolute memory references. */
-
-int
-h8300_valid_machine_decl_attribute (decl, attributes, attr, args)
- tree decl;
- tree attributes;
- tree attr;
- tree args;
-{
- if (args != NULL_TREE)
- return 0;
-
- if (is_attribute_p ("interrupt_handler", attr)
- || is_attribute_p ("OS_Task", attr)
- || is_attribute_p ("monitor", attr)
- || is_attribute_p ("function_vector", attr))
- return TREE_CODE (decl) == FUNCTION_DECL;
-
- if (is_attribute_p ("eightbit_data", attr)
- && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
- {
- if (DECL_INITIAL (decl) == NULL_TREE)
- {
- warning ("Only initialized variables can be placed into the 8-bit area.");
- return 0;
- }
- DECL_SECTION_NAME (decl) = build_string (7, ".eight");
- return 1;
- }
-
- if (is_attribute_p ("tiny_data", attr)
- && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
- {
- if (DECL_INITIAL (decl) == NULL_TREE)
- {
- warning ("Only initialized variables can be placed into the 8-bit area.");
- return 0;
- }
- DECL_SECTION_NAME (decl) = build_string (6, ".tiny");
- return 1;
- }
-
- return 0;
-}
-
-extern struct obstack *saveable_obstack;
-
-h8300_encode_label (decl)
- tree decl;
-{
- char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
- int len = strlen (str);
- char *newstr;
-
- newstr = obstack_alloc (saveable_obstack, len + 2);
-
- strcpy (newstr + 1, str);
- *newstr = '*';
- XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
-}
-
-char *
-output_simode_bld (bild, log2, operands)
- int bild;
- int log2;
- rtx operands[];
-{
- /* Clear the destination register. */
- if (TARGET_H8300H || TARGET_H8300S)
- output_asm_insn ("sub.l\t%S0,%S0", operands);
- else
- output_asm_insn ("sub.w\t%e0,%e0\n\tsub.w\t%f0,%f0", operands);
-
- /* Get the bit number we want to load. */
- if (log2)
- operands[2] = GEN_INT (exact_log2 (INTVAL (operands[2])));
-
- /* Now output the bit load or bit inverse load, and store it in
- the destination. */
- if (bild)
- output_asm_insn ("bild\t%Z2,%Y1\n\tbst\t#0,%w0", operands);
- else
- output_asm_insn ("bld\t%Z2,%Y1\n\tbst\t#0,%w0", operands);
-
- /* All done. */
- return "";
-}
-
-/* Given INSN and it's current length LENGTH, return the adjustment
- (in bytes) to correctly compute INSN's length.
-
- We use this to get the lengths of various memory references correct. */
-
-h8300_adjust_insn_length (insn, length)
- rtx insn;
- int length;
-{
- rtx pat = PATTERN (insn);
-
- /* Adjust length for reg->mem and mem->reg copies. */
- if (GET_CODE (pat) == SET
- && (GET_CODE (SET_SRC (pat)) == MEM
- || GET_CODE (SET_DEST (pat)) == MEM))
- {
- /* This insn might need a length adjustment. */
- rtx addr;
-
- if (GET_CODE (SET_SRC (pat)) == MEM)
- addr = XEXP (SET_SRC (pat), 0);
- else
- addr = XEXP (SET_DEST (pat), 0);
-
- /* On the H8/300, only one adjustment is necessary; if the
- address mode is register indirect, then this insn is two
- bytes shorter than indicated in the machine description. */
- if (TARGET_H8300 && GET_CODE (addr) == REG)
- return -2;
-
- /* On the H8/300H and H8/S, register indirect is 6 bytes shorter than
- indicated in the machine description. */
- if ((TARGET_H8300H || TARGET_H8300S)
- && GET_CODE (addr) == REG)
- return -6;
-
- /* On the H8/300H and H8/300S, reg + d, for small displacements is 4
- bytes shorter than indicated in the machine description. */
- if ((TARGET_H8300H || TARGET_H8300S)
- && GET_CODE (addr) == PLUS
- && GET_CODE (XEXP (addr, 0)) == REG
- && GET_CODE (XEXP (addr, 1)) == CONST_INT
- && INTVAL (XEXP (addr, 1)) > -32768
- && INTVAL (XEXP (addr, 1)) < 32767)
- return -4;
-
- /* On the H8/300H and H8/300S, abs:16 is two bytes shorter than the
- more general abs:24. */
- if ((TARGET_H8300H || TARGET_H8300S)
- && GET_CODE (addr) == SYMBOL_REF
- && TINY_DATA_NAME_P (XSTR (addr, 0)))
- return -2;
- }
-
- /* Loading some constants needs adjustment. */
- if (GET_CODE (pat) == SET
- && GET_CODE (SET_SRC (pat)) == CONST_INT
- && GET_MODE (SET_DEST (pat)) == SImode
- && INTVAL (SET_SRC (pat)) != 0)
- {
- if (TARGET_H8300
- && ((INTVAL (SET_SRC (pat)) & 0xffff) == 0
- || ((INTVAL (SET_SRC (pat)) >> 16) & 0xffff) == 0))
- return -2;
-
- if (TARGET_H8300H || TARGET_H8300S)
- {
- int val = INTVAL (SET_SRC (pat));
-
- if (val == (val & 0xff)
- || val == (val & 0xff00))
- return -6;
-
- if (val == -4 || val == -2 || val == -1)
- return -6;
- }
- }
-
- /* Shifts need various adjustments. */
- if (GET_CODE (pat) == PARALLEL
- && GET_CODE (XVECEXP (pat, 0, 0)) == SET
- && (GET_CODE (SET_SRC (XVECEXP (pat, 0, 0))) == ASHIFTRT
- || GET_CODE (SET_SRC (XVECEXP (pat, 0, 0))) == LSHIFTRT
- || GET_CODE (SET_SRC (XVECEXP (pat, 0, 0))) == ASHIFT))
- {
- rtx src = SET_SRC (XVECEXP (pat, 0, 0));
- enum machine_mode mode = GET_MODE (src);
-
- if (GET_CODE (XEXP (src, 1)) != CONST_INT)
- return 0;
-
- /* QImode shifts by small constants take one insn
- per shift. So the adjustment is 20 (md length) -
- # shifts * 2. */
- if (mode == QImode && INTVAL (XEXP (src, 1)) <= 4)
- return -(20 - INTVAL (XEXP (src, 1)) * 2);
-
- /* Similarly for HImode and SImode shifts by
- small constants on the H8/300H and H8/300S. */
- if ((TARGET_H8300H || TARGET_H8300S)
- && (mode == HImode || mode == SImode)
- && INTVAL (XEXP (src, 1)) <= 4)
- return -(20 - INTVAL (XEXP (src, 1)) * 2);
-
- /* HImode shifts by small constants for the H8/300. */
- if (mode == HImode
- && INTVAL (XEXP (src, 1)) <= 4)
- return -(20 - (INTVAL (XEXP (src, 1))
- * (GET_CODE (src) == ASHIFT ? 2 : 4)));
-
- /* SImode shifts by small constants for the H8/300. */
- if (mode == SImode
- && INTVAL (XEXP (src, 1)) <= 2)
- return -(20 - (INTVAL (XEXP (src, 1))
- * (GET_CODE (src) == ASHIFT ? 6 : 8)));
-
- /* XXX ??? Could check for more shift/rotate cases here. */
- }
-
- return 0;
-}
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
deleted file mode 100644
index 8e42f47f5a7..00000000000
--- a/gcc/config/h8300/h8300.h
+++ /dev/null
@@ -1,1406 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Hitachi H8/300 version generating coff
- Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Steve Chamberlain (sac@cygnus.com),
- Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.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. */
-
-/* Which cpu to compile for.
- We use int for CPU_TYPE to avoid lots of casts. */
-#if 0 /* defined in insn-attr.h, here for documentation */
-enum attr_cpu { CPU_H8300, CPU_H8300H };
-#endif
-extern int cpu_type;
-
-/* Various globals defined in h8300.c. */
-
-extern char *h8_push_op,*h8_pop_op,*h8_mov_op;
-extern char **h8_reg_names;
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES \
-"-D__LONG_MAX__=2147483647L -D__LONG_LONG_MAX__=2147483647L"
-
-#define CPP_SPEC \
- "%{!mh:%{!ms:-D__H8300__}} %{mh:-D__H8300H__} %{ms:-D__H8300S__} \
- %{!mh:%{!ms:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}} \
- %{mh:-D__SIZE_TYPE__=unsigned\\ long -D__PTRDIFF_TYPE__=long} \
- %{ms:-D__SIZE_TYPE__=unsigned\\ long -D__PTRDIFF_TYPE__=long} \
- %{!mh:%{!ms:-Acpu(h8300) -Amachine(h8300)}} \
- %{mh:-Acpu(h8300h) -Amachine(h8300h)} \
- %{ms:-Acpu(h8300s) -Amachine(h8300s)} \
- %{!mint32:-D__INT_MAX__=32767} %{mint32:-D__INT_MAX__=2147483647}"
-
-#define LINK_SPEC "%{mh:-m h8300h} %{ms:-m h8300s}"
-
-#define LIB_SPEC "%{mrelax:-relax} %{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fprintf (stderr, " (Hitachi H8/300)");
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Make int's 32 bits. */
-#define TARGET_INT32 (target_flags & 8)
-
-/* Dump recorded insn lengths into the output file. This helps debug the
- md file. */
-#define TARGET_ADDRESSES (target_flags & 64)
-
-/* Pass the first few arguments in registers. */
-#define TARGET_QUICKCALL (target_flags & 128)
-
-/* Pretend byte accesses are slow. */
-#define TARGET_SLOWBYTE (target_flags & 256)
-
-/* Dump each assembler insn's rtl into the output file.
- This is for debugging the compiler only. */
-#define TARGET_RTL_DUMP (target_flags & 2048)
-
-/* Select between the h8/300 and h8/300h cpus. */
-#define TARGET_H8300 (! TARGET_H8300H && ! TARGET_H8300S)
-#define TARGET_H8300H (target_flags & 4096)
-#define TARGET_H8300S (target_flags & 1)
-
-/* Align all values on the h8/300h the same way as the h8/300. Specifically,
- 32 bit and larger values are aligned on 16 bit boundaries.
- This is all the hardware requires, but the default is 32 bits for the 300h.
- ??? Now watch someone add hardware floating point requiring 32 bit
- alignment. */
-#define TARGET_ALIGN_300 (target_flags & 8192)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { {"s",1 }, \
- {"no-s",-1}, \
- {"int32",8}, \
- {"addresses",64 }, \
- {"quickcall",128}, \
- {"no-quickcall",-128}, \
- {"slowbyte",256}, \
- {"relax",1024}, \
- {"rtl-dump",2048}, \
- {"h",4096}, \
- {"no-h",-4096}, \
- {"align-300",8192}, \
- { "", TARGET_DEFAULT}}
-
-/* Do things that must be done once at start up. */
-
-#define OVERRIDE_OPTIONS \
-do { \
- h8300_init_once (); \
-} while (0)
-
-/* Default target_flags if no switches specified. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (128) /* quickcall */
-#endif
-
-/* Show we can debug even without a frame pointer. */
-/* #define CAN_DEBUG_WITHOUT_FP */
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap.
-
- Calls through a register are cheaper than calls to named
- functions; however, the register pressure this causes makes
- CSEing of function addresses generally a lose. */
-#define NO_FUNCTION_CSE
-
-/* Target machine storage layout */
-
-/* Define to use software floating point emulator for REAL_ARITHMETIC and
- decimal <-> binary conversion. */
-#define REAL_ARITHMETIC
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is not true on the H8/300. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is true on the H8/300. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is lowest
- numbered.
- This is true on an H8/300 (actually we can make it up, but we choose to
- be consistent). */
-#define WORDS_BIG_ENDIAN 1
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD (TARGET_H8300H || TARGET_H8300S ? 32 : 16)
-#define MAX_BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD (TARGET_H8300H || TARGET_H8300S ? 4 : 2)
-#define MIN_UNITS_PER_WORD 2
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE (TARGET_H8300H || TARGET_H8300S ? 32 : 16)
-
-#define SHORT_TYPE_SIZE 16
-#define INT_TYPE_SIZE (TARGET_INT32 ? 32 : 16)
-#define LONG_TYPE_SIZE 32
-#define LONG_LONG_TYPE_SIZE 32
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 32
-#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
-
-#define MAX_FIXED_MODE_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY (TARGET_H8300H || TARGET_H8300S ? 32 : 16)
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 16
-
-/* Alignment of field after `int : 0' in a structure. */
-/* One can argue this should be 32 for -mint32, but since 32 bit ints only
- need 16 bit alignment, this is left as is so that -mint32 doesn't change
- structure layouts. */
-#define EMPTY_FIELD_BOUNDARY 16
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 0
-
-/* No data type wants to be aligned rounder than this.
- 32 bit values are aligned as such on the 300h for speed. */
-#define BIGGEST_ALIGNMENT \
-(((TARGET_H8300H || TARGET_H8300S) && ! TARGET_ALIGN_300) ? 32 : 16)
-
-/* No structure field wants to be aligned rounder than this. */
-#define BIGGEST_FIELD_ALIGNMENT \
-(((TARGET_H8300H || TARGET_H8300S) && ! TARGET_ALIGN_300) ? 32 : 16)
-
-/* The stack goes in 16/32 bit lumps. */
-#define STACK_BOUNDARY (TARGET_H8300 ? 16 : 32)
-
-/* Define this if move instructions will actually fail to work
- when given unaligned data. */
-/* On the H8/300, longs can be aligned on halfword boundaries, but not
- byte boundaries. */
-#define STRICT_ALIGNMENT 1
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
-
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- Reg 9 does not correspond to any hardware register, but instead
- appears in the RTL as an argument pointer prior to reload, and is
- eliminated during reloading in favor of either the stack or frame
- pointer. */
-
-#define FIRST_PSEUDO_REGISTER 10
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator. */
-
-#define FIXED_REGISTERS \
- { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you
- like.
-
- h8 destroys r0,r1,r2,r3. */
-
-#define CALL_USED_REGISTERS \
- { 1, 1, 1, 1, 0, 0, 0, 1, 1, 1 }
-
-#define REG_ALLOC_ORDER \
- { 2, 3, 0, 1, 4, 5, 6, 8, 7, 9}
-
-#define CONDITIONAL_REGISTER_USAGE \
-{ \
- if (!TARGET_H8300S) \
- fixed_regs[8] = call_used_regs[8] = 1;\
-}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
-
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- We pretend the MAC register is 32bits -- we don't have any data
- types on the H8 series to handle more than 32bits. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode
- MODE.
-
- H8/300: If an even reg, then anything goes. Otherwise the mode must be QI
- or HI.
- H8/300H: Anything goes. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (TARGET_H8300 ? (((REGNO)&1)==0) || (MODE==HImode) || (MODE==QImode) \
- : REGNO == 8 ? MODE == SImode : 1)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) == (MODE2))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* H8/300 pc is not overloaded on a register. */
-
-/*#define PC_REGNUM 15*/
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 7
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 6
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 0
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 9
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 3
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-enum reg_class {
- NO_REGS, GENERAL_REGS, MAC_REGS, ALL_REGS, LIM_REG_CLASSES
-};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
-{ "NO_REGS", "GENERAL_REGS", "MAC_REGS", "ALL_REGS", "LIM_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ 0, /* No regs */ \
- 0x0ff, /* GENERAL_REGS */ \
- 0x100, /* MAC_REGS */ \
- 0x3ff, /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) (REGNO != 8 ? GENERAL_REGS : MAC_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS NO_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description.
-
- 'a' is the MAC register. */
-
-#define REG_CLASS_FROM_LETTER(C) ((C) == 'a' ? MAC_REGS : NO_REGS)
-
-/* The letters I, J, K, L, M, N, O, P in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C. */
-
-#define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
-#define CONST_OK_FOR_J(VALUE) ((unsigned) (VALUE) < 256)
-#define CONST_OK_FOR_K(VALUE) (((VALUE) == 1) || (VALUE) == 2)
-#define CONST_OK_FOR_L(VALUE) (((VALUE) == -1) || (VALUE) == -2)
-#define CONST_OK_FOR_M(VALUE) (((VALUE) == 3) || (VALUE) == 4)
-#define CONST_OK_FOR_N(VALUE) (((VALUE) == -3) || (VALUE) == -4)
-#define CONST_OK_FOR_O(VALUE) (ok_for_bclr (VALUE))
-#define CONST_OK_FOR_P(VALUE) (small_power_of_two (VALUE))
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
- (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
- (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
- (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
- (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
- (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
- (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
- (C) == 'P' ? CONST_OK_FOR_P(VALUE) : \
- 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself.
-
- `G' is a floating-point zero. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? (VALUE) == CONST0_RTX (DFmode) \
- : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-
-/* On the H8, this is the size of MODE in words. */
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Any SI register to register move may need to be reloaded,
- so define REGISTER_MOVE_COST to be > 2 so that reload never
- shortcuts. */
-
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- (CLASS1 == MAC_REGS || CLASS2 == MAC_REGS ? 6 : 3)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
-
- On the H8/300, @-sp really pushes a byte if you ask it to - but that's
- dangerous, so we claim that it always pushes a word, then we catch
- the mov.b rx,@-sp and turn it into a mov.w rx,@-sp on output.
-
- On the H8/300h, we simplify TARGET_QUICKCALL by setting this to 4 and doing
- a similar thing. */
-
-#define PUSH_ROUNDING(BYTES) \
- (((BYTES) + PARM_BOUNDARY/8 - 1) & -PARM_BOUNDARY/8)
-
-/* Offset of first parameter from the argument pointer register value. */
-/* Is equal to the size of the saved fp + pc, even if an fp isn't
- saved since the value is used before we know. */
-
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the H8 the return does not pop anything. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Definitions for register eliminations.
-
- This is an array of structures. Each structure initializes one pair
- of eliminable registers. The "from" register number is given first,
- followed by "to". Eliminations of the same "from" register are listed
- in order of preference.
-
- We have two registers that can be eliminated on the h8300. First, the
- frame pointer register can often be eliminated in favor of the stack
- pointer register. Secondly, the argument pointer register can always be
- eliminated; it is replaced with either the stack or frame pointer. */
-
-#define ELIMINABLE_REGS \
-{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
-
-/* Given FROM and TO register numbers, say whether this elimination is allowed.
- Frame pointer elimination is automatically handled.
-
- For the h8300, if frame pointer elimination is being done, we would like to
- convert ap into sp, not fp.
-
- All other eliminations are valid. */
-
-#define CAN_ELIMINATE(FROM, TO) \
- ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
- ? ! frame_pointer_needed \
- : 1)
-
-/* Define the offset between two registers, one to be eliminated, and the other
- its replacement, at the start of a routine. */
-
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
- OFFSET = initial_offset (FROM, TO)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0.
-
- On the H8 the return value is in R0/R1. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-/* On the h8 the return value is in R0/R1 */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, MODE, 0)
-
-/* 1 if N is a possible register number for a function value.
- On the H8, R0 is the only register thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-/*#define PCC_STATIC_STRUCT_RETURN*/
-
-/* 1 if N is a possible register number for function argument passing.
- On the H8, no registers are used in this way. */
-
-#define FUNCTION_ARG_REGNO_P(N) (TARGET_QUICKCALL ? N < 3 : 0)
-
-/* Register in which address to store a structure value
- is passed to a function. */
-
-#define STRUCT_VALUE 0
-
-/* Return true if X should be returned in memory. */
-#define RETURN_IN_MEMORY(X) \
- (TYPE_MODE (X) == BLKmode || GET_MODE_SIZE (TYPE_MODE (X)) > 4)
-
-/* When defined, the compiler allows registers explicitly used in the
- rtl to be used as spill registers but prevents the compiler from
- extending the lifetime of these registers. */
-
-#define SMALL_REGISTER_CLASSES 1
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the H8/300, this is a two item struct, the first is the number of bytes
- scanned so far and the second is the rtx of the called library
- function if any. */
-
-#define CUMULATIVE_ARGS struct cum_arg
-struct cum_arg { int nbytes; struct rtx_def * libcall; };
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the H8/300, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM).nbytes = 0, (CUM).libcall = LIBNAME)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM).nbytes += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD \
- : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the H8/300 all normal args are pushed, unless -mquickcall in which
- case the first 3 arguments are passed in registers.
- See function `function_arg'. */
-
-struct rtx_def *function_arg();
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- function_arg (&CUM, MODE, TYPE, NAMED)
-
-/* Generate assembly output for the start of a function. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
- function_prologue (FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\t%s\t#LP%d,%s\n\tjsr @mcount\n", \
- h8_mov_op, (LABELNO), h8_reg_names[0]);
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-/* ??? @LPBX0 is moved into r0 twice. */
-
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\t%s\t%s\n\t%s\t@LPBX0,%s\n\tbne LPI%d\n\t%s\t@LPBX0,%s\n\t%s\t%s\n\tjsr\t@__bb_init_func\nLPI%d:\t%s\t%s\n", \
- h8_push_op, h8_reg_names[0], \
- h8_mov_op, h8_reg_names[0], \
- (LABELNO), \
- h8_mov_op, h8_reg_names[0], \
- h8_push_op, h8_reg_names[0], \
- (LABELNO), \
- h8_pop_op, h8_reg_names[0]);
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. This is a real pain in the
- sphincter on a VAX, since we do not want to change any of the bits in the
- processor status word. The way it is done here, it is pushed onto the stack
- before any flags have changed, and then the stack is fixed up to account for
- the fact that the instruction to restore the flags only reads a word.
- It may seem a bit clumsy, but at least it works. */
-/* ??? This one needs work. */
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
- fprintf (FILE, "\tmovpsl -(sp)\n\tmovw (sp),2(sp)\n\taddl2 $2,sp\n\taddl2 $1,LPBX2+%d\n\tbicpsw $255\n\tbispsw (sp)+\n", \
- 4 * BLOCKNO)
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 0
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
- function_epilogue (FILE, SIZE)
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- H8/300
- vvvv context
- 1 0000 7900xxxx mov.w #0x1234,r3
- 2 0004 5A00xxxx jmp @0x1234
- ^^^^ function
-
- H8/300H
- vvvvvvvv context
- 2 0000 7A00xxxxxxxx mov.l #0x12345678,er3
- 3 0006 5Axxxxxx jmp @0x123456
- ^^^^^^ function
-*/
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
- do { \
- if (TARGET_H8300) \
- { \
- fprintf (FILE, "\tmov.w #0x1234,r3\n"); \
- fprintf (FILE, "\tjmp @0x1234\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tmov.l #0x12345678,er3\n"); \
- fprintf (FILE, "\tjmp @0x123456\n"); \
- } \
- } while (0)
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE (TARGET_H8300 ? 8 : 12)
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- enum machine_mode mode = TARGET_H8300H || TARGET_H8300S? SImode : HImode; \
- emit_move_insn (gen_rtx (MEM, mode, plus_constant ((TRAMP), 2)), CXT); \
- emit_move_insn (gen_rtx (MEM, mode, plus_constant ((TRAMP), 6)), FNADDR); \
- if (TARGET_H8300H || TARGET_H8300S) \
- emit_move_insn (gen_rtx (MEM, QImode, plus_constant ((TRAMP), 6)), GEN_INT (0x5A)); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-#define HAVE_POST_INCREMENT
-/*#define HAVE_POST_DECREMENT */
-
-#define HAVE_PRE_DECREMENT
-/*#define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(regno) 0
-
-#define REGNO_OK_FOR_BASE_P(regno) \
- (((regno) < FIRST_PSEUDO_REGISTER && regno != 8) || reg_renumber[regno] >= 0)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 1
-
-/* 1 if X is an rtx for a constant that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || (GET_CODE (X) == CONST_INT \
- /* We handle signed and unsigned offsets here. */ \
- && INTVAL (X) > (TARGET_H8300 ? -0x10000 : -0x1000000) \
- && INTVAL (X) < (TARGET_H8300 ? 0x10000 : 0x1000000)) \
- || ((GET_CODE (X) == HIGH || GET_CODE (X) == CONST) \
- && TARGET_H8300))
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) (GET_CODE (X) != CONST_DOUBLE)
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) 0
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) 1
-#define REG_OK_FOR_INDEX_P_STRICT(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-#define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-#define STRICT 0
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-#define STRICT 1
-
-#endif
-
-/* Extra constraints - 'U' if for an operand valid for a bset
- destination; i.e. a register, register indirect, or the
- eightbit memory region (a SYMBOL_REF with an SYMBOL_REF_FLAG set).
-
- On the H8/S 'U' can also be a 16bit or 32bit absolute. */
-#define OK_FOR_U(OP) \
- ((GET_CODE (OP) == REG && REG_OK_FOR_BASE_P (OP)) \
- || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (OP, 0))) \
- || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
- && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (OP, 0)))) \
- || (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == CONST \
- && GET_CODE (XEXP (XEXP (OP, 0), 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 0)) == SYMBOL_REF \
- && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 1)) == CONST_INT) \
- && (TARGET_H8300S || SYMBOL_REF_FLAG (XEXP (XEXP (OP, 0), 0))))
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'U' ? OK_FOR_U (OP) : 0)
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
- except for CONSTANT_ADDRESS_P which is actually
- machine-independent.
-
- On the H8/300, a legitimate address has the form
- REG, REG+CONSTANT_ADDRESS or CONSTANT_ADDRESS. */
-
-/* Accept either REG or SUBREG where a register is valid. */
-
-#define RTX_OK_FOR_BASE_P(X) \
- ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \
- && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
- if (RTX_OK_FOR_BASE_P (X)) goto ADDR; \
- if (CONSTANT_ADDRESS_P (X)) goto ADDR; \
- if (GET_CODE (X) == PLUS \
- && CONSTANT_ADDRESS_P (XEXP (X, 1)) \
- && RTX_OK_FOR_BASE_P (XEXP (X, 0))) goto ADDR;
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the H8/300, don't do anything. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
-
- On the H8/300, the predecrement and postincrement address depend thus
- (the amount of decrement or increment being the length of the operand)
- and all indexed address depend thus (because the index scale factor
- is the length of the operand). */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL;
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE Pmode
-
-/* Define this if the case instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/*#define CASE_VECTOR_PC_RELATIVE*/
-
-/* Define this if the case instruction drops through after the table
- when the index is out of range. Don't define it if the case insn
- jumps to the default label instead. */
-#define CASE_DROPS_THROUGH
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0.
-
- On the H8/300, sign extension is expensive, so we'll say that chars
- are unsigned. */
-#define DEFAULT_SIGNED_CHAR 0
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX (TARGET_H8300H || TARGET_H8300S ? 4 : 2)
-#define MAX_MOVE_MAX 4
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS TARGET_SLOWBYTE
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode (TARGET_H8300H || TARGET_H8300S ? SImode : HImode)
-
-/* ANSI C types.
- We use longs for the 300h because ints can be 16 or 32.
- GCC requires SIZE_TYPE to be the same size as pointers. */
-#define NO_BUILTIN_SIZE_TYPE
-#define NO_BUILTIN_PTRDIFF_TYPE
-#define SIZE_TYPE (TARGET_H8300 ? "unsigned int" : "long unsigned int")
-#define PTRDIFF_TYPE (TARGET_H8300 ? "int" : "long int")
-
-#define WCHAR_TYPE "short unsigned int"
-#define WCHAR_TYPE_SIZE 16
-#define MAX_WCHAR_TYPE_SIZE 16
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
- is a valid machine specific attribute for DECL.
- The attributes in ATTRIBUTES have previously been assigned to DECL. */
-extern int h8300_valid_machine_decl_attribute ();
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-h8300_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-
-#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
- LENGTH += h8300_adjust_insn_length (INSN, LENGTH);
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- default: { int _zxy= const_costs(RTX, CODE); \
- if(_zxy) return _zxy; break;}
-
-#define BRANCH_COST 0
-
-/* We say that MOD and DIV are so cheap because otherwise we'll
- generate some really horrible code for division of a power of two. */
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. */
-/* ??? Shifts need to have a *much* higher cost than this. */
-
-#define RTX_COSTS(RTX,CODE,OUTER_CODE) \
- case MOD: \
- case DIV: \
- return 60; \
- case MULT: \
- return 20; \
- case ASHIFT: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- case ROTATE: \
- case ROTATERT: \
- if (GET_MODE (RTX) == HImode) return 2; \
- return 8;
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). No extra ones are needed for the vax. */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
-
-/* The mov,and,or,xor insns always set V to 0. */
-#define CC_OVERFLOW_0 0400
-/* The add insns don't set overflow in a usable way. */
-#define CC_OVERFLOW_UNUSABLE 01000
-/* The mov,and,or,xor insns don't set carry. That's ok though as the
- Z bit is all we need when doing unsigned comparisons on the result of
- these insns (since they're always with 0). However, conditions.h has
- CC_NO_OVERFLOW defined for this purpose. Rename it to something more
- understandable. */
-#define CC_NO_CARRY CC_NO_OVERFLOW
-/* ??? Use CC_Z_IN_NOT_C for bld insns? */
-
-/* Control the assembler format that we output. */
-
-#define ASM_IDENTIFY_GCC /* nothing */
-
-/* Output at beginning/end of assembler file. */
-
-#define ASM_FILE_START(FILE) asm_file_start(FILE)
-
-#define ASM_FILE_END(FILE) asm_file_end(FILE)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "; #APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "; #NO_APP\n"
-
-#define FILE_ASM_OP "\t.file\n"
-#define IDENT_ASM_OP "\t.ident\n"
-
-/* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H. */
-#define ASM_WORD_OP (TARGET_H8300 ? ".word" : ".long")
-
-/* We define a readonly data section solely to remove readonly data
- from the instruction stream. This can improve relaxing in two significant
- ways. First it's more likely that references to readonly data
- can be done with a 16bit absolute address since they'll be in low
- memory. Second, it's more likely that jsr instructions can be
- turned into bsr instructions since read-only data is not in the
- instruction stream. */
-#define READONLY_DATA_SECTION readonly_data
-
-#define TEXT_SECTION_ASM_OP "\t.section .text"
-#define DATA_SECTION_ASM_OP "\t.section .data"
-#define BSS_SECTION_ASM_OP "\t.section .bss"
-#define INIT_SECTION_ASM_OP "\t.section .init"
-#define CTORS_SECTION_ASM_OP "\t.section .ctors"
-#define DTORS_SECTION_ASM_OP "\t.section .dtors"
-#define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata"
-
-#define EXTRA_SECTIONS in_ctors, in_dtors, in_readonly_data
-
-#define EXTRA_SECTION_FUNCTIONS \
- \
-void \
-ctors_section() \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-} \
- \
-void \
-dtors_section() \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-} \
- \
-void \
-readonly_data() \
-{ \
- if (in_section != in_readonly_data) \
- { \
- fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP);\
- in_section = in_readonly_data; \
- } \
-}
-
-
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { ctors_section(); \
- fprintf(FILE, "\t%s\t_%s\n", ASM_WORD_OP, NAME); } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { dtors_section(); \
- fprintf(FILE, "\t%s\t_%s\n", ASM_WORD_OP, NAME); } while (0)
-
-#undef DO_GLOBAL_CTORS_BODY
-#define DO_GLOBAL_CTORS_BODY \
-{ \
- typedef (*pfunc)(); \
- extern pfunc __ctors[]; \
- extern pfunc __ctors_end[]; \
- pfunc *p; \
- for (p = __ctors_end; p > __ctors; ) \
- { \
- (*--p)(); \
- } \
-}
-
-#undef DO_GLOBAL_DTORS_BODY
-#define DO_GLOBAL_DTORS_BODY \
-{ \
- typedef (*pfunc)(); \
- extern pfunc __dtors[]; \
- extern pfunc __dtors_end[]; \
- pfunc *p; \
- for (p = __dtors; p < __dtors_end; p++) \
- { \
- (*p)(); \
- } \
-}
-
-#define TINY_DATA_NAME_P(NAME) (*(NAME) == '*')
-
-/* If we are referencing a function that is supposed to be called
- through the function vector, the SYMBOL_REF_FLAG in the rtl
- so the call patterns can generate the correct code. */
-#define ENCODE_SECTION_INFO(DECL) \
- if (TREE_CODE (DECL) == FUNCTION_DECL \
- && h8300_funcvec_function_p (DECL)) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
- else if ((TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \
- && TREE_CODE (DECL) == VAR_DECL \
- && h8300_eightbit_data_p (DECL)) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
- else if ((TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \
- && TREE_CODE (DECL) == VAR_DECL \
- && h8300_tiny_data_p (DECL)) \
- h8300_encode_label (DECL);
-
-/* Store the user-specified part of SYMBOL_NAME in VAR.
- This is sort of inverse to ENCODE_SECTION_INFO. */
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
- (VAR) = (SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' || (SYMBOL_NAME)[0] == '@');
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "mac", "ap"}
-
-#define ADDITIONAL_REGISTER_NAMES { { "r7", 7 } }
-
-/* How to renumber registers for dbx and gdb.
- H8/300 needs no change in the numeration. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-#define SDB_DEBUGGING_INFO
-#define SDB_DELIM "\n"
-
-/* Support -gstabs. */
-
-#include "dbxcoff.h"
-
-/* Override definition in dbxcoff.h. */
-/* Generate a blank trailing N_SO to mark the end of the .o file, since
- we can't depend upon the linker to mark .o file boundaries with
- embedded stabs. */
-
-#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
- fprintf (FILE, \
- "\t.text\n.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO)
-
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- fprintf (FILE, "\t.section %s\n", NAME)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE, NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE, NAME) \
- do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- ASM_OUTPUT_LABEL(FILE, NAME)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
- sprintf (LABEL, "*.%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant.
- It is .dfloat or .gfloat, depending. */
-
-#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
-do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.double %s\n", dstr); \
- } while (0)
-
-
-/* This is how to output an assembler line defining a `float' constant. */
-#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
-do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.float %s\n", dstr); \
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE, VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE, VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE, VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-#define ASM_OUTPUT_BYTE(FILE, VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
- fprintf (FILE, "\t%s\t%s\n", h8_push_op, h8_reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\t%s\t%s\n", h8_pop_op, h8_reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- asm_fprintf (FILE, "\t%s .L%d\n", ASM_WORD_OP, VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t%s .L%d-.L%d\n", ASM_WORD_OP, VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", (LOG))
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf(FILE, "%s\t \"%s\"\n", IDENT_ASM_OP, NAME)
-
-#define ASM_OUTPUT_SKIP(FILE, SIZE) \
- fprintf (FILE, "\t.space %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* This says how to output the assembler to define a global
- uninitialized but not common symbol.
- Try to use asm_output_bss to implement this macro. */
-
-#define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
- asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
-( fputs ("\t.lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print an instruction operand X on file FILE.
- look in h8300.c for details */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '#')
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE,X,CODE)
-
-/* Print a memory operand whose address is X, on file FILE.
- This uses a function in output-vax.c. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
-/* Define this macro if you want to implement any pragmas. If defined, it
- should be a C expression to be executed when #pragma is seen. The
- argument STREAM is the stdio input stream from which the source
- text can be read. CH is the first character after the #pragma. The
- result of the expression is the terminating character found
- (newline or EOF). */
-#define HANDLE_PRAGMA(FILE, NODE) handle_pragma (FILE, NODE)
-
-#define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
-
-/* Define this macro if GNU CC should generate calls to the System V
- (and ANSI C) library functions `memcpy' and `memset' rather than
- the BSD functions `bcopy' and `bzero'. */
-
-#define TARGET_MEM_FUNCTIONS 1
-
-#define MULHI3_LIBCALL "__mulhi3"
-#define DIVHI3_LIBCALL "__divhi3"
-#define UDIVHI3_LIBCALL "__udivhi3"
-#define MODHI3_LIBCALL "__modhi3"
-#define UMODHI3_LIBCALL "__umodhi3"
-
-/* Perform target dependent optabs initialization. */
-
-#define INIT_TARGET_OPTABS \
- do { \
- smul_optab->handlers[(int) HImode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, MULHI3_LIBCALL); \
- sdiv_optab->handlers[(int) HImode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, DIVHI3_LIBCALL); \
- udiv_optab->handlers[(int) HImode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, UDIVHI3_LIBCALL); \
- smod_optab->handlers[(int) HImode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, MODHI3_LIBCALL); \
- umod_optab->handlers[(int) HImode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, UMODHI3_LIBCALL); \
- } while (0)
-
-#define MOVE_RATIO 3
-
-/* Declarations for functions used in insn-output.c. */
-char *emit_a_shift ();
-int h8300_funcvec_function_p ();
-char *output_adds_subs ();
-char * output_simode_bld ();
-
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
deleted file mode 100644
index a5838280033..00000000000
--- a/gcc/config/h8300/h8300.md
+++ /dev/null
@@ -1,2300 +0,0 @@
-;; GCC machine description for Hitachi H8/300
-;; Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
-
-;; Contributed by Steve Chamberlain (sac@cygnus.com),
-;; Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.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 original PO technology requires these to be ordered by speed,
-;; so that assigner will pick the fastest.
-
-;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-(define_attr "cpu" "h8300,h8300h"
- (const (symbol_ref "cpu_type")))
-
-;; Many logical operations should have "bit" variants if only one
-;; bit is going to be operated on.
-
-;; (and (logical op) (const_int X))
-;; If const_int only specifies a few bits (like a single byte in a 4 byte
-;; operation, then it's more efficient to only apply the and and logical_op
-;; to the bits we care about.
-
-;; Some of the extend instructions accept a general_operand_src, which
-;; allows all the normal memory addressing modes. The length computations
-;; don't take this into account. The lengths in the MD file should be
-;; "worst case" and then be adjusted to their correct values by
-;; h8300_adjust_insn_length.
-
-;; On the h8300h, adds/subs operate on the 32bit "er" registers. Right
-;; now GCC doesn't expose the "e" half to the compiler, so using add/subs
-;; for addhi and subhi is safe.
-;; Long term, we want to expose the "e" half to the compiler (gives us
-;; 8 more 16bit registers). At that point addhi and subhi can't use adds/subs.
-
-;; There's currently no way to have a insv/extzv expander for the h8/300h
-;; because word_mode is different for the h8/300 and h8/300h.
-
-;; Shifts/rotates by small constants should be handled by special
-;; patterns so we get the length and cc status correct.
-
-;; Bitfield operations no longer accept memory operands. We need
-;; to add variants which operate on memory back to the MD.
-
-;; ??? Implement remaining bit ops available on the h8300
-
-(define_attr "type" "branch,arith"
- (const_string "arith"))
-
-;; The size of instructions in bytes.
-
-(define_attr "length" ""
- (cond [(eq_attr "type" "branch")
- (if_then_else (and (ge (minus (pc) (match_dup 0))
- (const_int -120))
- (le (minus (pc) (match_dup 0))
- (const_int 120)))
- (const_int 2)
- (if_then_else (and (eq_attr "cpu" "h8300h")
- (and (ge (minus (pc) (match_dup 0))
- (const_int -32000))
- (le (minus (pc) (match_dup 0))
- (const_int 32000))))
- (const_int 4)
- (const_int 6)))]
- (const_int 200)))
-
-;; Condition code settings.
-;; none - insn does not affect cc
-;; none_0hit - insn does not affect cc but it does modify operand 0
-;; This attribute is used to keep track of when operand 0 changes.
-;; See the description of NOTICE_UPDATE_CC for more info.
-;; set - insn sets flags z,n,v. c are set to 0.
-;; (c may not really be set to 0 but that's ok, we don't need it anyway).
-;; set_zn_c0 - insn sets z,n to usable values. v is unknown. c may or may not
-;; be known (if it isn't that's ok, we don't need it anyway).
-;; compare - compare instruction
-;; clobber - value of cc is unknown
-(define_attr "cc" "none,none_0hit,set,set_zn_c0,compare,clobber"
- (const_string "clobber"))
-
-;; ----------------------------------------------------------------------
-;; MOVE INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-;; movqi
-
-(define_insn "movqi_push"
- [(set (match_operand:QI 0 "push_operand" "=<")
- (match_operand:QI 1 "register_operand" "r"))]
- ""
- "*
-{
- if (TARGET_H8300)
- return \"push.w %T1\";
- else
- return \"push.l %S1\";
-}"
- [(set (attr "length") (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4)))
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand_dst" "=r,r,<,r,r,m")
- (match_operand:QI 1 "general_operand_src" "I,r>,r,n,m,r"))]
- "register_operand (operands[0],QImode)
- || register_operand (operands[1], QImode)"
- "@
- sub.b %X0,%X0
- mov.b %R1,%X0
- mov.b %X1,%R0
- mov.b %R1,%X0
- mov.b %R1,%X0
- mov.b %X1,%R0"
- [(set_attr_alternative "length"
- [(const_int 2) (const_int 2) (const_int 2) (const_int 2)
- (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))
- (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))])
- (set_attr "cc" "set,set_zn_c0,set_zn_c0,set_zn_c0,set_zn_c0,set_zn_c0")])
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand_dst" "")
- (match_operand:QI 1 "general_operand_src" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register */
- if (!register_operand(operand0, QImode)
- && !register_operand(operand1, QImode))
- {
- operands[1] = copy_to_mode_reg(QImode, operand1);
- }
-}")
-
-(define_insn "movstrictqi"
- [(set (strict_low_part (match_operand:QI 0 "general_operand_dst" "=r,r,r,r"))
- (match_operand:QI 1 "general_operand_src" "I,r,n,m"))]
- ""
- "@
- sub.b %X0,%X0
- mov.b %X1,%X0
- mov.b %R1,%X0
- mov.b %R1,%X0"
- [(set_attr_alternative "length"
- [(const_int 2) (const_int 2) (const_int 2)
- (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))])
- (set_attr "cc" "set,set_zn_c0,set_zn_c0,set_zn_c0")])
-
-;; movhi
-
-;; ??? We use push.l on the h8300h to push a 16bit value?!? We have
-;; 16bit push insns!
-(define_insn "movhi_push"
- [(set (match_operand:HI 0 "push_operand" "=<")
- (match_operand:HI 1 "register_operand" "r"))]
- ""
- "*
-{
- if (TARGET_H8300)
- return \"push.w %T1\";
- else
- return \"push.l %S1\";
-}"
- [(set (attr "length") (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4)))
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand_dst" "=r,r,<,r,r,m")
- (match_operand:HI 1 "general_operand_src" "I,r>,r,i,m,r"))]
- "register_operand (operands[0],HImode)
- || register_operand (operands[1], HImode)"
- "@
- sub.w %T0,%T0
- mov.w %T1,%T0
- mov.w %T1,%T0
- mov.w %T1,%T0
- mov.w %T1,%T0
- mov.w %T1,%T0"
- [(set_attr_alternative "length"
- [(const_int 2) (const_int 2) (const_int 2) (const_int 4)
- (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))
- (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))])
- (set_attr "cc" "set,set_zn_c0,set_zn_c0,set_zn_c0,set_zn_c0,set_zn_c0")])
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand_dst" "")
- (match_operand:HI 1 "general_operand_src" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register */
- if (!register_operand(operand1, HImode)
- && !register_operand(operand0, HImode))
- {
- operands[1] = copy_to_mode_reg(HImode, operand1);
- }
-}")
-
-(define_insn "movstricthi"
- [(set (strict_low_part (match_operand:HI 0 "general_operand_dst" "=r,r,r,r"))
- (match_operand:HI 1 "general_operand_src" "I,r,i,m"))]
- ""
- "@
- sub.w %T0,%T0
- mov.w %T1,%T0
- mov.w %T1,%T0
- mov.w %T1,%T0"
- [(set_attr_alternative "length"
- [(const_int 2) (const_int 2) (const_int 4)
- (if_then_else (eq_attr "cpu" "h8300") (const_int 4) (const_int 8))])
- (set_attr "cc" "set,set_zn_c0,set_zn_c0,set_zn_c0")])
-
-;; movsi
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand_dst" "")
- (match_operand:SI 1 "general_operand_src" ""))]
- ""
- "
-{
- if (TARGET_H8300)
- {
- if (do_movsi (operands))
- DONE;
- }
- else
- {
- /* One of the ops has to be in a register. */
- if (!register_operand (operand1, SImode)
- && !register_operand (operand0, SImode))
- {
- operands[1] = copy_to_mode_reg (SImode, operand1);
- }
- }
-}")
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand_dst" "")
- (match_operand:SF 1 "general_operand_src" ""))]
- ""
- "
-{
- if (TARGET_H8300)
- {
- if (do_movsi (operands))
- DONE;
- }
- else
- {
- /* One of the ops has to be in a register. */
- if (!register_operand (operand1, SFmode)
- && !register_operand (operand0, SFmode))
- {
- operands[1] = copy_to_mode_reg (SFmode, operand1);
- }
- }
-}")
-
-(define_insn "movsi_h8300"
- [(set (match_operand:SI 0 "general_operand_dst" "=r,r,r,o,<,r")
- (match_operand:SI 1 "general_operand_src" "I,r,io,r,r,>"))]
- "TARGET_H8300
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode))"
- "*
-{
- int rn = -1;
- switch (which_alternative)
- {
- case 0:
- return \"sub.w %e0,%e0\;sub.w %f0,%f0\";
- case 1:
- if (REGNO(operands[0]) < REGNO(operands[1]))
- return \"mov.w %e1,%e0\;mov.w %f1,%f0\";
- else
- return \"mov.w %f1,%f0\;mov.w %e1,%e0\";
- case 2:
- /* Make sure we don't trample the register we index with. */
-
- if (GET_CODE(operands[1]) == MEM)
- {
- rtx inside = XEXP (operands[1],0);
- if (REG_P (inside))
- {
- rn = REGNO(inside);
- }
- else if (GET_CODE (inside) == PLUS)
- {
- rtx lhs = XEXP (inside,0);
- rtx rhs = XEXP (inside,1);
- if (REG_P (lhs)) rn = REGNO (lhs);
- if (REG_P (rhs)) rn = REGNO (rhs);
- }
- }
- if (rn == REGNO (operands[0]))
- {
- /* Move the second word first. */
- return \"mov.w %f1,%f0\;mov.w %e1,%e0\";
- }
- else
- {
- /* See if either half is zero. If so, use sub.w to clear
- that half. */
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if ((INTVAL (operands[1]) & 0xffff) == 0)
- return \"mov.w %e1,%e0\;sub.w %f0,%f0\";
- if (((INTVAL (operands[1]) >> 16) & 0xffff) == 0)
- return \"sub.w %e0,%e0\;mov.w %f1,%f0\";
- }
- return \"mov.w %e1,%e0\;mov.w %f1,%f0\";
- }
- case 3:
- return \"mov.w %e1,%e0\;mov.w %f1,%f0\";
- case 4:
- return \"mov.w %f1,%T0\;mov.w %e1,%T0\";
- case 5:
- return \"mov.w %T1,%e0\;mov.w %T1,%f0\";
- }
-}"
- [(set_attr "length" "4,4,8,8,4,4")
- (set_attr "cc" "clobber")])
-
-(define_insn "movsf_h8300"
- [(set (match_operand:SF 0 "general_operand_dst" "=r,r,r,o,<,r")
- (match_operand:SF 1 "general_operand_src" "I,r,io,r,r,>"))]
- "TARGET_H8300
- && (register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode))"
- "*
-{
- /* Copy of the movsi stuff */
- int rn = -1;
- switch (which_alternative)
- {
- case 0:
- return \"sub.w %e0,%e0\;sub.w %f0,%f0\";
- case 1:
- if (REGNO(operands[0]) < REGNO(operands[1]))
- return \"mov.w %e1,%e0\;mov.w %f1,%f0\";
- else
- return \"mov.w %f1,%f0\;mov.w %e1,%e0\";
- case 2:
- /* Make sure we don't trample the register we index with. */
-
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx inside = XEXP (operands[1],0);
- if (REG_P (inside))
- {
- rn = REGNO (inside);
- }
- else if (GET_CODE (inside) == PLUS)
- {
- rtx lhs = XEXP (inside,0);
- rtx rhs = XEXP (inside,1);
- if (REG_P (lhs)) rn = REGNO (lhs);
- if (REG_P (rhs)) rn = REGNO (rhs);
- }
- }
- if (rn == REGNO (operands[0]))
- {
- /* move the second word first */
- return \"mov.w %f1,%f0\;mov.w %e1,%e0\";
- }
- else
- {
- return \"mov.w %e1,%e0\;mov.w %f1,%f0\";
- }
-
- case 3:
- return \"mov.w %e1,%e0\;mov.w %f1,%f0\";
- case 4:
- return \"mov.w %f1,%T0\;mov.w %e1,%T0\";
- case 5:
- return \"mov.w %T1,%e0\;mov.w %T1,%f0\";
-
- }
-}"
- [(set_attr "length" "4,4,8,8,4,4")
- (set_attr "cc" "clobber")])
-
-(define_insn "movsi_h8300hs"
- [(set (match_operand:SI 0 "general_operand_dst" "=r,r,r,m,<,r,*a,*a,r")
- (match_operand:SI 1 "general_operand_src" "I,r,im,r,r,>,I,r,*a"))]
- "(TARGET_H8300S || TARGET_H8300H)
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode))"
- "*
-{
- if (which_alternative == 0)
- return \"sub.l %S0,%S0\";
- if (which_alternative == 6)
- return \"clrmac\";
- if (which_alternative == 7)
- return \"clrmac\;ldmac %1,macl\";
- if (which_alternative == 8)
- return \"stmac macl,%0\";
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- int val = INTVAL (operands[1]);
-
- /* Look for constants which can be made by adding an 8-bit
- number to zero in one of the two low bytes. */
- if (val == (val & 0xff))
- {
- operands[1] = GEN_INT ((char)val & 0xff);
- return \"sub.l %S0,%S0\;add.b %1,%w0\";
- }
-
- if (val == (val & 0xff00))
- {
- operands[1] = GEN_INT ((char)(val >> 8) & 0xff);
- return \"sub.l %S0,%S0\;add.b %1,%x0\";
- }
-
- /* Now look for small negative numbers. We can subtract them
- from zero to get the desired constant. */
- if (val == -4 || val == -2 || val == -1)
- {
- operands[1] = GEN_INT (-INTVAL (operands[1]));
- return \"sub.l %S0,%S0\;subs %1,%S0\";
- }
- }
- return \"mov.l %S1,%S0\";
-}"
- [(set_attr "length" "2,2,10,10,4,4,2,6,4")
- (set_attr "cc" "set,set_zn_c0,set_zn_c0,set_zn_c0,set_zn_c0,set_zn_c0,none_0hit,none_0hit,set_zn_c0")])
-
-(define_insn "movsf_h8300h"
- [(set (match_operand:SF 0 "general_operand_dst" "=r,r,r,m,<,r")
- (match_operand:SF 1 "general_operand_src" "I,r,im,r,r,>"))]
- "(TARGET_H8300H || TARGET_H8300S)
- && (register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode))"
- "@
- sub.l %S0,%S0
- mov.l %S1,%S0
- mov.l %S1,%S0
- mov.l %S1,%S0
- mov.l %S1,%S0
- mov.l %S1,%S0"
- [(set_attr "length" "2,2,10,10,4,4")
- (set_attr "cc" "set,set_zn_c0,set_zn_c0,set_zn_c0,set_zn_c0,set_zn_c0")])
-
-;; ----------------------------------------------------------------------
-;; TEST INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn ""
- [(set (cc0) (zero_extract:QI (match_operand:QI 0 "bit_memory_operand" "rU")
- (const_int 1)
- (match_operand:QI 1 "const_int_operand" "n")))]
- ""
- "btst %Z1,%R0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (cc0) (zero_extract:HI (match_operand:QI 0 "bit_memory_operand" "rU")
- (const_int 1)
- (match_operand:QI 1 "const_int_operand" "n")))]
- ""
- "btst %Z1,%Y0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (cc0) (zero_extract:SI (match_operand:QI 0 "bit_memory_operand" "rU")
- (const_int 1)
- (match_operand:QI 1 "const_int_operand" "n")))]
- ""
- "btst %Z1,%Y0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (cc0) (zero_extract:QI (match_operand:HI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:HI 1 "const_int_operand" "n")))]
- ""
- "btst %Z1,%R0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (cc0) (zero_extract:HI (match_operand:HI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:HI 1 "const_int_operand" "n")))]
- ""
- "btst %Z1,%Y0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (cc0) (zero_extract:SI (match_operand:HI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:HI 1 "const_int_operand" "n")))]
- ""
- "btst %Z1,%Y0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn "tstqi"
- [(set (cc0) (match_operand:QI 0 "register_operand" "r"))]
- ""
- "mov.b %X0,%X0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn "tsthi"
- [(set (cc0) (match_operand:HI 0 "register_operand" "r"))]
- ""
- "mov.w %T0,%T0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn "tstsi"
- [(set (cc0) (match_operand:SI 0 "register_operand" "r"))]
- "TARGET_H8300H || TARGET_H8300S"
- "mov.l %S0,%S0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn "cmpqi"
- [(set (cc0)
- (compare:QI (match_operand:QI 0 "register_operand" "r")
- (match_operand:QI 1 "nonmemory_operand" "rn")))]
- ""
- "cmp.b %X1,%X0"
- [(set_attr "length" "2")
- (set_attr "cc" "compare")])
-
-(define_expand "cmphi"
- [(set (cc0)
- (compare:HI (match_operand:HI 0 "register_operand" "")
- (match_operand:HI 1 "nonmemory_operand" "")))]
- ""
- "
-{
- /* Force operand1 into a register if we're compiling
- for the h8/300. */
- if (GET_CODE (operands[1]) != REG && TARGET_H8300)
- operands[1] = force_reg (HImode, operands[1]);
-}")
-
-(define_insn ""
- [(set (cc0)
- (compare:HI (match_operand:HI 0 "register_operand" "r")
- (match_operand:HI 1 "register_operand" "r")))]
- "TARGET_H8300"
- "cmp.w %T1,%T0"
- [(set_attr "length" "2")
- (set_attr "cc" "compare")])
-
-(define_insn ""
- [(set (cc0)
- (compare:HI (match_operand:HI 0 "register_operand" "r,r")
- (match_operand:HI 1 "nonmemory_operand" "r,n")))]
- "TARGET_H8300H || TARGET_H8300S"
- "cmp.w %T1,%T0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "compare,compare")])
-
-(define_insn "cmpsi"
- [(set (cc0)
- (compare:SI (match_operand:SI 0 "register_operand" "r,r")
- (match_operand:SI 1 "nonmemory_operand" "r,i")))]
- "TARGET_H8300H || TARGET_H8300S"
- "cmp.l %S1,%S0"
- [(set_attr "length" "2,6")
- (set_attr "cc" "compare,compare")])
-
-;; ----------------------------------------------------------------------
-;; ADD INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (plus:QI (match_operand:QI 1 "register_operand" "%0")
- (match_operand:QI 2 "nonmemory_operand" "rn")))]
- ""
- "add.b %X2,%X0"
- [(set_attr "length" "2")
- (set_attr "cc" "set")])
-
-(define_expand "addhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (plus:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:HI 2 "nonmemory_operand" "")))]
- ""
- "")
-
-;; Specialized version using adds/subs. This must come before
-;; the more general patterns below.
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (plus:HI (match_operand:HI 1 "register_operand" "%0")
- (match_operand:HI 2 "adds_subs_operand" "n")))]
- ""
- "* return output_adds_subs (operands);"
- [(set_attr "cc" "none_0hit")
- (set (attr "length")
- (if_then_else (ne (match_operand:HI 2 "one_insn_adds_subs_operand" "")
- (const_int 0))
- (const_int 2)
- (const_int 4)))])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=&r,r,&r")
- (plus:HI (match_operand:HI 1 "register_operand" "%0,0,g")
- (match_operand:HI 2 "nonmemory_operand" "n,r,r")))]
- "TARGET_H8300"
- "@
- add.b %s2,%s0\;addx %t2,%t0
- add.w %T2,%T0
- mov.w %T1,%T0\;add.w %T2,%T0"
- [(set_attr "length" "4,2,6")
- (set_attr "cc" "clobber,set,set")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (plus:HI (match_operand:HI 1 "register_operand" "%0,0")
- (match_operand:HI 2 "nonmemory_operand" "n,r")))]
- "TARGET_H8300H || TARGET_H8300S"
- "@
- add.w %T2,%T0
- add.w %T2,%T0"
- [(set_attr "length" "4,2")
- (set_attr "cc" "set,set")])
-
-(define_expand "addsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "")
-
-;; Specialized version using adds/subs. This must come before
-;; the more general patterns below.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "adds_subs_operand" "n")))]
- "TARGET_H8300H || TARGET_H8300S"
- "* return output_adds_subs (operands);"
- [(set_attr "cc" "none_0hit")
- (set (attr "length")
- (if_then_else (ne (match_operand:HI 2 "one_insn_adds_subs_operand" "")
- (const_int 0))
- (const_int 2)
- (const_int 4)))])
-
-(define_insn "addsi_h8300"
- [(set (match_operand:SI 0 "register_operand" "=r,r,&r")
- (plus:SI (match_operand:SI 1 "register_operand" "%0,0,r")
- (match_operand:SI 2 "nonmemory_operand" "n,r,r")))]
- "TARGET_H8300"
- "@
- add %w2,%w0\;addx %x2,%x0\;addx %y2,%y0\;addx %z2,%z0
- add.w %f2,%f0\;addx %y2,%y0\;addx %z2,%z0
- mov.w %f1,%f0\;mov.w %e1,%e0\;add.w %f2,%f0\;addx %y2,%y0\;addx %z2,%z0"
- [(set_attr "length" "8,6,10")
- (set_attr "cc" "clobber")])
-
-(define_insn "addsi_h8300h"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (plus:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "i,r")))]
- "TARGET_H8300H || TARGET_H8300S"
- "@
- add.l %S2,%S0
- add.l %S2,%S0"
- [(set_attr "length" "6,2")
- (set_attr "cc" "set,set")])
-
-;; ----------------------------------------------------------------------
-;; SUBTRACT INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "register_operand" "=r,r")
- (minus:QI (match_operand:QI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "r,n")))]
- ""
- "@
- sub.b %X2,%X0
- add.b %G2,%X0"
- [(set_attr "length" "2")
- (set_attr "cc" "set")])
-
-(define_expand "subhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (minus:HI (match_operand:HI 1 "general_operand" "")
- (match_operand:HI 2 "nonmemory_operand" "")))]
- ""
- "")
-
-;; Specialized version using adds/subs. This must come before
-;; the more general patterns below. This may not be needed
-;; due to instruction canonicalization.
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (minus:HI (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "adds_subs_operand" "n")))]
- ""
- "*
-{
- operands[2] = GEN_INT (-INTVAL (operands[2]));
- return output_adds_subs (operands);
-}"
- [(set_attr "cc" "none_0hit")
- (set (attr "length")
- (if_then_else (ne (match_operand:HI 2 "one_insn_adds_subs_operand" "")
- (const_int 0))
- (const_int 2)
- (const_int 4)))])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,&r")
- (minus:HI (match_operand:HI 1 "general_operand" "0,0")
- (match_operand:HI 2 "nonmemory_operand" "r,n")))]
- "TARGET_H8300"
- "@
- sub.w %T2,%T0
- add.b %E2,%s0\;addx %F2,%t0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "set,clobber")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,&r")
- (minus:HI (match_operand:HI 1 "general_operand" "0,0")
- (match_operand:HI 2 "nonmemory_operand" "r,n")))]
- "TARGET_H8300H || TARGET_H8300S"
- "@
- sub.w %T2,%T0
- sub.w %T2,%T0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "set,set")])
-
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (minus:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "")
-
-(define_insn "subsi3_h8300"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "register_operand" "r")))]
- "TARGET_H8300"
- "sub.w %f2,%f0\;subx %y2,%y0\;subx %z2,%z0"
- [(set_attr "length" "6")
- (set_attr "cc" "clobber")])
-
-;; Specialized version using adds/subs. This must come before
-;; the more general patterns below. This may not be needed
-;; due to instruction canonicalization.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "adds_subs_operand" "n")))]
- "TARGET_H8300H || TARGET_H8300S"
- "*
-{
- operands[2] = GEN_INT (-INTVAL (operands[2]));
- return output_adds_subs (operands);
-}"
- [(set_attr "cc" "none_0hit")
- (set (attr "length")
- (if_then_else (ne (match_operand:HI 2 "one_insn_adds_subs_operand" "")
- (const_int 0))
- (const_int 2)
- (const_int 4)))])
-
-(define_insn "subsi3_h8300h"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (minus:SI (match_operand:SI 1 "general_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "r,i")))]
- "TARGET_H8300H || TARGET_H8300S"
- "@
- sub.l %S2,%S0
- sub.l %S2,%S0"
- [(set_attr "length" "2,6")
- (set_attr "cc" "set,set")])
-
-;; ----------------------------------------------------------------------
-;; MULTIPLY INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-;; Note that the h8/300 can only handle umulqihi3.
-
-(define_insn "mulqihi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (mult:HI (sign_extend:HI (match_operand:QI 1 "general_operand" "%0"))
- (sign_extend:HI (match_operand:QI 2 "register_operand" "r"))))]
- "TARGET_H8300H || TARGET_H8300S"
- "mulxs.b %X2,%T0"
- [(set_attr "length" "4")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn "mulhisi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mult:SI (sign_extend:SI (match_operand:HI 1 "general_operand" "%0"))
- (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
- "TARGET_H8300H || TARGET_H8300S"
- "mulxs.w %T2,%S0"
- [(set_attr "length" "4")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn "umulqihi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (mult:HI (zero_extend:HI (match_operand:QI 1 "general_operand" "%0"))
- (zero_extend:HI (match_operand:QI 2 "register_operand" "r"))))]
- ""
- "mulxu %X2,%T0"
- [(set_attr "length" "2")
- (set_attr "cc" "none_0hit")])
-
-(define_insn "umulhisi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mult:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "%0"))
- (zero_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
- "TARGET_H8300H || TARGET_H8300S"
- "mulxu.w %T2,%S0"
- [(set_attr "length" "2")
- (set_attr "cc" "none_0hit")])
-
-;; This is a "bridge" instruction. Combine can't cram enough insns
-;; together to crate a MAC instruction directly, but it can create
-;; this instruction, which then allows combine to create the real
-;; MAC insn.
-;;
-;; Unfortunately, if combine doesn't create a MAC instruction, this
-;; insn must generate reasonably correct code. Egad.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=a")
- (mult:SI
- (sign_extend:SI
- (mem:HI (post_inc:SI (match_operand:SI 1 "register_operand" "r"))))
- (sign_extend:SI
- (mem:HI (post_inc:SI (match_operand:SI 2 "register_operand" "r"))))))]
- "TARGET_H8300S"
- "clrmac\;mac %2,%1"
- [(set_attr "length" "6")
- (set_attr "cc" "none_0hit")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=a")
- (plus (mult:SI
- (sign_extend:SI (mem:HI
- (post_inc:SI (match_operand:SI 1 "register_operand" "r"))))
- (sign_extend:SI (mem:HI
- (post_inc:SI (match_operand:SI 2 "register_operand" "r")))))
- (match_operand:SI 3 "register_operand" "0")))]
- "TARGET_H8300S"
- "mac %2,%1"
- [(set_attr "length" "4")
- (set_attr "cc" "none_0hit")])
-
-;; ----------------------------------------------------------------------
-;; DIVIDE INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "udivqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (truncate:QI
- (udiv:HI
- (match_operand:HI 1 "general_operand" "0")
- (zero_extend:HI (match_operand:QI 2 "register_operand" "r")))))]
- ""
- "divxu %X2,%T0"
- [(set_attr "length" "2")
- (set_attr "cc" "clobber")])
-
-;; ??? Will divxu always work here?
-
-(define_insn "divqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (truncate:QI
- (div:HI
- (match_operand:HI 1 "general_operand" "0")
- (sign_extend:HI (match_operand:QI 2 "register_operand" "r")))))]
- ""
- "divxu %X2,%T0"
- [(set_attr "length" "2")
- (set_attr "cc" "clobber")])
-
-(define_insn "udivhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (truncate:HI
- (udiv:SI
- (match_operand:SI 1 "general_operand" "0")
- (zero_extend:SI (match_operand:HI 2 "register_operand" "r")))))]
- "TARGET_H8300H || TARGET_H8300S"
- "divxu.w %T2,%S0"
- [(set_attr "length" "2")
- (set_attr "cc" "clobber")])
-
-(define_insn "divhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (truncate:HI
- (div:SI
- (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "register_operand" "r")))))]
- "TARGET_H8300H || TARGET_H8300S"
- "divxs.w %T2,%S0"
- [(set_attr "length" "4")
- (set_attr "cc" "clobber")])
-
-;; ----------------------------------------------------------------------
-;; MOD INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "umodqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (truncate:QI
- (umod:HI
- (match_operand:HI 1 "general_operand" "0")
- (zero_extend:HI (match_operand:QI 2 "register_operand" "r")))))]
- ""
- "divxu %X2,%T0\;mov %t0,%s0"
- [(set_attr "length" "4")
- (set_attr "cc" "clobber")])
-
-(define_insn "modqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (truncate:QI
- (mod:HI
- (match_operand:HI 1 "general_operand" "0")
- (sign_extend:HI (match_operand:QI 2 "register_operand" "r")))))]
- "TARGET_H8300H || TARGET_H8300S"
- "divxs.b %X2,%T0\;mov %t0,%s0"
- [(set_attr "length" "6")
- (set_attr "cc" "clobber")])
-
-(define_insn "umodhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (truncate:HI
- (umod:SI
- (match_operand:SI 1 "general_operand" "0")
- (zero_extend:SI (match_operand:HI 2 "register_operand" "r")))))]
- "TARGET_H8300H || TARGET_H8300S"
- "divxu.w %T2,%S0\;mov %e0,%f0"
- [(set_attr "length" "4")
- (set_attr "cc" "clobber")])
-
-(define_insn "modhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (truncate:HI
- (mod:SI
- (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI (match_operand:HI 2 "register_operand" "r")))))]
- "TARGET_H8300H || TARGET_H8300S"
- "divxs.w %T2,%S0\;mov %e0,%f0"
- [(set_attr "length" "6")
- (set_attr "cc" "clobber")])
-
-;; ----------------------------------------------------------------------
-;; AND INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn ""
- [(set (match_operand:QI 0 "bit_operand" "=r,U")
- (and:QI (match_operand:QI 1 "bit_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "rn,O")))]
- "register_operand (operands[0], QImode) || o_operand (operands[2], QImode)"
- "@
- and %X2,%X0
- bclr %W2,%R0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "set_zn_c0,none_0hit")])
-
-(define_expand "andqi3"
- [(set (match_operand:QI 0 "bit_operand" "")
- (and:QI (match_operand:QI 1 "bit_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (fix_bit_operand (operands, 'O', AND))
- DONE;
-}")
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (and:HI (match_operand:HI 1 "register_operand" "%0")
- (match_operand:HI 2 "nonmemory_operand" "rn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
-
- if ((i & 0x00ff) != 0x00ff)
- output_asm_insn (\"and %s2,%s0\", operands);
- if ((i & 0xff00) != 0xff00)
- output_asm_insn (\"and %t2,%t0\", operands);
- return \"\";
- }
- if (TARGET_H8300H || TARGET_H8300S)
- return \"and.w %T2,%T0\";
- return \"and %s2,%s0\;and %t2,%t0;\";
-}"
- [(set_attr "length" "4")
- (set_attr "cc" "clobber")])
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "nonmemory_operand" "rn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
- int upper_cleared, lower_cleared;
-
- /* The h8300h can't do byte-wise operations on the
- upper 16bits of 32bit registers. However, if
- those bits aren't going to change, or they're
- going to be zero'd out, then we can work on the
- low-order bits. */
- if ((TARGET_H8300H || TARGET_H8300S)
- && ((i & 0xffff0000) != 0xffff0000
- || (i & 0xffff0000) == 0x00000000))
- return \"and.l %S2,%S0\";
-
- lower_cleared = 0;
- if ((i & 0x0000ffff) == 0x00000000)
- {
- output_asm_insn (\"sub.w %f0,%f0\", operands);
- lower_cleared = 1;
- }
-
- upper_cleared = 0;
- if ((i & 0xffff0000) == 0x00000000)
- {
- output_asm_insn (\"sub.w %e0,%e0\", operands);
- upper_cleared = 1;
- }
-
- if ((i & 0x000000ff) != 0x000000ff && !lower_cleared)
- output_asm_insn (\"and %w2,%w0\", operands);
- if ((i & 0x0000ff00) != 0x0000ff00 && !lower_cleared)
- output_asm_insn (\"and %x2,%x0\", operands);
- if ((i & 0x00ff0000) != 0x00ff0000 && !upper_cleared)
- output_asm_insn (\"and %y2,%y0\", operands);
- if ((i & 0xff000000) != 0xff000000 && !upper_cleared)
- output_asm_insn (\"and %z2,%z0\", operands);
- return \"\";
- }
- if (TARGET_H8300H || TARGET_H8300S)
- return \"and.l %S2,%S0\";
- return \"and %w2,%w0\;and %x2,%x0\;and %y2,%y0\;and %z2,%z0\;\";
-}"
- [(set_attr "length" "8")
- (set_attr "cc" "clobber")])
-
-
-;; ----------------------------------------------------------------------
-;; OR INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn ""
- [(set (match_operand:QI 0 "bit_operand" "=r,U")
- (ior:QI (match_operand:QI 1 "bit_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "rn,P")))]
- "register_operand (operands[0], QImode) || p_operand (operands[2], QImode)"
- "@
- or %X2,%X0
- bset %V2,%R0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "set_zn_c0,none_0hit")])
-
-(define_expand "iorqi3"
- [(set (match_operand:QI 0 "bit_operand" "=r,U")
- (ior:QI (match_operand:QI 1 "bit_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "rn,P")))]
- ""
- "
-{
- if (fix_bit_operand (operands, 'P', IOR))
- DONE;
-}")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "general_operand" "=r,r")
- (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "J,rn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
-
- if ((i & 0x00ff) != 0)
- output_asm_insn (\"or %s2,%s0\", operands);
- if ((i & 0xff00) != 0)
- output_asm_insn (\"or %t2,%t0\", operands);
- return \"\";
- }
- if (TARGET_H8300H || TARGET_H8300S)
- return \"or.w %T2,%T0\";
- return \"or %s2,%s0\;or %t2,%t0; %2 or2\";
-}"
- [(set_attr "length" "2,4")
- (set_attr "cc" "clobber,clobber")])
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (ior:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "J,rn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
-
- /* The h8300h can't do byte-wise operations on the
- upper 16bits of 32bit registers. However, if
- those bits aren't going to change, then we can
- work on the low-order bits. */
- if ((TARGET_H8300H || TARGET_H8300S)
- && (i & 0xffff0000) != 0x00000000)
- return \"or.l %S2,%S0\";
-
- if ((i & 0x000000ff) != 0)
- output_asm_insn (\"or %w2,%w0\", operands);
- if ((i & 0x0000ff00) != 0)
- output_asm_insn (\"or %x2,%x0\", operands);
- if ((i & 0x00ff0000) != 0)
- output_asm_insn (\"or %y2,%y0\", operands);
- if ((i & 0xff000000) != 0)
- output_asm_insn (\"or %z2,%z0\", operands);
- return \"\";
- }
- if (TARGET_H8300H || TARGET_H8300S)
- return \"or.l %S2,%S0\";
- return \"or %w2,%w0\;or %x2,%x0\;or %y2,%y0\;or %z2,%z0\;\";
-}"
- [(set_attr "length" "2,8")
- (set_attr "cc" "clobber,clobber")])
-
-;; ----------------------------------------------------------------------
-;; XOR INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn ""
- [(set (match_operand:QI 0 "bit_operand" "=r,U")
- (xor:QI (match_operand:QI 1 "bit_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "rn,P")))]
- "register_operand (operands[0], QImode) || p_operand (operands[2], QImode)"
- "@
- xor %X2,%X0
- bnot %V2,%R0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "set_zn_c0,none_0hit")])
-
-(define_expand "xorqi3"
- [(set (match_operand:QI 0 "bit_operand" "=r,U")
- (xor:QI (match_operand:QI 1 "bit_operand" "%0,0")
- (match_operand:QI 2 "nonmemory_operand" "rn,O")))]
- ""
- "
-{
- if (fix_bit_operand (operands, 'O', XOR))
- DONE;
-}")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (xor:HI (match_operand:HI 1 "general_operand" "%0,0")
- (match_operand:HI 2 "nonmemory_operand" "J,rn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
-
- if ((i & 0x00ff) != 0)
- output_asm_insn (\"xor %s2,%s0\", operands);
- if ((i & 0xff00) != 0)
- output_asm_insn (\"xor %t2,%t0\", operands);
- return \"\";
- }
- if (TARGET_H8300H || TARGET_H8300S)
- return \"xor.w %T2,%T0\";
- return \"xor %s2,%s0\;xor %t2,%t0\";
-}"
- [(set_attr "length" "2,4")
- (set_attr "cc" "clobber,clobber")])
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (xor:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "J,rn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
-
- /* The h8300h can't do byte-wise operations on the
- upper 16bits of 32bit registers. However, if
- those bits aren't going to change, then we can
- work on the low-order bits. */
- if ((TARGET_H8300H || TARGET_H8300S)
- && (i & 0xffff0000) != 0x00000000)
- return \"xor.l %S2,%S0\";
-
- if ((i & 0x000000ff) != 0)
- output_asm_insn (\"xor %w2,%w0\", operands);
- if ((i & 0x0000ff00) != 0)
- output_asm_insn (\"xor %x2,%x0\", operands);
- if ((i & 0x00ff0000) != 0)
- output_asm_insn (\"xor %y2,%y0\", operands);
- if ((i & 0xff000000) != 0)
- output_asm_insn (\"xor %z2,%z0\", operands);
- return \"\";
- }
- if (TARGET_H8300H || TARGET_H8300S)
- return \"xor.l %S2,%S0\";
- return \"xor %w2,%w0\;xor %x2,%x0\;xor %y2,%y0\;xor %z2,%z0\;\";
-}"
- [(set_attr "length" "2,8")
- (set_attr "cc" "clobber,clobber")])
-
-;; ----------------------------------------------------------------------
-;; NEGATION INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (neg:QI (match_operand:QI 1 "general_operand" "0")))]
- ""
- "neg %X0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_expand "neghi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (neg:HI (match_operand:HI 1 "general_operand" "0")))]
- ""
- "
-{
- if (TARGET_H8300)
- {
- emit_insn (gen_neghi2_h8300 (operands[0], operands[1]));
- DONE;
- }
-}")
-
-(define_expand "neghi2_h8300"
- [(set (match_dup 2)
- (not:HI (match_operand:HI 1 "register_operand" "r")))
- (set (match_dup 2) (plus:HI (match_dup 2) (const_int 1)))
- (set (match_operand:HI 0 "register_operand" "=r")
- (match_dup 2))]
- ""
- "{ operands[2] = gen_reg_rtx (HImode); }")
-
-(define_insn "neghi2_h8300h"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (neg:HI (match_operand:HI 1 "general_operand" "0")))]
- "TARGET_H8300H || TARGET_H8300S"
- "neg %T0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_expand "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "general_operand" "0")))]
- ""
- "
-{
- if (TARGET_H8300)
- {
- emit_insn (gen_negsi2_h8300 (operands[0], operands[1]));
- DONE;
- }
-}")
-
-(define_expand "negsi2_h8300"
- [(set (match_dup 2)
- (not:SI (match_operand:SI 1 "register_operand" "r")))
- (set (match_dup 2) (plus:SI (match_dup 2) (const_int 1)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (match_dup 2))]
- ""
- "{ operands[2] = gen_reg_rtx(SImode); }")
-
-(define_insn "negsi2_h8300h"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "general_operand" "0")))]
- "TARGET_H8300H || TARGET_H8300S"
- "neg %S0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-;; ----------------------------------------------------------------------
-;; NOT INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (not:QI (match_operand:QI 1 "general_operand" "0")))]
- ""
- "not %X0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (not:HI (match_operand:HI 1 "general_operand" "0")))]
- ""
- "*
-{
- if (TARGET_H8300)
- return \"not %s0\;not %t0\";
- else
- return \"not %T0\";
-}"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 4)
- (const_int 2)))])
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_operand:SI 1 "general_operand" "0")))]
- ""
- "*
-{
- if (TARGET_H8300)
- return \"not %w0\;not %x0\;not %y0\;not %z0\";
- else
- return \"not %S0\";
-}"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 8)
- (const_int 2)))])
-
-
-;; ----------------------------------------------------------------------
-;; JUMP INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-;; Conditional jump instructions
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_insn "branch_true"
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (get_attr_length (insn) == 2)
- return \"b%j1 %l0\";
- else if (get_attr_length (insn) == 4)
- return \"b%j1 %l0:16\";
- else
- return \"b%k1 %L0\;jmp @%l0\;%L0:\";
-}"
- [(set_attr "type" "branch")
- (set_attr "cc" "none")])
-
-(define_insn "branch_false"
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if (get_attr_length (insn) == 2)
- return \"b%k1 %l0\";
- else if (get_attr_length (insn) == 4)
- return \"b%k1 %l0:16\";
- else
- return \"b%j1 %L0\;jmp @%l0\;%L0:\";
-}"
- [(set_attr "type" "branch")
- (set_attr "cc" "none")])
-
-;; Unconditional and other jump instructions.
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
-{
- if (get_attr_length (insn) == 2)
- return \"bra %l0\";
- else if (get_attr_length (insn) == 4)
- return \"bra %l0:16\";
- else
- return \"jmp @%l0\";
-}"
- [(set_attr "type" "branch")
- (set_attr "cc" "none")])
-
-;; This is a define expand, because pointers may be either 16 or 32 bits.
-
-(define_expand "tablejump"
- [(parallel [(set (pc) (match_operand 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))])]
- ""
- "")
-
-(define_insn "tablejump_h8300"
- [(set (pc) (match_operand:HI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- "TARGET_H8300"
- "jmp @%0"
- [(set_attr "cc" "none")
- (set_attr "length" "2")])
-
-(define_insn "tablejump_h8300h"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- "TARGET_H8300H || TARGET_H8300S"
- "jmp @%0"
- [(set_attr "cc" "none")
- (set_attr "length" "2")])
-
-;; This is a define expand, because pointers may be either 16 or 32 bits.
-
-(define_expand "indirect_jump"
- [(set (pc) (match_operand 0 "jump_address_operand" ""))]
- ""
- "")
-
-(define_insn "indirect_jump_h8300"
- [(set (pc) (match_operand:HI 0 "jump_address_operand" "Vr"))]
- "TARGET_H8300"
- "jmp @%0"
- [(set_attr "cc" "none")
- (set_attr "length" "2")])
-
-(define_insn "indirect_jump_h8300h"
- [(set (pc) (match_operand:SI 0 "jump_address_operand" "Vr"))]
- "TARGET_H8300H || TARGET_H8300S"
- "jmp @%0"
- [(set_attr "cc" "none")
- (set_attr "length" "2")])
-
-;; Call subroutine with no return value.
-
-;; ??? Even though we use HImode here, this works for the 300h.
-
-(define_insn "call"
- [(call (match_operand:QI 0 "call_insn_operand" "or")
- (match_operand:HI 1 "general_operand" "g"))]
- ""
- "*
-{
- if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
- && SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
- return \"jsr\\t\@%0:8\";
- else
- return \"jsr\\t%0\";
-}"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (match_operand:QI 0 "small_call_insn_operand" "")
- (const_int 4)
- (const_int 8)))])
-
-;; Call subroutine, returning value in operand 0
-;; (which must be a hard register).
-
-;; ??? Even though we use HImode here, this works on the 300h.
-
-(define_insn "call_value"
- [(set (match_operand 0 "" "=r")
- (call (match_operand:QI 1 "call_insn_operand" "or")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
- && SYMBOL_REF_FLAG (XEXP (operands[1], 0)))
- return \"jsr\\t\@%1:8\";
- else
- return \"jsr\\t%1\";
-}"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (match_operand:QI 0 "small_call_insn_operand" "")
- (const_int 4)
- (const_int 8)))])
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop"
- [(set_attr "cc" "none")
- (set_attr "length" "2")])
-
-;; ----------------------------------------------------------------------
-;; EXTEND INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (zero_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))]
- ""
- "@
- mov.b #0,%t0
- mov.b %R1,%s0\;mov.b #0,%t0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "clobber,clobber")])
-
-;; The compiler can synthesize a 300H variant of this which is
-;; just as efficient as one that we'd create
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:QI 1 "general_operand_src" "0,g>")))]
- "TARGET_H8300"
- "@
- mov.b #0,%x0\;sub.w %e0,%e0
- mov.b %R1,%w0\;mov.b #0,%x0\;sub.w %e0,%e0"
- [(set_attr "length" "4,6")
- (set_attr "cc" "clobber,clobber")])
-
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:HI 1 "general_operand" "")))]
- ""
- "
-{
- extern int optimize;
-
- if (TARGET_H8300
- && GET_CODE (operands[1]) != CONST_INT
- && !optimize)
- {
- emit_insn (gen_zero_extendhisi2_h8300 (operands[0], operands[1]));
- DONE;
- }
-}")
-
-;; This is used when not optimizing. It avoids severe code explosion
-;; due to poor register allocation.
-(define_expand "zero_extendhisi2_h8300"
- [(set (reg:HI 1) (match_operand:HI 1 "general_operand" ""))
- (set (reg:SI 0) (zero_extend:SI (reg:HI 1)))
- (set (match_operand:SI 0 "general_operand" "" ) (reg:SI 0))]
- "TARGET_H8300"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:HI 1 "general_operand_src" "0,g>")))]
- "TARGET_H8300"
- "@
- sub.w %e0,%e0
- mov.w %e1,%f0\;sub.w %e0,%e0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "clobber,clobber")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:HI 1 "general_operand_src" "0,g>")))]
- "TARGET_H8300H || TARGET_H8300S"
- "@
- extu.l %S0
- mov.w %T1,%T0\;extu.l %S0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "set_zn_c0,set_zn_c0")])
-
-(define_expand "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (sign_extend:HI (match_operand:QI 1 "general_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (sign_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))]
- "TARGET_H8300"
- "@
- bld #7,%s0\;subx %t0,%t0
- mov.b %R1,%s0\;bld #7,%s0\;subx %t0,%t0"
- [(set_attr "length" "4,6")
- (set_attr "cc" "clobber,clobber")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (sign_extend:HI (match_operand:QI 1 "general_operand_src" "0,g>")))]
- "TARGET_H8300H || TARGET_H8300S"
- "@
- exts.w %T0
- mov.b %R1,%s0\;exts.w %T0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "set_zn_c0,set_zn_c0")])
-
-;; The compiler can synthesize a 300H variant of this which is
-;; just as efficient as one that we'd create
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (sign_extend:SI (match_operand:QI 1 "general_operand_src" "0,g>")))]
- "TARGET_H8300"
- "@
- bld #7,%w0\;subx %x0,%x0\;subx %y0,%y0\;subx %z0,%z0
- mov.b %R1,%w0\;bld #7,%w0\;subx %x0,%x0\;subx %y0,%y0\;subx %z0,%z0"
- [(set_attr "length" "8,10")
- (set_attr "cc" "clobber,clobber")])
-
-(define_expand "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:HI 1 "general_operand" "")))]
- ""
- "
-{
- extern int optimize;
- if (TARGET_H8300
- && GET_CODE (operands[1]) != CONST_INT
- && !optimize)
- {
- emit_insn (gen_extendhisi2_h8300 (operands[0], operands[1]));
- DONE;
- }
-}")
-
-;; This is used when not optimizing. It avoids severe code explosion
-;; due to poor register allocation.
-(define_expand "extendhisi2_h8300"
- [(set (reg:HI 1) (match_operand:HI 1 "general_operand" ""))
- (set (reg:SI 0) (sign_extend:SI (reg:HI 1)))
- (set (match_operand:SI 0 "general_operand" "" ) (reg:SI 0))]
- "TARGET_H8300"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (sign_extend:SI (match_operand:HI 1 "general_operand_src" "0,g>")))]
- "TARGET_H8300"
- "@
- bld #7,%x0\;subx %y0,%y0\;subx %z0,%z0
- mov.w %T1,%f0\;bld #7,%x0\;subx %y0,%y0\;subx %z0,%z0"
- [(set_attr "length" "6,8")
- (set_attr "cc" "clobber,clobber")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (sign_extend:SI (match_operand:HI 1 "general_operand_src" "0,g>")))]
- "TARGET_H8300H || TARGET_H8300S"
- "@
- exts.l %S0
- mov.w %T1,%T0\;exts.l %S0"
- [(set_attr "length" "2,4")
- (set_attr "cc" "set_zn_c0,set_zn_c0")])
-
-;; ----------------------------------------------------------------------
-;; SHIFTS
-;; ----------------------------------------------------------------------
-;;
-;; We make some attempt to provide real efficient shifting. One example is
-;; doing an 8 bit shift of a 16 bit value by moving a byte reg into the other
-;; reg and moving 0 into the former reg.
-;;
-;; We also try to achieve this in a uniform way. IE: We don't try to achieve
-;; this in both rtl and at insn emit time. Ideally, we'd use rtl as that would
-;; give the optimizer more cracks at the code. However, we wish to do things
-;; like optimizing shifting the sign bit to bit 0 by rotating the other way.
-;; There is rtl to handle this (rotate + and), but the h8/300 doesn't handle
-;; 16 bit rotates. Also, if we emit complicated rtl, combine may not be able
-;; to detect cases it can optimize.
-;;
-;; For these and other fuzzy reasons, I've decided to go the less pretty but
-;; easier "do it at insn emit time" route.
-
-;; QI BIT SHIFTS
-
-(define_expand "ashlqi3"
- [(set (match_operand:QI 0 "register_operand" "")
- (ashift:QI (match_operand:QI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "if (expand_a_shift (QImode, ASHIFT, operands)) DONE;else FAIL;")
-
-(define_expand "ashrqi3"
- [(set (match_operand:QI 0 "register_operand" "")
- (ashiftrt:QI (match_operand:QI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "if (expand_a_shift (QImode, ASHIFTRT, operands)) DONE;else FAIL;")
-
-(define_expand "lshrqi3"
- [(set (match_operand:QI 0 "register_operand" "")
- (lshiftrt:QI (match_operand:QI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "if (expand_a_shift (QImode, LSHIFTRT, operands)) DONE;else FAIL;")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r,r")
- (match_operator:QI 3 "nshift_operator"
- [ (match_operand:QI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "KM,rn")]))
- (clobber (match_scratch:QI 4 "=X,&r"))]
- ""
- "* return emit_a_shift (insn, operands);"
- [(set_attr "length" "20")
- (set_attr "cc" "clobber")])
-
-;; HI BIT SHIFTS
-
-(define_expand "ashlhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (ashift:HI (match_operand:HI 1 "nonmemory_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "if (expand_a_shift (HImode, ASHIFT, operands)) DONE;else FAIL;")
-
-(define_expand "lshrhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (lshiftrt:HI (match_operand:HI 1 "general_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "if (expand_a_shift (HImode, LSHIFTRT, operands)) DONE;else FAIL;")
-
-(define_expand "ashrhi3"
- [(set (match_operand:HI 0 "register_operand" "")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "if (expand_a_shift (HImode, ASHIFTRT, operands)) DONE;else FAIL;")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (match_operator:HI 3 "nshift_operator"
- [ (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "KM,rn")]))
- (clobber (match_scratch:QI 4 "=X,&r"))]
- ""
- "* return emit_a_shift (insn, operands);"
- [(set_attr "length" "20")
- (set_attr "cc" "clobber")])
-
-;; SI BIT SHIFTS
-
-(define_expand "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashift:SI
- (match_operand:SI 1 "general_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "if (expand_a_shift (SImode, ASHIFT, operands)) DONE;else FAIL;")
-
-(define_expand "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (lshiftrt:SI
- (match_operand:SI 1 "general_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "if (expand_a_shift (SImode, LSHIFTRT, operands)) DONE;else FAIL;")
-
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashiftrt:SI
- (match_operand:SI 1 "general_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "if (expand_a_shift (SImode, ASHIFTRT, operands)) DONE;else FAIL;")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (match_operator:SI 3 "nshift_operator"
- [ (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "K,rn")]))
- (clobber (match_scratch:QI 4 "=X,&r"))]
- ""
- "* return emit_a_shift (insn, operands);"
- [(set_attr "length" "20")
- (set_attr "cc" "clobber")])
-
-;; -----------------------------------------------------------------
-;; BIT FIELDS
-;; -----------------------------------------------------------------
-;; The H8/300 has given 1/8th of its opcode space to bitfield
-;; instructions so let's use them as well as we can.
-
-;; You'll never believe all these patterns perform one basic action --
-;; load a bit from the source, optionally invert the bit, then store it
-;; in the destination (which is known to be zero)..
-;;
-;; Combine obviously need some work to better identify this situation and
-;; canonicalize the form better.
-
-;;
-;; Normal loads with a 16bit destination.
-;;
-;; Yes, both cases are needed.
-;;
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=&r")
- (zero_extract:HI (match_operand:HI 1 "register_operand" "r")
- (const_int 1)
- (match_operand:HI 2 "immediate_operand" "n")))]
- ""
- "sub.w %0,%0\;bld %Z2,%Y1\;bst #0,%X0"
- [(set_attr "cc" "clobber")
- (set_attr "length" "6")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=&r")
- (subreg:HI (zero_extract:SI
- (match_operand:HI 1 "register_operand" "r")
- (const_int 1)
- (match_operand:HI 2 "immediate_operand" "n")) 1))]
- ""
- "sub.w %0,%0\;bld %Z2,%Y1\;bst #0,%X0"
- [(set_attr "cc" "clobber")
- (set_attr "length" "6")])
-
-;;
-;; Inverted loads with a 16bit destination.
-;;
-;; Yes, all four cases are needed.
-;;
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=&r")
- (zero_extract:HI (xor:HI (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 3 "p_operand" "P"))
- (const_int 1)
- (match_operand:HI 2 "const_int_operand" "n")))]
- "(1 << INTVAL (operands[2])) == INTVAL (operands[3])"
- "sub.w %0,%0\;bild %Z2,%Y1\;bst #0,%X0"
- [(set_attr "cc" "clobber")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=&r")
- (and:HI (not:HI
- (lshiftrt:HI
- (match_operand:HI 1 "bit_operand" "Ur")
- (match_operand:HI 2 "const_int_operand" "n")))
- (const_int 1)))]
- ""
- "sub.w %0,%0\;bild %Z2,%Y1\;bst #0,%X0"
- [(set_attr "cc" "clobber")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=&r")
- (and:HI (not:HI
- (subreg:HI
- (lshiftrt:SI
- (match_operand:SI 1 "register_operand" "Ur")
- (match_operand:SI 2 "const_int_operand" "n")) 1))
- (const_int 1)))]
- "INTVAL (operands[2]) < 16"
- "sub.w %0,%0\;bild %Z2,%Y1\;bst #0,%X0"
- [(set_attr "cc" "clobber")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=&r")
- (and:HI (not:HI
- (subreg:HI
- (lshiftrt:SI
- (match_operand:SI 1 "bit_operand" "Ur")
- (match_operand:SI 2 "const_int_operand" "n")) 0))
- (const_int 1)))]
- "(TARGET_H8300H || TARGET_H8300S)
- && INTVAL (operands[2]) < 16"
- "sub.w %0,%0\;bild %Z2,%Y1\;bst #0,%X0"
- [(set_attr "cc" "clobber")
- (set_attr "length" "8")])
-
-;;
-;; Normal loads with a 32bit destination.
-;;
-;; Yes, all three cases are needed.
-;;
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (zero_extract:SI (match_operand:HI 1 "register_operand" "r")
- (const_int 1)
- (match_operand:HI 2 "const_int_operand" "n")))]
- ""
- "* return output_simode_bld (0, 0, operands);"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 10)
- (const_int 8)))])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (and:SI (zero_extend:SI
- (lshiftrt:QI
- (match_operand:QI 1 "bit_operand" "Ur")
- (match_operand:QI 2 "const_int_operand" "n")))
- (const_int 1)))]
- ""
- "* return output_simode_bld (0, 0, operands);"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 10)
- (const_int 8)))])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (and:SI (zero_extend:SI
- (lshiftrt:HI
- (match_operand:HI 1 "bit_operand" "Ur")
- (match_operand:HI 2 "const_int_operand" "n")))
- (const_int 1)))]
- ""
- "* return output_simode_bld (0, 0, operands);"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 10)
- (const_int 8)))])
-
-;;
-;; Inverted loads with a 32bit destination.
-;;
-;; Yes, all seven cases are needed.
-;;
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (and:SI (not:SI
- (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))
- (match_operand:SI 2 "p_operand" "P")))]
- ""
- "* return output_simode_bld (1, 1, operands);"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 10)
- (const_int 8)))])
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (and:SI (not:SI
- (zero_extend:SI
- (lshiftrt:HI (match_operand:HI 1 "bit_operand" "Ur")
- (match_operand:HI 2 "const_int_operand" "n"))))
- (const_int 1)))]
- ""
- "* return output_simode_bld (1, 0, operands);"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 10)
- (const_int 8)))])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (and:SI (not:SI
- (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))
- (match_operand:SI 2 "p_operand" "P")))]
- ""
- "* return output_simode_bld (1, 1, operands);"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 10)
- (const_int 8)))])
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (and:SI (not:SI
- (zero_extend:SI
- (lshiftrt:QI (match_operand:QI 1 "bit_operand" "Ur")
- (match_operand:QI 2 "const_int_operand" "n"))))
- (const_int 1)))]
- ""
- "* return output_simode_bld (1, 0, operands);"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 10)
- (const_int 8)))])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (and:SI (not:SI
- (subreg:SI
- (lshiftrt:HI
- (match_operand:HI 1 "bit_operand" "Ur")
- (match_operand:HI 2 "const_int_operand" "n")) 0))
- (const_int 1)))]
- "1"
- "* return output_simode_bld (1, 0, operands);"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 10)
- (const_int 8)))])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (and:SI (not:SI
- (subreg:SI
- (lshiftrt:QI
- (match_operand:QI 1 "bit_operand" "Ur")
- (match_operand:QI 2 "const_int_operand" "n")) 0))
- (const_int 1)))]
- "1"
- "* return output_simode_bld (1, 0, operands);"
- [(set_attr "cc" "clobber")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_H8300H || TARGET_H8300S")
- (const_int 0))
- (const_int 10)
- (const_int 8)))])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (zero_extract:SI (xor:HI (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 3 "p_operand" "P"))
- (const_int 1)
- (match_operand:HI 2 "const_int_operand" "n")))]
- "(1 << INTVAL (operands[2])) == INTVAL (operands[3])"
- "sub.w %0,%0\;bild %Z2,%Y1\;bst #0,%X0"
- [(set_attr "cc" "clobber")
- (set_attr "length" "8")])
-
-(define_expand "insv"
- [(set (zero_extract:HI (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" "")
- (match_operand:HI 2 "general_operand" ""))
- (match_operand:HI 3 "general_operand" ""))]
- "TARGET_H8300"
- "
-{
- /* We only have single bit bitfield instructions. */
- if (INTVAL (operands[1]) != 1)
- FAIL;
-
- /* For now, we don't allow memory operands. */
- if (GET_CODE (operands[0]) == MEM
- || GET_CODE (operands[3]) == MEM)
- FAIL;
-}")
-
-(define_insn ""
- [(set (zero_extract:HI (match_operand:HI 0 "register_operand" "+r")
- (const_int 1)
- (match_operand:HI 1 "immediate_operand" "n"))
- (match_operand:HI 2 "register_operand" "r"))]
- ""
- "bld #0,%R2\;bst %Z1,%Y0 ; i1"
- [(set_attr "cc" "clobber")
- (set_attr "length" "4")])
-
-(define_expand "extzv"
- [(set (match_operand:HI 0 "register_operand" "")
- (zero_extract:HI (match_operand:HI 1 "bit_operand" "")
- (match_operand:HI 2 "general_operand" "")
- (match_operand:HI 3 "general_operand" "")))]
- "TARGET_H8300"
- "
-{
- /* We only have single bit bitfield instructions. */
- if (INTVAL (operands[2]) != 1)
- FAIL;
-
- /* For now, we don't allow memory operands. */
- if (GET_CODE (operands[1]) == MEM)
- FAIL;
-}")
-
-;; BAND, BOR, and BXOR patterns
-
-(define_insn ""
- [(set (match_operand:HI 0 "bit_operand" "=Ur")
- (match_operator:HI 4 "bit_operator"
- [(zero_extract:HI (match_operand:HI 1 "register_operand" "r")
- (const_int 1)
- (match_operand:HI 2 "immediate_operand" "n"))
- (match_operand:HI 3 "bit_operand" "0")]))]
- ""
- "bld %Z2,%Y1\;%b4 #0,%R0\;bst #0,%R0; bl1"
- [(set_attr "cc" "clobber")
- (set_attr "length" "6")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "bit_operand" "=Ur")
- (match_operator:HI 5 "bit_operator"
- [(zero_extract:HI (match_operand:HI 1 "register_operand" "r")
- (const_int 1)
- (match_operand:HI 2 "immediate_operand" "n"))
- (zero_extract:HI (match_operand:HI 3 "register_operand" "r")
- (const_int 1)
- (match_operand:HI 4 "immediate_operand" "n"))]))]
- ""
- "bld %Z2,%Y1\;%b5 %Z4,%Y3\;bst #0,%R0; bl3"
- [(set_attr "cc" "clobber")
- (set_attr "length" "6")])
-
-
-;; ----------------------------------------------
-;; Peepholes go at the end.
-;; ----------------------------------------------
-
-;; Notice when two byte moves in a row could be a word move.
-
-(define_peephole
- [(set (match_operand:QI 0 "register_operand" "=r")
- (mem:QI (plus:HI (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "immediate_operand" "n"))))
- (set (match_operand:QI 3 "register_operand" "=r")
- (mem:QI (plus:HI (match_dup 1)
- (match_operand:HI 4 "immediate_operand" "n"))))]
- "(INTVAL(operands[2]) == INTVAL(operands[4])+1) && REGNO(operands[0]) +1 == REGNO(operands[3])"
- "mov.w @(%u4,%T1),%T0"
- [(set_attr "length" "6")
- (set_attr "cc" "set_zn_c0")])
-
-(define_peephole
- [(set (mem:QI (plus:HI (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "immediate_operand" "n")))
- (match_operand:QI 0 "register_operand" "r"))
- (set (mem:QI (plus:HI (match_dup 1)
- (match_operand:HI 4 "immediate_operand" "n")))
- (match_operand:QI 3 "register_operand" "r"))]
- "(INTVAL(operands[2]) == INTVAL(operands[4])+1) && REGNO(operands[0]) +1 == REGNO(operands[3])"
- "mov.w %T0,@(%u4,%T1)"
- [(set_attr "length" "6")
- (set_attr "cc" "set_zn_c0")])
-
-;; Notice a move which could be post incremented.
-
-(define_peephole
- [(set (match_operand:QI 0 "register_operand" "")
- (mem:QI (match_operand:HI 1 "register_operand" "")))
- (set (match_dup 1) (plus:HI (match_dup 1) (const_int 1)))]
- "REGNO(operands[1]) != REGNO(operands[0])"
- "mov.b @%T1+,%X0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_peephole
- [(set (match_operand:HI 0 "register_operand" "")
- (mem:HI (match_operand:HI 1 "register_operand" "")))
- (set (match_dup 1) (plus:HI (match_dup 1) (const_int 2)))]
- "REGNO(operands[1]) != REGNO(operands[0])"
- "mov.w @%T1+,%T0"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-;; Notice a move which could be predecremented.
-
-(define_peephole
- [(set (match_operand:HI 1 "register_operand" "")
- (plus:HI (match_dup 1) (const_int -1)))
- (set (mem:QI (match_dup 1))
- (match_operand:QI 0 "register_operand" ""))]
- "REGNO(operands[1]) != REGNO(operands[0])"
- "mov.b %X0,@-%T1"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
-(define_peephole
- [(set (match_operand:HI 1 "register_operand" "")
- (plus:HI (match_dup 1) (const_int -1)))
- (set (mem:HI (match_dup 1))
- (match_operand:HI 0 "register_operand" ""))]
- "REGNO(operands[1]) != REGNO(operands[0])"
- "mov.w %T0,@-%T1"
- [(set_attr "length" "2")
- (set_attr "cc" "set_zn_c0")])
-
diff --git a/gcc/config/h8300/lib1funcs.asm b/gcc/config/h8300/lib1funcs.asm
deleted file mode 100644
index 4179a747fab..00000000000
--- a/gcc/config/h8300/lib1funcs.asm
+++ /dev/null
@@ -1,781 +0,0 @@
-;; libgcc1 routines for the Hitachi h8/300 cpu.
-;; Contributed by Steve Chamberlain.
-;; sac@cygnus.com
-
-/* Copyright (C) 1994 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, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file 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; 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 link this library with other files,
- some of which are compiled with GCC, to produce an executable,
- this library 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. */
-
-/* Assembler register definitions. */
-
-#define A0 r0
-#define A0L r0l
-#define A0H r0h
-
-#define A1 r1
-#define A1L r1l
-#define A1H r1h
-
-#define A2 r2
-#define A2L r2l
-#define A2H r2h
-
-#define A3 r3
-#define A3L r3l
-#define A3H r3h
-
-#define S0 r4
-#define S0L r4l
-#define S0H r4h
-
-#define S1 r5
-#define S1L r5l
-#define S1H r5h
-
-#define S2 r6
-#define S2L r6l
-#define S2H r6h
-
-#ifdef __H8300__
-#define MOVP mov.w /* pointers are 16 bits */
-#define ADDP add.w
-#define CMPP cmp.w
-#define PUSHP push
-#define POPP pop
-
-#define A0P r0
-#define A1P r1
-#define A2P r2
-#define A3P r3
-#define S0P r4
-#define S1P r5
-#define S2P r6
-#endif
-
-#if defined (__H8300H__) || defined (__H8300S__)
-#define MOVP mov.l /* pointers are 32 bits */
-#define ADDP add.l
-#define CMPP cmp.l
-#define PUSHP push.l
-#define POPP pop.l
-
-#define A0P er0
-#define A1P er1
-#define A2P er2
-#define A3P er3
-#define S0P er4
-#define S1P er5
-#define S2P er6
-
-#define A0E e0
-#define A1E e1
-#define A2E e2
-#define A3E e3
-#endif
-
-#ifdef L_cmpsi2
-#ifdef __H8300__
- .section .text
- .align 2
- .global ___cmpsi2
-___cmpsi2:
- cmp.w A2,A0
- bne .L2
- cmp.w A3,A1
- bne .L2
- mov.w #1,A0
- rts
-.L2:
- cmp.w A0,A2
- bgt .L4
- bne .L3
- cmp.w A1,A3
- bls .L3
-.L4:
- sub.w A0,A0
- rts
-.L3:
- mov.w #2,A0
-.L5:
- rts
- .end
-#endif
-#endif /* L_cmpsi2 */
-
-#ifdef L_ucmpsi2
-#ifdef __H8300__
- .section .text
- .align 2
- .global ___ucmpsi2
-___ucmpsi2:
- cmp.w A2,A0
- bne .L2
- cmp.w A3,A1
- bne .L2
- mov.w #1,A0
- rts
-.L2:
- cmp.w A0,A2
- bhi .L4
- bne .L3
- cmp.w A1,A3
- bls .L3
-.L4:
- sub.w A0,A0
- rts
-.L3:
- mov.w #2,A0
-.L5:
- rts
- .end
-#endif
-#endif /* L_ucmpsi2 */
-
-#ifdef L_divhi3
-
-;; HImode divides for the H8/300.
-;; We bunch all of this into one object file since there are several
-;; "supporting routines".
-
-; general purpose normalize routine
-;
-; divisor in A0
-; dividend in A1
-; turns both into +ve numbers, and leaves what the answer sign
-; should be in A2L
-
-#ifdef __H8300__
- .section .text
- .align 2
-divnorm:
- mov.b #0x0,A2L
- or A0H,A0H ; is divisor > 0
- bge _lab1
- not A0H ; no - then make it +ve
- not A0L
- adds #1,A0
- xor #0x1,A2L ; and remember that in A2L
-_lab1: or A1H,A1H ; look at dividend
- bge _lab2
- not A1H ; it is -ve, make it positive
- not A1L
- adds #1,A1
- xor #0x1,A2L; and toggle sign of result
-_lab2: rts
-;; Basically the same, except that the sign of the divisor determines
-;; the sign.
-modnorm:
- mov.b #0x0,A2L
- or A0H,A0H ; is divisor > 0
- bge _lab7
- not A0H ; no - then make it +ve
- not A0L
- adds #1,A0
- xor #0x1,A2L ; and remember that in A2L
-_lab7: or A1H,A1H ; look at dividend
- bge _lab8
- not A1H ; it is -ve, make it positive
- not A1L
- adds #1,A1
-_lab8: rts
-
-; A0=A0/A1 signed
-
- .global ___divhi3
-___divhi3:
- bsr divnorm
- bsr ___udivhi3
-negans: or A2L,A2L ; should answer be negative ?
- beq _lab4
- not A0H ; yes, so make it so
- not A0L
- adds #1,A0
-_lab4: rts
-
-; A0=A0%A1 signed
-
- .global ___modhi3
-___modhi3:
- bsr modnorm
- bsr ___udivhi3
- mov A3,A0
- bra negans
-
-; A0=A0%A1 unsigned
-
- .global ___umodhi3
-___umodhi3:
- bsr ___udivhi3
- mov A3,A0
- rts
-
-; A0=A0/A1 unsigned
-; A3=A0%A1 unsigned
-; A2H trashed
-; D high 8 bits of denom
-; d low 8 bits of denom
-; N high 8 bits of num
-; n low 8 bits of num
-; M high 8 bits of mod
-; m low 8 bits of mod
-; Q high 8 bits of quot
-; q low 8 bits of quot
-; P preserve
-
-; The h8 only has a 16/8 bit divide, so we look at the incoming and
-; see how to partition up the expression.
-
- .global ___udivhi3
-___udivhi3:
- ; A0 A1 A2 A3
- ; Nn Dd P
- sub.w A3,A3 ; Nn Dd xP 00
- or A1H,A1H
- bne divlongway
- or A0H,A0H
- beq _lab6
-
-; we know that D == 0 and N is != 0
- mov.b A0H,A3L ; Nn Dd xP 0N
- divxu A1L,A3 ; MQ
- mov.b A3L,A0H ; Q
-; dealt with N, do n
-_lab6: mov.b A0L,A3L ; n
- divxu A1L,A3 ; mq
- mov.b A3L,A0L ; Qq
- mov.b A3H,A3L ; m
- mov.b #0x0,A3H ; Qq 0m
- rts
-
-; D != 0 - which means the denominator is
-; loop around to get the result.
-
-divlongway:
- mov.b A0H,A3L ; Nn Dd xP 0N
- mov.b #0x0,A0H ; high byte of answer has to be zero
- mov.b #0x8,A2H ; 8
-div8: add.b A0L,A0L ; n*=2
- rotxl A3L ; Make remainder bigger
- rotxl A3H
- sub.w A1,A3 ; Q-=N
- bhs setbit ; set a bit ?
- add.w A1,A3 ; no : too far , Q+=N
-
- dec A2H
- bne div8 ; next bit
- rts
-
-setbit: inc A0L ; do insert bit
- dec A2H
- bne div8 ; next bit
- rts
-
-#endif /* __H8300__ */
-#endif /* L_divhi3 */
-
-#ifdef L_divsi3
-
-;; 4 byte integer divides for the H8/300.
-;;
-;; We have one routine which does all the work and lots of
-;; little ones which prepare the args and massage the sign.
-;; We bunch all of this into one object file since there are several
-;; "supporting routines".
-
-#ifdef __H8300H__
- .h8300h
-#endif
-
-#ifdef __H8300S__
- .h8300s
-#endif
-
- .section .text
- .align 2
-
-; Put abs SIs into r0/r1 and r2/r3, and leave a 1 in r6l with sign of rest.
-; This function is here to keep branch displacements small.
-
-#ifdef __H8300__
-
-divnorm:
- mov.b #0,S2L ; keep the sign in S2
- mov.b A0H,A0H ; is the numerator -ve
- bge postive
-
- ; negate arg
- not A0H
- not A1H
- not A0L
- not A1L
-
- add #1,A1L
- addx #0,A1H
- addx #0,A0H
- addx #0,A0L
-
- mov.b #1,S2L ; the sign will be -ve
-postive:
- mov.b A2H,A2H ; is the denominator -ve
- bge postive2
- not A2L
- not A2H
- not A3L
- not A3H
- add.b #1,A3L
- addx #0,A3H
- addx #0,A2L
- addx #0,A2H
- xor #1,S2L ; toggle result sign
-postive2:
- rts
-
-;; Basically the same, except that the sign of the divisor determines
-;; the sign.
-modnorm:
- mov.b #0,S2L ; keep the sign in S2
- mov.b A0H,A0H ; is the numerator -ve
- bge mpostive
-
- ; negate arg
- not A0H
- not A1H
- not A0L
- not A1L
-
- add #1,A1L
- addx #0,A1H
- addx #0,A0H
- addx #0,A0L
-
- mov.b #1,S2L ; the sign will be -ve
-mpostive:
- mov.b A2H,A2H ; is the denominator -ve
- bge mpostive2
- not A2L
- not A2H
- not A3L
- not A3H
- add.b #1,A3L
- addx #0,A3H
- addx #0,A2L
- addx #0,A2H
-mpostive2:
- rts
-
-#else /* __H8300H__ */
-
-divnorm:
- mov.b #0,S2L ; keep the sign in S2
- mov.l A0P,A0P ; is the numerator -ve
- bge postive
-
- neg.l A0P ; negate arg
- mov.b #1,S2L ; the sign will be -ve
-
-postive:
- mov.l A1P,A1P ; is the denominator -ve
- bge postive2
-
- neg.l A1P ; negate arg
- xor.b #1,S2L ; toggle result sign
-
-postive2:
- rts
-
-;; Basically the same, except that the sign of the divisor determines
-;; the sign.
-modnorm:
- mov.b #0,S2L ; keep the sign in S2
- mov.l A0P,A0P ; is the numerator -ve
- bge mpostive
-
- neg.l A0P ; negate arg
- mov.b #1,S2L ; the sign will be -ve
-
-mpostive:
- mov.l A1P,A1P ; is the denominator -ve
- bge mpostive2
-
- neg.l A1P ; negate arg
-
-mpostive2:
- rts
-
-#endif
-
-; numerator in A0/A1
-; denominator in A2/A3
- .global ___modsi3
-___modsi3:
- PUSHP S2P
- PUSHP S0P
- PUSHP S1P
-
- bsr modnorm
- bsr divmodsi4
-#ifdef __H8300__
- mov S0,A0
- mov S1,A1
-#else
- mov.l S0P,A0P
-#endif
- bra exitdiv
-
- .global ___udivsi3
-___udivsi3:
- PUSHP S2P
- PUSHP S0P
- PUSHP S1P
- mov.b #0,S2L ; keep sign low
- bsr divmodsi4
- bra exitdiv
-
- .global ___umodsi3
-___umodsi3:
- PUSHP S2P
- PUSHP S0P
- PUSHP S1P
- mov.b #0,S2L ; keep sign low
- bsr divmodsi4
-#ifdef __H8300__
- mov S0,A0
- mov S1,A1
-#else
- mov.l S0P,A0P
-#endif
- bra exitdiv
-
- .global ___divsi3
-___divsi3:
- PUSHP S2P
- PUSHP S0P
- PUSHP S1P
- jsr divnorm
- jsr divmodsi4
-
- ; examine what the sign should be
-exitdiv:
- POPP S1P
- POPP S0P
-
- or S2L,S2L
- beq reti
-
- ; should be -ve
-#ifdef __H8300__
- not A0H
- not A1H
- not A0L
- not A1L
-
- add #1,A1L
- addx #0,A1H
- addx #0,A0H
- addx #0,A0L
-#else /* __H8300H__ */
- neg.l A0P
-#endif
-
-reti:
- POPP S2P
- rts
-
- ; takes A0/A1 numerator (A0P for 300h)
- ; A2/A3 denominator (A1P for 300h)
- ; returns A0/A1 quotient (A0P for 300h)
- ; S0/S1 remainder (S0P for 300h)
- ; trashes S2
-
-#ifdef __H8300__
-
-divmodsi4:
- sub.w S0,S0 ; zero play area
- mov.w S0,S1
- mov.b A2H,S2H
- or A2L,S2H
- or A3H,S2H
- bne DenHighZero
- mov.b A0H,A0H
- bne NumByte0Zero
- mov.b A0L,A0L
- bne NumByte1Zero
- mov.b A1H,A1H
- bne NumByte2Zero
- bra NumByte3Zero
-NumByte0Zero:
- mov.b A0H,S1L
- divxu A3L,S1
- mov.b S1L,A0H
-NumByte1Zero:
- mov.b A0L,S1L
- divxu A3L,S1
- mov.b S1L,A0L
-NumByte2Zero:
- mov.b A1H,S1L
- divxu A3L,S1
- mov.b S1L,A1H
-NumByte3Zero:
- mov.b A1L,S1L
- divxu A3L,S1
- mov.b S1L,A1L
-
- mov.b S1H,S1L
- mov.b #0x0,S1H
- rts
-
-; have to do the divide by shift and test
-DenHighZero:
- mov.b A0H,S1L
- mov.b A0L,A0H
- mov.b A1H,A0L
- mov.b A1L,A1H
-
- mov.b #0,A1L
- mov.b #24,S2H ; only do 24 iterations
-
-nextbit:
- add.w A1,A1 ; double the answer guess
- rotxl A0L
- rotxl A0H
-
- rotxl S1L ; double remainder
- rotxl S1H
- rotxl S0L
- rotxl S0H
- sub.w A3,S1 ; does it all fit
- subx A2L,S0L
- subx A2H,S0H
- bhs setone
-
- add.w A3,S1 ; no, restore mistake
- addx A2L,S0L
- addx A2H,S0H
-
- dec S2H
- bne nextbit
- rts
-
-setone:
- inc A1L
- dec S2H
- bne nextbit
- rts
-
-#else /* __H8300H__ */
-
-divmodsi4:
- sub.l S0P,S0P ; zero play area
- mov.w A1E,A1E ; denominator top word 0?
- bne DenHighZero
-
- ; do it the easy way, see page 107 in manual
- mov.w A0E,A2
- extu.l A2P
- divxu.w A1,A2P
- mov.w A2E,A0E
- divxu.w A1,A0P
- mov.w A0E,S0
- mov.w A2,A0E
- extu.l S0P
- rts
-
-DenHighZero:
- mov.w A0E,A2
- mov.b A2H,S0L
- mov.b A2L,A2H
- mov.b A0H,A2L
- mov.w A2,A0E
- mov.b A0L,A0H
- mov.b #0,A0L
- mov.b #24,S2H ; only do 24 iterations
-
-nextbit:
- shll.l A0P ; double the answer guess
- rotxl.l S0P ; double remainder
- sub.l A1P,S0P ; does it all fit?
- bhs setone
-
- add.l A1P,S0P ; no, restore mistake
- dec S2H
- bne nextbit
- rts
-
-setone:
- inc A0L
- dec S2H
- bne nextbit
- rts
-
-#endif
-#endif /* L_divsi3 */
-
-#ifdef L_mulhi3
-
-;; HImode multiply.
-; The h8 only has an 8*8->16 multiply.
-; The answer is the same as:
-;
-; product = (srca.l * srcb.l) + ((srca.h * srcb.l) + (srcb.h * srca.l)) * 256
-; (we can ignore A1.h * A0.h cause that will all off the top)
-; A0 in
-; A1 in
-; A0 answer
-
-#ifdef __H8300__
- .section .text
- .align 2
- .global ___mulhi3
-___mulhi3:
- mov.b A1L,A2L ; A2l gets srcb.l
- mulxu A0L,A2 ; A2 gets first sub product
-
- mov.b A0H,A3L ; prepare for
- mulxu A1L,A3 ; second sub product
-
- add.b A3L,A2H ; sum first two terms
-
- mov.b A1H,A3L ; third sub product
- mulxu A0L,A3
-
- add.b A3L,A2H ; almost there
- mov.w A2,A0 ; that is
- rts
-
-#endif
-#endif /* L_mulhi3 */
-
-#ifdef L_mulsi3
-
-;; SImode multiply.
-;;
-;; I think that shift and add may be sufficient for this. Using the
-;; supplied 8x8->16 would need 10 ops of 14 cycles each + overhead. This way
-;; the inner loop uses maybe 20 cycles + overhead, but terminates
-;; quickly on small args.
-;;
-;; A0/A1 src_a
-;; A2/A3 src_b
-;;
-;; while (a)
-;; {
-;; if (a & 1)
-;; r += b;
-;; a >>= 1;
-;; b <<= 1;
-;; }
-
- .section .text
- .align 2
-
-#ifdef __H8300__
-
- .global ___mulsi3
-___mulsi3:
- PUSHP S0P
- PUSHP S1P
- PUSHP S2P
-
- sub.w S0,S0
- sub.w S1,S1
-
- ; while (a)
-_top: mov.w A0,A0
- bne _more
- mov.w A1,A1
- beq _done
-_more: ; if (a & 1)
- bld #0,A1L
- bcc _nobit
- ; r += b
- add.w A3,S1
- addx A2L,S0L
- addx A2H,S0H
-_nobit:
- ; a >>= 1
- shlr A0H
- rotxr A0L
- rotxr A1H
- rotxr A1L
-
- ; b <<= 1
- add.w A3,A3
- addx A2L,A2L
- addx A2H,A2H
- bra _top
-
-_done:
- mov.w S0,A0
- mov.w S1,A1
- POPP S2P
- POPP S1P
- POPP S0P
- rts
-
-#else /* __H8300H__ */
-
-#ifdef __H8300H__
- .h8300h
-#endif
-
-#ifdef __H8300S__
- .h8300s
-#endif
-
- .global ___mulsi3
-___mulsi3:
- sub.l A2P,A2P
-
- ; while (a)
-_top: mov.l A0P,A0P
- beq _done
-
- ; if (a & 1)
- bld #0,A0L
- bcc _nobit
-
- ; r += b
- add.l A1P,A2P
-
-_nobit:
- ; a >>= 1
- shlr.l A0P
-
- ; b <<= 1
- shll.l A1P
- bra _top
-
-_done:
- mov.l A2P,A0P
- rts
-
-#endif
-#endif /* L_mulsi3 */
diff --git a/gcc/config/h8300/t-h8300 b/gcc/config/h8300/t-h8300
deleted file mode 100644
index 236ebccc8c4..00000000000
--- a/gcc/config/h8300/t-h8300
+++ /dev/null
@@ -1,26 +0,0 @@
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = h8300/lib1funcs.asm
-LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3
-
-# We do not have DF or DI types, so fake out the libgcc2 compilation.
-LIBGCC2_CFLAGS = -g -O2 -DDF=SF -DDI=SI $(GCC_CFLAGS) $(LIBGCC2_INCLUDES)
-
-LIB2FUNCS_EXTRA = fp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- echo '#define FLOAT_ONLY' >> fp-bit.c
- echo '#define SMALL_MACHINE' >> fp-bit.c
- echo '#ifdef __H8300__' >> fp-bit.c
- echo '#define CMPtype HItype' >> fp-bit.c
- echo '#else' >> fp-bit.c
- echo '#define CMPtype SItype' >> fp-bit.c
- echo '#endif' >> fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-MULTILIB_OPTIONS = mh/ms mint32
-MULTILIB_DIRNAMES = h8300h h8300s int32
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
diff --git a/gcc/config/h8300/xm-h8300.h b/gcc/config/h8300/xm-h8300.h
deleted file mode 100644
index 7fde9e6cd87..00000000000
--- a/gcc/config/h8300/xm-h8300.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Configuration for GNU C-compiler for H8/300.
- Copyright (C) 1993 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 16
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* If compiled with GNU C, use the built-in alloca */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#define USE_C_ALLOCA
-#endif
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
diff --git a/gcc/config/i370/i370.c b/gcc/config/i370/i370.c
deleted file mode 100644
index 6f59c5c4ffd..00000000000
--- a/gcc/config/i370/i370.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/* Subroutines for insn-output.c for System/370.
- Copyright (C) 1989, 1993, 1995 Free Software Foundation, Inc.
- Contributed by Jan Stein (jan@cd.chalmers.se).
- Modified for MVS C/370 by Dave Pitts (dpitts@nyx.cs.du.edu)
-
-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 <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "recog.h"
-
-
-/* Label node, this structure is used to keep track of labels on the
- current page. */
-typedef struct label_node
- {
- struct label_node *label_next;
- int label_id;
- int label_page;
- }
-label_node_t;
-
-/* Is 1 when a label has been generated and the base register must be
- reloaded. */
-int mvs_label_emitted = 0;
-
-/* Current function starting base page. */
-int function_base_page;
-
-/* Length of the current page code. */
-int mvs_page_code;
-
-/* Length of the current page literals. */
-int mvs_page_lit;
-
-/* Current function name. */
-char *mvs_function_name = 0;
-
-/* Current function name length. */
-int mvs_function_name_length = 0;
-
-/* Page number for multi-page functions. */
-int mvs_page_num = 0;
-
-/* Label node list anchor. */
-static label_node_t *label_anchor = 0;
-
-/* Label node free list anchor. */
-static label_node_t *free_anchor = 0;
-
-/* Assembler source file descriptor. */
-static FILE *assembler_source = 0;
-
-/* Define the length of the internal MVS function table. */
-#define MVS_FUNCTION_TABLE_LENGTH 32
-
-/* C/370 internal function table. These functions use non-standard linkage
- and must handled in a special manner. */
-static char *mvs_function_table[MVS_FUNCTION_TABLE_LENGTH] =
-{
- "ceil", "edc_acos", "edc_asin", "edc_ata2", "edc_atan", "edc_cos",
- "edc_cosh", "edc_erf", "edc_erfc", "edc_exp", "edc_gamm", "edc_lg10",
- "edc_log", "edc_sin", "edc_sinh", "edc_sqrt", "edc_tan", "edc_tanh",
- "fabs", "floor", "fmod", "frexp", "hypot", "j0",
- "j1", "jn", "ldexp", "modf", "pow", "y0",
- "y1", "yn"
-};
-
-/* ASCII to EBCDIC conversion table. */
-#if defined(TARGET_EBCDIC) && !defined(HOST_EBCDIC)
-static unsigned char ascebc[256] =
-{
- /*00 NL SH SX EX ET NQ AK BL */
- 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F,
- /*08 BS HT LF VT FF CR SO SI */
- 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- /*10 DL D1 D2 D3 D4 NK SN EB */
- 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26,
- /*18 CN EM SB EC FS GS RS US */
- 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F,
- /*20 SP ! " # $ % & ' */
- 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D,
- /*28 ( ) * + , - . / */
- 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,
- /*30 0 1 2 3 4 5 6 7 */
- 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
- /*38 8 9 : ; < = > ? */
- 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,
- /*40 @ A B C D E F G */
- 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
- /*48 H I J K L M N O */
- 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
- /*50 P Q R S T U V W */
- 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6,
- /*58 X Y Z [ \ ] ^ _ */
- 0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D,
- /*60 ` a b c d e f g */
- 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- /*68 h i j k l m n o */
- 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
- /*70 p q r s t u v w */
- 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
- /*78 x y z { | } ~ DL */
- 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF
-};
-#endif
-
-/* EBCDIC to ASCII conversion table. */
-#if defined(HOST_EBCDIC) && !defined(TARGET_EBCDIC)
-unsigned char ebcasc[256] =
-{
- /*00 NU SH SX EX PF HT LC DL */
- 0x00, 0x01, 0x02, 0x03, 0x00, 0x09, 0x00, 0x7F,
- /*08 SM VT FF CR SO SI */
- 0x00, 0x00, 0x00, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- /*10 DE D1 D2 TM RS NL BS IL */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x0A, 0x08, 0x00,
- /*18 CN EM CC C1 FS GS RS US */
- 0x18, 0x19, 0x00, 0x00, 0x1C, 0x1D, 0x1E, 0x1F,
- /*20 DS SS FS BP LF EB EC */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x17, 0x1B,
- /*28 SM C2 EQ AK BL */
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07, 0x00,
- /*30 SY PN RS UC ET */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
- /*38 C3 D4 NK SU */
- 0x00, 0x00, 0x00, 0x00, 0x14, 0x15, 0x00, 0x1A,
- /*40 SP */
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*48 . < ( + | */
- 0x00, 0x00, 0x00, 0x2E, 0x3C, 0x28, 0x2B, 0x7C,
- /*50 & */
- 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*58 ! $ * ) ; ^ */
- 0x00, 0x00, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E,
- /*60 - / */
- 0x2D, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*68 , % _ > ? */
- 0x00, 0x00, 0x00, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,
- /*70 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*78 ` : # @ ' = " */
- 0x00, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,
- /*80 a b c d e f g */
- 0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- /*88 h i { */
- 0x68, 0x69, 0x00, 0x7B, 0x00, 0x00, 0x00, 0x00,
- /*90 j k l m n o p */
- 0x00, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70,
- /*98 q r } */
- 0x71, 0x72, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x00,
- /*A0 ~ s t u v w x */
- 0x00, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
- /*A8 y z [ */
- 0x79, 0x7A, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00,
- /*B0 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*B8 ] */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00,
- /*C0 { A B C D E F G */
- 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- /*C8 H I */
- 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*D0 } J K L M N O P */
- 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
- /*D8 Q R */
- 0x51, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*E0 \ S T U V W X */
- 0x5C, 0x00, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- /*E8 Y Z */
- 0x59, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /*F0 0 1 2 3 4 5 6 7 */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- /*F8 8 9 */
- 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
-};
-#endif
-
-/* Map characters from one character set to another.
- C is the character to be translated. */
-
-char
-mvs_map_char (c)
- char c;
-{
-#if defined(TARGET_EBCDIC) && !defined(HOST_EBCDIC)
- return ascebc[c];
-#else
-#if defined(HOST_EBCDIC) && !defined(TARGET_EBCDIC)
- return ebcasc[c];
-#else
- return c;
-#endif
-#endif
-}
-
-/* Emit reload of base register if indicated. This is to eliminate multiple
- reloads when several labels are generated pointing to the same place
- in the code. */
-
-int
-check_label_emit (void)
-{
- if (mvs_label_emitted)
- {
- mvs_label_emitted = 0;
- mvs_page_code += 4;
- fprintf (assembler_source, "\tL\t%d,%d(,%d)\n",
- BASE_REGISTER, (mvs_page_num - function_base_page) * 4,
- PAGE_REGISTER);
- }
-}
-
-/* Add the label to the current page label list. If a free element is available
- it will be used for the new label. Otherwise, a label element will be
- allocated from memory.
- ID is the label number of the label being added to the list. */
-
-int
-mvs_add_label (id)
- int id;
-{
- label_node_t *lp;
-
- if (free_anchor)
- {
- lp = free_anchor;
- free_anchor = lp->label_next;
- }
- else
- {
- lp = (label_node_t *) malloc (sizeof (label_node_t));
- if (lp == 0)
- {
- fatal ("virtual memory exhausted\n");
- abort ();
- }
- }
- lp->label_id = id;
- lp->label_page = mvs_page_num;
- lp->label_next = label_anchor;
- label_anchor = lp;
-}
-
-/* Check to see if the label is in the list. If 1 is returned then a load
- and branch on register must be generated.
- ID is the label number of the label being checked. */
-
-int
-mvs_check_label (id)
- int id;
-{
- label_node_t *lp;
-
- for (lp = label_anchor; lp; lp = lp->label_next)
- {
- if (lp->label_id == id)
- return 1;
- }
- return 0;
-}
-
-/* The label list for the current page freed by linking the list onto the free
- label element chain. */
-
-int
-mvs_free_label (void)
-{
- if (label_anchor)
- {
- if (free_anchor)
- label_anchor->label_next = free_anchor;
- free_anchor = label_anchor;
- }
- label_anchor = 0;
-}
-
-/* If the page size limit is reached a new code page is started, and the base
- register is set to it. This page break point is counted conservatively,
- most literals that have the same value are collapsed by the assembler.
- True is returned when a new page is started.
- FILE is the assembler output file descriptor.
- CODE is the length, in bytes, of the instruction to be emitted.
- LIT is the length of the literal to be emitted. */
-
-int
-mvs_check_page (file, code, lit)
- FILE *file;
- int code, lit;
-{
- if (file)
- assembler_source = file;
-
- if (mvs_page_code + code + mvs_page_lit + lit > MAX_MVS_PAGE_LENGTH)
- {
- fprintf (assembler_source, "\tB\tPGE%d\n", mvs_page_num);
- fprintf (assembler_source, "\tDS\t0F\n");
- fprintf (assembler_source, "\tLTORG\n");
- fprintf (assembler_source, "\tDS\t0F\n");
- fprintf (assembler_source, "PGE%d\tEQU\t*\n", mvs_page_num);
- fprintf (assembler_source, "\tDROP\t%d\n", BASE_REGISTER);
- mvs_page_num++;
- fprintf (assembler_source, "\tBALR\t%d,0\n", BASE_REGISTER);
- fprintf (assembler_source, "PG%d\tEQU\t*\n", mvs_page_num);
- fprintf (assembler_source, "\tUSING\t*,%d\n", BASE_REGISTER);
- mvs_free_label ();
- mvs_page_code = code;
- mvs_page_lit = lit;
- return 1;
- }
- mvs_page_code += code;
- mvs_page_lit += lit;
- return 0;
-}
-
-/* Check for C/370 runtime function, they don't use standard calling
- conventions. True is returned if the function is in the table.
- NAME is the name of the current function. */
-
-int
-mvs_function_check (name)
- char *name;
-{
- int lower, middle, upper;
- int i;
-
- lower = 0;
- upper = MVS_FUNCTION_TABLE_LENGTH - 1;
- while (lower <= upper)
- {
- middle = (lower + upper) / 2;
- i = strcmp (name, mvs_function_table[middle]);
- if (i == 0)
- return 1;
- if (i < 0)
- upper = middle - 1;
- else
- lower = middle + 1;
- }
- return 0;
-}
-
-
-/* Return 1 if OP is a valid S operand for an RS, SI or SS type instruction.
- OP is the current operation.
- MODE is the current operation mode. */
-
-int
-s_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- extern int volatile_ok;
- register enum rtx_code code = GET_CODE (op);
-
- if (CONSTANT_ADDRESS_P (op))
- return 1;
- if (mode == VOIDmode || GET_MODE (op) != mode)
- return 0;
- if (code == MEM)
- {
- register rtx x = XEXP (op, 0);
-
- if (!volatile_ok && op->volatil)
- return 0;
- if (REG_P (x) && REG_OK_FOR_BASE_P (x))
- return 1;
- if (GET_CODE (x) == PLUS
- && REG_P (XEXP (x, 0)) && REG_OK_FOR_BASE_P (XEXP (x, 0))
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && (unsigned) INTVAL (XEXP (x, 1)) < 4096)
- return 1;
- }
- return 0;
-}
-
-
-/* Return 1 if OP is a valid R or S operand for an RS, SI or SS type
- instruction.
- OP is the current operation.
- MODE is the current operation mode. */
-
-int
-r_or_s_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- extern int volatile_ok;
- register enum rtx_code code = GET_CODE (op);
-
- if (CONSTANT_ADDRESS_P (op))
- return 1;
- if (mode == VOIDmode || GET_MODE (op) != mode)
- return 0;
- if (code == REG)
- return 1;
- else if (code == MEM)
- {
- register rtx x = XEXP (op, 0);
-
- if (!volatile_ok && op->volatil)
- return 0;
- if (REG_P (x) && REG_OK_FOR_BASE_P (x))
- return 1;
- if (GET_CODE (x) == PLUS
- && REG_P (XEXP (x, 0)) && REG_OK_FOR_BASE_P (XEXP (x, 0))
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && (unsigned) INTVAL (XEXP (x, 1)) < 4096)
- return 1;
- }
- return 0;
-}
-
-
-/* Return 1 if the next instruction is an unsigned jump instruction.
- INSN is the current instruction. */
-
-unsigned_jump_follows_p (insn)
- register rtx insn;
-{
- insn = NEXT_INSN (insn);
- if (GET_CODE (insn) != JUMP_INSN)
- return 0;
-
- insn = XEXP (insn, 3);
- if (GET_CODE (insn) != SET)
- return 0;
-
- if (GET_CODE (XEXP (insn, 0)) != PC)
- return 0;
-
- insn = XEXP (insn, 1);
- if (GET_CODE (insn) != IF_THEN_ELSE)
- return 0;
-
- insn = XEXP (insn, 0);
- return GET_CODE (insn) != GE && GET_CODE (insn) != GT
- && GET_CODE (insn) != LE && GET_CODE (insn) != LT;
-}
diff --git a/gcc/config/i370/i370.h b/gcc/config/i370/i370.h
deleted file mode 100644
index 576a44912f7..00000000000
--- a/gcc/config/i370/i370.h
+++ /dev/null
@@ -1,1543 +0,0 @@
-/* Definitions of target machine for GNU compiler. System/370 version.
- Copyright (C) 1989, 1993, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Jan Stein (jan@cd.chalmers.se).
- Modified for C/370 MVS by Dave Pitts (dpitts@nyx.cs.du.edu)
-
-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. */
-
-#ifdef sun
-#include <sys/types.h>
-#include <ctype.h>
-#endif
-#include <time.h>
-
-#define TARGET_VERSION printf (" (370/MVS)");
-
-/* Options for the preprocessor for this target machine. */
-
-#define CPP_SPEC "-trigraphs"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-DGCC -Dgcc -DMVS -Dmvs -Asystem(mvs) -Acpu(i370) -Amachine(i370)"
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* The sizes of the code and literals on the current page. */
-
-extern int mvs_page_code, mvs_page_lit;
-
-/* The current page number and the base page number for the function. */
-
-extern int mvs_page_num, function_base_page;
-
-/* True if a label has been emitted. */
-
-extern int mvs_label_emitted;
-
-/* The name of the current function. */
-
-extern char *mvs_function_name;
-
-/* The length of the function name malloc'd area. */
-
-extern int mvs_function_name_length;
-
-/* The amount of space used for outgoing arguments. */
-
-extern int current_function_outgoing_args_size;
-
-/* Compile using char instructions (mvc, nc, oc, xc). On 4341 use this since
- these are more than twice as fast as load-op-store.
- On 3090 don't use this since load-op-store is much faster. */
-
-#define TARGET_CHAR_INSTRUCTIONS (target_flags & 1)
-
-/* Default target switches */
-
-#define TARGET_DEFAULT 1
-
-/* Macro to define tables used to set the flags. This is a list in braces
- of pairs in braces, each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
-{ { "char-instructions", 1}, \
- { "no-char-instructions", -1}, \
- { "", TARGET_DEFAULT} }
-
-/* To use IBM supplied macro function prologue and epilogue, define the
- following to 1. Should only be needed if IBM changes the definition
- of their prologue and epilogue. */
-
-#define MACROPROLOGUE 0
-#define MACROEPILOGUE 0
-
-/* Target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered in instructions
- that operate on numbered bit-fields. */
-
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if MS word of a multiword is the lowest numbered. */
-
-#define WORDS_BIG_ENDIAN 1
-
-/* Number of bits in an addressable storage unit. */
-
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register. */
-
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer. See also the macro `Pmode' defined below. */
-
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing pointers in memory. */
-
-#define POINTER_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-
-#define STACK_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-
-#define FUNCTION_BOUNDARY 32
-
-/* There is no point aligning anything to a rounder boundary than this. */
-
-#define BIGGEST_ALIGNMENT 64
-
-/* Alignment of field after `int : 0' in a structure. */
-
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Define this if move instructions will actually fail to work when given
- unaligned data. */
-
-#define STRICT_ALIGNMENT 0
-
-/* Define target floating point format. */
-
-#define TARGET_FLOAT_FORMAT IBM_FLOAT_FORMAT
-
-/* Define character mapping for cross-compiling. */
-
-#define TARGET_EBCDIC 1
-
-#ifdef HOST_EBCDIC
-#define MAP_CHARACTER(c) ((char)(c))
-#else
-#define MAP_CHARACTER(c) ((char)mvs_map_char (c))
-#endif
-
-/* Define maximum length of page minus page escape overhead. */
-
-#define MAX_MVS_PAGE_LENGTH 4080
-
-/* Define if special allocation order desired. */
-
-#define REG_ALLOC_ORDER \
-{ 0, 1, 2, 3, 14, 15, 12, 10, 9, 8, 7, 6, 5, 4, 16, 17, 18, 19, 11, 13 }
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers. The hardware registers are
- assigned numbers for the compiler from 0 to just below
- FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
- For the 370, we give the data registers numbers 0-15,
- and the floating point registers numbers 16-19. */
-
-#define FIRST_PSEUDO_REGISTER 20
-
-/* Define base and page registers. */
-
-#define BASE_REGISTER 3
-#define PAGE_REGISTER 4
-
-/* 1 for registers that have pervasive standard uses and are not available
- for the register allocator. On the 370 under C/370, R13 is stack (DSA)
- pointer, R12 is the TCA pointer, R3 is the base register, R4 is the page
- origin table pointer and R11 is the arg pointer. */
-
-#define FIXED_REGISTERS \
-{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 }
-/*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19*/
-
-/* 1 for registers not available across function calls. These must include
- the FIXED_REGISTERS and also any registers that can be used without being
- saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- NOTE: all floating registers are undefined across calls. */
-
-#define CALL_USED_REGISTERS \
-{ 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
-/*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19*/
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((REGNO) > 15 ? 1 : (GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the 370, the cpu registers can hold QI, HI, SI, SF and DF. The
- even registers can hold DI. The floating point registers can hold
- either SF or DF. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((REGNO) < 16 ? ((REGNO) & 1) == 0 || (MODE) != DImode \
- : (MODE) == SFmode || (MODE) == DFmode)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers when one has
- mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (((MODE1) == SFmode || (MODE1) == DFmode) \
- == ((MODE2) == SFmode || (MODE2) == DFmode))
-
-/* Mark external references. */
-
-#define ENCODE_SECTION_INFO(decl) \
- if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* 370 PC isn't overloaded on a register. */
-
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-
-#define STACK_POINTER_REGNUM 13
-
-/* Base register for access to local variables of the function. */
-
-#define FRAME_POINTER_REGNUM 13
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms may be
- accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-
-#define FRAME_POINTER_REQUIRED 1
-
-/* Base register for access to arguments of the function. */
-
-#define ARG_POINTER_REGNUM 11
-
-/* Register in which static-chain is passed to a function. */
-
-#define STATIC_CHAIN_REGNUM 10
-
-/* Register in which address to store a structure value is passed to
- a function. */
-
-#define STRUCT_VALUE_REGNUM 1
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-enum reg_class
- {
- NO_REGS, ADDR_REGS, DATA_REGS,
- FP_REGS, ALL_REGS, LIM_REG_CLASSES
- };
-
-#define GENERAL_REGS DATA_REGS
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
-{ "NO_REGS", "ADDR_REGS", "DATA_REGS", "FP_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes. This is an initializer for
- a vector of HARD_REG_SET of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS {0, 0x0fffe, 0x0ffff, 0xf0000, 0xfffff}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) >= 16 ? FP_REGS : (REGNO) != 0 ? ADDR_REGS : DATA_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS ADDR_REGS
-#define BASE_REG_CLASS ADDR_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'a' ? ADDR_REGS : \
- ((C) == 'd' ? DATA_REGS : \
- ((C) == 'f' ? FP_REGS : NO_REGS)))
-
-/* The letters I, J, K, L and M in a register constraint string can be used
- to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (unsigned) (VALUE) < 256 : \
- (C) == 'J' ? (unsigned) (VALUE) < 4096 : \
- (C) == 'K' ? (VALUE) >= -32768 && (VALUE) < 32768 : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
-
-/* Given an rtx X being reloaded into a reg required to be in class CLASS,
- return the class of reg to actually use. In general this is just CLASS;
- but on some machines in some cases it is preferable to use a more
- restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X, CLASS) \
- (GET_CODE(X) == CONST_DOUBLE ? FP_REGS : \
- GET_CODE(X) == CONST_INT ? DATA_REGS : \
- GET_CODE(X) == LABEL_REF || \
- GET_CODE(X) == SYMBOL_REF || \
- GET_CODE(X) == CONST ? ADDR_REGS : (CLASS))
-
-/* Return the maximum number of consecutive registers needed to represent
- mode MODE in a register of class CLASS. */
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FP_REGS ? 1 : \
- (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack makes the stack pointer a
- smaller address. */
-
-/* #define STACK_GROWS_DOWNWARD */
-
-/* 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 goes at a more negative offset in the frame. */
-
-/* #define FRAME_GROWS_DOWNWARD */
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-
-#define STARTING_FRAME_OFFSET \
- (STACK_POINTER_OFFSET + current_function_outgoing_args_size)
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = STARTING_FRAME_OFFSET
-
-/* If we generate an insn to push BYTES bytes, this says how many the stack
- pointer really advances by. On the 370, we have no push instruction. */
-
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* Accumulate the outgoing argument count so we can request the right
- DSA size and determine stack offset. */
-
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Define offset from stack pointer, to location where a parm can be
- pushed. */
-
-#define STACK_POINTER_OFFSET 148
-
-/* Offset of first parameter from the argument pointer register value. */
-
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* 1 if N is a possible register number for function argument passing.
- On the 370, no registers are used in this way. */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list during
- the scan of that argument list. This data type should hold all
- necessary information about the function itself and about the args
- processed so far, enough to enable macros such as FUNCTION_ARG to
- determine where the next arg should go. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to
- a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument of mode MODE and
- data type TYPE. (TYPE is null for libcalls where that information
- may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) == DFmode || (MODE) == SFmode \
- ? 256 \
- : (MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) / 4 \
- : (int_size_in_bytes (TYPE) + 3) / 4))
-
-/* Define where to put the arguments to a function. Value is zero to push
- the argument on the stack, or a hard register in which to store the
- argument. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
-
-/* For an arg passed partly in registers and partly in memory, this is the
- number of registers used. For args passed entirely in registers or
- entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
-
-/* Define if returning from a function call automatically pops the
- arguments described by the number-of-args field in the call. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function. VALTYPE is the
- data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 15. */
-
-#define RET_REG(MODE) ((MODE) == DFmode || (MODE) == SFmode ? 16 : 15)
-
-/* On the 370 the return value is in R15 or R16. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx(REG, TYPE_MODE (VALTYPE), RET_REG(TYPE_MODE(VALTYPE)))
-
-/* Define how to find the value returned by a library function assuming
- the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx(REG, MODE, RET_REG(MODE))
-
-/* 1 if N is a possible register number for a function value.
- On the 370 under C/370, R15 and R16 are thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 15 || (N) == 16)
-
-/* This macro definition sets up a default value for `main' to return. */
-
-#define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node)
-
-/* This macro generates the assembly code for function entry.
- All of the C/370 environment is preserved. */
-
-#if MACROPROLOGUE == 1
-#define FUNCTION_PROLOGUE(FILE, LSIZE) \
-{ \
- fprintf (FILE, "\tEDCPRLG USRDSAL=%d,BASEREG=%d\n", \
- STACK_POINTER_OFFSET + LSIZE - 120 + \
- current_function_outgoing_args_size, BASE_REGISTER); \
- fprintf (FILE, "PG%d\tEQU\t*\n", mvs_page_num ); \
- fprintf (FILE, "\tLR\t11,1\n"); \
- fprintf (FILE, "\tL\t%d,=A(PGT%d)\n", PAGE_REGISTER, mvs_page_num); \
- mvs_page_code = 6; \
- mvs_page_lit = 4; \
- mvs_check_page (FILE, 0, 0); \
- function_base_page = mvs_page_num; \
-}
-#else /* MACROPROLOGUE != 1 */
-#define FUNCTION_PROLOGUE(FILE, LSIZE) \
-{ \
- static int function_label_index = 1; \
- static int function_first = 0; \
- static int function_year, function_month, function_day; \
- static int function_hour, function_minute, function_second; \
- int i; \
- if (!function_first) \
- { \
- struct tm *function_time; \
- time_t lcltime; \
- time (&lcltime); \
- function_time = localtime (&lcltime); \
- function_year = function_time->tm_year + 1900; \
- function_month = function_time->tm_mon + 1; \
- function_day = function_time->tm_mday; \
- function_hour = function_time->tm_hour; \
- function_minute = function_time->tm_min; \
- function_second = function_time->tm_sec; \
- fprintf (FILE, "PPA2\tDS\t0F\n"); \
- fprintf (FILE, "\tDC\tX'03',X'00',X'33',X'00'\n"); \
- fprintf (FILE, "\tDC\tV(CEESTART),A(0)\n"); \
- fprintf (FILE, "\tDC\tA(CEETIMES)\n"); \
- fprintf (FILE, "CEETIMES\tDS\t0F\n"); \
- fprintf (FILE, "\tDC\tCL4'%d',CL4'%02d%02d',CL6'%02d%02d00'\n", \
- function_year, function_month, function_day, \
- function_hour, function_minute, function_second); \
- fprintf (FILE, "\tDC\tCL2'01',CL4'0100'\n"); \
- } \
- fprintf (FILE, "$DSD%03d\tDSECT\n", function_label_index); \
- fprintf (FILE, "\tDS\tD\n"); \
- fprintf (FILE, "\tDS\tCL(%d)\n", STACK_POINTER_OFFSET + LSIZE \
- + current_function_outgoing_args_size); \
- fprintf (FILE, "\tORG\t$DSD%03d\n", function_label_index); \
- fprintf (FILE, "\tDS\tCL(120+8)\n"); \
- fprintf (FILE, "\tORG\n"); \
- fprintf (FILE, "\tDS\t0D\n"); \
- fprintf (FILE, "$DSL%03d\tEQU\t*-$DSD%03d-8\n", function_label_index, \
- function_label_index); \
- fprintf (FILE, "\tDS\t0H\n"); \
- assemble_name (FILE, mvs_function_name); \
- fprintf (FILE, "\tEQU\t*\n"); \
- fprintf (FILE, "\tUSING\t*,15\n"); \
- fprintf (FILE, "\tB\tFPL%03d\n", function_label_index); \
- fprintf (FILE, "\tDC\tAL1(FPL%03d+4-*)\n", function_label_index + 1); \
- fprintf (FILE, "\tDC\tX'CE',X'A0',AL1(16)\n"); \
- fprintf (FILE, "\tDC\tAL4(PPA2)\n"); \
- fprintf (FILE, "\tDC\tAL4(0)\n"); \
- fprintf (FILE, "\tDC\tAL4($DSL%03d)\n", function_label_index); \
- fprintf (FILE, "FPL%03d\tEQU\t*\n", function_label_index + 1); \
- fprintf (FILE, "\tDC\tAL2(%d),C'%s'\n", strlen (mvs_function_name), \
- mvs_function_name); \
- fprintf (FILE, "FPL%03d\tDS\t0H\n", function_label_index); \
- fprintf (FILE, "\tSTM\t14,12,12(13)\n"); \
- fprintf (FILE, "\tL\t2,76(,13)\n"); \
- fprintf (FILE, "\tL\t0,16(,15)\n"); \
- fprintf (FILE, "\tALR\t0,2\n"); \
- fprintf (FILE, "\tCL\t0,12(,12)\n"); \
- fprintf (FILE, "\tBNH\t*+10\n"); \
- fprintf (FILE, "\tL\t15,116(,12)\n"); \
- fprintf (FILE, "\tBALR\t14,15\n"); \
- fprintf (FILE, "\tL\t15,72(,13)\n"); \
- fprintf (FILE, "\tSTM\t15,0,72(2)\n"); \
- fprintf (FILE, "\tMVI\t0(2),X'10'\n"); \
- fprintf (FILE, "\tST\t2,8(,13)\n "); \
- fprintf (FILE, "\tST\t13,4(,2)\n "); \
- fprintf (FILE, "\tLR\t13,2\n"); \
- fprintf (FILE, "\tDROP\t15\n"); \
- fprintf (FILE, "\tBALR\t%d,0\n", BASE_REGISTER); \
- fprintf (FILE, "PG%d\tEQU\t*\n", mvs_page_num ); \
- fprintf (FILE, "\tUSING\t*,%d\n", BASE_REGISTER); \
- fprintf (FILE, "\tLR\t11,1\n"); \
- fprintf (FILE, "\tL\t%d,=A(PGT%d)\n", PAGE_REGISTER, mvs_page_num); \
- mvs_page_code = 4; \
- mvs_page_lit = 4; \
- mvs_check_page (FILE, 0, 0); \
- function_base_page = mvs_page_num; \
- function_first = 1; \
- function_label_index += 2; \
-}
-#endif /* MACROPROLOGUE */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
-{ \
- if (strlen (NAME) * 2 > mvs_function_name_length) \
- { \
- if (mvs_function_name) \
- free (mvs_function_name); \
- mvs_function_name = 0; \
- } \
- if (!mvs_function_name) \
- { \
- mvs_function_name_length = strlen (NAME) * 2; \
- mvs_function_name = (char *) malloc (mvs_function_name_length); \
- if (mvs_function_name == 0) \
- { \
- fatal ("virtual memory exceeded"); \
- abort (); \
- } \
- } \
- if (!strcmp (NAME, "main")) \
- strcpy (mvs_function_name, "gccmain"); \
- else \
- strcpy (mvs_function_name, NAME); \
-}
-
-/* This macro generates the assembly code for function exit, on machines
- that need it. If FUNCTION_EPILOGUE is not defined then individual
- return instructions are generated for each return statement. Args are
- same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#if MACROEPILOGUE == 1
-#define FUNCTION_EPILOGUE(FILE, LSIZE) \
-{ \
- int i; \
- check_label_emit(); \
- mvs_check_page (FILE,14,0); \
- fprintf (FILE, "\tEDCEPIL\n"); \
- mvs_page_num++; \
- fprintf (FILE, "\tDS\t0F\n" ); \
- fprintf (FILE, "\tLTORG\n"); \
- fprintf (FILE, "\tDS\t0F\n"); \
- fprintf (FILE, "PGT%d\tEQU\t*\n", function_base_page); \
- mvs_free_label(); \
- for ( i = function_base_page; i < mvs_page_num; i++ ) \
- fprintf (FILE, "\tDC\tA(PG%d)\n", i); \
-}
-#else /* MACROEPILOGUE != 1 */
-#define FUNCTION_EPILOGUE(FILE, LSIZE) \
-{ \
- int i; \
- check_label_emit(); \
- mvs_check_page (FILE,14,0); \
- fprintf (FILE, "\tL\t13,4(,13)\n"); \
- fprintf (FILE, "\tL\t14,12(,13)\n"); \
- fprintf (FILE, "\tLM\t2,12,28(13)\n"); \
- fprintf (FILE, "\tBALR\t1,14\n"); \
- fprintf (FILE, "\tDC\tA("); \
- mvs_page_num++; \
- assemble_name (FILE, mvs_function_name); \
- fprintf (FILE, ")\n" ); \
- fprintf (FILE, "\tDS\t0F\n" ); \
- fprintf (FILE, "\tLTORG\n"); \
- fprintf (FILE, "\tDS\t0F\n"); \
- fprintf (FILE, "PGT%d\tEQU\t*\n", function_base_page); \
- mvs_free_label(); \
- for ( i = function_base_page; i < mvs_page_num; i++ ) \
- fprintf (FILE, "\tDC\tA(PG%d)\n", i); \
-}
-#endif /* MACROEPILOGUE */
-
-
-/* Output assembler code for a block containing the constant parts of a
- trampoline, leaving space for the variable parts.
-
- On the 370, the trampoline contains these instructions:
-
- BALR 14,0
- USING *,14
- L STATIC_CHAIN_REGISTER,X
- L 15,Y
- BR 15
- X DS 0F
- Y DS 0F */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x05E0)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x5800 | \
- STATIC_CHAIN_REGNUM << 4)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xE00A)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x58F0)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xE00E)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x07FF)); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 20
-
-/* Emit RTL insns to initialize the variable parts of a trampoline. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 12)), CXT); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 16)), FNADDR); \
-}
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "Error: No profiling available.\n")
-
-/* Define EXIT_IGNORE_STACK if, when returning from a function, the stack
- pointer does not matter (provided there is a frame pointer). */
-
-#define EXIT_IGNORE_STACK 1
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* These assume that REGNO is a hard or pseudo reg number. They give
- nonzero only if REGNO is a hard reg of the suitable class or a pseudo
- reg currently allocated to a suitable hard reg.
- These definitions are NOT overridden anywhere. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
- (((REGNO) > 0 && (REGNO) < 16) \
- || (reg_renumber[REGNO] > 0 && reg_renumber[REGNO] < 16))
-
-#define REGNO_OK_FOR_BASE_P(REGNO) REGNO_OK_FOR_INDEX_P(REGNO)
-
-#define REGNO_OK_FOR_DATA_P(REGNO) \
- ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
-
-#define REGNO_OK_FOR_FP_P(REGNO) \
- ((unsigned) ((REGNO) - 16) < 4 || (unsigned) (reg_renumber[REGNO] - 16) < 4)
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class. */
-
-/* 1 if X is a data register. */
-
-#define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
-
-/* 1 if X is an fp register. */
-
-#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
-
-/* 1 if X is an address register. */
-
-#define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE \
- || (GET_CODE (X) == CONST \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == LABEL_REF) \
- || (GET_CODE (X) == CONST \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \
- && !SYMBOL_REF_FLAG (XEXP (XEXP (X, 0), 0))))
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check
- its validity for a certain class. We have two alternate definitions
- for each of them. The usual definition accepts all pseudo regs; the
- other rejects them all. The symbol REG_OK_STRICT causes the latter
- definition to be used.
-
- Most source files want to accept pseudo regs in the hope that they will
- get allocated to the class that the insn wants them to be in.
- Some source files that are used after register allocation
- need to be strict. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index or if it is
- a pseudo reg. */
-
-#define REG_OK_FOR_INDEX_P(X) \
- ((REGNO(X) > 0 && REGNO(X) < 16) || REGNO(X) >= 20)
-
-/* Nonzero if X is a hard reg that can be used as a base reg or if it is
- a pseudo reg. */
-
-#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_INDEX_P(X)
-
-#else /* REG_OK_STRICT */
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P(REGNO(X))
-
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P(REGNO(X))
-
-#endif /* REG_OK_STRICT */
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a
- valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
- except for CONSTANT_ADDRESS_P which is actually machine-independent. */
-
-#define COUNT_REGS(X, REGS, FAIL) \
- if (REG_P (X) && REG_OK_FOR_BASE_P (X)) \
- REGS += 1; \
- else if (GET_CODE (X) != CONST_INT || (unsigned) INTVAL (X) >= 4096) \
- goto FAIL;
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ \
- if (REG_P (X) && REG_OK_FOR_BASE_P (X)) \
- goto ADDR; \
- if (GET_CODE (X) == PLUS) \
- { \
- int regs = 0; \
- rtx x0 = XEXP (X, 0); \
- rtx x1 = XEXP (X, 1); \
- if (GET_CODE (x0) == PLUS) \
- { \
- COUNT_REGS (XEXP (x0, 0), regs, FAIL); \
- COUNT_REGS (XEXP (x0, 1), regs, FAIL); \
- COUNT_REGS (x1, regs, FAIL); \
- if (regs == 2) \
- goto ADDR; \
- } \
- else if (GET_CODE (x1) == PLUS) \
- { \
- COUNT_REGS (x0, regs, FAIL); \
- COUNT_REGS (XEXP (x1, 0), regs, FAIL); \
- COUNT_REGS (XEXP (x1, 1), regs, FAIL); \
- if (regs == 2) \
- goto ADDR; \
- } \
- else \
- { \
- COUNT_REGS (x0, regs, FAIL); \
- COUNT_REGS (x1, regs, FAIL); \
- if (regs != 0) \
- goto ADDR; \
- } \
- } \
- FAIL: ; \
-}
-
-/* The 370 has no mode dependent addresses. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c. */
-
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-{ \
- if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
- copy_to_mode_reg (SImode, XEXP (X, 1))); \
- if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
- copy_to_mode_reg (SImode, XEXP (X, 0))); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
- force_operand (XEXP (X, 0), 0)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
- force_operand (XEXP (X, 1), 0)); \
- if (memory_address_p (MODE, X)) \
- goto WIN; \
-}
-
-/* Specify the machine mode that this machine uses for the index in the
- tablejump instruction. */
-
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table to contain
- offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* Define this if fixuns_trunc is the same as fix_trunc. */
-
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* We use "unsigned char" as default. */
-
-#define DEFAULT_SIGNED_CHAR 0
-
-/* This is the kind of divide that is easiest to do in the general case. */
-
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Max number of bytes we can move from memory to memory in one reasonably
- fast instruction. */
-
-#define MOVE_MAX 256
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-
-#define SLOW_ZERO_EXTEND
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-
-#define SLOW_BYTE_ACCESS 1
-
-/* Define if shifts truncate the shift count which implies one can omit
- a sign-extension or zero-extension of a shift count. */
-
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) (OUTPREC != 16)
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-/* #define STORE_FLAG_VALUE -1 */
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-
-#define PROMOTE_PROTOTYPES
-
-/* Don't perform CSE on function addresses. */
-
-#define NO_FUNCTION_CSE
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-
-#define Pmode SImode
-
-/* A function address in a call instruction is a byte address (for
- indexing purposes) so give the MEM rtx a byte's mode. */
-
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of computing a constant rtl expression RTX whose
- rtx-code is CODE. The body of this macro is a portion of a switch
- statement. If the code is computed here, return it with a return
- statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX, CODE, OUTERCODE) \
- case CONST_INT: \
- if ((unsigned) INTVAL (RTX) < 0xfff) return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 2; \
- case CONST_DOUBLE: \
- return 4;
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-/* Store in cc_status the expressions that the condition codes will
- describe after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's.
-
- On the 370, load insns do not alter the cc's. However, in some
- cases these instructions can make it possibly invalid to use the
- saved cc's. In those cases we clear out some or all of the saved
- cc's so they won't be used. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ \
- rtx exp = (EXP); \
- if (GET_CODE (exp) == PARALLEL) /* Check this */ \
- exp = XVECEXP (exp, 0, 0); \
- if (GET_CODE (exp) != SET) \
- CC_STATUS_INIT; \
- else \
- { \
- if (XEXP (exp, 0) == cc0_rtx) \
- { \
- cc_status.value1 = XEXP (exp, 0); \
- cc_status.value2 = XEXP (exp, 1); \
- cc_status.flags = 0; \
- } \
- else \
- { \
- if (cc_status.value1 \
- && reg_mentioned_p (XEXP (exp, 0), cc_status.value1)) \
- cc_status.value1 = 0; \
- if (cc_status.value2 \
- && reg_mentioned_p (XEXP (exp, 0), cc_status.value2)) \
- cc_status.value2 = 0; \
- switch (GET_CODE (XEXP (exp, 1))) \
- { \
- case PLUS: case MINUS: case MULT: /* case UMULT: */ \
- case DIV: case UDIV: case NEG: case ASHIFT: \
- case ASHIFTRT: case AND: case IOR: case XOR: \
- case ABS: case NOT: \
- CC_STATUS_SET (XEXP (exp, 0), XEXP (exp, 1)); \
- } \
- } \
- } \
-}
-
-
-#define CC_STATUS_SET(V1, V2) \
-{ \
- cc_status.flags = 0; \
- cc_status.value1 = (V1); \
- cc_status.value2 = (V2); \
- if (cc_status.value1 \
- && reg_mentioned_p (cc_status.value1, cc_status.value2)) \
- cc_status.value2 = 0; \
-}
-
-#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
-{ if (cc_status.flags & CC_NO_OVERFLOW) return NO_OV; return NORMAL; }
-
-/* Control the assembler format that we output. */
-
-#define TEXT_SECTION_ASM_OP "* Program text area"
-#define DATA_SECTION_ASM_OP "* Program data area"
-#define INIT_SECTION_ASM_OP "* Program initialization area"
-#define CTOR_LIST_BEGIN /* NO OP */
-#define CTOR_LIST_END /* NO OP */
-
-/* How to refer to registers in assembler output. This sequence is
- indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{ "0", "1", "2", "3", "4", "5", "6", "7", \
- "8", "9", "10", "11", "12", "13", "14", "15", \
- "0", "2", "4", "6" \
-}
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-#define ASM_FILE_START(FILE) fputs ("\tCSECT\n", FILE);
-#define ASM_FILE_END(FILE) fputs ("\tEND\n", FILE);
-#define ASM_IDENTIFY_GCC(FILE)
-#define ASM_COMMENT_START "*"
-#define ASM_APP_OFF ""
-#define ASM_APP_ON ""
-
-#define ASM_OUTPUT_LABEL(FILE, NAME) \
-{ assemble_name (FILE, NAME); fputs ("\tEQU\t*\n", FILE); }
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) /* NO OP */
-
-#define ASM_GLOBALIZE_LABEL(FILE, NAME) \
-{ fputs ("\tENTRY\t", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE); }
-
-/* MVS externals are limited to 8 characters, upper case only.
- The '_' is mapped to '@', except for MVS functions, then '#'. */
-
-#define MAX_MVS_LABEL_SIZE 8
-
-#define ASM_OUTPUT_LABELREF(FILE, NAME) \
-{ \
- char *bp, ch, temp[MAX_MVS_LABEL_SIZE + 1]; \
- if (strlen (NAME) > MAX_MVS_LABEL_SIZE) \
- { \
- strncpy (temp, NAME, MAX_MVS_LABEL_SIZE); \
- temp[MAX_MVS_LABEL_SIZE] = '\0'; \
- } \
- else \
- strcpy (temp,NAME); \
- if (!strcmp (temp,"main")) \
- strcpy (temp,"gccmain"); \
- if (mvs_function_check (temp)) \
- ch = '#'; \
- else \
- ch = '@'; \
- for (bp = temp; *bp; bp++) \
- { \
- if (islower (*bp)) *bp = toupper (*bp); \
- if (*bp == '_') *bp = ch; \
- } \
- fprintf (FILE, "%s", temp); \
-}
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* Generate internal label. Since we can branch here from off page, we
- must reload the base register. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
-{ \
- if (!strcmp (PREFIX,"L")) \
- { \
- mvs_add_label(NUM); \
- mvs_label_emitted = 1; \
- } \
- fprintf (FILE, "%s%d\tEQU\t*\n", PREFIX, NUM); \
-}
-
-/* Generate case label. */
-
-#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
- fprintf (FILE, "%s%d\tEQU\t*\n", PREFIX, NUM)
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- mvs_check_page (FILE, 4, 0); \
- fprintf (FILE, "\tDC\tA(L%d)\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- mvs_check_page (FILE, 4, 0); \
- fprintf (FILE, "\tDC\tA(L%d-L%d)\n", VALUE, REL)
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \
- mvs_check_page (FILE, 8, 4); \
- fprintf (FILE, "\tS\t13,=F'4'\n\tST\t%s,%d(13)\n", \
- reg_names[REGNO], STACK_POINTER_OFFSET)
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE, REGNO) \
- mvs_check_page (FILE, 8, 0); \
- fprintf (FILE, "\tL\t%s,%d(13)\n\tLA\t13,4(13)\n", \
- reg_names[REGNO], STACK_POINTER_OFFSET)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
- fprintf (FILE, "\tDC\tD'%.18G'\n", (VALUE))
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
- fprintf (FILE, "\tDC\tE'%.9G'\n", (VALUE))
-
-/* This outputs an integer, if not a CONST_INT must be address constant. */
-
-#define ASM_OUTPUT_INT(FILE, EXP) \
-{ \
- if (GET_CODE (EXP) == CONST_INT) \
- { \
- fprintf (FILE, "\tDC\tF'"); \
- output_addr_const (FILE, EXP); \
- fprintf (FILE, "'\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tDC\tA("); \
- output_addr_const (FILE, EXP); \
- fprintf (FILE, ")\n"); \
- } \
-}
-
-/* This outputs a short integer. */
-
-#define ASM_OUTPUT_SHORT(FILE, EXP) \
-{ \
- fprintf (FILE, "\tDC\tX'%04X'\n", INTVAL(EXP) & 0xFFFF); \
-}
-
-/* This outputs a byte sized integer. */
-
-#define ASM_OUTPUT_CHAR(FILE, EXP) \
- fprintf (FILE, "\tDC\tX'%02X'\n", INTVAL (EXP) )
-
-#define ASM_OUTPUT_BYTE(FILE, VALUE) \
- fprintf (FILE, "\tDC\tX'%02X'\n", VALUE)
-
-/* This outputs a text string. The string are chopped up to fit into
- an 80 byte record. Also, control and special characters, interpreted
- by the IBM assembler, are output numerically. */
-
-#define MVS_ASCII_TEXT_LENGTH 48
-
-#define ASM_OUTPUT_ASCII(FILE, PTR, LEN) \
-{ \
- int i, j; \
- int c; \
- for (j = 0, i = 0; i < LEN; j++, i++) \
- { \
- c = PTR[i]; \
- if (iscntrl (c) || c == '&') \
- { \
- if (j % MVS_ASCII_TEXT_LENGTH != 0 ) \
- fprintf (FILE, "'\n"); \
- j = -1; \
- if (c == '&') c = MAP_CHARACTER (c); \
- fprintf (FILE, "\tDC\tX'%X'\n", c ); \
- } \
- else \
- { \
- if (j % MVS_ASCII_TEXT_LENGTH == 0) \
- fprintf (FILE, "\tDC\tC'"); \
- if ( c == '\'' ) \
- fprintf (FILE, "%c%c", c, c); \
- else \
- fprintf (FILE, "%c", c); \
- if (j % MVS_ASCII_TEXT_LENGTH == MVS_ASCII_TEXT_LENGTH - 1) \
- fprintf (FILE, "'\n" ); \
- } \
- } \
- if (j % MVS_ASCII_TEXT_LENGTH != 0) \
- fprintf (FILE, "'\n"); \
-}
-
-/* This is how to output an assembler line that says to advance the
- location counter to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE, LOG) \
- if (LOG) \
- { \
- if ((LOG) == 1) \
- fprintf (FILE, "\tDS\t0H\n" ); \
- else \
- fprintf (FILE, "\tDS\t0F\n" ); \
- } \
-
-/* The maximum length of memory that the IBM assembler will allow in one
- DS operation. */
-
-#define MAX_CHUNK 32767
-
-/* A C statement to output to the stdio stream FILE an assembler
- instruction to advance the location counter by SIZE bytes. Those
- bytes should be zero when loaded. */
-
-#define ASM_OUTPUT_SKIP(FILE, SIZE) \
-{ \
- int s, k; \
- for (s = (SIZE); s > 0; s -= MAX_CHUNK) \
- { \
- if (s > MAX_CHUNK) \
- k = MAX_CHUNK; \
- else \
- k = s; \
- fprintf (FILE, "\tDS\tXL%d\n", k); \
- } \
-}
-
-/* A C statement (sans semicolon) to output to the stdio stream
- FILE the assembler definition of a common-label named NAME whose
- size is SIZE bytes. The variable ROUNDED is the size rounded up
- to whatever alignment the caller wants. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-{ \
- fputs ("\tENTRY\t", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
- fprintf (FILE, "\tDS\t0F\n"); \
- ASM_OUTPUT_LABEL (FILE,NAME); \
- ASM_OUTPUT_SKIP (FILE,SIZE); \
-}
-
-/* A C statement (sans semicolon) to output to the stdio stream
- FILE the assembler definition of a local-common-label named NAME
- whose size is SIZE bytes. The variable ROUNDED is the size
- rounded up to whatever alignment the caller wants. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-{ \
- fprintf (FILE, "\tDS\t0F\n"); \
- ASM_OUTPUT_LABEL (FILE,NAME); \
- ASM_OUTPUT_SKIP (FILE,SIZE); \
-}
-
-/* Store in OUTPUT a string (made with alloca) containing an
- assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-{ \
- (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10); \
- sprintf ((OUTPUT), "%s%d", (NAME), (LABELNO)); \
-}
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-
-#define TARGET_BELL 47
-#define TARGET_BS 22
-#define TARGET_TAB 5
-#define TARGET_NEWLINE 21
-#define TARGET_VT 11
-#define TARGET_FF 12
-#define TARGET_CR 13
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ \
- switch (GET_CODE (X)) \
- { \
- static char curreg[4]; \
- case REG: \
- if (CODE == 'N') \
- strcpy (curreg, reg_names[REGNO (X) + 1]); \
- else \
- strcpy (curreg, reg_names[REGNO (X)]); \
- fprintf (FILE, "%s", curreg); \
- break; \
- case MEM: \
- { \
- rtx addr = XEXP (X, 0); \
- if (CODE == 'O') \
- { \
- if (GET_CODE (addr) == PLUS) \
- fprintf (FILE, "%d", INTVAL (XEXP (addr, 1))); \
- else \
- fprintf (FILE, "0"); \
- } \
- else if (CODE == 'R') \
- { \
- if (GET_CODE (addr) == PLUS) \
- fprintf (FILE, "%s", reg_names[REGNO (XEXP (addr, 0))]);\
- else \
- fprintf (FILE, "%s", reg_names[REGNO (addr)]); \
- } \
- else \
- output_address (XEXP (X, 0)); \
- } \
- break; \
- case SYMBOL_REF: \
- case LABEL_REF: \
- mvs_page_lit += 4; \
- if (SYMBOL_REF_FLAG (X)) fprintf (FILE, "=V("); \
- else fprintf (FILE, "=A("); \
- output_addr_const (FILE, X); \
- fprintf (FILE, ")"); \
- break; \
- case CONST_INT: \
- if (CODE == 'B') \
- fprintf (FILE, "%d", INTVAL (X) & 0xff); \
- else if (CODE == 'X') \
- fprintf (FILE, "%02X", INTVAL (X) & 0xff); \
- else if (CODE == 'h') \
- fprintf (FILE, "%d", (INTVAL (X) << 16) >> 16); \
- else if (CODE == 'H') \
- { \
- mvs_page_lit += 2; \
- fprintf (FILE, "=H'%d'", (INTVAL (X) << 16) >> 16); \
- } \
- else \
- { \
- mvs_page_lit += 4; \
- fprintf (FILE, "=F'%d'", INTVAL (X)); \
- } \
- break; \
- case CONST_DOUBLE: \
- if (GET_MODE (X) == DImode) \
- { \
- if (CODE == 'M') \
- { \
- mvs_page_lit += 4; \
- fprintf (FILE, "=XL4'%08X'", CONST_DOUBLE_LOW (X)); \
- } \
- else if (CODE == 'L') \
- { \
- mvs_page_lit += 4; \
- fprintf (FILE, "=XL4'%08X'", CONST_DOUBLE_HIGH (X)); \
- } \
- else \
- { \
- mvs_page_lit += 8; \
- fprintf (FILE, "=XL8'%08X%08X'", CONST_DOUBLE_LOW (X), \
- CONST_DOUBLE_HIGH (X)); \
- } \
- } \
- else \
- { \
- union { double d; int i[2]; } u; \
- u.i[0] = CONST_DOUBLE_LOW (X); \
- u.i[1] = CONST_DOUBLE_HIGH (X); \
- if (GET_MODE (X) == SFmode) \
- { \
- mvs_page_lit += 4; \
- fprintf (FILE, "=E'%.9G'", u.d); \
- } \
- else \
- { \
- mvs_page_lit += 8; \
- fprintf (FILE, "=D'%.18G'", u.d); \
- } \
- } \
- break; \
- case CONST: \
- if (GET_CODE (XEXP (X, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
- { \
- mvs_page_lit += 4; \
- if (SYMBOL_REF_FLAG (XEXP (XEXP (X, 0), 0))) \
- { \
- fprintf (FILE, "=V("); \
- ASM_OUTPUT_LABELREF (FILE, \
- XSTR (XEXP (XEXP (X, 0), 0), 0)); \
- fprintf (FILE, ")\n\tA\t%s,=F'%d'", curreg, \
- INTVAL (XEXP (XEXP (X, 0), 1))); \
- } \
- else \
- { \
- fprintf (FILE, "=A("); \
- output_addr_const (FILE, X); \
- fprintf (FILE, ")"); \
- } \
- } \
- else \
- { \
- mvs_page_lit += 4; \
- fprintf (FILE, "=F'"); \
- output_addr_const (FILE, X); \
- fprintf (FILE, "'"); \
- } \
- break; \
- default: \
- abort(); \
- } \
-}
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ \
- rtx breg, xreg, offset, plus; \
- \
- switch (GET_CODE (ADDR)) \
- { \
- case REG: \
- fprintf (FILE, "0(%s)", reg_names[REGNO (ADDR)]); \
- break; \
- case PLUS: \
- breg = 0; \
- xreg = 0; \
- offset = 0; \
- if (GET_CODE (XEXP (ADDR, 0)) == PLUS) \
- { \
- if (GET_CODE (XEXP (ADDR, 1)) == REG) \
- breg = XEXP (ADDR, 1); \
- else \
- offset = XEXP (ADDR, 1); \
- plus = XEXP (ADDR, 0); \
- } \
- else \
- { \
- if (GET_CODE (XEXP (ADDR, 0)) == REG) \
- breg = XEXP (ADDR, 0); \
- else \
- offset = XEXP (ADDR, 0); \
- plus = XEXP (ADDR, 1); \
- } \
- if (GET_CODE (plus) == PLUS) \
- { \
- if (GET_CODE (XEXP (plus, 0)) == REG) \
- { \
- if (breg) \
- xreg = XEXP (plus, 0); \
- else \
- breg = XEXP (plus, 0); \
- } \
- else \
- { \
- offset = XEXP (plus, 0); \
- } \
- if (GET_CODE (XEXP (plus, 1)) == REG) \
- { \
- if (breg) \
- xreg = XEXP (plus, 1); \
- else \
- breg = XEXP (plus, 1); \
- } \
- else \
- { \
- offset = XEXP (plus, 1); \
- } \
- } \
- else if (GET_CODE (plus) == REG) \
- { \
- if (breg) \
- xreg = plus; \
- else \
- breg = plus; \
- } \
- else \
- { \
- offset = plus; \
- } \
- if (offset) \
- { \
- if (GET_CODE (offset) == LABEL_REF) \
- fprintf (FILE, "L%d", \
- CODE_LABEL_NUMBER (XEXP (offset, 0))); \
- else \
- output_addr_const (FILE, offset); \
- } \
- else \
- fprintf (FILE, "0"); \
- if (xreg) \
- fprintf (FILE, "(%s,%s)", \
- reg_names[REGNO (xreg)], reg_names[REGNO (breg)]); \
- else \
- fprintf (FILE, "(%s)", reg_names[REGNO (breg)]); \
- break; \
- default: \
- mvs_page_lit += 4; \
- if (SYMBOL_REF_FLAG (ADDR)) fprintf (FILE, "=V("); \
- else fprintf (FILE, "=A("); \
- output_addr_const (FILE, ADDR); \
- fprintf (FILE, ")"); \
- break; \
- } \
-}
diff --git a/gcc/config/i370/i370.md b/gcc/config/i370/i370.md
deleted file mode 100644
index e12d2f62026..00000000000
--- a/gcc/config/i370/i370.md
+++ /dev/null
@@ -1,4215 +0,0 @@
-;;- Machine description for GNU compiler -- System/370 version.
-;; Copyright (C) 1989, 1993, 1994, 1995 Free Software Foundation, Inc.
-;; Contributed by Jan Stein (jan@cd.chalmers.se).
-;; Modified for MVS C/370 by Dave Pitts (dpitts@nyx.cs.du.edu)
-
-;; 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.
-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-;;
-;; Special constraints for 370 machine description:
-;;
-;; a -- Any address register from 1 to 15.
-;; d -- Any register from 0 to 15.
-;; I -- An 8-bit constant (0..255).
-;; J -- A 12-bit constant (0..4095).
-;; K -- A 16-bit constant (-32768..32767).
-;;
-;; Special formats used for outputting 370 instructions.
-;;
-;; %B -- Print a constant byte integer.
-;; %H -- Print a signed 16-bit constant.
-;; %L -- Print least significant word of a CONST_DOUBLE.
-;; %M -- Print most significant word of a CONST_DOUBLE.
-;; %N -- Print next register (second word of a DImode reg).
-;; %O -- Print the offset of a memory reference (PLUS (REG) (CONST_INT)).
-;; %R -- Print the register of a memory reference (PLUS (REG) (CONST_INT)).
-;; %X -- Print a constant byte integer in hex.
-;;
-;; We have a special constraint for pattern matching.
-;;
-;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
-;;
-;; r_or_s_operand -- Matches a register or a valid S operand in a RS, SI
-;; or SS type instruction or a register
-;;
-;; For MVS C/370 we use the following stack locations for:
-;;
-;; 136 - internal function result buffer
-;; 140 - numeric conversion buffer
-;; 144 - pointer to internal function result buffer
-;; 148 - start of automatic variables and function arguments
-;;
-;; To support programs larger than a page, 4096 bytes, PAGE_REGISTER points
-;; to a page origin table, all internal labels are generated to reload the
-;; BASE_REGISTER knowing what page it is on and all branch instructions go
-;; directly to the target if it is known that the target is on the current
-;; page (essentially backward references). All forward references and off
-;; page references are handled by loading the address of target into a
-;; register and branching indirectly.
-;;
-;; Some *di patterns have been commented out per advice from RMS, as gcc
-;; will generate the right things to do.
-;;
-
-;;
-;;- Test instructions.
-;;
-
-;
-; tstdi instruction pattern(s).
-;
-
-(define_insn "tstdi"
- [(set (cc0)
- (match_operand:DI 0 "register_operand" "d"))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 0);
- return \"SRDA %0,0\";
-}")
-
-;
-; tstsi instruction pattern(s).
-;
-
-(define_insn "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "register_operand" "d"))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LTR %0,%0\";
-}")
-
-;
-; tsthi instruction pattern(s).
-;
-
-(define_insn "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "register_operand" "d"))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 2);
- return \"CH %0,=H'0'\";
-}")
-
-;
-; tstqi instruction pattern(s).
-;
-
-(define_insn ""
- [(set (cc0)
- (match_operand:QI 0 "r_or_s_operand" "dm"))]
- "unsigned_jump_follows_p (insn)"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 4);
- return \"N %0,=X'000000FF'\";
- }
- mvs_check_page (0, 4, 0);
- return \"CLI %0,0\";
-}")
-
-(define_insn "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "register_operand" "d"))]
- ""
- "*
-{
- check_label_emit ();
- if (unsigned_jump_follows_p (insn))
- {
- mvs_check_page (0, 4, 4);
- return \"N %0,=X'000000FF'\";
- }
- mvs_check_page (0, 8, 0);
- return \"SLL %0,24\;SRA %0,24\";
-}")
-
-;
-; tstdf instruction pattern(s).
-;
-
-(define_insn "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "general_operand" "f"))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LTDR %0,%0\";
-}")
-
-;
-; tstsf instruction pattern(s).
-;
-
-(define_insn "tstsf"
- [(set (cc0)
- (match_operand:SF 0 "general_operand" "f"))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LTER %0,%0\";
-}")
-
-;;
-;;- Compare instructions.
-;;
-
-;
-; cmpdi instruction pattern(s).
-;
-
-;(define_insn "cmpdi"
-; [(set (cc0)
-; (compare (match_operand:DI 0 "register_operand" "d")
-; (match_operand:DI 1 "general_operand" "")))]
-; ""
-; "*
-;{
-; check_label_emit ();
-; if (REG_P (operands[1]))
-; {
-; mvs_check_page (0, 8, 0);
-; if (unsigned_jump_follows_p (insn))
-; return \"CLR %0,%1\;BNE *+6\;CLR %N0,%N1\";
-; return \"CR %0,%1\;BNE *+6\;CLR %N0,%N1\";
-; }
-; mvs_check_page (0, 12, 0);
-; if (unsigned_jump_follows_p (insn))
-; return \"CL %0,%M1\;BNE *+8\;CL %N0,%L1\";
-; return \"C %0,%M1\;BNE *+8\;CL %N0,%L1\";
-;}")
-
-;
-; cmpsi instruction pattern(s).
-;
-
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "general_operand" "md")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- if (unsigned_jump_follows_p (insn))
- return \"CLR %0,%1\";
- return \"CR %0,%1\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 4);
- if (unsigned_jump_follows_p (insn))
- return \"CL %0,=F'%c1'\";
- return \"C %0,=F'%c1'\";
- }
- mvs_check_page (0, 4, 0);
- if (unsigned_jump_follows_p (insn))
- return \"CL %0,%1\";
- return \"C %0,%1\";
-}")
-
-;
-; cmphi instruction pattern(s).
-;
-
-(define_insn "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "register_operand" "d")
- (match_operand:HI 1 "general_operand" "")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- if (unsigned_jump_follows_p (insn))
- return \"STH %1,140(,13)\;CLM %0,3,140(13)\";
- return \"STH %1,140(,13)\;CH %0,140(,13)\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"CH %0,%H1\";
- }
- mvs_check_page (0, 4, 0);
- return \"CH %0,%1\";
-}")
-
-;
-; cmpqi instruction pattern(s).
-;
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:QI 0 "r_or_s_operand" "g")
- (match_operand:QI 1 "r_or_s_operand" "g")))]
- "unsigned_jump_follows_p (insn)"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STC %1,140(,13)\;CLM %0,1,140(13)\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 1);
- return \"CLM %0,1,=FL1'%B1'\";
- }
- mvs_check_page (0, 4, 0);
- return \"CLM %0,1,%1\";
- }
- else if (GET_CODE (operands[0]) == CONST_INT)
- {
- cc_status.flags |= CC_REVERSED;
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 1);
- return \"CLM %1,1,=FL1'%B0'\";
- }
- mvs_check_page (0, 4, 0);
- return \"CLI %1,%B0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"CLI %0,%B1\";
- }
- if (GET_CODE (operands[1]) == MEM)
- {
- mvs_check_page (0, 6, 0);
- return \"CLC %O0(1,%R0),%1\";
- }
- cc_status.flags |= CC_REVERSED;
- mvs_check_page (0, 4, 0);
- return \"CLM %1,1,%0\";
-}")
-
-(define_insn "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "register_operand" "d")
- (match_operand:QI 1 "general_operand" "di")))]
- ""
- "*
-{
- check_label_emit ();
- if (unsigned_jump_follows_p (insn))
- {
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"CLM %0,1,%1\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 1);
- return \"CLM %0,1,=FL1'%B1'\";
- }
- mvs_check_page (0, 8, 0);
- return \"STC %1,140(,13)\;CLM %0,1,140(13)\";
- }
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 18, 0);
- return \"SLL %0,24\;SRA %0,24\;SLL %1,24\;SRA %1,24\;CR %0,%1\";
- }
- mvs_check_page (0, 12, 0);
- return \"SLL %0,24\;SRA %0,24\;C %0,%1\";
-}")
-
-;
-; cmpdf instruction pattern(s).
-;
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "general_operand" "f,mF")
- (match_operand:DF 1 "general_operand" "fmF,f")))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"CDR %0,%1\";
- }
- mvs_check_page (0, 4, 0);
- return \"CD %0,%1\";
- }
- cc_status.flags |= CC_REVERSED;
- mvs_check_page (0, 4, 0);
- return \"CD %1,%0\";
-}")
-
-;
-; cmpsf instruction pattern(s).
-;
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "general_operand" "f,mF")
- (match_operand:SF 1 "general_operand" "fmF,f")))]
- ""
- "*
-{
-check_label_emit ();
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"CER %0,%1\";
- }
- mvs_check_page (0, 4, 0);
- return \"CE %0,%1\";
- }
- cc_status.flags |= CC_REVERSED;
- mvs_check_page (0, 4, 0);
- return \"CE %1,%0\";
-}")
-
-;
-; cmpstrsi instruction pattern(s).
-;
-
-(define_expand "cmpstrsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (compare (match_operand:BLK 1 "general_operand" "")
- (match_operand:BLK 2 "general_operand" "")))
- (use (match_operand:SI 3 "general_operand" ""))
- (use (match_operand:SI 4 "" ""))]
- ""
- "
-{
- rtx op1, op2;
-
- op1 = XEXP (operands[1], 0);
- if (GET_CODE (op1) == REG
- || (GET_CODE (op1) == PLUS && GET_CODE (XEXP (op1, 0)) == REG
- && GET_CODE (XEXP (op1, 1)) == CONST_INT
- && (unsigned) INTVAL (XEXP (op1, 1)) < 4096))
- {
- op1 = operands[1];
- }
- else
- {
- op1 = gen_rtx (MEM, BLKmode, copy_to_mode_reg (SImode, op1));
- }
-
- op2 = XEXP (operands[2], 0);
- if (GET_CODE (op2) == REG
- || (GET_CODE (op2) == PLUS && GET_CODE (XEXP (op2, 0)) == REG
- && GET_CODE (XEXP (op2, 1)) == CONST_INT
- && (unsigned) INTVAL (XEXP (op2, 1)) < 4096))
- {
- op2 = operands[2];
- }
- else
- {
- op2 = gen_rtx (MEM, BLKmode, copy_to_mode_reg (SImode, op2));
- }
-
- if (GET_CODE (operands[3]) == CONST_INT && INTVAL (operands[3]) < 256)
- {
- emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
- gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (COMPARE, VOIDmode, op1, op2)),
- gen_rtx (USE, VOIDmode, operands[3]))));
- }
- else
- {
- rtx reg1 = gen_reg_rtx (DImode);
- rtx reg2 = gen_reg_rtx (DImode);
- rtx subreg = gen_rtx (SUBREG, SImode, reg1, 1);
-
- emit_insn (gen_rtx (SET, VOIDmode, subreg, operands[3]));
- emit_insn (gen_rtx (SET, VOIDmode, gen_rtx (SUBREG, SImode, reg2, 1),
- subreg));
- emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (5,
- gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (COMPARE, VOIDmode, op1, op2)),
- gen_rtx (USE, VOIDmode, reg1),
- gen_rtx (USE, VOIDmode, reg2),
- gen_rtx (CLOBBER, VOIDmode, reg1),
- gen_rtx (CLOBBER, VOIDmode, reg2))));
- }
- DONE;
-}")
-
-; Compare a block that is less than 256 bytes in length.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "d")
- (compare (match_operand:BLK 1 "s_operand" "m")
- (match_operand:BLK 2 "s_operand" "m")))
- (use (match_operand:QI 3 "immediate_operand" "I"))]
- "((unsigned) INTVAL (operands[3]) < 256)"
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 22, 0);
- return \"LA %0,1\;CLC %O1(%c3,%R1),%2\;BH *+12\;BL *+6\;SLR %0,%0\;LNR %0,%0\";
-}")
-
-; Compare a block that is larger than 255 bytes in length.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "d")
- (compare (match_operand:BLK 1 "general_operand" "m")
- (match_operand:BLK 2 "general_operand" "m")))
- (use (match_operand:DI 3 "register_operand" "d"))
- (use (match_operand:DI 4 "register_operand" "d"))
- (clobber (match_dup 3))
- (clobber (match_dup 4))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 26, 0);
- return \"LA %3,%1\;LA %4,%2\;LA %0,1\;CLCL %3,%4\;BH *+12\;BL *+6\;SLR %0,%0\;LNR %0,%0\";
-}")
-
-;;
-;;- Move instructions.
-;;
-
-;
-; movdi instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:DI 0 "r_or_s_operand" "=dm")
- (match_operand:DI 1 "r_or_s_operand" "dim*fF"))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STD %1,140(,13)\;LM %0,%N0,140(13)\";
- }
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"LR %0,%1\;LR %N0,%N1\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 4, 0);
- return \"SLR %0,%0\;SLR %N0,%N0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) < 4096)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 6, 0);
- return \"SLR %0,%0\;LA %N0,%c1\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 8, 0);
- return \"L %0,%1\;SRDA %0,32\";
- }
- mvs_check_page (0, 4, 0);
- return \"LM %0,%N0,%1\";
- }
- else if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STD %1,%0\";
- }
- else if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STM %1,%N1,%0\";
- }
- mvs_check_page (0, 6, 0);
- return \"MVC %O0(8,%R0),%1\";
-}")
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=dm")
- (match_operand:DI 1 "general_operand" "dim*fF"))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STD %1,140(,13)\;LM %0,%N0,140(13)\";
- }
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"LR %0,%1\;LR %N0,%N1\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 4, 0);
- return \"SLR %0,%0\;SLR %N0,%N0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) < 4096)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 6, 0);
- return \"SLR %0,%0\;LA %N0,%c1\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 8, 0);
- return \"L %0,%1\;SRDA %0,32\";
- }
- mvs_check_page (0, 4, 0);
- return \"LM %0,%N0,%1\";
- }
- else if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STD %1,%0\";
- }
- mvs_check_page (0, 4, 0);
- return \"STM %1,%N1,%0\";
-}")
-
-;
-; movsi instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:SI 0 "r_or_s_operand" "=dm,dm")
- (match_operand:SI 1 "r_or_s_operand" "dim,*fF"))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STE %1,140(,13)\;L %0,140(,13)\";
- }
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LR %0,%1\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"SLR %0,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) < 4096)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c1\";
- }
- mvs_check_page (0, 4, 0);
- return \"L %0,%1\";
- }
- else if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STE %1,%0\";
- }
- else if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"ST %1,%0\";
- }
- mvs_check_page (0, 6, 0);
- return \"MVC %O0(4,%R0),%1\";
-}")
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=d,dm")
- (match_operand:SI 1 "general_operand" "dimF,*fd"))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STE %1,140(,13)\;L %0,140(,13)\";
- }
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LR %0,%1\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"SLR %0,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) < 4096)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c1\";
- }
- mvs_check_page (0, 4, 0);
- return \"L %0,%1\";
- }
- else if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STE %1,%0\";
- }
- mvs_check_page (0, 4, 0);
- return \"ST %1,%0\";
-}")
-
-;(define_expand "movsi"
-; [(set (match_operand:SI 0 "general_operand" "=d,dm")
-; (match_operand:SI 1 "general_operand" "dimF,*fd"))]
-; ""
-; "
-;{
-; rtx op0, op1;
-;
-; op0 = operands[0];
-; if (GET_CODE (op0) == CONST
-; && GET_CODE (XEXP (XEXP (op0, 0), 0)) == SYMBOL_REF
-; && SYMBOL_REF_FLAG (XEXP (XEXP (op0, 0), 0)))
-; {
-; op0 = gen_rtx (MEM, SImode, copy_to_mode_reg (SImode, XEXP (op0, 0)));
-; }
-;
-; op1 = operands[1];
-; if (GET_CODE (op1) == CONST
-; && GET_CODE (XEXP (XEXP (op1, 0), 0)) == SYMBOL_REF
-; && SYMBOL_REF_FLAG (XEXP (XEXP (op1, 0), 0)))
-; {
-; op1 = gen_rtx (MEM, SImode, copy_to_mode_reg (SImode, XEXP (op1, 0)));
-; }
-;
-; emit_insn (gen_rtx (SET, VOIDmode, op0, op1));
-; DONE;
-;}")
-
-;
-; movhi instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:HI 0 "r_or_s_operand" "=g")
- (match_operand:HI 1 "r_or_s_operand" "g"))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LR %0,%1\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"SLR %0,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) < 4096)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c1\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"LH %0,%H1\";
- }
- mvs_check_page (0, 4, 0);
- return \"LH %0,%1\";
- }
- else if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STH %1,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 6, 0);
- return \"MVC %O0(2,%R0),%H1\";
- }
- mvs_check_page (0, 6, 0);
- return \"MVC %O0(2,%R0),%1\";
-}")
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=d,m")
- (match_operand:HI 1 "general_operand" "g,d"))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LR %0,%1\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"SLR %0,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) < 4096)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c1\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"LH %0,%H1\";
- }
- mvs_check_page (0, 4, 0);
- return \"LH %0,%1\";
- }
- mvs_check_page (0, 4, 0);
- return \"STH %1,%0\";
-}")
-
-;
-; movqi instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:QI 0 "r_or_s_operand" "=g")
- (match_operand:QI 1 "r_or_s_operand" "g"))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LR %0,%1\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"SLR %0,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (INTVAL (operands[1]) >= 0)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c1\";
- }
- mvs_check_page (0, 4, 0);
- return \"L %0,=F'%c1'\";
- }
- mvs_check_page (0, 4, 0);
- return \"IC %0,%1\";
- }
- else if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STC %1,%0\";
- }
- else if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"MVI %0,%B1\";
- }
- mvs_check_page (0, 6, 0);
- return \"MVC %O0(1,%R0),%1\";
-}")
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=d,m")
- (match_operand:QI 1 "general_operand" "g,d"))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LR %0,%1\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"SLR %0,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (INTVAL (operands[1]) >= 0)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c1\";
- }
- mvs_check_page (0, 4, 0);
- return \"L %0,=F'%c1'\";
- }
- mvs_check_page (0, 4, 0);
- return \"IC %0,%1\";
- }
- mvs_check_page (0, 4, 0);
- return \"STC %1,%0\";
-}")
-
-;
-; movestrictqi instruction pattern(s).
-;
-
-(define_insn "movestrictqi"
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "=d"))
- (match_operand:QI 1 "general_operand" "g"))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STC %1,140(,13)\;IC %0,140(,13)\";
- }
- mvs_check_page (0, 4, 0);
- return \"IC %0,%1\";
-}")
-
-;
-; movstricthi instruction pattern(s).
-;
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "register_operand" "=d"))
- (match_operand:HI 1 "r_or_s_operand" "g"))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STH %1,140(,13)\;ICM %0,3,140(13)\";
- }
- else if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"ICM %0,3,%H1\";
- }
- mvs_check_page (0, 4, 0);
- return \"ICM %0,3,%1\";
-}")
-
-(define_insn "movestricthi"
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "=dm"))
- (match_operand:HI 1 "general_operand" "d"))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 8, 0);
- return \"STH %1,140(,13)\;ICM %0,3,140(13)\";
- }
- mvs_check_page (0, 4, 0);
- return \"STH %1,%0\";
-}")
-
-;
-; movdf instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:DF 0 "r_or_s_operand" "=fm,fm,*dm")
- (match_operand:DF 1 "r_or_s_operand" "fmF,*dm,fmF"))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LDR %0,%1\";
- }
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STM %1,%N1,140(13)\;LD %0,140(,13)\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 2, 0);
- return \"SDR %0,%0\";
- }
- mvs_check_page (0, 4, 0);
- return \"LD %0,%1\";
- }
- if (REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 12, 0);
- return \"STD %1,140(,13)\;LM %0,%N0,140(13)\";
- }
- mvs_check_page (0, 4, 0);
- return \"LM %0,%N0,%1\";
- }
- else if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STD %1,%0\";
- }
- else if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STM %1,%N1,%0\";
- }
- mvs_check_page (0, 6, 0);
- return \"MVC %O0(8,%R0),%1\";
-}")
-
-(define_insn "movdf"
- [(set (match_operand:DF 0 "general_operand" "=f,fm,m,*d")
- (match_operand:DF 1 "general_operand" "fmF,*d,f,fmF"))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LDR %0,%1\";
- }
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STM %1,%N1,140(13)\;LD %0,140(,13)\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 2, 0);
- return \"SDR %0,%0\";
- }
- mvs_check_page (0, 4, 0);
- return \"LD %0,%1\";
- }
- else if (REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 12, 0);
- return \"STD %1,140(,13)\;LM %0,%N0,140(13)\";
- }
- mvs_check_page (0, 4, 0);
- return \"LM %0,%N0,%1\";
- }
- else if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STD %1,%0\";
- }
- mvs_check_page (0, 4, 0);
- return \"STM %1,%N1,%0\";
-}")
-
-;
-; movsf instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:SF 0 "r_or_s_operand" "=fm,fm,*dm")
- (match_operand:SF 1 "r_or_s_operand" "fmF,*dm,fmF"))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LER %0,%1\";
- }
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"ST %1,140(,13)\;LE %0,140(,13)\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 2, 0);
- return \"SER %0,%0\";
- }
- mvs_check_page (0, 4, 0);
- return \"LE %0,%1\";
- }
- else if (REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STE %1,140(,13)\;L %0,140(,13)\";
- }
- mvs_check_page (0, 4, 0);
- return \"L %0,%1\";
- }
- else if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STE %1,%0\";
- }
- else if (REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"ST %1,%0\";
- }
- mvs_check_page (0, 6, 0);
- return \"MVC %O0(4,%R0),%1\";
-}")
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=f,fm,m,*d")
- (match_operand:SF 1 "general_operand" "fmF,*d,f,fmF"))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LER %0,%1\";
- }
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"ST %1,140(,13)\;LE %0,140(,13)\";
- }
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 2, 0);
- return \"SER %0,%0\";
- }
- mvs_check_page (0, 4, 0);
- return \"LE %0,%1\";
- }
- else if (REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"STE %1,140(,13)\;L %0,140(,13)\";
- }
- mvs_check_page (0, 4, 0);
- return \"L %0,%1\";
- }
- else if (FP_REG_P (operands[1]))
- {
- mvs_check_page (0, 4, 0);
- return \"STE %1,%0\";
- }
- mvs_check_page (0, 4, 0);
- return \"ST %1,%0\";
-}")
-
-;
-; movstrsi instruction pattern(s).
-;
-
-(define_expand "movstrsi"
- [(set (match_operand:BLK 0 "general_operand" "")
- (match_operand:BLK 1 "general_operand" ""))
- (use (match_operand:SI 2 "general_operand" ""))
- (match_operand 3 "" "")]
- ""
- "
-{
- rtx op0, op1;
-
- op0 = XEXP (operands[0], 0);
- if (GET_CODE (op0) == REG
- || (GET_CODE (op0) == PLUS && GET_CODE (XEXP (op0, 0)) == REG
- && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && (unsigned) INTVAL (XEXP (op0, 1)) < 4096))
- {
- op0 = operands[0];
- }
- else
- {
- op0 = gen_rtx (MEM, BLKmode, copy_to_mode_reg (SImode, op0));
- }
-
- op1 = XEXP (operands[1], 0);
- if (GET_CODE (op1) == REG
- || (GET_CODE (op1) == PLUS && GET_CODE (XEXP (op1, 0)) == REG
- && GET_CODE (XEXP (op1, 1)) == CONST_INT
- && (unsigned) INTVAL (XEXP (op1, 1)) < 4096))
- {
- op1 = operands[1];
- }
- else
- {
- op1 = gen_rtx (MEM, BLKmode, copy_to_mode_reg (SImode, op1));
- }
-
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 256)
- {
- emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
- gen_rtx (SET, VOIDmode, op0, op1),
- gen_rtx (USE, VOIDmode, operands[2]))));
- }
- else
- {
- rtx reg1 = gen_reg_rtx (DImode);
- rtx reg2 = gen_reg_rtx (DImode);
- rtx subreg = gen_rtx (SUBREG, SImode, reg1, 1);
-
- emit_insn (gen_rtx (SET, VOIDmode, subreg, operands[2]));
- emit_insn (gen_rtx (SET, VOIDmode, gen_rtx (SUBREG, SImode, reg2, 1),
- subreg));
- emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (5,
- gen_rtx (SET, VOIDmode, op0, op1),
- gen_rtx (USE, VOIDmode, reg1),
- gen_rtx (USE, VOIDmode, reg2),
- gen_rtx (CLOBBER, VOIDmode, reg1),
- gen_rtx (CLOBBER, VOIDmode, reg2))));
- }
- DONE;
-}")
-
-; Move a block that is less than 256 bytes in length.
-
-(define_insn ""
- [(set (match_operand:BLK 0 "s_operand" "=m")
- (match_operand:BLK 1 "s_operand" "m"))
- (use (match_operand 2 "immediate_operand" "I"))]
- "((unsigned) INTVAL (operands[2]) < 256)"
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 6, 0);
- return \"MVC %O0(%c2,%R0),%1\";
-}")
-
-; Move a block that is larger than 255 bytes in length.
-
-(define_insn ""
- [(set (match_operand:BLK 0 "general_operand" "=m")
- (match_operand:BLK 1 "general_operand" "m"))
- (use (match_operand:DI 2 "register_operand" "d"))
- (use (match_operand:DI 3 "register_operand" "d"))
- (clobber (match_dup 2))
- (clobber (match_dup 3))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 10, 0);
- return \"LA %2,%0\;LA %3,%1\;MVCL %2,%3\";
-}")
-
-;;
-;;- Conversion instructions.
-;;
-
-;
-; extendsidi2 instruction pattern(s).
-;
-
-(define_expand "extendsidi2"
- [(set (match_operand:DI 0 "general_operand" "")
- (sign_extend:DI (match_operand:SI 1 "general_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[1]) != CONST_INT)
- {
- emit_insn (gen_rtx (SET, VOIDmode,
- operand_subword (operands[0], 0, 1, DImode), operands[1]));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (ASHIFTRT, DImode, operands[0],
- gen_rtx (CONST_INT, SImode, 32))));
- }
- else
- {
- if (INTVAL (operands[1]) < 0)
- {
- emit_insn (gen_rtx (SET, VOIDmode,
- operand_subword (operands[0], 0, 1, DImode),
- gen_rtx (CONST_INT, SImode, -1)));
- }
- else
- {
- emit_insn (gen_rtx (SET, VOIDmode,
- operand_subword (operands[0], 0, 1, DImode),
- gen_rtx (CONST_INT, SImode, 0)));
- }
- emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (SImode, operands[0]),
- operands[1]));
- }
- DONE;
-}")
-
-;
-; extendhisi2 instruction pattern(s).
-;
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=d,m")
- (sign_extend:SI (match_operand:HI 1 "general_operand" "g,d")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- if (REGNO (operands[0]) != REGNO (operands[1]))
- {
- mvs_check_page (0, 2, 0);
- return \"LR %0,%1\;SLL %0,16\;SRA %0,16\";
- }
- else
- return \"\"; /* Should be empty. 16-bits regs are always 32-bits. */
- if (operands[1] == const0_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"SLR %0,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) < 4096)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c1\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"LH %0,%H1\";
- }
- mvs_check_page (0, 4, 0);
- return \"LH %0,%1\";
- }
- mvs_check_page (0, 4, 0);
- return \"SLL %1,16\;SRA %1,16\;ST %1,%0\";
-}")
-
-;
-; extendqisi2 instruction pattern(s).
-;
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (sign_extend:SI (match_operand:QI 1 "general_operand" "0mi")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_SET (operands[0], operands[1]);
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"SLL %0,24\;SRA %0,24\";
- }
- if (s_operand (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"ICM %0,8,%1\;SRA %0,24\";
- }
- mvs_check_page (0, 12, 0);
- return \"IC %0,%1\;SLL %0,24\;SRA %0,24\";
-}")
-
-;
-; extendqihi2 instruction pattern(s).
-;
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (sign_extend:HI (match_operand:QI 1 "general_operand" "0m")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_SET (operands[0], operands[1]);
- if (REG_P (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"SLL %0,24\;SRA %0,24\";
- }
- if (s_operand (operands[1]))
- {
- mvs_check_page (0, 8, 0);
- return \"ICM %0,8,%1\;SRA %0,24\";
- }
- mvs_check_page (0, 12, 0);
- return \"IC %0,%1\;SLL %0,24\;SRA %0,24\";
-}")
-
-;
-; zero_extendsidi2 instruction pattern(s).
-;
-
-(define_expand "zero_extendsidi2"
- [(set (match_operand:DI 0 "general_operand" "")
- (zero_extend:DI (match_operand:SI 1 "general_operand" "")))]
- ""
- "
-{
- emit_insn (gen_rtx (SET, VOIDmode,
- operand_subword (operands[0], 0, 1, DImode), operands[1]));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (LSHIFTRT, DImode, operands[0],
- gen_rtx (CONST_INT, SImode, 32))));
- DONE;
-}")
-
-;
-; zero_extendhisi2 instruction pattern(s).
-;
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (zero_extend:SI (match_operand:HI 1 "general_operand" "0")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 4, 4);
- return \"N %1,=X'0000FFFF'\";
-}")
-
-;
-; zero_extendqisi2 instruction pattern(s).
-;
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=d,&d")
- (zero_extend:SI (match_operand:QI 1 "general_operand" "0i,m")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[1]))
- {
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 4, 4);
- return \"N %0,=X'000000FF'\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c1\";
- }
- CC_STATUS_INIT;
- mvs_check_page (0, 8, 0);
- return \"SLR %0,%0\;IC %0,%1\";
-}")
-
-;
-; zero_extendqihi2 instruction pattern(s).
-;
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=d,&d")
- (zero_extend:HI (match_operand:QI 1 "general_operand" "0i,m")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[1]))
- {
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 4, 4);
- return \"N %0,=X'000000FF'\";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c1\";
- }
- CC_STATUS_INIT;
- mvs_check_page (0, 8, 0);
- return \"SLR %0,%0\;IC %0,%1\";
-}")
-
-;
-; truncsihi2 instruction pattern(s).
-;
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=d,m")
- (truncate:HI (match_operand:SI 1 "general_operand" "0,d")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- CC_STATUS_SET (operands[0], operands[1]);
- mvs_check_page (0, 8, 0);
- return \"SLL %0,16\;SRA %0,16\";
- }
- mvs_check_page (0, 4, 0);
- return \"STH %1,%0\";
-}")
-
-;
-; fix_truncdfsi2 instruction pattern(s).
-;
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (fix:SI (truncate:DF (match_operand:DF 1 "general_operand" "f"))))
- (clobber (reg:DF 16))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- if (REGNO (operands[1]) == 16)
- {
- mvs_check_page (0, 12, 8);
- return \"AD 0,=XL8'4F08000000000000'\;STD 0,140(,13)\;L %0,144(,13)\";
- }
- mvs_check_page (0, 14, 8);
- return \"LDR 0,%1\;AD 0,=XL8'4F08000000000000'\;STD 0,140(,13)\;L %0,144(,13)\";
-}")
-
-;
-; floatsidf2 instruction pattern(s).
-;
-; Uses the float field of the TCA.
-;
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (float:DF (match_operand:SI 1 "general_operand" "d")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- mvs_check_page (0, 16, 8);
- return \"ST %1,508(,12)\;XI 508(12),128\;LD %0,504(,12)\;SD %0,=XL8'4E00000080000000'\";
-}")
-
-;
-; truncdfsf2 instruction pattern(s).
-;
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LRER %0,%1\";
-}")
-
-;
-; extendsfdf2 instruction pattern(s).
-;
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (float_extend:DF (match_operand:SF 1 "general_operand" "fmF")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_SET (0, const0_rtx);
- if (FP_REG_P (operands[1]))
- {
- if (REGNO (operands[0]) == REGNO (operands[1]))
- {
- mvs_check_page (0, 10, 0);
- return \"STE %1,140(,13)\;SDR %0,%0\;LE %0,140(,13)\";
- }
- mvs_check_page (0, 4, 0);
- return \"SDR %0,%0\;LER %0,%1\";
- }
- mvs_check_page (0, 6, 0);
- return \"SDR %0,%0\;LE %0,%1\";
-}")
-
-;;
-;;- Add instructions.
-;;
-
-;
-; adddi3 instruction pattern(s).
-;
-
-(define_expand "adddi3"
- [(set (match_operand:DI 0 "general_operand" "")
- (plus:DI (match_operand:DI 1 "general_operand" "")
- (match_operand:DI 2 "general_operand" "")))]
- ""
- "
-{
- rtx label = gen_label_rtx ();
- rtx op0_high = operand_subword (operands[0], 0, 1, DImode);
- rtx op0_low = gen_lowpart (SImode, operands[0]);
-
- emit_insn (gen_rtx (SET, VOIDmode, op0_high,
- gen_rtx (PLUS, SImode,
- operand_subword (operands[1], 0, 1, DImode),
- operand_subword (operands[2], 0, 1, DImode))));
- emit_jump_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
- gen_rtx (SET, VOIDmode, op0_low,
- gen_rtx (PLUS, SImode, gen_lowpart (SImode, operands[1]),
- gen_lowpart (SImode, operands[2]))),
- gen_rtx (USE, VOIDmode, gen_rtx (LABEL_REF, VOIDmode, label)))));
- emit_insn (gen_rtx (SET, VOIDmode, op0_high,
- gen_rtx (PLUS, SImode, op0_high,
- gen_rtx (CONST_INT, SImode, 1))));
- emit_label (label);
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (plus:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "g")))
- (use (label_ref (match_operand 3 "" "")))]
- ""
- "*
-{
- int onpage;
-
- check_label_emit ();
- onpage = mvs_check_label (CODE_LABEL_NUMBER (operands[3]));
- if (REG_P (operands[2]))
- {
- if (!onpage)
- {
- mvs_check_page (0, 8, 4);
- return \"ALR %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
- }
- if (mvs_check_page (0, 6, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"ALR %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
- }
- return \"ALR %0,%2\;BC 12,%l3\";
- }
- if (!onpage)
- {
- mvs_check_page (0, 10, 4);
- return \"AL %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
- }
- if (mvs_check_page (0, 8 ,0))
- {
- mvs_check_page (0, 2, 4);
- return \"AL %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
- }
- return \"AL %0,%2\;BC 12,%l3\";
-}")
-
-;
-; addsi3 instruction pattern(s).
-;
-; The following insn is used when it is known that operand one is an address,
-; frame, stack or argument pointer, and operand two is a constant that is
-; small enough to fit in the displacement field.
-; Notice that we can't allow the frame pointer to used as a normal register
-; because of this insn.
-;
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (plus:SI (match_operand:SI 1 "general_operand" "%a")
- (match_operand:SI 2 "immediate_operand" "J")))]
- "((REGNO (operands[1]) == FRAME_POINTER_REGNUM || REGNO (operands[1]) == ARG_POINTER_REGNUM || REGNO (operands[1]) == STACK_POINTER_REGNUM) && (unsigned) INTVAL (operands[2]) < 4096)"
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c2(,%1)\";
-}")
-
-; This insn handles additions that are relative to the frame pointer.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (plus:SI (match_operand:SI 1 "register_operand" "%a")
- (match_operand:SI 2 "immediate_operand" "i")))]
- "REGNO (operands[1]) == FRAME_POINTER_REGNUM"
- "*
-{
- check_label_emit ();
- if ((unsigned) INTVAL (operands[2]) < 4096)
- {
- mvs_check_page (0, 4, 0);
- return \"LA %0,%c2(,%1)\";
- }
- if (REGNO (operands[1]) == REGNO (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"A %0,%2\";
- }
- mvs_check_page (0, 6, 0);
- return \"L %0,%2\;AR %0,%1\";
-}")
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (plus:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"AR %0,%2\";
- }
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) == -1)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"BCTR %0,0\";
- }
- }
- mvs_check_page (0, 4, 0);
- return \"A %0,%2\";
-}")
-
-;
-; addhi3 instruction pattern(s).
-;
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (plus:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "dmi")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 8, 0);
- return \"STH %2,140(,13)\;AH %0,140(,13)\";
- }
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) == -1)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"BCTR %0,0\";
- }
- mvs_check_page (0, 4, 0);
- return \"AH %0,%H2\";
- }
- mvs_check_page (0, 4, 0);
- return \"AH %0,%2\";
-}")
-
-;
-; addqi3 instruction pattern(s).
-;
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (plus:QI (match_operand:QI 1 "general_operand" "%a")
- (match_operand:QI 2 "general_operand" "ai")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- mvs_check_page (0, 4, 0);
- if (REG_P (operands[2]))
- return \"LA %0,0(%1,%2)\";
- return \"LA %0,%B2(,%1)\";
-}")
-
-;
-; adddf3 instruction pattern(s).
-;
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (plus:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "fmF")))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"ADR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"AD %0,%2\";
-}")
-
-;
-; addsf3 instruction pattern(s).
-;
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (plus:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "fmF")))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"AER %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"AE %0,%2\";
-}")
-
-;;
-;;- Subtract instructions.
-;;
-
-;
-; subdi3 instruction pattern(s).
-;
-
-(define_expand "subdi3"
- [(set (match_operand:DI 0 "general_operand" "")
- (minus:DI (match_operand:DI 1 "general_operand" "")
- (match_operand:DI 2 "general_operand" "")))]
- ""
- "
-{
- rtx label = gen_label_rtx ();
- rtx op0_high = operand_subword (operands[0], 0, 1, DImode);
- rtx op0_low = gen_lowpart (SImode, operands[0]);
-
- emit_insn (gen_rtx (SET, VOIDmode, op0_high,
- gen_rtx (MINUS, SImode,
- operand_subword (operands[1], 0, 1, DImode),
- operand_subword (operands[2], 0, 1, DImode))));
- emit_jump_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
- gen_rtx (SET, VOIDmode, op0_low,
- gen_rtx (MINUS, SImode,
- gen_lowpart (SImode, operands[1]),
- gen_lowpart (SImode, operands[2]))),
- gen_rtx (USE, VOIDmode,
- gen_rtx (LABEL_REF, VOIDmode, label)))));
- emit_insn (gen_rtx (SET, VOIDmode, op0_high,
- gen_rtx (MINUS, SImode, op0_high,
- gen_rtx (CONST_INT, SImode, 1))));
- emit_label (label);
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (minus:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "g")))
- (use (label_ref (match_operand 3 "" "")))]
- ""
- "*
-{
- int onpage;
-
- check_label_emit ();
- CC_STATUS_INIT;
- onpage = mvs_check_label (CODE_LABEL_NUMBER (operands[3]));
- if (REG_P (operands[2]))
- {
- if (!onpage)
- {
- mvs_check_page (0, 8, 4);
- return \"SLR %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
- }
- if (mvs_check_page (0, 6, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"SLR %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
- }
- return \"SLR %0,%2\;BC 12,%l3\";
- }
- if (!onpage)
- {
- mvs_check_page (0, 10, 4);
- return \"SL %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
- }
- if (mvs_check_page (0, 8, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"SL %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
- }
- return \"SL %0,%2\;BC 12,%l3\";
-}")
-
-;
-; subsi3 instruction pattern(s).
-;
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (minus:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"SR %0,%2\";
- }
- if (operands[2] == const1_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"BCTR %0,0\";
- }
- mvs_check_page (0, 4, 0);
- return \"S %0,%2\";
-}")
-
-;
-; subhi3 instruction pattern(s).
-;
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (minus:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 8, 0);
- return \"STH %2,140(,13)\;SH %0,140(,13)\";
- }
- if (operands[2] == const1_rtx)
- {
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"BCTR %0,0\";
- }
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"SH %0,%H2\";
- }
- mvs_check_page (0, 4, 0);
- return \"SH %0,%2\";
-}")
-
-;
-; subqi3 instruction pattern(s).
-;
-
-(define_expand "subqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (minus:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "di")))]
- ""
- "
-{
- if (REG_P (operands[2]))
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (MINUS, QImode, operands[1], operands[2])));
- }
- else
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (PLUS, QImode, operands[1],
- negate_rtx (QImode, operands[2]))));
- }
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=d")
- (minus:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "register_operand" "d")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- mvs_check_page (0, 2, 0);
- return \"SR %0,%2\";
-}")
-
-;
-; subdf3 instruction pattern(s).
-;
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (minus:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "fmF")))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"SDR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"SD %0,%2\";
-}")
-
-;
-; subsf3 instruction pattern(s).
-;
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (minus:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "fmF")))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"SER %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"SE %0,%2\";
-}")
-
-;;
-;;- Multiply instructions.
-;;
-
-;
-; mulsi3 instruction pattern(s).
-;
-
-(define_expand "mulsi3"
- [(set (match_operand:SI 0 "general_operand" "")
- (mult:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == CONST_INT
- && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K'))
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (MULT, SImode, operands[2], operands[1])));
- }
- else if (GET_CODE (operands[2]) == CONST_INT
- && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (MULT, SImode, operands[1], operands[2])));
- }
- else
- {
- rtx r = gen_reg_rtx (DImode);
-
- emit_insn (gen_rtx (SET, VOIDmode,
- gen_rtx (SUBREG, SImode, r, 1), operands[1]));
- emit_insn (gen_rtx (SET, VOIDmode, r,
- gen_rtx (MULT, SImode, r, operands[2])));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (SUBREG, SImode, r, 1)));
- }
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mult:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "immediate_operand" "K")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 0);
- return \"MH %0,%H2\";
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (mult:SI (match_operand:DI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"MR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"M %0,%2\";
-}")
-
-;
-; muldf3 instruction pattern(s).
-;
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (mult:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "fmF")))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"MDR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"MD %0,%2\";
-}")
-
-;
-; mulsf3 instruction pattern(s).
-;
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (mult:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "fmF")))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"MER %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"ME %0,%2\";
-}")
-
-;;
-;;- Divide instructions.
-;;
-
-;
-; divsi3 instruction pattern(s).
-;
-
-(define_expand "divsi3"
- [(set (match_operand:SI 0 "general_operand" "")
- (div:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "
-{
- rtx r = gen_reg_rtx (DImode);
-
- emit_insn (gen_extendsidi2 (r, operands[1]));
- emit_insn (gen_rtx (SET, VOIDmode, r,
- gen_rtx (DIV, SImode, r, operands[2])));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (SUBREG, SImode, r, 1)));
- DONE;
-}")
-
-
-;
-; udivsi3 instruction pattern(s).
-;
-
-(define_expand "udivsi3"
- [(set (match_operand:SI 0 "general_operand" "")
- (udiv:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "
-{
- rtx dr = gen_reg_rtx (DImode);
- rtx dr_0 = gen_rtx (SUBREG, SImode, dr, 0);
- rtx dr_1 = gen_rtx (SUBREG, SImode, dr, 1);
-
-
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) > 0)
- {
- emit_insn (gen_zero_extendsidi2 (dr, operands[1]));
- emit_insn (gen_rtx (SET, VOIDmode, dr,
- gen_rtx (DIV, SImode, dr, operands[2])));
- }
- else
- {
- rtx label1 = gen_label_rtx ();
-
- emit_insn (gen_rtx (SET, VOIDmode, dr_0, operands[1]));
- emit_insn (gen_rtx (SET, VOIDmode, dr_1, const0_rtx));
- emit_insn (gen_cmpsi (dr_0, operands[2]));
- emit_jump_insn (gen_bltu (label1));
- emit_insn (gen_rtx (SET, VOIDmode, dr_1, const1_rtx));
- emit_label (label1);
- }
- }
- else
- {
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
- rtx label3 = gen_label_rtx ();
- rtx sr = gen_reg_rtx (SImode);
-
- emit_insn (gen_rtx (SET, VOIDmode, dr_0, operands[1]));
- emit_insn (gen_rtx (SET, VOIDmode, sr, operands[2]));
- emit_insn (gen_rtx (SET, VOIDmode, dr_1, const0_rtx));
- emit_insn (gen_cmpsi (sr, dr_0));
- emit_jump_insn (gen_bgtu (label3));
- emit_insn (gen_cmpsi (sr, const1_rtx));
- emit_jump_insn (gen_blt (label2));
- emit_jump_insn (gen_beq (label1));
- emit_insn (gen_rtx (SET, VOIDmode, dr,
- gen_rtx (LSHIFTRT, DImode, dr,
- gen_rtx (CONST_INT, SImode, 32))));
- emit_insn (gen_rtx (SET, VOIDmode, dr,
- gen_rtx (DIV, SImode, dr, sr)));
- emit_jump_insn (gen_jump (label3));
- emit_label (label1);
- emit_insn (gen_rtx (SET, VOIDmode, dr_1, dr_0));
- emit_jump_insn (gen_jump (label3));
- emit_label (label2);
- emit_insn (gen_rtx (SET, VOIDmode, dr_1, const1_rtx));
- emit_label (label3);
- }
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], dr_1));
-
- DONE;
-}")
-
-; This is used by divsi3 & udivsi3.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (div:SI (match_operand:DI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"DR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"D %0,%2\";
-}")
-
-;
-; divdf3 instruction pattern(s).
-;
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (div:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "fmF")))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"DDR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"DD %0,%2\";
-}")
-
-;
-; divsf3 instruction pattern(s).
-;
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (div:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "fmF")))]
- ""
- "*
-{
- check_label_emit ();
- if (FP_REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"DER %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"DE %0,%2\";
-}")
-
-;;
-;;- Modulo instructions.
-;;
-
-;
-; modsi3 instruction pattern(s).
-;
-
-(define_expand "modsi3"
- [(set (match_operand:SI 0 "general_operand" "")
- (mod:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "
-{
- rtx r = gen_reg_rtx (DImode);
-
- emit_insn (gen_extendsidi2 (r, operands[1]));
- emit_insn (gen_rtx (SET, VOIDmode, r,
- gen_rtx (MOD, SImode, r, operands[2])));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (SUBREG, SImode, r, 0)));
- DONE;
-}")
-
-;
-; umodsi3 instruction pattern(s).
-;
-
-(define_expand "umodsi3"
- [(set (match_operand:SI 0 "general_operand" "")
- (umod:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "
-{
- rtx dr = gen_reg_rtx (DImode);
- rtx dr_0 = gen_rtx (SUBREG, SImode, dr, 0);
- rtx dr_1 = gen_rtx (SUBREG, SImode, dr, 1);
-
- emit_insn (gen_rtx (SET, VOIDmode, dr_0, operands[1]));
-
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) > 0)
- {
- emit_insn (gen_rtx (SET, VOIDmode, dr,
- gen_rtx (LSHIFTRT, DImode, dr,
- gen_rtx (CONST_INT, SImode, 32))));
- emit_insn (gen_rtx (SET, VOIDmode, dr,
- gen_rtx (MOD, SImode, dr, operands[2])));
- }
- else
- {
- rtx label1 = gen_label_rtx ();
- rtx sr = gen_reg_rtx (SImode);
-
- emit_insn (gen_rtx (SET, VOIDmode, sr, operands[2]));
- emit_insn (gen_cmpsi (dr_0, sr));
- emit_jump_insn (gen_bltu (label1));
- emit_insn (gen_rtx (SET, VOIDmode, sr, gen_rtx (ABS, SImode, sr)));
- emit_insn (gen_rtx (SET, VOIDmode, dr_0,
- gen_rtx (PLUS, SImode, dr_0, sr)));
- emit_label (label1);
- }
- }
- else
- {
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
- rtx label3 = gen_label_rtx ();
- rtx sr = gen_reg_rtx (SImode);
-
- emit_insn (gen_rtx (SET, VOIDmode, dr_0, operands[1]));
- emit_insn (gen_rtx (SET, VOIDmode, sr, operands[2]));
- emit_insn (gen_cmpsi (sr, dr_0));
- emit_jump_insn (gen_bgtu (label3));
- emit_insn (gen_cmpsi (sr, const1_rtx));
- emit_jump_insn (gen_blt (label2));
- emit_jump_insn (gen_beq (label1));
- emit_insn (gen_rtx (SET, VOIDmode, dr,
- gen_rtx (LSHIFTRT, DImode, dr,
- gen_rtx (CONST_INT, SImode, 32))));
- emit_insn (gen_rtx (SET, VOIDmode, dr, gen_rtx (MOD, SImode, dr, sr)));
- emit_jump_insn (gen_jump (label3));
- emit_label (label1);
- emit_insn (gen_rtx (SET, VOIDmode, dr_0, const0_rtx));
- emit_jump_insn (gen_jump (label3));
- emit_label (label2);
- emit_insn (gen_rtx (SET, VOIDmode, dr_0,
- gen_rtx (MINUS, SImode, dr_0, sr)));
- emit_label (label3);
-
- }
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], dr_0));
-
- DONE;
-}")
-
-; This is used by modsi3 & umodsi3.
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (mod:SI (match_operand:DI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"DR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"D %0,%2\";
-}")
-
-;;
-;;- And instructions.
-;;
-
-;
-; anddi3 instruction pattern(s).
-;
-
-;(define_expand "anddi3"
-; [(set (match_operand:DI 0 "general_operand" "")
-; (and:DI (match_operand:DI 1 "general_operand" "")
-; (match_operand:DI 2 "general_operand" "")))]
-; ""
-; "
-;{
-; rtx gen_andsi3();
-;
-; emit_insn (gen_andsi3 (operand_subword (operands[0], 0, 1, DImode),
-; operand_subword (operands[1], 0, 1, DImode),
-; operand_subword (operands[2], 0, 1, DImode)));
-; emit_insn (gen_andsi3 (gen_lowpart (SImode, operands[0]),
-; gen_lowpart (SImode, operands[1]),
-; gen_lowpart (SImode, operands[2])));
-; DONE;
-;}")
-
-;
-; andsi3 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:SI 0 "r_or_s_operand" "=d,m")
- (and:SI (match_operand:SI 1 "r_or_s_operand" "%0,0")
- (match_operand:SI 2 "r_or_s_operand" "g,mi")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"NR %0,%2\";
- }
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"N %0,%2\";
- }
- CC_STATUS_INIT;
- mvs_check_page (0, 6, 0);
- return \"NC %O0(4,%R0),%2\";
-}")
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (and:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"NR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"N %0,%2\";
-}")
-
-;
-; andhi3 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:HI 0 "r_or_s_operand" "=d,m")
- (and:HI (match_operand:HI 1 "r_or_s_operand" "%0,0")
- (match_operand:HI 2 "r_or_s_operand" "di,mi")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"NR %0,%2\";
- }
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"N %0,%2\";
- }
- CC_STATUS_INIT;
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 6, 0);
- return \"NC %O0(2,%R0),%H2\";
- }
- mvs_check_page (0, 6, 0);
- return \"NC %O0(2,%R0),%2\";
-}")
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (and:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "di")))]
- ""
- "*
-{
- check_label_emit ();
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"N %0,%2\";
- }
- mvs_check_page (0, 2, 0);
- return \"NR %0,%2\";
-}")
-
-;
-; andqi3 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:QI 0 "r_or_s_operand" "=d,m")
- (and:QI (match_operand:QI 1 "r_or_s_operand" "%0,0")
- (match_operand:QI 2 "r_or_s_operand" "di,mi")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"NR %0,%2\";
- }
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"N %0,%2\";
- }
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"NI %0,%B2\";
- }
- mvs_check_page (0, 6, 0);
- return \"NC %O0(1,%R0),%2\";
-}")
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (and:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "di")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"N %0,%2\";
- }
- mvs_check_page (0, 2, 0);
- return \"NR %0,%2\";
-}")
-
-;;
-;;- Bit set (inclusive or) instructions.
-;;
-
-;
-; iordi3 instruction pattern(s).
-;
-
-;(define_expand "iordi3"
-; [(set (match_operand:DI 0 "general_operand" "")
-; (ior:DI (match_operand:DI 1 "general_operand" "")
-; (match_operand:DI 2 "general_operand" "")))]
-; ""
-; "
-;{
-; rtx gen_iorsi3();
-;
-; emit_insn (gen_iorsi3 (operand_subword (operands[0], 0, 1, DImode),
-; operand_subword (operands[1], 0, 1, DImode),
-; operand_subword (operands[2], 0, 1, DImode)));
-; emit_insn (gen_iorsi3 (gen_lowpart (SImode, operands[0]),
-; gen_lowpart (SImode, operands[1]),
-; gen_lowpart (SImode, operands[2])));
-; DONE;
-;}")
-
-;
-; iorsi3 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:SI 0 "r_or_s_operand" "=d,m")
- (ior:SI (match_operand:SI 1 "r_or_s_operand" "%0,0")
- (match_operand:SI 2 "r_or_s_operand" "g,mi")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"OR %0,%2\";
- }
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"O %0,%2\";
- }
- CC_STATUS_INIT;
- mvs_check_page (0, 6, 0);
- return \"OC %O0(4,%R0),%2\";
-}")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (ior:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"OR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"O %0,%2\";
-}")
-
-;
-; iorhi3 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:HI 0 "r_or_s_operand" "=d,m")
- (ior:HI (match_operand:HI 1 "r_or_s_operand" "%0,0")
- (match_operand:HI 2 "r_or_s_operand" "di,mi")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"OR %0,%2\";
- }
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"O %0,%2\";
- }
- CC_STATUS_INIT;
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 6, 0);
- return \"OC %O0(2,%R0),%H2\";
- }
- mvs_check_page (0, 6, 0);
- return \"OC %O0(2,%R0),%2\";
-}")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (ior:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "di")))]
- ""
- "*
-{
- check_label_emit ();
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"O %0,%2\";
- }
- mvs_check_page (0, 2, 0);
- return \"OR %0,%2\";
-}")
-
-;
-; iorqi3 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:QI 0 "r_or_s_operand" "=d,m")
- (ior:QI (match_operand:QI 1 "r_or_s_operand" "%0,0")
- (match_operand:QI 2 "r_or_s_operand" "di,mi")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"OR %0,%2\";
- }
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"O %0,%2\";
- }
- CC_STATUS_INIT;
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"OI %0,%B2\";
- }
- mvs_check_page (0, 6, 0);
- return \"OC %O0(1,%R0),%2\";
-}")
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (ior:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "di")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"O %0,%2\";
- }
- mvs_check_page (0, 2, 0);
- return \"OR %0,%2\";
-}")
-
-;;
-;;- Xor instructions.
-;;
-
-;
-; xordi3 instruction pattern(s).
-;
-
-;(define_expand "xordi3"
-; [(set (match_operand:DI 0 "general_operand" "")
-; (xor:DI (match_operand:DI 1 "general_operand" "")
-; (match_operand:DI 2 "general_operand" "")))]
-; ""
-; "
-;{
-; rtx gen_xorsi3();
-;
-; emit_insn (gen_xorsi3 (operand_subword (operands[0], 0, 1, DImode),
-; operand_subword (operands[1], 0, 1, DImode),
-; operand_subword (operands[2], 0, 1, DImode)));
-; emit_insn (gen_xorsi3 (gen_lowpart (SImode, operands[0]),
-; gen_lowpart (SImode, operands[1]),
-; gen_lowpart (SImode, operands[2])));
-; DONE;
-;}")
-
-;
-; xorsi3 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:SI 0 "r_or_s_operand" "=d,m")
- (xor:SI (match_operand:SI 1 "r_or_s_operand" "%0,0")
- (match_operand:SI 2 "r_or_s_operand" "g,mi")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"XR %0,%2\";
- }
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"X %0,%2\";
- }
- CC_STATUS_INIT;
- mvs_check_page (0, 6, 0);
- return \"XC %O0(4,%R0),%2\";
-}")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (xor:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"XR %0,%2\";
- }
- mvs_check_page (0, 4, 0);
- return \"X %0,%2\";
-}")
-
-;
-; xorhi3 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:HI 0 "r_or_s_operand" "=d,m")
- (xor:HI (match_operand:HI 1 "r_or_s_operand" "%0,0")
- (match_operand:HI 2 "r_or_s_operand" "di,mi")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"XR %0,%2\";
- }
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"X %0,%2\";
- }
- CC_STATUS_INIT;
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 6, 0);
- return \"XC %O0(2,%R0),%H2\";
- }
- mvs_check_page (0, 6, 0);
- return \"XC %O0(2,%R0),%2\";
-}")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (xor:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "di")))]
- ""
- "*
-{
- check_label_emit ();
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"X %0,%2\";
- }
- mvs_check_page (0, 2, 0);
- return \"XR %0,%2\";
-}")
-
-;
-; xorqi3 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:QI 0 "r_or_s_operand" "=d,m")
- (xor:QI (match_operand:QI 1 "r_or_s_operand" "%0,0")
- (match_operand:QI 2 "r_or_s_operand" "di,mi")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 2, 0);
- return \"XR %0,%2\";
- }
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 0);
- return \"X %0,%2\";
- }
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"XI %0,%B2\";
- }
- mvs_check_page (0, 6, 0);
- return \"XC %O0(1,%R0),%2\";
-}")
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (xor:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "di")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- mvs_check_page (0, 4, 0);
- return \"X %0,%2\";
- }
- mvs_check_page (0, 2, 0);
- return \"XR %0,%2\";
-}")
-
-;;
-;;- Negate instructions.
-;;
-
-;
-; negsi2 instruction pattern(s).
-;
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (neg:SI (match_operand:SI 1 "general_operand" "d")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LCR %0,%1\";
-}")
-
-;
-; neghi2 instruction pattern(s).
-;
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (neg:HI (match_operand:HI 1 "general_operand" "d")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 10, 0);
- return \"SLL %1,16\;SRA %1,16\;LCR %0,%1\";
-}")
-
-;
-; negdf2 instruction pattern(s).
-;
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (neg:DF (match_operand:DF 1 "general_operand" "f")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LCDR %0,%1\";
-}")
-
-;
-; negsf2 instruction pattern(s).
-;
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (neg:SF (match_operand:SF 1 "general_operand" "f")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LCER %0,%1\";
-}")
-
-;;
-;;- Absolute value instructions.
-;;
-
-;
-; abssi2 instruction pattern(s).
-;
-
-(define_insn "abssi2"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (abs:SI (match_operand:SI 1 "general_operand" "d")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LPR %0,%1\";
-}")
-
-;
-; abshi2 instruction pattern(s).
-;
-
-(define_insn "abshi2"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (abs:HI (match_operand:HI 1 "general_operand" "d")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 10, 0);
- return \"SLL %1,16\;SRA %1,16\;LPR %0,%1\";
-}")
-
-;
-; absdf2 instruction pattern(s).
-;
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (abs:DF (match_operand:DF 1 "general_operand" "f")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LPDR %0,%1\";
-}")
-
-;
-; abssf2 instruction pattern(s).
-;
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (abs:SF (match_operand:SF 1 "general_operand" "f")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LPER %0,%1\";
-}")
-
-;;
-;;- One complement instructions.
-;;
-
-;
-; one_cmpldi2 instruction pattern(s).
-;
-
-;(define_expand "one_cmpldi2"
-; [(set (match_operand:DI 0 "general_operand" "")
-; (not:DI (match_operand:DI 1 "general_operand" "")))]
-; ""
-; "
-;{
-; rtx gen_one_cmplsi2();
-;
-; emit_insn (gen_one_cmplsi2 (operand_subword (operands[0], 0, 1, DImode),
-; operand_subword (operands[1], 0, 1, DImode)));
-; emit_insn (gen_one_cmplsi2 (gen_lowpart (SImode, operands[0]),
-; gen_lowpart (SImode, operands[1])));
-; DONE;
-;}")
-
-;
-; one_cmplsi2 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:SI 0 "r_or_s_operand" "=dm")
- (not:SI (match_operand:SI 1 "r_or_s_operand" "0")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 4);
- return \"X %0,=F'-1'\";
- }
- CC_STATUS_INIT;
- mvs_check_page (0, 6, 4);
- return \"XC %O0(4,%R0),=F'-1'\";
-}")
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (not:SI (match_operand:SI 1 "general_operand" "0")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 4);
- return \"X %0,=F'-1'\";
-}")
-
-;
-; one_cmplhi2 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:HI 0 "r_or_s_operand" "=dm")
- (not:HI (match_operand:HI 1 "r_or_s_operand" "0")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 4);
- return \"X %0,=F'-1'\";
- }
- CC_STATUS_INIT;
- mvs_check_page (0, 6, 4);
- return \"XC %O0(2,%R0),=X'FFFF'\";
-}")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (not:HI (match_operand:HI 1 "general_operand" "0")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 4);
- return \"X %0,=F'-1'\";
-}")
-
-;
-; one_cmplqi2 instruction pattern(s).
-;
-
-(define_insn ""
- [(set (match_operand:QI 0 "r_or_s_operand" "=dm")
- (not:QI (match_operand:QI 1 "r_or_s_operand" "0")))]
- "TARGET_CHAR_INSTRUCTIONS"
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 4, 4);
- return \"X %0,=F'-1'\";
- }
- mvs_check_page (0, 4, 0);
- return \"XI %0,255\";
-}")
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (not:QI (match_operand:QI 1 "general_operand" "0")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- mvs_check_page (0, 4, 4);
- return \"X %0,=F'-1'\";
-}")
-
-;;
-;;- Arithmetic shift instructions.
-;;
-
-;
-; ashldi3 instruction pattern(s).
-;
-
-(define_insn "ashldi3"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (ashift:DI (match_operand:DI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- mvs_check_page (0, 4, 0);
- if (REG_P (operands[2]))
- return \"SLDA %0,0(%2)\";
- return \"SLDA %0,%c2\";
-}")
-
-;
-; ashrdi3 instruction pattern(s).
-;
-
-(define_insn "ashrdi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashiftrt:DI (match_operand:DI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 0);
- if (REG_P (operands[2]))
- return \"SRDA %0,0(%2)\";
- return \"SRDA %0,%c2\";
-}")
-
-;
-; ashlsi3 instruction pattern(s).
-;
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (ashift:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- mvs_check_page (0, 4, 0);
- if (REG_P (operands[2]))
- return \"SLL %0,0(%2)\";
- return \"SLL %0,%c2\";
-}")
-
-;
-; ashrsi3 instruction pattern(s).
-;
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 0);
- if (REG_P (operands[2]))
- return \"SRA %0,0(%2)\";
- return \"SRA %0,%c2\";
-}")
-
-;
-; ashlhi3 instruction pattern(s).
-;
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (ashift:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 8, 0);
- if (REG_P (operands[2]))
- return \"SLL %0,16(%2)\;SRA %0,16\";
- return \"SLL %0,16+%c2\;SRA %0,16\";
-}")
-
-;
-; ashrhi3 instruction pattern(s).
-;
-
-(define_insn "ashrhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 0);
- if (REG_P (operands[2]))
- return \"SLL %0,16\;SRA %0,16(%2)\";
- return \"SLL %0,16\;SRA %0,16+%c2\";
-}")
-
-;
-; ashlqi3 instruction pattern(s).
-;
-
-(define_insn "ashlqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (ashift:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- mvs_check_page (0, 4, 0);
- if (REG_P (operands[2]))
- return \"SLL %0,0(%2)\";
- return \"SLL %0,%c2\";
-}")
-
-;
-; ashrqi3 instruction pattern(s).
-;
-
-(define_insn "ashrqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 8, 0);
- if (REG_P (operands[2]))
- return \"SLL %0,24\;SRA %0,24(%2)\";
- return \"SLL %0,24\;SRA %0,24+%c2\";
-}")
-
-;;
-;;- Logical shift instructions.
-;;
-
-;
-; lshrdi3 instruction pattern(s).
-;
-
-(define_insn "lshrdi3"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (lshiftrt:DI (match_operand:DI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 0);
- if (REG_P (operands[2]))
- return \"SRDL %0,0(%2)\";
- return \"SRDL %0,%c2\";
-}")
-
-
-;
-; lshrsi3 instruction pattern(s).
-;
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 4, 0);
- if (REG_P (operands[2]))
- return \"SRL %0,0(%2)\";
- return \"SRL %0,%c2\";
-}")
-
-;
-; lshrhi3 instruction pattern(s).
-;
-
-(define_insn "lshrhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- if (REG_P (operands[2]))
- {
- mvs_check_page (0, 8, 4);
- return \"N %0,=X'0000FFFF'\;SRL %0,0(%2)\";
- }
- mvs_check_page (0, 8, 4);
- return \"N %0,=X'0000FFFF'\;SRL %0,%c2\";
-}")
-
-;
-; lshrqi3 instruction pattern(s).
-;
-
-(define_insn "lshrqi3"
- [(set (match_operand:QI 0 "general_operand" "=d")
- (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "Ja")))]
- ""
- "*
-{
- check_label_emit ();
- CC_STATUS_INIT;
- mvs_check_page (0, 8, 4);
- if (REG_P (operands[2]))
- return \"N %0,=X'000000FF'\;SRL %0,0(%2)\";
- return \"N %0,=X'000000FF'\;SRL %0,%c2\";
-}")
-
-;;
-;;- Conditional jump instructions.
-;;
-
-;
-; beq instruction pattern(s).
-;
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BER 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BER 14\";
- }
- return \"BE %l0\";
-}")
-
-;
-; bne instruction pattern(s).
-;
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNER 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNER 14\";
- }
- return \"BNE %l0\";
-}")
-
-;
-; bgt instruction pattern(s).
-;
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BHR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BHR 14\";
- }
- return \"BH %l0\";
-}")
-
-;
-; bgtu instruction pattern(s).
-;
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BHR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BHR 14\";
- }
- return \"BH %l0\";
-}")
-
-;
-; blt instruction pattern(s).
-;
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BLR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BLR 14\";
- }
- return \"BL %l0\";
-}")
-
-;
-; bltu instruction pattern(s).
-;
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BLR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BLR 14\";
- }
- return \"BL %l0\";
-}")
-
-;
-; bge instruction pattern(s).
-;
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNLR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNLR 14\";
- }
- return \"BNL %l0\";
-}")
-
-;
-; bgeu instruction pattern(s).
-;
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNLR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNLR 14\";
- }
- return \"BNL %l0\";
-}")
-
-;
-; ble instruction pattern(s).
-;
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNHR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNHR 14\";
- }
- return \"BNH %l0\";
-}")
-
-;
-; bleu instruction pattern(s).
-;
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNHR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNHR 14\";
- }
- return \"BNH %l0\";
-}")
-
-;;
-;;- Negated conditional jump instructions.
-;;
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNER 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNER 14\";
- }
- return \"BNE %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BER 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BER 14\";
- }
- return \"BE %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNHR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNHR 14\";
- }
- return \"BNH %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNHR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNHR 14\";
- }
- return \"BNH %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNLR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNLR 14\";
- }
- return \"BNL %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BNLR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BNLR 14\";
- }
- return \"BNL %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BLR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BLR 14\";
- }
- return \"BL %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BLR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BLR 14\";
- }
- return \"BL %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BHR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BHR 14\";
- }
- return \"BH %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BHR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BHR 14\";
- }
- return \"BH %l0\";
-}")
-
-;;
-;;- Subtract one and jump if not zero.
-;;
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (plus:SI (match_operand:SI 0 "register_operand" "+d")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[1])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l1)\;BCTR %0,14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l1)\;BCTR %0,14\";
- }
- return \"BCT %0,%l1\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (plus:SI (match_operand:SI 0 "register_operand" "+d")
- (const_int -1))
- (const_int 0))
- (pc)
- (label_ref (match_operand 1 "" ""))))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[1])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l1)\;BCTR %0,14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l1)\;BCTR %0,14\";
- }
- return \"BCT %0,%l1\";
-}")
-
-;;
-;;- Unconditional jump instructions.
-;;
-
-;
-; jump instruction pattern(s).
-;
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
-{
- check_label_emit ();
- if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
- {
- mvs_check_page (0, 6, 4);
- return \"L 14,=A(%l0)\;BR 14\";
- }
- if (mvs_check_page (0, 4, 0))
- {
- mvs_check_page (0, 2, 4);
- return \"L 14,=A(%l0)\;BR 14\";
- }
- return \"B %l0\";
-}")
-
-;
-; indirect-jump instruction pattern(s).
-;
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "general_operand" "r"))]
- "(GET_CODE (operands[0]) != MEM )"
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"BR %0\";
-}")
-
-;
-; tablejump instruction pattern(s).
-;
-
-(define_insn "tablejump"
- [(set (pc)
- (match_operand:SI 0 "general_operand" "am"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "*
-{
- check_label_emit ();
- if (REG_P (operands[0]))
- {
- mvs_check_page (0, 6, 0);
- return \"BR %0\;DS 0F\";
- }
- mvs_check_page (0, 10, 0);
- return \"L 14,%0\;BR 14\;DS 0F\";
-}")
-
-;;
-;;- Jump to subroutine.
-;;
-;; For the C/370 environment the internal functions, ie. sqrt, are called with
-;; a non-standard form. So, we must fix it here. There's no BM like IBM.
-;;
-
-;
-; call instruction pattern(s).
-;
-
-(define_insn "call"
- [(call (match_operand:QI 0 "memory_operand" "m")
- (match_operand:SI 1 "immediate_operand" "i"))]
- ""
- "*
-{
- static char temp[128];
- int i = STACK_POINTER_OFFSET;
-
- check_label_emit ();
- if (mvs_function_check (XSTR (operands[0], 0)))
- {
- mvs_check_page (0, 22, 4);
- sprintf ( temp, \"LA 1,136(,13)\;ST 1,%d(,13)\;LA 1,%d(,13)\;L 15,%%0\;BALR 14,15\;LD 0,136(,13)\",
- i - 4, i - 4 );
- }
- else
- {
- mvs_check_page (0, 10, 4);
- sprintf ( temp, \"LA 1,%d(,13)\;L 15,%%0\;BALR 14,15\", i );
- }
- return temp;
-}")
-
-;
-; call_value instruction pattern(s).
-;
-
-(define_insn "call_value"
- [(set (match_operand 0 "" "rf")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:SI 2 "general_operand" "i")))]
- ""
- "*
-{
- static char temp[128];
- int i = STACK_POINTER_OFFSET;
-
- check_label_emit ();
- if (mvs_function_check (XSTR (operands[1], 0)))
- {
- mvs_check_page (0, 22, 4);
- sprintf ( temp, \"LA 1,136(,13)\;ST 1,%d(,13)\;LA 1,%d(,13)\;L 15,%%1\;BALR 14,15\;LD 0,136(,13)\",
- i - 4, i - 4 );
- }
- else
- {
- mvs_check_page (0, 10, 4);
- sprintf ( temp, \"LA 1,%d(,13)\;L 15,%%1\;BALR 14,15\", i );
- }
- return temp;
-}")
-
-(define_insn ""
- [(call (mem:QI (match_operand:SI 0 "" "i"))
- (match_operand:SI 1 "general_operand" "g"))]
- "GET_CODE (operands[0]) == SYMBOL_REF"
- "*
-{
- static char temp[128];
- int i = STACK_POINTER_OFFSET;
-
- check_label_emit ();
- if (mvs_function_check (XSTR (operands[0], 0)))
- {
- mvs_check_page (0, 22, 4);
- sprintf ( temp, \"LA 1,136(,13)\;ST 1,%d(,13)\;LA 1,%d(,13)\;L 15,%%0\;BALR 14,15\;LD 0,136(,13)\",
- i - 4, i - 4 );
- }
- else
- {
- mvs_check_page (0, 10, 4);
- sprintf ( temp, \"LA 1,%d(,13)\;L 15,%%0\;BALR 14,15\", i );
- }
- return temp;
-}")
-
-(define_insn ""
- [(set (match_operand 0 "" "rf")
- (call (mem:QI (match_operand:SI 1 "" "i"))
- (match_operand:SI 2 "general_operand" "g")))]
- "GET_CODE (operands[1]) == SYMBOL_REF"
- "*
-{
- static char temp[128];
- int i = STACK_POINTER_OFFSET;
-
- check_label_emit ();
- if (mvs_function_check (XSTR (operands[1], 0)))
- {
- mvs_check_page (0, 22, 4);
- sprintf ( temp, \"LA 1,136(,13)\;ST 1,%d(,13)\;LA 1,%d(,13)\;L 15,%%1\;BALR 14,15\;LD 0,136(,13)\",
- i - 4, i - 4 );
- }
- else
- {
- mvs_check_page (0, 10, 4);
- sprintf ( temp, \"LA 1,%d(,13)\;L 15,%%1\;BALR 14,15\", i );
- }
- return temp;
-}")
-
-
-;;
-;;- Miscellaneous instructions.
-;;
-
-;
-; nop instruction pattern(s).
-;
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "*
-{
- check_label_emit ();
- mvs_check_page (0, 2, 0);
- return \"LR 0,0\";
-}")
-
diff --git a/gcc/config/i370/t-i370 b/gcc/config/i370/t-i370
deleted file mode 100644
index d20ab385dcc..00000000000
--- a/gcc/config/i370/t-i370
+++ /dev/null
@@ -1,4 +0,0 @@
-# There is no libgcc for mvs
-LIBGCC =
-INSTALL_LIBGCC =
-LIBGCC1_TEST =
diff --git a/gcc/config/i370/xm-i370.h b/gcc/config/i370/xm-i370.h
deleted file mode 100644
index 438a6a4be9d..00000000000
--- a/gcc/config/i370/xm-i370.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Configuration for GNU C-compiler for System/370.
- Copyright (C) 1989, 1993 Free Software Foundation, Inc.
- Contributed by Jan Stein (jan@cd.chalmers.se).
- Modified for MVS C/370 by Dave Pitts (dpitts@nyx.cs.du.edu)
-
-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. */
-
-/* #defines that need visibility everywhere. */
-
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_FLOAT_FORMAT IBM_FLOAT_FORMAT
-#define HOST_EBCDIC 1
-
-#define USG
-#ifndef MVS
-#define MVS
-#endif
-
-/* Target machine dependencies. tm.h is a symbolic link to the actual
- target specific file. */
-
-#include "tm.h"
-
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-
-/* Arguments to use with `exit'. */
-
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 12
-
-#define NO_DBX_FORMAT
-
diff --git a/gcc/config/i386/386bsd.h b/gcc/config/i386/386bsd.h
deleted file mode 100644
index c93279ffb00..00000000000
--- a/gcc/config/i386/386bsd.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Configuration for an i386 running 386BSD as the target machine. */
-
-/* This is tested by i386gas.h. */
-#define YES_UNDERSCORES
-
-#include "i386/gstabs.h"
-
-/* Get perform_* macros to build libgcc.a. */
-#include "i386/perform.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -D____386BSD____ -D__386BSD__ -DBSD_NET2 -Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386)"
-
-/* Like the default, except no -lg. */
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-
-#define WCHAR_UNSIGNED 1
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 16
-
-/* 386BSD does have atexit. */
-
-#define HAVE_ATEXIT
-
-/* Redefine this to use %eax instead of %edx. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- if (flag_pic) \
- { \
- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \
- LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall mcount\n"); \
- } \
-}
-
-#undef ASM_APP_ON
-#define ASM_APP_ON "#APP\n"
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* The following macros are stolen from i386v4.h */
-/* These have to be defined to get PIC code correct */
-
-/* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
- i386.md for an explanation of the expression this outputs. */
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
-
-/* Indicate that jump tables go in the text section. This is
- necessary when compiling PIC code. */
-
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/i386/aix386.h b/gcc/config/i386/aix386.h
deleted file mode 100644
index e0498e79595..00000000000
--- a/gcc/config/i386/aix386.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Definitions for IBM PS2 running AIX/386 with gas.
- From: Minh Tran-Le <TRANLE@intellicorp.com>
- Copyright (C) 1988 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 configuration file is for gcc with gas-2.x and gnu ld 2.x
- * with aix ps/2 1.3.x.
- */
-
-/* Define USE_GAS if you have the new version of gas that can handle
- * multiple segments and .section pseudo op. This will allow gcc to
- * use the .init section for g++ ctor/dtor.
- *
- * If you don't have gas then undefined USE_GAS. You will also have
- * to use collect if you want to use g++
- */
-#define USE_GAS
-
-#include "i386/aix386ng.h"
-
-/* Use crt1.o as a startup file and crtn.o as a closing file.
- And add crtbegin.o and crtend.o for ctors and dtors */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} crtbegin.o%s"
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "crtend.o%s crtn.o%s"
-
-/* Removed the -K flags because the gnu ld does not handle it */
-#undef LINK_SPEC
-#define LINK_SPEC "%{T*} %{z:-lm}"
-
-/* Define a few machine-specific details of the implementation of
- constructors. */
-
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP ".section .init,\"x\""
-
-#define CTOR_LIST_BEGIN \
- asm (INIT_SECTION_ASM_OP); \
- asm ("pushl $0")
-#define CTOR_LIST_END CTOR_LIST_BEGIN
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tpushl $"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
diff --git a/gcc/config/i386/aix386ng.h b/gcc/config/i386/aix386ng.h
deleted file mode 100644
index ec283a4fa4e..00000000000
--- a/gcc/config/i386/aix386ng.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Definitions for IBM PS2 running AIX/386.
- Copyright (C) 1988, 1996 Free Software Foundation, Inc.
- Contributed by Minh Tran-Le <TRANLE@intellicorp.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 "i386/i386.h"
-
-/* Get the generic definitions for system V.3. */
-
-#include "svr3.h"
-
-/* Use the ATT assembler syntax.
- This overrides at least one macro (USER_LABEL_PREFIX) from svr3.h. */
-
-#include "i386/att.h"
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
-#define ENDFILE_SPEC "crtn.o%s"
-
-#define LIB_SPEC "%{shlib:-lc_s} -lc"
-
-/* Special flags for the linker. I don't know what they do. */
-
-#define LINK_SPEC "%{K} %{!K:-K} %{T*} %{z:-lm}"
-
-/* Specify predefined symbols in preprocessor. */
-
-#define CPP_PREDEFINES "-Dps2 -Dunix -Asystem(aix)"
-
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] \
- "%{posix:-D_POSIX_SOURCE}%{!posix:-DAIX} -D_I386 -D_AIX -D_MBCS"
-
-/* special flags for the aix assembler to generate the short form for all
- qualifying forward reference */
-/* The buggy /bin/as of aix ps/2 1.2.x cannot always handle it. */
-#if 0
-#define ASM_SPEC "-s2"
-#endif /* 0 */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { fprintf (FILE, "\t.file\t"); \
- output_quoted_string (FILE, dump_base_name); \
- fprintf (FILE, "\n"); \
- if (optimize) \
- ASM_FILE_START_1 (FILE); \
- else \
- fprintf (FILE, "\t.noopt\n"); \
- } while (0)
-
-/* This was suggested, but it shouldn't be right for DBX output. -- RMS
- #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */
-
-/* Writing `int' for a bitfield forces int alignment for the structure. */
-
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-#ifndef USE_GAS
-/* Don't write a `.optim' pseudo; this assembler
- is said to have a bug when .optim is used. */
-
-#undef ASM_FILE_START_1
-#define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.noopt\n")
-#endif
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tleal %sP%d,%%eax\n\tcall mcount\n", LPREFIX, (LABELNO));
-
-/* Note that using bss_section here caused errors
- in building shared libraries on system V.3.
- but AIX 1.2 does not have yet shareable libraries on PS2 */
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- (bss_section (), \
- ASM_OUTPUT_LABEL ((FILE), (NAME)), \
- fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)))
-
-
-/* Undef all the .init and .fini section stuff if we are not using gas and
- * gnu ld so that we can use collect because the standard /bin/as and /bin/ld
- * cannot handle those.
- */
-#ifndef USE_GAS
-# undef INIT_SECTION_ASM_OP
-# undef FINI_SECTION_ASM_OP
-# undef CTORS_SECTION_ASM_OP
-# undef DTORS_SECTION_ASM_OP
-# undef ASM_OUTPUT_CONSTRUCTOR
-# undef ASM_OUTPUT_DESTRUCTOR
-# undef DO_GLOBAL_CTORS_BODY
-
-# undef CTOR_LIST_BEGIN
-# define CTOR_LIST_BEGIN
-# undef CTOR_LIST_END
-# define CTOR_LIST_END
-# undef DTOR_LIST_BEGIN
-# define DTOR_LIST_BEGIN
-# undef DTOR_LIST_END
-# define DTOR_LIST_END
-
-# undef CONST_SECTION_FUNCTION
-# define CONST_SECTION_FUNCTION \
-void \
-const_section () \
-{ \
- extern void text_section(); \
- text_section(); \
-}
-
-# undef EXTRA_SECTION_FUNCTIONS
-# define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION
-
-/* for collect2 */
-# define OBJECT_FORMAT_COFF
-# define MY_ISCOFF(magic) \
- ((magic) == I386MAGIC || (magic) == I386SVMAGIC)
-
-#endif /* !USE_GAS */
diff --git a/gcc/config/i386/att.h b/gcc/config/i386/att.h
deleted file mode 100644
index e5c2d9c7e99..00000000000
--- a/gcc/config/i386/att.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Definitions for AT&T assembler syntax for the Intel 80386.
- Copyright (C) 1988, 1996 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. */
-
-/* Include common aspects of all 386 Unix assemblers. */
-#include "i386/unix.h"
-
-#define TARGET_VERSION fprintf (stderr, " (80386, ATT syntax)");
-
-/* Define the syntax of instructions and addresses. */
-
-/* Prefix for internally generated assembler labels. */
-#define LPREFIX ".L"
-
-/* Assembler pseudos to introduce constants of various size. */
-
-/* #define ASM_BYTE_OP "\t.byte" Now in svr3.h or svr4.h. */
-#define ASM_SHORT "\t.value"
-#define ASM_LONG "\t.long"
-#define ASM_DOUBLE "\t.double"
-
-/* How to output an ASCII string constant. */
-
-#define ASM_OUTPUT_ASCII(FILE, p, size) \
-do \
-{ int i = 0; \
- while (i < (size)) \
- { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n"); \
- fprintf ((FILE), "%s ", ASM_BYTE_OP); } \
- else fprintf ((FILE), ","); \
- fprintf ((FILE), "0x%x", ((p)[i++] & 0377)) ;} \
- fprintf ((FILE), "\n"); \
-} while (0)
-
-/* Do use .optim by default on this machine. */
-#undef ASM_FILE_START_1
-#define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n")
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf ((FILE), "\t.set .,.+%u\n", (SIZE))
-
-/* Can't use ASM_OUTPUT_SKIP in text section; it doesn't leave 0s. */
-
-#define ASM_NO_SKIP_IN_TEXT 1
-
-/* Define the syntax of labels and symbol definitions/declarations. */
-
-/* This is how to store into the string BUF
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), ".%s%d", (PREFIX), (NUMBER))
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
diff --git a/gcc/config/i386/bsd.h b/gcc/config/i386/bsd.h
deleted file mode 100644
index d50be3664c1..00000000000
--- a/gcc/config/i386/bsd.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Definitions for BSD assembler syntax for Intel 386
- (actually AT&T syntax for insns and operands,
- adapted to BSD conventions for symbol names and debugging.)
- Copyright (C) 1988, 1996 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. */
-
-/* Include common aspects of all 386 Unix assemblers. */
-#include "i386/unix.h"
-
-/* Use the Sequent Symmetry assembler syntax. */
-
-#define TARGET_VERSION fprintf (stderr, " (80386, BSD syntax)");
-
-/* Define the syntax of pseudo-ops, labels and comments. */
-
-/* Prefix for internally generated assembler labels. If we aren't using
- underscores, we are using prefix `.'s to identify labels that should
- be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
-#ifdef NO_UNDERSCORES
-#define LPREFIX ".L"
-#else
-#define LPREFIX "L"
-#endif /* not NO_UNDERSCORES */
-
-/* Assembler pseudos to introduce constants of various size. */
-
-#define ASM_BYTE_OP "\t.byte"
-#define ASM_SHORT "\t.word"
-#define ASM_LONG "\t.long"
-#define ASM_DOUBLE "\t.double"
-
-/* Output at beginning of assembler file.
- ??? I am skeptical of this -- RMS. */
-
-#define ASM_FILE_START(FILE) \
- do { fprintf (FILE, "\t.file\t"); \
- output_quoted_string (FILE, dump_base_name); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* This was suggested, but it shouldn't be right for DBX output. -- RMS
- #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */
-
-
-/* Define the syntax of labels and symbol definitions/declarations. */
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %u\n", (SIZE))
-
-/* Define the syntax of labels and symbol definitions/declarations. */
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", (LOG))
-
-/* This is how to store into the string BUF
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#ifdef NO_UNDERSCORES
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER))
-#else
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), "*%s%d", (PREFIX), (NUMBER))
-#endif
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#ifdef NO_UNDERSCORES
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-#else
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-#endif
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#ifdef NO_UNDERSCORES
-#define USER_LABEL_PREFIX ""
-#else
-#define USER_LABEL_PREFIX "_"
-#endif /* not NO_UNDERSCORES */
-
-/* Sequent has some changes in the format of DBX symbols. */
-#define DBX_NO_XREFS 1
-
-/* Don't split DBX symbols into continuations. */
-#define DBX_CONTIN_LENGTH 0
diff --git a/gcc/config/i386/bsd386.h b/gcc/config/i386/bsd386.h
deleted file mode 100644
index 935a2e06404..00000000000
--- a/gcc/config/i386/bsd386.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Configuration for an i386 running BSDI's BSD/386 1.1 as the target
- machine. */
-
-#include "i386/386bsd.h"
-
-/* We exist mostly to add -Dbsdi and such to the predefines. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -Dbsdi -D__i386__ -D__bsdi__ -D____386BSD____ -D__386BSD__ -DBSD_NET2 -Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386)"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
diff --git a/gcc/config/i386/config-nt.sed b/gcc/config/i386/config-nt.sed
deleted file mode 100644
index 6c86b27e99c..00000000000
--- a/gcc/config/i386/config-nt.sed
+++ /dev/null
@@ -1,38 +0,0 @@
-/^Makefile/,/^ rm -f config.run/d
-s/rm -f/del/
-s/|| cp/|| copy/
-/^config.status/,/ fi/d
-s/config.status//g
-s/\/dev\/null/NUL/g
-s/$(srcdir)\/c-parse/c-parse/g
-s/$(srcdir)\/c-gperf/c-gperf/g
-/^multilib.h/ s/multilib/not-multilib/
-/^target=/ c\
-target=winnt3.5
-/^xmake_file=/ d
-/^tmake_file=/ d
-/^out_file/ c\
-out_file=config/i386/i386.c
-/^out_object_file/ c\
-out_object_file=i386.obj
-/^md_file/ c\
-md_file=config/i386/i386.md
-/^tm_file/ c\
-tm_file=config/i386/win-nt.h
-/^build_xm_file/ c\
-build_xm_file=config/i386/xm-winnt.h
-/^host_xm_file/ c\
-host_xm_file=config/i386/xm-winnt.h
-/^####target/ i\
-CC = cl \
-CLIB = libc.lib kernel32.lib \
-CFLAGS = -Di386 -DWIN32 -D_WIN32 -D_M_IX86=300 -D_X86_=1 \\\
- -DALMOST_STDC -D_MSC_VER=800 \
-LDFLAGS = -align:0x1000 -subsystem:console -entry:mainCRTStartup \\\
- -stack:1000000,1000 \
-\
-EXTRA_OBJS=winnt.obj \
-winnt.obj: $(srcdir)/config/i386/winnt.c \
-\ $(CC) $(CFLAGS) \\\
-\ -I. -I$(srcdir) -I$(srcdir)/config -c $(srcdir)/config/i386/winnt.c \
-
diff --git a/gcc/config/i386/cygwin32.asm b/gcc/config/i386/cygwin32.asm
deleted file mode 100644
index 4ac4c91a3b1..00000000000
--- a/gcc/config/i386/cygwin32.asm
+++ /dev/null
@@ -1,32 +0,0 @@
-/* stuff needed for libgcc1 on win32. */
-
-#ifdef L_chkstk
-
- .global ___chkstk
- .global __alloca
-___chkstk:
-__alloca:
- pushl %ecx /* save temp */
- movl %esp,%ecx /* get sp */
- addl $0x8,%ecx /* and point to return addr */
-
-probe: cmpl $0x1000,%eax /* > 4k ?*/
- jb done
-
- subl $0x1000,%ecx /* yes, move pointer down 4k*/
- orl $0x0,(%ecx) /* probe there */
- subl $0x1000,%eax /* decrement count */
- jmp probe /* and do it again */
-
-done: subl %eax,%ecx
- orl $0x0,(%ecx) /* less that 4k, just peek here */
-
- movl %esp,%eax
- movl %ecx,%esp /* decrement stack */
-
- movl (%eax),%ecx /* recover saved temp */
- movl 4(%eax),%eax /* get return address */
- jmp *%eax
-
-
-#endif
diff --git a/gcc/config/i386/cygwin32.h b/gcc/config/i386/cygwin32.h
deleted file mode 100644
index b8cbc36af8a..00000000000
--- a/gcc/config/i386/cygwin32.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for
- hosting on Windows NT 3.x, using a Unix style C library and tools,
- as distinct from winnt.h, which is used to build GCC for use with a
- windows style library and tool set and uses the Microsoft tools.
- Copyright (C) 1995, 1996, 1997 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. */
-
-
-#define YES_UNDERSCORES
-
-#define DBX_DEBUGGING_INFO
-#define SDB_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#include "i386/gas.h"
-#include "dbxcoff.h"
-
-#ifdef CPP_PREDEFINES
-#undef CPP_PREDEFINES
-#endif
-
-#define CPP_PREDEFINES "-Di386 -D_WIN32 \
- -DPOSIX -D__CYGWIN32__ -DWINNT -D_X86_=1 -D__STDC__=1\
- -D__stdcall=__attribute__((__stdcall__)) \
- -D__cdecl=__attribute__((__cdecl__)) \
- -Asystem(winnt) -Acpu(i386) -Amachine(i386)"
-
-/* We have to dynamic link to get to the system DLLs. All of libc, libm and
- the Unix stuff is in cygwin.dll. The import library is called
- 'libcygwin.a'. For Windows applications, include more libraries, but
- always include kernel32. We'd like to specific subsystem windows to
- ld, but that doesn't work just yet. */
-
-#undef LIB_SPEC
-#define LIB_SPEC "-lcygwin %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32"
-
-#define LINK_SPEC "%{mwindows:--subsystem windows}"
-
-/* Normally, -lgcc is not needed since everything in it is in the DLL, but we
- want to allow things to be added to it when installing new versions of
- GCC without making a new CYGWIN.DLL, so we leave it. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "crt0%O%s"
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-#define WCHAR_UNSIGNED 1
-#define WCHAR_TYPE_SIZE 16
-#define WCHAR_TYPE "short unsigned int"
-#define HAVE_ATEXIT 1
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTOR_SECTION_FUNCTION \
- DTOR_SECTION_FUNCTION
-
-#define CTOR_SECTION_FUNCTION \
-void \
-ctor_section () \
-{ \
- if (in_section != in_ctor) \
- { \
- fprintf (asm_out_file, "\t.section .ctor\n"); \
- in_section = in_ctor; \
- } \
-}
-
-#define DTOR_SECTION_FUNCTION \
-void \
-dtor_section () \
-{ \
- if (in_section != in_dtor) \
- { \
- fprintf (asm_out_file, "\t.section .dtor\n"); \
- in_section = in_dtor; \
- } \
-}
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctor_section (); \
- fprintf (FILE, "%s\t", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtor_section (); \
- fprintf (FILE, "%s\t", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
- so that we may access it directly in the GOT.
-
- On i386 running Windows NT, modify the assembler name with a suffix
- consisting of an atsign (@) followed by string of digits that represents
- the number of bytes of arguments passed to the function, if it has the
- attribute STDCALL. */
-
-#ifdef ENCODE_SECTION_INFO
-#undef ENCODE_SECTION_INFO
-#define ENCODE_SECTION_INFO(DECL) \
-do \
- { \
- if (flag_pic) \
- { \
- rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
- = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- || ! TREE_PUBLIC (DECL)); \
- } \
- if (TREE_CODE (DECL) == FUNCTION_DECL) \
- if (lookup_attribute ("stdcall", \
- TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
- XEXP (DECL_RTL (DECL), 0) = \
- gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \
- } \
-while (0)
-#endif
-
-/* Emit code to check the stack when allocating more that 4000
- bytes in one go. */
-
-#define CHECK_STACK_LIMIT 4000
-
-/* By default, target has a 80387, uses IEEE compatible arithmetic,
- and returns float values in the 387 and needs stack probes */
-#undef TARGET_DEFAULT
-
-#define TARGET_DEFAULT \
- (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE)
-
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- fprintf (FILE, "\t.section %s\n", NAME)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
diff --git a/gcc/config/i386/dgux.c b/gcc/config/i386/dgux.c
deleted file mode 100644
index 23e4cf1e004..00000000000
--- a/gcc/config/i386/dgux.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Subroutines for GNU compiler for Intel 80x86 running DG/ux
- Copyright (C) 1993, 1995 Free Software Foundation, Inc.
-
- Currently maintained by (gcc@dg-rtp.dg.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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <time.h>
-#include "i386/i386.c"
-
-
-extern char *version_string;
-
-struct option
-{
- char *string;
- int *variable;
- int on_value;
-};
-
-static int
-output_option (file, sep, type, name, indent, pos, max)
- FILE *file;
- char *sep;
- char *type;
- char *name;
- char *indent;
- int pos;
- int max;
-{
- if (strlen (sep) + strlen (type) + strlen (name) + pos > max)
- {
- fprintf (file, indent);
- return fprintf (file, "%s%s", type, name);
- }
- return pos + fprintf (file, "%s%s%s", sep, type, name);
-}
-
-static struct { char *name; int value; } m_options[] = TARGET_SWITCHES;
-
-static void
-output_options (file, f_options, f_len, W_options, W_len,
- pos, max, sep, indent, term)
- FILE *file;
- struct option *f_options;
- struct option *W_options;
- int f_len, W_len;
- int pos;
- int max;
- char *indent;
- char *term;
-{
- register int j;
-
- if (optimize)
- pos = output_option (file, sep, "-O", "", indent, pos, max);
- if (write_symbols != NO_DEBUG)
- pos = output_option (file, sep, "-g", "", indent, pos, max);
-/* if (flag_traditional)
- pos = output_option (file, sep, "-traditional", "", indent, pos, max);*/
- if (profile_flag)
- pos = output_option (file, sep, "-p", "", indent, pos, max);
- if (profile_block_flag)
- pos = output_option (file, sep, "-a", "", indent, pos, max);
-
- for (j = 0; j < f_len; j++)
- if (*f_options[j].variable == f_options[j].on_value)
- pos = output_option (file, sep, "-f", f_options[j].string,
- indent, pos, max);
-
- for (j = 0; j < W_len; j++)
- if (*W_options[j].variable == W_options[j].on_value)
- pos = output_option (file, sep, "-W", W_options[j].string,
- indent, pos, max);
-
- for (j = 0; j < sizeof m_options / sizeof m_options[0]; j++)
- if (m_options[j].name[0] != '\0'
- && m_options[j].value > 0
- && ((m_options[j].value & target_flags)
- == m_options[j].value))
- pos = output_option (file, sep, "-m", m_options[j].name,
- indent, pos, max);
-
- pos = output_option (file, sep, "-mcpu=", ix86_cpu_string, indent, pos, max);
- pos = output_option (file, sep, "-march=", ix86_isa_string, indent, pos, max);
- fprintf (file, term);
-}
-
-/* Output to FILE the start of the assembler file. */
-
-void
-output_file_start (file, f_options, f_len, W_options, W_len)
- FILE *file;
- struct option *f_options;
- struct option *W_options;
- int f_len, W_len;
-{
- register int pos;
-
- output_file_directive (file, main_input_filename);
- fprintf (file, "\t.version\t\"01.01\"\n"); \
- /* Switch to the data section so that the coffsem symbol and the
- gcc2_compiled. symbol aren't in the text section. */
- data_section ();
-
- pos = fprintf (file, "\n// cc1 (%s) arguments:", VERSION_STRING);
- output_options (file, f_options, f_len, W_options, W_len,
- pos, 75, " ", "\n// ", "\n\n");
-
-#ifdef TARGET_IDENTIFY_REVISION
- if (TARGET_IDENTIFY_REVISION)
- {
- char indent[256];
-
- time_t now = time ((time_t *)0);
- sprintf (indent, "]\"\n\t%s\t \"@(#)%s [", IDENT_ASM_OP, main_input_filename);
- fprintf (file, indent+3);
- pos = fprintf (file, "gcc %s, %.24s,", VERSION_STRING, ctime (&now));
- output_options (file, f_options, f_len, W_options, W_len,
- pos, 150 - strlen (indent), " ", indent, "]\"\n\n");
- }
-#endif /* TARGET_IDENTIFY_REVISION */
-}
-
-#ifndef CROSS_COMPILE
-#if defined (_abort_aux)
-/* Debugging aid to be registered via `atexit'. See the definition
- of abort in dgux.h. */
-void
-abort_aux ()
-{
- extern int insn_;
- extern char * file_;
- extern int line_;
- static int done;
- rtx line_note;
-
- if (done++)
- return;
- if (file_ || line_)
- {
- if (write_symbols != NO_DEBUG)
- {
- for (line_note = (rtx) insn_ ; line_note != 0 ; line_note = PREV_INSN (line_note))
- if (GET_CODE (line_note) == NOTE && NOTE_LINE_NUMBER (line_note) > 0)
- break;
- if (line_note != 0)
- {
- error_with_file_and_line (NOTE_SOURCE_FILE (line_note),
- NOTE_LINE_NUMBER (line_note),
- "Internal gcc abort from %s:%d",
- file_ ? file_ : "<nofile>", line_);
- if (insn_ && file_ && strcmp (file_, "toplev.c"))
- {
- error_with_file_and_line (NOTE_SOURCE_FILE (line_note),
- NOTE_LINE_NUMBER (line_note),
- "The local variable `insn' has the value:", 0);
- debug_rtx ((rtx) insn_);
- }
- }
- }
- if (write_symbols == NO_DEBUG || line_note == 0)
- {
- error ("Internal gcc abort from %s:%d",
- file_ ? file_ : "<nofile>", line_);
- if (insn_ && file_ && strcmp (file_, "toplev.c"))
- {
- error ("The local variable `insn' has the value:", 0);
- debug_rtx ((rtx) insn_);
- }
- }
- }
-}
-#endif
-#endif
-
-
diff --git a/gcc/config/i386/dgux.h b/gcc/config/i386/dgux.h
deleted file mode 100644
index 469ce14ddc8..00000000000
--- a/gcc/config/i386/dgux.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/* Target definitions for GNU compiler for Intel 80x86 running DG/ux
- Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
- Currently maintained by gcc@dg-rtp.dg.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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* for now, we are just like the sysv4 version with a
- few hacks
-*/
-
-#include "i386/sysv4.h"
-
-#ifndef VERSION_INFO2
-#define VERSION_INFO2 "$Revision: 1.5 $"
-#endif
-
-#ifndef VERSION_STRING
-#define VERSION_STRING version_string
-#endif
-
-/* Identify the compiler. */
-/* TARGET_VERSION used by toplev.c VERSION_STRING used by -midentify-revision */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (%s%s, %s)", \
- VERSION_INFO1, VERSION_INFO2, __DATE__)
-#undef VERSION_INFO1
-#define VERSION_INFO1 "ix86 DG/ux, "
-
-/* Augment TARGET_SWITCHES with the MXDB options. */
-#define MASK_STANDARD 0x40000000 /* Retain standard information */
-#define MASK_NOLEGEND 0x20000000 /* Discard legend information */
-#define MASK_EXTERNAL_LEGEND 0x10000000 /* Make external legends */
-#define MASK_IDENTIFY_REVISION 0x08000000 /* Emit 'ident' to .s */
-#define MASK_WARN_PASS_STRUCT 0x04000000 /* Emit 'ident' to .s */
-
-#define TARGET_STANDARD (target_flags & MASK_STANDARD)
-#define TARGET_NOLEGEND (target_flags & MASK_NOLEGEND)
-#define TARGET_EXTERNAL_LEGEND (target_flags & MASK_EXTERNAL_LEGEND)
-#define TARGET_IDENTIFY_REVISION (target_flags & MASK_IDENTIFY_REVISION)
-#define TARGET_WARN_PASS_STRUCT (target_flags & MASK_WARN_PASS_STRUCT)
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- { "standard", MASK_STANDARD }, \
- { "legend", -MASK_NOLEGEND }, \
- { "no-legend", MASK_NOLEGEND }, \
- { "external-legend", MASK_EXTERNAL_LEGEND }, \
- { "identify-revision", MASK_IDENTIFY_REVISION }, \
- { "warn-passed-structs", MASK_WARN_PASS_STRUCT },
-
-#undef DWARF_DEBUGGING_INFO
-#define DWARF_DEBUGGING_INFO
-
-/*
- allow -gstabs so that those who have gnu-as installed
- can debug c++ programs.
-*/
-#undef DBX_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
-
-/* Override svr[34].h. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- output_file_start (FILE, f_options, sizeof f_options / sizeof f_options[0], \
- W_options, sizeof W_options / sizeof W_options[0])
-
-/* ix86 abi specified type for wchar_t */
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-
-/* Some machines may desire to change what optimizations are performed for
- various optimization levels. This macro, if defined, is executed once
- just after the optimization level is determined and before the remainder
- of the command options have been parsed. Values set in this macro are
- used as the default values for the other command line options.
-
- LEVEL is the optimization level specified; 2 if -O2 is specified,
- 1 if -O is specified, and 0 if neither is specified. */
-
-/* This macro used to store 0 in flag_signed_bitfields.
- Not only is that misuse of this macro; the whole idea is wrong.
-
- The GNU C dialect makes bitfields signed by default,
- regardless of machine type. Making any machine inconsistent in this
- regard is bad for portability.
-
- I chose to make bitfields signed by default because this is consistent
- with the way ordinary variables are handled: `int' equals `signed int'.
- If there is a good reason to prefer making bitfields unsigned by default,
- it cannot have anything to do with the choice of machine.
- If the reason is good enough, we should change the convention for all machines.
-
- -- rms, 20 July 1991. */
-
-/*
- this really should go into dgux-local.h
-*/
-
-#undef OPTIMIZATION_OPTIONS
-#define OPTIMIZATION_OPTIONS(LEVEL) \
- do { \
- extern int flag_signed_bitfields; \
- flag_signed_bitfields = 0; \
- abort_helper (); \
- optimization_options (LEVEL); \
- } while (0)
-
-
-/* The normal location of the `ld' and `as' programs */
-
-#undef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/bin/"
-
-/* The normal location of the various *crt*.o files is the */
-
-#undef MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/usr/lib/"
-
-/* Macros to be automatically defined.
- __CLASSIFY_TYPE__ is used in the <varargs.h> and <stdarg.h> header
- files with DG/UX revision 5.40 and later. This allows GNU CC to
- operate without installing the header files. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di386 -D__ix86 -Dunix -DDGUX -D__CLASSIFY_TYPE__=2\
- -Asystem(unix) -Asystem(svr4) -Acpu(i386) -Amachine(i386)"
-
- /*
- If not -ansi, -traditional, or restricting include files to one
- specific source target, specify full DG/UX features.
- */
-#undef CPP_SPEC
-#define CPP_SPEC "%{!ansi:%{!traditional:-D__OPEN_NAMESPACE__}}"
-
-/* Assembler support (legends for mxdb). */
-#undef ASM_SPEC
-#define ASM_SPEC "\
-%{mno-legend:%{mstandard:-Wc,off}}\
-%{g:%{!mno-legend:-Wc,-fix-bb,-s\"%i\"\
-%{traditional:,-lc}%{!traditional:,-lansi-c}\
-%{mstandard:,-keep-std}\
-%{mexternal-legend:,-external}}}"
-
-/* Override svr4.h. */
-
-/* hassey 3/12/94 keep svr4 ASM_FINAL_SPEC allows -pipe to work */
-
-/* Linker and library spec's.
- -static, -shared, -symbolic, -h* and -z* access AT&T V.4 link options.
- -svr4 instructs gcc to place /usr/lib/values-X[cat].o on link the line.
- The absense of -msvr4 indicates linking done in a COFF environment and
- adds the link script to the link line. In all environments, the first
- and last objects are crtbegin.o and crtend.o.
- When the -G link option is used (-shared and -symbolic) a final link is
- not being done. */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
-"%{!shared:%{!symbolic:-lc}}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{z*} %{h*} %{v:-V} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy} \
- %{symbolic:-Bsymbolic -G -dy} \
- %{pg:-L/usr/lib/libp}%{p:-L/usr/lib/libp}"
-
-#ifdef CROSS_COMPILE
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared:%{!symbolic:%{pg:gcrt1.o%s} \
- %{!pg:%{p:mcrt1.o%s} \
- %{!p:crt1.o%s}}}} \
- %{pg:gcrti.o%s}%{!pg:crti.o%s} \
- crtbegin.o%s \
- %{ansi:values-Xc.o%s} \
- %{!ansi:%{traditional:values-Xt.o%s} \
- %{!traditional:values-Xa.o%s}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o}%{!pg:crtn.o%s}"
-
-#else
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared:%{!symbolic:%{pg:gcrt1.o%s} \
- %{!pg:%{p:/lib/mcrt1.o%s} \
- %{!p:/lib/crt1.o%s}}} \
- %{pg:gcrti.o%s}%{!pg:/lib/crti.o%s}} \
- crtbegin.o%s \
- %{ansi:/lib/values-Xc.o%s} \
- %{!ansi:%{traditional:/lib/values-Xt.o%s} \
- %{!traditional:/lib/values-Xa.o%s}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o}%{!pg:/lib/crtn.o}"
-
-#endif /* CROSS_COMPILE */
-
-#if !defined (no_abort) || defined (CRT_BEGIN) || defined (CRT_END)
-#undef abort
-
-char insn; int insn_; char * file_; int line_;
-#define abort() \
- (insn_ = (int) insn, \
- file_ = __FILE__, \
- line_ = __LINE__, \
- fancy_abort ())
-#define abort_helper() \
- do { \
- extern void abort_aux (); \
- atexit (abort_aux); \
- } while (0)
-#define _abort_aux
-#endif /* no abort */
-
-/* The maximum alignment which the object file format can support.
- page alignment would seem to be enough */
-#undef MAX_OFILE_ALIGNMENT
-#define MAX_OFILE_ALIGNMENT 0x1000
-
-/* Must use data section for relocatable constants when pic. */
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE,RTX) \
-{ \
- if (flag_pic && symbolic_operand (RTX)) \
- data_section (); \
- else \
- const_section (); \
-}
-
-/* This supplements FUNCTION_ARG's definition in i386.h to check
- TARGET_WARN_PASS_STRUCT */
-
-#undef FUNCTION_ARG
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-((((MODE) == BLKmode && TARGET_WARN_PASS_STRUCT) ? \
- warning ("argument is a structure"),0 : 0), \
- (function_arg (&CUM, MODE, TYPE, NAMED)))
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if (LOG <= 2) \
- fprintf ((FILE), "\t.align %d\n", 1<<(LOG));\
- else if ((LOG)!=0) \
- { \
- char buf[256]; \
- if (!backalign_labelno) fprintf ((FILE), "\t.align %d\n", 1); \
- ASM_GENERATE_INTERNAL_LABEL (buf, "LBA", backalign_labelno++); \
- fprintf ((FILE), "%s:", &buf[1]); \
- fprintf ((FILE), "\t.backalign %s,%d,%d\n", &buf[1], 1<<(LOG), \
- ((TARGET_PENTIUMPRO || TARGET_486) && LOG==4) ? 6 : 2);\
- }
-
-/* add .align 1 to avoid .backalign bug in assembler */
-#undef CONST_SECTION_ASM_OP
-#define CONST_SECTION_ASM_OP ".section\t.rodata\n\t.align 1"
diff --git a/gcc/config/i386/freebsd-elf.h b/gcc/config/i386/freebsd-elf.h
deleted file mode 100644
index 55bf23c0c63..00000000000
--- a/gcc/config/i386/freebsd-elf.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* Definitions for Intel 386 running FreeBSD with ELF format
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Eric Youngdale.
- Modified for stabs-in-ELF by H.J. Lu.
- Adapted from Linux version by John Polstra.
-
-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. */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
-
-/* The svr4 ABI for the i386 says that records and unions are returned
- in memory. */
-#undef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 1
-
-/* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
- i386.md for an explanation of the expression this outputs. */
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
-
-/* Indicate that jump tables go in the text section. This is
- necessary when compiling PIC code. */
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* Copy this from the svr4 specifications... */
-/* Define the register numbers to be used in Dwarf debugging information.
- The SVR4 reference port C compiler uses the following register numbers
- in its Dwarf output code:
- 0 for %eax (gnu regno = 0)
- 1 for %ecx (gnu regno = 2)
- 2 for %edx (gnu regno = 1)
- 3 for %ebx (gnu regno = 3)
- 4 for %esp (gnu regno = 7)
- 5 for %ebp (gnu regno = 6)
- 6 for %esi (gnu regno = 4)
- 7 for %edi (gnu regno = 5)
- The following three DWARF register numbers are never generated by
- the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
- believes these numbers have these meanings.
- 8 for %eip (no gnu equivalent)
- 9 for %eflags (no gnu equivalent)
- 10 for %trapno (no gnu equivalent)
- It is not at all clear how we should number the FP stack registers
- for the x86 architecture. If the version of SDB on x86/svr4 were
- a bit less brain dead with respect to floating-point then we would
- have a precedent to follow with respect to DWARF register numbers
- for x86 FP registers, but the SDB on x86/svr4 is so completely
- broken with respect to FP registers that it is hardly worth thinking
- of it as something to strive for compatibility with.
- The version of x86/svr4 SDB I have at the moment does (partially)
- seem to believe that DWARF register number 11 is associated with
- the x86 register %st(0), but that's about all. Higher DWARF
- register numbers don't seem to be associated with anything in
- particular, and even for DWARF regno 11, SDB only seems to under-
- stand that it should say that a variable lives in %st(0) (when
- asked via an `=' command) if we said it was in DWARF regno 11,
- but SDB still prints garbage when asked for the value of the
- variable in question (via a `/' command).
- (Also note that the labels SDB prints for various FP stack regs
- when doing an `x' command are all wrong.)
- Note that these problems generally don't affect the native SVR4
- C compiler because it doesn't allow the use of -O with -g and
- because when it is *not* optimizing, it allocates a memory
- location for each floating-point variable, and the memory
- location is what gets described in the DWARF AT_location
- attribute for the variable in question.
- Regardless of the severe mental illness of the x86/svr4 SDB, we
- do something sensible here and we use the following DWARF
- register numbers. Note that these are all stack-top-relative
- numbers.
- 11 for %st(0) (gnu regno = 8)
- 12 for %st(1) (gnu regno = 9)
- 13 for %st(2) (gnu regno = 10)
- 14 for %st(3) (gnu regno = 11)
- 15 for %st(4) (gnu regno = 12)
- 16 for %st(5) (gnu regno = 13)
- 17 for %st(6) (gnu regno = 14)
- 18 for %st(7) (gnu regno = 15)
-*/
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 \
- : (n) == 1 ? 2 \
- : (n) == 2 ? 1 \
- : (n) == 3 ? 3 \
- : (n) == 4 ? 6 \
- : (n) == 5 ? 7 \
- : (n) == 6 ? 5 \
- : (n) == 7 ? 4 \
- : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
- : (-1))
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- if (flag_pic) \
- { \
- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
- LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall mcount\n"); \
- } \
-}
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -D__ELF__ -D__FreeBSD__=2 -Asystem(FreeBSD)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
-
-#undef LIB_SPEC
-#if 1
-/* We no longer link with libc_p.a or libg.a by default. If you
- * want to profile or debug the C library, please add
- * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
- */
-#define LIB_SPEC \
- "%{!shared: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \
- %{!ggdb:-lc} %{ggdb:-lg}}"
-#else
-#define LIB_SPEC \
- "%{!shared: \
- %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
- %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
-#endif
-
-/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support
- for the special GCC options -static and -shared, which allow us to
- link things in one of these three modes by applying the appropriate
- combinations of options at link-time. We like to support here for
- as many of the other GNU linker options as possible. But I don't
- have the time to search for those flags. I am sure how to add
- support for -soname shared_object_name. H.J.
-
- I took out %{v:%{!V:-V}}. It is too much :-(. They can use
- -Wl,-V.
-
- When the -shared link option is used a final link is not being
- done. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
- %{!shared: \
- %{!ibcs: \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
- %{static:-static}}}"
-
-/* Get perform_* macros to build libgcc.a. */
diff --git a/gcc/config/i386/freebsd.h b/gcc/config/i386/freebsd.h
deleted file mode 100644
index 83d1de72467..00000000000
--- a/gcc/config/i386/freebsd.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/* Definitions of target machine for GNU compiler for Intel 80386
- running FreeBSD.
- Copyright (C) 1988, 1992, 1994, 1996 Free Software Foundation, Inc.
- Contributed by Poul-Henning Kamp <phk@login.dkuug.dk>
-
-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 goes away when the math-emulator is fixed */
-#define TARGET_CPU_DEFAULT 0400 /* TARGET_NO_FANCY_MATH_387 */
-
-/* This is tested by i386gas.h. */
-#define YES_UNDERSCORES
-
-/* Don't assume anything about the header files. */
-#define NO_IMPLICIT_EXTERN_C
-
-#include "i386/gstabs.h"
-
-/* Get perform_* macros to build libgcc.a. */
-#include "i386/perform.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__ -D__386BSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
-
-/* Like the default, except no -lg. */
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-
-#define WCHAR_UNSIGNED 1
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 16
-
-#define HAVE_ATEXIT
-
-#undef ASM_APP_ON
-#define ASM_APP_ON "#APP\n"
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* The following macros are stolen from i386v4.h */
-/* These have to be defined to get PIC code correct */
-
-/* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
- i386.md for an explanation of the expression this outputs. */
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
-
-/* Indicate that jump tables go in the text section. This is
- necessary when compiling PIC code. */
-
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Profiling routines, partially copied from i386/osfrose.h. */
-
-/* Redefine this to use %eax instead of %edx. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- if (flag_pic) \
- { \
- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \
- LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall mcount\n"); \
- } \
-}
-
-/*
- * Some imports from svr4.h in support of shared libraries.
- * Currently, we need the DECLARE_OBJECT_SIZE stuff.
- */
-
-/* Define the strings used for the special svr4 .type and .size directives.
- These strings generally do not vary from one system running svr4 to
- another, but if a given system (e.g. m88k running svr) needs to use
- different pseudo-op names for these, they may be overridden in the
- file which includes this one. */
-
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-
-/* The following macro defines the format used to output the second
- operand of the .type assembler directive. Different svr4 assemblers
- expect various different forms for this operand. The one given here
- is just a default. You may need to override it in your machine-
- specific tm.h file (depending upon the particulars of your assembler). */
-
-#define TYPE_OPERAND_FMT "@%s"
-
-/* Write the extra assembler code needed to declare a function's result.
- Most svr4 assemblers don't require any special declaration of the
- result value, but there are exceptions. */
-
-#ifndef ASM_DECLARE_RESULT
-#define ASM_DECLARE_RESULT(FILE, RESULT)
-#endif
-
-/* These macros generate the special .type and .size directives which
- are used to set the corresponding fields of the linker symbol table
- entries in an ELF object file under SVR4. These macros also output
- the starting labels for the relevant functions/objects. */
-
-/* Write the extra assembler code needed to declare a function properly.
- Some svr4 assemblers need to also have something extra said about the
- function's return value. We allow for that here. */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Write the extra assembler code needed to declare an object properly. */
-
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', FILE); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\
- } \
- } while (0)
-
-
-/* This is how to declare the size of a function. */
-
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
- do { \
- if (!flag_inhibit_size_directive) \
- { \
- char label[256]; \
- static int labelno; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ","); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } while (0)
-
-#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}"
-#define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
-
-/* This is defined when gcc is compiled in the BSD-directory-tree, and must
- * make up for the gap to all the stuff done in the GNU-makefiles.
- */
-
-#ifdef FREEBSD_NATIVE
-
-#define INCLUDE_DEFAULTS { \
- { "/usr/include", 0 }, \
- { "/usr/include/g++", 1 }, \
- { 0, 0} \
- }
-
-#undef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/libexec/"
-
-#undef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "/usr/lib"
-
-#if 0 /* This is very wrong!!! */
-#define DEFAULT_TARGET_MACHINE "i386-unknown-freebsd_1.0"
-#define GPLUSPLUS_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
-#define TOOL_INCLUDE_DIR "/usr/local/i386-unknown-freebsd_1.0/include"
-#define GCC_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
-#endif
-
-#endif /* FREEBSD_NATIVE */
diff --git a/gcc/config/i386/gas.h b/gcc/config/i386/gas.h
deleted file mode 100644
index fbfba7456be..00000000000
--- a/gcc/config/i386/gas.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Definitions for Intel 386 using GAS.
- Copyright (C) 1988, 1993, 1994, 1996 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. */
-
-/* Note that i386/seq-gas.h is a GAS configuration that does not use this
- file. */
-
-#include "i386/i386.h"
-
-#ifndef YES_UNDERSCORES
-/* Define this now, because i386/bsd.h tests it. */
-#define NO_UNDERSCORES
-#endif
-
-/* Use the bsd assembler syntax. */
-/* we need to do this because gas is really a bsd style assembler,
- * and so doesn't work well this these att-isms:
- *
- * ASM_OUTPUT_SKIP is .set .,.+N, which isn't implemented in gas
- * ASM_OUTPUT_LOCAL is done with .set .,.+N, but that can't be
- * used to define bss static space
- *
- * Next is the question of whether to uses underscores. RMS didn't
- * like this idea at first, but since it is now obvious that we
- * need this separate tm file for use with gas, at least to get
- * dbx debugging info, I think we should also switch to underscores.
- * We can keep i386v for real att style output, and the few
- * people who want both form will have to compile twice.
- */
-
-#include "i386/bsd.h"
-
-/* these come from i386/bsd.h, but are specific to sequent */
-#undef DBX_NO_XREFS
-#undef DBX_CONTIN_LENGTH
-
-/* Ask for COFF symbols. */
-
-#define SDB_DEBUGGING_INFO
-
-/* Specify predefined symbols in preprocessor. */
-
-#define CPP_PREDEFINES "-Dunix"
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{posix:-D_POSIX_SOURCE}"
-
-/* Allow #sccs in preprocessor. */
-
-#define SCCS_DIRECTIVE
-
-/* Output #ident as a .ident. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* In the past there was confusion as to what the argument to .align was
- in GAS. For the last several years the rule has been this: for a.out
- file formats that argument is LOG, and for all other file formats the
- argument is 1<<LOG.
-
- However, GAS now has .p2align and .balign pseudo-ops so to remove any
- doubt or guess work, and since this file is used for both a.out and other
- file formats, we use one of them. */
-
-#if 0 /* ??? However, not every port uses binutils 2.6 yet. */
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
-#endif
-
-/* Align labels, etc. at 4-byte boundaries.
- For the 486, align to 16-byte boundary for sake of cache. */
-
-#undef ASM_OUTPUT_ALIGN_CODE
-#define ASM_OUTPUT_ALIGN_CODE(FILE) \
- fprintf ((FILE), "\t.align %d,0x90\n", i386_align_jumps)
-
-/* Align start of loop at 4-byte boundary. */
-
-#undef ASM_OUTPUT_LOOP_ALIGN
-#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
- fprintf ((FILE), "\t.align %d,0x90\n", i386_align_loops)
-
-
-/* A C statement or statements which output an assembler instruction
- opcode to the stdio stream STREAM. The macro-operand PTR is a
- variable of type `char *' which points to the opcode name in its
- "internal" form--the form that is written in the machine description.
-
- GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
- So use `repe' instead. */
-
-#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
-{ \
- if ((PTR)[0] == 'r' \
- && (PTR)[1] == 'e' \
- && (PTR)[2] == 'p') \
- { \
- if ((PTR)[3] == 'z') \
- { \
- fprintf (STREAM, "repe"); \
- (PTR) += 4; \
- } \
- else if ((PTR)[3] == 'n' && (PTR)[4] == 'z') \
- { \
- fprintf (STREAM, "repne"); \
- (PTR) += 5; \
- } \
- } \
-}
-
-/* Define macro used to output shift-double opcodes when the shift
- count is in %cl. Some assemblers require %cl as an argument;
- some don't.
-
- GAS requires the %cl argument, so override i386/unix.h. */
-
-#undef SHIFT_DOUBLE_OMITS_COUNT
-#define SHIFT_DOUBLE_OMITS_COUNT 0
-
-/* Print opcodes the way that GAS expects them. */
-#define GAS_MNEMONICS 1
-
-#ifdef NO_UNDERSCORES /* If user-symbols don't have underscores,
- then it must take more than `L' to identify
- a label that should be ignored. */
-
-/* This is how to store into the string BUF
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), ".%s%d", (PREFIX), (NUMBER))
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
-#endif /* NO_UNDERSCORES */
diff --git a/gcc/config/i386/gmon-sol2.c b/gcc/config/i386/gmon-sol2.c
deleted file mode 100644
index 13d87ec0e90..00000000000
--- a/gcc/config/i386/gmon-sol2.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Re rework of the solaris 2 version of gmon by J.W.Hawtin 12/8/1996
- * Does not work right yet.
- */
-
-/*
- * This is a modified gmon.c by J.W.Hawtin <J.W.Hawtin@lboro.ac.uk>,
- * 14/8/96 based on the original gmon.c in GCC and the hacked version
- * solaris 2 sparc version (config/sparc/gmon-sol.c) by Mark Eichin. To do
- * process profiling on solaris 2.4 X86
- *
- * It must be used in conjunction with sol2-gc1.asm, which is used to start
- * and stop process monitoring.
- *
- * Differences.
- *
- * On Solaris 2 _mcount is called my library functions not mcount, so support
- * has been added for both.
- *
- * Also the prototype for profil() is different
- *
- * Solaris 2 does not seem to have char *minbrk whcih allows the setting of
- * the minimum SBRK region so this code has been removed and lets pray malloc
- * does not mess it up.
- *
- * Notes
- *
- * This code could easily be integrated with the orginal gmon.c and perhaps
- * should be.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91";
-#endif /* not lint */
-
-#if 0
-#include <unistd.h>
-
-#endif
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-#if 0
-#include "i386/gmon.h"
-#else
-
-struct phdr {
- char *lpc;
- char *hpc;
- int ncnt;
-};
-
-
-#define HISTFRACTION 2
-#define HISTCOUNTER unsigned short
-#define HASHFRACTION 1
-#define ARCDENSITY 2
-#define MINARCS 50
-#define BASEADDRESS 0x8000000 /* On Solaris 2 X86 all excutables start here
- and not at 0 */
-
-struct tostruct {
- char *selfpc;
- long count;
- unsigned short link;
-};
-struct rawarc {
- unsigned long raw_frompc;
- unsigned long raw_selfpc;
- long raw_count;
-};
-#define ROUNDDOWN(x,y) (((x)/(y))*(y))
-#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
-#endif
-
-/* char *minbrk; */
-
-#ifdef __alpha
-extern char *sbrk ();
-#endif
-
- /*
- * froms is actually a bunch of unsigned shorts indexing tos
- */
-static int profiling = 3;
-static unsigned short *froms;
-static struct tostruct *tos = 0;
-static long tolimit = 0;
-static char *s_lowpc = 0;
-static char *s_highpc = 0;
-static unsigned long s_textsize = 0;
-
-static int ssiz;
-static char *sbuf;
-static int s_scale;
- /* see profil(2) where this is describe (incorrectly) */
-#define SCALE_1_TO_1 0x10000L
-
-#define MSG "No space for profiling buffer(s)\n"
-
-extern int errno;
-
-monstartup(lowpc, highpc)
- char *lowpc;
- char *highpc;
-{
- int monsize;
- char *buffer;
- register int o;
-
- /*
- * round lowpc and highpc to multiples of the density we're using
- * so the rest of the scaling (here and in gprof) stays in ints.
- */
- lowpc = (char *)
- ROUNDDOWN((unsigned)lowpc, HISTFRACTION*sizeof(HISTCOUNTER));
- s_lowpc = lowpc;
- highpc = (char *)
- ROUNDUP((unsigned)highpc, HISTFRACTION*sizeof(HISTCOUNTER));
- s_highpc = highpc;
- s_textsize = highpc - lowpc;
- monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr);
- buffer = (char *) sbrk( monsize );
- if ( buffer == (char *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- return;
- }
- froms = (unsigned short *) sbrk( s_textsize / HASHFRACTION );
- if ( froms == (unsigned short *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- froms = 0;
- return;
- }
- tolimit = s_textsize * ARCDENSITY / 100;
- if ( tolimit < MINARCS ) {
- tolimit = MINARCS;
- } else if ( tolimit > 65534 ) {
- tolimit = 65534;
- }
- tos = (struct tostruct *) sbrk( tolimit * sizeof( struct tostruct ) );
- if ( tos == (struct tostruct *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- froms = 0;
- tos = 0;
- return;
- }
-/* minbrk = (char *) sbrk(0);*/
- tos[0].link = 0;
- sbuf = buffer;
- ssiz = monsize;
- ( (struct phdr *) buffer ) -> lpc = lowpc;
- ( (struct phdr *) buffer ) -> hpc = highpc;
- ( (struct phdr *) buffer ) -> ncnt = ssiz;
- monsize -= sizeof(struct phdr);
- if ( monsize <= 0 )
- return;
- o = highpc - lowpc;
- if( monsize < o )
-#ifndef hp300
- s_scale = ( (float) monsize / o ) * SCALE_1_TO_1;
-#else /* avoid floating point */
- {
- int quot = o / monsize;
-
- if (quot >= 0x10000)
- s_scale = 1;
- else if (quot >= 0x100)
- s_scale = 0x10000 / quot;
- else if (o >= 0x800000)
- s_scale = 0x1000000 / (o / (monsize >> 8));
- else
- s_scale = 0x1000000 / ((o << 8) / monsize);
- }
-#endif
- else
- s_scale = SCALE_1_TO_1;
- moncontrol(1);
-}
-
-_mcleanup()
-{
- int fd;
- int fromindex;
- int endfrom;
- char *frompc;
- int toindex;
- struct rawarc rawarc;
-
- moncontrol(0);
- fd = creat( "gmon.out" , 0666 );
- if ( fd < 0 ) {
- perror( "mcount: gmon.out" );
- return;
- }
-# ifdef DEBUG
- fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
-# endif DEBUG
-
- write( fd , sbuf , ssiz );
- endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
- for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) {
- if ( froms[fromindex] == 0 ) {
- continue;
- }
- frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms));
- for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) {
-# ifdef DEBUG
- fprintf( stderr ,
- "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
- frompc , tos[toindex].selfpc , tos[toindex].count );
-# endif DEBUG
- rawarc.raw_frompc = (unsigned long) frompc;
- rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
- rawarc.raw_count = tos[toindex].count;
- write( fd , &rawarc , sizeof rawarc );
- }
- }
- close( fd );
-}
-
-/* Solaris 2 libraries use _mcount. */
-asm(".globl _mcount; _mcount: jmp internal_mcount");
-/* This is for compatibility with old versions of gcc which used mcount. */
-asm(".globl mcount; mcount: jmp internal_mcount");
-
-internal_mcount()
-{
- register char *selfpc;
- register unsigned short *frompcindex;
- register struct tostruct *top;
- register struct tostruct *prevtop;
- register long toindex;
-
- /*
- * find the return address for mcount,
- * and the return address for mcount's caller.
- */
-
- /* selfpc = pc pushed by mcount call.
- This identifies the function that was just entered. */
- selfpc = (void *) __builtin_return_address (0);
- /* frompcindex = pc in preceding frame.
- This identifies the caller of the function just entered. */
- frompcindex = (void *) __builtin_return_address (1);
-
- /*
- * check that we are profiling
- * and that we aren't recursively invoked.
- */
- if (profiling) {
- goto out;
- }
- profiling++;
- /*
- * check that frompcindex is a reasonable pc value.
- * for example: signal catchers get called from the stack,
- * not from text space. too bad.
- */
- frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc);
- if ((unsigned long)frompcindex > s_textsize) {
- goto done;
- }
- frompcindex =
- &froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))];
- toindex = *frompcindex;
- if (toindex == 0) {
- /*
- * first time traversing this arc
- */
- toindex = ++tos[0].link;
- if (toindex >= tolimit) {
- goto overflow;
- }
- *frompcindex = toindex;
- top = &tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = 0;
- goto done;
- }
- top = &tos[toindex];
- if (top->selfpc == selfpc) {
- /*
- * arc at front of chain; usual case.
- */
- top->count++;
- goto done;
- }
- /*
- * have to go looking down chain for it.
- * top points to what we are looking at,
- * prevtop points to previous top.
- * we know it is not at the head of the chain.
- */
- for (; /* goto done */; ) {
- if (top->link == 0) {
- /*
- * top is end of the chain and none of the chain
- * had top->selfpc == selfpc.
- * so we allocate a new tostruct
- * and link it to the head of the chain.
- */
- toindex = ++tos[0].link;
- if (toindex >= tolimit) {
- goto overflow;
- }
- top = &tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
- /*
- * otherwise, check the next arc on the chain.
- */
- prevtop = top;
- top = &tos[top->link];
- if (top->selfpc == selfpc) {
- /*
- * there it is.
- * increment its count
- * move it to the head of the chain.
- */
- top->count++;
- toindex = prevtop->link;
- prevtop->link = top->link;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
-
- }
-done:
- profiling--;
- /* and fall through */
-out:
- return; /* normal return restores saved registers */
-
-overflow:
- profiling++; /* halt further profiling */
-# define TOLIMIT "mcount: tos overflow\n"
- write(2, TOLIMIT, sizeof(TOLIMIT));
- goto out;
-}
-
-/*
- * Control profiling
- * profiling is what mcount checks to see if
- * all the data structures are ready.
- */
-moncontrol(mode)
- int mode;
-{
- if (mode)
- {
- /* start */
- profil((unsigned short *)(sbuf + sizeof(struct phdr)),
- ssiz - sizeof(struct phdr),
- (int)s_lowpc, s_scale);
-
- profiling = 0;
- } else {
- /* stop */
- profil((unsigned short *)0, 0, 0, 0);
- profiling = 3;
- }
-}
diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h
deleted file mode 100644
index 8cfa903ff62..00000000000
--- a/gcc/config/i386/gnu.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Configuration for an i386 running GNU with ELF as the target machine. */
-
-/* This does it mostly for us. */
-#include <i386/linux.h>
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES GNU_CPP_PREDEFINES("i386")
-
-#undef LINK_SPEC
-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
- %{!shared: \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib/ld.so}} \
- %{static:-static}}"
-
-
-/* Get machine-independent configuration parameters for the GNU system. */
-#include <gnu.h>
diff --git a/gcc/config/i386/go32-rtems.h b/gcc/config/i386/go32-rtems.h
deleted file mode 100644
index 282465b249b..00000000000
--- a/gcc/config/i386/go32-rtems.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Configuration for an i386 running RTEMS on top of MS-DOS with
- djgpp/go32 v1.x.
-
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Joel Sherrill (joel@OARcorp.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 "i386/go32.h"
-
-/* Specify predefined symbols in preprocessor. */
-
-#ifdef CPP_PREDEFINES
-#undef CPP_PREDEFINES
-#endif
-#define CPP_PREDEFINES "-Dunix -Di386 -DGO32 -DMSDOS -Drtems -D__rtems__ \
- -Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386) -Asystem(rtems)"
diff --git a/gcc/config/i386/go32.h b/gcc/config/i386/go32.h
deleted file mode 100644
index 835cbde9af9..00000000000
--- a/gcc/config/i386/go32.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Configuration for an i386 running MS-DOS with djgpp/go32. */
-
-#define DBX_DEBUGGING_INFO /* support for stabs debugging info */
-#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG /* leave sdb as default */
-#define NO_STAB_H /* DJGPP has no stab.h */
-#if 0 /* enable this, if '-g' should select stabs debugging */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-#endif
-
-/* Don't assume anything about the header files. */
-#define NO_IMPLICIT_EXTERN_C
-
-#define HANDLE_SYSV_PRAGMA
-
-#define YES_UNDERSCORES
-
-#include "i386/gas.h"
-
-#ifdef CPP_PREDEFINES
-#undef CPP_PREDEFINES
-#endif
-#define CPP_PREDEFINES "-Dunix -Di386 -DGO32 -DMSDOS \
- -Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386)"
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTOR_SECTION_FUNCTION \
- DTOR_SECTION_FUNCTION
-
-#define CTOR_SECTION_FUNCTION \
-void \
-ctor_section () \
-{ \
- if (in_section != in_ctor) \
- { \
- fprintf (asm_out_file, "\t.section .ctor\n"); \
- in_section = in_ctor; \
- } \
-}
-
-#define DTOR_SECTION_FUNCTION \
-void \
-dtor_section () \
-{ \
- if (in_section != in_dtor) \
- { \
- fprintf (asm_out_file, "\t.section .dtor\n"); \
- in_section = in_dtor; \
- } \
-}
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctor_section (); \
- fprintf (FILE, "%s\t", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* Allow (eg) __attribute__((section "locked")) to work */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME)\
- do { \
- fprintf (FILE, "\t.section %s\n", NAME); \
- } while (0)
- do { \
- dtor_section (); \
- fprintf (FILE, "%s\t", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-/* Use the main_input_filename instead of dump_base_name */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- output_file_directive (FILE, main_input_filename); \
- } while (0)
-
-/* Be function-relative for block and source line stab directives. */
-
-#define DBX_BLOCKS_FUNCTION_RELATIVE 1
-
-/* but, to make this work, functions must appear prior to line info */
-
-#define DBX_FUNCTION_FIRST
-/* Allow (eg) __attribute__((section "locked")) to work */
-/* Generate a blank trailing N_SO to mark the end of the .o file, since
- we can't depend upon the linker to mark .o file boundaries with
- embedded stabs. */
-
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
- fprintf (FILE, \
- "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO)
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- if ( write_symbols == DBX_DEBUG ) \
- { static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,.LM%d-", \
- line, sym_lineno); \
- assemble_name (file, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- fprintf (file, "\n.LM%d:\n", sym_lineno); \
- sym_lineno += 1; } \
- else { \
- fprintf (file, "\t.ln\t%d\n", \
- ((sdb_begin_function_line > -1) \
- ? line - sdb_begin_function_line : 1)); }
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME)\
- do { \
- fprintf (FILE, "\t.section %s\n", NAME); \
- } while (0)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
diff --git a/gcc/config/i386/gstabs.h b/gcc/config/i386/gstabs.h
deleted file mode 100644
index 5f0ae348f15..00000000000
--- a/gcc/config/i386/gstabs.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "i386/gas.h"
-
-/* We do not want to output SDB debugging information. */
-
-#undef SDB_DEBUGGING_INFO
-
-/* We want to output DBX debugging information. */
-
-#define DBX_DEBUGGING_INFO
diff --git a/gcc/config/i386/i386-aout.h b/gcc/config/i386/i386-aout.h
deleted file mode 100644
index e4be8d5dd15..00000000000
--- a/gcc/config/i386/i386-aout.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Definitions for "naked" Intel 386 using a.out (or coff encap'd
- a.out) object format and stabs debugging info.
-
- Copyright (C) 1994 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 tested by gas.h. */
-#define YES_UNDERSCORES
-
-#include "i386/gstabs.h"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di386"
-
-/* end of i386-aout.h */
diff --git a/gcc/config/i386/i386-coff.h b/gcc/config/i386/i386-coff.h
deleted file mode 100644
index 915e307d17b..00000000000
--- a/gcc/config/i386/i386-coff.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Definitions for "naked" Intel 386 using coff object format files
- and coff debugging info.
-
- Copyright (C) 1994 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. */
-
-
-#include "i386/gas.h"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di386"
-
-#undef DBX_DEBUGGING_INFO
-#define SDB_DEBUGGING_INFO
-
-/* Support the ctors and dtors sections for g++. */
-
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\""
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-#define INT_ASM_OP ".long"
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-
-/* end of i386-coff.h */
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
deleted file mode 100644
index 93480fc8dd0..00000000000
--- a/gcc/config/i386/i386.c
+++ /dev/null
@@ -1,4904 +0,0 @@
-/* Subroutines for insn-output.c for Intel X86.
- Copyright (C) 1988, 1992, 1994, 1995, 1996 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. */
-
-#include <stdio.h>
-#include <setjmp.h>
-#include <ctype.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "tree.h"
-#include "flags.h"
-#include "except.h"
-#include "function.h"
-
-#ifdef EXTRA_CONSTRAINT
-/* If EXTRA_CONSTRAINT is defined, then the 'S'
- constraint in REG_CLASS_FROM_LETTER will no longer work, and various
- asm statements that need 'S' for class SIREG will break. */
- error EXTRA_CONSTRAINT conflicts with S constraint letter
-/* The previous line used to be #error, but some compilers barf
- even if the conditional was untrue. */
-#endif
-
-#ifndef CHECK_STACK_LIMIT
-#define CHECK_STACK_LIMIT -1
-#endif
-
-enum reg_mem /* Type of an operand for ix86_{binary,unary}_operator_ok */
-{
- reg_p,
- mem_p,
- imm_p
-};
-
-/* Processor costs (relative to an add) */
-struct processor_costs i386_cost = { /* 386 specific costs */
- 1, /* cost of an add instruction (2 cycles) */
- 1, /* cost of a lea instruction */
- 3, /* variable shift costs */
- 2, /* constant shift costs */
- 6, /* cost of starting a multiply */
- 1, /* cost of multiply per each bit set */
- 23 /* cost of a divide/mod */
-};
-
-struct processor_costs i486_cost = { /* 486 specific costs */
- 1, /* cost of an add instruction */
- 1, /* cost of a lea instruction */
- 3, /* variable shift costs */
- 2, /* constant shift costs */
- 12, /* cost of starting a multiply */
- 1, /* cost of multiply per each bit set */
- 40 /* cost of a divide/mod */
-};
-
-struct processor_costs pentium_cost = {
- 1, /* cost of an add instruction */
- 1, /* cost of a lea instruction */
- 4, /* variable shift costs */
- 1, /* constant shift costs */
- 11, /* cost of starting a multiply */
- 0, /* cost of multiply per each bit set */
- 25 /* cost of a divide/mod */
-};
-
-struct processor_costs pentiumpro_cost = {
- 1, /* cost of an add instruction */
- 1, /* cost of a lea instruction */
- 3, /* variable shift costs */
- 1, /* constant shift costs */
- 4, /* cost of starting a multiply */
- 0, /* cost of multiply per each bit set */
- 17 /* cost of a divide/mod */
-};
-
-struct processor_costs *ix86_cost = &pentium_cost;
-
-#define AT_BP(mode) (gen_rtx (MEM, (mode), frame_pointer_rtx))
-
-extern FILE *asm_out_file;
-extern char *strcat ();
-
-char *singlemove_string ();
-char *output_move_const_single ();
-char *output_fp_cc0_set ();
-
-char *hi_reg_name[] = HI_REGISTER_NAMES;
-char *qi_reg_name[] = QI_REGISTER_NAMES;
-char *qi_high_reg_name[] = QI_HIGH_REGISTER_NAMES;
-
-/* Array of the smallest class containing reg number REGNO, indexed by
- REGNO. Used by REGNO_REG_CLASS in i386.h. */
-
-enum reg_class regclass_map[FIRST_PSEUDO_REGISTER] =
-{
- /* ax, dx, cx, bx */
- AREG, DREG, CREG, BREG,
- /* si, di, bp, sp */
- SIREG, DIREG, INDEX_REGS, GENERAL_REGS,
- /* FP registers */
- FP_TOP_REG, FP_SECOND_REG, FLOAT_REGS, FLOAT_REGS,
- FLOAT_REGS, FLOAT_REGS, FLOAT_REGS, FLOAT_REGS,
- /* arg pointer */
- INDEX_REGS
-};
-
-/* Test and compare insns in i386.md store the information needed to
- generate branch and scc insns here. */
-
-struct rtx_def *i386_compare_op0 = NULL_RTX;
-struct rtx_def *i386_compare_op1 = NULL_RTX;
-struct rtx_def *(*i386_compare_gen)(), *(*i386_compare_gen_eq)();
-
-/* which cpu are we scheduling for */
-enum processor_type ix86_cpu;
-
-/* which instruction set architecture to use. */
-int ix86_arch;
-
-/* Strings to hold which cpu and instruction set architecture to use. */
-char *ix86_cpu_string; /* for -mcpu=<xxx> */
-char *ix86_arch_string; /* for -march=<xxx> */
-
-/* Register allocation order */
-char *i386_reg_alloc_order;
-static char regs_allocated[FIRST_PSEUDO_REGISTER];
-
-/* # of registers to use to pass arguments. */
-char *i386_regparm_string; /* # registers to use to pass args */
-int i386_regparm; /* i386_regparm_string as a number */
-
-/* Alignment to use for loops and jumps */
-char *i386_align_loops_string; /* power of two alignment for loops */
-char *i386_align_jumps_string; /* power of two alignment for non-loop jumps */
-char *i386_align_funcs_string; /* power of two alignment for functions */
-char *i386_branch_cost_string; /* values 1-5: see jump.c */
-
-int i386_align_loops; /* power of two alignment for loops */
-int i386_align_jumps; /* power of two alignment for non-loop jumps */
-int i386_align_funcs; /* power of two alignment for functions */
-int i386_branch_cost; /* values 1-5: see jump.c */
-
-/* Sometimes certain combinations of command options do not make
- sense on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed.
-
- Don't use this macro to turn on various extra optimizations for
- `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
-
-void
-override_options ()
-{
- int ch, i, j, regno;
- char *p;
- int def_align;
-
- static struct ptt
- {
- char *name; /* Canonical processor name. */
- enum processor_type processor; /* Processor type enum value. */
- struct processor_costs *cost; /* Processor costs */
- int target_enable; /* Target flags to enable. */
- int target_disable; /* Target flags to disable. */
- } processor_target_table[]
- = {{PROCESSOR_I386_STRING, PROCESSOR_I386, &i386_cost, 0, 0},
- {PROCESSOR_I486_STRING, PROCESSOR_I486, &i486_cost, 0, 0},
- {PROCESSOR_I586_STRING, PROCESSOR_PENTIUM, &pentium_cost, 0, 0},
- {PROCESSOR_PENTIUM_STRING, PROCESSOR_PENTIUM, &pentium_cost, 0, 0},
- {PROCESSOR_I686_STRING, PROCESSOR_PENTIUMPRO, &pentiumpro_cost, 0, 0},
- {PROCESSOR_PENTIUMPRO_STRING, PROCESSOR_PENTIUMPRO, &pentiumpro_cost, 0, 0}};
-
- int ptt_size = sizeof (processor_target_table) / sizeof (struct ptt);
-
-#ifdef SUBTARGET_OVERRIDE_OPTIONS
- SUBTARGET_OVERRIDE_OPTIONS;
-#endif
-
- /* Validate registers in register allocation order */
- if (i386_reg_alloc_order)
- {
- for (i = 0; (ch = i386_reg_alloc_order[i]) != '\0'; i++)
- {
- switch (ch)
- {
- case 'a': regno = 0; break;
- case 'd': regno = 1; break;
- case 'c': regno = 2; break;
- case 'b': regno = 3; break;
- case 'S': regno = 4; break;
- case 'D': regno = 5; break;
- case 'B': regno = 6; break;
-
- default: fatal ("Register '%c' is unknown", ch);
- }
-
- if (regs_allocated[regno])
- fatal ("Register '%c' was already specified in the allocation order", ch);
-
- regs_allocated[regno] = 1;
- }
- }
-
- if (ix86_arch_string == (char *)0)
- {
- ix86_arch_string = PROCESSOR_PENTIUM_STRING;
- if (ix86_cpu_string == (char *)0)
- ix86_cpu_string = PROCESSOR_DEFAULT_STRING;
- }
-
- for (i = 0; i < ptt_size; i++)
- if (! strcmp (ix86_arch_string, processor_target_table[i].name))
- {
- ix86_arch = processor_target_table[i].processor;
- if (ix86_cpu_string == (char *)0)
- ix86_cpu_string = processor_target_table[i].name;
- break;
- }
-
- if (i == ptt_size)
- {
- error ("bad value (%s) for -march= switch", ix86_arch_string);
- ix86_arch_string = PROCESSOR_PENTIUM_STRING;
- ix86_arch = PROCESSOR_DEFAULT;
- }
-
- if (ix86_cpu_string == (char *)0)
- ix86_cpu_string = PROCESSOR_DEFAULT_STRING;
-
- for (j = 0; j < ptt_size; j++)
- if (! strcmp (ix86_cpu_string, processor_target_table[j].name))
- {
- ix86_cpu = processor_target_table[j].processor;
- ix86_cost = processor_target_table[j].cost;
- if (i > j && (int)ix86_arch >= (int)PROCESSOR_PENTIUMPRO)
- error ("-mcpu=%s does not support -march=%s", ix86_cpu_string, ix86_arch_string);
-
- target_flags |= processor_target_table[j].target_enable;
- target_flags &= ~processor_target_table[j].target_disable;
- break;
- }
-
- if (j == ptt_size)
- {
- error ("bad value (%s) for -mcpu= switch", ix86_cpu_string);
- ix86_cpu_string = PROCESSOR_DEFAULT_STRING;
- ix86_cpu = PROCESSOR_DEFAULT;
- }
- /* Validate -mregparm= value */
- if (i386_regparm_string)
- {
- i386_regparm = atoi (i386_regparm_string);
- if (i386_regparm < 0 || i386_regparm > REGPARM_MAX)
- fatal ("-mregparm=%d is not between 0 and %d", i386_regparm, REGPARM_MAX);
- }
-
- /* The 486 suffers more from non-aligned cache line fills, and the larger code
- size results in a larger cache foot-print and more misses. The 486 has a
- 16 byte cache line, pentium and pentiumpro have a 32 byte cache line */
- def_align = (TARGET_486) ? 4 : 2;
-
- /* Validate -malign-loops= value, or provide default */
- if (i386_align_loops_string)
- {
- i386_align_loops = atoi (i386_align_loops_string);
- if (i386_align_loops < 0 || i386_align_loops > MAX_CODE_ALIGN)
- fatal ("-malign-loops=%d is not between 0 and %d",
- i386_align_loops, MAX_CODE_ALIGN);
- }
- else
- i386_align_loops = 2;
-
- /* Validate -malign-jumps= value, or provide default */
- if (i386_align_jumps_string)
- {
- i386_align_jumps = atoi (i386_align_jumps_string);
- if (i386_align_jumps < 0 || i386_align_jumps > MAX_CODE_ALIGN)
- fatal ("-malign-jumps=%d is not between 0 and %d",
- i386_align_jumps, MAX_CODE_ALIGN);
- }
- else
- i386_align_jumps = def_align;
-
- /* Validate -malign-functions= value, or provide default */
- if (i386_align_funcs_string)
- {
- i386_align_funcs = atoi (i386_align_funcs_string);
- if (i386_align_funcs < 0 || i386_align_funcs > MAX_CODE_ALIGN)
- fatal ("-malign-functions=%d is not between 0 and %d",
- i386_align_funcs, MAX_CODE_ALIGN);
- }
- else
- i386_align_funcs = def_align;
-
- /* Validate -mbranch-cost= value, or provide default */
- if (i386_branch_cost_string)
- {
- i386_branch_cost = atoi (i386_branch_cost_string);
- if (i386_branch_cost < 0 || i386_branch_cost > 5)
- fatal ("-mbranch-cost=%d is not between 0 and 5",
- i386_branch_cost);
- }
- else
- i386_branch_cost = 1;
-
- if (TARGET_OMIT_LEAF_FRAME_POINTER) /* keep nonleaf frame pointers */
- flag_omit_frame_pointer = 1;
-
- /* pic references don't explicitly mention pic_offset_table_rtx */
- /* code threaded into the prologue may conflict with profiling */
- if (flag_pic || profile_flag || profile_block_flag)
- target_flags &= ~MASK_SCHEDULE_PROLOGUE;
-}
-
-/* A C statement (sans semicolon) to choose the order in which to
- allocate hard registers for pseudo-registers local to a basic
- block.
-
- Store the desired register order in the array `reg_alloc_order'.
- Element 0 should be the register to allocate first; element 1, the
- next register; and so on.
-
- The macro body should not assume anything about the contents of
- `reg_alloc_order' before execution of the macro.
-
- On most machines, it is not necessary to define this macro. */
-
-void
-order_regs_for_local_alloc ()
-{
- int i, ch, order, regno;
-
- /* User specified the register allocation order */
- if (i386_reg_alloc_order)
- {
- for (i = order = 0; (ch = i386_reg_alloc_order[i]) != '\0'; i++)
- {
- switch (ch)
- {
- case 'a': regno = 0; break;
- case 'd': regno = 1; break;
- case 'c': regno = 2; break;
- case 'b': regno = 3; break;
- case 'S': regno = 4; break;
- case 'D': regno = 5; break;
- case 'B': regno = 6; break;
- }
-
- reg_alloc_order[order++] = regno;
- }
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (!regs_allocated[i])
- reg_alloc_order[order++] = i;
- }
- }
-
- /* If users did not specify a register allocation order, use natural order */
- else
- {
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- reg_alloc_order[i] = i;
- }
-}
-
-
-void
-optimization_options (level)
- int level;
-{
- /* 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
- if (level > 1)
- flag_schedule_insns = 0;
-#endif
-}
-
-/* Sign-extend a 16-bit constant */
-
-struct rtx_def *
-i386_sext16_if_const (op)
- struct rtx_def *op;
-{
- if (GET_CODE (op) == CONST_INT)
- {
- HOST_WIDE_INT val = INTVAL (op);
- HOST_WIDE_INT sext_val;
- if (val & 0x8000)
- sext_val = val | ~0xffff;
- else
- sext_val = val & 0xffff;
- if (sext_val != val)
- op = GEN_INT (sext_val);
- }
- return op;
-}
-
-/* Return nonzero if the rtx is aligned */
-
-static int
-i386_aligned_reg_p (regno)
- int regno;
-{
- return (regno == STACK_POINTER_REGNUM
- || (!flag_omit_frame_pointer
- && regno == FRAME_POINTER_REGNUM));
-}
-
-int
-i386_aligned_p (op)
- rtx op;
-{
- /* registers and immediate operands are always "aligned" */
- if (GET_CODE (op) != MEM)
- return 1;
-
- /* Don't even try to do any aligned optimizations with volatiles */
- if (MEM_VOLATILE_P (op))
- return 0;
-
- /* Get address of memory operand */
- op = XEXP (op, 0);
-
- switch (GET_CODE (op))
- {
- case CONST_INT:
- if (INTVAL (op) & 3)
- break;
- return 1;
-
- /* match "reg + offset" */
- case PLUS:
- if (GET_CODE (XEXP (op, 1)) != CONST_INT)
- break;
- if (INTVAL (XEXP (op, 1)) & 3)
- break;
- op = XEXP (op, 0);
- if (GET_CODE (op) != REG)
- break;
- /* fall through */
- case REG:
- return i386_aligned_reg_p (REGNO (op));
- }
- return 0;
-}
-
-/* Return nonzero if INSN looks like it won't compute useful cc bits
- as a side effect. This information is only a hint. */
-
-int
-i386_cc_probably_useless_p (insn)
- rtx insn;
-{
- return !next_cc0_user (insn);
-}
-
-/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific
- attribute for DECL. The attributes in ATTRIBUTES have previously been
- assigned to DECL. */
-
-int
-i386_valid_decl_attribute_p (decl, attributes, identifier, args)
- tree decl;
- tree attributes;
- tree identifier;
- tree args;
-{
- return 0;
-}
-
-/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific
- attribute for TYPE. The attributes in ATTRIBUTES have previously been
- assigned to TYPE. */
-
-int
-i386_valid_type_attribute_p (type, attributes, identifier, args)
- tree type;
- tree attributes;
- tree identifier;
- tree args;
-{
- if (TREE_CODE (type) != FUNCTION_TYPE
- && TREE_CODE (type) != FIELD_DECL
- && TREE_CODE (type) != TYPE_DECL)
- return 0;
-
- /* Stdcall attribute says callee is responsible for popping arguments
- if they are not variable. */
- if (is_attribute_p ("stdcall", identifier))
- return (args == NULL_TREE);
-
- /* Cdecl attribute says the callee is a normal C declaration */
- if (is_attribute_p ("cdecl", identifier))
- return (args == NULL_TREE);
-
- /* Regparm attribute specifies how many integer arguments are to be
- passed in registers */
- if (is_attribute_p ("regparm", identifier))
- {
- tree cst;
-
- if (!args || TREE_CODE (args) != TREE_LIST
- || TREE_CHAIN (args) != NULL_TREE
- || TREE_VALUE (args) == NULL_TREE)
- return 0;
-
- cst = TREE_VALUE (args);
- if (TREE_CODE (cst) != INTEGER_CST)
- return 0;
-
- if (TREE_INT_CST_HIGH (cst) != 0
- || TREE_INT_CST_LOW (cst) < 0
- || TREE_INT_CST_LOW (cst) > REGPARM_MAX)
- return 0;
-
- return 1;
- }
-
- return 0;
-}
-
-/* Return 0 if the attributes for two types are incompatible, 1 if they
- are compatible, and 2 if they are nearly compatible (which causes a
- warning to be generated). */
-
-int
-i386_comp_type_attributes (type1, type2)
- tree type1;
- tree type2;
-{
- return 1;
-}
-
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the 80386, the RTD insn may be used to pop them if the number
- of args is fixed, but if the number is variable then the caller
- must pop them all. RTD can't be used for library calls now
- because the library is compiled with the Unix compiler.
- Use of RTD is a selectable option, since it is incompatible with
- standard Unix calling sequences. If the option is not selected,
- the caller must always pop the args.
-
- The attribute stdcall is equivalent to RTD on a per module basis. */
-
-int
-i386_return_pops_args (fundecl, funtype, size)
- tree fundecl;
- tree funtype;
- int size;
-{
- int rtd = TARGET_RTD && (!fundecl || TREE_CODE (fundecl) != IDENTIFIER_NODE);
-
- /* Cdecl functions override -mrtd, and never pop the stack */
- if (!lookup_attribute ("cdecl", TYPE_ATTRIBUTES (funtype))) {
-
- /* Stdcall functions will pop the stack if not variable args */
- if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (funtype)))
- rtd = 1;
-
- if (rtd
- && (TYPE_ARG_TYPES (funtype) == NULL_TREE
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (funtype))) == void_type_node)))
- return size;
- }
-
- /* Lose any fake structure return argument */
- if (aggregate_value_p (TREE_TYPE (funtype)))
- return GET_MODE_SIZE (Pmode);
-
- return 0;
-}
-
-
-/* Argument support functions. */
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-void
-init_cumulative_args (cum, fntype, libname)
- CUMULATIVE_ARGS *cum; /* argument info to initialize */
- tree fntype; /* tree ptr for function decl */
- rtx libname; /* SYMBOL_REF of library name or 0 */
-{
- static CUMULATIVE_ARGS zero_cum;
- tree param, next_param;
-
- if (TARGET_DEBUG_ARG)
- {
- fprintf (stderr, "\ninit_cumulative_args (");
- if (fntype)
- {
- tree ret_type = TREE_TYPE (fntype);
- fprintf (stderr, "fntype code = %s, ret code = %s",
- tree_code_name[ (int)TREE_CODE (fntype) ],
- tree_code_name[ (int)TREE_CODE (ret_type) ]);
- }
- else
- fprintf (stderr, "no fntype");
-
- if (libname)
- fprintf (stderr, ", libname = %s", XSTR (libname, 0));
- }
-
- *cum = zero_cum;
-
- /* Set up the number of registers to use for passing arguments. */
- cum->nregs = i386_regparm;
- if (fntype)
- {
- tree attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (fntype));
- if (attr)
- cum->nregs = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr)));
- }
-
- /* Determine if this function has variable arguments. This is
- indicated by the last argument being 'void_type_mode' if there
- are no variable arguments. If there are variable arguments, then
- we won't pass anything in registers */
-
- if (cum->nregs)
- {
- for (param = (fntype) ? TYPE_ARG_TYPES (fntype) : 0;
- param != (tree)0;
- param = next_param)
- {
- next_param = TREE_CHAIN (param);
- if (next_param == (tree)0 && TREE_VALUE (param) != void_type_node)
- cum->nregs = 0;
- }
- }
-
- if (TARGET_DEBUG_ARG)
- fprintf (stderr, ", nregs=%d )\n", cum->nregs);
-
- return;
-}
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-void
-function_arg_advance (cum, mode, type, named)
- CUMULATIVE_ARGS *cum; /* current arg information */
- enum machine_mode mode; /* current arg mode */
- tree type; /* type of the argument or 0 if lib support */
- int named; /* whether or not the argument was named */
-{
- int bytes = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode);
- int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
-
- if (TARGET_DEBUG_ARG)
- fprintf (stderr,
- "function_adv( size=%d, words=%2d, nregs=%d, mode=%4s, named=%d )\n\n",
- words, cum->words, cum->nregs, GET_MODE_NAME (mode), named);
-
- cum->words += words;
- cum->nregs -= words;
- cum->regno += words;
-
- if (cum->nregs <= 0)
- {
- cum->nregs = 0;
- cum->regno = 0;
- }
-
- return;
-}
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-struct rtx_def *
-function_arg (cum, mode, type, named)
- CUMULATIVE_ARGS *cum; /* current arg information */
- enum machine_mode mode; /* current arg mode */
- tree type; /* type of the argument or 0 if lib support */
- int named; /* != 0 for normal args, == 0 for ... args */
-{
- rtx ret = NULL_RTX;
- int bytes = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode);
- int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
-
- switch (mode)
- {
- default: /* for now, pass fp/complex values on the stack */
- break;
-
- case BLKmode:
- case DImode:
- case SImode:
- case HImode:
- case QImode:
- if (words <= cum->nregs)
- ret = gen_rtx (REG, mode, cum->regno);
- break;
- }
-
- if (TARGET_DEBUG_ARG)
- {
- fprintf (stderr,
- "function_arg( size=%d, words=%2d, nregs=%d, mode=%4s, named=%d",
- words, cum->words, cum->nregs, GET_MODE_NAME (mode), named);
-
- if (ret)
- fprintf (stderr, ", reg=%%e%s", reg_names[ REGNO(ret) ]);
- else
- fprintf (stderr, ", stack");
-
- fprintf (stderr, " )\n");
- }
-
- return ret;
-}
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-int
-function_arg_partial_nregs (cum, mode, type, named)
- CUMULATIVE_ARGS *cum; /* current arg information */
- enum machine_mode mode; /* current arg mode */
- tree type; /* type of the argument or 0 if lib support */
- int named; /* != 0 for normal args, == 0 for ... args */
-{
- return 0;
-}
-
-
-/* Output an insn whose source is a 386 integer register. SRC is the
- rtx for the register, and TEMPLATE is the op-code template. SRC may
- be either SImode or DImode.
-
- The template will be output with operands[0] as SRC, and operands[1]
- as a pointer to the top of the 386 stack. So a call from floatsidf2
- would look like this:
-
- output_op_from_reg (operands[1], AS1 (fild%z0,%1));
-
- where %z0 corresponds to the caller's operands[1], and is used to
- emit the proper size suffix.
-
- ??? Extend this to handle HImode - a 387 can load and store HImode
- values directly. */
-
-void
-output_op_from_reg (src, template)
- rtx src;
- char *template;
-{
- rtx xops[4];
- int size = GET_MODE_SIZE (GET_MODE (src));
-
- xops[0] = src;
- xops[1] = AT_SP (Pmode);
- xops[2] = GEN_INT (size);
- xops[3] = stack_pointer_rtx;
-
- if (size > UNITS_PER_WORD)
- {
- rtx high;
- if (size > 2 * UNITS_PER_WORD)
- {
- high = gen_rtx (REG, SImode, REGNO (src) + 2);
- output_asm_insn (AS1 (push%L0,%0), &high);
- }
- high = gen_rtx (REG, SImode, REGNO (src) + 1);
- output_asm_insn (AS1 (push%L0,%0), &high);
- }
- output_asm_insn (AS1 (push%L0,%0), &src);
-
- output_asm_insn (template, xops);
-
- output_asm_insn (AS2 (add%L3,%2,%3), xops);
-}
-
-/* Output an insn to pop an value from the 387 top-of-stack to 386
- register DEST. The 387 register stack is popped if DIES is true. If
- the mode of DEST is an integer mode, a `fist' integer store is done,
- otherwise a `fst' float store is done. */
-
-void
-output_to_reg (dest, dies)
- rtx dest;
- int dies;
-{
- rtx xops[4];
- int size = GET_MODE_SIZE (GET_MODE (dest));
-
- xops[0] = AT_SP (Pmode);
- xops[1] = stack_pointer_rtx;
- xops[2] = GEN_INT (size);
- xops[3] = dest;
-
- output_asm_insn (AS2 (sub%L1,%2,%1), xops);
-
- if (GET_MODE_CLASS (GET_MODE (dest)) == MODE_INT)
- {
- if (dies)
- output_asm_insn (AS1 (fistp%z3,%y0), xops);
- else
- output_asm_insn (AS1 (fist%z3,%y0), xops);
- }
- else if (GET_MODE_CLASS (GET_MODE (dest)) == MODE_FLOAT)
- {
- if (dies)
- output_asm_insn (AS1 (fstp%z3,%y0), xops);
- else
- {
- if (GET_MODE (dest) == XFmode)
- {
- output_asm_insn (AS1 (fstp%z3,%y0), xops);
- output_asm_insn (AS1 (fld%z3,%y0), xops);
- }
- else
- output_asm_insn (AS1 (fst%z3,%y0), xops);
- }
- }
- else
- abort ();
-
- output_asm_insn (AS1 (pop%L0,%0), &dest);
-
- if (size > UNITS_PER_WORD)
- {
- dest = gen_rtx (REG, SImode, REGNO (dest) + 1);
- output_asm_insn (AS1 (pop%L0,%0), &dest);
- if (size > 2 * UNITS_PER_WORD)
- {
- dest = gen_rtx (REG, SImode, REGNO (dest) + 1);
- output_asm_insn (AS1 (pop%L0,%0), &dest);
- }
- }
-}
-
-char *
-singlemove_string (operands)
- rtx *operands;
-{
- rtx x;
- if (GET_CODE (operands[0]) == MEM
- && GET_CODE (x = XEXP (operands[0], 0)) == PRE_DEC)
- {
- if (XEXP (x, 0) != stack_pointer_rtx)
- abort ();
- return "push%L1 %1";
- }
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- return output_move_const_single (operands);
- }
- else if (GET_CODE (operands[0]) == REG || GET_CODE (operands[1]) == REG)
- return AS2 (mov%L0,%1,%0);
- else if (CONSTANT_P (operands[1]))
- return AS2 (mov%L0,%1,%0);
- else
- {
- output_asm_insn ("push%L1 %1", operands);
- return "pop%L0 %0";
- }
-}
-
-/* Return a REG that occurs in ADDR with coefficient 1.
- ADDR can be effectively incremented by incrementing REG. */
-
-static rtx
-find_addr_reg (addr)
- rtx addr;
-{
- while (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG)
- addr = XEXP (addr, 0);
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 0)))
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 1)))
- addr = XEXP (addr, 0);
- else
- abort ();
- }
- if (GET_CODE (addr) == REG)
- return addr;
- abort ();
-}
-
-
-/* Output an insn to add the constant N to the register X. */
-
-static void
-asm_add (n, x)
- int n;
- rtx x;
-{
- rtx xops[2];
- xops[0] = x;
-
- if (n == -1)
- output_asm_insn (AS1 (dec%L0,%0), xops);
- else if (n == 1)
- output_asm_insn (AS1 (inc%L0,%0), xops);
- else if (n < 0 || n == 128)
- {
- xops[1] = GEN_INT (-n);
- output_asm_insn (AS2 (sub%L0,%1,%0), xops);
- }
- else if (n > 0)
- {
- xops[1] = GEN_INT (n);
- output_asm_insn (AS2 (add%L0,%1,%0), xops);
- }
-}
-
-
-/* Output assembler code to perform a doubleword move insn
- with operands OPERANDS. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum {REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP } optype0, optype1;
- rtx latehalf[2];
- rtx middlehalf[2];
- rtx xops[2];
- rtx addreg0 = 0, addreg1 = 0;
- int dest_overlapped_low = 0;
- int size = GET_MODE_SIZE (GET_MODE (operands[0]));
-
- middlehalf[0] = 0;
- middlehalf[1] = 0;
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- optype0 = POPOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- optype0 = PUSHOP;
- else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1]))
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC)
- optype1 = POPOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- optype1 = PUSHOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP)
- abort ();
-
- /* If one operand is decrementing and one is incrementing
- decrement the former register explicitly
- and change that operand into ordinary indexing. */
-
- if (optype0 == PUSHOP && optype1 == POPOP)
- {
- /* ??? Can this ever happen on i386? */
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
- asm_add (-size, operands[0]);
- if (GET_MODE (operands[1]) == XFmode)
- operands[0] = gen_rtx (MEM, XFmode, operands[0]);
- else if (GET_MODE (operands[0]) == DFmode)
- operands[0] = gen_rtx (MEM, DFmode, operands[0]);
- else
- operands[0] = gen_rtx (MEM, DImode, operands[0]);
- optype0 = OFFSOP;
- }
-
- if (optype0 == POPOP && optype1 == PUSHOP)
- {
- /* ??? Can this ever happen on i386? */
- operands[1] = XEXP (XEXP (operands[1], 0), 0);
- asm_add (-size, operands[1]);
- if (GET_MODE (operands[1]) == XFmode)
- operands[1] = gen_rtx (MEM, XFmode, operands[1]);
- else if (GET_MODE (operands[1]) == DFmode)
- operands[1] = gen_rtx (MEM, DFmode, operands[1]);
- else
- operands[1] = gen_rtx (MEM, DImode, operands[1]);
- optype1 = OFFSOP;
- }
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (operands[0], 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (operands[1], 0));
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first,
- but if either operand is autodecrementing then we
- do the high-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (size == 12)
- {
- if (optype0 == REGOP)
- {
- middlehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 2);
- }
- else if (optype0 == OFFSOP)
- {
- middlehalf[0] = adj_offsettable_operand (operands[0], 4);
- latehalf[0] = adj_offsettable_operand (operands[0], 8);
- }
- else
- {
- middlehalf[0] = operands[0];
- latehalf[0] = operands[0];
- }
-
- if (optype1 == REGOP)
- {
- middlehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
- }
- else if (optype1 == OFFSOP)
- {
- middlehalf[1] = adj_offsettable_operand (operands[1], 4);
- latehalf[1] = adj_offsettable_operand (operands[1], 8);
- }
- else if (optype1 == CNSTOP)
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- REAL_VALUE_TYPE r; long l[3];
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l);
- operands[1] = GEN_INT (l[0]);
- middlehalf[1] = GEN_INT (l[1]);
- latehalf[1] = GEN_INT (l[2]);
- }
- else if (CONSTANT_P (operands[1]))
- /* No non-CONST_DOUBLE constant should ever appear here. */
- abort ();
- }
- else
- {
- middlehalf[1] = operands[1];
- latehalf[1] = operands[1];
- }
- }
- else /* size is not 12: */
- {
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], 4);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- else if (optype1 == CNSTOP)
- split_double (operands[1], &operands[1], &latehalf[1]);
- else
- latehalf[1] = operands[1];
- }
-
- /* If insn is effectively movd N (sp),-(sp) then we will do the
- high word first. We should use the adjusted operand 1
- (which is N+4 (sp) or N+8 (sp))
- for the low word and middle word as well,
- to compensate for the first decrement of sp. */
- if (optype0 == PUSHOP
- && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM
- && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1]))
- middlehalf[1] = operands[1] = latehalf[1];
-
- /* For (set (reg:DI N) (mem:DI ... (reg:SI N) ...)),
- if the upper part of reg N does not appear in the MEM, arrange to
- emit the move late-half first. Otherwise, compute the MEM address
- into the upper part of N and use that as a pointer to the memory
- operand. */
- if (optype0 == REGOP
- && (optype1 == OFFSOP || optype1 == MEMOP))
- {
- if (reg_mentioned_p (operands[0], XEXP (operands[1], 0))
- && reg_mentioned_p (latehalf[0], XEXP (operands[1], 0)))
- {
- /* If both halves of dest are used in the src memory address,
- compute the address into latehalf of dest. */
-compadr:
- xops[0] = latehalf[0];
- xops[1] = XEXP (operands[1], 0);
- output_asm_insn (AS2 (lea%L0,%a1,%0), xops);
- if( GET_MODE (operands[1]) == XFmode )
- {
-/* abort (); */
- operands[1] = gen_rtx (MEM, XFmode, latehalf[0]);
- middlehalf[1] = adj_offsettable_operand (operands[1], size-8);
- latehalf[1] = adj_offsettable_operand (operands[1], size-4);
- }
- else
- {
- operands[1] = gen_rtx (MEM, DImode, latehalf[0]);
- latehalf[1] = adj_offsettable_operand (operands[1], size-4);
- }
- }
- else if (size == 12
- && reg_mentioned_p (middlehalf[0], XEXP (operands[1], 0)))
- {
- /* Check for two regs used by both source and dest. */
- if (reg_mentioned_p (operands[0], XEXP (operands[1], 0))
- || reg_mentioned_p (latehalf[0], XEXP (operands[1], 0)))
- goto compadr;
-
- /* JRV says this can't happen: */
- if (addreg0 || addreg1)
- abort();
-
- /* Only the middle reg conflicts; simply put it last. */
- output_asm_insn (singlemove_string (operands), operands);
- output_asm_insn (singlemove_string (latehalf), latehalf);
- output_asm_insn (singlemove_string (middlehalf), middlehalf);
- return "";
- }
- else if (reg_mentioned_p (operands[0], XEXP (operands[1], 0)))
- /* If the low half of dest is mentioned in the source memory
- address, the arrange to emit the move late half first. */
- dest_overlapped_low = 1;
- }
-
- /* If one or both operands autodecrementing,
- do the two words, high-numbered first. */
-
- /* Likewise, the first move would clobber the source of the second one,
- do them in the other order. This happens only for registers;
- such overlap can't happen in memory unless the user explicitly
- sets it up, and that is an undefined circumstance. */
-
-/*
- if (optype0 == PUSHOP || optype1 == PUSHOP
- || (optype0 == REGOP && optype1 == REGOP
- && REGNO (operands[0]) == REGNO (latehalf[1]))
- || dest_overlapped_low)
-*/
- if (optype0 == PUSHOP || optype1 == PUSHOP
- || (optype0 == REGOP && optype1 == REGOP
- && ((middlehalf[1] && REGNO (operands[0]) == REGNO (middlehalf[1]))
- || REGNO (operands[0]) == REGNO (latehalf[1])))
- || dest_overlapped_low)
- {
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- asm_add (size-4, addreg0);
- if (addreg1)
- asm_add (size-4, addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- asm_add (-4, addreg0);
- if (addreg1)
- asm_add (-4, addreg1);
-
- if (size == 12)
- {
- output_asm_insn (singlemove_string (middlehalf), middlehalf);
- if (addreg0)
- asm_add (-4, addreg0);
- if (addreg1)
- asm_add (-4, addreg1);
- }
-
- /* Do low-numbered word. */
- return singlemove_string (operands);
- }
-
- /* Normal case: do the two words, low-numbered first. */
-
- output_asm_insn (singlemove_string (operands), operands);
-
- /* Do the middle one of the three words for long double */
- if (size == 12)
- {
- if (addreg0)
- asm_add (4, addreg0);
- if (addreg1)
- asm_add (4, addreg1);
-
- output_asm_insn (singlemove_string (middlehalf), middlehalf);
- }
-
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- asm_add (4, addreg0);
- if (addreg1)
- asm_add (4, addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- asm_add (4-size, addreg0);
- if (addreg1)
- asm_add (4-size, addreg1);
-
- return "";
-}
-
-
-#define MAX_TMPS 2 /* max temporary registers used */
-
-/* Output the appropriate code to move push memory on the stack */
-
-char *
-output_move_pushmem (operands, insn, length, tmp_start, n_operands)
- rtx operands[];
- rtx insn;
- int length;
- int tmp_start;
- int n_operands;
-{
-
- struct {
- char *load;
- char *push;
- rtx xops[2];
- } tmp_info[MAX_TMPS];
-
- rtx src = operands[1];
- int max_tmps = 0;
- int offset = 0;
- int stack_p = reg_overlap_mentioned_p (stack_pointer_rtx, src);
- int stack_offset = 0;
- int i, num_tmps;
- rtx xops[1];
-
- if (!offsettable_memref_p (src))
- fatal_insn ("Source is not offsettable", insn);
-
- if ((length & 3) != 0)
- fatal_insn ("Pushing non-word aligned size", insn);
-
- /* Figure out which temporary registers we have available */
- for (i = tmp_start; i < n_operands; i++)
- {
- if (GET_CODE (operands[i]) == REG)
- {
- if (reg_overlap_mentioned_p (operands[i], src))
- continue;
-
- tmp_info[ max_tmps++ ].xops[1] = operands[i];
- if (max_tmps == MAX_TMPS)
- break;
- }
- }
-
- if (max_tmps == 0)
- for (offset = length - 4; offset >= 0; offset -= 4)
- {
- xops[0] = adj_offsettable_operand (src, offset + stack_offset);
- output_asm_insn (AS1(push%L0,%0), xops);
- if (stack_p)
- stack_offset += 4;
- }
-
- else
- for (offset = length - 4; offset >= 0; )
- {
- for (num_tmps = 0; num_tmps < max_tmps && offset >= 0; num_tmps++)
- {
- tmp_info[num_tmps].load = AS2(mov%L0,%0,%1);
- tmp_info[num_tmps].push = AS1(push%L0,%1);
- tmp_info[num_tmps].xops[0] = adj_offsettable_operand (src, offset + stack_offset);
- offset -= 4;
- }
-
- for (i = 0; i < num_tmps; i++)
- output_asm_insn (tmp_info[i].load, tmp_info[i].xops);
-
- for (i = 0; i < num_tmps; i++)
- output_asm_insn (tmp_info[i].push, tmp_info[i].xops);
-
- if (stack_p)
- stack_offset += 4*num_tmps;
- }
-
- return "";
-}
-
-
-
-/* Output the appropriate code to move data between two memory locations */
-
-char *
-output_move_memory (operands, insn, length, tmp_start, n_operands)
- rtx operands[];
- rtx insn;
- int length;
- int tmp_start;
- int n_operands;
-{
- struct {
- char *load;
- char *store;
- rtx xops[3];
- } tmp_info[MAX_TMPS];
-
- rtx dest = operands[0];
- rtx src = operands[1];
- rtx qi_tmp = NULL_RTX;
- int max_tmps = 0;
- int offset = 0;
- int i, num_tmps;
- rtx xops[3];
-
- if (GET_CODE (dest) == MEM
- && GET_CODE (XEXP (dest, 0)) == PRE_INC
- && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx)
- return output_move_pushmem (operands, insn, length, tmp_start, n_operands);
-
- if (!offsettable_memref_p (src))
- fatal_insn ("Source is not offsettable", insn);
-
- if (!offsettable_memref_p (dest))
- fatal_insn ("Destination is not offsettable", insn);
-
- /* Figure out which temporary registers we have available */
- for (i = tmp_start; i < n_operands; i++)
- {
- if (GET_CODE (operands[i]) == REG)
- {
- if ((length & 1) != 0 && !qi_tmp && QI_REG_P (operands[i]))
- qi_tmp = operands[i];
-
- if (reg_overlap_mentioned_p (operands[i], dest))
- fatal_insn ("Temporary register overlaps the destination", insn);
-
- if (reg_overlap_mentioned_p (operands[i], src))
- fatal_insn ("Temporary register overlaps the source", insn);
-
- tmp_info[ max_tmps++ ].xops[2] = operands[i];
- if (max_tmps == MAX_TMPS)
- break;
- }
- }
-
- if (max_tmps == 0)
- fatal_insn ("No scratch registers were found to do memory->memory moves", insn);
-
- if ((length & 1) != 0)
- {
- if (!qi_tmp)
- fatal_insn ("No byte register found when moving odd # of bytes.", insn);
- }
-
- while (length > 1)
- {
- for (num_tmps = 0; num_tmps < max_tmps; num_tmps++)
- {
- if (length >= 4)
- {
- tmp_info[num_tmps].load = AS2(mov%L0,%1,%2);
- tmp_info[num_tmps].store = AS2(mov%L0,%2,%0);
- tmp_info[num_tmps].xops[0] = adj_offsettable_operand (dest, offset);
- tmp_info[num_tmps].xops[1] = adj_offsettable_operand (src, offset);
- offset += 4;
- length -= 4;
- }
- else if (length >= 2)
- {
- tmp_info[num_tmps].load = AS2(mov%W0,%1,%2);
- tmp_info[num_tmps].store = AS2(mov%W0,%2,%0);
- tmp_info[num_tmps].xops[0] = adj_offsettable_operand (dest, offset);
- tmp_info[num_tmps].xops[1] = adj_offsettable_operand (src, offset);
- offset += 2;
- length -= 2;
- }
- else
- break;
- }
-
- for (i = 0; i < num_tmps; i++)
- output_asm_insn (tmp_info[i].load, tmp_info[i].xops);
-
- for (i = 0; i < num_tmps; i++)
- output_asm_insn (tmp_info[i].store, tmp_info[i].xops);
- }
-
- if (length == 1)
- {
- xops[0] = adj_offsettable_operand (dest, offset);
- xops[1] = adj_offsettable_operand (src, offset);
- xops[2] = qi_tmp;
- output_asm_insn (AS2(mov%B0,%1,%2), xops);
- output_asm_insn (AS2(mov%B0,%2,%0), xops);
- }
-
- return "";
-}
-
-
-int
-standard_80387_constant_p (x)
- rtx x;
-{
-#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- REAL_VALUE_TYPE d;
- jmp_buf handler;
- int is0, is1;
-
- if (setjmp (handler))
- return 0;
-
- set_float_handler (handler);
- REAL_VALUE_FROM_CONST_DOUBLE (d, x);
- is0 = REAL_VALUES_EQUAL (d, dconst0) && !REAL_VALUE_MINUS_ZERO (d);
- is1 = REAL_VALUES_EQUAL (d, dconst1);
- set_float_handler (NULL_PTR);
-
- if (is0)
- return 1;
-
- if (is1)
- return 2;
-
- /* Note that on the 80387, other constants, such as pi,
- are much slower to load as standard constants
- than to load from doubles in memory! */
-#endif
-
- return 0;
-}
-
-char *
-output_move_const_single (operands)
- rtx *operands;
-{
- if (FP_REG_P (operands[0]))
- {
- int conval = standard_80387_constant_p (operands[1]);
-
- if (conval == 1)
- return "fldz";
-
- if (conval == 2)
- return "fld1";
- }
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- REAL_VALUE_TYPE r; long l;
-
- if (GET_MODE (operands[1]) == XFmode)
- abort ();
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
- REAL_VALUE_TO_TARGET_SINGLE (r, l);
- operands[1] = GEN_INT (l);
- }
- return singlemove_string (operands);
-}
-
-/* Returns 1 if OP is either a symbol reference or a sum of a symbol
- reference and a constant. */
-
-int
-symbolic_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- return 1;
- case CONST:
- op = XEXP (op, 0);
- return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (op, 0)) == LABEL_REF)
- && GET_CODE (XEXP (op, 1)) == CONST_INT);
- default:
- return 0;
- }
-}
-
-/* Test for a valid operand for a call instruction.
- Don't allow the arg pointer register or virtual regs
- since they may change into reg + const, which the patterns
- can't handle yet. */
-
-int
-call_insn_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == MEM
- && ((CONSTANT_ADDRESS_P (XEXP (op, 0))
- /* This makes a difference for PIC. */
- && general_operand (XEXP (op, 0), Pmode))
- || (GET_CODE (XEXP (op, 0)) == REG
- && XEXP (op, 0) != arg_pointer_rtx
- && !(REGNO (XEXP (op, 0)) >= FIRST_PSEUDO_REGISTER
- && REGNO (XEXP (op, 0)) <= LAST_VIRTUAL_REGISTER))))
- return 1;
- return 0;
-}
-
-/* Like call_insn_operand but allow (mem (symbol_ref ...))
- even if pic. */
-
-int
-expander_call_insn_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == MEM
- && (CONSTANT_ADDRESS_P (XEXP (op, 0))
- || (GET_CODE (XEXP (op, 0)) == REG
- && XEXP (op, 0) != arg_pointer_rtx
- && !(REGNO (XEXP (op, 0)) >= FIRST_PSEUDO_REGISTER
- && REGNO (XEXP (op, 0)) <= LAST_VIRTUAL_REGISTER))))
- return 1;
- return 0;
-}
-
-/* Return 1 if OP is a comparison operator that can use the condition code
- generated by an arithmetic operation. */
-
-int
-arithmetic_comparison_operator (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code;
-
- if (mode != VOIDmode && mode != GET_MODE (op))
- return 0;
- code = GET_CODE (op);
- if (GET_RTX_CLASS (code) != '<')
- return 0;
-
- return (code != GT && code != LE);
-}
-
-/* Returns 1 if OP contains a symbol reference */
-
-int
-symbolic_reference_mentioned_p (op)
- rtx op;
-{
- register char *fmt;
- register int i;
-
- if (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF)
- return 1;
-
- fmt = GET_RTX_FORMAT (GET_CODE (op));
- for (i = GET_RTX_LENGTH (GET_CODE (op)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
-
- for (j = XVECLEN (op, i) - 1; j >= 0; j--)
- if (symbolic_reference_mentioned_p (XVECEXP (op, i, j)))
- return 1;
- }
- else if (fmt[i] == 'e' && symbolic_reference_mentioned_p (XEXP (op, i)))
- return 1;
- }
-
- return 0;
-}
-
-/* Attempt to expand a binary operator. Make the expansion closer to the
- actual machine, then just general_operand, which will allow 3 separate
- memory references (one output, two input) in a single insn. Return
- whether the insn fails, or succeeds. */
-
-int
-ix86_expand_binary_operator (code, mode, operands)
- enum rtx_code code;
- enum machine_mode mode;
- rtx operands[];
-{
- rtx insn;
- int i;
- int modified;
-
- /* Recognize <var1> = <value> <op> <var1> for commutative operators */
- if (GET_RTX_CLASS (code) == 'c'
- && (rtx_equal_p (operands[0], operands[2])
- || immediate_operand (operands[1], mode)))
- {
- rtx temp = operands[1];
- operands[1] = operands[2];
- operands[2] = temp;
- }
-
- /* If optimizing, copy to regs to improve CSE */
- if (TARGET_PSEUDO && optimize && ((reload_in_progress | reload_completed) == 0))
- {
- if (GET_CODE (operands[1]) == MEM && !rtx_equal_p (operands[0], operands[1]))
- operands[1] = force_reg (GET_MODE (operands[1]), operands[1]);
-
- if (GET_CODE (operands[2]) == MEM)
- operands[2] = force_reg (GET_MODE (operands[2]), operands[2]);
-
- if (GET_CODE (operands[1]) == CONST_INT && code == MINUS)
- {
- rtx temp = gen_reg_rtx (GET_MODE (operands[0]));
- emit_move_insn (temp, operands[1]);
- operands[1] = temp;
- return TRUE;
- }
- }
-
- if (!ix86_binary_operator_ok (code, mode, operands))
- {
- /* If not optimizing, try to make a valid insn (optimize code previously did
- this above to improve chances of CSE) */
-
- if ((!TARGET_PSEUDO || !optimize)
- && ((reload_in_progress | reload_completed) == 0)
- && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM))
- {
- modified = FALSE;
- if (GET_CODE (operands[1]) == MEM && !rtx_equal_p (operands[0], operands[1]))
- {
- operands[1] = force_reg (GET_MODE (operands[1]), operands[1]);
- modified = TRUE;
- }
-
- if (GET_CODE (operands[2]) == MEM)
- {
- operands[2] = force_reg (GET_MODE (operands[2]), operands[2]);
- modified = TRUE;
- }
-
- if (GET_CODE (operands[1]) == CONST_INT && code == MINUS)
- {
- rtx temp = gen_reg_rtx (GET_MODE (operands[0]));
- emit_move_insn (temp, operands[1]);
- operands[1] = temp;
- return TRUE;
- }
-
- if (modified && !ix86_binary_operator_ok (code, mode, operands))
- return FALSE;
- }
- else
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Return TRUE or FALSE depending on whether the binary operator meets the
- appropriate constraints. */
-
-int
-ix86_binary_operator_ok (code, mode, operands)
- enum rtx_code code;
- enum machine_mode mode;
- rtx operands[3];
-{
- return (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)
- && (GET_CODE (operands[1]) != CONST_INT || GET_RTX_CLASS (code) == 'c');
-}
-
-/* Attempt to expand a unary operator. Make the expansion closer to the
- actual machine, then just general_operand, which will allow 2 separate
- memory references (one output, one input) in a single insn. Return
- whether the insn fails, or succeeds. */
-
-int
-ix86_expand_unary_operator (code, mode, operands)
- enum rtx_code code;
- enum machine_mode mode;
- rtx operands[];
-{
- rtx insn;
-
- /* If optimizing, copy to regs to improve CSE */
- if (TARGET_PSEUDO
- && optimize
- && ((reload_in_progress | reload_completed) == 0)
- && GET_CODE (operands[1]) == MEM)
- {
- operands[1] = force_reg (GET_MODE (operands[1]), operands[1]);
- }
-
- if (!ix86_unary_operator_ok (code, mode, operands))
- {
- if ((!TARGET_PSEUDO || !optimize)
- && ((reload_in_progress | reload_completed) == 0)
- && GET_CODE (operands[1]) == MEM)
- {
- operands[1] = force_reg (GET_MODE (operands[1]), operands[1]);
- if (!ix86_unary_operator_ok (code, mode, operands))
- return FALSE;
- }
- else
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Return TRUE or FALSE depending on whether the unary operator meets the
- appropriate constraints. */
-
-int
-ix86_unary_operator_ok (code, mode, operands)
- enum rtx_code code;
- enum machine_mode mode;
- rtx operands[2];
-{
- return TRUE;
-}
-
-
-
-static rtx pic_label_rtx;
-static char pic_label_name [256];
-static int pic_label_no = 0;
-
-/* This function generates code for -fpic that loads %ebx with
- with the return address of the caller and then returns. */
-void
-asm_output_function_prefix (file, name)
- FILE * file;
- char * name;
-{
- rtx xops[2];
- int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
- || current_function_uses_const_pool);
- xops[0] = pic_offset_table_rtx;
- xops[1] = stack_pointer_rtx;
-
- /* deep branch prediction favors having a return for every call */
- if (pic_reg_used && TARGET_DEEP_BRANCH_PREDICTION)
- {
- tree prologue_node;
-
- if (pic_label_rtx == 0)
- {
- pic_label_rtx = (rtx) gen_label_rtx ();
- sprintf (pic_label_name, "LPR%d", pic_label_no++);
- LABEL_NAME (pic_label_rtx) = pic_label_name;
- }
- prologue_node = make_node (FUNCTION_DECL);
- DECL_RESULT (prologue_node) = 0;
-#ifdef ASM_DECLARE_FUNCTION_NAME
- ASM_DECLARE_FUNCTION_NAME (file, pic_label_name, prologue_node);
-#endif
- output_asm_insn ("movl (%1),%0", xops);
- output_asm_insn ("ret", xops);
- }
-}
-
-/* Set up the stack and frame (if desired) for the function. */
-
-void
-function_prologue (file, size)
- FILE *file;
- int size;
-{
- register int regno;
- int limit;
- rtx xops[4];
- int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
- || current_function_uses_const_pool);
- long tsize = get_frame_size ();
-
- /* pic references don't explicitly mention pic_offset_table_rtx */
- if (TARGET_SCHEDULE_PROLOGUE)
- {
- pic_label_rtx = 0;
- return;
- }
-
- xops[0] = stack_pointer_rtx;
- xops[1] = frame_pointer_rtx;
- xops[2] = GEN_INT (tsize);
-
- if (frame_pointer_needed)
- {
- output_asm_insn ("push%L1 %1", xops);
- output_asm_insn (AS2 (mov%L0,%0,%1), xops);
- }
-
- if (tsize == 0)
- ;
- else if (! TARGET_STACK_PROBE || tsize < CHECK_STACK_LIMIT)
- output_asm_insn (AS2 (sub%L0,%2,%0), xops);
- else
- {
- xops[3] = gen_rtx (REG, SImode, 0);
- output_asm_insn (AS2 (mov%L0,%2,%3), xops);
-
- xops[3] = gen_rtx (SYMBOL_REF, Pmode, "_alloca");
- output_asm_insn (AS1 (call,%P3), xops);
- }
-
- /* Note If use enter it is NOT reversed args.
- This one is not reversed from intel!!
- I think enter is slower. Also sdb doesn't like it.
- But if you want it the code is:
- {
- xops[3] = const0_rtx;
- output_asm_insn ("enter %2,%3", xops);
- }
- */
- limit = (frame_pointer_needed ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
- for (regno = limit - 1; regno >= 0; regno--)
- if ((regs_ever_live[regno] && ! call_used_regs[regno])
- || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
- {
- xops[0] = gen_rtx (REG, SImode, regno);
- output_asm_insn ("push%L0 %0", xops);
- }
-
- if (pic_reg_used && TARGET_DEEP_BRANCH_PREDICTION)
- {
- xops[0] = pic_offset_table_rtx;
- xops[1] = gen_rtx (SYMBOL_REF, Pmode, LABEL_NAME (pic_label_rtx));
-
- output_asm_insn (AS1 (call,%P1), xops);
- output_asm_insn ("addl $_GLOBAL_OFFSET_TABLE_,%0", xops);
- pic_label_rtx = 0;
- }
- else if (pic_reg_used)
- {
- xops[0] = pic_offset_table_rtx;
- xops[1] = (rtx) gen_label_rtx ();
-
- output_asm_insn (AS1 (call,%P1), xops);
- ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (xops[1]));
- output_asm_insn (AS1 (pop%L0,%0), xops);
- output_asm_insn ("addl $_GLOBAL_OFFSET_TABLE_+[.-%P1],%0", xops);
- }
-}
-
-/* This function generates the assembly code for function entry.
- FILE is an stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate. */
-
-void
-ix86_expand_prologue ()
-{
- register int regno;
- int limit;
- rtx xops[4];
- int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
- || current_function_uses_const_pool);
- long tsize = get_frame_size ();
- rtx insn;
-
- if (!TARGET_SCHEDULE_PROLOGUE)
- return;
-
- xops[0] = stack_pointer_rtx;
- xops[1] = frame_pointer_rtx;
- xops[2] = GEN_INT (tsize);
- if (frame_pointer_needed)
- {
- insn = emit_insn
- (gen_rtx (SET, 0,
- gen_rtx (MEM, SImode,
- gen_rtx (PRE_DEC, SImode, stack_pointer_rtx)),
- frame_pointer_rtx));
- RTX_FRAME_RELATED_P (insn) = 1;
- insn = emit_move_insn (xops[1], xops[0]);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
-
- if (tsize == 0)
- ;
- else if (! TARGET_STACK_PROBE || tsize < CHECK_STACK_LIMIT)
- {
- insn = emit_insn (gen_subsi3 (xops[0], xops[0], xops[2]));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else
- {
- xops[3] = gen_rtx (REG, SImode, 0);
- emit_move_insn (xops[3], xops[2]);
- xops[3] = gen_rtx (MEM, FUNCTION_MODE,
- gen_rtx (SYMBOL_REF, Pmode, "_alloca"));
- emit_call_insn (gen_rtx (CALL, VOIDmode,
- xops[3], const0_rtx));
- }
-
- /* Note If use enter it is NOT reversed args.
- This one is not reversed from intel!!
- I think enter is slower. Also sdb doesn't like it.
- But if you want it the code is:
- {
- xops[3] = const0_rtx;
- output_asm_insn ("enter %2,%3", xops);
- }
- */
- limit = (frame_pointer_needed ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
- for (regno = limit - 1; regno >= 0; regno--)
- if ((regs_ever_live[regno] && ! call_used_regs[regno])
- || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
- {
- xops[0] = gen_rtx (REG, SImode, regno);
- insn = emit_insn
- (gen_rtx (SET, 0,
- gen_rtx (MEM, SImode,
- gen_rtx (PRE_DEC, SImode, stack_pointer_rtx)),
- xops[0]));
-
- RTX_FRAME_RELATED_P (insn) = 1;
- }
-
- if (pic_reg_used && TARGET_DEEP_BRANCH_PREDICTION)
- {
- xops[0] = pic_offset_table_rtx;
- if (pic_label_rtx == 0)
- {
- pic_label_rtx = (rtx) gen_label_rtx ();
- sprintf (pic_label_name, "LPR%d", pic_label_no++);
- LABEL_NAME (pic_label_rtx) = pic_label_name;
- }
- xops[1] = gen_rtx (MEM, QImode, gen_rtx (SYMBOL_REF, Pmode, LABEL_NAME (pic_label_rtx)));
-
- emit_insn (gen_prologue_get_pc (xops[0], xops[1]));
- emit_insn (gen_prologue_set_got (xops[0],
- gen_rtx (SYMBOL_REF, Pmode, "$_GLOBAL_OFFSET_TABLE_"),
- gen_rtx (CONST_INT, Pmode, CODE_LABEL_NUMBER(xops[1]))));
- }
- else if (pic_reg_used)
- {
- xops[0] = pic_offset_table_rtx;
- xops[1] = (rtx) gen_label_rtx ();
-
- emit_insn (gen_prologue_get_pc (xops[0], gen_rtx (CONST_INT, Pmode, CODE_LABEL_NUMBER(xops[1]))));
- emit_insn (gen_pop (xops[0]));
- emit_insn (gen_prologue_set_got (xops[0],
- gen_rtx (SYMBOL_REF, Pmode, "$_GLOBAL_OFFSET_TABLE_"),
- gen_rtx (CONST_INT, Pmode, CODE_LABEL_NUMBER (xops[1]))));
- }
-}
-
-/* Restore function stack, frame, and registers. */
-
-void
-function_epilogue (file, size)
- FILE *file;
- int size;
-{
-}
-
-/* Return 1 if it is appropriate to emit `ret' instructions in the
- body of a function. Do this only if the epilogue is simple, needing a
- couple of insns. Prior to reloading, we can't tell how many registers
- must be saved, so return 0 then. Return 0 if there is no frame
- marker to de-allocate.
-
- If NON_SAVING_SETJMP is defined and true, then it is not possible
- for the epilogue to be simple, so return 0. This is a special case
- since NON_SAVING_SETJMP will not cause regs_ever_live to change
- until final, but jump_optimize may need to know sooner if a
- `return' is OK. */
-
-int
-ix86_can_use_return_insn_p ()
-{
- int regno;
- int nregs = 0;
- int reglimit = (frame_pointer_needed
- ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
- int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
- || current_function_uses_const_pool);
-
-#ifdef NON_SAVING_SETJMP
- if (NON_SAVING_SETJMP && current_function_calls_setjmp)
- return 0;
-#endif
-
- if (! reload_completed)
- return 0;
-
- for (regno = reglimit - 1; regno >= 0; regno--)
- if ((regs_ever_live[regno] && ! call_used_regs[regno])
- || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
- nregs++;
-
- return nregs == 0 || ! frame_pointer_needed;
-}
-
-
-/* This function generates the assembly code for function exit.
- FILE is an stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to deallocate. */
-
-void
-ix86_expand_epilogue ()
-{
- register int regno;
- register int nregs, limit;
- int offset;
- rtx xops[3];
- int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
- || current_function_uses_const_pool);
- long tsize = get_frame_size ();
-
- /* Compute the number of registers to pop */
-
- limit = (frame_pointer_needed
- ? FRAME_POINTER_REGNUM
- : STACK_POINTER_REGNUM);
-
- nregs = 0;
-
- for (regno = limit - 1; regno >= 0; regno--)
- if ((regs_ever_live[regno] && ! call_used_regs[regno])
- || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
- nregs++;
-
- /* sp is often unreliable so we must go off the frame pointer,
- */
-
- /* In reality, we may not care if sp is unreliable, because we can
- restore the register relative to the frame pointer. In theory,
- since each move is the same speed as a pop, and we don't need the
- leal, this is faster. For now restore multiple registers the old
- way. */
-
- offset = -tsize - (nregs * UNITS_PER_WORD);
-
- xops[2] = stack_pointer_rtx;
-
- if (nregs > 1 || ! frame_pointer_needed)
- {
- if (frame_pointer_needed)
- {
- xops[0] = adj_offsettable_operand (AT_BP (QImode), offset);
- emit_insn (gen_movsi_lea (xops[2], XEXP (xops[0], 0)));
-/* output_asm_insn (AS2 (lea%L2,%0,%2), xops);*/
- }
-
- for (regno = 0; regno < limit; regno++)
- if ((regs_ever_live[regno] && ! call_used_regs[regno])
- || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
- {
- xops[0] = gen_rtx (REG, SImode, regno);
- emit_insn (gen_pop (xops[0]));
-/* output_asm_insn ("pop%L0 %0", xops);*/
- }
- }
- else
- for (regno = 0; regno < limit; regno++)
- if ((regs_ever_live[regno] && ! call_used_regs[regno])
- || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
- {
- xops[0] = gen_rtx (REG, SImode, regno);
- xops[1] = adj_offsettable_operand (AT_BP (Pmode), offset);
- emit_move_insn (xops[0], xops[1]);
-/* output_asm_insn (AS2 (mov%L0,%1,%0), xops);*/
- offset += 4;
- }
-
- if (frame_pointer_needed)
- {
- /* If not an i386, mov & pop is faster than "leave". */
-
- if (TARGET_USE_LEAVE)
- emit_insn (gen_leave());
-/* output_asm_insn ("leave", xops);*/
- else
- {
- xops[0] = frame_pointer_rtx;
- xops[1] = stack_pointer_rtx;
- emit_insn (gen_epilogue_set_stack_ptr());
-/* output_asm_insn (AS2 (mov%L2,%0,%2), xops);*/
- emit_insn (gen_pop (xops[0]));
-/* output_asm_insn ("pop%L0 %0", xops);*/
- }
- }
- else if (tsize)
- {
- /* If there is no frame pointer, we must still release the frame. */
-
- xops[0] = GEN_INT (tsize);
- emit_insn (gen_rtx (SET, SImode,
- xops[2],
- gen_rtx (PLUS, SImode,
- xops[2],
- xops[0])));
-/* output_asm_insn (AS2 (add%L2,%0,%2), xops);*/
- }
-
-#ifdef FUNCTION_BLOCK_PROFILER_EXIT
- if (profile_block_flag == 2)
- {
- FUNCTION_BLOCK_PROFILER_EXIT(file);
- }
-#endif
-
- if (current_function_pops_args && current_function_args_size)
- {
- xops[1] = GEN_INT (current_function_pops_args);
-
- /* i386 can only pop 32K bytes (maybe 64K? Is it signed?). If
- asked to pop more, pop return address, do explicit add, and jump
- indirectly to the caller. */
-
- if (current_function_pops_args >= 32768)
- {
- /* ??? Which register to use here? */
- xops[0] = gen_rtx (REG, SImode, 2);
- emit_insn (gen_pop (xops[0]));
-/* output_asm_insn ("pop%L0 %0", xops);*/
- emit_insn (gen_rtx (SET, SImode,
- xops[2],
- gen_rtx (PLUS, SImode,
- xops[1],
- xops[2])));
-/* output_asm_insn (AS2 (add%L2,%1,%2), xops);*/
- emit_jump_insn (xops[0]);
-/* output_asm_insn ("jmp %*%0", xops);*/
- }
- else
- emit_jump_insn (gen_return_pop_internal (xops[1]));
-/* output_asm_insn ("ret %1", xops);*/
- }
- else
-/* output_asm_insn ("ret", xops);*/
- emit_jump_insn (gen_return_internal ());
-}
-
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On x86, legitimate addresses are:
- base movl (base),reg
- displacement movl disp,reg
- base + displacement movl disp(base),reg
- index + base movl (base,index),reg
- (index + base) + displacement movl disp(base,index),reg
- index*scale movl (,index,scale),reg
- index*scale + disp movl disp(,index,scale),reg
- index*scale + base movl (base,index,scale),reg
- (index*scale + base) + disp movl disp(base,index,scale),reg
-
- In each case, scale can be 1, 2, 4, 8. */
-
-/* This is exactly the same as print_operand_addr, except that
- it recognizes addresses instead of printing them.
-
- It only recognizes address in canonical form. LEGITIMIZE_ADDRESS should
- convert common non-canonical forms to canonical form so that they will
- be recognized. */
-
-#define ADDR_INVALID(msg,insn) \
-do { \
- if (TARGET_DEBUG_ADDR) \
- { \
- fprintf (stderr, msg); \
- debug_rtx (insn); \
- } \
-} while (0)
-
-int
-legitimate_address_p (mode, addr, strict)
- enum machine_mode mode;
- register rtx addr;
- int strict;
-{
- rtx base = NULL_RTX;
- rtx indx = NULL_RTX;
- rtx scale = NULL_RTX;
- rtx disp = NULL_RTX;
-
- if (TARGET_DEBUG_ADDR)
- {
- fprintf (stderr,
- "\n==========\nGO_IF_LEGITIMATE_ADDRESS, mode = %s, strict = %d\n",
- GET_MODE_NAME (mode), strict);
-
- debug_rtx (addr);
- }
-
- if (GET_CODE (addr) == REG || GET_CODE (addr) == SUBREG)
- base = addr; /* base reg */
-
- else if (GET_CODE (addr) == PLUS)
- {
- rtx op0 = XEXP (addr, 0);
- rtx op1 = XEXP (addr, 1);
- enum rtx_code code0 = GET_CODE (op0);
- enum rtx_code code1 = GET_CODE (op1);
-
- if (code0 == REG || code0 == SUBREG)
- {
- if (code1 == REG || code1 == SUBREG)
- {
- indx = op0; /* index + base */
- base = op1;
- }
-
- else
- {
- base = op0; /* base + displacement */
- disp = op1;
- }
- }
-
- else if (code0 == MULT)
- {
- indx = XEXP (op0, 0);
- scale = XEXP (op0, 1);
-
- if (code1 == REG || code1 == SUBREG)
- base = op1; /* index*scale + base */
-
- else
- disp = op1; /* index*scale + disp */
- }
-
- else if (code0 == PLUS && GET_CODE (XEXP (op0, 0)) == MULT)
- {
- indx = XEXP (XEXP (op0, 0), 0); /* index*scale + base + disp */
- scale = XEXP (XEXP (op0, 0), 1);
- base = XEXP (op0, 1);
- disp = op1;
- }
-
- else if (code0 == PLUS)
- {
- indx = XEXP (op0, 0); /* index + base + disp */
- base = XEXP (op0, 1);
- disp = op1;
- }
-
- else
- {
- ADDR_INVALID ("PLUS subcode is not valid.\n", op0);
- return FALSE;
- }
- }
-
- else if (GET_CODE (addr) == MULT)
- {
- indx = XEXP (addr, 0); /* index*scale */
- scale = XEXP (addr, 1);
- }
-
- else
- disp = addr; /* displacement */
-
- /* Allow arg pointer and stack pointer as index if there is not scaling */
- if (base && indx && !scale
- && (indx == arg_pointer_rtx || indx == stack_pointer_rtx))
- {
- rtx tmp = base;
- base = indx;
- indx = tmp;
- }
-
- /* Validate base register */
- /* Don't allow SUBREG's here, it can lead to spill failures when the base
- is one word out of a two word structure, which is represented internally
- as a DImode int. */
- if (base)
- {
- if (GET_CODE (base) != REG)
- {
- ADDR_INVALID ("Base is not a register.\n", base);
- return FALSE;
- }
-
- if ((strict && !REG_OK_FOR_BASE_STRICT_P (base))
- || (!strict && !REG_OK_FOR_BASE_NONSTRICT_P (base)))
- {
- ADDR_INVALID ("Base is not valid.\n", base);
- return FALSE;
- }
- }
-
- /* Validate index register */
- /* Don't allow SUBREG's here, it can lead to spill failures when the index
- is one word out of a two word structure, which is represented internally
- as a DImode int. */
- if (indx)
- {
- if (GET_CODE (indx) != REG)
- {
- ADDR_INVALID ("Index is not a register.\n", indx);
- return FALSE;
- }
-
- if ((strict && !REG_OK_FOR_INDEX_STRICT_P (indx))
- || (!strict && !REG_OK_FOR_INDEX_NONSTRICT_P (indx)))
- {
- ADDR_INVALID ("Index is not valid.\n", indx);
- return FALSE;
- }
- }
- else if (scale)
- abort (); /* scale w/o index invalid */
-
- /* Validate scale factor */
- if (scale)
- {
- HOST_WIDE_INT value;
-
- if (GET_CODE (scale) != CONST_INT)
- {
- ADDR_INVALID ("Scale is not valid.\n", scale);
- return FALSE;
- }
-
- value = INTVAL (scale);
- if (value != 1 && value != 2 && value != 4 && value != 8)
- {
- ADDR_INVALID ("Scale is not a good multiplier.\n", scale);
- return FALSE;
- }
- }
-
- /* Validate displacement
- Constant pool addresses must be handled special. They are
- considered legitimate addresses, but only if not used with regs.
- When printed, the output routines know to print the reference with the
- PIC reg, even though the PIC reg doesn't appear in the RTL. */
- if (disp)
- {
- if (GET_CODE (disp) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (disp)
- && !base
- && !indx)
- ;
-
- else if (!CONSTANT_ADDRESS_P (disp))
- {
- ADDR_INVALID ("Displacement is not valid.\n", disp);
- return FALSE;
- }
-
- else if (GET_CODE (disp) == CONST_DOUBLE)
- {
- ADDR_INVALID ("Displacement is a const_double.\n", disp);
- return FALSE;
- }
-
- else if (flag_pic && SYMBOLIC_CONST (disp)
- && base != pic_offset_table_rtx
- && (indx != pic_offset_table_rtx || scale != NULL_RTX))
- {
- ADDR_INVALID ("Displacement is an invalid pic reference.\n", disp);
- return FALSE;
- }
-
- else if (HALF_PIC_P () && HALF_PIC_ADDRESS_P (disp)
- && (base != NULL_RTX || indx != NULL_RTX))
- {
- ADDR_INVALID ("Displacement is an invalid half-pic reference.\n", disp);
- return FALSE;
- }
- }
-
- if (TARGET_DEBUG_ADDR)
- fprintf (stderr, "Address is valid.\n");
-
- /* Everything looks valid, return true */
- return TRUE;
-}
-
-
-/* Return a legitimate reference for ORIG (an address) using the
- register REG. If REG is 0, a new pseudo is generated.
-
- There are three types of references that must be handled:
-
- 1. Global data references must load the address from the GOT, via
- the PIC reg. An insn is emitted to do this load, and the reg is
- returned.
-
- 2. Static data references must compute the address as an offset
- from the GOT, whose base is in the PIC reg. An insn is emitted to
- compute the address into a reg, and the reg is returned. Static
- data objects have SYMBOL_REF_FLAG set to differentiate them from
- global data objects.
-
- 3. Constant pool addresses must be handled special. They are
- considered legitimate addresses, but only if not used with regs.
- When printed, the output routines know to print the reference with the
- PIC reg, even though the PIC reg doesn't appear in the RTL.
-
- GO_IF_LEGITIMATE_ADDRESS rejects symbolic references unless the PIC
- reg also appears in the address (except for constant pool references,
- noted above).
-
- "switch" statements also require special handling when generating
- PIC code. See comments by the `casesi' insn in i386.md for details. */
-
-rtx
-legitimize_pic_address (orig, reg)
- rtx orig;
- rtx reg;
-{
- rtx addr = orig;
- rtx new = orig;
-
- if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
- {
- if (GET_CODE (addr) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (addr))
- reg = new = orig;
- else
- {
- if (reg == 0)
- reg = gen_reg_rtx (Pmode);
-
- if ((GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_FLAG (addr))
- || GET_CODE (addr) == LABEL_REF)
- new = gen_rtx (PLUS, Pmode, pic_offset_table_rtx, orig);
- else
- new = gen_rtx (MEM, Pmode,
- gen_rtx (PLUS, Pmode,
- pic_offset_table_rtx, orig));
-
- emit_move_insn (reg, new);
- }
- current_function_uses_pic_offset_table = 1;
- return reg;
- }
- else if (GET_CODE (addr) == CONST || GET_CODE (addr) == PLUS)
- {
- rtx base;
-
- if (GET_CODE (addr) == CONST)
- {
- addr = XEXP (addr, 0);
- if (GET_CODE (addr) != PLUS)
- abort ();
- }
-
- if (XEXP (addr, 0) == pic_offset_table_rtx)
- return orig;
-
- if (reg == 0)
- reg = gen_reg_rtx (Pmode);
-
- base = legitimize_pic_address (XEXP (addr, 0), reg);
- addr = legitimize_pic_address (XEXP (addr, 1),
- base == reg ? NULL_RTX : reg);
-
- if (GET_CODE (addr) == CONST_INT)
- return plus_constant (base, INTVAL (addr));
-
- if (GET_CODE (addr) == PLUS && CONSTANT_P (XEXP (addr, 1)))
- {
- base = gen_rtx (PLUS, Pmode, base, XEXP (addr, 0));
- addr = XEXP (addr, 1);
- }
- return gen_rtx (PLUS, Pmode, base, addr);
- }
- return new;
-}
-
-
-/* Emit insns to move operands[1] into operands[0]. */
-
-void
-emit_pic_move (operands, mode)
- rtx *operands;
- enum machine_mode mode;
-{
- rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
-
- if (GET_CODE (operands[0]) == MEM && SYMBOLIC_CONST (operands[1]))
- operands[1] = (rtx) force_reg (SImode, operands[1]);
- else
- operands[1] = legitimize_pic_address (operands[1], temp);
-}
-
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the 80386, we handle X+REG by loading X into a register R and
- using R+REG. R will go in a general reg and indexing will be used.
- However, if REG is a broken-out memory address or multiplication,
- nothing needs to be done because REG can certainly go in a general reg.
-
- When -fpic is used, special handling is needed for symbolic references.
- See comments by legitimize_pic_address in i386.c for details. */
-
-rtx
-legitimize_address (x, oldx, mode)
- register rtx x;
- register rtx oldx;
- enum machine_mode mode;
-{
- int changed = 0;
- unsigned log;
-
- if (TARGET_DEBUG_ADDR)
- {
- fprintf (stderr, "\n==========\nLEGITIMIZE_ADDRESS, mode = %s\n", GET_MODE_NAME (mode));
- debug_rtx (x);
- }
-
- if (flag_pic && SYMBOLIC_CONST (x))
- return legitimize_pic_address (x, 0);
-
- /* Canonicalize shifts by 0, 1, 2, 3 into multiply */
- if (GET_CODE (x) == ASHIFT
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && (log = (unsigned)exact_log2 (INTVAL (XEXP (x, 1)))) < 4)
- {
- changed = 1;
- x = gen_rtx (MULT, Pmode,
- force_reg (Pmode, XEXP (x, 0)),
- GEN_INT (1 << log));
- }
-
- if (GET_CODE (x) == PLUS)
- {
- /* Canonicalize shifts by 0, 1, 2, 3 into multiply */
- if (GET_CODE (XEXP (x, 0)) == ASHIFT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && (log = (unsigned)exact_log2 (INTVAL (XEXP (XEXP (x, 0), 1)))) < 4)
- {
- changed = 1;
- XEXP (x, 0) = gen_rtx (MULT, Pmode,
- force_reg (Pmode, XEXP (XEXP (x, 0), 0)),
- GEN_INT (1 << log));
- }
-
- if (GET_CODE (XEXP (x, 1)) == ASHIFT
- && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT
- && (log = (unsigned)exact_log2 (INTVAL (XEXP (XEXP (x, 1), 1)))) < 4)
- {
- changed = 1;
- XEXP (x, 1) = gen_rtx (MULT, Pmode,
- force_reg (Pmode, XEXP (XEXP (x, 1), 0)),
- GEN_INT (1 << log));
- }
-
- /* Put multiply first if it isn't already */
- if (GET_CODE (XEXP (x, 1)) == MULT)
- {
- rtx tmp = XEXP (x, 0);
- XEXP (x, 0) = XEXP (x, 1);
- XEXP (x, 1) = tmp;
- changed = 1;
- }
-
- /* Canonicalize (plus (mult (reg) (const)) (plus (reg) (const)))
- into (plus (plus (mult (reg) (const)) (reg)) (const)). This can be
- created by virtual register instantiation, register elimination, and
- similar optimizations. */
- if (GET_CODE (XEXP (x, 0)) == MULT && GET_CODE (XEXP (x, 1)) == PLUS)
- {
- changed = 1;
- x = gen_rtx (PLUS, Pmode,
- gen_rtx (PLUS, Pmode, XEXP (x, 0), XEXP (XEXP (x, 1), 0)),
- XEXP (XEXP (x, 1), 1));
- }
-
- /* Canonicalize (plus (plus (mult (reg) (const)) (plus (reg) (const))) const)
- into (plus (plus (mult (reg) (const)) (reg)) (const)). */
- else if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == PLUS
- && CONSTANT_P (XEXP (x, 1)))
- {
- rtx constant, other;
-
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- {
- constant = XEXP (x, 1);
- other = XEXP (XEXP (XEXP (x, 0), 1), 1);
- }
- else if (GET_CODE (XEXP (XEXP (XEXP (x, 0), 1), 1)) == CONST_INT)
- {
- constant = XEXP (XEXP (XEXP (x, 0), 1), 1);
- other = XEXP (x, 1);
- }
- else
- constant = 0;
-
- if (constant)
- {
- changed = 1;
- x = gen_rtx (PLUS, Pmode,
- gen_rtx (PLUS, Pmode, XEXP (XEXP (x, 0), 0),
- XEXP (XEXP (XEXP (x, 0), 1), 0)),
- plus_constant (other, INTVAL (constant)));
- }
- }
-
- if (changed && legitimate_address_p (mode, x, FALSE))
- return x;
-
- if (GET_CODE (XEXP (x, 0)) == MULT)
- {
- changed = 1;
- XEXP (x, 0) = force_operand (XEXP (x, 0), 0);
- }
-
- if (GET_CODE (XEXP (x, 1)) == MULT)
- {
- changed = 1;
- XEXP (x, 1) = force_operand (XEXP (x, 1), 0);
- }
-
- if (changed
- && GET_CODE (XEXP (x, 1)) == REG
- && GET_CODE (XEXP (x, 0)) == REG)
- return x;
-
- if (flag_pic && SYMBOLIC_CONST (XEXP (x, 1)))
- {
- changed = 1;
- x = legitimize_pic_address (x, 0);
- }
-
- if (changed && legitimate_address_p (mode, x, FALSE))
- return x;
-
- if (GET_CODE (XEXP (x, 0)) == REG)
- {
- register rtx temp = gen_reg_rtx (Pmode);
- register rtx val = force_operand (XEXP (x, 1), temp);
- if (val != temp)
- emit_move_insn (temp, val);
-
- XEXP (x, 1) = temp;
- return x;
- }
-
- else if (GET_CODE (XEXP (x, 1)) == REG)
- {
- register rtx temp = gen_reg_rtx (Pmode);
- register rtx val = force_operand (XEXP (x, 0), temp);
- if (val != temp)
- emit_move_insn (temp, val);
-
- XEXP (x, 0) = temp;
- return x;
- }
- }
-
- return x;
-}
-
-
-/* Print an integer constant expression in assembler syntax. Addition
- and subtraction are the only arithmetic that may appear in these
- expressions. FILE is the stdio stream to write to, X is the rtx, and
- CODE is the operand print code from the output string. */
-
-static void
-output_pic_addr_const (file, x, code)
- FILE *file;
- rtx x;
- int code;
-{
- char buf[256];
-
- switch (GET_CODE (x))
- {
- case PC:
- if (flag_pic)
- putc ('.', file);
- else
- abort ();
- break;
-
- case SYMBOL_REF:
- case LABEL_REF:
- if (GET_CODE (x) == SYMBOL_REF)
- assemble_name (file, XSTR (x, 0));
- else
- {
- ASM_GENERATE_INTERNAL_LABEL (buf, "L",
- CODE_LABEL_NUMBER (XEXP (x, 0)));
- assemble_name (asm_out_file, buf);
- }
-
- if (GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x))
- fprintf (file, "@GOTOFF(%%ebx)");
- else if (code == 'P')
- fprintf (file, "@PLT");
- else if (GET_CODE (x) == LABEL_REF)
- fprintf (file, "@GOTOFF");
- else if (! SYMBOL_REF_FLAG (x))
- fprintf (file, "@GOT");
- else
- fprintf (file, "@GOTOFF");
-
- break;
-
- case CODE_LABEL:
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));
- assemble_name (asm_out_file, buf);
- break;
-
- case CONST_INT:
- fprintf (file, "%d", INTVAL (x));
- break;
-
- case CONST:
- /* This used to output parentheses around the expression,
- but that does not work on the 386 (either ATT or BSD assembler). */
- output_pic_addr_const (file, XEXP (x, 0), code);
- break;
-
- case CONST_DOUBLE:
- if (GET_MODE (x) == VOIDmode)
- {
- /* We can use %d if the number is <32 bits and positive. */
- if (CONST_DOUBLE_HIGH (x) || CONST_DOUBLE_LOW (x) < 0)
- fprintf (file, "0x%x%08x",
- CONST_DOUBLE_HIGH (x), CONST_DOUBLE_LOW (x));
- else
- fprintf (file, "%d", CONST_DOUBLE_LOW (x));
- }
- else
- /* We can't handle floating point constants;
- PRINT_OPERAND must handle them. */
- output_operand_lossage ("floating constant misused");
- break;
-
- case PLUS:
- /* Some assemblers need integer constants to appear last (eg masm). */
- if (GET_CODE (XEXP (x, 0)) == CONST_INT)
- {
- output_pic_addr_const (file, XEXP (x, 1), code);
- if (INTVAL (XEXP (x, 0)) >= 0)
- fprintf (file, "+");
- output_pic_addr_const (file, XEXP (x, 0), code);
- }
- else
- {
- output_pic_addr_const (file, XEXP (x, 0), code);
- if (INTVAL (XEXP (x, 1)) >= 0)
- fprintf (file, "+");
- output_pic_addr_const (file, XEXP (x, 1), code);
- }
- break;
-
- case MINUS:
- output_pic_addr_const (file, XEXP (x, 0), code);
- fprintf (file, "-");
- output_pic_addr_const (file, XEXP (x, 1), code);
- break;
-
- default:
- output_operand_lossage ("invalid expression as operand");
- }
-}
-
-/* Append the correct conditional move suffix which corresponds to CODE */
-
-static void
-put_condition_code (code, mode, file)
- enum rtx_code code;
- enum mode_class mode;
- FILE * file;
-{
- if (mode == MODE_INT)
- switch (code)
- {
- case NE:
- if (cc_prev_status.flags & CC_Z_IN_NOT_C)
- fputs ("b", file);
- else
- fputs ("ne", file);
- return;
- case EQ:
- if (cc_prev_status.flags & CC_Z_IN_NOT_C)
- fputs ("ae", file);
- else
- fputs ("e", file);
- return;
- case GE:
- fputs ("ge", file); return;
- case GT:
- fputs ("g", file); return;
- case LE:
- fputs ("le", file); return;
- case LT:
- fputs ("l", file); return;
- case GEU:
- fputs ("ae", file); return;
- case GTU:
- fputs ("a", file); return;
- case LEU:
- fputs ("be", file); return;
- case LTU:
- fputs ("b", file); return;
- default: output_operand_lossage ("Invalid %%C operand");
- }
- else if (mode == MODE_FLOAT)
- switch (code)
- {
- case NE:
- fputs ("ne", file); return;
- case EQ:
- fputs ("e", file); return;
- case GE:
- fputs ("nb", file); return;
- case GT:
- fputs ("nbe", file); return;
- case LE:
- fputs ("be", file); return;
- case LT:
- fputs ("b", file); return;
- case GEU:
- fputs ("nb", file); return;
- case GTU:
- fputs ("nbe", file); return;
- case LEU:
- fputs ("be", file); return;
- case LTU:
- fputs ("b", file); return;
- default: output_operand_lossage ("Invalid %%C operand");
- }
-}
-
-/* Meaning of CODE:
- L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
- C -- print opcode suffix for set/cmov insn.
- c -- like C, but print reversed condition
- F -- print opcode suffix for fcmov insn.
- f -- like C, but print reversed condition
- R -- print the prefix for register names.
- z -- print the opcode suffix for the size of the current operand.
- * -- print a star (in certain assembler syntax)
- w -- print the operand as if it's a "word" (HImode) even if it isn't.
- c -- don't print special prefixes before constant operands.
- J -- print the appropriate jump operand.
- s -- print a shift double count, followed by the assemblers argument
- delimiter.
- b -- print the QImode name of the register for the indicated operand.
- %b0 would print %al if operands[0] is reg 0.
- w -- likewise, print the HImode name of the register.
- k -- likewise, print the SImode name of the register.
- h -- print the QImode name for a "high" register, either ah, bh, ch or dh.
- y -- print "st(0)" instead of "st" as a register.
- P -- print as a PIC constant
-*/
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- int code;
-{
- if (code)
- {
- switch (code)
- {
- case '*':
- if (USE_STAR)
- putc ('*', file);
- return;
-
- case 'L':
- PUT_OP_SIZE (code, 'l', file);
- return;
-
- case 'W':
- PUT_OP_SIZE (code, 'w', file);
- return;
-
- case 'B':
- PUT_OP_SIZE (code, 'b', file);
- return;
-
- case 'Q':
- PUT_OP_SIZE (code, 'l', file);
- return;
-
- case 'S':
- PUT_OP_SIZE (code, 's', file);
- return;
-
- case 'T':
- PUT_OP_SIZE (code, 't', file);
- return;
-
- case 'z':
- /* 387 opcodes don't get size suffixes if the operands are
- registers. */
-
- if (STACK_REG_P (x))
- return;
-
- /* this is the size of op from size of operand */
- switch (GET_MODE_SIZE (GET_MODE (x)))
- {
- case 1:
- PUT_OP_SIZE ('B', 'b', file);
- return;
-
- case 2:
- PUT_OP_SIZE ('W', 'w', file);
- return;
-
- case 4:
- if (GET_MODE (x) == SFmode)
- {
- PUT_OP_SIZE ('S', 's', file);
- return;
- }
- else
- PUT_OP_SIZE ('L', 'l', file);
- return;
-
- case 12:
- PUT_OP_SIZE ('T', 't', file);
- return;
-
- case 8:
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
- {
-#ifdef GAS_MNEMONICS
- PUT_OP_SIZE ('Q', 'q', file);
- return;
-#else
- PUT_OP_SIZE ('Q', 'l', file); /* Fall through */
-#endif
- }
-
- PUT_OP_SIZE ('Q', 'l', file);
- return;
- }
-
- case 'b':
- case 'w':
- case 'k':
- case 'h':
- case 'y':
- case 'P':
- break;
-
- case 'J':
- switch (GET_CODE (x))
- {
- /* These conditions are appropriate for testing the result
- of an arithmetic operation, not for a compare operation.
- Cases GE, LT assume CC_NO_OVERFLOW true. All cases assume
- CC_Z_IN_NOT_C false and not floating point. */
- case NE: fputs ("jne", file); return;
- case EQ: fputs ("je", file); return;
- case GE: fputs ("jns", file); return;
- case LT: fputs ("js", file); return;
- case GEU: fputs ("jmp", file); return;
- case GTU: fputs ("jne", file); return;
- case LEU: fputs ("je", file); return;
- case LTU: fputs ("#branch never", file); return;
-
- /* no matching branches for GT nor LE */
- }
- abort ();
-
- case 's':
- if (GET_CODE (x) == CONST_INT || ! SHIFT_DOUBLE_OMITS_COUNT)
- {
- PRINT_OPERAND (file, x, 0);
- fputs (AS2C (,) + 1, file);
- }
- return;
-
- /* This is used by the conditional move instructions. */
- case 'C':
- put_condition_code (GET_CODE (x), MODE_INT, file);
- return;
-
- /* like above, but reverse condition */
- case 'c':
- put_condition_code (reverse_condition (GET_CODE (x)), MODE_INT, file);
- return;
-
- case 'F':
- put_condition_code (GET_CODE (x), MODE_FLOAT, file);
- return;
-
- /* like above, but reverse condition */
- case 'f':
- put_condition_code (reverse_condition (GET_CODE (x)),
- MODE_FLOAT, file);
- return;
-
- default:
- {
- char str[50];
-
- sprintf (str, "invalid operand code `%c'", code);
- output_operand_lossage (str);
- }
- }
- }
- if (GET_CODE (x) == REG)
- {
- PRINT_REG (x, code, file);
- }
- else if (GET_CODE (x) == MEM)
- {
- PRINT_PTR (x, file);
- if (CONSTANT_ADDRESS_P (XEXP (x, 0)))
- {
- if (flag_pic)
- output_pic_addr_const (file, XEXP (x, 0), code);
- else
- output_addr_const (file, XEXP (x, 0));
- }
- else
- output_address (XEXP (x, 0));
- }
- else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == SFmode)
- {
- REAL_VALUE_TYPE r; long l;
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
- REAL_VALUE_TO_TARGET_SINGLE (r, l);
- PRINT_IMMED_PREFIX (file);
- fprintf (file, "0x%x", l);
- }
- /* These float cases don't actually occur as immediate operands. */
- else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == DFmode)
- {
- REAL_VALUE_TYPE r; char dstr[30];
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
- REAL_VALUE_TO_DECIMAL (r, "%.22e", dstr);
- fprintf (file, "%s", dstr);
- }
- else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == XFmode)
- {
- REAL_VALUE_TYPE r; char dstr[30];
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
- REAL_VALUE_TO_DECIMAL (r, "%.22e", dstr);
- fprintf (file, "%s", dstr);
- }
- else
- {
- if (code != 'P')
- {
- if (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)
- PRINT_IMMED_PREFIX (file);
- else if (GET_CODE (x) == CONST || GET_CODE (x) == SYMBOL_REF
- || GET_CODE (x) == LABEL_REF)
- PRINT_OFFSET_PREFIX (file);
- }
- if (flag_pic)
- output_pic_addr_const (file, x, code);
- else
- output_addr_const (file, x);
- }
-}
-
-/* Print a memory operand whose address is ADDR. */
-
-void
-print_operand_address (file, addr)
- FILE *file;
- register rtx addr;
-{
- register rtx reg1, reg2, breg, ireg;
- rtx offset;
-
- switch (GET_CODE (addr))
- {
- case REG:
- ADDR_BEG (file);
- fprintf (file, "%se", RP);
- fputs (hi_reg_name[REGNO (addr)], file);
- ADDR_END (file);
- break;
-
- case PLUS:
- reg1 = 0;
- reg2 = 0;
- ireg = 0;
- breg = 0;
- offset = 0;
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0)))
- {
- offset = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)))
- {
- offset = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- if (GET_CODE (addr) != PLUS) ;
- else if (GET_CODE (XEXP (addr, 0)) == MULT)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == MULT)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 0)) == REG)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT)
- {
- if (reg1 == 0) reg1 = addr;
- else reg2 = addr;
- addr = 0;
- }
- if (offset != 0)
- {
- if (addr != 0) abort ();
- addr = offset;
- }
- if ((reg1 && GET_CODE (reg1) == MULT)
- || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2))))
- {
- breg = reg2;
- ireg = reg1;
- }
- else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1)))
- {
- breg = reg1;
- ireg = reg2;
- }
-
- if (ireg != 0 || breg != 0)
- {
- int scale = 1;
-
- if (addr != 0)
- {
- if (flag_pic)
- output_pic_addr_const (file, addr, 0);
-
- else if (GET_CODE (addr) == LABEL_REF)
- output_asm_label (addr);
-
- else
- output_addr_const (file, addr);
- }
-
- if (ireg != 0 && GET_CODE (ireg) == MULT)
- {
- scale = INTVAL (XEXP (ireg, 1));
- ireg = XEXP (ireg, 0);
- }
-
- /* The stack pointer can only appear as a base register,
- never an index register, so exchange the regs if it is wrong. */
-
- if (scale == 1 && ireg && REGNO (ireg) == STACK_POINTER_REGNUM)
- {
- rtx tmp;
-
- tmp = breg;
- breg = ireg;
- ireg = tmp;
- }
-
- /* output breg+ireg*scale */
- PRINT_B_I_S (breg, ireg, scale, file);
- break;
- }
-
- case MULT:
- {
- int scale;
- if (GET_CODE (XEXP (addr, 0)) == CONST_INT)
- {
- scale = INTVAL (XEXP (addr, 0));
- ireg = XEXP (addr, 1);
- }
- else
- {
- scale = INTVAL (XEXP (addr, 1));
- ireg = XEXP (addr, 0);
- }
- output_addr_const (file, const0_rtx);
- PRINT_B_I_S ((rtx) 0, ireg, scale, file);
- }
- break;
-
- default:
- if (GET_CODE (addr) == CONST_INT
- && INTVAL (addr) < 0x8000
- && INTVAL (addr) >= -0x8000)
- fprintf (file, "%d", INTVAL (addr));
- else
- {
- if (flag_pic)
- output_pic_addr_const (file, addr, 0);
- else
- output_addr_const (file, addr);
- }
- }
-}
-
-/* Set the cc_status for the results of an insn whose pattern is EXP.
- On the 80386, we assume that only test and compare insns, as well
- as SI, HI, & DI mode ADD, SUB, NEG, AND, IOR, XOR, ASHIFT,
- ASHIFTRT, and LSHIFTRT instructions set the condition codes usefully.
- Also, we assume that jumps, moves and sCOND don't affect the condition
- codes. All else clobbers the condition codes, by assumption.
-
- We assume that ALL integer add, minus, etc. instructions effect the
- condition codes. This MUST be consistent with i386.md.
-
- We don't record any float test or compare - the redundant test &
- compare check in final.c does not handle stack-like regs correctly. */
-
-void
-notice_update_cc (exp)
- rtx exp;
-{
- if (GET_CODE (exp) == SET)
- {
- /* Jumps do not alter the cc's. */
- if (SET_DEST (exp) == pc_rtx)
- return;
-#ifdef IS_STACK_MODE
- /* Moving into a memory of stack_mode may have been moved
- in between the use and set of cc0 by loop_spl(). So
- old value of cc.status must be retained */
- if(GET_CODE(SET_DEST(exp))==MEM
- && IS_STACK_MODE(GET_MODE(SET_DEST(exp))))
- {
- return;
- }
-#endif
- /* Moving register or memory into a register:
- it doesn't alter the cc's, but it might invalidate
- the RTX's which we remember the cc's came from.
- (Note that moving a constant 0 or 1 MAY set the cc's). */
- if (REG_P (SET_DEST (exp))
- && (REG_P (SET_SRC (exp)) || GET_CODE (SET_SRC (exp)) == MEM
- || GET_RTX_CLASS (GET_CODE (SET_SRC (exp))) == '<'))
- {
- if (cc_status.value1
- && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value1))
- cc_status.value1 = 0;
- if (cc_status.value2
- && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2))
- cc_status.value2 = 0;
- return;
- }
- /* Moving register into memory doesn't alter the cc's.
- It may invalidate the RTX's which we remember the cc's came from. */
- if (GET_CODE (SET_DEST (exp)) == MEM
- && (REG_P (SET_SRC (exp))
- || GET_RTX_CLASS (GET_CODE (SET_SRC (exp))) == '<'))
- {
- if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM
- || reg_mentioned_p (SET_DEST (exp), cc_status.value1))
- cc_status.value1 = 0;
- if (cc_status.value2 && GET_CODE (cc_status.value2) == MEM
- || reg_mentioned_p (SET_DEST (exp), cc_status.value2))
- cc_status.value2 = 0;
- return;
- }
- /* Function calls clobber the cc's. */
- else if (GET_CODE (SET_SRC (exp)) == CALL)
- {
- CC_STATUS_INIT;
- return;
- }
- /* Tests and compares set the cc's in predictable ways. */
- else if (SET_DEST (exp) == cc0_rtx)
- {
- CC_STATUS_INIT;
- cc_status.value1 = SET_SRC (exp);
- return;
- }
- /* Certain instructions effect the condition codes. */
- else if (GET_MODE (SET_SRC (exp)) == SImode
- || GET_MODE (SET_SRC (exp)) == HImode
- || GET_MODE (SET_SRC (exp)) == QImode)
- switch (GET_CODE (SET_SRC (exp)))
- {
- case ASHIFTRT: case LSHIFTRT:
- case ASHIFT:
- /* Shifts on the 386 don't set the condition codes if the
- shift count is zero. */
- if (GET_CODE (XEXP (SET_SRC (exp), 1)) != CONST_INT)
- {
- CC_STATUS_INIT;
- break;
- }
- /* We assume that the CONST_INT is non-zero (this rtx would
- have been deleted if it were zero. */
-
- case PLUS: case MINUS: case NEG:
- case AND: case IOR: case XOR:
- cc_status.flags = CC_NO_OVERFLOW;
- cc_status.value1 = SET_SRC (exp);
- cc_status.value2 = SET_DEST (exp);
- break;
-
- default:
- CC_STATUS_INIT;
- }
- else
- {
- CC_STATUS_INIT;
- }
- }
- else if (GET_CODE (exp) == PARALLEL
- && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
- {
- if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx)
- return;
- if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx)
- {
- CC_STATUS_INIT;
- if (stack_regs_mentioned_p (SET_SRC (XVECEXP (exp, 0, 0))))
- cc_status.flags |= CC_IN_80387;
- else
- cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0));
- return;
- }
- CC_STATUS_INIT;
- }
- else
- {
- CC_STATUS_INIT;
- }
-}
-
-/* Split one or more DImode RTL references into pairs of SImode
- references. The RTL can be REG, offsettable MEM, integer constant, or
- CONST_DOUBLE. "operands" is a pointer to an array of DImode RTL to
- split and "num" is its length. lo_half and hi_half are output arrays
- that parallel "operands". */
-
-void
-split_di (operands, num, lo_half, hi_half)
- rtx operands[];
- int num;
- rtx lo_half[], hi_half[];
-{
- while (num--)
- {
- if (GET_CODE (operands[num]) == REG)
- {
- lo_half[num] = gen_rtx (REG, SImode, REGNO (operands[num]));
- hi_half[num] = gen_rtx (REG, SImode, REGNO (operands[num]) + 1);
- }
- else if (CONSTANT_P (operands[num]))
- {
- split_double (operands[num], &lo_half[num], &hi_half[num]);
- }
- else if (offsettable_memref_p (operands[num]))
- {
- lo_half[num] = operands[num];
- hi_half[num] = adj_offsettable_operand (operands[num], 4);
- }
- else
- abort();
- }
-}
-
-/* Return 1 if this is a valid binary operation on a 387.
- OP is the expression matched, and MODE is its mode. */
-
-int
-binary_387_op (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (mode != VOIDmode && mode != GET_MODE (op))
- return 0;
-
- switch (GET_CODE (op))
- {
- case PLUS:
- case MINUS:
- case MULT:
- case DIV:
- return GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT;
-
- default:
- return 0;
- }
-}
-
-
-/* Return 1 if this is a valid shift or rotate operation on a 386.
- OP is the expression matched, and MODE is its mode. */
-
-int
-shift_op (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- rtx operand = XEXP (op, 0);
-
- if (mode != VOIDmode && mode != GET_MODE (op))
- return 0;
-
- if (GET_MODE (operand) != GET_MODE (op)
- || GET_MODE_CLASS (GET_MODE (op)) != MODE_INT)
- return 0;
-
- return (GET_CODE (op) == ASHIFT
- || GET_CODE (op) == ASHIFTRT
- || GET_CODE (op) == LSHIFTRT
- || GET_CODE (op) == ROTATE
- || GET_CODE (op) == ROTATERT);
-}
-
-/* Return 1 if OP is COMPARE rtx with mode VOIDmode.
- MODE is not used. */
-
-int
-VOIDmode_compare_op (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == COMPARE && GET_MODE (op) == VOIDmode;
-}
-
-/* Output code to perform a 387 binary operation in INSN, one of PLUS,
- MINUS, MULT or DIV. OPERANDS are the insn operands, where operands[3]
- is the expression of the binary operation. The output may either be
- emitted here, or returned to the caller, like all output_* functions.
-
- There is no guarantee that the operands are the same mode, as they
- might be within FLOAT or FLOAT_EXTEND expressions. */
-
-char *
-output_387_binary_op (insn, operands)
- rtx insn;
- rtx *operands;
-{
- rtx temp;
- char *base_op;
- static char buf[100];
-
- switch (GET_CODE (operands[3]))
- {
- case PLUS:
- if (GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
- || GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT)
- base_op = "fiadd";
- else
- base_op = "fadd";
- break;
-
- case MINUS:
- if (GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
- || GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT)
- base_op = "fisub";
- else
- base_op = "fsub";
- break;
-
- case MULT:
- if (GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
- || GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT)
- base_op = "fimul";
- else
- base_op = "fmul";
- break;
-
- case DIV:
- if (GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT
- || GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT)
- base_op = "fidiv";
- else
- base_op = "fdiv";
- break;
-
- default:
- abort ();
- }
-
- strcpy (buf, base_op);
-
- switch (GET_CODE (operands[3]))
- {
- case MULT:
- case PLUS:
- if (REG_P (operands[2]) && REGNO (operands[0]) == REGNO (operands[2]))
- {
- temp = operands[2];
- operands[2] = operands[1];
- operands[1] = temp;
- }
-
- if (GET_CODE (operands[2]) == MEM)
- return strcat (buf, AS1 (%z2,%2));
-
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], strcat (buf, AS1 (%z0,%1)));
- RET;
- }
- else if (NON_STACK_REG_P (operands[2]))
- {
- output_op_from_reg (operands[2], strcat (buf, AS1 (%z0,%1)));
- RET;
- }
-
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[2])))
- return strcat (buf, AS2 (p,%2,%0));
-
- if (STACK_TOP_P (operands[0]))
- return strcat (buf, AS2C (%y2,%0));
- else
- return strcat (buf, AS2C (%2,%0));
-
- case MINUS:
- case DIV:
- if (GET_CODE (operands[1]) == MEM)
- return strcat (buf, AS1 (r%z1,%1));
-
- if (GET_CODE (operands[2]) == MEM)
- return strcat (buf, AS1 (%z2,%2));
-
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], strcat (buf, AS1 (r%z0,%1)));
- RET;
- }
- else if (NON_STACK_REG_P (operands[2]))
- {
- output_op_from_reg (operands[2], strcat (buf, AS1 (%z0,%1)));
- RET;
- }
-
- if (! STACK_REG_P (operands[1]) || ! STACK_REG_P (operands[2]))
- abort ();
-
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[2])))
- return strcat (buf, AS2 (rp,%2,%0));
-
- if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return strcat (buf, AS2 (p,%1,%0));
-
- if (STACK_TOP_P (operands[0]))
- {
- if (STACK_TOP_P (operands[1]))
- return strcat (buf, AS2C (%y2,%0));
- else
- return strcat (buf, AS2 (r,%y1,%0));
- }
- else if (STACK_TOP_P (operands[1]))
- return strcat (buf, AS2C (%1,%0));
- else
- return strcat (buf, AS2 (r,%2,%0));
-
- default:
- abort ();
- }
-}
-
-/* Output code for INSN to convert a float to a signed int. OPERANDS
- are the insn operands. The output may be SFmode or DFmode and the
- input operand may be SImode or DImode. As a special case, make sure
- that the 387 stack top dies if the output mode is DImode, because the
- hardware requires this. */
-
-char *
-output_fix_trunc (insn, operands)
- rtx insn;
- rtx *operands;
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
- rtx xops[2];
-
- if (! STACK_TOP_P (operands[1]) ||
- (GET_MODE (operands[0]) == DImode && ! stack_top_dies))
- abort ();
-
- xops[0] = GEN_INT (12);
- xops[1] = operands[4];
-
- output_asm_insn (AS1 (fnstc%W2,%2), operands);
- output_asm_insn (AS2 (mov%L2,%2,%4), operands);
- output_asm_insn (AS2 (mov%B1,%0,%h1), xops);
- output_asm_insn (AS2 (mov%L4,%4,%3), operands);
- output_asm_insn (AS1 (fldc%W3,%3), operands);
-
- if (NON_STACK_REG_P (operands[0]))
- output_to_reg (operands[0], stack_top_dies);
- else if (GET_CODE (operands[0]) == MEM)
- {
- if (stack_top_dies)
- output_asm_insn (AS1 (fistp%z0,%0), operands);
- else
- output_asm_insn (AS1 (fist%z0,%0), operands);
- }
- else
- abort ();
-
- return AS1 (fldc%W2,%2);
-}
-
-/* Output code for INSN to compare OPERANDS. The two operands might
- not have the same mode: one might be within a FLOAT or FLOAT_EXTEND
- expression. If the compare is in mode CCFPEQmode, use an opcode that
- will not fault if a qNaN is present. */
-
-char *
-output_float_compare (insn, operands)
- rtx insn;
- rtx *operands;
-{
- int stack_top_dies;
- rtx body = XVECEXP (PATTERN (insn), 0, 0);
- int unordered_compare = GET_MODE (SET_SRC (body)) == CCFPEQmode;
- rtx tmp;
-
- if (TARGET_CMOVE && STACK_REG_P (operands[1]))
- {
- cc_status.flags |= CC_FCOMI;
- cc_prev_status.flags &= ~CC_TEST_AX;
- }
-
- if (! STACK_TOP_P (operands[0]))
- {
- tmp = operands[0];
- operands[0] = operands[1];
- operands[1] = tmp;
- cc_status.flags |= CC_REVERSED;
- }
-
- if (! STACK_TOP_P (operands[0]))
- abort ();
-
- stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- if (STACK_REG_P (operands[1])
- && stack_top_dies
- && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))
- && REGNO (operands[1]) != FIRST_STACK_REG)
- {
- /* If both the top of the 387 stack dies, and the other operand
- is also a stack register that dies, then this must be a
- `fcompp' float compare */
-
- if (unordered_compare)
- output_asm_insn ("fucompp", operands);
- else
- output_asm_insn ("fcompp", operands);
- }
- else
- {
- static char buf[100];
-
- /* Decide if this is the integer or float compare opcode, or the
- unordered float compare. */
-
- if (unordered_compare)
- strcpy (buf, (cc_status.flags & CC_FCOMI) ? "fucomi" : "fucom");
- else if (GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_FLOAT)
- strcpy (buf, (cc_status.flags & CC_FCOMI) ? "fcomi" : "fcom");
- else
- strcpy (buf, "ficom");
-
- /* Modify the opcode if the 387 stack is to be popped. */
-
- if (stack_top_dies)
- strcat (buf, "p");
-
- if (NON_STACK_REG_P (operands[1]))
- output_op_from_reg (operands[1], strcat (buf, AS1 (%z0,%1)));
- else if (cc_status.flags & CC_FCOMI)
- {
- rtx xops[3];
-
- xops[0] = operands[0];
- xops[1] = operands[1];
- xops[2] = operands[0];
-
- output_asm_insn (strcat (buf, AS2 (%z1,%y1,%2)), xops);
- RET;
- }
- else
- output_asm_insn (strcat (buf, AS1 (%z1,%y1)), operands);
- }
-
- /* Now retrieve the condition code. */
-
- return output_fp_cc0_set (insn);
-}
-
-/* Output opcodes to transfer the results of FP compare or test INSN
- from the FPU to the CPU flags. If TARGET_IEEE_FP, ensure that if the
- result of the compare or test is unordered, no comparison operator
- succeeds except NE. Return an output template, if any. */
-
-char *
-output_fp_cc0_set (insn)
- rtx insn;
-{
- rtx xops[3];
- rtx unordered_label;
- rtx next;
- enum rtx_code code;
-
- xops[0] = gen_rtx (REG, HImode, 0);
- output_asm_insn (AS1 (fnsts%W0,%0), xops);
-
- if (! TARGET_IEEE_FP)
- {
- if (!(cc_status.flags & CC_REVERSED))
- {
- next = next_cc0_user (insn);
-
- if (GET_CODE (next) == JUMP_INSN
- && GET_CODE (PATTERN (next)) == SET
- && SET_DEST (PATTERN (next)) == pc_rtx
- && GET_CODE (SET_SRC (PATTERN (next))) == IF_THEN_ELSE)
- {
- code = GET_CODE (XEXP (SET_SRC (PATTERN (next)), 0));
- }
- else if (GET_CODE (PATTERN (next)) == SET)
- {
- code = GET_CODE (SET_SRC (PATTERN (next)));
- }
- else
- {
- return "sahf";
- }
- if (code == GT || code == LT || code == EQ || code == NE
- || code == LE || code == GE)
- { /* We will test eax directly */
- cc_status.flags |= CC_TEST_AX;
- RET;
- }
- }
- return "sahf";
- }
-
- next = next_cc0_user (insn);
- if (next == NULL_RTX)
- abort ();
-
- if (GET_CODE (next) == JUMP_INSN
- && GET_CODE (PATTERN (next)) == SET
- && SET_DEST (PATTERN (next)) == pc_rtx
- && GET_CODE (SET_SRC (PATTERN (next))) == IF_THEN_ELSE)
- {
- code = GET_CODE (XEXP (SET_SRC (PATTERN (next)), 0));
- }
- else if (GET_CODE (PATTERN (next)) == SET)
- {
- if (GET_CODE (SET_SRC (PATTERN (next))) == IF_THEN_ELSE)
- code = GET_CODE (XEXP (SET_SRC (PATTERN (next)), 0));
- else code = GET_CODE (SET_SRC (PATTERN (next)));
- }
- else if (GET_CODE (PATTERN (next)) == PARALLEL
- && GET_CODE (XVECEXP (PATTERN (next), 0, 0)) == SET)
- {
- if (GET_CODE (SET_SRC (XVECEXP (PATTERN (next), 0, 0))) == IF_THEN_ELSE)
- code = GET_CODE (XEXP (SET_SRC (XVECEXP (PATTERN (next), 0, 0)), 0));
- else code = GET_CODE (SET_SRC (XVECEXP (PATTERN (next), 0, 0)));
- }
- else
- abort ();
-
- xops[0] = gen_rtx (REG, QImode, 0);
-
- switch (code)
- {
- case GT:
- xops[1] = GEN_INT (0x45);
- output_asm_insn (AS2 (and%B0,%1,%h0), xops);
- /* je label */
- break;
-
- case LT:
- xops[1] = GEN_INT (0x45);
- xops[2] = GEN_INT (0x01);
- output_asm_insn (AS2 (and%B0,%1,%h0), xops);
- output_asm_insn (AS2 (cmp%B0,%2,%h0), xops);
- /* je label */
- break;
-
- case GE:
- xops[1] = GEN_INT (0x05);
- output_asm_insn (AS2 (and%B0,%1,%h0), xops);
- /* je label */
- break;
-
- case LE:
- xops[1] = GEN_INT (0x45);
- xops[2] = GEN_INT (0x40);
- output_asm_insn (AS2 (and%B0,%1,%h0), xops);
- output_asm_insn (AS1 (dec%B0,%h0), xops);
- output_asm_insn (AS2 (cmp%B0,%2,%h0), xops);
- /* jb label */
- break;
-
- case EQ:
- xops[1] = GEN_INT (0x45);
- xops[2] = GEN_INT (0x40);
- output_asm_insn (AS2 (and%B0,%1,%h0), xops);
- output_asm_insn (AS2 (cmp%B0,%2,%h0), xops);
- /* je label */
- break;
-
- case NE:
- xops[1] = GEN_INT (0x44);
- xops[2] = GEN_INT (0x40);
- output_asm_insn (AS2 (and%B0,%1,%h0), xops);
- output_asm_insn (AS2 (xor%B0,%2,%h0), xops);
- /* jne label */
- break;
-
- case GTU:
- case LTU:
- case GEU:
- case LEU:
- default:
- abort ();
- }
- RET;
-}
-
-#define MAX_386_STACK_LOCALS 2
-
-static rtx i386_stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS];
-
-/* Define the structure for the machine field in struct function. */
-struct machine_function
-{
- rtx i386_stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS];
-};
-
-/* Functions to save and restore i386_stack_locals.
- These will be called, via pointer variables,
- from push_function_context and pop_function_context. */
-
-void
-save_386_machine_status (p)
- struct function *p;
-{
- p->machine = (struct machine_function *) xmalloc (sizeof i386_stack_locals);
- bcopy ((char *) i386_stack_locals, (char *) p->machine->i386_stack_locals,
- sizeof i386_stack_locals);
-}
-
-void
-restore_386_machine_status (p)
- struct function *p;
-{
- bcopy ((char *) p->machine->i386_stack_locals, (char *) i386_stack_locals,
- sizeof i386_stack_locals);
- free (p->machine);
-}
-
-/* Clear stack slot assignments remembered from previous functions.
- This is called from INIT_EXPANDERS once before RTL is emitted for each
- function. */
-
-void
-clear_386_stack_locals ()
-{
- enum machine_mode mode;
- int n;
-
- for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
- mode = (enum machine_mode) ((int) mode + 1))
- for (n = 0; n < MAX_386_STACK_LOCALS; n++)
- i386_stack_locals[(int) mode][n] = NULL_RTX;
-
- /* Arrange to save and restore i386_stack_locals around nested functions. */
- save_machine_status = save_386_machine_status;
- restore_machine_status = restore_386_machine_status;
-}
-
-/* Return a MEM corresponding to a stack slot with mode MODE.
- Allocate a new slot if necessary.
-
- The RTL for a function can have several slots available: N is
- which slot to use. */
-
-rtx
-assign_386_stack_local (mode, n)
- enum machine_mode mode;
- int n;
-{
- if (n < 0 || n >= MAX_386_STACK_LOCALS)
- abort ();
-
- if (i386_stack_locals[(int) mode][n] == NULL_RTX)
- i386_stack_locals[(int) mode][n]
- = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
-
- return i386_stack_locals[(int) mode][n];
-}
-
-
-int is_mul(op,mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == MULT);
-}
-
-int is_div(op,mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == DIV);
-}
-
-
-#ifdef NOTYET
-/* Create a new copy of an rtx.
- Recursively copies the operands of the rtx,
- except for those few rtx codes that are sharable.
- Doesn't share CONST */
-
-rtx
-copy_all_rtx (orig)
- register rtx orig;
-{
- register rtx copy;
- register int i, j;
- register RTX_CODE code;
- register char *format_ptr;
-
- code = GET_CODE (orig);
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case SCRATCH:
- /* SCRATCH must be shared because they represent distinct values. */
- return orig;
-
-#if 0
- case CONST:
- /* CONST can be shared if it contains a SYMBOL_REF. If it contains
- a LABEL_REF, it isn't sharable. */
- if (GET_CODE (XEXP (orig, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
- return orig;
- break;
-#endif
- /* A MEM with a constant address is not sharable. The problem is that
- the constant address may need to be reloaded. If the mem is shared,
- then reloading one copy of this mem will cause all copies to appear
- to have been reloaded. */
- }
-
- copy = rtx_alloc (code);
- PUT_MODE (copy, GET_MODE (orig));
- copy->in_struct = orig->in_struct;
- copy->volatil = orig->volatil;
- copy->unchanging = orig->unchanging;
- copy->integrated = orig->integrated;
- /* intel1 */
- copy->is_spill_rtx = orig->is_spill_rtx;
-
- format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- XEXP (copy, i) = XEXP (orig, i);
- if (XEXP (orig, i) != NULL)
- XEXP (copy, i) = copy_rtx (XEXP (orig, i));
- break;
-
- case '0':
- case 'u':
- XEXP (copy, i) = XEXP (orig, i);
- break;
-
- case 'E':
- case 'V':
- XVEC (copy, i) = XVEC (orig, i);
- if (XVEC (orig, i) != NULL)
- {
- XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
- for (j = 0; j < XVECLEN (copy, i); j++)
- XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j));
- }
- break;
-
- case 'w':
- XWINT (copy, i) = XWINT (orig, i);
- break;
-
- case 'i':
- XINT (copy, i) = XINT (orig, i);
- break;
-
- case 's':
- case 'S':
- XSTR (copy, i) = XSTR (orig, i);
- break;
-
- default:
- abort ();
- }
- }
- return copy;
-}
-
-
-/* try to rewrite a memory address to make it valid */
-void
-rewrite_address (mem_rtx)
- rtx mem_rtx;
-{
- rtx index_rtx, base_rtx, offset_rtx, scale_rtx, ret_rtx;
- int scale = 1;
- int offset_adjust = 0;
- int was_only_offset = 0;
- rtx mem_addr = XEXP (mem_rtx, 0);
- char *storage = (char *) oballoc (0);
- int in_struct = 0;
- int is_spill_rtx = 0;
-
- in_struct = MEM_IN_STRUCT_P (mem_rtx);
- is_spill_rtx = RTX_IS_SPILL_P (mem_rtx);
-
- if (GET_CODE (mem_addr) == PLUS &&
- GET_CODE (XEXP (mem_addr, 1)) == PLUS &&
- GET_CODE (XEXP (XEXP (mem_addr, 1), 0)) == REG)
- { /* this part is utilized by the combiner */
- ret_rtx =
- gen_rtx (PLUS, GET_MODE (mem_addr),
- gen_rtx (PLUS, GET_MODE (XEXP (mem_addr, 1)),
- XEXP (mem_addr, 0),
- XEXP (XEXP (mem_addr, 1), 0)),
- XEXP (XEXP (mem_addr, 1), 1));
- if (memory_address_p (GET_MODE (mem_rtx), ret_rtx))
- {
- XEXP (mem_rtx, 0) = ret_rtx;
- RTX_IS_SPILL_P (ret_rtx) = is_spill_rtx;
- return;
- }
- obfree (storage);
- }
-
- /* this part is utilized by loop.c */
- /* If the address contains PLUS (reg,const) and this pattern is invalid
- in this case - try to rewrite the address to make it valid intel1
- */
- storage = (char *) oballoc (0);
- index_rtx = base_rtx = offset_rtx = NULL;
- /* find the base index and offset elements of the memory address */
- if (GET_CODE (mem_addr) == PLUS)
- {
- if (GET_CODE (XEXP (mem_addr, 0)) == REG)
- {
- if (GET_CODE (XEXP (mem_addr, 1)) == REG)
- {
- base_rtx = XEXP (mem_addr, 1);
- index_rtx = XEXP (mem_addr, 0);
- }
- else
- {
- base_rtx = XEXP (mem_addr, 0);
- offset_rtx = XEXP (mem_addr, 1);
- }
- }
- else if (GET_CODE (XEXP (mem_addr, 0)) == MULT)
- {
- index_rtx = XEXP (mem_addr, 0);
- if (GET_CODE (XEXP (mem_addr, 1)) == REG)
- {
- base_rtx = XEXP (mem_addr, 1);
- }
- else
- {
- offset_rtx = XEXP (mem_addr, 1);
- }
- }
- else if (GET_CODE (XEXP (mem_addr, 0)) == PLUS)
- {
- /* intel1 */
- if (GET_CODE (XEXP (XEXP (mem_addr, 0), 0)) == PLUS &&
- GET_CODE (XEXP (XEXP (XEXP (mem_addr, 0), 0), 0)) == MULT &&
- GET_CODE (XEXP (XEXP (XEXP (XEXP (mem_addr, 0), 0), 0), 0)) == REG &&
- GET_CODE (XEXP (XEXP (XEXP (XEXP (mem_addr, 0), 0), 0), 1)) == CONST_INT &&
- GET_CODE (XEXP (XEXP (XEXP (mem_addr, 0), 0), 1)) == CONST_INT &&
- GET_CODE (XEXP (XEXP (mem_addr, 0), 1)) == REG &&
- GET_CODE (XEXP (mem_addr, 1)) == SYMBOL_REF)
- {
- index_rtx = XEXP (XEXP (XEXP (mem_addr, 0), 0), 0);
- offset_rtx = XEXP (mem_addr, 1);
- base_rtx = XEXP (XEXP (mem_addr, 0), 1);
- offset_adjust = INTVAL (XEXP (XEXP (XEXP (mem_addr, 0), 0), 1));
- }
- else
- {
- offset_rtx = XEXP (mem_addr, 1);
- index_rtx = XEXP (XEXP (mem_addr, 0), 0);
- base_rtx = XEXP (XEXP (mem_addr, 0), 1);
- }
- }
- else if (GET_CODE (XEXP (mem_addr, 0)) == CONST_INT)
- {
- was_only_offset = 1;
- index_rtx = NULL;
- base_rtx = NULL;
- offset_rtx = XEXP (mem_addr, 1);
- offset_adjust = INTVAL (XEXP (mem_addr, 0));
- if (offset_adjust == 0)
- {
- XEXP (mem_rtx, 0) = offset_rtx;
- RTX_IS_SPILL_P (XEXP (mem_rtx, 0)) = is_spill_rtx;
- return;
- }
- }
- else
- {
- obfree (storage);
- return;
- }
- }
- else if (GET_CODE (mem_addr) == MULT)
- {
- index_rtx = mem_addr;
- }
- else
- {
- obfree (storage);
- return;
- }
- if (index_rtx && GET_CODE (index_rtx) == MULT)
- {
- if (GET_CODE (XEXP (index_rtx, 1)) != CONST_INT)
- {
- obfree (storage);
- return;
- }
- scale_rtx = XEXP (index_rtx, 1);
- scale = INTVAL (scale_rtx);
- index_rtx = copy_all_rtx (XEXP (index_rtx, 0));
- }
- /* now find which of the elements are invalid and try to fix them */
- if (index_rtx && GET_CODE (index_rtx) == CONST_INT && base_rtx == NULL)
- {
- offset_adjust = INTVAL (index_rtx) * scale;
- if (offset_rtx && GET_CODE (offset_rtx) == CONST &&
- GET_CODE (XEXP (offset_rtx, 0)) == PLUS)
- {
- if (GET_CODE (XEXP (XEXP (offset_rtx, 0), 0)) == SYMBOL_REF &&
- GET_CODE (XEXP (XEXP (offset_rtx, 0), 1)) == CONST_INT)
- {
- offset_rtx = copy_all_rtx (offset_rtx);
- XEXP (XEXP (offset_rtx, 0), 1) =
- gen_rtx (CONST_INT, 0, INTVAL (XEXP (XEXP (offset_rtx, 0), 1)) + offset_adjust);
- if (!CONSTANT_P (offset_rtx))
- {
- obfree (storage);
- return;
- }
- }
- }
- else if (offset_rtx && GET_CODE (offset_rtx) == SYMBOL_REF)
- {
- offset_rtx =
- gen_rtx (CONST, GET_MODE (offset_rtx),
- gen_rtx (PLUS, GET_MODE (offset_rtx),
- offset_rtx,
- gen_rtx (CONST_INT, 0, offset_adjust)));
- if (!CONSTANT_P (offset_rtx))
- {
- obfree (storage);
- return;
- }
- }
- else if (offset_rtx && GET_CODE (offset_rtx) == CONST_INT)
- {
- offset_rtx = gen_rtx (CONST_INT, 0, INTVAL (offset_rtx) + offset_adjust);
- }
- else if (!offset_rtx)
- {
- offset_rtx = gen_rtx (CONST_INT, 0, 0);
- }
- RTX_IS_SPILL_P (XEXP (mem_rtx, 0)) = is_spill_rtx;
- XEXP (mem_rtx, 0) = offset_rtx;
- return;
- }
- if (base_rtx && GET_CODE (base_rtx) == PLUS &&
- GET_CODE (XEXP (base_rtx, 0)) == REG &&
- GET_CODE (XEXP (base_rtx, 1)) == CONST_INT)
- {
- offset_adjust += INTVAL (XEXP (base_rtx, 1));
- base_rtx = copy_all_rtx (XEXP (base_rtx, 0));
- }
- else if (base_rtx && GET_CODE (base_rtx) == CONST_INT)
- {
- offset_adjust += INTVAL (base_rtx);
- base_rtx = NULL;
- }
- if (index_rtx && GET_CODE (index_rtx) == PLUS &&
- GET_CODE (XEXP (index_rtx, 0)) == REG &&
- GET_CODE (XEXP (index_rtx, 1)) == CONST_INT)
- {
- offset_adjust += INTVAL (XEXP (index_rtx, 1)) * scale;
- index_rtx = copy_all_rtx (XEXP (index_rtx, 0));
- }
- if (index_rtx)
- {
- if (!LEGITIMATE_INDEX_P (index_rtx)
- && !(index_rtx == stack_pointer_rtx && scale == 1 && base_rtx == NULL))
- {
- obfree (storage);
- return;
- }
- }
- if (base_rtx)
- {
- if (!LEGITIMATE_INDEX_P (base_rtx) && GET_CODE (base_rtx) != REG)
- {
- obfree (storage);
- return;
- }
- }
- if (offset_adjust != 0)
- {
- if (offset_rtx)
- {
- if (GET_CODE (offset_rtx) == CONST &&
- GET_CODE (XEXP (offset_rtx, 0)) == PLUS)
- {
- if (GET_CODE (XEXP (XEXP (offset_rtx, 0), 0)) == SYMBOL_REF &&
- GET_CODE (XEXP (XEXP (offset_rtx, 0), 1)) == CONST_INT)
- {
- offset_rtx = copy_all_rtx (offset_rtx);
- XEXP (XEXP (offset_rtx, 0), 1) =
- gen_rtx (CONST_INT, 0, INTVAL (XEXP (XEXP (offset_rtx, 0), 1)) + offset_adjust);
- if (!CONSTANT_P (offset_rtx))
- {
- obfree (storage);
- return;
- }
- }
- }
- else if (GET_CODE (offset_rtx) == SYMBOL_REF)
- {
- offset_rtx =
- gen_rtx (CONST, GET_MODE (offset_rtx),
- gen_rtx (PLUS, GET_MODE (offset_rtx),
- offset_rtx,
- gen_rtx (CONST_INT, 0, offset_adjust)));
- if (!CONSTANT_P (offset_rtx))
- {
- obfree (storage);
- return;
- }
- }
- else if (GET_CODE (offset_rtx) == CONST_INT)
- {
- offset_rtx = gen_rtx (CONST_INT, 0, INTVAL (offset_rtx) + offset_adjust);
- }
- else
- {
- obfree (storage);
- return;
- }
- }
- else
- {
- offset_rtx = gen_rtx (CONST_INT, 0, offset_adjust);
- }
- if (index_rtx)
- {
- if (base_rtx)
- {
- if (scale != 1)
- {
- if (GET_CODE (offset_rtx) == CONST_INT &&
- INTVAL (offset_rtx) == 0)
- {
- ret_rtx = gen_rtx (PLUS, GET_MODE (base_rtx),
- gen_rtx (MULT, GET_MODE (index_rtx), index_rtx,
- scale_rtx),
- base_rtx);
- }
- else
- {
- ret_rtx = gen_rtx (PLUS, GET_MODE (offset_rtx),
- gen_rtx (PLUS, GET_MODE (base_rtx),
- gen_rtx (MULT, GET_MODE (index_rtx), index_rtx,
- scale_rtx),
- base_rtx),
- offset_rtx);
- }
- }
- else
- {
- if (GET_CODE (offset_rtx) == CONST_INT &&
- INTVAL (offset_rtx) == 0)
- {
- ret_rtx = gen_rtx (PLUS, GET_MODE (index_rtx), index_rtx, base_rtx);
- }
- else
- {
- ret_rtx = gen_rtx (PLUS, GET_MODE (offset_rtx),
- gen_rtx (PLUS, GET_MODE (index_rtx), index_rtx,
- base_rtx),
- offset_rtx);
- }
- }
- }
- else
- {
- if (scale != 1)
- {
- if (GET_CODE (offset_rtx) == CONST_INT &&
- INTVAL (offset_rtx) == 0)
- {
- ret_rtx = gen_rtx (MULT, GET_MODE (index_rtx), index_rtx, scale_rtx);
- }
- else
- {
- ret_rtx =
- gen_rtx (PLUS, GET_MODE (offset_rtx),
- gen_rtx (MULT, GET_MODE (index_rtx), index_rtx,
- scale_rtx),
- offset_rtx);
- }
- }
- else
- {
- if (GET_CODE (offset_rtx) == CONST_INT &&
- INTVAL (offset_rtx) == 0)
- {
- ret_rtx = index_rtx;
- }
- else
- {
- ret_rtx = gen_rtx (PLUS, GET_MODE (index_rtx), index_rtx, offset_rtx);
- }
- }
- }
- }
- else
- {
- if (base_rtx)
- {
- if (GET_CODE (offset_rtx) == CONST_INT &&
- INTVAL (offset_rtx) == 0)
- {
- ret_rtx = base_rtx;
- }
- else
- {
- ret_rtx = gen_rtx (PLUS, GET_MODE (base_rtx), base_rtx, offset_rtx);
- }
- }
- else if (was_only_offset)
- {
- ret_rtx = offset_rtx;
- }
- else
- {
- obfree (storage);
- return;
- }
- }
- XEXP (mem_rtx, 0) = ret_rtx;
- RTX_IS_SPILL_P (XEXP (mem_rtx, 0)) = is_spill_rtx;
- return;
- }
- else
- {
- obfree (storage);
- return;
- }
-}
-#endif /* NOTYET */
-
-
-/* return 1 if the first insn to set cc before insn also sets the register
- reg_rtx - otherwise return 0 */
-int
-last_to_set_cc (reg_rtx, insn)
- rtx reg_rtx, insn;
-{
- rtx prev_insn = PREV_INSN (insn);
-
- while (prev_insn)
- {
- if (GET_CODE (prev_insn) == NOTE)
- ;
-
- else if (GET_CODE (prev_insn) == INSN)
- {
- if (GET_CODE (PATTERN (prev_insn)) != SET)
- return (0);
-
- if (rtx_equal_p (SET_DEST (PATTERN (prev_insn)), reg_rtx))
- {
- if (sets_condition_code (SET_SRC (PATTERN (prev_insn))))
- return (1);
-
- return (0);
- }
-
- else if (!doesnt_set_condition_code (SET_SRC (PATTERN (prev_insn))))
- return (0);
- }
-
- else
- return (0);
-
- prev_insn = PREV_INSN (prev_insn);
- }
-
- return (0);
-}
-
-
-int
-doesnt_set_condition_code (pat)
- rtx pat;
-{
- switch (GET_CODE (pat))
- {
- case MEM:
- case REG:
- return (1);
-
- default:
- return (0);
-
- }
-}
-
-
-int
-sets_condition_code (pat)
- rtx pat;
-{
- switch (GET_CODE (pat))
- {
- case PLUS:
- case MINUS:
- case AND:
- case IOR:
- case XOR:
- case NOT:
- case NEG:
- case MULT:
- case DIV:
- case MOD:
- case UDIV:
- case UMOD:
- return (1);
-
- default:
- return (0);
-
- }
-}
-
-
-int
-str_immediate_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT && INTVAL (op) <= 32 && INTVAL (op) >= 0)
- {
- return (1);
- }
- return (0);
-}
-
-
-int
-is_fp_insn (insn)
- rtx insn;
-{
- if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET
- && (GET_MODE (SET_DEST (PATTERN (insn))) == DFmode
- || GET_MODE (SET_DEST (PATTERN (insn))) == SFmode
- || GET_MODE (SET_DEST (PATTERN (insn))) == XFmode))
- {
- return (1);
- }
-
- return (0);
-}
-
-/*
- Return 1 if the mode of the SET_DEST of insn is floating point
- and it is not an fld or a move from memory to memory.
- Otherwise return 0 */
-int
-is_fp_dest (insn)
- rtx insn;
-{
- if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET
- && (GET_MODE (SET_DEST (PATTERN (insn))) == DFmode
- || GET_MODE (SET_DEST (PATTERN (insn))) == SFmode
- || GET_MODE (SET_DEST (PATTERN (insn))) == XFmode)
- && GET_CODE (SET_DEST (PATTERN (insn))) == REG
- && REGNO (SET_DEST (PATTERN (insn))) >= FIRST_FLOAT_REG
- && GET_CODE (SET_SRC (insn)) != MEM)
- {
- return (1);
- }
-
- return (0);
-}
-
-/*
- Return 1 if the mode of the SET_DEST floating point and is memory
- and the source is a register.
-*/
-int
-is_fp_store (insn)
- rtx insn;
-{
- if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET
- && (GET_MODE (SET_DEST (PATTERN (insn))) == DFmode
- || GET_MODE (SET_DEST (PATTERN (insn))) == SFmode
- || GET_MODE (SET_DEST (PATTERN (insn))) == XFmode)
- && GET_CODE (SET_DEST (PATTERN (insn))) == MEM
- && GET_CODE (SET_SRC (PATTERN (insn))) == REG)
- {
- return (1);
- }
-
- return (0);
-}
-
-
-/*
- Return 1 if dep_insn sets a register which insn uses as a base
- or index to reference memory.
- otherwise return 0 */
-
-int
-agi_dependent (insn, dep_insn)
- rtx insn, dep_insn;
-{
- if (GET_CODE (dep_insn) == INSN
- && GET_CODE (PATTERN (dep_insn)) == SET
- && GET_CODE (SET_DEST (PATTERN (dep_insn))) == REG)
- {
- return (reg_mentioned_in_mem (SET_DEST (PATTERN (dep_insn)), insn));
- }
-
- if (GET_CODE (dep_insn) == INSN && GET_CODE (PATTERN (dep_insn)) == SET
- && GET_CODE (SET_DEST (PATTERN (dep_insn))) == MEM
- && push_operand (SET_DEST (PATTERN (dep_insn)),
- GET_MODE (SET_DEST (PATTERN (dep_insn)))))
- {
- return (reg_mentioned_in_mem (stack_pointer_rtx, insn));
- }
-
- return (0);
-}
-
-
-/*
- Return 1 if reg is used in rtl as a base or index for a memory ref
- otherwise return 0. */
-
-int
-reg_mentioned_in_mem (reg, rtl)
- rtx reg, rtl;
-{
- register char *fmt;
- register int i;
- register enum rtx_code code;
-
- if (rtl == NULL)
- return (0);
-
- code = GET_CODE (rtl);
-
- switch (code)
- {
- case HIGH:
- case CONST_INT:
- case CONST:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- case PC:
- case CC0:
- case SUBREG:
- return (0);
-
-
- }
-
- if (code == MEM && reg_mentioned_p (reg, rtl))
- return (1);
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (rtl, i) - 1; j >= 0; j--)
- {
- if (reg_mentioned_in_mem (reg, XVECEXP (rtl, i, j)))
- return 1;
- }
- }
-
- else if (fmt[i] == 'e' && reg_mentioned_in_mem (reg, XEXP (rtl, i)))
- return 1;
- }
-
- return (0);
-}
-
-/* Output the approprate insns for doing strlen if not just doing repnz; scasb
-
- operands[0] = result, initialized with the startaddress
- operands[1] = alignment of the address.
- operands[2] = scratch register, initialized with the startaddress when
- not aligned, otherwise undefined
-
- This is just the body. It needs the initialisations mentioned above and
- some address computing at the end. These things are done in i386.md. */
-
-char *
-output_strlen_unroll (operands)
- rtx operands[];
-{
- rtx xops[18];
-
- xops[0] = operands[0]; /* Result */
- /* operands[1]; * Alignment */
- xops[1] = operands[2]; /* Scratch */
- xops[2] = GEN_INT (0);
- xops[3] = GEN_INT (2);
- xops[4] = GEN_INT (3);
- xops[5] = GEN_INT (4);
- /* xops[6] = gen_label_rtx (); * label when aligned to 3-byte */
- /* xops[7] = gen_label_rtx (); * label when aligned to 2-byte */
- xops[8] = gen_label_rtx (); /* label of main loop */
- if(TARGET_USE_Q_REG && QI_REG_P (xops[1]))
- xops[9] = gen_label_rtx (); /* pentium optimisation */
- xops[10] = gen_label_rtx (); /* end label 2 */
- xops[11] = gen_label_rtx (); /* end label 1 */
- xops[12] = gen_label_rtx (); /* end label */
- /* xops[13] * Temporary used */
- xops[14] = GEN_INT (0xff);
- xops[15] = GEN_INT (0xff00);
- xops[16] = GEN_INT (0xff0000);
- xops[17] = GEN_INT (0xff000000);
-
- /* Loop to check 1..3 bytes for null to get an aligned pointer */
-
- /* is there a known alignment and is it less then 4 */
- if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) < 4)
- {
- /* is there a known alignment and is it not 2 */
- if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 2)
- {
- xops[6] = gen_label_rtx (); /* label when aligned to 3-byte */
- xops[7] = gen_label_rtx (); /* label when aligned to 2-byte */
-
- /* leave just the 3 lower bits */
- /* if this is a q-register, then the high part is used later */
- /* therefore user andl rather than andb */
- output_asm_insn (AS2 (and%L1,%4,%1), xops);
- /* is aligned to 4-byte adress when zero */
- output_asm_insn (AS1 (je,%l8), xops);
- /* side-effect even Parity when %eax == 3 */
- output_asm_insn (AS1 (jp,%6), xops);
-
- /* is it aligned to 2 bytes ? */
- if (QI_REG_P (xops[1]))
- output_asm_insn (AS2 (cmp%L1,%3,%1), xops);
- else
- output_asm_insn (AS2 (cmp%L1,%3,%1), xops);
- output_asm_insn (AS1 (je,%7), xops);
- }
- else
- {
- /* since the alignment is 2, we have to check 2 or 0 bytes */
-
- /* check if is aligned to 4 - byte */
- output_asm_insn (AS2 (and%L1,%3,%1), xops);
- /* is aligned to 4-byte adress when zero */
- output_asm_insn (AS1 (je,%l8), xops);
- }
-
- xops[13] = gen_rtx (MEM, QImode, xops[0]);
- /* now, compare the bytes */
- /* compare with the high part of a q-reg gives shorter code */
- if (QI_REG_P (xops[1]))
- {
- /* compare the first n unaligned byte on a byte per byte basis */
- output_asm_insn (AS2 (cmp%B1,%h1,%13), xops);
- /* when zero we reached the end */
- output_asm_insn (AS1 (je,%l12), xops);
- /* increment the address */
- output_asm_insn (AS1 (inc%L0,%0), xops);
-
- /* not needed with an alignment of 2 */
- if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 2)
- {
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[7]));
- output_asm_insn (AS2 (cmp%B1,%h1,%13), xops);
- output_asm_insn (AS1 (je,%l12), xops);
- output_asm_insn (AS1 (inc%L0,%0), xops);
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[6]));
- }
- output_asm_insn (AS2 (cmp%B1,%h1,%13), xops);
- }
- else
- {
- output_asm_insn (AS2 (cmp%B13,%2,%13), xops);
- output_asm_insn (AS1 (je,%l12), xops);
- output_asm_insn (AS1 (inc%L0,%0), xops);
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[7]));
- output_asm_insn (AS2 (cmp%B13,%2,%13), xops);
- output_asm_insn (AS1 (je,%l12), xops);
- output_asm_insn (AS1 (inc%L0,%0), xops);
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[6]));
- output_asm_insn (AS2 (cmp%B13,%2,%13), xops);
- }
- output_asm_insn (AS1 (je,%l12), xops);
- output_asm_insn (AS1 (inc%L0,%0), xops);
- }
-
- /* Generate loop to check 4 bytes at a time */
- /* IMHO it is not a good idea to align this loop. It gives only */
- /* huge programs, but does not help to speed up */
- /* ASM_OUTPUT_LOOP_ALIGN (asm_out_file); */
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[8]));
-
- xops[13] = gen_rtx (MEM, SImode, xops[0]);
- output_asm_insn (AS2 (mov%L1,%13,%1), xops);
-
- if (QI_REG_P (xops[1]))
- {
- /* On i586 it is faster to combine the hi- and lo- part as
- a kind of lookahead. If anding both yields zero, then one
- of both *could* be zero, otherwise none of both is zero;
- this saves one instruction, on i486 this is slower
- tested with P-90, i486DX2-66, AMD486DX2-66 */
- if(TARGET_PENTIUM)
- {
- output_asm_insn (AS2 (test%B1,%h1,%b1), xops);
- output_asm_insn (AS1 (jne,%l9), xops);
- }
-
- /* check first byte */
- output_asm_insn (AS2 (test%B1,%b1,%b1), xops);
- output_asm_insn (AS1 (je,%l12), xops);
-
- /* check second byte */
- output_asm_insn (AS2 (test%B1,%h1,%h1), xops);
- output_asm_insn (AS1 (je,%l11), xops);
-
- if(TARGET_PENTIUM)
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[9]));
- }
- else
- {
- /* check first byte */
- output_asm_insn (AS2 (test%L1,%14,%1), xops);
- output_asm_insn (AS1 (je,%l12), xops);
-
- /* check second byte */
- output_asm_insn (AS2 (test%L1,%15,%1), xops);
- output_asm_insn (AS1 (je,%l11), xops);
- }
-
- /* check third byte */
- output_asm_insn (AS2 (test%L1,%16,%1), xops);
- output_asm_insn (AS1 (je,%l10), xops);
-
- /* check fourth byte and increment address */
- output_asm_insn (AS2 (add%L0,%5,%0), xops);
- output_asm_insn (AS2 (test%L1,%17,%1), xops);
- output_asm_insn (AS1 (jne,%l8), xops);
-
- /* now generate fixups when the compare stops within a 4-byte word */
- output_asm_insn (AS2 (sub%L0,%4,%0), xops);
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[10]));
- output_asm_insn (AS1 (inc%L0,%0), xops);
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[11]));
- output_asm_insn (AS1 (inc%L0,%0), xops);
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[12]));
-
- RET;
-}
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
deleted file mode 100644
index 6acb1ba3af5..00000000000
--- a/gcc/config/i386/i386.h
+++ /dev/null
@@ -1,2727 +0,0 @@
-/* Definitions of target machine for GNU compiler for Intel X86
- (386, 486, Pentium).
- Copyright (C) 1988, 1992, 1994, 1995, 1996 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. */
-
-/* The purpose of this file is to define the characteristics of the i386,
- independent of assembler syntax or operating system.
-
- Three other files build on this one to describe a specific assembler syntax:
- bsd386.h, att386.h, and sun386.h.
-
- The actual tm.h file for a particular system should include
- this file, and then the file for the appropriate assembler syntax.
-
- Many macros that specify assembler syntax are omitted entirely from
- this file because they really belong in the files for particular
- assemblers. These include AS1, AS2, AS3, RP, IP, LPREFIX, L_SIZE,
- PUT_OP_SIZE, USE_STAR, ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE,
- PRINT_B_I_S, and many that start with ASM_ or end in ASM_OP. */
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define I386 1
-
-/* Stubs for half-pic support if not OSF/1 reference platform. */
-
-#ifndef HALF_PIC_P
-#define HALF_PIC_P() 0
-#define HALF_PIC_NUMBER_PTRS 0
-#define HALF_PIC_NUMBER_REFS 0
-#define HALF_PIC_ENCODE(DECL)
-#define HALF_PIC_DECLARE(NAME)
-#define HALF_PIC_INIT() error ("half-pic init called on systems that don't support it.")
-#define HALF_PIC_ADDRESS_P(X) 0
-#define HALF_PIC_PTR(X) X
-#define HALF_PIC_FINISH(STREAM)
-#endif
-
-/* Define the specific costs for a given cpu */
-
-struct processor_costs {
- int add; /* cost of an add instruction */
- int lea; /* cost of a lea instruction */
- int shift_var; /* variable shift costs */
- int shift_const; /* constant shift costs */
- int mult_init; /* cost of starting a multiply */
- int mult_bit; /* cost of multiply per each bit set */
- int divide; /* cost of a divide/mod */
-};
-
-extern struct processor_costs *ix86_cost;
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* configure can arrange to make this 2, to force a 486. */
-#ifndef TARGET_CPU_DEFAULT
-#define TARGET_CPU_DEFAULT 0
-#endif
-
-/* Masks for the -m switches */
-#define MASK_80387 000000000001 /* Hardware floating point */
-#define MASK_NOTUSED1 000000000002 /* bit not currently used */
-#define MASK_NOTUSED2 000000000004 /* bit not currently used */
-#define MASK_RTD 000000000010 /* Use ret that pops args */
-#define MASK_ALIGN_DOUBLE 000000000020 /* align doubles to 2 word boundary */
-#define MASK_SVR3_SHLIB 000000000040 /* Uninit locals into bss */
-#define MASK_IEEE_FP 000000000100 /* IEEE fp comparisons */
-#define MASK_FLOAT_RETURNS 000000000200 /* Return float in st(0) */
-#define MASK_NO_FANCY_MATH_387 000000000400 /* Disable sin, cos, sqrt */
-#define MASK_OMIT_LEAF_FRAME_POINTER 0x00000800 /* omit leaf frame pointers */
- /* Temporary codegen switches */
-#define MASK_DEBUG_ADDR 000001000000 /* Debug GO_IF_LEGITIMATE_ADDRESS */
-#define MASK_NO_WIDE_MULTIPLY 000002000000 /* Disable 32x32->64 multiplies */
-#define MASK_NO_MOVE 000004000000 /* Don't generate mem->mem */
-#define MASK_NO_PSEUDO 000010000000 /* Move op's args -> pseudos */
-#define MASK_DEBUG_ARG 000020000000 /* Debug function_arg */
-#define MASK_SCHEDULE_PROLOGUE 000040000000 /* Emit prologue as rtl */
-#define MASK_STACK_PROBE 000100000000 /* Enable stack probing */
-
-/* Use the floating point instructions */
-#define TARGET_80387 (target_flags & MASK_80387)
-
-/* Compile using ret insn that pops args.
- This will not work unless you use prototypes at least
- for all functions that can take varying numbers of args. */
-#define TARGET_RTD (target_flags & MASK_RTD)
-
-/* Align doubles to a two word boundary. This breaks compatibility with
- the published ABI's for structures containing doubles, but produces
- faster code on the pentium. */
-#define TARGET_ALIGN_DOUBLE (target_flags & MASK_ALIGN_DOUBLE)
-
-/* Put uninitialized locals into bss, not data.
- Meaningful only on svr3. */
-#define TARGET_SVR3_SHLIB (target_flags & MASK_SVR3_SHLIB)
-
-/* Use IEEE floating point comparisons. These handle correctly the cases
- where the result of a comparison is unordered. Normally SIGFPE is
- generated in such cases, in which case this isn't needed. */
-#define TARGET_IEEE_FP (target_flags & MASK_IEEE_FP)
-
-/* Functions that return a floating point value may return that value
- in the 387 FPU or in 386 integer registers. If set, this flag causes
- the 387 to be used, which is compatible with most calling conventions. */
-#define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & MASK_FLOAT_RETURNS)
-
-/* Disable generation of FP sin, cos and sqrt operations for 387.
- This is because FreeBSD lacks these in the math-emulator-code */
-#define TARGET_NO_FANCY_MATH_387 (target_flags & MASK_NO_FANCY_MATH_387)
-
-/* Don't create frame pointers for leaf functions */
-#define TARGET_OMIT_LEAF_FRAME_POINTER (target_flags & MASK_OMIT_LEAF_FRAME_POINTER)
-
-/* Temporary switches for tuning code generation */
-
-/* Disable 32x32->64 bit multiplies that are used for long long multiplies
- and division by constants, but sometimes cause reload problems. */
-#define TARGET_NO_WIDE_MULTIPLY (target_flags & MASK_NO_WIDE_MULTIPLY)
-#define TARGET_WIDE_MULTIPLY (!TARGET_NO_WIDE_MULTIPLY)
-
-/* Emit/Don't emit prologue as rtl */
-#define TARGET_SCHEDULE_PROLOGUE (target_flags & MASK_SCHEDULE_PROLOGUE)
-
-/* Debug GO_IF_LEGITIMATE_ADDRESS */
-#define TARGET_DEBUG_ADDR (target_flags & MASK_DEBUG_ADDR)
-
-/* Debug FUNCTION_ARG macros */
-#define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
-
-/* Hack macros for tuning code generation */
-#define TARGET_MOVE ((target_flags & MASK_NO_MOVE) == 0) /* Don't generate memory->memory */
-#define TARGET_PSEUDO ((target_flags & MASK_NO_PSEUDO) == 0) /* Move op's args into pseudos */
-
-#define TARGET_386 (ix86_cpu == PROCESSOR_I386)
-#define TARGET_486 (ix86_cpu == PROCESSOR_I486)
-#define TARGET_PENTIUM (ix86_cpu == PROCESSOR_PENTIUM)
-#define TARGET_PENTIUMPRO (ix86_cpu == PROCESSOR_PENTIUMPRO)
-#define TARGET_USE_LEAVE (ix86_cpu == PROCESSOR_I386)
-#define TARGET_PUSH_MEMORY (ix86_cpu == PROCESSOR_I386)
-#define TARGET_ZERO_EXTEND_WITH_AND (ix86_cpu != PROCESSOR_I386 \
- && ix86_cpu != PROCESSOR_PENTIUMPRO)
-#define TARGET_DOUBLE_WITH_ADD (ix86_cpu != PROCESSOR_I386)
-#define TARGET_USE_BIT_TEST (ix86_cpu == PROCESSOR_I386)
-#define TARGET_UNROLL_STRLEN (ix86_cpu != PROCESSOR_I386)
-#define TARGET_USE_Q_REG (ix86_cpu == PROCESSOR_PENTIUM \
- || ix86_cpu == PROCESSOR_PENTIUMPRO)
-#define TARGET_USE_ANY_REG (ix86_cpu == PROCESSOR_I486)
-#define TARGET_CMOVE (ix86_arch == PROCESSOR_PENTIUMPRO)
-#define TARGET_DEEP_BRANCH_PREDICTION (ix86_cpu == PROCESSOR_PENTIUMPRO)
-#define TARGET_STACK_PROBE (target_flags & MASK_STACK_PROBE)
-
-#define TARGET_SWITCHES \
-{ { "80387", MASK_80387 }, \
- { "no-80387", -MASK_80387 }, \
- { "hard-float", MASK_80387 }, \
- { "soft-float", -MASK_80387 }, \
- { "no-soft-float", MASK_80387 }, \
- { "386", 0 }, \
- { "no-386", 0 }, \
- { "486", 0 }, \
- { "no-486", 0 }, \
- { "pentium", 0 }, \
- { "pentiumpro", 0 }, \
- { "rtd", MASK_RTD }, \
- { "no-rtd", -MASK_RTD }, \
- { "align-double", MASK_ALIGN_DOUBLE }, \
- { "no-align-double", -MASK_ALIGN_DOUBLE }, \
- { "svr3-shlib", MASK_SVR3_SHLIB }, \
- { "no-svr3-shlib", -MASK_SVR3_SHLIB }, \
- { "ieee-fp", MASK_IEEE_FP }, \
- { "no-ieee-fp", -MASK_IEEE_FP }, \
- { "fp-ret-in-387", MASK_FLOAT_RETURNS }, \
- { "no-fp-ret-in-387", -MASK_FLOAT_RETURNS }, \
- { "no-fancy-math-387", MASK_NO_FANCY_MATH_387 }, \
- { "fancy-math-387", -MASK_NO_FANCY_MATH_387 }, \
- { "omit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER }, \
- { "no-omit-leaf-frame-pointer",-MASK_OMIT_LEAF_FRAME_POINTER }, \
- { "no-wide-multiply", MASK_NO_WIDE_MULTIPLY }, \
- { "wide-multiply", -MASK_NO_WIDE_MULTIPLY }, \
- { "schedule-prologue", MASK_SCHEDULE_PROLOGUE }, \
- { "no-schedule-prologue", -MASK_SCHEDULE_PROLOGUE }, \
- { "debug-addr", MASK_DEBUG_ADDR }, \
- { "no-debug-addr", -MASK_DEBUG_ADDR }, \
- { "move", -MASK_NO_MOVE }, \
- { "no-move", MASK_NO_MOVE }, \
- { "debug-arg", MASK_DEBUG_ARG }, \
- { "no-debug-arg", -MASK_DEBUG_ARG }, \
- { "stack-arg-probe", MASK_STACK_PROBE }, \
- { "no-stack-arg-probe", -MASK_STACK_PROBE }, \
- SUBTARGET_SWITCHES \
- { "", MASK_SCHEDULE_PROLOGUE | TARGET_DEFAULT}}
-
-/* Which processor to schedule for. The cpu attribute defines a list that
- mirrors this list, so changes to i386.md must be made at the same time. */
-
-enum processor_type
- {PROCESSOR_I386, /* 80386 */
- PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */
- PROCESSOR_PENTIUM,
- PROCESSOR_PENTIUMPRO};
-
-#define PROCESSOR_I386_STRING "i386"
-#define PROCESSOR_I486_STRING "i486"
-#define PROCESSOR_I586_STRING "i586"
-#define PROCESSOR_PENTIUM_STRING "pentium"
-#define PROCESSOR_I686_STRING "i686"
-#define PROCESSOR_PENTIUMPRO_STRING "pentiumpro"
-
-extern enum processor_type ix86_cpu;
-
-extern int ix86_arch;
-
-/* Define the default processor. This is overridden by other tm.h files. */
-#define PROCESSOR_DEFAULT \
- ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_I486) \
- ? PROCESSOR_I486 \
- : ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_PENTIUM) \
- ? PROCESSOR_PENTIUM \
- : ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_PENTIUMPRO) \
- ? PROCESSOR_PENTIUMPRO \
- : PROCESSOR_I386
-#define PROCESSOR_DEFAULT_STRING \
- ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_I486) \
- ? PROCESSOR_I486_STRING \
- : ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_PENTIUM) \
- ? PROCESSOR_PENTIUM_STRING \
- : ((enum processor_type) TARGET_CPU_DEFAULT == PROCESSOR_PENTIUMPRO) \
- ? PROCESSOR_PENTIUMPRO_STRING \
- : PROCESSOR_I386_STRING
-
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
- command options that have values. Its definition is an
- initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- fixed part of the option name, and the address of a variable. The
- variable, type `char *', is set to the variable part of the given
- option if the fixed part matches. The actual option name is made
- by appending `-m' to the specified name. */
-#define TARGET_OPTIONS \
-{ { "cpu=", &ix86_cpu_string}, \
- { "arch=", &ix86_arch_string}, \
- { "reg-alloc=", &i386_reg_alloc_order }, \
- { "regparm=", &i386_regparm_string }, \
- { "align-loops=", &i386_align_loops_string }, \
- { "align-jumps=", &i386_align_jumps_string }, \
- { "align-functions=", &i386_align_funcs_string }, \
- { "branch-cost=", &i386_branch_cost_string }, \
- SUBTARGET_OPTIONS \
-}
-
-/* Sometimes certain combinations of command options do not make
- sense on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed.
-
- Don't use this macro to turn on various extra optimizations for
- `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
-
-#define OVERRIDE_OPTIONS override_options ()
-
-/* These are meant to be redefined in the host dependent files */
-#define SUBTARGET_SWITCHES
-#define SUBTARGET_OPTIONS
-
-/* Define this to change the optimizations performed by default. */
-#define OPTIMIZATION_OPTIONS(LEVEL) optimization_options(LEVEL)
-
-/* Specs for the compiler proper */
-
-#ifndef CC1_SPEC
-#define CC1_SPEC "\
-%{!mcpu*: \
-%{m386:-mcpu=i386 -march=i386} \
-%{mno-486:-mcpu=i386 -march=i386} \
-%{m486:-mcpu=i486 -march=i486} \
-%{mno-386:-mcpu=i486 -march=i486} \
-%{mno-pentium:-mcpu=i486 -march=i486} \
-%{mpentium:-mcpu=pentium} \
-%{mno-pentiumpro:-mcpu=pentium} \
-%{mpentiumpro:-mcpu=pentiumpro}}"
-#endif
-
-#ifndef CPP_CPU_SPEC
-#ifdef __STDC__
-#if TARGET_CPU_DEFAULT == 1
-#define CPP_CPU_DEFAULT "-Di486"
-#elif TARGET_CPU_DEFAULT == 2
-#define CPP_CPU_DEFAULT "-Di586"
-#elif TARGET_CPU_DEFAULT == 3
-#define CPP_CPU_DEFAULT "-Di686"
-#else
-#define CPP_CPU_DEFAULT ""
-#endif /* TARGET_CPU_DEFAULT */
-
-#define CPP_CPU_SPEC "\
--Di386 " CPP_CPU_DEFAULT " -Asystem(unix) -Acpu(i386) -Amachine(i386) \
-%{mcpu=i486:-Di486} %{m486:-Di486} \
-%{mpentium:-Dpentium -Di586} %{mcpu=pentium:-Dpentium -Di586} \
-%{mpentiumpro:-Dpentiumpro -Di686} %{mcpu=pentiumpro:-Dpentiumpro -Di686}"
-
-#else
-#define CPP_CPU_SPEC "\
--Di386 -Asystem(unix) -Acpu(i386) -Amachine(i386) \
-%{mcpu=i486:-Di486} %{m486:-Di486} \
-%{mpentium:-Dpentium -Di586} %{mcpu=pentium:-Dpentium -Di586} \
-%{mpentiumpro:-Dpentiumpro -Di686} %{mcpu=pentiumpro:-Dpentiumpro -Di686}"
-#endif /* __STDC__ */
-#endif /* CPP_CPU_SPEC */
-
-/* This macro defines names of additional specifications to put in the specs
- that can be used in various specifications like CC1_SPEC. Its definition
- is an initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- specification name, and a string constant that used by the GNU CC driver
- 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_cpu", CPP_CPU_SPEC }, \
- SUBTARGET_EXTRA_SPECS
-
-/* target machine storage layout */
-
-/* Define for XFmode extended real floating point support.
- This will automatically cause REAL_ARITHMETIC to be defined. */
-#define LONG_DOUBLE_TYPE_SIZE 96
-
-/* Define if you don't want extended real, but do want to use the
- software floating point emulator for REAL_ARITHMETIC and
- decimal <-> binary conversion. */
-/* #define REAL_ARITHMETIC */
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is true on the 80386. */
-
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is not true on the 80386. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-/* Not true for 80386 */
-#define WORDS_BIG_ENDIAN 0
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 80386, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function.
- For i486, we get better performance by aligning to a cache
- line (i.e. 16 byte) boundary. */
-#define FUNCTION_BOUNDARY (1 << (i386_align_funcs + 3))
-
-/* Alignment of field after `int : 0' in a structure. */
-
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Minimum size in bits of the largest boundary to which any
- and all fundamental data types supported by the hardware
- might need to be aligned. No data type wants to be aligned
- rounder than this. The i386 supports 64-bit floating point
- quantities, but these can be aligned on any 32-bit boundary.
- The published ABIs say that doubles should be aligned on word
- boundaries, but the Pentium gets better performance with them
- aligned on 64 bit boundaries. */
-#define BIGGEST_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
-
-/* align DFmode constants and nonaggregates */
-#define ALIGN_DFmode (!TARGET_386)
-
-/* Set this non-zero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 0
-
-/* If bit field type is int, don't let it cross an int,
- and give entire struct the alignment of an int. */
-/* Required on the 386 since it doesn't have bitfield insns. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Maximum power of 2 that code can be aligned to. */
-#define MAX_CODE_ALIGN 6 /* 64 byte alignment */
-
-/* Align loop starts for optimal branching. */
-#define ASM_OUTPUT_LOOP_ALIGN(FILE) ASM_OUTPUT_ALIGN (FILE, i386_align_loops)
-
-/* This is how to align an instruction for optimal branching.
- On i486 we'll get better performance by aligning on a
- cache line (i.e. 16 byte) boundary. */
-#define ASM_OUTPUT_ALIGN_CODE(FILE) ASM_OUTPUT_ALIGN ((FILE), i386_align_jumps)
-
-
-/* Standard register usage. */
-
-/* This processor has special stack-like registers. See reg-stack.c
- for details. */
-
-#define STACK_REGS
-#define IS_STACK_MODE(mode) (mode==DFmode || mode==SFmode || mode==XFmode)
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- In the 80386 we give the 8 general purpose registers the numbers 0-7.
- We number the floating point registers 8-15.
- Note that registers 0-7 can be accessed as a short or int,
- while only 0-3 may be used with byte `mov' instructions.
-
- Reg 16 does not correspond to any hardware register, but instead
- appears in the RTL as an argument pointer prior to reload, and is
- eliminated during reloading in favor of either the stack or frame
- pointer. */
-
-#define FIRST_PSEUDO_REGISTER 17
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the 80386, the stack pointer is such, as is the arg pointer. */
-#define FIXED_REGISTERS \
-/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
-{ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-
-#define CALL_USED_REGISTERS \
-/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
-{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
-
-/* Order in which to allocate registers. Each register must be
- listed once, even those in FIXED_REGISTERS. List frame pointer
- late and fixed registers last. Note that, in general, we prefer
- registers listed in CALL_USED_REGISTERS, keeping the others
- available for storage of persistent values.
-
- Three different versions of REG_ALLOC_ORDER have been tried:
-
- If the order is edx, ecx, eax, ... it produces a slightly faster compiler,
- but slower code on simple functions returning values in eax.
-
- If the order is eax, ecx, edx, ... it causes reload to abort when compiling
- perl 4.036 due to not being able to create a DImode register (to hold a 2
- word union).
-
- If the order is eax, edx, ecx, ... it produces better code for simple
- functions, and a slightly slower compiler. Users complained about the code
- generated by allocating edx first, so restore the 'natural' order of things. */
-
-#define REG_ALLOC_ORDER \
-/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
-{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }
-
-/* A C statement (sans semicolon) to choose the order in which to
- allocate hard registers for pseudo-registers local to a basic
- block.
-
- Store the desired register order in the array `reg_alloc_order'.
- Element 0 should be the register to allocate first; element 1, the
- next register; and so on.
-
- The macro body should not assume anything about the contents of
- `reg_alloc_order' before execution of the macro.
-
- On most machines, it is not necessary to define this macro. */
-
-#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
-
-/* Macro to conditionally modify fixed_regs/call_used_regs. */
-#define CONDITIONAL_REGISTER_USAGE \
- { \
- if (flag_pic) \
- { \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- } \
- if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \
- { \
- int i; \
- HARD_REG_SET x; \
- COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
- if (TEST_HARD_REG_BIT (x, i)) \
- fixed_regs[i] = call_used_regs[i] = 1; \
- } \
- }
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- Actually there are no two word move instructions for consecutive
- registers. And only registers 0-3 may have mov byte instructions
- applied to them.
- */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (FP_REGNO_P (REGNO) ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the 80386, the first 4 cpu registers can hold any mode
- while the floating point registers may hold only floating point.
- Make it clear that the fp regs could not hold a 16-byte float. */
-
-/* The casts to int placate a compiler on a microvax,
- for cross-compiler testing. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((REGNO) < 2 ? 1 \
- : (REGNO) < 4 ? 1 \
- : FP_REGNO_P (REGNO) \
- ? (((int) GET_MODE_CLASS (MODE) == (int) MODE_FLOAT \
- || (int) GET_MODE_CLASS (MODE) == (int) MODE_COMPLEX_FLOAT) \
- && GET_MODE_UNIT_SIZE (MODE) <= (LONG_DOUBLE_TYPE_SIZE == 96 ? 12 : 8))\
- : (int) (MODE) != (int) QImode ? 1 \
- : (reload_in_progress | reload_completed) == 1)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-
-#define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) == (MODE2))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* on the 386 the pc register is %eip, and is not usable as a general
- register. The ordinary mov instructions won't work */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 7
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 6
-
-/* First floating point reg */
-#define FIRST_FLOAT_REG 8
-
-/* First & last stack-like regs */
-#define FIRST_STACK_REG FIRST_FLOAT_REG
-#define LAST_STACK_REG (FIRST_FLOAT_REG + 7)
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ())
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 16
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 2
-
-/* Register to hold the addressing base for position independent
- code access to data items. */
-#define PIC_OFFSET_TABLE_REGNUM 3
-
-/* Register in which address to store a structure value
- arrives in the function. On the 386, the prologue
- copies this from the stack to register %eax. */
-#define STRUCT_VALUE_INCOMING 0
-
-/* Place in which caller passes the structure value address.
- 0 means push the value on the stack like an argument. */
-#define STRUCT_VALUE 0
-
-/* A C expression which can inhibit the returning of certain function
- values in registers, based on the type of value. A nonzero value
- says to return the function value in memory, just as large
- structures are always returned. Here TYPE will be a C expression
- of type `tree', representing the data type of the value.
-
- Note that values of mode `BLKmode' must be explicitly handled by
- this macro. Also, the option `-fpcc-struct-return' takes effect
- regardless of this macro. On most systems, it is possible to
- leave the macro undefined; this causes a default definition to be
- used, whose value is the constant 1 for `BLKmode' values, and 0
- otherwise.
-
- Do not use this macro to indicate that structures and unions
- should always be returned in memory. You should instead use
- `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
-
-#define RETURN_IN_MEMORY(TYPE) \
- ((TYPE_MODE (TYPE) == BLKmode) || int_size_in_bytes (TYPE) > 12)
-
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union.
-
- It might seem that class BREG is unnecessary, since no useful 386
- opcode needs reg %ebx. But some systems pass args to the OS in ebx,
- and the "b" register constraint is useful in asms for syscalls. */
-
-enum reg_class
-{
- NO_REGS,
- AREG, DREG, CREG, BREG,
- AD_REGS, /* %eax/%edx for DImode */
- Q_REGS, /* %eax %ebx %ecx %edx */
- SIREG, DIREG,
- INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */
- GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */
- FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */
- FLOAT_REGS,
- ALL_REGS, LIM_REG_CLASSES
-};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-#define FLOAT_CLASS_P(CLASS) (reg_class_subset_p (CLASS, FLOAT_REGS))
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
-{ "NO_REGS", \
- "AREG", "DREG", "CREG", "BREG", \
- "AD_REGS", \
- "Q_REGS", \
- "SIREG", "DIREG", \
- "INDEX_REGS", \
- "GENERAL_REGS", \
- "FP_TOP_REG", "FP_SECOND_REG", \
- "FLOAT_REGS", \
- "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ 0, \
- 0x1, 0x2, 0x4, 0x8, /* AREG, DREG, CREG, BREG */ \
- 0x3, /* AD_REGS */ \
- 0xf, /* Q_REGS */ \
- 0x10, 0x20, /* SIREG, DIREG */ \
- 0x7f, /* INDEX_REGS */ \
- 0x100ff, /* GENERAL_REGS */ \
- 0x0100, 0x0200, /* FP_TOP_REG, FP_SECOND_REG */ \
- 0xff00, /* FLOAT_REGS */ \
- 0x1ffff }
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO])
-
-/* When defined, the compiler allows registers explicitly used in the
- rtl to be used as spill registers but prevents the compiler from
- extending the lifetime of these registers. */
-
-#define SMALL_REGISTER_CLASSES 1
-
-#define QI_REG_P(X) \
- (REG_P (X) && REGNO (X) < 4)
-#define NON_QI_REG_P(X) \
- (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER)
-
-#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
-#define FP_REGNO_P(n) ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG)
-
-#define STACK_REG_P(xop) (REG_P (xop) && \
- REGNO (xop) >= FIRST_STACK_REG && \
- REGNO (xop) <= LAST_STACK_REG)
-
-#define NON_STACK_REG_P(xop) (REG_P (xop) && ! STACK_REG_P (xop))
-
-#define STACK_TOP_P(xop) (REG_P (xop) && REGNO (xop) == FIRST_STACK_REG)
-
-/* Try to maintain the accuracy of the death notes for regs satisfying the
- following. Important for stack like regs, to know when to pop. */
-
-/* #define PRESERVE_DEATH_INFO_REGNO_P(x) FP_REGNO_P(x) */
-
-/* 1 if register REGNO can magically overlap other regs.
- Note that nonzero values work only in very special circumstances. */
-
-/* #define OVERLAPPING_REGNO_P(REGNO) FP_REGNO_P (REGNO) */
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS INDEX_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'r' ? GENERAL_REGS : \
- (C) == 'q' ? Q_REGS : \
- (C) == 'f' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
- ? FLOAT_REGS \
- : NO_REGS) : \
- (C) == 't' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
- ? FP_TOP_REG \
- : NO_REGS) : \
- (C) == 'u' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \
- ? FP_SECOND_REG \
- : NO_REGS) : \
- (C) == 'a' ? AREG : \
- (C) == 'b' ? BREG : \
- (C) == 'c' ? CREG : \
- (C) == 'd' ? DREG : \
- (C) == 'A' ? AD_REGS : \
- (C) == 'D' ? DIREG : \
- (C) == 'S' ? SIREG : NO_REGS)
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- I is for non-DImode shifts.
- J is for DImode shifts.
- K and L are for an `andsi' optimization.
- M is for shifts that can be executed by the "lea" opcode.
- */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 31 : \
- (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 : \
- (C) == 'K' ? (VALUE) == 0xff : \
- (C) == 'L' ? (VALUE) == 0xffff : \
- (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3 : \
- (C) == 'N' ? (VALUE) >= 0 && (VALUE) <= 255 :\
- (C) == 'O' ? (VALUE) >= 0 && (VALUE) <= 32 : \
- 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. We allow constants even if
- TARGET_387 isn't set, because the stack register converter may need to
- load 0.0 into the function value register. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? standard_80387_constant_p (VALUE) : 0)
-
-/* Place additional restrictions on the register class to use when it
- is necessary to be able to hold a value of mode MODE in a reload
- register for which class CLASS would ordinarily be used. */
-
-#define LIMIT_RELOAD_CLASS(MODE, CLASS) \
- ((MODE) == QImode && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS) \
- ? Q_REGS : (CLASS))
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
- On the 80386 series, we prevent floating constants from being
- reloaded into floating registers (since no move-insn can do that)
- and we ensure that QImodes aren't reloaded into the esi or edi reg. */
-
-/* Put float CONST_DOUBLE in the constant pool instead of fp regs.
- QImode must go into class Q_REGS.
- Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and
- movdf to do mem-to-mem moves through integer regs. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode ? NO_REGS \
- : GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \
- : ((CLASS) == ALL_REGS \
- && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) ? GENERAL_REGS \
- : (CLASS))
-
-/* If we are copying between general and FP registers, we need a memory
- location. */
-
-#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
- ((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
- || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2)))
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On the 80386, this is the size of MODE in words,
- except in the FP regs, where a single reg is always enough. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- (FLOAT_CLASS_P (CLASS) ? 1 : \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* A C expression whose value is nonzero if pseudos that have been
- assigned to registers of class CLASS would likely be spilled
- because registers of CLASS are needed for spill registers.
-
- The default value of this macro returns 1 if CLASS has exactly one
- register and zero otherwise. On most machines, this default
- should be used. Only define this macro to some other expression
- if pseudo allocated by `local-alloc.c' end up in memory because
- their hard registers were needed for spill registers. If this
- macro returns nonzero for those classes, those pseudos will only
- be allocated by `global.c', which knows how to reallocate the
- pseudo to another register. If there would not be another
- register available for reallocation, you should not change the
- definition of this macro since the only effect of such a
- definition would be to slow down register allocation. */
-
-#define CLASS_LIKELY_SPILLED_P(CLASS) \
- (((CLASS) == AREG) \
- || ((CLASS) == DREG) \
- || ((CLASS) == CREG) \
- || ((CLASS) == BREG) \
- || ((CLASS) == AD_REGS) \
- || ((CLASS) == SIREG) \
- || ((CLASS) == DIREG))
-
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On 386 pushw decrements by exactly 2 no matter what the position was.
- On the 386 there is no pushb; we use pushw instead, and this
- has the effect of rounding up to 2. */
-
-#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2))
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the 80386, the RTD insn may be used to pop them if the number
- of args is fixed, but if the number is variable then the caller
- must pop them all. RTD can't be used for library calls now
- because the library is compiled with the Unix compiler.
- Use of RTD is a selectable option, since it is incompatible with
- standard Unix calling sequences. If the option is not selected,
- the caller must always pop the args.
-
- The attribute stdcall is equivalent to RTD on a per module basis. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- (i386_return_pops_args (FUNDECL, FUNTYPE, SIZE))
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), \
- VALUE_REGNO (TYPE_MODE (VALTYPE)))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, MODE, VALUE_REGNO (MODE))
-
-/* Define the size of the result block used for communication between
- untyped_call and untyped_return. The block contains a DImode value
- followed by the block used by fnsave and frstor. */
-
-#define APPLY_RESULT_SIZE (8+108)
-
-/* 1 if N is a possible register number for function argument passing. */
-#define FUNCTION_ARG_REGNO_P(N) ((N) >= 0 && (N) < REGPARM_MAX)
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go. */
-
-typedef struct i386_args {
- int words; /* # words passed so far */
- int nregs; /* # registers available for passing */
- int regno; /* next available register number */
-} CUMULATIVE_ARGS;
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- (init_cumulative_args (&CUM, FNTYPE, LIBNAME))
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- (function_arg_advance (&CUM, MODE, TYPE, NAMED))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- (function_arg (&CUM, MODE, TYPE, NAMED))
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
- (function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED))
-
-/* This macro is invoked just before the start of a function.
- It is used here to output code for -fpic that will load the
- return address into %ebx. */
-
-#undef ASM_OUTPUT_FUNCTION_PREFIX
-#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \
- asm_output_function_prefix (FILE, FNNAME)
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
- function_prologue (FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- if (flag_pic) \
- { \
- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
- LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall *_mcount@GOT(%%ebx)\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall _mcount\n"); \
- } \
-}
-
-
-/* There are three profiling modes for basic blocks available.
- The modes are selected at compile time by using the options
- -a or -ax of the gnu compiler.
- The variable `profile_block_flag' will be set according to the
- selected option.
-
- profile_block_flag == 0, no option used:
-
- No profiling done.
-
- profile_block_flag == 1, -a option used.
-
- Count frequency of execution of every basic block.
-
- profile_block_flag == 2, -ax option used.
-
- Generate code to allow several different profiling modes at run time.
- Available modes are:
- Produce a trace of all basic blocks.
- Count frequency of jump instructions executed.
- In every mode it is possible to start profiling upon entering
- certain functions and to disable profiling of some other functions.
-
- The result of basic-block profiling will be written to a file `bb.out'.
- If the -ax option is used parameters for the profiling will be read
- from file `bb.in'.
-
-*/
-
-/* The following macro shall output assembler code to FILE
- to initialize basic-block profiling.
-
- If profile_block_flag == 2
-
- Output code to call the subroutine `__bb_init_trace_func'
- and pass two parameters to it. The first parameter is
- the address of a block allocated in the object module.
- The second parameter is the number of the first basic block
- of the function.
-
- The name of the block is a local symbol made with this statement:
-
- ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
-
- Of course, since you are writing the definition of
- `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
- can take a short cut in the definition of this macro and use the
- name that you know will result.
-
- The number of the first basic block of the function is
- passed to the macro in BLOCK_OR_LABEL.
-
- If described in a virtual assembler language the code to be
- output looks like:
-
- parameter1 <- LPBX0
- parameter2 <- BLOCK_OR_LABEL
- call __bb_init_trace_func
-
- else if profile_block_flag != 0
-
- Output code to call the subroutine `__bb_init_func'
- and pass one single parameter to it, which is the same
- as the first parameter to `__bb_init_trace_func'.
-
- The first word of this parameter is a flag which will be nonzero if
- the object module has already been initialized. So test this word
- first, and do not call `__bb_init_func' if the flag is nonzero.
- Note: When profile_block_flag == 2 the test need not be done
- but `__bb_init_trace_func' *must* be called.
-
- BLOCK_OR_LABEL may be used to generate a label number as a
- branch destination in case `__bb_init_func' will not be called.
-
- If described in a virtual assembler language the code to be
- output looks like:
-
- cmp (LPBX0),0
- jne local_label
- parameter1 <- LPBX0
- call __bb_init_func
-local_label:
-
-*/
-
-#undef FUNCTION_BLOCK_PROFILER
-#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
-do \
- { \
- static int num_func = 0; \
- rtx xops[8]; \
- char block_table[80], false_label[80]; \
- \
- ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); \
- \
- xops[1] = gen_rtx (SYMBOL_REF, VOIDmode, block_table); \
- xops[5] = stack_pointer_rtx; \
- xops[7] = gen_rtx (REG, Pmode, 0); /* eax */ \
- \
- CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; \
- \
- switch (profile_block_flag) \
- { \
- \
- case 2: \
- \
- xops[2] = GEN_INT ((BLOCK_OR_LABEL)); \
- xops[3] = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, VOIDmode, "__bb_init_trace_func")); \
- xops[6] = GEN_INT (8); \
- \
- output_asm_insn (AS1(push%L2,%2), xops); \
- if (!flag_pic) \
- output_asm_insn (AS1(push%L1,%1), xops); \
- else \
- { \
- output_asm_insn (AS2 (lea%L7,%a1,%7), xops); \
- output_asm_insn (AS1 (push%L7,%7), xops); \
- } \
- \
- output_asm_insn (AS1(call,%P3), xops); \
- output_asm_insn (AS2(add%L0,%6,%5), xops); \
- \
- break; \
- \
- default: \
- \
- ASM_GENERATE_INTERNAL_LABEL (false_label, "LPBZ", num_func); \
- \
- xops[0] = const0_rtx; \
- xops[2] = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, VOIDmode, false_label)); \
- xops[3] = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, VOIDmode, "__bb_init_func")); \
- xops[4] = gen_rtx (MEM, Pmode, xops[1]); \
- xops[6] = GEN_INT (4); \
- \
- CONSTANT_POOL_ADDRESS_P (xops[2]) = TRUE; \
- \
- output_asm_insn (AS2(cmp%L4,%0,%4), xops); \
- output_asm_insn (AS1(jne,%2), xops); \
- \
- if (!flag_pic) \
- output_asm_insn (AS1(push%L1,%1), xops); \
- else \
- { \
- output_asm_insn (AS2 (lea%L7,%a1,%7), xops); \
- output_asm_insn (AS1 (push%L7,%7), xops); \
- } \
- \
- output_asm_insn (AS1(call,%P3), xops); \
- output_asm_insn (AS2(add%L0,%6,%5), xops); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "LPBZ", num_func); \
- num_func++; \
- \
- break; \
- \
- } \
- } \
-while (0)
-
-/* The following macro shall output assembler code to FILE
- to increment a counter associated with basic block number BLOCKNO.
-
- If profile_block_flag == 2
-
- Output code to initialize the global structure `__bb' and
- call the function `__bb_trace_func' which will increment the
- counter.
-
- `__bb' consists of two words. In the first word the number
- of the basic block has to be stored. In the second word
- the address of a block allocated in the object module
- has to be stored.
-
- The basic block number is given by BLOCKNO.
-
- The address of the block is given by the label created with
-
- ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
-
- by FUNCTION_BLOCK_PROFILER.
-
- Of course, since you are writing the definition of
- `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
- can take a short cut in the definition of this macro and use the
- name that you know will result.
-
- If described in a virtual assembler language the code to be
- output looks like:
-
- move BLOCKNO -> (__bb)
- move LPBX0 -> (__bb+4)
- call __bb_trace_func
-
- Note that function `__bb_trace_func' must not change the
- machine state, especially the flag register. To grant
- this, you must output code to save and restore registers
- either in this macro or in the macros MACHINE_STATE_SAVE
- and MACHINE_STATE_RESTORE. The last two macros will be
- used in the function `__bb_trace_func', so you must make
- sure that the function prologue does not change any
- register prior to saving it with MACHINE_STATE_SAVE.
-
- else if profile_block_flag != 0
-
- Output code to increment the counter directly.
- Basic blocks are numbered separately from zero within each
- compiled object module. The count associated with block number
- BLOCKNO is at index BLOCKNO in an array of words; the name of
- this array is a local symbol made with this statement:
-
- ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
-
- Of course, since you are writing the definition of
- `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
- can take a short cut in the definition of this macro and use the
- name that you know will result.
-
- If described in a virtual assembler language the code to be
- output looks like:
-
- inc (LPBX2+4*BLOCKNO)
-
-*/
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
-do \
- { \
- rtx xops[8], cnt_rtx; \
- char counts[80]; \
- char *block_table = counts; \
- \
- switch (profile_block_flag) \
- { \
- \
- case 2: \
- \
- ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); \
- \
- xops[1] = gen_rtx (SYMBOL_REF, VOIDmode, block_table); \
- xops[2] = GEN_INT ((BLOCKNO)); \
- xops[3] = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, VOIDmode, "__bb_trace_func")); \
- xops[4] = gen_rtx (SYMBOL_REF, VOIDmode, "__bb"); \
- xops[5] = plus_constant (xops[4], 4); \
- xops[0] = gen_rtx (MEM, SImode, xops[4]); \
- xops[6] = gen_rtx (MEM, SImode, xops[5]); \
- \
- CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; \
- \
- fprintf(FILE, "\tpushf\n"); \
- output_asm_insn (AS2(mov%L0,%2,%0), xops); \
- if (flag_pic) \
- { \
- xops[7] = gen_rtx (REG, Pmode, 0); /* eax */ \
- output_asm_insn (AS1(push%L7,%7), xops); \
- output_asm_insn (AS2(lea%L7,%a1,%7), xops); \
- output_asm_insn (AS2(mov%L6,%7,%6), xops); \
- output_asm_insn (AS1(pop%L7,%7), xops); \
- } \
- else \
- output_asm_insn (AS2(mov%L6,%1,%6), xops); \
- output_asm_insn (AS1(call,%P3), xops); \
- fprintf(FILE, "\tpopf\n"); \
- \
- break; \
- \
- default: \
- \
- ASM_GENERATE_INTERNAL_LABEL (counts, "LPBX", 2); \
- cnt_rtx = gen_rtx (SYMBOL_REF, VOIDmode, counts); \
- SYMBOL_REF_FLAG (cnt_rtx) = TRUE; \
- \
- if (BLOCKNO) \
- cnt_rtx = plus_constant (cnt_rtx, (BLOCKNO)*4); \
- \
- if (flag_pic) \
- cnt_rtx = gen_rtx (PLUS, Pmode, pic_offset_table_rtx, cnt_rtx); \
- \
- xops[0] = gen_rtx (MEM, SImode, cnt_rtx); \
- output_asm_insn (AS1(inc%L0,%0), xops); \
- \
- break; \
- \
- } \
- } \
-while (0)
-
-/* The following macro shall output assembler code to FILE
- to indicate a return from function during basic-block profiling.
-
- If profiling_block_flag == 2:
-
- Output assembler code to call function `__bb_trace_ret'.
-
- Note that function `__bb_trace_ret' must not change the
- machine state, especially the flag register. To grant
- this, you must output code to save and restore registers
- either in this macro or in the macros MACHINE_STATE_SAVE_RET
- and MACHINE_STATE_RESTORE_RET. The last two macros will be
- used in the function `__bb_trace_ret', so you must make
- sure that the function prologue does not change any
- register prior to saving it with MACHINE_STATE_SAVE_RET.
-
- else if profiling_block_flag != 0:
-
- The macro will not be used, so it need not distinguish
- these cases.
-*/
-
-#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \
-do \
- { \
- rtx xops[1]; \
- \
- xops[0] = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, VOIDmode, "__bb_trace_ret")); \
- \
- output_asm_insn (AS1(call,%P0), xops); \
- \
- } \
-while (0)
-
-/* The function `__bb_trace_func' is called in every basic block
- and is not allowed to change the machine state. Saving (restoring)
- the state can either be done in the BLOCK_PROFILER macro,
- before calling function (rsp. after returning from function)
- `__bb_trace_func', or it can be done inside the function by
- defining the macros:
-
- MACHINE_STATE_SAVE(ID)
- MACHINE_STATE_RESTORE(ID)
-
- In the latter case care must be taken, that the prologue code
- of function `__bb_trace_func' does not already change the
- state prior to saving it with MACHINE_STATE_SAVE.
-
- The parameter `ID' is a string identifying a unique macro use.
-
- On the i386 the initialization code at the begin of
- function `__bb_trace_func' contains a `sub' instruction
- therefore we handle save and restore of the flag register
- in the BLOCK_PROFILER macro. */
-
-#define MACHINE_STATE_SAVE(ID) \
- asm (" pushl %eax"); \
- asm (" pushl %ecx"); \
- asm (" pushl %edx"); \
- asm (" pushl %esi");
-
-#define MACHINE_STATE_RESTORE(ID) \
- asm (" popl %esi"); \
- asm (" popl %edx"); \
- asm (" popl %ecx"); \
- asm (" popl %eax");
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-/* Note on the 386 it might be more efficient not to define this since
- we have to restore it ourselves from the frame pointer, in order to
- use pop */
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning.
-
- If the last non-note insn in the function is a BARRIER, then there
- is no need to emit a function prologue, because control does not fall
- off the end. This happens if the function ends in an "exit" call, or
- if a `return' insn is emitted directly into the function. */
-
-#if 0
-#define FUNCTION_BEGIN_EPILOGUE(FILE) \
-do { \
- rtx last = get_last_insn (); \
- if (last && GET_CODE (last) == NOTE) \
- last = prev_nonnote_insn (last); \
-/* if (! last || GET_CODE (last) != BARRIER) \
- function_epilogue (FILE, SIZE);*/ \
-} while (0)
-#endif
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
- function_epilogue (FILE, SIZE)
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On the 386, the trampoline contains three instructions:
- mov #STATIC,ecx
- mov #FUNCTION,eax
- jmp @eax */
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- ASM_OUTPUT_CHAR (FILE, GEN_INT (0xb9)); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_CHAR (FILE, GEN_INT (0xb8)); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_CHAR (FILE, GEN_INT (0xff)); \
- ASM_OUTPUT_CHAR (FILE, GEN_INT (0xe0)); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 12
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 1)), CXT); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 6)), FNADDR); \
-}
-
-/* Definitions for register eliminations.
-
- This is an array of structures. Each structure initializes one pair
- of eliminable registers. The "from" register number is given first,
- followed by "to". Eliminations of the same "from" register are listed
- in order of preference.
-
- We have two registers that can be eliminated on the i386. First, the
- frame pointer register can often be eliminated in favor of the stack
- pointer register. Secondly, the argument pointer register can always be
- eliminated; it is replaced with either the stack or frame pointer. */
-
-#define ELIMINABLE_REGS \
-{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
-
-/* Given FROM and TO register numbers, say whether this elimination is allowed.
- Frame pointer elimination is automatically handled.
-
- For the i386, if frame pointer elimination is being done, we would like to
- convert ap into sp, not fp.
-
- All other eliminations are valid. */
-
-#define CAN_ELIMINATE(FROM, TO) \
- ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
- ? ! frame_pointer_needed \
- : 1)
-
-/* Define the offset between two registers, one to be eliminated, and the other
- its replacement, at the start of a routine. */
-
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ \
- if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
- (OFFSET) = 8; /* Skip saved PC and previous frame pointer */ \
- else \
- { \
- int regno; \
- int offset = 0; \
- \
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
- if ((regs_ever_live[regno] && ! call_used_regs[regno]) \
- || (current_function_uses_pic_offset_table \
- && regno == PIC_OFFSET_TABLE_REGNUM)) \
- offset += 4; \
- \
- (OFFSET) = offset + get_frame_size (); \
- \
- if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- (OFFSET) += 4; /* Skip saved PC */ \
- } \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
- ((REGNO) < STACK_POINTER_REGNUM \
- || (unsigned) reg_renumber[REGNO] < STACK_POINTER_REGNUM)
-
-#define REGNO_OK_FOR_BASE_P(REGNO) \
- ((REGNO) <= STACK_POINTER_REGNUM \
- || (REGNO) == ARG_POINTER_REGNUM \
- || (unsigned) reg_renumber[REGNO] <= STACK_POINTER_REGNUM)
-
-#define REGNO_OK_FOR_SIREG_P(REGNO) ((REGNO) == 4 || reg_renumber[REGNO] == 4)
-#define REGNO_OK_FOR_DIREG_P(REGNO) ((REGNO) == 5 || reg_renumber[REGNO] == 5)
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-
-/* Non strict versions, pseudos are ok */
-#define REG_OK_FOR_INDEX_NONSTRICT_P(X) \
- (REGNO (X) < STACK_POINTER_REGNUM \
- || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-#define REG_OK_FOR_BASE_NONSTRICT_P(X) \
- (REGNO (X) <= STACK_POINTER_REGNUM \
- || REGNO (X) == ARG_POINTER_REGNUM \
- || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-#define REG_OK_FOR_STRREG_NONSTRICT_P(X) \
- (REGNO (X) == 4 || REGNO (X) == 5 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-/* Strict versions, hard registers only */
-#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-#define REG_OK_FOR_STRREG_STRICT_P(X) \
- (REGNO_OK_FOR_DIREG_P (REGNO (X)) || REGNO_OK_FOR_SIREG_P (REGNO (X)))
-
-#ifndef REG_OK_STRICT
-#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X)
-#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X)
-#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_NONSTRICT_P(X)
-
-#else
-#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P(X)
-#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P(X)
-#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_STRICT_P(X)
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
- except for CONSTANT_ADDRESS_P which is usually machine-independent.
-
- See legitimize_pic_address in i386.c for details as to what
- constitutes a legitimate address when -fpic is used. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-#ifdef REG_OK_STRICT
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ \
- if (legitimate_address_p (MODE, X, 1)) \
- goto ADDR; \
-}
-
-#else
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ \
- if (legitimate_address_p (MODE, X, 0)) \
- goto ADDR; \
-}
-
-#endif
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the 80386, we handle X+REG by loading X into a register R and
- using R+REG. R will go in a general reg and indexing will be used.
- However, if REG is a broken-out memory address or multiplication,
- nothing needs to be done because REG can certainly go in a general reg.
-
- When -fpic is used, special handling is needed for symbolic references.
- See comments by legitimize_pic_address in i386.c for details. */
-
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-{ \
- rtx orig_x = (X); \
- (X) = legitimize_address (X, OLDX, MODE); \
- if (memory_address_p (MODE, X)) \
- goto WIN; \
-}
-
-#define REWRITE_ADDRESS(x) rewrite_address(x)
-
-/* Nonzero if the constant value X is a legitimate general operand
- when generating PIC code. It is given that flag_pic is on and
- that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_PIC_OPERAND_P(X) \
- (! SYMBOLIC_CONST (X) \
- || (GET_CODE (X) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (X)))
-
-#define SYMBOLIC_CONST(X) \
-(GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == LABEL_REF \
- || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the 80386, only postdecrement and postincrement address depend thus
- (the amount of decrement or increment being the length of the operand). */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL
-
-/* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
- so that we may access it directly in the GOT. */
-
-#define ENCODE_SECTION_INFO(DECL) \
-do \
- { \
- if (flag_pic) \
- { \
- rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
- \
- if (TARGET_DEBUG_ADDR \
- && TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd') \
- { \
- fprintf (stderr, "Encode %s, public = %s\n", \
- IDENTIFIER_POINTER (DECL_NAME (DECL)), \
- TREE_PUBLIC (DECL)); \
- } \
- \
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
- = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- || ! TREE_PUBLIC (DECL)); \
- } \
- } \
-while (0)
-
-/* Initialize data used by insn expanders. This is called from
- init_emit, once for each function, before code is generated.
- For 386, clear stack slot assignments remembered from previous
- functions. */
-
-#define INIT_EXPANDERS clear_386_stack_locals ()
-
-/* The `FINALIZE_PIC' macro serves as a hook to emit these special
- codes once the function is being compiled into assembly code, but
- not before. (It is not done before, because in the case of
- compiling an inline function, it would lead to multiple PIC
- prologues being included in functions which used inline functions
- and were compiled to assembly language.) */
-
-#define FINALIZE_PIC \
-do \
- { \
- extern int current_function_uses_pic_offset_table; \
- \
- current_function_uses_pic_offset_table |= profile_flag | profile_block_flag; \
- } \
-while (0)
-
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
- with arguments ARGS is a valid machine specific attribute for DECL.
- The attributes in ATTRIBUTES have previously been assigned to DECL. */
-
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
- (i386_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
- with arguments ARGS is a valid machine specific attribute for TYPE.
- The attributes in ATTRIBUTES have previously been assigned to TYPE. */
-
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
- (i386_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
-
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (i386_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-/* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
-
-/* Max number of args passed in registers. If this is more than 3, we will
- have problems with ebx (register #4), since it is a caller save register and
- is also used as the pic register in ELF. So for now, don't allow more than
- 3 registers to be passed in registers. */
-
-#define REGPARM_MAX 3
-
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE Pmode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers.
- This should be changed to take advantage of fist --wfs ??
- */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* The number of scalar move insns which should be generated instead
- of a string move insn or a library call. Increasing the value
- will always make code faster, but eventually incurs high cost in
- increased code size.
-
- If you don't define this, a reasonable default is used.
-
- Make this large on i386, since the block move is very inefficient with small
- blocks, and the hard register needs of the block move require much reload
- work. */
-
-#define MOVE_RATIO 5
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-/* On i386, shifts do truncate the count. But bit opcodes don't. */
-
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE 1
-
-/* When a prototype says `char' or `short', really pass an `int'.
- (The 386 can't easily push less than an int.) */
-
-#define PROMOTE_PROTOTYPES
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* A part of a C `switch' statement that describes the relative costs
- of constant RTL expressions. It must contain `case' labels for
- expression codes `const_int', `const', `symbol_ref', `label_ref'
- and `const_double'. Each case must ultimately reach a `return'
- statement to return the relative cost of the use of that kind of
- constant value in an expression. The cost may depend on the
- precise value of the constant, which is available for examination
- in X, and the rtx code of the expression in which it is contained,
- found in OUTER_CODE.
-
- CODE is the expression code--redundant, since it can be obtained
- with `GET_CODE (X)'. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return flag_pic && SYMBOLIC_CONST (RTX) ? 2 : 1; \
- \
- case CONST_DOUBLE: \
- { \
- int code; \
- if (GET_MODE (RTX) == VOIDmode) \
- return 2; \
- \
- code = standard_80387_constant_p (RTX); \
- return code == 1 ? 0 : \
- code == 2 ? 1 : \
- 2; \
- }
-
-/* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */
-#define TOPLEVEL_COSTS_N_INSNS(N) {total = COSTS_N_INSNS (N); break;}
-
-/* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
- This can be used, for example, to indicate how costly a multiply
- instruction is. In writing this macro, you can use the construct
- `COSTS_N_INSNS (N)' to specify a cost equal to N fast
- instructions. OUTER_CODE is the code of the expression in which X
- is contained.
-
- This macro is optional; do not define it if the default cost
- assumptions are adequate for the target machine. */
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case ASHIFT: \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && GET_MODE (XEXP (X, 0)) == SImode) \
- { \
- HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
- \
- if (value == 1) \
- return COSTS_N_INSNS (ix86_cost->add) \
- + rtx_cost(XEXP (X, 0), OUTER_CODE); \
- \
- if (value == 2 || value == 3) \
- return COSTS_N_INSNS (ix86_cost->lea) \
- + rtx_cost(XEXP (X, 0), OUTER_CODE); \
- } \
- /* fall through */ \
- \
- case ROTATE: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- case ROTATERT: \
- if (GET_MODE (XEXP (X, 0)) == DImode) \
- { \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
- if (INTVAL (XEXP (X, 1)) > 32) \
- return COSTS_N_INSNS(ix86_cost->shift_const + 2); \
- else \
- return COSTS_N_INSNS(ix86_cost->shift_const * 2); \
- return ((GET_CODE (XEXP (X, 1)) == AND \
- ? COSTS_N_INSNS(ix86_cost->shift_var * 2) \
- : COSTS_N_INSNS(ix86_cost->shift_var * 6 + 2)) \
- + rtx_cost(XEXP (X, 0), OUTER_CODE)); \
- } \
- return COSTS_N_INSNS (GET_CODE (XEXP (X, 1)) == CONST_INT \
- ? ix86_cost->shift_const \
- : ix86_cost->shift_var) \
- + rtx_cost(XEXP (X, 0), OUTER_CODE); \
- \
- case MULT: \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
- { \
- unsigned HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \
- int nbits = 0; \
- \
- if (value == 2) \
- return COSTS_N_INSNS (ix86_cost->add) \
- + rtx_cost(XEXP (X, 0), OUTER_CODE); \
- if (value == 4 || value == 8) \
- return COSTS_N_INSNS (ix86_cost->lea) \
- + rtx_cost(XEXP (X, 0), OUTER_CODE); \
- \
- while (value != 0) \
- { \
- nbits++; \
- value >>= 1; \
- } \
- \
- if (nbits == 1) \
- return COSTS_N_INSNS (ix86_cost->shift_const) \
- + rtx_cost(XEXP (X, 0), OUTER_CODE); \
- \
- return COSTS_N_INSNS (ix86_cost->mult_init \
- + nbits * ix86_cost->mult_bit) \
- + rtx_cost(XEXP (X, 0), OUTER_CODE); \
- } \
- \
- else /* This is arbitrary */ \
- TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \
- + 7 * ix86_cost->mult_bit); \
- \
- case DIV: \
- case UDIV: \
- case MOD: \
- case UMOD: \
- TOPLEVEL_COSTS_N_INSNS (ix86_cost->divide); \
- \
- case PLUS: \
- if (GET_CODE (XEXP (X, 0)) == REG \
- && GET_MODE (XEXP (X, 0)) == SImode \
- && GET_CODE (XEXP (X, 1)) == PLUS) \
- return COSTS_N_INSNS (ix86_cost->lea); \
- \
- /* fall through */ \
- case AND: \
- case IOR: \
- case XOR: \
- case MINUS: \
- if (GET_MODE (X) == DImode) \
- return COSTS_N_INSNS (ix86_cost->add) * 2 \
- + (rtx_cost (XEXP (X, 0), OUTER_CODE) \
- << (GET_MODE (XEXP (X, 0)) != DImode)) \
- + (rtx_cost (XEXP (X, 1), OUTER_CODE) \
- << (GET_MODE (XEXP (X, 1)) != DImode)); \
- case NEG: \
- case NOT: \
- if (GET_MODE (X) == DImode) \
- TOPLEVEL_COSTS_N_INSNS (ix86_cost->add * 2) \
- TOPLEVEL_COSTS_N_INSNS (ix86_cost->add)
-
-
-/* An expression giving the cost of an addressing mode that contains
- ADDRESS. If not defined, the cost is computed from the ADDRESS
- expression and the `CONST_COSTS' values.
-
- For most CISC machines, the default cost is a good approximation
- of the true cost of the addressing mode. However, on RISC
- machines, all instructions normally have the same length and
- execution time. Hence all addresses will have equal costs.
-
- In cases where more than one form of an address is known, the form
- with the lowest cost will be used. If multiple forms have the
- same, lowest, cost, the one that is the most complex will be used.
-
- For example, suppose an address that is equal to the sum of a
- register and a constant is used twice in the same basic block.
- When this macro is not defined, the address will be computed in a
- register and memory references will be indirect through that
- register. On machines where the cost of the addressing mode
- containing the sum is no higher than that of a simple indirect
- reference, this will produce an additional instruction and
- possibly require an additional register. Proper specification of
- this macro eliminates this overhead for such machines.
-
- Similar use of this macro is made in strength reduction of loops.
-
- ADDRESS need not be valid as an address. In such a case, the cost
- is not relevant and can be any value; invalid addresses need not be
- assigned a different cost.
-
- On machines where an address involving more than one register is as
- cheap as an address computation involving only one register,
- defining `ADDRESS_COST' to reflect this can cause two registers to
- be live over a region of code where only one would have been if
- `ADDRESS_COST' were not defined in that manner. This effect should
- be considered in the definition of this macro. Equivalent costs
- should probably only be given to addresses with different numbers
- of registers on machines with lots of registers.
-
- This macro will normally either not be defined or be defined as a
- constant.
-
- For i386, it is better to use a complex address than let gcc copy
- the address into a reg and make a new pseudo. But not if the address
- requires to two regs - that would mean more pseudos with longer
- lifetimes. */
-
-#define ADDRESS_COST(RTX) \
- ((CONSTANT_P (RTX) \
- || (GET_CODE (RTX) == PLUS && CONSTANT_P (XEXP (RTX, 1)) \
- && REG_P (XEXP (RTX, 0)))) ? 0 \
- : REG_P (RTX) ? 1 \
- : 2)
-
-/* A C expression for the cost of moving data of mode M between a
- register and memory. A value of 2 is the default; this cost is
- relative to those in `REGISTER_MOVE_COST'.
-
- If moving between registers and memory is more expensive than
- between two registers, you should define this macro to express the
- relative cost.
-
- On the i386, copying between floating-point and fixed-point
- registers is expensive. */
-
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- (((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \
- || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2))) ? 10 \
- : 2)
-
-
-/* A C expression for the cost of moving data of mode M between a
- register and memory. A value of 2 is the default; this cost is
- relative to those in `REGISTER_MOVE_COST'.
-
- If moving between registers and memory is more expensive than
- between two registers, you should define this macro to express the
- relative cost. */
-
-/* #define MEMORY_MOVE_COST(M) 2 */
-
-/* A C expression for the cost of a branch instruction. A value of 1
- is the default; other values are interpreted relative to that. */
-
-#define BRANCH_COST i386_branch_cost
-
-/* Define this macro as a C expression which is nonzero if accessing
- less than a word of memory (i.e. a `char' or a `short') is no
- faster than accessing a word of memory, i.e., if such access
- require more than one instruction or if there is no difference in
- cost between byte and (aligned) word loads.
-
- When this macro is not defined, the compiler will access a field by
- finding the smallest containing object; when it is defined, a
- fullword load will be used if alignment permits. Unless bytes
- accesses are faster than word accesses, using word accesses is
- preferable since it may eliminate subsequent memory access if
- subsequent accesses occur to other fields in the same word of the
- structure, but to different bytes. */
-
-#define SLOW_BYTE_ACCESS 0
-
-/* Nonzero if access to memory by shorts is slow and undesirable. */
-#define SLOW_SHORT_ACCESS 0
-
-/* Define this macro if zero-extension (of a `char' or `short' to an
- `int') can be done faster if the destination is a register that is
- known to be zero.
-
- If you define this macro, you must have instruction patterns that
- recognize RTL structures like this:
-
- (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
-
- and likewise for `HImode'. */
-
-/* #define SLOW_ZERO_EXTEND */
-
-/* Define this macro to be the value 1 if unaligned accesses have a
- cost many times greater than aligned accesses, for example if they
- are emulated in a trap handler.
-
- When this macro is non-zero, the compiler will act as if
- `STRICT_ALIGNMENT' were non-zero when generating code for block
- moves. This can cause significantly more instructions to be
- produced. Therefore, do not set this macro non-zero if unaligned
- accesses only add a cycle or two to the time for a memory access.
-
- If the value of this macro is always zero, it need not be defined. */
-
-/* #define SLOW_UNALIGNED_ACCESS 0 */
-
-/* Define this macro to inhibit strength reduction of memory
- addresses. (On some machines, such strength reduction seems to do
- harm rather than good.) */
-
-/* #define DONT_REDUCE_ADDR */
-
-/* Define this macro if it is as good or better to call a constant
- function address than to call an address kept in a register.
-
- Desirable on the 386 because a CALL with a constant address is
- faster than one with a register address. */
-
-#define NO_FUNCTION_CSE
-
-/* Define this macro if it is as good or better for a function to call
- itself with an explicit address than to call an address kept in a
- register. */
-
-#define NO_RECURSIVE_FUNCTION_CSE
-
-/* A C statement (sans semicolon) to update the integer variable COST
- based on the relationship between INSN that is dependent on
- DEP_INSN through the dependence LINK. The default is to make no
- adjustment to COST. This can be used for example to specify to
- the scheduler that an output- or anti-dependence does not incur
- the same cost as a data-dependence. */
-
-#define ADJUST_COST(insn,link,dep_insn,cost) \
- { \
- rtx next_inst; \
- if (GET_CODE (dep_insn) == CALL_INSN) \
- (cost) = 0; \
- \
- else if (GET_CODE (dep_insn) == INSN \
- && GET_CODE (PATTERN (dep_insn)) == SET \
- && GET_CODE (SET_DEST (PATTERN (dep_insn))) == REG \
- && GET_CODE (insn) == INSN \
- && GET_CODE (PATTERN (insn)) == SET \
- && !reg_overlap_mentioned_p (SET_DEST (PATTERN (dep_insn)), \
- SET_SRC (PATTERN (insn)))) \
- { \
- (cost) = 0; \
- } \
- \
- else if (GET_CODE (insn) == JUMP_INSN) \
- { \
- (cost) = 0; \
- } \
- \
- if (TARGET_PENTIUM) \
- { \
- if (cost !=0 && is_fp_insn (insn) && is_fp_insn (dep_insn) \
- && !is_fp_dest (dep_insn)) \
- { \
- (cost) = 0; \
- } \
- \
- if (agi_dependent (insn, dep_insn)) \
- { \
- (cost) = 3; \
- } \
- else if (GET_CODE (insn) == INSN \
- && GET_CODE (PATTERN (insn)) == SET \
- && SET_DEST (PATTERN (insn)) == cc0_rtx \
- && (next_inst = next_nonnote_insn (insn)) \
- && GET_CODE (next_inst) == JUMP_INSN) \
- { /* compare probably paired with jump */ \
- (cost) = 0; \
- } \
- } \
- else \
- if (!is_fp_dest (dep_insn)) \
- { \
- if(!agi_dependent (insn, dep_insn)) \
- (cost) = 0; \
- else if (TARGET_486) \
- (cost) = 2; \
- } \
- else \
- if (is_fp_store (insn) && is_fp_insn (dep_insn) \
- && NEXT_INSN (insn) && NEXT_INSN (NEXT_INSN (insn)) \
- && NEXT_INSN (NEXT_INSN (NEXT_INSN (insn))) \
- && (GET_CODE (NEXT_INSN (insn)) == INSN) \
- && (GET_CODE (NEXT_INSN (NEXT_INSN (insn))) == JUMP_INSN) \
- && (GET_CODE (NEXT_INSN (NEXT_INSN (NEXT_INSN (insn)))) == NOTE) \
- && (NOTE_LINE_NUMBER (NEXT_INSN (NEXT_INSN (NEXT_INSN (insn)))) \
- == NOTE_INSN_LOOP_END)) \
- { \
- (cost) = 3; \
- } \
- }
-
-
-#define ADJUST_BLOCKAGE(last_insn,insn,blockage) \
-{ \
- if (is_fp_store (last_insn) && is_fp_insn (insn) \
- && NEXT_INSN (last_insn) && NEXT_INSN (NEXT_INSN (last_insn)) \
- && NEXT_INSN (NEXT_INSN (NEXT_INSN (last_insn))) \
- && (GET_CODE (NEXT_INSN (last_insn)) == INSN) \
- && (GET_CODE (NEXT_INSN (NEXT_INSN (last_insn))) == JUMP_INSN) \
- && (GET_CODE (NEXT_INSN (NEXT_INSN (NEXT_INSN (last_insn)))) == NOTE) \
- && (NOTE_LINE_NUMBER (NEXT_INSN (NEXT_INSN (NEXT_INSN (last_insn)))) \
- == NOTE_INSN_LOOP_END)) \
- { \
- (blockage) = 3; \
- } \
-}
-
-
-/* Add any extra modes needed to represent the condition code.
-
- For the i386, we need separate modes when floating-point equality
- comparisons are being done. */
-
-#define EXTRA_CC_MODES CCFPEQmode
-
-/* Define the names for the modes specified above. */
-#define EXTRA_CC_NAMES "CCFPEQ"
-
-/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
- return the mode to be used for the comparison.
-
- For floating-point equality comparisons, CCFPEQmode should be used.
- VOIDmode should be used in all other cases. */
-
-#define SELECT_CC_MODE(OP,X,Y) \
- (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- && ((OP) == EQ || (OP) == NE) ? CCFPEQmode : VOIDmode)
-
-/* Define the information needed to generate branch and scc insns. This is
- stored from the compare operation. Note that we can't use "rtx" here
- since it hasn't been defined! */
-
-extern struct rtx_def *(*i386_compare_gen)(), *(*i386_compare_gen_eq)();
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-/* Set if the cc value was actually from the 80387 and
- we are testing eax directly (i.e. no sahf) */
-#define CC_TEST_AX 020000
-
-/* Set if the cc value is actually in the 80387, so a floating point
- conditional branch must be output. */
-#define CC_IN_80387 04000
-
-/* Set if the CC value was stored in a nonstandard way, so that
- the state of equality is indicated by zero in the carry bit. */
-#define CC_Z_IN_NOT_C 010000
-
-/* Set if the CC value was actually from the 80387 and loaded directly
- into the eflags instead of via eax/sahf. */
-#define CC_FCOMI 040000
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
- notice_update_cc((EXP))
-
-/* Output a signed jump insn. Use template NORMAL ordinarily, or
- FLOAT following a floating point comparison.
- Use NO_OV following an arithmetic insn that set the cc's
- before a test insn that was deleted.
- NO_OV may be zero, meaning final should reinsert the test insn
- because the jump cannot be handled properly without it. */
-
-#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
-{ \
- if (cc_prev_status.flags & CC_IN_80387) \
- return FLOAT; \
- if (cc_prev_status.flags & CC_NO_OVERFLOW) \
- return NO_OV; \
- return NORMAL; \
-}
-
-/* Control the assembler format that we output, to the extent
- this does not vary between assemblers. */
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-/* In order to refer to the first 8 regs as 32 bit regs prefix an "e"
- For non floating point regs, the following are the HImode names.
-
- For float regs, the stack top is sometimes referred to as "%st(0)"
- instead of just "%st". PRINT_REG handles this with the "y" code. */
-
-#define HI_REGISTER_NAMES \
-{"ax","dx","cx","bx","si","di","bp","sp", \
- "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","" }
-
-#define REGISTER_NAMES HI_REGISTER_NAMES
-
-/* Table of additional register names to use in user input. */
-
-#define ADDITIONAL_REGISTER_NAMES \
-{ "eax", 0, "edx", 1, "ecx", 2, "ebx", 3, \
- "esi", 4, "edi", 5, "ebp", 6, "esp", 7, \
- "al", 0, "dl", 1, "cl", 2, "bl", 3, \
- "ah", 0, "dh", 1, "ch", 2, "bh", 3 }
-
-/* Note we are omitting these since currently I don't know how
-to get gcc to use these, since they want the same but different
-number as al, and ax.
-*/
-
-/* note the last four are not really qi_registers, but
- the md will have to never output movb into one of them
- only a movw . There is no movb into the last four regs */
-
-#define QI_REGISTER_NAMES \
-{"al", "dl", "cl", "bl", "si", "di", "bp", "sp",}
-
-/* These parallel the array above, and can be used to access bits 8:15
- of regs 0 through 3. */
-
-#define QI_HIGH_REGISTER_NAMES \
-{"ah", "dh", "ch", "bh", }
-
-/* How to renumber registers for dbx and gdb. */
-
-/* {0,2,1,3,6,7,4,5,12,13,14,15,16,17} */
-#define DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 : \
- (n) == 1 ? 2 : \
- (n) == 2 ? 1 : \
- (n) == 3 ? 3 : \
- (n) == 4 ? 6 : \
- (n) == 5 ? 7 : \
- (n) == 6 ? 4 : \
- (n) == 7 ? 5 : \
- (n) + 4)
-
-/* Before the prologue, RA is at 0(%esp). */
-#define INCOMING_RETURN_ADDR_RTX \
- gen_rtx (MEM, VOIDmode, gen_rtx (REG, VOIDmode, STACK_POINTER_REGNUM))
-
-/* PC is dbx register 8; let's use that column for RA. */
-#define DWARF_FRAME_RETURN_COLUMN 8
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- (assemble_name (FILE, NAME), fputs (":\n", FILE))
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "%s 0x%x,0x%x\n", ASM_LONG, l[0], l[1]); \
- else \
- fprintf (FILE, "%s 0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \
- } while (0)
-
-/* This is how to output a `long double' extended real constant. */
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long l[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "%s 0x%x,0x%x,0x%x\n", ASM_LONG, l[0], l[1], l[2]); \
- else \
- fprintf (FILE, "%s 0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- fprintf ((FILE), "%s 0x%x\n", ASM_LONG, l); \
- else \
- fprintf ((FILE), "%s 0x%lx\n", ASM_LONG, l); \
- } while (0)
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "%s ", ASM_LONG), \
- output_addr_const (FILE,(VALUE)), \
- putc('\n',FILE))
-
-/* Likewise for `char' and `short' constants. */
-/* is this supposed to do align too?? */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "%s ", ASM_SHORT), \
- output_addr_const (FILE,(VALUE)), \
- putc('\n',FILE))
-
-/*
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "%s ", ASM_BYTE_OP), \
- output_addr_const (FILE,(VALUE)), \
- fputs (",", FILE), \
- output_addr_const (FILE,(VALUE)), \
- fputs (" >> 8\n",FILE))
-*/
-
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "%s ", ASM_BYTE_OP), \
- output_addr_const (FILE, (VALUE)), \
- putc ('\n', FILE))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf ((FILE), "%s 0x%x\n", ASM_BYTE_OP, (VALUE))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tpushl e%s\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tpopl e%s\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute.
- */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "%s %s%d\n", ASM_LONG, LPREFIX, VALUE)
-
-/* This is how to output an element of a case-vector that is relative.
- We don't use these on the 386 yet, because the ATT assembler can't do
- forward reference the differences.
- */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word %s%d-%s%d\n",LPREFIX, VALUE,LPREFIX, REL)
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN ""
-#define ASM_CLOSE_PAREN ""
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- The CODE z takes the size of operand from the following digit, and
- outputs b,w,or l respectively.
-
- On the 80386, we use several such letters:
- f -- float insn (print a CONST_DOUBLE as a float rather than in hex).
- L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
- R -- print the prefix for register names.
- z -- print the opcode suffix for the size of the current operand.
- * -- print a star (in certain assembler syntax)
- w -- print the operand as if it's a "word" (HImode) even if it isn't.
- b -- print the operand as if it's a byte (QImode) even if it isn't.
- c -- don't print special prefixes before constant operands. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '*')
-
-/* Print the name of a register based on its machine mode and number.
- If CODE is 'w', pretend the mode is HImode.
- If CODE is 'b', pretend the mode is QImode.
- If CODE is 'k', pretend the mode is SImode.
- If CODE is 'h', pretend the reg is the `high' byte register.
- If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op. */
-
-extern char *hi_reg_name[];
-extern char *qi_reg_name[];
-extern char *qi_high_reg_name[];
-
-#define PRINT_REG(X, CODE, FILE) \
- do { if (REGNO (X) == ARG_POINTER_REGNUM) \
- abort (); \
- fprintf (FILE, "%s", RP); \
- switch ((CODE == 'w' ? 2 \
- : CODE == 'b' ? 1 \
- : CODE == 'k' ? 4 \
- : CODE == 'y' ? 3 \
- : CODE == 'h' ? 0 \
- : GET_MODE_SIZE (GET_MODE (X)))) \
- { \
- case 3: \
- if (STACK_TOP_P (X)) \
- { \
- fputs ("st(0)", FILE); \
- break; \
- } \
- case 4: \
- case 8: \
- case 12: \
- if (! FP_REG_P (X)) fputs ("e", FILE); \
- case 2: \
- fputs (hi_reg_name[REGNO (X)], FILE); \
- break; \
- case 1: \
- fputs (qi_reg_name[REGNO (X)], FILE); \
- break; \
- case 0: \
- fputs (qi_high_reg_name[REGNO (X)], FILE); \
- break; \
- } \
- } while (0)
-
-#define PRINT_OPERAND(FILE, X, CODE) \
- print_operand (FILE, X, CODE)
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address (FILE, ADDR)
-
-/* Print the name of a register for based on its machine mode and number.
- This macro is used to print debugging output.
- This macro is different from PRINT_REG in that it may be used in
- programs that are not linked with aux-output.o. */
-
-#define DEBUG_PRINT_REG(X, CODE, FILE) \
- do { static char *hi_name[] = HI_REGISTER_NAMES; \
- static char *qi_name[] = QI_REGISTER_NAMES; \
- fprintf (FILE, "%d %s", REGNO (X), RP); \
- if (REGNO (X) == ARG_POINTER_REGNUM) \
- { fputs ("argp", FILE); break; } \
- if (STACK_TOP_P (X)) \
- { fputs ("st(0)", FILE); break; } \
- if (FP_REG_P (X)) \
- { fputs (hi_name[REGNO(X)], FILE); break; } \
- switch (GET_MODE_SIZE (GET_MODE (X))) \
- { \
- default: \
- fputs ("e", FILE); \
- case 2: \
- fputs (hi_name[REGNO (X)], FILE); \
- break; \
- case 1: \
- fputs (qi_name[REGNO (X)], FILE); \
- break; \
- } \
- } while (0)
-
-/* Output the prefix for an immediate operand, or for an offset operand. */
-#define PRINT_IMMED_PREFIX(FILE) fputs (IP, (FILE))
-#define PRINT_OFFSET_PREFIX(FILE) fputs (IP, (FILE))
-
-/* Routines in libgcc that return floats must return them in an fp reg,
- just as other functions do which return such values.
- These macros make that happen. */
-
-#define FLOAT_VALUE_TYPE float
-#define INTIFY(FLOATVAL) FLOATVAL
-
-/* Nonzero if INSN magically clobbers register REGNO. */
-
-/* #define INSN_CLOBBERS_REGNO_P(INSN, REGNO) \
- (FP_REGNO_P (REGNO) \
- && (GET_CODE (INSN) == JUMP_INSN || GET_CODE (INSN) == BARRIER))
-*/
-
-/* a letter which is not needed by the normal asm syntax, which
- we can use for operand syntax in the extended asm */
-
-#define ASM_OPERAND_LETTER '#'
-
-#define RET return ""
-#define AT_SP(mode) (gen_rtx (MEM, (mode), stack_pointer_rtx))
-
-/* Helper macros to expand a binary/unary operator if needed */
-#define IX86_EXPAND_BINARY_OPERATOR(OP, MODE, OPERANDS) \
-do { \
- if (!ix86_expand_binary_operator (OP, MODE, OPERANDS)) \
- FAIL; \
-} while (0)
-
-#define IX86_EXPAND_UNARY_OPERATOR(OP, MODE, OPERANDS) \
-do { \
- if (!ix86_expand_unary_operator (OP, MODE, OPERANDS,)) \
- FAIL; \
-} while (0)
-
-
-/* Functions in i386.c */
-extern void override_options ();
-extern void order_regs_for_local_alloc ();
-extern char *output_strlen_unroll ();
-extern struct rtx_def *i386_sext16_if_const ();
-extern int i386_aligned_p ();
-extern int i386_cc_probably_useless_p ();
-extern int i386_valid_decl_attribute_p ();
-extern int i386_valid_type_attribute_p ();
-extern int i386_return_pops_args ();
-extern int i386_comp_type_attributes ();
-extern void init_cumulative_args ();
-extern void function_arg_advance ();
-extern struct rtx_def *function_arg ();
-extern int function_arg_partial_nregs ();
-extern char *output_strlen_unroll ();
-extern void output_op_from_reg ();
-extern void output_to_reg ();
-extern char *singlemove_string ();
-extern char *output_move_double ();
-extern char *output_move_memory ();
-extern char *output_move_pushmem ();
-extern int standard_80387_constant_p ();
-extern char *output_move_const_single ();
-extern int symbolic_operand ();
-extern int call_insn_operand ();
-extern int expander_call_insn_operand ();
-extern int symbolic_reference_mentioned_p ();
-extern int ix86_expand_binary_operator ();
-extern int ix86_binary_operator_ok ();
-extern int ix86_expand_unary_operator ();
-extern int ix86_unary_operator_ok ();
-extern void emit_pic_move ();
-extern void function_prologue ();
-extern int simple_386_epilogue ();
-extern void function_epilogue ();
-extern int legitimate_address_p ();
-extern struct rtx_def *legitimize_pic_address ();
-extern struct rtx_def *legitimize_address ();
-extern void print_operand ();
-extern void print_operand_address ();
-extern void notice_update_cc ();
-extern void split_di ();
-extern int binary_387_op ();
-extern int shift_op ();
-extern int VOIDmode_compare_op ();
-extern char *output_387_binary_op ();
-extern char *output_fix_trunc ();
-extern char *output_float_compare ();
-extern char *output_fp_cc0_set ();
-extern void save_386_machine_status ();
-extern void restore_386_machine_status ();
-extern void clear_386_stack_locals ();
-extern struct rtx_def *assign_386_stack_local ();
-extern int is_mul ();
-extern int is_div ();
-extern int last_to_set_cc ();
-extern int doesnt_set_condition_code ();
-extern int sets_condition_code ();
-extern int str_immediate_operand ();
-extern int is_fp_insn ();
-extern int is_fp_dest ();
-extern int is_fp_store ();
-extern int agi_dependent ();
-extern int reg_mentioned_in_mem ();
-
-#ifdef NOTYET
-extern struct rtx_def *copy_all_rtx ();
-extern void rewrite_address ();
-#endif
-
-/* Variables in i386.c */
-extern char *ix86_cpu_string; /* for -mcpu=<xxx> */
-extern char *ix86_arch_string; /* for -march=<xxx> */
-extern char *i386_reg_alloc_order; /* register allocation order */
-extern char *i386_regparm_string; /* # registers to use to pass args */
-extern char *i386_align_loops_string; /* power of two alignment for loops */
-extern char *i386_align_jumps_string; /* power of two alignment for non-loop jumps */
-extern char *i386_align_funcs_string; /* power of two alignment for functions */
-extern char *i386_branch_cost_string; /* values 1-5: see jump.c */
-extern int i386_regparm; /* i386_regparm_string as a number */
-extern int i386_align_loops; /* power of two alignment for loops */
-extern int i386_align_jumps; /* power of two alignment for non-loop jumps */
-extern int i386_align_funcs; /* power of two alignment for functions */
-extern int i386_branch_cost; /* values 1-5: see jump.c */
-extern char *hi_reg_name[]; /* names for 16 bit regs */
-extern char *qi_reg_name[]; /* names for 8 bit regs (low) */
-extern char *qi_high_reg_name[]; /* names for 8 bit regs (high) */
-extern enum reg_class regclass_map[]; /* smalled class containing REGNO */
-extern struct rtx_def *i386_compare_op0; /* operand 0 for comparisons */
-extern struct rtx_def *i386_compare_op1; /* operand 1 for comparisons */
-
-/* External variables used */
-extern int optimize; /* optimization level */
-extern int obey_regdecls; /* TRUE if stupid register allocation */
-
-/* External functions used */
-extern struct rtx_def *force_operand ();
-
-
-/*
-Local variables:
-version-control: t
-End:
-*/
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
deleted file mode 100644
index b5ef6a77826..00000000000
--- a/gcc/config/i386/i386.md
+++ /dev/null
@@ -1,7572 +0,0 @@
-;; GCC machine description for Intel X86.
-;; Copyright (C) 1988, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
-;; Mostly by William Schelter.
-
-;; 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 original PO technology requires these to be ordered by speed,
-;; so that assigner will pick the fastest.
-
-;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; Macro #define NOTICE_UPDATE_CC in file i386.h handles condition code
-;; updates for most instructions.
-
-;; Macro REG_CLASS_FROM_LETTER in file i386.h defines the register
-;; constraint letters.
-
-;; the special asm out single letter directives following a '%' are:
-;; 'z' mov%z1 would be movl, movw, or movb depending on the mode of
-;; operands[1].
-;; 'L' Print the opcode suffix for a 32-bit integer opcode.
-;; 'W' Print the opcode suffix for a 16-bit integer opcode.
-;; 'B' Print the opcode suffix for an 8-bit integer opcode.
-;; 'Q' Print the opcode suffix for a 64-bit float opcode.
-;; 'S' Print the opcode suffix for a 32-bit float opcode.
-;; 'T' Print the opcode suffix for an 80-bit extended real XFmode float opcode.
-;; 'J' Print the appropriate jump operand.
-
-;; 'b' Print the QImode name of the register for the indicated operand.
-;; %b0 would print %al if operands[0] is reg 0.
-;; 'w' Likewise, print the HImode name of the register.
-;; 'k' Likewise, print the SImode name of the register.
-;; 'h' Print the QImode name for a "high" register, either ah, bh, ch or dh.
-;; 'y' Print "st(0)" instead of "st" as a register.
-
-;; UNSPEC usage:
-;; 0 This is a `scas' operation. The mode of the UNSPEC is always SImode.
-;; operand 0 is the memory address to scan.
-;; operand 1 is a register containing the value to scan for. The mode
-;; of the scas opcode will be the same as the mode of this operand.
-;; operand 2 is the known alignment of operand 0.
-;; 1 This is a `sin' operation. The mode of the UNSPEC is MODE_FLOAT.
-;; operand 0 is the argument for `sin'.
-;; 2 This is a `cos' operation. The mode of the UNSPEC is MODE_FLOAT.
-;; operand 0 is the argument for `cos'.
-;; 3 This is part of a `stack probe' operation. The mode of the UNSPEC is
-;; always SImode. operand 0 is the size of the stack allocation.
-
-;; This shadows the processor_type enumeration, so changes must be made
-;; to i386.h at the same time.
-
-(define_attr "type" "integer,idiv,imul,fld,fpop,fpdiv,fpmul"
- (const_string "integer"))
-
-;; Functional units
-
-; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
-; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
-
-; pentiumpro has a reservation station with 5 ports
-; port 0 has integer, float add, integer divide, float divide, float
-; multiply, and shifter units.
-; port 1 has integer, and jump units.
-; port 2 has the load address generation unit
-; ports 3 and 4 have the store address generation units
-
-; pentium has two integer pipelines, the main u pipe and the secondary v pipe.
-; and a float pipeline
-
-;; Floating point
-
-(define_function_unit "fp" 1 0
- (and (eq_attr "type" "fpop") (eq_attr "cpu" "i386,i486"))
- 5 5)
-
-(define_function_unit "fp" 1 0
- (and (eq_attr "type" "fpop") (eq_attr "cpu" "pentium,pentiumpro"))
- 3 0)
-
-(define_function_unit "fp" 1 0
- (and (eq_attr "type" "fpmul") (eq_attr "cpu" "pentium"))
- 7 0)
-
-(define_function_unit "fp" 1 0
- (and (eq_attr "type" "fpmul") (eq_attr "cpu" "pentiumpro"))
- 5 0)
-
-(define_function_unit "fp" 1 0
- (and (eq_attr "type" "idiv") (eq_attr "cpu" "pentiumpro"))
- 10 10)
-
-(define_function_unit "fp" 1 0
- (and (eq_attr "type" "imul") (eq_attr "cpu" "pentiumpro"))
- 6 0)
-
-(define_function_unit "fp" 1 0
- (eq_attr "type" "fpdiv")
- 10 10)
-
-(define_function_unit "fp" 1 0
- (eq_attr "type" "fld")
- 1 0)
-
-(define_function_unit "integer" 1 0
- (and (eq_attr "type" "integer") (eq_attr "cpu" "!i386"))
- 2 0)
-
-
-;; "movl MEM,REG / testl REG,REG" is faster on a 486 than "cmpl $0,MEM".
-;; But restricting MEM here would mean that gcc could not remove a redundant
-;; test in cases like "incl MEM / je TARGET".
-;;
-;; We don't want to allow a constant operand for test insns because
-;; (set (cc0) (const_int foo)) has no mode information. Such insns will
-;; be folded while optimizing anyway.
-
-;; All test insns have expanders that save the operands away without
-;; actually generating RTL. The bCOND or sCOND (emitted immediately
-;; after the tstM or cmp) will actually emit the tstM or cmpM.
-
-;; Processor type -- this attribute must exactly match the processor_type
-;; enumeration in i386.h.
-
-(define_attr "cpu" "i386,i486,pentium,pentiumpro"
- (const (symbol_ref "ix86_cpu")))
-
-(define_insn "tstsi_1"
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" "rm"))]
- ""
- "*
-{
- if (REG_P (operands[0]))
- return AS2 (test%L0,%0,%0);
-
- operands[1] = const0_rtx;
- return AS2 (cmp%L0,%1,%0);
-}")
-
-(define_expand "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" ""))]
- ""
- "
-{
- i386_compare_gen = gen_tstsi_1;
- i386_compare_op0 = operands[0];
- DONE;
-}")
-
-(define_insn "tsthi_1"
- [(set (cc0)
- (match_operand:HI 0 "nonimmediate_operand" "rm"))]
- ""
- "*
-{
- if (REG_P (operands[0]))
- return AS2 (test%W0,%0,%0);
-
- operands[1] = const0_rtx;
- return AS2 (cmp%W0,%1,%0);
-}")
-
-(define_expand "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "nonimmediate_operand" ""))]
- ""
- "
-{
- i386_compare_gen = gen_tsthi_1;
- i386_compare_op0 = operands[0];
- DONE;
-}")
-
-(define_insn "tstqi_1"
- [(set (cc0)
- (match_operand:QI 0 "nonimmediate_operand" "qm"))]
- ""
- "*
-{
- if (REG_P (operands[0]))
- return AS2 (test%B0,%0,%0);
-
- operands[1] = const0_rtx;
- return AS2 (cmp%B0,%1,%0);
-}")
-
-(define_expand "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "nonimmediate_operand" ""))]
- ""
- "
-{
- i386_compare_gen = gen_tstqi_1;
- i386_compare_op0 = operands[0];
- DONE;
-}")
-
-(define_insn "tstsf_cc"
- [(set (cc0)
- (match_operand:SF 0 "register_operand" "f"))
- (clobber (match_scratch:HI 1 "=a"))]
- "TARGET_80387 && ! TARGET_IEEE_FP"
- "*
-{
- if (! STACK_TOP_P (operands[0]))
- abort ();
-
- output_asm_insn (\"ftst\", operands);
-
- if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))
- output_asm_insn (AS1 (fstp,%y0), operands);
-
- return output_fp_cc0_set (insn);
-}")
-
-;; Don't generate tstsf if generating IEEE code, since the `ftst' opcode
-;; isn't IEEE compliant.
-
-(define_expand "tstsf"
- [(parallel [(set (cc0)
- (match_operand:SF 0 "register_operand" ""))
- (clobber (match_scratch:HI 1 ""))])]
- "TARGET_80387 && ! TARGET_IEEE_FP"
- "
-{
- i386_compare_gen = gen_tstsf_cc;
- i386_compare_op0 = operands[0];
- DONE;
-}")
-
-(define_insn "tstdf_cc"
- [(set (cc0)
- (match_operand:DF 0 "register_operand" "f"))
- (clobber (match_scratch:HI 1 "=a"))]
- "TARGET_80387 && ! TARGET_IEEE_FP"
- "*
-{
- if (! STACK_TOP_P (operands[0]))
- abort ();
-
- output_asm_insn (\"ftst\", operands);
-
- if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))
- output_asm_insn (AS1 (fstp,%y0), operands);
-
- return output_fp_cc0_set (insn);
-}")
-
-;; Don't generate tstdf if generating IEEE code, since the `ftst' opcode
-;; isn't IEEE compliant.
-
-(define_expand "tstdf"
- [(parallel [(set (cc0)
- (match_operand:DF 0 "register_operand" ""))
- (clobber (match_scratch:HI 1 ""))])]
- "TARGET_80387 && ! TARGET_IEEE_FP"
- "
-{
- i386_compare_gen = gen_tstdf_cc;
- i386_compare_op0 = operands[0];
- DONE;
-}")
-
-(define_insn "tstxf_cc"
- [(set (cc0)
- (match_operand:XF 0 "register_operand" "f"))
- (clobber (match_scratch:HI 1 "=a"))]
- "TARGET_80387 && ! TARGET_IEEE_FP"
- "*
-{
- if (! STACK_TOP_P (operands[0]))
- abort ();
-
- output_asm_insn (\"ftst\", operands);
-
- if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))
- output_asm_insn (AS1 (fstp,%y0), operands);
-
- return output_fp_cc0_set (insn);
-}")
-
-;; Don't generate tstxf if generating IEEE code, since the `ftst' opcode
-;; isn't IEEE compliant.
-
-(define_expand "tstxf"
- [(parallel [(set (cc0)
- (match_operand:XF 0 "register_operand" ""))
- (clobber (match_scratch:HI 1 ""))])]
- "TARGET_80387 && ! TARGET_IEEE_FP"
- "
-{
- i386_compare_gen = gen_tstxf_cc;
- i386_compare_op0 = operands[0];
- DONE;
-}")
-
-;;- compare instructions. See comments above tstM patterns about
-;; expansion of these insns.
-
-(define_insn "cmpsi_1"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "mr,r")
- (match_operand:SI 1 "general_operand" "ri,mr")))]
- "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
- "*
-{
- if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)
- {
- cc_status.flags |= CC_REVERSED;
- return AS2 (cmp%L0,%0,%1);
- }
- return AS2 (cmp%L0,%1,%0);
-}")
-
-(define_expand "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "")
- (match_operand:SI 1 "general_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- operands[0] = force_reg (SImode, operands[0]);
-
- i386_compare_gen = gen_cmpsi_1;
- i386_compare_op0 = operands[0];
- i386_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_insn "cmphi_1"
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "mr,r")
- (match_operand:HI 1 "general_operand" "ri,mr")))]
- "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
- "*
-{
- if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)
- {
- cc_status.flags |= CC_REVERSED;
- return AS2 (cmp%W0,%0,%1);
- }
- return AS2 (cmp%W0,%1,%0);
-}")
-
-(define_expand "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "")
- (match_operand:HI 1 "general_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- operands[0] = force_reg (HImode, operands[0]);
-
- i386_compare_gen = gen_cmphi_1;
- i386_compare_op0 = operands[0];
- i386_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_insn "cmpqi_1"
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "q,mq")
- (match_operand:QI 1 "general_operand" "qm,nq")))]
- "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
- "*
-{
- if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)
- {
- cc_status.flags |= CC_REVERSED;
- return AS2 (cmp%B0,%0,%1);
- }
- return AS2 (cmp%B0,%1,%0);
-}")
-
-(define_expand "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "")
- (match_operand:QI 1 "general_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- operands[0] = force_reg (QImode, operands[0]);
-
- i386_compare_gen = gen_cmpqi_1;
- i386_compare_op0 = operands[0];
- i386_compare_op1 = operands[1];
- DONE;
-}")
-
-;; These implement float point compares. For each of DFmode and
-;; SFmode, there is the normal insn, and an insn where the second operand
-;; is converted to the desired mode.
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(match_operand:XF 0 "register_operand" "f")
- (match_operand:XF 1 "register_operand" "f")]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(match_operand:XF 0 "register_operand" "f")
- (float:XF
- (match_operand:SI 1 "nonimmediate_operand" "rm"))]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(float:XF
- (match_operand:SI 0 "nonimmediate_operand" "rm"))
- (match_operand:XF 1 "register_operand" "f")]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(match_operand:XF 0 "register_operand" "f")
- (float_extend:XF
- (match_operand:DF 1 "nonimmediate_operand" "fm"))]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(float_extend:XF
- (match_operand:DF 1 "nonimmediate_operand" "fm"))
- (match_operand:XF 0 "register_operand" "f")]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(match_operand:XF 0 "register_operand" "f")
- (float_extend:XF
- (match_operand:SF 1 "nonimmediate_operand" "fm"))]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (compare:CCFPEQ (match_operand:XF 0 "register_operand" "f")
- (match_operand:XF 1 "register_operand" "f")))
- (clobber (match_scratch:HI 2 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(match_operand:DF 0 "nonimmediate_operand" "f,fm")
- (match_operand:DF 1 "nonimmediate_operand" "fm,f")]))
- (clobber (match_scratch:HI 3 "=a,a"))]
- "TARGET_80387
- && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(match_operand:DF 0 "register_operand" "f")
- (float:DF
- (match_operand:SI 1 "nonimmediate_operand" "rm"))]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(float:DF
- (match_operand:SI 0 "nonimmediate_operand" "rm"))
- (match_operand:DF 1 "register_operand" "f")]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(match_operand:DF 0 "register_operand" "f")
- (float_extend:DF
- (match_operand:SF 1 "nonimmediate_operand" "fm"))]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(float_extend:DF
- (match_operand:SF 0 "nonimmediate_operand" "fm"))
- (match_operand:DF 1 "register_operand" "f")]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(float_extend:DF
- (match_operand:SF 0 "register_operand" "f"))
- (match_operand:DF 1 "nonimmediate_operand" "fm")]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (compare:CCFPEQ (match_operand:DF 0 "register_operand" "f")
- (match_operand:DF 1 "register_operand" "f")))
- (clobber (match_scratch:HI 2 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-;; These two insns will never be generated by combine due to the mode of
-;; the COMPARE.
-;(define_insn ""
-; [(set (cc0)
-; (compare:CCFPEQ (match_operand:DF 0 "register_operand" "f")
-; (float_extend:DF
-; (match_operand:SF 1 "register_operand" "f"))))
-; (clobber (match_scratch:HI 2 "=a"))]
-; "TARGET_80387"
-; "* return output_float_compare (insn, operands);")
-;
-;(define_insn ""
-; [(set (cc0)
-; (compare:CCFPEQ (float_extend:DF
-; (match_operand:SF 0 "register_operand" "f"))
-; (match_operand:DF 1 "register_operand" "f")))
-; (clobber (match_scratch:HI 2 "=a"))]
-; "TARGET_80387"
-; "* return output_float_compare (insn, operands);")
-
-(define_insn "cmpsf_cc_1"
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(match_operand:SF 0 "nonimmediate_operand" "f,fm")
- (match_operand:SF 1 "nonimmediate_operand" "fm,f")]))
- (clobber (match_scratch:HI 3 "=a,a"))]
- "TARGET_80387
- && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(match_operand:SF 0 "register_operand" "f")
- (float:SF
- (match_operand:SI 1 "nonimmediate_operand" "rm"))]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (match_operator 2 "VOIDmode_compare_op"
- [(float:SF
- (match_operand:SI 0 "nonimmediate_operand" "rm"))
- (match_operand:SF 1 "register_operand" "f")]))
- (clobber (match_scratch:HI 3 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_insn ""
- [(set (cc0)
- (compare:CCFPEQ (match_operand:SF 0 "register_operand" "f")
- (match_operand:SF 1 "register_operand" "f")))
- (clobber (match_scratch:HI 2 "=a"))]
- "TARGET_80387"
- "* return output_float_compare (insn, operands);")
-
-(define_expand "cmpxf"
- [(set (cc0)
- (compare (match_operand:XF 0 "register_operand" "")
- (match_operand:XF 1 "register_operand" "")))]
- "TARGET_80387"
- "
-{
- i386_compare_gen = gen_cmpxf_cc;
- i386_compare_gen_eq = gen_cmpxf_ccfpeq;
- i386_compare_op0 = operands[0];
- i386_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_expand "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "register_operand" "")
- (match_operand:DF 1 "general_operand" "")))]
- "TARGET_80387"
- "
-{
- i386_compare_gen = gen_cmpdf_cc;
- i386_compare_gen_eq = gen_cmpdf_ccfpeq;
- i386_compare_op0 = operands[0];
- i386_compare_op1 = (immediate_operand (operands[1], DFmode))
- ? copy_to_mode_reg (DFmode, operands[1]) : operands[1];
- DONE;
-}")
-
-(define_expand "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "register_operand" "")
- (match_operand:SF 1 "general_operand" "")))]
- "TARGET_80387"
- "
-{
- i386_compare_gen = gen_cmpsf_cc;
- i386_compare_gen_eq = gen_cmpsf_ccfpeq;
- i386_compare_op0 = operands[0];
- i386_compare_op1 = (immediate_operand (operands[1], SFmode))
- ? copy_to_mode_reg (SFmode, operands[1]) : operands[1];
- DONE;
-}")
-
-(define_expand "cmpxf_cc"
- [(parallel [(set (cc0)
- (compare (match_operand:XF 0 "register_operand" "")
- (match_operand:XF 1 "register_operand" "")))
- (clobber (match_scratch:HI 2 ""))])]
- "TARGET_80387"
- "")
-
-(define_expand "cmpxf_ccfpeq"
- [(parallel [(set (cc0)
- (compare:CCFPEQ (match_operand:XF 0 "register_operand" "")
- (match_operand:XF 1 "register_operand" "")))
- (clobber (match_scratch:HI 2 ""))])]
- "TARGET_80387"
- "")
-
-(define_expand "cmpdf_cc"
- [(parallel [(set (cc0)
- (compare (match_operand:DF 0 "register_operand" "")
- (match_operand:DF 1 "register_operand" "")))
- (clobber (match_scratch:HI 2 ""))])]
- "TARGET_80387"
- "")
-
-(define_expand "cmpdf_ccfpeq"
- [(parallel [(set (cc0)
- (compare:CCFPEQ (match_operand:DF 0 "register_operand" "")
- (match_operand:DF 1 "register_operand" "")))
- (clobber (match_scratch:HI 2 ""))])]
- "TARGET_80387"
- "
-{
- if (! register_operand (operands[1], DFmode))
- operands[1] = copy_to_mode_reg (DFmode, operands[1]);
-}")
-
-(define_expand "cmpsf_cc"
- [(parallel [(set (cc0)
- (compare (match_operand:SF 0 "register_operand" "")
- (match_operand:SF 1 "register_operand" "")))
- (clobber (match_scratch:HI 2 ""))])]
- "TARGET_80387"
- "")
-
-(define_expand "cmpsf_ccfpeq"
- [(parallel [(set (cc0)
- (compare:CCFPEQ (match_operand:SF 0 "register_operand" "")
- (match_operand:SF 1 "register_operand" "")))
- (clobber (match_scratch:HI 2 ""))])]
- "TARGET_80387"
- "
-{
- if (! register_operand (operands[1], SFmode))
- operands[1] = copy_to_mode_reg (SFmode, operands[1]);
-}")
-
-;; logical compare
-
-(define_insn ""
- [(set (cc0)
- (and:SI (match_operand:SI 0 "general_operand" "%ro")
- (match_operand:SI 1 "nonmemory_operand" "ri")))]
- ""
- "*
-{
- /* For small integers, we may actually use testb. */
- if (GET_CODE (operands[1]) == CONST_INT
- && ! (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))
- && (! REG_P (operands[0]) || QI_REG_P (operands[0])))
- {
- /* We may set the sign bit spuriously. */
-
- if ((INTVAL (operands[1]) & ~0xff) == 0)
- {
- cc_status.flags |= CC_NOT_NEGATIVE;
- return AS2 (test%B0,%1,%b0);
- }
-
- if ((INTVAL (operands[1]) & ~0xff00) == 0)
- {
- cc_status.flags |= CC_NOT_NEGATIVE;
- operands[1] = GEN_INT (INTVAL (operands[1]) >> 8);
-
- if (QI_REG_P (operands[0]))
- return AS2 (test%B0,%1,%h0);
- else
- {
- operands[0] = adj_offsettable_operand (operands[0], 1);
- return AS2 (test%B0,%1,%b0);
- }
- }
-
- if (GET_CODE (operands[0]) == MEM
- && (INTVAL (operands[1]) & ~0xff0000) == 0)
- {
- cc_status.flags |= CC_NOT_NEGATIVE;
- operands[1] = GEN_INT (INTVAL (operands[1]) >> 16);
- operands[0] = adj_offsettable_operand (operands[0], 2);
- return AS2 (test%B0,%1,%b0);
- }
-
- if (GET_CODE (operands[0]) == MEM
- && (INTVAL (operands[1]) & ~0xff000000) == 0)
- {
- operands[1] = GEN_INT ((INTVAL (operands[1]) >> 24) & 0xff);
- operands[0] = adj_offsettable_operand (operands[0], 3);
- return AS2 (test%B0,%1,%b0);
- }
- }
-
- if (CONSTANT_P (operands[1]) || GET_CODE (operands[0]) == MEM)
- return AS2 (test%L0,%1,%0);
-
- return AS2 (test%L1,%0,%1);
-}")
-
-(define_insn ""
- [(set (cc0)
- (and:HI (match_operand:HI 0 "general_operand" "%ro")
- (match_operand:HI 1 "nonmemory_operand" "ri")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT
- && ! (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))
- && (! REG_P (operands[0]) || QI_REG_P (operands[0])))
- {
- if ((INTVAL (operands[1]) & 0xff00) == 0)
- {
- /* ??? This might not be necessary. */
- if (INTVAL (operands[1]) & 0xffff0000)
- operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff);
-
- /* We may set the sign bit spuriously. */
- cc_status.flags |= CC_NOT_NEGATIVE;
- return AS2 (test%B0,%1,%b0);
- }
-
- if ((INTVAL (operands[1]) & 0xff) == 0)
- {
- operands[1] = GEN_INT ((INTVAL (operands[1]) >> 8) & 0xff);
-
- if (QI_REG_P (operands[0]))
- return AS2 (test%B0,%1,%h0);
- else
- {
- operands[0] = adj_offsettable_operand (operands[0], 1);
- return AS2 (test%B0,%1,%b0);
- }
- }
- }
-
- /* use 32-bit test instruction if there are no sign issues */
- if (GET_CODE (operands[1]) == CONST_INT
- && !(INTVAL (operands[1]) & ~0x7fff)
- && i386_aligned_p (operands[0]))
- return AS2 (test%L0,%1,%k0);
-
- if (CONSTANT_P (operands[1]) || GET_CODE (operands[0]) == MEM)
- return AS2 (test%W0,%1,%0);
-
- return AS2 (test%W1,%0,%1);
-}")
-
-(define_insn ""
- [(set (cc0)
- (and:QI (match_operand:QI 0 "nonimmediate_operand" "%qm")
- (match_operand:QI 1 "nonmemory_operand" "qi")))]
- ""
- "*
-{
- if (CONSTANT_P (operands[1]) || GET_CODE (operands[0]) == MEM)
- return AS2 (test%B0,%1,%0);
-
- return AS2 (test%B1,%0,%1);
-}")
-
-;; move instructions.
-;; There is one for each machine mode,
-;; and each is preceded by a corresponding push-insn pattern
-;; (since pushes are not general_operands on the 386).
-
-(define_insn ""
- [(set (match_operand:SI 0 "push_operand" "=<")
- (match_operand:SI 1 "general_operand" "g"))]
- "TARGET_PUSH_MEMORY"
- "push%L0 %1")
-
-;; If not a 386, it is faster to move MEM to a REG and then push, rather than
-;; push MEM directly.
-
-(define_insn ""
- [(set (match_operand:SI 0 "push_operand" "=<")
- (match_operand:SI 1 "nonmemory_operand" "ri"))]
- "!TARGET_PUSH_MEMORY && TARGET_MOVE"
- "push%L0 %1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "push_operand" "=<")
- (match_operand:SI 1 "nonmemory_operand" "ri"))]
- "!TARGET_PUSH_MEMORY && !TARGET_MOVE"
- "push%L0 %1")
-
-;; General case of fullword move.
-
-;; If generating PIC code and operands[1] is a symbolic CONST, emit a
-;; move to get the address of the symbolic object from the GOT.
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- extern int flag_pic;
-
- if (flag_pic && SYMBOLIC_CONST (operands[1]))
- emit_pic_move (operands, SImode);
-
- /* Don't generate memory->memory moves, go through a register */
- else if (TARGET_MOVE
- && (reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) == MEM
- && GET_CODE (operands[1]) == MEM)
- {
- operands[1] = force_reg (SImode, operands[1]);
- }
-}")
-
-;; On i486, incl reg is faster than movl $1,reg.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g,r")
- (match_operand:SI 1 "general_operand" "ri,m"))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- rtx link;
- if (operands[1] == const0_rtx && REG_P (operands[0]))
- return AS2 (xor%L0,%0,%0);
-
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- /* Fastest way to change a 0 to a 1. */
- return AS1 (inc%L0,%0);
-
- if (flag_pic && SYMBOLIC_CONST (operands[1]))
- return AS2 (lea%L0,%a1,%0);
-
- return AS2 (mov%L0,%1,%0);
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "push_operand" "=<")
- (match_operand:HI 1 "general_operand" "g"))]
- "TARGET_PUSH_MEMORY"
- "push%W0 %1")
-
-(define_insn ""
- [(set (match_operand:HI 0 "push_operand" "=<")
- (match_operand:HI 1 "nonmemory_operand" "ri"))]
- "!TARGET_PUSH_MEMORY && TARGET_MOVE"
- "push%W0 %1")
-
-(define_insn ""
- [(set (match_operand:HI 0 "push_operand" "=<")
- (match_operand:HI 1 "nonmemory_operand" "ri"))]
- "!TARGET_PUSH_MEMORY && !TARGET_MOVE"
- "push%W0 %1")
-
-;; On i486, an incl and movl are both faster than incw and movw.
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- /* Don't generate memory->memory moves, go through a register */
- if (TARGET_MOVE
- && (reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) == MEM
- && GET_CODE (operands[1]) == MEM)
- {
- operands[1] = force_reg (HImode, operands[1]);
- }
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g,r")
- (match_operand:HI 1 "general_operand" "ri,m"))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- rtx link;
- if (REG_P (operands[0]) && operands[1] == const0_rtx)
- return AS2 (xor%L0,%k0,%k0);
-
- if (REG_P (operands[0]) && operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- /* Fastest way to change a 0 to a 1. */
- return AS1 (inc%L0,%k0);
-
- if (REG_P (operands[0]))
- {
- if (i386_aligned_p (operands[1]))
- {
- operands[1] = i386_sext16_if_const (operands[1]);
- return AS2 (mov%L0,%k1,%k0);
- }
- if (TARGET_PENTIUMPRO)
- {
- /* movzwl is faster than movw on the Pentium Pro,
- * although not as fast as an aligned movl. */
-#ifdef INTEL_SYNTAX
- return AS2 (movzx,%1,%k0);
-#else
- return AS2 (movz%W0%L0,%1,%k0);
-#endif
- }
- }
-
- return AS2 (mov%W0,%1,%0);
-}")
-
-(define_expand "movstricthi"
- [(set (strict_low_part (match_operand:HI 0 "general_operand" ""))
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- /* Don't generate memory->memory moves, go through a register */
- if (TARGET_MOVE
- && (reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) == MEM
- && GET_CODE (operands[1]) == MEM)
- {
- operands[1] = force_reg (HImode, operands[1]);
- }
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+g,r"))
- (match_operand:HI 1 "general_operand" "ri,m"))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- rtx link;
- if (operands[1] == const0_rtx && REG_P (operands[0]))
- return AS2 (xor%W0,%0,%0);
-
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- /* Fastest way to change a 0 to a 1. */
- return AS1 (inc%W0,%0);
-
- return AS2 (mov%W0,%1,%0);
-}")
-
-;; emit_push_insn when it calls move_by_pieces
-;; requires an insn to "push a byte".
-;; But actually we use pushw, which has the effect of rounding
-;; the amount pushed up to a halfword.
-(define_insn ""
- [(set (match_operand:QI 0 "push_operand" "=<")
- (match_operand:QI 1 "const_int_operand" "n"))]
- ""
- "* return AS1 (push%W0,%1);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "push_operand" "=<")
- (match_operand:QI 1 "register_operand" "q"))]
- "!TARGET_MOVE"
- "*
-{
- operands[1] = gen_rtx (REG, HImode, REGNO (operands[1]));
- return AS1 (push%W0,%1);
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "push_operand" "=<")
- (match_operand:QI 1 "register_operand" "q"))]
- "TARGET_MOVE"
- "*
-{
- operands[1] = gen_rtx (REG, HImode, REGNO (operands[1]));
- return AS1 (push%W0,%1);
-}")
-
-;; On i486, incb reg is faster than movb $1,reg.
-
-;; ??? Do a recognizer for zero_extract that looks just like this, but reads
-;; or writes %ah, %bh, %ch, %dh.
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- /* Don't generate memory->memory moves, go through a register */
- if (TARGET_MOVE
- && (reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) == MEM
- && GET_CODE (operands[1]) == MEM)
- {
- operands[1] = force_reg (QImode, operands[1]);
- }
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=q,*r,qm")
- (match_operand:QI 1 "general_operand" "*g,r,qn"))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- rtx link;
- if (operands[1] == const0_rtx && REG_P (operands[0]))
- return AS2 (xor%L0,%k0,%k0);
-
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- /* Fastest way to change a 0 to a 1. */
- return AS1 (inc%B0,%0);
-
- /* If mov%B0 isn't allowed for one of these regs, use mov%L0. */
- if (NON_QI_REG_P (operands[0]) || NON_QI_REG_P (operands[1]))
- return (AS2 (mov%L0,%k1,%k0));
-
- return (AS2 (mov%B0,%1,%0));
-}")
-
-;; If it becomes necessary to support movstrictqi into %esi or %edi,
-;; use the insn sequence:
-;;
-;; shrdl $8,srcreg,dstreg
-;; rorl $24,dstreg
-;;
-;; If operands[1] is a constant, then an andl/orl sequence would be
-;; faster.
-
-(define_expand "movstrictqi"
- [(set (strict_low_part (match_operand:QI 0 "general_operand" ""))
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- /* Don't generate memory->memory moves, go through a register */
- if (TARGET_MOVE
- && (reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) == MEM
- && GET_CODE (operands[1]) == MEM)
- {
- operands[1] = force_reg (QImode, operands[1]);
- }
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
- (match_operand:QI 1 "general_operand" "*qn,m"))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- rtx link;
- if (operands[1] == const0_rtx && REG_P (operands[0]))
- return AS2 (xor%B0,%0,%0);
-
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- /* Fastest way to change a 0 to a 1. */
- return AS1 (inc%B0,%0);
-
- /* If mov%B0 isn't allowed for one of these regs, use mov%L0. */
- if (NON_QI_REG_P (operands[0]) || NON_QI_REG_P (operands[1]))
- {
- abort ();
- return (AS2 (mov%L0,%k1,%k0));
- }
-
- return AS2 (mov%B0,%1,%0);
-}")
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- /* Special case memory->memory moves and pushes */
- if (TARGET_MOVE
- && (reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) == MEM
- && (GET_CODE (operands[1]) == MEM || push_operand (operands[0], SFmode)))
- {
- rtx (*genfunc) PROTO((rtx, rtx)) = (push_operand (operands[0], SFmode))
- ? gen_movsf_push
- : gen_movsf_mem;
-
- emit_insn ((*genfunc) (operands[0], operands[1]));
- DONE;
- }
-
- /* If we are loading a floating point constant that isn't 0 or 1
- into a register, indicate we need the pic register loaded. This could
- be optimized into stores of constants if the target eventually moves
- to memory, but better safe than sorry. */
- if ((reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) != MEM
- && GET_CODE (operands[1]) == CONST_DOUBLE
- && !standard_80387_constant_p (operands[1]))
- {
- rtx insn, note, fp_const;
-
- fp_const = force_const_mem (SFmode, operands[1]);
- if (flag_pic)
- current_function_uses_pic_offset_table = 1;
-
- insn = emit_insn (gen_rtx (SET, SFmode, operands[0], fp_const));
- note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
- if (note)
- XEXP (note, 0) = operands[1];
- else
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL, operands[1], REG_NOTES (insn));
- }
-}")
-
-(define_insn "movsf_push_nomove"
- [(set (match_operand:SF 0 "push_operand" "=<,<")
- (match_operand:SF 1 "general_operand" "gF,f"))]
- "!TARGET_MOVE"
- "*
-{
- if (STACK_REG_P (operands[1]))
- {
- rtx xops[3];
-
- if (! STACK_TOP_P (operands[1]))
- abort ();
-
- xops[0] = AT_SP (SFmode);
- xops[1] = GEN_INT (4);
- xops[2] = stack_pointer_rtx;
-
- output_asm_insn (AS2 (sub%L2,%1,%2), xops);
-
- if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))
- output_asm_insn (AS1 (fstp%S0,%0), xops);
- else
- output_asm_insn (AS1 (fst%S0,%0), xops);
- RET;
- }
- return AS1 (push%L1,%1);
-}")
-
-(define_insn "movsf_push"
- [(set (match_operand:SF 0 "push_operand" "=<,<,<,<")
- (match_operand:SF 1 "general_operand" "rF,f,m,m"))
- (clobber (match_scratch:SI 2 "=X,X,r,X"))]
- ""
- "*
-{
- if (STACK_REG_P (operands[1]))
- {
- rtx xops[3];
-
- if (! STACK_TOP_P (operands[1]))
- abort ();
-
- xops[0] = AT_SP (SFmode);
- xops[1] = GEN_INT (4);
- xops[2] = stack_pointer_rtx;
-
- output_asm_insn (AS2 (sub%L2,%1,%2), xops);
-
- if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))
- output_asm_insn (AS1 (fstp%S0,%0), xops);
- else
- output_asm_insn (AS1 (fst%S0,%0), xops);
- RET;
- }
-
- else if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != REG)
- return AS1 (push%L1,%1);
-
- else
- {
- output_asm_insn (AS2 (mov%L2,%1,%2), operands);
- return AS1 (push%L2,%2);
- }
-}")
-
-;; Special memory<->memory pattern that combine will recreate from the
-;; moves to pseudos.
-(define_insn "movsf_mem"
- [(set (match_operand:SF 0 "memory_operand" "=m")
- (match_operand:SF 1 "memory_operand" "m"))
- (clobber (match_scratch:SI 2 "=&r"))]
- ""
- "*
-{
- output_asm_insn (AS2 (mov%L2,%1,%2), operands);
- return AS2 (mov%L0,%2,%0);
-}")
-
-;; For the purposes of regclass, prefer FLOAT_REGS.
-(define_insn "movsf_normal"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=*rfm,*rf,f,!*rm")
- (match_operand:SF 1 "general_operand" "*rf,*rfm,fG,fF"))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- /* First handle a `pop' insn or a `fld %st(0)' */
-
- if (STACK_TOP_P (operands[0]) && STACK_TOP_P (operands[1]))
- {
- if (stack_top_dies)
- return AS1 (fstp,%y0);
- else
- return AS1 (fld,%y0);
- }
-
- /* Handle a transfer between the 387 and a 386 register */
-
- if (STACK_TOP_P (operands[0]) && NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fld%z0,%y1));
- RET;
- }
-
- if (STACK_TOP_P (operands[1]) && NON_STACK_REG_P (operands[0]))
- {
- output_to_reg (operands[0], stack_top_dies);
- RET;
- }
-
- /* Handle other kinds of writes from the 387 */
-
- if (STACK_TOP_P (operands[1]))
- {
- if (stack_top_dies)
- return AS1 (fstp%z0,%y0);
- else
- return AS1 (fst%z0,%y0);
- }
-
- /* Handle other kinds of reads to the 387 */
-
- if (STACK_TOP_P (operands[0]) && GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_single (operands);
-
- if (STACK_TOP_P (operands[0]))
- return AS1 (fld%z1,%y1);
-
- /* Handle all SFmode moves not involving the 387 */
-
- return singlemove_string (operands);
-}"
- [(set_attr "type" "fld")])
-
-
-(define_insn "swapsf"
- [(set (match_operand:SF 0 "register_operand" "f")
- (match_operand:SF 1 "register_operand" "f"))
- (set (match_dup 1)
- (match_dup 0))]
- ""
- "*
-{
- if (STACK_TOP_P (operands[0]))
- return AS1 (fxch,%1);
- else
- return AS1 (fxch,%0);
-}")
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
-{
- /* Special case memory->memory moves and pushes */
- if (TARGET_MOVE
- && (reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) == MEM
- && (GET_CODE (operands[1]) == MEM || push_operand (operands[0], DFmode)))
- {
- rtx (*genfunc) PROTO((rtx, rtx)) = (push_operand (operands[0], DFmode))
- ? gen_movdf_push
- : gen_movdf_mem;
-
- emit_insn ((*genfunc) (operands[0], operands[1]));
- DONE;
- }
-
- /* If we are loading a floating point constant that isn't 0 or 1 into a
- register, indicate we need the pic register loaded. This could be
- optimized into stores of constants if the target eventually moves to
- memory, but better safe than sorry. */
- if ((reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) != MEM
- && GET_CODE (operands[1]) == CONST_DOUBLE
- && !standard_80387_constant_p (operands[1]))
- {
- rtx insn, note, fp_const;
-
- fp_const = force_const_mem (DFmode, operands[1]);
- if (flag_pic)
- current_function_uses_pic_offset_table = 1;
-
- insn = emit_insn (gen_rtx (SET, DFmode, operands[0], fp_const));
- note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
- if (note)
- XEXP (note, 0) = operands[1];
- else
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL, operands[1], REG_NOTES (insn));
- }
-}")
-
-(define_insn "movdf_push_nomove"
- [(set (match_operand:DF 0 "push_operand" "=<,<")
- (match_operand:DF 1 "general_operand" "gF,f"))]
- "!TARGET_MOVE"
- "*
-{
- if (STACK_REG_P (operands[1]))
- {
- rtx xops[3];
-
- xops[0] = AT_SP (SFmode);
- xops[1] = GEN_INT (8);
- xops[2] = stack_pointer_rtx;
-
- output_asm_insn (AS2 (sub%L2,%1,%2), xops);
-
- if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))
- output_asm_insn (AS1 (fstp%Q0,%0), xops);
- else
- output_asm_insn (AS1 (fst%Q0,%0), xops);
-
- RET;
- }
- else
- return output_move_double (operands);
-}")
-
-(define_insn "movdf_push"
- [(set (match_operand:DF 0 "push_operand" "=<,<,<,<,<")
- (match_operand:DF 1 "general_operand" "rF,f,o,o,o"))
- (clobber (match_scratch:SI 2 "=X,X,&r,&r,X"))
- (clobber (match_scratch:SI 3 "=X,X,&r,X,X"))]
- ""
- "*
-{
- if (STACK_REG_P (operands[1]))
- {
- rtx xops[3];
-
- xops[0] = AT_SP (SFmode);
- xops[1] = GEN_INT (8);
- xops[2] = stack_pointer_rtx;
-
- output_asm_insn (AS2 (sub%L2,%1,%2), xops);
-
- if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))
- output_asm_insn (AS1 (fstp%Q0,%0), xops);
- else
- output_asm_insn (AS1 (fst%Q0,%0), xops);
-
- RET;
- }
-
- else if (GET_CODE (operands[1]) != MEM)
- return output_move_double (operands);
-
- else
- return output_move_pushmem (operands, insn, GET_MODE_SIZE (DFmode), 2, 4);
-}")
-
-(define_insn "movdf_mem"
- [(set (match_operand:DF 0 "memory_operand" "=o,o")
- (match_operand:DF 1 "memory_operand" "o,o"))
- (clobber (match_scratch:SI 2 "=&r,&r"))
- (clobber (match_scratch:SI 3 "=&r,X"))]
- ""
- "* return output_move_memory (operands, insn, GET_MODE_SIZE (DFmode), 2, 4);")
-
-;; For the purposes of regclass, prefer FLOAT_REGS.
-(define_insn ""
- [(set (match_operand:DF 0 "nonimmediate_operand" "=f,fm,!*rf,!*rm")
- (match_operand:DF 1 "general_operand" "fmG,f,*rfm,*rfF"))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM)
- || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- /* First handle a `pop' insn or a `fld %st(0)' */
-
- if (STACK_TOP_P (operands[0]) && STACK_TOP_P (operands[1]))
- {
- if (stack_top_dies)
- return AS1 (fstp,%y0);
- else
- return AS1 (fld,%y0);
- }
-
- /* Handle a transfer between the 387 and a 386 register */
-
- if (STACK_TOP_P (operands[0]) && NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fld%z0,%y1));
- RET;
- }
-
- if (STACK_TOP_P (operands[1]) && NON_STACK_REG_P (operands[0]))
- {
- output_to_reg (operands[0], stack_top_dies);
- RET;
- }
-
- /* Handle other kinds of writes from the 387 */
-
- if (STACK_TOP_P (operands[1]))
- {
- if (stack_top_dies)
- return AS1 (fstp%z0,%y0);
- else
- return AS1 (fst%z0,%y0);
- }
-
- /* Handle other kinds of reads to the 387 */
-
- if (STACK_TOP_P (operands[0]) && GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_single (operands);
-
- if (STACK_TOP_P (operands[0]))
- return AS1 (fld%z1,%y1);
-
- /* Handle all DFmode moves not involving the 387 */
-
- return output_move_double (operands);
-}"
- [(set_attr "type" "fld")])
-
-
-
-(define_insn "swapdf"
- [(set (match_operand:DF 0 "register_operand" "f")
- (match_operand:DF 1 "register_operand" "f"))
- (set (match_dup 1)
- (match_dup 0))]
- ""
- "*
-{
- if (STACK_TOP_P (operands[0]))
- return AS1 (fxch,%1);
- else
- return AS1 (fxch,%0);
-}")
-
-(define_expand "movxf"
- [(set (match_operand:XF 0 "general_operand" "")
- (match_operand:XF 1 "general_operand" ""))]
- ""
- "
-{
- /* Special case memory->memory moves and pushes */
- if (TARGET_MOVE
- && (reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) == MEM
- && (GET_CODE (operands[1]) == MEM || push_operand (operands[0], XFmode)))
- {
- rtx (*genfunc) PROTO((rtx, rtx)) = (push_operand (operands[0], XFmode))
- ? gen_movxf_push
- : gen_movxf_mem;
-
- emit_insn ((*genfunc) (operands[0], operands[1]));
- DONE;
- }
-
- /* If we are loading a floating point constant that isn't 0 or 1
- into a register, indicate we need the pic register loaded. This could
- be optimized into stores of constants if the target eventually moves
- to memory, but better safe than sorry. */
- if ((reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) != MEM
- && GET_CODE (operands[1]) == CONST_DOUBLE
- && !standard_80387_constant_p (operands[1]))
- {
- rtx insn, note, fp_const;
-
- fp_const = force_const_mem (XFmode, operands[1]);
- if (flag_pic)
- current_function_uses_pic_offset_table = 1;
-
- insn = emit_insn (gen_rtx (SET, XFmode, operands[0], fp_const));
- note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
- if (note)
- XEXP (note, 0) = operands[1];
- else
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL, operands[1], REG_NOTES (insn));
- }
-}")
-
-
-(define_insn "movxf_push_nomove"
- [(set (match_operand:XF 0 "push_operand" "=<,<")
- (match_operand:XF 1 "general_operand" "gF,f"))]
- "!TARGET_MOVE"
- "*
-{
- if (STACK_REG_P (operands[1]))
- {
- rtx xops[3];
-
- xops[0] = AT_SP (SFmode);
- xops[1] = GEN_INT (12);
- xops[2] = stack_pointer_rtx;
-
- output_asm_insn (AS2 (sub%L2,%1,%2), xops);
- output_asm_insn (AS1 (fstp%T0,%0), xops);
- if (! find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))
- output_asm_insn (AS1 (fld%T0,%0), xops);
-
- RET;
- }
- else
- return output_move_double (operands);
- }")
-
-(define_insn "movxf_push"
- [(set (match_operand:XF 0 "push_operand" "=<,<,<,<,<")
- (match_operand:XF 1 "general_operand" "rF,f,o,o,o"))
- (clobber (match_scratch:SI 2 "=X,X,&r,&r,X"))
- (clobber (match_scratch:SI 3 "=X,X,&r,X,X"))]
- ""
- "*
-{
- if (STACK_REG_P (operands[1]))
- {
- rtx xops[3];
-
- xops[0] = AT_SP (SFmode);
- xops[1] = GEN_INT (12);
- xops[2] = stack_pointer_rtx;
-
- output_asm_insn (AS2 (sub%L2,%1,%2), xops);
- output_asm_insn (AS1 (fstp%T0,%0), xops);
- if (! find_regno_note (insn, REG_DEAD, FIRST_STACK_REG))
- output_asm_insn (AS1 (fld%T0,%0), xops);
-
- RET;
- }
-
- else if (GET_CODE (operands[1]) != MEM
- || GET_CODE (operands[2]) != REG)
- return output_move_double (operands);
-
- else
- return output_move_pushmem (operands, insn, GET_MODE_SIZE (XFmode), 2, 4);
-}")
-
-(define_insn "movxf_mem"
- [(set (match_operand:XF 0 "memory_operand" "=o,o")
- (match_operand:XF 1 "memory_operand" "o,o"))
- (clobber (match_scratch:SI 2 "=&r,&r"))
- (clobber (match_scratch:SI 3 "=&r,X"))]
- ""
- "* return output_move_memory (operands, insn, GET_MODE_SIZE (XFmode), 2, 4);")
-
-(define_insn ""
- [(set (match_operand:XF 0 "nonimmediate_operand" "=f,fm,!*rf,!*rm")
- (match_operand:XF 1 "general_operand" "fmG,f,*rfm,*rfF"))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM)
- || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- /* First handle a `pop' insn or a `fld %st(0)' */
-
- if (STACK_TOP_P (operands[0]) && STACK_TOP_P (operands[1]))
- {
- if (stack_top_dies)
- return AS1 (fstp,%y0);
- else
- return AS1 (fld,%y0);
- }
-
- /* Handle a transfer between the 387 and a 386 register */
-
- if (STACK_TOP_P (operands[0]) && NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fld%z0,%y1));
- RET;
- }
-
- if (STACK_TOP_P (operands[1]) && NON_STACK_REG_P (operands[0]))
- {
- output_to_reg (operands[0], stack_top_dies);
- RET;
- }
-
- /* Handle other kinds of writes from the 387 */
-
- if (STACK_TOP_P (operands[1]))
- {
- output_asm_insn (AS1 (fstp%z0,%y0), operands);
- if (! stack_top_dies)
- return AS1 (fld%z0,%y0);
-
- RET;
- }
-
- /* Handle other kinds of reads to the 387 */
-
- if (STACK_TOP_P (operands[0]) && GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_single (operands);
-
- if (STACK_TOP_P (operands[0]))
- return AS1 (fld%z1,%y1);
-
- /* Handle all XFmode moves not involving the 387 */
-
- return output_move_double (operands);
-}")
-
-(define_insn "swapxf"
- [(set (match_operand:XF 0 "register_operand" "f")
- (match_operand:XF 1 "register_operand" "f"))
- (set (match_dup 1)
- (match_dup 0))]
- ""
- "*
-{
- if (STACK_TOP_P (operands[0]))
- return AS1 (fxch,%1);
- else
- return AS1 (fxch,%0);
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "push_operand" "=<,<,<,<")
- (match_operand:DI 1 "general_operand" "riF,o,o,o"))
- (clobber (match_scratch:SI 2 "=X,&r,&r,X"))
- (clobber (match_scratch:SI 3 "=X,&r,X,X"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) != MEM)
- return output_move_double (operands);
-
- else
- return output_move_pushmem (operands, insn, GET_MODE_SIZE (DImode), 2, 4);
-}")
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=o,o,r,rm")
- (match_operand:DI 1 "general_operand" "o,o,m,riF"))
- (clobber (match_scratch:SI 2 "=&r,&r,X,X"))
- (clobber (match_scratch:SI 3 "=&r,X,X,X"))]
- ""
- "*
-{
- rtx low[2], high[2], xop[6];
-
- if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
- return output_move_double (operands);
- else
- return output_move_memory (operands, insn, GET_MODE_SIZE (DImode), 2, 4);
-}")
-
-
-;;- conversion instructions
-;;- NONE
-
-;;- zero extension instructions
-;; See comments by `andsi' for when andl is faster than movzx.
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,&r,?r")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,rm,rm")))]
- ""
- "*
- {
- rtx xops[2];
-
- if ((TARGET_ZERO_EXTEND_WITH_AND || REGNO (operands[0]) == 0)
- && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1]))
- {
- xops[0] = operands[0];
- xops[1] = GEN_INT (0xffff);
- output_asm_insn (AS2 (and%L0,%1,%k0), xops);
- RET;
- }
- if (TARGET_ZERO_EXTEND_WITH_AND && !reg_overlap_mentioned_p (operands[0], operands[1]))
- {
- output_asm_insn (AS2 (xor%L0,%0,%0),operands);
- output_asm_insn (AS2 (mov%W0,%1,%w0),operands);
- RET;
- }
-
- if (TARGET_ZERO_EXTEND_WITH_AND)
- {
- xops[0] = operands[0];
- xops[1] = gen_rtx (CONST_INT, VOIDmode, 0xffff);
- if (i386_aligned_p (operands[1]))
- output_asm_insn (AS2 (mov%L0,%k1,%k0),operands);
- else
- output_asm_insn (AS2 (mov%W0,%1,%w0),operands);
- output_asm_insn (AS2 (and%L0,%1,%k0), xops);
- RET;
- }
-
-#ifdef INTEL_SYNTAX
- return AS2 (movzx,%1,%0);
-#else
- return AS2 (movz%W0%L0,%1,%0);
-#endif
-}")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
- "reload_completed && TARGET_ZERO_EXTEND_WITH_AND && !reg_overlap_mentioned_p (operands[0], operands[1])"
- [(set (match_dup 0)
- (const_int 0))
- (set (strict_low_part (match_dup 2))
- (match_dup 1))]
- "operands[2] = gen_rtx (REG, HImode, true_regnum (operands[0]));")
-
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:HI 1 "memory_operand" "")))]
- "reload_completed && TARGET_ZERO_EXTEND_WITH_AND && reg_overlap_mentioned_p (operands[0], operands[1])"
- [(set (strict_low_part (match_dup 2))
- (match_dup 1))
- (set (match_dup 0)
- (and:SI (match_dup 0)
- (const_int 65535)))]
- "operands[2] = gen_rtx (REG, HImode, true_regnum (operands[0]));")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=q,&q,?r")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,qm,qm")))]
- ""
- "*
- {
- rtx xops[2];
-
- if ((TARGET_ZERO_EXTEND_WITH_AND || REGNO (operands[0]) == 0)
- && REG_P (operands[1])
- && REGNO (operands[0]) == REGNO (operands[1]))
- {
- xops[0] = operands[0];
- xops[1] = GEN_INT (0xff);
- output_asm_insn (AS2 (and%L0,%1,%k0), xops);
- RET;
- }
- if (TARGET_ZERO_EXTEND_WITH_AND && QI_REG_P (operands[0]))
- {
- if(!reg_overlap_mentioned_p(operands[0],operands[1]))
- {
- output_asm_insn (AS2 (xor%L0,%k0,%k0), operands);
- output_asm_insn (AS2 (mov%B0,%1,%b0), operands);
- }
- else
- {
- xops[0] = operands[0];
- xops[1] = gen_rtx (CONST_INT, VOIDmode, 0xff);
- output_asm_insn (AS2 (mov%B0,%1,%b0),operands);
- output_asm_insn (AS2 (and%L0,%1,%k0), xops);
- }
- RET;
- }
-
-#ifdef INTEL_SYNTAX
- return AS2 (movzx,%1,%0);
-#else
- return AS2 (movz%B0%W0,%1,%0);
-#endif
-}")
-
-(define_split
- [(set (match_operand:HI 0 "register_operand" "")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
- "reload_completed && QI_REG_P (operands[0]) && TARGET_ZERO_EXTEND_WITH_AND
- && !reg_overlap_mentioned_p (operands[0], operands[1])"
- [(set (match_dup 0)
- (const_int 0))
- (set (strict_low_part (match_dup 2))
- (match_dup 1))]
- "operands[2] = gen_rtx (REG, QImode, REGNO (operands[0]));")
-
-
-(define_split
- [(set (match_operand:HI 0 "register_operand" "")
- (zero_extend:HI (match_operand:QI 1 "memory_operand" "")))]
- "reload_completed && QI_REG_P (operands[0]) && TARGET_ZERO_EXTEND_WITH_AND
- && reg_overlap_mentioned_p (operands[0], operands[1])"
- [(set (strict_low_part (match_dup 2))
- (match_dup 1))
- (set (match_dup 0)
- (and:HI (match_dup 0)
- (const_int 255)))]
- "operands[2] = gen_rtx (REG, QImode, REGNO (operands[0]));")
-
-(define_split
- [(set (match_operand:HI 0 "register_operand" "")
- (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
- "reload_completed && TARGET_ZERO_EXTEND_WITH_AND"
- [(set (match_dup 0)
- (match_dup 2))
- (set (match_dup 0)
- (and:HI (match_dup 0)
- (const_int 255)))]
- "if (GET_CODE (operands[1]) == SUBREG && SUBREG_WORD (operands[1]) == 0)
- operands[1] = SUBREG_REG (operands[1]);
- if (GET_CODE (operands[0]) != REG || GET_CODE (operands[1]) != REG
- || REGNO (operands[0]) == REGNO (operands[1]))
- FAIL;
- operands[2] = gen_rtx (REG, HImode, REGNO (operands[1]));")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=q,&q,?r")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,qm,qm")))]
- ""
- "*
- {
- rtx xops[2];
-
- if ((TARGET_ZERO_EXTEND_WITH_AND || REGNO (operands[0]) == 0)
- && REG_P (operands[1])
- && REGNO (operands[0]) == REGNO (operands[1]))
- {
- xops[0] = operands[0];
- xops[1] = GEN_INT (0xff);
- output_asm_insn (AS2 (and%L0,%1,%k0), xops);
- RET;
- }
- if (TARGET_ZERO_EXTEND_WITH_AND && QI_REG_P (operands[0]))
- {
- if(!reg_overlap_mentioned_p (operands[0], operands[1]))
- {
- output_asm_insn (AS2 (xor%L0,%0,%0),operands);
- output_asm_insn (AS2 (mov%B0,%1,%b0),operands);
- }
- else
- {
- xops[0] = operands[0];
- xops[1] = gen_rtx (CONST_INT, VOIDmode, 0xff);
- output_asm_insn (AS2 (mov%B0,%1,%b0), operands);
- output_asm_insn (AS2 (and%L0,%1,%k0), xops);
- }
- RET;
- }
-
- if (TARGET_ZERO_EXTEND_WITH_AND && GET_CODE (operands[1]) == REG)
- {
- xops[0] = operands[0];
- xops[1] = gen_rtx (CONST_INT, VOIDmode, 0xff);
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[1]));
- output_asm_insn (AS2 (mov%L0,%1,%0), operands);
- output_asm_insn (AS2 (and%L0,%1,%k0), xops);
- RET;
- }
-
-#ifdef INTEL_SYNTAX
- return AS2 (movzx,%1,%0);
-#else
- return AS2 (movz%B0%L0,%1,%0);
-#endif
-}")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
- "reload_completed && QI_REG_P (operands[0]) && TARGET_ZERO_EXTEND_WITH_AND
- && !reg_overlap_mentioned_p (operands[0], operands[1])"
- [(set (match_dup 0)
- (const_int 0))
- (set (strict_low_part (match_dup 2))
- (match_dup 1))]
- "operands[2] = gen_rtx (REG, QImode, REGNO (operands[0]));")
-
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:QI 1 "memory_operand" "")))]
- "reload_completed && QI_REG_P (operands[0]) && TARGET_ZERO_EXTEND_WITH_AND
- && reg_overlap_mentioned_p (operands[0], operands[1])"
- [(set (strict_low_part (match_dup 2))
- (match_dup 1))
- (set (match_dup 0)
- (and:SI (match_dup 0)
- (const_int 255)))]
- "operands[2] = gen_rtx (REG, QImode, REGNO (operands[0]));")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
- "reload_completed && TARGET_ZERO_EXTEND_WITH_AND
- && ! reg_overlap_mentioned_p (operands[0], operands[1])"
- [(set (match_dup 0)
- (match_dup 2))
- (set (match_dup 0)
- (and:SI (match_dup 0)
- (const_int 255)))]
- "operands[2] = gen_rtx (REG, SImode, true_regnum (operands[1]));")
-
-(define_insn "zero_extendsidi2"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?m")
- (zero_extend:DI (match_operand:SI 1 "register_operand" "0,rm,r")))]
- ""
- "*
- {
- rtx high[2], low[2], xops[4];
-
- if (REG_P (operands[0]) && REG_P (operands[1])
- && REGNO (operands[0]) == REGNO (operands[1]))
- {
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return AS2 (xor%L0,%0,%0);
- }
-
- split_di (operands, 1, low, high);
- xops[0] = low[0];
- xops[1] = operands[1];
- xops[2] = high[0];
- xops[3] = const0_rtx;
-
- output_asm_insn (AS2 (mov%L0,%1,%0), xops);
- if (GET_CODE (low[0]) == MEM)
- output_asm_insn (AS2 (mov%L2,%3,%2), xops);
- else
- output_asm_insn (AS2 (xor%L2,%2,%2), xops);
-
- RET;
-}")
-
-;;- sign extension instructions
-
-(define_insn "extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (sign_extend:DI (match_operand:SI 1 "register_operand" "0")))]
- ""
- "*
-{
- if (REGNO (operands[0]) == 0)
- {
- /* This used to be cwtl, but that extends HI to SI somehow. */
-#ifdef INTEL_SYNTAX
- return \"cdq\";
-#else
- return \"cltd\";
-#endif
- }
-
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- output_asm_insn (AS2 (mov%L0,%0,%1), operands);
-
- operands[0] = GEN_INT (31);
- return AS2 (sar%L1,%0,%1);
-}")
-
-;; Note that the i386 programmers' manual says that the opcodes
-;; are named movsx..., but the assembler on Unix does not accept that.
-;; We use what the Unix assembler expects.
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
- ""
- "*
-{
- if (REGNO (operands[0]) == 0
- && REG_P (operands[1]) && REGNO (operands[1]) == 0)
-#ifdef INTEL_SYNTAX
- return \"cwde\";
-#else
- return \"cwtl\";
-#endif
-
-#ifdef INTEL_SYNTAX
- return AS2 (movsx,%1,%0);
-#else
- return AS2 (movs%W0%L0,%1,%0);
-#endif
-}")
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
- ""
- "*
-{
- if (REGNO (operands[0]) == 0
- && REG_P (operands[1]) && REGNO (operands[1]) == 0)
- return \"cbtw\";
-
-#ifdef INTEL_SYNTAX
- return AS2 (movsx,%1,%0);
-#else
- return AS2 (movs%B0%W0,%1,%0);
-#endif
-}")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))]
- ""
- "*
-{
-#ifdef INTEL_SYNTAX
- return AS2 (movsx,%1,%0);
-#else
- return AS2 (movs%B0%L0,%1,%0);
-#endif
-}")
-
-
-;; Truncation of long long -> 32 bit
-
-(define_expand "truncdisi2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m")
- (truncate:SI (match_operand:DI 1 "nonimmediate_operand" "ro,r")))]
- ""
- "
-{
- /* Don't generate memory->memory moves, go through a register */
- if (TARGET_MOVE
- && (reload_in_progress | reload_completed) == 0
- && GET_CODE (operands[0]) == MEM
- && GET_CODE (operands[1]) == MEM)
- {
- rtx target = gen_reg_rtx (SImode);
- emit_insn (gen_truncdisi2 (target, operands[1]));
- emit_move_insn (operands[0], target);
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m")
- (truncate:SI (match_operand:DI 1 "nonimmediate_operand" "ro,r")))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- rtx low[2], high[2], xops[2];
-
- split_di (&operands[1], 1, low, high);
- xops[0] = operands[0];
- xops[1] = low[0];
- if (!rtx_equal_p (xops[0], xops[1]))
- output_asm_insn (AS2 (mov%L0,%1,%0), xops);
-
- RET;
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m")
- (truncate:SI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro,r")
- (const_int 32))))]
- "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)"
- "*
-{
- rtx low[2], high[2], xops[2];
-
- split_di (&operands[1], 1, low, high);
- xops[0] = operands[0];
- xops[1] = high[0];
- if (!rtx_equal_p (xops[0], xops[1]))
- output_asm_insn (AS2 (mov%L0,%1,%0), xops);
-
- RET;
-}")
-
-
-
-;; Conversions between float and double.
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=fm,f")
- (float_extend:DF
- (match_operand:SF 1 "nonimmediate_operand" "f,fm")))]
- "TARGET_80387"
- "*
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fld%z0,%y1));
- RET;
- }
-
- if (NON_STACK_REG_P (operands[0]))
- {
- output_to_reg (operands[0], stack_top_dies);
- RET;
- }
-
- if (STACK_TOP_P (operands[0]))
- return AS1 (fld%z1,%y1);
-
- if (GET_CODE (operands[0]) == MEM)
- {
- if (stack_top_dies)
- return AS1 (fstp%z0,%y0);
- else
- return AS1 (fst%z0,%y0);
- }
-
- abort ();
-}")
-
-(define_insn "extenddfxf2"
- [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f,f,!*r")
- (float_extend:XF
- (match_operand:DF 1 "nonimmediate_operand" "f,fm,!*r,f")))]
- "TARGET_80387"
- "*
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fld%z0,%y1));
- RET;
- }
-
- if (NON_STACK_REG_P (operands[0]))
- {
- output_to_reg (operands[0], stack_top_dies);
- RET;
- }
-
- if (STACK_TOP_P (operands[0]))
- return AS1 (fld%z1,%y1);
-
- if (GET_CODE (operands[0]) == MEM)
- {
- output_asm_insn (AS1 (fstp%z0,%y0), operands);
- if (! stack_top_dies)
- return AS1 (fld%z0,%y0);
- RET;
- }
-
- abort ();
-}")
-
-(define_insn "extendsfxf2"
- [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f,f,!*r")
- (float_extend:XF
- (match_operand:SF 1 "nonimmediate_operand" "f,fm,!*r,f")))]
- "TARGET_80387"
- "*
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fld%z0,%y1));
- RET;
- }
-
- if (NON_STACK_REG_P (operands[0]))
- {
- output_to_reg (operands[0], stack_top_dies);
- RET;
- }
-
- if (STACK_TOP_P (operands[0]))
- return AS1 (fld%z1,%y1);
-
- if (GET_CODE (operands[0]) == MEM)
- {
- output_asm_insn (AS1 (fstp%z0,%y0), operands);
- if (! stack_top_dies)
- return AS1 (fld%z0,%y0);
- RET;
- }
-
- abort ();
-}")
-
-(define_expand "truncdfsf2"
- [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "")
- (float_truncate:SF
- (match_operand:DF 1 "register_operand" "")))
- (clobber (match_dup 2))])]
- "TARGET_80387"
- "
-{
- operands[2] = (rtx) assign_386_stack_local (SFmode, 0);
-}")
-
-;; This cannot output into an f-reg because there is no way to be sure
-;; of truncating in that case. Otherwise this is just like a simple move
-;; insn. So we pretend we can output to a reg in order to get better
-;; register preferencing, but we really use a stack slot.
-
-(define_insn ""
- [(set (match_operand:SF 0 "nonimmediate_operand" "=f,m")
- (float_truncate:SF
- (match_operand:DF 1 "register_operand" "0,f")))
- (clobber (match_operand:SF 2 "memory_operand" "m,m"))]
- "TARGET_80387"
- "*
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- if (GET_CODE (operands[0]) == MEM)
- {
- if (stack_top_dies)
- return AS1 (fstp%z0,%0);
- else
- return AS1 (fst%z0,%0);
- }
- else if (STACK_TOP_P (operands[0]))
- {
- output_asm_insn (AS1 (fstp%z2,%y2), operands);
- return AS1 (fld%z2,%y2);
- }
- else
- abort ();
-}")
-
-(define_insn "truncxfsf2"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=m,!*r")
- (float_truncate:SF
- (match_operand:XF 1 "register_operand" "f,f")))]
- "TARGET_80387"
- "*
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- if (NON_STACK_REG_P (operands[0]))
- {
- if (stack_top_dies == 0)
- {
- output_asm_insn (AS1 (fld,%y1), operands);
- stack_top_dies = 1;
- }
- output_to_reg (operands[0], stack_top_dies);
- RET;
- }
- else if (GET_CODE (operands[0]) == MEM)
- {
- if (stack_top_dies)
- return AS1 (fstp%z0,%0);
- else
- {
- output_asm_insn (AS1 (fld,%y1), operands);
- return AS1 (fstp%z0,%0);
- }
- }
- else
- abort ();
-}")
-
-(define_insn "truncxfdf2"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=m,!*r")
- (float_truncate:DF
- (match_operand:XF 1 "register_operand" "f,f")))]
- "TARGET_80387"
- "*
-{
- int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
-
- if (NON_STACK_REG_P (operands[0]))
- {
- if (stack_top_dies == 0)
- {
- output_asm_insn (AS1 (fld,%y1), operands);
- stack_top_dies = 1;
- }
- output_to_reg (operands[0], stack_top_dies);
- RET;
- }
- else if (GET_CODE (operands[0]) == MEM)
- {
- if (stack_top_dies)
- return AS1 (fstp%z0,%0);
- else
- {
- output_asm_insn (AS1 (fld,%y1), operands);
- return AS1 (fstp%z0,%0);
- }
- }
- else
- abort ();
-}")
-
-
-;; The 387 requires that the stack top dies after converting to DImode.
-
-;; Represent an unsigned conversion from SImode to MODE_FLOAT by first
-;; doing a signed conversion to DImode, and then taking just the low
-;; part.
-
-(define_expand "fixuns_truncxfsi2"
- [(set (match_dup 4)
- (match_operand:XF 1 "register_operand" ""))
- (parallel [(set (match_dup 2)
- (fix:DI (fix:XF (match_dup 4))))
- (clobber (match_dup 4))
- (clobber (match_dup 5))
- (clobber (match_dup 6))
- (clobber (match_scratch:SI 7 ""))])
- (set (match_operand:SI 0 "general_operand" "")
- (match_dup 3))]
- "TARGET_80387"
- "
-{
- operands[2] = gen_reg_rtx (DImode);
- operands[3] = gen_lowpart (SImode, operands[2]);
- operands[4] = gen_reg_rtx (XFmode);
- operands[5] = (rtx) assign_386_stack_local (SImode, 0);
- operands[6] = (rtx) assign_386_stack_local (SImode, 1);
-}")
-
-(define_expand "fixuns_truncdfsi2"
- [(set (match_dup 4)
- (match_operand:DF 1 "register_operand" ""))
- (parallel [(set (match_dup 2)
- (fix:DI (fix:DF (match_dup 4))))
- (clobber (match_dup 4))
- (clobber (match_dup 5))
- (clobber (match_dup 6))
- (clobber (match_scratch:SI 7 ""))])
- (set (match_operand:SI 0 "general_operand" "")
- (match_dup 3))]
- "TARGET_80387"
- "
-{
- operands[2] = gen_reg_rtx (DImode);
- operands[3] = gen_lowpart (SImode, operands[2]);
- operands[4] = gen_reg_rtx (DFmode);
- operands[5] = (rtx) assign_386_stack_local (SImode, 0);
- operands[6] = (rtx) assign_386_stack_local (SImode, 1);
-}")
-
-(define_expand "fixuns_truncsfsi2"
- [(set (match_dup 4)
- (match_operand:SF 1 "register_operand" ""))
- (parallel [(set (match_dup 2)
- (fix:DI (fix:SF (match_dup 4))))
- (clobber (match_dup 4))
- (clobber (match_dup 5))
- (clobber (match_dup 6))
- (clobber (match_scratch:SI 7 ""))])
- (set (match_operand:SI 0 "general_operand" "")
- (match_dup 3))]
- "TARGET_80387"
- "
-{
- operands[2] = gen_reg_rtx (DImode);
- operands[3] = gen_lowpart (SImode, operands[2]);
- operands[4] = gen_reg_rtx (SFmode);
- operands[5] = (rtx) assign_386_stack_local (SImode, 0);
- operands[6] = (rtx) assign_386_stack_local (SImode, 1);
-}")
-
-;; Signed conversion to DImode.
-
-(define_expand "fix_truncxfdi2"
- [(set (match_dup 2)
- (match_operand:XF 1 "register_operand" ""))
- (parallel [(set (match_operand:DI 0 "general_operand" "")
- (fix:DI (fix:XF (match_dup 2))))
- (clobber (match_dup 2))
- (clobber (match_dup 3))
- (clobber (match_dup 4))
- (clobber (match_scratch:SI 5 ""))])]
- "TARGET_80387"
- "
-{
- operands[1] = copy_to_mode_reg (XFmode, operands[1]);
- operands[2] = gen_reg_rtx (XFmode);
- operands[3] = (rtx) assign_386_stack_local (SImode, 0);
- operands[4] = (rtx) assign_386_stack_local (SImode, 1);
-}")
-
-(define_expand "fix_truncdfdi2"
- [(set (match_dup 2)
- (match_operand:DF 1 "register_operand" ""))
- (parallel [(set (match_operand:DI 0 "general_operand" "")
- (fix:DI (fix:DF (match_dup 2))))
- (clobber (match_dup 2))
- (clobber (match_dup 3))
- (clobber (match_dup 4))
- (clobber (match_scratch:SI 5 ""))])]
- "TARGET_80387"
- "
-{
- operands[1] = copy_to_mode_reg (DFmode, operands[1]);
- operands[2] = gen_reg_rtx (DFmode);
- operands[3] = (rtx) assign_386_stack_local (SImode, 0);
- operands[4] = (rtx) assign_386_stack_local (SImode, 1);
-}")
-
-(define_expand "fix_truncsfdi2"
- [(set (match_dup 2)
- (match_operand:SF 1 "register_operand" ""))
- (parallel [(set (match_operand:DI 0 "general_operand" "")
- (fix:DI (fix:SF (match_dup 2))))
- (clobber (match_dup 2))
- (clobber (match_dup 3))
- (clobber (match_dup 4))
- (clobber (match_scratch:SI 5 ""))])]
- "TARGET_80387"
- "
-{
- operands[1] = copy_to_mode_reg (SFmode, operands[1]);
- operands[2] = gen_reg_rtx (SFmode);
- operands[3] = (rtx) assign_386_stack_local (SImode, 0);
- operands[4] = (rtx) assign_386_stack_local (SImode, 1);
-}")
-
-;; These match a signed conversion of either DFmode or SFmode to DImode.
-
-(define_insn ""
- [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
- (fix:DI (fix:XF (match_operand:XF 1 "register_operand" "f"))))
- (clobber (match_dup 1))
- (clobber (match_operand:SI 2 "memory_operand" "m"))
- (clobber (match_operand:SI 3 "memory_operand" "m"))
- (clobber (match_scratch:SI 4 "=&q"))]
- "TARGET_80387"
- "* return output_fix_trunc (insn, operands);")
-
-(define_insn ""
- [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
- (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
- (clobber (match_dup 1))
- (clobber (match_operand:SI 2 "memory_operand" "m"))
- (clobber (match_operand:SI 3 "memory_operand" "m"))
- (clobber (match_scratch:SI 4 "=&q"))]
- "TARGET_80387"
- "* return output_fix_trunc (insn, operands);")
-
-(define_insn ""
- [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
- (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))
- (clobber (match_dup 1))
- (clobber (match_operand:SI 2 "memory_operand" "m"))
- (clobber (match_operand:SI 3 "memory_operand" "m"))
- (clobber (match_scratch:SI 4 "=&q"))]
- "TARGET_80387"
- "* return output_fix_trunc (insn, operands);")
-
-;; Signed MODE_FLOAT conversion to SImode.
-
-(define_expand "fix_truncxfsi2"
- [(parallel [(set (match_operand:SI 0 "general_operand" "")
- (fix:SI
- (fix:XF (match_operand:XF 1 "register_operand" ""))))
- (clobber (match_dup 2))
- (clobber (match_dup 3))
- (clobber (match_scratch:SI 4 ""))])]
- "TARGET_80387"
- "
-{
- operands[2] = (rtx) assign_386_stack_local (SImode, 0);
- operands[3] = (rtx) assign_386_stack_local (SImode, 1);
-}")
-
-(define_expand "fix_truncdfsi2"
- [(parallel [(set (match_operand:SI 0 "general_operand" "")
- (fix:SI
- (fix:DF (match_operand:DF 1 "register_operand" ""))))
- (clobber (match_dup 2))
- (clobber (match_dup 3))
- (clobber (match_scratch:SI 4 ""))])]
- "TARGET_80387"
- "
-{
- operands[2] = (rtx) assign_386_stack_local (SImode, 0);
- operands[3] = (rtx) assign_386_stack_local (SImode, 1);
-}")
-
-(define_expand "fix_truncsfsi2"
- [(parallel [(set (match_operand:SI 0 "general_operand" "")
- (fix:SI
- (fix:SF (match_operand:SF 1 "register_operand" ""))))
- (clobber (match_dup 2))
- (clobber (match_dup 3))
- (clobber (match_scratch:SI 4 ""))])]
- "TARGET_80387"
- "
-{
- operands[2] = (rtx) assign_386_stack_local (SImode, 0);
- operands[3] = (rtx) assign_386_stack_local (SImode, 1);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (fix:SI (fix:XF (match_operand:XF 1 "register_operand" "f"))))
- (clobber (match_operand:SI 2 "memory_operand" "m"))
- (clobber (match_operand:SI 3 "memory_operand" "m"))
- (clobber (match_scratch:SI 4 "=&q"))]
- "TARGET_80387"
- "* return output_fix_trunc (insn, operands);")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
- (clobber (match_operand:SI 2 "memory_operand" "m"))
- (clobber (match_operand:SI 3 "memory_operand" "m"))
- (clobber (match_scratch:SI 4 "=&q"))]
- "TARGET_80387"
- "* return output_fix_trunc (insn, operands);")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))
- (clobber (match_operand:SI 2 "memory_operand" "m"))
- (clobber (match_operand:SI 3 "memory_operand" "m"))
- (clobber (match_scratch:SI 4 "=&q"))]
- "TARGET_80387"
- "* return output_fix_trunc (insn, operands);")
-
-;; Conversion between fixed point and floating point.
-;; The actual pattern that matches these is at the end of this file.
-
-;; ??? Possibly represent floatunssidf2 here in gcc2.
-
-(define_expand "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "")
- (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "floatdisf2"
- [(set (match_operand:SF 0 "register_operand" "")
- (float:SF (match_operand:DI 1 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "")
- (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "floatdidf2"
- [(set (match_operand:DF 0 "register_operand" "")
- (float:DF (match_operand:DI 1 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "floatsixf2"
- [(set (match_operand:XF 0 "register_operand" "")
- (float:XF (match_operand:SI 1 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "floatdixf2"
- [(set (match_operand:XF 0 "register_operand" "")
- (float:XF (match_operand:DI 1 "nonimmediate_operand" "")))]
- "TARGET_80387 && LONG_DOUBLE_TYPE_SIZE == 96"
- "")
-
-;; This will convert from SImode or DImode to MODE_FLOAT.
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f")
- (float:XF (match_operand:DI 1 "nonimmediate_operand" "rm")))]
- "TARGET_80387"
- "*
-{
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fild%z0,%1));
- RET;
- }
- else if (GET_CODE (operands[1]) == MEM)
- return AS1 (fild%z1,%1);
- else
- abort ();
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:DI 1 "nonimmediate_operand" "rm")))]
- "TARGET_80387"
- "*
-{
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fild%z0,%1));
- RET;
- }
- else if (GET_CODE (operands[1]) == MEM)
- return AS1 (fild%z1,%1);
- else
- abort ();
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:DI 1 "nonimmediate_operand" "rm")))]
- "TARGET_80387"
- "*
-{
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fild%z0,%1));
- RET;
- }
- else if (GET_CODE (operands[1]) == MEM)
- return AS1 (fild%z1,%1);
- else
- abort ();
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:SI 1 "nonimmediate_operand" "rm")))]
- "TARGET_80387"
- "*
-{
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fild%z0,%1));
- RET;
- }
- else if (GET_CODE (operands[1]) == MEM)
- return AS1 (fild%z1,%1);
- else
- abort ();
-}")
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f,f")
- (float:XF (match_operand:SI 1 "nonimmediate_operand" "m,!*r")))]
- "TARGET_80387"
- "*
-{
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fild%z0,%1));
- RET;
- }
- else if (GET_CODE (operands[1]) == MEM)
- return AS1 (fild%z1,%1);
- else
- abort ();
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:SI 1 "nonimmediate_operand" "rm")))]
- "TARGET_80387"
- "*
-{
- if (NON_STACK_REG_P (operands[1]))
- {
- output_op_from_reg (operands[1], AS1 (fild%z0,%1));
- RET;
- }
- else if (GET_CODE (operands[1]) == MEM)
- return AS1 (fild%z1,%1);
- else
- abort ();
-}")
-
-;;- add instructions
-
-(define_insn "addsidi3_1"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=&r,r,o,!&r,!r,o,!o")
- (plus:DI (match_operand:DI 1 "general_operand" "0,0,0,o,riF,riF,o")
- (zero_extend:DI (match_operand:SI 2 "general_operand" "o,ri,ri,roi,roi,ri,ri"))))
- (clobber (match_scratch:SI 3 "=X,X,X,X,X,X,&r"))]
- ""
- "*
-{
- rtx low[3], high[3], xops[7], temp;
-
- CC_STATUS_INIT;
-
- split_di (operands, 2, low, high);
- high[2] = const0_rtx;
- low[2] = operands[2];
-
- if (!rtx_equal_p (operands[0], operands[1]))
- {
- xops[0] = high[0];
- xops[1] = low[0];
- xops[2] = high[1];
- xops[3] = low[1];
-
- if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
- {
- output_asm_insn (AS2 (mov%L1,%3,%1), xops);
- output_asm_insn (AS2 (mov%L0,%2,%0), xops);
- }
- else
- {
- xops[4] = high[2];
- xops[5] = low[2];
- xops[6] = operands[3];
- output_asm_insn (AS2 (mov%L6,%3,%6), xops);
- output_asm_insn (AS2 (add%L6,%5,%6), xops);
- output_asm_insn (AS2 (mov%L1,%6,%1), xops);
- output_asm_insn (AS2 (mov%L6,%2,%6), xops);
- output_asm_insn (AS2 (adc%L6,%4,%6), xops);
- output_asm_insn (AS2 (mov%L0,%6,%0), xops);
- RET;
- }
- }
-
- output_asm_insn (AS2 (add%L0,%2,%0), low);
- output_asm_insn (AS2 (adc%L0,%2,%0), high);
- RET;
-}")
-
-(define_insn "addsidi3_2"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=&r,r,o,&r,!&r,&r,o,o,!o")
- (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "o,ri,ri,o,o,ri,ri,i,r"))
- (match_operand:DI 1 "general_operand" "0,0,0,iF,ro,roiF,riF,o,o")))
- (clobber (match_scratch:SI 3 "=X,X,X,X,X,X,X,&r,&r"))]
- ""
- "*
-{
- rtx low[3], high[3], xops[7], temp;
-
- CC_STATUS_INIT;
-
- split_di (operands, 2, low, high);
- high[2] = const0_rtx;
- low[2] = operands[2];
-
- if (!rtx_equal_p (operands[0], operands[1]))
- {
- xops[0] = high[0];
- xops[1] = low[0];
- xops[2] = high[1];
- xops[3] = low[1];
-
- if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
- {
- if (rtx_equal_p (low[0], operands[2]))
- {
- output_asm_insn (AS2 (mov%L0,%2,%0), high);
- output_asm_insn (AS2 (add%L0,%1,%0), low);
- output_asm_insn (AS2 (adc%L0,%1,%0), high);
- RET;
- }
- if (rtx_equal_p (high[0], operands[2]))
- {
- if (GET_CODE (operands[0]) != MEM)
- {
- output_asm_insn (AS2 (mov%L0,%2,%0), low);
- output_asm_insn (AS2 (mov%L0,%2,%0), high);
- output_asm_insn (AS2 (add%L0,%1,%0), low);
- output_asm_insn (AS2 (adc%L0,%1,%0), high);
- }
- else
- {
- /* It's too late to ask for a scratch now - but this
- will probably not happen too often. */
- output_asm_insn (AS2 (add%L1,%2,%1), low);
- output_asm_insn (AS2 (mov%L0,%1,%0), low);
- output_asm_insn (AS2 (mov%L1,%2,%1), low);
- output_asm_insn (AS2 (mov%L0,%2,%0), high);
- output_asm_insn (AS2 (adc%L0,%1,%0), high);
- output_asm_insn (AS2 (sub%L1,%0,%1), low);
- output_asm_insn (AS1 (neg%L1,%1), low);
- }
- RET;
- }
- output_asm_insn (AS2 (mov%L1,%3,%1), xops);
- output_asm_insn (AS2 (mov%L0,%2,%0), xops);
- }
- else
- {
- xops[4] = high[2];
- xops[5] = low[2];
- xops[6] = operands[3];
- output_asm_insn (AS2 (mov%L6,%3,%6), xops);
- output_asm_insn (AS2 (add%L6,%5,%6), xops);
- output_asm_insn (AS2 (mov%L1,%6,%1), xops);
- output_asm_insn (AS2 (mov%L6,%2,%6), xops);
- output_asm_insn (AS2 (adc%L6,%4,%6), xops);
- output_asm_insn (AS2 (mov%L0,%6,%0), xops);
- RET;
- }
- }
-
- output_asm_insn (AS2 (add%L0,%2,%0), low);
- output_asm_insn (AS2 (adc%L0,%2,%0), high);
- RET;
-}")
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "general_operand" "=&r,&ro,o,!&r,!o,!o")
- (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0iF,or,riF,o")
- (match_operand:DI 2 "general_operand" "o,riF,or,or,oriF,o")))
- (clobber (match_scratch:SI 3 "=X,X,&r,X,&r,&r"))]
- ""
- "*
-{
- rtx low[3], high[3], xops[7], temp;
-
- CC_STATUS_INIT;
-
- if (rtx_equal_p (operands[0], operands[2]))
- {
- temp = operands[1];
- operands[1] = operands[2];
- operands[2] = temp;
- }
-
- split_di (operands, 3, low, high);
- if (!rtx_equal_p (operands[0], operands[1]))
- {
- xops[0] = high[0];
- xops[1] = low[0];
- xops[2] = high[1];
- xops[3] = low[1];
-
- if (GET_CODE (operands[0]) != MEM)
- {
- output_asm_insn (AS2 (mov%L1,%3,%1), xops);
- output_asm_insn (AS2 (mov%L0,%2,%0), xops);
- }
- else
- {
- xops[4] = high[2];
- xops[5] = low[2];
- xops[6] = operands[3];
- output_asm_insn (AS2 (mov%L6,%3,%6), xops);
- output_asm_insn (AS2 (add%L6,%5,%6), xops);
- output_asm_insn (AS2 (mov%L1,%6,%1), xops);
- output_asm_insn (AS2 (mov%L6,%2,%6), xops);
- output_asm_insn (AS2 (adc%L6,%4,%6), xops);
- output_asm_insn (AS2 (mov%L0,%6,%0), xops);
- RET;
- }
- }
-
- if (GET_CODE (operands[3]) == REG && GET_CODE (operands[2]) != REG)
- {
- xops[0] = high[0];
- xops[1] = low[0];
- xops[2] = high[2];
- xops[3] = low[2];
- xops[4] = operands[3];
-
- output_asm_insn (AS2 (mov%L4,%3,%4), xops);
- output_asm_insn (AS2 (add%L1,%4,%1), xops);
- output_asm_insn (AS2 (mov%L4,%2,%4), xops);
- output_asm_insn (AS2 (adc%L0,%4,%0), xops);
- }
-
- else if (GET_CODE (low[2]) != CONST_INT || INTVAL (low[2]) != 0)
- {
- output_asm_insn (AS2 (add%L0,%2,%0), low);
- output_asm_insn (AS2 (adc%L0,%2,%0), high);
- }
-
- else
- output_asm_insn (AS2 (add%L0,%2,%0), high);
-
- RET;
-}")
-
-;; On a 486, it is faster to do movl/addl than to do a single leal if
-;; operands[1] and operands[2] are both registers.
-
-(define_expand "addsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "")
- (plus:SI (match_operand:SI 1 "nonimmediate_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "IX86_EXPAND_BINARY_OPERATOR (PLUS, SImode, operands);")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm,r")
- (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,r")
- (match_operand:SI 2 "general_operand" "rmi,ri,ri")))]
- "ix86_binary_operator_ok (PLUS, SImode, operands)"
- "*
-{
- if (REG_P (operands[0]) && REG_P (operands[1])
- && (REG_P (operands[2]) || GET_CODE (operands[2]) == CONST_INT)
- && REGNO (operands[0]) != REGNO (operands[1]))
- {
- if (REG_P (operands[2]) && REGNO (operands[0]) == REGNO (operands[2]))
- return AS2 (add%L0,%1,%0);
-
- if (operands[2] == stack_pointer_rtx)
- {
- rtx temp;
-
- temp = operands[1];
- operands[1] = operands[2];
- operands[2] = temp;
- }
-
- if (operands[2] != stack_pointer_rtx)
- {
- CC_STATUS_INIT;
- operands[1] = SET_SRC (PATTERN (insn));
- return AS2 (lea%L0,%a1,%0);
- }
- }
-
- if (!rtx_equal_p (operands[0], operands[1]))
- output_asm_insn (AS2 (mov%L0,%1,%0), operands);
-
- if (operands[2] == const1_rtx)
- return AS1 (inc%L0,%0);
-
- if (operands[2] == constm1_rtx)
- return AS1 (dec%L0,%0);
-
- /* subl $-128,%ebx is smaller than addl $128,%ebx. */
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) == 128)
- {
- /* This doesn't compute the carry bit in the same way
- * as add%L0, but we use inc and dec above and they
- * don't set the carry bit at all. If inc/dec don't need
- * a CC_STATUS_INIT, this doesn't either... */
- operands[2] = GEN_INT (-128);
- return AS2 (sub%L0,%2,%0);
- }
-
- return AS2 (add%L0,%2,%0);
-}")
-
-;; addsi3 is faster, so put this after.
-
-(define_insn "movsi_lea"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:QI 1 "address_operand" "p"))]
- ""
- "*
-{
- /* Adding a constant to a register is faster with an add. */
- /* ??? can this ever happen? */
- if (GET_CODE (operands[1]) == PLUS
- && GET_CODE (XEXP (operands[1], 1)) == CONST_INT
- && rtx_equal_p (operands[0], XEXP (operands[1], 0)))
- {
- operands[1] = XEXP (operands[1], 1);
-
- if (operands[1] == const1_rtx)
- return AS1 (inc%L0,%0);
-
- if (operands[1] == constm1_rtx)
- return AS1 (dec%L0,%0);
-
- return AS2 (add%L0,%1,%0);
- }
-
- CC_STATUS_INIT;
- return AS2 (lea%L0,%a1,%0);
-}")
-
-;; ??? `lea' here, for three operand add? If leaw is used, only %bx,
-;; %si and %di can appear in SET_SRC, and output_asm_insn might not be
-;; able to handle the operand. But leal always works?
-
-(define_expand "addhi3"
- [(set (match_operand:HI 0 "general_operand" "")
- (plus:HI (match_operand:HI 1 "nonimmediate_operand" "")
- (match_operand:HI 2 "general_operand" "")))]
- ""
- "IX86_EXPAND_BINARY_OPERATOR (PLUS, HImode, operands);")
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
- (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "ri,rm")))]
- "ix86_binary_operator_ok (PLUS, HImode, operands)"
- "*
-{
- /* ??? what about offsettable memory references? */
- if (!TARGET_PENTIUMPRO /* partial stalls are just too painful to risk. */
- && QI_REG_P (operands[0])
- && GET_CODE (operands[2]) == CONST_INT
- && (INTVAL (operands[2]) & 0xff) == 0
- && i386_cc_probably_useless_p (insn))
- {
- int byteval = (INTVAL (operands[2]) >> 8) & 0xff;
- CC_STATUS_INIT;
-
- if (byteval == 1)
- return AS1 (inc%B0,%h0);
- else if (byteval == 255)
- return AS1 (dec%B0,%h0);
-
- operands[2] = GEN_INT (byteval);
- return AS2 (add%B0,%2,%h0);
- }
-
- /* Use a 32-bit operation when possible, to avoid the prefix penalty. */
- if (REG_P (operands[0])
- && i386_aligned_p (operands[2])
- && i386_cc_probably_useless_p (insn))
- {
- CC_STATUS_INIT;
-
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- HOST_WIDE_INT intval = 0xffff & INTVAL (operands[2]);
-
- if (intval == 1)
- return AS1 (inc%L0,%k0);
-
- if (intval == 0xffff)
- return AS1 (dec%L0,%k0);
-
- operands[2] = i386_sext16_if_const (operands[2]);
- }
- return AS2 (add%L0,%k2,%k0);
- }
-
- if (operands[2] == const1_rtx)
- return AS1 (inc%W0,%0);
-
- if (operands[2] == constm1_rtx
- || (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) == 65535))
- return AS1 (dec%W0,%0);
-
- return AS2 (add%W0,%2,%0);
-}")
-
-(define_expand "addqi3"
- [(set (match_operand:QI 0 "general_operand" "")
- (plus:QI (match_operand:QI 1 "general_operand" "")
- (match_operand:QI 2 "general_operand" "")))]
- ""
- "IX86_EXPAND_BINARY_OPERATOR (PLUS, QImode, operands);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
- (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "qn,qmn")))]
- "ix86_binary_operator_ok (PLUS, QImode, operands)"
- "*
-{
- if (operands[2] == const1_rtx)
- return AS1 (inc%B0,%0);
-
- if (operands[2] == constm1_rtx
- || (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) == 255))
- return AS1 (dec%B0,%0);
-
- return AS2 (add%B0,%2,%0);
-}")
-
-;Lennart Augustsson <augustss@cs.chalmers.se>
-;says this pattern just makes slower code:
-; pushl %ebp
-; addl $-80,(%esp)
-;instead of
-; leal -80(%ebp),%eax
-; pushl %eax
-;
-;(define_insn ""
-; [(set (match_operand:SI 0 "push_operand" "=<")
-; (plus:SI (match_operand:SI 1 "register_operand" "%r")
-; (match_operand:SI 2 "nonmemory_operand" "ri")))]
-; ""
-; "*
-;{
-; rtx xops[4];
-; xops[0] = operands[0];
-; xops[1] = operands[1];
-; xops[2] = operands[2];
-; xops[3] = gen_rtx (MEM, SImode, stack_pointer_rtx);
-; output_asm_insn (\"push%z1 %1\", xops);
-; output_asm_insn (AS2 (add%z3,%2,%3), xops);
-; RET;
-;}")
-
-;; The patterns that match these are at the end of this file.
-
-(define_expand "addxf3"
- [(set (match_operand:XF 0 "register_operand" "")
- (plus:XF (match_operand:XF 1 "register_operand" "")
- (match_operand:XF 2 "register_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "adddf3"
- [(set (match_operand:DF 0 "register_operand" "")
- (plus:DF (match_operand:DF 1 "nonimmediate_operand" "")
- (match_operand:DF 2 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "addsf3"
- [(set (match_operand:SF 0 "register_operand" "")
- (plus:SF (match_operand:SF 1 "nonimmediate_operand" "")
- (match_operand:SF 2 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-;;- subtract instructions
-
-(define_insn "subsidi3"
- [(set (match_operand:DI 0 "general_operand" "=&r,&ro,&r,!&r,o,o,!o")
- (minus:DI (match_operand:DI 1 "general_operand" "0iF,0,roiF,roiF,riF,o,o")
- (zero_extend:DI (match_operand:SI 2 "general_operand" "o,ri,ri,o,ri,i,r"))))
- (clobber (match_scratch:SI 3 "=X,X,X,X,X,&r,&r"))]
- ""
- "*
-{
- rtx low[3], high[3], xops[7];
-
- CC_STATUS_INIT;
-
- split_di (operands, 2, low, high);
- high[2] = const0_rtx;
- low[2] = operands[2];
-
- if (!rtx_equal_p (operands[0], operands[1]))
- {
- xops[0] = high[0];
- xops[1] = low[0];
- xops[2] = high[1];
- xops[3] = low[1];
-
- if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
- {
- output_asm_insn (AS2 (mov%L1,%3,%1), xops);
- output_asm_insn (AS2 (mov%L0,%2,%0), xops);
- }
- else
- {
- xops[4] = high[2];
- xops[5] = low[2];
- xops[6] = operands[3];
- output_asm_insn (AS2 (mov%L6,%3,%6), xops);
- output_asm_insn (AS2 (sub%L6,%5,%6), xops);
- output_asm_insn (AS2 (mov%L1,%6,%1), xops);
- output_asm_insn (AS2 (mov%L6,%2,%6), xops);
- output_asm_insn (AS2 (sbb%L6,%4,%6), xops);
- output_asm_insn (AS2 (mov%L0,%6,%0), xops);
- RET;
- }
- }
-
- output_asm_insn (AS2 (sub%L0,%2,%0), low);
- output_asm_insn (AS2 (sbb%L0,%2,%0), high);
- RET;
-}")
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "general_operand" "=&r,&ro,o,o,!&r,!o")
- (minus:DI (match_operand:DI 1 "general_operand" "0,0,0iF,or,roiF,roiF")
- (match_operand:DI 2 "general_operand" "or,riF,or,iF,roiF,roiF")))
- (clobber (match_scratch:SI 3 "=X,X,&r,&r,X,&r"))]
- ""
- "*
-{
- rtx low[3], high[3], xops[7];
-
- CC_STATUS_INIT;
-
- split_di (operands, 3, low, high);
-
- if (!rtx_equal_p (operands[0], operands[1]))
- {
- xops[0] = high[0];
- xops[1] = low[0];
- xops[2] = high[1];
- xops[3] = low[1];
-
- if (GET_CODE (operands[0]) != MEM)
- {
- output_asm_insn (AS2 (mov%L1,%3,%1), xops);
- output_asm_insn (AS2 (mov%L0,%2,%0), xops);
- }
- else
- {
- xops[4] = high[2];
- xops[5] = low[2];
- xops[6] = operands[3];
- output_asm_insn (AS2 (mov%L6,%3,%6), xops);
- output_asm_insn (AS2 (sub%L6,%5,%6), xops);
- output_asm_insn (AS2 (mov%L1,%6,%1), xops);
- output_asm_insn (AS2 (mov%L6,%2,%6), xops);
- output_asm_insn (AS2 (sbb%L6,%4,%6), xops);
- output_asm_insn (AS2 (mov%L0,%6,%0), xops);
- RET;
- }
- }
-
- if (GET_CODE (operands[3]) == REG)
- {
- xops[0] = high[0];
- xops[1] = low[0];
- xops[2] = high[2];
- xops[3] = low[2];
- xops[4] = operands[3];
-
- output_asm_insn (AS2 (mov%L4,%3,%4), xops);
- output_asm_insn (AS2 (sub%L1,%4,%1), xops);
- output_asm_insn (AS2 (mov%L4,%2,%4), xops);
- output_asm_insn (AS2 (sbb%L0,%4,%0), xops);
- }
-
- else if (GET_CODE (low[2]) != CONST_INT || INTVAL (low[2]) != 0)
- {
- output_asm_insn (AS2 (sub%L0,%2,%0), low);
- output_asm_insn (AS2 (sbb%L0,%2,%0), high);
- }
-
- else
- output_asm_insn (AS2 (sub%L0,%2,%0), high);
-
- RET;
-}")
-
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "")
- (minus:SI (match_operand:SI 1 "nonimmediate_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "IX86_EXPAND_BINARY_OPERATOR (MINUS, SImode, operands);")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
- (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
- (match_operand:SI 2 "general_operand" "ri,rm")))]
- "ix86_binary_operator_ok (MINUS, SImode, operands)"
- "* return AS2 (sub%L0,%2,%0);")
-
-(define_expand "subhi3"
- [(set (match_operand:HI 0 "general_operand" "")
- (minus:HI (match_operand:HI 1 "nonimmediate_operand" "")
- (match_operand:HI 2 "general_operand" "")))]
- ""
- "IX86_EXPAND_BINARY_OPERATOR (MINUS, HImode, operands);")
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
- (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
- (match_operand:HI 2 "general_operand" "ri,rm")))]
- "ix86_binary_operator_ok (MINUS, HImode, operands)"
- "*
-{
- if (REG_P (operands[0])
- && i386_aligned_p (operands[2])
- && i386_cc_probably_useless_p (insn))
- {
- CC_STATUS_INIT;
- operands[2] = i386_sext16_if_const (operands[2]);
- return AS2 (sub%L0,%k2,%k0);
- }
- return AS2 (sub%W0,%2,%0);
-}")
-
-(define_expand "subqi3"
- [(set (match_operand:QI 0 "general_operand" "")
- (minus:QI (match_operand:QI 1 "general_operand" "")
- (match_operand:QI 2 "general_operand" "")))]
- ""
- "IX86_EXPAND_BINARY_OPERATOR (MINUS, QImode, operands);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
- (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
- (match_operand:QI 2 "general_operand" "qn,qmn")))]
- "ix86_binary_operator_ok (MINUS, QImode, operands)"
- "* return AS2 (sub%B0,%2,%0);")
-
-;; The patterns that match these are at the end of this file.
-
-(define_expand "subxf3"
- [(set (match_operand:XF 0 "register_operand" "")
- (minus:XF (match_operand:XF 1 "register_operand" "")
- (match_operand:XF 2 "register_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "subdf3"
- [(set (match_operand:DF 0 "register_operand" "")
- (minus:DF (match_operand:DF 1 "nonimmediate_operand" "")
- (match_operand:DF 2 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "subsf3"
- [(set (match_operand:SF 0 "register_operand" "")
- (minus:SF (match_operand:SF 1 "nonimmediate_operand" "")
- (match_operand:SF 2 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-;;- multiply instructions
-
-;(define_insn "mulqi3"
-; [(set (match_operand:QI 0 "register_operand" "=a")
-; (mult:QI (match_operand:QI 1 "register_operand" "%0")
-; (match_operand:QI 2 "nonimmediate_operand" "qm")))]
-; ""
-; "imul%B0 %2,%0")
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (mult:HI (match_operand:HI 1 "nonimmediate_operand" "%0,rm")
- (match_operand:HI 2 "general_operand" "g,i")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) == REGNO (operands[0])
- && (GET_CODE (operands[2]) == MEM || GET_CODE (operands[2]) == REG))
- /* Assembler has weird restrictions. */
- return AS2 (imul%W0,%2,%0);
- return AS3 (imul%W0,%2,%1,%0);
-}"
- [(set_attr "type" "imul")])
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm")
- (match_operand:SI 2 "general_operand" "g,i")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) == REGNO (operands[0])
- && (GET_CODE (operands[2]) == MEM || GET_CODE (operands[2]) == REG))
- /* Assembler has weird restrictions. */
- return AS2 (imul%L0,%2,%0);
- return AS3 (imul%L0,%2,%1,%0);
-}"
- [(set_attr "type" "imul")])
-
-(define_insn "umulqihi3"
- [(set (match_operand:HI 0 "register_operand" "=a")
- (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%0"))
- (zero_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))]
- ""
- "mul%B0 %2"
- [(set_attr "type" "imul")])
-
-(define_insn "mulqihi3"
- [(set (match_operand:HI 0 "register_operand" "=a")
- (mult:HI (sign_extend:HI (match_operand:QI 1 "register_operand" "%0"))
- (sign_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))]
- ""
- "imul%B0 %2"
- [(set_attr "type" "imul")])
-
-(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "register_operand" "=A")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0"))
- (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))]
- "TARGET_WIDE_MULTIPLY"
- "mul%L0 %2"
- [(set_attr "type" "imul")])
-
-(define_insn "mulsidi3"
- [(set (match_operand:DI 0 "register_operand" "=A")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%0"))
- (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))]
- "TARGET_WIDE_MULTIPLY"
- "imul%L0 %2"
- [(set_attr "type" "imul")])
-
-(define_insn "umulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%a"))
- (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm")))
- (const_int 32))))
- (clobber (match_scratch:SI 3 "=a"))]
- "TARGET_WIDE_MULTIPLY"
- "mul%L0 %2"
- [(set_attr "type" "imul")])
-
-(define_insn "smulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%a"))
- (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm")))
- (const_int 32))))
- (clobber (match_scratch:SI 3 "=a"))]
- "TARGET_WIDE_MULTIPLY"
- "imul%L0 %2"
- [(set_attr "type" "imul")])
-
-;; The patterns that match these are at the end of this file.
-
-(define_expand "mulxf3"
- [(set (match_operand:XF 0 "register_operand" "")
- (mult:XF (match_operand:XF 1 "register_operand" "")
- (match_operand:XF 2 "register_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "muldf3"
- [(set (match_operand:DF 0 "register_operand" "")
- (mult:DF (match_operand:DF 1 "register_operand" "")
- (match_operand:DF 2 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "")
- (mult:SF (match_operand:SF 1 "register_operand" "")
- (match_operand:SF 2 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-;;- divide instructions
-
-(define_insn "divqi3"
- [(set (match_operand:QI 0 "register_operand" "=a")
- (div:QI (match_operand:HI 1 "register_operand" "0")
- (match_operand:QI 2 "nonimmediate_operand" "qm")))]
- ""
- "idiv%B0 %2")
-
-(define_insn "udivqi3"
- [(set (match_operand:QI 0 "register_operand" "=a")
- (udiv:QI (match_operand:HI 1 "register_operand" "0")
- (match_operand:QI 2 "nonimmediate_operand" "qm")))]
- ""
- "div%B0 %2"
- [(set_attr "type" "idiv")])
-
-;; The patterns that match these are at the end of this file.
-
-(define_expand "divxf3"
- [(set (match_operand:XF 0 "register_operand" "")
- (div:XF (match_operand:XF 1 "register_operand" "")
- (match_operand:XF 2 "register_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "divdf3"
- [(set (match_operand:DF 0 "register_operand" "")
- (div:DF (match_operand:DF 1 "register_operand" "")
- (match_operand:DF 2 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-(define_expand "divsf3"
- [(set (match_operand:SF 0 "register_operand" "")
- (div:SF (match_operand:SF 1 "register_operand" "")
- (match_operand:SF 2 "nonimmediate_operand" "")))]
- "TARGET_80387"
- "")
-
-;; Remainder instructions.
-
-(define_insn "divmodsi4"
- [(set (match_operand:SI 0 "register_operand" "=a")
- (div:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "nonimmediate_operand" "rm")))
- (set (match_operand:SI 3 "register_operand" "=&d")
- (mod:SI (match_dup 1) (match_dup 2)))]
- ""
- "*
-{
-#ifdef INTEL_SYNTAX
- output_asm_insn (\"cdq\", operands);
-#else
- output_asm_insn (\"cltd\", operands);
-#endif
- return AS1 (idiv%L0,%2);
-}"
- [(set_attr "type" "idiv")])
-
-(define_insn "divmodhi4"
- [(set (match_operand:HI 0 "register_operand" "=a")
- (div:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:HI 2 "nonimmediate_operand" "rm")))
- (set (match_operand:HI 3 "register_operand" "=&d")
- (mod:HI (match_dup 1) (match_dup 2)))]
- ""
- "cwtd\;idiv%W0 %2"
- [(set_attr "type" "idiv")])
-
-;; ??? Can we make gcc zero extend operand[0]?
-(define_insn "udivmodsi4"
- [(set (match_operand:SI 0 "register_operand" "=a")
- (udiv:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "nonimmediate_operand" "rm")))
- (set (match_operand:SI 3 "register_operand" "=&d")
- (umod:SI (match_dup 1) (match_dup 2)))]
- ""
- "*
-{
- output_asm_insn (AS2 (xor%L3,%3,%3), operands);
- return AS1 (div%L0,%2);
-}"
- [(set_attr "type" "idiv")])
-
-;; ??? Can we make gcc zero extend operand[0]?
-(define_insn "udivmodhi4"
- [(set (match_operand:HI 0 "register_operand" "=a")
- (udiv:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:HI 2 "nonimmediate_operand" "rm")))
- (set (match_operand:HI 3 "register_operand" "=&d")
- (umod:HI (match_dup 1) (match_dup 2)))]
- ""
- "*
-{
- output_asm_insn (AS2 (xor%W0,%3,%3), operands);
- return AS1 (div%W0,%2);
-}"
- [(set_attr "type" "idiv")])
-
-/*
-;;this should be a valid double division which we may want to add
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=a")
- (udiv:DI (match_operand:DI 1 "register_operand" "a")
- (match_operand:SI 2 "nonimmediate_operand" "rm")))
- (set (match_operand:SI 3 "register_operand" "=d")
- (umod:SI (match_dup 1) (match_dup 2)))]
- ""
- "div%L0 %2,%0"
- [(set_attr "type" "idiv")])
-*/
-
-;;- and instructions
-
-;; On i386,
-;; movzbl %bl,%ebx
-;; is faster than
-;; andl $255,%ebx
-;;
-;; but if the reg is %eax, then the "andl" is faster.
-;;
-;; On i486, the "andl" is always faster than the "movzbl".
-;;
-;; On both i386 and i486, a three operand AND is as fast with movzbl or
-;; movzwl as with andl, if operands[0] != operands[1].
-
-;; The `r' in `rm' for operand 3 looks redundant, but it causes
-;; optional reloads to be generated if op 3 is a pseudo in a stack slot.
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
- (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "ri,rm")))]
- ""
- "*
-{
- HOST_WIDE_INT intval;
- if (!rtx_equal_p (operands[0], operands[1])
- && rtx_equal_p (operands[0], operands[2]))
- {
- rtx tmp;
- tmp = operands[1];
- operands[1] = operands[2];
- operands[2] = tmp;
- }
- switch (GET_CODE (operands[2]))
- {
- case CONST_INT:
- if (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))
- break;
- intval = INTVAL (operands[2]);
- /* zero-extend 16->32? */
- if (intval == 0xffff && REG_P (operands[0])
- && (! REG_P (operands[1])
- || REGNO (operands[0]) != 0 || REGNO (operands[1]) != 0)
- && (!TARGET_ZERO_EXTEND_WITH_AND || ! rtx_equal_p (operands[0], operands[1])))
- {
- /* ??? tege: Should forget CC_STATUS only if we clobber a
- remembered operand. Fix that later. */
- CC_STATUS_INIT;
-#ifdef INTEL_SYNTAX
- return AS2 (movzx,%w1,%0);
-#else
- return AS2 (movz%W0%L0,%w1,%0);
-#endif
- }
-
- /* zero extend 8->32? */
- if (intval == 0xff && REG_P (operands[0])
- && !(REG_P (operands[1]) && NON_QI_REG_P (operands[1]))
- && (! REG_P (operands[1])
- || REGNO (operands[0]) != 0 || REGNO (operands[1]) != 0)
- && (!TARGET_ZERO_EXTEND_WITH_AND || ! rtx_equal_p (operands[0], operands[1])))
- {
- /* ??? tege: Should forget CC_STATUS only if we clobber a
- remembered operand. Fix that later. */
- CC_STATUS_INIT;
-#ifdef INTEL_SYNTAX
- return AS2 (movzx,%b1,%0);
-#else
- return AS2 (movz%B0%L0,%b1,%0);
-#endif
- }
-
- /* Check partial bytes.. non-QI-regs are not available */
- if (REG_P (operands[0]) && ! QI_REG_P (operands[0]))
- break;
-
- /* only low byte has zero bits? */
- if (~(intval | 0xff) == 0)
- {
- intval &= 0xff;
- if (REG_P (operands[0]))
- {
- if (intval == 0)
- {
- CC_STATUS_INIT;
- return AS2 (xor%B0,%b0,%b0);
- }
-
- /* we're better off with the 32-bit version if reg != EAX */
- /* the value is sign-extended in 8 bits */
- if (REGNO (operands[0]) != 0 && (intval & 0x80))
- break;
- }
-
- CC_STATUS_INIT;
-
- operands[2] = GEN_INT (intval);
-
- if (intval == 0)
- return AS2 (mov%B0,%2,%b0);
-
- return AS2 (and%B0,%2,%b0);
- }
-
- /* only second byte has zero? */
- if (~(intval | 0xff00) == 0)
- {
- CC_STATUS_INIT;
-
- intval = (intval >> 8) & 0xff;
- operands[2] = GEN_INT (intval);
- if (intval == 0)
- {
- if (REG_P (operands[0]))
- return AS2 (xor%B0,%h0,%h0);
- operands[0] = adj_offsettable_operand (operands[0], 1);
- return AS2 (mov%B0,%2,%b0);
- }
-
- if (REG_P (operands[0]))
- return AS2 (and%B0,%2,%h0);
-
- operands[0] = adj_offsettable_operand (operands[0], 1);
- return AS2 (and%B0,%2,%b0);
- }
-
- if (REG_P (operands[0]))
- break;
-
- /* third byte has zero bits? */
- if (~(intval | 0xff0000) == 0)
- {
- intval = (intval >> 16) & 0xff;
- operands[0] = adj_offsettable_operand (operands[0], 2);
-byte_and_operation:
- CC_STATUS_INIT;
- operands[2] = GEN_INT (intval);
- if (intval == 0)
- return AS2 (mov%B0,%2,%b0);
- return AS2 (and%B0,%2,%b0);
- }
-
- /* fourth byte has zero bits? */
- if (~(intval | 0xff000000) == 0)
- {
- intval = (intval >> 24) & 0xff;
- operands[0] = adj_offsettable_operand (operands[0], 3);
- goto byte_and_operation;
- }
-
- /* Low word is zero? */
- if (intval == 0xffff0000)
- {
-word_zero_and_operation:
- CC_STATUS_INIT;
- operands[2] = const0_rtx;
- return AS2 (mov%W0,%2,%w0);
- }
-
- /* High word is zero? */
- if (intval == 0x0000ffff)
- {
- operands[0] = adj_offsettable_operand (operands[0], 2);
- goto word_zero_and_operation;
- }
- }
-
- return AS2 (and%L0,%2,%0);
-}")
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
- (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "ri,rm")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && ! (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))
- {
- /* Can we ignore the upper byte? */
- if ((! REG_P (operands[0]) || QI_REG_P (operands[0]))
- && (INTVAL (operands[2]) & 0xff00) == 0xff00)
- {
- CC_STATUS_INIT;
-
- if ((INTVAL (operands[2]) & 0xff) == 0)
- {
- operands[2] = const0_rtx;
- return AS2 (mov%B0,%2,%b0);
- }
-
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0xff);
- return AS2 (and%B0,%2,%b0);
- }
-
- /* Can we ignore the lower byte? */
- /* ??? what about offsettable memory references? */
- if (QI_REG_P (operands[0]) && (INTVAL (operands[2]) & 0xff) == 0xff)
- {
- CC_STATUS_INIT;
-
- if ((INTVAL (operands[2]) & 0xff00) == 0)
- {
- operands[2] = const0_rtx;
- return AS2 (mov%B0,%2,%h0);
- }
-
- operands[2] = GEN_INT ((INTVAL (operands[2]) >> 8) & 0xff);
- return AS2 (and%B0,%2,%h0);
- }
-
- /* use 32-bit ops on registers when there are no sign issues.. */
- if (REG_P (operands[0]))
- {
- if (!(INTVAL (operands[2]) & ~0x7fff))
- return AS2 (and%L0,%2,%k0);
- }
- }
-
- if (REG_P (operands[0])
- && i386_aligned_p (operands[2]))
- {
- CC_STATUS_INIT;
- /* If op[2] is constant, we should zero-extend it and */
- /* make a note that op[0] has been zero-extended, so */
- /* that we could use 32-bit ops on it forthwith, but */
- /* there is no such reg-note available. Instead we do */
- /* a sign extension as that can result in shorter asm */
- operands[2] = i386_sext16_if_const (operands[2]);
- return AS2 (and%L0,%k2,%k0);
- }
-
- /* Use a 32-bit word with the upper bits set, invalidate CC */
- if (GET_CODE (operands[2]) == CONST_INT
- && i386_aligned_p (operands[0]))
- {
- HOST_WIDE_INT val = INTVAL (operands[2]);
- CC_STATUS_INIT;
- val |= ~0xffff;
- if (val != INTVAL (operands[2]))
- operands[2] = GEN_INT (val);
- return AS2 (and%L0,%k2,%k0);
- }
-
- return AS2 (and%W0,%2,%0);
-}")
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
- (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "qn,qmn")))]
- ""
- "* return AS2 (and%B0,%2,%0);")
-
-/* I am nervous about these two.. add them later..
-;I presume this means that we have something in say op0= eax which is small
-;and we want to and it with memory so we can do this by just an
-;andb m,%al and have success.
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (and:SI (zero_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "rm"))
- (match_operand:SI 2 "general_operand" "0")))]
- "GET_CODE (operands[2]) == CONST_INT
- && (unsigned int) INTVAL (operands[2]) < (1 << GET_MODE_BITSIZE (HImode))"
- "and%W0 %1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=q")
- (and:SI
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm"))
- (match_operand:SI 2 "register_operand" "0")))]
- "GET_CODE (operands[2]) == CONST_INT
- && (unsigned int) INTVAL (operands[2]) < (1 << GET_MODE_BITSIZE (QImode))"
- "and%L0 %1,%0")
-
-*/
-
-;;- Bit set (inclusive or) instructions
-
-;; This optimizes known byte-wide operations to memory, and in some cases
-;; to QI registers.. Note that we don't want to use the QI registers too
-;; aggressively, because often the 32-bit register instruction is the same
-;; size, and likely to be faster on PentiumPro.
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
- (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "ri,rm")))]
- ""
- "*
-{
- HOST_WIDE_INT intval;
- switch (GET_CODE (operands[2]))
- {
- case CONST_INT:
-
- if (REG_P (operands[0]) && ! QI_REG_P (operands[0]))
- break;
-
- /* don't try to optimize volatile accesses */
- if (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))
- break;
-
- intval = INTVAL (operands[2]);
- if ((intval & ~0xff) == 0)
- {
- if (REG_P (operands[0]))
- {
- /* Do low byte access only for %eax or when high bit is set */
- if (REGNO (operands[0]) != 0 && !(intval & 0x80))
- break;
- }
-
-byte_or_operation:
- CC_STATUS_INIT;
-
- if (intval != INTVAL (operands[2]))
- operands[2] = GEN_INT (intval);
-
- if (intval == 0xff)
- return AS2 (mov%B0,%2,%b0);
-
- return AS2 (or%B0,%2,%b0);
- }
-
- /* second byte? */
- if ((intval & ~0xff00) == 0)
- {
- intval >>= 8;
-
- if (REG_P (operands[0]))
- {
- CC_STATUS_INIT;
- operands[2] = GEN_INT (intval);
- if (intval == 0xff)
- return AS2 (mov%B0,%2,%h0);
-
- return AS2 (or%B0,%2,%h0);
- }
-
- operands[0] = adj_offsettable_operand (operands[0], 1);
- goto byte_or_operation;
- }
-
- if (REG_P (operands[0]))
- break;
-
- /* third byte? */
- if ((intval & ~0xff0000) == 0)
- {
- intval >>= 16;
- operands[0] = adj_offsettable_operand (operands[0], 2);
- goto byte_or_operation;
- }
-
- /* fourth byte? */
- if ((intval & ~0xff000000) == 0)
- {
- intval = (intval >> 24) & 0xff;
- operands[0] = adj_offsettable_operand (operands[0], 3);
- goto byte_or_operation;
- }
- }
-
- return AS2 (or%L0,%2,%0);
-}")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
- (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "ri,rm")))]
- ""
- "*
-{
- HOST_WIDE_INT intval;
- switch (GET_CODE (operands[2]))
- {
- case CONST_INT:
-
- if (REG_P (operands[0]) && ! QI_REG_P (operands[0]))
- break;
-
- /* don't try to optimize volatile accesses */
- if (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))
- break;
-
- intval = 0xffff & INTVAL (operands[2]);
-
- if ((intval & 0xff00) == 0)
- {
- if (REG_P (operands[0]))
- {
- /* Do low byte access only for %eax or when high bit is set */
- if (REGNO (operands[0]) != 0 && !(intval & 0x80))
- break;
- }
-
-byte_or_operation:
- CC_STATUS_INIT;
-
- if (intval == 0xff)
- return AS2 (mov%B0,%2,%b0);
-
- return AS2 (or%B0,%2,%b0);
- }
-
- /* high byte? */
- if ((intval & 0xff) == 0)
- {
- intval >>= 8;
- operands[2] = GEN_INT (intval);
-
- if (REG_P (operands[0]))
- {
- CC_STATUS_INIT;
- if (intval == 0xff)
- return AS2 (mov%B0,%2,%h0);
-
- return AS2 (or%B0,%2,%h0);
- }
-
- operands[0] = adj_offsettable_operand (operands[0], 1);
-
- goto byte_or_operation;
- }
- }
-
- if (REG_P (operands[0])
- && i386_aligned_p (operands[2]))
- {
- CC_STATUS_INIT;
- operands[2] = i386_sext16_if_const (operands[2]);
- return AS2 (or%L0,%k2,%k0);
- }
-
- if (GET_CODE (operands[2]) == CONST_INT
- && i386_aligned_p (operands[0]))
- {
- CC_STATUS_INIT;
- intval = 0xffff & INTVAL (operands[2]);
- if (intval != INTVAL (operands[2]))
- operands[2] = GEN_INT (intval);
- return AS2 (or%L0,%2,%k0);
- }
-
- return AS2 (or%W0,%2,%0);
-}")
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
- (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "qn,qmn")))]
- ""
- "* return AS2 (or%B0,%2,%0);")
-
-;;- xor instructions
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
- (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "ri,rm")))]
- ""
- "*
-{
- HOST_WIDE_INT intval;
- switch (GET_CODE (operands[2]))
- {
- case CONST_INT:
-
- if (REG_P (operands[0]) && ! QI_REG_P (operands[0]))
- break;
-
- /* don't try to optimize volatile accesses */
- if (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))
- break;
-
- intval = INTVAL (operands[2]);
- if ((intval & ~0xff) == 0)
- {
- if (REG_P (operands[0]))
- {
- /* Do low byte access only for %eax or when high bit is set */
- if (REGNO (operands[0]) != 0 && !(intval & 0x80))
- break;
- }
-
-byte_xor_operation:
- CC_STATUS_INIT;
-
- if (intval == 0xff)
- return AS1 (not%B0,%b0);
-
- if (intval != INTVAL (operands[2]))
- operands[2] = GEN_INT (intval);
- return AS2 (xor%B0,%2,%b0);
- }
-
- /* second byte? */
- if ((intval & ~0xff00) == 0)
- {
- intval >>= 8;
-
- if (REG_P (operands[0]))
- {
- CC_STATUS_INIT;
- if (intval == 0xff)
- return AS1 (not%B0,%h0);
-
- operands[2] = GEN_INT (intval);
- return AS2 (xor%B0,%2,%h0);
- }
-
- operands[0] = adj_offsettable_operand (operands[0], 1);
-
- goto byte_xor_operation;
- }
-
- if (REG_P (operands[0]))
- break;
-
- /* third byte? */
- if ((intval & ~0xff0000) == 0)
- {
- intval >>= 16;
- operands[0] = adj_offsettable_operand (operands[0], 2);
- goto byte_xor_operation;
- }
-
- /* fourth byte? */
- if ((intval & ~0xff000000) == 0)
- {
- intval = (intval >> 24) & 0xff;
- operands[0] = adj_offsettable_operand (operands[0], 3);
- goto byte_xor_operation;
- }
- }
-
- return AS2 (xor%L0,%2,%0);
-}")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
- (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "ri,rm")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && ! (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))
- {
- /* Can we ignore the upper byte? */
- if ((! REG_P (operands[0]) || QI_REG_P (operands[0]))
- && (INTVAL (operands[2]) & 0xff00) == 0)
- {
- CC_STATUS_INIT;
- if (INTVAL (operands[2]) & 0xffff0000)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffff);
-
- if (INTVAL (operands[2]) == 0xff)
- return AS1 (not%B0,%b0);
-
- return AS2 (xor%B0,%2,%b0);
- }
-
- /* Can we ignore the lower byte? */
- /* ??? what about offsettable memory references? */
- if (QI_REG_P (operands[0])
- && (INTVAL (operands[2]) & 0xff) == 0)
- {
- CC_STATUS_INIT;
- operands[2] = GEN_INT ((INTVAL (operands[2]) >> 8) & 0xff);
-
- if (INTVAL (operands[2]) == 0xff)
- return AS1 (not%B0,%h0);
-
- return AS2 (xor%B0,%2,%h0);
- }
- }
-
- if (REG_P (operands[0])
- && i386_aligned_p (operands[2]))
- {
- CC_STATUS_INIT;
- operands[2] = i386_sext16_if_const (operands[2]);
- return AS2 (xor%L0,%k2,%k0);
- }
-
- if (GET_CODE (operands[2]) == CONST_INT
- && i386_aligned_p (operands[0]))
- {
- HOST_WIDE_INT intval;
- CC_STATUS_INIT;
- intval = 0xffff & INTVAL (operands[2]);
- if (intval != INTVAL (operands[2]))
- operands[2] = GEN_INT (intval);
- return AS2 (xor%L0,%2,%k0);
- }
-
- return AS2 (xor%W0,%2,%0);
-}")
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q")
- (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "qn,qm")))]
- ""
- "* return AS2 (xor%B0,%2,%0);")
-
-;;- negation instructions
-
-(define_insn "negdi2"
- [(set (match_operand:DI 0 "general_operand" "=&ro")
- (neg:DI (match_operand:DI 1 "general_operand" "0")))]
- ""
- "*
-{
- rtx xops[2], low[1], high[1];
-
- CC_STATUS_INIT;
-
- split_di (operands, 1, low, high);
- xops[0] = const0_rtx;
- xops[1] = high[0];
-
- output_asm_insn (AS1 (neg%L0,%0), low);
- output_asm_insn (AS2 (adc%L1,%0,%1), xops);
- output_asm_insn (AS1 (neg%L0,%0), high);
- RET;
-}")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
- ""
- "neg%L0 %0")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
- (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
- ""
- "neg%W0 %0")
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
- (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0")))]
- ""
- "neg%B0 %0")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (neg:SF (match_operand:SF 1 "register_operand" "0")))]
- "TARGET_80387"
- "fchs")
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (neg:DF (match_operand:DF 1 "register_operand" "0")))]
- "TARGET_80387"
- "fchs")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (neg:DF (float_extend:DF (match_operand:SF 1 "register_operand" "0"))))]
- "TARGET_80387"
- "fchs")
-
-(define_insn "negxf2"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (neg:XF (match_operand:XF 1 "register_operand" "0")))]
- "TARGET_80387"
- "fchs")
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f")
- (neg:XF (float_extend:XF (match_operand:DF 1 "register_operand" "0"))))]
- "TARGET_80387"
- "fchs")
-
-;; Absolute value instructions
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (abs:SF (match_operand:SF 1 "register_operand" "0")))]
- "TARGET_80387"
- "fabs"
- [(set_attr "type" "fpop")])
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (abs:DF (match_operand:DF 1 "register_operand" "0")))]
- "TARGET_80387"
- "fabs"
- [(set_attr "type" "fpop")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (abs:DF (float_extend:DF (match_operand:SF 1 "register_operand" "0"))))]
- "TARGET_80387"
- "fabs"
- [(set_attr "type" "fpop")])
-
-(define_insn "absxf2"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (abs:XF (match_operand:XF 1 "register_operand" "0")))]
- "TARGET_80387"
- "fabs"
- [(set_attr "type" "fpop")])
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f")
- (abs:XF (float_extend:XF (match_operand:DF 1 "register_operand" "0"))))]
- "TARGET_80387"
- "fabs"
- [(set_attr "type" "fpop")])
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387"
- "fsqrt")
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (sqrt:DF (match_operand:DF 1 "register_operand" "0")))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
- && (TARGET_IEEE_FP || flag_fast_math) "
- "fsqrt")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (sqrt:DF (float_extend:DF
- (match_operand:SF 1 "register_operand" "0"))))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387"
- "fsqrt")
-
-(define_insn "sqrtxf2"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (sqrt:XF (match_operand:XF 1 "register_operand" "0")))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387
- && (TARGET_IEEE_FP || flag_fast_math) "
- "fsqrt")
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f")
- (sqrt:XF (float_extend:XF
- (match_operand:DF 1 "register_operand" "0"))))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387"
- "fsqrt")
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f")
- (sqrt:XF (float_extend:XF
- (match_operand:SF 1 "register_operand" "0"))))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387"
- "fsqrt")
-
-(define_insn "sindf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 1))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math"
- "fsin")
-
-(define_insn "sinsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 1))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math"
- "fsin")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (unspec:DF [(float_extend:DF
- (match_operand:SF 1 "register_operand" "0"))] 1))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math"
- "fsin")
-
-(define_insn "sinxf2"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (unspec:XF [(match_operand:XF 1 "register_operand" "0")] 1))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math"
- "fsin")
-
-(define_insn "cosdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 2))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math"
- "fcos")
-
-(define_insn "cossf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 2))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math"
- "fcos")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (unspec:DF [(float_extend:DF
- (match_operand:SF 1 "register_operand" "0"))] 2))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math"
- "fcos")
-
-(define_insn "cosxf2"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (unspec:XF [(match_operand:XF 1 "register_operand" "0")] 2))]
- "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math"
- "fcos")
-
-;;- one complement instructions
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
- ""
- "not%L0 %0")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
- (not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
- ""
- "not%W0 %0")
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
- (not:QI (match_operand:QI 1 "nonimmediate_operand" "0")))]
- ""
- "not%B0 %0")
-
-;;- arithmetic shift instructions
-
-;; DImode shifts are implemented using the i386 "shift double" opcode,
-;; which is written as "sh[lr]d[lw] imm,reg,reg/mem". If the shift count
-;; is variable, then the count is in %cl and the "imm" operand is dropped
-;; from the assembler input.
-
-;; This instruction shifts the target reg/mem as usual, but instead of
-;; shifting in zeros, bits are shifted in from reg operand. If the insn
-;; is a left shift double, bits are taken from the high order bits of
-;; reg, else if the insn is a shift right double, bits are taken from the
-;; low order bits of reg. So if %eax is "1234" and %edx is "5678",
-;; "shldl $8,%edx,%eax" leaves %edx unchanged and sets %eax to "2345".
-
-;; Since sh[lr]d does not change the `reg' operand, that is done
-;; separately, making all shifts emit pairs of shift double and normal
-;; shift. Since sh[lr]d does not shift more than 31 bits, and we wish to
-;; support a 63 bit shift, each shift where the count is in a reg expands
-;; to a pair of shifts, a branch, a shift by 32 and a label.
-
-;; If the shift count is a constant, we need never emit more than one
-;; shift pair, instead using moves and sign extension for counts greater
-;; than 31.
-
-(define_expand "ashldi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (ashift:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT
- || ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))
- {
- operands[2] = copy_to_mode_reg (QImode, operands[2]);
- emit_insn (gen_ashldi3_non_const_int (operands[0], operands[1],
- operands[2]));
- }
- else
- emit_insn (gen_ashldi3_const_int (operands[0], operands[1], operands[2]));
-
- DONE;
-}")
-
-(define_insn "ashldi3_const_int"
- [(set (match_operand:DI 0 "register_operand" "=&r")
- (ashift:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:QI 2 "const_int_operand" "J")))]
- "CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')"
- "*
-{
- rtx xops[4], low[1], high[1];
-
- CC_STATUS_INIT;
-
- split_di (operands, 1, low, high);
- xops[0] = operands[2];
- xops[1] = const1_rtx;
- xops[2] = low[0];
- xops[3] = high[0];
-
- if (INTVAL (xops[0]) > 31)
- {
- output_asm_insn (AS2 (mov%L3,%2,%3), xops); /* Fast shift by 32 */
- output_asm_insn (AS2 (xor%L2,%2,%2), xops);
-
- if (INTVAL (xops[0]) > 32)
- {
- xops[0] = GEN_INT (INTVAL (xops[0]) - 32);
- output_asm_insn (AS2 (sal%L3,%0,%3), xops); /* Remaining shift */
- }
- }
- else
- {
- output_asm_insn (AS3 (shld%L3,%0,%2,%3), xops);
- output_asm_insn (AS2 (sal%L2,%0,%2), xops);
- }
- RET;
-}")
-
-(define_insn "ashldi3_non_const_int"
- [(set (match_operand:DI 0 "register_operand" "=&r")
- (ashift:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:QI 2 "register_operand" "c")))]
- ""
- "*
-{
- rtx xops[4], low[1], high[1];
- static HOST_WIDE_INT ashldi_label_number;
-
- CC_STATUS_INIT;
-
- split_di (operands, 1, low, high);
- xops[0] = operands[2];
- xops[1] = GEN_INT (32);
- xops[2] = low[0];
- xops[3] = high[0];
-
- output_asm_insn (AS3_SHIFT_DOUBLE (shld%L3,%0,%2,%3), xops);
- output_asm_insn (AS2 (sal%L2,%0,%2), xops);
- output_asm_insn (AS2 (test%B0,%1,%b0), xops);
- asm_fprintf (asm_out_file, \"\\tje %LLASHLDI%d\\n\", ashldi_label_number);
- output_asm_insn (AS2 (mov%L3,%2,%3), xops); /* Fast shift by 32 */
- output_asm_insn (AS2 (xor%L2,%2,%2), xops);
- asm_fprintf (asm_out_file, \"%LLASHLDI%d:\\n\", ashldi_label_number++);
-
- RET;
-}")
-
-;; On i386 and i486, "addl reg,reg" is faster than "sall $1,reg"
-;; On i486, movl/sall appears slightly faster than leal, but the leal
-;; is smaller - use leal for now unless the shift count is 1.
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
- (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "r,0")
- (match_operand:SI 2 "nonmemory_operand" "M,cI")))]
- ""
- "*
-{
- if (REG_P (operands[0]) && REGNO (operands[0]) != REGNO (operands[1]))
- {
- if (TARGET_DOUBLE_WITH_ADD && INTVAL (operands[2]) == 1)
- {
- output_asm_insn (AS2 (mov%L0,%1,%0), operands);
- return AS2 (add%L0,%1,%0);
- }
- else
- {
- CC_STATUS_INIT;
-
- if (operands[1] == stack_pointer_rtx)
- {
- output_asm_insn (AS2 (mov%L0,%1,%0), operands);
- operands[1] = operands[0];
- }
- operands[1] = gen_rtx (MULT, SImode, operands[1],
- GEN_INT (1 << INTVAL (operands[2])));
- return AS2 (lea%L0,%a1,%0);
- }
- }
-
- if (REG_P (operands[2]))
- return AS2 (sal%L0,%b2,%0);
-
- if (REG_P (operands[0]) && operands[2] == const1_rtx)
- return AS2 (add%L0,%0,%0);
-
- return AS2 (sal%L0,%2,%0);
-}")
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
- (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (sal%W0,%b2,%0);
-
- if (REG_P (operands[0]) && operands[2] == const1_rtx)
- return AS2 (add%W0,%0,%0);
-
- return AS2 (sal%W0,%2,%0);
-}")
-
-(define_insn "ashlqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
- (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (sal%B0,%b2,%0);
-
- if (REG_P (operands[0]) && operands[2] == const1_rtx)
- return AS2 (add%B0,%0,%0);
-
- return AS2 (sal%B0,%2,%0);
-}")
-
-;; See comment above `ashldi3' about how this works.
-
-(define_expand "ashrdi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT
- || ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))
- {
- operands[2] = copy_to_mode_reg (QImode, operands[2]);
- emit_insn (gen_ashrdi3_non_const_int (operands[0], operands[1],
- operands[2]));
- }
- else
- emit_insn (gen_ashrdi3_const_int (operands[0], operands[1], operands[2]));
-
- DONE;
-}")
-
-(define_insn "ashldi3_32"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,m")
- (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "ro,r")
- (const_int 32)))]
- ""
- "*
-{
- rtx low[2], high[2], xops[4];
-
- split_di (operands, 2, low, high);
- xops[0] = high[0];
- xops[1] = low[1];
- xops[2] = low[0];
- xops[3] = const0_rtx;
- if (!rtx_equal_p (xops[0], xops[1]))
- output_asm_insn (AS2 (mov%L0,%1,%0), xops);
-
- if (GET_CODE (low[0]) == MEM)
- output_asm_insn (AS2 (mov%L2,%3,%2), xops);
- else
- output_asm_insn (AS2 (xor%L2,%2,%2), xops);
-
- RET;
-}")
-
-(define_insn "ashrdi3_const_int"
- [(set (match_operand:DI 0 "register_operand" "=&r")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:QI 2 "const_int_operand" "J")))]
- "CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')"
- "*
-{
- rtx xops[4], low[1], high[1];
-
- CC_STATUS_INIT;
-
- split_di (operands, 1, low, high);
- xops[0] = operands[2];
- xops[1] = const1_rtx;
- xops[2] = low[0];
- xops[3] = high[0];
-
- if (INTVAL (xops[0]) > 31)
- {
- xops[1] = GEN_INT (31);
- output_asm_insn (AS2 (mov%L2,%3,%2), xops);
- output_asm_insn (AS2 (sar%L3,%1,%3), xops); /* shift by 32 */
-
- if (INTVAL (xops[0]) > 32)
- {
- xops[0] = GEN_INT (INTVAL (xops[0]) - 32);
- output_asm_insn (AS2 (sar%L2,%0,%2), xops); /* Remaining shift */
- }
- }
- else
- {
- output_asm_insn (AS3 (shrd%L2,%0,%3,%2), xops);
- output_asm_insn (AS2 (sar%L3,%0,%3), xops);
- }
-
- RET;
-}")
-
-(define_insn "ashrdi3_non_const_int"
- [(set (match_operand:DI 0 "register_operand" "=&r")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:QI 2 "register_operand" "c")))]
- ""
- "*
-{
- rtx xops[4], low[1], high[1];
- static HOST_WIDE_INT ashrdi_label_number;
-
- CC_STATUS_INIT;
-
- split_di (operands, 1, low, high);
- xops[0] = operands[2];
- xops[1] = GEN_INT (32);
- xops[2] = low[0];
- xops[3] = high[0];
-
- output_asm_insn (AS3_SHIFT_DOUBLE (shrd%L2,%0,%3,%2), xops);
- output_asm_insn (AS2 (sar%L3,%0,%3), xops);
- output_asm_insn (AS2 (test%B0,%1,%b0), xops);
- asm_fprintf (asm_out_file, \"\\tje %LLASHRDI%d\\n\", ashrdi_label_number);
- xops[1] = GEN_INT (31);
- output_asm_insn (AS2 (mov%L2,%3,%2), xops);
- output_asm_insn (AS2 (sar%L3,%1,%3), xops); /* shift by 32 */
- asm_fprintf (asm_out_file, \"%LLASHRDI%d:\\n\", ashrdi_label_number++);
-
- RET;
-}")
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (sar%L0,%b2,%0);
- else
- return AS2 (sar%L0,%2,%0);
-}")
-
-(define_insn "ashrhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
- (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (sar%W0,%b2,%0);
- else
- return AS2 (sar%W0,%2,%0);
-}")
-
-(define_insn "ashrqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
- (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (sar%B0,%b2,%0);
- else
- return AS2 (sar%B0,%2,%0);
-}")
-
-;;- logical shift instructions
-
-;; See comment above `ashldi3' about how this works.
-
-(define_expand "lshrdi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:QI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT
- || ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))
- {
- operands[2] = copy_to_mode_reg (QImode, operands[2]);
- emit_insn (gen_lshrdi3_non_const_int (operands[0], operands[1],
- operands[2]));
- }
- else
- emit_insn (gen_lshrdi3_const_int (operands[0], operands[1], operands[2]));
-
- DONE;
-}")
-
-(define_insn "lshrdi3_32"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,m")
- (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro,r")
- (const_int 32)))]
- ""
- "*
-{
- rtx low[2], high[2], xops[4];
-
- split_di (operands, 2, low, high);
- xops[0] = low[0];
- xops[1] = high[1];
- xops[2] = high[0];
- xops[3] = const0_rtx;
- if (!rtx_equal_p (xops[0], xops[1]))
- output_asm_insn (AS2 (mov%L0,%1,%0), xops);
-
- if (GET_CODE (low[0]) == MEM)
- output_asm_insn (AS2 (mov%L2,%3,%2), xops);
- else
- output_asm_insn (AS2 (xor%L2,%2,%2), xops);
-
- RET;
-}")
-
-(define_insn "lshrdi3_const_int"
- [(set (match_operand:DI 0 "register_operand" "=&r")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:QI 2 "const_int_operand" "J")))]
- "CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')"
- "*
-{
- rtx xops[4], low[1], high[1];
-
- CC_STATUS_INIT;
-
- split_di (operands, 1, low, high);
- xops[0] = operands[2];
- xops[1] = const1_rtx;
- xops[2] = low[0];
- xops[3] = high[0];
-
- if (INTVAL (xops[0]) > 31)
- {
- output_asm_insn (AS2 (mov%L2,%3,%2), xops); /* Fast shift by 32 */
- output_asm_insn (AS2 (xor%L3,%3,%3), xops);
-
- if (INTVAL (xops[0]) > 32)
- {
- xops[0] = GEN_INT (INTVAL (xops[0]) - 32);
- output_asm_insn (AS2 (shr%L2,%0,%2), xops); /* Remaining shift */
- }
- }
- else
- {
- output_asm_insn (AS3 (shrd%L2,%0,%3,%2), xops);
- output_asm_insn (AS2 (shr%L3,%0,%3), xops);
- }
-
- RET;
-}")
-
-(define_insn "lshrdi3_non_const_int"
- [(set (match_operand:DI 0 "register_operand" "=&r")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:QI 2 "register_operand" "c")))]
- ""
- "*
-{
- rtx xops[4], low[1], high[1];
- static HOST_WIDE_INT lshrdi_label_number;
-
- CC_STATUS_INIT;
-
- split_di (operands, 1, low, high);
- xops[0] = operands[2];
- xops[1] = GEN_INT (32);
- xops[2] = low[0];
- xops[3] = high[0];
-
- output_asm_insn (AS3_SHIFT_DOUBLE (shrd%L2,%0,%3,%2), xops);
- output_asm_insn (AS2 (shr%L3,%0,%3), xops);
- output_asm_insn (AS2 (test%B0,%1,%b0), xops);
- asm_fprintf (asm_out_file, \"\\tje %LLLSHRDI%d\\n\", lshrdi_label_number);
- output_asm_insn (AS2 (mov%L2,%3,%2), xops); /* Fast shift by 32 */
- output_asm_insn (AS2 (xor%L3,%3,%3), xops);
- asm_fprintf (asm_out_file, \"%LLLSHRDI%d:\\n\", lshrdi_label_number++);
-
- RET;
-}")
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (shr%L0,%b2,%0);
- else
- return AS2 (shr%L0,%2,%1);
-}")
-
-(define_insn "lshrhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
- (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (shr%W0,%b2,%0);
- else
- return AS2 (shr%W0,%2,%0);
-}")
-
-(define_insn "lshrqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
- (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (shr%B0,%b2,%0);
- else
- return AS2 (shr%B0,%2,%0);
-}")
-
-;;- rotate instructions
-
-(define_insn "rotlsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (rol%L0,%b2,%0);
- else
- return AS2 (rol%L0,%2,%0);
-}")
-
-(define_insn "rotlhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
- (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (rol%W0,%b2,%0);
- else
- return AS2 (rol%W0,%2,%0);
-}")
-
-(define_insn "rotlqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
- (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (rol%B0,%b2,%0);
- else
- return AS2 (rol%B0,%2,%0);
-}")
-
-(define_insn "rotrsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (ror%L0,%b2,%0);
- else
- return AS2 (ror%L0,%2,%0);
-}")
-
-(define_insn "rotrhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
- (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (ror%W0,%b2,%0);
- else
- return AS2 (ror%W0,%2,%0);
-}")
-
-(define_insn "rotrqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
- (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "cI")))]
- ""
- "*
-{
- if (REG_P (operands[2]))
- return AS2 (ror%B0,%b2,%0);
- else
- return AS2 (ror%B0,%2,%0);
-}")
-
-/*
-;; This usually looses. But try a define_expand to recognize a few case
-;; we can do efficiently, such as accessing the "high" QImode registers,
-;; %ah, %bh, %ch, %dh.
-;; ??? Note this has a botch on the mode of operand 0, which needs to be
-;; fixed if this is ever enabled.
-(define_insn "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+&r")
- (match_operand:SI 1 "immediate_operand" "i")
- (match_operand:SI 2 "immediate_operand" "i"))
- (match_operand:SI 3 "nonmemory_operand" "ri"))]
- ""
- "*
-{
- if (INTVAL (operands[1]) + INTVAL (operands[2]) > GET_MODE_BITSIZE (SImode))
- abort ();
- if (GET_CODE (operands[3]) == CONST_INT)
- {
- unsigned int mask = (1 << INTVAL (operands[1])) - 1;
- operands[1] = GEN_INT (~(mask << INTVAL (operands[2])));
- output_asm_insn (AS2 (and%L0,%1,%0), operands);
- operands[3] = GEN_INT (INTVAL (operands[3]) << INTVAL (operands[2]));
- output_asm_insn (AS2 (or%L0,%3,%0), operands);
- }
- else
- {
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]));
- if (INTVAL (operands[2]))
- output_asm_insn (AS2 (ror%L0,%2,%0), operands);
- output_asm_insn (AS3 (shrd%L0,%1,%3,%0), operands);
- operands[2] = GEN_INT (BITS_PER_WORD
- - INTVAL (operands[1]) - INTVAL (operands[2]));
- if (INTVAL (operands[2]))
- output_asm_insn (AS2 (ror%L0,%2,%0), operands);
- }
- RET;
-}")
-*/
-/*
-;; ??? There are problems with the mode of operand[3]. The point of this
-;; is to represent an HImode move to a "high byte" register.
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "immediate_operand" "")
- (match_operand:SI 2 "immediate_operand" ""))
- (match_operand:QI 3 "nonmemory_operand" "ri"))]
- ""
- "
-{
- if (GET_CODE (operands[1]) != CONST_INT
- || GET_CODE (operands[2]) != CONST_INT)
- FAIL;
-
- if (! (INTVAL (operands[1]) == 8
- && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 0))
- && ! INTVAL (operands[1]) == 1)
- FAIL;
-}")
-*/
-
-;; On i386, the register count for a bit operation is *not* truncated,
-;; so SHIFT_COUNT_TRUNCATED must not be defined.
-
-;; On i486, the shift & or/and code is faster than bts or btr. If
-;; operands[0] is a MEM, the bt[sr] is half as fast as the normal code.
-
-;; On i386, bts is a little faster if operands[0] is a reg, and a
-;; little slower if operands[0] is a MEM, than the shift & or/and code.
-;; Use bts & btr, since they reload better.
-
-;; General bit set and clear.
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+rm")
- (const_int 1)
- (match_operand:SI 2 "register_operand" "r"))
- (match_operand:SI 3 "const_int_operand" "n"))]
- "TARGET_USE_BIT_TEST && GET_CODE (operands[2]) != CONST_INT"
- "*
-{
- CC_STATUS_INIT;
-
- if (INTVAL (operands[3]) == 1)
- return AS2 (bts%L0,%2,%0);
- else
- return AS2 (btr%L0,%2,%0);
-}")
-
-;; Bit complement. See comments on previous pattern.
-;; ??? Is this really worthwhile?
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (xor:SI (ashift:SI (const_int 1)
- (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "nonimmediate_operand" "0")))]
- "TARGET_USE_BIT_TEST && GET_CODE (operands[1]) != CONST_INT"
- "*
-{
- CC_STATUS_INIT;
-
- return AS2 (btc%L0,%1,%0);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
- (xor:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (ashift:SI (const_int 1)
- (match_operand:SI 2 "register_operand" "r"))))]
- "TARGET_USE_BIT_TEST && GET_CODE (operands[2]) != CONST_INT"
- "*
-{
- CC_STATUS_INIT;
-
- return AS2 (btc%L0,%2,%0);
-}")
-
-;; Recognizers for bit-test instructions.
-
-;; The bt opcode allows a MEM in operands[0]. But on both i386 and
-;; i486, it is faster to copy a MEM to REG and then use bt, than to use
-;; bt on the MEM directly.
-
-;; ??? The first argument of a zero_extract must not be reloaded, so
-;; don't allow a MEM in the operand predicate without allowing it in the
-;; constraint.
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "register_operand" "r")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "*
-{
- cc_status.flags |= CC_Z_IN_NOT_C;
- return AS2 (bt%L0,%1,%0);
-}")
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "const_int_operand" "n")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "*
-{
- unsigned int mask;
-
- mask = ((1 << INTVAL (operands[1])) - 1) << INTVAL (operands[2]);
- operands[1] = GEN_INT (mask);
-
- if (QI_REG_P (operands[0]))
- {
- if ((mask & ~0xff) == 0)
- {
- cc_status.flags |= CC_NOT_NEGATIVE;
- return AS2 (test%B0,%1,%b0);
- }
-
- if ((mask & ~0xff00) == 0)
- {
- cc_status.flags |= CC_NOT_NEGATIVE;
- operands[1] = GEN_INT (mask >> 8);
- return AS2 (test%B0,%1,%h0);
- }
- }
-
- return AS2 (test%L0,%1,%0);
-}")
-
-;; ??? All bets are off if operand 0 is a volatile MEM reference.
-;; The CPU may access unspecified bytes around the actual target byte.
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
- (match_operand:SI 1 "const_int_operand" "n")
- (match_operand:SI 2 "const_int_operand" "n")))]
- "GET_CODE (operands[0]) != MEM || ! MEM_VOLATILE_P (operands[0])"
- "*
-{
- unsigned int mask;
-
- mask = ((1 << INTVAL (operands[1])) - 1) << INTVAL (operands[2]);
- operands[1] = GEN_INT (mask);
-
- if (! REG_P (operands[0]) || QI_REG_P (operands[0]))
- {
- if ((mask & ~0xff) == 0)
- {
- cc_status.flags |= CC_NOT_NEGATIVE;
- return AS2 (test%B0,%1,%b0);
- }
-
- if ((mask & ~0xff00) == 0)
- {
- cc_status.flags |= CC_NOT_NEGATIVE;
- operands[1] = GEN_INT (mask >> 8);
-
- if (QI_REG_P (operands[0]))
- return AS2 (test%B0,%1,%h0);
- else
- {
- operands[0] = adj_offsettable_operand (operands[0], 1);
- return AS2 (test%B0,%1,%b0);
- }
- }
-
- if (GET_CODE (operands[0]) == MEM && (mask & ~0xff0000) == 0)
- {
- cc_status.flags |= CC_NOT_NEGATIVE;
- operands[1] = GEN_INT (mask >> 16);
- operands[0] = adj_offsettable_operand (operands[0], 2);
- return AS2 (test%B0,%1,%b0);
- }
-
- if (GET_CODE (operands[0]) == MEM && (mask & ~0xff000000) == 0)
- {
- cc_status.flags |= CC_NOT_NEGATIVE;
- operands[1] = GEN_INT (mask >> 24);
- operands[0] = adj_offsettable_operand (operands[0], 3);
- return AS2 (test%B0,%1,%b0);
- }
- }
-
- if (CONSTANT_P (operands[1]) || GET_CODE (operands[0]) == MEM)
- return AS2 (test%L0,%1,%0);
-
- return AS2 (test%L1,%0,%1);
-}")
-
-;; Store-flag instructions.
-
-;; For all sCOND expanders, also expand the compare or test insn that
-;; generates cc0. Generate an equality comparison if `seq' or `sne'.
-
-;; The 386 sCOND opcodes can write to memory. But a gcc sCOND insn may
-;; not have any input reloads. A MEM write might need an input reload
-;; for the address of the MEM. So don't allow MEM as the SET_DEST.
-
-(define_expand "seq"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (eq:QI (cc0) (const_int 0)))]
- ""
- "
-{
- if (TARGET_IEEE_FP
- && GET_MODE_CLASS (GET_MODE (i386_compare_op0)) == MODE_FLOAT)
- operands[1] = (*i386_compare_gen_eq)(i386_compare_op0, i386_compare_op1);
- else
- operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (eq:QI (cc0) (const_int 0)))]
- ""
- "*
-{
- if (cc_prev_status.flags & CC_Z_IN_NOT_C)
- return AS1 (setnb,%0);
- else
- return AS1 (sete,%0);
-}")
-
-(define_expand "sne"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (ne:QI (cc0) (const_int 0)))]
- ""
- "
-{
- if (TARGET_IEEE_FP
- && GET_MODE_CLASS (GET_MODE (i386_compare_op0)) == MODE_FLOAT)
- operands[1] = (*i386_compare_gen_eq)(i386_compare_op0, i386_compare_op1);
- else
- operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (ne:QI (cc0) (const_int 0)))]
- ""
- "*
-{
- if (cc_prev_status.flags & CC_Z_IN_NOT_C)
- return AS1 (setb,%0);
- else
- return AS1 (setne,%0);
-}
-")
-
-(define_expand "sgt"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (gt:QI (cc0) (const_int 0)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (gt:QI (cc0) (const_int 0)))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (sete,%0);
-
- OUTPUT_JUMP (\"setg %0\", \"seta %0\", NULL_PTR);
-}")
-
-(define_expand "sgtu"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (gtu:QI (cc0) (const_int 0)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (gtu:QI (cc0) (const_int 0)))]
- ""
- "* return \"seta %0\"; ")
-
-(define_expand "slt"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (lt:QI (cc0) (const_int 0)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (lt:QI (cc0) (const_int 0)))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (sete,%0);
-
- OUTPUT_JUMP (\"setl %0\", \"setb %0\", \"sets %0\");
-}")
-
-(define_expand "sltu"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (ltu:QI (cc0) (const_int 0)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (ltu:QI (cc0) (const_int 0)))]
- ""
- "* return \"setb %0\"; ")
-
-(define_expand "sge"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (ge:QI (cc0) (const_int 0)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (ge:QI (cc0) (const_int 0)))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (sete,%0);
-
- OUTPUT_JUMP (\"setge %0\", \"setae %0\", \"setns %0\");
-}")
-
-(define_expand "sgeu"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (geu:QI (cc0) (const_int 0)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (geu:QI (cc0) (const_int 0)))]
- ""
- "* return \"setae %0\"; ")
-
-(define_expand "sle"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (le:QI (cc0) (const_int 0)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (le:QI (cc0) (const_int 0)))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (setb,%0);
-
- OUTPUT_JUMP (\"setle %0\", \"setbe %0\", NULL_PTR);
-}")
-
-(define_expand "sleu"
- [(match_dup 1)
- (set (match_operand:QI 0 "register_operand" "")
- (leu:QI (cc0) (const_int 0)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=q")
- (leu:QI (cc0) (const_int 0)))]
- ""
- "* return \"setbe %0\"; ")
-
-;; Basic conditional jump instructions.
-;; We ignore the overflow flag for signed branch instructions.
-
-;; For all bCOND expanders, also expand the compare or test insn that
-;; generates cc0. Generate an equality comparison if `beq' or `bne'.
-
-(define_expand "beq"
- [(match_dup 1)
- (set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (TARGET_IEEE_FP
- && GET_MODE_CLASS (GET_MODE (i386_compare_op0)) == MODE_FLOAT)
- operands[1] = (*i386_compare_gen_eq)(i386_compare_op0, i386_compare_op1);
- else
- operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (cc_prev_status.flags & CC_Z_IN_NOT_C)
- return \"jnc %l0\";
- else
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x4000);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (jne,%l0);
- }
-
- return \"je %l0\";
-}")
-
-(define_expand "bne"
- [(match_dup 1)
- (set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (TARGET_IEEE_FP
- && GET_MODE_CLASS (GET_MODE (i386_compare_op0)) == MODE_FLOAT)
- operands[1] = (*i386_compare_gen_eq)(i386_compare_op0, i386_compare_op1);
- else
- operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (cc_prev_status.flags & CC_Z_IN_NOT_C)
- return \"jc %l0\";
- else
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x4000);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (je,%l0);
- }
-
- return \"jne %l0\";
-}")
-
-(define_expand "bgt"
- [(match_dup 1)
- (set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (je,%l0);
-
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x4100);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (je,%l0);
- }
- OUTPUT_JUMP (\"jg %l0\", \"ja %l0\", NULL_PTR);
-}")
-
-(define_expand "bgtu"
- [(match_dup 1)
- (set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "ja %l0")
-
-(define_expand "blt"
- [(match_dup 1)
- (set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (je,%l0);
-
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x100);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (jne,%l0);
- }
- OUTPUT_JUMP (\"jl %l0\", \"jb %l0\", \"js %l0\");
-}")
-
-(define_expand "bltu"
- [(match_dup 1)
- (set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jb %l0")
-
-(define_expand "bge"
- [(match_dup 1)
- (set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (je,%l0);
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x100);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (je,%l0);
- }
- OUTPUT_JUMP (\"jge %l0\", \"jae %l0\", \"jns %l0\");
-}")
-
-(define_expand "bgeu"
- [(match_dup 1)
- (set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jae %l0")
-
-(define_expand "ble"
- [(match_dup 1)
- (set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (jb,%l0);
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x4100);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (jne,%l0);
- }
-
- OUTPUT_JUMP (\"jle %l0\", \"jbe %l0\", NULL_PTR);
-}")
-
-(define_expand "bleu"
- [(match_dup 1)
- (set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jbe %l0")
-
-;; Negated conditional jump instructions.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if (cc_prev_status.flags & CC_Z_IN_NOT_C)
- return \"jc %l0\";
- else
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x4000);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (je,%l0);
- }
- return \"jne %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if (cc_prev_status.flags & CC_Z_IN_NOT_C)
- return \"jnc %l0\";
- else
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x4000);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (jne,%l0);
- }
- return \"je %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (jne,%l0);
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x4100);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (jne,%l0);
- }
- OUTPUT_JUMP (\"jle %l0\", \"jbe %l0\", NULL_PTR);
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jbe %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (jne,%l0);
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x100);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (je,%l0);
- }
-
- OUTPUT_JUMP (\"jge %l0\", \"jae %l0\", \"jns %l0\");
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jae %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (jne,%l0);
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x100);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (jne,%l0);
- }
- OUTPUT_JUMP (\"jl %l0\", \"jb %l0\", \"js %l0\");
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jb %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387)
- && ! (cc_prev_status.flags & CC_FCOMI))
- return AS1 (jae,%l0);
-
- if (cc_prev_status.flags & CC_TEST_AX)
- {
- operands[1] = gen_rtx (REG, SImode, 0);
- operands[2] = GEN_INT (0x4100);
- output_asm_insn (AS2 (testl,%2,%1), operands);
- return AS1 (je,%l0);
- }
- OUTPUT_JUMP (\"jg %l0\", \"ja %l0\", NULL_PTR);
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "ja %l0")
-
-;; Unconditional and other jump instructions
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jmp %l0")
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))]
- ""
- "*
-{
- CC_STATUS_INIT;
-
- return AS1 (jmp,%*%0);
-}")
-
-;; ??? could transform while(--i > 0) S; to if (--i > 0) do S; while(--i);
-;; if S does not change i
-
-(define_expand "decrement_and_branch_until_zero"
- [(parallel [(set (pc)
- (if_then_else (ge (plus:SI (match_operand:SI 0 "general_operand" "")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))])]
- ""
- "")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "arithmetic_comparison_operator"
- [(plus:SI (match_operand:SI 1 "nonimmediate_operand" "+r,m")
- (match_operand:SI 2 "general_operand" "rmi,ri"))
- (const_int 0)])
- (label_ref (match_operand 3 "" ""))
- (pc)))
- (set (match_dup 1)
- (plus:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (operands[2] == constm1_rtx)
- output_asm_insn (AS1 (dec%L1,%1), operands);
-
- else if (operands[2] == const1_rtx)
- output_asm_insn (AS1 (inc%L1,%1), operands);
-
- else
- output_asm_insn (AS2 (add%L1,%2,%1), operands);
-
- return AS1 (%J0,%l3);
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "arithmetic_comparison_operator"
- [(minus:SI (match_operand:SI 1 "nonimmediate_operand" "+r,m")
- (match_operand:SI 2 "general_operand" "rmi,ri"))
- (const_int 0)])
- (label_ref (match_operand 3 "" ""))
- (pc)))
- (set (match_dup 1)
- (minus:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (operands[2] == const1_rtx)
- output_asm_insn (AS1 (dec%L1,%1), operands);
-
- else if (operands[1] == constm1_rtx)
- output_asm_insn (AS1 (inc%L1,%1), operands);
-
- else
- output_asm_insn (AS2 (sub%L1,%2,%1), operands);
-
- return AS1 (%J0,%l3);
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (match_operand:SI 0 "general_operand" "+g")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- operands[2] = const1_rtx;
- output_asm_insn (AS2 (sub%L0,%2,%0), operands);
- return \"jnc %l1\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (match_operand:SI 0 "general_operand" "+g")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- operands[2] = const1_rtx;
- output_asm_insn (AS2 (sub%L0,%2,%0), operands);
- return \"jc %l1\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (match_operand:SI 0 "general_operand" "+g")
- (const_int 1))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- output_asm_insn (AS1 (dec%L0,%0), operands);
- return \"jnz %l1\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (match_operand:SI 0 "general_operand" "+g")
- (const_int 1))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- output_asm_insn (AS1 (dec%L0,%0), operands);
- return \"jz %l1\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (match_operand:SI 0 "general_operand" "+g")
- (const_int -1))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- output_asm_insn (AS1 (inc%L0,%0), operands);
- return \"jnz %l1\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (match_operand:SI 0 "general_operand" "+g")
- (const_int -1))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- output_asm_insn (AS1 (inc%L0,%0), operands);
- return \"jz %l1\";
-}")
-
-;; Implement switch statements when generating PIC code. Switches are
-;; implemented by `tablejump' when not using -fpic.
-
-;; Emit code here to do the range checking and make the index zero based.
-
-(define_expand "casesi"
- [(set (match_dup 5)
- (match_operand:SI 0 "general_operand" ""))
- (set (match_dup 6)
- (minus:SI (match_dup 5)
- (match_operand:SI 1 "general_operand" "")))
- (set (cc0)
- (compare:CC (match_dup 6)
- (match_operand:SI 2 "general_operand" "")))
- (set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 4 "" ""))
- (pc)))
- (parallel
- [(set (pc)
- (minus:SI (reg:SI 3)
- (mem:SI (plus:SI (mult:SI (match_dup 6)
- (const_int 4))
- (label_ref (match_operand 3 "" ""))))))
- (clobber (match_scratch:SI 7 ""))])]
- "flag_pic"
- "
-{
- operands[5] = gen_reg_rtx (SImode);
- operands[6] = gen_reg_rtx (SImode);
- current_function_uses_pic_offset_table = 1;
-}")
-
-;; Implement a casesi insn.
-
-;; Each entry in the "addr_diff_vec" looks like this as the result of the
-;; two rules below:
-;;
-;; .long _GLOBAL_OFFSET_TABLE_+[.-.L2]
-;;
-;; 1. An expression involving an external reference may only use the
-;; addition operator, and only with an assembly-time constant.
-;; The example above satisfies this because ".-.L2" is a constant.
-;;
-;; 2. The symbol _GLOBAL_OFFSET_TABLE_ is magic, and at link time is
-;; given the value of "GOT - .", where GOT is the actual address of
-;; the Global Offset Table. Therefore, the .long above actually
-;; stores the value "( GOT - . ) + [ . - .L2 ]", or "GOT - .L2". The
-;; expression "GOT - .L2" by itself would generate an error from as(1).
-;;
-;; The pattern below emits code that looks like this:
-;;
-;; movl %ebx,reg
-;; subl TABLE@GOTOFF(%ebx,index,4),reg
-;; jmp reg
-;;
-;; The addr_diff_vec contents may be directly referenced with @GOTOFF, since
-;; the addr_diff_vec is known to be part of this module.
-;;
-;; The subl above calculates "GOT - (( GOT - . ) + [ . - .L2 ])", which
-;; evaluates to just ".L2".
-
-(define_insn ""
- [(set (pc)
- (minus:SI (reg:SI 3)
- (mem:SI (plus:SI
- (mult:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 4))
- (label_ref (match_operand 1 "" ""))))))
- (clobber (match_scratch:SI 2 "=&r"))]
- ""
- "*
-{
- rtx xops[4];
-
- xops[0] = operands[0];
- xops[1] = operands[1];
- xops[2] = operands[2];
- xops[3] = pic_offset_table_rtx;
-
- output_asm_insn (AS2 (mov%L2,%3,%2), xops);
- output_asm_insn (\"sub%L2 %l1@GOTOFF(%3,%0,4),%2\", xops);
- output_asm_insn (AS1 (jmp,%*%2), xops);
- ASM_OUTPUT_ALIGN_CODE (asm_out_file);
- RET;
-}")
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "*
-{
- CC_STATUS_INIT;
-
- return AS1 (jmp,%*%0);
-}")
-
-;; Call insns.
-
-;; If generating PIC code, the predicate indirect_operand will fail
-;; for operands[0] containing symbolic references on all of the named
-;; call* patterns. Each named pattern is followed by an unnamed pattern
-;; that matches any call to a symbolic CONST (ie, a symbol_ref). The
-;; unnamed patterns are only used while generating PIC code, because
-;; otherwise the named patterns match.
-
-;; Call subroutine returning no value.
-
-(define_expand "call_pop"
- [(parallel [(call (match_operand:QI 0 "indirect_operand" "")
- (match_operand:SI 1 "general_operand" ""))
- (set (reg:SI 7)
- (plus:SI (reg:SI 7)
- (match_operand:SI 3 "immediate_operand" "")))])]
- ""
- "
-{
- rtx addr;
-
- if (flag_pic)
- current_function_uses_pic_offset_table = 1;
-
- /* With half-pic, force the address into a register. */
- addr = XEXP (operands[0], 0);
- if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr))
- XEXP (operands[0], 0) = force_reg (Pmode, addr);
-
- if (! expander_call_insn_operand (operands[0], QImode))
- operands[0]
- = change_address (operands[0], VOIDmode,
- copy_to_mode_reg (Pmode, XEXP (operands[0], 0)));
-}")
-
-(define_insn ""
- [(call (match_operand:QI 0 "call_insn_operand" "m")
- (match_operand:SI 1 "general_operand" "g"))
- (set (reg:SI 7) (plus:SI (reg:SI 7)
- (match_operand:SI 3 "immediate_operand" "i")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM
- && ! CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- {
- operands[0] = XEXP (operands[0], 0);
- return AS1 (call,%*%0);
- }
- else
- return AS1 (call,%P0);
-}")
-
-(define_insn ""
- [(call (mem:QI (match_operand:SI 0 "symbolic_operand" ""))
- (match_operand:SI 1 "general_operand" "g"))
- (set (reg:SI 7) (plus:SI (reg:SI 7)
- (match_operand:SI 3 "immediate_operand" "i")))]
- "!HALF_PIC_P ()"
- "call %P0")
-
-(define_expand "call"
- [(call (match_operand:QI 0 "indirect_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ;; Operand 1 not used on the i386.
- ""
- "
-{
- rtx addr;
-
- if (flag_pic)
- current_function_uses_pic_offset_table = 1;
-
- /* With half-pic, force the address into a register. */
- addr = XEXP (operands[0], 0);
- if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr))
- XEXP (operands[0], 0) = force_reg (Pmode, addr);
-
- if (! expander_call_insn_operand (operands[0], QImode))
- operands[0]
- = change_address (operands[0], VOIDmode,
- copy_to_mode_reg (Pmode, XEXP (operands[0], 0)));
-}")
-
-(define_insn ""
- [(call (match_operand:QI 0 "call_insn_operand" "m")
- (match_operand:SI 1 "general_operand" "g"))]
- ;; Operand 1 not used on the i386.
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM
- && ! CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- {
- operands[0] = XEXP (operands[0], 0);
- return AS1 (call,%*%0);
- }
- else
- return AS1 (call,%P0);
-}")
-
-(define_insn ""
- [(call (mem:QI (match_operand:SI 0 "symbolic_operand" ""))
- (match_operand:SI 1 "general_operand" "g"))]
- ;; Operand 1 not used on the i386.
- "!HALF_PIC_P ()"
- "call %P0")
-
-;; Call subroutine, returning value in operand 0
-;; (which must be a hard register).
-
-(define_expand "call_value_pop"
- [(parallel [(set (match_operand 0 "" "")
- (call (match_operand:QI 1 "indirect_operand" "")
- (match_operand:SI 2 "general_operand" "")))
- (set (reg:SI 7)
- (plus:SI (reg:SI 7)
- (match_operand:SI 4 "immediate_operand" "")))])]
- ""
- "
-{
- rtx addr;
-
- if (flag_pic)
- current_function_uses_pic_offset_table = 1;
-
- /* With half-pic, force the address into a register. */
- addr = XEXP (operands[1], 0);
- if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr))
- XEXP (operands[1], 0) = force_reg (Pmode, addr);
-
- if (! expander_call_insn_operand (operands[1], QImode))
- operands[1]
- = change_address (operands[1], VOIDmode,
- copy_to_mode_reg (Pmode, XEXP (operands[1], 0)));
-}")
-
-(define_insn ""
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "call_insn_operand" "m")
- (match_operand:SI 2 "general_operand" "g")))
- (set (reg:SI 7) (plus:SI (reg:SI 7)
- (match_operand:SI 4 "immediate_operand" "i")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == MEM
- && ! CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- {
- operands[1] = XEXP (operands[1], 0);
- output_asm_insn (AS1 (call,%*%1), operands);
- }
- else
- output_asm_insn (AS1 (call,%P1), operands);
-
- RET;
-}")
-
-(define_insn ""
- [(set (match_operand 0 "" "=rf")
- (call (mem:QI (match_operand:SI 1 "symbolic_operand" ""))
- (match_operand:SI 2 "general_operand" "g")))
- (set (reg:SI 7) (plus:SI (reg:SI 7)
- (match_operand:SI 4 "immediate_operand" "i")))]
- "!HALF_PIC_P ()"
- "call %P1")
-
-(define_expand "call_value"
- [(set (match_operand 0 "" "")
- (call (match_operand:QI 1 "indirect_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ;; Operand 2 not used on the i386.
- ""
- "
-{
- rtx addr;
-
- if (flag_pic)
- current_function_uses_pic_offset_table = 1;
-
- /* With half-pic, force the address into a register. */
- addr = XEXP (operands[1], 0);
- if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr))
- XEXP (operands[1], 0) = force_reg (Pmode, addr);
-
- if (! expander_call_insn_operand (operands[1], QImode))
- operands[1]
- = change_address (operands[1], VOIDmode,
- copy_to_mode_reg (Pmode, XEXP (operands[1], 0)));
-}")
-
-(define_insn ""
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "call_insn_operand" "m")
- (match_operand:SI 2 "general_operand" "g")))]
- ;; Operand 2 not used on the i386.
- ""
- "*
-{
- if (GET_CODE (operands[1]) == MEM
- && ! CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- {
- operands[1] = XEXP (operands[1], 0);
- output_asm_insn (AS1 (call,%*%1), operands);
- }
- else
- output_asm_insn (AS1 (call,%P1), operands);
-
- RET;
-}")
-
-(define_insn ""
- [(set (match_operand 0 "" "=rf")
- (call (mem:QI (match_operand:SI 1 "symbolic_operand" ""))
- (match_operand:SI 2 "general_operand" "g")))]
- ;; Operand 2 not used on the i386.
- "!HALF_PIC_P ()"
- "call %P1")
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- /* In order to give reg-stack an easier job in validating two
- coprocessor registers as containing a possible return value,
- simply pretend the untyped call returns a complex long double
- value. */
-
- emit_call_insn (TARGET_80387
- ? gen_call_value (gen_rtx (REG, XCmode, FIRST_FLOAT_REG),
- operands[0], const0_rtx)
- : gen_call (operands[0], const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-;; Insn emitted into the body of a function to return from a function.
-;; This is only done if the function's epilogue is known to be simple.
-;; See comments for simple_386_epilogue in i386.c.
-
-(define_expand "return"
- [(return)]
- "ix86_can_use_return_insn_p ()"
- "")
-
-(define_insn "return_internal"
- [(return)]
- "reload_completed"
- "ret")
-
-(define_insn "return_pop_internal"
- [(return)
- (use (match_operand:SI 0 "const_int_operand" ""))]
- "reload_completed"
- "ret %0")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-(define_expand "prologue"
- [(const_int 1)]
- ""
- "
-{
- ix86_expand_prologue ();
- DONE;
-}")
-
-(define_insn "prologue_set_got"
- [(set (match_operand:SI 0 "" "")
- (plus:SI (match_dup 0)
- (plus:SI (match_operand:SI 1 "symbolic_operand" "")
- (minus:SI (pc) (match_operand 2 "" "")))))]
- ""
- "*
-{
- char buffer[64];
-
- if (TARGET_DEEP_BRANCH_PREDICTION)
- {
- sprintf (buffer, \"addl %s,%%0\", XSTR (operands[1], 0));
- output_asm_insn (buffer, operands);
- }
- else
- {
- sprintf (buffer, \"addl %s+[.-.L%d],%%0\", XSTR (operands[1], 0), INTVAL (operands[2]));
- output_asm_insn (buffer, operands);
- }
- RET;
-}")
-
-(define_insn "prologue_get_pc"
- [(set (match_operand:SI 0 "" "")
- (plus:SI (pc) (match_operand 1 "" "")))]
- ""
- "*
-{
- char buffer[64];
-
- output_asm_insn (AS1 (call,%P1), operands);
- if (! TARGET_DEEP_BRANCH_PREDICTION)
- {
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", INTVAL (operands[1]));
- }
- RET;
-}")
-
-(define_expand "epilogue"
- [(const_int 1)]
- ""
- "
-{
- ix86_expand_epilogue ();
- DONE;
-}")
-
-(define_insn "epilogue_set_stack_ptr"
- [(set (reg:SI 7) (reg:SI 6))
- (clobber (reg:SI 6))]
- ""
- "*
-{
- rtx xops [2];
-
- xops[0] = frame_pointer_rtx;
- xops[1] = stack_pointer_rtx;
- output_asm_insn (AS2 (mov%L0,%0,%1), xops);
- RET;
-}")
-
-(define_insn "leave"
- [(const_int 2)
- (clobber (reg:SI 6))
- (clobber (reg:SI 7))]
- ""
- "leave")
-
-(define_insn "pop"
- [(set (match_operand:SI 0 "register_operand" "r")
- (mem:SI (reg:SI 7)))
- (set (reg:SI 7) (minus:SI (reg:SI 7) (const_int 4)))]
- ""
- "*
-{
- output_asm_insn (AS1 (pop%L0,%P0), operands);
- RET;
-}")
-
-(define_expand "movstrsi"
- [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
- (match_operand:BLK 1 "memory_operand" ""))
- (use (match_operand:SI 2 "const_int_operand" ""))
- (use (match_operand:SI 3 "const_int_operand" ""))
- (clobber (match_scratch:SI 4 ""))
- (clobber (match_dup 5))
- (clobber (match_dup 6))])]
- ""
- "
-{
- rtx addr0, addr1;
-
- if (GET_CODE (operands[2]) != CONST_INT)
- FAIL;
-
- addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
- addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
-
- operands[5] = addr0;
- operands[6] = addr1;
-
- operands[0] = gen_rtx (MEM, BLKmode, addr0);
- operands[1] = gen_rtx (MEM, BLKmode, addr1);
-}")
-
-;; It might seem that operands 0 & 1 could use predicate register_operand.
-;; But strength reduction might offset the MEM expression. So we let
-;; reload put the address into %edi & %esi.
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "address_operand" "D"))
- (mem:BLK (match_operand:SI 1 "address_operand" "S")))
- (use (match_operand:SI 2 "const_int_operand" "n"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_scratch:SI 4 "=&c"))
- (clobber (match_dup 0))
- (clobber (match_dup 1))]
- ""
- "*
-{
- rtx xops[2];
-
- output_asm_insn (\"cld\", operands);
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) & ~0x03)
- {
- xops[0] = GEN_INT ((INTVAL (operands[2]) >> 2) & 0x3fffffff);
- xops[1] = operands[4];
-
- output_asm_insn (AS2 (mov%L1,%0,%1), xops);
-#ifdef INTEL_SYNTAX
- output_asm_insn (\"rep movsd\", xops);
-#else
- output_asm_insn (\"rep\;movsl\", xops);
-#endif
- }
- if (INTVAL (operands[2]) & 0x02)
- output_asm_insn (\"movsw\", operands);
- if (INTVAL (operands[2]) & 0x01)
- output_asm_insn (\"movsb\", operands);
- }
- else
- abort ();
- RET;
-}")
-
-(define_expand "clrstrsi"
- [(set (match_dup 3) (const_int 0))
- (parallel [(set (match_operand:BLK 0 "memory_operand" "")
- (const_int 0))
- (use (match_operand:SI 1 "const_int_operand" ""))
- (use (match_operand:SI 2 "const_int_operand" ""))
- (use (match_dup 3))
- (clobber (match_scratch:SI 4 ""))
- (clobber (match_dup 5))])]
- ""
- "
-{
- rtx addr0, addr1;
-
- if (GET_CODE (operands[1]) != CONST_INT)
- FAIL;
-
- addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
-
- operands[3] = gen_reg_rtx (SImode);
- operands[5] = addr0;
-
- operands[0] = gen_rtx (MEM, BLKmode, addr0);
-}")
-
-;; It might seem that operand 0 could use predicate register_operand.
-;; But strength reduction might offset the MEM expression. So we let
-;; reload put the address into %edi.
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "address_operand" "D"))
- (const_int 0))
- (use (match_operand:SI 1 "const_int_operand" "n"))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "register_operand" "a"))
- (clobber (match_scratch:SI 4 "=&c"))
- (clobber (match_dup 0))]
- ""
- "*
-{
- rtx xops[2];
-
- output_asm_insn (\"cld\", operands);
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (INTVAL (operands[1]) & ~0x03)
- {
- xops[0] = GEN_INT ((INTVAL (operands[1]) >> 2) & 0x3fffffff);
- xops[1] = operands[4];
-
- output_asm_insn (AS2 (mov%L1,%0,%1), xops);
-#ifdef INTEL_SYNTAX
- output_asm_insn (\"rep stosd\", xops);
-#else
- output_asm_insn (\"rep\;stosl\", xops);
-#endif
- }
- if (INTVAL (operands[1]) & 0x02)
- output_asm_insn (\"stosw\", operands);
- if (INTVAL (operands[1]) & 0x01)
- output_asm_insn (\"stosb\", operands);
- }
- else
- abort ();
- RET;
-}")
-
-(define_expand "cmpstrsi"
- [(parallel [(set (match_operand:SI 0 "general_operand" "")
- (compare:SI (match_operand:BLK 1 "general_operand" "")
- (match_operand:BLK 2 "general_operand" "")))
- (use (match_operand:SI 3 "general_operand" ""))
- (use (match_operand:SI 4 "immediate_operand" ""))
- (clobber (match_dup 5))
- (clobber (match_dup 6))
- (clobber (match_dup 3))])]
- ""
- "
-{
- rtx addr1, addr2;
-
- addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
- addr2 = copy_to_mode_reg (Pmode, XEXP (operands[2], 0));
- operands[3] = copy_to_mode_reg (SImode, operands[3]);
-
- operands[5] = addr1;
- operands[6] = addr2;
-
- operands[1] = gen_rtx (MEM, BLKmode, addr1);
- operands[2] = gen_rtx (MEM, BLKmode, addr2);
-
-}")
-
-;; memcmp recognizers. The `cmpsb' opcode does nothing if the count is
-;; zero. Emit extra code to make sure that a zero-length compare is EQ.
-
-;; It might seem that operands 0 & 1 could use predicate register_operand.
-;; But strength reduction might offset the MEM expression. So we let
-;; reload put the address into %edi & %esi.
-
-;; ??? Most comparisons have a constant length, and it's therefore
-;; possible to know that the length is non-zero, and to avoid the extra
-;; code to handle zero-length compares.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (compare:SI (mem:BLK (match_operand:SI 1 "address_operand" "S"))
- (mem:BLK (match_operand:SI 2 "address_operand" "D"))))
- (use (match_operand:SI 3 "register_operand" "c"))
- (use (match_operand:SI 4 "immediate_operand" "i"))
- (clobber (match_dup 1))
- (clobber (match_dup 2))
- (clobber (match_dup 3))]
- ""
- "*
-{
- rtx xops[2], label;
-
- label = gen_label_rtx ();
-
- output_asm_insn (\"cld\", operands);
- output_asm_insn (AS2 (xor%L0,%0,%0), operands);
- output_asm_insn (\"repz\;cmps%B2\", operands);
- output_asm_insn (\"je %l0\", &label);
-
- xops[0] = operands[0];
- xops[1] = const1_rtx;
- output_asm_insn (AS2 (sbb%L0,%0,%0), xops);
- if (QI_REG_P (xops[0]))
- output_asm_insn (AS2 (or%B0,%1,%b0), xops);
- else
- output_asm_insn (AS2 (or%L0,%1,%0), xops);
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (label));
- RET;
-}")
-
-(define_insn ""
- [(set (cc0)
- (compare:SI (mem:BLK (match_operand:SI 0 "address_operand" "S"))
- (mem:BLK (match_operand:SI 1 "address_operand" "D"))))
- (use (match_operand:SI 2 "register_operand" "c"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_dup 0))
- (clobber (match_dup 1))
- (clobber (match_dup 2))]
- ""
- "*
-{
- rtx xops[2];
-
- cc_status.flags |= CC_NOT_SIGNED;
-
- xops[0] = gen_rtx (REG, QImode, 0);
- xops[1] = CONST0_RTX (QImode);
-
- output_asm_insn (\"cld\", operands);
- output_asm_insn (AS2 (test%B0,%1,%0), xops);
- return \"repz\;cmps%B2\";
-}")
-
-
-(define_expand "ffssi2"
- [(set (match_dup 2)
- (plus:SI (ffs:SI (match_operand:SI 1 "general_operand" ""))
- (const_int -1)))
- (set (match_operand:SI 0 "general_operand" "")
- (plus:SI (match_dup 2) (const_int 1)))]
- ""
- "operands[2] = gen_reg_rtx (SImode);")
-
-;; Note, you cannot optimize away the branch following the bsfl by assuming
-;; that the destination is not modified if the input is 0, since not all
-;; x86 implementations do this.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (plus:SI (ffs:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))
- (const_int -1)))]
- ""
- "*
-{
- rtx xops[3];
- static int ffssi_label_number;
- char buffer[30];
-
- xops[0] = operands[0];
- xops[1] = operands[1];
- xops[2] = constm1_rtx;
- output_asm_insn (AS2 (bsf%L0,%1,%0), xops);
-#ifdef LOCAL_LABEL_PREFIX
- sprintf (buffer, \"jnz %sLFFSSI%d\",
- LOCAL_LABEL_PREFIX, ffssi_label_number);
-#else
- sprintf (buffer, \"jnz %sLFFSSI%d\",
- \"\", ffssi_label_number);
-#endif
- output_asm_insn (buffer, xops);
- output_asm_insn (AS2 (mov%L0,%2,%0), xops);
-#ifdef LOCAL_LABEL_PREFIX
- sprintf (buffer, \"%sLFFSSI%d:\",
- LOCAL_LABEL_PREFIX, ffssi_label_number);
-#else
- sprintf (buffer, \"%sLFFSSI%d:\",
- \"\", ffssi_label_number);
-#endif
- output_asm_insn (buffer, xops);
-
- ffssi_label_number++;
- CC_STATUS_INIT;
- return \"\";
-}")
-
-(define_expand "ffshi2"
- [(set (match_dup 2)
- (plus:HI (ffs:HI (match_operand:HI 1 "general_operand" ""))
- (const_int -1)))
- (set (match_operand:HI 0 "general_operand" "")
- (plus:HI (match_dup 2) (const_int 1)))]
- ""
- "operands[2] = gen_reg_rtx (HImode);")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=&r")
- (plus:HI (ffs:HI (match_operand:SI 1 "nonimmediate_operand" "rm"))
- (const_int -1)))]
- ""
- "*
-{
- rtx xops[3];
- static int ffshi_label_number;
- char buffer[30];
-
- xops[0] = operands[0];
- xops[1] = operands[1];
- xops[2] = constm1_rtx;
- output_asm_insn (AS2 (bsf%W0,%1,%0), xops);
-#ifdef LOCAL_LABEL_PREFIX
- sprintf (buffer, \"jnz %sLFFSHI%d\",
- LOCAL_LABEL_PREFIX, ffshi_label_number);
-#else
- sprintf (buffer, \"jnz %sLFFSHI%d\",
- \"\", ffshi_label_number);
-#endif
- output_asm_insn (buffer, xops);
- output_asm_insn (AS2 (mov%W0,%2,%0), xops);
-#ifdef LOCAL_LABEL_PREFIX
- sprintf (buffer, \"%sLFFSHI%d:\",
- LOCAL_LABEL_PREFIX, ffshi_label_number);
-#else
- sprintf (buffer, \"%sLFFSHI%d:\",
- \"\", ffshi_label_number);
-#endif
- output_asm_insn (buffer, xops);
-
- ffshi_label_number++;
- CC_STATUS_INIT;
- return \"\";
-}")
-
-;; These patterns match the binary 387 instructions for addM3, subM3,
-;; mulM3 and divM3. There are three patterns for each of DFmode and
-;; SFmode. The first is the normal insn, the second the same insn but
-;; with one operand a conversion, and the third the same insn but with
-;; the other operand a conversion. The conversion may be SFmode or
-;; SImode if the target mode DFmode, but only SImode if the target mode
-;; is SFmode.
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (match_operator:DF 3 "binary_387_op"
- [(match_operand:DF 1 "nonimmediate_operand" "0,fm")
- (match_operand:DF 2 "nonimmediate_operand" "fm,0")]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (match_operator:DF 3 "binary_387_op"
- [(float:DF (match_operand:SI 1 "nonimmediate_operand" "rm"))
- (match_operand:DF 2 "register_operand" "0")]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f,f")
- (match_operator:XF 3 "binary_387_op"
- [(match_operand:XF 1 "register_operand" "0,f")
- (match_operand:XF 2 "register_operand" "f,0")]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f")
- (match_operator:XF 3 "binary_387_op"
- [(float:XF (match_operand:SI 1 "nonimmediate_operand" "rm"))
- (match_operand:XF 2 "register_operand" "0")]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f,f")
- (match_operator:XF 3 "binary_387_op"
- [(float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,0"))
- (match_operand:XF 2 "register_operand" "0,f")]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f")
- (match_operator:XF 3 "binary_387_op"
- [(match_operand:XF 1 "register_operand" "0")
- (float:XF (match_operand:SI 2 "nonimmediate_operand" "rm"))]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:XF 0 "register_operand" "=f,f")
- (match_operator:XF 3 "binary_387_op"
- [(match_operand:XF 1 "register_operand" "0,f")
- (float_extend:XF
- (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (match_operator:DF 3 "binary_387_op"
- [(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,0"))
- (match_operand:DF 2 "register_operand" "0,f")]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (match_operator:DF 3 "binary_387_op"
- [(match_operand:DF 1 "register_operand" "0")
- (float:DF (match_operand:SI 2 "nonimmediate_operand" "rm"))]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (match_operator:DF 3 "binary_387_op"
- [(match_operand:DF 1 "register_operand" "0,f")
- (float_extend:DF
- (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f,f")
- (match_operator:SF 3 "binary_387_op"
- [(match_operand:SF 1 "nonimmediate_operand" "0,fm")
- (match_operand:SF 2 "nonimmediate_operand" "fm,0")]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (match_operator:SF 3 "binary_387_op"
- [(float:SF (match_operand:SI 1 "nonimmediate_operand" "rm"))
- (match_operand:SF 2 "register_operand" "0")]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (match_operator:SF 3 "binary_387_op"
- [(match_operand:SF 1 "register_operand" "0")
- (float:SF (match_operand:SI 2 "nonimmediate_operand" "rm"))]))]
- "TARGET_80387"
- "* return output_387_binary_op (insn, operands);"
- [(set (attr "type")
- (cond [(match_operand:DF 3 "is_mul" "")
- (const_string "fpmul")
- (match_operand:DF 3 "is_div" "")
- (const_string "fpdiv")
- ]
- (const_string "fpop")
- )
- )])
-
-(define_expand "strlensi"
- [(parallel [(set (match_dup 4)
- (unspec:SI [(mem:BLK (match_operand:BLK 1 "general_operand" ""))
- (match_operand:QI 2 "immediate_operand" "")
- (match_operand:SI 3 "immediate_operand" "")] 0))
- (clobber (match_dup 1))])
- (set (match_dup 5)
- (not:SI (match_dup 4)))
- (set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_dup 5)
- (const_int -1)))]
- ""
- "
-{
- if (TARGET_UNROLL_STRLEN && operands[2] == const0_rtx && optimize > 1)
- {
- rtx address;
- rtx scratch;
-
- /* well it seems that some optimizer does not combine a call like
- foo(strlen(bar), strlen(bar));
- when the move and the subtraction is done here. It does calculate
- the length just once when these instructions are done inside of
- output_strlen_unroll(). But I think since &bar[strlen(bar)] is
- often used and I use one fewer register for the lifetime of
- output_strlen_unroll() this is better. */
- scratch = gen_reg_rtx (SImode);
- address = force_reg (SImode, XEXP (operands[1], 0));
-
- /* move address to scratch-register
- this is done here because the i586 can do the following and
- in the same cycle with the following move. */
- if (GET_CODE (operands[3]) != CONST_INT || INTVAL (operands[3]) < 4)
- emit_insn (gen_movsi (scratch, address));
-
- emit_insn (gen_movsi (operands[0], address));
-
- if(TARGET_USE_Q_REG)
- emit_insn (gen_strlensi_unroll5 (operands[0],
- operands[3],
- scratch,
- operands[0]));
- else
- emit_insn (gen_strlensi_unroll4 (operands[0],
- operands[3],
- scratch,
- operands[0]));
-
- /* gen_strlensi_unroll[45] returns the address of the zero
- at the end of the string, like memchr(), so compute the
- length by subtracting the startaddress. */
- emit_insn (gen_subsi3 (operands[0], operands[0], address));
- DONE;
- }
-
- operands[1] = copy_to_mode_reg (SImode, XEXP (operands[1], 0));
- operands[4] = gen_reg_rtx (SImode);
- operands[5] = gen_reg_rtx (SImode);
-}")
-
-;; It might seem that operands 0 & 1 could use predicate register_operand.
-;; But strength reduction might offset the MEM expression. So we let
-;; reload put the address into %edi.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&c")
- (unspec:SI [(mem:BLK (match_operand:SI 1 "address_operand" "D"))
- (match_operand:QI 2 "immediate_operand" "a")
- (match_operand:SI 3 "immediate_operand" "i")] 0))
- (clobber (match_dup 1))]
- ""
- "*
-{
- rtx xops[2];
-
- xops[0] = operands[0];
- xops[1] = constm1_rtx;
- output_asm_insn (\"cld\", operands);
- output_asm_insn (AS2 (mov%L0,%1,%0), xops);
- return \"repnz\;scas%B2\";
-}")
-
-/* Conditional move define_insns. */
-
-(define_expand "movsicc"
- [(match_dup 4)
- (parallel [(set (match_operand 0 "register_operand" "")
- (if_then_else:SI (match_operand 1 "comparison_operator" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))
- (clobber (match_scratch:SI 4 "=&r"))])]
- "TARGET_CMOVE"
- "
-{
- operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
-}")
-
-(define_expand "movhicc"
- [(match_dup 4)
- (parallel [(set (match_operand 0 "register_operand" "")
- (if_then_else:HI (match_operand 1 "comparison_operator" "")
- (match_operand:HI 2 "general_operand" "")
- (match_operand:HI 3 "general_operand" "")))
- (clobber (match_scratch:SI 4 "=&r"))])]
- "TARGET_CMOVE"
- "
-{
- operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
-}")
-
-(define_insn "movsicc_1"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,&r,rm")
- (if_then_else:SI (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:SI 2 "general_operand" "rm,0,rm,g")
- (match_operand:SI 3 "general_operand" "0,rm,rm,g")))
- (clobber (match_scratch:SI 4 "X,X,X,=&r"))]
- "TARGET_CMOVE"
- "*
-{
- if (which_alternative == 0)
- {
- /* r <- cond ? arg : r */
- output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
- }
- else if (which_alternative == 1)
- {
- /* r <- cond ? r : arg */
- output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
- }
- else if (which_alternative == 2)
- {
- /* r <- cond ? arg1 : arg2 */
- output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
- output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
- }
- else if (which_alternative == 3)
- {
- /* r <- cond ? arg1 : arg2 */
- operands[5] = gen_label_rtx ();
- if (! rtx_equal_p (operands[0], operands[2]))
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[2]) == MEM)
- {
- output_asm_insn (AS2 (mov%z2,%2,%4), operands);
- output_asm_insn (AS2 (mov%z2,%4,%0), operands);
- }
- else
- output_asm_insn (AS2 (mov%z0,%2,%0), operands);
- if (! rtx_equal_p (operands[0], operands[3]))
- {
- output_asm_insn (\"j%C1 %l5\", operands);
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[3]) == MEM)
- {
- output_asm_insn (AS2 (mov%z2,%3,%4), operands);
- output_asm_insn (AS2 (mov%z2,%4,%0), operands);
- }
- else
- output_asm_insn (AS2 (mov%z0,%3,%0), operands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[5]));
- }
- }
- RET;
-}")
-
-(define_insn "movhicc_1"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,&r,rm")
- (if_then_else:HI (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:HI 2 "general_operand" "rm,0,rm,g")
- (match_operand:HI 3 "general_operand" "0,rm,rm,g")))
- (clobber (match_scratch:SI 4 "X,X,X,=&r"))]
- "TARGET_CMOVE"
- "*
-{
- if (which_alternative == 0)
- {
- /* r <- cond ? arg : r */
- output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
- }
- else if (which_alternative == 1)
- {
- /* r <- cond ? r : arg */
- output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
- }
- else if (which_alternative == 2)
- {
- /* r <- cond ? arg1 : arg2 */
- output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
- output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
- }
- else if (which_alternative == 3)
- {
- /* r <- cond ? arg1 : arg2 */
- operands[5] = gen_label_rtx ();
- if (! rtx_equal_p (operands[0], operands[2]))
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[2]) == MEM)
- {
- output_asm_insn (AS2 (mov%z2,%2,%4), operands);
- output_asm_insn (AS2 (mov%z2,%4,%0), operands);
- }
- else
- output_asm_insn (AS2 (mov%z0,%2,%0), operands);
- if (! rtx_equal_p (operands[0], operands[3]))
- {
- output_asm_insn (\"j%C1 %l5\", operands);
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[3]) == MEM)
- {
- output_asm_insn (AS2 (mov%z2,%3,%4), operands);
- output_asm_insn (AS2 (mov%z2,%4,%0), operands);
- }
- else
- output_asm_insn (AS2 (mov%z0,%3,%0), operands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[5]));
- }
- }
- RET;
-}")
-
-(define_expand "movsfcc"
- [(match_dup 4)
- (set (match_operand 0 "general_operand" "")
- (if_then_else:SF (match_operand 1 "comparison_operator" "")
- (match_operand:SF 2 "general_operand" "")
- (match_operand:SF 3 "general_operand" "")))]
- "TARGET_CMOVE"
- "
-{
- operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
-}")
-
-(define_expand "movdfcc"
- [(match_dup 4)
- (set (match_operand 0 "register_operand" "t")
- (if_then_else:DF (match_operand 1 "comparison_operator" "")
- (match_operand:DF 2 "register_operand" "f")
- (match_operand:DF 3 "register_operand" "f")))]
- "TARGET_CMOVE"
- "
-{
- operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
-}")
-
-(define_expand "movxfcc"
- [(match_dup 4)
- (set (match_operand 0 "register_operand" "t")
- (if_then_else:XF (match_operand 1 "comparison_operator" "")
- (match_operand:XF 2 "register_operand" "f")
- (match_operand:XF 3 "register_operand" "f")))]
- "TARGET_CMOVE"
- "
-{
- operands[4] = i386_compare_gen (i386_compare_op0, i386_compare_op1);
-}")
-
-(define_insn "movsfcc_1"
- [(set (match_operand:SF 0 "general_operand" "=t,=t,f,fFm")
- (if_then_else:SF (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:SF 2 "general_operand" "0,f,f,fFm")
- (match_operand:SF 3 "general_operand" "f,0,f,fFm")))]
- "TARGET_CMOVE"
- "*
-{
- if (which_alternative == 0)
- {
- /* r <- cond ? arg : r */
- output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
- }
- else if (which_alternative == 1)
- {
- /* r <- cond ? r : arg */
- output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
- }
- else if (which_alternative == 2)
- {
- /* r <- cond ? r : arg */
- output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
- output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
- }
- else if (which_alternative == 3)
- {
- rtx xops[2];
-
- /* r <- cond ? arg1 : arg2 */
- operands[4] = gen_label_rtx ();
-
- if (STACK_REG_P (operands[2]) || GET_CODE (operands[2]) == MEM)
- output_asm_insn (AS1 (fld%z2,%y2), operands);
- else
- {
- xops[0] = operands[0];
- xops[1] = operands[2];
- output_move_const_single (xops);
- }
- output_asm_insn (\"j%C1 %l4\", operands);
- if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
- output_asm_insn (AS1 (fld%z3,%y3), operands);
- else
- {
- xops[1] = operands[3];
- SET_SRC (PATTERN (insn)) = XEXP (SET_SRC (PATTERN (insn)), 2);
- output_move_const_single (xops);
- }
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[4]));
-}
- RET;
-}")
-
-(define_insn "movdfcc_1"
- [(set (match_operand:DF 0 "general_operand" "=t,=t,f,fFm")
- (if_then_else:DF (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:DF 2 "general_operand" "0,f,f,fFm")
- (match_operand:DF 3 "general_operand" "f,0,f,fFm")))]
- "TARGET_CMOVE"
- "*
-{
- if (which_alternative == 0)
- {
- /* r <- cond ? arg : r */
- output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
- }
- else if (which_alternative == 1)
- {
- /* r <- cond ? r : arg */
- output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
- }
- else if (which_alternative == 2)
- {
- /* r <- cond ? r : arg */
- output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
- output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
- }
- else if (which_alternative == 3)
- {
- rtx xops[2];
-
- /* r <- cond ? arg1 : arg2 */
- operands[4] = gen_label_rtx ();
-
- if (STACK_REG_P (operands[2]) || GET_CODE (operands[2]) == MEM)
- output_asm_insn (AS1 (fld%z2,%y2), operands);
- else
- {
- xops[0] = operands[0];
- xops[1] = operands[2];
- output_move_const_single (xops);
- }
- output_asm_insn (\"j%C1 %l4\", operands);
- if (STACK_REG_P (operands[3]) || GET_CODE (operands[0]) == MEM)
- output_asm_insn (AS1 (fld%z3,%y3), operands);
- else
- {
- xops[1] = operands[3];
- SET_SRC (PATTERN (insn)) = XEXP (SET_SRC (PATTERN (insn)), 2);
- output_move_const_single (xops);
- }
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[4]));
-}
- RET;
-}")
-
-(define_insn "movxfcc_1"
- [(set (match_operand:XF 0 "register_operand" "=t,t")
- (if_then_else:XF (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (match_operand:XF 2 "register_operand" "0,f")
- (match_operand:XF 3 "register_operand" "f,0")))]
- "TARGET_CMOVE"
- "*
-{
- if (which_alternative == 0)
- {
- /* r <- cond ? arg : r */
- output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
- }
- else if (which_alternative == 1)
- {
- /* r <- cond ? r : arg */
- output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
- }
- RET;
-}")
-
-(define_insn "strlensi_unroll"
- [(set (match_operand:SI 0 "register_operand" "=&r,&r")
- (unspec:SI [(mem:BLK (match_operand:SI 1 "address_operand" "r,r"))
- (match_operand:SI 2 "immediate_operand" "i,i")] 0))
- (clobber (match_scratch:SI 3 "=&q,&r"))]
- "optimize > 1"
- "* return output_strlen_unroll (operands);")
-
-;; the only difference between the following patterns is the register preference
-;; on a pentium using a q-register saves one clock cycle per 4 characters
-
-(define_insn "strlensi_unroll4"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (unspec:SI [(mem:BLK (match_operand:SI 3 "register_operand" "0,0"))
- (match_operand:SI 1 "immediate_operand" "i,i")
- (match_operand:SI 2 "register_operand" "+q,!r")] 0))
- (clobber (match_dup 2))]
- "(TARGET_USE_ANY_REG && optimize > 1)"
- "* return output_strlen_unroll (operands);")
-
-(define_insn "strlensi_unroll5"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (unspec:SI [(mem:BLK (match_operand:SI 3 "register_operand" "0"))
- (match_operand:SI 1 "immediate_operand" "i")
- (match_operand:SI 2 "register_operand" "+q")] 0))
- (clobber (match_dup 2))]
- "(TARGET_USE_Q_REG && optimize > 1)"
- "* return output_strlen_unroll (operands);"
-)
-
-(define_insn "allocate_stack_worker"
- [(unspec:SI [(match_operand:SI 0 "register_operand" "a")] 3)
- (set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0)))
- (clobber (match_dup 0))]
- "TARGET_STACK_PROBE"
- "* return AS1(call,__alloca);")
-
-(define_expand "allocate_stack"
- [(set (reg:SI 7)
- (minus:SI (reg:SI 7) (match_operand:SI 0 "general_operand" "")))]
- "TARGET_STACK_PROBE"
- "
-{
-#ifdef CHECK_STACK_LIMIT
- if (GET_CODE (operands[0]) == CONST_INT
- && INTVAL (operands[0]) < CHECK_STACK_LIMIT)
- emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
- operands[0]));
- else
-#endif
- emit_insn (gen_allocate_stack_worker (copy_to_mode_reg (SImode,
- operands[0])));
-
- DONE;
-}")
diff --git a/gcc/config/i386/isc.h b/gcc/config/i386/isc.h
deleted file mode 100644
index c0a51508abd..00000000000
--- a/gcc/config/i386/isc.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Assembler-independent definitions for an Intel 386 running
- Interactive Unix System V. Specifically, this is for recent versions
- that support POSIX. */
-
-/* Use crt1.o, not crt0.o, as a startup file, and crtn.o as a closing file. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!shlib:%{posix:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\
- %{Xp:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\
- %{!posix:%{!Xp:%{pg:mcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}\
- %{p:-L/lib/libp} %{pg:-L/lib/libp}}}}\
- %{shlib:%{Xp:crtp1.o%s}%{posix:crtp1.o%s}%{!posix:%{!Xp:crt1.o%s}}}\
- crtbegin.o%s"
-
-#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
-
-/* Library spec */
-#undef LIB_SPEC
-#define LIB_SPEC "%{shlib:-lc_s} %{posix:-lcposix} %{Xp:-lcposix} -lc -lg"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{posix:-D_POSIX_SOURCE} %{Xp:-D_POSIX_SOURCE}"
-
-/* ISC 2.2 uses `char' for `wchar_t'. */
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "char"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_UNIT
-
-#if 0
-/* This is apparently not true: ISC versions up to 3.0, at least, use
- the standard calling sequence in which the called function pops the
- extra arg. */
-/* caller has to pop the extra argument passed to functions that return
- structures. */
-
-#undef RETURN_POPS_ARGS
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE ? 0 \
- : (TARGET_RTD \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) ? (SIZE) \
- : 0)
-/* On other 386 systems, the last line looks like this:
- : (aggregate_value_p (TREE_TYPE (FUNTYPE))) ? GET_MODE_SIZE (Pmode) : 0) */
-#endif
-
-/* Handle #pragma pack and #pragma weak. */
-#define HANDLE_SYSV_PRAGMA
-
-/* By default, target has a 80387, uses IEEE compatible arithmetic,
- and returns float values in the 387, ie,
- (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387)
-
- ISC's software emulation of a 387 fails to handle the `fucomp'
- opcode. fucomp is only used when generating IEEE compliant code.
- So don't make TARGET_IEEE_FP default for ISC. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0201
-
-/* The ISC 2.0.2 software FPU emulator apparently can't handle
- 80-bit XFmode insns, so don't generate them. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* The ISC assembler does not like a .file directive with a name
- longer than 14 characters. Truncating it will not permit
- debugging to work properly, but at least we won't get an error
- message. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- char c; \
- int max = 0; \
- char *string = dump_base_name; \
- \
- fputs ("\t.file\t\"", FILE); \
- \
- while ((c = *string++) != 0 && max++ < 14) { \
- if (c == '\"' || c == '\\') \
- putc ('\\', FILE); \
- putc (c, FILE); \
- } \
- fputs ("\"\n", FILE); \
- } while (0)
diff --git a/gcc/config/i386/isccoff.h b/gcc/config/i386/isccoff.h
deleted file mode 100644
index 383b981328b..00000000000
--- a/gcc/config/i386/isccoff.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Definitions for Intel 386 running Interactive Unix System V.
- Specifically, this is for recent versions that support POSIX;
- for version 2.0.2, use configuration option i386-sysv instead.
- (But set TARGET_DEFAULT to 0201 if you do that,
- if you don't have a real 80387.) */
-
-/* Mostly it's like AT&T Unix System V. */
-
-#include "i386/sysv3.h"
-
-/* But with a few changes. */
-#include "i386/isc.h"
diff --git a/gcc/config/i386/iscdbx.h b/gcc/config/i386/iscdbx.h
deleted file mode 100644
index 6c2d42e470d..00000000000
--- a/gcc/config/i386/iscdbx.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Definitions for Intel 386 running Interactive Unix System V,
- using dbx-in-coff encapsulation.
- Specifically, this is for recent versions that support POSIX.
- Copyright (C) 1992, 1995 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. */
-
-/* Mostly it's like AT&T Unix System V with dbx-in-coff. */
-
-#include "i386/svr3dbx.h"
-
-/* But with a few changes. */
-#undef ENDFILE_SPEC
-#include "i386/isc.h"
-
-/* Overridden defines for ifile usage. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!r:%{!z:svr3.ifile%s}%{z:svr3z.ifile%s}}\
- %{!shlib:%{posix:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\
- %{Xp:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\
- %{!posix:%{!Xp:%{pg:mcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
- %{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp}}\
- %{shlib:%{posix:crtp1.o%s}%{Xp:crtp1.o%s}%{!posix:%{!Xp:crt1.o%s}}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtn.o%s"
diff --git a/gcc/config/i386/linux-aout.h b/gcc/config/i386/linux-aout.h
deleted file mode 100644
index f7d807a10d0..00000000000
--- a/gcc/config/i386/linux-aout.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Definitions for Intel 386 running Linux
- Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
- Contributed by H.J. Lu (hjl@nynexst.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 is tested by i386/gas.h. */
-#define YES_UNDERSCORES
-
-#include <i386/gstabs.h>
-#include <linux-aout.h> /* some common stuff */
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dlinux -Asystem(posix)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler,
- and we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-#undef LIB_SPEC
-
-#if 1
-/* We no longer link with libc_p.a or libg.a by default. If you
- * want to profile or debug the Linux C library, please add
- * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
- */
-#define LIB_SPEC \
-"%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}"
-#else
-#define LIB_SPEC \
-"%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
- %{!p:%{!pg:%{!g*:-lc} %{g*:-lg -static}}}"
-#endif
-
-
-#undef LINK_SPEC
-#define LINK_SPEC "-m i386linux"
-
-/* Get perform_* macros to build libgcc.a. */
-#include "i386/perform.h"
diff --git a/gcc/config/i386/linux-oldld.h b/gcc/config/i386/linux-oldld.h
deleted file mode 100644
index a12ab590076..00000000000
--- a/gcc/config/i386/linux-oldld.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Definitions for Intel 386 running Linux with pre-BFD a.out linkers
- Copyright (C) 1995 Free Software Foundation, Inc.
- Contributed by Michael Meissner (meissner@cygnus.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 is tested by i386/gas.h. */
-#define YES_UNDERSCORES
-
-#include <i386/gstabs.h>
-#include <linux-aout.h> /* some common stuff */
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dlinux -Asystem(posix)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler,
- and we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-#undef LIB_SPEC
-
-#if 1
-/* We no longer link with libc_p.a or libg.a by default. If you
- * want to profile or debug the Linux C library, please add
- * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
- */
-#define LIB_SPEC \
-"%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}"
-#else
-#define LIB_SPEC \
-"%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
- %{!p:%{!pg:%{!g*:-lc} %{g*:-lg -static}}}"
-#endif
-
-
-#undef LINK_SPEC
-#define LINK_SPEC ""
-
-/* Get perform_* macros to build libgcc.a. */
-#include <i386/perform.h>
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
deleted file mode 100644
index ef1f7f4f897..00000000000
--- a/gcc/config/i386/linux.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* Definitions for Intel 386 running Linux with ELF format
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Eric Youngdale.
- Modified for stabs-in-ELF by H.J. Lu.
-
-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. */
-
-#define LINUX_DEFAULT_ELF
-
-/* A lie, I guess, but the general idea behind linux/ELF is that we are
- supposed to be outputting something that will assemble under SVr4.
- This gets us pretty close. */
-#include <i386/i386.h> /* Base i386 target machine definitions */
-#include <i386/att.h> /* Use the i386 AT&T assembler syntax */
-#include <linux.h> /* some common stuff */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
-
-/* The svr4 ABI for the i386 says that records and unions are returned
- in memory. */
-#undef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 1
-
-/* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
- i386.md for an explanation of the expression this outputs. */
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
-
-/* Indicate that jump tables go in the text section. This is
- necessary when compiling PIC code. */
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* Copy this from the svr4 specifications... */
-/* Define the register numbers to be used in Dwarf debugging information.
- The SVR4 reference port C compiler uses the following register numbers
- in its Dwarf output code:
- 0 for %eax (gnu regno = 0)
- 1 for %ecx (gnu regno = 2)
- 2 for %edx (gnu regno = 1)
- 3 for %ebx (gnu regno = 3)
- 4 for %esp (gnu regno = 7)
- 5 for %ebp (gnu regno = 6)
- 6 for %esi (gnu regno = 4)
- 7 for %edi (gnu regno = 5)
- The following three DWARF register numbers are never generated by
- the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
- believes these numbers have these meanings.
- 8 for %eip (no gnu equivalent)
- 9 for %eflags (no gnu equivalent)
- 10 for %trapno (no gnu equivalent)
- It is not at all clear how we should number the FP stack registers
- for the x86 architecture. If the version of SDB on x86/svr4 were
- a bit less brain dead with respect to floating-point then we would
- have a precedent to follow with respect to DWARF register numbers
- for x86 FP registers, but the SDB on x86/svr4 is so completely
- broken with respect to FP registers that it is hardly worth thinking
- of it as something to strive for compatibility with.
- The version of x86/svr4 SDB I have at the moment does (partially)
- seem to believe that DWARF register number 11 is associated with
- the x86 register %st(0), but that's about all. Higher DWARF
- register numbers don't seem to be associated with anything in
- particular, and even for DWARF regno 11, SDB only seems to under-
- stand that it should say that a variable lives in %st(0) (when
- asked via an `=' command) if we said it was in DWARF regno 11,
- but SDB still prints garbage when asked for the value of the
- variable in question (via a `/' command).
- (Also note that the labels SDB prints for various FP stack regs
- when doing an `x' command are all wrong.)
- Note that these problems generally don't affect the native SVR4
- C compiler because it doesn't allow the use of -O with -g and
- because when it is *not* optimizing, it allocates a memory
- location for each floating-point variable, and the memory
- location is what gets described in the DWARF AT_location
- attribute for the variable in question.
- Regardless of the severe mental illness of the x86/svr4 SDB, we
- do something sensible here and we use the following DWARF
- register numbers. Note that these are all stack-top-relative
- numbers.
- 11 for %st(0) (gnu regno = 8)
- 12 for %st(1) (gnu regno = 9)
- 13 for %st(2) (gnu regno = 10)
- 14 for %st(3) (gnu regno = 11)
- 15 for %st(4) (gnu regno = 12)
- 16 for %st(5) (gnu regno = 13)
- 17 for %st(6) (gnu regno = 14)
- 18 for %st(7) (gnu regno = 15)
-*/
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 \
- : (n) == 1 ? 2 \
- : (n) == 2 ? 1 \
- : (n) == 3 ? 3 \
- : (n) == 4 ? 6 \
- : (n) == 5 ? 7 \
- : (n) == 6 ? 5 \
- : (n) == 7 ? 4 \
- : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
- : (-1))
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- if (flag_pic) \
- { \
- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
- LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall mcount\n"); \
- } \
-}
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__ELF__ -Dunix -Dlinux -Asystem(posix)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
-
-/* Provide a LINK_SPEC appropriate for Linux. Here we provide support
- for the special GCC options -static and -shared, which allow us to
- link things in one of these three modes by applying the appropriate
- combinations of options at link-time. We like to support here for
- as many of the other GNU linker options as possible. But I don't
- have the time to search for those flags. I am sure how to add
- support for -soname shared_object_name. H.J.
-
- I took out %{v:%{!V:-V}}. It is too much :-(. They can use
- -Wl,-V.
-
- When the -shared link option is used a final link is not being
- done. */
-
-/* If ELF is the default format, we should not use /lib/elf. */
-
-#undef LINK_SPEC
-#ifndef LINUX_DEFAULT_ELF
-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
- %{!shared: \
- %{!ibcs: \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \
- %{!rpath:-rpath /lib/elf/}} %{static:-static}}}"
-#else
-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
- %{!shared: \
- %{!ibcs: \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
- %{static:-static}}}"
-#endif
-
-/* Get perform_* macros to build libgcc.a. */
-#include "i386/perform.h"
-
-/* A C statement (sans semicolon) to output to the stdio stream
- FILE the assembler definition of uninitialized global DECL named
- NAME whose size is SIZE bytes and alignment is ALIGN bytes.
- Try to use asm_output_aligned_bss to implement this macro. */
-
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
- asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
diff --git a/gcc/config/i386/lynx-ng.h b/gcc/config/i386/lynx-ng.h
deleted file mode 100644
index ec4e2961692..00000000000
--- a/gcc/config/i386/lynx-ng.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Definitions for Intel 386 running LynxOS, using Lynx's old as and ld.
- Copyright (C) 1993, 1995 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. */
-
-#include <i386/gstabs.h>
-#include <lynx-ng.h>
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -DI386 -DLynx -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(i386) -Amachine(i386)"
-
-/* Provide required defaults for linker switches. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "-P1000 %{msystem-v:-V} %{mcoff:-k}"
-
-/* Apparently LynxOS clobbers ebx when you call into the OS. */
-
-#undef CALL_USED_REGISTERS
-#define CALL_USED_REGISTERS \
-/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
-{ 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
diff --git a/gcc/config/i386/lynx.h b/gcc/config/i386/lynx.h
deleted file mode 100644
index 73111f916a5..00000000000
--- a/gcc/config/i386/lynx.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Definitions for Intel 386 running LynxOS.
- Copyright (C) 1993, 1995, 1996 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. */
-
-#include <i386/gstabs.h>
-#include <lynx.h>
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -DI386 -DLynx -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(i386) -Amachine(i386)"
-
-/* The prefix to add to user-visible assembler symbols. */
-
-/* Override the svr3 convention of adding a leading underscore. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* Apparently LynxOS clobbers ebx when you call into the OS. */
-
-#undef CALL_USED_REGISTERS
-#define CALL_USED_REGISTERS \
-/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \
-{ 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
diff --git a/gcc/config/i386/mach.h b/gcc/config/i386/mach.h
deleted file mode 100644
index 4b7cf37e54d..00000000000
--- a/gcc/config/i386/mach.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Configuration for an i386 running Mach as the target machine. */
-
-/* We do want to add an underscore to the front of each user symbol.
- i386/gas.h checks this. */
-#define YES_UNDERSCORES
-
-#include "i386/gstabs.h"
-
-/* Get perform_* macros to build libgcc.a. */
-#include "i386/perform.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -DMACH -Asystem(unix) -Asystem(mach) -Acpu(i386) -Amachine(i386)"
-
-/* Specify extra dir to search for include files. */
-#define SYSTEM_INCLUDE_DIR "/usr/mach/include"
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/i386/moss.h b/gcc/config/i386/moss.h
deleted file mode 100644
index dadf3d86af2..00000000000
--- a/gcc/config/i386/moss.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Definitions for Intel 386 running MOSS
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Bryan Ford <baford@cs.utah.edu>
-
-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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* I believe in reuse... */
-#include "i386/linux.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__ELF__ -Di386 -Dmoss -Asystem(posix) -Acpu(i386) -Amachine(i386)"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "crt0.o%s"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtn.o%s"
-
-#undef LINK_SPEC
-
diff --git a/gcc/config/i386/netbsd.h b/gcc/config/i386/netbsd.h
deleted file mode 100644
index 8262fb04195..00000000000
--- a/gcc/config/i386/netbsd.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This goes away when the math-emulator is fixed */
-#define TARGET_CPU_DEFAULT 0400 /* TARGET_NO_FANCY_MATH_387 */
-
-/* This is tested by i386gas.h. */
-#define YES_UNDERSCORES
-
-#include <i386/gstabs.h>
-
-/* Get perform_* macros to build libgcc.a. */
-#include <i386/perform.h>
-
-/* Get generic NetBSD definitions. */
-#include <netbsd.h>
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386)"
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
-
-#undef ASM_APP_ON
-#define ASM_APP_ON "#APP\n"
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* The following macros are stolen from i386v4.h */
-/* These have to be defined to get PIC code correct */
-
-/* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
- i386.md for an explanation of the expression this outputs. */
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
-
-/* Indicate that jump tables go in the text section. This is
- necessary when compiling PIC code. */
-
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Profiling routines, partially copied from i386/osfrose.h. */
-
-/* Redefine this to use %eax instead of %edx. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- if (flag_pic) \
- { \
- fprintf (FILE, "\tcall mcount@PLT\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tcall mcount\n"); \
- } \
-}
diff --git a/gcc/config/i386/next.h b/gcc/config/i386/next.h
deleted file mode 100644
index 8dd46f5cd41..00000000000
--- a/gcc/config/i386/next.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/* Target definitions for GNU compiler for Intel x86 CPU running NeXTSTEP
- Copyright (C) 1993, 1995, 1996 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. */
-
-#include "i386/gas.h"
-#include "nextstep.h"
-
-/* By default, target has a 80387, with IEEE FP. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (1|0100)
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Machines that use the AT&T assembler syntax
- also return floating point values in an FP register.
- Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-#undef VALUE_REGNO
-#define VALUE_REGNO(MODE) \
- ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \
- ? FIRST_FLOAT_REG : 0)
-
-/* 1 if N is a possible register number for a function value. */
-
-#undef FUNCTION_VALUE_REGNO_P
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N)== FIRST_FLOAT_REG)
-
-#ifdef REAL_VALUE_TO_TARGET_LONG_DOUBLE
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
- do { \
- long hex[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, hex); \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n\t.long 0x%x\n", \
- hex[0], hex[1], hex[2]); \
- else \
- fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n\t.long 0x%lx\n", \
- hex[0], hex[1], hex[2]); \
- } while (0)
-#endif
-
-#ifdef REAL_VALUE_TO_TARGET_DOUBLE
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { \
- long hex[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex); \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n", hex[0], hex[1]); \
- else \
- fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", hex[0], hex[1]); \
- } while (0)
-#endif
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#ifdef REAL_VALUE_TO_TARGET_SINGLE
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { \
- long hex; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex); \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "\t.long 0x%x\n", hex); \
- else \
- fprintf (FILE, "\t.long 0x%lx\n", hex); \
- } while (0)
-#endif
-
-/* A C statement or statements which output an assembler instruction
- opcode to the stdio stream STREAM. The macro-operand PTR is a
- variable of type `char *' which points to the opcode name in its
- "internal" form--the form that is written in the machine description.
-
- GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
- So use `repe' instead. */
-
-#undef ASM_OUTPUT_OPCODE
-#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
-{ \
- if ((PTR)[0] == 'r' \
- && (PTR)[1] == 'e' \
- && (PTR)[2] == 'p') \
- { \
- if ((PTR)[3] == 'z') \
- { \
- fprintf (STREAM, "repe"); \
- (PTR) += 4; \
- } \
- else if ((PTR)[3] == 'n' && (PTR)[4] == 'z') \
- { \
- fprintf (STREAM, "repne"); \
- (PTR) += 5; \
- } \
- } \
-}
-
-/* Define macro used to output shift-double opcodes when the shift
- count is in %cl. Some assemblers require %cl as an argument;
- some don't.
-
- GAS requires the %cl argument, so override unx386.h. */
-
-#undef SHIFT_DOUBLE_OMITS_COUNT
-#define SHIFT_DOUBLE_OMITS_COUNT 0
-
-/* Print opcodes the way that GAS expects them. */
-#define GAS_MNEMONICS 1
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di386 -DNeXT -Dunix -D__MACH__ -D__LITTLE_ENDIAN__ -D__ARCHITECTURE__=\"i386\" -Asystem(unix) -Asystem(mach) -Acpu(i386) -Amachine(i386)"
-
-/* This accounts for the return pc and saved fp on the i386. */
-
-#define OBJC_FORWARDING_STACK_OFFSET 8
-#define OBJC_FORWARDING_MIN_OFFSET 8
-
-/* We do not want a dot in internal labels. */
-
-#undef LPREFIX
-#define LPREFIX "L"
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), "*%s%d", (PREFIX), (NUMBER))
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#undef ASM_APP_ON
-#define ASM_APP_ON "#APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF "#NO_APP\n"
-
-#undef ASM_OUTPUT_REG_PUSH
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tpushl %se%s\n", "%", reg_names[REGNO])
-
-#undef ASM_OUTPUT_REG_POP
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tpopl %se%s\n", "%", reg_names[REGNO])
-
-/* This is being overridden because the default i386 configuration
- generates calls to "_mcount". NeXT system libraries all use
- "mcount". */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- if (flag_pic) \
- { \
- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
- LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
- fprintf (FILE, "\tcall mcount\n"); \
- } \
-}
-
-/* BEGIN Calling Convention CHANGES */
-
-/* These changes violate the Intel/Unix ABI. Specifically, they
- change the way that space for a block return value is passed to a
- function. The ABI says that the pointer is passed on the stack.
- We change to pass the pointer in %ebx. This makes the NeXT
- Objective-C forwarding mechanism possible to implement on an i386. */
-
-/* Do NOT pass address of structure values on the stack. */
-
-#undef STRUCT_VALUE_INCOMING
-#undef STRUCT_VALUE
-
-/* Pass them in %ebx. */
-
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE_REGNUM 3
-
-/* Because we are passing the pointer in a register, we don't need to
- rely on the callee to pop it. */
-
-#undef RETURN_POPS_ARGS
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE \
- ? 0 \
- : (TARGET_RTD \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) ? (SIZE) : 0)
-
-/* END Calling Convention CHANGES */
diff --git a/gcc/config/i386/os2.h b/gcc/config/i386/os2.h
deleted file mode 100644
index 8bbab361f98..00000000000
--- a/gcc/config/i386/os2.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Definitions of target machine for GNU compiler
- for an Intel i386 or later processor running OS/2 2.x.
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
- Contributed by Samuel Figueroa (figueroa@cs.nyu.edu)
-
-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 DEFAULT_TARGET_MACHINE
-#define DEFAULT_TARGET_MACHINE "i386-os2"
-#endif
-#ifndef LINK_SPEC
-#define LINK_SPEC "/st:1048576/pm:vio/noi/a:16/e/bas:65536/nol"
-#endif
-#ifndef LIB_SPEC
-#define LIB_SPEC "libgcc libc"
-#endif
-#ifndef STARTFILE_SPEC
-#define STARTFILE_SPEC "libcrt.lib"
-#endif
-#ifndef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "\\gcc\\bin\\"
-#endif
-#ifndef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "\\gcc\\lib\\"
-#endif
-#ifndef LOCAL_INCLUDE_DIR
-#define LOCAL_INCLUDE_DIR "\\gcc\\include"
-#endif
-
-#define YES_UNDERSCORES
-#include "i386/gstabs.h"
-
-#define USE_COLLECT
-
-#define BIGGEST_FIELD_ALIGNMENT \
- (maximum_field_alignment ? maximum_field_alignment : 32)
-
-extern int maximum_field_alignment;
-
-#undef PCC_BITFIELD_TYPE_MATTERS
-#define PCC_BITFIELD_TYPE_MATTERS (maximum_field_alignment == 0)
-
-/* Define this macro if it is advisable to hold scalars in registers
- in a wider mode than that declared by the program. In such cases,
- the value is constrained to be within the bounds of the declared
- type, but kept valid in the wider mode. The signedness of the
- extension may differ from that of the type. */
-
-#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
- (MODE) = SImode;
-
-/* Define this if function arguments should also be promoted using the above
- procedure. */
-
-#define PROMOTE_FUNCTION_ARGS
-
-/* Likewise, if the function return value is promoted. */
-
-#define PROMOTE_FUNCTION_RETURN
diff --git a/gcc/config/i386/osfelf.h b/gcc/config/i386/osfelf.h
deleted file mode 100644
index 4604a341175..00000000000
--- a/gcc/config/i386/osfelf.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Intel 386 (OSF/1 with ELF) version.
- Copyright (C) 1993 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. */
-
-#include "config/i386/osfrose.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Asystem(xpg4)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] \
-%{mrose: -D__ROSE__ %{!pic-none: -D__SHARED__}} \
-%{!mrose: -D__ELF__ %{fpic: -D__SHARED__}} \
-%{mno-underscores: -D__NO_UNDERSCORES__} \
-%{!mrose: %{!munderscores: -D__NO_UNDERSCORES__}} \
-%{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
-%{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
-%{.cc: -D__LANGUAGE_C_PLUS_PLUS} \
-%{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \
-%{.C: -D__LANGUAGE_C_PLUS_PLUS} \
-%{.m: -D__LANGUAGE_OBJECTIVE_C} \
-%{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
-
-/* Turn on -pic-extern by default for OSF/rose, -fpic for ELF. */
-#undef CC1_SPEC
-#define CC1_SPEC "\
-%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
-%{!melf: %{!mrose: -melf }} \
-%{!mrose: %{!munderscores: %{!mno-underscores: -mno-underscores }} \
- %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount-ptr }}}} \
-%{mrose: %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount }}} \
- %{pic-extern: -mhalf-pic } %{pic-lib: -mhalf-pic } \
- %{!pic-extern: %{!pic-lib: %{pic-none: -mno-half-pic} %{!pic-none: -mhalf-pic}}} \
- %{pic-calls: } %{pic-names*: }}"
-
-#undef ASM_SPEC
-#define ASM_SPEC "%{v*: -v}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{v*: -v} \
-%{mrose: %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
- %{nostdlib} %{noshrlib} %{glue}} \
-%{!mrose: %{dy} %{dn} %{glue: } \
- %{h*} %{z*} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy} \
- %{symbolic:-Bsymbolic -G -dy} \
- %{G:-G} \
- %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
- %{noshrlib: -dn } %{pic-none: -dn } \
- %{!noshrlib: %{!pic-none: -dy}}}}}}}}"
-
-#undef TARGET_VERSION_INTERNAL
-#undef TARGET_VERSION
-
-#undef I386_VERSION
-#define I386_VERSION " 80386, ELF objects"
-
-#define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)
-#define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
-
-#undef OBJECT_FORMAT_ROSE
diff --git a/gcc/config/i386/osfrose.h b/gcc/config/i386/osfrose.h
deleted file mode 100644
index fd4c3a8eb28..00000000000
--- a/gcc/config/i386/osfrose.h
+++ /dev/null
@@ -1,920 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Intel 386 (OSF/1 with OSF/rose) version.
- Copyright (C) 1991, 1992, 1993, 1996 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. */
-
-#include "halfpic.h"
-#include "i386/gstabs.h"
-
-/* Get perform_* macros to build libgcc.a. */
-#include "i386/perform.h"
-
-#define OSF_OS
-
-#undef WORD_SWITCH_TAKES_ARG
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))
-
-/* This defines which switch letters take arguments. On svr4, most of
- the normal cases (defined in gcc.c) apply, and we also have -h* and
- -z* options (for the linker). */
-
-#define SWITCH_TAKES_ARG(CHAR) \
- (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
- || (CHAR) == 'h' \
- || (CHAR) == 'z')
-
-#define MASK_HALF_PIC 010000000000 /* Mask for half-pic code */
-#define MASK_HALF_PIC_DEBUG 004000000000 /* Debug flag */
-#define MASK_ELF 002000000000 /* ELF not rose */
-#define MASK_NO_IDENT 001000000000 /* suppress .ident */
-#define MASK_NO_UNDERSCORES 000400000000 /* suppress leading _ */
-#define MASK_LARGE_ALIGN 000200000000 /* align to >word boundaries */
-#define MASK_NO_MCOUNT 000100000000 /* profiling uses mcount_ptr */
-
-#define TARGET_HALF_PIC (target_flags & MASK_HALF_PIC)
-#define TARGET_DEBUG (target_flags & MASK_HALF_PIC_DEBUG)
-#define HALF_PIC_DEBUG TARGET_DEBUG
-#define TARGET_ELF (target_flags & MASK_ELF)
-#define TARGET_ROSE ((target_flags & MASK_ELF) == 0)
-#define TARGET_IDENT ((target_flags & MASK_NO_IDENT) == 0)
-#define TARGET_UNDERSCORES ((target_flags & MASK_NO_UNDERSCORES) == 0)
-#define TARGET_LARGE_ALIGN (target_flags & MASK_LARGE_ALIGN)
-#define TARGET_MCOUNT ((target_flags & MASK_NO_MCOUNT) == 0)
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- { "half-pic", MASK_HALF_PIC}, \
- { "no-half-pic", -MASK_HALF_PIC}, \
- { "debug-half-pic", MASK_HALF_PIC_DEBUG}, \
- { "debugb", MASK_HALF_PIC_DEBUG}, \
- { "elf", MASK_ELF}, \
- { "rose", -MASK_ELF}, \
- { "ident", -MASK_NO_IDENT}, \
- { "no-ident", MASK_NO_IDENT}, \
- { "underscores", -MASK_NO_UNDERSCORES}, \
- { "no-underscores", MASK_NO_UNDERSCORES}, \
- { "large-align", MASK_LARGE_ALIGN}, \
- { "no-large-align", -MASK_LARGE_ALIGN}, \
- { "mcount", -MASK_NO_MCOUNT}, \
- { "mcount-ptr", MASK_NO_MCOUNT}, \
- { "no-mcount", MASK_NO_MCOUNT},
-
-/* OSF/rose uses stabs, not dwarf. */
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#ifndef DWARF_DEBUGGING_INFO
-#define DWARF_DEBUGGING_INFO /* enable dwarf debugging for testing */
-#endif
-
-/* Handle #pragma weak and #pragma pack. */
-
-#define HANDLE_SYSV_PRAGMA
-#define SUPPORTS_WEAK TARGET_ELF
-
-/* Change default predefines. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Asystem(xpg4)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] \
-%{!melf: -D__ROSE__ %{!pic-none: -D__SHARED__}} \
-%{melf: -D__ELF__ %{fpic: -D__SHARED__}} \
-%{mno-underscores: -D__NO_UNDERSCORES__} \
-%{melf: %{!munderscores: -D__NO_UNDERSCORES__}} \
-%{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
-%{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
-%{.cc: -D__LANGUAGE_C_PLUS_PLUS} \
-%{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \
-%{.C: -D__LANGUAGE_C_PLUS_PLUS} \
-%{.m: -D__LANGUAGE_OBJECTIVE_C} \
-%{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
-
-/* Turn on -pic-extern by default for OSF/rose, -fpic for ELF. */
-#undef CC1_SPEC
-#define CC1_SPEC "\
-%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
-%{!melf: %{!mrose: -mrose }} \
-%{melf: %{!munderscores: %{!mno-underscores: -mno-underscores }} \
- %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount-ptr }}}} \
-%{!melf: %{!munderscores: %{!mno-underscores: -munderscores }} \
- %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount }}} \
- %{pic-extern: -mhalf-pic } %{pic-lib: -mhalf-pic } \
- %{!pic-extern: %{!pic-lib: %{pic-none: -mno-half-pic} %{!pic-none: -mhalf-pic}}} \
- %{pic-calls: } %{pic-names*: }}"
-
-#undef ASM_SPEC
-#define ASM_SPEC "%{v*: -v}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{v*: -v} \
-%{!melf: %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
- %{nostdlib} %{noshrlib} %{glue}} \
-%{melf: %{dy} %{dn} %{glue: } \
- %{h*} %{z*} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy} \
- %{symbolic:-Bsymbolic -G -dy} \
- %{G:-G} \
- %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
- %{noshrlib: -dn } %{pic-none: -dn } \
- %{!noshrlib: %{!pic-none: -dy}}}}}}}}"
-
-#undef LIB_SPEC
-#define LIB_SPEC "-lc"
-
-#undef LIBG_SPEC
-#define LIBG_SPEC ""
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
-
-#undef TARGET_VERSION_INTERNAL
-#undef TARGET_VERSION
-
-#define I386_VERSION " 80386, OSF/rose objects"
-
-#define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)
-#define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
-
-#undef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/ccs/gcc/"
-
-#undef MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
-
-/* Specify size_t, ptrdiff_t, and wchar_t types. */
-#undef SIZE_TYPE
-#undef PTRDIFF_TYPE
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-
-#define SIZE_TYPE "long unsigned int"
-#define PTRDIFF_TYPE "int"
-#define WCHAR_TYPE "unsigned int"
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-/* Define this macro if the system header files support C++ as well
- as C. This macro inhibits the usual method of using system header
- files in C++, which is to pretend that the file's contents are
- enclosed in `extern "C" {...}'. */
-#define NO_IMPLICIT_EXTERN_C
-
-/* Turn off long double being 96 bits. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used.
-
- We override it here to allow for the new profiling code to go before
- the prologue and the old mcount code to go after the prologue (and
- after %ebx has been set up for ELF shared library support). */
-
-#define OSF_PROFILE_BEFORE_PROLOGUE \
- (!TARGET_MCOUNT \
- && !current_function_needs_context \
- && (!flag_pic \
- || !frame_pointer_needed \
- || (!current_function_uses_pic_offset_table \
- && !current_function_uses_const_pool)))
-
-#undef FUNCTION_PROLOGUE
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-do \
- { \
- char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \
- char *lprefix = LPREFIX; \
- int labelno = profile_label_no; \
- \
- if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE) \
- { \
- if (!flag_pic && !HALF_PIC_P ()) \
- { \
- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
- fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix); \
- } \
- \
- else if (HALF_PIC_P ()) \
- { \
- rtx symref; \
- \
- HALF_PIC_EXTERNAL ("_mcount_ptr"); \
- symref = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, \
- "_mcount_ptr")); \
- \
- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
- fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix, \
- XSTR (symref, 0)); \
- fprintf (FILE, "\tcall *(%%eax)\n"); \
- } \
- \
- else \
- { \
- static int call_no = 0; \
- \
- fprintf (FILE, "\tcall %sPc%d\n", lprefix, call_no); \
- fprintf (FILE, "%sPc%d:\tpopl %%eax\n", lprefix, call_no); \
- fprintf (FILE, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-%sPc%d],%%eax\n", \
- lprefix, call_no++); \
- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%eax),%%edx\n", \
- lprefix, labelno); \
- fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n", \
- prefix); \
- fprintf (FILE, "\tcall *(%%eax)\n"); \
- } \
- } \
- \
- function_prologue (FILE, SIZE); \
- } \
-while (0)
-
-/* A C statement or compound statement to output to FILE some assembler code to
- call the profiling subroutine `mcount'. Before calling, the assembler code
- must load the address of a counter variable into a register where `mcount'
- expects to find the address. The name of this variable is `LP' followed by
- the number LABELNO, so you would generate the name using `LP%d' in a
- `fprintf'.
-
- The details of how the address should be passed to `mcount' are determined
- by your operating system environment, not by GNU CC. To figure them out,
- compile a small program for profiling using the system's installed C
- compiler and look at the assembler code that results. */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-do \
- { \
- if (!OSF_PROFILE_BEFORE_PROLOGUE) \
- { \
- char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \
- char *lprefix = LPREFIX; \
- int labelno = LABELNO; \
- \
- /* Note that OSF/rose blew it in terms of calling mcount, \
- since OSF/rose prepends a leading underscore, but mcount's \
- doesn't. At present, we keep this kludge for ELF as well \
- to allow old kernels to build profiling. */ \
- \
- if (flag_pic \
- && !current_function_uses_pic_offset_table \
- && !current_function_uses_const_pool) \
- abort (); \
- \
- if (TARGET_MCOUNT && flag_pic) \
- { \
- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
- lprefix, labelno); \
- fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \
- } \
- \
- else if (TARGET_MCOUNT && HALF_PIC_P ()) \
- { \
- rtx symdef; \
- \
- HALF_PIC_EXTERNAL ("mcount"); \
- symdef = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, "mcount")); \
- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
- fprintf (FILE, "\tcall *%s%s\n", prefix, XSTR (symdef, 0)); \
- } \
- \
- else if (TARGET_MCOUNT) \
- { \
- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
- fprintf (FILE, "\tcall %smcount\n", prefix); \
- } \
- \
- else if (flag_pic && frame_pointer_needed) \
- { \
- fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
- fprintf (FILE, "\tpushl %%ecx\n"); \
- fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
- lprefix, labelno); \
- fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n"); \
- fprintf (FILE, "\tcall *(%%eax)\n"); \
- fprintf (FILE, "\tpopl %%eax\n"); \
- } \
- \
- else if (frame_pointer_needed) \
- { \
- fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
- fprintf (FILE, "\tpushl %%ecx\n"); \
- fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
- fprintf (FILE, "\tcall *_mcount_ptr\n"); \
- fprintf (FILE, "\tpopl %%eax\n"); \
- } \
- \
- else \
- abort (); \
- } \
- } \
-while (0)
-
-/* A C function or functions which are needed in the library to
- support block profiling. When support goes into libc, undo
- the #if 0. */
-
-#if 0
-#undef BLOCK_PROFILING_CODE
-#define BLOCK_PROFILING_CODE
-#endif
-
-/* Prefix for internally generated assembler labels. If we aren't using
- underscores, we are using prefix `.'s to identify labels that should
- be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
-#undef LPREFIX
-#define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
-
-/* This is how to store into the string BUF
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".", \
- (PREFIX), (NUMBER))
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".", \
- PREFIX, NUM)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-/* target_flags is not accessible by the preprocessor */
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output a reference to a user-level label named NAME. */
-
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
-
-/* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
- i386.md for an explanation of the expression this outputs. */
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
-
-/* Output a definition */
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
-do \
-{ \
- fprintf ((FILE), "\t%s\t", SET_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, ","); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
- } \
-while (0)
-
-/* A C expression to output text to align the location counter in the
- way that is desirable at a point in the code that is reached only
- by jumping.
-
- This macro need not be defined if you don't want any special
- alignment to be done at such a time. Most machine descriptions do
- not currently define the macro. */
-
-#undef ASM_OUTPUT_ALIGN_CODE
-#define ASM_OUTPUT_ALIGN_CODE(STREAM) \
- fprintf (STREAM, "\t.align\t%d\n", \
- (!TARGET_LARGE_ALIGN && i386_align_jumps > 2) ? 2 : i386_align_jumps)
-
-/* A C expression to output text to align the location counter in the
- way that is desirable at the beginning of a loop.
-
- This macro need not be defined if you don't want any special
- alignment to be done at such a time. Most machine descriptions do
- not currently define the macro. */
-
-#undef ASM_OUTPUT_LOOP_ALIGN
-#define ASM_OUTPUT_LOOP_ALIGN(STREAM) \
- fprintf (STREAM, "\t.align\t%d\n", i386_align_loops)
-
-/* A C statement to output to the stdio stream STREAM an assembler
- command to advance the location counter to a multiple of 2 to the
- POWER bytes. POWER will be a C expression of type `int'. */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
- fprintf (STREAM, "\t.align\t%d\n", \
- (!TARGET_LARGE_ALIGN && (POWER) > 2) ? 2 : (POWER))
-
-/* A C expression that is 1 if the RTX X is a constant which is a
- valid address. On most machines, this can be defined as
- `CONSTANT_P (X)', but a few machines are more restrictive in
- which constant addresses are supported.
-
- `CONSTANT_P' accepts integer-values expressions whose values are
- not explicitly known, such as `symbol_ref', `label_ref', and
- `high' expressions and `const' arithmetic expressions, in
- addition to `const_int' and `const_double' expressions. */
-
-#define CONSTANT_ADDRESS_P_ORIG(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-#undef CONSTANT_ADDRESS_P
-#define CONSTANT_ADDRESS_P(X) \
- ((CONSTANT_ADDRESS_P_ORIG (X)) && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X)))
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#undef LEGITIMATE_CONSTANT_P
-#define LEGITIMATE_CONSTANT_P(X) \
- (!HALF_PIC_P () \
- || GET_CODE (X) == CONST_DOUBLE \
- || GET_CODE (X) == CONST_INT \
- || !HALF_PIC_ADDRESS_P (X))
-
-/* Sometimes certain combinations of command options do not make sense
- on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed. */
-
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-{ \
- /* \
- if (TARGET_ELF && TARGET_HALF_PIC) \
- { \
- target_flags &= ~MASK_HALF_PIC; \
- flag_pic = 1; \
- } \
- */ \
- \
- if (TARGET_ROSE && flag_pic) \
- { \
- target_flags |= MASK_HALF_PIC; \
- flag_pic = 0; \
- } \
- \
- if (TARGET_HALF_PIC) \
- half_pic_init (); \
-}
-
-/* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- The macro definition, if any, is executed immediately after the
- rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
- The value of the rtl will be a `mem' whose address is a
- `symbol_ref'.
-
- The usual thing for this macro to do is to a flag in the
- `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
- name string in the `symbol_ref' (if one bit is not enough
- information).
-
- The best way to modify the name string is by adding text to the
- beginning, with suitable punctuation to prevent any ambiguity.
- Allocate the new name in `saveable_obstack'. You will have to
- modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
- and output the name accordingly.
-
- You can also check the information stored in the `symbol_ref' in
- the definition of `GO_IF_LEGITIMATE_ADDRESS' or
- `PRINT_OPERAND_ADDRESS'. */
-
-#undef ENCODE_SECTION_INFO
-#define ENCODE_SECTION_INFO(DECL) \
-do \
- { \
- if (HALF_PIC_P ()) \
- HALF_PIC_ENCODE (DECL); \
- \
- else if (flag_pic) \
- { \
- rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
- = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- || ! TREE_PUBLIC (DECL)); \
- } \
- } \
-while (0)
-
-
-/* On most machines, read-only variables, constants, and jump tables
- are placed in the text section. If this is not the case on your
- machine, this macro should be defined to be the name of a function
- (either `data_section' or a function defined in `EXTRA_SECTIONS')
- that switches to the section to be used for read-only items.
-
- If these items should be placed in the text section, this macro
- should not be defined. */
-
-#if 0
-#undef READONLY_DATA_SECTION
-#define READONLY_DATA_SECTION() \
-do \
- { \
- if (TARGET_ELF) \
- { \
- if (in_section != in_rodata) \
- { \
- fprintf (asm_out_file, "\t.section \"rodata\"\n"); \
- in_section = in_rodata; \
- } \
- } \
- else \
- text_section (); \
- } \
-while (0)
-#endif
-
-/* A list of names for sections other than the standard two, which are
- `in_text' and `in_data'. You need not define this macro on a
- system with no other sections (that GCC needs to use). */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_rodata, in_data1
-
-/* Given a decl node or constant node, choose the section to output it in
- and select that section. */
-
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE, RTX) \
-do \
- { \
- if (MODE == Pmode && HALF_PIC_P () && HALF_PIC_ADDRESS_P (RTX)) \
- data_section (); \
- else \
- readonly_data_section (); \
- } \
-while (0)
-
-#undef SELECT_SECTION
-#define SELECT_SECTION(DECL, RELOC) \
-{ \
- if (RELOC && HALF_PIC_P ()) \
- data_section (); \
- \
- else if (TREE_CODE (DECL) == STRING_CST) \
- { \
- if (flag_writable_strings) \
- data_section (); \
- else \
- readonly_data_section (); \
- } \
- \
- else if (TREE_CODE (DECL) != VAR_DECL) \
- readonly_data_section (); \
- \
- else if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
- || !DECL_INITIAL (DECL) \
- || (DECL_INITIAL (DECL) != error_mark_node \
- && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
- data_section (); \
- \
- else \
- readonly_data_section (); \
-}
-
-
-/* Define the strings used for the special svr4 .type and .size directives.
- These strings generally do not vary from one system running svr4 to
- another, but if a given system (e.g. m88k running svr) needs to use
- different pseudo-op names for these, they may be overridden in the
- file which includes this one. */
-
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-#define SET_ASM_OP ".set"
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#define ASM_WEAKEN_LABEL(FILE,NAME) \
- do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
- fputc ('\n', FILE); } while (0)
-
-/* The following macro defines the format used to output the second
- operand of the .type assembler directive. Different svr4 assemblers
- expect various different forms for this operand. The one given here
- is just a default. You may need to override it in your machine-
- specific tm.h file (depending upon the particulars of your assembler). */
-
-#define TYPE_OPERAND_FMT "@%s"
-
-/* A C statement (sans semicolon) to output to the stdio stream
- STREAM any text necessary for declaring the name NAME of an
- initialized variable which is being defined. This macro must
- output the label definition (perhaps using `ASM_OUTPUT_LABEL').
- The argument DECL is the `VAR_DECL' tree node representing the
- variable.
-
- If this macro is not defined, then the variable name is defined
- in the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
-
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
-do \
- { \
- ASM_OUTPUT_LABEL(STREAM,NAME); \
- HALF_PIC_DECLARE (NAME); \
- if (TARGET_ELF) \
- { \
- fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (STREAM, NAME); \
- putc (',', STREAM); \
- fprintf (STREAM, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', STREAM); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (STREAM, NAME); \
- fprintf (STREAM, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } \
- } \
-while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (TARGET_ELF \
- && !flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } while (0)
-
-/* This is how to declare a function name. */
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
-do \
- { \
- ASM_OUTPUT_LABEL(STREAM,NAME); \
- HALF_PIC_DECLARE (NAME); \
- if (TARGET_ELF) \
- { \
- fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (STREAM, NAME); \
- putc (',', STREAM); \
- fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', STREAM); \
- ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \
- } \
- } \
-while (0)
-
-/* Write the extra assembler code needed to declare a function's result.
- Most svr4 assemblers don't require any special declaration of the
- result value, but there are exceptions. */
-
-#ifndef ASM_DECLARE_RESULT
-#define ASM_DECLARE_RESULT(FILE, RESULT)
-#endif
-
-/* This is how to declare the size of a function. */
-
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
-do \
- { \
- if (TARGET_ELF && !flag_inhibit_size_directive) \
- { \
- char label[256]; \
- static int labelno; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ","); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } \
-while (0)
-
-/* Attach a special .ident directive to the end of the file to identify
- the version of GCC which compiled this code. The format of the
- .ident string is patterned after the ones produced by native svr4
- C compilers. */
-
-#define IDENT_ASM_OP ".ident"
-
-/* Allow #sccs in preprocessor. */
-
-#define SCCS_DIRECTIVE
-
-/* This says what to print at the end of the assembly file */
-#define ASM_FILE_END(STREAM) \
-do \
- { \
- if (HALF_PIC_P ()) \
- HALF_PIC_FINISH (STREAM); \
- \
- if (TARGET_IDENT) \
- { \
- char *fstart = main_input_filename; \
- char *fname; \
- \
- if (!fstart) \
- fstart = "<no file>"; \
- \
- fname = fstart + strlen (fstart) - 1; \
- while (fname > fstart && *fname != '/') \
- fname--; \
- \
- if (*fname == '/') \
- fname++; \
- \
- fprintf ((STREAM), "\t%s\t\"GCC: (GNU) %s %s -O%d", \
- IDENT_ASM_OP, version_string, fname, optimize); \
- \
- if (write_symbols == PREFERRED_DEBUGGING_TYPE) \
- fprintf ((STREAM), " -g%d", (int)debug_info_level); \
- \
- else if (write_symbols == DBX_DEBUG) \
- fprintf ((STREAM), " -gstabs%d", (int)debug_info_level); \
- \
- else if (write_symbols == DWARF_DEBUG) \
- fprintf ((STREAM), " -gdwarf%d", (int)debug_info_level); \
- \
- else if (write_symbols != NO_DEBUG) \
- fprintf ((STREAM), " -g??%d", (int)debug_info_level); \
- \
- if (flag_omit_frame_pointer) \
- fprintf ((STREAM), " -fomit-frame-pointer"); \
- \
- if (flag_strength_reduce) \
- fprintf ((STREAM), " -fstrength-reduce"); \
- \
- if (flag_unroll_loops) \
- fprintf ((STREAM), " -funroll-loops"); \
- \
- if (flag_schedule_insns) \
- fprintf ((STREAM), " -fschedule-insns"); \
- \
- if (flag_schedule_insns_after_reload) \
- fprintf ((STREAM), " -fschedule-insns2"); \
- \
- if (flag_force_mem) \
- fprintf ((STREAM), " -fforce-mem"); \
- \
- if (flag_force_addr) \
- fprintf ((STREAM), " -fforce-addr"); \
- \
- if (flag_inline_functions) \
- fprintf ((STREAM), " -finline-functions"); \
- \
- if (flag_caller_saves) \
- fprintf ((STREAM), " -fcaller-saves"); \
- \
- if (flag_pic) \
- fprintf ((STREAM), (flag_pic > 1) ? " -fPIC" : " -fpic"); \
- \
- if (flag_inhibit_size_directive) \
- fprintf ((STREAM), " -finhibit-size-directive"); \
- \
- if (flag_gnu_linker) \
- fprintf ((STREAM), " -fgnu-linker"); \
- \
- if (profile_flag) \
- fprintf ((STREAM), " -p"); \
- \
- if (profile_block_flag) \
- fprintf ((STREAM), " -a"); \
- \
- if (TARGET_IEEE_FP) \
- fprintf ((STREAM), " -mieee-fp"); \
- \
- if (TARGET_HALF_PIC) \
- fprintf ((STREAM), " -mhalf-pic"); \
- \
- if (!TARGET_MOVE) \
- fprintf ((STREAM), " -mno-move"); \
- \
- if (TARGET_386) \
- fprintf ((STREAM), " -m386"); \
- \
- else if (TARGET_486) \
- fprintf ((STREAM), " -m486"); \
- \
- else \
- fprintf ((STREAM), " -munknown-machine"); \
- \
- fprintf ((STREAM), (TARGET_ELF) ? " -melf\"\n" : " -mrose\"\n"); \
- } \
- } \
-while (0)
-
-/* Tell collect that the object format is OSF/rose. */
-#define OBJECT_FORMAT_ROSE
-
-/* Tell collect where the appropriate binaries are. */
-#define REAL_NM_FILE_NAME "/usr/ccs/gcc/bfd-nm"
-#define REAL_STRIP_FILE_NAME "/usr/ccs/bin/strip"
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* Define this macro meaning that gcc should find the library 'libgcc.a'
- by hand, rather than passing the argument '-lgcc' to tell the linker
- to do the search */
-#define LINK_LIBGCC_SPECIAL
-
-/* A C statement to output assembler commands which will identify the object
- file as having been compile with GNU CC. We don't need or want this for
- OSF1. GDB doesn't need it and kdb doesn't like it */
-#define ASM_IDENTIFY_GCC(FILE)
-
-/* Identify the front-end which produced this file. To keep symbol
- space down, and not confuse kdb, only do this if the language is
- not C. */
-
-#define ASM_IDENTIFY_LANGUAGE(STREAM) \
-{ \
- if (strcmp (lang_identify (), "c") != 0) \
- output_lang_identify (STREAM); \
-}
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Map i386 registers to the numbers dwarf expects. Of course this is different
- from what stabs expects. */
-
-#define DWARF_DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 \
- : (n) == 1 ? 2 \
- : (n) == 2 ? 1 \
- : (n) == 3 ? 3 \
- : (n) == 4 ? 6 \
- : (n) == 5 ? 7 \
- : (n) == 6 ? 5 \
- : (n) == 7 ? 4 \
- : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
- : (-1))
-
-/* Now what stabs expects in the register. */
-#define STABS_DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 : \
- (n) == 1 ? 2 : \
- (n) == 2 ? 1 : \
- (n) == 3 ? 3 : \
- (n) == 4 ? 6 : \
- (n) == 5 ? 7 : \
- (n) == 6 ? 4 : \
- (n) == 7 ? 5 : \
- (n) + 4)
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG) \
- ? DWARF_DBX_REGISTER_NUMBER(n) \
- : STABS_DBX_REGISTER_NUMBER(n))
diff --git a/gcc/config/i386/perform.h b/gcc/config/i386/perform.h
deleted file mode 100644
index 8d6d0b71dfe..00000000000
--- a/gcc/config/i386/perform.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Definitions for AT&T assembler syntax for the Intel 80386.
- Copyright (C) 1993 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. */
-
-/* Defines to be able to build libgcc.a with GCC. */
-
-/* It might seem that these are not important, since gcc 2 will never
- call libgcc for these functions. But programs might be linked with
- code compiled by gcc 1, and then these will be used. */
-
-/* The arg names used to be a and b, but `a' appears inside strings
- and that confuses non-ANSI cpp. */
-
-#define perform_udivsi3(arg0,arg1) \
-{ \
- register int dx asm("dx"); \
- register int ax asm("ax"); \
- \
- dx = 0; \
- ax = arg0; \
- asm ("divl %3" : "=a" (ax), "=d" (dx) : "a" (ax), "g" (arg1), "d" (dx)); \
- return ax; \
-}
-
-#define perform_divsi3(arg0,arg1) \
-{ \
- register int dx asm("dx"); \
- register int ax asm("ax"); \
- register int cx asm("cx"); \
- \
- ax = arg0; \
- cx = arg1; \
- asm ("cltd\n\tidivl %3" : "=a" (ax), "=&d" (dx) : "a" (ax), "c" (cx)); \
- return ax; \
-}
-
-#define perform_umodsi3(arg0,arg1) \
-{ \
- register int dx asm("dx"); \
- register int ax asm("ax"); \
- \
- dx = 0; \
- ax = arg0; \
- asm ("divl %3" : "=a" (ax), "=d" (dx) : "a" (ax), "g" (arg1), "d" (dx)); \
- return dx; \
-}
-
-#define perform_modsi3(arg0,arg1) \
-{ \
- register int dx asm("dx"); \
- register int ax asm("ax"); \
- register int cx asm("cx"); \
- \
- ax = arg0; \
- cx = arg1; \
- asm ("cltd\n\tidivl %3" : "=a" (ax), "=&d" (dx) : "a" (ax), "c" (cx)); \
- return dx; \
-}
-
-#define perform_fixdfsi(arg0) \
-{ \
- auto unsigned short ostatus; \
- auto unsigned short nstatus; \
- auto int ret; \
- auto double tmp; \
- \
- &ostatus; /* guarantee these land in memory */ \
- &nstatus; \
- &ret; \
- &tmp; \
- \
- asm volatile ("fnstcw %0" : "=m" (ostatus)); \
- nstatus = ostatus | 0x0c00; \
- asm volatile ("fldcw %0" : /* no outputs */ : "m" (nstatus)); \
- tmp = arg0; \
- asm volatile ("fldl %0" : /* no outputs */ : "m" (tmp)); \
- asm volatile ("fistpl %0" : "=m" (ret)); \
- asm volatile ("fldcw %0" : /* no outputs */ : "m" (ostatus)); \
- \
- return ret; \
-}
-
diff --git a/gcc/config/i386/ptx4-i.h b/gcc/config/i386/ptx4-i.h
deleted file mode 100644
index fdf21a471f1..00000000000
--- a/gcc/config/i386/ptx4-i.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/* Target definitions for GNU compiler for Intel 80386 running Dynix/ptx v4
- Copyright (C) 1996 Free Software Foundation, Inc.
-
- Modified from sysv4.h
- Originally written by Ron Guilmette (rfg@netcom.com).
- Modified by Tim Wright (timw@sequent.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 "i386/i386.h" /* Base i386 target machine definitions */
-#include "i386/att.h" /* Use the i386 AT&T assembler syntax */
-#include "ptx4.h" /* Rest of definitions (non architecture dependent) */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i386 Sequent Dynix/ptx Version 4)");
-
-/* The svr4 ABI for the i386 says that records and unions are returned
- in memory. */
-
-#undef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE (TYPE) == BLKmode)
-
-/* Define which macros to predefine. _SEQUENT_ is our extension. */
-/* This used to define X86, but james@bigtex.cactus.org says that
- is supposed to be defined optionally by user programs--not by default. */
-#define CPP_PREDEFINES \
- "-Di386 -Dunix -D_SEQUENT_ -Asystem(unix) -Asystem(ptx4) -Acpu(i386) -Amachine(i386)"
-
-/* This is how to output assembly code to define a `float' constant.
- We always have to use a .long pseudo-op to do this because the native
- SVR4 ELF assembler is buggy and it generates incorrect values when we
- try to use the .float pseudo-op instead. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long value; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value); \
- if (sizeof (int) == sizeof (long)) \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value); \
- else \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value); \
- } while (0)
-
-/* This is how to output assembly code to define a `double' constant.
- We always have to use a pair of .long pseudo-ops to do this because
- the native SVR4 ELF assembler is buggy and it generates incorrect
- values when we try to use the the .double pseudo-op instead. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long value[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value); \
- if (sizeof (int) == sizeof (long)) \
- { \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \
- } \
- else \
- { \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \
- } \
- } while (0)
-
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long value[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value); \
- if (sizeof (int) == sizeof (long)) \
- { \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[2]); \
- } \
- else \
- { \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[2]); \
- } \
- } while (0)
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- output_file_directive (FILE, main_input_filename); \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- } while (0)
-
-/* Define the register numbers to be used in Dwarf debugging information.
- The SVR4 reference port C compiler uses the following register numbers
- in its Dwarf output code:
-
- 0 for %eax (gnu regno = 0)
- 1 for %ecx (gnu regno = 2)
- 2 for %edx (gnu regno = 1)
- 3 for %ebx (gnu regno = 3)
- 4 for %esp (gnu regno = 7)
- 5 for %ebp (gnu regno = 6)
- 6 for %esi (gnu regno = 4)
- 7 for %edi (gnu regno = 5)
-
- The following three DWARF register numbers are never generated by
- the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
- believes these numbers have these meanings.
-
- 8 for %eip (no gnu equivalent)
- 9 for %eflags (no gnu equivalent)
- 10 for %trapno (no gnu equivalent)
-
- It is not at all clear how we should number the FP stack registers
- for the x86 architecture. If the version of SDB on x86/svr4 were
- a bit less brain dead with respect to floating-point then we would
- have a precedent to follow with respect to DWARF register numbers
- for x86 FP registers, but the SDB on x86/svr4 is so completely
- broken with respect to FP registers that it is hardly worth thinking
- of it as something to strive for compatibility with.
-
- The version of x86/svr4 SDB I have at the moment does (partially)
- seem to believe that DWARF register number 11 is associated with
- the x86 register %st(0), but that's about all. Higher DWARF
- register numbers don't seem to be associated with anything in
- particular, and even for DWARF regno 11, SDB only seems to under-
- stand that it should say that a variable lives in %st(0) (when
- asked via an `=' command) if we said it was in DWARF regno 11,
- but SDB still prints garbage when asked for the value of the
- variable in question (via a `/' command).
-
- (Also note that the labels SDB prints for various FP stack regs
- when doing an `x' command are all wrong.)
-
- Note that these problems generally don't affect the native SVR4
- C compiler because it doesn't allow the use of -O with -g and
- because when it is *not* optimizing, it allocates a memory
- location for each floating-point variable, and the memory
- location is what gets described in the DWARF AT_location
- attribute for the variable in question.
-
- Regardless of the severe mental illness of the x86/svr4 SDB, we
- do something sensible here and we use the following DWARF
- register numbers. Note that these are all stack-top-relative
- numbers.
-
- 11 for %st(0) (gnu regno = 8)
- 12 for %st(1) (gnu regno = 9)
- 13 for %st(2) (gnu regno = 10)
- 14 for %st(3) (gnu regno = 11)
- 15 for %st(4) (gnu regno = 12)
- 16 for %st(5) (gnu regno = 13)
- 17 for %st(6) (gnu regno = 14)
- 18 for %st(7) (gnu regno = 15)
-*/
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 \
- : (n) == 1 ? 2 \
- : (n) == 2 ? 1 \
- : (n) == 3 ? 3 \
- : (n) == 4 ? 6 \
- : (n) == 5 ? 7 \
- : (n) == 6 ? 5 \
- : (n) == 7 ? 4 \
- : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
- : (-1))
-
-/* The routine used to output sequences of byte values. We use a special
- version of this for most svr4 targets because doing so makes the
- generated assembly code more compact (and thus faster to assemble)
- as well as more readable. Note that if we find subparts of the
- character sequence which end with NUL (and which are shorter than
- STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
- do \
- { \
- register unsigned char *_ascii_bytes = (unsigned char *) (STR); \
- register unsigned char *limit = _ascii_bytes + (LENGTH); \
- register unsigned bytes_in_chunk = 0; \
- for (; _ascii_bytes < limit; _ascii_bytes++) \
- { \
- register unsigned char *p; \
- if (bytes_in_chunk >= 64) \
- { \
- fputc ('\n', (FILE)); \
- bytes_in_chunk = 0; \
- } \
- for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
- continue; \
- if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
- { \
- if (bytes_in_chunk > 0) \
- { \
- fputc ('\n', (FILE)); \
- bytes_in_chunk = 0; \
- } \
- ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
- _ascii_bytes = p; \
- } \
- else \
- { \
- if (bytes_in_chunk == 0) \
- fprintf ((FILE), "\t.byte\t"); \
- else \
- fputc (',', (FILE)); \
- fprintf ((FILE), "0x%02x", *_ascii_bytes); \
- bytes_in_chunk += 5; \
- } \
- } \
- if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\n"); \
- } \
- while (0)
-
-/* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
- i386.md for an explanation of the expression this outputs. */
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
-
-/* Indicate that jump tables go in the text section. This is
- necessary when compiling PIC code. */
-
-#define JUMP_TABLES_IN_TEXT_SECTION
diff --git a/gcc/config/i386/rtems.h b/gcc/config/i386/rtems.h
deleted file mode 100644
index 99c817a14d7..00000000000
--- a/gcc/config/i386/rtems.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Definitions for rtems targetting an Intel i386 using coff.
-
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Joel Sherrill (joel@OARcorp.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 "i386/i386-coff.h"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di386 -Drtems -D__rtems__ \
- -Asystem(rtems) -Acpu(i386) -Amachine(i386)"
-
-/* end of i386-rtems.h */
diff --git a/gcc/config/i386/sco.h b/gcc/config/i386/sco.h
deleted file mode 100644
index 9c94a766a83..00000000000
--- a/gcc/config/i386/sco.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Definitions for Intel 386 running SCO Unix System V.
- Copyright (C) 1988, 1992, 1994, 1995 Free, 1996 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. */
-
-/* Mostly it's like AT&T Unix System V. */
-
-#include "i386/sysv3.h"
-
-/* By default, target has a 80387, uses IEEE compatible arithmetic,
- and returns float values in the 387, ie,
- (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387)
-
- SCO's software emulation of a 387 fails to handle the `fucomp'
- opcode. fucomp is only used when generating IEEE compliant code.
- So don't make TARGET_IEEE_FP default for SCO. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0201
-
-/* Let's guess that the SCO software FPU emulator can't handle
- 80-bit XFmode insns, so don't generate them. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} crtbegin.o%s"
-
-#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
-
-/* Library spec, including SCO international language support. */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} %{scointl:libintl.a%s} -lc"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -DM_UNIX -DM_I386 -DM_COFF -DM_WORDSWAP -Asystem(svr3)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{scointl:-DM_INTERNAT}"
-
-/* This spec is used for telling cpp whether char is signed or not. */
-
-#undef SIGNED_CHAR_SPEC
-#if DEFAULT_SIGNED_CHAR
-#define SIGNED_CHAR_SPEC \
- "%{funsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}"
-#else
-#define SIGNED_CHAR_SPEC \
- "%{!fsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}"
-#endif
-
-/* Use atexit for static destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* Specify the size_t type. */
-#define SIZE_TYPE "unsigned int"
-
-#if 0 /* Not yet certain whether this is needed. */
-/* If no 387, use the general regs to return floating values,
- since this system does not emulate the 80387. */
-
-#undef VALUE_REGNO
-#define VALUE_REGNO(MODE) \
- ((TARGET_80387
- && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)
- ? FIRST_FLOAT_REG : 0)
-
-#undef HARD_REGNO_MODE_OK
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((REGNO) < 2 ? 1 \
- : (REGNO) < 4 ? 1 \
- : FP_REGNO_P (REGNO) ? ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
- && TARGET_80387 \
- && GET_MODE_UNIT_SIZE (MODE) <= 8) \
- : (MODE) != QImode)
-#endif
-
-/* caller has to pop the extra argument passed to functions that return
- structures. */
-
-#undef RETURN_POPS_ARGS
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE ? 0 \
- : (TARGET_RTD \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) ? (SIZE) \
- : 0)
-/* On other 386 systems, the last line looks like this:
- : (aggregate_value_p (TREE_TYPE (FUNTYPE))) ? GET_MODE_SIZE (Pmode) : 0) */
-
-/* Handle #pragma pack. */
-#define HANDLE_SYSV_PRAGMA
diff --git a/gcc/config/i386/sco4.h b/gcc/config/i386/sco4.h
deleted file mode 100644
index 1b17d674cd5..00000000000
--- a/gcc/config/i386/sco4.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 4.
- Written by Chip Salzenberg.
- Copyright (C) 1992, 1994 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. */
-
-
-/* Mostly it's like earlier SCO UNIX. */
-
-#include "i386/sco.h"
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{scoxpg3:%{p:mcrt1X.o%s}%{!p:crt1X.o%s}} \
- %{!scoxpg3:\
- %{posix:%{p:mcrt1P.o%s}%{!p:crt1P.o%s}} \
- %{!posix:\
- %{ansi:%{p:mcrt1A.o%s}%{!p:crt1A.o%s}} \
- %{!ansi:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}} \
- crtbegin.o%s"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "crtend.o%s \
- %{scoxpg3:crtnX.o%s} \
- %{!scoxpg3:\
- %{posix:crtnP.o%s} \
- %{!posix:\
- %{ansi:crtnA.o%s} \
- %{!ansi:crtn.o%s}}}"
-
-/* Library spec. */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} \
- %{scoxpg3:-lcX -lcP -lcA} \
- %{!scoxpg3:\
- %{posix:-lcP -lcA} \
- %{!posix:\
- %{ansi:-lcA} \
- %{!ansi:%{scointl:-lintl} -lc}}}"
-
-/* Macros, macros everywhere:
- Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Asystem(svr3)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] \
- -D_i386 -D_M_I386 -D_M_I86 -D_M_I86SM -D_M_SDATA -D_M_STEXT \
- -D_unix -D_M_UNIX -D_M_XENIX \
- -D_M_SYS5 -D_M_SYSV -D_M_SYS3 -D_M_SYSIII \
- -D_M_COFF -D_M_BITFIELDS -D_M_WORDSWAP \
- %{scoxpg3:-D_XOPEN_SOURCE -D_STRICT_NAMES} \
- %{!scoxpg3:%{posix:-D_POSIX_SOURCE -D_STRICT_NAMES}} \
- %{!scoxpg3:%{!posix:\
- %{ansi:-D_STRICT_NAMES}%{!ansi:\
- -Di386 -DM_I386 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
- -Dunix -DM_UNIX -DM_XENIX \
- -DM_SYS5 -DM_SYSV -DM_SYS3 -DM_SYSIII \
- -DM_COFF -DM_BITFIELDS -DM_WORDSWAP \
- %{scointl:-D_M_INTERNAT -DM_INTERNAT} \
- %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE}}}}"
-
-/* The system headers are C++-aware. */
-#define NO_IMPLICIT_EXTERN_C
diff --git a/gcc/config/i386/sco4dbx.h b/gcc/config/i386/sco4dbx.h
deleted file mode 100644
index 6ff5714c56b..00000000000
--- a/gcc/config/i386/sco4dbx.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 4.s,
- using dbx-in-coff encapsulation.
- Copyright (C) 1992 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. */
-
-
-/* Mostly it's like earlier SCO UNIX. */
-
-#include "i386/scodbx.h"
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!r:%{!z:gcc.ifile%s}%{z:gccz.ifile%s}}\
- %{scoxpg3:%{p:mcrt1X.o%s}%{!p:crt1X.o%s}} \
- %{!scoxpg3:\
- %{posix:%{p:mcrt1P.o%s}%{!p:crt1P.o%s}} \
- %{!posix:\
- %{ansi:%{p:mcrt1A.o%s}%{!p:crt1A.o%s}} \
- %{!ansi:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "%{scoxpg3:crtnX.o%s} \
- %{!scoxpg3:\
- %{posix:crtnP.o%s} \
- %{!posix:\
- %{ansi:crtnA.o%s} \
- %{!ansi:crtn.o%s}}}"
-
-/* Library spec. */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} \
- %{scoxpg3:-lcX -lcP -lcA} \
- %{!scoxpg3:\
- %{posix:-lcP -lcA} \
- %{!posix:\
- %{ansi:-lcA} \
- %{!ansi:%{scointl:-lintl} -lc}}}"
-
-/* Macros, macros everywhere:
- Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Asystem(svr3)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] \
- -D_M_I386 -D_M_I86 -D_M_I86SM -D_M_SDATA -D_M_STEXT \
- -D_M_UNIX -D_M_XENIX \
- -D_M_SYS5 -D_M_SYSV -D_M_SYS3 -D_M_SYSIII \
- -D_M_COFF -D_M_BITFIELDS -D_M_WORDSWAP \
- %{scoxpg3:-D_XOPEN_SOURCE -D_STRICT_NAMES} \
- %{!scoxpg3:%{posix:-D_POSIX_SOURCE -D_STRICT_NAMES}} \
- %{!scoxpg3:%{!posix:\
- %{ansi:-D_STRICT_NAMES}%{!ansi:\
- -DM_I386 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
- -DM_UNIX -DM_XENIX \
- -DM_SYS5 -DM_SYSV -DM_SYS3 -DM_SYSIII \
- -DM_COFF -DM_BITFIELDS -DM_WORDSWAP \
- %{scointl:-D_M_INTERNAT -DM_INTERNAT} \
- %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE}}}}"
diff --git a/gcc/config/i386/sco5.h b/gcc/config/i386/sco5.h
deleted file mode 100644
index d156cab601e..00000000000
--- a/gcc/config/i386/sco5.h
+++ /dev/null
@@ -1,920 +0,0 @@
-/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5.
- Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Kean Johnston (hug@netcom.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 "i386/i386.h" /* Base i386 target definitions */
-#include "i386/att.h" /* Use AT&T i386 assembler syntax */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)");
-
-#undef LPREFIX
-#define LPREFIX ".L"
-
-#undef ALIGN_ASM_OP
-#define ALIGN_ASM_OP "\t.align"
-
-#undef ASCII_DATA_ASM_OP
-#define ASCII_DATA_ASM_OP "\t.ascii"
-
-#undef ASM_BYTE_OP
-#define ASM_BYTE_OP "\t.byte"
-
-#undef IDENT_ASM_OP
-#define IDENT_ASM_OP "\t.ident"
-
-#undef COMMON_ASM_OP
-#define COMMON_ASM_OP "\t.comm"
-
-#undef SET_ASM_OP
-#define SET_ASM_OP "\t.set"
-
-#undef LOCAL_ASM_OP
-#define LOCAL_ASM_OP "\t.local"
-
-#undef INT_ASM_OP
-#define INT_ASM_OP "\t.long"
-
-#undef ASM_SHORT
-#define ASM_SHORT "\t.value"
-
-#undef ASM_LONG
-#define ASM_LONG "\t.long"
-
-#undef ASM_DOUBLE
-#define ASM_DOUBLE "\t.double"
-
-#undef TYPE_ASM_OP
-#define TYPE_ASM_OP "\t.type"
-
-#undef SIZE_ASM_OP
-#define SIZE_ASM_OP "\t.size"
-
-#undef STRING_ASM_OP
-#define STRING_ASM_OP "\t.string"
-
-#undef SKIP_ASM_OP
-#define SKIP_ASM_OP "\t.zero"
-
-#undef GLOBAL_ASM_OP
-#define GLOBAL_ASM_OP "\t.globl"
-
-#undef CONST_SECTION_ASM_OP
-#define CONST_SECTION_ASM_OP_COFF "\t.section\t.rodata, \"x\""
-#define CONST_SECTION_ASM_OP_ELF "\t.section\t.rodata"
-#define CONST_SECTION_ASM_OP \
- ((TARGET_ELF) ? CONST_SECTION_ASM_OP_ELF : CONST_SECTION_ASM_OP_COFF)
-
-#undef USE_CONST_SECTION
-#define USE_CONST_SECTION_ELF 1
-#define USE_CONST_SECTION_COFF 0
-#define USE_CONST_SECTION \
- ((TARGET_ELF) ? USE_CONST_SECTION_ELF : USE_CONST_SECTION_COFF)
-
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP_ELF "\t.section\t.init"
-#define INIT_SECTION_ASM_OP_COFF "\t.section\t.init ,\"x\""
-#define INIT_SECTION_ASM_OP \
- ((TARGET_ELF) ? INIT_SECTION_ASM_OP_ELF : INIT_SECTION_ASM_OP_COFF)
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP_ELF "\t.section\t.ctors,\"aw\""
-#define CTORS_SECTION_ASM_OP_COFF INIT_SECTION_ASM_OP_COFF
-#define CTORS_SECTION_ASM_OP \
- ((TARGET_ELF) ? CTORS_SECTION_ASM_OP_ELF : CTORS_SECTION_ASM_OP_COFF)
-
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP_ELF "\t.section\t.dtors, \"aw\""
-#define DTORS_SECTION_ASM_OP_COFF FINI_SECTION_ASM_OP_COFF
-#define DTORS_SECTION_ASM_OP \
- ((TARGET_ELF) ? DTORS_SECTION_ASM_OP_ELF : DTORS_SECTION_ASM_OP_COFF)
-
-#undef FINI_SECTION_ASM_OP
-#define FINI_SECTION_ASM_OP_ELF "\t.section\t.fini"
-#define FINI_SECTION_ASM_OP_COFF "\t.section\t.fini, \"x\""
-#define FINI_SECTION_ASM_OP \
- ((TARGET_ELF) ? FINI_SECTION_ASM_OP_ELF : FINI_SECTION_ASM_OP_COFF)
-
-#undef BSS_SECTION_ASM_OP
-#define BSS_SECTION_ASM_OP "\t.data"
-
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP "\t.text"
-
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP "\t.data"
-
-#undef TYPE_OPERAND_FMT
-#define TYPE_OPERAND_FMT "@%s"
-
-#undef APPLY_RESULT_SIZE
-#define APPLY_RESULT_SIZE \
-(TARGET_ELF) ? size : 116
-
-#ifndef ASM_DECLARE_RESULT
-#define ASM_DECLARE_RESULT(FILE, RESULT)
-#endif
-
-#define SCO_DEFAULT_ASM_COFF(FILE,NAME) \
-do { \
- ASM_OUTPUT_LABEL (FILE, NAME); \
- } while (0)
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { \
- if (TARGET_ELF) { \
- fprintf (FILE, "%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } else \
- SCO_DEFAULT_ASM_COFF(FILE, NAME); \
-} while (0)
-
-#undef ASM_DECLARE_FUNCTION_SIZE
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
- do { \
- if (TARGET_ELF) { if (!flag_inhibit_size_directive) \
- { \
- fprintf (FILE, "%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ",.-"); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } } \
- } while (0)
-
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do { \
- if (TARGET_ELF) { \
- fprintf (FILE, "%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', FILE); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } else \
- SCO_DEFAULT_ASM_COFF(FILE, NAME); \
- } while (0)
-
-#undef ASM_FILE_START_1
-#define ASM_FILE_START_1(FILE)
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-do { \
- output_file_directive((FILE),main_input_filename); \
- fprintf ((FILE), "\t.version\t\"01.01\"\n"); \
-} while (0)
-
-#undef ASM_FILE_END
-#define ASM_FILE_END(FILE) \
-do { \
- fprintf ((FILE), "%s\t\"GCC: (GNU) %s\"\n", \
- IDENT_ASM_OP, version_string); \
-} while (0)
-
-#undef ASM_FINISH_DECLARE_OBJECT
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- if (TARGET_ELF) { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } \
-} while (0)
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
-do { \
- if (TARGET_ELF) \
- sprintf (LABEL, "*.%s%d", (PREFIX), (NUM)); \
- else \
- sprintf (LABEL, ".%s%d", (PREFIX), (NUM)); \
-} while (0)
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
-do { \
- if (TARGET_ELF) \
- fprintf (FILE, "%s _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", ASM_LONG, LPREFIX, VALUE); \
- else \
- fprintf (FILE, "\t.word %s%d-%s%d\n", LPREFIX,VALUE,LPREFIX,REL); \
-} while (0)
-
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "%s\t", COMMON_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- if (TARGET_ELF) \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
- else \
- fprintf ((FILE), ",%u\n", (SIZE)); \
-} while (0)
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- if (TARGET_ELF) { \
- fprintf ((FILE), "%s\t", LOCAL_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), "\n"); \
- ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
- } else { \
- int align = exact_log2 (ALIGN); \
- if (align > 2) align = 2; \
- if (TARGET_SVR3_SHLIB) \
- data_section (); \
- else \
- bss_section (); \
- ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
- fprintf ((FILE), "%s\t", "\t.lcomm"); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u\n", (SIZE)); \
- } \
-} while (0)
-
-#undef ESCAPES
-#define ESCAPES \
-"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
-
-#undef STRING_LIMIT
-#define STRING_LIMIT ((unsigned) 256)
-
-#undef ASM_OUTPUT_LIMITED_STRING
-#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
- do \
- { \
- register unsigned char *_limited_str = (unsigned char *) (STR); \
- register unsigned ch; \
- fprintf ((FILE), "%s\t\"", STRING_ASM_OP); \
- for (; ch = *_limited_str; _limited_str++) \
- { \
- register int escape; \
- switch (escape = ESCAPES[ch]) \
- { \
- case 0: \
- putc (ch, (FILE)); \
- break; \
- case 1: \
- fprintf ((FILE), "\\%03o", ch); \
- break; \
- default: \
- putc ('\\', (FILE)); \
- putc (escape, (FILE)); \
- break; \
- } \
- } \
- fprintf ((FILE), "\"\n"); \
- } \
- while (0)
-
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
-do { \
- register unsigned char *_ascii_bytes = (unsigned char *) (STR); \
- register unsigned char *limit = _ascii_bytes + (LENGTH); \
- register unsigned bytes_in_chunk = 0; \
- for (; _ascii_bytes < limit; _ascii_bytes++) \
- { \
- register unsigned char *p; \
- if (bytes_in_chunk >= 64) \
- { \
- fputc ('\n', (FILE)); \
- bytes_in_chunk = 0; \
- } \
- for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
- continue; \
- if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
- { \
- if (bytes_in_chunk > 0) \
- { \
- fputc ('\n', (FILE)); \
- bytes_in_chunk = 0; \
- } \
- ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
- _ascii_bytes = p; \
- } \
- else \
- { \
- if (bytes_in_chunk == 0) \
- fprintf ((FILE), "%s\t", ASM_BYTE_OP); \
- else \
- fputc (',', (FILE)); \
- fprintf ((FILE), "0x%02x", *_ascii_bytes); \
- bytes_in_chunk += 5; \
- } \
- } \
- if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\n"); \
-} while (0)
-
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
-do { \
- if (TARGET_ELF) \
- ASM_OUTPUT_ALIGN ((FILE), 2); \
- ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \
-} while (0)
-
-
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
-do { \
- if (TARGET_ELF) { \
- ctors_section (); \
- fprintf (FILE, "%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } else { \
- init_section (); \
- fprintf (FILE, "\tpushl $"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); } \
- } while (0)
-
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
-do { \
- if (TARGET_ELF) { \
- dtors_section (); \
- fprintf (FILE, "%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } else { \
- fini_section (); \
- fprintf (FILE, "%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); } \
- } while (0)
-
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { \
- long value[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value); \
- if (TARGET_ELF) { \
- if (sizeof (int) == sizeof (long)) \
- { \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \
- } \
- else \
- { \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \
- } \
- } else { \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "%s 0x%x,0x%x\n", ASM_LONG, value[0], value[1]); \
- else \
- fprintf (FILE, "%s 0x%lx,0x%lx\n", ASM_LONG,value[0],value[1]);} \
-} while (0)
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { \
- long value; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value); \
- if (sizeof (int) == sizeof (long)) \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value); \
- else \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value); \
-} while (0)
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { \
- long l[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), l); \
- if (TARGET_ELF) { \
- if (sizeof (int) == sizeof (long)) \
- { \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, l[0]); \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, l[1]); \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, l[2]); \
- } \
- else \
- { \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, l[0]); \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, l[1]); \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, l[2]); \
- } \
- } else { \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "%s 0x%x,0x%x,0x%x\n", ASM_LONG, l[0], l[1], l[2]); \
- else \
- fprintf (FILE, "%s 0x%lx,0x%lx,0x%lx\n", ASM_LONG,l[0],l[1],l[2]);} \
-} while (0)
-
-#undef ASM_OUTPUT_IDENT
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf (FILE, "%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
-
-#undef ASM_GLOBALIZE_LABEL
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- (fprintf ((FILE), "%s ", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE))
-
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
- if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
-do { \
- char *snam = NAME ; \
- if (strcmp(NAME, ".gcc_except_table") == 0) snam = ".gccexc" ; \
- if (TARGET_ELF) \
- fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
- (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
- (DECL) && TREE_READONLY (DECL) ? "a" : "aw"); \
- else \
- fprintf (FILE, ".section\t%s,\"%s\"\n", snam, \
- (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "x" : \
- (DECL) && TREE_READONLY (DECL) ? "a" : "w"); \
-} while (0)
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
-do { \
- if (TARGET_ELF) \
- fprintf (FILE, "%s\t%u\n", SKIP_ASM_OP, (SIZE)); \
- else \
- fprintf ((FILE), "%s\t.,.+%u\n", SET_ASM_OP, (SIZE)); \
-} while (0)
-
-
-#undef CTOR_LIST_BEGIN
-#define CTOR_LIST_BEGIN \
-do { \
- asm (CTORS_SECTION_ASM_OP); \
- if (TARGET_ELF) \
- STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; \
- else \
- asm ("pushl $0"); \
-} while (0)
-
-#undef CTOR_LIST_END
-#define CTOR_LIST_END \
-do { \
- if (TARGET_ELF) { \
- asm (CTORS_SECTION_ASM_OP); \
- STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) }; \
- } else { \
- CTOR_LIST_BEGIN; \
- } \
-} while (0)
-
-#undef DBX_BLOCKS_FUNCTION_RELATIVE
-#define DBX_BLOCKS_FUNCTION_RELATIVE 1
-
-#undef DBX_FUNCTION_FIRST
-#define DBX_FUNCTION_FIRST 1
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) \
-((TARGET_ELF) ? \
- ((n) == 0 ? 0 \
- : (n) == 1 ? 2 \
- : (n) == 2 ? 1 \
- : (n) == 3 ? 3 \
- : (n) == 4 ? 6 \
- : (n) == 5 ? 7 \
- : (n) == 6 ? 5 \
- : (n) == 7 ? 4 \
- : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
- : (-1)) \
- : \
- ((n) == 0 ? 0 : \
- (n) == 1 ? 2 : \
- (n) == 2 ? 1 : \
- (n) == 3 ? 3 : \
- (n) == 4 ? 6 : \
- (n) == 5 ? 7 : \
- (n) == 6 ? 4 : \
- (n) == 7 ? 5 : \
- (n) + 4))
-
-#undef DWARF_DEBUGGING_INFO
-#undef SDB_DEBUGGING_INFO
-#undef DBX_DEBUGGING_INFO
-#undef PREFERRED_DEBUGGING_TYPE
-
-#define DWARF_DEBUGGING_INFO 1
-#define SDB_DEBUGGING_INFO 1
-#define PREFERRED_DEBUGGING_TYPE \
- ((TARGET_ELF) ? DWARF_DEBUG: SDB_DEBUG)
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- INIT_SECTION_FUNCTION \
- FINI_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#undef CONST_SECTION_FUNCTION
-#define CONST_SECTION_FUNCTION \
-void \
-const_section () \
-{ \
- extern void text_section(); \
- if (!USE_CONST_SECTION) \
- text_section(); \
- else if (in_section != in_const) \
- { \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
- in_section = in_const; \
- } \
-}
-
-#undef FINI_SECTION_FUNCTION
-#define FINI_SECTION_FUNCTION \
-void \
-fini_section () \
-{ \
- if ((!TARGET_ELF) && in_section != in_fini) \
- { \
- fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
- in_section = in_fini; \
- } \
-}
-
-#undef INIT_SECTION_FUNCTION
-#define INIT_SECTION_FUNCTION \
-void \
-init_section () \
-{ \
- if ((!TARGET_ELF) && in_section != in_init) \
- { \
- fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
- in_section = in_init; \
- } \
-}
-
-#undef CTORS_SECTION_FUNCTION
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#undef DTORS_SECTION_FUNCTION
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-#undef FRAME_POINTER_REQUIRED
-#define FRAME_POINTER_REQUIRED \
- ((TARGET_ELF) ? 0 : \
- (current_function_calls_setjmp || current_function_calls_longjmp))
-
-#undef JUMP_TABLES_IN_TEXT_SECTION
-#define JUMP_TABLES_IN_TEXT_SECTION 1
-
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX \
- ((TARGET_ELF) ? "" : ".")
-
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-#define MD_EXEC_PREFIX "/usr/ccs/bin/"
-#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
-
-#undef NON_SAVING_SETJMP
-#define NON_SAVING_SETJMP \
- ((TARGET_ELF) ? 0 : \
- (current_function_calls_setjmp && current_function_calls_longjmp))
-
-#undef NO_IMPLICIT_EXTERN_C
-#define NO_IMPLICIT_EXTERN_C 1
-
-/* JKJ FIXME - examine the rammifications of RETURN_IN_MEMORY and
- RETURN_POPS_ARGS */
-
-#undef RETURN_POPS_ARGS
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((TARGET_ELF) ? \
- (i386_return_pops_args (FUNDECL, FUNTYPE, SIZE)) : \
- (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0 \
- : (TARGET_RTD \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) ? (SIZE) \
- : 0))
-
-#undef SELECT_SECTION
-#define SELECT_SECTION(DECL,RELOC) \
-{ \
- if (TREE_CODE (DECL) == STRING_CST) \
- { \
- if (! flag_writable_strings) \
- const_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
- if ((TARGET_ELF && flag_pic && RELOC) \
- || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
- || !DECL_INITIAL (DECL) \
- || (DECL_INITIAL (DECL) != error_mark_node \
- && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
- data_section (); \
- else \
- const_section (); \
- } \
- else \
- const_section (); \
-}
-
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
- (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
- || (CHAR) == 'h' \
- || (CHAR) == 'R' \
- || (CHAR) == 'Y' \
- || (CHAR) == 'z')
-
-#undef WORD_SWITCH_TAKES_ARG
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
- && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
- && strcmp (STR, "Tbss"))
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0301
-
-#undef HANDLE_SYSV_PRAGMA
-#define HANDLE_SYSV_PRAGMA 1
-
-#undef SCCS_DIRECTIVE
-#define SCCS_DIRECTIVE 1
-
-/*
- * Define sizes and types
- */
-#undef SIZE_TYPE
-#undef PTRDIFF_TYPE
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 96
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-#define WCHAR_TYPE "long int"
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-
-/* Please note that these specs may look messy but they are required in
- order to emulate the SCO Development system as closely as possible.
- With SCO Open Server 5.0, you now get the linker and assembler free,
- so that is what these specs are targeted for. These utilities are
- very argument sensitive: a space in the wrong place breaks everything.
- So RMS, please forgive this mess. It works.
-
- Parameters which can be passed to gcc, and their SCO equivalents:
- GCC Parameter SCO Equivalent
- -ansi -a ansi
- -posix -a posix
- -Xpg4 -a xpg4
- -Xpg4plus -a xpg4plus
- -Xods30 -a ods30
-
- As with SCO, the default is XPG4 plus mode. SCO also allows you to
- specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed
- on to the assembler and linker in the same way that the SCO compiler
- does.
-
- SCO also allows you to compile, link and generate either ELF or COFF
- binaries. With gcc, as with the SCO compiler, the default is coff.
- Specify -melf to gcc to produce elf binaries. -fpic will get the
- assembler and linker to produce PIC code.
-*/
-
-/* Set up assembler flags for PIC and ELF compilations */
-#undef ASM_SPEC
-#define ASM_SPEC \
- "-b %{melf:elf}%{!melf:coff \
- %{static:%e-static only valid with -melf} \
- %{shared:%e-shared only valid with -melf} \
- %{symbolic:%e-symbolic only valid with -melf}} \
- %{Ym,*} %{Yd,*} %{Wa,*:%*} \
- %{melf:-E%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},ELF %{Qn:} %{!Qy:-Qn}}"
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!shared:\
- %{!symbolic: \
- %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \
- %{ansi:values-Xc.o%s} \
- %{!ansi: \
- %{traditional:values-Xt.o%s} \
- %{!traditional: \
- %{Xa:values-Xa.o%s} \
- %{!Xa:%{Xc:values-Xc.o%s} \
- %{!Xc:%{Xk:values-Xk.o%s} \
- %{!Xk:%{Xt:values-Xt.o%s} \
- %{!Xt:values-Xa.o%s}}}}}} \
- %{!melf:crtbegin.o%s} \
- %{melf:%{static:crtbegin.o%s}%{!static:crtbeginS.o%s}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "%{melf:%{!static:crtendS.o%s}%{static:crtend.o%s}} \
- %{!melf:crtend.o%s} \
- %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Asystem(svr3)"
-
-/* You are in a maze of GCC specs ... all alike */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] \
- %{fpic:%{!melf:%e-fpic is only valid with -melf}} \
- %{fPIC:%{!melf:%e-fPIC is only valid with -melf}} \
- -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \
- %{!Xods30:-D_STRICT_NAMES} \
- %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \
- %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \
- %{!ansi: \
- %{posix:-isystem include/posix%s -isystem /usr/include/posix \
- -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \
- %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \
- -D_XOPEN_SOURCE=1} \
- %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \
- -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \
- -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \
- %{Xods30:-isystem include/ods_30_compat%s \
- -isystem /usr/include/ods_30_compat \
- -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \
- -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \
- -DM_WORDSWAP}}}} \
- %{scointl:-DM_INTERNAT -D_M_INTERNAT} \
- %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE} \
- %{melf:-D_SCO_ELF} \
- %{!melf:-D_M_COFF -D_SCO_COFF} \
- %{melf:%{fpic:-D__PIC__ -D__pic__} \
- %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \
- %{Xa:-D_SCO_C_DIALECT=1} \
- %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \
- %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \
- %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \
- %{!Xt:-D_SCO_C_DIALECT=1}}}} \
- %{traditional:-traditional -D_KR -D_NO_PROTOTYPE}"
-
-#undef LINK_SPEC
-#define LINK_SPEC \
- "-b %{melf:elf}%{!melf:coff \
- %{static:%e-static only valid with -melf} \
- %{shared:%e-shared only valid with -melf} \
- %{symbolic:%e-symbolic only valid with -melf} \
- %{fpic:%e-fpic only valid with -melf} \
- %{fPIC:%e-fPIC only valid with -melf}} \
- -R%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},%{melf:ELF}%{!melf:COFF} \
- %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \
- %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \
- %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \
- %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \
- %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \
- %{G:-G} %{melf:%{Qn:} %{!Qy:-Qn}}"
-
-/* Library spec. If we are not building a shared library, provide the
- standard libraries, as per the SCO compiler. */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{!shared:%{!symbolic:-lcrypt -lgen -lc}}"
-
-#undef LIBGCC_SPEC
-#define LIBGCC_SPEC \
- "%{!melf:-lgcc}%{melf:%{!shared:%{!symbolic:-lgcc-elf}}}"
-
-#define MASK_ELF 010000000000 /* Mask for elf generation */
-#define TARGET_ELF (target_flags & MASK_ELF)
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES { "elf", MASK_ELF },
-
-#define NO_DOLLAR_IN_LABEL
-
-/*
-Here comes some major hackery to get the crt stuff to compile properly.
-Since we can (and do) compile for both COFF and ELF environments, we
-set things up accordingly, based on the pre-processor defines for ELF
-and COFF. This is insane, but then I guess having one compiler with a
-single back-end supporting two vastly different file format types is
-a little insane too. But it is not impossible and we get a useful
-compiler at the end of the day. Onward we go ...
-*/
-
-#if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2)
-# undef OBJECT_FORMAT_ELF
-# undef HAVE_ATEXIT
-# undef INIT_SECTION_ASM_OP
-# undef FINI_SECTION_ASM_OP
-# undef CTORS_SECTION_ASM_OP
-# undef DTORS_SECTION_ASM_OP
-# undef CTOR_LIST_BEGIN
-# undef CTOR_LIST_END
-# undef DO_GLOBAL_CTORS_BODY
-
-# if defined (_SCO_ELF)
-# define OBJECT_FORMAT_ELF
-# define HAVE_ATEXIT
-# define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF
-# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF
-# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF
-# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF
-# else /* ! _SCO_ELF */
-# define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF
-# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF
-# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF
-# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF
-# define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0")
-# define CTOR_LIST_END CTOR_LIST_BEGIN
-# define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *p, *beg = alloca(0); \
- for (p = beg; *p;) \
- (*p++) (); \
-} while (0)
-# endif /* ! _SCO_ELF */
-#endif /* CRT_BEGIN !! CRT_END */
-
diff --git a/gcc/config/i386/scodbx.h b/gcc/config/i386/scodbx.h
deleted file mode 100644
index a2581d4257f..00000000000
--- a/gcc/config/i386/scodbx.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Definitions for Intel 386 running SCO Unix System V,
- using dbx-in-coff encapsulation.
- Copyright (C) 1992, 1995, 1996 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. */
-
-#include "i386/svr3dbx.h"
-
-/* Overridden defines for SCO systems from sco.h. */
-
-/* By default, target has a 80387, uses IEEE compatible arithmetic,
- and returns float values in the 387, ie,
- (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387)
-
- SCO's software emulation of a 387 fails to handle the `fucomp'
- opcode. fucomp is only used when generating IEEE compliant code.
- So don't make TARGET_IEEE_FP default for SCO. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0201
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!r:%{!z:svr3.ifile%s}%{z:svr3z.ifile%s}}\
- %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
-
-/* Library spec, including SCO international language support. */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} %{scointl:libintl.a%s} -lc"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -DM_UNIX -DM_I386 -DM_COFF -DM_WORDSWAP -Asystem(svr3)"
-
-#undef CPP_SPEC
-#define CPP_SPEC " -Acpu(i386) -Amachine(i386) %{scointl:-DM_INTERNAT}"
-
-/* This spec is used for telling cpp whether char is signed or not. */
-
-#undef SIGNED_CHAR_SPEC
-#if DEFAULT_SIGNED_CHAR
-#define SIGNED_CHAR_SPEC \
- "%{funsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}"
-#else
-#define SIGNED_CHAR_SPEC \
- "%{!fsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}"
-#endif
-
-/* Use atexit for static destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* caller has to pop the extra argument passed to functions that return
- structures. */
-
-#undef RETURN_POPS_ARGS
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE ? 0 \
- : (TARGET_RTD \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) ? (SIZE) \
- : 0)
-/* On other 386 systems, the last line looks like this:
- : (aggregate_value_p (TREE_TYPE (FUNTYPE))) ? GET_MODE_SIZE (Pmode) : 0) */
-
-/* Use periods rather than dollar signs in special g++ assembler names. */
-
-#define NO_DOLLAR_IN_LABEL
-
-/* Handle #pragma pack. */
-#define HANDLE_SYSV_PRAGMA
diff --git a/gcc/config/i386/seq-gas.h b/gcc/config/i386/seq-gas.h
deleted file mode 100644
index 796eaa24d62..00000000000
--- a/gcc/config/i386/seq-gas.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Definitions for Sequent Intel 386 using GAS.
- Copyright (C) 1992 Free Software Foundation, Inc.
-
-/* Mostly it's like a Sequent 386 without GAS. */
-
-#include "i386/sequent.h"
-
-/* A C statement or statements which output an assembler instruction
- opcode to the stdio stream STREAM. The macro-operand PTR is a
- variable of type `char *' which points to the opcode name in its
- "internal" form--the form that is written in the machine description.
-
- GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
- So use `repe' instead. */
-
-#undef ASM_OUTPUT_OPCODE
-#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
-{ \
- if ((PTR)[0] == 'r' \
- && (PTR)[1] == 'e' \
- && (PTR)[2] == 'p') \
- { \
- if ((PTR)[3] == 'z') \
- { \
- fprintf (STREAM, "repe"); \
- (PTR) += 4; \
- } \
- else if ((PTR)[3] == 'n' && (PTR)[4] == 'z') \
- { \
- fprintf (STREAM, "repne"); \
- (PTR) += 5; \
- } \
- } \
-}
-
-/* Define macro used to output shift-double opcodes when the shift
- count is in %cl. Some assemblers require %cl as an argument;
- some don't.
-
- GAS requires the %cl argument, so override i386/unix.h. */
-
-#undef SHIFT_DOUBLE_OMITS_COUNT
-#define SHIFT_DOUBLE_OMITS_COUNT 0
-
-/* Print opcodes the way that GAS expects them. */
-#define GAS_MNEMONICS 1
diff --git a/gcc/config/i386/seq-sysv3.h b/gcc/config/i386/seq-sysv3.h
deleted file mode 100644
index 9e8388d47d7..00000000000
--- a/gcc/config/i386/seq-sysv3.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Sequent DYNIX/ptx 1.x (SVr3) */
-
-#include "i386/sysv3.h"
-
-/* Sequent Symmetry SVr3 doesn't have crtn.o; crt1.o doesn't work
- but crt0.o does. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
-"%{pg:gcrt0.o%s}\
- %{!pg:%{posix:%{p:mcrtp0.o%s}%{!p:crtp0.o%s}}\
- %{!posix:%{p:mcrt0.o%s}%{!p:crt0.o%s}}} crtbegin.o%s\
- %{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp}"
-
-#undef LIB_SPEC
-#define LIB_SPEC \
-"%{posix:-lcposix}\
- %{shlib:-lc_s}\
- %{fshared-data:-lpps -lseq} -lc crtend.o%s"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} -D_SEQUENT_=1"
-
-/* Although the .init section is used, it is not automatically invoked.
- This because the _start() function in /lib/crt0.o never calls anything
- from the .init section */
-#define INVOKE__main
-
-/* Assembler pseudo-op for initialized shared variables (.shdata). */
-#undef SHARED_SECTION_ASM_OP
-#define SHARED_SECTION_ASM_OP ".section .shdata, \"ws\""
-
-/* Assembler pseudo-op for uninitialized shared global variables (.shbss). */
-#undef ASM_OUTPUT_SHARED_COMMON
-#define ASM_OUTPUT_SHARED_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs(".comm ", (FILE)), \
- assemble_name((FILE), (NAME)), \
- fprintf((FILE), ",%u,-3\n", (SIZE)))
-
-/* Assembler pseudo-op for uninitialized shared local variables (.shbss). */
-#undef SHARED_BSS_SECTION_ASM_OP
-#define SHARED_BSS_SECTION_ASM_OP ".section .shbss, \"bs\""
diff --git a/gcc/config/i386/seq2-sysv3.h b/gcc/config/i386/seq2-sysv3.h
deleted file mode 100644
index 763c5f0adcc..00000000000
--- a/gcc/config/i386/seq2-sysv3.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Sequent DYNIX/ptx 2.x (SVr3) */
-
-#include "i386/seq-sysv3.h"
-
-/* Use atexit for static destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
diff --git a/gcc/config/i386/sequent.h b/gcc/config/i386/sequent.h
deleted file mode 100644
index 4d76c389b6a..00000000000
--- a/gcc/config/i386/sequent.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Definitions for Sequent Intel 386.
- Copyright (C) 1988, 1994 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. */
-
-#include "i386/i386.h"
-
-/* Use the BSD assembler syntax. */
-
-#include "i386/bsd.h"
-
-/* By default, don't use IEEE compatible arithmetic comparisons
- because the assembler can't handle the fucom insn.
- Return float values in the 387.
- (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387) */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0201
-
-/* Specify predefined symbols in preprocessor. */
-
-#define CPP_PREDEFINES "-Dunix -Di386 -Dsequent -Asystem(unix) -Acpu(i386) -Amachine(i386)"
-
-/* Pass -Z and -ZO options to the linker. */
-
-#define LINK_SPEC "%{Z*}"
-
-#if 0 /* Dynix 3.1 is said to accept -L. */
-/* Dynix V3.0.12 doesn't accept -L at all. */
-
-#define LINK_LIBGCC_SPECIAL
-#endif
-
-/* Link with libg.a when debugging, for dbx's sake. */
-
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
-
-/* We don't want to output SDB debugging information. */
-
-#undef SDB_DEBUGGING_INFO
-
-/* We want to output DBX debugging information. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Sequent Symmetry has size_t defined as int in /usr/include/sys/types.h */
-#define SIZE_TYPE "int"
-
-/* gcc order is ax, dx, cx, bx, si, di, bp, sp, st, st.
- * dbx order is ax, dx, cx, st(0), st(1), bx, si, di, st(2), st(3),
- * st(4), st(5), st(6), st(7), sp, bp */
-
-/* ??? The right thing would be to change the ordering of the
- registers to correspond to the conventions of this system,
- and get rid of DBX_REGISTER_NUMBER. */
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) \
-((n) < 3 ? (n) : (n) < 6 ? (n) + 2 \
- : (n) == 6 ? 15 : (n) == 7 ? 14 : 3)
-
-/* malcolmp@hydra.maths.unsw.EDU.AU says these two definitions
- fix trouble in dbx. */
-#undef DBX_OUTPUT_LBRAC
-#define DBX_OUTPUT_LBRAC(file,name) \
- fprintf (asmfile, "%s %d,0,%d,", ASM_STABN_OP, N_LBRAC, depth); \
- assemble_name (asmfile, buf); \
- fprintf (asmfile, "\n");
-
-#undef DBX_OUTPUT_RBRAC
-#define DBX_OUTPUT_RBRAC(file,name) \
- fprintf (asmfile, "%s %d,0,%d,", ASM_STABN_OP, N_RBRAC, depth); \
- assemble_name (asmfile, buf); \
- fprintf (asmfile, "\n");
-
-/* Prevent anything from being allocated in the register pair cx/bx,
- since that would confuse GDB. */
-
-#undef HARD_REGNO_MODE_OK
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (((REGNO) < 2 ? 1 \
- : (REGNO) < 4 ? 1 \
- : FP_REGNO_P (REGNO) ? (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
- : (MODE) != QImode) \
- && ! (REGNO == 2 && GET_MODE_UNIT_SIZE (MODE) > 4))
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tmovl $.LP%d,%%eax\n\tcall mcount\n", (LABELNO));
-
-/* Assembler pseudo-op for shared data segment. */
-#define SHARED_SECTION_ASM_OP ".shdata"
-
-/* A C statement or statements which output an assembler instruction
- opcode to the stdio stream STREAM. The macro-operand PTR is a
- variable of type `char *' which points to the opcode name in its
- "internal" form--the form that is written in the machine description.
-
- The Sequent assembler (identified as "Balance 8000 Assembler
- 07/17/85 3.90" by "as -v") does not understand the `movs[bwl]' string
- move mnemonics - it uses `smov[bwl]' instead. Change "movs" into
- "smov", carefully avoiding the sign-extend opcodes. */
-
-#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
-{ \
- if ((PTR)[0] == 'm' \
- && (PTR)[1] == 'o' \
- && (PTR)[2] == 'v' \
- && (PTR)[3] == 's' \
- && ((PTR)[4] == 'b' || (PTR)[4] == 'w' || (PTR)[4] == 'l') \
- && ((PTR)[5] == ' ' || (PTR)[5] == '\t'|| (PTR)[5] == '\0')) \
- { \
- fprintf (STREAM, "smov"); \
- (PTR) += 4; \
- } \
-}
-
-/* 10-Aug-92 pes Local labels are prefixed with ".L" */
-#undef LPREFIX
-#define LPREFIX ".L"
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)\
- sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER))
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)\
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
-/* The native compiler passes the address of the returned structure in eax. */
-#undef STRUCT_VALUE
-#undef STRUCT_VALUE_INCOMING
-#define STRUCT_VALUE_REGNUM 0
diff --git a/gcc/config/i386/sol2-c1.asm b/gcc/config/i386/sol2-c1.asm
deleted file mode 100644
index 72fdfb87cc2..00000000000
--- a/gcc/config/i386/sol2-c1.asm
+++ /dev/null
@@ -1,156 +0,0 @@
-! crt1.s for Solaris 2, x86
-
-! Copyright (C) 1993 Free Software Foundation, Inc.
-! Written By Fred Fish, Nov 1992
-!
-! 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, or (at your option) any
-! later version.
-!
-! In addition to the permissions in the GNU General Public License, the
-! Free Software Foundation gives you unlimited permission to link the
-! compiled version of this file with other programs, and to distribute
-! those programs without any restriction coming from the use of this
-! file. (The General Public License restrictions do apply in other
-! respects; for example, they cover modification of the file, and
-! distribution when not linked into another program.)
-!
-! This file 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; 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 link this library with files
-! compiled with GCC to produce an executable, this does not 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.
-!
-
-! This file takes control of the process from the kernel, as specified
-! in section 3 of the System V Application Binary Interface, Intel386
-! Processor Supplement. It has been constructed from information obtained
-! from the ABI, information obtained from single stepping existing
-! Solaris executables through their startup code with gdb, and from
-! information obtained by single stepping executables on other i386 SVR4
-! implementations. This file is the first thing linked into any executable.
-
- .file "crt1.s"
- .ident "GNU C crt1.s"
- .weak _cleanup
- .weak _DYNAMIC
- .text
-
-! Start creating the initial frame by pushing a NULL value for the return
-! address of the initial frame, and mark the end of the stack frame chain
-! (the innermost stack frame) with a NULL value, per page 3-32 of the ABI.
-! Initialize the first stack frame pointer in %ebp (the contents of which
-! are unspecified at process initialization).
-
- .globl _start
-_start:
- pushl $0x0
- pushl $0x0
- movl %esp,%ebp
-
-! As specified per page 3-32 of the ABI, %edx contains a function
-! pointer that should be registered with atexit(), for proper
-! shared object termination. Just push it onto the stack for now
-! to preserve it. We want to register _cleanup() first.
-
- pushl %edx
-
-! Check to see if there is an _cleanup() function linked in, and if
-! so, register it with atexit() as the last thing to be run by
-! atexit().
-
- movl $_cleanup,%eax
- testl %eax,%eax
- je .L1
- pushl $_cleanup
- call atexit
- addl $0x4,%esp
-.L1:
-
-! Now check to see if we have an _DYNAMIC table, and if so then
-! we need to register the function pointer previously in %edx, but
-! now conveniently saved on the stack as the argument to pass to
-! atexit().
-
- movl $_DYNAMIC,%eax
- testl %eax,%eax
- je .L2
- call atexit
-.L2:
-
-! Register _fini() with atexit(). We will take care of calling _init()
-! directly.
-
- pushl $_fini
- call atexit
-
-! Compute the address of the environment vector on the stack and load
-! it into the global variable _environ. Currently argc is at 8 off
-! the frame pointer. Fetch the argument count into %eax, scale by the
-! size of each arg (4 bytes) and compute the address of the environment
-! vector which is 16 bytes (the two zero words we pushed, plus argc,
-! plus the null word terminating the arg vector) further up the stack,
-! off the frame pointer (whew!).
-
- movl 8(%ebp),%eax
- leal 16(%ebp,%eax,4),%edx
- movl %edx,_environ
-
-! Push the environment vector pointer, the argument vector pointer,
-! and the argument count on to the stack to set up the arguments
-! for _init(), _fpstart(), and main(). Note that the environment
-! vector pointer and the arg count were previously loaded into
-! %edx and %eax respectively. The only new value we need to compute
-! is the argument vector pointer, which is at a fixed address off
-! the initial frame pointer.
-
- pushl %edx
- leal 12(%ebp),%edx
- pushl %edx
- pushl %eax
-
-! Call _init(argc, argv, environ), _fpstart(argc, argv, environ), and
-! main(argc, argv, environ).
-
- call _init
- call __fpstart
- call main
-
-! Pop the argc, argv, and environ arguments off the stack, push the
-! value returned from main(), and call exit().
-
- addl $12,%esp
- pushl %eax
- call exit
-
-! An inline equivalent of _exit, as specified in Figure 3-26 of the ABI.
-
- pushl $0x0
- movl $0x1,%eax
- lcall $7,$0
-
-! If all else fails, just try a halt!
-
- hlt
- .type _start,@function
- .size _start,.-_start
-
-! A dummy profiling support routine for non-profiling executables,
-! in case we link in some objects that have been compiled for profiling.
-
- .globl _mcount
-_mcount:
- ret
- .type _mcount,@function
- .size _mcount,.-_mcount
diff --git a/gcc/config/i386/sol2-ci.asm b/gcc/config/i386/sol2-ci.asm
deleted file mode 100644
index 439c709ba68..00000000000
--- a/gcc/config/i386/sol2-ci.asm
+++ /dev/null
@@ -1,51 +0,0 @@
-! crti.s for Solaris 2, x86.
-
-! Copyright (C) 1993 Free Software Foundation, Inc.
-! Written By Fred Fish, Nov 1992
-!
-! 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, or (at your option) any
-! later version.
-!
-! In addition to the permissions in the GNU General Public License, the
-! Free Software Foundation gives you unlimited permission to link the
-! compiled version of this file with other programs, and to distribute
-! those programs without any restriction coming from the use of this
-! file. (The General Public License restrictions do apply in other
-! respects; for example, they cover modification of the file, and
-! distribution when not linked into another program.)
-!
-! This file 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; 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 link this library with files
-! compiled with GCC to produce an executable, this does not 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.
-!
-
-! This file just supplies labeled starting points for the .init and .fini
-! sections. It is linked in before the values-Xx.o files and also before
-! crtbegin.o.
-
- .file "crti.s"
- .ident "GNU C crti.s"
-
- .section .init
- .globl _init
- .type _init,@function
-_init:
-
- .section .fini
- .globl _fini
- .type _fini,@function
-_fini:
diff --git a/gcc/config/i386/sol2-cn.asm b/gcc/config/i386/sol2-cn.asm
deleted file mode 100644
index 3f3bad93300..00000000000
--- a/gcc/config/i386/sol2-cn.asm
+++ /dev/null
@@ -1,46 +0,0 @@
-! crtn.s for Solaris 2, x86.
-
-! Copyright (C) 1993 Free Software Foundation, Inc.
-! Written By Fred Fish, Nov 1992
-!
-! 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, or (at your option) any
-! later version.
-!
-! In addition to the permissions in the GNU General Public License, the
-! Free Software Foundation gives you unlimited permission to link the
-! compiled version of this file with other programs, and to distribute
-! those programs without any restriction coming from the use of this
-! file. (The General Public License restrictions do apply in other
-! respects; for example, they cover modification of the file, and
-! distribution when not linked into another program.)
-!
-! This file 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; 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 link this library with files
-! compiled with GCC to produce an executable, this does not 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.
-!
-
-! This file just supplies returns for the .init and .fini sections. It is
-! linked in after all other files.
-
- .file "crtn.o"
- .ident "GNU C crtn.o"
-
- .section .init
- ret $0x0
-
- .section .fini
- ret $0x0
diff --git a/gcc/config/i386/sol2-gc1.asm b/gcc/config/i386/sol2-gc1.asm
deleted file mode 100644
index 8983a672ac2..00000000000
--- a/gcc/config/i386/sol2-gc1.asm
+++ /dev/null
@@ -1,160 +0,0 @@
-! gcrt1.s for Solaris 2, x86
-
-! Copyright (C) 1993 Free Software Foundation, Inc.
-! Written By Fred Fish, Nov 1992
-!
-! 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, or (at your option) any
-! later version.
-!
-! In addition to the permissions in the GNU General Public License, the
-! Free Software Foundation gives you unlimited permission to link the
-! compiled version of this file with other programs, and to distribute
-! those programs without any restriction coming from the use of this
-! file. (The General Public License restrictions do apply in other
-! respects; for example, they cover modification of the file, and
-! distribution when not linked into another program.)
-!
-! This file 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; 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 link this library with files
-! compiled with GCC to produce an executable, this does not 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.
-!
-
-! This file takes control of the process from the kernel, as specified
-! in section 3 of the System V Application Binary Interface, Intel386
-! Processor Supplement. It has been constructed from information obtained
-! from the ABI, information obtained from single stepping existing
-! Solaris executables through their startup code with gdb, and from
-! information obtained by single stepping executables on other i386 SVR4
-! implementations. This file is the first thing linked into any executable.
-
-! This is a modified crt1.s by J.W.Hawtin <J.W.Hawtin@lboro.ac.uk> 15/8/96,
-! to allow program profiling, by calling monstartup on entry and _mcleanup
-! on exit
-
- .file "gcrt1.s"
- .ident "GNU C gcrt1.s"
- .weak _DYNAMIC
- .text
-
-! Start creating the initial frame by pushing a NULL value for the return
-! address of the initial frame, and mark the end of the stack frame chain
-! (the innermost stack frame) with a NULL value, per page 3-32 of the ABI.
-! Initialize the first stack frame pointer in %ebp (the contents of which
-! are unspecified at process initialization).
-
- .globl _start
-_start:
- pushl $0x0
- pushl $0x0
- movl %esp,%ebp
-
-! As specified per page 3-32 of the ABI, %edx contains a function
-! pointer that should be registered with atexit(), for proper
-! shared object termination. Just push it onto the stack for now
-! to preserve it. We want to register _cleanup() first.
-
- pushl %edx
-
-! Check to see if there is an _cleanup() function linked in, and if
-! so, register it with atexit() as the last thing to be run by
-! atexit().
-
- movl $_mcleanup,%eax
- testl %eax,%eax
- je .L1
- pushl $_mcleanup
- call atexit
- addl $0x4,%esp
-.L1:
-
-! Now check to see if we have an _DYNAMIC table, and if so then
-! we need to register the function pointer previously in %edx, but
-! now conveniently saved on the stack as the argument to pass to
-! atexit().
-
- movl $_DYNAMIC,%eax
- testl %eax,%eax
- je .L2
- call atexit
-.L2:
-
-! Register _fini() with atexit(). We will take care of calling _init()
-! directly.
-
- pushl $_fini
- call atexit
-
-! Start profiling
-
- pushl %ebp
- movl %esp,%ebp
- pushl $_etext
- pushl $_start
- call monstartup
- addl $8,%esp
- popl %ebp
-
-! Compute the address of the environment vector on the stack and load
-! it into the global variable _environ. Currently argc is at 8 off
-! the frame pointer. Fetch the argument count into %eax, scale by the
-! size of each arg (4 bytes) and compute the address of the environment
-! vector which is 16 bytes (the two zero words we pushed, plus argc,
-! plus the null word terminating the arg vector) further up the stack,
-! off the frame pointer (whew!).
-
- movl 8(%ebp),%eax
- leal 16(%ebp,%eax,4),%edx
- movl %edx,_environ
-
-! Push the environment vector pointer, the argument vector pointer,
-! and the argument count on to the stack to set up the arguments
-! for _init(), _fpstart(), and main(). Note that the environment
-! vector pointer and the arg count were previously loaded into
-! %edx and %eax respectively. The only new value we need to compute
-! is the argument vector pointer, which is at a fixed address off
-! the initial frame pointer.
-
- pushl %edx
- leal 12(%ebp),%edx
- pushl %edx
- pushl %eax
-
-! Call _init(argc, argv, environ), _fpstart(argc, argv, environ), and
-! main(argc, argv, environ).
-
- call _init
- call __fpstart
- call main
-
-! Pop the argc, argv, and environ arguments off the stack, push the
-! value returned from main(), and call exit().
-
- addl $12,%esp
- pushl %eax
- call exit
-
-! An inline equivalent of _exit, as specified in Figure 3-26 of the ABI.
-
- pushl $0x0
- movl $0x1,%eax
- lcall $7,$0
-
-! If all else fails, just try a halt!
-
- hlt
- .type _start,@function
- .size _start,.-_start
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
deleted file mode 100644
index 55fe5f775dc..00000000000
--- a/gcc/config/i386/sol2.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Target definitions for GNU compiler for Intel 80386 running Solaris 2
- Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Fred Fish (fnf@cygnus.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 "i386/sysv4.h"
-
-/* The Solaris 2.0 x86 linker botches alignment of code sections.
- It tries to align to a 16 byte boundary by padding with 0x00000090
- ints, rather than 0x90 bytes (nop). This generates trash in the
- ".init" section since the contribution from crtbegin.o is only 7
- bytes. The linker pads it to 16 bytes with a single 0x90 byte, and
- two 0x00000090 ints, which generates a segmentation violation when
- executed. This macro forces the assembler to do the padding, since
- it knows what it is doing. */
-
-#define FORCE_INIT_SECTION_ALIGN do { asm (ALIGN_ASM_OP ## " 16"); } while (0)
-#define FORCE_FINI_SECTION_ALIGN FORCE_INIT_SECTION_ALIGN
-
-/* Add "sun" to the list of symbols defined for SVR4. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dunix -D__svr4__ -D__SVR4 -Dsun -Asystem(svr4)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] \
- %{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude}"
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} %{!shared:%{!symbolic:-lc}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s %{pg:crtn.o%s}%{!pg:crtn.o%s}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared: \
- %{!symbolic: \
- %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
- %{pg:gmon.o%s}%{!pg:crti.o%s} \
- %{ansi:values-Xc.o%s} \
- %{!ansi: \
- %{traditional:values-Xt.o%s} \
- %{!traditional:values-Xa.o%s}} \
- crtbegin.o%s"
-
-/* This should be the same as in svr4.h, except with -R added. */
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{h*} %{v:-V} \
- %{b} %{Wl,*:%*} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy -z text} \
- %{symbolic:-Bsymbolic -G -dy -z text} \
- %{G:-G} \
- %{YP,*} \
- %{R*} \
- %{compat-bsd: \
- %{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
- -R /usr/ucblib} \
- %{!compat-bsd: \
- %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!p:-Y P,/usr/ccs/lib:/usr/lib}}} \
- %{Qy:} %{!Qn:-Qy}"
-
-/* This defines which switch letters take arguments.
- It is as in svr4.h but with -R added. */
-
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
- (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
- || (CHAR) == 'R' \
- || (CHAR) == 'h' \
- || (CHAR) == 'z')
-
diff --git a/gcc/config/i386/sol2dbg.h b/gcc/config/i386/sol2dbg.h
deleted file mode 100644
index 9d09c8fd043..00000000000
--- a/gcc/config/i386/sol2dbg.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Target definitions for GNU compiler for Intel 80386 running Solaris
- with gas and gdb.
- This file is added into the directory .../gcc-2.../config/i386
- Workability without "#undef DWARF_DEBUGGING_INFO" is not tested. */
-
-/* Use stabs instead of DWARF debug format. */
-#ifdef PREFERRED_DEBUGGING_TYPE
-#undef PREFERRED_DEBUGGING_TYPE
-#endif
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#include "i386/sol2.h"
-
-#ifdef DWARF_DEBUGGING_INFO
-#undef DWARF_DEBUGGING_INFO
-#endif
diff --git a/gcc/config/i386/sun.h b/gcc/config/i386/sun.h
deleted file mode 100644
index ecc0e8294d2..00000000000
--- a/gcc/config/i386/sun.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Definitions for Intel 386 running SunOS 4.0.
- Copyright (C) 1988, 1995 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. */
-
-
-#include "i386/i386.h"
-
-/* Use the Sun assembler syntax. */
-
-#include "i386/sun386.h"
-
-/* Use crt0.o as a startup file. */
-
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
-
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
-%{g:-lg} %{sun386:}"
-/* That last item is just to prevent a spurious error. */
-
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e _start}}} -dc -dp %{static:-Bstatic}"
-
-/* Extra switches to give the assembler. */
-
-#define ASM_SPEC "%{R} -i386 %{keep-local-as-symbols:-L}"
-
-/* Specify predefined symbols in preprocessor. */
-
-#define CPP_PREDEFINES "-Dunix -Di386 -Dsun386 -Dsun -Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386)"
-
-/* Allow #sccs in preprocessor. */
-
-#define SCCS_DIRECTIVE
-
-/* Output #ident as a .ident. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
-
-/* We don't want to output SDB debugging information. */
-
-#undef SDB_DEBUGGING_INFO
-
-/* We want to output DBX debugging information. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Force structure alignment to the type used for a bitfield. */
-
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* This is partly guess. */
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) \
- ((n) == 0 ? 11 : (n) == 1 ? 9 : (n) == 2 ? 10 : (n) == 3 ? 8 \
- : (n) == 4 ? 5 : (n) == 5 ? 4 : (n) == 6 ? 6 : (n))
-
-/* Every debugger symbol must be in the text section.
- Otherwise the assembler or the linker screws up. */
-
-#define DEBUG_SYMS_TEXT
diff --git a/gcc/config/i386/sun386.h b/gcc/config/i386/sun386.h
deleted file mode 100644
index 4d4d66c181a..00000000000
--- a/gcc/config/i386/sun386.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Definitions for Sun assembler syntax for the Intel 80386.
- Copyright (C) 1988, 1996 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. */
-
-
-/* Include common aspects of all 386 Unix assemblers. */
-#include "i386/unix.h"
-
-#define TARGET_VERSION fprintf (stderr, " (80386, Sun syntax)");
-
-/* Define the syntax of instructions and addresses. */
-
-/* Prefix for internally generated assembler labels. */
-#define LPREFIX ".L"
-
-/* Define the syntax of pseudo-ops, labels and comments. */
-
-/* Assembler pseudos to introduce constants of various size. */
-
-#define ASM_BYTE_OP "\t.byte"
-#define ASM_SHORT "\t.value"
-#define ASM_LONG "\t.long"
-#define ASM_DOUBLE "\t.double"
-
-/* How to output an ASCII string constant. */
-
-#define ASM_OUTPUT_ASCII(FILE, p, size) \
-do \
-{ int i = 0; \
- while (i < (size)) \
- { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n"); \
- fprintf ((FILE), "%s ", ASM_BYTE_OP); } \
- else fprintf ((FILE), ","); \
- fprintf ((FILE), "0x%x", ((p)[i++] & 0377)) ;} \
- fprintf ((FILE), "\n"); \
-} while (0)
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- extern char *version_string, *language_string; \
- { \
- int len = strlen (dump_base_name); \
- char *na = dump_base_name + len; \
- char shorter[15]; \
- /* NA gets DUMP_BASE_NAME sans directory names. */\
- while (na > dump_base_name) \
- { \
- if (na[-1] == '/') \
- break; \
- na--; \
- } \
- strncpy (shorter, na, 14); \
- shorter[14] = 0; \
- fprintf (FILE, "\t.file\t"); \
- output_quoted_string (FILE, shorter); \
- fprintf (FILE, "\n"); \
- } \
- fprintf (FILE, "\t.version\t\"%s %s\"\n", \
- language_string, version_string); \
- if (optimize) ASM_FILE_START_1 (FILE); \
- } while (0)
-
-#define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n")
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf ((FILE), "\t.set\t.,.+%u\n", (SIZE))
-
-/* Output before read-only data. */
-
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP ".data"
-
-/* Define the syntax of labels and symbol definitions/declarations. */
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This is how to store into the string BUF
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER))
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX ""
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
diff --git a/gcc/config/i386/svr3.ifile b/gcc/config/i386/svr3.ifile
deleted file mode 100644
index 32b3ddc2bf3..00000000000
--- a/gcc/config/i386/svr3.ifile
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * svr3.ifile - for collectless G++ on i386 System V.
- * Leaves memory configured at address 0.
- *
- * Install this file as $prefix/gcc-lib/TARGET/VERSION/gcc.ifile
- *
- * BLOCK to an offset that leaves room for many headers ( the value
- * here allows for a file header, an outheader, and up to 11 section
- * headers on most systems.
- * BIND to an address that includes page 0 in mapped memory. The value
- * used for BLOCK should be or'd into this value. Here I'm setting BLOCK
- * to 0x200 and BIND to ( value_used_for(BLOCK) )
- * If you are using shared libraries, watch that you don't overlap the
- * address ranges assigned for shared libs.
- *
- * GROUP BIND to a location in the next segment. Here, the only value
- * that you should change (I think) is that within NEXT, which I've set
- * to my hardware segment size. You can always use a larger size, but not
- * a smaller one.
- */
-SECTIONS
-{
- .text BIND(0x000200) BLOCK (0x200) :
- {
- /* plenty for room for headers */
- *(.init)
- *(.text)
- vfork = fork; /* I got tired of editing peoples sloppy code */
- *(.fini)
- }
- .stab BIND(ADDR(.text) + SIZEOF(.text)): { }
- .stabstr BIND(ADDR(.stab) + SIZEOF(.stab)): { }
- GROUP BIND( NEXT(0x400000) +
- (ADDR(.stabstr) + (SIZEOF(.stabstr)) % 0x1000)):
- {
- .data : {
- __CTOR_LIST__ = . ;
- . += 4 ; /* leading NULL */
- *(.ctor)
- . += 4 ; /* trailing NULL */
- __DTOR_LIST__ = . ;
- . += 4 ; /* leading NULL */
- *(.dtor)
- . += 4 ; /* trailing NULL */
- }
- .bss : { }
- }
-}
diff --git a/gcc/config/i386/svr3dbx.h b/gcc/config/i386/svr3dbx.h
deleted file mode 100644
index c394747ab9a..00000000000
--- a/gcc/config/i386/svr3dbx.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Definitions for Intel 386 running system V, using dbx-in-coff encapsulation.
- Copyright (C) 1992, 1995 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. */
-
-#include "i386/svr3gas.h"
-
-/* We do not want to output SDB debugging information. */
-
-#undef SDB_DEBUGGING_INFO
-
-/* We want to output DBX debugging information. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Compensate for botch in dbxout_init/dbxout_source_file which
- unconditionally drops the first character from ltext_label_name */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
- sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER))
-
-/* With the current gas, .align N aligns to an N-byte boundary.
- This is done to be compatible with the system assembler.
- You must specify -DOTHER_ALIGN when building gas-1.38.1. */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
-
-/* Align labels, etc. at 4-byte boundaries.
- For the 486, align to 16-byte boundary for sake of cache. */
-
-#undef ASM_OUTPUT_ALIGN_CODE
-#define ASM_OUTPUT_ALIGN_CODE(FILE) \
- fprintf ((FILE), "\t.align %d,0x90\n", \
- 1 << i386_align_jumps)
-
-/* Align start of loop at 4-byte boundary. */
-
-#undef ASM_OUTPUT_LOOP_ALIGN
-#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
- fprintf ((FILE), "\t.align %d,0x90\n", 1 << i386_align_loops);
-
-
-/* Additional overrides needed for dbx-in-coff gas, mostly taken from pbb.h */
-
-/* Although the gas we use can create .ctor and .dtor sections from N_SETT
- stabs, it does not support section directives, so we need to have the loader
- define the lists.
- */
-#define CTOR_LISTS_DEFINED_EXTERNALLY
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-/*
- * The loader directive file svr3.ifile defines how to merge the constructor
- * sections into the data section. Also, since gas only puts out those
- * sections in response to N_SETT stabs, and does not (yet) have a
- * ".sections" directive, svr3.ifile also defines the list symbols
- * __DTOR_LIST__ and __CTOR_LIST__.
- */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!r:%{!z:svr3.ifile%s}%{z:svr3z.ifile%s}}\
- %{pg:gcrt1.o%s}%{!pg:%{posix:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}%{!posix:%{p:mcrt1.o%s}%{!p:crt1.o%s}}} \
- %{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp}"
-
-#define ENDFILE_SPEC "crtn.o%s"
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{posix:-lcposix} %{shlib:-lc_s} -lc -lg"
diff --git a/gcc/config/i386/svr3gas.h b/gcc/config/i386/svr3gas.h
deleted file mode 100644
index a288b84e524..00000000000
--- a/gcc/config/i386/svr3gas.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/* Definitions for Intel 386 running system V, using gas.
- Copyright (C) 1992, 1996 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. */
-
-#include "i386/gas.h"
-
-/* Add stuff that normally comes from i386/sysv3.h */
-
-/* longjmp may fail to restore the registers if called from the same
- function that called setjmp. To compensate, the compiler avoids
- putting variables in registers in functions that use both setjmp
- and longjmp. */
-
-#define NON_SAVING_SETJMP \
- (current_function_calls_setjmp && current_function_calls_longjmp)
-
-/* longjmp may fail to restore the stack pointer if the saved frame
- pointer is the same as the caller's frame pointer. Requiring a frame
- pointer in any function that calls setjmp or longjmp avoids this
- problem, unless setjmp and longjmp are called from the same function.
- Since a frame pointer will be required in such a function, it is OK
- that the stack pointer is not restored. */
-
-#undef FRAME_POINTER_REQUIRED
-#define FRAME_POINTER_REQUIRED \
- (current_function_calls_setjmp || current_function_calls_longjmp)
-
-/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- do { \
- int align = exact_log2 (ROUNDED); \
- if (align > 2) align = 2; \
- if (TARGET_SVR3_SHLIB) \
- { \
- data_section (); \
- ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
- ASM_OUTPUT_LABEL ((FILE), (NAME)); \
- fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)); \
- } \
- else \
- { \
- fputs (".lcomm ", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u\n", (ROUNDED)); \
- } \
- } while (0)
-
-/* Add stuff that normally comes from i386/sysv3.h via svr3.h */
-
-/* Define the actual types of some ANSI-mandated types. These
- definitions should work for most SVR3 systems. */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-/* ??? This stuff is copied from config/svr3.h. In the future,
- this file should be rewritten to include config/svr3.h
- and override what isn't right. */
-
-/* Support const sections and the ctors and dtors sections for g++.
- Note that there appears to be two different ways to support const
- sections at the moment. You can either #define the symbol
- READONLY_DATA_SECTION (giving it some code which switches to the
- readonly data section) or else you can #define the symbols
- EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
- SELECT_RTX_SECTION. We do both here just to be on the safe side.
- However, use of the const section is turned off by default
- unless the specific tm.h file turns it on by defining
- USE_CONST_SECTION as 1. */
-
-/* Define a few machine-specific details of the implementation of
- constructors.
-
- The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
- and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- Define ASM_OUTPUT_CONSTRUCTOR to push the address of the constructor. */
-
-#define USE_CONST_SECTION 0
-
-#define INIT_SECTION_ASM_OP ".section\t.init"
-#define FINI_SECTION_ASM_OP ".section .fini,\"x\""
-#define CONST_SECTION_ASM_OP ".section\t.rodata, \"x\""
-#define CTORS_SECTION_ASM_OP INIT_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP
-
-/* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
- because they push on the stack. */
-
-#ifdef STACK_GROWS_DOWNWARD
-
-/* Constructor list on stack is in reverse order. Go to the end of the
- list and go backwards to call constructors in the right order. */
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *p, *beg = alloca (0); \
- for (p = beg; *p; p++) \
- ; \
- while (p != beg) \
- (*--p) (); \
-} while (0)
-
-#else
-
-/* Constructor list on stack is in correct order. Just call them. */
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *p, *beg = alloca (0); \
- for (p = beg; *p; ) \
- (*p++) (); \
-} while (0)
-
-#endif /* STACK_GROWS_DOWNWARD */
-
-/* Add extra sections .rodata, .init and .fini. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_init, in_fini
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- INIT_SECTION_FUNCTION \
- FINI_SECTION_FUNCTION
-
-#define INIT_SECTION_FUNCTION \
-void \
-init_section () \
-{ \
- if (in_section != in_init) \
- { \
- fprintf (asm_out_file, "\t%s\n", INIT_SECTION_ASM_OP); \
- in_section = in_init; \
- } \
-}
-
-#define FINI_SECTION_FUNCTION \
-void \
-fini_section () \
-{ \
- if (in_section != in_fini) \
- { \
- fprintf (asm_out_file, "\t%s\n", FINI_SECTION_ASM_OP); \
- in_section = in_fini; \
- } \
-}
-
-#define READONLY_DATA_SECTION() const_section ()
-
-#define CONST_SECTION_FUNCTION \
-void \
-const_section () \
-{ \
- extern void text_section(); \
- if (!USE_CONST_SECTION) \
- text_section(); \
- else if (in_section != in_const) \
- { \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
- in_section = in_const; \
- } \
-}
-
-/* The ctors and dtors sections are not normally put into use
- by EXTRA_SECTIONS and EXTRA_SECTION_FUNCTIONS as defined in svr3.h,
- but it can't hurt to define these macros for whatever systems use them. */
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-/* This is machine-dependent
- because it needs to push something on the stack. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- fini_section (); \
- fprintf (FILE, "%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement or statements to switch to the appropriate
- section for output of DECL. DECL is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether forming
- the initial value of DECL requires link-time relocations. */
-
-#define SELECT_SECTION(DECL,RELOC) \
-{ \
- if (TREE_CODE (DECL) == STRING_CST) \
- { \
- if (! flag_writable_strings) \
- const_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
- if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \
- || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
- || !DECL_INITIAL (DECL) \
- || (DECL_INITIAL (DECL) != error_mark_node \
- && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
- data_section (); \
- else \
- const_section (); \
- } \
- else \
- const_section (); \
-}
-
-/* A C statement or statements to switch to the appropriate
- section for output of RTX in mode MODE. RTX is some kind
- of constant in RTL. The argument MODE is redundant except
- in the case of a `const_int' rtx. Currently, these always
- go into the const section. */
-
-#define SELECT_RTX_SECTION(MODE,RTX) const_section()
-
-/* This is copied from i386/sysv3.h. */
-
-/* Define a few machine-specific details of the implementation of
- constructors.
-
- The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
- and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the
- constructor. */
-
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP ".section .init,\"x\""
-
-#define CTOR_LIST_BEGIN \
- asm (INIT_SECTION_ASM_OP); \
- asm ("pushl $0")
-#define CTOR_LIST_END CTOR_LIST_BEGIN
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tpushl $"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
diff --git a/gcc/config/i386/svr3z.ifile b/gcc/config/i386/svr3z.ifile
deleted file mode 100644
index 4946051235e..00000000000
--- a/gcc/config/i386/svr3z.ifile
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * svr3z.ifile - for collectless G++ on i386 System V.
- * Leaves memory unconfigured at address 0.
- *
- * Install this file as $prefix/gcc-lib/TARGET/VERSION/gccz.ifile
- *
- * BLOCK to an offset that leaves room for many headers ( the value
- * here allows for a file header, an outheader, and up to 11 section
- * headers on most systems.
- * BIND to an address that excludes page 0 from being mapped. The value
- * used for BLOCK should be or'd into this value. Here I'm setting BLOCK
- * to 0x200 and BIND to ( 0x400000 | value_used_for(BLOCK) )
- * If you are using shared libraries, watch that you don't overlap the
- * address ranges assigned for shared libs.
- *
- * GROUP BIND to a location in the next segment. Here, the only value
- * that you should change (I think) is that within NEXT, which I've set
- * to my hardware segment size. You can always use a larger size, but not
- * a smaller one.
- */
-SECTIONS
-{
- .text BIND(0x400200) BLOCK (0x200) :
- {
- /* plenty for room for headers */
- *(.init)
- *(.text)
- vfork = fork; /* I got tired of editing peoples sloppy code */
- *(.fini)
- }
- .stab BIND(ADDR(.text) + SIZEOF(.text)): { }
- .stabstr BIND(ADDR(.stab) + SIZEOF(.stab)): { }
- GROUP BIND( NEXT(0x400000) +
- (ADDR(.stabstr) + (SIZEOF(.stabstr)) % 0x1000)):
- {
- .data : {
- __CTOR_LIST__ = . ;
- . += 4 ; /* leading NULL */
- *(.ctor)
- . += 4 ; /* trailing NULL */
- __DTOR_LIST__ = . ;
- . += 4 ; /* leading NULL */
- *(.dtor)
- . += 4 ; /* trailing NULL */
- }
- .bss : { }
- }
-}
diff --git a/gcc/config/i386/sysv3.h b/gcc/config/i386/sysv3.h
deleted file mode 100644
index b6a1fcc8e2a..00000000000
--- a/gcc/config/i386/sysv3.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Definitions for Intel 386 running system V.
- Copyright (C) 1988, 1996 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. */
-
-
-#include "i386/i386.h"
-
-/* Use default settings for system V.3. */
-
-#include "svr3.h"
-
-/* Use the ATT assembler syntax.
- This overrides at least one macro (USER_LABEL_PREFIX) from svr3.h. */
-
-#include "i386/att.h"
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#define STARTFILE_SPEC \
- "%{pg:gcrt1.o%s}%{!pg:%{posix:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}%{!posix:%{p:mcrt1.o%s}%{!p:crt1.o%s}}} crtbegin.o%s\
- %{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp}"
-
-/* ??? There is a suggestion that -lg is needed here.
- Does anyone know whether this is right? */
-#define LIB_SPEC "%{posix:-lcposix} %{shlib:-lc_s} -lc crtend.o%s crtn.o%s"
-
-/* Specify predefined symbols in preprocessor. */
-
-#define CPP_PREDEFINES "-Dunix -Asystem(svr3)"
-
-#define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{posix:-D_POSIX_SOURCE}"
-
-/* Writing `int' for a bitfield forces int alignment for the structure. */
-
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Don't write a `.optim' pseudo; this assembler doesn't handle them. */
-
-#undef ASM_FILE_START_1
-#define ASM_FILE_START_1(FILE)
-
-/* We want to be able to get DBX debugging information via -gstabs. */
-
-#undef DBX_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
-
-/* longjmp may fail to restore the registers if called from the same
- function that called setjmp. To compensate, the compiler avoids
- putting variables in registers in functions that use both setjmp
- and longjmp. */
-
-#define NON_SAVING_SETJMP \
- (current_function_calls_setjmp && current_function_calls_longjmp)
-
-/* longjmp may fail to restore the stack pointer if the saved frame
- pointer is the same as the caller's frame pointer. Requiring a frame
- pointer in any function that calls setjmp or longjmp avoids this
- problem, unless setjmp and longjmp are called from the same function.
- Since a frame pointer will be required in such a function, it is OK
- that the stack pointer is not restored. */
-
-#undef FRAME_POINTER_REQUIRED
-#define FRAME_POINTER_REQUIRED \
- (current_function_calls_setjmp || current_function_calls_longjmp)
-
-/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib. */
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- do { \
- int align = exact_log2 (ROUNDED); \
- if (align > 2) align = 2; \
- if (TARGET_SVR3_SHLIB) \
- data_section (); \
- else \
- bss_section (); \
- ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
- ASM_OUTPUT_LABEL ((FILE), (NAME)); \
- fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)); \
- } while (0)
-
-/* Define a few machine-specific details of the implementation of
- constructors.
-
- The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
- and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the
- constructor. */
-
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP ".section .init,\"x\""
-
-#define CTOR_LIST_BEGIN \
- asm (INIT_SECTION_ASM_OP); \
- asm ("pushl $0")
-#define CTOR_LIST_END CTOR_LIST_BEGIN
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tpushl $"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
diff --git a/gcc/config/i386/sysv4.h b/gcc/config/i386/sysv4.h
deleted file mode 100644
index 3f69827fd54..00000000000
--- a/gcc/config/i386/sysv4.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/* Target definitions for GNU compiler for Intel 80386 running System V.4
- Copyright (C) 1991 Free Software Foundation, Inc.
-
- Written by Ron Guilmette (rfg@netcom.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 "i386/i386.h" /* Base i386 target machine definitions */
-#include "i386/att.h" /* Use the i386 AT&T assembler syntax */
-#include "svr4.h" /* Definitions common to all SVR4 targets */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
-
-/* The svr4 ABI for the i386 says that records and unions are returned
- in memory. */
-
-#undef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE (TYPE) == BLKmode)
-
-/* Define which macros to predefine. __svr4__ is our extension. */
-/* This used to define X86, but james@bigtex.cactus.org says that
- is supposed to be defined optionally by user programs--not by default. */
-#define CPP_PREDEFINES \
- "-Di386 -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(i386) -Amachine(i386)"
-
-/* This is how to output assembly code to define a `float' constant.
- We always have to use a .long pseudo-op to do this because the native
- SVR4 ELF assembler is buggy and it generates incorrect values when we
- try to use the .float pseudo-op instead. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long value; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value); \
- if (sizeof (int) == sizeof (long)) \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value); \
- else \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value); \
- } while (0)
-
-/* This is how to output assembly code to define a `double' constant.
- We always have to use a pair of .long pseudo-ops to do this because
- the native SVR4 ELF assembler is buggy and it generates incorrect
- values when we try to use the the .double pseudo-op instead. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long value[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value); \
- if (sizeof (int) == sizeof (long)) \
- { \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \
- } \
- else \
- { \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \
- } \
- } while (0)
-
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long value[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value); \
- if (sizeof (int) == sizeof (long)) \
- { \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \
- fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[2]); \
- } \
- else \
- { \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \
- fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[2]); \
- } \
- } while (0)
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- output_file_directive (FILE, main_input_filename); \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- } while (0)
-
-/* Define the register numbers to be used in Dwarf debugging information.
- The SVR4 reference port C compiler uses the following register numbers
- in its Dwarf output code:
-
- 0 for %eax (gnu regno = 0)
- 1 for %ecx (gnu regno = 2)
- 2 for %edx (gnu regno = 1)
- 3 for %ebx (gnu regno = 3)
- 4 for %esp (gnu regno = 7)
- 5 for %ebp (gnu regno = 6)
- 6 for %esi (gnu regno = 4)
- 7 for %edi (gnu regno = 5)
-
- The following three DWARF register numbers are never generated by
- the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
- believes these numbers have these meanings.
-
- 8 for %eip (no gnu equivalent)
- 9 for %eflags (no gnu equivalent)
- 10 for %trapno (no gnu equivalent)
-
- It is not at all clear how we should number the FP stack registers
- for the x86 architecture. If the version of SDB on x86/svr4 were
- a bit less brain dead with respect to floating-point then we would
- have a precedent to follow with respect to DWARF register numbers
- for x86 FP registers, but the SDB on x86/svr4 is so completely
- broken with respect to FP registers that it is hardly worth thinking
- of it as something to strive for compatibility with.
-
- The version of x86/svr4 SDB I have at the moment does (partially)
- seem to believe that DWARF register number 11 is associated with
- the x86 register %st(0), but that's about all. Higher DWARF
- register numbers don't seem to be associated with anything in
- particular, and even for DWARF regno 11, SDB only seems to under-
- stand that it should say that a variable lives in %st(0) (when
- asked via an `=' command) if we said it was in DWARF regno 11,
- but SDB still prints garbage when asked for the value of the
- variable in question (via a `/' command).
-
- (Also note that the labels SDB prints for various FP stack regs
- when doing an `x' command are all wrong.)
-
- Note that these problems generally don't affect the native SVR4
- C compiler because it doesn't allow the use of -O with -g and
- because when it is *not* optimizing, it allocates a memory
- location for each floating-point variable, and the memory
- location is what gets described in the DWARF AT_location
- attribute for the variable in question.
-
- Regardless of the severe mental illness of the x86/svr4 SDB, we
- do something sensible here and we use the following DWARF
- register numbers. Note that these are all stack-top-relative
- numbers.
-
- 11 for %st(0) (gnu regno = 8)
- 12 for %st(1) (gnu regno = 9)
- 13 for %st(2) (gnu regno = 10)
- 14 for %st(3) (gnu regno = 11)
- 15 for %st(4) (gnu regno = 12)
- 16 for %st(5) (gnu regno = 13)
- 17 for %st(6) (gnu regno = 14)
- 18 for %st(7) (gnu regno = 15)
-*/
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 \
- : (n) == 1 ? 2 \
- : (n) == 2 ? 1 \
- : (n) == 3 ? 3 \
- : (n) == 4 ? 6 \
- : (n) == 5 ? 7 \
- : (n) == 6 ? 5 \
- : (n) == 7 ? 4 \
- : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
- : (-1))
-
-/* The routine used to output sequences of byte values. We use a special
- version of this for most svr4 targets because doing so makes the
- generated assembly code more compact (and thus faster to assemble)
- as well as more readable. Note that if we find subparts of the
- character sequence which end with NUL (and which are shorter than
- STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
- do \
- { \
- register unsigned char *_ascii_bytes = (unsigned char *) (STR); \
- register unsigned char *limit = _ascii_bytes + (LENGTH); \
- register unsigned bytes_in_chunk = 0; \
- for (; _ascii_bytes < limit; _ascii_bytes++) \
- { \
- register unsigned char *p; \
- if (bytes_in_chunk >= 64) \
- { \
- fputc ('\n', (FILE)); \
- bytes_in_chunk = 0; \
- } \
- for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
- continue; \
- if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
- { \
- if (bytes_in_chunk > 0) \
- { \
- fputc ('\n', (FILE)); \
- bytes_in_chunk = 0; \
- } \
- ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
- _ascii_bytes = p; \
- } \
- else \
- { \
- if (bytes_in_chunk == 0) \
- fprintf ((FILE), "\t.byte\t"); \
- else \
- fputc (',', (FILE)); \
- fprintf ((FILE), "0x%02x", *_ascii_bytes); \
- bytes_in_chunk += 5; \
- } \
- } \
- if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\n"); \
- } \
- while (0)
-
-/* This is how to output an element of a case-vector that is relative.
- This is only used for PIC code. See comments by the `casesi' insn in
- i386.md for an explanation of the expression this outputs. */
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
-
-/* Indicate that jump tables go in the text section. This is
- necessary when compiling PIC code. */
-
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* A C statement (sans semicolon) to output to the stdio stream
- FILE the assembler definition of uninitialized global DECL named
- NAME whose size is SIZE bytes and alignment is ALIGN bytes.
- Try to use asm_output_aligned_bss to implement this macro. */
-
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
- asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
diff --git a/gcc/config/i386/t-crtpic b/gcc/config/i386/t-crtpic
deleted file mode 100644
index ff81a9bef9c..00000000000
--- a/gcc/config/i386/t-crtpic
+++ /dev/null
@@ -1,10 +0,0 @@
-# The pushl in CTOR initialization interferes with frame pointer elimination.
-
-# We need to use -fPIC when we are using gcc to compile the routines in
-# crtstuff.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fPIC when compiling the
-# routines in crtstuff.c.
-
-CRTSTUFF_T_CFLAGS = -fPIC -fno-omit-frame-pointer
-TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/i386/t-crtstuff b/gcc/config/i386/t-crtstuff
deleted file mode 100644
index a202df6653f..00000000000
--- a/gcc/config/i386/t-crtstuff
+++ /dev/null
@@ -1,2 +0,0 @@
-# The pushl in CTOR initialization interferes with frame pointer elimination.
-CRTSTUFF_T_CFLAGS = -fno-omit-frame-pointer
diff --git a/gcc/config/i386/t-cygwin32 b/gcc/config/i386/t-cygwin32
deleted file mode 100644
index 4be2477fbc9..00000000000
--- a/gcc/config/i386/t-cygwin32
+++ /dev/null
@@ -1,7 +0,0 @@
-LIBGCC1 = libgcc1-asm.a
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = i386/cygwin32.asm
-LIB1ASMFUNCS = _chkstk
-
-winnt.o: $(srcdir)/config/i386/winnt.c
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt.c
diff --git a/gcc/config/i386/t-dgux b/gcc/config/i386/t-dgux
deleted file mode 100644
index 292331f22a9..00000000000
--- a/gcc/config/i386/t-dgux
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# target makefile for dgux
-#
-EXTRA_PARTS=crtbegin.o crtend.o
diff --git a/gcc/config/i386/t-go32 b/gcc/config/i386/t-go32
deleted file mode 100644
index 6160b7ec945..00000000000
--- a/gcc/config/i386/t-go32
+++ /dev/null
@@ -1,2 +0,0 @@
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
diff --git a/gcc/config/i386/t-i386bare b/gcc/config/i386/t-i386bare
deleted file mode 100644
index 2970fa71415..00000000000
--- a/gcc/config/i386/t-i386bare
+++ /dev/null
@@ -1,3 +0,0 @@
-# The i386 md has all of these taken care of, according to sef.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/i386/t-next b/gcc/config/i386/t-next
deleted file mode 100644
index ec6373f9cea..00000000000
--- a/gcc/config/i386/t-next
+++ /dev/null
@@ -1,9 +0,0 @@
-# libgcc1.c is not needed, since the standard library has these functions.
-LIBGCC1=libgcc1.null
-CROSS_LIBGCC1=libgcc1.null
-
-# Specify other dirs of system header files to be fixed.
-OTHER_FIXINCLUDES_DIRS= /LocalDeveloper/Headers
-
-# <limits.h> is sometimes in /usr/include/ansi/limits.h.
-LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h -o -f $(SYSTEM_HEADER_DIR)/ansi/limits.h ]
diff --git a/gcc/config/i386/t-osf b/gcc/config/i386/t-osf
deleted file mode 100644
index c996e0c9e77..00000000000
--- a/gcc/config/i386/t-osf
+++ /dev/null
@@ -1,2 +0,0 @@
-# If compiling with the osf gcc, avoid sharing code.
-TCFLAGS = -pic-none
diff --git a/gcc/config/i386/t-sco5 b/gcc/config/i386/t-sco5
deleted file mode 100644
index 8dd7c5670e9..00000000000
--- a/gcc/config/i386/t-sco5
+++ /dev/null
@@ -1,91 +0,0 @@
-# The pushl in CTOR initialization interferes with frame pointer elimination.
-CRTSTUFF_T_CFLAGS =-fno-omit-frame-pointer
-CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -melf -fPIC
-
-#
-# Becuase we can be compiling for either elf or coff, we need to create
-# special versions of libgcc.a. It IS possible for this not to be done
-# and let the SCO linker transform the coff objects (which are created
-# by default) into elf objects. However, this is inefficient. So,
-# we create a libgcc-elf.a, which is used in the specs in sco5.h.
-# These are the rules for doing that.
-#
-# NOTE: This is duplicated directly from Makefile.in. If you change it
-# there, be sure to change things here!
-#
-EXTRA_PARTS = libgcc-elf.a crtbegin.o crtend.o crtbeginS.o crtendS.o
-TAROUTOPTS = xpf
-
-libgcc1-elf.a: stamp-crtS libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
- -rm -f tmplibgcc1-elf.a
- for name in $(LIB1FUNCS); \
- do \
- echo $${name}; \
- rm -f $${name}$(objext); \
- $(OLDCC) -DIN_LIBGCC1 -dy $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- mv libgcc1$(objext) $${name}$(objext); \
- $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1-elf.a $${name}$(objext); \
- rm -f $${name}$(objext); \
- done
- for file in .. $(LIB1FUNCS_EXTRA); \
- do \
- if [ x$${file} != x.. ]; then \
- name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
- echo $${name}; \
- if [ $${name}.asm = $${file} ]; then \
- cp $${file} $${name}.s || exit 1; file=$${name}.s; \
- else true; fi; \
- $(OLDCC) -DIN_LIBGCC1 -dy $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1-elf.a $${name}$(objext); \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- rm -f $${name}.s $${name}$(objext); \
- else true; \
- fi; \
- done
- -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc1-elf.a; else true; fi
- mv tmplibgcc1-elf.a libgcc1-elf.a
-
-libgcc2-elf.a: stamp-crtS libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
- machmode.h longlong.h gbl-ctors.h config.status
- -rm -f tmplibgcc2-elf.a
- for name in $(LIB2FUNCS); \
- do \
- echo $${name}; \
- $(GCC_FOR_TARGET) -melf $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
- $(srcdir)/libgcc2.c -o $${name}$(objext); \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- $(AR) $(AR_FLAGS) tmplibgcc2-elf.a $${name}$(objext); \
- rm -f $${name}$(objext); \
- done
- for file in .. $(LIB2FUNCS_EXTRA); \
- do \
- if [ x$${file} != x.. ]; then \
- name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
- oname=` echo $${name} | sed -e 's,.*/,,'`; \
- echo $${name}; \
- if [ $${name}.asm = $${file} ]; then \
- cp $${file} $${name}.s || exit 1; file=$${name}.s; \
- else true; fi; \
- $(GCC_FOR_TARGET) -melf $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
- if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
- $(AR) $(AR_FLAGS) tmplibgcc2-elf.a $${oname}$(objext); \
- rm -f $${name}.s $${oname}$(objext); \
- else true; \
- fi; \
- done
- mv tmplibgcc2-elf.a libgcc2-elf.a
-
-# Combine the various libraries into a single library, libgcc.a.
-libgcc-elf.a: libgcc1-elf.a libgcc2-elf.a
- -rm -rf tmplibgcc-elf.a libgcc-elf.a tmpcopy
- mkdir tmpcopy
- -(cd tmpcopy; $(AR) x ../libgcc1-elf.a)
- -(cd tmpcopy; chmod +w * > /dev/null 2>&1)
- -(cd tmpcopy; $(AR) x ../libgcc2-elf.a)
- (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc-elf.a *$(objext))
- rm -rf tmpcopy
- -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc-elf.a; else true; fi
- mv tmplibgcc-elf.a libgcc-elf.a
-
diff --git a/gcc/config/i386/t-sol2 b/gcc/config/i386/t-sol2
deleted file mode 100644
index 6c1eafa24d3..00000000000
--- a/gcc/config/i386/t-sol2
+++ /dev/null
@@ -1,35 +0,0 @@
-# we need to supply our own assembly versions of libgcc1.c files,
-# since the user may not have native 'cc' available
-
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-
-# gmon build rule:
-gmon.o: $(srcdir)/config/i386/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
- -c $(srcdir)/config/i386/gmon-sol2.c -o gmon.o
-
-# Assemble startup files.
-# Apparently Sun believes that assembler files don't need comments, because no
-# single ASCII character is valid (tried them all). So we manually strip out
-# the comments with sed. This bug may only be in the Early Access releases.
-gcrt1.o: $(srcdir)/config/i386/sol2-gc1.asm
- sed -e '/^!/d' <$(srcdir)/config/i386/sol2-gc1.asm >gcrt1.s
- $(AS) -o gcrt1.o gcrt1.s
-crt1.o: $(srcdir)/config/i386/sol2-c1.asm
- sed -e '/^!/d' <$(srcdir)/config/i386/sol2-c1.asm >crt1.s
- $(GCC_FOR_TARGET) -c -o crt1.o crt1.s
-crti.o: $(srcdir)/config/i386/sol2-ci.asm
- sed -e '/^!/d' <$(srcdir)/config/i386/sol2-ci.asm >crti.s
- $(GCC_FOR_TARGET) -c -o crti.o crti.s
-crtn.o: $(srcdir)/config/i386/sol2-cn.asm
- sed -e '/^!/d' <$(srcdir)/config/i386/sol2-cn.asm >crtn.s
- $(GCC_FOR_TARGET) -c -o crtn.o crtn.s
-
-# We need to use -fPIC when we are using gcc to compile the routines in
-# crtstuff.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fPIC when compiling the
-# routines in crtstuff.c.
-
-CRTSTUFF_T_CFLAGS = -fPIC
diff --git a/gcc/config/i386/t-svr3dbx b/gcc/config/i386/t-svr3dbx
deleted file mode 100644
index 51711379191..00000000000
--- a/gcc/config/i386/t-svr3dbx
+++ /dev/null
@@ -1,7 +0,0 @@
-# gas 1.38.1 supporting dbx-in-coff requires a link script.
-
-svr3.ifile: $(srcdir)/config/i386/svr3.ifile
- rm -f svr3.ifile; cp $(srcdir)/config/i386/svr3.ifile .
-
-svr3z.ifile: $(srcdir)/config/i386/svr3z.ifile
- rm -f svr3z.ifile; cp $(srcdir)/config/i386/svr3z.ifile .
diff --git a/gcc/config/i386/t-vsta b/gcc/config/i386/t-vsta
deleted file mode 100644
index 6160b7ec945..00000000000
--- a/gcc/config/i386/t-vsta
+++ /dev/null
@@ -1,2 +0,0 @@
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
diff --git a/gcc/config/i386/t-winnt b/gcc/config/i386/t-winnt
deleted file mode 100644
index 1e3557c1822..00000000000
--- a/gcc/config/i386/t-winnt
+++ /dev/null
@@ -1,6 +0,0 @@
-winnt.o: $(srcdir)/config/i386/winnt.c
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt.c
-oldnames.o: $(srcdir)/config/winnt/oldnames.c
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/winnt/oldnames.c
-spawnv.o: $(srcdir)/config/winnt/spawnv.c
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/winnt/spawnv.c
diff --git a/gcc/config/i386/unix.h b/gcc/config/i386/unix.h
deleted file mode 100644
index c74911c7107..00000000000
--- a/gcc/config/i386/unix.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Definitions for Unix assembler syntax for the Intel 80386.
- Copyright (C) 1988, 1994 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 defines the aspects of assembler syntax
- that are the same for all the i386 Unix systems
- (though they may differ in non-Unix systems). */
-
-/* Define some concatenation macros to concatenate an opcode
- and one, two or three operands. In other assembler syntaxes
- they may alter the order of ther operands. */
-
-/* Note that the other files fail to use these
- in some of the places where they should. */
-
-#if defined(__STDC__) || defined(ALMOST_STDC)
-#define AS2(a,b,c) #a " " #b "," #c
-#define AS2C(b,c) " " #b "," #c
-#define AS3(a,b,c,d) #a " " #b "," #c "," #d
-#define AS1(a,b) #a " " #b
-#else
-#define AS1(a,b) "a b"
-#define AS2(a,b,c) "a b,c"
-#define AS2C(b,c) " b,c"
-#define AS3(a,b,c,d) "a b,c,d"
-#endif
-
-/* Define macro used to output shift-double opcodes when the shift
- count is in %cl. Some assemblers require %cl as an argument;
- some don't. This macro controls what to do: by default, don't
- print %cl. */
-#define SHIFT_DOUBLE_OMITS_COUNT 1
-#define AS3_SHIFT_DOUBLE(a,b,c,d) \
- (SHIFT_DOUBLE_OMITS_COUNT ? AS2 (a,c,d) : AS3 (a,b,c,d))
-
-/* Output the size-letter for an opcode.
- CODE is the letter used in an operand spec (L, B, W, S or Q).
- CH is the corresponding lower case letter
- (except if CODE is `Q' then CH is `l', unless GAS_MNEMONICS). */
-#define PUT_OP_SIZE(CODE,CH,FILE) putc (CH,(FILE))
-
-/* Opcode suffix for fullword insn. */
-#define L_SIZE "l"
-
-/* Prefix for register names in this syntax. */
-#define RP "%"
-
-/* Prefix for immediate operands in this syntax. */
-#define IP "$"
-
-/* Indirect call instructions should use `*'. */
-#define USE_STAR 1
-
-/* Prefix for a memory-operand X. */
-#define PRINT_PTR(X, FILE)
-
-/* Delimiters that surround base reg and index reg. */
-#define ADDR_BEG(FILE) putc('(', (FILE))
-#define ADDR_END(FILE) putc(')', (FILE))
-
-/* Print an index register (whose rtx is IREG). */
-#define PRINT_IREG(FILE,IREG) \
- do \
- { fputs (",", (FILE)); PRINT_REG ((IREG), 0, (FILE)); } \
- while (0)
-
-/* Print an index scale factor SCALE. */
-#define PRINT_SCALE(FILE,SCALE) \
- if ((SCALE) != 1) fprintf ((FILE), ",%d", (SCALE))
-
-/* Print a base/index combination.
- BREG is the base reg rtx, IREG is the index reg rtx,
- and SCALE is the index scale factor (an integer). */
-
-#define PRINT_B_I_S(BREG,IREG,SCALE,FILE) \
- { ADDR_BEG (FILE); \
- if (BREG) PRINT_REG ((BREG), 0, (FILE)); \
- if ((IREG) != 0) \
- { PRINT_IREG ((FILE), (IREG)); \
- PRINT_SCALE ((FILE), (SCALE)); } \
- ADDR_END (FILE); }
-
-/* Define the syntax of pseudo-ops, labels and comments. */
-
-/* String containing the assembler's comment-starter. */
-
-#define ASM_COMMENT_START "/"
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "/APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "/NO_APP\n"
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable (initialized) data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* Output before writable (uninitialized) data. */
-
-#define BSS_SECTION_ASM_OP ".bss"
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
-
-/* By default, target has a 80387, uses IEEE compatible arithmetic,
- and returns float values in the 387, ie,
- (TARGET_80387 | TARGET_IEEE_FP | TARGET_FLOAT_RETURNS_IN_80387) */
-
-#define TARGET_DEFAULT 0301
-
-/* Floating-point return values come in the FP register. */
-
-#define VALUE_REGNO(MODE) \
- (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- && TARGET_FLOAT_RETURNS_IN_80387 ? FIRST_FLOAT_REG : 0)
-
-/* 1 if N is a possible register number for a function value. */
-
-#define FUNCTION_VALUE_REGNO_P(N) \
- ((N) == 0 || ((N)== FIRST_FLOAT_REG && TARGET_FLOAT_RETURNS_IN_80387))
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
- Used for C++ multiple inheritance. */
-#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
-do { \
- tree parm; \
- \
- if (i386_regparm > 0) \
- parm = TYPE_ARG_TYPES (TREE_TYPE (function)); \
- else \
- parm = NULL_TREE; \
- for (; parm; parm = TREE_CHAIN (parm)) \
- if (TREE_VALUE (parm) == void_type_node) \
- break; \
- fprintf (FILE, "\taddl $%d,%s\n", DELTA, \
- parm ? "%eax" \
- : aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? "8(%esp)" \
- : "4(%esp)"); \
- \
- if (flag_pic) \
- { \
- rtx xops[2]; \
- xops[0] = pic_offset_table_rtx; \
- xops[1] = (rtx) gen_label_rtx (); \
- \
- if (i386_regparm > 2) \
- abort (); \
- output_asm_insn ("push%L0 %0", xops); \
- output_asm_insn (AS1 (call,%P1), xops); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", CODE_LABEL_NUMBER (xops[1])); \
- output_asm_insn (AS1 (pop%L0,%0), xops); \
- output_asm_insn ("addl $_GLOBAL_OFFSET_TABLE_+[.-%P1],%0", xops); \
- fprintf (FILE, "\tmovl "); \
- assemble_name \
- (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
- fprintf (FILE, "@GOT(%%ebx),%%ecx\n\tpopl %%ebx\n\tjmp *%%ecx\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tjmp "); \
- assemble_name \
- (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
- fprintf (FILE, "\n"); \
- } \
-} while (0)
diff --git a/gcc/config/i386/v3gas.h b/gcc/config/i386/v3gas.h
deleted file mode 100644
index fe558d265b4..00000000000
--- a/gcc/config/i386/v3gas.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Definitions for Intel 386 running system V, using gas.
- Copyright (C) 1992, 1995 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. */
-
-#include <i386/gas.h>
-
-/* Add stuff that normally comes from i386v.h */
-
-/* longjmp may fail to restore the registers if called from the same
- function that called setjmp. To compensate, the compiler avoids
- putting variables in registers in functions that use both setjmp
- and longjmp. */
-
-#define NON_SAVING_SETJMP \
- (current_function_calls_setjmp && current_function_calls_longjmp)
-
-/* longjmp may fail to restore the stack pointer if the saved frame
- pointer is the same as the caller's frame pointer. Requiring a frame
- pointer in any function that calls setjmp or longjmp avoids this
- problem, unless setjmp and longjmp are called from the same function.
- Since a frame pointer will be required in such a function, it is OK
- that the stack pointer is not restored. */
-
-#undef FRAME_POINTER_REQUIRED
-#define FRAME_POINTER_REQUIRED \
- (current_function_calls_setjmp || current_function_calls_longjmp)
-
-/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- do { \
- int align = exact_log2 (ROUNDED); \
- if (align > 2) align = 2; \
- if (TARGET_SVR3_SHLIB) \
- { \
- data_section (); \
- ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
- ASM_OUTPUT_LABEL ((FILE), (NAME)); \
- fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)); \
- } \
- else \
- { \
- fputs (".lcomm ", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u\n", (ROUNDED)); \
- } \
- } while (0)
-
-/* Add stuff that normally comes from i386v.h via svr3.h */
-
-/* Define the actual types of some ANSI-mandated types. These
- definitions should work for most SVR3 systems. */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
diff --git a/gcc/config/i386/vsta.h b/gcc/config/i386/vsta.h
deleted file mode 100644
index ee7fab9173f..00000000000
--- a/gcc/config/i386/vsta.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Configuration for an i386 running VSTa micro-kernel.
- Copyright (C) 1994 Free Software Foundation, Inc.
- Contributed by Rob Savoye (rob@cygnus.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. */
-
-#define YES_UNDERSCORES
-
-#include "i386/gas.h"
-
-#ifdef CPP_PREDEFINES
-#undef CPP_PREDEFINES
-#endif
-#define CPP_PREDEFINES "-Dunix -Di386 -DVSTA \
- -Asystem(unix) -Asystem(vsta) -Acpu(i386) -Amachine(i386)"
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTOR_SECTION_FUNCTION \
- DTOR_SECTION_FUNCTION
-
-#define CTOR_SECTION_FUNCTION \
-void \
-ctor_section () \
-{ \
- if (in_section != in_ctor) \
- { \
- fprintf (asm_out_file, "\t.section .ctor\n"); \
- in_section = in_ctor; \
- } \
-}
-
-#define DTOR_SECTION_FUNCTION \
-void \
-dtor_section () \
-{ \
- if (in_section != in_dtor) \
- { \
- fprintf (asm_out_file, "\t.section .dtor\n"); \
- in_section = in_dtor; \
- } \
-}
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctor_section (); \
- fprintf (FILE, "%s\t", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtor_section (); \
- fprintf (FILE, "%s\t", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-
diff --git a/gcc/config/i386/win-nt.h b/gcc/config/i386/win-nt.h
deleted file mode 100644
index 60c0bb6a1f6..00000000000
--- a/gcc/config/i386/win-nt.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for
- Windows NT 3.x on an i386.
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (drupp@cs.washington.edu).
-
-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. */
-
-#define YES_UNDERSCORES
-
-#include "i386/gas.h"
-
-#ifdef CPP_PREDEFINES
-#undef CPP_PREDEFINES
-#endif
-#define CPP_PREDEFINES "-Dunix -Di386 -DWIN32 -D_WIN32 \
- -DWINNT -D_M_IX86=300 -D_X86_=1 -D__STDC__=0 -DALMOST_STDC -D_MSC_VER=800 \
- -D__stdcall=__attribute__((__stdcall__)) \
- -D__cdecl=__attribute__((__cdecl__)) \
- -D_cdecl=__attribute__((__cdecl__)) \
- -Asystem(unix) -Asystem(winnt) -Acpu(i386) -Amachine(i386)"
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-#define WCHAR_UNSIGNED 1
-#define WCHAR_TYPE_SIZE 16
-#define WCHAR_TYPE "short unsigned int"
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-#define HAVE_ATEXIT 1
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTOR_SECTION_FUNCTION \
- DTOR_SECTION_FUNCTION
-
-#define CTOR_SECTION_FUNCTION \
-void \
-ctor_section () \
-{ \
- if (in_section != in_ctor) \
- { \
- fprintf (asm_out_file, "\t.section .ctor\n"); \
- in_section = in_ctor; \
- } \
-}
-
-#define DTOR_SECTION_FUNCTION \
-void \
-dtor_section () \
-{ \
- if (in_section != in_dtor) \
- { \
- fprintf (asm_out_file, "\t.section .dtor\n"); \
- in_section = in_dtor; \
- } \
-}
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctor_section (); \
- fprintf (FILE, "%s\t", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtor_section (); \
- fprintf (FILE, "%s\t", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
- so that we may access it directly in the GOT.
-
- On i386 running Windows NT, modify the assembler name with a suffix
- consisting of an atsign (@) followed by string of digits that represents
- the number of bytes of arguments passed to the function, if it has the
- attribute STDCALL. */
-
-#ifdef ENCODE_SECTION_INFO
-#undef ENCODE_SECTION_INFO
-#define ENCODE_SECTION_INFO(DECL) \
-do \
- { \
- if (flag_pic) \
- { \
- rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
- = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- || ! TREE_PUBLIC (DECL)); \
- } \
- if (TREE_CODE (DECL) == FUNCTION_DECL) \
- if (lookup_attribute ("stdcall", \
- TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
- XEXP (DECL_RTL (DECL), 0) = \
- gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \
- } \
-while (0)
-#endif
-
-/* The global __fltused is necessary to cause the printf/scanf routines
- for outputting/inputting floating point numbers to be loaded. Since this
- is kind of hard to detect, we just do it all the time. */
-
-#ifdef ASM_FILE_START
-#undef ASM_FILE_START
-#endif
-#define ASM_FILE_START(FILE) \
- do { fprintf (FILE, "\t.file\t"); \
- output_quoted_string (FILE, dump_base_name); \
- fprintf (FILE, "\n"); \
- fprintf (FILE, ".global\t__fltused\n"); \
- } while (0)
-
-/* if the switch "-mwindows" is passed to ld, then specify to the Microsoft
- linker the proper switches and libraries to build a graphical program */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{mwindows:-subsystem windows -e _WinMainCRTStartup \
- USER32.LIB%s GDI32.LIB%s COMDLG32.LIB%s WINSPOOL.LIB%s} \
- %{!mwindows:-subsystem console -e _mainCRTStartup} \
- %{mcrtmt:LIBCMT.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \
- %{!mcrtmt:LIBC.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \
- %{v}"
-
-#include "winnt/win-nt.h"
-
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
deleted file mode 100644
index 9920b8d4f8d..00000000000
--- a/gcc/config/i386/winnt.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Subroutines for insn-output.c for Windows NT.
- Contributed by Douglas Rupp (drupp@cs.washington.edu)
- Copyright (C) 1995 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. */
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "output.h"
-#include "tree.h"
-#include "flags.h"
-
-/* Return string which is the former assembler name modified with a
- suffix consisting of an atsign (@) followed by the number of bytes of
- arguments */
-
-char *
-gen_stdcall_suffix (decl)
- tree decl;
-{
- int total = 0;
- char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
- char *newsym;
-
- if (TYPE_ARG_TYPES (TREE_TYPE (decl)))
- if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (decl))))
- == void_type_node)
- {
- tree formal_type = TYPE_ARG_TYPES (TREE_TYPE (decl));
-
- while (TREE_VALUE (formal_type) != void_type_node)
- {
- int parm_size
- = TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type)));
- /* Must round up to include padding. This is done the same
- way as in store_one_arg. */
- parm_size = ((parm_size + PARM_BOUNDARY - 1)
- / PARM_BOUNDARY * PARM_BOUNDARY);
- total += parm_size;
- formal_type = TREE_CHAIN (formal_type);
- }
- }
-
- newsym = xmalloc (strlen (asmname) + 10);
- sprintf (newsym, "%s@%d", asmname, total/BITS_PER_UNIT);
- return IDENTIFIER_POINTER (get_identifier (newsym));
-}
-
diff --git a/gcc/config/i386/x-aix b/gcc/config/i386/x-aix
deleted file mode 100644
index b191e48fd0f..00000000000
--- a/gcc/config/i386/x-aix
+++ /dev/null
@@ -1,12 +0,0 @@
-# There is an alloca in -lbsd, but it is limited to 32K
-ALLOCA = alloca.o
-
-# If you are running out of memory while compiling gcc, with the standard
-# /bin/cc uncomment MALLOCLIB line. That version of malloc is slower but
-# has less overhead than the one in libc.
-#MALLOCLIB = -lmalloc
-
-# Uncomment out the next line if you want to link with the shareable libc_s.
-#CLIB_S = -lc_s
-
-CLIB = -lld $(MALLOCLIB) $(CLIB_S)
diff --git a/gcc/config/i386/x-cygwin32 b/gcc/config/i386/x-cygwin32
deleted file mode 100644
index 5e796a0e916..00000000000
--- a/gcc/config/i386/x-cygwin32
+++ /dev/null
@@ -1,4 +0,0 @@
-# Don't run fixproto
-STMP_FIXPROTO =
-# Don't need collect2
-USE_COLLECT2 =
diff --git a/gcc/config/i386/x-dgux b/gcc/config/i386/x-dgux
deleted file mode 100644
index 83d3455b162..00000000000
--- a/gcc/config/i386/x-dgux
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# host is ix86 running dgux
-#
-CC = /bin/gcc
-X_CFLAGS = -O -mstandard -mlegend
-BOOT_CFLAGS = -O2 -g -mstandard -mlegend $(CFLAGS)
-CLIB = -lw32
-RANLIB = true
-INSTALL_HEADERS =
-STMP_FIXPROTO =
-
diff --git a/gcc/config/i386/x-isc b/gcc/config/i386/x-isc
deleted file mode 100644
index ea65ec888a3..00000000000
--- a/gcc/config/i386/x-isc
+++ /dev/null
@@ -1,3 +0,0 @@
-CLIB = -lPW -lcposix
-X_CFLAGS = -D_POSIX_SOURCE
-ENQUIRE_LDFLAGS = -posix $(LDFLAGS)
diff --git a/gcc/config/i386/x-isc3 b/gcc/config/i386/x-isc3
deleted file mode 100644
index 527cca8132b..00000000000
--- a/gcc/config/i386/x-isc3
+++ /dev/null
@@ -1,4 +0,0 @@
-CLIB = -lPW
-# One person said it needs -DPOSIX_JC, but daa@CERF.NET says no.
-X_CFLAGS = -D_SYSV3 -Xp
-ENQUIRE_LDFLAGS = $(LDFLAGS)
diff --git a/gcc/config/i386/x-ncr3000 b/gcc/config/i386/x-ncr3000
deleted file mode 100644
index 4ae168b1fe5..00000000000
--- a/gcc/config/i386/x-ncr3000
+++ /dev/null
@@ -1,34 +0,0 @@
-# Makefile additions for the NCR3000 as host system.
-
-# Using -O with the AT&T compiler fails, with a message about a missing
-# /usr/ccs/lib/optim pass. So override the default in Makefile.in
-
-CCLIBFLAGS=
-
-## Supposedly not needed now that xm-sysv4.h includes alloc.h for Metaware.
-### NCR3000 ships with a MetaWare compiler installed as CC, which chokes and
-### dies all over the place on GCC source. However, the AT&T compiler,
-### crusty as it is, can be used to bootstrap GCC. It can be found in
-### /usr/ccs/ATT/cc. It is also used to compile the things that should
-### not be compiled with GCC.
-##
-##CC = /usr/ccs/ATT/cc
-##OLDCC = /usr/ccs/ATT/cc
-
-# The rest is just x-i386v4.
-
-# Some versions of SVR4 have an alloca in /usr/ucblib/libucb.a, and if we are
-# careful to link that in after libc we can use it, but since newer versions of
-# SVR4 are dropping libucb, it is better to just use the portable C version for
-# bootstrapping. Do this by defining ALLOCA.
-
-ALLOCA = alloca.o
-
-# We used to build all stages *without* shared libraries because that may make
-# debugging the compiler easier (until there is a GDB which supports
-# both Dwarf *and* svr4 shared libraries).
-
-# But james@bigtex.cactus.org says that redefining GCC_CFLAGS causes trouble,
-# and that it is easy enough to debug using shared libraries.
-# CCLIBFLAGS=-Bstatic -dn -g
-# GCC_CFLAGS=-static -g -O2 -B./
diff --git a/gcc/config/i386/x-next b/gcc/config/i386/x-next
deleted file mode 100644
index a16b918e2d3..00000000000
--- a/gcc/config/i386/x-next
+++ /dev/null
@@ -1,3 +0,0 @@
-# Make assignments for compiling on NeXT with their compiler version.
-CC=cc -traditional-cpp
-OLDCC=cc -traditional-cpp
diff --git a/gcc/config/i386/x-osfrose b/gcc/config/i386/x-osfrose
deleted file mode 100644
index 27c36fe4fe7..00000000000
--- a/gcc/config/i386/x-osfrose
+++ /dev/null
@@ -1,28 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds).
-
-BUILD =
-CC = $(OLDCC)
-CLIB = -lld
-X_CFLAGS = $(DEB_OPT) $(MSTATS) $(X_DEFINES)
-X_CFLAGS_NODEBUG = $(NO_DEBUG) $(MSTATS) $(OPT) $(PROFILE) $(X_DEFINES) $(XCFLAGS)
-XCFLAGS = $(SHLIB)
-CPP_ABORT = # -Dabort=fancy_abort
-CPPFLAGS = $(CPP_ABORT) $(SYSTEM_INCLUDES)
-DEB_OPT = $(OPT) $(DEBUG) $(PROFILE)
-DEBUG =
-DEBUG_COLLECT = # -DDEBUG
-CCLIBFLAGS = -O -DNO_HALF_PIC
-GCC_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -B./ -DPOSIX -DNO_HALF_PIC
-INSTALL = installbsd -c
-LDFLAGS =
-MSTATS = # -mstats
-OLDCC = /usr/ccs/gcc/gcc
-OPT = -O
-PROFILE =
-SHLIB = -pic-none
-SYSTEM_INCLUDES = # -I${BUILD}/usr/include
-X_DEFINES = -Dvfork=fork
diff --git a/gcc/config/i386/x-sco b/gcc/config/i386/x-sco
deleted file mode 100644
index f7f14e9f7c0..00000000000
--- a/gcc/config/i386/x-sco
+++ /dev/null
@@ -1,7 +0,0 @@
-RANLIB = :
-RANLIB_TEST = false
-CC = rcc $(RCCFLAGS)
-OLDCC = rcc $(RCCFLAGS)
-RCCFLAGS = -Dunix -Di386 -DM_UNIX -DM_I386 -DNULL=0
-CCLIBFLAGS =
-CLIB = -lmalloc -lPW
diff --git a/gcc/config/i386/x-sco4 b/gcc/config/i386/x-sco4
deleted file mode 100644
index be6080f8893..00000000000
--- a/gcc/config/i386/x-sco4
+++ /dev/null
@@ -1,10 +0,0 @@
-RANLIB = :
-RANLIB_TEST = false
-CC = rcc $(RCCFLAGS)
-OLDCC = rcc $(RCCFLAGS)
-RCCFLAGS = -Dunix -Di386 -DM_UNIX -DM_I386 -DNULL=0
-CCLIBFLAGS =
-CLIB = -lmalloc -lPW
-
-# See all the declarations.
-FIXPROTO_DEFINES = -D_XOPEN_SOURCE
diff --git a/gcc/config/i386/x-sco5 b/gcc/config/i386/x-sco5
deleted file mode 100644
index ada44eda382..00000000000
--- a/gcc/config/i386/x-sco5
+++ /dev/null
@@ -1,9 +0,0 @@
-RANLIB = :
-RANLIB_TEST = false
-CC = cc
-OLDCC = cc
-CCLIBFLAGS =
-CLIB = -lPW
-
-# See all the declarations.
-FIXPROTO_DEFINES = -D_XOPEN_SOURCE -D_POSIX_C_SOURCE=2
diff --git a/gcc/config/i386/x-sysv3 b/gcc/config/i386/x-sysv3
deleted file mode 100644
index a1391df851c..00000000000
--- a/gcc/config/i386/x-sysv3
+++ /dev/null
@@ -1 +0,0 @@
-CLIB=-lPW
diff --git a/gcc/config/i386/x-vsta b/gcc/config/i386/x-vsta
deleted file mode 100644
index e2279a4b59a..00000000000
--- a/gcc/config/i386/x-vsta
+++ /dev/null
@@ -1 +0,0 @@
-CLIB=-lm
diff --git a/gcc/config/i386/xm-aix.h b/gcc/config/i386/xm-aix.h
deleted file mode 100644
index 5e5d40281a1..00000000000
--- a/gcc/config/i386/xm-aix.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Configuration for GNU C-compiler for IBM PS/2 running AIX/386.
- Copyright (C) 1988, 1993 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. */
-
-#define USG
-
-#undef TRUE
-#undef FALSE
-
-#include "i386/xm-i386.h"
-
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-
-/* If not compiled with GNU C, use the portable alloca. */
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-#endif
-
-#define HAVE_PUTENV
diff --git a/gcc/config/i386/xm-cygwin32.h b/gcc/config/i386/xm-cygwin32.h
deleted file mode 100644
index b3f4c04b5fb..00000000000
--- a/gcc/config/i386/xm-cygwin32.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Configuration for GNU C-compiler for hosting on Windows NT.
- using a unix style C library.
- Copyright (C) 1995, 1996, 1997 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. */
-
-#define NO_STAB_H
-#define HAVE_STRERROR
-#define HAVE_RUSAGE
-#define HAVE_FILE_H
-#define EXECUTABLE_SUFFIX ".exe"
-
-/* Even though we support "/", allow "\" since everybody tests both. */
-#define DIR_SEPARATOR '\\'
diff --git a/gcc/config/i386/xm-dos.h b/gcc/config/i386/xm-dos.h
deleted file mode 100644
index 1dd0c013b1d..00000000000
--- a/gcc/config/i386/xm-dos.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "i386/xm-i386.h"
-
-/* Inhibit cccp.c's definition of putenv. */
-#define HAVE_PUTENV
-
-/* Use semicolons to separate elements of a path. */
-#define PATH_SEPARATOR ';'
-
-/* Use backslashs to separate levels of directory. */
-#define DIR_SEPARATOR '\\'
-
-/* Suffix for executable file names. */
-#define EXECUTABLE_SUFFIX ".exe"
-
-#define MKTEMP_EACH_FILE 1
-
-#define NO_PRECOMPILES 1
-
-/* sys_errlist proto in cccp.c doesn't match djgpp */
-#define HAVE_STRERROR
diff --git a/gcc/config/i386/xm-go32.h b/gcc/config/i386/xm-go32.h
deleted file mode 100644
index d8182132ac6..00000000000
--- a/gcc/config/i386/xm-go32.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Configuration for GNU C-compiler for Intel 80386 running GO32.
- Copyright (C) 1988, 1996 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. */
-
-#define __MSDOS__ 1
-
-#define NO_STAB_H
-
-#include "i386/xm-i386.h"
-
-/* Use semicolons to separate elements of a path. */
-#define PATH_SEPARATOR ';'
diff --git a/gcc/config/i386/xm-i386.h b/gcc/config/i386/xm-i386.h
deleted file mode 100644
index acc16576709..00000000000
--- a/gcc/config/i386/xm-i386.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Configuration for GNU C-compiler for Intel 80386.
- Copyright (C) 1988, 1993 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. */
-
-#ifndef i386
-#define i386
-#endif
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-
-#include "tm.h"
diff --git a/gcc/config/i386/xm-isc.h b/gcc/config/i386/xm-isc.h
deleted file mode 100644
index 7a0a47c4df5..00000000000
--- a/gcc/config/i386/xm-isc.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "i386/xm-sysv3.h"
-
-#ifndef REAL_ARITHMETIC
-#define REAL_VALUE_ATOF(x, mode) strtod ((x), (char **)0)
-extern double strtod ();
-#endif
diff --git a/gcc/config/i386/xm-lynx.h b/gcc/config/i386/xm-lynx.h
deleted file mode 100644
index 359e41bbe24..00000000000
--- a/gcc/config/i386/xm-lynx.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Configuration for GNU C-compiler for i386 platforms running LynxOS.
- Copyright (C) 1995 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. */
-
-#include <xm-lynx.h>
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-
-#include "tm.h"
diff --git a/gcc/config/i386/xm-next.h b/gcc/config/i386/xm-next.h
deleted file mode 100644
index bf903281a0d..00000000000
--- a/gcc/config/i386/xm-next.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "i386/xm-i386.h"
-
-/* malloc does better with chunks the size of a page. */
-
-#define OBSTACK_CHUNK_SIZE (getpagesize ())
diff --git a/gcc/config/i386/xm-os2.h b/gcc/config/i386/xm-os2.h
deleted file mode 100644
index 5ff2899cfd5..00000000000
--- a/gcc/config/i386/xm-os2.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Configuration for GNU compiler
- for an Intel i386 or later processor running OS/2 2.x.
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
- Contributed by Samuel Figueroa (figueroa@cs.nyu.edu)
-
-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 OS2
-#define OS2
-#endif
-
-#ifdef __IBMC__
-#include <stdlib.h> /* this defines alloca */
-#define USG
-#define ONLY_INT_FIELDS
-#define HAVE_PUTENV
-#define USE_PROTOTYPES 1
-#define bcmp(a,b,c) memcmp (a,b,c)
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define index strchr
-#define rindex strrchr
-#define strcasecmp stricmp
-#define kill(a,b) raise(b)
-#define mktemp tmpnam
-#else
-#define ____386BSD____
-int spawnv (int modeflag, char *path, char *argv[]);
-int spawnvp (int modeflag, char *path, char *argv[]);
-#endif /* __IBMC__ */
-
-#ifndef PATH_SEPARATOR
-#define PATH_SEPARATOR ';'
-#endif
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '\\'
-#endif
-
-#define EXECUTABLE_SUFFIX ".exe"
-#define OBJECT_SUFFIX ".obj"
-
-#include "i386/xm-i386.h"
diff --git a/gcc/config/i386/xm-osf.h b/gcc/config/i386/xm-osf.h
deleted file mode 100644
index fda50d98f55..00000000000
--- a/gcc/config/i386/xm-osf.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Configuration for GNU C-compiler for 386 running OSF/1
- Copyright (C) 1994 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. */
-
-#undef TRUE
-#undef FALSE
-
-#include "i386/xm-i386.h"
-
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-
-#define HAVE_PUTENV
-#define HAVE_VPRINTF
-
diff --git a/gcc/config/i386/xm-sco.h b/gcc/config/i386/xm-sco.h
deleted file mode 100644
index 472ce047cf8..00000000000
--- a/gcc/config/i386/xm-sco.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Configuration for GCC for Intel i386 running SCO. */
-
-#include "i386/xm-sysv3.h"
-
-/* On SCO 3.2.1, ldexp rejects values outside [0.5, 1). */
-
-#define BROKEN_LDEXP
-
-/* Big buffers improve performance. */
-
-#define IO_BUFFER_SIZE (0x8000 - 1024)
-
-/* SCO has a very small ARG_MAX. */
-#define SMALL_ARG_MAX
-
-#ifndef __GNUC__
-/* The SCO compiler gets it wrong, and treats enumerated bitfields
- as signed quantities, making it impossible to use an 8-bit enum
- for compiling GNU C++. */
-#define ONLY_INT_FIELDS 1
-#define CODE_FIELD_BUG 1
-#endif
-
-/* SCO lacks sys_siglist. */
-#define NO_SYS_SIGLIST
diff --git a/gcc/config/i386/xm-sco5.h b/gcc/config/i386/xm-sco5.h
deleted file mode 100644
index 27adf86490e..00000000000
--- a/gcc/config/i386/xm-sco5.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Configuration for GCC for Intel i386 running SCO. */
-
-#include "i386/xm-sysv3.h"
-
-/* Big buffers improve performance. */
-
-#define IO_BUFFER_SIZE (0x8000 - 1024)
-
diff --git a/gcc/config/i386/xm-sysv4.h b/gcc/config/i386/xm-sysv4.h
deleted file mode 100644
index 49d52b4e7f3..00000000000
--- a/gcc/config/i386/xm-sysv4.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Configuration for GCC for Intel i386 running System V Release 4. */
-
-#include "i386/xm-i386.h"
-#include "xm-svr4.h"
-
-/* If not compiled with GNU C, use the portable alloca. */
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-#endif
-#ifdef __HIGHC__
-#include <alloca.h> /* for MetaWare High-C on NCR System 3000 */
-#endif
-
-/* Univel, at least, has a small ARG_MAX. Defining this is harmless
- except for causing extra stat calls in the driver program. */
-#define SMALL_ARG_MAX
diff --git a/gcc/config/i386/xm-vsta.h b/gcc/config/i386/xm-vsta.h
deleted file mode 100644
index bb333aeae67..00000000000
--- a/gcc/config/i386/xm-vsta.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Configuration for GNU C-compiler for Intel 80386.
- Copyright (C) 1994 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. */
-
-#define NO_STAB_H
-
-#include "i386/xm-i386.h"
-
-/* Use semicolons to separate elements of a path. */
-#define PATH_SEPARATOR ';'
diff --git a/gcc/config/i860/bsd-gas.h b/gcc/config/i860/bsd-gas.h
deleted file mode 100644
index f76fec76827..00000000000
--- a/gcc/config/i860/bsd-gas.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#undef ASCII_DATA_ASM_OP
-#define ASCII_DATA_ASM_OP ".ascii"
diff --git a/gcc/config/i860/bsd.h b/gcc/config/i860/bsd.h
deleted file mode 100644
index 17b053343e8..00000000000
--- a/gcc/config/i860/bsd.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i860, BSD)")
-
-/* BSD UN*X systems use BSD STABS debugging info. */
-
-#define DBX_DEBUGGING_INFO
-
-#define ASCII_DATA_ASM_OP ".byte"
-#define ASM_OUTPUT_ASCII(f, p, size) \
-do { register unsigned i; \
- int inside; \
- inside = FALSE; \
- for (i = 0; i < (size); i++) { \
- if (i % 64 == 0) { \
- if (i != 0) { \
- if (inside) \
- putc('"', (f)); \
- putc('\n', (f)); \
- inside = FALSE; \
- } \
- fprintf((f), "\t%s ", ASCII_DATA_ASM_OP); \
- } \
- if ((p)[i] < 32 || (p)[i] == '\\' || (p)[i] == '"' || (p)[i] >= 127) { \
- if (inside) { \
- putc('"', (f)); \
- inside = FALSE; \
- } \
- if (i % 64 != 0) \
- putc(',', (f)); \
- fprintf((f), "%d", (p)[i]); \
- } else { \
- if (!inside) { \
- if (i % 64 != 0) \
- putc(',', (f)); \
- putc('"', (f)); \
- inside = TRUE; \
- } \
- putc((p)[i], (f)); \
- } \
- } \
- if (inside) \
- putc('"', (f)); \
- putc('\n', (f)); \
-} while (0)
diff --git a/gcc/config/i860/fx2800.h b/gcc/config/i860/fx2800.h
deleted file mode 100644
index 41c5bae3d06..00000000000
--- a/gcc/config/i860/fx2800.h
+++ /dev/null
@@ -1,356 +0,0 @@
-/* Target definitions for GNU compiler for Alliant FX/2800
- running Concentrix 2.2
- Copyright (C) 1991, 1996 Free Software Foundation, Inc.
- Contributed by Howard Chu (hyc@hanauma.jpl.nasa.gov).
-
-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 Alliant fx2800 running Concentrix 2.x is weird. This is basically
- a BSD 4.3 based operating system, but it uses svr4 ELF format object
- files and it somehow puts BSD stabs records into the ELF files for
- symbolic debug information. The assembler is "mostly an SVR4 assembler
- with some Alliant additions. We based it on the `Intel 80860 Assembly
- Language Specification' from AT&T." */
-
-/* This file consists of three sections. The first section establishes
- definitions unique to the Alliant FX/2800. The next section reconciles
- differences between Alliant and i860v4.h, and the last overrides the
- remaining differences with svr4.h */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i860 Alliant)");
-
-/* atexit is not present prior to Concentrix 2.2. Uncomment the following
- if you're on 2.1 or older. */
-
-/* #undef HAVE_ATEXIT */
-
-#define I860_STRICT_ABI_PROLOGUES
-
-/* There is no avoiding this; -L does not exist at all (in Concentrix 2.2). */
-#define LINK_LIBGCC_SPECIAL 1
-
-/* Most of the Alliant-specific definitions here are to get stab info that
- Alliant's dbx can understand. */
-
-#define DBX_DEBUGGING_INFO
-#define DEFAULT_GDB_EXTENSIONS 0
-#define DBX_NO_XREFS
-#define DBX_NO_EXTRA_TAGS
-
-/* Alliant dbx also needs to see the function stab before anything
- else in the function. */
-
-#define DBX_FUNCTION_FIRST
-#define DBX_LBRAC_FIRST
-
-/* Alliant dbx also needs to see the end of a function somewhere. */
-
-#define DBX_OUTPUT_FUNCTION_END(file,decl) \
- fprintf (file, ".stab \"\",.,0x%x,0,0\n", N_EFUN)
-
-/* Alliant dbx has predefined types, so they must be emitted with the
- proper type numbers. The defined types are:
-
- Type # C, Fortran, Pascal Types
- -- ------------------------
- 1 char, integer*1
- 2 short, integer*2
- 3 int, long, integer*4, integer
- 4 logical*1, byte
- 5 logical*2
- 6 logical*4, logical
- 7 float, real*4, real
- 8 double, real*8, double
- 9 single complex, complex*8, complex
- 10 double complex, doublecomplex
- 11 character
- 12 void
- 13 nil
- 14 boolean
- 15 unsigned char, ubyte
- 16 unsigned short, uword
- 17 unsigned, unsigned int, unsigned long, ulong
- 18 quad, logical*8
- 19 long long, integer*8
- 20 unsigned long long, uquad*8
- 21-100 reserved for future predefined types
- 100 long redefine same as 3
- 101 unsigned long same as 17
- -- --------------------
- 102 First user program type
-
- Since long and unsigned long are int references, they must be handled
- as special cases. The Alliant compiler doesn't use types 18-20, so it
- sets long & unsigned long in 18 & 19, not in 100 & 101 as shown above. */
-
-#define DBX_OUTPUT_STANDARD_TYPES(syms) \
-{ char *dtyps[]={"", "char", "short int", "int", "logical*1", \
- "logical*2", "logical*4", "float", "double", "complex", \
- "doublecomplex", "character", "void", "nil", "boolean", \
- "unsigned char", "short unsigned int", "unsigned int", \
- "logical*8", "long long int", "long long unsigned int",""}; \
- \
- tree decl; \
- int i; \
- \
- for (i=1;*dtyps[i];i++) \
- for (decl = syms; decl; decl = TREE_CHAIN(decl)) \
- if ((TREE_CODE (decl) == TYPE_DECL) && DECL_NAME(decl) && \
- !strcmp(IDENTIFIER_POINTER(DECL_NAME(decl)), dtyps[i])) { \
- TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = i; \
- typevec[i] = TYPE_DEFINED; \
- dbxout_symbol (decl, 0); \
- break; \
- } \
- \
- for (decl = syms; decl; decl = TREE_CHAIN(decl)) \
- if ((TREE_CODE (decl) == TYPE_DECL) && DECL_NAME(decl) && \
- !strcmp(IDENTIFIER_POINTER(DECL_NAME(decl)),"long int")) { \
- TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = i; \
- typevec[i] = TYPE_DEFINED; \
- fprintf(asmfile,".stab \"long int:t%d=3\",0,0x%x,0,0\n", \
- i++,N_LSYM); \
- TREE_ASM_WRITTEN (decl) = 1; \
- break; \
- } \
- \
- for (decl = syms; decl; decl = TREE_CHAIN(decl)) \
- if ((TREE_CODE (decl) == TYPE_DECL) && DECL_NAME(decl) && !strcmp( \
- IDENTIFIER_POINTER(DECL_NAME(decl)),"long unsigned int")) { \
- TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = i; \
- typevec[i] = TYPE_DEFINED; \
- fprintf(asmfile,".stab \"long unsigned int:t%d=17\",0,0x%x,0,0\n",\
- i++,N_LSYM); \
- TREE_ASM_WRITTEN (decl) = 1; \
- break; \
- } \
- next_type_number = i; };
-
-/* Alliant dbx doesn't understand split names... */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* The syntax for stabs records is also different; there is only a single
- ".stab" directive instead of the 3 directives in BSD, and the order of
- arguments is slightly changed. */
-
-#define ASM_STABS_OP ".stab"
-#define ASM_STABN_OP ".stab"
-#define ASM_STABD_OP ".stab"
-
-#define DBX_MEMPARM_STABS_LETTER 'k'
-#define DBX_REGPARM_STABS_LETTER 'r'
-
-#define ASM_OUTPUT_SOURCE_LINE(file,num) \
- fprintf (file, "\t.stab \"\",.,0x%x,0,%d\n", \
- N_SLINE,num)
-
-#if 0 /* Alliant dbx only reads first N_SO, so it
- ignores the filename if dir is present. */
-#define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(file,name) \
- fprintf (file, ".stab \"%s/\",.Ltext0,0x%x,0,0\n", \
- name, N_SO)
-#else
-#define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(file,name)
-#endif
-
-#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(file,name) \
- fprintf (file, ".stab "); \
- output_quoted_string (file, name); \
- fprintf (file, ",.Ltext0,0x%x,0,0\n", N_SO); \
- text_section (); \
- ASM_OUTPUT_INTERNAL_LABEL (file, "Ltext", 0)
-
-#define DBX_OUTPUT_SOURCE_FILENAME(file,name) \
- do { fprintf (file, ".stab "); \
- output_quoted_string (file, name); \
- fprintf (file, ",.Ltext0,0x%x,0,0\n", N_SOL); \
- } while (0)
-
-#define DBX_OUTPUT_CONSTANT_SYMBOL(file,name,ival) \
- fprintf (file, ".stab \"%s:c=i%d\",0,0x%x,0,0\n", \
- name, ival, N_LSYM)
-
-#define DBX_FINISH_SYMBOL(decl) \
- int line = 0; \
- fprintf (asmfile, "\","); \
- if (current_sym_addr) \
- output_addr_const (asmfile, current_sym_addr); \
- else \
- fprintf (asmfile, "%d", current_sym_value); \
- if (decl != 0 && TREE_CODE(decl) == FUNCTION_DECL) \
- line=DECL_SOURCE_LINE (decl); \
- fprintf (asmfile, ",0x%x,%d,%d\n", current_sym_code, \
- line!=0?64:0,line)
-
-#define DBX_OUTPUT_CATCH(file,decl,name) \
- fprintf (file, ".stab \"%s:C1\",", \
- IDENTIFIER_POINTER (DECL_NAME (decl))); \
- assemble_name (file, name); \
- fprintf (file, ",0x%x,0,0\n", N_CATCH)
-
-#define DBX_OUTPUT_LBRAC(file,name) \
- if (depth > 1) { \
- fprintf (file, ".stab \"\","); \
- assemble_name (file, name); \
- fprintf (file, ",0x%x,0,%d\n", N_LBRAC, depth); }
-
-#define DBX_OUTPUT_RBRAC(file,name) \
- if (depth > 1) { \
- fprintf (file, ".stab \"\","); \
- assemble_name (file, name); \
- fprintf (file, ",0x%x,0,%d\n", N_RBRAC, depth); }
-
-#define DBX_OUTPUT_ENUM(file,type) \
- fprintf (file, "e3"); \
- CHARS(2); \
- for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem)) \
- { \
- fprintf (asmfile, "%s:%d,", \
- IDENTIFIER_POINTER (TREE_PURPOSE (tem)), \
- TREE_INT_CST_LOW (TREE_VALUE (tem))); \
- CHARS (11 + IDENTIFIER_LENGTH (TREE_PURPOSE (tem))); \
- if (TREE_CHAIN (tem) != 0) \
- CONTIN; \
- } \
- putc (';', asmfile); \
- CHARS (1);
-
-/* Undefine some things defined in i860.h because the native C compiler
- on the FX/2800 emits code to do these operations inline. For GCC,
- we will use the default implementation of these things... i.e.
- generating calls to libgcc1 routines. */
-
-#undef DIVSI3_LIBCALL
-#undef UDIVSI3_LIBCALL
-#undef REMSI3_LIBCALL
-#undef UREMSI3_LIBCALL
-
-/* The Alliant compiler's mod function gives the wrong result after a
- shift operation. This bug typically hits in hash functions. */
-
-#define perform_umodsi3(a, b) a %= b; if (a == b) a=0; return a
-#define perform_modsi3(a, b) a %= b; if (a == b) a=0; return a
-
-/* Global pointer needs to be 8 byte aligned? Link error if not... */
-
-#define DATA_ALIGNMENT(dummy,align) \
- ((TREE_PUBLIC (decl) && \
- (TREE_CODE (TREE_TYPE (decl))==POINTER_TYPE)) ? 64:align)
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tcall __mcount_\n\tnop\n")
-
-/* Overrides for i860v4.h begin here */
-
-/* Provide a set of pre-definitions and pre-assertions appropriate for
- the i860 running Concentrix 2.x. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di860 -Dunix -DBSD4_3 -Dalliant -Asystem(unix) -Asystem(bsd) -Acpu(i860) -Amachine(i860)"
-
-#undef I860_REG_PREFIX
-#undef ASM_COMMENT_START
-#define ASM_COMMENT_START "//"
-
-/* Use definitions of ASM_OUTPUT_{DOUBLE,FLOAT} as given in i860.h */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf(FILE, "\t.double %.20e\n", (VALUE))
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- fprintf(FILE, "\t.float %.12e\n", (VALUE))
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)
-#undef ASM_OUTPUT_FUNCTION_PREFIX
-#define ASM_OUTPUT_FUNCTION_PREFIX(FILE,NAME) \
- fputs("\tnop\n", (FILE)); \
- current_function_original_name = (NAME)
-#undef ASM_OUTPUT_PROLOGUE_SUFFIX
-
-/* Overrides for svr4.h begin here */
-
-#undef SVR4
-
-#undef SWITCH_TAKES_ARG
-#undef WORD_SWITCH_TAKES_ARG
-
-#undef ASM_SPEC
-#undef ASM_FINAL_SPEC
-#undef MD_STARTFILE_PREFIX
-#undef MD_EXEC_PREFIX
-
-/* Generate an error message if -p option is selected. Concentrix 2.x
- does not support prof format profiling, only gprof is supported. */
-
-#define CPP_SPEC "%{p:%e-p option not supported: use -pg instead}"
-
-/* Provide an appropriate LIB_SPEC. The crtend.o file provides part of the
- support for getting C++ file-scope static objects constructed before
- entering `main'. */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{g*:-lg} %{!pg:-lc}%{pg:-lc_p} crtend.o%s"
-
-/* Tell linker to strip local symbols, since assembler may not. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "-X"
-
-/* Get the correct startup file for regular or profiled code. Also
- use the crtbegin.o file for C++ ... */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!pg:crt0.o%s}%{pg:gcrt0.o%s} crtbegin.o%s"
-
-#undef SCCS_DIRECTIVE
-#undef NO_DOLLAR_IN_LABEL
-#undef TARGET_MEM_FUNCTIONS
-
-#undef DWARF_DEBUGGING_INFO
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX "_"
-
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-
-/* ??? Is this used anywhere? */
-#undef BSS_ASM_OP
-#define BSS_ASM_OP "\t.lcomm"
-
-#undef ASM_FILE_END
-#define ASM_FILE_END(FILE) \
-do { \
- if (current_function_original_name != NULL) { \
- tdesc_section(); \
- fprintf ((FILE), "%s __ETEXT\n", ASM_LONG); \
- fprintf ((FILE), "%s 0\n", ASM_LONG); \
- text_section(); \
- fputs("__ETEXT:\n", (FILE)); \
- } \
- fprintf ((FILE), "\t.ident\t\"GCC: (GNU) %s\"\n", \
- version_string); \
- } while (0)
diff --git a/gcc/config/i860/i860.c b/gcc/config/i860/i860.c
deleted file mode 100644
index dce13404783..00000000000
--- a/gcc/config/i860/i860.c
+++ /dev/null
@@ -1,2097 +0,0 @@
-/* Subroutines for insn-output.c for Intel 860
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- Derived from sparc.c.
-
- Written by Richard Stallman (rms@ai.mit.edu).
-
- Hacked substantially by Ron Guilmette (rfg@netcom.com) to cater
- to the whims of the System V Release 4 assembler.
-
-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 "flags.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "recog.h"
-#include "insn-attr.h"
-
-#include <stdio.h>
-
-static rtx find_addr_reg ();
-
-#ifndef I860_REG_PREFIX
-#define I860_REG_PREFIX ""
-#endif
-
-char *i860_reg_prefix = I860_REG_PREFIX;
-
-/* Save information from a "cmpxx" operation until the branch is emitted. */
-
-rtx i860_compare_op0, i860_compare_op1;
-
-/* Return non-zero if this pattern, can be evaluated safely, even if it
- was not asked for. */
-int
-safe_insn_src_p (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- /* Just experimenting. */
-
- /* No floating point src is safe if it contains an arithmetic
- operation, since that operation may trap. */
- switch (GET_CODE (op))
- {
- case CONST_INT:
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST:
- return 1;
-
- case REG:
- return 1;
-
- case MEM:
- return CONSTANT_ADDRESS_P (XEXP (op, 0));
-
- /* We never need to negate or complement constants. */
- case NEG:
- return (mode != SFmode && mode != DFmode);
- case NOT:
- case ZERO_EXTEND:
- return 1;
-
- case EQ:
- case NE:
- case LT:
- case GT:
- case LE:
- case GE:
- case LTU:
- case GTU:
- case LEU:
- case GEU:
- case MINUS:
- case PLUS:
- return (mode != SFmode && mode != DFmode);
- case AND:
- case IOR:
- case XOR:
- case ASHIFT:
- case ASHIFTRT:
- case LSHIFTRT:
- if ((GET_CODE (XEXP (op, 0)) == CONST_INT && ! SMALL_INT (XEXP (op, 0)))
- || (GET_CODE (XEXP (op, 1)) == CONST_INT && ! SMALL_INT (XEXP (op, 1))))
- return 0;
- return 1;
-
- default:
- return 0;
- }
-}
-
-/* Return 1 if REG is clobbered in IN.
- Return 2 if REG is used in IN.
- Return 3 if REG is both used and clobbered in IN.
- Return 0 if neither. */
-
-static int
-reg_clobbered_p (reg, in)
- rtx reg;
- rtx in;
-{
- register enum rtx_code code;
-
- if (in == 0)
- return 0;
-
- code = GET_CODE (in);
-
- if (code == SET || code == CLOBBER)
- {
- rtx dest = SET_DEST (in);
- int set = 0;
- int used = 0;
-
- while (GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == ZERO_EXTRACT)
- dest = XEXP (dest, 0);
-
- if (dest == reg)
- set = 1;
- else if (GET_CODE (dest) == REG
- && refers_to_regno_p (REGNO (reg),
- REGNO (reg) + HARD_REGNO_NREGS (reg, GET_MODE (reg)),
- SET_DEST (in), 0))
- {
- set = 1;
- /* Anything that sets just part of the register
- is considered using as well as setting it.
- But note that a straight SUBREG of a single-word value
- clobbers the entire value. */
- if (dest != SET_DEST (in)
- && ! (GET_CODE (SET_DEST (in)) == SUBREG
- || UNITS_PER_WORD >= GET_MODE_SIZE (GET_MODE (dest))))
- used = 1;
- }
-
- if (code == SET)
- {
- if (set)
- used = refers_to_regno_p (REGNO (reg),
- REGNO (reg) + HARD_REGNO_NREGS (reg, GET_MODE (reg)),
- SET_SRC (in), 0);
- else
- used = refers_to_regno_p (REGNO (reg),
- REGNO (reg) + HARD_REGNO_NREGS (reg, GET_MODE (reg)),
- in, 0);
- }
-
- return set + used * 2;
- }
-
- if (refers_to_regno_p (REGNO (reg),
- REGNO (reg) + HARD_REGNO_NREGS (reg, GET_MODE (reg)),
- in, 0))
- return 2;
- return 0;
-}
-
-/* Return non-zero if OP can be written to without screwing up
- GCC's model of what's going on. It is assumed that this operand
- appears in the dest position of a SET insn in a conditional
- branch's delay slot. AFTER is the label to start looking from. */
-int
-operand_clobbered_before_used_after (op, after)
- rtx op;
- rtx after;
-{
- /* Just experimenting. */
- if (GET_CODE (op) == CC0)
- return 1;
- if (GET_CODE (op) == REG)
- {
- rtx insn;
-
- if (op == stack_pointer_rtx)
- return 0;
-
- /* Scan forward from the label, to see if the value of OP
- is clobbered before the first use. */
-
- for (insn = NEXT_INSN (after); insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE)
- continue;
- if (GET_CODE (insn) == INSN
- || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- switch (reg_clobbered_p (op, PATTERN (insn)))
- {
- default:
- return 0;
- case 1:
- return 1;
- case 0:
- break;
- }
- }
- /* If we reach another label without clobbering OP,
- then we cannot safely write it here. */
- else if (GET_CODE (insn) == CODE_LABEL)
- return 0;
- if (GET_CODE (insn) == JUMP_INSN)
- {
- if (condjump_p (insn))
- return 0;
- /* This is a jump insn which has already
- been mangled. We can't tell what it does. */
- if (GET_CODE (PATTERN (insn)) == PARALLEL)
- return 0;
- if (! JUMP_LABEL (insn))
- return 0;
- /* Keep following jumps. */
- insn = JUMP_LABEL (insn);
- }
- }
- return 1;
- }
-
- /* In both of these cases, the first insn executed
- for this op will be a orh whatever%h,%?r0,%?r31,
- which is tolerable. */
- if (GET_CODE (op) == MEM)
- return (CONSTANT_ADDRESS_P (XEXP (op, 0)));
-
- return 0;
-}
-
-/* Return non-zero if this pattern, as a source to a "SET",
- is known to yield an instruction of unit size. */
-int
-single_insn_src_p (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case CONST_INT:
- /* This is not always a single insn src, technically,
- but output_delayed_branch knows how to deal with it. */
- return 1;
-
- case SYMBOL_REF:
- case CONST:
- /* This is not a single insn src, technically,
- but output_delayed_branch knows how to deal with it. */
- return 1;
-
- case REG:
- return 1;
-
- case MEM:
- return 1;
-
- /* We never need to negate or complement constants. */
- case NEG:
- return (mode != DFmode);
- case NOT:
- case ZERO_EXTEND:
- return 1;
-
- case PLUS:
- case MINUS:
- /* Detect cases that require multiple instructions. */
- if (CONSTANT_P (XEXP (op, 1))
- && !(GET_CODE (XEXP (op, 1)) == CONST_INT
- && SMALL_INT (XEXP (op, 1))))
- return 0;
- case EQ:
- case NE:
- case LT:
- case GT:
- case LE:
- case GE:
- case LTU:
- case GTU:
- case LEU:
- case GEU:
- /* Not doing floating point, since they probably
- take longer than the branch slot they might fill. */
- return (mode != SFmode && mode != DFmode);
-
- case AND:
- if (GET_CODE (XEXP (op, 1)) == NOT)
- {
- rtx arg = XEXP (XEXP (op, 1), 0);
- if (CONSTANT_P (arg)
- && !(GET_CODE (arg) == CONST_INT
- && (SMALL_INT (arg)
- || INTVAL (arg) & 0xffff == 0)))
- return 0;
- }
- case IOR:
- case XOR:
- /* Both small and round numbers take one instruction;
- others take two. */
- if (CONSTANT_P (XEXP (op, 1))
- && !(GET_CODE (XEXP (op, 1)) == CONST_INT
- && (SMALL_INT (XEXP (op, 1))
- || INTVAL (XEXP (op, 1)) & 0xffff == 0)))
- return 0;
-
- case ASHIFT:
- case ASHIFTRT:
- case LSHIFTRT:
- return 1;
-
- case SUBREG:
- if (SUBREG_WORD (op) != 0)
- return 0;
- return single_insn_src_p (SUBREG_REG (op), mode);
-
- /* Not doing floating point, since they probably
- take longer than the branch slot they might fill. */
- case FLOAT_EXTEND:
- case FLOAT_TRUNCATE:
- case FLOAT:
- case FIX:
- case UNSIGNED_FLOAT:
- case UNSIGNED_FIX:
- return 0;
-
- default:
- return 0;
- }
-}
-
-/* Return non-zero only if OP is a register of mode MODE,
- or const0_rtx. */
-int
-reg_or_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (op == const0_rtx || register_operand (op, mode)
- || op == CONST0_RTX (mode));
-}
-
-/* Return truth value of whether OP can be used as an operands in a three
- address add/subtract insn (such as add %o1,7,%l2) of mode MODE. */
-
-int
-arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && SMALL_INT (op)));
-}
-
-/* Return 1 if OP is a valid first operand for a logical insn of mode MODE. */
-
-int
-logic_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && LOGIC_INT (op)));
-}
-
-/* Return 1 if OP is a valid first operand for a shift insn of mode MODE. */
-
-int
-shift_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT));
-}
-
-/* Return 1 if OP is a valid first operand for either a logical insn
- or an add insn of mode MODE. */
-
-int
-compare_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && SMALL_INT (op) && LOGIC_INT (op)));
-}
-
-/* Return truth value of whether OP can be used as the 5-bit immediate
- operand of a bte or btne insn. */
-
-int
-bte_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT
- && (unsigned) INTVAL (op) < 0x20));
-}
-
-/* Return 1 if OP is an indexed memory reference of mode MODE. */
-
-int
-indexed_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == MEM && GET_MODE (op) == mode
- && GET_CODE (XEXP (op, 0)) == PLUS
- && GET_MODE (XEXP (op, 0)) == SImode
- && register_operand (XEXP (XEXP (op, 0), 0), SImode)
- && register_operand (XEXP (XEXP (op, 0), 1), SImode));
-}
-
-/* Return 1 if OP is a suitable source operand for a load insn
- with mode MODE. */
-
-int
-load_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (memory_operand (op, mode) || indexed_operand (op, mode));
-}
-
-/* Return truth value of whether OP is a integer which fits the
- range constraining immediate operands in add/subtract insns. */
-
-int
-small_int (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && SMALL_INT (op));
-}
-
-/* Return truth value of whether OP is a integer which fits the
- range constraining immediate operands in logic insns. */
-
-int
-logic_int (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && LOGIC_INT (op));
-}
-
-/* Test for a valid operand for a call instruction.
- Don't allow the arg pointer register or virtual regs
- since they may change into reg + const, which the patterns
- can't handle yet. */
-
-int
-call_insn_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == MEM
- && (CONSTANT_ADDRESS_P (XEXP (op, 0))
- || (GET_CODE (XEXP (op, 0)) == REG
- && XEXP (op, 0) != arg_pointer_rtx
- && !(REGNO (XEXP (op, 0)) >= FIRST_PSEUDO_REGISTER
- && REGNO (XEXP (op, 0)) <= LAST_VIRTUAL_REGISTER))))
- return 1;
- return 0;
-}
-
-/* Return the best assembler insn template
- for moving operands[1] into operands[0] as a fullword. */
-
-static char *
-singlemove_string (operands)
- rtx *operands;
-{
- if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (operands[1]) != MEM)
- if (CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && cc_prev_status.mdep == XEXP (operands[0], 0)))
- {
- CC_STATUS_INIT;
- output_asm_insn ("orh %h0,%?r0,%?r31", operands);
- }
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[0], 0);
- return "st.l %r1,%L0(%?r31)";
- }
- else
- return "st.l %r1,%0";
- else
- abort ();
-#if 0
- {
- rtx xoperands[2];
-
- cc_status.flags &= ~CC_F0_IS_0;
- xoperands[0] = gen_rtx (REG, SFmode, 32);
- xoperands[1] = operands[1];
- output_asm_insn (singlemove_string (xoperands), xoperands);
- xoperands[1] = xoperands[0];
- xoperands[0] = operands[0];
- output_asm_insn (singlemove_string (xoperands), xoperands);
- return "";
- }
-#endif
- }
- if (GET_CODE (operands[1]) == MEM)
- {
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && cc_prev_status.mdep == XEXP (operands[1], 0)))
- {
- CC_STATUS_INIT;
- output_asm_insn ("orh %h1,%?r0,%?r31", operands);
- }
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[1], 0);
- return "ld.l %L1(%?r31),%0";
- }
- return "ld.l %m1,%0";
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (operands[1] == const0_rtx)
- return "mov %?r0,%0";
- if((INTVAL (operands[1]) & 0xffff0000) == 0)
- return "or %L1,%?r0,%0";
- if((INTVAL (operands[1]) & 0xffff8000) == 0xffff8000)
- return "adds %1,%?r0,%0";
- if((INTVAL (operands[1]) & 0x0000ffff) == 0)
- return "orh %H1,%?r0,%0";
- }
- return "mov %1,%0";
-}
-
-/* Output assembler code to perform a doubleword move insn
- with operands OPERANDS. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum { REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP } optype0, optype1;
- rtx latehalf[2];
- rtx addreg0 = 0, addreg1 = 0;
- int highest_first = 0;
- int no_addreg1_decrement = 0;
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1]))
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP)
- abort ();
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (operands[0], 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (operands[1], 0));
-
-/* ??? Perhaps in some cases move double words
- if there is a spare pair of floating regs. */
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first,
- but if either operand is autodecrementing then we
- do the high-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], 4);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- else if (optype1 == CNSTOP)
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- split_double (operands[1], &operands[1], &latehalf[1]);
- else if (CONSTANT_P (operands[1]))
- latehalf[1] = const0_rtx;
- }
- else
- latehalf[1] = operands[1];
-
- /* If the first move would clobber the source of the second one,
- do them in the other order.
-
- RMS says "This happens only for registers;
- such overlap can't happen in memory unless the user explicitly
- sets it up, and that is an undefined circumstance."
-
- but it happens on the sparc when loading parameter registers,
- so I am going to define that circumstance, and make it work
- as expected. */
-
- if (optype0 == REGOP && optype1 == REGOP
- && REGNO (operands[0]) == REGNO (latehalf[1]))
- {
- CC_STATUS_PARTIAL_INIT;
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("adds 0x4,%0,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("adds 0x4,%0,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("adds -0x4,%0,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("adds -0x4,%0,%0", &addreg1);
-
- /* Do low-numbered word. */
- return singlemove_string (operands);
- }
- else if (optype0 == REGOP && optype1 != REGOP
- && reg_overlap_mentioned_p (operands[0], operands[1]))
- {
- /* If both halves of dest are used in the src memory address,
- add the two regs and put them in the low reg (operands[0]).
- Then it works to load latehalf first. */
- if (reg_mentioned_p (operands[0], XEXP (operands[1], 0))
- && reg_mentioned_p (latehalf[0], XEXP (operands[1], 0)))
- {
- rtx xops[2];
- xops[0] = latehalf[0];
- xops[1] = operands[0];
- output_asm_insn ("adds %1,%0,%1", xops);
- operands[1] = gen_rtx (MEM, DImode, operands[0]);
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- addreg1 = 0;
- highest_first = 1;
- }
- /* Only one register in the dest is used in the src memory address,
- and this is the first register of the dest, so we want to do
- the late half first here also. */
- else if (! reg_mentioned_p (latehalf[0], XEXP (operands[1], 0)))
- highest_first = 1;
- /* Only one register in the dest is used in the src memory address,
- and this is the second register of the dest, so we want to do
- the late half last. If addreg1 is set, and addreg1 is the same
- register as latehalf, then we must suppress the trailing decrement,
- because it would clobber the value just loaded. */
- else if (addreg1 && reg_mentioned_p (addreg1, latehalf[0]))
- no_addreg1_decrement = 1;
- }
-
- /* Normal case: do the two words, low-numbered first.
- Overlap case (highest_first set): do high-numbered word first. */
-
- if (! highest_first)
- output_asm_insn (singlemove_string (operands), operands);
-
- CC_STATUS_PARTIAL_INIT;
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("adds 0x4,%0,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("adds 0x4,%0,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("adds -0x4,%0,%0", &addreg0);
- if (addreg1 && !no_addreg1_decrement)
- output_asm_insn ("adds -0x4,%0,%0", &addreg1);
-
- if (highest_first)
- output_asm_insn (singlemove_string (operands), operands);
-
- return "";
-}
-
-char *
-output_fp_move_double (operands)
- rtx *operands;
-{
- /* If the source operand is any sort of zero, use f0 instead. */
-
- if (operands[1] == CONST0_RTX (GET_MODE (operands[1])))
- operands[1] = gen_rtx (REG, DFmode, F0_REGNUM);
-
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return "fmov.dd %1,%0";
- if (GET_CODE (operands[1]) == REG)
- {
- output_asm_insn ("ixfr %1,%0", operands);
- operands[0] = gen_rtx (REG, VOIDmode, REGNO (operands[0]) + 1);
- operands[1] = gen_rtx (REG, VOIDmode, REGNO (operands[1]) + 1);
- return "ixfr %1,%0";
- }
- if (operands[1] == CONST0_RTX (DFmode))
- return "fmov.dd f0,%0";
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && cc_prev_status.mdep == XEXP (operands[1], 0)))
- {
- CC_STATUS_INIT;
- output_asm_insn ("orh %h1,%?r0,%?r31", operands);
- }
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[1], 0);
- return "fld.d %L1(%?r31),%0";
- }
- return "fld.d %1,%0";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (GET_CODE (operands[0]) == REG)
- {
- output_asm_insn ("fxfr %1,%0", operands);
- operands[0] = gen_rtx (REG, VOIDmode, REGNO (operands[0]) + 1);
- operands[1] = gen_rtx (REG, VOIDmode, REGNO (operands[1]) + 1);
- return "fxfr %1,%0";
- }
- if (CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && cc_prev_status.mdep == XEXP (operands[0], 0)))
- {
- CC_STATUS_INIT;
- output_asm_insn ("orh %h0,%?r0,%?r31", operands);
- }
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[0], 0);
- return "fst.d %1,%L0(%?r31)";
- }
- return "fst.d %1,%0";
- }
- else
- abort ();
- /* NOTREACHED */
- return NULL;
-}
-
-/* Return a REG that occurs in ADDR with coefficient 1.
- ADDR can be effectively incremented by incrementing REG. */
-
-static rtx
-find_addr_reg (addr)
- rtx addr;
-{
- while (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG)
- addr = XEXP (addr, 0);
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 0)))
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 1)))
- addr = XEXP (addr, 0);
- else
- abort ();
- }
- if (GET_CODE (addr) == REG)
- return addr;
- abort ();
- /* NOTREACHED */
- return NULL;
-}
-
-/* Return a template for a load instruction with mode MODE and
- arguments from the string ARGS.
-
- This string is in static storage. */
-
-static char *
-load_opcode (mode, args, reg)
- enum machine_mode mode;
- char *args;
- rtx reg;
-{
- static char buf[30];
- char *opcode;
-
- switch (mode)
- {
- case QImode:
- opcode = "ld.b";
- break;
-
- case HImode:
- opcode = "ld.s";
- break;
-
- case SImode:
- case SFmode:
- if (FP_REG_P (reg))
- opcode = "fld.l";
- else
- opcode = "ld.l";
- break;
-
- case DImode:
- if (!FP_REG_P (reg))
- abort ();
- case DFmode:
- opcode = "fld.d";
- break;
-
- default:
- abort ();
- }
-
- sprintf (buf, "%s %s", opcode, args);
- return buf;
-}
-
-/* Return a template for a store instruction with mode MODE and
- arguments from the string ARGS.
-
- This string is in static storage. */
-
-static char *
-store_opcode (mode, args, reg)
- enum machine_mode mode;
- char *args;
- rtx reg;
-{
- static char buf[30];
- char *opcode;
-
- switch (mode)
- {
- case QImode:
- opcode = "st.b";
- break;
-
- case HImode:
- opcode = "st.s";
- break;
-
- case SImode:
- case SFmode:
- if (FP_REG_P (reg))
- opcode = "fst.l";
- else
- opcode = "st.l";
- break;
-
- case DImode:
- if (!FP_REG_P (reg))
- abort ();
- case DFmode:
- opcode = "fst.d";
- break;
-
- default:
- abort ();
- }
-
- sprintf (buf, "%s %s", opcode, args);
- return buf;
-}
-
-/* Output a store-in-memory whose operands are OPERANDS[0,1].
- OPERANDS[0] is a MEM, and OPERANDS[1] is a reg or zero.
-
- This function returns a template for an insn.
- This is in static storage.
-
- It may also output some insns directly.
- It may alter the values of operands[0] and operands[1]. */
-
-char *
-output_store (operands)
- rtx *operands;
-{
- enum machine_mode mode = GET_MODE (operands[0]);
- rtx address = XEXP (operands[0], 0);
- char *string;
-
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = address;
-
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && address == cc_prev_status.mdep))
- {
- CC_STATUS_INIT;
- output_asm_insn ("orh %h0,%?r0,%?r31", operands);
- cc_prev_status.mdep = address;
- }
-
- /* Store zero in two parts when appropriate. */
- if (mode == DFmode && operands[1] == CONST0_RTX (DFmode))
- return store_opcode (DFmode, "%r1,%L0(%?r31)", operands[1]);
-
- /* Code below isn't smart enough to move a doubleword in two parts,
- so use output_move_double to do that in the cases that require it. */
- if ((mode == DImode || mode == DFmode)
- && ! FP_REG_P (operands[1]))
- return output_move_double (operands);
-
- return store_opcode (mode, "%r1,%L0(%?r31)", operands[1]);
-}
-
-/* Output a load-from-memory whose operands are OPERANDS[0,1].
- OPERANDS[0] is a reg, and OPERANDS[1] is a mem.
-
- This function returns a template for an insn.
- This is in static storage.
-
- It may also output some insns directly.
- It may alter the values of operands[0] and operands[1]. */
-
-char *
-output_load (operands)
- rtx *operands;
-{
- enum machine_mode mode = GET_MODE (operands[0]);
- rtx address = XEXP (operands[1], 0);
-
- /* We don't bother trying to see if we know %hi(address).
- This is because we are doing a load, and if we know the
- %hi value, we probably also know that value in memory. */
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = address;
-
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && address == cc_prev_status.mdep
- && cc_prev_status.mdep == cc_status.mdep))
- {
- CC_STATUS_INIT;
- output_asm_insn ("orh %h1,%?r0,%?r31", operands);
- cc_prev_status.mdep = address;
- }
-
- /* Code below isn't smart enough to move a doubleword in two parts,
- so use output_move_double to do that in the cases that require it. */
- if ((mode == DImode || mode == DFmode)
- && ! FP_REG_P (operands[0]))
- return output_move_double (operands);
-
- return load_opcode (mode, "%L1(%?r31),%0", operands[0]);
-}
-
-#if 0
-/* Load the address specified by OPERANDS[3] into the register
- specified by OPERANDS[0].
-
- OPERANDS[3] may be the result of a sum, hence it could either be:
-
- (1) CONST
- (2) REG
- (2) REG + CONST_INT
- (3) REG + REG + CONST_INT
- (4) REG + REG (special case of 3).
-
- Note that (3) is not a legitimate address.
- All cases are handled here. */
-
-void
-output_load_address (operands)
- rtx *operands;
-{
- rtx base, offset;
-
- if (CONSTANT_P (operands[3]))
- {
- output_asm_insn ("mov %3,%0", operands);
- return;
- }
-
- if (REG_P (operands[3]))
- {
- if (REGNO (operands[0]) != REGNO (operands[3]))
- output_asm_insn ("shl %?r0,%3,%0", operands);
- return;
- }
-
- if (GET_CODE (operands[3]) != PLUS)
- abort ();
-
- base = XEXP (operands[3], 0);
- offset = XEXP (operands[3], 1);
-
- if (GET_CODE (base) == CONST_INT)
- {
- rtx tmp = base;
- base = offset;
- offset = tmp;
- }
-
- if (GET_CODE (offset) != CONST_INT)
- {
- /* Operand is (PLUS (REG) (REG)). */
- base = operands[3];
- offset = const0_rtx;
- }
-
- if (REG_P (base))
- {
- operands[6] = base;
- operands[7] = offset;
- CC_STATUS_PARTIAL_INIT;
- if (SMALL_INT (offset))
- output_asm_insn ("adds %7,%6,%0", operands);
- else
- output_asm_insn ("mov %7,%0\n\tadds %0,%6,%0", operands);
- }
- else if (GET_CODE (base) == PLUS)
- {
- operands[6] = XEXP (base, 0);
- operands[7] = XEXP (base, 1);
- operands[8] = offset;
-
- CC_STATUS_PARTIAL_INIT;
- if (SMALL_INT (offset))
- output_asm_insn ("adds %6,%7,%0\n\tadds %8,%0,%0", operands);
- else
- output_asm_insn ("mov %8,%0\n\tadds %0,%6,%0\n\tadds %0,%7,%0", operands);
- }
- else
- abort ();
-}
-#endif
-
-/* Output code to place a size count SIZE in register REG.
- Because block moves are pipelined, we don't include the
- first element in the transfer of SIZE to REG.
- For this, we subtract ALIGN. (Actually, I think it is not
- right to subtract on this machine, so right now we don't.) */
-
-static void
-output_size_for_block_move (size, reg, align)
- rtx size, reg, align;
-{
- rtx xoperands[3];
-
- xoperands[0] = reg;
- xoperands[1] = size;
- xoperands[2] = align;
-
-#if 1
- cc_status.flags &= ~ CC_KNOW_HI_R31;
- output_asm_insn (singlemove_string (xoperands), xoperands);
-#else
- if (GET_CODE (size) == REG)
- output_asm_insn ("sub %2,%1,%0", xoperands);
- else
- {
- xoperands[1]
- = gen_rtx (CONST_INT, VOIDmode, INTVAL (size) - INTVAL (align));
- cc_status.flags &= ~ CC_KNOW_HI_R31;
- output_asm_insn ("mov %1,%0", xoperands);
- }
-#endif
-}
-
-/* Emit code to perform a block move.
-
- OPERANDS[0] is the destination.
- OPERANDS[1] is the source.
- OPERANDS[2] is the size.
- OPERANDS[3] is the known safe alignment.
- OPERANDS[4..6] are pseudos we can safely clobber as temps. */
-
-char *
-output_block_move (operands)
- rtx *operands;
-{
- /* A vector for our computed operands. Note that load_output_address
- makes use of (and can clobber) up to the 8th element of this vector. */
- rtx xoperands[10];
- rtx zoperands[10];
- static int movstrsi_label = 0;
- int i, j;
- rtx temp1 = operands[4];
- rtx alignrtx = operands[3];
- int align = INTVAL (alignrtx);
- int chunk_size;
-
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- xoperands[2] = temp1;
-
- /* We can't move more than four bytes at a time
- because we have only one register to move them through. */
- if (align > 4)
- {
- align = 4;
- alignrtx = gen_rtx (CONST_INT, VOIDmode, 4);
- }
-
- /* Recognize special cases of block moves. These occur
- when GNU C++ is forced to treat something as BLKmode
- to keep it in memory, when its mode could be represented
- with something smaller.
-
- We cannot do this for global variables, since we don't know
- what pages they don't cross. Sigh. */
- if (GET_CODE (operands[2]) == CONST_INT
- && ! CONSTANT_ADDRESS_P (operands[0])
- && ! CONSTANT_ADDRESS_P (operands[1]))
- {
- int size = INTVAL (operands[2]);
- rtx op0 = xoperands[0];
- rtx op1 = xoperands[1];
-
- if ((align & 3) == 0 && (size & 3) == 0 && (size >> 2) <= 16)
- {
- if (memory_address_p (SImode, plus_constant (op0, size))
- && memory_address_p (SImode, plus_constant (op1, size)))
- {
- cc_status.flags &= ~CC_KNOW_HI_R31;
- for (i = (size>>2)-1; i >= 0; i--)
- {
- xoperands[0] = plus_constant (op0, i * 4);
- xoperands[1] = plus_constant (op1, i * 4);
- output_asm_insn ("ld.l %a1,%?r31\n\tst.l %?r31,%a0",
- xoperands);
- }
- return "";
- }
- }
- else if ((align & 1) == 0 && (size & 1) == 0 && (size >> 1) <= 16)
- {
- if (memory_address_p (HImode, plus_constant (op0, size))
- && memory_address_p (HImode, plus_constant (op1, size)))
- {
- cc_status.flags &= ~CC_KNOW_HI_R31;
- for (i = (size>>1)-1; i >= 0; i--)
- {
- xoperands[0] = plus_constant (op0, i * 2);
- xoperands[1] = plus_constant (op1, i * 2);
- output_asm_insn ("ld.s %a1,%?r31\n\tst.s %?r31,%a0",
- xoperands);
- }
- return "";
- }
- }
- else if (size <= 16)
- {
- if (memory_address_p (QImode, plus_constant (op0, size))
- && memory_address_p (QImode, plus_constant (op1, size)))
- {
- cc_status.flags &= ~CC_KNOW_HI_R31;
- for (i = size-1; i >= 0; i--)
- {
- xoperands[0] = plus_constant (op0, i);
- xoperands[1] = plus_constant (op1, i);
- output_asm_insn ("ld.b %a1,%?r31\n\tst.b %?r31,%a0",
- xoperands);
- }
- return "";
- }
- }
- }
-
- /* Since we clobber untold things, nix the condition codes. */
- CC_STATUS_INIT;
-
- /* This is the size of the transfer.
- Either use the register which already contains the size,
- or use a free register (used by no operands). */
- output_size_for_block_move (operands[2], operands[4], alignrtx);
-
-#if 0
- /* Also emit code to decrement the size value by ALIGN. */
- zoperands[0] = operands[0];
- zoperands[3] = plus_constant (operands[0], align);
- output_load_address (zoperands);
-#endif
-
- /* Generate number for unique label. */
-
- xoperands[3] = gen_rtx (CONST_INT, VOIDmode, movstrsi_label++);
-
- /* Calculate the size of the chunks we will be trying to move first. */
-
-#if 0
- if ((align & 3) == 0)
- chunk_size = 4;
- else if ((align & 1) == 0)
- chunk_size = 2;
- else
-#endif
- chunk_size = 1;
-
- /* Copy the increment (negative) to a register for bla insn. */
-
- xoperands[4] = gen_rtx (CONST_INT, VOIDmode, - chunk_size);
- xoperands[5] = operands[5];
- output_asm_insn ("adds %4,%?r0,%5", xoperands);
-
- /* Predecrement the loop counter. This happens again also in the `bla'
- instruction which precedes the loop, but we need to have it done
- two times before we enter the loop because of the bizarre semantics
- of the bla instruction. */
-
- output_asm_insn ("adds %5,%2,%2", xoperands);
-
- /* Check for the case where the original count was less than or equal to
- zero. Avoid going through the loop at all if the original count was
- indeed less than or equal to zero. Note that we treat the count as
- if it were a signed 32-bit quantity here, rather than an unsigned one,
- even though we really shouldn't. We have to do this because of the
- semantics of the `ble' instruction, which assume that the count is
- a signed 32-bit value. Anyway, in practice it won't matter because
- nobody is going to try to do a memcpy() of more than half of the
- entire address space (i.e. 2 gigabytes) anyway. */
-
- output_asm_insn ("bc .Le%3", xoperands);
-
- /* Make available a register which is a temporary. */
-
- xoperands[6] = operands[6];
-
- /* Now the actual loop.
- In xoperands, elements 1 and 0 are the input and output vectors.
- Element 2 is the loop index. Element 5 is the increment. */
-
- output_asm_insn ("subs %1,%5,%1", xoperands);
- output_asm_insn ("bla %5,%2,.Lm%3", xoperands);
- output_asm_insn ("adds %0,%2,%6", xoperands);
- output_asm_insn ("\n.Lm%3:", xoperands); /* Label for bla above. */
- output_asm_insn ("\n.Ls%3:", xoperands); /* Loop start label. */
- output_asm_insn ("adds %5,%6,%6", xoperands);
-
- /* NOTE: The code here which is supposed to handle the cases where the
- sources and destinations are known to start on a 4 or 2 byte boundary
- are currently broken. They fail to do anything about the overflow
- bytes which might still need to be copied even after we have copied
- some number of words or halfwords. Thus, for now we use the lowest
- common denominator, i.e. the code which just copies some number of
- totally unaligned individual bytes. (See the calculation of
- chunk_size above. */
-
- if (chunk_size == 4)
- {
- output_asm_insn ("ld.l %2(%1),%?r31", xoperands);
- output_asm_insn ("bla %5,%2,.Ls%3", xoperands);
- output_asm_insn ("st.l %?r31,8(%6)", xoperands);
- }
- else if (chunk_size == 2)
- {
- output_asm_insn ("ld.s %2(%1),%?r31", xoperands);
- output_asm_insn ("bla %5,%2,.Ls%3", xoperands);
- output_asm_insn ("st.s %?r31,4(%6)", xoperands);
- }
- else /* chunk_size == 1 */
- {
- output_asm_insn ("ld.b %2(%1),%?r31", xoperands);
- output_asm_insn ("bla %5,%2,.Ls%3", xoperands);
- output_asm_insn ("st.b %?r31,2(%6)", xoperands);
- }
- output_asm_insn ("\n.Le%3:", xoperands); /* Here if count <= 0. */
-
- return "";
-}
-
-/* Output a delayed branch insn with the delay insn in its
- branch slot. The delayed branch insn template is in TEMPLATE,
- with operands OPERANDS. The insn in its delay slot is INSN.
-
- As a special case, since we know that all memory transfers are via
- ld/st insns, if we see a (MEM (SYMBOL_REF ...)) we divide the memory
- reference around the branch as
-
- orh ha%x,%?r0,%?r31
- b ...
- ld/st l%x(%?r31),...
-
- As another special case, we handle loading (SYMBOL_REF ...) and
- other large constants around branches as well:
-
- orh h%x,%?r0,%0
- b ...
- or l%x,%0,%1
-
- */
-
-char *
-output_delayed_branch (template, operands, insn)
- char *template;
- rtx *operands;
- rtx insn;
-{
- rtx src = XVECEXP (PATTERN (insn), 0, 1);
- rtx dest = XVECEXP (PATTERN (insn), 0, 0);
-
- /* See if we are doing some branch together with setting some register
- to some 32-bit value which does (or may) have some of the high-order
- 16 bits set. If so, we need to set the register in two stages. One
- stage must be done before the branch, and the other one can be done
- in the delay slot. */
-
- if ( (GET_CODE (src) == CONST_INT
- && ((unsigned) INTVAL (src) & (unsigned) 0xffff0000) != (unsigned) 0)
- || (GET_CODE (src) == SYMBOL_REF)
- || (GET_CODE (src) == LABEL_REF)
- || (GET_CODE (src) == CONST))
- {
- rtx xoperands[2];
- xoperands[0] = dest;
- xoperands[1] = src;
-
- CC_STATUS_PARTIAL_INIT;
- /* Output the `orh' insn. */
- output_asm_insn ("orh %H1,%?r0,%0", xoperands);
-
- /* Output the branch instruction next. */
- output_asm_insn (template, operands);
-
- /* Now output the `or' insn. */
- output_asm_insn ("or %L1,%0,%0", xoperands);
- }
- else if ((GET_CODE (src) == MEM
- && CONSTANT_ADDRESS_P (XEXP (src, 0)))
- || (GET_CODE (dest) == MEM
- && CONSTANT_ADDRESS_P (XEXP (dest, 0))))
- {
- rtx xoperands[2];
- char *split_template;
- xoperands[0] = dest;
- xoperands[1] = src;
-
- /* Output the `orh' insn. */
- if (GET_CODE (src) == MEM)
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && cc_prev_status.mdep == XEXP (operands[1], 0)))
- {
- CC_STATUS_INIT;
- output_asm_insn ("orh %h1,%?r0,%?r31", xoperands);
- }
- split_template = load_opcode (GET_MODE (dest),
- "%L1(%?r31),%0", dest);
- }
- else
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && cc_prev_status.mdep == XEXP (operands[0], 0)))
- {
- CC_STATUS_INIT;
- output_asm_insn ("orh %h0,%?r0,%?r31", xoperands);
- }
- split_template = store_opcode (GET_MODE (dest),
- "%r1,%L0(%?r31)", src);
- }
-
- /* Output the branch instruction next. */
- output_asm_insn (template, operands);
-
- /* Now output the load or store.
- No need to do a CC_STATUS_INIT, because we are branching anyway. */
- output_asm_insn (split_template, xoperands);
- }
- else
- {
- int insn_code_number;
- rtx pat = gen_rtx (SET, VOIDmode, dest, src);
- rtx delay_insn = gen_rtx (INSN, VOIDmode, 0, 0, 0, pat, -1, 0, 0);
- int i;
-
- /* Output the branch instruction first. */
- output_asm_insn (template, operands);
-
- /* Now recognize the insn which we put in its delay slot.
- We must do this after outputting the branch insn,
- since operands may just be a pointer to `recog_operand'. */
- INSN_CODE (delay_insn) = insn_code_number = recog (pat, delay_insn);
- if (insn_code_number == -1)
- abort ();
-
- for (i = 0; i < insn_n_operands[insn_code_number]; i++)
- {
- if (GET_CODE (recog_operand[i]) == SUBREG)
- recog_operand[i] = alter_subreg (recog_operand[i]);
- }
-
- insn_extract (delay_insn);
- if (! constrain_operands (insn_code_number, 1))
- fatal_insn_not_found (delay_insn);
-
- template = insn_template[insn_code_number];
- if (template == 0)
- template = (*insn_outfun[insn_code_number]) (recog_operand, delay_insn);
- output_asm_insn (template, recog_operand);
- }
- CC_STATUS_INIT;
- return "";
-}
-
-/* Output a newly constructed insn DELAY_INSN. */
-char *
-output_delay_insn (delay_insn)
- rtx delay_insn;
-{
- char *template;
- int insn_code_number;
- int i;
-
- /* Now recognize the insn which we put in its delay slot.
- We must do this after outputting the branch insn,
- since operands may just be a pointer to `recog_operand'. */
- insn_code_number = recog_memoized (delay_insn);
- if (insn_code_number == -1)
- abort ();
-
- /* Extract the operands of this delay insn. */
- INSN_CODE (delay_insn) = insn_code_number;
- insn_extract (delay_insn);
-
- /* It is possible that this insn has not been properly scanned by final
- yet. If this insn's operands don't appear in the peephole's
- actual operands, then they won't be fixed up by final, so we
- make sure they get fixed up here. -- This is a kludge. */
- for (i = 0; i < insn_n_operands[insn_code_number]; i++)
- {
- if (GET_CODE (recog_operand[i]) == SUBREG)
- recog_operand[i] = alter_subreg (recog_operand[i]);
- }
-
-#ifdef REGISTER_CONSTRAINTS
- if (! constrain_operands (insn_code_number))
- abort ();
-#endif
-
- cc_prev_status = cc_status;
-
- /* Update `cc_status' for this instruction.
- The instruction's output routine may change it further.
- If the output routine for a jump insn needs to depend
- on the cc status, it should look at cc_prev_status. */
-
- NOTICE_UPDATE_CC (PATTERN (delay_insn), delay_insn);
-
- /* Now get the template for what this insn would
- have been, without the branch. */
-
- template = insn_template[insn_code_number];
- if (template == 0)
- template = (*insn_outfun[insn_code_number]) (recog_operand, delay_insn);
- output_asm_insn (template, recog_operand);
- return "";
-}
-
-/* Special routine to convert an SFmode value represented as a
- CONST_DOUBLE into its equivalent unsigned long bit pattern.
- We convert the value from a double precision floating-point
- value to single precision first, and thence to a bit-wise
- equivalent unsigned long value. This routine is used when
- generating an immediate move of an SFmode value directly
- into a general register because the svr4 assembler doesn't
- grok floating literals in instruction operand contexts. */
-
-unsigned long
-sfmode_constant_to_ulong (x)
- rtx x;
-{
- REAL_VALUE_TYPE d;
- union { float f; unsigned long i; } u2;
-
- if (GET_CODE (x) != CONST_DOUBLE || GET_MODE (x) != SFmode)
- abort ();
-
-#if TARGET_FLOAT_FORMAT != HOST_FLOAT_FORMAT
- error IEEE emulation needed
-#endif
- REAL_VALUE_FROM_CONST_DOUBLE (d, x);
- u2.f = d;
- return u2.i;
-}
-
-/* This function generates the assembly code for function entry.
- The macro FUNCTION_PROLOGUE in i860.h is defined to call this function.
-
- ASM_FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
-
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used.
-
- NOTE: `frame_lower_bytes' is the count of bytes which will lie
- between the new `fp' value and the new `sp' value after the
- prologue is done. `frame_upper_bytes' is the count of bytes
- that will lie between the new `fp' and the *old* `sp' value
- after the new `fp' is setup (in the prologue). The upper
- part of each frame always includes at least 2 words (8 bytes)
- to hold the saved frame pointer and the saved return address.
-
- The svr4 ABI for the i860 now requires that the values of the
- stack pointer and frame pointer registers be kept aligned to
- 16-byte boundaries at all times. We obey that restriction here.
-
- The svr4 ABI for the i860 is entirely vague when it comes to specifying
- exactly where the "preserved" registers should be saved. The native
- svr4 C compiler I now have doesn't help to clarify the requirements
- very much because it is plainly out-of-date and non-ABI-compliant
- (in at least one important way, i.e. how it generates function
- epilogues).
-
- The native svr4 C compiler saves the "preserved" registers (i.e.
- r4-r15 and f2-f7) in the lower part of a frame (i.e. at negative
- offsets from the frame pointer).
-
- Previous versions of GCC also saved the "preserved" registers in the
- "negative" part of the frame, but they saved them using positive
- offsets from the (adjusted) stack pointer (after it had been adjusted
- to allocate space for the new frame). That's just plain wrong
- because if the current function calls alloca(), the stack pointer
- will get moved, and it will be impossible to restore the registers
- properly again after that.
-
- Both compilers handled parameter registers (i.e. r16-r27 and f8-f15)
- by copying their values either into various "preserved" registers or
- into stack slots in the lower part of the current frame (as seemed
- appropriate, depending upon subsequent usage of these values).
-
- Here we want to save the preserved registers at some offset from the
- frame pointer register so as to avoid any possible problems arising
- from calls to alloca(). We can either save them at small positive
- offsets from the frame pointer, or at small negative offsets from
- the frame pointer. If we save them at small negative offsets from
- the frame pointer (i.e. in the lower part of the frame) then we
- must tell the rest of GCC (via STARTING_FRAME_OFFSET) exactly how
- many bytes of space we plan to use in the lower part of the frame
- for this purpose. Since other parts of the compiler reference the
- value of STARTING_FRAME_OFFSET long before final() calls this function,
- we would have to go ahead and assume the worst-case storage requirements
- for saving all of the "preserved" registers (and use that number, i.e.
- `80', to define STARTING_FRAME_OFFSET) if we wanted to save them in
- the lower part of the frame. That could potentially be very wasteful,
- and that wastefulness could really hamper people compiling for embedded
- i860 targets with very tight limits on stack space. Thus, we choose
- here to save the preserved registers in the upper part of the
- frame, so that we can decide at the very last minute how much (or how
- little) space we must allocate for this purpose.
-
- To satisfy the needs of the svr4 ABI "tdesc" scheme, preserved
- registers must always be saved so that the saved values of registers
- with higher numbers are at higher addresses. We obey that restriction
- here.
-
- There are two somewhat different ways that you can generate prologues
- here... i.e. pedantically ABI-compliant, and the "other" way. The
- "other" way is more consistent with what is currently generated by the
- "native" svr4 C compiler for the i860. That's important if you want
- to use the current (as of 8/91) incarnation of svr4 SDB for the i860.
- The SVR4 SDB for the i860 insists on having function prologues be
- non-ABI-compliant!
-
- To get fully ABI-compliant prologues, define I860_STRICT_ABI_PROLOGUES
- in the i860svr4.h file. (By default this is *not* defined).
-
- The differences between the ABI-compliant and non-ABI-compliant prologues
- are that (a) the ABI version seems to require the use of *signed*
- (rather than unsigned) adds and subtracts, and (b) the ordering of
- the various steps (e.g. saving preserved registers, saving the
- return address, setting up the new frame pointer value) is different.
-
- For strict ABI compliance, it seems to be the case that the very last
- thing that is supposed to happen in the prologue is getting the frame
- pointer set to its new value (but only after everything else has
- already been properly setup). We do that here, but only if the symbol
- I860_STRICT_ABI_PROLOGUES is defined.
-*/
-
-#ifndef STACK_ALIGNMENT
-#define STACK_ALIGNMENT 16
-#endif
-
-extern char call_used_regs[];
-extern int leaf_function_p ();
-
-char *current_function_original_name;
-
-static int must_preserve_r1;
-static unsigned must_preserve_bytes;
-
-void
-function_prologue (asm_file, local_bytes)
- register FILE *asm_file;
- register unsigned local_bytes;
-{
- register unsigned frame_lower_bytes;
- register unsigned frame_upper_bytes;
- register unsigned total_fsize;
- register unsigned preserved_reg_bytes = 0;
- register unsigned i;
- register unsigned preserved_so_far = 0;
-
- must_preserve_r1 = (optimize < 2 || ! leaf_function_p ());
- must_preserve_bytes = 4 + (must_preserve_r1 ? 4 : 0);
-
- /* Count registers that need preserving. Ignore r0. It never needs
- preserving. */
-
- for (i = 1; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (regs_ever_live[i] && ! call_used_regs[i])
- preserved_reg_bytes += 4;
- }
-
- /* Round-up the frame_lower_bytes so that it's a multiple of 16. */
-
- frame_lower_bytes = (local_bytes + STACK_ALIGNMENT - 1) & -STACK_ALIGNMENT;
-
- /* The upper part of each frame will contain the saved fp,
- the saved r1, and stack slots for all of the other "preserved"
- registers that we find we will need to save & restore. */
-
- frame_upper_bytes = must_preserve_bytes + preserved_reg_bytes;
-
- /* Round-up the frame_upper_bytes so that it's a multiple of 16. */
-
- frame_upper_bytes
- = (frame_upper_bytes + STACK_ALIGNMENT - 1) & -STACK_ALIGNMENT;
-
- total_fsize = frame_upper_bytes + frame_lower_bytes;
-
-#ifndef I860_STRICT_ABI_PROLOGUES
-
- /* There are two kinds of function prologues.
- You use the "small" version if the total frame size is
- small enough so that it can fit into an immediate 16-bit
- value in one instruction. Otherwise, you use the "large"
- version of the function prologue. */
-
- if (total_fsize > 0x7fff)
- {
- /* Adjust the stack pointer. The ABI sez to do this using `adds',
- but the native C compiler on svr4 uses `addu'. */
-
- fprintf (asm_file, "\taddu -%d,%ssp,%ssp\n",
- frame_upper_bytes, i860_reg_prefix, i860_reg_prefix);
-
- /* Save the old frame pointer. */
-
- fprintf (asm_file, "\tst.l %sfp,0(%ssp)\n",
- i860_reg_prefix, i860_reg_prefix);
-
- /* Setup the new frame pointer. The ABI sez to do this after
- preserving registers (using adds), but that's not what the
- native C compiler on svr4 does. */
-
- fprintf (asm_file, "\taddu 0,%ssp,%sfp\n",
- i860_reg_prefix, i860_reg_prefix);
-
- /* Get the value of frame_lower_bytes into r31. */
-
- fprintf (asm_file, "\torh %d,%sr0,%sr31\n",
- frame_lower_bytes >> 16, i860_reg_prefix, i860_reg_prefix);
- fprintf (asm_file, "\tor %d,%sr31,%sr31\n",
- frame_lower_bytes & 0xffff, i860_reg_prefix, i860_reg_prefix);
-
- /* Now re-adjust the stack pointer using the value in r31.
- The ABI sez to do this with `subs' but SDB may prefer `subu'. */
-
- fprintf (asm_file, "\tsubu %ssp,%sr31,%ssp\n",
- i860_reg_prefix, i860_reg_prefix, i860_reg_prefix);
-
- /* Preserve registers. The ABI sez to do this before setting
- up the new frame pointer, but that's not what the native
- C compiler on svr4 does. */
-
- for (i = 1; i < 32; i++)
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (asm_file, "\tst.l %s%s,%d(%sfp)\n",
- i860_reg_prefix, reg_names[i],
- must_preserve_bytes + (4 * preserved_so_far++),
- i860_reg_prefix);
-
- for (i = 32; i < 64; i++)
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (asm_file, "\tfst.l %s%s,%d(%sfp)\n",
- i860_reg_prefix, reg_names[i],
- must_preserve_bytes + (4 * preserved_so_far++),
- i860_reg_prefix);
-
- /* Save the return address. */
-
- if (must_preserve_r1)
- fprintf (asm_file, "\tst.l %sr1,4(%sfp)\n",
- i860_reg_prefix, i860_reg_prefix);
- }
- else
- {
- /* Adjust the stack pointer. The ABI sez to do this using `adds',
- but the native C compiler on svr4 uses `addu'. */
-
- fprintf (asm_file, "\taddu -%d,%ssp,%ssp\n",
- total_fsize, i860_reg_prefix, i860_reg_prefix);
-
- /* Save the old frame pointer. */
-
- fprintf (asm_file, "\tst.l %sfp,%d(%ssp)\n",
- i860_reg_prefix, frame_lower_bytes, i860_reg_prefix);
-
- /* Setup the new frame pointer. The ABI sez to do this after
- preserving registers and after saving the return address,
- (and its saz to do this using adds), but that's not what the
- native C compiler on svr4 does. */
-
- fprintf (asm_file, "\taddu %d,%ssp,%sfp\n",
- frame_lower_bytes, i860_reg_prefix, i860_reg_prefix);
-
- /* Preserve registers. The ABI sez to do this before setting
- up the new frame pointer, but that's not what the native
- compiler on svr4 does. */
-
- for (i = 1; i < 32; i++)
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (asm_file, "\tst.l %s%s,%d(%sfp)\n",
- i860_reg_prefix, reg_names[i],
- must_preserve_bytes + (4 * preserved_so_far++),
- i860_reg_prefix);
-
- for (i = 32; i < 64; i++)
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (asm_file, "\tfst.l %s%s,%d(%sfp)\n",
- i860_reg_prefix, reg_names[i],
- must_preserve_bytes + (4 * preserved_so_far++),
- i860_reg_prefix);
-
- /* Save the return address. The ABI sez to do this earlier,
- and also via an offset from %sp, but the native C compiler
- on svr4 does it later (i.e. now) and uses an offset from
- %fp. */
-
- if (must_preserve_r1)
- fprintf (asm_file, "\tst.l %sr1,4(%sfp)\n",
- i860_reg_prefix, i860_reg_prefix);
- }
-
-#else /* defined(I860_STRICT_ABI_PROLOGUES) */
-
- /* There are two kinds of function prologues.
- You use the "small" version if the total frame size is
- small enough so that it can fit into an immediate 16-bit
- value in one instruction. Otherwise, you use the "large"
- version of the function prologue. */
-
- if (total_fsize > 0x7fff)
- {
- /* Adjust the stack pointer (thereby allocating a new frame). */
-
- fprintf (asm_file, "\tadds -%d,%ssp,%ssp\n",
- frame_upper_bytes, i860_reg_prefix, i860_reg_prefix);
-
- /* Save the caller's frame pointer. */
-
- fprintf (asm_file, "\tst.l %sfp,0(%ssp)\n",
- i860_reg_prefix, i860_reg_prefix);
-
- /* Save return address. */
-
- if (must_preserve_r1)
- fprintf (asm_file, "\tst.l %sr1,4(%ssp)\n",
- i860_reg_prefix, i860_reg_prefix);
-
- /* Get the value of frame_lower_bytes into r31 for later use. */
-
- fprintf (asm_file, "\torh %d,%sr0,%sr31\n",
- frame_lower_bytes >> 16, i860_reg_prefix, i860_reg_prefix);
- fprintf (asm_file, "\tor %d,%sr31,%sr31\n",
- frame_lower_bytes & 0xffff, i860_reg_prefix, i860_reg_prefix);
-
- /* Now re-adjust the stack pointer using the value in r31. */
-
- fprintf (asm_file, "\tsubs %ssp,%sr31,%ssp\n",
- i860_reg_prefix, i860_reg_prefix, i860_reg_prefix);
-
- /* Pre-compute value to be used as the new frame pointer. */
-
- fprintf (asm_file, "\tadds %ssp,%sr31,%sr31\n",
- i860_reg_prefix, i860_reg_prefix, i860_reg_prefix);
-
- /* Preserve registers. */
-
- for (i = 1; i < 32; i++)
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (asm_file, "\tst.l %s%s,%d(%sr31)\n",
- i860_reg_prefix, reg_names[i],
- must_preserve_bytes + (4 * preserved_so_far++),
- i860_reg_prefix);
-
- for (i = 32; i < 64; i++)
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (asm_file, "\tfst.l %s%s,%d(%sr31)\n",
- i860_reg_prefix, reg_names[i],
- must_preserve_bytes + (4 * preserved_so_far++),
- i860_reg_prefix);
-
- /* Actually set the new value of the frame pointer. */
-
- fprintf (asm_file, "\tmov %sr31,%sfp\n",
- i860_reg_prefix, i860_reg_prefix);
- }
- else
- {
- /* Adjust the stack pointer. */
-
- fprintf (asm_file, "\tadds -%d,%ssp,%ssp\n",
- total_fsize, i860_reg_prefix, i860_reg_prefix);
-
- /* Save the caller's frame pointer. */
-
- fprintf (asm_file, "\tst.l %sfp,%d(%ssp)\n",
- i860_reg_prefix, frame_lower_bytes, i860_reg_prefix);
-
- /* Save the return address. */
-
- if (must_preserve_r1)
- fprintf (asm_file, "\tst.l %sr1,%d(%ssp)\n",
- i860_reg_prefix, frame_lower_bytes + 4, i860_reg_prefix);
-
- /* Preserve registers. */
-
- for (i = 1; i < 32; i++)
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (asm_file, "\tst.l %s%s,%d(%ssp)\n",
- i860_reg_prefix, reg_names[i],
- frame_lower_bytes + must_preserve_bytes + (4 * preserved_so_far++),
- i860_reg_prefix);
-
- for (i = 32; i < 64; i++)
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (asm_file, "\tfst.l %s%s,%d(%ssp)\n",
- i860_reg_prefix, reg_names[i],
- frame_lower_bytes + must_preserve_bytes + (4 * preserved_so_far++),
- i860_reg_prefix);
-
- /* Setup the new frame pointer. */
-
- fprintf (asm_file, "\tadds %d,%ssp,%sfp\n",
- frame_lower_bytes, i860_reg_prefix, i860_reg_prefix);
- }
-#endif /* defined(I860_STRICT_ABI_PROLOGUES) */
-
-#ifdef ASM_OUTPUT_PROLOGUE_SUFFIX
- ASM_OUTPUT_PROLOGUE_SUFFIX (asm_file);
-#endif /* defined(ASM_OUTPUT_PROLOGUE_SUFFIX) */
-}
-
-/* This function generates the assembly code for function exit.
- The macro FUNCTION_EPILOGUE in i860.h is defined to call this function.
-
- ASM_FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning.
-
- Note that when we go to restore the preserved register values we must
- not try to address their slots by using offsets from the stack pointer.
- That's because the stack pointer may have been moved during the function
- execution due to a call to alloca(). Rather, we must restore all
- preserved registers via offsets from the frame pointer value.
-
- Note also that when the current frame is being "popped" (by adjusting
- the value of the stack pointer) on function exit, we must (for the
- sake of alloca) set the new value of the stack pointer based upon
- the current value of the frame pointer. We can't just add what we
- believe to be the (static) frame size to the stack pointer because
- if we did that, and alloca() had been called during this function,
- we would end up returning *without* having fully deallocated all of
- the space grabbed by alloca. If that happened, and a function
- containing one or more alloca() calls was called over and over again,
- then the stack would grow without limit!
-
- Finally note that the epilogues generated here are completely ABI
- compliant. They go out of their way to insure that the value in
- the frame pointer register is never less than the value in the stack
- pointer register. It's not clear why this relationship needs to be
- maintained at all times, but maintaining it only costs one extra
- instruction, so what the hell.
-*/
-
-/* This corresponds to a version 4 TDESC structure. Lower numbered
- versions successively omit the last word of the structure. We
- don't try to handle version 5 here. */
-
-typedef struct TDESC_flags {
- int version:4;
- int reg_packing:1;
- int callable_block:1;
- int reserved:4;
- int fregs:6; /* fp regs 2-7 */
- int iregs:16; /* regs 0-15 */
-} TDESC_flags;
-
-typedef struct TDESC {
- TDESC_flags flags;
- int integer_reg_offset; /* same as must_preserve_bytes */
- int floating_point_reg_offset;
- unsigned int positive_frame_size; /* same as frame_upper_bytes */
- unsigned int negative_frame_size; /* same as frame_lower_bytes */
-} TDESC;
-
-void
-function_epilogue (asm_file, local_bytes)
- register FILE *asm_file;
- register unsigned local_bytes;
-{
- register unsigned frame_upper_bytes;
- register unsigned frame_lower_bytes;
- register unsigned preserved_reg_bytes = 0;
- register unsigned i;
- register unsigned restored_so_far = 0;
- register unsigned int_restored;
- register unsigned mask;
- unsigned intflags=0;
- register TDESC_flags *flags = (TDESC_flags *) &intflags;
-
- flags->version = 4;
- flags->reg_packing = 1;
- flags->iregs = 8; /* old fp always gets saved */
-
- /* Round-up the frame_lower_bytes so that it's a multiple of 16. */
-
- frame_lower_bytes = (local_bytes + STACK_ALIGNMENT - 1) & -STACK_ALIGNMENT;
-
- /* Count the number of registers that were preserved in the prologue.
- Ignore r0. It is never preserved. */
-
- for (i = 1; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (regs_ever_live[i] && ! call_used_regs[i])
- preserved_reg_bytes += 4;
- }
-
- /* The upper part of each frame will contain only saved fp,
- the saved r1, and stack slots for all of the other "preserved"
- registers that we find we will need to save & restore. */
-
- frame_upper_bytes = must_preserve_bytes + preserved_reg_bytes;
-
- /* Round-up frame_upper_bytes so that t is a multiple of 16. */
-
- frame_upper_bytes
- = (frame_upper_bytes + STACK_ALIGNMENT - 1) & -STACK_ALIGNMENT;
-
- /* Restore all of the "preserved" registers that need restoring. */
-
- mask = 2;
-
- for (i = 1; i < 32; i++, mask<<=1)
- if (regs_ever_live[i] && ! call_used_regs[i]) {
- fprintf (asm_file, "\tld.l %d(%sfp),%s%s\n",
- must_preserve_bytes + (4 * restored_so_far++),
- i860_reg_prefix, i860_reg_prefix, reg_names[i]);
- if (i > 3 && i < 16)
- flags->iregs |= mask;
- }
-
- int_restored = restored_so_far;
- mask = 1;
-
- for (i = 32; i < 64; i++) {
- if (regs_ever_live[i] && ! call_used_regs[i]) {
- fprintf (asm_file, "\tfld.l %d(%sfp),%s%s\n",
- must_preserve_bytes + (4 * restored_so_far++),
- i860_reg_prefix, i860_reg_prefix, reg_names[i]);
- if (i > 33 & i < 40)
- flags->fregs |= mask;
- }
- if (i > 33 && i < 40)
- mask<<=1;
- }
-
- /* Get the value we plan to use to restore the stack pointer into r31. */
-
- fprintf (asm_file, "\tadds %d,%sfp,%sr31\n",
- frame_upper_bytes, i860_reg_prefix, i860_reg_prefix);
-
- /* Restore the return address and the old frame pointer. */
-
- if (must_preserve_r1) {
- fprintf (asm_file, "\tld.l 4(%sfp),%sr1\n",
- i860_reg_prefix, i860_reg_prefix);
- flags->iregs |= 2;
- }
-
- fprintf (asm_file, "\tld.l 0(%sfp),%sfp\n",
- i860_reg_prefix, i860_reg_prefix);
-
- /* Return and restore the old stack pointer value. */
-
- fprintf (asm_file, "\tbri %sr1\n\tmov %sr31,%ssp\n",
- i860_reg_prefix, i860_reg_prefix, i860_reg_prefix);
-
-#ifdef OUTPUT_TDESC /* Output an ABI-compliant TDESC entry */
- if (! frame_lower_bytes) {
- flags->version--;
- if (! frame_upper_bytes) {
- flags->version--;
- if (restored_so_far == int_restored) /* No FP saves */
- flags->version--;
- }
- }
- assemble_name(asm_file,current_function_original_name);
- fputs(".TDESC:\n", asm_file);
- fprintf(asm_file, "%s 0x%0x\n", ASM_LONG, intflags);
- fprintf(asm_file, "%s %d\n", ASM_LONG,
- int_restored ? must_preserve_bytes : 0);
- if (flags->version > 1) {
- fprintf(asm_file, "%s %d\n", ASM_LONG,
- (restored_so_far == int_restored) ? 0 : must_preserve_bytes +
- (4 * int_restored));
- if (flags->version > 2) {
- fprintf(asm_file, "%s %d\n", ASM_LONG, frame_upper_bytes);
- if (flags->version > 3)
- fprintf(asm_file, "%s %d\n", ASM_LONG, frame_lower_bytes);
- }
- }
- tdesc_section();
- fprintf(asm_file, "%s ", ASM_LONG);
- assemble_name(asm_file, current_function_original_name);
- fprintf(asm_file, "\n%s ", ASM_LONG);
- assemble_name(asm_file, current_function_original_name);
- fputs(".TDESC\n", asm_file);
- text_section();
-#endif
-}
diff --git a/gcc/config/i860/i860.h b/gcc/config/i860/i860.h
deleted file mode 100644
index 29a42cca316..00000000000
--- a/gcc/config/i860/i860.h
+++ /dev/null
@@ -1,1431 +0,0 @@
-/* Definitions of target machine for GNU compiler, for Intel 860.
- Copyright (C) 1989, 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
- Hacked substantially by Ron Guilmette (rfg@segfault.us.com) to cater to
- the whims of the System V Release 4 assembler.
-
-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. */
-
-
-/* Note that some other tm.h files include this one and then override
- many of the definitions that relate to assembler syntax. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Di860 -Dunix -Asystem(unix) -Asystem(svr4) -Acpu(i860) -Amachine(i860)"
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION fprintf (stderr, " (i860)");
-
-/* Run-time compilation parameters selecting different hardware subsets
- or supersets.
-
- On the i860, we have one: TARGET_XP. This option allows gcc to generate
- additional instructions available only on the newer i860 XP (but not on
- the older i860 XR).
-*/
-
-extern int target_flags;
-
-/* Nonzero if we should generate code to use the fpu. */
-#define TARGET_XP (target_flags & 1)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { {"xp", 1}, \
- {"noxp", -1}, \
- {"xr", -1}, \
- { "", TARGET_DEFAULT}}
-
-#define TARGET_DEFAULT 0
-
-/* target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is a moot question on the i860 due to the lack of bit-field insns. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is not true on i860 in the mode we will use. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-/* For the i860 this goes with BYTES_BIG_ENDIAN. */
-/* NOTE: GCC probably cannot support a big-endian i860
- because GCC fundamentally assumes that the order of words
- in memory as the same as the order in registers.
- That's not true for the big-endian i860.
- The big-endian i860 isn't important enough to
- justify the trouble of changing this assumption. */
-#define WORDS_BIG_ENDIAN 0
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 128
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 64
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* Minimum size in bits of the largest boundary to which any
- and all fundamental data types supported by the hardware
- might need to be aligned. No data type wants to be aligned
- rounder than this. The i860 supports 128-bit (long double)
- floating point quantities, and the System V Release 4 i860
- ABI requires these to be aligned to 16-byte (128-bit)
- boundaries. */
-#define BIGGEST_ALIGNMENT 128
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* If bit field type is int, dont let it cross an int,
- and give entire struct the alignment of an int. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- i860 has 32 fullword registers and 32 floating point registers. */
-
-#define FIRST_PSEUDO_REGISTER 64
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the i860, this includes the always-0 registers
- and fp, sp, arg pointer, and the return address.
- Also r31, used for special purposes for constant addresses. */
-#define FIXED_REGISTERS \
- {1, 1, 1, 1, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 1, \
- 1, 1, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- On the i860, these are r0-r3, r16-r31, f0, f1, and f16-f31. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1}
-
-/* Try to get a non-preserved register before trying to get one we will
- have to preserve. Try to get an FP register only *after* trying to
- get a general register, because it is relatively expensive to move
- into or out of an FP register. */
-
-#define REG_ALLOC_ORDER \
- {31, 30, 29, 28, 27, 26, 25, 24, \
- 23, 22, 21, 20, 19, 18, 17, 16, \
- 15, 14, 13, 12, 11, 10, 9, 8, \
- 7, 6, 5, 4, 3, 2, 1, 0, \
- 63, 62, 61, 60, 59, 58, 57, 56, \
- 55, 54, 53, 52, 51, 50, 49, 48, \
- 47, 46, 45, 44, 43, 42, 41, 40, \
- 39, 38, 37, 36, 35, 34, 33, 32}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On the i860, all registers hold 32 bits worth. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-#define REGNO_MODE_ALIGNED(REGNO, MODE) \
- (((REGNO) % ((GET_MODE_UNIT_SIZE (MODE) + 3) / 4)) == 0)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
-
- On the i860, we allow anything to go into any registers, but we require
- any sort of value going into the FP registers to be properly aligned
- (based on its size) within the FP register set.
-*/
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (((REGNO) < 32) \
- || (MODE) == VOIDmode || (MODE) == BLKmode \
- || REGNO_MODE_ALIGNED (REGNO, MODE))
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-/* I think that is not always true; alignment restrictions for doubles
- should not prevent tying them with singles. So try allowing that.
- On the other hand, don't let fixed and floating be tied;
- this restriction is not necessary, but may make better code. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- ((GET_MODE_CLASS (MODE1) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
- == (GET_MODE_CLASS (MODE2) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* i860 pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 2
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 3
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 1
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 28
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 29
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 16
-
-/* Register to use when a source of a floating-point zero is needed. */
-#define F0_REGNUM 32
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The i860 has two kinds of registers, hence four classes. */
-
-enum reg_class { NO_REGS, GENERAL_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
- {{0, 0}, {0xffffffff, 0}, \
- {0, 0xffffffff}, {0xffffffff, 0xffffffff}}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) >= 32 ? FP_REGS : GENERAL_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'f' ? FP_REGS : NO_REGS)
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For the i860, `I' is used for the range of constants
- an add/subtract insn can actually contain.
- But not including -0x8000, since we need
- to negate the constant sometimes.
- `J' is used for the range which is just zero (since that is R0).
- `K' is used for the range allowed in bte.
- `L' is used for the range allowed in logical insns. */
-
-#define SMALL_INT(X) ((unsigned) (INTVAL (X) + 0x7fff) < 0xffff)
-
-#define LOGIC_INT(X) ((unsigned) INTVAL (X) < 0x10000)
-
-#define SMALL_INTVAL(X) ((unsigned) ((X) + 0x7fff) < 0xffff)
-
-#define LOGIC_INTVAL(X) ((unsigned) (X) < 0x10000)
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? ((unsigned) (VALUE) + 0x7fff) < 0xffff \
- : (C) == 'J' ? (VALUE) == 0 \
- : (C) == 'K' ? (unsigned) (VALUE) < 0x20 \
- : (C) == 'L' ? (unsigned) (VALUE) < 0x10000 \
- : 0)
-
-/* Return non-zero if the given VALUE is acceptable for the
- constraint letter C. For the i860, constraint letter 'G'
- permits only a floating-point zero value. */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' && CONST_DOUBLE_LOW ((VALUE)) == 0 \
- && CONST_DOUBLE_HIGH ((VALUE)) == 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
-
- If we are trying to put an integer constant into some register, prefer an
- integer register to an FP register. If we are trying to put a
- non-zero floating-point constant into some register, use an integer
- register if the constant is SFmode and GENERAL_REGS is one of our options.
- Otherwise, put the constant into memory.
-
- When reloading something smaller than a word, use a general reg
- rather than an FP reg. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- ((CLASS) == ALL_REGS && GET_CODE (X) == CONST_INT ? GENERAL_REGS \
- : ((GET_MODE (X) == HImode || GET_MODE (X) == QImode) \
- && (CLASS) == ALL_REGS) \
- ? GENERAL_REGS \
- : (GET_CODE (X) == CONST_DOUBLE \
- && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- && ! CONST_DOUBLE_OK_FOR_LETTER_P (X, 'G')) \
- ? ((CLASS) == ALL_REGS && GET_MODE (X) == SFmode ? GENERAL_REGS \
- : (CLASS) == GENERAL_REGS && GET_MODE (X) == SFmode ? (CLASS) \
- : NO_REGS) \
- : (CLASS))
-
-/* Return the register class of a scratch register needed to copy IN into
- a register in CLASS in MODE. If it can be done directly, NO_REGS is
- returned. */
-
-#define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,IN) \
- ((CLASS) == FP_REGS && CONSTANT_P (IN) ? GENERAL_REGS : NO_REGS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On the i860, this is the size of MODE in words. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On the i860, don't define this because there are no push insns. */
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On the i860, the value register depends on the mode. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), \
- (GET_MODE_CLASS (TYPE_MODE (VALTYPE)) == MODE_FLOAT \
- ? 40 : 16))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, MODE, \
- (GET_MODE_CLASS ((MODE)) == MODE_FLOAT \
- ? 40 : 16))
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 40 || (N) == 16)
-
-/* 1 if N is a possible register number for function argument passing.
- On the i860, these are r16-r27 and f8-f15. */
-
-#define FUNCTION_ARG_REGNO_P(N) \
- (((N) < 28 && (N) > 15) || ((N) < 48 && (N) >= 40))
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the i860, we must count separately the number of general registers used
- and the number of float registers used. */
-
-struct cumulative_args { int ints, floats; };
-#define CUMULATIVE_ARGS struct cumulative_args
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the i860, the general-reg offset normally starts at 0,
- but starts at 4 bytes
- when the function gets a structure-value-address as an
- invisible first argument. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM).ints = ((FNTYPE) != 0 && aggregate_value_p (TREE_TYPE ((FNTYPE))) \
- ? 4 : 0), \
- (CUM).floats = 0)
-
-/* Machine-specific subroutines of the following macros. */
-#define CEILING(X,Y) (((X) + (Y) - 1) / (Y))
-#define ROUNDUP(X,Y) (CEILING ((X), (Y)) * (Y))
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.)
- Floats, and doubleword ints, are returned in f regs;
- other ints, in r regs.
- Aggregates, even short ones, are passed in memory. */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((TYPE) != 0 && (TREE_CODE ((TYPE)) == RECORD_TYPE \
- || TREE_CODE ((TYPE)) == UNION_TYPE) \
- ? 0 \
- : GET_MODE_CLASS ((MODE)) == MODE_FLOAT || (MODE) == DImode \
- ? ((CUM).floats = (ROUNDUP ((CUM).floats, GET_MODE_SIZE ((MODE))) \
- + ROUNDUP (GET_MODE_SIZE (MODE), 4))) \
- : GET_MODE_CLASS ((MODE)) == MODE_INT \
- ? ((CUM).ints = (ROUNDUP ((CUM).ints, GET_MODE_SIZE ((MODE))) \
- + ROUNDUP (GET_MODE_SIZE (MODE), 4))) \
- : 0)
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the i860, the first 12 words of integer arguments go in r16-r27,
- and the first 8 words of floating arguments go in f8-f15.
- DImode values are treated as floats. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- ((TYPE) != 0 && (TREE_CODE ((TYPE)) == RECORD_TYPE \
- || TREE_CODE ((TYPE)) == UNION_TYPE) \
- ? 0 \
- : GET_MODE_CLASS ((MODE)) == MODE_FLOAT || (MODE) == DImode \
- ? (ROUNDUP ((CUM).floats, GET_MODE_SIZE ((MODE))) < 32 \
- ? gen_rtx (REG, (MODE), \
- 40+(ROUNDUP ((CUM).floats, \
- GET_MODE_SIZE ((MODE))) \
- / 4)) \
- : 0) \
- : GET_MODE_CLASS ((MODE)) == MODE_INT \
- ? (ROUNDUP ((CUM).ints, GET_MODE_SIZE ((MODE))) < 48 \
- ? gen_rtx (REG, (MODE), \
- 16+(ROUNDUP ((CUM).ints, \
- GET_MODE_SIZE ((MODE))) \
- / 4)) \
- : 0) \
- : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
-
-/* If defined, a C expression that gives the alignment boundary, in
- bits, of an argument with the specified mode and type. If it is
- not defined, `PARM_BOUNDARY' is used for all arguments. */
-
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
- (((TYPE) != 0) \
- ? ((TYPE_ALIGN(TYPE) <= PARM_BOUNDARY) \
- ? PARM_BOUNDARY \
- : TYPE_ALIGN(TYPE)) \
- : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
- ? PARM_BOUNDARY \
- : GET_MODE_ALIGNMENT(MODE)))
-
-/* This macro generates the assembly code for function entry.
-
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
-*/
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) function_prologue ((FILE), (SIZE))
-
-/* Output a no-op just before the beginning of the function,
- to ensure that there does not appear to be a delayed branch there.
- Such a thing would confuse interrupt recovery. */
-#define ASM_OUTPUT_FUNCTION_PREFIX(FILE,NAME) \
- fprintf (FILE, "\tnop\n")
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- abort ();
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit.
-
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning.
-*/
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) function_epilogue ((FILE), (SIZE))
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved.
-
- On the i860, FRAME_POINTER_REQUIRED is always 1, so the definition of this
- macro doesn't matter. But it must be defined. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
- do { (DEPTH) = 0; } while (0)
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On the i860, the trampoline contains five instructions:
- orh #TOP_OF_FUNCTION,r0,r31
- or #BOTTOM_OF_FUNCTION,r31,r31
- orh #TOP_OF_STATIC,r0,r29
- bri r31
- or #BOTTOM_OF_STATIC,r29,r29 */
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xec1f0000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xe7ff0000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xec1d0000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x4000f800)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0xe7bd0000)); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 20
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function.
-
- Store hi function at +0, low function at +4,
- hi static at +8, low static at +16 */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- rtx cxt = force_reg (Pmode, CXT); \
- rtx fn = force_reg (Pmode, FNADDR); \
- rtx hi_cxt = expand_shift (RSHIFT_EXPR, SImode, cxt, \
- size_int (16), 0, 0); \
- rtx hi_fn = expand_shift (RSHIFT_EXPR, SImode, fn, \
- size_int (16), 0, 0); \
- emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 16)), \
- gen_lowpart (HImode, cxt)); \
- emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 4)), \
- gen_lowpart (HImode, fn)); \
- emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 8)), \
- gen_lowpart (HImode, hi_cxt)); \
- emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 0)), \
- gen_lowpart (HImode, hi_fn)); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
-((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
-#define REGNO_OK_FOR_FP_P(REGNO) \
-(((REGNO) ^ 0x20) < 32 || (unsigned) (reg_renumber[REGNO] ^ 0x20) < 32)
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-
- These macros are specific to the i860, and may be used only
- in code for printing assembler insns and in conditions for
- define_optimization. */
-
-/* 1 if X is an fp register. */
-
-#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
-
- On the Sparc, this is anything but a CONST_DOUBLE.
- Let's try permitting CONST_DOUBLEs and see what happens. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On the i860, the actual addresses must be REG+REG or REG+SMALLINT.
- But we can treat a SYMBOL_REF as legitimate if it is part of this
- function's constant-pool, because such addresses can actually
- be output as REG+SMALLINT.
-
- The displacement in an address must be a multiple of the alignment.
-
- Try making SYMBOL_REF (and other things which are CONSTANT_ADDRESS_P)
- a legitimate address, regardless. Because the only insns which can use
- memory are load or store insns, the added hair in the machine description
- is not that bad. It should also speed up the compiler by halving the number
- of insns it must manage for each (MEM (SYMBOL_REF ...)) involved. */
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ if (GET_CODE (X) == REG) \
- { if (REG_OK_FOR_BASE_P (X)) goto ADDR; } \
- else if (GET_CODE (X) == PLUS) \
- { \
- if (GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
- { \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && INTVAL (XEXP (X, 1)) >= -0x8000 \
- && INTVAL (XEXP (X, 1)) < 0x8000 \
- && (INTVAL (XEXP (X, 1)) & (GET_MODE_SIZE (MODE) - 1)) == 0) \
- goto ADDR; \
- } \
- else if (GET_CODE (XEXP (X, 1)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
- { \
- if (GET_CODE (XEXP (X, 0)) == CONST_INT \
- && INTVAL (XEXP (X, 0)) >= -0x8000 \
- && INTVAL (XEXP (X, 0)) < 0x8000 \
- && (INTVAL (XEXP (X, 0)) & (GET_MODE_SIZE (MODE) - 1)) == 0) \
- goto ADDR; \
- } \
- } \
- else if (CONSTANT_ADDRESS_P (X)) \
- goto ADDR; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-/* On the i860, change COMPLICATED + CONSTANT to REG+CONSTANT.
- Also change a symbolic constant to a REG,
- though that may not be necessary. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
- force_operand (XEXP (X, 0), 0)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
- force_operand (XEXP (X, 1), 0)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
- force_operand (XEXP (X, 0), 0)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
- force_operand (XEXP (X, 1), 0)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) != REG \
- && GET_CODE (XEXP (X, 0)) != CONST_INT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
- copy_to_mode_reg (SImode, XEXP (X, 0))); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) != REG \
- && GET_CODE (XEXP (X, 1)) != CONST_INT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
- copy_to_mode_reg (SImode, XEXP (X, 1))); \
- if (GET_CODE (x) == SYMBOL_REF) \
- (X) = copy_to_reg (X); \
- if (GET_CODE (x) == CONST) \
- (X) = copy_to_reg (X); \
- if (memory_address_p (MODE, X)) \
- goto WIN; }
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the i860 this is never true.
- There are some addresses that are invalid in wide modes
- but valid for narrower modes, but they shouldn't affect
- the places that use this macro. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Must pass floats to libgcc functions as doubles. */
-#define LIBGCC_NEEDS_DOUBLE 1
-
-#define DIVSI3_LIBCALL "*.div"
-#define UDIVSI3_LIBCALL "*.udiv"
-#define REMSI3_LIBCALL "*.rem"
-#define UREMSI3_LIBCALL "*.urem"
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 16
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Value is 1 if it generates better code to perform an unsigned comparison
- on the given literal integer value in the given mode when we are only
- looking for an equal/non-equal result. */
-/* For the i860, if the immediate value has its high-order 27 bits zero,
- then we want to engineer an unsigned comparison for EQ/NE because
- such values can fit in the 5-bit immediate field of a bte or btne
- instruction (which gets zero extended before comparing). For all
- other immediate values on the i860, we will use signed compares
- because that avoids the need for doing explicit xor's to zero_extend
- the non-constant operand in cases where it was (mem:QI ...) or a
- (mem:HI ...) which always gets automatically sign-extended by the
- hardware upon loading. */
-
-#define LITERAL_COMPARE_BETTER_UNSIGNED(intval, mode) \
- (((unsigned) (intval) & 0x1f) == (unsigned) (intval))
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE SImode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-#define NO_FUNCTION_CSE
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE, OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) == 0) \
- return 0; \
- if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 4; \
- case CONST_DOUBLE: \
- return 6;
-
-/* Specify the cost of a branch insn; roughly the number of extra insns that
- should be added to avoid a branch.
-
- Set this to 3 on the i860 since branches may often take three cycles. */
-
-#define BRANCH_COST 3
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-/* This holds the value sourcing h%r31. We keep this info
- around so that mem/mem ops, such as increment and decrement,
- etc, can be performed reasonably. */
-#define CC_STATUS_MDEP rtx
-
-#define CC_STATUS_MDEP_INIT (cc_status.mdep = 0)
-
-#define CC_NEGATED 01000
-
-/* We use this macro in those places in the i860.md file where we would
- normally just do a CC_STATUS_INIT (for other machines). This macro
- differs from CC_STATUS_INIT in that it doesn't mess with the special
- bits or fields which describe what is currently in the special r31
- scratch register, but it does clear out everything that actually
- relates to the condition code bit of the i860. */
-
-#define CC_STATUS_PARTIAL_INIT \
- (cc_status.flags &= (CC_KNOW_HI_R31 | CC_HI_R31_ADJ), \
- cc_status.value1 = 0, \
- cc_status.value2 = 0)
-
-/* Nonzero if we know the value of h%r31. */
-#define CC_KNOW_HI_R31 0100000
-
-/* Nonzero if h%r31 is actually ha%something, rather than h%something. */
-#define CC_HI_R31_ADJ 0200000
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-/* On the i860, only compare insns set a useful condition code. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ cc_status.flags &= (CC_KNOW_HI_R31 | CC_HI_R31_ADJ); \
- cc_status.value1 = 0; cc_status.value2 = 0; }
-
-/* Control the assembler format that we output. */
-
-/* Assembler pseudos to introduce constants of various size. */
-
-#define ASM_BYTE_OP "\t.byte"
-#define ASM_SHORT "\t.short"
-#define ASM_LONG "\t.long"
-#define ASM_DOUBLE "\t.double"
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-
-#define ASM_FILE_START(FILE)
-#if 0
-#define ASM_FILE_START(FILE) \
- do { output_file_directive ((FILE), main_input_filename); \
- if (optimize) ASM_FILE_START_1 (FILE); \
- } while (0)
-#endif
-
-#define ASM_FILE_START_1(FILE)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "sp", "fp", "r4", "r5", "r6", "r7", "r8", "r9", \
- "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", \
- "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
- "r30", "r31", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", \
- "f10", "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", \
- "f20", "f21", "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", \
- "f30", "f31" }
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
- } while (0)
-
-/* The prefix to add to user-visible assembler symbols.
-
- This definition is overridden in i860v4.h because under System V
- Release 4, user-level symbols are *not* prefixed with underscores in
- the generated assembly code. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
-/* This is how to output an internal numbered label which
- labels a jump table. */
-
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
-do { ASM_OUTPUT_ALIGN ((FILE), 2); \
- ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM); \
- } while (0)
-
-/* Output at the end of a jump table. */
-
-#define ASM_OUTPUT_CASE_END(FILE,NUM,INSN) \
- fprintf (FILE, ".text\n")
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*.%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.double %.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- fprintf (FILE, "\t.float %.12e\n", (VALUE))
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.short "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output code to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\taddu -16,%ssp,%ssp\n\t%sst.l %s%s,0(%ssp)\n", \
- i860_reg_prefix, i860_reg_prefix, \
- ((REGNO) < 32 ? "" : "f"), \
- i860_reg_prefix, reg_names[REGNO], \
- i860_reg_prefix)
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\t%sld.l 0(%ssp),%s%s\n\taddu 16,%ssp,%ssp\n", \
- ((REGNO) < 32 ? "" : "f"), \
- i860_reg_prefix, \
- i860_reg_prefix, reg_names[REGNO], \
- i860_reg_prefix, i860_reg_prefix)
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.long .L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative.
- (The i860 does not use such vectors,
- but we must define this macro anyway.) */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", 1 << (LOG))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.blkb %u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
-
- In the following comments, the term "constant address" is used frequently.
- For an exact definition of what constitutes a "constant address" see the
- output_addr_const routine in final.c
-
- On the i860, the following target-specific special codes are recognized:
-
- `r' The operand can be anything, but if is is an immediate zero
- value (either integer or floating point) then it will be
- represented as `r0' or as `f0' (respectively).
-
- `m' The operand is a memory ref (to a constant address) but print
- its address as a constant.
-
- `L' The operand is a numeric constant, a constant address, or
- a memory ref to a constant address. Print the correct
- notation to yield the low part of the given value or
- address or the low part of the address of the referred
- to memory object.
-
- `H' The operand is a numeric constant, a constant address, or
- a memory ref to a constant address. Print the correct
- notation to yield the high part of the given value or
- address or the high part of the address of the referred
- to memory object.
-
- `h' The operand is a numeric constant, a constant address, or
- a memory ref to a constant address. Either print the
- correct notation to yield the plain high part of the
- given value or address (or the plain high part of the
- address of the memory object) or else print the correct
- notation to yield the "adjusted" high part of the given
- address (or of the address of the referred to memory object).
-
- The choice of what to print depends upon whether the address
- in question is relocatable or not. If it is relocatable,
- print the notation to get the adjusted high part. Otherwise
- just print the notation to get the plain high part. Note
- that "adjusted" high parts are generally used *only* when
- the next following instruction uses the low part of the
- address as an offset, as in `offset(reg)'.
-
- `R' The operand is a floating-pointer register. Print the
- name of the next following (32-bit) floating-point register.
- (This is used when moving a value into just the most
- significant part of a floating-point register pair.)
-
- `?' (takes no operand) Substitute the value of i860_reg_prefix
- at this point. The value of i860_reg_prefix is typically
- a null string for most i860 targets, but for System V
- Release 4 the i860 assembler syntax requires that all
- names of registers be prefixed with a percent-sign, so
- for SVR4, the value of i860_reg_prefix is initialized to
- "%" in i860.c.
-*/
-
-extern char *i860_reg_prefix;
-extern unsigned long sfmode_constant_to_ulong ();
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '?')
-
-/* The following macro definition is overridden in i860v4.h
- because the svr4 i860 assembler required a different syntax
- for getting parts of constant/relocatable values. */
-
-#define PRINT_OPERAND_PART(FILE, X, PART_CODE) \
- do { fprintf (FILE, "%s%%", PART_CODE); \
- output_address (X); \
- } while (0)
-
-#define OPERAND_LOW_PART "l"
-#define OPERAND_HIGH_PART "h"
-/* NOTE: All documentation available for the i860 sez that you must
- use "ha" to get the relocated high part of a relocatable, but
- reality sez different. */
-#define OPERAND_HIGH_ADJ_PART "ha"
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if ((CODE) == '?') \
- fprintf (FILE, "%s", i860_reg_prefix); \
- else if (CODE == 'R') \
- fprintf (FILE, "%s%s", i860_reg_prefix, reg_names[REGNO (X) + 1]); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s%s", i860_reg_prefix, reg_names[REGNO (X)]); \
- else if ((CODE) == 'm') \
- output_address (XEXP (X, 0)); \
- else if ((CODE) == 'L') \
- { \
- if (GET_CODE (X) == MEM) \
- PRINT_OPERAND_PART (FILE, XEXP (X, 0), OPERAND_LOW_PART); \
- else \
- PRINT_OPERAND_PART (FILE, X, OPERAND_LOW_PART); \
- } \
- else if ((CODE) == 'H') \
- { \
- if (GET_CODE (X) == MEM) \
- PRINT_OPERAND_PART (FILE, XEXP (X, 0), OPERAND_HIGH_PART); \
- else \
- PRINT_OPERAND_PART (FILE, X, OPERAND_HIGH_PART); \
- } \
- else if ((CODE) == 'h') \
- { \
- if (GET_CODE (X) == MEM) \
- PRINT_OPERAND_PART (FILE, XEXP (X, 0), OPERAND_HIGH_ADJ_PART); \
- else \
- PRINT_OPERAND_PART (FILE, X, OPERAND_HIGH_ADJ_PART); \
- } \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else if ((CODE) == 'r' && (X) == const0_rtx) \
- fprintf (FILE, "%sr0", i860_reg_prefix); \
- else if ((CODE) == 'r' && (X) == CONST0_RTX (GET_MODE (X))) \
- fprintf (FILE, "%sf0", i860_reg_prefix); \
- else if (GET_CODE (X) == CONST_DOUBLE) \
- fprintf (FILE, "0x%x", sfmode_constant_to_ulong (X)); \
- else \
- output_addr_const (FILE, X); }
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx base, index = 0; \
- int offset = 0; \
- register rtx addr = ADDR; \
- if (GET_CODE (addr) == REG) \
- { \
- fprintf (FILE, "0(%s%s)", \
- i860_reg_prefix, reg_names[REGNO (addr)]); \
- } \
- else if (GET_CODE (addr) == CONST_DOUBLE \
- && GET_MODE (addr) == SFmode) \
- fprintf (FILE, "0x%x", sfmode_constant_to_ulong (addr)); \
- else if (GET_CODE (addr) == PLUS) \
- { \
- if ((GET_CODE (XEXP (addr, 0)) == CONST_INT) \
- && (GET_CODE (XEXP (addr, 1)) == REG)) \
- fprintf (FILE, "%d(%s%s)", INTVAL (XEXP (addr, 0)), \
- i860_reg_prefix, reg_names[REGNO (XEXP (addr, 1))]);\
- else if ((GET_CODE (XEXP (addr, 1)) == CONST_INT) \
- && (GET_CODE (XEXP (addr, 0)) == REG)) \
- fprintf (FILE, "%d(%s%s)", INTVAL (XEXP (addr, 1)), \
- i860_reg_prefix, reg_names[REGNO (XEXP (addr, 0))]);\
- else if ((GET_CODE (XEXP (addr, 0)) == REG) \
- && (GET_CODE (XEXP (addr, 1)) == REG)) \
- fprintf (FILE, "%s%s(%s%s)", \
- i860_reg_prefix, reg_names[REGNO (XEXP (addr, 0))], \
- i860_reg_prefix, reg_names[REGNO (XEXP (addr, 1))]);\
- else \
- output_addr_const (FILE, addr); \
- } \
- else \
- { \
- output_addr_const (FILE, addr); \
- } \
-}
-
-/* The following #defines are used when compiling the routines in
- libgcc1.c. Since the i860 calling conventions require single
- precision floats to be passed in the floating-point registers
- (rather than in the general registers) we have to build the
- libgcc1.c routines in such a way that they know the actual types
- of their formal arguments and the actual types of their return
- values. Otherwise, gcc will generate calls to the libgcc1.c
- routines, passing arguments in the floating-point registers,
- but the libgcc1.c routines will expect their arguments on the
- stack (where the i860 calling conventions require structs &
- unions to be passed). */
-
-#define FLOAT_TYPE_VALUE float
-#define INTIFY(FLOATVAL) (FLOATVAL)
-#define FLOATIFY(INTVAL) (INTVAL)
-#define FLOAT_ARG_TYPE float
-
-
-/* Optionally define this if you have added predicates to
- `MACHINE.c'. This macro is called within an initializer of an
- array of structures. The first field in the structure is the
- name of a predicate and the second field is an array of rtl
- codes. For each predicate, list all rtl codes that can be in
- expressions matched by the predicate. The list should have a
- trailing comma. Here is an example of two entries in the list
- for a typical RISC machine:
-
- #define PREDICATE_CODES \
- {"gen_reg_rtx_operand", {SUBREG, REG}}, \
- {"reg_or_short_cint_operand", {SUBREG, REG, CONST_INT}},
-
- Defining this macro does not affect the generated code (however,
- incorrect definitions that omit an rtl code that may be matched
- by the predicate can cause the compiler to malfunction).
- Instead, it allows the table built by `genrecog' to be more
- compact and efficient, thus speeding up the compiler. The most
- important predicates to include in the list specified by this
- macro are thoses used in the most insn patterns. */
-
-#define PREDICATE_CODES \
- {"reg_or_0_operand", {REG, SUBREG, CONST_INT}}, \
- {"arith_operand", {REG, SUBREG, CONST_INT}}, \
- {"logic_operand", {REG, SUBREG, CONST_INT}}, \
- {"shift_operand", {REG, SUBREG, CONST_INT}}, \
- {"compare_operand", {REG, SUBREG, CONST_INT}}, \
- {"arith_const_operand", {CONST_INT}}, \
- {"logic_const_operand", {CONST_INT}}, \
- {"bte_operand", {REG, SUBREG, CONST_INT}}, \
- {"indexed_operand", {MEM}}, \
- {"load_operand", {MEM}}, \
- {"small_int", {CONST_INT}}, \
- {"logic_int", {CONST_INT}}, \
- {"call_insn_operand", {MEM}},
-
-/* Define the information needed to generate branch insns. This is stored
- from the compare operation. Note that we can't use "rtx" here since it
- hasn't been defined! */
-
-extern struct rtx_def *i860_compare_op0, *i860_compare_op1;
-
-/* Declare things which are defined in i860.c but called from
- insn-output.c. */
-
-extern unsigned long sfmode_constant_to_ulong ();
-extern char *output_load ();
-extern char *output_store ();
-extern char *output_move_double ();
-extern char *output_fp_move_double ();
-extern char *output_block_move ();
-extern char *output_delay_insn ();
-extern char *output_delayed_branch ();
-extern void output_load_address ();
diff --git a/gcc/config/i860/i860.md b/gcc/config/i860/i860.md
deleted file mode 100644
index a3df7bc4584..00000000000
--- a/gcc/config/i860/i860.md
+++ /dev/null
@@ -1,2318 +0,0 @@
-;;- Machine description for Intel 860 chip for GNU C compiler
-;; Copyright (C) 1989, 1990 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.
-
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-;;- Operand classes for the register allocator:
-
-/* Bit-test instructions. */
-
-(define_insn ""
- [(set (cc0) (eq (and:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "logic_operand" "rL"))
- (const_int 0)))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"and %1,%0,%?r0\";
-}")
-
-(define_insn ""
- [(set (cc0) (ne (and:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "logic_operand" "rL"))
- (const_int 0)))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- return \"and %1,%0,%?r0\";
-}")
-
-(define_insn ""
- [(set (cc0) (eq (and:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "immediate_operand" "i"))
- (const_int 0)))]
- "GET_CODE (operands[1]) == CONST_INT && (INTVAL (operands[1]) & 0xffff) == 0"
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"andh %H1,%0,%?r0\";
-}")
-
-(define_insn ""
- [(set (cc0) (ne (and:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "immediate_operand" "i"))
- (const_int 0)))]
- "GET_CODE (operands[1]) == CONST_INT && (INTVAL (operands[1]) & 0xffff) == 0"
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- return \"andh %H1,%0,%?r0\";
-}")
-
-(define_insn ""
- [(set (cc0) (eq (ashiftrt:SI
- (sign_extend:SI
- (ashift:QI (match_operand:QI 0 "register_operand" "r")
- (match_operand:QI 1 "logic_int" "n")))
- (match_operand:SI 2 "logic_int" "n"))
- (const_int 0)))]
- ""
- "*
-{
- int width = 8 - INTVAL (operands[2]);
- int pos = 8 - width - INTVAL (operands[1]);
-
- CC_STATUS_PARTIAL_INIT;
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- ~((-1) << width) << pos);
- return \"and %2,%0,%?r0\";
-}")
-
-;; -------------------------------------------------------------------------
-;; SImode signed integer comparisons
-;; -------------------------------------------------------------------------
-
-(define_insn "cmpeqsi"
- [(set (cc0) (eq (match_operand:SI 0 "logic_operand" "r,rL")
- (match_operand:SI 1 "logic_operand" "L,r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[0]))
- return \"xor %1,%0,%?r0\";
- else
- return \"xor %0,%1,%?r0\";
-}")
-
-(define_insn "cmpnesi"
- [(set (cc0) (ne (match_operand:SI 0 "logic_operand" "r,rL")
- (match_operand:SI 1 "logic_operand" "L,r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- if (REG_P (operands[0]))
- return \"xor %1,%0,%?r0\";
- else
- return \"xor %0,%1,%?r0\";
-}")
-
-(define_insn "cmpltsi"
- [(set (cc0) (lt (match_operand:SI 0 "arith_operand" "r,rI")
- (match_operand:SI 1 "arith_operand" "I,r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[1]))
- return \"subs %0,%1,%?r0\";
- else
- {
- cc_status.flags |= CC_REVERSED;
- operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
- return \"adds %1,%0,%?r0\";
- }
-}")
-
-(define_insn "cmpgtsi"
- [(set (cc0) (gt (match_operand:SI 0 "arith_operand" "r,rI")
- (match_operand:SI 1 "arith_operand" "I,r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[0]))
- return \"subs %1,%0,%?r0\";
- else
- {
- cc_status.flags |= CC_REVERSED;
- operands[0] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[0]));
- return \"adds %0,%1,%?r0\";
- }
-}")
-
-(define_insn "cmplesi"
- [(set (cc0) (le (match_operand:SI 0 "arith_operand" "r,rI")
- (match_operand:SI 1 "arith_operand" "I,r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- if (REG_P (operands[0]))
- return \"subs %1,%0,%?r0\";
- else
- {
- cc_status.flags |= CC_REVERSED;
- operands[0] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[0]));
- return \"adds %0,%1,%?r0\";
- }
-}")
-
-(define_insn "cmpgesi"
- [(set (cc0) (ge (match_operand:SI 0 "arith_operand" "r,rI")
- (match_operand:SI 1 "arith_operand" "I,r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- if (REG_P (operands[1]))
- return \"subs %0,%1,%?r0\";
- else
- {
- cc_status.flags |= CC_REVERSED;
- operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
- return \"adds %1,%0,%?r0\";
- }
-}")
-
-;; -------------------------------------------------------------------------
-;; SImode unsigned integer comparisons
-;; -------------------------------------------------------------------------
-
-;; WARNING! There is a small i860 hardware limitation (bug?) which we
-;; may run up against (if we are not careful) when we are trying to do
-;; unsigned comparisons like (x >= 0), (x < 0), (0 <= x), and (0 > x).
-;; Specifically, we must avoid using an `addu' instruction to perform
-;; such comparisons because the result (in the CC bit register) will
-;; come out wrong. (This fact is documented in a footnote on page 7-10
-;; of the 1991 version of the i860 Microprocessor Family Programmer's
-;; Reference Manual). Note that unsigned comparisons of this sort are
-;; always redundant anyway, because an unsigned quantity can never be
-;; less than zero. When we see cases like this, we generate an
-;; `or K,%r0,%r0' instruction instead (where K is a constant 0 or -1)
-;; so as to get the CC bit register set properly for any subsequent
-;; conditional jump instruction.
-
-(define_insn "cmpgeusi"
- [(set (cc0) (geu (match_operand:SI 0 "arith_operand" "r,rI")
- (match_operand:SI 1 "arith_operand" "I,r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[1]))
- return \"subu %0,%1,%?r0\";
- else
- {
- if (INTVAL (operands[1]) == 0)
- return \"or 0,%?r0,%?r0\";
- else
- {
- cc_status.flags |= CC_REVERSED;
- operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
- return \"addu %1,%0,%?r0\";
- }
- }
-}")
-
-(define_insn "cmpleusi"
- [(set (cc0) (leu (match_operand:SI 0 "arith_operand" "r,rI")
- (match_operand:SI 1 "arith_operand" "I,r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[0]))
- return \"subu %1,%0,%?r0\";
- else
- {
- if (INTVAL (operands[0]) == 0)
- return \"or 0,%?r0,%?r0\";
- else
- {
- cc_status.flags |= CC_REVERSED;
- operands[0] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[0]));
- return \"addu %0,%1,%?r0\";
- }
- }
-}")
-
-;; -------------------------------------------------------------------------
-;; SFmode floating-point comparisons
-;; -------------------------------------------------------------------------
-
-(define_insn "cmpeqsf"
- [(set (cc0) (eq (match_operand:SF 0 "reg_or_0_operand" "fG")
- (match_operand:SF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"pfeq.ss %r0,%r1,%?f0\";
-}")
-
-(define_insn "cmpnesf"
- [(set (cc0) (ne (match_operand:SF 0 "reg_or_0_operand" "fG")
- (match_operand:SF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- return \"pfeq.ss %r1,%r0,%?f0\";
-}")
-
-;; NOTE: The i860 Programmer's Reference Manual says that when we are
-;; doing (A < B) or (A > B) comparisons, we have to use pfgt for these
-;; in order to be IEEE compliant (in case a trap occurs during these
-;; operations). Conversely, for (A <= B) or (A >= B) comparisons, we
-;; must use pfle to be IEEE compliant.
-
-(define_insn "cmpltsf"
- [(set (cc0) (lt (match_operand:SF 0 "reg_or_0_operand" "fG")
- (match_operand:SF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"pfgt.ss %r1,%r0,%?f0\";
-}")
-
-(define_insn "cmpgtsf"
- [(set (cc0) (gt (match_operand:SF 0 "reg_or_0_operand" "fG")
- (match_operand:SF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"pfgt.ss %r0,%r1,%?f0\";
-}")
-
-;; NOTE: The pfle opcode doesn't do what you think it does. It is
-;; bass-ackwards. It *clears* the CC flag if the first operand is
-;; less than or equal to the second. Thus, we have to set CC_NEGATED
-;; for the following two patterns.
-
-(define_insn "cmplesf"
- [(set (cc0) (le (match_operand:SF 0 "reg_or_0_operand" "fG")
- (match_operand:SF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- return \"pfle.ss %r0,%r1,%?f0\";
-}")
-
-(define_insn "cmpgesf"
- [(set (cc0) (ge (match_operand:SF 0 "reg_or_0_operand" "fG")
- (match_operand:SF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- return \"pfle.ss %r1,%r0,%?f0\";
-}")
-
-;; -------------------------------------------------------------------------
-;; DFmode floating-point comparisons
-;; -------------------------------------------------------------------------
-
-(define_insn "cmpeqdf"
- [(set (cc0) (eq (match_operand:DF 0 "reg_or_0_operand" "fG")
- (match_operand:DF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"pfeq.dd %r0,%r1,%?f0\";
-}")
-
-(define_insn "cmpnedf"
- [(set (cc0) (ne (match_operand:DF 0 "reg_or_0_operand" "fG")
- (match_operand:DF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- return \"pfeq.dd %r1,%r0,%?f0\";
-}")
-
-;; NOTE: The i860 Programmer's Reference Manual says that when we are
-;; doing (A < B) or (A > B) comparisons, we have to use pfgt for these
-;; in order to be IEEE compliant (in case a trap occurs during these
-;; operations). Conversely, for (A <= B) or (A >= B) comparisons, we
-;; must use pfle to be IEEE compliant.
-
-(define_insn "cmpltdf"
- [(set (cc0) (lt (match_operand:DF 0 "reg_or_0_operand" "fG")
- (match_operand:DF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"pfgt.dd %r1,%r0,%?f0\";
-}")
-
-(define_insn "cmpgtdf"
- [(set (cc0) (gt (match_operand:DF 0 "reg_or_0_operand" "fG")
- (match_operand:DF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"pfgt.dd %r0,%r1,%?f0\";
-}")
-
-;; NOTE: The pfle opcode doesn't do what you think it does. It is
-;; bass-ackwards. It *clears* the CC flag if the first operand is
-;; less than or equal to the second. Thus, we have to set CC_NEGATED
-;; for the following two patterns.
-
-(define_insn "cmpledf"
- [(set (cc0) (le (match_operand:DF 0 "reg_or_0_operand" "fG")
- (match_operand:DF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- return \"pfle.dd %r0,%r1,%?f0\";
-}")
-
-(define_insn "cmpgedf"
- [(set (cc0) (ge (match_operand:DF 0 "reg_or_0_operand" "fG")
- (match_operand:DF 1 "reg_or_0_operand" "fG")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- cc_status.flags |= CC_NEGATED;
- return \"pfle.dd %r1,%r0,%?f0\";
-}")
-
-;; ------------------------------------------------------------------------
-;; Integer EQ/NE comparisons against constant values which will fit in the
-;; 16-bit immediate field of an instruction. These are made by combining.
-;; ------------------------------------------------------------------------
-
-(define_insn ""
- [(set (cc0) (eq (zero_extend:SI (match_operand:HI 0 "load_operand" "m"))
- (match_operand:SI 1 "small_int" "I")))]
- "INTVAL (operands[1]) >= 0"
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"ld.s %0,%?r31\;xor %1,%?r31,%?r0\";
-}")
-
-(define_insn ""
- [(set (cc0) (eq (match_operand:SI 0 "small_int" "I")
- (zero_extend:SI (match_operand:HI 1 "load_operand" "m"))))]
- "INTVAL (operands[0]) >= 0"
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"ld.s %1,%?r31\;xor %0,%?r31,%?r0\";
-}")
-
-;; ------------------------------------------------------------------------
-;; Define the real conditional branch instructions.
-;; ------------------------------------------------------------------------
-
-(define_insn "cbranch"
- [(set (pc) (if_then_else (eq (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if ((cc_prev_status.flags & CC_NEGATED) == 0)
- return \"bnc %l0\";
- else
- return \"bc %l0\";
-}")
-
-(define_insn "flipped_cbranch"
- [(set (pc) (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if ((cc_prev_status.flags & CC_NEGATED) == 0)
- return \"bnc %l0\";
- else
- return \"bc %l0\";
-}")
-
-(define_insn "inverse_cbranch"
- [(set (pc) (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if ((cc_prev_status.flags & CC_NEGATED) == 0)
- return \"bc %l0\";
- else
- return \"bnc %l0\";
-}")
-
-
-(define_insn "flipped_inverse_cbranch"
- [(set (pc) (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if ((cc_prev_status.flags & CC_NEGATED) == 0)
- return \"bc %l0\";
- else
- return \"bnc %l0\";
-}")
-
-;; Simple BTE/BTNE compare-and-branch insns made by combining.
-;; Note that it is wrong to add similar patterns for QI or HImode
-;; because bte/btne always compare the whole register.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "bte_operand" "rK"))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "bte %1,%0,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "bte_operand" "rK"))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "btne %1,%0,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "bte_operand" "rK"))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "btne %1,%0,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "bte_operand" "rK"))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "bte %1,%0,%2")
-
-;; Load byte/halfword, zero-extend, & compare-and-branch insns.
-;; These are made by combining.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (zero_extend:SI (match_operand:QI 0 "memory_operand" "m"))
- (match_operand:SI 1 "bte_operand" "K"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (match_scratch:SI 3 "=r")]
- ""
- "ld.b %0,%3;bte %1,%3,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (zero_extend:SI (match_operand:QI 0 "memory_operand" "m"))
- (match_operand:SI 1 "bte_operand" "K"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (match_scratch:SI 3 "=r")]
- ""
- "ld.b %0,%3;btne %1,%3,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (zero_extend:SI (match_operand:QI 0 "memory_operand" "m"))
- (match_operand:SI 1 "bte_operand" "K"))
- (pc)
- (label_ref (match_operand 2 "" ""))))
- (match_scratch:SI 3 "=r")]
- ""
- "ld.b %0,%3;btne %1,%3,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (zero_extend:SI (match_operand:QI 0 "memory_operand" "m"))
- (match_operand:SI 1 "bte_operand" "K"))
- (pc)
- (label_ref (match_operand 2 "" ""))))
- (match_scratch:SI 3 "=r")]
- ""
- "ld.b %0,%3;bte %1,%3,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (zero_extend:SI (match_operand:HI 0 "memory_operand" "m"))
- (match_operand:SI 1 "bte_operand" "K"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (match_scratch:SI 3 "=r")]
- ""
- "ld.s %0,%3;bte %1,%3,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (zero_extend:SI (match_operand:HI 0 "memory_operand" "m"))
- (match_operand:SI 1 "bte_operand" "K"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (match_scratch:SI 3 "=r")]
- ""
- "ld.s %0,%3;btne %1,%3,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (zero_extend:SI (match_operand:HI 0 "memory_operand" "m"))
- (match_operand:SI 1 "bte_operand" "K"))
- (pc)
- (label_ref (match_operand 2 "" ""))))
- (match_scratch:SI 3 "=r")]
- ""
- "ld.s %0,%3;btne %1,%3,%2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (zero_extend:SI (match_operand:HI 0 "memory_operand" "m"))
- (match_operand:SI 1 "bte_operand" "K"))
- (pc)
- (label_ref (match_operand 2 "" ""))))
- (match_scratch:SI 3 "=r")]
- ""
- "ld.s %0,%3;bte %1,%3,%2")
-
-
-;; Generation of conditionals.
-
-;; We save the compare operands in the cmpxx patterns and use then when
-;; we generate the branch.
-
-(define_expand "cmpsi"
- [(set (cc0) (compare (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "compare_operand" "")))]
- ""
- "
-{ i860_compare_op0 = operands[0];
- i860_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_expand "cmpsf"
- [(set (cc0) (compare (match_operand:SF 0 "register_operand" "")
- (match_operand:SF 1 "register_operand" "")))]
- ""
- "
-{ i860_compare_op0 = operands[0];
- i860_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_expand "cmpdf"
- [(set (cc0) (compare (match_operand:DF 0 "register_operand" "")
- (match_operand:DF 1 "register_operand" "")))]
- ""
- "
-{ i860_compare_op0 = operands[0];
- i860_compare_op1 = operands[1];
- DONE;
-}")
-
-;; These are the standard-named conditional branch patterns.
-;; Detailed comments are found in the first one only.
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- /* Emit a single-condition compare insn according to
- the type of operands and the condition to be tested. */
-
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) == MODE_INT)
- emit_insn (gen_cmpeqsi (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == SFmode)
- emit_insn (gen_cmpeqsf (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == DFmode)
- emit_insn (gen_cmpeqdf (i860_compare_op0, i860_compare_op1));
- else
- abort ();
-
- /* Emit branch-if-true. */
-
- emit_jump_insn (gen_flipped_inverse_cbranch (operands[0]));
- DONE;
-}")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) == MODE_INT)
- emit_insn (gen_cmpeqsi (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == SFmode)
- emit_insn (gen_cmpeqsf (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == DFmode)
- emit_insn (gen_cmpeqdf (i860_compare_op0, i860_compare_op1));
- else
- abort ();
-
- emit_jump_insn (gen_flipped_cbranch (operands[0]));
-
- DONE;
-}")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) == MODE_INT)
- emit_insn (gen_cmpgtsi (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == SFmode)
- emit_insn (gen_cmpgtsf (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == DFmode)
- emit_insn (gen_cmpgtdf (i860_compare_op0, i860_compare_op1));
- else
- abort ();
-
- emit_jump_insn (gen_flipped_inverse_cbranch (operands[0]));
- DONE;
-}")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) == MODE_INT)
- emit_insn (gen_cmpltsi (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == SFmode)
- emit_insn (gen_cmpltsf (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == DFmode)
- emit_insn (gen_cmpltdf (i860_compare_op0, i860_compare_op1));
- else
- abort ();
-
- emit_jump_insn (gen_flipped_inverse_cbranch (operands[0]));
- DONE;
-}")
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) == MODE_INT)
- {
- emit_insn (gen_cmpgtsi (i860_compare_op0, i860_compare_op1));
- emit_jump_insn (gen_flipped_cbranch (operands[0]));
- }
- else
- {
- if (GET_MODE (i860_compare_op0) == SFmode)
- emit_insn (gen_cmplesf (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == DFmode)
- emit_insn (gen_cmpledf (i860_compare_op0, i860_compare_op1));
- else
- abort ();
- emit_jump_insn (gen_flipped_inverse_cbranch (operands[0]));
- }
- DONE;
-}")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) == MODE_INT)
- {
- emit_insn (gen_cmpltsi (i860_compare_op0, i860_compare_op1));
- emit_jump_insn (gen_flipped_cbranch (operands[0]));
- }
- else
- {
- if (GET_MODE (i860_compare_op0) == SFmode)
- emit_insn (gen_cmpgesf (i860_compare_op0, i860_compare_op1));
- else if (GET_MODE (i860_compare_op0) == DFmode)
- emit_insn (gen_cmpgedf (i860_compare_op0, i860_compare_op1));
- else
- abort ();
- emit_jump_insn (gen_flipped_inverse_cbranch (operands[0]));
- }
- DONE;
-}")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) != MODE_INT)
- abort ();
-
- emit_insn (gen_cmpleusi (i860_compare_op0, i860_compare_op1));
- emit_jump_insn (gen_flipped_cbranch (operands[0]));
- DONE;
-}")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) != MODE_INT)
- abort ();
-
- emit_insn (gen_cmpgeusi (i860_compare_op0, i860_compare_op1));
- emit_jump_insn (gen_flipped_cbranch (operands[0]));
- DONE;
-}")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) != MODE_INT)
- abort ();
-
- emit_insn (gen_cmpgeusi (i860_compare_op0, i860_compare_op1));
- emit_jump_insn (gen_flipped_inverse_cbranch (operands[0]));
- DONE;
-}")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE_CLASS (GET_MODE (i860_compare_op0)) != MODE_INT)
- abort ();
-
- emit_insn (gen_cmpleusi (i860_compare_op0, i860_compare_op1));
- emit_jump_insn (gen_flipped_inverse_cbranch (operands[0]));
- DONE;
-}")
-
-;; Move instructions
-
-;; Note that source operands for `mov' pseudo-instructions are no longer
-;; allowed (by the svr4 assembler) to be "big" things, i.e. constants that
-;; won't fit in 16-bits. (This includes any sort of a relocatable address
-;; also.) Thus, we must use an explicit orh/or pair of instructions if
-;; the source operand is something "big".
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=r,m,f")
- (match_operand:SI 1 "general_operand" "rmif,rfJ,rmfJ"))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- {
- if (CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- return output_store (operands);
- if (FP_REG_P (operands[1]))
- return \"fst.l %1,%0\";
- return \"st.l %r1,%0\";
- }
- if (GET_CODE (operands[1]) == MEM)
- {
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- return output_load (operands);
- if (FP_REG_P (operands[0]))
- return \"fld.l %1,%0\";
- return \"ld.l %1,%0\";
- }
- if (FP_REG_P (operands[1]) && FP_REG_P (operands[0]))
- return \"fmov.ss %1,%0\";
- if (FP_REG_P (operands[1]))
- return \"fxfr %1,%0\";
- if (FP_REG_P (operands[0]) && operands[1] == const0_rtx)
- return \"fmov.ss %?f0,%0\";
- if (FP_REG_P (operands[0]))
- return \"ixfr %1,%0\";
-
- if (GET_CODE (operands[1]) == REG)
- return \"shl %?r0,%1,%0\";
-
- CC_STATUS_PARTIAL_INIT;
-
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if((INTVAL (operands[1]) & 0xffff0000) == 0)
- return \"or %L1,%?r0,%0\";
- if((INTVAL (operands[1]) & 0x0000ffff) == 0)
- return \"orh %H1,%?r0,%0\";
- }
- return \"orh %H1,%?r0,%0\;or %L1,%0,%0\";
-}")
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=r,m,!*f,!r")
- (match_operand:HI 1 "general_operand" "rmi,rJ,rJ*f,*f"))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- {
- if (CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- return output_store (operands);
- return \"st.s %r1,%0\";
- }
- if (GET_CODE (operands[1]) == MEM)
- {
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- return output_load (operands);
- return \"ld.s %1,%0\";
- }
- if (FP_REG_P (operands[1]) && FP_REG_P (operands[0]))
- return \"fmov.ss %1,%0\";
- if (FP_REG_P (operands[1]))
- return \"fxfr %1,%0\";
- if (FP_REG_P (operands[0]) && operands[1] == const0_rtx)
- return \"fmov.ss %?f0,%0\";
- if (FP_REG_P (operands[0]))
- return \"ixfr %1,%0\";
-
- if (GET_CODE (operands[1]) == REG)
- return \"shl %?r0,%1,%0\";
-
- CC_STATUS_PARTIAL_INIT;
-
- return \"or %L1,%?r0,%0\";
-}")
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=r,m,!*f,!r")
- (match_operand:QI 1 "general_operand" "rmi,rJ,rJ*f,*f"))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- {
- if (CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- return output_store (operands);
- return \"st.b %r1,%0\";
- }
- if (GET_CODE (operands[1]) == MEM)
- {
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- return output_load (operands);
- return \"ld.b %1,%0\";
- }
- if (FP_REG_P (operands[1]) && FP_REG_P (operands[0]))
- return \"fmov.ss %1,%0\";
- if (FP_REG_P (operands[1]))
- return \"fxfr %1,%0\";
- if (FP_REG_P (operands[0]) && operands[1] == const0_rtx)
- return \"fmov.ss %?f0,%0\";
- if (FP_REG_P (operands[0]))
- return \"ixfr %1,%0\";
-
- if (GET_CODE (operands[1]) == REG)
- return \"shl %?r0,%1,%0\";
-
- CC_STATUS_PARTIAL_INIT;
-
- return \"or %L1,%?r0,%0\";
-}")
-
-;; The definition of this insn does not really explain what it does,
-;; but it should suffice
-;; that anything generated as this insn will be recognized as one
-;; and that it won't successfully combine with anything.
-(define_expand "movstrsi"
- [(parallel [(set (mem:BLK (match_operand:BLK 0 "general_operand" ""))
- (mem:BLK (match_operand:BLK 1 "general_operand" "")))
- (use (match_operand:SI 2 "nonmemory_operand" ""))
- (use (match_operand:SI 3 "immediate_operand" ""))
- (clobber (match_dup 4))
- (clobber (match_dup 5))
- (clobber (match_dup 6))
- (clobber (match_dup 0))
- (clobber (match_dup 1))])]
- ""
- "
-{
- operands[0] = copy_to_mode_reg (SImode, XEXP (operands[0], 0));
- operands[1] = copy_to_mode_reg (SImode, XEXP (operands[1], 0));
- operands[4] = gen_reg_rtx (SImode);
- operands[5] = gen_reg_rtx (SImode);
- operands[6] = gen_reg_rtx (SImode);
-}")
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "r"))
- (mem:BLK (match_operand:SI 1 "register_operand" "r")))
- (use (match_operand:SI 2 "general_operand" "rn"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_operand:SI 4 "register_operand" "=r"))
- (clobber (match_operand:SI 5 "register_operand" "=r"))
- (clobber (match_operand:SI 6 "register_operand" "=r"))
- (clobber (match_dup 0))
- (clobber (match_dup 1))]
- ""
- "* return output_block_move (operands);")
-
-;; Floating point move insns
-
-;; This pattern forces (set (reg:DF ...) (const_double ...))
-;; to be reloaded by putting the constant into memory.
-;; It must come before the more general movdf pattern.
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=r,f,o")
- (match_operand:DF 1 "" "mG,m,G"))]
- "GET_CODE (operands[1]) == CONST_DOUBLE"
- "*
-{
- if (FP_REG_P (operands[0]) || operands[1] == CONST0_RTX (DFmode))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}")
-
-(define_insn "movdf"
- [(set (match_operand:DF 0 "general_operand" "=*rm,*r,?f,?*rm")
- (match_operand:DF 1 "general_operand" "*r,m,*rfmG,f"))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM
- && CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- return output_store (operands);
- if (GET_CODE (operands[1]) == MEM
- && CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- return output_load (operands);
-
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}")
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=rm,r,?f,?rm")
- (match_operand:DI 1 "general_operand" "r,miF,rfmG,f"))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM
- && CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- return output_store (operands);
- if (GET_CODE (operands[1]) == MEM
- && CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- return output_load (operands);
-
- /* ??? How can we have a DFmode arg here with DImode above? */
- if (FP_REG_P (operands[0]) && operands[1] == CONST0_RTX (DFmode))
- return \"fmov.dd %?f0,%0\";
-
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}")
-
-;; The alternative m/r is separate from m/f
-;; The first alternative is separate from the second for the same reason.
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=*rf,*rf,*r,m,m")
- (match_operand:SF 1 "general_operand" "*r,fmG,F,*r,f"))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM
- && CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- return output_store (operands);
- if (GET_CODE (operands[1]) == MEM
- && CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- return output_load (operands);
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fmov.ss %1,%0\";
- if (GET_CODE (operands[1]) == REG)
- return \"ixfr %1,%0\";
- if (operands[1] == CONST0_RTX (SFmode))
- return \"fmov.ss %?f0,%0\";
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && cc_prev_status.mdep == XEXP(operands[1],0)))
- {
- CC_STATUS_INIT;
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[1], 0);
- return \"orh %h1,%?r0,%?r31\;fld.l %L1(%?r31),%0\";
- }
- return \"fld.l %L1(%?r31),%0\";
- }
- return \"fld.l %1,%0\";
- }
- if (FP_REG_P (operands[1]) || GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- if (GET_CODE (operands[0]) == REG && FP_REG_P (operands[1]))
- return \"fxfr %1,%0\";
- if (GET_CODE (operands[0]) == REG)
- {
- CC_STATUS_PARTIAL_INIT;
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- register unsigned long ul;
-
- ul = sfmode_constant_to_ulong (operands[1]);
- if ((ul & 0x0000ffff) == 0)
- return \"orh %H1,%?r0,%0\";
- if ((ul & 0xffff0000) == 0)
- return \"or %L1,%?r0,%0\";
- }
- return \"orh %H1,%?r0,%0\;or %L1,%0,%0\";
- }
- /* Now operand 0 must be memory.
- If operand 1 is CONST_DOUBLE, its value must be 0. */
- if (CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && XEXP (operands[0], 0) == cc_prev_status.mdep))
- {
- CC_STATUS_INIT;
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[0], 0);
- output_asm_insn (\"orh %h0,%?r0,%?r31\", operands);
- }
- return \"fst.l %r1,%L0(%?r31)\";
- }
- return \"fst.l %r1,%0\";
- }
- if (GET_CODE (operands[0]) == MEM)
- return \"st.l %r1,%0\";
- if (GET_CODE (operands[1]) == MEM)
- return \"ld.l %1,%0\";
- if (operands[1] == CONST0_RTX (SFmode))
- return \"shl %?r0,%?r0,%0\";
- return \"mov %1,%0\";
-}")
-
-;; Special load insns for REG+REG addresses.
-;; Such addresses are not "legitimate" because st rejects them.
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=rf")
- (match_operand:DF 1 "indexed_operand" "m"))]
- ""
- "*
-{
- if (FP_REG_P (operands[0]))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=rf")
- (match_operand:SF 1 "indexed_operand" "m"))]
- ""
- "*
-{
- if (FP_REG_P (operands[0]))
- return \"fld.l %1,%0\";
- return \"ld.l %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=rf")
- (match_operand:SI 1 "indexed_operand" "m"))]
- ""
- "*
-{
- if (FP_REG_P (operands[0]))
- return \"fld.l %1,%0\";
- return \"ld.l %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (match_operand:HI 1 "indexed_operand" "m"))]
- ""
- "ld.s %1,%0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (match_operand:QI 1 "indexed_operand" "m"))]
- ""
- "ld.b %1,%0")
-
-;; Likewise for floating-point store insns.
-
-(define_insn ""
- [(set (match_operand:DF 0 "indexed_operand" "=m")
- (match_operand:DF 1 "register_operand" "f"))]
- ""
- "fst.d %1,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "indexed_operand" "=m")
- (match_operand:SF 1 "register_operand" "f"))]
- ""
- "fst.l %1,%0")
-
-;;- truncation instructions
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (truncate:QI
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- if (CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && XEXP (operands[0], 0) == cc_prev_status.mdep))
- {
- CC_STATUS_INIT;
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[0], 0);
- output_asm_insn (\"orh %h0,%?r0,%?r31\", operands);
- }
- return \"st.b %1,%L0(%?r31)\";
- }
- else
- return \"st.b %1,%0\";
- return \"shl %?r0,%1,%0\";
-}")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (truncate:QI
- (match_operand:HI 1 "register_operand" "r")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- if (CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && XEXP (operands[0], 0) == cc_prev_status.mdep))
- {
- CC_STATUS_INIT;
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[0], 0);
- output_asm_insn (\"orh %h0,%?r0,%?r31\", operands);
- }
- return \"st.b %1,%L0(%?r31)\";
- }
- else
- return \"st.b %1,%0\";
- return \"shl %?r0,%1,%0\";
-}")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (truncate:HI
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- if (CONSTANT_ADDRESS_P (XEXP (operands[0], 0)))
- {
- if (! ((cc_prev_status.flags & CC_KNOW_HI_R31)
- && (cc_prev_status.flags & CC_HI_R31_ADJ)
- && XEXP (operands[0], 0) == cc_prev_status.mdep))
- {
- CC_STATUS_INIT;
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[0], 0);
- output_asm_insn (\"orh %h0,%?r0,%?r31\", operands);
- }
- return \"st.s %1,%L0(%?r31)\";
- }
- else
- return \"st.s %1,%0\";
- return \"shl %?r0,%1,%0\";
-}")
-
-;;- zero extension instructions
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI
- (match_operand:HI 1 "register_operand" "r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"and 0xffff,%1,%0\";
-}")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (zero_extend:HI
- (match_operand:QI 1 "register_operand" "r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"and 0xff,%1,%0\";
-}")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI
- (match_operand:QI 1 "register_operand" "r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"and 0xff,%1,%0\";
-}")
-
-;; Sign extension instructions.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI
- (match_operand:HI 1 "indexed_operand" "m")))]
- ""
- "ld.s %1,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (sign_extend:HI
- (match_operand:QI 1 "indexed_operand" "m")))]
- ""
- "ld.b %1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI
- (match_operand:QI 1 "indexed_operand" "m")))]
- ""
- "ld.b %1,%0")
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "mr")))]
- ""
- "*
-{
- if (REG_P (operands[1]))
- return \"shl 16,%1,%0\;shra 16,%0,%0\";
- if (GET_CODE (operands[1]) == CONST_INT)
- abort ();
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- {
- CC_STATUS_INIT;
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[1], 0);
- return \"orh %h1,%?r0,%?r31\;ld.s %L1(%?r31),%0\";
- }
- else
- return \"ld.s %1,%0\";
-}")
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (sign_extend:HI
- (match_operand:QI 1 "nonimmediate_operand" "mr")))]
- ""
- "*
-{
- if (REG_P (operands[1]))
- return \"shl 24,%1,%0\;shra 24,%0,%0\";
- if (GET_CODE (operands[1]) == CONST_INT)
- abort ();
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- {
- CC_STATUS_INIT;
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[1], 0);
- return \"orh %h1,%?r0,%?r31\;ld.b %L1(%?r31),%0\";
- }
- else
- return \"ld.b %1,%0\";
-}")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI
- (match_operand:QI 1 "nonimmediate_operand" "mr")))]
- ""
- "*
-{
- if (REG_P (operands[1]))
- return \"shl 24,%1,%0\;shra 24,%0,%0\";
- if (GET_CODE (operands[1]) == CONST_INT)
- abort ();
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- {
- CC_STATUS_INIT;
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[1], 0);
- return \"orh %h1,%?r0,%?r31\;ld.b %L1(%?r31),%0\";
- }
- else
- return \"ld.b %1,%0\";
-}")
-
-;; Signed bitfield extractions come out looking like
-;; (shiftrt (sign_extend (shift <Y> <C1>)) <C2>)
-;; which we expand poorly as four shift insns.
-;; These patterns yield two shifts:
-;; (shiftrt (shift <Y> <C3>) <C4>)
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI
- (sign_extend:SI
- (match_operand:QI 1 "register_operand" "r"))
- (match_operand:SI 2 "logic_int" "n")))]
- "INTVAL (operands[2]) < 8"
- "*
-{
- return \"shl 24,%1,%0\;shra 24+%2,%0,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI
- (sign_extend:SI
- (subreg:QI (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "logic_int" "n")) 0))
- (match_operand:SI 3 "logic_int" "n")))]
- "INTVAL (operands[3]) < 8"
- "*
-{
- return \"shl 0x18+%2,%1,%0\;shra 0x18+%3,%0,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI
- (sign_extend:SI
- (ashift:QI (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "logic_int" "n")))
- (match_operand:SI 3 "logic_int" "n")))]
- "INTVAL (operands[3]) < 8"
- "*
-{
- return \"shl 0x18+%2,%1,%0\;shra 0x18+%3,%0,%0\";
-}")
-
-;; Special patterns for optimizing bit-field instructions.
-
-;; First two patterns are for bitfields that came from memory
-;; testing only the high bit. They work with old combiner.
-
-(define_insn ""
- [(set (cc0)
- (eq (zero_extend:SI (subreg:QI (lshiftrt:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 7)) 0))
- (const_int 0)))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"and 128,%0,%?r0\";
-}")
-
-(define_insn ""
- [(set (cc0)
- (eq (sign_extend:SI (subreg:QI (ashiftrt:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 7)) 0))
- (const_int 0)))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"and 128,%0,%?r0\";
-}")
-
-;; next two patterns are good for bitfields coming from memory
-;; (via pseudo-register) or from a register, though this optimization
-;; is only good for values contained wholly within the bottom 13 bits
-(define_insn ""
- [(set (cc0)
- (eq
- (and:SI (lshiftrt:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "logic_int" "n"))
- (match_operand:SI 2 "logic_int" "n"))
- (const_int 0)))]
- "LOGIC_INTVAL (INTVAL (operands[2]) << INTVAL (operands[1]))"
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- (INTVAL (operands[2]) << INTVAL (operands[1])));
- return \"and %2,%0,%?r0\";
-}")
-
-(define_insn ""
- [(set (cc0)
- (eq
- (and:SI (ashiftrt:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "logic_int" "n"))
- (match_operand:SI 2 "logic_int" "n"))
- (const_int 0)))]
- "LOGIC_INTVAL (INTVAL (operands[2]) << INTVAL (operands[1]))"
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- (INTVAL (operands[2]) << INTVAL (operands[1])));
- return \"and %2,%0,%?r0\";
-}")
-
-;; Conversions between float and double.
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float_extend:DF
- (match_operand:SF 1 "register_operand" "f")))]
- ""
- "fmov.sd %1,%0")
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float_truncate:SF
- (match_operand:DF 1 "register_operand" "f")))]
- ""
- "fmov.ds %1,%0")
-
-;; Conversion between fixed point and floating point.
-;; Note that among the fix-to-float insns
-;; the ones that start with SImode come first.
-;; That is so that an operand that is a CONST_INT
-;; (and therefore lacks a specific machine mode).
-;; will be recognized as SImode (which is always valid)
-;; rather than as QImode or HImode.
-
-;; This pattern forces (set (reg:SF ...) (float:SF (const_int ...)))
-;; to be reloaded by putting the constant into memory.
-;; It must come before the more general floatsisf2 pattern.
-(define_expand "floatsidf2"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (xor:SI (match_operand:SI 1 "register_operand" "")
- (const_int -2147483648)))
- (set (match_dup 5) (match_dup 3))
- (set (subreg:SI (match_dup 5) 0) (match_dup 4))
- (set (match_operand:DF 0 "register_operand" "")
- (minus:DF (match_dup 5) (match_dup 2)))]
- ""
- "
-{
- REAL_VALUE_TYPE d;
- /* 4503601774854144 is (1 << 30) * ((1 << 22) + (1 << 1)). */
- d = REAL_VALUE_ATOF (\"4503601774854144\", DFmode);
- operands[2] = gen_reg_rtx (DFmode);
- operands[3] = CONST_DOUBLE_FROM_REAL_VALUE (d, DFmode);
- operands[4] = gen_reg_rtx (SImode);
- operands[5] = gen_reg_rtx (DFmode);
-}")
-
-;; Floating to fixed conversion.
-
-(define_expand "fix_truncdfsi2"
- ;; This first insn produces a double-word value
- ;; in which only the low word is valid.
- [(set (match_dup 2)
- (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
- (set (match_operand:SI 0 "register_operand" "=f")
- (subreg:SI (match_dup 2) 0))]
- ""
- "
-{
- operands[2] = gen_reg_rtx (DImode);
-}")
-
-;; Recognize the first insn generated above.
-;; This RTL looks like a fix_truncdfdi2 insn,
-;; but we dont call it that, because only 32 bits
-;; of the result are valid.
-;; This pattern will work for the intended purposes
-;; as long as we do not have any fixdfdi2 or fix_truncdfdi2.
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=f")
- (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
- ""
- "ftrunc.dd %1,%0")
-
-(define_expand "fix_truncsfsi2"
- ;; This first insn produces a double-word value
- ;; in which only the low word is valid.
- [(set (match_dup 2)
- (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))
- (set (match_operand:SI 0 "register_operand" "=f")
- (subreg:SI (match_dup 2) 0))]
- ""
- "
-{
- operands[2] = gen_reg_rtx (DImode);
-}")
-
-;; Recognize the first insn generated above.
-;; This RTL looks like a fix_truncsfdi2 insn,
-;; but we dont call it that, because only 32 bits
-;; of the result are valid.
-;; This pattern will work for the intended purposes
-;; as long as we do not have any fixsfdi2 or fix_truncsfdi2.
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=f")
- (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
- ""
- "ftrunc.sd %1,%0")
-
-;;- arithmetic instructions
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,*f")
- (plus:SI (match_operand:SI 1 "nonmemory_operand" "%r,*f")
- (match_operand:SI 2 "arith_operand" "rI,*f")))]
- ""
- "*
-{
- if (which_alternative == 1)
- return \"fiadd.ss %2,%1,%0\";
- CC_STATUS_PARTIAL_INIT;
- return \"addu %2,%1,%0\";
-}")
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=f")
- (plus:DI (match_operand:DI 1 "register_operand" "%f")
- (match_operand:DI 2 "register_operand" "f")))]
- ""
- "fiadd.dd %1,%2,%0")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,*f")
- (minus:SI (match_operand:SI 1 "register_operand" "r,I,*f")
- (match_operand:SI 2 "arith_operand" "rI,r,*f")))]
- ""
- "*
-{
- if (which_alternative == 2)
- return \"fisub.ss %1,%2,%0\";
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[2]))
- return \"subu %1,%2,%0\";
- operands[2] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[2]));
- return \"addu %2,%1,%0\";
-}")
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=f")
- (minus:DI (match_operand:DI 1 "register_operand" "f")
- (match_operand:DI 2 "register_operand" "f")))]
- ""
- "fisub.dd %1,%2,%0")
-
-(define_expand "mulsi3"
- [(set (subreg:SI (match_dup 4) 0) (match_operand:SI 1 "general_operand" ""))
- (set (subreg:SI (match_dup 5) 0) (match_operand:SI 2 "general_operand" ""))
- (clobber (match_dup 3))
- (set (subreg:SI (match_dup 3) 0)
- (mult:SI (subreg:SI (match_dup 4) 0) (subreg:SI (match_dup 5) 0)))
- (set (match_operand:SI 0 "register_operand" "") (subreg:SI (match_dup 3) 0))]
- ""
- "
-{
- if (WORDS_BIG_ENDIAN)
- emit_insn (gen_mulsi3_big (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_mulsi3_little (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_expand "mulsi3_little"
- [(set (subreg:SI (match_dup 4) 0) (match_operand:SI 1 "general_operand" ""))
- (set (subreg:SI (match_dup 5) 0) (match_operand:SI 2 "general_operand" ""))
- (clobber (match_dup 3))
- (set (subreg:SI (match_dup 3) 0)
- (mult:SI (subreg:SI (match_dup 4) 0) (subreg:SI (match_dup 5) 0)))
- (set (match_operand:SI 0 "register_operand" "") (subreg:SI (match_dup 3) 0))]
- "! WORDS_BIG_ENDIAN"
- "
-{
- operands[3] = gen_reg_rtx (DImode);
- operands[4] = gen_reg_rtx (DImode);
- operands[5] = gen_reg_rtx (DImode);
-}")
-
-(define_expand "mulsi3_big"
- [(set (subreg:SI (match_dup 4) 1) (match_operand:SI 1 "general_operand" ""))
- (set (subreg:SI (match_dup 5) 1) (match_operand:SI 2 "general_operand" ""))
- (clobber (match_dup 3))
- (set (subreg:SI (match_dup 3) 1)
- (mult:SI (subreg:SI (match_dup 4) 1) (subreg:SI (match_dup 5) 1)))
- (set (match_operand:SI 0 "register_operand" "") (subreg:SI (match_dup 3) 1))]
- "WORDS_BIG_ENDIAN"
- "
-{
- operands[3] = gen_reg_rtx (DImode);
- operands[4] = gen_reg_rtx (DImode);
- operands[5] = gen_reg_rtx (DImode);
-}")
-
-(define_insn ""
- [(set (subreg:SI (match_operand:DI 0 "register_operand" "=f") 0)
- (mult:SI (subreg:SI (match_operand:DI 1 "register_operand" "f") 0)
- (subreg:SI (match_operand:DI 2 "register_operand" "f") 0)))]
- "! WORDS_BIG_ENDIAN"
- "fmlow.dd %2,%1,%0")
-
-(define_insn ""
- [(set (subreg:SI (match_operand:DI 0 "register_operand" "=f") 1)
- (mult:SI (subreg:SI (match_operand:DI 1 "register_operand" "f") 1)
- (subreg:SI (match_operand:DI 2 "register_operand" "f") 1)))]
- "WORDS_BIG_ENDIAN"
- "fmlow.dd %2,%1,%0")
-
-;;- and instructions (with compliment also)
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (match_operand:SI 1 "nonmemory_operand" "%r")
- (match_operand:SI 2 "nonmemory_operand" "rL")))]
- ""
- "*
-{
- rtx xop[3];
-
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[2]) || LOGIC_INT (operands[2]))
- return \"and %2,%1,%0\";
- if ((INTVAL (operands[2]) & 0xffff) == 0)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- (unsigned) INTVAL (operands[2]) >> 16);
- return \"andh %2,%1,%0\";
- }
- xop[0] = operands[0];
- xop[1] = operands[1];
- xop[2] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]) & 0xffff);
- output_asm_insn (\"andnot %2,%1,%0\", xop);
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- ~(unsigned) INTVAL (operands[2]) >> 16);
- return \"andnoth %2,%0,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (not:SI (match_operand:SI 1 "register_operand" "rn"))
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "*
-{
- rtx xop[3];
-
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[1]) || LOGIC_INT (operands[1]))
- return \"andnot %1,%2,%0\";
- if ((INTVAL (operands[1]) & 0xffff) == 0)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- (unsigned) INTVAL (operands[1]) >> 16);
- return \"andnoth %1,%2,%0\";
- }
- xop[0] = operands[0];
- xop[1] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[1]) & 0xffff));
- xop[2] = operands[2];
- output_asm_insn (\"andnot %1,%2,%0\", xop);
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- (unsigned) INTVAL (operands[1]) >> 16);
- return \"andnoth %1,%0,%0\";
-}")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operand:SI 1 "nonmemory_operand" "%r")
- (match_operand:SI 2 "nonmemory_operand" "rL")))]
- ""
- "*
-{
- rtx xop[3];
-
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[2]) || LOGIC_INT (operands[2]))
- return \"or %2,%1,%0\";
- if ((INTVAL (operands[2]) & 0xffff) == 0)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- (unsigned) INTVAL (operands[2]) >> 16);
- return \"orh %2,%1,%0\";
- }
- xop[0] = operands[0];
- xop[1] = operands[1];
- xop[2] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[2]) & 0xffff));
- output_asm_insn (\"or %2,%1,%0\", xop);
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- (unsigned) INTVAL (operands[2]) >> 16);
- return \"orh %2,%0,%0\";
-}")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (xor:SI (match_operand:SI 1 "nonmemory_operand" "%r")
- (match_operand:SI 2 "nonmemory_operand" "rL")))]
- ""
- "*
-{
- rtx xop[3];
-
- CC_STATUS_PARTIAL_INIT;
- if (REG_P (operands[2]) || LOGIC_INT (operands[2]))
- return \"xor %2,%1,%0\";
- if ((INTVAL (operands[2]) & 0xffff) == 0)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- (unsigned) INTVAL (operands[2]) >> 16);
- return \"xorh %2,%1,%0\";
- }
- xop[0] = operands[0];
- xop[1] = operands[1];
- xop[2] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[2]) & 0xffff));
- output_asm_insn (\"xor %2,%1,%0\", xop);
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- (unsigned) INTVAL (operands[2]) >> 16);
- return \"xorh %2,%0,%0\";
-}")
-
-;(The i860 instruction set doesn't allow an immediate second operand in
-; a subtraction.)
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "general_operand" "=r")
- (neg:SI (match_operand:SI 1 "arith_operand" "r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"subu %?r0,%1,%0\";
-}")
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "general_operand" "=r")
- (not:SI (match_operand:SI 1 "arith_operand" "r")))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- return \"subu -1,%1,%0\";
-}")
-
-;; Floating point arithmetic instructions.
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (plus:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- ""
- "fadd.dd %1,%2,%0")
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (plus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- ""
- "fadd.ss %1,%2,%0")
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- ""
- "fsub.dd %1,%2,%0")
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (minus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- ""
- "fsub.ss %1,%2,%0")
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- ""
- "fmul.dd %1,%2,%0")
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- ""
- "fmul.ss %1,%2,%0")
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (neg:DF (match_operand:DF 1 "register_operand" "f")))]
- ""
- "fsub.dd %?f0,%1,%0")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (neg:SF (match_operand:SF 1 "register_operand" "f")))]
- ""
- "fsub.ss %?f0,%1,%0")
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=&f")
- (div:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))
- (clobber (match_scratch:DF 3 "=&f"))
- (clobber (match_scratch:DF 4 "=&f"))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- if (((cc_prev_status.flags & CC_KNOW_HI_R31) == 0)
- || (cc_prev_status.flags & CC_HI_R31_ADJ)
- || (cc_prev_status.mdep != CONST2_RTX (SFmode)))
- {
- cc_status.flags |= CC_KNOW_HI_R31;
- cc_status.flags &= ~CC_HI_R31_ADJ;
- cc_status.mdep = CONST2_RTX (SFmode);
- return \"frcp.dd %2,%3\;fmul.dd %2,%3,%0\;fmov.dd %?f0,%4\;\\\
-orh 0x4000,%?r0,%?r31\;ixfr %?r31,%R4\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%1,%3\;fmul.dd %0,%3,%0\";
- }
- else
- return \"frcp.dd %2,%3\;fmul.dd %2,%3,%0\;fmov.dd %?f0,%4\;\\\
-ixfr %?r31,%R4\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%1,%3\;fmul.dd %0,%3,%0\";
-}")
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=&f")
- (div:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))
- (clobber (match_scratch:SF 3 "=&f"))
- (clobber (match_scratch:SF 4 "=&f"))]
- ""
- "*
-{
- CC_STATUS_PARTIAL_INIT;
- if (((cc_prev_status.flags & CC_KNOW_HI_R31) == 0)
- || (cc_prev_status.flags & CC_HI_R31_ADJ)
- || (cc_prev_status.mdep != CONST2_RTX (SFmode)))
- {
- cc_status.flags |= CC_KNOW_HI_R31;
- cc_status.flags &= ~CC_HI_R31_ADJ;
- cc_status.mdep = CONST2_RTX (SFmode);
- output_asm_insn (\"orh 0x4000,%?r0,%?r31\", operands);
- }
- return \"ixfr %?r31,%4\;frcp.ss %2,%0\;\\\
-fmul.ss %2,%0,%3\;fsub.ss %4,%3,%3\;fmul.ss %0,%3,%0\;\\\
-fmul.ss %2,%0,%3\;fsub.ss %4,%3,%3\;\\\
-fmul.ss %1,%0,%4\;fmul.ss %3,%4,%0\";
-}")
-
-;; Shift instructions
-
-;; Optimized special case of shifting.
-;; Must precede the general case.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 24)))]
- ""
- "*
-{
- if (CONSTANT_ADDRESS_P (XEXP (operands[1], 0)))
- {
- CC_STATUS_INIT;
- cc_status.flags |= CC_KNOW_HI_R31 | CC_HI_R31_ADJ;
- cc_status.mdep = XEXP (operands[1], 0);
- return \"orh %h1,%?r0,%?r31\;ld.b %L1(%?r31),%0\";
- }
- return \"ld.b %1,%0\";
-}")
-
-
-;;- arithmetic shift instructions
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "shift_operand" "rn")))]
- ""
- "*
-{
- return \"shl %2,%1,%0\";
-}")
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ashift:HI (match_operand:HI 1 "register_operand" "r")
- (match_operand:HI 2 "shift_operand" "rn")))]
- ""
- "*
-{
- return \"shl %2,%1,%0\";
-}")
-
-(define_insn "ashlqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (ashift:QI (match_operand:QI 1 "register_operand" "r")
- (match_operand:QI 2 "shift_operand" "rn")))]
- ""
- "*
-{
- return \"shl %2,%1,%0\";
-}")
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "shift_operand" "rn")))]
- ""
- "*
-{
- return \"shra %2,%1,%0\";
-}")
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "shift_operand" "rn")))]
- ""
- "*
-{
- return \"shr %2,%1,%0\";
-}")
-
-;; Unconditional and other jump instructions
-
-(define_insn "jump"
- [(set (pc) (label_ref (match_operand 0 "" "")))]
- ""
- "*
-{
- return \"br %l0\;nop\";
-}")
-
-;; Here are two simple peepholes which fill the delay slot of
-;; an unconditional branch.
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=rf")
- (match_operand:SI 1 "single_insn_src_p" "gfG"))
- (set (pc) (label_ref (match_operand 2 "" "")))]
- ""
- "* return output_delayed_branch (\"br %l2\", operands, insn);")
-
-(define_peephole
- [(set (match_operand:SI 0 "memory_operand" "=m")
- (match_operand:SI 1 "reg_or_0_operand" "rfJ"))
- (set (pc) (label_ref (match_operand 2 "" "")))]
- ""
- "* return output_delayed_branch (\"br %l2\", operands, insn);")
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "bri %0\;nop")
-
-(define_peephole
- [(set (match_operand:SI 0 "memory_operand" "=m")
- (match_operand:SI 1 "reg_or_0_operand" "rfJ"))
- (set (pc) (match_operand:SI 2 "register_operand" "r"))
- (use (label_ref (match_operand 3 "" "")))]
- ""
- "* return output_delayed_branch (\"bri %2\", operands, insn);")
-
-;;- jump to subroutine
-(define_expand "call"
- [(call (match_operand:SI 0 "memory_operand" "m")
- (match_operand 1 "" "i"))]
- ;; operand[2] is next_arg_register
- ""
- "
-{
- /* Make sure the address is just one reg and will stay that way. */
- if (! call_insn_operand (operands[0], QImode))
- operands[0]
- = change_address (operands[0], VOIDmode,
- copy_to_mode_reg (Pmode, XEXP (operands[0], 0)));
- if (INTVAL (operands[1]) > 0)
- {
- emit_move_insn (arg_pointer_rtx, stack_pointer_rtx);
- emit_insn (gen_rtx (USE, VOIDmode, arg_pointer_rtx));
- }
-}")
-
-;;- jump to subroutine
-(define_insn ""
- [(call (match_operand:SI 0 "call_insn_operand" "m")
- (match_operand 1 "" "i"))]
- ;; operand[2] is next_arg_register
- ""
- "*
-{
- /* strip the MEM. */
- operands[0] = XEXP (operands[0], 0);
- CC_STATUS_INIT;
- if (GET_CODE (operands[0]) == REG)
- return \"calli %0\;nop\";
- return \"call %0\;nop\";
-}")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=rf")
- (match_operand:SI 1 "single_insn_src_p" "gfG"))
- (call (match_operand:SI 2 "memory_operand" "m")
- (match_operand 3 "" "i"))]
- ;;- Don't use operand 1 for most machines.
- "! reg_mentioned_p (operands[0], operands[2])"
- "*
-{
- /* strip the MEM. */
- operands[2] = XEXP (operands[2], 0);
- if (GET_CODE (operands[2]) == REG)
- return output_delayed_branch (\"calli %2\", operands, insn);
- return output_delayed_branch (\"call %2\", operands, insn);
-}")
-
-(define_peephole
- [(set (match_operand:SI 0 "memory_operand" "=m")
- (match_operand:SI 1 "reg_or_0_operand" "rfJ"))
- (call (match_operand:SI 2 "call_insn_operand" "m")
- (match_operand 3 "" "i"))]
- ;;- Don't use operand 1 for most machines.
- ""
- "*
-{
- /* strip the MEM. */
- operands[2] = XEXP (operands[2], 0);
- if (GET_CODE (operands[2]) == REG)
- return output_delayed_branch (\"calli %2\", operands, insn);
- return output_delayed_branch (\"call %2\", operands, insn);
-}")
-
-(define_expand "call_value"
- [(set (match_operand 0 "register_operand" "=rf")
- (call (match_operand:SI 1 "memory_operand" "m")
- (match_operand 2 "" "i")))]
- ;; operand 3 is next_arg_register
- ""
- "
-{
- /* Make sure the address is just one reg and will stay that way. */
- if (! call_insn_operand (operands[1], QImode))
- operands[1]
- = change_address (operands[1], VOIDmode,
- copy_to_mode_reg (Pmode, XEXP (operands[1], 0)));
- if (INTVAL (operands[2]) > 0)
- {
- emit_move_insn (arg_pointer_rtx, stack_pointer_rtx);
- emit_insn (gen_rtx (USE, VOIDmode, arg_pointer_rtx));
- }
-}")
-
-(define_insn ""
- [(set (match_operand 0 "register_operand" "=rf")
- (call (match_operand:SI 1 "call_insn_operand" "m")
- (match_operand 2 "" "i")))]
- ;; operand 3 is next_arg_register
- ""
- "*
-{
- /* strip the MEM. */
- operands[1] = XEXP (operands[1], 0);
- CC_STATUS_INIT;
- if (GET_CODE (operands[1]) == REG)
- return \"calli %1\;nop\";
- return \"call %1\;nop\";
-}")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=rf")
- (match_operand:SI 1 "single_insn_src_p" "gfG"))
- (set (match_operand 2 "" "=rf")
- (call (match_operand:SI 3 "call_insn_operand" "m")
- (match_operand 4 "" "i")))]
- ;;- Don't use operand 4 for most machines.
- "! reg_mentioned_p (operands[0], operands[3])"
- "*
-{
- /* strip the MEM. */
- operands[3] = XEXP (operands[3], 0);
- if (GET_CODE (operands[3]) == REG)
- return output_delayed_branch (\"calli %3\", operands, insn);
- return output_delayed_branch (\"call %3\", operands, insn);
-}")
-
-(define_peephole
- [(set (match_operand:SI 0 "memory_operand" "=m")
- (match_operand:SI 1 "reg_or_0_operand" "rJf"))
- (set (match_operand 2 "" "=rf")
- (call (match_operand:SI 3 "call_insn_operand" "m")
- (match_operand 4 "" "i")))]
- ;;- Don't use operand 4 for most machines.
- ""
- "*
-{
- /* strip the MEM. */
- operands[3] = XEXP (operands[3], 0);
- if (GET_CODE (operands[3]) == REG)
- return output_delayed_branch (\"calli %3\", operands, insn);
- return output_delayed_branch (\"call %3\", operands, insn);
-}")
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
- ""
- "bri %0")
-
-;;
-;; A special insn that does the work to get setup just
-;; before a table jump.
-;;
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
- (label_ref (match_operand 2 "" "")))))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"orh %H2,%?r0,%?r31\;or %L2,%?r31,%?r31\;ld.l %?r31(%1),%0\";
-}")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=rf")
- (match_operand:SI 1 "single_insn_src_p" "gfG"))
- (set (pc) (match_operand:SI 2 "register_operand" "r"))
- (use (label_ref (match_operand 3 "" "")))]
- "REGNO (operands[0]) != REGNO (operands[2])"
- "* return output_delayed_branch (\"bri %2\", operands, insn);")
diff --git a/gcc/config/i860/mach.h b/gcc/config/i860/mach.h
deleted file mode 100644
index a59cc58e0ff..00000000000
--- a/gcc/config/i860/mach.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Configuration for an i860 running Mach as the target machine. */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i860 Mach3.x)");
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di860 -DMACH -Asystem(unix) -Asystem(mach) -Acpu(i860) -Amachine(i860)"
-
-/* Specify extra dir to search for include files. */
-#define SYSTEM_INCLUDE_DIR "/usr/mach/include"
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/i860/paragon.h b/gcc/config/i860/paragon.h
deleted file mode 100644
index c6bfbba09e9..00000000000
--- a/gcc/config/i860/paragon.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Target definitions for GNU compiler for Intel 80860 running OSF/1AD
- Copyright (C) 1991, 1996 Free Software Foundation, Inc.
- Based upon original work of Ron Guilmette (rfg@monkeys.com).
- Contributed by Andy Pfiffer (andyp@ssd.intel.com).
- Partially inspired by
- Pete Beckman of Indiana University (beckman@cs.indiana.edu)
- Harry Dolan of Intel Corporation (dolan@ssd.intel.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. */
-
-/* For the sake of libgcc2.c, indicate target supports atexit. */
-#define HAVE_ATEXIT
-
-#undef TARGET_SWITCHES
-#define TARGET_SWITCHES \
- { {"xp", 1}, \
- {"noxp", -1}, \
- {"xr", -1}, \
- {"noieee", -1}, \
- {"nx", 2}, \
- { "", TARGET_DEFAULT}}
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 1
-
-/* The Intel as860 assembler does not understand .stabs, must use COFF */
-#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i860 OSF/1AD)");
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di860 -D__i860 -D__i860__ -D__PARAGON__ -D__OSF1__ -D_COFF -Dunix -DMACH -DCMU"
-
-#define CPP_SPEC "%{mnx:-D__NODE}"
-
-/* autoinit.o autolaunches NX applications */
-#define STARTFILE_SPEC "crt0.o%s %{mnx:-yoptions/autoinit.o%s}"
-
-/* libic.a is the PGI intrinsic library */
-/* libpm.o and guard.o are for the performance monitoring modules (ignored) */
-/* /usr/lib/noieee contains non-IEEE compliant (but faster) math routines */
-#if HAVE_DASH_G
-#define LIB_SPEC \
-"%{mnoieee:-L/usr/lib/noieee} %{mnx:-lnx} %{g*:-lg} -lc -lmach -lc -lic"
-#else /* HAVE_DASH_G */
-/* can't use -g for -lg; libg.a doesn't have a symbol table and ld complains */
-#define LIB_SPEC "%{mnoieee:-L/usr/lib/noieee} %{mnx:-lnx} -lc -lmach -lc -lic"
-#endif /* HAVE_DASH_G */
-
-/* Get rid of definition from svr3.h. */
-#undef SIZE_TYPE
-
-#undef I860_REG_PREFIX
-
-#undef ASM_COMMENT_START
-#define ASM_COMMENT_START "//"
-
-#undef TYPE_OPERAND_FMT
-#define TYPE_OPERAND_FMT "\"%s\""
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-#undef ASCII_DATA_ASM_OP
-#define ASCII_DATA_ASM_OP ".byte"
-
-/*
- * the assembler we're using doesn't grok .ident...
- */
-#undef ASM_OUTPUT_IDENT
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf (FILE, "//\t.ident \"%s\"\n", NAME);
-
-/*
- * the assembler doesn't grok .double INF and the like
- * but does understand .long with hex numbers, so special
- * case the "symbolic" IEEE numbers.
- */
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
- fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", t[0], t[1]); \
- } \
- else \
- fprintf (FILE, "\t.double %.20e\n", VALUE); \
- }
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
- fprintf (FILE, "\t.long 0x%lx\n", t); \
- } \
- else \
- fprintf (FILE, "\t.float %.12e\n", VALUE); \
- }
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
- do \
- { \
- register unsigned char *str = (unsigned char *) (STR); \
- register unsigned char *limit = str + (LENGTH); \
- register unsigned bytes_in_chunk = 0; \
- for (; str < limit; str++) \
- { \
- register unsigned ch = *str; \
- if (ch < 32 || ch == '\\' || ch == '"' || ch >= 127) \
- { \
- if (bytes_in_chunk > 0) \
- { \
- fprintf ((FILE), "\"\n"); \
- bytes_in_chunk = 0; \
- } \
- fprintf ((FILE), "\t%s\t%d\n", ASM_BYTE_OP, ch); \
- } \
- else \
- { \
- if (bytes_in_chunk >= 60) \
- { \
- fprintf ((FILE), "\"\n"); \
- bytes_in_chunk = 0; \
- } \
- if (bytes_in_chunk == 0) \
- fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP);\
- putc (ch, (FILE)); \
- bytes_in_chunk++; \
- } \
- } \
- if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\"\n"); \
- } \
- while (0)
-
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/*
- * not defining ASM_STABS_OP yields .stabs in the .s file
- * when using g++ -- so, I'll define it.
- */
-#define ASM_STABS_OP "//.stabs"
-
-/* Define this macro if an argument declared as `char' or `short' in a
- prototype should actually be passed as an `int'. In addition to
- avoiding errors in certain cases of mismatch, it also makes for
- better code on certain machines. */
-/*#define PROMOTE_PROTOTYPES*/
-
-/* Define this macro if an instruction to load a value narrower
- than a word from memory into a register also zero-extends the
- value to the whole register. */
-/*#define BYTE_LOADS_ZERO_EXTEND*/
-
-/* Define this macro as a C expression which is nonzero if
- accessing less than a word of memory (i.e. a `char' or a
- `short') is no faster than accessing a word of memory, i.e., if
- such access require more than one instruction or if there is no
- difference in cost between byte and (aligned) word loads.
-
- On RISC machines, it tends to generate better code to define
- this as 1, since it avoids making a QI or HI mode register. */
-/*
-#undef SLOW_BYTE_ACCESS
-#define SLOW_BYTE_ACCESS 1
-*/
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-
-#define FASTEST_ALIGNMENT 32
-
-/* Make strings word-aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- (TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
-
-/*
- * disable a few things picked up from svr3.h
- */
-#undef INIT_SECTION_ASM_OP
-#undef FINI_SECTION_ASM_OP
-#undef CONST_SECTION_ASM_OP
-#undef CTORS_SECTION_ASM_OP
-#undef DTORS_SECTION_ASM_OP
-#undef DO_GLOBAL_CTORS_BODY
-#undef ASM_OUTPUT_DESTRUCTOR
-#undef SELECT_SECTION
-#undef SELECT_RTX_SECTION
-#undef READONLY_DATA_SECTION
-
-#define BSS_SECTION_ASM_OP ".bss" /* XXX */
-#undef EXTRA_SECTIONS
-#undef EXTRA_SECTION_FUNCTIONS
diff --git a/gcc/config/i860/sysv3.h b/gcc/config/i860/sysv3.h
deleted file mode 100644
index 56f8e49a3e7..00000000000
--- a/gcc/config/i860/sysv3.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Target definitions for GNU compiler for Intel 80860 running System V.3
- Copyright (C) 1991, 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@monkeys.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. */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i860, System V Release 3)")
-
-/* Provide a set of pre-definitions and pre-assertions appropriate for
- the i860 running svr3. */
-#define CPP_PREDEFINES "-Di860 -Dunix -D__svr3__ -Asystem(unix) -Asystem(svr3) -Acpu(i860) -Amachine(i860)"
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#define STARTFILE_SPEC \
- "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
-
-#define LIB_SPEC "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} -lc crtn.o%s"
-
-/* Special flags for the linker. I don't know what they do. */
-
-#define LINK_SPEC "%{T*} %{z:-lm}"
-
-/* The prefix to be used in assembler output for all names of registers.
- None is needed in V.3. */
-
-#define I860_REG_PREFIX ""
-
-/* Delimiter that starts comments in the assembler code. */
-
-#define ASM_COMMENT_START "//"
-
-/* Don't renumber the regusters for debugger output. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Output the special word the System V SDB wants to see just before
- the first word of each function's prologue code. */
-
-extern char *current_function_original_name;
-
-/* This special macro is used to output a magic word just before the
- first word of each function. On some versions of UNIX running on
- the i860, this word can be any word that looks like a NOP, however
- under svr4, this neds to be an `shr r0,r0,r0' instruction in which
- the normally unused low-order bits contain the length of the function
- prologue code (in bytes). This is needed to make the System V SDB
- debugger happy. */
-
-#undef ASM_OUTPUT_FUNCTION_PREFIX
-#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \
- do { ASM_OUTPUT_ALIGN (FILE, 2); \
- fprintf ((FILE), "\t.long\t.ep."); \
- assemble_name (FILE, FNNAME); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, FNNAME); \
- fprintf (FILE, "+0xc8000000\n"); \
- current_function_original_name = (FNNAME); \
- } while (0)
-
-/* Output the special label that must go just after each function's
- prologue code to support svr4 SDB. */
-
-#define ASM_OUTPUT_PROLOGUE_SUFFIX(FILE) \
- do { fprintf (FILE, ".ep."); \
- assemble_name (FILE, current_function_original_name); \
- fprintf (FILE, ":\n"); \
- } while (0)
-
-/* This says how to output an assembler line
- to define a local common symbol.
- The difference from svr3.h is we don't limit align to 2. */
-
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- do { \
- int align = exact_log2 (ROUNDED); \
- data_section (); \
- ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
- ASM_OUTPUT_LABEL ((FILE), (NAME)); \
- fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)); \
- } while (0)
-
-/* The routine used to output string literals.
-
-#define ASCII_DATA_ASM_OP ".byte"
-
-#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
- do \
- { \
- register unsigned char *str = (unsigned char *) (STR); \
- register unsigned char *limit = str + (LENGTH); \
- register unsigned bytes_in_chunk = 0; \
- for (; str < limit; str++) \
- { \
- register unsigned ch = *str; \
- if (ch < 32 || ch == '\\' || ch == '"' || ch >= 127) \
- { \
- if (bytes_in_chunk > 0) \
- { \
- fprintf ((FILE), "\"\n"); \
- bytes_in_chunk = 0; \
- } \
- fprintf ((FILE), "\t%s\t%d\n", ASM_BYTE_OP, ch); \
- } \
- else \
- { \
- if (bytes_in_chunk >= 60) \
- { \
- fprintf ((FILE), "\"\n"); \
- bytes_in_chunk = 0; \
- } \
- if (bytes_in_chunk == 0) \
- fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP); \
- putc (ch, (FILE)); \
- bytes_in_chunk++; \
- } \
- } \
- if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\"\n"); \
- } \
- while (0)
-
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\""
-
-/* Add definitions to support the .tdesc section as specified in the svr4
- ABI for the i860. */
-
-#define TDESC_SECTION_ASM_OP ".section\t.tdesc"
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_tdesc
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
- TDESC_SECTION_FUNCTION
-
-#define TDESC_SECTION_FUNCTION \
-void \
-tdesc_section () \
-{ \
- if (in_section != in_tdesc) \
- { \
- fprintf (asm_out_file, "%s\n", TDESC_SECTION_ASM_OP); \
- in_section = in_tdesc; \
- } \
-}
-
-/* Enable the `const' section that svr3.h defines how to use. */
-#undef USE_CONST_SECTION
-#define USE_CONST_SECTION 1
diff --git a/gcc/config/i860/sysv4.h b/gcc/config/i860/sysv4.h
deleted file mode 100644
index eca6b79ce2e..00000000000
--- a/gcc/config/i860/sysv4.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Target definitions for GNU compiler for Intel 80860 running System V.4
- Copyright (C) 1991, 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@monkeys.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. */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (i860 System V Release 4)");
-
-/* Provide a set of pre-definitions and pre-assertions appropriate for
- the i860 running svr4. Note that the symbol `__svr4__' MUST BE
- DEFINED! It is needed so that the va_list struct in va-i860.h
- will get correctly defined for the svr4 (ABI compliant) case rather
- than for the previous (svr3, svr2, ...) case. It also needs to be
- defined so that the correct (svr4) version of __builtin_saveregs
- will be selected when we are building gnulib2.c.
- __svr4__ is our extension. */
-
-#define CPP_PREDEFINES \
- "-Di860 -Dunix -DSVR4 -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(i860) -Amachine(i860)"
-
-/* The prefix to be used in assembler output for all names of registers.
- This string gets prepended to all i860 register names (svr4 only). */
-
-#define I860_REG_PREFIX "%"
-
-#define ASM_COMMENT_START "#"
-
-#undef TYPE_OPERAND_FMT
-#define TYPE_OPERAND_FMT "\"%s\""
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* The following macro definition overrides the one in i860.h
- because the svr4 i860 assembler requires a different syntax
- for getting parts of constant/relocatable values. */
-
-#undef PRINT_OPERAND_PART
-#define PRINT_OPERAND_PART(FILE, X, PART_CODE) \
- do { fprintf (FILE, "["); \
- output_address (X); \
- fprintf (FILE, "]@%s", PART_CODE); \
- } while (0)
-
-/* If the host and target formats match, output the floats as hex. */
-#if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
-#if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
-
-/* This is how to output an assembler line defining a `double' constant.
- Note that the native i860/svr4 ELF assembler can't properly handle
- infinity. It generates an incorrect (non-infinity) value when given
- `.double 99e9999' and it doesn't grok `inf' at all. It also mishandles
- NaNs and -0.0. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
- fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", t[0], t[1]); \
- } \
- else \
- fprintf (FILE, "\t.double %.20e\n", VALUE); \
- }
-
-/* This is how to output an assembler line defining a `float' constant.
- Note that the native i860/svr4 ELF assembler can't properly handle
- infinity. It actually generates an assembly time error when given
- `.float 99e9999' and it doesn't grok `inf' at all. It also mishandles
- NaNs and -0.0. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
- fprintf (FILE, "\t.word 0x%lx\n", t); \
- } \
- else \
- fprintf (FILE, "\t.float %.12e\n", VALUE); \
- }
-
-#endif /* word order matches */
-#endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { output_file_directive (FILE, main_input_filename); \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- } while (0)
-
-/* Output the special word the svr4 SDB wants to see just before
- the first word of each function's prologue code. */
-
-extern char *current_function_original_name;
-
-/* This special macro is used to output a magic word just before the
- first word of each function. On some versions of UNIX running on
- the i860, this word can be any word that looks like a NOP, however
- under svr4, this neds to be an `shr r0,r0,r0' instruction in which
- the normally unused low-order bits contain the length of the function
- prologue code (in bytes). This is needed to make the svr4 SDB debugger
- happy. */
-
-#undef ASM_OUTPUT_FUNCTION_PREFIX
-#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \
- do { ASM_OUTPUT_ALIGN (FILE, 2); \
- fprintf ((FILE), "\t.long\t.ep."); \
- assemble_name (FILE, FNNAME); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, FNNAME); \
- fprintf (FILE, "+0xc8000000\n"); \
- current_function_original_name = (FNNAME); \
- } while (0)
-
-/* Output the special label that must go just after each function's
- prologue code to support svr4 SDB. */
-
-#define ASM_OUTPUT_PROLOGUE_SUFFIX(FILE) \
- do { fprintf (FILE, ".ep."); \
- assemble_name (FILE, current_function_original_name); \
- fprintf (FILE, ":\n"); \
- } while (0)
-
-/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
-
- Note that we want to give these sections the SHF_WRITE attribute
- because these sections will actually contain data (i.e. tables of
- addresses of functions in the current root executable or shared library
- file) and, in the case of a shared library, the relocatable addresses
- will have to be properly resolved/relocated (and then written into) by
- the dynamic linker when it actually attaches the given shared library
- to the executing process. (Note that on SVR4, you may wish to use the
- `-z text' option to the ELF linker, when building a shared library, as
- an additional check that you are doing everything right. But if you do
- use the `-z text' option when building a shared library, you will get
- errors unless the .ctors and .dtors sections are marked as writable
- via the SHF_WRITE attribute.) */
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
-
-/* Add definitions to support the .tdesc section as specified in the svr4
- ABI for the i860. */
-
-#define TDESC_SECTION_ASM_OP ".section\t.tdesc"
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_tdesc
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
- TDESC_SECTION_FUNCTION
-
-#define TDESC_SECTION_FUNCTION \
-void \
-tdesc_section () \
-{ \
- if (in_section != in_tdesc) \
- { \
- fprintf (asm_out_file, "%s\n", TDESC_SECTION_ASM_OP); \
- in_section = in_tdesc; \
- } \
-}
-
diff --git a/gcc/config/i860/t-fx2800 b/gcc/config/i860/t-fx2800
deleted file mode 100644
index 5f081735714..00000000000
--- a/gcc/config/i860/t-fx2800
+++ /dev/null
@@ -1,3 +0,0 @@
-# Use ieee rounding rules for divide and square root operations.
-# /bin/cc is assumed to point to fxc version 1.3 or newer.
-CCLIBFLAGS=-O -ieee -uniproc
diff --git a/gcc/config/i860/x-fx2800 b/gcc/config/i860/x-fx2800
deleted file mode 100644
index cf05f8f43bd..00000000000
--- a/gcc/config/i860/x-fx2800
+++ /dev/null
@@ -1,7 +0,0 @@
-
-# The Alliant FX2800 is supposed to conform to the SysV R4 i860 ABI,
-# but apparently the native compiler generates non ABI-compliant
-# function prologues and epilogues, so we need the alloca from emacs.
-# -- hyc@hanauma.jpl.nasa.gov
-
-ALLOCA=alloca.o
diff --git a/gcc/config/i860/x-sysv3 b/gcc/config/i860/x-sysv3
deleted file mode 100644
index 3375d421849..00000000000
--- a/gcc/config/i860/x-sysv3
+++ /dev/null
@@ -1 +0,0 @@
-ALLOCA=alloca.o
diff --git a/gcc/config/i860/x-sysv4 b/gcc/config/i860/x-sysv4
deleted file mode 100644
index c01fb887dca..00000000000
--- a/gcc/config/i860/x-sysv4
+++ /dev/null
@@ -1,44 +0,0 @@
-# The svr4 reference port for the i860 contains an alloca.o routine
-# in /usr/ucblib/libucb.a, but we can't just try to get that by
-# setting CLIB to /usr/ucblib/libucb.a because (unfortunately)
-# there are a lot of other routines in libucb.a which are supposed
-# to be the Berkeley versions of library routines normally found in
-# libc.a and many of these Berkeley versions are badly broken. Thus,
-# if we try to link programs with libucb.a before libc.a, those
-# programs tend to crash.
-
-# Also, the alloca() routine supplied in early version of svr4 for
-# the i860 is non-ABI compliant. It doesn't keep the stack aligned
-# to a 16-byte boundary as the ABI requires.
-
-# More importantly however, even a fully ABI compliant alloca() routine
-# would fail to work correctly with some versions of the native svr4 C
-# compiler currently being distributed for the i860 (as of 1/29/92).
-# The problem is that the native C compiler generates non-ABI-compliant
-# function epilogues which cut back the stack (upon function exit) in
-# an incorrect manner. Specifically, they cut back the stack by adding
-# the nominal *static* frame size (determined statically at compile-time)
-# to the stack pointer rather than setting the stack pointer based upon
-# the current value of the frame pointer (as called for in the i860 ABI).
-# This can cause serious trouble in cases where you repeatedly call a
-# routine which itself calls alloca(). In such cases, the stack will
-# grow continuously until you finally run out of swap space or exceed
-# the system's process size limit. To avoid this problem (which can
-# arise when a stage1 gcc is being used to build a stage2 gcc) you
-# *must* link in the C language version of alloca() which is supplied
-# with gcc to your stage1 version of gcc. The following definition
-# forces that to happen.
-
-ALLOCA=alloca.o
-
-# We build all stages *without* shared libraries because that may make
-# debugging the compiler easier (until there is a GDB which supports
-# both Dwarf *and* svr4 shared libraries).
-
-# Note that the native C compiler for the svr4 reference port on the
-# i860 recognizes a special -gg option. Using that option causes *full*
-# Dwarf debugging information to be generated, whereas using only -g
-# causes only limited Dwarf debugging information to be generated.
-# (This is an undocumented feature of the native svr4 C compiler.)
-
-CCLIBFLAGS=-Bstatic -dn -gg
diff --git a/gcc/config/i860/xm-i860.h b/gcc/config/i860/xm-i860.h
deleted file mode 100644
index 4e8488f1f10..00000000000
--- a/gcc/config/i860/xm-i860.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Configuration for GNU C-compiler for Intel i860.
- Copyright (C) 1988, 1993 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. */
-
-#ifndef i860
-#define i860
-#endif
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-
-#include "tm.h"
diff --git a/gcc/config/i960/i960-coff.h b/gcc/config/i960/i960-coff.h
deleted file mode 100644
index 139e8d1c5c3..00000000000
--- a/gcc/config/i960/i960-coff.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Definitions of target machine for GNU compiler, for "naked" Intel
- 80960 using coff object format and coff debugging symbols.
- Copyright (C) 1988, 1989, 1991, 1996 Free Software Foundation.
- Contributed by Steven McGeady (mcg@omepd.intel.com)
- Additional work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson
- Converted to GCC 2.0 by Michael Tiemann, Cygnus Support.
-
-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. */
-
-/* Support -gstabs using stabs in COFF sections. */
-
-/* Generate SDB_DEBUGGING_INFO by default. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
-
-/* This is intended to be used with Cygnus's newlib library, so we want to
- use the standard definition of LIB_SPEC. */
-#undef LIB_SPEC
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- output_file_directive ((FILE), main_input_filename)
-
-/* Support the ctors and dtors sections for g++. */
-
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\""
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-#define INT_ASM_OP ".word"
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* end of i960-coff.h */
diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c
deleted file mode 100644
index 70e5f208ecc..00000000000
--- a/gcc/config/i960/i960.c
+++ /dev/null
@@ -1,2617 +0,0 @@
-/* Subroutines used for code generation on intel 80960.
- Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Steven McGeady, Intel Corp.
- Additional Work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson
- Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support.
-
-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 <stdio.h>
-
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "tree.h"
-#include "insn-codes.h"
-#include "assert.h"
-#include "expr.h"
-#include "except.h"
-#include "function.h"
-#include "recog.h"
-#include <math.h>
-
-/* Save the operands last given to a compare for use when we
- generate a scc or bcc insn. */
-
-rtx i960_compare_op0, i960_compare_op1;
-
-/* Used to implement #pragma align/noalign. Initialized by OVERRIDE_OPTIONS
- macro in i960.h. */
-
-static int i960_maxbitalignment;
-static int i960_last_maxbitalignment;
-
-/* Used to implement switching between MEM and ALU insn types, for better
- C series performance. */
-
-enum insn_types i960_last_insn_type;
-
-/* The leaf-procedure return register. Set only if this is a leaf routine. */
-
-static int i960_leaf_ret_reg;
-
-/* True if replacing tail calls with jumps is OK. */
-
-static int tail_call_ok;
-
-/* A string containing a list of insns to emit in the epilogue so as to
- restore all registers saved by the prologue. Created by the prologue
- code as it saves registers away. */
-
-char epilogue_string[1000];
-
-/* A unique number (per function) for return labels. */
-
-static int ret_label = 0;
-
-/* This is true if FNDECL is either a varargs or a stdarg function.
- This is used to help identify functions that use an argument block. */
-
-#define VARARGS_STDARG_FUNCTION(FNDECL) \
-((TYPE_ARG_TYPES (TREE_TYPE (FNDECL)) != 0 \
- && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (FNDECL)))) != void_type_node)) \
- || current_function_varargs)
-
-/* Handle pragmas for compatibility with Intel's compilers. */
-
-/* ??? This is incomplete, since it does not handle all pragmas that the
- intel compilers understand. */
-
-int
-process_pragma (finput, t)
- FILE *finput;
- tree t;
-{
- int i;
- register int c;
- register char *pname;
-
- if (TREE_CODE (t) != IDENTIFIER_NODE)
- return 0;
-
- pname = IDENTIFIER_POINTER (t);
-
- if (strcmp (pname, "align") == 0)
- {
- char buf[20];
- char *s = buf;
- int align;
-
- do {
- c = getc (finput);
- } while (c == ' ' || c == '\t');
-
- if (c == '(')
- c = getc (finput);
- while (c >= '0' && c <= '9')
- {
- if (s < buf + sizeof buf - 1)
- *s++ = c;
- c = getc (finput);
- }
- *s = '\0';
-
- /* We had to read a non-numerical character to get out of the
- while loop---often a newline. So, we have to put it back to
- make sure we continue to parse everything properly. */
- ungetc (c, finput);
-
- align = atoi (buf);
- switch (align)
- {
- case 0:
- /* Return to last alignment. */
- align = i960_last_maxbitalignment / 8;
- /* Fall through. */
- case 16:
- case 8:
- case 4:
- case 2:
- case 1:
- i960_last_maxbitalignment = i960_maxbitalignment;
- i960_maxbitalignment = align * 8;
- break;
-
- default:
- /* Silently ignore bad values. */
- break;
- }
-
- /* NOTE: ic960 R3.0 pragma align definition:
-
- #pragma align [(size)] | (identifier=size[,...])
- #pragma noalign [(identifier)[,...]]
-
- (all parens are optional)
-
- - size is [1,2,4,8,16]
- - noalign means size==1
- - applies only to component elements of a struct (and union?)
- - identifier applies to structure tag (only)
- - missing identifier means next struct
-
- - alignment rules for bitfields need more investigation */
-
- return 1;
- }
-
- /* Should be pragma 'far' or equivalent for callx/balx here. */
-
- return 0;
-}
-
-/* Initialize variables before compiling any files. */
-
-void
-i960_initialize ()
-{
- if (TARGET_IC_COMPAT2_0)
- {
- i960_maxbitalignment = 8;
- i960_last_maxbitalignment = 128;
- }
- else
- {
- i960_maxbitalignment = 128;
- i960_last_maxbitalignment = 8;
- }
-}
-
-/* Return true if OP can be used as the source of an fp move insn. */
-
-int
-fpmove_src_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_DOUBLE || general_operand (op, mode));
-}
-
-#if 0
-/* Return true if OP is a register or zero. */
-
-int
-reg_or_zero_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return register_operand (op, mode) || op == const0_rtx;
-}
-#endif
-
-/* Return truth value of whether OP can be used as an operands in a three
- address arithmetic insn (such as add %o1,7,%l2) of mode MODE. */
-
-int
-arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode) || literal (op, mode));
-}
-
-/* Return truth value of whether OP can be used as an operands in a three
- address logic insn, possibly complementing OP, of mode MODE. */
-
-int
-logic_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT
- && INTVAL(op) >= -32 && INTVAL(op) < 32));
-}
-
-/* Return true if OP is a register or a valid floating point literal. */
-
-int
-fp_arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode) || fp_literal (op, mode));
-}
-
-/* Return true is OP is a register or a valid signed integer literal. */
-
-int
-signed_arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode) || signed_literal (op, mode));
-}
-
-/* Return truth value of whether OP is a integer which fits the
- range constraining immediate operands in three-address insns. */
-
-int
-literal (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ((GET_CODE (op) == CONST_INT) && INTVAL(op) >= 0 && INTVAL(op) < 32);
-}
-
-/* Return true if OP is a float constant of 1. */
-
-int
-fp_literal_one (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (TARGET_NUMERICS && mode == GET_MODE (op) && op == CONST1_RTX (mode));
-}
-
-/* Return true if OP is a float constant of 0. */
-
-int
-fp_literal_zero (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (TARGET_NUMERICS && mode == GET_MODE (op) && op == CONST0_RTX (mode));
-}
-
-/* Return true if OP is a valid floating point literal. */
-
-int
-fp_literal(op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return fp_literal_zero (op, mode) || fp_literal_one (op, mode);
-}
-
-/* Return true if OP is a valid signed immediate constant. */
-
-int
-signed_literal(op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ((GET_CODE (op) == CONST_INT) && INTVAL(op) > -32 && INTVAL(op) < 32);
-}
-
-/* Return truth value of statement that OP is a symbolic memory
- operand of mode MODE. */
-
-int
-symbolic_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
- if (GET_CODE (op) != MEM)
- return 0;
- op = XEXP (op, 0);
- return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST
- || GET_CODE (op) == HIGH || GET_CODE (op) == LABEL_REF);
-}
-
-/* Return truth value of whether OP is EQ or NE. */
-
-int
-eq_or_neq (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == EQ || GET_CODE (op) == NE);
-}
-
-/* OP is an integer register or a constant. */
-
-int
-arith32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
- return (CONSTANT_P (op));
-}
-
-/* Return true if OP is an integer constant which is a power of 2. */
-
-int
-power2_operand (op,mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != CONST_INT)
- return 0;
-
- return exact_log2 (INTVAL (op)) >= 0;
-}
-
-/* Return true if OP is an integer constant which is the complement of a
- power of 2. */
-
-int
-cmplpower2_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != CONST_INT)
- return 0;
-
- return exact_log2 (~ INTVAL (op)) >= 0;
-}
-
-/* If VAL has only one bit set, return the index of that bit. Otherwise
- return -1. */
-
-int
-bitpos (val)
- unsigned int val;
-{
- register int i;
-
- for (i = 0; val != 0; i++, val >>= 1)
- {
- if (val & 1)
- {
- if (val != 1)
- return -1;
- return i;
- }
- }
- return -1;
-}
-
-/* Return non-zero if OP is a mask, i.e. all one bits are consecutive.
- The return value indicates how many consecutive non-zero bits exist
- if this is a mask. This is the same as the next function, except that
- it does not indicate what the start and stop bit positions are. */
-
-int
-is_mask (val)
- unsigned int val;
-{
- register int start, end, i;
-
- start = -1;
- for (i = 0; val != 0; val >>= 1, i++)
- {
- if (val & 1)
- {
- if (start < 0)
- start = i;
-
- end = i;
- continue;
- }
- /* Still looking for the first bit. */
- if (start < 0)
- continue;
-
- /* We've seen the start of a bit sequence, and now a zero. There
- must be more one bits, otherwise we would have exited the loop.
- Therefore, it is not a mask. */
- if (val)
- return 0;
- }
-
- /* The bit string has ones from START to END bit positions only. */
- return end - start + 1;
-}
-
-/* If VAL is a mask, then return nonzero, with S set to the starting bit
- position and E set to the ending bit position of the mask. The return
- value indicates how many consecutive bits exist in the mask. This is
- the same as the previous function, except that it also indicates the
- start and end bit positions of the mask. */
-
-int
-bitstr (val, s, e)
- unsigned int val;
- int *s, *e;
-{
- register int start, end, i;
-
- start = -1;
- end = -1;
- for (i = 0; val != 0; val >>= 1, i++)
- {
- if (val & 1)
- {
- if (start < 0)
- start = i;
-
- end = i;
- continue;
- }
-
- /* Still looking for the first bit. */
- if (start < 0)
- continue;
-
- /* We've seen the start of a bit sequence, and now a zero. There
- must be more one bits, otherwise we would have exited the loop.
- Therefor, it is not a mask. */
- if (val)
- {
- start = -1;
- end = -1;
- break;
- }
- }
-
- /* The bit string has ones from START to END bit positions only. */
- *s = start;
- *e = end;
- return ((start < 0) ? 0 : end - start + 1);
-}
-
-/* Return the machine mode to use for a comparison. */
-
-enum machine_mode
-select_cc_mode (op, x)
- RTX_CODE op;
- rtx x;
-{
- if (op == GTU || op == LTU || op == GEU || op == LEU)
- return CC_UNSmode;
- return CCmode;
-}
-
-/* X and Y are two things to compare using CODE. Emit the compare insn and
- return the rtx for register 36 in the proper mode. */
-
-rtx
-gen_compare_reg (code, x, y)
- enum rtx_code code;
- rtx x, y;
-{
- rtx cc_reg;
- enum machine_mode ccmode = SELECT_CC_MODE (code, x, y);
- enum machine_mode mode
- = GET_MODE (x) == VOIDmode ? GET_MODE (y) : GET_MODE (x);
-
- if (mode == SImode)
- {
- if (! arith_operand (x, mode))
- x = force_reg (SImode, x);
- if (! arith_operand (y, mode))
- y = force_reg (SImode, y);
- }
-
- cc_reg = gen_rtx (REG, ccmode, 36);
- emit_insn (gen_rtx (SET, VOIDmode, cc_reg,
- gen_rtx (COMPARE, ccmode, x, y)));
-
- return cc_reg;
-}
-
-/* For the i960, REG is cost 1, REG+immed CONST is cost 2, REG+REG is cost 2,
- REG+nonimmed CONST is cost 4. REG+SYMBOL_REF, SYMBOL_REF, and similar
- are 4. Indexed addresses are cost 6. */
-
-/* ??? Try using just RTX_COST, i.e. not defining ADDRESS_COST. */
-
-int
-i960_address_cost (x)
- rtx x;
-{
-#if 0
- /* Handled before calling here. */
- if (GET_CODE (x) == REG)
- return 1;
-#endif
- if (GET_CODE (x) == PLUS)
- {
- rtx base = XEXP (x, 0);
- rtx offset = XEXP (x, 1);
-
- if (GET_CODE (base) == SUBREG)
- base = SUBREG_REG (base);
- if (GET_CODE (offset) == SUBREG)
- offset = SUBREG_REG (offset);
-
- if (GET_CODE (base) == REG)
- {
- if (GET_CODE (offset) == REG)
- return 2;
- if (GET_CODE (offset) == CONST_INT)
- {
- if ((unsigned)INTVAL (offset) < 2047)
- return 2;
- return 4;
- }
- if (CONSTANT_P (offset))
- return 4;
- }
- if (GET_CODE (base) == PLUS || GET_CODE (base) == MULT)
- return 6;
-
- /* This is an invalid address. The return value doesn't matter, but
- for convenience we make this more expensive than anything else. */
- return 12;
- }
- if (GET_CODE (x) == MULT)
- return 6;
-
- /* Symbol_refs and other unrecognized addresses are cost 4. */
- return 4;
-}
-
-/* Emit insns to move operands[1] into operands[0].
-
- Return 1 if we have written out everything that needs to be done to
- do the move. Otherwise, return 0 and the caller will emit the move
- normally. */
-
-int
-emit_move_sequence (operands, mode)
- rtx *operands;
- enum machine_mode mode;
-{
- /* We can only store registers to memory. */
-
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) != REG)
- operands[1] = force_reg (mode, operands[1]);
-
- /* Storing multi-word values in unaligned hard registers to memory may
- require a scratch since we have to store them a register at a time and
- adding 4 to the memory address may not yield a valid insn. */
- /* ??? We don't always need the scratch, but that would complicate things.
- Maybe later. */
- if (GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && GET_CODE (operands[0]) == MEM
- && GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && ! HARD_REGNO_MODE_OK (REGNO (operands[1]), mode))
- {
- emit_insn (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (2,
- gen_rtx (SET, VOIDmode,
- operands[0], operands[1]),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (SCRATCH, Pmode)))));
- return 1;
- }
-
- return 0;
-}
-
-/* Output assembler to move a double word value. */
-
-char *
-i960_output_move_double (dst, src)
- rtx dst, src;
-{
- rtx operands[5];
-
- if (GET_CODE (dst) == REG
- && GET_CODE (src) == REG)
- {
- if ((REGNO (src) & 1)
- || (REGNO (dst) & 1))
- {
- /* We normally copy the low-numbered register first. However, if
- the second source register is the same as the first destination
- register, we must copy in the opposite order. */
- if (REGNO (src) + 1 == REGNO (dst))
- return "mov %D1,%D0\n\tmov %1,%0";
- else
- return "mov %1,%0\n\tmov %D1,%D0";
- }
- else
- return "movl %1,%0";
- }
- else if (GET_CODE (dst) == REG
- && GET_CODE (src) == CONST_INT
- && CONST_OK_FOR_LETTER_P (INTVAL (src), 'I'))
- {
- if (REGNO (dst) & 1)
- return "mov %1,%0\n\tmov 0,%D0";
- else
- return "movl %1,%0";
- }
- else if (GET_CODE (dst) == REG
- && GET_CODE (src) == MEM)
- {
- if (REGNO (dst) & 1)
- {
- /* One can optimize a few cases here, but you have to be
- careful of clobbering registers used in the address and
- edge conditions. */
- operands[0] = dst;
- operands[1] = src;
- operands[2] = gen_rtx (REG, Pmode, REGNO (dst) + 1);
- operands[3] = gen_rtx (MEM, word_mode, operands[2]);
- operands[4] = adj_offsettable_operand (operands[3], UNITS_PER_WORD);
- output_asm_insn ("lda %1,%2\n\tld %3,%0\n\tld %4,%D0", operands);
- return "";
- }
- else
- return "ldl %1,%0";
- }
- else if (GET_CODE (dst) == MEM
- && GET_CODE (src) == REG)
- {
- if (REGNO (src) & 1)
- {
- /* This is handled by emit_move_sequence so we shouldn't get here. */
- abort ();
- }
- return "stl %1,%0";
- }
- else
- abort ();
-}
-
-/* Output assembler to move a quad word value. */
-
-char *
-i960_output_move_quad (dst, src)
- rtx dst, src;
-{
- rtx operands[7];
-
- if (GET_CODE (dst) == REG
- && GET_CODE (src) == REG)
- {
- if ((REGNO (src) & 3)
- || (REGNO (dst) & 3))
- {
- /* We normally copy starting with the low numbered register.
- However, if there is an overlap such that the first dest reg
- is <= the last source reg but not < the first source reg, we
- must copy in the opposite order. */
- if (REGNO (dst) <= REGNO (src) + 3
- && REGNO (dst) >= REGNO (src))
- return "mov %F1,%F0\n\tmov %E1,%E0\n\tmov %D1,%D0\n\tmov %1,%0";
- else
- return "mov %1,%0\n\tmov %D1,%D0\n\tmov %E1,%E0\n\tmov %F1,%F0";
- }
- else
- return "movq %1,%0";
- }
- else if (GET_CODE (dst) == REG
- && GET_CODE (src) == CONST_INT
- && CONST_OK_FOR_LETTER_P (INTVAL (src), 'I'))
- {
- if (REGNO (dst) & 3)
- return "mov %1,%0\n\tmov 0,%D0\n\tmov 0,%E0\n\tmov 0,%F0";
- else
- return "movq %1,%0";
- }
- else if (GET_CODE (dst) == REG
- && GET_CODE (src) == MEM)
- {
- if (REGNO (dst) & 3)
- {
- /* One can optimize a few cases here, but you have to be
- careful of clobbering registers used in the address and
- edge conditions. */
- operands[0] = dst;
- operands[1] = src;
- operands[2] = gen_rtx (REG, Pmode, REGNO (dst) + 3);
- operands[3] = gen_rtx (MEM, word_mode, operands[2]);
- operands[4] = adj_offsettable_operand (operands[3], UNITS_PER_WORD);
- operands[5] = adj_offsettable_operand (operands[4], UNITS_PER_WORD);
- operands[6] = adj_offsettable_operand (operands[5], UNITS_PER_WORD);
- output_asm_insn ("lda %1,%2\n\tld %3,%0\n\tld %4,%D0\n\tld %5,%E0\n\tld %6,%F0", operands);
- return "";
- }
- else
- return "ldq %1,%0";
- }
- else if (GET_CODE (dst) == MEM
- && GET_CODE (src) == REG)
- {
- if (REGNO (src) & 3)
- {
- /* This is handled by emit_move_sequence so we shouldn't get here. */
- abort ();
- }
- return "stq %1,%0";
- }
- else
- abort ();
-}
-
-/* Emit insns to load a constant to non-floating point registers.
- Uses several strategies to try to use as few insns as possible. */
-
-char *
-i960_output_ldconst (dst, src)
- register rtx dst, src;
-{
- register int rsrc1;
- register unsigned rsrc2;
- enum machine_mode mode = GET_MODE (dst);
- rtx operands[4];
-
- operands[0] = operands[2] = dst;
- operands[1] = operands[3] = src;
-
- /* Anything that isn't a compile time constant, such as a SYMBOL_REF,
- must be a ldconst insn. */
-
- if (GET_CODE (src) != CONST_INT && GET_CODE (src) != CONST_DOUBLE)
- {
- output_asm_insn ("ldconst %1,%0", operands);
- return "";
- }
- else if (mode == XFmode)
- {
- REAL_VALUE_TYPE d;
- long value_long[3];
- int i;
-
- if (fp_literal_zero (src, XFmode))
- return "movt 0,%0";
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, src);
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (d, value_long);
-
- output_asm_insn ("# ldconst %1,%0",operands);
-
- for (i = 0; i < 3; i++)
- {
- operands[0] = gen_rtx (REG, SImode, REGNO (dst) + i);
- operands[1] = GEN_INT (value_long[i]);
- output_asm_insn (i960_output_ldconst (operands[0], operands[1]),
- operands);
- }
-
- return "";
- }
- else if (mode == DFmode)
- {
- rtx first, second;
-
- if (fp_literal_zero (src, DFmode))
- return "movl 0,%0";
-
- split_double (src, &first, &second);
-
- output_asm_insn ("# ldconst %1,%0",operands);
-
- operands[0] = gen_rtx (REG, SImode, REGNO (dst));
- operands[1] = first;
- output_asm_insn (i960_output_ldconst (operands[0], operands[1]),
- operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (dst) + 1);
- operands[1] = second;
- output_asm_insn (i960_output_ldconst (operands[0], operands[1]),
- operands);
- return "";
- }
- else if (mode == SFmode)
- {
- REAL_VALUE_TYPE d;
- long value;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, src);
- REAL_VALUE_TO_TARGET_SINGLE (d, value);
-
- output_asm_insn ("# ldconst %1,%0",operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (dst));
- operands[1] = gen_rtx (CONST_INT, VOIDmode, value);
- output_asm_insn (i960_output_ldconst (operands[0], operands[1]),
- operands);
- return "";
- }
- else if (mode == TImode)
- {
- /* ??? This is currently not handled at all. */
- abort ();
-
- /* Note: lowest order word goes in lowest numbered reg. */
- rsrc1 = INTVAL (src);
- if (rsrc1 >= 0 && rsrc1 < 32)
- return "movq %1,%0";
- else
- output_asm_insn ("movq\t0,%0\t# ldconstq %1,%0",operands);
- /* Go pick up the low-order word. */
- }
- else if (mode == DImode)
- {
- rtx upperhalf, lowerhalf, xoperands[2];
-
- if (GET_CODE (src) == CONST_DOUBLE || GET_CODE (src) == CONST_INT)
- split_double (src, &lowerhalf, &upperhalf);
-
- else
- abort ();
-
- /* Note: lowest order word goes in lowest numbered reg. */
- /* Numbers from 0 to 31 can be handled with a single insn. */
- rsrc1 = INTVAL (lowerhalf);
- if (upperhalf == const0_rtx && rsrc1 >= 0 && rsrc1 < 32)
- return "movl %1,%0";
-
- /* Output the upper half with a recursive call. */
- xoperands[0] = gen_rtx (REG, SImode, REGNO (dst) + 1);
- xoperands[1] = upperhalf;
- output_asm_insn (i960_output_ldconst (xoperands[0], xoperands[1]),
- xoperands);
- /* The lower word is emitted as normally. */
- }
- else
- {
- rsrc1 = INTVAL (src);
- if (mode == QImode)
- {
- if (rsrc1 > 0xff)
- rsrc1 &= 0xff;
- }
- else if (mode == HImode)
- {
- if (rsrc1 > 0xffff)
- rsrc1 &= 0xffff;
- }
- }
-
- if (rsrc1 >= 0)
- {
- /* ldconst 0..31,X -> mov 0..31,X */
- if (rsrc1 < 32)
- {
- if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
- return "lda %1,%0";
- return "mov %1,%0";
- }
-
- /* ldconst 32..63,X -> add 31,nn,X */
- if (rsrc1 < 63)
- {
- if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
- return "lda %1,%0";
- operands[1] = gen_rtx (CONST_INT, VOIDmode, rsrc1 - 31);
- output_asm_insn ("addo\t31,%1,%0\t# ldconst %3,%0", operands);
- return "";
- }
- }
- else if (rsrc1 < 0)
- {
- /* ldconst -1..-31 -> sub 0,0..31,X */
- if (rsrc1 >= -31)
- {
- /* return 'sub -(%1),0,%0' */
- operands[1] = gen_rtx (CONST_INT, VOIDmode, - rsrc1);
- output_asm_insn ("subo\t%1,0,%0\t# ldconst %3,%0", operands);
- return "";
- }
-
- /* ldconst -32 -> not 31,X */
- if (rsrc1 == -32)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode, ~rsrc1);
- output_asm_insn ("not\t%1,%0 # ldconst %3,%0", operands);
- return "";
- }
- }
-
- /* If const is a single bit. */
- if (bitpos (rsrc1) >= 0)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode, bitpos (rsrc1));
- output_asm_insn ("setbit\t%1,0,%0\t# ldconst %3,%0", operands);
- return "";
- }
-
- /* If const is a bit string of less than 6 bits (1..31 shifted). */
- if (is_mask (rsrc1))
- {
- int s, e;
-
- if (bitstr (rsrc1, &s, &e) < 6)
- {
- rsrc2 = ((unsigned int) rsrc1) >> s;
- operands[1] = gen_rtx (CONST_INT, VOIDmode, rsrc2);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, s);
- output_asm_insn ("shlo\t%2,%1,%0\t# ldconst %3,%0", operands);
- return "";
- }
- }
-
- /* Unimplemented cases:
- const is in range 0..31 but rotated around end of word:
- ror 31,3,g0 -> ldconst 0xe0000003,g0
-
- and any 2 instruction cases that might be worthwhile */
-
- output_asm_insn ("ldconst %1,%0", operands);
- return "";
-}
-
-/* Determine if there is an opportunity for a bypass optimization.
- Bypass succeeds on the 960K* if the destination of the previous
- instruction is the second operand of the current instruction.
- Bypass always succeeds on the C*.
-
- Return 1 if the pattern should interchange the operands.
-
- CMPBR_FLAG is true if this is for a compare-and-branch insn.
- OP1 and OP2 are the two source operands of a 3 operand insn. */
-
-int
-i960_bypass (insn, op1, op2, cmpbr_flag)
- register rtx insn, op1, op2;
- int cmpbr_flag;
-{
- register rtx prev_insn, prev_dest;
-
- if (TARGET_C_SERIES)
- return 0;
-
- /* Can't do this if op1 isn't a register. */
- if (! REG_P (op1))
- return 0;
-
- /* Can't do this for a compare-and-branch if both ops aren't regs. */
- if (cmpbr_flag && ! REG_P (op2))
- return 0;
-
- prev_insn = prev_real_insn (insn);
-
- if (prev_insn && GET_CODE (prev_insn) == INSN
- && GET_CODE (PATTERN (prev_insn)) == SET)
- {
- prev_dest = SET_DEST (PATTERN (prev_insn));
- if ((GET_CODE (prev_dest) == REG && REGNO (prev_dest) == REGNO (op1))
- || (GET_CODE (prev_dest) == SUBREG
- && GET_CODE (SUBREG_REG (prev_dest)) == REG
- && REGNO (SUBREG_REG (prev_dest)) == REGNO (op1)))
- return 1;
- }
- return 0;
-}
-
-/* Output the code which declares the function name. This also handles
- leaf routines, which have special requirements, and initializes some
- global variables. */
-
-void
-i960_function_name_declare (file, name, fndecl)
- FILE *file;
- char *name;
- tree fndecl;
-{
- register int i, j;
- int leaf_proc_ok;
- rtx insn;
-
- /* Increment global return label. */
-
- ret_label++;
-
- /* Compute whether tail calls and leaf routine optimizations can be performed
- for this function. */
-
- if (TARGET_TAILCALL)
- tail_call_ok = 1;
- else
- tail_call_ok = 0;
-
- if (TARGET_LEAFPROC)
- leaf_proc_ok = 1;
- else
- leaf_proc_ok = 0;
-
- /* Even if nobody uses extra parms, can't have leafproc or tail calls if
- argblock, because argblock uses g14 implicitly. */
-
- if (current_function_args_size != 0 || VARARGS_STDARG_FUNCTION (fndecl))
- {
- tail_call_ok = 0;
- leaf_proc_ok = 0;
- }
-
- /* See if caller passes in an address to return value. */
-
- if (aggregate_value_p (DECL_RESULT (fndecl)))
- {
- tail_call_ok = 0;
- leaf_proc_ok = 0;
- }
-
- /* Can not use tail calls or make this a leaf routine if there is a non
- zero frame size. */
-
- if (get_frame_size () != 0)
- leaf_proc_ok = 0;
-
- /* I don't understand this condition, and do not think that it is correct.
- Apparently this is just checking whether the frame pointer is used, and
- we can't trust regs_ever_live[fp] since it is (almost?) always set. */
-
- if (tail_call_ok)
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN
- && reg_mentioned_p (frame_pointer_rtx, insn))
- {
- tail_call_ok = 0;
- break;
- }
-
- /* Check for CALL insns. Can not be a leaf routine if there are any. */
-
- if (leaf_proc_ok)
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == CALL_INSN)
- {
- leaf_proc_ok = 0;
- break;
- }
-
- /* Can not be a leaf routine if any non-call clobbered registers are
- used in this function. */
-
- if (leaf_proc_ok)
- for (i = 0, j = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (regs_ever_live[i]
- && ((! call_used_regs[i]) || (i > 7 && i < 12)))
- {
- /* Global registers. */
- if (i < 16 && i > 7 && i != 13)
- leaf_proc_ok = 0;
- /* Local registers. */
- else if (i < 32)
- leaf_proc_ok = 0;
- }
-
- /* Now choose a leaf return register, if we can find one, and if it is
- OK for this to be a leaf routine. */
-
- i960_leaf_ret_reg = -1;
-
- if (optimize && leaf_proc_ok)
- {
- for (i960_leaf_ret_reg = -1, i = 0; i < 8; i++)
- if (regs_ever_live[i] == 0)
- {
- i960_leaf_ret_reg = i;
- regs_ever_live[i] = 1;
- break;
- }
- }
-
- /* Do this after choosing the leaf return register, so it will be listed
- if one was chosen. */
-
- fprintf (file, "\t# Function '%s'\n", (name[0] == '*' ? &name[1] : name));
- fprintf (file, "\t# Registers used: ");
-
- for (i = 0, j = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (regs_ever_live[i])
- {
- fprintf (file, "%s%s ", reg_names[i], call_used_regs[i] ? "" : "*");
-
- if (i > 15 && j == 0)
- {
- fprintf (file,"\n\t#\t\t ");
- j++;
- }
- }
- }
-
- fprintf (file, "\n");
-
- if (i960_leaf_ret_reg >= 0)
- {
- /* Make it a leaf procedure. */
-
- if (TREE_PUBLIC (fndecl))
- fprintf (file,"\t.globl\t%s.lf\n", (name[0] == '*' ? &name[1] : name));
-
- fprintf (file, "\t.leafproc\t");
- assemble_name (file, name);
- fprintf (file, ",%s.lf\n", (name[0] == '*' ? &name[1] : name));
- ASM_OUTPUT_LABEL (file, name);
- fprintf (file, "\tlda LR%d,g14\n", ret_label);
- fprintf (file, "%s.lf:\n", (name[0] == '*' ? &name[1] : name));
- fprintf (file, "\tmov g14,g%d\n", i960_leaf_ret_reg);
-
- if (TARGET_C_SERIES)
- {
- fprintf (file, "\tlda 0,g14\n");
- i960_last_insn_type = I_TYPE_MEM;
- }
- else
- {
- fprintf (file, "\tmov 0,g14\n");
- i960_last_insn_type = I_TYPE_REG;
- }
- }
- else
- {
- ASM_OUTPUT_LABEL (file, name);
- i960_last_insn_type = I_TYPE_CTRL;
- }
-}
-
-/* Compute and return the frame size. */
-
-int
-compute_frame_size (size)
- int size;
-{
- int actual_fsize;
- int outgoing_args_size = current_function_outgoing_args_size;
-
- /* The STARTING_FRAME_OFFSET is totally hidden to us as far
- as size is concerned. */
- actual_fsize = (size + 15) & -16;
- actual_fsize += (outgoing_args_size + 15) & -16;
-
- return actual_fsize;
-}
-
-/* Output code for the function prologue. */
-
-void
-i960_function_prologue (file, size)
- FILE *file;
- unsigned int size;
-{
- register int i, j, nr;
- int n_iregs = 0;
- int rsize = 0;
- int actual_fsize, offset;
- char tmpstr[1000];
- /* -1 if reg must be saved on proc entry, 0 if available, 1 if saved
- somewhere. */
- int regs[FIRST_PSEUDO_REGISTER];
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (regs_ever_live[i]
- && ((! call_used_regs[i]) || (i > 7 && i < 12)))
- {
- regs[i] = -1;
- /* Count global registers that need saving. */
- if (i < 16)
- n_iregs++;
- }
- else
- regs[i] = 0;
-
- epilogue_string[0] = '\0';
-
- if (profile_flag || profile_block_flag)
- {
- /* When profiling, we may use registers 20 to 27 to save arguments, so
- they can't be used here for saving globals. J is the number of
- argument registers the mcount call will save. */
- for (j = 7; j >= 0 && ! regs_ever_live[j]; j--)
- ;
-
- for (i = 20; i <= j + 20; i++)
- regs[i] = -1;
- }
-
- /* First look for local registers to save globals in. */
- for (i = 0; i < 16; i++)
- {
- if (regs[i] == 0)
- continue;
-
- /* Start at r4, not r3. */
- for (j = 20; j < 32; j++)
- {
- if (regs[j] != 0)
- continue;
-
- regs[i] = 1;
- regs[j] = -1;
- regs_ever_live[j] = 1;
- nr = 1;
- if (i <= 14 && i % 2 == 0 && j <= 30 && j % 2 == 0
- && regs[i+1] != 0 && regs[j+1] == 0)
- {
- nr = 2;
- regs[i+1] = 1;
- regs[j+1] = -1;
- regs_ever_live[j+1] = 1;
- }
- if (nr == 2 && i <= 12 && i % 4 == 0 && j <= 28 && j % 4 == 0
- && regs[i+2] != 0 && regs[j+2] == 0)
- {
- nr = 3;
- regs[i+2] = 1;
- regs[j+2] = -1;
- regs_ever_live[j+2] = 1;
- }
- if (nr == 3 && regs[i+3] != 0 && regs[j+3] == 0)
- {
- nr = 4;
- regs[i+3] = 1;
- regs[j+3] = -1;
- regs_ever_live[j+3] = 1;
- }
-
- fprintf (file, "\tmov%s %s,%s\n",
- ((nr == 4) ? "q" :
- (nr == 3) ? "t" :
- (nr == 2) ? "l" : ""),
- reg_names[i], reg_names[j]);
- sprintf (tmpstr, "\tmov%s %s,%s\n",
- ((nr == 4) ? "q" :
- (nr == 3) ? "t" :
- (nr == 2) ? "l" : ""),
- reg_names[j], reg_names[i]);
- strcat (epilogue_string, tmpstr);
-
- n_iregs -= nr;
- i += nr-1;
- break;
- }
- }
-
- /* N_iregs is now the number of global registers that haven't been saved
- yet. */
-
- rsize = (n_iregs * 4);
- actual_fsize = compute_frame_size (size) + rsize;
-#if 0
- /* ??? The 1.2.1 compiler does this also. This is meant to round the frame
- size up to the nearest multiple of 16. I don't know whether this is
- necessary, or even desirable.
-
- The frame pointer must be aligned, but the call instruction takes care of
- that. If we leave the stack pointer unaligned, we may save a little on
- dynamic stack allocation. And we don't lose, at least according to the
- i960CA manual. */
- actual_fsize = (actual_fsize + 15) & ~0xF;
-#endif
-
- /* Allocate space for register save and locals. */
- if (actual_fsize > 0)
- {
- if (actual_fsize < 32)
- fprintf (file, "\taddo %d,sp,sp\n", actual_fsize);
- else
- fprintf (file, "\tlda\t%d(sp),sp\n", actual_fsize);
- }
-
- /* Take hardware register save area created by the call instruction
- into account, but store them before the argument block area. */
- offset = 64 + actual_fsize - compute_frame_size (0) - rsize;
- /* Save registers on stack if needed. */
- for (i = 0, j = n_iregs; j > 0 && i < 16; i++)
- {
- if (regs[i] != -1)
- continue;
-
- nr = 1;
-
- if (i <= 14 && i % 2 == 0 && regs[i+1] == -1 && offset % 2 == 0)
- nr = 2;
-
- if (nr == 2 && i <= 12 && i % 4 == 0 && regs[i+2] == -1
- && offset % 4 == 0)
- nr = 3;
-
- if (nr == 3 && regs[i+3] == -1)
- nr = 4;
-
- fprintf (file,"\tst%s %s,%d(fp)\n",
- ((nr == 4) ? "q" :
- (nr == 3) ? "t" :
- (nr == 2) ? "l" : ""),
- reg_names[i], offset);
- sprintf (tmpstr,"\tld%s %d(fp),%s\n",
- ((nr == 4) ? "q" :
- (nr == 3) ? "t" :
- (nr == 2) ? "l" : ""),
- offset, reg_names[i]);
- strcat (epilogue_string, tmpstr);
- i += nr-1;
- j -= nr;
- offset += nr * 4;
- }
-
- if (actual_fsize == 0 && size == 0 && rsize == 0)
- return;
-
- fprintf (file, "\t#Prologue stats:\n");
- fprintf (file, "\t# Total Frame Size: %d bytes\n", actual_fsize);
-
- if (size)
- fprintf (file, "\t# Local Variable Size: %d bytes\n", size);
- if (rsize)
- fprintf (file, "\t# Register Save Size: %d regs, %d bytes\n",
- n_iregs, rsize);
- fprintf (file, "\t#End Prologue#\n");
-}
-
-/* Output code for the function profiler. */
-
-void
-output_function_profiler (file, labelno)
- FILE *file;
- int labelno;
-{
- /* The last used parameter register. */
- int last_parm_reg;
- int i, j, increment;
- int varargs_stdarg_function
- = VARARGS_STDARG_FUNCTION (current_function_decl);
-
- /* Figure out the last used parameter register. The proper thing to do
- is to walk incoming args of the function. A function might have live
- parameter registers even if it has no incoming args. Note that we
- don't have to save parameter registers g8 to g11 because they are
- call preserved. */
-
- /* See also output_function_prologue, which tries to use local registers
- for preserved call-saved global registers. */
-
- for (last_parm_reg = 7;
- last_parm_reg >= 0 && ! regs_ever_live[last_parm_reg];
- last_parm_reg--)
- ;
-
- /* Save parameter registers in regs r4 (20) to r11 (27). */
-
- for (i = 0, j = 4; i <= last_parm_reg; i += increment, j += increment)
- {
- if (i % 4 == 0 && (last_parm_reg - i) >= 3)
- increment = 4;
- else if (i % 4 == 0 && (last_parm_reg - i) >= 2)
- increment = 3;
- else if (i % 2 == 0 && (last_parm_reg - i) >= 1)
- increment = 2;
- else
- increment = 1;
-
- fprintf (file, "\tmov%s g%d,r%d\n",
- (increment == 4 ? "q" : increment == 3 ? "t"
- : increment == 2 ? "l": ""), i, j);
- }
-
- /* If this function uses the arg pointer, then save it in r3 and then
- set it to zero. */
-
- if (current_function_args_size != 0 || varargs_stdarg_function)
- fprintf (file, "\tmov g14,r3\n\tmov 0,g14\n");
-
- /* Load location address into g0 and call mcount. */
-
- fprintf (file, "\tlda\tLP%d,g0\n\tcallx\tmcount\n", labelno);
-
- /* If this function uses the arg pointer, restore it. */
-
- if (current_function_args_size != 0 || varargs_stdarg_function)
- fprintf (file, "\tmov r3,g14\n");
-
- /* Restore parameter registers. */
-
- for (i = 0, j = 4; i <= last_parm_reg; i += increment, j += increment)
- {
- if (i % 4 == 0 && (last_parm_reg - i) >= 3)
- increment = 4;
- else if (i % 4 == 0 && (last_parm_reg - i) >= 2)
- increment = 3;
- else if (i % 2 == 0 && (last_parm_reg - i) >= 1)
- increment = 2;
- else
- increment = 1;
-
- fprintf (file, "\tmov%s r%d,g%d\n",
- (increment == 4 ? "q" : increment == 3 ? "t"
- : increment == 2 ? "l": ""), j, i);
- }
-}
-
-/* Output code for the function epilogue. */
-
-void
-i960_function_epilogue (file, size)
- FILE *file;
- unsigned int size;
-{
- if (i960_leaf_ret_reg >= 0)
- {
- fprintf (file, "LR%d: ret\n", ret_label);
- return;
- }
-
- if (*epilogue_string == 0)
- {
- register rtx tmp;
-
- /* Emit a return insn, but only if control can fall through to here. */
-
- tmp = get_last_insn ();
- while (tmp)
- {
- if (GET_CODE (tmp) == BARRIER)
- return;
- if (GET_CODE (tmp) == CODE_LABEL)
- break;
- if (GET_CODE (tmp) == JUMP_INSN)
- {
- if (GET_CODE (PATTERN (tmp)) == RETURN)
- return;
- break;
- }
- if (GET_CODE (tmp) == NOTE)
- {
- tmp = PREV_INSN (tmp);
- continue;
- }
- break;
- }
- fprintf (file, "LR%d: ret\n", ret_label);
- return;
- }
-
- fprintf (file, "LR%d:\n", ret_label);
-
- fprintf (file, "\t#EPILOGUE#\n");
-
- /* Output the string created by the prologue which will restore all
- registers saved by the prologue. */
-
- if (epilogue_string[0] != '\0')
- fprintf (file, "%s", epilogue_string);
-
- /* Must clear g14 on return if this function set it.
- Only varargs/stdarg functions modify g14. */
-
- if (VARARGS_STDARG_FUNCTION (current_function_decl))
- fprintf (file, "\tmov 0,g14\n");
-
- fprintf (file, "\tret\n");
- fprintf (file, "\t#End Epilogue#\n");
-}
-
-/* Output code for a call insn. */
-
-char *
-i960_output_call_insn (target, argsize_rtx, arg_pointer, insn)
- register rtx target, argsize_rtx, arg_pointer, insn;
-{
- int argsize = INTVAL (argsize_rtx);
- rtx nexti = next_real_insn (insn);
- rtx operands[2];
- int varargs_stdarg_function
- = VARARGS_STDARG_FUNCTION (current_function_decl);
-
- operands[0] = target;
- operands[1] = arg_pointer;
-
- if (current_function_args_size != 0 || varargs_stdarg_function)
- output_asm_insn ("mov g14,r3", operands);
-
- if (argsize > 48)
- output_asm_insn ("lda %a1,g14", operands);
- else if (current_function_args_size != 0 || varargs_stdarg_function)
- output_asm_insn ("mov 0,g14", operands);
-
- /* The code used to assume that calls to SYMBOL_REFs could not be more
- than 24 bits away (b vs bx, callj vs callx). This is not true. This
- feature is now implemented by relaxing in the GNU linker. It can convert
- bx to b if in range, and callx to calls/call/balx/bal as appropriate. */
-
- /* Nexti could be zero if the called routine is volatile. */
- if (optimize && (*epilogue_string == 0) && argsize == 0 && tail_call_ok
- && (nexti == 0 || GET_CODE (PATTERN (nexti)) == RETURN))
- {
- /* Delete following return insn. */
- if (nexti && no_labels_between_p (insn, nexti))
- delete_insn (nexti);
- output_asm_insn ("bx %0", operands);
- return "# notreached";
- }
-
- output_asm_insn ("callx %0", operands);
-
- /* If the caller sets g14 to the address of the argblock, then the caller
- must clear it after the return. */
-
- if (current_function_args_size != 0 || varargs_stdarg_function)
- output_asm_insn ("mov r3,g14", operands);
- else if (argsize > 48)
- output_asm_insn ("mov 0,g14", operands);
-
- return "";
-}
-
-/* Output code for a return insn. */
-
-char *
-i960_output_ret_insn (insn)
- register rtx insn;
-{
- static char lbuf[20];
-
- if (*epilogue_string != 0)
- {
- if (! TARGET_CODE_ALIGN && next_real_insn (insn) == 0)
- return "";
-
- sprintf (lbuf, "b LR%d", ret_label);
- return lbuf;
- }
-
- /* Must clear g14 on return if this function set it.
- Only varargs/stdarg functions modify g14. */
-
- if (VARARGS_STDARG_FUNCTION (current_function_decl))
- output_asm_insn ("mov 0,g14", 0);
-
- if (i960_leaf_ret_reg >= 0)
- {
- sprintf (lbuf, "bx (%s)", reg_names[i960_leaf_ret_reg]);
- return lbuf;
- }
- return "ret";
-}
-
-#if 0
-/* Return a character string representing the branch prediction
- opcode to be tacked on an instruction. This must at least
- return a null string. */
-
-char *
-i960_br_predict_opcode (lab_ref, insn)
- rtx lab_ref, insn;
-{
- if (TARGET_BRANCH_PREDICT)
- {
- unsigned long label_uid;
-
- if (GET_CODE (lab_ref) == CODE_LABEL)
- label_uid = INSN_UID (lab_ref);
- else if (GET_CODE (lab_ref) == LABEL_REF)
- label_uid = INSN_UID (XEXP (lab_ref, 0));
- else
- return ".f";
-
- /* If not optimizing, then the insn_addresses array will not be
- valid. In this case, always return ".t" since most branches
- are taken. If optimizing, return .t for backward branches
- and .f for forward branches. */
- if (! optimize
- || insn_addresses[label_uid] < insn_addresses[INSN_UID (insn)])
- return ".t";
- return ".f";
- }
-
- return "";
-}
-#endif
-
-/* Print the operand represented by rtx X formatted by code CODE. */
-
-void
-i960_print_operand (file, x, code)
- FILE *file;
- rtx x;
- char code;
-{
- enum rtx_code rtxcode = GET_CODE (x);
-
- if (rtxcode == REG)
- {
- switch (code)
- {
- case 'D':
- /* Second reg of a double or quad. */
- fprintf (file, "%s", reg_names[REGNO (x)+1]);
- break;
-
- case 'E':
- /* Third reg of a quad. */
- fprintf (file, "%s", reg_names[REGNO (x)+2]);
- break;
-
- case 'F':
- /* Fourth reg of a quad. */
- fprintf (file, "%s", reg_names[REGNO (x)+3]);
- break;
-
- case 0:
- fprintf (file, "%s", reg_names[REGNO (x)]);
- break;
-
- default:
- abort ();
- }
- return;
- }
- else if (rtxcode == MEM)
- {
- output_address (XEXP (x, 0));
- return;
- }
- else if (rtxcode == CONST_INT)
- {
- HOST_WIDE_INT val = INTVAL (x);
- if (code == 'C')
- val = ~val;
- if (val > 9999 || val < -999)
- fprintf (file, "0x%x", val);
- else
- fprintf (file, "%d", val);
- return;
- }
- else if (rtxcode == CONST_DOUBLE)
- {
- REAL_VALUE_TYPE d;
- char dstr[30];
-
- if (x == CONST0_RTX (GET_MODE (x)))
- {
- fprintf (file, "0f0.0");
- return;
- }
- else if (x == CONST1_RTX (GET_MODE (x)))
- {
- fprintf (file, "0f1.0");
- return;
- }
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, x);
- REAL_VALUE_TO_DECIMAL (d, "%#g", dstr);
- fprintf (file, "0f%s", dstr);
- return;
- }
-
- switch(code)
- {
- case 'B':
- /* Branch or jump, depending on assembler. */
- if (TARGET_ASM_COMPAT)
- fputs ("j", file);
- else
- fputs ("b", file);
- break;
-
- case 'S':
- /* Sign of condition. */
- if ((rtxcode == EQ) || (rtxcode == NE) || (rtxcode == GTU)
- || (rtxcode == LTU) || (rtxcode == GEU) || (rtxcode == LEU))
- fputs ("o", file);
- else if ((rtxcode == GT) || (rtxcode == LT)
- || (rtxcode == GE) || (rtxcode == LE))
- fputs ("i", file);
- else
- abort();
- break;
-
- case 'I':
- /* Inverted condition. */
- rtxcode = reverse_condition (rtxcode);
- goto normal;
-
- case 'X':
- /* Inverted condition w/ reversed operands. */
- rtxcode = reverse_condition (rtxcode);
- /* Fallthrough. */
-
- case 'R':
- /* Reversed operand condition. */
- rtxcode = swap_condition (rtxcode);
- /* Fallthrough. */
-
- case 'C':
- /* Normal condition. */
- normal:
- if (rtxcode == EQ) { fputs ("e", file); return; }
- else if (rtxcode == NE) { fputs ("ne", file); return; }
- else if (rtxcode == GT) { fputs ("g", file); return; }
- else if (rtxcode == GTU) { fputs ("g", file); return; }
- else if (rtxcode == LT) { fputs ("l", file); return; }
- else if (rtxcode == LTU) { fputs ("l", file); return; }
- else if (rtxcode == GE) { fputs ("ge", file); return; }
- else if (rtxcode == GEU) { fputs ("ge", file); return; }
- else if (rtxcode == LE) { fputs ("le", file); return; }
- else if (rtxcode == LEU) { fputs ("le", file); return; }
- else abort ();
- break;
-
- case 0:
- output_addr_const (file, x);
- break;
-
- default:
- abort ();
- }
-
- return;
-}
-
-/* Print a memory address as an operand to reference that memory location.
-
- This is exactly the same as legitimate_address_p, except that it the prints
- addresses instead of recognizing them. */
-
-void
-i960_print_operand_addr (file, addr)
- FILE *file;
- register rtx addr;
-{
- rtx breg, ireg;
- rtx scale, offset;
-
- ireg = 0;
- breg = 0;
- offset = 0;
- scale = const1_rtx;
-
- if (GET_CODE (addr) == REG)
- breg = addr;
- else if (CONSTANT_P (addr))
- offset = addr;
- else if (GET_CODE (addr) == PLUS)
- {
- rtx op0, op1;
-
- op0 = XEXP (addr, 0);
- op1 = XEXP (addr, 1);
-
- if (GET_CODE (op0) == REG)
- {
- breg = op0;
- if (GET_CODE (op1) == REG)
- ireg = op1;
- else if (CONSTANT_P (op1))
- offset = op1;
- else
- abort ();
- }
- else if (GET_CODE (op0) == PLUS)
- {
- if (GET_CODE (XEXP (op0, 0)) == MULT)
- {
- ireg = XEXP (XEXP (op0, 0), 0);
- scale = XEXP (XEXP (op0, 0), 1);
- if (GET_CODE (XEXP (op0, 1)) == REG)
- {
- breg = XEXP (op0, 1);
- offset = op1;
- }
- else
- abort ();
- }
- else if (GET_CODE (XEXP (op0, 0)) == REG)
- {
- breg = XEXP (op0, 0);
- if (GET_CODE (XEXP (op0, 1)) == REG)
- {
- ireg = XEXP (op0, 1);
- offset = op1;
- }
- else
- abort ();
- }
- else
- abort ();
- }
- else if (GET_CODE (op0) == MULT)
- {
- ireg = XEXP (op0, 0);
- scale = XEXP (op0, 1);
- if (GET_CODE (op1) == REG)
- breg = op1;
- else if (CONSTANT_P (op1))
- offset = op1;
- else
- abort ();
- }
- else
- abort ();
- }
- else if (GET_CODE (addr) == MULT)
- {
- ireg = XEXP (addr, 0);
- scale = XEXP (addr, 1);
- }
- else
- abort ();
-
- if (offset)
- output_addr_const (file, offset);
- if (breg)
- fprintf (file, "(%s)", reg_names[REGNO (breg)]);
- if (ireg)
- fprintf (file, "[%s*%d]", reg_names[REGNO (ireg)], INTVAL (scale));
-}
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On 80960, legitimate addresses are:
- base ld (g0),r0
- disp (12 or 32 bit) ld foo,r0
- base + index ld (g0)[g1*1],r0
- base + displ ld 0xf00(g0),r0
- base + index*scale + displ ld 0xf00(g0)[g1*4],r0
- index*scale + base ld (g0)[g1*4],r0
- index*scale + displ ld 0xf00[g1*4],r0
- index*scale ld [g1*4],r0
- index + base + displ ld 0xf00(g0)[g1*1],r0
-
- In each case, scale can be 1, 2, 4, 8, or 16. */
-
-/* This is exactly the same as i960_print_operand_addr, except that
- it recognizes addresses instead of printing them.
-
- It only recognizes address in canonical form. LEGITIMIZE_ADDRESS should
- convert common non-canonical forms to canonical form so that they will
- be recognized. */
-
-/* These two macros allow us to accept either a REG or a SUBREG anyplace
- where a register is valid. */
-
-#define RTX_OK_FOR_BASE_P(X, STRICT) \
- ((GET_CODE (X) == REG \
- && (STRICT ? REG_OK_FOR_BASE_P_STRICT (X) : REG_OK_FOR_BASE_P (X))) \
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && (STRICT ? REG_OK_FOR_BASE_P_STRICT (SUBREG_REG (X)) \
- : REG_OK_FOR_BASE_P (SUBREG_REG (X)))))
-
-#define RTX_OK_FOR_INDEX_P(X, STRICT) \
- ((GET_CODE (X) == REG \
- && (STRICT ? REG_OK_FOR_INDEX_P_STRICT (X) : REG_OK_FOR_INDEX_P (X)))\
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && (STRICT ? REG_OK_FOR_INDEX_P_STRICT (SUBREG_REG (X)) \
- : REG_OK_FOR_INDEX_P (SUBREG_REG (X)))))
-
-int
-legitimate_address_p (mode, addr, strict)
- enum machine_mode mode;
- register rtx addr;
- int strict;
-{
- if (RTX_OK_FOR_BASE_P (addr, strict))
- return 1;
- else if (CONSTANT_P (addr))
- return 1;
- else if (GET_CODE (addr) == PLUS)
- {
- rtx op0, op1;
-
- if (! TARGET_COMPLEX_ADDR && ! reload_completed)
- return 0;
-
- op0 = XEXP (addr, 0);
- op1 = XEXP (addr, 1);
-
- if (RTX_OK_FOR_BASE_P (op0, strict))
- {
- if (RTX_OK_FOR_INDEX_P (op1, strict))
- return 1;
- else if (CONSTANT_P (op1))
- return 1;
- else
- return 0;
- }
- else if (GET_CODE (op0) == PLUS)
- {
- if (GET_CODE (XEXP (op0, 0)) == MULT)
- {
- if (! (RTX_OK_FOR_INDEX_P (XEXP (XEXP (op0, 0), 0), strict)
- && SCALE_TERM_P (XEXP (XEXP (op0, 0), 1))))
- return 0;
-
- if (RTX_OK_FOR_BASE_P (XEXP (op0, 1), strict)
- && CONSTANT_P (op1))
- return 1;
- else
- return 0;
- }
- else if (RTX_OK_FOR_BASE_P (XEXP (op0, 0), strict))
- {
- if (RTX_OK_FOR_INDEX_P (XEXP (op0, 1), strict)
- && CONSTANT_P (op1))
- return 1;
- else
- return 0;
- }
- else
- return 0;
- }
- else if (GET_CODE (op0) == MULT)
- {
- if (! (RTX_OK_FOR_INDEX_P (XEXP (op0, 0), strict)
- && SCALE_TERM_P (XEXP (op0, 1))))
- return 0;
-
- if (RTX_OK_FOR_BASE_P (op1, strict))
- return 1;
- else if (CONSTANT_P (op1))
- return 1;
- else
- return 0;
- }
- else
- return 0;
- }
- else if (GET_CODE (addr) == MULT)
- {
- if (! TARGET_COMPLEX_ADDR && ! reload_completed)
- return 0;
-
- return (RTX_OK_FOR_INDEX_P (XEXP (addr, 0), strict)
- && SCALE_TERM_P (XEXP (addr, 1)));
- }
- else
- return 0;
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- This converts some non-canonical addresses to canonical form so they
- can be recognized. */
-
-rtx
-legitimize_address (x, oldx, mode)
- register rtx x;
- register rtx oldx;
- enum machine_mode mode;
-{
- if (GET_CODE (x) == SYMBOL_REF)
- {
- abort ();
- x = copy_to_reg (x);
- }
-
- if (! TARGET_COMPLEX_ADDR && ! reload_completed)
- return x;
-
- /* Canonicalize (plus (mult (reg) (const)) (plus (reg) (const)))
- into (plus (plus (mult (reg) (const)) (reg)) (const)). This can be
- created by virtual register instantiation, register elimination, and
- similar optimizations. */
- if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 0)) == MULT
- && GET_CODE (XEXP (x, 1)) == PLUS)
- x = gen_rtx (PLUS, Pmode,
- gen_rtx (PLUS, Pmode, XEXP (x, 0), XEXP (XEXP (x, 1), 0)),
- XEXP (XEXP (x, 1), 1));
-
- /* Canonicalize (plus (plus (mult (reg) (const)) (plus (reg) (const))) const)
- into (plus (plus (mult (reg) (const)) (reg)) (const)). */
- else if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == PLUS
- && CONSTANT_P (XEXP (x, 1)))
- {
- rtx constant, other;
-
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- {
- constant = XEXP (x, 1);
- other = XEXP (XEXP (XEXP (x, 0), 1), 1);
- }
- else if (GET_CODE (XEXP (XEXP (XEXP (x, 0), 1), 1)) == CONST_INT)
- {
- constant = XEXP (XEXP (XEXP (x, 0), 1), 1);
- other = XEXP (x, 1);
- }
- else
- constant = 0;
-
- if (constant)
- x = gen_rtx (PLUS, Pmode,
- gen_rtx (PLUS, Pmode, XEXP (XEXP (x, 0), 0),
- XEXP (XEXP (XEXP (x, 0), 1), 0)),
- plus_constant (other, INTVAL (constant)));
- }
-
- return x;
-}
-
-#if 0
-/* Return the most stringent alignment that we are willing to consider
- objects of size SIZE and known alignment ALIGN as having. */
-
-int
-i960_alignment (size, align)
- int size;
- int align;
-{
- int i;
-
- if (! TARGET_STRICT_ALIGN)
- if (TARGET_IC_COMPAT2_0 || align >= 4)
- {
- i = i960_object_bytes_bitalign (size) / BITS_PER_UNIT;
- if (i > align)
- align = i;
- }
-
- return align;
-}
-#endif
-
-/* Modes for condition codes. */
-#define C_MODES \
- ((1 << (int) CCmode) | (1 << (int) CC_UNSmode) | (1<< (int) CC_CHKmode))
-
-/* Modes for single-word (and smaller) quantities. */
-#define S_MODES \
- (~C_MODES \
- & ~ ((1 << (int) DImode) | (1 << (int) TImode) \
- | (1 << (int) DFmode) | (1 << (int) XFmode)))
-
-/* Modes for double-word (and smaller) quantities. */
-#define D_MODES \
- (~C_MODES \
- & ~ ((1 << (int) TImode) | (1 << (int) XFmode)))
-
-/* Modes for quad-word quantities. */
-#define T_MODES (~C_MODES)
-
-/* Modes for single-float quantities. */
-#define SF_MODES ((1 << (int) SFmode))
-
-/* Modes for double-float quantities. */
-#define DF_MODES (SF_MODES | (1 << (int) DFmode) | (1 << (int) SCmode))
-
-/* Modes for quad-float quantities. */
-#define XF_MODES (DF_MODES | (1 << (int) XFmode) | (1 << (int) DCmode))
-
-unsigned int hard_regno_mode_ok[FIRST_PSEUDO_REGISTER] = {
- T_MODES, S_MODES, D_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES,
- T_MODES, S_MODES, D_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES,
- T_MODES, S_MODES, D_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES,
- T_MODES, S_MODES, D_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES,
-
- XF_MODES, XF_MODES, XF_MODES, XF_MODES, C_MODES};
-
-
-/* Return the minimum alignment of an expression rtx X in bytes. This takes
- advantage of machine specific facts, such as knowing that the frame pointer
- is always 16 byte aligned. */
-
-int
-i960_expr_alignment (x, size)
- rtx x;
- int size;
-{
- int align = 1;
-
- if (x == 0)
- return 1;
-
- switch (GET_CODE(x))
- {
- case CONST_INT:
- align = INTVAL(x);
-
- if ((align & 0xf) == 0)
- align = 16;
- else if ((align & 0x7) == 0)
- align = 8;
- else if ((align & 0x3) == 0)
- align = 4;
- else if ((align & 0x1) == 0)
- align = 2;
- else
- align = 1;
- break;
-
- case PLUS:
- align = MIN (i960_expr_alignment (XEXP (x, 0), size),
- i960_expr_alignment (XEXP (x, 1), size));
- break;
-
- case SYMBOL_REF:
- /* If this is a valid program, objects are guaranteed to be
- correctly aligned for whatever size the reference actually is. */
- align = i960_object_bytes_bitalign (size) / BITS_PER_UNIT;
- break;
-
- case REG:
- if (REGNO (x) == FRAME_POINTER_REGNUM)
- align = 16;
- break;
-
- case ASHIFT:
- align = i960_expr_alignment (XEXP (x, 0));
-
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- {
- align = align << INTVAL (XEXP (x, 1));
- align = MIN (align, 16);
- }
- break;
-
- case MULT:
- align = (i960_expr_alignment (XEXP (x, 0), size) *
- i960_expr_alignment (XEXP (x, 1), size));
-
- align = MIN (align, 16);
- break;
- }
-
- return align;
-}
-
-/* Return true if it is possible to reference both BASE and OFFSET, which
- have alignment at least as great as 4 byte, as if they had alignment valid
- for an object of size SIZE. */
-
-int
-i960_improve_align (base, offset, size)
- rtx base;
- rtx offset;
- int size;
-{
- int i, j;
-
- /* We have at least a word reference to the object, so we know it has to
- be aligned at least to 4 bytes. */
-
- i = MIN (i960_expr_alignment (base, 4),
- i960_expr_alignment (offset, 4));
-
- i = MAX (i, 4);
-
- /* We know the size of the request. If strict align is not enabled, we
- can guess that the alignment is OK for the requested size. */
-
- if (! TARGET_STRICT_ALIGN)
- if ((j = (i960_object_bytes_bitalign (size) / BITS_PER_UNIT)) > i)
- i = j;
-
- return (i >= size);
-}
-
-/* Return true if it is possible to access BASE and OFFSET, which have 4 byte
- (SImode) alignment as if they had 16 byte (TImode) alignment. */
-
-int
-i960_si_ti (base, offset)
- rtx base;
- rtx offset;
-{
- return i960_improve_align (base, offset, 16);
-}
-
-/* Return true if it is possible to access BASE and OFFSET, which have 4 byte
- (SImode) alignment as if they had 8 byte (DImode) alignment. */
-
-int
-i960_si_di (base, offset)
- rtx base;
- rtx offset;
-{
- return i960_improve_align (base, offset, 8);
-}
-
-/* Return raw values of size and alignment (in words) for the data
- type being accessed. These values will be rounded by the caller. */
-
-static void
-i960_arg_size_and_align (mode, type, size_out, align_out)
- enum machine_mode mode;
- tree type;
- int *size_out;
- int *align_out;
-{
- int size, align;
-
- /* Use formal alignment requirements of type being passed, except make
- it at least a word. If we don't have a type, this is a library call,
- and the parm has to be of scalar type. In this case, consider its
- formal alignment requirement to be its size in words. */
-
- if (mode == BLKmode)
- size = (int_size_in_bytes (type) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
- else if (mode == VOIDmode)
- {
- /* End of parm list. */
- assert (type != 0 && TYPE_MODE (type) == VOIDmode);
- size = 1;
- }
- else
- size = (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
-
- if (type == 0)
- {
- /* ??? This is a hack to properly correct the alignment of XFmode
- values without affecting anything else. */
- if (size == 3)
- align = 4;
- else
- align = size;
- }
- else if (TYPE_ALIGN (type) >= BITS_PER_WORD)
- align = TYPE_ALIGN (type) / BITS_PER_WORD;
- else
- align = 1;
-
- *size_out = size;
- *align_out = align;
-}
-
-/* On the 80960 the first 12 args are in registers and the rest are pushed.
- Any arg that is bigger than 4 words is placed on the stack and all
- subsequent arguments are placed on the stack.
-
- Additionally, parameters with an alignment requirement stronger than
- a word must be aligned appropriately. Note that this means that a
- 64 bit object with a 32 bit alignment is not 64 bit aligned and may be
- passed in an odd/even register pair. */
-
-/* Update CUM to advance past an argument described by MODE and TYPE. */
-
-void
-i960_function_arg_advance (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- int size, align;
-
- i960_arg_size_and_align (mode, type, &size, &align);
-
- if (size > 4 || cum->ca_nstackparms != 0
- || (size + ROUND_PARM (cum->ca_nregparms, align)) > NPARM_REGS
- || MUST_PASS_IN_STACK (mode, type))
- {
- /* Indicate that all the registers are in use, even if all are not,
- so va_start will compute the right value. */
- cum->ca_nregparms = NPARM_REGS;
- cum->ca_nstackparms = ROUND_PARM (cum->ca_nstackparms, align) + size;
- }
- else
- cum->ca_nregparms = ROUND_PARM (cum->ca_nregparms, align) + size;
-}
-
-/* Return the register that the argument described by MODE and TYPE is
- passed in, or else return 0 if it is passed on the stack. */
-
-rtx
-i960_function_arg (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- rtx ret;
- int size, align;
-
- i960_arg_size_and_align (mode, type, &size, &align);
-
- if (size > 4 || cum->ca_nstackparms != 0
- || (size + ROUND_PARM (cum->ca_nregparms, align)) > NPARM_REGS
- || MUST_PASS_IN_STACK (mode, type))
- {
- cum->ca_nstackparms = ROUND_PARM (cum->ca_nstackparms, align);
- ret = 0;
- }
- else
- {
- cum->ca_nregparms = ROUND_PARM (cum->ca_nregparms, align);
- ret = gen_rtx (REG, mode, cum->ca_nregparms);
- }
-
- return ret;
-}
-
-/* Floating-point support. */
-
-void
-i960_output_long_double (file, value)
- FILE *file;
- REAL_VALUE_TYPE value;
-{
- long value_long[3];
- char dstr[30];
-
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (value, value_long);
- REAL_VALUE_TO_DECIMAL (value, "%.20g", dstr);
-
- fprintf (file,
- "\t.word\t0x%08lx\t\t# %s\n\t.word\t0x%08lx\n\t.word\t0x%08lx\n",
- value_long[0], dstr, value_long[1], value_long[2]);
- fprintf (file, "\t.word\t0x0\n");
-}
-
-void
-i960_output_double (file, value)
- FILE *file;
- REAL_VALUE_TYPE value;
-{
- long value_long[2];
- char dstr[30];
-
- REAL_VALUE_TO_TARGET_DOUBLE (value, value_long);
- REAL_VALUE_TO_DECIMAL (value, "%.20g", dstr);
-
- fprintf (file, "\t.word\t0x%08lx\t\t# %s\n\t.word\t0x%08lx\n",
- value_long[0], dstr, value_long[1]);
-}
-
-void
-i960_output_float (file, value)
- FILE *file;
- REAL_VALUE_TYPE value;
-{
- long value_long;
- char dstr[30];
-
- REAL_VALUE_TO_TARGET_SINGLE (value, value_long);
- REAL_VALUE_TO_DECIMAL (value, "%.12g", dstr);
-
- fprintf (file, "\t.word\t0x%08lx\t\t# %s (float)\n", value_long, dstr);
-}
-
-/* Return the number of bits that an object of size N bytes is aligned to. */
-
-int
-i960_object_bytes_bitalign (n)
- int n;
-{
- if (n > 8) n = 128;
- else if (n > 4) n = 64;
- else if (n > 2) n = 32;
- else if (n > 1) n = 16;
- else n = 8;
-
- return n;
-}
-
-/* Compute the alignment for an aggregate type TSIZE.
- Alignment is MAX (greatest member alignment,
- MIN (pragma align, structure size alignment)). */
-
-int
-i960_round_align (align, tsize)
- int align;
- tree tsize;
-{
- int new_align;
-
- if (TREE_CODE (tsize) != INTEGER_CST)
- return align;
-
- new_align = i960_object_bytes_bitalign (TREE_INT_CST_LOW (tsize)
- / BITS_PER_UNIT);
- /* Handle #pragma align. */
- if (new_align > i960_maxbitalignment)
- new_align = i960_maxbitalignment;
-
- if (align < new_align)
- align = new_align;
-
- return align;
-}
-
-/* Do any needed setup for a varargs function. For the i960, we must
- create a register parameter block if one doesn't exist, and then copy
- all register parameters to memory. */
-
-void
-i960_setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int *pretend_size;
- int no_rtl;
-{
- /* Note: for a varargs fn with only a va_alist argument, this is 0. */
- int first_reg = cum->ca_nregparms;
-
- /* Copy only unnamed register arguments to memory. If there are
- any stack parms, there are no unnamed arguments in registers, and
- an argument block was already allocated by the caller.
- Remember that any arg bigger than 4 words is passed on the stack as
- are all subsequent args.
-
- If there are no stack arguments but there are exactly NPARM_REGS
- registers, either there were no extra arguments or the caller
- allocated an argument block. */
-
- if (cum->ca_nstackparms == 0 && first_reg < NPARM_REGS && !no_rtl)
- {
- rtx label = gen_label_rtx ();
- rtx regblock;
-
- /* If arg_pointer_rtx == 0, no arguments were passed on the stack
- and we need to allocate a chunk to save the registers (if any
- arguments were passed on the stack the caller would allocate the
- 48 bytes as well). We must allocate all 48 bytes (12*4) because
- va_start assumes it. */
- emit_insn (gen_cmpsi (arg_pointer_rtx, const0_rtx));
- emit_jump_insn (gen_bne (label));
- emit_insn (gen_rtx (SET, VOIDmode, arg_pointer_rtx,
- stack_pointer_rtx));
- emit_insn (gen_rtx (SET, VOIDmode, stack_pointer_rtx,
- memory_address (SImode,
- plus_constant (stack_pointer_rtx,
- 48))));
- emit_label (label);
-
- /* ??? Note that we unnecessarily store one extra register for stdarg
- fns. We could optimize this, but it's kept as for now. */
- regblock = gen_rtx (MEM, BLKmode,
- plus_constant (arg_pointer_rtx,
- first_reg * 4));
- move_block_from_reg (first_reg, regblock,
- NPARM_REGS - first_reg,
- (NPARM_REGS - first_reg) * UNITS_PER_WORD);
- }
-}
-
-/* Calculate the final size of the reg parm stack space for the current
- function, based on how many bytes would be allocated on the stack. */
-
-int
-i960_final_reg_parm_stack_space (const_size, var_size)
- int const_size;
- tree var_size;
-{
- if (var_size || const_size > 48)
- return 48;
- else
- return 0;
-}
-
-/* Calculate the size of the reg parm stack space. This is a bit complicated
- on the i960. */
-
-int
-i960_reg_parm_stack_space (fndecl)
- tree fndecl;
-{
- /* In this case, we are called from emit_library_call, and we don't need
- to pretend we have more space for parameters than what's apparent. */
- if (fndecl == 0)
- return 0;
-
- /* In this case, we are called from locate_and_pad_parms when we're
- not IN_REGS, so we have an arg block. */
- if (fndecl != current_function_decl)
- return 48;
-
- /* Otherwise, we have an arg block if the current function has more than
- 48 bytes of parameters. */
- if (current_function_args_size != 0 || VARARGS_STDARG_FUNCTION (fndecl))
- return 48;
- else
- return 0;
-}
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
- NO_REGS is returned. */
-
-enum reg_class
-secondary_reload_class (class, mode, in)
- enum reg_class class;
- enum machine_mode mode;
- rtx in;
-{
- int regno = -1;
-
- if (GET_CODE (in) == REG || GET_CODE (in) == SUBREG)
- regno = true_regnum (in);
-
- /* We can place anything into LOCAL_OR_GLOBAL_REGS and can put
- LOCAL_OR_GLOBAL_REGS into anything. */
- if (class == LOCAL_OR_GLOBAL_REGS || class == LOCAL_REGS
- || class == GLOBAL_REGS || (regno >= 0 && regno < 32))
- return NO_REGS;
-
- /* We can place any hard register, 0.0, and 1.0 into FP_REGS. */
- if (class == FP_REGS
- && ((regno >= 0 && regno < FIRST_PSEUDO_REGISTER)
- || in == CONST0_RTX (mode) || in == CONST1_RTX (mode)))
- return NO_REGS;
-
- return LOCAL_OR_GLOBAL_REGS;
-}
-
-/* Look at the opcode P, and set i96_last_insn_type to indicate which
- function unit it executed on. */
-
-/* ??? This would make more sense as an attribute. */
-
-void
-i960_scan_opcode (p)
- char *p;
-{
- switch (*p)
- {
- case 'a':
- case 'd':
- case 'e':
- case 'm':
- case 'n':
- case 'o':
- case 'r':
- /* Ret is not actually of type REG, but it won't matter, because no
- insn will ever follow it. */
- case 'u':
- case 'x':
- i960_last_insn_type = I_TYPE_REG;
- break;
-
- case 'b':
- if (p[1] == 'x' || p[3] == 'x')
- i960_last_insn_type = I_TYPE_MEM;
- i960_last_insn_type = I_TYPE_CTRL;
- break;
-
- case 'f':
- case 't':
- i960_last_insn_type = I_TYPE_CTRL;
- break;
-
- case 'c':
- if (p[1] == 'a')
- {
- if (p[4] == 'x')
- i960_last_insn_type = I_TYPE_MEM;
- else
- i960_last_insn_type = I_TYPE_CTRL;
- }
- else if (p[1] == 'm')
- {
- if (p[3] == 'd')
- i960_last_insn_type = I_TYPE_REG;
- else if (p[4] == 'b' || p[4] == 'j')
- i960_last_insn_type = I_TYPE_CTRL;
- else
- i960_last_insn_type = I_TYPE_REG;
- }
- else
- i960_last_insn_type = I_TYPE_REG;
- break;
-
- case 'l':
- i960_last_insn_type = I_TYPE_MEM;
- break;
-
- case 's':
- if (p[1] == 't')
- i960_last_insn_type = I_TYPE_MEM;
- else
- i960_last_insn_type = I_TYPE_REG;
- break;
- }
-}
diff --git a/gcc/config/i960/i960.h b/gcc/config/i960/i960.h
deleted file mode 100644
index 28d58ab7b71..00000000000
--- a/gcc/config/i960/i960.h
+++ /dev/null
@@ -1,1540 +0,0 @@
-/* Definitions of target machine for GNU compiler, for Intel 80960
- Copyright (C) 1992, 1993, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Steven McGeady, Intel Corp.
- Additional Work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson
- Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support.
-
-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. */
-
-/* Note that some other tm.h files may include this one and then override
- many of the definitions that relate to assembler syntax. */
-
-/* Names to predefine in the preprocessor for this target machine. */
-#define CPP_PREDEFINES "-Di960 -Di80960 -DI960 -DI80960 -Acpu(i960) -Amachine(i960)"
-
-/* Name to predefine in the preprocessor for processor variations. */
-#define CPP_SPEC "%{mic*:-D__i960\
- %{mka:-D__i960KA}%{mkb:-D__i960KB}\
- %{mja:-D__i960JA}%{mjd:-D__i960JD}%{mjf:-D__i960JF}\
- %{mrp:-D__i960RP}\
- %{msa:-D__i960SA}%{msb:-D__i960SB}\
- %{mmc:-D__i960MC}\
- %{mca:-D__i960CA}%{mcc:-D__i960CC}\
- %{mcf:-D__i960CF}}\
- %{mka:-D__i960KA__ -D__i960_KA__}\
- %{mkb:-D__i960KB__ -D__i960_KB__}\
- %{msa:-D__i960SA__ -D__i960_SA__}\
- %{msb:-D__i960SB__ -D__i960_SB__}\
- %{mmc:-D__i960MC__ -D__i960_MC__}\
- %{mca:-D__i960CA__ -D__i960_CA__}\
- %{mcc:-D__i960CC__ -D__i960_CC__}\
- %{mcf:-D__i960CF__ -D__i960_CF__}\
- %{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:\
- %{!mcc:%{!mcf:-D__i960_KB -D__i960KB__ %{mic*:-D__i960KB}}}}}}}}}"
-
-/* -mic* options make characters signed by default. */
-/* Use #if rather than ?: because MIPS C compiler rejects ?: in
- initializers. */
-#if DEFAULT_SIGNED_CHAR
-#define SIGNED_CHAR_SPEC "%{funsigned-char:-D__CHAR_UNSIGNED__}"
-#else
-#define SIGNED_CHAR_SPEC "%{!fsigned-char:%{!mic*:-D__CHAR_UNSIGNED__}}"
-#endif
-
-/* Specs for the compiler, to handle processor variations.
- If the user gives an explicit -gstabs or -gcoff option, then do not
- try to add an implicit one, as this will fail. */
-#define CC1_SPEC \
- "%{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:%{!mcc:%{!mcf:%{!mja:%{!mjd:%{!mjf:%{!mrp:-mka}}}}}}}}}}}}\
- %{!gs*:%{!gc*:%{mbout:%{g*:-gstabs}}\
- %{mcoff:%{g*:-gcoff}}\
- %{!mbout:%{!mcoff:%{g*:-gstabs}}}}}"
-
-/* Specs for the assembler, to handle processor variations.
- For compatibility with Intel's gnu960 tool chain, pass -A options to
- the assembler. */
-#define ASM_SPEC \
- "%{mka:-AKA}%{mkb:-AKB}%{msa:-ASA}%{msb:-ASB}\
- %{mmc:-AMC}%{mca:-ACA}%{mcc:-ACC}%{mcf:-ACF}\
- %{mja:-AJX}%{mjd:-AJX}%{mjf:-AJX}%{mrp:-AJX}\
- %{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:%{!mcc:%{!mcf:%{!mja:%{!mjd:%{!mjf:%{!mrp:-AKB}}}}}}}}}}}}\
- %{mlink-relax:-linkrelax}"
-
-/* Specs for the linker, to handle processor variations.
- For compatibility with Intel's gnu960 tool chain, pass -F and -A options
- to the linker. */
-#define LINK_SPEC \
- "%{mka:-AKA}%{mkb:-AKB}%{msa:-ASA}%{msb:-ASB}\
- %{mmc:-AMC}%{mca:-ACA}%{mcc:-ACC}%{mcf:-ACF}\
- %{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:%{!mcc:%{!mcf:-AKB}}}}}}}}\
- %{mbout:-Fbout}%{mcoff:-Fcoff}\
- %{mlink-relax:-relax}"
-
-/* Specs for the libraries to link with, to handle processor variations.
- Compatible with Intel's gnu960 tool chain. */
-#define LIB_SPEC "%{!nostdlib:-lcg %{p:-lprof}%{pg:-lgprof}\
- %{mka:-lfpg}%{msa:-lfpg}%{mca:-lfpg}%{mcf:-lfpg} -lgnu}"
-
-/* Show we can debug even without a frame pointer. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* Do leaf procedure and tail call optimizations for -O2 and higher. */
-#define OPTIMIZATION_OPTIONS(LEVEL) \
-{ \
- if ((LEVEL) >= 2) \
- { \
- target_flags |= TARGET_FLAG_LEAFPROC; \
- target_flags |= TARGET_FLAG_TAILCALL; \
- } \
-}
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION fprintf (stderr," (intel 80960)");
-
-/* Generate DBX debugging information. */
-#define DBX_DEBUGGING_INFO
-
-/* Generate SDB style debugging information. */
-#define SDB_DEBUGGING_INFO
-#define EXTENDED_SDB_BASIC_TYPES
-
-/* Generate DBX_DEBUGGING_INFO by default. */
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* Redefine this to print in hex. No value adjustment is necessary
- anymore. */
-#define PUT_SDB_TYPE(A) \
- fprintf (asm_out_file, "\t.type\t0x%x;", A)
-
-/* Handle pragmas for compatibility with Intel's compilers. */
-#define HANDLE_PRAGMA(FILE, NODE) process_pragma (FILE, NODE)
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-/* 960 architecture with floating-point. */
-#define TARGET_FLAG_NUMERICS 0x01
-#define TARGET_NUMERICS (target_flags & TARGET_FLAG_NUMERICS)
-
-/* 960 architecture with memory management. */
-/* ??? Not used currently. */
-#define TARGET_FLAG_PROTECTED 0x02
-#define TARGET_PROTECTED (target_flags & TARGET_FLAG_PROTECTED)
-
-/* The following three are mainly used to provide a little sanity checking
- against the -mARCH flags given. The Jx series, for the purposes of
- gcc, is a Kx with a data cache. */
-
-/* Nonzero if we should generate code for the KA and similar processors.
- No FPU, no microcode instructions. */
-#define TARGET_FLAG_K_SERIES 0x04
-#define TARGET_K_SERIES (target_flags & TARGET_FLAG_K_SERIES)
-
-/* Nonzero if we should generate code for the MC processor.
- Not really different from KB for our purposes. */
-#define TARGET_FLAG_MC 0x08
-#define TARGET_MC (target_flags & TARGET_FLAG_MC)
-
-/* Nonzero if we should generate code for the CA processor.
- Enables different optimization strategies. */
-#define TARGET_FLAG_C_SERIES 0x10
-#define TARGET_C_SERIES (target_flags & TARGET_FLAG_C_SERIES)
-
-/* Nonzero if we should generate leaf-procedures when we find them.
- You may not want to do this because leaf-proc entries are
- slower when not entered via BAL - this would be true when
- a linker not supporting the optimization is used. */
-#define TARGET_FLAG_LEAFPROC 0x20
-#define TARGET_LEAFPROC (target_flags & TARGET_FLAG_LEAFPROC)
-
-/* Nonzero if we should perform tail-call optimizations when we find them.
- You may not want to do this because the detection of cases where
- this is not valid is not totally complete. */
-#define TARGET_FLAG_TAILCALL 0x40
-#define TARGET_TAILCALL (target_flags & TARGET_FLAG_TAILCALL)
-
-/* Nonzero if use of a complex addressing mode is a win on this implementation.
- Complex addressing modes are probably not worthwhile on the K-series,
- but they definitely are on the C-series. */
-#define TARGET_FLAG_COMPLEX_ADDR 0x80
-#define TARGET_COMPLEX_ADDR (target_flags & TARGET_FLAG_COMPLEX_ADDR)
-
-/* Align code to 8 byte boundaries for faster fetching. */
-#define TARGET_FLAG_CODE_ALIGN 0x100
-#define TARGET_CODE_ALIGN (target_flags & TARGET_FLAG_CODE_ALIGN)
-
-/* Append branch prediction suffixes to branch opcodes. */
-/* ??? Not used currently. */
-#define TARGET_FLAG_BRANCH_PREDICT 0x200
-#define TARGET_BRANCH_PREDICT (target_flags & TARGET_FLAG_BRANCH_PREDICT)
-
-/* Forces prototype and return promotions. */
-/* ??? This does not work. */
-#define TARGET_FLAG_CLEAN_LINKAGE 0x400
-#define TARGET_CLEAN_LINKAGE (target_flags & TARGET_FLAG_CLEAN_LINKAGE)
-
-/* For compatibility with iC960 v3.0. */
-#define TARGET_FLAG_IC_COMPAT3_0 0x800
-#define TARGET_IC_COMPAT3_0 (target_flags & TARGET_FLAG_IC_COMPAT3_0)
-
-/* For compatibility with iC960 v2.0. */
-#define TARGET_FLAG_IC_COMPAT2_0 0x1000
-#define TARGET_IC_COMPAT2_0 (target_flags & TARGET_FLAG_IC_COMPAT2_0)
-
-/* If no unaligned accesses are to be permitted. */
-#define TARGET_FLAG_STRICT_ALIGN 0x2000
-#define TARGET_STRICT_ALIGN (target_flags & TARGET_FLAG_STRICT_ALIGN)
-
-/* For compatibility with iC960 assembler. */
-#define TARGET_FLAG_ASM_COMPAT 0x4000
-#define TARGET_ASM_COMPAT (target_flags & TARGET_FLAG_ASM_COMPAT)
-
-/* For compatibility with the gcc960 v1.2 compiler. Use the old structure
- alignment rules. Also, turns on STRICT_ALIGNMENT. */
-#define TARGET_FLAG_OLD_ALIGN 0x8000
-#define TARGET_OLD_ALIGN (target_flags & TARGET_FLAG_OLD_ALIGN)
-
-extern int target_flags;
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-/* ??? Not all ten of these architecture variations actually exist, but I
- am not sure which are real and which aren't. */
-
-#define TARGET_SWITCHES \
- { {"sa", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR)},\
- {"sb", (TARGET_FLAG_NUMERICS|TARGET_FLAG_K_SERIES| \
- TARGET_FLAG_COMPLEX_ADDR)},\
-/* {"sc", (TARGET_FLAG_NUMERICS|TARGET_FLAG_PROTECTED|\
- TARGET_FLAG_MC|TARGET_FLAG_COMPLEX_ADDR)},*/ \
- {"ka", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR)},\
- {"kb", (TARGET_FLAG_NUMERICS|TARGET_FLAG_K_SERIES| \
- TARGET_FLAG_COMPLEX_ADDR)},\
-/* {"kc", (TARGET_FLAG_NUMERICS|TARGET_FLAG_PROTECTED|\
- TARGET_FLAG_MC|TARGET_FLAG_COMPLEX_ADDR)},*/ \
- {"ja", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR)},\
- {"jd", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR)},\
- {"jf", (TARGET_FLAG_NUMERICS|TARGET_FLAG_K_SERIES| \
- TARGET_FLAG_COMPLEX_ADDR)},\
- {"rp", (TARGET_FLAG_K_SERIES|TARGET_FLAG_COMPLEX_ADDR)},\
- {"mc", (TARGET_FLAG_NUMERICS|TARGET_FLAG_PROTECTED|\
- TARGET_FLAG_MC|TARGET_FLAG_COMPLEX_ADDR)},\
- {"ca", (TARGET_FLAG_C_SERIES|TARGET_FLAG_BRANCH_PREDICT|\
- TARGET_FLAG_CODE_ALIGN|TARGET_FLAG_COMPLEX_ADDR)},\
-/* {"cb", (TARGET_FLAG_NUMERICS|TARGET_FLAG_C_SERIES|\
- TARGET_FLAG_BRANCH_PREDICT|TARGET_FLAG_CODE_ALIGN)},\
- {"cc", (TARGET_FLAG_NUMERICS|TARGET_FLAG_PROTECTED|\
- TARGET_FLAG_C_SERIES|TARGET_FLAG_BRANCH_PREDICT|\
- TARGET_FLAG_CODE_ALIGN)}, */ \
- {"cf", (TARGET_FLAG_C_SERIES|TARGET_FLAG_BRANCH_PREDICT|\
- TARGET_FLAG_CODE_ALIGN|TARGET_FLAG_COMPLEX_ADDR)},\
- {"numerics", (TARGET_FLAG_NUMERICS)}, \
- {"soft-float", -(TARGET_FLAG_NUMERICS)}, \
- {"leaf-procedures", TARGET_FLAG_LEAFPROC}, \
- {"no-leaf-procedures",-(TARGET_FLAG_LEAFPROC)}, \
- {"tail-call",TARGET_FLAG_TAILCALL}, \
- {"no-tail-call",-(TARGET_FLAG_TAILCALL)}, \
- {"complex-addr",TARGET_FLAG_COMPLEX_ADDR}, \
- {"no-complex-addr",-(TARGET_FLAG_COMPLEX_ADDR)}, \
- {"code-align",TARGET_FLAG_CODE_ALIGN}, \
- {"no-code-align",-(TARGET_FLAG_CODE_ALIGN)}, \
- {"clean-linkage", (TARGET_FLAG_CLEAN_LINKAGE)}, \
- {"no-clean-linkage", -(TARGET_FLAG_CLEAN_LINKAGE)}, \
- {"ic-compat", TARGET_FLAG_IC_COMPAT2_0}, \
- {"ic2.0-compat", TARGET_FLAG_IC_COMPAT2_0}, \
- {"ic3.0-compat", TARGET_FLAG_IC_COMPAT3_0}, \
- {"asm-compat",TARGET_FLAG_ASM_COMPAT}, \
- {"intel-asm",TARGET_FLAG_ASM_COMPAT}, \
- {"strict-align", TARGET_FLAG_STRICT_ALIGN}, \
- {"no-strict-align", -(TARGET_FLAG_STRICT_ALIGN)}, \
- {"old-align", (TARGET_FLAG_OLD_ALIGN|TARGET_FLAG_STRICT_ALIGN)}, \
- {"no-old-align", -(TARGET_FLAG_OLD_ALIGN|TARGET_FLAG_STRICT_ALIGN)}, \
- {"link-relax", 0}, \
- {"no-link-relax", 0}, \
- { "", TARGET_DEFAULT}}
-
-/* Override conflicting target switch options.
- Doesn't actually detect if more than one -mARCH option is given, but
- does handle the case of two blatantly conflicting -mARCH options. */
-#define OVERRIDE_OPTIONS \
-{ \
- if (TARGET_K_SERIES && TARGET_C_SERIES) \
- { \
- warning ("conflicting architectures defined - using C series", 0); \
- target_flags &= ~TARGET_FLAG_K_SERIES; \
- } \
- if (TARGET_K_SERIES && TARGET_MC) \
- { \
- warning ("conflicting architectures defined - using K series", 0); \
- target_flags &= ~TARGET_FLAG_MC; \
- } \
- if (TARGET_C_SERIES && TARGET_MC) \
- { \
- warning ("conflicting architectures defined - using C series", 0);\
- target_flags &= ~TARGET_FLAG_MC; \
- } \
- if (TARGET_IC_COMPAT3_0) \
- { \
- flag_short_enums = 1; \
- flag_signed_char = 1; \
- target_flags |= TARGET_FLAG_CLEAN_LINKAGE; \
- if (TARGET_IC_COMPAT2_0) \
- { \
- warning ("iC2.0 and iC3.0 are incompatible - using iC3.0", 0); \
- target_flags &= ~TARGET_FLAG_IC_COMPAT2_0; \
- } \
- } \
- if (TARGET_IC_COMPAT2_0) \
- { \
- flag_signed_char = 1; \
- target_flags |= TARGET_FLAG_CLEAN_LINKAGE; \
- } \
- i960_initialize (); \
-}
-
-/* Don't enable anything by default. The user is expected to supply a -mARCH
- option. If none is given, then -mka is added by CC1_SPEC. */
-#define TARGET_DEFAULT 0
-
-/* Target machine storage layout. */
-
-/* Define for cross-compilation from a host with a different float format
- or endianness, as well as to support 80 bit long doubles on the i960. */
-#define REAL_ARITHMETIC
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered.
- The i960 case be either big endian or little endian. We only support
- little endian, which is the most common. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is lowest
- numbered. */
-#define WORDS_BIG_ENDIAN 0
-
-/* Number of bits in an addressable storage unit. */
-#define BITS_PER_UNIT 8
-
-/* Bitfields cannot cross word boundaries. */
-#define BITFIELD_NBYTES_LIMITED 1
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer. See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Width in bits of a long double. Identical to double for now. */
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Allocation boundary (in *bits*) for storing pointers in memory. */
-#define POINTER_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 128
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 128
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* This makes zero-length anonymous fields lay the next field
- at a word boundary. It also makes the whole struct have
- at least word alignment if there are any bitfields at all. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* No data type wants to be aligned rounder than this.
- Extended precision floats gets 4-word alignment. */
-#define BIGGEST_ALIGNMENT 128
-
-/* Define this if move instructions will actually fail to work
- when given unaligned data.
- 80960 will work even with unaligned data, but it is slow. */
-#define STRICT_ALIGNMENT TARGET_STRICT_ALIGN
-
-/* Specify alignment for string literals (which might be higher than the
- base type's minimal alignment requirement. This allows strings to be
- aligned on word boundaries, and optimizes calls to the str* and mem*
- library functions. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- (TREE_CODE (EXP) == STRING_CST \
- && i960_object_bytes_bitalign (int_size_in_bytes (TREE_TYPE (EXP))) > (ALIGN) \
- ? i960_object_bytes_bitalign (int_size_in_bytes (TREE_TYPE (EXP))) \
- : (ALIGN))
-
-/* Make XFmode floating point quantities be 128 bit aligned. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == XFmode \
- && (ALIGN) < 128 ? 128 : (ALIGN))
-
-/* Macros to determine size of aggregates (structures and unions
- in C). Normally, these may be defined to simply return the maximum
- alignment and simple rounded-up size, but on some machines (like
- the i960), the total size of a structure is based on a non-trivial
- rounding method. */
-
-#define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \
- ((TREE_CODE (TYPE) == REAL_TYPE && TYPE_MODE (TYPE) == XFmode) \
- ? 128 /* Put 80 bit floating point elements on 128 bit boundaries. */ \
- : ((!TARGET_OLD_ALIGN && !TYPE_PACKED (TYPE) \
- && TREE_CODE (TYPE) == RECORD_TYPE) \
- ? i960_round_align (MAX ((COMPUTED), (SPECIFIED)), TYPE_SIZE (TYPE)) \
- : MAX ((COMPUTED), (SPECIFIED))))
-
-#define ROUND_TYPE_SIZE(TYPE, COMPUTED, SPECIFIED) \
- ((TREE_CODE (TYPE) == REAL_TYPE && TYPE_MODE (TYPE) == XFmode) \
- ? build_int_2 (128, 0) : round_up (COMPUTED, SPECIFIED))
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- Registers 0-15 are the global registers (g0-g15).
- Registers 16-31 are the local registers (r0-r15).
- Register 32-35 are the fp registers (fp0-fp3).
- Register 36 is the condition code register.
- Register 37 is unused. */
-
-#define FIRST_PSEUDO_REGISTER 38
-
-/* 1 for registers that have pervasive standard uses and are not available
- for the register allocator. On 80960, this includes the frame pointer
- (g15), the previous FP (r0), the stack pointer (r1), the return
- instruction pointer (r2), and the argument pointer (g14). */
-#define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 1, 1, \
- 1, 1, 1, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 1, 1}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-
-/* On the 80960, note that:
- g0..g3 are used for return values,
- g0..g7 may always be used for parameters,
- g8..g11 may be used for parameters, but are preserved if they aren't,
- g12 is always preserved, but otherwise unused,
- g13 is the struct return ptr if used, or temp, but may be trashed,
- g14 is the leaf return ptr or the arg block ptr otherwise zero,
- must be reset to zero before returning if it was used,
- g15 is the frame pointer,
- r0 is the previous FP,
- r1 is the stack pointer,
- r2 is the return instruction pointer,
- r3-r15 are always available,
- r3 is clobbered by calls in functions that use the arg pointer
- r4-r11 may be clobbered by the mcount call when profiling
- r4-r15 if otherwise unused may be used for preserving global registers
- fp0..fp3 are never available. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 1, 1, 1, \
- 1, 1, 1, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1}
-
-/* If no fp unit, make all of the fp registers fixed so that they can't
- be used. */
-#define CONDITIONAL_REGISTER_USAGE \
- if (! TARGET_NUMERICS) { \
- fixed_regs[32] = fixed_regs[33] = fixed_regs[34] = fixed_regs[35] = 1;\
- } \
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On 80960, ordinary registers hold 32 bits worth, but can be ganged
- together to hold double or extended precision floating point numbers,
- and the floating point registers hold any size floating point number */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((REGNO) < 32 \
- ? (((MODE) == VOIDmode) \
- ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)) \
- : ((REGNO) < FIRST_PSEUDO_REGISTER) ? 1 : 0)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On 80960, the cpu registers can hold any mode but the float registers
- can only hold SFmode, DFmode, or XFmode. */
-extern unsigned int hard_regno_mode_ok[FIRST_PSEUDO_REGISTER];
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((hard_regno_mode_ok[REGNO] & (1 << (int) (MODE))) != 0)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- ((MODE1) == (MODE2) || GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* 80960 pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 17
-
-/* Actual top-of-stack address is same as
- the contents of the stack pointer register. */
-#define STACK_POINTER_OFFSET (-current_function_outgoing_args_size)
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 15
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-/* ??? It isn't clear to me why this is here. Perhaps because of a bug (since
- fixed) in the definition of INITIAL_FRAME_POINTER_OFFSET which would have
- caused this to fail. */
-#define FRAME_POINTER_REQUIRED (! leaf_function_p ())
-
-/* C statement to store the difference between the frame pointer
- and the stack pointer values immediately after the function prologue.
-
- Since the stack grows upward on the i960, this must be a negative number.
- This includes the 64 byte hardware register save area and the size of
- the frame. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
- do { (VAR) = - (64 + compute_frame_size (get_frame_size ())); } while (0)
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 14
-
-/* Register in which static-chain is passed to a function.
- On i960, we use r3. */
-#define STATIC_CHAIN_REGNUM 19
-
-/* Functions which return large structures get the address
- to place the wanted value at in g13. */
-
-#define STRUCT_VALUE_REGNUM 13
-
-/* The order in which to allocate registers. */
-
-#define REG_ALLOC_ORDER \
-{ 4, 5, 6, 7, 0, 1, 2, 3, 13, /* g4, g5, g6, g7, g0, g1, g2, g3, g13 */ \
- 20, 21, 22, 23, 24, 25, 26, 27,/* r4, r5, r6, r7, r8, r9, r10, r11 */ \
- 28, 29, 30, 31, 19, 8, 9, 10, /* r12, r13, r14, r15, r3, g8, g9, g10 */ \
- 11, 12, /* g11, g12 */ \
- 32, 33, 34, 35, /* fp0, fp1, fp2, fp3 */ \
- /* We can't actually allocate these. */ \
- 16, 17, 18, 14, 15, 36, 37} /* r0, r1, r2, g14, g15, cc */
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The 80960 has four kinds of registers, global, local, floating point,
- and condition code. The cc register is never allocated, so no class
- needs to be defined for it. */
-
-enum reg_class { NO_REGS, GLOBAL_REGS, LOCAL_REGS, LOCAL_OR_GLOBAL_REGS,
- FP_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-/* 'r' includes floating point registers if TARGET_NUMERICS. 'd' never
- does. */
-#define GENERAL_REGS ((TARGET_NUMERICS) ? ALL_REGS : LOCAL_OR_GLOBAL_REGS)
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
-{ "NO_REGS", "GLOBAL_REGS", "LOCAL_REGS", "LOCAL_OR_GLOBAL_REGS", \
- "FP_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ {0, 0}, {0x0ffff, 0}, {0xffff0000, 0}, {-1,0}, {0, -1}, {-1,-1}}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) < 16 ? GLOBAL_REGS \
- : (REGNO) < 32 ? LOCAL_REGS \
- : (REGNO) < 36 ? FP_REGS \
- : NO_REGS)
-
-/* The class value for index registers, and the one for base regs.
- There is currently no difference between base and index registers on the
- i960, but this distinction may one day be useful. */
-#define INDEX_REG_CLASS LOCAL_OR_GLOBAL_REGS
-#define BASE_REG_CLASS LOCAL_OR_GLOBAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description.
- 'f' is a floating point register (fp0..fp3)
- 'l' is a local register (r0-r15)
- 'b' is a global register (g0-g15)
- 'd' is any local or global register
- 'r' or 'g' are pre-defined to the class GENERAL_REGS. */
-/* 'l' and 'b' are probably never used. Note that 'd' and 'r' are *not*
- the same thing, since 'r' may include the fp registers. */
-#define REG_CLASS_FROM_LETTER(C) \
- (((C) == 'f') && (TARGET_NUMERICS) ? FP_REGS : ((C) == 'l' ? LOCAL_REGS : \
- (C) == 'b' ? GLOBAL_REGS : ((C) == 'd' ? LOCAL_OR_GLOBAL_REGS : NO_REGS)))
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For 80960:
- 'I' is used for literal values 0..31
- 'J' means literal 0
- 'K' means 0..-31. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (((unsigned) (VALUE)) <= 31) \
- : (C) == 'J' ? ((VALUE) == 0) \
- : (C) == 'K' ? ((VALUE) >= -31 && (VALUE) <= 0) \
- : (C) == 'M' ? ((VALUE) >= -32 && (VALUE) <= 0) \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself.
- For the 80960, G is 0.0 and H is 1.0. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((TARGET_NUMERICS) && \
- (((C) == 'G' && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
- || ((C) == 'H' && ((VALUE) == CONST1_RTX (GET_MODE (VALUE))))))
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-/* On 960, can't load constant into floating-point reg except
- 0.0 or 1.0.
-
- Any hard reg is ok as a src operand of a reload insn. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- (GET_CODE (X) == REG && REGNO (X) < FIRST_PSEUDO_REGISTER \
- ? (CLASS) \
- : ((CLASS) == FP_REGS && CONSTANT_P (X) \
- && (X) != CONST0_RTX (DFmode) && (X) != CONST1_RTX (DFmode)\
- && (X) != CONST0_RTX (SFmode) && (X) != CONST1_RTX (SFmode)\
- ? NO_REGS \
- : (CLASS) == ALL_REGS ? LOCAL_OR_GLOBAL_REGS : (CLASS)))
-
-#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
- secondary_reload_class (CLASS, MODE, IN)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On 80960, this is the size of MODE in words,
- except in the FP regs, where a single reg is always enough. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FP_REGS ? 1 : HARD_REGNO_NREGS (0, (MODE)))
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-/* #define STACK_GROWS_DOWNWARD */
-
-/* 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
- goes at a more negative offset in the frame. */
-/* #define FRAME_GROWS_DOWNWARD */
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated.
-
- The i960 has a 64 byte register save area, plus possibly some extra
- bytes allocated for varargs functions. */
-#define STARTING_FRAME_OFFSET 64
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On 80960, don't define this because there are no push insns. */
-/* #define PUSH_ROUNDING(BYTES) BYTES */
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* When a parameter is passed in a register, no stack space is
- allocated for it. However, when args are passed in the
- stack, space is allocated for every register parameter. */
-#define MAYBE_REG_PARM_STACK_SPACE 48
-#define FINAL_REG_PARM_STACK_SPACE(CONST_SIZE, VAR_SIZE) \
- i960_final_reg_parm_stack_space (CONST_SIZE, VAR_SIZE);
-#define REG_PARM_STACK_SPACE(DECL) i960_reg_parm_stack_space (DECL)
-#define OUTGOING_REG_PARM_STACK_SPACE
-
-/* Keep the stack pointer constant throughout the function. */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Value is 1 if returning from a function call automatically
- pops the arguments described by the number-of-args field in the call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx ((REG), (MODE), 0)
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller.
- On 80960, returns are in g0..g3 */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* 1 if N is a possible register number for function argument passing.
- On 80960, parameters are passed in g0..g11 */
-
-#define FUNCTION_ARG_REGNO_P(N) ((N) < 12)
-
-/* Perform any needed actions needed for a function that is receiving a
- variable number of arguments.
-
- CUM is as above.
-
- MODE and TYPE are the mode and type of the current parameter.
-
- PRETEND_SIZE is a variable that should be set to the amount of stack
- that must be pushed by the prolog to pretend that our caller pushed
- it.
-
- Normally, this macro will push all remaining incoming registers on the
- stack and set PRETEND_SIZE to the length of the registers pushed. */
-
-#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
- i960_setup_incoming_varargs(&CUM,MODE,TYPE,&PRETEND_SIZE,NO_RTL)
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On 80960, this is two integers, which count the number of register
- parameters and the number of stack parameters seen so far. */
-
-struct cum_args { int ca_nregparms; int ca_nstackparms; };
-
-#define CUMULATIVE_ARGS struct cum_args
-
-/* Define the number of registers that can hold parameters.
- This macro is used only in macro definitions below and/or i960.c. */
-#define NPARM_REGS 12
-
-/* Define how to round to the next parameter boundary.
- This macro is used only in macro definitions below and/or i960.c. */
-#define ROUND_PARM(X, MULTIPLE_OF) \
- ((((X) + (MULTIPLE_OF) - 1) / (MULTIPLE_OF)) * MULTIPLE_OF)
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On 80960, the offset always starts at 0; the first parm reg is g0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM).ca_nregparms = 0, (CUM).ca_nstackparms = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- CUM should be advanced to align with the data type accessed and
- also the size of that data type in # of regs.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- i960_function_arg_advance(&CUM, MODE, TYPE, NAMED)
-
-/* Indicate the alignment boundary for an argument of the specified mode and
- type. */
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
- (((TYPE) != 0) \
- ? ((TYPE_ALIGN (TYPE) <= PARM_BOUNDARY) \
- ? PARM_BOUNDARY \
- : TYPE_ALIGN (TYPE)) \
- : ((GET_MODE_ALIGNMENT (MODE) <= PARM_BOUNDARY) \
- ? PARM_BOUNDARY \
- : GET_MODE_ALIGNMENT (MODE)))
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-extern struct rtx_def *i960_function_arg ();
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- i960_function_arg(&CUM, MODE, TYPE, NAMED)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-#define FUNCTION_VALUE(TYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (TYPE), 0)
-
-/* Force aggregates and objects larger than 16 bytes to be returned in memory,
- since we only have 4 registers available for return values. */
-
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE (TYPE) == BLKmode || int_size_in_bytes (TYPE) > 16)
-
-/* Don't default to pcc-struct-return, because we have already specified
- exactly how to return structures in the RETURN_IN_MEMORY macro. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- This never happens on 80960. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
-
-/* Output the label for a function definition.
- This handles leaf functions and a few other things for the i960. */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- i960_function_name_declare (FILE, NAME, DECL)
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) i960_function_prologue ((FILE), (SIZE))
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- output_function_profiler ((FILE), (LABELNO));
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) i960_function_epilogue (FILE, SIZE)
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
- ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
-#define REGNO_OK_FOR_BASE_P(REGNO) \
- ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
-#define REGNO_OK_FOR_FP_P(REGNO) \
- ((REGNO) < 36 || (unsigned) reg_renumber[REGNO] < 36)
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-
- These macros are specific to the 960, and may be used only
- in code for printing assembler insns and in conditions for
- define_optimization. */
-
-/* 1 if X is an fp register. */
-
-#define FP_REG_P(X) (REGNO (X) >= 32 && REGNO (X) < 36)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-#define MAX_REGS_PER_ADDRESS 2
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* LEGITIMATE_CONSTANT_P is nonzero if the constant value X
- is a legitimate general operand.
- It is given that X satisfies CONSTANT_P.
-
- Anything but a CONST_DOUBLE can be made to work, excepting 0.0 and 1.0.
-
- ??? This probably should be defined to 1. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- ((GET_CODE (X) != CONST_DOUBLE) || fp_literal ((X), GET_MODE (X)))
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) \
- (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-#define REG_OK_FOR_INDEX_P_STRICT(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-#define REG_OK_FOR_BASE_P_STRICT(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On 80960, legitimate addresses are:
- base ld (g0),r0
- disp (12 or 32 bit) ld foo,r0
- base + index ld (g0)[g1*1],r0
- base + displ ld 0xf00(g0),r0
- base + index*scale + displ ld 0xf00(g0)[g1*4],r0
- index*scale + base ld (g0)[g1*4],r0
- index*scale + displ ld 0xf00[g1*4],r0
- index*scale ld [g1*4],r0
- index + base + displ ld 0xf00(g0)[g1*1],r0
-
- In each case, scale can be 1, 2, 4, 8, or 16. */
-
-/* Returns 1 if the scale factor of an index term is valid. */
-#define SCALE_TERM_P(X) \
- (GET_CODE (X) == CONST_INT \
- && (INTVAL (X) == 1 || INTVAL (X) == 2 || INTVAL (X) == 4 \
- || INTVAL(X) == 8 || INTVAL (X) == 16))
-
-
-#ifdef REG_OK_STRICT
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
- { if (legitimate_address_p (MODE, X, 1)) goto ADDR; }
-#else
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
- { if (legitimate_address_p (MODE, X, 0)) goto ADDR; }
-#endif
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-/* On 80960, convert non-canonical addresses to canonical form. */
-
-extern struct rtx_def *legitimize_address ();
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-{ rtx orig_x = (X); \
- (X) = legitimize_address (X, OLDX, MODE); \
- if ((X) != orig_x && memory_address_p (MODE, X)) \
- goto WIN; }
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the 960 this is never true. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 0
-
-/* Allow and ignore #sccs directives. */
-#define SCCS_DIRECTIVE
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 16
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-
-/* Nonzero if access to memory by bytes is no faster than for words.
- Defining this results in worse code on the i960. */
-
-#define SLOW_BYTE_ACCESS 0
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE 1
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 0
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* Specify the widest mode that BLKmode objects can be promoted to */
-#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode)
-
-/* These global variables are used to pass information between
- cc setter and cc user at insn emit time. */
-
-extern struct rtx_def *i960_compare_op0, *i960_compare_op1;
-
-/* Define the function that build the compare insn for scc and bcc. */
-
-extern struct rtx_def *gen_compare_reg ();
-
-/* Add any extra modes needed to represent the condition code.
-
- Also, signed and unsigned comparisons are distinguished, as
- are operations which are compatible with chkbit insns. */
-#define EXTRA_CC_MODES CC_UNSmode, CC_CHKmode
-
-/* Define the names for the modes specified above. */
-#define EXTRA_CC_NAMES "CC_UNS", "CC_CHK"
-
-/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
- return the mode to be used for the comparison. For floating-point, CCFPmode
- should be used. CC_NOOVmode should be used when the first operand is a
- PLUS, MINUS, or NEG. CCmode should be used when no special processing is
- needed. */
-#define SELECT_CC_MODE(OP,X,Y) select_cc_mode (OP, X)
-
-/* A function address in a call instruction is a byte address
- (for indexing purposes) so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE SImode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-#define NO_FUNCTION_CSE
-
-/* Use memcpy, etc. instead of bcopy. */
-
-#ifndef WIND_RIVER
-#define TARGET_MEM_FUNCTIONS 1
-#endif
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-/* Constants that can be (non-ldconst) insn operands are cost 0. Constants
- that can be non-ldconst operands in rare cases are cost 1. Other constants
- have higher costs. */
-
-#define CONST_COSTS(RTX, CODE, OUTER_CODE) \
- case CONST_INT: \
- if ((INTVAL (RTX) >= 0 && INTVAL (RTX) < 32) \
- || power2_operand (RTX, VOIDmode)) \
- return 0; \
- else if (INTVAL (RTX) >= -31 && INTVAL (RTX) < 0) \
- return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return (TARGET_FLAG_C_SERIES ? 6 : 8); \
- case CONST_DOUBLE: \
- if ((RTX) == CONST0_RTX (DFmode) || (RTX) == CONST0_RTX (SFmode) \
- || (RTX) == CONST1_RTX (DFmode) || (RTX) == CONST1_RTX (SFmode))\
- return 1; \
- return 12;
-
-/* The i960 offers addressing modes which are "as cheap as a register".
- See i960.c (or gcc.texinfo) for details. */
-
-#define ADDRESS_COST(RTX) \
- (GET_CODE (RTX) == REG ? 1 : i960_address_cost (RTX))
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(file)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES { \
- "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
- "g8", "g9", "g10", "g11", "g12", "g13", "g14", "fp", \
- "pfp","sp", "rip", "r3", "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
- "fp0","fp1","fp2", "fp3", "cc", "fake" }
-
-/* How to renumber registers for dbx and gdb.
- In the 960 encoding, g0..g15 are registers 16..31. */
-
-#define DBX_REGISTER_NUMBER(REGNO) \
- (((REGNO) < 16) ? (REGNO) + 16 \
- : (((REGNO) > 31) ? (REGNO) : (REGNO) - 16))
-
-/* Don't emit dbx records longer than this. This is an arbitrary value. */
-#define DBX_CONTIN_LENGTH 1500
-
-/* This is how to output a note to DBX telling it the line number
- to which the following sequence of instructions corresponds. */
-
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
-{ if (write_symbols == SDB_DEBUG) { \
- fprintf ((FILE), "\t.ln %d\n", \
- (sdb_begin_function_line \
- ? (LINE) - sdb_begin_function_line : 1)); \
- } else if (write_symbols == DBX_DEBUG) { \
- fprintf((FILE),"\t.stabd 68,0,%d\n",(LINE)); \
- } }
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
-{ fputs ("\t.globl ", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); }
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `long double'
- constant. */
-
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) i960_output_long_double(FILE, VALUE)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) i960_output_double(FILE, VALUE)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) i960_output_float(FILE, VALUE)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.short "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tst\t%s,(sp)\n\taddo\t4,sp,sp\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tsubo\t4,sp,sp\n\tld\t(sp),%s\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.word L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line that says to advance the
- location counter to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf (FILE, "\t.align %d\n", (LOG))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-/* For common objects, output unpadded size... gld960 & lnk960 both
- have code to align each common object at link time. Also, if size
- is 0, treat this as a declaration, not a definition - i.e.,
- do nothing at all. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-{ if ((SIZE) != 0) \
- { \
- fputs (".globl ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fputs ("\n.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)); \
- } \
-}
-
-/* This says how to output an assembler line to define a local common symbol.
- Output unpadded size, with request to linker to align as requested.
- 0 size should not be possible here. */
-
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-( fputs (".bss\t", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d,%d\n", (SIZE), \
- ((ALIGN) <= 8 ? 0 \
- : ((ALIGN) <= 16 ? 1 \
- : ((ALIGN) <= 32 ? 2 \
- : ((ALIGN <= 64 ? 3 : 4)))))))
-
-/* Output text for an #ident directive. */
-#define ASM_OUTPUT_IDENT(FILE, STR) fprintf(FILE, "\t# %s\n", STR);
-
-/* Align code to 8 byte boundary if TARGET_CODE_ALIGN is true. */
-
-#define ASM_OUTPUT_ALIGN_CODE(FILE) \
-{ if (TARGET_CODE_ALIGN) fputs("\t.align 3\n",FILE); }
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
- ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
-{ fprintf (FILE, "\tld LPBX0,g12\n"); \
- fprintf (FILE, "\tcmpobne 0,g12,LPY%d\n",LABELNO);\
- fprintf (FILE, "\tlda LPBX0,g12\n"); \
- fprintf (FILE, "\tcall ___bb_init_func\n"); \
- fprintf (FILE, "LPY%d:\n",LABELNO); }
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. */
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
-{ int blockn = (BLOCKNO); \
- fprintf (FILE, "\tld LPBX2+%d,g12\n", 4 * blockn); \
- fprintf (FILE, "\taddo g12,1,g12\n"); \
- fprintf (FILE, "\tst g12,LPBX2+%d\n", 4 * blockn); }
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND(FILE, X, CODE) \
- i960_print_operand (FILE, X, CODE);
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- i960_print_operand_addr (FILE, ADDR)
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On the i960, the trampoline contains three instructions:
- ldconst _function, r4
- ldconst static addr, r3
- jump (r4) */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x8C203000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x8C183000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x84212000)); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 20
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 4)), \
- FNADDR); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 12)), \
- CXT); \
-}
-
-#if 0
-/* Promote char and short arguments to ints, when want compatibility with
- the iC960 compilers. */
-
-/* ??? In order for this to work, all users would need to be changed
- to test the value of the macro at run time. */
-#define PROMOTE_PROTOTYPES TARGET_CLEAN_LINKAGE
-/* ??? This does not exist. */
-#define PROMOTE_RETURN TARGET_CLEAN_LINKAGE
-#endif
-
-/* Instruction type definitions. Used to alternate instructions types for
- better performance on the C series chips. */
-
-enum insn_types { I_TYPE_REG, I_TYPE_MEM, I_TYPE_CTRL };
-
-/* Holds the insn type of the last insn output to the assembly file. */
-
-extern enum insn_types i960_last_insn_type;
-
-/* Parse opcodes, and set the insn last insn type based on them. */
-
-#define ASM_OUTPUT_OPCODE(FILE, INSN) i960_scan_opcode (INSN)
-
-/* Table listing what rtl codes each predicate in i960.c will accept. */
-
-#define PREDICATE_CODES \
- {"fpmove_src_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF, \
- LABEL_REF, SUBREG, REG, MEM}}, \
- {"arith_operand", {SUBREG, REG, CONST_INT}}, \
- {"logic_operand", {SUBREG, REG, CONST_INT}}, \
- {"fp_arith_operand", {SUBREG, REG, CONST_DOUBLE}}, \
- {"signed_arith_operand", {SUBREG, REG, CONST_INT}}, \
- {"literal", {CONST_INT}}, \
- {"fp_literal_one", {CONST_DOUBLE}}, \
- {"fp_literal_double", {CONST_DOUBLE}}, \
- {"fp_literal", {CONST_DOUBLE}}, \
- {"signed_literal", {CONST_INT}}, \
- {"symbolic_memory_operand", {SUBREG, MEM}}, \
- {"eq_or_neq", {EQ, NE}}, \
- {"arith32_operand", {SUBREG, REG, LABEL_REF, SYMBOL_REF, CONST_INT, \
- CONST_DOUBLE, CONST}}, \
- {"power2_operand", {CONST_INT}}, \
- {"cmplpower2_operand", {CONST_INT}},
-
-/* Define functions in i960.c and used in insn-output.c. */
-
-extern char *i960_output_ldconst ();
-extern char *i960_output_call_insn ();
-extern char *i960_output_ret_insn ();
-extern char *i960_output_move_double ();
-extern char *i960_output_move_quad ();
-
-/* Defined in reload.c, and used in insn-recog.c. */
-
-extern int rtx_equal_function_value_matters;
diff --git a/gcc/config/i960/i960.md b/gcc/config/i960/i960.md
deleted file mode 100644
index 32acd924ed1..00000000000
--- a/gcc/config/i960/i960.md
+++ /dev/null
@@ -1,2673 +0,0 @@
-;;- Machine description for Intel 80960 chip for GNU C compiler
-;; Copyright (C) 1992, 1995 Free Software Foundation, Inc.
-;; Contributed by Steven McGeady, Intel Corp.
-;; Additional work by Glenn Colon-Bonet, Jonathan Shapiro, Andy Wilson
-;; Converted to GCC 2.0 by Jim Wilson and Michael Tiemann, Cygnus Support.
-
-;; 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.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; There are very few (4) 'f' registers, they can't be loaded/stored from/to
-;; memory, and some instructions explicitly require them, so we get better
-;; code by discouraging pseudo-registers from being allocated to them.
-;; However, we do want to allow all patterns which can store to them to
-;; include them in their constraints, so we always use '*f' in a destination
-;; constraint except when 'f' is the only alternative.
-
-;; Insn attributes which describe the i960.
-
-;; Modscan is not used, since the compiler never emits any of these insns.
-(define_attr "type"
- "move,arith,alu2,mult,div,modscan,load,store,branch,call,address,compare,fpload,fpstore,fpmove,fpcvt,fpcc,fpadd,fpmul,fpdiv,multi,misc"
- (const_string "arith"))
-
-;; Length (in # of insns).
-(define_attr "length" ""
- (cond [(eq_attr "type" "load,fpload")
- (if_then_else (match_operand 1 "symbolic_memory_operand" "")
- (const_int 2)
- (const_int 1))
- (eq_attr "type" "store,fpstore")
- (if_then_else (match_operand 0 "symbolic_memory_operand" "")
- (const_int 2)
- (const_int 1))
- (eq_attr "type" "address")
- (const_int 2)]
- (const_int 1)))
-
-(define_asm_attributes
- [(set_attr "length" "1")
- (set_attr "type" "multi")])
-
-;; (define_function_unit {name} {num-units} {n-users} {test}
-;; {ready-delay} {issue-delay} [{conflict-list}])
-
-;; The integer ALU
-(define_function_unit "alu" 2 0 (eq_attr "type" "arith,compare,move,address") 1 0)
-(define_function_unit "alu" 2 0 (eq_attr "type" "alu2") 2 0)
-(define_function_unit "alu" 2 0 (eq_attr "type" "mult") 5 0)
-(define_function_unit "alu" 2 0 (eq_attr "type" "div") 35 0)
-(define_function_unit "alu" 2 0 (eq_attr "type" "modscan") 3 0)
-
-;; Memory with load-delay of 1 (i.e., 2 cycle load).
-(define_function_unit "memory" 1 0 (eq_attr "type" "load,fpload") 2 0)
-
-;; Floating point operations.
-(define_function_unit "fp" 1 2 (eq_attr "type" "fpmove") 5 0)
-(define_function_unit "fp" 1 2 (eq_attr "type" "fpcvt") 35 0)
-(define_function_unit "fp" 1 2 (eq_attr "type" "fpcc") 10 0)
-(define_function_unit "fp" 1 2 (eq_attr "type" "fpadd") 10 0)
-(define_function_unit "fp" 1 2 (eq_attr "type" "fpmul") 20 0)
-(define_function_unit "fp" 1 2 (eq_attr "type" "fpdiv") 35 0)
-
-;; Compare instructions.
-;; This controls RTL generation and register allocation.
-
-;; We generate RTL for comparisons and branches by having the cmpxx
-;; patterns store away the operands. Then, the scc and bcc patterns
-;; emit RTL for both the compare and the branch.
-;;
-;; We start with the DEFINE_EXPANDs, then then DEFINE_INSNs to match
-;; the patterns. Finally, we have the DEFINE_SPLITs for some of the scc
-;; insns that actually require more than one machine instruction.
-
-;; Put cmpsi first because it is expected to be the most common.
-
-(define_expand "cmpsi"
- [(set (reg:CC 36)
- (compare:CC (match_operand:SI 0 "nonimmediate_operand" "")
- (match_operand:SI 1 "general_operand" "")))]
- ""
- "
-{
- i960_compare_op0 = operands[0];
- i960_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_expand "cmpdf"
- [(set (reg:CC 36)
- (compare:CC (match_operand:DF 0 "register_operand" "r")
- (match_operand:DF 1 "nonmemory_operand" "rGH")))]
- "TARGET_NUMERICS"
- "
-{
- i960_compare_op0 = operands[0];
- i960_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_expand "cmpsf"
- [(set (reg:CC 36)
- (compare:CC (match_operand:SF 0 "register_operand" "r")
- (match_operand:SF 1 "nonmemory_operand" "rGH")))]
- "TARGET_NUMERICS"
- "
-{
- i960_compare_op0 = operands[0];
- i960_compare_op1 = operands[1];
- DONE;
-}")
-
-;; Now the DEFINE_INSNs for the compare and scc cases. First the compares.
-
-(define_insn ""
- [(set (reg:CC 36)
- (compare:CC (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "arith_operand" "dI")))]
- ""
- "cmpi %0,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (reg:CC_UNS 36)
- (compare:CC_UNS (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "arith_operand" "dI")))]
- ""
- "cmpo %0,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (reg:CC 36)
- (compare:CC (match_operand:DF 0 "register_operand" "r")
- (match_operand:DF 1 "nonmemory_operand" "rGH")))]
- "TARGET_NUMERICS"
- "cmprl %0,%1"
- [(set_attr "type" "fpcc")])
-
-(define_insn ""
- [(set (reg:CC 36)
- (compare:CC (match_operand:SF 0 "register_operand" "r")
- (match_operand:SF 1 "nonmemory_operand" "rGH")))]
- "TARGET_NUMERICS"
- "cmpr %0,%1"
- [(set_attr "type" "fpcc")])
-
-;; Instruction definitions for branch-on-bit-set and clear insns.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
- (const_int 1)
- (match_operand:SI 2 "arith_operand" "dI"))
- (const_int 0))
- (label_ref (match_operand 3 "" ""))
- (pc)))]
- ""
- "bbs %2,%1,%l3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
- (const_int 1)
- (match_operand:SI 2 "arith_operand" "dI"))
- (const_int 0))
- (label_ref (match_operand 3 "" ""))
- (pc)))]
- ""
- "bbc %2,%1,%l3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
- (const_int 1)
- (match_operand:SI 2 "arith_operand" "dI"))
- (const_int 0))
- (label_ref (match_operand 3 "" ""))
- (pc)))]
- ""
- "bbs %2,%1,%l3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
- (const_int 1)
- (match_operand:SI 2 "arith_operand" "dI"))
- (const_int 0))
- (label_ref (match_operand 3 "" ""))
- (pc)))]
- ""
- "bbc %2,%1,%l3"
- [(set_attr "type" "branch")])
-
-;; ??? These will never match. The LOG_LINKs necessary to make these match
-;; are not created by flow. These remain as a reminder to make this work
-;; some day.
-
-(define_insn ""
- [(set (reg:CC 36)
- (compare (match_operand:SI 0 "arith_operand" "d")
- (match_operand:SI 1 "arith_operand" "d")))
- (set (match_dup 1) (plus:SI (match_dup 1) (const_int 1)))]
- "0"
- "cmpinci %0,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (reg:CC_UNS 36)
- (compare (match_operand:SI 0 "arith_operand" "d")
- (match_operand:SI 1 "arith_operand" "d")))
- (set (match_dup 1) (plus:SI (match_dup 1) (const_int 1)))]
- "0"
- "cmpinco %0,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (reg:CC 36)
- (compare (match_operand:SI 0 "arith_operand" "d")
- (match_operand:SI 1 "arith_operand" "d")))
- (set (match_dup 1) (minus:SI (match_dup 1) (const_int 1)))]
- "0"
- "cmpdeci %0,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (reg:CC_UNS 36)
- (compare (match_operand:SI 0 "arith_operand" "d")
- (match_operand:SI 1 "arith_operand" "d")))
- (set (match_dup 1) (minus:SI (match_dup 1) (const_int 1)))]
- "0"
- "cmpdeco %0,%1"
- [(set_attr "type" "compare")])
-
-;; Templates to store result of condition.
-;; '1' is stored if condition is true.
-;; '0' is stored if condition is false.
-;; These should use predicate "general_operand", since
-;; gcc seems to be creating mem references which use these
-;; templates.
-
-(define_expand "seq"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (eq:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (EQ, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_expand "sne"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (ne:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (NE, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_expand "sgt"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (gt:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GT, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_expand "sgtu"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (gtu:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GTU, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_expand "slt"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (lt:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LT, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_expand "sltu"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (ltu:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LTU, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_expand "sge"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (ge:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GE, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_expand "sgeu"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (geu:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (GEU, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_expand "sle"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (le:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LE, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_expand "sleu"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (leu:SI (match_dup 1) (const_int 0)))]
- ""
- "
-{
- operands[1] = gen_compare_reg (LEU, i960_compare_op0, i960_compare_op1);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (eq:SI (match_operand:SI 1 "register_operand" "d") (const_int 0)))]
- ""
- "shro %1,1,%0"
- [(set_attr "type" "alu2")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (match_operator:SI 1 "comparison_operator" [(reg:CC 36) (const_int 0)]))]
- ""
- "test%C1 %0"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (match_operator:SI 1 "comparison_operator" [(reg:CC_UNS 36) (const_int 0)]))]
- ""
- "test%C1 %0"
- [(set_attr "type" "compare")])
-
-;; These control RTL generation for conditional jump insns
-;; and match them for register allocation.
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (EQ, i960_compare_op0, i960_compare_op1); }")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (NE, i960_compare_op0, i960_compare_op1); }")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (GT, i960_compare_op0, i960_compare_op1); }")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (GTU, i960_compare_op0, i960_compare_op1); }")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (LT, i960_compare_op0, i960_compare_op1); }")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (LTU, i960_compare_op0, i960_compare_op1); }")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (GE, i960_compare_op0, i960_compare_op1); }")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (GEU, i960_compare_op0, i960_compare_op1); }")
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (LE, i960_compare_op0, i960_compare_op1); }")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (match_dup 1)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (LEU, i960_compare_op0, i960_compare_op1); }")
-
-;; Now the normal branch insns (forward and reverse).
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(reg:CC 36) (const_int 0)])
- (label_ref (match_operand 1 "" ""))
- (pc)))]
- ""
- "b%C0 %l1"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(reg:CC 36) (const_int 0)])
- (pc)
- (label_ref (match_operand 1 "" ""))))]
- ""
- "b%I0 %l1"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(reg:CC_UNS 36) (const_int 0)])
- (label_ref (match_operand 1 "" ""))
- (pc)))]
- ""
- "b%C0 %l1"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(reg:CC_UNS 36) (const_int 0)])
- (pc)
- (label_ref (match_operand 1 "" ""))))]
- ""
- "b%I0 %l1"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "comparison_operator"
- [(match_operand:SI 1 "arith_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")])
- (label_ref (match_operand 3 "" ""))
- (pc)))]
- ""
- "cmp%S0%B0%R0 %2,%1,%l3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "comparison_operator"
- [(match_operand:SI 1 "arith_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")])
- (pc)
- (label_ref (match_operand 3 "" ""))))]
- ""
- "cmp%S0%B0%X0 %2,%1,%l3"
- [(set_attr "type" "branch")])
-
-;; Normal move instructions.
-;; This code is based on the sparc machine description.
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, SImode))
- DONE;
-}")
-
-;; The store case can not be separate, because reload may convert a register
-;; to register move insn to a store (or load) insn without rerecognizing
-;; the insn.
-
-;; The i960 does not have any store constant to memory instruction. However,
-;; the calling convention is defined so that the arg pointer when it is not
-;; overwise being used is zero. Thus, we can handle store zero to memory
-;; by storing an unused arg pointer. The arg pointer will be unused if
-;; current_function_args_size is zero and this is not a stdarg/varargs
-;; function. This value of the former variable is not valid until after
-;; all rtl generation is complete, including function inlining (because a
-;; function that doesn't need an arg pointer may be inlined into a function
-;; that does need an arg pointer), so we must also check that
-;; rtx_equal_function_value_matters is zero.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d,d,d,m")
- (match_operand:SI 1 "general_operand" "dI,i,m,dJ"))]
- "(current_function_args_size == 0
- && current_function_varargs == 0
- && current_function_stdarg == 0
- && rtx_equal_function_value_matters == 0)
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)
- || operands[1] == const0_rtx)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
- {
- if (GET_CODE (operands[1]) == REG)
- return \"lda (%1),%0\";
- else
- return \"lda %1,%0\";
- }
- return \"mov %1,%0\";
- case 1:
- return i960_output_ldconst (operands[0], operands[1]);
- case 2:
- return \"ld %1,%0\";
- case 3:
- if (operands[1] == const0_rtx)
- return \"st g14,%0\";
- return \"st %1,%0\";
- }
-}"
- [(set_attr "type" "move,address,load,store")
- (set_attr "length" "*,3,*,*")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d,d,d,m")
- (match_operand:SI 1 "general_operand" "dI,i,m,d"))]
- "(current_function_args_size != 0
- || current_function_varargs != 0
- || current_function_stdarg != 0
- || rtx_equal_function_value_matters != 0)
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
- {
- if (GET_CODE (operands[1]) == REG)
- return \"lda (%1),%0\";
- else
- return \"lda %1,%0\";
- }
- return \"mov %1,%0\";
- case 1:
- return i960_output_ldconst (operands[0], operands[1]);
- case 2:
- return \"ld %1,%0\";
- case 3:
- return \"st %1,%0\";
- }
-}"
- [(set_attr "type" "move,address,load,store")
- (set_attr "length" "*,3,*,*")])
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, HImode))
- DONE;
-}")
-
-;; Special pattern for zero stores to memory for functions which don't use
-;; the arg pointer.
-
-;; The store case can not be separate. See above.
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d,d,d,m")
- (match_operand:HI 1 "general_operand" "dI,i,m,dJ"))]
- "(current_function_args_size == 0
- && current_function_varargs == 0
- && current_function_stdarg == 0
- && rtx_equal_function_value_matters == 0)
- && (register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode)
- || operands[1] == const0_rtx)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
- {
- if (GET_CODE (operands[1]) == REG)
- return \"lda (%1),%0\";
- else
- return \"lda %1,%0\";
- }
- return \"mov %1,%0\";
- case 1:
- return i960_output_ldconst (operands[0], operands[1]);
- case 2:
- return \"ldos %1,%0\";
- case 3:
- if (operands[1] == const0_rtx)
- return \"stos g14,%0\";
- return \"stos %1,%0\";
- }
-}"
- [(set_attr "type" "move,misc,load,store")
- (set_attr "length" "*,3,*,*")])
-
-;; The store case can not be separate. See above.
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d,d,d,m")
- (match_operand:HI 1 "general_operand" "dI,i,m,d"))]
- "(current_function_args_size != 0
- || current_function_varargs != 0
- || current_function_stdarg != 0
- || rtx_equal_function_value_matters != 0)
- && (register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
- {
- if (GET_CODE (operands[1]) == REG)
- return \"lda (%1),%0\";
- else
- return \"lda %1,%0\";
- }
- return \"mov %1,%0\";
- case 1:
- return i960_output_ldconst (operands[0], operands[1]);
- case 2:
- return \"ldos %1,%0\";
- case 3:
- return \"stos %1,%0\";
- }
-}"
- [(set_attr "type" "move,misc,load,store")
- (set_attr "length" "*,3,*,*")])
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, QImode))
- DONE;
-}")
-
-;; The store case can not be separate. See comment above.
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=d,d,d,m")
- (match_operand:QI 1 "general_operand" "dI,i,m,dJ"))]
- "(current_function_args_size == 0
- && current_function_varargs == 0
- && current_function_stdarg == 0
- && rtx_equal_function_value_matters == 0)
- && (register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode)
- || operands[1] == const0_rtx)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
- {
- if (GET_CODE (operands[1]) == REG)
- return \"lda (%1),%0\";
- else
- return \"lda %1,%0\";
- }
- return \"mov %1,%0\";
- case 1:
- return i960_output_ldconst (operands[0], operands[1]);
- case 2:
- return \"ldob %1,%0\";
- case 3:
- if (operands[1] == const0_rtx)
- return \"stob g14,%0\";
- return \"stob %1,%0\";
- }
-}"
- [(set_attr "type" "move,misc,load,store")
- (set_attr "length" "*,3,*,*")])
-
-;; The store case can not be separate. See comment above.
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=d,d,d,m")
- (match_operand:QI 1 "general_operand" "dI,i,m,d"))]
- "(current_function_args_size != 0
- || current_function_varargs != 0
- || current_function_stdarg != 0
- || rtx_equal_function_value_matters != 0)
- && (register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (i960_last_insn_type == I_TYPE_REG && TARGET_C_SERIES)
- {
- if (GET_CODE (operands[1]) == REG)
- return \"lda (%1),%0\";
- else
- return \"lda %1,%0\";
- }
- return \"mov %1,%0\";
- case 1:
- return i960_output_ldconst (operands[0], operands[1]);
- case 2:
- return \"ldob %1,%0\";
- case 3:
- return \"stob %1,%0\";
- }
-}"
- [(set_attr "type" "move,misc,load,store")
- (set_attr "length" "*,3,*,*")])
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, DImode))
- DONE;
-}")
-
-;; The store case can not be separate. See comment above.
-(define_insn ""
- [(set (match_operand:DI 0 "general_operand" "=d,d,d,d,m,o")
- (match_operand:DI 1 "general_operand" "d,I,i,m,d,J"))]
- "(current_function_args_size == 0
- && current_function_varargs == 0
- && current_function_stdarg == 0
- && rtx_equal_function_value_matters == 0)
- && (register_operand (operands[0], DImode)
- || register_operand (operands[1], DImode)
- || operands[1] == const0_rtx)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- case 3:
- case 4:
- return i960_output_move_double (operands[0], operands[1]);
- case 2:
- return i960_output_ldconst (operands[0], operands[1]);
- case 5:
- operands[1] = adj_offsettable_operand (operands[0], 4);
- return \"st g14,%0\;st g14,%1\";
- }
-}"
- [(set_attr "type" "move,move,load,load,store,store")])
-
-;; The store case can not be separate. See comment above.
-(define_insn ""
- [(set (match_operand:DI 0 "general_operand" "=d,d,d,d,m")
- (match_operand:DI 1 "general_operand" "d,I,i,m,d"))]
- "(current_function_args_size != 0
- || current_function_varargs != 0
- || current_function_stdarg != 0
- || rtx_equal_function_value_matters != 0)
- && (register_operand (operands[0], DImode)
- || register_operand (operands[1], DImode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- case 3:
- case 4:
- return i960_output_move_double (operands[0], operands[1]);
- case 2:
- return i960_output_ldconst (operands[0], operands[1]);
- }
-}"
- [(set_attr "type" "move,move,load,load,store")])
-
-(define_insn "*store_unaligned_di_reg"
- [(set (match_operand:DI 0 "memory_operand" "=m")
- (match_operand:DI 1 "register_operand" "d"))
- (clobber (match_scratch:SI 2 "=&d"))]
- ""
- "*
-{
- operands[3] = gen_rtx (MEM, word_mode, operands[2]);
- operands[4] = adj_offsettable_operand (operands[3], UNITS_PER_WORD);
- return \"lda %0,%2\;st %1,%3\;st %D1,%4\";
-}"
- [(set_attr "type" "store")])
-
-(define_expand "movti"
- [(set (match_operand:TI 0 "general_operand" "")
- (match_operand:TI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, TImode))
- DONE;
-}")
-
-;; The store case can not be separate. See comment above.
-(define_insn ""
- [(set (match_operand:TI 0 "general_operand" "=d,d,d,d,m,o")
- (match_operand:TI 1 "general_operand" "d,I,i,m,d,J"))]
- "(current_function_args_size == 0
- && current_function_varargs == 0
- && current_function_stdarg == 0
- && rtx_equal_function_value_matters == 0)
- && (register_operand (operands[0], TImode)
- || register_operand (operands[1], TImode)
- || operands[1] == const0_rtx)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- case 3:
- case 4:
- return i960_output_move_quad (operands[0], operands[1]);
- case 2:
- return i960_output_ldconst (operands[0], operands[1]);
- case 5:
- operands[1] = adj_offsettable_operand (operands[0], 4);
- operands[2] = adj_offsettable_operand (operands[0], 8);
- operands[3] = adj_offsettable_operand (operands[0], 12);
- return \"st g14,%0\;st g14,%1\;st g14,%2\;st g14,%3\";
- }
-}"
- [(set_attr "type" "move,move,load,load,store,store")])
-
-;; The store case can not be separate. See comment above.
-(define_insn ""
- [(set (match_operand:TI 0 "general_operand" "=d,d,d,d,m")
- (match_operand:TI 1 "general_operand" "d,I,i,m,d"))]
- "(current_function_args_size != 0
- || current_function_varargs != 0
- || current_function_stdarg != 0
- || rtx_equal_function_value_matters != 0)
- && (register_operand (operands[0], TImode)
- || register_operand (operands[1], TImode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- case 3:
- case 4:
- return i960_output_move_quad (operands[0], operands[1]);
- case 2:
- return i960_output_ldconst (operands[0], operands[1]);
- }
-}"
- [(set_attr "type" "move,move,load,load,store")])
-
-(define_insn "*store_unaligned_ti_reg"
- [(set (match_operand:TI 0 "memory_operand" "=m")
- (match_operand:TI 1 "register_operand" "d"))
- (clobber (match_scratch:SI 2 "=&d"))]
- ""
- "*
-{
- operands[3] = gen_rtx (MEM, word_mode, operands[2]);
- operands[4] = adj_offsettable_operand (operands[3], UNITS_PER_WORD);
- operands[5] = adj_offsettable_operand (operands[4], UNITS_PER_WORD);
- operands[6] = adj_offsettable_operand (operands[5], UNITS_PER_WORD);
- return \"lda %0,%2\;st %1,%3\;st %D1,%4\;st %E1,%5\;st %F1,%6\";
-}"
- [(set_attr "type" "store")])
-
-(define_expand "store_multiple"
- [(set (match_operand:SI 0 "" "") ;;- dest
- (match_operand:SI 1 "" "")) ;;- src
- (use (match_operand:SI 2 "" ""))] ;;- nregs
- ""
- "
-{
- int regno;
- int count;
- rtx from;
- int i;
-
- if (GET_CODE (operands[0]) != MEM
- || GET_CODE (operands[1]) != REG
- || GET_CODE (operands[2]) != CONST_INT)
- FAIL;
-
- count = INTVAL (operands[2]);
- if (count > 12)
- FAIL;
-
- regno = REGNO (operands[1]);
- from = memory_address (SImode, XEXP (operands[0], 0));
- while (count >= 4 && ((regno & 3) == 0))
- {
- emit_insn (gen_rtx (SET, VOIDmode,
- gen_rtx (MEM, TImode, from),
- gen_rtx (REG, TImode, regno)));
- count -= 4;
- regno += 4;
- from = memory_address (TImode, plus_constant (from, 16));
- }
- while (count >= 2 && ((regno & 1) == 0))
- {
- emit_insn (gen_rtx (SET, VOIDmode,
- gen_rtx (MEM, DImode, from),
- gen_rtx (REG, DImode, regno)));
- count -= 2;
- regno += 2;
- from = memory_address (DImode, plus_constant (from, 8));
- }
- while (count > 0)
- {
- emit_insn (gen_rtx (SET, VOIDmode,
- gen_rtx (MEM, SImode, from),
- gen_rtx (REG, SImode, regno)));
- count -= 1;
- regno += 1;
- from = memory_address (SImode, plus_constant (from, 4));
- }
- DONE;
-}")
-
-;; Floating point move insns
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "fpmove_src_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, DFmode))
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=r,*f,d,d,m,o")
- (match_operand:DF 1 "fpmove_src_operand" "r,GH,F,m,d,G"))]
- "(current_function_args_size == 0
- && current_function_varargs == 0
- && current_function_stdarg == 0
- && rtx_equal_function_value_matters == 0)
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode)
- || operands[1] == CONST0_RTX (DFmode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return \"movrl %1,%0\";
- else
- return \"movl %1,%0\";
- case 1:
- return \"movrl %1,%0\";
- case 2:
- return i960_output_ldconst (operands[0], operands[1]);
- case 3:
- return \"ldl %1,%0\";
- case 4:
- return \"stl %1,%0\";
- case 5:
- operands[1] = adj_offsettable_operand (operands[0], 4);
- return \"st g14,%0\;st g14,%1\";
- }
-}"
- [(set_attr "type" "move,move,load,fpload,fpstore,fpstore")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=r,*f,d,d,m")
- (match_operand:DF 1 "fpmove_src_operand" "r,GH,F,m,d"))]
- "(current_function_args_size != 0
- || current_function_varargs != 0
- || current_function_stdarg != 0
- || rtx_equal_function_value_matters != 0)
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return \"movrl %1,%0\";
- else
- return \"movl %1,%0\";
- case 1:
- return \"movrl %1,%0\";
- case 2:
- return i960_output_ldconst (operands[0], operands[1]);
- case 3:
- return \"ldl %1,%0\";
- case 4:
- return \"stl %1,%0\";
- }
-}"
- [(set_attr "type" "move,move,load,fpload,fpstore")])
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "fpmove_src_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, SFmode))
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=r,*f,d,d,m")
- (match_operand:SF 1 "fpmove_src_operand" "r,GH,F,m,dG"))]
- "(current_function_args_size == 0
- && current_function_varargs == 0
- && current_function_stdarg == 0
- && rtx_equal_function_value_matters == 0)
- && (register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode)
- || operands[1] == CONST0_RTX (SFmode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return \"movr %1,%0\";
- else
- return \"mov %1,%0\";
- case 1:
- return \"movr %1,%0\";
- case 2:
- return i960_output_ldconst (operands[0], operands[1]);
- case 3:
- return \"ld %1,%0\";
- case 4:
- if (operands[1] == CONST0_RTX (SFmode))
- return \"st g14,%0\";
- return \"st %1,%0\";
- }
-}"
- [(set_attr "type" "move,move,load,fpload,fpstore")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=r,*f,d,d,m")
- (match_operand:SF 1 "fpmove_src_operand" "r,GH,F,m,d"))]
- "(current_function_args_size != 0
- || current_function_varargs != 0
- || current_function_stdarg != 0
- || rtx_equal_function_value_matters != 0)
- && (register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return \"movr %1,%0\";
- else
- return \"mov %1,%0\";
- case 1:
- return \"movr %1,%0\";
- case 2:
- return i960_output_ldconst (operands[0], operands[1]);
- case 3:
- return \"ld %1,%0\";
- case 4:
- return \"st %1,%0\";
- }
-}"
- [(set_attr "type" "move,move,load,fpload,fpstore")])
-
-;; Mixed-mode moves with sign and zero-extension.
-
-;; Note that the one starting from HImode comes before those for QImode
-;; so that a constant operand will match HImode, not QImode.
-
-(define_expand "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operand1) == REG
- || (GET_CODE (operand1) == SUBREG
- && GET_CODE (XEXP (operand1, 0)) == REG))
- {
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_16 = gen_rtx (CONST_INT, VOIDmode, 16);
- int op1_subreg_word = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subreg_word = SUBREG_WORD (operand1);
- operand1 = SUBREG_REG (operand1);
- }
- operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
-
- emit_insn (gen_ashlsi3 (temp, operand1, shift_16));
- emit_insn (gen_ashrsi3 (operand0, temp, shift_16));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
- ""
- "ldis %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operand1) == REG
- || (GET_CODE (operand1) == SUBREG
- && GET_CODE (XEXP (operand1, 0)) == REG))
- {
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
- int op1_subreg_word = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subreg_word = SUBREG_WORD (operand1);
- operand1 = SUBREG_REG (operand1);
- }
- operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word),
-
- emit_insn (gen_ashlsi3 (temp, operand1, shift_24));
- emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
- ""
- "ldib %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (sign_extend:HI
- (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operand1) == REG
- || (GET_CODE (operand1) == SUBREG
- && GET_CODE (XEXP (operand1, 0)) == REG))
- {
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
- int op0_subreg_word = 0;
- int op1_subreg_word = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subreg_word = SUBREG_WORD (operand1);
- operand1 = SUBREG_REG (operand1);
- }
- operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
-
- if (GET_CODE (operand0) == SUBREG)
- {
- op0_subreg_word = SUBREG_WORD (operand0);
- operand0 = SUBREG_REG (operand0);
- }
- if (GET_MODE (operand0) != SImode)
- operand0 = gen_rtx (SUBREG, SImode, operand0, op0_subreg_word);
-
- emit_insn (gen_ashlsi3 (temp, operand1, shift_24));
- emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=d")
- (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
- ""
- "ldib %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operand1) == REG
- || (GET_CODE (operand1) == SUBREG
- && GET_CODE (XEXP (operand1, 0)) == REG))
- {
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_16 = gen_rtx (CONST_INT, VOIDmode, 16);
- int op1_subreg_word = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subreg_word = SUBREG_WORD (operand1);
- operand1 = SUBREG_REG (operand1);
- }
- operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
-
- emit_insn (gen_ashlsi3 (temp, operand1, shift_16));
- emit_insn (gen_lshrsi3 (operand0, temp, shift_16));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
- ""
- "ldos %1,%0"
- [(set_attr "type" "load")])
-
-;; Using shifts here generates much better code than doing an `and 255'.
-;; This is mainly because the `and' requires loading the constant separately,
-;; the constant is likely to get optimized, and then the compiler can't
-;; optimize the `and' because it doesn't know that one operand is a constant.
-
-(define_expand "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operand1) == REG
- || (GET_CODE (operand1) == SUBREG
- && GET_CODE (XEXP (operand1, 0)) == REG))
- {
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
- int op1_subreg_word = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subreg_word = SUBREG_WORD (operand1);
- operand1 = SUBREG_REG (operand1);
- }
- operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
-
- emit_insn (gen_ashlsi3 (temp, operand1, shift_24));
- emit_insn (gen_lshrsi3 (operand0, temp, shift_24));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
- ""
- "ldob %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (zero_extend:HI
- (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operand1) == REG
- || (GET_CODE (operand1) == SUBREG
- && GET_CODE (XEXP (operand1, 0)) == REG))
- {
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
- int op0_subreg_word = 0;
- int op1_subreg_word = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subreg_word = SUBREG_WORD (operand1);
- operand1 = SUBREG_REG (operand1);
- }
- operand1 = gen_rtx (SUBREG, SImode, operand1, op1_subreg_word);
-
- if (GET_CODE (operand0) == SUBREG)
- {
- op0_subreg_word = SUBREG_WORD (operand0);
- operand0 = SUBREG_REG (operand0);
- }
- if (GET_MODE (operand0) != SImode)
- operand0 = gen_rtx (SUBREG, SImode, operand0, op0_subreg_word);
-
- emit_insn (gen_ashlsi3 (temp, operand1, shift_24));
- emit_insn (gen_lshrsi3 (operand0, temp, shift_24));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=d")
- (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
- ""
- "ldob %1,%0"
- [(set_attr "type" "load")])
-
-;; Conversions between float and double.
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=*f,d")
- (float_extend:DF (match_operand:SF 1 "fp_arith_operand" "dGH,fGH")))]
- "TARGET_NUMERICS"
- "@
- movr %1,%0
- movrl %1,%0"
- [(set_attr "type" "fpmove")])
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (float_truncate:SF
- (match_operand:DF 1 "fp_arith_operand" "fGH")))]
- "TARGET_NUMERICS"
- "movr %1,%0"
- [(set_attr "type" "fpmove")])
-
-;; Conversion between fixed point and floating point.
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:SI 1 "register_operand" "d")))]
- "TARGET_NUMERICS"
- "cvtir %1,%0"
- [(set_attr "type" "fpcvt")])
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "=d*f")
- (float:SF (match_operand:SI 1 "register_operand" "d")))]
- "TARGET_NUMERICS"
- "cvtir %1,%0"
- [(set_attr "type" "fpcvt")])
-
-;; Convert a float to an actual integer.
-;; Truncation is performed as part of the conversion.
-;; The i960 requires conversion from DFmode to DImode to make
-;; unsigned conversions work properly.
-
-(define_insn "fixuns_truncdfdi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (unsigned_fix:DI (fix:DF (match_operand:DF 1 "fp_arith_operand" "fGH"))))]
- "TARGET_NUMERICS"
- "cvtzril %1,%0"
- [(set_attr "type" "fpcvt")])
-
-(define_insn "fixuns_truncsfdi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (unsigned_fix:DI (fix:SF (match_operand:SF 1 "fp_arith_operand" "fGH"))))]
- "TARGET_NUMERICS"
- "cvtzril %1,%0"
- [(set_attr "type" "fpcvt")])
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (fix:SI (fix:DF (match_operand:DF 1 "fp_arith_operand" "fGH"))))]
- "TARGET_NUMERICS"
- "cvtzri %1,%0"
- [(set_attr "type" "fpcvt")])
-
-(define_expand "fixuns_truncdfsi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (unsigned_fix:SI (fix:DF (match_operand:DF 1 "fp_arith_operand" ""))))]
- "TARGET_NUMERICS"
- "
-{
- rtx temp = gen_reg_rtx (DImode);
- emit_insn (gen_rtx (SET, VOIDmode, temp,
- gen_rtx (UNSIGNED_FIX, DImode,
- gen_rtx (FIX, DFmode, operands[1]))));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (SUBREG, SImode, temp, 0)));
- DONE;
-}")
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (fix:SI (fix:SF (match_operand:SF 1 "fp_arith_operand" "dfGH"))))]
- "TARGET_NUMERICS"
- "cvtzri %1,%0"
- [(set_attr "type" "fpcvt")])
-
-(define_expand "fixuns_truncsfsi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (unsigned_fix:SI (fix:SF (match_operand:SF 1 "fp_arith_operand" ""))))]
- "TARGET_NUMERICS"
- "
-{
- rtx temp = gen_reg_rtx (DImode);
- emit_insn (gen_rtx (SET, VOIDmode, temp,
- gen_rtx (UNSIGNED_FIX, DImode,
- gen_rtx (FIX, SFmode, operands[1]))));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (SUBREG, SImode, temp, 0)));
- DONE;
-}")
-
-;; Arithmetic instructions.
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (minus:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "subo %2,%1,%0")
-
-;; Try to generate an lda instruction when it would be faster than an
-;; add instruction.
-;; Some assemblers apparently won't accept two addresses added together.
-
-;; ??? The condition should be improved to reject the case of two
-;; symbolic constants.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,d,d")
- (plus:SI (match_operand:SI 1 "arith32_operand" "%dn,i,dn")
- (match_operand:SI 2 "arith32_operand" "dn,dn,i")))]
- "(TARGET_C_SERIES) && (CONSTANT_P (operands[1]) || CONSTANT_P (operands[2]))"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- rtx tmp = operands[1];
- operands[1] = operands[2];
- operands[2] = tmp;
- }
- if (GET_CODE (operands[2]) == CONST_INT
- && GET_CODE (operands[1]) == REG
- && i960_last_insn_type != I_TYPE_REG)
- {
- if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) > -32)
- return \"subo %n2,%1,%0\";
- else if (INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 32)
- return \"addo %1,%2,%0\";
- }
- /* Non-canonical results (op1 == const, op2 != const) have been seen
- in reload output when both operands were symbols before reload, so
- we deal with it here. This may be a fault of the constraints above. */
- if (CONSTANT_P (operands[1]))
- {
- if (CONSTANT_P (operands[2]))
- return \"lda %1+%2,%0\";
- else
- return \"lda %1(%2),%0\";
- }
- return \"lda %2(%1),%0\";
-}")
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (plus:SI (match_operand:SI 1 "signed_arith_operand" "%dI")
- (match_operand:SI 2 "signed_arith_operand" "dIK")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- return \"subo %n2,%1,%0\";
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"addo %2,%1,%0\";
- return \"addo %1,%2,%0\";
-}")
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mult:SI (match_operand:SI 1 "arith_operand" "%dI")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "*
-{
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"mulo %2,%1,%0\";
- return \"mulo %1,%2,%0\";
-}"
- [(set_attr "type" "mult")])
-
-(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
- (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))]
- ""
- "*
-{
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"emul %2,%1,%0\";
- return \"emul %1,%2,%0\";
-}"
- [(set_attr "type" "mult")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%d"))
- (match_operand:SI 2 "literal" "I")))]
- ""
- "*
-{
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"emul %2,%1,%0\";
- return \"emul %1,%2,%0\";
-}"
- [(set_attr "type" "mult")])
-
-;; This goes after the move/add/sub/mul instructions
-;; because those instructions are better when they apply.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (match_operand:SI 1 "address_operand" "p"))]
- ""
- "lda %a1,%0"
- [(set_attr "type" "load")])
-
-;; This will never be selected because of an "optimization" that GCC does.
-;; It always converts divides by a power of 2 into a sequence of instructions
-;; that does a right shift, and then corrects the result if it was negative.
-
-;; (define_insn ""
-;; [(set (match_operand:SI 0 "register_operand" "=d")
-;; (div:SI (match_operand:SI 1 "arith_operand" "dI")
-;; (match_operand:SI 2 "power2_operand" "nI")))]
-;; ""
-;; "*{
-;; operands[2] = gen_rtx(CONST_INT, VOIDmode,bitpos (INTVAL (operands[2])));
-;; return \"shrdi %2,%1,%0\";
-;; }"
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (div:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "divi %2,%1,%0"
- [(set_attr "type" "div")])
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (udiv:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "divo %2,%1,%0"
- [(set_attr "type" "div")])
-
-;; We must use `remi' not `modi' here, to ensure that `%' has the effects
-;; specified by the ANSI C standard.
-
-(define_insn "modsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mod:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "remi %2,%1,%0"
- [(set_attr "type" "div")])
-
-(define_insn "umodsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (umod:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "remo %2,%1,%0"
- [(set_attr "type" "div")])
-
-;; And instructions (with complement also).
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (and:SI (match_operand:SI 1 "register_operand" "%d")
- (match_operand:SI 2 "logic_operand" "dIM")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- return \"andnot %C2,%1,%0\";
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"and %2,%1,%0\";
- return \"and %1,%2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (and:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "cmplpower2_operand" "n")))]
- ""
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- bitpos (~INTVAL (operands[2])));
- return \"clrbit %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (and:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
- (match_operand:SI 2 "logic_operand" "dIM")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- return \"nor %C2,%1,%0\";
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"notand %2,%1,%0\";
- return \"andnot %1,%2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ior:SI (not:SI (match_operand:SI 1 "register_operand" "%d"))
- (not:SI (match_operand:SI 2 "register_operand" "d"))))]
- ""
- "*
-{
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"nand %2,%1,%0\";
- return \"nand %1,%2,%0\";
-}")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ior:SI (match_operand:SI 1 "register_operand" "%d")
- (match_operand:SI 2 "logic_operand" "dIM")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- return \"ornot %C2,%1,%0\";
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"or %2,%1,%0\";
- return \"or %1,%2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ior:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "power2_operand" "n")))]
- ""
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- bitpos (INTVAL (operands[2])));
- return \"setbit %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ior:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
- (match_operand:SI 2 "logic_operand" "dIM")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- return \"nand %C2,%1,%0\";
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"notor %2,%1,%0\";
- return \"ornot %1,%2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (and:SI (not:SI (match_operand:SI 1 "register_operand" "%d"))
- (not:SI (match_operand:SI 2 "register_operand" "d"))))]
- ""
- "*
-{
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"nor %2,%1,%0\";
- return \"nor %1,%2,%0\";
-}")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (xor:SI (match_operand:SI 1 "register_operand" "%d")
- (match_operand:SI 2 "logic_operand" "dIM")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- return \"xnor %C2,%1,%0\";
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"xor %2,%1,%0\";
- return \"xor %1,%2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (xor:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "power2_operand" "n")))]
- ""
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- bitpos (INTVAL (operands[2])));
- return \"notbit %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (not:SI (xor:SI (match_operand:SI 1 "register_operand" "%d")
- (match_operand:SI 2 "register_operand" "d"))))]
- ""
- "*
-{
- if (i960_bypass (insn, operands[1], operands[2], 0))
- return \"xnor %2,%1,%0\";
- return \"xnor %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ior:SI (ashift:SI (const_int 1)
- (match_operand:SI 1 "register_operand" "d"))
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "setbit %1,%2,%0")
-
-;; (not (ashift 1 reg)) canonicalizes to (rotate -2 reg)
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (and:SI (rotate:SI (const_int -2)
- (match_operand:SI 1 "register_operand" "d"))
- (match_operand:SI 2 "register_operand" "d")))]
- ""
- "clrbit %1,%2,%0")
-
-;; The above pattern canonicalizes to this when both the input and output
-;; are the same pseudo-register.
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "=d")
- (const_int 1)
- (match_operand:SI 1 "register_operand" "d"))
- (const_int 0))]
- ""
- "clrbit %1,%0,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (xor:SI (ashift:SI (const_int 1)
- (match_operand:SI 1 "register_operand" "d"))
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "notbit %1,%2,%0")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (neg:SI (match_operand:SI 1 "arith_operand" "dI")))]
- ""
- "subo %1,0,%0"
- [(set_attr "length" "1")])
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (not:SI (match_operand:SI 1 "arith_operand" "dI")))]
- ""
- "not %1,%0"
- [(set_attr "length" "1")])
-
-;; Floating point arithmetic instructions.
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=d*f")
- (plus:DF (match_operand:DF 1 "fp_arith_operand" "%rGH")
- (match_operand:DF 2 "fp_arith_operand" "rGH")))]
- "TARGET_NUMERICS"
- "addrl %1,%2,%0"
- [(set_attr "type" "fpadd")])
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=d*f")
- (plus:SF (match_operand:SF 1 "fp_arith_operand" "%rGH")
- (match_operand:SF 2 "fp_arith_operand" "rGH")))]
- "TARGET_NUMERICS"
- "addr %1,%2,%0"
- [(set_attr "type" "fpadd")])
-
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=d*f")
- (minus:DF (match_operand:DF 1 "fp_arith_operand" "rGH")
- (match_operand:DF 2 "fp_arith_operand" "rGH")))]
- "TARGET_NUMERICS"
- "subrl %2,%1,%0"
- [(set_attr "type" "fpadd")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=d*f")
- (minus:SF (match_operand:SF 1 "fp_arith_operand" "rGH")
- (match_operand:SF 2 "fp_arith_operand" "rGH")))]
- "TARGET_NUMERICS"
- "subr %2,%1,%0"
- [(set_attr "type" "fpadd")])
-
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=d*f")
- (mult:DF (match_operand:DF 1 "fp_arith_operand" "%rGH")
- (match_operand:DF 2 "fp_arith_operand" "rGH")))]
- "TARGET_NUMERICS"
- "mulrl %1,%2,%0"
- [(set_attr "type" "fpmul")])
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=d*f")
- (mult:SF (match_operand:SF 1 "fp_arith_operand" "%rGH")
- (match_operand:SF 2 "fp_arith_operand" "rGH")))]
- "TARGET_NUMERICS"
- "mulr %1,%2,%0"
- [(set_attr "type" "fpmul")])
-
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=d*f")
- (div:DF (match_operand:DF 1 "fp_arith_operand" "rGH")
- (match_operand:DF 2 "fp_arith_operand" "rGH")))]
- "TARGET_NUMERICS"
- "divrl %2,%1,%0"
- [(set_attr "type" "fpdiv")])
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=d*f")
- (div:SF (match_operand:SF 1 "fp_arith_operand" "rGH")
- (match_operand:SF 2 "fp_arith_operand" "rGH")))]
- "TARGET_NUMERICS"
- "divr %2,%1,%0"
- [(set_attr "type" "fpdiv")])
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=d,d*f")
- (neg:DF (match_operand:DF 1 "register_operand" "d,r")))]
- ""
- "*
-{
- if (which_alternative == 0)
- {
- if (REGNO (operands[0]) == REGNO (operands[1]))
- return \"notbit 31,%D1,%D0\";
- return \"mov %1,%0\;notbit 31,%D1,%D0\";
- }
- return \"subrl %1,0f0.0,%0\";
-}"
- [(set_attr "type" "fpadd")])
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=d,d*f")
- (neg:SF (match_operand:SF 1 "register_operand" "d,r")))]
- ""
- "@
- notbit 31,%1,%0
- subr %1,0f0.0,%0"
- [(set_attr "type" "fpadd")])
-
-;;; The abs patterns also work even if the target machine doesn't have
-;;; floating point, because in that case dstreg and srcreg will always be
-;;; less than 32.
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=d*f")
- (abs:DF (match_operand:DF 1 "register_operand" "df")))]
- ""
- "*
-{
- int dstreg = REGNO (operands[0]);
- int srcreg = REGNO (operands[1]);
-
- if (dstreg < 32)
- {
- if (srcreg < 32)
- {
- if (dstreg != srcreg)
- output_asm_insn (\"mov %1,%0\", operands);
- return \"clrbit 31,%D1,%D0\";
- }
- /* Src is an fp reg. */
- return \"movrl %1,%0\;clrbit 31,%D1,%D0\";
- }
- if (srcreg >= 32)
- return \"cpysre %1,0f0.0,%0\";
- return \"movrl %1,%0\;cpysre %0,0f0.0,%0\";
-}"
- [(set_attr "type" "multi")])
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=d*f")
- (abs:SF (match_operand:SF 1 "register_operand" "df")))]
- ""
- "*
-{
- int dstreg = REGNO (operands[0]);
- int srcreg = REGNO (operands[1]);
-
- if (dstreg < 32 && srcreg < 32)
- return \"clrbit 31,%1,%0\";
-
- if (dstreg >= 32 && srcreg >= 32)
- return \"cpysre %1,0f0.0,%0\";
-
- if (dstreg < 32)
- return \"movr %1,%0\;clrbit 31,%0,%0\";
-
- return \"movr %1,%0\;cpysre %0,0f0.0,%0\";
-}"
- [(set_attr "type" "multi")])
-
-;; Tetra (16 byte) float support.
-
-(define_expand "cmpxf"
- [(set (reg:CC 36)
- (compare:CC (match_operand:XF 0 "register_operand" "")
- (match_operand:XF 1 "nonmemory_operand" "")))]
- "TARGET_NUMERICS"
- "
-{
- i960_compare_op0 = operands[0];
- i960_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_insn ""
- [(set (reg:CC 36)
- (compare:CC (match_operand:XF 0 "register_operand" "f")
- (match_operand:XF 1 "nonmemory_operand" "fGH")))]
- "TARGET_NUMERICS"
- "cmpr %0,%1"
- [(set_attr "type" "fpcc")])
-
-(define_expand "movxf"
- [(set (match_operand:XF 0 "general_operand" "")
- (match_operand:XF 1 "fpmove_src_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, XFmode))
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=r,f,d,d,m")
- (match_operand:XF 1 "fpmove_src_operand" "r,GH,F,m,d"))]
- "register_operand (operands[0], XFmode)
- || register_operand (operands[1], XFmode)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return \"movre %1,%0\";
- else
- return \"movq %1,%0\";
- case 1:
- return \"movre %1,%0\";
- case 2:
- return i960_output_ldconst (operands[0], operands[1]);
- case 3:
- return \"ldt %1,%0\";
- case 4:
- return \"stt %1,%0\";
- }
-}"
- [(set_attr "type" "move,move,load,fpload,fpstore")])
-
-(define_insn "extendsfxf2"
- [(set (match_operand:XF 0 "register_operand" "=f,d")
- (float_extend:XF
- (match_operand:SF 1 "register_operand" "d,f")))]
- "TARGET_NUMERICS"
- "@
- movr %1,%0
- movre %1,%0"
- [(set_attr "type" "fpmove")])
-
-(define_insn "extenddfxf2"
- [(set (match_operand:XF 0 "register_operand" "=f,d")
- (float_extend:XF
- (match_operand:DF 1 "register_operand" "d,f")))]
- "TARGET_NUMERICS"
- "@
- movrl %1,%0
- movre %1,%0"
- [(set_attr "type" "fpmove")])
-
-(define_insn "truncxfdf2"
- [(set (match_operand:DF 0 "register_operand" "=d")
- (float_truncate:DF
- (match_operand:XF 1 "register_operand" "f")))]
- "TARGET_NUMERICS"
- "movrl %1,%0"
- [(set_attr "type" "fpmove")])
-
-(define_insn "truncxfsf2"
- [(set (match_operand:SF 0 "register_operand" "=d")
- (float_truncate:SF
- (match_operand:XF 1 "register_operand" "f")))]
- "TARGET_NUMERICS"
- "movr %1,%0"
- [(set_attr "type" "fpmove")])
-
-(define_insn "floatsixf2"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (float:XF (match_operand:SI 1 "register_operand" "d")))]
- "TARGET_NUMERICS"
- "cvtir %1,%0"
- [(set_attr "type" "fpcvt")])
-
-(define_insn "fix_truncxfsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (fix:SI (fix:XF (match_operand:XF 1 "register_operand" "f"))))]
- "TARGET_NUMERICS"
- "cvtzri %1,%0"
- [(set_attr "type" "fpcvt")])
-
-(define_insn "fixuns_truncxfsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (unsigned_fix:SI (fix:XF (match_operand:XF 1 "register_operand" "f"))))]
- "TARGET_NUMERICS"
- "cvtzri %1,%0"
- [(set_attr "type" "fpcvt")])
-
-(define_insn "addxf3"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (plus:XF (match_operand:XF 1 "nonmemory_operand" "%fGH")
- (match_operand:XF 2 "nonmemory_operand" "fGH")))]
- "TARGET_NUMERICS"
- "addr %1,%2,%0"
- [(set_attr "type" "fpadd")])
-
-(define_insn "subxf3"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (minus:XF (match_operand:XF 1 "nonmemory_operand" "fGH")
- (match_operand:XF 2 "nonmemory_operand" "fGH")))]
- "TARGET_NUMERICS"
- "subr %2,%1,%0"
- [(set_attr "type" "fpadd")])
-
-(define_insn "mulxf3"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (mult:XF (match_operand:XF 1 "nonmemory_operand" "%fGH")
- (match_operand:XF 2 "nonmemory_operand" "fGH")))]
- "TARGET_NUMERICS"
- "mulr %1,%2,%0"
- [(set_attr "type" "fpmul")])
-
-(define_insn "divxf3"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (div:XF (match_operand:XF 1 "nonmemory_operand" "fGH")
- (match_operand:XF 2 "nonmemory_operand" "fGH")))]
- "TARGET_NUMERICS"
- "divr %2,%1,%0"
- [(set_attr "type" "fpdiv")])
-
-(define_insn "negxf2"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (neg:XF (match_operand:XF 1 "register_operand" "f")))]
- "TARGET_NUMERICS"
- "subr %1,0f0.0,%0"
- [(set_attr "type" "fpadd")])
-
-(define_insn "absxf2"
- [(set (match_operand:XF 0 "register_operand" "=f")
- (abs:XF (match_operand:XF 1 "register_operand" "f")))]
- "(TARGET_NUMERICS)"
- "cpysre %1,0f0.0,%0"
- [(set_attr "type" "fpmove")])
-
-;; Arithmetic shift instructions.
-
-;; The shli instruction generates an overflow fault if the sign changes.
-;; In the case of overflow, it does not give the natural result, it instead
-;; gives the last shift value before the overflow. We can not use this
-;; instruction because gcc thinks that arithmetic left shift and logical
-;; left shift are identical, and sometimes canonicalizes the logical left
-;; shift to an arithmetic left shift. Therefore we must always use the
-;; logical left shift instruction.
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashift:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "shlo %2,%1,%0"
- [(set_attr "type" "alu2")])
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashiftrt:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "shri %2,%1,%0"
- [(set_attr "type" "alu2")])
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (lshiftrt:SI (match_operand:SI 1 "arith_operand" "dI")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "shro %2,%1,%0"
- [(set_attr "type" "alu2")])
-
-;; Unconditional and other jump instructions.
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "b %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
- ""
- "bx %a0"
- [(set_attr "type" "branch")])
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "register_operand" "d"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "bx (%0)"
- [(set_attr "type" "branch")])
-
-;;- jump to subroutine
-
-(define_expand "call"
- [(call (match_operand:SI 0 "memory_operand" "m")
- (match_operand:SI 1 "immediate_operand" "i"))]
- ""
- "
-{
- emit_insn (gen_call_internal (operands[0], operands[1],
- virtual_outgoing_args_rtx));
- DONE;
-}")
-
-;; We need a call saved register allocated for the match_scratch, so we use
-;; 'l' because all local registers are call saved.
-
-;; ??? I would prefer to use a match_scratch here, but match_scratch allocated
-;; registers can't be used for spills. In a function with lots of calls,
-;; local-alloc may allocate all local registers to a match_scratch, leaving
-;; no local registers available for spills.
-
-(define_insn "call_internal"
- [(call (match_operand:SI 0 "memory_operand" "m")
- (match_operand:SI 1 "immediate_operand" "i"))
- (use (match_operand:SI 2 "address_operand" "p"))
- (clobber (reg:SI 19))]
- ""
- "* return i960_output_call_insn (operands[0], operands[1], operands[2],
- insn);"
- [(set_attr "type" "call")])
-
-(define_expand "call_value"
- [(set (match_operand 0 "register_operand" "=d")
- (call (match_operand:SI 1 "memory_operand" "m")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "
-{
- emit_insn (gen_call_value_internal (operands[0], operands[1], operands[2],
- virtual_outgoing_args_rtx));
- DONE;
-}")
-
-;; We need a call saved register allocated for the match_scratch, so we use
-;; 'l' because all local registers are call saved.
-
-(define_insn "call_value_internal"
- [(set (match_operand 0 "register_operand" "=d")
- (call (match_operand:SI 1 "memory_operand" "m")
- (match_operand:SI 2 "immediate_operand" "i")))
- (use (match_operand:SI 3 "address_operand" "p"))
- (clobber (reg:SI 19))]
- ""
- "* return i960_output_call_insn (operands[1], operands[2], operands[3],
- insn);"
- [(set_attr "type" "call")])
-
-(define_insn "return"
- [(return)]
- ""
- "* return i960_output_ret_insn (insn);"
- [(set_attr "type" "branch")])
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "")
-
-;; Various peephole optimizations for multiple-word moves, loads, and stores.
-;; Multiple register moves.
-
-;; Matched 5/28/91
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "register_operand" "r"))
- (set (match_operand:SI 2 "register_operand" "=r")
- (match_operand:SI 3 "register_operand" "r"))
- (set (match_operand:SI 4 "register_operand" "=r")
- (match_operand:SI 5 "register_operand" "r"))
- (set (match_operand:SI 6 "register_operand" "=r")
- (match_operand:SI 7 "register_operand" "r"))]
- "((REGNO (operands[0]) & 3) == 0)
- && ((REGNO (operands[1]) & 3) == 0)
- && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
- && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
- && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
- && (REGNO (operands[1]) + 2 == REGNO (operands[5]))
- && (REGNO (operands[0]) + 3 == REGNO (operands[6]))
- && (REGNO (operands[1]) + 3 == REGNO (operands[7]))"
- "movq %1,%0")
-
-;; Matched 4/17/92
-(define_peephole
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:DI 1 "register_operand" "r"))
- (set (match_operand:DI 2 "register_operand" "=r")
- (match_operand:DI 3 "register_operand" "r"))]
- "((REGNO (operands[0]) & 3) == 0)
- && ((REGNO (operands[1]) & 3) == 0)
- && (REGNO (operands[0]) + 2 == REGNO (operands[2]))
- && (REGNO (operands[1]) + 2 == REGNO (operands[3]))"
- "movq %1,%0")
-
-;; Matched 4/17/92
-(define_peephole
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:DI 1 "register_operand" "r"))
- (set (match_operand:SI 2 "register_operand" "=r")
- (match_operand:SI 3 "register_operand" "r"))
- (set (match_operand:SI 4 "register_operand" "=r")
- (match_operand:SI 5 "register_operand" "r"))]
- "((REGNO (operands[0]) & 3) == 0)
- && ((REGNO (operands[1]) & 3) == 0)
- && (REGNO (operands[0]) + 2 == REGNO (operands[2]))
- && (REGNO (operands[1]) + 2 == REGNO (operands[3]))
- && (REGNO (operands[0]) + 3 == REGNO (operands[4]))
- && (REGNO (operands[1]) + 3 == REGNO (operands[5]))"
- "movq %1,%0")
-
-;; Matched 4/17/92
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "register_operand" "r"))
- (set (match_operand:SI 2 "register_operand" "=r")
- (match_operand:SI 3 "register_operand" "r"))
- (set (match_operand:DI 4 "register_operand" "=r")
- (match_operand:DI 5 "register_operand" "r"))]
- "((REGNO (operands[0]) & 3) == 0)
- && ((REGNO (operands[1]) & 3) == 0)
- && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
- && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
- && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
- && (REGNO (operands[1]) + 2 == REGNO (operands[5]))"
- "movq %1,%0")
-
-;; Matched 4/17/92
-(define_peephole
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:DI 1 "register_operand" "r"))
- (set (match_operand:SI 2 "register_operand" "=r")
- (match_operand:SI 3 "register_operand" "r"))]
- "((REGNO (operands[0]) & 3) == 0)
- && ((REGNO (operands[1]) & 3) == 0)
- && (REGNO (operands[0]) + 2 == REGNO (operands[2]))
- && (REGNO (operands[1]) + 2 == REGNO (operands[3]))"
- "movt %1,%0")
-
-;; Matched 5/28/91
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "register_operand" "r"))
- (set (match_operand:SI 2 "register_operand" "=r")
- (match_operand:SI 3 "register_operand" "r"))
- (set (match_operand:SI 4 "register_operand" "=r")
- (match_operand:SI 5 "register_operand" "r"))]
- "((REGNO (operands[0]) & 3) == 0)
- && ((REGNO (operands[1]) & 3) == 0)
- && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
- && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
- && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
- && (REGNO (operands[1]) + 2 == REGNO (operands[5]))"
- "movt %1,%0")
-
-;; Matched 5/28/91
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "register_operand" "r"))
- (set (match_operand:SI 2 "register_operand" "=r")
- (match_operand:SI 3 "register_operand" "r"))]
- "((REGNO (operands[0]) & 1) == 0)
- && ((REGNO (operands[1]) & 1) == 0)
- && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
- && (REGNO (operands[1]) + 1 == REGNO (operands[3]))"
- "movl %1,%0")
-
-; Multiple register loads.
-
-;; Matched 6/15/91
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "n"))))
- (set (match_operand:SI 3 "register_operand" "=r")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 4 "immediate_operand" "n"))))
- (set (match_operand:SI 5 "register_operand" "=r")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 6 "immediate_operand" "n"))))
- (set (match_operand:SI 7 "register_operand" "=r")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 8 "immediate_operand" "n"))))]
- "(i960_si_ti (operands[1], operands[2]) && ((REGNO (operands[0]) & 3) == 0)
- && (REGNO (operands[1]) != REGNO (operands[0]))
- && (REGNO (operands[0]) + 1 == REGNO (operands[3]))
- && (REGNO (operands[1]) != REGNO (operands[3]))
- && (REGNO (operands[0]) + 2 == REGNO (operands[5]))
- && (REGNO (operands[1]) != REGNO (operands[5]))
- && (REGNO (operands[0]) + 3 == REGNO (operands[7]))
- && (INTVAL (operands[2]) + 4 == INTVAL (operands[4]))
- && (INTVAL (operands[2]) + 8 == INTVAL (operands[6]))
- && (INTVAL (operands[2]) + 12 == INTVAL (operands[8])))"
- "ldq %2(%1),%0")
-
-;; Matched 5/28/91
-(define_peephole
- [(set (match_operand:DF 0 "register_operand" "=d")
- (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "immediate_operand" "n"))))
- (set (match_operand:DF 3 "register_operand" "=d")
- (mem:DF (plus:SI (match_dup 1)
- (match_operand:SI 4 "immediate_operand" "n"))))]
- "(i960_si_ti (operands[1], operands[2]) && ((REGNO (operands[0]) & 3) == 0)
- && (REGNO (operands[1]) != REGNO (operands[0]))
- && (REGNO (operands[0]) + 2 == REGNO (operands[3]))
- && (REGNO (operands[1]) != REGNO (operands[3]))
- && (INTVAL (operands[2]) + 8 == INTVAL (operands[4])))"
- "ldq %2(%1),%0")
-
-;; Matched 1/24/92
-(define_peephole
- [(set (match_operand:DI 0 "register_operand" "=d")
- (mem:DI (plus:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "immediate_operand" "n"))))
- (set (match_operand:DI 3 "register_operand" "=d")
- (mem:DI (plus:SI (match_dup 1)
- (match_operand:SI 4 "immediate_operand" "n"))))]
- "(i960_si_ti (operands[1], operands[2]) && ((REGNO (operands[0]) & 3) == 0)
- && (REGNO (operands[1]) != REGNO (operands[0]))
- && (REGNO (operands[0]) + 2 == REGNO (operands[3]))
- && (REGNO (operands[1]) != REGNO (operands[3]))
- && (INTVAL (operands[2]) + 8 == INTVAL (operands[4])))"
- "ldq %2(%1),%0")
-
-;; Matched 4/17/92
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mem:SI (match_operand:SI 1 "register_operand" "d")))
- (set (match_operand:SI 2 "register_operand" "=d")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 3 "immediate_operand" "n"))))
- (set (match_operand:SI 4 "register_operand" "=d")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 5 "immediate_operand" "n"))))
- (set (match_operand:SI 6 "register_operand" "=d")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 7 "immediate_operand" "n"))))]
- "(i960_si_ti (operands[1], 0) && ((REGNO (operands[0]) & 3) == 0)
- && (REGNO (operands[1]) != REGNO (operands[0]))
- && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
- && (REGNO (operands[1]) != REGNO (operands[2]))
- && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
- && (REGNO (operands[1]) != REGNO (operands[4]))
- && (REGNO (operands[0]) + 3 == REGNO (operands[6]))
- && (INTVAL (operands[3]) == 4)
- && (INTVAL (operands[5]) == 8)
- && (INTVAL (operands[7]) == 12))"
- "ldq (%1),%0")
-
-;; Matched 5/28/91
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "immediate_operand" "n"))))
- (set (match_operand:SI 3 "register_operand" "=d")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 4 "immediate_operand" "n"))))
- (set (match_operand:SI 5 "register_operand" "=d")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 6 "immediate_operand" "n"))))]
- "(i960_si_ti (operands[1], operands[2]) && ((REGNO (operands[0]) & 3) == 0)
- && (REGNO (operands[1]) != REGNO (operands[0]))
- && (REGNO (operands[0]) + 1 == REGNO (operands[3]))
- && (REGNO (operands[1]) != REGNO (operands[3]))
- && (REGNO (operands[0]) + 2 == REGNO (operands[5]))
- && (INTVAL (operands[2]) + 4 == INTVAL (operands[4]))
- && (INTVAL (operands[2]) + 8 == INTVAL (operands[6])))"
- "ldt %2(%1),%0")
-
-;; Matched 6/15/91
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mem:SI (match_operand:SI 1 "register_operand" "d")))
- (set (match_operand:SI 2 "register_operand" "=d")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 3 "immediate_operand" "n"))))
- (set (match_operand:SI 4 "register_operand" "=d")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 5 "immediate_operand" "n"))))]
- "(i960_si_ti (operands[1], 0) && ((REGNO (operands[0]) & 3) == 0)
- && (REGNO (operands[1]) != REGNO (operands[0]))
- && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
- && (REGNO (operands[1]) != REGNO (operands[2]))
- && (REGNO (operands[0]) + 2 == REGNO (operands[4]))
- && (INTVAL (operands[3]) == 4)
- && (INTVAL (operands[5]) == 8))"
- "ldt (%1),%0")
-
-;; Matched 5/28/91
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "immediate_operand" "n"))))
- (set (match_operand:SI 3 "register_operand" "=d")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 4 "immediate_operand" "n"))))]
- "(i960_si_di (operands[1], operands[2]) && ((REGNO (operands[0]) & 1) == 0)
- && (REGNO (operands[1]) != REGNO (operands[0]))
- && (REGNO (operands[0]) + 1 == REGNO (operands[3]))
- && (INTVAL (operands[2]) + 4 == INTVAL (operands[4])))"
- "ldl %2(%1),%0")
-
-;; Matched 5/28/91
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mem:SI (match_operand:SI 1 "register_operand" "d")))
- (set (match_operand:SI 2 "register_operand" "=d")
- (mem:SI (plus:SI (match_dup 1)
- (match_operand:SI 3 "immediate_operand" "n"))))]
- "(i960_si_di (operands[1], 0) && ((REGNO (operands[0]) & 1) == 0)
- && (REGNO (operands[1]) != REGNO (operands[0]))
- && (REGNO (operands[0]) + 1 == REGNO (operands[2]))
- && (INTVAL (operands[3]) == 4))"
- "ldl (%1),%0")
-
-; Multiple register stores.
-
-;; Matched 5/28/91
-(define_peephole
- [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "immediate_operand" "n")))
- (match_operand:SI 2 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 3 "immediate_operand" "n")))
- (match_operand:SI 4 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 5 "immediate_operand" "n")))
- (match_operand:SI 6 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 7 "immediate_operand" "n")))
- (match_operand:SI 8 "register_operand" "d"))]
- "(i960_si_ti (operands[0], operands[1]) && ((REGNO (operands[2]) & 3) == 0)
- && (REGNO (operands[2]) + 1 == REGNO (operands[4]))
- && (REGNO (operands[2]) + 2 == REGNO (operands[6]))
- && (REGNO (operands[2]) + 3 == REGNO (operands[8]))
- && (INTVAL (operands[1]) + 4 == INTVAL (operands[3]))
- && (INTVAL (operands[1]) + 8 == INTVAL (operands[5]))
- && (INTVAL (operands[1]) + 12 == INTVAL (operands[7])))"
- "stq %2,%1(%0)")
-
-;; Matched 6/16/91
-(define_peephole
- [(set (mem:DF (plus:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "immediate_operand" "n")))
- (match_operand:DF 2 "register_operand" "d"))
- (set (mem:DF (plus:SI (match_dup 0)
- (match_operand:SI 3 "immediate_operand" "n")))
- (match_operand:DF 4 "register_operand" "d"))]
- "(i960_si_ti (operands[0], operands[1]) && ((REGNO (operands[2]) & 3) == 0)
- && (REGNO (operands[2]) + 2 == REGNO (operands[4]))
- && (INTVAL (operands[1]) + 8 == INTVAL (operands[3])))"
- "stq %2,%1(%0)")
-
-;; Matched 4/17/92
-(define_peephole
- [(set (mem:DI (plus:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "immediate_operand" "n")))
- (match_operand:DI 2 "register_operand" "d"))
- (set (mem:DI (plus:SI (match_dup 0)
- (match_operand:SI 3 "immediate_operand" "n")))
- (match_operand:DI 4 "register_operand" "d"))]
- "(i960_si_ti (operands[0], operands[1]) && ((REGNO (operands[2]) & 3) == 0)
- && (REGNO (operands[2]) + 2 == REGNO (operands[4]))
- && (INTVAL (operands[1]) + 8 == INTVAL (operands[3])))"
- "stq %2,%1(%0)")
-
-;; Matched 1/23/92
-(define_peephole
- [(set (mem:SI (match_operand:SI 0 "register_operand" "d"))
- (match_operand:SI 1 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 2 "immediate_operand" "n")))
- (match_operand:SI 3 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 4 "immediate_operand" "n")))
- (match_operand:SI 5 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 6 "immediate_operand" "n")))
- (match_operand:SI 7 "register_operand" "d"))]
- "(i960_si_ti (operands[0], 0) && ((REGNO (operands[1]) & 3) == 0)
- && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
- && (REGNO (operands[1]) + 2 == REGNO (operands[5]))
- && (REGNO (operands[1]) + 3 == REGNO (operands[7]))
- && (INTVAL (operands[2]) == 4)
- && (INTVAL (operands[4]) == 8)
- && (INTVAL (operands[6]) == 12))"
- "stq %1,(%0)")
-
-;; Matched 5/29/91
-(define_peephole
- [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "immediate_operand" "n")))
- (match_operand:SI 2 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 3 "immediate_operand" "n")))
- (match_operand:SI 4 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 5 "immediate_operand" "n")))
- (match_operand:SI 6 "register_operand" "d"))]
- "(i960_si_ti (operands[0], operands[1]) && ((REGNO (operands[2]) & 3) == 0)
- && (REGNO (operands[2]) + 1 == REGNO (operands[4]))
- && (REGNO (operands[2]) + 2 == REGNO (operands[6]))
- && (INTVAL (operands[1]) + 4 == INTVAL (operands[3]))
- && (INTVAL (operands[1]) + 8 == INTVAL (operands[5])))"
- "stt %2,%1(%0)")
-
-;; Matched 5/29/91
-(define_peephole
- [(set (mem:SI (match_operand:SI 0 "register_operand" "d"))
- (match_operand:SI 1 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 2 "immediate_operand" "n")))
- (match_operand:SI 3 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 4 "immediate_operand" "n")))
- (match_operand:SI 5 "register_operand" "d"))]
- "(i960_si_ti (operands[0], 0) && ((REGNO (operands[1]) & 3) == 0)
- && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
- && (REGNO (operands[1]) + 2 == REGNO (operands[5]))
- && (INTVAL (operands[2]) == 4)
- && (INTVAL (operands[4]) == 8))"
- "stt %1,(%0)")
-
-;; Matched 5/28/91
-(define_peephole
- [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "immediate_operand" "n")))
- (match_operand:SI 2 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 3 "immediate_operand" "n")))
- (match_operand:SI 4 "register_operand" "d"))]
- "(i960_si_di (operands[0], operands[1]) && ((REGNO (operands[2]) & 1) == 0)
- && (REGNO (operands[2]) + 1 == REGNO (operands[4]))
- && (INTVAL (operands[1]) + 4 == INTVAL (operands[3])))"
- "stl %2,%1(%0)")
-
-;; Matched 5/28/91
-(define_peephole
- [(set (mem:SI (match_operand:SI 0 "register_operand" "d"))
- (match_operand:SI 1 "register_operand" "d"))
- (set (mem:SI (plus:SI (match_dup 0)
- (match_operand:SI 2 "immediate_operand" "n")))
- (match_operand:SI 3 "register_operand" "d"))]
- "(i960_si_di (operands[0], 0) && ((REGNO (operands[1]) & 1) == 0)
- && (REGNO (operands[1]) + 1 == REGNO (operands[3]))
- && (INTVAL (operands[2]) == 4))"
- "stl %1,(%0)")
diff --git a/gcc/config/i960/rtems.h b/gcc/config/i960/rtems.h
deleted file mode 100644
index 9263027f22c..00000000000
--- a/gcc/config/i960/rtems.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Definitions for rtems targetting an Intel i960.
-
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Joel Sherrill (joel@OARcorp.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 "i960/i960-coff.h"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di960 -Di80960 -DI960 -DI80960 -Drtems -D__rtems__ \
- -Asystem(rtems) -Acpu(i960) -Amachine(i960)"
-
-/* end of i960-rtems.h */
diff --git a/gcc/config/i960/t-960bare b/gcc/config/i960/t-960bare
deleted file mode 100644
index c6be2a04f3e..00000000000
--- a/gcc/config/i960/t-960bare
+++ /dev/null
@@ -1,24 +0,0 @@
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c xp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' > dp-bit.c
- cat $(srcdir)/config/fp-bit.c >> dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-xp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define EXTENDED_FLOAT_STUBS' > xp-bit.c
- cat $(srcdir)/config/fp-bit.c >> xp-bit.c
-
-MULTILIB_OPTIONS=mnumerics/msoft-float
-MULTILIB_DIRNAMES=float soft-float
-MULTILIB_MATCHES=mnumerics=msb mnumerics=msc mnumerics=mkb mnumerics=mkc mnumerics=mmc mnumerics=mcb mnumerics=mcc mnumerics=mjf msoft-float=msa msoft-float=mka msoft-float=mca msoft-float=mcf
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/i960/t-vxworks960 b/gcc/config/i960/t-vxworks960
deleted file mode 100644
index 9f8529125cb..00000000000
--- a/gcc/config/i960/t-vxworks960
+++ /dev/null
@@ -1,27 +0,0 @@
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# We don't want to put exit in libgcc.a for VxWorks, because VxWorks
-# does not have _exit.
-LIBGCC2_CFLAGS = -O2 $(GCC_CFLAGS) -g1 -Dexit=unused_exit
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c xp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' > dp-bit.c
- cat $(srcdir)/config/fp-bit.c >> dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-xp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define EXTENDED_FLOAT_STUBS' > xp-bit.c
- cat $(srcdir)/config/fp-bit.c >> xp-bit.c
-
-MULTILIB_OPTIONS=mnumerics/msoft-float
-MULTILIB_DIRNAMES=float soft-float
-MULTILIB_MATCHES=mnumerics=msb mnumerics=msc mnumerics=mkb mnumerics=mkc mnumerics=mmc mnumerics=mcb mnumerics=mcc msoft-float=msa msoft-float=mka msoft-float=mca msoft-float=mcf
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/i960/vx960-coff.h b/gcc/config/i960/vx960-coff.h
deleted file mode 100644
index 3e12bbe536c..00000000000
--- a/gcc/config/i960/vx960-coff.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Definitions of target machine for GNU compiler. Vxworks i960 version.
- Copyright (C) 1994, 1995, 1996 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 just exists to give specs for the 960 running on VxWorks.
- VxWorks does all the library stuff itself. */
-
-#undef LIB_SPEC
-#define LIB_SPEC ""
-
-/* VxWorks provides the functionality of crt0.o and friends itself. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
-
-/* Predefine vxworks. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di960 -Di80960 -DI960 -DI80960 -Dvxworks -Acpu(i960) -Amachine(i960)"
-
-/* The VxWorks header files expect the compiler to define CPU to a
- magic number. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{mic*:-D__i960\
- %{mka:-D__i960KA}%{mkb:-D__i960KB}\
- %{msa:-D__i960SA}%{msb:-D__i960SB}\
- %{mmc:-D__i960MC}\
- %{mca:-D__i960CA}%{mcc:-D__i960CC}\
- %{mcf:-D__i960CF}}\
- %{mka:-D__i960KA__ -D__i960_KA__ %{!ansi:-DCPU=I960KA}}\
- %{mkb:-D__i960KB__ -D__i960_KB__ %{!ansi:-DCPU=I960KB}}\
- %{msa:-D__i960SA__ -D__i960_SA__}\
- %{msb:-D__i960SB__ -D__i960_SB__}\
- %{mmc:-D__i960MC__ -D__i960_MC__}\
- %{mca:-D__i960CA__ -D__i960_CA__ %{!ansi:-DCPU=I960CA}}\
- %{mcc:-D__i960CC__ -D__i960_CC__}\
- %{mcf:-D__i960CF__ -D__i960_CF__}\
- %{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:\
- %{!mcc:%{!mcf:-D__i960_CA -D__i960CA__ %{!ansi:-DCPU=I960CA}\
- %{mic*:-D__i960CA}}}}}}}}}"
-
-/* Default to -mca. */
-
-#undef CC1_SPEC
-#define CC1_SPEC \
- "%{!mka:%{!mkb:%{!msa:%{!msb:%{!mmc:%{!mca:%{!mcc:%{!mcf:-mca}}}}}}}}\
- %{!gs*:%{!gc*:%{mbout:%{g*:-gstabs}}\
- %{mcoff:%{g*:-gcoff}}\
- %{!mbout:%{!mcoff:%{g*:-gcoff}}}}}"
diff --git a/gcc/config/i960/vx960.h b/gcc/config/i960/vx960.h
deleted file mode 100644
index ebf70dc183a..00000000000
--- a/gcc/config/i960/vx960.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Definitions of target machine for GNU compiler. Vxworks i960 version.
- Copyright (C) 1994, 1996 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 just exists to give specs for the 960 running on VxWorks.
- VxWorks does all the library stuff itself. */
-
-#undef LIB_SPEC
-#define LIB_SPEC ""
-
-/* VxWorks provides the functionality of crt0.o and friends itself. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
diff --git a/gcc/config/i960/xm-i960.h b/gcc/config/i960/xm-i960.h
deleted file mode 100644
index 09dcadff460..00000000000
--- a/gcc/config/i960/xm-i960.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Configuration for GNU C-compiler for Intel 960 family
- Copyright (C) 1987, 1993 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* If not compiled with GNU C, use the C alloca */
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-#endif
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
diff --git a/gcc/config/libgloss.h b/gcc/config/libgloss.h
deleted file mode 100644
index 2f2ba569f4f..00000000000
--- a/gcc/config/libgloss.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* libgloss.h -- operating system specific defines to be used when
- targeting GCC for Libgloss supported targets.
- Copyright (C) 1996 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. */
-
-/* The libgloss standard for crt0.s has the name based on the command line
- option. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared:%{pg:pgcrt0%O%s}%{!pg:%{p:pcrt0%O%s}%{!p:crt0%O%s}}}"
-
-/* This file used to force LINK_SPEC to be the null string, but that is not
- correct. LINK_SPEC is used to pass machine specific arguments to the
- linker and hence can not be redefined here. LINK_SPEC is never used to
- specify startup files or libraries, so it should never conflict with
- libgloss. */
-
-/* Don't set the target flags, this is done by the linker script */
-#undef LIB_SPEC
-#define LIB_SPEC ""
diff --git a/gcc/config/linux-aout.h b/gcc/config/linux-aout.h
deleted file mode 100644
index 2e9a790b252..00000000000
--- a/gcc/config/linux-aout.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Definitions for Linux
- Copyright (C) 1995 Free Software Foundation, Inc.
- Contributed by H.J. Lu (hjl@nynexst.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. */
-
-/* Don't assume anything about the header files. */
-#define NO_IMPLICIT_EXTERN_C
-
-#undef HAVE_ATEXIT
-#define HAVE_ATEXIT
-
-/* Linux uses ctype from glibc.a. I am not sure how complete it is.
- For now, we play safe. It may change later. */
-
-#if 0
-#undef MULTIBYTE_CHARS
-#define MULTIBYTE_CHARS 1
-#endif
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static}"
-
-#undef ASM_APP_ON
-#define ASM_APP_ON "#APP\n"
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF "#NO_APP\n"
-
-#define SET_ASM_OP ".set"
-
-/* We need that too. */
-#define HANDLE_SYSV_PRAGMA
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
deleted file mode 100644
index 76100bfb8a3..00000000000
--- a/gcc/config/linux.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Definitions for Linux with ELF format
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Eric Youngdale.
- Modified for stabs-in-ELF by H.J. Lu.
-
-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. */
-
-/* Don't assume anything about the header files. */
-#define NO_IMPLICIT_EXTERN_C
-
-#undef HAVE_ATEXIT
-#define HAVE_ATEXIT
-
-/* Linux uses ctype from glibc.a. I am not sure how complete it is.
- For now, we play safe. It may change later. */
-
-#if 0
-#undef MULTIBYTE_CHARS
-#define MULTIBYTE_CHARS 1
-#endif
-
-#undef ASM_APP_ON
-#define ASM_APP_ON "#APP\n"
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF "#NO_APP\n"
-
-#define SET_ASM_OP ".set"
-
-/* Use stabs instead of DWARF debug format. */
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-#include "svr4.h"
-
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- output_file_directive (FILE, main_input_filename); \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- } while (0)
-
-/* Provide a STARTFILE_SPEC appropriate for Linux. Here we add
- the Linux magical crtbegin.o file (see crtstuff.c) which
- provides part of the support for getting C++ file-scope static
- object constructed before entering `main'. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!shared: \
- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
- %{!p:%{profile:gcrt1.o%s} \
- %{!profile:crt1.o%s}}}} \
- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
-
-/* Provide a ENDFILE_SPEC appropriate for Linux. Here we tack on
- the Linux magical crtend.o file (see crtstuff.c) which
- provides part of the support for getting C++ file-scope static
- object constructed before entering `main', followed by a normal
- Linux "finalizer" file, `crtn.o'. */
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
-
-/* This is for -profile to use -lc_p instead of -lc. */
-#undef CC1_SPEC
-#define CC1_SPEC "%{profile:-p}"
-
-#undef LIB_SPEC
-#if 1
-/* We no longer link with libc_p.a or libg.a by default. If you
- * want to profile or debug the Linux C library, please add
- * -profile or -ggdb to LDFLAGS at the link time, respectively.
- */
-#define LIB_SPEC \
- "%{!shared: %{p:-lgmon} %{pg:-lgmon} %{profile:-lgmon -lc_p} \
- %{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}"
-#else
-#define LIB_SPEC \
- "%{!shared: \
- %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
- %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
-#endif
diff --git a/gcc/config/lynx-ng.h b/gcc/config/lynx-ng.h
deleted file mode 100644
index a3a9c3799d4..00000000000
--- a/gcc/config/lynx-ng.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Target independent definitions for LynxOS, using Lynx's old as and ld.
- Copyright (C) 1993 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 for backwards compatibility with older Lynx tools, which use
- a version of a.out format. */
-
-#undef ASM_SPEC
-#define ASM_SPEC "%{mcoff:-C}"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
- %{mposix:-D_POSIX_SOURCE} \
- %{msystem-v:-I/usr/include_v}"
-
-/* Provide required defaults for linker switches. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{msystem-v:-V} %{mcoff:-k}"
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{mthreads:-L/lib/thread/}%{msystem-v:-lc_v}%{!msystem-v:%{mposix:-lc_p} -lc}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{p:%{mcoff:pinit1.o%s}%{!mcoff:pinit.o%s}}%{!p:%{msystem-v:%{mcoff:vinit1.o%s}%{!mcoff:vinit.o%s}}%{!msystem-v:%{mcoff:init1.o%s}%{!mcoff:init.o%s}}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "%{mcoff:initn.o%s} %{p:_etext.o%s}"
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-
-/* We want to output DBX debugging information. */
-
-#define DBX_DEBUGGING_INFO
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* We optionally want to be able to produce SDB debugging output so that
- we can create debuggable SDB/coff files. This won't be needed when
- stabs-in-coff works. */
-
-#define SDB_DEBUGGING_INFO
-
-/* Generate calls to memcpy, memcmp and memset. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Handle #pragma pack and sometimes #pragma weak. */
-
-#define HANDLE_SYSV_PRAGMA
-
-#define TARGET_THREADS (target_flags & MASK_THREADS)
-#define MASK_THREADS 0x40000000
-
-#define TARGET_POSIX (target_flags & MASK_POSIX)
-#define MASK_POSIX 0x20000000
-
-#define TARGET_SYSTEM_V (target_flags & MASK_SYSTEM_V)
-#define MASK_SYSTEM_V 0x10000000
-
-#define TARGET_COFF (target_flags & MASK_COFF)
-#define MASK_COFF 0x08000000
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- {"threads", MASK_THREADS}, \
- {"posix", MASK_POSIX}, \
- {"system-v", MASK_SYSTEM_V}, \
- {"coff", MASK_COFF},
-
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-{ if (TARGET_SYSTEM_V && profile_flag) \
- warning ("-msystem-v and -p are incompatible"); \
- if (TARGET_SYSTEM_V && TARGET_THREADS) \
- warning ("-msystem-v and -mthreads are incompatible"); }
-
-/* Define this so that C++ destructors will use atexit. */
-
-#define HAVE_ATEXIT
-
-/* This is defined only so that we can find the assembler. Everything else
- is in /bin. */
-
-#define MD_EXEC_PREFIX "/usr/local/lib/gcc-"
-
-/* This is needed because /bin/ld does not handle -L options correctly. */
-
-#define LINK_LIBGCC_SPECIAL_1
-
-/* The Lynx linker considers __main to be a possible entry point, so we
- must use a different name. */
-
-#define NAME__MAIN "____main"
-#define SYMBOL__MAIN ____main
diff --git a/gcc/config/lynx.h b/gcc/config/lynx.h
deleted file mode 100644
index 62c790b6bfb..00000000000
--- a/gcc/config/lynx.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Target independent definitions for LynxOS.
- Copyright (C) 1993, 1994, 1995, 1996 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. */
-
-/* LynxOS is a multi-platform Unix, similar to SVR3, but not identical.
- We can get quite a bit from generic svr3, but have to do some overrides. */
-
-#include "svr3.h"
-
-/* Define various macros, depending on the combination of flags. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
- %{mposix:-D_POSIX_SOURCE} \
- %{msystem-v:-I/usr/include_v}"
-
-/* No asm spec needed, since using GNU assembler always. */
-
-/* No linker spec needed, since using GNU linker always. */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{mthreads:-L/lib/thread/} \
- %{msystem-v:-lc_v} \
- %{!msystem-v:%{mposix:-lc_p} -lc -lm}"
-
-/* Set the appropriate names for the Lynx startfiles. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{p:%{mthreads:thread/pinit1.o%s}%{!mthreads:pinit1.o%s}}%{!p:%{msystem-v:vinit1.o%s -e_start}%{!msystem-v:%{mthreads:thread/init1.o%s}%{!mthreads:init1.o%s}}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "%{p:_etext.o%s}%{!p:initn.o%s}"
-
-/* Override the svr3 versions. */
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-
-/* We want to output DBX (stabs) debugging information normally. */
-
-#define DBX_DEBUGGING_INFO
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* It is convenient to be able to generate standard coff debugging
- if requested via -gcoff. */
-
-#define SDB_DEBUGGING_INFO
-
-/* Be function-relative for block and source line stab directives. */
-
-#define DBX_BLOCKS_FUNCTION_RELATIVE 1
-
-/* but, to make this work, functions must appear prior to line info */
-
-#define DBX_FUNCTION_FIRST
-
-/* Generate a blank trailing N_SO to mark the end of the .o file, since
- we can't depend upon the linker to mark .o file boundaries with
- embedded stabs. */
-
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
- fprintf (FILE, \
- "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO)
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- { static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,.LM%d-", \
- line, sym_lineno); \
- assemble_name (file, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- fprintf (file, "\n.LM%d:\n", sym_lineno); \
- sym_lineno += 1; }
-
-/* Handle #pragma pack and sometimes #pragma weak. */
-
-#define HANDLE_SYSV_PRAGMA
-
-/* Some additional command-line options. */
-
-#define TARGET_THREADS (target_flags & MASK_THREADS)
-#define MASK_THREADS 0x40000000
-
-#define TARGET_POSIX (target_flags & MASK_POSIX)
-#define MASK_POSIX 0x20000000
-
-#define TARGET_SYSTEM_V (target_flags & MASK_SYSTEM_V)
-#define MASK_SYSTEM_V 0x10000000
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- {"threads", MASK_THREADS}, \
- {"posix", MASK_POSIX}, \
- {"system-v", MASK_SYSTEM_V},
-
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-do { \
- if (TARGET_SYSTEM_V && profile_flag) \
- warning ("-msystem-v and -p are incompatible"); \
- if (TARGET_SYSTEM_V && TARGET_THREADS) \
- warning ("-msystem-v and -mthreads are incompatible"); \
-} while (0)
-
-/* Define this so that C++ destructors will use atexit, since LynxOS
- calls exit after main returns. */
-
-#define HAVE_ATEXIT
-
-/* Since init.o et al put all sorts of stuff into the init section,
- we can't use the standard init section support in crtbegin.o. */
-
-#undef INIT_SECTION_ASM_OP
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_fini
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
- FINI_SECTION_FUNCTION
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP ".section\t.ctors"
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP ".section\t.dtors"
-
-#define INT_ASM_OP ".long"
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#undef DO_GLOBAL_CTORS_BODY
-#undef DO_GLOBAL_DTORS_BODY
-
-/* LynxOS doesn't have mcount. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(file, profile_label_no)
diff --git a/gcc/config/m32r/initfini.c b/gcc/config/m32r/initfini.c
deleted file mode 100644
index 34ef5da962f..00000000000
--- a/gcc/config/m32r/initfini.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* .init/.fini section handling + C++ global constructor/destructor handling.
- This file is based on crtstuff.c, sol2-crti.asm, sol2-crtn.asm.
-
-Copyright (C) 1996, 1997 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. */
-
-/* As a special exception, if you link this file with files
- compiled with GCC to produce an executable, this does not 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. */
-
-/* Declare a pointer to void function type. */
-typedef void (*func_ptr) (void);
-
-#ifdef CRT_INIT
-
-/* NOTE: In order to be able to support SVR4 shared libraries, we arrange
- to have one set of symbols { __CTOR_LIST__, __DTOR_LIST__, __CTOR_END__,
- __DTOR_END__ } per root executable and also one set of these symbols
- per shared library. So in any given whole process image, we may have
- multiple definitions of each of these symbols. In order to prevent
- these definitions from conflicting with one another, and in order to
- ensure that the proper lists are used for the initialization/finalization
- of each individual shared library (respectively), we give these symbols
- only internal (i.e. `static') linkage, and we also make it a point to
- refer to only the __CTOR_END__ symbol in crtfini.o and the __DTOR_LIST__
- symbol in crtinit.o, where they are defined. */
-
-static func_ptr __CTOR_LIST__[1]
- __attribute__ ((section (".ctors")))
- = { (func_ptr) (-1) };
-
-static func_ptr __DTOR_LIST__[1]
- __attribute__ ((section (".dtors")))
- = { (func_ptr) (-1) };
-
-/* Run all the global destructors on exit from the program. */
-
-/* Some systems place the number of pointers in the first word of the
- table. On SVR4 however, that word is -1. In all cases, the table is
- null-terminated. On SVR4, we start from the beginning of the list and
- invoke each per-compilation-unit destructor routine in order
- until we find that null.
-
- Note that this function MUST be static. There will be one of these
- functions in each root executable and one in each shared library, but
- although they all have the same code, each one is unique in that it
- refers to one particular associated `__DTOR_LIST__' which belongs to the
- same particular root executable or shared library file. */
-
-static void __do_global_dtors ()
-asm ("__do_global_dtors") __attribute__ ((section (".text")));
-
-static void
-__do_global_dtors ()
-{
- func_ptr *p;
-
- for (p = __DTOR_LIST__ + 1; *p; p++)
- (*p) ();
-}
-
-/* .init section start.
- This must appear at the start of the .init section. */
-
-asm ("
- .section .init,\"ax\",@progbits
- .balign 4
- .global __init
-__init:
- push fp
- push lr
- mv fp,sp
- ld24 r0,#__fini
- bl atexit
- .fillinsn
-");
-
-/* .fini section start.
- This must appear at the start of the .init section. */
-
-asm ("
- .section .fini,\"ax\",@progbits
- .balign 4
- .global __fini
-__fini:
- push fp
- push lr
- mv fp,sp
- bl __do_global_dtors
- .fillinsn
-");
-
-#endif /* CRT_INIT */
-
-#ifdef CRT_FINI
-
-/* Put a word containing zero at the end of each of our two lists of function
- addresses. Note that the words defined here go into the .ctors and .dtors
- sections of the crtend.o file, and since that file is always linked in
- last, these words naturally end up at the very ends of the two lists
- contained in these two sections. */
-
-static func_ptr __CTOR_END__[1]
- __attribute__ ((section (".ctors")))
- = { (func_ptr) 0 };
-
-static func_ptr __DTOR_END__[1]
- __attribute__ ((section (".dtors")))
- = { (func_ptr) 0 };
-
-/* Run all global constructors for the program.
- Note that they are run in reverse order. */
-
-static void __do_global_ctors ()
-asm ("__do_global_ctors") __attribute__ ((section (".text")));
-
-static void
-__do_global_ctors ()
-{
- func_ptr *p;
-
- for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
- (*p) ();
-}
-
-/* .init section end.
- This must live at the end of the .init section. */
-
-asm ("
- .section .init,\"ax\",@progbits
- bl __do_global_ctors
- mv sp,fp
- pop lr
- pop fp
- jmp lr
- .fillinsn
-");
-
-/* .fini section end.
- This must live at the end of the .fini section. */
-
-asm ("
- .section .fini,\"ax\",@progbits
- mv sp,fp
- pop lr
- pop fp
- jmp lr
- .fillinsn
-");
-
-#endif /* CRT_FINI */
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
deleted file mode 100644
index b915553fa9e..00000000000
--- a/gcc/config/m32r/m32r.c
+++ /dev/null
@@ -1,1815 +0,0 @@
-/* Subroutines used for code generation on the M32R/D cpu.
- Copyright (C) 1996, 1997 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. */
-
-#include <stdio.h>
-#include "config.h"
-#include "tree.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "expr.h"
-#include "recog.h"
-
-/* Save the operands last given to a compare for use when we
- generate a scc or bcc insn. */
-rtx m32r_compare_op0, m32r_compare_op1;
-
-/* Array of valid operand punctuation characters. */
-char m32r_punct_chars[256];
-
-static void init_reg_tables ();
-
-/* Selected code model. */
-char *m32r_model_string = M32R_MODEL_DEFAULT;
-enum m32r_model m32r_model;
-
-/* Selected SDA support. */
-char *m32r_sdata_string = M32R_SDATA_DEFAULT;
-enum m32r_sdata m32r_sdata;
-
-/* Called by OVERRIDE_OPTIONS to initialize various things. */
-
-void
-m32r_init ()
-{
- init_reg_tables ();
-
- /* Initialize array for PRINT_OPERAND_PUNCT_VALID_P. */
- memset (m32r_punct_chars, 0, sizeof (m32r_punct_chars));
- m32r_punct_chars['#'] = 1;
- m32r_punct_chars['@'] = 1; /* ??? no longer used */
-
- /* Provide default value if not specified. */
- if (!g_switch_set)
- g_switch_value = SDATA_DEFAULT_SIZE;
-
- if (strcmp (m32r_model_string, "small") == 0)
- m32r_model = M32R_MODEL_SMALL;
- else if (strcmp (m32r_model_string, "medium") == 0)
- m32r_model = M32R_MODEL_MEDIUM;
- else if (strcmp (m32r_model_string, "large") == 0)
- m32r_model = M32R_MODEL_LARGE;
- else
- error ("bad value (%s) for -mmodel switch", m32r_model_string);
-
- if (strcmp (m32r_sdata_string, "none") == 0)
- m32r_sdata = M32R_SDATA_NONE;
- else if (strcmp (m32r_sdata_string, "sdata") == 0)
- m32r_sdata = M32R_SDATA_SDATA;
- else if (strcmp (m32r_sdata_string, "use") == 0)
- m32r_sdata = M32R_SDATA_USE;
- else
- error ("bad value (%s) for -msdata switch", m32r_sdata_string);
-}
-
-/* Vectors to keep interesting information about registers where it can easily
- be got. We use to use the actual mode value as the bit number, but there
- is (or may be) more than 32 modes now. Instead we use two tables: one
- indexed by hard register number, and one indexed by mode. */
-
-/* The purpose of m32r_mode_class is to shrink the range of modes so that
- they all fit (as bit numbers) in a 32 bit word (again). Each real mode is
- mapped into one m32r_mode_class mode. */
-
-enum m32r_mode_class {
- C_MODE,
- S_MODE, D_MODE, T_MODE, O_MODE,
- SF_MODE, DF_MODE, TF_MODE, OF_MODE
-};
-
-/* Modes for condition codes. */
-#define C_MODES (1 << (int) C_MODE)
-
-/* Modes for single-word and smaller quantities. */
-#define S_MODES ((1 << (int) S_MODE) | (1 << (int) SF_MODE))
-
-/* Modes for double-word and smaller quantities. */
-#define D_MODES (S_MODES | (1 << (int) D_MODE) | (1 << DF_MODE))
-
-/* Modes for quad-word and smaller quantities. */
-#define T_MODES (D_MODES | (1 << (int) T_MODE) | (1 << (int) TF_MODE))
-
-/* Value is 1 if register/mode pair is acceptable on arc. */
-
-unsigned int m32r_hard_regno_mode_ok[FIRST_PSEUDO_REGISTER] = {
- T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES,
- T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, S_MODES, S_MODES, S_MODES,
- S_MODES, C_MODES
-};
-
-unsigned int m32r_mode_class [NUM_MACHINE_MODES];
-
-enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
-
-static void
-init_reg_tables ()
-{
- int i;
-
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- {
- switch (GET_MODE_CLASS (i))
- {
- case MODE_INT:
- case MODE_PARTIAL_INT:
- case MODE_COMPLEX_INT:
- if (GET_MODE_SIZE (i) <= 4)
- m32r_mode_class[i] = 1 << (int) S_MODE;
- else if (GET_MODE_SIZE (i) == 8)
- m32r_mode_class[i] = 1 << (int) D_MODE;
- else if (GET_MODE_SIZE (i) == 16)
- m32r_mode_class[i] = 1 << (int) T_MODE;
- else if (GET_MODE_SIZE (i) == 32)
- m32r_mode_class[i] = 1 << (int) O_MODE;
- else
- m32r_mode_class[i] = 0;
- break;
- case MODE_FLOAT:
- case MODE_COMPLEX_FLOAT:
- if (GET_MODE_SIZE (i) <= 4)
- m32r_mode_class[i] = 1 << (int) SF_MODE;
- else if (GET_MODE_SIZE (i) == 8)
- m32r_mode_class[i] = 1 << (int) DF_MODE;
- else if (GET_MODE_SIZE (i) == 16)
- m32r_mode_class[i] = 1 << (int) TF_MODE;
- else if (GET_MODE_SIZE (i) == 32)
- m32r_mode_class[i] = 1 << (int) OF_MODE;
- else
- m32r_mode_class[i] = 0;
- break;
- case MODE_CC:
- default:
- /* mode_class hasn't been initialized yet for EXTRA_CC_MODES, so
- we must explicitly check for them here. */
- if (i == (int) CCmode)
- m32r_mode_class[i] = 1 << (int) C_MODE;
- else
- m32r_mode_class[i] = 0;
- break;
- }
- }
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (GPR_P (i))
- m32r_regno_reg_class[i] = GENERAL_REGS;
- else if (i == ARG_POINTER_REGNUM)
- m32r_regno_reg_class[i] = GENERAL_REGS;
- else
- m32r_regno_reg_class[i] = NO_REGS;
- }
-}
-
-/* M32R specific attribute support.
-
- interrupt - for interrupt functions
-
- model - select code model used to access object
-
- small: addresses use 24 bits, use bl to make calls
- medium: addresses use 32 bits, use bl to make calls
- large: addresses use 32 bits, use seth/add3/jl to make calls
-
- Grep for MODEL in m32r.h for more info.
-*/
-
-/* Return nonzero if IDENTIFIER is a valid decl attribute. */
-
-int
-m32r_valid_machine_decl_attribute (type, attributes, identifier, args)
- tree type;
- tree attributes;
- tree identifier;
- tree args;
-{
- static tree interrupt_ident, model_ident;
- static tree small_ident, medium_ident, large_ident;
-
- if (interrupt_ident == 0)
- {
- interrupt_ident = get_identifier ("__interrupt__");
- model_ident = get_identifier ("__model__");
- small_ident = get_identifier ("__small__");
- medium_ident = get_identifier ("__medium__");
- large_ident = get_identifier ("__large__");
- }
-
- if (identifier == interrupt_ident
- && list_length (args) == 0)
- return 1;
-
- if (identifier == model_ident
- && list_length (args) == 1
- && (TREE_VALUE (args) == small_ident
- || TREE_VALUE (args) == medium_ident
- || TREE_VALUE (args) == large_ident))
- return 1;
-
- return 0;
-}
-
-/* Return zero if TYPE1 and TYPE are incompatible, one if they are compatible,
- and two if they are nearly compatible (which causes a warning to be
- generated). */
-
-int
-m32r_comp_type_attributes (type1, type2)
- tree type1, type2;
-{
- return 1;
-}
-
-/* Set the default attributes for TYPE. */
-
-void
-m32r_set_default_type_attributes (type)
- tree type;
-{
-}
-
-/* A C statement or statements to switch to the appropriate
- section for output of DECL. DECL is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether forming
- the initial value of DECL requires link-time relocations. */
-
-void
-m32r_select_section (decl, reloc)
- tree decl;
- int reloc;
-{
- if (TREE_CODE (decl) == STRING_CST)
- {
- if (! flag_writable_strings)
- const_section ();
- else
- data_section ();
- }
- else if (TREE_CODE (decl) == VAR_DECL)
- {
- if (SDATA_NAME_P (XSTR (XEXP (DECL_RTL (decl), 0), 0)))
- sdata_section ();
- else if ((flag_pic && reloc)
- || !TREE_READONLY (decl)
- || TREE_SIDE_EFFECTS (decl)
- || !DECL_INITIAL (decl)
- || (DECL_INITIAL (decl) != error_mark_node
- && !TREE_CONSTANT (DECL_INITIAL (decl))))
- data_section ();
- else
- const_section ();
- }
- else
- const_section ();
-}
-
-/* Encode section information of DECL, which is either a VAR_DECL,
- FUNCTION_DECL, STRING_CST, CONSTRUCTOR, or ???.
-
- For the M32R we want to record:
-
- - whether the object lives in .sdata/.sbss.
- objects living in .sdata/.sbss are prefixed with SDATA_FLAG_CHAR
-
- - what code model should be used to access the object
- small: recorded with no flag - for space efficiency since they'll
- be the most common
- medium: prefixed with MEDIUM_FLAG_CHAR
- large: prefixed with LARGE_FLAG_CHAR
-*/
-
-void
-m32r_encode_section_info (decl)
- tree decl;
-{
- char prefix = 0;
- tree model = 0;
-
- switch (TREE_CODE (decl))
- {
- case VAR_DECL :
- case FUNCTION_DECL :
- model = lookup_attribute ("model", DECL_MACHINE_ATTRIBUTES (decl));
- break;
- case STRING_CST :
- case CONSTRUCTOR :
- /* ??? document all others that can appear here */
- default :
- return;
- }
-
- /* Only mark the object as being small data area addressable if
- it hasn't been explicitly marked with a code model.
-
- The user can explicitly put an object in the small data area with the
- section attribute. If the object is in sdata/sbss and marked with a
- code model do both [put the object in .sdata and mark it as being
- addressed with a specific code model - don't mark it as being addressed
- with an SDA reloc though]. This is ok and might be useful at times. If
- the object doesn't fit the linker will give an error. */
-
- if (! model)
- {
- if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd'
- && DECL_SECTION_NAME (decl) != NULL_TREE)
- {
- char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
- if (! strcmp (name, ".sdata") || ! strcmp (name, ".sbss"))
- {
-#if 0 /* ??? There's no reason to disallow this, is there? */
- if (TREE_READONLY (decl))
- error_with_decl (decl, "const objects cannot go in .sdata/.sbss");
-#endif
- prefix = SDATA_FLAG_CHAR;
- }
- }
- else
- {
- if (TREE_CODE (decl) == VAR_DECL
- && ! TREE_READONLY (decl)
- && ! TARGET_SDATA_NONE)
- {
- int size = int_size_in_bytes (TREE_TYPE (decl));
-
- if (size > 0 && size <= g_switch_value)
- prefix = SDATA_FLAG_CHAR;
- }
- }
- }
-
- /* If data area not decided yet, check for a code model. */
- if (prefix == 0)
- {
- if (model)
- {
- if (TREE_VALUE (TREE_VALUE (model)) == get_identifier ("__small__"))
- ; /* don't mark the symbol specially */
- else if (TREE_VALUE (TREE_VALUE (model)) == get_identifier ("__medium__"))
- prefix = MEDIUM_FLAG_CHAR;
- else if (TREE_VALUE (TREE_VALUE (model)) == get_identifier ("__large__"))
- prefix = LARGE_FLAG_CHAR;
- else
- abort (); /* shouldn't happen */
- }
- else
- {
- if (TARGET_MODEL_SMALL)
- ; /* don't mark the symbol specially */
- else if (TARGET_MODEL_MEDIUM)
- prefix = MEDIUM_FLAG_CHAR;
- else if (TARGET_MODEL_LARGE)
- prefix = LARGE_FLAG_CHAR;
- else
- abort (); /* shouldn't happen */
- }
- }
-
- if (prefix != 0)
- {
- rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd'
- ? TREE_CST_RTL (decl) : DECL_RTL (decl));
- char *str = XSTR (XEXP (rtl, 0), 0);
- int len = strlen (str);
- char *newstr = savealloc (len + 2);
- strcpy (newstr + 1, str);
- *newstr = prefix;
- XSTR (XEXP (rtl, 0), 0) = newstr;
- }
-}
-
-/* Do anything needed before RTL is emitted for each function. */
-
-void
-m32r_init_expanders ()
-{
- /* ??? At one point there was code here. The function is left in
- to make it easy to experiment. */
-}
-
-/* Acceptable arguments to the call insn. */
-
-int
-call_address_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (symbolic_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && LEGITIMATE_CONSTANT_P (op))
- || (GET_CODE (op) == REG));
-}
-
-int
-call_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != MEM)
- return 0;
- op = XEXP (op, 0);
- return call_address_operand (op, mode);
-}
-
-/* Returns 1 if OP is a symbol reference. */
-
-int
-symbolic_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST :
- return 1;
- default:
- return 0;
- }
-}
-
-/* Return truth value of statement that OP is a symbolic memory
- operand of mode MODE. */
-
-int
-symbolic_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
- if (GET_CODE (op) != MEM)
- return 0;
- op = XEXP (op, 0);
- return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST
- || GET_CODE (op) == LABEL_REF);
-}
-
-/* Return 1 if OP is a reference to an object in .sdata/.sbss. */
-
-int
-small_data_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (! TARGET_SDATA_USE)
- return 0;
-
- if (GET_CODE (op) == SYMBOL_REF)
- return SDATA_NAME_P (XSTR (op, 0));
-
- if (GET_CODE (op) == CONST
- && GET_CODE (XEXP (op, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT
- && INT16_P (INTVAL (XEXP (XEXP (op, 0), 1))))
- return SDATA_NAME_P (XSTR (XEXP (XEXP (op, 0), 0), 0));
-
- return 0;
-}
-
-/* Return 1 if OP is a symbol that can use 24 bit addressing. */
-
-int
-addr24_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == LABEL_REF)
- return TARGET_ADDR24;
-
- if (GET_CODE (op) == SYMBOL_REF)
- return (SMALL_NAME_P (XSTR (op, 0))
- || (TARGET_ADDR24
- && CONSTANT_POOL_ADDRESS_P (op)));
-
- if (GET_CODE (op) == CONST
- && GET_CODE (XEXP (op, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT
- && UINT24_P (INTVAL (XEXP (XEXP (op, 0), 1))))
- {
- rtx sym = XEXP (XEXP (op, 0), 0);
- return (SMALL_NAME_P (XSTR (sym, 0))
- || (TARGET_ADDR24
- && CONSTANT_POOL_ADDRESS_P (op)));
- }
-
- return 0;
-}
-
-/* Return 1 if OP is a symbol that needs 32 bit addressing. */
-
-int
-addr32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == LABEL_REF)
- return TARGET_ADDR32;
-
- if (GET_CODE (op) == SYMBOL_REF)
- return (! addr24_operand (op)
- && ! small_data_operand (op));
-
- if (GET_CODE (op) == CONST
- && GET_CODE (XEXP (op, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT)
- {
- return (! addr24_operand (op)
- && ! small_data_operand (op));
- }
-
- return 0;
-}
-
-/* Return 1 if OP is a function that can be called with the `bl' insn. */
-
-int
-call26_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == SYMBOL_REF)
- return ! LARGE_NAME_P (XSTR (op, 0));
-
- return TARGET_CALL26;
-}
-
-/* Return 1 if OP is a function that must be called with 32 bit addressing. */
-
-int
-call32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ! call26_operand (op, mode);
-}
-
-/* Returns 1 if OP is an acceptable operand for seth/add3. */
-
-int
-seth_add3_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == SYMBOL_REF
- || GET_CODE (op) == LABEL_REF)
- return 1;
-
- if (GET_CODE (op) == CONST
- && GET_CODE (XEXP (op, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT
- && INT16_P (INTVAL (XEXP (XEXP (op, 0), 1))))
- return 1;
-
- return 0;
-}
-
-/* Return true if OP is a signed 8 bit immediate value. */
-
-int
-int8_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != CONST_INT)
- return 0;
- return INT8_P (INTVAL (op));
-}
-
-/* Return true if OP is a signed 16 bit immediate value. */
-
-int
-int16_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != CONST_INT)
- return 0;
- return INT16_P (INTVAL (op));
-}
-
-/* Return true if OP is a signed 16 bit immediate value
- useful in comparisons. */
-
-int
-cmp_int16_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != CONST_INT)
- return 0;
- return CMP_INT16_P (INTVAL (op));
-}
-
-/* Return true if OP is an unsigned 16 bit immediate value. */
-
-int
-uint16_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != CONST_INT)
- return 0;
- return UINT16_P (INTVAL (op));
-}
-
-/* Return true if OP is an unsigned 24 bit immediate value. */
-
-int
-uint24_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != CONST_INT)
- return 0;
- return UINT24_P (INTVAL (op));
-}
-
-/* Return true if OP is a register or signed 8 bit value. */
-
-int
-reg_or_int8_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == REG || GET_CODE (op) == SUBREG)
- return register_operand (op, mode);
- if (GET_CODE (op) != CONST_INT)
- return 0;
- return INT8_P (INTVAL (op));
-}
-
-/* Return true if OP is a register or signed 8 bit value. */
-
-int
-reg_or_int16_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == REG || GET_CODE (op) == SUBREG)
- return register_operand (op, mode);
- if (GET_CODE (op) != CONST_INT)
- return 0;
- return INT16_P (INTVAL (op));
-}
-
-/* Return true if OP is a register or signed 8 bit value. */
-
-int
-reg_or_uint16_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == REG || GET_CODE (op) == SUBREG)
- return register_operand (op, mode);
- if (GET_CODE (op) != CONST_INT)
- return 0;
- return UINT16_P (INTVAL (op));
-}
-
-/* Return true if OP is a register or signed 16 bit value for compares. */
-
-int
-reg_or_cmp_int16_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == REG || GET_CODE (op) == SUBREG)
- return register_operand (op, mode);
- if (GET_CODE (op) != CONST_INT)
- return 0;
- return CMP_INT16_P (INTVAL (op));
-}
-
-/* Return true if OP is an acceptable argument for a single word
- move source. */
-
-int
-move_src_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF :
- case CONST :
- return addr24_operand (op, mode);
- case CONST_INT :
- /* FIXME: We allow more cse opportunities if we only allow constants
- loadable with one insn, and split the rest into two. */
- return INT32_P (INTVAL (op));
- case LABEL_REF :
- return TARGET_ADDR24;
- case CONST_DOUBLE :
- if (mode == SFmode)
- return 1;
- else if (mode == SImode)
- {
- /* Large unsigned constants are represented as const_double's. */
- unsigned HOST_WIDE_INT low, high;
-
- low = CONST_DOUBLE_LOW (op);
- high = CONST_DOUBLE_HIGH (op);
- return high == 0 && low <= 0xffffffff;
- }
- else
- return 0;
- case REG :
- return register_operand (op, mode);
- case SUBREG :
- /* (subreg (mem ...) ...) can occur here if the inner part was once a
- pseudo-reg and is now a stack slot. */
- if (GET_CODE (SUBREG_REG (op)) == MEM)
- return address_operand (XEXP (SUBREG_REG (op), 0), mode);
- else
- return register_operand (op, mode);
- case MEM :
- return address_operand (XEXP (op, 0), mode);
- default :
- return 0;
- }
-}
-
-/* Return true if OP is an acceptable argument for a double word
- move source. */
-
-int
-move_double_src_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case CONST_INT :
- case CONST_DOUBLE :
- if (mode == DFmode)
- return easy_df_const (op);
- else
- return easy_di_const (op);
- case REG :
- return register_operand (op, mode);
- case SUBREG :
- /* (subreg (mem ...) ...) can occur here if the inner part was once a
- pseudo-reg and is now a stack slot. */
- if (GET_CODE (SUBREG_REG (op)) == MEM)
- return move_double_src_operand (SUBREG_REG (op), mode);
- else
- return register_operand (op, mode);
- case MEM :
- /* Disallow auto inc/dec for now. */
- if (GET_CODE (XEXP (op, 0)) == PRE_DEC
- || GET_CODE (XEXP (op, 0)) == PRE_INC)
- return 0;
- return address_operand (XEXP (op, 0), mode);
- default :
- return 0;
- }
-}
-
-/* Return true if OP is an acceptable argument for a move destination. */
-
-int
-move_dest_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case REG :
- return register_operand (op, mode);
- case SUBREG :
- /* (subreg (mem ...) ...) can occur here if the inner part was once a
- pseudo-reg and is now a stack slot. */
- if (GET_CODE (SUBREG_REG (op)) == MEM)
- return address_operand (XEXP (SUBREG_REG (op), 0), mode);
- else
- return register_operand (op, mode);
- case MEM :
- return address_operand (XEXP (op, 0), mode);
- default :
- return 0;
- }
-}
-
-/* Return 1 if OP is a DImode const we want to handle inline.
- This must match the code in the movdi pattern.
- It is used by the 'G' CONST_DOUBLE_OK_FOR_LETTER. */
-
-int
-easy_di_const (op)
- rtx op;
-{
- rtx high_rtx, low_rtx;
- HOST_WIDE_INT high, low;
-
- split_double (op, &high_rtx, &low_rtx);
- high = INTVAL (high_rtx);
- low = INTVAL (low_rtx);
- /* Pick constants loadable with 2 16 bit `ldi' insns. */
- if (high >= -128 && high <= 127
- && low >= -128 && low <= 127)
- return 1;
- return 0;
-}
-
-/* Return 1 if OP is a DFmode const we want to handle inline.
- This must match the code in the movdf pattern.
- It is used by the 'H' CONST_DOUBLE_OK_FOR_LETTER. */
-
-int
-easy_df_const (op)
- rtx op;
-{
- REAL_VALUE_TYPE r;
- long l[2];
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, op);
- REAL_VALUE_TO_TARGET_DOUBLE (r, l);
- if (l[0] == 0 && l[1] == 0)
- return 1;
- if ((l[0] & 0xffff) == 0 && l[1] == 0)
- return 1;
- return 0;
-}
-
-/* Return 1 if OP is an EQ or NE comparison operator. */
-
-int
-eqne_comparison_operator (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (op);
-
- if (GET_RTX_CLASS (code) != '<')
- return 0;
- return (code == EQ || code == NE);
-}
-
-/* Return 1 if OP is a signed comparison operator. */
-
-int
-signed_comparison_operator (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (op);
-
- if (GET_RTX_CLASS (code) != '<')
- return 0;
- return (code == EQ || code == NE
- || code == LT || code == LE || code == GT || code == GE);
-}
-
-/* Return 1 if OP is (mem (reg ...)).
- This is used in insn length calcs. */
-
-int
-memreg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == REG;
-}
-
-/* Comparisons. */
-
-/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
- return the mode to be used for the comparison. */
-
-enum machine_mode
-m32r_select_cc_mode (op, x, y)
- enum rtx_code op;
- rtx x, y;
-{
- return CCmode;
-}
-
-/* X and Y are two things to compare using CODE. Emit the compare insn and
- return the rtx for compare [arg0 of the if_then_else]. */
-
-rtx
-gen_compare (code, x, y)
- enum rtx_code code;
- rtx x, y;
-{
- enum machine_mode mode = SELECT_CC_MODE (code, x, y);
- enum rtx_code compare_code, branch_code;
- rtx cc_reg = gen_rtx (REG, mode, CARRY_REGNUM);
- int swap_p = 0;
-
- switch (code)
- {
- case EQ: compare_code = EQ; branch_code = NE; break;
- case NE: compare_code = EQ; branch_code = EQ; break;
- case LT: compare_code = LT; branch_code = NE; break;
- case LE: compare_code = LT; branch_code = EQ; swap_p = 1; break;
- case GT: compare_code = LT; branch_code = NE; swap_p = 1; break;
- case GE: compare_code = LT; branch_code = EQ; break;
- case LTU: compare_code = LTU; branch_code = NE; break;
- case LEU: compare_code = LTU; branch_code = EQ; swap_p = 1; break;
- case GTU: compare_code = LTU; branch_code = NE; swap_p = 1; break;
- case GEU: compare_code = LTU; branch_code = EQ; break;
- }
-
- if (! TARGET_OLD_COMPARE)
- {
- /* reg/reg equal comparison */
- if (compare_code == EQ
- && register_operand (y, SImode))
- return gen_rtx (code, mode, x, y);
- /* reg/zero signed comparison */
- if ((compare_code == EQ || compare_code == LT)
- && y == const0_rtx)
- return gen_rtx (code, mode, x, y);
- /* reg/smallconst equal comparison */
- if (compare_code == EQ
- && GET_CODE (y) == CONST_INT
- && CMP_INT16_P (INTVAL (y)))
- {
- rtx tmp = gen_reg_rtx (SImode);
- emit_insn (gen_cmp_ne_small_const_insn (tmp, x, y));
- return gen_rtx (code, mode, tmp, const0_rtx);
- }
- /* reg/const equal comparison */
- if (compare_code == EQ
- && CONSTANT_P (y))
- {
- rtx tmp = force_reg (GET_MODE (x), y);
- return gen_rtx (code, mode, x, tmp);
- }
- }
-
- if (swap_p && CONSTANT_P (y))
- y = force_reg (GET_MODE (x), y);
- else if (CONSTANT_P (y))
- {
- int ok_const_p =
- (code == LTU || code == LEU || code == GTU || code == GEU)
- ? uint16_operand (y, GET_MODE (y))
- : reg_or_cmp_int16_operand (y, GET_MODE (y));
- if (! ok_const_p)
- y = force_reg (GET_MODE (x), y);
- }
-
- switch (compare_code)
- {
- case EQ :
- emit_insn (gen_cmp_eqsi_insn (swap_p ? y : x, swap_p ? x : y));
- break;
- case LT :
- emit_insn (gen_cmp_ltsi_insn (swap_p ? y : x, swap_p ? x : y));
- break;
- case LTU :
- emit_insn (gen_cmp_ltusi_insn (swap_p ? y : x, swap_p ? x : y));
- break;
- }
-
- return gen_rtx (branch_code, VOIDmode, cc_reg, CONST0_RTX (mode));
-}
-
-/* Implements the FUNCTION_ARG_PARTIAL_NREGS macro. */
-
-int
-function_arg_partial_nregs (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- int ret;
- int size = (((mode == BLKmode && type)
- ? int_size_in_bytes (type)
- : GET_MODE_SIZE (mode)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
-
- if (*cum >= M32R_MAX_PARM_REGS)
- ret = 0;
- else if (*cum + size > M32R_MAX_PARM_REGS)
- ret = (*cum + size) - M32R_MAX_PARM_REGS;
- else
- ret = 0;
-
- return ret;
-}
-
-/* Do any needed setup for a variadic function. For the M32R, we must
- create a register parameter block, and then copy any anonymous arguments
- in registers to memory.
-
- CUM has not been updated for the last named argument which has type TYPE
- and mode MODE, and we rely on this fact. */
-
-void
-m32r_setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int *pretend_size;
- int no_rtl;
-{
- int first_anon_arg;
-
- if (no_rtl)
- return;
-
- /* All BLKmode values are passed by reference. */
- if (mode == BLKmode)
- abort ();
-
- /* We must treat `__builtin_va_alist' as an anonymous arg. */
- if (current_function_varargs)
- first_anon_arg = *cum;
- else
- first_anon_arg = (ROUND_ADVANCE_CUM (*cum, mode, type)
- + ROUND_ADVANCE_ARG (mode, type));
-
- if (first_anon_arg < M32R_MAX_PARM_REGS)
- {
- /* Note that first_reg_offset < M32R_MAX_PARM_REGS. */
- int first_reg_offset = first_anon_arg;
- /* Size in words to "pretend" allocate. */
- int size = M32R_MAX_PARM_REGS - first_reg_offset;
- rtx regblock;
-
- regblock = gen_rtx (MEM, BLKmode,
- plus_constant (arg_pointer_rtx,
- FIRST_PARM_OFFSET (0)));
- move_block_from_reg (first_reg_offset, regblock,
- size, size * UNITS_PER_WORD);
-
- *pretend_size = (size * UNITS_PER_WORD);
- }
-}
-
-/* Implements EXPAND_BUILTIN_SAVEREGS macro. */
-/* FIXME: Not currently used ('cus it might be unnecessary). */
-
-struct rtx_def *
-m32r_expand_builtin_saveregs (args)
- tree args;
-{
- return gen_rtx (PLUS, Pmode,
- virtual_incoming_args_rtx,
- GEN_INT (- UNITS_PER_WORD * M32R_MAX_PARM_REGS));
-}
-
-/* Cost functions. */
-
-/* Provide the costs of an addressing mode that contains ADDR.
- If ADDR is not a valid address, its cost is irrelevant.
-
- This function is trivial at the moment. This code doesn't live
- in m32r.h so it's easy to experiment. */
-
-int
-m32r_address_cost (addr)
- rtx addr;
-{
- return 1;
-}
-
-/* Type of function DECL.
-
- The result is cached. To reset the cache at the end of a function,
- call with DECL = NULL_TREE. */
-
-enum m32r_function_type
-m32r_compute_function_type (decl)
- tree decl;
-{
- /* Cached value. */
- static enum m32r_function_type fn_type = M32R_FUNCTION_UNKNOWN;
- /* Last function we were called for. */
- static tree last_fn = NULL_TREE;
-
- /* Resetting the cached value? */
- if (decl == NULL_TREE)
- {
- fn_type = M32R_FUNCTION_UNKNOWN;
- last_fn = NULL_TREE;
- return fn_type;
- }
-
- if (decl == last_fn && fn_type != M32R_FUNCTION_UNKNOWN)
- return fn_type;
-
- /* Compute function type. */
- fn_type = (lookup_attribute ("interrupt", DECL_MACHINE_ATTRIBUTES (current_function_decl)) != NULL_TREE
- ? M32R_FUNCTION_INTERRUPT
- : M32R_FUNCTION_NORMAL);
-
- last_fn = decl;
- return fn_type;
-}
- /* Function prologue/epilogue handlers. */
-
-/* M32R stack frames look like:
-
- Before call After call
- +-----------------------+ +-----------------------+
- | | | |
- high | local variables, | | local variables, |
- mem | reg save area, etc. | | reg save area, etc. |
- | | | |
- +-----------------------+ +-----------------------+
- | | | |
- | arguments on stack. | | arguments on stack. |
- | | | |
- SP+0->+-----------------------+ +-----------------------+
- | reg parm save area, |
- | only created for |
- | variable argument |
- | functions |
- +-----------------------+
- | previous frame ptr |
- +-----------------------+
- | |
- | register save area |
- | |
- +-----------------------+
- | return address |
- +-----------------------+
- | |
- | local variables |
- | |
- +-----------------------+
- | |
- | alloca allocations |
- | |
- +-----------------------+
- | |
- low | arguments on stack |
- memory | |
- SP+0->+-----------------------+
-
-Notes:
-1) The "reg parm save area" does not exist for non variable argument fns.
-2) The "reg parm save area" can be eliminated completely if we saved regs
- containing anonymous args separately but that complicates things too
- much (so it's not done).
-3) The return address is saved after the register save area so as to have as
- many insns as possible between the restoration of `lr' and the `jmp lr'.
-*/
-
-/* Structure to be filled in by m32r_compute_frame_size with register
- save masks, and offsets for the current function. */
-struct m32r_frame_info
-{
- unsigned int total_size; /* # bytes that the entire frame takes up */
- unsigned int extra_size; /* # bytes of extra stuff */
- unsigned int pretend_size; /* # bytes we push and pretend caller did */
- unsigned int args_size; /* # bytes that outgoing arguments take up */
- unsigned int reg_size; /* # bytes needed to store regs */
- unsigned int var_size; /* # bytes that variables take up */
- unsigned int gmask; /* mask of saved gp registers */
- unsigned int save_fp; /* nonzero if fp must be saved */
- unsigned int save_lr; /* nonzero if lr (return addr) must be saved */
- int initialized; /* nonzero if frame size already calculated */
-};
-
-/* Current frame information calculated by m32r_compute_frame_size. */
-static struct m32r_frame_info current_frame_info;
-
-/* Zero structure to initialize current_frame_info. */
-static struct m32r_frame_info zero_frame_info;
-
-#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
-#define RETURN_ADDR_MASK (1 << (RETURN_ADDR_REGNUM))
-
-/* Tell prologue and epilogue if register REGNO should be saved / restored.
- The return address and frame pointer are treated separately.
- Don't consider them here. */
-#define MUST_SAVE_REGISTER(regno, interrupt_p) \
-((regno) != RETURN_ADDR_REGNUM && (regno) != FRAME_POINTER_REGNUM \
- && (regs_ever_live[regno] && (!call_used_regs[regno] || interrupt_p)))
-
-#define MUST_SAVE_FRAME_POINTER (regs_ever_live[FRAME_POINTER_REGNUM])
-#define MUST_SAVE_RETURN_ADDR (regs_ever_live[RETURN_ADDR_REGNUM])
-
-/* Return the bytes needed to compute the frame pointer from the current
- stack pointer.
-
- SIZE is the size needed for local variables. */
-
-unsigned int
-m32r_compute_frame_size (size)
- int size; /* # of var. bytes allocated. */
-{
- int regno;
- unsigned int total_size, var_size, args_size, pretend_size, extra_size;
- unsigned int reg_size;
- unsigned int gmask;
- enum m32r_function_type fn_type;
- int interrupt_p;
-
- var_size = M32R_STACK_ALIGN (size);
- args_size = M32R_STACK_ALIGN (current_function_outgoing_args_size);
- pretend_size = current_function_pretend_args_size;
- extra_size = FIRST_PARM_OFFSET (0);
- total_size = extra_size + pretend_size + args_size + var_size;
- reg_size = 0;
- gmask = 0;
-
- /* See if this is an interrupt handler. Call used registers must be saved
- for them too. */
- fn_type = m32r_compute_function_type (current_function_decl);
- interrupt_p = M32R_INTERRUPT_P (fn_type);
-
- /* Calculate space needed for registers. */
-
- for (regno = 0; regno < M32R_MAX_INT_REGS; regno++)
- {
- if (MUST_SAVE_REGISTER (regno, interrupt_p))
- {
- reg_size += UNITS_PER_WORD;
- gmask |= 1 << regno;
- }
- }
-
- current_frame_info.save_fp = MUST_SAVE_FRAME_POINTER;
- current_frame_info.save_lr = MUST_SAVE_RETURN_ADDR;
-
- reg_size += ((current_frame_info.save_fp + current_frame_info.save_lr)
- * UNITS_PER_WORD);
- total_size += reg_size;
-
- /* FIXME: Not sure this is necessary, and I don't think the epilogue
- handler will do the right thing if this changes total_size. */
- total_size = M32R_STACK_ALIGN (total_size);
-
- /* Save computed information. */
- current_frame_info.total_size = total_size;
- current_frame_info.extra_size = extra_size;
- current_frame_info.pretend_size = pretend_size;
- current_frame_info.var_size = var_size;
- current_frame_info.args_size = args_size;
- current_frame_info.reg_size = reg_size;
- current_frame_info.gmask = gmask;
- current_frame_info.initialized = reload_completed;
-
- /* Ok, we're done. */
- return total_size;
-}
-
-/* Set up the stack and frame pointer (if desired) for the function. */
-
-void
-m32r_output_function_prologue (file, size)
- FILE *file;
- int size;
-{
- int regno;
- int total_size, frame_size;
- char *sp_str = reg_names[STACK_POINTER_REGNUM];
- char *fp_str = reg_names[FRAME_POINTER_REGNUM];
- unsigned int gmask = current_frame_info.gmask;
- enum m32r_function_type fn_type = m32r_compute_function_type (current_function_decl);
-
- /* If this is an interrupt handler, mark it as such. */
- if (M32R_INTERRUPT_P (fn_type))
- {
- fprintf (file, "\t%s interrupt handler\n",
- ASM_COMMENT_START);
- }
-
- /* This is only for the human reader. */
- fprintf (file, "\t%s BEGIN PROLOGUE %s vars= %d, regs= %d, args= %d, extra= %d\n",
- ASM_COMMENT_START, ASM_COMMENT_START,
- current_frame_info.var_size,
- current_frame_info.reg_size / 4,
- current_frame_info.args_size,
- current_frame_info.extra_size);
-
- total_size = (! current_frame_info.initialized
- ? m32r_compute_frame_size (size)
- : current_frame_info.total_size);
-
- /* These cases shouldn't happen. Catch them now. */
- if (total_size == 0 && gmask)
- abort ();
-
-#if 1
- /* Allocate space for register arguments if this is a variadic function. */
- if (current_frame_info.pretend_size != 0)
- fprintf (file, "\taddi %s,%d\n",
- sp_str, -current_frame_info.pretend_size);
-#else
- /* If there are unnamed args in registers, save them. */
- if (current_function_stdarg || current_function_varargs)
- {
- int i;
- fprintf (file, "\taddi %s,%d\n",
- sp_str, - M32R_MAX_PARM_REGS * UNITS_PER_WORD);
- for (i = 0; i < M32R_MAX_PARM_REGS; ++i)
- fprintf (file, "\tst %s,@(sp,%d)\n",
- reg_names[i], i * UNITS_PER_WORD);
- }
-#endif
-
- /* Save any registers we need to and set up fp. */
-
- if (current_frame_info.save_fp)
- fprintf (file, "\tpush %s\n", fp_str);
-
- gmask &= ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK);
-
- /* Save any needed call-saved regs (and call-used if this is an
- interrupt handler). */
- for (regno = 0; regno <= M32R_MAX_INT_REGS; ++regno)
- {
- if ((gmask & (1 << regno)) != 0)
- fprintf (file, "\tpush %s\n", reg_names[regno]);
- }
-
- if (current_frame_info.save_lr)
- fprintf (file, "\tpush %s\n", reg_names[RETURN_ADDR_REGNUM]);
-
- /* Allocate the stack frame. */
- frame_size = total_size - (current_frame_info.pretend_size
- + current_frame_info.reg_size);
- if (frame_size == 0)
- ; /* nothing to do */
- else if (frame_size <= 128)
- fprintf (file, "\taddi %s,%d\n",
- sp_str, -frame_size);
- else if (frame_size <= 32768)
- fprintf (file, "\tadd3 %s,%s,%d\n",
- sp_str, sp_str, -frame_size);
- else
- fprintf (file, "\tld24 %s,%d\n\tsub %s,%s\n",
- reg_names[PROLOGUE_TMP_REGNUM], frame_size,
- sp_str, reg_names[PROLOGUE_TMP_REGNUM]);
-
- if (frame_pointer_needed)
- fprintf (file, "\tmv %s,%s\n", fp_str, sp_str);
-
- fprintf (file, "\t%s END PROLOGUE\n", ASM_COMMENT_START);
-}
-
-/* Do any necessary cleanup after a function to restore stack, frame,
- and regs. */
-
-void
-m32r_output_function_epilogue (file, size)
- FILE *file;
- int size;
-{
- int regno;
- int noepilogue = FALSE;
- int total_size;
- enum m32r_function_type fn_type = m32r_compute_function_type (current_function_decl);
-
- /* This is only for the human reader. */
- fprintf (file, "\t%s EPILOGUE\n", ASM_COMMENT_START);
-
- if (!current_frame_info.initialized)
- abort ();
- total_size = current_frame_info.total_size;
-
- if (total_size == 0)
- {
- rtx insn = get_last_insn ();
-
- /* If the last insn was a BARRIER, we don't have to write any code
- because a jump (aka return) was put there. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
- if (insn && GET_CODE (insn) == BARRIER)
- noepilogue = TRUE;
- }
-
- if (!noepilogue)
- {
- unsigned int pretend_size = current_frame_info.pretend_size;
- unsigned int frame_size = total_size - pretend_size;
- unsigned int var_size = current_frame_info.var_size;
- unsigned int args_size = current_frame_info.args_size;
- unsigned int gmask = current_frame_info.gmask;
- int can_trust_sp_p = !current_function_calls_alloca;
- char *sp_str = reg_names[STACK_POINTER_REGNUM];
- char *fp_str = reg_names[FRAME_POINTER_REGNUM];
-
- /* The first thing to do is point the sp at the bottom of the register
- save area. */
- if (can_trust_sp_p)
- {
- unsigned int reg_offset = var_size + args_size;
- if (reg_offset == 0)
- ; /* nothing to do */
- else if (reg_offset < 32768)
- fprintf (file, "\tadd3 %s,%s,%d\n",
- sp_str, sp_str, reg_offset);
- else
- fprintf (file, "\tld24 %s,%d\n\tadd %s,%s\n",
- reg_names[PROLOGUE_TMP_REGNUM], reg_offset,
- sp_str, reg_names[PROLOGUE_TMP_REGNUM]);
- }
- else if (frame_pointer_needed)
- {
- unsigned int reg_offset = var_size + args_size;
- if (reg_offset == 0)
- fprintf (file, "\tmv %s,%s\n", sp_str, fp_str);
- else if (reg_offset < 32768)
- fprintf (file, "\tadd3 %s,%s,%d\n",
- sp_str, fp_str, reg_offset);
- else
- fprintf (file, "\tld24 %s,%d\n\tadd %s,%s\n",
- reg_names[PROLOGUE_TMP_REGNUM], reg_offset,
- sp_str, reg_names[PROLOGUE_TMP_REGNUM]);
- }
- else
- abort ();
-
- if (current_frame_info.save_lr)
- fprintf (file, "\tpop %s\n", reg_names[RETURN_ADDR_REGNUM]);
-
- /* Restore any saved registers, in reverse order of course. */
- gmask &= ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK);
- for (regno = M32R_MAX_INT_REGS - 1; regno >= 0; --regno)
- {
- if ((gmask & (1L << regno)) != 0)
- fprintf (file, "\tpop %s\n", reg_names[regno]);
- }
-
- if (current_frame_info.save_fp)
- fprintf (file, "\tpop %s\n", fp_str);
-
- /* Remove varargs area if present. */
-#if 1
- /* FIXME: Must decide whether to use pretend_size or not. */
- if (current_frame_info.pretend_size != 0)
- fprintf (file, "\taddi %s,%d\n",
- sp_str, current_frame_info.pretend_size);
-#else
- /* This is the other way of doing it. */
- if (current_function_stdarg || current_function_varargs)
- fprintf (file, "\taddi %s,%d\n",
- sp_str, M32R_MAX_PARM_REGS * UNITS_PER_WORD);
-#endif
-
- /* Emit the return instruction. */
- if (M32R_INTERRUPT_P (fn_type))
- fprintf (file, "\trte\n");
- else
- fprintf (file, "\tjmp %s\n", reg_names[RETURN_ADDR_REGNUM]);
- }
-
-#if 0 /* no longer needed */
- /* Ensure the function cleanly ends on a 32 bit boundary. */
- fprintf (file, "\t.fillinsn\n");
-#endif
-
- /* Reset state info for each function. */
- current_frame_info = zero_frame_info;
- m32r_compute_function_type (NULL_TREE);
-}
-
-/* PIC */
-
-/* Emit special PIC prologues and epilogues. */
-
-void
-m32r_finalize_pic ()
-{
- /* nothing to do */
-}
-
-/* Nested function support. */
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-void
-m32r_initialize_trampoline (tramp, fnaddr, cxt)
- rtx tramp, fnaddr, cxt;
-{
-}
-
-/* Set the cpu type and print out other fancy things,
- at the top of the file. */
-
-void
-m32r_asm_file_start (file)
- FILE *file;
-{
- if (flag_verbose_asm)
- fprintf (file, "%s M32R/D special options: -G %d\n",
- ASM_COMMENT_START, g_switch_value);
-}
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-void
-m32r_print_operand (file, x, code)
- FILE *file;
- rtx x;
- int code;
-{
- switch (code)
- {
- case 'R' :
- /* Write second word of DImode or DFmode reference,
- register or memory. */
- if (GET_CODE (x) == REG)
- fputs (reg_names[REGNO (x)+1], file);
- else if (GET_CODE (x) == MEM)
- {
- fprintf (file, "@(");
- /* Handle possible auto-increment. Since it is pre-increment and
- we have already done it, we can just use an offset of four. */
- /* ??? This is taken from rs6000.c I think. I don't think it is
- currently necessary, but keep it around. */
- if (GET_CODE (XEXP (x, 0)) == PRE_INC
- || GET_CODE (XEXP (x, 0)) == PRE_DEC)
- output_address (plus_constant (XEXP (XEXP (x, 0), 0), 4));
- else
- output_address (plus_constant (XEXP (x, 0), 4));
- fputc (')', file);
- }
- else
- output_operand_lossage ("invalid operand to %R code");
- return;
-
- case 'H' : /* High word */
- case 'L' : /* Low word */
- if (GET_CODE (x) == REG)
- {
- /* L = least significant word, H = most significant word */
- if ((WORDS_BIG_ENDIAN != 0) ^ (code == 'L'))
- fputs (reg_names[REGNO (x)], file);
- else
- fputs (reg_names[REGNO (x)+1], file);
- }
- else if (GET_CODE (x) == CONST_INT
- || GET_CODE (x) == CONST_DOUBLE)
- {
- rtx first, second;
-
- split_double (x, &first, &second);
- fprintf (file, "0x%08lx",
- code == 'L' ? INTVAL (first) : INTVAL (second));
- }
- else
- output_operand_lossage ("invalid operand to %H/%L code");
- return;
-
- case 'A' :
- {
- REAL_VALUE_TYPE d;
- char str[30];
-
- if (GET_CODE (x) != CONST_DOUBLE
- || GET_MODE_CLASS (GET_MODE (x)) != MODE_FLOAT)
- abort ();
- REAL_VALUE_FROM_CONST_DOUBLE (d, x);
- REAL_VALUE_TO_DECIMAL (d, "%.20e", str);
- fprintf (file, "%s", str);
- return;
- }
-
- case 'B' : /* Bottom half */
- case 'T' : /* Top half */
- /* Output the argument to a `seth' insn (sets the Top half-word).
- For constants output arguments to a seth/or3 pair to set Top and
- Bottom halves. For symbols output arguments to a seth/add3 pair to
- set Top and Bottom halves. The difference exists because for
- constants seth/or3 is more readable but for symbols we need to use
- the same scheme as `ld' and `st' insns (16 bit addend is signed). */
- switch (GET_CODE (x))
- {
- case CONST_INT :
- case CONST_DOUBLE :
- {
- rtx first, second;
-
- split_double (x, &first, &second);
- x = WORDS_BIG_ENDIAN ? second : first;
- fprintf (file,
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- "0x%x",
-#else
- "0x%lx",
-#endif
- (code == 'B'
- ? INTVAL (x) & 0xffff
- : (INTVAL (x) >> 16) & 0xffff));
- }
- return;
- case CONST :
- case SYMBOL_REF :
- if (code == 'B'
- && small_data_operand (x, VOIDmode))
- {
- fputs ("sda(", file);
- output_addr_const (file, x);
- fputc (')', file);
- return;
- }
- /* fall through */
- case LABEL_REF :
- fputs (code == 'T' ? "shigh(" : "low(", file);
- output_addr_const (file, x);
- fputc (')', file);
- return;
- default :
- output_operand_lossage ("invalid operand to %T/%B code");
- return;
- }
- break;
-
- case 'U' :
- /* FIXME: wip */
- /* Output a load/store with update indicator if appropriate. */
- if (GET_CODE (x) == MEM)
- {
- if (GET_CODE (XEXP (x, 0)) == PRE_INC
- || GET_CODE (XEXP (x, 0)) == PRE_DEC)
- fputs (".a", file);
- }
- else
- output_operand_lossage ("invalid operand to %U code");
- return;
-
- case 'N' :
- /* Print a constant value negated. */
- if (GET_CODE (x) == CONST_INT)
- output_addr_const (file, GEN_INT (- INTVAL (x)));
- else
- output_operand_lossage ("invalid operand to %N code");
- return;
-
- case '#' :
- fputs (IMMEDIATE_PREFIX, file);
- return;
-
-#if 0 /* ??? no longer used */
- case '@' :
- fputs (reg_names[SDA_REGNUM], file);
- return;
-#endif
-
- case 0 :
- /* Do nothing special. */
- break;
-
- default :
- /* Unknown flag. */
- output_operand_lossage ("invalid operand output code");
- }
-
- switch (GET_CODE (x))
- {
- case REG :
- fputs (reg_names[REGNO (x)], file);
- break;
-
- case MEM :
- fprintf (file, "@(");
- if (GET_CODE (XEXP (x, 0)) == PRE_INC)
- output_address (plus_constant (XEXP (XEXP (x, 0), 0),
- GET_MODE_SIZE (GET_MODE (x))));
- else if (GET_CODE (XEXP (x, 0)) == PRE_DEC)
- output_address (plus_constant (XEXP (XEXP (x, 0), 0),
- - GET_MODE_SIZE (GET_MODE (x))));
- else
- output_address (XEXP (x, 0));
- fputc (')', file);
- break;
-
- case CONST_DOUBLE :
- /* We handle SFmode constants here as output_addr_const doesn't. */
- if (GET_MODE (x) == SFmode)
- {
- REAL_VALUE_TYPE d;
- long l;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, x);
- REAL_VALUE_TO_TARGET_SINGLE (d, l);
- fprintf (file, "0x%08lx", l);
- break;
- }
-
- /* Fall through. Let output_addr_const deal with it. */
-
- default :
- output_addr_const (file, x);
- break;
- }
-}
-
-/* Print a memory address as an operand to reference that memory location. */
-
-void
-m32r_print_operand_address (file, addr)
- FILE *file;
- rtx addr;
-{
- register rtx base, index = 0;
- int offset = 0;
-
- switch (GET_CODE (addr))
- {
- case REG :
- fputs (reg_names[REGNO (addr)], file);
- break;
-
- case PLUS :
- if (GET_CODE (XEXP (addr, 0)) == CONST_INT)
- offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);
- else if (GET_CODE (XEXP (addr, 1)) == CONST_INT)
- offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);
- else
- base = XEXP (addr, 0), index = XEXP (addr, 1);
- if (GET_CODE (base) == REG)
- {
- /* Print the offset first (if present) to conform to the manual. */
- if (index == 0)
- {
- if (offset != 0)
- fprintf (file, "%d,", offset);
- fputs (reg_names[REGNO (base)], file);
- }
- /* The chip doesn't support this, but left in for generality. */
- else if (GET_CODE (index) == REG)
- fprintf (file, "%s,%s",
- reg_names[REGNO (base)], reg_names[REGNO (index)]);
- /* Not sure this can happen, but leave in for now. */
- else if (GET_CODE (index) == SYMBOL_REF)
- {
- output_addr_const (file, index);
- fputc (',', file);
- fputs (reg_names[REGNO (base)], file);
- }
- else
- abort ();
- }
- else if (GET_CODE (base) == LO_SUM)
- {
- if (index != 0
- || GET_CODE (XEXP (base, 0)) != REG)
- abort ();
- if (small_data_operand (XEXP (base, 1), VOIDmode))
- fputs ("sda(", file);
- else
- fputs ("low(", file);
- output_addr_const (file, plus_constant (XEXP (base, 1), offset));
- fputs ("),", file);
- fputs (reg_names[REGNO (XEXP (base, 0))], file);
- }
- else
- abort ();
- break;
-
- case LO_SUM :
- if (GET_CODE (XEXP (addr, 0)) != REG)
- abort ();
- if (small_data_operand (XEXP (addr, 1), VOIDmode))
- fputs ("sda(", file);
- else
- fputs ("low(", file);
- output_addr_const (file, XEXP (addr, 1));
- fputs ("),", file);
- fputs (reg_names[REGNO (XEXP (addr, 0))], file);
- break;
-
- case PRE_INC :
- case PRE_DEC :
- /* We shouldn't get here as we've lost the mode of the memory object
- (which says how much to inc/dec by). */
- abort ();
- break;
-
- default :
- output_addr_const (file, addr);
- break;
- }
-}
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
deleted file mode 100644
index 805de455985..00000000000
--- a/gcc/config/m32r/m32r.h
+++ /dev/null
@@ -1,1871 +0,0 @@
-/* Definitions of target machine for GNU compiler, for the M32R/D cpu.
- Copyright (C) 1996, 1997 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. */
-
-/* Things to do:
-- longlong.h?
-*/
-
-/* FIXME: Create elf.h and have svr4.h include it. */
-#include "svr4.h"
-
-#undef SWITCH_TAKES_ARG
-#undef WORD_SWITCH_TAKES_ARG
-#undef HANDLE_SYSV_PRAGMA
-#undef SIZE_TYPE
-#undef PTRDIFF_TYPE
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-#undef ASM_FILE_START
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION fprintf (stderr, " (m32r)")
-
-/* Switch Recognition by gcc.c. Add -G xx support */
-
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
-(DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G')
-
-/* Names to predefine in the preprocessor for this target machine. */
-/* __M32R__ is defined by the existing compiler so we use that. */
-#define CPP_PREDEFINES "-Acpu(m32r) -Amachine(m32r) -D__M32R__"
-
-/* Additional flags for the preprocessor. */
-#define CPP_SPEC ""
-
-#define CC1_SPEC "%{G*}"
-
-#undef ASM_SPEC
-#if 0 /* not supported yet */
-#define ASM_SPEC "%{v} %{mrelax:-relax}"
-#else
-#define ASM_SPEC "%{v}"
-#endif
-
-#undef ASM_FINAL_SPEC
-
-#undef LINK_SPEC
-#if 0 /* not supported yet */
-#define LINK_SPEC "%{v} %{mrelax:-relax}"
-#else
-#define LINK_SPEC "%{v}"
-#endif
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared:crt0.o%s crtsysc.o%s} crtinit.o%s"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtfini.o%s"
-
-#undef LIB_SPEC
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* If non-zero, tell the linker to do relaxing.
- We don't do anything with the option, other than recognize it.
- LINK_SPEC handles passing -relax to the linker.
- This can cause incorrect debugging information as line numbers may
- turn out wrong. This shouldn't be specified unless accompanied with -O2
- [where the user expects debugging information to be less accurate]. */
-#define TARGET_RELAX_MASK 1
-
-/* For miscellaneous debugging purposes. */
-#define TARGET_DEBUG_MASK 2
-#define TARGET_DEBUG (target_flags & TARGET_DEBUG_MASK)
-
-/* Align loops to 32 byte boundaries (cache line size). */
-/* ??? This option is experimental and is not documented. */
-#define TARGET_ALIGN_LOOPS_MASK 4
-#define TARGET_ALIGN_LOOPS (target_flags & TARGET_ALIGN_LOOPS_MASK)
-
-/* Use old compare/branch support (kept around for awhile for
- comparison and backoff purposes). */
-/* ??? This option is experimental and is not documented.
- Eventually it will be deleted. */
-#define TARGET_OLD_COMPARE_MASK 8
-#define TARGET_OLD_COMPARE (target_flags & TARGET_OLD_COMPARE_MASK)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
-{ \
-/* { "relax", TARGET_RELAX_MASK }, \
- { "no-relax", -TARGET_RELAX_MASK },*/ \
- { "debug", TARGET_DEBUG_MASK }, \
- { "align-loops", TARGET_ALIGN_LOOPS_MASK }, \
- { "no-align-loops", -TARGET_ALIGN_LOOPS_MASK }, \
- { "old-compare", TARGET_OLD_COMPARE_MASK }, \
- { "no-old-compare", -TARGET_OLD_COMPARE_MASK }, \
- SUBTARGET_SWITCHES \
- { "", TARGET_DEFAULT } \
-}
-
-#define TARGET_DEFAULT (0)
-
-#define SUBTARGET_SWITCHES
-
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
- command options that have values. Its definition is an
- initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- fixed part of the option name, and the address of a variable.
- The variable, type `char *', is set to the variable part of the
- given option if the fixed part matches. The actual option name
- is made by appending `-m' to the specified name.
-
- Here is an example which defines `-mshort-data-NUMBER'. If the
- given option is `-mshort-data-512', the variable `m88k_short_data'
- will be set to the string `"512"'.
-
- extern char *m88k_short_data;
- #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
-
-extern char *m32r_model_string;
-extern char *m32r_sdata_string;
-#define TARGET_OPTIONS \
-{ \
- { "model=", &m32r_model_string }, \
- { "sdata=", &m32r_sdata_string }, \
-}
-
-/* Code Models
-
- Code models are used to select between two choices of two separate
- possibilities (address space size, call insn to use):
-
- small: addresses use 24 bits, use bl to make calls
- medium: addresses use 32 bits, use bl to make calls (*1)
- large: addresses use 32 bits, use seth/add3/jl to make calls (*2)
-
- The fourth is "addresses use 24 bits, use seth/add3/jl to make calls" but
- using this one doesn't make much sense.
-
- (*1) The linker may eventually be able to relax seth/add3 -> ld24.
- (*2) The linker may eventually be able to relax seth/add3/jl -> bl.
-
- Internally these are recorded as TARGET_ADDR{24,32} and
- TARGET_CALL{26,32}.
-
- The __model__ attribute can be used to select the code model to use when
- accessing particular objects. */
-
-enum m32r_model { M32R_MODEL_SMALL, M32R_MODEL_MEDIUM, M32R_MODEL_LARGE };
-
-extern enum m32r_model m32r_model;
-#define TARGET_MODEL_SMALL (m32r_model == M32R_MODEL_SMALL)
-#define TARGET_MODEL_MEDIUM (m32r_model == M32R_MODEL_MEDIUM)
-#define TARGET_MODEL_LARGE (m32r_model == M32R_MODEL_LARGE)
-#define TARGET_ADDR24 (m32r_model == M32R_MODEL_SMALL)
-#define TARGET_ADDR32 (! TARGET_ADDR24)
-#define TARGET_CALL26 (! TARGET_CALL32)
-#define TARGET_CALL32 (m32r_model == M32R_MODEL_LARGE)
-
-/* The default is the small model. */
-#define M32R_MODEL_DEFAULT "small"
-
-/* Small Data Area
-
- The SDA consists of sections .sdata, .sbss, and .scommon.
- .scommon isn't a real section, symbols in it have their section index
- set to SHN_M32R_SCOMMON, though support for it exists in the linker script.
-
- Two switches control the SDA:
-
- -G NNN - specifies the maximum size of variable to go in the SDA
-
- -msdata=foo - specifies how such variables are handled
-
- -msdata=none - small data area is disabled
-
- -msdata=sdata - small data goes in the SDA, special code isn't
- generated to use it, and special relocs aren't
- generated
-
- -msdata=use - small data goes in the SDA, special code is generated
- to use the SDA and special relocs are generated
-
- The SDA is not multilib'd, it isn't necessary.
- MULTILIB_EXTRA_OPTS is set in tmake_file to -msdata=sdata so multilib'd
- libraries have small data in .sdata/SHN_M32R_SCOMMON so programs that use
- -msdata=use will successfully link with them (references in header files
- will cause the compiler to emit code that refers to library objects in
- .data). ??? There can be a problem if the user passes a -G value greater
- than the default and a library object in a header file is that size.
- The default is 8 so this should be rare - if it occurs the user
- is required to rebuild the libraries or use a smaller value for -G.
-*/
-
-/* Maximum size of variables that go in .sdata/.sbss.
- The -msdata=foo switch also controls how small variables are handled. */
-#define SDATA_DEFAULT_SIZE 8
-
-extern int g_switch_value; /* value of the -G xx switch */
-extern int g_switch_set; /* whether -G xx was passed. */
-
-enum m32r_sdata { M32R_SDATA_NONE, M32R_SDATA_SDATA, M32R_SDATA_USE };
-
-extern enum m32r_sdata m32r_sdata;
-#define TARGET_SDATA_NONE (m32r_sdata == M32R_SDATA_NONE)
-#define TARGET_SDATA_SDATA (m32r_sdata == M32R_SDATA_SDATA)
-#define TARGET_SDATA_USE (m32r_sdata == M32R_SDATA_USE)
-
-/* Default is to disable the SDA
- [for upward compatibility with previous toolchains]. */
-#define M32R_SDATA_DEFAULT "none"
-
-/* Define this macro as a C expression for the initializer of an array of
- string to tell the driver program which options are defaults for this
- target and thus do not need to be handled specially when using
- `MULTILIB_OPTIONS'. */
-#define MULTILIB_DEFAULTS { "mmodel=small" }
-
-/* Sometimes certain combinations of command options do not make
- sense on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed.
-
- Don't use this macro to turn on various extra optimizations for
- `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
-
-extern void m32r_init ();
-
-#define OVERRIDE_OPTIONS \
-do { \
- /* These need to be done at start up. It's convenient to do them here. */ \
- m32r_init (); \
-} while (0)
-
-/* Define this macro if debugging can be performed even without a
- frame pointer. If this macro is defined, GNU CC will turn on the
- `-fomit-frame-pointer' option whenever `-O' is specified. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* Target machine storage layout. */
-
-/* Define to use software floating point emulator for REAL_ARITHMETIC and
- decimal <-> binary conversion. */
-#define REAL_ARITHMETIC
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-#define WORDS_BIG_ENDIAN 1
-
-/* Define this macro if WORDS_BIG_ENDIAN is not constant. This must
- be a constant value with the same meaning as WORDS_BIG_ENDIAN,
- which will be used only when compiling libgcc2.c. Typically the
- value will be set based on preprocessor defines. */
-/*#define LIBGCC2_WORDS_BIG_ENDIAN 1*/
-
-/* Number of bits in an addressable storage unit. */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Define this macro if it is advisable to hold scalars in registers
- in a wider mode than that declared by the program. In such cases,
- the value is constrained to be within the bounds of the declared
- type, but kept valid in the wider mode. The signedness of the
- extension may differ from that of the type. */
-#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
-if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
-{ \
- (MODE) = SImode; \
-}
-
-/* Define this macro if the promotion described by `PROMOTE_MODE'
- should also be done for outgoing function arguments. */
-/*#define PROMOTE_FUNCTION_ARGS*/
-
-/* Likewise, if the function return value is promoted.
- If defined, FUNCTION_VALUE must perform the same promotions done by
- PROMOTE_MODE. */
-/*#define PROMOTE_FUNCTION_RETURN*/
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 32
-
-/* ALIGN FRAMES on word boundaries */
-#define M32R_STACK_ALIGN(LOC) (((LOC)+3) & ~3)
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* The best alignment to use in cases where we have a choice. */
-#define FASTEST_ALIGNMENT 32
-
-/* Make strings word-aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- ((TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < FASTEST_ALIGNMENT) \
- ? FASTEST_ALIGNMENT : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Layout of source language data types. */
-
-#define SHORT_TYPE_SIZE 16
-#define INT_TYPE_SIZE 32
-#define LONG_TYPE_SIZE 32
-#define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-#define SIZE_TYPE "long unsigned int"
-#define PTRDIFF_TYPE "long int"
-#define WCHAR_TYPE "short unsigned int"
-#define WCHAR_TYPE_SIZE 16
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-#define FIRST_PSEUDO_REGISTER 18
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
-
- 0-3 - arguments/results
- 4-5 - call used [4 is used as a tmp during prologue/epilogue generation]
- 6 - call used, gptmp
- 7 - call used, static chain pointer
- 8-11 - call saved
- 12 - call saved [reserved for global pointer]
- 13 - frame pointer
- 14 - subroutine link register
- 15 - stack pointer
- 16 - arg pointer
- 17 - carry flag
-
- By default, the extension registers are not available. */
-
-#define FIXED_REGISTERS \
-{ 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 1, \
- 1, 0 }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-
-#define CALL_USED_REGISTERS \
-{ 1, 1, 1, 1, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 1, 1, \
- 1, 1 }
-
-/* Zero or more C statements that may conditionally modify two variables
- `fixed_regs' and `call_used_regs' (both of type `char []') after they
- have been initialized from the two preceding macros.
-
- This is necessary in case the fixed or call-clobbered registers depend
- on target flags.
-
- You need not define this macro if it has no work to do. */
-
-/*#define CONDITIONAL_REGISTER_USAGE*/
-
-/* If defined, an initializer for a vector of integers, containing the
- numbers of hard registers in the order in which GNU CC should
- prefer to use them (from most preferred to least). */
-/* FIXME: revisit.
- GCC seemed very poor at optimizing register allocations for libcalls.
- By ordering the regs according to function arguments, all problems were
- alleviated. Leave changed for now but revisit again in awhile. */
-#if 0
-#define REG_ALLOC_ORDER \
-{ 4, 5, 6, 7, 2, 3, 8, 9, 10, 11, 12, 13, 14, 0, 1, 15, 16, 17 }
-#else
-#define REG_ALLOC_ORDER \
-{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }
-#endif
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
-((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
-extern unsigned int m32r_hard_regno_mode_ok[];
-extern unsigned int m32r_mode_class[];
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-((m32r_hard_regno_mode_ok[REGNO] & m32r_mode_class[MODE]) != 0)
-
-/* A C expression that is nonzero if it is desirable to choose
- register allocation so as to avoid move instructions between a
- value of mode MODE1 and a value of mode MODE2.
-
- If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
- MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
- MODE2)' must be zero. */
-
-/* Tie QI/HI/SI modes together. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
-(GET_MODE_CLASS (MODE1) == MODE_INT \
- && GET_MODE_CLASS (MODE2) == MODE_INT \
- && GET_MODE_SIZE (MODE1) <= UNITS_PER_WORD \
- && GET_MODE_SIZE (MODE2) <= UNITS_PER_WORD)
-
-/* Register classes and constants. */
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union.
-
- It is important that any condition codes have class NO_REGS.
- See `register_operand'. */
-
-enum reg_class {
- NO_REGS, CARRY_REG, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
-};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-#define REG_CLASS_NAMES \
-{ "NO_REGS", "CARRY_REG", "GENERAL_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ {0}, {0x20000}, {0x1ffff}, {0x3ffff} }
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-extern enum reg_class m32r_regno_reg_class[];
-#define REGNO_REG_CLASS(REGNO) \
-(m32r_regno_reg_class[REGNO])
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-#define REG_CLASS_FROM_LETTER(C) NO_REGS
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-((REGNO) < FIRST_PSEUDO_REGISTER \
- ? GPR_P (REGNO) || (REGNO) == ARG_POINTER_REGNUM \
- : GPR_P (reg_renumber[REGNO]))
-#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
-(CLASS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
-((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* The letters I, J, K, L, M, N, O, P in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C. */
-/* 'I' is used for 8 bit signed immediates.
- 'J' is used for 16 bit signed immediates.
- 'K' is used for 16 bit unsigned immediates.
- 'L' is used for 16 bit immediates left shifted by 16 (sign ???).
- 'M' is used for 24 bit unsigned immediates.
- 'N' is used for any 32 bit non-symbolic value.
- 'O' is used for 5 bit unsigned immediates (shift count).
- 'P' is used for 16 bit signed immediates for compares
- (values in the range -32767 to +32768). */
-
-/* local to this file */
-#define INT8_P(X) ((unsigned) ((X) + 0x80) < 0x100)
-#define INT16_P(X) ((unsigned) ((X) + 0x8000) < 0x10000)
-#define CMP_INT16_P(X) ((unsigned) ((X) - 1 + 0x8000) < 0x10000)
-#define UINT16_P(X) ((unsigned) (X) < 0x10000)
-#define UPPER16_P(X) (((X) & 0xffff0000) == 0)
-#define UINT24_P(X) ((unsigned) (X) < 0x1000000)
-#define INT32_P(X) ((X) >= (-(HOST_WIDE_INT) 0x7fffffff - 1) \
- && (X) <= (unsigned HOST_WIDE_INT) 0xffffffff)
-#define UINT5_P(X) ((unsigned) (X) < 32)
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
-((C) == 'I' ? INT8_P (VALUE) \
- : (C) == 'J' ? INT16_P (VALUE) \
- : (C) == 'K' ? UINT16_P (VALUE) \
- : (C) == 'L' ? UPPER16_P (VALUE) \
- : (C) == 'M' ? UINT24_P (VALUE) \
- : (C) == 'N' ? INT32_P (VALUE) \
- : (C) == 'O' ? UINT5_P (VALUE) \
- : (C) == 'P' ? CMP_INT16_P (VALUE) \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself.
- For the m32r, handle a few constants inline.
- ??? We needn't treat DI and DF modes differently, but for now we do. */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
-((C) == 'G' ? easy_di_const (VALUE) \
- : (C) == 'H' ? easy_df_const (VALUE) \
- : 0)
-
-/* A C expression that defines the optional machine-dependent constraint
- letters that can be used to segregate specific types of operands,
- usually memory references, for the target machine. It should return 1 if
- VALUE corresponds to the operand type represented by the constraint letter
- C. If C is not defined as an extra constraint, the value returned should
- be 0 regardless of VALUE. */
-/* Q is for symbolic addresses loadable with ld24.
- R is for symbolic addresses when ld24 can't be used. */
-#define EXTRA_CONSTRAINT(VALUE, C) \
-((C) == 'Q' \
- ? ((TARGET_ADDR24 && GET_CODE (VALUE) == LABEL_REF) \
- || addr24_operand (VALUE, VOIDmode)) \
- : (C) == 'R' \
- ? ((TARGET_ADDR32 && GET_CODE (VALUE) == LABEL_REF) \
- || addr32_operand (VALUE, VOIDmode)) \
- : 0)
-
-/* Stack layout and stack pointer usage. */
-
-/* Define this macro if pushing a word onto the stack moves the stack
- pointer to a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset from the frame pointer. */
-/*#define FRAME_GROWS_DOWNWARD*/
-
-/* Offset from frame pointer to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-/* The frame pointer points at the same place as the stack pointer, except if
- alloca has been called. */
-#define STARTING_FRAME_OFFSET \
-M32R_STACK_ALIGN (current_function_outgoing_args_size)
-
-/* Offset from the stack pointer register to the first location at which
- outgoing arguments are placed. */
-#define STACK_POINTER_OFFSET 0
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* A C expression whose value is RTL representing the address in a
- stack frame where the pointer to the caller's frame is stored.
- Assume that FRAMEADDR is an RTL expression for the address of the
- stack frame itself.
-
- If you don't define this macro, the default is to return the value
- of FRAMEADDR--that is, the stack frame address is also the address
- of the stack word that points to the previous frame. */
-/*define DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)*/
-
-/* A C expression whose value is RTL representing the value of the
- return address for the frame COUNT steps up from the current frame.
- FRAMEADDR is the frame pointer of the COUNT frame, or the frame
- pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME'
- is defined. */
-/* The current return address is in r14. */
-#if 0 /* The default value should work. */
-#define RETURN_ADDR_RTX(COUNT, FRAME) \
-(((COUNT) == -1) \
- ? gen_rtx (REG, Pmode, 14) \
- : copy_to_reg (gen_rtx (MEM, Pmode, \
- memory_address (Pmode, plus_constant ((FRAME), UNITS_PER_WORD)))))
-#endif
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 15
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 13
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 16
-
-/* The register number of the return address pointer register, which
- is used to access the current function's return address from the
- stack. On some machines, the return address is not at a fixed
- offset from the frame pointer or stack pointer or argument
- pointer. This register can be defined to point to the return
- address on the stack, and then be converted by `ELIMINABLE_REGS'
- into either the frame pointer or stack pointer.
-
- Do not define this macro unless there is no other way to get the
- return address from the stack. */
-/* FIXME: revisit */
-/* #define RETURN_ADDRESS_POINTER_REGNUM */
-
-/* Register in which static-chain is passed to a function. This must
- not be a register used by the prologue. */
-#define STATIC_CHAIN_REGNUM 7
-
-/* These aren't official macros. */
-#define PROLOGUE_TMP_REGNUM 4
-#define RETURN_ADDR_REGNUM 14
-/* #define GP_REGNUM 12 */
-#define CARRY_REGNUM 17
-#define M32R_MAX_INT_REGS 16
-
-#define GPR_P(REGNO) ((unsigned) (REGNO) < M32R_MAX_INT_REGS)
-
-/* Eliminating the frame and arg pointers. */
-
-/* A C expression which is nonzero if a function must have and use a
- frame pointer. This expression is evaluated in the reload pass.
- If its value is nonzero the function will have a frame pointer. */
-#define FRAME_POINTER_REQUIRED \
-(current_function_calls_alloca)
-
-#if 0
-/* C statement to store the difference between the frame pointer
- and the stack pointer values immediately after the function prologue.
- If `ELIMINABLE_REGS' is defined, this macro will be not be used and
- need not be defined. */
-#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
-((VAR) = m32r_compute_frame_size (get_frame_size ()))
-#endif
-
-/* If defined, this macro specifies a table of register pairs used to
- eliminate unneeded registers that point into the stack frame. If
- it is not defined, the only elimination attempted by the compiler
- is to replace references to the frame pointer with references to
- the stack pointer.
-
- Note that the elimination of the argument pointer with the stack
- pointer is specified first since that is the preferred elimination. */
-
-#define ELIMINABLE_REGS \
-{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
- { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }} \
-
-/* A C expression that returns non-zero if the compiler is allowed to
- try to replace register number FROM-REG with register number
- TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
- defined, and will usually be the constant 1, since most of the
- cases preventing register elimination are things that the compiler
- already knows about. */
-
-#define CAN_ELIMINATE(FROM, TO) \
-((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
- ? ! frame_pointer_needed \
- : 1)
-
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
- specifies the initial difference between the specified pair of
- registers. This macro must be defined if `ELIMINABLE_REGS' is
- defined. */
-
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ \
- int size = m32r_compute_frame_size (get_frame_size ()); \
- \
- if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- (OFFSET) = 0; \
- else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
- (OFFSET) = size - current_function_pretend_args_size; \
- else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- (OFFSET) = size - current_function_pretend_args_size; \
- else \
- abort (); \
-}
-
-/* Function argument passing. */
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-/* FIXME: revisit */
-#define PROMOTE_PROTOTYPES
-
-/* If defined, the maximum amount of space required for outgoing
- arguments will be computed and placed into the variable
- `current_function_outgoing_args_size'. No space will be pushed
- onto the stack for each call; instead, the function prologue should
- increase the stack frame size by this amount. */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Define this macro if functions should assume that stack space has
- been allocated for arguments even when their values are passed in
- registers.
-
- The value of this macro is the size, in bytes, of the area
- reserved for arguments passed in registers for the function
- represented by FNDECL.
-
- This space can be allocated by the caller, or be a part of the
- machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says
- which. */
-#if 0
-#define REG_PARM_STACK_SPACE(FNDECL) \
-(M32R_MAX_PARM_REGS * UNITS_PER_WORD)
-#endif
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-#define RETURN_POPS_ARGS(DECL, FUNTYPE, SIZE) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go. */
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
-((CUM) = 0)
-
-/* The number of registers used for parameter passing. Local to this file. */
-#define M32R_MAX_PARM_REGS 4
-
-/* 1 if N is a possible register number for function argument passing. */
-#define FUNCTION_ARG_REGNO_P(N) \
-((unsigned) (N) < M32R_MAX_PARM_REGS)
-
-/* The ROUND_ADVANCE* macros are local to this file. */
-/* Round SIZE up to a word boundary. */
-#define ROUND_ADVANCE(SIZE) \
-(((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Round arg MODE/TYPE up to the next word boundary. */
-#define ROUND_ADVANCE_ARG(MODE, TYPE) \
-((MODE) == BLKmode \
- ? ROUND_ADVANCE (int_size_in_bytes (TYPE)) \
- : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
-
-/* Round CUM up to the necessary point for argument MODE/TYPE. */
-#if 0
-#define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \
-((((MODE) == BLKmode ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) \
- > BITS_PER_WORD) \
- ? ((CUM) + 1 & ~1) \
- : (CUM))
-#else
-#define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) (CUM)
-#endif
-
-/* Return boolean indicating arg of type TYPE and mode MODE will be passed in
- a reg. This includes arguments that have to be passed by reference as the
- pointer to them is passed in a reg if one is available (and that is what
- we're given).
- This macro is only used in this file. */
-#define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \
-(ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) < M32R_MAX_PARM_REGS)
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-/* On the M32R the first M32R_MAX_PARM_REGS args are normally in registers
- and the rest are pushed. */
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-(PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED)) \
- ? gen_rtx (REG, (MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \
- : 0)
-
-/* FIXME: Quick hack to try to get varargs working the normal way. */
-#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
-(((! current_function_varargs || (NAMED)) \
- && PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED))) \
- ? gen_rtx (REG, (MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \
- : 0)
-
-/* A C expression for the number of words, at the beginning of an
- argument, must be put in registers. The value must be zero for
- arguments that are passed entirely in registers or that are entirely
- pushed on the stack.
-
- On some machines, certain arguments must be passed partially in
- registers and partially in memory. On these machines, typically the
- first @var{n} words of arguments are passed in registers, and the rest
- on the stack. If a multi-word argument (a @code{double} or a
- structure) crosses that boundary, its first few words must be passed
- in registers and the rest must be pushed. This macro tells the
- compiler when this occurs, and how many of the words should go in
- registers. */
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
- function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
-
-/* A C expression that indicates when an argument must be passed by
- reference. If nonzero for an argument, a copy of that argument is
- made in memory and a pointer to the argument is passed instead of
- the argument itself. The pointer is passed in whatever way is
- appropriate for passing a pointer to that type. */
-/* All arguments greater than 8 bytes are passed this way. */
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
-((TYPE) && int_size_in_bytes (TYPE) > 8)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
-((CUM) = (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \
- + ROUND_ADVANCE_ARG ((MODE), (TYPE))))
-
-/* If defined, a C expression that gives the alignment boundary, in bits,
- of an argument with the specified mode and type. If it is not defined,
- PARM_BOUNDARY is used for all arguments. */
-#if 0
-/* We assume PARM_BOUNDARY == UNITS_PER_WORD here. */
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
-(((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
- ? PARM_BOUNDARY \
- : 2 * PARM_BOUNDARY)
-#endif
-
-#if 0
-/* If defined, is a C expression that produces the machine-specific
- code for a call to `__builtin_saveregs'. This code will be moved
- to the very beginning of the function, before any parameter access
- are made. The return value of this function should be an RTX that
- contains the value to use as the return of `__builtin_saveregs'.
-
- The argument ARGS is a `tree_list' containing the arguments that
- were passed to `__builtin_saveregs'.
-
- If this macro is not defined, the compiler will output an ordinary
- call to the library function `__builtin_saveregs'. */
-extern struct rtx *m32r_expand_builtin_savergs ();
-#define EXPAND_BUILTIN_SAVEREGS(ARGS) m32r_expand_builtin_saveregs (ARGS)
-#endif
-
-/* This macro offers an alternative
- to using `__builtin_saveregs' and defining the macro
- `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register
- arguments into the stack so that all the arguments appear to have
- been passed consecutively on the stack. Once this is done, you
- can use the standard implementation of varargs that works for
- machines that pass all their arguments on the stack.
-
- The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure,
- containing the values that obtain after processing of the named
- arguments. The arguments MODE and TYPE describe the last named
- argument--its machine mode and its data type as a tree node.
-
- The macro implementation should do two things: first, push onto the
- stack all the argument registers *not* used for the named
- arguments, and second, store the size of the data thus pushed into
- the `int'-valued variable whose name is supplied as the argument
- PRETEND_SIZE. The value that you store here will serve as
- additional offset for setting up the stack frame.
-
- If the argument NO_RTL is nonzero, it means that the
- arguments of the function are being analyzed for the second time.
- This happens for an inline function, which is not actually
- compiled until the end of the source file. The macro
- `SETUP_INCOMING_VARARGS' should not generate any instructions in
- this case. */
-
-#define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_SIZE, NO_RTL) \
-m32r_setup_incoming_varargs (&ARGS_SO_FAR, MODE, TYPE, &PRETEND_SIZE, NO_RTL)
-
-/* Function results. */
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-#define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller. */
-/* ??? What about r1 in DI/DF values. */
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* A C expression which can inhibit the returning of certain function
- values in registers, based on the type of value. A nonzero value says
- to return the function value in memory, just as large structures are
- always returned. Here TYPE will be a C expression of type `tree',
- representing the data type of the value. */
-#define RETURN_IN_MEMORY(TYPE) \
-(int_size_in_bytes (TYPE) > 8)
-
-/* Tell GCC to use RETURN_IN_MEMORY. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Register in which address to store a structure value
- is passed to a function, or 0 to use `invisible' first argument. */
-#define STRUCT_VALUE 0
-
-/* Function entry and exit. */
-
-/* Initialize data used by insn expanders. This is called from
- init_emit, once for each function, before code is generated. */
-#define INIT_EXPANDERS m32r_init_expanders ()
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-m32r_output_function_prologue (FILE, SIZE)
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-m32r_output_function_epilogue (FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-#define FUNCTION_PROFILER(FILE, LABELNO)
-
-/* Trampolines. */
-
-/* On the M32R, the trampoline is
-
- ld24 r7,STATIC
- ld24 r6,FUNCTION
- jmp r6
- nop
-
- FIXME: Need addr32 support.
-*/
-
-/* Length in bytes of the trampoline for entering a nested function. */
-#define TRAMPOLINE_SIZE 12
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-do { \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 0)), \
- plus_constant ((CXT), 0xe7000000)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 4)), \
- plus_constant ((FNADDR), 0xe6000000)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 8)), \
- GEN_INT (0x1fc67000)); \
- emit_insn (gen_flush_icache (validize_mem (gen_rtx (MEM, SImode, TRAMP)))); \
-} while (0)
-
-/* Library calls. */
-
-/* Generate calls to memcpy, memcmp and memset. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Addressing modes, and classification of registers for them. */
-
-/* Maximum number of registers that can appear in a valid memory address. */
-#define MAX_REGS_PER_ADDRESS 1
-
-/* We have post-inc load and pre-dec,pre-inc store,
- but only for 4 byte vals. */
-#if 0
-#define HAVE_PRE_DECREMENT
-#define HAVE_PRE_INCREMENT
-#define HAVE_POST_INCREMENT
-#endif
-
-/* Recognize any constant value that is a valid address. */
-#define CONSTANT_ADDRESS_P(X) \
-(GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- We don't allow (plus symbol large-constant) as the relocations can't
- describe it. INTVAL > 32767 handles both 16 bit and 24 bit relocations.
- We allow all CONST_DOUBLE's as the md file patterns will force the
- constant to memory if they can't handle them. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
-(! (GET_CODE (X) == CONST \
- && GET_CODE (XEXP (X, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \
- && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
- && (unsigned HOST_WIDE_INT) INTVAL (XEXP (XEXP (X, 0), 1)) > 32767))
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifdef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) GPR_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
-(GPR_P (REGNO (X)) \
- || (REGNO (X)) == ARG_POINTER_REGNUM \
- || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address. */
-
-/* local to this file */
-#define RTX_OK_FOR_BASE_P(X) \
-(REG_P (X) && REG_OK_FOR_BASE_P (X))
-
-/* local to this file */
-#define RTX_OK_FOR_OFFSET_P(X) \
-(GET_CODE (X) == CONST_INT && INT16_P (INTVAL (X)))
-
-/* local to this file */
-#define LEGITIMATE_OFFSET_ADDRESS_P(MODE, X) \
-(GET_CODE (X) == PLUS \
- && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
- && RTX_OK_FOR_OFFSET_P (XEXP (X, 1)))
-
-/* local to this file */
-#define LEGITIMATE_LO_SUM_ADDRESS_P(MODE, X) \
-(GET_CODE (X) == LO_SUM \
- && RTX_OK_FOR_BASE_P (XEXP (X, 0)) \
- && CONSTANT_P (XEXP (X, 1)))
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ if (RTX_OK_FOR_BASE_P (X)) \
- goto ADDR; \
- if (LEGITIMATE_OFFSET_ADDRESS_P ((MODE), (X))) \
- goto ADDR; \
- if (LEGITIMATE_LO_SUM_ADDRESS_P ((MODE), (X))) \
- goto ADDR; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- ??? Is there anything useful we can do here for the M32R? */
-
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for. */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
-do { \
- if (GET_CODE (ADDR) == PRE_DEC) \
- goto LABEL; \
- if (GET_CODE (ADDR) == PRE_INC) \
- goto LABEL; \
- if (GET_CODE (ADDR) == POST_INC) \
- goto LABEL; \
-} while (0)
-
-/* Condition code usage. */
-
-/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
- return the mode to be used for the comparison. */
-extern enum machine_mode m32r_select_cc_mode ();
-#define SELECT_CC_MODE(OP, X, Y) \
-m32r_select_cc_mode (OP, X, Y)
-
-/* Return non-zero if SELECT_CC_MODE will never return MODE for a
- floating point inequality comparison. */
-#define REVERSIBLE_CC_MODE(MODE) 1 /*FIXME*/
-
-/* Costs. */
-
-/* ??? I'm quite sure I don't understand enough of the subtleties involved
- in choosing the right numbers to use here, but there doesn't seem to be
- enough documentation on this. What I've done is define an insn to cost
- 4 "units" and work from there. COSTS_N_INSNS (N) is defined as (N) * 4 - 2
- so that seems reasonable. Some values are supposed to be defined relative
- to each other and thus aren't necessarily related to COSTS_N_INSNS. */
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-/* Small integers are as cheap as registers. 4 byte values can be fetched
- as immediate constants - let's give that the cost of an extra insn. */
-#define CONST_COSTS(X, CODE, OUTER_CODE) \
- case CONST_INT : \
- if (INT16_P (INTVAL (X))) \
- return 0; \
- /* fall through */ \
- case CONST : \
- case LABEL_REF : \
- case SYMBOL_REF : \
- return 4; \
- case CONST_DOUBLE : \
- { \
- rtx high, low; \
- split_double (X, &high, &low); \
- return 4 * (!INT16_P (INTVAL (high)) \
- + !INT16_P (INTVAL (low))); \
- }
-
-/* Compute the cost of an address. */
-#define ADDRESS_COST(ADDR) m32r_address_cost (ADDR)
-
-/* Compute extra cost of moving data between one register class
- and another. */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) 2
-
-/* Compute the cost of moving data between registers and memory. */
-/* Memory is 3 times as expensive as registers.
- ??? Is that the right way to look at it? */
-#define MEMORY_MOVE_COST(MODE) \
-(GET_MODE_SIZE (MODE) <= UNITS_PER_WORD ? 6 : 12)
-
-/* The cost of a branch insn. */
-/* A value of 2 here causes GCC to avoid using branches in comparisons like
- while (a < N && a). Branches aren't that expensive on the M32R so
- we define this as 1. Defining it as 2 had a heavy hit in fp-bit.c. */
-#define BRANCH_COST 1
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. The purpose for the cost of MULT is to encourage
- `synth_mult' to find a synthetic multiply when reasonable.
-
- If we need more than 12 insns to do a multiply, then go out-of-line,
- since the call overhead will be < 10% of the cost of the multiply. */
-#define RTX_COSTS(X, CODE, OUTER_CODE) \
- case MULT : \
- return COSTS_N_INSNS (3); \
- case DIV : \
- case UDIV : \
- case MOD : \
- case UMOD : \
- return COSTS_N_INSNS (10); \
-
-/* Nonzero if access to memory by bytes is slow and undesirable.
- For RISC chips, it means that access to memory by bytes is no
- better than access by words when possible, so grab a whole word
- and maybe make use of that. */
-#define SLOW_BYTE_ACCESS 1
-
-/* Define this macro if it is as good or better to call a constant
- function address than to call an address kept in a register. */
-/* FIXME: revisit */
-#define NO_FUNCTION_CSE
-
-/* Define this macro if it is as good or better for a function to call
- itself with an explicit address than to call an address kept in a
- register. */
-/* FIXME: revisit */
-#define NO_RECURSIVE_FUNCTION_CSE
-
-/* Enable the register move pass.
- This is useful for machines with only 2 address instructions.
- It's not currently enabled by default because on the stanford benchmarks
- the improvement wasn't significant and in a couple of cases caused a
- significant de-optimization. */
-/* #define ENABLE_REGMOVE_PASS */
-
-/* Section selection. */
-
-#define TEXT_SECTION_ASM_OP "\t.section .text"
-#define DATA_SECTION_ASM_OP "\t.section .data"
-#define RODATA_SECTION_ASM_OP "\t.section .rodata"
-#define BSS_SECTION_ASM_OP "\t.section .bss"
-#define SDATA_SECTION_ASM_OP "\t.section .sdata"
-#define SBSS_SECTION_ASM_OP "\t.section .sbss"
-/* This one is for svr4.h. */
-#undef CONST_SECTION_ASM_OP
-#define CONST_SECTION_ASM_OP "\t.section .rodata"
-
-/* A list of names for sections other than the standard two, which are
- `in_text' and `in_data'. You need not define this macro
- on a system with no other sections (that GCC needs to use). */
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_sbss, in_const, in_ctors, in_dtors
-
-/* One or more functions to be defined in "varasm.c". These
- functions should do jobs analogous to those of `text_section' and
- `data_section', for your additional sections. Do not define this
- macro if you do not define `EXTRA_SECTIONS'. */
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
-CONST_SECTION_FUNCTION \
-CTORS_SECTION_FUNCTION \
-DTORS_SECTION_FUNCTION \
-SDATA_SECTION_FUNCTION \
-SBSS_SECTION_FUNCTION
-
-#define SDATA_SECTION_FUNCTION \
-void \
-sdata_section () \
-{ \
- if (in_section != in_sdata) \
- { \
- fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
- in_section = in_sdata; \
- } \
-} \
-
-#define SBSS_SECTION_FUNCTION \
-void \
-sbss_section () \
-{ \
- if (in_section != in_sbss) \
- { \
- fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
- in_section = in_sbss; \
- } \
-} \
-
-/* A C statement or statements to switch to the appropriate section for
- output of EXP. You can assume that EXP is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether the initial value
- of EXP requires link-time relocations. */
-extern void m32r_select_section ();
-#undef SELECT_SECTION
-#define SELECT_SECTION(EXP, RELOC) m32r_select_section ((EXP), (RELOC))
-
-/* A C statement or statements to switch to the appropriate section for
- output of RTX in mode MODE. You can assume that RTX
- is some kind of constant in RTL. The argument MODE is redundant
- except in the case of a `const_int' rtx. Select the section by
- calling `text_section' or one of the alternatives for other
- sections.
-
- Do not define this macro if you put all constants in the read-only
- data section. */
-
-#undef SELECT_RTX_SECTION
-
-/* Define this macro if jump tables (for tablejump insns) should be
- output in the text section, along with the assembler instructions.
- Otherwise, the readonly data section is used.
- This macro is irrelevant if there is no separate readonly data section. */
-/*#define JUMP_TABLES_IN_TEXT_SECTION*/
-
-/* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- The macro definition, if any, is executed immediately after the
- rtl for DECL or other node is created.
- The value of the rtl will be a `mem' whose address is a
- `symbol_ref'.
-
- The usual thing for this macro to do is to store a flag in the
- `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
- name string in the `symbol_ref' (if one bit is not enough
- information). */
-
-#define SDATA_FLAG_CHAR '@'
-/* Small objects are recorded with no prefix for space efficiency since
- they'll be the most common. This isn't the case if the user passes
- -mmodel={medium|large} and one could choose to not mark symbols that
- are the default, but that complicates things. */
-/*#define SMALL_FLAG_CHAR '#'*/
-#define MEDIUM_FLAG_CHAR '%'
-#define LARGE_FLAG_CHAR '&'
-
-#define SDATA_NAME_P(NAME) (*(NAME) == SDATA_FLAG_CHAR)
-/*#define SMALL_NAME_P(NAME) (*(NAME) == SMALL_FLAG_CHAR)*/
-#define SMALL_NAME_P(NAME) (! ENCODED_NAME_P (NAME))
-#define MEDIUM_NAME_P(NAME) (*(NAME) == MEDIUM_FLAG_CHAR)
-#define LARGE_NAME_P(NAME) (*(NAME) == LARGE_FLAG_CHAR)
-
-#define ENCODED_NAME_P(SYMBOL_NAME) \
-(SDATA_NAME_P (SYMBOL_NAME) \
- /*|| SMALL_NAME_P (SYMBOL_NAME)*/ \
- || MEDIUM_NAME_P (SYMBOL_NAME) \
- || LARGE_NAME_P (SYMBOL_NAME))
-
-extern void m32r_encode_section_info ();
-#define ENCODE_SECTION_INFO(DECL) m32r_encode_section_info (DECL)
-
-/* Decode SYM_NAME and store the real name part in VAR, sans
- the characters that encode section info. Define this macro if
- ENCODE_SECTION_INFO alters the symbol's name string. */
-/* Note that we have to handle symbols like "#*start". */
-#define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \
-do { \
- (VAR) = (SYMBOL_NAME) + ENCODED_NAME_P (SYMBOL_NAME); \
- (VAR) += *(VAR) == '*'; \
-} while (0)
-
-/* PIC */
-
-/* The register number of the register used to address a table of static
- data addresses in memory. In some cases this register is defined by a
- processor's ``application binary interface'' (ABI). When this macro
- is defined, RTL is generated for this register once, as with the stack
- pointer and frame pointer registers. If this macro is not defined, it
- is up to the machine-dependent files to allocate such a register (if
- necessary). */
-/*#define PIC_OFFSET_TABLE_REGNUM 12*/
-
-/* Define this macro if the register defined by PIC_OFFSET_TABLE_REGNUM is
- clobbered by calls. Do not define this macro if PIC_OFFSET_TABLE_REGNUM
- is not defined. */
-/* This register is call-saved on the M32R. */
-/*#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED*/
-
-/* By generating position-independent code, when two different programs (A
- and B) share a common library (libC.a), the text of the library can be
- shared whether or not the library is linked at the same address for both
- programs. In some of these environments, position-independent code
- requires not only the use of different addressing modes, but also
- special code to enable the use of these addressing modes.
-
- The FINALIZE_PIC macro serves as a hook to emit these special
- codes once the function is being compiled into assembly code, but not
- before. (It is not done before, because in the case of compiling an
- inline function, it would lead to multiple PIC prologues being
- included in functions which used inline functions and were compiled to
- assembly language.) */
-
-/*#define FINALIZE_PIC m32r_finalize_pic ()*/
-
-/* A C expression that is nonzero if X is a legitimate immediate
- operand on the target machine when generating position independent code.
- You can assume that X satisfies CONSTANT_P, so you need not
- check this. You can also assume `flag_pic' is true, so you need not
- check it either. You need not define this macro if all constants
- (including SYMBOL_REF) can be immediate operands when generating
- position independent code. */
-/*#define LEGITIMATE_PIC_OPERAND_P(X)*/
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-extern void m32r_asm_file_start ();
-#define ASM_FILE_START(FILE) m32r_asm_file_start (FILE)
-
-/* A C string constant describing how to begin a comment in the target
- assembler language. The compiler assumes that the comment will
- end at the end of the line. */
-#define ASM_COMMENT_START ";"
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-#define ASM_APP_OFF ""
-
-/* This is how to output an assembler line defining a `char' constant. */
-#define ASM_OUTPUT_CHAR(FILE, VALUE) \
-do { \
- fprintf (FILE, "\t.byte\t"); \
- output_addr_const (FILE, (VALUE)); \
- fprintf (FILE, "\n"); \
-} while (0)
-
-/* This is how to output an assembler line defining a `short' constant. */
-#define ASM_OUTPUT_SHORT(FILE, VALUE) \
-do { \
- fprintf (FILE, "\t.hword\t"); \
- output_addr_const (FILE, (VALUE)); \
- fprintf (FILE, "\n"); \
-} while (0)
-
-/* This is how to output an assembler line defining an `int' constant.
- We also handle symbol output here. */
-#define ASM_OUTPUT_INT(FILE, VALUE) \
-do { \
- fprintf (FILE, "\t.word\t"); \
- output_addr_const (FILE, (VALUE)); \
- fprintf (FILE, "\n"); \
-} while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
-do { \
- long t; \
- char str[30]; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
- fprintf (FILE, "\t.word\t0x%lx %s %s\n", \
- t, ASM_COMMENT_START, str); \
-} while (0)
-
-/* This is how to output an assembler line defining a `double' constant. */
-#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
-do { \
- long t[2]; \
- char str[30]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
- fprintf (FILE, "\t.word\t0x%lx %s %s\n\t.word\t0x%lx\n", \
- t[0], ASM_COMMENT_START, str, t[1]); \
-} while (0)
-
-/* This is how to output an assembler line for a numeric constant byte. */
-#define ASM_OUTPUT_BYTE(FILE, VALUE) \
- fprintf (FILE, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
-
-/* The assembler's parentheses characters. */
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-/* On the M32R we need to ensure the next instruction starts on a 32 bit
- boundary [the previous insn must either be 2 16 bit insns or 1 32 bit]. */
-#define ASM_OUTPUT_LABEL(FILE, NAME) \
-do { \
- assemble_name (FILE, NAME); \
- fputs (":\n", FILE); \
-} while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-#define ASM_GLOBALIZE_LABEL(FILE, NAME) \
-do { \
- fputs ("\t.global\t", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
-} while (0)
-
-/* This is how to output a reference to a user-level label named NAME.
- `assemble_name' uses this. */
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE, NAME) \
-do { \
- char *real_name; \
- STRIP_NAME_ENCODING (real_name, (NAME)); \
- fprintf (FILE, "%s%s", USER_LABEL_PREFIX, real_name); \
-} while (0)
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-do { \
- (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10); \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)); \
-} while (0)
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-#define REGISTER_NAMES \
-{ \
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp", \
- "ap", "cbit" \
-}
-
-/* If defined, a C initializer for an array of structures containing
- a name and a register number. This macro defines additional names
- for hard registers, thus allowing the `asm' option in declarations
- to refer to registers using alternate names. */
-#define ADDITIONAL_REGISTER_NAMES \
-{ \
- /*{ "gp", GP_REGNUM },*/ \
- { "r13", FRAME_POINTER_REGNUM }, \
- { "r14", RETURN_ADDR_REGNUM }, \
- { "r15", STACK_POINTER_REGNUM }, \
-}
-
-/* A C expression which evaluates to true if CODE is a valid
- punctuation character for use in the `PRINT_OPERAND' macro. */
-extern char m32r_punct_chars[];
-#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
-m32r_punct_chars[(unsigned char) (CHAR)]
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-#define PRINT_OPERAND(FILE, X, CODE) \
-m32r_print_operand (FILE, X, CODE)
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand that is a memory
- reference whose address is ADDR. ADDR is an RTL expression.
-
- On some machines, the syntax for a symbolic address depends on
- the section that the address refers to. On these machines,
- define the macro `ENCODE_SECTION_INFO' to store the information
- into the `symbol_ref', and then check for it here. */
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-m32r_print_operand_address (FILE, ADDR)
-
-/* If defined, C string expressions to be used for the `%R', `%L',
- `%U', and `%I' options of `asm_fprintf' (see `final.c'). These
- are useful when a single `md' file must support multiple assembler
- formats. In that case, the various `tm.h' files can define these
- macros differently. */
-#define REGISTER_PREFIX ""
-#define LOCAL_LABEL_PREFIX ".L"
-#define USER_LABEL_PREFIX ""
-#define IMMEDIATE_PREFIX "#"
-
-/* This is how to output an element of a case-vector that is absolute. */
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
-do { \
- char label[30]; \
- ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
- fprintf (FILE, "\t.word\t"); \
- assemble_name (FILE, label); \
- fprintf (FILE, "\n"); \
-} while (0)
-
-/* This is how to output an element of a case-vector that is relative. */
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
-do { \
- char label[30]; \
- ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
- fprintf (FILE, "\t.word\t"); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-"); \
- ASM_GENERATE_INTERNAL_LABEL (label, "L", REL); \
- assemble_name (FILE, label); \
- fprintf (FILE, ")\n"); \
-} while (0)
-
-/* A C expression to output text to align the location counter in the way
- that is desirable at the beginning of a loop. */
-/* On the M32R, align loops to 32 byte boundaries (cache line size)
- if -malign-loops. */
-#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
-do { if (TARGET_ALIGN_LOOPS) ASM_OUTPUT_ALIGN (FILE, 5); } while (0)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-/* .balign is used to avoid confusion. */
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
-do { if ((LOG) != 0) fprintf (FILE, "\t.balign %d\n", 1 << (LOG)); } while (0)
-
-/* Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
- separate, explicit argument. If you define this macro, it is used in
- place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
- handling the required alignment of the variable. The alignment is
- specified as the number of bits. */
-
-#define SCOMMON_ASM_OP ".scomm"
-
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
-do { \
- if ((SIZE) > 0 && (SIZE) <= g_switch_value) \
- fprintf ((FILE), "\t%s\t", SCOMMON_ASM_OP); \
- else \
- fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
-} while (0)
-
-#if 0 /* not needed, delete later */
-/* Like `ASM_OUTPUT_LOCAL' except takes the required alignment as a
- separate, explicit argument. If you define this macro, it is used in
- place of `ASM_OUTPUT_LOCAL', and gives you more flexibility in
- handling the required alignment of the variable. The alignment is
- specified as the number of bits. */
-
-extern void sbss_section ();
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- if ((SIZE) > 0 && (SIZE) <= g_switch_value) \
- { \
- sbss_section (); \
- ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
- ASM_OUTPUT_SKIP (FILE, SIZE); \
- if (!flag_inhibit_size_directive) \
- { \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", SIZE); \
- } \
- } \
- else \
- { \
- /* This is copied from svr4.h. */ \
- fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), "\n"); \
- ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
- } \
-} while (0)
-#endif
-
-/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
- separate, explicit argument. If you define this macro, it is used in
- place of `ASM_OUTPUT_BSS', and gives you more flexibility in
- handling the required alignment of the variable. The alignment is
- specified as the number of bits.
-
- For the M32R we need sbss support. */
-
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
-do { \
- ASM_GLOBALIZE_LABEL (FILE, NAME); \
- ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
-} while (0)
-
-/* Debugging information. */
-
-/* Generate DBX and DWARF debugging information. */
-#define DBX_DEBUGGING_INFO
-#define DWARF_DEBUGGING_INFO
-
-/* Prefer STABS (for now). */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* How to renumber registers for dbx and gdb. */
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Turn off splitting of long stabs. */
-#define DBX_CONTIN_LENGTH 0
-
-/* Miscellaneous. */
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE Pmode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* It's not clear what PIC will look like or whether we want to use -fpic
- for the embedded form currently being talked about. For now require -fpic
- to get pc relative switch tables. */
-/*#define CASE_VECTOR_PC_RELATIVE*/
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-#define STORE_FLAG_VALUE 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-/* ??? The M32R doesn't have full 32 bit pointers, but making this PSImode has
- it's own problems (you have to add extendpsisi2 and truncsipsi2).
- Try to avoid it. */
-#define Pmode SImode
-
-/* A function address in a call instruction. */
-#define FUNCTION_MODE SImode
-
-/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
- is a valid machine specific attribute for DECL.
- The attributes in ATTRIBUTES have previously been assigned to TYPE. */
-extern int m32r_valid_machine_attribute ();
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-m32r_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
-
-/* A C expression that returns zero if the attributes on TYPE1 and TYPE2 are
- incompatible, one if they are compatible, and two if they are
- nearly compatible (which causes a warning to be generated). */
-extern int m32r_comp_type_attributes ();
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
-m32r_comp_type_attributes (TYPE1, TYPE2)
-
-/* Give newly defined TYPE some default attributes. */
-extern void m32r_set_default_type_attributes ();
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
-m32r_set_default_type_attributes (TYPE)
-
-/* Define the information needed to generate branch and scc insns. This is
- stored from the compare operation. Note that we can't use "rtx" here
- since it hasn't been defined! */
-extern struct rtx_def *m32r_compare_op0, *m32r_compare_op1;
-
-/* Define the function that build the compare insn for scc and bcc. */
-extern struct rtx_def *gen_compare ();
-
-/* M32R function types. */
-enum m32r_function_type {
- M32R_FUNCTION_UNKNOWN, M32R_FUNCTION_NORMAL, M32R_FUNCTION_INTERRUPT
-};
-#define M32R_INTERRUPT_P(TYPE) \
-((TYPE) == M32R_FUNCTION_INTERRUPT)
-/* Compute the type of a function from its DECL. */
-enum m32r_function_type m32r_compute_function_type ();
diff --git a/gcc/config/m32r/m32r.md b/gcc/config/m32r/m32r.md
deleted file mode 100644
index 5d11a7bea4b..00000000000
--- a/gcc/config/m32r/m32r.md
+++ /dev/null
@@ -1,1421 +0,0 @@
-;; Machine description of the M32R/D cpu for GNU C compiler
-;; Copyright (C) 1996, 1997 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.
-
-;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; unspec usage
-;; 0 - blockage
-;; 1 - flush_icache
-;; 2 - load_sda_base
-
-;; Insn type. Used to default other attribute values.
-;; move4 = 4 byte move
-(define_attr "type"
- "move,move4,load,store,unary,binary,compare,shift,mul,div,uncond_branch,branch,call,multi,misc"
- (const_string "misc"))
-
-;; Length in bytes.
-(define_attr "length" ""
- (cond [(eq_attr "type" "move,unary,shift,mul,div")
- (const_int 2)
-
- (eq_attr "type" "binary")
- (if_then_else (match_operand 2 "register_operand" "")
- (const_int 2) (const_int 4))
-
- (eq_attr "type" "compare")
- (if_then_else (match_operand 1 "register_operand" "")
- (const_int 2) (const_int 4))
-
- (eq_attr "type" "load")
- (if_then_else (match_operand 1 "memreg_operand" "")
- (const_int 2) (const_int 4))
-
- (eq_attr "type" "store")
- (if_then_else (match_operand 0 "memreg_operand" "")
- (const_int 2) (const_int 4))
-
- (eq_attr "type" "multi")
- (const_int 8)
-
- (eq_attr "type" "uncond_branch,branch,call")
- (const_int 4)]
-
- (const_int 4)))
-
-;; The length here is the length of a single asm. Unfortunately it might be
-;; 2 or 4 so we must allow for 4. That's ok though.
-(define_asm_attributes
- [(set_attr "length" "4")
- (set_attr "type" "multi")])
-
-;; Function units of the M32R
-;; Units that take one cycle do not need to be specified.
-
-;; (define_function_unit {name} {num-units} {n-users} {test}
-;; {ready-delay} {issue-delay} [{conflict-list}])
-
-;; References to loaded registers should wait a cycle.
-;; Memory with load-delay of 1 (i.e. 2 cycle load).
-(define_function_unit "memory" 1 1 (eq_attr "type" "load") 2 0)
-
-;; Hack to get GCC to better pack the instructions.
-;; We pretend there is a separate long function unit that conflicts with
-;; both the left and right 16 bit insn slots.
-
-(define_function_unit "left" 1 1
- (eq_attr "length" "2")
- 1 0
- [(not (eq_attr "length" "2"))])
-
-(define_function_unit "right" 1 1
- (eq_attr "length" "1")
- 1 0
- [(not (eq_attr "length" "2"))])
-
-(define_function_unit "long" 1 1
- (not (eq_attr "length" "2"))
- 1 0
- [(eq_attr "length" "2")])
-
-;; Expand prologue as RTL
-;; FIXME: Unfinished.
-
-;(define_expand "prologue"
-; [(const_int 1)]
-; ""
-; "
-;{
-;}")
-
-;; Move instructions.
-;;
-;; For QI and HI moves, the register must contain the full properly
-;; sign-extended value. nonzero_bits assumes this [otherwise
-;; SHORT_IMMEDIATES_SIGN_EXTEND must be used, but the comment for it
-;; says it's a kludge and the .md files should be fixed instead].
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- /* Everything except mem = const or mem = mem can be done easily.
- Objects in the small data area are handled too. */
-
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (QImode, operands[1]);
-}")
-
-(define_insn "*movqi_insn"
- [(set (match_operand:QI 0 "move_dest_operand" "=r,r,r,r,m")
- (match_operand:QI 1 "move_src_operand" "r,I,JQR,m,r"))]
- "register_operand (operands[0], QImode) || register_operand (operands[1], QImode)"
- "@
- mv %0,%1
- ldi %0,%#%1
- ldi %0,%#%1
- ldub %0,%1
- stb %1,%0"
- [(set_attr "type" "move,move,move4,load,store")])
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- /* Everything except mem = const or mem = mem can be done easily. */
-
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (HImode, operands[1]);
-}")
-
-(define_insn "*movhi_insn"
- [(set (match_operand:HI 0 "move_dest_operand" "=r,r,r,r,r,m")
- (match_operand:HI 1 "move_src_operand" "r,I,JQR,K,m,r"))]
- "register_operand (operands[0], HImode) || register_operand (operands[1], HImode)"
- "@
- mv %0,%1
- ldi %0,%#%1
- ldi %0,%#%1
- ld24 %0,%#%1
- lduh %0,%1
- sth %1,%0"
- [(set_attr "type" "move,move,move4,move4,load,store")])
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- /* Everything except mem = const or mem = mem can be done easily.
- If medium or large code model, symbols have to be loaded with seth/add3.
- Objects in the small data area are handled too. */
-
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (SImode, operands[1]);
-
- if (small_data_operand (operands[1], SImode))
- {
- emit_insn (gen_movsi_sda (operands[0], operands[1]));
- DONE;
- }
- else if (addr32_operand (operands[1], SImode))
- {
- emit_insn (gen_movsi_addr32 (operands[0], operands[1]));
- DONE;
- }
-}")
-
-(define_insn "*movsi_insn"
- [(set (match_operand:SI 0 "move_dest_operand" "=r,r,r,r,r,r,r,m")
-;; FIXME: Do we need a const_double constraint here for large unsigned values?
- (match_operand:SI 1 "move_src_operand" "r,I,J,MQ,L,N,m,r"))]
- "register_operand (operands[0], SImode) || register_operand (operands[1], SImode)"
- "@
- mv %0,%1
- ldi %0,%#%1
- ldi %0,%#%1
- ld24 %0,%#%1
- seth %0,%#%T1
- seth %0,%#%T1\;or3 %0,%0,%#%B1
- ld %0,%1
- st %1,%0"
- [(set_attr "type" "move,move,move4,move4,move4,multi,load,store")])
-
-;; Small data area support.
-;; The address of _SDA_BASE_ is loaded into a register and all objects in
-;; the small data area are indexed off that. This is done for each reference
-;; but cse will clean things up for us. We let the compiler choose the
-;; register to use so we needn't allocate (and maybe even fix) a special
-;; register to use. Since the load and store insns have a 16 bit offset the
-;; total size of the data area can be 64K. However, if the data area lives
-;; above 16M (24 bits), _SDA_BASE_ will have to be loaded with seth/add3 which
-;; would then yield 3 instructions to reference an object [though there would
-;; be no net loss if two or more objects were referenced]. The 3 insns can be
-;; reduced back to 2 if the size of the small data area were reduced to 32K
-;; [then seth + ld/st would work for any object in the area]. Doing this
-;; would require special handling of _SDA_BASE_ (its value would be
-;; (.sdata + 32K) & 0xffff0000) and reloc computations would be different
-;; [I think]. What to do about this is defered until later and for now we
-;; require .sdata to be in the first 16M.
-
-(define_expand "movsi_sda"
- [(set (match_dup 2)
- (unspec [(const_int 0)] 2))
- (set (match_operand:SI 0 "register_operand" "")
- (lo_sum:SI (match_dup 2)
- (match_operand:SI 1 "small_data_operand" "")))]
- ""
- "
-{
- if (reload_in_progress || reload_completed)
- operands[2] = operands[0];
- else
- operands[2] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "*load_sda_base"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (unspec [(const_int 0)] 2))]
- ""
- "ld24 %0,#_SDA_BASE_"
- [(set_attr "type" "move4")])
-
-;; 32 bit address support.
-
-(define_expand "movsi_addr32"
- [(set (match_dup 2)
- ; addr32_operand isn't used because it's too restrictive,
- ; seth_add3_operand is more general and thus safer.
- (high:SI (match_operand:SI 1 "seth_add3_operand" "")))
- (set (match_operand:SI 0 "register_operand" "")
- (lo_sum:SI (match_dup 2) (match_dup 1)))]
- ""
- "
-{
- if (reload_in_progress || reload_completed)
- operands[2] = operands[0];
- else
- operands[2] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "set_hi_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (match_operand 1 "symbolic_operand" "")))]
- ""
- "seth %0,%#shigh(%1)"
- [(set_attr "type" "move4")])
-
-(define_insn "lo_sum_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "in")))]
- ""
- "add3 %0,%1,%#%B2"
- [(set_attr "length" "4")])
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{
- /* Everything except mem = const or mem = mem can be done easily. */
-
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (DImode, operands[1]);
-
- if (CONSTANT_P (operands[1])
- && ! easy_di_const (operands[1]))
- {
- rtx mem = force_const_mem (DImode, operands[1]);
- rtx reg = ((reload_in_progress || reload_completed)
- ? copy_to_suggested_reg (XEXP (mem, 0),
- gen_rtx (REG, Pmode, REGNO (operands[0])),
- Pmode)
- : force_reg (Pmode, XEXP (mem, 0)));
- operands[1] = change_address (mem, DImode, reg);
- }
-}")
-
-(define_insn "*movdi_insn"
- [(set (match_operand:DI 0 "move_dest_operand" "=r,r,r,m")
- (match_operand:DI 1 "move_double_src_operand" "r,nG,m,r"))]
- "register_operand (operands[0], DImode) || register_operand (operands[1], DImode)"
- "*
-{
- switch (which_alternative)
- {
- case 0 :
- /* We normally copy the low-numbered register first. However, if
- the first register operand 0 is the same as the second register of
- operand 1, we must copy in the opposite order. */
- if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
- return \"mv %R0,%R1\;mv %0,%1\";
- else
- return \"mv %0,%1\;mv %R0,%R1\";
- case 1 :
- return \"#\";
- case 2 :
- /* If the low-address word is used in the address, we must load it
- last. Otherwise, load it first. Note that we cannot have
- auto-increment in that case since the address register is known to be
- dead. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands [1], 0))
- {
- return \"ld %R0,%R1\;ld %0,%1\";
- }
- else
- {
- /* Try to use auto-inc addressing if we can. */
- if (GET_CODE (XEXP (operands[1], 0)) == REG
- && dead_or_set_p (insn, XEXP (operands[1], 0)))
- {
- operands[1] = XEXP (operands[1], 0);
- return \"ld %0,@%1+\;ld %R0,@%1\";
- }
- return \"ld %0,%1\;ld %R0,%R1\";
- }
- case 3 :
- /* Try to use auto-inc addressing if we can. */
- if (GET_CODE (XEXP (operands[0], 0)) == REG
- && dead_or_set_p (insn, XEXP (operands[0], 0)))
- {
- operands[0] = XEXP (operands[0], 0);
- return \"st %1,@%0\;st %R1,@+%0\";
- }
- return \"st %1,%0\;st %R1,%R0\";
- }
-}"
- [(set_attr "type" "multi,multi,multi,multi")
- (set_attr "length" "4,4,6,6")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (match_operand:DI 1 "const_double_operand" ""))]
- "reload_completed"
- [(set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (match_dup 5))]
- "
-{
- operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
- operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
- split_double (operands[1], operands + 4, operands + 5);
-}")
-
-;; Floating point move insns.
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- /* Everything except mem = const or mem = mem can be done easily. */
-
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (SFmode, operands[1]);
-}")
-
-(define_insn "*movsf_insn"
- [(set (match_operand:SF 0 "move_dest_operand" "=r,r,r,m")
- (match_operand:SF 1 "move_src_operand" "r,F,m,r"))]
- "register_operand (operands[0], SFmode) || register_operand (operands[1], SFmode)"
- "*
-{
- switch (which_alternative)
- {
- case 0 :
- return \"mv %0,%1\";
- case 1 :
- {
- REAL_VALUE_TYPE r;
- long l;
- REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
- REAL_VALUE_TO_TARGET_SINGLE (r, l);
- operands[1] = GEN_INT (l);
- if (l == 0)
- return \"ldi %0,%#0\";
- if ((l & 0xffff) == 0)
- return \"seth %0,%#%T1\";
- else
- return \"seth %0,%#%T1\;or3 %0,%0,%#%B1\";
- }
- case 2 :
- return \"ld %0,%1\";
- case 3 :
- return \"st %1,%0\";
- }
-}"
- ;; ??? Length of alternative 1 is either 2, 4 or 8.
- [(set_attr "type" "move,multi,load,store")])
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
-{
- /* Everything except mem = const or mem = mem can be done easily. */
-
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (DFmode, operands[1]);
-
- if (GET_CODE (operands[1]) == CONST_DOUBLE
- && ! easy_df_const (operands[1]))
- {
- rtx mem = force_const_mem (DFmode, operands[1]);
- rtx reg = ((reload_in_progress || reload_completed)
- ? copy_to_suggested_reg (XEXP (mem, 0),
- gen_rtx (REG, Pmode, REGNO (operands[0])),
- Pmode)
- : force_reg (Pmode, XEXP (mem, 0)));
- operands[1] = change_address (mem, DFmode, reg);
- }
-}")
-
-(define_insn "*movdf_insn"
- [(set (match_operand:DF 0 "move_dest_operand" "=r,r,r,m")
- (match_operand:DF 1 "move_double_src_operand" "r,H,m,r"))]
- "register_operand (operands[0], DFmode) || register_operand (operands[1], DFmode)"
- "*
-{
- switch (which_alternative)
- {
- case 0 :
- /* We normally copy the low-numbered register first. However, if
- the first register operand 0 is the same as the second register of
- operand 1, we must copy in the opposite order. */
- if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
- return \"mv %R0,%R1\;mv %0,%1\";
- else
- return \"mv %0,%1\;mv %R0,%R1\";
- case 1 :
- {
- REAL_VALUE_TYPE r;
- long l[2];
- REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
- REAL_VALUE_TO_TARGET_DOUBLE (r, l);
- operands[1] = GEN_INT (l[0]);
- if (l[0] == 0 && l[1] == 0)
- return \"ldi %0,%#0\;ldi %R0,%#0\";
- else if (l[1] != 0)
- abort ();
- else if ((l[0] & 0xffff) == 0)
- return \"seth %0,%#%T1\;ldi %R0,%#0\";
- else
- abort ();
- }
- case 2 :
- /* If the low-address word is used in the address, we must load it
- last. Otherwise, load it first. Note that we cannot have
- auto-increment in that case since the address register is known to be
- dead. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands [1], 0))
- {
- return \"ld %R0,%R1\;ld %0,%1\";
- }
- else
- {
- /* Try to use auto-inc addressing if we can. */
- if (GET_CODE (XEXP (operands[1], 0)) == REG
- && dead_or_set_p (insn, XEXP (operands[1], 0)))
- {
- operands[1] = XEXP (operands[1], 0);
- return \"ld %0,@%1+\;ld %R0,@%1\";
- }
- return \"ld %0,%1\;ld %R0,%R1\";
- }
- case 3 :
- /* Try to use auto-inc addressing if we can. */
- if (GET_CODE (XEXP (operands[0], 0)) == REG
- && dead_or_set_p (insn, XEXP (operands[0], 0)))
- {
- operands[0] = XEXP (operands[0], 0);
- return \"st %1,@%0\;st %R1,@+%0\";
- }
- return \"st %1,%0\;st %R1,%R0\";
- }
-}"
- [(set_attr "type" "multi,multi,multi,multi")
- (set_attr "length" "4,6,6,6")])
-
-;; Zero extension instructions.
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
- ""
- "@
- and3 %0,%1,%#255
- ldub %0,%1"
- [(set_attr "type" "unary,load")
- (set_attr "length" "4,*")])
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
- ""
- "@
- and3 %0,%1,%#255
- ldub %0,%1"
- [(set_attr "type" "unary,load")
- (set_attr "length" "4,*")])
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
- ""
- "@
- and3 %0,%1,%#65535
- lduh %0,%1"
- [(set_attr "type" "unary,load")
- (set_attr "length" "4,*")])
-
-;; Sign extension instructions.
-;; FIXME: See v850.md.
-
-;; These patterns originally accepted general_operands, however, slightly
-;; better code is generated by only accepting register_operands, and then
-;; letting combine generate the lds[hb] insns.
-;; [This comment copied from sparc.md, I think.]
-
-(define_expand "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (sign_extend:HI (match_operand:QI 1 "register_operand" "")))]
- ""
- "
-{
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
- int op1_subword = 0;
- int op0_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
- if (GET_CODE (operand0) == SUBREG)
- {
- op0_subword = SUBREG_WORD (operand0);
- operand0 = XEXP (operand0, 0);
- }
- emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
- op1_subword),
- shift_24));
- if (GET_MODE (operand0) != SImode)
- operand0 = gen_rtx (SUBREG, SImode, operand0, op0_subword);
- emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
- DONE;
-}")
-
-(define_insn "*sign_extendqihi2_insn"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
- ""
- "ldb %0,%1"
- [(set_attr "type" "load")])
-
-(define_expand "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
- ""
- "
-{
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
- int op1_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
-
- emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
- op1_subword),
- shift_24));
- emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
- DONE;
-}")
-
-(define_insn "*sign_extendqisi2_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
- ""
- "ldb %0,%1"
- [(set_attr "type" "load")])
-
-(define_expand "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
- ""
- "
-{
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_16 = gen_rtx (CONST_INT, VOIDmode, 16);
- int op1_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
-
- emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
- op1_subword),
- shift_16));
- emit_insn (gen_ashrsi3 (operand0, temp, shift_16));
- DONE;
-}")
-
-(define_insn "*sign_extendhisi2_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
- ""
- "ldh %0,%1"
- [(set_attr "type" "load")])
-
-;; Arithmetic instructions.
-
-; ??? Adding an alternative to split add3 of small constants into two
-; insns yields better instruction packing but slower code. Adds of small
-; values is done a lot.
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (plus:SI (match_operand:SI 1 "register_operand" "%0,0,r")
- (match_operand:SI 2 "nonmemory_operand" "r,I,J")))]
- ""
- "@
- add %0,%2
- addi %0,%#%2
- add3 %0,%1,%#%2"
- [(set_attr "type" "binary")
- (set_attr "length" "2,2,4")])
-
-;(define_split
-; [(set (match_operand:SI 0 "register_operand" "")
-; (plus:SI (match_operand:SI 1 "register_operand" "")
-; (match_operand:SI 2 "int8_operand" "")))]
-; "reload_completed
-; && REGNO (operands[0]) != REGNO (operands[1])
-; && INT8_P (INTVAL (operands[2]))
-; && INTVAL (operands[2]) != 0"
-; [(set (match_dup 0) (match_dup 1))
-; (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))]
-; "")
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "register_operand" "r")))
- (clobber (reg:CC 17))]
- ""
- "*
-{
- /* ??? The cmp clears the condition bit. Can we speed up somehow? */
- return \"cmp %L0,%L0\;addx %L0,%L2\;addx %H0,%H2\";
-}"
- [(set_attr "type" "binary")
- (set_attr "length" "6")])
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "sub %0,%2"
- [(set_attr "type" "binary")])
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:DI 2 "register_operand" "r")))
- (clobber (reg:CC 17))]
- ""
- "*
-{
- /* ??? The cmp clears the condition bit. Can we speed up somehow? */
- return \"cmp %L0,%L0\;subx %L0,%L2\;subx %H0,%H2\";
-}"
- [(set_attr "type" "binary")
- (set_attr "length" "6")])
-
-; Multiply/Divide instructions.
-
-(define_insn "mulhisi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mult:SI (sign_extend:SI (match_operand:HI 1 "register_operand" "r"))
- (sign_extend:SI (match_operand:HI 2 "register_operand" "r"))))]
- ""
- "mullo %1,%2\;mvfacmi %0"
- [(set_attr "type" "mul")
- (set_attr "length" "4")])
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mult:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "mul %0,%2"
- [(set_attr "type" "mul")])
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (div:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "div %0,%2"
- [(set_attr "type" "div")])
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (udiv:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "divu %0,%2"
- [(set_attr "type" "div")])
-
-(define_insn "modsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mod:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "rem %0,%2"
- [(set_attr "type" "div")])
-
-(define_insn "umodsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (umod:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "remu %0,%2"
- [(set_attr "type" "div")])
-
-;; Boolean instructions.
-;;
-;; We don't define the DImode versions as expand_binop does a good enough job.
-;; And if it doesn't it should be fixed.
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (and:SI (match_operand:SI 1 "register_operand" "%0,r")
- (match_operand:SI 2 "nonmemory_operand" "r,K")))]
- ""
- "@
- and %0,%2
- and3 %0,%1,%#%2"
- [(set_attr "type" "binary")])
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (ior:SI (match_operand:SI 1 "register_operand" "%0,r")
- (match_operand:SI 2 "nonmemory_operand" "r,K")))]
- ""
- "@
- or %0,%2
- or3 %0,%1,%#%2"
- [(set_attr "type" "binary")])
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (xor:SI (match_operand:SI 1 "register_operand" "%0,r")
- (match_operand:SI 2 "nonmemory_operand" "r,K")))]
- ""
- "@
- xor %0,%2
- xor3 %0,%1,%#%2"
- [(set_attr "type" "binary")])
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "neg %0,%1"
- [(set_attr "type" "unary")])
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "not %0,%1"
- [(set_attr "type" "unary")])
-
-;; Shift instructions.
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (ashift:SI (match_operand:SI 1 "register_operand" "0,0,r")
- (match_operand:SI 2 "reg_or_uint16_operand" "r,O,K")))]
- ""
- "@
- sll %0,%2
- slli %0,%#%2
- sll3 %0,%1,%#%2"
- [(set_attr "type" "shift")
- (set_attr "length" "2,2,4")])
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0,r")
- (match_operand:SI 2 "reg_or_uint16_operand" "r,O,K")))]
- ""
- "@
- sra %0,%2
- srai %0,%#%2
- sra3 %0,%1,%#%2"
- [(set_attr "type" "shift")
- (set_attr "length" "2,2,4")])
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0,r")
- (match_operand:SI 2 "reg_or_uint16_operand" "r,O,K")))]
- ""
- "@
- srl %0,%2
- srli %0,%#%2
- srl3 %0,%1,%#%2"
- [(set_attr "type" "shift")
- (set_attr "length" "2,2,4")])
-
-;; Compare instructions.
-;; This controls RTL generation and register allocation.
-
-;; We generate RTL for comparisons and branches by having the cmpxx
-;; patterns store away the operands. Then the bcc patterns
-;; emit RTL for both the compare and the branch.
-;;
-;; On the m32r it is more efficient to use the bxxz instructions and
-;; thus merge the compare and branch into one instruction, so they are
-;; prefered.
-
-(define_expand "cmpsi"
- [(set (reg:CC 17)
- (compare:CC (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "nonmemory_operand" "")))]
- ""
- "
-{
- m32r_compare_op0 = operands[0];
- m32r_compare_op1 = operands[1];
- DONE;
-}")
-
-;; The cmp_xxx_insn patterns set the condition bit to the result of the
-;; comparison. There isn't a "compare equal" instruction so cmp_eqsi_insn
-;; is quite inefficient. However, it is rarely used.
-
-(define_insn "cmp_eqsi_insn"
- [(set (reg:CC 17)
- (eq:CC (match_operand:SI 0 "register_operand" "r,r")
- (match_operand:SI 1 "reg_or_cmp_int16_operand" "r,P")))
- (clobber (match_scratch:SI 2 "=&r,&r"))]
- "TARGET_OLD_COMPARE"
- "@
- mv %2,%0\;sub %2,%1\;cmpui %2,#1
- add3 %2,%0,%#%N1\;cmpui %2,#1"
- [(set_attr "type" "compare,compare")
- (set_attr "length" "8,8")])
-
-(define_insn "cmp_ltsi_insn"
- [(set (reg:CC 17)
- (lt:CC (match_operand:SI 0 "register_operand" "r,r")
- (match_operand:SI 1 "reg_or_int16_operand" "r,J")))]
- ""
- "@
- cmp %0,%1
- cmpi %0,%#%1"
- [(set_attr "type" "compare")])
-
-(define_insn "cmp_ltusi_insn"
- [(set (reg:CC 17)
- (ltu:CC (match_operand:SI 0 "register_operand" "r,r")
- (match_operand:SI 1 "reg_or_uint16_operand" "r,K")))]
- ""
- "@
- cmpu %0,%1
- cmpui %0,%#%1"
- [(set_attr "type" "compare")])
-
-;; reg == small constant comparisons are best handled by putting the result
-;; of the comparison in a tmp reg and then using beqz/bnez.
-;; ??? The result register doesn't contain 0/STORE_FLAG_VALUE,
-;; it contains 0/non-zero.
-
-(define_insn "cmp_ne_small_const_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ne:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "cmp_int16_operand" "P")))]
- ""
- "add3 %0,%1,%#%N2"
- [(set_attr "type" "compare")
- (set_attr "length" "4")])
-
-;; These control RTL generation for conditional jump insns.
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (EQ, m32r_compare_op0, m32r_compare_op1);
-}")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (NE, m32r_compare_op0, m32r_compare_op1);
-}")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (GT, m32r_compare_op0, m32r_compare_op1);
-}")
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (LE, m32r_compare_op0, m32r_compare_op1);
-}")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (GE, m32r_compare_op0, m32r_compare_op1);
-}")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (LT, m32r_compare_op0, m32r_compare_op1);
-}")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (GTU, m32r_compare_op0, m32r_compare_op1);
-}")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (LEU, m32r_compare_op0, m32r_compare_op1);
-}")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (GEU, m32r_compare_op0, m32r_compare_op1);
-}")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (match_dup 1)
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- operands[1] = gen_compare (LTU, m32r_compare_op0, m32r_compare_op1);
-}")
-
-;; Now match both normal and inverted jump.
-
-(define_insn "*branch_insn"
- [(set (pc)
- (if_then_else (match_operator 1 "eqne_comparison_operator"
- [(reg 17) (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == NE)
- return \"bc %l0\";
- else
- return \"bnc %l0\";
-}"
- [(set_attr "type" "branch")
- ; We use 400/800 instead of 512,1024 to account for inaccurate insn
- ; lengths and insn alignments that are complex to track.
- ; It's not important that we be hyper-precise here. It may be more
- ; important blah blah blah when the chip supports parallel execution
- ; blah blah blah but until then blah blah blah this is simple and
- ; suffices.
- (set (attr "length") (if_then_else (ltu (plus (minus (match_dup 0) (pc))
- (const_int 400))
- (const_int 800))
- (const_int 2)
- (const_int 4)))])
-
-(define_insn "*rev_branch_insn"
- [(set (pc)
- (if_then_else (match_operator 1 "eqne_comparison_operator"
- [(reg 17) (const_int 0)])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ;"REVERSIBLE_CC_MODE (GET_MODE (XEXP (operands[1], 0)))"
- ""
- "*
-{
- if (GET_CODE (operands[1]) == EQ)
- return \"bc %l0\";
- else
- return \"bnc %l0\";
-}"
- [(set_attr "type" "branch")
- ; We use 400/800 instead of 512,1024 to account for inaccurate insn
- ; lengths and insn alignments that are complex to track.
- ; It's not important that we be hyper-precise here. It may be more
- ; important blah blah blah when the chip supports parallel execution
- ; blah blah blah but until then blah blah blah this is simple and
- ; suffices.
- (set (attr "length") (if_then_else (ltu (plus (minus (match_dup 0) (pc))
- (const_int 400))
- (const_int 800))
- (const_int 2)
- (const_int 4)))])
-
-; reg/reg compare and branch insns
-
-(define_insn "*reg_branch_insn"
- [(set (pc)
- (if_then_else (match_operator 1 "eqne_comparison_operator"
- [(match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "register_operand" "r")])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- /* Is branch target reachable with beq/bne? */
- if (get_attr_length (insn) == 4)
- {
- if (GET_CODE (operands[1]) == EQ)
- return \"beq %2,%3,%l0\";
- else
- return \"bne %2,%3,%l0\";
- }
- else
- {
- if (GET_CODE (operands[1]) == EQ)
- return \"bne %2,%3,1f\;bra %l0\;1:\";
- else
- return \"beq %2,%3,1f\;bra %l0\;1:\";
- }
-}"
- [(set_attr "type" "branch")
- ; We use 25000/50000 instead of 32768/65536 to account for slot filling
- ; which is complex to track and inaccurate length specs.
- (set (attr "length") (if_then_else (ltu (plus (minus (match_dup 0) (pc))
- (const_int 25000))
- (const_int 50000))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn "*rev_reg_branch_insn"
- [(set (pc)
- (if_then_else (match_operator 1 "eqne_comparison_operator"
- [(match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "register_operand" "r")])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- /* Is branch target reachable with beq/bne? */
- if (get_attr_length (insn) == 4)
- {
- if (GET_CODE (operands[1]) == NE)
- return \"beq %2,%3,%l0\";
- else
- return \"bne %2,%3,%l0\";
- }
- else
- {
- if (GET_CODE (operands[1]) == NE)
- return \"bne %2,%3,1f\;bra %l0\;1:\";
- else
- return \"beq %2,%3,1f\;bra %l0\;1:\";
- }
-}"
- [(set_attr "type" "branch")
- ; We use 25000/50000 instead of 32768/65536 to account for slot filling
- ; which is complex to track and inaccurate length specs.
- (set (attr "length") (if_then_else (ltu (plus (minus (match_dup 0) (pc))
- (const_int 25000))
- (const_int 50000))
- (const_int 4)
- (const_int 8)))])
-
-; reg/zero compare and branch insns
-
-(define_insn "*zero_branch_insn"
- [(set (pc)
- (if_then_else (match_operator 1 "signed_comparison_operator"
- [(match_operand:SI 2 "register_operand" "r")
- (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- char *br,*invbr;
- char asmtext[40];
-
- switch (GET_CODE (operands[1]))
- {
- case EQ : br = \"eq\"; invbr = \"ne\"; break;
- case NE : br = \"ne\"; invbr = \"eq\"; break;
- case LE : br = \"le\"; invbr = \"gt\"; break;
- case GT : br = \"gt\"; invbr = \"le\"; break;
- case LT : br = \"lt\"; invbr = \"ge\"; break;
- case GE : br = \"ge\"; invbr = \"lt\"; break;
- }
-
- /* Is branch target reachable with bxxz? */
- if (get_attr_length (insn) == 4)
- {
- sprintf (asmtext, \"b%sz %%2,%%l0\", br);
- output_asm_insn (asmtext, operands);
- }
- else
- {
- sprintf (asmtext, \"b%sz %%2,1f\;bra %%l0\;1:\", invbr);
- output_asm_insn (asmtext, operands);
- }
- return \"\";
-}"
- [(set_attr "type" "branch")
- ; We use 25000/50000 instead of 32768/65536 to account for slot filling
- ; which is complex to track and inaccurate length specs.
- (set (attr "length") (if_then_else (ltu (plus (minus (match_dup 0) (pc))
- (const_int 25000))
- (const_int 50000))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn "*rev_zero_branch_insn"
- [(set (pc)
- (if_then_else (match_operator 1 "eqne_comparison_operator"
- [(match_operand:SI 2 "register_operand" "r")
- (const_int 0)])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- char *br,*invbr;
- char asmtext[40];
-
- switch (GET_CODE (operands[1]))
- {
- case EQ : br = \"eq\"; invbr = \"ne\"; break;
- case NE : br = \"ne\"; invbr = \"eq\"; break;
- case LE : br = \"le\"; invbr = \"gt\"; break;
- case GT : br = \"gt\"; invbr = \"le\"; break;
- case LT : br = \"lt\"; invbr = \"ge\"; break;
- case GE : br = \"ge\"; invbr = \"lt\"; break;
- }
-
- /* Is branch target reachable with bxxz? */
- if (get_attr_length (insn) == 4)
- {
- sprintf (asmtext, \"b%sz %%2,%%l0\", invbr);
- output_asm_insn (asmtext, operands);
- }
- else
- {
- sprintf (asmtext, \"b%sz %%2,1f\;bra %%l0\;1:\", br);
- output_asm_insn (asmtext, operands);
- }
- return \"\";
-}"
- [(set_attr "type" "branch")
- ; We use 25000/50000 instead of 32768/65536 to account for slot filling
- ; which is complex to track and inaccurate length specs.
- (set (attr "length") (if_then_else (ltu (plus (minus (match_dup 0) (pc))
- (const_int 25000))
- (const_int 50000))
- (const_int 4)
- (const_int 8)))])
-
-;; Unconditional and other jump instructions.
-
-(define_insn "jump"
- [(set (pc) (label_ref (match_operand 0 "" "")))]
- ""
- "bra %l0"
- [(set_attr "type" "uncond_branch")
- (set (attr "length") (if_then_else (ltu (plus (minus (match_dup 0) (pc))
- (const_int 400))
- (const_int 800))
- (const_int 2)
- (const_int 4)))])
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
- ""
- "jmp %a0"
- [(set_attr "type" "uncond_branch")
- (set_attr "length" "2")])
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "address_operand" "p"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jmp %a0"
- [(set_attr "type" "uncond_branch")
- (set_attr "length" "2")])
-
-(define_expand "call"
- ;; operands[1] is stack_size_rtx
- ;; operands[2] is next_arg_register
- [(parallel [(call (match_operand:SI 0 "call_operand" "")
- (match_operand 1 "" ""))
- (clobber (reg:SI 14))])]
- ""
- "")
-
-(define_insn "*call_via_reg"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
- (match_operand 1 "" ""))
- (clobber (reg:SI 14))]
- ""
- "jl %0"
- [(set_attr "type" "call")
- (set_attr "length" "2")])
-
-(define_insn "*call_via_label"
- [(call (mem:SI (match_operand:SI 0 "call_address_operand" ""))
- (match_operand 1 "" ""))
- (clobber (reg:SI 14))]
- ""
- "*
-{
- int call26_p = call26_operand (operands[0], FUNCTION_MODE);
-
- if (! call26_p)
- {
- /* We may not be able to reach with a `bl' insn so punt and leave it to
- the linker.
- We do this here, rather than doing a force_reg in the define_expand
- so these insns won't be separated, say by scheduling, thus simplifying
- the linker. */
- return \"seth r14,%T0\;add3 r14,r14,%B0\;jl r14\";
- }
- else
- return \"bl %0\";
-}"
- [(set_attr "type" "call")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "call26_operand (operands[0], FUNCTION_MODE)")
- (const_int 0))
- (const_int 12) ; 10 + 2 for nop filler
- ; The return address must be on a 4 byte boundary so
- ; there's no point in using a value of 2 here. A 2 byte
- ; insn may go in the left slot but we currently can't
- ; use such knowledge.
- (const_int 4)))])
-
-(define_expand "call_value"
- ;; operand 2 is stack_size_rtx
- ;; operand 3 is next_arg_register
- [(parallel [(set (match_operand 0 "register_operand" "=r")
- (call (match_operand:SI 1 "call_operand" "")
- (match_operand 2 "" "")))
- (clobber (reg:SI 14))])]
- ""
- "")
-
-(define_insn "*call_value_via_reg"
- [(set (match_operand 0 "register_operand" "=r")
- (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
- (match_operand 2 "" "")))
- (clobber (reg:SI 14))]
- ""
- "jl %1"
- [(set_attr "type" "call")
- (set_attr "length" "2")])
-
-(define_insn "*call_value_via_label"
- [(set (match_operand 0 "register_operand" "=r")
- (call (mem:SI (match_operand:SI 1 "call_address_operand" ""))
- (match_operand 2 "" "")))
- (clobber (reg:SI 14))]
- ""
- "*
-{
- int call26_p = call26_operand (operands[1], FUNCTION_MODE);
-
- if (! call26_p)
- {
- /* We may not be able to reach with a `bl' insn so punt and leave it to
- the linker.
- We do this here, rather than doing a force_reg in the define_expand
- so these insns won't be separated, say by scheduling, thus simplifying
- the linker. */
- return \"seth r14,%T1\;add3 r14,r14,%B1\;jl r14\";
- }
- else
- return \"bl %1\";
-}"
- [(set_attr "type" "call")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "call26_operand (operands[1], FUNCTION_MODE)")
- (const_int 0))
- (const_int 12) ; 10 + 2 for nop filler
- ; The return address must be on a 4 byte boundary so
- ; there's no point in using a value of 2 here. A 2 byte
- ; insn may go in the left slot but we currently can't
- ; use such knowledge.
- (const_int 4)))])
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop"
- [(set_attr "type" "misc")
- (set_attr "length" "2")])
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-;; Special pattern to flush the icache.
-
-(define_insn "flush_icache"
- [(unspec_volatile [(match_operand 0 "memory_operand" "m")] 0)]
- ""
- "* return \"nop ; flush-icache\";"
- [(set_attr "type" "misc")])
-
-;; Split up troublesome insns for better scheduling.
-
-;; Peepholes go at the end.
-
-;; ??? Setting the type attribute may not be useful, but for completeness
-;; we do it.
-
-(define_peephole
- [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 4)))
- (match_operand:SI 1 "register_operand" "r"))]
- "dead_or_set_p (insn, operands[0])"
- "st %1,@+%0"
- [(set_attr "type" "store")
- (set_attr "length" "2")])
diff --git a/gcc/config/m32r/t-m32r b/gcc/config/m32r/t-m32r
deleted file mode 100644
index 6005eb96db3..00000000000
--- a/gcc/config/m32r/t-m32r
+++ /dev/null
@@ -1,57 +0,0 @@
-# lib1funcs.asm is currently empty.
-CROSS_LIBGCC1 =
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-# Turn off the SDA while compiling libgcc2. There are no headers for it
-# and we want maximal upward compatibility here.
-
-TARGET_LIBGCC2_CFLAGS = -G 0
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-# We need to use -fpic when we are using gcc to compile the routines in
-# initfini.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fpic when compiling the
-# routines in initfini.c.
-# -fpic currently isn't supported for the m32r.
-
-CRTSTUFF_T_CFLAGS =
-
-# .init/.fini section routines
-
-crtinit.o: $(srcdir)/config/m32r/initfini.c $(GCC_PASSES) $(CONFIG_H)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS) \
- -DCRT_INIT -finhibit-size-directive -fno-inline-functions \
- -g0 -c $(srcdir)/config/m32r/initfini.c -o crtinit.o
-
-crtfini.o: $(srcdir)/config/m32r/initfini.c $(GCC_PASSES) $(CONFIG_H)
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS) \
- -DCRT_FINI -finhibit-size-directive -fno-inline-functions \
- -g0 -c $(srcdir)/config/m32r/initfini.c -o crtfini.o
-
-# -mmodel={small,medium} requires separate libraries.
-# We don't build libraries for the large model, instead we use the medium
-# libraries. The only difference is that the large model can handle jumps
-# more than 26 signed bits away.
-
-MULTILIB_OPTIONS = mmodel=small/mmodel=medium
-MULTILIB_DIRNAMES = small medium
-MULTILIB_MATCHES = mmodel?medium=mmodel?large
-
-# Set MULTILIB_EXTRA_OPTS so shipped libraries have small data in .sdata and
-# SHN_M32R_SCOMMON.
-# This is important for objects referenced in system header files.
-MULTILIB_EXTRA_OPTS = msdata=sdata
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/m32r/xm-m32r.h b/gcc/config/m32r/xm-m32r.h
deleted file mode 100644
index 57100c875cd..00000000000
--- a/gcc/config/m32r/xm-m32r.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Configuration for GNU C-compiler for the M32R processor.
- Copyright (C) 1996 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Doubles are stored in memory with the high order word first. This
- matters when cross-compiling. */
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* If compiled with Sun CC, the use of alloca requires this #include. */
-#ifndef __GNUC__
-#include "alloca.h"
-#endif
diff --git a/gcc/config/m68k/3b1.h b/gcc/config/m68k/3b1.h
deleted file mode 100644
index 5f9ec4c7301..00000000000
--- a/gcc/config/m68k/3b1.h
+++ /dev/null
@@ -1,513 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- AT&T UNIX PC version (pc7300, 3b1)
- Copyright (C) 1987, 1993, 1996 Free Software Foundation, Inc.
- Contributed by Alex Crain (alex@umbc3.umd.edu).
-
-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. */
-
-#define SGS_SWITCH_TABLES /* Different switch table handling */
-
-#include "m68k/hp320.h"
-
-/* See m68k.h. 0 means 680[01]0 with no 68881. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* -m68020 requires special flags to the assembler. */
-
-#undef ASM_SPEC
-#define ASM_SPEC "%{m68020:-68020}%{!m68020:-68010} %{m68881:-68881}"
-
-/* we use /lib/libp/lib* when profiling */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{!shlib:%{p:-L/lib/libp} %{pg:-L/lib/libp} -lc}"
-
-/* shared libraries need to use crt0s.o */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
- %{shlib:crt0s.o%s shlib.ifile%s} "
-
-/* cpp has to support a #sccs directive for the /usr/include files */
-
-#define SCCS_DIRECTIVE
-
-/* Make output for SDB. */
-
-#define SDB_DEBUGGING_INFO
-
-/* The .file command should always begin the output. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-output_file_directive ((FILE), main_input_filename)
-
-/* Don't try to define `gcc_compiled.' since the assembler might not
- accept symbols with periods and GDB doesn't run on this machine anyway. */
-#define ASM_IDENTIFY_GCC(FILE)
-
-/* Define __HAVE_68881__ in preprocessor if -m68881 is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-/* ihnp4!lmayk!lgm@eddie.mit.edu says mc68000 and m68k should not be here. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmc68k -Dunix -Dunixpc -D__motorola__ -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-
-#undef REGISTER_NAMES
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
- "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7"}
-
-/* Specify how to pad function arguments.
- Value should be `upward', `downward' or `none'.
- Same as the default, except no padding for large or variable-size args. */
-
-#define FUNCTION_ARG_PADDING(MODE, TYPE) \
- (((MODE) == BLKmode \
- ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && int_size_in_bytes (TYPE) < PARM_BOUNDARY / BITS_PER_UNIT) \
- : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
- ? downward : none)
-
-/* The 3b1 does not have `atexit'. */
-
-#undef HAVE_ATEXIT
-
-/* Override parts of m68k.h to fit the SGS-3b1 assembler. */
-
-#undef TARGET_VERSION
-#undef ASM_FORMAT_PRIVATE_NAME
-#undef ASM_OUTPUT_DOUBLE
-#undef ASM_OUTPUT_FLOAT
-#undef ASM_OUTPUT_ALIGN
-#undef ASM_OUTPUT_SOURCE_FILENAME
-#undef ASM_OUTPUT_SOURCE_LINE
-#undef PRINT_OPERAND_ADDRESS
-#undef ASM_GENERATE_INTERNAL_LABEL
-#undef FUNCTION_PROFILER
-#undef ASM_OUTPUT_ADDR_VEC_ELT
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#undef ASM_OUTPUT_OPCODE
-#undef ASM_OUTPUT_LOCAL
-#undef USER_LABEL_PREFIX
-#undef ASM_OUTPUT_ASCII
-
-#define TARGET_VERSION fprintf (stderr, " (68k, SGS/AT&T unixpc syntax)");
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
- sprintf ((OUTPUT), "%s_%%%d", (NAME), (LABELNO)))
-
-/* The unixpc doesn't know about double's and float's */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf (FILE, "\tlong 0x%x,0x%x\n", l[0], l[1]); \
- } while (0)
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long l[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
- fprintf (FILE, "\tlong 0x%x,0x%x,0x%x\n", l[0], l[1], l[2]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- fprintf ((FILE), "\tlong 0x%x\n", l); \
- } while (0)
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) == 1) \
- fprintf (FILE, "\teven\n"); \
- else if ((LOG) != 0) \
- abort ();
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\tspace %d\n", (SIZE))
-
-/* Can't use ASM_OUTPUT_SKIP in text section; it doesn't leave 0s. */
-
-#define ASM_NO_SKIP_IN_TEXT 1
-
-/* The beginnings of sdb support... */
-
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
- do { fprintf (FILE, "\tfile\t"); \
- output_quoted_string (FILE, FILENAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
- fprintf (FILE, "\tln\t%d\n", \
- (sdb_begin_function_line \
- ? last_linenum - sdb_begin_function_line : 1))
-
-/* Yet another null terminated string format. */
-
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
- do { register int sp = 0, lp = 0; \
- fprintf ((FILE), "\tbyte\t"); \
- loop: \
- if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \
- { lp += 3; \
- fprintf ((FILE), "'%c", (PTR)[sp]); } \
- else \
- { lp += 5; \
- fprintf ((FILE), "0x%x", (PTR)[sp]); } \
- if (++sp < (LEN)) \
- { if (lp > 60) \
- { lp = 0; \
- fprintf ((FILE), "\n\t%s ", ASCII_DATA_ASM_OP); } \
- else \
- putc (',', (FILE)); \
- goto loop; } \
- putc ('\n', (FILE)); } while (0)
-
-/* Note that in the case of the movhi which fetches an element of
- an ADDR_DIFF_VEC the offset output is too large by 2.
- This is because the 3b1 assembler refuses to subtract 2.
- ASM_OUTPUT_CASE_LABEL, below, compensates for this. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx reg1, reg2, breg, ireg; \
- register rtx addr = ADDR; \
- rtx offset; \
- switch (GET_CODE (addr)) \
- { \
- case REG: \
- fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
- break; \
- case PRE_DEC: \
- fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case POST_INC: \
- fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case PLUS: \
- reg1 = 0; reg2 = 0; \
- ireg = 0; breg = 0; \
- offset = 0; \
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
- { \
- offset = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
- { \
- offset = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) != PLUS) ; \
- else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == MULT) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == MULT) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
- || GET_CODE (addr) == SIGN_EXTEND) \
- { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
-/* for OLD_INDEXING \
- else if (GET_CODE (addr) == PLUS) \
- { \
- if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg2 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg2 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- } \
- */ \
- if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
- if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
- || GET_CODE (reg1) == MULT)) \
- || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
- { breg = reg2; ireg = reg1; } \
- else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
- { breg = reg1; ireg = reg2; } \
- if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
- { int scale = 1; \
- if (GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "LD%%%d(%%pc,%s.w", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (XEXP (ireg, 0))]); \
- else \
- fprintf (FILE, "LD%%%d(%%pc,%s.l", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- fprintf (FILE, ")"); \
- break; } \
- if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "LD%%%d(%%pc,%s.l", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (breg)]); \
- putc (')', FILE); \
- break; } \
- if (ireg != 0 || breg != 0) \
- { int scale = 1; \
- if (breg == 0) \
- abort (); \
- if (addr != 0) \
- output_addr_const (FILE, addr); \
- fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \
- if (ireg != 0) \
- putc (',', FILE); \
- if (ireg != 0 && GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
- else if (ireg != 0) \
- fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- putc (')', FILE); \
- break; \
- } \
- else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "LD%%%d(%%pc,%s.w)", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (reg1)]); \
- break; } \
- default: \
- if (GET_CODE (addr) == CONST_INT \
- && INTVAL (addr) < 0x8000 \
- && INTVAL (addr) >= -0x8000) \
- fprintf (FILE, "%d", INTVAL (addr)); \
- else \
- output_addr_const (FILE, addr); \
- }}
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
- sprintf ((LABEL), "%s%%%d", (PREFIX), (NUM))
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%%%d:\n", PREFIX, NUM)
-
-/* Must put address in %a0 , not %d0 . -- LGM, 7/15/88 */
-#define FUNCTION_PROFILER(FILE, LABEL_NO) \
- fprintf (FILE, "\tmov.l &LP%%%d,%%a0\n\tjsr mcount\n", (LABEL_NO))
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\tlong L%%%d\n", (VALUE))
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\tshort L%%%d-L%%%d\n", (VALUE), (REL))
-
-/* ihnp4!lmayk!lgm says that `short 0' triggers assembler bug;
- `short L%nn-L%nn' supposedly works. */
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- if (! RTX_INTEGRATED_P (TABLE)) \
- fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n", \
- XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM)); \
- else \
- fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n\tshort %s%%%d-%s%%%d\n", \
- XVECLEN (PATTERN (TABLE), 1) + 1, (PREFIX), (NUM), \
- (PREFIX), (NUM), (PREFIX), (NUM))
-
-/* At end of a switch table, define LDnnn iff the symbol LInnn was defined.
- Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)"
- fails to assemble. Luckily "LDnnn(pc,d0.l*2)" produces the results
- we want. This difference can be accommodated by making the assembler
- define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other
- string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END
- macro. */
-
-#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
-{ if (switch_table_difference_label_flag) \
- fprintf (FILE, "\tset LD%%%d,L%%%d-LI%%%d\n", (NUM), (NUM), (NUM)); \
- switch_table_difference_label_flag = 0; }
-
-int switch_table_difference_label_flag;
-
-#define ASM_OUTPUT_OPCODE(FILE, PTR) \
-{ if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
- { ++(PTR); \
- while (*(PTR) != ' ') \
- { putc (*(PTR), (FILE)); ++(PTR); } \
- fprintf ((FILE), ".w"); } \
- else if ((PTR)[0] == 's') \
- { \
- if (!strncmp ((PTR), "swap", 4)) \
- { fprintf ((FILE), "swap.w"); (PTR) += 4; } \
- } \
- else if ((PTR)[0] == 'f') \
- { \
- if (!strncmp ((PTR), "fmove", 5)) \
- { fprintf ((FILE), "fmov"); (PTR) += 5; } \
- else if (!strncmp ((PTR), "fbne", 4)) \
- { fprintf ((FILE), "fbneq"); (PTR) += 4; } \
- } \
-/* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
- else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
- && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
- { fprintf ((FILE), "mov"); (PTR) += 4; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \
- || (PTR)[0] == 'c') (PTR)++; } \
-/* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
- else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
- && (PTR)[2] == 'b') \
- { fprintf ((FILE), "sub"); (PTR) += 3; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \
- || (PTR)[0] == 'a') (PTR)++; } \
-/* CMP, CMPA, CMPI, CMPM ==> CMP */ \
- else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
- && (PTR)[2] == 'p') \
- { fprintf ((FILE), "cmp"); (PTR) += 3; \
- if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \
- || (PTR)[0] == 'm') (PTR)++; } \
-}
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\tlcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-#define USER_LABEL_PREFIX ""
-
-/* Override usual definitions of SDB output macros.
- These definitions differ only in the absence of the period
- at the beginning of the name of the directive
- and in the use of `~' as the symbol for the current location. */
-
-#define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a))
-#define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a))
-#define PUT_SDB_VAL(a) \
-( fputs ("\tval\t", asm_out_file), \
- output_addr_const (asm_out_file, (a)), \
- fputc (';', asm_out_file))
-
-#define PUT_SDB_DEF(a) \
-do { fprintf (asm_out_file, "\tdef\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, ";"); } while (0)
-
-#define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a)
-#define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file)
-#define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a)
-#define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a)
-#define PUT_SDB_START_DIM fprintf(asm_out_file, "\tdim\t")
-
-#define PUT_SDB_TAG(a) \
-do { fprintf (asm_out_file, "\ttag\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, ";"); } while (0)
-
-#define PUT_SDB_BLOCK_START(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_BLOCK_END(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_FUNCTION_START(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_FUNCTION_END(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_EPILOGUE_END(NAME) \
- fprintf (asm_out_file, \
- "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n", \
- (NAME))
-
-#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
- sprintf ((BUFFER), "~%dfake", (NUMBER));
-
-/* Define subroutines to call to handle multiply, divide, and remainder.
- Use the subroutines that the 3b1's library provides.
- The `*' prevents an underscore from being prepended by the compiler. */
-
-#define DIVSI3_LIBCALL "*ldiv"
-#define UDIVSI3_LIBCALL "*uldiv"
-#define MODSI3_LIBCALL "*lrem"
-#define UMODSI3_LIBCALL "*ulrem"
-#define MULSI3_LIBCALL "*lmul"
-#define UMULSI3_LIBCALL "*ulmul"
-
-/* Definitions for collect2. */
-
-#define OBJECT_FORMAT_COFF
-#define NO_SYS_SIGLIST
-#define MY_ISCOFF(magic) \
- ((magic) == MC68KWRMAGIC || (magic) == MC68KROMAGIC || (magic) == MC68KPGMAGIC)
diff --git a/gcc/config/m68k/3b1g.h b/gcc/config/m68k/3b1g.h
deleted file mode 100644
index 2b1d23ce6a8..00000000000
--- a/gcc/config/m68k/3b1g.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Definitions of target machine for GNU compiler, for a 3b1 using GAS.
- Copyright (C) 1987, 1988 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. */
-
-#include "m68k/m68k.h"
-
-/* See m68k.h. 0 means 68000 with no 68881. */
-#define TARGET_DEFAULT 0
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Define __HAVE_68881 in preprocessor only if -m68881 is specified.
- This will control the use of inline 68881 insns in certain macros.
- Also inform the program which CPU this is for. */
-#define CPP_SPEC "%{m68881:-D__HAVE_68881__} \
-%{!ansi:%{m68020:-Dmc68020}%{mc68020:-Dmc68020}%{!mc68020:%{!m68020:-Dmc68010}}}"
-
-/* -m68020 requires special flags to the assembler. */
-#define ASM_SPEC \
- "%{m68020:-mc68020}%{mc68020:-mc68020}%{!mc68020:%{!m68020:-mc68010}}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-#define CPP_PREDEFINES "-Dmc68000 -Dmc68k -Dunix -Dunixpc -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-
-/* This is (not really) BSD, so (but) it wants DBX format. */
-#define DBX_DEBUGGING_INFO
-
-/* Brain damage. */
-#define SCCS_DIRECTIVE
-
-/* Specify how to pad function arguments.
- Value should be `upward', `downward' or `none'.
- Same as the default, except no padding for large or variable-size args. */
-#define FUNCTION_ARG_PADDING(MODE, TYPE) \
- (((MODE) == BLKmode \
- ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && int_size_in_bytes (TYPE) < PARM_BOUNDARY / BITS_PER_UNIT) \
- : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
- ? downward : none)
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* Generate calls to memcpy, memcmp and memset. */
-#define TARGET_MEM_FUNCTIONS
-
diff --git a/gcc/config/m68k/a-ux.h b/gcc/config/m68k/a-ux.h
deleted file mode 100644
index 74aaa4ea9ad..00000000000
--- a/gcc/config/m68k/a-ux.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* Definitions for Motorola 680x0 running A/UX
- Copyright (C) 1996 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 was renamed from aux.h because of MSDOS: aux.anything
- isn't usable. Sigh. */
-
-/* Execution environment */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020) /* 68020, 68881 */
-
-#define CPP_PREDEFINES "-Dunix -Dm68k -DAUX -DmacII \
--Asystem(unix) -Asystem(AUX) -Acpu(m68k) -Amachine(m68k) -Amachine(macII)"
-
-#define CPP_SPEC \
-"%{!msoft-float:%{!ansi:-Dmc68881 }-D__HAVE_68881__ }\
--Acpu(mc68000) -D__mc68000__ %{!ansi:-Dmc68000 }\
-%{!mc68000:%{!m68000:-Acpu(mc68020) -D__mc68020__ %{!ansi:-Dmc68020 }}}\
-%{m68030:-Acpu(mc68030) -D__mc68030__ %{!ansi:-Dmc68030 }}\
-%{m68040:-Acpu(mc68040) -D__mc68040__ %{!ansi:-Dmc68040 }}\
-%{!ansi:%{!traditional:-D__STDC__=2 }}\
-%{sbsd:-D_BSD_SOURCE -DBSD }%{ZB:-D_BSD_SOURCE -DBSD }\
-%{ssysv:-D_SYSV_SOURCE -DSYSV -DUSG }%{ZS:-D_SYSV_SOURCE -DSYSV -DUSG }\
-%{sposix:-D_POSIX_SOURCE -DPOSIX }%{ZP:-D_POSIX_SOURCE -DPOSIX }\
-%{sposix+:-D_POSIX_SOURCE -DPOSIX }\
-%{saux:-D_AUX_SOURCE }%{ZA:-D_AUX_SOURCE }\
-%{!sbsd:%{!ZB:%{!ssysv:%{!ZS:%{!sposix:%{!ZP:%{!snone:\
--D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE }}}}}}}"
-
-#define LIB_SPEC \
-"%{sbsd:-lbsd }%{ZB:-lbsd }\
-%{ssysv:-lsvid }%{ZS:-lsvid }\
-%{sposix:-lposix }%{ZP:-lposix }%{sposix+:-lposix }\
-%{!static:%{smac:-lmac_s -lat -lld -lmr }-lc_s }\
-%{static:%{smac:-lmac -lat -lld -lmr }-lc }"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
-"%{pg:mcrt0.o%s }%{!pg:%{p:mcrt1.o%s }\
-%{!p:%{smac:maccrt1.o%s low.o%s }%{!smac:crt1.o%s }}}\
-crt2.o%s "
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtn.o%s "
-
-
-/*===================================================================*/
-/* Compilation environment -- mostly */
-
-#define NO_SYS_SIGLIST
-
-/* We provide atexit(), A/UX does not have it */
-#define HAVE_ATEXIT
-
-/* Generate calls to memcpy, memcmp and memset, as opposed to bcopy, bcmp,
- and bzero */
-#define TARGET_MEM_FUNCTIONS
-
-/* Resize standard types */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "unsigned int"
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* Bits needed by collect */
-
-#define OBJECT_FORMAT_COFF
-#define MY_ISCOFF(m) ((m) == M68TVMAGIC || \
- (m) == M68MAGIC || \
- (m) == MC68TVMAGIC || \
- (m) == MC68MAGIC || \
- (m) == M68NSMAGIC)
-
-
-#ifndef USE_COLLECT2
-/* For .ctor/.dtor sections for collecting constructors */
-/* We have special start/end files for defining [cd]tor lists */
-#define CTOR_LISTS_DEFINED_EXTERNALLY
-#endif
-
-
-/*======================================================================*/
-/* Calling convention and library support changes */
-
-/* Define how to generate (in the callee) the output value of a function
- and how to find (in the caller) the value returned by a function. VALTYPE
- is the data type of the value (as a tree). If the precise function being
- called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0.
- For A/UX generate the result in d0, a0, or fp0 as appropriate. */
-
-#undef FUNCTION_VALUE
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
- : (TREE_CODE (VALTYPE) == POINTER_TYPE \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
- : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
-
-#undef LIBCALL_VALUE
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, (MODE), ((TARGET_68881 && \
- ((MODE) == SFmode || (MODE) == DFmode)) ? 16 : 0))
-
-/* 1 if N is a possible register number for a function value.
- For A/UX allow d0, a0, or fp0 as return registers, for integral,
- pointer, or floating types, respectively. Reject fp0 if not using a
- 68881 coprocessor. */
-
-#undef FUNCTION_VALUE_REGNO_P
-#define FUNCTION_VALUE_REGNO_P(N) \
- ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
-
-/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
- more than one register. */
-
-#undef NEEDS_UNTYPED_CALL
-#define NEEDS_UNTYPED_CALL 1
-
-/* For compatibility with the large body of existing code which does not
- always properly declare external functions returning pointer types, the
- A/UX convention is to copy the value returned for pointer functions
- from a0 to d0 in the function epilogue, so that callers that have
- neglected to properly declare the callee can still find the correct return
- value. */
-
-#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
-{ \
- extern int current_function_returns_pointer; \
- if ((current_function_returns_pointer) && \
- ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
- asm_fprintf (FILE, "\t%s %Ra0,%Rd0\n", ASM_MOV_INSN); \
-}
-
-/* How to call the function profiler */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- asm_fprintf (FILE, "\t%Olea %LLP%d,%Ra0\n\t%Ojbsr %s\n", \
- (LABELNO), FUNCTION_PROFILER_SYMBOL)
-
-/* Finalize the trampoline by flushing the insn cache */
-
-#undef FINALIZE_TRAMPOLINE
-#define FINALIZE_TRAMPOLINE(TRAMP) \
- emit_library_call(gen_rtx(SYMBOL_REF, Pmode, "__clear_cache"), \
- 0, VOIDmode, 2, TRAMP, Pmode, \
- plus_constant(TRAMP, TRAMPOLINE_SIZE), Pmode);
-
-/* Clear the instruction cache from `beg' to `end'. This makes an
- inline system call to SYS_sysm68k. The arguments are as follows:
-
- sysm68k(105, addr, scope, cache, len)
-
- 105 - the subfunction code to clear the cache
- addr - the start address for the flush
- scope - the scope of the flush (see the cpush insn)
- cache - which cache to flush (see the cpush insn)
- len - a factor relating to the number of flushes to perform :
- len/16 lines, or len/4096 pages.
-
- While all this is only really relevant to 040's, the system call
- will just return an error (which we ignore) on other systems. */
-
-#define CLEAR_INSN_CACHE(beg, end) \
-{ \
- unsigned _beg = (unsigned)(beg), _end = (unsigned)(end); \
- unsigned _len = ((_end / 16) - (_beg / 16) + 1) * 16; \
- __asm __volatile( \
- ASM_MOV_INSN " %1, %-\n\t" /* nr lines */ \
- ASM_MOV_INSN " %#3, %-\n\t" /* insn+data caches */ \
- ASM_MOV_INSN " %#1, %-\n\t" /* clear lines */ \
- ASM_MOV_INSN " %0, %-\n\t" /* beginning of buffer */ \
- ASM_MOV_INSN " %#105, %-\n\t" /* cache sub-function nr */ \
- ASM_MOV_INSN " %#0, %-\n\t" /* dummy return address */ \
- ASM_MOV_INSN " %#38, %/d0\n\t" /* system call nr */ \
- "trap %#0\n\t" \
- "add%.l %#24, %/sp" \
- : /* no outputs */ \
- : "g"(_beg), "g"(_len) \
- : "%d0"); \
-}
diff --git a/gcc/config/m68k/altos3068.h b/gcc/config/m68k/altos3068.h
deleted file mode 100644
index 5903a12d5a6..00000000000
--- a/gcc/config/m68k/altos3068.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Definitions of target machine for GNU compiler. Altos 3068 68020 version.
- Copyright (C) 1988, 1989, 1993, 1996 Free Software Foundation, Inc.
- Contributed by Jyrki Kuoppala <jkp@cs.hut.fi>
-
-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 "m68k/m68k.h"
-
-/* See m68k.h. 7 means 68020 with 68881. */
-/* 5 is without 68881. Change to 7 if you have 68881 */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68020)
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-#endif
-
-/* Define __HAVE_68881__ in preprocessor,
- according to the -m flags.
- This will control the use of inline 68881 insns in certain macros.
- Also inform the program which CPU this is for. */
-
-#if TARGET_DEFAULT & MASK_68881
-
-/* -m68881 is the default */
-#define CPP_SPEC \
-"%{!msoft-float:-D__HAVE_68881__ }\
-%{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
-
-#else
-
-/* -msoft-float is the default */
-#define CPP_SPEC \
-"%{m68881:-D__HAVE_68881__ }\
-%{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
-
-#endif
-
-/* -m68000 requires special flags to the assembler. */
-
-#define ASM_SPEC \
- "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dmc68000 -DPORTAR -Dmc68k32 -Uvax -Dm68k -Dunix -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* Generate calls to memcpy, memcmp and memset. */
-#define TARGET_MEM_FUNCTIONS
-
-/* We use gnu assembler, linker and gdb, so we want DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Tell some conditionals we will use GAS. Is this really used? */
-
-#define USE_GAS
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", dstr); \
- fprintf (FILE, "\t.double 0r%s\n", dstr); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", dstr); \
- fprintf (FILE, "\t.single 0r%s\n", dstr); \
- } while (0)
-
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { \
- if (CODE == 'f') \
- { \
- char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
- fprintf (FILE, "#0r%s", dstr); \
- } \
- else \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- asm_fprintf ((FILE), "%I0x%x", l); \
- else \
- asm_fprintf ((FILE), "%I0x%lx", l); \
- } \
- } while (0)
-
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- fprintf (FILE, "#0r%s", dstr); \
- } while (0)
-
-/* Return pointer values in both d0 and a0. */
-
-#undef FUNCTION_EXTRA_EPILOGUE
-#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
-{ \
- extern int current_function_returns_pointer; \
- if ((current_function_returns_pointer) && \
- ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode))\
- fprintf (FILE, "\tmovel d0,a0\n"); \
-}
diff --git a/gcc/config/m68k/amix.h b/gcc/config/m68k/amix.h
deleted file mode 100644
index 9b40a29248b..00000000000
--- a/gcc/config/m68k/amix.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Commodore Amiga A3000UX version.
-
- Copyright (C) 1991, 1993 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 1, 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 "m68k/m68kv4.h"
-
-/* rhealey@aggregate.com says dots are no good either. */
-#define NO_DOT_IN_LABEL
-
-/* Alter assembler syntax for fsgldiv and fsglmul.
- It is highly likely that this is a generic SGS m68k assembler dependency.
- If so, it should eventually be handled in the m68k/sgs.h ASM_OUTPUT_OPCODE
- macro, like the other SGS assembler quirks. -fnf */
-
-#define FSGLDIV_USE_S /* Use fsgldiv.s, not fsgldiv.x */
-#define FSGLMUL_USE_S /* Use fsglmul.s, not fsglmul.x */
-
-/* Names to predefine in the preprocessor for this target machine. For the
- Amiga, these definitions match those of the native AT&T compiler. Note
- that we override the definition in m68kv4.h, where SVR4 is defined and
- AMIX isn't. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dm68k -Dunix -DAMIX -D__svr4__ -D__motorola__ \
- -Amachine(m68k) -Acpu(m68k) -Asystem(unix) -Alint(off)"
-
-/* At end of a switch table, define LDnnn iff the symbol LInnn was defined.
- Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)"
- fails to assemble. Luckily "Lnnn(pc,d0.l*2)" produces the results
- we want. This difference can be accommodated by making the assembler
- define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other
- string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END
- macro. (the Amiga assembler has this bug) */
-
-#undef ASM_OUTPUT_CASE_END
-#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
-do { \
- if (switch_table_difference_label_flag) \
- asm_fprintf ((FILE), "\t%s %LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM));\
- switch_table_difference_label_flag = 0; \
-} while (0)
-
-int switch_table_difference_label_flag;
-
-/* This says how to output assembler code to declare an
- uninitialized external linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here.
- [This macro overrides the one in svr4.h because the amix assembler
- has a minimum default alignment of 4, and will not accept any
- explicit alignment smaller than this. -fnf] */
-
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
-do { \
- fputs ("\t.comm\t", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u,%u\n", (SIZE), MAX ((ALIGN) / BITS_PER_UNIT, 4)); \
-} while (0)
-
-/* This says how to output assembler code to declare an
- uninitialized internal linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here.
- [This macro overrides the one in svr4.h because the amix assembler
- has a minimum default alignment of 4, and will not accept any
- explicit alignment smaller than this. -fnf] */
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "\t%s\t%s,%u,%u\n", \
- BSS_ASM_OP, (NAME), (SIZE), MAX ((ALIGN) / BITS_PER_UNIT, 4)); \
-} while (0)
-
-/* This definition of ASM_OUTPUT_ASCII is the same as the one in m68k/sgs.h,
- which has been overridden by the one in svr4.h. However, we can't use
- the one in svr4.h because the amix assembler croaks on some of the
- strings that it emits (such as .string "\"%s\"\n"). */
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- register int sp = 0, lp = 0, ch; \
- fprintf ((FILE), "\t%s ", BYTE_ASM_OP); \
- do { \
- ch = (PTR)[sp]; \
- if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \
- { \
- fprintf ((FILE), "'%c", ch); \
- } \
- else \
- { \
- fprintf ((FILE), "0x%x", ch); \
- } \
- if (++sp < (LEN)) \
- { \
- if ((sp % 10) == 0) \
- { \
- fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP); \
- } \
- else \
- { \
- putc (',', (FILE)); \
- } \
- } \
- } while (sp < (LEN)); \
- putc ('\n', (FILE)); \
-} while (0)
-
-/* The following should be unnecessary as a result of PIC_CASE_VECTOR_ADDRESS.
- But rhealey@aggregate.com says they are still needed. */
-
-/* Override these for the sake of an assembler bug: the Amix
- assembler can't handle .LC0@GOT syntax. This pollutes the final
- table for shared librarys but what's a poor soul to do; sigh... RFH */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- if (flag_pic && !strcmp(PREFIX,"LC")) \
- sprintf (LABEL, "*%s%%%d", PREFIX, NUM); \
- else \
- sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- if (flag_pic && !strcmp(PREFIX,"LC")) \
- asm_fprintf (FILE, "%s%%%d:\n", PREFIX, NUM); \
- else \
- asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
diff --git a/gcc/config/m68k/apollo68.h b/gcc/config/m68k/apollo68.h
deleted file mode 100644
index 8eed141dc84..00000000000
--- a/gcc/config/m68k/apollo68.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/* Definitions of target machine for GNU compiler. Apollo 680X0 version.
- Copyright (C) 1989, 1992, 1996, 1997 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. */
-
-#include "m68k/m68k.h"
-
-/* This symbol may be tested in other files for special Apollo handling */
-
-#define TM_APOLLO
-
-/* See m68k.h. 7 means 68020 with 68881. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-#endif
-
-/* Target switches for the Apollo is the same as in m68k.h, except
- there is no Sun FPA. */
-
-#undef TARGET_SWITCHES
-#define TARGET_SWITCHES \
- { { "68020", 5}, \
- { "c68020", 5}, \
- { "68881", 2}, \
- { "bitfield", 4}, \
- { "68000", -5}, \
- { "c68000", -5}, \
- { "soft-float", -0102}, \
- { "nobitfield", -4}, \
- { "rtd", 8}, \
- { "nortd", -8}, \
- { "short", 040}, \
- { "noshort", -040}, \
- { "", TARGET_DEFAULT}}
-
-/* Define __HAVE_68881__ in preprocessor,
- according to the -m flags.
- This will control the use of inline 68881 insns in certain macros.
- Also inform the program which CPU this is for. */
-
-#if TARGET_DEFAULT & MASK_68881
-
-/* -m68881 is the default */
-#define CPP_SPEC \
-"%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}\
-%{!ansi:%{m68000:-Dmc68010 }%{mc68000:-Dmc68010 }%{!mc68000:%{!m68000:-Dmc68020 }}\
-%{!ansi:-D_APOLLO_SOURCE}}"
-
-#else
-
-/* -msoft-float is the default */
-#define CPP_SPEC \
-"%{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }\
-%{!ansi:%{m68000:-Dmc68010 }%{mc68000:-Dmc68010 }%{!mc68000:%{!m68000:-Dmc68020 }}\
-%{!ansi:-D_APOLLO_SOURCE}}"
-
-#endif
-
-/* Names to predefine in the preprocessor for this target machine. */
-/* These are the ones defined by Apollo, plus mc68000 for uniformity with
- GCC on other 68000 systems. */
-
-#define CPP_PREDEFINES "-Dapollo -Daegis -Dunix -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
-
-/* cpp has to support a #sccs directive for the /usr/include files */
-
-#define SCCS_DIRECTIVE
-
-/* Allow #ident but output nothing for it. */
-
-#define IDENT_DIRECTIVE
-#define ASM_OUTPUT_IDENT(FILE, NAME)
-
-/* -m68000 requires special flags to the assembler. */
-
-#define ASM_SPEC \
- "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}}"
-
-/* STARTFILE_SPEC
- Note that includes knowledge of the default specs for gcc, ie. no
- args translates to the same effect as -m68881 */
-
-#if TARGET_DEFAULT & MASK_68881
-/* -m68881 is the default */
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
-#else
-/* -msoft-float is the default */
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
-#endif
-
-/* Specify library to handle `-a' basic block profiling. */
-
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
-%{a:/usr/lib/bb_link.o} "
-
-/* Debugging is not supported yet */
-
-#undef DBX_DEBUGGING_INFO
-#undef SDB_DEBUGGING_INFO
-
-/* We have atexit(2). So C++ can use it for global destructors. */
-
-#if 0 /* troy@cbme.unsw.edu.au says people are still using sr10.2
- and it does not support atexit. */
-#define HAVE_ATEXIT
-#endif
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY 32
-
-/* Functions which return large structures get the address
- to place the wanted value from a hidden parameter. */
-
-#undef PCC_STATIC_STRUCT_RETURN
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE 0
-#define STRUCT_VALUE_INCOMING 0
-
-/* Specify how to pad function arguments.
- Arguments are not padded at all; the stack is kept aligned on long
- boundaries. */
-
-#define FUNCTION_ARG_PADDING(mode, size) none
-
-/* The definition of this macro imposes a limit on the size of
- an aggregate object which can be treated as if it were a scalar
- object. */
-
-#define MAX_FIXED_MODE_SIZE BITS_PER_WORD
-
-/* The definition of this macro implies that there are cases where
- a scalar value cannot be returned in registers.
- For Apollo, anything larger than one integer register is returned
- using the structure-value mechanism, i.e. objects of DFmode are
- returned that way. */
-
-#define RETURN_IN_MEMORY(type) \
- (TYPE_MODE (type) == BLKmode \
- || GET_MODE_SIZE (TYPE_MODE (type)) > UNITS_PER_WORD)
-
-/* In order to link with Apollo libraries, we can't prefix external
- symbols with an underscore. */
-
-#undef USER_LABEL_PREFIX
-
-/* Use a prefix for local labels, just to be on the save side. */
-
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
-/* Use a register prefix to avoid clashes with external symbols (classic
- example: `extern char PC;' in termcap). */
-
-#undef REGISTER_PREFIX
-#define REGISTER_PREFIX "%"
-
-/* config/m68k.md has an explicit reference to the program counter,
- prefix this by the register prefix. */
-
-#define ASM_RETURN_CASE_JUMP \
- do { \
- if (TARGET_5200) \
- return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
- else \
- return "jmp %%pc@(2,%0:w)" \
- } while (0)
-
-/* Here are the new register names. */
-
-#undef REGISTER_NAMES
-#ifndef SUPPORT_SUN_FPA
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" }
-#else /* SUPPORTED_SUN_FPA */
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", \
- "%fpa0", "%fpa1", "%fpa2", "%fpa3", "%fpa4", "%fpa5", "%fpa6", "%fpa7", \
- "%fpa8", "%fpa9", "%fpa10", "%fpa11", "%fpa12", "%fpa13", "%fpa14", "%fpa15", \
- "%fpa16", "%fpa17", "%fpa18", "%fpa19", "%fpa20", "%fpa21", "%fpa22", "%fpa23", \
- "%fpa24", "%fpa25", "%fpa26", "%fpa27", "%fpa28", "%fpa29", "%fpa30", "%fpa31" }
-#endif /* defined SUPPORT_SUN_FPA */
diff --git a/gcc/config/m68k/atari.h b/gcc/config/m68k/atari.h
deleted file mode 100644
index da0a803250a..00000000000
--- a/gcc/config/m68k/atari.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Atari TT ASV version.
- Copyright (C) 1994, 1995 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 1, 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 "m68k/m68kv4.h"
-
-/* Dollars and dots in labels are not allowed. */
-
-#define NO_DOLLAR_IN_LABEL
-#define NO_DOT_IN_LABEL
-
-/* Alter assembler syntax for fsgldiv and fsglmul.
- It is highly likely that this is a generic SGS m68k assembler dependency.
- If so, it should eventually be handled in the m68k/sgs.h ASM_OUTPUT_OPCODE
- macro, like the other SGS assembler quirks. -fnf */
-
-#define FSGLDIV_USE_S /* Use fsgldiv.s, not fsgldiv.x */
-#define FSGLMUL_USE_S /* Use fsglmul.s, not fsglmul.x */
-
-/* At end of a switch table, define LDnnn iff the symbol LInnn was defined.
- Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)"
- fails to assemble. Luckily "Lnnn(pc,d0.l*2)" produces the results
- we want. This difference can be accommodated by making the assembler
- define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other
- string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END
- macro. (the Amiga assembler has this bug) */
-
-#undef ASM_OUTPUT_CASE_END
-#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
-do { \
- if (switch_table_difference_label_flag) \
- asm_fprintf ((FILE), "\t%s %LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM));\
- switch_table_difference_label_flag = 0; \
-} while (0)
-
-int switch_table_difference_label_flag;
-
-/* This definition of ASM_OUTPUT_ASCII is the same as the one in m68k/sgs.h,
- which has been overridden by the one in svr4.h. However, we can't use
- the one in svr4.h because the ASV assembler croaks on some of the
- strings that it emits (such as .string "\"%s\"\n"). */
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-{ \
- register int sp = 0, lp = 0, ch; \
- fprintf ((FILE), "\t%s ", BYTE_ASM_OP); \
- do { \
- ch = (PTR)[sp]; \
- if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \
- { \
- fprintf ((FILE), "'%c", ch); \
- } \
- else \
- { \
- fprintf ((FILE), "0x%x", ch); \
- } \
- if (++sp < (LEN)) \
- { \
- if ((sp % 10) == 0) \
- { \
- fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP); \
- } \
- else \
- { \
- putc (',', (FILE)); \
- } \
- } \
- } while (sp < (LEN)); \
- putc ('\n', (FILE)); \
-}
-
-/* Override these for the sake of an assembler bug: the ASV
- assembler can't handle .LC0@GOT syntax. This pollutes the final
- table for shared librarys but what's a poor soul to do; sigh... RFH */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- if (flag_pic && !strcmp(PREFIX,"LC")) \
- sprintf (LABEL, "*%s%%%d", PREFIX, NUM); \
- else \
- sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- if (flag_pic && !strcmp(PREFIX,"LC")) \
- asm_fprintf (FILE, "%s%%%d:\n", PREFIX, NUM); \
- else \
- asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
diff --git a/gcc/config/m68k/aux-crt1.c b/gcc/config/m68k/aux-crt1.c
deleted file mode 100644
index 9ee529b053d..00000000000
--- a/gcc/config/m68k/aux-crt1.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Startup code for A/UX
- Copyright (C) 1996 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, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file 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; 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 link this library with files
- compiled with GCC to produce an executable, this does not 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. */
-
-/* This file is compiled three times to produce crt1.o, mcrt1.o, and
- maccrt1.o. The final two are created by defining MCRT1 and MACCRT1
- respectively. */
-
-#include <stdlib.h>
-#ifdef MCRT1
-#include <unistd.h>
-#include <mon.h>
-#endif
-
-/* Extern function declarations */
-
-extern void initfpu(void);
-extern void __istart(void);
-extern void __compatmode(void);
-extern void _cleanup(void);
-extern int main(int, char **, char **);
-extern void exit(int) __attribute__((noreturn));
-extern void _exit(int) __attribute__((noreturn));
-
-#ifdef MACCRT1
-extern void InitMac(void);
-#endif
-#ifdef MCRT1
-static void monitor_start(void);
-#endif
-
-/* Global variables */
-
-char **environ;
-char *__splimit; /* address of top of stack */
-
-
-/* Initialize system and run */
-
-void _start() __attribute__((noreturn));
-void _start()
-{
- register int *fp __asm__("%a6");
- register char *d0 __asm__("%d0");
- char **argv;
- int argc;
-
- __splimit = d0;
- argc = fp[1];
- argv = (char **)&fp[2];
- environ = &argv[argc+1];
-
- initfpu();
- __istart();
- __compatmode();
-
- atexit(_cleanup);
-#ifdef MCRT1
- monitor_start();
-#endif
-#ifdef MACCRT1
- InitMac();
-#endif
-
- exit(main(argc, argv, environ));
-}
-
-
-#ifdef MCRT1
-/* Start/Stop program monitor */
-
-extern void monitor(void *, void *, WORD *, int, int);
-
-static WORD *monitor_buffer;
-
-static void monitor_cleanup(void)
-{
- monitor(NULL, NULL, NULL, 0, 0);
- free(monitor_buffer);
-}
-
-static void monitor_start(void)
-{
- extern int etext;
- extern int stext __asm__(".text");
-
- /* Choice of buffer size should be "no more than a few times
- smaller than the program size" -- I don't believe that there
- are any (useful) functions smaller than two insns (4 bytes)
- so that is the scale factor used here */
- int len = (&etext - &stext + 1) / 4;
-
- monitor_buffer = (WORD *)calloc(len, sizeof(WORD));
- if (monitor_buffer == NULL)
- {
- static const char msg[] = "mcrt1: could not allocate monitor buffer\n";
- write(2, msg, sizeof(msg)-1);
- _exit(-1);
- }
-
- /* I'm not sure why the count cap at 600 -- but that is what A/UX does */
- monitor(&stext, &etext, monitor_buffer, len, 600);
-
- atexit(monitor_cleanup);
-}
-#endif /* MCRT1 */
diff --git a/gcc/config/m68k/aux-crt2.asm b/gcc/config/m68k/aux-crt2.asm
deleted file mode 100644
index 062c16ae8c2..00000000000
--- a/gcc/config/m68k/aux-crt2.asm
+++ /dev/null
@@ -1,42 +0,0 @@
-/* More startup code for A/UX */
-
-#include "tm.h"
-
-#ifdef USE_BIN_AS
- file "crt2.s"
-
-/* The init section is used to support shared libraries */
- init
- global __istart
-
-__istart:
- link %fp,&-4
-#else
- .file "crt2.s"
-
-/* The init section is used to support shared libraries */
-.section .init, "x"
-.even
-.globl __istart
-
-__istart:
- link %fp,#-4
-
-#ifndef USE_COLLECT2
-/* The ctors and dtors sections are used to support COFF collection of
- c++ constructors and destructors */
-.section .ctors, "d"
-.even
-.globl __CTOR_LIST__
-
-__CTOR_LIST__:
- .long -1
-
-.section .dtors, "d"
-.even
-.globl __DTOR_LIST__
-
-__DTOR_LIST__:
- .long -1
-#endif /* USE_COLLECT2 */
-#endif /* USE_BIN_AS */
diff --git a/gcc/config/m68k/aux-crtn.asm b/gcc/config/m68k/aux-crtn.asm
deleted file mode 100644
index ce63d7fead7..00000000000
--- a/gcc/config/m68k/aux-crtn.asm
+++ /dev/null
@@ -1,26 +0,0 @@
-/* More startup code for A/UX */
-
-#include "tm.h"
-
-#ifdef USE_BIN_AS
- file "crtn.s"
-
- init
-
- unlk %fp
- rts
-#else
- .file "crtn.s"
-
-.section .init, "x"
- unlk %fp
- rts
-
-#ifndef USE_COLLECT2
-.section .ctors, "d"
- .long 0
-
-.section .dtors, "d"
- .long 0
-#endif /* USE_COLLECT2 */
-#endif /* USE_BIN_AS */
diff --git a/gcc/config/m68k/aux-exit.c b/gcc/config/m68k/aux-exit.c
deleted file mode 100644
index fe06c77c406..00000000000
--- a/gcc/config/m68k/aux-exit.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Generic atexit()
- Copyright (C) 1996 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, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file 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; 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 link this library with files
- compiled with GCC to produce an executable, this does not 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. */
-
-/* Rather than come up with some ugly hack to make mcrt1 work, it is
- better to just go ahead and provide atexit(). */
-
-
-#include <stdlib.h>
-
-
-void exit(int) __attribute__((noreturn));
-void _exit(int) __attribute__((noreturn));
-void _cleanup(void);
-
-
-#define FNS_PER_BLOCK 32
-
-struct atexit_fn_block
-{
- struct atexit_fn_block *next;
- void (*fns[FNS_PER_BLOCK])(void);
- short used;
-};
-
-
-/* staticly allocate the first block */
-static struct atexit_fn_block atexit_fns;
-static struct atexit_fn_block *current_block = &atexit_fns;
-
-
-int atexit(void (*fn)(void))
-{
- if (current_block->used >= FNS_PER_BLOCK)
- {
- struct atexit_fn_block *new_block =
- (struct atexit_fn_block *)malloc(sizeof(struct atexit_fn_block));
- if (new_block == NULL)
- return -1;
-
- new_block->used = 0;
- new_block->next = current_block;
- current_block = new_block;
- }
-
- current_block->fns[current_block->used++] = fn;
-
- return 0;
-}
-
-
-void exit(int status)
-{
- struct atexit_fn_block *block = current_block, *old_block;
- short i;
-
- while (1)
- {
- for (i = block->used; --i >= 0 ;)
- (*block->fns[i])();
- if (block == &atexit_fns)
- break;
- /* I know what you are thinking -- we are about to exit, why free?
- Because it is friendly to memory leak detectors, that's why. */
- old_block = block;
- block = block->next;
- free(old_block);
- }
-
- _exit(status);
-}
diff --git a/gcc/config/m68k/aux-low.gld b/gcc/config/m68k/aux-low.gld
deleted file mode 100644
index d1bb2a99080..00000000000
--- a/gcc/config/m68k/aux-low.gld
+++ /dev/null
@@ -1,38 +0,0 @@
-/* GLD link script for building mac-compatible executables */
-
-OUTPUT_FORMAT("coff-m68k")
-
-SEARCH_DIR(@tooldir@/lib);
-SEARCH_DIR(@libdir@);
-SEARCH_DIR(/lib);
-SEARCH_DIR(/usr/lib);
-SEARCH_DIR(@local_prefix@/lib);
-
-ENTRY(_start)
-
-SECTIONS
-{
- .lowmem 0 (DSECT) : {
- /usr/lib/low.o (.data)
- }
- .text 0x10000000 : {
- *(.text)
- *(.init)
- *(.fini)
- etext = .;
- _etext = .;
- }
- .data ALIGN(0x40000) : {
- *(.data)
- *(.ctors)
- *(.dtors)
- edata = .;
- _edata = .;
- }
- .bss : {
- *(.bss)
- *(COMMON)
- end = .;
- _end = .;
- }
-}
diff --git a/gcc/config/m68k/aux-mcount.c b/gcc/config/m68k/aux-mcount.c
deleted file mode 100644
index 1001c84762b..00000000000
--- a/gcc/config/m68k/aux-mcount.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Profiling support code for A/UX
- Copyright (C) 1996 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, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file 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; 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 link this library with files
- compiled with GCC to produce an executable, this does not 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. */
-
-/* This routine is called at the beginning of functions compiled with -p
- or -pg. The A/UX libraries call mcount%, but gas cannot generate
- symbols with embedded percent signs. Previous ports of GCC to A/UX
- have done things like (1) assemble a stub routine with the native
- assembler, or (2) assemble a stub routine with gas and edit the object
- file. This solution has the advantage that it can interoperate with
- the A/UX version and can be used in an eventual port of glibc to A/UX. */
-
-#ifndef __GNUC__
-#error This file uses GNU C extensions
-#endif
-
-#include <mon.h>
-
-#ifdef IN_GCC
-#include "tm.h"
-#endif
-
-struct cnt *_countbase;
-
-#ifdef FUNCTION_PROFILER_SYMBOL
-void __mcount() __asm__(FUNCTION_PROFILER_SYMBOL);
-#endif
-
-void __mcount()
-{
- register long **pfncnt __asm__("%a0");
- register long *fncnt = *pfncnt;
-
- if (!fncnt)
- {
- struct cnt *newcnt = _countbase++;
- newcnt->fnpc = (char *)__builtin_return_address(0);
- *pfncnt = fncnt = &newcnt->mcnt;
- }
- *fncnt += 1;
-}
diff --git a/gcc/config/m68k/auxas.h b/gcc/config/m68k/auxas.h
deleted file mode 100644
index 79a242068a5..00000000000
--- a/gcc/config/m68k/auxas.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* Definitions for Motorola 680x0 running A/UX using /bin/as
- Copyright (C) 1996 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. */
-
-#define USE_BIN_AS
-
-#ifndef USE_COLLECT2
-#define USE_COLLECT2
-#endif
-
-#ifndef __ASSEMBLY__
-
-#include "m68k/sgs.h"
-
-#define ASM_SPEC "%{m68030:-68030 }%{m68040:-68040 }"
-
-/* Modify AT&T SGS assembler syntax */
-/* A/UX's as doesn't do dots in pseodo-ops */
-
-#define SDB_DEBUGGING_INFO
-
-#define NO_DOLLAR_IN_LABEL
-#define NO_DOT_IN_LABEL
-
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP "\ttext"
-
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP "\tdata\t1"
-
-#undef BYTE_ASM_OP
-#define BYTE_ASM_OP "byte"
-
-#undef WORD_ASM_OP
-#define WORD_ASM_OP "short"
-
-#undef LONG_ASM_OP
-#define LONG_ASM_OP "long"
-
-#undef SPACE_ASM_OP
-#define SPACE_ASM_OP "space"
-
-#undef ALIGN_ASM_OP
-#define ALIGN_ASM_OP "align"
-
-#undef GLOBAL_ASM_OP
-#define GLOBAL_ASM_OP "\tglobal"
-
-#undef SWBEG_ASM_OP
-#define SWBEG_ASM_OP "swbeg"
-
-#undef SET_ASM_OP
-#define SET_ASM_OP "set"
-
-#undef ASM_PN_FORMAT
-#define ASM_PN_FORMAT "%s%%%d"
-
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "L%"
-
-#define ADDITIONAL_REGISTER_NAMES { "%a6", 14, "%a7", 15 }
-
-#undef ASM_OUTPUT_INT
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf ((FILE), "\t%s ", LONG_ASM_OP), \
- output_addr_const ((FILE), (VALUE)), \
- fprintf ((FILE), "\n"))
-
-#undef ASM_OUTPUT_COMMON
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\tcomm\t", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\tlcomm\t", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- output_file_directive ((FILE), main_input_filename)
-
-#undef ASM_OUTPUT_SOURCE_FILENAME
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) \
-( fputs ("\tfile\t", (FILE)), \
- output_quoted_string ((FILE), (NAME)), \
- fputc ('\n', (FILE)) )
-
-#undef ASM_OUTPUT_CASE_FETCH
-#define ASM_OUTPUT_CASE_FETCH(file, labelno, regname) \
- asm_fprintf (file, "10(%Rpc,%s.", regname)
-
-#define SGS_NO_LI
-
-/* Random macros describing parts of SDB data. */
-
-#define PUT_SDB_SCL(a) \
- fprintf(asm_out_file, "\tscl\t%d%s", (a), SDB_DELIM)
-
-#define PUT_SDB_INT_VAL(a) \
- fprintf (asm_out_file, "\tval\t%d%s", (a), SDB_DELIM)
-
-#define PUT_SDB_VAL(a) \
-( fputs ("\tval\t", asm_out_file), \
- output_addr_const (asm_out_file, (a)), \
- fprintf (asm_out_file, SDB_DELIM))
-
-#define PUT_SDB_DEF(a) \
-do { fprintf (asm_out_file, "\tdef\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, SDB_DELIM); } while (0)
-
-#define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s%s", a, SDB_DELIM)
-
-#define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file)
-
-#define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o%s", a, SDB_DELIM)
-
-#define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d%s", a, SDB_DELIM)
-
-#define PUT_SDB_START_DIM fprintf(asm_out_file, "\tdim\t")
-
-#define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
-
-#define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d%s", a, SDB_DELIM)
-
-#define PUT_SDB_TAG(a) \
-do { fprintf (asm_out_file, "\ttag\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, SDB_DELIM); } while (0)
-
-#define PUT_SDB_BLOCK_START(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~bb%s\tval\t~%s\tscl\t100%s\tline\t%d%s\tendef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-
-#define PUT_SDB_BLOCK_END(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~eb%s\tval\t~%s\tscl\t100%s\tline\t%d%s\tendef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-
-#define PUT_SDB_FUNCTION_START(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~bf%s\tval\t~%s\tscl\t101%s\tline\t%d%s\tendef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-
-#define PUT_SDB_FUNCTION_END(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~ef%s\tval\t~%s\tscl\t101%s\tline\t%d%s\tendef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-
-#define PUT_SDB_EPILOGUE_END(NAME) \
-do { fprintf (asm_out_file, "\tdef\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, NAME); \
- fprintf (asm_out_file, \
- "%s\tval\t~%s\tscl\t-1%s\tendef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM); } while (0)
-
-#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
- sprintf ((BUFFER), "~%dfake", (NUMBER));
-
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
- fprintf((FILE), "\tln\t%d\n", \
- (sdb_begin_function_line > 1 ? \
- last_linenum - sdb_begin_function_line : 1))
-
-#define ASM_MOV_INSN "mov.l"
-
-#define FUNCTION_PROFILER_SYMBOL "mcount%"
-
-#endif /* !__ASSEMBLY__ */
diff --git a/gcc/config/m68k/auxgas.h b/gcc/config/m68k/auxgas.h
deleted file mode 100644
index c2e0d567b45..00000000000
--- a/gcc/config/m68k/auxgas.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Definitions for Motorola 680x0 running A/UX using GAS
- Copyright (C) 1996 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. */
-
-#define USE_GAS
-
-#ifndef __ASSEMBLY__
-
-#include "m68k/m68k.h"
-#include "m68k/coff.h"
-
-#define ASM_SPEC "%{m68000:-Am68000 }%{m68030:-Am68030 }%{m68040:-Am68040 }"
-
-/* Output #ident as a .ident. */
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf (FILE, "\t.ident \"%s\"\n", NAME);
-
-#ifdef IDENTIFY_WITH_IDENT
-/* Put the GCC identification somewhere nicer, I think.
- Does the COFF GDB use the "gcc2_complied." symbol anyway? */
-#define ASM_IDENTIFY_GCC(FILE) /* nothing */
-#define ASM_IDENTIFY_LANGUAGE(FILE) \
- fprintf (FILE, "\t.ident \"GCC (%s) %s\"\n", lang_identify(), version_string)
-#endif
-
-#ifdef USE_COLLECT2
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-/* for the sake of link-level compatibility with /bin/as version */
-#define NO_DOLLAR_IN_LABEL
-#define NO_DOT_IN_LABEL
-#endif
-
-#define ADDITIONAL_REGISTER_NAMES { "%fp", 14, "%a7", 15 }
-
-#define ASM_MOV_INSN "movel"
-
-#define FUNCTION_PROFILER_SYMBOL "__mcount"
-
-#endif /* !__ASSEMBLY__ */
diff --git a/gcc/config/m68k/auxgld.h b/gcc/config/m68k/auxgld.h
deleted file mode 100644
index 12c97afaead..00000000000
--- a/gcc/config/m68k/auxgld.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Definitions for Motorola 680x0 running A/UX using GLD
- Copyright (C) 1996 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. */
-
-#define USE_GNU_LD
-
-#ifndef __ASSEMBLY__
-
-#define LINK_SPEC \
-"%{p:-L/lib/libp -L/usr/lib/libp }%{pg:-L/lib/libp -L/usr/lib/libp }\
-%{smac:-T low.gld%s }"
-
-#endif /* !__ASSEMBLY__ */
diff --git a/gcc/config/m68k/auxld.h b/gcc/config/m68k/auxld.h
deleted file mode 100644
index 932dd6ab953..00000000000
--- a/gcc/config/m68k/auxld.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Definitions for Motorola 680x0 running A/UX using /bin/ld
- Copyright (C) 1996 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. */
-
-#define USE_BIN_LD
-
-#ifndef USE_COLLECT2
-#define USE_COLLECT2
-#endif
-
-#ifndef __ASSEMBLY__
-
-#define LINK_SPEC \
-"%{p:-L/lib/libp -L/usr/lib/libp }%{pg:-L/lib/libp -L/usr/lib/libp }\
-%{smac:low.ld%s }%{!smac:shlib.ld%s }"
-
-#define SWITCHES_NEED_SPACES "o"
-
-#endif /* !__ASSEMBLY__ */
diff --git a/gcc/config/m68k/ccur-GAS.h b/gcc/config/m68k/ccur-GAS.h
deleted file mode 100644
index a7c8d7fe3fd..00000000000
--- a/gcc/config/m68k/ccur-GAS.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Definitions of target machine for GNU compiler. Concurrent 68k version.
- Copyright (C) 1987, 1988, 1995, 1996 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 1, 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 MASSCOMP
-#define MASSCOMP
-#endif
-
-#ifndef CONCURRENT
-#define CONCURRENT
-#endif
-
-#ifndef __mc68000__
-#define __mc68000__
-#endif
-
-#ifndef __mc68020__
-#define __mc68020__
-#endif
-
-#define USE_GAS
-#define MOVE_RATIO 100
-
-#define SPACE_AFTER_L_OPTION
-#define SWITCHES_NEED_SPACES "oL"
-
-/* See m68k.h. 7 means 68020 with 68881. */
-#define TARGET_DEFAULT (MASK_68040_ALSO|MASK_BITFIELD|MASK_68881|MASK_68020)
-
-#include "m68k/m68k.h"
-
-#define SIZE_TYPE "int"
-
-/* for 68k machines this only needs to be TRUE for the 68000 */
-
-#undef STRICT_ALIGNMENT
-#define STRICT_ALIGNMENT 0
-
-/* Names to predefine in the preprocessor for this target machine. */
-#define CPP_PREDEFINES \
- "-Dmc68000 -Dmasscomp -DMASSCOMP -Dunix -DLANGUAGE_C -Dconcurrent -DCONCURRENT"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (68k, GNU GAS syntax)");
-
-/* Discard internal local symbols beginning with 'L'. */
-#define LINK_SPEC "-X"
-
-/* Every structure or union's size must be a multiple of 4 bytes. */
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* No data type wants to be aligned rounder than this. */
-#undef BIGGEST_ALIGNMENT
-#define BIGGEST_ALIGNMENT 32
-
-/* Allocation boundary (in *bits*) for storing pointers in memory. */
-#undef POINTER_BOUNDARY
-#define POINTER_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#undef EMPTY_FIELD_BOUNDARY
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Allocation boundary in bits for the code of a function */
-#undef FUNCTION_BOUNDARY
-#define FUNCTION_BOUNDARY 32
-
-/* Make strings long-word aligned so dhrystones will run faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- (TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* This is BSD, so it wants DBX format. */
-#define DBX_DEBUGGING_INFO
-
-/* Override parts of m68k.h */
-
-#undef CALL_USED_REGISTERS
-#define CALL_USED_REGISTERS \
- {1, 1, 0, 0, 0, 0, 0, 0, \
- 1, 1, 0, 0, 0, 0, 0, 1, \
- 1, 1, 0, 0, 0, 0, 1, 1 }
-
-#undef REG_ALLOC_ORDER
-#define REG_ALLOC_ORDER \
-{ 0, 1, 2, 3, 4, 5, 6, 7,\
- 8, 9, 10, 11, 12, 13, 14, 15, \
- 16, 17, 22, 23, 18, 19, 20, 21 }
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- fprintf (FILE, "#NO_APP\n.globl fltused\n");
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
-{ int _LOG = LOG; \
- if (_LOG == 1) \
- fprintf (FILE, "\t.even\n"); \
- else if (_LOG == 2) \
- fprintf (FILE, "\t.align 4\n"); \
- else if (_LOG != 0) \
- fprintf (FILE, "\t.align %d\n", _LOG);\
-}
-
-/* crt0.c should use the vax-bsd style of entry, with a dummy arg. */
-
-#define CRT0_DUMMIES bogus_fp,
diff --git a/gcc/config/m68k/coff.h b/gcc/config/m68k/coff.h
deleted file mode 100644
index 85b1061a84b..00000000000
--- a/gcc/config/m68k/coff.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- m68k series COFF object files and debugging, version.
- Copyright (C) 1994, 1996, 1997 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 is included after m68k.h by CPU COFF specific files. It
- is not a complete target itself. */
-
-/* Generate sdb debugging information. */
-
-#define SDB_DEBUGGING_INFO
-
-/* Output DBX (stabs) debugging information if using -gstabs. */
-
-#include "dbxcoff.h"
-
-/* COFF symbols don't start with an underscore. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* Use a prefix for local labels, just to be on the save side. */
-
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
-/* Use a register prefix to avoid clashes with external symbols (classic
- example: `extern char PC;' in termcap). */
-
-#undef REGISTER_PREFIX
-#define REGISTER_PREFIX "%"
-
-/* In the machine description we can't use %R, because it will not be seen
- by ASM_FPRINTF. (Isn't that a design bug?). */
-
-#undef REGISTER_PREFIX_MD
-#define REGISTER_PREFIX_MD "%%"
-
-/* config/m68k.md has an explicit reference to the program counter,
- prefix this by the register prefix. */
-
-#define ASM_RETURN_CASE_JUMP \
- do { \
- if (TARGET_5200) \
- return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
- else \
- return "jmp %%pc@(2,%0:w)"; \
- } while (0)
-
-/* Here are the new register names. */
-
-#undef REGISTER_NAMES
-#ifndef SUPPORT_SUN_FPA
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" }
-#else /* SUPPORTED_SUN_FPA */
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", \
- "%fpa0", "%fpa1", "%fpa2", "%fpa3", "%fpa4", "%fpa5", "%fpa6", "%fpa7", \
- "%fpa8", "%fpa9", "%fpa10", "%fpa11", "%fpa12", "%fpa13", "%fpa14", "%fpa15", \
- "%fpa16", "%fpa17", "%fpa18", "%fpa19", "%fpa20", "%fpa21", "%fpa22", "%fpa23", \
- "%fpa24", "%fpa25", "%fpa26", "%fpa27", "%fpa28", "%fpa29", "%fpa30", "%fpa31" }
-#endif /* defined SUPPORT_SUN_FPA */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- output_file_directive ((FILE), main_input_filename)
-
-/* If defined, a C expression whose value is a string containing the
- assembler operation to identify the following data as uninitialized global
- data. */
-
-#define BSS_SECTION_ASM_OP ".section\t.bss"
-
-/* A C statement (sans semicolon) to output to the stdio stream
- FILE the assembler definition of uninitialized global DECL named
- NAME whose size is SIZE bytes and alignment is ALIGN bytes.
- Try to use asm_output_aligned_bss to implement this macro. */
-
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
- asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
-
-/* Support generic sections */
-
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- fprintf((FILE), ".section\t%s,\"%c\"\n", (NAME), \
- (DECL) && (TREE_CODE (DECL) == FUNCTION_DECL || \
- TREE_READONLY (DECL)) ? 'x' : 'd')
-
-/* Support the ctors and dtors sections for g++. */
-
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\""
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-#define INT_ASM_OP ".long"
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* Don't assume anything about startfiles. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
diff --git a/gcc/config/m68k/crds.h b/gcc/config/m68k/crds.h
deleted file mode 100644
index 441b285b4ee..00000000000
--- a/gcc/config/m68k/crds.h
+++ /dev/null
@@ -1,621 +0,0 @@
-/* Definitions of target machine for GNU compiler;
- Charles River Data Systems UNiverse/32.
- Copyright (C) 1987, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Gary E. Miller (Gary_Edmunds_Miller@cup.portal.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. */
-
-#define MOTOROLA /* Use Motorola syntax rather than "MIT" */
-#define SGS /* Uses SGS assembler */
-#define SGS_SWITCH_TABLES /* Different switch table handling */
-#define SGS_NO_LI /* Suppress jump table label usage */
-#define CRDS /* Charles River Data Systems assembler */
-
-#include "m68k/m68k.h"
-
-/* Without STRUCTURE_SIZE_BOUNDARY, we can't ensure that structures are
- aligned such that we can correctly extract bitfields from them.
- Someone should check whether the usual compiler on the crds machine
- provides the equivalent behavior of STRUCTURE_SIZE_BOUNDARY. */
-/* Set to 16 because all other m68k targets have it so */
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* See m68k.h. 0 means 680[01]0 with no 68881. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* special flags to the unos assembler. */
-
-#undef ASM_SPEC
-#define ASM_SPEC "-g"
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{!p:%{!pg:-lunos}}%{p:-lc_p}%{pg:-lc_p}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mc68rt0.o%s}%{!p:c68rt0.o%s}}"
-
-/* CC1 spec */
-#if 0
-/* c.sac only used in _s_call_r() in libunos.a and malloc() in libmalloc.a */
-/* so we do not need to bother ! */
-#define CC1_SPEC "-fpcc-struct-return"
-#endif
-
-/* -O2 for MAX optimization */
-#undef CC1_SPEC
-#define CC1_SPEC "%{O2:-fstrength-reduce}"
-
-/* cpp has to support a #sccs directive for the /usr/include files */
-
-#define SCCS_DIRECTIVE
-
-/* Make output for SDB. */
-
-/* #define SDB_DEBUGGING_INFO UNOS casm has no debugging :-( */
-
-/* UNOS need stack probe :-( */
-
-#if 0
-#define HAVE_probe 1
-#define gen_probe() gen_rtx(ASM_INPUT, VOIDmode, "tstb -2048(sp)\t;probe\n")
-#else
-#undef NEED_PROBE
-#define NEED_PROBE (-2048)
-#endif
-
-/* use memcpy, memset instead of bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Don't try to define `gcc_compiled.' since the assembler might not
- accept symbols with periods and GDB doesn't run on this machine anyway. */
-#define ASM_IDENTIFY_GCC(FILE)
-
-/* Define __HAVE_68881__ in preprocessor if -m68881 is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmc68k -DM68000 -Dmc68000 -Dunos -Dunix -D__motorola__ -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
-
-/* Register in which address to store a structure value
- is passed to a function. */
-/* unos uses ".comm c.sac" returns &c.sac in d0 */
-/* make pointer to c.sac ?
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE gen_rtx(MEM, Pmode, gen_rtx( , , ) )
-*/
-
-#define BSS_SECTION_ASM_OP ".bss"
-
-/* Specify how to pad function arguments.
- Value should be `upward', `downward' or `none'.
- Same as the default, except no padding for large or variable-size args. */
-
-#define FUNCTION_ARG_PADDING(MODE, TYPE) \
- (((MODE) == BLKmode \
- ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && int_size_in_bytes (TYPE) < PARM_BOUNDARY / BITS_PER_UNIT) \
- : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
- ? downward : none)
-
-/* Override parts of m68k.h to fit the CRuDS assembler. */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (68k, CRDS/UNOS)");
-
-/* Specify extra dir to search for include files. */
-#define SYSTEM_INCLUDE_DIR "/include"
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- fprintf (FILE, ";#NO_APP\n");
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#undef ASM_APP_ON
-#define ASM_APP_ON ";#APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF ";#NO_APP\n"
-
-/* The prefix for immediate operands. */
-
-#undef IMMEDIATE_PREFIX
-#define IMMEDIATE_PREFIX "$"
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf (FILE, "\t.long 0x%x, 0x%x\n", l[0], l[1]); \
- } while (0)
-
-/*unos has no .skip :-( */
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t. = . + %u\n", (SIZE));
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-/* should use bss_section instead of data_section but this makes casm die ? */
-
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-{ data_section (); \
- if ((SIZE) > 1) fprintf (FILE, "\t.even\n"); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ":\t. = . + %u\n", (ROUNDED));}
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#undef ASM_OUTPUT_REG_PUSH
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tmovel %s,-(sp)\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#undef ASM_OUTPUT_REG_POP
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmovel (sp)+,%s\n", reg_names[REGNO])
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE, P , SIZE) \
-do { int i; \
- fprintf ((FILE), "\t.ascii \""); \
- for (i = 0; i < (SIZE); i++) \
- { \
- register int c = (P)[i]; \
- if (i != 0 && (i / 200) * 200 == i) \
- fprintf ((FILE), "\"\n\t.ascii \""); \
- if (c >= ' ' && c < 0177) { \
- if (c != '\"' && c != '\\') { \
- putc (c, (FILE)); \
- continue; \
- } \
- } \
- /* brain dead asm doesn't understand char escapes */ \
- fprintf ((FILE), "\"\n\t.byte\t%d\n\t.ascii \"", c); \
- } \
- fprintf ((FILE), "\"\n"); \
- } while (0)
-
-
-/* Change all JBxx to Bxx. Also change all DBRA to DBF.
- Also change divs.l, etc., to divs, etc. But don't change divsl.l. */
-
-#define ASM_OUTPUT_OPCODE(FILE, PTR) \
-{ if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
- { ++(PTR); } \
- else if ((PTR)[0] == 'd') \
- { \
- if (!strncmp ((PTR), "dbra", 4)) \
- { fprintf ((FILE), "dbf"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "div", 3) && (PTR)[5] == ' ') \
- { fprintf ((FILE), "div%c", (PTR)[3]); (PTR) += 6; } \
- } \
-}
-
-
-#if 0
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
-
- On the 68000, we use several CODE characters:
- '.' for dot needed in Motorola-style opcode names.
- '-' for an operand pushing on the stack:
- sp@-, -(sp) or -(%sp) depending on the style of syntax.
- '+' for an operand pushing on the stack:
- sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
- '@' for a reference to the top word on the stack:
- sp@, (sp) or (%sp) depending on the style of syntax.
- '#' for an immediate operand prefix (# in MIT and Motorola syntax
- but & in SGS syntax, $ in unos syntax).
- '!' for the fpcr register (used in some float-to-fixed conversions).
-
- 'b' for byte insn (no effect, on the Sun; this is for the ISI).
- 'd' to force memory addressing to be absolute, not relative.
- 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
- 'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
- than directly). Second part of 'y' below.
- 'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
- or print pair of registers as rx:ry.
- 'y' for a FPA insn (print pair of registers as rx:ry). This also outputs
- CONST_DOUBLE's as SunFPA constant RAM registers if
- possible, so it should not be used except for the SunFPA. */
-
-#undef PRINT_OPERAND_PUNCT_VALID_P
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '.' || (CODE) == '#' || (CODE) == '-' \
- || (CODE) == '+' || (CODE) == '@' || (CODE) == '!')
-
-#undef PRINT_OPERAND
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ int i; \
- if (CODE == '.') ; \
- else if (CODE == '#') fprintf (FILE, "$"); \
- else if (CODE == '-') fprintf (FILE, "-(sp)"); \
- else if (CODE == '+') fprintf (FILE, "(sp)+"); \
- else if (CODE == '@') fprintf (FILE, "(sp)"); \
- else if (CODE == '!') fprintf (FILE, "fpcr"); \
- else if (CODE == '/') \
- ; \
- else if (GET_CODE (X) == REG) \
- { if (REGNO (X) < 16 && (CODE == 'y' || CODE == 'x') && GET_MODE (X) == DFmode) \
- fprintf (FILE, "%s:%s", reg_names[REGNO (X)], reg_names[REGNO (X)+1]); \
- else \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- } \
- else if (GET_CODE (X) == MEM) \
- { \
- output_address (XEXP (X, 0)); \
- if (CODE == 'd' && ! TARGET_68020 \
- && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
- /* fprintf (FILE, ".l") */; \
- } \
- else if ((CODE == 'y' || CODE == 'w') \
- && GET_CODE(X) == CONST_DOUBLE \
- && (i = standard_sun_fpa_constant_p (X))) \
- fprintf (FILE, "%%%d", i & 0x1ff); \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
- { REAL_VALUE_TYPE r; long l; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- if (CODE == 'f') \
- ASM_OUTPUT_FLOAT_OPERAND (CODE, FILE, r); \
- else \
- { REAL_VALUE_TO_TARGET_SINGLE (r, l); \
- fprintf (FILE, "$0x%x", l); } } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
- { REAL_VALUE_TYPE r; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- ASM_OUTPUT_DOUBLE_OPERAND (FILE, r); } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode) \
- { REAL_VALUE_TYPE r; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- ASM_OUTPUT_LONG_DOUBLE_OPERAND (FILE, r); } \
- else { putc ('$', FILE); output_addr_const (FILE, X); }}
-#endif
-
-/* Note that this contains a kludge that knows that the only reason
- we have an address (plus (label_ref...) (reg...))
- is in the insn before a tablejump, and we know that m68k.md
- generates a label LInnn: on such an insn. */
-#undef PRINT_OPERAND_ADDRESS
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx reg1, reg2, breg, ireg; \
- register rtx addr = ADDR; \
- rtx offset; \
- switch (GET_CODE (addr)) \
- { \
- case REG: \
- fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
- break; \
- case PRE_DEC: \
- fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case POST_INC: \
- fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case PLUS: \
- reg1 = 0; reg2 = 0; \
- ireg = 0; breg = 0; \
- offset = 0; \
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
- { \
- offset = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
- { \
- offset = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) != PLUS) ; \
- else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == MULT) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == MULT) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
- || GET_CODE (addr) == SIGN_EXTEND) \
- { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
- if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
- if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
- || GET_CODE (reg1) == MULT)) \
- || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
- { breg = reg2; ireg = reg1; } \
- else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
- { breg = reg1; ireg = reg2; } \
- if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
- { int scale = 1; \
- if (GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "L%d-LI%d-2(pc,%s.w", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (XEXP (ireg, 0))]); \
- else \
- fprintf (FILE, "L%d-LI%d-2(pc,%s.l", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, ":%d", scale); \
- putc (')', FILE); \
- break; } \
- if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "L%d-LI%d-2(pc,%s.l", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (breg)]); \
- putc (')', FILE); \
- break; } \
- if (ireg != 0 || breg != 0) \
- { int scale = 1; \
- if (breg == 0) \
- abort (); \
- if (addr && GET_CODE (addr) == LABEL_REF) abort (); \
- if (addr != 0) \
- output_addr_const (FILE, addr); \
- fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \
- if (breg != 0 && ireg != 0) \
- putc (',', FILE); \
- if (ireg != 0 && GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
- else if (ireg != 0) \
- fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, ":%d", scale); \
- putc (')', FILE); \
- break; \
- } \
- else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "L%d-LI%d-2(pc,%s.l)", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (reg1)]); \
- break; } \
- default: \
- if (GET_CODE (addr) == CONST_INT \
- && INTVAL (addr) < 0x8000 \
- && INTVAL (addr) >= -0x8000) \
- fprintf (FILE, "%d", INTVAL (addr)); \
- else \
- output_addr_const (FILE, addr); \
- }}
-
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
- do { fprintf (FILE, "\t; file\t"); \
- output_quoted_string (FILE, FILENAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
- fprintf (FILE, "\t; ln\t%d\n", \
- (sdb_begin_function_line \
- ? last_linenum - sdb_begin_function_line : 1))
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-/* Note that the order of the bit mask for fmovem is the opposite
- of the order for movem! */
-
-#undef FUNCTION_PROLOGUE
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int regno; \
- register int mask = 0; \
- extern char call_used_regs[]; \
- int fsize = ((SIZE) + 3) & -4; \
- /* unos stack probe */ \
- if ( fsize > 30000 ) { \
- fprintf (FILE, "\tmovel sp,a0\n"); \
- fprintf (FILE, "\taddl $-%d,a0\n", 2048 + fsize); \
- fprintf (FILE, "\ttstb (a0)\n"); \
- } else { \
- fprintf (FILE, "\ttstb -%d(sp)\n", 2048 + fsize); \
- } \
- if (frame_pointer_needed) \
- { if (TARGET_68020 || fsize < 0x8000) \
- fprintf (FILE, "\tlink a6,$%d\n", -fsize); \
- else \
- fprintf (FILE, "\tlink a6,$0\n\tsubl $%d,sp\n", fsize); } \
- else if (fsize) \
- { \
- /* Adding negative number is faster on the 68040. */ \
- if (fsize + 4 < 0x8000) \
- { \
- fprintf (FILE, "\tadd.w #%d,sp\n", - (fsize + 4)); \
- } \
- else \
- { \
- fprintf (FILE, "\tadd.l #%d,sp\n", - (fsize + 4)); \
- } \
- } \
- for (regno = 16; regno < 24; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- mask |= 1 << (regno - 16); \
- if ((mask & 0xff) != 0) \
- fprintf (FILE, "\tfmovem $0x%x,-(sp)\n", mask & 0xff); \
- mask = 0; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- mask |= 1 << (15 - regno); \
- if (frame_pointer_needed) \
- mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \
- if (exact_log2 (mask) >= 0) \
- fprintf (FILE, "\tmovel %s,-(sp)\n", reg_names[15 - exact_log2 (mask)]); \
- else if (mask) fprintf (FILE, "\tmovem $0x%x,-(sp)\n", mask); }
-
-/* Must put address in %a0 , not %d0 . -- LGM, 7/15/88 */
-/* UNOS ?? */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABEL_NO) \
- fprintf (FILE, "\tmovl &LP%%%d,%%a0\n\tjsr mcount\n", (LABEL_NO))
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#undef FUNCTION_EPILOGUE
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ register int regno; \
- register int mask, fmask; \
- register int nregs; \
- int offset, foffset, fpoffset; \
- extern char call_used_regs[]; \
- int fsize = ((SIZE) + 3) & -4; \
- int big = 0; \
- nregs = 0; fmask = 0; fpoffset = 0; \
- for (regno = 16; regno < 24; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- { nregs++; fmask |= 1 << (23 - regno); } \
- foffset = fpoffset + nregs * 12; \
- nregs = 0; mask = 0; \
- if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- { nregs++; mask |= 1 << regno; } \
- offset = foffset + nregs * 4; \
- if (offset + fsize >= 0x8000 \
- && frame_pointer_needed \
- && (mask || fmask || fpoffset)) \
- { fprintf (FILE, "\tmovel $%d,a0\n", -fsize); \
- fsize = 0, big = 1; } \
- if (exact_log2 (mask) >= 0) { \
- if (big) \
- fprintf (FILE, "\tmovel -%d(a6,a0.l),%s\n", \
- offset + fsize, reg_names[exact_log2 (mask)]); \
- else if (! frame_pointer_needed) \
- fprintf (FILE, "\tmovel (sp)+,%s\n", \
- reg_names[exact_log2 (mask)]); \
- else \
- fprintf (FILE, "\tmovel -%d(a6),%s\n", \
- offset + fsize, reg_names[exact_log2 (mask)]); } \
- else if (mask) { \
- if (big) \
- fprintf (FILE, "\tmovem -%d(a6,a0.l),$0x%x\n", \
- offset + fsize, mask); \
- else if (! frame_pointer_needed) \
- fprintf (FILE, "\tmovem (sp)+,$0x%x\n", mask); \
- else \
- fprintf (FILE, "\tmovem -%d(a6),$0x%x\n", \
- offset + fsize, mask); } \
- if (fmask) { \
- if (big) \
- fprintf (FILE, "\tfmovem -%d(a6,a0.l),$0x%x\n", \
- foffset + fsize, fmask); \
- else if (! frame_pointer_needed) \
- fprintf (FILE, "\tfmovem (sp)+,$0x%x\n", fmask); \
- else \
- fprintf (FILE, "\tfmovem -%d(a6),$0x%x\n", \
- foffset + fsize, fmask); } \
- if (fpoffset != 0) \
- for (regno = 55; regno >= 24; regno--) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) { \
- if (big) \
- fprintf(FILE, "\tfpmoved -%d(a6,a0.l), %s\n", \
- fpoffset + fsize, reg_names[regno]); \
- else if (! frame_pointer_needed) \
- fprintf(FILE, "\tfpmoved (sp)+, %s\n", \
- reg_names[regno]); \
- else \
- fprintf(FILE, "\tfpmoved -%d(a6), %s\n", \
- fpoffset + fsize, reg_names[regno]); \
- fpoffset -= 8; \
- } \
- if (frame_pointer_needed) \
- fprintf (FILE, "\tunlk a6\n"); \
- else if (fsize) \
- { \
- if (fsize + 4 < 0x8000) \
- { \
- fprintf (FILE, "\tadd.w #%d,sp\n", fsize + 4); \
- } \
- else \
- { \
- fprintf (FILE, "\tadd.l #%d,sp\n", fsize + 4); \
- } \
- } \
- if (current_function_pops_args) \
- fprintf (FILE, "\trtd $%d\n", current_function_pops_args); \
- else fprintf (FILE, "\trts\n"); }
-
diff --git a/gcc/config/m68k/ctix.h b/gcc/config/m68k/ctix.h
deleted file mode 100644
index 9c213fc1a52..00000000000
--- a/gcc/config/m68k/ctix.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Convergent Technologies MiniFrame version,
- using GAS and binutils with COFF encapsulation.
-
- Written by Ronald Cole
-
- Because the MiniFrame's C compiler is so completely lobotomized,
- bootstrapping this is damn near impossible!
- Write to me for information on obtaining the binaries...
-
- bug reports to csusac!unify!rjc@ucdavis.edu
-
- Copyright (C) 1990 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. */
-
-#include "m68k/3b1g.h"
-
-/* Names to predefine in the preprocessor for this target machine. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmc68000 -Dmc68k -Dunix -Dctix -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
-
-/* Where to look for robotussinized startfiles. */
-#undef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "/usr/local/lib/gnu/"
-
-/* Generate calls to the MiniFrame's library (for speed). */
-#define DIVSI3_LIBCALL "ldiv"
-#define UDIVSI3_LIBCALL "uldiv"
-#define MODSI3_LIBCALL "lrem"
-#define UMODSI3_LIBCALL "ulrem"
-#define MULSI3_LIBCALL "lmul"
-#define UMULSI3_LIBCALL "ulmul"
diff --git a/gcc/config/m68k/dpx2.h b/gcc/config/m68k/dpx2.h
deleted file mode 100644
index 14f0606b8aa..00000000000
--- a/gcc/config/m68k/dpx2.h
+++ /dev/null
@@ -1,822 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Bull DPX/2 200 and 300 systems (m68k, SysVr3).
- Copyright (C) 1987, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr).
-
-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 USE_GAS
-#define MOTOROLA /* Use Motorola syntax rather than "MIT" */
-#define SGS_NO_LI /* Suppress jump table label usage */
-#define VERSADOS /* This is the name of the assembler we have */
-#endif
-
-#include "m68k/m68k.h"
-#undef SELECT_RTX_SECTION
-#include "svr3.h"
-
-/* See m68k.h. 7 means 68020 with 68881.
- * We really have 68030 and 68882,
- * but this will get us going.
- */
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-#endif
-
-#define OBJECT_FORMAT_COFF
-#define NO_SYS_SIGLIST
-
-#ifdef CPP_PREDEFINES
-#undef CPP_PREDEFINES
-#endif
-/*
- * define all the things the compiler should
- */
-#ifdef ncl_mr
-# define CPP_PREDEFINES "-Dunix -Dbull -DDPX2 -DSVR3 -Dmc68000 -Dmc68020 -Dncl_mr=1 -D_BULL_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-#else
-# ifdef ncl_el
-# define CPP_PREDEFINES "-Dunix -Dbull -DDPX2 -DSVR3 -Dmc68000 -Dmc68020 -Dncl_el -D_BULL_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-# else
-# define CPP_PREDEFINES "-Dunix -Dbull -DDPX2 -DSVR3 -Dmc68000 -Dmc68020 -D_BULL_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-# endif
-#endif
-
-#undef CPP_SPEC
-/*
- * you can't get a DPX/2 without a 68882 but allow it
- * to be ignored...
- */
-# define __HAVE_68881__ 1
-# define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ }"
-
-#define HAVE_ATEXIT
-#undef DO_GLOBAL_CTORS_BODY /* don't use svr3.h version */
-#undef DO_GLOBAL_DTORS_BODY
-
-#ifndef USE_GAS
-/*
- * handle the native MOTOROLA VERSAdos assembler.
- */
-
-/* See m68k.h. 3 means 68020 with 68881 and no bitfield
- * bitfield instructions do not seem to work a clean way.
- */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_68881|MASK_68020)
-
-/* The native assembler doesn't support fmovecr. */
-#define NO_ASM_FMOVECR
-
-#undef EXTRA_SECTIONS
-#undef EXTRA_SECTION_FUNCTIONS
-#undef READONLY_DATA_SECTION
-#define READONLY_DATA_SECTION data_section
-#undef SELECT_SECTION
-#undef SELECT_RTX_SECTION
-#define fini_section() while (0)
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\tsection 15"
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\tsection 15"
-#undef INIT_SECTION_ASM_OP
-#define BSS_SECTION_ASM_OP "\tsection 14"
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP "\tsection 10"
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP "\tsection 15"
-
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Define if you don't want extended real, but do want to use the
- software floating point emulator for REAL_ARITHMETIC and
- decimal <-> binary conversion. */
-#define REAL_ARITHMETIC
-
-#undef ASM_OUTPUT_SOURCE_FILENAME
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE, NA) \
- do { fprintf ((FILE), "\t.file\t'%s'\n", (NA)); } while (0)
-
-/* Assembler pseudos to introduce constants of various size. */
-
-#undef ASM_BYTE_OP
-#define ASM_BYTE_OP "\tdc.b"
-#undef ASM_LONG
-#define ASM_LONG "\tdc.l"
-
-/*
- * we don't seem to support any of:
- * .globl
- * .even
- * .align
- * .ascii
- */
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\tdcb.b %u,0\n", (SIZE))
-
-#undef GLOBAL_ASM_OP
-#define GLOBAL_ASM_OP "\txdef"
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) >= 1) \
- fprintf (FILE, "\tds.w 0\n");
-
-
-#define STRING_LIMIT (0)
-#undef ASM_APP_ON
-#define ASM_APP_ON ""
-#undef ASM_APP_OFF
-#define ASM_APP_OFF ""
-/*
- * dc.b 'hello, world!'
- * dc.b 10,0
- * is how we have to output "hello, world!\n"
- */
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(asm_out_file, p, thissize) \
- do { register int i, c, f=0, len=0; \
- for (i = 0; i < thissize; i++) { \
- c = p[i]; \
- if (c == '\'' || c < ' ' || c > 127) { \
- switch(f) { \
- case 0: /* need to output dc.b etc */ \
- fprintf(asm_out_file, "\tdc.b %d", c); \
- f=1; \
- break; \
- case 1: \
- fprintf(asm_out_file, ",%d", c); \
- break; \
- default: \
- /* close a string */ \
- fprintf(asm_out_file, "'\n\tdc.b %d", c); \
- f=1; \
- break; \
- } \
- } else { \
- switch(f) { \
- case 0: \
- fprintf(asm_out_file, "\tdc.b '%c", c); \
- f=2; \
- break; \
- case 2: \
- if (len >= 79) { \
- fprintf(asm_out_file, "'\n\tdc.b '%c", c); \
- len = 0; } \
- else \
- fprintf(asm_out_file, "%c", c); \
- break; \
- default: \
- len = 0; \
- fprintf(asm_out_file, "\n\tdc.b '%c", c); \
- f=2; \
- break; \
- } \
- } \
- len++; \
- } \
- if (f==2) \
- putc('\'', asm_out_file); \
- putc('\n', asm_out_file); } while (0)
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#undef ASM_OUTPUT_REG_PUSH
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#undef ASM_OUTPUT_REG_POP
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmove.l (sp)+,%s\n", reg_names[REGNO])
-
-
-#define PUT_SDB_FUNCTION_START(LINE) \
- fprintf (asm_out_file, \
- "\t.def\t.bf%s\t.val\t*%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-
-#define PUT_SDB_FUNCTION_END(LINE) \
- fprintf (asm_out_file, \
- "\t.def\t.ef%s\t.val\t*%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-
-#define PUT_SDB_BLOCK_START(LINE) \
- fprintf (asm_out_file, \
- "\t.def\t.bb%s\t.val\t*%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-
-#define PUT_SDB_BLOCK_END(LINE) \
- fprintf (asm_out_file, \
- "\t.def\t.eb%s\t.val\t*%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-
-#define PUT_SDB_EPILOGUE_END(NAME)
-
-/* Output type in decimal not in octal as done in sdbout.c */
-#define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%d%s", a, SDB_DELIM)
-
-#undef FUNCTION_PROLOGUE
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ \
- register int regno; \
- register int mask = 0; \
- int num_saved_regs = 0, first = 1; \
- extern char call_used_regs[]; \
- int fsize = ((SIZE) + 3) & -4; \
- \
- \
- if (frame_pointer_needed) \
- { \
- /* Adding negative number is faster on the 68040. */ \
- if (fsize < 0x8000 && !TARGET_68040) \
- { \
- fprintf (FILE, "\tlink %s,#%d\n", \
- reg_names[FRAME_POINTER_REGNUM], -fsize); \
- } \
- else if (TARGET_68020) \
- { \
- fprintf (FILE, "\tlink %s,#%d\n", \
- reg_names[FRAME_POINTER_REGNUM], -fsize); \
- } \
- else \
- { \
- fprintf (FILE, "\tlink %s,#0\n\tadd.l #%d,sp\n", \
- reg_names[FRAME_POINTER_REGNUM], -fsize); \
- } \
- } \
- else if (fsize) \
- { \
- /* Adding negative number is faster on the 68040. */ \
- if (fsize + 4 < 0x8000) \
- { \
- fprintf (FILE, "\tadd.w #%d,sp\n", - (fsize + 4)); \
- } \
- else \
- { \
- fprintf (FILE, "\tadd.l #%d,sp\n", - (fsize + 4)); \
- } \
- } \
- for (regno = 23; regno >= 16; regno--) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- if (first) { \
- fprintf (FILE, "\tfmovem.x %s", reg_names[regno]); \
- first = 0; \
- } \
- else fprintf (FILE, "/%s", reg_names[regno]); \
- if (!first) fprintf (FILE, ",-(sp)\n"); \
- \
- mask = 0; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- { \
- mask |= 1 << (15 - regno); \
- num_saved_regs++; \
- } \
- if (frame_pointer_needed) \
- { \
- mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM)); \
- num_saved_regs--; \
- } \
- \
- \
- if (num_saved_regs <= 2) \
- { \
- /* Store each separately in the same order moveml uses. \
- Using two movel instructions instead of a single moveml \
- is about 15% faster for the 68020 and 68030 at no expense \
- in code size */ \
- \
- int i; \
- \
- /* Undo the work from above. */ \
- for (i = 0; i< 16; i++) \
- if (mask & (1 << i)) \
- fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[15 - i]); \
- } \
- else if (mask) \
- { \
- first = 1; \
- for (regno = 0; regno < 16; regno++) \
- if (mask & (1 << regno)) \
- if (first) { \
- fprintf (FILE, "\tmovem.l %s", reg_names[15 - regno]); \
- first = 0; \
- } \
- else fprintf (FILE, "/%s", reg_names[15 - regno]); \
- fprintf (FILE, ",-(sp)\n"); \
- } \
- if (flag_pic && current_function_uses_pic_offset_table) \
- { \
- fprintf (FILE, "\tmove.l #__GLOBAL_OFFSET_TABLE_, %s\n", \
- reg_names[PIC_OFFSET_TABLE_REGNUM]); \
- fprintf (FILE, "\tlea.l (pc,%s.l),%s\n", \
- reg_names[PIC_OFFSET_TABLE_REGNUM], \
- reg_names[PIC_OFFSET_TABLE_REGNUM]); \
- } \
-}
-
-
-#undef FUNCTION_EPILOGUE
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ \
- register int regno; \
- register int mask, fmask; \
- register int nregs; \
- int offset, foffset, fpoffset, first = 1; \
- extern char call_used_regs[]; \
- int fsize = ((SIZE) + 3) & -4; \
- int big = 0; \
- rtx insn = get_last_insn (); \
- \
- /* If the last insn was a BARRIER, we don't have to write any code. */ \
- if (GET_CODE (insn) == NOTE) \
- insn = prev_nonnote_insn (insn); \
- if (insn && GET_CODE (insn) == BARRIER) \
- { \
- /* Output just a no-op so that debuggers don't get confused \
- about which function the pc is in at this address. */ \
- fprintf (FILE, "\tnop\n"); \
- return; \
- } \
- \
- nregs = 0; fmask = 0; fpoffset = 0; \
- for (regno = 16; regno < 24; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- { \
- nregs++; \
- fmask |= 1 << (23 - regno); \
- } \
- foffset = fpoffset + nregs * 12; \
- nregs = 0; mask = 0; \
- if (frame_pointer_needed) \
- regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- { \
- nregs++; \
- mask |= 1 << regno; \
- } \
- offset = foffset + nregs * 4; \
- if (offset + fsize >= 0x8000 \
- && frame_pointer_needed \
- && (mask || fmask || fpoffset)) \
- { \
- fprintf (FILE, "\tmove.l #%d,a0\n", -fsize); \
- fsize = 0, big = 1; \
- } \
- if (nregs <= 2) \
- { \
- /* Restore each separately in the same order moveml does. \
- Using two movel instructions instead of a single moveml \
- is about 15% faster for the 68020 and 68030 at no expense \
- in code size. */ \
- \
- int i; \
- \
- /* Undo the work from above. */ \
- for (i = 0; i< 16; i++) \
- if (mask & (1 << i)) \
- { \
- if (big) \
- { \
- fprintf (FILE, "\tmove.l -%d(%s,a0.l),%s\n", \
- offset + fsize, \
- reg_names[FRAME_POINTER_REGNUM], \
- reg_names[i]); \
- } \
- else if (! frame_pointer_needed) \
- { \
- fprintf (FILE, "\tmove.l (sp)+,%s\n", \
- reg_names[i]); \
- } \
- else \
- { \
- fprintf (FILE, "\tmove.l -%d(%s),%s\n", \
- offset + fsize, \
- reg_names[FRAME_POINTER_REGNUM], \
- reg_names[i]); \
- } \
- offset = offset - 4; \
- } \
- } \
- else if (mask) \
- { \
- first = 1; \
- for (regno = 0; regno < 16; regno++) \
- if (mask & (1 << regno)) \
- if (first && big) { \
- fprintf (FILE, "\tmovem.l -%d(%s,a0.l),%s", \
- offset + fsize, \
- reg_names[FRAME_POINTER_REGNUM], \
- reg_names[regno]); \
- first = 0; \
- } \
- else if (first && ! frame_pointer_needed) { \
- fprintf (FILE, "\tmovem.l (sp)+,%s", \
- offset + fsize, \
- reg_names[FRAME_POINTER_REGNUM], \
- reg_names[regno]); \
- first = 0; \
- } \
- else if (first) { \
- fprintf (FILE, "\tmovem.l -%d(%s),%s", \
- offset + fsize, \
- reg_names[FRAME_POINTER_REGNUM], \
- reg_names[regno]); \
- first = 0; \
- } \
- else \
- fprintf (FILE, "/%s", reg_names[regno]); \
- fprintf (FILE, "\n"); \
- } \
- if (fmask) \
- { \
- first = 1; \
- for (regno = 16; regno < 24; regno++) \
- if (fmask & (1 << (23 - regno))) \
- if (first && big) { \
- fprintf (FILE, "\tfmovem.x -%d(%s,a0.l),%s", \
- foffset + fsize, \
- reg_names[FRAME_POINTER_REGNUM], \
- reg_names[regno]); \
- first = 0; \
- } \
- else if (first && ! frame_pointer_needed) { \
- fprintf (FILE, "\tfmovem.x (sp)+,%s", \
- foffset + fsize, \
- reg_names[FRAME_POINTER_REGNUM], \
- reg_names[regno]); \
- first = 0; \
- } \
- else if (first) { \
- fprintf (FILE, "\tfmovem.x -%d(%s),%s", \
- foffset + fsize, \
- reg_names[FRAME_POINTER_REGNUM], \
- reg_names[regno]); \
- first = 0; \
- } \
- else fprintf (FILE, "/%s", reg_names[regno]); \
- fprintf (FILE, "\n"); \
- } \
- if (frame_pointer_needed) \
- fprintf (FILE, "\tunlk %s\n", \
- reg_names[FRAME_POINTER_REGNUM]); \
- else if (fsize) \
- { \
- if (fsize + 4 < 0x8000) \
- { \
- fprintf (FILE, "\tadd.w #%d,sp\n", fsize + 4); \
- } \
- else \
- { \
- fprintf (FILE, "\tadd.l #%d,sp\n", fsize + 4); \
- } \
- } \
- if (current_function_pops_args) \
- fprintf (FILE, "\trtd #%d\n", current_function_pops_args); \
- else \
- fprintf (FILE, "\trts\n"); \
-}
-
-/* Translate Motorola opcodes such as `jbeq'
- into VERSAdos opcodes such as `beq'.
- Change `fbeq' to `fbseq', `fbne' to `fbsneq'.
-*/
-
-#undef ASM_OUTPUT_OPCODE
-#define ASM_OUTPUT_OPCODE(FILE, PTR) \
-{ if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
- { ++(PTR); \
- while (*(PTR) != ' ') \
- { putc (*(PTR), (FILE)); ++(PTR); } \
- } \
- else if ((PTR)[0] == 'f') \
- { \
- if (!strncmp ((PTR), "fbeq", 4)) \
- { fprintf ((FILE), "fbseq"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "fbne", 4)) \
- { fprintf ((FILE), "fbsneq"); (PTR) += 4; } \
- } \
- else if ((PTR)[0] == 'b' && (PTR)[1] == 'f') \
- { \
- char *s; \
- if ((s = (char*)strchr ((PTR), '{'))) \
- while (*s != '}') { \
- if (*s == 'b') \
- /* hack, I replace it with R ie nothing */ \
- *s = '0'; \
- s++; } \
- } \
-}
-
-/* This is how to output a `long double' extended real constant. */
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long l[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "\tdc.l $%x,$%x,$%x\n", l[0], l[1], l[2]); \
- else \
- fprintf (FILE, "\tdc.l $%lx,$%lx,$%lx\n", l[0], l[1], l[2]); \
- } while (0)
-
-#undef ASM_OUTPUT_DOUBLE
-#if 0
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- fprintf (FILE, "\tdc.d %s\n", dstr); \
- } while (0)
-#endif
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf (FILE, "\tdc.l $%x,$%x\n", l[0], l[1]); \
- } while (0)
-
-
-/* This is how to output an assembler line defining a `float' constant. */
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "\tdc.l $%x\n", l); \
- else \
- fprintf (FILE, "\tdc.l $%lx\n", l); \
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-#undef ASM_OUTPUT_INT
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\tdc.l "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-#undef ASM_OUTPUT_SHORT
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\tdc.w "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#undef ASM_OUTPUT_CHAR
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\tdc.b "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-#undef ASM_OUTPUT_BYTE
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\tdc.b $%x\n", (VALUE))
-
-/* This is how to output an element of a case-vector that is absolute.
- (The 68000 does not use such vectors,
- but we must define this macro anyway.) */
-#undef ASM_OUTPUT_ADDR_VEC_ELT
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- asm_fprintf (FILE, "\tdc.l %LL%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- asm_fprintf (FILE, "\tdc.w %LL%d-%LL%d\n", VALUE, REL)
-
-/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
- keep switch tables in the text section. */
-#define JUMP_TABLES_IN_TEXT_SECTION 1
-
-/* Output a float value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { \
- if (CODE == 'f') \
- { \
- char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
- asm_fprintf ((FILE), "%I%s", dstr); \
- } \
- else \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- asm_fprintf ((FILE), "%I$%x", l); \
- else \
- asm_fprintf ((FILE), "%I$%lx", l); \
- } \
- } while (0)
-
-/* Output a double value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- asm_fprintf (FILE, "%I%s", dstr); \
- } while (0)
-
-/* Note, long double immediate operands are not actually
- generated by m68k.md. */
-#undef ASM_OUTPUT_LONG_DOUBLE_OPERAND
-#define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- asm_fprintf (FILE, "%I%s", dstr); \
- } while (0)
-
-#undef ASM_OUTPUT_COMMON
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- do { \
- int align = exact_log2 (ROUNDED); \
- /*fprintf ((FILE), "\tsection 14\n"); */ \
- data_section (); \
- ASM_OUTPUT_ALIGN ((FILE), align) \
- ASM_OUTPUT_LABEL ((FILE), (NAME)); \
- fprintf ((FILE), "\tdcb.b %u,0\n", (ROUNDED)); \
- /* fprintf ((FILE), "\tsection 10\n"); */ \
- } while (0)
-
-#undef PRINT_OPERAND_ADDRESS
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx reg1, reg2, breg, ireg; \
- register rtx addr = ADDR; \
- rtx offset; \
- switch (GET_CODE (addr)) \
- { \
- case REG: \
- fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
- break; \
- case PRE_DEC: \
- fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case POST_INC: \
- fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case PLUS: \
- reg1 = 0; reg2 = 0; \
- ireg = 0; breg = 0; \
- offset = 0; \
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
- { \
- offset = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
- { \
- offset = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) != PLUS) ; \
- else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == MULT) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == MULT) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
- || GET_CODE (addr) == SIGN_EXTEND) \
- { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
-/* for OLD_INDEXING \
- else if (GET_CODE (addr) == PLUS) \
- { \
- if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg2 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg2 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- } \
- */ \
- if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
- if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
- || GET_CODE (reg1) == MULT)) \
- || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
- { breg = reg2; ireg = reg1; } \
- else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
- { breg = reg1; ireg = reg2; } \
- if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
- { int scale = 1; \
- if (GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "(.L%d,pc,%s.w", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (XEXP (ireg, 0))]); \
- else \
- fprintf (FILE, "(.L%d,pc,%s.l", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- putc (')', FILE); \
- break; } \
- if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF \
- && ! (flag_pic && breg == pic_offset_table_rtx)) \
- { \
- fprintf (FILE, "(.L%d,pc,%s.l", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (breg)]); \
- putc (')', FILE); \
- break; } \
- if (ireg != 0 || breg != 0) \
- { int scale = 1; \
- if (breg == 0) \
- abort (); \
- putc ('(', FILE); \
- if (addr != 0) \
- { \
- output_addr_const (FILE, addr); \
- putc (',', FILE); \
- } \
- fprintf (FILE, "%s", reg_names[REGNO (breg)]); \
- if (ireg != 0) \
- putc (',', FILE); \
- if (ireg != 0 && GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
- else if (ireg != 0) \
- fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- putc (')', FILE); \
- break; \
- } \
- else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "(.L%d,pc,%s.w)", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (reg1)]); \
- break; } \
- default: \
- if (GET_CODE (addr) == CONST_INT \
- && INTVAL (addr) < 0x8000 \
- && INTVAL (addr) >= -0x8000) \
- fprintf (FILE, "%d.w", INTVAL (addr)); \
- else \
- output_addr_const (FILE, addr); \
- }}
-
-
-#endif /* ! use gas */
diff --git a/gcc/config/m68k/dpx2.ifile b/gcc/config/m68k/dpx2.ifile
deleted file mode 100644
index 2c8acd808e3..00000000000
--- a/gcc/config/m68k/dpx2.ifile
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * dpx2.ifile - for collectless G++ on Bull DPX/2
- *
- * Peter Schauer <Peter.Schauer@regent.e-technik.tu-muenchen.dbp.de>
- *
- * Install this file as $prefix/gcc-lib/dpx2/VERSION/gcc.ifile
- * and comment out the lines referring to COLLECT at the top
- * of Makefile before building GCC.
- *
- * This file has been tested with gcc-2.2.2 on a DPX/2 340
- * running BOS 2.00.45, if it doesn't work for you, stick
- * with collect.
- * --sjg
- */
-/*
- * Ifile to link with memory configured at 0.
- * BLOCK to an offset that leaves room for many headers ( the value
- * here allows for a file header, an outheader, and up to 11 section
- * headers on most systems.
- * BIND to an address that excludes page 0 from being mapped. The value
- * used for BLOCK should be or'd into this value. Here I'm setting BLOCK
- * to 0x200 and BIND to ( 0x100000 | value_used_for(BLOCK) )
- * If you are using shared libraries, watch that you don't overlap the
- * address ranges assigned for shared libs.
- *
- * GROUP BIND to a location in the next segment. Here, the only value
- * that you should change (I think) is that within NEXT, which I've set
- * to my hardware segment size. You can always use a larger size, but not
- * a smaller one.
- */
-SECTIONS
-{
- .text BIND(0x100200) BLOCK (0x200) :
- {
- /* plenty of room for headers */
- *(.init)
- *(.text)
- _vfork = _fork; /* I got tired of editing peoples sloppy code */
- *(.fini)
- }
- GROUP BIND( NEXT(0x100000) + (ADDR(.text) + (SIZEOF(.text)) % 0x1000)):
- {
- .data : {
- ___CTOR_LIST__ = . ;
- . += 4 ; /* leading NULL */
- *(.ctor)
- . += 4 ; /* trailing NULL */
- ___DTOR_LIST__ = . ;
- . += 4 ; /* leading NULL */
- *(.dtor)
- . += 4 ; /* trailing NULL */
- }
- .bss : { }
- }
-}
diff --git a/gcc/config/m68k/dpx2cdbx.h b/gcc/config/m68k/dpx2cdbx.h
deleted file mode 100644
index 88a180e91cf..00000000000
--- a/gcc/config/m68k/dpx2cdbx.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Definitions for Bull dpx/2 200 and 300 with gas
- using dbx-in-coff encapsulation.
- Copyright (C) 1992, 1994 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. */
-
-
-#include "m68k/dpx2g.h"
-
-/* Use STABS debugging information inside COFF. */
-#ifndef DBX_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-#endif
-
-/* Let sbd debugging be the default. */
-#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
diff --git a/gcc/config/m68k/dpx2g.h b/gcc/config/m68k/dpx2g.h
deleted file mode 100644
index ea5cd13d099..00000000000
--- a/gcc/config/m68k/dpx2g.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * dpx2g.h - Bull DPX/2 200 and 300 systems (m68k, SysVr3) with gas
- */
-
-#define USE_GAS
-#include "m68k/dpx2.h"
-
-#if 0 /* #ifndef USE_COLLECT2 */
-
-/* We use set vectors for the constructors/destructors. */
-
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-
-/* Although the gas we use can create .ctor and .dtor sections from N_SETT
- stabs, it does not support section directives, so we need to have the loader
- define the lists.
- */
-#define CTOR_LISTS_DEFINED_EXTERNALLY
-
-/* similar to default, but allows for the table defined by ld with gcc.ifile.
- nptrs is always 0. So we need to instead check that __DTOR_LIST__[1] != 0.
- The old check is left in so that the same macro can be used if and when
- a future version of gas does support section directives. */
-
-#define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \
- if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0)) \
- for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++); \
- for (i = nptrs; i >= 1; i--) \
- __DTOR_LIST__[i] (); }
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!r:gcc.ifile%s}\
- %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}\
- huge.o%s"
-
-#endif /* !USE_COLLECT2 */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}\
- huge.o%s"
-
-
-/*
- * we are using GAS
- */
-#undef EXTRA_SECTION_FUNCTIONS
-#undef EXTRA_SECTIONS
-/* Gas understands dollars in labels. */
-#undef NO_DOLLAR_IN_LABEL
-/* GAS does not understand .ident so don't output anything for #ident. */
-#undef ASM_OUTPUT_IDENT
-
-#undef ASM_LONG
-#define ASM_LONG "\t.long"
-
-/*
- * put const's in the text section
- */
-#define const_section() text_section()
-#define fini_section() while (0)
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\t.data"
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\t.data"
-#undef INIT_SECTION_ASM_OP
-
-/* end of dpx2g.h */
diff --git a/gcc/config/m68k/fpgnulib.c b/gcc/config/m68k/fpgnulib.c
deleted file mode 100644
index 0559b628c87..00000000000
--- a/gcc/config/m68k/fpgnulib.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* This is a stripped down version of floatlib.c. It supplies only those
- functions which exist in libgcc, but for which there is not assembly
- language versions in m68k/lb1sf68.asm.
-
- It also includes simplistic support for extended floats (by working in
- double precision). You must compile this file again with -DEXTFLOAT
- to get this support. */
-
-/*
-** gnulib support for software floating point.
-** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved.
-** Permission is granted to do *anything* you want with this file,
-** commercial or otherwise, provided this message remains intact. So there!
-** I would appreciate receiving any updates/patches/changes that anyone
-** makes, and am willing to be the repository for said changes (am I
-** making a big mistake?).
-**
-** Pat Wood
-** Pipeline Associates, Inc.
-** pipeline!phw@motown.com or
-** sun!pipeline!phw or
-** uunet!motown!pipeline!phw
-**
-** 05/01/91 -- V1.0 -- first release to gcc mailing lists
-** 05/04/91 -- V1.1 -- added float and double prototypes and return values
-** -- fixed problems with adding and subtracting zero
-** -- fixed rounding in truncdfsf2
-** -- fixed SWAP define and tested on 386
-*/
-
-/*
-** The following are routines that replace the gnulib soft floating point
-** routines that are called automatically when -msoft-float is selected.
-** The support single and double precision IEEE format, with provisions
-** for byte-swapped machines (tested on 386). Some of the double-precision
-** routines work at full precision, but most of the hard ones simply punt
-** and call the single precision routines, producing a loss of accuracy.
-** long long support is not assumed or included.
-** Overall accuracy is close to IEEE (actually 68882) for single-precision
-** arithmetic. I think there may still be a 1 in 1000 chance of a bit
-** being rounded the wrong way during a multiply. I'm not fussy enough to
-** bother with it, but if anyone is, knock yourself out.
-**
-** Efficiency has only been addressed where it was obvious that something
-** would make a big difference. Anyone who wants to do this right for
-** best speed should go in and rewrite in assembler.
-**
-** I have tested this only on a 68030 workstation and 386/ix integrated
-** in with -msoft-float.
-*/
-
-/* the following deal with IEEE single-precision numbers */
-#define EXCESS 126L
-#define SIGNBIT 0x80000000L
-#define HIDDEN (1L << 23L)
-#define SIGN(fp) ((fp) & SIGNBIT)
-#define EXP(fp) (((fp) >> 23L) & 0xFF)
-#define MANT(fp) (((fp) & 0x7FFFFFL) | HIDDEN)
-#define PACK(s,e,m) ((s) | ((e) << 23L) | (m))
-
-/* the following deal with IEEE double-precision numbers */
-#define EXCESSD 1022
-#define HIDDEND (1L << 20L)
-#define EXPDBITS 11
-#define EXPDMASK 0x7FF
-#define EXPD(fp) (((fp.l.upper) >> 20L) & 0x7FFL)
-#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
-#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
- (fp.l.lower >> 22))
-#define MANTDMASK 0xFFFFF /* mask of upper part */
-
-/* the following deal with IEEE extended-precision numbers */
-#define EXCESSX 16382
-#define HIDDENX (1L << 31L)
-#define EXPXBITS 15
-#define EXPXMASK 0x7FFF
-#define EXPX(fp) (((fp.l.upper) >> 16) & EXPXMASK)
-#define SIGNX(fp) ((fp.l.upper) & SIGNBIT)
-#define MANTXMASK 0x7FFFFFFF /* mask of upper part */
-
-union double_long
-{
- double d;
- struct {
- long upper;
- unsigned long lower;
- } l;
-};
-
-union float_long {
- float f;
- long l;
-};
-
-union long_double_long
-{
- long double ld;
- struct
- {
- long upper;
- unsigned long middle;
- unsigned long lower;
- } l;
-};
-
-#ifndef EXTFLOAT
-
-/* convert int to double */
-double
-__floatsidf (int a1)
-{
- long sign = 0, exp = 31 + EXCESSD;
- union double_long dl;
-
- if (!a1)
- {
- dl.l.upper = dl.l.lower = 0;
- return dl.d;
- }
-
- if (a1 < 0)
- {
- sign = SIGNBIT;
- a1 = -a1;
- if (a1 < 0)
- {
- dl.l.upper = SIGNBIT | ((32 + EXCESSD) << 20L);
- dl.l.lower = 0;
- return dl.d;
- }
- }
-
- while (a1 < 0x1000000)
- {
- a1 <<= 4;
- exp -= 4;
- }
-
- while (a1 < 0x40000000)
- {
- a1 <<= 1;
- exp--;
- }
-
- /* pack up and go home */
- dl.l.upper = sign;
- dl.l.upper |= exp << 20L;
- dl.l.upper |= (a1 >> 10L) & ~HIDDEND;
- dl.l.lower = a1 << 22L;
-
- return dl.d;
-}
-
-/* convert int to float */
-float
-__floatsisf (int l)
-{
- double foo = __floatsidf (l);
- return foo;
-}
-
-/* convert float to double */
-double
-__extendsfdf2 (float a1)
-{
- register union float_long fl1;
- register union double_long dl;
- register long exp;
-
- fl1.f = a1;
-
- if (!fl1.l)
- {
- dl.l.upper = dl.l.lower = 0;
- return dl.d;
- }
-
- dl.l.upper = SIGN (fl1.l);
- exp = EXP (fl1.l) - EXCESS + EXCESSD;
- dl.l.upper |= exp << 20;
- dl.l.upper |= (MANT (fl1.l) & ~HIDDEN) >> 3;
- dl.l.lower = MANT (fl1.l) << 29;
-
- return dl.d;
-}
-
-/* convert double to float */
-float
-__truncdfsf2 (double a1)
-{
- register long exp;
- register long mant;
- register union float_long fl;
- register union double_long dl1;
-
- dl1.d = a1;
-
- if (!dl1.l.upper && !dl1.l.lower)
- return 0;
-
- exp = EXPD (dl1) - EXCESSD + EXCESS;
-
- /* shift double mantissa 6 bits so we can round */
- mant = MANTD (dl1) >> 6;
-
- /* now round and shift down */
- mant += 1;
- mant >>= 1;
-
- /* did the round overflow? */
- if (mant & 0xFF000000)
- {
- mant >>= 1;
- exp++;
- }
-
- mant &= ~HIDDEN;
-
- /* pack up and go home */
- fl.l = PACK (SIGND (dl1), exp, mant);
- return (fl.f);
-}
-
-/* convert double to int */
-int
-__fixdfsi (double a1)
-{
- register union double_long dl1;
- register long exp;
- register long l;
-
- dl1.d = a1;
-
- if (!dl1.l.upper && !dl1.l.lower)
- return 0;
-
- exp = EXPD (dl1) - EXCESSD - 31;
- l = MANTD (dl1);
-
- if (exp > 0)
- {
- /* Return largest integer. */
- return SIGND (dl1) ? 0x80000000 : 0x7fffffff;
- }
-
- if (exp <= -32)
- return 0;
-
- /* shift down until exp = 0 */
- if (exp < 0)
- l >>= -exp;
-
- return (SIGND (dl1) ? -l : l);
-}
-
-/* convert float to int */
-int
-__fixsfsi (float a1)
-{
- double foo = a1;
- return __fixdfsi (foo);
-}
-
-#else /* EXTFLOAT */
-
-/* Primitive extended precision floating point support.
-
- We assume all numbers are normalized, don't do any rounding, etc. */
-
-/* Prototypes for the above in case we use them. */
-double __floatsidf (int);
-float __floatsisf (int);
-double __extendsfdf2 (float);
-float __truncdfsf2 (double);
-int __fixdfsi (double);
-int __fixsfsi (float);
-
-/* convert double to long double */
-long double
-__extenddfxf2 (double d)
-{
- register union double_long dl;
- register union long_double_long ldl;
- register long exp;
-
- dl.d = d;
- /*printf ("dfxf in: %g\n", d);*/
-
- if (!dl.l.upper && !dl.l.lower)
- return 0;
-
- ldl.l.upper = SIGND (dl);
- exp = EXPD (dl) - EXCESSD + EXCESSX;
- ldl.l.upper |= exp << 16;
- ldl.l.middle = HIDDENX;
- /* 31-20: # mantissa bits in ldl.l.middle - # mantissa bits in dl.l.upper */
- ldl.l.middle |= (dl.l.upper & MANTDMASK) << (31 - 20);
- /* 1+20: explicit-integer-bit + # mantissa bits in dl.l.upper */
- ldl.l.middle |= dl.l.lower >> (1 + 20);
- /* 32 - 21: # bits of dl.l.lower in ldl.l.middle */
- ldl.l.lower = dl.l.lower << (32 - 21);
-
- /*printf ("dfxf out: %s\n", dumpxf (ldl.ld));*/
- return ldl.ld;
-}
-
-/* convert long double to double */
-double
-__truncxfdf2 (long double ld)
-{
- register long exp;
- register union double_long dl;
- register union long_double_long ldl;
-
- ldl.ld = ld;
- /*printf ("xfdf in: %s\n", dumpxf (ld));*/
-
- if (!ldl.l.upper && !ldl.l.middle && !ldl.l.lower)
- return 0;
-
- exp = EXPX (ldl) - EXCESSX + EXCESSD;
- /* ??? quick and dirty: keep `exp' sane */
- if (exp >= EXPDMASK)
- exp = EXPDMASK - 1;
- dl.l.upper = SIGNX (ldl);
- dl.l.upper |= exp << (32 - (EXPDBITS + 1));
- /* +1-1: add one for sign bit, but take one off for explicit-integer-bit */
- dl.l.upper |= (ldl.l.middle & MANTXMASK) >> (EXPDBITS + 1 - 1);
- dl.l.lower = (ldl.l.middle & MANTXMASK) << (32 - (EXPDBITS + 1 - 1));
- dl.l.lower |= ldl.l.lower >> (EXPDBITS + 1 - 1);
-
- /*printf ("xfdf out: %g\n", dl.d);*/
- return dl.d;
-}
-
-/* convert a float to a long double */
-long double
-__extendsfxf2 (float f)
-{
- long double foo = __extenddfxf2 (__extendsfdf2 (f));
- return foo;
-}
-
-/* convert a long double to a float */
-float
-__truncxfsf2 (long double ld)
-{
- float foo = __truncdfsf2 (__truncxfdf2 (ld));
- return foo;
-}
-
-/* convert an int to a long double */
-long double
-__floatsixf (int l)
-{
- double foo = __floatsidf (l);
- return foo;
-}
-
-/* convert a long double to an int */
-int
-__fixxfsi (long double ld)
-{
- int foo = __fixdfsi ((double) ld);
- return foo;
-}
-
-/* The remaining provide crude math support by working in double precision. */
-
-long double
-__addxf3 (long double x1, long double x2)
-{
- return (double) x1 + (double) x2;
-}
-
-long double
-__subxf3 (long double x1, long double x2)
-{
- return (double) x1 - (double) x2;
-}
-
-long double
-__mulxf3 (long double x1, long double x2)
-{
- return (double) x1 * (double) x2;
-}
-
-long double
-__divxf3 (long double x1, long double x2)
-{
- return (double) x1 / (double) x2;
-}
-
-long double
-__negxf2 (long double x1)
-{
- return - (double) x1;
-}
-
-long
-__cmpxf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__eqxf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__nexf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__ltxf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__lexf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__gtxf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-long
-__gexf2 (long double x1, long double x2)
-{
- return __cmpdf2 ((double) x1, (double) x2);
-}
-
-#endif /* EXTFLOAT */
diff --git a/gcc/config/m68k/hp2bsd.h b/gcc/config/m68k/hp2bsd.h
deleted file mode 100644
index 9090923ae54..00000000000
--- a/gcc/config/m68k/hp2bsd.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Definitions of target machine for GNU compiler. HP 9000/200 68000 version.
- Copyright (C) 1987, 1991 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. */
-
-#include "m68k/m68k.h"
-
-/* See m68k.h. 0 means 68000 with no 68881. */
-
-#define TARGET_DEFAULT 0
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Define __HAVE_68881 in preprocessor only if -m68881 is specified.
- This will control the use of inline 68881 insns in certain macros.
- Also inform the program which CPU this is for. */
-
-#define CPP_SPEC "%{m68881:-D__HAVE_68881__} \
-%{!ansi:%{m68020:-Dmc68020}%{mc68020:-Dmc68020}%{!mc68020:%{!m68020:-Dmc68010}}}"
-
-/* -m68020 requires special flags to the assembler. */
-
-#define ASM_SPEC \
- "%{m68020:-mc68020}%{mc68020:-mc68020}%{!mc68020:%{!m68020:-mc68010}}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dmc68000 -Dmc68010 -Dhp200 -Dunix -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-
-/* Link with libg.a when debugging, for dbx's sake. */
-
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
-
-/* Alignment of field after `int : 0' in a structure. */
-
-#undef EMPTY_FIELD_BOUNDARY
-#define EMPTY_FIELD_BOUNDARY 16
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Define subroutines to call to handle multiply, divide, and remainder.
- These routines are built into the c-library on the hp200.
- XXX What other routines from the c-library could we use?
- The `*' prevents an underscore from being prepended by the compiler. */
-
-#define DIVSI3_LIBCALL "*ldiv"
-#define UDIVSI3_LIBCALL "*uldiv"
-#define MODSI3_LIBCALL "*lrem"
-#define UMODSI3_LIBCALL "*ulrem"
-#define MULSI3_LIBCALL "*lmul"
-#define UMULSI3_LIBCALL "*ulmul"
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/m68k/hp310.h b/gcc/config/m68k/hp310.h
deleted file mode 100644
index a9d24f4ec19..00000000000
--- a/gcc/config/m68k/hp310.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Definitions of target machine for GNU compiler. HP-UX 68010 version. */
-
-/* See m68k.h. 0 means 68000 without 68881 and no bitfields. */
-#define TARGET_DEFAULT 0
-
-#include "m68k/hp320.h"
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-#undef CPP_SPEC
-#undef ASM_SPEC
-
-/* HP does not support a 68020 without a 68881 or a 68010 with a 68881.
- However, -m68020 does not imply -m68881. You must specify both
- if you want both. */
-
-#ifdef HPUX_ASM
-
-#define CPP_SPEC "-D__HPUX_ASM__ %{m68881: -D__HAVE_68881__}\
-%{m68020: -Dmc68020}%{mc68020: -Dmc68020}\
-%{!traditional:-D_INCLUDE__STDC__}"
-
-#define ASM_SPEC "%{!m68020:%{!mc68020:+X}}"
-
-#else /* not HPUX_ASM */
-
-#define CPP_SPEC "%{m68881: -D__HAVE_68881__}\
-%{m68020: -Dmc68020}%{mc68020: -Dmc68020}\
-%{!traditional:-D_INCLUDE__STDC__}"
-
-#define ASM_SPEC \
- "%{m68000:-mc68000}%{mc68000:-mc68000}%{!mc68000:%{!m68000:-mc68020}}"
-
-#endif /* not HPUX_ASM */
diff --git a/gcc/config/m68k/hp310g.h b/gcc/config/m68k/hp310g.h
deleted file mode 100644
index c07a73b2cb6..00000000000
--- a/gcc/config/m68k/hp310g.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Definitions of target machine for GNU compiler. HP-UX 68010 version.
- Use this file if GCC is supposed to work with the GNU assembler,
- GNU linker and GNU debugger using DBX debugging information.
- (In other words, much of HPUX has been cast aside.) */
-
-/* This wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-#define USE_GAS
-
-#include "m68k/hp310.h"
diff --git a/gcc/config/m68k/hp320.h b/gcc/config/m68k/hp320.h
deleted file mode 100644
index 1388e0262b2..00000000000
--- a/gcc/config/m68k/hp320.h
+++ /dev/null
@@ -1,642 +0,0 @@
-/* Definitions of target machine for GNU compiler. HP-UX 68000/68020 version.
- Copyright (C) 1987, 88, 93, 94, 95, 96, 1997 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. */
-
-/* Define USE_GAS if GCC is supposed to work with the GNU assembler,
- GNU linker and GNU debugger using DBX debugging information.
- (In other words, much of HPUX has been cast aside.)
- Undefine USE_GAS if you want GCC to feed the HP assembler. */
-
-/* #define USE_GAS */ /* Use hp320g.h if you want this. */
-
-/* Control assembler-syntax conditionals in m68k.md. */
-
-#ifndef USE_GAS
-#define MOTOROLA /* Use Motorola syntax rather than "MIT" */
-#define SGS /* Uses SGS assembler */
-#define SGS_CMP_ORDER /* Takes cmp operands in reverse order */
-#define HPUX_ASM
-
-#if !defined (CROSS_COMPILE) && !defined (NO_BUGS)
-/* The assembler on HP 9k3xx machines running HPUX 8.0 doesn't translate
- floating point constants behind some operands. The workaround is to
- use hex constants. Reported by Thomas Nau (nau@medizin.uni-ulm.de). */
-#define AS_BUG_FLOATING_CONSTANT
-/* The assembler on HP 9k3xx machines running HPUX 8.0 doesn't accept
- labels followed by a text, data, or other section directive. Reported
- by Thomas Nau (nau@medizin.uni-ulm.de). */
-#define AS_BUG_TRAILING_LABEL
-#endif
-
-#endif /* not USE_GAS */
-
-/* gcc.c should find libgcc.a itself rather than expecting linker to. */
-#define LINK_LIBGCC_SPECIAL
-/* The arguments of -L must be a separate argv element. */
-#define SPACE_AFTER_L_OPTION
-/* HP/UX doesn't have libg.a. */
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-/* Be compatible with system stddef.h. */
-#define SIZE_TYPE "unsigned int"
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-#include "m68k/m68k.h"
-
-/* See m68k.h. 7 means 68020 with 68881. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-#endif
-
-/* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#ifdef HPUX_ASM
-
-#define ASM_SPEC "%{m68000:+X}%{mc68000:+X}"
-
-#define NO_DOT_IN_LABEL
-
-#if TARGET_DEFAULT & MASK_68881 /* -m68881 is the default */
-
-/* These definitions differ from those used for GAS by defining __HPUX_ASM__.
- This is needed because some programs, particularly GDB, need to
- know which assembler is being used so that the correct `asm'
- instructions can be used. */
-
-#define CPP_SPEC \
-"%{!msoft-float:-D__HAVE_68881__ }\
-%{!ansi:%{!mc68000:%{!m68000:-Dmc68020}} -D_HPUX_SOURCE} -D__HPUX_ASM__"
-
-#else /* default is -msoft-float */
-
-#define CPP_SPEC \
-"%{m68881:-D__HAVE_68881__ }\
-%{!ansi:%{!mc68000:%{!m68000:-Dmc68020}} -D_HPUX_SOURCE} -D__HPUX_ASM__"
-
-#endif /* default is -msoft-float */
-
-#else /* not HPUX_ASM */
-
-#if TARGET_DEFAULT & MASK_68881 /* -m68881 is the default */
-
-#define CPP_SPEC \
-"%{!msoft-float:-D__HAVE_68881__ }\
-%{!ansi:%{!mc68000:%{!m68000:-Dmc68020}} -D_HPUX_SOURCE}"
-
-#else /* default is -msoft-float */
-
-#define CPP_SPEC \
-"%{m68881:-D__HAVE_68881__ }\
-%{!ansi:%{!mc68000:%{!m68000:-Dmc68020}} -D_HPUX_SOURCE}"
-
-#endif /* default is -msoft-float */
-
-
-/* -m68000 requires special flags to the assembler. */
-#define ASM_SPEC \
- "%{m68000:-mc68000}%{mc68000:-mc68000}%{!mc68000:%{!m68000:-mc68020}}"
-
-/* Tell GCC to put a space after -L when generating such options. */
-#define SPACE_AFTER_L_OPTION
-
-#endif /* Not HPUX_ASM */
-
-/* Translate -static for HPUX linker. */
-#define LINK_SPEC "%{static:-a archive}"
-
-/* Names to predefine in the preprocessor for this target machine
- (for non-strict-ANSI programs only). */
-/* These are the ones defined by HPUX cc, plus mc68000 for uniformity with
- GCC on other 68000 systems. */
-
-#define CPP_PREDEFINES "-Dhp9000s200 -Dhp9000s300 -DPWB -Dhpux -Dunix -D__hp9000s300 -D__hp9000s200 -D__PWB -D__hpux -D__unix -D__motorola__ -Asystem(unix) -Asystem(hpux) -Acpu(m68k) -Amachine(m68k)"
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* hpux doesn't use static area for struct returns. */
-#undef PCC_STATIC_STRUCT_RETURN
-
-/* Generate calls to memcpy, memcmp and memset. */
-#define TARGET_MEM_FUNCTIONS
-
-#if 0 /* No longer correct in HPUX version 6.5. */
-/* Function calls don't save any fp registers on hpux. */
-#undef CALL_USED_REGISTERS
-#define CALL_USED_REGISTERS \
- {1, 1, 0, 0, 0, 0, 0, 0, \
- 1, 1, 0, 0, 0, 0, 0, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1}
-#endif /* 0 */
-
-#ifdef HPUX_ASM
-
-/* Override parts of m68k.h to fit the HPUX assembler. */
-
-#undef TARGET_VERSION
-#undef REGISTER_NAMES
-#undef ASM_OUTPUT_REG_PUSH
-#undef ASM_OUTPUT_REG_POP
-#undef ASM_FILE_START
-#undef ASM_APP_ON
-#undef ASM_APP_OFF
-#undef TEXT_SECTION_ASM_OP
-#undef DATA_SECTION_ASM_OP
-#undef READONLY_DATA_SECTION
-#undef ASM_OUTPUT_DOUBLE
-#undef ASM_OUTPUT_FLOAT
-#undef ASM_OUTPUT_INT
-#undef ASM_OUTPUT_SHORT
-#undef ASM_OUTPUT_CHAR
-#undef ASM_OUTPUT_BYTE
-#undef ASM_OUTPUT_ADDR_VEC_ELT
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#undef ASM_OUTPUT_ALIGN
-#undef ASM_OUTPUT_SKIP
-#undef ASM_OUTPUT_COMMON
-#undef ASM_OUTPUT_LOCAL
-#undef ASM_FORMAT_PRIVATE_NAME
-#undef FUNCTION_PROFILER
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#undef GLOBAL_ASM_OP
-#undef IMMEDIATE_PREFIX
-#undef REGISTER_PREFIX
-
-#define TARGET_VERSION fprintf (stderr, " (68k, SGS/hpux syntax)");
-
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"}
-
-#define IMMEDIATE_PREFIX "&"
-#define REGISTER_PREFIX "%"
-
-#define FUNCTION_PROFILER(FILE, LABEL_NO) \
- fprintf (FILE, "\tmov.l &LP%d,%%a0\n\tjsr mcount\n", (LABEL_NO));
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO])
-
-/* For HPUX versions before 6.5, define this macro as empty. */
-#define ASM_FILE_START(FILE) \
- if (TARGET_68020) \
- { \
- if (TARGET_68881) \
- fprintf (FILE, "\tversion 3\n"); /* 68020 fp regs saved */ \
- else \
- fprintf (FILE, "\tversion 2\n"); /* 68020 no fp regs saved */ \
- } \
- else \
- fprintf (FILE, "\tversion 1\n"); /* 68010 */
-
-#define ASM_APP_ON ""
-
-#define ASM_APP_OFF ""
-
-#ifdef AS_BUG_TRAILING_LABEL
-#define TEXT_SECTION_ASM_OP "\tlalign\t1\ntext"
-#define DATA_SECTION_ASM_OP "\tlalign\t1\ndata"
-#else
-#define TEXT_SECTION_ASM_OP "text"
-#define DATA_SECTION_ASM_OP "data"
-#endif
-#define ASCII_DATA_ASM_OP "byte"
-
-/* This is the command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define GLOBAL_ASM_OP "global"
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\tcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\tlcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u,2\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
- sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
-do{ if (PREFIX[0] == 'L' && PREFIX[1] == 'I') \
- fprintf(FILE, "\tset %s%d,.+2\n", PREFIX, NUM); \
- else \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM); \
-} while(0)
-
-#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- fprintf (FILE, "\tdouble 0f%s\n", dstr); \
- } while (0)
-
-#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
- fprintf (FILE, "\tfloat 0f%s\n", dstr); \
- } while (0)
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long l[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
- fprintf (FILE, "\tlong 0x%x,0x%x,0x%x\n", l[0], l[1], l[2]); \
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\tlong "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\tshort "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\tbyte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\tbyte 0x%x\n", (VALUE))
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\tlong L%d\n", VALUE)
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\tshort L%d-L%d\n", VALUE, REL)
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) == 1) \
- fprintf (FILE, "\tlalign 2\n"); \
- else if ((LOG) != 0) \
- abort ();
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\tspace %u\n", (SIZE))
-
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME)
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO)
-
-/* Output a float value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#ifdef AS_BUG_FLOATING_CONSTANT
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- fprintf ((FILE), "&0x%lx", l); \
- } while (0)
-#else
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { \
- if (CODE == 'f') \
- { \
- char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
- fprintf ((FILE), "&0f%s", dstr); \
- } \
- else \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- fprintf ((FILE), "&0x%lx", l); \
- } \
- } while (0)
-#endif /* AS_BUG_FLOATING_CONSTANT */
-
-/* Output a double value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- fprintf (FILE, "&0f%s", dstr); \
- } while (0)
-
-/* Note, long double immediate operands are not actually
- generated by m68k.md. */
-#undef ASM_OUTPUT_LONG_DOUBLE_OPERAND
-#define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- fprintf (FILE, "&0f%s", dstr); \
- } while (0)
-
-#if 0
-#undef PRINT_OPERAND
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (CODE == '.') fprintf (FILE, "."); \
- else if (CODE == '#') fprintf (FILE, "&"); \
- else if (CODE == '-') fprintf (FILE, "-(%%sp)"); \
- else if (CODE == '+') fprintf (FILE, "(%%sp)+"); \
- else if (CODE == '@') fprintf (FILE, "(%%sp)"); \
- else if (CODE == '!') fprintf (FILE, "%%fpcr"); \
- else if (CODE == '$') { if (TARGET_68040_ONLY) fprintf (FILE, "s"); } \
- else if (CODE == '&') { if (TARGET_68040_ONLY) fprintf (FILE, "d"); } \
- else if (CODE == '/') \
- fprintf (FILE, "%%"); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
- { REAL_VALUE_TYPE r; long l; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- PRINT_OPERAND_FLOAT (CODE, FILE, r, l); } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
- { REAL_VALUE_TYPE r; char dstr[30]; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- REAL_VALUE_TO_DECIMAL (r, "%.20g", dstr); \
- fprintf (FILE, "&0f%s", dstr); } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode) \
- { REAL_VALUE_TYPE r; char dstr[30]; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- REAL_VALUE_TO_DECIMAL (r, "%.20g", dstr); \
- fprintf (FILE, "&0f%s", dstr); } \
- else { putc ('&', FILE); output_addr_const (FILE, X); }}
-#endif
-
-#undef PRINT_OPERAND_ADDRESS
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx reg1, reg2, breg, ireg; \
- register rtx addr = ADDR; \
- rtx offset; \
- switch (GET_CODE (addr)) \
- { \
- case REG: \
- fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
- break; \
- case PRE_DEC: \
- fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case POST_INC: \
- fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case PLUS: \
- reg1 = 0; reg2 = 0; \
- ireg = 0; breg = 0; \
- offset = 0; \
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
- { \
- offset = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
- { \
- offset = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) != PLUS) ; \
- else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == MULT) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == MULT) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
- || GET_CODE (addr) == SIGN_EXTEND) \
- { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
-/* for OLD_INDEXING \
- else if (GET_CODE (addr) == PLUS) \
- { \
- if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg2 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg2 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- } \
- */ \
- if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
- if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
- || GET_CODE (reg1) == MULT)) \
- || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
- { breg = reg2; ireg = reg1; } \
- else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
- { breg = reg1; ireg = reg2; } \
- if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
- { int scale = 1; \
- if (GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "L%d-LI%d(%%pc,%s.w", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (XEXP (ireg, 0))]); \
- else \
- fprintf (FILE, "L%d-LI%d(%%pc,%s.l", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- putc (')', FILE); \
- break; } \
- if (ireg != 0 || breg != 0) \
- { int scale = 1; \
- if (breg == 0) \
- abort (); \
- if (addr != 0) \
- output_addr_const (FILE, addr); \
- fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \
- if (ireg != 0) \
- putc (',', FILE); \
- if (ireg != 0 && GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
- else if (ireg != 0) \
- fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- putc (')', FILE); \
- break; \
- } \
- else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "L%d-LI%d(%%pc,%s.w)", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (reg1)]); \
- break; } \
- default: \
- if (GET_CODE (addr) == CONST_INT \
- && INTVAL (addr) < 0x8000 \
- && INTVAL (addr) >= -0x8000) \
- fprintf (FILE, "%d.w", INTVAL (addr)); \
- else \
- output_addr_const (FILE, addr); \
- }}
-
-#define ASM_OUTPUT_ASCII(f, p, size) \
-do { register int i; \
- int inside; \
- inside = FALSE; \
- for (i = 0; i < (size); i++) { \
- if (i % 8 == 0) { \
- if (i != 0) { \
- if (inside) \
- putc('"', (f)); \
- putc('\n', (f)); \
- inside = FALSE; \
- } \
- fprintf((f), "\t%s ", ASCII_DATA_ASM_OP); \
- } \
- if ((p)[i] < 32 || (p)[i] == '\\' || (p)[i] == '"' || (p)[i] == 127) { \
- if (inside) { \
- putc('"', (f)); \
- inside = FALSE; \
- } \
- if (i % 8 != 0) \
- putc(',', (f)); \
- fprintf((f), "%d", (p)[i]); \
- } else { \
- if (!inside) { \
- if (i % 8 != 0) \
- putc(',', (f)); \
- putc('"', (f)); \
- inside = TRUE; \
- } \
- putc((p)[i], (f)); \
- } \
- } \
- if (inside) \
- putc('"', (f)); \
- putc('\n', (f)); \
-} while (0)
-
-/* Translate Motorola opcodes such as `jbeq'
- into SGS opcodes such as `beq.w'.
- Delete the `e' in `move...' and `fmove'.
- Change `ftst' to `ftest'. */
-
-#define ASM_OUTPUT_OPCODE(FILE, PTR) \
-{ if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
- { ++(PTR); \
- while (*(PTR) != ' ') \
- { putc (*(PTR), (FILE)); ++(PTR); } \
- fprintf ((FILE), ".w"); } \
- else if ((PTR)[0] == 'f') \
- { \
- if (!strncmp ((PTR), "fmove", 5)) \
- { fprintf ((FILE), "fmov"); (PTR) += 5; } \
- else if (!strncmp ((PTR), "ftst", 4)) \
- { fprintf ((FILE), "ftest"); (PTR) += 4; } \
- } \
- else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
- && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
- { fprintf ((FILE), "mov"); (PTR) += 4; } \
-}
-
-/* Prevent output of `gcc_compiled.:'. */
-
-#define ASM_IDENTIFY_GCC(FILE)
-
-#else /* not HPUX_ASM */
-
-#undef FUNCTION_PROFILER
-
-/* HP-UX needs the call to mcount before the link instruction.
- Copy the return address onto the stack before the call to fake it out. */
-#define FUNCTION_PROFILER(FILE, LABEL_NO) \
- fprintf (FILE, \
- "\tmovel a6@(4),sp@-\n\tmovl #LP%d,a0\n\tjsr mcount\n\taddqw #4,sp\n", \
- (LABEL_NO));
-
-#endif /* not HPUX_ASM */
-
-/* In m68k svr4, a symbol_ref rtx can be a valid PIC operand if it is an
- operand of a function call. */
-#undef LEGITIMATE_PIC_OPERAND_P
-#define LEGITIMATE_PIC_OPERAND_P(X) \
- ((! symbolic_operand (X, VOIDmode) \
- && ! (GET_CODE (X) == CONST_DOUBLE && CONST_DOUBLE_MEM (X) \
- && GET_CODE (CONST_DOUBLE_MEM (X)) == MEM \
- && symbolic_operand (XEXP (CONST_DOUBLE_MEM (X), 0), VOIDmode))) \
- || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)))
-
-/* hpux8 and later have C++ compatible include files, so do not
- pretend they are `extern "C"'. */
-#define NO_IMPLICIT_EXTERN_C
diff --git a/gcc/config/m68k/hp320g.h b/gcc/config/m68k/hp320g.h
deleted file mode 100644
index 1e931854e90..00000000000
--- a/gcc/config/m68k/hp320g.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Definitions of target machine for GNU compiler. HP-UX 68000/68020 version.
- Use this file if GCC is supposed to work with the GNU assembler,
- GNU linker and GNU debugger using DBX debugging information.
- (In other words, much of HPUX has been cast aside.) */
-
-/* This wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-#define USE_GAS
-
-#include "m68k/hp320.h"
diff --git a/gcc/config/m68k/hp3bsd.h b/gcc/config/m68k/hp3bsd.h
deleted file mode 100644
index 34405f88350..00000000000
--- a/gcc/config/m68k/hp3bsd.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "m68k/m68k.h"
-
-/* See m68k.h. 7 means 68020 with 68881. */
-
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-
-/* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ -D__HAVE_FPU__}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dmc68000 -Dmc68020 -Dhp300 -Dhp9000 -Dunix -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-
-/* Link with libg.a when debugging, for dbx's sake. */
-
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Do not break .stabs pseudos into continuations. */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* This is the char to use for continuation (in case we need to turn
- continuation back on). */
-
-#define DBX_CONTIN_CHAR '?'
-
-/* Don't use the `xsfoo;' construct in DBX output; this system
- doesn't support it. */
-
-#define DBX_NO_XREFS
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/m68k/hp3bsd44.h b/gcc/config/m68k/hp3bsd44.h
deleted file mode 100644
index a3b652ffe35..00000000000
--- a/gcc/config/m68k/hp3bsd44.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "m68k/m68k.h"
-
-/* See m68k.h. 7 means 68020 with 68881. */
-
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-
-/* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ -D__HAVE_FPU__}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dmc68000 -Dmc68020 -Dhp300 -Dhp9000 -Dunix -D__BSD_4_4__ -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-
-/* No more libg.a */
-
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-/* Make gcc agree with <machine/ansi.h> */
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 16
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Do not break .stabs pseudos into continuations. */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* This is the char to use for continuation (in case we need to turn
- continuation back on). */
-
-#define DBX_CONTIN_CHAR '?'
-
-/* Don't use the `xsfoo;' construct in DBX output; this system
- doesn't support it. */
-
-#define DBX_NO_XREFS
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/m68k/hpux7.h b/gcc/config/m68k/hpux7.h
deleted file mode 100644
index ae584bde097..00000000000
--- a/gcc/config/m68k/hpux7.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* tm.h for m68k running HPUX version 7. */
-
-/* fletcher@cs.utexas.edu says this is needed. */
-#define NO_DOT_IN_LABEL
-#define NO_BUGS
-
-#include "m68k/hp320.h"
diff --git a/gcc/config/m68k/isi-nfp.h b/gcc/config/m68k/isi-nfp.h
deleted file mode 100644
index fbded9e8bdb..00000000000
--- a/gcc/config/m68k/isi-nfp.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Define target machine as an ISI 68000/68020 with no 68881. */
-
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68020)
-
-#include "m68k/isi.h"
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
diff --git a/gcc/config/m68k/isi.h b/gcc/config/m68k/isi.h
deleted file mode 100644
index a458cf9e080..00000000000
--- a/gcc/config/m68k/isi.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Definitions of target machine for GNU compiler. ISI 68000/68020 version.
- Intended only for use with GAS, and not ISI's assembler, which is buggy
- Copyright (C) 1988, 1996 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. */
-
-#include "m68k/m68k.h"
-
-/* See m68k.h. 7 means 68020 with 68881. */
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-#endif
-
-#if TARGET_DEFAULT & MASK_68881
-/* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
-
-/* If the 68881 is used, link must load libmc.a before libc.a. */
-
-#define LIB_SPEC "%{!msoft-float:%{!p:%{!pg:-lmc}}%{p:-lmc_p}%{pg:-lmc_p}} \
-%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}"
-
-#else
-/* Define __HAVE_68881__ in preprocessor if -m68881 is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
-
-/* If the 68881 is used, link must load libmc.a instead of libc.a */
-
-#define LIB_SPEC "%{m68881:%{!p:%{!pg:-lmc}}%{p:-lmc_p}%{pg:-lmc_p}} \
-%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}"
-#endif
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dunix -Dmc68000 -Dis68k -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Override parts of m68k.h to fit the ISI 68k machine. */
-
-#undef FUNCTION_VALUE
-#undef LIBCALL_VALUE
-#undef FUNCTION_VALUE_REGNO_P
-#undef NEEDS_UNTYPED_CALL
-#undef ASM_FILE_START
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* If TARGET_68881, return SF and DF values in f0 instead of d0. */
-
-#define FUNCTION_VALUE(VALTYPE,FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, (MODE), ((TARGET_68881 && ((MODE) == SFmode || (MODE) == DFmode)) ? 16 : 0))
-
-/* 1 if N is a possible register number for a function value.
- D0 may be used, and F0 as well if -m68881 is specified. */
-
-#define FUNCTION_VALUE_REGNO_P(N) \
- ((N) == 0 || (TARGET_68881 && (N) == 16))
-
-/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
- more than one register. */
-
-#define NEEDS_UNTYPED_CALL 1
-
-/* Also output something to cause the correct _doprnt to be loaded. */
-#define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n%s\n", TARGET_68881 ? ".globl fltused" : "")
diff --git a/gcc/config/m68k/lb1sf68.asm b/gcc/config/m68k/lb1sf68.asm
deleted file mode 100644
index a8a7a6ced5e..00000000000
--- a/gcc/config/m68k/lb1sf68.asm
+++ /dev/null
@@ -1,3904 +0,0 @@
-/* libgcc1 routines for 68000 w/o floating-point hardware.
- Copyright (C) 1994, 1996, 1997 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.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file 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; 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 link this library with files
- compiled with GCC to produce an executable, this does not 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. */
-
-/* Use this one for any 680x0; assumes no floating point hardware.
- The trailing " '" appearing on some lines is for ANSI preprocessors. Yuk.
- Some of this code comes from MINIX, via the folks at ericsson.
- D. V. Henkel-Wallace (gumby@cygnus.com) Fete Bastille, 1992
-*/
-
-/* These are predefined by new versions of GNU cpp. */
-
-#ifndef __USER_LABEL_PREFIX__
-#define __USER_LABEL_PREFIX__ _
-#endif
-
-#ifndef __REGISTER_PREFIX__
-#define __REGISTER_PREFIX__
-#endif
-
-#ifndef __IMMEDIATE_PREFIX__
-#define __IMMEDIATE_PREFIX__ #
-#endif
-
-/* ANSI concatenation macros. */
-
-#define CONCAT1(a, b) CONCAT2(a, b)
-#define CONCAT2(a, b) a ## b
-
-/* Use the right prefix for global labels. */
-
-#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
-
-/* Use the right prefix for registers. */
-
-#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
-
-/* Use the right prefix for immediate values. */
-
-#define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__, x)
-
-#define d0 REG (d0)
-#define d1 REG (d1)
-#define d2 REG (d2)
-#define d3 REG (d3)
-#define d4 REG (d4)
-#define d5 REG (d5)
-#define d6 REG (d6)
-#define d7 REG (d7)
-#define a0 REG (a0)
-#define a1 REG (a1)
-#define a2 REG (a2)
-#define a3 REG (a3)
-#define a4 REG (a4)
-#define a5 REG (a5)
-#define a6 REG (a6)
-#define fp REG (fp)
-#define sp REG (sp)
-
-#ifdef L_floatex
-
-| This is an attempt at a decent floating point (single, double and
-| extended double) code for the GNU C compiler. It should be easy to
-| adapt to other compilers (but beware of the local labels!).
-
-| Starting date: 21 October, 1990
-
-| It is convenient to introduce the notation (s,e,f) for a floating point
-| number, where s=sign, e=exponent, f=fraction. We will call a floating
-| point number fpn to abbreviate, independently of the precision.
-| Let MAX_EXP be in each case the maximum exponent (255 for floats, 1023
-| for doubles and 16383 for long doubles). We then have the following
-| different cases:
-| 1. Normalized fpns have 0 < e < MAX_EXP. They correspond to
-| (-1)^s x 1.f x 2^(e-bias-1).
-| 2. Denormalized fpns have e=0. They correspond to numbers of the form
-| (-1)^s x 0.f x 2^(-bias).
-| 3. +/-INFINITY have e=MAX_EXP, f=0.
-| 4. Quiet NaN (Not a Number) have all bits set.
-| 5. Signaling NaN (Not a Number) have s=0, e=MAX_EXP, f=1.
-
-|=============================================================================
-| exceptions
-|=============================================================================
-
-| This is the floating point condition code register (_fpCCR):
-|
-| struct {
-| short _exception_bits;
-| short _trap_enable_bits;
-| short _sticky_bits;
-| short _rounding_mode;
-| short _format;
-| short _last_operation;
-| union {
-| float sf;
-| double df;
-| } _operand1;
-| union {
-| float sf;
-| double df;
-| } _operand2;
-| } _fpCCR;
-
- .data
- .even
-
- .globl SYM (_fpCCR)
-
-SYM (_fpCCR):
-__exception_bits:
- .word 0
-__trap_enable_bits:
- .word 0
-__sticky_bits:
- .word 0
-__rounding_mode:
- .word ROUND_TO_NEAREST
-__format:
- .word NIL
-__last_operation:
- .word NOOP
-__operand1:
- .long 0
- .long 0
-__operand2:
- .long 0
- .long 0
-
-| Offsets:
-EBITS = __exception_bits - SYM (_fpCCR)
-TRAPE = __trap_enable_bits - SYM (_fpCCR)
-STICK = __sticky_bits - SYM (_fpCCR)
-ROUND = __rounding_mode - SYM (_fpCCR)
-FORMT = __format - SYM (_fpCCR)
-LASTO = __last_operation - SYM (_fpCCR)
-OPER1 = __operand1 - SYM (_fpCCR)
-OPER2 = __operand2 - SYM (_fpCCR)
-
-| The following exception types are supported:
-INEXACT_RESULT = 0x0001
-UNDERFLOW = 0x0002
-OVERFLOW = 0x0004
-DIVIDE_BY_ZERO = 0x0008
-INVALID_OPERATION = 0x0010
-
-| The allowed rounding modes are:
-UNKNOWN = -1
-ROUND_TO_NEAREST = 0 | round result to nearest representable value
-ROUND_TO_ZERO = 1 | round result towards zero
-ROUND_TO_PLUS = 2 | round result towards plus infinity
-ROUND_TO_MINUS = 3 | round result towards minus infinity
-
-| The allowed values of format are:
-NIL = 0
-SINGLE_FLOAT = 1
-DOUBLE_FLOAT = 2
-LONG_FLOAT = 3
-
-| The allowed values for the last operation are:
-NOOP = 0
-ADD = 1
-MULTIPLY = 2
-DIVIDE = 3
-NEGATE = 4
-COMPARE = 5
-EXTENDSFDF = 6
-TRUNCDFSF = 7
-
-|=============================================================================
-| __clear_sticky_bits
-|=============================================================================
-
-| The sticky bits are normally not cleared (thus the name), whereas the
-| exception type and exception value reflect the last computation.
-| This routine is provided to clear them (you can also write to _fpCCR,
-| since it is globally visible).
-
- .globl SYM (__clear_sticky_bit)
-
- .text
- .even
-
-| void __clear_sticky_bits(void);
-SYM (__clear_sticky_bit):
- lea SYM (_fpCCR),a0
-#ifndef __mcf5200__
- movew IMM (0),a0@(STICK)
-#else
- clr.w a0@(STICK)
-#endif
- rts
-
-|=============================================================================
-| $_exception_handler
-|=============================================================================
-
- .globl $_exception_handler
-
- .text
- .even
-
-| This is the common exit point if an exception occurs.
-| NOTE: it is NOT callable from C!
-| It expects the exception type in d7, the format (SINGLE_FLOAT,
-| DOUBLE_FLOAT or LONG_FLOAT) in d6, and the last operation code in d5.
-| It sets the corresponding exception and sticky bits, and the format.
-| Depending on the format if fills the corresponding slots for the
-| operands which produced the exception (all this information is provided
-| so if you write your own exception handlers you have enough information
-| to deal with the problem).
-| Then checks to see if the corresponding exception is trap-enabled,
-| in which case it pushes the address of _fpCCR and traps through
-| trap FPTRAP (15 for the moment).
-
-FPTRAP = 15
-
-$_exception_handler:
- lea SYM (_fpCCR),a0
- movew d7,a0@(EBITS) | set __exception_bits
-#ifndef __mcf5200__
- orw d7,a0@(STICK) | and __sticky_bits
-#else
- movew a0@(STICK),d4
- orl d7,d4
- movew d4,a0@(STICK)
-#endif
- movew d6,a0@(FORMT) | and __format
- movew d5,a0@(LASTO) | and __last_operation
-
-| Now put the operands in place:
-#ifndef __mcf5200__
- cmpw IMM (SINGLE_FLOAT),d6
-#else
- cmpl IMM (SINGLE_FLOAT),d6
-#endif
- beq 1f
- movel a6@(8),a0@(OPER1)
- movel a6@(12),a0@(OPER1+4)
- movel a6@(16),a0@(OPER2)
- movel a6@(20),a0@(OPER2+4)
- bra 2f
-1: movel a6@(8),a0@(OPER1)
- movel a6@(12),a0@(OPER2)
-2:
-| And check whether the exception is trap-enabled:
-#ifndef __mcf5200__
- andw a0@(TRAPE),d7 | is exception trap-enabled?
-#else
- clrl d6
- movew a0@(TRAPE),d6
- andl d6,d7
-#endif
- beq 1f | no, exit
- pea SYM (_fpCCR) | yes, push address of _fpCCR
- trap IMM (FPTRAP) | and trap
-#ifndef __mcf5200__
-1: moveml sp@+,d2-d7 | restore data registers
-#else
-1: moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-#endif /* L_floatex */
-
-#ifdef L_mulsi3
- .text
- .proc
- .globl SYM (__mulsi3)
-SYM (__mulsi3):
- movew sp@(4), d0 /* x0 -> d0 */
- muluw sp@(10), d0 /* x0*y1 */
- movew sp@(6), d1 /* x1 -> d1 */
- muluw sp@(8), d1 /* x1*y0 */
-#ifndef __mcf5200__
- addw d1, d0
-#else
- addl d1, d0
-#endif
- swap d0
- clrw d0
- movew sp@(6), d1 /* x1 -> d1 */
- muluw sp@(10), d1 /* x1*y1 */
- addl d1, d0
-
- rts
-#endif /* L_mulsi3 */
-
-#ifdef L_udivsi3
- .text
- .proc
- .globl SYM (__udivsi3)
-SYM (__udivsi3):
-#ifndef __mcf5200__
- movel d2, sp@-
- movel sp@(12), d1 /* d1 = divisor */
- movel sp@(8), d0 /* d0 = dividend */
-
- cmpl IMM (0x10000), d1 /* divisor >= 2 ^ 16 ? */
- jcc L3 /* then try next algorithm */
- movel d0, d2
- clrw d2
- swap d2
- divu d1, d2 /* high quotient in lower word */
- movew d2, d0 /* save high quotient */
- swap d0
- movew sp@(10), d2 /* get low dividend + high rest */
- divu d1, d2 /* low quotient */
- movew d2, d0
- jra L6
-
-L3: movel d1, d2 /* use d2 as divisor backup */
-L4: lsrl IMM (1), d1 /* shift divisor */
- lsrl IMM (1), d0 /* shift dividend */
- cmpl IMM (0x10000), d1 /* still divisor >= 2 ^ 16 ? */
- jcc L4
- divu d1, d0 /* now we have 16 bit divisor */
- andl IMM (0xffff), d0 /* mask out divisor, ignore remainder */
-
-/* Multiply the 16 bit tentative quotient with the 32 bit divisor. Because of
- the operand ranges, this might give a 33 bit product. If this product is
- greater than the dividend, the tentative quotient was too large. */
- movel d2, d1
- mulu d0, d1 /* low part, 32 bits */
- swap d2
- mulu d0, d2 /* high part, at most 17 bits */
- swap d2 /* align high part with low part */
- tstw d2 /* high part 17 bits? */
- jne L5 /* if 17 bits, quotient was too large */
- addl d2, d1 /* add parts */
- jcs L5 /* if sum is 33 bits, quotient was too large */
- cmpl sp@(8), d1 /* compare the sum with the dividend */
- jls L6 /* if sum > dividend, quotient was too large */
-L5: subql IMM (1), d0 /* adjust quotient */
-
-L6: movel sp@+, d2
- rts
-
-#else /* __mcf5200__ */
-
-/* Coldfire implementation of non-restoring division algorithm from
- Hennessy & Patterson, Appendix A. */
- link a6,IMM (-12)
- moveml d2-d4,sp@
- movel a6@(8),d0
- movel a6@(12),d1
- clrl d2 | clear p
- moveq IMM (31),d4
-L1: addl d0,d0 | shift reg pair (p,a) one bit left
- addxl d2,d2
- movl d2,d3 | subtract b from p, store in tmp.
- subl d1,d3
- jmi L2 | if the result is not is negative, set the
- bset IMM (0),d0 | low order bit of a to 1 and store tmp in p.
- movl d3,d2
-L2: subql IMM (1),d4
- jcc L1
- moveml sp@,d2-d4 | restore data registers
- unlk a6 | and return
- rts
-#endif /* __mcf5200__ */
-
-#endif /* L_udivsi3 */
-
-#ifdef L_divsi3
- .text
- .proc
- .globl SYM (__divsi3)
-SYM (__divsi3):
- movel d2, sp@-
-
- moveq IMM (1), d2 /* sign of result stored in d2 (=1 or =-1) */
- movel sp@(12), d1 /* d1 = divisor */
- jpl L1
- negl d1
-#ifndef __mcf5200__
- negb d2 /* change sign because divisor <0 */
-#else
- negl d2 /* change sign because divisor <0 */
-#endif
-L1: movel sp@(8), d0 /* d0 = dividend */
- jpl L2
- negl d0
-#ifndef __mcf5200__
- negb d2
-#else
- negl d2
-#endif
-
-L2: movel d1, sp@-
- movel d0, sp@-
- jbsr SYM (__udivsi3) /* divide abs(dividend) by abs(divisor) */
- addql IMM (8), sp
-
- tstb d2
- jpl L3
- negl d0
-
-L3: movel sp@+, d2
- rts
-#endif /* L_divsi3 */
-
-#ifdef L_umodsi3
- .text
- .proc
- .globl SYM (__umodsi3)
-SYM (__umodsi3):
- movel sp@(8), d1 /* d1 = divisor */
- movel sp@(4), d0 /* d0 = dividend */
- movel d1, sp@-
- movel d0, sp@-
- jbsr SYM (__udivsi3)
- addql IMM (8), sp
- movel sp@(8), d1 /* d1 = divisor */
-#ifndef __mcf5200__
- movel d1, sp@-
- movel d0, sp@-
- jbsr SYM (__mulsi3) /* d0 = (a/b)*b */
- addql IMM (8), sp
-#else
- mulsl d1,d0
-#endif
- movel sp@(4), d1 /* d1 = dividend */
- subl d0, d1 /* d1 = a - (a/b)*b */
- movel d1, d0
- rts
-#endif /* L_umodsi3 */
-
-#ifdef L_modsi3
- .text
- .proc
- .globl SYM (__modsi3)
-SYM (__modsi3):
- movel sp@(8), d1 /* d1 = divisor */
- movel sp@(4), d0 /* d0 = dividend */
- movel d1, sp@-
- movel d0, sp@-
- jbsr SYM (__divsi3)
- addql IMM (8), sp
- movel sp@(8), d1 /* d1 = divisor */
-#ifndef __mcf5200__
- movel d1, sp@-
- movel d0, sp@-
- jbsr SYM (__mulsi3) /* d0 = (a/b)*b */
- addql IMM (8), sp
-#else
- mulsl d1,d0
-#endif
- movel sp@(4), d1 /* d1 = dividend */
- subl d0, d1 /* d1 = a - (a/b)*b */
- movel d1, d0
- rts
-#endif /* L_modsi3 */
-
-
-#ifdef L_double
-
- .globl SYM (_fpCCR)
- .globl $_exception_handler
-
-QUIET_NaN = 0xffffffff
-
-D_MAX_EXP = 0x07ff
-D_BIAS = 1022
-DBL_MAX_EXP = D_MAX_EXP - D_BIAS
-DBL_MIN_EXP = 1 - D_BIAS
-DBL_MANT_DIG = 53
-
-INEXACT_RESULT = 0x0001
-UNDERFLOW = 0x0002
-OVERFLOW = 0x0004
-DIVIDE_BY_ZERO = 0x0008
-INVALID_OPERATION = 0x0010
-
-DOUBLE_FLOAT = 2
-
-NOOP = 0
-ADD = 1
-MULTIPLY = 2
-DIVIDE = 3
-NEGATE = 4
-COMPARE = 5
-EXTENDSFDF = 6
-TRUNCDFSF = 7
-
-UNKNOWN = -1
-ROUND_TO_NEAREST = 0 | round result to nearest representable value
-ROUND_TO_ZERO = 1 | round result towards zero
-ROUND_TO_PLUS = 2 | round result towards plus infinity
-ROUND_TO_MINUS = 3 | round result towards minus infinity
-
-| Entry points:
-
- .globl SYM (__adddf3)
- .globl SYM (__subdf3)
- .globl SYM (__muldf3)
- .globl SYM (__divdf3)
- .globl SYM (__negdf2)
- .globl SYM (__cmpdf2)
-
- .text
- .even
-
-| These are common routines to return and signal exceptions.
-
-Ld$den:
-| Return and signal a denormalized number
- orl d7,d0
- movew IMM (INEXACT_RESULT+UNDERFLOW),d7
- moveq IMM (DOUBLE_FLOAT),d6
- jmp $_exception_handler
-
-Ld$infty:
-Ld$overflow:
-| Return a properly signed INFINITY and set the exception flags
- movel IMM (0x7ff00000),d0
- movel IMM (0),d1
- orl d7,d0
- movew IMM (INEXACT_RESULT+OVERFLOW),d7
- moveq IMM (DOUBLE_FLOAT),d6
- jmp $_exception_handler
-
-Ld$underflow:
-| Return 0 and set the exception flags
- movel IMM (0),d0
- movel d0,d1
- movew IMM (INEXACT_RESULT+UNDERFLOW),d7
- moveq IMM (DOUBLE_FLOAT),d6
- jmp $_exception_handler
-
-Ld$inop:
-| Return a quiet NaN and set the exception flags
- movel IMM (QUIET_NaN),d0
- movel d0,d1
- movew IMM (INEXACT_RESULT+INVALID_OPERATION),d7
- moveq IMM (DOUBLE_FLOAT),d6
- jmp $_exception_handler
-
-Ld$div$0:
-| Return a properly signed INFINITY and set the exception flags
- movel IMM (0x7ff00000),d0
- movel IMM (0),d1
- orl d7,d0
- movew IMM (INEXACT_RESULT+DIVIDE_BY_ZERO),d7
- moveq IMM (DOUBLE_FLOAT),d6
- jmp $_exception_handler
-
-|=============================================================================
-|=============================================================================
-| double precision routines
-|=============================================================================
-|=============================================================================
-
-| A double precision floating point number (double) has the format:
-|
-| struct _double {
-| unsigned int sign : 1; /* sign bit */
-| unsigned int exponent : 11; /* exponent, shifted by 126 */
-| unsigned int fraction : 52; /* fraction */
-| } double;
-|
-| Thus sizeof(double) = 8 (64 bits).
-|
-| All the routines are callable from C programs, and return the result
-| in the register pair d0-d1. They also preserve all registers except
-| d0-d1 and a0-a1.
-
-|=============================================================================
-| __subdf3
-|=============================================================================
-
-| double __subdf3(double, double);
-SYM (__subdf3):
- bchg IMM (31),sp@(12) | change sign of second operand
- | and fall through, so we always add
-|=============================================================================
-| __adddf3
-|=============================================================================
-
-| double __adddf3(double, double);
-SYM (__adddf3):
-#ifndef __mcf5200__
- link a6,IMM (0) | everything will be done in registers
- moveml d2-d7,sp@- | save all data registers and a2 (but d0-d1)
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get first operand
- movel a6@(12),d1 |
- movel a6@(16),d2 | get second operand
- movel a6@(20),d3 |
-
- movel d0,d7 | get d0's sign bit in d7 '
- addl d1,d1 | check and clear sign bit of a, and gain one
- addxl d0,d0 | bit of extra precision
- beq Ladddf$b | if zero return second operand
-
- movel d2,d6 | save sign in d6
- addl d3,d3 | get rid of sign bit and gain one bit of
- addxl d2,d2 | extra precision
- beq Ladddf$a | if zero return first operand
-
- andl IMM (0x80000000),d7 | isolate a's sign bit '
- swap d6 | and also b's sign bit '
-#ifndef __mcf5200__
- andw IMM (0x8000),d6 |
- orw d6,d7 | and combine them into d7, so that a's sign '
- | bit is in the high word and b's is in the '
- | low word, so d6 is free to be used
-#else
- andl IMM (0x8000),d6
- orl d6,d7
-#endif
- movel d7,a0 | now save d7 into a0, so d7 is free to
- | be used also
-
-| Get the exponents and check for denormalized and/or infinity.
-
- movel IMM (0x001fffff),d6 | mask for the fraction
- movel IMM (0x00200000),d7 | mask to put hidden bit back
-
- movel d0,d4 |
- andl d6,d0 | get fraction in d0
- notl d6 | make d6 into mask for the exponent
- andl d6,d4 | get exponent in d4
- beq Ladddf$a$den | branch if a is denormalized
- cmpl d6,d4 | check for INFINITY or NaN
- beq Ladddf$nf |
- orl d7,d0 | and put hidden bit back
-Ladddf$1:
- swap d4 | shift right exponent so that it starts
-#ifndef __mcf5200__
- lsrw IMM (5),d4 | in bit 0 and not bit 20
-#else
- lsrl IMM (5),d4 | in bit 0 and not bit 20
-#endif
-| Now we have a's exponent in d4 and fraction in d0-d1 '
- movel d2,d5 | save b to get exponent
- andl d6,d5 | get exponent in d5
- beq Ladddf$b$den | branch if b is denormalized
- cmpl d6,d5 | check for INFINITY or NaN
- beq Ladddf$nf
- notl d6 | make d6 into mask for the fraction again
- andl d6,d2 | and get fraction in d2
- orl d7,d2 | and put hidden bit back
-Ladddf$2:
- swap d5 | shift right exponent so that it starts
-#ifndef __mcf5200__
- lsrw IMM (5),d5 | in bit 0 and not bit 20
-#else
- lsrl IMM (5),d5 | in bit 0 and not bit 20
-#endif
-
-| Now we have b's exponent in d5 and fraction in d2-d3. '
-
-| The situation now is as follows: the signs are combined in a0, the
-| numbers are in d0-d1 (a) and d2-d3 (b), and the exponents in d4 (a)
-| and d5 (b). To do the rounding correctly we need to keep all the
-| bits until the end, so we need to use d0-d1-d2-d3 for the first number
-| and d4-d5-d6-d7 for the second. To do this we store (temporarily) the
-| exponents in a2-a3.
-
-#ifndef __mcf5200__
- moveml a2-a3,sp@- | save the address registers
-#else
- movel a2,sp@-
- movel a3,sp@-
- movel a4,sp@-
-#endif
-
- movel d4,a2 | save the exponents
- movel d5,a3 |
-
- movel IMM (0),d7 | and move the numbers around
- movel d7,d6 |
- movel d3,d5 |
- movel d2,d4 |
- movel d7,d3 |
- movel d7,d2 |
-
-| Here we shift the numbers until the exponents are the same, and put
-| the largest exponent in a2.
-#ifndef __mcf5200__
- exg d4,a2 | get exponents back
- exg d5,a3 |
- cmpw d4,d5 | compare the exponents
-#else
- movel d4,a4 | get exponents back
- movel a2,d4
- movel a4,a2
- movel d5,a4
- movel a3,d5
- movel a4,a3
- cmpl d4,d5 | compare the exponents
-#endif
- beq Ladddf$3 | if equal don't shift '
- bhi 9f | branch if second exponent is higher
-
-| Here we have a's exponent larger than b's, so we have to shift b. We do
-| this by using as counter d2:
-1: movew d4,d2 | move largest exponent to d2
-#ifndef __mcf5200__
- subw d5,d2 | and subtract second exponent
- exg d4,a2 | get back the longs we saved
- exg d5,a3 |
-#else
- subl d5,d2 | and subtract second exponent
- movel d4,a4 | get back the longs we saved
- movel a2,d4
- movel a4,a2
- movel d5,a4
- movel a3,d5
- movel a4,a3
-#endif
-| if difference is too large we don't shift (actually, we can just exit) '
-#ifndef __mcf5200__
- cmpw IMM (DBL_MANT_DIG+2),d2
-#else
- cmpl IMM (DBL_MANT_DIG+2),d2
-#endif
- bge Ladddf$b$small
-#ifndef __mcf5200__
- cmpw IMM (32),d2 | if difference >= 32, shift by longs
-#else
- cmpl IMM (32),d2 | if difference >= 32, shift by longs
-#endif
- bge 5f
-2:
-#ifndef __mcf5200__
- cmpw IMM (16),d2 | if difference >= 16, shift by words
-#else
- cmpl IMM (16),d2 | if difference >= 16, shift by words
-#endif
- bge 6f
- bra 3f | enter dbra loop
-
-4:
-#ifndef __mcf5200__
- lsrl IMM (1),d4
- roxrl IMM (1),d5
- roxrl IMM (1),d6
- roxrl IMM (1),d7
-#else
- lsrl IMM (1),d7
- btst IMM (0),d6
- beq 10f
- bset IMM (31),d7
-10: lsrl IMM (1),d6
- btst IMM (0),d5
- beq 11f
- bset IMM (31),d6
-11: lsrl IMM (1),d5
- btst IMM (0),d4
- beq 12f
- bset IMM (31),d5
-12: lsrl IMM (1),d4
-#endif
-3:
-#ifndef __mcf5200__
- dbra d2,4b
-#else
- subql IMM (1),d2
- bpl 4b
-#endif
- movel IMM (0),d2
- movel d2,d3
- bra Ladddf$4
-5:
- movel d6,d7
- movel d5,d6
- movel d4,d5
- movel IMM (0),d4
-#ifndef __mcf5200__
- subw IMM (32),d2
-#else
- subl IMM (32),d2
-#endif
- bra 2b
-6:
- movew d6,d7
- swap d7
- movew d5,d6
- swap d6
- movew d4,d5
- swap d5
- movew IMM (0),d4
- swap d4
-#ifndef __mcf5200__
- subw IMM (16),d2
-#else
- subl IMM (16),d2
-#endif
- bra 3b
-
-9:
-#ifndef __mcf5200__
- exg d4,d5
- movew d4,d6
- subw d5,d6 | keep d5 (largest exponent) in d4
- exg d4,a2
- exg d5,a3
-#else
- movel d5,d6
- movel d4,d5
- movel d6,d4
- subl d5,d6
- movel d4,a4
- movel a2,d4
- movel a4,a2
- movel d5,a4
- movel a3,d5
- movel a4,a3
-#endif
-| if difference is too large we don't shift (actually, we can just exit) '
-#ifndef __mcf5200__
- cmpw IMM (DBL_MANT_DIG+2),d6
-#else
- cmpl IMM (DBL_MANT_DIG+2),d6
-#endif
- bge Ladddf$a$small
-#ifndef __mcf5200__
- cmpw IMM (32),d6 | if difference >= 32, shift by longs
-#else
- cmpl IMM (32),d6 | if difference >= 32, shift by longs
-#endif
- bge 5f
-2:
-#ifndef __mcf5200__
- cmpw IMM (16),d6 | if difference >= 16, shift by words
-#else
- cmpl IMM (16),d6 | if difference >= 16, shift by words
-#endif
- bge 6f
- bra 3f | enter dbra loop
-
-4:
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
-#endif
-3:
-#ifndef __mcf5200__
- dbra d6,4b
-#else
- subql IMM (1),d6
- bpl 4b
-#endif
- movel IMM (0),d7
- movel d7,d6
- bra Ladddf$4
-5:
- movel d2,d3
- movel d1,d2
- movel d0,d1
- movel IMM (0),d0
-#ifndef __mcf5200__
- subw IMM (32),d6
-#else
- subl IMM (32),d6
-#endif
- bra 2b
-6:
- movew d2,d3
- swap d3
- movew d1,d2
- swap d2
- movew d0,d1
- swap d1
- movew IMM (0),d0
- swap d0
-#ifndef __mcf5200__
- subw IMM (16),d6
-#else
- subl IMM (16),d6
-#endif
- bra 3b
-Ladddf$3:
-#ifndef __mcf5200__
- exg d4,a2
- exg d5,a3
-#else
- movel d4,a4
- movel a2,d4
- movel a4,a2
- movel d5,a4
- movel a3,d5
- movel a4,a3
-#endif
-Ladddf$4:
-| Now we have the numbers in d0--d3 and d4--d7, the exponent in a2, and
-| the signs in a4.
-
-| Here we have to decide whether to add or subtract the numbers:
-#ifndef __mcf5200__
- exg d7,a0 | get the signs
- exg d6,a3 | a3 is free to be used
-#else
- movel d7,a4
- movel a0,d7
- movel a4,a0
- movel d6,a4
- movel a3,d6
- movel a4,a3
-#endif
- movel d7,d6 |
- movew IMM (0),d7 | get a's sign in d7 '
- swap d6 |
- movew IMM (0),d6 | and b's sign in d6 '
- eorl d7,d6 | compare the signs
- bmi Lsubdf$0 | if the signs are different we have
- | to subtract
-#ifndef __mcf5200__
- exg d7,a0 | else we add the numbers
- exg d6,a3 |
-#else
- movel d7,a4
- movel a0,d7
- movel a4,a0
- movel d6,a4
- movel a3,d6
- movel a4,a3
-#endif
- addl d7,d3 |
- addxl d6,d2 |
- addxl d5,d1 |
- addxl d4,d0 |
-
- movel a2,d4 | return exponent to d4
- movel a0,d7 |
- andl IMM (0x80000000),d7 | d7 now has the sign
-
-#ifndef __mcf5200__
- moveml sp@+,a2-a3
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
-
-| Before rounding normalize so bit #DBL_MANT_DIG is set (we will consider
-| the case of denormalized numbers in the rounding routine itself).
-| As in the addition (not in the subtraction!) we could have set
-| one more bit we check this:
- btst IMM (DBL_MANT_DIG+1),d0
- beq 1f
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- addw IMM (1),d4
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
-1:
- lea Ladddf$5,a0 | to return from rounding routine
- lea SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcf5200__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcf5200__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Ladddf$5:
-| Put back the exponent and check for overflow
-#ifndef __mcf5200__
- cmpw IMM (0x7ff),d4 | is the exponent big?
-#else
- cmpl IMM (0x7ff),d4 | is the exponent big?
-#endif
- bge 1f
- bclr IMM (DBL_MANT_DIG-1),d0
-#ifndef __mcf5200__
- lslw IMM (4),d4 | put exponent back into position
-#else
- lsll IMM (4),d4 | put exponent back into position
-#endif
- swap d0 |
-#ifndef __mcf5200__
- orw d4,d0 |
-#else
- orl d4,d0 |
-#endif
- swap d0 |
- bra Ladddf$ret
-1:
- movew IMM (ADD),d5
- bra Ld$overflow
-
-Lsubdf$0:
-| Here we do the subtraction.
-#ifndef __mcf5200__
- exg d7,a0 | put sign back in a0
- exg d6,a3 |
-#else
- movel d7,a4
- movel a0,d7
- movel a4,a0
- movel d6,a4
- movel a3,d6
- movel a4,a3
-#endif
- subl d7,d3 |
- subxl d6,d2 |
- subxl d5,d1 |
- subxl d4,d0 |
- beq Ladddf$ret$1 | if zero just exit
- bpl 1f | if positive skip the following
- movel a0,d7 |
- bchg IMM (31),d7 | change sign bit in d7
- movel d7,a0 |
- negl d3 |
- negxl d2 |
- negxl d1 | and negate result
- negxl d0 |
-1:
- movel a2,d4 | return exponent to d4
- movel a0,d7
- andl IMM (0x80000000),d7 | isolate sign bit
-#ifndef __mcf5200__
- moveml sp@+,a2-a3 |
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
-
-| Before rounding normalize so bit #DBL_MANT_DIG is set (we will consider
-| the case of denormalized numbers in the rounding routine itself).
-| As in the addition (not in the subtraction!) we could have set
-| one more bit we check this:
- btst IMM (DBL_MANT_DIG+1),d0
- beq 1f
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- addw IMM (1),d4
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
-1:
- lea Lsubdf$1,a0 | to return from rounding routine
- lea SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcf5200__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcf5200__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Lsubdf$1:
-| Put back the exponent and sign (we don't have overflow). '
- bclr IMM (DBL_MANT_DIG-1),d0
-#ifndef __mcf5200__
- lslw IMM (4),d4 | put exponent back into position
-#else
- lsll IMM (4),d4 | put exponent back into position
-#endif
- swap d0 |
-#ifndef __mcf5200__
- orw d4,d0 |
-#else
- orl d4,d0 |
-#endif
- swap d0 |
- bra Ladddf$ret
-
-| If one of the numbers was too small (difference of exponents >=
-| DBL_MANT_DIG+1) we return the other (and now we don't have to '
-| check for finiteness or zero).
-Ladddf$a$small:
-#ifndef __mcf5200__
- moveml sp@+,a2-a3
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
- movel a6@(16),d0
- movel a6@(20),d1
- lea SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-Ladddf$b$small:
-#ifndef __mcf5200__
- moveml sp@+,a2-a3
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
- movel a6@(8),d0
- movel a6@(12),d1
- lea SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-Ladddf$a$den:
- movel d7,d4 | d7 contains 0x00200000
- bra Ladddf$1
-
-Ladddf$b$den:
- movel d7,d5 | d7 contains 0x00200000
- notl d6
- bra Ladddf$2
-
-Ladddf$b:
-| Return b (if a is zero)
- movel d2,d0
- movel d3,d1
- bra 1f
-Ladddf$a:
- movel a6@(8),d0
- movel a6@(12),d1
-1:
- movew IMM (ADD),d5
-| Check for NaN and +/-INFINITY.
- movel d0,d7 |
- andl IMM (0x80000000),d7 |
- bclr IMM (31),d0 |
- cmpl IMM (0x7ff00000),d0 |
- bge 2f |
- movel d0,d0 | check for zero, since we don't '
- bne Ladddf$ret | want to return -0 by mistake
- bclr IMM (31),d7 |
- bra Ladddf$ret |
-2:
- andl IMM (0x000fffff),d0 | check for NaN (nonzero fraction)
- orl d1,d0 |
- bne Ld$inop |
- bra Ld$infty |
-
-Ladddf$ret$1:
-#ifndef __mcf5200__
- moveml sp@+,a2-a3 | restore regs and exit
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
-
-Ladddf$ret:
-| Normal exit.
- lea SYM (_fpCCR),a0
- movew IMM (0),a0@
- orl d7,d0 | put sign bit back
-#ifndef __mcf5200__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-Ladddf$ret$den:
-| Return a denormalized number.
-#ifndef __mcf5200__
- lsrl IMM (1),d0 | shift right once more
- roxrl IMM (1),d1 |
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
-#endif
- bra Ladddf$ret
-
-Ladddf$nf:
- movew IMM (ADD),d5
-| This could be faster but it is not worth the effort, since it is not
-| executed very often. We sacrifice speed for clarity here.
- movel a6@(8),d0 | get the numbers back (remember that we
- movel a6@(12),d1 | did some processing already)
- movel a6@(16),d2 |
- movel a6@(20),d3 |
- movel IMM (0x7ff00000),d4 | useful constant (INFINITY)
- movel d0,d7 | save sign bits
- movel d2,d6 |
- bclr IMM (31),d0 | clear sign bits
- bclr IMM (31),d2 |
-| We know that one of them is either NaN of +/-INFINITY
-| Check for NaN (if either one is NaN return NaN)
- cmpl d4,d0 | check first a (d0)
- bhi Ld$inop | if d0 > 0x7ff00000 or equal and
- bne 2f
- tstl d1 | d1 > 0, a is NaN
- bne Ld$inop |
-2: cmpl d4,d2 | check now b (d1)
- bhi Ld$inop |
- bne 3f
- tstl d3 |
- bne Ld$inop |
-3:
-| Now comes the check for +/-INFINITY. We know that both are (maybe not
-| finite) numbers, but we have to check if both are infinite whether we
-| are adding or subtracting them.
- eorl d7,d6 | to check sign bits
- bmi 1f
- andl IMM (0x80000000),d7 | get (common) sign bit
- bra Ld$infty
-1:
-| We know one (or both) are infinite, so we test for equality between the
-| two numbers (if they are equal they have to be infinite both, so we
-| return NaN).
- cmpl d2,d0 | are both infinite?
- bne 1f | if d0 <> d2 they are not equal
- cmpl d3,d1 | if d0 == d2 test d3 and d1
- beq Ld$inop | if equal return NaN
-1:
- andl IMM (0x80000000),d7 | get a's sign bit '
- cmpl d4,d0 | test now for infinity
- beq Ld$infty | if a is INFINITY return with this sign
- bchg IMM (31),d7 | else we know b is INFINITY and has
- bra Ld$infty | the opposite sign
-
-|=============================================================================
-| __muldf3
-|=============================================================================
-
-| double __muldf3(double, double);
-SYM (__muldf3):
-#ifndef __mcf5200__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get a into d0-d1
- movel a6@(12),d1 |
- movel a6@(16),d2 | and b into d2-d3
- movel a6@(20),d3 |
- movel d0,d7 | d7 will hold the sign of the product
- eorl d2,d7 |
- andl IMM (0x80000000),d7 |
- movel d7,a0 | save sign bit into a0
- movel IMM (0x7ff00000),d7 | useful constant (+INFINITY)
- movel d7,d6 | another (mask for fraction)
- notl d6 |
- bclr IMM (31),d0 | get rid of a's sign bit '
- movel d0,d4 |
- orl d1,d4 |
- beq Lmuldf$a$0 | branch if a is zero
- movel d0,d4 |
- bclr IMM (31),d2 | get rid of b's sign bit '
- movel d2,d5 |
- orl d3,d5 |
- beq Lmuldf$b$0 | branch if b is zero
- movel d2,d5 |
- cmpl d7,d0 | is a big?
- bhi Lmuldf$inop | if a is NaN return NaN
- beq Lmuldf$a$nf | we still have to check d1 and b ...
- cmpl d7,d2 | now compare b with INFINITY
- bhi Lmuldf$inop | is b NaN?
- beq Lmuldf$b$nf | we still have to check d3 ...
-| Here we have both numbers finite and nonzero (and with no sign bit).
-| Now we get the exponents into d4 and d5.
- andl d7,d4 | isolate exponent in d4
- beq Lmuldf$a$den | if exponent zero, have denormalized
- andl d6,d0 | isolate fraction
- orl IMM (0x00100000),d0 | and put hidden bit back
- swap d4 | I like exponents in the first byte
-#ifndef __mcf5200__
- lsrw IMM (4),d4 |
-#else
- lsrl IMM (4),d4 |
-#endif
-Lmuldf$1:
- andl d7,d5 |
- beq Lmuldf$b$den |
- andl d6,d2 |
- orl IMM (0x00100000),d2 | and put hidden bit back
- swap d5 |
-#ifndef __mcf5200__
- lsrw IMM (4),d5 |
-#else
- lsrl IMM (4),d5 |
-#endif
-Lmuldf$2: |
-#ifndef __mcf5200__
- addw d5,d4 | add exponents
- subw IMM (D_BIAS+1),d4 | and subtract bias (plus one)
-#else
- addl d5,d4 | add exponents
- subl IMM (D_BIAS+1),d4 | and subtract bias (plus one)
-#endif
-
-| We are now ready to do the multiplication. The situation is as follows:
-| both a and b have bit 52 ( bit 20 of d0 and d2) set (even if they were
-| denormalized to start with!), which means that in the product bit 104
-| (which will correspond to bit 8 of the fourth long) is set.
-
-| Here we have to do the product.
-| To do it we have to juggle the registers back and forth, as there are not
-| enough to keep everything in them. So we use the address registers to keep
-| some intermediate data.
-
-#ifndef __mcf5200__
- moveml a2-a3,sp@- | save a2 and a3 for temporary use
-#else
- movel a2,sp@-
- movel a3,sp@-
- movel a4,sp@-
-#endif
- movel IMM (0),a2 | a2 is a null register
- movel d4,a3 | and a3 will preserve the exponent
-
-| First, shift d2-d3 so bit 20 becomes bit 31:
-#ifndef __mcf5200__
- rorl IMM (5),d2 | rotate d2 5 places right
- swap d2 | and swap it
- rorl IMM (5),d3 | do the same thing with d3
- swap d3 |
- movew d3,d6 | get the rightmost 11 bits of d3
- andw IMM (0x07ff),d6 |
- orw d6,d2 | and put them into d2
- andw IMM (0xf800),d3 | clear those bits in d3
-#else
- moveq IMM (11),d7 | left shift d2 11 bits
- lsll d7,d2
- movel d3,d6 | get a copy of d3
- lsll d7,d3 | left shift d3 11 bits
- andl IMM (0xffe00000),d6 | get the top 11 bits of d3
- moveq IMM (21),d7 | right shift them 21 bits
- lsrl d7,d6
- orl d6,d2 | stick them at the end of d2
-#endif
-
- movel d2,d6 | move b into d6-d7
- movel d3,d7 | move a into d4-d5
- movel d0,d4 | and clear d0-d1-d2-d3 (to put result)
- movel d1,d5 |
- movel IMM (0),d3 |
- movel d3,d2 |
- movel d3,d1 |
- movel d3,d0 |
-
-| We use a1 as counter:
- movel IMM (DBL_MANT_DIG-1),a1
-#ifndef __mcf5200__
- exg d7,a1
-#else
- movel d7,a4
- movel a1,d7
- movel a4,a1
-#endif
-
-1:
-#ifndef __mcf5200__
- exg d7,a1 | put counter back in a1
-#else
- movel d7,a4
- movel a1,d7
- movel a4,a1
-#endif
- addl d3,d3 | shift sum once left
- addxl d2,d2 |
- addxl d1,d1 |
- addxl d0,d0 |
- addl d7,d7 |
- addxl d6,d6 |
- bcc 2f | if bit clear skip the following
-#ifndef __mcf5200__
- exg d7,a2 |
-#else
- movel d7,a4
- movel a2,d7
- movel a4,a2
-#endif
- addl d5,d3 | else add a to the sum
- addxl d4,d2 |
- addxl d7,d1 |
- addxl d7,d0 |
-#ifndef __mcf5200__
- exg d7,a2 |
-#else
- movel d7,a4
- movel a2,d7
- movel a4,a2
-#endif
-2:
-#ifndef __mcf5200__
- exg d7,a1 | put counter in d7
- dbf d7,1b | decrement and branch
-#else
- movel d7,a4
- movel a1,d7
- movel a4,a1
- subql IMM (1),d7
- bpl 1b
-#endif
-
- movel a3,d4 | restore exponent
-#ifndef __mcf5200__
- moveml sp@+,a2-a3
-#else
- movel sp@+,a4
- movel sp@+,a3
- movel sp@+,a2
-#endif
-
-| Now we have the product in d0-d1-d2-d3, with bit 8 of d0 set. The
-| first thing to do now is to normalize it so bit 8 becomes bit
-| DBL_MANT_DIG-32 (to do the rounding); later we will shift right.
- swap d0
- swap d1
- movew d1,d0
- swap d2
- movew d2,d1
- swap d3
- movew d3,d2
- movew IMM (0),d3
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
-#else
- moveq IMM (29),d6
- lsrl IMM (3),d3
- movel d2,d7
- lsll d6,d7
- orl d7,d3
- lsrl IMM (3),d2
- movel d1,d7
- lsll d6,d7
- orl d7,d2
- lsrl IMM (3),d1
- movel d0,d7
- lsll d6,d7
- orl d7,d1
- lsrl IMM (3),d0
-#endif
-
-| Now round, check for over- and underflow, and exit.
- movel a0,d7 | get sign bit back into d7
- movew IMM (MULTIPLY),d5
-
- btst IMM (DBL_MANT_DIG+1-32),d0
- beq Lround$exit
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- addw IMM (1),d4
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
- bra Lround$exit
-
-Lmuldf$inop:
- movew IMM (MULTIPLY),d5
- bra Ld$inop
-
-Lmuldf$b$nf:
- movew IMM (MULTIPLY),d5
- movel a0,d7 | get sign bit back into d7
- tstl d3 | we know d2 == 0x7ff00000, so check d3
- bne Ld$inop | if d3 <> 0 b is NaN
- bra Ld$overflow | else we have overflow (since a is finite)
-
-Lmuldf$a$nf:
- movew IMM (MULTIPLY),d5
- movel a0,d7 | get sign bit back into d7
- tstl d1 | we know d0 == 0x7ff00000, so check d1
- bne Ld$inop | if d1 <> 0 a is NaN
- bra Ld$overflow | else signal overflow
-
-| If either number is zero return zero, unless the other is +/-INFINITY or
-| NaN, in which case we return NaN.
-Lmuldf$b$0:
- movew IMM (MULTIPLY),d5
-#ifndef __mcf5200__
- exg d2,d0 | put b (==0) into d0-d1
- exg d3,d1 | and a (with sign bit cleared) into d2-d3
-#else
- movel d2,d7
- movel d0,d2
- movel d7,d0
- movel d3,d7
- movel d1,d3
- movel d7,d1
-#endif
- bra 1f
-Lmuldf$a$0:
- movel a6@(16),d2 | put b into d2-d3 again
- movel a6@(20),d3 |
- bclr IMM (31),d2 | clear sign bit
-1: cmpl IMM (0x7ff00000),d2 | check for non-finiteness
- bge Ld$inop | in case NaN or +/-INFINITY return NaN
- lea SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcf5200__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-| If a number is denormalized we put an exponent of 1 but do not put the
-| hidden bit back into the fraction; instead we shift left until bit 21
-| (the hidden bit) is set, adjusting the exponent accordingly. We do this
-| to ensure that the product of the fractions is close to 1.
-Lmuldf$a$den:
- movel IMM (1),d4
- andl d6,d0
-1: addl d1,d1 | shift a left until bit 20 is set
- addxl d0,d0 |
-#ifndef __mcf5200__
- subw IMM (1),d4 | and adjust exponent
-#else
- subl IMM (1),d4 | and adjust exponent
-#endif
- btst IMM (20),d0 |
- bne Lmuldf$1 |
- bra 1b
-
-Lmuldf$b$den:
- movel IMM (1),d5
- andl d6,d2
-1: addl d3,d3 | shift b left until bit 20 is set
- addxl d2,d2 |
-#ifndef __mcf5200__
- subw IMM (1),d5 | and adjust exponent
-#else
- subql IMM (1),d5 | and adjust exponent
-#endif
- btst IMM (20),d2 |
- bne Lmuldf$2 |
- bra 1b
-
-
-|=============================================================================
-| __divdf3
-|=============================================================================
-
-| double __divdf3(double, double);
-SYM (__divdf3):
-#ifndef __mcf5200__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get a into d0-d1
- movel a6@(12),d1 |
- movel a6@(16),d2 | and b into d2-d3
- movel a6@(20),d3 |
- movel d0,d7 | d7 will hold the sign of the result
- eorl d2,d7 |
- andl IMM (0x80000000),d7
- movel d7,a0 | save sign into a0
- movel IMM (0x7ff00000),d7 | useful constant (+INFINITY)
- movel d7,d6 | another (mask for fraction)
- notl d6 |
- bclr IMM (31),d0 | get rid of a's sign bit '
- movel d0,d4 |
- orl d1,d4 |
- beq Ldivdf$a$0 | branch if a is zero
- movel d0,d4 |
- bclr IMM (31),d2 | get rid of b's sign bit '
- movel d2,d5 |
- orl d3,d5 |
- beq Ldivdf$b$0 | branch if b is zero
- movel d2,d5
- cmpl d7,d0 | is a big?
- bhi Ldivdf$inop | if a is NaN return NaN
- beq Ldivdf$a$nf | if d0 == 0x7ff00000 we check d1
- cmpl d7,d2 | now compare b with INFINITY
- bhi Ldivdf$inop | if b is NaN return NaN
- beq Ldivdf$b$nf | if d2 == 0x7ff00000 we check d3
-| Here we have both numbers finite and nonzero (and with no sign bit).
-| Now we get the exponents into d4 and d5 and normalize the numbers to
-| ensure that the ratio of the fractions is around 1. We do this by
-| making sure that both numbers have bit #DBL_MANT_DIG-32-1 (hidden bit)
-| set, even if they were denormalized to start with.
-| Thus, the result will satisfy: 2 > result > 1/2.
- andl d7,d4 | and isolate exponent in d4
- beq Ldivdf$a$den | if exponent is zero we have a denormalized
- andl d6,d0 | and isolate fraction
- orl IMM (0x00100000),d0 | and put hidden bit back
- swap d4 | I like exponents in the first byte
-#ifndef __mcf5200__
- lsrw IMM (4),d4 |
-#else
- lsrl IMM (4),d4 |
-#endif
-Ldivdf$1: |
- andl d7,d5 |
- beq Ldivdf$b$den |
- andl d6,d2 |
- orl IMM (0x00100000),d2
- swap d5 |
-#ifndef __mcf5200__
- lsrw IMM (4),d5 |
-#else
- lsrl IMM (4),d5 |
-#endif
-Ldivdf$2: |
-#ifndef __mcf5200__
- subw d5,d4 | subtract exponents
- addw IMM (D_BIAS),d4 | and add bias
-#else
- subl d5,d4 | subtract exponents
- addl IMM (D_BIAS),d4 | and add bias
-#endif
-
-| We are now ready to do the division. We have prepared things in such a way
-| that the ratio of the fractions will be less than 2 but greater than 1/2.
-| At this point the registers in use are:
-| d0-d1 hold a (first operand, bit DBL_MANT_DIG-32=0, bit
-| DBL_MANT_DIG-1-32=1)
-| d2-d3 hold b (second operand, bit DBL_MANT_DIG-32=1)
-| d4 holds the difference of the exponents, corrected by the bias
-| a0 holds the sign of the ratio
-
-| To do the rounding correctly we need to keep information about the
-| nonsignificant bits. One way to do this would be to do the division
-| using four registers; another is to use two registers (as originally
-| I did), but use a sticky bit to preserve information about the
-| fractional part. Note that we can keep that info in a1, which is not
-| used.
- movel IMM (0),d6 | d6-d7 will hold the result
- movel d6,d7 |
- movel IMM (0),a1 | and a1 will hold the sticky bit
-
- movel IMM (DBL_MANT_DIG-32+1),d5
-
-1: cmpl d0,d2 | is a < b?
- bhi 3f | if b > a skip the following
- beq 4f | if d0==d2 check d1 and d3
-2: subl d3,d1 |
- subxl d2,d0 | a <-- a - b
- bset d5,d6 | set the corresponding bit in d6
-3: addl d1,d1 | shift a by 1
- addxl d0,d0 |
-#ifndef __mcf5200__
- dbra d5,1b | and branch back
-#else
- subql IMM (1), d5
- bpl 1b
-#endif
- bra 5f
-4: cmpl d1,d3 | here d0==d2, so check d1 and d3
- bhi 3b | if d1 > d2 skip the subtraction
- bra 2b | else go do it
-5:
-| Here we have to start setting the bits in the second long.
- movel IMM (31),d5 | again d5 is counter
-
-1: cmpl d0,d2 | is a < b?
- bhi 3f | if b > a skip the following
- beq 4f | if d0==d2 check d1 and d3
-2: subl d3,d1 |
- subxl d2,d0 | a <-- a - b
- bset d5,d7 | set the corresponding bit in d7
-3: addl d1,d1 | shift a by 1
- addxl d0,d0 |
-#ifndef __mcf5200__
- dbra d5,1b | and branch back
-#else
- subql IMM (1), d5
- bpl 1b
-#endif
- bra 5f
-4: cmpl d1,d3 | here d0==d2, so check d1 and d3
- bhi 3b | if d1 > d2 skip the subtraction
- bra 2b | else go do it
-5:
-| Now go ahead checking until we hit a one, which we store in d2.
- movel IMM (DBL_MANT_DIG),d5
-1: cmpl d2,d0 | is a < b?
- bhi 4f | if b < a, exit
- beq 3f | if d0==d2 check d1 and d3
-2: addl d1,d1 | shift a by 1
- addxl d0,d0 |
-#ifndef __mcf5200__
- dbra d5,1b | and branch back
-#else
- subql IMM (1), d5
- bpl 1b
-#endif
- movel IMM (0),d2 | here no sticky bit was found
- movel d2,d3
- bra 5f
-3: cmpl d1,d3 | here d0==d2, so check d1 and d3
- bhi 2b | if d1 > d2 go back
-4:
-| Here put the sticky bit in d2-d3 (in the position which actually corresponds
-| to it; if you don't do this the algorithm loses in some cases). '
- movel IMM (0),d2
- movel d2,d3
-#ifndef __mcf5200__
- subw IMM (DBL_MANT_DIG),d5
- addw IMM (63),d5
- cmpw IMM (31),d5
-#else
- subl IMM (DBL_MANT_DIG),d5
- addl IMM (63),d5
- cmpl IMM (31),d5
-#endif
- bhi 2f
-1: bset d5,d3
- bra 5f
-#ifndef __mcf5200__
- subw IMM (32),d5
-#else
- subl IMM (32),d5
-#endif
-2: bset d5,d2
-5:
-| Finally we are finished! Move the longs in the address registers to
-| their final destination:
- movel d6,d0
- movel d7,d1
- movel IMM (0),d3
-
-| Here we have finished the division, with the result in d0-d1-d2-d3, with
-| 2^21 <= d6 < 2^23. Thus bit 23 is not set, but bit 22 could be set.
-| If it is not, then definitely bit 21 is set. Normalize so bit 22 is
-| not set:
- btst IMM (DBL_MANT_DIG-32+1),d0
- beq 1f
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- roxrl IMM (1),d2
- roxrl IMM (1),d3
- addw IMM (1),d4
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
-1:
-| Now round, check for over- and underflow, and exit.
- movel a0,d7 | restore sign bit to d7
- movew IMM (DIVIDE),d5
- bra Lround$exit
-
-Ldivdf$inop:
- movew IMM (DIVIDE),d5
- bra Ld$inop
-
-Ldivdf$a$0:
-| If a is zero check to see whether b is zero also. In that case return
-| NaN; then check if b is NaN, and return NaN also in that case. Else
-| return zero.
- movew IMM (DIVIDE),d5
- bclr IMM (31),d2 |
- movel d2,d4 |
- orl d3,d4 |
- beq Ld$inop | if b is also zero return NaN
- cmpl IMM (0x7ff00000),d2 | check for NaN
- bhi Ld$inop |
- blt 1f |
- tstl d3 |
- bne Ld$inop |
-1: movel IMM (0),d0 | else return zero
- movel d0,d1 |
- lea SYM (_fpCCR),a0 | clear exception flags
- movew IMM (0),a0@ |
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 |
-#else
- moveml sp@,d2-d7 |
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 |
- rts |
-
-Ldivdf$b$0:
- movew IMM (DIVIDE),d5
-| If we got here a is not zero. Check if a is NaN; in that case return NaN,
-| else return +/-INFINITY. Remember that a is in d0 with the sign bit
-| cleared already.
- movel a0,d7 | put a's sign bit back in d7 '
- cmpl IMM (0x7ff00000),d0 | compare d0 with INFINITY
- bhi Ld$inop | if larger it is NaN
- tstl d1 |
- bne Ld$inop |
- bra Ld$div$0 | else signal DIVIDE_BY_ZERO
-
-Ldivdf$b$nf:
- movew IMM (DIVIDE),d5
-| If d2 == 0x7ff00000 we have to check d3.
- tstl d3 |
- bne Ld$inop | if d3 <> 0, b is NaN
- bra Ld$underflow | else b is +/-INFINITY, so signal underflow
-
-Ldivdf$a$nf:
- movew IMM (DIVIDE),d5
-| If d0 == 0x7ff00000 we have to check d1.
- tstl d1 |
- bne Ld$inop | if d1 <> 0, a is NaN
-| If a is INFINITY we have to check b
- cmpl d7,d2 | compare b with INFINITY
- bge Ld$inop | if b is NaN or INFINITY return NaN
- tstl d3 |
- bne Ld$inop |
- bra Ld$overflow | else return overflow
-
-| If a number is denormalized we put an exponent of 1 but do not put the
-| bit back into the fraction.
-Ldivdf$a$den:
- movel IMM (1),d4
- andl d6,d0
-1: addl d1,d1 | shift a left until bit 20 is set
- addxl d0,d0
-#ifndef __mcf5200__
- subw IMM (1),d4 | and adjust exponent
-#else
- subl IMM (1),d4 | and adjust exponent
-#endif
- btst IMM (DBL_MANT_DIG-32-1),d0
- bne Ldivdf$1
- bra 1b
-
-Ldivdf$b$den:
- movel IMM (1),d5
- andl d6,d2
-1: addl d3,d3 | shift b left until bit 20 is set
- addxl d2,d2
-#ifndef __mcf5200__
- subw IMM (1),d5 | and adjust exponent
-#else
- subql IMM (1),d5 | and adjust exponent
-#endif
- btst IMM (DBL_MANT_DIG-32-1),d2
- bne Ldivdf$2
- bra 1b
-
-Lround$exit:
-| This is a common exit point for __muldf3 and __divdf3. When they enter
-| this point the sign of the result is in d7, the result in d0-d1, normalized
-| so that 2^21 <= d0 < 2^22, and the exponent is in the lower byte of d4.
-
-| First check for underlow in the exponent:
-#ifndef __mcf5200__
- cmpw IMM (-DBL_MANT_DIG-1),d4
-#else
- cmpl IMM (-DBL_MANT_DIG-1),d4
-#endif
- blt Ld$underflow
-| It could happen that the exponent is less than 1, in which case the
-| number is denormalized. In this case we shift right and adjust the
-| exponent until it becomes 1 or the fraction is zero (in the latter case
-| we signal underflow and return zero).
- movel d7,a0 |
- movel IMM (0),d6 | use d6-d7 to collect bits flushed right
- movel d6,d7 | use d6-d7 to collect bits flushed right
-#ifndef __mcf5200__
- cmpw IMM (1),d4 | if the exponent is less than 1 we
-#else
- cmpl IMM (1),d4 | if the exponent is less than 1 we
-#endif
- bge 2f | have to shift right (denormalize)
-1:
-#ifndef __mcf5200__
- addw IMM (1),d4 | adjust the exponent
- lsrl IMM (1),d0 | shift right once
- roxrl IMM (1),d1 |
- roxrl IMM (1),d2 |
- roxrl IMM (1),d3 |
- roxrl IMM (1),d6 |
- roxrl IMM (1),d7 |
- cmpw IMM (1),d4 | is the exponent 1 already?
-#else
- addl IMM (1),d4 | adjust the exponent
- lsrl IMM (1),d7
- btst IMM (0),d6
- beq 13f
- bset IMM (31),d7
-13: lsrl IMM (1),d6
- btst IMM (0),d3
- beq 14f
- bset IMM (31),d6
-14: lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d2
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 12f
- bset IMM (31),d1
-12: lsrl IMM (1),d0
- cmpl IMM (1),d4 | is the exponent 1 already?
-#endif
- beq 2f | if not loop back
- bra 1b |
- bra Ld$underflow | safety check, shouldn't execute '
-2: orl d6,d2 | this is a trick so we don't lose '
- orl d7,d3 | the bits which were flushed right
- movel a0,d7 | get back sign bit into d7
-| Now call the rounding routine (which takes care of denormalized numbers):
- lea Lround$0,a0 | to return from rounding routine
- lea SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcf5200__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcf5200__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Lround$0:
-| Here we have a correctly rounded result (either normalized or denormalized).
-
-| Here we should have either a normalized number or a denormalized one, and
-| the exponent is necessarily larger or equal to 1 (so we don't have to '
-| check again for underflow!). We have to check for overflow or for a
-| denormalized number (which also signals underflow).
-| Check for overflow (i.e., exponent >= 0x7ff).
-#ifndef __mcf5200__
- cmpw IMM (0x07ff),d4
-#else
- cmpl IMM (0x07ff),d4
-#endif
- bge Ld$overflow
-| Now check for a denormalized number (exponent==0):
- movew d4,d4
- beq Ld$den
-1:
-| Put back the exponents and sign and return.
-#ifndef __mcf5200__
- lslw IMM (4),d4 | exponent back to fourth byte
-#else
- lsll IMM (4),d4 | exponent back to fourth byte
-#endif
- bclr IMM (DBL_MANT_DIG-32-1),d0
- swap d0 | and put back exponent
-#ifndef __mcf5200__
- orw d4,d0 |
-#else
- orl d4,d0 |
-#endif
- swap d0 |
- orl d7,d0 | and sign also
-
- lea SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcf5200__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-|=============================================================================
-| __negdf2
-|=============================================================================
-
-| double __negdf2(double, double);
-SYM (__negdf2):
-#ifndef __mcf5200__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movew IMM (NEGATE),d5
- movel a6@(8),d0 | get number to negate in d0-d1
- movel a6@(12),d1 |
- bchg IMM (31),d0 | negate
- movel d0,d2 | make a positive copy (for the tests)
- bclr IMM (31),d2 |
- movel d2,d4 | check for zero
- orl d1,d4 |
- beq 2f | if zero (either sign) return +zero
- cmpl IMM (0x7ff00000),d2 | compare to +INFINITY
- blt 1f | if finite, return
- bhi Ld$inop | if larger (fraction not zero) is NaN
- tstl d1 | if d2 == 0x7ff00000 check d1
- bne Ld$inop |
- movel d0,d7 | else get sign and return INFINITY
- andl IMM (0x80000000),d7
- bra Ld$infty
-1: lea SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcf5200__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-2: bclr IMM (31),d0
- bra 1b
-
-|=============================================================================
-| __cmpdf2
-|=============================================================================
-
-GREATER = 1
-LESS = -1
-EQUAL = 0
-
-| int __cmpdf2(double, double);
-SYM (__cmpdf2):
-#ifndef __mcf5200__
- link a6,IMM (0)
- moveml d2-d7,sp@- | save registers
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movew IMM (COMPARE),d5
- movel a6@(8),d0 | get first operand
- movel a6@(12),d1 |
- movel a6@(16),d2 | get second operand
- movel a6@(20),d3 |
-| First check if a and/or b are (+/-) zero and in that case clear
-| the sign bit.
- movel d0,d6 | copy signs into d6 (a) and d7(b)
- bclr IMM (31),d0 | and clear signs in d0 and d2
- movel d2,d7 |
- bclr IMM (31),d2 |
- cmpl IMM (0x7fff0000),d0 | check for a == NaN
- bhi Ld$inop | if d0 > 0x7ff00000, a is NaN
- beq Lcmpdf$a$nf | if equal can be INFINITY, so check d1
- movel d0,d4 | copy into d4 to test for zero
- orl d1,d4 |
- beq Lcmpdf$a$0 |
-Lcmpdf$0:
- cmpl IMM (0x7fff0000),d2 | check for b == NaN
- bhi Ld$inop | if d2 > 0x7ff00000, b is NaN
- beq Lcmpdf$b$nf | if equal can be INFINITY, so check d3
- movel d2,d4 |
- orl d3,d4 |
- beq Lcmpdf$b$0 |
-Lcmpdf$1:
-| Check the signs
- eorl d6,d7
- bpl 1f
-| If the signs are not equal check if a >= 0
- tstl d6
- bpl Lcmpdf$a$gt$b | if (a >= 0 && b < 0) => a > b
- bmi Lcmpdf$b$gt$a | if (a < 0 && b >= 0) => a < b
-1:
-| If the signs are equal check for < 0
- tstl d6
- bpl 1f
-| If both are negative exchange them
-#ifndef __mcf5200__
- exg d0,d2
- exg d1,d3
-#else
- movel d0,d7
- movel d2,d0
- movel d7,d2
- movel d1,d7
- movel d3,d1
- movel d7,d3
-#endif
-1:
-| Now that they are positive we just compare them as longs (does this also
-| work for denormalized numbers?).
- cmpl d0,d2
- bhi Lcmpdf$b$gt$a | |b| > |a|
- bne Lcmpdf$a$gt$b | |b| < |a|
-| If we got here d0 == d2, so we compare d1 and d3.
- cmpl d1,d3
- bhi Lcmpdf$b$gt$a | |b| > |a|
- bne Lcmpdf$a$gt$b | |b| < |a|
-| If we got here a == b.
- movel IMM (EQUAL),d0
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-Lcmpdf$a$gt$b:
- movel IMM (GREATER),d0
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-Lcmpdf$b$gt$a:
- movel IMM (LESS),d0
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-Lcmpdf$a$0:
- bclr IMM (31),d6
- bra Lcmpdf$0
-Lcmpdf$b$0:
- bclr IMM (31),d7
- bra Lcmpdf$1
-
-Lcmpdf$a$nf:
- tstl d1
- bne Ld$inop
- bra Lcmpdf$0
-
-Lcmpdf$b$nf:
- tstl d3
- bne Ld$inop
- bra Lcmpdf$1
-
-|=============================================================================
-| rounding routines
-|=============================================================================
-
-| The rounding routines expect the number to be normalized in registers
-| d0-d1-d2-d3, with the exponent in register d4. They assume that the
-| exponent is larger or equal to 1. They return a properly normalized number
-| if possible, and a denormalized number otherwise. The exponent is returned
-| in d4.
-
-Lround$to$nearest:
-| We now normalize as suggested by D. Knuth ("Seminumerical Algorithms"):
-| Here we assume that the exponent is not too small (this should be checked
-| before entering the rounding routine), but the number could be denormalized.
-
-| Check for denormalized numbers:
-1: btst IMM (DBL_MANT_DIG-32),d0
- bne 2f | if set the number is normalized
-| Normalize shifting left until bit #DBL_MANT_DIG-32 is set or the exponent
-| is one (remember that a denormalized number corresponds to an
-| exponent of -D_BIAS+1).
-#ifndef __mcf5200__
- cmpw IMM (1),d4 | remember that the exponent is at least one
-#else
- cmpl IMM (1),d4 | remember that the exponent is at least one
-#endif
- beq 2f | an exponent of one means denormalized
- addl d3,d3 | else shift and adjust the exponent
- addxl d2,d2 |
- addxl d1,d1 |
- addxl d0,d0 |
-#ifndef __mcf5200__
- dbra d4,1b |
-#else
- subql IMM (1), d4
- bpl 1b
-#endif
-2:
-| Now round: we do it as follows: after the shifting we can write the
-| fraction part as f + delta, where 1 < f < 2^25, and 0 <= delta <= 2.
-| If delta < 1, do nothing. If delta > 1, add 1 to f.
-| If delta == 1, we make sure the rounded number will be even (odd?)
-| (after shifting).
- btst IMM (0),d1 | is delta < 1?
- beq 2f | if so, do not do anything
- orl d2,d3 | is delta == 1?
- bne 1f | if so round to even
- movel d1,d3 |
- andl IMM (2),d3 | bit 1 is the last significant bit
- movel IMM (0),d2 |
- addl d3,d1 |
- addxl d2,d0 |
- bra 2f |
-1: movel IMM (1),d3 | else add 1
- movel IMM (0),d2 |
- addl d3,d1 |
- addxl d2,d0
-| Shift right once (because we used bit #DBL_MANT_DIG-32!).
-2:
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
-#endif
-
-| Now check again bit #DBL_MANT_DIG-32 (rounding could have produced a
-| 'fraction overflow' ...).
- btst IMM (DBL_MANT_DIG-32),d0
- beq 1f
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- addw IMM (1),d4
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- addl IMM (1),d4
-#endif
-1:
-| If bit #DBL_MANT_DIG-32-1 is clear we have a denormalized number, so we
-| have to put the exponent to zero and return a denormalized number.
- btst IMM (DBL_MANT_DIG-32-1),d0
- beq 1f
- jmp a0@
-1: movel IMM (0),d4
- jmp a0@
-
-Lround$to$zero:
-Lround$to$plus:
-Lround$to$minus:
- jmp a0@
-#endif /* L_double */
-
-#ifdef L_float
-
- .globl SYM (_fpCCR)
- .globl $_exception_handler
-
-QUIET_NaN = 0xffffffff
-SIGNL_NaN = 0x7f800001
-INFINITY = 0x7f800000
-
-F_MAX_EXP = 0xff
-F_BIAS = 126
-FLT_MAX_EXP = F_MAX_EXP - F_BIAS
-FLT_MIN_EXP = 1 - F_BIAS
-FLT_MANT_DIG = 24
-
-INEXACT_RESULT = 0x0001
-UNDERFLOW = 0x0002
-OVERFLOW = 0x0004
-DIVIDE_BY_ZERO = 0x0008
-INVALID_OPERATION = 0x0010
-
-SINGLE_FLOAT = 1
-
-NOOP = 0
-ADD = 1
-MULTIPLY = 2
-DIVIDE = 3
-NEGATE = 4
-COMPARE = 5
-EXTENDSFDF = 6
-TRUNCDFSF = 7
-
-UNKNOWN = -1
-ROUND_TO_NEAREST = 0 | round result to nearest representable value
-ROUND_TO_ZERO = 1 | round result towards zero
-ROUND_TO_PLUS = 2 | round result towards plus infinity
-ROUND_TO_MINUS = 3 | round result towards minus infinity
-
-| Entry points:
-
- .globl SYM (__addsf3)
- .globl SYM (__subsf3)
- .globl SYM (__mulsf3)
- .globl SYM (__divsf3)
- .globl SYM (__negsf2)
- .globl SYM (__cmpsf2)
-
-| These are common routines to return and signal exceptions.
-
- .text
- .even
-
-Lf$den:
-| Return and signal a denormalized number
- orl d7,d0
- movew IMM (INEXACT_RESULT+UNDERFLOW),d7
- moveq IMM (SINGLE_FLOAT),d6
- jmp $_exception_handler
-
-Lf$infty:
-Lf$overflow:
-| Return a properly signed INFINITY and set the exception flags
- movel IMM (INFINITY),d0
- orl d7,d0
- movew IMM (INEXACT_RESULT+OVERFLOW),d7
- moveq IMM (SINGLE_FLOAT),d6
- jmp $_exception_handler
-
-Lf$underflow:
-| Return 0 and set the exception flags
- movel IMM (0),d0
- movew IMM (INEXACT_RESULT+UNDERFLOW),d7
- moveq IMM (SINGLE_FLOAT),d6
- jmp $_exception_handler
-
-Lf$inop:
-| Return a quiet NaN and set the exception flags
- movel IMM (QUIET_NaN),d0
- movew IMM (INEXACT_RESULT+INVALID_OPERATION),d7
- moveq IMM (SINGLE_FLOAT),d6
- jmp $_exception_handler
-
-Lf$div$0:
-| Return a properly signed INFINITY and set the exception flags
- movel IMM (INFINITY),d0
- orl d7,d0
- movew IMM (INEXACT_RESULT+DIVIDE_BY_ZERO),d7
- moveq IMM (SINGLE_FLOAT),d6
- jmp $_exception_handler
-
-|=============================================================================
-|=============================================================================
-| single precision routines
-|=============================================================================
-|=============================================================================
-
-| A single precision floating point number (float) has the format:
-|
-| struct _float {
-| unsigned int sign : 1; /* sign bit */
-| unsigned int exponent : 8; /* exponent, shifted by 126 */
-| unsigned int fraction : 23; /* fraction */
-| } float;
-|
-| Thus sizeof(float) = 4 (32 bits).
-|
-| All the routines are callable from C programs, and return the result
-| in the single register d0. They also preserve all registers except
-| d0-d1 and a0-a1.
-
-|=============================================================================
-| __subsf3
-|=============================================================================
-
-| float __subsf3(float, float);
-SYM (__subsf3):
- bchg IMM (31),sp@(8) | change sign of second operand
- | and fall through
-|=============================================================================
-| __addsf3
-|=============================================================================
-
-| float __addsf3(float, float);
-SYM (__addsf3):
-#ifndef __mcf5200__
- link a6,IMM (0) | everything will be done in registers
- moveml d2-d7,sp@- | save all data registers but d0-d1
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get first operand
- movel a6@(12),d1 | get second operand
- movel d0,d6 | get d0's sign bit '
- addl d0,d0 | check and clear sign bit of a
- beq Laddsf$b | if zero return second operand
- movel d1,d7 | save b's sign bit '
- addl d1,d1 | get rid of sign bit
- beq Laddsf$a | if zero return first operand
-
- movel d6,a0 | save signs in address registers
- movel d7,a1 | so we can use d6 and d7
-
-| Get the exponents and check for denormalized and/or infinity.
-
- movel IMM (0x00ffffff),d4 | mask to get fraction
- movel IMM (0x01000000),d5 | mask to put hidden bit back
-
- movel d0,d6 | save a to get exponent
- andl d4,d0 | get fraction in d0
- notl d4 | make d4 into a mask for the exponent
- andl d4,d6 | get exponent in d6
- beq Laddsf$a$den | branch if a is denormalized
- cmpl d4,d6 | check for INFINITY or NaN
- beq Laddsf$nf
- swap d6 | put exponent into first word
- orl d5,d0 | and put hidden bit back
-Laddsf$1:
-| Now we have a's exponent in d6 (second byte) and the mantissa in d0. '
- movel d1,d7 | get exponent in d7
- andl d4,d7 |
- beq Laddsf$b$den | branch if b is denormalized
- cmpl d4,d7 | check for INFINITY or NaN
- beq Laddsf$nf
- swap d7 | put exponent into first word
- notl d4 | make d4 into a mask for the fraction
- andl d4,d1 | get fraction in d1
- orl d5,d1 | and put hidden bit back
-Laddsf$2:
-| Now we have b's exponent in d7 (second byte) and the mantissa in d1. '
-
-| Note that the hidden bit corresponds to bit #FLT_MANT_DIG-1, and we
-| shifted right once, so bit #FLT_MANT_DIG is set (so we have one extra
-| bit).
-
- movel d1,d2 | move b to d2, since we want to use
- | two registers to do the sum
- movel IMM (0),d1 | and clear the new ones
- movel d1,d3 |
-
-| Here we shift the numbers in registers d0 and d1 so the exponents are the
-| same, and put the largest exponent in d6. Note that we are using two
-| registers for each number (see the discussion by D. Knuth in "Seminumerical
-| Algorithms").
-#ifndef __mcf5200__
- cmpw d6,d7 | compare exponents
-#else
- cmpl d6,d7 | compare exponents
-#endif
- beq Laddsf$3 | if equal don't shift '
- bhi 5f | branch if second exponent largest
-1:
- subl d6,d7 | keep the largest exponent
- negl d7
-#ifndef __mcf5200__
- lsrw IMM (8),d7 | put difference in lower byte
-#else
- lsrl IMM (8),d7 | put difference in lower byte
-#endif
-| if difference is too large we don't shift (actually, we can just exit) '
-#ifndef __mcf5200__
- cmpw IMM (FLT_MANT_DIG+2),d7
-#else
- cmpl IMM (FLT_MANT_DIG+2),d7
-#endif
- bge Laddsf$b$small
-#ifndef __mcf5200__
- cmpw IMM (16),d7 | if difference >= 16 swap
-#else
- cmpl IMM (16),d7 | if difference >= 16 swap
-#endif
- bge 4f
-2:
-#ifndef __mcf5200__
- subw IMM (1),d7
-#else
- subql IMM (1), d7
-#endif
-3:
-#ifndef __mcf5200__
- lsrl IMM (1),d2 | shift right second operand
- roxrl IMM (1),d3
- dbra d7,3b
-#else
- lsrl IMM (1),d3
- btst IMM (0),d2
- beq 10f
- bset IMM (31),d3
-10: lsrl IMM (1),d2
- subql IMM (1), d7
- bpl 3b
-#endif
- bra Laddsf$3
-4:
- movew d2,d3
- swap d3
- movew d3,d2
- swap d2
-#ifndef __mcf5200__
- subw IMM (16),d7
-#else
- subl IMM (16),d7
-#endif
- bne 2b | if still more bits, go back to normal case
- bra Laddsf$3
-5:
-#ifndef __mcf5200__
- exg d6,d7 | exchange the exponents
-#else
- eorl d6,d7
- eorl d7,d6
- eorl d6,d7
-#endif
- subl d6,d7 | keep the largest exponent
- negl d7 |
-#ifndef __mcf5200__
- lsrw IMM (8),d7 | put difference in lower byte
-#else
- lsrl IMM (8),d7 | put difference in lower byte
-#endif
-| if difference is too large we don't shift (and exit!) '
-#ifndef __mcf5200__
- cmpw IMM (FLT_MANT_DIG+2),d7
-#else
- cmpl IMM (FLT_MANT_DIG+2),d7
-#endif
- bge Laddsf$a$small
-#ifndef __mcf5200__
- cmpw IMM (16),d7 | if difference >= 16 swap
-#else
- cmpl IMM (16),d7 | if difference >= 16 swap
-#endif
- bge 8f
-6:
-#ifndef __mcf5200__
- subw IMM (1),d7
-#else
- subl IMM (1),d7
-#endif
-7:
-#ifndef __mcf5200__
- lsrl IMM (1),d0 | shift right first operand
- roxrl IMM (1),d1
- dbra d7,7b
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- subql IMM (1),d7
- bpl 7b
-#endif
- bra Laddsf$3
-8:
- movew d0,d1
- swap d1
- movew d1,d0
- swap d0
-#ifndef __mcf5200__
- subw IMM (16),d7
-#else
- subl IMM (16),d7
-#endif
- bne 6b | if still more bits, go back to normal case
- | otherwise we fall through
-
-| Now we have a in d0-d1, b in d2-d3, and the largest exponent in d6 (the
-| signs are stored in a0 and a1).
-
-Laddsf$3:
-| Here we have to decide whether to add or subtract the numbers
-#ifndef __mcf5200__
- exg d6,a0 | get signs back
- exg d7,a1 | and save the exponents
-#else
- movel d6,d4
- movel a0,d6
- movel d4,d6
- movel d7,d4
- movel a1,d4
- movel d4,a1
-#endif
- eorl d6,d7 | combine sign bits
- bmi Lsubsf$0 | if negative a and b have opposite
- | sign so we actually subtract the
- | numbers
-
-| Here we have both positive or both negative
-#ifndef __mcf5200__
- exg d6,a0 | now we have the exponent in d6
-#else
- movel d6,d4
- movel a0,d6
- movel d4,a0
-#endif
- movel a0,d7 | and sign in d7
- andl IMM (0x80000000),d7
-| Here we do the addition.
- addl d3,d1
- addxl d2,d0
-| Note: now we have d2, d3, d4 and d5 to play with!
-
-| Put the exponent, in the first byte, in d2, to use the "standard" rounding
-| routines:
- movel d6,d2
-#ifndef __mcf5200__
- lsrw IMM (8),d2
-#else
- lsrl IMM (8),d2
-#endif
-
-| Before rounding normalize so bit #FLT_MANT_DIG is set (we will consider
-| the case of denormalized numbers in the rounding routine itself).
-| As in the addition (not in the subtraction!) we could have set
-| one more bit we check this:
- btst IMM (FLT_MANT_DIG+1),d0
- beq 1f
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
-#endif
- addl IMM (1),d2
-1:
- lea Laddsf$4,a0 | to return from rounding routine
- lea SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcf5200__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcf5200__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Laddsf$4:
-| Put back the exponent, but check for overflow.
-#ifndef __mcf5200__
- cmpw IMM (0xff),d2
-#else
- cmpl IMM (0xff),d2
-#endif
- bhi 1f
- bclr IMM (FLT_MANT_DIG-1),d0
-#ifndef __mcf5200__
- lslw IMM (7),d2
-#else
- lsll IMM (7),d2
-#endif
- swap d2
- orl d2,d0
- bra Laddsf$ret
-1:
- movew IMM (ADD),d5
- bra Lf$overflow
-
-Lsubsf$0:
-| We are here if a > 0 and b < 0 (sign bits cleared).
-| Here we do the subtraction.
- movel d6,d7 | put sign in d7
- andl IMM (0x80000000),d7
-
- subl d3,d1 | result in d0-d1
- subxl d2,d0 |
- beq Laddsf$ret | if zero just exit
- bpl 1f | if positive skip the following
- bchg IMM (31),d7 | change sign bit in d7
- negl d1
- negxl d0
-1:
-#ifndef __mcf5200__
- exg d2,a0 | now we have the exponent in d2
- lsrw IMM (8),d2 | put it in the first byte
-#else
- movel d2,d4
- movel a0,d2
- movel d4,a0
- lsrl IMM (8),d2 | put it in the first byte
-#endif
-
-| Now d0-d1 is positive and the sign bit is in d7.
-
-| Note that we do not have to normalize, since in the subtraction bit
-| #FLT_MANT_DIG+1 is never set, and denormalized numbers are handled by
-| the rounding routines themselves.
- lea Lsubsf$1,a0 | to return from rounding routine
- lea SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcf5200__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcf5200__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Lsubsf$1:
-| Put back the exponent (we can't have overflow!). '
- bclr IMM (FLT_MANT_DIG-1),d0
-#ifndef __mcf5200__
- lslw IMM (7),d2
-#else
- lsll IMM (7),d2
-#endif
- swap d2
- orl d2,d0
- bra Laddsf$ret
-
-| If one of the numbers was too small (difference of exponents >=
-| FLT_MANT_DIG+2) we return the other (and now we don't have to '
-| check for finiteness or zero).
-Laddsf$a$small:
- movel a6@(12),d0
- lea SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-Laddsf$b$small:
- movel a6@(8),d0
- lea SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-| If the numbers are denormalized remember to put exponent equal to 1.
-
-Laddsf$a$den:
- movel d5,d6 | d5 contains 0x01000000
- swap d6
- bra Laddsf$1
-
-Laddsf$b$den:
- movel d5,d7
- swap d7
- notl d4 | make d4 into a mask for the fraction
- | (this was not executed after the jump)
- bra Laddsf$2
-
-| The rest is mainly code for the different results which can be
-| returned (checking always for +/-INFINITY and NaN).
-
-Laddsf$b:
-| Return b (if a is zero).
- movel a6@(12),d0
- bra 1f
-Laddsf$a:
-| Return a (if b is zero).
- movel a6@(8),d0
-1:
- movew IMM (ADD),d5
-| We have to check for NaN and +/-infty.
- movel d0,d7
- andl IMM (0x80000000),d7 | put sign in d7
- bclr IMM (31),d0 | clear sign
- cmpl IMM (INFINITY),d0 | check for infty or NaN
- bge 2f
- movel d0,d0 | check for zero (we do this because we don't '
- bne Laddsf$ret | want to return -0 by mistake
- bclr IMM (31),d7 | if zero be sure to clear sign
- bra Laddsf$ret | if everything OK just return
-2:
-| The value to be returned is either +/-infty or NaN
- andl IMM (0x007fffff),d0 | check for NaN
- bne Lf$inop | if mantissa not zero is NaN
- bra Lf$infty
-
-Laddsf$ret:
-| Normal exit (a and b nonzero, result is not NaN nor +/-infty).
-| We have to clear the exception flags (just the exception type).
- lea SYM (_fpCCR),a0
- movew IMM (0),a0@
- orl d7,d0 | put sign bit
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | restore data registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 | and return
- rts
-
-Laddsf$ret$den:
-| Return a denormalized number (for addition we don't signal underflow) '
- lsrl IMM (1),d0 | remember to shift right back once
- bra Laddsf$ret | and return
-
-| Note: when adding two floats of the same sign if either one is
-| NaN we return NaN without regard to whether the other is finite or
-| not. When subtracting them (i.e., when adding two numbers of
-| opposite signs) things are more complicated: if both are INFINITY
-| we return NaN, if only one is INFINITY and the other is NaN we return
-| NaN, but if it is finite we return INFINITY with the corresponding sign.
-
-Laddsf$nf:
- movew IMM (ADD),d5
-| This could be faster but it is not worth the effort, since it is not
-| executed very often. We sacrifice speed for clarity here.
- movel a6@(8),d0 | get the numbers back (remember that we
- movel a6@(12),d1 | did some processing already)
- movel IMM (INFINITY),d4 | useful constant (INFINITY)
- movel d0,d2 | save sign bits
- movel d1,d3
- bclr IMM (31),d0 | clear sign bits
- bclr IMM (31),d1
-| We know that one of them is either NaN of +/-INFINITY
-| Check for NaN (if either one is NaN return NaN)
- cmpl d4,d0 | check first a (d0)
- bhi Lf$inop
- cmpl d4,d1 | check now b (d1)
- bhi Lf$inop
-| Now comes the check for +/-INFINITY. We know that both are (maybe not
-| finite) numbers, but we have to check if both are infinite whether we
-| are adding or subtracting them.
- eorl d3,d2 | to check sign bits
- bmi 1f
- movel d0,d7
- andl IMM (0x80000000),d7 | get (common) sign bit
- bra Lf$infty
-1:
-| We know one (or both) are infinite, so we test for equality between the
-| two numbers (if they are equal they have to be infinite both, so we
-| return NaN).
- cmpl d1,d0 | are both infinite?
- beq Lf$inop | if so return NaN
-
- movel d0,d7
- andl IMM (0x80000000),d7 | get a's sign bit '
- cmpl d4,d0 | test now for infinity
- beq Lf$infty | if a is INFINITY return with this sign
- bchg IMM (31),d7 | else we know b is INFINITY and has
- bra Lf$infty | the opposite sign
-
-|=============================================================================
-| __mulsf3
-|=============================================================================
-
-| float __mulsf3(float, float);
-SYM (__mulsf3):
-#ifndef __mcf5200__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get a into d0
- movel a6@(12),d1 | and b into d1
- movel d0,d7 | d7 will hold the sign of the product
- eorl d1,d7 |
- andl IMM (0x80000000),d7
- movel IMM (INFINITY),d6 | useful constant (+INFINITY)
- movel d6,d5 | another (mask for fraction)
- notl d5 |
- movel IMM (0x00800000),d4 | this is to put hidden bit back
- bclr IMM (31),d0 | get rid of a's sign bit '
- movel d0,d2 |
- beq Lmulsf$a$0 | branch if a is zero
- bclr IMM (31),d1 | get rid of b's sign bit '
- movel d1,d3 |
- beq Lmulsf$b$0 | branch if b is zero
- cmpl d6,d0 | is a big?
- bhi Lmulsf$inop | if a is NaN return NaN
- beq Lmulsf$inf | if a is INFINITY we have to check b
- cmpl d6,d1 | now compare b with INFINITY
- bhi Lmulsf$inop | is b NaN?
- beq Lmulsf$overflow | is b INFINITY?
-| Here we have both numbers finite and nonzero (and with no sign bit).
-| Now we get the exponents into d2 and d3.
- andl d6,d2 | and isolate exponent in d2
- beq Lmulsf$a$den | if exponent is zero we have a denormalized
- andl d5,d0 | and isolate fraction
- orl d4,d0 | and put hidden bit back
- swap d2 | I like exponents in the first byte
-#ifndef __mcf5200__
- lsrw IMM (7),d2 |
-#else
- lsrl IMM (7),d2 |
-#endif
-Lmulsf$1: | number
- andl d6,d3 |
- beq Lmulsf$b$den |
- andl d5,d1 |
- orl d4,d1 |
- swap d3 |
-#ifndef __mcf5200__
- lsrw IMM (7),d3 |
-#else
- lsrl IMM (7),d3 |
-#endif
-Lmulsf$2: |
-#ifndef __mcf5200__
- addw d3,d2 | add exponents
- subw IMM (F_BIAS+1),d2 | and subtract bias (plus one)
-#else
- addl d3,d2 | add exponents
- subl IMM (F_BIAS+1),d2 | and subtract bias (plus one)
-#endif
-
-| We are now ready to do the multiplication. The situation is as follows:
-| both a and b have bit FLT_MANT_DIG-1 set (even if they were
-| denormalized to start with!), which means that in the product
-| bit 2*(FLT_MANT_DIG-1) (that is, bit 2*FLT_MANT_DIG-2-32 of the
-| high long) is set.
-
-| To do the multiplication let us move the number a little bit around ...
- movel d1,d6 | second operand in d6
- movel d0,d5 | first operand in d4-d5
- movel IMM (0),d4
- movel d4,d1 | the sums will go in d0-d1
- movel d4,d0
-
-| now bit FLT_MANT_DIG-1 becomes bit 31:
- lsll IMM (31-FLT_MANT_DIG+1),d6
-
-| Start the loop (we loop #FLT_MANT_DIG times):
- movew IMM (FLT_MANT_DIG-1),d3
-1: addl d1,d1 | shift sum
- addxl d0,d0
- lsll IMM (1),d6 | get bit bn
- bcc 2f | if not set skip sum
- addl d5,d1 | add a
- addxl d4,d0
-2:
-#ifndef __mcf5200__
- dbf d3,1b | loop back
-#else
- subql IMM (1),d3
- bpl 1b
-#endif
-
-| Now we have the product in d0-d1, with bit (FLT_MANT_DIG - 1) + FLT_MANT_DIG
-| (mod 32) of d0 set. The first thing to do now is to normalize it so bit
-| FLT_MANT_DIG is set (to do the rounding).
-#ifndef __mcf5200__
- rorl IMM (6),d1
- swap d1
- movew d1,d3
- andw IMM (0x03ff),d3
- andw IMM (0xfd00),d1
-#else
- movel d1,d3
- lsll IMM (8),d1
- addl d1,d1
- addl d1,d1
- moveq IMM (22),d5
- lsrl d5,d3
- orl d3,d1
- andl IMM (0xfffffd00),d1
-#endif
- lsll IMM (8),d0
- addl d0,d0
- addl d0,d0
-#ifndef __mcf5200__
- orw d3,d0
-#else
- orl d3,d0
-#endif
-
- movew IMM (MULTIPLY),d5
-
- btst IMM (FLT_MANT_DIG+1),d0
- beq Lround$exit
-#ifndef __mcf5200__
- lsrl IMM (1),d0
- roxrl IMM (1),d1
- addw IMM (1),d2
-#else
- lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- addql IMM (1),d2
-#endif
- bra Lround$exit
-
-Lmulsf$inop:
- movew IMM (MULTIPLY),d5
- bra Lf$inop
-
-Lmulsf$overflow:
- movew IMM (MULTIPLY),d5
- bra Lf$overflow
-
-Lmulsf$inf:
- movew IMM (MULTIPLY),d5
-| If either is NaN return NaN; else both are (maybe infinite) numbers, so
-| return INFINITY with the correct sign (which is in d7).
- cmpl d6,d1 | is b NaN?
- bhi Lf$inop | if so return NaN
- bra Lf$overflow | else return +/-INFINITY
-
-| If either number is zero return zero, unless the other is +/-INFINITY,
-| or NaN, in which case we return NaN.
-Lmulsf$b$0:
-| Here d1 (==b) is zero.
- movel d1,d0 | put b into d0 (just a zero)
- movel a6@(8),d1 | get a again to check for non-finiteness
- bra 1f
-Lmulsf$a$0:
- movel a6@(12),d1 | get b again to check for non-finiteness
-1: bclr IMM (31),d1 | clear sign bit
- cmpl IMM (INFINITY),d1 | and check for a large exponent
- bge Lf$inop | if b is +/-INFINITY or NaN return NaN
- lea SYM (_fpCCR),a0 | else return zero
- movew IMM (0),a0@ |
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 |
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 |
- rts |
-
-| If a number is denormalized we put an exponent of 1 but do not put the
-| hidden bit back into the fraction; instead we shift left until bit 23
-| (the hidden bit) is set, adjusting the exponent accordingly. We do this
-| to ensure that the product of the fractions is close to 1.
-Lmulsf$a$den:
- movel IMM (1),d2
- andl d5,d0
-1: addl d0,d0 | shift a left (until bit 23 is set)
-#ifndef __mcf5200__
- subw IMM (1),d2 | and adjust exponent
-#else
- subql IMM (1),d2 | and adjust exponent
-#endif
- btst IMM (FLT_MANT_DIG-1),d0
- bne Lmulsf$1 |
- bra 1b | else loop back
-
-Lmulsf$b$den:
- movel IMM (1),d3
- andl d5,d1
-1: addl d1,d1 | shift b left until bit 23 is set
-#ifndef __mcf5200__
- subw IMM (1),d3 | and adjust exponent
-#else
- subl IMM (1),d3 | and adjust exponent
-#endif
- btst IMM (FLT_MANT_DIG-1),d1
- bne Lmulsf$2 |
- bra 1b | else loop back
-
-|=============================================================================
-| __divsf3
-|=============================================================================
-
-| float __divsf3(float, float);
-SYM (__divsf3):
-#ifndef __mcf5200__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movel a6@(8),d0 | get a into d0
- movel a6@(12),d1 | and b into d1
- movel d0,d7 | d7 will hold the sign of the result
- eorl d1,d7 |
- andl IMM (0x80000000),d7 |
- movel IMM (INFINITY),d6 | useful constant (+INFINITY)
- movel d6,d5 | another (mask for fraction)
- notl d5 |
- movel IMM (0x00800000),d4 | this is to put hidden bit back
- bclr IMM (31),d0 | get rid of a's sign bit '
- movel d0,d2 |
- beq Ldivsf$a$0 | branch if a is zero
- bclr IMM (31),d1 | get rid of b's sign bit '
- movel d1,d3 |
- beq Ldivsf$b$0 | branch if b is zero
- cmpl d6,d0 | is a big?
- bhi Ldivsf$inop | if a is NaN return NaN
- beq Ldivsf$inf | if a is INFINITY we have to check b
- cmpl d6,d1 | now compare b with INFINITY
- bhi Ldivsf$inop | if b is NaN return NaN
- beq Ldivsf$underflow
-| Here we have both numbers finite and nonzero (and with no sign bit).
-| Now we get the exponents into d2 and d3 and normalize the numbers to
-| ensure that the ratio of the fractions is close to 1. We do this by
-| making sure that bit #FLT_MANT_DIG-1 (hidden bit) is set.
- andl d6,d2 | and isolate exponent in d2
- beq Ldivsf$a$den | if exponent is zero we have a denormalized
- andl d5,d0 | and isolate fraction
- orl d4,d0 | and put hidden bit back
- swap d2 | I like exponents in the first byte
-#ifndef __mcf5200__
- lsrw IMM (7),d2 |
-#else
- lsrl IMM (7),d2 |
-#endif
-Ldivsf$1: |
- andl d6,d3 |
- beq Ldivsf$b$den |
- andl d5,d1 |
- orl d4,d1 |
- swap d3 |
-#ifndef __mcf5200__
- lsrw IMM (7),d3 |
-#else
- lsrl IMM (7),d3 |
-#endif
-Ldivsf$2: |
-#ifndef __mcf5200__
- subw d3,d2 | subtract exponents
- addw IMM (F_BIAS),d2 | and add bias
-#else
- subl d3,d2 | subtract exponents
- addl IMM (F_BIAS),d2 | and add bias
-#endif
-
-| We are now ready to do the division. We have prepared things in such a way
-| that the ratio of the fractions will be less than 2 but greater than 1/2.
-| At this point the registers in use are:
-| d0 holds a (first operand, bit FLT_MANT_DIG=0, bit FLT_MANT_DIG-1=1)
-| d1 holds b (second operand, bit FLT_MANT_DIG=1)
-| d2 holds the difference of the exponents, corrected by the bias
-| d7 holds the sign of the ratio
-| d4, d5, d6 hold some constants
- movel d7,a0 | d6-d7 will hold the ratio of the fractions
- movel IMM (0),d6 |
- movel d6,d7
-
- movew IMM (FLT_MANT_DIG+1),d3
-1: cmpl d0,d1 | is a < b?
- bhi 2f |
- bset d3,d6 | set a bit in d6
- subl d1,d0 | if a >= b a <-- a-b
- beq 3f | if a is zero, exit
-2: addl d0,d0 | multiply a by 2
-#ifndef __mcf5200__
- dbra d3,1b
-#else
- subql IMM (1),d3
- bpl 1b
-#endif
-
-| Now we keep going to set the sticky bit ...
- movew IMM (FLT_MANT_DIG),d3
-1: cmpl d0,d1
- ble 2f
- addl d0,d0
-#ifndef __mcf5200__
- dbra d3,1b
-#else
- subql IMM(1),d3
- bpl 1b
-#endif
- movel IMM (0),d1
- bra 3f
-2: movel IMM (0),d1
-#ifndef __mcf5200__
- subw IMM (FLT_MANT_DIG),d3
- addw IMM (31),d3
-#else
- subl IMM (FLT_MANT_DIG),d3
- addl IMM (31),d3
-#endif
- bset d3,d1
-3:
- movel d6,d0 | put the ratio in d0-d1
- movel a0,d7 | get sign back
-
-| Because of the normalization we did before we are guaranteed that
-| d0 is smaller than 2^26 but larger than 2^24. Thus bit 26 is not set,
-| bit 25 could be set, and if it is not set then bit 24 is necessarily set.
- btst IMM (FLT_MANT_DIG+1),d0
- beq 1f | if it is not set, then bit 24 is set
- lsrl IMM (1),d0 |
-#ifndef __mcf5200__
- addw IMM (1),d2 |
-#else
- addl IMM (1),d2 |
-#endif
-1:
-| Now round, check for over- and underflow, and exit.
- movew IMM (DIVIDE),d5
- bra Lround$exit
-
-Ldivsf$inop:
- movew IMM (DIVIDE),d5
- bra Lf$inop
-
-Ldivsf$overflow:
- movew IMM (DIVIDE),d5
- bra Lf$overflow
-
-Ldivsf$underflow:
- movew IMM (DIVIDE),d5
- bra Lf$underflow
-
-Ldivsf$a$0:
- movew IMM (DIVIDE),d5
-| If a is zero check to see whether b is zero also. In that case return
-| NaN; then check if b is NaN, and return NaN also in that case. Else
-| return zero.
- andl IMM (0x7fffffff),d1 | clear sign bit and test b
- beq Lf$inop | if b is also zero return NaN
- cmpl IMM (INFINITY),d1 | check for NaN
- bhi Lf$inop |
- movel IMM (0),d0 | else return zero
- lea SYM (_fpCCR),a0 |
- movew IMM (0),a0@ |
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 |
-#else
- moveml sp@,d2-d7 |
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6 |
- rts |
-
-Ldivsf$b$0:
- movew IMM (DIVIDE),d5
-| If we got here a is not zero. Check if a is NaN; in that case return NaN,
-| else return +/-INFINITY. Remember that a is in d0 with the sign bit
-| cleared already.
- cmpl IMM (INFINITY),d0 | compare d0 with INFINITY
- bhi Lf$inop | if larger it is NaN
- bra Lf$div$0 | else signal DIVIDE_BY_ZERO
-
-Ldivsf$inf:
- movew IMM (DIVIDE),d5
-| If a is INFINITY we have to check b
- cmpl IMM (INFINITY),d1 | compare b with INFINITY
- bge Lf$inop | if b is NaN or INFINITY return NaN
- bra Lf$overflow | else return overflow
-
-| If a number is denormalized we put an exponent of 1 but do not put the
-| bit back into the fraction.
-Ldivsf$a$den:
- movel IMM (1),d2
- andl d5,d0
-1: addl d0,d0 | shift a left until bit FLT_MANT_DIG-1 is set
-#ifndef __mcf5200__
- subw IMM (1),d2 | and adjust exponent
-#else
- subl IMM (1),d2 | and adjust exponent
-#endif
- btst IMM (FLT_MANT_DIG-1),d0
- bne Ldivsf$1
- bra 1b
-
-Ldivsf$b$den:
- movel IMM (1),d3
- andl d5,d1
-1: addl d1,d1 | shift b left until bit FLT_MANT_DIG is set
-#ifndef __mcf5200__
- subw IMM (1),d3 | and adjust exponent
-#else
- subl IMM (1),d3 | and adjust exponent
-#endif
- btst IMM (FLT_MANT_DIG-1),d1
- bne Ldivsf$2
- bra 1b
-
-Lround$exit:
-| This is a common exit point for __mulsf3 and __divsf3.
-
-| First check for underlow in the exponent:
-#ifndef __mcf5200__
- cmpw IMM (-FLT_MANT_DIG-1),d2
-#else
- cmpl IMM (-FLT_MANT_DIG-1),d2
-#endif
- blt Lf$underflow
-| It could happen that the exponent is less than 1, in which case the
-| number is denormalized. In this case we shift right and adjust the
-| exponent until it becomes 1 or the fraction is zero (in the latter case
-| we signal underflow and return zero).
- movel IMM (0),d6 | d6 is used temporarily
-#ifndef __mcf5200__
- cmpw IMM (1),d2 | if the exponent is less than 1 we
-#else
- cmpl IMM (1),d2 | if the exponent is less than 1 we
-#endif
- bge 2f | have to shift right (denormalize)
-1:
-#ifndef __mcf5200__
- addw IMM (1),d2 | adjust the exponent
- lsrl IMM (1),d0 | shift right once
- roxrl IMM (1),d1 |
- roxrl IMM (1),d6 | d6 collect bits we would lose otherwise
- cmpw IMM (1),d2 | is the exponent 1 already?
-#else
- addql IMM (1),d2 | adjust the exponent
- lsrl IMM (1),d6
- btst IMM (0),d1
- beq 11f
- bset IMM (31),d6
-11: lsrl IMM (1),d1
- btst IMM (0),d0
- beq 10f
- bset IMM (31),d1
-10: lsrl IMM (1),d0
- cmpl IMM (1),d2 | is the exponent 1 already?
-#endif
- beq 2f | if not loop back
- bra 1b |
- bra Lf$underflow | safety check, shouldn't execute '
-2: orl d6,d1 | this is a trick so we don't lose '
- | the extra bits which were flushed right
-| Now call the rounding routine (which takes care of denormalized numbers):
- lea Lround$0,a0 | to return from rounding routine
- lea SYM (_fpCCR),a1 | check the rounding mode
-#ifdef __mcf5200__
- clrl d6
-#endif
- movew a1@(6),d6 | rounding mode in d6
- beq Lround$to$nearest
-#ifndef __mcf5200__
- cmpw IMM (ROUND_TO_PLUS),d6
-#else
- cmpl IMM (ROUND_TO_PLUS),d6
-#endif
- bhi Lround$to$minus
- blt Lround$to$zero
- bra Lround$to$plus
-Lround$0:
-| Here we have a correctly rounded result (either normalized or denormalized).
-
-| Here we should have either a normalized number or a denormalized one, and
-| the exponent is necessarily larger or equal to 1 (so we don't have to '
-| check again for underflow!). We have to check for overflow or for a
-| denormalized number (which also signals underflow).
-| Check for overflow (i.e., exponent >= 255).
-#ifndef __mcf5200__
- cmpw IMM (0x00ff),d2
-#else
- cmpl IMM (0x00ff),d2
-#endif
- bge Lf$overflow
-| Now check for a denormalized number (exponent==0).
- movew d2,d2
- beq Lf$den
-1:
-| Put back the exponents and sign and return.
-#ifndef __mcf5200__
- lslw IMM (7),d2 | exponent back to fourth byte
-#else
- lsll IMM (7),d2 | exponent back to fourth byte
-#endif
- bclr IMM (FLT_MANT_DIG-1),d0
- swap d0 | and put back exponent
-#ifndef __mcf5200__
- orw d2,d0 |
-#else
- orl d2,d0
-#endif
- swap d0 |
- orl d7,d0 | and sign also
-
- lea SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcf5200__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-|=============================================================================
-| __negsf2
-|=============================================================================
-
-| This is trivial and could be shorter if we didn't bother checking for NaN '
-| and +/-INFINITY.
-
-| float __negsf2(float);
-SYM (__negsf2):
-#ifndef __mcf5200__
- link a6,IMM (0)
- moveml d2-d7,sp@-
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movew IMM (NEGATE),d5
- movel a6@(8),d0 | get number to negate in d0
- bchg IMM (31),d0 | negate
- movel d0,d1 | make a positive copy
- bclr IMM (31),d1 |
- tstl d1 | check for zero
- beq 2f | if zero (either sign) return +zero
- cmpl IMM (INFINITY),d1 | compare to +INFINITY
- blt 1f |
- bhi Lf$inop | if larger (fraction not zero) is NaN
- movel d0,d7 | else get sign and return INFINITY
- andl IMM (0x80000000),d7
- bra Lf$infty
-1: lea SYM (_fpCCR),a0
- movew IMM (0),a0@
-#ifndef __mcf5200__
- moveml sp@+,d2-d7
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-2: bclr IMM (31),d0
- bra 1b
-
-|=============================================================================
-| __cmpsf2
-|=============================================================================
-
-GREATER = 1
-LESS = -1
-EQUAL = 0
-
-| int __cmpsf2(float, float);
-SYM (__cmpsf2):
-#ifndef __mcf5200__
- link a6,IMM (0)
- moveml d2-d7,sp@- | save registers
-#else
- link a6,IMM (-24)
- moveml d2-d7,sp@
-#endif
- movew IMM (COMPARE),d5
- movel a6@(8),d0 | get first operand
- movel a6@(12),d1 | get second operand
-| Check if either is NaN, and in that case return garbage and signal
-| INVALID_OPERATION. Check also if either is zero, and clear the signs
-| if necessary.
- movel d0,d6
- andl IMM (0x7fffffff),d0
- beq Lcmpsf$a$0
- cmpl IMM (0x7f800000),d0
- bhi Lf$inop
-Lcmpsf$1:
- movel d1,d7
- andl IMM (0x7fffffff),d1
- beq Lcmpsf$b$0
- cmpl IMM (0x7f800000),d1
- bhi Lf$inop
-Lcmpsf$2:
-| Check the signs
- eorl d6,d7
- bpl 1f
-| If the signs are not equal check if a >= 0
- tstl d6
- bpl Lcmpsf$a$gt$b | if (a >= 0 && b < 0) => a > b
- bmi Lcmpsf$b$gt$a | if (a < 0 && b >= 0) => a < b
-1:
-| If the signs are equal check for < 0
- tstl d6
- bpl 1f
-| If both are negative exchange them
-#ifndef __mcf5200__
- exg d0,d1
-#else
- movel d0,d7
- movel d1,d0
- movel d7,d1
-#endif
-1:
-| Now that they are positive we just compare them as longs (does this also
-| work for denormalized numbers?).
- cmpl d0,d1
- bhi Lcmpsf$b$gt$a | |b| > |a|
- bne Lcmpsf$a$gt$b | |b| < |a|
-| If we got here a == b.
- movel IMM (EQUAL),d0
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
-#endif
- unlk a6
- rts
-Lcmpsf$a$gt$b:
- movel IMM (GREATER),d0
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-Lcmpsf$b$gt$a:
- movel IMM (LESS),d0
-#ifndef __mcf5200__
- moveml sp@+,d2-d7 | put back the registers
-#else
- moveml sp@,d2-d7
- | XXX if frame pointer is ever removed, stack pointer must
- | be adjusted here.
-#endif
- unlk a6
- rts
-
-Lcmpsf$a$0:
- bclr IMM (31),d6
- bra Lcmpsf$1
-Lcmpsf$b$0:
- bclr IMM (31),d7
- bra Lcmpsf$2
-
-|=============================================================================
-| rounding routines
-|=============================================================================
-
-| The rounding routines expect the number to be normalized in registers
-| d0-d1, with the exponent in register d2. They assume that the
-| exponent is larger or equal to 1. They return a properly normalized number
-| if possible, and a denormalized number otherwise. The exponent is returned
-| in d2.
-
-Lround$to$nearest:
-| We now normalize as suggested by D. Knuth ("Seminumerical Algorithms"):
-| Here we assume that the exponent is not too small (this should be checked
-| before entering the rounding routine), but the number could be denormalized.
-
-| Check for denormalized numbers:
-1: btst IMM (FLT_MANT_DIG),d0
- bne 2f | if set the number is normalized
-| Normalize shifting left until bit #FLT_MANT_DIG is set or the exponent
-| is one (remember that a denormalized number corresponds to an
-| exponent of -F_BIAS+1).
-#ifndef __mcf5200__
- cmpw IMM (1),d2 | remember that the exponent is at least one
-#else
- cmpl IMM (1),d2 | remember that the exponent is at least one
-#endif
- beq 2f | an exponent of one means denormalized
- addl d1,d1 | else shift and adjust the exponent
- addxl d0,d0 |
-#ifndef __mcf5200__
- dbra d2,1b |
-#else
- subql IMM (1),d2
- bpl 1b
-#endif
-2:
-| Now round: we do it as follows: after the shifting we can write the
-| fraction part as f + delta, where 1 < f < 2^25, and 0 <= delta <= 2.
-| If delta < 1, do nothing. If delta > 1, add 1 to f.
-| If delta == 1, we make sure the rounded number will be even (odd?)
-| (after shifting).
- btst IMM (0),d0 | is delta < 1?
- beq 2f | if so, do not do anything
- tstl d1 | is delta == 1?
- bne 1f | if so round to even
- movel d0,d1 |
- andl IMM (2),d1 | bit 1 is the last significant bit
- addl d1,d0 |
- bra 2f |
-1: movel IMM (1),d1 | else add 1
- addl d1,d0 |
-| Shift right once (because we used bit #FLT_MANT_DIG!).
-2: lsrl IMM (1),d0
-| Now check again bit #FLT_MANT_DIG (rounding could have produced a
-| 'fraction overflow' ...).
- btst IMM (FLT_MANT_DIG),d0
- beq 1f
- lsrl IMM (1),d0
-#ifndef __mcf5200__
- addw IMM (1),d2
-#else
- addql IMM (1),d2
-#endif
-1:
-| If bit #FLT_MANT_DIG-1 is clear we have a denormalized number, so we
-| have to put the exponent to zero and return a denormalized number.
- btst IMM (FLT_MANT_DIG-1),d0
- beq 1f
- jmp a0@
-1: movel IMM (0),d2
- jmp a0@
-
-Lround$to$zero:
-Lround$to$plus:
-Lround$to$minus:
- jmp a0@
-#endif /* L_float */
-
-| gcc expects the routines __eqdf2, __nedf2, __gtdf2, __gedf2,
-| __ledf2, __ltdf2 to all return the same value as a direct call to
-| __cmpdf2 would. In this implementation, each of these routines
-| simply calls __cmpdf2. It would be more efficient to give the
-| __cmpdf2 routine several names, but separating them out will make it
-| easier to write efficient versions of these routines someday.
-
-#ifdef L_eqdf2
- .text
- .proc
- .globl SYM (__eqdf2)
-SYM (__eqdf2):
- link a6,IMM (0)
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpdf2)
- unlk a6
- rts
-#endif /* L_eqdf2 */
-
-#ifdef L_nedf2
- .text
- .proc
- .globl SYM (__nedf2)
-SYM (__nedf2):
- link a6,IMM (0)
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpdf2)
- unlk a6
- rts
-#endif /* L_nedf2 */
-
-#ifdef L_gtdf2
- .text
- .proc
- .globl SYM (__gtdf2)
-SYM (__gtdf2):
- link a6,IMM (0)
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpdf2)
- unlk a6
- rts
-#endif /* L_gtdf2 */
-
-#ifdef L_gedf2
- .text
- .proc
- .globl SYM (__gedf2)
-SYM (__gedf2):
- link a6,IMM (0)
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpdf2)
- unlk a6
- rts
-#endif /* L_gedf2 */
-
-#ifdef L_ltdf2
- .text
- .proc
- .globl SYM (__ltdf2)
-SYM (__ltdf2):
- link a6,IMM (0)
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpdf2)
- unlk a6
- rts
-#endif /* L_ltdf2 */
-
-#ifdef L_ledf2
- .text
- .proc
- .globl SYM (__ledf2)
-SYM (__ledf2):
- link a6,IMM (0)
- movl a6@(20),sp@-
- movl a6@(16),sp@-
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpdf2)
- unlk a6
- rts
-#endif /* L_ledf2 */
-
-| The comments above about __eqdf2, et. al., also apply to __eqsf2,
-| et. al., except that the latter call __cmpsf2 rather than __cmpdf2.
-
-#ifdef L_eqsf2
- .text
- .proc
- .globl SYM (__eqsf2)
-SYM (__eqsf2):
- link a6,IMM (0)
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpsf2)
- unlk a6
- rts
-#endif /* L_eqsf2 */
-
-#ifdef L_nesf2
- .text
- .proc
- .globl SYM (__nesf2)
-SYM (__nesf2):
- link a6,IMM (0)
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpsf2)
- unlk a6
- rts
-#endif /* L_nesf2 */
-
-#ifdef L_gtsf2
- .text
- .proc
- .globl SYM (__gtsf2)
-SYM (__gtsf2):
- link a6,IMM (0)
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpsf2)
- unlk a6
- rts
-#endif /* L_gtsf2 */
-
-#ifdef L_gesf2
- .text
- .proc
- .globl SYM (__gesf2)
-SYM (__gesf2):
- link a6,IMM (0)
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpsf2)
- unlk a6
- rts
-#endif /* L_gesf2 */
-
-#ifdef L_ltsf2
- .text
- .proc
- .globl SYM (__ltsf2)
-SYM (__ltsf2):
- link a6,IMM (0)
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpsf2)
- unlk a6
- rts
-#endif /* L_ltsf2 */
-
-#ifdef L_lesf2
- .text
- .proc
- .globl SYM (__lesf2)
-SYM (__lesf2):
- link a6,IMM (0)
- movl a6@(12),sp@-
- movl a6@(8),sp@-
- jbsr SYM (__cmpsf2)
- unlk a6
- rts
-#endif /* L_lesf2 */
diff --git a/gcc/config/m68k/linux-aout.h b/gcc/config/m68k/linux-aout.h
deleted file mode 100644
index b21e76bf6a9..00000000000
--- a/gcc/config/m68k/linux-aout.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Definitions for Motorola m68k running Linux
- Copyright (C) 1995, 1996 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 1, 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 <m68k/m68k.h>
-#include <linux-aout.h>
-
-/* 68020 with 68881 */
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-
-#define DBX_DEBUGGING_INFO
-
-#define CPP_PREDEFINES \
- "-Dunix -Dmc68000 -Dmc68020 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(m68k) -Amachine(m68k)"
-
-#undef CPP_SPEC
-#if TARGET_DEFAULT & MASK_68881
-#define CPP_SPEC \
- "%{!msoft-float:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE}"
-#else
-#define CPP_SPEC \
- "%{m68881:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE}"
-#endif
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES {"ieee-fp", 0},
-
-#undef ASM_SPEC
-#define ASM_SPEC \
- "%{m68030} %{m68040} %{fpic:-k} %{fPIC:-k}"
-
-#undef LIB_SPEC
-#if 1
-/* We no longer link with libc_p.a or libg.a by default. If you want
- to profile or debug the Linux C library, please add -lc_p or -ggdb
- to LDFLAGS at the link time, respectively. */
-#define LIB_SPEC \
- "%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}"
-#else
-#define LIB_SPEC \
- "%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}"
-#endif
-
-/* We want to pass -v to linker */
-#undef LINK_SPEC
-#define LINK_SPEC "-m m68klinux %{v:-dll-verbose}"
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-
-/* Generate calls to memcpy, memcmp and memset. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler. */
-#undef PCC_STATIC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Allow folding division by zero. */
-#define REAL_INFINITY
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
deleted file mode 100644
index 10ef0e8be06..00000000000
--- a/gcc/config/m68k/linux.h
+++ /dev/null
@@ -1,387 +0,0 @@
-/* Definitions for Motorola 68k running Linux with ELF format.
- Copyright (C) 1995, 1996, 1997 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 1, 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. */
-
-#define LINUX_DEFAULT_ELF
-#define MOTOROLA /* Use Motorola syntax */
-#define USE_GAS /* But GAS wants jbsr instead of jsr */
-
-#include <m68k/m68k.h>
-#include <linux.h> /* some common stuff */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (68k Linux/ELF)");
-
-/* 68020 with 68881 */
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-
-/* for 68k machines this only needs to be TRUE for the 68000 */
-
-#undef STRICT_ALIGNMENT
-#define STRICT_ALIGNMENT 0
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES {"ieee-fp", 0},
-
-/* Here are four prefixes that are used by asm_fprintf to
- facilitate customization for alternate assembler syntaxes.
- Machines with no likelihood of an alternate syntax need not
- define these and need not use asm_fprintf. */
-
-/* The prefix for register names. Note that REGISTER_NAMES
- is supposed to include this prefix. Also note that this is NOT an
- fprintf format string, it is a literal string */
-
-#undef REGISTER_PREFIX
-#define REGISTER_PREFIX "%"
-
-/* The prefix for local (compiler generated) labels.
- These labels will not appear in the symbol table. */
-
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number.
- Motorola format uses different register names than defined in m68k.h. */
-
-#undef REGISTER_NAMES
-
-#ifndef SUPPORT_SUN_FPA
-
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" }
-
-#else /* SUPPORTED_SUN_FPA */
-
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", \
- "%fpa0", "%fpa1", "%fpa2", "%fpa3", "%fpa4", "%fpa5", "%fpa6", "%fpa7", \
- "%fpa8", "%fpa9", "%fpa10","%fpa11","%fpa12","%fpa13","%fpa14","%fpa15", \
- "%fpa16","%fpa17","%fpa18","%fpa19","%fpa20","%fpa21","%fpa22","%fpa23", \
- "%fpa24","%fpa25","%fpa26","%fpa27","%fpa28","%fpa29","%fpa30","%fpa31" }
-
-#endif /* defined SUPPORT_SUN_FPA */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#define CPP_PREDEFINES \
- "-D__ELF__ -Dunix -Dmc68000 -Dmc68020 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(m68k) -Amachine(m68k)"
-
-#undef CPP_SPEC
-#if TARGET_DEFAULT & MASK_68881
-#define CPP_SPEC \
- "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!msoft-float:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE}"
-#else
-#define CPP_SPEC \
- "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{m68881:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE}"
-#endif
-
-/* Provide a LINK_SPEC appropriate for Linux. Here we provide support
- for the special GCC options -static and -shared, which allow us to
- link things in one of these three modes by applying the appropriate
- combinations of options at link-time. We like to support here for
- as many of the other GNU linker options as possible. But I don't
- have the time to search for those flags. I am sure how to add
- support for -soname shared_object_name. H.J.
-
- I took out %{v:%{!V:-V}}. It is too much :-(. They can use
- -Wl,-V.
-
- When the -shared link option is used a final link is not being
- done. */
-
-/* If ELF is the default format, we should not use /lib/elf. */
-
-#undef LINK_SPEC
-#ifndef LINUX_DEFAULT_ELF
-#define LINK_SPEC "-m m68kelf %{shared} %{symbolic:-shared -Bsymbolic} \
- %{!shared:%{!symbolic: \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker*:-dynamic-linker /lib/elf/ld-linux.so.1} \
- %{!rpath*:-rpath /lib/elf/}} %{static}}}"
-#else
-#define LINK_SPEC "-m m68kelf %{shared} %{symbolic:-shared -Bsymbolic} \
- %{!shared:%{!symbolic: \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker*:-dynamic-linker /lib/ld-linux.so.1}} \
- %{static}}}"
-#endif
-
-/* For compatibility with linux/a.out */
-
-#undef PCC_BITFIELD_TYPE_MATTERS
-
-/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
- keep switch tables in the text section. */
-
-#define JUMP_TABLES_IN_TEXT_SECTION 1
-
-/* Use the default action for outputting the case label. */
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_RETURN_CASE_JUMP \
- do { \
- if (TARGET_5200) \
- return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
- else \
- return "jmp %%pc@(2,%0:w)"; \
- } while (0)
-
-/* This is how to output an assembler line that says to advance the
- location counter to a multiple of 2**LOG bytes. */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) > 0) \
- fprintf ((FILE), "\t%s \t%u\n", ALIGN_ASM_OP, 1 << (LOG));
-
-/* If defined, a C expression whose value is a string containing the
- assembler operation to identify the following data as uninitialized global
- data. */
-
-#define BSS_SECTION_ASM_OP ".section\t.bss"
-
-/* A C statement (sans semicolon) to output to the stdio stream
- FILE the assembler definition of uninitialized global DECL named
- NAME whose size is SIZE bytes and alignment is ALIGN bytes.
- Try to use asm_output_aligned_bss to implement this macro. */
-
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
- asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO)); \
- if (flag_pic) \
- fprintf (FILE, "\tbsr.l _mcount@PLTPC\n"); \
- else \
- fprintf (FILE, "\tjbsr _mcount\n"); \
-}
-
-/* Register in which address to store a structure value is passed to a
- function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */
-
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE_REGNUM 8
-
-/* Register in which static-chain is passed to a function. The
- default in m68k.h is a0, but that is already the struct value
- regnum. Make it a1 instead. */
-
-#undef STATIC_CHAIN_REGNUM
-#define STATIC_CHAIN_REGNUM 9
-
-/* How to renumber registers for dbx and gdb.
- On the Sun-3, the floating point registers have numbers
- 18 to 25, not 16 to 23 as they do in the compiler. */
-
-#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
-
-/* Do not break .stabs pseudos into continuations. */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* Allow folding division by zero. */
-#define REAL_INFINITY
-
-/* 1 if N is a possible register number for a function value. For
- m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
- pointer, or floating types, respectively. Reject fp0 if not using
- a 68881 coprocessor. */
-
-#undef FUNCTION_VALUE_REGNO_P
-#define FUNCTION_VALUE_REGNO_P(N) \
- ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
-
-/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
- more than one register. */
-
-#undef NEEDS_UNTYPED_CALL
-#define NEEDS_UNTYPED_CALL 1
-
-/* Define how to generate (in the callee) the output value of a
- function and how to find (in the caller) the value returned by a
- function. VALTYPE is the data type of the value (as a tree). If
- the precise function being called is known, FUNC is its
- FUNCTION_DECL; otherwise, FUNC is 0. For m68k/SVR4 generate the
- result in d0, a0, or fp0 as appropriate. */
-
-#undef FUNCTION_VALUE
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
- : (POINTER_TYPE_P (VALTYPE) \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
- : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
-
-/* For compatibility with the large body of existing code which does
- not always properly declare external functions returning pointer
- types, the m68k/SVR4 convention is to copy the value returned for
- pointer functions from a0 to d0 in the function epilogue, so that
- callers that have neglected to properly declare the callee can
- still find the correct return value. */
-
-extern int current_function_returns_pointer;
-#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
-do { \
- if ((current_function_returns_pointer) && \
- ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
- asm_fprintf (FILE, "\tmove.l %Ra0,%Rd0\n"); \
-} while (0);
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE.
- For m68k/SVR4 look for integer values in d0, pointer values in d0
- (returned in both d0 and a0), and floating values in fp0. */
-
-#undef LIBCALL_VALUE
-#define LIBCALL_VALUE(MODE) \
- ((((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode) \
- && TARGET_68881) \
- ? gen_rtx (REG, (MODE), 16) \
- : gen_rtx (REG, (MODE), 0))
-
-/* In m68k svr4, a symbol_ref rtx can be a valid PIC operand if it is
- an operand of a function call. */
-#undef LEGITIMATE_PIC_OPERAND_P
-#define LEGITIMATE_PIC_OPERAND_P(X) \
- ((! symbolic_operand (X, VOIDmode) \
- && ! (GET_CODE (X) == CONST_DOUBLE && CONST_DOUBLE_MEM (X) \
- && GET_CODE (CONST_DOUBLE_MEM (X)) == MEM \
- && symbolic_operand (XEXP (CONST_DOUBLE_MEM (X), 0), VOIDmode))) \
- || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)))
-
-/* Turn off function cse if we are doing PIC. We always want function
- call to be done as `bsr foo@PLTPC', so it will force the assembler
- to create the PLT entry for `foo'. Doing function cse will cause
- the address of `foo' to be loaded into a register, which is exactly
- what we want to avoid when we are doing PIC on svr4 m68k. */
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
- if (flag_pic) flag_no_function_cse = 1;
-
-/* For m68k SVR4, structures are returned using the reentrant
- technique. */
-#undef PCC_STATIC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-/* This is different from the generic version in that we use a1 as the
- static call chain. */
-
-#undef INITIALIZE_TRAMPOLINE
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, HImode, TRAMP), GEN_INT (0x227C)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 2)), CXT); \
- emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 6)), \
- GEN_INT (0x4EF9)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 8)), FNADDR); \
- FINALIZE_TRAMPOLINE (TRAMP); \
-}
-
-/* Finalize the trampoline by flushing the insn cache. */
-
-#undef FINALIZE_TRAMPOLINE
-#define FINALIZE_TRAMPOLINE(TRAMP) \
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__clear_cache"), \
- 0, VOIDmode, 2, TRAMP, Pmode, \
- plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode);
-
-/* Clear the instruction cache from `beg' to `end'. This makes an
- inline system call to SYS_cacheflush. The arguments are as
- follows:
-
- cacheflush (addr, scope, cache, len)
-
- addr - the start address for the flush
- scope - the scope of the flush (see the cpush insn)
- cache - which cache to flush (see the cpush insn)
- len - a factor relating to the number of flushes to perform:
- len/16 lines, or len/4096 pages. */
-
-#define CLEAR_INSN_CACHE(BEG, END) \
-{ \
- register unsigned long _beg __asm ("%d1") = (unsigned long) (BEG); \
- unsigned long _end = (unsigned long) (END); \
- register unsigned long _len __asm ("%d4") = (_end - _beg + 32); \
- __asm __volatile \
- ("move%.l %#123, %/d0\n\t" /* system call nr */ \
- "move%.l %#1, %/d2\n\t" /* clear lines */ \
- "move%.l %#3, %/d3\n\t" /* insn+data caches */ \
- "trap %#0" \
- : /* no outputs */ \
- : "d" (_beg), "d" (_len) \
- : "%d0", "%d2", "%d3"); \
-}
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
- Used for C++ multiple inheritance. */
-#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
-do { \
- if (DELTA > 0 && DELTA <= 8) \
- asm_fprintf (FILE, "\taddq.l %I%d,4(%Rsp)\n", DELTA); \
- else if (DELTA < 0 && DELTA >= -8) \
- asm_fprintf (FILE, "\tsubq.l %I%d,4(%Rsp)\n", -DELTA); \
- else \
- asm_fprintf (FILE, "\tadd.l %I%d,4(%Rsp)\n", DELTA); \
- \
- if (flag_pic) \
- { \
- fprintf (FILE, "\tbra.l "); \
- assemble_name \
- (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
- fprintf (FILE, "@PLTPC\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tjmp "); \
- assemble_name \
- (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
- fprintf (FILE, "\n"); \
- } \
-} while (0)
diff --git a/gcc/config/m68k/lynx-ng.h b/gcc/config/m68k/lynx-ng.h
deleted file mode 100644
index ac3afac938e..00000000000
--- a/gcc/config/m68k/lynx-ng.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Definitions for Motorola 680x0 running LynxOS, using Lynx's old as and ld.
- Copyright (C) 1993, 1995, 1996 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. */
-
-#include <m68k/m68k.h>
-#include <m68k/coff.h>
-#include <lynx-ng.h>
-
-/* See m68k.h. 7 means 68020 with 68881. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-#endif
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dmc68000 -DM68K -DLynx -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(m68k) -Amachine(m68k)"
-
-/* Provide required defaults for linker switches. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "-P1000 %{msystem-v:-V} %{mcoff:-k}"
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
diff --git a/gcc/config/m68k/lynx.h b/gcc/config/m68k/lynx.h
deleted file mode 100644
index 8c54b8bc13f..00000000000
--- a/gcc/config/m68k/lynx.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Definitions for Motorola 680x0 running LynxOS.
- Copyright (C) 1993, 1994, 1995, 1996 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. */
-
-#include <m68k/m68k.h>
-#include <m68k/coff.h>
-
-#undef CTORS_SECTION_ASM_OP
-#undef DTORS_SECTION_ASM_OP
-#undef ASM_OUTPUT_DESTRUCTOR
-#undef SELECT_RTX_SECTION
-
-#define BSS_SECTION_ASM_OP ".bss"
-
-#define ASM_LONG ".long"
-
-#include <lynx.h>
-
-/* See m68k.h. 7 means 68020 with 68881. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-#endif
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dmc68000 -DM68K -DLynx -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(m68k) -Amachine(m68k)"
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* Lynx uses d2 and d3 as scratch registers. */
-#undef CALL_USED_REGISTERS
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 0, 0, 0, 0, \
- 1, 1, 0, 0, 0, 0, 0, 1, \
- 1, 1, 0, 0, 0, 0, 0, 0 }
-
-/* Return floating point values in a fp register. This make fp code a
- little bit faster. It also makes -msoft-float code incompatible with
- -m68881 code, so people have to be careful not to mix the two. */
-#undef FUNCTION_VALUE
-#define FUNCTION_VALUE(VALTYPE,FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
-
-#undef LIBCALL_VALUE
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, (MODE), \
- ((TARGET_68881 \
- && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
- ? 16 : 0))
-
-#undef FUNCTION_VALUE_REGNO_P
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (TARGET_68881 && (N) == 16))
-
-#undef NEEDS_UNTYPED_CALL
-#define NEEDS_UNTYPED_CALL 1
diff --git a/gcc/config/m68k/m68k-aout.h b/gcc/config/m68k/m68k-aout.h
deleted file mode 100644
index b65f9fefcd1..00000000000
--- a/gcc/config/m68k/m68k-aout.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Definitions of target machine for GNU compiler. "naked" 68020,
- a.out object files and debugging, version.
- Copyright (C) 1994, 1996 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 comment is here to see if it will keep Sun's cpp from dying. */
-
-#include "m68k/m68k-none.h"
-#include "m68k/m68kemb.h"
-#include "aoutos.h"
-
-#define DBX_DEBUGGING_INFO
-#undef SDB_DEBUGGING_INFO
-
-/* If defined, a C expression whose value is a string containing the
- assembler operation to identify the following data as uninitialized global
- data. */
-#define BSS_SECTION_ASM_OP "\t.bss"
-
-/* A C statement (sans semicolon) to output to the stdio stream
- FILE the assembler definition of uninitialized global DECL named
- NAME whose size is SIZE bytes. The variable ROUNDED
- is the size rounded up to whatever alignment the caller wants.
- Try to use asm_output_bss to implement this macro. */
-/* a.out files typically can't handle arbitrary variable alignments so
- define ASM_OUTPUT_BSS instead of ASM_OUTPUT_ALIGNED_BSS. */
-#define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
- asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
diff --git a/gcc/config/m68k/m68k-coff.h b/gcc/config/m68k/m68k-coff.h
deleted file mode 100644
index 085dd95ce32..00000000000
--- a/gcc/config/m68k/m68k-coff.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Definitions of target machine for GNU compiler. "naked" 68020,
- COFF object files and debugging, version.
- Copyright (C) 1994 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. */
-
-#define MOTOROLA /* Use Motorola syntax rather than MIT. */
-
-#include "m68k/m68k-none.h"
-#include "m68k/m68kemb.h"
-#include "m68k/coff.h"
-
-/* end of m68k-coff.h */
diff --git a/gcc/config/m68k/m68k-none.h b/gcc/config/m68k/m68k-none.h
deleted file mode 100644
index 5ee2498ffff..00000000000
--- a/gcc/config/m68k/m68k-none.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/* Definitions of target machine for GNU compiler. "naked" 68020.
- Copyright (C) 1994, 1996 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. */
-
-#include "m68k/m68k.h"
-
-/* Default to m68k (m68020). */
-#ifndef TARGET_CPU_DEFAULT
-#define TARGET_CPU_DEFAULT M68K_CPU_m68k
-#endif
-
-/* These are values set by the configure script in TARGET_CPU_DEFAULT.
- They are ((desired value for TARGET_DEFAULT) << 4) + sequential integer.
- See m68k.h for the values (it should really define MASK_FOO so we can
- use them). */
-#define M68K_CPU_m68k ((7 << 4) + 0)
-#define M68K_CPU_m68000 ((0 << 4) + 1)
-#define M68K_CPU_m68010 ((0 << 4) + 1) /* make same as m68000 */
-#define M68K_CPU_m68020 ((7 << 4) + 2)
-#define M68K_CPU_m68030 ((7 << 4) + 3)
-#define M68K_CPU_m68040 ((01007 << 4) + 4)
-#define M68K_CPU_m68302 ((0 << 4) + 5)
-#define M68K_CPU_m68332 ((1 << 4) + 6)
-
-/* This is tested for below, so if target wants to override this, it
- just set this first in cover file. */
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (TARGET_CPU_DEFAULT >> 4)
-#endif
-
-/* Defaults for the various specs below.
- These are collected here so we only test TARGET_CPU_DEFAULT once. */
-/* ??? CC1_CPU_DEFAULT_SPEC was copied over from the earlier version of
- this file. However, it's not used anywhere here because it doesn't
- seem to be necessary. */
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68k || TARGET_CPU_DEFAULT == M68K_CPU_m68020
-#define CPP_CPU_DEFAULT_SPEC "%{!ansi:-Dmc68020 } -D__mc68020 -D__mc68020__"
-#define ASM_CPU_DEFAULT_SPEC "-mc68020"
-#define CC1_CPU_DEFAULT_SPEC "-m68020"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68000
-#define CPP_CPU_DEFAULT_SPEC "%{!ansi:-Dmc68000 } -D__mc68000 -D__mc68000__"
-#define ASM_CPU_DEFAULT_SPEC "-mc68000"
-#define CC1_CPU_DEFAULT_SPEC "-m68000"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68030
-#define CPP_CPU_DEFAULT_SPEC "%{!ansi:-Dmc68030 } -D__mc68030 -D__mc68030__"
-#define ASM_CPU_DEFAULT_SPEC "-mc68030"
-#define CC1_CPU_DEFAULT_SPEC "-m68030"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68040
-#define CPP_CPU_DEFAULT_SPEC "%{!ansi:-Dmc68040 } -D__mc68040 -D__mc68040__"
-#define ASM_CPU_DEFAULT_SPEC "-mc68040"
-#define CC1_CPU_DEFAULT_SPEC "-m68040"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68302
-#define CPP_CPU_DEFAULT_SPEC "%{!ansi:-Dmc68302 } -D__mc68302 -D__mc68302__"
-#define ASM_CPU_DEFAULT_SPEC "-mc68302"
-#define CC1_CPU_DEFAULT_SPEC "-m68000"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68332
-#define CPP_CPU_DEFAULT_SPEC "%{!ansi:-Dmc68332 } -D__mc68332 -D__mc68332__"
-#define ASM_CPU_DEFAULT_SPEC "-mc68332"
-#define CC1_CPU_DEFAULT_SPEC "-m68020 -mnobitfield %{!m68881:-msoft-float}"
-#else
-Unrecognized value in TARGET_CPU_DEFAULT.
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-
-/* Always define mc68000.
- Remember that GCC will automatically add __mc68000 and __mc68000__. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmc68000"
-
-/* Define one of __HAVE_68881__, __HAVE_FPA__, or nothing (soft float), appropriately. */
-#undef CPP_FPU_SPEC
-#if TARGET_DEFAULT & MASK_68881
-/* ??? Why isn't m68302 treated like m68000 here? */
-#define CPP_FPU_SPEC \
-"%{!mc68000:%{!m68000:%{!m68332:%{!m5200:%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}}}}}"
-#else
-/* This can't currently happen, but we code it anyway to show how it's done. */
-#if TARGET_DEFAULT & MASK_FPA
-#define CPP_FPU_SPEC \
-"%{!msoft-float:%{m68881:-D__HAVE_68881__ }%{!m68881:-D__HAVE_FPA__ }}"
-#else
-#define CPP_FPU_SPEC \
-"%{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }"
-#endif
-#endif
-
-/* Names to predefine in the preprocessor for this target machine.
- Other definitions depend on what the default cpu is and switches
- given to the compiler:
-
- -m68000, -mc68000: define nothing else
- -m68010: define mc68010
- -m68020, -mc68020: define mc68020
- -m68030: define mc68030
- -m68040: define mc68040
- -m68060: define mc68060
- -m68020-40: define mc68020 mc68030 mc68040
- -m68302: define mc68302
- -m68332: define mc68332
- -m5200: define mcf5200
- default: define as above appropriately
-
- GCC won't automatically add __'d versions, we have to mention them
- explicitly. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "\
-%(cpp_fpu) \
-%{!ansi:%{m68010:-Dmc68010 }%{m68020:-Dmc68020 }%{mc68020:-Dmc68020 }%{m68030:-Dmc68030 }%{m68040:-Dmc68040 }%{m68020-40:-Dmc68020 -Dmc68030 -Dmc68040 }%{m68060:-Dmc68060 }%{m68302:-Dmc68302 }%{m68332:-Dmc68332 }%{m5200:-Dmcf5200 }} \
-%{m68010:-D__mc68010__ -D__mc68010 }%{m68020:-D__mc68020__ -D__mc68020 }%{mc68020:-D__mc68020__ -D__mc68020 }%{m68030:-D__mc68030__ -D__mc68030 }%{m68040:-D__mc68040__ -D__mc68040 }%{m68020-40:-D__mc68020__ -D__mc68030__ -D__mc68040__ -D__mc68020 -D__mc68030 -D__mc68040 }%{mc68060:-D__mc68060__ -D__mc68060 }%{m68302:-D__mc68302__ -D__mc68302 }%{m68332:-D__mc68332__ -D__mc68332 }%{m5200:-D__mcf5200__ -D__mcf5200 } \
-%{!mc68000:%{!m68000:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68060:%{!m68302:%{!m68332:%{!m5200:%(cpp_cpu_default)}}}}}}}}}}}} \
-%(cpp_subtarget) \
-"
-
-/* Pass flags to gas indicating which type of processor we have. */
-
-#undef ASM_SPEC
-#define ASM_SPEC "\
-%{m68851}%{mno-68851}%{m68881}%{mno-68881}%{msoft-float:-mno-68881 } \
-%{m68000}%{mc68000}%{m68010}%{m68020}%{mc68020}%{m68030}%{m68040}%{m68020-40:-mc68040}%{m68060}%{m68302}%{m68332}%{m5200} \
-%{!mc68000:%{!m68000:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68060:%{!m68302:%{!m68332:%{!m5200:%(asm_cpu_default)}}}}}}}}}}}} \
-"
-
-#undef CC1_SPEC
-#define CC1_SPEC "\
-%{m68000:%{!m68881:-msoft-float }}%{m68302:-m68000 }%{m68332:-m68020 -mnobitfield %{!m68881:-msoft-float }} \
-"
-/* ??? Is this needed?
-%{!m68000:%{!mc68000:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68302:%{!m68332:%(cc1_cpu_default)}}}}}}}}}}
-*/
-
-/* This macro defines names of additional specifications to put in the specs
- that can be used in various specifications like CC1_SPEC. Its definition
- is an initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- specification name, and a string constant that used by the GNU CC driver
- program.
-
- Do not define this macro if it does not need to do anything. */
-
-#define EXTRA_SPECS \
- { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \
- { "cpp_fpu", CPP_FPU_SPEC }, \
- { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
- { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
-/*{ "cc1_cpu_default", CC1_CPU_DEFAULT__SPEC },*/ \
- SUBTARGET_EXTRA_SPECS
-
-#define CPP_SUBTARGET_SPEC ""
-#define SUBTARGET_EXTRA_SPECS
-
-/* Avoid building multilib libraries for the defaults.
- t-m68kbare doesn't support -mfpa in the multilib'd libraries, so we don't
- either.
- For targets not handled here, just build the full set of multilibs.
- The default is m68k 99.9% of the time anyway. */
-
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68k || TARGET_CPU_DEFAULT == M68K_CPU_m68020
-#if TARGET_DEFAULT & MASK_68881
-#define MULTILIB_DEFAULTS { "m68020", "m68881" }
-#else
-#define MULTILIB_DEFAULTS { "m68020", "msoft-float" }
-#endif
-#endif
-
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68000 || TARGET_CPU_DEFAULT == M68K_CPU_m68302
-#if TARGET_DEFAULT & MASK_68881
-#define MULTILIB_DEFAULTS { "m68000", "m68881" }
-#else
-#define MULTILIB_DEFAULTS { "m68000", "msoft-float" }
-#endif
-#endif
diff --git a/gcc/config/m68k/m68k-psos.h b/gcc/config/m68k/m68k-psos.h
deleted file mode 100644
index 8e5b843397e..00000000000
--- a/gcc/config/m68k/m68k-psos.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Definitions of a target machine for the GNU compiler:
- 68040 running pSOS, ELF object files, DBX debugging.
- Copyright (C) 1996 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. */
-
-
-/* Use MOTOROLA assembler syntax, as gas is configured that way and
- glibc also seems to use it. Must come BEFORE m68k.h! */
-
-#define MOTOROLA
-
-/* Get generic m68k definitions. */
-
-#include "m68k/m68k.h"
-#include "m68k/m68kemb.h"
-
-/* Default processor type is a (pure) 68040 with 68881 emulation using
- the floating-point support package. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_68040_ONLY|MASK_BITFIELD|MASK_68881|MASK_68020)
-
-/* Options passed to CPP, GAS, CC1 and CC1PLUS. We override
- m68k-none.h for consistency with TARGET_DEFAULT. */
-
-#undef CPP_SPEC
-#define CPP_SPEC \
-"%{!mc68000:%{!m68000:%{!m68332:%{!msoft-float:-D__HAVE_68881__ }}}}\
-%{!ansi:-Dmc68000 %{m68010:-Dmc68010 }%{m68020:-Dmc68020 }%{mc68020:-Dmc68020 }%{m68030:-Dmc68030 }%{m68040:-Dmc68040 }%{m68020-40:-Dmc68020 -Dmc68030 -Dmc68040 }%{m68302:-Dmc68302 }%{m68332:-Dmc68332 }%{!mc68000:%{!m68000:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68302:%{!m68332:-Dmc68040 }}}}}}}}}}}\
--D__mc68000__ -D__mc68000 %{m68010:-D__mc68010__ -D__mc68010 }%{m68020:-D__mc68020__ -D__mc68020 }%{mc68020:-D__mc68020__ -D__mc68020 }%{m68030:-D__mc68030__ -D__mc68030 }%{m68040:-D__mc68040__ -D__mc68040 }%{m68020-40:-D__mc68020__ -D__mc68030__ -D__mc68040__ -D__mc68020 -D__mc68030 -D__mc68040 }%{m68302:-D__mc68302__ -D__mc68302 }%{m68332:-D__mc68332__ -D__mc68332 }%{!mc68000:%{!m68000:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68302:%{!m68332:-D__mc68040__ -D__mc68040 }}}}}}}}}}"
-
-#undef ASM_SPEC
-#define ASM_SPEC \
-"%{m68851}%{mno-68851}%{m68881}%{mno-68881}%{msoft-float:-mno-68881 }\
-%{m68000}%{mc68000}%{m68010}%{m68020}%{mc68020}%{m68030}%{m68040}%{m68020-40:-mc68040}%{m68302}%{m68332}%{!m68000:%{!mc68000:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68302:%{!m68332:-mc68040}}}}}}}}}}"
-
-#undef CC1_SPEC
-#define CC1_SPEC \
- "%{m68000:%{!m68881:-msoft-float }}%{m68302:-m68000}%{m68332:-m68020 -mnobitfield %{!m68881:-msoft-float}}%{!m68000:%{!mc68000:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68302:%{!m68332:-m68040}}}}}}}}}}"
-
-#undef CC1PLUS_SPEC
-#define CC1PLUS_SPEC \
- "%{m68000:%{!m68881:-msoft-float }}%{m68302:-m68000}%{m68332:-m68020 -mnobitfield %{!m68881:-msoft-float}}%{!m68000:%{!mc68000:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68302:%{!m68332:-m68040}}}}}}}}}}"
-
-
-/* Get processor-independent pSOS definitions. */
-
-#include "psos.h"
-
-
-/* end of m68k-psos.h */
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
deleted file mode 100644
index 59b931525e1..00000000000
--- a/gcc/config/m68k/m68k.c
+++ /dev/null
@@ -1,3017 +0,0 @@
-/* Subroutines for insn-output.c for Motorola 68000 family.
- Copyright (C) 1987, 93, 94, 95, 96, 1997 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. */
-
-
-/* Some output-actions in m68k.md need these. */
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-
-/* Needed for use_return_insn. */
-#include "flags.h"
-
-#ifdef SUPPORT_SUN_FPA
-
-/* Index into this array by (register number >> 3) to find the
- smallest class which contains that register. */
-enum reg_class regno_reg_class[]
- = { DATA_REGS, ADDR_REGS, FP_REGS,
- LO_FPA_REGS, LO_FPA_REGS, FPA_REGS, FPA_REGS };
-
-#endif /* defined SUPPORT_SUN_FPA */
-
-/* This flag is used to communicate between movhi and ASM_OUTPUT_CASE_END,
- if SGS_SWITCH_TABLE. */
-int switch_table_difference_label_flag;
-
-static rtx find_addr_reg ();
-rtx legitimize_pic_address ();
-
-
-/* Alignment to use for loops and jumps */
-/* Specify power of two alignment used for loops. */
-char *m68k_align_loops_string;
-/* Specify power of two alignment used for non-loop jumps. */
-char *m68k_align_jumps_string;
-/* Specify power of two alignment used for functions. */
-char *m68k_align_funcs_string;
-
-/* Specify power of two alignment used for loops. */
-int m68k_align_loops;
-/* Specify power of two alignment used for non-loop jumps. */
-int m68k_align_jumps;
-/* Specify power of two alignment used for functions. */
-int m68k_align_funcs;
-
-/* Nonzero if the last compare/test insn had FP operands. The
- sCC expanders peek at this to determine what to do for the
- 68060, which has no fsCC instructions. */
-int m68k_last_compare_had_fp_operands;
-
-/* Sometimes certain combinations of command options do not make
- sense on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed.
-
- Don't use this macro to turn on various extra optimizations for
- `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
-
-void
-override_options ()
-{
- int def_align;
-
- def_align = 1;
-
- /* Validate -malign-loops= value, or provide default */
- if (m68k_align_loops_string)
- {
- m68k_align_loops = atoi (m68k_align_loops_string);
- if (m68k_align_loops < 1 || m68k_align_loops > MAX_CODE_ALIGN)
- fatal ("-malign-loops=%d is not between 1 and %d",
- m68k_align_loops, MAX_CODE_ALIGN);
- }
- else
- m68k_align_loops = def_align;
-
- /* Validate -malign-jumps= value, or provide default */
- if (m68k_align_jumps_string)
- {
- m68k_align_jumps = atoi (m68k_align_jumps_string);
- if (m68k_align_jumps < 1 || m68k_align_jumps > MAX_CODE_ALIGN)
- fatal ("-malign-jumps=%d is not between 1 and %d",
- m68k_align_jumps, MAX_CODE_ALIGN);
- }
- else
- m68k_align_jumps = def_align;
-
- /* Validate -malign-functions= value, or provide default */
- if (m68k_align_funcs_string)
- {
- m68k_align_funcs = atoi (m68k_align_funcs_string);
- if (m68k_align_funcs < 1 || m68k_align_funcs > MAX_CODE_ALIGN)
- fatal ("-malign-functions=%d is not between 1 and %d",
- m68k_align_funcs, MAX_CODE_ALIGN);
- }
- else
- m68k_align_funcs = def_align;
-}
-
-/* Emit a (use pic_offset_table_rtx) if we used PIC relocation in the
- function at any time during the compilation process. In the future
- we should try and eliminate the USE if we can easily determine that
- all PIC references were deleted from the current function. That would
- save an address register */
-
-void
-finalize_pic ()
-{
- if (flag_pic && current_function_uses_pic_offset_table)
- {
- rtx insn = gen_rtx (USE, VOIDmode, pic_offset_table_rtx);
- emit_insn_after (insn, get_insns ());
- emit_insn (insn);
- }
-}
-
-
-/* This function generates the assembly code for function entry.
- STREAM is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This function is responsible for
- knowing which registers should not be saved even if used. */
-
-
-/* Note that the order of the bit mask for fmovem is the opposite
- of the order for movem! */
-
-
-void
-output_function_prologue (stream, size)
- FILE *stream;
- int size;
-{
- register int regno;
- register int mask = 0;
- int num_saved_regs = 0;
- extern char call_used_regs[];
- int fsize = (size + 3) & -4;
-
-
- if (frame_pointer_needed)
- {
- if (fsize == 0 && TARGET_68040)
- {
- /* on the 68040, pea + move is faster than link.w 0 */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tpea (%s)\n\tmove.l %s,%s\n",
- reg_names[FRAME_POINTER_REGNUM], reg_names[STACK_POINTER_REGNUM],
- reg_names[FRAME_POINTER_REGNUM]);
-#else
- asm_fprintf (stream, "\tpea %s@\n\tmovel %s,%s\n",
- reg_names[FRAME_POINTER_REGNUM], reg_names[STACK_POINTER_REGNUM],
- reg_names[FRAME_POINTER_REGNUM]);
-#endif
- }
- else if (fsize < 0x8000)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tlink.w %s,%0I%d\n",
- reg_names[FRAME_POINTER_REGNUM], -fsize);
-#else
- asm_fprintf (stream, "\tlink %s,%0I%d\n",
- reg_names[FRAME_POINTER_REGNUM], -fsize);
-#endif
- }
- else if (TARGET_68020)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tlink.l %s,%0I%d\n",
- reg_names[FRAME_POINTER_REGNUM], -fsize);
-#else
- asm_fprintf (stream, "\tlink %s,%0I%d\n",
- reg_names[FRAME_POINTER_REGNUM], -fsize);
-#endif
- }
- else
- {
- /* Adding negative number is faster on the 68040. */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tlink.w %s,%0I0\n\tadd.l %0I%d,%Rsp\n",
- reg_names[FRAME_POINTER_REGNUM], -fsize);
-#else
- asm_fprintf (stream, "\tlink %s,%0I0\n\taddl %0I%d,%Rsp\n",
- reg_names[FRAME_POINTER_REGNUM], -fsize);
-#endif
- }
- }
- else if (fsize)
- {
- if (fsize + 4 < 0x8000)
- {
-#ifdef NO_ADDSUB_Q
- if (fsize + 4 <= 8)
- {
- if (!TARGET_5200)
- {
- /* asm_fprintf() cannot handle %. */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tsubq.w %OI%d,%Rsp\n", fsize + 4);
-#else
- asm_fprintf (stream, "\tsubqw %OI%d,%Rsp\n", fsize + 4);
-#endif
- }
- else
- {
- /* asm_fprintf() cannot handle %. */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tsubq.l %OI%d,%Rsp\n", fsize + 4);
-#else
- asm_fprintf (stream, "\tsubql %OI%d,%Rsp\n", fsize + 4);
-#endif
- }
- }
- else if (fsize + 4 <= 16 && TARGET_CPU32)
- {
- /* On the CPU32 it is faster to use two subqw instructions to
- subtract a small integer (8 < N <= 16) to a register. */
- /* asm_fprintf() cannot handle %. */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tsubq.w %OI8,%Rsp\n\tsubq.w %OI%d,%Rsp\n",
- fsize + 4);
-#else
- asm_fprintf (stream, "\tsubqw %OI8,%Rsp\n\tsubqw %OI%d,%Rsp\n",
- fsize + 4);
-#endif
- }
- else
-#endif /* NO_ADDSUB_Q */
- if (TARGET_68040)
- {
- /* Adding negative number is faster on the 68040. */
- /* asm_fprintf() cannot handle %. */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tadd.w %0I%d,%Rsp\n", - (fsize + 4));
-#else
- asm_fprintf (stream, "\taddw %0I%d,%Rsp\n", - (fsize + 4));
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", - (fsize + 4));
-#else
- asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", - (fsize + 4));
-#endif
- }
- }
- else
- {
- /* asm_fprintf() cannot handle %. */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tadd.l %0I%d,%Rsp\n", - (fsize + 4));
-#else
- asm_fprintf (stream, "\taddl %0I%d,%Rsp\n", - (fsize + 4));
-#endif
- }
- }
-#ifdef SUPPORT_SUN_FPA
- for (regno = 24; regno < 56; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tfpmovd %s,-(%Rsp)\n",
- reg_names[regno]);
-#else
- asm_fprintf (stream, "\tfpmoved %s,%Rsp@-\n",
- reg_names[regno]);
-#endif
- }
-#endif
- if (TARGET_68881)
- {
- for (regno = 16; regno < 24; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- mask |= 1 << (regno - 16);
- if ((mask & 0xff) != 0)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tfmovm %0I0x%x,-(%Rsp)\n", mask & 0xff);
-#else
- asm_fprintf (stream, "\tfmovem %0I0x%x,%Rsp@-\n", mask & 0xff);
-#endif
- }
- mask = 0;
- }
- for (regno = 0; regno < 16; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- {
- mask |= 1 << (15 - regno);
- num_saved_regs++;
- }
- if (frame_pointer_needed)
- {
- mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM));
- num_saved_regs--;
- }
-
-#if NEED_PROBE
-#ifdef MOTOROLA
-#ifdef CRDS
- asm_fprintf (stream, "\ttstl %d(%Rsp)\n", NEED_PROBE - num_saved_regs * 4);
-#else
- asm_fprintf (stream, "\ttst.l %d(%Rsp)\n", NEED_PROBE - num_saved_regs * 4);
-#endif
-#else
- asm_fprintf (stream, "\ttstl %Rsp@(%d)\n", NEED_PROBE - num_saved_regs * 4);
-#endif
-#endif
-
- if (num_saved_regs <= 2)
- {
- /* Store each separately in the same order moveml uses.
- Using two movel instructions instead of a single moveml
- is about 15% faster for the 68020 and 68030 at no expense
- in code size */
-
- int i;
-
- /* Undo the work from above. */
- for (i = 0; i< 16; i++)
- if (mask & (1 << i))
- asm_fprintf (stream,
-#ifdef MOTOROLA
- "\t%Omove.l %s,-(%Rsp)\n",
-#else
- "\tmovel %s,%Rsp@-\n",
-#endif
- reg_names[15 - i]);
- }
- else if (mask)
- {
- if (TARGET_5200)
- {
- /* The coldfire does not support the predecrement form of the
- movml instruction, so we must adjust the stack pointer and
- then use the plain address register indirect mode. We also
- have to invert the register save mask to use the new mode.
-
- FIXME: if num_saved_regs was calculated earlier, we could
- combine the stack pointer adjustment with any adjustment
- done when the initial stack frame is created. This would
- save an instruction */
-
- int newmask = 0;
- int i;
-
- for (i = 0; i < 16; i++)
- if (mask & (1 << i))
- newmask |= (1 << (15-i));
-
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", -num_saved_regs*4);
- asm_fprintf (stream, "\tmovm.l %0I0x%x,(%Rsp)\n", newmask);
-#else
- asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", -num_saved_regs*4);
- asm_fprintf (stream, "\tmoveml %0I0x%x,%Rsp@\n", newmask);
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tmovm.l %0I0x%x,-(%Rsp)\n", mask);
-#else
- asm_fprintf (stream, "\tmoveml %0I0x%x,%Rsp@-\n", mask);
-#endif
- }
- }
- if (flag_pic && current_function_uses_pic_offset_table)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\t%Olea (%Rpc, %U_GLOBAL_OFFSET_TABLE_@GOTPC), %s\n",
- reg_names[PIC_OFFSET_TABLE_REGNUM]);
-#else
- asm_fprintf (stream, "\tmovel %0I__GLOBAL_OFFSET_TABLE_, %s\n",
- reg_names[PIC_OFFSET_TABLE_REGNUM]);
- asm_fprintf (stream, "\tlea %Rpc@(0,%s:l),%s\n",
- reg_names[PIC_OFFSET_TABLE_REGNUM],
- reg_names[PIC_OFFSET_TABLE_REGNUM]);
-#endif
- }
-}
-
-/* Return true if this function's epilogue can be output as RTL. */
-
-int
-use_return_insn ()
-{
- int regno;
-
- if (!reload_completed || frame_pointer_needed || get_frame_size () != 0)
- return 0;
-
- /* Copied from output_function_epilogue (). We should probably create a
- separate layout routine to perform the common work. */
-
- for (regno = 0 ; regno < FIRST_PSEUDO_REGISTER ; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- return 0;
-
- return 1;
-}
-
-/* This function generates the assembly code for function exit,
- on machines that need it. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only, if there is a frame pointer.
- This is mandatory because of alloca; we also take advantage of it to
- omit stack adjustments before returning. */
-
-void
-output_function_epilogue (stream, size)
- FILE *stream;
- int size;
-{
- register int regno;
- register int mask, fmask;
- register int nregs;
- int offset, foffset, fpoffset;
- extern char call_used_regs[];
- int fsize = (size + 3) & -4;
- int big = 0;
- rtx insn = get_last_insn ();
- int restore_from_sp = 0;
-
- /* If the last insn was a BARRIER, we don't have to write any code. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
- if (insn && GET_CODE (insn) == BARRIER)
- {
- /* Output just a no-op so that debuggers don't get confused
- about which function the pc is in at this address. */
- asm_fprintf (stream, "\tnop\n");
- return;
- }
-
-#ifdef FUNCTION_BLOCK_PROFILER_EXIT
- if (profile_block_flag == 2)
- {
- FUNCTION_BLOCK_PROFILER_EXIT (stream);
- }
-#endif
-
-#ifdef FUNCTION_EXTRA_EPILOGUE
- FUNCTION_EXTRA_EPILOGUE (stream, size);
-#endif
- nregs = 0; fmask = 0; fpoffset = 0;
-#ifdef SUPPORT_SUN_FPA
- for (regno = 24 ; regno < 56 ; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- nregs++;
- fpoffset = nregs * 8;
-#endif
- nregs = 0;
- if (TARGET_68881)
- {
- for (regno = 16; regno < 24; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- {
- nregs++;
- fmask |= 1 << (23 - regno);
- }
- }
- foffset = fpoffset + nregs * 12;
- nregs = 0; mask = 0;
- if (frame_pointer_needed)
- regs_ever_live[FRAME_POINTER_REGNUM] = 0;
- for (regno = 0; regno < 16; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- {
- nregs++;
- mask |= 1 << regno;
- }
- offset = foffset + nregs * 4;
- /* FIXME : leaf_function_p below is too strong.
- What we really need to know there is if there could be pending
- stack adjustment needed at that point. */
- restore_from_sp = ! frame_pointer_needed
- || (! current_function_calls_alloca && leaf_function_p ());
- if (offset + fsize >= 0x8000
- && ! restore_from_sp
- && (mask || fmask || fpoffset))
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\t%Omove.l %0I%d,%Ra1\n", -fsize);
-#else
- asm_fprintf (stream, "\tmovel %0I%d,%Ra1\n", -fsize);
-#endif
- fsize = 0, big = 1;
- }
- if (TARGET_5200 || nregs <= 2)
- {
- /* Restore each separately in the same order moveml does.
- Using two movel instructions instead of a single moveml
- is about 15% faster for the 68020 and 68030 at no expense
- in code size. */
-
- int i;
-
- /* Undo the work from above. */
- for (i = 0; i< 16; i++)
- if (mask & (1 << i))
- {
- if (big)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\t%Omove.l -%d(%s,%Ra1.l),%s\n",
- offset + fsize,
- reg_names[FRAME_POINTER_REGNUM],
- reg_names[i]);
-#else
- asm_fprintf (stream, "\tmovel %s@(-%d,%Ra1:l),%s\n",
- reg_names[FRAME_POINTER_REGNUM],
- offset + fsize, reg_names[i]);
-#endif
- }
- else if (restore_from_sp)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\t%Omove.l (%Rsp)+,%s\n",
- reg_names[i]);
-#else
- asm_fprintf (stream, "\tmovel %Rsp@+,%s\n",
- reg_names[i]);
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\t%Omove.l -%d(%s),%s\n",
- offset + fsize,
- reg_names[FRAME_POINTER_REGNUM],
- reg_names[i]);
-#else
- asm_fprintf (stream, "\tmovel %s@(-%d),%s\n",
- reg_names[FRAME_POINTER_REGNUM],
- offset + fsize, reg_names[i]);
-#endif
- }
- offset = offset - 4;
- }
- }
- else if (mask)
- {
- if (big)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tmovm.l -%d(%s,%Ra1.l),%0I0x%x\n",
- offset + fsize,
- reg_names[FRAME_POINTER_REGNUM],
- mask);
-#else
- asm_fprintf (stream, "\tmoveml %s@(-%d,%Ra1:l),%0I0x%x\n",
- reg_names[FRAME_POINTER_REGNUM],
- offset + fsize, mask);
-#endif
- }
- else if (restore_from_sp)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tmovm.l (%Rsp)+,%0I0x%x\n", mask);
-#else
- asm_fprintf (stream, "\tmoveml %Rsp@+,%0I0x%x\n", mask);
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tmovm.l -%d(%s),%0I0x%x\n",
- offset + fsize,
- reg_names[FRAME_POINTER_REGNUM],
- mask);
-#else
- asm_fprintf (stream, "\tmoveml %s@(-%d),%0I0x%x\n",
- reg_names[FRAME_POINTER_REGNUM],
- offset + fsize, mask);
-#endif
- }
- }
- if (fmask)
- {
- if (big)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tfmovm -%d(%s,%Ra1.l),%0I0x%x\n",
- foffset + fsize,
- reg_names[FRAME_POINTER_REGNUM],
- fmask);
-#else
- asm_fprintf (stream, "\tfmovem %s@(-%d,%Ra1:l),%0I0x%x\n",
- reg_names[FRAME_POINTER_REGNUM],
- foffset + fsize, fmask);
-#endif
- }
- else if (restore_from_sp)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tfmovm (%Rsp)+,%0I0x%x\n", fmask);
-#else
- asm_fprintf (stream, "\tfmovem %Rsp@+,%0I0x%x\n", fmask);
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tfmovm -%d(%s),%0I0x%x\n",
- foffset + fsize,
- reg_names[FRAME_POINTER_REGNUM],
- fmask);
-#else
- asm_fprintf (stream, "\tfmovem %s@(-%d),%0I0x%x\n",
- reg_names[FRAME_POINTER_REGNUM],
- foffset + fsize, fmask);
-#endif
- }
- }
- if (fpoffset != 0)
- for (regno = 55; regno >= 24; regno--)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- {
- if (big)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tfpmovd -%d(%s,%Ra1.l), %s\n",
- fpoffset + fsize,
- reg_names[FRAME_POINTER_REGNUM],
- reg_names[regno]);
-#else
- asm_fprintf (stream, "\tfpmoved %s@(-%d,%Ra1:l), %s\n",
- reg_names[FRAME_POINTER_REGNUM],
- fpoffset + fsize, reg_names[regno]);
-#endif
- }
- else if (restore_from_sp)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tfpmovd (%Rsp)+,%s\n",
- reg_names[regno]);
-#else
- asm_fprintf (stream, "\tfpmoved %Rsp@+, %s\n",
- reg_names[regno]);
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tfpmovd -%d(%s), %s\n",
- fpoffset + fsize,
- reg_names[FRAME_POINTER_REGNUM],
- reg_names[regno]);
-#else
- asm_fprintf (stream, "\tfpmoved %s@(-%d), %s\n",
- reg_names[FRAME_POINTER_REGNUM],
- fpoffset + fsize, reg_names[regno]);
-#endif
- }
- fpoffset -= 8;
- }
- if (frame_pointer_needed)
- fprintf (stream, "\tunlk %s\n",
- reg_names[FRAME_POINTER_REGNUM]);
- else if (fsize)
- {
-#ifdef NO_ADDSUB_Q
- if (fsize + 4 <= 8)
- {
- if (!TARGET_5200)
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\taddq.w %OI%d,%Rsp\n", fsize + 4);
-#else
- asm_fprintf (stream, "\taddqw %OI%d,%Rsp\n", fsize + 4);
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\taddq.l %OI%d,%Rsp\n", fsize + 4);
-#else
- asm_fprintf (stream, "\taddql %OI%d,%Rsp\n", fsize + 4);
-#endif
- }
- }
- else if (fsize + 4 <= 16 && TARGET_CPU32)
- {
- /* On the CPU32 it is faster to use two addqw instructions to
- add a small integer (8 < N <= 16) to a register. */
- /* asm_fprintf() cannot handle %. */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\taddq.w %OI8,%Rsp\n\taddq.w %OI%d,%Rsp\n",
- fsize + 4);
-#else
- asm_fprintf (stream, "\taddqw %OI8,%Rsp\n\taddqw %OI%d,%Rsp\n",
- fsize + 4);
-#endif
- }
- else
-#endif /* NO_ADDSUB_Q */
- if (fsize + 4 < 0x8000)
- {
- if (TARGET_68040)
- {
- /* asm_fprintf() cannot handle %. */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tadd.w %0I%d,%Rsp\n", fsize + 4);
-#else
- asm_fprintf (stream, "\taddw %0I%d,%Rsp\n", fsize + 4);
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", fsize + 4);
-#else
- asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", fsize + 4);
-#endif
- }
- }
- else
- {
- /* asm_fprintf() cannot handle %. */
-#ifdef MOTOROLA
- asm_fprintf (stream, "\tadd.l %0I%d,%Rsp\n", fsize + 4);
-#else
- asm_fprintf (stream, "\taddl %0I%d,%Rsp\n", fsize + 4);
-#endif
- }
- }
- if (current_function_pops_args)
- asm_fprintf (stream, "\trtd %0I%d\n", current_function_pops_args);
- else
- fprintf (stream, "\trts\n");
-}
-
-/* Similar to general_operand, but exclude stack_pointer_rtx. */
-
-int
-not_sp_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return op != stack_pointer_rtx && general_operand (op, mode);
-}
-
-/* Return TRUE if X is a valid comparison operator for the dbcc
- instruction.
-
- Note it rejects floating point comparison operators.
- (In the future we could use Fdbcc).
-
- It also rejects some comparisons when CC_NO_OVERFLOW is set. */
-
-int
-valid_dbcc_comparison_p (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- switch (GET_CODE (x))
- {
- case EQ: case NE: case GTU: case LTU:
- case GEU: case LEU:
- return 1;
-
- /* Reject some when CC_NO_OVERFLOW is set. This may be over
- conservative */
- case GT: case LT: case GE: case LE:
- return ! (cc_prev_status.flags & CC_NO_OVERFLOW);
- default:
- return 0;
- }
-}
-
-/* Return non-zero if flags are currently in the 68881 flag register. */
-int
-flags_in_68881 ()
-{
- /* We could add support for these in the future */
- return cc_status.flags & CC_IN_68881;
-}
-
-/* Output a dbCC; jCC sequence. Note we do not handle the
- floating point version of this sequence (Fdbcc). We also
- do not handle alternative conditions when CC_NO_OVERFLOW is
- set. It is assumed that valid_dbcc_comparison_p and flags_in_68881 will
- kick those out before we get here. */
-
-output_dbcc_and_branch (operands)
- rtx *operands;
-{
- switch (GET_CODE (operands[3]))
- {
- case EQ:
-#ifdef MOTOROLA
- output_asm_insn ("dbeq %0,%l1\n\tjbeq %l2", operands);
-#else
- output_asm_insn ("dbeq %0,%l1\n\tjeq %l2", operands);
-#endif
- break;
-
- case NE:
-#ifdef MOTOROLA
- output_asm_insn ("dbne %0,%l1\n\tjbne %l2", operands);
-#else
- output_asm_insn ("dbne %0,%l1\n\tjne %l2", operands);
-#endif
- break;
-
- case GT:
-#ifdef MOTOROLA
- output_asm_insn ("dbgt %0,%l1\n\tjbgt %l2", operands);
-#else
- output_asm_insn ("dbgt %0,%l1\n\tjgt %l2", operands);
-#endif
- break;
-
- case GTU:
-#ifdef MOTOROLA
- output_asm_insn ("dbhi %0,%l1\n\tjbhi %l2", operands);
-#else
- output_asm_insn ("dbhi %0,%l1\n\tjhi %l2", operands);
-#endif
- break;
-
- case LT:
-#ifdef MOTOROLA
- output_asm_insn ("dblt %0,%l1\n\tjblt %l2", operands);
-#else
- output_asm_insn ("dblt %0,%l1\n\tjlt %l2", operands);
-#endif
- break;
-
- case LTU:
-#ifdef MOTOROLA
- output_asm_insn ("dbcs %0,%l1\n\tjbcs %l2", operands);
-#else
- output_asm_insn ("dbcs %0,%l1\n\tjcs %l2", operands);
-#endif
- break;
-
- case GE:
-#ifdef MOTOROLA
- output_asm_insn ("dbge %0,%l1\n\tjbge %l2", operands);
-#else
- output_asm_insn ("dbge %0,%l1\n\tjge %l2", operands);
-#endif
- break;
-
- case GEU:
-#ifdef MOTOROLA
- output_asm_insn ("dbcc %0,%l1\n\tjbcc %l2", operands);
-#else
- output_asm_insn ("dbcc %0,%l1\n\tjcc %l2", operands);
-#endif
- break;
-
- case LE:
-#ifdef MOTOROLA
- output_asm_insn ("dble %0,%l1\n\tjble %l2", operands);
-#else
- output_asm_insn ("dble %0,%l1\n\tjle %l2", operands);
-#endif
- break;
-
- case LEU:
-#ifdef MOTOROLA
- output_asm_insn ("dbls %0,%l1\n\tjbls %l2", operands);
-#else
- output_asm_insn ("dbls %0,%l1\n\tjls %l2", operands);
-#endif
- break;
-
- default:
- abort ();
- }
-
- /* If the decrement is to be done in SImode, then we have
- to compensate for the fact that dbcc decrements in HImode. */
- switch (GET_MODE (operands[0]))
- {
- case SImode:
-#ifdef MOTOROLA
- output_asm_insn ("clr%.w %0\n\tsubq%.l %#1,%0\n\tjbpl %l1", operands);
-#else
- output_asm_insn ("clr%.w %0\n\tsubq%.l %#1,%0\n\tjpl %l1", operands);
-#endif
- break;
-
- case HImode:
- break;
-
- default:
- abort ();
- }
-}
-
-char *
-output_scc_di(op, operand1, operand2, dest)
- rtx op;
- rtx operand1;
- rtx operand2;
- rtx dest;
-{
- rtx loperands[7];
- enum rtx_code op_code = GET_CODE (op);
-
- /* This does not produce a usefull cc. */
- CC_STATUS_INIT;
-
- /* The m68k cmp.l instruction requires operand1 to be a reg as used
- below. Swap the operands and change the op if these requirements
- are not fulfilled. */
- if (GET_CODE (operand2) == REG && GET_CODE (operand1) != REG)
- {
- rtx tmp = operand1;
-
- operand1 = operand2;
- operand2 = tmp;
- op_code = swap_condition (op_code);
- }
- loperands[0] = operand1;
- if (GET_CODE (operand1) == REG)
- loperands[1] = gen_rtx (REG, SImode, REGNO (operand1) + 1);
- else
- loperands[1] = adj_offsettable_operand (operand1, 4);
- if (operand2 != const0_rtx)
- {
- loperands[2] = operand2;
- if (GET_CODE (operand2) == REG)
- loperands[3] = gen_rtx (REG, SImode, REGNO (operand2) + 1);
- else
- loperands[3] = adj_offsettable_operand (operand2, 4);
- }
- loperands[4] = gen_label_rtx();
- if (operand2 != const0_rtx)
-#ifdef MOTOROLA
-#ifdef SGS_CMP_ORDER
- output_asm_insn ("cmp%.l %0,%2\n\tjbne %l4\n\tcmp%.l %1,%3", loperands);
-#else
- output_asm_insn ("cmp%.l %2,%0\n\tjbne %l4\n\tcmp%.l %3,%1", loperands);
-#endif
-#else
-#ifdef SGS_CMP_ORDER
- output_asm_insn ("cmp%.l %0,%2\n\tjne %l4\n\tcmp%.l %1,%3", loperands);
-#else
- output_asm_insn ("cmp%.l %2,%0\n\tjne %l4\n\tcmp%.l %3,%1", loperands);
-#endif
-#endif
- else
-#ifdef MOTOROLA
- output_asm_insn ("tst%.l %0\n\tjbne %l4\n\ttst%.l %1", loperands);
-#else
- output_asm_insn ("tst%.l %0\n\tjne %l4\n\ttst%.l %1", loperands);
-#endif
- loperands[5] = dest;
-
- switch (op_code)
- {
- case EQ:
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("seq %5", loperands);
- break;
-
- case NE:
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("sne %5", loperands);
- break;
-
- case GT:
- loperands[6] = gen_label_rtx();
-#ifdef MOTOROLA
- output_asm_insn ("shi %5\n\tjbra %l6", loperands);
-#else
- output_asm_insn ("shi %5\n\tjra %l6", loperands);
-#endif
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("sgt %5", loperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[6]));
- break;
-
- case GTU:
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("shi %5", loperands);
- break;
-
- case LT:
- loperands[6] = gen_label_rtx();
-#ifdef MOTOROLA
- output_asm_insn ("scs %5\n\tjbra %l6", loperands);
-#else
- output_asm_insn ("scs %5\n\tjra %l6", loperands);
-#endif
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("slt %5", loperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[6]));
- break;
-
- case LTU:
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("scs %5", loperands);
- break;
-
- case GE:
- loperands[6] = gen_label_rtx();
-#ifdef MOTOROLA
- output_asm_insn ("scc %5\n\tjbra %l6", loperands);
-#else
- output_asm_insn ("scc %5\n\tjra %l6", loperands);
-#endif
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("sge %5", loperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[6]));
- break;
-
- case GEU:
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("scc %5", loperands);
- break;
-
- case LE:
- loperands[6] = gen_label_rtx();
-#ifdef MOTOROLA
- output_asm_insn ("sls %5\n\tjbra %l6", loperands);
-#else
- output_asm_insn ("sls %5\n\tjra %l6", loperands);
-#endif
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("sle %5", loperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[6]));
- break;
-
- case LEU:
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (loperands[4]));
- output_asm_insn ("sls %5", loperands);
- break;
-
- default:
- abort ();
- }
- return "";
-}
-
-char *
-output_btst (operands, countop, dataop, insn, signpos)
- rtx *operands;
- rtx countop, dataop;
- rtx insn;
- int signpos;
-{
- operands[0] = countop;
- operands[1] = dataop;
-
- if (GET_CODE (countop) == CONST_INT)
- {
- register int count = INTVAL (countop);
- /* If COUNT is bigger than size of storage unit in use,
- advance to the containing unit of same size. */
- if (count > signpos)
- {
- int offset = (count & ~signpos) / 8;
- count = count & signpos;
- operands[1] = dataop = adj_offsettable_operand (dataop, offset);
- }
- if (count == signpos)
- cc_status.flags = CC_NOT_POSITIVE | CC_Z_IN_NOT_N;
- else
- cc_status.flags = CC_NOT_NEGATIVE | CC_Z_IN_NOT_N;
-
- /* These three statements used to use next_insns_test_no...
- but it appears that this should do the same job. */
- if (count == 31
- && next_insn_tests_no_inequality (insn))
- return "tst%.l %1";
- if (count == 15
- && next_insn_tests_no_inequality (insn))
- return "tst%.w %1";
- if (count == 7
- && next_insn_tests_no_inequality (insn))
- return "tst%.b %1";
-
- cc_status.flags = CC_NOT_NEGATIVE;
- }
- return "btst %0,%1";
-}
-
-/* Returns 1 if OP is either a symbol reference or a sum of a symbol
- reference and a constant. */
-
-int
-symbolic_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- return 1;
-
- case CONST:
- op = XEXP (op, 0);
- return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (op, 0)) == LABEL_REF)
- && GET_CODE (XEXP (op, 1)) == CONST_INT);
-
-#if 0 /* Deleted, with corresponding change in m68k.h,
- so as to fit the specs. No CONST_DOUBLE is ever symbolic. */
- case CONST_DOUBLE:
- return GET_MODE (op) == mode;
-#endif
-
- default:
- return 0;
- }
-}
-
-/* Check for sign_extend or zero_extend. Used for bit-count operands. */
-
-int
-extend_operator(x, mode)
- rtx x;
- enum machine_mode mode;
-{
- if (mode != VOIDmode && GET_MODE(x) != mode)
- return 0;
- switch (GET_CODE(x))
- {
- case SIGN_EXTEND :
- case ZERO_EXTEND :
- return 1;
- default :
- return 0;
- }
-}
-
-
-/* Legitimize PIC addresses. If the address is already
- position-independent, we return ORIG. Newly generated
- position-independent addresses go to REG. If we need more
- than one register, we lose.
-
- An address is legitimized by making an indirect reference
- through the Global Offset Table with the name of the symbol
- used as an offset.
-
- The assembler and linker are responsible for placing the
- address of the symbol in the GOT. The function prologue
- is responsible for initializing a5 to the starting address
- of the GOT.
-
- The assembler is also responsible for translating a symbol name
- into a constant displacement from the start of the GOT.
-
- A quick example may make things a little clearer:
-
- When not generating PIC code to store the value 12345 into _foo
- we would generate the following code:
-
- movel #12345, _foo
-
- When generating PIC two transformations are made. First, the compiler
- loads the address of foo into a register. So the first transformation makes:
-
- lea _foo, a0
- movel #12345, a0@
-
- The code in movsi will intercept the lea instruction and call this
- routine which will transform the instructions into:
-
- movel a5@(_foo:w), a0
- movel #12345, a0@
-
-
- That (in a nutshell) is how *all* symbol and label references are
- handled. */
-
-rtx
-legitimize_pic_address (orig, mode, reg)
- rtx orig, reg;
- enum machine_mode mode;
-{
- rtx pic_ref = orig;
-
- /* First handle a simple SYMBOL_REF or LABEL_REF */
- if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
- {
- if (reg == 0)
- abort ();
-
- pic_ref = gen_rtx (MEM, Pmode,
- gen_rtx (PLUS, Pmode,
- pic_offset_table_rtx, orig));
- current_function_uses_pic_offset_table = 1;
- RTX_UNCHANGING_P (pic_ref) = 1;
- emit_move_insn (reg, pic_ref);
- return reg;
- }
- else if (GET_CODE (orig) == CONST)
- {
- rtx base, offset;
-
- /* Make sure this is CONST has not already been legitimized */
- if (GET_CODE (XEXP (orig, 0)) == PLUS
- && XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx)
- return orig;
-
- if (reg == 0)
- abort ();
-
- /* legitimize both operands of the PLUS */
- if (GET_CODE (XEXP (orig, 0)) == PLUS)
- {
- base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg);
- orig = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
- base == reg ? 0 : reg);
- }
- else abort ();
-
- if (GET_CODE (orig) == CONST_INT)
- return plus_constant_for_output (base, INTVAL (orig));
- pic_ref = gen_rtx (PLUS, Pmode, base, orig);
- /* Likewise, should we set special REG_NOTEs here? */
- }
- return pic_ref;
-}
-
-
-typedef enum { MOVL, SWAP, NEGW, NOTW, NOTB, MOVQ } CONST_METHOD;
-
-#define USE_MOVQ(i) ((unsigned)((i) + 128) <= 255)
-
-CONST_METHOD
-const_method (constant)
- rtx constant;
-{
- int i;
- unsigned u;
-
- i = INTVAL (constant);
- if (USE_MOVQ (i))
- return MOVQ;
-
- /* The Coldfire doesn't have byte or word operations. */
- /* FIXME: This may not be useful for the m68060 either */
- if (!TARGET_5200)
- {
- /* if -256 < N < 256 but N is not in range for a moveq
- N^ff will be, so use moveq #N^ff, dreg; not.b dreg. */
- if (USE_MOVQ (i ^ 0xff))
- return NOTB;
- /* Likewise, try with not.w */
- if (USE_MOVQ (i ^ 0xffff))
- return NOTW;
- /* This is the only value where neg.w is useful */
- if (i == -65408)
- return NEGW;
- /* Try also with swap */
- u = i;
- if (USE_MOVQ ((u >> 16) | (u << 16)))
- return SWAP;
- }
- /* Otherwise, use move.l */
- return MOVL;
-}
-
-const_int_cost (constant)
- rtx constant;
-{
- switch (const_method (constant))
- {
- case MOVQ :
- /* Constants between -128 and 127 are cheap due to moveq */
- return 0;
- case NOTB :
- case NOTW :
- case NEGW :
- case SWAP :
- /* Constants easily generated by moveq + not.b/not.w/neg.w/swap */
- return 1;
- case MOVL :
- return 2;
- default :
- abort ();
- }
-}
-
-char *
-output_move_const_into_data_reg (operands)
- rtx *operands;
-{
- int i;
-
- i = INTVAL (operands[1]);
- switch (const_method (operands[1]))
- {
- case MOVQ :
-#if defined (MOTOROLA) && !defined (CRDS)
- return "moveq%.l %1,%0";
-#else
- return "moveq %1,%0";
-#endif
- case NOTB :
- operands[1] = gen_rtx (CONST_INT, VOIDmode, i ^ 0xff);
-#if defined (MOTOROLA) && !defined (CRDS)
- return "moveq%.l %1,%0\n\tnot%.b %0";
-#else
- return "moveq %1,%0\n\tnot%.b %0";
-#endif
- case NOTW :
- operands[1] = gen_rtx (CONST_INT, VOIDmode, i ^ 0xffff);
-#if defined (MOTOROLA) && !defined (CRDS)
- return "moveq%.l %1,%0\n\tnot%.w %0";
-#else
- return "moveq %1,%0\n\tnot%.w %0";
-#endif
- case NEGW :
-#if defined (MOTOROLA) && !defined (CRDS)
- return "moveq%.l %#-128,%0\n\tneg%.w %0";
-#else
- return "moveq %#-128,%0\n\tneg%.w %0";
-#endif
- case SWAP :
- {
- unsigned u = i;
-
- operands[1] = gen_rtx (CONST_INT, VOIDmode, (u << 16) | (u >> 16));
-#if defined (MOTOROLA) && !defined (CRDS)
- return "moveq%.l %1,%0\n\tswap %0";
-#else
- return "moveq %1,%0\n\tswap %0";
-#endif
- }
- case MOVL :
- return "move%.l %1,%0";
- default :
- abort ();
- }
-}
-
-char *
-output_move_simode_const (operands)
- rtx *operands;
-{
- if (operands[1] == const0_rtx
- && (DATA_REG_P (operands[0])
- || GET_CODE (operands[0]) == MEM)
- /* clr insns on 68000 read before writing.
- This isn't so on the 68010, but we have no TARGET_68010. */
- && ((TARGET_68020 || TARGET_5200)
- || !(GET_CODE (operands[0]) == MEM
- && MEM_VOLATILE_P (operands[0]))))
- return "clr%.l %0";
- else if (DATA_REG_P (operands[0]))
- return output_move_const_into_data_reg (operands);
- else if (ADDRESS_REG_P (operands[0])
- && INTVAL (operands[1]) < 0x8000
- && INTVAL (operands[1]) >= -0x8000)
- return "move%.w %1,%0";
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
- && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM
- && INTVAL (operands[1]) < 0x8000
- && INTVAL (operands[1]) >= -0x8000)
- return "pea %a1";
- return "move%.l %1,%0";
-}
-
-char *
-output_move_simode (operands)
- rtx *operands;
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- return output_move_simode_const (operands);
- else if ((GET_CODE (operands[1]) == SYMBOL_REF
- || GET_CODE (operands[1]) == CONST)
- && push_operand (operands[0], SImode))
- return "pea %a1";
- else if ((GET_CODE (operands[1]) == SYMBOL_REF
- || GET_CODE (operands[1]) == CONST)
- && ADDRESS_REG_P (operands[0]))
- return "lea %a1,%0";
- return "move%.l %1,%0";
-}
-
-char *
-output_move_himode (operands)
- rtx *operands;
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (operands[1] == const0_rtx
- && (DATA_REG_P (operands[0])
- || GET_CODE (operands[0]) == MEM)
- /* clr insns on 68000 read before writing.
- This isn't so on the 68010, but we have no TARGET_68010. */
- && ((TARGET_68020 || TARGET_5200)
- || !(GET_CODE (operands[0]) == MEM
- && MEM_VOLATILE_P (operands[0]))))
- return "clr%.w %0";
- else if (DATA_REG_P (operands[0])
- && INTVAL (operands[1]) < 128
- && INTVAL (operands[1]) >= -128)
- {
-#if defined(MOTOROLA) && !defined(CRDS)
- return "moveq%.l %1,%0";
-#else
- return "moveq %1,%0";
-#endif
- }
- else if (INTVAL (operands[1]) < 0x8000
- && INTVAL (operands[1]) >= -0x8000)
- return "move%.w %1,%0";
- }
- else if (CONSTANT_P (operands[1]))
- return "move%.l %1,%0";
-#ifndef SGS_NO_LI
- /* Recognize the insn before a tablejump, one that refers
- to a table of offsets. Such an insn will need to refer
- to a label on the insn. So output one. Use the label-number
- of the table of offsets to generate this label. This code,
- and similar code below, assumes that there will be at most one
- reference to each table. */
- if (GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1], 0)) == PLUS
- && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == LABEL_REF
- && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS)
- {
- rtx labelref = XEXP (XEXP (operands[1], 0), 1);
-#if defined (MOTOROLA) && !defined (SGS_SWITCH_TABLES)
-#ifdef SGS
- asm_fprintf (asm_out_file, "\tset %LLI%d,.+2\n",
- CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-#else /* not SGS */
- asm_fprintf (asm_out_file, "\t.set %LLI%d,.+2\n",
- CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-#endif /* not SGS */
-#else /* SGS_SWITCH_TABLES or not MOTOROLA */
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LI",
- CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-#ifdef SGS_SWITCH_TABLES
- /* Set flag saying we need to define the symbol
- LD%n (with value L%n-LI%n) at the end of the switch table. */
- switch_table_difference_label_flag = 1;
-#endif /* SGS_SWITCH_TABLES */
-#endif /* SGS_SWITCH_TABLES or not MOTOROLA */
- }
-#endif /* SGS_NO_LI */
- return "move%.w %1,%0";
-}
-
-char *
-output_move_qimode (operands)
- rtx *operands;
-{
- rtx xoperands[4];
-
- /* This is probably useless, since it loses for pushing a struct
- of several bytes a byte at a time. */
- if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
- && XEXP (XEXP (operands[0], 0), 0) == stack_pointer_rtx
- && ! ADDRESS_REG_P (operands[1]))
- {
- xoperands[1] = operands[1];
- xoperands[2]
- = gen_rtx (MEM, QImode,
- gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
- /* Just pushing a byte puts it in the high byte of the halfword. */
- /* We must put it in the low-order, high-numbered byte. */
- output_asm_insn ("move%.b %1,%-\n\tmove%.b %@,%2", xoperands);
- return "";
- }
-
- /* clr and st insns on 68000 read before writing.
- This isn't so on the 68010, but we have no TARGET_68010. */
- if (!ADDRESS_REG_P (operands[0])
- && ((TARGET_68020 || TARGET_5200)
- || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
- {
- if (operands[1] == const0_rtx)
- return "clr%.b %0";
- if ((!TARGET_5200 || DATA_REG_P (operands[0]))
- && GET_CODE (operands[1]) == CONST_INT
- && (INTVAL (operands[1]) & 255) == 255)
- {
- CC_STATUS_INIT;
- return "st %0";
- }
- }
- if (GET_CODE (operands[1]) == CONST_INT
- && DATA_REG_P (operands[0])
- && INTVAL (operands[1]) < 128
- && INTVAL (operands[1]) >= -128)
- {
-#if defined(MOTOROLA) && !defined(CRDS)
- return "moveq%.l %1,%0";
-#else
- return "moveq %1,%0";
-#endif
- }
- if (GET_CODE (operands[1]) != CONST_INT && CONSTANT_P (operands[1]))
- return "move%.l %1,%0";
- if (ADDRESS_REG_P (operands[0]) || ADDRESS_REG_P (operands[1]))
- return "move%.w %1,%0";
- return "move%.b %1,%0";
-}
-
-/* Return the best assembler insn template
- for moving operands[1] into operands[0] as a fullword. */
-
-static char *
-singlemove_string (operands)
- rtx *operands;
-{
-#ifdef SUPPORT_SUN_FPA
- if (FPA_REG_P (operands[0]) || FPA_REG_P (operands[1]))
- return "fpmoves %1,%0";
-#endif
- if (GET_CODE (operands[1]) == CONST_INT)
- return output_move_simode_const (operands);
- return "move%.l %1,%0";
-}
-
-
-/* Output assembler code to perform a doubleword move insn
- with operands OPERANDS. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum
- {
- REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP
- } optype0, optype1;
- rtx latehalf[2];
- rtx middlehalf[2];
- rtx xops[2];
- rtx addreg0 = 0, addreg1 = 0;
- int dest_overlapped_low = 0;
- int size = GET_MODE_SIZE (GET_MODE (operands[0]));
-
- middlehalf[0] = 0;
- middlehalf[1] = 0;
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- optype0 = POPOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- optype0 = PUSHOP;
- else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1]))
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC)
- optype1 = POPOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- optype1 = PUSHOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP)
- abort ();
-
- /* If one operand is decrementing and one is incrementing
- decrement the former register explicitly
- and change that operand into ordinary indexing. */
-
- if (optype0 == PUSHOP && optype1 == POPOP)
- {
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
- if (size == 12)
- output_asm_insn ("sub%.l %#12,%0", operands);
- else
- output_asm_insn ("subq%.l %#8,%0", operands);
- if (GET_MODE (operands[1]) == XFmode)
- operands[0] = gen_rtx (MEM, XFmode, operands[0]);
- else if (GET_MODE (operands[0]) == DFmode)
- operands[0] = gen_rtx (MEM, DFmode, operands[0]);
- else
- operands[0] = gen_rtx (MEM, DImode, operands[0]);
- optype0 = OFFSOP;
- }
- if (optype0 == POPOP && optype1 == PUSHOP)
- {
- operands[1] = XEXP (XEXP (operands[1], 0), 0);
- if (size == 12)
- output_asm_insn ("sub%.l %#12,%1", operands);
- else
- output_asm_insn ("subq%.l %#8,%1", operands);
- if (GET_MODE (operands[1]) == XFmode)
- operands[1] = gen_rtx (MEM, XFmode, operands[1]);
- else if (GET_MODE (operands[1]) == DFmode)
- operands[1] = gen_rtx (MEM, DFmode, operands[1]);
- else
- operands[1] = gen_rtx (MEM, DImode, operands[1]);
- optype1 = OFFSOP;
- }
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (operands[0], 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (operands[1], 0));
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first,
- but if either operand is autodecrementing then we
- do the high-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (size == 12)
- {
- if (optype0 == REGOP)
- {
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 2);
- middlehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- }
- else if (optype0 == OFFSOP)
- {
- middlehalf[0] = adj_offsettable_operand (operands[0], 4);
- latehalf[0] = adj_offsettable_operand (operands[0], size - 4);
- }
- else
- {
- middlehalf[0] = operands[0];
- latehalf[0] = operands[0];
- }
-
- if (optype1 == REGOP)
- {
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
- middlehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- }
- else if (optype1 == OFFSOP)
- {
- middlehalf[1] = adj_offsettable_operand (operands[1], 4);
- latehalf[1] = adj_offsettable_operand (operands[1], size - 4);
- }
- else if (optype1 == CNSTOP)
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- REAL_VALUE_TYPE r;
- long l[3];
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l);
- operands[1] = GEN_INT (l[0]);
- middlehalf[1] = GEN_INT (l[1]);
- latehalf[1] = GEN_INT (l[2]);
- }
- else if (CONSTANT_P (operands[1]))
- {
- /* actually, no non-CONST_DOUBLE constant should ever
- appear here. */
- abort ();
- if (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) < 0)
- latehalf[1] = constm1_rtx;
- else
- latehalf[1] = const0_rtx;
- }
- }
- else
- {
- middlehalf[1] = operands[1];
- latehalf[1] = operands[1];
- }
- }
- else
- /* size is not 12: */
- {
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], size - 4);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], size - 4);
- else if (optype1 == CNSTOP)
- split_double (operands[1], &operands[1], &latehalf[1]);
- else
- latehalf[1] = operands[1];
- }
-
- /* If insn is effectively movd N(sp),-(sp) then we will do the
- high word first. We should use the adjusted operand 1 (which is N+4(sp))
- for the low word as well, to compensate for the first decrement of sp. */
- if (optype0 == PUSHOP
- && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM
- && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1]))
- operands[1] = middlehalf[1] = latehalf[1];
-
- /* For (set (reg:DI N) (mem:DI ... (reg:SI N) ...)),
- if the upper part of reg N does not appear in the MEM, arrange to
- emit the move late-half first. Otherwise, compute the MEM address
- into the upper part of N and use that as a pointer to the memory
- operand. */
- if (optype0 == REGOP
- && (optype1 == OFFSOP || optype1 == MEMOP))
- {
- rtx testlow = gen_rtx (REG, SImode, REGNO (operands[0]));
-
- if (reg_overlap_mentioned_p (testlow, XEXP (operands[1], 0))
- && reg_overlap_mentioned_p (latehalf[0], XEXP (operands[1], 0)))
- {
- /* If both halves of dest are used in the src memory address,
- compute the address into latehalf of dest.
- Note that this can't happen if the dest is two data regs. */
-compadr:
- xops[0] = latehalf[0];
- xops[1] = XEXP (operands[1], 0);
- output_asm_insn ("lea %a1,%0", xops);
- if( GET_MODE (operands[1]) == XFmode )
- {
- operands[1] = gen_rtx (MEM, XFmode, latehalf[0]);
- middlehalf[1] = adj_offsettable_operand (operands[1], size-8);
- latehalf[1] = adj_offsettable_operand (operands[1], size-4);
- }
- else
- {
- operands[1] = gen_rtx (MEM, DImode, latehalf[0]);
- latehalf[1] = adj_offsettable_operand (operands[1], size-4);
- }
- }
- else if (size == 12
- && reg_overlap_mentioned_p (middlehalf[0],
- XEXP (operands[1], 0)))
- {
- /* Check for two regs used by both source and dest.
- Note that this can't happen if the dest is all data regs.
- It can happen if the dest is d6, d7, a0.
- But in that case, latehalf is an addr reg, so
- the code at compadr does ok. */
-
- if (reg_overlap_mentioned_p (testlow, XEXP (operands[1], 0))
- || reg_overlap_mentioned_p (latehalf[0], XEXP (operands[1], 0)))
- goto compadr;
-
- /* JRV says this can't happen: */
- if (addreg0 || addreg1)
- abort ();
-
- /* Only the middle reg conflicts; simply put it last. */
- output_asm_insn (singlemove_string (operands), operands);
- output_asm_insn (singlemove_string (latehalf), latehalf);
- output_asm_insn (singlemove_string (middlehalf), middlehalf);
- return "";
- }
- else if (reg_overlap_mentioned_p (testlow, XEXP (operands[1], 0)))
- /* If the low half of dest is mentioned in the source memory
- address, the arrange to emit the move late half first. */
- dest_overlapped_low = 1;
- }
-
- /* If one or both operands autodecrementing,
- do the two words, high-numbered first. */
-
- /* Likewise, the first move would clobber the source of the second one,
- do them in the other order. This happens only for registers;
- such overlap can't happen in memory unless the user explicitly
- sets it up, and that is an undefined circumstance. */
-
- if (optype0 == PUSHOP || optype1 == PUSHOP
- || (optype0 == REGOP && optype1 == REGOP
- && ((middlehalf[1] && REGNO (operands[0]) == REGNO (middlehalf[1]))
- || REGNO (operands[0]) == REGNO (latehalf[1])))
- || dest_overlapped_low)
- {
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- {
- if (size == 12)
- output_asm_insn ("addq%.l %#8,%0", &addreg0);
- else
- output_asm_insn ("addq%.l %#4,%0", &addreg0);
- }
- if (addreg1)
- {
- if (size == 12)
- output_asm_insn ("addq%.l %#8,%0", &addreg1);
- else
- output_asm_insn ("addq%.l %#4,%0", &addreg1);
- }
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("subq%.l %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("subq%.l %#4,%0", &addreg1);
-
- if (size == 12)
- {
- output_asm_insn (singlemove_string (middlehalf), middlehalf);
- if (addreg0)
- output_asm_insn ("subq%.l %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("subq%.l %#4,%0", &addreg1);
- }
-
- /* Do low-numbered word. */
- return singlemove_string (operands);
- }
-
- /* Normal case: do the two words, low-numbered first. */
-
- output_asm_insn (singlemove_string (operands), operands);
-
- /* Do the middle one of the three words for long double */
- if (size == 12)
- {
- if (addreg0)
- output_asm_insn ("addq%.l %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("addq%.l %#4,%0", &addreg1);
-
- output_asm_insn (singlemove_string (middlehalf), middlehalf);
- }
-
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("addq%.l %#4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("addq%.l %#4,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- {
- if (size == 12)
- output_asm_insn ("subq%.l %#8,%0", &addreg0);
- else
- output_asm_insn ("subq%.l %#4,%0", &addreg0);
- }
- if (addreg1)
- {
- if (size == 12)
- output_asm_insn ("subq%.l %#8,%0", &addreg1);
- else
- output_asm_insn ("subq%.l %#4,%0", &addreg1);
- }
-
- return "";
-}
-
-/* Return a REG that occurs in ADDR with coefficient 1.
- ADDR can be effectively incremented by incrementing REG. */
-
-static rtx
-find_addr_reg (addr)
- rtx addr;
-{
- while (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG)
- addr = XEXP (addr, 0);
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 0)))
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 1)))
- addr = XEXP (addr, 0);
- else
- abort ();
- }
- if (GET_CODE (addr) == REG)
- return addr;
- abort ();
-}
-
-/* Store in cc_status the expressions that the condition codes will
- describe after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-/* On the 68000, all the insns to store in an address register fail to
- set the cc's. However, in some cases these instructions can make it
- possibly invalid to use the saved cc's. In those cases we clear out
- some or all of the saved cc's so they won't be used. */
-
-notice_update_cc (exp, insn)
- rtx exp;
- rtx insn;
-{
- /* If the cc is being set from the fpa and the expression is not an
- explicit floating point test instruction (which has code to deal with
- this), reinit the CC. */
- if (((cc_status.value1 && FPA_REG_P (cc_status.value1))
- || (cc_status.value2 && FPA_REG_P (cc_status.value2)))
- && !(GET_CODE (exp) == PARALLEL
- && GET_CODE (XVECEXP (exp, 0, 0)) == SET
- && XEXP (XVECEXP (exp, 0, 0), 0) == cc0_rtx))
- {
- CC_STATUS_INIT;
- }
- else if (GET_CODE (exp) == SET)
- {
- if (GET_CODE (SET_SRC (exp)) == CALL)
- {
- CC_STATUS_INIT;
- }
- else if (ADDRESS_REG_P (SET_DEST (exp)))
- {
- if (cc_status.value1
- && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value1))
- cc_status.value1 = 0;
- if (cc_status.value2
- && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2))
- cc_status.value2 = 0;
- }
- else if (!FP_REG_P (SET_DEST (exp))
- && SET_DEST (exp) != cc0_rtx
- && (FP_REG_P (SET_SRC (exp))
- || GET_CODE (SET_SRC (exp)) == FIX
- || GET_CODE (SET_SRC (exp)) == FLOAT_TRUNCATE
- || GET_CODE (SET_SRC (exp)) == FLOAT_EXTEND))
- {
- CC_STATUS_INIT;
- }
- /* A pair of move insns doesn't produce a useful overall cc. */
- else if (!FP_REG_P (SET_DEST (exp))
- && !FP_REG_P (SET_SRC (exp))
- && GET_MODE_SIZE (GET_MODE (SET_SRC (exp))) > 4
- && (GET_CODE (SET_SRC (exp)) == REG
- || GET_CODE (SET_SRC (exp)) == MEM
- || GET_CODE (SET_SRC (exp)) == CONST_DOUBLE))
- {
- CC_STATUS_INIT;
- }
- else if (GET_CODE (SET_SRC (exp)) == CALL)
- {
- CC_STATUS_INIT;
- }
- else if (XEXP (exp, 0) != pc_rtx)
- {
- cc_status.flags = 0;
- cc_status.value1 = XEXP (exp, 0);
- cc_status.value2 = XEXP (exp, 1);
- }
- }
- else if (GET_CODE (exp) == PARALLEL
- && GET_CODE (XVECEXP (exp, 0, 0)) == SET)
- {
- if (ADDRESS_REG_P (XEXP (XVECEXP (exp, 0, 0), 0)))
- CC_STATUS_INIT;
- else if (XEXP (XVECEXP (exp, 0, 0), 0) != pc_rtx)
- {
- cc_status.flags = 0;
- cc_status.value1 = XEXP (XVECEXP (exp, 0, 0), 0);
- cc_status.value2 = XEXP (XVECEXP (exp, 0, 0), 1);
- }
- }
- else
- CC_STATUS_INIT;
- if (cc_status.value2 != 0
- && ADDRESS_REG_P (cc_status.value2)
- && GET_MODE (cc_status.value2) == QImode)
- CC_STATUS_INIT;
- if (cc_status.value2 != 0
- && !(cc_status.value1 && FPA_REG_P (cc_status.value1)))
- switch (GET_CODE (cc_status.value2))
- {
- case PLUS: case MINUS: case MULT:
- case DIV: case UDIV: case MOD: case UMOD: case NEG:
-#if 0 /* These instructions always clear the overflow bit */
- case ASHIFT: case ASHIFTRT: case LSHIFTRT:
- case ROTATE: case ROTATERT:
-#endif
- if (GET_MODE (cc_status.value2) != VOIDmode)
- cc_status.flags |= CC_NO_OVERFLOW;
- break;
- case ZERO_EXTEND:
- /* (SET r1 (ZERO_EXTEND r2)) on this machine
- ends with a move insn moving r2 in r2's mode.
- Thus, the cc's are set for r2.
- This can set N bit spuriously. */
- cc_status.flags |= CC_NOT_NEGATIVE;
- }
- if (cc_status.value1 && GET_CODE (cc_status.value1) == REG
- && cc_status.value2
- && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2))
- cc_status.value2 = 0;
- if (((cc_status.value1 && FP_REG_P (cc_status.value1))
- || (cc_status.value2 && FP_REG_P (cc_status.value2)))
- && !((cc_status.value1 && FPA_REG_P (cc_status.value1))
- || (cc_status.value2 && FPA_REG_P (cc_status.value2))))
- cc_status.flags = CC_IN_68881;
-}
-
-char *
-output_move_const_double (operands)
- rtx *operands;
-{
-#ifdef SUPPORT_SUN_FPA
- if (TARGET_FPA && FPA_REG_P (operands[0]))
- {
- int code = standard_sun_fpa_constant_p (operands[1]);
-
- if (code != 0)
- {
- static char buf[40];
-
- sprintf (buf, "fpmove%%.d %%%%%d,%%0", code & 0x1ff);
- return buf;
- }
- return "fpmove%.d %1,%0";
- }
- else
-#endif
- {
- int code = standard_68881_constant_p (operands[1]);
-
- if (code != 0)
- {
- static char buf[40];
-
- sprintf (buf, "fmovecr %%#0x%x,%%0", code & 0xff);
- return buf;
- }
- return "fmove%.d %1,%0";
- }
-}
-
-char *
-output_move_const_single (operands)
- rtx *operands;
-{
-#ifdef SUPPORT_SUN_FPA
- if (TARGET_FPA)
- {
- int code = standard_sun_fpa_constant_p (operands[1]);
-
- if (code != 0)
- {
- static char buf[40];
-
- sprintf (buf, "fpmove%%.s %%%%%d,%%0", code & 0x1ff);
- return buf;
- }
- return "fpmove%.s %1,%0";
- }
- else
-#endif /* defined SUPPORT_SUN_FPA */
- {
- int code = standard_68881_constant_p (operands[1]);
-
- if (code != 0)
- {
- static char buf[40];
-
- sprintf (buf, "fmovecr %%#0x%x,%%0", code & 0xff);
- return buf;
- }
- return "fmove%.s %f1,%0";
- }
-}
-
-/* Return nonzero if X, a CONST_DOUBLE, has a value that we can get
- from the "fmovecr" instruction.
- The value, anded with 0xff, gives the code to use in fmovecr
- to get the desired constant. */
-
-/* This code has been fixed for cross-compilation. */
-
-static int inited_68881_table = 0;
-
-char *strings_68881[7] = {
- "0.0",
- "1.0",
- "10.0",
- "100.0",
- "10000.0",
- "1e8",
- "1e16"
- };
-
-int codes_68881[7] = {
- 0x0f,
- 0x32,
- 0x33,
- 0x34,
- 0x35,
- 0x36,
- 0x37
- };
-
-REAL_VALUE_TYPE values_68881[7];
-
-/* Set up values_68881 array by converting the decimal values
- strings_68881 to binary. */
-
-void
-init_68881_table ()
-{
- int i;
- REAL_VALUE_TYPE r;
- enum machine_mode mode;
-
- mode = SFmode;
- for (i = 0; i < 7; i++)
- {
- if (i == 6)
- mode = DFmode;
- r = REAL_VALUE_ATOF (strings_68881[i], mode);
- values_68881[i] = r;
- }
- inited_68881_table = 1;
-}
-
-int
-standard_68881_constant_p (x)
- rtx x;
-{
- REAL_VALUE_TYPE r;
- int i;
- enum machine_mode mode;
-
-#ifdef NO_ASM_FMOVECR
- return 0;
-#endif
-
- /* fmovecr must be emulated on the 68040, so it shouldn't be used at all. */
- if (TARGET_68040)
- return 0;
-
-#ifndef REAL_ARITHMETIC
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
- if (! flag_pretend_float)
- return 0;
-#endif
-#endif
-
- if (! inited_68881_table)
- init_68881_table ();
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
-
- for (i = 0; i < 6; i++)
- {
- if (REAL_VALUES_EQUAL (r, values_68881[i]))
- return (codes_68881[i]);
- }
-
- if (GET_MODE (x) == SFmode)
- return 0;
-
- if (REAL_VALUES_EQUAL (r, values_68881[6]))
- return (codes_68881[6]);
-
- /* larger powers of ten in the constants ram are not used
- because they are not equal to a `double' C constant. */
- return 0;
-}
-
-/* If X is a floating-point constant, return the logarithm of X base 2,
- or 0 if X is not a power of 2. */
-
-int
-floating_exact_log2 (x)
- rtx x;
-{
- REAL_VALUE_TYPE r, r1;
- int i;
-
-#ifndef REAL_ARITHMETIC
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
- if (! flag_pretend_float)
- return 0;
-#endif
-#endif
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
-
- if (REAL_VALUES_LESS (r, dconst0))
- return 0;
-
- r1 = dconst1;
- i = 0;
- while (REAL_VALUES_LESS (r1, r))
- {
- r1 = REAL_VALUE_LDEXP (dconst1, i);
- if (REAL_VALUES_EQUAL (r1, r))
- return i;
- i = i + 1;
- }
- return 0;
-}
-
-#ifdef SUPPORT_SUN_FPA
-/* Return nonzero if X, a CONST_DOUBLE, has a value that we can get
- from the Sun FPA's constant RAM.
- The value returned, anded with 0x1ff, gives the code to use in fpmove
- to get the desired constant. */
-
-static int inited_FPA_table = 0;
-
-char *strings_FPA[38] = {
-/* small rationals */
- "0.0",
- "1.0",
- "0.5",
- "-1.0",
- "2.0",
- "3.0",
- "4.0",
- "8.0",
- "0.25",
- "0.125",
- "10.0",
- "-0.5",
-/* Decimal equivalents of double precision values */
- "2.718281828459045091", /* D_E */
- "6.283185307179586477", /* 2 pi */
- "3.141592653589793116", /* D_PI */
- "1.570796326794896619", /* pi/2 */
- "1.414213562373095145", /* D_SQRT2 */
- "0.7071067811865475244", /* 1/sqrt(2) */
- "-1.570796326794896619", /* -pi/2 */
- "1.442695040888963387", /* D_LOG2ofE */
- "3.321928024887362182", /* D_LOG2of10 */
- "0.6931471805599452862", /* D_LOGEof2 */
- "2.302585092994045901", /* D_LOGEof10 */
- "0.3010299956639811980", /* D_LOG10of2 */
- "0.4342944819032518167", /* D_LOG10ofE */
-/* Decimal equivalents of single precision values */
- "2.718281745910644531", /* S_E */
- "6.283185307179586477", /* 2 pi */
- "3.141592741012573242", /* S_PI */
- "1.570796326794896619", /* pi/2 */
- "1.414213538169860840", /* S_SQRT2 */
- "0.7071067811865475244", /* 1/sqrt(2) */
- "-1.570796326794896619", /* -pi/2 */
- "1.442695021629333496", /* S_LOG2ofE */
- "3.321928024291992188", /* S_LOG2of10 */
- "0.6931471824645996094", /* S_LOGEof2 */
- "2.302585124969482442", /* S_LOGEof10 */
- "0.3010300099849700928", /* S_LOG10of2 */
- "0.4342944920063018799", /* S_LOG10ofE */
-};
-
-
-int codes_FPA[38] = {
-/* small rationals */
- 0x200,
- 0xe,
- 0xf,
- 0x10,
- 0x11,
- 0xb1,
- 0x12,
- 0x13,
- 0x15,
- 0x16,
- 0x17,
- 0x2e,
-/* double precision */
- 0x8,
- 0x9,
- 0xa,
- 0xb,
- 0xc,
- 0xd,
- 0x27,
- 0x28,
- 0x29,
- 0x2a,
- 0x2b,
- 0x2c,
- 0x2d,
-/* single precision */
- 0x8,
- 0x9,
- 0xa,
- 0xb,
- 0xc,
- 0xd,
- 0x27,
- 0x28,
- 0x29,
- 0x2a,
- 0x2b,
- 0x2c,
- 0x2d
- };
-
-REAL_VALUE_TYPE values_FPA[38];
-
-/* This code has been fixed for cross-compilation. */
-
-void
-init_FPA_table ()
-{
- enum machine_mode mode;
- int i;
- REAL_VALUE_TYPE r;
-
- mode = DFmode;
- for (i = 0; i < 38; i++)
- {
- if (i == 25)
- mode = SFmode;
- r = REAL_VALUE_ATOF (strings_FPA[i], mode);
- values_FPA[i] = r;
- }
- inited_FPA_table = 1;
-}
-
-
-int
-standard_sun_fpa_constant_p (x)
- rtx x;
-{
- REAL_VALUE_TYPE r;
- int i;
-
-#ifndef REAL_ARITHMETIC
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
- if (! flag_pretend_float)
- return 0;
-#endif
-#endif
-
- if (! inited_FPA_table)
- init_FPA_table ();
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, x);
-
- for (i=0; i<12; i++)
- {
- if (REAL_VALUES_EQUAL (r, values_FPA[i]))
- return (codes_FPA[i]);
- }
-
- if (GET_MODE (x) == SFmode)
- {
- for (i=25; i<38; i++)
- {
- if (REAL_VALUES_EQUAL (r, values_FPA[i]))
- return (codes_FPA[i]);
- }
- }
- else
- {
- for (i=12; i<25; i++)
- {
- if (REAL_VALUES_EQUAL (r, values_FPA[i]))
- return (codes_FPA[i]);
- }
- }
- return 0x0;
-}
-#endif /* define SUPPORT_SUN_FPA */
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand X. X is an RTL
- expression.
-
- CODE is a value that can be used to specify one of several ways
- of printing the operand. It is used when identical operands
- must be printed differently depending on the context. CODE
- comes from the `%' specification that was used to request
- printing of the operand. If the specification was just `%DIGIT'
- then CODE is 0; if the specification was `%LTR DIGIT' then CODE
- is the ASCII code for LTR.
-
- If X is a register, this macro should print the register's name.
- The names can be found in an array `reg_names' whose type is
- `char *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
-
- When the machine description has a specification `%PUNCT' (a `%'
- followed by a punctuation character), this macro is called with
- a null pointer for X and the punctuation character for CODE.
-
- The m68k specific codes are:
-
- '.' for dot needed in Motorola-style opcode names.
- '-' for an operand pushing on the stack:
- sp@-, -(sp) or -(%sp) depending on the style of syntax.
- '+' for an operand pushing on the stack:
- sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
- '@' for a reference to the top word on the stack:
- sp@, (sp) or (%sp) depending on the style of syntax.
- '#' for an immediate operand prefix (# in MIT and Motorola syntax
- but & in SGS syntax, $ in CRDS/UNOS syntax).
- '!' for the cc register (used in an `and to cc' insn).
- '$' for the letter `s' in an op code, but only on the 68040.
- '&' for the letter `d' in an op code, but only on the 68040.
- '/' for register prefix needed by longlong.h.
-
- 'b' for byte insn (no effect, on the Sun; this is for the ISI).
- 'd' to force memory addressing to be absolute, not relative.
- 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
- 'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
- than directly). Second part of 'y' below.
- 'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
- or print pair of registers as rx:ry.
- 'y' for a FPA insn (print pair of registers as rx:ry). This also outputs
- CONST_DOUBLE's as SunFPA constant RAM registers if
- possible, so it should not be used except for the SunFPA.
-
- */
-
-void
-print_operand (file, op, letter)
- FILE *file; /* file to write to */
- rtx op; /* operand to print */
- int letter; /* %<letter> or 0 */
-{
- int i;
-
- if (letter == '.')
- {
-#if defined (MOTOROLA) && !defined (CRDS)
- asm_fprintf (file, ".");
-#endif
- }
- else if (letter == '#')
- {
- asm_fprintf (file, "%0I");
- }
- else if (letter == '-')
- {
-#ifdef MOTOROLA
- asm_fprintf (file, "-(%Rsp)");
-#else
- asm_fprintf (file, "%Rsp@-");
-#endif
- }
- else if (letter == '+')
- {
-#ifdef MOTOROLA
- asm_fprintf (file, "(%Rsp)+");
-#else
- asm_fprintf (file, "%Rsp@+");
-#endif
- }
- else if (letter == '@')
- {
-#ifdef MOTOROLA
- asm_fprintf (file, "(%Rsp)");
-#else
- asm_fprintf (file, "%Rsp@");
-#endif
- }
- else if (letter == '!')
- {
- asm_fprintf (file, "%Rfpcr");
- }
- else if (letter == '$')
- {
- if (TARGET_68040_ONLY)
- {
- fprintf (file, "s");
- }
- }
- else if (letter == '&')
- {
- if (TARGET_68040_ONLY)
- {
- fprintf (file, "d");
- }
- }
- else if (letter == '/')
- {
- asm_fprintf (file, "%R");
- }
- else if (GET_CODE (op) == REG)
- {
-#ifdef SUPPORT_SUN_FPA
- if (REGNO (op) < 16
- && (letter == 'y' || letter == 'x')
- && GET_MODE (op) == DFmode)
- {
- fprintf (file, "%s:%s", reg_names[REGNO (op)],
- reg_names[REGNO (op)+1]);
- }
- else
-#endif
- {
- if (letter == 'R')
- /* Print out the second register name of a register pair.
- I.e., R (6) => 7. */
- fputs (reg_names[REGNO (op) + 1], file);
- else
- fputs (reg_names[REGNO (op)], file);
- }
- }
- else if (GET_CODE (op) == MEM)
- {
- output_address (XEXP (op, 0));
- if (letter == 'd' && ! TARGET_68020
- && CONSTANT_ADDRESS_P (XEXP (op, 0))
- && !(GET_CODE (XEXP (op, 0)) == CONST_INT
- && INTVAL (XEXP (op, 0)) < 0x8000
- && INTVAL (XEXP (op, 0)) >= -0x8000))
- {
-#ifdef MOTOROLA
- fprintf (file, ".l");
-#else
- fprintf (file, ":l");
-#endif
- }
- }
-#ifdef SUPPORT_SUN_FPA
- else if ((letter == 'y' || letter == 'w')
- && GET_CODE (op) == CONST_DOUBLE
- && (i = standard_sun_fpa_constant_p (op)))
- {
- fprintf (file, "%%%d", i & 0x1ff);
- }
-#endif
- else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == SFmode)
- {
- REAL_VALUE_TYPE r;
- REAL_VALUE_FROM_CONST_DOUBLE (r, op);
- ASM_OUTPUT_FLOAT_OPERAND (letter, file, r);
- }
- else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == XFmode)
- {
- REAL_VALUE_TYPE r;
- REAL_VALUE_FROM_CONST_DOUBLE (r, op);
- ASM_OUTPUT_LONG_DOUBLE_OPERAND (file, r);
- }
- else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == DFmode)
- {
- REAL_VALUE_TYPE r;
- REAL_VALUE_FROM_CONST_DOUBLE (r, op);
- ASM_OUTPUT_DOUBLE_OPERAND (file, r);
- }
- else
- {
- asm_fprintf (file, "%0I"); output_addr_const (file, op);
- }
-}
-
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand that is a memory
- reference whose address is ADDR. ADDR is an RTL expression.
-
- Note that this contains a kludge that knows that the only reason
- we have an address (plus (label_ref...) (reg...)) when not generating
- PIC code is in the insn before a tablejump, and we know that m68k.md
- generates a label LInnn: on such an insn.
-
- It is possible for PIC to generate a (plus (label_ref...) (reg...))
- and we handle that just like we would a (plus (symbol_ref...) (reg...)).
-
- Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)"
- fails to assemble. Luckily "Lnnn(pc,d0.l*2)" produces the results
- we want. This difference can be accommodated by using an assembler
- define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other
- string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END
- macro. See m68k/sgs.h for an example; for versions without the bug.
- Some assemblers refuse all the above solutions. The workaround is to
- emit "K(pc,d0.l*2)" with K being a small constant known to give the
- right behaviour.
-
- They also do not like things like "pea 1.w", so we simple leave off
- the .w on small constants.
-
- This routine is responsible for distinguishing between -fpic and -fPIC
- style relocations in an address. When generating -fpic code the
- offset is output in word mode (eg movel a5@(_foo:w), a0). When generating
- -fPIC code the offset is output in long mode (eg movel a5@(_foo:l), a0) */
-
-#ifndef ASM_OUTPUT_CASE_FETCH
-#ifdef MOTOROLA
-#ifdef SGS
-#define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
- asm_fprintf (file, "%LLD%d(%Rpc,%s.", labelno, regname)
-#else
-#define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
- asm_fprintf (file, "%LL%d-%LLI%d.b(%Rpc,%s.", labelno, labelno, regname)
-#endif
-#else
-#define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
- asm_fprintf (file, "%Rpc@(%LL%d-%LLI%d-2:b,%s:", labelno, labelno, regname)
-#endif
-#endif /* ASM_OUTPUT_CASE_FETCH */
-
-void
-print_operand_address (file, addr)
- FILE *file;
- rtx addr;
-{
- register rtx reg1, reg2, breg, ireg;
- rtx offset;
-
- switch (GET_CODE (addr))
- {
- case REG:
-#ifdef MOTOROLA
- fprintf (file, "(%s)", reg_names[REGNO (addr)]);
-#else
- fprintf (file, "%s@", reg_names[REGNO (addr)]);
-#endif
- break;
- case PRE_DEC:
-#ifdef MOTOROLA
- fprintf (file, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]);
-#else
- fprintf (file, "%s@-", reg_names[REGNO (XEXP (addr, 0))]);
-#endif
- break;
- case POST_INC:
-#ifdef MOTOROLA
- fprintf (file, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]);
-#else
- fprintf (file, "%s@+", reg_names[REGNO (XEXP (addr, 0))]);
-#endif
- break;
- case PLUS:
- reg1 = reg2 = ireg = breg = offset = 0;
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0)))
- {
- offset = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)))
- {
- offset = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- if (GET_CODE (addr) != PLUS)
- {
- ;
- }
- else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 0)) == MULT)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == MULT)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 0)) == REG)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT
- || GET_CODE (addr) == SIGN_EXTEND)
- {
- if (reg1 == 0)
- {
- reg1 = addr;
- }
- else
- {
- reg2 = addr;
- }
- addr = 0;
- }
-#if 0 /* for OLD_INDEXING */
- else if (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG)
- {
- reg2 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- {
- reg2 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- }
-#endif
- if (offset != 0)
- {
- if (addr != 0)
- {
- abort ();
- }
- addr = offset;
- }
- if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND
- || GET_CODE (reg1) == MULT))
- || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2))))
- {
- breg = reg2;
- ireg = reg1;
- }
- else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1)))
- {
- breg = reg1;
- ireg = reg2;
- }
- if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF
- && ! (flag_pic && ireg == pic_offset_table_rtx))
- {
- int scale = 1;
- if (GET_CODE (ireg) == MULT)
- {
- scale = INTVAL (XEXP (ireg, 1));
- ireg = XEXP (ireg, 0);
- }
- if (GET_CODE (ireg) == SIGN_EXTEND)
- {
- ASM_OUTPUT_CASE_FETCH (file,
- CODE_LABEL_NUMBER (XEXP (addr, 0)),
- reg_names[REGNO (XEXP (ireg, 0))]);
- fprintf (file, "w");
- }
- else
- {
- ASM_OUTPUT_CASE_FETCH (file,
- CODE_LABEL_NUMBER (XEXP (addr, 0)),
- reg_names[REGNO (ireg)]);
- fprintf (file, "l");
- }
- if (scale != 1)
- {
-#ifdef MOTOROLA
- fprintf (file, "*%d", scale);
-#else
- fprintf (file, ":%d", scale);
-#endif
- }
- putc (')', file);
- break;
- }
- if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF
- && ! (flag_pic && breg == pic_offset_table_rtx))
- {
- ASM_OUTPUT_CASE_FETCH (file,
- CODE_LABEL_NUMBER (XEXP (addr, 0)),
- reg_names[REGNO (breg)]);
- fprintf (file, "l)");
- break;
- }
- if (ireg != 0 || breg != 0)
- {
- int scale = 1;
- if (breg == 0)
- {
- abort ();
- }
- if (! flag_pic && addr && GET_CODE (addr) == LABEL_REF)
- {
- abort ();
- }
-#ifdef MOTOROLA
- if (addr != 0)
- {
- output_addr_const (file, addr);
- if (flag_pic && (breg == pic_offset_table_rtx))
- fprintf (file, "@GOT");
- }
- fprintf (file, "(%s", reg_names[REGNO (breg)]);
- if (ireg != 0)
- {
- putc (',', file);
- }
-#else
- fprintf (file, "%s@(", reg_names[REGNO (breg)]);
- if (addr != 0)
- {
- output_addr_const (file, addr);
- if ((flag_pic == 1) && (breg == pic_offset_table_rtx))
- fprintf (file, ":w");
- if ((flag_pic == 2) && (breg == pic_offset_table_rtx))
- fprintf (file, ":l");
- }
- if (addr != 0 && ireg != 0)
- {
- putc (',', file);
- }
-#endif
- if (ireg != 0 && GET_CODE (ireg) == MULT)
- {
- scale = INTVAL (XEXP (ireg, 1));
- ireg = XEXP (ireg, 0);
- }
- if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND)
- {
-#ifdef MOTOROLA
- fprintf (file, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]);
-#else
- fprintf (file, "%s:w", reg_names[REGNO (XEXP (ireg, 0))]);
-#endif
- }
- else if (ireg != 0)
- {
-#ifdef MOTOROLA
- fprintf (file, "%s.l", reg_names[REGNO (ireg)]);
-#else
- fprintf (file, "%s:l", reg_names[REGNO (ireg)]);
-#endif
- }
- if (scale != 1)
- {
-#ifdef MOTOROLA
- fprintf (file, "*%d", scale);
-#else
- fprintf (file, ":%d", scale);
-#endif
- }
- putc (')', file);
- break;
- }
- else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF
- && ! (flag_pic && reg1 == pic_offset_table_rtx))
- {
- ASM_OUTPUT_CASE_FETCH (file,
- CODE_LABEL_NUMBER (XEXP (addr, 0)),
- reg_names[REGNO (reg1)]);
- fprintf (file, "l)");
- break;
- }
- /* FALL-THROUGH (is this really what we want? */
- default:
- if (GET_CODE (addr) == CONST_INT
- && INTVAL (addr) < 0x8000
- && INTVAL (addr) >= -0x8000)
- {
-#ifdef MOTOROLA
-#ifdef SGS
- /* Many SGS assemblers croak on size specifiers for constants. */
- fprintf (file, "%d", INTVAL (addr));
-#else
- fprintf (file, "%d.w", INTVAL (addr));
-#endif
-#else
- fprintf (file, "%d:w", INTVAL (addr));
-#endif
- }
- else
- {
- output_addr_const (file, addr);
- }
- break;
- }
-}
-
-/* Check for cases where a clr insns can be omitted from code using
- strict_low_part sets. For example, the second clrl here is not needed:
- clrl d0; movw a0@+,d0; use d0; clrl d0; movw a0@+; use d0; ...
-
- MODE is the mode of this STRICT_LOW_PART set. FIRST_INSN is the clear
- insn we are checking for redundancy. TARGET is the register set by the
- clear insn. */
-
-int
-strict_low_part_peephole_ok (mode, first_insn, target)
- enum machine_mode mode;
- rtx first_insn;
- rtx target;
-{
- rtx p;
-
- p = prev_nonnote_insn (first_insn);
-
- while (p)
- {
- /* If it isn't an insn, then give up. */
- if (GET_CODE (p) != INSN)
- return 0;
-
- if (reg_set_p (target, p))
- {
- rtx set = single_set (p);
- rtx dest;
-
- /* If it isn't an easy to recognize insn, then give up. */
- if (! set)
- return 0;
-
- dest = SET_DEST (set);
-
- /* If this sets the entire target register to zero, then our
- first_insn is redundant. */
- if (rtx_equal_p (dest, target)
- && SET_SRC (set) == const0_rtx)
- return 1;
- else if (GET_CODE (dest) == STRICT_LOW_PART
- && GET_CODE (XEXP (dest, 0)) == REG
- && REGNO (XEXP (dest, 0)) == REGNO (target)
- && (GET_MODE_SIZE (GET_MODE (XEXP (dest, 0)))
- <= GET_MODE_SIZE (mode)))
- /* This is a strict low part set which modifies less than
- we are using, so it is safe. */
- ;
- else
- return 0;
- }
-
- p = prev_nonnote_insn (p);
-
- }
-
- return 0;
-}
-
-/* Accept integer operands in the range 0..0xffffffff. We have to check the
- range carefully since this predicate is used in DImode contexts. Also, we
- need some extra crud to make it work when hosted on 64-bit machines. */
-
-int
-const_uint32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
-#if HOST_BITS_PER_WIDE_INT > 32
- /* All allowed constants will fit a CONST_INT. */
- return (GET_CODE (op) == CONST_INT
- && (INTVAL (op) >= 0 && INTVAL (op) <= 0xffffffffL));
-#else
- return ((GET_CODE (op) == CONST_INT && INTVAL (op) >= 0)
- || (GET_CODE (op) == CONST_DOUBLE && CONST_DOUBLE_HIGH (op) == 0));
-#endif
-}
-
-/* Accept integer operands in the range -0x80000000..0x7fffffff. We have
- to check the range carefully since this predicate is used in DImode
- contexts. */
-
-int
-const_sint32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- /* All allowed constants will fit a CONST_INT. */
- return (GET_CODE (op) == CONST_INT
- && (INTVAL (op) >= (-0x7fffffff - 1) && INTVAL (op) <= 0x7fffffff));
-}
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
deleted file mode 100644
index 89212e57356..00000000000
--- a/gcc/config/m68k/m68k.h
+++ /dev/null
@@ -1,2107 +0,0 @@
-/* Definitions of target machine for GNU compiler. Sun 68000/68020 version.
- Copyright (C) 1987, 88, 93, 94, 95, 96, 1997 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. */
-
-
-/* Note that some other tm.h files include this one and then override
- many of the definitions that relate to assembler syntax. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-/* See sun3.h, sun2.h, isi.h for different CPP_PREDEFINES. */
-
-/* Print subsidiary information on the compiler version in use. */
-#ifdef MOTOROLA
-#define TARGET_VERSION fprintf (stderr, " (68k, Motorola syntax)");
-#else
-#define TARGET_VERSION fprintf (stderr, " (68k, MIT syntax)");
-#endif
-
-/* Define SUPPORT_SUN_FPA to include support for generating code for
- the Sun Floating Point Accelerator, an optional product for Sun 3
- machines. By default, it is not defined. Avoid defining it unless
- you need to output code for the Sun3+FPA architecture, as it has the
- effect of slowing down the register set operations in hard-reg-set.h
- (total number of registers will exceed number of bits in a long,
- if defined, causing the set operations to expand to loops).
- SUPPORT_SUN_FPA is typically defined in sun3.h. */
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Compile for a 68020 (not a 68000 or 68010). */
-#define MASK_68020 1
-#define TARGET_68020 (target_flags & MASK_68020)
-
-/* Compile 68881 insns for floating point (not library calls). */
-#define MASK_68881 2
-#define TARGET_68881 (target_flags & MASK_68881)
-
-/* Compile using 68020 bitfield insns. */
-#define MASK_BITFIELD 4
-#define TARGET_BITFIELD (target_flags & MASK_BITFIELD)
-
-/* Compile using rtd insn calling sequence.
- This will not work unless you use prototypes at least
- for all functions that can take varying numbers of args. */
-#define MASK_RTD 8
-#define TARGET_RTD (target_flags & MASK_RTD)
-
-/* Compile passing first two args in regs 0 and 1.
- This exists only to test compiler features that will
- be needed for RISC chips. It is not usable
- and is not intended to be usable on this cpu. */
-#define MASK_REGPARM 16
-#define TARGET_REGPARM (target_flags & MASK_REGPARM)
-
-/* Compile with 16-bit `int'. */
-#define MASK_SHORT 32
-#define TARGET_SHORT (target_flags & MASK_SHORT)
-
-/* Compile with special insns for Sun FPA. */
-#define MASK_FPA 64
-#define TARGET_FPA (target_flags & MASK_FPA)
-
-/* Compile (actually, link) for Sun SKY board. */
-#define MASK_SKY 128
-#define TARGET_SKY (target_flags & MASK_SKY)
-
-/* Optimize for 68040, but still allow execution on 68020
- (-m68020-40 or -m68040).
- The 68040 will execute all 68030 and 68881/2 instructions, but some
- of them must be emulated in software by the OS. When TARGET_68040 is
- turned on, these instructions won't be used. This code will still
- run on a 68030 and 68881/2. */
-#define MASK_68040_ALSO (256)
-#define MASK_68040 (256|512)
-#define TARGET_68040 (target_flags & MASK_68040)
-
-/* Use the 68040-only fp instructions (-m68040 or -m68060). */
-#define MASK_68040_ONLY 512
-#define TARGET_68040_ONLY (target_flags & MASK_68040_ONLY)
-
-/* Optimize for 68060, but still allow execution on 68020
- (-m68060).
- The 68060 will execute all 68030 and 68881/2 instructions, but some
- of them must be emulated in software by the OS. When TARGET_68060 is
- turned on, these instructions won't be used. This code will still
- run on a 68030 and 68881/2. */
-#define MASK_68060 1024
-#define TARGET_68060 (target_flags & MASK_68060)
-
-/* Compile for mcf5200 */
-#define MASK_5200 2048
-#define TARGET_5200 (target_flags & MASK_5200)
-
-/* Compile for a CPU32 */
- /* A 68020 without bitfields is a good heuristic for a CPU32 */
-#define TARGET_CPU32 (TARGET_68020 && !TARGET_BITFIELD)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { { "68020", - (MASK_68060|MASK_68040)}, \
- { "c68020", - (MASK_68060|MASK_68040)}, \
- { "68020", (MASK_68020|MASK_BITFIELD)}, \
- { "c68020", (MASK_68020|MASK_BITFIELD)}, \
- { "68000", - (MASK_68060|MASK_68040|MASK_68020|MASK_BITFIELD)}, \
- { "c68000", - (MASK_68060|MASK_68040|MASK_68020|MASK_BITFIELD)}, \
- { "bitfield", MASK_BITFIELD}, \
- { "nobitfield", - MASK_BITFIELD}, \
- { "rtd", MASK_RTD}, \
- { "nortd", - MASK_RTD}, \
- { "short", MASK_SHORT}, \
- { "noshort", - MASK_SHORT}, \
- { "fpa", -(MASK_SKY|MASK_68040_ONLY|MASK_68881)}, \
- { "fpa", MASK_FPA}, \
- { "nofpa", - MASK_FPA}, \
- { "sky", -(MASK_FPA|MASK_68040_ONLY|MASK_68881)}, \
- { "sky", MASK_SKY}, \
- { "nosky", - MASK_SKY}, \
- { "68881" - (MASK_FPA|MASK_SKY)}, \
- { "68881", MASK_68881}, \
- { "soft-float", - (MASK_FPA|MASK_SKY|MASK_68040_ONLY|MASK_68881)}, \
- { "68020-40", (MASK_BITFIELD|MASK_68881|MASK_68020|MASK_68040_ALSO)}, \
- { "68030", - (MASK_68040|MASK_68060)}, \
- { "68030", (MASK_68020|MASK_BITFIELD)}, \
- { "68040", (MASK_68020|MASK_68881|MASK_BITFIELD|MASK_68040_ONLY)}, \
- { "68060", (MASK_68020|MASK_68881|MASK_BITFIELD \
- |MASK_68040_ONLY|MASK_68060)}, \
- { "5200", - (MASK_68060|MASK_68040|MASK_68020|MASK_BITFIELD|MASK_68881)}, \
- { "5200", (MASK_5200)}, \
- { "68851", 0}, \
- { "no-68851", 0}, \
- { "68302", - (MASK_68060|MASK_68040|MASK_68020|MASK_BITFIELD)}, \
- { "68332", - (MASK_68060|MASK_68040|MASK_BITFIELD)}, \
- { "68332", MASK_68020}, \
- SUBTARGET_SWITCHES \
- { "", TARGET_DEFAULT}}
-/* TARGET_DEFAULT is defined in sun*.h and isi.h, etc. */
-
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
- command options that have values. Its definition is an
- initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- fixed part of the option name, and the address of a variable. The
- variable, type `char *', is set to the variable part of the given
- option if the fixed part matches. The actual option name is made
- by appending `-m' to the specified name. */
-#define TARGET_OPTIONS \
-{ { "align-loops=", &m68k_align_loops_string }, \
- { "align-jumps=", &m68k_align_jumps_string }, \
- { "align-functions=", &m68k_align_funcs_string }, \
- SUBTARGET_OPTIONS \
-}
-
-/* Sometimes certain combinations of command options do not make
- sense on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed.
-
- Don't use this macro to turn on various extra optimizations for
- `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
-
-#define OVERRIDE_OPTIONS \
-{ \
- override_options(); \
- if (! TARGET_68020 && flag_pic == 2) \
- error("-fPIC is not currently supported on the 68000 or 68010\n"); \
- SUBTARGET_OVERRIDE_OPTIONS; \
-}
-
-/* These are meant to be redefined in the host dependent files */
-#define SUBTARGET_SWITCHES
-#define SUBTARGET_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS
-
-/* target machine storage layout */
-
-/* Define for XFmode extended real floating point support.
- This will automatically cause REAL_ARITHMETIC to be defined. */
-#define LONG_DOUBLE_TYPE_SIZE 96
-
-/* Define if you don't want extended real, but do want to use the
- software floating point emulator for REAL_ARITHMETIC and
- decimal <-> binary conversion. */
-/* #define REAL_ARITHMETIC */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is true for 68020 insns such as bfins and bfexts.
- We make it true always by avoiding using the single-bit insns
- except in special cases with constant bit numbers. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is true on the 68000. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-/* For 68000 we can decide arbitrarily
- since there are no machine instructions for them.
- So let's be consistent. */
-#define WORDS_BIG_ENDIAN 1
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY (TARGET_SHORT ? 16 : 32)
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 16
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY (1 << (m68k_align_funcs + 3))
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 16
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 16
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Maximum power of 2 that code can be aligned to. */
-#define MAX_CODE_ALIGN 2 /* 4 byte alignment */
-
-/* Align loop starts for optimal branching. */
-#define ASM_OUTPUT_LOOP_ALIGN(FILE) ASM_OUTPUT_ALIGN ((FILE), m68k_align_loops)
-
-/* This is how to align an instruction for optimal branching. */
-#define ASM_OUTPUT_ALIGN_CODE(FILE) ASM_OUTPUT_ALIGN ((FILE), m68k_align_jumps)
-
-#define SELECT_RTX_SECTION(MODE, X) \
-{ \
- if (!flag_pic) \
- readonly_data_section(); \
- else if (LEGITIMATE_PIC_OPERAND_P (X)) \
- readonly_data_section(); \
- else \
- data_section(); \
-}
-
-/* Define number of bits in most basic integer type.
- (If undefined, default is BITS_PER_WORD). */
-
-#define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
-
-/* Define these to avoid dependence on meaning of `int'.
- Note that WCHAR_TYPE_SIZE is used in cexp.y,
- where TARGET_SHORT is not available. */
-
-#define WCHAR_TYPE "long int"
-#define WCHAR_TYPE_SIZE 32
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
- For the 68000, we give the data registers numbers 0-7,
- the address registers numbers 010-017,
- and the 68881 floating point registers numbers 020-027. */
-#ifndef SUPPORT_SUN_FPA
-#define FIRST_PSEUDO_REGISTER 24
-#else
-#define FIRST_PSEUDO_REGISTER 56
-#endif
-
-/* This defines the register which is used to hold the offset table for PIC. */
-#define PIC_OFFSET_TABLE_REGNUM 13
-
-/* Used to output a (use pic_offset_table_rtx) so that we
- always save/restore a5 in functions that use PIC relocation
- at *any* time during the compilation process. */
-#define FINALIZE_PIC finalize_pic()
-
-#ifndef SUPPORT_SUN_FPA
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the 68000, only the stack pointer is such. */
-
-#define FIXED_REGISTERS \
- {/* Data registers. */ \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- \
- /* Address registers. */ \
- 0, 0, 0, 0, 0, 0, 0, 1, \
- \
- /* Floating point registers \
- (if available). */ \
- 0, 0, 0, 0, 0, 0, 0, 0 }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 0, 0, 0, 0, 0, 0, \
- 1, 1, 0, 0, 0, 0, 0, 1, \
- 1, 1, 0, 0, 0, 0, 0, 0 }
-
-#else /* SUPPORT_SUN_FPA */
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the 68000, only the stack pointer is such. */
-
-/* fpa0 is also reserved so that it can be used to move shit back and
- forth between high fpa regs and everything else. */
-
-#define FIXED_REGISTERS \
- {/* Data registers. */ \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- \
- /* Address registers. */ \
- 0, 0, 0, 0, 0, 0, 0, 1, \
- \
- /* Floating point registers \
- (if available). */ \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- \
- /* Sun3 FPA registers. */ \
- 1, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0 }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 0, 0, 0, 0, 0, 0, \
- 1, 1, 0, 0, 0, 0, 0, 1, \
- 1, 1, 0, 0, 0, 0, 0, 0, \
- /* FPA registers. */ \
- 1, 1, 1, 1, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0 }
-
-#endif /* defined SUPPORT_SUN_FPA */
-
-
-/* Make sure everything's fine if we *don't* have a given processor.
- This assumes that putting a register in fixed_regs will keep the
- compiler's mitts completely off it. We don't bother to zero it out
- of register classes. If neither TARGET_FPA or TARGET_68881 is set,
- the compiler won't touch since no instructions that use these
- registers will be valid. */
-
-#ifdef SUPPORT_SUN_FPA
-
-#define CONDITIONAL_REGISTER_USAGE \
-{ \
- int i; \
- HARD_REG_SET x; \
- if (!TARGET_FPA) \
- { \
- COPY_HARD_REG_SET (x, reg_class_contents[(int)FPA_REGS]); \
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
- if (TEST_HARD_REG_BIT (x, i)) \
- fixed_regs[i] = call_used_regs[i] = 1; \
- } \
- if (TARGET_FPA) \
- { \
- COPY_HARD_REG_SET (x, reg_class_contents[(int)FP_REGS]); \
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
- if (TEST_HARD_REG_BIT (x, i)) \
- fixed_regs[i] = call_used_regs[i] = 1; \
- } \
-}
-
-#endif /* defined SUPPORT_SUN_FPA */
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On the 68000, ordinary registers hold 32 bits worth;
- for the 68881 registers, a single register is always enough for
- anything that can be stored in them at all. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((REGNO) >= 16 ? GET_MODE_NUNITS (MODE) \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-#ifndef SUPPORT_SUN_FPA
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the 68000, the cpu registers can hold any mode but the 68881 registers
- can hold only SFmode or DFmode. The 68881 registers can't hold anything
- if 68881 use is disabled. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (((REGNO) < 16 \
- && !((REGNO) < 8 && (REGNO) + GET_MODE_SIZE ((MODE)) / 4 > 8)) \
- || ((REGNO) < 24 \
- && TARGET_68881 \
- && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)))
-
-#else /* defined SUPPORT_SUN_FPA */
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the 68000, the cpu registers can hold any mode but the 68881 registers
- can hold only SFmode or DFmode. And the 68881 registers can't hold anything
- if 68881 use is disabled. However, the Sun FPA register can
- (apparently) hold whatever you feel like putting in them.
- If using the fpa, don't put a double in d7/a0. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-(((REGNO) < 16 \
- && !(TARGET_FPA \
- && GET_MODE_CLASS ((MODE)) != MODE_INT \
- && GET_MODE_UNIT_SIZE ((MODE)) > 4 \
- && (REGNO) < 8 && (REGNO) + GET_MODE_SIZE ((MODE)) / 4 > 8 \
- && (REGNO) % (GET_MODE_UNIT_SIZE ((MODE)) / 4) != 0)) \
- || ((REGNO) < 24 \
- ? TARGET_68881 && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
- : ((REGNO) < 56 ? TARGET_FPA : 0)))
-
-#endif /* defined SUPPORT_SUN_FPA */
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (! TARGET_68881 \
- || ((GET_MODE_CLASS (MODE1) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
- == (GET_MODE_CLASS (MODE2) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT)))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* m68000 pc isn't overloaded on a register. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 15
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 14
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 0
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 14
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 8
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 9
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The 68000 has three kinds of registers, so eight classes would be
- a complete set. One of them is not needed. */
-
-#ifndef SUPPORT_SUN_FPA
-
-enum reg_class {
- NO_REGS, DATA_REGS,
- ADDR_REGS, FP_REGS,
- GENERAL_REGS, DATA_OR_FP_REGS,
- ADDR_OR_FP_REGS, ALL_REGS,
- LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- { "NO_REGS", "DATA_REGS", \
- "ADDR_REGS", "FP_REGS", \
- "GENERAL_REGS", "DATA_OR_FP_REGS", \
- "ADDR_OR_FP_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ \
- 0x00000000, /* NO_REGS */ \
- 0x000000ff, /* DATA_REGS */ \
- 0x0000ff00, /* ADDR_REGS */ \
- 0x00ff0000, /* FP_REGS */ \
- 0x0000ffff, /* GENERAL_REGS */ \
- 0x00ff00ff, /* DATA_OR_FP_REGS */ \
- 0x00ffff00, /* ADDR_OR_FP_REGS */ \
- 0x00ffffff, /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) (((REGNO)>>3)+1)
-
-#else /* defined SUPPORT_SUN_FPA */
-
-/*
- * Notes on final choices:
- *
- * 1) Didn't feel any need to union-ize LOW_FPA_REGS with anything
- * else.
- * 2) Removed all unions that involve address registers with
- * floating point registers (left in unions of address and data with
- * floating point).
- * 3) Defined GENERAL_REGS as ADDR_OR_DATA_REGS.
- * 4) Defined ALL_REGS as FPA_OR_FP_OR_GENERAL_REGS.
- * 4) Left in everything else.
- */
-enum reg_class { NO_REGS, LO_FPA_REGS, FPA_REGS, FP_REGS,
- FP_OR_FPA_REGS, DATA_REGS, DATA_OR_FPA_REGS, DATA_OR_FP_REGS,
- DATA_OR_FP_OR_FPA_REGS, ADDR_REGS, GENERAL_REGS,
- GENERAL_OR_FPA_REGS, GENERAL_OR_FP_REGS, ALL_REGS,
- LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- { "NO_REGS", "LO_FPA_REGS", "FPA_REGS", "FP_REGS", \
- "FP_OR_FPA_REGS", "DATA_REGS", "DATA_OR_FPA_REGS", "DATA_OR_FP_REGS", \
- "DATA_OR_FP_OR_FPA_REGS", "ADDR_REGS", "GENERAL_REGS", \
- "GENERAL_OR_FPA_REGS", "GENERAL_OR_FP_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ \
- {0, 0}, /* NO_REGS */ \
- {0xff000000, 0x000000ff}, /* LO_FPA_REGS */ \
- {0xff000000, 0x00ffffff}, /* FPA_REGS */ \
- {0x00ff0000, 0x00000000}, /* FP_REGS */ \
- {0xffff0000, 0x00ffffff}, /* FP_OR_FPA_REGS */ \
- {0x000000ff, 0x00000000}, /* DATA_REGS */ \
- {0xff0000ff, 0x00ffffff}, /* DATA_OR_FPA_REGS */ \
- {0x00ff00ff, 0x00000000}, /* DATA_OR_FP_REGS */ \
- {0xffff00ff, 0x00ffffff}, /* DATA_OR_FP_OR_FPA_REGS */\
- {0x0000ff00, 0x00000000}, /* ADDR_REGS */ \
- {0x0000ffff, 0x00000000}, /* GENERAL_REGS */ \
- {0xff00ffff, 0x00ffffff}, /* GENERAL_OR_FPA_REGS */\
- {0x00ffffff, 0x00000000}, /* GENERAL_OR_FP_REGS */\
- {0xffffffff, 0x00ffffff}, /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-extern enum reg_class regno_reg_class[];
-#define REGNO_REG_CLASS(REGNO) (regno_reg_class[(REGNO)>>3])
-
-#endif /* SUPPORT_SUN_FPA */
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS ADDR_REGS
-
-/* Get reg_class from a letter such as appears in the machine description.
- We do a trick here to modify the effective constraints on the
- machine description; we zorch the constraint letters that aren't
- appropriate for a specific target. This allows us to guarantee
- that a specific kind of register will not be used for a given target
- without fiddling with the register classes above. */
-
-#ifndef SUPPORT_SUN_FPA
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'a' ? ADDR_REGS : \
- ((C) == 'd' ? DATA_REGS : \
- ((C) == 'f' ? (TARGET_68881 ? FP_REGS : \
- NO_REGS) : \
- NO_REGS)))
-
-#else /* defined SUPPORT_SUN_FPA */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'a' ? ADDR_REGS : \
- ((C) == 'd' ? DATA_REGS : \
- ((C) == 'f' ? (TARGET_68881 ? FP_REGS : \
- NO_REGS) : \
- ((C) == 'x' ? (TARGET_FPA ? FPA_REGS : \
- NO_REGS) : \
- ((C) == 'y' ? (TARGET_FPA ? LO_FPA_REGS : \
- NO_REGS) : \
- NO_REGS)))))
-
-#endif /* defined SUPPORT_SUN_FPA */
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For the 68000, `I' is used for the range 1 to 8
- allowed as immediate shift counts and in addq.
- `J' is used for the range of signed numbers that fit in 16 bits.
- `K' is for numbers that moveq can't handle.
- `L' is for range -8 to -1, range of values that can be added with subq.
- `M' is for numbers that moveq+notb can't handle.
- 'N' is for range 24 to 31, rotatert:SI 8 to 1 expressed as rotate.
- 'O' is for 16 (for rotate using swap).
- 'P' is for range 8 to 15, rotatert:HI 8 to 1 expressed as rotate. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 : \
- (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
- (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 : \
- (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 : \
- (C) == 'M' ? (VALUE) < -0x100 && (VALUE) >= 0x100 : \
- (C) == 'N' ? (VALUE) >= 24 && (VALUE) <= 31 : \
- (C) == 'O' ? (VALUE) == 16 : \
- (C) == 'P' ? (VALUE) >= 8 && (VALUE) <= 15 : 0)
-
-/*
- * A small bit of explanation:
- * "G" defines all of the floating constants that are *NOT* 68881
- * constants. this is so 68881 constants get reloaded and the
- * fpmovecr is used. "H" defines *only* the class of constants that
- * the fpa can use, because these can be gotten at in any fpa
- * instruction and there is no need to force reloads.
- */
-#ifndef SUPPORT_SUN_FPA
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 0 )
-#else /* defined SUPPORT_SUN_FPA */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : \
- (C) == 'H' ? (TARGET_FPA && standard_sun_fpa_constant_p (VALUE)) : 0)
-#endif /* defined SUPPORT_SUN_FPA */
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
- On the 68000 series, use a data reg if possible when the
- value is a constant in the range where moveq could be used
- and we ensure that QImodes are reloaded into data regs.
- Also, if a floating constant needs reloading, put it in memory.
- Don't do this for !G constants, since all patterns in the md file
- expect them to be loaded into a register via fpmovecr. See above. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- ((GET_CODE (X) == CONST_INT \
- && (unsigned) (INTVAL (X) + 0x80) < 0x100 \
- && (CLASS) != ADDR_REGS) \
- ? DATA_REGS \
- : (GET_MODE (X) == QImode && (CLASS) != ADDR_REGS) \
- ? DATA_REGS \
- : (GET_CODE (X) == CONST_DOUBLE \
- && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
- ? (! CONST_DOUBLE_OK_FOR_LETTER_P (X, 'G') \
- && (CLASS == FP_REGS || CLASS == DATA_OR_FP_REGS) \
- ? FP_REGS : NO_REGS) \
- : (CLASS))
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On the 68000, this is the size of MODE in words,
- except in the FP regs, where a single reg is always enough. */
-#ifndef SUPPORT_SUN_FPA
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FP_REGS ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Moves between fp regs and other regs are two insns. */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- (((CLASS1) == FP_REGS && (CLASS2) != FP_REGS) \
- || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS) \
- ? 4 : 2)
-
-#else /* defined SUPPORT_SUN_FPA */
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FP_REGS || (CLASS) == FPA_REGS || (CLASS) == LO_FPA_REGS ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Moves between fp regs and other regs are two insns. */
-/* Likewise for high fpa regs and other regs. */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- ((((CLASS1) == FP_REGS && (CLASS2) != FP_REGS) \
- || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS) \
- || ((CLASS1) == FPA_REGS && (CLASS2) != FPA_REGS) \
- || ((CLASS2) == FPA_REGS && (CLASS1) != FPA_REGS)) \
- ? 4 : 2)
-
-#endif /* define SUPPORT_SUN_FPA */
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* Nonzero if we need to generate stack-probe insns.
- On most systems they are not needed.
- When they are needed, define this as the stack offset to probe at. */
-#define NEED_PROBE 0
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On the 68000, sp@- in a byte insn really pushes a word. */
-#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 8
-
-/* Value is the number of byte of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the 68000, the RTS insn cannot pop anything.
- On the 68010, the RTD insn may be used to pop them if the number
- of args is fixed, but if the number is variable then the caller
- must pop them all. RTD can't be used for library calls now
- because the library is compiled with the Unix compiler.
- Use of RTD is a selectable option, since it is incompatible with
- standard Unix calling sequences. If the option is not selected,
- the caller must always pop the args. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((TARGET_RTD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE) \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) \
- ? (SIZE) : 0)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On the 68000 the return value is in D0 regardless. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-/* On the 68000 the return value is in D0 regardless. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
-
-/* 1 if N is a possible register number for a function value.
- On the 68000, d0 is the only register thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
- more than one register. */
-
-#define NEEDS_UNTYPED_CALL 0
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-#define PCC_STATIC_STRUCT_RETURN
-
-/* 1 if N is a possible register number for function argument passing.
- On the 68000, no registers are used in this way. */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the m68k, this is a single integer, which is a number of bytes
- of arguments scanned so far. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the m68k, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the 68000 all args are pushed, except if -mregparm is specified
- then the first two words of arguments are passed in d0, d1.
- *NOTE* -mregparm does not work.
- It exists only to test register calling conventions. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-((TARGET_REGPARM && (CUM) < 8) ? gen_rtx (REG, (MODE), (CUM) / 4) : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
-((TARGET_REGPARM && (CUM) < 8 \
- && 8 < ((CUM) + ((MODE) == BLKmode \
- ? int_size_in_bytes (TYPE) \
- : GET_MODE_SIZE (MODE)))) \
- ? 2 - (CUM) / 4 : 0)
-
-/* Generate the assembly code for function entry. */
-#define FUNCTION_PROLOGUE(FILE, SIZE) output_function_prologue(FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- asm_fprintf (FILE, "\tlea %LLP%d,%Ra0\n\tjsr mcount\n", (LABELNO))
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-
-#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
-do \
- { \
- switch (profile_block_flag) \
- { \
- case 2: \
- asm_fprintf (FILE, "\tpea %d\n\tpea %LLPBX0\n\tjsr %U__bb_init_trace_func\n\taddql %I8,%Rsp\n", \
- (BLOCK_OR_LABEL)); \
- break; \
- \
- default: \
- asm_fprintf (FILE, "\ttstl %LLPBX0\n\tbne %LLPI%d\n\tpea %LLPBX0\n\tjsr %U__bb_init_func\n\taddql %I4,%Rsp\n%LLPI%d:\n", \
- (BLOCK_OR_LABEL), (BLOCK_OR_LABEL)); \
- break; \
- } \
- } \
-while(0)
-
-/* Output assembler code to FILE to increment the counter for
- the BLOCKNO'th basic block in this source file. */
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
-do \
- { \
- switch (profile_block_flag) \
- { \
- case 2: \
- asm_fprintf (FILE, "\tmovel %Ra1,%Rsp@-\n\tlea ___bb,%Ra1\n\tmovel %I%d,%Ra1@(0)\n\tmovel %I%LLPBX0,%Ra1@(4)\n\tmovel %Rsp@+,%Ra1\n\tjsr %U__bb_trace_func\n", \
- BLOCKNO); \
- break; \
- \
- default: \
- asm_fprintf (FILE, "\taddql %I1,%LLPBX2+%d\n", 4 * BLOCKNO); \
- break; \
- } \
- } \
-while(0)
-
-/* Output assembler code to FILE to indicate return from
- a function during basic block profiling. */
-
-#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \
- asm_fprintf (FILE, "\tjsr %U__bb_trace_ret\n");
-
-/* Save all registers which may be clobbered by a function call. */
-
-#ifdef MOTOROLA
-#define MACHINE_STATE_SAVE(id) \
- asm ("move.w %ccr,-(%sp)"); \
- asm ("movm.l &0xc0c0,-(%sp)");
-#else
-#define MACHINE_STATE_SAVE(id) \
- asm ("movew cc,sp@-"); \
- asm ("moveml d0/d1/a0/a1,sp@-");
-#endif
-
-/* Restore all registers saved by MACHINE_STATE_SAVE. */
-
-#ifdef MOTOROLA
-#define MACHINE_STATE_RESTORE(id) \
- asm ("movm.l (%sp)+,&0x0303"); \
- asm ("move.w (%sp)+,%ccr");
-#else
-#define MACHINE_STATE_RESTORE(id) \
- asm ("moveml sp@+,d0/d1/a0/a1"); \
- asm ("movew sp@+,cc");
-#endif
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* Generate the assembly code for function exit. */
-#define FUNCTION_EPILOGUE(FILE, SIZE) output_function_epilogue (FILE, SIZE)
-
-/* This is a hook for other tm files to change. */
-/* #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) */
-
-/* Determine if the epilogue should be output as RTL.
- You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
-#define USE_RETURN_INSN use_return_insn ()
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved.
-
- On the 68k, if we have a frame, we must add one word to its length
- to allow for the place that a6 is stored when we do have a frame pointer.
- Otherwise, we would need to compute the offset from the frame pointer
- of a local variable as a function of frame_pointer_needed, which
- is hard. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
-{ int regno; \
- int offset = -4; \
- for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 12; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 4; \
- (DEPTH) = (offset + ((get_frame_size () + 3) & -4) \
- + (get_frame_size () == 0 ? 0 : 4)); \
-}
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On the 68k, the trampoline looks like this:
- movl #STATIC,a0
- jmp FUNCTION
-
- WARNING: Targets that may run on 68040+ cpus must arrange for
- the instruction cache to be flushed. Previous incarnations of
- the m68k trampoline code attempted to get around this by either
- using an out-of-line transfer function or pc-relative data, but
- the fact remains that the code to jump to the transfer function
- or the code to load the pc-relative data needs to be flushed
- just as much as the "variable" portion of the trampoline.
- Recognizing that a cache flush is going to be required anyway,
- dispense with such notions and build a smaller trampoline. */
-
-/* Since more instructions are required to move a template into
- place than to create it on the spot, don't use a template. */
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 12
-
-/* Alignment required for a trampoline in bits. */
-
-#define TRAMPOLINE_ALIGNMENT 16
-
-/* Targets redefine this to invoke code to either flush the cache,
- or enable stack execution (or both). */
-
-#ifndef FINALIZE_TRAMPOLINE
-#define FINALIZE_TRAMPOLINE(TRAMP)
-#endif
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, HImode, TRAMP), GEN_INT(0x207C)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 2)), CXT); \
- emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 6)), \
- GEN_INT(0x4EF9)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 8)), FNADDR); \
- FINALIZE_TRAMPOLINE(TRAMP); \
-}
-
-/* This is the library routine that is used
- to transfer control from the trampoline
- to the actual nested function.
- It is defined for backward compatibility,
- for linking with object code that used the old
- trampoline definition. */
-
-/* A colon is used with no explicit operands
- to cause the template string to be scanned for %-constructs. */
-/* The function name __transfer_from_trampoline is not actually used.
- The function definition just permits use of "asm with operands"
- (though the operand list is empty). */
-#define TRANSFER_FROM_TRAMPOLINE \
-void \
-__transfer_from_trampoline () \
-{ \
- register char *a0 asm ("%a0"); \
- asm (GLOBAL_ASM_OP " ___trampoline"); \
- asm ("___trampoline:"); \
- asm volatile ("move%.l %0,%@" : : "m" (a0[22])); \
- asm volatile ("move%.l %1,%0" : "=a" (a0) : "m" (a0[18])); \
- asm ("rts":); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-#define HAVE_POST_INCREMENT
-/* #define HAVE_POST_DECREMENT */
-
-#define HAVE_PRE_DECREMENT
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
-((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-(((REGNO) ^ 010) < 8 || (unsigned) (reg_renumber[REGNO] ^ 010) < 8)
-#define REGNO_OK_FOR_DATA_P(REGNO) \
-((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
-#define REGNO_OK_FOR_FP_P(REGNO) \
-(((REGNO) ^ 020) < 8 || (unsigned) (reg_renumber[REGNO] ^ 020) < 8)
-#ifdef SUPPORT_SUN_FPA
-#define REGNO_OK_FOR_FPA_P(REGNO) \
-(((REGNO) >= 24 && (REGNO) < 56) || (reg_renumber[REGNO] >= 24 && reg_renumber[REGNO] < 56))
-#endif
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-
- These macros are specific to the 68000, and may be used only
- in code for printing assembler insns and in conditions for
- define_optimization. */
-
-/* 1 if X is a data register. */
-
-#define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
-
-/* 1 if X is an fp register. */
-
-#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
-
-/* 1 if X is an address register */
-
-#define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
-
-#ifdef SUPPORT_SUN_FPA
-/* 1 if X is a register in the Sun FPA. */
-#define FPA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FPA_P (REGNO (X)))
-#else
-/* Answer must be no if we don't have an FPA. */
-#define FPA_REG_P(X) 0
-#endif
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* Nonzero if the constant value X is a legitimate general operand
- when generating PIC code. It is given that flag_pic is on and
- that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_PIC_OPERAND_P(X) \
- ((! symbolic_operand (X, VOIDmode) \
- && ! (GET_CODE (X) == CONST_DOUBLE && CONST_DOUBLE_MEM (X) \
- && GET_CODE (CONST_DOUBLE_MEM (X)) == MEM \
- && symbolic_operand (XEXP (CONST_DOUBLE_MEM (X), 0), \
- VOIDmode))) \
- || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)))
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) ((REGNO (X) ^ 020) >= 8)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~027) != 0)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- When generating PIC, an address involving a SYMBOL_REF is legitimate
- if and only if it is the sum of pic_offset_table_rtx and the SYMBOL_REF.
- We use LEGITIMATE_PIC_OPERAND_P to throw out the illegitimate addresses,
- and we explicitly check for the sum of pic_offset_table_rtx and a SYMBOL_REF.
-
- Likewise for a LABEL_REF when generating PIC.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
-
-/* Allow SUBREG everywhere we allow REG. This results in better code. It
- also makes function inlining work when inline functions are called with
- arguments that are SUBREGs. */
-
-#define LEGITIMATE_BASE_REG_P(X) \
- ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
-
-#define INDIRECTABLE_1_ADDRESS_P(X) \
- ((CONSTANT_ADDRESS_P (X) && (!flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \
- || LEGITIMATE_BASE_REG_P (X) \
- || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
- && LEGITIMATE_BASE_REG_P (XEXP (X, 0))) \
- || (GET_CODE (X) == PLUS \
- && LEGITIMATE_BASE_REG_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000) \
- || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \
- && flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF) \
- || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \
- && flag_pic && GET_CODE (XEXP (X, 1)) == LABEL_REF)) \
-
-#if 0
-/* This should replace the last two (non-pic) lines
- except that Sun's assembler does not seem to handle such operands. */
- && (TARGET_68020 ? CONSTANT_ADDRESS_P (XEXP (X, 1)) \
- : (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))))
-#endif
-
-
-#define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
-{ if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; }
-
-/* Only labels on dispatch tables are valid for indexing from. */
-#define GO_IF_INDEXABLE_BASE(X, ADDR) \
-{ rtx temp; \
- if (GET_CODE (X) == LABEL_REF \
- && (temp = next_nonnote_insn (XEXP (X, 0))) != 0 \
- && GET_CODE (temp) == JUMP_INSN \
- && (GET_CODE (PATTERN (temp)) == ADDR_VEC \
- || GET_CODE (PATTERN (temp)) == ADDR_DIFF_VEC)) \
- goto ADDR; \
- if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; }
-
-#define GO_IF_INDEXING(X, ADDR) \
-{ if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0))) \
- { GO_IF_INDEXABLE_BASE (XEXP (X, 1), ADDR); } \
- if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1))) \
- { GO_IF_INDEXABLE_BASE (XEXP (X, 0), ADDR); } }
-
-#define GO_IF_INDEXED_ADDRESS(X, ADDR) \
-{ GO_IF_INDEXING (X, ADDR); \
- if (GET_CODE (X) == PLUS) \
- { if (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100) \
- { rtx go_temp = XEXP (X, 0); GO_IF_INDEXING (go_temp, ADDR); } \
- if (GET_CODE (XEXP (X, 0)) == CONST_INT \
- && (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100) \
- { rtx go_temp = XEXP (X, 1); GO_IF_INDEXING (go_temp, ADDR); } } }
-
-#define LEGITIMATE_INDEX_REG_P(X) \
- ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
- || (GET_CODE (X) == SIGN_EXTEND \
- && GET_CODE (XEXP (X, 0)) == REG \
- && GET_MODE (XEXP (X, 0)) == HImode \
- && REG_OK_FOR_INDEX_P (XEXP (X, 0))) \
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
-
-#define LEGITIMATE_INDEX_P(X) \
- (LEGITIMATE_INDEX_REG_P (X) \
- || ((TARGET_68020 || TARGET_5200) && GET_CODE (X) == MULT \
- && LEGITIMATE_INDEX_REG_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (INTVAL (XEXP (X, 1)) == 2 \
- || INTVAL (XEXP (X, 1)) == 4 \
- || (INTVAL (XEXP (X, 1)) == 8 && !TARGET_5200))))
-
-/* If pic, we accept INDEX+LABEL, which is what do_tablejump makes. */
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
- GO_IF_INDEXED_ADDRESS (X, ADDR); \
- if (flag_pic && MODE == CASE_VECTOR_MODE && GET_CODE (X) == PLUS \
- && LEGITIMATE_INDEX_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 1)) == LABEL_REF) \
- goto ADDR; }
-
-/* Don't call memory_address_noforce for the address to fetch
- the switch offset. This address is ok as it stands (see above),
- but memory_address_noforce would alter it. */
-#define PIC_CASE_VECTOR_ADDRESS(index) index
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the 68000, we handle X+REG by loading X into a register R and
- using R+REG. R will go in an address reg and indexing will be used.
- However, if REG is a broken-out memory address or multiplication,
- nothing needs to be done because REG can certainly go in an address reg. */
-
-#define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ register int ch = (X) != (OLDX); \
- if (GET_CODE (X) == PLUS) \
- { int copied = 0; \
- if (GET_CODE (XEXP (X, 0)) == MULT) \
- { COPY_ONCE (X); XEXP (X, 0) = force_operand (XEXP (X, 0), 0);} \
- if (GET_CODE (XEXP (X, 1)) == MULT) \
- { COPY_ONCE (X); XEXP (X, 1) = force_operand (XEXP (X, 1), 0);} \
- if (ch && GET_CODE (XEXP (X, 1)) == REG \
- && GET_CODE (XEXP (X, 0)) == REG) \
- goto WIN; \
- if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); } \
- if (GET_CODE (XEXP (X, 0)) == REG \
- || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
- && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode)) \
- { register rtx temp = gen_reg_rtx (Pmode); \
- register rtx val = force_operand (XEXP (X, 1), 0); \
- emit_move_insn (temp, val); \
- COPY_ONCE (X); \
- XEXP (X, 1) = temp; \
- goto WIN; } \
- else if (GET_CODE (XEXP (X, 1)) == REG \
- || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND \
- && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \
- && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode)) \
- { register rtx temp = gen_reg_rtx (Pmode); \
- register rtx val = force_operand (XEXP (X, 0), 0); \
- emit_move_insn (temp, val); \
- COPY_ONCE (X); \
- XEXP (X, 0) = temp; \
- goto WIN; }}}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the 68000, only predecrement and postincrement address depend thus
- (the amount of decrement or increment being the length of the operand). */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE HImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-#define CASE_VECTOR_PC_RELATIVE
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Don't cse the address of the function being compiled. */
-#define NO_RECURSIVE_FUNCTION_CSE
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-#define SLOW_ZERO_EXTEND
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE -1
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- /* Constant zero is super cheap due to clr instruction. */ \
- if (RTX == const0_rtx) return 0; \
- /* if ((OUTER_CODE) == SET) */ \
- return const_int_cost(RTX); \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 3; \
- case CONST_DOUBLE: \
- return 5;
-
-/* Compute the cost of various arithmetic operations.
- These are vaguely right for a 68020. */
-/* The costs for long multiply have been adjusted to
- work properly in synth_mult on the 68020,
- relative to an average of the time for add and the time for shift,
- taking away a little more because sometimes move insns are needed. */
-/* div?.w is relatively cheaper on 68000 counted in COSTS_N_INSNS terms. */
-#define MULL_COST (TARGET_68060 ? 2 : TARGET_68040 ? 5 : 13)
-#define MULW_COST (TARGET_68060 ? 2 : TARGET_68040 ? 3 : TARGET_68020 ? 8 : 5)
-#define DIVW_COST (TARGET_68020 ? 27 : 12)
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case PLUS: \
- /* An lea costs about three times as much as a simple add. */ \
- if (GET_MODE (X) == SImode \
- && GET_CODE (XEXP (X, 1)) == REG \
- && GET_CODE (XEXP (X, 0)) == MULT \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
- && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
- && (INTVAL (XEXP (XEXP (X, 0), 1)) == 2 \
- || INTVAL (XEXP (XEXP (X, 0), 1)) == 4 \
- || INTVAL (XEXP (XEXP (X, 0), 1)) == 8)) \
- return COSTS_N_INSNS (3); /* lea an@(dx:l:i),am */ \
- break; \
- case ASHIFT: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- if (TARGET_68060) \
- return COSTS_N_INSNS(1); \
- if (! TARGET_68020) \
- { \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
- { \
- if (INTVAL (XEXP (X, 1)) < 16) \
- return COSTS_N_INSNS (2) + INTVAL (XEXP (X, 1)) / 2; \
- else \
- /* We're using clrw + swap for these cases. */ \
- return COSTS_N_INSNS (4) + (INTVAL (XEXP (X, 1)) - 16) / 2; \
- } \
- return COSTS_N_INSNS (10); /* worst case */ \
- } \
- /* A shift by a big integer takes an extra instruction. */ \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (INTVAL (XEXP (X, 1)) == 16)) \
- return COSTS_N_INSNS (2); /* clrw;swap */ \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && !(INTVAL (XEXP (X, 1)) > 0 \
- && INTVAL (XEXP (X, 1)) <= 8)) \
- return COSTS_N_INSNS (3); /* lsr #i,dn */ \
- break; \
- case MULT: \
- if ((GET_CODE (XEXP (X, 0)) == ZERO_EXTEND \
- || GET_CODE (XEXP (X, 0)) == SIGN_EXTEND) \
- && GET_MODE (X) == SImode) \
- return COSTS_N_INSNS (MULW_COST); \
- if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \
- return COSTS_N_INSNS (MULW_COST); \
- else \
- return COSTS_N_INSNS (MULL_COST); \
- case DIV: \
- case UDIV: \
- case MOD: \
- case UMOD: \
- if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \
- return COSTS_N_INSNS (DIVW_COST); /* div.w */ \
- return COSTS_N_INSNS (43); /* div.l */
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-/* Set if the cc value is actually in the 68881, so a floating point
- conditional branch must be output. */
-#define CC_IN_68881 04000
-
-/* Store in cc_status the expressions that the condition codes will
- describe after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-/* On the 68000, all the insns to store in an address register fail to
- set the cc's. However, in some cases these instructions can make it
- possibly invalid to use the saved cc's. In those cases we clear out
- some or all of the saved cc's so they won't be used. */
-
-#define NOTICE_UPDATE_CC(EXP,INSN) notice_update_cc (EXP, INSN)
-
-#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
-{ if (cc_prev_status.flags & CC_IN_68881) \
- return FLOAT; \
- if (cc_prev_status.flags & CC_NO_OVERFLOW) \
- return NO_OV; \
- return NORMAL; }
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) \
- fprintf (FILE, "#NO_APP\n");
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "#APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* Here are four prefixes that are used by asm_fprintf to
- facilitate customization for alternate assembler syntaxes.
- Machines with no likelihood of an alternate syntax need not
- define these and need not use asm_fprintf. */
-
-/* The prefix for register names. Note that REGISTER_NAMES
- is supposed to include this prefix. */
-
-#define REGISTER_PREFIX ""
-
-/* The prefix for local labels. You should be able to define this as
- an empty string, or any arbitrary string (such as ".", ".L%", etc)
- without having to make any other changes to account for the specific
- definition. Note it is a string literal, not interpreted by printf
- and friends. */
-
-#define LOCAL_LABEL_PREFIX ""
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* The prefix for immediate operands. */
-
-#define IMMEDIATE_PREFIX "#"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#ifndef SUPPORT_SUN_FPA
-
-#define REGISTER_NAMES \
-{"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
- "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
- "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7" }
-
-#else /* SUPPORTED_SUN_FPA */
-
-#define REGISTER_NAMES \
-{"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
- "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
- "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \
- "fpa0", "fpa1", "fpa2", "fpa3", "fpa4", "fpa5", "fpa6", "fpa7", \
- "fpa8", "fpa9", "fpa10", "fpa11", "fpa12", "fpa13", "fpa14", "fpa15", \
- "fpa16", "fpa17", "fpa18", "fpa19", "fpa20", "fpa21", "fpa22", "fpa23", \
- "fpa24", "fpa25", "fpa26", "fpa27", "fpa28", "fpa29", "fpa30", "fpa31" }
-
-#endif /* defined SUPPORT_SUN_FPA */
-
-/* How to renumber registers for dbx and gdb.
- On the Sun-3, the floating point registers have numbers
- 18 to 25, not 16 to 23 as they do in the compiler. */
-
-#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define GLOBAL_ASM_OP ".globl"
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fprintf (FILE, "%s ", GLOBAL_ASM_OP); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE);} while (0)
-
-/* This is how to output a reference to a user-level label named NAME.
- `assemble_name' uses this. */
-
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- asm_fprintf (FILE, "%0U%s", NAME)
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
-
-/* This is how to output a `long double' extended real constant. */
-
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long l[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "\t.long 0x%x,0x%x,0x%x\n", l[0], l[1], l[2]); \
- else \
- fprintf (FILE, "\t.long 0x%lx,0x%lx,0x%lx\n", l[0], l[1], l[2]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- fprintf (FILE, "\t.double 0r%s\n", dstr); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- fprintf (FILE, "\t.long 0x%x\n", l); \
- else \
- fprintf (FILE, "\t.long 0x%lx\n", l); \
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- asm_fprintf (FILE, "\tmovel %s,%Rsp@-\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- asm_fprintf (FILE, "\tmovel %Rsp@+,%s\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute.
- (The 68000 does not use such vectors,
- but we must define this macro anyway.) */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- asm_fprintf (FILE, "\t.long %LL%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- asm_fprintf (FILE, "\t.word %LL%d-%LL%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-/* We don't have a way to align to more than a two-byte boundary, so do the
- best we can and don't complain. */
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) >= 1) \
- fprintf (FILE, "\t.even\n");
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.skip %u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Output a float value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { \
- if (CODE == 'f') \
- { \
- char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
- asm_fprintf ((FILE), "%I0r%s", dstr); \
- } \
- else \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- asm_fprintf ((FILE), "%I0x%x", l); \
- else \
- asm_fprintf ((FILE), "%I0x%lx", l); \
- } \
- } while (0)
-
-/* Output a double value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- asm_fprintf (FILE, "%I0r%s", dstr); \
- } while (0)
-
-/* Note, long double immediate operands are not actually
- generated by m68k.md. */
-#define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- asm_fprintf (FILE, "%I0r%s", dstr); \
- } while (0)
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
-
- On the 68000, we use several CODE characters:
- '.' for dot needed in Motorola-style opcode names.
- '-' for an operand pushing on the stack:
- sp@-, -(sp) or -(%sp) depending on the style of syntax.
- '+' for an operand pushing on the stack:
- sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
- '@' for a reference to the top word on the stack:
- sp@, (sp) or (%sp) depending on the style of syntax.
- '#' for an immediate operand prefix (# in MIT and Motorola syntax
- but & in SGS syntax).
- '!' for the fpcr register (used in some float-to-fixed conversions).
- '$' for the letter `s' in an op code, but only on the 68040.
- '&' for the letter `d' in an op code, but only on the 68040.
- '/' for register prefix needed by longlong.h.
-
- 'b' for byte insn (no effect, on the Sun; this is for the ISI).
- 'd' to force memory addressing to be absolute, not relative.
- 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
- 'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
- than directly). Second part of 'y' below.
- 'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
- or print pair of registers as rx:ry.
- 'y' for a FPA insn (print pair of registers as rx:ry). This also outputs
- CONST_DOUBLE's as SunFPA constant RAM registers if
- possible, so it should not be used except for the SunFPA. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '.' || (CODE) == '#' || (CODE) == '-' \
- || (CODE) == '+' || (CODE) == '@' || (CODE) == '!' \
- || (CODE) == '$' || (CODE) == '&' || (CODE) == '/')
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand X. X is an RTL
- expression.
-
- CODE is a value that can be used to specify one of several ways
- of printing the operand. It is used when identical operands
- must be printed differently depending on the context. CODE
- comes from the `%' specification that was used to request
- printing of the operand. If the specification was just `%DIGIT'
- then CODE is 0; if the specification was `%LTR DIGIT' then CODE
- is the ASCII code for LTR.
-
- If X is a register, this macro should print the register's name.
- The names can be found in an array `reg_names' whose type is
- `char *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
-
- When the machine description has a specification `%PUNCT' (a `%'
- followed by a punctuation character), this macro is called with
- a null pointer for X and the punctuation character for CODE.
-
- See m68k.c for the m68k specific codes. */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand that is a memory
- reference whose address is ADDR. ADDR is an RTL expression.
-
- On some machines, the syntax for a symbolic address depends on
- the section that the address refers to. On these machines,
- define the macro `ENCODE_SECTION_INFO' to store the information
- into the `symbol_ref', and then check for it here. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
-
-/* Definitions for generating bytecode */
-
-/* Just so it's known this target is supported by the bytecode generator.
- If this define isn't found anywhere in the target config files, then
- dummy stubs are supplied by bytecode.h, and any attempt to use
- -fbytecode will result in an error message. */
-
-#define TARGET_SUPPORTS_BYTECODE
-
-/* Minimal segment alignment within sections is 8 units. */
-#define MACHINE_SEG_ALIGN 3
-
-/* Integer alignment is two units. */
-#define INT_ALIGN 2
-
-/* Pointer alignment is eight units. */
-#define PTR_ALIGN 3
-
-/* Global symbols begin with `_' */
-#define NAMES_HAVE_UNDERSCORES
-
-/* BC_xxx below are similar to their ASM_xxx counterparts above. */
-#define BC_GLOBALIZE_LABEL(FP, NAME) bc_globalize_label(NAME)
-
-#define BC_OUTPUT_COMMON(FP, NAME, SIZE, ROUNDED) \
- do { bc_emit_common(NAME, ROUNDED); bc_globalize_label(NAME); } while (0)
-
-#define BC_OUTPUT_BSS(FP, NAME, SIZE, ROUNDED) \
- do { bc_data (); bc_emit_labeldef(NAME); bc_emit_skip (SIZE); } while (0)
-
-#define BC_OUTPUT_LOCAL(FP, NAME, SIZE, ROUNDED) \
- bc_emit_common(NAME, ROUNDED)
-
-#define BC_OUTPUT_ALIGN(FP, ALIGN) bc_align(ALIGN)
-
-#define BC_OUTPUT_LABEL(FP, NAME) bc_emit_labeldef(NAME)
-
-#define BC_OUTPUT_SKIP(FP, SIZE) bc_emit_skip(SIZE)
-
-#define BC_OUTPUT_LABELREF(FP, NAME) \
- do { \
- char *foo = (char *) xmalloc(strlen(NAME) + 2); \
- strcpy(foo, "_"); \
- strcat(foo, NAME); \
- bc_emit_labelref (foo); \
- free (foo); \
- } while (0)
-
-#define BC_OUTPUT_FLOAT(FP, VAL) \
- do { \
- float F = VAL; \
- bc_emit ((char *) &F, sizeof F); \
- } while (0)
-
-#define BC_OUTPUT_DOUBLE(FP, VAL) \
- do { \
- double D = VAL; \
- bc_emit ((char *) &D, sizeof D); \
- } while (0)
-
-#define BC_OUTPUT_BYTE(FP, VAL) \
- do { \
- char C = VAL; \
- bc_emit (&C, 1); \
- } while (0)
-
-
-#define BC_OUTPUT_FILE ASM_OUTPUT_FILE
-#define BC_OUTPUT_ASCII ASM_OUTPUT_ASCII
-#define BC_OUTPUT_IDENT ASM_OUTPUT_IDENT
-
-/* Same as XSTR, but for bytecode */
-#define BCXSTR(RTX) ((RTX)->bc_label)
-
-
-/* Flush bytecode buffer onto file */
-#define BC_WRITE_FILE(FP) \
-{ \
- fprintf (FP, ".text\n"); \
- bc_seg_write (bc_text_seg, FP); \
- fprintf(FP, "\n.data\n"); \
- bc_seg_write (bc_data_seg, FP); \
- bc_sym_write (FP); /* do .globl, .bss, etc. */ \
-}
-
-/* Write one symbol */
-#define BC_WRITE_SEGSYM(SEGSYM, FP) \
-{ \
- prsym (FP, (SEGSYM)->sym->name); \
- fprintf (FP, ":\n"); \
-}
-
-
-/* Write one reloc entry */
-#define BC_WRITE_RELOC_ENTRY(SEGRELOC, FP, OFFSET) \
-{ \
- fprintf (FP, "\t.long "); \
- prsym (FP, (SEGRELOC)->sym->name); \
- fprintf (FP, " + %d\n", OFFSET); \
-}
-
-/* Start new line of bytecodes */
-#define BC_START_BYTECODE_LINE(FP) \
-{ \
- fprintf (FP, "\t.byte"); \
-}
-
-/* Write one bytecode */
-#define BC_WRITE_BYTECODE(SEP, VAL, FP) \
-{ \
- fprintf (FP, "%c0x%02X", (SEP), (VAL) & 0xff); \
-}
-
-/* Write one bytecode RTL entry */
-#define BC_WRITE_RTL(R, FP) \
-{ \
- fprintf (FP, "%s+%d/0x%08X\n", (R)->label, (R)->offset, (R)->bc_label); \
-}
-
-
-/* Emit function entry trampoline */
-#define BC_EMIT_TRAMPOLINE(TRAMPSEG, CALLINFO) \
-{ \
- short insn; \
- \
- /* Push a reference to the callinfo structure. */ \
- insn = 0x4879; /* pea xxx.L */ \
- seg_data (TRAMPSEG, (char *) &insn, sizeof insn); \
- seg_refsym (TRAMPSEG, CALLINFO, 0); \
- \
- /* Call __interp, pop arguments, and return. */ \
- insn = 0x4eb9; /* jsr xxx.L */ \
- seg_data (TRAMPSEG, (char *) &insn, sizeof insn); \
- seg_refsym (TRAMPSEG, "__callint", 0); \
- insn = 0x588f; /* addql #4, sp */ \
- seg_data (TRAMPSEG, (char *) &insn, sizeof insn); \
- insn = 0x4e75; /* rts */ \
- seg_data (TRAMPSEG, (char *) &insn, sizeof insn); \
-}
-
-
-
-#if 0
-#define VALIDATE_STACK() if (stack_depth < 0) abort ();
-#else
-#if 0
-#define VALIDATE_STACK() \
- fprintf (stderr, " %%%d%%", stack_depth);
-#endif
-#endif
-
-/* Define functions defined in aux-output.c and used in templates. */
-
-extern char *output_move_const_into_data_reg ();
-extern char *output_move_simode_const ();
-extern char *output_move_simode ();
-extern char *output_move_himode ();
-extern char *output_move_qimode ();
-extern char *output_move_double ();
-extern char *output_move_const_single ();
-extern char *output_move_const_double ();
-extern char *output_btst ();
-extern char *output_scc_di ();
-
-/* Variables in m68k.c */
-extern char *m68k_align_loops_string;
-extern char *m68k_align_jumps_string;
-extern char *m68k_align_funcs_string;
-extern int m68k_align_loops;
-extern int m68k_align_jumps;
-extern int m68k_align_funcs;
-extern int m68k_last_compare_had_fp_operands;
-
-
-/*
-Local variables:
-version-control: t
-End:
-*/
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
deleted file mode 100644
index 86a70b6361d..00000000000
--- a/gcc/config/m68k/m68k.md
+++ /dev/null
@@ -1,7415 +0,0 @@
-;;- Machine description for GNU compiler, Motorola 68000 Version
-;; Copyright (C) 1987, 88, 93, 94, 95, 96, 1997 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.
-
-;;- Information about MCF5200 port.
-
-;;- The MCF5200 "ColdFire" architecture is a reduced version of the
-;;- 68k ISA. Differences include reduced support for byte and word
-;;- operands and the removal of BCD, bitfield, rotate, and integer
-;;- divide instructions. The TARGET_5200 flag turns the use of the
-;;- removed opcodes and addressing modes off.
-;;-
-
-
-;;- instruction definitions
-
-;;- @@The original PO technology requires these to be ordered by speed,
-;;- @@ so that assigner will pick the fastest.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;;- When naming insn's (operand 0 of define_insn) be careful about using
-;;- names from other targets machine descriptions.
-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-;;- Operand classes for the register allocator:
-;;- 'a' one of the address registers can be used.
-;;- 'd' one of the data registers can be used.
-;;- 'f' one of the m68881 registers can be used
-;;- 'r' either a data or an address register can be used.
-;;- 'x' if one of the Sun FPA registers
-;;- 'y' if one of the Low Sun FPA registers (fpa0-fpa15).
-
-;;- Immediate Floating point operator constraints
-;;- 'G' a floating point constant that is *NOT* one of the standard
-;; 68881 constant values (to force calling output_move_const_double
-;; to get it from rom if it is a 68881 constant).
-;;- 'H' one of the standard FPA constant values
-;;
-;; See the functions standard_XXX_constant_p in output-m68k.c for more
-;; info.
-
-;;- Immediate integer operand constraints:
-;;- 'I' 1 .. 8
-;;- 'J' -32768 .. 32767
-;;- 'K' all integers EXCEPT -128 .. 127
-;;- 'L' -8 .. -1
-;;- 'M' all integers EXCEPT -256 .. 255
-;;- 'N' 24 .. 31
-;;- 'O' 16
-;;- 'P' 8 .. 15
-
-;;- Assembler specs:
-;;- "%." size separator ("." or "") move%.l d0,d1
-;;- "%#" immediate separator ("#" or "") move%.l %#0,d0
-;;- "%-" push operand "sp@-" move%.l d0,%-
-;;- "%+" pop operand "sp@+" move%.l d0,%+
-;;- "%@" top of stack "sp@" move%.l d0,%@
-;;- "%!" fpcr register
-;;- "%$" single-precision fp specifier ("s" or "") f%$add.x fp0,fp1
-;;- "%&" double-precision fp specifier ("d" or "") f%&add.x fp0,fp1
-
-;; UNSPEC usage:
-;; 1 This is a `sin' operation. The mode of the UNSPEC is MODE_FLOAT.
-;; operand 1 is the argument for `sin'.
-;; 2 This is a `cos' operation. The mode of the UNSPEC is MODE_FLOAT.
-;; operand 1 is the argument for `cos'.
-
-;;- Information about 68040 port.
-
-;;- The 68040 executes all 68030 and 68881/2 instructions, but some must
-;;- be emulated in software by the OS. It is faster to avoid these
-;;- instructions and issue a library call rather than trapping into
-;;- the kernel. The affected instructions are fintrz and fscale. The
-;;- TARGET_68040 flag turns the use of the opcodes off.
-
-;;- The '040 also implements a set of new floating-point instructions
-;;- which specify the rounding precision in the opcode. This finally
-;;- permit the 68k series to be truly IEEE compliant, and solves all
-;;- issues of excess precision accumulating in the extended registers.
-;;- By default, GCC does not use these instructions, since such code will
-;;- not run on an '030. To use these instructions, use the -m68040-only
-;;- switch. By changing TARGET_DEFAULT to include TARGET_68040_ONLY,
-;;- you can make these instructions the default.
-
-;;- These new instructions aren't directly in the md. They are brought
-;;- into play by defining "%$" and "%&" to expand to "s" and "d" rather
-;;- than "".
-
-;;- Information about 68060 port.
-
-;;- The 68060 executes all 68030 and 68881/2 instructions, but some must
-;;- be emulated in software by the OS. It is faster to avoid these
-;;- instructions and issue a library call rather than trapping into
-;;- the kernel. The affected instructions are: divs.l <ea>,Dr:Dq;
-;;- divu.l <ea>,Dr:Dq; muls.l <ea>,Dr:Dq; mulu.l <ea>,Dr:Dq; and
-;;- fscale. The TARGET_68060 flag turns the use of the opcodes off.
-
-;;- FPA port explanation:
-
-;;- Usage of the Sun FPA and the 68881 together
-
-;;- The current port of gcc to the sun fpa disallows use of the m68881
-;;- instructions completely if code is targeted for the fpa. This is
-;;- for the following reasons:
-
-;;- 1) Expressing the preference hierarchy (ie. use the fpa if you
-;;- can, the 68881 otherwise, and data registers only if you are
-;;- forced to it) is a bitch with the current constraint scheme,
-;;- especially since it would have to work for any combination of
-;;- -mfpa, -m68881.
-
-;;- 2) There are no instructions to move between the two types of
-;;- registers; the stack must be used as an intermediary.
-
-;;- It could indeed be done; I think the best way would be to have
-;;- separate patterns for TARGET_FPA (which implies a 68881),
-;;- TARGET_68881, and no floating point co-processor. Use
-;;- define_expands for all of the named instruction patterns, and
-;;- include code in the FPA instruction to deal with the 68881 with
-;;- preferences specifically set to favor the fpa. Some of this has
-;;- already been done:
-;;-
-;;- 1) Separation of most of the patterns out into a TARGET_FPA
-;;- case and a TARGET_68881 case (the exceptions are the patterns
-;;- which would need one define_expand and three define_insn's under
-;;- it (with a lot of duplicate code between them) to replace the
-;;- current single define_insn. These are mov{[ds]f,[ds]i} and the
-;;- first two patterns in the md.
-;;-
-;;- Some would still have to be done:
-;;-
-;;- 1) Add code to the fpa patterns which correspond to 68881
-;;- patterns to deal with the 68881 case (including preferences!).
-;;- What you might actually do here is combine the fpa and 68881 code
-;;- back together into one pattern for those instructions where it's
-;;- absolutely necessary and save yourself some duplicate code. I'm
-;;- not completely sure as to whether you could get away with doing
-;;- this only for the mov* insns, or if you'd have to do it for all
-;;- named insns.
-;;- 2) Add code to the mov{[ds]f,[ds]i} instructions to handle
-;;- moving between fpa regs and 68881 regs.
-
-;;- Since the fpa is more powerful than the 68881 and also has more
-;;- registers, and since I think the resultant md would be medium ugly
-;;- (lot's of duplicate code, ugly constraint strings), I elected not
-;;- to do this change.
-
-;;- Another reason why someone *might* want to do the change is to
-;;- control which register classes are accessed in a slightly cleaner
-;;- way than I have. See the blurb on CONDITIONAL_REGISTER_USAGE in
-;;- the internals manual.
-
-;;- Yet another reason why someone might want to do this change is to
-;;- allow use of some of the 68881 insns which have no equivalent on
-;;- the fpa. The sqrt instruction comes fairly quickly to mind.
-
-;;- If this is ever done, don't forget to change sun3.h so that
-;;- it *will* define __HAVE_68881__ when the FPA is in use.
-
-;;- Condition code hack
-
-;;- When a floating point compare is done in the fpa, the resulting
-;;- condition codes are left in the fpastatus register. The values in
-;;- this register must be moved into the 68000 cc register before any
-;;- jump is executed. Once this has been done, regular jump
-;;- instructions are fine (ie. floating point jumps are not necessary.
-;;- They are only done if the cc is in the 68881).
-
-;;- The instructions that move the fpastatus register to the 68000
-;;- register clobber a data register (the move cannot be done direct).
-;;- These instructions might be bundled either with the compare
-;;- instruction, or the branch instruction. If we were using both the
-;;- fpa and the 68881 together, we would wish to only mark the
-;;- register clobbered if we were doing the compare in the fpa, but I
-;;- think that that decision (whether to clobber the register or not)
-;;- must be done before register allocation (makes sense) and hence we
-;;- can't know if the floating point compare will be done in the fpa
-;;- or the fp. So whenever we are asked for code that uses the fpa,
-;;- we will mark a data register as clobbered. This is reasonable, as
-;;- almost all floating point compare operations done with fpa code
-;;- enabled will be done in the fpa. It's even more reasonable since
-;;- we decided to make the 68881 and the fpa mutually exclusive.
-
-;;- We place to code to move the fpastatus register inside of a
-;;- define_expand so that we can do it conditionally based on whether
-;;- we are targeting an fpa or not.
-
-;;- This still leaves us with the question of where we wish to put the
-;;- code to move the fpastatus reg. If we put it in the compare
-;;- instruction, we can restrict the clobbering of the register to
-;;- floating point compares, but we can't take advantage of floating
-;;- point subtracts & etc. that alter the fpastatus register. If we
-;;- put it in the branch instruction, all branches compiled with fpa
-;;- code enabled will clobber a data register, but we will be able to
-;;- take advantage of fpa subtracts. This balance favors putting the
-;;- code in with the compare instruction.
-
-;;- Note that if some enterprising hacker should decide to switch
-;;- this, he'll need to modify the code in NOTICE_UPDATE_CC.
-
-;;- Usage of the top 16 fpa registers
-
-;;- The only locations which we may transfer fpa registers 16-31 from
-;;- or to are the fpa registers 0-15. (68000 registers and memory
-;;- locations are impossible). This causes problems in gcc, which
-;;- assumes that mov?? instructions require no additional registers
-;;- (see section 11.7) and since floating point moves *must* be
-;;- supported into general registers (see section 12.3 under
-;;- HARD_REGNO_OK_FOR_MODE_P) from anywhere.
-
-;;- My solution was to reserve fpa0 for moves into or out of these top
-;;- 16 registers and to disparage the choice to reload into or out of
-;;- these registers as much as I could. That alternative is always
-;;- last in the list, so it will not be used unless all else fails. I
-;;- will note that according to my current information, sun's compiler
-;;- doesn't use these top 16 registers at all.
-
-;;- There is another possible way to do it. I *believe* that if you
-;;- make absolutely sure that the code will not be executed in the
-;;- reload pass, you can support the mov?? names with define_expands
-;;- which require new registers. This may be possible by the
-;;- appropriate juggling of constraints. I may come back to this later.
-
-;;- Usage of constant RAM
-
-;;- This has been handled correctly (I believe) but the way I've done
-;;- it could use a little explanation. The constant RAM can only be
-;;- accessed when the instruction is in "command register" mode.
-;;- "command register" mode means that no accessing of memory or the
-;;- 68000 registers is being done. This can be expressed easily in
-;;- constraints, so generally the mode of the instruction is
-;;- determined by a branch off of which_alternative. In outputting
-;;- instructions, a 'w' means to output an access to the constant ram
-;;- (if the arg is CONST_DOUBLE and is one of the available
-;;- constants), and 'x' means to output a register pair (if the arg is
-;;- a 68000 register) and a 'y' is the combination of the above two
-;;- processes. You use a 'y' in two operand DF instructions where you
-;;- *know* the other operand is an fpa register, you use an 'x' in DF
-;;- instructions where the arg might be a 68000 register and the
-;;- instruction is *not* in "command register" mode, and you use a 'w'
-;;- in two situations: 1) The instruction *is* in command register
-;;- mode (and hence won't be accessing 68000 registers), or 2) The
-;;- instruction is a two operand SF instruction where you know the
-;;- other operand is an fpa register.
-
-;;- Optimization issues
-
-;;- I actually think that I've included all of the fpa instructions
-;;- that should be included. Note that if someone is interested in
-;;- doing serious floating point work on the sun fpa, I would advise
-;;- the use of the "asm" instruction in gcc to allow you to use the
-;;- sin, cos, and exponential functions on the fpa board.
-
-;;- END FPA Explanation Section.
-
-
-;;- Some of these insn's are composites of several m68000 op codes.
-;;- The assembler (or final @@??) insures that the appropriate one is
-;;- selected.
-
-(define_insn ""
- [(set (match_operand:DF 0 "push_operand" "=m")
- (match_operand:DF 1 "general_operand" "ro<>fyE"))]
- ""
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"fmove%.d %f1,%0\";
- if (FPA_REG_P (operands[1]))
- return \"fpmove%.d %1, %x0\";
- return output_move_double (operands);
-}")
-
-(define_insn "pushdi"
- [(set (match_operand:DI 0 "push_operand" "=m")
- (match_operand:DI 1 "general_operand" "ro<>Fyi"))]
- ""
- "*
-{
- return output_move_double (operands);
-}")
-
-;; We don't want to allow a constant operand for test insns because
-;; (set (cc0) (const_int foo)) has no mode information. Such insns will
-;; be folded while optimizing anyway.
-
-(define_expand "tstdi"
- [(set (cc0)
- (match_operand:DI 0 "nonimmediate_operand" ""))
- (clobber (match_scratch:SI 1 ""))
- (clobber (match_scratch:DI 2 ""))]
- ""
- "m68k_last_compare_had_fp_operands = 0;")
-
-(define_insn ""
- [(set (cc0)
- (match_operand:DI 0 "nonimmediate_operand" "am,d"))
- (clobber (match_scratch:SI 1 "=X,d"))
- (clobber (match_scratch:DI 2 "=d,X"))]
- ""
- "*
-{
- if (which_alternative == 0)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[2];
- xoperands[1] = operands[0];
- output_move_double (xoperands);
- cc_status.flags |= CC_REVERSED;
- return \"neg%.l %R2\;negx%.l %2\";
- }
- if (find_reg_note (insn, REG_DEAD, operands[0]))
- {
- cc_status.flags |= CC_REVERSED;
- return \"neg%.l %R0\;negx%.l %0\";
- }
- else
- /*
- ** 'sub' clears %1, and also clears the X cc bit
- ** 'tst' sets the Z cc bit according to the low part of the DImode operand
- ** 'subx %1' (i.e. subx #0) acts as a (non-existent) tstx on the high part
- */
- return \"sub%.l %1,%1\;tst%.l %R0\;subx%.l %1,%0\";
-}")
-
-(define_expand "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" ""))]
- ""
- "m68k_last_compare_had_fp_operands = 0;")
-
-(define_insn ""
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" "rm"))]
- ""
- "*
-{
-#ifdef ISI_OV
- /* ISI's assembler fails to handle tstl a0. */
- if (! ADDRESS_REG_P (operands[0]))
-#else
- if (TARGET_68020 || TARGET_5200 || ! ADDRESS_REG_P (operands[0]))
-#endif
- return \"tst%.l %0\";
- /* If you think that the 68020 does not support tstl a0,
- reread page B-167 of the 68020 manual more carefully. */
- /* On an address reg, cmpw may replace cmpl. */
-#ifdef SGS_CMP_ORDER
- return \"cmp%.w %0,%#0\";
-#else
- return \"cmp%.w %#0,%0\";
-#endif
-}")
-
-;; This can't use an address register, because comparisons
-;; with address registers as second operand always test the whole word.
-(define_expand "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "nonimmediate_operand" ""))]
- ""
- "m68k_last_compare_had_fp_operands = 0;")
-
-(define_insn ""
- [(set (cc0)
- (match_operand:HI 0 "nonimmediate_operand" "dm"))]
- ""
- "tst%.w %0")
-
-(define_expand "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "nonimmediate_operand" ""))]
- ""
- "m68k_last_compare_had_fp_operands = 0;")
-
-(define_insn ""
- [(set (cc0)
- (match_operand:QI 0 "nonimmediate_operand" "dm"))]
- ""
- "tst%.b %0")
-
-(define_expand "tstsf"
- [(set (cc0)
- (match_operand:SF 0 "general_operand" ""))]
- "TARGET_68881 || TARGET_FPA"
- "
-{
- m68k_last_compare_had_fp_operands = 1;
- if (TARGET_FPA)
- {
- emit_insn (gen_tstsf_fpa (operands[0]));
- DONE;
- }
-}")
-
-(define_insn "tstsf_fpa"
- [(set (cc0)
- (match_operand:SF 0 "general_operand" "xmdF"))
- (clobber (match_scratch:SI 1 "=d"))]
- "TARGET_FPA"
- "fptst%.s %x0\;fpmove fpastatus,%1\;movw %1,cc")
-
-(define_insn ""
- [(set (cc0)
- (match_operand:SF 0 "general_operand" "fdm"))]
- "TARGET_68881"
- "*
-{
- cc_status.flags = CC_IN_68881;
- if (FP_REG_P (operands[0]))
- return \"ftst%.x %0\";
- return \"ftst%.s %0\";
-}")
-
-(define_expand "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "general_operand" ""))]
- "TARGET_68881 || TARGET_FPA"
- "
-{
- m68k_last_compare_had_fp_operands = 1;
- if (TARGET_FPA)
- {
- emit_insn (gen_tstsf_fpa (operands[0]));
- DONE;
- }
-}")
-
-(define_insn "tstdf_fpa"
- [(set (cc0)
- (match_operand:DF 0 "general_operand" "xrmF"))
- (clobber (match_scratch:SI 1 "=d"))]
- "TARGET_FPA"
- "fptst%.d %x0\;fpmove fpastatus,%1\;movw %1,cc")
-
-(define_insn ""
- [(set (cc0)
- (match_operand:DF 0 "general_operand" "fm"))]
- "TARGET_68881"
- "*
-{
- cc_status.flags = CC_IN_68881;
- if (FP_REG_P (operands[0]))
- return \"ftst%.x %0\";
- return \"ftst%.d %0\";
-}")
-
-;; compare instructions.
-
-(define_expand "cmpdi"
- [(parallel
- [(set (cc0)
- (compare (match_operand:DI 0 "nonimmediate_operand" "")
- (match_operand:DI 1 "general_operand" "")))
- (clobber (match_dup 2))])]
- ""
- "m68k_last_compare_had_fp_operands = 0; operands[2] = gen_reg_rtx (DImode);")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
- (match_operand:DI 2 "general_operand" "d,0")))
- (clobber (match_operand:DI 0 "register_operand" "=d,d"))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"sub%.l %R2,%R0\;subx%.l %2,%0\";
- else
- {
- cc_status.flags |= CC_REVERSED;
- return \"sub%.l %R1,%R0\;subx%.l %1,%0\";
- }
-}")
-
-;; This is the second "hook" for PIC code (in addition to movsi). See
-;; comment of movsi for a description of PIC handling.
-(define_expand "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "")
- (match_operand:SI 1 "general_operand" "")))]
- ""
- "
-{
- m68k_last_compare_had_fp_operands = 0;
- if (flag_pic && symbolic_operand (operands[1], SImode))
- {
- /* The source is an address which requires PIC relocation.
- Call legitimize_pic_address with the source, mode, and a relocation
- register (a new pseudo, or the final destination if reload_in_progress
- is set). Then fall through normally */
- extern rtx legitimize_pic_address();
- rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
- operands[1] = legitimize_pic_address (operands[1], SImode, temp);
- }
-}")
-
-;; A composite of the cmp, cmpa, cmpi & cmpm m68000 op codes.
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "rKs,mr,>")
- (match_operand:SI 1 "general_operand" "mr,rKs,>")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
-#ifdef SGS_CMP_ORDER
- return \"cmpm%.l %0,%1\";
-#else
- return \"cmpm%.l %1,%0\";
-#endif
- if (REG_P (operands[1])
- || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
- { cc_status.flags |= CC_REVERSED;
-#ifdef SGS_CMP_ORDER
- return \"cmp%.l %d1,%d0\";
-#else
- return \"cmp%.l %d0,%d1\";
-#endif
- }
-#ifdef SGS_CMP_ORDER
- return \"cmp%.l %d0,%d1\";
-#else
- return \"cmp%.l %d1,%d0\";
-#endif
-}")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "mrKs,r")
- (match_operand:SI 1 "general_operand" "r,mrKs")))]
- "TARGET_5200"
- "*
-{
- if (REG_P (operands[1])
- || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
- { cc_status.flags |= CC_REVERSED;
-#ifdef SGS_CMP_ORDER
- return \"cmp%.l %d1,%d0\";
-#else
- return \"cmp%.l %d0,%d1\";
-#endif
- }
-#ifdef SGS_CMP_ORDER
- return \"cmp%.l %d0,%d1\";
-#else
- return \"cmp%.l %d1,%d0\";
-#endif
-}")
-
-(define_expand "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "")
- (match_operand:HI 1 "general_operand" "")))]
- "!TARGET_5200"
- "m68k_last_compare_had_fp_operands = 0;")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "rnm,d,n,m,>")
- (match_operand:HI 1 "general_operand" "d,rnm,m,n,>")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
-#ifdef SGS_CMP_ORDER
- return \"cmpm%.w %0,%1\";
-#else
- return \"cmpm%.w %1,%0\";
-#endif
- if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
- || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
- { cc_status.flags |= CC_REVERSED;
-#ifdef SGS_CMP_ORDER
- return \"cmp%.w %d1,%d0\";
-#else
- return \"cmp%.w %d0,%d1\";
-#endif
- }
-#ifdef SGS_CMP_ORDER
- return \"cmp%.w %d0,%d1\";
-#else
- return \"cmp%.w %d1,%d0\";
-#endif
-}")
-
-(define_expand "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "")
- (match_operand:QI 1 "general_operand" "")))]
- "!TARGET_5200"
- "m68k_last_compare_had_fp_operands = 0;")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "dn,md,>")
- (match_operand:QI 1 "general_operand" "dm,nd,>")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
-#ifdef SGS_CMP_ORDER
- return \"cmpm%.b %0,%1\";
-#else
- return \"cmpm%.b %1,%0\";
-#endif
- if (REG_P (operands[1])
- || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
- { cc_status.flags |= CC_REVERSED;
-#ifdef SGS_CMP_ORDER
- return \"cmp%.b %d1,%d0\";
-#else
- return \"cmp%.b %d0,%d1\";
-#endif
- }
-#ifdef SGS_CMP_ORDER
- return \"cmp%.b %d0,%d1\";
-#else
- return \"cmp%.b %d1,%d0\";
-#endif
-}")
-
-(define_expand "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "
-{
- m68k_last_compare_had_fp_operands = 1;
- if (TARGET_FPA)
- {
- emit_insn (gen_cmpdf_fpa (operands[0], operands[1]));
- DONE;
- }
-}")
-
-(define_insn "cmpdf_fpa"
- [(set (cc0)
- (compare (match_operand:DF 0 "general_operand" "x,y")
- (match_operand:DF 1 "general_operand" "xH,rmF")))
- (clobber (match_scratch:SI 2 "=d,d"))]
- "TARGET_FPA"
- "fpcmp%.d %y1,%0\;fpmove fpastatus,%2\;movw %2,cc")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:DF 0 "general_operand" "f,mG")
- (match_operand:DF 1 "general_operand" "fmG,f")))]
- "TARGET_68881"
- "*
-{
- cc_status.flags = CC_IN_68881;
-#ifdef SGS_CMP_ORDER
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- return \"fcmp%.x %0,%1\";
- else
- return \"fcmp%.d %0,%f1\";
- }
- cc_status.flags |= CC_REVERSED;
- return \"fcmp%.d %1,%f0\";
-#else
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- return \"fcmp%.x %1,%0\";
- else
- return \"fcmp%.d %f1,%0\";
- }
- cc_status.flags |= CC_REVERSED;
- return \"fcmp%.d %f0,%1\";
-#endif
-}")
-
-(define_expand "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "
-{
- m68k_last_compare_had_fp_operands = 1;
- if (TARGET_FPA)
- {
- emit_insn (gen_cmpsf_fpa (operands[0], operands[1]));
- DONE;
- }
-}")
-
-(define_insn "cmpsf_fpa"
- [(set (cc0)
- (compare (match_operand:SF 0 "general_operand" "x,y")
- (match_operand:SF 1 "general_operand" "xH,rmF")))
- (clobber (match_scratch:SI 2 "=d,d"))]
- "TARGET_FPA"
- "fpcmp%.s %w1,%x0\;fpmove fpastatus,%2\;movw %2,cc")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:SF 0 "general_operand" "f,mdG")
- (match_operand:SF 1 "general_operand" "fmdG,f")))]
- "TARGET_68881"
- "*
-{
- cc_status.flags = CC_IN_68881;
-#ifdef SGS_CMP_ORDER
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fcmp%.x %0,%1\";
- else
- return \"fcmp%.s %0,%f1\";
- }
- cc_status.flags |= CC_REVERSED;
- return \"fcmp%.s %1,%f0\";
-#else
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fcmp%.x %1,%0\";
- else
- return \"fcmp%.s %f1,%0\";
- }
- cc_status.flags |= CC_REVERSED;
- return \"fcmp%.s %f0,%1\";
-#endif
-}")
-
-;; Recognizers for btst instructions.
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
- (const_int 1)
- (minus:SI (const_int 7)
- (match_operand:SI 1 "general_operand" "di"))))]
- ""
- "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
- (const_int 1)
- (minus:SI (const_int 31)
- (match_operand:SI 1 "general_operand" "di"))))]
- ""
- "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
-
-;; The following two patterns are like the previous two
-;; except that they use the fact that bit-number operands
-;; are automatically masked to 3 or 5 bits.
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
- (const_int 1)
- (minus:SI (const_int 7)
- (and:SI
- (match_operand:SI 1 "register_operand" "d")
- (const_int 7)))))]
- ""
- "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
- (const_int 1)
- (minus:SI (const_int 31)
- (and:SI
- (match_operand:SI 1 "register_operand" "d")
- (const_int 31)))))]
- ""
- "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
-
-;; Nonoffsettable mem refs are ok in this one pattern
-;; since we don't try to adjust them.
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
- (const_int 1)
- (match_operand:SI 1 "const_int_operand" "n")))]
- "(unsigned) INTVAL (operands[1]) < 8"
- "*
-{
- operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - INTVAL (operands[1]));
- return output_btst (operands, operands[1], operands[0], insn, 7);
-}")
-
-(define_insn ""
- [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
- (const_int 1)
- (match_operand:SI 1 "const_int_operand" "n")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- {
- operands[0] = adj_offsettable_operand (operands[0],
- INTVAL (operands[1]) / 8);
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- 7 - INTVAL (operands[1]) % 8);
- return output_btst (operands, operands[1], operands[0], insn, 7);
- }
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- 31 - INTVAL (operands[1]));
- return output_btst (operands, operands[1], operands[0], insn, 31);
-}")
-
-
-;; move instructions
-
-;; A special case in which it is not desirable
-;; to reload the constant into a data register.
-(define_insn "pushexthisi_const"
- [(set (match_operand:SI 0 "push_operand" "=m")
- (match_operand:SI 1 "const_int_operand" "J"))]
- "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
- "*
-{
- if (operands[1] == const0_rtx)
- return \"clr%.l %0\";
- return \"pea %a1\";
-}")
-
-;This is never used.
-;(define_insn "swapsi"
-; [(set (match_operand:SI 0 "general_operand" "+r")
-; (match_operand:SI 1 "general_operand" "+r"))
-; (set (match_dup 1) (match_dup 0))]
-; ""
-; "exg %1,%0")
-
-;; Special case of fullword move when source is zero.
-;; The reason this is special is to avoid loading a zero
-;; into a data reg with moveq in order to store it elsewhere.
-
-(define_insn "movsi_const0"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (const_int 0))]
- ;; clr insns on 68000 read before writing.
- ;; This isn't so on the 68010, but we have no TARGET_68010.
- "((TARGET_68020 || TARGET_5200)
- || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))"
- "*
-{
- if (ADDRESS_REG_P (operands[0]))
- {
- /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
- if (!TARGET_68040 && !TARGET_68060)
- return \"sub%.l %0,%0\";
- else
- {
-#ifdef MOTOROLA
-#ifdef SGS
- /* Many SGS assemblers croak on size specifiers for constants. */
- return \"lea 0,%0\";
-#else
- return \"lea 0.w,%0\";
-#endif
-#else
- return \"lea 0:w,%0\";
-#endif
- }
- }
- /* moveq is faster on the 68000. */
- if (DATA_REG_P (operands[0]) && (!TARGET_68020 && !TARGET_5200))
-#if defined(MOTOROLA) && !defined(CRDS)
- return \"moveq%.l %#0,%0\";
-#else
- return \"moveq %#0,%0\";
-#endif
- return \"clr%.l %0\";
-}")
-
-;; General case of fullword move.
-;;
-;; This is the main "hook" for PIC code. When generating
-;; PIC, movsi is responsible for determining when the source address
-;; needs PIC relocation and appropriately calling legitimize_pic_address
-;; to perform the actual relocation.
-;;
-;; In both the PIC and non-PIC cases the patterns generated will
-;; matched by the next define_insn.
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (flag_pic && symbolic_operand (operands[1], SImode))
- {
- /* The source is an address which requires PIC relocation.
- Call legitimize_pic_address with the source, mode, and a relocation
- register (a new pseudo, or the final destination if reload_in_progress
- is set). Then fall through normally */
- extern rtx legitimize_pic_address();
- rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
- operands[1] = legitimize_pic_address (operands[1], SImode, temp);
- }
-}")
-
-;; General case of fullword move. The register constraints
-;; force integer constants in range for a moveq to be reloaded
-;; if they are headed for memory.
-(define_insn ""
- ;; Notes: make sure no alternative allows g vs g.
- ;; We don't allow f-regs since fixed point cannot go in them.
- ;; We do allow y and x regs since fixed point is allowed in them.
- [(set (match_operand:SI 0 "general_operand" "=g,da,y,!*x*r*m")
- (match_operand:SI 1 "general_operand" "daymKs,i,g,*x*r*m"))]
- "!TARGET_5200"
- "*
-{
- if (which_alternative == 3)
- return \"fpmove%.l %x1,fpa0\;fpmove%.l fpa0,%x0\";
- if (FPA_REG_P (operands[1]) || FPA_REG_P (operands[0]))
- return \"fpmove%.l %x1,%x0\";
- return output_move_simode (operands);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r<>,g")
- (match_operand:SI 1 "general_operand" "g,r<>"))]
- "TARGET_5200"
- "* return output_move_simode (operands);")
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g")
- (match_operand:HI 1 "general_operand" "g"))]
- "!TARGET_5200"
- "* return output_move_himode (operands);")
-
- (define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=r<>,g")
- (match_operand:HI 1 "general_operand" "g,r<>"))]
- "TARGET_5200"
- "* return output_move_himode (operands);")
-
-(define_insn "movstricthi"
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
- (match_operand:HI 1 "general_operand" "rmn"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (operands[1] == const0_rtx
- && (DATA_REG_P (operands[0])
- || GET_CODE (operands[0]) == MEM)
- /* clr insns on 68000 read before writing.
- This isn't so on the 68010, but we have no TARGET_68010. */
- && ((TARGET_68020 || TARGET_5200)
- || !(GET_CODE (operands[0]) == MEM
- && MEM_VOLATILE_P (operands[0]))))
- return \"clr%.w %0\";
- }
- return \"move%.w %1,%0\";
-}")
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=d,*a,m")
- (match_operand:QI 1 "general_operand" "dmi*a,di*a,dmi"))]
- "!TARGET_5200"
- "* return output_move_qimode (operands);")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=d<>,dm")
- (match_operand:QI 1 "general_operand" "dmi,d<>"))]
- "TARGET_5200"
- "* return output_move_qimode (operands);")
-
-(define_insn "movstrictqi"
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
- (match_operand:QI 1 "general_operand" "dmn"))]
- ""
- "*
-{
- if (operands[1] == const0_rtx
- /* clr insns on 68000 read before writing.
- This isn't so on the 68010, but we have no TARGET_68010. */
- && ((TARGET_68020 || TARGET_5200)
- || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
- return \"clr%.b %0\";
- return \"move%.b %1,%0\";
-}")
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=rmf,x,y,rm,!x,!rm")
- (match_operand:SF 1 "general_operand" "rmfF,xH,rmF,y,rm,x"))]
-; [(set (match_operand:SF 0 "general_operand" "=rmf")
-; (match_operand:SF 1 "general_operand" "rmfF"))]
- "!TARGET_5200"
- "*
-{
- if (which_alternative >= 4)
- return \"fpmove%.s %1,fpa0\;fpmove%.s fpa0,%0\";
- if (FPA_REG_P (operands[0]))
- {
- if (FPA_REG_P (operands[1]))
- return \"fpmove%.s %x1,%x0\";
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_single (operands);
- else if (FP_REG_P (operands[1]))
- return \"fmove%.s %1,sp@-\;fpmove%.d sp@+, %0\";
- return \"fpmove%.s %x1,%x0\";
- }
- if (FPA_REG_P (operands[1]))
- {
- if (FP_REG_P (operands[0]))
- return \"fpmove%.s %x1,sp@-\;fmove%.s sp@+,%0\";
- else
- return \"fpmove%.s %x1,%x0\";
- }
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"f%$move%.x %1,%0\";
- else if (ADDRESS_REG_P (operands[1]))
- return \"move%.l %1,%-\;f%$move%.s %+,%0\";
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_single (operands);
- return \"f%$move%.s %f1,%0\";
- }
- if (FP_REG_P (operands[1]))
- {
- if (ADDRESS_REG_P (operands[0]))
- return \"fmove%.s %1,%-\;move%.l %+,%0\";
- return \"fmove%.s %f1,%0\";
- }
- return \"move%.l %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=r,g")
- (match_operand:SF 1 "general_operand" "g,r"))]
- "TARGET_5200"
- "* return \"move%.l %1,%0\";")
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=rm,rf,rf,&rof<>,y,rm,x,!x,!rm")
- (match_operand:DF 1 "general_operand" "rf,m,0,rofE<>,rmE,y,xH,rm,x"))]
-; [(set (match_operand:DF 0 "general_operand" "=rm,&rf,&rof<>")
-; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
- "!TARGET_5200"
- "*
-{
- if (which_alternative == 7)
- return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
- if (FPA_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_double (operands);
- if (FP_REG_P (operands[1]))
- return \"fmove%.d %1,sp@-\;fpmove%.d sp@+,%x0\";
- return \"fpmove%.d %x1,%x0\";
- }
- else if (FPA_REG_P (operands[1]))
- {
- if (FP_REG_P(operands[0]))
- return \"fpmove%.d %x1,sp@-\;fmoved sp@+,%0\";
- else
- return \"fpmove%.d %x1,%x0\";
- }
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"f%&move%.x %1,%0\";
- if (REG_P (operands[1]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"move%.l %1,%-\", xoperands);
- output_asm_insn (\"move%.l %1,%-\", operands);
- return \"f%&move%.d %+,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_double (operands);
- return \"f%&move%.d %f1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"move%.l %+,%0\";
- }
- else
- return \"fmove%.d %f1,%0\";
- }
- return output_move_double (operands);
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=r,g")
- (match_operand:DF 1 "general_operand" "g,r"))]
- "TARGET_5200"
- "* return output_move_double (operands);")
-
-(define_expand "movxf"
- [(set (match_operand:XF 0 "nonimmediate_operand" "")
- (match_operand:XF 1 "general_operand" ""))]
- ""
- "
-{
- if (CONSTANT_P (operands[1]))
- {
- operands[1] = force_const_mem (XFmode, operands[1]);
- if (! memory_address_p (XFmode, XEXP (operands[1], 0))
- && ! reload_in_progress)
- operands[1] = change_address (operands[1], XFmode,
- XEXP (operands[1], 0));
- }
-}")
-
-(define_insn ""
- [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f")
- (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r"))]
- "TARGET_68881"
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fmove%.x %1,%0\";
- if (REG_P (operands[1]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
- output_asm_insn (\"move%.l %1,%-\", xoperands);
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"move%.l %1,%-\", xoperands);
- output_asm_insn (\"move%.l %1,%-\", operands);
- return \"fmove%.x %+,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return \"fmove%.x %1,%0\";
- return \"fmove%.x %f1,%0\";
- }
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"fmove%.x %f1,%-\;move%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- output_asm_insn (\"move%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"move%.l %+,%0\";
- }
- return \"fmove%.x %f1,%0\";
-}
-")
-
-(define_insn ""
- [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
- (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
- "! TARGET_68881"
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fmove%.x %1,%0\";
- if (REG_P (operands[1]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
- output_asm_insn (\"move%.l %1,%-\", xoperands);
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"move%.l %1,%-\", xoperands);
- output_asm_insn (\"move%.l %1,%-\", operands);
- return \"fmove%.x %+,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return \"fmove%.x %1,%0\";
- return \"fmove%.x %f1,%0\";
- }
- if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"fmove%.x %f1,%-\;move%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- output_asm_insn (\"move%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"move%.l %+,%0\";
- }
- else
- return \"fmove%.x %f1,%0\";
- }
- return output_move_double (operands);
-}
-")
-
-(define_expand "movdi"
- ;; Let's see if it really still needs to handle fp regs, and, if so, why.
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "")
-
-;; movdi can apply to fp regs in some cases
-(define_insn ""
- ;; Let's see if it really still needs to handle fp regs, and, if so, why.
- [(set (match_operand:DI 0 "general_operand" "=rm,r,&ro<>,y,rm,!*x,!rm")
- (match_operand:DI 1 "general_operand" "rF,m,roi<>F,rmiF,y,rmF,*x"))]
-; [(set (match_operand:DI 0 "general_operand" "=rm,&r,&ro<>,!&rm,!&f,y,rm,x,!x,!rm")
-; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfmF,rmi,y,rm,x"))]
-; [(set (match_operand:DI 0 "general_operand" "=rm,&rf,&ro<>,!&rm,!&f")
-; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
- "!TARGET_5200"
- "*
-{
- if (which_alternative == 8)
- return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
- if (FPA_REG_P (operands[0]) || FPA_REG_P (operands[1]))
- return \"fpmove%.d %x1,%x0\";
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fmove%.x %1,%0\";
- if (REG_P (operands[1]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"move%.l %1,%-\", xoperands);
- output_asm_insn (\"move%.l %1,%-\", operands);
- return \"fmove%.d %+,%0\";
- }
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return output_move_const_double (operands);
- return \"fmove%.d %f1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"move%.l %+,%0\";
- }
- else
- return \"fmove%.d %f1,%0\";
- }
- return output_move_double (operands);
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "general_operand" "=r,g")
- (match_operand:DI 1 "general_operand" "g,r"))]
- "TARGET_5200"
- "* return output_move_double (operands);")
-
-;; Thus goes after the move instructions
-;; because the move instructions are better (require no spilling)
-;; when they can apply. It goes before the add/sub insns
-;; so we will prefer it to them.
-
-(define_insn "pushasi"
- [(set (match_operand:SI 0 "push_operand" "=m")
- (match_operand:SI 1 "address_operand" "p"))]
- ""
- "pea %a1")
-
-;; truncation instructions
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm,d")
- (truncate:QI
- (match_operand:SI 1 "general_operand" "doJ,i")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == REG)
- {
- /* Must clear condition codes, since the move.l bases them on
- the entire 32 bits, not just the desired 8 bits. */
- CC_STATUS_INIT;
- return \"move%.l %1,%0\";
- }
- if (GET_CODE (operands[1]) == MEM)
- operands[1] = adj_offsettable_operand (operands[1], 3);
- return \"move%.b %1,%0\";
-}")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm,d")
- (truncate:QI
- (match_operand:HI 1 "general_operand" "doJ,i")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == REG
- && (GET_CODE (operands[1]) == MEM
- || GET_CODE (operands[1]) == CONST_INT))
- {
- /* Must clear condition codes, since the move.w bases them on
- the entire 16 bits, not just the desired 8 bits. */
- CC_STATUS_INIT;
- return \"move%.w %1,%0\";
- }
- if (GET_CODE (operands[0]) == REG)
- {
- /* Must clear condition codes, since the move.l bases them on
- the entire 32 bits, not just the desired 8 bits. */
- CC_STATUS_INIT;
- return \"move%.l %1,%0\";
- }
- if (GET_CODE (operands[1]) == MEM)
- operands[1] = adj_offsettable_operand (operands[1], 1);
- return \"move%.b %1,%0\";
-}")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=dm,d")
- (truncate:HI
- (match_operand:SI 1 "general_operand" "roJ,i")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == REG)
- {
- /* Must clear condition codes, since the move.l bases them on
- the entire 32 bits, not just the desired 8 bits. */
- CC_STATUS_INIT;
- return \"move%.l %1,%0\";
- }
- if (GET_CODE (operands[1]) == MEM)
- operands[1] = adj_offsettable_operand (operands[1], 2);
- return \"move%.w %1,%0\";
-}")
-
-;; zero extension instructions
-
-;; this is the canonical form for (lshiftrt:DI x 32)
-(define_insn "zero_extendsidi2"
- [(set (match_operand:DI 0 "general_operand" "rm")
- (zero_extend:DI (match_operand:SI 1 "general_operand" "rm")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (GET_CODE (operands[0]) == REG)
- operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- return \"move%.l %1,%0\;clr%.l %0\";
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- return \"clr%.l %0\;move%.l %1,%0\";
- else
- operands[2] = adj_offsettable_operand (operands[0], 4);
- if (ADDRESS_REG_P (operands[0]))
- return \"move%.l %1,%2\;sub%.l %0,%0\";
- else
- return \"move%.l %1,%2\;clr%.l %0\";
-}")
-
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (const_int 0))
- (set (strict_low_part (match_dup 2))
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- operands[1] = make_safe_from (operands[1], operands[0]);
- if (GET_CODE (operands[0]) == SUBREG)
- operands[2] = gen_rtx (SUBREG, HImode, SUBREG_REG (operands[0]),
- SUBREG_WORD (operands[0]));
- else
- operands[2] = gen_rtx (SUBREG, HImode, operands[0], 0);
-}")
-
-(define_expand "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (const_int 0))
- (set (strict_low_part (match_dup 2))
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- operands[1] = make_safe_from (operands[1], operands[0]);
- if (GET_CODE (operands[0]) == SUBREG)
- operands[2] = gen_rtx (SUBREG, QImode, SUBREG_REG (operands[0]),
- SUBREG_WORD (operands[0]));
- else
- operands[2] = gen_rtx (SUBREG, QImode, operands[0], 0);
-}")
-
-(define_expand "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (const_int 0))
- (set (strict_low_part (match_dup 2))
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- operands[1] = make_safe_from (operands[1], operands[0]);
- if (GET_CODE (operands[0]) == SUBREG)
- operands[2] = gen_rtx (SUBREG, QImode, SUBREG_REG (operands[0]),
- SUBREG_WORD (operands[0]));
- else
- operands[2] = gen_rtx (SUBREG, QImode, operands[0], 0);
-}")
-
-;; Patterns to recognize zero-extend insns produced by the combiner.
-;; We don't allow both operands in memory, because of aliasing problems.
-;; Explicitly disallow two memory operands via the condition since reloading
-;; of this case will result in worse code than the uncombined patterns.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=do<>,d<")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
- "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1]))
- return \"and%.l %#0xFFFF,%0\";
- if (reg_mentioned_p (operands[0], operands[1]))
- return \"move%.w %1,%0\;and%.l %#0xFFFF,%0\";
- return \"clr%.l %0\;move%.w %1,%0\";
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- return \"move%.w %1,%0\;clr%.w %0\";
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- return \"clr%.w %0\;move%.w %1,%0\";
- else
- {
- output_asm_insn (\"clr%.w %0\", operands);
- operands[0] = adj_offsettable_operand (operands[0], 2);
- return \"move%.w %1,%0\";
- }
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=do<>,d")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
- "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1]))
- return \"and%.w %#0xFF,%0\";
- if (reg_mentioned_p (operands[0], operands[1]))
- return \"move%.b %1,%0\;and%.w %#0xFF,%0\";
- return \"clr%.w %0\;move%.b %1,%0\";
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- {
- if (REGNO (XEXP (XEXP (operands[0], 0), 0))
- == STACK_POINTER_REGNUM)
- {
- output_asm_insn (\"clr%.w %-\", operands);
- operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
- plus_constant (stack_pointer_rtx, 1));
- return \"move%.b %1,%0\";
- }
- else
- return \"move%.b %1,%0\;clr%.b %0\";
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- return \"clr%.b %0\;move%.b %1,%0\";
- else
- {
- output_asm_insn (\"clr%.b %0\", operands);
- operands[0] = adj_offsettable_operand (operands[0], 1);
- return \"move%.b %1,%0\";
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=do<>,d")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
- "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[0]) == REGNO (operands[1]))
- return \"and%.l %#0xFF,%0\";
- if (reg_mentioned_p (operands[0], operands[1]))
- return \"move%.b %1,%0\;and%.l %#0xFF,%0\";
- return \"clr%.l %0\;move%.b %1,%0\";
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- {
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
-#ifdef MOTOROLA
-#ifdef SGS
- return \"clr%.l -(%0)\;move%.b %1,3(%0)\";
-#else
- return \"clr%.l -(%0)\;move%.b %1,(3,%0)\";
-#endif
-#else
- return \"clrl %0@-\;moveb %1,%0@(3)\";
-#endif
- }
- else if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- {
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
-#ifdef MOTOROLA
-#ifdef SGS
- return \"clr%.l (%0)+\;move%.b %1,-1(%0)\";
-#else
- return \"clr%.l (%0)+\;move%.b %1,(-1,%0)\";
-#endif
-#else
- return \"clrl %0@+\;moveb %1,%0@(-1)\";
-#endif
- }
- else
- {
- output_asm_insn (\"clr%.l %0\", operands);
- operands[0] = adj_offsettable_operand (operands[0], 3);
- return \"move%.b %1,%0\";
- }
-}")
-
-;; sign extension instructions
-
-(define_insn "extendqidi2"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (sign_extend:DI
- (match_operand:QI 1 "general_operand" "rm")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (TARGET_68020 || TARGET_5200)
- return \"move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0\";
- else
- return \"move%.b %1,%2\;ext%.w %0\;ext%.l %2\;move%.l %2,%0\;smi %0\";
-}")
-
-(define_insn "extendhidi2"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (sign_extend:DI
- (match_operand:HI 1 "general_operand" "rm")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (TARGET_68020 || TARGET_5200)
- return \"move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0\";
- else
- return \"move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0\";
-}")
-
-(define_insn "extendsidi2"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (sign_extend:DI
- (match_operand:SI 1 "general_operand" "rm")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (TARGET_68020 || TARGET_5200)
- return \"move%.l %1,%2\;smi %0\;extb%.l %0\";
- else
- return \"move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0\";
-}")
-
-;; Special case when one can avoid register clobbering, copy and test
-;; Maybe there is a way to make that the general case, by forcing the
-;; result of the SI tree to be in the lower register of the DI target
-
-(define_insn "extendplussidi"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
- (match_operand:SI 2 "general_operand" "rmn"))))]
- ""
- "*
-{
- CC_STATUS_INIT;
- operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) > 8)
- {
- rtx tmp = operands[1];
-
- operands[1] = operands[2];
- operands[2] = tmp;
- }
- if (GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) == REGNO (operands[3]))
- output_asm_insn (\"add%.l %2,%3\", operands);
- else
- output_asm_insn (\"move%.l %2,%3\;add%.l %1,%3\", operands);
- if (TARGET_68020 || TARGET_5200)
- return \"smi %0\;extb%.l %0\";
- else
- return \"smi %0\;ext%.w %0\;ext%.l %0\";
-}")
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=*d,a")
- (sign_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "0,rm")))]
- ""
- "*
-{
- if (ADDRESS_REG_P (operands[0]))
- return \"move%.w %1,%0\";
- return \"ext%.l %0\";
-}")
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
- ""
- "ext%.w %0")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
- "TARGET_68020 || TARGET_5200"
- "extb%.l %0")
-
-;; Conversions between float and double.
-
-(define_expand "extendsfdf2"
- [(set (match_operand:DF 0 "general_operand" "")
- (float_extend:DF
- (match_operand:SF 1 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=x,y")
- (float_extend:DF
- (match_operand:SF 1 "general_operand" "xH,rmF")))]
- "TARGET_FPA"
- "fpstod %w1,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=*fdm,f")
- (float_extend:DF
- (match_operand:SF 1 "general_operand" "f,dmF")))]
- "TARGET_68881"
- "*
-{
- if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
- {
- if (REGNO (operands[0]) == REGNO (operands[1]))
- {
- /* Extending float to double in an fp-reg is a no-op.
- NOTICE_UPDATE_CC has already assumed that the
- cc will be set. So cancel what it did. */
- cc_status = cc_prev_status;
- return \"\";
- }
- return \"f%&move%.x %1,%0\";
- }
- if (FP_REG_P (operands[0]))
- return \"f%&move%.s %f1,%0\";
- if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
- {
- output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"move%.l %+,%0\";
- }
- return \"fmove%.d %f1,%0\";
-}")
-
-;; This cannot output into an f-reg because there is no way to be
-;; sure of truncating in that case.
-;; But on the Sun FPA, we can be sure.
-(define_expand "truncdfsf2"
- [(set (match_operand:SF 0 "general_operand" "")
- (float_truncate:SF
- (match_operand:DF 1 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=x,y")
- (float_truncate:SF
- (match_operand:DF 1 "general_operand" "xH,rmF")))]
- "TARGET_FPA"
- "fpdtos %y1,%0")
-
-;; On the '040 we can truncate in a register accurately and easily.
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (float_truncate:SF
- (match_operand:DF 1 "general_operand" "fmG")))]
- "TARGET_68040_ONLY"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"f%$move%.x %1,%0\";
- return \"f%$move%.d %f1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=dm")
- (float_truncate:SF
- (match_operand:DF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.s %f1,%0")
-
-;; Conversion between fixed point and floating point.
-;; Note that among the fix-to-float insns
-;; the ones that start with SImode come first.
-;; That is so that an operand that is a CONST_INT
-;; (and therefore lacks a specific machine mode).
-;; will be recognized as SImode (which is always valid)
-;; rather than as QImode or HImode.
-
-(define_expand "floatsisf2"
- [(set (match_operand:SF 0 "general_operand" "")
- (float:SF (match_operand:SI 1 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=y,x")
- (float:SF (match_operand:SI 1 "general_operand" "rmi,x")))]
- "TARGET_FPA"
- "fpltos %1,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (float:SF (match_operand:SI 1 "general_operand" "dmi")))]
- "TARGET_68881"
- "f%$move%.l %1,%0")
-
-(define_expand "floatsidf2"
- [(set (match_operand:DF 0 "general_operand" "")
- (float:DF (match_operand:SI 1 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=y,x")
- (float:DF (match_operand:SI 1 "general_operand" "rmi,x")))]
- "TARGET_FPA"
- "fpltod %1,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (float:DF (match_operand:SI 1 "general_operand" "dmi")))]
- "TARGET_68881"
- "f%&move%.l %1,%0")
-
-(define_insn "floathisf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (float:SF (match_operand:HI 1 "general_operand" "dmn")))]
- "TARGET_68881"
- "f%$move%.w %1,%0")
-
-(define_insn "floathidf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (float:DF (match_operand:HI 1 "general_operand" "dmn")))]
- "TARGET_68881"
- "fmove%.w %1,%0")
-
-(define_insn "floatqisf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (float:SF (match_operand:QI 1 "general_operand" "dmn")))]
- "TARGET_68881"
- "fmove%.b %1,%0")
-
-(define_insn "floatqidf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (float:DF (match_operand:QI 1 "general_operand" "dmn")))]
- "TARGET_68881"
- "f%&move%.b %1,%0")
-
-;; New routines to convert floating-point values to integers
-;; to be used on the '040. These should be faster than trapping
-;; into the kernel to emulate fintrz. They should also be faster
-;; than calling the subroutines fixsfsi or fixdfsi.
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
- (clobber (match_scratch:SI 2 "=d"))
- (clobber (match_scratch:SI 3 "=d"))]
- "TARGET_68881 && TARGET_68040"
- "*
-{
- CC_STATUS_INIT;
- return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.l %1,%0\;fmovem%.l %2,%!\";
-}")
-
-(define_insn "fix_truncdfhi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
- (clobber (match_scratch:SI 2 "=d"))
- (clobber (match_scratch:SI 3 "=d"))]
- "TARGET_68881 && TARGET_68040"
- "*
-{
- CC_STATUS_INIT;
- return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.w %1,%0\;fmovem%.l %2,%!\";
-}")
-
-(define_insn "fix_truncdfqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
- (clobber (match_scratch:SI 2 "=d"))
- (clobber (match_scratch:SI 3 "=d"))]
- "TARGET_68881 && TARGET_68040"
- "*
-{
- CC_STATUS_INIT;
- return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.b %1,%0\;fmovem%.l %2,%!\";
-}")
-
-;; Convert a float to a float whose value is an integer.
-;; This is the first stage of converting it to an integer type.
-
-(define_insn "ftruncdf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (fix:DF (match_operand:DF 1 "general_operand" "fFm")))]
- "TARGET_68881 && !TARGET_68040"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"fintrz%.x %f1,%0\";
- return \"fintrz%.d %f1,%0\";
-}")
-
-(define_insn "ftruncsf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (fix:SF (match_operand:SF 1 "general_operand" "dfFm")))]
- "TARGET_68881 && !TARGET_68040"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"fintrz%.x %f1,%0\";
- return \"fintrz%.s %f1,%0\";
-}")
-
-;; Convert a float whose value is an integer
-;; to an actual integer. Second stage of converting float to integer type.
-(define_insn "fixsfqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (fix:QI (match_operand:SF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.b %1,%0")
-
-(define_insn "fixsfhi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (fix:HI (match_operand:SF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.w %1,%0")
-
-(define_insn "fixsfsi2"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (fix:SI (match_operand:SF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.l %1,%0")
-
-(define_insn "fixdfqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (fix:QI (match_operand:DF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.b %1,%0")
-
-(define_insn "fixdfhi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (fix:HI (match_operand:DF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.w %1,%0")
-
-(define_insn "fixdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (fix:SI (match_operand:DF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.l %1,%0")
-
-;; Convert a float to an integer.
-;; On the Sun FPA, this is done in one step.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=x,y")
- (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "xH,rmF"))))]
- "TARGET_FPA"
- "fpstol %w1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=x,y")
- (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "xH,rmF"))))]
- "TARGET_FPA"
- "fpdtol %y1,%0")
-
-;; add instructions
-
-(define_insn "adddi_lshrdi_63"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
- (const_int 63))
- (match_dup 1)))
- (clobber (match_scratch:SI 2 "=d"))]
- ""
- "*
-{
- operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
- return
- \"move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0\";
- if (GET_CODE (operands[1]) == REG)
- operands[4] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
- || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- operands[4] = operands[1];
- else
- operands[4] = adj_offsettable_operand (operands[1], 4);
- if (GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- output_asm_insn (\"move%.l %4,%3\", operands);
- output_asm_insn (\"move%.l %1,%0\;smi %2\", operands);
- if (TARGET_68020 || TARGET_5200)
- output_asm_insn (\"extb%.l %2\", operands);
- else
- output_asm_insn (\"ext%.w %2\;ext%.l %2\", operands);
- if (GET_CODE (operands[1]) != MEM
- || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
- output_asm_insn (\"move%.l %4,%3\", operands);
- return \"sub%.l %2,%3\;subx%.l %2,%0\";
-}")
-
-(define_insn "adddi_sexthishl32"
- [(set (match_operand:DI 0 "general_operand" "=o,a,*d,*d")
- (plus:DI (ashift:DI (sign_extend:DI
- (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
- (const_int 32))
- (match_operand:DI 2 "general_operand" "0,0,0,0")))
- (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
- "!TARGET_5200"
- "*
-{
- CC_STATUS_INIT;
- if (ADDRESS_REG_P (operands[0]))
- return \"add%.w %1,%0\";
- else if (ADDRESS_REG_P (operands[3]))
- return \"move%.w %1,%3\;add%.l %3,%0\";
- else
- return \"move%.w %1,%3\;ext%.l %3\;add%.l %3,%0\";
-} ")
-
-(define_insn "adddi_dilshr32"
- [(set (match_operand:DI 0 "general_operand" "=do")
-;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
-;; (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
-;; (const_int 32))))]
- (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
- (const_int 32))
- (match_operand:DI 2 "general_operand" "0")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (GET_CODE (operands[0]) == REG)
- operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else
- operands[2] = adj_offsettable_operand (operands[0], 4);
- return \"add%.l %1,%2\;negx%.l %0\;neg%.l %0\";
-} ")
-
-(define_insn "adddi_dishl32"
- [(set (match_operand:DI 0 "general_operand" "=ro")
-;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
-;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
-;; (const_int 32))))]
- (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro")
- (const_int 32))
- (match_operand:DI 2 "general_operand" "0")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (GET_CODE (operands[1]) == REG)
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else
- operands[1] = adj_offsettable_operand (operands[1], 4);
- return \"add%.l %1,%0\";
-} ")
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "general_operand" "=<,o<>,d,d,d")
- (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0,0")
- (match_operand:DI 2 "general_operand" "<,d,o>,d,a")))
- (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
- ""
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- if (DATA_REG_P (operands[2]))
- return \"add%.l %R2,%R0\;addx%.l %2,%0\";
- else if (GET_CODE (operands[2]) == MEM
- && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
- {
- return \"move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0\";
- }
- else
- {
- /* TODO : this should work also for CONST operands[2] */
- if (GET_CODE (operands[2]) == REG)
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
- else
- operands[1] = adj_offsettable_operand (operands[2], 4);
- return \"move%.l %2,%3\;add%.l %1,%R0\;addx%.l %3,%0\";
- }
- }
- else if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (operands[2]) == MEM
- && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
- return \"add%.l %2,%0\;addx%.l %2,%0\";
- CC_STATUS_INIT;
- if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- {
- operands[1] = gen_rtx (MEM, SImode,
- gen_rtx (PLUS, VOIDmode, XEXP(operands[0], 0),
- gen_rtx (CONST_INT, VOIDmode, -8)));
- return \"move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1\";
- }
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- {
- operands[1] = XEXP(operands[0], 0);
- return \"add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1\";
- }
- else
- {
- operands[1] = adj_offsettable_operand (operands[0], 4);
- return \"add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0\";
- }
- }
-} ")
-
-(define_insn "addsi_lshrsi_31"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
- (const_int 31))
- (match_dup 1)))]
- ""
- "*
-{
- operands[2] = operands[0];
- operands[3] = gen_label_rtx();
- if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- operands[0] = gen_rtx (MEM, SImode, XEXP (XEXP (operands[0], 0), 0));
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- operands[2] = gen_rtx (MEM, SImode, XEXP (XEXP (operands[0], 0), 0));
- }
- output_asm_insn (\"move%.l %1,%0\", operands);
-#ifdef MOTOROLA
- output_asm_insn (\"jbpl %l3\", operands);
-#else
- output_asm_insn (\"jpl %l3\", operands);
-#endif
-#ifndef NO_ADDSUB_Q
- output_asm_insn (\"addq%.l %#1,%2\", operands);
-#else
- output_asm_insn (\"add%.l %#1,%2\", operands);
-#endif
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (operands[3]));
- return \"\";
-}")
-
-;; Note that the middle two alternatives are near-duplicates
-;; in order to handle insns generated by reload.
-;; This is needed since they are not themselves reloaded,
-;; so commutativity won't apply to them.
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "general_operand" "=m,?a,?a,r")
- (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
- (match_operand:SI 2 "general_operand" "dIKLs,rJK,a,mrIKLs")))]
- ""
- "*
-{
- if (! operands_match_p (operands[0], operands[1]))
- {
- if (!ADDRESS_REG_P (operands[1]))
- {
- rtx tmp = operands[1];
-
- operands[1] = operands[2];
- operands[2] = tmp;
- }
-
- /* These insns can result from reloads to access
- stack slots over 64k from the frame pointer. */
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) + 0x8000 >= (unsigned) 0x10000)
- return \"move%.l %2,%0\;add%.l %1,%0\";
-#ifdef SGS
- if (GET_CODE (operands[2]) == REG)
- return \"lea 0(%1,%2.l),%0\";
- else
- return \"lea %c2(%1),%0\";
-#else /* not SGS */
-#ifdef MOTOROLA
- if (GET_CODE (operands[2]) == REG)
- return \"lea (%1,%2.l),%0\";
- else
- return \"lea (%c2,%1),%0\";
-#else /* not MOTOROLA (MIT syntax) */
- if (GET_CODE (operands[2]) == REG)
- return \"lea %1@(0,%2:l),%0\";
- else
- return \"lea %1@(%c2),%0\";
-#endif /* not MOTOROLA */
-#endif /* not SGS */
- }
- if (GET_CODE (operands[2]) == CONST_INT)
- {
-#ifndef NO_ADDSUB_Q
- if (INTVAL (operands[2]) > 0
- && INTVAL (operands[2]) <= 8)
- return \"addq%.l %2,%0\";
- if (INTVAL (operands[2]) < 0
- && INTVAL (operands[2]) >= -8)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- - INTVAL (operands[2]));
- return \"subq%.l %2,%0\";
- }
- /* On the CPU32 it is faster to use two addql instructions to
- add a small integer (8 < N <= 16) to a register.
- Likewise for subql. */
- if (TARGET_CPU32 && REG_P (operands[0]))
- {
- if (INTVAL (operands[2]) > 8
- && INTVAL (operands[2]) <= 16)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) - 8);
- return \"addq%.l %#8,%0\;addq%.l %2,%0\";
- }
- if (INTVAL (operands[2]) < -8
- && INTVAL (operands[2]) >= -16)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- - INTVAL (operands[2]) - 8);
- return \"subq%.l %#8,%0\;subq%.l %2,%0\";
- }
- }
-#endif
- if (ADDRESS_REG_P (operands[0])
- && INTVAL (operands[2]) >= -0x8000
- && INTVAL (operands[2]) < 0x8000)
- {
- if (TARGET_68040)
- return \"add%.w %2,%0\";
- else
-#ifdef MOTOROLA
- return \"lea (%c2,%0),%0\";
-#else
- return \"lea %0@(%c2),%0\";
-#endif
- }
- }
- return \"add%.l %2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=a")
- (plus:SI (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI
- (match_operand:HI 2 "nonimmediate_operand" "rm"))))]
- "!TARGET_5200"
- "add%.w %2,%0")
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "general_operand" "=m,r")
- (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "dn,rmn")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
-#ifndef NO_ADDSUB_Q
- /* If the constant would be a negative number when interpreted as
- HImode, make it negative. This is usually, but not always, done
- elsewhere in the compiler. First check for constants out of range,
- which could confuse us. */
-
- if (INTVAL (operands[2]) >= 32768)
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) - 65536);
-
- if (INTVAL (operands[2]) > 0
- && INTVAL (operands[2]) <= 8)
- return \"addq%.w %2,%0\";
- if (INTVAL (operands[2]) < 0
- && INTVAL (operands[2]) >= -8)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- - INTVAL (operands[2]));
- return \"subq%.w %2,%0\";
- }
- /* On the CPU32 it is faster to use two addqw instructions to
- add a small integer (8 < N <= 16) to a register.
- Likewise for subqw. */
- if (TARGET_CPU32 && REG_P (operands[0]))
- {
- if (INTVAL (operands[2]) > 8
- && INTVAL (operands[2]) <= 16)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) - 8);
- return \"addq%.w %#8,%0\;addq%.w %2,%0\";
- }
- if (INTVAL (operands[2]) < -8
- && INTVAL (operands[2]) >= -16)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- - INTVAL (operands[2]) - 8);
- return \"subq%.w %#8,%0\;subq%.w %2,%0\";
- }
- }
-#endif
- if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
-#ifdef MOTOROLA
- return \"lea (%c2,%0),%0\";
-#else
- return \"lea %0@(%c2),%0\";
-#endif
- }
- return \"add%.w %2,%0\";
-}")
-
-;; These insns must use MATCH_DUP instead of the more expected
-;; use of a matching constraint because the "output" here is also
-;; an input, so you can't use the matching constraint. That also means
-;; that you can't use the "%", so you need patterns with the matched
-;; operand in both positions.
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
- (plus:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dn,rmn")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
-#ifndef NO_ADDSUB_Q
- /* If the constant would be a negative number when interpreted as
- HImode, make it negative. This is usually, but not always, done
- elsewhere in the compiler. First check for constants out of range,
- which could confuse us. */
-
- if (INTVAL (operands[1]) >= 32768)
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[1]) - 65536);
-
- if (INTVAL (operands[1]) > 0
- && INTVAL (operands[1]) <= 8)
- return \"addq%.w %1,%0\";
- if (INTVAL (operands[1]) < 0
- && INTVAL (operands[1]) >= -8)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- - INTVAL (operands[1]));
- return \"subq%.w %1,%0\";
- }
- /* On the CPU32 it is faster to use two addqw instructions to
- add a small integer (8 < N <= 16) to a register.
- Likewise for subqw. */
- if (TARGET_CPU32 && REG_P (operands[0]))
- {
- if (INTVAL (operands[1]) > 8
- && INTVAL (operands[1]) <= 16)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[1]) - 8);
- return \"addq%.w %#8,%0\;addq%.w %1,%0\";
- }
- if (INTVAL (operands[1]) < -8
- && INTVAL (operands[1]) >= -16)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- - INTVAL (operands[1]) - 8);
- return \"subq%.w %#8,%0\;subq%.w %1,%0\";
- }
- }
-#endif
- if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
-#ifdef MOTOROLA
- return \"lea (%c1,%0),%0\";
-#else
- return \"lea %0@(%c1),%0\";
-#endif
- }
- return \"add%.w %1,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
- (plus:HI (match_operand:HI 1 "general_operand" "dn,rmn")
- (match_dup 0)))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
-#ifndef NO_ADDSUB_Q
- /* If the constant would be a negative number when interpreted as
- HImode, make it negative. This is usually, but not always, done
- elsewhere in the compiler. First check for constants out of range,
- which could confuse us. */
-
- if (INTVAL (operands[1]) >= 32768)
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[1]) - 65536);
-
- if (INTVAL (operands[1]) > 0
- && INTVAL (operands[1]) <= 8)
- return \"addq%.w %1,%0\";
- if (INTVAL (operands[1]) < 0
- && INTVAL (operands[1]) >= -8)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- - INTVAL (operands[1]));
- return \"subq%.w %1,%0\";
- }
- /* On the CPU32 it is faster to use two addqw instructions to
- add a small integer (8 < N <= 16) to a register.
- Likewise for subqw. */
- if (TARGET_CPU32 && REG_P (operands[0]))
- {
- if (INTVAL (operands[1]) > 8
- && INTVAL (operands[1]) <= 16)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[1]) - 8);
- return \"addq%.w %#8,%0\;addq%.w %1,%0\";
- }
- if (INTVAL (operands[1]) < -8
- && INTVAL (operands[1]) >= -16)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- - INTVAL (operands[1]) - 8);
- return \"subq%.w %#8,%0\;subq%.w %1,%0\";
- }
- }
-#endif
- if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
-#ifdef MOTOROLA
- return \"lea (%c1,%0),%0\";
-#else
- return \"lea %0@(%c1),%0\";
-#endif
- }
- return \"add%.w %1,%0\";
-}")
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "general_operand" "=m,d")
- (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "*
-{
-#ifndef NO_ADDSUB_Q
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) >= 128)
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) - 256);
-
- if (INTVAL (operands[2]) > 0
- && INTVAL (operands[2]) <= 8)
- return \"addq%.b %2,%0\";
- if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[2]));
- return \"subq%.b %2,%0\";
- }
- }
-#endif
- return \"add%.b %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
- (plus:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "*
-{
-#ifndef NO_ADDSUB_Q
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (INTVAL (operands[1]) >= 128)
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[1]) - 256);
-
- if (INTVAL (operands[1]) > 0
- && INTVAL (operands[1]) <= 8)
- return \"addq%.b %1,%0\";
- if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
- return \"subq%.b %1,%0\";
- }
- }
-#endif
- return \"add%.b %1,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
- (plus:QI (match_operand:QI 1 "general_operand" "dn,dmn")
- (match_dup 0)))]
- "!TARGET_5200"
- "*
-{
-#ifndef NO_ADDSUB_Q
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (INTVAL (operands[1]) >= 128)
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[1]) - 256);
-
- if (INTVAL (operands[1]) > 0
- && INTVAL (operands[1]) <= 8)
- return \"addq%.b %1,%0\";
- if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
- return \"subq%.b %1,%0\";
- }
- }
-#endif
- return \"add%.b %1,%0\";
-}")
-
-(define_expand "adddf3"
- [(set (match_operand:DF 0 "general_operand" "")
- (plus:DF (match_operand:DF 1 "general_operand" "")
- (match_operand:DF 2 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=x,y")
- (plus:DF (match_operand:DF 1 "general_operand" "%xH,y")
- (match_operand:DF 2 "general_operand" "xH,dmF")))]
- "TARGET_FPA"
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"fpadd%.d %y2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"fpadd%.d %y1,%0\";
- if (which_alternative == 0)
- return \"fpadd3%.d %w2,%w1,%0\";
- return \"fpadd3%.d %x2,%x1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (plus:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
- (match_operand:DF 1 "general_operand" "0")))]
- "TARGET_68881"
- "f%&add%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (plus:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
- (match_operand:DF 1 "general_operand" "0")))]
- "TARGET_68881"
- "f%&add%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (plus:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
- (match_operand:DF 1 "general_operand" "0")))]
- "TARGET_68881"
- "f%&add%.b %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (plus:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "fmG")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[2]))
- return \"f%&add%.x %2,%0\";
- return \"f%&add%.d %f2,%0\";
-}")
-
-(define_expand "addsf3"
- [(set (match_operand:SF 0 "general_operand" "")
- (plus:SF (match_operand:SF 1 "general_operand" "")
- (match_operand:SF 2 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=x,y")
- (plus:SF (match_operand:SF 1 "general_operand" "%xH,y")
- (match_operand:SF 2 "general_operand" "xH,rmF")))]
- "TARGET_FPA"
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"fpadd%.s %w2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"fpadd%.s %w1,%0\";
- if (which_alternative == 0)
- return \"fpadd3%.s %w2,%w1,%0\";
- return \"fpadd3%.s %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (plus:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
- (match_operand:SF 1 "general_operand" "0")))]
- "TARGET_68881"
- "f%$add%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (plus:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
- (match_operand:SF 1 "general_operand" "0")))]
- "TARGET_68881"
- "f%$add%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (plus:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
- (match_operand:SF 1 "general_operand" "0")))]
- "TARGET_68881"
- "f%$add%.b %2,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (plus:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "fdmF")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
- return \"f%$add%.x %2,%0\";
- return \"f%$add%.s %f2,%0\";
-}")
-
-;; subtract instructions
-
-(define_insn "subdi_sexthishl32"
- [(set (match_operand:DI 0 "general_operand" "=o,a,*d,*d")
- (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
- (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
- (const_int 32))))
- (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
- "!TARGET_5200"
- "*
-{
- CC_STATUS_INIT;
- if (ADDRESS_REG_P (operands[0]))
- return \"sub%.w %2,%0\";
- else if (ADDRESS_REG_P (operands[3]))
- return \"move%.w %2,%3\;sub%.l %3,%0\";
- else
- return \"move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0\";
-} ")
-
-(define_insn "subdi_dishl32"
- [(set (match_operand:DI 0 "general_operand" "+ro")
- (minus:DI (match_dup 0)
- (ashift:DI (match_operand:DI 1 "general_operand" "ro")
- (const_int 32))))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (GET_CODE (operands[1]) == REG)
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else
- operands[1] = adj_offsettable_operand (operands[1], 4);
- return \"sub%.l %1,%0\";
-} ")
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "general_operand" "=<,o<>,d,d,d")
- (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0,0")
- (match_operand:DI 2 "general_operand" "<,d,o>,d,a")))
- (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
- ""
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- if (DATA_REG_P (operands[2]))
- return \"sub%.l %R2,%R0\;subx%.l %2,%0\";
- else if (GET_CODE (operands[2]) == MEM
- && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
- {
- return \"move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0\";
- }
- else
- {
- /* TODO : this should work also for CONST operands[2] */
- if (GET_CODE (operands[2]) == REG)
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
- else
- operands[1] = adj_offsettable_operand (operands[2], 4);
- return \"move%.l %2,%3\;sub%.l %1,%R0\;subx%.l %3,%0\";
- }
- }
- else if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (operands[2]) == MEM
- && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
- return \"sub%.l %2,%0\;subx%.l %2,%0\";
- CC_STATUS_INIT;
- if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- {
- operands[1] = gen_rtx (MEM, SImode,
- gen_rtx (PLUS, VOIDmode, XEXP(operands[0], 0),
- gen_rtx (CONST_INT, VOIDmode, -8)));
- return \"move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1\";
- }
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- {
- operands[1] = XEXP(operands[0], 0);
- return \"sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1\";
- }
- else
- {
- operands[1] = adj_offsettable_operand (operands[0], 4);
- return \"sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0\";
- }
- }
-} ")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "general_operand" "=m,r")
- (minus:SI (match_operand:SI 1 "general_operand" "0,0")
- (match_operand:SI 2 "general_operand" "ds,mrs")))]
- ""
- "sub%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=a")
- (minus:SI (match_operand:SI 1 "general_operand" "0")
- (sign_extend:SI
- (match_operand:HI 2 "nonimmediate_operand" "rm"))))]
- "!TARGET_5200"
- "sub%.w %2,%0")
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "general_operand" "=m,r")
- (minus:HI (match_operand:HI 1 "general_operand" "0,0")
- (match_operand:HI 2 "general_operand" "dn,rmn")))]
- "!TARGET_5200"
- "sub%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
- (minus:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dn,rmn")))]
- "!TARGET_5200"
- "sub%.w %1,%0")
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "general_operand" "=m,d")
- (minus:QI (match_operand:QI 1 "general_operand" "0,0")
- (match_operand:QI 2 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "sub%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
- (minus:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "sub%.b %1,%0")
-
-(define_expand "subdf3"
- [(set (match_operand:DF 0 "general_operand" "")
- (minus:DF (match_operand:DF 1 "general_operand" "")
- (match_operand:DF 2 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=x,y,y")
- (minus:DF (match_operand:DF 1 "general_operand" "xH,y,dmF")
- (match_operand:DF 2 "general_operand" "xH,dmF,0")))]
- "TARGET_FPA"
- "*
-{
- if (rtx_equal_p (operands[0], operands[2]))
- return \"fprsub%.d %y1,%0\";
- if (rtx_equal_p (operands[0], operands[1]))
- return \"fpsub%.d %y2,%0\";
- if (which_alternative == 0)
- return \"fpsub3%.d %w2,%w1,%0\";
- return \"fpsub3%.d %x2,%x1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (minus:DF (match_operand:DF 1 "general_operand" "0")
- (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
- "TARGET_68881"
- "f%&sub%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (minus:DF (match_operand:DF 1 "general_operand" "0")
- (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "f%&sub%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (minus:DF (match_operand:DF 1 "general_operand" "0")
- (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "f%&sub%.b %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (minus:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "fmG")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[2]))
- return \"f%&sub%.x %2,%0\";
- return \"f%&sub%.d %f2,%0\";
-}")
-
-(define_expand "subsf3"
- [(set (match_operand:SF 0 "general_operand" "")
- (minus:SF (match_operand:SF 1 "general_operand" "")
- (match_operand:SF 2 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=x,y,y")
- (minus:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
- (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
- "TARGET_FPA"
- "*
-{
- if (rtx_equal_p (operands[0], operands[2]))
- return \"fprsub%.s %w1,%0\";
- if (rtx_equal_p (operands[0], operands[1]))
- return \"fpsub%.s %w2,%0\";
- if (which_alternative == 0)
- return \"fpsub3%.s %w2,%w1,%0\";
- return \"fpsub3%.s %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (minus:SF (match_operand:SF 1 "general_operand" "0")
- (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
- "TARGET_68881"
- "f%$sub%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (minus:SF (match_operand:SF 1 "general_operand" "0")
- (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "f%$sub%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (minus:SF (match_operand:SF 1 "general_operand" "0")
- (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "f%$sub%.b %2,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (minus:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "fdmF")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
- return \"f%$sub%.x %2,%0\";
- return \"f%$sub%.s %f2,%0\";
-}")
-
-;; multiply instructions
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (mult:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "dmn")))]
- ""
- "*
-{
-#if defined(MOTOROLA) && !defined(CRDS)
- return \"muls%.w %2,%0\";
-#else
- return \"muls %2,%0\";
-#endif
-}")
-
-(define_insn "mulhisi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (sign_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "%0"))
- (sign_extend:SI
- (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
- ""
- "*
-{
-#if defined(MOTOROLA) && !defined(CRDS)
- return \"muls%.w %2,%0\";
-#else
- return \"muls %2,%0\";
-#endif
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (sign_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "%0"))
- (match_operand:SI 2 "const_int_operand" "n")))]
- "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
- "*
-{
-#if defined(MOTOROLA) && !defined(CRDS)
- return \"muls%.w %2,%0\";
-#else
- return \"muls %2,%0\";
-#endif
-}")
-
-(define_expand "mulsi3"
- [(set (match_operand:SI 0 "general_operand" "")
- (mult:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- "TARGET_68020 || TARGET_5200"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "dmsK")))]
- "TARGET_68020"
- "muls%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "d<>")))]
- "TARGET_5200"
- "muls%.l %2,%0")
-
-(define_insn "umulhisi3"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (zero_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "%0"))
- (zero_extend:SI
- (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
- ""
- "*
-{
-#if defined(MOTOROLA) && !defined(CRDS)
- return \"mulu%.w %2,%0\";
-#else
- return \"mulu %2,%0\";
-#endif
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (mult:SI (zero_extend:SI
- (match_operand:HI 1 "nonimmediate_operand" "%0"))
- (match_operand:SI 2 "const_int_operand" "n")))]
- "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
- "*
-{
-#if defined(MOTOROLA) && !defined(CRDS)
- return \"mulu%.w %2,%0\";
-#else
- return \"mulu %2,%0\";
-#endif
-}")
-
-;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
-;; proper matching constraint. This is because the matching is between
-;; the high-numbered word of the DImode operand[0] and operand[1].
-(define_expand "umulsidi3"
- [(parallel
- [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 1)
- (mult:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonimmediate_operand" "")))
- (set (subreg:SI (match_dup 0) 0)
- (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
- (zero_extend:DI (match_dup 2)))
- (const_int 32))))])]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mult:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "nonimmediate_operand" "dm")))
- (set (match_operand:SI 3 "register_operand" "=d")
- (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
- (zero_extend:DI (match_dup 2)))
- (const_int 32))))]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "mulu%.l %2,%3:%0")
-
-; Match immediate case. For 2.4 only match things < 2^31.
-; It's tricky with larger values in these patterns since we need to match
-; values between the two parallel multiplies, between a CONST_DOUBLE and
-; a CONST_INT.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mult:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "const_int_operand" "n")))
- (set (match_operand:SI 3 "register_operand" "=d")
- (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
- (match_dup 2))
- (const_int 32))))]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200
- && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
- "mulu%.l %2,%3:%0")
-
-(define_expand "mulsidi3"
- [(parallel
- [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 1)
- (mult:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonimmediate_operand" "")))
- (set (subreg:SI (match_dup 0) 0)
- (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
- (sign_extend:DI (match_dup 2)))
- (const_int 32))))])]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mult:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "nonimmediate_operand" "dm")))
- (set (match_operand:SI 3 "register_operand" "=d")
- (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
- (sign_extend:DI (match_dup 2)))
- (const_int 32))))]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "muls%.l %2,%3:%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mult:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "const_sint32_operand" "")))
- (set (match_operand:SI 3 "register_operand" "=d")
- (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
- (match_dup 2))
- (const_int 32))))]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "muls%.l %2,%3:%0")
-
-(define_expand "umulsi3_highpart"
- [(parallel
- [(set (match_operand:SI 0 "register_operand" "")
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
- (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
- (const_int 32))))
- (clobber (match_dup 3))])]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "
-{
- operands[3] = gen_reg_rtx (SImode);
- if (GET_CODE (operands[2]) == CONST_INT
- || GET_CODE (operands[2]) == CONST_DOUBLE)
- {
- if (! const_uint32_operand (operands[2], VOIDmode))
- abort ();
- /* We have to adjust the operand order for the matching constraints. */
- emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
- operands[1], operands[2]));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
- (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
- (const_int 32))))
- (clobber (match_operand:SI 1 "register_operand" "=d"))]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "mulu%.l %3,%0:%1")
-
-(define_insn "const_umulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
- (match_operand 3 "const_uint32_operand" ""))
- (const_int 32))))
- (clobber (match_operand:SI 1 "register_operand" "=d"))]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "mulu%.l %3,%0:%1")
-
-(define_expand "smulsi3_highpart"
- [(parallel
- [(set (match_operand:SI 0 "register_operand" "")
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
- (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
- (const_int 32))))
- (clobber (match_dup 3))])]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "
-{
- operands[3] = gen_reg_rtx (SImode);
- if (GET_CODE (operands[2]) == CONST_INT
- || GET_CODE (operands[2]) == CONST_DOUBLE)
- {
- if (! const_sint32_operand (operands[2], VOIDmode))
- abort ();
- /* We have to adjust the operand order for the matching constraints. */
- emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
- operands[1], operands[2]));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
- (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
- (const_int 32))))
- (clobber (match_operand:SI 1 "register_operand" "=d"))]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "muls%.l %3,%0:%1")
-
-(define_insn "const_smulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI
- (lshiftrt:DI
- (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
- (match_operand 3 "const_sint32_operand" ""))
- (const_int 32))))
- (clobber (match_operand:SI 1 "register_operand" "=d"))]
- "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
- "muls%.l %3,%0:%1")
-
-(define_expand "muldf3"
- [(set (match_operand:DF 0 "general_operand" "")
- (mult:DF (match_operand:DF 1 "general_operand" "")
- (match_operand:DF 2 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=x,y")
- (mult:DF (match_operand:DF 1 "general_operand" "%xH,y")
- (match_operand:DF 2 "general_operand" "xH,rmF")))]
- "TARGET_FPA"
- "*
-{
- if (rtx_equal_p (operands[1], operands[2]))
- return \"fpsqr%.d %y1,%0\";
- if (rtx_equal_p (operands[0], operands[1]))
- return \"fpmul%.d %y2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"fpmul%.d %y1,%0\";
- if (which_alternative == 0)
- return \"fpmul3%.d %w2,%w1,%0\";
- return \"fpmul3%.d %x2,%x1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (mult:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
- (match_operand:DF 1 "general_operand" "0")))]
- "TARGET_68881"
- "f%&mul%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (mult:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
- (match_operand:DF 1 "general_operand" "0")))]
- "TARGET_68881"
- "f%&mul%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (mult:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
- (match_operand:DF 1 "general_operand" "0")))]
- "TARGET_68881"
- "f%&mul%.b %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (mult:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "fmG")))]
- "TARGET_68881"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_DOUBLE
- && floating_exact_log2 (operands[2]) && !TARGET_68040 && !TARGET_68060)
- {
- int i = floating_exact_log2 (operands[2]);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, i);
- return \"fscale%.l %2,%0\";
- }
- if (REG_P (operands[2]))
- return \"f%&mul%.x %2,%0\";
- return \"f%&mul%.d %f2,%0\";
-}")
-
-(define_expand "mulsf3"
- [(set (match_operand:SF 0 "general_operand" "")
- (mult:SF (match_operand:SF 1 "general_operand" "")
- (match_operand:SF 2 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=x,y")
- (mult:SF (match_operand:SF 1 "general_operand" "%xH,y")
- (match_operand:SF 2 "general_operand" "xH,rmF")))]
- "TARGET_FPA"
- "*
-{
- if (rtx_equal_p (operands[1], operands[2]))
- return \"fpsqr%.s %w1,%0\";
- if (rtx_equal_p (operands[0], operands[1]))
- return \"fpmul%.s %w2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"fpmul%.s %w1,%0\";
- if (which_alternative == 0)
- return \"fpmul3%.s %w2,%w1,%0\";
- return \"fpmul3%.s %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (mult:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
- (match_operand:SF 1 "general_operand" "0")))]
- "TARGET_68881"
- "*
-{
- return (TARGET_68040_ONLY
- ? \"fsmul%.l %2,%0\"
- : \"fsglmul%.l %2,%0\");
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (mult:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
- (match_operand:SF 1 "general_operand" "0")))]
- "TARGET_68881"
- "*
-{
- return (TARGET_68040_ONLY
- ? \"fsmul%.w %2,%0\"
- : \"fsglmul%.w %2,%0\");
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (mult:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
- (match_operand:SF 1 "general_operand" "0")))]
- "TARGET_68881"
- "*
-{
- return (TARGET_68040_ONLY
- ? \"fsmul%.b %2,%0\"
- : \"fsglmul%.b %2,%0\");
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (mult:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "fdmF")))]
- "TARGET_68881"
- "*
-{
-#ifdef FSGLMUL_USE_S
- if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
- return (TARGET_68040_ONLY
- ? \"fsmul%.s %2,%0\"
- : \"fsglmul%.s %2,%0\");
-#else
- if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
- return (TARGET_68040_ONLY
- ? \"fsmul%.x %2,%0\"
- : \"fsglmul%.x %2,%0\");
-#endif
- return (TARGET_68040_ONLY
- ? \"fsmul%.s %f2,%0\"
- : \"fsglmul%.s %f2,%0\");
-}")
-
-;; divide instructions
-
-(define_expand "divdf3"
- [(set (match_operand:DF 0 "general_operand" "")
- (div:DF (match_operand:DF 1 "general_operand" "")
- (match_operand:DF 2 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=x,y,y")
- (div:DF (match_operand:DF 1 "general_operand" "xH,y,rmF")
- (match_operand:DF 2 "general_operand" "xH,rmF,0")))]
- "TARGET_FPA"
- "*
-{
- if (rtx_equal_p (operands[0], operands[2]))
- return \"fprdiv%.d %y1,%0\";
- if (rtx_equal_p (operands[0], operands[1]))
- return \"fpdiv%.d %y2,%0\";
- if (which_alternative == 0)
- return \"fpdiv3%.d %w2,%w1,%0\";
- return \"fpdiv3%.d %x2,%x1,%x0\";
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (div:DF (match_operand:DF 1 "general_operand" "0")
- (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
- "TARGET_68881"
- "f%&div%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (div:DF (match_operand:DF 1 "general_operand" "0")
- (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "f%&div%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (div:DF (match_operand:DF 1 "general_operand" "0")
- (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "f%&div%.b %2,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (div:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "fmG")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[2]))
- return \"f%&div%.x %2,%0\";
- return \"f%&div%.d %f2,%0\";
-}")
-
-(define_expand "divsf3"
- [(set (match_operand:SF 0 "general_operand" "")
- (div:SF (match_operand:SF 1 "general_operand" "")
- (match_operand:SF 2 "general_operand" "")))]
- "TARGET_68881 || TARGET_FPA"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=x,y,y")
- (div:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
- (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
- "TARGET_FPA"
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"fpdiv%.s %w2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"fprdiv%.s %w1,%0\";
- if (which_alternative == 0)
- return \"fpdiv3%.s %w2,%w1,%0\";
- return \"fpdiv3%.s %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (div:SF (match_operand:SF 1 "general_operand" "0")
- (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
- "TARGET_68881"
- "*
-{
- return (TARGET_68040_ONLY
- ? \"fsdiv%.l %2,%0\"
- : \"fsgldiv%.l %2,%0\");
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (div:SF (match_operand:SF 1 "general_operand" "0")
- (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "*
-{
- return (TARGET_68040_ONLY
- ? \"fsdiv%.w %2,%0\"
- : \"fsgldiv%.w %2,%0\");
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (div:SF (match_operand:SF 1 "general_operand" "0")
- (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "*
-{
- return (TARGET_68040_ONLY
- ? \"fsdiv%.b %2,%0\"
- : \"fsgldiv%.b %2,%0\");
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (div:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "fdmF")))]
- "TARGET_68881"
- "*
-{
-#ifdef FSGLDIV_USE_S
- if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
- return (TARGET_68040_ONLY
- ? \"fsdiv%.s %2,%0\"
- : \"fsgldiv%.s %2,%0\");
-#else
- if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
- return (TARGET_68040_ONLY
- ? \"fsdiv%.x %2,%0\"
- : \"fsgldiv%.x %2,%0\");
-#endif
- return (TARGET_68040_ONLY
- ? \"fsdiv%.s %f2,%0\"
- : \"fsgldiv%.s %f2,%0\");
-}")
-
-;; Remainder instructions.
-
-(define_insn "divmodsi4"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dmsK")))
- (set (match_operand:SI 3 "general_operand" "=d")
- (mod:SI (match_dup 1) (match_dup 2)))]
- "TARGET_68020 && !TARGET_5200"
- "*
-{
- if (find_reg_note (insn, REG_UNUSED, operands[3]))
- return \"divs%.l %2,%0\";
- else
- return \"divsl%.l %2,%3:%0\";
-}")
-
-(define_insn "udivmodsi4"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (udiv:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dmsK")))
- (set (match_operand:SI 3 "general_operand" "=d")
- (umod:SI (match_dup 1) (match_dup 2)))]
- "TARGET_68020 && !TARGET_5200"
- "*
-{
- if (find_reg_note (insn, REG_UNUSED, operands[3]))
- return \"divu%.l %2,%0\";
- else
- return \"divul%.l %2,%3:%0\";
-}")
-
-(define_insn "divmodhi4"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (div:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dmsK")))
- (set (match_operand:HI 3 "general_operand" "=d")
- (mod:HI (match_dup 1) (match_dup 2)))]
- "!TARGET_5200"
- "*
-{
-#ifdef MOTOROLA
- output_asm_insn(\"ext%.l %0\;divs%.w %2,%0\", operands);
-#else
- output_asm_insn(\"extl %0\;divs %2,%0\", operands);
-#endif
- if (!find_reg_note(insn, REG_UNUSED, operands[3]))
- {
- CC_STATUS_INIT;
- return \"move%.l %0,%3\;swap %3\";
- }
- else
- return \"\";
-}")
-
-(define_insn "udivmodhi4"
- [(set (match_operand:HI 0 "general_operand" "=d")
- (udiv:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "dmsK")))
- (set (match_operand:HI 3 "general_operand" "=d")
- (umod:HI (match_dup 1) (match_dup 2)))]
- "!TARGET_5200"
- "*
-{
-#ifdef MOTOROLA
- output_asm_insn(\"and%.l %#0xFFFF,%0\;divu%.w %2,%0\", operands);
-#else
- output_asm_insn(\"and%.l %#0xFFFF,%0\;divu %2,%0\", operands);
-#endif
- if (!find_reg_note(insn, REG_UNUSED, operands[3]))
- {
- CC_STATUS_INIT;
- return \"move%.l %0,%3\;swap %3\";
- }
- else
- return \"\";
-}")
-
-;; logical-and instructions
-
-;; Prevent AND from being made with sp. This doesn't exist in the machine
-;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
-;; can't allocate pseudos into it.
-
-(define_expand "andsi3"
- [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
- (and:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "dKs,dmMs")))]
- ""
- "")
-
-(define_insn "andsi3_internal"
- [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
- (and:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "dKs,dmMs")))]
- "!TARGET_5200"
- "*
-{
- int logval;
- if (GET_CODE (operands[2]) == CONST_INT
- && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
- && (DATA_REG_P (operands[0])
- || offsettable_memref_p (operands[0])))
- {
- if (GET_CODE (operands[0]) != REG)
- operands[0] = adj_offsettable_operand (operands[0], 2);
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & 0xffff);
- /* Do not delete a following tstl %0 insn; that would be incorrect. */
- CC_STATUS_INIT;
- if (operands[2] == const0_rtx)
- return \"clr%.w %0\";
- return \"and%.w %2,%0\";
- }
- if (GET_CODE (operands[2]) == CONST_INT
- && (logval = exact_log2 (~ INTVAL (operands[2]))) >= 0
- && (DATA_REG_P (operands[0])
- || offsettable_memref_p (operands[0])))
- {
- if (DATA_REG_P (operands[0]))
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
- }
- else
- {
- operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
- operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
- }
- /* This does not set condition codes in a standard way. */
- CC_STATUS_INIT;
- return \"bclr %1,%0\";
- }
- return \"and%.l %2,%0\";
-}")
-
-(define_insn "andsi3_5200"
- [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
- (and:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "d,dmsK")))]
- "TARGET_5200"
- "and%.l %2,%0")
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "general_operand" "=m,d")
- (and:HI (match_operand:HI 1 "general_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "and%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
- (and:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "and%.w %1,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
- (and:HI (match_operand:HI 1 "general_operand" "dn,dmn")
- (match_dup 0)))]
- "!TARGET_5200"
- "and%.w %1,%0")
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "general_operand" "=m,d")
- (and:QI (match_operand:QI 1 "general_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "and%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
- (and:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "and%.b %1,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
- (and:QI (match_operand:QI 1 "general_operand" "dn,dmn")
- (match_dup 0)))]
- "!TARGET_5200"
- "and%.b %1,%0")
-
-;; inclusive-or instructions
-
-(define_expand "iorsi3"
- [(set (match_operand:SI 0 "general_operand" "")
- (ior:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "")
-
-(define_insn "iorsi3_internal"
- [(set (match_operand:SI 0 "general_operand" "=m,d")
- (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "dKs,dmMs")))]
- "!TARGET_5200"
- "*
-{
- register int logval;
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) >> 16 == 0
- && (DATA_REG_P (operands[0])
- || offsettable_memref_p (operands[0])))
- {
- if (GET_CODE (operands[0]) != REG)
- operands[0] = adj_offsettable_operand (operands[0], 2);
- /* Do not delete a following tstl %0 insn; that would be incorrect. */
- CC_STATUS_INIT;
- return \"or%.w %2,%0\";
- }
- if (GET_CODE (operands[2]) == CONST_INT
- && (logval = exact_log2 (INTVAL (operands[2]))) >= 0
- && (DATA_REG_P (operands[0])
- || offsettable_memref_p (operands[0])))
- {
- if (DATA_REG_P (operands[0]))
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
- }
- else
- {
- operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
- operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
- }
- CC_STATUS_INIT;
- return \"bset %1,%0\";
- }
- return \"or%.l %2,%0\";
-}")
-
-(define_insn "iorsi3_5200"
- [(set (match_operand:SI 0 "general_operand" "=m,d")
- (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "d,dmsK")))]
- "TARGET_5200"
- "or%.l %2,%0")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "general_operand" "=m,d")
- (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "or%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
- (ior:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "or%.w %1,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
- (ior:HI (match_operand:HI 1 "general_operand" "dn,dmn")
- (match_dup 0)))]
- "!TARGET_5200"
- "or%.w %1,%0")
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "general_operand" "=m,d")
- (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
- (match_operand:QI 2 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "or%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
- (ior:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dn,dmn")))]
- "!TARGET_5200"
- "or%.b %1,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
- (ior:QI (match_operand:QI 1 "general_operand" "dn,dmn")
- (match_dup 0)))]
- "!TARGET_5200"
- "or%.b %1,%0")
-
-;; On all 68k models, this makes faster code in a special case.
-;; See also ashlsi_16, ashrsi_16 and lshrsi_16.
-
-(define_insn "iorsi_zexthi_ashl16"
- [(set (match_operand:SI 0 "general_operand" "=d,d")
- (ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "dmn,dmn"))
- (ashift:SI (match_operand:SI 2 "general_operand" "o,0")
- (const_int 16))))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (GET_CODE (operands[2]) != REG)
- {
- operands[2] = adj_offsettable_operand (operands[2], 2);
- output_asm_insn (\"move%.w %2,%0\", operands);
- }
- return \"swap %0\;mov%.w %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=o,d")
- (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
- (match_operand:SI 2 "general_operand" "0,0")))]
- "!TARGET_5200"
- "*
-{
- int byte_mode;
-
- CC_STATUS_INIT;
- byte_mode = (GET_MODE(operands[1]) == QImode);
- if (GET_CODE (operands[0]) == MEM)
- operands[0] = adj_offsettable_operand (operands[0], byte_mode ? 3 : 2);
- if (byte_mode)
- return \"or%.b %1,%0\";
- else
- return \"or%.w %1,%0\";
-}")
-
-;; xor instructions
-
-(define_expand "xorsi3"
- [(set (match_operand:SI 0 "general_operand" "")
- (xor:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "")
-
-(define_insn "xorsi3_internal"
- [(set (match_operand:SI 0 "general_operand" "=do,m")
- (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "di,dKs")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) >> 16 == 0
- && (offsettable_memref_p (operands[0]) || DATA_REG_P (operands[0])))
- {
- if (! DATA_REG_P (operands[0]))
- operands[0] = adj_offsettable_operand (operands[0], 2);
- /* Do not delete a following tstl %0 insn; that would be incorrect. */
- CC_STATUS_INIT;
- return \"eor%.w %2,%0\";
- }
- return \"eor%.l %2,%0\";
-}")
-
-(define_insn "xorsi3_5200"
- [(set (match_operand:SI 0 "general_operand" "=dm,d")
- (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "d,Ks")))]
- "TARGET_5200"
- "eor%.l %2,%0")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (xor:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "dn")))]
- "!TARGET_5200"
- "eor%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
- (xor:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dn")))]
- "!TARGET_5200"
- "eor%.w %1,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
- (xor:HI (match_operand:HI 1 "general_operand" "dn")
- (match_dup 0)))]
- "!TARGET_5200"
- "eor%.w %1,%0")
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (xor:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "dn")))]
- "!TARGET_5200"
- "eor%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
- (xor:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dn")))]
- "!TARGET_5200"
- "eor%.b %1,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
- (xor:QI (match_operand:QI 1 "general_operand" "dn")
- (match_dup 0)))]
- "!TARGET_5200"
- "eor%.b %1,%0")
-
-;; negation instructions
-
-(define_expand "negdi2"
- [(set (match_operand:DI 0 "general_operand" "")
- (neg:DI (match_operand:DI 1 "general_operand" "")))]
- ""
- "
-{
- if (TARGET_5200)
- emit_insn (gen_negdi2_5200 (operands[0], operands[1]));
- else
- emit_insn (gen_negdi2_internal (operands[0], operands[1]));
- DONE;
-}")
-
-(define_insn "negdi2_internal"
- [(set (match_operand:DI 0 "general_operand" "=<,do,!*a")
- (neg:DI (match_operand:DI 1 "general_operand" "0,0,0")))]
- "!TARGET_5200"
- "*
-{
- if (which_alternative == 0)
- return \"neg%.l %0\;negx%.l %0\";
- if (GET_CODE (operands[0]) == REG)
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else
- operands[1] = adj_offsettable_operand (operands[0], 4);
- if (ADDRESS_REG_P (operands[0]))
- return \"exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0\";
- else
- return \"neg%.l %1\;negx%.l %0\";
-} ")
-
-(define_insn "negdi2_5200"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (neg:DI (match_operand:DI 1 "general_operand" "0")))]
- "TARGET_5200"
- "*
-{
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"neg%.l %1\;negx%.l %0\";
-} ")
-
-(define_expand "negsi2"
- [(set (match_operand:SI 0 "general_operand" "")
- (neg:SI (match_operand:SI 1 "general_operand" "")))]
- ""
- "
-{
- if (TARGET_5200)
- emit_insn (gen_negsi2_5200 (operands[0], operands[1]));
- else
- emit_insn (gen_negsi2_internal (operands[0], operands[1]));
- DONE;
-}")
-
-(define_insn "negsi2_internal"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (neg:SI (match_operand:SI 1 "general_operand" "0")))]
- "!TARGET_5200"
- "neg%.l %0")
-
-(define_insn "negsi2_5200"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (neg:SI (match_operand:SI 1 "general_operand" "0")))]
- "TARGET_5200"
- "neg%.l %0")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (neg:HI (match_operand:HI 1 "general_operand" "0")))]
- "!TARGET_5200"
- "neg%.w %0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
- (neg:HI (match_dup 0)))]
- "!TARGET_5200"
- "neg%.w %0")
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (neg:QI (match_operand:QI 1 "general_operand" "0")))]
- "!TARGET_5200"
- "neg%.b %0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
- (neg:QI (match_dup 0)))]
- "!TARGET_5200"
- "neg%.b %0")
-
-;; If using software floating point, just flip the sign bit.
-
-(define_expand "negsf2"
- [(set (match_operand:SF 0 "general_operand" "")
- (neg:SF (match_operand:SF 1 "general_operand" "")))]
- ""
- "
-{
- if (!TARGET_FPA && !TARGET_68881)
- {
- rtx result;
- rtx target;
-
- target = operand_subword_force (operands[0], 0, SFmode);
- result = expand_binop (SImode, xor_optab,
- operand_subword_force (operands[1], 0, SFmode),
- GEN_INT(0x80000000), target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- /* Make a place for REG_EQUAL. */
- emit_move_insn (operands[0], operands[0]);
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=x,y")
- (neg:SF (match_operand:SF 1 "general_operand" "xH,rmF")))]
- "TARGET_FPA"
- "fpneg%.s %w1,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f,d")
- (neg:SF (match_operand:SF 1 "general_operand" "fdmF,0")))]
- "TARGET_68881"
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode, 31);
- return \"bchg %1,%0\";
- }
- if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
- return \"f%$neg%.x %1,%0\";
- return \"f%$neg%.s %f1,%0\";
-}")
-
-(define_expand "negdf2"
- [(set (match_operand:DF 0 "general_operand" "")
- (neg:DF (match_operand:DF 1 "general_operand" "")))]
- ""
- "
-{
- if (!TARGET_FPA && !TARGET_68881)
- {
- rtx result;
- rtx target;
- rtx insns;
-
- start_sequence ();
- target = operand_subword (operands[0], 0, 1, DFmode);
- result = expand_binop (SImode, xor_optab,
- operand_subword_force (operands[1], 0, DFmode),
- GEN_INT(0x80000000), target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
- operand_subword_force (operands[1], 1, DFmode));
-
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=x,y")
- (neg:DF (match_operand:DF 1 "general_operand" "xH,rmF")))]
- "TARGET_FPA"
- "fpneg%.d %y1, %0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f,d")
- (neg:DF (match_operand:DF 1 "general_operand" "fmF,0")))]
- "TARGET_68881"
- "*
-{
- if (DATA_REG_P (operands[0]))
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode, 31);
- return \"bchg %1,%0\";
- }
- if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
- return \"f%&neg%.x %1,%0\";
- return \"f%&neg%.d %f1,%0\";
-}")
-
-;; Sqrt instruction for the 68881
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (sqrt:SF (match_operand:SF 1 "general_operand" "fm")))]
- "TARGET_68881"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"f%$sqrt%.x %1,%0\";
- else
- return \"f%$sqrt%.s %1,%0\";
-}")
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (sqrt:DF (match_operand:DF 1 "general_operand" "fm")))]
- "TARGET_68881"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"f%&sqrt%.x %1,%0\";
- else
- return \"f%&sqrt%.d %1,%0\";
-}")
-
-;; Absolute value instructions
-;; If using software floating point, just zero the sign bit.
-
-(define_expand "abssf2"
- [(set (match_operand:SF 0 "general_operand" "")
- (abs:SF (match_operand:SF 1 "general_operand" "")))]
- ""
- "
-{
- if (!TARGET_FPA && !TARGET_68881)
- {
- rtx result;
- rtx target;
-
- target = operand_subword_force (operands[0], 0, SFmode);
- result = expand_binop (SImode, and_optab,
- operand_subword_force (operands[1], 0, SFmode),
- GEN_INT(0x7fffffff), target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- /* Make a place for REG_EQUAL. */
- emit_move_insn (operands[0], operands[0]);
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=x,y")
- (abs:SF (match_operand:SF 1 "general_operand" "xH,rmF")))]
- "TARGET_FPA"
- "fpabs%.s %y1,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=f")
- (abs:SF (match_operand:SF 1 "general_operand" "fdmF")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
- return \"f%$abs%.x %1,%0\";
- return \"f%$abs%.s %f1,%0\";
-}")
-
-(define_expand "absdf2"
- [(set (match_operand:DF 0 "general_operand" "")
- (abs:DF (match_operand:DF 1 "general_operand" "")))]
- ""
- "
-{
- if (!TARGET_FPA && !TARGET_68881)
- {
- rtx result;
- rtx target;
- rtx insns;
-
- start_sequence ();
- target = operand_subword (operands[0], 0, 1, DFmode);
- result = expand_binop (SImode, and_optab,
- operand_subword_force (operands[1], 0, DFmode),
- GEN_INT(0x7fffffff), target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
- operand_subword_force (operands[1], 1, DFmode));
-
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=x,y")
- (abs:DF (match_operand:DF 1 "general_operand" "xH,rmF")))]
- "TARGET_FPA"
- "fpabs%.d %y1,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=f")
- (abs:DF (match_operand:DF 1 "general_operand" "fmF")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
- return \"f%&abs%.x %1,%0\";
- return \"f%&abs%.d %f1,%0\";
-}")
-
-;; one complement instructions
-
-;; "one_cmpldi2" is only here to help combine().
-(define_insn "one_cmpldi2"
- [(set (match_operand:DI 0 "general_operand" "=dm")
- (not:DI (match_operand:DI 1 "general_operand" "0")))]
- "!TARGET_5200"
- "*
-{
- CC_STATUS_INIT;
- if (GET_CODE (operands[0]) == REG)
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC
- || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- operands[1] = operands[0];
- else
- operands[1] = adj_offsettable_operand (operands[0], 4);
- return \"not%.l %1\;not%.l %0\";
-}")
-
-(define_expand "one_cmplsi2"
- [(set (match_operand:SI 0 "general_operand" "")
- (not:SI (match_operand:SI 1 "general_operand" "")))]
- ""
- "
-{
- if (TARGET_5200)
- emit_insn (gen_one_cmplsi2_5200 (operands[0], operands[1]));
- else
- emit_insn (gen_one_cmplsi2_internal (operands[0], operands[1]));
- DONE;
-}")
-
-(define_insn "one_cmplsi2_internal"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (not:SI (match_operand:SI 1 "general_operand" "0")))]
- "!TARGET_5200"
- "not%.l %0")
-
-(define_insn "one_cmplsi2_5200"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (not:SI (match_operand:SI 1 "general_operand" "0")))]
- "TARGET_5200"
- "not%.l %0")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (not:HI (match_operand:HI 1 "general_operand" "0")))]
- "!TARGET_5200"
- "not%.w %0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
- (not:HI (match_dup 0)))]
- "!TARGET_5200"
- "not%.w %0")
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (not:QI (match_operand:QI 1 "general_operand" "0")))]
- "!TARGET_5200"
- "not%.b %0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
- (not:QI (match_dup 0)))]
- "!TARGET_5200"
- "not%.b %0")
-
-;; arithmetic shift instructions
-;; We don't need the shift memory by 1 bit instruction
-
-(define_insn "ashldi_extsi"
- [(set (match_operand:DI 0 "general_operand" "=ro")
- (ashift:DI
- (match_operator:DI 2 "extend_operator"
- [(match_operand:SI 1 "general_operand" "rm")])
- (const_int 32)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (GET_CODE (operands[0]) == REG)
- operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else
- operands[2] = adj_offsettable_operand (operands[0], 4);
- if (ADDRESS_REG_P (operands[0]))
- return \"move%.l %1,%0\;sub%.l %2,%2\";
- else
- return \"move%.l %1,%0\;clr%.l %2\";
-} ")
-
-(define_insn "ashldi_sexthi"
- [(set (match_operand:DI 0 "general_operand" "=m,a*d")
- (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm,rm"))
- (const_int 32)))
- (clobber (match_scratch:SI 2 "=a,X"))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- return \"clr%.l %0\;move%.w %1,%2\;move%.l %2,%0\";
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- return \"move%.w %1,%2\;move%.l %2,%0\;clr%.l %0\";
- else
- {
- operands[3] = adj_offsettable_operand (operands[0], 4);
- return \"move%.w %1,%2\;move%.l %2,%0\;clr%.l %3\";
- }
- }
- else if (DATA_REG_P (operands[0]))
- return \"move%.w %1,%0\;ext%.l %0\;clr%.l %R0\";
- else
- return \"move%.w %1,%0\;sub%.l %R0,%R0\";
-} ")
-
-(define_insn "ashldi_const32"
- [(set (match_operand:DI 0 "general_operand" "=rm")
- (ashift:DI (match_operand:DI 1 "general_operand" "ro")
- (const_int 32)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (GET_CODE (operands[1]) == REG)
- operands[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else
- operands[3] = adj_offsettable_operand (operands[1], 4);
- if (GET_CODE (operands[0]) == REG)
- operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- return \"clr%.l %0\;move%.l %3,%0\";
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- return \"move%.l %3,%0\;clr%.l %0\";
- else
- operands[2] = adj_offsettable_operand (operands[0], 4);
- if (ADDRESS_REG_P (operands[2]))
- return \"move%.l %3,%0\;sub%.l %2,%2\";
- else
- return \"move%.l %3,%0\;clr%.l %2\";
-} ")
-
-;; The predicate below must be general_operand, because ashldi3 allows that
-(define_insn "ashldi_const"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (ashift:DI (match_operand:DI 1 "general_operand" "0")
- (match_operand 2 "const_int_operand" "n")))]
- "(INTVAL (operands[2]) == 1
- || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
- || INTVAL (operands[2]) == 2 || INTVAL (operands[2]) == 3)"
- "*
-{
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (INTVAL (operands[2]) == 1)
- return \"add%.l %1,%1\;addx%.l %0,%0\";
- else if (INTVAL (operands[2]) == 8)
- return \"rol%.l %#8,%1\;rol%.l %#8,%0\;move%.b %1,%0\;clr%.b %1\";
- else if (INTVAL (operands[2]) == 16)
- return \"swap %1\;swap %0\;move%.w %1,%0\;clr%.w %1\";
- else if (INTVAL (operands[2]) == 2)
- return \"add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0\";
- else/* if (INTVAL (operands[2]) == 3)*/
- return \"add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0\";
-} ")
-
-(define_expand "ashldi3"
- [(set (match_operand:DI 0 "general_operand" "")
- (ashift:DI (match_operand:DI 1 "general_operand" "")
- (match_operand 2 "const_int_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT
- || (INTVAL (operands[2]) != 1 && INTVAL (operands[2]) != 32
- && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
- && INTVAL (operands[2]) != 2 && INTVAL (operands[2]) != 3))
- FAIL;
-} ")
-
-;; On most 68k models, this makes faster code in a special case.
-
-(define_insn "ashlsi_16"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (const_int 16)))]
- "!TARGET_68060"
- "*
-{
- CC_STATUS_INIT;
- return \"swap %0\;clr%.w %0\";
-}")
-
-;; ashift patterns : use lsl instead of asl, because lsl always clears the
-;; overflow bit, so we must not set CC_NO_OVERFLOW.
-
-;; On the 68000, this makes faster code in a special case.
-
-(define_insn "ashlsi_17_24"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- "(! TARGET_68020 && !TARGET_5200
- && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
- "*
-{
- CC_STATUS_INIT;
-
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
- return \"lsl%.w %2,%0\;swap %0\;clr%.w %0\";
-}")
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "dI")))]
- ""
- "*
-{
- if (operands[2] == const1_rtx)
- {
- cc_status.flags = CC_NO_OVERFLOW;
- return \"add%.l %0,%0\";
- }
- return \"lsl%.l %2,%0\";
-}")
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "register_operand" "=d")
- (ashift:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:HI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "lsl%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
- (ashift:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dI")))]
- "!TARGET_5200"
- "lsl%.w %1,%0")
-
-(define_insn "ashlqi3"
- [(set (match_operand:QI 0 "register_operand" "=d")
- (ashift:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "lsl%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
- (ashift:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dI")))]
- "!TARGET_5200"
- "lsl%.b %1,%0")
-
-;; On most 68k models, this makes faster code in a special case.
-
-(define_insn "ashrsi_16"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (const_int 16)))]
- "!TARGET_68060"
- "swap %0\;ext%.l %0")
-
-;; On the 68000, this makes faster code in a special case.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- "(! TARGET_68020 && !TARGET_5200
- && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
- return \"swap %0\;asr%.w %2,%0\;ext%.l %0\";
-}")
-
-(define_insn "subreghi1ashrdi_const32"
- [(set (match_operand:HI 0 "general_operand" "=rm")
- (subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
- (const_int 32)) 1))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) != REG)
- operands[1] = adj_offsettable_operand (operands[1], 2);
- return \"move%.w %1,%0\";
-} ")
-
-(define_insn "subregsi1ashrdi_const32"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
- (const_int 32)) 1))]
- ""
- "*
-{
- return \"move%.l %1,%0\";
-} ")
-
-(define_insn "ashrdi_const32"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
- (const_int 32)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (TARGET_68020)
- return \"move%.l %1,%2\;smi %0\;extb%.l %0\";
- else
- return \"move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0\";
-} ")
-
-(define_insn "ashrdi_const32_mem"
- [(set (match_operand:DI 0 "general_operand" "=o,<")
- (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro,ro")
- (const_int 32)))
- (clobber (match_scratch:SI 2 "=d,d"))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (which_alternative == 1)
- operands[3] = operands[0];
- else
- operands[3] = adj_offsettable_operand (operands[0], 4);
- if (TARGET_68020)
- return \"move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0\";
- else
- return \"move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\";
-} ")
-
-;; The predicate below must be general_operand, because ashrdi3 allows that
-(define_insn "ashrdi_const"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (ashiftrt:DI (match_operand:DI 1 "general_operand" "0")
- (match_operand 2 "const_int_operand" "n")))]
- "!TARGET_5200
- && ((INTVAL (operands[2]) == 1 || INTVAL (operands[2]) == 2
- || INTVAL (operands[2]) == 3 || INTVAL (operands[2]) == 8
- || INTVAL (operands[2]) == 16 || INTVAL (operands[2]) == 31
- || INTVAL (operands[2]) == 63))"
- "*
-{
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (INTVAL (operands[2]) == 63)
- return \"add%.l %0,%0\;subx%.l %0,%0\;move%.l %0,%1\";
- CC_STATUS_INIT;
- if (INTVAL (operands[2]) == 1)
- return \"asr%.l %#1,%0\;roxr%.l %#1,%1\";
- else if (INTVAL (operands[2]) == 8)
- return \"move%.b %0,%1\;asr%.l %#8,%0\;ror%.l %#8,%1\";
- else if (INTVAL (operands[2]) == 16)
- return \"move%.w %0,%1\;clr%.w %0\;swap %1\;ext%.l %0\";
- else if (INTVAL (operands[2]) == 31)
- return \"add%.l %1,%1\;addx%.l %0,%0\;move%.l %0,%1\;subx%.l %0,%0\";
- else if (INTVAL (operands[2]) == 2)
- return \"asr%.l %#1,%0\;roxr%.l %#1,%1\;asr%.l %#1,%0\;roxr%.l %#1,%1\";
- else/* if (INTVAL (operands[2]) == 3)*/
- return \"asr%.l %#1,%0\;roxr%.l %#1,%1\;asr%.l %#1,%0\;roxr%.l %#1,%1\;asr%.l %#1,%0\;roxr%.l %#1,%1\";
-} ")
-
-(define_expand "ashrdi3"
- [(set (match_operand:DI 0 "general_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "general_operand" "")
- (match_operand 2 "const_int_operand" "")))]
- "!TARGET_5200"
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT
- || (INTVAL (operands[2]) != 1 && INTVAL (operands[2]) != 2
- && INTVAL (operands[2]) != 3 && INTVAL (operands[2]) != 8
- && INTVAL (operands[2]) != 16 && INTVAL (operands[2]) != 31
- && INTVAL (operands[2]) != 32 && INTVAL (operands[2]) != 63))
- FAIL;
-} ")
-
-;; On all 68k models, this makes faster code in a special case.
-
-(define_insn "ashrsi_31"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (const_int 31)))]
- ""
- "*
-{
- return \"add%.l %0,%0\;subx%.l %0,%0\";
-}")
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "dI")))]
- ""
- "asr%.l %2,%0")
-
-(define_insn "ashrhi3"
- [(set (match_operand:HI 0 "register_operand" "=d")
- (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:HI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "asr%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
- (ashiftrt:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dI")))]
- "!TARGET_5200"
- "asr%.w %1,%0")
-
-(define_insn "ashrqi3"
- [(set (match_operand:QI 0 "register_operand" "=d")
- (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "asr%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
- (ashiftrt:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dI")))]
- "!TARGET_5200"
- "asr%.b %1,%0")
-
-;; logical shift instructions
-
-;; commented out because of reload problems in 950612-1.c
-;;(define_insn ""
-;; [(set (cc0)
-;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
-;; (const_int 32)) 1))
-;; (set (match_operand:SI 1 "general_operand" "=dm")
-;; (subreg:SI (lshiftrt:DI (match_dup 0)
-;; (const_int 32)) 1))]
-;; ""
-;; "*
-;;{
-;; return \"move%.l %0,%1\";
-;;} ")
-;;
-;;(define_insn ""
-;; [(set (cc0)
-;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
-;; (const_int 32)) 0))
-;; (set (match_operand:DI 1 "general_operand" "=do")
-;; (lshiftrt:DI (match_dup 0)
-;; (const_int 32)))]
-;; ""
-;; "*
-;;{
-;; if (GET_CODE (operands[1]) == REG)
-;; operands[2] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
-;; else
-;; operands[2] = adj_offsettable_operand (operands[1], 4);
-;; return \"move%.l %0,%2\;clr%.l %1\";
-;;} ")
-
-(define_insn "subreg1lshrdi_const32"
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
- (const_int 32)) 1))]
- ""
- "*
-{
- return \"move%.l %1,%0\";
-} ")
-
-(define_insn "lshrdi_const32"
- [(set (match_operand:DI 0 "general_operand" "=ro,<,>")
- (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,ro,ro")
- (const_int 32)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (which_alternative == 1)
- return \"move%.l %1,%0\;clr%.l %0\";
- if (which_alternative == 2)
- return \"clr%.l %0\;move%.l %1,%0\";
- if (GET_CODE (operands[0]) == REG)
- operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else
- operands[2] = adj_offsettable_operand (operands[0], 4);
- if (GET_CODE (operands[1]) == REG)
- operands[3] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else
- operands[3] = adj_offsettable_operand (operands[1], 4);
- if (ADDRESS_REG_P (operands[0]))
- return \"move%.l %1,%2\;sub%.l %0,%0\";
- else
- return \"move%.l %1,%2\;clr%.l %0\";
-} ")
-
-;; The predicate below must be general_operand, because lshrdi3 allows that
-(define_insn "lshrdi_const"
- [(set (match_operand:DI 0 "general_operand" "=d")
- (lshiftrt:DI (match_operand:DI 1 "general_operand" "0")
- (match_operand 2 "const_int_operand" "n")))]
- "!TARGET_5200
- && ((INTVAL (operands[2]) == 1 || INTVAL (operands[2]) == 2
- || INTVAL (operands[2]) == 3 || INTVAL (operands[2]) == 8
- || INTVAL (operands[2]) == 16 || INTVAL (operands[2]) == 63))"
- "*
-{
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (INTVAL (operands[2]) == 63)
- return \"add%.l %0,%0\;clr%.l %0\;clr%.l %1\;addx%.l %1,%1\";
- CC_STATUS_INIT;
- if (INTVAL (operands[2]) == 1)
- return \"lsr%.l %#1,%0\;roxr%.l %#1,%1\";
- else if (INTVAL (operands[2]) == 8)
- return \"move%.b %0,%1\;lsr%.l %#8,%0\;ror%.l %#8,%1\";
- else if (INTVAL (operands[2]) == 16)
- return \"move%.w %0,%1\;clr%.w %0\;swap %1\;swap %0\";
- else if (INTVAL (operands[2]) == 2)
- return \"lsr%.l %#1,%0\;roxr%.l %#1,%1\;lsr%.l %#1,%0\;roxr%.l %#1,%1\";
- else /*if (INTVAL (operands[2]) == 3)*/
- return \"lsr%.l %#1,%0\;roxr%.l %#1,%1\;lsr%.l %#1,%0\;roxr%.l %#1,%1\;lsr%.l %#1,%0\;roxr%.l %#1,%1\";
-} ")
-
-(define_expand "lshrdi3"
- [(set (match_operand:DI 0 "general_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "general_operand" "")
- (match_operand 2 "const_int_operand" "")))]
- "!TARGET_5200"
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT
- || (INTVAL (operands[2]) != 1 && INTVAL (operands[2]) != 2
- && INTVAL (operands[2]) != 3 && INTVAL (operands[2]) != 8
- && INTVAL (operands[2]) != 16 && INTVAL (operands[2]) != 32
- && INTVAL (operands[2]) != 63))
- FAIL;
-} ")
-
-;; On all 68k models, this makes faster code in a special case.
-
-(define_insn "lshrsi_31"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (const_int 31)))]
- ""
- "*
-{
- return \"add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0\";
-}")
-
-;; On most 68k models, this makes faster code in a special case.
-
-(define_insn "lshrsi_16"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (const_int 16)))]
- "!TARGET_68060"
- "*
-{
- CC_STATUS_INIT;
- return \"clr%.w %0\;swap %0\";
-}")
-
-;; On the 68000, this makes faster code in a special case.
-
-(define_insn "lshrsi_17_24"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))]
- "(! TARGET_68020 && !TARGET_5200
- && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
- "*
-{
- /* I think lsr%.w sets the CC properly. */
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) - 16);
- return \"clr%.w %0\;swap %0\;lsr%.w %2,%0\";
-}")
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "dI")))]
- ""
- "lsr%.l %2,%0")
-
-(define_insn "lshrhi3"
- [(set (match_operand:HI 0 "register_operand" "=d")
- (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:HI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "lsr%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
- (lshiftrt:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dI")))]
- "!TARGET_5200"
- "lsr%.w %1,%0")
-
-(define_insn "lshrqi3"
- [(set (match_operand:QI 0 "register_operand" "=d")
- (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "lsr%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
- (lshiftrt:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dI")))]
- "!TARGET_5200"
- "lsr%.b %1,%0")
-
-;; rotate instructions
-
-(define_insn "rotlsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (rotate:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "dINO")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)
- return \"swap %0\";
- else if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 16)
- {
- INTVAL (operands[2]) = 32 - INTVAL (operands[2]);
- return \"ror%.l %2,%0\";
- }
- else
- return \"rol%.l %2,%0\";
-}")
-
-(define_insn "rotlhi3"
- [(set (match_operand:HI 0 "register_operand" "=d")
- (rotate:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:HI 2 "general_operand" "dIP")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
- {
- INTVAL (operands[2]) = 16 - INTVAL (operands[2]);
- return \"ror%.w %2,%0\";
- }
- else
- return \"rol%.w %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
- (rotate:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dIP")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
- {
- INTVAL (operands[2]) = 16 - INTVAL (operands[2]);
- return \"ror%.w %2,%0\";
- }
- else
- return \"rol%.w %2,%0\";
-}")
-
-(define_insn "rotlqi3"
- [(set (match_operand:QI 0 "register_operand" "=d")
- (rotate:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
- {
- INTVAL (operands[2]) = 8 - INTVAL (operands[2]);
- return \"ror%.b %2,%0\";
- }
- else
- return \"rol%.b %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
- (rotate:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dI")))]
- "!TARGET_5200"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
- {
- INTVAL (operands[2]) = 8 - INTVAL (operands[2]);
- return \"ror%.b %2,%0\";
- }
- else
- return \"rol%.b %2,%0\";
-}")
-
-(define_insn "rotrsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (rotatert:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "ror%.l %2,%0")
-
-(define_insn "rotrhi3"
- [(set (match_operand:HI 0 "register_operand" "=d")
- (rotatert:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:HI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "ror%.w %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
- (rotatert:HI (match_dup 0)
- (match_operand:HI 1 "general_operand" "dI")))]
- "!TARGET_5200"
- "ror%.w %1,%0")
-
-(define_insn "rotrqi3"
- [(set (match_operand:QI 0 "register_operand" "=d")
- (rotatert:QI (match_operand:QI 1 "register_operand" "0")
- (match_operand:QI 2 "general_operand" "dI")))]
- "!TARGET_5200"
- "ror%.b %2,%0")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
- (rotatert:QI (match_dup 0)
- (match_operand:QI 1 "general_operand" "dI")))]
- "!TARGET_5200"
- "ror%.b %1,%0")
-
-
-;; Bit set/clear in memory byte.
-
-;; set bit, bit number is int
-(define_insn "bsetmemqi"
- [(set (match_operand:QI 0 "memory_operand" "+m")
- (ior:QI (subreg:QI (ashift:SI (const_int 1)
- (match_operand:SI 1 "general_operand" "d")) 0)
- (match_dup 0)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"bset %1,%0\";
-}")
-
-;; set bit, bit number is (sign/zero)_extended from HImode/QImode
-(define_insn ""
- [(set (match_operand:QI 0 "memory_operand" "+m")
- (ior:QI (subreg:QI (ashift:SI (const_int 1)
- (match_operator:SI 2 "extend_operator"
- [(match_operand 1 "general_operand" "d")])) 0)
- (match_dup 0)))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"bset %1,%0\";
-}")
-
-;; clear bit, bit number is int
-(define_insn "bclrmemqi"
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
- (const_int 1)
- (minus:SI (const_int 7)
- (match_operand:SI 1 "general_operand" "d")))
- (const_int 0))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"bclr %1,%0\";
-}")
-
-;; clear bit, bit number is (sign/zero)_extended from HImode/QImode
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
- (const_int 1)
- (minus:SI (const_int 7)
- (match_operator:SI 2 "extend_operator"
- [(match_operand 1 "general_operand" "d")])))
- (const_int 0))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"bclr %1,%0\";
-}")
-
-;; Special cases of bit-field insns which we should
-;; recognize in preference to the general case.
-;; These handle aligned 8-bit and 16-bit fields,
-;; which can usually be done with move instructions.
-
-;
-; Special case for 32-bit field in memory. This only occurs when 32-bit
-; alignment of structure members is specified.
-;
-; The move is allowed to be odd byte aligned, because that's still faster
-; than an odd byte aligned bit field instruction.
-;
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
- (const_int 32)
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "general_operand" "rmi"))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[2]) % 8) == 0
- && ! mode_dependent_address_p (XEXP (operands[0], 0))"
- "*
-{
- operands[0]
- = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
-
- return \"move%.l %3,%0\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
- (match_operand:SI 1 "const_int_operand" "n")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "register_operand" "d"))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
- && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
- && (GET_CODE (operands[0]) == REG
- || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
- "*
-{
- if (REG_P (operands[0]))
- {
- if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
- return \"bfins %3,%0{%b2:%b1}\";
- }
- else
- operands[0]
- = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
-
- if (GET_CODE (operands[3]) == MEM)
- operands[3] = adj_offsettable_operand (operands[3],
- (32 - INTVAL (operands[1])) / 8);
- if (INTVAL (operands[1]) == 8)
- return \"move%.b %3,%0\";
- return \"move%.w %3,%0\";
-}")
-
-
-;
-; Special case for 32-bit field in memory. This only occurs when 32-bit
-; alignment of structure members is specified.
-;
-; The move is allowed to be odd byte aligned, because that's still faster
-; than an odd byte aligned bit field instruction.
-;
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (zero_extract:SI (match_operand:QI 1 "memory_operand" "o")
- (const_int 32)
- (match_operand:SI 3 "const_int_operand" "n")))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[3]) % 8) == 0
- && ! mode_dependent_address_p (XEXP (operands[1], 0))"
- "*
-{
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- return \"move%.l %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=&d")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
- (match_operand:SI 2 "const_int_operand" "n")
- (match_operand:SI 3 "const_int_operand" "n")))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
- && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
- && (GET_CODE (operands[1]) == REG
- || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
- "*
-{
- cc_status.flags |= CC_NOT_NEGATIVE;
- if (REG_P (operands[1]))
- {
- if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
- return \"bfextu %1{%b3:%b2},%0\";
- }
- else
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- output_asm_insn (\"clr%.l %0\", operands);
- if (GET_CODE (operands[0]) == MEM)
- operands[0] = adj_offsettable_operand (operands[0],
- (32 - INTVAL (operands[1])) / 8);
- if (INTVAL (operands[2]) == 8)
- return \"move%.b %1,%0\";
- return \"move%.w %1,%0\";
-}")
-
-;
-; Special case for 32-bit field in memory. This only occurs when 32-bit
-; alignment of structure members is specified.
-;
-; The move is allowed to be odd byte aligned, because that's still faster
-; than an odd byte aligned bit field instruction.
-;
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=rm")
- (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
- (const_int 32)
- (match_operand:SI 3 "const_int_operand" "n")))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[3]) % 8) == 0
- && ! mode_dependent_address_p (XEXP (operands[1], 0))"
- "*
-{
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- return \"move%.l %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
- (match_operand:SI 2 "const_int_operand" "n")
- (match_operand:SI 3 "const_int_operand" "n")))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
- && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
- && (GET_CODE (operands[1]) == REG
- || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
- "*
-{
- if (REG_P (operands[1]))
- {
- if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
- return \"bfexts %1{%b3:%b2},%0\";
- }
- else
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- if (INTVAL (operands[2]) == 8)
- return \"move%.b %1,%0\;extb%.l %0\";
- return \"move%.w %1,%0\;ext%.l %0\";
-}")
-
-;; Bit field instructions, general cases.
-;; "o,d" constraint causes a nonoffsettable memref to match the "o"
-;; so that its address is reloaded.
-
-(define_expand "extv"
- [(set (match_operand:SI 0 "general_operand" "")
- (sign_extract:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
- (match_operand:SI 2 "general_operand" "di")
- (match_operand:SI 3 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "bfexts %1{%b3:%b2},%0")
-
-(define_expand "extzv"
- [(set (match_operand:SI 0 "general_operand" "")
- (zero_extract:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d,d")
- (zero_extract:SI (match_operand:QI 1 "memory_operand" "o,d")
- (match_operand:SI 2 "general_operand" "di,di")
- (match_operand:SI 3 "general_operand" "di,di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) != 32)
- cc_status.flags |= CC_NOT_NEGATIVE;
- }
- else
- {
- CC_STATUS_INIT;
- }
- return \"bfextu %1{%b3:%b2},%0\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
- (match_operand 3 "const_int_operand" "n")))]
- "TARGET_68020 && TARGET_BITFIELD
- && (INTVAL (operands[3]) == -1
- || (GET_CODE (operands[1]) == CONST_INT
- && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
- "*
-{
- CC_STATUS_INIT;
- return \"bfchg %0{%b2:%b1}\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (const_int 0))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- CC_STATUS_INIT;
- return \"bfclr %0{%b2:%b1}\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (const_int -1))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- CC_STATUS_INIT;
- return \"bfset %0{%b2:%b1}\";
-}")
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" ""))
- (match_operand:SI 3 "register_operand" ""))]
- "TARGET_68020 && TARGET_BITFIELD"
- "")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (match_operand:SI 3 "register_operand" "d"))]
- "TARGET_68020 && TARGET_BITFIELD"
- "bfins %3,%0{%b2:%b1}")
-
-;; Now recognize bit field insns that operate on registers
-;; (or at least were intended to do so).
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "general_operand" "di")
- (match_operand:SI 3 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "bfexts %1{%b3:%b2},%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "general_operand" "di")
- (match_operand:SI 3 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) != 32)
- cc_status.flags |= CC_NOT_NEGATIVE;
- }
- else
- {
- CC_STATUS_INIT;
- }
- return \"bfextu %1{%b3:%b2},%0\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (const_int 0))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- CC_STATUS_INIT;
- return \"bfclr %0{%b2:%b1}\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (const_int -1))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- CC_STATUS_INIT;
- return \"bfset %0{%b2:%b1}\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
- (match_operand:SI 1 "general_operand" "di")
- (match_operand:SI 2 "general_operand" "di"))
- (match_operand:SI 3 "register_operand" "d"))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
-#if 0
- /* These special cases are now recognized by a specific pattern. */
- if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
- return \"move%.w %3,%0\";
- if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
- return \"move%.b %3,%0\";
-#endif
- return \"bfins %3,%0{%b2:%b1}\";
-}")
-
-;; Special patterns for optimizing bit-field instructions.
-
-(define_insn ""
- [(set (cc0)
- (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
- (match_operand:SI 1 "const_int_operand" "n")
- (match_operand:SI 2 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- if (operands[1] == const1_rtx
- && GET_CODE (operands[2]) == CONST_INT)
- {
- int width = GET_CODE (operands[0]) == REG ? 31 : 7;
- return output_btst (operands,
- gen_rtx (CONST_INT, VOIDmode,
- width - INTVAL (operands[2])),
- operands[0],
- insn, 1000);
- /* Pass 1000 as SIGNPOS argument so that btst will
- not think we are testing the sign bit for an `and'
- and assume that nonzero implies a negative result. */
- }
- if (INTVAL (operands[1]) != 32)
- cc_status.flags = CC_NOT_NEGATIVE;
- return \"bftst %0{%b2:%b1}\";
-}")
-
-
-;;; now handle the register cases
-(define_insn ""
- [(set (cc0)
- (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "const_int_operand" "n")
- (match_operand:SI 2 "general_operand" "di")))]
- "TARGET_68020 && TARGET_BITFIELD"
- "*
-{
- if (operands[1] == const1_rtx
- && GET_CODE (operands[2]) == CONST_INT)
- {
- int width = GET_CODE (operands[0]) == REG ? 31 : 7;
- return output_btst (operands,
- gen_rtx (CONST_INT, VOIDmode,
- width - INTVAL (operands[2])),
- operands[0],
- insn, 1000);
- /* Pass 1000 as SIGNPOS argument so that btst will
- not think we are testing the sign bit for an `and'
- and assume that nonzero implies a negative result. */
- }
- if (INTVAL (operands[1]) != 32)
- cc_status.flags = CC_NOT_NEGATIVE;
- return \"bftst %0{%b2:%b1}\";
-}")
-
-(define_insn "scc0_di"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (match_operator 1 "valid_dbcc_comparison_p"
- [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
- ""
- "*
-{
- return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
-} ")
-
-(define_insn "scc_di"
- [(set (match_operand:QI 0 "general_operand" "=dm,dm")
- (match_operator 1 "valid_dbcc_comparison_p"
- [(match_operand:DI 2 "general_operand" "ro,r")
- (match_operand:DI 3 "general_operand" "r,ro")]))]
- ""
- "*
-{
- return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
-} ")
-
-(define_expand "seq"
- [(set (match_operand:QI 0 "general_operand" "")
- (eq:QI (cc0) (const_int 0)))]
- ""
- "
-{
- if (TARGET_68060 && m68k_last_compare_had_fp_operands)
- {
- m68k_last_compare_had_fp_operands = 0;
- FAIL;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (eq:QI (cc0) (const_int 0)))]
- ""
- "*
- cc_status = cc_prev_status;
- OUTPUT_JUMP (\"seq %0\", \"fseq %0\", \"seq %0\");
-")
-
-(define_expand "sne"
- [(set (match_operand:QI 0 "general_operand" "")
- (ne:QI (cc0) (const_int 0)))]
- ""
- "
-{
- if (TARGET_68060 && m68k_last_compare_had_fp_operands)
- {
- m68k_last_compare_had_fp_operands = 0;
- FAIL;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (ne:QI (cc0) (const_int 0)))]
- ""
- "*
- cc_status = cc_prev_status;
- OUTPUT_JUMP (\"sne %0\", \"fsne %0\", \"sne %0\");
-")
-
-(define_expand "sgt"
- [(set (match_operand:QI 0 "general_operand" "")
- (gt:QI (cc0) (const_int 0)))]
- ""
- "
-{
- if (TARGET_68060 && m68k_last_compare_had_fp_operands)
- {
- m68k_last_compare_had_fp_operands = 0;
- FAIL;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (gt:QI (cc0) (const_int 0)))]
- ""
- "*
- cc_status = cc_prev_status;
- OUTPUT_JUMP (\"sgt %0\", \"fsgt %0\", 0);
-")
-
-(define_insn "sgtu"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (gtu:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- return \"shi %0\"; ")
-
-(define_expand "slt"
- [(set (match_operand:QI 0 "general_operand" "")
- (lt:QI (cc0) (const_int 0)))]
- ""
- "
-{
- if (TARGET_68060 && m68k_last_compare_had_fp_operands)
- {
- m68k_last_compare_had_fp_operands = 0;
- FAIL;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (lt:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- OUTPUT_JUMP (\"slt %0\", \"fslt %0\", \"smi %0\"); ")
-
-(define_insn "sltu"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (ltu:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- return \"scs %0\"; ")
-
-(define_expand "sge"
- [(set (match_operand:QI 0 "general_operand" "")
- (ge:QI (cc0) (const_int 0)))]
- ""
- "
-{
- if (TARGET_68060 && m68k_last_compare_had_fp_operands)
- {
- m68k_last_compare_had_fp_operands = 0;
- FAIL;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (ge:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- OUTPUT_JUMP (\"sge %0\", \"fsge %0\", \"spl %0\"); ")
-
-(define_insn "sgeu"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (geu:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- return \"scc %0\"; ")
-
-(define_expand "sle"
- [(set (match_operand:QI 0 "general_operand" "")
- (le:QI (cc0) (const_int 0)))]
- ""
- "
-{
- if (TARGET_68060 && m68k_last_compare_had_fp_operands)
- {
- m68k_last_compare_had_fp_operands = 0;
- FAIL;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (le:QI (cc0) (const_int 0)))]
- ""
- "*
- cc_status = cc_prev_status;
- OUTPUT_JUMP (\"sle %0\", \"fsle %0\", 0);
-")
-
-(define_insn "sleu"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (leu:QI (cc0) (const_int 0)))]
- ""
- "* cc_status = cc_prev_status;
- return \"sls %0\"; ")
-
-;; Basic conditional jump instructions.
-
-(define_insn "beq0_di"
- [(set (pc)
- (if_then_else (eq (match_operand:DI 0 "general_operand" "d*ao,<>")
- (const_int 0))
- (label_ref (match_operand 1 "" ","))
- (pc)))
- (clobber (match_scratch:SI 2 "=d,d"))]
- ""
- "*
-{
- CC_STATUS_INIT;
- if (which_alternative == 1)
-#ifdef MOTOROLA
- return \"move%.l %0,%2\;or%.l %0,%2\;jbeq %l1\";
-#else
- return \"move%.l %0,%2\;or%.l %0,%2\;jeq %l1\";
-#endif
- if ((cc_prev_status.value1
- && rtx_equal_p (cc_prev_status.value1, operands[0]))
- || (cc_prev_status.value2
- && rtx_equal_p (cc_prev_status.value2, operands[0])))
- {
- cc_status = cc_prev_status;
-#ifdef MOTOROLA
- return \"jbeq %l1\";
-#else
- return \"jeq %l1\";
-#endif
- }
- if (GET_CODE (operands[0]) == REG)
- operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else
- operands[3] = adj_offsettable_operand (operands[0], 4);
- if (! ADDRESS_REG_P (operands[0]))
-#ifdef MOTOROLA
- return \"move%.l %0,%2\;or%.l %3,%2\;jbeq %l1\";
-#else
- return \"move%.l %0,%2\;or%.l %3,%2\;jeq %l1\";
-#endif
- operands[4] = gen_label_rtx();
- if (TARGET_68020 || TARGET_5200)
-#ifdef MOTOROLA
- output_asm_insn (\"tst%.l %0\;jbne %l4\;tst%.l %3\;jbeq %l1\", operands);
-#else
- output_asm_insn (\"tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1\", operands);
-#endif
- else
-#ifdef MOTOROLA
-#ifdef SGS_CMP_ORDER
- output_asm_insn (\"cmp%.w %0,%#0\;jbne %l4\;cmp%.w %3,%#0\;jbeq %l1\", operands);
-#else
- output_asm_insn (\"cmp%.w %#0,%0\;jbne %l4\;cmp%.w %#0,%3\;jbeq %l1\", operands);
-#endif
-#else
- output_asm_insn (\"cmp%.w %#0,%0\;jne %l4\;cmp%.w %#0,%3\;jeq %l1\", operands);
-#endif
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (operands[4]));
- return \"\";
-} ")
-
-(define_insn "bne0_di"
- [(set (pc)
- (if_then_else (ne (match_operand:DI 0 "general_operand" "do,*a")
- (const_int 0))
- (label_ref (match_operand 1 "" ","))
- (pc)))
- (clobber (match_scratch:SI 2 "=d,X"))]
- ""
- "*
-{
- if ((cc_prev_status.value1
- && rtx_equal_p (cc_prev_status.value1, operands[0]))
- || (cc_prev_status.value2
- && rtx_equal_p (cc_prev_status.value2, operands[0])))
- {
- cc_status = cc_prev_status;
-#ifdef MOTOROLA
- return \"jbne %l1\";
-#else
- return \"jne %l1\";
-#endif
- }
- CC_STATUS_INIT;
- if (GET_CODE (operands[0]) == REG)
- operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else
- operands[3] = adj_offsettable_operand (operands[0], 4);
- if (!ADDRESS_REG_P (operands[0]))
-#ifdef MOTOROLA
- return \"move%.l %0,%2\;or%.l %3,%2\;jbne %l1\";
-#else
- return \"move%.l %0,%2\;or%.l %3,%2\;jne %l1\";
-#endif
- if (TARGET_68020 || TARGET_5200)
-#ifdef MOTOROLA
- return \"tst%.l %0\;jbne %l1\;tst%.l %3\;jbne %l1\";
-#else
- return \"tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1\";
-#endif
- else
-#ifdef MOTOROLA
-#ifdef SGS_CMP_ORDER
- return \"cmp%.w %0,%#0\;jbne %l1\;cmp%.w %3,%#0\;jbne %l1\";
-#else
- return \"cmp%.w %#0,%0\;jbne %l1\;cmp%.w %#0,%3\;jbne %l1\";
-#endif
-#else
- return \"cmp%.w %#0,%0\;jne %l1\;cmp%.w %#0,%3\;jne %l1\";
-#endif
-} ")
-
-(define_insn "bge0_di"
- [(set (pc)
- (if_then_else (ge (match_operand:DI 0 "general_operand" "ro")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))]
- ""
- "*
-{
- if ((cc_prev_status.value1
- && rtx_equal_p (cc_prev_status.value1, operands[0]))
- || (cc_prev_status.value2
- && rtx_equal_p (cc_prev_status.value2, operands[0])))
- {
- cc_status = cc_prev_status;
- if (cc_status.flags & CC_REVERSED)
- {
-#ifdef MOTOROLA
- return \"jble %l1\";
-#else
- return \"jle %l1\";
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- return \"jbpl %l1\";
-#else
- return \"jpl %l1\";
-#endif
- }
- }
- CC_STATUS_INIT;
- if (TARGET_68020 || TARGET_5200 || ! ADDRESS_REG_P (operands[0]))
- output_asm_insn(\"tst%.l %0\", operands);
- else
- /* On an address reg, cmpw may replace cmpl. */
-#ifdef SGS_CMP_ORDER
- output_asm_insn(\"cmp%.w %0,%#0\", operands);
-#else
- output_asm_insn(\"cmp%.w %#0,%0\", operands);
-#endif
-
-#ifdef MOTOROLA
- return \"jbpl %l1\";
-#else
- return \"jpl %l1\";
-#endif
-} ")
-
-(define_insn "blt0_di"
- [(set (pc)
- (if_then_else (lt (match_operand:DI 0 "general_operand" "ro")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))]
- ""
- "*
-{
- if ((cc_prev_status.value1
- && rtx_equal_p (cc_prev_status.value1, operands[0]))
- || (cc_prev_status.value2
- && rtx_equal_p (cc_prev_status.value2, operands[0])))
- {
- cc_status = cc_prev_status;
- if (cc_status.flags & CC_REVERSED)
- {
-#ifdef MOTOROLA
- return \"jbgt %l1\";
-#else
- return \"jgt %l1\";
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- return \"jbmi %l1\";
-#else
- return \"jmi %l1\";
-#endif
- }
- }
- CC_STATUS_INIT;
- if (TARGET_68020 || TARGET_5200 || ! ADDRESS_REG_P (operands[0]))
- output_asm_insn(\"tst%.l %0\", operands);
- else
- /* On an address reg, cmpw may replace cmpl. */
-#ifdef SGS_CMP_ORDER
- output_asm_insn(\"cmp%.w %0,%#0\", operands);
-#else
- output_asm_insn(\"cmp%.w %#0,%0\", operands);
-#endif
-
-#ifdef MOTOROLA
- return \"jbmi %l1\";
-#else
- return \"jmi %l1\";
-#endif
-} ")
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
-#else
- OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
-#endif
-}")
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
-#else
- OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
-#endif
-}")
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jbgt %l0\", \"fbgt %l0\", 0);
-#else
- OUTPUT_JUMP (\"jgt %l0\", \"fjgt %l0\", 0);
-#endif
-")
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jbhi %l0\";
-#else
- return \"jhi %l0\";
-#endif
-")
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jblt %l0\", \"fblt %l0\", \"jbmi %l0\");
-#else
- OUTPUT_JUMP (\"jlt %l0\", \"fjlt %l0\", \"jmi %l0\");
-#endif
-")
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jbcs %l0\";
-#else
- return \"jcs %l0\";
-#endif
-")
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jbge %l0\", \"fbge %l0\", \"jbpl %l0\");
-#else
- OUTPUT_JUMP (\"jge %l0\", \"fjge %l0\", \"jpl %l0\");
-#endif
-")
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jbcc %l0\";
-#else
- return \"jcc %l0\";
-#endif
-")
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jble %l0\", \"fble %l0\", 0);
-#else
- OUTPUT_JUMP (\"jle %l0\", \"fjle %l0\", 0);
-#endif
-")
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jbls %l0\";
-#else
- return \"jls %l0\";
-#endif
-")
-
-;; Negated conditional jump instructions.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
-#else
- OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
-#endif
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
-#else
- OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
-#endif
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jble %l0\", \"fbngt %l0\", 0);
-#else
- OUTPUT_JUMP (\"jle %l0\", \"fjngt %l0\", 0);
-#endif
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jbls %l0\";
-#else
- return \"jls %l0\";
-#endif
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jbge %l0\", \"fbnlt %l0\", \"jbpl %l0\");
-#else
- OUTPUT_JUMP (\"jge %l0\", \"fjnlt %l0\", \"jpl %l0\");
-#endif
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jbcc %l0\";
-#else
- return \"jcc %l0\";
-#endif
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jblt %l0\", \"fbnge %l0\", \"jbmi %l0\");
-#else
- OUTPUT_JUMP (\"jlt %l0\", \"fjnge %l0\", \"jmi %l0\");
-#endif
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jbcs %l0\";
-#else
- return \"jcs %l0\";
-#endif
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-#ifdef MOTOROLA
- OUTPUT_JUMP (\"jbgt %l0\", \"fbnle %l0\", 0);
-#else
- OUTPUT_JUMP (\"jgt %l0\", \"fjnle %l0\", 0);
-#endif
-")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jbhi %l0\";
-#else
- return \"jhi %l0\";
-#endif
-")
-
-;; Unconditional and other jump instructions
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jbra %l0\";
-#else
- return \"jra %l0\";
-#endif
-")
-
-;; We support two different ways of handling dispatch tables.
-;; The NeXT uses absolute tables, and other machines use relative.
-;; This define_expand can generate either kind.
-(define_expand "tablejump"
- [(parallel [(set (pc) (match_operand 0 "" ""))
- (use (label_ref (match_operand 1 "" "")))])]
- ""
- "
-{
-#ifdef CASE_VECTOR_PC_RELATIVE
- operands[0] = gen_rtx (PLUS, SImode, pc_rtx,
- gen_rtx (SIGN_EXTEND, SImode, operands[0]));
-#endif
-}")
-
-;; Jump to variable address from dispatch table of absolute addresses.
-(define_insn ""
- [(set (pc) (match_operand:SI 0 "register_operand" "a"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "*
-#ifdef MOTOROLA
- return \"jmp (%0)\";
-#else
- return \"jmp %0@\";
-#endif
-")
-
-;; Jump to variable address from dispatch table of relative addresses.
-(define_insn ""
- [(set (pc)
- (plus:SI (pc)
- (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "*
-#ifdef ASM_RETURN_CASE_JUMP
- ASM_RETURN_CASE_JUMP;
-#else
-#ifdef SGS
-#ifdef ASM_OUTPUT_CASE_LABEL
- if (TARGET_5200)
- return \"ext%.l %0\;jmp 6(%%pc,%0.l)\";
- else
- return \"jmp 6(%%pc,%0.w)\";
-#else
- if (TARGET_5200)
- {
-#ifdef CRDS
- return \"ext%.l %0\;jmp 2(pc,%0.l)\";
-#else
- return \"extl %0\;jmp 2(%%pc,%0.l)\";
-#endif /* end !CRDS */
- }
- else
- {
-#ifdef CRDS
- return \"jmp 2(pc,%0.w)\";
-#else
- return \"jmp 2(%%pc,%0.w)\";
-#endif /* end !CRDS */
- }
-#endif
-#else /* not SGS */
- if (TARGET_5200)
- {
-#ifdef MOTOROLA
- return \"ext%.l %0\;jmp (2,pc,%0.l)\";
-#else
- return \"extl %0\;jmp pc@(2,%0:l)\";
-#endif
- }
- else
- {
-#ifdef MOTOROLA
- return \"jmp (2,pc,%0.w)\";
-#else
- return \"jmp pc@(2,%0:w)\";
-#endif
- }
-#endif
-#endif
-")
-
-;; Decrement-and-branch insns.
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operand:HI 0 "general_operand" "+d*g")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:HI (match_dup 0)
- (const_int -1)))]
- "!TARGET_5200"
- "*
-{
- CC_STATUS_INIT;
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\";
- if (GET_CODE (operands[0]) == MEM)
- {
-#ifdef MOTOROLA
-#ifdef NO_ADDSUB_Q
- return \"sub%.w %#1,%0\;jbcc %l1\";
-#else
- return \"subq%.w %#1,%0\;jbcc %l1\";
-#endif
-#else /* not MOTOROLA */
- return \"subqw %#1,%0\;jcc %l1\";
-#endif
- }
-#ifdef MOTOROLA
-#ifdef SGS_CMP_ORDER
-#ifdef NO_ADDSUB_Q
- return \"sub%.w %#1,%0\;cmp%.w %0,%#-1\;jbne %l1\";
-#else
- return \"subq%.w %#1,%0\;cmp%.w %0,%#-1\;jbne %l1\";
-#endif
-#else /* not SGS_CMP_ORDER */
- return \"subq%.w %#1,%0\;cmp%.w %#-1,%0\;jbne %l1\";
-#endif
-#else /* not MOTOROLA */
- return \"subqw %#1,%0\;cmpw %#-1,%0\;jne %l1\";
-#endif
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operand:SI 0 "general_operand" "+d*g")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- "!TARGET_5200"
- "*
-{
- CC_STATUS_INIT;
-#ifdef MOTOROLA
-#ifdef NO_ADDSUB_Q
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\;clr%.w %0\;sub%.l %#1,%0\;jbcc %l1\";
- if (GET_CODE (operands[0]) == MEM)
- return \"sub%.l %#1,%0\;jbcc %l1\";
-#else
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jbcc %l1\";
- if (GET_CODE (operands[0]) == MEM)
- return \"subq%.l %#1,%0\;jbcc %l1\";
-#endif /* NO_ADDSUB_Q */
-#ifdef SGS_CMP_ORDER
-#ifdef NO_ADDSUB_Q
- return \"sub.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
-#else
- return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
-#endif
-#else /* not SGS_CMP_ORDER */
- return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
-#endif /* not SGS_CMP_ORDER */
-#else /* not MOTOROLA */
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\;clr%.w %0\;subql %#1,%0\;jcc %l1\";
- if (GET_CODE (operands[0]) == MEM)
- return \"subql %#1,%0\;jcc %l1\";
- return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
-#endif /* not MOTOROLA */
-}")
-
-;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ge (plus:HI (match_operand:HI 0 "general_operand" "+d*am")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:HI (match_dup 0)
- (const_int -1)))]
- "!TARGET_5200 && find_reg_note (insn, REG_NONNEG, 0)"
- "*
-{
- CC_STATUS_INIT;
-#ifdef MOTOROLA
-#ifdef NO_ADDSUB_Q
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\";
- if (GET_CODE (operands[0]) == MEM)
- return \"sub%.w %#1,%0\;jbcc %l1\";
-#else
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\";
- if (GET_CODE (operands[0]) == MEM)
- return \"subq%.w %#1,%0\;jbcc %l1\";
-#endif
-#ifdef SGS_CMP_ORDER
-#ifdef NO_ADDSUB_Q
- return \"sub.w %#1,%0\;cmp.w %0,%#-1\;jbne %l1\";
-#else
- return \"subq.w %#1,%0\;cmp.w %0,%#-1\;jbne %l1\";
-#endif
-#else /* not SGS_CMP_ORDER */
- return \"subq.w %#1,%0\;cmp.w %#-1,%0\;jbne %l1\";
-#endif /* not SGS_CMP_ORDER */
-#else /* not MOTOROLA */
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\";
- if (GET_CODE (operands[0]) == MEM)
- return \"subqw %#1,%0\;jcc %l1\";
- return \"subqw %#1,%0\;cmpw %#-1,%0\;jne %l1\";
-#endif /* not MOTOROLA */
-}")
-
-(define_expand "decrement_and_branch_until_zero"
- [(parallel [(set (pc)
- (if_then_else
- (ge (plus:SI (match_operand:SI 0 "general_operand" "")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))])]
- ""
- "")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ge (plus:SI (match_operand:SI 0 "general_operand" "+d*am")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- "!TARGET_5200 && find_reg_note (insn, REG_NONNEG, 0)"
- "*
-{
- CC_STATUS_INIT;
-#ifdef MOTOROLA
-#ifdef NO_ADDSUB_Q
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\;clr%.w %0\;sub%.l %#1,%0\;jbcc %l1\";
- if (GET_CODE (operands[0]) == MEM)
- return \"sub%.l %#1,%0\;jbcc %l1\";
-#else
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jbcc %l1\";
- if (GET_CODE (operands[0]) == MEM)
- return \"subq%.l %#1,%0\;jbcc %l1\";
-#endif
-#ifdef SGS_CMP_ORDER
-#ifdef NO_ADDSUB_Q
- return \"sub.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
-#else
- return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
-#endif
-#else /* not SGS_CMP_ORDER */
- return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
-#endif /* not SGS_CMP_ORDER */
-#else /* not MOTOROLA */
- if (DATA_REG_P (operands[0]))
- return \"dbra %0,%l1\;clr%.w %0\;subql %#1,%0\;jcc %l1\";
- if (GET_CODE (operands[0]) == MEM)
- return \"subql %#1,%0\;jcc %l1\";
- return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
-#endif /* not MOTOROLA */
-}")
-
-
-;; For PIC calls, in order to be able to support
-;; dynamic linker LAZY BINDING, all the procedure calls need to go
-;; through the PLT (Procedure Linkage Table) section in PIC mode.
-;;
-;; PIC calls are handled by loading the address of the function into a
-;; register (via movsi), then emitting a register indirect call using
-;; the "jsr" function call syntax.
-;;
-;; When outputting MIT syntax (e.g. on Suns), we add a bogus extra
-;; operand to the jbsr statement to indicate that this call should
-;; go through the PLT (why? because this is the way that Sun does it).
-;;
-;; We have different patterns for PIC calls and non-PIC calls. The
-;; different patterns are only used to choose the right syntax.
-;;
-;; The svr4 m68k assembler recognizes this syntax: `bsr FUNC@PLTPC' and it
-;; will create the correct relocation entry (R_68K_PLT32) for `FUNC',
-;; that tells the linker editor to create an entry for `FUNC' in PLT
-;; section at link time. However, all global objects reference are still
-;; done by using `OBJ@GOT'. So, the goal here is to output the function
-;; call operand as `FUNC@PLTPC', but output object operand as `OBJ@GOT'.
-;; We need to have a way to differentiate these two different operands.
-;;
-;; The strategy I use here is to use SYMBOL_REF_FLAG to differentiate
-;; these two different operands. The macro LEGITIMATE_PIC_OPERAND_P needs
-;; to be changed to recognize function calls symbol_ref operand as a valid
-;; PIC operand (by checking whether SYMBOL_REF_FLAG is set). This will
-;; avoid the compiler to load this symbol_ref operand into a register.
-;; Remember, the operand "foo@PLTPC" cannot be called via jsr directly
-;; since the value is a PC relative offset, not a real address.
-;;
-;; All global objects are treated in the similar way as in SUN3. The only
-;; difference is: on m68k svr4, the reference of such global object needs
-;; to end with a suffix "@GOT" so the assembler and linker know to create
-;; an entry for it in GOT (Global Offset Table) section. This is done in
-;; m68k.c.
-
-;; Call subroutine with no return value.
-(define_expand "call"
- [(call (match_operand:QI 0 "memory_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ;; Operand 1 not really used on the m68000.
-
- ""
- "
-{
- if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
- SYMBOL_REF_FLAG (XEXP (operands[0], 0)) = 1;
-}")
-
-;; This is a normal call sequence.
-(define_insn ""
- [(call (match_operand:QI 0 "memory_operand" "o")
- (match_operand:SI 1 "general_operand" "g"))]
- ;; Operand 1 not really used on the m68000.
-
- "! flag_pic"
- "*
-#if defined (MOTOROLA) && !defined (USE_GAS)
-#ifdef MOTOROLA_BSR
- if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
- return \"bsr %0\";
-#endif
- return \"jsr %0\";
-#else
- return \"jbsr %0\";
-#endif
-")
-
-;; This is a PIC call sequence.
-(define_insn ""
- [(call (match_operand:QI 0 "memory_operand" "o")
- (match_operand:SI 1 "general_operand" "g"))]
- ;; Operand 1 not really used on the m68000.
-
- "flag_pic"
- "*
- if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
-#ifdef MOTOROLA
-#ifdef HPUX_ASM
- return \"bsr.l %0\";
-#else
-#ifdef USE_GAS
- return \"bsr.l %0@PLTPC\";
-#else
- return \"bsr %0@PLTPC\";
-#endif
-#endif
-#else
- /* The ',a1' is a dummy argument telling the Sun assembler we want PIC,
- GAS just plain ignores it. */
- return \"jbsr %0,a1\";
-#endif
- return \"jsr %0\";
-")
-
-;; Call subroutine, returning value in operand 0
-;; (which must be a hard register).
-;; See comments before "call" regarding PIC calls.
-(define_expand "call_value"
- [(set (match_operand 0 "" "")
- (call (match_operand:QI 1 "memory_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ;; Operand 2 not really used on the m68000.
- ""
- "
-{
- if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
- SYMBOL_REF_FLAG (XEXP (operands[1], 0)) = 1;
-}")
-
-;; This is a normal call_value
-(define_insn ""
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "memory_operand" "o")
- (match_operand:SI 2 "general_operand" "g")))]
- ;; Operand 2 not really used on the m68000.
- "! flag_pic"
- "*
-#if defined (MOTOROLA) && !defined (USE_GAS)
-#ifdef MOTOROLA_BSR
- if (GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
- return \"bsr %1\";
-#endif
- return \"jsr %1\";
-#else
- return \"jbsr %1\";
-#endif
-")
-
-;; This is a PIC call_value
-(define_insn ""
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "memory_operand" "o")
- (match_operand:SI 2 "general_operand" "g")))]
- ;; Operand 2 not really used on the m68000.
- "flag_pic"
- "*
- if (GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
-#ifdef MOTOROLA
-#ifdef HPUX_ASM
- return \"bsr.l %1\";
-#else
-#ifdef USE_GAS
- return \"bsr.l %1@PLTPC\";
-#else
- return \"bsr %1@PLTPC\";
-#endif
-#endif
-#else
- /* The ',a1' is a dummy argument telling the Sun assembler we want PIC
- GAS just plain ignores it. */
- return \"jbsr %1,a1\";
-#endif
- return \"jsr %1\";
-")
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- "NEEDS_UNTYPED_CALL"
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-(define_insn "probe"
- [(reg:SI 15)]
- "NEED_PROBE"
- "*
-{
- operands[0] = gen_rtx (PLUS, SImode, stack_pointer_rtx,
- gen_rtx (CONST_INT, VOIDmode, NEED_PROBE));
- return \"tstl %a0\";
-}")
-
-;; Used for frameless functions which save no regs and allocate no locals.
-(define_insn "return"
- [(return)]
- "USE_RETURN_INSN"
- "*
-{
- if (current_function_pops_args == 0)
- return \"rts\";
- operands[0] = gen_rtx (CONST_INT, VOIDmode, current_function_pops_args);
- return \"rtd %0\";
-}")
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
- ""
- "jmp %a0")
-
-;; This should not be used unless the add/sub insns can't be.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=a")
- (match_operand:QI 1 "address_operand" "p"))]
- ""
- "*
-{
-#ifndef SGS_NO_LI
- /* Recognize an insn that refers to a table of offsets. Such an insn will
- need to refer to a label on the insn. So output one. Use the
- label-number of the table of offsets to generate this label. This code,
- and similar code above, assumes that there will be at most one reference
- to each table. */
- if (GET_CODE (operands[1]) == PLUS
- && GET_CODE (XEXP (operands[1], 1)) == LABEL_REF
- && GET_CODE (XEXP (operands[1], 0)) != PLUS)
- {
- rtx labelref = XEXP (operands[1], 1);
-#if defined (MOTOROLA) && !defined (SGS_SWITCH_TABLES)
-#ifdef SGS
- asm_fprintf (asm_out_file, \"\\tset %LLI%d,.+2\\n\",
- CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-#else /* not SGS */
- asm_fprintf (asm_out_file, \"\\t.set %LLI%d,.+2\\n\",
- CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-#endif /* not SGS */
-#else /* SGS_SWITCH_TABLES or not MOTOROLA */
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\",
- CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-#ifdef SGS_SWITCH_TABLES
- /* Set flag saying we need to define the symbol
- LD%n (with value L%n-LI%n) at the end of the switch table. */
- switch_table_difference_label_flag = 1;
-#endif /* SGS_SWITCH_TABLES */
-#endif /* SGS_SWITCH_TABLES or not MOTOROLA */
- }
-#endif /* SGS_NO_LI */
-
- return \"lea %a1,%0\";
-}")
-
-;; This is the first machine-dependent peephole optimization.
-;; It is useful when a floating value is returned from a function call
-;; and then is moved into an FP register.
-;; But it is mainly intended to test the support for these optimizations.
-
-(define_peephole
- [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
- (set (match_operand:DF 0 "register_operand" "=f")
- (match_operand:DF 1 "register_operand" "ad"))]
- "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
- "*
-{
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"move%.l %1,%@\", xoperands);
- output_asm_insn (\"move%.l %1,%-\", operands);
- return \"fmove%.d %+,%0\";
-}
-")
-
-;; Optimize a stack-adjust followed by a push of an argument.
-;; This is said to happen frequently with -msoft-float
-;; when there are consecutive library calls.
-
-(define_peephole
- [(set (reg:SI 15) (plus:SI (reg:SI 15)
- (match_operand:SI 0 "const_int_operand" "n")))
- (set (match_operand:SF 1 "push_operand" "=m")
- (match_operand:SF 2 "general_operand" "rmfF"))]
- "INTVAL (operands[0]) >= 4
- && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
- "*
-{
- if (INTVAL (operands[0]) > 4)
- {
- rtx xoperands[2];
- xoperands[0] = stack_pointer_rtx;
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[0]) - 4);
-#ifndef NO_ADDSUB_Q
- if (INTVAL (xoperands[1]) <= 8)
- {
- if (!TARGET_5200)
- output_asm_insn (\"addq%.w %1,%0\", xoperands);
- else
- output_asm_insn (\"addq%.l %1,%0\", xoperands);
- }
- else if (TARGET_CPU32 && INTVAL (xoperands[1]) <= 16)
- {
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (xoperands[1]) - 8);
- output_asm_insn (\"addq%.w %#8,%0\;addq%.w %1,%0\", xoperands);
- }
- else
-#endif
- if (INTVAL (xoperands[1]) <= 0x7FFF)
- {
- if (TARGET_68040)
- output_asm_insn (\"add%.w %1,%0\", xoperands);
- else
-#ifdef MOTOROLA
- output_asm_insn (\"lea (%c1,%0),%0\", xoperands);
-#else
- output_asm_insn (\"lea %0@(%c1),%0\", xoperands);
-#endif
- }
- else
- output_asm_insn (\"add%.l %1,%0\", xoperands);
- }
- if (FP_REG_P (operands[2]))
- return \"fmove%.s %2,%@\";
- return \"move%.l %2,%@\";
-}")
-
-;; Speed up stack adjust followed by a fullword fixedpoint push.
-
-(define_peephole
- [(set (reg:SI 15) (plus:SI (reg:SI 15)
- (match_operand:SI 0 "const_int_operand" "n")))
- (set (match_operand:SI 1 "push_operand" "=m")
- (match_operand:SI 2 "general_operand" "g"))]
- "INTVAL (operands[0]) >= 4
- && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
- "*
-{
- if (INTVAL (operands[0]) > 4)
- {
- rtx xoperands[2];
- xoperands[0] = stack_pointer_rtx;
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[0]) - 4);
-#ifndef NO_ADDSUB_Q
- if (INTVAL (xoperands[1]) <= 8)
- {
- if (!TARGET_5200)
- output_asm_insn (\"addq%.w %1,%0\", xoperands);
- else
- output_asm_insn (\"addq%.l %1,%0\", xoperands);
- }
- else if (TARGET_CPU32 && INTVAL (xoperands[1]) <= 16)
- {
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (xoperands[1]) - 8);
- output_asm_insn (\"addq%.w %#8,%0\;addq%.w %1,%0\", xoperands);
- }
- else
-#endif
- if (INTVAL (xoperands[1]) <= 0x7FFF)
- {
- if (TARGET_68040)
- output_asm_insn (\"add%.w %1,%0\", xoperands);
- else
-#ifdef MOTOROLA
- output_asm_insn (\"lea (%c1,%0),%0\", xoperands);
-#else
- output_asm_insn (\"lea %0@(%c1),%0\", xoperands);
-#endif
- }
- else
- output_asm_insn (\"add%.l %1,%0\", xoperands);
- }
- if (operands[2] == const0_rtx)
- return \"clr%.l %@\";
- return \"move%.l %2,%@\";
-}")
-
-;; Speed up pushing a single byte but leaving four bytes of space.
-
-(define_peephole
- [(set (mem:QI (pre_dec:SI (reg:SI 15)))
- (match_operand:QI 1 "general_operand" "dami"))
- (set (reg:SI 15) (minus:SI (reg:SI 15) (const_int 2)))]
- "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
- "*
-{
- rtx xoperands[4];
-
- if (GET_CODE (operands[1]) == REG)
- return \"move%.l %1,%-\";
-
- xoperands[1] = operands[1];
- xoperands[2]
- = gen_rtx (MEM, QImode,
- gen_rtx (PLUS, VOIDmode, stack_pointer_rtx,
- gen_rtx (CONST_INT, VOIDmode, 3)));
- xoperands[3] = stack_pointer_rtx;
- if (!TARGET_5200)
- output_asm_insn (\"subq%.w %#4,%3\;move%.b %1,%2\", xoperands);
- else
- output_asm_insn (\"subq%.l %#4,%3\;move%.b %1,%2\", xoperands);
- return \"\";
-}")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=d")
- (const_int 0))
- (set (strict_low_part (subreg:HI (match_dup 0) 0))
- (match_operand:HI 1 "general_operand" "rmn"))]
- "strict_low_part_peephole_ok (HImode, prev_nonnote_insn (insn), operands[0])"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- if (operands[1] == const0_rtx
- && (DATA_REG_P (operands[0])
- || GET_CODE (operands[0]) == MEM)
- /* clr insns on 68000 read before writing.
- This isn't so on the 68010, but we have no TARGET_68010. */
- && ((TARGET_68020 || TARGET_5200)
- || !(GET_CODE (operands[0]) == MEM
- && MEM_VOLATILE_P (operands[0]))))
- return \"clr%.w %0\";
- }
- return \"move%.w %1,%0\";
-}")
-
-;; dbCC peepholes
-;;
-;; Turns
-;; loop:
-;; [ ... ]
-;; jCC label ; abnormal loop termination
-;; dbra dN, loop ; normal loop termination
-;;
-;; Into
-;; loop:
-;; [ ... ]
-;; dbCC dN, loop
-;; jCC label
-;;
-;; Which moves the jCC condition outside the inner loop for free.
-;;
-(define_peephole
- [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
- [(cc0) (const_int 0)])
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (parallel
- [(set (pc)
- (if_then_else
- (ge (plus:HI (match_operand:HI 0 "register_operand" "+d")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:HI (match_dup 0)
- (const_int -1)))])]
- "!TARGET_5200 && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
- "*
-{
- CC_STATUS_INIT;
- output_dbcc_and_branch (operands);
- return \"\";
-}")
-
-(define_peephole
- [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
- [(cc0) (const_int 0)])
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (parallel
- [(set (pc)
- (if_then_else
- (ge (plus:SI (match_operand:SI 0 "register_operand" "+d")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))])]
- "!TARGET_5200 && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
- "*
-{
- CC_STATUS_INIT;
- output_dbcc_and_branch (operands);
- return \"\";
-}")
-
-
-;; FPA multiply and add.
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=x,y,y")
- (plus:DF (mult:DF (match_operand:DF 1 "general_operand" "%x,dmF,y")
- (match_operand:DF 2 "general_operand" "xH,y,y"))
- (match_operand:DF 3 "general_operand" "xH,y,dmF")))]
- "TARGET_FPA"
- "@
- fpma%.d %1,%w2,%w3,%0
- fpma%.d %x1,%x2,%x3,%0
- fpma%.d %x1,%x2,%x3,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=x,y,y")
- (plus:SF (mult:SF (match_operand:SF 1 "general_operand" "%x,ydmF,y")
- (match_operand:SF 2 "general_operand" "xH,y,ydmF"))
- (match_operand:SF 3 "general_operand" "xH,ydmF,ydmF")))]
- "TARGET_FPA"
- "@
- fpma%.s %1,%w2,%w3,%0
- fpma%.s %1,%2,%3,%0
- fpma%.s %1,%2,%3,%0")
-
-;; FPA Multiply and subtract
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=x,y,y")
- (minus:DF (match_operand:DF 1 "general_operand" "xH,rmF,y")
- (mult:DF (match_operand:DF 2 "general_operand" "%xH,y,y")
- (match_operand:DF 3 "general_operand" "x,y,rmF"))))]
- "TARGET_FPA"
- "@
- fpms%.d %3,%w2,%w1,%0
- fpms%.d %x3,%2,%x1,%0
- fpms%.d %x3,%2,%x1,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=x,y,y")
- (minus:SF (match_operand:SF 1 "general_operand" "xH,rmF,yrmF")
- (mult:SF (match_operand:SF 2 "general_operand" "%xH,rmF,y")
- (match_operand:SF 3 "general_operand" "x,y,yrmF"))))]
- "TARGET_FPA"
- "@
- fpms%.s %3,%w2,%w1,%0
- fpms%.s %3,%2,%1,%0
- fpms%.s %3,%2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=x,y,y")
- (minus:DF (mult:DF (match_operand:DF 1 "general_operand" "%xH,y,y")
- (match_operand:DF 2 "general_operand" "x,y,rmF"))
- (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
- "TARGET_FPA"
- "@
- fpmr%.d %2,%w1,%w3,%0
- fpmr%.d %x2,%1,%x3,%0
- fpmr%.d %x2,%1,%x3,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=x,y,y")
- (minus:SF (mult:SF (match_operand:SF 1 "general_operand" "%xH,rmF,y")
- (match_operand:SF 2 "general_operand" "x,y,yrmF"))
- (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
- "TARGET_FPA"
- "@
- fpmr%.s %2,%w1,%w3,%0
- fpmr%.s %x2,%1,%x3,%0
- fpmr%.s %x2,%1,%x3,%0")
-
-;; FPA Add and multiply
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=x,y,y")
- (mult:DF (plus:DF (match_operand:DF 1 "general_operand" "%xH,y,y")
- (match_operand:DF 2 "general_operand" "x,y,rmF"))
- (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
- "TARGET_FPA"
- "@
- fpam%.d %2,%w1,%w3,%0
- fpam%.d %x2,%1,%x3,%0
- fpam%.d %x2,%1,%x3,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=x,y,y")
- (mult:SF (plus:SF (match_operand:SF 1 "general_operand" "%xH,rmF,y")
- (match_operand:SF 2 "general_operand" "x,y,yrmF"))
- (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
- "TARGET_FPA"
- "@
- fpam%.s %2,%w1,%w3,%0
- fpam%.s %x2,%1,%x3,%0
- fpam%.s %x2,%1,%x3,%0")
-
-;;FPA Subtract and multiply
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=x,y,y")
- (mult:DF (minus:DF (match_operand:DF 1 "general_operand" "xH,y,y")
- (match_operand:DF 2 "general_operand" "x,y,rmF"))
- (match_operand:DF 3 "general_operand" "xH,rmF,y")))]
- "TARGET_FPA"
- "@
- fpsm%.d %2,%w1,%w3,%0
- fpsm%.d %x2,%1,%x3,%0
- fpsm%.d %x2,%1,%x3,%0")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=x,y,y")
- (mult:DF (match_operand:DF 1 "general_operand" "xH,rmF,y")
- (minus:DF (match_operand:DF 2 "general_operand" "xH,y,y")
- (match_operand:DF 3 "general_operand" "x,y,rmF"))))]
- "TARGET_FPA"
- "@
- fpsm%.d %3,%w2,%w1,%0
- fpsm%.d %x3,%2,%x1,%0
- fpsm%.d %x3,%2,%x1,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=x,y,y")
- (mult:SF (minus:SF (match_operand:SF 1 "general_operand" "xH,rmF,y")
- (match_operand:SF 2 "general_operand" "x,y,yrmF"))
- (match_operand:SF 3 "general_operand" "xH,rmF,yrmF")))]
- "TARGET_FPA"
- "@
- fpsm%.s %2,%w1,%w3,%0
- fpsm%.s %x2,%1,%x3,%0
- fpsm%.s %x2,%1,%x3,%0")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=x,y,y")
- (mult:SF (match_operand:SF 1 "general_operand" "xH,rmF,yrmF")
- (minus:SF (match_operand:SF 2 "general_operand" "xH,rmF,y")
- (match_operand:SF 3 "general_operand" "x,y,yrmF"))))]
- "TARGET_FPA"
- "@
- fpsm%.s %3,%w2,%w1,%0
- fpsm%.s %x3,%2,%x1,%0
- fpsm%.s %x3,%2,%x1,%0")
-
-(define_expand "tstxf"
- [(set (cc0)
- (match_operand:XF 0 "nonimmediate_operand" ""))]
- "TARGET_68881"
- "m68k_last_compare_had_fp_operands = 1;")
-
-(define_insn ""
- [(set (cc0)
- (match_operand:XF 0 "nonimmediate_operand" "fm"))]
- "TARGET_68881"
- "*
-{
- cc_status.flags = CC_IN_68881;
- return \"ftst%.x %0\";
-}")
-
-(define_expand "cmpxf"
- [(set (cc0)
- (compare (match_operand:XF 0 "nonimmediate_operand" "")
- (match_operand:XF 1 "nonimmediate_operand" "")))]
- "TARGET_68881"
- "m68k_last_compare_had_fp_operands = 1;")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:XF 0 "nonimmediate_operand" "f,m")
- (match_operand:XF 1 "nonimmediate_operand" "fm,f")))]
- "TARGET_68881"
- "*
-{
- cc_status.flags = CC_IN_68881;
-#ifdef SGS_CMP_ORDER
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- return \"fcmp%.x %0,%1\";
- else
- return \"fcmp%.x %0,%f1\";
- }
- cc_status.flags |= CC_REVERSED;
- return \"fcmp%.x %1,%f0\";
-#else
- if (REG_P (operands[0]))
- {
- if (REG_P (operands[1]))
- return \"fcmp%.x %1,%0\";
- else
- return \"fcmp%.x %f1,%0\";
- }
- cc_status.flags |= CC_REVERSED;
- return \"fcmp%.x %f0,%1\";
-#endif
-}")
-
-(define_insn "extendsfxf2"
- [(set (match_operand:XF 0 "general_operand" "=fm,f")
- (float_extend:XF (match_operand:SF 1 "general_operand" "f,m")))]
- "TARGET_68881"
- "*
-{
- if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
- {
- if (REGNO (operands[0]) == REGNO (operands[1]))
- {
- /* Extending float to double in an fp-reg is a no-op.
- NOTICE_UPDATE_CC has already assumed that the
- cc will be set. So cancel what it did. */
- cc_status = cc_prev_status;
- return \"\";
- }
- return \"f%$move%.x %1,%0\";
- }
- if (FP_REG_P (operands[0]))
- return \"f%$move%.s %f1,%0\";
- return \"fmove%.x %f1,%0\";
-}")
-
-
-(define_insn "extenddfxf2"
- [(set (match_operand:XF 0 "general_operand" "=fm,f")
- (float_extend:XF
- (match_operand:DF 1 "general_operand" "f,m")))]
- "TARGET_68881"
- "*
-{
- if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
- {
- if (REGNO (operands[0]) == REGNO (operands[1]))
- {
- /* Extending float to double in an fp-reg is a no-op.
- NOTICE_UPDATE_CC has already assumed that the
- cc will be set. So cancel what it did. */
- cc_status = cc_prev_status;
- return \"\";
- }
- return \"fmove%.x %1,%0\";
- }
- if (FP_REG_P (operands[0]))
- return \"f%&move%.d %f1,%0\";
- return \"fmove%.x %f1,%0\";
-}")
-
-(define_insn "truncxfdf2"
- [(set (match_operand:DF 0 "general_operand" "=m,!r")
- (float_truncate:DF
- (match_operand:XF 1 "general_operand" "f,f")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"move%.l %+,%0\";
- }
- return \"fmove%.d %f1,%0\";
-}")
-
-(define_insn "truncxfsf2"
- [(set (match_operand:SF 0 "general_operand" "=dm")
- (float_truncate:SF
- (match_operand:XF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.s %f1,%0")
-
-(define_insn "floatsixf2"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (float:XF (match_operand:SI 1 "general_operand" "dmi")))]
- "TARGET_68881"
- "fmove%.l %1,%0")
-
-(define_insn "floathixf2"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (float:XF (match_operand:HI 1 "general_operand" "dmn")))]
- "TARGET_68881"
- "fmove%.w %1,%0")
-
-(define_insn "floatqixf2"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (float:XF (match_operand:QI 1 "general_operand" "dmn")))]
- "TARGET_68881"
- "fmove%.b %1,%0")
-
-(define_insn "ftruncxf2"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (fix:XF (match_operand:XF 1 "general_operand" "fFm")))]
- "TARGET_68881"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"fintrz%.x %f1,%0\";
- return \"fintrz%.x %f1,%0\";
-}")
-
-(define_insn "fixxfqi2"
- [(set (match_operand:QI 0 "general_operand" "=dm")
- (fix:QI (match_operand:XF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.b %1,%0")
-
-(define_insn "fixxfhi2"
- [(set (match_operand:HI 0 "general_operand" "=dm")
- (fix:HI (match_operand:XF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.w %1,%0")
-
-(define_insn "fixxfsi2"
- [(set (match_operand:SI 0 "general_operand" "=dm")
- (fix:SI (match_operand:XF 1 "general_operand" "f")))]
- "TARGET_68881"
- "fmove%.l %1,%0")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (plus:XF (float:XF (match_operand:SI 2 "general_operand" "dmi"))
- (match_operand:XF 1 "nonimmediate_operand" "0")))]
- "TARGET_68881"
- "fadd%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (plus:XF (float:XF (match_operand:HI 2 "general_operand" "dmn"))
- (match_operand:XF 1 "nonimmediate_operand" "0")))]
- "TARGET_68881"
- "fadd%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (plus:XF (float:XF (match_operand:QI 2 "general_operand" "dmn"))
- (match_operand:XF 1 "general_operand" "0")))]
- "TARGET_68881"
- "fadd%.b %2,%0")
-
-(define_insn "addxf3"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (plus:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
- (match_operand:XF 2 "nonimmediate_operand" "fm")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[2]))
- return \"fadd%.x %2,%0\";
- return \"fadd%.x %f2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
- (float:XF (match_operand:SI 2 "general_operand" "dmi"))))]
- "TARGET_68881"
- "fsub%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
- (float:XF (match_operand:HI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "fsub%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
- (float:XF (match_operand:QI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "fsub%.b %2,%0")
-
-(define_insn "subxf3"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
- (match_operand:XF 2 "nonimmediate_operand" "fm")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[2]))
- return \"fsub%.x %2,%0\";
- return \"fsub%.x %f2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (mult:XF (float:XF (match_operand:SI 2 "general_operand" "dmi"))
- (match_operand:XF 1 "nonimmediate_operand" "0")))]
- "TARGET_68881"
- "fmul%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (mult:XF (float:XF (match_operand:HI 2 "general_operand" "dmn"))
- (match_operand:XF 1 "nonimmediate_operand" "0")))]
- "TARGET_68881"
- "fmul%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (mult:XF (float:XF (match_operand:QI 2 "general_operand" "dmn"))
- (match_operand:XF 1 "nonimmediate_operand" "0")))]
- "TARGET_68881"
- "fmul%.b %2,%0")
-
-(define_insn "mulxf3"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
- (match_operand:XF 2 "nonimmediate_operand" "fm")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[2]))
- return \"fmul%.x %2,%0\";
- return \"fmul%.x %f2,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
- (float:XF (match_operand:SI 2 "general_operand" "dmi"))))]
- "TARGET_68881"
- "fdiv%.l %2,%0")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
- (float:XF (match_operand:HI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "fdiv%.w %2,%0")
-
-(define_insn ""
- [(set (match_operand:XF 0 "general_operand" "=f")
- (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
- (float:XF (match_operand:QI 2 "general_operand" "dmn"))))]
- "TARGET_68881"
- "fdiv%.b %2,%0")
-
-(define_insn "divxf3"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
- (match_operand:XF 2 "nonimmediate_operand" "fm")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[2]))
- return \"fdiv%.x %2,%0\";
- return \"fdiv%.x %f2,%0\";
-}")
-
-(define_expand "negxf2"
- [(set (match_operand:XF 0 "general_operand" "")
- (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- /* ??? There isn't an FPA define_insn so we could handle it here too.
- For now we don't (paranoia). */
- if (!TARGET_68881)
- {
- rtx result;
- rtx target;
- rtx insns;
-
- start_sequence ();
- target = operand_subword (operands[0], 0, 1, XFmode);
- result = expand_binop (SImode, xor_optab,
- operand_subword_force (operands[1], 0, XFmode),
- GEN_INT(0x80000000), target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
- operand_subword_force (operands[1], 1, XFmode));
- emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
- operand_subword_force (operands[1], 2, XFmode));
-
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
- DONE;
- }
-}")
-
-(define_insn "negxf2_68881"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (neg:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
- return \"fneg%.x %1,%0\";
- return \"fneg%.x %f1,%0\";
-}")
-
-(define_expand "absxf2"
- [(set (match_operand:XF 0 "general_operand" "")
- (abs:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- /* ??? There isn't an FPA define_insn so we could handle it here too.
- For now we don't (paranoia). */
- if (!TARGET_68881)
- {
- rtx result;
- rtx target;
- rtx insns;
-
- start_sequence ();
- target = operand_subword (operands[0], 0, 1, XFmode);
- result = expand_binop (SImode, and_optab,
- operand_subword_force (operands[1], 0, XFmode),
- GEN_INT(0x7fffffff), target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
- operand_subword_force (operands[1], 1, XFmode));
- emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
- operand_subword_force (operands[1], 2, XFmode));
-
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
- DONE;
- }
-}")
-
-(define_insn "absxf2_68881"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (abs:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
- "TARGET_68881"
- "*
-{
- if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
- return \"fabs%.x %1,%0\";
- return \"fabs%.x %f1,%0\";
-}")
-
-(define_insn "sqrtxf2"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (sqrt:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
- "TARGET_68881"
- "fsqrt%.x %1,%0")
-
-(define_insn "sinsf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (unspec:SF [(match_operand:SF 1 "general_operand" "fm")] 1))]
- "TARGET_68881 && flag_fast_math"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"fsin%.x %1,%0\";
- else
- return \"fsin%.s %1,%0\";
-}")
-
-(define_insn "sindf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "general_operand" "fm")] 1))]
- "TARGET_68881 && flag_fast_math"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"fsin%.x %1,%0\";
- else
- return \"fsin%.d %1,%0\";
-}")
-
-(define_insn "sinxf2"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (unspec:XF [(match_operand:XF 1 "nonimmediate_operand" "fm")] 1))]
- "TARGET_68881 && flag_fast_math"
- "fsin%.x %1,%0")
-
-(define_insn "cossf2"
- [(set (match_operand:SF 0 "general_operand" "=f")
- (unspec:SF [(match_operand:SF 1 "general_operand" "fm")] 2))]
- "TARGET_68881 && flag_fast_math"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"fcos%.x %1,%0\";
- else
- return \"fcos%.s %1,%0\";
-}")
-
-(define_insn "cosdf2"
- [(set (match_operand:DF 0 "general_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "general_operand" "fm")] 2))]
- "TARGET_68881 && flag_fast_math"
- "*
-{
- if (FP_REG_P (operands[1]))
- return \"fcos%.x %1,%0\";
- else
- return \"fcos%.d %1,%0\";
-}")
-
-(define_insn "cosxf2"
- [(set (match_operand:XF 0 "general_operand" "=f")
- (unspec:XF [(match_operand:XF 1 "nonimmediate_operand" "fm")] 2))]
- "TARGET_68881 && flag_fast_math"
- "fcos%.x %1,%0")
diff --git a/gcc/config/m68k/m68kemb.h b/gcc/config/m68k/m68kemb.h
deleted file mode 100644
index 016a13b667f..00000000000
--- a/gcc/config/m68k/m68kemb.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Definitions of target machine for GNU compiler. "embedded" 68XXX.
- This is meant to be included after m68k.h.
- Copyright (C) 1994, 1995 Free Software Foundation, Inc. */
-
-#define PTRDIFF_TYPE "long int"
-#define SIZE_TYPE "long unsigned int"
-
-/* In order for bitfields to work on a 68000, or with -mnobitfield, we must
- define either PCC_BITFIELD_TYPE_MATTERS or STRUCTURE_SIZE_BOUNDARY.
- Defining STRUCTURE_SIZE_BOUNDARY results in structure packing problems,
- so we define PCC_BITFIELD_TYPE_MATTERS. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Undef PCC_STATIC_STRUCT_RETURN so that we get a re-entrant calling
- convention. */
-#undef PCC_STATIC_STRUCT_RETURN
-
-/* Don't default to pcc-struct-return, so that we can return small structures
- and unions in registers, which is slightly more efficient. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Return floating point values in a fp register. This make fp code a
- little bit faster. It also makes -msoft-float code incompatible with
- -m68881 code, so people have to be careful not to mix the two. */
-#undef FUNCTION_VALUE
-#define FUNCTION_VALUE(VALTYPE,FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
-
-#undef LIBCALL_VALUE
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, (MODE), \
- ((TARGET_68881 \
- && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
- ? 16 : 0))
-
-#undef FUNCTION_VALUE_REGNO_P
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (TARGET_68881 && (N) == 16))
-
-#undef NEEDS_UNTYPED_CALL
-#define NEEDS_UNTYPED_CALL 1
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmc68000 -D__embedded__ -Asystem(embedded) \
- -Amachine(mc68000)"
-
-/* Override the default LIB_SPEC from gcc.c. We don't currently support
- profiling, or libg.a
-
-#define LIB_SPEC "-lc"
-
-/* Make this be null, since we want the crt0.o to come from the linker
- script */
-
-#define STARTFILE_SPEC ""
diff --git a/gcc/config/m68k/m68kv4.h b/gcc/config/m68k/m68kv4.h
deleted file mode 100644
index a40d919990d..00000000000
--- a/gcc/config/m68k/m68kv4.h
+++ /dev/null
@@ -1,346 +0,0 @@
-/* Target definitions for GNU compiler for mc680x0 running System V.4
- Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@monkeys.com) and
- Fred Fish (fnf@cygnus.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. */
-
-/* Use SGS_* macros to control compilation in m68k.md */
-
-#define SGS_SWITCH_TABLES /* Different switch table handling */
-
-#include "m68k/sgs.h" /* The m68k/SVR4 assembler is SGS based */
-
-/* The SGS assembler requires a special definition of
- ASM_IDENTIFY_GCC. We combine the m68k/sgs.h and the svr4.h
- definitions below. */
-#undef ASM_IDENTIFY_GCC
-
-#include "svr4.h" /* Pick up the generic SVR4 macros */
-
-/* See m68k.h. 7 means 68020 with 68881. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-#endif
-
-/* When using an SGS assembler, modify the name of the artificial label which
- identifies this file as having been compiled with gcc, and the macro that
- emits such a label in the assembly output, to use '%' rather than '.' */
-
-#undef ASM_IDENTIFY_GCC
-#define ASM_IDENTIFY_GCC(FILE) \
-do \
- { \
- if (write_symbols != DBX_DEBUG) \
- fputs ("gcc2_compiled%:\n", FILE); \
- } \
-while (0)
-
-/* Override the definition of NO_DOLLAR_IN_LABEL in svr4.h, for special
- g++ assembler names. When this is defined, g++ uses embedded '.'
- characters and some m68k assemblers have problems with this. The
- chances are much greater that any particular assembler will permit
- embedded '$' characters. */
-
-#undef NO_DOLLAR_IN_LABEL
-
-/* Define PCC_STATIC_STRUCT_RETURN if the convention on the target machine
- is to use the nonreentrant technique for returning structure and union
- values, as commonly implemented by the AT&T Portable C Compiler (PCC).
- When defined, the gcc option -fpcc-struct-return can be used to cause
- this form to be generated. When undefined, the option does nothing.
- For m68k SVR4, the convention is to use a reentrant technique compatible
- with the gcc default, so override the definition of this macro in m68k.h */
-
-#undef PCC_STATIC_STRUCT_RETURN
-
-/* Provide a set of pre-definitions and pre-assertions appropriate for
- the m68k running svr4. __svr4__ is our extension. */
-
-#define CPP_PREDEFINES \
- "-Dm68k -Dunix -D__svr4__ -D__motorola__ \
- -Asystem(unix) -Asystem(svr4) -Acpu(m68k) -Amachine(m68k)"
-
-/* Test to see if the target includes a 68881 by default, and use CPP_SPEC
- to control whether or not __HAVE_68881__ is defined by default or not.
- If a 68881 is the default, gcc will use inline 68881 instructions, by
- predefining __HAVE_68881__, unless -msoft-float is specified.
- If a 68881 is not the default, gcc will only define __HAVE_68881__ if
- -m68881 is specified. */
-
-#if TARGET_DEFAULT & MASK_68881
-#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
-#else
-#define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
-#endif
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. We override the definition in m68k.h
- and match the way the native m68k/SVR4 compiler does profiling, with the
- address of the profile counter in a1, not a0, and using bsr rather
- than jsr. */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- asm_fprintf ((FILE), "\tlea.l\t(%LLP%d,%Rpc),%Ra1\n\tbsr\t_mcount\n", \
- (LABELNO))
-
-/* Local common symbols are declared to the assembler with ".lcomm" rather
- than ".bss", so override the definition in svr4.h */
-/* ??? svr4.h no longer defines this, and this is only used by m68k/amix.h. */
-
-#undef BSS_ASM_OP
-#define BSS_ASM_OP ".lcomm"
-
-/* Register in which address to store a structure value is passed to a
- function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */
-
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE_REGNUM 8
-
-/* Register in which static-chain is passed to a function. The
- default in m68k.h is a0, but that is already the struct value
- regnum. Make it a1 instead. */
-
-#undef STATIC_CHAIN_REGNUM
-#define STATIC_CHAIN_REGNUM 9
-
-#define ASM_COMMENT_START "#"
-
-#undef TYPE_OPERAND_FMT
-#define TYPE_OPERAND_FMT "@%s"
-
-/* Define how the m68k registers should be numbered for Dwarf output.
- The numbering provided here should be compatible with the native
- SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7
- are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* The ASM_OUTPUT_SKIP macro is first defined in m68k.h, using ".skip".
- It is then overridden by m68k/sgs.h to use ".space", and again by svr4.h
- to use ".zero". The m68k/SVR4 assembler uses ".space", so repeat the
- definition from m68k/sgs.h here. Note that ASM_NO_SKIP_IN_TEXT is
- defined in m68k/sgs.h, so we don't have to repeat it here. */
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t%s %u\n", SPACE_ASM_OP, (SIZE))
-
-/* 1 if N is a possible register number for a function value.
- For m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
- pointer, or floating types, respectively. Reject fp0 if not using a
- 68881 coprocessor. */
-
-#undef FUNCTION_VALUE_REGNO_P
-#define FUNCTION_VALUE_REGNO_P(N) \
- ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
-
-/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
- more than one register. */
-
-#undef NEEDS_UNTYPED_CALL
-#define NEEDS_UNTYPED_CALL 1
-
-/* Define how to generate (in the callee) the output value of a function
- and how to find (in the caller) the value returned by a function. VALTYPE
- is the data type of the value (as a tree). If the precise function being
- called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0.
- For m68k/SVR4 generate the result in d0, a0, or fp0 as appropriate. */
-
-#undef FUNCTION_VALUE
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
- : (POINTER_TYPE_P (VALTYPE) \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
- : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
-
-/* For compatibility with the large body of existing code which does not
- always properly declare external functions returning pointer types, the
- m68k/SVR4 convention is to copy the value returned for pointer functions
- from a0 to d0 in the function epilogue, so that callers that have
- neglected to properly declare the callee can still find the correct return
- value. */
-
-extern int current_function_returns_pointer;
-#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
-do { \
- if ((current_function_returns_pointer) && \
- ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
- asm_fprintf (FILE, "\tmov.l %Ra0,%Rd0\n"); \
-} while (0);
-
-/* Define how to find the value returned by a library function assuming the
- value has mode MODE.
- For m68k/SVR4 look for integer values in d0, pointer values in d0
- (returned in both d0 and a0), and floating values in fp0. */
-
-#undef LIBCALL_VALUE
-#define LIBCALL_VALUE(MODE) \
- ((((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode) \
- && TARGET_68881) \
- ? gen_rtx (REG, (MODE), 16) \
- : gen_rtx (REG, (MODE), 0))
-
-/* Boundary (in *bits*) on which stack pointer should be aligned.
- The m68k/SVR4 convention is to keep the stack pointer longword aligned. */
-
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure.
- For m68k/SVR4, this is the next longword boundary. */
-
-#undef EMPTY_FIELD_BOUNDARY
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* No data type wants to be aligned rounder than this.
- For m68k/SVR4, some types (doubles for example) are aligned on 8 byte
- boundaries */
-
-#undef BIGGEST_ALIGNMENT
-#define BIGGEST_ALIGNMENT 64
-
-/* SVR4 m68k assembler is bitching on the `comm i,1,1' which asks for
- 1 byte alignment. Don't generate alignment for COMMON seems to be
- safer until we the assembler is fixed. */
-#undef ASM_OUTPUT_ALIGNED_COMMON
-/* Same problem with this one. */
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-
-/* The `string' directive on m68k svr4 does not handle string with
- escape char (ie., `\') right. Use normal way to output ASCII bytes
- seems to be safer. */
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- register int sp = 0, lp = 0, ch; \
- fprintf ((FILE), "\t%s ", BYTE_ASM_OP); \
- do { \
- ch = (PTR)[sp]; \
- if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \
- { \
- fprintf ((FILE), "'%c", ch); \
- } \
- else \
- { \
- fprintf ((FILE), "0x%x", ch); \
- } \
- if (++sp < (LEN)) \
- { \
- if ((sp % 10) == 0) \
- { \
- fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP); \
- } \
- else \
- { \
- putc (',', (FILE)); \
- } \
- } \
- } while (sp < (LEN)); \
- putc ('\n', (FILE)); \
-} while (0)
-
-/* SVR4 m68k assembler is bitching on the syntax `2.b'.
- So use the "LLDnnn-LLnnn" format. Define LLDnnn after the table. */
-
-#undef ASM_OUTPUT_CASE_END
-#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
-do { \
- if (switch_table_difference_label_flag) \
- asm_fprintf ((FILE), "\t%s %LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM));\
- switch_table_difference_label_flag = 0; \
-} while (0)
-
-int switch_table_difference_label_flag;
-
-#undef ASM_OUTPUT_COMMON
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE)))
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE)))
-
-/* Override the definition in svr4.h. In m68k svr4, using swbeg is the
- standard way to do switch table. */
-#undef ASM_OUTPUT_BEFORE_CASE_LABEL
-#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- fprintf ((FILE), "\t%s &%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
-
-/* In m68k svr4, a symbol_ref rtx can be a valid PIC operand if it is an
- operand of a function call. */
-#undef LEGITIMATE_PIC_OPERAND_P
-#define LEGITIMATE_PIC_OPERAND_P(X) \
- ((! symbolic_operand (X, VOIDmode) \
- && ! (GET_CODE (X) == CONST_DOUBLE && CONST_DOUBLE_MEM (X) \
- && GET_CODE (CONST_DOUBLE_MEM (X)) == MEM \
- && symbolic_operand (XEXP (CONST_DOUBLE_MEM (X), 0), VOIDmode))) \
- || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)))
-
-/* Turn off function cse if we are doing PIC. We always want function call
- to be done as `bsr foo@PLTPC', so it will force the assembler to create
- the PLT entry for `foo'. Doing function cse will cause the address of `foo'
- to be loaded into a register, which is exactly what we want to avoid when
- we are doing PIC on svr4 m68k. */
-#undef OVERRIDE_OPTIONS
-#define OVERRIDE_OPTIONS \
-{ \
- if (flag_pic) flag_no_function_cse = 1; \
- if (! TARGET_68020 && flag_pic == 2) \
- error("-fPIC is not currently supported on the 68000 or 68010\n"); \
-}
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On m68k svr4, the trampoline is different from the generic version
- in that we use a1 as the static call chain. */
-
-#undef TRAMPOLINE_TEMPLATE
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x227a)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 8)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x2f3a)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 8)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x4e75)); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
-}
-
-/* Redefine since we are using a different trampoline */
-#undef TRAMPOLINE_SIZE
-#define TRAMPOLINE_SIZE 18
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#undef INITIALIZE_TRAMPOLINE
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 10)), CXT); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 14)), FNADDR); \
-}
diff --git a/gcc/config/m68k/mot3300-crt0.S b/gcc/config/m68k/mot3300-crt0.S
deleted file mode 100644
index c86e56b719b..00000000000
--- a/gcc/config/m68k/mot3300-crt0.S
+++ /dev/null
@@ -1,109 +0,0 @@
-/* The start module crt0.s for the SysV68 Motorola 3300 Delta Series.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Manfred Hollstein (manfred@lts.sel.alcatel.de).
-
-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. */
-
-#ifdef MOTOROLA
-# define COMM comm
-# define DATA data
-# define EVEN even
-# define FILE(n) file n
-# define GLOBAL_SYM(s) global s
-# define LOCAL_LABEL(l) L%##l
-# define SECTION(n) section n
-# define TEXT text
-#else /* Assume we are using GNU as. */
-# define COMM .comm
-# define DATA .data
-# define EVEN .even
-# define FILE(name) .file name
-# define GLOBAL_SYM(s) .globl s
-# define LOCAL_LABEL(l) .L.##l
-# define SECTION(n) .section n
-# define STRING(s) .asciz s
-# define TEXT .text
-#endif
-
- FILE ("crt0.s")
- TEXT
- GLOBAL_SYM (_start)
-_start: mov.l %d0,splimit%
- subq.w &8,%sp
- mov.l 8(%sp),(%sp)
- lea 12(%sp),%a0
- mov.l %a0,4(%sp)
- mov.l %a0,%a1
-LOCAL_LABEL(0):
- tst.l (%a0)+
- bne.b LOCAL_LABEL(0)
-#ifdef SGS_CMP_ORDER
- cmpa.l %a0,(%a1)
-#else
- cmpa.l (%a1),%a0
-#endif
- blt.b LOCAL_LABEL(1)
- subq.w &4,%a0
-LOCAL_LABEL(1):
- mov.l %a0,8(%sp)
- mov.l %a0,environ
- jsr initfpu
-
- subq.w &8,%sp
- clr.l %d0 /* if (! isatty (fileno (stderr))) */
- mov.b _iob+27,%d0
- mov.l %d0,-(%sp)
- jsr isatty
- addq.w &4,%sp
- tst.l %d0
- bne.b LOCAL_LABEL(isatty)
- clr.l -(%sp) /* setbuf (stderr, NULL) */
- pea _iob+28
- jsr setbuf
- addq.w &8,%sp
-LOCAL_LABEL(isatty):
- addq.w &8,%sp
-
- jsr main
- mov.l %d0,(%sp)
- jsr exit
- moveq.l &1,%d0
- trap &0
- nop
-
- EVEN
-
- COMM splimit%,4
- COMM environ,4
-
- COMM mcount,4
- COMM mcount%,4
- COMM monitor,4
-
-#ifdef STRING
- SECTION (.comment)
- STRING ("$Id: crt0.S,v 1.6 1995/12/07 17:17:47 manfred Exp $\n")
- STRING ("Contributed by manfred@lts.sel.alcatel.de (Manfred Hollstein, Germany)\n")
-#else
- byte 'C,'o,'n,'t,'r,'i,'b,'u,'t,'e,'d,' ,'b,'y
- byte ' ,'m,'a,'n,'f,'r,'e,'d,'@,'l,'t,'s,'.,'s
- byte 'e,'l,'.,'a,'l,'c,'a,'t,'e,'l,'.,'d,'e,'
- byte '(,'M,'a,'n,'f,'r,'e,'d,' ,'H,'o,'l,'l,'s
- byte 't,'e,'i,'n,',,' ,'G,'e,'r,'m,'a,'n,'y,')
- byte 10,0
-#endif
diff --git a/gcc/config/m68k/mot3300.h b/gcc/config/m68k/mot3300.h
deleted file mode 100644
index d86874c30c4..00000000000
--- a/gcc/config/m68k/mot3300.h
+++ /dev/null
@@ -1,814 +0,0 @@
-/* Definitions of target machine for GNU compiler,
- SysV68 Motorola 3300 Delta Series.
- Copyright (C) 1987, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Abramo and Roberto Bagnara (bagnara@dipisa.di.unipi.it)
- based on Alex Crain's 3B1 definitions.
- Maintained by Philippe De Muyter (phdm@info.ucl.ac.be).
- Support for GAS added by merging mot3300g.h into this file by
- Manfred Hollstein (manfred@lts.sel.alcatel.de).
-
-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 USE_GAS
-#define MOTOROLA /* Use Motorola syntax rather than "MIT" */
-#define MOTOROLA_BSR /* Use Span-dependent optimized bsr */
-#define SGS /* Uses SGS assembler */
-#define SGS_CMP_ORDER /* Takes cmp operands in reverse order */
-#define SGS_SWAP_W /* Use swap.w rather than just plain swap */
-#endif /* USE_GAS */
-
-#define NO_DOLLAR_IN_LABEL
-#define NO_DOT_IN_LABEL
-
-#include "m68k/m68k.h"
-
-/* See m68k.h. 0407 means 68020-68040. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_68040_ALSO|MASK_BITFIELD|MASK_68881|MASK_68020)
-#endif
-
-/* -m[c]6800 requires special flag to the assembler. */
-
-#undef ASM_SPEC
-#ifndef USE_GAS
-#define ASM_SPEC "%{m68000:-p 000}%{mc68000:-p 000}"
-#else /* USE_GAS */
-#define ASM_SPEC \
- "%{v:-v} %{m68000:-mc68000}%{mc68000:-mc68000}%{!mc68000:%{!m68000:-mc68020}}"
-#endif /* USE_GAS */
-
-/* NYI: FP= is equivalent to -msoft-float */
-
-/* We use /lib/libp/lib* when profiling. */
-
-/* NYI: if FP=M68881U library is -lc881u */
-/* NYI: if FP= library is -lc. */
-/* Default for us: FP=M68881 library is -lc881 */
-#undef LIB_SPEC
-#define LIB_SPEC "%{!shlib:%{!msoft-float:-lc881}%{msoft-float:-lc}}"
-#ifdef CROSS_COMPILE
-#ifndef USE_GLD
-#define DEFAULT_A_OUT_NAME "m68ka.out"
-#endif
-#endif
-
-#ifdef USE_GLD
-#undef LINK_SPEC
-#define LINK_SPEC "%{v:-v}"
-#endif /* defined (USE_GLD) */
-
-#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
-
-/* Shared libraries need to use crt0s.o */
-
-#undef STARTFILE_SPEC
-#ifdef CROSS_COMPILE
-#define STARTFILE_SPEC \
- "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
- %{shlib:crt0s.o%s shlib.ifile%s} %{p:-L"TOOLDIR_BASE_PREFIX DEFAULT_TARGET_MACHINE"/lib/libp} %{pg:-L"TOOLDIR_BASE_PREFIX DEFAULT_TARGET_MACHINE"/lib/libp} "
-#else /* CROSS_COMPILE */
-#define STARTFILE_SPEC \
- "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
- %{shlib:crt0s.o%s shlib.ifile%s} %{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} "
-#endif /* CROSS_COMPILE */
-
-/* Generate calls to memcpy, memcmp and memset. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* size_t is unsigned int. */
-
-#define SIZE_TYPE "unsigned int"
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* Follow sysV68 cc regarding alignment imposed by char:0; */
-
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-/* Be compatible with native compiler. */
-#undef PARM_BOUNDARY
-#define PARM_BOUNDARY 16
-
-/* cpp has to support a #sccs directive for the /usr/include files */
-
-#define SCCS_DIRECTIVE
-
-/* Make output for SDB. */
-
-#define SDB_DEBUGGING_INFO
-
-#undef REGISTER_PREFIX
-#define REGISTER_PREFIX "%"
-
-#undef LOCAL_LABEL_PREFIX
-#ifdef USE_GAS
-#define LOCAL_LABEL_PREFIX ".L"
-#else
-#define LOCAL_LABEL_PREFIX "L%"
-#endif
-
-#undef USER_LABEL_PREFIX
-
-#undef IMMEDIATE_PREFIX
-#define IMMEDIATE_PREFIX "&"
-
-#undef REGISTER_NAMES
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"}
-
-#undef FUNCTION_EXTRA_EPILOGUE
-#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
- { extern int current_function_returns_pointer; \
- if ((current_function_returns_pointer) && \
- ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
- asm_fprintf (FILE, "\tmov.l %Ra0,%Rd0\n"); }
-
-#undef FUNCTION_PROFILER
-#ifndef USE_GAS
-#define FUNCTION_PROFILER(FILE, LABEL_NO) \
- asm_fprintf (FILE, "\tmov.l %ILP%%%d,%Ra0\n\tjsr mcount%%\n", (LABEL_NO))
-#else /* USE_GAS */
-#define FUNCTION_PROFILER(FILE, LABEL_NO) \
- asm_fprintf (FILE, "\tmov.l %I%.LP%d,%Ra0\n\tjsr mcount%%\n", (LABEL_NO))
-#endif /* USE_GAS */
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#undef ASM_OUTPUT_REG_PUSH
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#undef ASM_OUTPUT_REG_POP
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO])
-
-#ifndef USE_GAS
-
-#undef ASM_APP_ON
-#define ASM_APP_ON ""
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF ""
-
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP "text"
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP "data"
-#undef ASCII_DATA_ASM_OP
-#define ASCII_DATA_ASM_OP "byte"
-
-#endif /* USE_GAS */
-
-#ifdef USE_GLD
-/* Support the ctors and dtors sections for g++. */
-
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\""
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-#endif /* defined (USE_GLD) */
-
-/* The file command should always begin the output. */
-
-#undef ASM_FILE_START
-#ifndef USE_GAS
-#define ASM_FILE_START(FILE) \
- output_file_directive ((FILE), main_input_filename)
-#else /* USE_GAS */
-#define ASM_FILE_START(FILE) \
- { \
- fprintf (FILE, "%s", ASM_APP_OFF); \
- output_file_directive ((FILE), main_input_filename); \
- }
-#endif /* USE_GAS */
-
-/* The sysV68 assembler does not accept dots in labels.
- Let's use percent instead */
-
-#define ASM_IDENTIFY_GCC(FILE) fputs("gcc2_compiled%:\n", FILE)
-
-/* Names to predefine in the preprocessor for this target machine. */
-/* ihnp4!lmayk!lgm@eddie.mit.edu says mc68000 and m68k should not be here,
- on the other hand I don't care what he says. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dm68k -Dunix -DsysV68 -D__motorola__ -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-
-#undef TARGET_VERSION
-#ifndef USE_GAS
-#define TARGET_VERSION fprintf (stderr, " (68k, SGS/AT&T sysV68 syntax)");
-#endif /* USE_GAS */
-
-/* This will return small structs in d0. */
-#define RETURN_IN_MEMORY(type) \
- ((TYPE_MODE (type) == BLKmode) \
- || (AGGREGATE_TYPE_P (type) \
- && GET_MODE_SIZE (TYPE_MODE (type)) > UNITS_PER_WORD))
-
-/* Don't default to pcc-struct-return, because we have already specified
- exactly how to return structures in the RETURN_IN_MEMORY macro. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* If TARGET_68881, return SF and DF values in fp0 instead of d0. */
-/* NYI: If FP=M68881U return SF and DF values in d0. */
-/* NYI: If -mold return pointer in a0 and d0 */
-
-#undef FUNCTION_VALUE
-/* sysV68 (brain damaged) cc convention support. */
-#define FUNCTION_VALUE(VALTYPE,FUNC) \
- (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
- : (POINTER_TYPE_P (VALTYPE) \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
- : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
-
-/* If TARGET_68881, SF and DF values are returned in fp0 instead of d0. */
-
-/* Is LIBCALL_VALUE never called with a pointer ? */
-#undef LIBCALL_VALUE
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, (MODE), \
- ((TARGET_68881 \
- && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
- ? 16 : 0))
-
-/* 1 if N is a possible register number for a function value.
- d0 may be used, and fp0 as well if -msoft-float is not specified. */
-
-#undef FUNCTION_VALUE_REGNO_P
-/* sysV68 (brain damaged) cc convention support. */
-#define FUNCTION_VALUE_REGNO_P(N) \
- ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
-
-/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
- more than one register. */
-
-#undef NEEDS_UNTYPED_CALL
-#define NEEDS_UNTYPED_CALL 1
-
-#ifndef USE_GAS
-/* This is the command to make the user-level label named NAME
- defined for reference from other files. */
-
-#undef GLOBAL_ASM_OP
-#define GLOBAL_ASM_OP "global"
-#endif /* USE_GAS */
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#undef ASM_FORMAT_PRIVATE_NAME
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
- sprintf ((OUTPUT), "%s_%%%d", (NAME), (LABELNO)))
-
-#ifdef USE_GAS
-#undef ASM_LONG
-#define ASM_LONG ".long"
-#undef ASM_SHORT
-#define ASM_SHORT ".short"
-#undef ASM_CHAR
-#define ASM_CHAR ".byte"
-#undef ASM_BYTE
-#define ASM_BYTE ".byte"
-#undef ASM_BYTE_OP
-#define ASM_BYTE_OP "\t.byte"
-#else
-#undef ASM_LONG
-#define ASM_LONG "long"
-#undef ASM_SHORT
-#define ASM_SHORT "short"
-#undef ASM_CHAR
-#define ASM_CHAR "byte"
-#undef ASM_BYTE
-#define ASM_BYTE "byte"
-#undef ASM_BYTE_OP
-#define ASM_BYTE_OP "\tbyte"
-#endif /* USE_GAS */
-
-/* The sysV68 as doesn't know about double's and float's. */
-/* This is how to output an assembler line defining a `double' constant. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf (FILE, "\t%s 0x%x,0x%x\n", ASM_LONG, l[0], l[1]); \
- } while (0)
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long l[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
- fprintf (FILE, "\t%s 0x%x,0x%x,0x%x\n", ASM_LONG, l[0], l[1], l[2]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- fprintf ((FILE), "\t%s 0x%x\n", ASM_LONG, l); \
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#undef ASM_OUTPUT_INT
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t%s ", ASM_LONG), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#undef ASM_OUTPUT_SHORT
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t%s ", ASM_SHORT), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#undef ASM_OUTPUT_CHAR
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t%s ", ASM_CHAR), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#undef ASM_OUTPUT_BYTE
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t%s 0x%x\n", ASM_BYTE, (VALUE))
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#ifndef USE_GAS
-#define ALIGN_ASM_OP "even"
-#else /* USE_GAS */
-#define ALIGN_ASM_OP ".even"
-#endif /* USE_GAS */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) == 1) \
- fprintf (FILE, "\t%s\n", ALIGN_ASM_OP); \
- else if ((LOG) != 0) \
- abort ();
-
-#ifndef USE_GAS
-#define SKIP_ASM_OP "space"
-#else /* USE_GAS */
-#define SKIP_ASM_OP ".skip"
-#endif /* USE_GAS */
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t%s %u\n", SKIP_ASM_OP, (SIZE))
-
-/* Can't use ASM_OUTPUT_SKIP in text section. */
-
-#define ASM_NO_SKIP_IN_TEXT 1
-
-/* The beginnings of sdb support... */
-
-/* Undefining these will allow `output_file_directive' (in toplev.c)
- to default to the right thing. */
-#undef ASM_OUTPUT_MAIN_SOURCE_FILENAME
-#ifndef USE_GAS
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
- do { fprintf (FILE, "\tfile\t"); \
- output_quoted_string (FILE, FILENAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
- fprintf (FILE, "\tln\t%d\n", \
- (sdb_begin_function_line \
- ? last_linenum - sdb_begin_function_line : 1))
-
-/* Yet another null terminated string format. */
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
- do { register int sp = 0, lp = 0; \
- fprintf ((FILE), "%s\t", ASM_BYTE_OP); \
- loop: \
- if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \
- { lp += 3; \
- fprintf ((FILE), "'%c", (PTR)[sp]); } \
- else \
- { lp += 5; \
- fprintf ((FILE), "0x%x", (PTR)[sp]); } \
- if (++sp < (LEN)) \
- { if (lp > 60) \
- { lp = 0; \
- fprintf ((FILE), "\n\t%s ", ASCII_DATA_ASM_OP); } \
- else \
- putc (',', (FILE)); \
- goto loop; } \
- putc ('\n', (FILE)); } while (0)
-#endif /* USE_GAS */
-
-#ifndef USE_GAS
-/* Output a float value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (r, l); \
- /* Use hex representation even if CODE is f. as needs it. */ \
- fprintf ((FILE), "&0x%lx", l); \
- } while (0)
-
-/* Output a double value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf ((FILE), "&0x%lx%08lx", l[0], l[1]); \
- } while (0)
-#endif /* USE_GAS */
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
- sprintf ((LABEL), "%s%s%d", LOCAL_LABEL_PREFIX, (PREFIX), (NUM))
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- asm_fprintf (FILE, "%L%s%d:\n", PREFIX, NUM)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* This is how to output an element of a case-vector that is absolute.
- (The 68000 does not use such vectors,
- but we must define this macro anyway.) */
-/* The L after the local prefix is the "L" prefix for the normal labels
- generated by gcc; why are ASM_OUTPUT_ADDR_VEC_ELT and
- ASM_OUTPUT_ADDR_DIFF_ELT not called with a PREFIX parameter, like
- ASM_OUTPUT_INTERNAL_LABEL ? */
-
-#undef ASM_OUTPUT_ADDR_VEC_ELT
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- asm_fprintf (FILE, "\t%s %LL%d\n", ASM_LONG, (VALUE))
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- asm_fprintf (FILE, "\t%s %LL%d-%LL%d\n", ASM_SHORT, (VALUE), (REL))
-
-#ifndef USE_GAS
-
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- asm_fprintf (FILE, "\tswbeg &%d\n%L%s%d:\n", \
- XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM))
-
-/* sysV68 as cannot handle LD%n(%pc,%reg) */
-#define SGS_NO_LI
-
-/* labelno is not used here */
-#define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
- asm_fprintf (file, "12(%Rpc,%s.", regname)
-
-#define ASM_RETURN_CASE_JUMP \
- do { \
- if (TARGET_5200) \
- return "ext%.l %0\n\tjmp 8(%%pc,%0.l)"; \
- else \
- return "jmp 8(%%pc,%0.w)"; \
- } while (0)
-
-#else /* USE_GAS */
-
-/* labelno is not used here */
-#define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
- asm_fprintf (file, "%Rpc@(6,%s:", regname)
-
-#define ASM_RETURN_CASE_JUMP return "jmp %%pc@(2,%0:w)"
-
-#endif /* USE_GAS */
-
-#ifndef USE_GAS
-
-/* Translate some opcodes to fit the sysV68 assembler syntax. */
-/* The opcodes fdmov and fsmov are guesses. */
-
-/* cliffm@netcom.com says no need for .w suffix on jumps. */
-#undef ASM_OUTPUT_OPCODE
-#define ASM_OUTPUT_OPCODE(FILE, PTR) \
-{ if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
- { ++(PTR); \
- while (*(PTR) != ' ') \
- { putc (*(PTR), (FILE)); ++(PTR); } \
- } \
- else if ((PTR)[0] == 's') \
- { \
- if (!strncmp ((PTR), "swap", 4)) \
- { fprintf ((FILE), "swap.w"); (PTR) += 4; } \
- } \
- else if ((PTR)[0] == 'f') \
- { \
- if (!strncmp ((PTR), "fmove", 5)) \
- { fprintf ((FILE), "fmov"); (PTR) += 5; } \
- else if (!strncmp ((PTR), "f%$move", 7)) \
- { if (TARGET_68040_ONLY) \
- { fprintf ((FILE), "fsmov"); (PTR) += 7; } \
- else \
- { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
- else if (!strncmp ((PTR), "f%&move", 7)) \
- { if (TARGET_68040_ONLY) \
- { fprintf ((FILE), "fdmov"); (PTR) += 7; } \
- else \
- { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
- else if (!strncmp ((PTR), "ftst", 4)) \
- { fprintf ((FILE), "ftest"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "fbne", 4)) \
- { fprintf ((FILE), "fbneq"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "fsne", 4)) \
- { fprintf ((FILE), "fsneq"); (PTR) += 4; } \
- } \
-/* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
- else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
- && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
- { fprintf ((FILE), "mov"); (PTR) += 4; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \
- || (PTR)[0] == 'c') (PTR)++; } \
-/* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
- else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
- && (PTR)[2] == 'b') \
- { fprintf ((FILE), "sub"); (PTR) += 3; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \
- || (PTR)[0] == 'a') (PTR)++; } \
-/* CMP, CMPA, CMPI, CMPM ==> CMP */ \
- else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
- && (PTR)[2] == 'p') \
- { fprintf ((FILE), "cmp"); (PTR) += 3; \
- if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \
- || (PTR)[0] == 'm') (PTR)++; } \
-}
-#endif /* USE_GAS */
-
-/* phdm@info.ucl.ac.be says to pass SIZE, not ROUNDED. */
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#undef ASM_OUTPUT_COMMON
-#ifndef USE_GAS
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\tcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE)))
-#else /* USE_GAS */
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE)))
-#endif /* USE_GAS */
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#undef ASM_OUTPUT_LOCAL
-#ifndef USE_GAS
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\tlcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE)))
-#else /* USE_GAS */
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE)))
-#endif /* USE_GAS */
-
-#ifndef USE_GAS
-/* Override usual definitions of SDB output macros.
- These definitions differ only in the absence of the period
- at the beginning of the name of the directive
- and in the use of `~' as the symbol for the current location. */
-
-#define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a))
-#define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a))
-#define PUT_SDB_VAL(a) \
-( fputs ("\tval\t", asm_out_file), \
- output_addr_const (asm_out_file, (a)), \
- fputc (';', asm_out_file))
-
-#define PUT_SDB_DEF(a) \
-do { fprintf (asm_out_file, "\tdef\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, ";"); } while (0)
-
-#define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a)
-#define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file)
-#define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a)
-#define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a)
-#define PUT_SDB_START_DIM fprintf(asm_out_file, "\tdim\t")
-#define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
-#define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d;", a)
-
-#define PUT_SDB_TAG(a) \
-do { fprintf (asm_out_file, "\ttag\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, ";"); } while (0)
-
-#define PUT_SDB_BLOCK_START(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_BLOCK_END(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_FUNCTION_START(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_FUNCTION_END(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_EPILOGUE_END(NAME) \
- fprintf (asm_out_file, \
- "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n", \
- (NAME))
-
-#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
- sprintf ((BUFFER), "~%dfake", (NUMBER));
-
-#endif /* USE_GAS */
-
-/* Define subroutines to call to handle multiply, divide, and remainder.
- Use the subroutines that the sysV68's library provides.
- The `*' prevents an underscore from being prepended by the compiler. */
-/* The '*' is also used by INIT_CUMULATIVE_ARGS */
-
-#define DIVSI3_LIBCALL "*ldiv%%"
-#define UDIVSI3_LIBCALL "*uldiv%%"
-#define MODSI3_LIBCALL "*lrem%%"
-#define UMODSI3_LIBCALL "*ulrem%%"
-#define MULSI3_LIBCALL "*lmul%%"
-
-struct sysV68_cumulative_args
- {
- int offset;
- int libcall;
- };
-
-#undef CUMULATIVE_ARGS
-#define CUMULATIVE_ARGS struct sysV68_cumulative_args
-
-#undef INIT_CUMULATIVE_ARGS
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
-do {(CUM).offset = 0;\
-(CUM).libcall = (LIBNAME) && (*XSTR((LIBNAME), 0) == '*');} while(0)
-
-#undef FUNCTION_ARG_ADVANCE
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM).offset += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-#undef FUNCTION_ARG
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-(((CUM).libcall && (CUM).offset == 0) ? gen_rtx(REG, (MODE), 0)\
-: (TARGET_REGPARM && (CUM).offset < 8) ? gen_rtx (REG, (MODE), (CUM).offset / 4) : 0)
-
-#undef FUNCTION_ARG_PARTIAL_NREGS
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
-((TARGET_REGPARM && (CUM).offset < 8 \
- && 8 < ((CUM).offset + ((MODE) == BLKmode \
- ? int_size_in_bytes (TYPE) \
- : GET_MODE_SIZE (MODE)))) \
- ? 2 - (CUM).offset / 4 : 0)
-
-#undef FUNCTION_ARG_REGNO_P
-#define FUNCTION_ARG_REGNO_P(N) (TARGET_68020 ? 0 : (N) == 0)
-
-/* manfred@lts.sel.alcatel.de: I believe that most delta machines are configured to have
- a 6888[12] FPU for which we need to link -lm881 instead of -lm; define ALT_LIBM to
- tell g++.c about that. */
-#define ALT_LIBM "-lm881"
-
-#if (TARGET_DEFAULT & MASK_68881) /* The default configuration has a 6888[12] FPU. */
-#define MATH_LIBRARY "-lm881"
-#endif
-
-/* Currently we do not have the atexit() function;
- * so take that from libgcc2.c
- */
-
-#define NEED_ATEXIT 1
-#define HAVE_ATEXIT 1
-
-#define EXIT_BODY \
- do \
- { extern void monitor (); \
- extern long mcount asm ("mcount%"); \
- extern long etext; \
- \
- if (&mcount < &etext) \
- monitor (0); \
- _cleanup (); \
- } while (0)
diff --git a/gcc/config/m68k/mot3300Mcrt0.S b/gcc/config/m68k/mot3300Mcrt0.S
deleted file mode 100644
index 52561e630d1..00000000000
--- a/gcc/config/m68k/mot3300Mcrt0.S
+++ /dev/null
@@ -1,155 +0,0 @@
-/* The start module mcrt0.s for the SysV68 Motorola 3300 Delta Series.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Manfred Hollstein (manfred@lts.sel.alcatel.de).
-
-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. */
-
-#ifdef MOTOROLA
-# define COMM comm
-# define DATA data
-# define EVEN even
-# define FILE(n) file n
-# define GLOBAL_SYM(s) global s
-# define LOCAL_LABEL(l) L%##l
-# define SECTION(n) section n
-# define TEXT text
-#else /* Assume we are using GNU as. */
-# define COMM .comm
-# define DATA .data
-# define EVEN .even
-# define FILE(name) .file name
-# define GLOBAL_SYM(s) .globl s
-# define LOCAL_LABEL(l) .L.##l
-# define SECTION(n) .section n
-# define STRING(s) .asciz s
-# define TEXT .text
-#endif
-
- FILE ("mcrt0.s")
- TEXT
- GLOBAL_SYM (_start)
-_start: mov.l %d0,splimit%
- subq.w &8,%sp
- mov.l 8(%sp),(%sp)
- lea 12(%sp),%a0
- mov.l %a0,___Argv
- mov.l %a0,4(%sp)
- mov.l %a0,%a1
-LOCAL_LABEL(0):
- tst.l (%a0)+
- bne.b LOCAL_LABEL(0)
-#ifdef SGS_CMP_ORDER
- cmpa.l %a0,(%a1)
-#else
- cmpa.l (%a1),%a0
-#endif
- blt.b LOCAL_LABEL(1)
- subq.w &4,%a0
-LOCAL_LABEL(1):
- mov.l %a0,8(%sp)
- mov.l %a0,environ
- jsr initfpu
-
- sub &8,%sp
- clr.l %d0 /* if (! isatty (fileno (stderr))) */
- mov.b _iob+27,%d0
- mov.l %d0,-(%sp)
- jsr isatty
- addq.w &4,%sp
- tst.l %d0
- bne.b LOCAL_LABEL(isatty)
- clr.l -(%sp) /* setbuf (stderr, NULL) */
- pea _iob+28
- jsr setbuf
- addq.w &8,%sp
-LOCAL_LABEL(isatty):
- addq.w &8,%sp
-
- mov.l &600,-(%sp)
- mov.l &etext,%d1
- subi.l &LOCAL_LABEL(endofstart),%d1
- addq.l &1,%d1
- bclr &0,%d1
- addi.l &4812,%d1
- asr.l &1,%d1
- mov.l %d1,-(%sp)
- add.l %d1,%d1
- mov.l %d1,-(%sp)
- jsr sbrk
- addq.w &4,%sp
-#ifdef SGS_CMP_ORDER
- cmpa.l %a0,&-1
-#else
- cmpa.l &-1,%a0
-#endif
- beq.b LOCAL_LABEL(3)
- mov.l %a0,-(%sp)
- add.l &12,%a0
- mov.l %a0,_countbase
- mov.l &etext,-(%sp)
- mov.l &LOCAL_LABEL(endofstart),-(%sp)
- jsr monitor
- lea 20(%sp),%sp
- jsr main
- mov.l %d0,(%sp)
- jsr exit
-_exit: moveq &1,%d0
- trap &0
-
- GLOBAL_SYM (mcount)
-
- EVEN
-mcount: bra mcount%
-
-LOCAL_LABEL(errtxt):
-#ifdef STRING
- STRING ("No space for monitor buffer\n")
-#else
- byte 'N,'o,' ,'s,'p,'a,'c,'e,' ,'f,'o,'r,' ,'m,'o,'n
- byte 'i,'t,'o,'r,' ,'b,'u,'f,'f,'e,'r,'\n,0
-#endif
-
- EVEN
-LOCAL_LABEL(3):
- mov.l &28,-(%sp)
- mov.l &LOCAL_LABEL(errtxt),-(%sp)
- moveq &2,%d0
- mov.l %d0,-(%sp)
- jsr write
- bra.b _exit
-LOCAL_LABEL(endofstart):
- nop
-
- EVEN
-
- COMM splimit%,4
- COMM environ,4
- COMM _countbase,4
-
-#ifdef STRING
- SECTION (.comment)
- STRING ("$Id: mcrt0.S,v 1.5 1995/12/07 17:23:39 manfred Exp $\n")
- STRING ("Contributed by manfred@lts.sel.alcatel.de (Manfred Hollstein, Germany)\n")
-#else
- byte 'C,'o,'n,'t,'r,'i,'b,'u,'t,'e,'d,' ,'b,'y
- byte ' ,'m,'a,'n,'f,'r,'e,'d,'@,'l,'t,'s,'.,'s
- byte 'e,'l,'.,'a,'l,'c,'a,'t,'e,'l,'.,'d,'e,'
- byte '(,'M,'a,'n,'f,'r,'e,'d,' ,'H,'o,'l,'l,'s
- byte 't,'e,'i,'n,',,' ,'G,'e,'r,'m,'a,'n,'y,')
- byte 10,0
-#endif
diff --git a/gcc/config/m68k/netbsd.h b/gcc/config/m68k/netbsd.h
deleted file mode 100644
index 0dbf380c76d..00000000000
--- a/gcc/config/m68k/netbsd.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <m68k/m68k.h>
-
-/* Get generic NetBSD definitions. */
-
-#include <netbsd.h>
-
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-
-/* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ -D__HAVE_FPU__} %{posix:-D_POSIX_SOURCE}"
-
-#undef ASM_SPEC
-#define ASM_SPEC " %| %{m68030} %{m68040} %{fpic:-k} %{fPIC:-k -K}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dunix -Dm68k -Dmc68000 -Dmc68020 -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(m68k) -Amachine(m68k)"
-
-/* Make gcc agree with <machine/ansi.h> */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Do not break .stabs pseudos into continuations. */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* This is the char to use for continuation (in case we need to turn
- continuation back on). */
-
-#define DBX_CONTIN_CHAR '?'
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/m68k/news.h b/gcc/config/m68k/news.h
deleted file mode 100644
index f83524cc0cf..00000000000
--- a/gcc/config/m68k/news.h
+++ /dev/null
@@ -1,552 +0,0 @@
-/* Definitions of target machine for GNU compiler. SONY NEWS-OS 4 version.
- Copyright (C) 1987, 89, 93, 94, 96, 1997 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. */
-
-#ifndef USE_GAS
-/* This controls conditionals in m68k.h. */
-#define MOTOROLA /* Use Motorola syntax rather than "MIT" */
-#define SGS_NO_LI /* Suppress jump table label usage */
-#endif
-
-#define NO_DOLLAR_IN_LABEL
-#define NO_DOT_IN_LABEL
-
-#include "m68k/m68k.h"
-
-/* See m68k.h. 7 means 68020 with 68881. */
-
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-
-/* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-/* These are the ones defined by Sony, plus mc68000 for uniformity with
- GCC on other 68000 systems. */
-
-#ifdef MOTOROLA
-#define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews700 -D__motorola__ -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-#else
-#define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews700 -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-#endif
-
-/* These conditionals tested for different submodels,
- but they were incorrect since they tested the host rather than the target.
- The choice of model shouldn't actually matter. */
-
-#if 0
-#ifdef news800
-#define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews800 -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#ifdef news900
-#define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews900 -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#ifdef news1500
-#define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1500 -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#ifdef news1700
-#define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1700 -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#ifdef news1800
-#define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1800 -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#ifdef news1900
-#define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1900 -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#endif
-
-/* Link with libg.a when debugging, for dbx's sake. */
-
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-#if 0
-/* This is to be compatible with types.h.
- It was found to be necessary with Newsos 3. */
-
-#define SIZE_TYPE "long int"
-#endif
-
-/* Override parts of m68k.h to fit Sony's assembler syntax. */
-
-#undef BIGGEST_ALIGNMENT
-#undef CALL_USED_REGISTERS
-#undef FUNCTION_VALUE
-#undef LIBCALL_VALUE
-#undef FUNCTION_PROFILER
-
-#ifdef MOTOROLA
-#undef FUNCTION_PROLOGUE
-#undef FUNCTION_EPILOGUE
-#undef REGISTER_NAMES
-#undef ASM_OUTPUT_REG_PUSH
-#undef ASM_OUTPUT_REG_POP
-#undef ASM_OUTPUT_DOUBLE
-#undef ASM_OUTPUT_SKIP
-#undef ASM_FORMAT_PRIVATE_NAME
-#endif
-
-#undef ASM_OUTPUT_ALIGN
-
-/* There is no point aligning anything to a rounder boundary than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* NEWS makes d2, d3, fp2 and fp3 unsaved registers, unlike the Sun system. */
-
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 0, 0, 0, 0, \
- 1, 1, 0, 0, 0, 0, 0, 1, \
- 1, 1, 1, 1, 0, 0, 0, 0}
-
-/* NEWS returns floats and doubles in fp0, not d0/d1. */
-
-#define FUNCTION_VALUE(VALTYPE,FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, (MODE), \
- ((TARGET_68881 \
- && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
- ? 16 : 0))
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf (FILE, "\t.align %d\n", (LOG))
-
-#ifdef MOTOROLA
-
-/* Don't try to define `gcc_compiled.' since the assembler does not
- accept symbols with periods. This is no real loss since GDB only
- really needs it for parms passed in registers. */
-#define ASM_IDENTIFY_GCC(FILE)
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int regno; \
- register int mask = 0; \
- extern char call_used_regs[]; \
- int fsize = ((SIZE) + 3) & -4; \
- if (frame_pointer_needed) \
- { if (fsize < 0x8000) \
- fprintf (FILE, "\tlink fp,#%d\n", -fsize); \
- else if (TARGET_68020) \
- fprintf (FILE, "\tlink.l fp,#%d\n", -fsize); \
- else \
- fprintf (FILE, "\tlink fp,#0\n\tsub.l #%d,sp\n", fsize);\
- } \
- else if (fsize) \
- { \
- int amt = fsize + 4; \
- /* Adding negative number is faster on the 68040. */ \
- if (fsize + 4 < 0x8000) \
- asm_fprintf (FILE, "\tadd.w %0I%d,%Rsp\n", - amt); \
- else \
- asm_fprintf (FILE, "\tadd.l %0I%d,%Rsp\n", - amt); \
- } \
- for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- mask |= 1 << (regno - 16); \
- if (mask != 0) \
- fprintf (FILE, "\tfmovem.x #0x%x,-(sp)\n", mask & 0xff); \
- mask = 0; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- mask |= 1 << (15 - regno); \
- if (frame_pointer_needed) \
- mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \
- if (exact_log2 (mask) >= 0) \
- fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[15 - exact_log2 (mask)]); \
- else if (mask) fprintf (FILE, "\tmovem.l #0x%x,-(sp)\n", mask); }
-
-#define FUNCTION_PROFILER(FILE, LABEL_NO) \
- fprintf (FILE, "\tmove.l #LP%d,d0\n\tjsr mcount\n", (LABEL_NO));
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ register int regno; \
- register int mask, fmask; \
- register int nregs; \
- int offset, foffset; \
- extern char call_used_regs[]; \
- int fsize = ((SIZE) + 3) & -4; \
- int big = 0; \
- nregs = 0; fmask = 0; \
- for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- { nregs++; fmask |= 1 << (23 - regno); } \
- foffset = nregs * 12; \
- nregs = 0; mask = 0; \
- if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- { nregs++; mask |= 1 << regno; } \
- offset = foffset + nregs * 4; \
- if (offset + fsize >= 0x8000 \
- && frame_pointer_needed \
- && (mask || fmask)) \
- { fprintf (FILE, "\tmove.l #%d,a0\n", -fsize); \
- fsize = 0, big = 1; } \
- if (exact_log2 (mask) >= 0) { \
- if (big) \
- fprintf (FILE, "\tmove.l (-%d,fp,a0.l),%s\n", \
- offset + fsize, reg_names[exact_log2 (mask)]); \
- else if (! frame_pointer_needed) \
- fprintf (FILE, "\tmove.l (sp)+,%s\n", \
- reg_names[exact_log2 (mask)]); \
- else \
- fprintf (FILE, "\tmove.l (-%d,fp),%s\n", \
- offset + fsize, reg_names[exact_log2 (mask)]); } \
- else if (mask) { \
- if (big) \
- fprintf (FILE, "\tmovem.l (-%d,fp,a0.l),#0x%x\n", \
- offset + fsize, mask); \
- else if (! frame_pointer_needed) \
- fprintf (FILE, "\tmovem.l (sp)+,#0x%x\n", mask); \
- else \
- fprintf (FILE, "\tmovem.l (-%d,fp),#0x%x\n", \
- offset + fsize, mask); } \
- if (fmask) { \
- if (big) \
- fprintf (FILE, "\tfmovem.x (-%d,fp,a0.l),#0x%x\n", \
- foffset + fsize, fmask); \
- else if (! frame_pointer_needed) \
- fprintf (FILE, "\tfmovem.x (sp)+,#0x%x\n", fmask); \
- else \
- fprintf (FILE, "\tfmovem.x (-%d,fp),#0x%x\n", \
- foffset + fsize, fmask); } \
- if (frame_pointer_needed) \
- fprintf (FILE, "\tunlk fp\n"); \
- else if (fsize) \
- { \
- if (fsize + 4 < 0x8000) \
- fprintf (FILE, "\tadd.w #%d,sp\n", fsize + 4); \
- else \
- fprintf (FILE, "\tadd.l #%d,sp\n", fsize + 4); \
- } \
- if (current_function_pops_args) \
- fprintf (FILE, "\trtd #%d\n", current_function_pops_args); \
- else fprintf (FILE, "\trts\n"); }
-
-/* Difference from m68k.h is in `fp' instead of `a6'. */
-
-#define REGISTER_NAMES \
-{"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
- "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp", \
- "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7"}
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmove.l (sp)+,%s\n", reg_names[REGNO])
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.double 0d%s\n", dstr); \
- } while (0)
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %u\n", (SIZE))
-
-#if 0
-/* The NEWS assembler in version 3.4 complains about fmove.d, but this
- macro proved not to work right. 3.4 is old, so forget about it. */
-#define ASM_OUTPUT_OPCODE(FILE, STRING) \
-{ \
- if (!strncmp (STRING, "fmove.d", 7) \
- && CONSTANT_P (operands[1])) \
- { \
- fprintf (FILE, "fmove.x"); \
- STRING += 7; \
- } \
-}
-#endif
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 13), \
- sprintf ((OUTPUT), "%s$$$%d", (NAME), (LABELNO)))
-
-/* Output a float value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { \
- if (CODE == 'f') \
- { \
- char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.9e", dstr); \
- if (REAL_VALUE_ISINF (VALUE) || REAL_VALUE_ISNAN (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "#0f-99e999"); \
- else \
- fprintf (FILE, "#0f99e999"); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- fprintf (FILE, "#0f-0.0"); \
- else \
- fprintf (FILE, "#0f%s", dstr); \
- } \
- else \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- fprintf (FILE, "#0x%lx", l); \
- } \
- } while (0)
-
-/* Output a double value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", dstr ); \
- if (REAL_VALUE_ISINF (VALUE) || REAL_VALUE_ISNAN (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "#0d-99e999"); \
- else \
- fprintf (FILE, "#0d99e999"); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- fprintf (FILE, "#0d-0.0"); \
- else \
- fprintf (FILE, "#0d%s", dstr); \
- } while (0)
-
-/* Note, long double immediate operands are not actually
- generated by m68k.md. */
-#undef ASM_OUTPUT_LONG_DOUBLE_OPERAND
-#define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
- asm_fprintf (FILE, "%I0r%s", dstr); \
- } while (0)
-
-#if 0
-#undef PRINT_OPERAND
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (CODE == '.') fprintf (FILE, "."); \
- else if (CODE == '#') fprintf (FILE, "#"); \
- else if (CODE == '-') fprintf (FILE, "-(sp)"); \
- else if (CODE == '+') fprintf (FILE, "(sp)+"); \
- else if (CODE == '@') fprintf (FILE, "(sp)"); \
- else if (CODE == '!') fprintf (FILE, "fpcr"); \
- else if (CODE == '$') {if (TARGET_68040_ONLY) fprintf (FILE, "s");} \
- else if (CODE == '&') {if (TARGET_68040_ONLY) fprintf (FILE, "d");} \
- else if (CODE == '/') \
- ; \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
- { REAL_VALUE_TYPE r; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- if (CODE == 'f') \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (r, "%.9e", dstr); \
- if (REAL_VALUE_ISINF (r) || REAL_VALUE_ISNAN (r)) { \
- if (REAL_VALUE_NEGATIVE (r)) \
- fprintf (FILE, "#0f-99e999"); \
- else \
- fprintf (FILE, "#0f99e999"); } \
- else if (REAL_VALUE_MINUS_ZERO (r)) \
- fprintf (FILE, "#0f-0.0"); \
- else \
- fprintf (FILE, "#0f%s", dstr); \
- } \
- else \
- { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (r, l); \
- fprintf (FILE, "#0x%x", l); \
- }} \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode) \
- { REAL_VALUE_TYPE r; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- ASM_OUTPUT_LONG_DOUBLE_OPERAND (FILE, r); } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
- { REAL_VALUE_TYPE r; char dstr[30]; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- REAL_VALUE_TO_DECIMAL (r, "%.20e", dstr ); \
- if (REAL_VALUE_ISINF (r) || REAL_VALUE_ISNAN (r)) { \
- if (REAL_VALUE_NEGATIVE (r)) \
- fprintf (FILE, "#0d-99e999"); \
- else \
- fprintf (FILE, "#0d99e999"); } \
- else if (REAL_VALUE_MINUS_ZERO (r)) \
- fprintf (FILE, "#0d-0.0"); \
- else \
- fprintf (FILE, "#0d%s", dstr); } \
- else if (CODE == 'b') output_addr_const (FILE, X); \
- else { putc ('#', FILE); output_addr_const (FILE, X); }}
-#endif
-
-#undef PRINT_OPERAND_ADDRESS
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx reg1, reg2, breg, ireg; \
- register rtx addr = ADDR; \
- rtx offset; \
- switch (GET_CODE (addr)) \
- { \
- case REG: \
- fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
- break; \
- case PRE_DEC: \
- fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case POST_INC: \
- fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case PLUS: \
- reg1 = 0; reg2 = 0; \
- ireg = 0; breg = 0; \
- offset = 0; \
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
- { \
- offset = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
- { \
- offset = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) != PLUS) ; \
- else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == MULT) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == MULT) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
- || GET_CODE (addr) == SIGN_EXTEND) \
- { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
- if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
- if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
- || GET_CODE (reg1) == MULT)) \
- || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
- { breg = reg2; ireg = reg1; } \
- else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
- { breg = reg1; ireg = reg2; } \
- if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
- { int scale = 1; \
- if (GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "(L%d.b,pc,%s.w", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (XEXP (ireg, 0))]); \
- else \
- fprintf (FILE, "(L%d.b,pc,%s.l", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- putc (')', FILE); \
- break; } \
- if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "(L%d.b,pc,%s.l", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (breg)]); \
- putc (')', FILE); \
- break; } \
- if (ireg != 0 || breg != 0) \
- { int scale = 1; \
- if (breg == 0) \
- abort (); \
- if (addr && GET_CODE (addr) == LABEL_REF) abort (); \
- fprintf (FILE, "("); \
- if (addr != 0) { \
- output_addr_const (FILE, addr); \
- putc (',', FILE); } \
- fprintf (FILE, "%s", reg_names[REGNO (breg)]); \
- if (ireg != 0) \
- putc (',', FILE); \
- if (ireg != 0 && GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
- else if (ireg != 0) \
- fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- putc (')', FILE); \
- break; \
- } \
- else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "(L%d.b,pc,%s.l)", \
- CODE_LABEL_NUMBER (XEXP (addr, 0)), \
- reg_names[REGNO (reg1)]); \
- break; } \
- default: \
- if (GET_CODE (addr) == CONST_INT \
- && INTVAL (addr) < 0x8000 \
- && INTVAL (addr) >= -0x8000) \
- fprintf (FILE, "%d.w", INTVAL (addr)); \
- else \
- output_addr_const (FILE, addr); \
- }}
-
-#else /* Using GAS, which uses the MIT assembler syntax, like a Sun. */
-
-#define FUNCTION_PROFILER(FILE, LABEL_NO) \
- fprintf (FILE, "\tmovl #LP%d,d0\n\tjsr mcount\n", (LABEL_NO));
-
-#endif /* MOTOROLA */
diff --git a/gcc/config/m68k/news3.h b/gcc/config/m68k/news3.h
deleted file mode 100644
index b4a3f4100d1..00000000000
--- a/gcc/config/m68k/news3.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "m68k/news.h"
-
-/* This is to be compatible with types.h.
- It was found to be necessary with Newsos 3. */
-
-#define SIZE_TYPE "long int"
diff --git a/gcc/config/m68k/news3gas.h b/gcc/config/m68k/news3gas.h
deleted file mode 100644
index 7c2d2b0595f..00000000000
--- a/gcc/config/m68k/news3gas.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "m68k/newsgas.h"
-
-/* This is to be compatible with types.h.
- It was found to be necessary with Newsos 3. */
-
-#define SIZE_TYPE "long int"
diff --git a/gcc/config/m68k/newsgas.h b/gcc/config/m68k/newsgas.h
deleted file mode 100644
index 8dc7801ea60..00000000000
--- a/gcc/config/m68k/newsgas.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* In Sony versions before 3.0, use the GNU Assembler, because the
- system's assembler has no way to assemble the difference of two
- labels for the displacement in a switch-dispatch instruction. */
-
-#define USE_GAS
-
-/* This is the assembler directive to equate two values. */
-
-#undef SET_ASM_OP
-#define SET_ASM_OP ".set"
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#undef ASM_WEAKEN_LABEL
-#define ASM_WEAKEN_LABEL(FILE,NAME) \
- do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
- fputc ('\n', FILE); } while (0)
-
-#include "m68k/news.h"
diff --git a/gcc/config/m68k/next.h b/gcc/config/m68k/next.h
deleted file mode 100644
index 1c7c7fd1692..00000000000
--- a/gcc/config/m68k/next.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Target definitions for GNU compiler for mc680x0 running NeXTSTEP
- Copyright (C) 1989, 90, 91, 92, 93, 94, 1996 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. */
-
-#include "m68k/m68k.h"
-#include "nextstep.h"
-#include "machmode.h"
-#include "real.h"
-
-/* See m68k.h. 0407 means 68040 (or 68030 or 68020, with 68881/2). */
-
-#define TARGET_DEFAULT (MASK_68040_ALSO|MASK_BITFIELD|MASK_68881|MASK_68020)
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY 32
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__ -D__BIG_ENDIAN__ -D__ARCHITECTURE__=\"m68k\" -Asystem(unix) -Asystem(mach) -Acpu(m68k) -Amachine(m68k) -D_NEXT_SOURCE"
-
-/* Every structure or union's size must be a multiple of 2 bytes.
- (Why isn't this in m68k.h?) */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-/* This is how to output an assembler line defining a `double' constant. */
-
-#undef ASM_OUTPUT_DOUBLE
-#ifdef REAL_VALUE_TO_TARGET_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { \
- long hex[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex); \
- fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n", hex[0], hex[1]); \
- } while (0)
-#else
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "\t.double 0r-99e999\n"); \
- else \
- fprintf (FILE, "\t.double 0r99e999\n"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.double 0r%s\n", dstr); \
- } \
- } while (0)
-#endif
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#undef ASM_OUTPUT_FLOAT
-#ifdef REAL_VALUE_TO_TARGET_SINGLE
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { \
- long hex; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex); \
- fprintf (FILE, "\t.long 0x%x\n", hex); \
- } while (0)
-#else
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "\t.single 0r-99e999\n"); \
- else \
- fprintf (FILE, "\t.single 0r99e999\n"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.single 0r%s\n", dstr); \
- } \
- } while (0)
-#endif
-
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#ifdef REAL_VALUE_TO_TARGET_SINGLE
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { \
- long hex; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex); \
- fprintf (FILE, "#0%c%x", (CODE) == 'f' ? 'b' : 'x', hex); \
- } while (0)
-#else
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do{ \
- if (CODE != 'f') \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- asm_fprintf ((FILE), "%I0x%x", l); \
- else \
- asm_fprintf ((FILE), "%I0x%lx", l); \
- } \
- else if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "#0r-99e999"); \
- else \
- fprintf (FILE, "#0r99e999"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
- fprintf (FILE, "#0r%s", dstr); \
- } \
- } while (0)
-#endif
-
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#ifdef REAL_VALUE_TO_TARGET_DOUBLE
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { \
- long hex[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex); \
- fprintf (FILE, "#0b%x%08x", hex[0], hex[1]); \
- } while (0)
-#else
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "#0r-99e999"); \
- else \
- fprintf (FILE, "#0r99e999"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20g", dstr); \
- fprintf (FILE, "#0r%s", dstr); \
- } \
- } while (0)
-#endif
-
-/* We do not define JUMP_TABLES_IN_TEXT_SECTION, since we wish to keep
- the text section pure. There is no point in addressing the jump
- tables using pc relative addressing, since they are not in the text
- section, so we undefine CASE_VECTOR_PC_RELATIVE. This also
- causes the compiler to use absolute addresses in the jump table,
- so we redefine CASE_VECTOR_MODE to be SImode. */
-
-#undef CASE_VECTOR_MODE
-#define CASE_VECTOR_MODE SImode
-#undef CASE_VECTOR_PC_RELATIVE
-
-/* Make sure jump tables have the same alignment as other pointers. */
-
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
-{ ASM_OUTPUT_ALIGN (FILE, 1); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
-
-/* Don't treat addresses involving labels differently from symbol names.
- Previously, references to labels generated pc-relative addressing modes
- while references to symbol names generated absolute addressing modes. */
-
-#undef GO_IF_INDEXABLE_BASE(X, ADDR)
-#define GO_IF_INDEXABLE_BASE(X, ADDR) \
-{ if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; }
-
-/* This accounts for the return pc and saved fp on the m68k. */
-
-#define OBJC_FORWARDING_STACK_OFFSET 8
-#define OBJC_FORWARDING_MIN_OFFSET 8
-
-/* FINALIZE_TRAMPOLINE enables executable stack. The
- __enable_execute_stack also clears the insn cache. */
-
-#undef FINALIZE_TRAMPOLINE
-#define FINALIZE_TRAMPOLINE(TRAMP) \
- emit_library_call(gen_rtx(SYMBOL_REF, Pmode, "__enable_execute_stack"), \
- 0, VOIDmode, 1, memory_address(SImode, (TRAMP)), Pmode)
-
-/* A C expression used to clear the instruction cache from
- address BEG to address END. On NeXTSTEP this i a system trap. */
-
-#define CLEAR_INSN_CACHE(BEG, END) \
- asm volatile ("trap #2")
-
-/* GCC is the primary compiler for NeXTSTEP, so we don't need this. */
-#undef PCC_STATIC_STRUCT_RETURN
diff --git a/gcc/config/m68k/next21.h b/gcc/config/m68k/next21.h
deleted file mode 100644
index 5d18c4edbc3..00000000000
--- a/gcc/config/m68k/next21.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Target definitions for GNU compiler for mc680x0 running NeXTSTEP 2.1
- Copyright (C) 1989, 90, 91, 92, 93, 1994 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. */
-
-/* Changed for NeXTStep2.1, Ch. Kranz, 2/94, 3/94 */
-
-#include "m68k/next.h"
-#include "nextstep21.h"
-
-/* for #include <mach.h> in libgcc2.c */
-#define NeXTStep21
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "#0r-99e999"); \
- else \
- fprintf (FILE, "#0r99e999"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.double 0r%s\n", dstr); \
- } \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "\t.single 0r-99e999\n"); \
- else \
- fprintf (FILE, "\t.single 0r99e999\n"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.single 0r%s\n", dstr); \
- } \
- } while (0)
-
-/* called from m68k.c line 1881 */
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do{ \
- if (CODE != 'f') \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- asm_fprintf ((FILE), "%I0x%x", l); \
- else \
- asm_fprintf ((FILE), "%I0x%lx", l); \
- } \
- else if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "#0r-99e999"); \
- else \
- fprintf (FILE, "#0r99e999"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
- fprintf (FILE, "#0r%s", dstr); \
- } \
- } while (0)
-
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "#0r-99e999"); \
- else \
- fprintf (FILE, "#0r99e999"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20g", dstr); \
- fprintf (FILE, "#0r%s", dstr); \
- } \
- } while (0)
-
diff --git a/gcc/config/m68k/pbb.h b/gcc/config/m68k/pbb.h
deleted file mode 100644
index 41319c219af..00000000000
--- a/gcc/config/m68k/pbb.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Citicorp/TTI Unicom PBB version (using GAS with a %-register prefix)
- Copyright (C) 1987, 1988, 1990, 1996, 1997 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. */
-
-/* Note: This config uses a version of gas with a postprocessing stage that
- converts the output of gas to coff containing stab debug symbols.
- (See vasta@apollo.com or mb@soldev.tti.com) */
-
-#include "m68k/m68k.h"
-
-/* See m68k.h. 5 means 68020 without 68881. */
-
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68020)
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* Define __HAVE_68881__ in preprocessor if -m68881 is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dm68k -Dunix -DUnicomPBB -Dmc68k -Dmc68020 -Dmc68k32 -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
-
-/* We want DBX format for use with gdb under COFF. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Generate calls to memcpy, memcmp and memset. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* -m68000 requires special flags to the assembler. */
-
-#define ASM_SPEC \
- " %{m68000:-mc68010}%{mc68000:-mc68010}"
-
-/* we use /lib/libp/lib* when profiling */
-
-#define LIB_SPEC "%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc"
-
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-/*
- * The loader directive file gcc.ifile defines how to merge the constructor
- * sections into the data section. Also, since gas only puts out those
- * sections in response to N_SETT stabs, and does not (yet) have a
- * ".sections" directive, gcc.ifile also defines the list symbols
- * __DTOR_LIST__ and __CTOR_LIST__.
- *
- * Finally, we must explicitly specify the file from libgcc.a that defines
- * exit(), otherwise if the user specifies (for example) "-lc_s" on the
- * command line, the wrong exit() will be used and global destructors will
- * not get called .
- */
-
-#define STARTFILE_SPEC \
-"%{!r: gcc.ifile%s} %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} \
-%{!r:_exit.o%s}"
-
-#define ENDFILE_SPEC "crtn.o%s"
-
-/* cpp has to support a #sccs directive for the /usr/include files */
-
-#define SCCS_DIRECTIVE
-
-/* GAS register prefix assembly syntax: */
-
-/* User labels have no prefix */
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* local labels are prefixed with ".L" */
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
-/* registers are prefixed with "%" */
-#undef REGISTER_PREFIX
-#define REGISTER_PREFIX "%"
-
-#undef REGISTER_NAMES
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"}
-
-#undef FUNCTION_EXTRA_EPILOGUE
-#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
- { extern int current_function_returns_pointer; \
- if ((current_function_returns_pointer) && \
- ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
- asm_fprintf (FILE, "\tmovl %Rd0,%Ra0\n"); }
-
-#define ASM_RETURN_CASE_JUMP \
- do { \
- if (TARGET_5200) \
- return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
- else \
- return "jmp %%pc@(2,%0:w)"; \
- } while (0)
-
-/* Although the gas we use can create .ctor and .dtor sections from N_SETT
- stabs, it does not support section directives, so we need to have the loader
- define the lists.
- */
-#define CTOR_LISTS_DEFINED_EXTERNALLY
-
-/* similar to default, but allows for the table defined by ld with gcc.ifile.
- nptrs is always 0. So we need to instead check that __DTOR_LIST__[1] != 0.
- The old check is left in so that the same macro can be used if and when
- a future version of gas does support section directives. */
-
-#define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \
- if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0)) \
- for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++); \
- for (i = nptrs; i >= 1; i--) \
- __DTOR_LIST__[i] (); }
-
-/*
- * Here is an example gcc.ifile. I've tested it on PBB 68k and on sco 386
- * systems. The NEXT(0x200000) works on just about all 386 and m68k systems,
- * but can be reduced to any power of 2 that is >= NBPS (0x10000 on a pbb).
-
- SECTIONS {
- .text BIND(0x200200) BLOCK (0x200) :
- { *(.init) *(.text) vfork = fork; *(.fini) }
-
- GROUP BIND( NEXT(0x200000) + ADDR(.text) + SIZEOF(.text)):
- { .data : { __CTOR_LIST__ = . ; . += 4; *(.ctor) . += 4 ;
- __DTOR_LIST__ = . ; . += 4; *(.dtor) . += 4 ; }
- .bss : { }
- }
- }
- */
-
-/*
-Local variables:
-version-control: t
-End:
-*/
diff --git a/gcc/config/m68k/plexus.h b/gcc/config/m68k/plexus.h
deleted file mode 100644
index 3ca99fdb5bc..00000000000
--- a/gcc/config/m68k/plexus.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Definitions of target machine for GNU compiler, for 680X0 based Plexus
- Computers running SYSVR2
- Copyright (C) 1990, 1994, 1996 Free Software Foundation, Inc.
- Contributed by Randy Welch (rwelch@netcom.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 1, 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 Plexus port of gcc requires you to use gas ( either 1.3X with COFF
- patches or 2.X ), If you use gas 2.X you have to use binutils-2.X.
-
- With using gas-2.X the Plexus gcc port is now capable of generating
- output suitable for use by gdb-4.X ( send mail to above address for
- info on getting gdb patches or other GNU items for the Plexus )
-
- This is configured for label output default by gas as LXXX instead of
- plexus cc/as combination requires .LXXX */
-
-#include "m68k/m68k.h"
-
-/* Define __HAVE_68881 in preprocessor only if -m68881 is specified.
- This will control the use of inline 68881 insns in certain macros. */
-
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68020)
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-#define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
-#define CPP_PREDEFINES "-Dm68 -Dunix -Dplexus -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
-
-#if TARGET_DEFAULT & MASK_68020
-#define ASM_SPEC\
-"%{m68000:-mc68000}%{mc68000:-mc68000}%{!mc68000:%{!m68000:-mc68020}}"
-#undef STRICT_ALIGNMENT
-#define STRICT_ALIGNMENT 0
-#else
-#define ASM_SPEC\
-"%{m68020:-mc68020}%{mc68020:-mc68020}%{!mc68020:%{!mc68020:-mc68000}}"
-#endif
-
-/***************************************************************************/
-/* Un comment the following if you want adb to be able to follow a core */
-/* file if you compile a program with -O */
-/***************************************************************************/
-/* #define FRAME_POINTER_REQUIRED */
-
-/* Let's be compatible with the Plexus C compiler by default. Why not? */
-#define PLEXUS_CC_COMPAT
-
-#ifdef PLEXUS_CC_COMPAT
-#define STRUCTURE_SIZE_BOUNDARY 16 /* for compatibility with cc */
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY 32 /* ditto */
-#endif
-
-#undef NEED_PROBE
-#define NEED_PROBE -132 /* plexus needs a stack probe */
-
-/***********************************************************************/
-/* if you have binutils-2.X and gas-2.X running you can generate code */
-/* that gdb can understand ( gdb support available for 4.11 ) */
-/* */
-/* If you use gas-1.3X don't define this as the version of the coff */
-/* patches for gas-1.3x ( stabs in coff ) does not generate coff debug */
-/* syms */
-/***********************************************************************/
-#define HAVE_GAS_2_X
-
-#ifdef HAVE_GAS_2_X
-#undef DBX_DEBUGGING_INFO
-#define SDB_DEBUGGING_INFO
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- output_file_directive((FILE), main_input_filename)
-
-#else
-#undef DBX_DEBUGGING_INFO /* no real debugger */
-#undef SDB_DEBUGGING_INFO
-#endif
-#define TARGET_MEM_FUNCTIONS
-
-/***********************************************************************/
-/* items for collect2 */
-/***********************************************************************/
-
-#define NM_FLAGS ""
-#define NO_SYS_SIGLIST
-#define NO_DUP2
-
-#define SIZE_TYPE "int"
diff --git a/gcc/config/m68k/rtems.h b/gcc/config/m68k/rtems.h
deleted file mode 100644
index 99f4505fcf8..00000000000
--- a/gcc/config/m68k/rtems.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Definitions for rtems targetting an Intel m68k using coff.
-
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Joel Sherrill (joel@OARcorp.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 "m68k/m68k-coff.h"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmc68000 -Drtems -D__rtems__ \
- -Asystem(rtems) -Acpu(mc68000) -Acpu(m68k) -Amachine(m68k)"
-
-/* end of m68k-rtems.h */
diff --git a/gcc/config/m68k/sgs.h b/gcc/config/m68k/sgs.h
deleted file mode 100644
index 447ca6ec5cc..00000000000
--- a/gcc/config/m68k/sgs.h
+++ /dev/null
@@ -1,446 +0,0 @@
-/* Definitions of target machine for GNU compiler for m68k targets using
- assemblers derived from AT&T "SGS" releases.
- Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
- Written by Fred Fish (fnf@cygnus.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 1, 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. */
-
-/* Control assembler-syntax conditionals in m68k.md and conditionals in
- m68k.h. Note that some systems may also require SGS_SWAP_W and/or
- SGS_SWITCH_TABLES to be defined as well. */
-
-#define MOTOROLA /* Use Motorola syntax rather than "MIT" */
-#define SGS /* Uses SGS assembler */
-#define SGS_CMP_ORDER /* Takes cmp operands in reverse order */
-
-#include "m68k/m68k.h"
-
-/* SGS specific assembler pseudo ops. */
-
-#define BYTE_ASM_OP ".byte"
-#define WORD_ASM_OP ".short"
-#define LONG_ASM_OP ".long"
-#define SPACE_ASM_OP ".space"
-#define ALIGN_ASM_OP ".align"
-#undef GLOBAL_ASM_OP
-#define GLOBAL_ASM_OP ".global"
-#define SWBEG_ASM_OP ".swbeg"
-#define SET_ASM_OP ".set"
-
-#define UNALIGNED_SHORT_ASM_OP ".short" /* Used in dwarfout.c */
-#define UNALIGNED_INT_ASM_OP ".long" /* Used in dwarfout.c */
-
-#define ASM_PN_FORMAT "%s_%d" /* Format for private names */
-
-/* Here are four prefixes that are used by asm_fprintf to
- facilitate customization for alternate assembler syntaxes.
- Machines with no likelihood of an alternate syntax need not
- define these and need not use asm_fprintf. */
-
-/* The prefix for register names. Note that REGISTER_NAMES
- is supposed to include this prefix. Also note that this is NOT an
- fprintf format string, it is a literal string */
-
-#undef REGISTER_PREFIX
-#define REGISTER_PREFIX "%"
-
-/* The prefix for local (compiler generated) labels.
- These labels will not appear in the symbol table. */
-
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* The prefix for immediate operands. */
-
-#undef IMMEDIATE_PREFIX
-#define IMMEDIATE_PREFIX "&"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number.
- Motorola format uses different register names than defined in m68k.h.
- We also take this chance to convert 'a6' to 'fp' */
-
-#undef REGISTER_NAMES
-
-#ifndef SUPPORT_SUN_FPA
-
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" }
-
-#else /* SUPPORTED_SUN_FPA */
-
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", \
- "%fpa0", "%fpa1", "%fpa2", "%fpa3", "%fpa4", "%fpa5", "%fpa6","%fpa7", \
- "%fpa8", "%fpa9", "%fpa10","%fpa11","%fpa12","%fpa13","%fpa14","%fpa15", \
- "%fpa16","%fpa17","%fpa18","%fpa19","%fpa20","%fpa21","%fpa22","%fpa23", \
- "%fpa24","%fpa25","%fpa26","%fpa27","%fpa28","%fpa29","%fpa30","%fpa31" }
-
-#endif /* defined SUPPORT_SUN_FPA */
-
-/* When using an SGS assembler, modify the name of the artificial label which
- identifies this file as having been compiled with gcc, and the macro that
- emits such a label in the assembly output, to use '%' rather than '.' */
-
-#define ASM_IDENTIFY_GCC(FILE) \
- { fprintf ((FILE), "%s:\n", "gcc2_compiled%"); }
-
-/* This is how to output an assembler line defining an `int' constant. */
-/* The SGS assembler doesn't understand ".word". */
-
-#undef ASM_OUTPUT_SHORT
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf ((FILE), "\t%s ", WORD_ASM_OP), \
- output_addr_const ((FILE), (VALUE)), \
- fprintf ((FILE), "\n"))
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long l[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
- fprintf ((FILE), "\t%s 0x%x,0x%x,0x%x\n", LONG_ASM_OP, \
- l[0], l[1], l[2]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf ((FILE), "\t%s 0x%x,0x%x\n", LONG_ASM_OP, \
- l[0], l[1]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- fprintf ((FILE), "\t%s 0x%x\n", LONG_ASM_OP, l); \
- } while (0)
-
-/* This is how to output an assembler line that says to advance the
- location counter to a multiple of 2**LOG bytes. */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) > 0) \
- fprintf ((FILE), "\t%s \t%u\n", ALIGN_ASM_OP, 1 << (LOG)); \
- else if ((LOG) > 31) \
- abort ();
-
-/* The routine used to output null terminated string literals. We cannot
- use the ".string" pseudo op, because it silently truncates strings to
- 1023 bytes. There is no "partial string op" which works like ".string"
- but doesn't append a null byte, so we can't chop the input string up
- into small pieces and use that. Our only remaining alternative is to
- output the string one byte at a time. */
-
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- register int sp = 0, lp = 0, ch; \
- fprintf ((FILE), "\t%s ", BYTE_ASM_OP); \
- do { \
- ch = (PTR)[sp]; \
- if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \
- { \
- fprintf ((FILE), "'%c", ch); \
- } \
- else \
- { \
- fprintf ((FILE), "0x%x", ch); \
- } \
- if (++sp < (LEN)) \
- { \
- if ((sp % 10) == 0) \
- { \
- fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP); \
- } \
- else \
- { \
- putc (',', (FILE)); \
- } \
- } \
- } while (sp < (LEN)); \
- putc ('\n', (FILE)); \
-} while (0)
-
-
-/* SGS based assemblers don't understand #NO_APP and #APP, so just don't
- bother emitting them. */
-
-#undef ASM_APP_ON
-#define ASM_APP_ON ""
-
-#undef ASM_APP_OFF
-#define ASM_APP_OFF ""
-
-/* When using SGS derived assemblers, change the "MIT" or "MOTOROLA"
- to "SGS/AT&T" */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (68k, SGS/AT&T syntax)");
-
-/* Use proper assembler syntax for these macros. */
-#undef ASM_OUTPUT_REG_PUSH
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- asm_fprintf (FILE, "\t%Omove.l %s,-(%Rsp)\n", reg_names[REGNO])
-
-#undef ASM_OUTPUT_REG_POP
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- asm_fprintf (FILE, "\t%Omove.l (%Rsp)+,%s\n", reg_names[REGNO])
-
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- asm_fprintf ((FILE), "%I0x%x", l); \
- } while (0)
-
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- asm_fprintf ((FILE), "%I0x%x%08x", l[0], l[1]); \
- } while (0)
-
-/* How to output a block of SIZE zero bytes. Note that the `space' pseudo,
- when used in the text segment, causes SGS assemblers to output nop insns
- rather than 0s, so we set ASM_NO_SKIP_IN_TEXT to prevent this. */
-
-#define ASM_NO_SKIP_IN_TEXT 1
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t%s %u\n", SPACE_ASM_OP, (SIZE))
-
-/* Translate Motorola opcodes such as `jbeq' into SGS opcodes such
- as `beq.w'.
- Delete the `e' in `move...' and `fmove'.
- Change `ftst' to `ftest'.
- Change `fbne' to `fbneq'
- Change `fsne' to `fsneq'
- Change `divsl' to `tdivs' (32/32 -> 32r:32q)
- Change `divul' to `tdivu' (32/32 -> 32r:32q)
- Optionally change swap to swap.w.
- */
-
-#ifdef SGS_SWAP_W
-#define ASM_OUTPUT_OPCODE(FILE, PTR) \
-{ \
- extern int flag_pic; \
- if (!strncmp ((PTR), "jbsr", 4)) \
- { if (flag_pic) \
- fprintf ((FILE), "bsr"); \
- else \
- fprintf ((FILE), "jsr"); \
- (PTR) += 4; } \
- else if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
- { ++(PTR); \
- while (*(PTR) != ' ') \
- { putc (*(PTR), (FILE)); ++(PTR); } \
- fprintf ((FILE), ".w"); } \
- else if ((PTR)[0] == 's') \
- { \
- if (!strncmp ((PTR), "swap", 4)) \
- { fprintf ((FILE), "swap.w"); (PTR) += 4; } \
- } \
-/* FMOVE ==> FMOV, (and F%& F%$ translations) */ \
- else if ((PTR)[0] == 'f') \
- { \
- if (!strncmp ((PTR), "fmove", 5)) \
- { fprintf ((FILE), "fmov"); (PTR) += 5; } \
- else if (!strncmp ((PTR), "ftst", 4)) \
- { fprintf ((FILE), "ftest"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "fbne", 4)) \
- { fprintf ((FILE), "fbneq"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "fsne", 4)) \
- { fprintf ((FILE), "fsneq"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "f%$move", 7)) \
- { (PTR) += 7; \
- if (TARGET_68040_ONLY) \
- fprintf ((FILE), "fsmov"); \
- else fprintf ((FILE), "fmov"); } \
- else if (!strncmp ((PTR), "f%&move", 7)) \
- { (PTR) += 7; \
- if (TARGET_68040_ONLY) \
- fprintf ((FILE), "fdmov"); \
- else fprintf ((FILE), "fmov"); } \
- } \
-/* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
- else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
- && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
- { fprintf ((FILE), "mov"); (PTR) += 4; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \
- || (PTR)[0] == 'c') (PTR)++; } \
-/* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
- else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
- && (PTR)[2] == 'b') \
- { fprintf ((FILE), "sub"); (PTR) += 3; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \
- || (PTR)[0] == 'a') (PTR)++; } \
-/* CMP, CMPA, CMPI, CMPM ==> CMP */ \
- else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
- && (PTR)[2] == 'p') \
- { fprintf ((FILE), "cmp"); (PTR) += 3; \
- if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \
- || (PTR)[0] == 'm') (PTR)++; } \
-/* DIVSL ==> TDIVS */ \
- else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \
- && (PTR)[2] == 'v' && (PTR)[3] == 's' \
- && (PTR)[4] == 'l') \
- { fprintf ((FILE), "tdivs"); (PTR) += 5; } \
-/* DIVUL ==> TDIVU */ \
- else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \
- && (PTR)[2] == 'v' && (PTR)[3] == 'u' \
- && (PTR)[4] == 'l') \
- { fprintf ((FILE), "tdivu"); (PTR) += 5; } \
-}
-
-#else /* not SGS_SWAP_W */
-
-#define ASM_OUTPUT_OPCODE(FILE, PTR) \
-{ \
- extern int flag_pic; \
- if (!strncmp ((PTR), "jbsr", 4)) \
- { if (flag_pic) \
- fprintf ((FILE), "bsr"); \
- else \
- fprintf ((FILE), "jsr"); \
- (PTR) += 4; } \
- else if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
- { ++(PTR); \
- while (*(PTR) != ' ') \
- { putc (*(PTR), (FILE)); ++(PTR); } \
- fprintf ((FILE), ".w"); } \
-/* FMOVE ==> FMOV, (and F%& F%$ translations) */ \
- else if ((PTR)[0] == 'f') \
- { \
- if (!strncmp ((PTR), "fmove", 5)) \
- { fprintf ((FILE), "fmov"); (PTR) += 5; } \
- else if (!strncmp ((PTR), "ftst", 4)) \
- { fprintf ((FILE), "ftest"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "fbne", 4)) \
- { fprintf ((FILE), "fbneq"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "fsne", 4)) \
- { fprintf ((FILE), "fsneq"); (PTR) += 4; } \
- else if (!strncmp ((PTR), "f%$move", 7)) \
- { (PTR) += 7; \
- if (TARGET_68040_ONLY) \
- fprintf ((FILE), "fsmov"); \
- else fprintf ((FILE), "fmov"); } \
- else if (!strncmp ((PTR), "f%&move", 7)) \
- { (PTR) += 7; \
- if (TARGET_68040_ONLY) \
- fprintf ((FILE), "fdmov"); \
- else fprintf ((FILE), "fmov"); } \
- } \
-/* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
- else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
- && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
- { fprintf ((FILE), "mov"); (PTR) += 4; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \
- || (PTR)[0] == 'c') (PTR)++; } \
-/* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
- else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
- && (PTR)[2] == 'b') \
- { fprintf ((FILE), "sub"); (PTR) += 3; \
- if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \
- || (PTR)[0] == 'a') (PTR)++; } \
-/* CMP, CMPA, CMPI, CMPM ==> CMP */ \
- else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
- && (PTR)[2] == 'p') \
- { fprintf ((FILE), "cmp"); (PTR) += 3; \
- if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \
- || (PTR)[0] == 'm') (PTR)++; } \
-/* DIVSL ==> TDIVS */ \
- else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \
- && (PTR)[2] == 'v' && (PTR)[3] == 's' \
- && (PTR)[4] == 'l') \
- { fprintf ((FILE), "tdivs"); (PTR) += 5; } \
-/* DIVUL ==> TDIVU */ \
- else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \
- && (PTR)[2] == 'v' && (PTR)[3] == 'u' \
- && (PTR)[4] == 'l') \
- { fprintf ((FILE), "tdivu"); (PTR) += 5; } \
-}
-
-#endif /* not SGS_SWAP_W */
-
-/* This macro outputs the label at the start of a switch table. The
- ".swbeg <N>" is an assembler directive that causes the switch table
- size to be inserted into the object code so that disassemblers, for
- example, can identify that it is the start of a switch table. */
-
-#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- fprintf ((FILE), "\t%s &%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1));
-
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- do { \
- ASM_OUTPUT_BEFORE_CASE_LABEL((FILE),(PREFIX),(NUM),(TABLE)); \
- ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \
- } while (0)
-
-/* At end of a switch table, define LDnnn iff the symbol LInnn was defined.
- Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)"
- fails to assemble. Luckily "LDnnn(pc,d0.l*2)" produces the results
- we want. This difference can be accommodated by making the assembler
- define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other
- string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END
- macro. */
-
-#undef ASM_OUTPUT_CASE_END
-#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
-{ if (switch_table_difference_label_flag) \
- asm_fprintf (FILE, "\t%s %LLD%d,%LL%d-%LLI%d-2.b\n",\
- SET_ASM_OP, (NUM), (NUM), (NUM)); \
- switch_table_difference_label_flag = 0; }
-
-extern int switch_table_difference_label_flag;
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- asm_fprintf (FILE, "\t%s %LL%d-%LL%d\n", WORD_ASM_OP, VALUE, REL)
-
-/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
- keep switch tables in the text section. */
-
-#define JUMP_TABLES_IN_TEXT_SECTION 1
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#undef ASM_FORMAT_PRIVATE_NAME
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), ASM_PN_FORMAT, (NAME), (LABELNO)))
-
diff --git a/gcc/config/m68k/sun2.h b/gcc/config/m68k/sun2.h
deleted file mode 100644
index 679e57a8fbb..00000000000
--- a/gcc/config/m68k/sun2.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Definitions of target machine for GNU compiler. Sun 68010 version.
- Copyright (C) 1987, 1988, 1995 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. */
-
-
-#include "m68k/m68k.h"
-
-/* See m68k.h. 0 means 68000 with no 68881. */
-
-#define TARGET_DEFAULT 0
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Define __HAVE_68881 in preprocessor only if -m68881 is specified.
- This will control the use of inline 68881 insns in certain macros.
- Also inform the program which CPU this is for. */
-
-#define CPP_SPEC "%{m68881:-D__HAVE_68881__} \
-%{!ansi:%{m68020:-Dmc68020}%{mc68020:-Dmc68020}%{!mc68020:%{!m68020:-Dmc68010}}}"
-
-/* -m68020 requires special flags to the assembler. */
-
-#define ASM_SPEC \
- "%{m68020:-mc68020}%{mc68020:-mc68020}%{!mc68020:%{!m68020:-mc68010}} \
- %{fpic:-k} %{fPIC:-k} %{R} %{j} %{J} %{h} %{d2} %{keep-local-as-symbols:-L}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-
-/* Prevent error on `-sun2' and `-target sun2' options. */
-
-#define CC1_SPEC "%{sun2:} %{target:}"
-
-/* These compiler options take an argument. We ignore -target for now. */
-
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
- || !strcmp (STR, "target") || !strcmp (STR, "assert"))
-
-/* Specify what to link with. */
-
-/* Link with libg.a when debugging, for dbx's sake. */
-/* Include the support for -a when appropriate. */
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
-%{a:/usr/lib/bb_link.o -lc} "
-
-/* Alignment of field after `int : 0' in a structure. */
-
-#undef EMPTY_FIELD_BOUNDARY
-#define EMPTY_FIELD_BOUNDARY 16
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
diff --git a/gcc/config/m68k/sun2o4.h b/gcc/config/m68k/sun2o4.h
deleted file mode 100644
index 6f1ae7a7a6c..00000000000
--- a/gcc/config/m68k/sun2o4.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* Definitions of target machine for GNU compiler. Sun 2 running Sunos 4.
- Copyright (C) 1987, 1988, 1993, 1996 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. */
-
-#include "m68k/sun2.h"
-
-
-/* Define __HAVE_SKY__ in preprocessor, according to the -m flags.
- Also inform the program which CPU this is for. */
-
-#undef CPP_SPEC
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-#undef SIZE_TYPE
-#define SIZE_TYPE "int"
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 16
-
-#if TARGET_DEFAULT & MASK_SKY
-
-/* -msky is the default */
-#define CPP_SPEC \
-"%{!msoft-float:-D__HAVE_SKY__}\
-%{!ansi:%{m68020:-Dmc68020}%{mc68020:-Dmc68020}%{!mc68020:%{!m68020:-Dmc68010}}}"
-
-#else
-
-/* -msoft-float is the default */
-#define CPP_SPEC \
-"%{msky:-D__HAVE_SKY__ }\
-%{!ansi:%{m68020:-Dmc68020}%{mc68020:-Dmc68020}%{!mc68020:%{!m68020:-Dmc68010}}}"
-
-#endif
-
-/* STARTFILE_SPEC to include sun floating point initialization
- This is necessary (tr: Sun does it) for the sky routines.
- I'm not sure what would happen below if people gave contradictory
- arguments (eg. -msoft-float -mfpa) */
-
-#undef STARTFILE_SPEC
-
-#if TARGET_DEFAULT & MASK_SKY
-/* -msky is the default */
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
- %{msoft-float:Fcrt1.o%s} \
- %{!msoft-float:Scrt1.o%s}"
-#else
-/* -msoft-float is the default */
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
- %{msky:Scrt1.o%s} \
- %{!msky:Fcrt1.o%s}"
-#endif
-
-/* Specify library to handle `-a' basic block profiling.
- Control choice of libm.a (if user says -lm)
- based on fp arith default and options. */
-
-#undef LIB_SPEC
-
-#if TARGET_DEFAULT & MASK_SKY
-/* -msky is the default */
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
-%{a:/usr/lib/bb_link.o -lc} %{g:-lg} \
-%{msoft-float:-L/usr/lib/fsoft} \
-%{!msoft_float:-L/usr/lib/fsky}"
-#else
-/* -msoft-float is the default */
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
-%{a:/usr/lib/bb_link.o -lc} %{g:-lg} \
-%{!msky:-L/usr/lib/fsoft} \
-%{msky:-L/usr/lib/ffpa}"
-#endif
-
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic}"
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "\t.double 0r-99e999\n"); \
- else \
- fprintf (FILE, "\t.double 0r99e999\n"); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- fprintf (FILE, "\t.long 0x80000000,0\n"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.double 0r%s\n", dstr); \
- } \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "\t.single 0r-99e999\n"); \
- else \
- fprintf (FILE, "\t.single 0r99e999\n"); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- fprintf (FILE, "\t.long 0x80000000\n"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.single 0r%s\n", dstr); \
- } \
- } while (0)
-
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { \
- if (CODE != 'f') \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- asm_fprintf ((FILE), "%I0x%x", l); \
- else \
- asm_fprintf ((FILE), "%I0x%lx", l); \
- } \
- else if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "#0r-99e999"); \
- else \
- fprintf (FILE, "#0r99e999"); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- fprintf (FILE, "#0r-0.0"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
- fprintf (FILE, "#0r%s", dstr); \
- } \
- } while (0)
-
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "#0r-99e999"); \
- else \
- fprintf (FILE, "#0r99e999"); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- fprintf (FILE, "#0r-0.0"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20g", dstr); \
- fprintf (FILE, "#0r%s", dstr); \
- } \
- } while (0)
diff --git a/gcc/config/m68k/sun3.h b/gcc/config/m68k/sun3.h
deleted file mode 100644
index 13e927ede4d..00000000000
--- a/gcc/config/m68k/sun3.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/* Definitions of target machine for GNU compiler. Sun 68000/68020 version.
- Copyright (C) 1987, 1988, 1993, 1995, 1996 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 comment is here to see if it will keep Sun's cpp from dying. */
-
-/* If you do not need to generate floating point code for the optional
- Sun FPA board, you can safely comment out the SUPPORT_SUN_FPA define
- to gain a little speed and code size. */
-
-#define SUPPORT_SUN_FPA
-
-#include "m68k/m68k.h"
-
-/* See m68k.h. 7 means 68020 with 68881. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
-#endif
-
-/* Define __HAVE_FPA__ or __HAVE_68881__ in preprocessor,
- according to the -m flags.
- This will control the use of inline 68881 insns in certain macros.
- Also inform the program which CPU this is for. */
-
-#if TARGET_DEFAULT & MASK_68881
-
-/* -m68881 is the default */
-#define CPP_SPEC \
-"%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}\
-%{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
-%{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
-
-#else
-
-/* -msoft-float is the default */
-#define CPP_SPEC \
-"%{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }\
-%{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
-%{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
-
-#endif
-
-/* Prevent error on `-sun3' and `-target sun3' options. */
-
-#define CC1_SPEC "%{sun3:} %{target:}"
-
-#define PTRDIFF_TYPE "int"
-
-/* We must override m68k.h. */
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE "short unsigned int"
-#define WCHAR_TYPE_SIZE 16
-
-/* These compiler options take an argument. We ignore -target for now. */
-
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
- || !strcmp (STR, "target") || !strcmp (STR, "assert"))
-
-/* -m68000 requires special flags to the assembler. */
-
-#define ASM_SPEC \
- "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}} \
- %{fpic:-k} %{fPIC:-k} %{R} %{j} %{J} %{h} %{d2} %{keep-local-as-symbols:-L}"
-
-/* Names to predefine in the preprocessor for this target machine. */
-/* For a while, -D_CROSS_TARGET_ARCH=SUN3 was included here,
- but it doesn't work, partly because SUN3 etc. aren't defined
- (and shouldn't be). It seems that on a native compiler _CROSS_TARGET_ARCH
- should not be defined. For cross compilers, let's do things as we
- normally do in GCC. -- rms. */
-
-#define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix -Asystem(unix) -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
-
-/* STARTFILE_SPEC to include sun floating point initialization
- This is necessary (tr: Sun does it) for both the m68881 and the fpa
- routines.
- Note that includes knowledge of the default specs for gcc, ie. no
- args translates to the same effect as -m68881
- I'm not sure what would happen below if people gave contradictory
- arguments (eg. -msoft-float -mfpa) */
-
-#if TARGET_DEFAULT & MASK_FPA
-/* -mfpa is the default */
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
- %{m68881:Mcrt1.o%s} \
- %{msoft-float:Fcrt1.o%s} \
- %{!m68881:%{!msoft-float:Wcrt1.o%s}}"
-#else
-#if TARGET_DEFAULT & MASK_68881
-/* -m68881 is the default */
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
- %{mfpa:Wcrt1.o%s} \
- %{msoft-float:Fcrt1.o%s} \
- %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
-#else
-/* -msoft-float is the default */
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} \
- %{m68881:Mcrt1.o%s} \
- %{mfpa:Wcrt1.o%s} \
- %{!m68881:%{!mfpa:Fcrt1.o%s}}"
-#endif
-#endif
-
-/* Specify library to handle `-a' basic block profiling.
- Control choice of libm.a (if user says -lm)
- based on fp arith default and options. */
-
-#if TARGET_DEFAULT & MASK_FPA
-/* -mfpa is the default */
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
-%{g:-lg} \
-%{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
-%{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
-#else
-#if TARGET_DEFAULT & MASK_68881
-/* -m68881 is the default */
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
-%{g:-lg} \
-%{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
-%{mfpa:-L/usr/lib/ffpa}"
-#else
-/* -msoft-float is the default */
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
-%{g:-lg} \
-%{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
-%{mfpa:-L/usr/lib/ffpa}"
-#endif
-#endif
-
-/* Provide required defaults for linker -e and -d switches. */
-
-#define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Allow folding division by zero. */
-#define REAL_INFINITY
-
-/* Generate calls to memcpy, memcmp and memset. */
-#define TARGET_MEM_FUNCTIONS
-
-/* This is not a good idea. It prevents interoperation between
- files compiled with -m68881 and those compiled with -msoft-float. */
-#if 0
-#define FUNCTION_VALUEX(MODE) \
- gen_rtx (REG, (MODE), \
- ((TARGET_68881 \
- && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
- ? 16 : 0))
-
-#undef FUNCTION_VALUE
-#define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
-#endif /* 0 */
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "\t.double 0r-99e999\n"); \
- else \
- fprintf (FILE, "\t.double 0r99e999\n"); \
- } \
- else if (REAL_VALUE_ISNAN (VALUE)) \
- { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), l); \
- fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", l[0], l[1]); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr); \
- fprintf (FILE, "\t.double 0r%s\n", dstr); \
- } \
- }
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- fprintf (FILE, "\t.single 0r-99e999\n"); \
- else \
- fprintf (FILE, "\t.single 0r99e999\n"); \
- } \
- else if (REAL_VALUE_ISNAN (VALUE)) \
- { long l; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), l); \
- fprintf (FILE, "\t.long 0x%lx\n", l); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
- fprintf (FILE, "\t.single 0r%s\n", dstr); \
- } \
- }
-
-/* This is how to output an assembler lines defining floating operands.
- There's no way to output a NaN's fraction, so we lose it. */
-
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { \
- if (CODE != 'f') \
- { \
- long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- if (sizeof (int) == sizeof (long)) \
- asm_fprintf ((FILE), "%I0x%x", l); \
- else \
- asm_fprintf ((FILE), "%I0x%lx", l); \
- } \
- else if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- asm_fprintf (FILE, "%I0r-99e999"); \
- else \
- asm_fprintf (FILE, "%I0r99e999"); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- asm_fprintf (FILE, "%I0r-0.0"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
- asm_fprintf (FILE, "%I0r%s", dstr); \
- } \
- } while (0)
-
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { if (REAL_VALUE_ISINF (VALUE)) \
- { \
- if (REAL_VALUE_NEGATIVE (VALUE)) \
- asm_fprintf (FILE, "%I0r-99e999"); \
- else \
- asm_fprintf (FILE, "%I0r99e999"); \
- } \
- else if (REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- asm_fprintf (FILE, "%I0r-0.0"); \
- } \
- else \
- { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr); \
- asm_fprintf (FILE, "%I0r%s", dstr); \
- } \
- } while (0)
-
-#if 0
-/* This was turned off as it caused linking errors on sunos4.1.
- `gcc -a' links in /usr/lib/bb_link.o which does not provide __bb_link
- but its own version of __bb_init_func. */
-#undef BLOCK_PROFILER_CODE
-#define BLOCK_PROFILER_CODE \
-extern int ___tcov_init; \
- \
-__bb_init_func (blocks) \
- struct bb *blocks; \
-{ \
- if (! ___tcov_init) \
- ___tcov_init_func (); \
- \
- ___bb_link (blocks->filename, blocks->counts, blocks->ncounts); \
-}
-#endif
diff --git a/gcc/config/m68k/sun3mach.h b/gcc/config/m68k/sun3mach.h
deleted file mode 100644
index 86c48d0f7c3..00000000000
--- a/gcc/config/m68k/sun3mach.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "m68k/sun3.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmc68000 -Dsun -Dsun3 -Dunix -DMACH -DCMU -DMTXINU -DBIT_MSF -DBYTE_MSF -Asystem(unix) -Asystem(mach) -Acpu(m68k) -Amachine(m68k)"
-
-/* Specify extra dir to search for include files. */
-#define SYSTEM_INCLUDE_DIR "/usr/mach/include"
-
-/* LINK_SPEC is needed only for Sunos 4. */
-
-#undef LINK_SPEC
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/m68k/sun3n.h b/gcc/config/m68k/sun3n.h
deleted file mode 100644
index 32f5f657dc0..00000000000
--- a/gcc/config/m68k/sun3n.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Define target machine as a Sun 3 with no 68881. */
-
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68020)
-
-#include "m68k/sun3.h"
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
diff --git a/gcc/config/m68k/sun3n3.h b/gcc/config/m68k/sun3n3.h
deleted file mode 100644
index 1c962bd68b8..00000000000
--- a/gcc/config/m68k/sun3n3.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "m68k/sun3n.h"
-
-/* LINK_SPEC is needed only for Sunos 4. */
-
-#undef LINK_SPEC
diff --git a/gcc/config/m68k/sun3o3.h b/gcc/config/m68k/sun3o3.h
deleted file mode 100644
index 4d3e3dd2584..00000000000
--- a/gcc/config/m68k/sun3o3.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "m68k/sun3.h"
-
-/* LINK_SPEC is needed only for Sunos 4. */
-
-#undef LINK_SPEC
diff --git a/gcc/config/m68k/t-aux b/gcc/config/m68k/t-aux
deleted file mode 100644
index 3d59d675ffd..00000000000
--- a/gcc/config/m68k/t-aux
+++ /dev/null
@@ -1,44 +0,0 @@
-# Makefile additions for A/UX
-
-LIB2FUNCS_EXTRA=aux-mcount.c aux-exit.c
-
-FIXPROTO_DEFINES=-D_POSIX_SOURCE
-
-# Only really needed for collect2
-CLIB=-lld
-
-# Needed to support builds for multiple versions of A/UX
-# LDFLAGS=-static
-
-# Make sure we get the right assembler by letting gcc choose
-AS = $(GCC_FOR_TARGET) -xassembler-with-cpp -D__ASSEMBLY__ $(INCLUDES) -c
-
-aux-mcount.c: $(srcdir)/config/m68k/aux-mcount.c
- cp $(srcdir)/config/m68k/aux-mcount.c aux-mcount.c
-
-aux-exit.c: $(srcdir)/config/m68k/aux-exit.c
- cp $(srcdir)/config/m68k/aux-exit.c aux-exit.c
-
-crt1.o: $(srcdir)/config/m68k/aux-crt1.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -o crt1.o -c \
- -fno-omit-frame-pointer $(srcdir)/config/m68k/aux-crt1.c
-
-mcrt1.o: $(srcdir)/config/m68k/aux-crt1.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -o mcrt1.o -c \
- -fno-omit-frame-pointer -DMCRT1 $(srcdir)/config/m68k/aux-crt1.c
-
-maccrt1.o: $(srcdir)/config/m68k/aux-crt1.c $(GCC_PASSES)
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -o maccrt1.o -c \
- -fno-omit-frame-pointer -DMACCRT1 $(srcdir)/config/m68k/aux-crt1.c
-
-crt2.o: $(srcdir)/config/m68k/aux-crt2.asm $(GCC_PASSES)
- $(AS) -o crt2.o $(srcdir)/config/m68k/aux-crt2.asm
-
-crtn.o: $(srcdir)/config/m68k/aux-crtn.asm $(GCC_PASSES)
- $(AS) -o crtn.o $(srcdir)/config/m68k/aux-crtn.asm
-
-low.gld: $(srcdir)/config/m68k/aux-low.gld
- sed -e 's|@libdir@|$(libdir)|' -e 's|@tooldir@|$(tooldir)|' \
- -e 's|@local_prefix@|$(local_prefix)|' \
- $(srcdir)/config/m68k/aux-low.gld > tmp-low.gld
- mv tmp-low.gld low.gld
diff --git a/gcc/config/m68k/t-linux b/gcc/config/m68k/t-linux
deleted file mode 100644
index 169661f6296..00000000000
--- a/gcc/config/m68k/t-linux
+++ /dev/null
@@ -1,19 +0,0 @@
-# Don't run fixproto
-STMP_FIXPROTO =
-# Don't make libgcc1.a
-LIBGCC1 =
-CROSS_LIBGCC1 =
-# On Linux we can print long double
-ENQUIRE_CFLAGS = -DNO_MEM -O0
-# Don't install assert.h
-INSTALL_ASSERT_H =
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = -fPIC
-# Compile libgcc2.a with pic.
-TARGET_LIBGCC2_CFLAGS = -fPIC
-# Don't install assert.h
-INSTALL_ASSERT_H =
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = -fPIC
-# Compile libgcc2.a with pic.
-TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/m68k/t-linux-aout b/gcc/config/m68k/t-linux-aout
deleted file mode 100644
index 85f13a7f1ed..00000000000
--- a/gcc/config/m68k/t-linux-aout
+++ /dev/null
@@ -1,5 +0,0 @@
-# Don't make libgcc1.a
-LIBGCC1 =
-CROSS_LIBGCC1 =
-# On Linux we can print long double
-ENQUIRE_CFLAGS = -DNO_MEM -O0
diff --git a/gcc/config/m68k/t-lynx b/gcc/config/m68k/t-lynx
deleted file mode 100644
index 6f2cabaaed5..00000000000
--- a/gcc/config/m68k/t-lynx
+++ /dev/null
@@ -1,6 +0,0 @@
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = m68k/lb1sf68.asm
-LIB1ASMFUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
- _double _float _floatex \
- _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
- _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
diff --git a/gcc/config/m68k/t-m68kbare b/gcc/config/m68k/t-m68kbare
deleted file mode 100644
index 34c832a0f13..00000000000
--- a/gcc/config/m68k/t-m68kbare
+++ /dev/null
@@ -1,24 +0,0 @@
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = m68k/lb1sf68.asm
-LIB1ASMFUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
- _double _float _floatex \
- _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
- _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-LIB2FUNCS_EXTRA = fpgnulib.c xfgnulib.c
-
-fpgnulib.c: $(srcdir)/config/m68k/fpgnulib.c
- cp $(srcdir)/config/m68k/fpgnulib.c fpgnulib.c
-xfgnulib.c: $(srcdir)/config/m68k/fpgnulib.c
- echo '#define EXTFLOAT' > xfgnulib.c
- cat $(srcdir)/config/m68k/fpgnulib.c >> xfgnulib.c
-
-MULTILIB_OPTIONS = m68000/m68020/m5200 m68881/msoft-float
-MULTILIB_DIRNAMES =
-MULTILIB_MATCHES = m68000=mc68000 m68000=m68302 m68000=m68332 m68020=mc68020 m68020=m68040
-MULTILIB_EXCEPTIONS = *m5200/*m68881 *m5200/*msoft-float
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/m68k/t-mot3300 b/gcc/config/m68k/t-mot3300
deleted file mode 100644
index 2fc11858d58..00000000000
--- a/gcc/config/m68k/t-mot3300
+++ /dev/null
@@ -1,10 +0,0 @@
-MULTILIB_OPTIONS=m68000/m68020 msoft-float
-MULTILIB_DIRNAMES=
-MULTILIB_MATCHES=m68000=mc68000 m68000=m68302 m68000=m68332 m68020=mc68020 m68020=m68040
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-CRT0_S = $(srcdir)/config/m68k/mot3300-crt0.S
-MCRT0_S = $(srcdir)/config/m68k/mot3300Mcrt0.S
-CRT0STUFF_T_CFLAGS = -DMOTOROLA -DSGS_CMP_ORDER
diff --git a/gcc/config/m68k/t-mot3300-gald b/gcc/config/m68k/t-mot3300-gald
deleted file mode 100644
index 435afc49e65..00000000000
--- a/gcc/config/m68k/t-mot3300-gald
+++ /dev/null
@@ -1,13 +0,0 @@
-T_CPPFLAGS = -DUSE_GAS -DUSE_GLD
-TARGET_LIBGCC2_CFLAGS = -DUSE_GAS
-
-MULTILIB_OPTIONS=m68000/m68020 msoft-float
-MULTILIB_DIRNAMES=
-MULTILIB_MATCHES=m68000=mc68000 m68000=m68302 m68000=m68332 m68020=mc68020 m68020=m68040
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-CRT0_S = $(srcdir)/config/m68k/mot3300-crt0.S
-MCRT0_S = $(srcdir)/config/m68k/mot3300Mcrt0.S
-CRT0STUFF_T_CFLAGS =
diff --git a/gcc/config/m68k/t-mot3300-gas b/gcc/config/m68k/t-mot3300-gas
deleted file mode 100644
index 525667452e2..00000000000
--- a/gcc/config/m68k/t-mot3300-gas
+++ /dev/null
@@ -1,13 +0,0 @@
-T_CPPFLAGS = -DUSE_GAS
-TARGET_LIBGCC2_CFLAGS = -DUSE_GAS
-
-MULTILIB_OPTIONS=m68000/m68020 msoft-float
-MULTILIB_DIRNAMES=
-MULTILIB_MATCHES=m68000=mc68000 m68000=m68302 m68000=m68332 m68020=mc68020 m68020=m68040
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-CRT0_S = $(srcdir)/config/m68k/mot3300-crt0.S
-MCRT0_S = $(srcdir)/config/m68k/mot3300Mcrt0.S
-CRT0STUFF_T_CFLAGS =
diff --git a/gcc/config/m68k/t-mot3300-gld b/gcc/config/m68k/t-mot3300-gld
deleted file mode 100644
index 8cc3ed6f250..00000000000
--- a/gcc/config/m68k/t-mot3300-gld
+++ /dev/null
@@ -1,12 +0,0 @@
-T_CPPFLAGS = -DUSE_GLD
-
-MULTILIB_OPTIONS=m68000/m68020 msoft-float
-MULTILIB_DIRNAMES=
-MULTILIB_MATCHES=m68000=mc68000 m68000=m68302 m68000=m68332 m68020=mc68020 m68020=m68040
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-CRT0_S = $(srcdir)/config/m68k/mot3300-crt0.S
-MCRT0_S = $(srcdir)/config/m68k/mot3300Mcrt0.S
-CRT0STUFF_T_CFLAGS = -DMOTOROLA -DSGS_CMP_ORDER
diff --git a/gcc/config/m68k/t-next b/gcc/config/m68k/t-next
deleted file mode 100644
index 439688b541b..00000000000
--- a/gcc/config/m68k/t-next
+++ /dev/null
@@ -1,4 +0,0 @@
-# libgcc1.c is not needed, since the standard library has these functions.
-LIBGCC1=
-CROSS_LIBGCC1=
-
diff --git a/gcc/config/m68k/t-vxworks68 b/gcc/config/m68k/t-vxworks68
deleted file mode 100644
index 7be1bb0ee76..00000000000
--- a/gcc/config/m68k/t-vxworks68
+++ /dev/null
@@ -1,27 +0,0 @@
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = m68k/lb1sf68.asm
-LIB1ASMFUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
- _double _float _floatex \
- _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
- _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
-
-# We don't want to put exit in libgcc.a for VxWorks, because VxWorks
-# does not have _exit.
-LIBGCC2_CFLAGS = -O2 $(GCC_CFLAGS) -g1 -Dexit=unused_exit
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-LIB2FUNCS_EXTRA = fpgnulib.c xfgnulib.c
-
-fpgnulib.c: $(srcdir)/config/m68k/fpgnulib.c
- cp $(srcdir)/config/m68k/fpgnulib.c fpgnulib.c
-xfgnulib.c: $(srcdir)/config/m68k/fpgnulib.c
- echo '#define EXTFLOAT' > xfgnulib.c
- cat $(srcdir)/config/m68k/fpgnulib.c >> xfgnulib.c
-
-MULTILIB_OPTIONS = m68000/m68020 m68881/msoft-float
-MULTILIB_DIRNAMES =
-MULTILIB_MATCHES = m68000=mc68000 m68000=m68302 m68000=m68332 m68020=mc68020 m68020=m68040
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/m68k/tower-as.h b/gcc/config/m68k/tower-as.h
deleted file mode 100644
index 46aa30a7478..00000000000
--- a/gcc/config/m68k/tower-as.h
+++ /dev/null
@@ -1,616 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- For NCR Tower 32/4x0 and 32/6x0 running System V Release 3.
- Copyright (C) 1990, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Robert Andersson (ra@intsys.no), International Systems,
- Oslo, Norway.
-
-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 outputs assembler source suitable for the native Tower as
- and with sdb debugging symbols. See tower.h for more comments.
-
- This file was based on m68k.h, hp320.h and 3b1.h as of the
- 1.37.1 version. */
-
-#include "m68k/tower.h"
-#undef SELECT_RTX_SECTION
-
-/* Use default settings for system V.3. */
-
-#include "svr3.h"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dunix -Dtower32 -Dtower32_600 -D__motorola__ -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-
-/* Define __HAVE_68881 in preprocessor only if -m68881 is specified.
- This will control the use of inline 68881 insns in certain macros.
- Also, define special define used to identify the Tower assembler. */
-
-#define CPP_SPEC "-D__TOWER_ASM__ %{m68881:-D__HAVE_68881__}"
-
-/* We don't want local labels to start with period.
- See ASM_OUTPUT_INTERNAL_LABEL. */
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX ""
-
-/* The prefix to add to user-visible assembler symbols. */
-/* We do not want leading underscores. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* These four macros control how m68k.md is expanded. */
-
-#define MOTOROLA /* Use Motorola syntax rather than "MIT" */
-#define SGS /* Uses SGS assembler */
-#define SGS_CMP_ORDER /* Takes cmp operands in reverse order */
-#define SGS_NO_LI /* Suppress jump table label usage */
-
-/* Turn on SDB debugging info. */
-
-#define SDB_DEBUGGING_INFO
-
-/* This is only useful if gdb is changed, but doesn't harm anyway. */
-
-#define ASM_IDENTIFY_GCC(FILE) \
- fprintf (FILE, "gcc2_compiled%%:\n")
-
-/* All the ASM_OUTPUT macros need to conform to the Tower as syntax. */
-
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
- do { \
- fprintf (FILE, "\tfile\t"); \
- output_quoted_string (FILE, FILENAME); \
- fprintf (FILE, "\n"); \
- fprintf (FILE, "section ~init,\"x\"\n"); \
- fprintf (FILE, "section ~fini,\"x\"\n"); \
- fprintf (FILE, "section ~rodata,\"x\"\n"); \
- fprintf (FILE, "text\n"); \
- } while (0)
-
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
- fprintf (FILE, "\tln\t%d\n", \
- (sdb_begin_function_line \
- ? last_linenum - sdb_begin_function_line : 1))
-
-#undef ASM_OUTPUT_IDENT
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf (FILE, "\tident\t\"%s\" \n", NAME)
-
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
- do { register int sp = 0, lp = 0; \
- fprintf ((FILE), "\tbyte\t"); \
- loop: \
- if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \
- { lp += 3; \
- fprintf ((FILE), "'%c", (PTR)[sp]); } \
- else \
- { lp += 5; \
- fprintf ((FILE), "0x%x", (PTR)[sp]); } \
- if (++sp < (LEN)) \
- { if (lp > 60) \
- { lp = 0; \
- fprintf ((FILE), "\n\tbyte\t"); } \
- else \
- putc (',', (FILE)); \
- goto loop; } \
- putc ('\n', (FILE)); } while (0)
-
-/* Translate Motorola opcodes such as `jbeq'
- into SGS/Tower opcodes such as `beq.w'.
- Change `move' to `mov'.
- Change `cmpm' to `cmp'.
- Change `divsl' to `tdivs'.
- Change `divul' to `tdivu'.
- Change `ftst' to `ftest'.
- Change `fmove' to `fmov'. */
-
-#define ASM_OUTPUT_OPCODE(FILE, PTR) \
-{ if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
- { ++(PTR); \
- while (*(PTR) != ' ') \
- { putc (*(PTR), (FILE)); ++(PTR); } \
- fprintf ((FILE), ".w"); } \
- else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
- && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
- { fprintf ((FILE), "mov"); (PTR) += 4; } \
- else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
- && (PTR)[2] == 'p' && (PTR)[3] == 'm') \
- { fprintf ((FILE), "cmp"); (PTR) += 4; } \
- else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \
- && (PTR)[2] == 'v' && (PTR)[3] == 's' \
- && (PTR)[4] == 'l') \
- { fprintf ((FILE), "tdivs"); (PTR) += 5; } \
- else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \
- && (PTR)[2] == 'v' && (PTR)[3] == 'u' \
- && (PTR)[4] == 'l') \
- { fprintf ((FILE), "tdivu"); (PTR) += 5; } \
- else if ((PTR)[0] == 'f' && (PTR)[1] == 't' \
- && (PTR)[2] == 's' && (PTR)[3] == 't') \
- { fprintf ((FILE), "ftest"); (PTR) += 4; } \
- else if ((PTR)[0] == 'f' && (PTR)[1] == 'm' \
- && (PTR)[2] == 'o' && (PTR)[3] == 'v' \
- && (PTR)[4] == 'e') \
- { fprintf ((FILE), "fmov"); (PTR) += 5; } \
-}
-
-
-
-/* Override parts of m68k.h to fit the Tower assembler.
- This section needs to track changes done to m68k.h in the future. */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (68k, Motorola/SGS/Tower32 syntax)");
-
-#undef FUNCTION_BLOCK_PROFILER
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- do { \
- char label1[20], label2[20]; \
- ASM_GENERATE_INTERNAL_LABEL (label1, "LPBX", 0); \
- ASM_GENERATE_INTERNAL_LABEL (label2, "LPI", LABELNO); \
- fprintf (FILE, "\ttst.l %s\n\tbne %s\n\tpea %s\n\tjsr __bb_init_func\n\taddq.l &4,%%sp\n", \
- label1, label2, label1); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "LPI", LABELNO); \
- putc ('\n', FILE); \
- } while (0)
-
-#undef BLOCK_PROFILER
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
- do { \
- char label[20]; \
- ASM_GENERATE_INTERNAL_LABEL (label, "LPBX", 2); \
- fprintf (FILE, "\taddq.l &1,%s+%d\n", label, 4 * BLOCKNO); \
- } while (0)
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABEL_NO) \
- fprintf (FILE, "\tmov.l &LP%%%d,%%a0\n\tjsr mcount%%\n", (LABEL_NO))
-
-#undef FUNCTION_EXTRA_EPILOGUE
-#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
- { extern int current_function_returns_pointer; \
- if ((current_function_returns_pointer) && \
- ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
- asm_fprintf (FILE, "\tmov.l %Rd0,%Ra0\n"); }
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#undef ASM_OUTPUT_REG_PUSH
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#undef ASM_OUTPUT_REG_POP
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO])
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-( fprintf (FILE, "#NO_APP\n"), \
- output_file_directive ((FILE), main_input_filename))
-
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP "text"
-
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP "data"
-
-/* This says how to output an assembler line to define a global common symbol.
- We use SIZE rather than ROUNDED, as this is what the native cc does. */
-
-#undef ASM_OUTPUT_COMMON
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\tcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", ((SIZE) == 0) ? (ROUNDED) : (SIZE)))
-
-/* This says how to output an assembler line to define a local common symbol.
- We use SIZE rather than ROUNDED, as this is what the native cc does. */
-
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\tlcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", ((SIZE) == 0) ? (ROUNDED) : (SIZE)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#undef ASM_FORMAT_PRIVATE_NAME
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 11), \
- sprintf ((OUTPUT), "%s%%%%%d", (NAME), (LABELNO)))
-
-/* This is the command to make the user-level label named NAME
- defined for reference from other files. */
-
-#undef GLOBAL_ASM_OP
-#define GLOBAL_ASM_OP "global"
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
- sprintf ((LABEL), "%s%%%d", (PREFIX), (NUM))
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf ((FILE), "%s%%%d:\n", (PREFIX), (NUM))
-
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n", \
- XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM)); \
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf (FILE, "\tlong 0x%x,0x%x\n", l[0], l[1]); \
- } while (0)
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long l[3]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
- fprintf (FILE, "\tlong 0x%x,0x%x,0x%x\n", l[0], l[1], l[2]); \
- } while (0)
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- fprintf ((FILE), "\tlong 0x%x\n", l); \
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#undef ASM_OUTPUT_INT
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\tlong "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#undef ASM_OUTPUT_SHORT
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\tshort "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#undef ASM_OUTPUT_CHAR
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\tbyte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#undef ASM_OUTPUT_BYTE
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\tbyte 0x%x\n", (VALUE))
-
-#undef ASM_OUTPUT_ADDR_VEC_ELT
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\tlong L%%%d\n", (VALUE))
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\tshort L%%%d-L%%%d\n", (VALUE), (REL))
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) == 1) \
- fprintf (FILE, "\teven\n"); \
- else if ((LOG) != 0) \
- abort ();
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\tspace %d\n", (SIZE))
-
-/* Output a float value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-
-#undef ASM_OUTPUT_FLOAT_OPERAND
-#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
- do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (r, l); \
- /* Use hex representation even if CODE is f. as needs it. */ \
- fprintf ((FILE), "&0x%lx", l); \
- } while (0)
-
-/* Output a double value (represented as a C double) as an immediate operand.
- This macro is a 68k-specific macro. */
-#undef ASM_OUTPUT_DOUBLE_OPERAND
-#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
- do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf ((FILE), "&0x%lx%08lx", l[0], l[1]); \
- } while (0)
-
-#if 0
-#undef PRINT_OPERAND
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (CODE == '.') fprintf (FILE, "."); \
- else if (CODE == '#') fprintf (FILE, "&"); \
- else if (CODE == '-') fprintf (FILE, "-(%%sp)"); \
- else if (CODE == '+') fprintf (FILE, "(%%sp)+"); \
- else if (CODE == '@') fprintf (FILE, "(%%sp)"); \
- else if (CODE == '!') fprintf (FILE, "%%fpcr"); \
- else if (CODE == '/') \
- fprintf (FILE, "%%"); \
- else if (CODE == '$') { if (TARGET_68040_ONLY) fprintf (FILE, "s"); } \
- else if (CODE == '&') { if (TARGET_68040_ONLY) fprintf (FILE, "d"); } \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
- { REAL_VALUE_TYPE r; long l; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- REAL_VALUE_TO_TARGET_SINGLE (r, l); \
- fprintf (FILE, "&0x%x", l); } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
- { REAL_VALUE_TYPE r; int i[2]; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- REAL_VALUE_TO_TARGET_DOUBLE (r, i); \
- fprintf (FILE, "&0x%x%08x", i[0], i[1]); } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode) \
- { REAL_VALUE_TYPE r; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- ASM_OUTPUT_LONG_DOUBLE_OPERAND (FILE, r); } \
- else { putc ('&', FILE); output_addr_const (FILE, X); }}
-#endif
-
-/* Note that this contains a kludge that knows that the only reason
- we have an address (plus (label_ref...) (reg...))
- is in the insn before a tablejump, and we know that the table is
- exactly 10 bytes away. */
-
-#undef PRINT_OPERAND_ADDRESS
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx reg1, reg2, breg, ireg; \
- register rtx addr = ADDR; \
- rtx offset; \
- switch (GET_CODE (addr)) \
- { \
- case REG: \
- fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
- break; \
- case PRE_DEC: \
- fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case POST_INC: \
- fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
- break; \
- case PLUS: \
- reg1 = 0; reg2 = 0; \
- ireg = 0; breg = 0; \
- offset = 0; \
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
- { \
- offset = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
- { \
- offset = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) != PLUS) ; \
- else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == MULT) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == MULT) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
- || GET_CODE (addr) == SIGN_EXTEND) \
- { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
-/* for OLD_INDEXING \
- else if (GET_CODE (addr) == PLUS) \
- { \
- if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg2 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg2 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- } \
- */ \
- if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
- if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
- || GET_CODE (reg1) == MULT)) \
- || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
- { breg = reg2; ireg = reg1; } \
- else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
- { breg = reg1; ireg = reg2; } \
- if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
- { int scale = 1; \
- if (GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "10(%%pc,%s.w", \
- reg_names[REGNO (XEXP (ireg, 0))]); \
- else \
- fprintf (FILE, "10(%%pc,%s.l", \
- reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- putc (')', FILE); \
- break; } \
- if (ireg != 0 || breg != 0) \
- { int scale = 1; \
- if (breg == 0) \
- abort (); \
- if (addr != 0) \
- output_addr_const (FILE, addr); \
- fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \
- if (ireg != 0) \
- putc (',', FILE); \
- if (ireg != 0 && GET_CODE (ireg) == MULT) \
- { scale = INTVAL (XEXP (ireg, 1)); \
- ireg = XEXP (ireg, 0); } \
- if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
- fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
- else if (ireg != 0) \
- fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
- if (scale != 1) fprintf (FILE, "*%d", scale); \
- putc (')', FILE); \
- break; \
- } \
- else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
- { fprintf (FILE, "10(%%pc,%s.w)", \
- reg_names[REGNO (reg1)]); \
- break; } \
- default: \
- output_addr_const (FILE, addr); \
- }}
-
-
-
-/* Override usual definitions of SDB output macros.
- These definitions differ only in the absence of the period
- at the beginning of the name of the directive
- and in the use of `~' as the symbol for the current location. */
-
-#define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a))
-#define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a))
-#define PUT_SDB_VAL(a) \
-( fputs ("\tval\t", asm_out_file), \
- output_addr_const (asm_out_file, (a)), \
- fputc (';', asm_out_file))
-
-#define PUT_SDB_DEF(a) \
-do { fprintf (asm_out_file, "\tdef\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, ";"); } while (0)
-
-#define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a)
-#define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file)
-#define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a)
-#define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a)
-#define PUT_SDB_START_DIM fprintf(asm_out_file, "\tdim\t")
-#define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
-#define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d;", a)
-
-#define PUT_SDB_TAG(a) \
-do { fprintf (asm_out_file, "\ttag\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, ";"); } while (0)
-
-#define PUT_SDB_BLOCK_START(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_BLOCK_END(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_FUNCTION_START(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_FUNCTION_END(LINE) \
- fprintf (asm_out_file, \
- "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
- (LINE))
-
-#define PUT_SDB_EPILOGUE_END(NAME) \
- fprintf (asm_out_file, \
- "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n", \
- (NAME))
-
-#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
- sprintf ((BUFFER), "~%dfake", (NUMBER));
-
-#define NO_DOLLAR_IN_LABEL
-#define NO_DOT_IN_LABEL
-
-/* The usual definitions don't work because neither $ nor . is allowed. */
-#define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_%%I\%%%s"
-
-/* Define a few machine-specific details
- of the implementation of constructors.
-
- The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
- and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- ASM_OUTPUT_CONSTRUCTOR should be defined
- to push the address of the constructor. */
-
-#define ASM_LONG "\tlong"
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP "section\t~init"
-#undef FINI_SECTION_ASM_OP
-#define FINI_SECTION_ASM_OP "section\t~fini"
-#undef CONST_SECTION_ASM_OP
-#define CONST_SECTION_ASM_OP "section\t~rodata"
-
-#define CTOR_LIST_BEGIN \
- asm (INIT_SECTION_ASM_OP); \
- asm ("clr.l -(%sp)")
-#define CTOR_LIST_END CTOR_LIST_BEGIN
-
-#define BSS_SECTION_ASM_OP "section\t~bss"
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tmov.l &"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",-(%%sp)\n"); \
- } while (0)
diff --git a/gcc/config/m68k/tower.h b/gcc/config/m68k/tower.h
deleted file mode 100644
index 73faedbd0e7..00000000000
--- a/gcc/config/m68k/tower.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Copyright (C) 1990, 1994, 1996 Free Software Foundation, Inc.
- Contributed by Robert Andersson, International Systems, Oslo, ra@intsys.no.
-
-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. */
-
-/* For NCR Tower 32/4x0 and 32/6x0 running System V Release 3. I don't have
- access to 200/700/800/850 machines, so I don't know if it works on those
- as well. It shouldn't be far from it however. The hardware floating point
- support is completely untested, as I do not have access to a machine with
- a 6888x FPU in it. It does not work on the System V Release 2 based OS
- releases. Making it work will not be easy, due to the silly way in which
- stack expansion is implemented in the OS.
-
- This file is included in tower-as.h.
- Do *NOT* include this file directly. */
-
-
-#include "m68k/m68k.h"
-
-#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68020)
-
-/* Don't try using XFmode. */
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dunix -Dtower32 -Dtower32_200 -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-
-#if 0 /* It is incorrect to test these symbols.
- They describe the host, not the target.
- It should not matter which model is specified. */
-#ifdef tower32_600
-#define CPP_PREDEFINES "-Dunix -Dtower32 -Dtower32_600 -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#ifdef tower32_700
-#define CPP_PREDEFINES "-Dunix -Dtower32 -Dtower32_700 -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#ifdef tower32_800
-#define CPP_PREDEFINES "-Dunix -Dtower32 -Dtower32_800 -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#ifdef tower32_850
-#define CPP_PREDEFINES "-Dunix -Dtower32 -Dtower32_850 -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
-#endif
-#endif
-
-/* The startfiles and libraries depend on the -p and -m68881 options.
- The Tower does not support the -pg option. */
-
-#define LINK_SPEC \
-"%{p:%{m68881:-L/usr/lib/fp/libp} -L/usr/lib/libp} \
- %{m68881:-L/usr/lib/fp}"
-
-#define LIB_SPEC \
-"%{shlib:-lc_s} -lc crtend.o%s crtn.o%s"
-
-#define STARTFILE_SPEC \
-"%{p:mcrt1.o%s} %{!p:crt1.o%s} crtbegin.o%s"
-
-/* Use mem* functions, recognize #ident lines. */
-
-#define TARGET_MEM_FUNCTIONS
-#define IDENT_DIRECTIVE
-
-/* Every structure and union's size must be a multiple of two bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* All register names should have a leading % character. */
-
-#undef REGISTER_NAMES
-#define REGISTER_NAMES \
-{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
- "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
- "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"};
-
-#undef REGISTER_PREFIX
-#define REGISTER_PREFIX "%"
-
-#undef IMMEDIATE_PREFIX
-#define IMMEDIATE_PREFIX "&"
-
-/* The prefix to add to user-visible assembler symbols. */
-
-/* We do not want leading underscores. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
diff --git a/gcc/config/m68k/vxm68k.h b/gcc/config/m68k/vxm68k.h
deleted file mode 100644
index 063ded86a63..00000000000
--- a/gcc/config/m68k/vxm68k.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Definitions of target machine for GNU compiler. Vxworks m68k version.
- Copyright (C) 1994, 1996, 1997 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 comment is here to see if it will keep Sun's cpp from dying. */
-
-#include "m68k/m68k-none.h"
-#include "aoutos.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmc68000 -D__vxworks -D__vxworks_5 -Acpu(m68k) -Amachine(m68k)"
-
-/* The default value for -DCPU=. */
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68k || TARGET_CPU_DEFAULT == M68K_CPU_m68020
-#define CPP_SUBTARGET_CPU_DEFAULT_SPEC "-DCPU=MC68020"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68000
-#define CPP_SUBTARGET_CPU_DEFAULT_SPEC "-DCPU=MC68000"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68030
-#define CPP_SUBTARGET_CPU_DEFAULT_SPEC "-DCPU=MC68030"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68040
-#define CPP_SUBTARGET_CPU_DEFAULT_SPEC "-DCPU=MC68040"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68302
-#define CPP_SUBTARGET_CPU_DEFAULT_SPEC "-DCPU=MC68302"
-#else
-#if TARGET_CPU_DEFAULT == M68K_CPU_m68332
-#define CPP_SUBTARGET_CPU_DEFAULT_SPEC "-DCPU=MC68332"
-#else
-Unrecognized value in TARGET_CPU_DEFAULT.
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-
-#undef SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS \
-{ "cpp_subtarget_cpu_default", CPP_SUBTARGET_CPU_DEFAULT_SPEC }
-
-/* Vxworks header files require that the macro CPU be set. */
-/* ??? The previous code didn't set CPU if -ansi. */
-#undef CPP_SUBTARGET_SPEC
-#define CPP_SUBTARGET_SPEC "\
-%{m68000:-DCPU=MC68000 }%{m68010:-DCPU=MC68010 }%{m68020:-DCPU=MC68020 }%{mc68020:-DCPU=MC68020 }%{m68030:-DCPU=MC68030 }%{m68040:-DCPU=MC68040 }%{m68020-40:-DCPU=MC68020 }%{m68302:-DCPU=MC68000 }%{m68332:-DCPU=CPU32 } \
-%{!mc68000:%{!m68000:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68302:%{!m68332:%(cpp_subtarget_cpu_default) }}}}}}}}}} \
-"
-
-#define DBX_DEBUGGING_INFO
-#undef SDB_DEBUGGING_INFO
-
-/* These are the official values from WRS. */
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "char"
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 8
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-/* VxWorks does all the library stuff itself. */
-
-#define LIB_SPEC ""
-
-/* Provide required defaults for linker -e. */
-
-#define LINK_SPEC "%{!nostdlib:%{!r*:%{!e*:-e start}}}"
-
-/* VxWorks provides the functionality of crt0.o and friends itself. */
-
-#define STARTFILE_SPEC ""
-
-/* Every structure or union's size must be a multiple of 2 bytes. */
-
-#define STRUCTURE_SIZE_BOUNDARY 16
-
-/* Allow folding division by zero. */
-#define REAL_INFINITY
-
-/* GCC is the primary compiler for VxWorks, so we don't need this. */
-#undef PCC_STATIC_STRUCT_RETURN
diff --git a/gcc/config/m68k/x-alloca-c b/gcc/config/m68k/x-alloca-c
deleted file mode 100644
index 3375d421849..00000000000
--- a/gcc/config/m68k/x-alloca-c
+++ /dev/null
@@ -1 +0,0 @@
-ALLOCA=alloca.o
diff --git a/gcc/config/m68k/x-amix b/gcc/config/m68k/x-amix
deleted file mode 100644
index 6ec4f638889..00000000000
--- a/gcc/config/m68k/x-amix
+++ /dev/null
@@ -1,27 +0,0 @@
-# Makefile configuration for Commodore Amiga running SVR4.
-# (configure amiga-amix)
-
-# The Amiga ships with gcc installed, so use it as the default CC.
-
-CC = /usr/public/bin/gcc
-
-# The AT&T compiler is still available in /usr/ccs/bin/cc and should
-# be used to compile the things that should not be compiled with gcc.
-
-OLDCC = /usr/ccs/bin/cc
-
-# Link the executables with -ansi to get ANSI floating point ranges.
-# Otherwise the values returned on overflow or underflow will be wrong.
-# NOTE: some early releases of Amiga Unix contained a bug in ptod.o
-# that prevents the correct values being returned from strtod/atof, even
-# when linked with -ansi. Sometimes -static will fix this since at least
-# one version had a fixed copy in the static libc.a.
-
-LDFLAGS = -ansi
-
-# The manual pages go in /usr/man/1l (section 1, local) without any filename
-# extension. The man command will automatically create the /usr/catman/1l
-# entry.
-
-mandir = /usr/man/1l
-manext =
diff --git a/gcc/config/m68k/x-apollo68 b/gcc/config/m68k/x-apollo68
deleted file mode 100644
index 4c809f958f9..00000000000
--- a/gcc/config/m68k/x-apollo68
+++ /dev/null
@@ -1,15 +0,0 @@
-# x-apollo68 -- 680x0 based Apollos as host system
-
-# vasta@apollo.com says this is how to compile on an Apollo (SR10.x).
-# Use a Berkeley environment.
-CC=cc -g -A nansi -A cpu,3000 -A runtype,bsd4.3 -A systype,any -DSHORT_ENUM_BUG
-OLDCC=cc -g -A nansi -A cpu,3000 -A runtype,bsd4.3 -A systype,any -DSHORT_ENUM_BUG
-
-# This used to redefine CFLAGS and LIBGCC2_CFLAGS to eliminate the unsupported
-# -g flag from both macros. This gives an undebuggable stage1 compiler which
-# is bad, and it also does the wrong thing if we are cross compiling to a
-# target which does support debugging. There is currently no way to avoid
-# the -g option that doesn't break something else.
-
-# Apollo does not have B option.
-TAROUTOPTS=xpf
diff --git a/gcc/config/m68k/x-ccur b/gcc/config/m68k/x-ccur
deleted file mode 100644
index 0f94e9da2f0..00000000000
--- a/gcc/config/m68k/x-ccur
+++ /dev/null
@@ -1,3 +0,0 @@
-# Specify the jobs library when building in the ATT universe.
-CLIB = -ljobs
-X_CFLAGS = -O0 -DSHORT_ENUM_BUG -Dregister=
diff --git a/gcc/config/m68k/x-crds b/gcc/config/m68k/x-crds
deleted file mode 100644
index 172909c1179..00000000000
--- a/gcc/config/m68k/x-crds
+++ /dev/null
@@ -1,7 +0,0 @@
-CC = cc -Wx,-X23
-
-# The following line might be necessary as well or instead of the above.
-# If you find out that it is necessary,
-# or if you find out that it is not necessary,
-# please inform bug-gcc@prep.ai.mit.edu.
-# ALLOCA = alloca.o
diff --git a/gcc/config/m68k/x-dpx2 b/gcc/config/m68k/x-dpx2
deleted file mode 100644
index a4a8c1b2cf8..00000000000
--- a/gcc/config/m68k/x-dpx2
+++ /dev/null
@@ -1,16 +0,0 @@
-# need this when using cc
-ALLOCA = alloca.o
-# avoid lossage assembling alloca.
-ALLOCA_FLAGS=-S
-ALLOCA_FINISH = $(AS) -o alloca.o alloca.s
-# be sure not to confuse ./as with /bin/as
-AS=`if [ x$(OLDCC) = x$(CC) ] ; then echo /bin/as; else echo $(GAS); fi`
-GAS = gas
-#
-# as of gcc-2.2.1 gcc -g produces too many .stabd's for /bin/ld
-# to link cc1plus, so use -g with /bin/cc, but -O with gcc
-CFLAGS=`if [ x$(OLDCC) = x$(CC) ] ; then echo -g; else echo -O; fi`
-#
-CLIB=-lmalloc -lld -lm
-# tell CC whether we are a 200 or 300
-X_CFLAGS=-D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BULL_SOURCE -D__DPX2__ `if [ -d /makesys/kernel/cf/ncl_mr ]; then echo -Dncl_mr=1; else echo -Dncl_el; fi`
diff --git a/gcc/config/m68k/x-hp2bsd b/gcc/config/m68k/x-hp2bsd
deleted file mode 100644
index 7dd651c96b6..00000000000
--- a/gcc/config/m68k/x-hp2bsd
+++ /dev/null
@@ -1,4 +0,0 @@
-# Make assignments for compilation for hp200 running 4.3bsd
-CC=gcc
-OLDCC=oldcc
-# You must have a previous version of gcc for bootstrapping
diff --git a/gcc/config/m68k/x-hp320 b/gcc/config/m68k/x-hp320
deleted file mode 100644
index 46f68e64e3e..00000000000
--- a/gcc/config/m68k/x-hp320
+++ /dev/null
@@ -1,17 +0,0 @@
-# Make assignments for compilation on HPUX with their C compiler.
-CC=cc -Wc,-Nw2000 -Wc,-Ns2000 -Wc,-Ne700 -Wc,-Np300
-OLDCC=cc -Wc,-Nw2000 -Wc,-Ns2000 -Wc,-Ne700 -Wc,-Np300
-ALLOCA=alloca.o
-# B option not supported on hpux.
-TAROUTOPTS = xpf
-
-# For CCLIBFLAGS you might want to specify the switch that
-# forces only 68000 instructions to be used.
-
-# Version 5 of HPUX had a compiler bug that made it crash with -g.
-# You must set CFLAGS to empty on version 5.
-
-# You must get alloca.c from GNU Emacs.
-
-# So putenv and other functions get seen by fixproto.
-FIXPROTO_DEFINES = -D_HPUX_SOURCE
diff --git a/gcc/config/m68k/x-hp320g b/gcc/config/m68k/x-hp320g
deleted file mode 100644
index 38f201e8e8b..00000000000
--- a/gcc/config/m68k/x-hp320g
+++ /dev/null
@@ -1,17 +0,0 @@
-# Make assignments for compilation on HPUX with their C compiler.
-CC=cc -Wc,-Nw2000 -Wc,-Ns2000 -Wc,-Ne700 -Wc,-Np300
-OLDCC=cc -Wc,-Nw2000 -Wc,-Ns2000 -Wc,-Ne700 -Wc,-Np300
-ALLOCA=alloca.o
-# B option not supported on hpux.
-TAROUTOPTS = xpf
-
-# For CCLIBFLAGS you might want to specify the switch that
-# forces only 68000 instructions to be used.
-
-X_CFLAGS= -I../hp-include
-
-# Version 5 of HPUX had a compiler bug that made it crash with -g.
-# You must set CFLAGS to empty on version 5.
-
-# So putenv and other functions get seen by fixproto.
-FIXPROTO_DEFINES = -D_HPUX_SOURCE
diff --git a/gcc/config/m68k/x-hp3bsd44 b/gcc/config/m68k/x-hp3bsd44
deleted file mode 100644
index 936b5797801..00000000000
--- a/gcc/config/m68k/x-hp3bsd44
+++ /dev/null
@@ -1,2 +0,0 @@
-CC=/usr/local/bin/gcc
-INSTALL_HEADERS=
diff --git a/gcc/config/m68k/x-mot3300 b/gcc/config/m68k/x-mot3300
deleted file mode 100644
index 634540ff675..00000000000
--- a/gcc/config/m68k/x-mot3300
+++ /dev/null
@@ -1,14 +0,0 @@
-ALLOCA=alloca.o
-
-# This disables the long/short jump optimization.
-# I use sysV68 R3V7.1 RM04 (phdm@info.ucl.ac.be)
-# Since ss-950318, with jump optimization enabled, "as" issues a warning
-# when assembling combine.s :
-# aline nnnnn : Warning: Table overflow: some optimizations lost (SDIs)
-# but later "ld" complains with
-# ld: relocation entry found for non-relocatable symbol in combine.o
-# and the produced "cc1" fails with SIGSEGV
-# Another possible fix would be to split combine.c.
-# Since ss-961013, the same happens for expr.c compiled by gcc, but not by cc;
-# and for cp/decl.c; aren't those files too big ?
-XCFLAGS=`case $@ in combine.o|expr.o|decl.o) echo -Wa,-j;;esac`
diff --git a/gcc/config/m68k/x-mot3300-gas b/gcc/config/m68k/x-mot3300-gas
deleted file mode 100644
index cf2797773df..00000000000
--- a/gcc/config/m68k/x-mot3300-gas
+++ /dev/null
@@ -1,12 +0,0 @@
-ALLOCA=alloca.o
-
-# This disables the long/short jump optimization.
-# I use sysV68 R3V7.1 RM04 (phdm@info.ucl.ac.be)
-# Since ss-950318, with jump optimization enabled, "as" issues a warning
-# when assembling combine.s :
-# aline nnnnn : Warning: Table overflow: some optimizations lost (SDIs)
-# but later "ld" complains with
-# ld: relocation entry found for non-relocatable symbol in combine.o
-# and the produced "cc1" fails with SIGSEGV
-# Another possible fix would be to split combine.c.
-XCFLAGS=`if [ x$@ = xcombine.o -a "${CC}" = "${OLDCC}" ]; then echo -Wa,-j; fi`
diff --git a/gcc/config/m68k/x-next b/gcc/config/m68k/x-next
deleted file mode 100644
index ac101bb9ff9..00000000000
--- a/gcc/config/m68k/x-next
+++ /dev/null
@@ -1,9 +0,0 @@
-# Make assignments for compiling on NeXT with their compiler version.
-CC=cc -traditional-cpp
-OLDCC=CC -traditional-cpp
-
-# Specify other dirs of system header files to be fixed.
-OTHER_FIXINCLUDES_DIRS= /LocalDeveloper/Headers
-
-# <limits.h> is sometimes in /usr/include/ansi/limits.h.
-LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h -o -f $(SYSTEM_HEADER_DIR)/ansi/limits.h ]
diff --git a/gcc/config/m68k/x-tower b/gcc/config/m68k/x-tower
deleted file mode 100644
index 995e72b9bad..00000000000
--- a/gcc/config/m68k/x-tower
+++ /dev/null
@@ -1,9 +0,0 @@
-# On the NCR Tower 32 running SVR3, says ra@intsys.no :
-# Do *not* enable optimization in CFLAGS when using the native cc, because:
-# a) The optimizer seems to loop when invoked with -O2.
-# b) The -O1 level does stack/frame pointer optimizations that make the
-# assembler alloca in libPW.a fail, and the C alloca eats *lots* of memory.
-# c) gcc will eventually be recompiled with itself, so all this doesn't matter.
-X_CFLAGS = -O0
-CCLIBFLAGS = -O2
-CLIB = -lmalloc -lPW
diff --git a/gcc/config/m68k/xm-3b1.h b/gcc/config/m68k/xm-3b1.h
deleted file mode 100644
index 9d6ad5412a3..00000000000
--- a/gcc/config/m68k/xm-3b1.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#define USG
-
-#include "m68k/xm-m68k.h"
-
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-#define index strchr
-#define rindex strrchr
-
-/* Override part of the obstack macros. */
-
-#define __PTR_TO_INT(P) ((int)(P))
-#define __INT_TO_PTR(P) ((char *)(P))
diff --git a/gcc/config/m68k/xm-atari.h b/gcc/config/m68k/xm-atari.h
deleted file mode 100644
index a28a98606ef..00000000000
--- a/gcc/config/m68k/xm-atari.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Definitions of host machine for GNU compiler.
- Atari TT ASV version.
- Copyright (C) 1994, 1995 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 1, 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 "m68k/xm-m68kv.h" /* Use the System V flavor of m68k host */
-
-#define HAVE_VPRINTF /* Host has vprintf() in library */
-
-/* Add HZ define if missing */
-
-#ifndef HZ
-#define HZ 100 /* System clock */
-#endif
-
-/* Define FULL_PROTOTYPES for protoize.c, to get <unistd.h> included.
- We need this file for things like R_OK, not necessarily prototypes. */
-
-#define FULL_PROTOTYPES
-
-#if defined (__GNUC__) && __GNUC__ == 1
-#define alloca __builtin_alloca
-#endif
-
-/* The m88k and mips ports make use of fancy_abort to give possibly helpful
- abort information rather than just dumping core. They do it in their
- tm-* files. It seems more logical that this is a characteristic of
- the host machine and not the target machine, so we do it here. */
-
-#define abort fancy_abort /* give possibly helpful abort info */
diff --git a/gcc/config/m68k/xm-crds.h b/gcc/config/m68k/xm-crds.h
deleted file mode 100644
index 3bd3461ce10..00000000000
--- a/gcc/config/m68k/xm-crds.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#define USG
-
-#ifndef unos
-#define unos
-#endif
-
-#include "m68k/xm-m68k.h"
-
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-
-/* UNOS has vprintf() */
-#define HAVE_VPRINTF
-
-/* Avoid conflict with C library by changing name of this symbol. */
-#define gettime gcc_gettime
-
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-#endif
-
-/* Override part of the obstack macros. */
-
-#define __PTR_TO_INT(P) ((int)(P))
-#define __INT_TO_PTR(P) ((char *)(P))
diff --git a/gcc/config/m68k/xm-lynx.h b/gcc/config/m68k/xm-lynx.h
deleted file mode 100644
index 78762b3afe4..00000000000
--- a/gcc/config/m68k/xm-lynx.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Configuration for GNU C-compiler for all platforms running LynxOS.
- Copyright (C) 1993, 1995 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. */
-
-#include <xm-lynx.h>
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-
-#include "tm.h"
diff --git a/gcc/config/m68k/xm-m68k.h b/gcc/config/m68k/xm-m68k.h
deleted file mode 100644
index 757c9af67a1..00000000000
--- a/gcc/config/m68k/xm-m68k.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Configuration for GNU C-compiler for Motorola 68000 family.
- Copyright (C) 1987, 1993 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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
diff --git a/gcc/config/m68k/xm-mot3300.h b/gcc/config/m68k/xm-mot3300.h
deleted file mode 100644
index b20be33f99e..00000000000
--- a/gcc/config/m68k/xm-mot3300.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Configuration for GNU C-compiler for Motorola 68000 family.
- SysV68 Motorola 3300 Delta Series
- Copyright (C) 1994, 1995, 1996 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. */
-
-
-#define USG 1
-
-#include "m68k/xm-m68k.h"
-
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-
-#define rindex strrchr
-#define index strchr
-
-#define NO_SYS_SIGLIST
-
-/* do not use alloca from -lPW with cc, because function epilogues use %sp */
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-extern char *alloca ();
-#endif
-
-/* Override part of the obstack macros. */
-
-#define __PTR_TO_INT(P) ((int)(P))
-#define __INT_TO_PTR(P) ((char *)(P))
diff --git a/gcc/config/m68k/xm-next.h b/gcc/config/m68k/xm-next.h
deleted file mode 100644
index 5c1e89d4a28..00000000000
--- a/gcc/config/m68k/xm-next.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "m68k/xm-m68k.h"
-
-/* malloc does better with chunks the size of a page. */
-
-#define OBSTACK_CHUNK_SIZE (getpagesize ())
diff --git a/gcc/config/m68k/xm-plexus.h b/gcc/config/m68k/xm-plexus.h
deleted file mode 100644
index 6d191ceed26..00000000000
--- a/gcc/config/m68k/xm-plexus.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Host environment for 68000's running System V. */
-
-#include "m68k/xm-m68k.h"
-
-#define USG
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-
-#define rindex strrchr
-#define index strchr
-
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-#endif
-
-#ifndef _SIZE_T_
-typedef int size_t;
-#define _SIZE_T_
-#endif
diff --git a/gcc/config/m88k/dgux.h b/gcc/config/m88k/dgux.h
deleted file mode 100644
index edeffdf4f16..00000000000
--- a/gcc/config/m88k/dgux.h
+++ /dev/null
@@ -1,303 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Motorola m88100 running DG/UX.
- Copyright (C) 1988, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@mcc.com)
- Currently maintained by (gcc@dg-rtp.dg.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. */
-
-/* You're not seeing double! To transition to dwarf debugging, both are
- supported. The option -msvr4 specifies elf. With these combinations,
- -g means dwarf. */
-/* DWARF_DEBUGGING_INFO defined in svr4.h. */
-#define SDB_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE \
- (TARGET_SVR4 ? DWARF_DEBUG : SDB_DEBUG)
-
-#ifndef VERSION_INFO2
-#define VERSION_INFO2 "$Revision: 1.23 $"
-#endif
-#ifndef NO_BUGS
-#define AS_BUG_IMMEDIATE_LABEL
-/* The DG/UX 4.30 assembler doesn't accept the symbol `fcr63'. */
-#define AS_BUG_FLDCR
-#endif
-
-#include "svr4.h"
-#include "m88k/m88k.h"
-
-/* Augment TARGET_SWITCHES with the MXDB options. */
-#define MASK_STANDARD 0x40000000 /* Retain standard information */
-#define MASK_NOLEGEND 0x20000000 /* Discard legend information */
-#define MASK_EXTERNAL_LEGEND 0x10000000 /* Make external legends */
-
-#define TARGET_STANDARD (target_flags & MASK_STANDARD)
-#define TARGET_NOLEGEND (target_flags & MASK_NOLEGEND)
-#define TARGET_EXTERNAL_LEGEND (target_flags & MASK_EXTERNAL_LEGEND)
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- { "standard", MASK_STANDARD }, \
- { "legend", -MASK_NOLEGEND }, \
- { "no-legend", MASK_NOLEGEND }, \
- { "external-legend", MASK_EXTERNAL_LEGEND }, \
- /* the following is used only in the *_SPEC's */ \
- { "keep-coff", 0 },
-
-/* Default switches */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_CHECK_ZERO_DIV | \
- MASK_OCS_DEBUG_INFO | \
- MASK_OCS_FRAME_POSITION | \
- MASK_STANDARD | \
- MASK_SVR4)
-#undef CPU_DEFAULT
-#define CPU_DEFAULT MASK_88000
-
-/* Macros to be automatically defined. __svr4__ is our extension.
- __CLASSIFY_TYPE__ is used in the <varargs.h> and <stdarg.h> header
- files with DG/UX revision 5.40 and later. This allows GNU CC to
- operate without installing the header files. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dm88000 -Dm88k -Dunix -DDGUX -D__CLASSIFY_TYPE__=2\
- -D__svr4__ -Asystem(unix) -Acpu(m88k) -Amachine(m88k)"
-
-/* If -m88100 is in effect, add -Dm88100; similarly for -m88110.
- Here, the CPU_DEFAULT is assumed to be -m88000. If not -ansi,
- -traditional, or restricting include files to one specific source
- target, specify full DG/UX features. */
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %{msvr3:-D_M88KBCS_TARGET} %{!msvr3:-D_DGUX_TARGET}"
-
-/* Assembler support (-V, silicon filter, legends for mxdb). */
-#undef ASM_SPEC
-#define ASM_SPEC "%{pipe:%{!.s: - }\
- %{!msvr3:%{!m88110:-KV3 }%{m88110:-KV04.00 }}}\
- %(asm_cpu)"
-
-/* Override svr4.h. */
-#undef ASM_FINAL_SPEC
-#undef STARTFILE_SPEC
-
-/* Linker and library spec's.
- -msvr4 is the default if -msvr3 is not specified.
- -static, -shared, -symbolic, -h* and -z* access AT&T V.4 link options.
- -svr4 instructs gcc to place /usr/lib/values-X[cat].o on the link line.
- -msvr3 indicates linking done in a COFF environment and the link
- script is added to the link line. In all environments, the first
- and last objects are crtbegin.o (or bcscrtbegin.o) and crtend.o.
- When the -G link option is used (-shared and -symbolic) a final
- link is not being done. */
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s"
-#undef LIB_SPEC
-#define LIB_SPEC "%{!msvr3:%{!shared:-lstaticdgc}} %{!shared:%{!symbolic:-lc}}"
-#undef LINK_SPEC
-#define LINK_SPEC "%{z*} %{h*} %{v:-V} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy} \
- %{symbolic:-Bsymbolic -G -dy} \
- %{pg:-L/usr/lib/libp}%{p:-L/usr/lib/libp}"
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%(startfile_default)"
-
-
-/* This macro defines names of additional specifications to put in the specs
- that can be used in various specifications like CC1_SPEC. Its definition
- is an initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- specification name, and a string constant that used by the GNU CC driver
- program.
-
- Do not define this macro if it does not need to do anything. */
-
-#define EXTRA_SPECS \
- { "cpp_cpu", CPP_CPU_SPEC }, \
- { "asm_cpu", ASM_CPU_SPEC }, \
- { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
- { "startfile_crtbegin", STARTFILE_CRTBEGIN_SPEC }
-
-#define ASM_CPU_SPEC "\
- %{v:-V}\
- %{g:\
- %{mno-legend:-Wc,off}\
- %{!mno-legend:-Wc,-fix-bb,-s\"%i\"\
- %{traditional:,-lc}\
- %{!traditional:,-lansi-c}\
- %{mstandard:,-keep-std}\
- %{mexternal-legend:,-external}\
- %{mocs-frame-position:,-ocs}}}"
-
-#define CPP_CPU_SPEC "\
- %{!m88000:%{!m88100:%{m88110:-D__m88110__}}} \
- %{!m88000:%{!m88110:%{m88100:-D__m88100__}}} \
- %{!ansi:%{!traditional:-D__OPEN_NAMESPACE__}}"
-
-#define STARTFILE_DEFAULT_SPEC "\
- %{!shared:%{!symbolic:%{pg:gcrt0.o%s} \
- %{!pg:%{p:/lib/mcrt0.o}%{!p:/lib/crt0.o}} \
- %(startfile_crtbegin) \
- %{svr4:%{ansi:/lib/values-Xc.o} \
- %{!ansi:%{traditional:/lib/values-Xt.o} \
- %{!traditional:/usr/lib/values-Xa.o}}}}}"
-
-#define STARTFILE_CRTBEGIN_SPEC "\
- %{msvr3:m88kdgux.ld%s bcscrtbegin.o%s} \
- %{!msvr3:crtbegin.o%s}"
-
-#undef GPLUSPLUS_INCLUDE_DIR
-#define GPLUSPLUS_INCLUDE_DIR "/usr/opt/g++/lib/g++-include"
-
-/* Fast DG/UX version of profiler that does not require lots of
- registers to be stored. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- output_function_profiler (FILE, LABELNO, "gcc.mcount", 0)
-
-/* Output the legend info for mxdb when debugging except if standard
- debugging information only is explicitly requested. */
-#undef ASM_FIRST_LINE
-#define ASM_FIRST_LINE(FILE) \
- do { \
- if (TARGET_SVR4) \
- { \
- if (TARGET_88110) \
- fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "04.00"); \
- else \
- fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "03.00"); \
- } \
- if (write_symbols != NO_DEBUG && !TARGET_NOLEGEND) \
- { \
- fprintf (FILE, ";legend_info -fix-bb -h\"gcc-%s\" -s\"%s\"", \
- VERSION_STRING, main_input_filename); \
- fputs (flag_traditional ? " -lc" : " -lansi-c", FILE); \
- if (TARGET_STANDARD) \
- fputs (" -keep-std", FILE); \
- if (TARGET_EXTERNAL_LEGEND) \
- fputs (" -external", FILE); \
- if (TARGET_OCS_FRAME_POSITION) \
- fputs (" -ocs", FILE); \
- fputc ('\n', FILE); \
- } \
- } while (0)
-
-/* Override svr4.h. */
-#undef PTRDIFF_TYPE
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-
-/* Override svr4.h and m88k.h except when compiling crtstuff.c. These must
- be constant strings when compiling crtstuff.c. Otherwise, respect the
- -mversion-STRING option used. */
-#undef INIT_SECTION_PREAMBLE
-#undef INIT_SECTION_ASM_OP
-#undef FINI_SECTION_ASM_OP
-#undef CTORS_SECTION_ASM_OP
-#undef DTORS_SECTION_ASM_OP
-
-#if defined (CRT_BEGIN) || defined (CRT_END) || defined (L__main)
-/* routines to invoke global constructors and destructors are always COFF
- to enable linking mixed COFF and ELF objects */
-#define FINI_SECTION_ASM_OP ("section .fini,\"x\"")
-#ifndef BCS
-#define INIT_SECTION_PREAMBLE asm ("\taddu\tr31,r31,0x20")
-#endif
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP ("section\t .init,\"x\"")
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP ("section\t .ctors,\"d\"")
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP ("section\t .dtors,\"d\"")
-#undef OBJECT_FORMAT_ELF
-#else
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP (TARGET_SVR4 \
- ? "section\t .init,\"xa\"" \
- : "section\t .init,\"x\"")
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP (TARGET_SVR4 \
- ? "section\t .ctors,\"aw\"" \
- : "section\t .ctors,\"d\"")
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP (TARGET_SVR4 \
- ? "section\t .dtors,\"aw\"" \
- : "section\t .dtors,\"d\"")
-#endif /* crtstuff.c */
-
-/* The lists of global object constructors and global destructors are always
- placed in the .ctors/.dtors sections. This requires the use of a link
- script if the COFF linker is used, but otherwise COFF and ELF objects
- can be intermixed. A COFF object will pad the section to 16 bytes with
- zeros; and ELF object will not contain padding. We deal with this by
- putting a -1 marker at the begin and end of the list and ignoring zero
- entries. */
-
-/* Mark the end of the .ctors/.dtors sections with a -1. */
-
-#define CTOR_LIST_BEGIN \
-asm (CTORS_SECTION_ASM_OP); \
-func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }
-
-#define CTOR_LIST_END \
-asm (CTORS_SECTION_ASM_OP); \
-func_ptr __CTOR_END__[1] = { (func_ptr) (-1) }
-
-#define DTOR_LIST_BEGIN \
-asm (DTORS_SECTION_ASM_OP); \
-func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }
-
-#define DTOR_LIST_END \
-asm (DTORS_SECTION_ASM_OP); \
-func_ptr __DTOR_END__[1] = { (func_ptr) (-1) }
-
-/* Walk the list ignoring NULL entries till we hit the terminating -1. */
-#define DO_GLOBAL_CTORS_BODY \
- do { \
- int i; \
- for (i=1;(int)(__CTOR_LIST__[i]) != -1; i++) \
- if (((int *)__CTOR_LIST__)[i] != 0) \
- __CTOR_LIST__[i] (); \
- } while (0)
-
-/* Walk the list looking for the terminating -1 that marks the end.
- Go backward and ignore any NULL entries. */
-#define DO_GLOBAL_DTORS_BODY \
- do { \
- int i; \
- for (i=1;(int)(__DTOR_LIST__[i]) != -1; i++); \
- for (i-=1;(int)(__DTOR_LIST__[i]) != -1; i--) \
- if (((int *)__DTOR_LIST__)[i] != 0) \
- __DTOR_LIST__[i] (); \
- } while (0)
-
-/* The maximum alignment which the object file format can support.
- page alignment would seem to be enough */
-#undef MAX_OFILE_ALIGNMENT
-#define MAX_OFILE_ALIGNMENT 0x1000
-
-/* Must use data section for relocatable constants when pic. */
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE,RTX) \
-{ \
- if (flag_pic && symbolic_operand (RTX)) \
- data_section (); \
- else \
- const_section (); \
-}
diff --git a/gcc/config/m88k/dgux.ld b/gcc/config/m88k/dgux.ld
deleted file mode 100644
index 26848959c65..00000000000
--- a/gcc/config/m88k/dgux.ld
+++ /dev/null
@@ -1,48 +0,0 @@
-/* m88kdgux.ld - COFF linker directives for G++ on an AViiON
-
- 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.
-
- On The AViiON we start the output .text section somewhere after the
- first 64kb (0x10000) of logical address space so that the first
- 64kb can be mapped out, thus catching references through null
- pointers. We actually start at 0x10200 (for efficiency). Ideally,
- we want the page offset of a given word of the .text (output)
- section to be the same as it's page offset in the actual (output)
- linked core file so that paging of the .text section is efficient.
- In order to do this we allow for up to 0x200 bytes of header stuff
- in the output (linked) object file.
-
- For .data, the OCS says that regions with different "protections"
- (i.e. read/write, read-only) should not share any 4 megabyte chunk
- of the logical address space, so we start the .data segment at the
- first (lowest) 4 MB boundary past the end of the .text segment.
-
- For some reason, you can't start right at the 4 MB boundary. You
- have to start at some distance past that. The distance must be
- equal to the distance from the start of the last 64 KB segment in
- the (output) .text segment to the actual end of the (output) .text
- segment. */
-
-SECTIONS {
- .text 0x10200 BLOCK(0x200) :
- { *(.init) *(.initp) *(.finip) *(.text) *(.tdesc) }
-
- GROUP BIND (((((ADDR(.text) + SIZEOF(.text) - 1) / 0x400000) + 1) * 0x400000) + ((ADDR(.text) + SIZEOF (.text)) % 0x10000)) :
- { .data : { *(.data) *(.ctors) *(.dtors) }
- .bss : {} }
-}
diff --git a/gcc/config/m88k/dguxbcs.h b/gcc/config/m88k/dguxbcs.h
deleted file mode 100644
index 00ef9b3a289..00000000000
--- a/gcc/config/m88k/dguxbcs.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Motorola m88100 running DG/UX.
- Copyright (C) 1988, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@mcc.com)
- Currently maintained by (gcc@dg-rtp.dg.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 "m88k/dgux.h"
-
-/* dgux.h builds an elf gcc which compiles elf objects by default.
- dguxbcs.h builds a bcs gcc which compiles bcs objects by default.
- The default can be overridden in either case with -msvr3 and -msvr4 */
-
-/* Default switches */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_CHECK_ZERO_DIV | \
- MASK_OCS_DEBUG_INFO | \
- MASK_OCS_FRAME_POSITION | \
- MASK_SVR3)
-
-/* Assembler support (-V, silicon filter, legends for mxdb). */
-#undef ASM_SPEC
-#define ASM_SPEC "%{pipe:%{!.s: - }\
- %{msvr4:%{!m88110:-KV3 }%{m88110:-KV04.00 }}}\
- %(asm_cpu)"
-
-/* If -m88100 is in effect, add -Dm88100; similarly for -m88110.
- Here, the CPU_DEFAULT is assumed to be -m88000. If not -ansi,
- -traditional, or restricting include files to one specific source
- target, specify full DG/UX features. */
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu)
- %{!msvr4:-D_M88KBCS_TARGET} %{msvr4:-D_DGUX_TARGET}"
-
-/* Linker and library spec's.
- -msvr3 is the default if -msvr4 is not specified. */
-#undef LIB_SPEC
-#define LIB_SPEC "%{msvr4:%{!shared:-lstaticdgc}} %{!shared:%{!symbolic:-lc}}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%(startfile_default)"
-
-#undef STARTFILE_CRTBEGIN_SPEC
-#define STARTFILE_CRTBEGIN_SPEC "\
- %{!msvr4:m88kdgux.ld%s bcscrtbegin.o%s} \
- %{msvr4:crtbegin.o%s}"
diff --git a/gcc/config/m88k/dolph.h b/gcc/config/m88k/dolph.h
deleted file mode 100644
index 48c0378636a..00000000000
--- a/gcc/config/m88k/dolph.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Motorola m88100 running the Dolphin UNIX System V/88 Release 3.2,
- Version 3.8/7.83 and 3.6/5.86
- Copyright (C) 1992, 1993 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. */
-
-#include "m88k/sysv3.h"
-
-#define SDB_ALLOW_FORWARD_REFERENCES
-#define SDB_ALLOW_UNKNOWN_REFERENCES
-
-/* Override m88k/sysv3.h */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dm88000 -Dm88k -DOCS88 -DDOLPHIN -Dunix -DsysV88 -D__CLASSIFY_TYPE__=2 -Asystem(unix) -Asystem(svr3) -Acpu(m88k) -Amachine(m88k)"
-
-/*
- If you want to detect dereferencing of NULL pointers, uncomment the
- following two lines. Alternatively, edit the appropriate specs file.
-
- #undef LINK_SPEC
- #define LINK_SPEC "gcc.ld%s"
-
- */
-
-#undef CPU_DEFAULT
-#define CPU_DEFAULT MASK_88000
-
-#undef INITIALIZE_TRAMPOLINE
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 40)), FNADDR); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 36)), CXT); \
- emit_call_insn (gen_call( gen_rtx (MEM, SImode, \
- gen_rtx(SYMBOL_REF,Pmode, \
- "__enable_execute_stack")), \
- const0_rtx)); \
-}
diff --git a/gcc/config/m88k/dolphin.ld b/gcc/config/m88k/dolphin.ld
deleted file mode 100644
index ce5c8f0aa7b..00000000000
--- a/gcc/config/m88k/dolphin.ld
+++ /dev/null
@@ -1,40 +0,0 @@
-/* COFF linker directives for the Dolphin Triton88 for GNU compiler.
- Copyright (C) 1993 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 does the following:
-
- - Sets VIRTUAL addr of .text to 0x400200
- Sets FILE addr of .text to 0x200 (BLOCK directive)
- - Depending on size of .text section rounds up to next
- 4 MG boundary, adds (size of .text and vaddr of .text) mod 64K
- This is to handle sections larger than 4 MG. */
-
-SECTIONS {
- .text 0x400200 BLOCK (0x200):
- { *(.init) *(.text) *(.rodata) *(.tdesc) *(.fini)}
-
- GROUP BIND( (((SIZEOF(.text)+ADDR(.text)) / 0x400000 * 0x400000) + 0x400000) +
- ((SIZEOF(.text) + ADDR(.text)) % 0x10000) ) :
- {
- .data : { }
- .bss : { }
- }
-}
diff --git a/gcc/config/m88k/luna.h b/gcc/config/m88k/luna.h
deleted file mode 100644
index 677afcdae56..00000000000
--- a/gcc/config/m88k/luna.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Motorola m88100 running Omron Luna/88k.
- Copyright (C) 1991 Free Software Foundation, Inc.
- Contributed by Jeffery Friedl (jfriedl@omron.co.jp)
-
-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 Omron Luna/88k is MACH and uses BSD a.out, not COFF or ELF. */
-#ifndef MACH
-#define MACH
-#endif
-#define DBX_DEBUGGING_INFO
-#define DEFAULT_GDB_EXTENSIONS 0
-
-#include "aoutos.h"
-#include "m88k/m88k.h"
-
-/* Identify the compiler. */
-#undef VERSION_INFO1
-#define VERSION_INFO1 "Omron Luna/88k, "
-
-/* Macros to be automatically defined. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-DMACH -Dm88k -Dunix -Dluna -Dluna88k -D__CLASSIFY_TYPE__=2 -Asystem(unix) -Asystem(mach) -Acpu(m88k) -Amachine(m88k)"
-
-/* If -m88000 is in effect, add -Dmc88000; similarly for -m88100 and -m88110.
- However, reproduce the effect of -Dmc88100 previously in CPP_PREDEFINES.
- Here, the CPU_DEFAULT is assumed to be -m88100. */
-#undef CPP_SPEC
-#define CPP_SPEC "%{m88000:-D__mc88000__} \
- %{!m88000:%{m88100:%{m88110:-D__mc88000__}}} \
- %{!m88000:%{!m88100:%{m88110:-D__mc88110__}}} \
- %{!m88000:%{!m88110:%{!ansi:%{traditional:-Dmc88100}} \
- -D__mc88100__ -D__mc88100}}"
-
-/* Specify extra dir to search for include files. */
-#undef SYSTEM_INCLUDE_DIR
-#define SYSTEM_INCLUDE_DIR "/usr/mach/include"
-
-/* For the Omron Luna/88k, a float function returns a double in traditional
- mode (and a float in ansi mode). */
-#undef TRADITIONAL_RETURN_FLOAT
diff --git a/gcc/config/m88k/m88k-aout.h b/gcc/config/m88k/m88k-aout.h
deleted file mode 100644
index 90f3fe73519..00000000000
--- a/gcc/config/m88k/m88k-aout.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Definitions for "naked" Motorola 88k using a.out object format files
- and stabs debugging info.
-
- Copyright (C) 1994 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. */
-
-#undef SDB_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-
-#include "m88k/m88k.h"
-#include "aoutos.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dm88000 -Dm88k -Acpu(m88k) -Amachine(m88k)"
-
-/* end of m88k-aout.h */
diff --git a/gcc/config/m88k/m88k-coff.h b/gcc/config/m88k/m88k-coff.h
deleted file mode 100644
index d32e1d97787..00000000000
--- a/gcc/config/m88k/m88k-coff.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Definitions for "naked" Motorola 88k using coff object format files
- and coff debugging info.
-
- Copyright (C) 1994, 1996 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. */
-
-#include "m88k/m88k.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dm88000 -Dm88k -Acpu(m88k) -Amachine(m88k)"
-
-#define SDB_DEBUGGING_INFO
-
-/* Output DBX (stabs) debugging information if using -gstabs. */
-
-#include "dbxcoff.h"
-
-/* end of m88k-coff.h */
diff --git a/gcc/config/m88k/m88k-move.sh b/gcc/config/m88k/m88k-move.sh
deleted file mode 100755
index 7da45a64096..00000000000
--- a/gcc/config/m88k/m88k-move.sh
+++ /dev/null
@@ -1,306 +0,0 @@
-#!/bin/sh
-#
-# If your shell doesn't support functions (true for some BSD users),
-# you might try using GNU's bash.
-#
-#ident "@(#) m88k-move.sh 1-Sep-92"
-#
-# This file provided by Data General, February 1990.
-#
-# This script generates the necessary movstr library functions
-# for the m88100. These functions are called from the expansion
-# of movstrsi. There are eight modules created by this script,
-# each with multiple entry points. One module, moveSI64n
-# implements a word aligned loop; the other modules, moveXINx
-# implement a straight line copy of N bytes in mode XI.
-#
-# By analysis of the best memcpy function, it can be determined
-# what appear to be certain magic numbers. For example, a
-# memcpy of 13 bytes, where the pointers are determined at run
-# time to be word aligned takes 28 cycles. A call to
-# __movstrQI13x13 also takes 28 cycles. The break even point
-# for a HImode copy is 38 bytes. Just to be on the safe side,
-# these are bumped to 16 and 48 respectively.
-#
-# The smaller, odd-remainder modules are provided to help
-# mitigate the overhead of copying the last bytes.
-#
-# Changes to these functions should not be taken lightly if you
-# want to be able to link programs built with older movstr
-# parameters.
-#
-#.Revision History
-#
-# 1-Sep-92 Stan Cox Added moveDI96x, moveDI41x through moveDI47x.
-# 2-Jan-92 Tom Wood Renamed files to comply with SVR3 14 char limit.
-# 26-Oct-90 Tom Wood Delete movstr.h; moved to out-m88k.c.
-# 17-Oct-90 Tom Wood Files are named *.asm rather than *.s.
-# 11-Sep-90 Jeffrey Friedl
-# On my BSD 4.3 awk and my GNU-awk, only the
-# first character of an argument to -F is passed
-# through, so I can't get this to work.
-# 5-Sep-90 Ray Essick/Tom Wood
-# Added a -no-tdesc option.
-# 27-Aug-90 Vince Guarna/Tom Wood
-# Version 3 assembler syntax (-abi).
-# 16-Aug-90 Ron Guilmette
-# Avoid problems on a Sparc. The common
-# denominator among shells seems to be '...\'
-# rather than '...\\'.
-# 15-Aug-90 Ron Guilmette
-# Avoid awk syntax errors on a Sun by not using
-# the `!' operator.
-# 22-Feb-90 Tom Wood Created.
-# 20-Jun-90 Tom Wood Emit file directives.
-#
-#.End]=--------------------------------------------------------------*/
-
-usage() {
- echo "usage: $0 [ -abi ] [ -no-tdesc ]" 1>&2
- exit 1
-}
-
-awk_flag="-F:";
-awk_begin="BEGIN { "
-ps=""; us="_"; tf="x"; la="@L"; fb="8"; nt="";
-do_file() {
- echo " file $1";
-}
-
-while [ $# -gt 0 ] ; do
- case $1 in
- -no-tdesc) awk_begin="$awk_begin no_tdesc=1;"
- nt=";";;
- -abi) awk_begin="$awk_begin abi=1;"
- ps="#"; us=""; tf="a"; la=".L"; fb="16";
- do_file() {
- echo ' version "03.00"';
- echo " file $1";
- };;
- *) usage;;
- esac
- shift
-done
-
-rm -f move?I*[xn].s move?I*[xn].asm
-
-#.Implementation_continued[=-----------------------------------------------
-#
-# This generates the word aligned loop. The loop is entered
-# from the callable entry points ___movstrSI64nN, where at
-# least N bytes will be copied. r2 is the destination pointer
-# offset by 4, r3 is the source pointer offset by 4, r6 is the
-# loop count. Thus, the total bytes moved is 64 * r6 + N. The
-# first value is is preloaded into r4 or r5 (r4 if N/4 is odd;
-# r5 if N/4 is even). Upon returning, r2 and r3 have been
-# updated and may be used for the remainder bytes to move.
-#
-# The code for this loop is generated by the awk program
-# following. Edit *it*, not what it generates!
-#
-#.End]=------------------------------------------------------------------*/
-
-gen_movstrN() {
- awk $awk_flag "$awk_begin"'
- if (abi) {
- ps="#"; us=""; tf="a"; la=".L"; fb=16;
- } else {
- ps=""; us="_"; tf="x"; la="@L"; fb=8;
- }
- }
- NR == 1 && NF == 4 {
- mode = $1; suffix = $2; align = $3; count = $4;
- ld = align; st = 0;
-
- printf "; The following was calculated using awk.\n";
- printf "\ttext\n";
- printf "\talign\t%d\n", fb;
- printf "%sloop%s%d:\n", la, mode, count * align;
- printf "\taddu\t%sr3,%sr3,%d\n", ps, ps, count * align;
- printf "\taddu\t%sr2,%sr2,%d\n", ps, ps, count * align;
- printf "\tsubu\t%sr6,%sr6,1\n", ps, ps;
- for (r = count + 1; r >= 1; r--) {
- evenp = r % 2;
- name = sprintf("__%smovstr%s%dn%d", us, mode, count * align, r * align);
- if (r > 1) {
- printf "\tglobal\t%s\n", name;
- printf "%s:\n", name;
- }
- if (r > 2) {
- printf "\tld%s\t%sr%d,%sr3,%d\n", suffix, ps, 4 + evenp, ps, ld;
- printf "\tst%s\t%sr%d,%sr2,%d\n", suffix, ps, 5 - evenp, ps, st;
- } else if (r == 2) {
- printf "\tld%s\t%sr%d,%sr3,%d\n", suffix, ps, 4 + evenp, ps, ld;
- printf "\tbcnd.n\t%sgt0,%sr6,%sloop%s%d\n", ps, ps, la, mode, count * align;
- printf "\tst%s\t%sr%d,%sr2,%d\n", suffix, ps, 5 - evenp, ps, st;
- printf "\tjmp.n\t%sr1\n", ps;
- } else {
- printf "\tst%s\t%sr%d,%sr2,%d\n", suffix, ps, 5 - evenp, ps, st;
- }
- ld += align; st += align;
- }
- if (!no_tdesc) {
- printf "%send%s%d:\n", la, mode, count * align;
- printf "\tsection\t.tdesc,\"%s\"\n", tf;
- printf "\tword\t0x42,1,%sloop%s%d", la, mode, count * align;
- printf ",%send%s%d\n", la, mode, count * align;
- printf "\tword\t0x0100001f,0,1,0\n";
- printf "\ttext\n";
- }
- printf "; End of awk generated code.\n";
- exit;
- }'
-}
-
-(do_file '"movstrSI64n.s"';
- echo 'SI::4:16' | gen_movstrN) > moveSI64n.asm
-
-#.Implementation_continued[=-----------------------------------------------
-#
-# This generates the even-remainder, straight-line modules.
-# The code is entered from the callable entry points
-# ___movstrXINxM, where exactly M bytes will be copied in XI
-# mode. r2 is the destination pointer, r3 is the source
-# pointer, neither being offset. The first value is preloaded
-# into r4 or r5 (r4 if M-N/B is even; r5 if M-N/B is odd, where
-# B is the mode size of XI). Upon returning, r2 and r3 have not
-# been changed.
-#
-# The code for these cases is generated by the awk program
-# following. Edit *it*, not what it generates!
-#
-#.End]=------------------------------------------------------------------*/
-
-gen_movstrX0() {
- awk $awk_flag "$awk_begin"'
- if (abi) {
- ps="#"; us=""; tf="a"; la=".L"; fb=16;
- } else {
- ps=""; us="_"; tf="x"; la="@L"; fb=8;
- }
- }
- NR == 1 && NF == 4 {
- mode = $1; suffix = $2; align = $3; bytes = $4;
- ld = align; st = 0; count = bytes / align;
- reg[0] = 4; if (align == 8) reg[1] = 6; else reg[1] = 5;
- printf "; The following was calculated using awk.\n";
- printf "\ttext\n";
- printf "\talign\t%d\n", fb;
- for (r = count; r >= 1; r--) {
- evenp = r % 2;
- name = sprintf("__%smovstr%s%dx%d", us, mode, count * align, r * align);
- if (r > 1) {
- printf "\tglobal\t%s\n", name;
- printf "%s:\n", name;
- }
- if (r == 1)
- printf "\tjmp.n\t%sr1\n", ps;
- else
- printf "\tld%s\t%sr%d,%sr3,%d\n", suffix, ps, reg[evenp], ps, ld;
- printf "\tst%s\t%sr%d,%sr2,%d\n", suffix, ps, reg[1-evenp], ps, st;
- ld += align; st += align;
- }
- if (!no_tdesc) {
- printf "%send%s%dx:\n", la, mode, count * align;
- printf "\tsection\t.tdesc,\"%s\"\n", tf;
- printf "\tword\t0x42,1,__%smovstr%s%dx%d", us, mode, count * align, count * align;
- printf ",%send%s%dx\n", la, mode, count * align;
- printf "\tword\t0x0100001f,0,1,0\n";
- printf "\ttext\n";
- }
- printf "; End of awk generated code.\n"
- exit;
- }'
-}
-
-(do_file '"movstrQI16x.s"';
- echo 'QI:.b:1:16' | gen_movstrX0) > moveQI16x.asm
-(do_file '"movstrHI48x.s"';
- echo 'HI:.h:2:48' | gen_movstrX0) > moveHI48x.asm
-(do_file '"movstrSI96x.s"';
- echo 'SI::4:96' | gen_movstrX0) > moveSI96x.asm
-(do_file '"movstrDI96x.s"';
- echo 'DI:.d:8:96' | gen_movstrX0) > moveDI96x.asm
-
-#.Implementation_continued[=-----------------------------------------------
-#
-# This generates the odd-remainder, straight-line modules. The
-# interface is the same as that for the even-remainder modules.
-#
-#.End]=------------------------------------------------------------------*/
-
-gen_movstrXr() {
- awk $awk_flag "$awk_begin"'
- if (abi) {
- ps="#"; us=""; tf="a"; la=".L"; fb=16;
- } else {
- ps=""; us="_"; tf="x"; la="@L"; fb=8;
- }
- }
- NR == 1 && NF == 4 {
- mode = $1; rem = $2; most = $3; count = $4;
- suffix[1] = ".b"; suffix[2] = ".h"; suffix[4] = ""; suffix[8] = ".d";
-
- prev = align = most;
- ld = align; st = 0; total = count - rem - most;
- evenp = int(total/align) % 2;
- reg[0] = 4; if (align == 8) reg[1] = 6; else reg[1] = 5;
- printf "; The following was calculated using awk.\n";
- printf "\ttext\n";
- printf "\talign\t%d\n", fb;
- for (bytes = total; bytes >= 0; bytes -= align) {
- if (bytes < align) {
- if (bytes >= 4) align = 4;
- else if (bytes >= 2) align = 2;
- else align = 1;
- }
- name = sprintf("__%smovstr%s%dx%d", us, mode, total + most, bytes + most);
- if (bytes > most) {
- printf "\tglobal\t%s\n", name;
- printf "%s:\n", name;
- }
- if (bytes == 0)
- printf "\tjmp.n\t%sr1\n", ps;
- else
- printf "\tld%s\t%sr%d,%sr3,%d\n", suffix[align], ps, reg[evenp], ps, ld;
- printf "\tst%s\t%sr%d,%sr2,%d\n", suffix[prev], ps, reg[1-evenp], ps, st;
- ld += align; st += prev; prev = align;
- evenp = 1 - evenp;
- }
- if (!no_tdesc) {
- printf "%send%s%dx:\n", la, mode, total + most;
- printf "\tsection\t.tdesc,\"%s\"\n", tf;
- printf "\tword\t0x42,1,__%smovstr%s%dx%d", us, mode, total + most, total + most;
- printf ",%send%s%dx\n", la, mode, total + most;
- printf "\tword\t0x0100001f,0,1,0\n";
- printf "\ttext\n";
- }
- printf "; End of awk generated code.\n"
- exit;
- }'
-}
-
-(do_file '"movstrDI47x.s"';
- echo 'DI:1:8:48' | gen_movstrXr) > moveDI47x.asm
-(do_file '"movstrDI46x.s"';
- echo 'DI:2:8:48' | gen_movstrXr) > moveDI46x.asm
-(do_file '"movstrDI45x.s"';
- echo 'DI:3:8:48' | gen_movstrXr) > moveDI45x.asm
-(do_file '"movstrDI44x.s"';
- echo 'DI:4:8:48' | gen_movstrXr) > moveDI44x.asm
-(do_file '"movstrDI43x.s"';
- echo 'DI:5:8:48' | gen_movstrXr) > moveDI43x.asm
-(do_file '"movstrDI42x.s"';
- echo 'DI:6:8:48' | gen_movstrXr) > moveDI42x.asm
-(do_file '"movstrDI41x.s"';
- echo 'DI:7:8:48' | gen_movstrXr) > moveDI41x.asm
-
-(do_file '"movstrSI47x.s"';
- echo 'SI:1:4:48' | gen_movstrXr) > moveSI47x.asm
-(do_file '"movstrSI46x.s"';
- echo 'SI:2:4:48' | gen_movstrXr) > moveSI46x.asm
-(do_file '"movstrSI45x.s"';
- echo 'SI:3:4:48' | gen_movstrXr) > moveSI45x.asm
-
-(do_file '"movstrHI15x.s"';
- echo 'HI:1:2:16' | gen_movstrXr) > moveHI15x.asm
diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c
deleted file mode 100644
index b3138376b66..00000000000
--- a/gcc/config/m88k/m88k.c
+++ /dev/null
@@ -1,3148 +0,0 @@
-/* Subroutines for insn-output.c for Motorola 88000.
- Copyright (C) 1988, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@mcc.com)
- Currently maintained by (gcc@dg-rtp.dg.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 <stdio.h>
-#include <sys/types.h>
-#include <time.h>
-#include <ctype.h>
-
-#include "assert.h"
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "tree.h"
-#include "c-tree.h"
-#include "expr.h"
-#include "flags.h"
-
-extern char *version_string;
-extern time_t time ();
-extern char *ctime ();
-extern int flag_traditional;
-extern FILE *asm_out_file;
-
-static char out_rcs_id[] = "$What: <@(#) m88k.c,v 1.8> $";
-static char tm_rcs_id [] = TM_RCS_ID;
-
-char *m88k_pound_sign = ""; /* Either # for SVR4 or empty for SVR3 */
-char *m88k_short_data;
-char *m88k_version;
-char m88k_volatile_code;
-
-unsigned m88k_gp_threshold = 0;
-int m88k_prologue_done = 0; /* Ln directives can now be emitted */
-int m88k_function_number = 0; /* Counter unique to each function */
-int m88k_fp_offset = 0; /* offset of frame pointer if used */
-int m88k_stack_size = 0; /* size of allocated stack (including frame) */
-int m88k_case_index;
-
-rtx m88k_compare_reg; /* cmp output pseudo register */
-rtx m88k_compare_op0; /* cmpsi operand 0 */
-rtx m88k_compare_op1; /* cmpsi operand 1 */
-
-enum processor_type m88k_cpu; /* target cpu */
-
-/* Determine what instructions are needed to manufacture the integer VALUE
- in the given MODE. */
-
-enum m88k_instruction
-classify_integer (mode, value)
- enum machine_mode mode;
- register int value;
-{
- register int mask;
-
- if (value == 0)
- return m88k_zero;
- else if (SMALL_INTVAL (value))
- return m88k_or;
- else if (SMALL_INTVAL (-value))
- return m88k_subu;
- else if (mode == HImode)
- return m88k_or_lo16;
- else if (mode == QImode)
- return m88k_or_lo8;
- else if ((value & 0xffff) == 0)
- return m88k_oru_hi16;
- else if (integer_ok_for_set (value))
- return m88k_set;
- else
- return m88k_oru_or;
-}
-
-/* Return the bit number in a compare word corresponding to CONDITION. */
-
-int
-condition_value (condition)
- rtx condition;
-{
- switch (GET_CODE (condition))
- {
- case EQ: return 2;
- case NE: return 3;
- case GT: return 4;
- case LE: return 5;
- case LT: return 6;
- case GE: return 7;
- case GTU: return 8;
- case LEU: return 9;
- case LTU: return 10;
- case GEU: return 11;
- default: abort ();
- }
-}
-
-int
-integer_ok_for_set (value)
- register unsigned value;
-{
- /* All the "one" bits must be contiguous. If so, MASK + 1 will be
- a power of two or zero. */
- register unsigned mask = (value | (value - 1));
- return (value && POWER_OF_2_or_0 (mask + 1));
-}
-
-char *
-output_load_const_int (mode, operands)
- enum machine_mode mode;
- rtx *operands;
-{
- static char *patterns[] =
- { "or %0,%#r0,0",
- "or %0,%#r0,%1",
- "subu %0,%#r0,%n1",
- "or %0,%#r0,%h1",
- "or %0,%#r0,%q1",
- "set %0,%#r0,%s1",
- "or.u %0,%#r0,%X1",
- "or.u %0,%#r0,%X1\n\tor %0,%0,%x1",
- };
-
- if (! REG_P (operands[0])
- || GET_CODE (operands[1]) != CONST_INT)
- abort ();
- return patterns[classify_integer (mode, INTVAL (operands[1]))];
-}
-
-/* These next two routines assume that floating point numbers are represented
- in a manner which is consistent between host and target machines. */
-
-char *
-output_load_const_float (operands)
- rtx *operands;
-{
- /* These can return 0 under some circumstances when cross-compiling. */
- operands[0] = operand_subword (operands[0], 0, 0, SFmode);
- operands[1] = operand_subword (operands[1], 0, 0, SFmode);
-
- return output_load_const_int (SImode, operands);
-}
-
-char *
-output_load_const_double (operands)
- rtx *operands;
-{
- rtx latehalf[2];
-
- /* These can return zero on some cross-compilers, but there's nothing
- we can do about it. */
- latehalf[0] = operand_subword (operands[0], 1, 0, DFmode);
- latehalf[1] = operand_subword (operands[1], 1, 0, DFmode);
-
- operands[0] = operand_subword (operands[0], 0, 0, DFmode);
- operands[1] = operand_subword (operands[1], 0, 0, DFmode);
-
- output_asm_insn (output_load_const_int (SImode, operands), operands);
-
- operands[0] = latehalf[0];
- operands[1] = latehalf[1];
-
- return output_load_const_int (SImode, operands);
-}
-
-char *
-output_load_const_dimode (operands)
- rtx *operands;
-{
- rtx latehalf[2];
-
- latehalf[0] = operand_subword (operands[0], 1, 0, DImode);
- latehalf[1] = operand_subword (operands[1], 1, 0, DImode);
-
- operands[0] = operand_subword (operands[0], 0, 0, DImode);
- operands[1] = operand_subword (operands[1], 0, 0, DImode);
-
- output_asm_insn (output_load_const_int (SImode, operands), operands);
-
- operands[0] = latehalf[0];
- operands[1] = latehalf[1];
-
- return output_load_const_int (SImode, operands);
-}
-
-/* Emit insns to move operands[1] into operands[0].
-
- Return 1 if we have written out everything that needs to be done to
- do the move. Otherwise, return 0 and the caller will emit the move
- normally.
-
- SCRATCH if non zero can be used as a scratch register for the move
- operation. It is provided by a SECONDARY_RELOAD_* macro if needed. */
-
-int
-emit_move_sequence (operands, mode, scratch)
- rtx *operands;
- enum machine_mode mode;
- rtx scratch;
-{
- register rtx operand0 = operands[0];
- register rtx operand1 = operands[1];
-
- if (CONSTANT_P (operand1) && flag_pic
- && pic_address_needs_scratch (operand1))
- operands[1] = operand1 = legitimize_address (1, operand1, 0, 0);
-
- /* Handle most common case first: storing into a register. */
- if (register_operand (operand0, mode))
- {
- if (register_operand (operand1, mode)
- || (GET_CODE (operand1) == CONST_INT && SMALL_INT (operand1))
- || GET_CODE (operand1) == HIGH
- /* Only `general_operands' can come here, so MEM is ok. */
- || GET_CODE (operand1) == MEM)
- {
- /* Run this case quickly. */
- emit_insn (gen_rtx (SET, VOIDmode, operand0, operand1));
- return 1;
- }
- }
- else if (GET_CODE (operand0) == MEM)
- {
- if (register_operand (operand1, mode)
- || (operand1 == const0_rtx && GET_MODE_SIZE (mode) <= UNITS_PER_WORD))
- {
- /* Run this case quickly. */
- emit_insn (gen_rtx (SET, VOIDmode, operand0, operand1));
- return 1;
- }
- if (! reload_in_progress && ! reload_completed)
- {
- operands[0] = validize_mem (operand0);
- operands[1] = operand1 = force_reg (mode, operand1);
- }
- }
-
- /* Simplify the source if we need to. */
- if (GET_CODE (operand1) != HIGH && immediate_operand (operand1, mode))
- {
- if (GET_CODE (operand1) != CONST_INT
- && GET_CODE (operand1) != CONST_DOUBLE)
- {
- rtx temp = ((reload_in_progress || reload_completed)
- ? operand0 : 0);
- operands[1] = legitimize_address (flag_pic
- && symbolic_address_p (operand1),
- operand1, temp, scratch);
- if (mode != SImode)
- operands[1] = gen_rtx (SUBREG, mode, operands[1], 0);
- }
- }
-
- /* Now have insn-emit do whatever it normally does. */
- return 0;
-}
-
-/* Return a legitimate reference for ORIG (either an address or a MEM)
- using the register REG. If PIC and the address is already
- position-independent, use ORIG. Newly generated position-independent
- addresses go into a reg. This is REG if non zero, otherwise we
- allocate register(s) as necessary. If this is called during reload,
- and we need a second temp register, then we use SCRATCH, which is
- provided via the SECONDARY_INPUT_RELOAD_CLASS mechanism. */
-
-struct rtx_def *
-legitimize_address (pic, orig, reg, scratch)
- int pic;
- rtx orig;
- rtx reg;
- rtx scratch;
-{
- rtx addr = (GET_CODE (orig) == MEM ? XEXP (orig, 0) : orig);
- rtx new = orig;
- rtx temp, insn;
-
- if (pic)
- {
- if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
- {
- if (reg == 0)
- {
- if (reload_in_progress || reload_completed)
- abort ();
- else
- reg = gen_reg_rtx (Pmode);
- }
-
- if (flag_pic == 2)
- {
- /* If not during reload, allocate another temp reg here for
- loading in the address, so that these instructions can be
- optimized properly. */
- temp = ((reload_in_progress || reload_completed)
- ? reg : gen_reg_rtx (Pmode));
-
- emit_insn (gen_rtx (SET, VOIDmode, temp,
- gen_rtx (HIGH, SImode,
- gen_rtx (UNSPEC, SImode,
- gen_rtvec (1, addr),
- 0))));
- emit_insn (gen_rtx (SET, VOIDmode, temp,
- gen_rtx (LO_SUM, SImode, temp,
- gen_rtx (UNSPEC, SImode,
- gen_rtvec (1, addr),
- 0))));
- addr = temp;
- }
- new = gen_rtx (MEM, Pmode,
- gen_rtx (PLUS, SImode,
- pic_offset_table_rtx, addr));
- current_function_uses_pic_offset_table = 1;
- RTX_UNCHANGING_P (new) = 1;
- insn = emit_move_insn (reg, new);
- /* Put a REG_EQUAL note on this insn, so that it can be optimized
- by loop. */
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL, orig,
- REG_NOTES (insn));
- new = reg;
- }
- else if (GET_CODE (addr) == CONST)
- {
- rtx base, offset;
-
- if (GET_CODE (XEXP (addr, 0)) == PLUS
- && XEXP (XEXP (addr, 0), 0) == pic_offset_table_rtx)
- return orig;
-
- if (reg == 0)
- {
- if (reload_in_progress || reload_completed)
- abort ();
- else
- reg = gen_reg_rtx (Pmode);
- }
-
- if (GET_CODE (XEXP (addr, 0)) != PLUS) abort ();
-
- base = legitimize_address (1, XEXP (XEXP (addr, 0), 0), reg, 0);
- addr = legitimize_address (1, XEXP (XEXP (addr, 0), 1),
- base == reg ? 0 : reg, 0);
-
- if (GET_CODE (addr) == CONST_INT)
- {
- if (ADD_INT (addr))
- return plus_constant_for_output (base, INTVAL (addr));
- else if (! reload_in_progress && ! reload_completed)
- addr = force_reg (Pmode, addr);
- /* We can't create any new registers during reload, so use the
- SCRATCH reg provided by the reload_insi pattern. */
- else if (scratch)
- {
- emit_move_insn (scratch, addr);
- addr = scratch;
- }
- else
- /* If we reach here, then the SECONDARY_INPUT_RELOAD_CLASS
- macro needs to be adjusted so that a scratch reg is provided
- for this address. */
- abort ();
- }
- new = gen_rtx (PLUS, SImode, base, addr);
- /* Should we set special REG_NOTEs here? */
- }
- }
- else if (! SHORT_ADDRESS_P (addr, temp))
- {
- if (reg == 0)
- {
- if (reload_in_progress || reload_completed)
- abort ();
- else
- reg = gen_reg_rtx (Pmode);
- }
-
- emit_insn (gen_rtx (SET, VOIDmode,
- reg, gen_rtx (HIGH, SImode, addr)));
- new = gen_rtx (LO_SUM, SImode, reg, addr);
- }
-
- if (new != orig
- && GET_CODE (orig) == MEM)
- {
- new = gen_rtx (MEM, GET_MODE (orig), new);
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (orig);
- MEM_VOLATILE_P (new) = MEM_VOLATILE_P (orig);
- MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (orig);
- }
- return new;
-}
-
-/* Support functions for code to emit a block move. There are four methods
- used to perform the block move:
- + call memcpy
- + call the looping library function, e.g. __movstrSI64n8
- + call a non-looping library function, e.g. __movstrHI15x11
- + produce an inline sequence of ld/st instructions
-
- The parameters below describe the library functions produced by
- movstr-m88k.sh. */
-
-#define MOVSTR_LOOP 64 /* __movstrSI64n68 .. __movstrSI64n8 */
-#define MOVSTR_QI 16 /* __movstrQI16x16 .. __movstrQI16x2 */
-#define MOVSTR_HI 48 /* __movstrHI48x48 .. __movstrHI48x4 */
-#define MOVSTR_SI 96 /* __movstrSI96x96 .. __movstrSI96x8 */
-#define MOVSTR_DI 96 /* __movstrDI96x96 .. __movstrDI96x16 */
-#define MOVSTR_ODD_HI 16 /* __movstrHI15x15 .. __movstrHI15x5 */
-#define MOVSTR_ODD_SI 48 /* __movstrSI47x47 .. __movstrSI47x11,
- __movstrSI46x46 .. __movstrSI46x10,
- __movstrSI45x45 .. __movstrSI45x9 */
-#define MOVSTR_ODD_DI 48 /* __movstrDI47x47 .. __movstrDI47x23,
- __movstrDI46x46 .. __movstrDI46x22,
- __movstrDI45x45 .. __movstrDI45x21,
- __movstrDI44x44 .. __movstrDI44x20,
- __movstrDI43x43 .. __movstrDI43x19,
- __movstrDI42x42 .. __movstrDI42x18,
- __movstrDI41x41 .. __movstrDI41x17 */
-
-/* Limits for using the non-looping movstr functions. For the m88100
- processor, we assume the source and destination are word aligned.
- The QImode and HImode limits are the break even points where memcpy
- does just as well and beyond which memcpy does better. For the
- m88110, we tend to assume double word alignment, but also analyze
- the word aligned cases. The analysis is complicated because memcpy
- may use the cache control instructions for better performance. */
-
-#define MOVSTR_QI_LIMIT_88100 13
-#define MOVSTR_HI_LIMIT_88100 38
-#define MOVSTR_SI_LIMIT_88100 MOVSTR_SI
-#define MOVSTR_DI_LIMIT_88100 MOVSTR_SI
-
-#define MOVSTR_QI_LIMIT_88000 16
-#define MOVSTR_HI_LIMIT_88000 38
-#define MOVSTR_SI_LIMIT_88000 72
-#define MOVSTR_DI_LIMIT_88000 72
-
-#define MOVSTR_QI_LIMIT_88110 16
-#define MOVSTR_HI_LIMIT_88110 38
-#define MOVSTR_SI_LIMIT_88110 72
-#define MOVSTR_DI_LIMIT_88110 72
-
-static enum machine_mode mode_from_align[] =
- {VOIDmode, QImode, HImode, VOIDmode, SImode,
- VOIDmode, VOIDmode, VOIDmode, DImode};
-static int max_from_align[] = {0, MOVSTR_QI, MOVSTR_HI, 0, MOVSTR_SI,
- 0, 0, 0, MOVSTR_DI};
-static int all_from_align[] = {0, MOVSTR_QI, MOVSTR_ODD_HI, 0, MOVSTR_ODD_SI,
- 0, 0, 0, MOVSTR_ODD_DI};
-
-static int best_from_align[3][9] =
- {0, MOVSTR_QI_LIMIT_88100, MOVSTR_HI_LIMIT_88100, 0, MOVSTR_SI_LIMIT_88100,
- 0, 0, 0, MOVSTR_DI_LIMIT_88100,
- 0, MOVSTR_QI_LIMIT_88110, MOVSTR_HI_LIMIT_88110, 0, MOVSTR_SI_LIMIT_88110,
- 0, 0, 0, MOVSTR_DI_LIMIT_88110,
- 0, MOVSTR_QI_LIMIT_88000, MOVSTR_HI_LIMIT_88000, 0, MOVSTR_SI_LIMIT_88000,
- 0, 0, 0, MOVSTR_DI_LIMIT_88000};
-
-static void block_move_loop ();
-static void block_move_no_loop ();
-static void block_move_sequence ();
-
-/* Emit code to perform a block move. Choose the best method.
-
- OPERANDS[0] is the destination.
- OPERANDS[1] is the source.
- OPERANDS[2] is the size.
- OPERANDS[3] is the alignment safe to use. */
-
-void
-expand_block_move (dest_mem, src_mem, operands)
- rtx dest_mem;
- rtx src_mem;
- rtx *operands;
-{
- int align = INTVAL (operands[3]);
- int constp = (GET_CODE (operands[2]) == CONST_INT);
- int bytes = (constp ? INTVAL (operands[2]) : 0);
- int target = (int) m88k_cpu;
-
- assert (PROCESSOR_M88100 == 0);
- assert (PROCESSOR_M88110 == 1);
- assert (PROCESSOR_M88000 == 2);
-
- if (constp && bytes <= 0)
- return;
-
- /* Determine machine mode to do move with. */
- if (align > 4 && !TARGET_88110)
- align = 4;
- else if (align <= 0 || align == 3)
- abort (); /* block move invalid alignment. */
-
- if (constp && bytes <= 3 * align)
- block_move_sequence (operands[0], dest_mem, operands[1], src_mem,
- bytes, align, 0);
-
- else if (constp && bytes <= best_from_align[target][align])
- block_move_no_loop (operands[0], dest_mem, operands[1], src_mem,
- bytes, align);
-
- else if (constp && align == 4 && TARGET_88100)
- block_move_loop (operands[0], dest_mem, operands[1], src_mem,
- bytes, align);
-
- else
- {
-#ifdef TARGET_MEM_FUNCTIONS
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"), 0,
- VOIDmode, 3,
- operands[0], Pmode,
- operands[1], Pmode,
- convert_to_mode (TYPE_MODE (sizetype), operands[2],
- TREE_UNSIGNED (sizetype)),
- TYPE_MODE (sizetype));
-#else
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcopy"), 0,
- VOIDmode, 3,
- operands[1], Pmode,
- operands[0], Pmode,
- convert_to_mode (TYPE_MODE (integer_type_node),
- operands[2],
- TREE_UNSIGNED (integer_type_node)),
- TYPE_MODE (integer_type_node));
-#endif
- }
-}
-
-/* Emit code to perform a block move by calling a looping movstr library
- function. SIZE and ALIGN are known constants. DEST and SRC are
- registers. */
-
-static void
-block_move_loop (dest, dest_mem, src, src_mem, size, align)
- rtx dest, dest_mem;
- rtx src, src_mem;
- int size;
- int align;
-{
- enum machine_mode mode;
- int count;
- int units;
- int remainder;
- rtx offset_rtx;
- rtx value_rtx;
- char entry[30];
- tree entry_name;
-
- /* Determine machine mode to do move with. */
- if (align != 4)
- abort ();
-
- /* Determine the structure of the loop. */
- count = size / MOVSTR_LOOP;
- units = (size - count * MOVSTR_LOOP) / align;
-
- if (units < 2)
- {
- count--;
- units += MOVSTR_LOOP / align;
- }
-
- if (count <= 0)
- {
- block_move_no_loop (dest, dest_mem, src, src_mem, size, align);
- return;
- }
-
- remainder = size - count * MOVSTR_LOOP - units * align;
-
- mode = mode_from_align[align];
- sprintf (entry, "__movstr%s%dn%d",
- GET_MODE_NAME (mode), MOVSTR_LOOP, units * align);
- entry_name = get_identifier (entry);
-
- offset_rtx = gen_rtx (CONST_INT, VOIDmode,
- MOVSTR_LOOP + (1 - units) * align);
-
- value_rtx = gen_rtx (MEM, MEM_IN_STRUCT_P (src_mem) ? mode : BLKmode,
- gen_rtx (PLUS, Pmode,
- gen_rtx (REG, Pmode, 3),
- offset_rtx));
- RTX_UNCHANGING_P (value_rtx) = RTX_UNCHANGING_P (src_mem);
- MEM_VOLATILE_P (value_rtx) = MEM_VOLATILE_P (src_mem);
- MEM_IN_STRUCT_P (value_rtx) = MEM_IN_STRUCT_P (src_mem);
-
- emit_insn (gen_call_movstrsi_loop
- (gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (entry_name)),
- dest, src, offset_rtx, value_rtx,
- gen_rtx (REG, mode, ((units & 1) ? 4 : 5)),
- gen_rtx (CONST_INT, VOIDmode, count)));
-
- if (remainder)
- block_move_sequence (gen_rtx (REG, Pmode, 2), dest_mem,
- gen_rtx (REG, Pmode, 3), src_mem,
- remainder, align, MOVSTR_LOOP + align);
-}
-
-/* Emit code to perform a block move by calling a non-looping library
- function. SIZE and ALIGN are known constants. DEST and SRC are
- registers. OFFSET is the known starting point for the output pattern. */
-
-static void
-block_move_no_loop (dest, dest_mem, src, src_mem, size, align)
- rtx dest, dest_mem;
- rtx src, src_mem;
- int size;
- int align;
-{
- enum machine_mode mode = mode_from_align[align];
- int units = size / align;
- int remainder = size - units * align;
- int most;
- int value_reg;
- rtx offset_rtx;
- rtx value_rtx;
- char entry[30];
- tree entry_name;
-
- if (remainder && size <= all_from_align[align])
- {
- most = all_from_align[align] - (align - remainder);
- remainder = 0;
- }
- else
- {
- most = max_from_align[align];
- }
-
- sprintf (entry, "__movstr%s%dx%d",
- GET_MODE_NAME (mode), most, size - remainder);
- entry_name = get_identifier (entry);
-
- offset_rtx = gen_rtx (CONST_INT, VOIDmode, most - (size - remainder));
-
- value_rtx = gen_rtx (MEM, MEM_IN_STRUCT_P (src_mem) ? mode : BLKmode,
- gen_rtx (PLUS, Pmode,
- gen_rtx (REG, Pmode, 3),
- offset_rtx));
- RTX_UNCHANGING_P (value_rtx) = RTX_UNCHANGING_P (src_mem);
- MEM_VOLATILE_P (value_rtx) = MEM_VOLATILE_P (src_mem);
- MEM_IN_STRUCT_P (value_rtx) = MEM_IN_STRUCT_P (src_mem);
-
- value_reg = ((((most - (size - remainder)) / align) & 1) == 0
- ? (align == 8 ? 6 : 5) : 4);
-
- emit_insn (gen_call_block_move
- (gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (entry_name)),
- dest, src, offset_rtx, value_rtx,
- gen_rtx (REG, mode, value_reg)));
-
- if (remainder)
- block_move_sequence (gen_rtx (REG, Pmode, 2), dest_mem,
- gen_rtx (REG, Pmode, 3), src_mem,
- remainder, align, most);
-}
-
-/* Emit code to perform a block move with an offset sequence of ld/st
- instructions (..., ld 0, st 1, ld 1, st 0, ...). SIZE and ALIGN are
- known constants. DEST and SRC are registers. OFFSET is the known
- starting point for the output pattern. */
-
-static void
-block_move_sequence (dest, dest_mem, src, src_mem, size, align, offset)
- rtx dest, dest_mem;
- rtx src, src_mem;
- int size;
- int align;
- int offset;
-{
- rtx temp[2];
- enum machine_mode mode[2];
- int amount[2];
- int active[2];
- int phase = 0;
- int next;
- int offset_ld = offset;
- int offset_st = offset;
-
- active[0] = active[1] = FALSE;
-
- /* Establish parameters for the first load and for the second load if
- it is known to be the same mode as the first. */
- amount[0] = amount[1] = align;
- mode[0] = mode_from_align[align];
- temp[0] = gen_reg_rtx (mode[0]);
- if (size >= 2 * align)
- {
- mode[1] = mode[0];
- temp[1] = gen_reg_rtx (mode[1]);
- }
-
- do
- {
- rtx srcp, dstp;
- next = phase;
- phase = !phase;
-
- if (size > 0)
- {
- /* Change modes as the sequence tails off. */
- if (size < amount[next])
- {
- amount[next] = (size >= 4 ? 4 : (size >= 2 ? 2 : 1));
- mode[next] = mode_from_align[amount[next]];
- temp[next] = gen_reg_rtx (mode[next]);
- }
- size -= amount[next];
- srcp = gen_rtx (MEM,
- MEM_IN_STRUCT_P (src_mem) ? mode[next] : BLKmode,
- gen_rtx (PLUS, Pmode, src,
- gen_rtx (CONST_INT, SImode, offset_ld)));
- RTX_UNCHANGING_P (srcp) = RTX_UNCHANGING_P (src_mem);
- MEM_VOLATILE_P (srcp) = MEM_VOLATILE_P (src_mem);
- MEM_IN_STRUCT_P (srcp) = MEM_IN_STRUCT_P (src_mem);
- emit_insn (gen_rtx (SET, VOIDmode, temp[next], srcp));
- offset_ld += amount[next];
- active[next] = TRUE;
- }
-
- if (active[phase])
- {
- active[phase] = FALSE;
- dstp = gen_rtx (MEM,
- MEM_IN_STRUCT_P (dest_mem) ? mode[phase] : BLKmode,
- gen_rtx (PLUS, Pmode, dest,
- gen_rtx (CONST_INT, SImode, offset_st)));
- RTX_UNCHANGING_P (dstp) = RTX_UNCHANGING_P (dest_mem);
- MEM_VOLATILE_P (dstp) = MEM_VOLATILE_P (dest_mem);
- MEM_IN_STRUCT_P (dstp) = MEM_IN_STRUCT_P (dest_mem);
- emit_insn (gen_rtx (SET, VOIDmode, dstp, temp[phase]));
- offset_st += amount[phase];
- }
- }
- while (active[next]);
-}
-
-/* Emit the code to do an AND operation. */
-
-char *
-output_and (operands)
- rtx operands[];
-{
- unsigned int value;
-
- if (REG_P (operands[2]))
- return "and %0,%1,%2";
-
- value = INTVAL (operands[2]);
- if (SMALL_INTVAL (value))
- return "mask %0,%1,%2";
- else if ((value & 0xffff0000) == 0xffff0000)
- return "and %0,%1,%x2";
- else if ((value & 0xffff) == 0xffff)
- return "and.u %0,%1,%X2";
- else if ((value & 0xffff) == 0)
- return "mask.u %0,%1,%X2";
- else if (integer_ok_for_set (~value))
- return "clr %0,%1,%S2";
- else
- return "and.u %0,%1,%X2\n\tand %0,%0,%x2";
-}
-
-/* Emit the code to do an inclusive OR operation. */
-
-char *
-output_ior (operands)
- rtx operands[];
-{
- unsigned int value;
-
- if (REG_P (operands[2]))
- return "or %0,%1,%2";
-
- value = INTVAL (operands[2]);
- if (SMALL_INTVAL (value))
- return "or %0,%1,%2";
- else if ((value & 0xffff) == 0)
- return "or.u %0,%1,%X2";
- else if (integer_ok_for_set (value))
- return "set %0,%1,%s2";
- else
- return "or.u %0,%1,%X2\n\tor %0,%0,%x2";
-}
-
-/* Emit the instructions for doing an XOR. */
-
-char *
-output_xor (operands)
- rtx operands[];
-{
- unsigned int value;
-
- if (REG_P (operands[2]))
- return "xor %0,%1,%2";
-
- value = INTVAL (operands[2]);
- if (SMALL_INTVAL (value))
- return "xor %0,%1,%2";
- else if ((value & 0xffff) == 0)
- return "xor.u %0,%1,%X2";
- else
- return "xor.u %0,%1,%X2\n\txor %0,%0,%x2";
-}
-
-/* Output a call. Normally this is just bsr or jsr, but this also deals with
- accomplishing a branch after the call by incrementing r1. This requires
- that various assembler bugs be accommodated. The 4.30 DG/UX assembler
- requires that forward references not occur when computing the difference of
- two labels. The [version?] Motorola assembler computes a word difference.
- No doubt there's more to come!
-
- It would seem the same idea could be used to tail call, but in this case,
- the epilogue will be non-null. */
-
-static rtx sb_name = 0;
-static rtx sb_high = 0;
-static rtx sb_low = 0;
-
-char *
-output_call (operands, addr)
- rtx operands[];
- rtx addr;
-{
- operands[0] = addr;
- if (final_sequence)
- {
- rtx jump;
- rtx seq_insn;
-
- /* This can be generalized, but there is currently no need. */
- if (XVECLEN (final_sequence, 0) != 2)
- abort ();
-
- /* The address of interior insns is not computed, so use the sequence. */
- seq_insn = NEXT_INSN (PREV_INSN (XVECEXP (final_sequence, 0, 0)));
- jump = XVECEXP (final_sequence, 0, 1);
- if (GET_CODE (jump) == JUMP_INSN)
- {
- rtx low, high;
- char *last;
- rtx dest = XEXP (SET_SRC (PATTERN (jump)), 0);
- int delta = 4 * (insn_addresses[INSN_UID (dest)]
- - insn_addresses[INSN_UID (seq_insn)]
- - 2);
-#if (MONITOR_GCC & 0x2) /* How often do long branches happen? */
- if ((unsigned) (delta + 0x8000) >= 0x10000)
- warning ("Internal gcc monitor: short-branch(%x)", delta);
-#endif
-
- /* Delete the jump. */
- PUT_CODE (jump, NOTE);
- NOTE_LINE_NUMBER (jump) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (jump) = 0;
-
- /* We only do this optimization if -O2, modifying the value of
- r1 in the delay slot confuses debuggers and profilers on some
- systems.
-
- If we loose, we must use the non-delay form. This is unlikely
- to ever happen. If it becomes a problem, claim that a call
- has two delay slots and only the second can be filled with
- a jump.
-
- The 88110 can lose when a jsr.n r1 is issued and a page fault
- occurs accessing the delay slot. So don't use jsr.n form when
- jumping thru r1.
- */
-#ifdef AS_BUG_IMMEDIATE_LABEL /* The assembler restricts immediate values. */
- if (optimize < 2
- || ! ADD_INTVAL (delta * 2)
-#else
- if (optimize < 2
- || ! ADD_INTVAL (delta)
-#endif
- || (REG_P (addr) && REGNO (addr) == 1))
- {
- operands[1] = dest;
- return (REG_P (addr)
- ? "jsr %0\n\tbr %l1"
- : (flag_pic
- ? "bsr %0#plt\n\tbr %l1"
- : "bsr %0\n\tbr %l1"));
- }
-
- /* Output the short branch form. */
- output_asm_insn ((REG_P (addr)
- ? "jsr.n %0"
- : (flag_pic ? "bsr.n %0#plt" : "bsr.n %0")),
- operands);
-
-#ifdef USE_GAS
- last = (delta < 0
- ? "subu %#r1,%#r1,.-%l0+4"
- : "addu %#r1,%#r1,%l0-.-4");
- operands[0] = dest;
-#else
- operands[0] = gen_label_rtx ();
- operands[1] = gen_label_rtx ();
- if (delta < 0)
- {
- low = dest;
- high = operands[1];
- last = "subu %#r1,%#r1,%l0\n%l1:";
- }
- else
- {
- low = operands[1];
- high = dest;
- last = "addu %#r1,%#r1,%l0\n%l1:";
- }
-
- /* Record the values to be computed later as "def name,high-low". */
- sb_name = gen_rtx (EXPR_LIST, VOIDmode, operands[0], sb_name);
- sb_high = gen_rtx (EXPR_LIST, VOIDmode, high, sb_high);
- sb_low = gen_rtx (EXPR_LIST, VOIDmode, low, sb_low);
-#endif /* Don't USE_GAS */
-
- return last;
- }
- }
- return (REG_P (addr)
- ? "jsr%. %0"
- : (flag_pic ? "bsr%. %0#plt" : "bsr%. %0"));
-}
-
-static void
-output_short_branch_defs (stream)
- FILE *stream;
-{
- char name[256], high[256], low[256];
-
- for (; sb_name && sb_high && sb_low;
- sb_name = XEXP (sb_name, 1),
- sb_high = XEXP (sb_high, 1),
- sb_low = XEXP (sb_low, 1))
- {
- ASM_GENERATE_INTERNAL_LABEL
- (name, "L", CODE_LABEL_NUMBER (XEXP (sb_name, 0)));
- ASM_GENERATE_INTERNAL_LABEL
- (high, "L", CODE_LABEL_NUMBER (XEXP (sb_high, 0)));
- ASM_GENERATE_INTERNAL_LABEL
- (low, "L", CODE_LABEL_NUMBER (XEXP (sb_low, 0)));
- /* This will change as the assembler requirements become known. */
- fprintf (stream, "\t%s\t %s,%s-%s\n",
- SET_ASM_OP, &name[1], &high[1], &low[1]);
- }
- if (sb_name || sb_high || sb_low)
- abort ();
-}
-
-/* Return truth value of the statement that this conditional branch is likely
- to fall through. CONDITION, is the condition that JUMP_INSN is testing. */
-
-int
-mostly_false_jump (jump_insn, condition)
- rtx jump_insn, condition;
-{
- rtx target_label = JUMP_LABEL (jump_insn);
- rtx insnt, insnj;
-
- /* Much of this isn't computed unless we're optimizing. */
- if (optimize == 0)
- return 0;
-
- /* Determine if one path or the other leads to a return. */
- for (insnt = NEXT_INSN (target_label);
- insnt;
- insnt = NEXT_INSN (insnt))
- {
- if (GET_CODE (insnt) == JUMP_INSN)
- break;
- else if (GET_CODE (insnt) == INSN
- && GET_CODE (PATTERN (insnt)) == SEQUENCE
- && GET_CODE (XVECEXP (PATTERN (insnt), 0, 0)) == JUMP_INSN)
- {
- insnt = XVECEXP (PATTERN (insnt), 0, 0);
- break;
- }
- }
- if (insnt
- && (GET_CODE (PATTERN (insnt)) == RETURN
- || (GET_CODE (PATTERN (insnt)) == SET
- && GET_CODE (SET_SRC (PATTERN (insnt))) == REG
- && REGNO (SET_SRC (PATTERN (insnt))) == 1)))
- insnt = 0;
-
- for (insnj = NEXT_INSN (jump_insn);
- insnj;
- insnj = NEXT_INSN (insnj))
- {
- if (GET_CODE (insnj) == JUMP_INSN)
- break;
- else if (GET_CODE (insnj) == INSN
- && GET_CODE (PATTERN (insnj)) == SEQUENCE
- && GET_CODE (XVECEXP (PATTERN (insnj), 0, 0)) == JUMP_INSN)
- {
- insnj = XVECEXP (PATTERN (insnj), 0, 0);
- break;
- }
- }
- if (insnj
- && (GET_CODE (PATTERN (insnj)) == RETURN
- || (GET_CODE (PATTERN (insnj)) == SET
- && GET_CODE (SET_SRC (PATTERN (insnj))) == REG
- && REGNO (SET_SRC (PATTERN (insnj))) == 1)))
- insnj = 0;
-
- /* Predict to not return. */
- if ((insnt == 0) != (insnj == 0))
- return (insnt == 0);
-
- /* Predict loops to loop. */
- for (insnt = PREV_INSN (target_label);
- insnt && GET_CODE (insnt) == NOTE;
- insnt = PREV_INSN (insnt))
- if (NOTE_LINE_NUMBER (insnt) == NOTE_INSN_LOOP_END)
- return 1;
- else if (NOTE_LINE_NUMBER (insnt) == NOTE_INSN_LOOP_BEG)
- return 0;
- else if (NOTE_LINE_NUMBER (insnt) == NOTE_INSN_LOOP_CONT)
- return 0;
-
- /* Predict backward branches usually take. */
- if (final_sequence)
- insnj = NEXT_INSN (PREV_INSN (XVECEXP (final_sequence, 0, 0)));
- else
- insnj = jump_insn;
- if (insn_addresses[INSN_UID (insnj)]
- > insn_addresses[INSN_UID (target_label)])
- return 0;
-
- /* EQ tests are usually false and NE tests are usually true. Also,
- most quantities are positive, so we can make the appropriate guesses
- about signed comparisons against zero. Consider unsigned comparisons
- to be a range check and assume quantities to be in range. */
- switch (GET_CODE (condition))
- {
- case CONST_INT:
- /* Unconditional branch. */
- return 0;
- case EQ:
- return 1;
- case NE:
- return 0;
- case LE:
- case LT:
- case GEU:
- case GTU: /* Must get casesi right at least. */
- if (XEXP (condition, 1) == const0_rtx)
- return 1;
- break;
- case GE:
- case GT:
- case LEU:
- case LTU:
- if (XEXP (condition, 1) == const0_rtx)
- return 0;
- break;
- }
-
- return 0;
-}
-
-/* Return true if the operand is a power of two and is a floating
- point type (to optimize division by power of two into multiplication). */
-
-int
-real_power_of_2_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- union {
- REAL_VALUE_TYPE d;
- int i[sizeof (REAL_VALUE_TYPE) / sizeof (int)];
- struct { /* IEEE double precision format */
- unsigned sign : 1;
- unsigned exponent : 11;
- unsigned mantissa1 : 20;
- unsigned mantissa2;
- } s;
- struct { /* IEEE double format to quick check */
- unsigned sign : 1; /* if it fits in a float */
- unsigned exponent1 : 4;
- unsigned exponent2 : 7;
- unsigned mantissa1 : 20;
- unsigned mantissa2;
- } s2;
- } u;
-
- if (GET_MODE (op) != DFmode && GET_MODE (op) != SFmode)
- return 0;
-
- if (GET_CODE (op) != CONST_DOUBLE)
- return 0;
-
- u.i[0] = CONST_DOUBLE_LOW (op);
- u.i[1] = CONST_DOUBLE_HIGH (op);
-
- if (u.s.mantissa1 != 0 || u.s.mantissa2 != 0 /* not a power of two */
- || u.s.exponent == 0 /* constant 0.0 */
- || u.s.exponent == 0x7ff /* NAN */
- || (u.s2.exponent1 != 0x8 && u.s2.exponent1 != 0x7))
- return 0; /* const won't fit in float */
-
- return 1;
-}
-
-/* Make OP legitimate for mode MODE. Currently this only deals with DFmode
- operands, putting them in registers and making CONST_DOUBLE values
- SFmode where possible. */
-
-struct rtx_def *
-legitimize_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- rtx temp;
- union {
- union real_extract r;
- struct { /* IEEE double precision format */
- unsigned sign : 1;
- unsigned exponent : 11;
- unsigned mantissa1 : 20;
- unsigned mantissa2;
- } d;
- struct { /* IEEE double format to quick check */
- unsigned sign : 1; /* if it fits in a float */
- unsigned exponent1 : 4;
- unsigned exponent2 : 7;
- unsigned mantissa1 : 20;
- unsigned mantissa2;
- } s;
- } u;
-
- if (GET_CODE (op) == REG || mode != DFmode)
- return op;
-
- if (GET_CODE (op) == CONST_DOUBLE)
- {
- bcopy (&CONST_DOUBLE_LOW (op), &u.r, sizeof u);
- if (u.d.exponent != 0x7ff /* NaN */
- && u.d.mantissa2 == 0 /* Mantissa fits */
- && (u.s.exponent1 == 0x8 || u.s.exponent1 == 0x7) /* Exponent fits */
- && (temp = simplify_unary_operation (FLOAT_TRUNCATE, SFmode,
- op, mode)) != 0)
- return gen_rtx (FLOAT_EXTEND, mode, force_reg (SFmode, temp));
- }
- else if (register_operand (op, mode))
- return op;
-
- return force_reg (mode, op);
-}
-
-/* Return true if OP is a suitable input for a move insn. */
-
-int
-move_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
- if (GET_CODE (op) == CONST_INT)
- return (classify_integer (mode, INTVAL (op)) < m88k_oru_hi16);
- if (GET_MODE (op) != mode)
- return 0;
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
- if (GET_CODE (op) != MEM)
- return 0;
-
- op = XEXP (op, 0);
- if (GET_CODE (op) == LO_SUM)
- return (REG_P (XEXP (op, 0))
- && symbolic_address_p (XEXP (op, 1)));
- return memory_address_p (mode, op);
-}
-
-/* Return true if OP is suitable for a call insn. */
-
-int
-call_address_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (REG_P (op) || symbolic_address_p (op));
-}
-
-/* Returns true if OP is either a symbol reference or a sum of a symbol
- reference and a constant. */
-
-int
-symbolic_address_p (op)
- register rtx op;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- return 1;
-
- case CONST:
- op = XEXP (op, 0);
- return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (op, 0)) == LABEL_REF)
- && GET_CODE (XEXP (op, 1)) == CONST_INT);
-
- default:
- return 0;
- }
-}
-
-/* Return true if OP is a register or const0_rtx. */
-
-int
-reg_or_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (op == const0_rtx || register_operand (op, mode));
-}
-
-/* Nonzero if OP is a valid second operand for an arithmetic insn. */
-
-int
-arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && SMALL_INT (op)));
-}
-
-/* Return true if OP is a register or 5 bit integer. */
-
-int
-arith5_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && (unsigned) INTVAL (op) < 32));
-}
-
-int
-arith32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode) || GET_CODE (op) == CONST_INT);
-}
-
-int
-arith64_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || GET_CODE (op) == CONST_INT
- || (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode));
-}
-
-int
-int5_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && (unsigned) INTVAL (op) < 32);
-}
-
-int
-int32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT);
-}
-
-/* Return true if OP is a register or a valid immediate operand for
- addu or subu. */
-
-int
-add_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && ADD_INT (op)));
-}
-
-/* Nonzero if this is a bitmask filling the bottom bits, for optimizing and +
- shift left combinations into a single mak instruction. */
-
-int
-mak_mask_p (value)
- int value;
-{
- return (value && POWER_OF_2_or_0 (value + 1));
-}
-
-int
-reg_or_bbx_mask_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int value;
- if (register_operand (op, mode))
- return 1;
- if (GET_CODE (op) != CONST_INT)
- return 0;
-
- value = INTVAL (op);
- if (POWER_OF_2 (value))
- return 1;
-
- return 0;
-}
-
-/* Return true if OP is valid to use in the context of a floating
- point operation. Special case 0.0, since we can use r0. */
-
-int
-real_or_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (mode != SFmode && mode != DFmode)
- return 0;
-
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_DOUBLE
- && op == CONST0_RTX (mode)));
-}
-
-/* Return true if OP is valid to use in the context of logic arithmetic
- on condition codes. */
-
-int
-partial_ccmode_register_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return register_operand (op, CCmode) || register_operand (op, CCEVENmode);
-}
-
-/* Return true if OP is a relational operator. */
-
-int
-relop (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case EQ:
- case NE:
- case LT:
- case LE:
- case GE:
- case GT:
- case LTU:
- case LEU:
- case GEU:
- case GTU:
- return 1;
- default:
- return 0;
- }
-}
-
-int
-even_relop (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case EQ:
- case LT:
- case GT:
- case LTU:
- case GTU:
- return 1;
- default:
- return 0;
- }
-}
-
-int
-odd_relop (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case NE:
- case LE:
- case GE:
- case LEU:
- case GEU:
- return 1;
- default:
- return 0;
- }
-}
-
-/* Return true if OP is a relational operator, and is not an unsigned
- relational operator. */
-
-int
-relop_no_unsigned (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case EQ:
- case NE:
- case LT:
- case LE:
- case GE:
- case GT:
- /* @@ What is this test doing? Why not use `mode'? */
- if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT
- || GET_MODE (op) == DImode
- || GET_MODE_CLASS (GET_MODE (XEXP (op, 0))) == MODE_FLOAT
- || GET_MODE (XEXP (op, 0)) == DImode
- || GET_MODE_CLASS (GET_MODE (XEXP (op, 1))) == MODE_FLOAT
- || GET_MODE (XEXP (op, 1)) == DImode)
- return 0;
- return 1;
- default:
- return 0;
- }
-}
-
-/* Return true if the code of this rtx pattern is EQ or NE. */
-
-int
-equality_op (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == EQ || GET_CODE (op) == NE);
-}
-
-/* Return true if the code of this rtx pattern is pc or label_ref. */
-
-int
-pc_or_label_ref (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == PC || GET_CODE (op) == LABEL_REF);
-}
-
-/* Output to FILE the start of the assembler file. */
-
-struct option
-{
- char *string;
- int *variable;
- int on_value;
-};
-
-static int
-output_option (file, sep, type, name, indent, pos, max)
- FILE *file;
- char *sep;
- char *type;
- char *name;
- char *indent;
- int pos;
- int max;
-{
- if (strlen (sep) + strlen (type) + strlen (name) + pos > max)
- {
- fprintf (file, indent);
- return fprintf (file, "%s%s", type, name);
- }
- return pos + fprintf (file, "%s%s%s", sep, type, name);
-}
-
-static struct { char *name; int value; } m_options[] = TARGET_SWITCHES;
-
-static void
-output_options (file, f_options, f_len, W_options, W_len,
- pos, max, sep, indent, term)
- FILE *file;
- struct option *f_options;
- struct option *W_options;
- int f_len, W_len;
- int pos;
- int max;
- char *indent;
- char *term;
-{
- register int j;
-
- if (optimize)
- pos = output_option (file, sep, "-O", "", indent, pos, max);
- if (write_symbols != NO_DEBUG)
- pos = output_option (file, sep, "-g", "", indent, pos, max);
- if (flag_traditional)
- pos = output_option (file, sep, "-traditional", "", indent, pos, max);
- if (profile_flag)
- pos = output_option (file, sep, "-p", "", indent, pos, max);
- if (profile_block_flag)
- pos = output_option (file, sep, "-a", "", indent, pos, max);
-
- for (j = 0; j < f_len; j++)
- if (*f_options[j].variable == f_options[j].on_value)
- pos = output_option (file, sep, "-f", f_options[j].string,
- indent, pos, max);
-
- for (j = 0; j < W_len; j++)
- if (*W_options[j].variable == W_options[j].on_value)
- pos = output_option (file, sep, "-W", W_options[j].string,
- indent, pos, max);
-
- for (j = 0; j < sizeof m_options / sizeof m_options[0]; j++)
- if (m_options[j].name[0] != '\0'
- && m_options[j].value > 0
- && ((m_options[j].value & target_flags)
- == m_options[j].value))
- pos = output_option (file, sep, "-m", m_options[j].name,
- indent, pos, max);
-
- if (m88k_short_data)
- pos = output_option (file, sep, "-mshort-data-", m88k_short_data,
- indent, pos, max);
-
- fprintf (file, term);
-}
-
-void
-output_file_start (file, f_options, f_len, W_options, W_len)
- FILE *file;
- struct option *f_options;
- struct option *W_options;
- int f_len, W_len;
-{
- register int pos;
-
- ASM_FIRST_LINE (file);
- if (TARGET_88110
- && TARGET_SVR4)
- fprintf (file, "\t%s\n", REQUIRES_88110_ASM_OP);
- output_file_directive (file, main_input_filename);
- /* Switch to the data section so that the coffsem symbol and the
- gcc2_compiled. symbol aren't in the text section. */
- data_section ();
- ASM_COFFSEM (file);
-
- if (TARGET_IDENTIFY_REVISION)
- {
- char indent[256];
-
- time_t now = time ((time_t *)0);
- sprintf (indent, "]\"\n\t%s\t \"@(#)%s [", IDENT_ASM_OP, main_input_filename);
- fprintf (file, indent+3);
- pos = fprintf (file, "gcc %s, %.24s,", VERSION_STRING, ctime (&now));
-#if 1
- /* ??? It would be nice to call print_switch_values here (and thereby
- let us delete output_options) but this is kept in until it is known
- whether the change in content format matters. */
- output_options (file, f_options, f_len, W_options, W_len,
- pos, 150 - strlen (indent), " ", indent, "]\"\n\n");
-#else
- fprintf (file, "]\"\n");
- print_switch_values (file, 0, 150 - strlen (indent),
- indent + 3, " ", "]\"\n");
-#endif
- }
-}
-
-/* Output an ascii string. */
-
-void
-output_ascii (file, opcode, max, p, size)
- FILE *file;
- char *opcode;
- int max;
- unsigned char *p;
- int size;
-{
- int i;
- int in_escape = 0;
-
- register int num = 0;
-
- fprintf (file, "\t%s\t \"", opcode);
- for (i = 0; i < size; i++)
- {
- register int c = p[i];
-
- if (num > max)
- {
- fprintf (file, "\"\n\t%s\t \"", opcode);
- num = 0;
- }
-
- if (c == '\"' || c == '\\')
- {
- escape:
- putc ('\\', file);
- putc (c, file);
- num += 2;
- in_escape = 0;
- }
- else if (in_escape && c >= '0' && c <= '9')
- {
- /* If a digit follows an octal-escape, the Vax assembler fails
- to stop reading the escape after three digits. Continue to
- output the values as an octal-escape until a non-digit is
- found. */
- fprintf (file, "\\%03o", c);
- num += 4;
- }
- else if ((c >= ' ' && c < 0177) || (c == '\t'))
- {
- putc (c, file);
- num++;
- in_escape = 0;
- }
- else
- {
- switch (c)
- {
- /* Some assemblers can't handle \a, \v, or \?. */
- case '\f': c = 'f'; goto escape;
- case '\b': c = 'b'; goto escape;
- case '\r': c = 'r'; goto escape;
- case '\n': c = 'n'; goto escape;
- }
-
- fprintf (file, "\\%03o", c);
- num += 4;
- in_escape = 1;
- }
- }
- fprintf (file, "\"\n");
-}
-
-/* Output a label (allows insn-output.c to be compiled without including
- m88k.c or needing to include stdio.h). */
-
-void
-output_label (label_number)
- int label_number;
-{
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", label_number);
-}
-
-/* Generate the assembly code for function entry.
-
- The prologue is responsible for setting up the stack frame,
- initializing the frame pointer register, saving registers that must be
- saved, and allocating SIZE additional bytes of storage for the
- local variables. SIZE is an integer. FILE is a stdio
- stream to which the assembler code should be output.
-
- The label for the beginning of the function need not be output by this
- macro. That has already been done when the macro is run.
-
- To determine which registers to save, the macro can refer to the array
- `regs_ever_live': element R is nonzero if hard register
- R is used anywhere within the function. This implies the
- function prologue should save register R, but not if it is one
- of the call-used registers.
-
- On machines where functions may or may not have frame-pointers, the
- function entry code must vary accordingly; it must set up the frame
- pointer if one is wanted, and not otherwise. To determine whether a
- frame pointer is in wanted, the macro can refer to the variable
- `frame_pointer_needed'. The variable's value will be 1 at run
- time in a function that needs a frame pointer.
-
- On machines where an argument may be passed partly in registers and
- partly in memory, this macro must examine the variable
- `current_function_pretend_args_size', and allocate that many bytes
- of uninitialized space on the stack just underneath the first argument
- arriving on the stack. (This may not be at the very end of the stack,
- if the calling sequence has pushed anything else since pushing the stack
- arguments. But usually, on such machines, nothing else has been pushed
- yet, because the function prologue itself does all the pushing.)
-
- If `ACCUMULATE_OUTGOING_ARGS' is defined, the variable
- `current_function_outgoing_args_size' contains the size in bytes
- required for the outgoing arguments. This macro must add that
- amount of uninitialized space to very bottom of the stack.
-
- The stack frame we use looks like this:
-
- caller callee
- |==============================================|
- | caller's frame |
- |==============================================|
- | [caller's outgoing memory arguments] |
- |==============================================|
- | caller's outgoing argument area (32 bytes) |
- sp -> |==============================================| <- ap
- | [local variable space] |
- |----------------------------------------------|
- | [return address (r1)] |
- |----------------------------------------------|
- | [previous frame pointer (r30)] |
- |==============================================| <- fp
- | [preserved registers (r25..r14)] |
- |----------------------------------------------|
- | [preserved registers (x29..x22)] |
- |==============================================|
- | [dynamically allocated space (alloca)] |
- |==============================================|
- | [callee's outgoing memory arguments] |
- |==============================================|
- | [callee's outgoing argument area (32 bytes)] |
- |==============================================| <- sp
-
- Notes:
-
- r1 and r30 must be saved if debugging.
-
- fp (if present) is located two words down from the local
- variable space.
- */
-
-static void emit_add ();
-static void preserve_registers ();
-static void emit_ldst ();
-static void output_tdesc ();
-
-static int nregs;
-static int nxregs;
-static char save_regs[FIRST_PSEUDO_REGISTER];
-static int frame_laid_out;
-static int frame_size;
-static int variable_args_p;
-static int epilogue_marked;
-static int prologue_marked;
-
-extern char call_used_regs[];
-extern int current_function_pretend_args_size;
-extern int current_function_outgoing_args_size;
-extern int frame_pointer_needed;
-
-#define FIRST_OCS_PRESERVE_REGISTER 14
-#define LAST_OCS_PRESERVE_REGISTER 30
-
-#define FIRST_OCS_EXTENDED_PRESERVE_REGISTER (32 + 22)
-#define LAST_OCS_EXTENDED_PRESERVE_REGISTER (32 + 31)
-
-#define STACK_UNIT_BOUNDARY (STACK_BOUNDARY / BITS_PER_UNIT)
-#define ROUND_CALL_BLOCK_SIZE(BYTES) \
- (((BYTES) + (STACK_UNIT_BOUNDARY - 1)) & ~(STACK_UNIT_BOUNDARY - 1))
-
-/* Establish the position of the FP relative to the SP. This is done
- either during FUNCTION_PROLOGUE or by INITIAL_ELIMINATION_OFFSET. */
-
-void
-m88k_layout_frame ()
-{
- int regno, sp_size;
-
- frame_laid_out++;
-
- bzero ((char *) &save_regs[0], sizeof (save_regs));
- sp_size = nregs = nxregs = 0;
- frame_size = get_frame_size ();
-
- /* Since profiling requires a call, make sure r1 is saved. */
- if (profile_flag || profile_block_flag)
- save_regs[1] = 1;
-
- /* If we are producing debug information, store r1 and r30 where the
- debugger wants to find them (r30 at r30+0, r1 at r30+4). Space has
- already been reserved for r1/r30 in STARTING_FRAME_OFFSET. */
- if (write_symbols != NO_DEBUG && !TARGET_OCS_FRAME_POSITION)
- save_regs[1] = 1;
-
- /* If there is a call, alloca is used, __builtin_alloca is used, or
- a dynamic-sized object is defined, add the 8 additional words
- for the callee's argument area. The common denominator is that the
- FP is required. may_call_alloca only gets calls to alloca;
- current_function_calls_alloca gets alloca and __builtin_alloca. */
- if (regs_ever_live[1] || frame_pointer_needed)
- {
- save_regs[1] = 1;
- sp_size += REG_PARM_STACK_SPACE (0);
- }
-
- /* If we are producing PIC, save the addressing base register and r1. */
- if (flag_pic && current_function_uses_pic_offset_table)
- {
- save_regs[PIC_OFFSET_TABLE_REGNUM] = 1;
- nregs++;
- }
-
- /* If a frame is requested, save the previous FP, and the return
- address (r1), so that a traceback can be done without using tdesc
- information. Otherwise, simply save the FP if it is used as
- a preserve register. */
- if (frame_pointer_needed)
- save_regs[FRAME_POINTER_REGNUM] = save_regs[1] = 1;
- else if (regs_ever_live[FRAME_POINTER_REGNUM])
- save_regs[FRAME_POINTER_REGNUM] = 1;
-
- /* Figure out which extended register(s) needs to be saved. */
- for (regno = FIRST_EXTENDED_REGISTER + 1; regno < FIRST_PSEUDO_REGISTER;
- regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- {
- save_regs[regno] = 1;
- nxregs++;
- }
-
- /* Figure out which normal register(s) needs to be saved. */
- for (regno = 2; regno < FRAME_POINTER_REGNUM; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- {
- save_regs[regno] = 1;
- nregs++;
- }
-
- /* Achieve greatest use of double memory ops. Either we end up saving
- r30 or we use that slot to align the registers we do save. */
- if (nregs >= 2 && save_regs[1] && !save_regs[FRAME_POINTER_REGNUM])
- sp_size += 4;
-
- nregs += save_regs[1] + save_regs[FRAME_POINTER_REGNUM];
- /* if we need to align extended registers, add a word */
- if (nxregs > 0 && (nregs & 1) != 0)
- sp_size +=4;
- sp_size += 4 * nregs;
- sp_size += 8 * nxregs;
- sp_size += current_function_outgoing_args_size;
-
- /* The first two saved registers are placed above the new frame pointer
- if any. In the only case this matters, they are r1 and r30. */
- if (frame_pointer_needed || sp_size)
- m88k_fp_offset = ROUND_CALL_BLOCK_SIZE (sp_size - STARTING_FRAME_OFFSET);
- else
- m88k_fp_offset = -STARTING_FRAME_OFFSET;
- m88k_stack_size = m88k_fp_offset + STARTING_FRAME_OFFSET;
-
- /* First, combine m88k_stack_size and size. If m88k_stack_size is
- non-zero, align the frame size to 8 mod 16; otherwise align the
- frame size to 0 mod 16. (If stacks are 8 byte aligned, this ends
- up as a NOP. */
- {
- int need
- = ((m88k_stack_size ? STACK_UNIT_BOUNDARY - STARTING_FRAME_OFFSET : 0)
- - (frame_size % STACK_UNIT_BOUNDARY));
- if (need)
- {
- if (need < 0)
- need += STACK_UNIT_BOUNDARY;
- (void) assign_stack_local (BLKmode, need, BITS_PER_UNIT);
- frame_size = get_frame_size ();
- }
- m88k_stack_size
- = ROUND_CALL_BLOCK_SIZE (m88k_stack_size + frame_size
- + current_function_pretend_args_size);
- }
-}
-
-/* Return true if this function is known to have a null prologue. */
-
-int
-null_prologue ()
-{
- if (! reload_completed)
- return 0;
- if (! frame_laid_out)
- m88k_layout_frame ();
- return (! frame_pointer_needed
- && nregs == 0
- && nxregs == 0
- && m88k_stack_size == 0);
-}
-
-/* Determine if the current function has any references to the arg pointer.
- This is done indirectly by examining the DECL_ARGUMENTS' DECL_RTL.
- It is OK to return TRUE if there are no references, but FALSE must be
- correct. */
-
-static int
-uses_arg_area_p ()
-{
- register tree parm;
-
- if (current_function_decl == 0
- || current_function_varargs
- || variable_args_p)
- return 1;
-
- for (parm = DECL_ARGUMENTS (current_function_decl);
- parm;
- parm = TREE_CHAIN (parm))
- {
- if (DECL_RTL (parm) == 0
- || GET_CODE (DECL_RTL (parm)) == MEM)
- return 1;
-
- if (DECL_INCOMING_RTL (parm) == 0
- || GET_CODE (DECL_INCOMING_RTL (parm)) == MEM)
- return 1;
- }
- return 0;
-}
-
-void
-m88k_begin_prologue (stream, size)
- FILE *stream;
- int size;
-{
- if (TARGET_OMIT_LEAF_FRAME_POINTER && ! quiet_flag && leaf_function_p ())
- fprintf (stderr, "$");\
-
- m88k_prologue_done = 1; /* it's ok now to put out ln directives */
-}
-
-void
-m88k_end_prologue (stream)
- FILE *stream;
-{
- if (TARGET_OCS_DEBUG_INFO && !prologue_marked)
- {
- PUT_OCS_FUNCTION_START (stream);
- prologue_marked = 1;
-
- /* If we've already passed the start of the epilogue, say that
- it starts here. This marks the function as having a null body,
- but at a point where the return address is in a known location.
-
- Originally, I thought this couldn't happen, but the pic prologue
- for leaf functions ends with the instruction that restores the
- return address from the temporary register. If the temporary
- register is never used, that instruction can float all the way
- to the end of the function. */
- if (epilogue_marked)
- PUT_OCS_FUNCTION_END (stream);
- }
-}
-
-void
-m88k_expand_prologue ()
-{
- m88k_layout_frame ();
-
- if (TARGET_OPTIMIZE_ARG_AREA
- && m88k_stack_size
- && ! uses_arg_area_p ())
- {
- /* The incoming argument area is used for stack space if it is not
- used (or if -mno-optimize-arg-area is given). */
- if ((m88k_stack_size -= REG_PARM_STACK_SPACE (0)) < 0)
- m88k_stack_size = 0;
- }
-
- if (m88k_stack_size)
- emit_add (stack_pointer_rtx, stack_pointer_rtx, -m88k_stack_size);
-
- if (nregs || nxregs)
- preserve_registers (m88k_fp_offset + 4, 1);
-
- if (frame_pointer_needed)
- emit_add (frame_pointer_rtx, stack_pointer_rtx, m88k_fp_offset);
-
- if (flag_pic && save_regs[PIC_OFFSET_TABLE_REGNUM])
- {
- rtx return_reg = gen_rtx (REG, SImode, 1);
- rtx label = gen_label_rtx ();
- rtx temp_reg;
-
- if (! save_regs[1])
- {
- temp_reg = gen_rtx (REG, SImode, TEMP_REGNUM);
- emit_move_insn (temp_reg, return_reg);
- }
- emit_insn (gen_locate1 (pic_offset_table_rtx, label));
- emit_insn (gen_locate2 (pic_offset_table_rtx, label));
- emit_insn (gen_addsi3 (pic_offset_table_rtx,
- pic_offset_table_rtx, return_reg));
- if (! save_regs[1])
- emit_move_insn (return_reg, temp_reg);
- }
- if (profile_flag || profile_block_flag)
- emit_insn (gen_blockage ());
-}
-
-/* This function generates the assembly code for function exit,
- on machines that need it. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only, if there is a frame pointer.
- This is mandatory because of alloca; we also take advantage of it to
- omit stack adjustments before returning. */
-
-void
-m88k_begin_epilogue (stream)
- FILE *stream;
-{
- if (TARGET_OCS_DEBUG_INFO && !epilogue_marked && prologue_marked)
- {
- PUT_OCS_FUNCTION_END (stream);
- }
- epilogue_marked = 1;
-}
-
-void
-m88k_end_epilogue (stream, size)
- FILE *stream;
- int size;
-{
- rtx insn = get_last_insn ();
-
- if (TARGET_OCS_DEBUG_INFO && !epilogue_marked)
- PUT_OCS_FUNCTION_END (stream);
-
- /* If the last insn isn't a BARRIER, we must write a return insn. This
- should only happen if the function has no prologue and no body. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
- if (insn == 0 || GET_CODE (insn) != BARRIER)
- fprintf (stream, "\tjmp\t %s\n", reg_names[1]);
-
- /* If the last insn is a barrier, and the insn before that is a call,
- then add a nop instruction so that tdesc can walk the stack correctly
- even though there is no epilogue. (Otherwise, the label for the
- end of the tdesc region ends up at the start of the next function. */
- if (insn && GET_CODE (insn) == BARRIER)
- {
- insn = prev_nonnote_insn (insn);
- if (insn && GET_CODE (insn) == CALL_INSN)
- fprintf (stream, "\tor\t %s,%s,%s\n",reg_names[0],reg_names[0],reg_names[0]);
- }
-
- output_short_branch_defs (stream);
-
- fprintf (stream, "\n");
-
- if (TARGET_OCS_DEBUG_INFO)
- output_tdesc (stream, m88k_fp_offset + 4);
-
- m88k_function_number++;
- m88k_prologue_done = 0; /* don't put out ln directives */
- variable_args_p = 0; /* has variable args */
- frame_laid_out = 0;
- epilogue_marked = 0;
- prologue_marked = 0;
-}
-
-void
-m88k_expand_epilogue ()
-{
-#if (MONITOR_GCC & 0x4) /* What are interesting prologue/epilogue values? */
- fprintf (stream, "; size = %d, m88k_fp_offset = %d, m88k_stack_size = %d\n",
- size, m88k_fp_offset, m88k_stack_size);
-#endif
-
- if (frame_pointer_needed)
- emit_add (stack_pointer_rtx, frame_pointer_rtx, -m88k_fp_offset);
-
- if (nregs || nxregs)
- preserve_registers (m88k_fp_offset + 4, 0);
-
- if (m88k_stack_size)
- emit_add (stack_pointer_rtx, stack_pointer_rtx, m88k_stack_size);
-}
-
-/* Emit insns to set DSTREG to SRCREG + AMOUNT during the prologue or
- epilogue. */
-
-static void
-emit_add (dstreg, srcreg, amount)
- rtx dstreg;
- rtx srcreg;
- int amount;
-{
- rtx incr = gen_rtx (CONST_INT, VOIDmode, abs (amount));
- if (! ADD_INTVAL (amount))
- {
- rtx temp = gen_rtx (REG, SImode, TEMP_REGNUM);
- emit_move_insn (temp, incr);
- incr = temp;
- }
- emit_insn ((amount < 0 ? gen_subsi3 : gen_addsi3) (dstreg, srcreg, incr));
-}
-
-/* Save/restore the preserve registers. base is the highest offset from
- r31 at which a register is stored. store_p is true if stores are to
- be done; otherwise loads. */
-
-static void
-preserve_registers (base, store_p)
- int base;
- int store_p;
-{
- int regno, offset;
- struct mem_op {
- int regno;
- int nregs;
- int offset;
- } mem_op[FIRST_PSEUDO_REGISTER];
- struct mem_op *mo_ptr = mem_op;
-
- /* The 88open OCS mandates that preserved registers be stored in
- increasing order. For compatibility with current practice,
- the order is r1, r30, then the preserve registers. */
-
- offset = base;
- if (save_regs[1])
- {
- /* An extra word is given in this case to make best use of double
- memory ops. */
- if (nregs > 2 && !save_regs[FRAME_POINTER_REGNUM])
- offset -= 4;
- emit_ldst (store_p, 1, SImode, offset);
- offset -= 4;
- base = offset;
- }
-
- /* Walk the registers to save recording all single memory operations. */
- for (regno = FRAME_POINTER_REGNUM; regno > 1; regno--)
- if (save_regs[regno])
- {
- if ((offset & 7) != 4 || (regno & 1) != 1 || !save_regs[regno-1])
- {
- mo_ptr->nregs = 1;
- mo_ptr->regno = regno;
- mo_ptr->offset = offset;
- mo_ptr++;
- offset -= 4;
- }
- else
- {
- regno--;
- offset -= 2*4;
- }
- }
-
- /* Walk the registers to save recording all double memory operations.
- This avoids a delay in the epilogue (ld.d/ld). */
- offset = base;
- for (regno = FRAME_POINTER_REGNUM; regno > 1; regno--)
- if (save_regs[regno])
- {
- if ((offset & 7) != 4 || (regno & 1) != 1 || !save_regs[regno-1])
- {
- offset -= 4;
- }
- else
- {
- mo_ptr->nregs = 2;
- mo_ptr->regno = regno-1;
- mo_ptr->offset = offset-4;
- mo_ptr++;
- regno--;
- offset -= 2*4;
- }
- }
-
- /* Walk the extended registers to record all memory operations. */
- /* Be sure the offset is double word aligned. */
- offset = (offset - 1) & ~7;
- for (regno = FIRST_PSEUDO_REGISTER - 1; regno > FIRST_EXTENDED_REGISTER;
- regno--)
- if (save_regs[regno])
- {
- mo_ptr->nregs = 2;
- mo_ptr->regno = regno;
- mo_ptr->offset = offset;
- mo_ptr++;
- offset -= 2*4;
- }
-
- mo_ptr->regno = 0;
-
- /* Output the memory operations. */
- for (mo_ptr = mem_op; mo_ptr->regno; mo_ptr++)
- {
- if (mo_ptr->nregs)
- emit_ldst (store_p, mo_ptr->regno,
- (mo_ptr->nregs > 1 ? DImode : SImode),
- mo_ptr->offset);
- }
-}
-
-static void
-emit_ldst (store_p, regno, mode, offset)
- int store_p;
- int regno;
- enum machine_mode mode;
- int offset;
-{
- rtx reg = gen_rtx (REG, mode, regno);
- rtx mem;
-
- if (SMALL_INTVAL (offset))
- {
- mem = gen_rtx (MEM, mode, plus_constant (stack_pointer_rtx, offset));
- }
- else
- {
- /* offset is too large for immediate index must use register */
-
- rtx disp = gen_rtx (CONST_INT, VOIDmode, offset);
- rtx temp = gen_rtx (REG, SImode, TEMP_REGNUM);
- rtx regi = gen_rtx (PLUS, SImode, stack_pointer_rtx, temp);
- emit_move_insn (temp, disp);
- mem = gen_rtx (MEM, mode, regi);
- }
-
- if (store_p)
- emit_move_insn (mem, reg);
- else
- emit_move_insn (reg, mem);
-}
-
-/* Convert the address expression REG to a CFA offset. */
-
-int
-m88k_debugger_offset (reg, offset)
- register rtx reg;
- register int offset;
-{
- if (GET_CODE (reg) == PLUS)
- {
- offset = INTVAL (XEXP (reg, 1));
- reg = XEXP (reg, 0);
- }
-
- /* Put the offset in terms of the CFA (arg pointer). */
- if (reg == frame_pointer_rtx)
- offset += m88k_fp_offset - m88k_stack_size;
- else if (reg == stack_pointer_rtx)
- offset -= m88k_stack_size;
- else if (reg != arg_pointer_rtx)
- {
-#if (MONITOR_GCC & 0x10) /* Watch for suspicious symbolic locations. */
- if (! (GET_CODE (reg) == REG
- && REGNO (reg) >= FIRST_PSEUDO_REGISTER))
- warning ("Internal gcc error: Can't express symbolic location");
-#endif
- return 0;
- }
-
- return offset;
-}
-
-/* Output the 88open OCS proscribed text description information.
- The information is:
- 0 8: zero
- 0 22: info-byte-length (16 or 20 bytes)
- 0 2: info-alignment (word 2)
- 1 32: info-protocol (version 1 or 2(pic))
- 2 32: starting-address (inclusive, not counting prologue)
- 3 32: ending-address (exclusive, not counting epilog)
- 4 8: info-variant (version 1 or 3(extended registers))
- 4 17: register-save-mask (from register 14 to 30)
- 4 1: zero
- 4 1: return-address-info-discriminant
- 4 5: frame-address-register
- 5 32: frame-address-offset
- 6 32: return-address-info
- 7 32: register-save-offset
- 8 16: extended-register-save-mask (x16 - x31)
- 8 16: extended-register-save-offset (WORDS from register-save-offset) */
-
-static void
-output_tdesc (file, offset)
- FILE *file;
- int offset;
-{
- int regno, i, j;
- long mask, return_address_info, register_save_offset;
- long xmask, xregister_save_offset;
- char buf[256];
-
- for (mask = 0, i = 0, regno = FIRST_OCS_PRESERVE_REGISTER;
- regno <= LAST_OCS_PRESERVE_REGISTER;
- regno++)
- {
- mask <<= 1;
- if (save_regs[regno])
- {
- mask |= 1;
- i++;
- }
- }
-
- for (xmask = 0, j = 0, regno = FIRST_OCS_EXTENDED_PRESERVE_REGISTER;
- regno <= LAST_OCS_EXTENDED_PRESERVE_REGISTER;
- regno++)
- {
- xmask <<= 1;
- if (save_regs[regno])
- {
- xmask |= 1;
- j++;
- }
- }
-
- if (save_regs[1])
- {
- if ((nxregs > 0 || nregs > 2) && !save_regs[FRAME_POINTER_REGNUM])
- offset -= 4;
- return_address_info = - m88k_stack_size + offset;
- register_save_offset = return_address_info - i*4;
- }
- else
- {
- return_address_info = 1;
- register_save_offset = - m88k_stack_size + offset + 4 - i*4;
- }
-
- xregister_save_offset = - (j * 2 + ((register_save_offset >> 2) & 1));
-
- tdesc_section ();
-
- fprintf (file, "\t%s\t %d,%d", INT_ASM_OP, /* 8:0,22:(20 or 16),2:2 */
- (((xmask != 0) ? 20 : 16) << 2) | 2,
- flag_pic ? 2 : 1);
-
- ASM_GENERATE_INTERNAL_LABEL (buf, OCS_START_PREFIX, m88k_function_number);
- fprintf (file, ",%s%s", buf+1, flag_pic ? "#rel" : "");
- ASM_GENERATE_INTERNAL_LABEL (buf, OCS_END_PREFIX, m88k_function_number);
- fprintf (file, ",%s%s", buf+1, flag_pic ? "#rel" : "");
-
- fprintf (file, ",0x%x,0x%x,0x%x,0x%x",
- /* 8:1,17:0x%.3x,1:0,1:%d,5:%d */
- (((xmask ? 3 : 1) << (17+1+1+5))
- | (mask << (1+1+5))
- | ((!!save_regs[1]) << 5)
- | (frame_pointer_needed
- ? FRAME_POINTER_REGNUM
- : STACK_POINTER_REGNUM)),
- (m88k_stack_size - (frame_pointer_needed ? m88k_fp_offset : 0)),
- return_address_info,
- register_save_offset);
- if (xmask)
- fprintf (file, ",0x%x%04x", xmask, (0xffff & xregister_save_offset));
- fputc ('\n', file);
-
- text_section ();
-}
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. NAME is the mcount function name
- (varies), SAVEP indicates whether the parameter registers need to
- be saved and restored. */
-
-void
-output_function_profiler (file, labelno, name, savep)
- FILE *file;
- int labelno;
- char *name;
- int savep;
-{
- char label[256];
- char dbi[256];
- char *temp = (savep ? reg_names[2] : reg_names[10]);
-
- /* Remember to update FUNCTION_PROFILER_LENGTH. */
-
- if (savep)
- {
- fprintf (file, "\tsubu\t %s,%s,64\n", reg_names[31], reg_names[31]);
- fprintf (file, "\tst.d\t %s,%s,32\n", reg_names[2], reg_names[31]);
- fprintf (file, "\tst.d\t %s,%s,40\n", reg_names[4], reg_names[31]);
- fprintf (file, "\tst.d\t %s,%s,48\n", reg_names[6], reg_names[31]);
- fprintf (file, "\tst.d\t %s,%s,56\n", reg_names[8], reg_names[31]);
- }
-
- ASM_GENERATE_INTERNAL_LABEL (label, "LP", labelno);
- if (flag_pic == 2)
- {
- fprintf (file, "\tor.u\t %s,%s,%shi16(%s#got_rel)\n",
- temp, reg_names[0], m88k_pound_sign, &label[1]);
- fprintf (file, "\tor\t %s,%s,%slo16(%s#got_rel)\n",
- temp, temp, m88k_pound_sign, &label[1]);
- sprintf (dbi, "\tld\t %s,%s,%s\n", temp,
- reg_names[PIC_OFFSET_TABLE_REGNUM], temp);
- }
- else if (flag_pic)
- {
- sprintf (dbi, "\tld\t %s,%s,%s#got_rel\n", temp,
- reg_names[PIC_OFFSET_TABLE_REGNUM], &label[1]);
- }
- else
- {
- fprintf (file, "\tor.u\t %s,%s,%shi16(%s)\n",
- temp, reg_names[0], m88k_pound_sign, &label[1]);
- sprintf (dbi, "\tor\t %s,%s,%slo16(%s)\n",
- temp, temp, m88k_pound_sign, &label[1]);
- }
-
- if (flag_pic)
- fprintf (file, "\tbsr.n\t %s#plt\n", name);
- else
- fprintf (file, "\tbsr.n\t %s\n", name);
- fputs (dbi, file);
-
- if (savep)
- {
- fprintf (file, "\tld.d\t %s,%s,32\n", reg_names[2], reg_names[31]);
- fprintf (file, "\tld.d\t %s,%s,40\n", reg_names[4], reg_names[31]);
- fprintf (file, "\tld.d\t %s,%s,48\n", reg_names[6], reg_names[31]);
- fprintf (file, "\tld.d\t %s,%s,56\n", reg_names[8], reg_names[31]);
- fprintf (file, "\taddu\t %s,%s,64\n", reg_names[31], reg_names[31]);
- }
-}
-
-/* Output assembler code to FILE to initialize basic-block profiling for
- the current module. LABELNO is unique to each instance. */
-
-void
-output_function_block_profiler (file, labelno)
- FILE *file;
- int labelno;
-{
- char block[256];
- char label[256];
-
- /* Remember to update FUNCTION_BLOCK_PROFILER_LENGTH. */
-
- ASM_GENERATE_INTERNAL_LABEL (block, "LPBX", 0);
- ASM_GENERATE_INTERNAL_LABEL (label, "LPY", labelno);
-
- /* @@ Need to deal with PIC. I'm not sure what the requirements are on
- register usage, so I used r26/r27 to be safe. */
- fprintf (file, "\tor.u\t %s,%s,%shi16(%s)\n", reg_names[27], reg_names[0],
- m88k_pound_sign, &block[1]);
- fprintf (file, "\tld\t %s,%s,%slo16(%s)\n", reg_names[26], reg_names[27],
- m88k_pound_sign, &block[1]);
- fprintf (file, "\tbcnd\t %sne0,%s,%s\n",
- m88k_pound_sign, reg_names[26], &label[1]);
- fprintf (file, "\tsubu\t %s,%s,64\n", reg_names[31], reg_names[31]);
- fprintf (file, "\tst.d\t %s,%s,32\n", reg_names[2], reg_names[31]);
- fprintf (file, "\tst.d\t %s,%s,40\n", reg_names[4], reg_names[31]);
- fprintf (file, "\tst.d\t %s,%s,48\n", reg_names[6], reg_names[31]);
- fprintf (file, "\tst.d\t %s,%s,56\n", reg_names[8], reg_names[31]);
- fputs ("\tbsr.n\t ", file);
- ASM_OUTPUT_LABELREF (file, "__bb_init_func");
- putc ('\n', file);
- fprintf (file, "\tor\t %s,%s,%slo16(%s)\n", reg_names[2], reg_names[27],
- m88k_pound_sign, &block[1]);
- fprintf (file, "\tld.d\t %s,%s,32\n", reg_names[2], reg_names[31]);
- fprintf (file, "\tld.d\t %s,%s,40\n", reg_names[4], reg_names[31]);
- fprintf (file, "\tld.d\t %s,%s,48\n", reg_names[6], reg_names[31]);
- fprintf (file, "\tld.d\t %s,%s,56\n", reg_names[8], reg_names[31]);
- fprintf (file, "\taddu\t %s,%s,64\n", reg_names[31], reg_names[31]);
- ASM_OUTPUT_INTERNAL_LABEL (file, "LPY", labelno);
-}
-
-/* Output assembler code to FILE to increment the count associated with
- the basic block number BLOCKNO. */
-
-void
-output_block_profiler (file, blockno)
- FILE *file;
- int blockno;
-{
- char block[256];
-
- /* Remember to update BLOCK_PROFILER_LENGTH. */
-
- ASM_GENERATE_INTERNAL_LABEL (block, "LPBX", 2);
-
- /* @@ Need to deal with PIC. I'm not sure what the requirements are on
- register usage, so I used r26/r27 to be safe. */
- fprintf (file, "\tor.u\t %s,%s,%shi16(%s+%d)\n", reg_names[27], reg_names[0],
- m88k_pound_sign, &block[1], 4 * blockno);
- fprintf (file, "\tld\t %s,%s,%slo16(%s+%d)\n", reg_names[26], reg_names[27],
- m88k_pound_sign, &block[1], 4 * blockno);
- fprintf (file, "\taddu\t %s,%s,1\n", reg_names[26], reg_names[26]);
- fprintf (file, "\tst\t %s,%s,%slo16(%s+%d)\n", reg_names[26], reg_names[27],
- m88k_pound_sign, &block[1], 4 * blockno);
-}
-
-/* Determine whether a function argument is passed in a register, and
- which register.
-
- The arguments are CUM, which summarizes all the previous
- arguments; MODE, the machine mode of the argument; TYPE,
- the data type of the argument as a tree node or 0 if that is not known
- (which happens for C support library functions); and NAMED,
- which is 1 for an ordinary argument and 0 for nameless arguments that
- correspond to `...' in the called function's prototype.
-
- The value of the expression should either be a `reg' RTX for the
- hard register in which to pass the argument, or zero to pass the
- argument on the stack.
-
- On the m88000 the first eight words of args are normally in registers
- and the rest are pushed. Double precision floating point must be
- double word aligned (and if in a register, starting on an even
- register). Structures and unions which are not 4 byte, and word
- aligned are passed in memory rather than registers, even if they
- would fit completely in the registers under OCS rules.
-
- Note that FUNCTION_ARG and FUNCTION_INCOMING_ARG were different.
- For structures that are passed in memory, but could have been
- passed in registers, we first load the structure into the
- register, and then when the last argument is passed, we store
- the registers into the stack locations. This fixes some bugs
- where GCC did not expect to have register arguments, followed
- by stack arguments, followed by register arguments. */
-
-struct rtx_def *
-m88k_function_arg (args_so_far, mode, type, named)
- CUMULATIVE_ARGS args_so_far;
- enum machine_mode mode;
- tree type;
- int named;
-{
- int bytes, words;
-
- if (type != 0 /* undo putting struct in register */
- && (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE))
- mode = BLKmode;
-
- if (mode == BLKmode && TARGET_WARN_PASS_STRUCT)
- warning ("argument #%d is a structure", args_so_far + 1);
-
- if ((args_so_far & 1) != 0
- && (mode == DImode || mode == DFmode
- || (type != 0 && TYPE_ALIGN (type) > 32)))
- args_so_far++;
-
-#ifdef ESKIT
- if (no_reg_params)
- return (rtx) 0; /* don't put args in registers */
-#endif
-
- if (type == 0 && mode == BLKmode)
- abort (); /* m88k_function_arg argument `type' is NULL for BLKmode. */
-
- bytes = (mode != BLKmode) ? GET_MODE_SIZE (mode) : int_size_in_bytes (type);
- words = (bytes + 3) / 4;
-
- if (args_so_far + words > 8)
- return (rtx) 0; /* args have exhausted registers */
-
- else if (mode == BLKmode
- && (TYPE_ALIGN (type) != BITS_PER_WORD
- || bytes != UNITS_PER_WORD))
- return (rtx) 0;
-
- return gen_rtx (REG,
- ((mode == BLKmode) ? TYPE_MODE (type) : mode),
- 2 + args_so_far);
-}
-
-/* Do what is necessary for `va_start'. The argument is ignored;
- We look at the current function to determine if stdargs or varargs
- is used and fill in an initial va_list. A pointer to this constructor
- is returned. */
-
-struct rtx_def *
-m88k_builtin_saveregs (arglist)
- tree arglist;
-{
- rtx block, addr, argsize;
- tree fntype = TREE_TYPE (current_function_decl);
- int argadj = ((!(TYPE_ARG_TYPES (fntype) != 0
- && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
- != void_type_node)))
- ? -UNITS_PER_WORD : 0) + UNITS_PER_WORD - 1;
- int fixed;
- variable_args_p = 1;
-
- if (CONSTANT_P (current_function_arg_offset_rtx))
- {
- fixed = (XINT (current_function_arg_offset_rtx, 0)
- + argadj) / UNITS_PER_WORD;
- argsize = gen_rtx (CONST_INT, VOIDmode, fixed);
- }
- else
- {
- fixed = 0;
- argsize = plus_constant (current_function_arg_offset_rtx, argadj);
- argsize = expand_shift (RSHIFT_EXPR, Pmode, argsize,
- build_int_2 (2, 0), argsize, 0);
- }
-
- /* Allocate the va_list constructor */
- block = assign_stack_local (BLKmode, 3 * UNITS_PER_WORD, BITS_PER_WORD);
- RTX_UNCHANGING_P (block) = 1;
- RTX_UNCHANGING_P (XEXP (block, 0)) = 1;
-
- /* Store the argsize as the __va_arg member. */
- emit_move_insn (change_address (block, SImode, XEXP (block, 0)),
- argsize);
-
- /* Store the arg pointer in the __va_stk member. */
- emit_move_insn (change_address (block, Pmode,
- plus_constant (XEXP (block, 0),
- UNITS_PER_WORD)),
- copy_to_reg (virtual_incoming_args_rtx));
-
- /* Allocate the register space, and store it as the __va_reg member. */
- addr = assign_stack_local (BLKmode, 8 * UNITS_PER_WORD, -1);
- MEM_IN_STRUCT_P (addr) = 1;
- RTX_UNCHANGING_P (addr) = 1;
- RTX_UNCHANGING_P (XEXP (addr, 0)) = 1;
- emit_move_insn (change_address (block, Pmode,
- plus_constant (XEXP (block, 0),
- 2 * UNITS_PER_WORD)),
- copy_to_reg (XEXP (addr, 0)));
-
- /* Now store the incoming registers. */
- if (fixed < 8)
- move_block_from_reg
- (2 + fixed,
- change_address (addr, Pmode,
- plus_constant (XEXP (addr, 0),
- fixed * UNITS_PER_WORD)),
- 8 - fixed, UNITS_PER_WORD * (8 - fixed));
-
- /* Return the address of the va_list constructor, but don't put it in a
- register. This fails when not optimizing and produces worse code when
- optimizing. */
- return XEXP (block, 0);
-}
-
-/* If cmpsi has not been generated, emit code to do the test. Return the
- expression describing the test of operator OP. */
-
-rtx
-emit_test (op, mode)
- enum rtx_code op;
- enum machine_mode mode;
-{
- if (m88k_compare_reg == 0)
- emit_insn (gen_test (m88k_compare_op0, m88k_compare_op1));
- return (gen_rtx (op, mode, m88k_compare_reg, const0_rtx));
-}
-
-/* Determine how to best perform cmpsi/bxx, where cmpsi has a constant
- operand. All tests with zero (albeit swapped) and all equality tests
- with a constant are done with bcnd. The remaining cases are swapped
- as needed. */
-
-void
-emit_bcnd (op, label)
- enum rtx_code op;
- rtx label;
-{
- if (m88k_compare_op1 == const0_rtx)
- emit_jump_insn( gen_bcnd (
- gen_rtx (op, VOIDmode,m88k_compare_op0, const0_rtx),
- label));
- else if (m88k_compare_op0 == const0_rtx)
- emit_jump_insn( gen_bcnd(
- gen_rtx(
- swap_condition (op),
- VOIDmode, m88k_compare_op1, const0_rtx),
- label));
- else if (op != EQ && op != NE)
- emit_jump_insn (gen_bxx (emit_test (op, VOIDmode), label));
- else
- {
- rtx zero = gen_reg_rtx (SImode);
- rtx reg, constant;
- int value;
-
- if (GET_CODE (m88k_compare_op1) == CONST_INT)
- {
- reg = force_reg (SImode, m88k_compare_op0);
- constant = m88k_compare_op1;
- }
- else
- {
- reg = force_reg (SImode, m88k_compare_op1);
- constant = m88k_compare_op0;
- }
- value = INTVAL (constant);
-
- /* Perform an arithmetic computation to make the compared-to value
- zero, but avoid loosing if the bcnd is later changed into sxx. */
- if (SMALL_INTVAL (value))
- emit_jump_insn (gen_bxx (emit_test (op, VOIDmode), label));
- else
- {
- if (SMALL_INTVAL (-value))
- emit_insn (gen_addsi3 (zero, reg,
- gen_rtx (CONST_INT, VOIDmode, -value)));
- else
- emit_insn (gen_xorsi3 (zero, reg, constant));
-
- emit_jump_insn (gen_bcnd (gen_rtx (op, VOIDmode,
- zero, const0_rtx),
- label));
- }
- }
-}
-
-/* Print an operand. Recognize special options, documented below. */
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- char code;
-{
- enum rtx_code xc = (x ? GET_CODE (x) : UNKNOWN);
- register int value = (xc == CONST_INT ? INTVAL (x) : 0);
- static int sequencep;
- static int reversep;
-
- if (sequencep)
- {
- if (code < 'B' || code > 'E')
- output_operand_lossage ("%R not followed by %B/C/D/E");
- if (reversep)
- xc = reverse_condition (xc);
- sequencep = 0;
- }
-
- switch (code)
- {
- case '*': /* addressing base register for PIC */
- fputs (reg_names[PIC_OFFSET_TABLE_REGNUM], file); return;
-
- case '#': /* SVR4 pound-sign syntax character (empty if SVR3) */
- fputs (m88k_pound_sign, file); return;
-
- case 'V': /* Output a serializing instruction as needed if the operand
- (assumed to be a MEM) is a volatile load. */
- case 'v': /* ditto for a volatile store. */
- if (MEM_VOLATILE_P (x) && TARGET_SERIALIZE_VOLATILE)
- {
- /* The m88110 implements two FIFO queues, one for loads and
- one for stores. These queues mean that loads complete in
- their issue order as do stores. An interaction between the
- history buffer and the store reservation station ensures
- that a store will not bypass load. Finally, a load will not
- bypass store, but only when they reference the same address.
-
- To avoid this reordering (a load bypassing a store) for
- volatile references, a serializing instruction is output.
- We choose the fldcr instruction as it does not serialize on
- the m88100 so that -m88000 code will not be degraded.
-
- The mechanism below is completed by having CC_STATUS_INIT set
- the code to the unknown value. */
-
- /*
- hassey 6/30/93
- A problem with 88110 4.1 & 4.2 makes the use of fldcr for
- this purpose undesirable. Instead we will use tb1, this will
- cause serialization on the 88100 but such is life.
- */
-
- static rtx last_addr = 0;
- if (code == 'V' /* Only need to serialize before a load. */
- && m88k_volatile_code != 'V' /* Loads complete in FIFO order. */
- && !(m88k_volatile_code == 'v'
- && GET_CODE (XEXP (x, 0)) == LO_SUM
- && rtx_equal_p (XEXP (XEXP (x, 0), 1), last_addr)))
- fprintf (file,
-#if 0
-#ifdef AS_BUG_FLDCR
- "fldcr\t %s,%scr63\n\t",
-#else
- "fldcr\t %s,%sfcr63\n\t",
-#endif
- reg_names[0], m88k_pound_sign);
-#else /* 0 */
- "tb1\t 1,%s,0xff\n\t", reg_names[0]);
-#endif /* 0 */
- m88k_volatile_code = code;
- last_addr = (GET_CODE (XEXP (x, 0)) == LO_SUM
- ? XEXP (XEXP (x, 0), 1) : 0);
- }
- return;
-
- case 'X': /* print the upper 16 bits... */
- value >>= 16;
- case 'x': /* print the lower 16 bits of the integer constant in hex */
- if (xc != CONST_INT)
- output_operand_lossage ("invalid %x/X value");
- fprintf (file, "0x%x", value & 0xffff); return;
-
- case 'H': /* print the low 16 bits of the negated integer constant */
- if (xc != CONST_INT)
- output_operand_lossage ("invalid %H value");
- value = -value;
- case 'h': /* print the register or low 16 bits of the integer constant */
- if (xc == REG)
- goto reg;
- if (xc != CONST_INT)
- output_operand_lossage ("invalid %h value");
- fprintf (file, "%d", value & 0xffff);
- return;
-
- case 'Q': /* print the low 8 bits of the negated integer constant */
- if (xc != CONST_INT)
- output_operand_lossage ("invalid %Q value");
- value = -value;
- case 'q': /* print the register or low 8 bits of the integer constant */
- if (xc == REG)
- goto reg;
- if (xc != CONST_INT)
- output_operand_lossage ("invalid %q value");
- fprintf (file, "%d", value & 0xff);
- return;
-
- case 'w': /* print the integer constant (X == 32 ? 0 : 32 - X) */
- if (xc != CONST_INT)
- output_operand_lossage ("invalid %o value");
- fprintf (file, "%d", value == 32 ? 0 : 32 - value);
- return;
-
- case 'p': /* print the logarithm of the integer constant */
- if (xc != CONST_INT
- || (value = exact_log2 (value)) < 0)
- output_operand_lossage ("invalid %p value");
- fprintf (file, "%d", value);
- return;
-
- case 'S': /* compliment the value and then... */
- value = ~value;
- case 's': /* print the width and offset values forming the integer
- constant with a SET instruction. See integer_ok_for_set. */
- {
- register unsigned mask, uval = value;
- register int top, bottom;
-
- if (xc != CONST_INT)
- output_operand_lossage ("invalid %s/S value");
- /* All the "one" bits must be contiguous. If so, MASK will be
- a power of two or zero. */
- mask = (uval | (uval - 1)) + 1;
- if (!(uval && POWER_OF_2_or_0 (mask)))
- output_operand_lossage ("invalid %s/S value");
- top = mask ? exact_log2 (mask) : 32;
- bottom = exact_log2 (uval & ~(uval - 1));
- fprintf (file,"%d<%d>", top - bottom, bottom);
- return;
- }
-
- case 'P': /* print nothing if pc_rtx; output label_ref */
- if (xc == LABEL_REF)
- output_addr_const (file, x);
- else if (xc != PC)
- output_operand_lossage ("invalid %P operand");
- return;
-
- case 'L': /* print 0 or 1 if operand is label_ref and then... */
- fputc (xc == LABEL_REF ? '1' : '0', file);
- case '.': /* print .n if delay slot is used */
- fputs ((final_sequence
- && ! INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0)))
- ? ".n\t" : "\t", file);
- return;
-
- case '!': /* Reverse the following condition. */
- sequencep++;
- reversep = 1;
- return;
- case 'R': /* reverse the condition of the next print_operand
- if operand is a label_ref. */
- sequencep++;
- reversep = (xc == LABEL_REF);
- return;
-
- case 'B': /* bcnd branch values */
- fputs (m88k_pound_sign, file);
- switch (xc)
- {
- case EQ: fputs ("eq0", file); return;
- case NE: fputs ("ne0", file); return;
- case GT: fputs ("gt0", file); return;
- case LE: fputs ("le0", file); return;
- case LT: fputs ("lt0", file); return;
- case GE: fputs ("ge0", file); return;
- default: output_operand_lossage ("invalid %B value");
- }
-
- case 'C': /* bb0/bb1 branch values for comparisons */
- fputs (m88k_pound_sign, file);
- switch (xc)
- {
- case EQ: fputs ("eq", file); return;
- case NE: fputs ("ne", file); return;
- case GT: fputs ("gt", file); return;
- case LE: fputs ("le", file); return;
- case LT: fputs ("lt", file); return;
- case GE: fputs ("ge", file); return;
- case GTU: fputs ("hi", file); return;
- case LEU: fputs ("ls", file); return;
- case LTU: fputs ("lo", file); return;
- case GEU: fputs ("hs", file); return;
- default: output_operand_lossage ("invalid %C value");
- }
-
- case 'D': /* bcnd branch values for float comparisons */
- switch (xc)
- {
- case EQ: fputs ("0xa", file); return;
- case NE: fputs ("0x5", file); return;
- case GT: fputs (m88k_pound_sign, file);
- fputs ("gt0", file); return;
- case LE: fputs ("0xe", file); return;
- case LT: fputs ("0x4", file); return;
- case GE: fputs ("0xb", file); return;
- default: output_operand_lossage ("invalid %D value");
- }
-
- case 'E': /* bcnd branch values for special integers */
- switch (xc)
- {
- case EQ: fputs ("0x8", file); return;
- case NE: fputs ("0x7", file); return;
- default: output_operand_lossage ("invalid %E value");
- }
-
- case 'd': /* second register of a two register pair */
- if (xc != REG)
- output_operand_lossage ("`%d' operand isn't a register");
- fputs (reg_names[REGNO (x) + 1], file);
- return;
-
- case 'r': /* an immediate 0 should be represented as `r0' */
- if (x == const0_rtx)
- {
- fputs (reg_names[0], file);
- return;
- }
- else if (xc != REG)
- output_operand_lossage ("invalid %r value");
- case 0:
- name:
- if (xc == REG)
- {
- reg:
- if (REGNO (x) == ARG_POINTER_REGNUM)
- output_operand_lossage ("operand is r0");
- else
- fputs (reg_names[REGNO (x)], file);
- }
- else if (xc == PLUS)
- output_address (x);
- else if (xc == MEM)
- output_address (XEXP (x, 0));
- else if (flag_pic && xc == UNSPEC)
- {
- output_addr_const (file, XVECEXP (x, 0, 0));
- fputs ("#got_rel", file);
- }
- else if (xc == CONST_DOUBLE)
- output_operand_lossage ("operand is const_double");
- else
- output_addr_const (file, x);
- return;
-
- case 'g': /* append #got_rel as needed */
- if (flag_pic && (xc == SYMBOL_REF || xc == LABEL_REF))
- {
- output_addr_const (file, x);
- fputs ("#got_rel", file);
- return;
- }
- goto name;
-
- case 'a': /* (standard), assume operand is an address */
- case 'c': /* (standard), assume operand is an immediate value */
- case 'l': /* (standard), assume operand is a label_ref */
- case 'n': /* (standard), like %c, except negate first */
- default:
- output_operand_lossage ("invalid code");
- }
-}
-
-void
-print_operand_address (file, addr)
- FILE *file;
- rtx addr;
-{
- register rtx reg0, reg1, temp;
-
- switch (GET_CODE (addr))
- {
- case REG:
- if (REGNO (addr) == ARG_POINTER_REGNUM)
- abort ();
- else
- fprintf (file, "%s,%s", reg_names[0], reg_names [REGNO (addr)]);
- break;
-
- case LO_SUM:
- fprintf (file, "%s,%slo16(",
- reg_names[REGNO (XEXP (addr, 0))], m88k_pound_sign);
- output_addr_const (file, XEXP (addr, 1));
- fputc (')', file);
- break;
-
- case PLUS:
- reg0 = XEXP (addr, 0);
- reg1 = XEXP (addr, 1);
- if (GET_CODE (reg0) == MULT || GET_CODE (reg0) == CONST_INT)
- {
- rtx tmp = reg0;
- reg0 = reg1;
- reg1 = tmp;
- }
-
- if ((REG_P (reg0) && REGNO (reg0) == ARG_POINTER_REGNUM)
- || (REG_P (reg1) && REGNO (reg1) == ARG_POINTER_REGNUM))
- abort ();
-
- else if (REG_P (reg0))
- {
- if (REG_P (reg1))
- fprintf (file, "%s,%s",
- reg_names [REGNO (reg0)], reg_names [REGNO (reg1)]);
-
- else if (GET_CODE (reg1) == CONST_INT)
- fprintf (file, "%s,%d",
- reg_names [REGNO (reg0)], INTVAL (reg1));
-
- else if (GET_CODE (reg1) == MULT)
- {
- rtx mreg = XEXP (reg1, 0);
- if (REGNO (mreg) == ARG_POINTER_REGNUM)
- abort ();
-
- fprintf (file, "%s[%s]", reg_names[REGNO (reg0)],
- reg_names[REGNO (mreg)]);
- }
-
- else if (GET_CODE (reg1) == ZERO_EXTRACT)
- {
- fprintf (file, "%s,%slo16(",
- reg_names[REGNO (reg0)], m88k_pound_sign);
- output_addr_const (file, XEXP (reg1, 0));
- fputc (')', file);
- }
-
- else if (flag_pic)
- {
- fprintf (file, "%s,", reg_names[REGNO (reg0)]);
- output_addr_const (file, reg1);
- fputs ("#got_rel", file);
- }
- else abort ();
- }
-
- else
- abort ();
- break;
-
- case MULT:
- if (REGNO (XEXP (addr, 0)) == ARG_POINTER_REGNUM)
- abort ();
-
- fprintf (file, "%s[%s]",
- reg_names[0], reg_names[REGNO (XEXP (addr, 0))]);
- break;
-
- case CONST_INT:
- fprintf (file, "%s,%d", reg_names[0], INTVAL (addr));
- break;
-
- default:
- fprintf (file, "%s,", reg_names[0]);
- if (SHORT_ADDRESS_P (addr, temp))
- {
- fprintf (file, "%siw16(", m88k_pound_sign);
- output_addr_const (file, addr);
- fputc (')', file);
- }
- else
- output_addr_const (file, addr);
- }
-}
-
-/* Return true if X is an address which needs a temporary register when
- reloaded while generating PIC code. */
-
-int
-pic_address_needs_scratch (x)
- rtx x;
-{
- /* An address which is a symbolic plus a non SMALL_INT needs a temp reg. */
- if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && ! ADD_INT (XEXP (XEXP (x, 0), 1)))
- return 1;
-
- return 0;
-}
-
-/* Returns 1 if OP is either a symbol reference or a sum of a symbol
- reference and a constant. */
-
-int
-symbolic_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- return 1;
-
- case CONST:
- op = XEXP (op, 0);
- return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (op, 0)) == LABEL_REF)
- && GET_CODE (XEXP (op, 1)) == CONST_INT);
-
- /* ??? This clause seems to be irrelevant. */
- case CONST_DOUBLE:
- return GET_MODE (op) == mode;
-
- default:
- return 0;
- }
-}
diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h
deleted file mode 100644
index 8a45610a9b2..00000000000
--- a/gcc/config/m88k/m88k.h
+++ /dev/null
@@ -1,2644 +0,0 @@
-/* Definitions of target machine for GNU compiler for
- Motorola m88100 in an 88open OCS/BCS environment.
- Copyright (C) 1988, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.com).
- Currently maintained by (gcc@dg-rtp.dg.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 m88100 port of GNU CC adheres to the various standards from 88open.
- These documents are available by writing:
-
- 88open Consortium Ltd.
- 100 Homeland Court, Suite 800
- San Jose, CA 95112
- (408) 436-6600
-
- In brief, the current standards are:
-
- Binary Compatibility Standard, Release 1.1A, May 1991
- This provides for portability of application-level software at the
- executable level for AT&T System V Release 3.2.
-
- Object Compatibility Standard, Release 1.1A, May 1991
- This provides for portability of application-level software at the
- object file and library level for C, Fortran, and Cobol, and again,
- largely for SVR3.
-
- Under development are standards for AT&T System V Release 4, based on the
- [generic] System V Application Binary Interface from AT&T. These include:
-
- System V Application Binary Interface, Motorola 88000 Processor Supplement
- Another document from AT&T for SVR4 specific to the m88100.
- Available from Prentice Hall.
-
- System V Application Binary Interface, Motorola 88000 Processor Supplement,
- Release 1.1, Draft H, May 6, 1991
- A proposed update to the AT&T document from 88open.
-
- System V ABI Implementation Guide for the M88000 Processor,
- Release 1.0, January 1991
- A companion ABI document from 88open. */
-
-/* Other *.h files in config/m88k include this one and override certain items.
- Currently these are sysv3.h, sysv4.h, dgux.h, dolph.h, tekXD88.h, and luna.h.
- Additionally, sysv4.h and dgux.h include svr4.h first. All other
- m88k targets except luna.h are based on svr3.h. */
-
-/* Choose SVR3 as the default. */
-#if !defined(DBX_DEBUGGING_INFO) && !defined(DWARF_DEBUGGING_INFO)
-#include "svr3.h"
-#endif
-
-/* External types used. */
-
-/* What instructions are needed to manufacture an integer constant. */
-enum m88k_instruction {
- m88k_zero,
- m88k_or,
- m88k_subu,
- m88k_or_lo16,
- m88k_or_lo8,
- m88k_set,
- m88k_oru_hi16,
- m88k_oru_or
-};
-
-/* Which processor to schedule for. The elements of the enumeration
- must match exactly the cpu attribute in the m88k.md machine description. */
-
-enum processor_type {
- PROCESSOR_M88100,
- PROCESSOR_M88110,
- PROCESSOR_M88000,
-};
-
-/* Recast the cpu class to be the cpu attribute. */
-#define m88k_cpu_attr ((enum attr_cpu)m88k_cpu)
-
-/* External variables/functions defined in m88k.c. */
-
-extern char *m88k_pound_sign;
-extern char *m88k_short_data;
-extern char *m88k_version;
-extern char m88k_volatile_code;
-
-extern unsigned m88k_gp_threshold;
-extern int m88k_prologue_done;
-extern int m88k_function_number;
-extern int m88k_fp_offset;
-extern int m88k_stack_size;
-extern int m88k_case_index;
-
-extern struct rtx_def *m88k_compare_reg;
-extern struct rtx_def *m88k_compare_op0;
-extern struct rtx_def *m88k_compare_op1;
-
-extern enum processor_type m88k_cpu;
-
-extern int null_prologue ();
-extern int integer_ok_for_set ();
-extern int m88k_debugger_offset ();
-
-
-extern void emit_bcnd ();
-extern void expand_block_move ();
-extern void m88k_layout_frame ();
-extern void m88k_expand_prologue ();
-extern void m88k_begin_prologue ();
-extern void m88k_end_prologue ();
-extern void m88k_expand_epilogue ();
-extern void m88k_begin_epilogue ();
-extern void m88k_end_epilogue ();
-extern void output_function_profiler ();
-extern void output_function_block_profiler ();
-extern void output_block_profiler ();
-extern void output_file_start ();
-extern void output_ascii ();
-extern void output_label ();
-extern void print_operand ();
-extern void print_operand_address ();
-
-extern char *output_load_const_int ();
-extern char *output_load_const_float ();
-extern char *output_load_const_double ();
-extern char *output_load_const_dimode ();
-extern char *output_and ();
-extern char *output_ior ();
-extern char *output_xor ();
-extern char *output_call ();
-
-extern struct rtx_def *emit_test ();
-extern struct rtx_def *legitimize_address ();
-extern struct rtx_def *legitimize_operand ();
-extern struct rtx_def *m88k_function_arg ();
-extern struct rtx_def *m88k_builtin_saveregs ();
-
-extern enum m88k_instruction classify_integer ();
-
-/* external variables defined elsewhere in the compiler */
-
-extern int target_flags; /* -m compiler switches */
-extern int frame_pointer_needed; /* current function has a FP */
-extern int current_function_pretend_args_size; /* args size without ... */
-extern int flag_delayed_branch; /* -fdelayed-branch */
-extern int flag_pic; /* -fpic */
-extern char * reg_names[];
-
-/* Specify the default monitors. The meaning of these values can
- be obtained by doing "grep MONITOR_GCC *m88k*". Generally, the
- values downward from 0x8000 are tests that will soon go away.
- values upward from 0x1 are generally useful tests that will remain. */
-
-#ifndef MONITOR_GCC
-#define MONITOR_GCC 0
-#endif
-
-/*** Controlling the Compilation Driver, `gcc' ***/
-/* Show we can debug even without a frame pointer. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* If -m88100 is in effect, add -D__m88100__; similarly for -m88110.
- Here, the CPU_DEFAULT is assumed to be -m88100. */
-#undef CPP_SPEC
-#define CPP_SPEC "%{!m88000:%{!m88100:%{m88110:-D__m88110__}}} \
- %{!m88000:%{!m88110:-D__m88100__}}"
-
-/* LIB_SPEC, LINK_SPEC, and STARTFILE_SPEC defined in svr3.h.
- ASM_SPEC, ASM_FINAL_SPEC, LIB_SPEC, LINK_SPEC, and STARTFILE_SPEC redefined
- in svr4.h.
- CPP_SPEC, ASM_SPEC, ASM_FINAL_SPEC, LIB_SPEC, LINK_SPEC, and
- STARTFILE_SPEC redefined in dgux.h. */
-
-/*** Run-time Target Specification ***/
-
-/* Names to predefine in the preprocessor for this target machine.
- Redefined in sysv3.h, sysv4.h, dgux.h, and luna.h. */
-#define CPP_PREDEFINES "-Dm88000 -Dm88k -Dunix -D__CLASSIFY_TYPE__=2"
-
-#define TARGET_VERSION fprintf (stderr, " (%s%s)", \
- VERSION_INFO1, VERSION_INFO2)
-
-/* Print subsidiary information on the compiler version in use.
- Redefined in sysv4.h, and luna.h. */
-#define VERSION_INFO1 "m88k, "
-#ifndef VERSION_INFO2
-#define VERSION_INFO2 "$Revision: 1.72 $"
-#endif
-
-#ifndef VERSION_STRING
-#define VERSION_STRING version_string
-#ifdef __STDC__
-#define TM_RCS_ID "@(#)" __FILE__ " $Revision: 1.72 $ " __DATE__
-#else
-#define TM_RCS_ID "$What: <@(#) m88k.h,v 1.1.1.2.2.2> $"
-#endif /* __STDC__ */
-#else
-#define TM_RCS_ID "@(#)" __FILE__ " " VERSION_INFO2 " " __DATE__
-#endif /* VERSION_STRING */
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define MASK_88100 0x00000001 /* Target m88100 */
-#define MASK_88110 0x00000002 /* Target m88110 */
-#define MASK_88000 (MASK_88100 | MASK_88110)
-
-#define MASK_OCS_DEBUG_INFO 0x00000004 /* Emit .tdesc info */
-#define MASK_OCS_FRAME_POSITION 0x00000008 /* Debug frame = CFA, not r30 */
-#define MASK_SVR4 0x00000010 /* Target is AT&T System V.4 */
-#define MASK_SVR3 0x00000020 /* Target is AT&T System V.3 */
-#define MASK_NO_UNDERSCORES 0x00000040 /* Don't emit a leading `_' */
-#define MASK_BIG_PIC 0x00000080 /* PIC with large got-rel's -fPIC */
-#define MASK_TRAP_LARGE_SHIFT 0x00000100 /* Trap if shift not <= 31 */
-#define MASK_HANDLE_LARGE_SHIFT 0x00000200 /* Handle shift count >= 32 */
-#define MASK_CHECK_ZERO_DIV 0x00000400 /* Check for int div. by 0 */
-#define MASK_USE_DIV 0x00000800 /* No signed div. checks */
-#define MASK_IDENTIFY_REVISION 0x00001000 /* Emit ident, with GCC rev */
-#define MASK_WARN_PASS_STRUCT 0x00002000 /* Warn about passed structs */
-#define MASK_OPTIMIZE_ARG_AREA 0x00004000 /* Save stack space */
-#define MASK_NO_SERIALIZE_VOLATILE 0x00008000 /* Serialize volatile refs */
-#define MASK_EITHER_LARGE_SHIFT (MASK_TRAP_LARGE_SHIFT | \
- MASK_HANDLE_LARGE_SHIFT)
-#define MASK_OMIT_LEAF_FRAME_POINTER 0x00020000 /* omit leaf frame pointers */
-
-
-#define TARGET_88100 ((target_flags & MASK_88000) == MASK_88100)
-#define TARGET_88110 ((target_flags & MASK_88000) == MASK_88110)
-#define TARGET_88000 ((target_flags & MASK_88000) == MASK_88000)
-
-#define TARGET_OCS_DEBUG_INFO (target_flags & MASK_OCS_DEBUG_INFO)
-#define TARGET_OCS_FRAME_POSITION (target_flags & MASK_OCS_FRAME_POSITION)
-#define TARGET_SVR4 (target_flags & MASK_SVR4)
-#define TARGET_SVR3 (target_flags & MASK_SVR3)
-#define TARGET_NO_UNDERSCORES (target_flags & MASK_NO_UNDERSCORES)
-#define TARGET_BIG_PIC (target_flags & MASK_BIG_PIC)
-#define TARGET_TRAP_LARGE_SHIFT (target_flags & MASK_TRAP_LARGE_SHIFT)
-#define TARGET_HANDLE_LARGE_SHIFT (target_flags & MASK_HANDLE_LARGE_SHIFT)
-#define TARGET_CHECK_ZERO_DIV (target_flags & MASK_CHECK_ZERO_DIV)
-#define TARGET_USE_DIV (target_flags & MASK_USE_DIV)
-#define TARGET_IDENTIFY_REVISION (target_flags & MASK_IDENTIFY_REVISION)
-#define TARGET_WARN_PASS_STRUCT (target_flags & MASK_WARN_PASS_STRUCT)
-#define TARGET_OPTIMIZE_ARG_AREA (target_flags & MASK_OPTIMIZE_ARG_AREA)
-#define TARGET_SERIALIZE_VOLATILE (!(target_flags & MASK_NO_SERIALIZE_VOLATILE))
-
-#define TARGET_EITHER_LARGE_SHIFT (target_flags & MASK_EITHER_LARGE_SHIFT)
-#define TARGET_OMIT_LEAF_FRAME_POINTER (target_flags & MASK_OMIT_LEAF_FRAME_POINTER)
-
-/* Redefined in sysv3.h, sysv4.h, and dgux.h. */
-#define TARGET_DEFAULT (MASK_CHECK_ZERO_DIV)
-#define CPU_DEFAULT MASK_88100
-
-#define TARGET_SWITCHES \
- { \
- { "88110", MASK_88110 }, \
- { "88100", MASK_88100 }, \
- { "88000", MASK_88000 }, \
- { "ocs-debug-info", MASK_OCS_DEBUG_INFO }, \
- { "no-ocs-debug-info", -MASK_OCS_DEBUG_INFO }, \
- { "ocs-frame-position", MASK_OCS_FRAME_POSITION }, \
- { "no-ocs-frame-position", -MASK_OCS_FRAME_POSITION }, \
- { "svr4", MASK_SVR4 }, \
- { "svr3", -MASK_SVR4 }, \
- { "no-underscores", MASK_NO_UNDERSCORES }, \
- { "big-pic", MASK_BIG_PIC }, \
- { "trap-large-shift", MASK_TRAP_LARGE_SHIFT }, \
- { "handle-large-shift", MASK_HANDLE_LARGE_SHIFT }, \
- { "check-zero-division", MASK_CHECK_ZERO_DIV }, \
- { "no-check-zero-division", -MASK_CHECK_ZERO_DIV }, \
- { "use-div-instruction", MASK_USE_DIV }, \
- { "identify-revision", MASK_IDENTIFY_REVISION }, \
- { "warn-passed-structs", MASK_WARN_PASS_STRUCT }, \
- { "optimize-arg-area", MASK_OPTIMIZE_ARG_AREA }, \
- { "no-optimize-arg-area", -MASK_OPTIMIZE_ARG_AREA }, \
- { "no-serialize-volatile", MASK_NO_SERIALIZE_VOLATILE }, \
- { "serialize-volatile", -MASK_NO_SERIALIZE_VOLATILE }, \
- { "omit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER }, \
- { "no-omit-leaf-frame-pointer", -MASK_OMIT_LEAF_FRAME_POINTER }, \
- SUBTARGET_SWITCHES \
- /* Default switches */ \
- { "", TARGET_DEFAULT }, \
- }
-
-/* Redefined in dgux.h. */
-#define SUBTARGET_SWITCHES
-
-/* Macro to define table for command options with values. */
-
-#define TARGET_OPTIONS { { "short-data-", &m88k_short_data }, \
- { "version-", &m88k_version } }
-
-/* Do any checking or such that is needed after processing the -m switches. */
-
-#define OVERRIDE_OPTIONS \
- do { \
- register int i; \
- \
- if ((target_flags & MASK_88000) == 0) \
- target_flags |= CPU_DEFAULT; \
- \
- if (TARGET_88110) \
- { \
- target_flags |= MASK_USE_DIV; \
- target_flags &= ~MASK_CHECK_ZERO_DIV; \
- } \
- \
- m88k_cpu = (TARGET_88000 ? PROCESSOR_M88000 \
- : (TARGET_88100 ? PROCESSOR_M88100 : PROCESSOR_M88110)); \
- \
- if (TARGET_BIG_PIC) \
- flag_pic = 2; \
- \
- if ((target_flags & MASK_EITHER_LARGE_SHIFT) == MASK_EITHER_LARGE_SHIFT) \
- error ("-mtrap-large-shift and -mhandle-large-shift are incompatible");\
- \
- if (TARGET_SVR4) \
- { \
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) \
- reg_names[i]--; \
- m88k_pound_sign = "#"; \
- } \
- else \
- { \
- target_flags |= MASK_SVR3; \
- target_flags &= ~MASK_SVR4; \
- } \
- \
- if (m88k_short_data) \
- { \
- char *p = m88k_short_data; \
- while (*p) \
- if (*p >= '0' && *p <= '9') \
- p++; \
- else \
- { \
- error ("Invalid option `-mshort-data-%s'", m88k_short_data); \
- break; \
- } \
- m88k_gp_threshold = atoi (m88k_short_data); \
- if (m88k_gp_threshold > 0x7fffffff) \
- error ("-mshort-data-%s is too large ", m88k_short_data); \
- if (flag_pic) \
- error ("-mshort-data-%s and PIC are incompatible", m88k_short_data); \
- } \
- if (TARGET_OMIT_LEAF_FRAME_POINTER) /* keep nonleaf frame pointers */ \
- flag_omit_frame_pointer = 1; \
- } while (0)
-
-/*** Storage Layout ***/
-
-/* Sizes in bits of the various types. */
-#define CHAR_TYPE_SIZE 8
-#define SHORT_TYPE_SIZE 16
-#define INT_TYPE_SIZE 32
-#define LONG_TYPE_SIZE 32
-#define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- Somewhat arbitrary. It matches the bit field patterns. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered.
- That is true on the m88000. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered.
- For the m88000 we can decide arbitrarily since there are no machine
- instructions for them. */
-#define WORDS_BIG_ENDIAN 1
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Largest alignment for stack parameters (if greater than PARM_BOUNDARY). */
-#define MAX_PARM_BOUNDARY 64
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 128
-
-/* Allocation boundary (in *bits*) for the code of a function. On the
- m88100, it is desirable to align to a cache line. However, SVR3 targets
- only provided 8 byte alignment. The m88110 cache is small, so align
- to an 8 byte boundary. Pack code tightly when compiling crtstuff.c. */
-#define FUNCTION_BOUNDARY (flag_inhibit_size_directive ? 32 : \
- (TARGET_88100 && TARGET_SVR4 ? 128 : 64))
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 64
-
-/* The best alignment to use in cases where we have a choice. */
-#define FASTEST_ALIGNMENT (TARGET_88100 ? 32 : 64)
-
-/* Make strings 4/8 byte aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- ((TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < FASTEST_ALIGNMENT) \
- ? FASTEST_ALIGNMENT : (ALIGN))
-
-/* Make arrays of chars 4/8 byte aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
-
-/* Alignment of field after `int : 0' in a structure.
- Ignored with PCC_BITFIELD_TYPE_MATTERS. */
-/* #define EMPTY_FIELD_BOUNDARY 8 */
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Maximum size (in bits) to use for the largest integral type that
- replaces a BLKmode type. */
-/* #define MAX_FIXED_MODE_SIZE 0 */
-
-/* Check a `double' value for validity for a particular machine mode.
- This is defined to avoid crashes outputting certain constants.
- Since we output the number in hex, the assembler won't choke on it. */
-/* #define CHECK_FLOAT_VALUE(MODE,VALUE) */
-
-/* A code distinguishing the floating point format of the target machine. */
-/* #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT */
-
-/*** Register Usage ***/
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- The m88100 has a General Register File (GRF) of 32 32-bit registers.
- The m88110 adds an Extended Register File (XRF) of 32 80-bit registers. */
-#define FIRST_PSEUDO_REGISTER 64
-#define FIRST_EXTENDED_REGISTER 32
-
-/* General notes on extended registers, their use and misuse.
-
- Possible good uses:
-
- spill area instead of memory.
- -waste if only used once
-
- floating point calculations
- -probably a waste unless we have run out of general purpose registers
-
- freeing up general purpose registers
- -e.g. may be able to have more loop invariants if floating
- point is moved into extended registers.
-
-
- I've noticed wasteful moves into and out of extended registers; e.g. a load
- into x21, then inside a loop a move into r24, then r24 used as input to
- an fadd. Why not just load into r24 to begin with? Maybe the new cse.c
- will address this. This wastes a move, but the load,store and move could
- have been saved had extended registers been used throughout.
- E.g. in the code following code, if z and xz are placed in extended
- registers, there is no need to save preserve registers.
-
- long c=1,d=1,e=1,f=1,g=1,h=1,i=1,j=1,k;
-
- double z=0,xz=4.5;
-
- foo(a,b)
- long a,b;
- {
- while (a < b)
- {
- k = b + c + d + e + f + g + h + a + i + j++;
- z += xz;
- a++;
- }
- printf("k= %d; z=%f;\n", k, z);
- }
-
- I've found that it is possible to change the constraints (putting * before
- the 'r' constraints int the fadd.ddd instruction) and get the entire
- addition and store to go into extended registers. However, this also
- forces simple addition and return of floating point arguments to a
- function into extended registers. Not the correct solution.
-
- Found the following note in local-alloc.c which may explain why I can't
- get both registers to be in extended registers since two are allocated in
- local-alloc and one in global-alloc. Doesn't explain (I don't believe)
- why an extended register is used instead of just using the preserve
- register.
-
- from local-alloc.c:
- We have provision to exempt registers, even when they are contained
- within the block, that can be tied to others that are not contained in it.
- This is so that global_alloc could process them both and tie them then.
- But this is currently disabled since tying in global_alloc is not
- yet implemented.
-
- The explanation of why the preserved register is not used is as follows,
- I believe. The registers are being allocated in order. Tying is not
- done so efficiently, so when it comes time to do the first allocation,
- there are no registers left to use without spilling except extended
- registers. Then when the next pseudo register needs a hard reg, there
- are still no registers to be had for free, but this one must be a GRF
- reg instead of an extended reg, so a preserve register is spilled. Thus
- the move from extended to GRF is necessitated. I do not believe this can
- be 'fixed' through the config/*m88k* files.
-
- gcc seems to sometimes make worse use of register allocation -- not counting
- moves -- whenever extended registers are present. For example in the
- whetstone, the simple for loop (slightly modified)
- for(i = 1; i <= n1; i++)
- {
- x1 = (x1 + x2 + x3 - x4) * t;
- x2 = (x1 + x2 - x3 + x4) * t;
- x3 = (x1 - x2 + x3 + x4) * t;
- x4 = (x1 + x2 + x3 + x4) * t;
- }
- in general loads the high bits of the addresses of x2-x4 and i into registers
- outside the loop. Whenever extended registers are used, it loads all of
- these inside the loop. My conjecture is that since the 88110 has so many
- registers, and gcc makes no distinction at this point -- just that they are
- not fixed, that in loop.c it believes it can expect a number of registers
- to be available. Then it allocates 'too many' in local-alloc which causes
- problems later. 'Too many' are allocated because a large portion of the
- registers are extended registers and cannot be used for certain purposes
- ( e.g. hold the address of a variable). When this loop is compiled on its
- own, the problem does not occur. I don't know the solution yet, though it
- is probably in the base sources. Possibly a different way to calculate
- "threshold". */
-
-/* 1 for registers that have pervasive standard uses and are not available
- for the register allocator. Registers r14-r25 and x22-x29 are expected
- to be preserved across function calls.
-
- On the 88000, the standard uses of the General Register File (GRF) are:
- Reg 0 = Pseudo argument pointer (hardware fixed to 0).
- Reg 1 = Subroutine return pointer (hardware).
- Reg 2-9 = Parameter registers (OCS).
- Reg 10 = OCS reserved temporary.
- Reg 11 = Static link if needed [OCS reserved temporary].
- Reg 12 = Address of structure return (OCS).
- Reg 13 = OCS reserved temporary.
- Reg 14-25 = Preserved register set.
- Reg 26-29 = Reserved by OCS and ABI.
- Reg 30 = Frame pointer (Common use).
- Reg 31 = Stack pointer.
-
- The following follows the current 88open UCS specification for the
- Extended Register File (XRF):
- Reg 32 = x0 Always equal to zero
- Reg 33-53 = x1-x21 Temporary registers (Caller Save)
- Reg 54-61 = x22-x29 Preserver registers (Callee Save)
- Reg 62-63 = x30-x31 Reserved for future ABI use.
-
- Note: The current 88110 extended register mapping is subject to change.
- The bias towards caller-save registers is based on the
- presumption that memory traffic can potentially be reduced by
- allowing the "caller" to save only that part of the register
- which is actually being used. (i.e. don't do a st.x if a st.d
- is sufficient). Also, in scientific code (a.k.a. Fortran), the
- large number of variables defined in common blocks may require
- that almost all registers be saved across calls anyway. */
-
-#define FIXED_REGISTERS \
- {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}
-
-/* Macro to conditionally modify fixed_regs/call_used_regs. */
-#define CONDITIONAL_REGISTER_USAGE \
- { \
- if (! TARGET_88110) \
- { \
- register int i; \
- for (i = FIRST_EXTENDED_REGISTER; i < FIRST_PSEUDO_REGISTER; i++) \
- { \
- fixed_regs[i] = 1; \
- call_used_regs[i] = 1; \
- } \
- } \
- if (flag_pic) \
- { \
- /* Current hack to deal with -fpic -O2 problems. */ \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- global_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- } \
- }
-
-/* These interfaces that don't apply to the m88000. */
-/* OVERLAPPING_REGNO_P(REGNO) 0 */
-/* INSN_CLOBBERS_REGNO_P(INSN, REGNO) 0 */
-/* PRESERVE_DEATH_INFO_REGNO_P(REGNO) 0 */
-
-/* True if register is an extended register. */
-#define XRF_REGNO_P(N) ((N) < FIRST_PSEUDO_REGISTER && (N) >= FIRST_EXTENDED_REGISTER)
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On the m88000, GRF registers hold 32-bits and XRF registers hold 80-bits.
- An XRF register can hold any mode, but two GRF registers are required
- for larger modes. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (XRF_REGNO_P (REGNO) \
- ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
-
- For double integers, we never put the value into an odd register so that
- the operators don't run into the situation where the high part of one of
- the inputs is the low part of the result register. (It's ok if the output
- registers are the same as the input registers.) The XRF registers can
- hold all modes, but only DF and SF modes can be manipulated in these
- registers. The compiler should be allowed to use these as a fast spill
- area. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (XRF_REGNO_P(REGNO) \
- ? (TARGET_88110 && GET_MODE_CLASS (MODE) == MODE_FLOAT) \
- : (((MODE) != DImode && (MODE) != DFmode && (MODE) != DCmode) \
- || ((REGNO) & 1) == 0))
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (((MODE1) == DFmode || (MODE1) == DCmode || (MODE1) == DImode \
- || (TARGET_88110 && GET_MODE_CLASS (MODE1) == MODE_FLOAT)) \
- == ((MODE2) == DFmode || (MODE2) == DCmode || (MODE2) == DImode \
- || (TARGET_88110 && GET_MODE_CLASS (MODE2) == MODE_FLOAT)))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* the m88000 pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 31
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 30
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 0
-
-/* Register used in cases where a temporary is known to be safe to use. */
-#define TEMP_REGNUM 10
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 11
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 12
-
-/* Register to hold the addressing base for position independent
- code access to data items. */
-#define PIC_OFFSET_TABLE_REGNUM 25
-
-/* Order in which registers are preferred (most to least). Use temp
- registers, then param registers top down. Preserve registers are
- top down to maximize use of double memory ops for register save.
- The 88open reserved registers (r26-r29 and x30-x31) may commonly be used
- in most environments with the -fcall-used- or -fcall-saved- options. */
-#define REG_ALLOC_ORDER \
- { \
- 13, 12, 11, 10, 29, 28, 27, 26, \
- 62, 63, 9, 8, 7, 6, 5, 4, \
- 3, 2, 1, 53, 52, 51, 50, 49, \
- 48, 47, 46, 45, 44, 43, 42, 41, \
- 40, 39, 38, 37, 36, 35, 34, 33, \
- 25, 24, 23, 22, 21, 20, 19, 18, \
- 17, 16, 15, 14, 61, 60, 59, 58, \
- 57, 56, 55, 54, 30, 31, 0, 32}
-
-/* Order for leaf functions. */
-#define REG_LEAF_ALLOC_ORDER \
- { \
- 9, 8, 7, 6, 13, 12, 11, 10, \
- 29, 28, 27, 26, 62, 63, 5, 4, \
- 3, 2, 0, 53, 52, 51, 50, 49, \
- 48, 47, 46, 45, 44, 43, 42, 41, \
- 40, 39, 38, 37, 36, 35, 34, 33, \
- 25, 24, 23, 22, 21, 20, 19, 18, \
- 17, 16, 15, 14, 61, 60, 59, 58, \
- 57, 56, 55, 54, 30, 31, 1, 32}
-
-/* Switch between the leaf and non-leaf orderings. The purpose is to avoid
- write-over scoreboard delays between caller and callee. */
-#define ORDER_REGS_FOR_LOCAL_ALLOC \
-{ \
- static int leaf[] = REG_LEAF_ALLOC_ORDER; \
- static int nonleaf[] = REG_ALLOC_ORDER; \
- \
- bcopy (regs_ever_live[1] ? nonleaf : leaf, reg_alloc_order, \
- FIRST_PSEUDO_REGISTER * sizeof (int)); \
-}
-
-/*** Register Classes ***/
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The m88000 hardware has two kinds of registers. In addition, we denote
- the arg pointer as a separate class. */
-
-enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
- XGRF_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-#define REG_CLASS_NAMES {"NO_REGS", "AP_REG", "XRF_REGS", "GENERAL_REGS", \
- "AGRF_REGS", "XGRF_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-#define REG_CLASS_CONTENTS {{0x00000000, 0x00000000}, \
- {0x00000001, 0x00000000}, \
- {0x00000000, 0xffffffff}, \
- {0xfffffffe, 0x00000000}, \
- {0xffffffff, 0x00000000}, \
- {0xfffffffe, 0xffffffff}, \
- {0xffffffff, 0xffffffff}}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) ? ((REGNO < 32) ? GENERAL_REGS : XRF_REGS) : AP_REG)
-
-/* The class value for index registers, and the one for base regs. */
-#define BASE_REG_CLASS AGRF_REGS
-#define INDEX_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description.
- For the 88000, the following class/letter is defined for the XRF:
- x - Extended register file */
-#define REG_CLASS_FROM_LETTER(C) \
- (((C) == 'x') ? XRF_REGS : NO_REGS)
-
-/* Macros to check register numbers against specific register classes.
- These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-#define REGNO_OK_FOR_BASE_P(REGNO) \
- ((REGNO) < FIRST_EXTENDED_REGISTER \
- || (unsigned) reg_renumber[REGNO] < FIRST_EXTENDED_REGISTER)
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
- (((REGNO) && (REGNO) < FIRST_EXTENDED_REGISTER) \
- || (unsigned) reg_renumber[REGNO] < FIRST_EXTENDED_REGISTER)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
- Double constants should be in a register iff they can be made cheaply. */
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- (CONSTANT_P(X) && (CLASS == XRF_REGS) ? NO_REGS : (CLASS))
-
-/* Return the register class of a scratch register needed to load IN
- into a register of class CLASS in MODE. On the m88k, when PIC, we
- need a temporary when loading some addresses into a register. */
-#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN) \
- ((flag_pic \
- && GET_CODE (IN) == CONST \
- && GET_CODE (XEXP (IN, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (IN, 0), 0)) == CONST_INT \
- && ! SMALL_INT (XEXP (XEXP (IN, 0), 1))) ? GENERAL_REGS : NO_REGS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((((CLASS) == XRF_REGS) ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
-
-/* Letters in the range `I' through `P' in a register constraint string can
- be used to stand for particular ranges of immediate operands. The C
- expression is true iff C is a known letter and VALUE is appropriate for
- that letter.
-
- For the m88000, the following constants are used:
- `I' requires a non-negative 16-bit value.
- `J' requires a non-positive 16-bit value.
- `K' requires a non-negative value < 32.
- `L' requires a constant with only the upper 16-bits set.
- `M' requires constant values that can be formed with `set'.
- `N' requires a negative value.
- `O' requires zero.
- `P' requires a non-negative value. */
-
-/* Quick tests for certain values. */
-#define SMALL_INT(X) (SMALL_INTVAL (INTVAL (X)))
-#define SMALL_INTVAL(I) ((unsigned) (I) < 0x10000)
-#define ADD_INT(X) (ADD_INTVAL (INTVAL (X)))
-#define ADD_INTVAL(I) ((unsigned) (I) + 0xffff < 0x1ffff)
-#define POWER_OF_2(I) ((I) && POWER_OF_2_or_0(I))
-#define POWER_OF_2_or_0(I) (((I) & ((unsigned)(I) - 1)) == 0)
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? SMALL_INTVAL (VALUE) \
- : (C) == 'J' ? SMALL_INTVAL (-(VALUE)) \
- : (C) == 'K' ? (unsigned)(VALUE) < 32 \
- : (C) == 'L' ? ((VALUE) & 0xffff) == 0 \
- : (C) == 'M' ? integer_ok_for_set (VALUE) \
- : (C) == 'N' ? (VALUE) < 0 \
- : (C) == 'O' ? (VALUE) == 0 \
- : (C) == 'P' ? (VALUE) >= 0 \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. For the m88000, the
- constraints are: `G' requires zero, and `H' requires one or two. */
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? (CONST_DOUBLE_HIGH (VALUE) == 0 \
- && CONST_DOUBLE_LOW (VALUE) == 0) \
- : 0)
-
-/* Letters in the range `Q' through `U' in a register constraint string
- may be defined in a machine-dependent fashion to stand for arbitrary
- operand types.
-
- For the m88k, `Q' handles addresses in a call context. */
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' ? symbolic_address_p (OP) : 0)
-
-/*** Describing Stack Layout ***/
-
-/* Define this if pushing a word on the stack moves the stack pointer
- to a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* Define this if the addresses of local variable slots are at negative
- offsets from the frame pointer. */
-/* #define FRAME_GROWS_DOWNWARD */
-
-/* Offset from the frame pointer to the first local variable slot to be
- allocated. For the m88k, the debugger wants the return address (r1)
- stored at location r30+4, and the previous frame pointer stored at
- location r30. */
-#define STARTING_FRAME_OFFSET 8
-
-/* If we generate an insn to push BYTES bytes, this says how many the
- stack pointer really advances by. The m88k has no push instruction. */
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* If defined, the maximum amount of space required for outgoing arguments
- will be computed and placed into the variable
- `current_function_outgoing_args_size'. No space will be pushed
- onto the stack for each call; instead, the function prologue should
- increase the stack frame size by this amount. */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Offset from the stack pointer register to the first location at which
- outgoing arguments are placed. Use the default value zero. */
-/* #define STACK_POINTER_OFFSET 0 */
-
-/* Offset of first parameter from the argument pointer register value.
- Using an argument pointer, this is 0 for the m88k. GCC knows
- how to eliminate the argument pointer references if necessary. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Define this if functions should assume that stack space has been
- allocated for arguments even when their values are passed in
- registers.
-
- The value of this macro is the size, in bytes, of the area reserved for
- arguments passed in registers.
-
- This space can either be allocated by the caller or be a part of the
- machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE'
- says which. */
-#define REG_PARM_STACK_SPACE(FNDECL) 32
-
-/* Define this macro if REG_PARM_STACK_SPACE is defined but stack
- parameters don't skip the area specified by REG_PARM_STACK_SPACE.
- Normally, when a parameter is not passed in registers, it is placed on
- the stack beyond the REG_PARM_STACK_SPACE area. Defining this macro
- suppresses this behavior and causes the parameter to be passed on the
- stack in its natural location. */
-#define STACK_PARMS_IN_REG_PARM_AREA
-
-/* Define this if it is the responsibility of the caller to allocate the
- area reserved for arguments passed in registers. If
- `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect of this
- macro is to determine whether the space is included in
- `current_function_outgoing_args_size'. */
-/* #define OUTGOING_REG_PARM_STACK_SPACE */
-
-/* Offset from the stack pointer register to an item dynamically allocated
- on the stack, e.g., by `alloca'.
-
- The default value for this macro is `STACK_POINTER_OFFSET' plus the
- length of the outgoing arguments. The default is correct for most
- machines. See `function.c' for details. */
-/* #define STACK_DYNAMIC_OFFSET(FUNDECL) ... */
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, \
- TYPE_MODE (VALTYPE) == BLKmode ? SImode : TYPE_MODE (VALTYPE), \
- 2)
-
-/* Define this if it differs from FUNCTION_VALUE. */
-/* #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) ... */
-
-/* Disable the promotion of some structures and unions to registers. */
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE (TYPE) == BLKmode \
- || ((TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE(TYPE) == UNION_TYPE) \
- && !(TYPE_MODE (TYPE) == SImode \
- || (TYPE_MODE (TYPE) == BLKmode \
- && TYPE_ALIGN (TYPE) == BITS_PER_WORD \
- && int_size_in_bytes (TYPE) == UNITS_PER_WORD))))
-
-/* Don't default to pcc-struct-return, because we have already specified
- exactly how to return structures in the RETURN_IN_MEMORY macro. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 2)
-
-/* True if N is a possible register number for a function value
- as seen by the caller. */
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 2)
-
-/* Determine whether a function argument is passed in a register, and
- which register. See m88k.c. */
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- m88k_function_arg (CUM, MODE, TYPE, NAMED)
-
-/* Define this if it differs from FUNCTION_ARG. */
-/* #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) ... */
-
-/* A C expression for the number of words, at the beginning of an
- argument, must be put in registers. The value must be zero for
- arguments that are passed entirely in registers or that are entirely
- pushed on the stack. */
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) (0)
-
-/* A C expression that indicates when an argument must be passed by
- reference. If nonzero for an argument, a copy of that argument is
- made in memory and a pointer to the argument is passed instead of the
- argument itself. The pointer is passed in whatever way is appropriate
- for passing a pointer to that type. */
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) (0)
-
-/* A C type for declaring a variable that is used as the first argument
- of `FUNCTION_ARG' and other related values. It suffices to count
- the number of words of argument so far. */
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to a
- function whose data type is FNTYPE. For a library call, FNTYPE is 0. */
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) ((CUM) = 0)
-
-/* A C statement (sans semicolon) to update the summarizer variable
- CUM to advance past an argument in the argument list. The values
- MODE, TYPE and NAMED describe that argument. Once this is done,
- the variable CUM is suitable for analyzing the *following* argument
- with `FUNCTION_ARG', etc. (TYPE is null for libcalls where that
- information may not be available.) */
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- do { \
- enum machine_mode __mode = (TYPE) ? TYPE_MODE (TYPE) : (MODE); \
- if ((CUM & 1) \
- && (__mode == DImode || __mode == DFmode \
- || ((TYPE) && TYPE_ALIGN (TYPE) > BITS_PER_WORD))) \
- CUM++; \
- CUM += (((__mode != BLKmode) \
- ? GET_MODE_SIZE (MODE) : int_size_in_bytes (TYPE)) \
- + 3) / 4; \
- } while (0)
-
-/* True if N is a possible register number for function argument passing.
- On the m88000, these are registers 2 through 9. */
-#define FUNCTION_ARG_REGNO_P(N) ((N) <= 9 && (N) >= 2)
-
-/* A C expression which determines whether, and in which direction,
- to pad out an argument with extra space. The value should be of
- type `enum direction': either `upward' to pad above the argument,
- `downward' to pad below, or `none' to inhibit padding.
-
- This macro does not control the *amount* of padding; that is always
- just enough to reach the next multiple of `FUNCTION_ARG_BOUNDARY'. */
-#define FUNCTION_ARG_PADDING(MODE, TYPE) \
- ((MODE) == BLKmode \
- || ((TYPE) && (TREE_CODE (TYPE) == RECORD_TYPE \
- || TREE_CODE (TYPE) == UNION_TYPE)) \
- ? upward : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY ? downward : none)
-
-/* If defined, a C expression that gives the alignment boundary, in bits,
- of an argument with the specified mode and type. If it is not defined,
- `PARM_BOUNDARY' is used for all arguments. */
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
- (((TYPE) ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) <= PARM_BOUNDARY \
- ? PARM_BOUNDARY : 2 * PARM_BOUNDARY)
-
-/* Generate necessary RTL for __builtin_saveregs().
- ARGLIST is the argument list; see expr.c. */
-#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) m88k_builtin_saveregs (ARGLIST)
-
-/* Generate the assembly code for function entry. */
-#define FUNCTION_PROLOGUE(FILE, SIZE) m88k_begin_prologue(FILE, SIZE)
-
-/* Perform special actions at the point where the prologue ends. */
-#define FUNCTION_END_PROLOGUE(FILE) m88k_end_prologue(FILE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. Redefined in sysv3.h, sysv4.h and
- dgux.h. */
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- output_function_profiler (FILE, LABELNO, "mcount", 1)
-
-/* Maximum length in instructions of the code output by FUNCTION_PROFILER. */
-#define FUNCTION_PROFILER_LENGTH (5+3+1+5)
-
-/* Output assembler code to FILE to initialize basic-block profiling for
- the current module. LABELNO is unique to each instance. */
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- output_function_block_profiler (FILE, LABELNO)
-
-/* Maximum length in instructions of the code output by
- FUNCTION_BLOCK_PROFILER. */
-#define FUNCTION_BLOCK_PROFILER_LENGTH (3+5+2+5)
-
-/* Output assembler code to FILE to increment the count associated with
- the basic block number BLOCKNO. */
-#define BLOCK_PROFILER(FILE, BLOCKNO) output_block_profiler (FILE, BLOCKNO)
-
-/* Maximum length in instructions of the code output by BLOCK_PROFILER. */
-#define BLOCK_PROFILER_LENGTH 4
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-#define EXIT_IGNORE_STACK (1)
-
-/* Generate the assembly code for function exit. */
-#define FUNCTION_EPILOGUE(FILE, SIZE) m88k_end_epilogue(FILE, SIZE)
-
-/* Perform special actions at the point where the epilogue begins. */
-#define FUNCTION_BEGIN_EPILOGUE(FILE) m88k_begin_epilogue(FILE)
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED \
-(current_function_varargs \
- || (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ()) \
- || (write_symbols != NO_DEBUG && !TARGET_OCS_FRAME_POSITION))
-
-/* Definitions for register eliminations.
-
- We have two registers that can be eliminated on the m88k. First, the
- frame pointer register can often be eliminated in favor of the stack
- pointer register. Secondly, the argument pointer register can always be
- eliminated; it is replaced with either the stack or frame pointer. */
-
-/* This is an array of structures. Each structure initializes one pair
- of eliminable registers. The "from" register number is given first,
- followed by "to". Eliminations of the same "from" register are listed
- in order of preference. */
-#define ELIMINABLE_REGS \
-{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
-
-/* Given FROM and TO register numbers, say whether this elimination
- is allowed. */
-#define CAN_ELIMINATE(FROM, TO) \
- (!((FROM) == FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED))
-
-/* Define the offset between two registers, one to be eliminated, and the other
- its replacement, at the start of a routine. */
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ m88k_layout_frame (); \
- if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- (OFFSET) = m88k_fp_offset; \
- else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
- (OFFSET) = m88k_stack_size - m88k_fp_offset; \
- else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- (OFFSET) = m88k_stack_size; \
- else \
- abort (); \
-}
-
-/*** Trampolines for Nested Functions ***/
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- This block is placed on the stack and filled in. It is aligned
- 0 mod 128 and those portions that are executed are constant.
- This should work for instruction caches that have cache lines up
- to the aligned amount (128 is arbitrary), provided no other code
- producer is attempting to play the same game. This of course is
- in violation of any number of 88open standards. */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- char buf[256]; \
- static int labelno = 0; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (buf, "LTRMP", labelno); \
- /* Save the return address (r1) in the static chain reg (r11). */ \
- fprintf (FILE, "\tor\t %s,%s,0\n", reg_names[11], reg_names[1]); \
- /* Locate this block; transfer to the next instruction. */ \
- fprintf (FILE, "\tbsr\t %s\n", &buf[1]); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "LTRMP", labelno); \
- /* Save r10; use it as the relative pointer; restore r1. */ \
- fprintf (FILE, "\tst\t %s,%s,24\n", reg_names[10], reg_names[1]); \
- fprintf (FILE, "\tor\t %s,%s,0\n", reg_names[10], reg_names[1]); \
- fprintf (FILE, "\tor\t %s,%s,0\n", reg_names[1], reg_names[11]); \
- /* Load the function's address and go there. */ \
- fprintf (FILE, "\tld\t %s,%s,32\n", reg_names[11], reg_names[10]); \
- fprintf (FILE, "\tjmp.n\t %s\n", reg_names[11]); \
- /* Restore r10 and load the static chain register. */ \
- fprintf (FILE, "\tld.d\t %s,%s,24\n", reg_names[10], reg_names[10]); \
- /* Storage: r10 save area, static chain, function address. */ \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
-}
-
-/* Length in units of the trampoline for entering a nested function.
- This is really two components. The first 32 bytes are fixed and
- must be copied; the last 12 bytes are just storage that's filled
- in later. So for allocation purposes, it's 32+12 bytes, but for
- initialization purposes, it's 32 bytes. */
-
-#define TRAMPOLINE_SIZE (32+12)
-
-/* Alignment required for a trampoline. 128 is used to find the
- beginning of a line in the instruction cache and to allow for
- instruction cache lines of up to 128 bytes. */
-
-#define TRAMPOLINE_ALIGNMENT 128
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 40)), FNADDR); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 36)), CXT); \
-}
-
-/*** Library Subroutine Names ***/
-
-/* Define this macro if GNU CC should generate calls to the System V
- (and ANSI C) library functions `memcpy' and `memset' rather than
- the BSD functions `bcopy' and `bzero'. */
-#define TARGET_MEM_FUNCTIONS
-
-/*** Addressing Modes ***/
-
-#define EXTRA_CC_MODES CCEVENmode
-
-#define EXTRA_CC_NAMES "CCEVEN"
-
-#define SELECT_CC_MODE(OP,X,Y) CCmode
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Recognize any constant value that is a valid address.
- When PIC, we do not accept an address that would require a scratch reg
- to load into a register. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \
- || (GET_CODE (X) == CONST \
- && ! (flag_pic && pic_address_needs_scratch (X))))
-
-
-/* Maximum number of registers that can appear in a valid memory address. */
-#define MAX_REGS_PER_ADDRESS 2
-
-/* The condition for memory shift insns. */
-#define SCALED_ADDRESS_P(ADDR) \
- (GET_CODE (ADDR) == PLUS \
- && (GET_CODE (XEXP (ADDR, 0)) == MULT \
- || GET_CODE (XEXP (ADDR, 1)) == MULT))
-
-/* Can the reference to X be made short? */
-#define SHORT_ADDRESS_P(X,TEMP) \
- ((TEMP) = (GET_CODE (X) == CONST ? get_related_value (X) : X), \
- ((TEMP) && GET_CODE (TEMP) == SYMBOL_REF && SYMBOL_REF_FLAG (TEMP)))
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On the m88000, a legitimate address has the form REG, REG+REG,
- REG+SMALLINT, REG+(REG*modesize) (REG[REG]), or SMALLINT.
-
- The register elimination process should deal with the argument
- pointer and frame pointer changing to REG+SMALLINT. */
-
-#define LEGITIMATE_INDEX_P(X, MODE) \
- ((GET_CODE (X) == CONST_INT \
- && SMALL_INT (X)) \
- || (REG_P (X) \
- && REG_OK_FOR_INDEX_P (X)) \
- || (GET_CODE (X) == MULT \
- && REG_P (XEXP (X, 0)) \
- && REG_OK_FOR_INDEX_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && INTVAL (XEXP (X, 1)) == GET_MODE_SIZE (MODE)))
-
-#define RTX_OK_FOR_BASE_P(X) \
- ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
-
-#define RTX_OK_FOR_INDEX_P(X) \
- ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ \
- register rtx _x; \
- if (REG_P (X)) \
- { \
- if (REG_OK_FOR_BASE_P (X)) \
- goto ADDR; \
- } \
- else if (GET_CODE (X) == PLUS) \
- { \
- register rtx _x0 = XEXP (X, 0); \
- register rtx _x1 = XEXP (X, 1); \
- if ((flag_pic \
- && _x0 == pic_offset_table_rtx \
- && (flag_pic == 2 \
- ? RTX_OK_FOR_BASE_P (_x1) \
- : (GET_CODE (_x1) == SYMBOL_REF \
- || GET_CODE (_x1) == LABEL_REF))) \
- || (REG_P (_x0) \
- && (REG_OK_FOR_BASE_P (_x0) \
- && LEGITIMATE_INDEX_P (_x1, MODE))) \
- || (REG_P (_x1) \
- && (REG_OK_FOR_BASE_P (_x1) \
- && LEGITIMATE_INDEX_P (_x0, MODE)))) \
- goto ADDR; \
- } \
- else if (GET_CODE (X) == LO_SUM) \
- { \
- register rtx _x0 = XEXP (X, 0); \
- register rtx _x1 = XEXP (X, 1); \
- if (((REG_P (_x0) \
- && REG_OK_FOR_BASE_P (_x0)) \
- || (GET_CODE (_x0) == SUBREG \
- && REG_P (SUBREG_REG (_x0)) \
- && REG_OK_FOR_BASE_P (SUBREG_REG (_x0)))) \
- && CONSTANT_P (_x1)) \
- goto ADDR; \
- } \
- else if (GET_CODE (X) == CONST_INT \
- && SMALL_INT (X)) \
- goto ADDR; \
- else if (SHORT_ADDRESS_P (X, _x)) \
- goto ADDR; \
-}
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. Not the argument pointer. */
-#define REG_OK_FOR_INDEX_P(X) \
- (!XRF_REGNO_P(REGNO (X)))
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) (REG_OK_FOR_INDEX_P (X))
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-/* On the m88000, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ \
- if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
- copy_to_mode_reg (SImode, XEXP (X, 1))); \
- if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
- copy_to_mode_reg (SImode, XEXP (X, 0))); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
- force_operand (XEXP (X, 0), 0)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
- force_operand (XEXP (X, 1), 0)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \
- (X) = gen_rtx (PLUS, Pmode, force_operand (XEXP (X, 0), NULL_RTX),\
- XEXP (X, 1)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \
- (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
- force_operand (XEXP (X, 1), NULL_RTX)); \
- if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
- || GET_CODE (X) == LABEL_REF) \
- (X) = legitimize_address (flag_pic, X, 0, 0); \
- if (memory_address_p (MODE, X)) \
- goto WIN; }
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the the m88000 this is never true. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-#define LEGITIMATE_CONSTANT_P(X) (1)
-
-/* Define this, so that when PIC, reload won't try to reload invalid
- addresses which require two reload registers. */
-
-#define LEGITIMATE_PIC_OPERAND_P(X) (! pic_address_needs_scratch (X))
-
-
-/*** Condition Code Information ***/
-
-/* C code for a data type which is used for declaring the `mdep'
- component of `cc_status'. It defaults to `int'. */
-/* #define CC_STATUS_MDEP int */
-
-/* A C expression to initialize the `mdep' field to "empty". */
-/* #define CC_STATUS_MDEP_INIT (cc_status.mdep = 0) */
-
-/* Macro to zap the normal portions of CC_STATUS, but leave the
- machine dependent parts (ie, literal synthesis) alone. */
-/* #define CC_STATUS_INIT_NO_MDEP \
- (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0) */
-
-/* When using a register to hold the condition codes, the cc_status
- mechanism cannot be used. */
-#define NOTICE_UPDATE_CC(EXP, INSN) (0)
-
-/*** Miscellaneous Parameters ***/
-
-/* Define the codes that are matched by predicates in m88k.c. */
-#define PREDICATE_CODES \
- {"move_operand", {SUBREG, REG, CONST_INT, LO_SUM, MEM}}, \
- {"call_address_operand", {SUBREG, REG, SYMBOL_REF, LABEL_REF, CONST}}, \
- {"arith_operand", {SUBREG, REG, CONST_INT}}, \
- {"arith5_operand", {SUBREG, REG, CONST_INT}}, \
- {"arith32_operand", {SUBREG, REG, CONST_INT}}, \
- {"arith64_operand", {SUBREG, REG, CONST_INT}}, \
- {"int5_operand", {CONST_INT}}, \
- {"int32_operand", {CONST_INT}}, \
- {"add_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_bbx_mask_operand", {SUBREG, REG, CONST_INT}}, \
- {"real_or_0_operand", {SUBREG, REG, CONST_DOUBLE}}, \
- {"reg_or_0_operand", {SUBREG, REG, CONST_INT}}, \
- {"relop", {EQ, NE, LT, LE, GE, GT, LTU, LEU, GEU, GTU}}, \
- {"even_relop", {EQ, LT, GT, LTU, GTU}}, \
- {"odd_relop", { NE, LE, GE, LEU, GEU}}, \
- {"partial_ccmode_register_operand", { SUBREG, REG}}, \
- {"relop_no_unsigned", {EQ, NE, LT, LE, GE, GT}}, \
- {"equality_op", {EQ, NE}}, \
- {"pc_or_label_ref", {PC, LABEL_REF}},
-
-/* The case table contains either words or branch instructions. This says
- which. We always claim that the vector is PC-relative. It is position
- independent when -fpic is used. */
-#define CASE_VECTOR_INSNS (TARGET_88100 || flag_pic)
-
-/* An alias for a machine mode name. This is the machine mode that
- elements of a jump-table should have. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this macro if jump-tables should contain relative addresses. */
-#define CASE_VECTOR_PC_RELATIVE
-
-/* Define this if control falls through a `case' insn when the index
- value is out of range. This means the specified default-label is
- actually ignored by the `case' insn proper. */
-/* #define CASE_DROPS_THROUGH */
-
-/* Define this to be the smallest number of different values for which it
- is best to use a jump-table instead of a tree of conditional branches.
- The default is 4 for machines with a casesi instruction and 5 otherwise.
- The best 88110 number is around 7, though the exact number isn't yet
- known. A third alternative for the 88110 is to use a binary tree of
- bb1 instructions on bits 2/1/0 if the range is dense. This may not
- win very much though. */
-#define CASE_VALUES_THRESHOLD (TARGET_88100 ? 4 : 7)
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* The 88open ABI says size_t is unsigned int. */
-#define SIZE_TYPE "unsigned int"
-
-/* Allow and ignore #sccs directives */
-#define SCCS_DIRECTIVE
-
-/* Handle #pragma pack and sometimes #pragma weak. */
-#define HANDLE_SYSV_PRAGMA
-
-/* Tell when to handle #pragma weak. This is only done for V.4. */
-#define SUPPORTS_WEAK TARGET_SVR4
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 8
-
-/* Define if normal loads of shorter-than-word items from memory clears
- the rest of the bigs in the register. */
-#define BYTE_LOADS_ZERO_EXTEND
-
-/* Zero if access to memory by bytes is faster. */
-#define SLOW_BYTE_ACCESS 1
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-#define NO_FUNCTION_CSE
-
-/* Define this macro if an argument declared as `char' or
- `short' in a prototype should actually be passed as an
- `int'. In addition to avoiding errors in certain cases of
- mismatch, it also makes for better code on certain machines. */
-#define PROMOTE_PROTOTYPES
-
-/* Define this macro if a float function always returns float
- (even in traditional mode). Redefined in luna.h. */
-#define TRADITIONAL_RETURN_FLOAT
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-#define STORE_FLAG_VALUE -1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a word address (for indexing purposes)
- so give the MEM rtx word mode. */
-#define FUNCTION_MODE SImode
-
-/* A barrier will be aligned so account for the possible expansion.
- A volatile load may be preceded by a serializing instruction.
- Account for profiling code output at NOTE_INSN_PROLOGUE_END.
- Account for block profiling code at basic block boundaries. */
-#define ADJUST_INSN_LENGTH(RTX, LENGTH) \
- if (GET_CODE (RTX) == BARRIER \
- || (TARGET_SERIALIZE_VOLATILE \
- && GET_CODE (RTX) == INSN \
- && GET_CODE (PATTERN (RTX)) == SET \
- && ((GET_CODE (SET_SRC (PATTERN (RTX))) == MEM \
- && MEM_VOLATILE_P (SET_SRC (PATTERN (RTX))))))) \
- LENGTH += 1; \
- else if (GET_CODE (RTX) == NOTE \
- && NOTE_LINE_NUMBER (RTX) == NOTE_INSN_PROLOGUE_END) \
- { \
- if (profile_block_flag) \
- LENGTH += FUNCTION_BLOCK_PROFILER_LENGTH; \
- if (profile_flag) \
- LENGTH += (FUNCTION_PROFILER_LENGTH + REG_PUSH_LENGTH \
- + REG_POP_LENGTH); \
- } \
- else if (profile_block_flag \
- && (GET_CODE (RTX) == CODE_LABEL \
- || GET_CODE (RTX) == JUMP_INSN \
- || (GET_CODE (RTX) == INSN \
- && GET_CODE (PATTERN (RTX)) == SEQUENCE \
- && GET_CODE (XVECEXP (PATTERN (RTX), 0, 0)) == JUMP_INSN)))\
- LENGTH += BLOCK_PROFILER_LENGTH;
-
-/* Track the state of the last volatile memory reference. Clear the
- state with CC_STATUS_INIT for now. */
-#define CC_STATUS_INIT m88k_volatile_code = '\0'
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch.
-
- We assume that any 16 bit integer can easily be recreated, so we
- indicate 0 cost, in an attempt to get GCC not to optimize things
- like comparison against a constant.
-
- The cost of CONST_DOUBLE is zero (if it can be placed in an insn, it
- is as good as a register; since it can't be placed in any insn, it
- won't do anything in cse, but it will cause expand_binop to pass the
- constant to the define_expands). */
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (SMALL_INT (RTX)) \
- return 0; \
- else if (SMALL_INTVAL (- INTVAL (RTX))) \
- return 2; \
- else if (classify_integer (SImode, INTVAL (RTX)) != m88k_oru_or) \
- return 4; \
- return 7; \
- case HIGH: \
- return 2; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- if (flag_pic) \
- return (flag_pic == 2) ? 11 : 8; \
- return 5; \
- case CONST_DOUBLE: \
- return 0;
-
-/* Provide the costs of an addressing mode that contains ADDR.
- If ADDR is not a valid address, its cost is irrelevant.
- REG+REG is made slightly more expensive because it might keep
- a register live for longer than we might like. */
-#define ADDRESS_COST(ADDR) \
- (GET_CODE (ADDR) == REG ? 1 : \
- GET_CODE (ADDR) == LO_SUM ? 1 : \
- GET_CODE (ADDR) == HIGH ? 2 : \
- GET_CODE (ADDR) == MULT ? 1 : \
- GET_CODE (ADDR) != PLUS ? 4 : \
- (REG_P (XEXP (ADDR, 0)) && REG_P (XEXP (ADDR, 1))) ? 2 : 1)
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. */
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MEM: \
- return COSTS_N_INSNS (2); \
- case MULT: \
- return COSTS_N_INSNS (3); \
- case DIV: \
- case UDIV: \
- case MOD: \
- case UMOD: \
- return COSTS_N_INSNS (38);
-
-/* A C expressions returning the cost of moving data of MODE from a register
- to or from memory. This is more costly than between registers. */
-#define MEMORY_MOVE_COST(MODE) 4
-
-/* Provide the cost of a branch. Exact meaning under development. */
-#define BRANCH_COST (TARGET_88100 ? 1 : 2)
-
-/* A C statement (sans semicolon) to update the integer variable COST
- based on the relationship between INSN that is dependent on
- DEP_INSN through the dependence LINK. The default is to make no
- adjustment to COST. On the m88k, ignore the cost of anti- and
- output-dependencies. On the m88100, a store can issue two cycles
- before the value (not the address) has finished computing. */
-#define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \
- do { \
- if (REG_NOTE_KIND (LINK) != 0) \
- (COST) = 0; /* Anti or output dependence. */ \
- else if (! TARGET_88100 \
- && recog_memoized (INSN) >= 0 \
- && get_attr_type (INSN) == TYPE_STORE \
- && SET_SRC (PATTERN (INSN)) == SET_DEST (PATTERN (DEP_INSN))) \
- (COST) -= 4; /* 88110 store reservation station. */ \
- } while (0)
-
-/* Do not break .stabs pseudos into continuations. */
-#define DBX_CONTIN_LENGTH 0
-
-/*** Output of Assembler Code ***/
-
-/* Control the assembler format that we output. */
-
-/* A C string constant describing how to begin a comment in the target
- assembler language. The compiler assumes that the comment will end at
- the end of the line. */
-#define ASM_COMMENT_START ";"
-
-/* Allow pseudo-ops to be overridden. Override these in svr[34].h. */
-#undef INT_ASM_OP
-#undef ASCII_DATA_ASM_OP
-#undef CONST_SECTION_ASM_OP
-#undef CTORS_SECTION_ASM_OP
-#undef DTORS_SECTION_ASM_OP
-#undef ASM_OUTPUT_SECTION_NAME
-#undef INIT_SECTION_ASM_OP
-#undef FINI_SECTION_ASM_OP
-#undef TYPE_ASM_OP
-#undef SIZE_ASM_OP
-#undef SET_ASM_OP
-#undef SKIP_ASM_OP
-#undef COMMON_ASM_OP
-#undef ALIGN_ASM_OP
-#undef IDENT_ASM_OP
-
-/* These are used in varasm.c as well. */
-#define TEXT_SECTION_ASM_OP "text"
-#define DATA_SECTION_ASM_OP "data"
-
-/* Other sections. */
-#define CONST_SECTION_ASM_OP (TARGET_SVR4 \
- ? "section\t .rodata,\"a\"" \
- : "section\t .rodata,\"x\"")
-#define TDESC_SECTION_ASM_OP (TARGET_SVR4 \
- ? "section\t .tdesc,\"a\"" \
- : "section\t .tdesc,\"x\"")
-
-/* These must be constant strings for crtstuff.c. */
-#define CTORS_SECTION_ASM_OP "section\t .ctors,\"d\""
-#define DTORS_SECTION_ASM_OP "section\t .dtors,\"d\""
-#define INIT_SECTION_ASM_OP "section\t .init,\"x\""
-#define FINI_SECTION_ASM_OP "section\t .fini,\"x\""
-
-/* These are pretty much common to all assemblers. */
-#define IDENT_ASM_OP "ident"
-#define FILE_ASM_OP "file"
-#define SECTION_ASM_OP "section"
-#define SET_ASM_OP "def"
-#define GLOBAL_ASM_OP "global"
-#define ALIGN_ASM_OP "align"
-#define SKIP_ASM_OP "zero"
-#define COMMON_ASM_OP "comm"
-#define BSS_ASM_OP "bss"
-#define FLOAT_ASM_OP "float"
-#define DOUBLE_ASM_OP "double"
-#define INT_ASM_OP "word"
-#define ASM_LONG INT_ASM_OP
-#define SHORT_ASM_OP "half"
-#define CHAR_ASM_OP "byte"
-#define ASCII_DATA_ASM_OP "string"
-
-/* These are particular to the global pool optimization. */
-#define SBSS_ASM_OP "sbss"
-#define SCOMM_ASM_OP "scomm"
-#define SDATA_SECTION_ASM_OP "sdata"
-
-/* These are specific to PIC. */
-#define TYPE_ASM_OP "type"
-#define SIZE_ASM_OP "size"
-#ifndef AS_BUG_POUND_TYPE /* Faulty assemblers require @ rather than #. */
-#undef TYPE_OPERAND_FMT
-#define TYPE_OPERAND_FMT "#%s"
-#endif
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#undef ASM_WEAKEN_LABEL
-#define ASM_WEAKEN_LABEL(FILE,NAME) \
- do { fputs ("\tweak\t", FILE); assemble_name (FILE, NAME); \
- fputc ('\n', FILE); } while (0)
-
-/* These are specific to version 03.00 assembler syntax. */
-#define INTERNAL_ASM_OP "local"
-#define VERSION_ASM_OP "version"
-#define UNALIGNED_SHORT_ASM_OP "uahalf"
-#define UNALIGNED_INT_ASM_OP "uaword"
-#define PUSHSECTION_ASM_OP "section"
-#define POPSECTION_ASM_OP "previous"
-
-/* These are specific to the version 04.00 assembler syntax. */
-#define REQUIRES_88110_ASM_OP "requires_88110"
-
-/* Output any initial stuff to the assembly file. Always put out
- a file directive, even if not debugging.
-
- Immediately after putting out the file, put out a "sem.<value>"
- declaration. This should be harmless on other systems, and
- is used in DG/UX by the debuggers to supplement COFF. The
- fields in the integer value are as follows:
-
- Bits Value Meaning
- ---- ----- -------
- 0-1 0 No information about stack locations
- 1 Auto/param locations are based on r30
- 2 Auto/param locations are based on CFA
-
- 3-2 0 No information on dimension order
- 1 Array dims in sym table matches source language
- 2 Array dims in sym table is in reverse order
-
- 5-4 0 No information about the case of global names
- 1 Global names appear in the symbol table as in the source
- 2 Global names have been converted to lower case
- 3 Global names have been converted to upper case. */
-
-#ifdef SDB_DEBUGGING_INFO
-#define ASM_COFFSEM(FILE) \
- if (write_symbols == SDB_DEBUG) \
- { \
- fprintf (FILE, "\nsem.%x:\t\t; %s\n", \
- (((TARGET_OCS_FRAME_POSITION) ? 2 : 1) << 0) + (1 << 2) + (1 << 4),\
- (TARGET_OCS_FRAME_POSITION) \
- ? "frame is CFA, normal array dims, case unchanged" \
- : "frame is r30, normal array dims, case unchanged"); \
- }
-#else
-#define ASM_COFFSEM(FILE)
-#endif
-
-/* Output the first line of the assembly file. Redefined in dgux.h. */
-
-#define ASM_FIRST_LINE(FILE) \
- do { \
- if (TARGET_SVR4) \
- { \
- if (TARGET_88110) \
- fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "04.00"); \
- else \
- fprintf (FILE, "\t%s\t \"%s\"\n", VERSION_ASM_OP, "03.00"); \
- } \
- } while (0)
-
-/* Override svr[34].h. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- output_file_start (FILE, f_options, sizeof f_options / sizeof f_options[0], \
- W_options, sizeof W_options / sizeof W_options[0])
-
-#undef ASM_FILE_END
-
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) \
- fprintf (FILE, "\t%s\t \"%s\"\n", FILE_ASM_OP, NAME)
-
-#ifdef SDB_DEBUGGING_INFO
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
- if (m88k_prologue_done) \
- fprintf (FILE, "\n\tln\t %d\t\t\t\t; Real source line %d\n",\
- LINE - sdb_begin_function_line, LINE)
-#endif
-
-/* Code to handle #ident directives. Override svr[34].h definition. */
-#undef ASM_OUTPUT_IDENT
-#ifdef DBX_DEBUGGING_INFO
-#define ASM_OUTPUT_IDENT(FILE, NAME)
-#else
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- output_ascii (FILE, IDENT_ASM_OP, 4000, NAME, strlen (NAME));
-#endif
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-#define ASM_APP_OFF ""
-
-/* Format the assembly opcode so that the arguments are all aligned.
- The maximum instruction size is 8 characters (fxxx.xxx), so a tab and a
- space will do to align the output. Abandon the output if a `%' is
- encountered. */
-#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
- { \
- int ch; \
- char *orig_ptr; \
- \
- for (orig_ptr = (PTR); \
- (ch = *(PTR)) && ch != ' ' && ch != '\t' && ch != '\n' && ch != '%'; \
- (PTR)++) \
- putc (ch, STREAM); \
- \
- if (ch == ' ' && orig_ptr != (PTR) && (PTR) - orig_ptr < 8) \
- putc ('\t', STREAM); \
- }
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number.
- Updated by OVERRIDE_OPTIONS to include the # for version 03.00 syntax. */
-
-#define REGISTER_NAMES \
- {"#r0"+1, "#r1"+1, "#r2"+1, "#r3"+1, "#r4"+1, "#r5"+1, "#r6"+1, "#r7"+1, \
- "#r8"+1, "#r9"+1, "#r10"+1,"#r11"+1,"#r12"+1,"#r13"+1,"#r14"+1,"#r15"+1,\
- "#r16"+1,"#r17"+1,"#r18"+1,"#r19"+1,"#r20"+1,"#r21"+1,"#r22"+1,"#r23"+1,\
- "#r24"+1,"#r25"+1,"#r26"+1,"#r27"+1,"#r28"+1,"#r29"+1,"#r30"+1,"#r31"+1,\
- "#x0"+1, "#x1"+1, "#x2"+1, "#x3"+1, "#x4"+1, "#x5"+1, "#x6"+1, "#x7"+1, \
- "#x8"+1, "#x9"+1, "#x10"+1,"#x11"+1,"#x12"+1,"#x13"+1,"#x14"+1,"#x15"+1,\
- "#x16"+1,"#x17"+1,"#x18"+1,"#x19"+1,"#x20"+1,"#x21"+1,"#x22"+1,"#x23"+1,\
- "#x24"+1,"#x25"+1,"#x26"+1,"#x27"+1,"#x28"+1,"#x29"+1,"#x30"+1,"#x31"+1}
-
-/* Define additional names for use in asm clobbers and asm declarations.
-
- We define the fake Condition Code register as an alias for reg 0 (which
- is our `condition code' register), so that condition codes can easily
- be clobbered by an asm. The carry bit in the PSR is now used. */
-
-#define ADDITIONAL_REGISTER_NAMES {"psr", 0, "cc", 0}
-
-/* How to renumber registers for dbx and gdb. */
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Tell when to declare ASM names. Override svr4.h to provide this hook. */
-#undef DECLARE_ASM_NAME
-#define DECLARE_ASM_NAME TARGET_SVR4
-
-/* Write the extra assembler code needed to declare a function properly. */
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { \
- if (DECLARE_ASM_NAME) \
- { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Write the extra assembler code needed to declare an object properly. */
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do { \
- if (DECLARE_ASM_NAME) \
- { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', FILE); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#undef ASM_FINISH_DECLARE_OBJECT
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && DECLARE_ASM_NAME \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } while (0)
-
-/* This is how to declare the size of a function. */
-#undef ASM_DECLARE_FUNCTION_SIZE
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
- do { \
- if (DECLARE_ASM_NAME) \
- { \
- if (!flag_inhibit_size_directive) \
- { \
- char label[256]; \
- static int labelno = 0; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ",%s-", &label[1]); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } \
- } while (0)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { \
- fprintf (FILE, "\t%s\t ", GLOBAL_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc ('\n', FILE); \
- } while (0)
-
-/* The prefix to add to user-visible assembler symbols.
- Override svr[34].h. */
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output a reference to a user-level label named NAME.
- Override svr[34].h. */
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- { \
- if (!TARGET_NO_UNDERSCORES && !TARGET_SVR4) \
- fputc ('_', FILE); \
- fputs (NAME, FILE); \
- }
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- For V.4, labels use `.' rather than `@'. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#ifdef AS_BUG_DOT_LABELS /* The assembler requires a declaration of local. */
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, TARGET_SVR4 ? ".%s%d:\n\t%s\t .%s%d\n" : "@%s%d:\n", \
- PREFIX, NUM, INTERNAL_ASM_OP, PREFIX, NUM)
-#else
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, TARGET_SVR4 ? ".%s%d:\n" : "@%s%d:\n", PREFIX, NUM)
-#endif /* AS_BUG_DOT_LABELS */
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. This must agree
- with ASM_OUTPUT_INTERNAL_LABEL above, except for being prefixed
- with an `*'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, TARGET_SVR4 ? "*.%s%d" : "*@%s%d", PREFIX, NUM)
-
-/* Internal macro to get a single precision floating point value into
- an int, so we can print it's value in hex. */
-#define FLOAT_TO_INT_INTERNAL( FVALUE, IVALUE ) \
- { union { \
- REAL_VALUE_TYPE d; \
- struct { \
- unsigned sign : 1; \
- unsigned exponent1 : 1; \
- unsigned exponent2 : 3; \
- unsigned exponent3 : 7; \
- unsigned mantissa1 : 20; \
- unsigned mantissa2 : 3; \
- unsigned mantissa3 : 29; \
- } s; \
- } _u; \
- \
- union { \
- int i; \
- struct { \
- unsigned sign : 1; \
- unsigned exponent1 : 1; \
- unsigned exponent3 : 7; \
- unsigned mantissa1 : 20; \
- unsigned mantissa2 : 3; \
- } s; \
- } _u2; \
- \
- _u.d = REAL_VALUE_TRUNCATE (SFmode, FVALUE); \
- _u2.s.sign = _u.s.sign; \
- _u2.s.exponent1 = _u.s.exponent1; \
- _u2.s.exponent3 = _u.s.exponent3; \
- _u2.s.mantissa1 = _u.s.mantissa1; \
- _u2.s.mantissa2 = _u.s.mantissa2; \
- IVALUE = _u2.i; \
- }
-
-/* This is how to output an assembler line defining a `double' constant.
- Use "word" pseudos to avoid printing NaNs, infinity, etc. */
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { \
- union { REAL_VALUE_TYPE d; long l[2]; } x; \
- x.d = (VALUE); \
- fprintf (FILE, "\t%s\t 0x%.8x, 0x%.8x\n", INT_ASM_OP, \
- x.l[0], x.l[1]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { \
- int i; \
- FLOAT_TO_INT_INTERNAL (VALUE, i); \
- fprintf (FILE, "\t%s\t 0x%.8x\n", INT_ASM_OP, i); \
- } while (0)
-
-/* Likewise for `int', `short', and `char' constants. */
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t%s\t ", INT_ASM_OP), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t%s\t ", SHORT_ASM_OP), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t%s\t ", CHAR_ASM_OP), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t%s\t 0x%x\n", CHAR_ASM_OP, (VALUE))
-
-/* The single-byte pseudo-op is the default. Override svr[34].h. */
-#undef ASM_BYTE_OP
-#define ASM_BYTE_OP "byte"
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE, P, SIZE) \
- output_ascii (FILE, ASCII_DATA_ASM_OP, 48, P, SIZE)
-
-/* Override svr4.h. Change to the readonly data section for a table of
- addresses. final_scan_insn changes back to the text section. */
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
- do { \
- if (! CASE_VECTOR_INSNS) \
- { \
- readonly_data_section (); \
- ASM_OUTPUT_ALIGN (FILE, 2); \
- } \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \
- } while (0)
-
-/* Epilogue for case labels. This jump instruction is called by casesi
- to transfer to the appropriate branch instruction within the table.
- The label `@L<n>e' is coined to mark the end of the table. */
-#define ASM_OUTPUT_CASE_END(FILE, NUM, TABLE) \
- do { \
- if (CASE_VECTOR_INSNS) \
- { \
- char label[256]; \
- ASM_GENERATE_INTERNAL_LABEL (label, "L", NUM); \
- fprintf (FILE, "%se:\n", &label[1]); \
- if (! flag_delayed_branch) \
- fprintf (FILE, "\tlda\t %s,%s[%s]\n", reg_names[1], \
- reg_names[1], reg_names[m88k_case_index]); \
- fprintf (FILE, "\tjmp\t %s\n", reg_names[1]); \
- } \
- } while (0)
-
-/* This is how to output an element of a case-vector that is absolute. */
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- do { \
- char buffer[256]; \
- ASM_GENERATE_INTERNAL_LABEL (buffer, "L", VALUE); \
- fprintf (FILE, CASE_VECTOR_INSNS ? "\tbr\t %s\n" : "\tword\t %s\n", \
- &buffer[1]); \
- } while (0)
-
-/* This is how to output an element of a case-vector that is relative. */
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- ASM_OUTPUT_ADDR_VEC_ELT (FILE, VALUE)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t%s\t %d\n", ALIGN_ASM_OP, 1<<(LOG))
-
-/* On the m88100, align the text address to half a cache boundary when it
- can only be reached by jumping. Pack code tightly when compiling
- crtstuff.c. */
-#define ASM_OUTPUT_ALIGN_CODE(FILE) \
- ASM_OUTPUT_ALIGN (FILE, \
- (TARGET_88100 && !flag_inhibit_size_directive ? 3 : 2))
-
-/* Override svr[34].h. */
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t%s\t %u\n", SKIP_ASM_OP, (SIZE))
-
-/* Override svr4.h. */
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-
-/* This says how to output an assembler line to define a global common
- symbol. Size can be zero for the unusual case of a `struct { int : 0; }'.
- Override svr[34].h. */
-#undef ASM_OUTPUT_COMMON
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fprintf ((FILE), "\t%s\t ", \
- ((SIZE) ? (SIZE) : 1) <= m88k_gp_threshold ? SCOMM_ASM_OP : COMMON_ASM_OP), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE) ? (SIZE) : 1))
-
-/* This says how to output an assembler line to define a local common
- symbol. Override svr[34].h. */
-#undef ASM_OUTPUT_LOCAL
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fprintf ((FILE), "\t%s\t ", \
- ((SIZE) ? (SIZE) : 1) <= m88k_gp_threshold ? SBSS_ASM_OP : BSS_ASM_OP), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u,%d\n", (SIZE) ? (SIZE) : 1, (SIZE) <= 4 ? 4 : 8))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tsubu\t %s,%s,%d\n\tst\t %s,%s,0\n", \
- reg_names[STACK_POINTER_REGNUM], \
- reg_names[STACK_POINTER_REGNUM], \
- (STACK_BOUNDARY / BITS_PER_UNIT), \
- reg_names[REGNO], \
- reg_names[STACK_POINTER_REGNUM])
-
-/* Length in instructions of the code output by ASM_OUTPUT_REG_PUSH. */
-#define REG_PUSH_LENGTH 2
-
-/* This is how to output an insn to pop a register from the stack. */
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tld\t %s,%s,0\n\taddu\t %s,%s,%d\n", \
- reg_names[REGNO], \
- reg_names[STACK_POINTER_REGNUM], \
- reg_names[STACK_POINTER_REGNUM], \
- reg_names[STACK_POINTER_REGNUM], \
- (STACK_BOUNDARY / BITS_PER_UNIT))
-
-/* Length in instructions of the code output by ASM_OUTPUT_REG_POP. */
-#define REG_POP_LENGTH 2
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Macros to deal with OCS debug information */
-
-#define OCS_START_PREFIX "Ltb"
-#define OCS_END_PREFIX "Lte"
-
-#define PUT_OCS_FUNCTION_START(FILE) \
- { ASM_OUTPUT_INTERNAL_LABEL (FILE, OCS_START_PREFIX, m88k_function_number); }
-
-#define PUT_OCS_FUNCTION_END(FILE) \
- { ASM_OUTPUT_INTERNAL_LABEL (FILE, OCS_END_PREFIX, m88k_function_number); }
-
-/* Macros for debug information */
-#define DEBUGGER_AUTO_OFFSET(X) \
- (m88k_debugger_offset (X, 0) \
- + (TARGET_OCS_FRAME_POSITION ? 0 : m88k_stack_size - m88k_fp_offset))
-
-#define DEBUGGER_ARG_OFFSET(OFFSET, X) \
- (m88k_debugger_offset (X, OFFSET) \
- + (TARGET_OCS_FRAME_POSITION ? 0 : m88k_stack_size - m88k_fp_offset))
-
-/* Macros to deal with SDB debug information */
-#ifdef SDB_DEBUGGING_INFO
-
-/* Output structure tag names even when it causes a forward reference. */
-#define SDB_ALLOW_FORWARD_REFERENCES
-
-/* Print out extra debug information in the assembler file */
-#define PUT_SDB_SCL(a) \
- do { \
- register int s = (a); \
- register char *scl; \
- switch (s) \
- { \
- case C_EFCN: scl = "end of function"; break; \
- case C_NULL: scl = "NULL storage class"; break; \
- case C_AUTO: scl = "automatic"; break; \
- case C_EXT: scl = "external"; break; \
- case C_STAT: scl = "static"; break; \
- case C_REG: scl = "register"; break; \
- case C_EXTDEF: scl = "external definition"; break; \
- case C_LABEL: scl = "label"; break; \
- case C_ULABEL: scl = "undefined label"; break; \
- case C_MOS: scl = "structure member"; break; \
- case C_ARG: scl = "argument"; break; \
- case C_STRTAG: scl = "structure tag"; break; \
- case C_MOU: scl = "union member"; break; \
- case C_UNTAG: scl = "union tag"; break; \
- case C_TPDEF: scl = "typedef"; break; \
- case C_USTATIC: scl = "uninitialized static"; break; \
- case C_ENTAG: scl = "enumeration tag"; break; \
- case C_MOE: scl = "member of enumeration"; break; \
- case C_REGPARM: scl = "register parameter"; break; \
- case C_FIELD: scl = "bit field"; break; \
- case C_BLOCK: scl = "block start/end"; break; \
- case C_FCN: scl = "function start/end"; break; \
- case C_EOS: scl = "end of structure"; break; \
- case C_FILE: scl = "filename"; break; \
- case C_LINE: scl = "line"; break; \
- case C_ALIAS: scl = "duplicated tag"; break; \
- case C_HIDDEN: scl = "hidden"; break; \
- default: scl = "unknown"; break; \
- } \
- \
- fprintf(asm_out_file, "\tscl\t %d\t\t\t\t; %s\n", s, scl); \
- } while (0)
-
-#define PUT_SDB_TYPE(a) \
- do { \
- register int t = (a); \
- static char buffer[100]; \
- register char *p = buffer, *q; \
- register int typ = t; \
- register int i,d; \
- \
- for (i = 0; i <= 5; i++) \
- { \
- switch ((typ >> ((i*N_TSHIFT) + N_BTSHFT)) & 03) \
- { \
- case DT_PTR: \
- strcpy (p, "ptr to "); \
- p += sizeof("ptr to"); \
- break; \
- \
- case DT_ARY: \
- strcpy (p, "array of "); \
- p += sizeof("array of"); \
- break; \
- \
- case DT_FCN: \
- strcpy (p, "func ret "); \
- p += sizeof("func ret"); \
- break; \
- } \
- } \
- \
- switch (typ & N_BTMASK) \
- { \
- case T_NULL: q = "<no type>"; break; \
- case T_CHAR: q = "char"; break; \
- case T_SHORT: q = "short"; break; \
- case T_INT: q = "int"; break; \
- case T_LONG: q = "long"; break; \
- case T_FLOAT: q = "float"; break; \
- case T_DOUBLE: q = "double"; break; \
- case T_STRUCT: q = "struct"; break; \
- case T_UNION: q = "union"; break; \
- case T_ENUM: q = "enum"; break; \
- case T_MOE: q = "enum member"; break; \
- case T_UCHAR: q = "unsigned char"; break; \
- case T_USHORT: q = "unsigned short"; break; \
- case T_UINT: q = "unsigned int"; break; \
- case T_ULONG: q = "unsigned long"; break; \
- default: q = "void"; break; \
- } \
- \
- strcpy (p, q); \
- fprintf(asm_out_file, "\ttype\t %d\t\t\t\t; %s\n", \
- t, buffer); \
- } while (0)
-
-#define PUT_SDB_INT_VAL(a) \
- fprintf (asm_out_file, "\tval\t %d\n", (a))
-
-#define PUT_SDB_VAL(a) \
-( fprintf (asm_out_file, "\tval\t "), \
- output_addr_const (asm_out_file, (a)), \
- fputc ('\n', asm_out_file))
-
-#define PUT_SDB_DEF(a) \
- do { fprintf (asm_out_file, "\tsdef\t "); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fputc ('\n', asm_out_file); \
- } while (0)
-
-#define PUT_SDB_PLAIN_DEF(a) \
- fprintf(asm_out_file,"\tsdef\t .%s\n", a)
-
-/* Simply and endef now. */
-#define PUT_SDB_ENDEF \
- fputs("\tendef\n\n", asm_out_file)
-
-#define PUT_SDB_SIZE(a) \
- fprintf (asm_out_file, "\tsize\t %d\n", (a))
-
-/* Max dimensions to store for debug information (limited by COFF). */
-#define SDB_MAX_DIM 6
-
-/* New method for dim operations. */
-#define PUT_SDB_START_DIM \
- fputs("\tdim\t ", asm_out_file)
-
-/* How to end the DIM sequence. */
-#define PUT_SDB_LAST_DIM(a) \
- fprintf(asm_out_file, "%d\n", a)
-
-#define PUT_SDB_TAG(a) \
- do { \
- fprintf (asm_out_file, "\ttag\t "); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fputc ('\n', asm_out_file); \
- } while( 0 )
-
-#define PUT_SDB_BLOCK_OR_FUNCTION(NAME, SCL, LINE) \
- do { \
- fprintf (asm_out_file, "\n\tsdef\t %s\n\tval\t .\n", \
- NAME); \
- PUT_SDB_SCL( SCL ); \
- fprintf (asm_out_file, "\tline\t %d\n\tendef\n\n", \
- (LINE)); \
- } while (0)
-
-#define PUT_SDB_BLOCK_START(LINE) \
- PUT_SDB_BLOCK_OR_FUNCTION (".bb", C_BLOCK, (LINE))
-
-#define PUT_SDB_BLOCK_END(LINE) \
- PUT_SDB_BLOCK_OR_FUNCTION (".eb", C_BLOCK, (LINE))
-
-#define PUT_SDB_FUNCTION_START(LINE) \
- do { \
- fprintf (asm_out_file, "\tln\t 1\n"); \
- PUT_SDB_BLOCK_OR_FUNCTION (".bf", C_FCN, (LINE)); \
- } while (0)
-
-#define PUT_SDB_FUNCTION_END(LINE) \
- do { \
- PUT_SDB_BLOCK_OR_FUNCTION (".ef", C_FCN, (LINE)); \
- } while (0)
-
-#define PUT_SDB_EPILOGUE_END(NAME) \
- do { \
- text_section (); \
- fprintf (asm_out_file, "\n\tsdef\t "); \
- ASM_OUTPUT_LABELREF(asm_out_file, (NAME)); \
- fputc('\n', asm_out_file); \
- PUT_SDB_SCL( C_EFCN ); \
- fprintf (asm_out_file, "\tendef\n\n"); \
- } while (0)
-
-#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
- sprintf ((BUFFER), ".%dfake", (NUMBER));
-
-#endif /* SDB_DEBUGGING_INFO */
-
-/* Support const and tdesc sections. Generally, a const section will
- be distinct from the text section whenever we do V.4-like things
- and so follows DECLARE_ASM_NAME. Note that strings go in text
- rather than const. Override svr[34].h. */
-
-#undef USE_CONST_SECTION
-#undef EXTRA_SECTIONS
-
-#define USE_CONST_SECTION DECLARE_ASM_NAME
-
-#if defined(USING_SVR4_H)
-
-#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata, in_ctors, in_dtors
-#define INIT_SECTION_FUNCTION
-#define FINI_SECTION_FUNCTION
-
-#else
-#if defined(USING_SVR3_H)
-
-#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata, in_ctors, in_dtors, \
- in_init, in_fini
-
-#else /* luna or other not based on svr[34].h. */
-
-#undef INIT_SECTION_ASM_OP
-#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata
-#define CONST_SECTION_FUNCTION \
-void \
-const_section () \
-{ \
- text_section(); \
-}
-#define CTORS_SECTION_FUNCTION
-#define DTORS_SECTION_FUNCTION
-#define INIT_SECTION_FUNCTION
-#define FINI_SECTION_FUNCTION
-
-#endif /* USING_SVR3_H */
-#endif /* USING_SVR4_H */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- \
-void \
-tdesc_section () \
-{ \
- if (in_section != in_tdesc) \
- { \
- fprintf (asm_out_file, "%s\n", TDESC_SECTION_ASM_OP); \
- in_section = in_tdesc; \
- } \
-} \
- \
-void \
-sdata_section () \
-{ \
- if (in_section != in_sdata) \
- { \
- fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
- in_section = in_sdata; \
- } \
-} \
- \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
- INIT_SECTION_FUNCTION \
- FINI_SECTION_FUNCTION
-
-/* A C statement or statements to switch to the appropriate
- section for output of DECL. DECL is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether forming
- the initial value of DECL requires link-time relocations.
-
- For strings, the section is selected before the segment info is encoded. */
-#undef SELECT_SECTION
-#define SELECT_SECTION(DECL,RELOC) \
-{ \
- if (TREE_CODE (DECL) == STRING_CST) \
- { \
- if (! flag_writable_strings) \
- const_section (); \
- else if ( TREE_STRING_LENGTH (DECL) <= m88k_gp_threshold) \
- sdata_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
- if (SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0))) \
- sdata_section (); \
- else if ((flag_pic && RELOC) \
- || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
- || !DECL_INITIAL (DECL) \
- || (DECL_INITIAL (DECL) != error_mark_node \
- && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
- data_section (); \
- else \
- const_section (); \
- } \
- else \
- const_section (); \
-}
-
-/* Jump tables consist of branch instructions and should be output in
- the text section. When we use a table of addresses, we explicitly
- change to the readonly data section. */
-#define JUMP_TABLES_IN_TEXT_SECTION 1
-
-/* Define this macro if references to a symbol must be treated differently
- depending on something about the variable or function named by the
- symbol (such as what section it is in).
-
- The macro definition, if any, is executed immediately after the rtl for
- DECL has been created and stored in `DECL_RTL (DECL)'. The value of the
- rtl will be a `mem' whose address is a `symbol_ref'.
-
- For the m88k, determine if the item should go in the global pool. */
-#define ENCODE_SECTION_INFO(DECL) \
- do { \
- if (m88k_gp_threshold > 0) \
- if (TREE_CODE (DECL) == VAR_DECL) \
- { \
- if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)) \
- { \
- int size = int_size_in_bytes (TREE_TYPE (DECL)); \
- \
- if (size > 0 && size <= m88k_gp_threshold) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
- } \
- } \
- else if (TREE_CODE (DECL) == STRING_CST \
- && flag_writable_strings \
- && TREE_STRING_LENGTH (DECL) <= m88k_gp_threshold) \
- SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1; \
- } while (0)
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-#define PRINT_OPERAND_PUNCT_VALID_P(c) \
- ((c) == '#' || (c) == '.' || (c) == '!' || (c) == '*' || (c) == ';')
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-/* Print a memory address as an operand to reference that memory location. */
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
-/* This says not to strength reduce the addr calculations within loops
- (otherwise it does not take advantage of m88k scaled loads and stores */
-
-#define DONT_REDUCE_ADDR
diff --git a/gcc/config/m88k/m88k.md b/gcc/config/m88k/m88k.md
deleted file mode 100644
index bf5124b2244..00000000000
--- a/gcc/config/m88k/m88k.md
+++ /dev/null
@@ -1,4040 +0,0 @@
-;;- Machine description for the Motorola 88000 for GNU C compiler
-;;; Copyright (C) 1988, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
-;; Contributed by Michael Tiemann (tiemann@mcc.com)
-;; Currently maintained by (gcc@dg-rtp.dg.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.
-
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; RCS rev field. This is a NOP, just to get the RCS id into the
-;; program image.
-(define_expand "m88k_rcs_id"
- [(match_operand:SI 0 "" "")]
- ""
- "{ static char rcs_id[] = \"$What: <@(#) m88k.md,v 1.1.1.2.2.2> $\";
- FAIL; }")
-
-;; Attribute describing the processor. This attribute must match exactly
-;; with the processor_type enumeration in m88k.h.
-
-; Target CPU.
-(define_attr "cpu" "m88100,m88110,m88000"
- (const (symbol_ref "m88k_cpu")))
-
-; Type of each instruction. Default is arithmetic.
-; I'd like to write the list as this, but genattrtab won't accept it.
-;
-; "branch,jump,call, ; flow-control instructions
-; load,store,loadd,loada, ; data unit instructions
-; spadd,dpadd,spcmp,dpcmp,spdiv,dpdiv,idiv, ; FPU add instructions
-; spmul,dpmul,imul, ; FPU multiply instructions
-; arith,bit,mov ; integer unit instructions
-; marith,weird" ; multi-word instructions
-
-; Classification of each insn. Some insns of TYPE_BRANCH are multi-word.
-(define_attr "type"
- "branch,jump,call,load,store,loadd,loada,spadd,dpadd,spcmp,dpcmp,spdiv,dpdiv,idiv,spmul,dpmul,imul,arith,bit,mov,marith,weird"
- (const_string "arith"))
-
-(define_attr "fpu" "yes,no"
- (if_then_else
- (eq_attr "type" "spmul,dpmul,imul,spadd,dpadd,spcmp,dpcmp,spdiv,dpdiv,idiv")
- (const_string "yes") (const_string "no")))
-
-; Length in # of instructions of each insn. The values are not exact, but
-; are safe.
-(define_attr "length" ""
- (cond [(eq_attr "type" "marith,weird,branch")
- (const_int 2)]
- (const_int 1)))
-
-; Describe a user's asm statement.
-(define_asm_attributes
- [(set_attr "type" "weird")])
-
-; Define the delay slot requirements for branches and calls.
-; The m88100 annuls instructions if a conditional branch is taken.
-; For insns of TYPE_BRANCH that are multi-word instructions, the
-; delay slot applies to the first instruction.
-
-; @@ For the moment, reorg.c requires that the delay slot of a branch not
-; be a call or branch.
-
-(define_delay (eq_attr "type" "branch,jump")
- [(and
- (and
- (eq_attr "type" "!branch,jump,call,marith,weird") ; required.
- (eq_attr "type" "!load,loadd")) ; issue as-soon-as-possible.
- (eq_attr "fpu" "no")) ; issue as-soon-as-possible.
- (eq_attr "type" "!call,branch,jump") (nil)]) ; @@ was (const_int 1)
-
-; output_call supports an unconditional branch in the delay slot of
-; a call. (@@ Support for this case is expected in reorg.c soon.)
-
-(define_delay (eq_attr "type" "call")
- [(eq_attr "type" "!branch,call,marith,weird") ; required.
- (nil) (nil)])
-
-; An abstract block diagram of the function units for the m88100.
-;
-; *
-; |
-; +---v----+
-; | decode |
-; +-vv-v-v-+ fpu
-; ,----------'| | `----------------------.
-; | | | | ,-----.
-; load | store | | arith | | |
-; | | | +-v-v-+ | dp source
-; | | | | fp1 |---'
-; store | | | div +-v-v-+
-; ,------. | | | ,-----. ,-----------' `-----------.
-; | | | | | | | | |
-; | +--v---v--+ ,---' | | +-v-v---+ +---v---+
-; | | stage 2 | | | `---| add 2 | | mul 2 |
-; | +---------+ | +--v--+ +-------+ imul +-------+
-; | | stage 1 | | | alu | | add 3 | ,--------| mul 3 |
-; | +---------+ | +--v--+ +-------+ | +-------+
-; | | stage 0 | | | | add 4 | | | mul 4 |
-; | +--v---v--+ | | +---v---+ | +-------+
-; | | | | | | | | mul 5 |
-; | * | | | | | +---v---+
-; | | | | | +----v----+ |
-; | load | | | fp add `------>| fp last |<------' fp mul
-; | | | | +---v-v--^+
-; | | | | | | |
-; | | | | | `--' dp dest
-; | | +--v-----v--+ |
-; | `--->| writeback |<--------------------'
-; | +--v-----v--+
-; | | |
-; `------------------' *
-;
-; The decode unit need not be specified.
-; Consideration of writeback contention is critical to superb scheduling.
-;
-; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
-; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
-
-; Describing the '100 alu is currently not useful.
-;(define_function_unit "alu" 1 0 (eq_attr "type"
-; "!store,marith,weird") 1 0)
-;(define_function_unit "alu" 1 0 (eq_attr "type" "marith,weird") 2 0)
-
-(define_function_unit "alu" 1 0
- (and (eq_attr "type" "loada,arith,mov") (eq_attr "cpu" "!m88100")) 2 0)
-(define_function_unit "alu" 1 0
- (and (eq_attr "type" "marith,weird") (eq_attr "cpu" "!m88100")) 4 0)
-
-(define_function_unit "bit" 1 0
- (and (eq_attr "type" "bit") (eq_attr "cpu" "!m88100")) 2 2)
-
-(define_function_unit "mem100" 1 0
- (and (eq_attr "type" "store,loada") (eq_attr "cpu" "m88100")) 1 0)
-(define_function_unit "mem100" 1 0
- (and (eq_attr "type" "load") (eq_attr "cpu" "m88100")) 3 0)
-(define_function_unit "mem100" 1 0
- (and (eq_attr "type" "loadd") (eq_attr "cpu" "m88100")) 3 2)
-
-(define_function_unit "mem110" 1 0
- (and (eq_attr "type" "load,loadd") (eq_attr "cpu" "!m88100")) 3 2)
-(define_function_unit "mem110" 1 0
- (and (eq_attr "type" "store") (eq_attr "cpu" "!m88100")) 1 2)
-
-; The times are adjusted to include fp1 and fplast, but then are further
-; adjusted based on the actual generated code. The notation to the right
-; is the total latency. A range denotes a group of instructions and/or
-; conditions (the extra clock of fplast time with some sequences).
-
-(define_function_unit "fpmul100" 1 0
- (and (eq_attr "type" "spmul") (eq_attr "cpu" "m88100")) 4 0) ; 6-8
-(define_function_unit "fpmul100" 1 0
- (and (eq_attr "type" "dpmul") (eq_attr "cpu" "m88100")) 7 0) ; 9-10
-(define_function_unit "fpmul100" 1 0
- (and (eq_attr "type" "imul") (eq_attr "cpu" "m88100")) 3 0) ; 4
-
-(define_function_unit "fpmul110" 1 0
- (and (eq_attr "type" "imul,spmul,dpmul")
- (eq_attr "cpu" "!m88100")) 5 2) ; 3
-
-(define_function_unit "fpadd100" 1 5
- (and (eq_attr "type" "spadd,spcmp") (eq_attr "cpu" "m88100")) 3 0) ; 5-6
-(define_function_unit "fpadd100" 1 5
- (and (eq_attr "type" "dpadd,dpcmp") (eq_attr "cpu" "m88100")) 4 0) ; 6-7
-
-(define_function_unit "fpadd110" 1 0
- (and (eq_attr "type" "spadd,dpadd") (eq_attr "cpu" "!m88100")) 5 2) ; 3
-(define_function_unit "fpadd110" 1 0
- (and (eq_attr "type" "spcmp,dpcmp") (eq_attr "cpu" "!m88100")) 2 2) ; 1
-
-(define_function_unit "fpadd100" 1 5
- (and (eq_attr "type" "spdiv") (eq_attr "cpu" "m88100")) 30 0) ; 30-31
-(define_function_unit "fpadd100" 1 5
- (and (eq_attr "type" "dpdiv") (eq_attr "cpu" "m88100")) 60 0) ; 60-61
-(define_function_unit "fpadd100" 1 5
- (and (eq_attr "type" "idiv") (eq_attr "cpu" "m88100")) 38 0) ; 38
-
-(define_function_unit "div" 1 1
- (and (eq_attr "type" "spdiv") (eq_attr "cpu" "!m88100")) 25 2) ; 13
-(define_function_unit "div" 1 1
- (and (eq_attr "type" "dpdiv") (eq_attr "cpu" "!m88100")) 45 2) ; 23
-(define_function_unit "div" 1 1
- (and (eq_attr "type" "idiv") (eq_attr "cpu" "!m88100")) 35 2) ; 18
-
-;; Superoptimizer sequences
-
-;; geu+: { r = ((unsigned_word) v0 >= (unsigned_word) v1) + v2; }
-;; subu.co r5,r2,r3
-;; addu.cio r6,r4,r0
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (geu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "register_operand" "r"))))]
- ""
- [(set (reg:CC 0) (unspec:CC [(match_dup 2) (match_dup 3)] 1))
- (set (match_dup 0)
- (plus:SI (match_dup 1)
- (unspec:SI [(const_int 0)
- (reg:CC 0)] 0)))]
- "")
-
-;; leu+: { r = ((unsigned_word) v0 <= (unsigned_word) v1) + v2; }
-;; subu.co r5,r3,r2
-;; addu.cio r6,r4,r0
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (leu:SI (match_operand:SI 3 "register_operand" "r")
- (match_operand:SI 2 "register_operand" "r"))))]
- ""
- [(set (reg:CC 0) (unspec:CC [(match_dup 2) (match_dup 3)] 1))
- (set (match_dup 0)
- (plus:SI (match_dup 1)
- (unspec:SI [(const_int 0)
- (reg:CC 0)] 0)))]
- "")
-
-;; eq0+: { r = (v0 == 0) + v1; }
-;; subu.co r4,r0,r2
-;; addu.cio r5,r3,r0
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (eq:SI (match_operand:SI 2 "register_operand" "r")
- (const_int 0))))]
- ""
- [(set (reg:CC 0) (unspec:CC [(const_int 0) (match_dup 2)] 1))
- (set (match_dup 0)
- (plus:SI (match_dup 1)
- (unspec:SI [(const_int 0)
- (reg:CC 0)] 0)))]
- "")
-
-;; ltu-: { r = v2 - ((unsigned_word) v0 < (unsigned_word) v1); }
-;; subu.co r5,r2,r3
-;; subu.cio r6,r4,r0
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (ltu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "register_operand" "r"))
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- [(set (reg:CC 0) (unspec:CC [(match_dup 2) (match_dup 3)] 1))
- (set (match_dup 0)
- (minus:SI (match_dup 1)
- (unspec:SI [(const_int 0)
- (reg:CC 0)] 1)))]
- "")
-
-;; gtu-: { r = v2 - ((unsigned_word) v0 > (unsigned_word) v1); }
-;; subu.co r5,r3,r2
-;; subu.cio r6,r4,r0
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (gtu:SI (match_operand:SI 3 "register_operand" "r")
- (match_operand:SI 2 "register_operand" "r"))
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- [(set (reg:CC 0) (unspec:CC [(match_dup 2) (match_dup 3)] 1))
- (set (match_dup 0)
- (minus:SI (match_dup 1)
- (unspec:SI [(const_int 0)
- (reg:CC 0)] 1)))]
- "")
-
-;; ne0-: { r = v1 - (v0 != 0); }
-;; subu.co r4,r0,r2
-;; subu.cio r5,r3,r0
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (ne:SI (match_operand:SI 2 "register_operand" "r")
- (const_int 0))
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- [(set (reg:CC 0) (unspec:CC [(const_int 0) (match_dup 2)] 1))
- (set (match_dup 0)
- (minus:SI (match_dup 1)
- (unspec:SI [(const_int 0)
- (reg:CC 0)] 1)))]
- "")
-
-;; ges0-: { r = v1 - ((signed_word) v0 >= 0); }
-;; addu.co r4,r2,r2
-;; subu.cio r5,r3,r0
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (xor:SI (lshiftrt:SI
- (match_operand:SI 2 "register_operand" "r")
- (const_int 31))
- (const_int 1))))]
- ""
- [(set (reg:CC 0) (unspec:CC [(match_dup 2) (match_dup 2)] 0))
- (set (match_dup 0)
- (minus:SI (match_dup 1)
- (unspec:SI [(const_int 0)
- (reg:CC 0)] 1)))]
- "")
-
-;; This rich set of complex patterns are mostly due to Torbjorn Granlund
-;; (tege@sics.se). They've changed since then, so don't complain to him
-;; if they don't work right.
-
-;; Regarding shifts, gen_lshlsi3 generates ASHIFT. The gen functions
-;; produce the necessary insns to support TARGET_*_LARGE_SHIFT, so nothing
-;; special needs to be done here.
-
-;; Optimize possible cases of the set instruction.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (const_int -1)
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "set %0,%#r0,%1"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (ashift:SI (const_int -1)
- (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "set %0,%2,%1"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operand:SI 1 "register_operand" "r")
- (ashift:SI (const_int -1)
- (match_operand:SI 2 "register_operand" "r"))))]
- ""
- "set %0,%1,%2"
- [(set_attr "type" "bit")])
-
-;; Optimize possible cases of the mak instruction.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "int5_operand" ""))
- (match_operand:SI 3 "immediate_operand" "n")))]
- "mak_mask_p (INTVAL (operands[3]) >> INTVAL (operands[2]))"
- "*
-{
- operands[4] = gen_rtx (CONST_INT, SImode,
- exact_log2 (1 + (INTVAL (operands[3])
- >> INTVAL(operands[2]))));
- return \"mak %0,%1,%4<%2>\";
-}"
- [(set_attr "type" "bit")])
-
-;; Optimize possible cases of output_and.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "int5_operand" "")
- (match_operand:SI 3 "int5_operand" ""))
- (match_operand:SI 4 "int5_operand" "")))]
- "INTVAL (operands[2]) + INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
- "*
-{
- operands[2]
- = gen_rtx (CONST_INT, SImode,
- ((1 << INTVAL (operands[2])) - 1) << INTVAL (operands[4]));
- return output_and (operands);
-}"
- [(set_attr "type" "marith")]) ; arith,bit,marith. length is 1 or 2.
-
-;; Improve logical operations on compare words
-;;
-;; We define all logical operations on CCmode values to preserve the pairwise
-;; relationship of the compare bits. This allows a future branch prediction
-;; pass the degree of freedom needed to change and/bb0-le into or/bb1-gt.
-;; THIS IS CURRENTLY FALSE!
-;;
-;; Opportunities arise when conditional expressions using && and || are made
-;; unconditional. When these are used to branch, the sequence is
-;; cmp/cmp/extu/extu/{and,or}/bcnd-{eq0,ne0}. When these are used to create
-;; a value, the sequence is cmp/cmp/extu/extu/{and,or} for 1 or 0 or
-;; cmp/cmp/ext/ext/{and,or} for -1 or 0.
-;;
-;; When the extracted conditions are the same, the define_split patterns
-;; below change extu/extu/{and,or} into {and,or}/extu. If the reversed
-;; conditions match, one compare word can be complimented, resulting in
-;; {and.c,or.c}/extu. These changes are done for ext/ext/{and,or} as well.
-;; If the conditions don't line up, one can be rotated. To keep the pairwise
-;; relationship, it may be necessary to both rotate and compliment. Rotating
-;; makes branching cheaper, but doesn't help (or hurt) creating a value, so
-;; we don't do this for ext/ext/{and,or}.
-;;
-;; These changes result in the sequence extu/bcnd-{eq0,ne0} which is combined
-;; into an alternate form of bb0 and bb1.
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (neg:SI
- (match_operator 1 "even_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)]))
- (neg:SI
- (match_operator 3 "relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)]))))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- ""
- [(set (match_dup 5)
- (ior:CCEVEN (match_dup 4)
- (match_dup 2)))
- (set (match_dup 0)
- (neg:SI (match_op_dup 1 [(match_dup 5) (const_int 0)])))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);
- if (GET_CODE (operands[1]) == GET_CODE (operands[3]))
- ; /* The conditions match. */
- else if (GET_CODE (operands[1])
- == reverse_condition (GET_CODE (operands[3])))
- /* Reverse the condition by complimenting the compare word. */
- operands[4] = gen_rtx (NOT, CCmode, operands[4]);
- else
- {
- /* Make the condition pairs line up by rotating the compare word. */
- int cv1 = condition_value (operands[1]);
- int cv2 = condition_value (operands[3]);
-
- operands[4] = gen_rtx (ROTATE, CCmode, operands[4],
- gen_rtx (CONST_INT, VOIDmode,
- ((cv2 & ~1) - (cv1 & ~1)) & 0x1f));
- /* Reverse the condition if needed. */
- if ((cv1 & 1) != (cv2 & 1))
- operands[4] = gen_rtx (NOT, CCmode, operands[4]);
- }")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (neg:SI
- (match_operator 1 "odd_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)]))
- (neg:SI
- (match_operator 3 "odd_relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)]))))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- ""
- [(set (match_dup 5)
- (and:CCEVEN (match_dup 4)
- (match_dup 2)))
- (set (match_dup 0)
- (neg:SI (match_op_dup 1 [(match_dup 5) (const_int 0)])))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);
- if (GET_CODE (operands[1]) == GET_CODE (operands[3]))
- ; /* The conditions match. */
- else
- {
- /* Make the condition pairs line up by rotating the compare word. */
- int cv1 = condition_value (operands[1]);
- int cv2 = condition_value (operands[3]);
-
- operands[4] = gen_rtx (ROTATE, CCmode, operands[4],
- gen_rtx (CONST_INT, VOIDmode,
- (cv2 - cv1) & 0x1f));
- }")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (neg:SI
- (match_operator 1 "odd_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)]))
- (neg:SI
- (match_operator 3 "even_relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)]))))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- ""
- [(set (match_dup 5)
- (ior:CCEVEN (not:CC (match_dup 2))
- (match_dup 4)))
- (set (match_dup 0)
- (neg:SI (match_op_dup 3 [(match_dup 5) (const_int 0)])))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);
- if (GET_CODE (operands[1])
- == reverse_condition (GET_CODE (operands[3])))
- ;
- else
- {
- /* Make the condition pairs line up by rotating the compare word. */
- int cv1 = condition_value (operands[1]);
- int cv2 = condition_value (operands[3]);
-
- operands[2] = gen_rtx (ROTATE, CCmode, operands[2],
- gen_rtx (CONST_INT, VOIDmode,
- ((cv1 & ~1) - (cv2 & ~1)) & 0x1f));
- }")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operator 1 "even_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)])
- (match_operator 3 "relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)])))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- "GET_CODE (operands[1]) == GET_CODE (operands[3])
- || GET_CODE (operands[1]) == reverse_condition (GET_CODE (operands[3]))"
- [(set (match_dup 5)
- (ior:CCEVEN (match_dup 4)
- (match_dup 2)))
- (set (match_dup 0)
- (match_op_dup 1 [(match_dup 5) (const_int 0)]))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);
- /* Reverse the condition by complimenting the compare word. */
- if (GET_CODE (operands[1]) != GET_CODE (operands[3]))
- operands[4] = gen_rtx (NOT, CCmode, operands[4]);")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operator 1 "odd_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)])
- (match_operator 3 "odd_relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)])))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- "GET_CODE (operands[1]) == GET_CODE (operands[3])"
- [(set (match_dup 5)
- (and:CCEVEN (match_dup 4)
- (match_dup 2)))
- (set (match_dup 0)
- (match_op_dup 1 [(match_dup 5) (const_int 0)]))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operator 1 "odd_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)])
- (match_operator 3 "even_relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)])))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- "GET_CODE (operands[1]) == reverse_condition (GET_CODE (operands[3]))"
- [(set (match_dup 5)
- (ior:CCEVEN (not:CC (match_dup 4))
- (match_dup 2)))
- (set (match_dup 0)
- (match_op_dup 1 [(match_dup 5) (const_int 0)]))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (neg:SI
- (match_operator 1 "even_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)]))
- (neg:SI
- (match_operator 3 "relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)]))))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- ""
- [(set (match_dup 5)
- (and:CCEVEN (match_dup 4)
- (match_dup 2)))
- (set (match_dup 0)
- (neg:SI (match_op_dup 1 [(match_dup 5) (const_int 0)])))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);
- if (GET_CODE (operands[1]) == GET_CODE (operands[3]))
- ; /* The conditions match. */
- else if (GET_CODE (operands[1])
- == reverse_condition (GET_CODE (operands[3])))
- /* Reverse the condition by complimenting the compare word. */
- operands[4] = gen_rtx (NOT, CCmode, operands[4]);
- else
- {
- /* Make the condition pairs line up by rotating the compare word. */
- int cv1 = condition_value (operands[1]);
- int cv2 = condition_value (operands[3]);
- operands[4] = gen_rtx (ROTATE, CCmode, operands[4],
- gen_rtx (CONST_INT, VOIDmode,
- ((cv2 & ~1) - (cv1 & ~1)) & 0x1f));
- /* Reverse the condition if needed. */
- if ((cv1 & 1) != (cv2 & 1))
- operands[4] = gen_rtx (NOT, CCmode, operands[4]);
- }")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (neg:SI
- (match_operator 1 "odd_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)]))
- (neg:SI
- (match_operator 3 "odd_relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)]))))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- ""
- [(set (match_dup 5)
- (ior:CCEVEN (match_dup 4)
- (match_dup 2)))
- (set (match_dup 0)
- (neg:SI (match_op_dup 1 [(match_dup 5) (const_int 0)])))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);
- if (GET_CODE (operands[1]) == GET_CODE (operands[3]))
- ; /* The conditions match. */
- else
- {
- /* Make the condition pairs line up by rotating the compare word. */
- int cv1 = condition_value (operands[1]);
- int cv2 = condition_value (operands[3]);
- operands[4] = gen_rtx (ROTATE, CCmode, operands[4],
- gen_rtx (CONST_INT, VOIDmode,
- (cv2 - cv1) & 0x1f));
- }")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (neg:SI
- (match_operator 1 "odd_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)]))
- (neg:SI
- (match_operator 3 "even_relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)]))))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- ""
- [(set (match_dup 5)
- (and:CCEVEN (not:CC (match_dup 2))
- (match_dup 4)))
- (set (match_dup 0)
- (neg:SI (match_op_dup 3 [(match_dup 5) (const_int 0)])))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);
- if (GET_CODE (operands[1])
- == reverse_condition (GET_CODE (operands[3])))
- ;
- else
- {
- /* Make the condition pairs line up by rotating the compare word. */
- int cv1 = condition_value (operands[1]);
- int cv2 = condition_value (operands[3]);
- operands[2] = gen_rtx (ROTATE, CCmode, operands[2],
- gen_rtx (CONST_INT, VOIDmode,
- ((cv1 & ~1) - (cv2 & ~1)) & 0x1f));
- }")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (match_operator 1 "even_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)])
- (match_operator 3 "relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)])))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- "GET_CODE (operands[1]) == GET_CODE (operands[3])
- || GET_CODE (operands[1]) == reverse_condition (GET_CODE (operands[3]))"
- [(set (match_dup 5)
- (and:CCEVEN (match_dup 4)
- (match_dup 2)))
- (set (match_dup 0)
- (match_op_dup 1 [(match_dup 5) (const_int 0)]))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);
- /* Reverse the condition by complimenting the compare word. */
- if (GET_CODE (operands[1]) != GET_CODE (operands[3]))
- operands[4] = gen_rtx (NOT, CCmode, operands[4]);")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (match_operator 1 "odd_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)])
- (match_operator 3 "odd_relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)])))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- "GET_CODE (operands[1]) == GET_CODE (operands[3])"
- [(set (match_dup 5)
- (ior:CCEVEN (match_dup 4)
- (match_dup 2)))
- (set (match_dup 0)
- (match_op_dup 1 [(match_dup 5) (const_int 0)]))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (match_operator 1 "odd_relop"
- [(match_operand 2 "partial_ccmode_register_operand" "%r")
- (const_int 0)])
- (match_operator 3 "even_relop"
- [(match_operand 4 "partial_ccmode_register_operand" "r")
- (const_int 0)])))
- (clobber (match_operand:SI 5 "register_operand" "=r"))]
- "GET_CODE (operands[1]) == reverse_condition (GET_CODE (operands[3]))"
- [(set (match_dup 5)
- (and:CCEVEN (not:CC (match_dup 2))
- (match_dup 4)))
- (set (match_dup 0)
- (match_op_dup 3 [(match_dup 5) (const_int 0)]))]
- "operands[5] = gen_rtx(SUBREG, CCEVENmode, operands[5], 0);")
-
-
-;; Logical operations on compare words.
-
-(define_insn ""
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (and:CCEVEN (not:CC (match_operand 1 "partial_ccmode_register_operand" "r"))
- (match_operand 2 "partial_ccmode_register_operand" "r")))]
- ""
- "and.c %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (and:CCEVEN (match_operand 1 "partial_ccmode_register_operand" "%r")
- (match_operand 2 "partial_ccmode_register_operand" "r")))]
- ""
- "and %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (ior:CCEVEN (not:CC (match_operand 1 "partial_ccmode_register_operand" "r"))
- (match_operand 2 "partial_ccmode_register_operand" "r")))]
- ""
- "or.c %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (ior:CCEVEN (match_operand 1 "partial_ccmode_register_operand" "%r")
- (match_operand 2 "partial_ccmode_register_operand" "r")))]
- ""
- "or %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "register_operand" "=r")
- (rotate:CC (match_operand:CC 1 "register_operand" "r")
- (match_operand:CC 2 "int5_operand" "")))]
- ""
- "rot %0,%1,%2"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (rotate:CC (match_operand 1 "partial_ccmode_register_operand" "r")
- (match_operand:CC 2 "int5_operand" "")))]
- ""
- "rot %0,%1,%2"
- [(set_attr "type" "bit")])
-
-;; rotate/and[.c] and rotate/ior[.c]
-
-(define_split
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (ior:CCEVEN (rotate:CC (match_operand 1 "partial_ccmode_register_operand" "r")
- (match_operand:CC 2 "int5_operand" ""))
- (match_operand 3 "partial_ccmode_register_operand" "r")))
- (clobber (match_operand:CCEVEN 4 "register_operand" "=r"))]
- ""
- [(set (match_dup 4)
- (rotate:CC (match_dup 1) (match_dup 2)))
- (set (match_dup 0)
- (ior:CCEVEN (match_dup 4) (match_dup 3)))]
- "")
-
-(define_insn ""
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (ior:CC (rotate:CC (match_operand 1 "partial_ccmode_register_operand" "r")
- (match_operand:CC 2 "int5_operand" ""))
- (match_operand 3 "partial_ccmode_register_operand" "r")))
- (clobber (match_scratch:CCEVEN 4 "=r"))]
- ""
- "#")
-
-(define_split
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (ior:CCEVEN (not:CC (rotate:CC (match_operand 1 "partial_ccmode_register_operand" "r")
- (match_operand:CC 2 "int5_operand" "")))
- (match_operand 3 "partial_ccmode_register_operand" "r")))
- (clobber (match_operand:CCEVEN 4 "register_operand" "=r"))]
- ""
- [(set (match_dup 4)
- (rotate:CC (match_dup 1) (match_dup 2)))
- (set (match_dup 0)
- (ior:CCEVEN (not:CC (match_dup 4)) (match_dup 3)))]
- "")
-
-(define_insn ""
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (ior:CCEVEN (not:CC (rotate:CC (match_operand 1 "partial_ccmode_register_operand" "r")
- (match_operand:CC 2 "int5_operand" "")))
- (match_operand 3 "partial_ccmode_register_operand" "r")))
- (clobber (match_scratch:CCEVEN 4 "=r"))]
- ""
- "#")
-
-(define_split
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (and:CCEVEN (rotate:CC (match_operand 1 "partial_ccmode_register_operand" "r")
- (match_operand:CC 2 "int5_operand" ""))
- (match_operand 3 "partial_ccmode_register_operand" "r")))
- (clobber (match_operand:CCEVEN 4 "register_operand" "=r"))]
- ""
- [(set (match_dup 4)
- (rotate:CC (match_dup 1) (match_dup 2)))
- (set (match_dup 0)
- (and:CCEVEN (match_dup 4) (match_dup 3)))]
- "")
-
-(define_insn ""
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (and:CCEVEN (rotate:CC (match_operand 1 "partial_ccmode_register_operand" "r")
- (match_operand:CC 2 "int5_operand" ""))
- (match_operand 3 "partial_ccmode_register_operand" "r")))
- (clobber (match_scratch:CCEVEN 4 "=r"))]
- ""
- "#")
-
-(define_split
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (and:CCEVEN (not:CC (rotate:CC (match_operand 1 "partial_ccmode_register_operand" "r")
- (match_operand:CC 2 "int5_operand" "")))
- (match_operand 3 "partial_ccmode_register_operand" "r")))
- (clobber (match_operand:CCEVEN 4 "register_operand" "=r"))]
- ""
- [(set (match_dup 4)
- (rotate:CC (match_dup 1) (match_dup 2)))
- (set (match_dup 0)
- (and:CCEVEN (not:CC (match_dup 4)) (match_dup 3)))]
- "")
-
-(define_insn ""
- [(set (match_operand:CCEVEN 0 "register_operand" "=r")
- (and:CCEVEN (not:CC (rotate:CC (match_operand 1 "partial_ccmode_register_operand" "r")
- (match_operand:CC 2 "int5_operand" "")))
- (match_operand 3 "partial_ccmode_register_operand" "r")))
- (clobber (match_scratch:CCEVEN 4 "=r"))]
- ""
- "#")
-
-
-;; Recognize bcnd instructions for integer values. This is distinguished
-;; from a conditional branch instruction (below) with SImode instead of
-;; CCmode.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "relop_no_unsigned"
- [(match_operand:SI 1 "register_operand" "r")
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bcnd%. %R3%B0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-;; Recognize tests for sign and zero.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "equality_op"
- [(match_operand:SI 1 "register_operand" "r")
- (const_int -2147483648)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bcnd%. %R3%E0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "equality_op"
- [(zero_extract:SI
- (match_operand:SI 1 "register_operand" "r")
- (const_int 31)
- (const_int 1))
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bcnd%. %R3%D0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-;; Recognize bcnd instructions for double integer values
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "relop_no_unsigned"
- [(sign_extend:DI
- (match_operand:SI 1 "register_operand" "r"))
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bcnd%. %R3%B0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "equality_op"
- [(zero_extend:DI
- (match_operand:SI 1 "register_operand" "r"))
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bcnd%. %R3%B0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-; @@ I doubt this is interesting until cmpdi is provided. Anyway, it needs
-; to be reworked.
-;
-;(define_insn ""
-; [(set (pc)
-; (if_then_else
-; (match_operator 0 "relop_no_unsigned"
-; [(match_operand:DI 1 "register_operand" "r")
-; (const_int 0)])
-; (match_operand 2 "pc_or_label_ref" "")
-; (match_operand 3 "pc_or_label_ref" "")))]
-; ""
-; "*
-;{
-; switch (GET_CODE (operands[0]))
-; {
-; case EQ:
-; case NE:
-; /* I'm not sure if it's safe to use .n here. */
-; return \"or %!,%1,%d1\;bcnd %R3%B0,%!,%P2%P3\";
-; case GE:
-; case LT:
-; return \"bcnd%. %R3%B0,%1,%P2%P3\";
-; case GT:
-; {
-; rtx op2 = operands[2];
-; operands[2] = operands[3];
-; operands[3] = op2;
-; }
-; case LE:
-; if (GET_CODE (operands[3]) == LABEL_REF)
-; {
-; int label_num;
-; operands[2] = gen_label_rtx ();
-; label_num = XINT (operands[2], 3);
-; output_asm_insn
-; (\"bcnd%. %#lt0,%1,%2\;or %!,%1,%d1\;bcnd %#ne0,%!,%3\", operands);
-; output_label (label_num);
-; return \"\";
-; }
-; else
-; return \"bcnd%. %#lt0,%1,%2\;or %!,%1,%d1\;bcnd %#eq0,%!,%2\";
-; }
-;}")
-
-;; Recognize bcnd instructions for single precision float values
-;; Exclude relational operations as they must signal NaNs.
-
-;; @@ These bcnd insns for float and double values don't seem to be recognized.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "equality_op"
- [(float_extend:DF
- (match_operand:SF 1 "register_operand" "r"))
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bcnd%. %R3%D0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "equality_op"
- [(match_operand:SF 1 "register_operand" "r")
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bcnd%. %R3%D0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-;; Recognize bcnd instructions for double precision float values
-;; Exclude relational operations as they must signal NaNs.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "equality_op"
- [(match_operand:DF 1 "register_operand" "r")
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "*
-{
- int label_num;
-
- if (GET_CODE (operands[0]) == NE)
- {
- rtx op2 = operands[2];
- operands[2] = operands[3];
- operands[3] = op2;
- }
- if (GET_CODE (operands[3]) == LABEL_REF)
- return \"bcnd 0x5,%1,%3\;bcnd %#ne0,%d1,%3\";
-
- operands[3] = gen_label_rtx ();
- label_num = XINT (operands[3], 3);
- output_asm_insn (\"bcnd 0x5,%1,%3\;bcnd %#eq0,%d1,%2\", operands);
- output_label (label_num);
- return \"\";
-}"
- [(set_attr "type" "weird")
- (set_attr "length" "3")])
-
-;; Recognize bb0 and bb1 instructions. These use two unusual template
-;; patterns, %Lx and %Px. %Lx outputs a 1 if operand `x' is a LABEL_REF
-;; otherwise it outputs a 0. It then may print ".n" if the delay slot
-;; is used. %Px does noting if `x' is PC and outputs the operand if `x'
-;; is a LABEL_REF.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (sign_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "int5_operand" ""))
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L2 (31-%1),%0,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (sign_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "int5_operand" ""))
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L3 (31-%1),%0,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "int5_operand" ""))
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L2 (31-%1),%0,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "int5_operand" ""))
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L3 (31-%1),%0,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (and:SI (match_operand:SI 0 "reg_or_bbx_mask_operand" "%r")
- (match_operand:SI 1 "reg_or_bbx_mask_operand" "n"))
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- "(GET_CODE (operands[0]) == CONST_INT)
- != (GET_CODE (operands[1]) == CONST_INT)"
- "bb%L3 %p1,%0,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (and:SI (match_operand:SI 0 "reg_or_bbx_mask_operand" "%r")
- (match_operand:SI 1 "reg_or_bbx_mask_operand" "n"))
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- "(GET_CODE (operands[0]) == CONST_INT)
- != (GET_CODE (operands[1]) == CONST_INT)"
- "bb%L2 %p1,%0,%P2%P3"
- [(set_attr "type" "branch")])
-
-;; The comparison operations store the comparison into a register and
-;; record that register. The following Bxx or Sxx insn uses that
-;; register as an input. To facilitate use of bcnd instead of cmp/bb1,
-;; cmpsi records it's operands and produces no code when any operand
-;; is constant. In this case, the Bxx insns use gen_bcnd and the
-;; Sxx insns use gen_test to ensure a cmp has been emitted.
-;;
-;; This could also be done for SFmode and DFmode having only beq and bne
-;; use gen_bcnd. The others must signal NaNs. It seems though that zero
-;; has already been copied into a register.
-;;
-;; cmpsi/beq and cmpsi/bne can always be done with bcnd if any operand
-;; is a constant. (This idea is due to Torbjorn Granlund.) Others can
-;; use bcnd only if an operand is zero.
-;;
-;; It is necessary to distinguish a register holding condition codes.
-;; This is done by context.
-
-(define_expand "test"
- [(set (match_dup 2)
- (compare:CC (match_operand 0 "" "")
- (match_operand 1 "" "")))]
- ""
- "
-{
- if (m88k_compare_reg)
- abort ();
-
- if (GET_CODE (operands[0]) == CONST_INT
- && ! SMALL_INT (operands[0]))
- operands[0] = force_reg (SImode, operands[0]);
-
- if (GET_CODE (operands[1]) == CONST_INT
- && ! SMALL_INT (operands[1]))
- operands[1] = force_reg (SImode, operands[1]);
-
- operands[2] = m88k_compare_reg = gen_reg_rtx (CCmode);
-}")
-
-; @@ The docs say don't do this. It's probably a nop since the insn looks
-; identical to cmpsi against zero. Is there an advantage to providing
-; this, perhaps with a different form?
-
-;(define_expand "tstsi"
-; [(set (match_dup 1)
-; (compare:CC (match_operand:SI 0 "register_operand" "")
-; (const_int 0)))]
-; ""
-; "
-;{
-; m88k_compare_reg = 0;
-; m88k_compare_op0 = operands[0];
-; m88k_compare_op1 = const0_rtx;
-; DONE;
-;}")
-
-(define_expand "cmpsi"
- [(set (match_dup 2)
- (compare:CC (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == CONST_INT
- || GET_CODE (operands[1]) == CONST_INT)
- {
- m88k_compare_reg = 0;
- m88k_compare_op0 = operands[0];
- m88k_compare_op1 = operands[1];
- DONE;
- }
- operands[2] = m88k_compare_reg = gen_reg_rtx (CCmode);
-}")
-
-(define_expand "cmpsf"
- [(set (match_dup 2)
- (compare:CC (match_operand:SF 0 "register_operand" "")
- (match_operand:SF 1 "register_operand" "")))]
- ""
- "operands[2] = m88k_compare_reg = gen_reg_rtx (CCmode);")
-
-(define_expand "cmpdf"
- [(set (match_dup 2)
- (compare:CC (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" "")))]
- ""
- "
-{
- operands[0] = legitimize_operand (operands[0], DFmode);
- operands[1] = legitimize_operand (operands[1], DFmode);
- operands[2] = m88k_compare_reg = gen_reg_rtx (CCmode);
-}")
-
-; @@ Get back to this later on.
-;
-;(define_insn "cmpdi"
-; [(set (cc0)
-; (compare:CC (match_operand:DI 0 "register_operand" "r")
-; (match_operand:DI 1 "register_operand" "r")))]
-; ""
-; "*
-;{
-; if ((cc_status.mdep & MDEP_LS_CHANGE) != 0)
-; abort (); /* output_move_double MDEP_LS_CHANGE bits were set. */
-;
-; cc_status.mdep &= ~ MDEP_LS_MASK;
-;
-; operands[2] = gen_label_rtx ();
-; /* Remember, %! is the condition code register and %@ is the
-; literal synthesis register. */
-;
-; output_asm_insn (\"cmp %!,%0,%1\;bb0 %#eq,%!,%l2\;cmp %!,%d0,%d1\",
-; operands);
-;
-; output_asm_insn (\"extu %@,%!,4<8>\;clr %!,%!,4<4>\", operands);
-; output_asm_insn (\"mak %@,%@,4<4>\;or %!,%!,%@\", operands);
-; output_label (XINT (operands[2], 3));
-; return \"\";
-;}"
-
-;; The actual compare instructions.
-
-(define_insn ""
- [(set (match_operand:CC 0 "register_operand" "=r")
- (compare:CC (match_operand:SI 1 "register_operand" "rO")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "cmp %0,%r1,%2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "register_operand" "=r,r,r,r")
- (compare:CC (match_operand:SF 1 "register_operand" "r,r,x,x")
- (match_operand:SF 2 "real_or_0_operand" "r,G,x,G")))]
- ""
- "@
- fcmp.sss %0,%1,%2
- fcmp.sss %0,%1,%#r0
- fcmp.sss %0,%1,%2
- fcmp.sss %0,%1,%#x0"
- [(set_attr "type" "spcmp")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "register_operand" "=r,r")
- (compare:CC (match_operand:DF 1 "register_operand" "r,x")
- (float_extend:DF
- (match_operand:SF 2 "register_operand" "r,x"))))]
- ""
- "fcmp.sds %0,%1,%2"
- [(set_attr "type" "dpcmp")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "register_operand" "=r,r")
- (compare:CC (float_extend:DF
- (match_operand:SF 1 "register_operand" "r,x"))
- (match_operand:DF 2 "register_operand" "r,x")))]
- ""
- "fcmp.ssd %0,%1,%2"
- [(set_attr "type" "dpcmp")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "register_operand" "=r,r,r,r")
- (compare:CC (match_operand:DF 1 "register_operand" "r,r,x,x")
- (match_operand:DF 2 "real_or_0_operand" "r,G,x,G")))]
- ""
- "@
- fcmp.sdd %0,%1,%2
- fcmp.sds %0,%1,%#r0
- fcmp.sdd %0,%1,%2
- fcmp.sds %0,%1,%#x0"
- [(set_attr "type" "dpcmp")])
-
-;; Store condition code insns. The compare insns set a register
-;; rather than cc0 and record that register for use here. See above
-;; for the special treatment of cmpsi with a constant operand.
-
-;; @@ For the m88110, use fcmpu for bxx sxx inequality comparisons.
-
-(define_expand "seq"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (EQ, SImode);")
-
-(define_expand "sne"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (NE, SImode);")
-
-(define_expand "sgt"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (GT, SImode);")
-
-(define_expand "sgtu"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (GTU, SImode);")
-
-(define_expand "slt"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (LT, SImode);")
-
-(define_expand "sltu"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (LTU, SImode);")
-
-(define_expand "sge"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (GE, SImode);")
-
-(define_expand "sgeu"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (GEU, SImode);")
-
-(define_expand "sle"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (LE, SImode);")
-
-(define_expand "sleu"
- [(set (match_operand:SI 0 "register_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = emit_test (LEU, SImode);")
-
-;; The actual set condition code instruction.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operator:SI 1 "relop"
- [(match_operand:CC 2 "register_operand" "r")
- (const_int 0)]))]
- ""
- "ext %0,%2,1<%C1>"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operator:SI 1 "even_relop"
- [(match_operand:CCEVEN 2 "register_operand" "r")
- (const_int 0)]))]
- ""
- "ext %0,%2,1<%C1>"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_operator:SI 1 "odd_relop"
- [(match_operand:CCEVEN 2 "register_operand" "r")
- (const_int 0)])))]
- ""
- "ext %0,%2,1<%!%C1>"
- [(set_attr "type" "bit")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operator:SI 1 "odd_relop"
- [(match_operand:CCEVEN 2 "register_operand" "r")
- (const_int 0)]))
- (clobber (match_operand:SI 3 "register_operand" "=r"))]
- ""
- [(set (match_dup 3) (not:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])))
- (set (match_dup 0) (not:SI (match_dup 3)))]
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operator:SI 1 "odd_relop"
- [(match_operand:CCEVEN 2 "register_operand" "r")
- (const_int 0)]))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "#")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI
- (match_operator:SI 1 "relop"
- [(match_operand:CC 2 "register_operand" "r")
- (const_int 0)])))]
- ""
- "extu %0,%2,1<%C1>"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI
- (match_operator:SI 1 "even_relop"
- [(match_operand:CCEVEN 2 "register_operand" "r")
- (const_int 0)])))]
- ""
- "extu %0,%2,1<%C1>"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI
- (not:SI (match_operator:SI 1 "odd_relop"
- [(match_operand:CCEVEN 2 "register_operand" "r")
- (const_int 0)]))))]
- ""
- "extu %0,%2,1<%!%C1>"
- [(set_attr "type" "bit")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operator:SI 1 "odd_relop"
- [(match_operand:CCEVEN 2 "register_operand" "r")
- (const_int 0)])))
- (clobber (match_operand:SI 3 "register_operand" "=r"))]
- ""
- [(set (match_dup 3) (neg:SI (not:SI (match_op_dup 1 [(match_dup 2)
- (const_int 0)]))))
- (set (match_dup 0) (xor:SI (match_dup 3) (const_int 1)))]
- "")
-
-(define_insn
- ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operator:SI 1 "odd_relop"
- [(match_operand:CCEVEN 2 "register_operand" "r")
- (const_int 0)])))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "#")
-
-
-
-
-;; Conditional branch insns. The compare insns set a register
-;; rather than cc0 and record that register for use here. See above
-;; for the special case of cmpsi with a constant operand.
-
-(define_expand "bcnd"
- [(set (pc)
- (if_then_else (match_operand 0 "" "")
- (label_ref (match_operand 1 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg) abort ();")
-
-(define_expand "bxx"
- [(set (pc)
- (if_then_else (match_operand 0 "" "")
- (label_ref (match_operand 1 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0) abort ();")
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_bcnd (EQ, operands[0]);
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_bcnd (NE, operands[0]);
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_bcnd (GT, operands[0]);
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_jump_insn (gen_bxx (emit_test (GTU, VOIDmode), operands[0]));
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_bcnd (LT, operands[0]);
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_jump_insn (gen_bxx (emit_test (LTU, VOIDmode), operands[0]));
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_bcnd (GE, operands[0]);
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_jump_insn (gen_bxx (emit_test (GEU, VOIDmode), operands[0]));
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_bcnd (LE, operands[0]);
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "if (m88k_compare_reg == 0)
- {
- emit_jump_insn (gen_bxx (emit_test (LEU, VOIDmode), operands[0]));
- DONE;
- }
- operands[1] = m88k_compare_reg;")
-
-;; The actual conditional branch instruction (both directions). This
-;; uses two unusual template patterns, %Rx and %Px. %Rx is a prefix code
-;; for the immediately following condition and reverses the condition iff
-;; operand `x' is a LABEL_REF. %Px does nothing if `x' is PC and outputs
-;; the operand if `x' is a LABEL_REF.
-
-(define_insn ""
- [(set (pc) (if_then_else
- (match_operator 0 "relop"
- [(match_operand:CC 1 "register_operand" "r")
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "*
-{
- if (mostly_false_jump (insn, operands[0]))
- return \"bb0%. %R2%C0,%1,%P2%P3\";
- else
- return \"bb1%. %R3%C0,%1,%P2%P3\";
-}"
- [(set_attr "type" "branch")])
-
-;;
-;; Here branch prediction is sacrificed. To get it back, you need
-;; - CCODD (CC mode where the ODD bits are valid)
-;; - several define_split that can apply De Morgan's Law.
-;; - transformations between CCEVEN and CCODD modes.
-;;
-
-(define_insn ""
- [(set (pc) (if_then_else
- (match_operator 0 "even_relop"
- [(match_operand:CCEVEN 1 "register_operand" "r")
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L2%. %C0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc) (if_then_else
- (match_operator 0 "odd_relop"
- [(match_operand:CCEVEN 1 "register_operand" "r")
- (const_int 0)])
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L3%. %!%C0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-;; Branch conditional on scc values. These arise from manipulations on
-;; compare words above.
-;; Are these really used ?
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operator 0 "relop"
- [(match_operand:CC 1 "register_operand" "r")
- (const_int 0)])
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L2 %C0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operator 0 "even_relop"
- [(match_operand:CCEVEN 1 "register_operand" "r")
- (const_int 0)])
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L2 %C0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operator 0 "odd_relop"
- [(match_operand:CCEVEN 1 "register_operand" "r")
- (const_int 0)])
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L3 %!%C0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (match_operator 0 "relop"
- [(match_operand:CC 1 "register_operand" "r")
- (const_int 0)])
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L3 %C0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (match_operator 0 "even_relop"
- [(match_operand:CCEVEN 1 "register_operand" "r")
- (const_int 0)])
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L3 %C0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (match_operator 0 "odd_relop"
- [(match_operand:CCEVEN 1 "register_operand" "r")
- (const_int 0)])
- (const_int 0))
- (match_operand 2 "pc_or_label_ref" "")
- (match_operand 3 "pc_or_label_ref" "")))]
- ""
- "bb%L2 %!%C0,%1,%P2%P3"
- [(set_attr "type" "branch")])
-
-(define_insn "locate1"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (unspec:SI [(label_ref (match_operand 1 "" ""))] 0)))]
- ""
- "or.u %0,%#r0,%#hi16(%1#abdiff)")
-
-(define_insn "locate2"
- [(parallel [(set (reg:SI 1) (pc))
- (set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_dup 0)
- (unspec:SI
- [(label_ref (match_operand 1 "" ""))] 0)))])]
- ""
- "bsr.n %1\;or %0,%0,%#lo16(%1#abdiff)\\n%1:"
- [(set_attr "length" "2")])
-
-;; SImode move instructions
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, SImode, 0))
- DONE;
-}")
-
-(define_expand "reload_insi"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "general_operand" ""))
- (clobber (match_operand:SI 2 "register_operand" "=&r"))]
- ""
- "
-{
- if (emit_move_sequence (operands, SImode, operands[2]))
- DONE;
-
- /* We don't want the clobber emitted, so handle this ourselves. */
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,m,r,r,r,x,x,x,m")
- (match_operand:SI 1 "move_operand" "rI,m,rO,J,M,x,r,x,m,x"))]
- "(register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)
- || operands[1] == const0_rtx)"
- "@
- or %0,%#r0,%1
- %V1ld\\t %0,%1
- %v0st\\t %r1,%0
- subu %0,%#r0,%n1
- set %0,%#r0,%s1
- mov.s %0,%1
- mov.s %0,%1
- mov %0,%1
- %V1ld\\t %0,%1
- %v0st\\t %1,%0"
- [(set_attr "type" "arith,load,store,arith,bit,mov,mov,mov,load,store")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
- (match_operand:SI 1 "arith32_operand" "rI,J,L,M,n"))]
- ""
- "@
- or %0,%#r0,%1
- subu %0,%#r0,%n1
- or.u %0,%#r0,%X1
- set %0,%#r0,%s1
- or.u %0,%#r0,%X1\;or %0,%0,%x1"
- [(set_attr "type" "arith,arith,arith,bit,marith")])
-
-;; @@ Why the constraint "in"? Doesn't `i' include `n'?
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "in")))]
- ""
- "or %0,%1,%#lo16(%g2)")
-
-;; For PIC, symbol_refs are put inside unspec so that the optimizer won't
-;; confuse them with real addresses.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (unspec:SI [(match_operand:SI 2 "immediate_operand" "in")] 0)))]
- ""
- "or %0,%1,%#lo16(%g2)"
- ;; Need to set length for this arith insn because operand2
- ;; is not an "arith_operand".
- [(set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (match_operand 1 "" "")))]
- ""
- "or.u %0,%#r0,%#hi16(%g1)")
-
-;; For PIC, symbol_refs are put inside unspec so that the optimizer won't
-;; confuse them with real addresses.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (unspec:SI [(match_operand 1 "" "")] 0)))]
- ""
- "or.u %0,%#r0,%#hi16(%g1)"
- ;; Need to set length for this arith insn because operand2
- ;; is not an arith_operand.
- [(set_attr "length" "1")])
-
-;; HImode move instructions
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, HImode, 0))
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r")
- (match_operand:HI 1 "move_operand" "rP,m,rO,N"))]
- "(register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode)
- || operands[1] == const0_rtx)"
- "@
- or %0,%#r0,%h1
- %V1ld.hu\\t %0,%1
- %v0st.h\\t %r1,%0
- subu %0,%#r0,%H1"
- [(set_attr "type" "arith,load,store,arith")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (subreg:HI (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "in")) 0))]
- "!flag_pic"
- "or %0,%1,%#lo16(%2)")
-
-;; QImode move instructions
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, QImode, 0))
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r")
- (match_operand:QI 1 "move_operand" "rP,m,rO,N"))]
- "(register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode)
- || operands[1] == const0_rtx)"
- "@
- or %0,%#r0,%q1
- %V1ld.bu\\t %0,%1
- %v0st.b\\t %r1,%0
- subu %r0,%#r0,%Q1"
- [(set_attr "type" "arith,load,store,arith")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (subreg:QI (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "in")) 0))]
- "!flag_pic"
- "or %0,%1,%#lo16(%2)")
-
-;; DImode move instructions
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, DImode, 0))
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,x")
- (const_int 0))]
- ""
- "@
- or %0,%#r0,0\;or %d0,%#r0,0
- mov %0,%#x0"
- [(set_attr "type" "marith,mov")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,x,x,x,m")
- (match_operand:DI 1 "nonimmediate_operand" "r,m,r,x,r,x,m,x"))]
- ""
- "@
- or %0,%#r0,%1\;or %d0,%#r0,%d1
- %V1ld.d\\t %0,%1
- %v0st.d\\t %1,%0
- mov.d %0,%1
- mov.d %0,%1
- mov %0,%1
- %V1ld.d\\t %0,%1
- %v0st.d\\t %1,%0"
- [(set_attr "type" "marith,loadd,store,mov,mov,mov,loadd,store")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (subreg:DI (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "in")) 0))]
- "!flag_pic"
- "or %0,%1,%#lo16(%2)")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:DI 1 "immediate_operand" "n"))]
- ""
- "* return output_load_const_dimode (operands);"
- [(set_attr "type" "marith")
- (set_attr "length" "4")]) ; length is 2, 3 or 4.
-
-;; DFmode move instructions
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, DFmode, 0))
- DONE;
-}")
-
-(define_split
- [(set (match_operand:DF 0 "register_operand" "=r")
- (match_operand:DF 1 "register_operand" "r"))]
- "reload_completed
- && GET_CODE (operands[0]) == REG && !XRF_REGNO_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && !XRF_REGNO_P (REGNO (operands[1]))"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))]
- "
-{ operands[2] = operand_subword (operands[0], 0, 0, DFmode);
- operands[3] = operand_subword (operands[1], 0, 0, DFmode);
- operands[4] = operand_subword (operands[0], 1, 0, DFmode);
- operands[5] = operand_subword (operands[1], 1, 0, DFmode); }")
-
-;; @@ This pattern is incomplete and doesn't appear necessary.
-;;
-;; This pattern forces (set (reg:DF ...) (const_double ...))
-;; to be reloaded by putting the constant into memory.
-;; It must come before the more general movdf pattern.
-
-;(define_insn ""
-; [(set (match_operand:DF 0 "general_operand" "=r,o")
-; (match_operand:DF 1 "" "G,G"))]
-; "GET_CODE (operands[1]) == CONST_DOUBLE"
-; "*
-;{
-; switch (which_alternative)
-; {
-; case 0:
-; return \"or %0,%#r0,0\;or %d0,%#r0,0\";
-; case 1:
-; operands[1] = adj_offsettable_operand (operands[0], 4);
-; return \"%v0st\\t %#r0,%0\;st %#r0,%1\";
-; }
-;}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (const_int 0))]
- ""
- "@
- or %0,%#r0,0\;or %d0,%#r0,0
- mov %0,%#x0"
- [(set_attr "type" "marith,mov")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,x,r,x,x,m")
- (match_operand:DF 1 "nonimmediate_operand" "r,m,r,r,x,x,m,x"))]
- ""
- "@
- or %0,%#r0,%1\;or %d0,%#r0,%d1
- %V1ld.d\\t %0,%1
- %v0st.d\\t %1,%0
- mov.d %0,%1
- mov.d %0,%1
- mov %0,%1
- %V1ld.d\\t %0,%1
- %v0st.d\\t %1,%0"
- [(set_attr "type" "marith,loadd,store,mov,mov,mov,loadd,store")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r")
- (subreg:DF (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "in")) 0))]
- "!flag_pic"
- "or %0,%1,%#lo16(%2)")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r")
- (match_operand:DF 1 "immediate_operand" "F"))]
- ""
- "* return output_load_const_double (operands);"
- [(set_attr "type" "marith")
- (set_attr "length" "4")]) ; length is 2, 3, or 4.
-
-;; SFmode move instructions
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, SFmode, 0))
- DONE;
-}")
-
-;; @@ What happens to fconst0_rtx?
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r,x")
- (const_int 0))]
- ""
- "@
- or %0,%#r0,0
- mov %0,%#x0"
- [(set_attr "type" "arith,mov")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,x,r,x,x,m")
- (match_operand:SF 1 "nonimmediate_operand" "r,m,r,r,x,x,m,x"))]
- ""
- "@
- or %0,%#r0,%1
- %V1ld\\t %0,%1
- %v0st\\t %r1,%0
- mov.s %0,%1
- mov.s %0,%1
- mov %0,%1
- %V1ld\\t %0,%1
- %v0st\\t %r1,%0"
- [(set_attr "type" "arith,load,store,mov,mov,mov,load,store")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r")
- (subreg:SF (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "in")) 0))]
- "!flag_pic"
- "or %0,%1,%#lo16(%2)")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r")
- (match_operand:SF 1 "immediate_operand" "F"))]
- "operands[1] != const0_rtx"
- "* return output_load_const_float (operands);"
- [(set_attr "type" "marith")]) ; length is 1 or 2.
-
-;; String/block move insn. See m88k.c for details.
-
-(define_expand "movstrsi"
- [(parallel [(set (mem:BLK (match_operand:BLK 0 "" ""))
- (mem:BLK (match_operand:BLK 1 "" "")))
- (use (match_operand:SI 2 "arith32_operand" ""))
- (use (match_operand:SI 3 "immediate_operand" ""))])]
- ""
- "
-{
- rtx dest_mem = operands[0];
- rtx src_mem = operands[1];
- operands[0] = copy_to_mode_reg (SImode, XEXP (operands[0], 0));
- operands[1] = copy_to_mode_reg (SImode, XEXP (operands[1], 0));
- expand_block_move (dest_mem, src_mem, operands);
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (match_operand:BLK 1 "memory_operand" "m"))]
- ""
- "%V1ld.bu\\t %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (match_operand:BLK 1 "memory_operand" "m"))]
- ""
- "%V1ld.hu\\t %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:BLK 1 "memory_operand" "m"))]
- ""
- "%V1ld\\t %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:BLK 1 "memory_operand" "m"))]
- ""
- "%V1ld.d\\t %0,%1"
- [(set_attr "type" "loadd")])
-
-(define_insn ""
- [(set (match_operand:BLK 0 "memory_operand" "=m")
- (match_operand:QI 1 "register_operand" "r"))]
- ""
- "%v0st.b\\t %1,%0"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(set (match_operand:BLK 0 "memory_operand" "=m")
- (match_operand:HI 1 "register_operand" "r"))]
- ""
- "%v0st.h\\t %1,%0"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(set (match_operand:BLK 0 "memory_operand" "=m")
- (match_operand:SI 1 "register_operand" "r"))]
- ""
- "%v0st\\t %1,%0"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(set (match_operand:BLK 0 "memory_operand" "=m")
- (match_operand:DI 1 "register_operand" "r"))]
- ""
- "%v0st.d\\t %1,%0"
- [(set_attr "type" "store")])
-
-;; Call a non-looping block move library function (e.g. __movstrSI96x64).
-;; operand 0 is the function name
-;; operand 1 is the destination pointer
-;; operand 2 is the source pointer
-;; operand 3 is the offset for the source and destination pointers
-;; operand 4 is the first value to be loaded
-;; operand 5 is the register to hold the value (r4 or r5)
-
-(define_expand "call_block_move"
- [(set (reg:SI 3) (minus:SI (match_operand:SI 2 "register_operand" "")
- (match_operand:SI 3 "immediate_operand" "")))
- (set (match_operand 5 "register_operand" "")
- (match_operand 4 "memory_operand" ""))
- (set (reg:SI 2) (minus:SI (match_operand:SI 1 "register_operand" "")
- (match_dup 3)))
- (use (reg:SI 2))
- (use (reg:SI 3))
- (use (match_dup 5))
- (parallel [(set (reg:DI 2)
- (call (mem:SI (match_operand 0 "" ""))
- (const_int 0)))
- (clobber (reg:SI 1))])]
- ""
- "")
-
-;; Call an SImode looping block move library function (e.g. __movstrSI64n68).
-;; operands 0-5 as in the non-looping interface
-;; operand 6 is the loop count
-
-(define_expand "call_movstrsi_loop"
- [(set (reg:SI 3) (minus:SI (match_operand:SI 2 "register_operand" "")
- (match_operand:SI 3 "immediate_operand" "")))
- (set (match_operand:SI 5 "register_operand" "")
- (match_operand 4 "memory_operand" ""))
- (set (reg:SI 2) (minus:SI (match_operand:SI 1 "register_operand" "")
- (match_dup 3)))
- (set (reg:SI 6) (match_operand:SI 6 "immediate_operand" ""))
- (use (reg:SI 2))
- (use (reg:SI 3))
- (use (match_dup 5))
- (use (reg:SI 6))
- (parallel [(set (reg:DI 2)
- (call (mem:SI (match_operand 0 "" ""))
- (const_int 0)))
- (clobber (reg:SI 1))])]
- ""
- "")
-
-;;- zero extension instructions
-
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == MEM
- && symbolic_address_p (XEXP (operands[1], 0)))
- operands[1]
- = legitimize_address (flag_pic, operands[1], 0, 0);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (zero_extend:SI (match_operand:HI 1 "move_operand" "!r,n,m")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- mask %0,%1,0xffff
- or %0,%#r0,%h1
- %V1ld.hu\\t %0,%1"
- [(set_attr "type" "arith,arith,load")])
-
-(define_expand "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == MEM
- && symbolic_address_p (XEXP (operands[1], 0)))
- operands[1]
- = legitimize_address (flag_pic, operands[1], 0, 0);
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,r,r")
- (zero_extend:HI (match_operand:QI 1 "move_operand" "r,n,m")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- mask %0,%1,0xff
- or %0,%#r0,%q1
- %V1ld.bu\\t %0,%1"
- [(set_attr "type" "arith,arith,load")])
-
-(define_expand "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == MEM
- && symbolic_address_p (XEXP (operands[1], 0)))
- {
- operands[1]
- = legitimize_address (flag_pic, operands[1], 0, 0);
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (ZERO_EXTEND, SImode, operands[1])));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (zero_extend:SI (match_operand:QI 1 "move_operand" "r,n,m")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- mask %0,%1,0xff
- or %0,%#r0,%q1
- %V1ld.bu\\t %0,%1"
- [(set_attr "type" "arith,arith,load")])
-
-;;- sign extension instructions
-
-(define_expand "extendsidi2"
- [(set (subreg:SI (match_operand:DI 0 "register_operand" "=r") 1)
- (match_operand:SI 1 "general_operand" "g"))
- (set (subreg:SI (match_dup 0) 0)
- (ashiftrt:SI (subreg:SI (match_dup 0) 1)
- (const_int 31)))]
- ""
- "")
-
-(define_expand "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == MEM
- && symbolic_address_p (XEXP (operands[1], 0)))
- operands[1]
- = legitimize_address (flag_pic, operands[1], 0, 0);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
- (sign_extend:SI (match_operand:HI 1 "move_operand" "!r,P,N,m")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- ext %0,%1,16<0>
- or %0,%#r0,%h1
- subu %0,%#r0,%H1
- %V1ld.h\\t %0,%1"
- [(set_attr "type" "bit,arith,arith,load")])
-
-(define_expand "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == MEM
- && symbolic_address_p (XEXP (operands[1], 0)))
- operands[1]
- = legitimize_address (flag_pic, operands[1], 0, 0);
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
- (sign_extend:HI (match_operand:QI 1 "move_operand" "!r,P,N,m")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- ext %0,%1,8<0>
- or %0,%#r0,%q1
- subu %0,%#r0,%Q1
- %V1ld.b\\t %0,%1"
- [(set_attr "type" "bit,arith,arith,load")])
-
-(define_expand "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == MEM
- && symbolic_address_p (XEXP (operands[1], 0)))
- operands[1]
- = legitimize_address (flag_pic, operands[1], 0, 0);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
- (sign_extend:SI (match_operand:QI 1 "move_operand" "!r,P,N,m")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- ext %0,%1,8<0>
- or %0,%#r0,%q1
- subu %0,%#r0,%Q1
- %V1ld.b\\t %0,%1"
- [(set_attr "type" "bit,arith,arith,load")])
-
-;; Conversions between float and double.
-
-;; The fadd instruction does not conform to IEEE 754 when used to
-;; convert between float and double. In particular, the sign of -0 is
-;; not preserved. Interestingly, fsub does conform.
-
-(define_expand "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (float_extend:DF (match_operand:SF 1 "register_operand" "r")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r")
- (float_extend:DF (match_operand:SF 1 "register_operand" "r")))]
- "! TARGET_88110"
- "fsub.dss %0,%1,%#r0"
- [(set_attr "type" "spadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (float_extend:DF (match_operand:SF 1 "register_operand" "r,x")))]
- "TARGET_88110"
- "fcvt.ds %0,%1"
- [(set_attr "type" "spadd")])
-
-(define_expand "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (float_truncate:SF (match_operand:DF 1 "register_operand" "r")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r")
- (float_truncate:SF (match_operand:DF 1 "register_operand" "r")))]
- "! TARGET_88110"
- "fsub.sds %0,%1,%#r0"
- [(set_attr "type" "dpadd")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r,x")
- (float_truncate:SF (match_operand:DF 1 "register_operand" "r,x")))]
- "TARGET_88110"
- "fcvt.sd %0,%1"
- [(set_attr "type" "dpadd")])
-
-;; Conversions between floating point and integer
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (float:DF (match_operand:SI 1 "register_operand" "r,r")))]
- ""
- "flt.ds %0,%1"
- [(set_attr "type" "spadd,dpadd")])
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "=r,x")
- (float:SF (match_operand:SI 1 "register_operand" "r,r")))]
- ""
- "flt.ss %0,%1"
- [(set_attr "type" "spadd,spadd")])
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (fix:SI (match_operand:DF 1 "register_operand" "r,x")))]
- ""
- "trnc.sd %0,%1"
- [(set_attr "type" "dpadd,dpadd")])
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (fix:SI (match_operand:SF 1 "register_operand" "r,x")))]
- ""
- "trnc.ss %0,%1"
- [(set_attr "type" "spadd,dpadd")])
-
-
-;;- arithmetic instructions
-;;- add instructions
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (plus:SI (match_operand:SI 1 "add_operand" "%r,r")
- (match_operand:SI 2 "add_operand" "rI,J")))]
- ""
- "@
- addu %0,%1,%2
- subu %0,%1,%n2")
-
-;; patterns for mixed mode floating point.
-;; Do not define patterns that utilize mixed mode arithmetic that result
-;; in narrowing the precision, because it loses accuracy, since the standard
-;; requires double rounding, whereas the 88000 instruction only rounds once.
-
-(define_expand "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (plus:DF (match_operand:DF 1 "general_operand" "%r,x")
- (match_operand:DF 2 "general_operand" "r,x")))]
- ""
- "
-{
- operands[1] = legitimize_operand (operands[1], DFmode);
- operands[2] = legitimize_operand (operands[2], DFmode);
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (plus:DF (float_extend:DF (match_operand:SF 1 "register_operand" "r,x"))
- (float_extend:DF (match_operand:SF 2 "register_operand" "r,x"))))]
- ""
- "fadd.dss %0,%1,%2"
- [(set_attr "type" "spadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (plus:DF (match_operand:DF 1 "register_operand" "r,x")
- (float_extend:DF (match_operand:SF 2 "register_operand" "r,x"))))]
- ""
- "fadd.dds %0,%1,%2"
- [(set_attr "type" "dpadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (plus:DF (float_extend:DF (match_operand:SF 1 "register_operand" "r,x"))
- (match_operand:DF 2 "register_operand" "r,x")))]
- ""
- "fadd.dsd %0,%1,%2"
- [(set_attr "type" "dpadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (plus:DF (match_operand:DF 1 "register_operand" "%r,x")
- (match_operand:DF 2 "register_operand" "r,x")))]
- ""
- "fadd.ddd %0,%1,%2"
- [(set_attr "type" "dpadd")])
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=r,x")
- (plus:SF (match_operand:SF 1 "register_operand" "%r,x")
- (match_operand:SF 2 "register_operand" "r,x")))]
- ""
- "fadd.sss %0,%1,%2"
- [(set_attr "type" "spadd")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_operand:DI 1 "register_operand" "r")
- (zero_extend:DI
- (match_operand:SI 2 "register_operand" "r"))))
- (clobber (reg:CC 0))]
- ""
- "addu.co %d0,%d1,%2\;addu.ci %0,%1,%#r0"
- [(set_attr "type" "marith")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (zero_extend:DI
- (match_operand:SI 1 "register_operand" "r"))
- (match_operand:DI 2 "register_operand" "r")))
- (clobber (reg:CC 0))]
- ""
- "addu.co %d0,%1,%d2\;addu.ci %0,%#r0,%2"
- [(set_attr "type" "marith")])
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_operand:DI 1 "register_operand" "%r")
- (match_operand:DI 2 "register_operand" "r")))
- (clobber (reg:CC 0))]
- ""
- "addu.co %d0,%d1,%d2\;addu.ci %0,%1,%2"
- [(set_attr "type" "marith")])
-
-;; Add with carry insns.
-
-(define_insn ""
- [(parallel [(set (match_operand:SI 0 "reg_or_0_operand" "=r")
- (plus:SI (match_operand:SI 1 "reg_or_0_operand" "rO")
- (match_operand:SI 2 "reg_or_0_operand" "rO")))
- (set (reg:CC 0)
- (unspec:CC [(match_dup 1) (match_dup 2)] 0))])]
- ""
- "addu.co %r0,%r1,%r2")
-
-(define_insn ""
- [(set (reg:CC 0) (unspec:CC [(match_operand:SI 0 "reg_or_0_operand" "rO")
- (match_operand:SI 1 "reg_or_0_operand" "rO")]
- 0))]
- ""
- "addu.co %#r0,%r0,%r1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "reg_or_0_operand" "=r")
- (plus:SI (match_operand:SI 1 "reg_or_0_operand" "rO")
- (unspec:SI [(match_operand:SI 2 "reg_or_0_operand" "rO")
- (reg:CC 0)] 0)))]
- ""
- "addu.ci %r0,%r1,%r2")
-
-;;- subtract instructions
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith32_operand" "rI")))]
- ""
- "subu %0,%1,%2")
-
-;; patterns for mixed mode floating point
-;; Do not define patterns that utilize mixed mode arithmetic that result
-;; in narrowing the precision, because it loses accuracy, since the standard
-;; requires double rounding, whereas the 88000 instruction only rounds once.
-
-(define_expand "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (minus:DF (match_operand:DF 1 "general_operand" "r,x")
- (match_operand:DF 2 "general_operand" "r,x")))]
- ""
- "
-{
- operands[1] = legitimize_operand (operands[1], DFmode);
- operands[2] = legitimize_operand (operands[2], DFmode);
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (minus:DF (float_extend:DF (match_operand:SF 1 "register_operand" "r,x"))
- (float_extend:DF (match_operand:SF 2 "register_operand" "r,x"))))]
- ""
- "fsub.dss %0,%1,%2"
- [(set_attr "type" "spadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (minus:DF (match_operand:DF 1 "register_operand" "r,x")
- (float_extend:DF (match_operand:SF 2 "register_operand" "r,x"))))]
- ""
- "fsub.dds %0,%1,%2"
- [(set_attr "type" "dpadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (minus:DF (float_extend:DF (match_operand:SF 1 "register_operand" "r,x"))
- (match_operand:DF 2 "register_operand" "r,x")))]
- ""
- "fsub.dsd %0,%1,%2"
- [(set_attr "type" "dpadd")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (minus:DF (match_operand:DF 1 "register_operand" "r,x")
- (match_operand:DF 2 "register_operand" "r,x")))]
- ""
- "fsub.ddd %0,%1,%2"
- [(set_attr "type" "dpadd")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=r,x")
- (minus:SF (match_operand:SF 1 "register_operand" "r,x")
- (match_operand:SF 2 "register_operand" "r,x")))]
- ""
- "fsub.sss %0,%1,%2"
- [(set_attr "type" "spadd")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "register_operand" "r")
- (zero_extend:DI
- (match_operand:SI 2 "register_operand" "r"))))
- (clobber (reg:CC 0))]
- ""
- "subu.co %d0,%d1,%2\;subu.ci %0,%1,%#r0"
- [(set_attr "type" "marith")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (zero_extend:DI
- (match_operand:SI 1 "register_operand" "r"))
- (match_operand:DI 2 "register_operand" "r")))
- (clobber (reg:CC 0))]
- ""
- "subu.co %d0,%1,%d2\;subu.ci %0,%#r0,%2"
- [(set_attr "type" "marith")])
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "register_operand" "r")))
- (clobber (reg:CC 0))]
- ""
- "subu.co %d0,%d1,%d2\;subu.ci %0,%1,%2"
- [(set_attr "type" "marith")])
-
-;; Subtract with carry insns.
-
-(define_insn ""
- [(parallel [(set (match_operand:SI 0 "reg_or_0_operand" "=r")
- (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rO")
- (match_operand:SI 2 "reg_or_0_operand" "rO")))
- (set (reg:CC 0)
- (unspec:CC [(match_dup 1) (match_dup 2)] 1))])]
- ""
- "subu.co %r0,%r1,%r2")
-
-(define_insn ""
- [(set (reg:CC 0) (unspec:CC [(match_operand:SI 0 "reg_or_0_operand" "rO")
- (match_operand:SI 1 "reg_or_0_operand" "rO")]
- 1))]
- ""
- "subu.co %#r0,%r0,%r1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "reg_or_0_operand" "=r")
- (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rO")
- (unspec:SI [(match_operand:SI 2 "reg_or_0_operand" "rO")
- (reg:CC 0)] 1)))]
- ""
- "subu.ci %r0,%r1,%r2")
-
-;;- multiply instructions
-;;
-;; There is an unfounded silicon errata for E.1 requiring that an
-;; immediate constant value in div/divu/mul instructions be less than
-;; 0x800. This is no longer provided for.
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mult:SI (match_operand:SI 1 "arith32_operand" "%r")
- (match_operand:SI 2 "arith32_operand" "rI")))]
- ""
- "mul %0,%1,%2"
- [(set_attr "type" "imul")])
-
-(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%r"))
- (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
- "TARGET_88110"
- "mulu.d %0,%1,%2"
- [(set_attr "type" "imul")])
-
-;; patterns for mixed mode floating point
-;; Do not define patterns that utilize mixed mode arithmetic that result
-;; in narrowing the precision, because it loses accuracy, since the standard
-;; requires double rounding, whereas the 88000 instruction only rounds once.
-
-(define_expand "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (mult:DF (match_operand:DF 1 "general_operand" "%r,x")
- (match_operand:DF 2 "general_operand" "r,x")))]
- ""
- "
-{
- operands[1] = legitimize_operand (operands[1], DFmode);
- operands[2] = legitimize_operand (operands[2], DFmode);
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (mult:DF (float_extend:DF (match_operand:SF 1 "register_operand" "r,x"))
- (float_extend:DF (match_operand:SF 2 "register_operand" "r,x"))))]
- ""
- "fmul.dss %0,%1,%2"
- [(set_attr "type" "spmul")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (mult:DF (match_operand:DF 1 "register_operand" "r,x")
- (float_extend:DF (match_operand:SF 2 "register_operand" "r,x"))))]
- ""
- "fmul.dds %0,%1,%2"
- [(set_attr "type" "spmul")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (mult:DF (float_extend:DF (match_operand:SF 1 "register_operand" "r,x"))
- (match_operand:DF 2 "register_operand" "r,x")))]
- ""
- "fmul.dsd %0,%1,%2"
- [(set_attr "type" "spmul")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (mult:DF (match_operand:DF 1 "register_operand" "%r,x")
- (match_operand:DF 2 "register_operand" "r,x")))]
- ""
- "fmul.ddd %0,%1,%2"
- [(set_attr "type" "dpmul")])
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=r,x")
- (mult:SF (match_operand:SF 1 "register_operand" "%r,x")
- (match_operand:SF 2 "register_operand" "r,x")))]
- ""
- "fmul.sss %0,%1,%2"
- [(set_attr "type" "spmul")])
-
-;;- divide instructions
-;;
-;; The 88k div and divu instructions don't reliably trap on
-;; divide-by-zero. A trap to vector 503 asserts divide-by-zero. The
-;; general scheme for doing divide is to do a 4-way split based on the
-;; sign of the two operand and do the appropriate negates.
-;;
-;; The conditional trap instruction is not used as this serializes the
-;; processor. Instead a conditional branch and an unconditional trap
-;; are used, but after the divu. Since the divu takes up to 38 cycles,
-;; the conditional branch is essentially free.
-;;
-;; Two target options control how divide is done. One options selects
-;; whether to do the branch and negate scheme instead of using the div
-;; instruction; the other option selects whether to explicitly check
-;; for divide-by-zero or take your chances. If the div instruction is
-;; used, the O/S must complete the operation if the operands are
-;; negative. The O/S will signal an overflow condition if the most
-;; negative number (-2147483648) is divided by negative 1.
-;;
-;; There is an unfounded silicon errata for E.1 requiring that an
-;; immediate constant value in div/divu/mul instructions be less than
-;; 0x800. This is no longer provided for.
-
-;; Division by 0 trap
-(define_insn "trap_divide_by_zero"
- [(trap_if (const_int 1) 503)]
- ""
- "tb0 0,%#r0,503"
- [(set_attr "type" "weird")])
-
-;; Conditional division by 0 trap.
-(define_expand "tcnd_divide_by_zero"
- [(set (pc)
- (if_then_else (eq (match_operand:SI 0 "register_operand" "")
- (const_int 0))
- (pc)
- (match_operand 1 "" "")))
- (trap_if (const_int 1) 503)]
- ""
- "
-{
- emit_insn (gen_cmpsi (operands[0], const0_rtx));
- emit_jump_insn (gen_bne (operands[1]));
- emit_insn (gen_trap_divide_by_zero ());
- DONE;
-}")
-
-(define_expand "divsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (div:SI (match_operand:SI 1 "arith32_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- rtx op0 = operands[0];
- rtx op1 = operands[1];
- rtx op2 = operands[2];
- rtx join_label;
-
- /* @@ This needs to be reworked. Torbjorn Granlund has suggested making
- it a runtime (perhaps quite special). */
-
- if (GET_CODE (op1) == CONST_INT)
- op1 = force_reg (SImode, op1);
-
- else if (GET_CODE (op2) == CONST_INT
- && ! SMALL_INT (operands[2]))
- op2 = force_reg (SImode, op2);
-
- if (op2 == const0_rtx)
- {
- emit_insn (gen_trap_divide_by_zero ());
- emit_insn (gen_dummy (op0));
- DONE;
- }
-
- if (TARGET_USE_DIV)
- {
- emit_move_insn (op0, gen_rtx (DIV, SImode, op1, op2));
- if (TARGET_CHECK_ZERO_DIV && GET_CODE (op2) != CONST_INT)
- {
- rtx label = gen_label_rtx ();
- emit_insn (gen_tcnd_divide_by_zero (op2, label));
- emit_label (label);
- emit_insn (gen_dummy (op0));
- }
- DONE;
- }
-
- join_label = gen_label_rtx ();
- if (GET_CODE (op1) == CONST_INT)
- {
- int neg = FALSE;
- rtx neg_op2 = gen_reg_rtx (SImode);
- rtx label1 = gen_label_rtx ();
-
- if (INTVAL (op1) < 0)
- {
- neg = TRUE;
- op1 = gen_rtx (CONST_INT, VOIDmode, -INTVAL (op1));
- }
- op1 = force_reg (SImode, op1);
-
- emit_insn (gen_negsi2 (neg_op2, op2));
- emit_insn (gen_cmpsi (op2, const0_rtx));
- emit_jump_insn (gen_bgt (label1));
- /* constant / 0-or-negative */
- emit_move_insn (op0, gen_rtx (UDIV, SImode, op1, neg_op2));
- if (!neg)
- emit_insn (gen_negsi2 (op0, op0));
-
- if (TARGET_CHECK_ZERO_DIV)
- emit_insn (gen_tcnd_divide_by_zero (op2, join_label));
- emit_jump_insn (gen_jump (join_label));
- emit_barrier ();
-
- emit_label (label1); /* constant / positive */
- emit_move_insn (op0, gen_rtx (UDIV, SImode, op1, op2));
- if (neg)
- emit_insn (gen_negsi2 (op0, op0));
- }
-
- else if (GET_CODE (op2) == CONST_INT)
- {
- int neg = FALSE;
- rtx neg_op1 = gen_reg_rtx (SImode);
- rtx label1 = gen_label_rtx ();
-
- if (INTVAL (op2) < 0)
- {
- neg = TRUE;
- op2 = gen_rtx (CONST_INT, VOIDmode, -INTVAL (op2));
- }
- else if (! SMALL_INT (operands[2]))
- op2 = force_reg (SImode, op2);
-
- emit_insn (gen_negsi2 (neg_op1, op1));
- emit_insn (gen_cmpsi (op1, const0_rtx));
- emit_jump_insn (gen_bge (label1));
- /* 0-or-negative / constant */
- emit_move_insn (op0, gen_rtx (UDIV, SImode, neg_op1, op2));
- if (!neg)
- emit_insn (gen_negsi2 (op0, op0));
-
- emit_jump_insn (gen_jump (join_label));
- emit_barrier ();
-
- emit_label (label1); /* positive / constant */
- emit_move_insn (op0, gen_rtx (UDIV, SImode, op1, op2));
- if (neg)
- emit_insn (gen_negsi2 (op0, op0));
- }
-
- else
- {
- rtx neg_op1 = gen_reg_rtx (SImode);
- rtx neg_op2 = gen_reg_rtx (SImode);
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
- rtx label3 = gen_label_rtx ();
- rtx label4;
-
- emit_insn (gen_negsi2 (neg_op2, op2));
- emit_insn (gen_cmpsi (op2, const0_rtx));
- emit_jump_insn (gen_bgt (label1));
-
- emit_insn (gen_negsi2 (neg_op1, op1));
- emit_insn (gen_cmpsi (op1, const0_rtx));
- emit_jump_insn (gen_bge (label2));
- /* negative / negative-or-0 */
- emit_move_insn (op0, gen_rtx (UDIV, SImode, neg_op1, neg_op2));
-
- if (TARGET_CHECK_ZERO_DIV)
- {
- label4 = gen_label_rtx ();
- emit_insn (gen_cmpsi (op2, const0_rtx));
- emit_jump_insn (gen_bne (join_label));
- emit_label (label4);
- emit_insn (gen_trap_divide_by_zero ());
- }
- emit_jump_insn (gen_jump (join_label));
- emit_barrier ();
-
- emit_label (label2); /* pos.-or-0 / neg.-or-0 */
- emit_move_insn (op0, gen_rtx (UDIV, SImode, op1, neg_op2));
-
- if (TARGET_CHECK_ZERO_DIV)
- {
- emit_insn (gen_cmpsi (op2, const0_rtx));
- emit_jump_insn (gen_beq (label4));
- }
-
- emit_insn (gen_negsi2 (op0, op0));
- emit_jump_insn (gen_jump (join_label));
- emit_barrier ();
-
- emit_label (label1);
- emit_insn (gen_negsi2 (neg_op1, op1));
- emit_insn (gen_cmpsi (op1, const0_rtx));
- emit_jump_insn (gen_bge (label3));
- /* negative / positive */
- emit_move_insn (op0, gen_rtx (UDIV, SImode, neg_op1, op2));
- emit_insn (gen_negsi2 (op0, op0));
- emit_jump_insn (gen_jump (join_label));
- emit_barrier ();
-
- emit_label (label3); /* positive-or-0 / positive */
- emit_move_insn (op0, gen_rtx (UDIV, SImode, op1, op2));
- }
-
- emit_label (join_label);
-
- emit_insn (gen_dummy (op0));
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (div:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "div %0,%1,%2"
- [(set_attr "type" "idiv")])
-
-(define_expand "udivsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (udiv:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- rtx op2 = operands[2];
-
- if (op2 == const0_rtx)
- {
- emit_insn (gen_trap_divide_by_zero ());
- emit_insn (gen_dummy (operands[0]));
- DONE;
- }
- else if (GET_CODE (op2) != CONST_INT && TARGET_CHECK_ZERO_DIV)
- {
- rtx label = gen_label_rtx ();
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (UDIV, SImode, operands[1], op2)));
- emit_insn (gen_tcnd_divide_by_zero (op2, label));
- emit_label (label);
- emit_insn (gen_dummy (operands[0]));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (udiv:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith32_operand" "rI")))]
- "operands[2] != const0_rtx"
- "divu %0,%1,%2"
- [(set_attr "type" "idiv")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (udiv:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0)))]
- ""
- "tb0 0,%#r0,503"
- [(set_attr "type" "weird")])
-
-;; patterns for mixed mode floating point.
-;; Do not define patterns that utilize mixed mode arithmetic that result
-;; in narrowing the precision, because it loses accuracy, since the standard
-;; requires double rounding, whereas the 88000 instruction only rounds once.
-
-(define_expand "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (div:DF (match_operand:DF 1 "general_operand" "r,x")
- (match_operand:DF 2 "general_operand" "r,x")))]
- ""
- "
-{
- operands[1] = legitimize_operand (operands[1], DFmode);
- if (real_power_of_2_operand (operands[2]))
- {
- union real_extract u;
- bcopy (&CONST_DOUBLE_LOW (operands[2]), &u, sizeof u);
- emit_insn (gen_muldf3 (operands[0], operands[1],
- CONST_DOUBLE_FROM_REAL_VALUE (1.0/u.d, DFmode)));
- DONE;
- }
- else if (! register_operand (operands[2], DFmode))
- operands[2] = force_reg (DFmode, operands[2]);
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (div:DF (float_extend:DF (match_operand:SF 1 "register_operand" "r,x"))
- (float_extend:DF (match_operand:SF 2 "register_operand" "r,x"))))]
- ""
- "fdiv.dss %0,%1,%2"
- [(set_attr "type" "dpdiv")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (div:DF (match_operand:DF 1 "register_operand" "r,x")
- (float_extend:DF (match_operand:SF 2 "register_operand" "r,x"))))]
- ""
- "fdiv.dds %0,%1,%2"
- [(set_attr "type" "dpdiv")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (div:DF (float_extend:DF (match_operand:SF 1 "register_operand" "r,x"))
- (match_operand:DF 2 "register_operand" "r,x")))]
- ""
- "fdiv.dsd %0,%1,%2"
- [(set_attr "type" "dpdiv")])
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=r,x")
- (div:SF (match_operand:SF 1 "register_operand" "r,x")
- (match_operand:SF 2 "register_operand" "r,x")))]
- ""
- "fdiv.sss %0,%1,%2"
- [(set_attr "type" "spdiv")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r,x")
- (div:DF (match_operand:DF 1 "register_operand" "r,x")
- (match_operand:DF 2 "register_operand" "r,x")))]
- ""
- "fdiv.ddd %0,%1,%2"
- [(set_attr "type" "dpdiv")])
-
-;; - remainder instructions, don't define, since the hardware doesn't have any
-;; direct support, and GNU can synthesis them out of div/mul just fine.
-
-;;- load effective address, must come after add, so that we favor using
-;; addu reg,reg,reg instead of: lda reg,reg,reg (addu doesn't require
-;; the data unit), and also future 88k chips might not support unscaled
-;; lda instructions.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "address_operand" "p"))]
- "m88k_gp_threshold > 0 && symbolic_address_p (operands[1])"
- "addu %0,%a1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:HI 1 "address_operand" "p"))]
- ""
- "lda.h %0,%a1"
- [(set_attr "type" "loada")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "address_operand" "p"))]
- ""
- "lda %0,%a1"
- [(set_attr "type" "loada")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:DI 1 "address_operand" "p"))]
- ""
- "lda.d %0,%a1"
- [(set_attr "type" "loada")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SF 1 "address_operand" "p"))]
- ""
- "lda %0,%a1"
- [(set_attr "type" "loada")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:DF 1 "address_operand" "p"))]
- ""
- "lda.d %0,%a1"
- [(set_attr "type" "loada")])
-
-;;- and instructions (with complement also)
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "and.c %0,%2,%1")
-
-;; If the operation is being performed on a 32-bit constant such that
-;; it cannot be done in one insn, do it in two. We may lose a bit on
-;; CSE in pathological cases, but it seems better doing it this way.
-
-(define_expand "andsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (and:SI (match_operand:SI 1 "arith32_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int value = INTVAL (operands[2]);
-
- if (! (SMALL_INTVAL (value)
- || (value & 0xffff0000) == 0xffff0000
- || (value & 0xffff) == 0xffff
- || (value & 0xffff) == 0
- || integer_ok_for_set (~value)))
- {
- emit_insn (gen_andsi3 (operands[0], operands[1],
- gen_rtx (CONST_INT, VOIDmode,
- value | 0xffff)));
- operands[1] = operands[0];
- operands[2] = gen_rtx (CONST_INT, VOIDmode, value | 0xffff0000);
- }
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (and:SI (match_operand:SI 1 "arith32_operand" "%r,r")
- (match_operand:SI 2 "arith32_operand" "rIJL,rn")))]
- ""
- "* return output_and (operands);"
- [(set_attr "type" "arith,marith")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
- (match_operand:DI 2 "register_operand" "r")))]
- ""
- "and.c %d0,%d2,%d1\;and.c %0,%2,%1"
- [(set_attr "type" "marith")])
-
-(define_insn "anddi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (match_operand:DI 1 "arith64_operand" "%r")
- (match_operand:DI 2 "arith64_operand" "rn")))]
- ""
- "*
-{
- rtx xoperands[10];
-
- xoperands[0] = operand_subword (operands[0], 1, 0, DImode);
- xoperands[1] = operand_subword (operands[1], 1, 0, DImode);
- xoperands[2] = operand_subword (operands[2], 1, 0, DImode);
-
- output_asm_insn (output_and (xoperands), xoperands);
-
- operands[0] = operand_subword (operands[0], 0, 0, DImode);
- operands[1] = operand_subword (operands[1], 0, 0, DImode);
- operands[2] = operand_subword (operands[2], 0, 0, DImode);
-
- return output_and (operands);
-}"
- [(set_attr "type" "marith")
- (set_attr "length" "4")]) ; length is 2, 3, or 4.
-
-;;- Bit set (inclusive or) instructions (with complement also)
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "or.c %0,%2,%1")
-
-(define_expand "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ior:SI (match_operand:SI 1 "arith32_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int value = INTVAL (operands[2]);
-
- if (! (SMALL_INTVAL (value)
- || (value & 0xffff) == 0
- || integer_ok_for_set (value)))
- {
- emit_insn (gen_iorsi3 (operands[0], operands[1],
- gen_rtx (CONST_INT, VOIDmode,
- value & 0xffff0000)));
- operands[1] = operands[0];
- operands[2] = gen_rtx (CONST_INT, VOIDmode, value & 0xffff);
- }
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
- (ior:SI (match_operand:SI 1 "arith32_operand" "%r,r,r,r")
- (match_operand:SI 2 "arith32_operand" "rI,L,M,n")))]
- ""
- "@
- or %0,%1,%2
- or.u %0,%1,%X2
- set %0,%1,%s2
- or.u %0,%1,%X2\;or %0,%0,%x2"
- [(set_attr "type" "arith,arith,bit,marith")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ior:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
- (match_operand:DI 2 "register_operand" "r")))]
- ""
- "or.c %d0,%d2,%d1\;or.c %0,%2,%1"
- [(set_attr "type" "marith")])
-
-(define_insn "iordi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ior:DI (match_operand:DI 1 "arith64_operand" "%r")
- (match_operand:DI 2 "arith64_operand" "rn")))]
- ""
- "*
-{
- rtx xoperands[10];
-
- xoperands[0] = operand_subword (operands[0], 1, 0, DImode);
- xoperands[1] = operand_subword (operands[1], 1, 0, DImode);
- xoperands[2] = operand_subword (operands[2], 1, 0, DImode);
-
- output_asm_insn (output_ior (xoperands), xoperands);
-
- operands[0] = operand_subword (operands[0], 0, 0, DImode);
- operands[1] = operand_subword (operands[1], 0, 0, DImode);
- operands[2] = operand_subword (operands[2], 0, 0, DImode);
-
- return output_ior (operands);
-}"
- [(set_attr "type" "marith")
- (set_attr "length" "4")]) ; length is 2, 3, or 4.
-
-;;- xor instructions (with complement also)
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (xor:SI (match_operand:SI 1 "register_operand" "%r")
- (match_operand:SI 2 "register_operand" "r"))))]
- ""
- "xor.c %0,%1,%2")
-
-(define_expand "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (xor:SI (match_operand:SI 1 "arith32_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int value = INTVAL (operands[2]);
-
- if (! (SMALL_INTVAL (value)
- || (value & 0xffff) == 0))
- {
- emit_insn (gen_xorsi3 (operands[0], operands[1],
- gen_rtx (CONST_INT, VOIDmode,
- value & 0xffff0000)));
- operands[1] = operands[0];
- operands[2] = gen_rtx (CONST_INT, VOIDmode, value & 0xffff);
- }
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (xor:SI (match_operand:SI 1 "arith32_operand" "%r,r,r")
- (match_operand:SI 2 "arith32_operand" "rI,L,n")))]
- ""
- "@
- xor %0,%1,%2
- xor.u %0,%1,%X2
- xor.u %0,%1,%X2\;xor %0,%0,%x2"
- [(set_attr "type" "arith,arith,marith")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (xor:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "register_operand" "r"))))]
- ""
- "xor.c %d0,%d1,%d2\;xor.c %0,%1,%2"
- [(set_attr "type" "marith")])
-
-(define_insn "xordi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (xor:DI (match_operand:DI 1 "arith64_operand" "%r")
- (match_operand:DI 2 "arith64_operand" "rn")))]
- ""
- "*
-{
- rtx xoperands[10];
-
- xoperands[0] = operand_subword (operands[0], 1, 0, DImode);
- xoperands[1] = operand_subword (operands[1], 1, 0, DImode);
- xoperands[2] = operand_subword (operands[2], 1, 0, DImode);
-
- output_asm_insn (output_xor (xoperands), xoperands);
-
- operands[0] = operand_subword (operands[0], 0, 0, DImode);
- operands[1] = operand_subword (operands[1], 0, 0, DImode);
- operands[2] = operand_subword (operands[2], 0, 0, DImode);
-
- return output_xor (operands);
-}"
- [(set_attr "type" "marith")
- (set_attr "length" "4")]) ; length is 2, 3, or 4.
-
-;;- ones complement instructions
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "xor.c %0,%1,%#r0")
-
-(define_insn "one_cmpldi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (match_operand:DI 1 "register_operand" "r")))]
- ""
- "xor.c %d0,%d1,%#r0\;xor.c %0,%1,%#r0"
- [(set_attr "type" "marith")])
-
-;; Optimized special cases of shifting.
-;; Must precede the general case.
-
-;; @@ What about HImode shifted by 8?
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 24)))]
- "! SCALED_ADDRESS_P (XEXP (operands[1], 0))"
- "%V1ld.b\\t %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 24)))]
- "! SCALED_ADDRESS_P (XEXP (operands[1], 0))"
- "%V1ld.bu\\t %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 16)))]
- "! SCALED_ADDRESS_P (XEXP (operands[1], 0))"
- "%V1ld.h\\t %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 16)))]
- "! SCALED_ADDRESS_P (XEXP (operands[1], 0))"
- "%V1ld.hu\\t %0,%1"
- [(set_attr "type" "load")])
-
-;;- arithmetic shift instructions.
-
-;; @@ Do the optimized patterns with -1 get used? Perhaps operand 1 should
-;; be arith32_operand?
-
-;; Use tbnd to support TARGET_TRAP_LARGE_SHIFT.
-(define_insn "tbnd"
- [(trap_if (gtu (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "arith_operand" "rI"))
- 7)]
- ""
- "tbnd %r0,%1"
- [(set_attr "type" "weird")])
-
-;; Just in case the optimizer decides to fold away the test.
-(define_insn ""
- [(trap_if (const_int 1) 7)]
- ""
- "tbnd %#r31,0"
- [(set_attr "type" "weird")])
-
-(define_expand "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashift:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if ((unsigned) INTVAL (operands[2]) > 31)
- {
- if (TARGET_TRAP_LARGE_SHIFT)
- emit_insn (gen_tbnd (force_reg (SImode, operands[2]),
- gen_rtx (CONST_INT, VOIDmode, 31)));
- else
- emit_move_insn (operands[0], const0_rtx);
- DONE;
- }
- }
-
- else if (TARGET_TRAP_LARGE_SHIFT)
- emit_insn (gen_tbnd (operands[2], gen_rtx (CONST_INT, VOIDmode, 31)));
-
- else if (TARGET_HANDLE_LARGE_SHIFT)
- {
- rtx reg = gen_reg_rtx (SImode);
- emit_insn (gen_cmpsi (operands[2], gen_rtx (CONST_INT, VOIDmode, 31)));
- emit_insn (gen_sleu (reg));
- emit_insn (gen_andsi3 (reg, operands[1], reg));
- operands[1] = reg;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (ashift:SI (match_operand:SI 1 "register_operand" "r,r")
- (match_operand:SI 2 "arith5_operand" "r,K")))]
- ""
- "@
- mak %0,%1,%2
- mak %0,%1,0<%2>"
- [(set_attr "type" "bit")])
-
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if ((unsigned) INTVAL (operands[2]) > 31)
- {
- if (TARGET_TRAP_LARGE_SHIFT)
- {
- emit_insn (gen_tbnd (force_reg (SImode, operands[2]),
- gen_rtx (CONST_INT, VOIDmode, 31)));
- DONE;
- }
- else
- operands[2] = gen_rtx (CONST_INT, VOIDmode, 31);
- }
- }
-
- else if (TARGET_TRAP_LARGE_SHIFT)
- emit_insn (gen_tbnd (operands[2], gen_rtx (CONST_INT, VOIDmode, 31)));
-
- else if (TARGET_HANDLE_LARGE_SHIFT)
- {
- rtx reg = gen_reg_rtx (SImode);
- emit_insn (gen_cmpsi (operands[2], gen_rtx (CONST_INT, VOIDmode, 31)));
- emit_insn (gen_sgtu (reg));
- emit_insn (gen_iorsi3 (reg, operands[2], reg));
- operands[2] = reg;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
- (match_operand:SI 2 "arith5_operand" "r,K")))]
- ""
- "@
- ext %0,%1,%2
- ext %0,%1,0<%2>"
- [(set_attr "type" "bit")])
-
-;;- logical shift instructions. Logical shift left becomes arithmetic
-;; shift left.
-
-(define_expand "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if ((unsigned) INTVAL (operands[2]) > 31)
- {
- if (TARGET_TRAP_LARGE_SHIFT)
- emit_insn (gen_tbnd (force_reg (SImode, operands[2]),
- gen_rtx (CONST_INT, VOIDmode, 31)));
- else
- emit_move_insn (operands[0], const0_rtx);
- DONE;
- }
- }
-
- else if (TARGET_TRAP_LARGE_SHIFT)
- emit_insn (gen_tbnd (operands[2], gen_rtx (CONST_INT, VOIDmode, 31)));
-
- else if (TARGET_HANDLE_LARGE_SHIFT)
- {
- rtx reg = gen_reg_rtx (SImode);
- emit_insn (gen_cmpsi (operands[2], gen_rtx (CONST_INT, VOIDmode, 31)));
- emit_insn (gen_sleu (reg));
- emit_insn (gen_andsi3 (reg, operands[1], reg));
- operands[1] = reg;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
- (match_operand:SI 2 "arith5_operand" "r,K")))]
- ""
- "@
- extu %0,%1,%2
- extu %0,%1,0<%2>"
- [(set_attr "type" "bit")])
-
-;;- rotate instructions
-
-(define_expand "rotlsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (rotatert:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) INTVAL (operands[2]) >= 32)
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- (32 - INTVAL (operands[2])) % 32);
- else
- {
- rtx op = gen_reg_rtx (SImode);
- emit_insn (gen_negsi2 (op, operands[2]));
- operands[2] = op;
- }
-}")
-
-(define_insn "rotrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (rotatert:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "rot %0,%1,%2"
- [(set_attr "type" "bit")])
-
-;; find first set.
-
-;; The ff1 instruction searches from the most significant bit while ffs
-;; searches from the least significant bit. The bit index and treatment of
-;; zero also differ. This amazing sequence was discovered using the GNU
-;; Superoptimizer.
-
-(define_insn "ffssi2"
- [(set (match_operand:SI 0 "register_operand" "=r,&r")
- (ffs:SI (match_operand:SI 1 "register_operand" "0,r")))
- (clobber (reg:CC 0))
- (clobber (match_scratch:SI 2 "=r,X"))]
- ""
- "@
- subu.co %2,%#r0,%1\;and %2,%2,%1\;addu.ci %2,%2,%2\;ff1 %0,%2
- subu.co %0,%#r0,%1\;and %0,%0,%1\;addu.ci %0,%0,%0\;ff1 %0,%0"
- [(set_attr "type" "marith")
- (set_attr "length" "4")])
-
-;; Bit field instructions.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 32)
- (const_int 0)))]
- ""
- "or %0,%#r0,%1")
-
-(define_insn "extv"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "int5_operand" "")
- (match_operand:SI 3 "int5_operand" "")))]
- ""
- "*
-{
- operands[4] = gen_rtx (CONST_INT, SImode,
- (32 - INTVAL (operands[2])) - INTVAL (operands[3]));
- return \"ext %0,%1,%2<%4>\"; /* <(32-%2-%3)> */
-}"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 32)
- (const_int 0)))]
- ""
- "or %0,%#r0,%1")
-
-(define_insn "extzv"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "int5_operand" "")
- (match_operand:SI 3 "int5_operand" "")))]
- ""
- "*
-{
- operands[4] = gen_rtx (CONST_INT, SImode,
- (32 - INTVAL (operands[2])) - INTVAL (operands[3]));
- return \"extu %0,%1,%2<%4>\"; /* <(32-%2-%3)> */
-}"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
- (match_operand:SI 1 "int5_operand" "")
- (match_operand:SI 2 "int5_operand" ""))
- (const_int 0))]
- ""
- "*
-{
- operands[3] = gen_rtx (CONST_INT, SImode,
- (32 - INTVAL (operands[1])) - INTVAL (operands[2]));
- return \"clr %0,%0,%1<%3>\"; /* <(32-%1-%2)> */
-}"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
- (match_operand:SI 1 "int5_operand" "")
- (match_operand:SI 2 "int5_operand" ""))
- (const_int -1))]
- ""
- "*
-{
- operands[3] = gen_rtx (CONST_INT, SImode,
- (32 - INTVAL (operands[1])) - INTVAL (operands[2]));
- return \"set %0,%0,%1<%3>\"; /* <(32-%1-%2)> */
-}"
- [(set_attr "type" "bit")])
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
- (match_operand:SI 1 "int5_operand" "")
- (match_operand:SI 2 "int5_operand" ""))
- (match_operand:SI 3 "int32_operand" "n"))]
- ""
- "*
-{
- int value = INTVAL (operands[3]);
-
- if (INTVAL (operands[1]) < 32)
- value &= (1 << INTVAL (operands[1])) - 1;
-
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- 32 - (INTVAL(operands[1]) + INTVAL(operands[2])));
-
- value <<= INTVAL (operands[2]);
- operands[3] = gen_rtx (CONST_INT, VOIDmode, value);
-
- if (SMALL_INTVAL (value))
- return \"clr %0,%0,%1<%2>\;or %0,%0,%3\";
- else if ((value & 0x0000ffff) == 0)
- return \"clr %0,%0,%1<%2>\;or.u %0,%0,%X3\";
- else
- return \"clr %0,%0,%1<%2>\;or.u %0,%0,%X3\;or %0,%0,%x3\";
-}"
- [(set_attr "type" "marith")
- (set_attr "length" "3")]) ; may be 2 or 3.
-
-;; negate insns
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "arith_operand" "rI")))]
- ""
- "subu %0,%#r0,%1")
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r,x")
- (float_truncate:SF (neg:DF (match_operand:DF 1 "register_operand" "r,x"))))]
- ""
- "@
- fsub.ssd %0,%#r0,%1
- fsub.ssd %0,%#x0,%1"
- [(set_attr "type" "dpadd")])
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=&r,r")
- (neg:DF (match_operand:DF 1 "register_operand" "r,0")))]
- ""
- "@
- xor.u %0,%1,0x8000\;or %d0,%#r0,%d1
- xor.u %0,%0,0x8000"
- [(set_attr "type" "marith,arith")])
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (neg:SF (match_operand:SF 1 "register_operand" "r")))]
- ""
- "xor.u %0,%1,0x8000")
-
-;; absolute value insns for floating-point (integer abs can be done using the
-;; machine-independent sequence).
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=&r,r")
- (abs:DF (match_operand:DF 1 "register_operand" "r,0")))]
- ""
- "@
- and.u %0,%1,0x7fff\;or %d0,%#r0,%d1
- and.u %0,%0,0x7fff"
- [(set_attr "type" "marith,arith")])
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (abs:SF (match_operand:SF 1 "register_operand" "r")))]
- ""
- "and.u %0,%1,0x7fff")
-
-;; Subroutines of "casesi".
-
-;; Operand 0 is index
-;; operand 1 is the minimum bound
-;; operand 2 is the maximum bound - minimum bound + 1
-;; operand 3 is CODE_LABEL for the table;
-;; operand 4 is the CODE_LABEL to go to if index out of range.
-
-(define_expand "casesi"
- ;; We don't use these for generating the RTL, but we must describe
- ;; the operands here.
- [(match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "immediate_operand" "")
- (match_operand:SI 2 "immediate_operand" "")
- (match_operand 3 "" "")
- (match_operand 4 "" "")]
- ""
- "
-{
- register rtx index_diff = gen_reg_rtx (SImode);
- register rtx low = gen_rtx (CONST_INT, VOIDmode, -INTVAL (operands[1]));
- register rtx label = gen_rtx (LABEL_REF, VOIDmode, operands[3]);
- register rtx base;
-
- if (! CASE_VECTOR_INSNS)
- /* These instructions are likely to be scheduled and made loop invariant.
- This decreases the cost of the dispatch at the expense of the default
- case. */
- base = force_reg (SImode, memory_address_noforce (SImode, label));
-
- /* Compute the index difference and handle the default case. */
- emit_insn (gen_addsi3 (index_diff,
- force_reg (SImode, operands[0]),
- ADD_INT (low) ? low : force_reg (SImode, low)));
- emit_insn (gen_cmpsi (index_diff, operands[2]));
- /* It's possible to replace this branch with sgtu/iorsi3 and adding a -1
- entry to the table. However, that doesn't seem to win on the m88110. */
- emit_jump_insn (gen_bgtu (operands[4]));
-
- if (CASE_VECTOR_INSNS)
- /* Call the jump that will branch to the appropriate case. */
- emit_jump_insn (gen_casesi_enter (label, index_diff, operands[3]));
- else
- /* Load the table entry and jump to it. */
- emit_jump_insn (gen_casesi_jump (gen_reg_rtx (SImode), base, index_diff, operands[3]));
-
- /* Claim that flow drops into the table so it will be adjacent by not
- emitting a barrier. */
- DONE;
-}")
-
-(define_expand "casesi_jump"
- [(set (match_operand:SI 0 "" "")
- (mem:SI (plus:SI (match_operand:SI 1 "" "")
- (mult:SI (match_operand:SI 2 "" "")
- (const_int 4)))))
- (parallel [(set (pc) (match_dup 0))
- (use (label_ref (match_operand 3 "" "")))])]
- ""
- "")
-
-(define_insn ""
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jmp%. %0"
- [(set_attr "type" "jump")])
-
-;; The bsr.n instruction is directed to the END of the table. See
-;; ASM_OUTPUT_CASE_END.
-
-(define_insn "casesi_enter"
- [(set (pc) (match_operand 0 "" ""))
- (use (match_operand:SI 1 "register_operand" "r"))
- ;; The USE here is so that at least one jump-insn will refer to the label,
- ;; to keep it alive in jump_optimize.
- (use (label_ref (match_operand 2 "" "")))
- (clobber (reg:SI 1))]
- ""
- "*
-{
- if (flag_delayed_branch)
- return \"bsr.n %0e\;lda %#r1,%#r1[%1]\";
- m88k_case_index = REGNO (operands[1]);
- return \"bsr %0e\";
-}"
- [(set_attr "type" "weird")
- (set_attr "length" "3")]) ; Including the "jmp r1".
-
-;;- jump to subroutine
-(define_expand "call"
- [(parallel [(call (match_operand:SI 0 "" "")
- (match_operand 1 "" ""))
- (clobber (reg:SI 1))])]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM
- && ! call_address_operand (XEXP (operands[0], 0), SImode))
- operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
- force_reg (Pmode, XEXP (operands[0], 0)));
-}")
-
-(define_insn ""
- [(parallel [(call (mem:SI (match_operand:SI 0 "call_address_operand" "rQ"))
- (match_operand 1 "" ""))
- (clobber (reg:SI 1))])]
- ""
- "* return output_call (operands, operands[0]);"
- [(set_attr "type" "call")])
-
-(define_expand "call_value"
- [(parallel [(set (match_operand 0 "register_operand" "")
- (call (match_operand:SI 1 "" "")
- (match_operand 2 "" "")))
- (clobber (reg:SI 1))])]
- ""
- "
-{
- if (GET_CODE (operands[1]) == MEM
- && ! call_address_operand (XEXP (operands[1], 0), SImode))
- operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
- force_reg (Pmode, XEXP (operands[1], 0)));
-}")
-
-(define_insn ""
- [(parallel [(set (match_operand 0 "register_operand" "=r")
- (call (mem:SI
- (match_operand:SI 1 "call_address_operand" "rQ"))
- (match_operand 2 "" "")))
- (clobber (reg:SI 1))])]
- ""
- "* return output_call (operands, operands[1]);"
- [(set_attr "type" "call")])
-
-;; Nop instruction and others
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "ff0 %#r0,%#r0"
- [(set_attr "type" "bit")])
-
-(define_insn "return"
- [(return)]
- "reload_completed"
- "jmp%. %#r1"
- [(set_attr "type" "jump")])
-
-(define_expand "prologue"
- [(const_int 0)]
- ""
- "m88k_expand_prologue (); DONE;")
-
-(define_expand "epilogue"
- [(return)]
- "! null_prologue ()"
- "m88k_expand_epilogue ();")
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- ""
- [(set_attr "length" "0")])
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
- ""
- "jmp%. %0"
- [(set_attr "type" "jump")])
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "br%. %l0"
- [(set_attr "type" "jump")])
-
-;; This insn is used for some loop tests, typically loops reversed when
-;; strength reduction is used. It is actually created when the instruction
-;; combination phase combines the special loop test. Since this insn
-;; is both a jump insn and has an output, it must deal with it's own
-;; reloads, hence the `m' constraints. The `!' constraints direct reload
-;; to not choose the register alternatives in the event a reload is needed.
-
-(define_expand "decrement_and_branch_until_zero"
- [(parallel [(set (pc)
- (if_then_else
- (match_operator 0 "relop_no_unsigned"
- [(match_operand:SI 1 "register_operand" "")
- (const_int 0)])
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 1)
- (plus:SI (match_dup 1)
- (match_operand:SI 3 "add_operand" "")))
- (clobber (match_scratch:SI 4 ""))
- (clobber (match_scratch:SI 5 "=X,X,&r,&r"))])]
- ""
- "")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 0 "relop_no_unsigned"
- [(match_operand:SI 1 "register_operand" "+!r,!r,m,m")
- (const_int 0)])
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 1)
- (plus:SI (match_dup 1)
- (match_operand:SI 3 "add_operand" "rI,J,rI,J")))
- (clobber (match_scratch:SI 4 "=X,X,&r,&r"))
- (clobber (match_scratch:SI 5 "=X,X,&r,&r"))]
- "find_reg_note (insn, REG_NONNEG, 0)"
- "@
- bcnd.n %B0,%1,%2\;addu %1,%1,%3
- bcnd.n %B0,%1,%2\;subu %1,%1,%n3
- ld %4,%1\;addu %5,%4,%3\;bcnd.n %B0,%4,%2\;st %5,%1
- ld %4,%1\;subu %5,%4,%n3\;bcnd.n %B0,%4,%2\;st %5,%1"
- [(set_attr "type" "weird")
- (set_attr "length" "2,2,4,4")])
-
-;; Special insn to serve as the last insn of a define_expand. This insn
-;; will generate no code.
-
-(define_expand "dummy"
- [(set (match_operand 0 "" "") (match_dup 0))]
- ""
- "")
diff --git a/gcc/config/m88k/sysv3.h b/gcc/config/m88k/sysv3.h
deleted file mode 100644
index 62fe8973d4f..00000000000
--- a/gcc/config/m88k/sysv3.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Motorola m88100 running the AT&T/Unisoft/Motorola V.3 reference port.
- Copyright (C) 1990, 1991 Free Software Foundation, Inc.
- Contributed by Ray Essick (ressick@mot.com)
- Enhanced by Tom Wood (Tom_Wood@NeXT.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 "m88k/m88k.h"
-
-/* Default switches */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_CHECK_ZERO_DIV | \
- MASK_OCS_DEBUG_INFO | \
- MASK_OCS_FRAME_POSITION)
-
-/* Macros to be automatically defined. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dm88000 -Dm88k -Dunix -DsysV88 -D__CLASSIFY_TYPE__=2 -Asystem(unix) -Asystem(svr3) -Acpu(m88k) -Amachine(m88k)"
-
-/* Override svr3.h to link with ?crt0.o instead of ?crt1.o and ?crtn.o.
- From arul@sdsu.edu. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} crtbegin.o%s"
-
-/* Profiled libraries live in a different directory but keep the same
- names other than that. arul@sdsu.edu says -lg is always needed. */
-#undef LIB_SPEC
-#define LIB_SPEC "%{p:-L/lib/libp}%{pg:%{!p:-L/lib/libp}} -lg -lc crtend.o%s"
-
-/* Hot version of the profiler that uses r10 to pass the address of
- the counter. the _gcc_mcount routine knows not to screw with
- the parameter registers.
-
- DG/UX does this; i wrote a gnu-c/88k specific version and put it
- in libgcc2.c -- RBE; this macro knows about the leading underscore
- convention. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- output_function_profiler (FILE, LABELNO, "_gcc_mcount", 0)
-
-/* Various other changes that we want to have in place without
- too many changes to the m88k.h file. */
-#undef USE_LIBG
-#define USE_LIBG
-
-/* Define a few machine-specific details of the implementation of
- constructors. */
-
-/* Although the .init section is used, it is not automatically invoked. */
-#define INVOKE__main
-
-/* State that atexit exists so __do_global_ctors will register
- __do_global_dtors. */
-#define HAVE_ATEXIT
-
-#define CTOR_LIST_BEGIN \
- asm (INIT_SECTION_ASM_OP); \
- asm ("\tsubu\t r31,r31,16"); /* (STACK_BOUNDARY / BITS_PER_UNIT) == 16 */ \
- asm ("\tst\t r0,r31,32"); /* REG_PARM_STACK_SPACE (0) == 32 */
-#define CTOR_LIST_END
-
-/* ASM_OUTPUT_CONSTRUCTOR outputs code into the .init section to push the
- address of the constructor. This becomes the body of __do_global_ctors
- in crtstuff.c. r13 is a temporary register. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tor.u\t r13,r0,hi16("); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ")\n\tor\t r13,r13,lo16("); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ")\n\tsubu\t r31,r31,%d\n\tst\t r13,r31,%d\n", \
- STACK_BOUNDARY / BITS_PER_UNIT, REG_PARM_STACK_SPACE (0)); \
- } while (0)
-
-#undef DO_GLOBAL_CTORS_BODY
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *__CTOR_LIST__ = __builtin_alloca (1), *p; \
- for (p = __CTOR_LIST__ + 4; *p; p += 4) \
- (*p) (); \
-} while (0)
-
-#define DTOR_LIST_BEGIN \
- asm (FINI_SECTION_ASM_OP); \
- func_ptr __DTOR_LIST__[4] = { (func_ptr) (-1), (func_ptr) (-1), \
- (func_ptr) (-1), (func_ptr) (-1) }
-#define DTOR_LIST_END \
- asm (FINI_SECTION_ASM_OP); \
- func_ptr __DTOR_END__[4] = { (func_ptr) 0, (func_ptr) 0, \
- (func_ptr) 0, (func_ptr) 0 }
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. The table is constructed in the .fini section
- so that an explicit linker script is not required. The complication
- is that this section is padded with NOP instructions and to either
- 8 or 16 byte alignment depending on the specific system. A clever
- way to avoid trouble is to output a block of 16 bytes where the
- extra words are known values (-1). */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- register int i; \
- fini_section (); \
- fprintf (FILE, "\t%s\t ", ASM_LONG); \
- assemble_name (FILE,NAME); \
- fprintf (FILE, "\n"); \
- for (i = 1; i < 4; i++) \
- fprintf (FILE, "\t%s\t -1\n", ASM_LONG); \
- } while (0)
-
-/* Walk the list looking for the terminating zero and ignoring all values of
- -1. */
-#undef DO_GLOBAL_DTORS_BODY
-#define DO_GLOBAL_DTORS_BODY \
- do { \
- int i; \
- for (i = 0; __DTOR_LIST__[i] != 0; i++) \
- if (((int *)__DTOR_LIST__)[i] != -1) \
- __DTOR_LIST__[i] (); \
- } while (0)
diff --git a/gcc/config/m88k/sysv4.h b/gcc/config/m88k/sysv4.h
deleted file mode 100644
index ff6dc781352..00000000000
--- a/gcc/config/m88k/sysv4.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Motorola 88100 in an 88open ABI environment.
- Copyright (C) 1990, 1991 Free Software Foundation, Inc.
-
- Written by Ron Guilmette (rfg@netcom.com).
- Contributed to FSF by Network Computing Devices.
-
- Other contributions by Vince Guarna (vguarna@urbana.mcd.mot.com),
- Ray Essick (essick@i88.isc.com), Wilson Tien (wtien@urbana.mcd.mot.com),
- and Tom Wood (Tom_Wood@NeXT.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. */
-
-/* DWARF_DEBUGGING_INFO defined in svr4.h. */
-
-#ifndef NO_BUGS
-#define AS_BUG_DOT_LABELS
-#define AS_BUG_POUND_TYPE
-#endif
-
-#include "svr4.h"
-#include "m88k/m88k.h"
-
-/* Identify the compiler. */
-#undef VERSION_INFO1
-#define VERSION_INFO1 "88open ABI, "
-
-/* Default switches */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_CHECK_ZERO_DIV | \
- MASK_OCS_DEBUG_INFO | \
- MASK_SVR4)
-
-/* Cpp spec. These pre-assertions are needed for SVR4 as they occur
- often in the system header files. __svr4__ is our extension. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dm88000 -Dm88k -Dunix -D__svr4__ -Amachine(m88k) -Acpu(m88k) -Asystem(unix) -Asystem(svr4)"
-
-/* For the AT&T SVR4 port, the function is _mcount. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- output_function_profiler (FILE, LABELNO, "_mcount", 1)
-
-/* Override svr4.h and m88k.h. */
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP "section\t.init,\"xa\",#progbits"
-#undef FINI_SECTION_ASM_OP
-#define FINI_SECTION_ASM_OP "section\t.fini,\"xa\",#progbits"
-
-/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
-
- Note that we want to give these sections the SHF_WRITE attribute
- because these sections will actually contain data (i.e. tables of
- addresses of functions in the current root executable or shared library
- file) and, in the case of a shared library, the relocatable addresses
- will have to be properly resolved/relocated (and then written into) by
- the dynamic linker when it actually attaches the given shared library
- to the executing process. (Note that on SVR4, you may wish to use the
- `-z text' option to the ELF linker, when building a shared library, as
- an additional check that you are doing everything right. But if you do
- use the `-z text' option when building a shared library, you will get
- errors unless the .ctors and .dtors sections are marked as writable
- via the SHF_WRITE attribute.) */
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "section\t.ctors,\"aw\""
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "section\t.dtors,\"aw\""
diff --git a/gcc/config/m88k/t-bug b/gcc/config/m88k/t-bug
deleted file mode 100644
index a5e71ddf3fc..00000000000
--- a/gcc/config/m88k/t-bug
+++ /dev/null
@@ -1,12 +0,0 @@
-# Specify how to create the *.asm files
-
-MOVE_ASM = moveHI15x.asm moveQI16x.asm moveSI46x.asm moveSI64n.asm \
- moveHI48x.asm moveSI45x.asm moveSI47x.asm moveSI96x.asm \
- moveDI96x.asm
-
-$(MOVE_ASM): $(srcdir)/config/m88k/m88k-move.sh
- $(srcdir)/config/m88k/m88k-move.sh
-
-LIB2FUNCS_EXTRA = $(MOVE_ASM)
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
diff --git a/gcc/config/m88k/t-dgux b/gcc/config/m88k/t-dgux
deleted file mode 100644
index cced6b1eca2..00000000000
--- a/gcc/config/m88k/t-dgux
+++ /dev/null
@@ -1,26 +0,0 @@
-# Specify how to create the *.asm files
-
-MOVE_ASM = moveHI15x.asm moveQI16x.asm moveSI46x.asm moveSI64n.asm \
- moveHI48x.asm moveSI45x.asm moveSI47x.asm moveSI96x.asm \
- moveDI96x.asm
-
-$(MOVE_ASM): $(srcdir)/config/m88k/m88k-move.sh
- $(srcdir)/config/m88k/m88k-move.sh
-
-LIB2FUNCS_EXTRA = $(MOVE_ASM)
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-
-# In a coff environment, a link script is required for ctors and dtors.
-m88kdgux.ld: $(srcdir)/config/m88k/dgux.ld
- rm -f m88kdgux.ld; cp $(srcdir)/config/m88k/dgux.ld ./m88kdgux.ld
-
-# A bcs crtbegin.o is needed since bcs does not
-# increment the stack pointer in the init section as elf does
-bcscrtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_BEGIN -DBCS \
- -finhibit-size-directive -fno-inline-functions \
- -g0 -c $(srcdir)/crtstuff.c -o bcscrtbegin.o
-
-# Build libgcc.a, crtbegin.o, and crtend.o as bcs objects
-GCC_FOR_TARGET = PATH=/usr/sde/m88kbcs/usr/bin/:/usr/bin TARGET_BINARY_INTERFACE=m88kbcs ./xgcc -B./ -msvr3 -D_M88KBCS_TARGET -mno-ocs-debug-info
diff --git a/gcc/config/m88k/t-dgux-gas b/gcc/config/m88k/t-dgux-gas
deleted file mode 100644
index c7368c3c216..00000000000
--- a/gcc/config/m88k/t-dgux-gas
+++ /dev/null
@@ -1,17 +0,0 @@
-# Specify how to create the *.asm files
-
-MOVE_ASM = moveHI15x.asm moveQI16x.asm moveSI46x.asm moveSI64n.asm \
- moveHI48x.asm moveSI45x.asm moveSI47x.asm moveSI96x.asm \
- moveDI96x.asm
-
-$(MOVE_ASM): $(srcdir)/config/m88k/m88k-move.sh
- $(srcdir)/config/m88k/m88k-move.sh
-
-LIB2FUNCS_EXTRA = $(MOVE_ASM)
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-T_CPPFLAGS = -DUSE_GAS
-
-# In a coff environment, a link script is required.
-m88kdgux.ld: $(srcdir)/config/m88k/dgux.ld
- rm -f m88kdgux.ld; cp $(srcdir)/config/m88k/dgux.ld ./m88kdgux.ld
diff --git a/gcc/config/m88k/t-dguxbcs b/gcc/config/m88k/t-dguxbcs
deleted file mode 100644
index c42a9bf18d5..00000000000
--- a/gcc/config/m88k/t-dguxbcs
+++ /dev/null
@@ -1,28 +0,0 @@
-# Specify how to create the *.asm files
-
-MOVE_ASM = moveHI15x.asm moveQI16x.asm moveSI46x.asm moveSI64n.asm \
- moveHI48x.asm moveSI45x.asm moveSI47x.asm moveSI96x.asm \
- moveDI96x.asm
-
-$(MOVE_ASM): $(srcdir)/config/m88k/m88k-move.sh
- $(srcdir)/config/m88k/m88k-move.sh
-
-LIB2FUNCS_EXTRA = $(MOVE_ASM)
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-
-# In a coff environment, a link script is required for ctors and dtors.
-m88kdgux.ld: $(srcdir)/config/m88k/dgux.ld
- rm -f m88kdgux.ld; cp $(srcdir)/config/m88k/dgux.ld ./m88kdgux.ld
-
-# A bcs crtbegin.o is needed since bcs does not
-# increment the stack pointer in the init section as elf does
-bcscrtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_BEGIN -DBCS \
- -finhibit-size-directive -fno-inline-functions \
- -g0 -c $(srcdir)/crtstuff.c -o bcscrtbegin.o
-
-# Build libgcc.a, crtbegin.o, and crtend.o as bcs objects
-GCC_FOR_TARGET = PATH=/usr/sde/m88kbcs/usr/bin/:/usr/bin TARGET_BINARY_INTERFACE=m88kbcs ./xgcc -B./ -msvr3 -D_M88KBCS_TARGET -mno-ocs-debug-info
-
-T_CFLAGS = -O -D_M88KBCS_TARGET
diff --git a/gcc/config/m88k/t-luna b/gcc/config/m88k/t-luna
deleted file mode 100644
index dce5f225931..00000000000
--- a/gcc/config/m88k/t-luna
+++ /dev/null
@@ -1,12 +0,0 @@
-# Specify how to create the *.asm files
-
-MOVE_ASM = moveHI15x.asm moveQI16x.asm moveSI46x.asm moveSI64n.asm \
- moveHI48x.asm moveSI45x.asm moveSI47x.asm moveSI96x.asm \
- moveDI96x.asm
-
-$(MOVE_ASM): $(srcdir)/config/m88k/m88k-move.sh
- $(srcdir)/config/m88k/m88k-move.sh -no-tdesc
-
-LIB2FUNCS_EXTRA = $(MOVE_ASM)
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
diff --git a/gcc/config/m88k/t-luna-gas b/gcc/config/m88k/t-luna-gas
deleted file mode 100644
index 1d6692ab4a0..00000000000
--- a/gcc/config/m88k/t-luna-gas
+++ /dev/null
@@ -1,13 +0,0 @@
-# Specify how to create the *.asm files
-
-MOVE_ASM = moveHI15x.asm moveQI16x.asm moveSI46x.asm moveSI64n.asm \
- moveHI48x.asm moveSI45x.asm moveSI47x.asm moveSI96x.asm \
- moveDI96x.asm
-
-$(MOVE_ASM): $(srcdir)/config/m88k/m88k-move.sh
- bash $(srcdir)/config/m88k/m88k-move.sh -no-tdesc
-
-LIB2FUNCS_EXTRA = $(MOVE_ASM)
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-T_CPPFLAGS = -DUSE_GAS
diff --git a/gcc/config/m88k/t-m88k b/gcc/config/m88k/t-m88k
deleted file mode 100644
index a5e71ddf3fc..00000000000
--- a/gcc/config/m88k/t-m88k
+++ /dev/null
@@ -1,12 +0,0 @@
-# Specify how to create the *.asm files
-
-MOVE_ASM = moveHI15x.asm moveQI16x.asm moveSI46x.asm moveSI64n.asm \
- moveHI48x.asm moveSI45x.asm moveSI47x.asm moveSI96x.asm \
- moveDI96x.asm
-
-$(MOVE_ASM): $(srcdir)/config/m88k/m88k-move.sh
- $(srcdir)/config/m88k/m88k-move.sh
-
-LIB2FUNCS_EXTRA = $(MOVE_ASM)
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
diff --git a/gcc/config/m88k/t-m88k-gas b/gcc/config/m88k/t-m88k-gas
deleted file mode 100644
index dc436e181be..00000000000
--- a/gcc/config/m88k/t-m88k-gas
+++ /dev/null
@@ -1,18 +0,0 @@
-# Specify how to create the *.asm files
-
-MOVE_ASM = moveHI15x.asm moveQI16x.asm moveSI46x.asm moveSI64n.asm \
- moveHI48x.asm moveSI45x.asm moveSI47x.asm moveSI96x.asm \
- moveDI96x.asm
-
-$(MOVE_ASM): $(srcdir)/config/m88k/m88k-move.sh
- $(srcdir)/config/m88k/m88k-move.sh
-
-LIB2FUNCS_EXTRA = $(MOVE_ASM)
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-T_CPPFLAGS = -DUSE_GAS
-
-# For svr4 we build crtbegin.o and crtend.o which serve to add begin and
-# end labels to the .ctors and .dtors section when we link using gcc.
-
-EXTRA_PARTS=crtbegin.o crtend.o
diff --git a/gcc/config/m88k/t-sysv4 b/gcc/config/m88k/t-sysv4
deleted file mode 100644
index 3f90cd577ef..00000000000
--- a/gcc/config/m88k/t-sysv4
+++ /dev/null
@@ -1,22 +0,0 @@
-# Specify how to create the *.asm files
-
-MOVE_ASM = moveHI15x.asm moveQI16x.asm moveSI46x.asm moveSI64n.asm \
- moveHI48x.asm moveSI45x.asm moveSI47x.asm moveSI96x.asm \
- moveDI96x.asm
-
-# Use the -abi option for version 03.00 syntax.
-
-$(MOVE_ASM): $(srcdir)/config/m88k/m88k-move.sh
- $(srcdir)/config/m88k/m88k-move.sh -abi
-
-LIB2FUNCS_EXTRA = $(MOVE_ASM)
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-
-# We need to use -fPIC when we are using gcc to compile the routines in
-# crtstuff.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fPIC when compiling the
-# routines in crtstuff.c.
-
-CRTSTUFF_T_CFLAGS=-fPIC
diff --git a/gcc/config/m88k/tekXD88.h b/gcc/config/m88k/tekXD88.h
deleted file mode 100644
index 5b37dead612..00000000000
--- a/gcc/config/m88k/tekXD88.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Tektronix XD88 UTekV 3.2e (svr3 derived from UniSoft System V/88)
-
- Copyright (C) 1993 Free Software Foundation, Inc.
- Contributed by Kaveh R. Ghazi (ghazi@caip.rutgers.edu) 2/22/93.
-
- 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 "m88k/sysv3.h"
-
-/* Don't output structure tag names when it causes a forward reference.
- Symptom:
- Error messages like
- as: "/usr/tmp/cca22733.s": cannot reduce symbol table, unused symbols remain
- when compiling some programs.
- example program (C++): struct bad { bad(); }; bad::bad() {}
-
- This problem seems to have gone away, perhaps with release 3.6 of the O/S
- from Dolphin. */
-/* #undef SDB_ALLOW_FORWARD_REFERENCES */
-/* I don't know if this SDB thing is needed or not --KRG */
-
-
-/* Use T_ARG as T_VOID. T_VOID is not defined in <syms.h> as it should be. */
-#define T_VOID T_ARG
-
-
-/* The bundled ld program needs link editor directives which normally
- reside in /lib/default.ld. We'll pass our own copy during the link
- phase because additional information about extra sections must be added
- so that gcc generated files will link properly.
- --KRG.
- */
-#undef LINK_SPEC
-#define LINK_SPEC "gcc.ld%s"
diff --git a/gcc/config/m88k/tekXD88.ld b/gcc/config/m88k/tekXD88.ld
deleted file mode 100644
index 86c652249ad..00000000000
--- a/gcc/config/m88k/tekXD88.ld
+++ /dev/null
@@ -1,39 +0,0 @@
-/* gcc.ld - COFF linker directives for the Tektronix XD88.
-
- 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 does the following:
- - Sets VIRTUAL addr of .text to 0x10200
- Sets FILE addr of .text to 0x200 (BLOCK directive)
- - Depending on size of .text section rounds up to next
- 4 MG boundary, adds (size of .text and vaddr of .text) mod 64K
- This is to handle sections larger than 4 MG.
-*/
-
-SECTIONS {
- .text 0x10200 BLOCK (0x200):
- { *(.init) *(.text) *(.rodata) *(.tdesc) *(.fini)}
-
- GROUP BIND( ((SIZEOF(.text) / 0x400000 * 0x400000) + 0x400000) +
- ((SIZEOF(.text) + ADDR(.text)) % 0x10000) ) :
- {
- .data : { }
- .bss : { }
- }
-}
diff --git a/gcc/config/m88k/x-dgux b/gcc/config/m88k/x-dgux
deleted file mode 100644
index 9282cfdd752..00000000000
--- a/gcc/config/m88k/x-dgux
+++ /dev/null
@@ -1,5 +0,0 @@
-CC = gcc
-BISONFLAGS = -l
-INSTALL_HEADERS =
-STMP_FIXPROTO =
-X_CFLAGS = -O -mstandard -mlegend
diff --git a/gcc/config/m88k/x-dguxbcs b/gcc/config/m88k/x-dguxbcs
deleted file mode 100644
index 8495b8db43d..00000000000
--- a/gcc/config/m88k/x-dguxbcs
+++ /dev/null
@@ -1,5 +0,0 @@
-CC = gcc
-BISONFLAGS = -l
-INSTALL_HEADERS =
-STMP_FIXPROTO =
-
diff --git a/gcc/config/m88k/x-dolph b/gcc/config/m88k/x-dolph
deleted file mode 100644
index b31a7a9ac90..00000000000
--- a/gcc/config/m88k/x-dolph
+++ /dev/null
@@ -1,19 +0,0 @@
-# Use link editor directives to make NULL pointers point to
-# invalid addresses.
-
-EXTRA_PARTS=crtbegin.o crtend.o gcc.ld
-
-gcc.ld: $(srcdir)/config/m88k/dolphin.ld
- rm -f gcc.ld; cp $(srcdir)/config/m88k/dolphin.ld gcc.ld
-
-# Green Hills C on Dolphin UNIX System V/88 Release 3.2 Version 3.6/5.86 does
-# not provide alloca. It does not harm to have it defined on version 3.8.alfa
-# even though it's not needed there.
-
-ALLOCA=alloca.o
-
-# Under DolphinOS 3.8.alfa, /bin/cc defines __GNUC__, but not __m88k__,
-# causing gdstarg.h to fail. Defining __m88k__ does probably not hurt on
-# DolphinOS 3.6.
-
-X_CFLAGS =-D__m88k__
diff --git a/gcc/config/m88k/x-sysv3 b/gcc/config/m88k/x-sysv3
deleted file mode 100644
index 3ee9067ac00..00000000000
--- a/gcc/config/m88k/x-sysv3
+++ /dev/null
@@ -1,7 +0,0 @@
-# this is m88k/x-sysv3
-
-# native compiler does not provide alloca
-
-ALLOCA = alloca.o
-
-# end m88k/x-sysv3
diff --git a/gcc/config/m88k/x-sysv4 b/gcc/config/m88k/x-sysv4
deleted file mode 100644
index dd242871eea..00000000000
--- a/gcc/config/m88k/x-sysv4
+++ /dev/null
@@ -1,10 +0,0 @@
-# Problems in early version of the assembler have been fixed (-DNO_BUGS).
-# There are peculiar problems with the include files that require __STDC__
-# to be defined as 0. This results in sigset_t being defined which otherwise
-# results in a problem when <wait.h> includes <siginfo.h>.
-
-X_CFLAGS = -DNO_BUGS -D__STDC__=0
-
-# The CI5 compiler does not provide alloca.
-
-ALLOCA = alloca.o
diff --git a/gcc/config/m88k/x-tekXD88 b/gcc/config/m88k/x-tekXD88
deleted file mode 100644
index b8b4a2f1021..00000000000
--- a/gcc/config/m88k/x-tekXD88
+++ /dev/null
@@ -1,12 +0,0 @@
-# Install the custom Tektronix XD88 link editor directives file.
-EXTRA_PARTS=crtbegin.o crtend.o gcc.ld
-
-gcc.ld: $(srcdir)/config/m88k/tekXD88.ld
- rm -f gcc.ld; cp $(srcdir)/config/m88k/tekXD88.ld ./gcc.ld
-
-# Green Hills C on the Tektronix XD88 does not provide alloca.
-ALLOCA=alloca.o
-
-# rc is cleaner, but the ar program sometimes crashes.
-# This is a workaround.
-AR_FLAGS=qc
diff --git a/gcc/config/m88k/xm-m88k.h b/gcc/config/m88k/xm-m88k.h
deleted file mode 100644
index 8691f865643..00000000000
--- a/gcc/config/m88k/xm-m88k.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Configuration for GNU compiler.
- Motorola m88100 in an 88open OCS/BCS environment.
- Copyright (C) 1988, 1989, 1990, 1991, 1993 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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* Use System V memory functions. */
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-
-#define rindex strrchr
-#define index strchr
-
-/* The 88open BCS (and ABI) environment doesn't support BSD features
- (vfork, getrusage), so use USG. The Omron Luna/88k is BSD though. */
-#ifndef luna88k
-#define USG
-#define NO_SYS_SIGLIST
-#endif
-
-/* Define HAVE_VPRINTF if it is available on host system. */
-#define HAVE_VPRINTF
-
-/* If not compiled with GNU C, use the C alloca */
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-#endif
-
-/* For DG/UX, the best size is different. */
-#ifdef __DGUX__
-#define OBSTACK_CHUNK_SIZE (8192-16)
-#endif
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
diff --git a/gcc/config/m88k/xm-sysv3.h b/gcc/config/m88k/xm-sysv3.h
deleted file mode 100644
index 05d3e4cf4d4..00000000000
--- a/gcc/config/m88k/xm-sysv3.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Configuration for GNU C-compiler.
- Motorola m88100 running the AT&T/Unisoft/Motorola V.3 reference port.
- Copyright (C) 1990 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. */
-
-#include "m88k/xm-m88k.h"
-
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#define F_OK 0
-
-/* for the emacs version of alloca */
-#define STACK_DIRECTION -1
diff --git a/gcc/config/mips/abi64.h b/gcc/config/mips/abi64.h
deleted file mode 100644
index 1cf561a6803..00000000000
--- a/gcc/config/mips/abi64.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/* Definitions of target machine for GNU compiler. 64 bit ABI support.
- Copyright (C) 1994, 1995, 1996 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. */
-
-/* Macros to implement the 64 bit ABI. This file is meant to be included
- after mips.h. */
-
-#undef SUBTARGET_TARGET_OPTIONS
-#define SUBTARGET_TARGET_OPTIONS\
- { "abi=", &mips_abi_string },
-
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY \
- ((mips_abi == ABI_32 || mips_abi == ABI_EABI) ? 64 : 128)
-
-#undef MIPS_STACK_ALIGN
-#define MIPS_STACK_ALIGN(LOC) \
- ((mips_abi == ABI_32 || mips_abi == ABI_EABI) \
- ? ((LOC) + 7) & ~7 \
- : ((LOC) + 15) & ~15)
-
-#undef GP_ARG_LAST
-#define GP_ARG_LAST (mips_abi == ABI_32 ? GP_REG_FIRST + 7 : GP_REG_FIRST + 11)
-#undef FP_ARG_LAST
-#define FP_ARG_LAST (mips_abi == ABI_32 ? FP_REG_FIRST + 15 : FP_REG_FIRST + 19)
-
-#undef SUBTARGET_CONDITIONAL_REGISTER_USAGE
-#define SUBTARGET_CONDITIONAL_REGISTER_USAGE \
-{ \
- /* fp20-23 are now caller saved. */ \
- if (mips_abi == ABI_64) \
- { \
- int regno; \
- for (regno = FP_REG_FIRST + 20; regno < FP_REG_FIRST + 24; regno++) \
- call_used_regs[regno] = 1; \
- } \
- /* odd registers from fp21 to fp31 are now caller saved. */ \
- if (mips_abi == ABI_N32) \
- { \
- int regno; \
- for (regno = FP_REG_FIRST + 21; regno <= FP_REG_FIRST + 31; regno+=2) \
- call_used_regs[regno] = 1; \
- } \
-}
-
-#undef MAX_ARGS_IN_REGISTERS
-#define MAX_ARGS_IN_REGISTERS (mips_abi == ABI_32 ? 4 : 8)
-
-#undef REG_PARM_STACK_SPACE
-#if 0
-/* ??? This is necessary in order for the ABI_32 support to work. However,
- expr.c (emit_push_insn) has no support for a REG_PARM_STACK_SPACE
- definition that returns zero. That would have to be fixed before this
- can be enabled. */
-#define REG_PARM_STACK_SPACE(FNDECL) \
- (mips_abi == ABI_32 \
- ? (MAX_ARGS_IN_REGISTERS*UNITS_PER_WORD) - FIRST_PARM_OFFSET (FNDECL) \
- : 0)
-#endif
-
-#define FUNCTION_ARG_PADDING(MODE, TYPE) \
- (! BYTES_BIG_ENDIAN \
- ? upward \
- : (((MODE) == BLKmode \
- ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT))\
- : (GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY \
- && (mips_abi == ABI_32 || mips_abi == ABI_EABI \
- || GET_MODE_CLASS (MODE) == MODE_INT))) \
- ? downward : upward))
-
-#undef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY(TYPE) \
- (mips_abi == ABI_32 \
- ? TYPE_MODE (TYPE) == BLKmode \
- : (int_size_in_bytes (TYPE) \
- > (mips_abi == ABI_EABI ? 2 * UNITS_PER_WORD : 16)))
-
-extern struct rtx_def *mips_function_value ();
-#undef FUNCTION_VALUE
-#define FUNCTION_VALUE(VALTYPE, FUNC) mips_function_value (VALTYPE, FUNC)
-
-/* For varargs, we must save the current argument, because it is the fake
- argument va_alist, and will need to be converted to the real argument.
- For stdarg, we do not need to save the current argument, because it
- is a real argument. */
-#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
-{ int mips_off = (! current_function_varargs) && (! (CUM).last_arg_fp); \
- int mips_fp_off = (! current_function_varargs) && ((CUM).last_arg_fp); \
- if ((mips_abi != ABI_32 \
- && (CUM).arg_words < MAX_ARGS_IN_REGISTERS - mips_off) \
- || (mips_abi == ABI_EABI \
- && ! TARGET_SOFT_FLOAT \
- && (CUM).fp_arg_words < MAX_ARGS_IN_REGISTERS - mips_fp_off)) \
- { \
- int mips_save_gp_regs = \
- MAX_ARGS_IN_REGISTERS - (CUM).arg_words - mips_off; \
- int mips_save_fp_regs = \
- (mips_abi != ABI_EABI ? 0 \
- : MAX_ARGS_IN_REGISTERS - (CUM).fp_arg_words - mips_fp_off); \
- \
- if (mips_save_gp_regs < 0) \
- mips_save_gp_regs = 0; \
- if (mips_save_fp_regs < 0) \
- mips_save_fp_regs = 0; \
- PRETEND_SIZE = ((mips_save_gp_regs * UNITS_PER_WORD) \
- + (mips_save_fp_regs * UNITS_PER_FPREG)); \
- \
- if (! (NO_RTL)) \
- { \
- if ((CUM).arg_words < MAX_ARGS_IN_REGISTERS - mips_off) \
- { \
- rtx ptr, mem; \
- if (mips_abi != ABI_EABI) \
- ptr = virtual_incoming_args_rtx; \
- else \
- ptr = plus_constant (virtual_incoming_args_rtx, \
- - (mips_save_gp_regs \
- * UNITS_PER_WORD)); \
- mem = gen_rtx (MEM, BLKmode, ptr); \
- /* va_arg is an array access in this case, which causes \
- it to get MEM_IN_STRUCT_P set. We must set it here \
- so that the insn scheduler won't assume that these \
- stores can't possibly overlap with the va_arg loads. */ \
- if (mips_abi != ABI_EABI && BYTES_BIG_ENDIAN) \
- MEM_IN_STRUCT_P (mem) = 1; \
- move_block_from_reg \
- ((CUM).arg_words + GP_ARG_FIRST + mips_off, \
- mem, \
- mips_save_gp_regs, \
- mips_save_gp_regs * UNITS_PER_WORD); \
- } \
- if (mips_abi == ABI_EABI \
- && ! TARGET_SOFT_FLOAT \
- && (CUM).fp_arg_words < MAX_ARGS_IN_REGISTERS - mips_fp_off) \
- { \
- enum machine_mode mode = TARGET_SINGLE_FLOAT ? SFmode : DFmode; \
- int size = GET_MODE_SIZE (mode); \
- int off; \
- int i; \
- /* We can't use move_block_from_reg, because it will use \
- the wrong mode. */ \
- off = - (mips_save_gp_regs * UNITS_PER_WORD); \
- if (! TARGET_SINGLE_FLOAT) \
- off &= ~ 7; \
- if (! TARGET_FLOAT64 || TARGET_SINGLE_FLOAT) \
- off -= (mips_save_fp_regs / 2) * size; \
- else \
- off -= mips_save_fp_regs * size; \
- for (i = 0; i < mips_save_fp_regs; i++) \
- { \
- rtx tem = \
- gen_rtx (MEM, mode, \
- plus_constant (virtual_incoming_args_rtx, \
- off)); \
- emit_move_insn (tem, \
- gen_rtx (REG, mode, \
- ((CUM).fp_arg_words \
- + FP_ARG_FIRST \
- + i \
- + mips_fp_off))); \
- off += size; \
- if (! TARGET_FLOAT64 || TARGET_SINGLE_FLOAT) \
- ++i; \
- } \
- } \
- } \
- } \
-}
-
-/* ??? Should disable for mips_abi == ABI32. */
-#define STRICT_ARGUMENT_NAMING
-
-/* A C expression that indicates when an argument must be passed by
- reference. If nonzero for an argument, a copy of that argument is
- made in memory and a pointer to the argument is passed instead of the
- argument itself. The pointer is passed in whatever way is appropriate
- for passing a pointer to that type. */
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
- (mips_abi == ABI_EABI \
- && function_arg_pass_by_reference (&CUM, MODE, TYPE, NAMED))
-
-/* A C expression that indicates when it is the called function's
- responsibility to make a copy of arguments passed by invisible
- reference. Normally, the caller makes a copy and passes the
- address of the copy to the routine being called. When
- FUNCTION_ARG_CALLEE_COPIES is defined and is nonzero, the caller
- does not make a copy. Instead, it passes a pointer to the "live"
- value. The called function must not modify this value. If it can
- be determined that the value won't be modified, it need not make a
- copy; otherwise a copy must be made.
-
- ??? The MIPS EABI says that the caller should copy in ``K&R mode.''
- I don't know how to detect that here, since flag_traditional is not
- a back end flag. */
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
- (mips_abi == ABI_EABI && (NAMED) \
- && FUNCTION_ARG_PASS_BY_REFERENCE (CUM, MODE, TYPE, NAMED))
-
-/* ??? Unimplemented stuff follows. */
-
-/* ??? Add support for 16 byte/128 bit long doubles here when
- mips_abi != ABI32. */
-
-/* ??? Make main return zero if user did not specify return value. */
-
-/* ??? Add support for .interfaces section, so as to get linker warnings
- when stdarg functions called without prototype in scope? */
-
-/* ??? Could optimize structure passing by putting the right register rtx
- into the field decl, so that if we use the field, we can take the value from
- a register instead of from memory. */
-
diff --git a/gcc/config/mips/bsd-4.h b/gcc/config/mips/bsd-4.h
deleted file mode 100644
index 1542ddd3944..00000000000
--- a/gcc/config/mips/bsd-4.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS RISC-OS BSD version.
- Copyright (C) 1991 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. */
-
-#define MIPS_BSD43
-
-#define CPP_PREDEFINES "\
--Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_BSD43 \
--D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_BSD43 \
--Asystem(unix) -Asystem(bsd) -Acpu(mips) -Amachine(mips)"
-
-#define STANDARD_INCLUDE_DIR "/bsd43/usr/include"
-
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
--systype /bsd43/"
-
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc"
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s crtn.o%s}}"
-
-#define MACHINE_TYPE "RISC-OS BSD Mips"
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Override defaults for finding the MIPS tools. */
-#define MD_STARTFILE_PREFIX "/bsd43/usr/lib/cmplrs/cc/"
-#define MD_EXEC_PREFIX "/bsd43/usr/lib/cmplrs/cc/"
-
-#include "mips/mips.h"
diff --git a/gcc/config/mips/bsd-5.h b/gcc/config/mips/bsd-5.h
deleted file mode 100644
index 75a468da32c..00000000000
--- a/gcc/config/mips/bsd-5.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS RISC-OS, 5.0 BSD version.
- Copyright (C) 1991 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. */
-
-#define MIPS_BSD43
-
-#define CPP_PREDEFINES "\
--Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_BSD43 \
--D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_BSD43 \
--Asystem(unix) -Asystem(bsd) -Acpu(mips) -Amachine(mips)"
-
-#define STANDARD_INCLUDE_DIR "/bsd43/usr/include"
-
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
-%{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
--systype /bsd43/"
-
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc"
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s crtn.o%s}}"
-
-#define MACHINE_TYPE "RISC-OS BSD Mips"
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Override defaults for finding the MIPS tools. */
-#define MD_STARTFILE_PREFIX "/bsd43/usr/lib/cmplrs/cc/"
-#define MD_EXEC_PREFIX "/bsd43/usr/lib/cmplrs/cc/"
-
-#include "mips/mips.h"
-
-/* Some assemblers have a bug that causes backslash escaped chars in .ascii
- to be misassembled, so we just completely avoid it. */
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- unsigned char *s; \
- int i; \
- for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++) \
- { \
- if ((i % 8) == 0) \
- fputs ("\n\t.byte\t", (FILE)); \
- fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
- } \
- fputs ("\n", (FILE)); \
-} while (0)
diff --git a/gcc/config/mips/cross64.h b/gcc/config/mips/cross64.h
deleted file mode 100644
index fcbb16f34b3..00000000000
--- a/gcc/config/mips/cross64.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Configuration for an Irix 5 host and Irix 6 target using SGI's cross64
- package. */
-
-#include "mips/iris6.h"
-
-#define STANDARD_INCLUDE_DIR "/usr/cross64/usr/include"
-#undef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/cross64/usr/bin/"
-#undef MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/usr/cross64/usr/lib/lib64/"
-
-/* Must add TOOLROOT to the environment, or else the assembler will not
- work. */
-#define INIT_ENVIRONMENT \
- "TOOLROOT=/usr/cross64"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{mips1:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
- %{mips2:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
- %{!mips1:%{!mips2:%{pg:/usr/cross64/usr/lib64/mips4/gcrt1.o} \
- %{!pg:%{p:/usr/cross64/usr/lib64/mips4/mcrt1.o \
- /usr/cross64/usr/lib64/mips4/libprof1.a} \
- %{!p:/usr/cross64/usr/lib64/mips4/crt1.o}}}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "%{mips1:crtn.o%s}%{mips2:crtn.o%s}%{!mips1:%{!mips2:/usr/cross64/usr/lib64/mips4/crtn.o}}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "\
--64 -_SYSTYPE_SVR4 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
-%{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
-%{!mips1:%{!mips2:-L/usr/cross64/usr/lib64/mips4 -L/usr/cross64/usr/lib64}}"
diff --git a/gcc/config/mips/dec-bsd.h b/gcc/config/mips/dec-bsd.h
deleted file mode 100644
index 126353b25dd..00000000000
--- a/gcc/config/mips/dec-bsd.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Definitions for DECstation running BSD as target machine for GNU compiler.
- Copyright (C) 1993, 1995, 1996 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. */
-
-#define DECSTATION
-
-#ifndef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__ANSI_COMPAT \
--DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -Dbsd4_4 -Dhost_mips -Dmips \
--Dunix -D_mips -D_unix -D_host_mips -D_MIPSEL -D_R3000 \
--Asystem(unix) -Asystem(bsd) -Amachine(mips)"
-#endif
-
-/* Always uses GNU ld. */
-#ifndef LINK_SPEC
-#define LINK_SPEC "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3}"
-#endif
-
-#define LIB_SPEC ""
-#define STARTFILE_SPEC ""
-
-#ifndef MACHINE_TYPE
-#define MACHINE_TYPE "DECstation running BSD 4.4"
-#endif
-
-#define TARGET_DEFAULT MASK_GAS
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#include "mips/mips.h"
-
-/* Since gas and gld are standard on 4.4 BSD, we don't need these */
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-#undef ASM_FINAL_SPEC
-#undef LIB_SPEC
-#undef STARTFILE_SPEC
-
diff --git a/gcc/config/mips/dec-osf1.h b/gcc/config/mips/dec-osf1.h
deleted file mode 100644
index cc0e7e15a0a..00000000000
--- a/gcc/config/mips/dec-osf1.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Definitions of target machine for GNU compiler. DECstation (OSF/1) version.
- Copyright (C) 1992, 1996 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. */
-
-#define DEC_OSF1
-
-#define CPP_PREDEFINES "\
--D__ANSI_COMPAT -DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD \
--Dbsd4_2 -Dhost_mips -Dmips -Dosf -Dunix \
--Asystem(unix) -Asystem(xpg4) -Acpu(mips) -Amachine(mips)"
-
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
-%{!shared: %{!non_shared: %{!call_shared: -non_shared}}}"
-
-#include "mips/ultrix.h"
-
-/* Specify size_t and wchar_t types. */
-#undef SIZE_TYPE
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-
-#define SIZE_TYPE "long unsigned int"
-#define WCHAR_TYPE "short unsigned int"
-#define WCHAR_TYPE_SIZE SHORT_TYPE_SIZE
-
-#undef SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mlong64:-D__PTRDIFF_TYPE__=long\\ int} \
-%{!mlong64:-D__PTRDIFF_TYPE__=int}"
-
-/* turn off collect2 COFF support, since ldfcn now has elf declaration */
-#undef OBJECT_FORMAT_COFF
-
-#undef MACHINE_TYPE
-#define MACHINE_TYPE "DECstation running DEC OSF/1"
diff --git a/gcc/config/mips/ecoff.h b/gcc/config/mips/ecoff.h
deleted file mode 100644
index 29bf0380c1f..00000000000
--- a/gcc/config/mips/ecoff.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS version with
- GOFAST floating point library.
- Copyright (C) 1994 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. */
-
-#include "mips/mips.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmips -DMIPSEB -DR3000 -D_mips -D_MIPSEB -D_R3000"
-
-/* Use memcpy, et. al., rather than bcopy. */
-#define TARGET_MEM_FUNCTIONS
-
-/* US Software GOFAST library support. */
-#include "gofast.h"
-#define INIT_TARGET_OPTABS INIT_GOFAST_OPTABS
-
-/* Don't assume anything about startfiles. The linker script will load the
- appropriate startfiles. */
-#define STARTFILE_SPEC ""
diff --git a/gcc/config/mips/ecoffl.h b/gcc/config/mips/ecoffl.h
deleted file mode 100644
index 85663e95465..00000000000
--- a/gcc/config/mips/ecoffl.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Definitions of target machine for GNU compiler. Little endian MIPS
- version with GOFAST floating point library.
- Copyright (C) 1994 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 a little endian version of ecoff.h. */
-
-#define TARGET_ENDIAN_DEFAULT 0
-
-#include "mips/ecoff.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmips -DMIPSEL -DR3000 -D_mips -D_MIPSEL -D_R3000"
diff --git a/gcc/config/mips/elf.h b/gcc/config/mips/elf.h
deleted file mode 100644
index 8f5e32be396..00000000000
--- a/gcc/config/mips/elf.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS R3000 version with
- GOFAST floating point library.
- Copyright (C) 1994 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. */
-
-/* Use ELF. */
-#define OBJECT_FORMAT_ELF
-
-/* Until we figure out what MIPS ELF targets normally use, just do
- stabs in ELF. */
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* Mostly like ECOFF. */
-#include "mips/ecoff.h"
-
-/* We need to use .esize and .etype instead of .size and .type to
- avoid conflicting with ELF directives. */
-#undef PUT_SDB_SIZE
-#define PUT_SDB_SIZE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.esize\t%d;", (a)); \
-} while (0)
-
-#undef PUT_SDB_TYPE
-#define PUT_SDB_TYPE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
-} while (0)
-
-/* Biggest alignment supported by the object file format of this
- machine. Use this macro to limit the alignment which can be
- specified using the `__attribute__ ((aligned (N)))' construct. If
- not defined, the default value is `BIGGEST_ALIGNMENT'. */
-
-#define MAX_OFILE_ALIGNMENT (32768*8)
diff --git a/gcc/config/mips/elf64.h b/gcc/config/mips/elf64.h
deleted file mode 100644
index 358316c1c64..00000000000
--- a/gcc/config/mips/elf64.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS R4000 version with
- GOFAST floating point library.
- Copyright (C) 1994, 1995, 1996 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. */
-
-#define OBJECT_FORMAT_ELF
-
-/* Default to -mips3. */
-#define TARGET_DEFAULT MASK_FLOAT64|MASK_64BIT
-#define MIPS_ISA_DEFAULT 3
-
-#ifndef MULTILIB_DEFAULTS
-#ifndef TARGET_ENDIAN_DEFAULT
-#define MULTILIB_DEFAULTS { "EB", "mips3" }
-#else
-#define MULTILIB_DEFAULTS { "EL", "mips3" }
-#endif
-#endif
-
-/* Until we figure out what MIPS ELF targets normally use, just do
- stabs in ELF. */
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#include "mips/mips.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmips -DMIPSEB -DR4000 -D_mips -D_MIPSEB -D_R4000"
-
-/* I would rather put this in CPP_PREDEFINES, but the gcc driver
- doesn't handle -U options in CPP_PREDEFINES. */
-#undef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC "\
-%{!mips1:%{!mips2:-U__mips -D__mips=3 -D__mips64}}"
-
-/* Use memcpy, et. al., rather than bcopy. */
-#define TARGET_MEM_FUNCTIONS
-
-/* US Software GOFAST library support. */
-#include "gofast.h"
-#define INIT_TARGET_OPTABS INIT_GOFAST_OPTABS
-
-/* Biggest alignment supported by the object file format of this
- machine. Use this macro to limit the alignment which can be
- specified using the `__attribute__ ((aligned (N)))' construct. If
- not defined, the default value is `BIGGEST_ALIGNMENT'. */
-
-#define MAX_OFILE_ALIGNMENT (32768*8)
-
-/* We need to use .esize and .etype instead of .size and .type to
- avoid conflicting with ELF directives. */
-#undef PUT_SDB_SIZE
-#define PUT_SDB_SIZE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.esize\t%d;", (a)); \
-} while (0)
-
-#undef PUT_SDB_TYPE
-#define PUT_SDB_TYPE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
-} while (0)
-
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME) \
-do { \
- extern FILE *asm_out_text_file; \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
- else if ((DECL) && TREE_READONLY (DECL)) \
- fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \
- else \
- fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \
-} while (0)
diff --git a/gcc/config/mips/elfl.h b/gcc/config/mips/elfl.h
deleted file mode 100644
index 7575e3da5d8..00000000000
--- a/gcc/config/mips/elfl.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Definitions of target machine for GNU compiler. Little endian MIPS
- R3000 version with GOFAST floating point library.
- Copyright (C) 1994 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 a little endian version of elf.h. */
-
-#define TARGET_ENDIAN_DEFAULT 0
-
-#include "mips/elf.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmips -DMIPSEL -DR3000 -D_mips -D_MIPSEL -D_R3000"
diff --git a/gcc/config/mips/elfl64.h b/gcc/config/mips/elfl64.h
deleted file mode 100644
index 5e18c093208..00000000000
--- a/gcc/config/mips/elfl64.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Definitions of target machine for GNU compiler. Little endian MIPS
- R4000 version with GOFAST floating point library.
- Copyright (C) 1994 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 a little endian version of elf64.h. */
-
-#define TARGET_ENDIAN_DEFAULT 0
-
-#include "mips/elf64.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmips -DMIPSEL -DR4000 -D_mips -D_MIPSEL -D_R4000"
diff --git a/gcc/config/mips/elforion.h b/gcc/config/mips/elforion.h
deleted file mode 100644
index 4d90a4be4ad..00000000000
--- a/gcc/config/mips/elforion.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS ORION version with
- GOFAST floating point library.
- Copyright (C) 1994 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. */
-
-#define MIPS_CPU_STRING_DEFAULT "orion"
-
-#include "mips/elf64.h"
diff --git a/gcc/config/mips/gnu.h b/gcc/config/mips/gnu.h
deleted file mode 100644
index 039e05cd820..00000000000
--- a/gcc/config/mips/gnu.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS GNU Hurd version.
- Copyright (C) 1995, 1996 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. */
-
-#define TARGET_DEFAULT MASK_GAS
-
-#include <mips/mips.h>
-
-#undef SWITCH_TAKES_ARG
-#undef ASM_FILE_END
-#undef ASM_OUTPUT_IDENT
-#undef ASM_OUTPUT_SOURCE_LINE
-#undef READONLY_DATA_SECTION
-#undef SELECT_SECTION
-#undef ASM_DECLARE_FUNCTION_NAME
-#undef ASM_DECLARE_OBJECT_NAME
-/* #undef PREFERRED_DEBUGGING_TYPE */
-
-#include <svr4.h>
-
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (MIPS GNU/ELF)");
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- mips_asm_file_start (FILE); \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- } while (0)
-
-#undef ASM_FILE_END
-#define ASM_FILE_END(FILE) \
- do { \
- mips_asm_file_end(FILE); \
- fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \
- IDENT_ASM_OP, version_string); \
- } while (0)
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \
- do { \
- ++sym_lineno; \
- fprintf ((FILE), ".LM%d:\n\t%s %d,0,%d,.LM%d\n", \
- sym_lineno, ASM_STABN_OP, N_SLINE, (LINE), sym_lineno); \
- } while (0)
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
- do { \
- extern FILE *asm_out_text_file; \
- \
- if (TARGET_GP_OPT) \
- STREAM = asm_out_text_file; \
- fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (STREAM, NAME); \
- putc (',', STREAM); \
- fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', STREAM); \
- ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \
- HALF_PIC_DECLARE (NAME); \
- } while (0)
-
-/* Switch Recognition by gcc.c. Add -G xx support */
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
- (DEFAULT_SWITCH_TAKES_ARG(CHAR) || (CHAR) == 'G')
-
-#undef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 1
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(REGNO) mips_dbx_regno[ (REGNO) ]
-
-#define MIPS_GNU
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES GNU_CPP_PREDEFINES("mips") \
-"-DMIPSEB -DR3000 -D_MIPSEB -D_R3000 \
--D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32"
-
-#undef LINK_SPEC
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
-%{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
--systype /gnu/ "
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static}"
-
-#undef MACHINE_TYPE
-#define MACHINE_TYPE "GNU MIPS/ELF"
-
-#undef YES_UNDERSCORE
-
-#undef SDB_DEBUGGING_INFO
-#undef DBX_DEBUGGING_INFO
-#undef MIPS_DEBUGGING_INFO
-#define DWARF_DEBUGGING_INFO
-
-#define NO_MIPS_SELECT_SECTION
-
-/* Get machine-independent configuration parameters for the GNU system. */
-#include <gnu.h>
diff --git a/gcc/config/mips/iris3.h b/gcc/config/mips/iris3.h
deleted file mode 100644
index 8843d69dc81..00000000000
--- a/gcc/config/mips/iris3.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Definitions of target machine for GNU compiler. Iris version.
- Copyright (C) 1991, 1993, 1995, 1996 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. */
-
-#define SGI_TARGET 1 /* inform other mips files this is SGI */
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "\
--Dunix -Dmips -Dsgi -DSVR3 -Dhost_mips -DMIPSEB -DSYSTYPE_SYSV \
--Asystem(unix) -Asystem(svr3) -Acpu(mips) -Amachine(mips)"
-
-#define STARTFILE_SPEC "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
-
-#define SUBTARGET_CPP_SPEC "\
-%{!ansi:-D__EXTENSIONS__} -D_MIPSEB -D_SYSTYPE_SYSV"
-
-#define LIB_SPEC \
- "%{!p:%{!pg:%{!static:%{!g*:-lc_s}} -lc}}%{p:-lc_p}%{pg:-lc_p} crtn.o%s"
-
-#define MACHINE_TYPE "Silicon Graphics Mips"
-
-/* Always use 1 for .file number. I [meissner@osf.org] wonder why
- IRIS needs this. */
-
-#define SET_FILE_NUMBER() num_source_filenames = 1
-
-/* Put out a label after a .loc. I [meissner@osf.org] wonder why
- IRIS needs this. */
-
-#define LABEL_AFTER_LOC(STREAM) fprintf (STREAM, "LM%d:\n", ++sym_lineno)
-
-#define STACK_ARGS_ADJUST(SIZE) \
-{ \
- SIZE.constant += 4; \
- if (SIZE.constant < 32) \
- SIZE.constant = 32; \
-}
-
-/* Do not allow `$' in identifiers. */
-
-#define DOLLARS_IN_IDENTIFIERS 0
-
-/* Tell G++ not to create constructors or destructors with $'s in them. */
-
-#define NO_DOLLAR_IN_LABEL 1
-
-/* Specify wchar_t type. */
-#define WCHAR_TYPE "unsigned char"
-#define WCHAR_TYPE_SIZE BITS_PER_UNIT
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Plain char is unsigned in the SGI compiler. */
-#define DEFAULT_SIGNED_CHAR 0
-
-#include "mips/mips.h"
diff --git a/gcc/config/mips/iris4.h b/gcc/config/mips/iris4.h
deleted file mode 100644
index be121a4ee7f..00000000000
--- a/gcc/config/mips/iris4.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Definitions of target machine for GNU compiler. Iris version 4.
- Copyright (C) 1991, 1993 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. */
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-#include "mips/iris3.h"
-
-/* Profiling is supported via libprof1.a not -lc_p as in Irix 3. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}"
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{!p:%{!pg:%{!static:%{!g*:-lc_s}}}}%{p:libprof1.a%s}%{pg:libprof1.a%s} -lc crtn.o%s"
-
-/* Some assemblers have a bug that causes backslash escaped chars in .ascii
- to be misassembled, so we just completely avoid it. */
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- unsigned char *s; \
- int i; \
- for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++) \
- { \
- if ((i % 8) == 0) \
- fputs ("\n\t.byte\t", (FILE)); \
- fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
- } \
- fputs ("\n", (FILE)); \
-} while (0)
diff --git a/gcc/config/mips/iris4loser.h b/gcc/config/mips/iris4loser.h
deleted file mode 100644
index 971bb53be20..00000000000
--- a/gcc/config/mips/iris4loser.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Like iris4.h, but always inhibits assembler optimization for MIPS as.
- Use this via mips-sgi-iris4loser if you need it. */
-
-#define SUBTARGET_MIPS_AS_ASM_SPEC "-O0 %{v}"
-#define SUBTARGET_ASM_OPTIMIZING_SPEC ""
-
-#include "mips/iris4.h"
diff --git a/gcc/config/mips/iris5.h b/gcc/config/mips/iris5.h
deleted file mode 100644
index d7840b45a4a..00000000000
--- a/gcc/config/mips/iris5.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Definitions of target machine for GNU compiler. Iris version 5.
- Copyright (C) 1993, 1995, 1996 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. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT MASK_ABICALLS
-#endif
-#define ABICALLS_ASM_OP ".option pic2"
-
-#include "mips/iris4.h"
-
-/* Irix 5 doesn't use COFF, so disable special COFF handling in collect2.c. */
-#undef OBJECT_FORMAT_COFF
-
-/* ??? This is correct, but not very useful, because there is no file that
- uses this macro. */
-/* ??? The best way to handle global constructors under ELF is to use .init
- and .fini sections. Unfortunately, there is apparently no way to get
- the Irix 5.x (x <= 2) assembler to create these sections. So we instead
- use collect. The linker can create these sections via -init and -fini
- options, but using this would require modifying how crtstuff works, and
- I will leave that for another time (or someone else). */
-#define OBJECT_FORMAT_ELF
-#define HAS_INIT_SECTION
-#define LD_INIT_SWITCH "-init"
-#define LD_FINI_SWITCH "-fini"
-
-/* Specify wchar_t types. */
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-#undef MAX_WCHAR_TYPE_SIZE
-
-#define WCHAR_TYPE "long int"
-#define WCHAR_TYPE_SIZE LONG_TYPE_SIZE
-#define MAX_WCHAR_TYPE_SIZE MAX_LONG_TYPE_SIZE
-
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
- || !strcmp (STR, "rpath"))
-
-#undef SUBTARGET_CC1_SPEC
-#define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
-
-/* ??? _MIPS_SIM and _MIPS_SZPTR should eventually depend on options when
- options for them exist. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 \
- -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ \
- -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZPTR=32 \
- -Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(sgi)"
-
-#undef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC "\
-%{!ansi:-D__EXTENSIONS__ -D_SGI_SOURCE -D_LONGLONG} \
-%{!mfp64: -D_MIPS_FPSET=16}%{mfp64: -D_MIPS_FPSET=32} \
-%{mips1: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
-%{mips2: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
-%{mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \
-%{!mips1: %{!mips2: %{!mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS1}}} \
-%{!mint64: -D_MIPS_SZINT=32}%{mint64: -D_MIPS_SZINT=64} \
-%{!mlong64: -D_MIPS_SZLONG=32}%{mlong64: -D_MIPS_SZLONG=64}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
-%{static: -non_shared} \
-%{!static: \
- %{!shared:%{!non_shared:%{!call_shared: -call_shared -no_unresolved}}}} \
-%{rpath} \
--_SYSTYPE_SVR4"
-
-/* We now support shared libraries. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "\
-%{!static: \
- %{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}} \
-%{static: \
- %{pg:gcrt1.o%s} \
- %{!pg:%{p:/usr/lib/nonshared/mcrt1.o%s libprof1.a%s} \
- %{!p:/usr/lib/nonshared/crt1.o%s}}}"
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{!shared:%{p:-lprof1} %{pg:-lprof1} -lc}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "%{!shared:crtn.o%s}"
-
-/* We do not want to run mips-tfile! */
-#undef ASM_FINAL_SPEC
-
-/* The system header files are C++ aware. */
-/* ??? Unfortunately, most but not all of the headers are C++ aware.
- Specifically, curses.h is not, and as a consequence, defining this
- used to prevent libg++ building. This is no longer the case so
- define it again to prevent other problems, e.g. with getopt in
- unistd.h. We still need some way to fix just those files that need
- fixing. */
-#define NO_IMPLICIT_EXTERN_C 1
-
-/* We don't support debugging info for now. */
-#undef DBX_DEBUGGING_INFO
-#undef SDB_DEBUGGING_INFO
-#undef MIPS_DEBUGGING_INFO
-
-#undef MACHINE_TYPE
-#define MACHINE_TYPE "SGI running IRIX 5.x"
-
- /* Dollar signs are OK in Irix5 but not in Irix3. */
-#undef DOLLARS_IN_IDENTIFIERS
-#undef NO_DOLLAR_IN_LABEL
-
-/* -G is incompatible with -KPIC which is the default, so only allow objects
- in the small data section if the user explicitly asks for it. */
-#undef MIPS_DEFAULT_GVALUE
-#define MIPS_DEFAULT_GVALUE 0
-
-/* In Irix 5, we must output a `.global name .text' directive for every used
- but undefined function. If we don't, the linker may perform an optimization
- (skipping over the insns that set $gp) when it is unsafe. This is used
- indirectly by ASM_OUTPUT_EXTERNAL. */
-#define ASM_OUTPUT_UNDEF_FUNCTION(FILE, NAME) \
-do { \
- fputs ("\t.globl ", FILE); \
- assemble_name (FILE, NAME); \
- fputs (" .text\n", FILE); \
-} while (0)
-
-/* Also do this for libcalls. */
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
- mips_output_external_libcall (FILE, XSTR (FUN, 0))
-
-/* This does for functions what ASM_DECLARE_OBJECT_NAME does for variables.
- This is used indirectly by ASM_OUTPUT_EXTERNAL. */
-#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
-do { \
- tree name_tree = get_identifier (NAME); \
- TREE_ASM_WRITTEN (name_tree) = 1; \
-} while (0)
diff --git a/gcc/config/mips/iris5gas.h b/gcc/config/mips/iris5gas.h
deleted file mode 100644
index e519df72b25..00000000000
--- a/gcc/config/mips/iris5gas.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Definitions of target machine for GNU compiler. Irix version 5 with gas. */
-
-#include "mips/iris5.h"
-
-/* Enable debugging. */
-#define DBX_DEBUGGING_INFO
-#define SDB_DEBUGGING_INFO
-#define MIPS_DEBUGGING_INFO
-
-/* Irix 5 does not have some strange restrictions that Irix 3 had. */
-#undef SET_FILE_NUMBER
-#define SET_FILE_NUMBER() ++num_source_filenames
-#undef LABEL_AFTER_LOC
-#define LABEL_AFTER_LOC(STREAM)
-
-/* We need to use .esize and .etype instead of .size and .type to
- avoid conflicting with ELF directives. These are only recognized
- by gas, anyhow, not the native assembler. */
-#undef PUT_SDB_SIZE
-#define PUT_SDB_SIZE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.esize\t%d;", (a)); \
-} while (0)
-
-#undef PUT_SDB_TYPE
-#define PUT_SDB_TYPE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
-} while (0)
diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h
deleted file mode 100644
index 2c6070b426d..00000000000
--- a/gcc/config/mips/iris6.h
+++ /dev/null
@@ -1,523 +0,0 @@
-/* Definitions of target machine for GNU compiler. Iris version 6.
- Copyright (C) 1994, 1995, 1996 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. */
-
-/* Default to -mabi=n32 and -mips3. */
-#define MIPS_ISA_DEFAULT 3
-#define MIPS_ABI_DEFAULT ABI_N32
-#define MULTILIB_DEFAULTS { "mabi=n32" }
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT MASK_ABICALLS|MASK_FLOAT64|MASK_64BIT
-#endif
-
-#include "mips/iris5.h"
-#include "mips/abi64.h"
-
-/* For Irix 6, -mips3 implies TARGET_LONG64. */
-#undef TARGET_LONG64
-#define TARGET_LONG64 (mips_abi == ABI_64)
-
-#undef SUBTARGET_CC1_SPEC
-#define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
-
-/* We must pass -D_LONGLONG always, even when -ansi is used, because irix6
- system header files require it. This is OK, because gcc never warns
- when long long is used in system header files. Alternatively, we can
- add support for the SGI builtin type __long_long. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 \
- -D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ \
- -Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(sgi)"
-
-#undef SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=n32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=64: -D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-%{!mabi*: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}"
-
-/* We must make -mips3 do what -mlong64 used to do. */
-/* ??? If no mipsX option given, but a mabi=X option is, then should set
- _MIPS_ISA based on the mabi=X option. */
-/* ??? If no mabi=X option give, but a mipsX option is, then should set
- _MIPS_SIM based on the mipsX option. */
-/* ??? Same for _MIPS_SZINT. */
-/* ??? Same for _MIPS_SZPTR. */
-/* ??? Same for __SIZE_TYPE and __PTRDIFF_TYPE. */
-#undef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC "\
-%{!ansi:-D__EXTENSIONS__ -D_SGI_SOURCE} \
-%{mfp32: -D_MIPS_FPSET=16}%{!mfp32: -D_MIPS_FPSET=32} \
-%{mips1: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
-%{mips2: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
-%{mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \
-%{mips4: -D_MIPS_ISA=_MIPS_ISA_MIPS4} \
-%{!mips*: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \
-%{mabi=32: -D_MIPS_SIM=_MIPS_SIM_ABI32} \
-%{mabi=n32: -D_ABIN32=2 -D_MIPS_SIM=_ABIN32} \
-%{mabi=64: -D_ABI64=3 -D_MIPS_SIM=_ABI64} \
-%{!mabi*: -D_ABIN32=2 -D_MIPS_SIM=_ABIN32} \
-%{!mint64: -D_MIPS_SZINT=32}%{mint64: -D_MIPS_SZINT=64} \
-%{mabi=32: -D_MIPS_SZLONG=32} \
-%{mabi=n32: -D_MIPS_SZLONG=32} \
-%{mabi=64: -D_MIPS_SZLONG=64} \
-%{!mabi*: -D_MIPS_SZLONG=32} \
-%{mabi=32: -D_MIPS_SZPTR=32} \
-%{mabi=n32: -D_MIPS_SZPTR=32} \
-%{mabi=64: -D_MIPS_SZPTR=64} \
-%{!mabi*: -D_MIPS_SZPTR=32} \
-%{!mips1:%{!mips2: -D_COMPILER_VERSION=601}} \
-%{!mips*: -U__mips -D__mips=3} \
-%{mabi=32: -U__mips64} \
-%{mabi=n32: -D__mips64} \
-%{mabi=64: -D__mips64} \
-%{!mabi*: -D__mips64}"
-
-/* Irix 6 uses DWARF-2. */
-#define DWARF2_DEBUGGING_INFO
-#define MIPS_DEBUGGING_INFO
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-
-/* The size in bytes of a DWARF field indicating an offset or length
- relative to a debug info section, specified to be 4 bytes in the DWARF-2
- specification. The SGI/MIPS ABI defines it to be the same as PTR_SIZE. */
-#define DWARF_OFFSET_SIZE PTR_SIZE
-
-#undef MACHINE_TYPE
-#define MACHINE_TYPE "SGI running IRIX 6.x"
-
-/* The Irix 6.0.1 assembler doesn't like labels in the text section, so
- just avoid emitting them. */
-#define ASM_IDENTIFY_GCC
-#define ASM_IDENTIFY_LANGUAGE
-
-/* Irix 5 stuff that we don't need for Irix 6. */
-/* ??? We do need this for the -mabi=32 switch though. */
-#undef ASM_OUTPUT_UNDEF_FUNCTION
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-#undef ASM_DECLARE_FUNCTION_SIZE
-
-/* Stuff we need for Irix 6 that isn't in Irix 5. */
-
-/* The SGI assembler doesn't like labels before the .ent, so we must output
- the .ent and function name here, which is the normal place for it. */
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
- do { \
- fputs ("\t.ent\t", STREAM); \
- assemble_name (STREAM, NAME); \
- fputs ("\n", STREAM); \
- assemble_name (STREAM, NAME); \
- fputs (":\n", STREAM); \
- } while (0)
-
-/* Likewise, the SGI assembler doesn't like labels after the .end, so we
- must output the .end here. */
-#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
- do { \
- fputs ("\t.end\t", STREAM); \
- assemble_name (STREAM, NAME); \
- fputs ("\n", STREAM); \
- } while (0)
-
-/* Tell function_prologue in mips.c that we have already output the .ent/.end
- psuedo-ops. */
-#define FUNCTION_NAME_ALREADY_DECLARED
-
-#undef SET_ASM_OP /* Has no equivalent. See ASM_OUTPUT_DEF below. */
-
-#if 0
-/* This is *NOT* how to equate one symbol to another symbol. The assembler
- '=' syntax just equates a name to a constant expression.
- See ASM_OUTPUT_WEAK_ALIAS. */
-
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t"); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, " = "); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
- } while (0)
-#endif
-
-/* Define the strings used for the special svr4 .type and .size directives. */
-
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
- do { \
- fputs ("\t.weakext\t", FILE); \
- assemble_name (FILE, NAME); \
- if (VALUE) \
- { \
- fputc (' ', FILE); \
- assemble_name (FILE, VALUE); \
- } \
- fputc ('\n', FILE); \
- } while (0)
-
-#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
-
-#define POPSECTION_ASM_OP ".popsection"
-
-#define DEBUG_SECTION ".debug_info,0x7000001e,0,0,1"
-#define LINE_SECTION ".debug_line,0x7000001e,0,0,1"
-#define SFNAMES_SECTION ".debug_sfnames,0x7000001e,0,0,1"
-#define SRCINFO_SECTION ".debug_srcinfo,0x7000001e,0,0,1"
-#define MACINFO_SECTION ".debug_macinfo,0x7000001e,0,0,1"
-#define PUBNAMES_SECTION ".debug_pubnames,0x7000001e,0,0,1"
-#define ARANGES_SECTION ".debug_aranges,0x7000001e,0,0,1"
-#define FRAME_SECTION ".debug_frame,0x7000001e,0x08000000,0,1"
-#define ABBREV_SECTION ".debug_abbrev,0x7000001e,0,0,1"
-
-/* ??? If no mabi=X option give, but a mipsX option is, then should depend
- on the mipsX option. */
-#undef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC "%{!mabi*:-n32}"
-
-/* Must pass -g0 to the assembler, otherwise it may overwrite our
- debug info with its own debug info. */
-/* Must pass -show instead of -v. */
-/* Must pass -G 0 to the assembler, otherwise we may get warnings about
- GOT overflow. */
-/* ??? We pass -w to disable all assembler warnings. The `label should be
- inside .ent/.end block' warning that we get for DWARF II debug info labels
- is particularly annoying. */
-#undef SUBTARGET_MIPS_AS_ASM_SPEC
-#define SUBTARGET_MIPS_AS_ASM_SPEC "%{v:-show} -G 0 -w"
-
-#undef SUBTARGET_ASM_DEBUGGING_SPEC
-#define SUBTARGET_ASM_DEBUGGING_SPEC "-g0"
-
-/* Stuff for constructors. Start here. */
-
-/* The assembler now accepts .section pseudo-ops, but it does not allow
- one to change the section in the middle of a function, so we can't use
- the INIT_SECTION_ASM_OP code in crtstuff. But we can build up the ctor
- and dtor lists this way, so we use -init and -fini to invoke the
- do_global_* functions instead of running collect2. */
-
-#define BSS_SECTION_ASM_OP ".section\t.bss"
-#define CONST_SECTION_ASM_OP_32 "\t.rdata"
-#define CONST_SECTION_ASM_OP_64 ".section\t.rodata"
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,1,2,0,4"
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,1,2,0,4"
-
-/* This is the pseudo-op used to generate a 32-bit word of data with a
- specific value in some section. This is the same for all known svr4
- assemblers. */
-
-#define INT_ASM_OP ".word"
-
-/* A default list of other sections which we might be "in" at any given
- time. For targets that use additional sections (e.g. .tdesc) you
- should override this definition in the target-specific file which
- includes this file. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_rdata, in_const, in_ctors, in_dtors
-
-/* A default list of extra section function definitions. For targets
- that use additional sections (e.g. .tdesc) you should override this
- definition in the target-specific file which includes this file. */
-
-/* ??? rdata_section is now same as svr4 const_section. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-sdata_section () \
-{ \
- if (in_section != in_sdata) \
- { \
- fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
- in_section = in_sdata; \
- } \
-} \
- \
-void \
-rdata_section () \
-{ \
- if (in_section != in_rdata) \
- { \
- if (mips_abi != ABI_32) \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_64); \
- else \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_32); \
- in_section = in_rdata; \
- } \
-} \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. */
-
-#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME) \
-do { \
- extern FILE *asm_out_text_file; \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (asm_out_text_file, "\t.section %s,1,6,4,4\n", (NAME)); \
- else if ((DECL) && TREE_READONLY (DECL)) \
- fprintf (F, "\t.section %s,1,2,0,8\n", (NAME)); \
- else \
- fprintf (F, "\t.section %s,1,3,0,8\n", (NAME)); \
-} while (0)
-
-/* Stuff for constructors. End here. */
-
-/* ??? Perhaps just include svr4.h in this file? */
-
-/* ??? SGI assembler may core dump when compiling with -g.
- Sometimes as succeeds, but then we get a linker error. (cmds.c in 072.sc)
- Getting rid of .file solves both problems. */
-#undef ASM_OUTPUT_FILENAME
-#define ASM_OUTPUT_FILENAME(STREAM, NUM_SOURCE_FILENAMES, NAME) \
-do \
- { \
- fprintf (STREAM, "\t#.file\t%d ", NUM_SOURCE_FILENAMES); \
- output_quoted_string (STREAM, NAME); \
- fputs ("\n", STREAM); \
- } \
-while (0)
-
-/* ??? SGI assembler gives warning whenever .lcomm is used. */
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \
-do \
- { \
- if (mips_abi != ABI_32) \
- { \
- fprintf (STREAM, "%s\n", BSS_SECTION_ASM_OP); \
- mips_declare_object (STREAM, NAME, "", ":\n", 0); \
- ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
- ASM_OUTPUT_SKIP (STREAM, SIZE); \
- fprintf (STREAM, "\t%s\n", POPSECTION_ASM_OP); \
- } \
- else \
- mips_declare_object (STREAM, NAME, "\n\t.lcomm\t", ",%u\n", (SIZE)); \
- } \
-while (0)
-
-/* A C statement (sans semicolon) to output to the stdio stream
- FILE the assembler definition of uninitialized global DECL named
- NAME whose size is SIZE bytes and alignment is ALIGN bytes.
- Try to use asm_output_aligned_bss to implement this macro. */
-
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
- asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
-
-/* Write the extra assembler code needed to declare an object properly. */
-
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
-do \
- { \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (STREAM, NAME); \
- fprintf (STREAM, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- mips_declare_object (STREAM, NAME, "", ":\n", 0); \
- } \
-while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } while (0)
-
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX (mips_abi == ABI_32 ? "$" : ".")
-
-/* Profiling is supported via libprof1.a not -lc_p as in Irix 3. */
-/* ??? If no mabi=X option give, but a mipsX option is, then should depend
- on the mipsX option. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!static:%{!shared: \
- %{mabi=32:%{pg:gcrt1.o%s} \
- %{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
- %{mabi=n32: \
- %{mips4:%{pg:/usr/lib32/mips4/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips4/mcrt1.o%s /usr/lib32/mips4/libprof1.a%s} \
- %{!p:/usr/lib32/mips4/crt1.o%s}}} \
- %{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
- %{!p:/usr/lib32/mips3/crt1.o%s}}}} \
- %{mabi=64: \
- %{mips4:%{pg:/usr/lib64/mips4/gcrt1.o} \
- %{!pg:%{p:/usr/lib64/mips4/mcrt1.o /usr/lib64/mips4/libprof1.a} \
- %{!p:/usr/lib64/mips4/crt1.o}}} \
- %{!mips4:%{pg:/usr/lib64/mips3/gcrt1.o} \
- %{!pg:%{p:/usr/lib64/mips3/mcrt1.o /usr/lib64/mips3/libprof1.a} \
- %{!p:/usr/lib64/mips3/crt1.o}}}} \
- %{!mabi*: \
- %{mips4:%{pg:/usr/lib32/mips4/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips4/mcrt1.o%s /usr/lib32/mips4/libprof1.a%s} \
- %{!p:/usr/lib32/mips4/crt1.o%s}}} \
- %{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
- %{!p:/usr/lib32/mips3/crt1.o%s}}}}}} \
- %{static: \
- %{mabi=32:%{pg:/usr/lib/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib/nonshared/mcrt1.o%s /usr/lib/nonshared/libprof1.a%s} \
- %{!p:/usr/lib/nonshared/crt1.o%s}}} \
- %{mabi=n32: \
- %{mips4:%{pg:/usr/lib32/mips4/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips4/nonshared/mcrt1.o%s \
- /usr/lib32/mips4/nonshared/libprof1.a%s} \
- %{!p:/usr/lib32/mips4/nonshared/crt1.o%s}}} \
- %{!mips4:%{pg:/usr/lib32/mips3/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips3/nonshared/mcrt1.o%s \
- /usr/lib32/mips3/nonshared/libprof1.a%s} \
- %{!p:/usr/lib32/mips3/nonshared/crt1.o%s}}}} \
- %{mabi=64: \
- %{mips4:%{pg:/usr/lib64/mips4/nonshared/gcrt1.o} \
- %{!pg:%{p:/usr/lib64/mips4/nonshared/mcrt1.o \
- /usr/lib64/mips4/nonshared/libprof1.a} \
- %{!p:/usr/lib64/mips4/nonshared/crt1.o}}} \
- %{!mips4:%{pg:/usr/lib64/mips3/nonshared/gcrt1.o} \
- %{!pg:%{p:/usr/lib64/mips3/nonshared/mcrt1.o \
- /usr/lib64/mips3/nonshared/libprof1.a} \
- %{!p:/usr/lib64/mips3/nonshared/crt1.o}}}} \
- %{!mabi*: \
- %{mips4:%{pg:/usr/lib32/mips4/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips4/nonshared/mcrt1.o%s \
- /usr/lib32/mips4/nonshared/libprof1.a%s} \
- %{!p:/usr/lib32/mips4/nonshared/crt1.o%s}}} \
- %{!mips4:%{pg:/usr/lib32/mips3/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips3/nonshared/mcrt1.o%s \
- /usr/lib32/mips3/nonshared/libprof1.a%s} \
- %{!pg:%{p:/usr/lib32/mips3/nonshared/mcrt1.o%s \
- /usr/lib32/mips3/nonshared/libprof1.a%s} \
- %{!p:/usr/lib32/mips3/nonshared/crt1.o%s}}}}}} \
- %{mabi=n32: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
- -L/usr/lib32} \
- %{mabi=64: %{mips4:-L/usr/lib64/mips4} %{!mips4:-L/usr/lib64/mips3} \
- -L/usr/lib64} \
- %{!mabi*: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
- -L/usr/lib32} \
- crtbegin.o%s"
-
-#undef LIB_SPEC
-#define LIB_SPEC "\
-%{!shared: \
- -dont_warn_unused %{p:libprof1.a%s}%{pg:libprof1.a%s} -lc -warn_unused}"
-
-/* Avoid getting two warnings for libgcc.a everytime we link. */
-#undef LIBGCC_SPEC
-#define LIBGCC_SPEC "-dont_warn_unused -lgcc -warn_unused"
-
-/* ??? If no mabi=X option give, but a mipsX option is, then should depend
- on the mipsX option. */
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "crtend.o%s \
- %{!shared: \
- %{mabi=32:crtn.o%s}\
- %{mabi=n32:%{mips4:/usr/lib32/mips4/crtn.o%s}\
- %{!mips4:/usr/lib32/mips3/crtn.o%s}}\
- %{mabi=64:%{mips4:/usr/lib64/mips4/crtn.o%s}\
- %{!mips4:/usr/lib64/mips3/crtn.o%s}}\
- %{!mabi*:%{mips4:/usr/lib32/mips4/crtn.o%s}\
- %{!mips4:/usr/lib32/mips3/crtn.o%s}}}"
-
-/* ??? If no mabi=X option give, but a mipsX option is, then should depend
- on the mipsX option. */
-#undef LINK_SPEC
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} %{w} \
-%{static: -non_shared} \
-%{!static: \
- %{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}}} \
-%{rpath} -init __do_global_ctors -fini __do_global_dtors \
-%{shared:-hidden_symbol __do_global_ctors,__do_global_dtors} \
--_SYSTYPE_SVR4 %{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64} %{!mabi*: -n32}"
diff --git a/gcc/config/mips/mips-5.h b/gcc/config/mips/mips-5.h
deleted file mode 100644
index f8b0941b035..00000000000
--- a/gcc/config/mips/mips-5.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS RISC-OS 5.0
- default version.
- Copyright (C) 1992 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. */
-
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
-%{!shared: %{!non_shared: %{!call_shared: -non_shared}}}"
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s crtn.o%s}}"
-
-#include "mips/mips.h"
-
-/* Some assemblers have a bug that causes backslash escaped chars in .ascii
- to be misassembled, so we just completely avoid it. */
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- unsigned char *s; \
- int i; \
- for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++) \
- { \
- if ((i % 8) == 0) \
- fputs ("\n\t.byte\t", (FILE)); \
- fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
- } \
- fputs ("\n", (FILE)); \
-} while (0)
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
deleted file mode 100644
index dd65b958f3e..00000000000
--- a/gcc/config/mips/mips.c
+++ /dev/null
@@ -1,6121 +0,0 @@
-/* Subroutines for insn-output.c for MIPS
- Copyright (C) 1989, 90, 91, 93-95, 1996 Free Software Foundation, Inc.
- Contributed by A. Lichnewsky, lich@inria.inria.fr.
- Changes by Michael Meissner, meissner@osf.org.
- 64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and
- Brendan Eich, brendan@microunity.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 TARGET_FP_CALL_32 macros are intended to simulate a 32 bit
- calling convention in 64 bit mode. It doesn't work though, and should
- be replaced with something better designed. */
-
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "insn-attr.h"
-#include "insn-codes.h"
-#include "recog.h"
-#include "output.h"
-
-#undef MAX /* sys/param.h may also define these */
-#undef MIN
-
-#include <stdio.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <ctype.h>
-#include "tree.h"
-#include "expr.h"
-#include "flags.h"
-
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#endif
-
-#if defined(USG) || defined(NO_STAB_H)
-#include "gstab.h" /* If doing DBX on sysV, use our own stab.h. */
-#else
-#include <stab.h> /* On BSD, use the system's stab.h. */
-#endif /* not USG */
-
-#ifdef __GNU_STAB__
-#define STAB_CODE_TYPE enum __stab_debug_code
-#else
-#define STAB_CODE_TYPE int
-#endif
-
-extern void abort ();
-extern int atoi ();
-extern char *getenv ();
-extern char *mktemp ();
-
-extern rtx adj_offsettable_operand ();
-extern rtx copy_to_reg ();
-extern void error ();
-extern void fatal ();
-extern tree lookup_name ();
-extern void pfatal_with_name ();
-extern void warning ();
-
-extern FILE *asm_out_file;
-
-/* Enumeration for all of the relational tests, so that we can build
- arrays indexed by the test type, and not worry about the order
- of EQ, NE, etc. */
-
-enum internal_test {
- ITEST_EQ,
- ITEST_NE,
- ITEST_GT,
- ITEST_GE,
- ITEST_LT,
- ITEST_LE,
- ITEST_GTU,
- ITEST_GEU,
- ITEST_LTU,
- ITEST_LEU,
- ITEST_MAX
- };
-
-/* Global variables for machine-dependent things. */
-
-/* Threshold for data being put into the small data/bss area, instead
- of the normal data area (references to the small data/bss area take
- 1 instruction, and use the global pointer, references to the normal
- data area takes 2 instructions). */
-int mips_section_threshold = -1;
-
-/* Count the number of .file directives, so that .loc is up to date. */
-int num_source_filenames = 0;
-
-/* Count the number of sdb related labels are generated (to find block
- start and end boundaries). */
-int sdb_label_count = 0;
-
-/* Next label # for each statement for Silicon Graphics IRIS systems. */
-int sym_lineno = 0;
-
-/* Non-zero if inside of a function, because the stupid MIPS asm can't
- handle .files inside of functions. */
-int inside_function = 0;
-
-/* Files to separate the text and the data output, so that all of the data
- can be emitted before the text, which will mean that the assembler will
- generate smaller code, based on the global pointer. */
-FILE *asm_out_data_file;
-FILE *asm_out_text_file;
-
-/* Linked list of all externals that are to be emitted when optimizing
- for the global pointer if they haven't been declared by the end of
- the program with an appropriate .comm or initialization. */
-
-struct extern_list {
- struct extern_list *next; /* next external */
- char *name; /* name of the external */
- int size; /* size in bytes */
-} *extern_head = 0;
-
-/* Name of the file containing the current function. */
-char *current_function_file = "";
-
-/* Warning given that Mips ECOFF can't support changing files
- within a function. */
-int file_in_function_warning = FALSE;
-
-/* Whether to suppress issuing .loc's because the user attempted
- to change the filename within a function. */
-int ignore_line_number = FALSE;
-
-/* Number of nested .set noreorder, noat, nomacro, and volatile requests. */
-int set_noreorder;
-int set_noat;
-int set_nomacro;
-int set_volatile;
-
-/* The next branch instruction is a branch likely, not branch normal. */
-int mips_branch_likely;
-
-/* Count of delay slots and how many are filled. */
-int dslots_load_total;
-int dslots_load_filled;
-int dslots_jump_total;
-int dslots_jump_filled;
-
-/* # of nops needed by previous insn */
-int dslots_number_nops;
-
-/* Number of 1/2/3 word references to data items (ie, not jal's). */
-int num_refs[3];
-
-/* registers to check for load delay */
-rtx mips_load_reg, mips_load_reg2, mips_load_reg3, mips_load_reg4;
-
-/* Cached operands, and operator to compare for use in set/branch on
- condition codes. */
-rtx branch_cmp[2];
-
-/* what type of branch to use */
-enum cmp_type branch_type;
-
-/* Number of previously seen half-pic pointers and references. */
-static int prev_half_pic_ptrs = 0;
-static int prev_half_pic_refs = 0;
-
-/* which cpu are we scheduling for */
-enum processor_type mips_cpu;
-
-/* which instruction set architecture to use. */
-int mips_isa;
-
-#ifdef MIPS_ABI_DEFAULT
-/* which ABI to use. This is defined to a constant in mips.h if the target
- doesn't support multiple ABIs. */
-enum mips_abi_type mips_abi;
-#endif
-
-/* Strings to hold which cpu and instruction set architecture to use. */
-char *mips_cpu_string; /* for -mcpu=<xxx> */
-char *mips_isa_string; /* for -mips{1,2,3,4} */
-char *mips_abi_string; /* for -mabi={o32,32,n32,n64,64,eabi} */
-
-/* If TRUE, we split addresses into their high and low parts in the RTL. */
-int mips_split_addresses;
-
-/* Generating calls to position independent functions? */
-enum mips_abicalls_type mips_abicalls;
-
-/* High and low marks for floating point values which we will accept
- as legitimate constants for LEGITIMATE_CONSTANT_P. These are
- initialized in override_options. */
-REAL_VALUE_TYPE dfhigh, dflow, sfhigh, sflow;
-
-/* Array giving truth value on whether or not a given hard register
- can support a given mode. */
-char mips_hard_regno_mode_ok[(int)MAX_MACHINE_MODE][FIRST_PSEUDO_REGISTER];
-
-/* Current frame information calculated by compute_frame_size. */
-struct mips_frame_info current_frame_info;
-
-/* Zero structure to initialize current_frame_info. */
-struct mips_frame_info zero_frame_info;
-
-/* Temporary filename used to buffer .text until end of program
- for -mgpopt. */
-static char *temp_filename;
-
-/* Pseudo-reg holding the address of the current function when
- generating embedded PIC code. Created by LEGITIMIZE_ADDRESS, used
- by mips_finalize_pic if it was created. */
-rtx embedded_pic_fnaddr_rtx;
-
-/* List of all MIPS punctuation characters used by print_operand. */
-char mips_print_operand_punct[256];
-
-/* Map GCC register number to debugger register number. */
-int mips_dbx_regno[FIRST_PSEUDO_REGISTER];
-
-/* Buffer to use to enclose a load/store operation with %{ %} to
- turn on .set volatile. */
-static char volatile_buffer[60];
-
-/* Hardware names for the registers. If -mrnames is used, this
- will be overwritten with mips_sw_reg_names. */
-
-char mips_reg_names[][8] =
-{
- "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7",
- "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15",
- "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23",
- "$24", "$25", "$26", "$27", "$28", "$sp", "$fp", "$31",
- "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7",
- "$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15",
- "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",
- "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31",
- "hi", "lo", "accum","$fcc0","$fcc1","$fcc2","$fcc3","$fcc4",
- "$fcc5","$fcc6","$fcc7","$rap"
-};
-
-/* Mips software names for the registers, used to overwrite the
- mips_reg_names array. */
-
-char mips_sw_reg_names[][8] =
-{
- "$zero","$at", "$v0", "$v1", "$a0", "$a1", "$a2", "$a3",
- "$t0", "$t1", "$t2", "$t3", "$t4", "$t5", "$t6", "$t7",
- "$s0", "$s1", "$s2", "$s3", "$s4", "$s5", "$s6", "$s7",
- "$t8", "$t9", "$k0", "$k1", "$gp", "$sp", "$fp", "$ra",
- "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7",
- "$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15",
- "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",
- "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31",
- "hi", "lo", "accum","$fcc0","$fcc1","$fcc2","$fcc3","$fcc4",
- "$fcc5","$fcc6","$fcc7","$rap"
-};
-
-/* Map hard register number to register class */
-enum reg_class mips_regno_to_class[] =
-{
- GR_REGS, GR_REGS, GR_REGS, GR_REGS,
- GR_REGS, GR_REGS, GR_REGS, GR_REGS,
- GR_REGS, GR_REGS, GR_REGS, GR_REGS,
- GR_REGS, GR_REGS, GR_REGS, GR_REGS,
- GR_REGS, GR_REGS, GR_REGS, GR_REGS,
- GR_REGS, GR_REGS, GR_REGS, GR_REGS,
- GR_REGS, GR_REGS, GR_REGS, GR_REGS,
- GR_REGS, GR_REGS, GR_REGS, GR_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- HI_REG, LO_REG, HILO_REG, ST_REGS,
- ST_REGS, ST_REGS, ST_REGS, ST_REGS,
- ST_REGS, ST_REGS, ST_REGS, GR_REGS
-};
-
-/* Map register constraint character to register class. */
-enum reg_class mips_char_to_class[256] =
-{
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
- NO_REGS, NO_REGS, NO_REGS, NO_REGS,
-};
-
-
-/* Return truth value of whether OP can be used as an operands
- where a register or 16 bit unsigned integer is needed. */
-
-int
-uns_arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT && SMALL_INT_UNSIGNED (op))
- return TRUE;
-
- return register_operand (op, mode);
-}
-
-/* Return truth value of whether OP can be used as an operands
- where a 16 bit integer is needed */
-
-int
-arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT && SMALL_INT (op))
- return TRUE;
-
- return register_operand (op, mode);
-}
-
-/* Return truth value of whether OP can be used as an operand in a two
- address arithmetic insn (such as set 123456,%o4) of mode MODE. */
-
-int
-arith32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return TRUE;
-
- return register_operand (op, mode);
-}
-
-/* Return truth value of whether OP is a integer which fits in 16 bits */
-
-int
-small_int (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && SMALL_INT (op));
-}
-
-/* Return truth value of whether OP is a 32 bit integer which is too big to
- be loaded with one instruction. */
-
-int
-large_int (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- HOST_WIDE_INT value;
-
- if (GET_CODE (op) != CONST_INT)
- return FALSE;
-
- value = INTVAL (op);
- if ((value & ~0x0000ffff) == 0) /* ior reg,$r0,value */
- return FALSE;
-
- if (((unsigned long)(value + 32768)) <= 32767) /* subu reg,$r0,value */
- return FALSE;
-
- if ((value & 0x0000ffff) == 0) /* lui reg,value>>16 */
- return FALSE;
-
- return TRUE;
-}
-
-/* Return truth value of whether OP is a register or the constant 0. */
-
-int
-reg_or_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- default:
- break;
-
- case CONST_INT:
- return (INTVAL (op) == 0);
-
- case CONST_DOUBLE:
- if (op != CONST0_RTX (mode))
- return FALSE;
-
- return TRUE;
-
- case REG:
- case SUBREG:
- return register_operand (op, mode);
- }
-
- return FALSE;
-}
-
-/* Return truth value if a CONST_DOUBLE is ok to be a legitimate constant. */
-
-int
-mips_const_double_ok (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- REAL_VALUE_TYPE d;
-
- if (GET_CODE (op) != CONST_DOUBLE)
- return FALSE;
-
- if (mode == VOIDmode)
- return TRUE;
-
- if (mode != SFmode && mode != DFmode)
- return FALSE;
-
- if (op == CONST0_RTX (mode))
- return TRUE;
-
- /* ??? li.s does not work right with SGI's Irix 6 assembler. */
- if (mips_abi != ABI_32 && mips_abi != ABI_EABI)
- return FALSE;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, op);
-
- if (REAL_VALUE_ISNAN (d))
- return FALSE;
-
- if (REAL_VALUE_NEGATIVE (d))
- d = REAL_VALUE_NEGATE (d);
-
- if (mode == DFmode)
- {
- if (REAL_VALUES_LESS (d, dfhigh)
- && REAL_VALUES_LESS (dflow, d))
- return TRUE;
- }
- else
- {
- if (REAL_VALUES_LESS (d, sfhigh)
- && REAL_VALUES_LESS (sflow, d))
- return TRUE;
- }
-
- return FALSE;
-}
-
-/* Accept the floating point constant 1 in the appropriate mode. */
-
-int
-const_float_1_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- REAL_VALUE_TYPE d;
- static REAL_VALUE_TYPE onedf;
- static REAL_VALUE_TYPE onesf;
- static int one_initialized;
-
- if (GET_CODE (op) != CONST_DOUBLE
- || mode != GET_MODE (op)
- || (mode != DFmode && mode != SFmode))
- return FALSE;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, op);
-
- /* We only initialize these values if we need them, since we will
- never get called unless mips_isa >= 4. */
- if (! one_initialized)
- {
- onedf = REAL_VALUE_ATOF ("1.0", DFmode);
- onesf = REAL_VALUE_ATOF ("1.0", SFmode);
- one_initialized = TRUE;
- }
-
- if (mode == DFmode)
- return REAL_VALUES_EQUAL (d, onedf);
- else
- return REAL_VALUES_EQUAL (d, onesf);
-}
-
-/* Return truth value if a memory operand fits in a single instruction
- (ie, register + small offset). */
-
-int
-simple_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- rtx addr, plus0, plus1;
-
- /* Eliminate non-memory operations */
- if (GET_CODE (op) != MEM)
- return FALSE;
-
- /* dword operations really put out 2 instructions, so eliminate them. */
- /* ??? This isn't strictly correct. It is OK to accept multiword modes
- here, since the length attributes are being set correctly, but only
- if the address is offsettable. LO_SUM is not offsettable. */
- if (GET_MODE_SIZE (GET_MODE (op)) > UNITS_PER_WORD)
- return FALSE;
-
- /* Decode the address now. */
- addr = XEXP (op, 0);
- switch (GET_CODE (addr))
- {
- default:
- break;
-
- case REG:
- case LO_SUM:
- return TRUE;
-
- case CONST_INT:
- return SMALL_INT (op);
-
- case PLUS:
- plus0 = XEXP (addr, 0);
- plus1 = XEXP (addr, 1);
- if (GET_CODE (plus0) == REG
- && GET_CODE (plus1) == CONST_INT
- && SMALL_INT (plus1))
- return TRUE;
-
- else if (GET_CODE (plus1) == REG
- && GET_CODE (plus0) == CONST_INT
- && SMALL_INT (plus0))
- return TRUE;
-
- else
- return FALSE;
-
-#if 0
- /* We used to allow small symbol refs here (ie, stuff in .sdata
- or .sbss), but this causes some bugs in G++. Also, it won't
- interfere if the MIPS linker rewrites the store instruction
- because the function is PIC. */
-
- case LABEL_REF: /* never gp relative */
- break;
-
- case CONST:
- /* If -G 0, we can never have a GP relative memory operation.
- Also, save some time if not optimizing. */
- if (!TARGET_GP_OPT)
- return FALSE;
-
- {
- rtx offset = const0_rtx;
- addr = eliminate_constant_term (XEXP (addr, 0), &offset);
- if (GET_CODE (op) != SYMBOL_REF)
- return FALSE;
-
- /* let's be paranoid.... */
- if (! SMALL_INT (offset))
- return FALSE;
- }
- /* fall through */
-
- case SYMBOL_REF:
- return SYMBOL_REF_FLAG (addr);
-#endif
- }
-
- return FALSE;
-}
-
-/* Return true if the code of this rtx pattern is EQ or NE. */
-
-int
-equality_op (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (mode != GET_MODE (op))
- return FALSE;
-
- return (GET_CODE (op) == EQ || GET_CODE (op) == NE);
-}
-
-/* Return true if the code is a relational operations (EQ, LE, etc.) */
-
-int
-cmp_op (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (mode != GET_MODE (op))
- return FALSE;
-
- return (GET_RTX_CLASS (GET_CODE (op)) == '<');
-}
-
-/* Return true if the operand is either the PC or a label_ref. */
-
-int
-pc_or_label_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (op == pc_rtx)
- return TRUE;
-
- if (GET_CODE (op) == LABEL_REF)
- return TRUE;
-
- return FALSE;
-}
-
-/* Test for a valid operand for a call instruction.
- Don't allow the arg pointer register or virtual regs
- since they may change into reg + const, which the patterns
- can't handle yet. */
-
-int
-call_insn_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (CONSTANT_ADDRESS_P (op)
- || (GET_CODE (op) == REG && op != arg_pointer_rtx
- && ! (REGNO (op) >= FIRST_PSEUDO_REGISTER
- && REGNO (op) <= LAST_VIRTUAL_REGISTER)))
- return 1;
- return 0;
-}
-
-/* Return true if OPERAND is valid as a source operand for a move
- instruction. */
-
-int
-move_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (general_operand (op, mode)
- && ! (mips_split_addresses && mips_check_split (op, mode)));
-}
-
-/* Return true if OPERAND is valid as a source operand for movdi.
- This accepts not only general_operand, but also sign extended
- constants and registers. We need to accept sign extended constants
- in case a sign extended register which is used in an expression,
- and is equivalent to a constant, is spilled. */
-
-int
-movdi_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (TARGET_64BIT
- && mode == DImode
- && GET_CODE (op) == SIGN_EXTEND
- && GET_MODE (op) == DImode
- && (GET_MODE (XEXP (op, 0)) == SImode
- || (GET_CODE (XEXP (op, 0)) == CONST_INT
- && GET_MODE (XEXP (op, 0)) == VOIDmode))
- && (register_operand (XEXP (op, 0), SImode)
- || immediate_operand (XEXP (op, 0), SImode)))
- return 1;
-
- return general_operand (op, mode);
-}
-
-/* Like register_operand, but when in 64 bit mode also accept a sign
- extend of a 32 bit register, since the value is known to be already
- sign extended. */
-
-int
-se_register_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (TARGET_64BIT
- && mode == DImode
- && GET_CODE (op) == SIGN_EXTEND
- && GET_MODE (op) == DImode
- && GET_MODE (XEXP (op, 0)) == SImode
- && register_operand (XEXP (op, 0), SImode))
- return 1;
-
- return register_operand (op, mode);
-}
-
-/* Like reg_or_0_operand, but when in 64 bit mode also accept a sign
- extend of a 32 bit register, since the value is known to be already
- sign extended. */
-
-int
-se_reg_or_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (TARGET_64BIT
- && mode == DImode
- && GET_CODE (op) == SIGN_EXTEND
- && GET_MODE (op) == DImode
- && GET_MODE (XEXP (op, 0)) == SImode
- && register_operand (XEXP (op, 0), SImode))
- return 1;
-
- return reg_or_0_operand (op, mode);
-}
-
-/* Like uns_arith_operand, but when in 64 bit mode also accept a sign
- extend of a 32 bit register, since the value is known to be already
- sign extended. */
-
-int
-se_uns_arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (TARGET_64BIT
- && mode == DImode
- && GET_CODE (op) == SIGN_EXTEND
- && GET_MODE (op) == DImode
- && GET_MODE (XEXP (op, 0)) == SImode
- && register_operand (XEXP (op, 0), SImode))
- return 1;
-
- return uns_arith_operand (op, mode);
-}
-
-/* Like arith_operand, but when in 64 bit mode also accept a sign
- extend of a 32 bit register, since the value is known to be already
- sign extended. */
-
-int
-se_arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (TARGET_64BIT
- && mode == DImode
- && GET_CODE (op) == SIGN_EXTEND
- && GET_MODE (op) == DImode
- && GET_MODE (XEXP (op, 0)) == SImode
- && register_operand (XEXP (op, 0), SImode))
- return 1;
-
- return arith_operand (op, mode);
-}
-
-/* Like nonmemory_operand, but when in 64 bit mode also accept a sign
- extend of a 32 bit register, since the value is known to be already
- sign extended. */
-
-int
-se_nonmemory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (TARGET_64BIT
- && mode == DImode
- && GET_CODE (op) == SIGN_EXTEND
- && GET_MODE (op) == DImode
- && GET_MODE (XEXP (op, 0)) == SImode
- && register_operand (XEXP (op, 0), SImode))
- return 1;
-
- return nonmemory_operand (op, mode);
-}
-
-/* Like nonimmediate_operand, but when in 64 bit mode also accept a
- sign extend of a 32 bit register, since the value is known to be
- already sign extended. */
-
-int
-se_nonimmediate_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (TARGET_64BIT
- && mode == DImode
- && GET_CODE (op) == SIGN_EXTEND
- && GET_MODE (op) == DImode
- && GET_MODE (XEXP (op, 0)) == SImode
- && register_operand (XEXP (op, 0), SImode))
- return 1;
-
- return nonimmediate_operand (op, mode);
-}
-
-/* Return true if we split the address into high and low parts. */
-
-/* ??? We should also handle reg+array somewhere. We get four
- instructions currently, lui %hi/addui %lo/addui reg/lw. Better is
- lui %hi/addui reg/lw %lo. Fixing GO_IF_LEGITIMATE_ADDRESS to accept
- (plus (reg) (symbol_ref)) doesn't work because the SYMBOL_REF is broken
- out of the address, then we have 4 instructions to combine. Perhaps
- add a 3->2 define_split for combine. */
-
-/* ??? We could also split a CONST_INT here if it is a large_int().
- However, it doesn't seem to be very useful to have %hi(constant).
- We would be better off by doing the masking ourselves and then putting
- the explicit high part of the constant in the RTL. This will give better
- optimization. Also, %hi(constant) needs assembler changes to work.
- There is already a define_split that does this. */
-
-int
-mips_check_split (address, mode)
- rtx address;
- enum machine_mode mode;
-{
- /* ??? This is the same check used in simple_memory_operand.
- We use it here because LO_SUM is not offsettable. */
- if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
- return 0;
-
- if ((GET_CODE (address) == SYMBOL_REF && ! SYMBOL_REF_FLAG (address))
- || (GET_CODE (address) == CONST
- && GET_CODE (XEXP (XEXP (address, 0), 0)) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (XEXP (XEXP (address, 0), 0)))
- || GET_CODE (address) == LABEL_REF)
- return 1;
-
- return 0;
-}
-
-/* Returns an operand string for the given instruction's delay slot,
- after updating filled delay slot statistics.
-
- We assume that operands[0] is the target register that is set.
-
- In order to check the next insn, most of this functionality is moved
- to FINAL_PRESCAN_INSN, and we just set the global variables that
- it needs. */
-
-/* ??? This function no longer does anything useful, because final_prescan_insn
- now will never emit a nop. */
-
-char *
-mips_fill_delay_slot (ret, type, operands, cur_insn)
- char *ret; /* normal string to return */
- enum delay_type type; /* type of delay */
- rtx operands[]; /* operands to use */
- rtx cur_insn; /* current insn */
-{
- register rtx set_reg;
- register enum machine_mode mode;
- register rtx next_insn = (cur_insn) ? NEXT_INSN (cur_insn) : (rtx)0;
- register int num_nops;
-
- if (type == DELAY_LOAD || type == DELAY_FCMP)
- num_nops = 1;
-
- else if (type == DELAY_HILO)
- num_nops = 2;
-
- else
- num_nops = 0;
-
- /* Make sure that we don't put nop's after labels. */
- next_insn = NEXT_INSN (cur_insn);
- while (next_insn != (rtx)0 && GET_CODE (next_insn) == NOTE)
- next_insn = NEXT_INSN (next_insn);
-
- dslots_load_total += num_nops;
- if (TARGET_DEBUG_F_MODE
- || !optimize
- || type == DELAY_NONE
- || operands == (rtx *)0
- || cur_insn == (rtx)0
- || next_insn == (rtx)0
- || GET_CODE (next_insn) == CODE_LABEL
- || (set_reg = operands[0]) == (rtx)0)
- {
- dslots_number_nops = 0;
- mips_load_reg = (rtx)0;
- mips_load_reg2 = (rtx)0;
- mips_load_reg3 = (rtx)0;
- mips_load_reg4 = (rtx)0;
- return ret;
- }
-
- set_reg = operands[0];
- if (set_reg == (rtx)0)
- return ret;
-
- while (GET_CODE (set_reg) == SUBREG)
- set_reg = SUBREG_REG (set_reg);
-
- mode = GET_MODE (set_reg);
- dslots_number_nops = num_nops;
- mips_load_reg = set_reg;
- if (GET_MODE_SIZE (mode)
- > (FP_REG_P (REGNO (set_reg)) ? UNITS_PER_FPREG : UNITS_PER_WORD))
- mips_load_reg2 = gen_rtx (REG, SImode, REGNO (set_reg) + 1);
- else
- mips_load_reg2 = 0;
-
- if (type == DELAY_HILO)
- {
- mips_load_reg3 = gen_rtx (REG, SImode, MD_REG_FIRST);
- mips_load_reg4 = gen_rtx (REG, SImode, MD_REG_FIRST+1);
- }
- else
- {
- mips_load_reg3 = 0;
- mips_load_reg4 = 0;
- }
-
- return ret;
-}
-
-
-/* Determine whether a memory reference takes one (based off of the GP pointer),
- two (normal), or three (label + reg) instructions, and bump the appropriate
- counter for -mstats. */
-
-void
-mips_count_memory_refs (op, num)
- rtx op;
- int num;
-{
- int additional = 0;
- int n_words = 0;
- rtx addr, plus0, plus1;
- enum rtx_code code0, code1;
- int looping;
-
- if (TARGET_DEBUG_B_MODE)
- {
- fprintf (stderr, "\n========== mips_count_memory_refs:\n");
- debug_rtx (op);
- }
-
- /* Skip MEM if passed, otherwise handle movsi of address. */
- addr = (GET_CODE (op) != MEM) ? op : XEXP (op, 0);
-
- /* Loop, going through the address RTL */
- do
- {
- looping = FALSE;
- switch (GET_CODE (addr))
- {
- default:
- break;
-
- case REG:
- case CONST_INT:
- case LO_SUM:
- break;
-
- case PLUS:
- plus0 = XEXP (addr, 0);
- plus1 = XEXP (addr, 1);
- code0 = GET_CODE (plus0);
- code1 = GET_CODE (plus1);
-
- if (code0 == REG)
- {
- additional++;
- addr = plus1;
- looping = TRUE;
- continue;
- }
-
- if (code0 == CONST_INT)
- {
- addr = plus1;
- looping = TRUE;
- continue;
- }
-
- if (code1 == REG)
- {
- additional++;
- addr = plus0;
- looping = TRUE;
- continue;
- }
-
- if (code1 == CONST_INT)
- {
- addr = plus0;
- looping = TRUE;
- continue;
- }
-
- if (code0 == SYMBOL_REF || code0 == LABEL_REF || code0 == CONST)
- {
- addr = plus0;
- looping = TRUE;
- continue;
- }
-
- if (code1 == SYMBOL_REF || code1 == LABEL_REF || code1 == CONST)
- {
- addr = plus1;
- looping = TRUE;
- continue;
- }
-
- break;
-
- case LABEL_REF:
- n_words = 2; /* always 2 words */
- break;
-
- case CONST:
- addr = XEXP (addr, 0);
- looping = TRUE;
- continue;
-
- case SYMBOL_REF:
- n_words = SYMBOL_REF_FLAG (addr) ? 1 : 2;
- break;
- }
- }
- while (looping);
-
- if (n_words == 0)
- return;
-
- n_words += additional;
- if (n_words > 3)
- n_words = 3;
-
- num_refs[n_words-1] += num;
-}
-
-
-/* Return RTL for the offset from the current function to the
- argument. */
-
-rtx
-embedded_pic_offset (x)
- rtx x;
-{
- if (embedded_pic_fnaddr_rtx == NULL)
- {
- rtx seq;
-
- embedded_pic_fnaddr_rtx = gen_reg_rtx (Pmode);
-
- /* Output code at function start to initialize the pseudo-reg. */
- /* ??? We used to do this in FINALIZE_PIC, but that does not work for
- inline functions, because it is called after RTL for the function
- has been copied. The pseudo-reg in embedded_pic_fnaddr_rtx however
- does not get copied, and ends up not matching the rest of the RTL.
- This solution works, but means that we get unnecessary code to
- initialize this value every time a function is inlined into another
- function. */
- start_sequence ();
- emit_insn (gen_get_fnaddr (embedded_pic_fnaddr_rtx,
- XEXP (DECL_RTL (current_function_decl), 0)));
- seq = gen_sequence ();
- end_sequence ();
- push_topmost_sequence ();
- emit_insn_after (seq, get_insns ());
- pop_topmost_sequence ();
- }
-
- return gen_rtx (CONST, Pmode,
- gen_rtx (MINUS, Pmode, x,
- XEXP (DECL_RTL (current_function_decl), 0)));
-}
-
-/* Return the appropriate instructions to move one operand to another. */
-
-char *
-mips_move_1word (operands, insn, unsignedp)
- rtx operands[];
- rtx insn;
- int unsignedp;
-{
- char *ret = 0;
- rtx op0 = operands[0];
- rtx op1 = operands[1];
- enum rtx_code code0 = GET_CODE (op0);
- enum rtx_code code1 = GET_CODE (op1);
- enum machine_mode mode = GET_MODE (op0);
- int subreg_word0 = 0;
- int subreg_word1 = 0;
- enum delay_type delay = DELAY_NONE;
-
- while (code0 == SUBREG)
- {
- subreg_word0 += SUBREG_WORD (op0);
- op0 = SUBREG_REG (op0);
- code0 = GET_CODE (op0);
- }
-
- while (code1 == SUBREG)
- {
- subreg_word1 += SUBREG_WORD (op1);
- op1 = SUBREG_REG (op1);
- code1 = GET_CODE (op1);
- }
-
- /* For our purposes, a condition code mode is the same as SImode. */
- if (mode == CCmode)
- mode = SImode;
-
- if (code0 == REG)
- {
- int regno0 = REGNO (op0) + subreg_word0;
-
- if (code1 == REG)
- {
- int regno1 = REGNO (op1) + subreg_word1;
-
- /* Just in case, don't do anything for assigning a register
- to itself, unless we are filling a delay slot. */
- if (regno0 == regno1 && set_nomacro == 0)
- ret = "";
-
- else if (GP_REG_P (regno0))
- {
- if (GP_REG_P (regno1))
- ret = "move\t%0,%1";
-
- else if (MD_REG_P (regno1))
- {
- delay = DELAY_HILO;
- if (regno1 != HILO_REGNUM)
- ret = "mf%1\t%0";
- else
- ret = "mflo\t%0";
- }
-
- else if (ST_REG_P (regno1) && mips_isa >= 4)
- ret = "li\t%0,1\n\tmovf\t%0,%.,%1";
-
- else
- {
- delay = DELAY_LOAD;
- if (FP_REG_P (regno1))
- ret = "mfc1\t%0,%1";
-
- else if (regno1 == FPSW_REGNUM && mips_isa < 4)
- ret = "cfc1\t%0,$31";
- }
- }
-
- else if (FP_REG_P (regno0))
- {
- if (GP_REG_P (regno1))
- {
- delay = DELAY_LOAD;
- ret = "mtc1\t%1,%0";
- }
-
- if (FP_REG_P (regno1))
- ret = "mov.s\t%0,%1";
- }
-
- else if (MD_REG_P (regno0))
- {
- if (GP_REG_P (regno1))
- {
- delay = DELAY_HILO;
- if (regno0 != HILO_REGNUM)
- ret = "mt%0\t%1";
- }
- }
-
- else if (regno0 == FPSW_REGNUM && mips_isa < 4)
- {
- if (GP_REG_P (regno1))
- {
- delay = DELAY_LOAD;
- ret = "ctc1\t%0,$31";
- }
- }
- }
-
- else if (code1 == MEM)
- {
- delay = DELAY_LOAD;
-
- if (TARGET_STATS)
- mips_count_memory_refs (op1, 1);
-
- if (GP_REG_P (regno0))
- {
- /* For loads, use the mode of the memory item, instead of the
- target, so zero/sign extend can use this code as well. */
- switch (GET_MODE (op1))
- {
- default:
- break;
- case SFmode:
- ret = "lw\t%0,%1";
- break;
- case SImode:
- case CCmode:
- ret = ((unsignedp && TARGET_64BIT)
- ? "lwu\t%0,%1"
- : "lw\t%0,%1");
- break;
- case HImode:
- ret = (unsignedp) ? "lhu\t%0,%1" : "lh\t%0,%1";
- break;
- case QImode:
- ret = (unsignedp) ? "lbu\t%0,%1" : "lb\t%0,%1";
- break;
- }
- }
-
- else if (FP_REG_P (regno0) && (mode == SImode || mode == SFmode))
- ret = "l.s\t%0,%1";
-
- if (ret != (char *)0 && MEM_VOLATILE_P (op1))
- {
- int i = strlen (ret);
- if (i > sizeof (volatile_buffer) - sizeof ("%{%}"))
- abort ();
-
- sprintf (volatile_buffer, "%%{%s%%}", ret);
- ret = volatile_buffer;
- }
- }
-
- else if (code1 == CONST_INT
- || (code1 == CONST_DOUBLE
- && GET_MODE (op1) == VOIDmode))
- {
- if (code1 == CONST_DOUBLE)
- {
- /* This can happen when storing constants into long long
- bitfields. Just store the least significant word of
- the value. */
- operands[1] = op1 = GEN_INT (CONST_DOUBLE_LOW (op1));
- }
-
- if (INTVAL (op1) == 0)
- {
- if (GP_REG_P (regno0))
- ret = "move\t%0,%z1";
-
- else if (FP_REG_P (regno0))
- {
- delay = DELAY_LOAD;
- ret = "mtc1\t%z1,%0";
- }
-
- else if (MD_REG_P (regno0))
- {
- delay = DELAY_HILO;
- ret = "mt%0\t%.";
- }
- }
-
- else if (GP_REG_P (regno0))
- /* Don't use X format, because that will give out of range
- numbers for 64 bit host and 32 bit target. */
- ret = "li\t%0,%1\t\t\t# %X1";
- }
-
- else if (code1 == CONST_DOUBLE && mode == SFmode)
- {
- if (op1 == CONST0_RTX (SFmode))
- {
- if (GP_REG_P (regno0))
- ret = "move\t%0,%.";
-
- else if (FP_REG_P (regno0))
- {
- delay = DELAY_LOAD;
- ret = "mtc1\t%.,%0";
- }
- }
-
- else
- {
- delay = DELAY_LOAD;
- ret = "li.s\t%0,%1";
- }
- }
-
- else if (code1 == LABEL_REF)
- {
- if (TARGET_STATS)
- mips_count_memory_refs (op1, 1);
-
- ret = "la\t%0,%a1";
- }
-
- else if (code1 == SYMBOL_REF || code1 == CONST)
- {
- if (HALF_PIC_P () && CONSTANT_P (op1) && HALF_PIC_ADDRESS_P (op1))
- {
- rtx offset = const0_rtx;
-
- if (GET_CODE (op1) == CONST)
- op1 = eliminate_constant_term (XEXP (op1, 0), &offset);
-
- if (GET_CODE (op1) == SYMBOL_REF)
- {
- operands[2] = HALF_PIC_PTR (op1);
-
- if (TARGET_STATS)
- mips_count_memory_refs (operands[2], 1);
-
- if (INTVAL (offset) == 0)
- {
- delay = DELAY_LOAD;
- ret = (unsignedp && TARGET_64BIT
- ? "lwu\t%0,%2"
- : "lw\t%0,%2");
- }
- else
- {
- dslots_load_total++;
- operands[3] = offset;
- if (unsignedp && TARGET_64BIT)
- ret = (SMALL_INT (offset))
- ? "lwu\t%0,%2%#\n\tadd\t%0,%0,%3"
- : "lwu\t%0,%2%#\n\t%[li\t%@,%3\n\tadd\t%0,%0,%@%]";
- else
- ret = (SMALL_INT (offset))
- ? "lw\t%0,%2%#\n\tadd\t%0,%0,%3"
- : "lw\t%0,%2%#\n\t%[li\t%@,%3\n\tadd\t%0,%0,%@%]";
- }
- }
- }
- else
- {
- if (TARGET_STATS)
- mips_count_memory_refs (op1, 1);
-
- ret = "la\t%0,%a1";
- }
- }
-
- else if (code1 == PLUS)
- {
- rtx add_op0 = XEXP (op1, 0);
- rtx add_op1 = XEXP (op1, 1);
-
- if (GET_CODE (XEXP (op1, 1)) == REG && GET_CODE (XEXP (op1, 0)) == CONST_INT)
- {
- add_op0 = XEXP (op1, 1); /* reverse operands */
- add_op1 = XEXP (op1, 0);
- }
-
- operands[2] = add_op0;
- operands[3] = add_op1;
- ret = "add%:\t%0,%2,%3";
- }
-
- else if (code1 == HIGH)
- {
- operands[1] = XEXP (op1, 0);
- ret = "lui\t%0,%%hi(%1)";
- }
- }
-
- else if (code0 == MEM)
- {
- if (TARGET_STATS)
- mips_count_memory_refs (op0, 1);
-
- if (code1 == REG)
- {
- int regno1 = REGNO (op1) + subreg_word1;
-
- if (GP_REG_P (regno1))
- {
- switch (mode)
- {
- default: break;
- case SFmode: ret = "sw\t%1,%0"; break;
- case SImode: ret = "sw\t%1,%0"; break;
- case HImode: ret = "sh\t%1,%0"; break;
- case QImode: ret = "sb\t%1,%0"; break;
- }
- }
-
- else if (FP_REG_P (regno1) && (mode == SImode || mode == SFmode))
- ret = "s.s\t%1,%0";
- }
-
- else if (code1 == CONST_INT && INTVAL (op1) == 0)
- {
- switch (mode)
- {
- default: break;
- case SFmode: ret = "sw\t%z1,%0"; break;
- case SImode: ret = "sw\t%z1,%0"; break;
- case HImode: ret = "sh\t%z1,%0"; break;
- case QImode: ret = "sb\t%z1,%0"; break;
- }
- }
-
- else if (code1 == CONST_DOUBLE && op1 == CONST0_RTX (mode))
- {
- switch (mode)
- {
- default: break;
- case SFmode: ret = "sw\t%.,%0"; break;
- case SImode: ret = "sw\t%.,%0"; break;
- case HImode: ret = "sh\t%.,%0"; break;
- case QImode: ret = "sb\t%.,%0"; break;
- }
- }
-
- if (ret != (char *)0 && MEM_VOLATILE_P (op0))
- {
- int i = strlen (ret);
- if (i > sizeof (volatile_buffer) - sizeof ("%{%}"))
- abort ();
-
- sprintf (volatile_buffer, "%%{%s%%}", ret);
- ret = volatile_buffer;
- }
- }
-
- if (ret == (char *)0)
- {
- abort_with_insn (insn, "Bad move");
- return 0;
- }
-
- if (delay != DELAY_NONE)
- return mips_fill_delay_slot (ret, delay, operands, insn);
-
- return ret;
-}
-
-
-/* Return the appropriate instructions to move 2 words */
-
-char *
-mips_move_2words (operands, insn)
- rtx operands[];
- rtx insn;
-{
- char *ret = 0;
- rtx op0 = operands[0];
- rtx op1 = operands[1];
- enum rtx_code code0 = GET_CODE (operands[0]);
- enum rtx_code code1 = GET_CODE (operands[1]);
- int subreg_word0 = 0;
- int subreg_word1 = 0;
- enum delay_type delay = DELAY_NONE;
-
- while (code0 == SUBREG)
- {
- subreg_word0 += SUBREG_WORD (op0);
- op0 = SUBREG_REG (op0);
- code0 = GET_CODE (op0);
- }
-
- if (code1 == SIGN_EXTEND)
- {
- op1 = XEXP (op1, 0);
- code1 = GET_CODE (op1);
- }
-
- while (code1 == SUBREG)
- {
- subreg_word1 += SUBREG_WORD (op1);
- op1 = SUBREG_REG (op1);
- code1 = GET_CODE (op1);
- }
-
- /* Sanity check. */
- if (GET_CODE (operands[1]) == SIGN_EXTEND
- && code1 != REG
- && code1 != CONST_INT
- /* The following three can happen as the result of a questionable
- cast. */
- && code1 != LABEL_REF
- && code1 != SYMBOL_REF
- && code1 != CONST)
- abort ();
-
- if (code0 == REG)
- {
- int regno0 = REGNO (op0) + subreg_word0;
-
- if (code1 == REG)
- {
- int regno1 = REGNO (op1) + subreg_word1;
-
- /* Just in case, don't do anything for assigning a register
- to itself, unless we are filling a delay slot. */
- if (regno0 == regno1 && set_nomacro == 0)
- ret = "";
-
- else if (FP_REG_P (regno0))
- {
- if (FP_REG_P (regno1))
- ret = "mov.d\t%0,%1";
-
- else
- {
- delay = DELAY_LOAD;
- if (TARGET_FLOAT64)
- {
- if (!TARGET_64BIT)
- abort_with_insn (insn, "Bad move");
-#ifdef TARGET_FP_CALL_32
- if (FP_CALL_GP_REG_P (regno1))
- ret = "dsll\t%1,32\n\tor\t%1,%D1\n\tdmtc1\t%1,%0";
- else
-#endif
- ret = "dmtc1\t%1,%0";
- }
- else
- ret = "mtc1\t%L1,%0\n\tmtc1\t%M1,%D0";
- }
- }
-
- else if (FP_REG_P (regno1))
- {
- delay = DELAY_LOAD;
- if (TARGET_FLOAT64)
- {
- if (!TARGET_64BIT)
- abort_with_insn (insn, "Bad move");
-#ifdef TARGET_FP_CALL_32
- if (FP_CALL_GP_REG_P (regno0))
- ret = "dmfc1\t%0,%1\n\tmfc1\t%D0,%1\n\tdsrl\t%0,32";
- else
-#endif
- ret = "dmfc1\t%0,%1";
- }
- else
- ret = "mfc1\t%L0,%1\n\tmfc1\t%M0,%D1";
- }
-
- else if (MD_REG_P (regno0) && GP_REG_P (regno1))
- {
- delay = DELAY_HILO;
- if (TARGET_64BIT)
- {
- if (regno0 != HILO_REGNUM)
- ret = "mt%0\t%1";
- else if (regno1 == 0)
- ret = "mtlo\t%.\n\tmthi\t%.";
- }
- else
- ret = "mthi\t%M1\n\tmtlo\t%L1";
- }
-
- else if (GP_REG_P (regno0) && MD_REG_P (regno1))
- {
- delay = DELAY_HILO;
- if (TARGET_64BIT)
- {
- if (regno1 != HILO_REGNUM)
- ret = "mf%1\t%0";
- }
- else
- ret = "mfhi\t%M0\n\tmflo\t%L0";
- }
-
- else if (TARGET_64BIT)
- ret = "move\t%0,%1";
-
- else if (regno0 != (regno1+1))
- ret = "move\t%0,%1\n\tmove\t%D0,%D1";
-
- else
- ret = "move\t%D0,%D1\n\tmove\t%0,%1";
- }
-
- else if (code1 == CONST_DOUBLE)
- {
- /* Move zero from $0 unless !TARGET_64BIT and recipient
- is 64-bit fp reg, in which case generate a constant. */
- if (op1 != CONST0_RTX (GET_MODE (op1))
- || (TARGET_FLOAT64 && !TARGET_64BIT && FP_REG_P (regno0)))
- {
- if (GET_MODE (op1) == DFmode)
- {
- delay = DELAY_LOAD;
-#ifdef TARGET_FP_CALL_32
- if (FP_CALL_GP_REG_P (regno0))
- {
- if (TARGET_FLOAT64 && !TARGET_64BIT)
- {
- split_double (op1, operands + 2, operands + 3);
- ret = "li\t%0,%2\n\tli\t%D0,%3";
- }
- else
- ret = "li.d\t%0,%1\n\tdsll\t%D0,%0,32\n\tdsrl\t%D0,32\n\tdsrl\t%0,32";
- }
- else
-#endif
- ret = "li.d\t%0,%1";
- }
-
- else if (TARGET_64BIT)
- ret = "dli\t%0,%1";
-
- else
- {
- split_double (op1, operands + 2, operands + 3);
- ret = "li\t%0,%2\n\tli\t%D0,%3";
- }
- }
-
- else
- {
- if (GP_REG_P (regno0))
- ret = (TARGET_64BIT
-#ifdef TARGET_FP_CALL_32
- && ! FP_CALL_GP_REG_P (regno0)
-#endif
- )
- ? "move\t%0,%."
- : "move\t%0,%.\n\tmove\t%D0,%.";
-
- else if (FP_REG_P (regno0))
- {
- delay = DELAY_LOAD;
- ret = (TARGET_64BIT)
- ? "dmtc1\t%.,%0"
- : "mtc1\t%.,%0\n\tmtc1\t%.,%D0";
- }
- }
- }
-
- else if (code1 == CONST_INT && INTVAL (op1) == 0)
- {
- if (GP_REG_P (regno0))
- ret = (TARGET_64BIT)
- ? "move\t%0,%."
- : "move\t%0,%.\n\tmove\t%D0,%.";
-
- else if (FP_REG_P (regno0))
- {
- delay = DELAY_LOAD;
- ret = (TARGET_64BIT)
- ? "dmtc1\t%.,%0"
- : (TARGET_FLOAT64
- ? "li.d\t%0,%1"
- : "mtc1\t%.,%0\n\tmtc1\t%.,%D0");
- }
- else if (MD_REG_P (regno0))
- {
- delay = DELAY_HILO;
- if (regno0 != HILO_REGNUM)
- ret = "mt%0\t%.\n";
- else
- ret = "mtlo\t%.\n\tmthi\t%.";
- }
- }
-
- else if (code1 == CONST_INT && GET_MODE (op0) == DImode && GP_REG_P (regno0))
- {
- if (TARGET_64BIT)
- {
- if (GET_CODE (operands[1]) == SIGN_EXTEND)
- ret = "li\t%0,%1\t\t# %X1";
- else if (HOST_BITS_PER_WIDE_INT < 64)
- /* We can't use 'X' for negative numbers, because then we won't
- get the right value for the upper 32 bits. */
- ret = ((INTVAL (op1) < 0) ? "dli\t%0,%1\t\t\t# %X1"
- : "dli\t%0,%X1\t\t# %1");
- else
- /* We must use 'X', because otherwise LONG_MIN will print as
- a number that the assembler won't accept. */
- ret = "dli\t%0,%X1\t\t# %1";
- }
- else if (HOST_BITS_PER_WIDE_INT < 64)
- {
- operands[2] = GEN_INT (INTVAL (operands[1]) >= 0 ? 0 : -1);
- ret = "li\t%M0,%2\n\tli\t%L0,%1";
- }
- else
- {
- /* We use multiple shifts here, to avoid warnings about out
- of range shifts on 32 bit hosts. */
- operands[2] = GEN_INT (INTVAL (operands[1]) >> 16 >> 16);
- operands[1] = GEN_INT (INTVAL (operands[1]) << 16 << 16 >> 16 >> 16);
- ret = "li\t%M0,%2\n\tli\t%L0,%1";
- }
- }
-
- else if (code1 == MEM)
- {
- delay = DELAY_LOAD;
-
- if (TARGET_STATS)
- mips_count_memory_refs (op1, 2);
-
- if (FP_REG_P (regno0))
- ret = "l.d\t%0,%1";
-
- else if (TARGET_64BIT)
- {
-#ifdef TARGET_FP_CALL_32
- if (FP_CALL_GP_REG_P (regno0))
- {
- if (offsettable_address_p (FALSE, SImode, op1))
- ret = "lwu\t%0,%1\n\tlwu\t%D0,4+%1";
- else
- ret = "ld\t%0,%1\n\tdsll\t%D0,%0,32\n\tdsrl\t%D0,32\n\tdsrl\t%0,32";
- }
- else
-#endif
- ret = "ld\t%0,%1";
- }
-
- else if (offsettable_address_p (1, DFmode, XEXP (op1, 0)))
- {
- operands[2] = adj_offsettable_operand (op1, 4);
- if (reg_mentioned_p (op0, op1))
- ret = "lw\t%D0,%2\n\tlw\t%0,%1";
- else
- ret = "lw\t%0,%1\n\tlw\t%D0,%2";
- }
-
- if (ret != (char *)0 && MEM_VOLATILE_P (op1))
- {
- int i = strlen (ret);
- if (i > sizeof (volatile_buffer) - sizeof ("%{%}"))
- abort ();
-
- sprintf (volatile_buffer, "%%{%s%%}", ret);
- ret = volatile_buffer;
- }
- }
-
- else if (code1 == LABEL_REF
- || code1 == SYMBOL_REF
- || code1 == CONST)
- {
- if (TARGET_STATS)
- mips_count_memory_refs (op1, 2);
-
- if (GET_CODE (operands[1]) == SIGN_EXTEND)
- /* We deliberately remove the 'a' from '%1', so that we don't
- have to add SIGN_EXTEND support to print_operand_address.
- print_operand will just call print_operand_address in this
- case, so there is no problem. */
- ret = "la\t%0,%1";
- else
- ret = "dla\t%0,%a1";
- }
- }
-
- else if (code0 == MEM)
- {
- if (code1 == REG)
- {
- int regno1 = REGNO (op1) + subreg_word1;
-
- if (FP_REG_P (regno1))
- ret = "s.d\t%1,%0";
-
- else if (TARGET_64BIT)
- {
-#ifdef TARGET_FP_CALL_32
- if (FP_CALL_GP_REG_P (regno1))
- ret = "dsll\t%1,32\n\tor\t%1,%D1\n\tsd\t%1,%0";
- else
-#endif
- ret = "sd\t%1,%0";
- }
-
- else if (offsettable_address_p (1, DFmode, XEXP (op0, 0)))
- {
- operands[2] = adj_offsettable_operand (op0, 4);
- ret = "sw\t%1,%0\n\tsw\t%D1,%2";
- }
- }
-
- else if (((code1 == CONST_INT && INTVAL (op1) == 0)
- || (code1 == CONST_DOUBLE
- && op1 == CONST0_RTX (GET_MODE (op1))))
- && (TARGET_64BIT
- || offsettable_address_p (1, DFmode, XEXP (op0, 0))))
- {
- if (TARGET_64BIT)
- ret = "sd\t%.,%0";
- else
- {
- operands[2] = adj_offsettable_operand (op0, 4);
- ret = "sw\t%.,%0\n\tsw\t%.,%2";
- }
- }
-
- if (TARGET_STATS)
- mips_count_memory_refs (op0, 2);
-
- if (ret != (char *)0 && MEM_VOLATILE_P (op0))
- {
- int i = strlen (ret);
- if (i > sizeof (volatile_buffer) - sizeof ("%{%}"))
- abort ();
-
- sprintf (volatile_buffer, "%%{%s%%}", ret);
- ret = volatile_buffer;
- }
- }
-
- if (ret == (char *)0)
- {
- abort_with_insn (insn, "Bad move");
- return 0;
- }
-
- if (delay != DELAY_NONE)
- return mips_fill_delay_slot (ret, delay, operands, insn);
-
- return ret;
-}
-
-
-/* Provide the costs of an addressing mode that contains ADDR.
- If ADDR is not a valid address, its cost is irrelevant. */
-
-int
-mips_address_cost (addr)
- rtx addr;
-{
- switch (GET_CODE (addr))
- {
- default:
- break;
-
- case LO_SUM:
- return 1;
-
- case LABEL_REF:
- return 2;
-
- case CONST:
- {
- rtx offset = const0_rtx;
- addr = eliminate_constant_term (XEXP (addr, 0), &offset);
- if (GET_CODE (addr) == LABEL_REF)
- return 2;
-
- if (GET_CODE (addr) != SYMBOL_REF)
- return 4;
-
- if (! SMALL_INT (offset))
- return 2;
- }
- /* fall through */
-
- case SYMBOL_REF:
- return SYMBOL_REF_FLAG (addr) ? 1 : 2;
-
- case PLUS:
- {
- register rtx plus0 = XEXP (addr, 0);
- register rtx plus1 = XEXP (addr, 1);
-
- if (GET_CODE (plus0) != REG && GET_CODE (plus1) == REG)
- {
- plus0 = XEXP (addr, 1);
- plus1 = XEXP (addr, 0);
- }
-
- if (GET_CODE (plus0) != REG)
- break;
-
- switch (GET_CODE (plus1))
- {
- default:
- break;
-
- case CONST_INT:
- return (SMALL_INT (plus1) ? 1 : 2);
-
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- case HIGH:
- case LO_SUM:
- return mips_address_cost (plus1) + 1;
- }
- }
- }
-
- return 4;
-}
-
-/* Return true if X is an address which needs a temporary register when
- reloaded while generating PIC code. */
-
-int
-pic_address_needs_scratch (x)
- rtx x;
-{
- /* An address which is a symbolic plus a non SMALL_INT needs a temp reg. */
- if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && ! SMALL_INT (XEXP (XEXP (x, 0), 1)))
- return 1;
-
- return 0;
-}
-
-/* Make normal rtx_code into something we can index from an array */
-
-static enum internal_test
-map_test_to_internal_test (test_code)
- enum rtx_code test_code;
-{
- enum internal_test test = ITEST_MAX;
-
- switch (test_code)
- {
- default: break;
- case EQ: test = ITEST_EQ; break;
- case NE: test = ITEST_NE; break;
- case GT: test = ITEST_GT; break;
- case GE: test = ITEST_GE; break;
- case LT: test = ITEST_LT; break;
- case LE: test = ITEST_LE; break;
- case GTU: test = ITEST_GTU; break;
- case GEU: test = ITEST_GEU; break;
- case LTU: test = ITEST_LTU; break;
- case LEU: test = ITEST_LEU; break;
- }
-
- return test;
-}
-
-
-/* Generate the code to compare two integer values. The return value is:
- (reg:SI xx) The pseudo register the comparison is in
- (rtx)0 No register, generate a simple branch.
-
- ??? This is called with result nonzero by the Scond patterns in
- mips.md. These patterns are called with a target in the mode of
- the Scond instruction pattern. Since this must be a constant, we
- must use SImode. This means that if RESULT is non-zero, it will
- always be an SImode register, even if TARGET_64BIT is true. We
- cope with this by calling convert_move rather than emit_move_insn.
- This will sometimes lead to an unnecessary extension of the result;
- for example:
-
- long long
- foo (long long i)
- {
- return i < 5;
- }
-
- */
-
-rtx
-gen_int_relational (test_code, result, cmp0, cmp1, p_invert)
- enum rtx_code test_code; /* relational test (EQ, etc) */
- rtx result; /* result to store comp. or 0 if branch */
- rtx cmp0; /* first operand to compare */
- rtx cmp1; /* second operand to compare */
- int *p_invert; /* NULL or ptr to hold whether branch needs */
- /* to reverse its test */
-{
- struct cmp_info {
- enum rtx_code test_code; /* code to use in instruction (LT vs. LTU) */
- int const_low; /* low bound of constant we can accept */
- int const_high; /* high bound of constant we can accept */
- int const_add; /* constant to add (convert LE -> LT) */
- int reverse_regs; /* reverse registers in test */
- int invert_const; /* != 0 if invert value if cmp1 is constant */
- int invert_reg; /* != 0 if invert value if cmp1 is register */
- int unsignedp; /* != 0 for unsigned comparisons. */
- };
-
- static struct cmp_info info[ (int)ITEST_MAX ] = {
-
- { XOR, 0, 65535, 0, 0, 0, 0, 0 }, /* EQ */
- { XOR, 0, 65535, 0, 0, 1, 1, 0 }, /* NE */
- { LT, -32769, 32766, 1, 1, 1, 0, 0 }, /* GT */
- { LT, -32768, 32767, 0, 0, 1, 1, 0 }, /* GE */
- { LT, -32768, 32767, 0, 0, 0, 0, 0 }, /* LT */
- { LT, -32769, 32766, 1, 1, 0, 1, 0 }, /* LE */
- { LTU, -32769, 32766, 1, 1, 1, 0, 1 }, /* GTU */
- { LTU, -32768, 32767, 0, 0, 1, 1, 1 }, /* GEU */
- { LTU, -32768, 32767, 0, 0, 0, 0, 1 }, /* LTU */
- { LTU, -32769, 32766, 1, 1, 0, 1, 1 }, /* LEU */
- };
-
- enum internal_test test;
- enum machine_mode mode;
- struct cmp_info *p_info;
- int branch_p;
- int eqne_p;
- int invert;
- rtx reg;
- rtx reg2;
-
- test = map_test_to_internal_test (test_code);
- if (test == ITEST_MAX)
- abort ();
-
- p_info = &info[ (int)test ];
- eqne_p = (p_info->test_code == XOR);
-
- mode = GET_MODE (cmp0);
- if (mode == VOIDmode)
- mode = GET_MODE (cmp1);
-
- /* Eliminate simple branches */
- branch_p = (result == (rtx)0);
- if (branch_p)
- {
- if (GET_CODE (cmp0) == REG || GET_CODE (cmp0) == SUBREG)
- {
- /* Comparisons against zero are simple branches */
- if (GET_CODE (cmp1) == CONST_INT && INTVAL (cmp1) == 0)
- return (rtx)0;
-
- /* Test for beq/bne. */
- if (eqne_p)
- return (rtx)0;
- }
-
- /* allocate a pseudo to calculate the value in. */
- result = gen_reg_rtx (mode);
- }
-
- /* Make sure we can handle any constants given to us. */
- if (GET_CODE (cmp0) == CONST_INT)
- cmp0 = force_reg (mode, cmp0);
-
- if (GET_CODE (cmp1) == CONST_INT)
- {
- HOST_WIDE_INT value = INTVAL (cmp1);
- if (value < p_info->const_low
- || value > p_info->const_high
- /* ??? Why? And why wasn't the similar code below modified too? */
- || (TARGET_64BIT
- && HOST_BITS_PER_WIDE_INT < 64
- && p_info->const_add != 0
- && ((p_info->unsignedp
- ? ((unsigned HOST_WIDE_INT) (value + p_info->const_add)
- > INTVAL (cmp1))
- : (value + p_info->const_add) > INTVAL (cmp1))
- != (p_info->const_add > 0))))
- cmp1 = force_reg (mode, cmp1);
- }
-
- /* See if we need to invert the result. */
- invert = (GET_CODE (cmp1) == CONST_INT)
- ? p_info->invert_const
- : p_info->invert_reg;
-
- if (p_invert != (int *)0)
- {
- *p_invert = invert;
- invert = FALSE;
- }
-
- /* Comparison to constants, may involve adding 1 to change a LT into LE.
- Comparison between two registers, may involve switching operands. */
- if (GET_CODE (cmp1) == CONST_INT)
- {
- if (p_info->const_add != 0)
- {
- HOST_WIDE_INT new = INTVAL (cmp1) + p_info->const_add;
- /* If modification of cmp1 caused overflow,
- we would get the wrong answer if we follow the usual path;
- thus, x > 0xffffffffU would turn into x > 0U. */
- if ((p_info->unsignedp
- ? (unsigned HOST_WIDE_INT) new > INTVAL (cmp1)
- : new > INTVAL (cmp1))
- != (p_info->const_add > 0))
- {
- /* This test is always true, but if INVERT is true then
- the result of the test needs to be inverted so 0 should
- be returned instead. */
- emit_move_insn (result, invert ? const0_rtx : const_true_rtx);
- return result;
- }
- else
- cmp1 = GEN_INT (new);
- }
- }
- else if (p_info->reverse_regs)
- {
- rtx temp = cmp0;
- cmp0 = cmp1;
- cmp1 = temp;
- }
-
- if (test == ITEST_NE && GET_CODE (cmp1) == CONST_INT && INTVAL (cmp1) == 0)
- reg = cmp0;
- else
- {
- reg = (invert || eqne_p) ? gen_reg_rtx (mode) : result;
- convert_move (reg, gen_rtx (p_info->test_code, mode, cmp0, cmp1), 0);
- }
-
- if (test == ITEST_NE)
- {
- convert_move (result, gen_rtx (GTU, mode, reg, const0_rtx), 0);
- invert = FALSE;
- }
-
- else if (test == ITEST_EQ)
- {
- reg2 = (invert) ? gen_reg_rtx (mode) : result;
- convert_move (reg2, gen_rtx (LTU, mode, reg, const1_rtx), 0);
- reg = reg2;
- }
-
- if (invert)
- convert_move (result, gen_rtx (XOR, mode, reg, const1_rtx), 0);
-
- return result;
-}
-
-
-/* Emit the common code for doing conditional branches.
- operand[0] is the label to jump to.
- The comparison operands are saved away by cmp{si,di,sf,df}. */
-
-void
-gen_conditional_branch (operands, test_code)
- rtx operands[];
- enum rtx_code test_code;
-{
- enum cmp_type type = branch_type;
- rtx cmp0 = branch_cmp[0];
- rtx cmp1 = branch_cmp[1];
- enum machine_mode mode;
- rtx reg;
- int invert;
- rtx label1, label2;
-
- switch (type)
- {
- default:
- abort_with_insn (gen_rtx (test_code, VOIDmode, cmp0, cmp1), "bad test");
-
- case CMP_SI:
- case CMP_DI:
- mode = type == CMP_SI ? SImode : DImode;
- invert = FALSE;
- reg = gen_int_relational (test_code, NULL_RTX, cmp0, cmp1, &invert);
- if (reg)
- {
- cmp0 = reg;
- cmp1 = const0_rtx;
- test_code = NE;
- }
- else if (GET_CODE (cmp1) == CONST_INT && INTVAL (cmp1) != 0)
- {
- /* We don't want to build a comparison against a non-zero
- constant. */
- cmp1 = force_reg (mode, cmp1);
- }
- break;
-
- case CMP_SF:
- case CMP_DF:
- if (mips_isa < 4)
- reg = gen_rtx (REG, CCmode, FPSW_REGNUM);
- else
- reg = gen_reg_rtx (CCmode);
-
- /* For cmp0 != cmp1, build cmp0 == cmp1, and test for result ==
- 0 in the instruction built below. The MIPS FPU handles
- inequality testing by testing for equality and looking for a
- false result. */
- emit_insn (gen_rtx (SET, VOIDmode,
- reg,
- gen_rtx (test_code == NE ? EQ : test_code,
- CCmode, cmp0, cmp1)));
-
- test_code = test_code == NE ? EQ : NE;
- mode = CCmode;
- cmp0 = reg;
- cmp1 = const0_rtx;
- invert = FALSE;
- break;
- }
-
- /* Generate the branch. */
-
- label1 = gen_rtx (LABEL_REF, VOIDmode, operands[0]);
- label2 = pc_rtx;
-
- if (invert)
- {
- label2 = label1;
- label1 = pc_rtx;
- }
-
- emit_jump_insn (gen_rtx (SET, VOIDmode,
- pc_rtx,
- gen_rtx (IF_THEN_ELSE, VOIDmode,
- gen_rtx (test_code, mode, cmp0, cmp1),
- label1,
- label2)));
-}
-
-/* Emit the common code for conditional moves. OPERANDS is the array
- of operands passed to the conditional move defined_expand. */
-
-void
-gen_conditional_move (operands)
- rtx *operands;
-{
- rtx op0 = branch_cmp[0];
- rtx op1 = branch_cmp[1];
- enum machine_mode mode = GET_MODE (branch_cmp[0]);
- enum rtx_code cmp_code = GET_CODE (operands[1]);
- enum rtx_code move_code = NE;
- enum machine_mode op_mode = GET_MODE (operands[0]);
- enum machine_mode cmp_mode;
- rtx cmp_reg;
-
- if (GET_MODE_CLASS (mode) != MODE_FLOAT)
- {
- switch (cmp_code)
- {
- case EQ:
- cmp_code = XOR;
- move_code = EQ;
- break;
- case NE:
- cmp_code = XOR;
- break;
- case LT:
- break;
- case GE:
- cmp_code = LT;
- move_code = EQ;
- break;
- case GT:
- cmp_code = LT;
- op0 = force_reg (mode, branch_cmp[1]);
- op1 = branch_cmp[0];
- break;
- case LE:
- cmp_code = LT;
- op0 = force_reg (mode, branch_cmp[1]);
- op1 = branch_cmp[0];
- move_code = EQ;
- break;
- case LTU:
- break;
- case GEU:
- cmp_code = LTU;
- move_code = EQ;
- break;
- case GTU:
- cmp_code = LTU;
- op0 = force_reg (mode, branch_cmp[1]);
- op1 = branch_cmp[0];
- break;
- case LEU:
- cmp_code = LTU;
- op0 = force_reg (mode, branch_cmp[1]);
- op1 = branch_cmp[0];
- move_code = EQ;
- break;
- default:
- abort ();
- }
- }
- else
- {
- if (cmp_code == NE)
- {
- cmp_code = EQ;
- move_code = EQ;
- }
- }
-
- if (mode == SImode || mode == DImode)
- cmp_mode = mode;
- else if (mode == SFmode || mode == DFmode)
- cmp_mode = CCmode;
- else
- abort ();
-
- cmp_reg = gen_reg_rtx (cmp_mode);
- emit_insn (gen_rtx (SET, cmp_mode,
- cmp_reg,
- gen_rtx (cmp_code, cmp_mode, op0, op1)));
- emit_insn (gen_rtx (SET, op_mode,
- operands[0],
- gen_rtx (IF_THEN_ELSE, op_mode,
- gen_rtx (move_code, VOIDmode,
- cmp_reg,
- CONST0_RTX (SImode)),
- operands[2],
- operands[3])));
-}
-
-/* Write a loop to move a constant number of bytes. Generate load/stores as follows:
-
- do {
- temp1 = src[0];
- temp2 = src[1];
- ...
- temp<last> = src[MAX_MOVE_REGS-1];
- dest[0] = temp1;
- dest[1] = temp2;
- ...
- dest[MAX_MOVE_REGS-1] = temp<last>;
- src += MAX_MOVE_REGS;
- dest += MAX_MOVE_REGS;
- } while (src != final);
-
- This way, no NOP's are needed, and only MAX_MOVE_REGS+3 temp
- registers are needed.
-
- Aligned moves move MAX_MOVE_REGS*4 bytes every (2*MAX_MOVE_REGS)+3
- cycles, unaligned moves move MAX_MOVE_REGS*4 bytes every
- (4*MAX_MOVE_REGS)+3 cycles, assuming no cache misses. */
-
-#define MAX_MOVE_REGS 4
-#define MAX_MOVE_BYTES (MAX_MOVE_REGS * UNITS_PER_WORD)
-
-static void
-block_move_loop (dest_reg, src_reg, bytes, align, orig_dest, orig_src)
- rtx dest_reg; /* register holding destination address */
- rtx src_reg; /* register holding source address */
- int bytes; /* # bytes to move */
- int align; /* alignment */
- rtx orig_dest; /* original dest for change_address */
- rtx orig_src; /* original source for making a reg note */
-{
- rtx dest_mem = change_address (orig_dest, BLKmode, dest_reg);
- rtx src_mem = change_address (orig_src, BLKmode, src_reg);
- rtx align_rtx = GEN_INT (align);
- rtx label;
- rtx final_src;
- rtx bytes_rtx;
- int leftover;
-
- if (bytes < 2*MAX_MOVE_BYTES)
- abort ();
-
- leftover = bytes % MAX_MOVE_BYTES;
- bytes -= leftover;
-
- label = gen_label_rtx ();
- final_src = gen_reg_rtx (Pmode);
- bytes_rtx = GEN_INT (bytes);
-
- if (bytes > 0x7fff)
- {
- if (TARGET_LONG64)
- {
- emit_insn (gen_movdi (final_src, bytes_rtx));
- emit_insn (gen_adddi3 (final_src, final_src, src_reg));
- }
- else
- {
- emit_insn (gen_movsi (final_src, bytes_rtx));
- emit_insn (gen_addsi3 (final_src, final_src, src_reg));
- }
- }
- else
- {
- if (TARGET_LONG64)
- emit_insn (gen_adddi3 (final_src, src_reg, bytes_rtx));
- else
- emit_insn (gen_addsi3 (final_src, src_reg, bytes_rtx));
- }
-
- emit_label (label);
-
- bytes_rtx = GEN_INT (MAX_MOVE_BYTES);
- emit_insn (gen_movstrsi_internal (dest_mem, src_mem, bytes_rtx, align_rtx));
- if (TARGET_LONG64)
- {
- emit_insn (gen_adddi3 (src_reg, src_reg, bytes_rtx));
- emit_insn (gen_adddi3 (dest_reg, dest_reg, bytes_rtx));
- emit_insn (gen_cmpdi (src_reg, final_src));
- }
- else
- {
- emit_insn (gen_addsi3 (src_reg, src_reg, bytes_rtx));
- emit_insn (gen_addsi3 (dest_reg, dest_reg, bytes_rtx));
- emit_insn (gen_cmpsi (src_reg, final_src));
- }
- emit_jump_insn (gen_bne (label));
-
- if (leftover)
- emit_insn (gen_movstrsi_internal (dest_mem, src_mem,
- GEN_INT (leftover),
- align_rtx));
-}
-
-/* Use a library function to move some bytes. */
-
-static void
-block_move_call (dest_reg, src_reg, bytes_rtx)
- rtx dest_reg;
- rtx src_reg;
- rtx bytes_rtx;
-{
- /* We want to pass the size as Pmode, which will normally be SImode
- but will be DImode if we are using 64 bit longs and pointers. */
- if (GET_MODE (bytes_rtx) != VOIDmode
- && GET_MODE (bytes_rtx) != Pmode)
- bytes_rtx = convert_to_mode (Pmode, bytes_rtx, TRUE);
-
-#ifdef TARGET_MEM_FUNCTIONS
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"), 0,
- VOIDmode, 3,
- dest_reg, Pmode,
- src_reg, Pmode,
- convert_to_mode (TYPE_MODE (sizetype), bytes_rtx,
- TREE_UNSIGNED (sizetype)),
- TYPE_MODE (sizetype));
-#else
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcopy"), 0,
- VOIDmode, 3,
- src_reg, Pmode,
- dest_reg, Pmode,
- convert_to_mode (TYPE_MODE (integer_type_node),
- bytes_rtx,
- TREE_UNSIGNED (integer_type_node)),
- TYPE_MODE (integer_type_node));
-#endif
-}
-
-
-/* Expand string/block move operations.
-
- operands[0] is the pointer to the destination.
- operands[1] is the pointer to the source.
- operands[2] is the number of bytes to move.
- operands[3] is the alignment. */
-
-void
-expand_block_move (operands)
- rtx operands[];
-{
- rtx bytes_rtx = operands[2];
- rtx align_rtx = operands[3];
- int constp = (GET_CODE (bytes_rtx) == CONST_INT);
- int bytes = (constp ? INTVAL (bytes_rtx) : 0);
- int align = INTVAL (align_rtx);
- rtx orig_src = operands[1];
- rtx orig_dest = operands[0];
- rtx src_reg;
- rtx dest_reg;
-
- if (constp && bytes <= 0)
- return;
-
- if (align > UNITS_PER_WORD)
- align = UNITS_PER_WORD;
-
- /* Move the address into scratch registers. */
- dest_reg = copy_addr_to_reg (XEXP (orig_dest, 0));
- src_reg = copy_addr_to_reg (XEXP (orig_src, 0));
-
- if (TARGET_MEMCPY)
- block_move_call (dest_reg, src_reg, bytes_rtx);
-
- else if (constp && bytes <= 2*MAX_MOVE_BYTES)
- emit_insn (gen_movstrsi_internal (change_address (orig_dest, BLKmode,
- dest_reg),
- change_address (orig_src, BLKmode,
- src_reg),
- bytes_rtx, align_rtx));
-
- else if (constp && align >= UNITS_PER_WORD && optimize)
- block_move_loop (dest_reg, src_reg, bytes, align, orig_dest, orig_src);
-
- else if (constp && optimize)
- {
- /* If the alignment is not word aligned, generate a test at
- runtime, to see whether things wound up aligned, and we
- can use the faster lw/sw instead ulw/usw. */
-
- rtx temp = gen_reg_rtx (Pmode);
- rtx aligned_label = gen_label_rtx ();
- rtx join_label = gen_label_rtx ();
- int leftover = bytes % MAX_MOVE_BYTES;
-
- bytes -= leftover;
-
- if (TARGET_LONG64)
- {
- emit_insn (gen_iordi3 (temp, src_reg, dest_reg));
- emit_insn (gen_anddi3 (temp, temp, GEN_INT (UNITS_PER_WORD-1)));
- emit_insn (gen_cmpdi (temp, const0_rtx));
- }
- else
- {
- emit_insn (gen_iorsi3 (temp, src_reg, dest_reg));
- emit_insn (gen_andsi3 (temp, temp, GEN_INT (UNITS_PER_WORD-1)));
- emit_insn (gen_cmpsi (temp, const0_rtx));
- }
- emit_jump_insn (gen_beq (aligned_label));
-
- /* Unaligned loop. */
- block_move_loop (dest_reg, src_reg, bytes, 1, orig_dest, orig_src);
- emit_jump_insn (gen_jump (join_label));
- emit_barrier ();
-
- /* Aligned loop. */
- emit_label (aligned_label);
- block_move_loop (dest_reg, src_reg, bytes, UNITS_PER_WORD, orig_dest,
- orig_src);
- emit_label (join_label);
-
- /* Bytes at the end of the loop. */
- if (leftover)
- emit_insn (gen_movstrsi_internal (change_address (orig_dest, BLKmode,
- dest_reg),
- change_address (orig_src, BLKmode,
- src_reg),
- GEN_INT (leftover),
- GEN_INT (align)));
- }
-
- else
- block_move_call (dest_reg, src_reg, bytes_rtx);
-}
-
-
-/* Emit load/stores for a small constant block_move.
-
- operands[0] is the memory address of the destination.
- operands[1] is the memory address of the source.
- operands[2] is the number of bytes to move.
- operands[3] is the alignment.
- operands[4] is a temp register.
- operands[5] is a temp register.
- ...
- operands[3+num_regs] is the last temp register.
-
- The block move type can be one of the following:
- BLOCK_MOVE_NORMAL Do all of the block move.
- BLOCK_MOVE_NOT_LAST Do all but the last store.
- BLOCK_MOVE_LAST Do just the last store. */
-
-char *
-output_block_move (insn, operands, num_regs, move_type)
- rtx insn;
- rtx operands[];
- int num_regs;
- enum block_move_type move_type;
-{
- rtx dest_reg = XEXP (operands[0], 0);
- rtx src_reg = XEXP (operands[1], 0);
- int bytes = INTVAL (operands[2]);
- int align = INTVAL (operands[3]);
- int num = 0;
- int offset = 0;
- int use_lwl_lwr = FALSE;
- int last_operand = num_regs+4;
- int safe_regs = 4;
- int i;
- rtx xoperands[10];
-
- struct {
- char *load; /* load insn without nop */
- char *load_nop; /* load insn with trailing nop */
- char *store; /* store insn */
- char *final; /* if last_store used: NULL or swr */
- char *last_store; /* last store instruction */
- int offset; /* current offset */
- enum machine_mode mode; /* mode to use on (MEM) */
- } load_store[4];
-
- /* Detect a bug in GCC, where it can give us a register
- the same as one of the addressing registers and reduce
- the number of registers available. */
- for (i = 4;
- i < last_operand && safe_regs < (sizeof(xoperands) / sizeof(xoperands[0]));
- i++)
- {
- if (!reg_mentioned_p (operands[i], operands[0])
- && !reg_mentioned_p (operands[i], operands[1]))
-
- xoperands[safe_regs++] = operands[i];
- }
-
- if (safe_regs < last_operand)
- {
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- xoperands[2] = operands[2];
- xoperands[3] = operands[3];
- return output_block_move (insn, xoperands, safe_regs-4, move_type);
- }
-
- /* If we are given global or static addresses, and we would be
- emitting a few instructions, try to save time by using a
- temporary register for the pointer. */
- if (num_regs > 2 && (bytes > 2*align || move_type != BLOCK_MOVE_NORMAL))
- {
- if (CONSTANT_P (src_reg))
- {
- if (TARGET_STATS)
- mips_count_memory_refs (operands[1], 1);
-
- src_reg = operands[ 3 + num_regs-- ];
- if (move_type != BLOCK_MOVE_LAST)
- {
- xoperands[1] = operands[1];
- xoperands[0] = src_reg;
- if (Pmode == DImode)
- output_asm_insn ("dla\t%0,%1", xoperands);
- else
- output_asm_insn ("la\t%0,%1", xoperands);
- }
- }
-
- if (CONSTANT_P (dest_reg))
- {
- if (TARGET_STATS)
- mips_count_memory_refs (operands[0], 1);
-
- dest_reg = operands[ 3 + num_regs-- ];
- if (move_type != BLOCK_MOVE_LAST)
- {
- xoperands[1] = operands[0];
- xoperands[0] = dest_reg;
- if (Pmode == DImode)
- output_asm_insn ("dla\t%0,%1", xoperands);
- else
- output_asm_insn ("la\t%0,%1", xoperands);
- }
- }
- }
-
- /* ??? We really shouldn't get any LO_SUM addresses here, because they
- are not offsettable, however, offsettable_address_p says they are
- offsettable. I think this is a bug in offsettable_address_p.
- For expediency, we fix this by just loading the address into a register
- if we happen to get one. */
-
- if (GET_CODE (src_reg) == LO_SUM)
- {
- src_reg = operands[ 3 + num_regs-- ];
- if (move_type != BLOCK_MOVE_LAST)
- {
- xoperands[2] = XEXP (XEXP (operands[1], 0), 1);
- xoperands[1] = XEXP (XEXP (operands[1], 0), 0);
- xoperands[0] = src_reg;
- if (Pmode == DImode)
- output_asm_insn ("daddiu\t%0,%1,%%lo(%2)", xoperands);
- else
- output_asm_insn ("addiu\t%0,%1,%%lo(%2)", xoperands);
- }
- }
-
- if (GET_CODE (dest_reg) == LO_SUM)
- {
- dest_reg = operands[ 3 + num_regs-- ];
- if (move_type != BLOCK_MOVE_LAST)
- {
- xoperands[2] = XEXP (XEXP (operands[0], 0), 1);
- xoperands[1] = XEXP (XEXP (operands[0], 0), 0);
- xoperands[0] = dest_reg;
- if (Pmode == DImode)
- output_asm_insn ("daddiu\t%0,%1,%%lo(%2)", xoperands);
- else
- output_asm_insn ("addiu\t%0,%1,%%lo(%2)", xoperands);
- }
- }
-
- if (num_regs > (sizeof (load_store) / sizeof (load_store[0])))
- num_regs = (sizeof (load_store) / sizeof (load_store[0]));
-
- else if (num_regs < 1)
- abort_with_insn (insn, "Cannot do block move, not enough scratch registers");
-
- while (bytes > 0)
- {
- load_store[num].offset = offset;
-
- if (TARGET_64BIT && bytes >= 8 && align >= 8)
- {
- load_store[num].load = "ld\t%0,%1";
- load_store[num].load_nop = "ld\t%0,%1%#";
- load_store[num].store = "sd\t%0,%1";
- load_store[num].last_store = "sd\t%0,%1";
- load_store[num].final = (char *)0;
- load_store[num].mode = DImode;
- offset += 8;
- bytes -= 8;
- }
-
- /* ??? Fails because of a MIPS assembler bug? */
- else if (TARGET_64BIT && bytes >= 8)
- {
- if (BYTES_BIG_ENDIAN)
- {
- load_store[num].load = "ldl\t%0,%1\n\tldr\t%0,%2";
- load_store[num].load_nop = "ldl\t%0,%1\n\tldr\t%0,%2%#";
- load_store[num].store = "sdl\t%0,%1\n\tsdr\t%0,%2";
- load_store[num].last_store = "sdr\t%0,%2";
- load_store[num].final = "sdl\t%0,%1";
- }
- else
- {
- load_store[num].load = "ldl\t%0,%2\n\tldr\t%0,%1";
- load_store[num].load_nop = "ldl\t%0,%2\n\tldr\t%0,%1%#";
- load_store[num].store = "sdl\t%0,%2\n\tsdr\t%0,%1";
- load_store[num].last_store = "sdr\t%0,%1";
- load_store[num].final = "sdl\t%0,%2";
- }
- load_store[num].mode = DImode;
- offset += 8;
- bytes -= 8;
- use_lwl_lwr = TRUE;
- }
-
- else if (bytes >= 4 && align >= 4)
- {
- load_store[num].load = "lw\t%0,%1";
- load_store[num].load_nop = "lw\t%0,%1%#";
- load_store[num].store = "sw\t%0,%1";
- load_store[num].last_store = "sw\t%0,%1";
- load_store[num].final = (char *)0;
- load_store[num].mode = SImode;
- offset += 4;
- bytes -= 4;
- }
-
- else if (bytes >= 4)
- {
- if (BYTES_BIG_ENDIAN)
- {
- load_store[num].load = "lwl\t%0,%1\n\tlwr\t%0,%2";
- load_store[num].load_nop = "lwl\t%0,%1\n\tlwr\t%0,%2%#";
- load_store[num].store = "swl\t%0,%1\n\tswr\t%0,%2";
- load_store[num].last_store = "swr\t%0,%2";
- load_store[num].final = "swl\t%0,%1";
- }
- else
- {
- load_store[num].load = "lwl\t%0,%2\n\tlwr\t%0,%1";
- load_store[num].load_nop = "lwl\t%0,%2\n\tlwr\t%0,%1%#";
- load_store[num].store = "swl\t%0,%2\n\tswr\t%0,%1";
- load_store[num].last_store = "swr\t%0,%1";
- load_store[num].final = "swl\t%0,%2";
- }
- load_store[num].mode = SImode;
- offset += 4;
- bytes -= 4;
- use_lwl_lwr = TRUE;
- }
-
- else if (bytes >= 2 && align >= 2)
- {
- load_store[num].load = "lh\t%0,%1";
- load_store[num].load_nop = "lh\t%0,%1%#";
- load_store[num].store = "sh\t%0,%1";
- load_store[num].last_store = "sh\t%0,%1";
- load_store[num].final = (char *)0;
- load_store[num].mode = HImode;
- offset += 2;
- bytes -= 2;
- }
-
- else
- {
- load_store[num].load = "lb\t%0,%1";
- load_store[num].load_nop = "lb\t%0,%1%#";
- load_store[num].store = "sb\t%0,%1";
- load_store[num].last_store = "sb\t%0,%1";
- load_store[num].final = (char *)0;
- load_store[num].mode = QImode;
- offset++;
- bytes--;
- }
-
- if (TARGET_STATS && move_type != BLOCK_MOVE_LAST)
- {
- dslots_load_total++;
- dslots_load_filled++;
-
- if (CONSTANT_P (src_reg))
- mips_count_memory_refs (src_reg, 1);
-
- if (CONSTANT_P (dest_reg))
- mips_count_memory_refs (dest_reg, 1);
- }
-
- /* Emit load/stores now if we have run out of registers or are
- at the end of the move. */
-
- if (++num == num_regs || bytes == 0)
- {
- /* If only load/store, we need a NOP after the load. */
- if (num == 1)
- {
- load_store[0].load = load_store[0].load_nop;
- if (TARGET_STATS && move_type != BLOCK_MOVE_LAST)
- dslots_load_filled--;
- }
-
- if (move_type != BLOCK_MOVE_LAST)
- {
- for (i = 0; i < num; i++)
- {
- int offset;
-
- if (!operands[i+4])
- abort ();
-
- if (GET_MODE (operands[i+4]) != load_store[i].mode)
- operands[i+4] = gen_rtx (REG, load_store[i].mode, REGNO (operands[i+4]));
-
- offset = load_store[i].offset;
- xoperands[0] = operands[i+4];
- xoperands[1] = gen_rtx (MEM, load_store[i].mode,
- plus_constant (src_reg, offset));
-
- if (use_lwl_lwr)
- {
- int extra_offset;
- extra_offset = GET_MODE_SIZE (load_store[i].mode) - 1;
- xoperands[2] = gen_rtx (MEM, load_store[i].mode,
- plus_constant (src_reg,
- extra_offset
- + offset));
- }
-
- output_asm_insn (load_store[i].load, xoperands);
- }
- }
-
- for (i = 0; i < num; i++)
- {
- int last_p = (i == num-1 && bytes == 0);
- int offset = load_store[i].offset;
-
- xoperands[0] = operands[i+4];
- xoperands[1] = gen_rtx (MEM, load_store[i].mode,
- plus_constant (dest_reg, offset));
-
-
- if (use_lwl_lwr)
- {
- int extra_offset;
- extra_offset = GET_MODE_SIZE (load_store[i].mode) - 1;
- xoperands[2] = gen_rtx (MEM, load_store[i].mode,
- plus_constant (dest_reg,
- extra_offset
- + offset));
- }
-
- if (move_type == BLOCK_MOVE_NORMAL)
- output_asm_insn (load_store[i].store, xoperands);
-
- else if (move_type == BLOCK_MOVE_NOT_LAST)
- {
- if (!last_p)
- output_asm_insn (load_store[i].store, xoperands);
-
- else if (load_store[i].final != (char *)0)
- output_asm_insn (load_store[i].final, xoperands);
- }
-
- else if (last_p)
- output_asm_insn (load_store[i].last_store, xoperands);
- }
-
- num = 0; /* reset load_store */
- use_lwl_lwr = FALSE;
- }
- }
-
- return "";
-}
-
-
-/* Argument support functions. */
-
-/* Initialize CUMULATIVE_ARGS for a function. */
-
-void
-init_cumulative_args (cum, fntype, libname)
- CUMULATIVE_ARGS *cum; /* argument info to initialize */
- tree fntype; /* tree ptr for function decl */
- rtx libname; /* SYMBOL_REF of library name or 0 */
-{
- static CUMULATIVE_ARGS zero_cum;
- tree param, next_param;
-
- if (TARGET_DEBUG_E_MODE)
- {
- fprintf (stderr, "\ninit_cumulative_args, fntype = 0x%.8lx", (long)fntype);
- if (!fntype)
- fputc ('\n', stderr);
-
- else
- {
- tree ret_type = TREE_TYPE (fntype);
- fprintf (stderr, ", fntype code = %s, ret code = %s\n",
- tree_code_name[ (int)TREE_CODE (fntype) ],
- tree_code_name[ (int)TREE_CODE (ret_type) ]);
- }
- }
-
- *cum = zero_cum;
-
- /* Determine if this function has variable arguments. This is
- indicated by the last argument being 'void_type_mode' if there
- are no variable arguments. The standard MIPS calling sequence
- passes all arguments in the general purpose registers in this
- case. */
-
- for (param = (fntype) ? TYPE_ARG_TYPES (fntype) : 0;
- param != (tree)0;
- param = next_param)
- {
- next_param = TREE_CHAIN (param);
- if (next_param == (tree)0 && TREE_VALUE (param) != void_type_node)
- cum->gp_reg_found = 1;
- }
-}
-
-/* Advance the argument to the next argument position. */
-
-void
-function_arg_advance (cum, mode, type, named)
- CUMULATIVE_ARGS *cum; /* current arg information */
- enum machine_mode mode; /* current arg mode */
- tree type; /* type of the argument or 0 if lib support */
- int named; /* whether or not the argument was named */
-{
- if (TARGET_DEBUG_E_MODE)
- fprintf (stderr,
- "function_adv( {gp reg found = %d, arg # = %2d, words = %2d}, %4s, 0x%.8x, %d )\n\n",
- cum->gp_reg_found, cum->arg_number, cum->arg_words, GET_MODE_NAME (mode),
- type, named);
-
- cum->arg_number++;
- switch (mode)
- {
- case VOIDmode:
- break;
-
- default:
- if (GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
- && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)
- abort ();
- cum->gp_reg_found = 1;
- cum->arg_words += ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1)
- / UNITS_PER_WORD);
- break;
-
- case BLKmode:
- cum->gp_reg_found = 1;
- cum->arg_words += ((int_size_in_bytes (type) + UNITS_PER_WORD - 1)
- / UNITS_PER_WORD);
- break;
-
- case SFmode:
- if (mips_abi == ABI_EABI && ! TARGET_SOFT_FLOAT)
- cum->fp_arg_words++;
- else
- cum->arg_words++;
- break;
-
- case DFmode:
- if (mips_abi == ABI_EABI && ! TARGET_SOFT_FLOAT && ! TARGET_SINGLE_FLOAT)
- cum->fp_arg_words += (TARGET_64BIT ? 1 : 2);
- else
- cum->arg_words += (TARGET_64BIT ? 1 : 2);
- break;
-
- case DImode:
- cum->gp_reg_found = 1;
- cum->arg_words += (TARGET_64BIT ? 1 : 2);
- break;
-
- case QImode:
- case HImode:
- case SImode:
- cum->gp_reg_found = 1;
- cum->arg_words++;
- break;
- }
-}
-
-/* Return an RTL expression containing the register for the given mode,
- or 0 if the argument is to be passed on the stack. */
-
-struct rtx_def *
-function_arg (cum, mode, type, named)
- CUMULATIVE_ARGS *cum; /* current arg information */
- enum machine_mode mode; /* current arg mode */
- tree type; /* type of the argument or 0 if lib support */
- int named; /* != 0 for normal args, == 0 for ... args */
-{
- rtx ret;
- int regbase = -1;
- int bias = 0;
- int *arg_words = &cum->arg_words;
- int struct_p = ((type != (tree)0)
- && (TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE));
-
- if (TARGET_DEBUG_E_MODE)
- fprintf (stderr,
- "function_arg( {gp reg found = %d, arg # = %2d, words = %2d}, %4s, 0x%.8x, %d ) = ",
- cum->gp_reg_found, cum->arg_number, cum->arg_words, GET_MODE_NAME (mode),
- type, named);
-
- cum->last_arg_fp = 0;
- switch (mode)
- {
- case SFmode:
- if (mips_abi == ABI_32)
- {
- if (cum->gp_reg_found || cum->arg_number >= 2 || TARGET_SOFT_FLOAT)
- regbase = GP_ARG_FIRST;
- else
- {
- regbase = FP_ARG_FIRST;
- /* If the first arg was a float in a floating point register,
- then set bias to align this float arg properly. */
- if (cum->arg_words == 1)
- bias = 1;
- }
- }
- else if (mips_abi == ABI_EABI && ! TARGET_SOFT_FLOAT)
- {
- if (! TARGET_64BIT)
- cum->fp_arg_words += cum->fp_arg_words & 1;
- cum->last_arg_fp = 1;
- arg_words = &cum->fp_arg_words;
- regbase = FP_ARG_FIRST;
- }
- else
- regbase = (TARGET_SOFT_FLOAT || ! named ? GP_ARG_FIRST : FP_ARG_FIRST);
- break;
-
- case DFmode:
- if (! TARGET_64BIT)
- {
- if (mips_abi == ABI_EABI
- && ! TARGET_SOFT_FLOAT
- && ! TARGET_SINGLE_FLOAT)
- cum->fp_arg_words += cum->fp_arg_words & 1;
- else
- cum->arg_words += cum->arg_words & 1;
- }
- if (mips_abi == ABI_32)
- regbase = ((cum->gp_reg_found
- || TARGET_SOFT_FLOAT
- || TARGET_SINGLE_FLOAT
- || cum->arg_number >= 2)
- ? GP_ARG_FIRST
- : FP_ARG_FIRST);
- else if (mips_abi == ABI_EABI
- && ! TARGET_SOFT_FLOAT
- && ! TARGET_SINGLE_FLOAT)
- {
- cum->last_arg_fp = 1;
- arg_words = &cum->fp_arg_words;
- regbase = FP_ARG_FIRST;
- }
- else
- regbase = (TARGET_SOFT_FLOAT || TARGET_SINGLE_FLOAT || ! named
- ? GP_ARG_FIRST : FP_ARG_FIRST);
- break;
-
- default:
- if (GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
- && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)
- abort ();
-
- /* Drops through. */
- case BLKmode:
- if (type != (tree)0 && TYPE_ALIGN (type) > BITS_PER_WORD
- && ! TARGET_64BIT && mips_abi != ABI_EABI)
- cum->arg_words += (cum->arg_words & 1);
- regbase = GP_ARG_FIRST;
- break;
-
- case VOIDmode:
- case QImode:
- case HImode:
- case SImode:
- regbase = GP_ARG_FIRST;
- break;
-
- case DImode:
- if (! TARGET_64BIT)
- cum->arg_words += (cum->arg_words & 1);
- regbase = GP_ARG_FIRST;
- }
-
- if (*arg_words >= MAX_ARGS_IN_REGISTERS)
- {
- if (TARGET_DEBUG_E_MODE)
- fprintf (stderr, "<stack>%s\n", struct_p ? ", [struct]" : "");
-
- ret = (rtx)0;
- }
- else
- {
- if (regbase == -1)
- abort ();
-
- if (! type || TREE_CODE (type) != RECORD_TYPE || mips_abi == ABI_32
- || mips_abi == ABI_EABI || ! named)
- ret = gen_rtx (REG, mode, regbase + *arg_words + bias);
- else
- {
- /* The Irix 6 n32/n64 ABIs say that if any 64 bit chunk of the
- structure contains a double in its entirety, then that 64 bit
- chunk is passed in a floating point register. */
- tree field;
-
- /* First check to see if there is any such field. */
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- if (TREE_CODE (field) == FIELD_DECL
- && TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
- && TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD
- && (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))
- % BITS_PER_WORD == 0))
- break;
-
- if (! field)
- ret = gen_rtx (REG, mode, regbase + *arg_words + bias);
- else
- {
- /* Now handle the special case by returning a PARALLEL
- indicating where each 64 bit chunk goes. */
- int chunks;
- int bitpos;
- int regno;
- int i;
-
- /* ??? If this is a packed structure, then the last hunk won't
- be 64 bits. */
-
- /* ??? If this is a structure with a single double field,
- it would be more convenient to return (REG:DI %fX) than
- a parallel. However, we would have to modify the mips
- backend to allow DImode values in fp registers. */
-
- chunks = TREE_INT_CST_LOW (TYPE_SIZE (type)) / BITS_PER_WORD;
- if (chunks + *arg_words + bias > MAX_ARGS_IN_REGISTERS)
- chunks = MAX_ARGS_IN_REGISTERS - *arg_words - bias;
-
- /* assign_parms checks the mode of ENTRY_PARM, so we must
- use the actual mode here. */
- ret = gen_rtx (PARALLEL, mode, rtvec_alloc (chunks));
-
- bitpos = 0;
- regno = regbase + *arg_words + bias;
- field = TYPE_FIELDS (type);
- for (i = 0; i < chunks; i++)
- {
- rtx reg;
-
- for (; field; field = TREE_CHAIN (field))
- if (TREE_CODE (field) == FIELD_DECL
- && (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))
- >= bitpos))
- break;
-
- if (field
- && TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field)) == bitpos
- && TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
- && TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD)
- reg = gen_rtx (REG, DFmode,
- regno + FP_ARG_FIRST - GP_ARG_FIRST);
- else
- reg = gen_rtx (REG, word_mode, regno);
-
- XVECEXP (ret, 0, i) = gen_rtx (EXPR_LIST, VOIDmode, reg,
- GEN_INT (bitpos / BITS_PER_UNIT));
-
- bitpos += 64;
- regno++;
- }
- }
- }
-
- if (TARGET_DEBUG_E_MODE)
- fprintf (stderr, "%s%s\n", reg_names[regbase + *arg_words + bias],
- struct_p ? ", [struct]" : "");
-
- /* The following is a hack in order to pass 1 byte structures
- the same way that the MIPS compiler does (namely by passing
- the structure in the high byte or half word of the register).
- This also makes varargs work. If we have such a structure,
- we save the adjustment RTL, and the call define expands will
- emit them. For the VOIDmode argument (argument after the
- last real argument), pass back a parallel vector holding each
- of the adjustments. */
-
- /* ??? function_arg can be called more than once for each argument.
- As a result, we compute more adjustments than we need here.
- See the CUMULATIVE_ARGS definition in mips.h. */
-
- /* ??? This scheme requires everything smaller than the word size to
- shifted to the left, but when TARGET_64BIT and ! TARGET_INT64,
- that would mean every int needs to be shifted left, which is very
- inefficient. Let's not carry this compatibility to the 64 bit
- calling convention for now. */
-
- if (struct_p && int_size_in_bytes (type) < UNITS_PER_WORD
- && ! TARGET_64BIT && mips_abi != ABI_EABI)
- {
- rtx amount = GEN_INT (BITS_PER_WORD
- - int_size_in_bytes (type) * BITS_PER_UNIT);
- rtx reg = gen_rtx (REG, word_mode, regbase + *arg_words + bias);
- if (TARGET_64BIT)
- cum->adjust[ cum->num_adjusts++ ] = gen_ashldi3 (reg, reg, amount);
- else
- cum->adjust[ cum->num_adjusts++ ] = gen_ashlsi3 (reg, reg, amount);
- }
- }
-
- if (mode == VOIDmode && cum->num_adjusts > 0)
- ret = gen_rtx (PARALLEL, VOIDmode, gen_rtvec_v (cum->num_adjusts, cum->adjust));
-
- return ret;
-}
-
-
-int
-function_arg_partial_nregs (cum, mode, type, named)
- CUMULATIVE_ARGS *cum; /* current arg information */
- enum machine_mode mode; /* current arg mode */
- tree type; /* type of the argument or 0 if lib support */
- int named; /* != 0 for normal args, == 0 for ... args */
-{
- if ((mode == BLKmode
- || GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
- || GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)
- && cum->arg_words < MAX_ARGS_IN_REGISTERS
- && mips_abi != ABI_EABI)
- {
- int words;
- if (mode == BLKmode)
- words = ((int_size_in_bytes (type) + UNITS_PER_WORD - 1)
- / UNITS_PER_WORD);
- else
- words = (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
-
- if (words + cum->arg_words <= MAX_ARGS_IN_REGISTERS)
- return 0; /* structure fits in registers */
-
- if (TARGET_DEBUG_E_MODE)
- fprintf (stderr, "function_arg_partial_nregs = %d\n",
- MAX_ARGS_IN_REGISTERS - cum->arg_words);
-
- return MAX_ARGS_IN_REGISTERS - cum->arg_words;
- }
-
- else if (mode == DImode && cum->arg_words == MAX_ARGS_IN_REGISTERS-1
- && ! TARGET_64BIT
- && mips_abi != ABI_EABI)
- {
- if (TARGET_DEBUG_E_MODE)
- fprintf (stderr, "function_arg_partial_nregs = 1\n");
-
- return 1;
- }
-
- return 0;
-}
-
-/* Abort after printing out a specific insn. */
-
-void
-abort_with_insn (insn, reason)
- rtx insn;
- char *reason;
-{
- error (reason);
- debug_rtx (insn);
- abort ();
-}
-
-/* Write a message to stderr (for use in macros expanded in files that do not
- include stdio.h). */
-
-void
-trace (s, s1, s2)
- char *s, *s1, *s2;
-{
- fprintf (stderr, s, s1, s2);
-}
-
-
-#ifdef SIGINFO
-
-static void
-siginfo (signo)
- int signo;
-{
- fprintf (stderr, "compiling '%s' in '%s'\n",
- (current_function_name != (char *)0) ? current_function_name : "<toplevel>",
- (current_function_file != (char *)0) ? current_function_file : "<no file>");
- fflush (stderr);
-}
-#endif /* SIGINFO */
-
-
-/* Set up the threshold for data to go into the small data area, instead
- of the normal data area, and detect any conflicts in the switches. */
-
-void
-override_options ()
-{
- register int i, start;
- register int regno;
- register enum machine_mode mode;
-
- mips_section_threshold = (g_switch_set) ? g_switch_value : MIPS_DEFAULT_GVALUE;
-
- if (mips_section_threshold <= 0)
- target_flags &= ~MASK_GPOPT;
- else if (optimize)
- target_flags |= MASK_GPOPT;
-
- /* Get the architectural level. */
- if (mips_isa_string == (char *)0)
- {
-#ifdef MIPS_ISA_DEFAULT
- mips_isa = MIPS_ISA_DEFAULT;
-#else
- mips_isa = 1;
-#endif
- }
-
- else if (isdigit (*mips_isa_string))
- {
- mips_isa = atoi (mips_isa_string);
- if (mips_isa < 1 || mips_isa > 4)
- {
- error ("-mips%d not supported", mips_isa);
- mips_isa = 1;
- }
- }
-
- else
- {
- error ("bad value (%s) for -mips switch", mips_isa_string);
- mips_isa = 1;
- }
-
-#ifdef MIPS_ABI_DEFAULT
- /* Get the ABI to use. Currently this code is only used for Irix 6. */
- if (mips_abi_string == (char *) 0)
- mips_abi = MIPS_ABI_DEFAULT;
- else if (! strcmp (mips_abi_string, "32")
- || ! strcmp (mips_abi_string, "o32"))
- mips_abi = ABI_32;
- else if (! strcmp (mips_abi_string, "n32"))
- mips_abi = ABI_N32;
- else if (! strcmp (mips_abi_string, "64")
- || ! strcmp (mips_abi_string, "n64"))
- mips_abi = ABI_64;
- else if (! strcmp (mips_abi_string, "eabi"))
- mips_abi = ABI_EABI;
- else
- error ("bad value (%s) for -mabi= switch", mips_abi_string);
-
- /* A specified ISA defaults the ABI if it was not specified. */
- if (mips_abi_string == 0 && mips_isa_string && mips_abi != ABI_EABI)
- {
- if (mips_isa <= 2)
- mips_abi = ABI_32;
- else
- mips_abi = ABI_64;
- }
- /* A specified ABI defaults the ISA if it was not specified. */
- else if (mips_isa_string == 0 && mips_abi_string && mips_abi != ABI_EABI)
- {
- if (mips_abi == ABI_32)
- mips_isa = 1;
- else if (mips_abi == ABI_N32)
- mips_isa = 3;
- else
- mips_isa = 4;
- }
- /* If both ABI and ISA were specified, check for conflicts. */
- else if (mips_isa_string && mips_abi_string)
- {
- if ((mips_isa <= 2 && (mips_abi == ABI_N32 || mips_abi == ABI_64))
- || (mips_isa >= 3 && mips_abi == ABI_32))
- error ("-mabi=%s does not support -mips%d", mips_abi_string, mips_isa);
- }
-
- /* Override TARGET_DEFAULT if necessary. */
- if (mips_abi == ABI_32)
- target_flags &= ~ (MASK_FLOAT64|MASK_64BIT);
-
- /* In the EABI in 64 bit mode, longs and pointers are 64 bits. */
- if (mips_abi == ABI_EABI && TARGET_64BIT)
- target_flags |= MASK_LONG64;
-
- /* ??? This doesn't work yet, so don't let people try to use it. */
- if (mips_abi == ABI_32)
- error ("The -mabi=32 support does not work yet.");
-#else
- if (mips_abi_string)
- error ("This target does not support the -mabi switch.");
-#endif
-
-#ifdef MIPS_CPU_STRING_DEFAULT
- /* ??? There is a minor inconsistency here. If the user specifies an ISA
- greater than that supported by the default processor, then the user gets
- an error. Normally, the compiler will just default to the base level cpu
- for the indicated isa. */
- if (mips_cpu_string == (char *)0)
- mips_cpu_string = MIPS_CPU_STRING_DEFAULT;
-#endif
-
- /* Identify the processor type */
- if (mips_cpu_string == (char *)0
- || !strcmp (mips_cpu_string, "default")
- || !strcmp (mips_cpu_string, "DEFAULT"))
- {
- switch (mips_isa)
- {
- default:
- mips_cpu_string = "3000";
- mips_cpu = PROCESSOR_R3000;
- break;
- case 2:
- mips_cpu_string = "6000";
- mips_cpu = PROCESSOR_R6000;
- break;
- case 3:
- mips_cpu_string = "4000";
- mips_cpu = PROCESSOR_R4000;
- break;
- case 4:
- mips_cpu_string = "8000";
- mips_cpu = PROCESSOR_R8000;
- break;
- }
- }
-
- else
- {
- char *p = mips_cpu_string;
- int seen_v = FALSE;
-
- /* We need to cope with the various "vr" prefixes for the NEC 4300
- and 4100 processors. */
- if (*p == 'v' || *p == 'V')
- {
- seen_v = TRUE;
- p++;
- }
- if (*p == 'r' || *p == 'R')
- p++;
-
- /* Since there is no difference between a R2000 and R3000 in
- terms of the scheduler, we collapse them into just an R3000. */
-
- mips_cpu = PROCESSOR_DEFAULT;
- switch (*p)
- {
- case '2':
- if (!strcmp (p, "2000") || !strcmp (p, "2k") || !strcmp (p, "2K"))
- mips_cpu = PROCESSOR_R3000;
- break;
-
- case '3':
- if (!strcmp (p, "3000") || !strcmp (p, "3k") || !strcmp (p, "3K"))
- mips_cpu = PROCESSOR_R3000;
- break;
-
- case '4':
- if (!strcmp (p, "4000") || !strcmp (p, "4k") || !strcmp (p, "4K"))
- mips_cpu = PROCESSOR_R4000;
- /* The vr4100 is a non-FP ISA III processor with some extra
- instructions. */
- else if (!strcmp (p, "4100")) {
- mips_cpu = PROCESSOR_R4100;
- target_flags |= MASK_SOFT_FLOAT ;
- }
- /* The vr4300 is a standard ISA III processor, but with a different
- pipeline. */
- else if (!strcmp (p, "4300"))
- mips_cpu = PROCESSOR_R4300;
- /* The r4400 is exactly the same as the r4000 from the compiler's
- viewpoint. */
- else if (!strcmp (p, "4400"))
- mips_cpu = PROCESSOR_R4000;
- else if (!strcmp (p, "4600"))
- mips_cpu = PROCESSOR_R4600;
- else if (!strcmp (p, "4650"))
- mips_cpu = PROCESSOR_R4650;
- break;
-
- case '5':
- if (!strcmp (p, "5000") || !strcmp (p, "5k") || !strcmp (p, "5K"))
- mips_cpu = PROCESSOR_R5000;
- break;
-
- case '6':
- if (!strcmp (p, "6000") || !strcmp (p, "6k") || !strcmp (p, "6K"))
- mips_cpu = PROCESSOR_R6000;
- break;
-
- case '8':
- if (!strcmp (p, "8000"))
- mips_cpu = PROCESSOR_R8000;
- break;
-
- case 'o':
- if (!strcmp (p, "orion"))
- mips_cpu = PROCESSOR_R4600;
- break;
- }
-
- if (seen_v
- && mips_cpu != PROCESSOR_R4300
- && mips_cpu != PROCESSOR_R4100
- && mips_cpu != PROCESSOR_R5000)
- mips_cpu = PROCESSOR_DEFAULT;
-
- if (mips_cpu == PROCESSOR_DEFAULT)
- {
- error ("bad value (%s) for -mcpu= switch", mips_cpu_string);
- mips_cpu_string = "default";
- }
- }
-
- if ((mips_cpu == PROCESSOR_R3000 && mips_isa > 1)
- || (mips_cpu == PROCESSOR_R6000 && mips_isa > 2)
- || ((mips_cpu == PROCESSOR_R4000
- || mips_cpu == PROCESSOR_R4100
- || mips_cpu == PROCESSOR_R4300
- || mips_cpu == PROCESSOR_R4600
- || mips_cpu == PROCESSOR_R4650)
- && mips_isa > 3))
- error ("-mcpu=%s does not support -mips%d", mips_cpu_string, mips_isa);
-
- /* make sure sizes of ints/longs/etc. are ok */
- if (mips_isa < 3)
- {
- if (TARGET_INT64)
- fatal ("Only MIPS-III or MIPS-IV CPUs can support 64 bit ints");
-
- else if (TARGET_LONG64)
- fatal ("Only MIPS-III or MIPS-IV CPUs can support 64 bit longs");
-
- else if (TARGET_FLOAT64)
- fatal ("Only MIPS-III or MIPS-IV CPUs can support 64 bit fp registers");
-
- else if (TARGET_64BIT)
- fatal ("Only MIPS-III or MIPS-IV CPUs can support 64 bit gp registers");
- }
-
- if (mips_abi != ABI_32)
- flag_pcc_struct_return = 0;
-
- /* Tell halfpic.c that we have half-pic code if we do. */
- if (TARGET_HALF_PIC)
- HALF_PIC_INIT ();
-
- /* -fpic (-KPIC) is the default when TARGET_ABICALLS is defined. We need
- to set flag_pic so that the LEGITIMATE_PIC_OPERAND_P macro will work. */
- /* ??? -non_shared turns off pic code generation, but this is not
- implemented. */
- if (TARGET_ABICALLS)
- {
- mips_abicalls = MIPS_ABICALLS_YES;
- flag_pic = 1;
- if (mips_section_threshold > 0)
- warning ("-G is incompatible with PIC code which is the default");
- }
- else
- mips_abicalls = MIPS_ABICALLS_NO;
-
- /* -membedded-pic is a form of PIC code suitable for embedded
- systems. All calls are made using PC relative addressing, and
- all data is addressed using the $gp register. This requires gas,
- which does most of the work, and GNU ld, which automatically
- expands PC relative calls which are out of range into a longer
- instruction sequence. All gcc really does differently is
- generate a different sequence for a switch. */
- if (TARGET_EMBEDDED_PIC)
- {
- flag_pic = 1;
- if (TARGET_ABICALLS)
- warning ("-membedded-pic and -mabicalls are incompatible");
- if (g_switch_set)
- warning ("-G and -membedded-pic are incompatible");
- /* Setting mips_section_threshold is not required, because gas
- will force everything to be GP addressable anyhow, but
- setting it will cause gcc to make better estimates of the
- number of instructions required to access a particular data
- item. */
- mips_section_threshold = 0x7fffffff;
- }
-
- /* ??? This does not work when target addresses are DImode.
- This is because we are missing DImode high/lo_sum patterns. */
-
- if (TARGET_GAS && optimize && ! flag_pic && Pmode == SImode)
- mips_split_addresses = 1;
- else
- mips_split_addresses = 0;
-
- /* -mrnames says to use the MIPS software convention for register
- names instead of the hardware names (ie, $a0 instead of $4).
- We do this by switching the names in mips_reg_names, which the
- reg_names points into via the REGISTER_NAMES macro. */
-
- if (TARGET_NAME_REGS)
- bcopy ((char *) mips_sw_reg_names, (char *) mips_reg_names, sizeof (mips_reg_names));
-
- /* If this is OSF/1, set up a SIGINFO handler so we can see what function
- is currently being compiled. */
-#ifdef SIGINFO
- if (getenv ("GCC_SIGINFO") != (char *)0)
- {
- struct sigaction action;
- action.sa_handler = siginfo;
- action.sa_mask = 0;
- action.sa_flags = SA_RESTART;
- sigaction (SIGINFO, &action, (struct sigaction *)0);
- }
-#endif
-
-#if defined(_IOLBF)
-#if defined(ultrix) || defined(__ultrix) || defined(__OSF1__) || defined(__osf__) || defined(osf)
- /* If -mstats and -quiet, make stderr line buffered. */
- if (quiet_flag && TARGET_STATS)
- setvbuf (stderr, (char *)0, _IOLBF, BUFSIZ);
-#endif
-#endif
-
- /* Initialize the high and low values for legitimate floating point
- constants. Rather than trying to get the accuracy down to the
- last bit, just use approximate ranges. */
- dfhigh = REAL_VALUE_ATOF ("1.0e300", DFmode);
- dflow = REAL_VALUE_ATOF ("1.0e-300", DFmode);
- sfhigh = REAL_VALUE_ATOF ("1.0e38", SFmode);
- sflow = REAL_VALUE_ATOF ("1.0e-38", SFmode);
-
- mips_print_operand_punct['?'] = TRUE;
- mips_print_operand_punct['#'] = TRUE;
- mips_print_operand_punct['&'] = TRUE;
- mips_print_operand_punct['!'] = TRUE;
- mips_print_operand_punct['*'] = TRUE;
- mips_print_operand_punct['@'] = TRUE;
- mips_print_operand_punct['.'] = TRUE;
- mips_print_operand_punct['('] = TRUE;
- mips_print_operand_punct[')'] = TRUE;
- mips_print_operand_punct['['] = TRUE;
- mips_print_operand_punct[']'] = TRUE;
- mips_print_operand_punct['<'] = TRUE;
- mips_print_operand_punct['>'] = TRUE;
- mips_print_operand_punct['{'] = TRUE;
- mips_print_operand_punct['}'] = TRUE;
- mips_print_operand_punct['^'] = TRUE;
-
- mips_char_to_class['d'] = GR_REGS;
- mips_char_to_class['f'] = ((TARGET_HARD_FLOAT) ? FP_REGS : NO_REGS);
- mips_char_to_class['h'] = HI_REG;
- mips_char_to_class['l'] = LO_REG;
- mips_char_to_class['a'] = HILO_REG;
- mips_char_to_class['x'] = MD_REGS;
- mips_char_to_class['b'] = ALL_REGS;
- mips_char_to_class['y'] = GR_REGS;
- mips_char_to_class['z'] = ST_REGS;
-
- /* Set up array to map GCC register number to debug register number.
- Ignore the special purpose register numbers. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- mips_dbx_regno[i] = -1;
-
- start = GP_DBX_FIRST - GP_REG_FIRST;
- for (i = GP_REG_FIRST; i <= GP_REG_LAST; i++)
- mips_dbx_regno[i] = i + start;
-
- start = FP_DBX_FIRST - FP_REG_FIRST;
- for (i = FP_REG_FIRST; i <= FP_REG_LAST; i++)
- mips_dbx_regno[i] = i + start;
-
- /* Set up array giving whether a given register can hold a given mode.
- At present, restrict ints from being in FP registers, because reload
- is a little enthusiastic about storing extra values in FP registers,
- and this is not good for things like OS kernels. Also, due to the
- mandatory delay, it is as fast to load from cached memory as to move
- from the FP register. */
-
- for (mode = VOIDmode;
- mode != MAX_MACHINE_MODE;
- mode = (enum machine_mode)((int)mode + 1))
- {
- register int size = GET_MODE_SIZE (mode);
- register enum mode_class class = GET_MODE_CLASS (mode);
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- {
- register int temp;
-
- if (mode == CCmode)
- {
- if (mips_isa < 4)
- temp = (regno == FPSW_REGNUM);
- else
- temp = (ST_REG_P (regno)
- || GP_REG_P (regno)
- || FP_REG_P (regno));
- }
-
- else if (GP_REG_P (regno))
- temp = ((regno & 1) == 0 || (size <= UNITS_PER_WORD));
-
- else if (FP_REG_P (regno))
- temp = ((TARGET_FLOAT64 || ((regno & 1) == 0))
- && (class == MODE_FLOAT
- || class == MODE_COMPLEX_FLOAT
- || (TARGET_DEBUG_H_MODE && class == MODE_INT))
- && (! TARGET_SINGLE_FLOAT || size <= 4));
-
- else if (MD_REG_P (regno))
- temp = (class == MODE_INT
- && (size <= UNITS_PER_WORD
- || (regno == MD_REG_FIRST && size == 2 * UNITS_PER_WORD)));
-
- else
- temp = FALSE;
-
- mips_hard_regno_mode_ok[(int)mode][regno] = temp;
- }
- }
-}
-
-
-/*
- * The MIPS debug format wants all automatic variables and arguments
- * to be in terms of the virtual frame pointer (stack pointer before
- * any adjustment in the function), while the MIPS 3.0 linker wants
- * the frame pointer to be the stack pointer after the initial
- * adjustment. So, we do the adjustment here. The arg pointer (which
- * is eliminated) points to the virtual frame pointer, while the frame
- * pointer (which may be eliminated) points to the stack pointer after
- * the initial adjustments.
- */
-
-int
-mips_debugger_offset (addr, offset)
- rtx addr;
- int offset;
-{
- rtx offset2 = const0_rtx;
- rtx reg = eliminate_constant_term (addr, &offset2);
-
- if (!offset)
- offset = INTVAL (offset2);
-
- if (reg == stack_pointer_rtx || reg == frame_pointer_rtx)
- {
- int frame_size = (!current_frame_info.initialized)
- ? compute_frame_size (get_frame_size ())
- : current_frame_info.total_size;
-
- offset = offset - frame_size;
- }
- /* sdbout_parms does not want this to crash for unrecognized cases. */
-#if 0
- else if (reg != arg_pointer_rtx)
- abort_with_insn (addr, "mips_debugger_offset called with non stack/frame/arg pointer.");
-#endif
-
- return offset;
-}
-
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand X. X is an RTL
- expression.
-
- CODE is a value that can be used to specify one of several ways
- of printing the operand. It is used when identical operands
- must be printed differently depending on the context. CODE
- comes from the `%' specification that was used to request
- printing of the operand. If the specification was just `%DIGIT'
- then CODE is 0; if the specification was `%LTR DIGIT' then CODE
- is the ASCII code for LTR.
-
- If X is a register, this macro should print the register's name.
- The names can be found in an array `reg_names' whose type is
- `char *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
-
- When the machine description has a specification `%PUNCT' (a `%'
- followed by a punctuation character), this macro is called with
- a null pointer for X and the punctuation character for CODE.
-
- The MIPS specific codes are:
-
- 'X' X is CONST_INT, prints 32 bits in hexadecimal format = "0x%08x",
- 'x' X is CONST_INT, prints 16 bits in hexadecimal format = "0x%04x",
- 'd' output integer constant in decimal,
- 'z' if the operand is 0, use $0 instead of normal operand.
- 'D' print second register of double-word register operand.
- 'L' print low-order register of double-word register operand.
- 'M' print high-order register of double-word register operand.
- 'C' print part of opcode for a branch condition.
- 'N' print part of opcode for a branch condition, inverted.
- 'S' X is CODE_LABEL, print with prefix of "LS" (for embedded switch).
- 'B' print 'z' for EQ, 'n' for NE
- 'b' print 'n' for EQ, 'z' for NE
- 'T' print 'f' for EQ, 't' for NE
- 't' print 't' for EQ, 'f' for NE
- 'Z' print register and a comma, but print nothing for $fcc0
- '(' Turn on .set noreorder
- ')' Turn on .set reorder
- '[' Turn on .set noat
- ']' Turn on .set at
- '<' Turn on .set nomacro
- '>' Turn on .set macro
- '{' Turn on .set volatile (not GAS)
- '}' Turn on .set novolatile (not GAS)
- '&' Turn on .set noreorder if filling delay slots
- '*' Turn on both .set noreorder and .set nomacro if filling delay slots
- '!' Turn on .set nomacro if filling delay slots
- '#' Print nop if in a .set noreorder section.
- '?' Print 'l' if we are to use a branch likely instead of normal branch.
- '@' Print the name of the assembler temporary register (at or $1).
- '.' Print the name of the register with a hard-wired zero (zero or $0).
- '^' Print the name of the pic call-through register (t9 or $25). */
-
-void
-print_operand (file, op, letter)
- FILE *file; /* file to write to */
- rtx op; /* operand to print */
- int letter; /* %<letter> or 0 */
-{
- register enum rtx_code code;
-
- if (PRINT_OPERAND_PUNCT_VALID_P (letter))
- {
- switch (letter)
- {
- default:
- error ("PRINT_OPERAND: Unknown punctuation '%c'", letter);
- break;
-
- case '?':
- if (mips_branch_likely)
- putc ('l', file);
- break;
-
- case '@':
- fputs (reg_names [GP_REG_FIRST + 1], file);
- break;
-
- case '^':
- fputs (reg_names [PIC_FUNCTION_ADDR_REGNUM], file);
- break;
-
- case '.':
- fputs (reg_names [GP_REG_FIRST + 0], file);
- break;
-
- case '&':
- if (final_sequence != 0 && set_noreorder++ == 0)
- fputs (".set\tnoreorder\n\t", file);
- break;
-
- case '*':
- if (final_sequence != 0)
- {
- if (set_noreorder++ == 0)
- fputs (".set\tnoreorder\n\t", file);
-
- if (set_nomacro++ == 0)
- fputs (".set\tnomacro\n\t", file);
- }
- break;
-
- case '!':
- if (final_sequence != 0 && set_nomacro++ == 0)
- fputs ("\n\t.set\tnomacro", file);
- break;
-
- case '#':
- if (set_noreorder != 0)
- fputs ("\n\tnop", file);
-
- else if (TARGET_STATS)
- fputs ("\n\t#nop", file);
-
- break;
-
- case '(':
- if (set_noreorder++ == 0)
- fputs (".set\tnoreorder\n\t", file);
- break;
-
- case ')':
- if (set_noreorder == 0)
- error ("internal error: %%) found without a %%( in assembler pattern");
-
- else if (--set_noreorder == 0)
- fputs ("\n\t.set\treorder", file);
-
- break;
-
- case '[':
- if (set_noat++ == 0)
- fputs (".set\tnoat\n\t", file);
- break;
-
- case ']':
- if (set_noat == 0)
- error ("internal error: %%] found without a %%[ in assembler pattern");
-
- else if (--set_noat == 0)
- fputs ("\n\t.set\tat", file);
-
- break;
-
- case '<':
- if (set_nomacro++ == 0)
- fputs (".set\tnomacro\n\t", file);
- break;
-
- case '>':
- if (set_nomacro == 0)
- error ("internal error: %%> found without a %%< in assembler pattern");
-
- else if (--set_nomacro == 0)
- fputs ("\n\t.set\tmacro", file);
-
- break;
-
- case '{':
- if (set_volatile++ == 0)
- fprintf (file, "%s.set\tvolatile\n\t", (TARGET_MIPS_AS) ? "" : "#");
- break;
-
- case '}':
- if (set_volatile == 0)
- error ("internal error: %%} found without a %%{ in assembler pattern");
-
- else if (--set_volatile == 0)
- fprintf (file, "\n\t%s.set\tnovolatile", (TARGET_MIPS_AS) ? "" : "#");
-
- break;
- }
- return;
- }
-
- if (! op)
- {
- error ("PRINT_OPERAND null pointer");
- return;
- }
-
- code = GET_CODE (op);
-
- if (code == SIGN_EXTEND)
- {
- op = XEXP (op, 0);
- code = GET_CODE (op);
- }
-
- if (letter == 'C')
- switch (code)
- {
- case EQ: fputs ("eq", file); break;
- case NE: fputs ("ne", file); break;
- case GT: fputs ("gt", file); break;
- case GE: fputs ("ge", file); break;
- case LT: fputs ("lt", file); break;
- case LE: fputs ("le", file); break;
- case GTU: fputs ("gtu", file); break;
- case GEU: fputs ("geu", file); break;
- case LTU: fputs ("ltu", file); break;
- case LEU: fputs ("leu", file); break;
-
- default:
- abort_with_insn (op, "PRINT_OPERAND, invalid insn for %%C");
- }
-
- else if (letter == 'N')
- switch (code)
- {
- case EQ: fputs ("ne", file); break;
- case NE: fputs ("eq", file); break;
- case GT: fputs ("le", file); break;
- case GE: fputs ("lt", file); break;
- case LT: fputs ("ge", file); break;
- case LE: fputs ("gt", file); break;
- case GTU: fputs ("leu", file); break;
- case GEU: fputs ("ltu", file); break;
- case LTU: fputs ("geu", file); break;
- case LEU: fputs ("gtu", file); break;
-
- default:
- abort_with_insn (op, "PRINT_OPERAND, invalid insn for %%N");
- }
-
- else if (letter == 'S')
- {
- char buffer[100];
-
- ASM_GENERATE_INTERNAL_LABEL (buffer, "LS", CODE_LABEL_NUMBER (op));
- assemble_name (file, buffer);
- }
-
- else if (letter == 'Z')
- {
- register int regnum;
-
- if (code != REG)
- abort ();
- regnum = REGNO (op);
- if (! ST_REG_P (regnum))
- abort ();
- if (regnum != ST_REG_FIRST)
- fprintf (file, "%s,", reg_names[regnum]);
- }
-
- else if (code == REG || code == SUBREG)
- {
- register int regnum;
-
- if (code == REG)
- regnum = REGNO (op);
- else
- regnum = true_regnum (op);
-
- if ((letter == 'M' && ! WORDS_BIG_ENDIAN)
- || (letter == 'L' && WORDS_BIG_ENDIAN)
- || letter == 'D')
- regnum++;
-
- fprintf (file, "%s", reg_names[regnum]);
- }
-
- else if (code == MEM)
- output_address (XEXP (op, 0));
-
- else if (code == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT)
- {
- REAL_VALUE_TYPE d;
- char s[30];
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, op);
- REAL_VALUE_TO_DECIMAL (d, "%.20e", s);
- fprintf (file, s);
- }
-
- else if ((letter == 'x') && (GET_CODE(op) == CONST_INT))
- fprintf (file, "0x%04x", 0xffff & (INTVAL(op)));
-
- else if ((letter == 'X') && (GET_CODE(op) == CONST_INT)
- && HOST_BITS_PER_WIDE_INT == 32)
- fprintf (file, "0x%08x", INTVAL(op));
-
- else if ((letter == 'X') && (GET_CODE(op) == CONST_INT)
- && HOST_BITS_PER_WIDE_INT == 64)
- fprintf (file, "0x%016lx", INTVAL(op));
-
- else if ((letter == 'd') && (GET_CODE(op) == CONST_INT))
- fprintf (file, "%d", (INTVAL(op)));
-
- else if (letter == 'z'
- && (GET_CODE (op) == CONST_INT)
- && INTVAL (op) == 0)
- fputs (reg_names[GP_REG_FIRST], file);
-
- else if (letter == 'd' || letter == 'x' || letter == 'X')
- fatal ("PRINT_OPERAND: letter %c was found & insn was not CONST_INT", letter);
-
- else if (letter == 'B')
- fputs (code == EQ ? "z" : "n", file);
- else if (letter == 'b')
- fputs (code == EQ ? "n" : "z", file);
- else if (letter == 'T')
- fputs (code == EQ ? "f" : "t", file);
- else if (letter == 't')
- fputs (code == EQ ? "t" : "f", file);
-
- else
- output_addr_const (file, op);
-}
-
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand that is a memory
- reference whose address is ADDR. ADDR is an RTL expression.
-
- On some machines, the syntax for a symbolic address depends on
- the section that the address refers to. On these machines,
- define the macro `ENCODE_SECTION_INFO' to store the information
- into the `symbol_ref', and then check for it here. */
-
-void
-print_operand_address (file, addr)
- FILE *file;
- rtx addr;
-{
- if (!addr)
- error ("PRINT_OPERAND_ADDRESS, null pointer");
-
- else
- switch (GET_CODE (addr))
- {
- default:
- abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, invalid insn #1");
- break;
-
- case REG:
- if (REGNO (addr) == ARG_POINTER_REGNUM)
- abort_with_insn (addr, "Arg pointer not eliminated.");
-
- fprintf (file, "0(%s)", reg_names [REGNO (addr)]);
- break;
-
- case LO_SUM:
- {
- register rtx arg0 = XEXP (addr, 0);
- register rtx arg1 = XEXP (addr, 1);
-
- if (! mips_split_addresses)
- abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, Spurious LO_SUM.");
-
- if (GET_CODE (arg0) != REG)
- abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, LO_SUM with #1 not REG.");
-
- fprintf (file, "%%lo(");
- print_operand_address (file, arg1);
- fprintf (file, ")(%s)", reg_names [REGNO (arg0)]);
- }
- break;
-
- case PLUS:
- {
- register rtx reg = (rtx)0;
- register rtx offset = (rtx)0;
- register rtx arg0 = XEXP (addr, 0);
- register rtx arg1 = XEXP (addr, 1);
-
- if (GET_CODE (arg0) == REG)
- {
- reg = arg0;
- offset = arg1;
- if (GET_CODE (offset) == REG)
- abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, 2 regs");
- }
- else if (GET_CODE (arg1) == REG)
- {
- reg = arg1;
- offset = arg0;
- }
- else if (CONSTANT_P (arg0) && CONSTANT_P (arg1))
- {
- output_addr_const (file, addr);
- break;
- }
- else
- abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, no regs");
-
- if (!CONSTANT_P (offset))
- abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, invalid insn #2");
-
- if (REGNO (reg) == ARG_POINTER_REGNUM)
- abort_with_insn (addr, "Arg pointer not eliminated.");
-
- output_addr_const (file, offset);
- fprintf (file, "(%s)", reg_names [REGNO (reg)]);
- }
- break;
-
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST_INT:
- case CONST:
- output_addr_const (file, addr);
- break;
- }
-}
-
-
-/* If optimizing for the global pointer, keep track of all of
- the externs, so that at the end of the file, we can emit
- the appropriate .extern declaration for them, before writing
- out the text section. We assume that all names passed to
- us are in the permanent obstack, so that they will be valid
- at the end of the compilation.
-
- If we have -G 0, or the extern size is unknown, don't bother
- emitting the .externs. */
-
-int
-mips_output_external (file, decl, name)
- FILE *file;
- tree decl;
- char *name;
-{
- register struct extern_list *p;
- int len;
-
- if (TARGET_GP_OPT
- && ((TREE_CODE (decl)) != FUNCTION_DECL)
- && ((len = int_size_in_bytes (TREE_TYPE (decl))) > 0))
- {
- p = (struct extern_list *)permalloc ((long) sizeof (struct extern_list));
- p->next = extern_head;
- p->name = name;
- p->size = len;
- extern_head = p;
- }
-
-#ifdef ASM_OUTPUT_UNDEF_FUNCTION
- if (TREE_CODE (decl) == FUNCTION_DECL
- /* ??? Don't include alloca, since gcc will always expand it
- inline. If we don't do this, libg++ fails to build. */
- && strcmp (name, "alloca")
- /* ??? Don't include __builtin_next_arg, because then gcc will not
- bootstrap under Irix 5.1. */
- && strcmp (name, "__builtin_next_arg"))
- {
- p = (struct extern_list *)permalloc ((long) sizeof (struct extern_list));
- p->next = extern_head;
- p->name = name;
- p->size = -1;
- extern_head = p;
- }
-#endif
-
- return 0;
-}
-
-#ifdef ASM_OUTPUT_UNDEF_FUNCTION
-int
-mips_output_external_libcall (file, name)
- FILE *file;
- char *name;
-{
- register struct extern_list *p;
-
- p = (struct extern_list *)permalloc ((long) sizeof (struct extern_list));
- p->next = extern_head;
- p->name = name;
- p->size = -1;
- extern_head = p;
-
- return 0;
-}
-#endif
-
-
-/* Compute a string to use as a temporary file name. */
-
-/* On MSDOS, write temp files in current dir
- because there's no place else we can expect to use. */
-#if __MSDOS__
-#ifndef P_tmpdir
-#define P_tmpdir "./"
-#endif
-#endif
-
-static FILE *
-make_temp_file ()
-{
- FILE *stream;
- char *base = getenv ("TMPDIR");
- int len;
-
- if (base == (char *)0)
- {
-#ifdef P_tmpdir
- if (access (P_tmpdir, R_OK | W_OK) == 0)
- base = P_tmpdir;
- else
-#endif
- if (access ("/usr/tmp", R_OK | W_OK) == 0)
- base = "/usr/tmp/";
- else
- base = "/tmp/";
- }
-
- len = strlen (base);
- /* temp_filename is global, so we must use malloc, not alloca. */
- temp_filename = (char *) xmalloc (len + sizeof("/ctXXXXXX"));
- strcpy (temp_filename, base);
- if (len > 0 && temp_filename[len-1] != '/')
- temp_filename[len++] = '/';
-
- strcpy (temp_filename + len, "ctXXXXXX");
- mktemp (temp_filename);
-
- stream = fopen (temp_filename, "w+");
- if (!stream)
- pfatal_with_name (temp_filename);
-
-#ifndef __MSDOS__
- /* In MSDOS, we cannot unlink the temporary file until we are finished using
- it. Otherwise, we delete it now, so that it will be gone even if the
- compiler happens to crash. */
- unlink (temp_filename);
-#endif
- return stream;
-}
-
-
-/* Emit a new filename to a stream. If this is MIPS ECOFF, watch out
- for .file's that start within a function. If we are smuggling stabs, try to
- put out a MIPS ECOFF file and a stab. */
-
-void
-mips_output_filename (stream, name)
- FILE *stream;
- char *name;
-{
- static int first_time = TRUE;
- char ltext_label_name[100];
-
- if (first_time)
- {
- first_time = FALSE;
- SET_FILE_NUMBER ();
- current_function_file = name;
- ASM_OUTPUT_FILENAME (stream, num_source_filenames, name);
- /* This tells mips-tfile that stabs will follow. */
- if (!TARGET_GAS && write_symbols == DBX_DEBUG)
- fprintf (stream, "\t#@stabs\n");
- }
-
- else if (write_symbols == DBX_DEBUG)
- {
- ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
- fprintf (stream, "%s ", ASM_STABS_OP);
- output_quoted_string (stream, name);
- fprintf (stream, ",%d,0,0,%s\n", N_SOL, &ltext_label_name[1]);
- }
-
- else if (name != current_function_file
- && strcmp (name, current_function_file) != 0)
- {
- if (inside_function && !TARGET_GAS)
- {
- if (!file_in_function_warning)
- {
- file_in_function_warning = TRUE;
- ignore_line_number = TRUE;
- warning ("MIPS ECOFF format does not allow changing filenames within functions with #line");
- }
- }
- else
- {
- SET_FILE_NUMBER ();
- current_function_file = name;
- ASM_OUTPUT_FILENAME (stream, num_source_filenames, name);
- }
- }
-}
-
-
-/* Emit a linenumber. For encapsulated stabs, we need to put out a stab
- as well as a .loc, since it is possible that MIPS ECOFF might not be
- able to represent the location for inlines that come from a different
- file. */
-
-void
-mips_output_lineno (stream, line)
- FILE *stream;
- int line;
-{
- if (write_symbols == DBX_DEBUG)
- {
- ++sym_lineno;
- fprintf (stream, "%sLM%d:\n\t%s %d,0,%d,%sLM%d\n",
- LOCAL_LABEL_PREFIX, sym_lineno, ASM_STABN_OP, N_SLINE, line,
- LOCAL_LABEL_PREFIX, sym_lineno);
- }
-
- else
- {
- fprintf (stream, "\n\t%s.loc\t%d %d\n",
- (ignore_line_number) ? "#" : "",
- num_source_filenames, line);
-
- LABEL_AFTER_LOC (stream);
- }
-}
-
-
-/* If defined, a C statement to be executed just prior to the
- output of assembler code for INSN, to modify the extracted
- operands so they will be output differently.
-
- Here the argument OPVEC is the vector containing the operands
- extracted from INSN, and NOPERANDS is the number of elements of
- the vector which contain meaningful data for this insn. The
- contents of this vector are what will be used to convert the
- insn template into assembler code, so you can change the
- assembler output by changing the contents of the vector.
-
- We use it to check if the current insn needs a nop in front of it
- because of load delays, and also to update the delay slot
- statistics. */
-
-/* ??? There is no real need for this function, because it never actually
- emits a NOP anymore. */
-
-void
-final_prescan_insn (insn, opvec, noperands)
- rtx insn;
- rtx opvec[];
- int noperands;
-{
- if (dslots_number_nops > 0)
- {
- rtx pattern = PATTERN (insn);
- int length = get_attr_length (insn);
-
- /* Do we need to emit a NOP? */
- if (length == 0
- || (mips_load_reg != (rtx)0 && reg_mentioned_p (mips_load_reg, pattern))
- || (mips_load_reg2 != (rtx)0 && reg_mentioned_p (mips_load_reg2, pattern))
- || (mips_load_reg3 != (rtx)0 && reg_mentioned_p (mips_load_reg3, pattern))
- || (mips_load_reg4 != (rtx)0 && reg_mentioned_p (mips_load_reg4, pattern)))
- fputs ("\t#nop\n", asm_out_file);
-
- else
- dslots_load_filled++;
-
- while (--dslots_number_nops > 0)
- fputs ("\t#nop\n", asm_out_file);
-
- mips_load_reg = (rtx)0;
- mips_load_reg2 = (rtx)0;
- mips_load_reg3 = (rtx)0;
- mips_load_reg4 = (rtx)0;
- }
-
- if (TARGET_STATS)
- {
- enum rtx_code code = GET_CODE (insn);
- if (code == JUMP_INSN || code == CALL_INSN)
- dslots_jump_total++;
- }
-}
-
-
-/* Output at beginning of assembler file.
- If we are optimizing to use the global pointer, create a temporary
- file to hold all of the text stuff, and write it out to the end.
- This is needed because the MIPS assembler is evidently one pass,
- and if it hasn't seen the relevant .comm/.lcomm/.extern/.sdata
- declaration when the code is processed, it generates a two
- instruction sequence. */
-
-void
-mips_asm_file_start (stream)
- FILE *stream;
-{
- ASM_OUTPUT_SOURCE_FILENAME (stream, main_input_filename);
-
- /* Versions of the MIPS assembler before 2.20 generate errors
- if a branch inside of a .set noreorder section jumps to a
- label outside of the .set noreorder section. Revision 2.20
- just set nobopt silently rather than fixing the bug. */
-
- if (TARGET_MIPS_AS && optimize && flag_delayed_branch)
- fprintf (stream, "\t.set\tnobopt\n");
-
- /* Generate the pseudo ops that System V.4 wants. */
-#ifndef ABICALLS_ASM_OP
-#define ABICALLS_ASM_OP ".abicalls"
-#endif
- if (TARGET_ABICALLS)
- /* ??? but do not want this (or want pic0) if -non-shared? */
- fprintf (stream, "\t%s\n", ABICALLS_ASM_OP);
-
- /* Start a section, so that the first .popsection directive is guaranteed
- to have a previously defined section to pop back to. */
- if (mips_abi != ABI_32 && mips_abi != ABI_EABI)
- fprintf (stream, "\t.section\t.text\n");
-
- /* This code exists so that we can put all externs before all symbol
- references. This is necessary for the assembler's global pointer
- optimizations to work. */
- /* ??? Current versions of gas do not require that externs occur before
- symbol references. This means that this code is unnecessary when
- gas is being used. This gas feature hasn't been well tested as yet
- though. */
- if (TARGET_GP_OPT)
- {
- asm_out_data_file = stream;
- asm_out_text_file = make_temp_file ();
- }
- else
- asm_out_data_file = asm_out_text_file = stream;
-
- if (flag_verbose_asm)
- fprintf (stream, "\n%s -G value = %d, Cpu = %s, ISA = %d\n",
- ASM_COMMENT_START,
- mips_section_threshold, mips_cpu_string, mips_isa);
-}
-
-
-/* If we are optimizing the global pointer, emit the text section now
- and any small externs which did not have .comm, etc that are
- needed. Also, give a warning if the data area is more than 32K and
- -pic because 3 instructions are needed to reference the data
- pointers. */
-
-void
-mips_asm_file_end (file)
- FILE *file;
-{
- char buffer[8192];
- tree name_tree;
- struct extern_list *p;
- int len;
-
- if (HALF_PIC_P ())
- HALF_PIC_FINISH (file);
-
- if (extern_head)
- {
- fputs ("\n", file);
-
- for (p = extern_head; p != 0; p = p->next)
- {
- name_tree = get_identifier (p->name);
-
- /* Positively ensure only one .extern for any given symbol. */
- if (! TREE_ASM_WRITTEN (name_tree))
- {
- TREE_ASM_WRITTEN (name_tree) = 1;
-#ifdef ASM_OUTPUT_UNDEF_FUNCTION
- if (p->size == -1)
- ASM_OUTPUT_UNDEF_FUNCTION (file, p->name);
- else
-#endif
- {
- fputs ("\t.extern\t", file);
- assemble_name (file, p->name);
- fprintf (file, ", %d\n", p->size);
- }
- }
- }
- }
-
- if (TARGET_GP_OPT)
- {
- fprintf (file, "\n\t.text\n");
- rewind (asm_out_text_file);
- if (ferror (asm_out_text_file))
- fatal_io_error (temp_filename);
-
- while ((len = fread (buffer, 1, sizeof (buffer), asm_out_text_file)) > 0)
- if (fwrite (buffer, 1, len, file) != len)
- pfatal_with_name (asm_file_name);
-
- if (len < 0)
- pfatal_with_name (temp_filename);
-
- if (fclose (asm_out_text_file) != 0)
- pfatal_with_name (temp_filename);
-
-#ifdef __MSDOS__
- unlink (temp_filename);
-#endif
- }
-}
-
-
-/* Emit either a label, .comm, or .lcomm directive, and mark
- that the symbol is used, so that we don't emit an .extern
- for it in mips_asm_file_end. */
-
-void
-mips_declare_object (stream, name, init_string, final_string, size)
- FILE *stream;
- char *name;
- char *init_string;
- char *final_string;
- int size;
-{
- fputs (init_string, stream); /* "", "\t.comm\t", or "\t.lcomm\t" */
- assemble_name (stream, name);
- fprintf (stream, final_string, size); /* ":\n", ",%u\n", ",%u\n" */
-
- if (TARGET_GP_OPT)
- {
- tree name_tree = get_identifier (name);
- TREE_ASM_WRITTEN (name_tree) = 1;
- }
-}
-
-
-/* Output a double precision value to the assembler. If both the
- host and target are IEEE, emit the values in hex. */
-
-void
-mips_output_double (stream, value)
- FILE *stream;
- REAL_VALUE_TYPE value;
-{
-#ifdef REAL_VALUE_TO_TARGET_DOUBLE
- long value_long[2];
- REAL_VALUE_TO_TARGET_DOUBLE (value, value_long);
-
- fprintf (stream, "\t.word\t0x%08lx\t\t# %.20g\n\t.word\t0x%08lx\n",
- value_long[0], value, value_long[1]);
-#else
- fprintf (stream, "\t.double\t%.20g\n", value);
-#endif
-}
-
-
-/* Output a single precision value to the assembler. If both the
- host and target are IEEE, emit the values in hex. */
-
-void
-mips_output_float (stream, value)
- FILE *stream;
- REAL_VALUE_TYPE value;
-{
-#ifdef REAL_VALUE_TO_TARGET_SINGLE
- long value_long;
- REAL_VALUE_TO_TARGET_SINGLE (value, value_long);
-
- fprintf (stream, "\t.word\t0x%08lx\t\t# %.12g (float)\n", value_long, value);
-#else
- fprintf (stream, "\t.float\t%.12g\n", value);
-#endif
-}
-
-
-/* Return TRUE if any register used in the epilogue is used. This to insure
- any insn put into the epilogue delay slots is safe. */
-
-int
-epilogue_reg_mentioned_p (insn)
- rtx insn;
-{
- register char *fmt;
- register int i;
- register enum rtx_code code;
- register int regno;
-
- if (insn == (rtx)0)
- return 0;
-
- if (GET_CODE (insn) == LABEL_REF)
- return 0;
-
- code = GET_CODE (insn);
- switch (code)
- {
- case REG:
- regno = REGNO (insn);
- if (regno == STACK_POINTER_REGNUM)
- return 1;
-
- if (regno == FRAME_POINTER_REGNUM && frame_pointer_needed)
- return 1;
-
- if (!call_used_regs[regno])
- return 1;
-
- if (regno != MIPS_TEMP1_REGNUM && regno != MIPS_TEMP2_REGNUM)
- return 0;
-
- if (!current_frame_info.initialized)
- compute_frame_size (get_frame_size ());
-
- return (current_frame_info.total_size >= 32768);
-
- case SCRATCH:
- case CC0:
- case PC:
- case CONST_INT:
- case CONST_DOUBLE:
- return 0;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (insn, i) - 1; j >= 0; j--)
- if (epilogue_reg_mentioned_p (XVECEXP (insn, i, j)))
- return 1;
- }
- else if (fmt[i] == 'e' && epilogue_reg_mentioned_p (XEXP (insn, i)))
- return 1;
- }
-
- return 0;
-}
-
-/* Return the bytes needed to compute the frame pointer from the current
- stack pointer.
-
- Mips stack frames look like:
-
- Before call After call
- +-----------------------+ +-----------------------+
- high | | | |
- mem. | | | |
- | caller's temps. | | caller's temps. |
- | | | |
- +-----------------------+ +-----------------------+
- | | | |
- | arguments on stack. | | arguments on stack. |
- | | | |
- +-----------------------+ +-----------------------+
- | 4 words to save | | 4 words to save |
- | arguments passed | | arguments passed |
- | in registers, even | | in registers, even |
- SP->| if not passed. | VFP->| if not passed. |
- +-----------------------+ +-----------------------+
- | |
- | fp register save |
- | |
- +-----------------------+
- | |
- | gp register save |
- | |
- +-----------------------+
- | |
- | local variables |
- | |
- +-----------------------+
- | |
- | alloca allocations |
- | |
- +-----------------------+
- | |
- | GP save for V.4 abi |
- | |
- +-----------------------+
- | |
- | arguments on stack |
- | |
- +-----------------------+
- | 4 words to save |
- | arguments passed |
- | in registers, even |
- low SP->| if not passed. |
- memory +-----------------------+
-
-*/
-
-long
-compute_frame_size (size)
- int size; /* # of var. bytes allocated */
-{
- int regno;
- long total_size; /* # bytes that the entire frame takes up */
- long var_size; /* # bytes that variables take up */
- long args_size; /* # bytes that outgoing arguments take up */
- long extra_size; /* # extra bytes */
- long gp_reg_rounded; /* # bytes needed to store gp after rounding */
- long gp_reg_size; /* # bytes needed to store gp regs */
- long fp_reg_size; /* # bytes needed to store fp regs */
- long mask; /* mask of saved gp registers */
- long fmask; /* mask of saved fp registers */
- int fp_inc; /* 1 or 2 depending on the size of fp regs */
- long fp_bits; /* bitmask to use for each fp register */
-
- gp_reg_size = 0;
- fp_reg_size = 0;
- mask = 0;
- fmask = 0;
- extra_size = MIPS_STACK_ALIGN (((TARGET_ABICALLS) ? UNITS_PER_WORD : 0));
- var_size = MIPS_STACK_ALIGN (size);
- args_size = MIPS_STACK_ALIGN (current_function_outgoing_args_size);
-
- /* The MIPS 3.0 linker does not like functions that dynamically
- allocate the stack and have 0 for STACK_DYNAMIC_OFFSET, since it
- looks like we are trying to create a second frame pointer to the
- function, so allocate some stack space to make it happy. */
-
- if (args_size == 0 && current_function_calls_alloca)
- args_size = 4*UNITS_PER_WORD;
-
- total_size = var_size + args_size + extra_size;
-
- /* Calculate space needed for gp registers. */
- for (regno = GP_REG_FIRST; regno <= GP_REG_LAST; regno++)
- {
- if (MUST_SAVE_REGISTER (regno))
- {
- gp_reg_size += UNITS_PER_WORD;
- mask |= 1L << (regno - GP_REG_FIRST);
- }
- }
-
- /* Calculate space needed for fp registers. */
- if (TARGET_FLOAT64 || TARGET_SINGLE_FLOAT)
- {
- fp_inc = 1;
- fp_bits = 1;
- }
- else
- {
- fp_inc = 2;
- fp_bits = 3;
- }
-
- for (regno = FP_REG_FIRST; regno <= FP_REG_LAST; regno += fp_inc)
- {
- if (regs_ever_live[regno] && !call_used_regs[regno])
- {
- fp_reg_size += fp_inc * UNITS_PER_FPREG;
- fmask |= fp_bits << (regno - FP_REG_FIRST);
- }
- }
-
- gp_reg_rounded = MIPS_STACK_ALIGN (gp_reg_size);
- total_size += gp_reg_rounded + MIPS_STACK_ALIGN (fp_reg_size);
-
- /* The gp reg is caller saved in the 32 bit ABI, so there is no need
- for leaf routines (total_size == extra_size) to save the gp reg.
- The gp reg is callee saved in the 64 bit ABI, so all routines must
- save the gp reg. */
- if (total_size == extra_size && (mips_abi == ABI_32 || mips_abi == ABI_EABI))
- total_size = extra_size = 0;
- else if (TARGET_ABICALLS)
- {
- /* Add the context-pointer to the saved registers. */
- gp_reg_size += UNITS_PER_WORD;
- mask |= 1L << (PIC_OFFSET_TABLE_REGNUM - GP_REG_FIRST);
- total_size -= gp_reg_rounded;
- gp_reg_rounded = MIPS_STACK_ALIGN (gp_reg_size);
- total_size += gp_reg_rounded;
- }
-
- /* Add in space reserved on the stack by the callee for storing arguments
- passed in registers. */
- if (mips_abi != ABI_32)
- total_size += MIPS_STACK_ALIGN (current_function_pretend_args_size);
-
- /* Save other computed information. */
- current_frame_info.total_size = total_size;
- current_frame_info.var_size = var_size;
- current_frame_info.args_size = args_size;
- current_frame_info.extra_size = extra_size;
- current_frame_info.gp_reg_size = gp_reg_size;
- current_frame_info.fp_reg_size = fp_reg_size;
- current_frame_info.mask = mask;
- current_frame_info.fmask = fmask;
- current_frame_info.initialized = reload_completed;
- current_frame_info.num_gp = gp_reg_size / UNITS_PER_WORD;
- current_frame_info.num_fp = fp_reg_size / (fp_inc * UNITS_PER_FPREG);
-
- if (mask)
- {
- unsigned long offset = (args_size + extra_size + var_size
- + gp_reg_size - UNITS_PER_WORD);
- current_frame_info.gp_sp_offset = offset;
- current_frame_info.gp_save_offset = offset - total_size;
- }
- else
- {
- current_frame_info.gp_sp_offset = 0;
- current_frame_info.gp_save_offset = 0;
- }
-
-
- if (fmask)
- {
- unsigned long offset = (args_size + extra_size + var_size
- + gp_reg_rounded + fp_reg_size
- - fp_inc * UNITS_PER_FPREG);
- current_frame_info.fp_sp_offset = offset;
- current_frame_info.fp_save_offset = offset - total_size;
- }
- else
- {
- current_frame_info.fp_sp_offset = 0;
- current_frame_info.fp_save_offset = 0;
- }
-
- /* Ok, we're done. */
- return total_size;
-}
-
-
-/* Common code to emit the insns (or to write the instructions to a file)
- to save/restore registers.
-
- Other parts of the code assume that MIPS_TEMP1_REGNUM (aka large_reg)
- is not modified within save_restore_insns. */
-
-#define BITSET_P(value,bit) (((value) & (1L << (bit))) != 0)
-
-static void
-save_restore_insns (store_p, large_reg, large_offset, file)
- int store_p; /* true if this is prologue */
- rtx large_reg; /* register holding large offset constant or NULL */
- long large_offset; /* large constant offset value */
- FILE *file; /* file to write instructions to instead of making RTL */
-{
- long mask = current_frame_info.mask;
- long fmask = current_frame_info.fmask;
- int regno;
- rtx base_reg_rtx;
- long base_offset;
- long gp_offset;
- long fp_offset;
- long end_offset;
- rtx insn;
-
- if (frame_pointer_needed && !BITSET_P (mask, FRAME_POINTER_REGNUM - GP_REG_FIRST))
- abort ();
-
- if (mask == 0 && fmask == 0)
- return;
-
- /* Save registers starting from high to low. The debuggers prefer
- at least the return register be stored at func+4, and also it
- allows us not to need a nop in the epilog if at least one
- register is reloaded in addition to return address. */
-
- /* Save GP registers if needed. */
- if (mask)
- {
- /* Pick which pointer to use as a base register. For small
- frames, just use the stack pointer. Otherwise, use a
- temporary register. Save 2 cycles if the save area is near
- the end of a large frame, by reusing the constant created in
- the prologue/epilogue to adjust the stack frame. */
-
- gp_offset = current_frame_info.gp_sp_offset;
- end_offset = gp_offset - (current_frame_info.gp_reg_size - UNITS_PER_WORD);
-
- if (gp_offset < 0 || end_offset < 0)
- fatal ("gp_offset (%ld) or end_offset (%ld) is less than zero.",
- gp_offset, end_offset);
-
- else if (gp_offset < 32768)
- {
- base_reg_rtx = stack_pointer_rtx;
- base_offset = 0;
- }
-
- else if (large_reg != (rtx)0
- && (((unsigned long)(large_offset - gp_offset)) < 32768)
- && (((unsigned long)(large_offset - end_offset)) < 32768))
- {
- base_reg_rtx = gen_rtx (REG, Pmode, MIPS_TEMP2_REGNUM);
- base_offset = large_offset;
- if (file == (FILE *)0)
- {
- if (TARGET_LONG64)
- insn = emit_insn (gen_adddi3 (base_reg_rtx, large_reg, stack_pointer_rtx));
- else
- insn = emit_insn (gen_addsi3 (base_reg_rtx, large_reg, stack_pointer_rtx));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else
- fprintf (file, "\t%s\t%s,%s,%s\n",
- TARGET_LONG64 ? "daddu" : "addu",
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[REGNO (large_reg)],
- reg_names[STACK_POINTER_REGNUM]);
- }
-
- else
- {
- base_reg_rtx = gen_rtx (REG, Pmode, MIPS_TEMP2_REGNUM);
- base_offset = gp_offset;
- if (file == (FILE *)0)
- {
- insn = emit_move_insn (base_reg_rtx, GEN_INT (gp_offset));
- RTX_FRAME_RELATED_P (insn) = 1;
- if (TARGET_LONG64)
- insn = emit_insn (gen_adddi3 (base_reg_rtx, base_reg_rtx, stack_pointer_rtx));
- else
- insn = emit_insn (gen_addsi3 (base_reg_rtx, base_reg_rtx, stack_pointer_rtx));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else
- fprintf (file, "\tli\t%s,0x%.08lx\t# %ld\n\t%s\t%s,%s,%s\n",
- reg_names[MIPS_TEMP2_REGNUM],
- (long)base_offset,
- (long)base_offset,
- TARGET_LONG64 ? "daddu" : "addu",
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[STACK_POINTER_REGNUM]);
- }
-
- for (regno = GP_REG_LAST; regno >= GP_REG_FIRST; regno--)
- {
- if (BITSET_P (mask, regno - GP_REG_FIRST))
- {
- if (file == (FILE *)0)
- {
- rtx reg_rtx = gen_rtx (REG, word_mode, regno);
- rtx mem_rtx = gen_rtx (MEM, word_mode,
- gen_rtx (PLUS, Pmode, base_reg_rtx,
- GEN_INT (gp_offset - base_offset)));
-
- if (store_p)
- {
- insn = emit_move_insn (mem_rtx, reg_rtx);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else if (!TARGET_ABICALLS || mips_abi != ABI_32
- || regno != (PIC_OFFSET_TABLE_REGNUM - GP_REG_FIRST))
- emit_move_insn (reg_rtx, mem_rtx);
- }
- else
- {
- if (store_p || !TARGET_ABICALLS || mips_abi != ABI_32
- || regno != (PIC_OFFSET_TABLE_REGNUM - GP_REG_FIRST))
- fprintf (file, "\t%s\t%s,%ld(%s)\n",
- (TARGET_64BIT
- ? (store_p) ? "sd" : "ld"
- : (store_p) ? "sw" : "lw"),
- reg_names[regno],
- gp_offset - base_offset,
- reg_names[REGNO(base_reg_rtx)]);
-
- }
- gp_offset -= UNITS_PER_WORD;
- }
- }
- }
- else
- {
- base_reg_rtx = (rtx)0; /* Make sure these are initialized */
- base_offset = 0;
- }
-
- /* Save floating point registers if needed. */
- if (fmask)
- {
- int fp_inc = (TARGET_FLOAT64 || TARGET_SINGLE_FLOAT) ? 1 : 2;
- int fp_size = fp_inc * UNITS_PER_FPREG;
-
- /* Pick which pointer to use as a base register. */
- fp_offset = current_frame_info.fp_sp_offset;
- end_offset = fp_offset - (current_frame_info.fp_reg_size - fp_size);
-
- if (fp_offset < 0 || end_offset < 0)
- fatal ("fp_offset (%ld) or end_offset (%ld) is less than zero.",
- fp_offset, end_offset);
-
- else if (fp_offset < 32768)
- {
- base_reg_rtx = stack_pointer_rtx;
- base_offset = 0;
- }
-
- else if (base_reg_rtx != (rtx)0
- && (((unsigned long)(base_offset - fp_offset)) < 32768)
- && (((unsigned long)(base_offset - end_offset)) < 32768))
- {
- ; /* already set up for gp registers above */
- }
-
- else if (large_reg != (rtx)0
- && (((unsigned long)(large_offset - fp_offset)) < 32768)
- && (((unsigned long)(large_offset - end_offset)) < 32768))
- {
- base_reg_rtx = gen_rtx (REG, Pmode, MIPS_TEMP2_REGNUM);
- base_offset = large_offset;
- if (file == (FILE *)0)
- {
- if (TARGET_LONG64)
- insn = emit_insn (gen_adddi3 (base_reg_rtx, large_reg, stack_pointer_rtx));
- else
- insn = emit_insn (gen_addsi3 (base_reg_rtx, large_reg, stack_pointer_rtx));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else
- fprintf (file, "\t%s\t%s,%s,%s\n",
- TARGET_LONG64 ? "daddu" : "addu",
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[REGNO (large_reg)],
- reg_names[STACK_POINTER_REGNUM]);
- }
-
- else
- {
- base_reg_rtx = gen_rtx (REG, Pmode, MIPS_TEMP2_REGNUM);
- base_offset = fp_offset;
- if (file == (FILE *)0)
- {
- insn = emit_move_insn (base_reg_rtx, GEN_INT (fp_offset));
- RTX_FRAME_RELATED_P (insn) = 1;
- if (TARGET_LONG64)
- insn = emit_insn (gen_adddi3 (base_reg_rtx, base_reg_rtx, stack_pointer_rtx));
- else
- insn = emit_insn (gen_addsi3 (base_reg_rtx, base_reg_rtx, stack_pointer_rtx));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else
- fprintf (file, "\tli\t%s,0x%.08lx\t# %ld\n\t%s\t%s,%s,%s\n",
- reg_names[MIPS_TEMP2_REGNUM],
- (long)base_offset,
- (long)base_offset,
- TARGET_LONG64 ? "daddu" : "addu",
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[MIPS_TEMP2_REGNUM],
- reg_names[STACK_POINTER_REGNUM]);
- }
-
- for (regno = FP_REG_LAST-1; regno >= FP_REG_FIRST; regno -= fp_inc)
- {
- if (BITSET_P (fmask, regno - FP_REG_FIRST))
- {
- if (file == (FILE *)0)
- {
- enum machine_mode sz =
- TARGET_SINGLE_FLOAT ? SFmode : DFmode;
- rtx reg_rtx = gen_rtx (REG, sz, regno);
- rtx mem_rtx = gen_rtx (MEM, sz,
- gen_rtx (PLUS, Pmode, base_reg_rtx,
- GEN_INT (fp_offset - base_offset)));
-
- if (store_p)
- {
- insn = emit_move_insn (mem_rtx, reg_rtx);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else
- emit_move_insn (reg_rtx, mem_rtx);
- }
- else
- fprintf (file, "\t%s\t%s,%ld(%s)\n",
- (TARGET_SINGLE_FLOAT
- ? ((store_p) ? "s.s" : "l.s")
- : ((store_p) ? "s.d" : "l.d")),
- reg_names[regno],
- fp_offset - base_offset,
- reg_names[REGNO(base_reg_rtx)]);
-
-
- fp_offset -= fp_size;
- }
- }
- }
-}
-
-
-/* Set up the stack and frame (if desired) for the function. */
-
-void
-function_prologue (file, size)
- FILE *file;
- int size;
-{
- char *fnname;
- long tsize = current_frame_info.total_size;
-
- ASM_OUTPUT_SOURCE_FILENAME (file, DECL_SOURCE_FILE (current_function_decl));
-
-#ifdef SDB_DEBUGGING_INFO
- if (debug_info_level != DINFO_LEVEL_TERSE && write_symbols == SDB_DEBUG)
- ASM_OUTPUT_SOURCE_LINE (file, DECL_SOURCE_LINE (current_function_decl));
-#endif
-
- inside_function = 1;
-
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
- /* Get the function name the same way that toplev.c does before calling
- assemble_start_function. This is needed so that the name used here
- exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
- fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
-
- fputs ("\t.ent\t", file);
- assemble_name (file, fnname);
- fputs ("\n", file);
-
- assemble_name (file, fnname);
- fputs (":\n", file);
-#endif
-
- fprintf (file, "\t.frame\t%s,%d,%s\t\t# vars= %d, regs= %d/%d, args= %d, extra= %d\n",
- reg_names[ (frame_pointer_needed) ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM ],
- tsize,
- reg_names[31 + GP_REG_FIRST],
- current_frame_info.var_size,
- current_frame_info.num_gp,
- current_frame_info.num_fp,
- current_function_outgoing_args_size,
- current_frame_info.extra_size);
-
- fprintf (file, "\t.mask\t0x%08lx,%d\n\t.fmask\t0x%08lx,%d\n",
- current_frame_info.mask,
- current_frame_info.gp_save_offset,
- current_frame_info.fmask,
- current_frame_info.fp_save_offset);
-
- if (TARGET_ABICALLS && mips_abi == ABI_32)
- {
- char *sp_str = reg_names[STACK_POINTER_REGNUM];
-
- fprintf (file, "\t.set\tnoreorder\n\t.cpload\t%s\n\t.set\treorder\n",
- reg_names[PIC_FUNCTION_ADDR_REGNUM]);
- if (tsize > 0)
- {
- fprintf (file, "\t%s\t%s,%s,%d\n",
- (TARGET_LONG64 ? "dsubu" : "subu"),
- sp_str, sp_str, tsize);
- fprintf (file, "\t.cprestore %d\n", current_frame_info.args_size);
- }
- }
-}
-
-
-/* Expand the prologue into a bunch of separate insns. */
-
-void
-mips_expand_prologue ()
-{
- int regno;
- long tsize;
- rtx tmp_rtx = (rtx)0;
- char *arg_name = (char *)0;
- tree fndecl = current_function_decl;
- tree fntype = TREE_TYPE (fndecl);
- tree fnargs = DECL_ARGUMENTS (fndecl);
- rtx next_arg_reg;
- int i;
- tree next_arg;
- tree cur_arg;
- CUMULATIVE_ARGS args_so_far;
-
- /* If struct value address is treated as the first argument, make it so. */
- if (aggregate_value_p (DECL_RESULT (fndecl))
- && ! current_function_returns_pcc_struct
- && struct_value_incoming_rtx == 0)
- {
- tree type = build_pointer_type (fntype);
- tree function_result_decl = build_decl (PARM_DECL, NULL_TREE, type);
- DECL_ARG_TYPE (function_result_decl) = type;
- TREE_CHAIN (function_result_decl) = fnargs;
- fnargs = function_result_decl;
- }
-
- /* Determine the last argument, and get its name. */
-
- INIT_CUMULATIVE_ARGS (args_so_far, fntype, (rtx)0, 0);
- regno = GP_ARG_FIRST;
-
- for (cur_arg = fnargs; cur_arg != (tree)0; cur_arg = next_arg)
- {
- tree passed_type = DECL_ARG_TYPE (cur_arg);
- enum machine_mode passed_mode = TYPE_MODE (passed_type);
- rtx entry_parm;
-
- if (TREE_ADDRESSABLE (passed_type))
- {
- passed_type = build_pointer_type (passed_type);
- passed_mode = Pmode;
- }
-
- entry_parm = FUNCTION_ARG (args_so_far, passed_mode, passed_type, 1);
-
- if (entry_parm)
- {
- int words;
-
- /* passed in a register, so will get homed automatically */
- if (GET_MODE (entry_parm) == BLKmode)
- words = (int_size_in_bytes (passed_type) + 3) / 4;
- else
- words = (GET_MODE_SIZE (GET_MODE (entry_parm)) + 3) / 4;
-
- regno = REGNO (entry_parm) + words - 1;
- }
- else
- {
- regno = GP_ARG_LAST+1;
- break;
- }
-
- FUNCTION_ARG_ADVANCE (args_so_far, passed_mode, passed_type, 1);
-
- next_arg = TREE_CHAIN (cur_arg);
- if (next_arg == (tree)0)
- {
- if (DECL_NAME (cur_arg))
- arg_name = IDENTIFIER_POINTER (DECL_NAME (cur_arg));
-
- break;
- }
- }
-
- /* In order to pass small structures by value in registers
- compatibly with the MIPS compiler, we need to shift the value
- into the high part of the register. Function_arg has encoded a
- PARALLEL rtx, holding a vector of adjustments to be made as the
- next_arg_reg variable, so we split up the insns, and emit them
- separately. */
-
- next_arg_reg = FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1);
- if (next_arg_reg != (rtx)0 && GET_CODE (next_arg_reg) == PARALLEL)
- {
- rtvec adjust = XVEC (next_arg_reg, 0);
- int num = GET_NUM_ELEM (adjust);
-
- for (i = 0; i < num; i++)
- {
- rtx pattern = RTVEC_ELT (adjust, i);
- if (GET_CODE (pattern) != SET
- || GET_CODE (SET_SRC (pattern)) != ASHIFT)
- abort_with_insn (pattern, "Insn is not a shift");
-
- PUT_CODE (SET_SRC (pattern), ASHIFTRT);
- emit_insn (pattern);
- }
- }
-
- tsize = compute_frame_size (get_frame_size ());
-
- /* If this function is a varargs function, store any registers that
- would normally hold arguments ($4 - $7) on the stack. */
- if (mips_abi == ABI_32
- && ((TYPE_ARG_TYPES (fntype) != 0
- && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) != void_type_node))
- || (arg_name != (char *)0
- && ((arg_name[0] == '_' && strcmp (arg_name, "__builtin_va_alist") == 0)
- || (arg_name[0] == 'v' && strcmp (arg_name, "va_alist") == 0)))))
- {
- int offset = (regno - GP_ARG_FIRST) * UNITS_PER_WORD;
- rtx ptr = stack_pointer_rtx;
-
- /* If we are doing svr4-abi, sp has already been decremented by tsize. */
- if (TARGET_ABICALLS)
- offset += tsize;
-
- for (; regno <= GP_ARG_LAST; regno++)
- {
- if (offset != 0)
- ptr = gen_rtx (PLUS, Pmode, stack_pointer_rtx, GEN_INT (offset));
- emit_move_insn (gen_rtx (MEM, word_mode, ptr),
- gen_rtx (REG, word_mode, regno));
- offset += UNITS_PER_WORD;
- }
- }
-
- if (tsize > 0)
- {
- rtx tsize_rtx = GEN_INT (tsize);
-
- /* If we are doing svr4-abi, sp move is done by function_prologue. */
- if (!TARGET_ABICALLS || mips_abi != ABI_32)
- {
- rtx insn;
-
- if (tsize > 32767)
- {
- tmp_rtx = gen_rtx (REG, Pmode, MIPS_TEMP1_REGNUM);
- insn = emit_move_insn (tmp_rtx, tsize_rtx);
- RTX_FRAME_RELATED_P (insn) = 1;
- tsize_rtx = tmp_rtx;
- }
-
- if (TARGET_LONG64)
- insn = emit_insn (gen_subdi3 (stack_pointer_rtx, stack_pointer_rtx,
- tsize_rtx));
- else
- insn = emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
- tsize_rtx));
-
- RTX_FRAME_RELATED_P (insn) = 1;
- }
-
- save_restore_insns (TRUE, tmp_rtx, tsize, (FILE *)0);
-
- if (frame_pointer_needed)
- {
- rtx insn;
-
- if (TARGET_64BIT)
- insn= emit_insn (gen_movdi (frame_pointer_rtx, stack_pointer_rtx));
- else
- insn= emit_insn (gen_movsi (frame_pointer_rtx, stack_pointer_rtx));
-
- RTX_FRAME_RELATED_P (insn) = 1;
- }
-
- if (TARGET_ABICALLS && mips_abi != ABI_32)
- emit_insn (gen_loadgp (XEXP (DECL_RTL (current_function_decl), 0)));
- }
-
- /* If we are profiling, make sure no instructions are scheduled before
- the call to mcount. */
-
- if (profile_flag || profile_block_flag)
- emit_insn (gen_blockage ());
-}
-
-
-/* Do any necessary cleanup after a function to restore stack, frame, and regs. */
-
-#define RA_MASK ((long) 0x80000000) /* 1 << 31 */
-#define PIC_OFFSET_TABLE_MASK (1 << (PIC_OFFSET_TABLE_REGNUM - GP_REG_FIRST))
-
-void
-function_epilogue (file, size)
- FILE *file;
- int size;
-{
- char *fnname;
- long tsize;
- char *sp_str = reg_names[STACK_POINTER_REGNUM];
- char *t1_str = reg_names[MIPS_TEMP1_REGNUM];
- rtx epilogue_delay = current_function_epilogue_delay_list;
- int noreorder = (epilogue_delay != 0);
- int noepilogue = FALSE;
- int load_nop = FALSE;
- int load_only_r31;
- rtx tmp_rtx = (rtx)0;
- rtx restore_rtx;
- int i;
-
- /* The epilogue does not depend on any registers, but the stack
- registers, so we assume that if we have 1 pending nop, it can be
- ignored, and 2 it must be filled (2 nops occur for integer
- multiply and divide). */
-
- if (dslots_number_nops > 0)
- {
- if (dslots_number_nops == 1)
- {
- dslots_number_nops = 0;
- dslots_load_filled++;
- }
- else
- {
- while (--dslots_number_nops > 0)
- fputs ("\t#nop\n", asm_out_file);
- }
- }
-
- if (set_noat != 0)
- {
- set_noat = 0;
- fputs ("\t.set\tat\n", file);
- error ("internal gcc error: .set noat left on in epilogue");
- }
-
- if (set_nomacro != 0)
- {
- set_nomacro = 0;
- fputs ("\t.set\tmacro\n", file);
- error ("internal gcc error: .set nomacro left on in epilogue");
- }
-
- if (set_noreorder != 0)
- {
- set_noreorder = 0;
- fputs ("\t.set\treorder\n", file);
- error ("internal gcc error: .set noreorder left on in epilogue");
- }
-
- if (set_volatile != 0)
- {
- set_volatile = 0;
- fprintf (file, "\t%s.set\tnovolatile\n", (TARGET_MIPS_AS) ? "" : "#");
- error ("internal gcc error: .set volatile left on in epilogue");
- }
-
- size = MIPS_STACK_ALIGN (size);
- tsize = (!current_frame_info.initialized)
- ? compute_frame_size (size)
- : current_frame_info.total_size;
-
- if (tsize == 0 && epilogue_delay == 0)
- {
- rtx insn = get_last_insn ();
-
- /* If the last insn was a BARRIER, we don't have to write any code
- because a jump (aka return) was put there. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
- if (insn && GET_CODE (insn) == BARRIER)
- noepilogue = TRUE;
-
- noreorder = FALSE;
- }
-
- if (!noepilogue)
- {
- /* In the reload sequence, we don't need to fill the load delay
- slots for most of the loads, also see if we can fill the final
- delay slot if not otherwise filled by the reload sequence. */
-
- if (noreorder)
- fprintf (file, "\t.set\tnoreorder\n");
-
- if (tsize > 32767)
- {
- fprintf (file, "\tli\t%s,0x%.08lx\t# %ld\n", t1_str, (long)tsize, (long)tsize);
- tmp_rtx = gen_rtx (REG, Pmode, MIPS_TEMP1_REGNUM);
- }
-
- if (frame_pointer_needed)
- fprintf (file, "\tmove\t%s,%s\t\t\t# sp not trusted here\n",
- sp_str, reg_names[FRAME_POINTER_REGNUM]);
-
- save_restore_insns (FALSE, tmp_rtx, tsize, file);
-
- load_only_r31 = (((current_frame_info.mask
- & ~ (TARGET_ABICALLS && mips_abi == ABI_32
- ? PIC_OFFSET_TABLE_MASK : 0))
- == RA_MASK)
- && current_frame_info.fmask == 0);
-
- if (noreorder)
- {
- /* If the only register saved is the return address, we need a
- nop, unless we have an instruction to put into it. Otherwise
- we don't since reloading multiple registers doesn't reference
- the register being loaded. */
-
- if (load_only_r31)
- {
- if (epilogue_delay)
- final_scan_insn (XEXP (epilogue_delay, 0),
- file,
- 1, /* optimize */
- -2, /* prescan */
- 1); /* nopeepholes */
- else
- {
- fprintf (file, "\tnop\n");
- load_nop = TRUE;
- }
- }
-
- fprintf (file, "\tj\t%s\n", reg_names[GP_REG_FIRST + 31]);
-
- if (tsize > 32767)
- fprintf (file, "\t%s\t%s,%s,%s\n",
- TARGET_LONG64 ? "daddu" : "addu",
- sp_str, sp_str, t1_str);
-
- else if (tsize > 0)
- fprintf (file, "\t%s\t%s,%s,%d\n",
- TARGET_LONG64 ? "daddu" : "addu",
- sp_str, sp_str, tsize);
-
- else if (!load_only_r31 && epilogue_delay != 0)
- final_scan_insn (XEXP (epilogue_delay, 0),
- file,
- 1, /* optimize */
- -2, /* prescan */
- 1); /* nopeepholes */
-
- fprintf (file, "\t.set\treorder\n");
- }
-
- else
- {
- if (tsize > 32767)
- fprintf (file, "\t%s\t%s,%s,%s\n",
- TARGET_LONG64 ? "daddu" : "addu",
- sp_str, sp_str, t1_str);
-
- else if (tsize > 0)
- fprintf (file, "\t%s\t%s,%s,%d\n",
- TARGET_LONG64 ? "daddu" : "addu",
- sp_str, sp_str, tsize);
-
- fprintf (file, "\tj\t%s\n", reg_names[GP_REG_FIRST + 31]);
- }
- }
-
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
- /* Get the function name the same way that toplev.c does before calling
- assemble_start_function. This is needed so that the name used here
- exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
- fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
-
- fputs ("\t.end\t", file);
- assemble_name (file, fnname);
- fputs ("\n", file);
-#endif
-
- if (TARGET_STATS)
- {
- int num_gp_regs = current_frame_info.gp_reg_size / 4;
- int num_fp_regs = current_frame_info.fp_reg_size / 8;
- int num_regs = num_gp_regs + num_fp_regs;
- char *name = fnname;
-
- if (name[0] == '*')
- name++;
-
- dslots_load_total += num_regs;
-
- if (!noepilogue)
- dslots_jump_total++;
-
- if (noreorder)
- {
- dslots_load_filled += num_regs;
-
- /* If the only register saved is the return register, we
- can't fill this register's delay slot. */
-
- if (load_only_r31 && epilogue_delay == 0)
- dslots_load_filled--;
-
- if (tsize > 0 || (!load_only_r31 && epilogue_delay != 0))
- dslots_jump_filled++;
- }
-
- fprintf (stderr,
- "%-20s fp=%c leaf=%c alloca=%c setjmp=%c stack=%4ld arg=%3ld reg=%2d/%d delay=%3d/%3dL %3d/%3dJ refs=%3d/%3d/%3d",
- name,
- (frame_pointer_needed) ? 'y' : 'n',
- ((current_frame_info.mask & RA_MASK) != 0) ? 'n' : 'y',
- (current_function_calls_alloca) ? 'y' : 'n',
- (current_function_calls_setjmp) ? 'y' : 'n',
- (long)current_frame_info.total_size,
- (long)current_function_outgoing_args_size,
- num_gp_regs, num_fp_regs,
- dslots_load_total, dslots_load_filled,
- dslots_jump_total, dslots_jump_filled,
- num_refs[0], num_refs[1], num_refs[2]);
-
- if (HALF_PIC_NUMBER_PTRS > prev_half_pic_ptrs)
- {
- fprintf (stderr, " half-pic=%3d", HALF_PIC_NUMBER_PTRS - prev_half_pic_ptrs);
- prev_half_pic_ptrs = HALF_PIC_NUMBER_PTRS;
- }
-
- if (HALF_PIC_NUMBER_REFS > prev_half_pic_refs)
- {
- fprintf (stderr, " pic-ref=%3d", HALF_PIC_NUMBER_REFS - prev_half_pic_refs);
- prev_half_pic_refs = HALF_PIC_NUMBER_REFS;
- }
-
- fputc ('\n', stderr);
- }
-
- /* Reset state info for each function. */
- inside_function = FALSE;
- ignore_line_number = FALSE;
- dslots_load_total = 0;
- dslots_jump_total = 0;
- dslots_load_filled = 0;
- dslots_jump_filled = 0;
- num_refs[0] = 0;
- num_refs[1] = 0;
- num_refs[2] = 0;
- mips_load_reg = (rtx)0;
- mips_load_reg2 = (rtx)0;
- current_frame_info = zero_frame_info;
-
- /* Restore the output file if optimizing the GP (optimizing the GP causes
- the text to be diverted to a tempfile, so that data decls come before
- references to the data). */
-
- if (TARGET_GP_OPT)
- asm_out_file = asm_out_data_file;
-}
-
-
-/* Expand the epilogue into a bunch of separate insns. */
-
-void
-mips_expand_epilogue ()
-{
- long tsize = current_frame_info.total_size;
- rtx tsize_rtx = GEN_INT (tsize);
- rtx tmp_rtx = (rtx)0;
-
- if (tsize > 32767)
- {
- tmp_rtx = gen_rtx (REG, Pmode, MIPS_TEMP1_REGNUM);
- emit_move_insn (tmp_rtx, tsize_rtx);
- tsize_rtx = tmp_rtx;
- }
-
- if (tsize > 0)
- {
- if (frame_pointer_needed)
- {
- if (TARGET_LONG64)
- emit_insn (gen_movdi (stack_pointer_rtx, frame_pointer_rtx));
- else
- emit_insn (gen_movsi (stack_pointer_rtx, frame_pointer_rtx));
- }
-
- save_restore_insns (FALSE, tmp_rtx, tsize, (FILE *)0);
-
- if (TARGET_LONG64)
- emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
- tsize_rtx));
- else
- emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
- tsize_rtx));
- }
-
- emit_jump_insn (gen_return_internal (gen_rtx (REG, Pmode, GP_REG_FIRST+31)));
-}
-
-
-/* Define the number of delay slots needed for the function epilogue.
-
- On the mips, we need a slot if either no stack has been allocated,
- or the only register saved is the return register. */
-
-int
-mips_epilogue_delay_slots ()
-{
- if (!current_frame_info.initialized)
- (void) compute_frame_size (get_frame_size ());
-
- if (current_frame_info.total_size == 0)
- return 1;
-
- if (current_frame_info.mask == RA_MASK && current_frame_info.fmask == 0)
- return 1;
-
- return 0;
-}
-
-
-/* Return true if this function is known to have a null epilogue.
- This allows the optimizer to omit jumps to jumps if no stack
- was created. */
-
-int
-simple_epilogue_p ()
-{
- if (!reload_completed)
- return 0;
-
- if (current_frame_info.initialized)
- return current_frame_info.total_size == 0;
-
- return (compute_frame_size (get_frame_size ())) == 0;
-}
-
-/* Choose the section to use for the constant rtx expression X that has
- mode MODE. */
-
-mips_select_rtx_section (mode, x)
- enum machine_mode mode;
- rtx x;
-{
- if (TARGET_EMBEDDED_DATA)
- {
- /* For embedded applications, always put constants in read-only data,
- in order to reduce RAM usage. */
- READONLY_DATA_SECTION ();
- }
- else
- {
- /* For hosted applications, always put constants in small data if
- possible, as this gives the best performance. */
-
- if (GET_MODE_SIZE (mode) <= mips_section_threshold
- && mips_section_threshold > 0)
- SMALL_DATA_SECTION ();
- else
- READONLY_DATA_SECTION ();
- }
-}
-
-/* Choose the section to use for DECL. RELOC is true if its value contains
- any relocatable expression. */
-
-mips_select_section (decl, reloc)
- tree decl;
- int reloc;
-{
- int size = int_size_in_bytes (TREE_TYPE (decl));
-
- if (TARGET_EMBEDDED_PIC
- && TREE_CODE (decl) == STRING_CST
- && !flag_writable_strings)
- {
- /* For embedded position independent code, put constant strings
- in the text section, because the data section is limited to
- 64K in size. */
-
- text_section ();
- }
- else if (TARGET_EMBEDDED_DATA)
- {
- /* For embedded applications, always put an object in read-only data
- if possible, in order to reduce RAM usage. */
-
- if (((TREE_CODE (decl) == VAR_DECL
- && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
- && DECL_INITIAL (decl)
- && (DECL_INITIAL (decl) == error_mark_node
- || TREE_CONSTANT (DECL_INITIAL (decl))))
- /* Deal with calls from output_constant_def_contents. */
- || (TREE_CODE (decl) != VAR_DECL
- && (TREE_CODE (decl) != STRING_CST
- || !flag_writable_strings)))
- && ! (flag_pic && reloc))
- READONLY_DATA_SECTION ();
- else if (size > 0 && size <= mips_section_threshold)
- SMALL_DATA_SECTION ();
- else
- data_section ();
- }
- else
- {
- /* For hosted applications, always put an object in small data if
- possible, as this gives the best performance. */
-
- if (size > 0 && size <= mips_section_threshold)
- SMALL_DATA_SECTION ();
- else if (((TREE_CODE (decl) == VAR_DECL
- && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)
- && DECL_INITIAL (decl)
- && (DECL_INITIAL (decl) == error_mark_node
- || TREE_CONSTANT (DECL_INITIAL (decl))))
- /* Deal with calls from output_constant_def_contents. */
- || (TREE_CODE (decl) != VAR_DECL
- && (TREE_CODE (decl) != STRING_CST
- || !flag_writable_strings)))
- && ! (flag_pic && reloc))
- READONLY_DATA_SECTION ();
- else
- data_section ();
- }
-}
-
-#ifdef MIPS_ABI_DEFAULT
-/* Support functions for the 64 bit ABI. */
-
-/* Return register to use for a function return value with VALTYPE for function
- FUNC. */
-
-rtx
-mips_function_value (valtype, func)
- tree valtype;
- tree func;
-{
- int reg = GP_RETURN;
- enum machine_mode mode = TYPE_MODE (valtype);
- enum mode_class mclass = GET_MODE_CLASS (mode);
-
- /* ??? How should we return complex float? */
- if (mclass == MODE_FLOAT || mclass == MODE_COMPLEX_FLOAT)
- {
- if (TARGET_SINGLE_FLOAT
- && (mclass == MODE_FLOAT
- ? GET_MODE_SIZE (mode) > 4
- : GET_MODE_SIZE (mode) / 2 > 4))
- reg = GP_RETURN;
- else
- reg = FP_RETURN;
- }
- else if (TREE_CODE (valtype) == RECORD_TYPE
- && mips_abi != ABI_32 && mips_abi != ABI_EABI)
- {
- /* A struct with only one or two floating point fields is returned in
- the floating point registers. */
- tree field, fields[2];
- int i;
-
- for (i = 0, field = TYPE_FIELDS (valtype); field;
- field = TREE_CHAIN (field))
- {
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
- if (TREE_CODE (TREE_TYPE (field)) != REAL_TYPE || i >= 2)
- break;
-
- fields[i++] = field;
- }
-
- /* Must check i, so that we reject structures with no elements. */
- if (! field)
- {
- if (i == 1)
- {
- /* The structure has DImode, but we don't allow DImode values
- in FP registers, so we use a PARALLEL even though it isn't
- strictly necessary. */
- enum machine_mode field_mode = TYPE_MODE (TREE_TYPE (fields[0]));
-
- return gen_rtx (PARALLEL, mode,
- gen_rtvec (1,
- gen_rtx (EXPR_LIST, VOIDmode,
- gen_rtx (REG, field_mode, FP_RETURN),
- const0_rtx)));
- }
- else if (i == 2)
- {
- enum machine_mode first_mode
- = TYPE_MODE (TREE_TYPE (fields[0]));
- enum machine_mode second_mode
- = TYPE_MODE (TREE_TYPE (fields[1]));
- int first_offset
- = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (fields[0]));
- int second_offset
- = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (fields[1]));
-
- return gen_rtx (PARALLEL, mode,
- gen_rtvec (2,
- gen_rtx (EXPR_LIST, VOIDmode,
- gen_rtx (REG, first_mode, FP_RETURN),
- GEN_INT (first_offset / BITS_PER_UNIT)),
- gen_rtx (EXPR_LIST, VOIDmode,
- gen_rtx (REG, second_mode, FP_RETURN + 2),
- GEN_INT (second_offset / BITS_PER_UNIT))));
- }
- }
- }
-
- return gen_rtx (REG, mode, reg);
-}
-
-/* The implementation of FUNCTION_ARG_PASS_BY_REFERENCE. Return
- nonzero when an argument must be passed by reference. */
-
-int
-function_arg_pass_by_reference (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- int size;
-
- if (mips_abi != ABI_EABI)
- return 0;
-
- /* ??? How should SCmode be handled? */
- if (type == NULL_TREE || mode == DImode || mode == DFmode)
- return 0;
-
- size = int_size_in_bytes (type);
- return size == -1 || size > UNITS_PER_WORD;
-}
-
-#endif
-
-/* This function returns the register class required for a secondary
- register when copying between one of the registers in CLASS, and X,
- using MODE. If IN_P is nonzero, the copy is going from X to the
- register, otherwise the register is the source. A return value of
- NO_REGS means that no secondary register is required. */
-
-enum reg_class
-mips_secondary_reload_class (class, mode, x, in_p)
- enum reg_class class;
- enum machine_mode mode;
- rtx x;
- int in_p;
-{
- int regno = -1;
-
- if (GET_CODE (x) == SIGN_EXTEND)
- {
- int off = 0;
-
- x = XEXP (x, 0);
-
- /* We may be called with reg_renumber NULL from regclass.
- ??? This is probably a bug. */
- if (reg_renumber)
- regno = true_regnum (x);
- else
- {
- while (GET_CODE (x) == SUBREG)
- {
- off += SUBREG_WORD (x);
- x = SUBREG_REG (x);
- }
- if (GET_CODE (x) == REG)
- regno = REGNO (x) + off;
- }
- }
- else if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG)
- regno = true_regnum (x);
-
- /* We always require a general register when copying anything to
- HILO_REGNUM, except when copying an SImode value from HILO_REGNUM
- to a general register, or when copying from register 0. */
- if (class == HILO_REG && regno != GP_REG_FIRST + 0)
- {
- if (! in_p
- && GP_REG_P (regno)
- && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (SImode))
- return NO_REGS;
- return GR_REGS;
- }
- if (regno == HILO_REGNUM)
- {
- if (in_p
- && class == GR_REGS
- && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (SImode))
- return NO_REGS;
- return GR_REGS;
- }
-
- /* Copying from HI or LO to anywhere other than a general register
- requires a general register. */
- if (class == HI_REG || class == LO_REG || class == MD_REGS)
- {
- if (GP_REG_P (regno))
- return NO_REGS;
- return GR_REGS;
- }
- if (MD_REG_P (regno))
- {
- if (class == GR_REGS)
- return NO_REGS;
- return GR_REGS;
- }
-
- /* We can only copy a value to a condition code register from a
- floating point register, and even then we require a scratch
- floating point register. We can only copy a value out of a
- condition code register into a general register. */
- if (class == ST_REGS)
- {
- if (in_p)
- return FP_REGS;
- if (GP_REG_P (regno))
- return NO_REGS;
- return GR_REGS;
- }
- if (ST_REG_P (regno))
- {
- if (! in_p)
- return FP_REGS;
- if (class == GR_REGS)
- return NO_REGS;
- return GR_REGS;
- }
-
- return NO_REGS;
-}
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
deleted file mode 100644
index 1c83ef8ec91..00000000000
--- a/gcc/config/mips/mips.h
+++ /dev/null
@@ -1,4034 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS version.
- Copyright (C) 1989, 90-6, 1997 Free Software Foundation, Inc.
- Contributed by A. Lichnewsky (lich@inria.inria.fr).
- Changed by Michael Meissner (meissner@osf.org).
- 64 bit r4000 support by Ian Lance Taylor (ian@cygnus.com) and
- Brendan Eich (brendan@microunity.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. */
-
-
-/* Standard GCC variables that we reference. */
-
-extern char *asm_file_name;
-extern char call_used_regs[];
-extern int current_function_calls_alloca;
-extern int flag_omit_frame_pointer;
-extern int frame_pointer_needed;
-extern char *language_string;
-extern int may_call_alloca;
-extern int optimize;
-extern char **save_argv;
-extern int target_flags;
-extern char *version_string;
-
-/* MIPS external variables defined in mips.c. */
-
-/* comparison type */
-enum cmp_type {
- CMP_SI, /* compare four byte integers */
- CMP_DI, /* compare eight byte integers */
- CMP_SF, /* compare single precision floats */
- CMP_DF, /* compare double precision floats */
- CMP_MAX /* max comparison type */
-};
-
-/* types of delay slot */
-enum delay_type {
- DELAY_NONE, /* no delay slot */
- DELAY_LOAD, /* load from memory delay */
- DELAY_HILO, /* move from/to hi/lo registers */
- DELAY_FCMP /* delay after doing c.<xx>.{d,s} */
-};
-
-/* Which processor to schedule for. Since there is no difference between
- a R2000 and R3000 in terms of the scheduler, we collapse them into
- just an R3000. The elements of the enumeration must match exactly
- the cpu attribute in the mips.md machine description. */
-
-enum processor_type {
- PROCESSOR_DEFAULT,
- PROCESSOR_R3000,
- PROCESSOR_R6000,
- PROCESSOR_R4000,
- PROCESSOR_R4100,
- PROCESSOR_R4300,
- PROCESSOR_R4600,
- PROCESSOR_R4650,
- PROCESSOR_R5000,
- PROCESSOR_R8000
-};
-
-/* Recast the cpu class to be the cpu attribute. */
-#define mips_cpu_attr ((enum attr_cpu)mips_cpu)
-
-/* Which ABI to use. This is only used by the Irix 6 port currently. */
-
-enum mips_abi_type {
- ABI_32,
- ABI_N32,
- ABI_64,
- ABI_EABI
-};
-
-#ifndef MIPS_ABI_DEFAULT
-/* We define this away so that there is no extra runtime cost if the target
- doesn't support multiple ABIs. */
-#define mips_abi ABI_32
-#else
-extern enum mips_abi_type mips_abi;
-#endif
-
-/* Whether to emit abicalls code sequences or not. */
-
-enum mips_abicalls_type {
- MIPS_ABICALLS_NO,
- MIPS_ABICALLS_YES
-};
-
-/* Recast the abicalls class to be the abicalls attribute. */
-#define mips_abicalls_attr ((enum attr_abicalls)mips_abicalls)
-
-/* Which type of block move to do (whether or not the last store is
- split out so it can fill a branch delay slot). */
-
-enum block_move_type {
- BLOCK_MOVE_NORMAL, /* generate complete block move */
- BLOCK_MOVE_NOT_LAST, /* generate all but last store */
- BLOCK_MOVE_LAST /* generate just the last store */
-};
-
-extern char mips_reg_names[][8]; /* register names (a0 vs. $4). */
-extern char mips_print_operand_punct[]; /* print_operand punctuation chars */
-extern char *current_function_file; /* filename current function is in */
-extern int num_source_filenames; /* current .file # */
-extern int inside_function; /* != 0 if inside of a function */
-extern int ignore_line_number; /* != 0 if we are to ignore next .loc */
-extern int file_in_function_warning; /* warning given about .file in func */
-extern int sdb_label_count; /* block start/end next label # */
-extern int sdb_begin_function_line; /* Starting Line of current function */
-extern int mips_section_threshold; /* # bytes of data/sdata cutoff */
-extern int g_switch_value; /* value of the -G xx switch */
-extern int g_switch_set; /* whether -G xx was passed. */
-extern int sym_lineno; /* sgi next label # for each stmt */
-extern int set_noreorder; /* # of nested .set noreorder's */
-extern int set_nomacro; /* # of nested .set nomacro's */
-extern int set_noat; /* # of nested .set noat's */
-extern int set_volatile; /* # of nested .set volatile's */
-extern int mips_branch_likely; /* emit 'l' after br (branch likely) */
-extern int mips_dbx_regno[]; /* Map register # to debug register # */
-extern struct rtx_def *branch_cmp[2]; /* operands for compare */
-extern enum cmp_type branch_type; /* what type of branch to use */
-extern enum processor_type mips_cpu; /* which cpu are we scheduling for */
-extern enum mips_abicalls_type mips_abicalls;/* for svr4 abi pic calls */
-extern int mips_isa; /* architectural level */
-extern char *mips_cpu_string; /* for -mcpu=<xxx> */
-extern char *mips_isa_string; /* for -mips{1,2,3,4} */
-extern char *mips_abi_string; /* for -misa={32,n32,64} */
-extern int mips_split_addresses; /* perform high/lo_sum support */
-extern int dslots_load_total; /* total # load related delay slots */
-extern int dslots_load_filled; /* # filled load delay slots */
-extern int dslots_jump_total; /* total # jump related delay slots */
-extern int dslots_jump_filled; /* # filled jump delay slots */
-extern int dslots_number_nops; /* # of nops needed by previous insn */
-extern int num_refs[3]; /* # 1/2/3 word references */
-extern struct rtx_def *mips_load_reg; /* register to check for load delay */
-extern struct rtx_def *mips_load_reg2; /* 2nd reg to check for load delay */
-extern struct rtx_def *mips_load_reg3; /* 3rd reg to check for load delay */
-extern struct rtx_def *mips_load_reg4; /* 4th reg to check for load delay */
-extern struct rtx_def *embedded_pic_fnaddr_rtx; /* function address */
-
-/* Functions within mips.c that we reference. */
-
-extern void abort_with_insn ();
-extern int arith32_operand ();
-extern int arith_operand ();
-extern int cmp_op ();
-extern long compute_frame_size ();
-extern int epilogue_reg_mentioned_p ();
-extern void expand_block_move ();
-extern int equality_op ();
-extern void final_prescan_insn ();
-extern struct rtx_def * function_arg ();
-extern void function_arg_advance ();
-extern int function_arg_partial_nregs ();
-extern int function_arg_pass_by_reference ();
-extern void function_epilogue ();
-extern void function_prologue ();
-extern void gen_conditional_branch ();
-extern void gen_conditional_move ();
-extern struct rtx_def * gen_int_relational ();
-extern void init_cumulative_args ();
-extern int large_int ();
-extern int mips_address_cost ();
-extern void mips_asm_file_end ();
-extern void mips_asm_file_start ();
-extern int mips_const_double_ok ();
-extern void mips_count_memory_refs ();
-extern int mips_debugger_offset ();
-extern void mips_declare_object ();
-extern int mips_epilogue_delay_slots ();
-extern void mips_expand_epilogue ();
-extern void mips_expand_prologue ();
-extern int mips_check_split ();
-extern char *mips_fill_delay_slot ();
-extern char *mips_move_1word ();
-extern char *mips_move_2words ();
-extern void mips_output_double ();
-extern int mips_output_external ();
-extern void mips_output_float ();
-extern void mips_output_filename ();
-extern void mips_output_lineno ();
-extern char *output_block_move ();
-extern void override_options ();
-extern int pc_or_label_operand ();
-extern void print_operand_address ();
-extern void print_operand ();
-extern void print_options ();
-extern int reg_or_0_operand ();
-extern int simple_epilogue_p ();
-extern int simple_memory_operand ();
-extern int small_int ();
-extern void trace();
-extern int uns_arith_operand ();
-extern struct rtx_def * embedded_pic_offset ();
-
-/* Recognition functions that return if a condition is true. */
-extern int address_operand ();
-extern int const_double_operand ();
-extern int const_int_operand ();
-extern int general_operand ();
-extern int immediate_operand ();
-extern int memory_address_p ();
-extern int memory_operand ();
-extern int nonimmediate_operand ();
-extern int nonmemory_operand ();
-extern int register_operand ();
-extern int scratch_operand ();
-extern int move_operand ();
-extern int movdi_operand ();
-extern int se_register_operand ();
-extern int se_reg_or_0_operand ();
-extern int se_uns_arith_operand ();
-extern int se_arith_operand ();
-extern int se_nonmemory_operand ();
-extern int se_nonimmediate_operand ();
-
-/* Functions to change what output section we are using. */
-extern void data_section ();
-extern void rdata_section ();
-extern void readonly_data_section ();
-extern void sdata_section ();
-extern void text_section ();
-
-/* Stubs for half-pic support if not OSF/1 reference platform. */
-
-#ifndef HALF_PIC_P
-#define HALF_PIC_P() 0
-#define HALF_PIC_NUMBER_PTRS 0
-#define HALF_PIC_NUMBER_REFS 0
-#define HALF_PIC_ENCODE(DECL)
-#define HALF_PIC_DECLARE(NAME)
-#define HALF_PIC_INIT() error ("half-pic init called on systems that don't support it.")
-#define HALF_PIC_ADDRESS_P(X) 0
-#define HALF_PIC_PTR(X) X
-#define HALF_PIC_FINISH(STREAM)
-#endif
-
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-/* Macros used in the machine description to test the flags. */
-
- /* Bits for real switches */
-#define MASK_INT64 0x00000001 /* ints are 64 bits */
-#define MASK_LONG64 0x00000002 /* longs and pointers are 64 bits */
-#define MASK_UNUSED 0x00000004
-#define MASK_GPOPT 0x00000008 /* Optimize for global pointer */
-#define MASK_GAS 0x00000010 /* Gas used instead of MIPS as */
-#define MASK_NAME_REGS 0x00000020 /* Use MIPS s/w reg name convention */
-#define MASK_STATS 0x00000040 /* print statistics to stderr */
-#define MASK_MEMCPY 0x00000080 /* call memcpy instead of inline code*/
-#define MASK_SOFT_FLOAT 0x00000100 /* software floating point */
-#define MASK_FLOAT64 0x00000200 /* fp registers are 64 bits */
-#define MASK_ABICALLS 0x00000400 /* emit .abicalls/.cprestore/.cpload */
-#define MASK_HALF_PIC 0x00000800 /* Emit OSF-style pic refs to externs*/
-#define MASK_LONG_CALLS 0x00001000 /* Always call through a register */
-#define MASK_64BIT 0x00002000 /* Use 64 bit GP registers and insns */
-#define MASK_EMBEDDED_PIC 0x00004000 /* Generate embedded PIC code */
-#define MASK_EMBEDDED_DATA 0x00008000 /* Reduce RAM usage, not fast code */
-#define MASK_BIG_ENDIAN 0x00010000 /* Generate big endian code */
-#define MASK_SINGLE_FLOAT 0x00020000 /* Only single precision FPU. */
-#define MASK_MAD 0x00040000 /* Generate mad/madu as on 4650. */
-#define MASK_4300_MUL_FIX 0x00080000 /* Work-around early Vr4300 CPU bug */
-
- /* Dummy switches used only in spec's*/
-#define MASK_MIPS_TFILE 0x00000000 /* flag for mips-tfile usage */
-
- /* Debug switches, not documented */
-#define MASK_DEBUG 0x40000000 /* Eliminate version # in .s file */
-#define MASK_DEBUG_A 0x20000000 /* don't allow <label>($reg) addrs */
-#define MASK_DEBUG_B 0x10000000 /* GO_IF_LEGITIMATE_ADDRESS debug */
-#define MASK_DEBUG_C 0x08000000 /* don't expand seq, etc. */
-#define MASK_DEBUG_D 0x04000000 /* don't do define_split's */
-#define MASK_DEBUG_E 0x02000000 /* function_arg debug */
-#define MASK_DEBUG_F 0x01000000 /* don't try to suppress load nop's */
-#define MASK_DEBUG_G 0x00800000 /* don't support 64 bit arithmetic */
-#define MASK_DEBUG_H 0x00400000 /* allow ints in FP registers */
-#define MASK_DEBUG_I 0x00200000 /* unused */
-#define MASK_DEBUG_J 0x00100000 /* unused */
-
- /* r4000 64 bit sizes */
-#define TARGET_INT64 (target_flags & MASK_INT64)
-#define TARGET_LONG64 (target_flags & MASK_LONG64)
-#define TARGET_FLOAT64 (target_flags & MASK_FLOAT64)
-#define TARGET_64BIT (target_flags & MASK_64BIT)
-
- /* Mips vs. GNU assembler */
-#define TARGET_GAS (target_flags & MASK_GAS)
-#define TARGET_UNIX_ASM (!TARGET_GAS)
-#define TARGET_MIPS_AS TARGET_UNIX_ASM
-
- /* Debug Mode */
-#define TARGET_DEBUG_MODE (target_flags & MASK_DEBUG)
-#define TARGET_DEBUG_A_MODE (target_flags & MASK_DEBUG_A)
-#define TARGET_DEBUG_B_MODE (target_flags & MASK_DEBUG_B)
-#define TARGET_DEBUG_C_MODE (target_flags & MASK_DEBUG_C)
-#define TARGET_DEBUG_D_MODE (target_flags & MASK_DEBUG_D)
-#define TARGET_DEBUG_E_MODE (target_flags & MASK_DEBUG_E)
-#define TARGET_DEBUG_F_MODE (target_flags & MASK_DEBUG_F)
-#define TARGET_DEBUG_G_MODE (target_flags & MASK_DEBUG_G)
-#define TARGET_DEBUG_H_MODE (target_flags & MASK_DEBUG_H)
-#define TARGET_DEBUG_I_MODE (target_flags & MASK_DEBUG_I)
-#define TARGET_DEBUG_J_MODE (target_flags & MASK_DEBUG_J)
-
- /* Reg. Naming in .s ($21 vs. $a0) */
-#define TARGET_NAME_REGS (target_flags & MASK_NAME_REGS)
-
- /* Optimize for Sdata/Sbss */
-#define TARGET_GP_OPT (target_flags & MASK_GPOPT)
-
- /* print program statistics */
-#define TARGET_STATS (target_flags & MASK_STATS)
-
- /* call memcpy instead of inline code */
-#define TARGET_MEMCPY (target_flags & MASK_MEMCPY)
-
- /* .abicalls, etc from Pyramid V.4 */
-#define TARGET_ABICALLS (target_flags & MASK_ABICALLS)
-
- /* OSF pic references to externs */
-#define TARGET_HALF_PIC (target_flags & MASK_HALF_PIC)
-
- /* software floating point */
-#define TARGET_SOFT_FLOAT (target_flags & MASK_SOFT_FLOAT)
-#define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
-
- /* always call through a register */
-#define TARGET_LONG_CALLS (target_flags & MASK_LONG_CALLS)
-
- /* generate embedded PIC code;
- requires gas. */
-#define TARGET_EMBEDDED_PIC (target_flags & MASK_EMBEDDED_PIC)
-
- /* for embedded systems, optimize for
- reduced RAM space instead of for
- fastest code. */
-#define TARGET_EMBEDDED_DATA (target_flags & MASK_EMBEDDED_DATA)
-
- /* generate big endian code. */
-#define TARGET_BIG_ENDIAN (target_flags & MASK_BIG_ENDIAN)
-
-#define TARGET_SINGLE_FLOAT (target_flags & MASK_SINGLE_FLOAT)
-#define TARGET_DOUBLE_FLOAT (! TARGET_SINGLE_FLOAT)
-
-#define TARGET_MAD (target_flags & MASK_MAD)
-
-#define TARGET_4300_MUL_FIX (target_flags & MASK_4300_MUL_FIX)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
-{ \
- {"int64", MASK_INT64 | MASK_LONG64}, \
- {"long64", MASK_LONG64}, \
- {"mips-as", -MASK_GAS}, \
- {"gas", MASK_GAS}, \
- {"rnames", MASK_NAME_REGS}, \
- {"no-rnames", -MASK_NAME_REGS}, \
- {"gpOPT", MASK_GPOPT}, \
- {"gpopt", MASK_GPOPT}, \
- {"no-gpOPT", -MASK_GPOPT}, \
- {"no-gpopt", -MASK_GPOPT}, \
- {"stats", MASK_STATS}, \
- {"no-stats", -MASK_STATS}, \
- {"memcpy", MASK_MEMCPY}, \
- {"no-memcpy", -MASK_MEMCPY}, \
- {"mips-tfile", MASK_MIPS_TFILE}, \
- {"no-mips-tfile", -MASK_MIPS_TFILE}, \
- {"soft-float", MASK_SOFT_FLOAT}, \
- {"hard-float", -MASK_SOFT_FLOAT}, \
- {"fp64", MASK_FLOAT64}, \
- {"fp32", -MASK_FLOAT64}, \
- {"gp64", MASK_64BIT}, \
- {"gp32", -MASK_64BIT}, \
- {"abicalls", MASK_ABICALLS}, \
- {"no-abicalls", -MASK_ABICALLS}, \
- {"half-pic", MASK_HALF_PIC}, \
- {"no-half-pic", -MASK_HALF_PIC}, \
- {"long-calls", MASK_LONG_CALLS}, \
- {"no-long-calls", -MASK_LONG_CALLS}, \
- {"embedded-pic", MASK_EMBEDDED_PIC}, \
- {"no-embedded-pic", -MASK_EMBEDDED_PIC}, \
- {"embedded-data", MASK_EMBEDDED_DATA}, \
- {"no-embedded-data", -MASK_EMBEDDED_DATA}, \
- {"eb", MASK_BIG_ENDIAN}, \
- {"el", -MASK_BIG_ENDIAN}, \
- {"single-float", MASK_SINGLE_FLOAT}, \
- {"double-float", -MASK_SINGLE_FLOAT}, \
- {"mad", MASK_MAD}, \
- {"no-mad", -MASK_MAD}, \
- {"fix4300", MASK_4300_MUL_FIX}, \
- {"no-fix4300", -MASK_4300_MUL_FIX}, \
- {"4650", MASK_MAD | MASK_SINGLE_FLOAT}, \
- {"debug", MASK_DEBUG}, \
- {"debuga", MASK_DEBUG_A}, \
- {"debugb", MASK_DEBUG_B}, \
- {"debugc", MASK_DEBUG_C}, \
- {"debugd", MASK_DEBUG_D}, \
- {"debuge", MASK_DEBUG_E}, \
- {"debugf", MASK_DEBUG_F}, \
- {"debugg", MASK_DEBUG_G}, \
- {"debugh", MASK_DEBUG_H}, \
- {"debugi", MASK_DEBUG_I}, \
- {"debugj", MASK_DEBUG_J}, \
- {"", (TARGET_DEFAULT \
- | TARGET_CPU_DEFAULT \
- | TARGET_ENDIAN_DEFAULT)} \
-}
-
-/* Default target_flags if no switches are specified */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 0
-#endif
-
-#ifndef TARGET_CPU_DEFAULT
-#define TARGET_CPU_DEFAULT 0
-#endif
-
-#ifndef TARGET_ENDIAN_DEFAULT
-#ifndef DECSTATION
-#define TARGET_ENDIAN_DEFAULT MASK_BIG_ENDIAN
-#else
-#define TARGET_ENDIAN_DEFAULT 0
-#endif
-#endif
-
-#ifndef MULTILIB_DEFAULTS
-#if TARGET_ENDIAN_DEFAULT == 0
-#define MULTILIB_DEFAULTS { "EL", "mips1" }
-#else
-#define MULTILIB_DEFAULTS { "EB", "mips1" }
-#endif
-#endif
-
-/* We must pass -EL to the linker by default for little endian embedded
- targets using linker scripts with a OUTPUT_FORMAT line. Otherwise, the
- linker will default to using big-endian output files. The OUTPUT_FORMAT
- line must be in the linker script, otherwise -EB/-EL will not work. */
-
-#ifndef LINKER_ENDIAN_SPEC
-#if TARGET_ENDIAN_DEFAULT == 0
-#define LINKER_ENDIAN_SPEC "%{!EB:%{!meb:-EL}}"
-#else
-#define LINKER_ENDIAN_SPEC ""
-#endif
-#endif
-
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
- command options that have values. Its definition is an
- initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- fixed part of the option name, and the address of a variable.
- The variable, type `char *', is set to the variable part of the
- given option if the fixed part matches. The actual option name
- is made by appending `-m' to the specified name.
-
- Here is an example which defines `-mshort-data-NUMBER'. If the
- given option is `-mshort-data-512', the variable `m88k_short_data'
- will be set to the string `"512"'.
-
- extern char *m88k_short_data;
- #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
-
-#define TARGET_OPTIONS \
-{ \
- SUBTARGET_TARGET_OPTIONS \
- { "cpu=", &mips_cpu_string }, \
- { "ips", &mips_isa_string } \
-}
-
-/* This is meant to be redefined in the host dependent files. */
-#define SUBTARGET_TARGET_OPTIONS
-
-/* Macros to decide whether certain features are available or not,
- depending on the instruction set architecture level. */
-
-#define BRANCH_LIKELY_P() (mips_isa >= 2)
-#define HAVE_SQRT_P() (mips_isa >= 2)
-
-/* CC1_SPEC causes -mips3 and -mips4 to set -mfp64 and -mgp64; -mips1 or
- -mips2 sets -mfp32 and -mgp32. This can be overridden by an explicit
- -mfp32, -mfp64, -mgp32 or -mgp64. -mfp64 sets MASK_FLOAT64 in
- target_flags, and -mgp64 sets MASK_64BIT.
-
- Setting MASK_64BIT in target_flags will cause gcc to assume that
- registers are 64 bits wide. int, long and void * will be 32 bit;
- this may be changed with -mint64 or -mlong64.
-
- The gen* programs link code that refers to MASK_64BIT. They don't
- actually use the information in target_flags; they just refer to
- it. */
-
-/* Switch Recognition by gcc.c. Add -G xx support */
-
-#ifdef SWITCH_TAKES_ARG
-#undef SWITCH_TAKES_ARG
-#endif
-
-#define SWITCH_TAKES_ARG(CHAR) \
- (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G')
-
-/* Sometimes certain combinations of command options do not make sense
- on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed.
-
- On the MIPS, it is used to handle -G. We also use it to set up all
- of the tables referenced in the other macros. */
-
-#define OVERRIDE_OPTIONS override_options ()
-
-/* Zero or more C statements that may conditionally modify two
- variables `fixed_regs' and `call_used_regs' (both of type `char
- []') after they have been initialized from the two preceding
- macros.
-
- This is necessary in case the fixed or call-clobbered registers
- depend on target flags.
-
- You need not define this macro if it has no work to do.
-
- If the usage of an entire class of registers depends on the target
- flags, you may indicate this to GCC by using this macro to modify
- `fixed_regs' and `call_used_regs' to 1 for each of the registers in
- the classes which should not be used by GCC. Also define the macro
- `REG_CLASS_FROM_LETTER' to return `NO_REGS' if it is called with a
- letter for a class that shouldn't be used.
-
- (However, if this class is not included in `GENERAL_REGS' and all
- of the insn patterns whose constraints permit this class are
- controlled by target switches, then GCC will automatically avoid
- using these registers when the target switches are opposed to
- them.) */
-
-#define CONDITIONAL_REGISTER_USAGE \
-do \
- { \
- if (!TARGET_HARD_FLOAT) \
- { \
- int regno; \
- \
- for (regno = FP_REG_FIRST; regno <= FP_REG_LAST; regno++) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- for (regno = ST_REG_FIRST; regno <= ST_REG_LAST; regno++) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- } \
- else if (mips_isa < 4) \
- { \
- int regno; \
- \
- /* We only have a single condition code register. We \
- implement this by hiding all the condition code registers, \
- and generating RTL that refers directly to ST_REG_FIRST. */ \
- for (regno = ST_REG_FIRST; regno <= ST_REG_LAST; regno++) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- } \
- SUBTARGET_CONDITIONAL_REGISTER_USAGE \
- } \
-while (0)
-
-/* This is meant to be redefined in the host dependent files. */
-#define SUBTARGET_CONDITIONAL_REGISTER_USAGE
-
-/* Show we can debug even without a frame pointer. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* Complain about missing specs and predefines that should be defined in each
- of the target tm files to override the defaults. This is mostly a place-
- holder until I can get each of the files updated [mm]. */
-
-#if defined(OSF_OS) \
- || defined(DECSTATION) \
- || defined(SGI_TARGET) \
- || defined(MIPS_NEWS) \
- || defined(MIPS_SYSV) \
- || defined(MIPS_SVR4) \
- || defined(MIPS_BSD43)
-
-#ifndef CPP_PREDEFINES
- #error "Define CPP_PREDEFINES in the appropriate tm.h file"
-#endif
-
-#ifndef LIB_SPEC
- #error "Define LIB_SPEC in the appropriate tm.h file"
-#endif
-
-#ifndef STARTFILE_SPEC
- #error "Define STARTFILE_SPEC in the appropriate tm.h file"
-#endif
-
-#ifndef MACHINE_TYPE
- #error "Define MACHINE_TYPE in the appropriate tm.h file"
-#endif
-#endif
-
-/* Tell collect what flags to pass to nm. */
-#ifndef NM_FLAGS
-#define NM_FLAGS "-Bp"
-#endif
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#ifndef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_BSD43 \
--D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_BSD43 \
--Asystem(unix) -Asystem(bsd) -Acpu(mips) -Amachine(mips)"
-#endif
-
-/* Assembler specs. */
-
-/* MIPS_AS_ASM_SPEC is passed when using the MIPS assembler rather
- than gas. */
-
-#define MIPS_AS_ASM_SPEC "\
-%{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} \
-%{pipe: %e-pipe is not supported.} \
-%{K} %(subtarget_mips_as_asm_spec)"
-
-/* SUBTARGET_MIPS_AS_ASM_SPEC is passed when using the MIPS assembler
- rather than gas. It may be overridden by subtargets. */
-
-#ifndef SUBTARGET_MIPS_AS_ASM_SPEC
-#define SUBTARGET_MIPS_AS_ASM_SPEC "%{v}"
-#endif
-
-/* GAS_ASM_SPEC is passed when using gas, rather than the MIPS
- assembler. */
-
-#define GAS_ASM_SPEC "%{mcpu=*} %{m4650} %{mmad:-m4650} %{v}"
-
-/* TARGET_ASM_SPEC is used to select either MIPS_AS_ASM_SPEC or
- GAS_ASM_SPEC as the default, depending upon the value of
- TARGET_DEFAULT. */
-
-#if ((TARGET_CPU_DEFAULT | TARGET_DEFAULT) & MASK_GAS) != 0
-/* GAS */
-
-#define TARGET_ASM_SPEC "\
-%{mmips-as: %(mips_as_asm_spec)} \
-%{!mmips-as: %(gas_asm_spec)}"
-
-#else /* not GAS */
-
-#define TARGET_ASM_SPEC "\
-%{!mgas: %(mips_as_asm_spec)} \
-%{mgas: %(gas_asm_spec)}"
-
-#endif /* not GAS */
-
-/* SUBTARGET_ASM_OPTIMIZING_SPEC handles passing optimization options
- to the assembler. It may be overridden by subtargets. */
-#ifndef SUBTARGET_ASM_OPTIMIZING_SPEC
-#define SUBTARGET_ASM_OPTIMIZING_SPEC "\
-%{noasmopt:-O0} \
-%{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}}"
-#endif
-
-/* SUBTARGET_ASM_DEBUGGING_SPEC handles passing debugging options to
- the assembler. It may be overridden by subtargets. */
-#ifndef SUBTARGET_ASM_DEBUGGING_SPEC
-#define SUBTARGET_ASM_DEBUGGING_SPEC "\
-%{g} %{g0} %{g1} %{g2} %{g3} \
-%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
-%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \
-%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
-%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3}"
-#endif
-
-/* SUBTARGET_ASM_SPEC is always passed to the assembler. It may be
- overridden by subtargets. */
-
-#ifndef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC ""
-#endif
-
-/* ASM_SPEC is the set of arguments to pass to the assembler. */
-
-#define ASM_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
-%(subtarget_asm_optimizing_spec) \
-%(subtarget_asm_debugging_spec) \
-%{membedded-pic} \
-%{mabi=32:-32}%{mabi=o32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \
-%(target_asm_spec) \
-%(subtarget_asm_spec)"
-
-/* Specify to run a post-processor, mips-tfile after the assembler
- has run to stuff the mips debug information into the object file.
- This is needed because the $#!%^ MIPS assembler provides no way
- of specifying such information in the assembly file. If we are
- cross compiling, disable mips-tfile unless the user specifies
- -mmips-tfile. */
-
-#ifndef ASM_FINAL_SPEC
-#if ((TARGET_CPU_DEFAULT | TARGET_DEFAULT) & MASK_GAS) != 0
-/* GAS */
-#define ASM_FINAL_SPEC "\
-%{mmips-as: %{!mno-mips-tfile: \
- \n mips-tfile %{v*: -v} \
- %{K: -I %b.o~} \
- %{!K: %{save-temps: -I %b.o~}} \
- %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \
- %{.s:%i} %{!.s:%g.s}}}"
-
-#else
-/* not GAS */
-#define ASM_FINAL_SPEC "\
-%{!mgas: %{!mno-mips-tfile: \
- \n mips-tfile %{v*: -v} \
- %{K: -I %b.o~} \
- %{!K: %{save-temps: -I %b.o~}} \
- %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \
- %{.s:%i} %{!.s:%g.s}}}"
-
-#endif
-#endif /* ASM_FINAL_SPEC */
-
-/* Redefinition of libraries used. Mips doesn't support normal
- UNIX style profiling via calling _mcount. It does offer
- profiling that samples the PC, so do what we can... */
-
-#ifndef LIB_SPEC
-#define LIB_SPEC "%{pg:-lprof1} %{p:-lprof1} -lc"
-#endif
-
-/* Extra switches sometimes passed to the linker. */
-/* ??? The bestGnum will never be passed to the linker, because the gcc driver
- will interpret it as a -b option. */
-
-#ifndef LINK_SPEC
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
-%{bestGnum} %{shared} %{non_shared} \
-%(linker_endian_spec)"
-#endif /* LINK_SPEC defined */
-
-/* Specs for the compiler proper */
-
-/* SUBTARGET_CC1_SPEC is passed to the compiler proper. It may be
- overridden by subtargets. */
-#ifndef SUBTARGET_CC1_SPEC
-#define SUBTARGET_CC1_SPEC ""
-#endif
-
-/* CC1_SPEC is the set of arguments to pass to the compiler proper. */
-
-#ifndef CC1_SPEC
-#define CC1_SPEC "\
-%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
-%{mips1:-mfp32 -mgp32} %{mips2:-mfp32 -mgp32}\
-%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
-%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \
-%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \
-%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \
-%{m4650:-mcpu=r4650} \
-%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \
-%{pic-none: -mno-half-pic} \
-%{pic-lib: -mhalf-pic} \
-%{pic-extern: -mhalf-pic} \
-%{pic-calls: -mhalf-pic} \
-%{save-temps: } \
-%(subtarget_cc1_spec) "
-#endif
-
-/* Preprocessor specs. */
-
-/* SUBTARGET_CPP_SIZE_SPEC defines SIZE_TYPE and PTRDIFF_TYPE. It may
- be overridden by subtargets. */
-
-#ifndef SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}"
-#endif
-
-/* SUBTARGET_CPP_SPEC is passed to the preprocessor. It may be
- overridden by subtargets. */
-#ifndef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC ""
-#endif
-
-/* CPP_SPEC is the set of arguments to pass to the preprocessor. */
-
-#ifndef CPP_SPEC
-#define CPP_SPEC "\
-%{.cc: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
-%{.cxx: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
-%{.C: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
-%{.m: -D__LANGUAGE_OBJECTIVE_C -D_LANGUAGE_OBJECTIVE_C -D__LANGUAGE_C -D_LANGUAGE_C} \
-%{.S: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
-%{.s: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
-%{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D__LANGUAGE_C -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} \
-%(subtarget_cpp_size_spec) \
-%{mips3:-U__mips -D__mips=3 -D__mips64} \
-%{mips4:-U__mips -D__mips=4 -D__mips64} \
-%{mgp32:-U__mips64} %{mgp64:-D__mips64} \
-%{msingle-float:%{!msoft-float:-D__mips_single_float}} \
-%{m4650:%{!msoft-float:-D__mips_single_float}} \
-%{msoft-float:-D__mips_soft_float} \
-%{mabi=eabi:-D__mips_eabi} \
-%{EB:-UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__ -D_MIPSEB -D__MIPSEB -D__MIPSEB__ %{!ansi:-DMIPSEB}} \
-%{EL:-UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__ -D_MIPSEL -D__MIPSEL -D__MIPSEL__ %{!ansi:-DMIPSEL}} \
-%(subtarget_cpp_spec) "
-#endif
-
-/* This macro defines names of additional specifications to put in the specs
- that can be used in various specifications like CC1_SPEC. Its definition
- is an initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- specification name, and a string constant that used by the GNU CC driver
- program.
-
- Do not define this macro if it does not need to do anything. */
-
-#define EXTRA_SPECS \
- { "subtarget_cc1_spec", SUBTARGET_CC1_SPEC }, \
- { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \
- { "subtarget_cpp_size_spec", SUBTARGET_CPP_SIZE_SPEC }, \
- { "mips_as_asm_spec", MIPS_AS_ASM_SPEC }, \
- { "gas_asm_spec", GAS_ASM_SPEC }, \
- { "target_asm_spec", TARGET_ASM_SPEC }, \
- { "subtarget_mips_as_asm_spec", SUBTARGET_MIPS_AS_ASM_SPEC }, \
- { "subtarget_asm_optimizing_spec", SUBTARGET_ASM_OPTIMIZING_SPEC }, \
- { "subtarget_asm_debugging_spec", SUBTARGET_ASM_DEBUGGING_SPEC }, \
- { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \
- { "linker_endian_spec", LINKER_ENDIAN_SPEC }, \
- SUBTARGET_EXTRA_SPECS
-
-#ifndef SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS
-#endif
-
-/* If defined, this macro is an additional prefix to try after
- `STANDARD_EXEC_PREFIX'. */
-
-#ifndef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/lib/cmplrs/cc/"
-#endif
-
-#ifndef MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"
-#endif
-
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define MIPS_VERSION "[AL 1.1, MM 40]"
-
-#ifndef MACHINE_TYPE
-#define MACHINE_TYPE "BSD Mips"
-#endif
-
-#ifndef TARGET_VERSION_INTERNAL
-#define TARGET_VERSION_INTERNAL(STREAM) \
- fprintf (STREAM, " %s %s", MIPS_VERSION, MACHINE_TYPE)
-#endif
-
-#ifndef TARGET_VERSION
-#define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
-#endif
-
-
-#define SDB_DEBUGGING_INFO /* generate info for mips-tfile */
-#define DBX_DEBUGGING_INFO /* generate stabs (OSF/rose) */
-#define MIPS_DEBUGGING_INFO /* MIPS specific debugging info */
-
-#ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */
-#define PREFERRED_DEBUGGING_TYPE ((!strncmp (str, "ggdb", 4)) ? DBX_DEBUG : SDB_DEBUG)
-#endif
-
-/* By default, turn on GDB extensions. */
-#define DEFAULT_GDB_EXTENSIONS 1
-
-/* If we are passing smuggling stabs through the MIPS ECOFF object
- format, put a comment in front of the .stab<x> operation so
- that the MIPS assembler does not choke. The mips-tfile program
- will correctly put the stab into the object file. */
-
-#define ASM_STABS_OP ((TARGET_GAS) ? ".stabs" : " #.stabs")
-#define ASM_STABN_OP ((TARGET_GAS) ? ".stabn" : " #.stabn")
-#define ASM_STABD_OP ((TARGET_GAS) ? ".stabd" : " #.stabd")
-
-/* Local compiler-generated symbols must have a prefix that the assembler
- understands. By default, this is $, although some targets (e.g.,
- NetBSD-ELF) need to override this. */
-
-#ifndef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "$"
-#endif
-
-/* By default on the mips, external symbols do not have an underscore
- prepended, but some targets (e.g., NetBSD) require this. */
-
-#ifndef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-#endif
-
-/* Forward references to tags are allowed. */
-#define SDB_ALLOW_FORWARD_REFERENCES
-
-/* Unknown tags are also allowed. */
-#define SDB_ALLOW_UNKNOWN_REFERENCES
-
-/* On Sun 4, this limit is 2048. We use 1500 to be safe,
- since the length can run past this up to a continuation point. */
-#define DBX_CONTIN_LENGTH 1500
-
-/* How to renumber registers for dbx and gdb. */
-#define DBX_REGISTER_NUMBER(REGNO) mips_dbx_regno[ (REGNO) ]
-
-/* The mapping from gcc register number to DWARF 2 CFA column number.
- This mapping does not allow for tracking DBX register 0, since column 0
- is used for the frame address, but since register 0 is fixed this is
- not really a problem. */
-#define DWARF_FRAME_REGNUM(REG) \
- (REG == GP_REG_FIRST + 31 ? DWARF_FRAME_RETURN_COLUMN \
- : DBX_REGISTER_NUMBER (REG))
-
-/* The DWARF 2 CFA column which tracks the return address. */
-#define DWARF_FRAME_RETURN_COLUMN (FP_REG_LAST + 1)
-
-/* Before the prologue, RA lives in r31. */
-#define INCOMING_RETURN_ADDR_RTX gen_rtx (REG, VOIDmode, GP_REG_FIRST + 31)
-
-/* Overrides for the COFF debug format. */
-#define PUT_SDB_SCL(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.scl\t%d;", (a)); \
-} while (0)
-
-#define PUT_SDB_INT_VAL(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.val\t%d;", (a)); \
-} while (0)
-
-#define PUT_SDB_VAL(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fputs ("\t.val\t", asm_out_text_file); \
- output_addr_const (asm_out_text_file, (a)); \
- fputc (';', asm_out_text_file); \
-} while (0)
-
-#define PUT_SDB_DEF(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t%s.def\t", \
- (TARGET_GAS) ? "" : "#"); \
- ASM_OUTPUT_LABELREF (asm_out_text_file, a); \
- fputc (';', asm_out_text_file); \
-} while (0)
-
-#define PUT_SDB_PLAIN_DEF(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t%s.def\t.%s;", \
- (TARGET_GAS) ? "" : "#", (a)); \
-} while (0)
-
-#define PUT_SDB_ENDEF \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.endef\n"); \
-} while (0)
-
-#define PUT_SDB_TYPE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.type\t0x%x;", (a)); \
-} while (0)
-
-#define PUT_SDB_SIZE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.size\t%d;", (a)); \
-} while (0)
-
-#define PUT_SDB_DIM(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.dim\t%d;", (a)); \
-} while (0)
-
-#ifndef PUT_SDB_START_DIM
-#define PUT_SDB_START_DIM \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.dim\t"); \
-} while (0)
-#endif
-
-#ifndef PUT_SDB_NEXT_DIM
-#define PUT_SDB_NEXT_DIM(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "%d,", a); \
-} while (0)
-#endif
-
-#ifndef PUT_SDB_LAST_DIM
-#define PUT_SDB_LAST_DIM(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "%d;", a); \
-} while (0)
-#endif
-
-#define PUT_SDB_TAG(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.tag\t"); \
- ASM_OUTPUT_LABELREF (asm_out_text_file, a); \
- fputc (';', asm_out_text_file); \
-} while (0)
-
-/* For block start and end, we create labels, so that
- later we can figure out where the correct offset is.
- The normal .ent/.end serve well enough for functions,
- so those are just commented out. */
-
-#define PUT_SDB_BLOCK_START(LINE) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, \
- "%sLb%d:\n\t%s.begin\t%sLb%d\t%d\n", \
- LOCAL_LABEL_PREFIX, \
- sdb_label_count, \
- (TARGET_GAS) ? "" : "#", \
- LOCAL_LABEL_PREFIX, \
- sdb_label_count, \
- (LINE)); \
- sdb_label_count++; \
-} while (0)
-
-#define PUT_SDB_BLOCK_END(LINE) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, \
- "%sLe%d:\n\t%s.bend\t%sLe%d\t%d\n", \
- LOCAL_LABEL_PREFIX, \
- sdb_label_count, \
- (TARGET_GAS) ? "" : "#", \
- LOCAL_LABEL_PREFIX, \
- sdb_label_count, \
- (LINE)); \
- sdb_label_count++; \
-} while (0)
-
-#define PUT_SDB_FUNCTION_START(LINE)
-
-#define PUT_SDB_FUNCTION_END(LINE) \
-do { \
- extern FILE *asm_out_text_file; \
- ASM_OUTPUT_SOURCE_LINE (asm_out_text_file, LINE + sdb_begin_function_line); \
-} while (0)
-
-#define PUT_SDB_EPILOGUE_END(NAME)
-
-#define PUT_SDB_SRC_FILE(FILENAME) \
-do { \
- extern FILE *asm_out_text_file; \
- output_file_directive (asm_out_text_file, (FILENAME)); \
-} while (0)
-
-#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
- sprintf ((BUFFER), ".%dfake", (NUMBER));
-
-/* Correct the offset of automatic variables and arguments. Note that
- the MIPS debug format wants all automatic variables and arguments
- to be in terms of the virtual frame pointer (stack pointer before
- any adjustment in the function), while the MIPS 3.0 linker wants
- the frame pointer to be the stack pointer after the initial
- adjustment. */
-
-#define DEBUGGER_AUTO_OFFSET(X) mips_debugger_offset (X, 0)
-#define DEBUGGER_ARG_OFFSET(OFFSET, X) mips_debugger_offset (X, OFFSET)
-
-
-/* Tell collect that the object format is ECOFF */
-#ifndef OBJECT_FORMAT_ROSE
-#define OBJECT_FORMAT_COFF /* Object file looks like COFF */
-#define EXTENDED_COFF /* ECOFF, not normal coff */
-#endif
-
-#if 0 /* These definitions normally have no effect because
- MIPS systems define USE_COLLECT2, so
- assemble_constructor does nothing anyway. */
-
-/* Don't use the default definitions, because we don't have gld.
- Also, we don't want stabs when generating ECOFF output.
- Instead we depend on collect to handle these. */
-
-#define ASM_OUTPUT_CONSTRUCTOR(file, name)
-#define ASM_OUTPUT_DESTRUCTOR(file, name)
-
-#endif /* 0 */
-
-/* Target machine storage layout */
-
-/* Define in order to support both big and little endian float formats
- in the same gcc binary. */
-#define REAL_ARITHMETIC
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
-*/
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0)
-
-/* Define this if most significant word of a multiword number is the lowest. */
-#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0)
-
-/* Define this to set the endianness to use in libgcc2.c, which can
- not depend on target_flags. */
-#if !defined(MIPSEL) && !defined(__MIPSEL__)
-#define LIBGCC2_WORDS_BIG_ENDIAN 1
-#else
-#define LIBGCC2_WORDS_BIG_ENDIAN 0
-#endif
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD (TARGET_64BIT ? 64 : 32)
-#define MAX_BITS_PER_WORD 64
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4)
-#define MIN_UNITS_PER_WORD 4
-
-/* For MIPS, width of a floating point register. */
-#define UNITS_PER_FPREG (TARGET_FLOAT64 ? 8 : 4)
-
-/* A C expression for the size in bits of the type `int' on the
- target machine. If you don't define this, the default is one
- word. */
-#define INT_TYPE_SIZE (TARGET_INT64 ? 64 : 32)
-#define MAX_INT_TYPE_SIZE 64
-
-/* Tell the preprocessor the maximum size of wchar_t. */
-#ifndef MAX_WCHAR_TYPE_SIZE
-#ifndef WCHAR_TYPE_SIZE
-#define MAX_WCHAR_TYPE_SIZE MAX_INT_TYPE_SIZE
-#endif
-#endif
-
-/* A C expression for the size in bits of the type `short' on the
- target machine. If you don't define this, the default is half a
- word. (If this would be less than one storage unit, it is
- rounded up to one unit.) */
-#define SHORT_TYPE_SIZE 16
-
-/* A C expression for the size in bits of the type `long' on the
- target machine. If you don't define this, the default is one
- word. */
-#define LONG_TYPE_SIZE (TARGET_LONG64 ? 64 : 32)
-#define MAX_LONG_TYPE_SIZE 64
-
-/* A C expression for the size in bits of the type `long long' on the
- target machine. If you don't define this, the default is two
- words. */
-#define LONG_LONG_TYPE_SIZE 64
-
-/* A C expression for the size in bits of the type `char' on the
- target machine. If you don't define this, the default is one
- quarter of a word. (If this would be less than one storage unit,
- it is rounded up to one unit.) */
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-
-/* A C expression for the size in bits of the type `float' on the
- target machine. If you don't define this, the default is one
- word. */
-#define FLOAT_TYPE_SIZE 32
-
-/* A C expression for the size in bits of the type `double' on the
- target machine. If you don't define this, the default is two
- words. */
-#define DOUBLE_TYPE_SIZE 64
-
-/* A C expression for the size in bits of the type `long double' on
- the target machine. If you don't define this, the default is two
- words. */
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE (TARGET_LONG64 ? 64 : 32)
-
-/* Allocation boundary (in *bits*) for storing pointers in memory. */
-#define POINTER_BOUNDARY (TARGET_LONG64 ? 64 : 32)
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY (TARGET_64BIT ? 64 : 32)
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-/* 8 is observed right on a DECstation and on riscos 4.02. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* There is no point aligning anything to a rounder boundary than this. */
-#define BIGGEST_ALIGNMENT 64
-
-/* Biggest alignment any structure field can require in bits. */
-#define BIGGEST_FIELD_ALIGNMENT 64
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Define this if you wish to imitate the way many other C compilers
- handle alignment of bitfields and the structures that contain
- them.
-
- The behavior is that the type written for a bitfield (`int',
- `short', or other integer type) imposes an alignment for the
- entire structure, as if the structure really did contain an
- ordinary field of that type. In addition, the bitfield is placed
- within the structure so that it would fit within such a field,
- not crossing a boundary for it.
-
- Thus, on most machines, a bitfield whose type is written as `int'
- would not cross a four-byte boundary, and would force four-byte
- alignment for the whole structure. (The alignment used may not
- be four bytes; it is controlled by the other alignment
- parameters.)
-
- If the macro is defined, its definition should be a C expression;
- a nonzero value for the expression enables this behavior. */
-
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* If defined, a C expression to compute the alignment given to a
- constant that is being placed in memory. CONSTANT is the constant
- and ALIGN is the alignment that the object would ordinarily have.
- The value of this macro is used instead of that alignment to align
- the object.
-
- If this macro is not defined, then ALIGN is used.
-
- The typical use of this macro is to increase alignment for string
- constants to be word aligned so that `strcpy' calls that copy
- constants can be done inline. */
-
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
- && (ALIGN) < BITS_PER_WORD \
- ? BITS_PER_WORD \
- : (ALIGN))
-
-/* If defined, a C expression to compute the alignment for a static
- variable. TYPE is the data type, and ALIGN is the alignment that
- the object would ordinarily have. The value of this macro is used
- instead of that alignment to align the object.
-
- If this macro is not defined, then ALIGN is used.
-
- One use of this macro is to increase alignment of medium-size
- data to make it all fit in fewer cache lines. Another is to
- cause character arrays to be word-aligned so that `strcpy' calls
- that copy constants to character arrays can be done inline. */
-
-#undef DATA_ALIGNMENT
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- ((((ALIGN) < BITS_PER_WORD) \
- && (TREE_CODE (TYPE) == ARRAY_TYPE \
- || TREE_CODE (TYPE) == UNION_TYPE \
- || TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))
-
-/* Define this macro if an argument declared as `char' or `short' in a
- prototype should actually be passed as an `int'. In addition to
- avoiding errors in certain cases of mismatch, it also makes for
- better code on certain machines. */
-
-#define PROMOTE_PROTOTYPES
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- On the Mips, we have 32 integer registers, 32 floating point
- registers, 8 condition code registers, and the special registers
- hi, lo, hilo, and rap. The 8 condition code registers are only
- used if mips_isa >= 4. The hilo register is only used in 64 bit
- mode. It represents a 64 bit value stored as two 32 bit values in
- the hi and lo registers; this is the result of the mult
- instruction. rap is a pointer to the stack where the return
- address reg ($31) was stored. This is needed for C++ exception
- handling. */
-
-#define FIRST_PSEUDO_REGISTER 76
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
-
- On the MIPS, see conventions, page D-2 */
-
-#define FIXED_REGISTERS \
-{ \
- 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 \
-}
-
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-
-#define CALL_USED_REGISTERS \
-{ \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 \
-}
-
-
-/* Internal macros to classify a register number as to whether it's a
- general purpose register, a floating point register, a
- multiply/divide register, or a status register. */
-
-#define GP_REG_FIRST 0
-#define GP_REG_LAST 31
-#define GP_REG_NUM (GP_REG_LAST - GP_REG_FIRST + 1)
-#define GP_DBX_FIRST 0
-
-#define FP_REG_FIRST 32
-#define FP_REG_LAST 63
-#define FP_REG_NUM (FP_REG_LAST - FP_REG_FIRST + 1)
-#define FP_DBX_FIRST ((write_symbols == DBX_DEBUG) ? 38 : 32)
-
-#define MD_REG_FIRST 64
-#define MD_REG_LAST 66
-#define MD_REG_NUM (MD_REG_LAST - MD_REG_FIRST + 1)
-
-#define ST_REG_FIRST 67
-#define ST_REG_LAST 74
-#define ST_REG_NUM (ST_REG_LAST - ST_REG_FIRST + 1)
-
-#define RAP_REG_NUM 75
-
-#define AT_REGNUM (GP_REG_FIRST + 1)
-#define HI_REGNUM (MD_REG_FIRST + 0)
-#define LO_REGNUM (MD_REG_FIRST + 1)
-#define HILO_REGNUM (MD_REG_FIRST + 2)
-
-/* FPSW_REGNUM is the single condition code used if mips_isa < 4. If
- mips_isa >= 4, it should not be used, and an arbitrary ST_REG
- should be used instead. */
-#define FPSW_REGNUM ST_REG_FIRST
-
-#define GP_REG_P(REGNO) ((unsigned) ((REGNO) - GP_REG_FIRST) < GP_REG_NUM)
-#define FP_REG_P(REGNO) ((unsigned) ((REGNO) - FP_REG_FIRST) < FP_REG_NUM)
-#define MD_REG_P(REGNO) ((unsigned) ((REGNO) - MD_REG_FIRST) < MD_REG_NUM)
-#define ST_REG_P(REGNO) ((unsigned) ((REGNO) - ST_REG_FIRST) < ST_REG_NUM)
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On the MIPS, all general registers are one word long. Except on
- the R4000 with the FR bit set, the floating point uses register
- pairs, with the second register not being allocatable. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (! FP_REG_P (REGNO) \
- ? ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_FPREG - 1) / UNITS_PER_FPREG))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode
- MODE. In 32 bit mode, require that DImode and DFmode be in even
- registers. For DImode, this makes some of the insns easier to
- write, since you don't have to worry about a DImode value in
- registers 3 & 4, producing a result in 4 & 5.
-
- To make the code simpler HARD_REGNO_MODE_OK now just references an
- array built in override_options. Because machmodes.h is not yet
- included before this file is processed, the MODE bound can't be
- expressed here. */
-
-extern char mips_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- mips_hard_regno_mode_ok[ (int)(MODE) ][ (REGNO) ]
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- ((GET_MODE_CLASS (MODE1) == MODE_FLOAT || \
- GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
- == (GET_MODE_CLASS (MODE2) == MODE_FLOAT || \
- GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT))
-
-/* MIPS pc is not overloaded on a register. */
-/* #define PC_REGNUM xx */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM (GP_REG_FIRST + 29)
-
-/* Offset from the stack pointer to the first available location. Use
- the default value zero. */
-/* #define STACK_POINTER_OFFSET 0 */
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM (GP_REG_FIRST + 30)
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED (current_function_calls_alloca)
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM GP_REG_FIRST
-
-/* Fake register that holds the address on the stack of the
- current function's return address. */
-#define RETURN_ADDRESS_POINTER_REGNUM RAP_REG_NUM
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 2)
-
-/* If the structure value address is passed in a register, then
- `STRUCT_VALUE_REGNUM' should be the number of that register. */
-/* #define STRUCT_VALUE_REGNUM (GP_REG_FIRST + 4) */
-
-/* If the structure value address is not passed in a register, define
- `STRUCT_VALUE' as an expression returning an RTX for the place
- where the address is passed. If it returns 0, the address is
- passed as an "invisible" first argument. */
-#define STRUCT_VALUE 0
-
-/* Mips registers used in prologue/epilogue code when the stack frame
- is larger than 32K bytes. These registers must come from the
- scratch register set, and not used for passing and returning
- arguments and any other information used in the calling sequence
- (such as pic). Must start at 12, since t0/t3 are parameter passing
- registers in the 64 bit ABI. */
-
-#define MIPS_TEMP1_REGNUM (GP_REG_FIRST + 12)
-#define MIPS_TEMP2_REGNUM (GP_REG_FIRST + 13)
-
-/* Define this macro if it is as good or better to call a constant
- function address than to call an address kept in a register. */
-#define NO_FUNCTION_CSE 1
-
-/* Define this macro if it is as good or better for a function to
- call itself with an explicit address than to call an address
- kept in a register. */
-#define NO_RECURSIVE_FUNCTION_CSE 1
-
-/* The register number of the register used to address a table of
- static data addresses in memory. In some cases this register is
- defined by a processor's "application binary interface" (ABI).
- When this macro is defined, RTL is generated for this register
- once, as with the stack pointer and frame pointer registers. If
- this macro is not defined, it is up to the machine-dependent
- files to allocate such a register (if necessary). */
-#define PIC_OFFSET_TABLE_REGNUM (GP_REG_FIRST + 28)
-
-#define PIC_FUNCTION_ADDR_REGNUM (GP_REG_FIRST + 25)
-
-/* Initialize embedded_pic_fnaddr_rtx before RTL generation for
- each function. We used to do this in FINALIZE_PIC, but FINALIZE_PIC
- isn't always called for static inline functions. */
-#define INIT_EXPANDERS embedded_pic_fnaddr_rtx = NULL;
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-enum reg_class
-{
- NO_REGS, /* no registers in set */
- GR_REGS, /* integer registers */
- FP_REGS, /* floating point registers */
- HI_REG, /* hi register */
- LO_REG, /* lo register */
- HILO_REG, /* hilo register pair for 64 bit mode mult */
- MD_REGS, /* multiply/divide registers (hi/lo) */
- ST_REGS, /* status registers (fp status) */
- ALL_REGS, /* all registers */
- LIM_REG_CLASSES /* max value + 1 */
-};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-#define GENERAL_REGS GR_REGS
-
-/* An initializer containing the names of the register classes as C
- string constants. These names are used in writing some of the
- debugging dumps. */
-
-#define REG_CLASS_NAMES \
-{ \
- "NO_REGS", \
- "GR_REGS", \
- "FP_REGS", \
- "HI_REG", \
- "LO_REG", \
- "HILO_REG", \
- "MD_REGS", \
- "ST_REGS", \
- "ALL_REGS" \
-}
-
-/* An initializer containing the contents of the register classes,
- as integers which are bit masks. The Nth integer specifies the
- contents of class N. The way the integer MASK is interpreted is
- that register R is in the class if `MASK & (1 << R)' is 1.
-
- When the machine has more than 32 registers, an integer does not
- suffice. Then the integers are replaced by sub-initializers,
- braced groupings containing several integers. Each
- sub-initializer must be suitable as an initializer for the type
- `HARD_REG_SET' which is defined in `hard-reg-set.h'. */
-
-#define REG_CLASS_CONTENTS \
-{ \
- { 0x00000000, 0x00000000, 0x00000000 }, /* no registers */ \
- { 0xffffffff, 0x00000000, 0x00000000 }, /* integer registers */ \
- { 0x00000000, 0xffffffff, 0x00000000 }, /* floating registers*/ \
- { 0x00000000, 0x00000000, 0x00000001 }, /* hi register */ \
- { 0x00000000, 0x00000000, 0x00000002 }, /* lo register */ \
- { 0x00000000, 0x00000000, 0x00000004 }, /* hilo register */ \
- { 0x00000000, 0x00000000, 0x00000003 }, /* mul/div registers */ \
- { 0x00000000, 0x00000000, 0x000007f8 }, /* status registers */ \
- { 0xffffffff, 0xffffffff, 0x000007ff } /* all registers */ \
-}
-
-
-/* A C expression whose value is a register class containing hard
- register REGNO. In general there is more that one such class;
- choose a class which is "minimal", meaning that no smaller class
- also contains the register. */
-
-extern enum reg_class mips_regno_to_class[];
-
-#define REGNO_REG_CLASS(REGNO) mips_regno_to_class[ (REGNO) ]
-
-/* A macro whose definition is the name of the class to which a
- valid base register must belong. A base register is one used in
- an address which is the register value plus a displacement. */
-
-#define BASE_REG_CLASS GR_REGS
-
-/* A macro whose definition is the name of the class to which a
- valid index register must belong. An index register is one used
- in an address where its value is either multiplied by a scale
- factor or added to another register (as well as added to a
- displacement). */
-
-#define INDEX_REG_CLASS NO_REGS
-
-
-/* REGISTER AND CONSTANT CLASSES */
-
-/* Get reg_class from a letter such as appears in the machine
- description.
-
- DEFINED REGISTER CLASSES:
-
- 'd' General (aka integer) registers
- 'f' Floating point registers
- 'h' Hi register
- 'l' Lo register
- 'x' Multiply/divide registers
- 'a' HILO_REG
- 'z' FP Status register
- 'b' All registers */
-
-extern enum reg_class mips_char_to_class[];
-
-#define REG_CLASS_FROM_LETTER(C) mips_char_to_class[ (C) ]
-
-/* The letters I, J, K, L, M, N, O, and P in a register constraint
- string can be used to stand for particular ranges of immediate
- operands. This macro defines what the ranges are. C is the
- letter, and VALUE is a constant value. Return 1 if VALUE is
- in the range specified by C. */
-
-/* For MIPS:
-
- `I' is used for the range of constants an arithmetic insn can
- actually contain (16 bits signed integers).
-
- `J' is used for the range which is just zero (ie, $r0).
-
- `K' is used for the range of constants a logical insn can actually
- contain (16 bit zero-extended integers).
-
- `L' is used for the range of constants that be loaded with lui
- (ie, the bottom 16 bits are zero).
-
- `M' is used for the range of constants that take two words to load
- (ie, not matched by `I', `K', and `L').
-
- `N' is used for negative 16 bit constants.
-
- `O' is an exact power of 2 (not yet used in the md file).
-
- `P' is used for positive 16 bit constants. */
-
-#define SMALL_INT(X) ((unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)
-#define SMALL_INT_UNSIGNED(X) ((unsigned HOST_WIDE_INT) (INTVAL (X)) < 0x10000)
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? ((unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000) \
- : (C) == 'J' ? ((VALUE) == 0) \
- : (C) == 'K' ? ((unsigned HOST_WIDE_INT) (VALUE) < 0x10000) \
- : (C) == 'L' ? (((VALUE) & 0x0000ffff) == 0 \
- && (((VALUE) & ~2147483647) == 0 \
- || ((VALUE) & ~2147483647) == ~2147483647)) \
- : (C) == 'M' ? ((((VALUE) & ~0x0000ffff) != 0) \
- && (((VALUE) & ~0x0000ffff) != ~0x0000ffff) \
- && (((VALUE) & 0x0000ffff) != 0 \
- || (((VALUE) & ~2147483647) != 0 \
- && ((VALUE) & ~2147483647) != ~2147483647))) \
- : (C) == 'N' ? (((VALUE) & ~0x0000ffff) == ~0x0000ffff) \
- : (C) == 'O' ? (exact_log2 (VALUE) >= 0) \
- : (C) == 'P' ? ((VALUE) != 0 && (((VALUE) & ~0x0000ffff) == 0)) \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-/* For Mips
-
- 'G' : Floating point 0 */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' \
- && (VALUE) == CONST0_RTX (GET_MODE (VALUE)))
-
-/* Letters in the range `Q' through `U' may be defined in a
- machine-dependent fashion to stand for arbitrary operand types.
- The machine description macro `EXTRA_CONSTRAINT' is passed the
- operand as its first argument and the constraint letter as its
- second operand.
-
- `Q' is for memory references which take more than 1 instruction.
- `R' is for memory references which take 1 word for the instruction.
- `S' is for references to extern items which are PIC for OSF/rose. */
-
-#define EXTRA_CONSTRAINT(OP,CODE) \
- ((GET_CODE (OP) != MEM) ? FALSE \
- : ((CODE) == 'Q') ? !simple_memory_operand (OP, GET_MODE (OP)) \
- : ((CODE) == 'R') ? simple_memory_operand (OP, GET_MODE (OP)) \
- : ((CODE) == 'S') ? (HALF_PIC_P () && CONSTANT_P (OP) \
- && HALF_PIC_ADDRESS_P (OP)) \
- : FALSE)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- ((CLASS) != ALL_REGS \
- ? (CLASS) \
- : ((GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- || GET_MODE_CLASS (GET_MODE (X)) == MODE_COMPLEX_FLOAT) \
- ? (TARGET_SOFT_FLOAT ? GR_REGS : FP_REGS) \
- : ((GET_MODE_CLASS (GET_MODE (X)) == MODE_INT \
- || GET_MODE (X) == VOIDmode) \
- ? GR_REGS \
- : (CLASS))))
-
-/* Certain machines have the property that some registers cannot be
- copied to some other registers without using memory. Define this
- macro on those machines to be a C expression that is non-zero if
- objects of mode MODE in registers of CLASS1 can only be copied to
- registers of class CLASS2 by storing a register of CLASS1 into
- memory and loading that memory location into a register of CLASS2.
-
- Do not define this macro if its value would always be zero. */
-
-#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
- ((!TARGET_DEBUG_H_MODE \
- && GET_MODE_CLASS (MODE) == MODE_INT \
- && ((CLASS1 == FP_REGS && CLASS2 == GR_REGS) \
- || (CLASS1 == GR_REGS && CLASS2 == FP_REGS))) \
- || (TARGET_FLOAT64 && !TARGET_64BIT && (MODE) == DFmode \
- && ((CLASS1 == GR_REGS && CLASS2 == FP_REGS) \
- || (CLASS2 == GR_REGS && CLASS1 == FP_REGS))))
-
-/* The HI and LO registers can only be reloaded via the general
- registers. Condition code registers can only be loaded to the
- general registers, and from the floating point registers. */
-
-#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
- mips_secondary_reload_class (CLASS, MODE, X, 1)
-#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
- mips_secondary_reload_class (CLASS, MODE, X, 0)
-
-/* Not declared above, with the other functions, because enum
- reg_class is not declared yet. */
-extern enum reg_class mips_secondary_reload_class ();
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-
-#define CLASS_UNITS(mode, size) \
- ((GET_MODE_SIZE (mode) + (size) - 1) / (size))
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FP_REGS \
- ? (TARGET_FLOAT64 \
- ? CLASS_UNITS (MODE, 8) \
- : 2 * CLASS_UNITS (MODE, 8)) \
- : CLASS_UNITS (MODE, UNITS_PER_WORD))
-
-/* If defined, this is a C expression whose value should be
- nonzero if the insn INSN has the effect of mysteriously
- clobbering the contents of hard register number REGNO. By
- "mysterious" we mean that the insn's RTL expression doesn't
- describe such an effect.
-
- If this macro is not defined, it means that no insn clobbers
- registers mysteriously. This is the usual situation; all else
- being equal, it is best for the RTL expression to show all the
- activity. */
-
-/* #define INSN_CLOBBERS_REGNO_P(INSN, REGNO) */
-
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-/* #define FRAME_GROWS_DOWNWARD */
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET \
- (current_function_outgoing_args_size \
- + (TARGET_ABICALLS ? MIPS_STACK_ALIGN (UNITS_PER_WORD) : 0))
-
-/* Offset from the stack pointer register to an item dynamically
- allocated on the stack, e.g., by `alloca'.
-
- The default value for this macro is `STACK_POINTER_OFFSET' plus the
- length of the outgoing arguments. The default is correct for most
- machines. See `function.c' for details.
-
- The MIPS ABI states that functions which dynamically allocate the
- stack must not have 0 for STACK_DYNAMIC_OFFSET, since it looks like
- we are trying to create a second frame pointer to the function, so
- allocate some stack space to make it happy.
-
- However, the linker currently complains about linking any code that
- dynamically allocates stack space, and there seems to be a bug in
- STACK_DYNAMIC_OFFSET, so don't define this right now. */
-
-#if 0
-#define STACK_DYNAMIC_OFFSET(FUNDECL) \
- ((current_function_outgoing_args_size == 0 && current_function_calls_alloca) \
- ? 4*UNITS_PER_WORD \
- : current_function_outgoing_args_size)
-#endif
-
-/* The return address for the current frame is in r31 is this is a leaf
- function. Otherwise, it is on the stack. It is at a variable offset
- from sp/fp/ap, so we define a fake hard register rap which is a
- poiner to the return address on the stack. This always gets eliminated
- during reload to be either the frame pointer or the stack pointer plus
- an offset. */
-
-/* ??? This definition fails for leaf functions. There is currently no
- general solution for this problem. */
-
-/* ??? There appears to be no way to get the return address of any previous
- frame except by disassembling instructions in the prologue/epilogue.
- So currently we support only the current frame. */
-
-#define RETURN_ADDR_RTX(count, frame) \
- ((count == 0) \
- ? gen_rtx (MEM, Pmode, gen_rtx (REG, Pmode, RETURN_ADDRESS_POINTER_REGNUM))\
- : (rtx) 0)
-
-/* Structure to be filled in by compute_frame_size with register
- save masks, and offsets for the current function. */
-
-struct mips_frame_info
-{
- long total_size; /* # bytes that the entire frame takes up */
- long var_size; /* # bytes that variables take up */
- long args_size; /* # bytes that outgoing arguments take up */
- long extra_size; /* # bytes of extra gunk */
- int gp_reg_size; /* # bytes needed to store gp regs */
- int fp_reg_size; /* # bytes needed to store fp regs */
- long mask; /* mask of saved gp registers */
- long fmask; /* mask of saved fp registers */
- long gp_save_offset; /* offset from vfp to store gp registers */
- long fp_save_offset; /* offset from vfp to store fp registers */
- long gp_sp_offset; /* offset from new sp to store gp registers */
- long fp_sp_offset; /* offset from new sp to store fp registers */
- int initialized; /* != 0 if frame size already calculated */
- int num_gp; /* number of gp registers saved */
- int num_fp; /* number of fp registers saved */
-};
-
-extern struct mips_frame_info current_frame_info;
-
-/* If defined, this macro specifies a table of register pairs used to
- eliminate unneeded registers that point into the stack frame. If
- it is not defined, the only elimination attempted by the compiler
- is to replace references to the frame pointer with references to
- the stack pointer.
-
- The definition of this macro is a list of structure
- initializations, each of which specifies an original and
- replacement register.
-
- On some machines, the position of the argument pointer is not
- known until the compilation is completed. In such a case, a
- separate hard register must be used for the argument pointer.
- This register can be eliminated by replacing it with either the
- frame pointer or the argument pointer, depending on whether or not
- the frame pointer has been eliminated.
-
- In this case, you might specify:
- #define ELIMINABLE_REGS \
- {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
-
- Note that the elimination of the argument pointer with the stack
- pointer is specified first since that is the preferred elimination. */
-
-#define ELIMINABLE_REGS \
-{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { RETURN_ADDRESS_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
-
-/* A C expression that returns non-zero if the compiler is allowed to
- try to replace register number FROM-REG with register number
- TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
- defined, and will usually be the constant 1, since most of the
- cases preventing register elimination are things that the compiler
- already knows about. */
-
-#define CAN_ELIMINATE(FROM, TO) \
- (!frame_pointer_needed \
- || ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
- || ((FROM) == RETURN_ADDRESS_POINTER_REGNUM \
- && (TO) == FRAME_POINTER_REGNUM))
-
-/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
- specifies the initial difference between the specified pair of
- registers. This macro must be defined if `ELIMINABLE_REGS' is
- defined. */
-
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ compute_frame_size (get_frame_size ()); \
- if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- (OFFSET) = 0; \
- else if ((FROM) == ARG_POINTER_REGNUM \
- && ((TO) == FRAME_POINTER_REGNUM \
- || (TO) == STACK_POINTER_REGNUM)) \
- (OFFSET) = (current_frame_info.total_size \
- - ((mips_abi != ABI_32 && mips_abi != ABI_EABI) \
- ? current_function_pretend_args_size \
- : 0)); \
- else if ((FROM) == RETURN_ADDRESS_POINTER_REGNUM \
- && ((TO) == FRAME_POINTER_REGNUM \
- || (TO) == STACK_POINTER_REGNUM)) \
- (OFFSET) = current_frame_info.gp_sp_offset; \
- else \
- abort (); \
-}
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On the vax, sp@- in a byte insn really pushes a word. */
-
-/* #define PUSH_ROUNDING(BYTES) 0 */
-
-/* If defined, the maximum amount of space required for outgoing
- arguments will be computed and placed into the variable
- `current_function_outgoing_args_size'. No space will be pushed
- onto the stack for each call; instead, the function prologue
- should increase the stack frame size by this amount.
-
- It is not proper to define both `PUSH_ROUNDING' and
- `ACCUMULATE_OUTGOING_ARGS'. */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Offset from the argument pointer register to the first argument's
- address. On some machines it may depend on the data type of the
- function.
-
- If `ARGS_GROW_DOWNWARD', this is the offset to the location above
- the first argument's address.
-
- On the MIPS, we must skip the first argument position if we are
- returning a structure or a union, to account for its address being
- passed in $4. However, at the current time, this produces a compiler
- that can't bootstrap, so comment it out for now. */
-
-#if 0
-#define FIRST_PARM_OFFSET(FNDECL) \
- (FNDECL != 0 \
- && TREE_TYPE (FNDECL) != 0 \
- && TREE_TYPE (TREE_TYPE (FNDECL)) != 0 \
- && (TREE_CODE (TREE_TYPE (TREE_TYPE (FNDECL))) == RECORD_TYPE \
- || TREE_CODE (TREE_TYPE (TREE_TYPE (FNDECL))) == UNION_TYPE) \
- ? UNITS_PER_WORD \
- : 0)
-#else
-#define FIRST_PARM_OFFSET(FNDECL) 0
-#endif
-
-/* When a parameter is passed in a register, stack space is still
- allocated for it. For the MIPS, stack space must be allocated, cf
- Asm Lang Prog Guide page 7-8.
-
- BEWARE that some space is also allocated for non existing arguments
- in register. In case an argument list is of form GF used registers
- are a0 (a2,a3), but we should push over a1... */
-
-#define REG_PARM_STACK_SPACE(FNDECL) \
- ((MAX_ARGS_IN_REGISTERS*UNITS_PER_WORD) - FIRST_PARM_OFFSET (FNDECL))
-
-/* Define this if it is the responsibility of the caller to
- allocate the area reserved for arguments passed in registers.
- If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect
- of this macro is to determine whether the space is included in
- `current_function_outgoing_args_size'. */
-#define OUTGOING_REG_PARM_STACK_SPACE
-
-/* Align stack frames on 64 bits (Double Word ). */
-#define STACK_BOUNDARY 64
-
-/* Make sure 4 words are always allocated on the stack. */
-
-#ifndef STACK_ARGS_ADJUST
-#define STACK_ARGS_ADJUST(SIZE) \
-{ \
- if (SIZE.constant < 4 * UNITS_PER_WORD) \
- SIZE.constant = 4 * UNITS_PER_WORD; \
-}
-#endif
-
-
-/* A C expression that should indicate the number of bytes of its
- own arguments that a function function pops on returning, or 0
- if the function pops no arguments and the caller must therefore
- pop them all after the function returns.
-
- FUNDECL is the declaration node of the function (as a tree).
-
- FUNTYPE is a C variable whose value is a tree node that
- describes the function in question. Normally it is a node of
- type `FUNCTION_TYPE' that describes the data type of the function.
- From this it is possible to obtain the data types of the value
- and arguments (if known).
-
- When a call to a library function is being considered, FUNTYPE
- will contain an identifier node for the library function. Thus,
- if you need to distinguish among various library functions, you
- can do so by their names. Note that "library function" in this
- context means a function used to perform arithmetic, whose name
- is known specially in the compiler and was not mentioned in the
- C code being compiled.
-
- STACK-SIZE is the number of bytes of arguments passed on the
- stack. If a variable number of bytes is passed, it is zero, and
- argument popping will always be the responsibility of the
- calling function. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-
-/* Symbolic macros for the registers used to return integer and floating
- point values. */
-
-#define GP_RETURN (GP_REG_FIRST + 2)
-#define FP_RETURN ((TARGET_SOFT_FLOAT) ? GP_RETURN : (FP_REG_FIRST + 0))
-
-/* Symbolic macros for the first/last argument registers. */
-
-#define GP_ARG_FIRST (GP_REG_FIRST + 4)
-#define GP_ARG_LAST (GP_REG_FIRST + 7)
-#define FP_ARG_FIRST (FP_REG_FIRST + 12)
-#define FP_ARG_LAST (FP_REG_FIRST + 15)
-
-#define MAX_ARGS_IN_REGISTERS 4
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, MODE, \
- ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
- && (! TARGET_SINGLE_FLOAT \
- || GET_MODE_SIZE (MODE) <= 4)) \
- ? FP_RETURN \
- : GP_RETURN))
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
-
-
-/* 1 if N is a possible register number for a function value.
- On the MIPS, R2 R3 and F0 F2 are the only register thus used.
- Currently, R2 and F0 are only implemented here (C has no complex type) */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_RETURN || (N) == FP_RETURN)
-
-/* 1 if N is a possible register number for function argument passing.
- We have no FP argument registers when soft-float. When FP registers
- are 32 bits, we can't directly reference the odd numbered ones. */
-
-#define FUNCTION_ARG_REGNO_P(N) \
- (((N) >= GP_ARG_FIRST && (N) <= GP_ARG_LAST) \
- || (! TARGET_SOFT_FLOAT \
- && ((N) >= FP_ARG_FIRST && (N) <= FP_ARG_LAST) \
- && (TARGET_FLOAT64 || (0 == (N) % 2))))
-
-/* A C expression which can inhibit the returning of certain function
- values in registers, based on the type of value. A nonzero value says
- to return the function value in memory, just as large structures are
- always returned. Here TYPE will be a C expression of type
- `tree', representing the data type of the value.
-
- Note that values of mode `BLKmode' must be explicitly
- handled by this macro. Also, the option `-fpcc-struct-return'
- takes effect regardless of this macro. On most systems, it is
- possible to leave the macro undefined; this causes a default
- definition to be used, whose value is the constant 1 for BLKmode
- values, and 0 otherwise.
-
- GCC normally converts 1 byte structures into chars, 2 byte
- structs into shorts, and 4 byte structs into ints, and returns
- them this way. Defining the following macro overrides this,
- to give us MIPS cc compatibility. */
-
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE (TYPE) == BLKmode)
-
-/* A code distinguishing the floating point format of the target
- machine. There are three defined values: IEEE_FLOAT_FORMAT,
- VAX_FLOAT_FORMAT, and UNKNOWN_FLOAT_FORMAT. */
-
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-*/
-
-typedef struct mips_args {
- int gp_reg_found; /* whether a gp register was found yet */
- int arg_number; /* argument number */
- int arg_words; /* # total words the arguments take */
- int fp_arg_words; /* # words for FP args (MIPS_EABI only) */
- int last_arg_fp; /* nonzero if last arg was FP (EABI only) */
- int num_adjusts; /* number of adjustments made */
- /* Adjustments made to args pass in regs. */
- /* ??? The size is doubled to work around a
- bug in the code that sets the adjustments
- in function_arg. */
- struct rtx_def *adjust[MAX_ARGS_IN_REGISTERS*2];
-} CUMULATIVE_ARGS;
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
-*/
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- init_cumulative_args (&CUM, FNTYPE, LIBNAME) \
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- function_arg_advance (&CUM, MODE, TYPE, NAMED)
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- function_arg( &CUM, MODE, TYPE, NAMED)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
- function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
-
-/* If defined, a C expression that gives the alignment boundary, in
- bits, of an argument with the specified mode and type. If it is
- not defined, `PARM_BOUNDARY' is used for all arguments. */
-
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
- (((TYPE) != 0) \
- ? ((TYPE_ALIGN(TYPE) <= PARM_BOUNDARY) \
- ? PARM_BOUNDARY \
- : TYPE_ALIGN(TYPE)) \
- : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
- ? PARM_BOUNDARY \
- : GET_MODE_ALIGNMENT(MODE)))
-
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) function_prologue(FILE, SIZE)
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) function_epilogue(FILE, SIZE)
-
-/* Define the number of delay slots needed for the function epilogue.
-
- On the mips, we need a slot if either no stack has been allocated,
- or the only register saved is the return register. */
-
-#define DELAY_SLOTS_FOR_EPILOGUE mips_epilogue_delay_slots ()
-
-/* Define whether INSN can be placed in delay slot N for the epilogue.
- No references to the stack must be made, since on the MIPS, the
- delay slot is done after the stack has been cleaned up. */
-
-#define ELIGIBLE_FOR_EPILOGUE_DELAY(INSN,N) \
- (get_attr_dslot (INSN) == DSLOT_NO \
- && get_attr_length (INSN) == 1 \
- && ! epilogue_reg_mentioned_p (PATTERN (INSN)))
-
-/* Tell prologue and epilogue if register REGNO should be saved / restored. */
-
-#define MUST_SAVE_REGISTER(regno) \
- ((regs_ever_live[regno] && !call_used_regs[regno]) \
- || (regno == FRAME_POINTER_REGNUM && frame_pointer_needed) \
- || (regno == (GP_REG_FIRST + 31) && regs_ever_live[GP_REG_FIRST + 31]))
-
-/* ALIGN FRAMES on double word boundaries */
-
-#define MIPS_STACK_ALIGN(LOC) (((LOC)+7) & ~7)
-
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ \
- fprintf (FILE, "\t.set\tnoreorder\n"); \
- fprintf (FILE, "\t.set\tnoat\n"); \
- fprintf (FILE, "\tmove\t%s,%s\t\t# save current return address\n", \
- reg_names[GP_REG_FIRST + 1], reg_names[GP_REG_FIRST + 31]); \
- fprintf (FILE, "\tjal\t_mcount\n"); \
- fprintf (FILE, \
- "\t%s\t%s,%s,%d\t\t# _mcount pops 2 words from stack\n", \
- TARGET_64BIT ? "dsubu" : "subu", \
- reg_names[STACK_POINTER_REGNUM], \
- reg_names[STACK_POINTER_REGNUM], \
- TARGET_LONG64 ? 16 : 8); \
- fprintf (FILE, "\t.set\treorder\n"); \
- fprintf (FILE, "\t.set\tat\n"); \
-}
-
-/* Define this macro if the code for function profiling should come
- before the function prologue. Normally, the profiling code comes
- after. */
-
-/* #define PROFILE_BEFORE_PROLOGUE */
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-
-/* A C statement to output, on the stream FILE, assembler code for a
- block of data that contains the constant parts of a trampoline.
- This code should not include a label--the label is taken care of
- automatically. */
-
-#define TRAMPOLINE_TEMPLATE(STREAM) \
-{ \
- fprintf (STREAM, "\t.word\t0x03e00821\t\t# move $1,$31\n"); \
- fprintf (STREAM, "\t.word\t0x04110001\t\t# bgezal $0,.+8\n"); \
- fprintf (STREAM, "\t.word\t0x00000000\t\t# nop\n"); \
- if (TARGET_LONG64) \
- { \
- fprintf (STREAM, "\t.word\t0xdfe30014\t\t# ld $3,20($31)\n"); \
- fprintf (STREAM, "\t.word\t0xdfe2001c\t\t# ld $2,28($31)\n"); \
- } \
- else \
- { \
- fprintf (STREAM, "\t.word\t0x8fe30014\t\t# lw $3,20($31)\n"); \
- fprintf (STREAM, "\t.word\t0x8fe20018\t\t# lw $2,24($31)\n"); \
- } \
- fprintf (STREAM, "\t.word\t0x0060c821\t\t# move $25,$3 (abicalls)\n"); \
- fprintf (STREAM, "\t.word\t0x00600008\t\t# jr $3\n"); \
- fprintf (STREAM, "\t.word\t0x0020f821\t\t# move $31,$1\n"); \
- if (TARGET_LONG64) \
- { \
- fprintf (STREAM, "\t.dword\t0x00000000\t\t# <function address>\n"); \
- fprintf (STREAM, "\t.dword\t0x00000000\t\t# <static chain value>\n"); \
- } \
- else \
- { \
- fprintf (STREAM, "\t.word\t0x00000000\t\t# <function address>\n"); \
- fprintf (STREAM, "\t.word\t0x00000000\t\t# <static chain value>\n"); \
- } \
-}
-
-/* A C expression for the size in bytes of the trampoline, as an
- integer. */
-
-#define TRAMPOLINE_SIZE (32 + (TARGET_LONG64 ? 16 : 8))
-
-/* Alignment required for trampolines, in bits. */
-
-#define TRAMPOLINE_ALIGNMENT (TARGET_LONG64 ? 64 : 32)
-
-/* A C statement to initialize the variable parts of a trampoline.
- ADDR is an RTX for the address of the trampoline; FNADDR is an
- RTX for the address of the nested function; STATIC_CHAIN is an
- RTX for the static chain value that should be passed to the
- function when it is called. */
-
-#define INITIALIZE_TRAMPOLINE(ADDR, FUNC, CHAIN) \
-{ \
- rtx addr = ADDR; \
- if (TARGET_LONG64) \
- { \
- emit_move_insn (gen_rtx (MEM, DImode, plus_constant (addr, 32)), FUNC); \
- emit_move_insn (gen_rtx (MEM, DImode, plus_constant (addr, 40)), CHAIN);\
- } \
- else \
- { \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (addr, 32)), FUNC); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (addr, 36)), CHAIN);\
- } \
- \
- /* Flush both caches. We need to flush the data cache in case \
- the system has a write-back cache. */ \
- /* ??? Should check the return value for errors. */ \
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "_flush_cache"), \
- 0, VOIDmode, 3, addr, Pmode, \
- GEN_INT (TRAMPOLINE_SIZE), TYPE_MODE (integer_type_node),\
- GEN_INT (3), TYPE_MODE (integer_type_node)); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- These definitions are NOT overridden anywhere. */
-
-#define GP_REG_OR_PSEUDO_STRICT_P(regno) \
- GP_REG_P((regno < FIRST_PSEUDO_REGISTER) ? regno : reg_renumber[regno])
-
-#define GP_REG_OR_PSEUDO_NONSTRICT_P(regno) \
- (((regno) >= FIRST_PSEUDO_REGISTER) || (GP_REG_P (regno)))
-
-#define REGNO_OK_FOR_INDEX_P(regno) 0
-#define REGNO_OK_FOR_BASE_P(regno) GP_REG_OR_PSEUDO_STRICT_P (regno)
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects them all.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Some source files that are used after register allocation
- need to be strict. */
-
-#ifndef REG_OK_STRICT
-
-#define REG_OK_STRICT_P 0
-#define REG_OK_FOR_INDEX_P(X) 0
-#define REG_OK_FOR_BASE_P(X) GP_REG_OR_PSEUDO_NONSTRICT_P (REGNO (X))
-
-#else
-
-#define REG_OK_STRICT_P 1
-#define REG_OK_FOR_INDEX_P(X) 0
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 1
-
-/* A C compound statement with a conditional `goto LABEL;' executed
- if X (an RTX) is a legitimate memory address on the target
- machine for a memory operand of mode MODE.
-
- It usually pays to define several simpler macros to serve as
- subroutines for this one. Otherwise it may be too complicated
- to understand.
-
- This macro must exist in two variants: a strict variant and a
- non-strict one. The strict variant is used in the reload pass.
- It must be defined so that any pseudo-register that has not been
- allocated a hard register is considered a memory reference. In
- contexts where some kind of register is required, a
- pseudo-register with no hard register must be rejected.
-
- The non-strict variant is used in other passes. It must be
- defined to accept all pseudo-registers in every context where
- some kind of register is required.
-
- Compiler source files that want to use the strict variant of
- this macro define the macro `REG_OK_STRICT'. You should use an
- `#ifdef REG_OK_STRICT' conditional to define the strict variant
- in that case and the non-strict variant otherwise.
-
- Typically among the subroutines used to define
- `GO_IF_LEGITIMATE_ADDRESS' are subroutines to check for
- acceptable registers for various purposes (one for base
- registers, one for index registers, and so on). Then only these
- subroutine macros need have two variants; the higher levels of
- macros may be the same whether strict or not.
-
- Normally, constant addresses which are the sum of a `symbol_ref'
- and an integer are stored inside a `const' RTX to mark them as
- constant. Therefore, there is no need to recognize such sums
- specifically as legitimate addresses. Normally you would simply
- recognize any `const' as legitimate.
-
- Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle
- constant sums that are not marked with `const'. It assumes
- that a naked `plus' indicates indexing. If so, then you *must*
- reject such naked constant sums as illegitimate addresses, so
- that none of them will be given to `PRINT_OPERAND_ADDRESS'.
-
- On some machines, whether a symbolic address is legitimate
- depends on the section that the address refers to. On these
- machines, define the macro `ENCODE_SECTION_INFO' to store the
- information into the `symbol_ref', and then check for it here.
- When you see a `const', you will have to look inside it to find
- the `symbol_ref' in order to determine the section. */
-
-#if 1
-#define GO_PRINTF(x) trace(x)
-#define GO_PRINTF2(x,y) trace(x,y)
-#define GO_DEBUG_RTX(x) debug_rtx(x)
-
-#else
-#define GO_PRINTF(x)
-#define GO_PRINTF2(x,y)
-#define GO_DEBUG_RTX(x)
-#endif
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ \
- register rtx xinsn = (X); \
- \
- if (TARGET_DEBUG_B_MODE) \
- { \
- GO_PRINTF2 ("\n========== GO_IF_LEGITIMATE_ADDRESS, %sstrict\n", \
- (REG_OK_STRICT_P) ? "" : "not "); \
- GO_DEBUG_RTX (xinsn); \
- } \
- \
- if (GET_CODE (xinsn) == REG && REG_OK_FOR_BASE_P (xinsn)) \
- goto ADDR; \
- \
- if (CONSTANT_ADDRESS_P (xinsn) \
- && ! (mips_split_addresses && mips_check_split (xinsn, MODE))) \
- goto ADDR; \
- \
- if (GET_CODE (xinsn) == LO_SUM && mips_split_addresses) \
- { \
- register rtx xlow0 = XEXP (xinsn, 0); \
- register rtx xlow1 = XEXP (xinsn, 1); \
- \
- if (GET_CODE (xlow0) == REG && REG_OK_FOR_BASE_P (xlow0) \
- && mips_check_split (xlow1, MODE)) \
- goto ADDR; \
- } \
- \
- if (GET_CODE (xinsn) == PLUS) \
- { \
- register rtx xplus0 = XEXP (xinsn, 0); \
- register rtx xplus1 = XEXP (xinsn, 1); \
- register enum rtx_code code0 = GET_CODE (xplus0); \
- register enum rtx_code code1 = GET_CODE (xplus1); \
- \
- if (code0 != REG && code1 == REG) \
- { \
- xplus0 = XEXP (xinsn, 1); \
- xplus1 = XEXP (xinsn, 0); \
- code0 = GET_CODE (xplus0); \
- code1 = GET_CODE (xplus1); \
- } \
- \
- if (code0 == REG && REG_OK_FOR_BASE_P (xplus0)) \
- { \
- if (code1 == CONST_INT \
- && INTVAL (xplus1) >= -32768 \
- && INTVAL (xplus1) + GET_MODE_SIZE (MODE) - 1 <= 32767) \
- goto ADDR; \
- \
- /* For some code sequences, you actually get better code by \
- pretending that the MIPS supports an address mode of a \
- constant address + a register, even though the real \
- machine doesn't support it. This is because the \
- assembler can use $r1 to load just the high 16 bits, add \
- in the register, and fold the low 16 bits into the memory \
- reference, whereas the compiler generates a 4 instruction \
- sequence. On the other hand, CSE is not as effective. \
- It would be a win to generate the lui directly, but the \
- MIPS assembler does not have syntax to generate the \
- appropriate relocation. */ \
- \
- /* Also accept CONST_INT addresses here, so no else. */ \
- /* Reject combining an embedded PIC text segment reference \
- with a register. That requires an additional \
- instruction. */ \
- /* ??? Reject combining an address with a register for the MIPS \
- 64 bit ABI, because the SGI assembler can not handle this. */ \
- if (!TARGET_DEBUG_A_MODE \
- && (mips_abi == ABI_32 || mips_abi == ABI_EABI) \
- && CONSTANT_ADDRESS_P (xplus1) \
- && ! mips_split_addresses \
- && (!TARGET_EMBEDDED_PIC \
- || code1 != CONST \
- || GET_CODE (XEXP (xplus1, 0)) != MINUS)) \
- goto ADDR; \
- } \
- } \
- \
- if (TARGET_DEBUG_B_MODE) \
- GO_PRINTF ("Not a legitimate address\n"); \
-}
-
-
-/* A C expression that is 1 if the RTX X is a constant which is a
- valid address. This is defined to be the same as `CONSTANT_P (X)',
- but rejecting CONST_DOUBLE. */
-/* When pic, we must reject addresses of the form symbol+large int.
- This is because an instruction `sw $4,s+70000' needs to be converted
- by the assembler to `lw $at,s($gp);sw $4,70000($at)'. Normally the
- assembler would use $at as a temp to load in the large offset. In this
- case $at is already in use. We convert such problem addresses to
- `la $5,s;sw $4,70000($5)' via LEGITIMIZE_ADDRESS. */
-/* ??? SGI Irix 6 assembler fails for CONST address, so reject them. */
-#define CONSTANT_ADDRESS_P(X) \
- ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \
- || (GET_CODE (X) == CONST \
- && ! (flag_pic && pic_address_needs_scratch (X)) \
- && (mips_abi == ABI_32 || mips_abi == ABI_EABI))) \
- && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X)))
-
-/* Define this, so that when PIC, reload won't try to reload invalid
- addresses which require two reload registers. */
-
-#define LEGITIMATE_PIC_OPERAND_P(X) (! pic_address_needs_scratch (X))
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
-
- At present, GAS doesn't understand li.[sd], so don't allow it
- to be generated at present. Also, the MIPS assembler does not
- grok li.d Infinity. */
-
-/* ??? SGI Irix 6 assembler fails for CONST address, so reject them. */
-#define LEGITIMATE_CONSTANT_P(X) \
- ((GET_CODE (X) != CONST_DOUBLE \
- || mips_const_double_ok (X, GET_MODE (X))) \
- && ! (GET_CODE (X) == CONST \
- && mips_abi != ABI_32 && mips_abi != ABI_EABI))
-
-/* A C compound statement that attempts to replace X with a valid
- memory address for an operand of mode MODE. WIN will be a C
- statement label elsewhere in the code; the macro definition may
- use
-
- GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
-
- to avoid further processing if the address has become legitimate.
-
- X will always be the result of a call to `break_out_memory_refs',
- and OLDX will be the operand that was given to that function to
- produce X.
-
- The code generated by this macro should not alter the
- substructure of X. If it transforms X into a more legitimate
- form, it should assign X (which will always be a C variable) a
- new value.
-
- It is not necessary for this macro to come up with a legitimate
- address. The compiler has standard ways of doing so in all
- cases. In fact, it is safe for this macro to do nothing. But
- often a machine-dependent strategy can generate better code.
-
- For the MIPS, transform:
-
- memory(X + <large int>)
-
- into:
-
- Y = <large int> & ~0x7fff;
- Z = X + Y
- memory (Z + (<large int> & 0x7fff));
-
- This is for CSE to find several similar references, and only use one Z.
-
- When PIC, convert addresses of the form memory (symbol+large int) to
- memory (reg+large int). */
-
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ \
- register rtx xinsn = (X); \
- \
- if (TARGET_DEBUG_B_MODE) \
- { \
- GO_PRINTF ("\n========== LEGITIMIZE_ADDRESS\n"); \
- GO_DEBUG_RTX (xinsn); \
- } \
- \
- if (mips_split_addresses && mips_check_split (X, MODE)) \
- { \
- /* ??? Is this ever executed? */ \
- X = gen_rtx (LO_SUM, Pmode, \
- copy_to_mode_reg (Pmode, gen_rtx (HIGH, Pmode, X)), X); \
- goto WIN; \
- } \
- \
- if (GET_CODE (xinsn) == CONST \
- && ((flag_pic && pic_address_needs_scratch (xinsn)) \
- /* ??? SGI's Irix 6 assembler can't handle CONST. */ \
- || (mips_abi != ABI_32 && mips_abi != ABI_EABI))) \
- { \
- rtx ptr_reg = gen_reg_rtx (Pmode); \
- rtx constant = XEXP (XEXP (xinsn, 0), 1); \
- \
- emit_move_insn (ptr_reg, XEXP (XEXP (xinsn, 0), 0)); \
- \
- X = gen_rtx (PLUS, Pmode, ptr_reg, constant); \
- if (SMALL_INT (constant)) \
- goto WIN; \
- /* Otherwise we fall through so the code below will fix the \
- constant. */ \
- xinsn = X; \
- } \
- \
- if (GET_CODE (xinsn) == PLUS) \
- { \
- register rtx xplus0 = XEXP (xinsn, 0); \
- register rtx xplus1 = XEXP (xinsn, 1); \
- register enum rtx_code code0 = GET_CODE (xplus0); \
- register enum rtx_code code1 = GET_CODE (xplus1); \
- \
- if (code0 != REG && code1 == REG) \
- { \
- xplus0 = XEXP (xinsn, 1); \
- xplus1 = XEXP (xinsn, 0); \
- code0 = GET_CODE (xplus0); \
- code1 = GET_CODE (xplus1); \
- } \
- \
- if (code0 == REG && REG_OK_FOR_BASE_P (xplus0) \
- && code1 == CONST_INT && !SMALL_INT (xplus1)) \
- { \
- rtx int_reg = gen_reg_rtx (Pmode); \
- rtx ptr_reg = gen_reg_rtx (Pmode); \
- \
- emit_move_insn (int_reg, \
- GEN_INT (INTVAL (xplus1) & ~ 0x7fff)); \
- \
- emit_insn (gen_rtx (SET, VOIDmode, \
- ptr_reg, \
- gen_rtx (PLUS, Pmode, xplus0, int_reg))); \
- \
- X = gen_rtx (PLUS, Pmode, ptr_reg, \
- GEN_INT (INTVAL (xplus1) & 0x7fff)); \
- goto WIN; \
- } \
- } \
- \
- if (TARGET_DEBUG_B_MODE) \
- GO_PRINTF ("LEGITIMIZE_ADDRESS could not fix.\n"); \
-}
-
-
-/* A C statement or compound statement with a conditional `goto
- LABEL;' executed if memory address X (an RTX) can have different
- meanings depending on the machine mode of the memory reference it
- is used for.
-
- Autoincrement and autodecrement addresses typically have
- mode-dependent effects because the amount of the increment or
- decrement is the size of the operand being addressed. Some
- machines have other mode-dependent addresses. Many RISC machines
- have no mode-dependent addresses.
-
- You may assume that ADDR is a valid address for the machine. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
-
-
-/* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- The macro definition, if any, is executed immediately after the
- rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
- The value of the rtl will be a `mem' whose address is a
- `symbol_ref'.
-
- The usual thing for this macro to do is to a flag in the
- `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
- name string in the `symbol_ref' (if one bit is not enough
- information).
-
- The best way to modify the name string is by adding text to the
- beginning, with suitable punctuation to prevent any ambiguity.
- Allocate the new name in `saveable_obstack'. You will have to
- modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
- and output the name accordingly.
-
- You can also check the information stored in the `symbol_ref' in
- the definition of `GO_IF_LEGITIMATE_ADDRESS' or
- `PRINT_OPERAND_ADDRESS'. */
-
-#define ENCODE_SECTION_INFO(DECL) \
-do \
- { \
- if (TARGET_EMBEDDED_PIC) \
- { \
- if (TREE_CODE (DECL) == VAR_DECL) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
- else if (TREE_CODE (DECL) == FUNCTION_DECL) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 0; \
- else if (TREE_CODE (DECL) == STRING_CST \
- && ! flag_writable_strings) \
- SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 0; \
- else \
- SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1; \
- } \
- \
- else if (TARGET_GP_OPT && TREE_CODE (DECL) == VAR_DECL) \
- { \
- int size = int_size_in_bytes (TREE_TYPE (DECL)); \
- \
- if (size > 0 && size <= mips_section_threshold) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
- } \
- \
- else if (HALF_PIC_P ()) \
- HALF_PIC_ENCODE (DECL); \
- } \
-while (0)
-
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE (TARGET_LONG64 ? DImode : SImode)
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#ifndef DEFAULT_SIGNED_CHAR
-#define DEFAULT_SIGNED_CHAR 1
-#endif
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX (TARGET_64BIT ? 8 : 4)
-#define MAX_MOVE_MAX 8
-
-/* Define this macro as a C expression which is nonzero if
- accessing less than a word of memory (i.e. a `char' or a
- `short') is no faster than accessing a word of memory, i.e., if
- such access require more than one instruction or if there is no
- difference in cost between byte and (aligned) word loads.
-
- On RISC machines, it tends to generate better code to define
- this as 1, since it avoids making a QI or HI mode register. */
-#define SLOW_BYTE_ACCESS 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE 1
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-#define SLOW_ZERO_EXTEND
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-/* In 64 bit mode, 32 bit instructions require that register values be properly
- sign-extended to 64 bits. As a result, a truncate is not a no-op if it
- converts a value >32 bits to a value <32 bits. */
-/* ??? This results in inefficient code for 64 bit to 32 conversions.
- Something needs to be done about this. Perhaps not use any 32 bit
- instructions? Perhaps use PROMOTE_MODE? */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) \
- (TARGET_64BIT ? ((INPREC) <= 32 || (OUTPREC) > 32) : 1)
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-
-#define Pmode (TARGET_LONG64 ? DImode : SImode)
-
-/* A function address in a call instruction
- is a word address (for indexing purposes)
- so give the MEM rtx a words's mode. */
-
-#define FUNCTION_MODE (TARGET_LONG64 ? DImode : SImode)
-
-/* Define TARGET_MEM_FUNCTIONS if we want to use calls to memcpy and
- memset, instead of the BSD functions bcopy and bzero. */
-
-#if defined(MIPS_SYSV) || defined(OSF_OS)
-#define TARGET_MEM_FUNCTIONS
-#endif
-
-
-/* A part of a C `switch' statement that describes the relative
- costs of constant RTL expressions. It must contain `case'
- labels for expression codes `const_int', `const', `symbol_ref',
- `label_ref' and `const_double'. Each case must ultimately reach
- a `return' statement to return the relative cost of the use of
- that kind of constant value in an expression. The cost may
- depend on the precise value of the constant, which is available
- for examination in X.
-
- CODE is the expression code--redundant, since it can be obtained
- with `GET_CODE (X)'. */
-
-#define CONST_COSTS(X,CODE,OUTER_CODE) \
- case CONST_INT: \
- /* Always return 0, since we don't have different sized \
- instructions, hence different costs according to Richard \
- Kenner */ \
- return 0; \
- \
- case LABEL_REF: \
- return COSTS_N_INSNS (2); \
- \
- case CONST: \
- { \
- rtx offset = const0_rtx; \
- rtx symref = eliminate_constant_term (XEXP (X, 0), &offset); \
- \
- if (GET_CODE (symref) == LABEL_REF) \
- return COSTS_N_INSNS (2); \
- \
- if (GET_CODE (symref) != SYMBOL_REF) \
- return COSTS_N_INSNS (4); \
- \
- /* let's be paranoid.... */ \
- if (INTVAL (offset) < -32768 || INTVAL (offset) > 32767) \
- return COSTS_N_INSNS (2); \
- \
- return COSTS_N_INSNS (SYMBOL_REF_FLAG (symref) ? 1 : 2); \
- } \
- \
- case SYMBOL_REF: \
- return COSTS_N_INSNS (SYMBOL_REF_FLAG (X) ? 1 : 2); \
- \
- case CONST_DOUBLE: \
- { \
- rtx high, low; \
- split_double (X, &high, &low); \
- return COSTS_N_INSNS ((high == CONST0_RTX (GET_MODE (high)) \
- || low == CONST0_RTX (GET_MODE (low))) \
- ? 2 : 4); \
- }
-
-/* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
- This can be used, for example, to indicate how costly a multiply
- instruction is. In writing this macro, you can use the construct
- `COSTS_N_INSNS (N)' to specify a cost equal to N fast instructions.
-
- This macro is optional; do not define it if the default cost
- assumptions are adequate for the target machine.
-
- If -mdebugd is used, change the multiply cost to 2, so multiply by
- a constant isn't converted to a series of shifts. This helps
- strength reduction, and also makes it easier to identify what the
- compiler is doing. */
-
-/* ??? Fix this to be right for the R8000. */
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MEM: \
- { \
- int num_words = (GET_MODE_SIZE (GET_MODE (X)) > UNITS_PER_WORD) ? 2 : 1; \
- if (simple_memory_operand (X, GET_MODE (X))) \
- return COSTS_N_INSNS (num_words); \
- \
- return COSTS_N_INSNS (2*num_words); \
- } \
- \
- case FFS: \
- return COSTS_N_INSNS (6); \
- \
- case NOT: \
- return COSTS_N_INSNS ((GET_MODE (X) == DImode && !TARGET_64BIT) ? 2 : 1); \
- \
- case AND: \
- case IOR: \
- case XOR: \
- if (GET_MODE (X) == DImode && !TARGET_64BIT) \
- return COSTS_N_INSNS (2); \
- \
- return COSTS_N_INSNS (1); \
- \
- case ASHIFT: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- if (GET_MODE (X) == DImode && !TARGET_64BIT) \
- return COSTS_N_INSNS ((GET_CODE (XEXP (X, 1)) == CONST_INT) ? 4 : 12); \
- \
- return COSTS_N_INSNS (1); \
- \
- case ABS: \
- { \
- enum machine_mode xmode = GET_MODE (X); \
- if (xmode == SFmode || xmode == DFmode) \
- return COSTS_N_INSNS (1); \
- \
- return COSTS_N_INSNS (4); \
- } \
- \
- case PLUS: \
- case MINUS: \
- { \
- enum machine_mode xmode = GET_MODE (X); \
- if (xmode == SFmode || xmode == DFmode) \
- { \
- if (mips_cpu == PROCESSOR_R3000) \
- return COSTS_N_INSNS (2); \
- else if (mips_cpu == PROCESSOR_R6000) \
- return COSTS_N_INSNS (3); \
- else \
- return COSTS_N_INSNS (6); \
- } \
- \
- if (xmode == DImode && !TARGET_64BIT) \
- return COSTS_N_INSNS (4); \
- \
- return COSTS_N_INSNS (1); \
- } \
- \
- case NEG: \
- return COSTS_N_INSNS ((GET_MODE (X) == DImode && !TARGET_64BIT) ? 4 : 1); \
- \
- case MULT: \
- { \
- enum machine_mode xmode = GET_MODE (X); \
- if (xmode == SFmode) \
- { \
- if (mips_cpu == PROCESSOR_R3000 \
- || mips_cpu == PROCESSOR_R5000) \
- return COSTS_N_INSNS (4); \
- else if (mips_cpu == PROCESSOR_R6000) \
- return COSTS_N_INSNS (5); \
- else \
- return COSTS_N_INSNS (7); \
- } \
- \
- if (xmode == DFmode) \
- { \
- if (mips_cpu == PROCESSOR_R3000 \
- || mips_cpu == PROCESSOR_R5000) \
- return COSTS_N_INSNS (5); \
- else if (mips_cpu == PROCESSOR_R6000) \
- return COSTS_N_INSNS (6); \
- else \
- return COSTS_N_INSNS (8); \
- } \
- \
- if (mips_cpu == PROCESSOR_R3000) \
- return COSTS_N_INSNS (12); \
- else if (mips_cpu == PROCESSOR_R6000) \
- return COSTS_N_INSNS (17); \
- else if (mips_cpu == PROCESSOR_R5000) \
- return COSTS_N_INSNS (5); \
- else \
- return COSTS_N_INSNS (10); \
- } \
- \
- case DIV: \
- case MOD: \
- { \
- enum machine_mode xmode = GET_MODE (X); \
- if (xmode == SFmode) \
- { \
- if (mips_cpu == PROCESSOR_R3000) \
- return COSTS_N_INSNS (12); \
- else if (mips_cpu == PROCESSOR_R6000) \
- return COSTS_N_INSNS (15); \
- else \
- return COSTS_N_INSNS (23); \
- } \
- \
- if (xmode == DFmode) \
- { \
- if (mips_cpu == PROCESSOR_R3000) \
- return COSTS_N_INSNS (19); \
- else if (mips_cpu == PROCESSOR_R6000) \
- return COSTS_N_INSNS (16); \
- else \
- return COSTS_N_INSNS (36); \
- } \
- } \
- /* fall through */ \
- \
- case UDIV: \
- case UMOD: \
- if (mips_cpu == PROCESSOR_R3000) \
- return COSTS_N_INSNS (35); \
- else if (mips_cpu == PROCESSOR_R6000) \
- return COSTS_N_INSNS (38); \
- else if (mips_cpu == PROCESSOR_R5000) \
- return COSTS_N_INSNS (36); \
- else \
- return COSTS_N_INSNS (69); \
- \
- case SIGN_EXTEND: \
- /* A sign extend from SImode to DImode in 64 bit mode is often \
- zero instructions, because the result can often be used \
- directly by another instruction; we'll call it one. */ \
- if (TARGET_64BIT && GET_MODE (X) == DImode \
- && GET_MODE (XEXP (X, 0)) == SImode) \
- return COSTS_N_INSNS (1); \
- else \
- return COSTS_N_INSNS (2); \
- \
- case ZERO_EXTEND: \
- if (TARGET_64BIT && GET_MODE (X) == DImode \
- && GET_MODE (XEXP (X, 0)) == SImode) \
- return COSTS_N_INSNS (2); \
- else \
- return COSTS_N_INSNS (1);
-
-/* An expression giving the cost of an addressing mode that
- contains ADDRESS. If not defined, the cost is computed from the
- form of the ADDRESS expression and the `CONST_COSTS' values.
-
- For most CISC machines, the default cost is a good approximation
- of the true cost of the addressing mode. However, on RISC
- machines, all instructions normally have the same length and
- execution time. Hence all addresses will have equal costs.
-
- In cases where more than one form of an address is known, the
- form with the lowest cost will be used. If multiple forms have
- the same, lowest, cost, the one that is the most complex will be
- used.
-
- For example, suppose an address that is equal to the sum of a
- register and a constant is used twice in the same basic block.
- When this macro is not defined, the address will be computed in
- a register and memory references will be indirect through that
- register. On machines where the cost of the addressing mode
- containing the sum is no higher than that of a simple indirect
- reference, this will produce an additional instruction and
- possibly require an additional register. Proper specification
- of this macro eliminates this overhead for such machines.
-
- Similar use of this macro is made in strength reduction of loops.
-
- ADDRESS need not be valid as an address. In such a case, the
- cost is not relevant and can be any value; invalid addresses
- need not be assigned a different cost.
-
- On machines where an address involving more than one register is
- as cheap as an address computation involving only one register,
- defining `ADDRESS_COST' to reflect this can cause two registers
- to be live over a region of code where only one would have been
- if `ADDRESS_COST' were not defined in that manner. This effect
- should be considered in the definition of this macro.
- Equivalent costs should probably only be given to addresses with
- different numbers of registers on machines with lots of registers.
-
- This macro will normally either not be defined or be defined as
- a constant. */
-
-#define ADDRESS_COST(ADDR) (REG_P (ADDR) ? 1 : mips_address_cost (ADDR))
-
-/* A C expression for the cost of moving data from a register in
- class FROM to one in class TO. The classes are expressed using
- the enumeration values such as `GENERAL_REGS'. A value of 2 is
- the default; other values are interpreted relative to that.
-
- It is not required that the cost always equal 2 when FROM is the
- same as TO; on some machines it is expensive to move between
- registers if they are not general registers.
-
- If reload sees an insn consisting of a single `set' between two
- hard registers, and if `REGISTER_MOVE_COST' applied to their
- classes returns a value of 2, reload does not check to ensure
- that the constraints of the insn are met. Setting a cost of
- other than 2 will allow reload to verify that the constraints are
- met. You should do this if the `movM' pattern's constraints do
- not allow such copying. */
-
-#define REGISTER_MOVE_COST(FROM, TO) \
- ((FROM) == GR_REGS && (TO) == GR_REGS ? 2 \
- : (FROM) == FP_REGS && (TO) == FP_REGS ? 2 \
- : (FROM) == GR_REGS && (TO) == FP_REGS ? 4 \
- : (FROM) == FP_REGS && (TO) == GR_REGS ? 4 \
- : (((FROM) == HI_REG || (FROM) == LO_REG \
- || (FROM) == MD_REGS || (FROM) == HILO_REG) \
- && (TO) == GR_REGS) ? 6 \
- : (((TO) == HI_REG || (TO) == LO_REG \
- || (TO) == MD_REGS || (FROM) == HILO_REG) \
- && (FROM) == GR_REGS) ? 6 \
- : (FROM) == ST_REGS && (TO) == GR_REGS ? 4 \
- : (FROM) == FP_REGS && (TO) == ST_REGS ? 8 \
- : 12)
-
-/* ??? Fix this to be right for the R8000. */
-#define MEMORY_MOVE_COST(MODE) \
- ((mips_cpu == PROCESSOR_R4000 || mips_cpu == PROCESSOR_R6000) ? 6 : 4)
-
-/* A C expression for the cost of a branch instruction. A value of
- 1 is the default; other values are interpreted relative to that. */
-
-/* ??? Fix this to be right for the R8000. */
-#define BRANCH_COST \
- ((mips_cpu == PROCESSOR_R4000 || mips_cpu == PROCESSOR_R6000) ? 2 : 1)
-
-/* A C statement (sans semicolon) to update the integer variable COST
- based on the relationship between INSN that is dependent on
- DEP_INSN through the dependence LINK. The default is to make no
- adjustment to COST. On the MIPS, ignore the cost of anti- and
- output-dependencies. */
-
-#define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \
- if (REG_NOTE_KIND (LINK) != 0) \
- (COST) = 0; /* Anti or output dependence. */
-
-/* Optionally define this if you have added predicates to
- `MACHINE.c'. This macro is called within an initializer of an
- array of structures. The first field in the structure is the
- name of a predicate and the second field is an array of rtl
- codes. For each predicate, list all rtl codes that can be in
- expressions matched by the predicate. The list should have a
- trailing comma. Here is an example of two entries in the list
- for a typical RISC machine:
-
- #define PREDICATE_CODES \
- {"gen_reg_rtx_operand", {SUBREG, REG}}, \
- {"reg_or_short_cint_operand", {SUBREG, REG, CONST_INT}},
-
- Defining this macro does not affect the generated code (however,
- incorrect definitions that omit an rtl code that may be matched
- by the predicate can cause the compiler to malfunction).
- Instead, it allows the table built by `genrecog' to be more
- compact and efficient, thus speeding up the compiler. The most
- important predicates to include in the list specified by this
- macro are thoses used in the most insn patterns. */
-
-#define PREDICATE_CODES \
- {"uns_arith_operand", { REG, CONST_INT, SUBREG }}, \
- {"arith_operand", { REG, CONST_INT, SUBREG }}, \
- {"arith32_operand", { REG, CONST_INT, SUBREG }}, \
- {"reg_or_0_operand", { REG, CONST_INT, SUBREG }}, \
- {"small_int", { CONST_INT }}, \
- {"large_int", { CONST_INT }}, \
- {"mips_const_double_ok", { CONST_DOUBLE }}, \
- {"const_float_1_operand", { CONST_DOUBLE }}, \
- {"simple_memory_operand", { MEM, SUBREG }}, \
- {"equality_op", { EQ, NE }}, \
- {"cmp_op", { EQ, NE, GT, GE, GTU, GEU, LT, LE, \
- LTU, LEU }}, \
- {"pc_or_label_operand", { PC, LABEL_REF }}, \
- {"call_insn_operand", { CONST_INT, CONST, SYMBOL_REF, REG}}, \
- {"move_operand", { CONST_INT, CONST_DOUBLE, CONST, \
- SYMBOL_REF, LABEL_REF, SUBREG, \
- REG, MEM}}, \
- {"movdi_operand", { CONST_INT, CONST_DOUBLE, CONST, \
- SYMBOL_REF, LABEL_REF, SUBREG, REG, \
- MEM, SIGN_EXTEND }}, \
- {"se_register_operand", { SUBREG, REG, SIGN_EXTEND }}, \
- {"se_reg_or_0_operand", { REG, CONST_INT, SUBREG, \
- SIGN_EXTEND }}, \
- {"se_uns_arith_operand", { REG, CONST_INT, SUBREG, \
- SIGN_EXTEND }}, \
- {"se_arith_operand", { REG, CONST_INT, SUBREG, \
- SIGN_EXTEND }}, \
- {"se_nonmemory_operand", { CONST_INT, CONST_DOUBLE, CONST, \
- SYMBOL_REF, LABEL_REF, SUBREG, \
- REG, SIGN_EXTEND }}, \
- {"se_nonimmediate_operand", { SUBREG, REG, MEM, SIGN_EXTEND }},
-
-
-/* If defined, a C statement to be executed just prior to the
- output of assembler code for INSN, to modify the extracted
- operands so they will be output differently.
-
- Here the argument OPVEC is the vector containing the operands
- extracted from INSN, and NOPERANDS is the number of elements of
- the vector which contain meaningful data for this insn. The
- contents of this vector are what will be used to convert the
- insn template into assembler code, so you can change the
- assembler output by changing the contents of the vector.
-
- We use it to check if the current insn needs a nop in front of it
- because of load delays, and also to update the delay slot
- statistics. */
-
-#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
- final_prescan_insn (INSN, OPVEC, NOPERANDS)
-
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file.
- If we are optimizing to use the global pointer, create a temporary
- file to hold all of the text stuff, and write it out to the end.
- This is needed because the MIPS assembler is evidently one pass,
- and if it hasn't seen the relevant .comm/.lcomm/.extern/.sdata
- declaration when the code is processed, it generates a two
- instruction sequence. */
-
-#define ASM_FILE_START(STREAM) mips_asm_file_start (STREAM)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON " #APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF " #NO_APP\n"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above).
-
- In order to support the two different conventions for register names,
- we use the name of a table set up in mips.c, which is overwritten
- if -mrnames is used. */
-
-#define REGISTER_NAMES \
-{ \
- &mips_reg_names[ 0][0], \
- &mips_reg_names[ 1][0], \
- &mips_reg_names[ 2][0], \
- &mips_reg_names[ 3][0], \
- &mips_reg_names[ 4][0], \
- &mips_reg_names[ 5][0], \
- &mips_reg_names[ 6][0], \
- &mips_reg_names[ 7][0], \
- &mips_reg_names[ 8][0], \
- &mips_reg_names[ 9][0], \
- &mips_reg_names[10][0], \
- &mips_reg_names[11][0], \
- &mips_reg_names[12][0], \
- &mips_reg_names[13][0], \
- &mips_reg_names[14][0], \
- &mips_reg_names[15][0], \
- &mips_reg_names[16][0], \
- &mips_reg_names[17][0], \
- &mips_reg_names[18][0], \
- &mips_reg_names[19][0], \
- &mips_reg_names[20][0], \
- &mips_reg_names[21][0], \
- &mips_reg_names[22][0], \
- &mips_reg_names[23][0], \
- &mips_reg_names[24][0], \
- &mips_reg_names[25][0], \
- &mips_reg_names[26][0], \
- &mips_reg_names[27][0], \
- &mips_reg_names[28][0], \
- &mips_reg_names[29][0], \
- &mips_reg_names[30][0], \
- &mips_reg_names[31][0], \
- &mips_reg_names[32][0], \
- &mips_reg_names[33][0], \
- &mips_reg_names[34][0], \
- &mips_reg_names[35][0], \
- &mips_reg_names[36][0], \
- &mips_reg_names[37][0], \
- &mips_reg_names[38][0], \
- &mips_reg_names[39][0], \
- &mips_reg_names[40][0], \
- &mips_reg_names[41][0], \
- &mips_reg_names[42][0], \
- &mips_reg_names[43][0], \
- &mips_reg_names[44][0], \
- &mips_reg_names[45][0], \
- &mips_reg_names[46][0], \
- &mips_reg_names[47][0], \
- &mips_reg_names[48][0], \
- &mips_reg_names[49][0], \
- &mips_reg_names[50][0], \
- &mips_reg_names[51][0], \
- &mips_reg_names[52][0], \
- &mips_reg_names[53][0], \
- &mips_reg_names[54][0], \
- &mips_reg_names[55][0], \
- &mips_reg_names[56][0], \
- &mips_reg_names[57][0], \
- &mips_reg_names[58][0], \
- &mips_reg_names[59][0], \
- &mips_reg_names[60][0], \
- &mips_reg_names[61][0], \
- &mips_reg_names[62][0], \
- &mips_reg_names[63][0], \
- &mips_reg_names[64][0], \
- &mips_reg_names[65][0], \
- &mips_reg_names[66][0], \
- &mips_reg_names[67][0], \
- &mips_reg_names[68][0], \
- &mips_reg_names[69][0], \
- &mips_reg_names[70][0], \
- &mips_reg_names[71][0], \
- &mips_reg_names[72][0], \
- &mips_reg_names[73][0], \
- &mips_reg_names[74][0], \
- &mips_reg_names[75][0], \
-}
-
-/* print-rtl.c can't use REGISTER_NAMES, since it depends on mips.c.
- So define this for it. */
-#define DEBUG_REGISTER_NAMES \
-{ \
- "$0", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
- "t8", "t9", "k0", "k1", "gp", "sp", "$fp", "ra", \
- "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", \
- "$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", \
- "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23", \
- "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31", \
- "hi", "lo", "accum","$fcc0","$fcc1","$fcc2","$fcc3","$fcc4", \
- "$fcc5","$fcc6","$fcc7","$rap" \
-}
-
-/* If defined, a C initializer for an array of structures
- containing a name and a register number. This macro defines
- additional names for hard registers, thus allowing the `asm'
- option in declarations to refer to registers using alternate
- names.
-
- We define both names for the integer registers here. */
-
-#define ADDITIONAL_REGISTER_NAMES \
-{ \
- { "$0", 0 + GP_REG_FIRST }, \
- { "$1", 1 + GP_REG_FIRST }, \
- { "$2", 2 + GP_REG_FIRST }, \
- { "$3", 3 + GP_REG_FIRST }, \
- { "$4", 4 + GP_REG_FIRST }, \
- { "$5", 5 + GP_REG_FIRST }, \
- { "$6", 6 + GP_REG_FIRST }, \
- { "$7", 7 + GP_REG_FIRST }, \
- { "$8", 8 + GP_REG_FIRST }, \
- { "$9", 9 + GP_REG_FIRST }, \
- { "$10", 10 + GP_REG_FIRST }, \
- { "$11", 11 + GP_REG_FIRST }, \
- { "$12", 12 + GP_REG_FIRST }, \
- { "$13", 13 + GP_REG_FIRST }, \
- { "$14", 14 + GP_REG_FIRST }, \
- { "$15", 15 + GP_REG_FIRST }, \
- { "$16", 16 + GP_REG_FIRST }, \
- { "$17", 17 + GP_REG_FIRST }, \
- { "$18", 18 + GP_REG_FIRST }, \
- { "$19", 19 + GP_REG_FIRST }, \
- { "$20", 20 + GP_REG_FIRST }, \
- { "$21", 21 + GP_REG_FIRST }, \
- { "$22", 22 + GP_REG_FIRST }, \
- { "$23", 23 + GP_REG_FIRST }, \
- { "$24", 24 + GP_REG_FIRST }, \
- { "$25", 25 + GP_REG_FIRST }, \
- { "$26", 26 + GP_REG_FIRST }, \
- { "$27", 27 + GP_REG_FIRST }, \
- { "$28", 28 + GP_REG_FIRST }, \
- { "$29", 29 + GP_REG_FIRST }, \
- { "$30", 30 + GP_REG_FIRST }, \
- { "$31", 31 + GP_REG_FIRST }, \
- { "$sp", 29 + GP_REG_FIRST }, \
- { "$fp", 30 + GP_REG_FIRST }, \
- { "at", 1 + GP_REG_FIRST }, \
- { "v0", 2 + GP_REG_FIRST }, \
- { "v1", 3 + GP_REG_FIRST }, \
- { "a0", 4 + GP_REG_FIRST }, \
- { "a1", 5 + GP_REG_FIRST }, \
- { "a2", 6 + GP_REG_FIRST }, \
- { "a3", 7 + GP_REG_FIRST }, \
- { "t0", 8 + GP_REG_FIRST }, \
- { "t1", 9 + GP_REG_FIRST }, \
- { "t2", 10 + GP_REG_FIRST }, \
- { "t3", 11 + GP_REG_FIRST }, \
- { "t4", 12 + GP_REG_FIRST }, \
- { "t5", 13 + GP_REG_FIRST }, \
- { "t6", 14 + GP_REG_FIRST }, \
- { "t7", 15 + GP_REG_FIRST }, \
- { "s0", 16 + GP_REG_FIRST }, \
- { "s1", 17 + GP_REG_FIRST }, \
- { "s2", 18 + GP_REG_FIRST }, \
- { "s3", 19 + GP_REG_FIRST }, \
- { "s4", 20 + GP_REG_FIRST }, \
- { "s5", 21 + GP_REG_FIRST }, \
- { "s6", 22 + GP_REG_FIRST }, \
- { "s7", 23 + GP_REG_FIRST }, \
- { "t8", 24 + GP_REG_FIRST }, \
- { "t9", 25 + GP_REG_FIRST }, \
- { "k0", 26 + GP_REG_FIRST }, \
- { "k1", 27 + GP_REG_FIRST }, \
- { "gp", 28 + GP_REG_FIRST }, \
- { "sp", 29 + GP_REG_FIRST }, \
- { "fp", 30 + GP_REG_FIRST }, \
- { "ra", 31 + GP_REG_FIRST }, \
- { "$sp", 29 + GP_REG_FIRST }, \
- { "$fp", 30 + GP_REG_FIRST } \
-}
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand X. X is an RTL
- expression.
-
- CODE is a value that can be used to specify one of several ways
- of printing the operand. It is used when identical operands
- must be printed differently depending on the context. CODE
- comes from the `%' specification that was used to request
- printing of the operand. If the specification was just `%DIGIT'
- then CODE is 0; if the specification was `%LTR DIGIT' then CODE
- is the ASCII code for LTR.
-
- If X is a register, this macro should print the register's name.
- The names can be found in an array `reg_names' whose type is
- `char *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
-
- When the machine description has a specification `%PUNCT' (a `%'
- followed by a punctuation character), this macro is called with
- a null pointer for X and the punctuation character for CODE.
-
- See mips.c for the MIPS specific codes. */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-/* A C expression which evaluates to true if CODE is a valid
- punctuation character for use in the `PRINT_OPERAND' macro. If
- `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no
- punctuation characters (except for the standard one, `%') are
- used in this way. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) mips_print_operand_punct[CODE]
-
-/* A C compound statement to output to stdio stream STREAM the
- assembler syntax for an instruction operand that is a memory
- reference whose address is ADDR. ADDR is an RTL expression.
-
- On some machines, the syntax for a symbolic address depends on
- the section that the address refers to. On these machines,
- define the macro `ENCODE_SECTION_INFO' to store the information
- into the `symbol_ref', and then check for it here. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
-
-/* A C statement, to be executed after all slot-filler instructions
- have been output. If necessary, call `dbr_sequence_length' to
- determine the number of slots filled in a sequence (zero if not
- currently outputting a sequence), to decide how many no-ops to
- output, or whatever.
-
- Don't define this macro if it has nothing to do, but it is
- helpful in reading assembly output if the extent of the delay
- sequence is made explicit (e.g. with white space).
-
- Note that output routines for instructions with delay slots must
- be prepared to deal with not being output as part of a sequence
- (i.e. when the scheduling pass is not run, or when no slot
- fillers could be found.) The variable `final_sequence' is null
- when not processing a sequence, otherwise it contains the
- `sequence' rtx being output. */
-
-#define DBR_OUTPUT_SEQEND(STREAM) \
-do \
- { \
- if (set_nomacro > 0 && --set_nomacro == 0) \
- fputs ("\t.set\tmacro\n", STREAM); \
- \
- if (set_noreorder > 0 && --set_noreorder == 0) \
- fputs ("\t.set\treorder\n", STREAM); \
- \
- dslots_jump_filled++; \
- fputs ("\n", STREAM); \
- } \
-while (0)
-
-
-/* How to tell the debugger about changes of source files. Note, the
- mips ECOFF format cannot deal with changes of files inside of
- functions, which means the output of parser generators like bison
- is generally not debuggable without using the -l switch. Lose,
- lose, lose. Silicon graphics seems to want all .file's hardwired
- to 1. */
-
-#ifndef SET_FILE_NUMBER
-#define SET_FILE_NUMBER() ++num_source_filenames
-#endif
-
-#define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
- mips_output_filename (STREAM, NAME)
-
-/* This is defined so that it can be overridden in iris6.h. */
-#define ASM_OUTPUT_FILENAME(STREAM, NUM_SOURCE_FILENAMES, NAME) \
-do \
- { \
- fprintf (STREAM, "\t.file\t%d ", NUM_SOURCE_FILENAMES); \
- output_quoted_string (STREAM, NAME); \
- fputs ("\n", STREAM); \
- } \
-while (0)
-
-/* This is how to output a note the debugger telling it the line number
- to which the following sequence of instructions corresponds.
- Silicon graphics puts a label after each .loc. */
-
-#ifndef LABEL_AFTER_LOC
-#define LABEL_AFTER_LOC(STREAM)
-#endif
-
-#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
- mips_output_lineno (STREAM, LINE)
-
-/* The MIPS implementation uses some labels for it's own purpose. The
- following lists what labels are created, and are all formed by the
- pattern $L[a-z].*. The machine independent portion of GCC creates
- labels matching: $L[A-Z][0-9]+ and $L[0-9]+.
-
- LM[0-9]+ Silicon Graphics/ECOFF stabs label before each stmt.
- $Lb[0-9]+ Begin blocks for MIPS debug support
- $Lc[0-9]+ Label for use in s<xx> operation.
- $Le[0-9]+ End blocks for MIPS debug support
- $Lp\..+ Half-pic labels. */
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME.
-
- If we are optimizing the gp, remember that this label has been put
- out, so we know not to emit an .extern for it in mips_asm_file_end.
- We use one of the common bits in the IDENTIFIER tree node for this,
- since those bits seem to be unused, and we don't have any method
- of getting the decl nodes from the name. */
-
-#define ASM_OUTPUT_LABEL(STREAM,NAME) \
-do { \
- assemble_name (STREAM, NAME); \
- fputs (":\n", STREAM); \
-} while (0)
-
-
-/* A C statement (sans semicolon) to output to the stdio stream
- STREAM any text necessary for declaring the name NAME of an
- initialized variable which is being defined. This macro must
- output the label definition (perhaps using `ASM_OUTPUT_LABEL').
- The argument DECL is the `VAR_DECL' tree node representing the
- variable.
-
- If this macro is not defined, then the variable name is defined
- in the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
-
-#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
-do \
- { \
- mips_declare_object (STREAM, NAME, "", ":\n", 0); \
- HALF_PIC_DECLARE (NAME); \
- } \
-while (0)
-
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
- do { \
- fputs ("\t.globl\t", STREAM); \
- assemble_name (STREAM, NAME); \
- fputs ("\n", STREAM); \
- } while (0)
-
-/* This says how to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
- mips_declare_object (STREAM, NAME, "\n\t.comm\t", ",%u\n", (SIZE))
-
-/* This says how to define a local common symbol (ie, not visible to
- linker). */
-
-#define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
- mips_declare_object (STREAM, NAME, "\n\t.lcomm\t", ",%u\n", (SIZE))
-
-
-/* This says how to output an external. It would be possible not to
- output anything and let undefined symbol become external. However
- the assembler uses length information on externals to allocate in
- data/sdata bss/sbss, thereby saving exec time. */
-
-#define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
- mips_output_external(STREAM,DECL,NAME)
-
-/* This says what to print at the end of the assembly file */
-#define ASM_FILE_END(STREAM) mips_asm_file_end(STREAM)
-
-
-/* This is how to declare a function name. The actual work of
- emitting the label is moved to function_prologue, so that we can
- get the line number correctly emitted before the .ent directive,
- and after any .file directives.
-
- Also, switch files if we are optimizing the global pointer. */
-
-#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
-{ \
- extern FILE *asm_out_text_file; \
- if (TARGET_GP_OPT) \
- { \
- STREAM = asm_out_text_file; \
- /* ??? text_section gets called too soon. If the previous \
- function is in a special section and we're not, we have \
- to switch back to the text section. We can't call \
- text_section again as gcc thinks we're already there. */ \
- /* ??? See varasm.c. There are other things that get output \
- too early, like alignment (before we've switched STREAM). */ \
- if (DECL_SECTION_NAME (DECL) == NULL_TREE) \
- fprintf (STREAM, "%s\n", TEXT_SECTION_ASM_OP); \
- } \
- \
- HALF_PIC_DECLARE (NAME); \
-}
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(STREAM,PREFIX,NUM) \
- fprintf (STREAM, "%s%s%d:\n", LOCAL_LABEL_PREFIX, PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(STREAM,VALUE) \
- mips_output_double (STREAM, VALUE)
-
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(STREAM,VALUE) \
- mips_output_float (STREAM, VALUE)
-
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(STREAM,VALUE) \
-do { \
- fprintf (STREAM, "\t.word\t"); \
- output_addr_const (STREAM, (VALUE)); \
- fprintf (STREAM, "\n"); \
-} while (0)
-
-/* Likewise for 64 bit, `char' and `short' constants. */
-
-#define ASM_OUTPUT_DOUBLE_INT(STREAM,VALUE) \
-do { \
- if (TARGET_64BIT) \
- { \
- fprintf (STREAM, "\t.dword\t"); \
- if (HOST_BITS_PER_WIDE_INT < 64 || GET_CODE (VALUE) != CONST_INT) \
- /* We can't use 'X' for negative numbers, because then we won't \
- get the right value for the upper 32 bits. */ \
- output_addr_const (STREAM, VALUE); \
- else \
- /* We must use 'X', because otherwise LONG_MIN will print as \
- a number that the Irix 6 assembler won't accept. */ \
- print_operand (STREAM, VALUE, 'X'); \
- fprintf (STREAM, "\n"); \
- } \
- else \
- { \
- assemble_integer (operand_subword ((VALUE), 0, 0, DImode), \
- UNITS_PER_WORD, 1); \
- assemble_integer (operand_subword ((VALUE), 1, 0, DImode), \
- UNITS_PER_WORD, 1); \
- } \
-} while (0)
-
-#define ASM_OUTPUT_SHORT(STREAM,VALUE) \
-{ \
- fprintf (STREAM, "\t.half\t"); \
- output_addr_const (STREAM, (VALUE)); \
- fprintf (STREAM, "\n"); \
-}
-
-#define ASM_OUTPUT_CHAR(STREAM,VALUE) \
-{ \
- fprintf (STREAM, "\t.byte\t"); \
- output_addr_const (STREAM, (VALUE)); \
- fprintf (STREAM, "\n"); \
-}
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(STREAM,VALUE) \
- fprintf (STREAM, "\t.byte\t0x%x\n", (VALUE))
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
- fprintf (STREAM, "\t%s\t%sL%d\n", \
- TARGET_LONG64 ? ".dword" : ".word", \
- LOCAL_LABEL_PREFIX, \
- VALUE)
-
-/* This is how to output an element of a case-vector that is relative.
- This is used for pc-relative code (e.g. when TARGET_ABICALLS or
- TARGET_EMBEDDED_PIC). */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, VALUE, REL) \
-do { \
- if (TARGET_EMBEDDED_PIC) \
- fprintf (STREAM, "\t%s\t%sL%d-%sLS%d\n", \
- TARGET_LONG64 ? ".dword" : ".word", \
- LOCAL_LABEL_PREFIX, VALUE, LOCAL_LABEL_PREFIX, REL); \
- else if (mips_abi == ABI_32) \
- fprintf (STREAM, "\t%s\t%sL%d\n", \
- TARGET_LONG64 ? ".gpdword" : ".gpword", \
- LOCAL_LABEL_PREFIX, VALUE); \
- else \
- fprintf (STREAM, "\t%s\t%sL%d\n", \
- TARGET_LONG64 ? ".dword" : ".word", \
- LOCAL_LABEL_PREFIX, VALUE); \
-} while (0)
-
-/* When generating embedded PIC code we want to put the jump table in
- the .text section. In all other cases, we want to put the jump
- table in the .rdata section. Unfortunately, we can't use
- JUMP_TABLES_IN_TEXT_SECTION, because it is not conditional.
- Instead, we use ASM_OUTPUT_CASE_LABEL to switch back to the .text
- section if appropriate. */
-#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, INSN) \
-do { \
- if (TARGET_EMBEDDED_PIC) \
- text_section (); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \
-} while (0)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(STREAM,LOG) \
-{ \
- int mask = (1 << (LOG)) - 1; \
- fprintf (STREAM, "\t.align\t%d\n", (LOG)); \
-}
-
-/* This is how to output an assembler line to to advance the location
- counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(STREAM,SIZE) \
- fprintf (STREAM, "\t.space\t%u\n", (SIZE))
-
-/* This is how to output a string. */
-#define ASM_OUTPUT_ASCII(STREAM, STRING, LEN) \
-do { \
- register int i, c, len = (LEN), cur_pos = 17; \
- register unsigned char *string = (unsigned char *)(STRING); \
- fprintf ((STREAM), "\t.ascii\t\""); \
- for (i = 0; i < len; i++) \
- { \
- register int c = string[i]; \
- \
- switch (c) \
- { \
- case '\"': \
- case '\\': \
- putc ('\\', (STREAM)); \
- putc (c, (STREAM)); \
- cur_pos += 2; \
- break; \
- \
- case TARGET_NEWLINE: \
- fputs ("\\n", (STREAM)); \
- if (i+1 < len \
- && (((c = string[i+1]) >= '\040' && c <= '~') \
- || c == TARGET_TAB)) \
- cur_pos = 32767; /* break right here */ \
- else \
- cur_pos += 2; \
- break; \
- \
- case TARGET_TAB: \
- fputs ("\\t", (STREAM)); \
- cur_pos += 2; \
- break; \
- \
- case TARGET_FF: \
- fputs ("\\f", (STREAM)); \
- cur_pos += 2; \
- break; \
- \
- case TARGET_BS: \
- fputs ("\\b", (STREAM)); \
- cur_pos += 2; \
- break; \
- \
- case TARGET_CR: \
- fputs ("\\r", (STREAM)); \
- cur_pos += 2; \
- break; \
- \
- default: \
- if (c >= ' ' && c < 0177) \
- { \
- putc (c, (STREAM)); \
- cur_pos++; \
- } \
- else \
- { \
- fprintf ((STREAM), "\\%03o", c); \
- cur_pos += 4; \
- } \
- } \
- \
- if (cur_pos > 72 && i+1 < len) \
- { \
- cur_pos = 17; \
- fprintf ((STREAM), "\"\n\t.ascii\t\""); \
- } \
- } \
- fprintf ((STREAM), "\"\n"); \
-} while (0)
-
-/* Handle certain cpp directives used in header files on sysV. */
-#define SCCS_DIRECTIVE
-
-/* Output #ident as a in the read-only data section. */
-#define ASM_OUTPUT_IDENT(FILE, STRING) \
-{ \
- char *p = STRING; \
- int size = strlen (p) + 1; \
- rdata_section (); \
- assemble_string (p, size); \
-}
-
-/* Default to -G 8 */
-#ifndef MIPS_DEFAULT_GVALUE
-#define MIPS_DEFAULT_GVALUE 8
-#endif
-
-/* Define the strings to put out for each section in the object file. */
-#define TEXT_SECTION_ASM_OP "\t.text" /* instructions */
-#define DATA_SECTION_ASM_OP "\t.data" /* large data */
-#define SDATA_SECTION_ASM_OP "\t.sdata" /* small data */
-#define RDATA_SECTION_ASM_OP "\t.rdata" /* read-only data */
-#define READONLY_DATA_SECTION rdata_section
-#define SMALL_DATA_SECTION sdata_section
-
-/* What other sections we support other than the normal .data/.text. */
-
-#define EXTRA_SECTIONS in_sdata, in_rdata
-
-/* Define the additional functions to select our additional sections. */
-
-/* on the MIPS it is not a good idea to put constants in the text
- section, since this defeats the sdata/data mechanism. This is
- especially true when -O is used. In this case an effort is made to
- address with faster (gp) register relative addressing, which can
- only get at sdata and sbss items (there is no stext !!) However,
- if the constant is too large for sdata, and it's readonly, it
- will go into the .rdata section. */
-
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-sdata_section () \
-{ \
- if (in_section != in_sdata) \
- { \
- fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
- in_section = in_sdata; \
- } \
-} \
- \
-void \
-rdata_section () \
-{ \
- if (in_section != in_rdata) \
- { \
- fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
- in_section = in_rdata; \
- } \
-}
-
-/* Given a decl node or constant node, choose the section to output it in
- and select that section. */
-
-#define SELECT_RTX_SECTION(MODE,RTX) mips_select_rtx_section (MODE, RTX)
-
-#define SELECT_SECTION(DECL, RELOC) mips_select_section (DECL, RELOC)
-
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-#define ASM_OUTPUT_REG_PUSH(STREAM,REGNO) \
-do \
- { \
- fprintf (STREAM, "\t%s\t%s,%s,8\n\t%s\t%s,0(%s)\n", \
- TARGET_64BIT ? "dsubu" : "subu", \
- reg_names[STACK_POINTER_REGNUM], \
- reg_names[STACK_POINTER_REGNUM], \
- TARGET_64BIT ? "sd" : "sw", \
- reg_names[REGNO], \
- reg_names[STACK_POINTER_REGNUM]); \
- } \
-while (0)
-
-#define ASM_OUTPUT_REG_POP(STREAM,REGNO) \
-do \
- { \
- if (! set_noreorder) \
- fprintf (STREAM, "\t.set\tnoreorder\n"); \
- \
- dslots_load_total++; \
- dslots_load_filled++; \
- fprintf (STREAM, "\t%s\t%s,0(%s)\n\t%s\t%s,%s,8\n", \
- TARGET_64BIT ? "ld" : "lw", \
- reg_names[REGNO], \
- reg_names[STACK_POINTER_REGNUM], \
- TARGET_64BIT ? "daddu" : "addu", \
- reg_names[STACK_POINTER_REGNUM], \
- reg_names[STACK_POINTER_REGNUM]); \
- \
- if (! set_noreorder) \
- fprintf (STREAM, "\t.set\treorder\n"); \
- } \
-while (0)
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* How to start an assembler comment.
- The leading space is important (the mips native assembler requires it). */
-#ifndef ASM_COMMENT_START
-#define ASM_COMMENT_START " #"
-#endif
-
-
-/* Macros for mips-tfile.c to encapsulate stabs in ECOFF, and for
- and mips-tdump.c to print them out.
-
- These must match the corresponding definitions in gdb/mipsread.c.
- Unfortunately, gcc and gdb do not currently share any directories. */
-
-#define CODE_MASK 0x8F300
-#define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
-#define MIPS_MARK_STAB(code) ((code)+CODE_MASK)
-#define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
-
-
-/* Default definitions for size_t and ptrdiff_t. */
-
-#ifndef SIZE_TYPE
-#define NO_BUILTIN_SIZE_TYPE
-#define SIZE_TYPE (TARGET_LONG64 ? "long unsigned int" : "unsigned int")
-#endif
-
-#ifndef PTRDIFF_TYPE
-#define NO_BUILTIN_PTRDIFF_TYPE
-#define PTRDIFF_TYPE (TARGET_LONG64 ? "long int" : "int")
-#endif
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
deleted file mode 100644
index d74edf7eb77..00000000000
--- a/gcc/config/mips/mips.md
+++ /dev/null
@@ -1,7095 +0,0 @@
-;; Mips.md Machine Description for MIPS based processors
-;; Contributed by A. Lichnewsky, lich@inria.inria.fr
-;; Changes by Michael Meissner, meissner@osf.org
-;; 64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and
-;; Brendan Eich, brendan@microunity.com.
-;; Copyright (C) 1989, 90-96, 1997 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.
-
-;; ??? Currently does not have define_function_unit support for the R8000.
-;; Must include new entries for fmadd in addition to existing entries.
-
-
-
-;; ....................
-;;
-;; Attributes
-;;
-;; ....................
-
-;; Classification of each insn.
-;; branch conditional branch
-;; jump unconditional jump
-;; call unconditional call
-;; load load instruction(s)
-;; store store instruction(s)
-;; move data movement within same register set
-;; xfer transfer to/from coprocessor
-;; hilo transfer of hi/lo registers
-;; arith integer arithmetic instruction
-;; darith double precision integer arithmetic instructions
-;; imul integer multiply
-;; idiv integer divide
-;; icmp integer compare
-;; fadd floating point add/subtract
-;; fmul floating point multiply
-;; fmadd floating point multiply-add
-;; fdiv floating point divide
-;; fabs floating point absolute value
-;; fneg floating point negation
-;; fcmp floating point compare
-;; fcvt floating point convert
-;; fsqrt floating point square root
-;; multi multiword sequence (or user asm statements)
-;; nop no operation
-
-(define_attr "type"
- "unknown,branch,jump,call,load,store,move,xfer,hilo,arith,darith,imul,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,multi,nop"
- (const_string "unknown"))
-
-;; Main data type used by the insn
-(define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF,FPSW" (const_string "unknown"))
-
-;; # instructions (4 bytes each)
-(define_attr "length" "" (const_int 1))
-
-;; whether or not an instruction has a mandatory delay slot
-(define_attr "dslot" "no,yes"
- (if_then_else (eq_attr "type" "branch,jump,call,load,xfer,hilo,fcmp")
- (const_string "yes")
- (const_string "no")))
-
-;; Attribute describing the processor. This attribute must match exactly
-;; with the processor_type enumeration in mips.h.
-
-;; Attribute describing the processor
-;; (define_attr "cpu" "default,r3000,r6000,r4000"
-;; (const
-;; (cond [(eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R3000")) (const_string "r3000")
-;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R4000")) (const_string "r4000")
-;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R6000")) (const_string "r6000")]
-;; (const_string "default"))))
-
-;; ??? Fix everything that tests this attribute.
-(define_attr "cpu"
- "default,r3000,r6000,r4000,r4100,r4300,r4600,r4650,r5000,r8000"
- (const (symbol_ref "mips_cpu_attr")))
-
-;; Attribute defining whether or not we can use the branch-likely instructions
-;; (MIPS ISA level 2)
-
-(define_attr "branch_likely" "no,yes"
- (const
- (if_then_else (ge (symbol_ref "mips_isa") (const_int 2))
- (const_string "yes")
- (const_string "no"))))
-
-
-;; Describe a user's asm statement.
-(define_asm_attributes
- [(set_attr "type" "multi")])
-
-;; whether or not generating calls to position independent functions
-(define_attr "abicalls" "no,yes"
- (const (symbol_ref "mips_abicalls_attr")))
-
-
-
-;; .........................
-;;
-;; Delay slots, can't describe load/fcmp/xfer delay slots here
-;;
-;; .........................
-
-(define_delay (eq_attr "type" "branch")
- [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
- (nil)
- (and (eq_attr "branch_likely" "yes") (and (eq_attr "dslot" "no") (eq_attr "length" "1")))])
-
-(define_delay (eq_attr "type" "jump")
- [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
- (nil)
- (nil)])
-
-(define_delay (and (eq_attr "type" "call") (eq_attr "abicalls" "no"))
- [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
- (nil)
- (nil)])
-
-
-
-;; .........................
-;;
-;; Functional units
-;;
-;; .........................
-
-; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
-; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
-
-;; Make the default case (PROCESSOR_DEFAULT) handle the worst case
-
-(define_function_unit "memory" 1 0
- (and (eq_attr "type" "load")
- (eq_attr "cpu" "!r3000,r4600,r4650,r4100,r4300,r5000"))
- 3 0)
-
-(define_function_unit "memory" 1 0
- (and (eq_attr "type" "load")
- (eq_attr "cpu" "r3000,r4600,r4650,r4100,r4300,r5000"))
- 2 0)
-
-(define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
-
-(define_function_unit "memory" 1 0 (eq_attr "type" "xfer") 2 0)
-
-(define_function_unit "imuldiv" 1 0
- (eq_attr "type" "hilo")
- 1 3)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul")
- (eq_attr "cpu" "!r3000,r4000,r4600,r4650,r4100,r4300,r5000"))
- 17 17)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul") (eq_attr "cpu" "r3000"))
- 12 12)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul") (eq_attr "cpu" "r4000,r4600"))
- 10 10)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul") (eq_attr "cpu" "r4650"))
- 4 4)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul")
- (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4100")))
- 1 1)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul")
- (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4100")))
- 4 4)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul")
- (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4300,r5000")))
- 5 5)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul")
- (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4300")))
- 8 8)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul")
- (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000")))
- 9 9)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (eq_attr "cpu" "!r3000,r4000,r4600,r4650,r4100,r4300,r5000"))
- 38 38)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv") (eq_attr "cpu" "r3000"))
- 35 35)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4600"))
- 42 42)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4650"))
- 36 36)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4000"))
- 69 69)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4100")))
- 35 35)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4100")))
- 67 67)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4300")))
- 37 37)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4300")))
- 69 69)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (and (eq_attr "mode" "SI") (eq_attr "cpu" "r5000")))
- 36 36)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000")))
- 68 68)
-
-;; The R4300 does *NOT* have a seperate Floating Point Unit, instead
-;; the FP hardware is part of the normal ALU circuitry. This means FP
-;; instructions affect the pipe-line, and no functional unit
-;; parallelism can occur on R4300 processors. To force GCC into coding
-;; for only a single functional unit, we force the R4300 FP
-;; instructions to be processed in the "imuldiv" unit.
-
-(define_function_unit "adder" 1 1
- (and (eq_attr "type" "fcmp") (eq_attr "cpu" "!r3000,r6000,r4300,r5000"))
- 3 0)
-
-(define_function_unit "adder" 1 1
- (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r3000,r6000"))
- 2 0)
-
-(define_function_unit "adder" 1 1
- (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r5000"))
- 1 0)
-
-(define_function_unit "adder" 1 1
- (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r6000,r4300"))
- 4 0)
-
-(define_function_unit "adder" 1 1
- (and (eq_attr "type" "fadd") (eq_attr "cpu" "r3000"))
- 2 0)
-
-(define_function_unit "adder" 1 1
- (and (eq_attr "type" "fadd") (eq_attr "cpu" "r6000"))
- 3 0)
-
-(define_function_unit "adder" 1 1
- (and (eq_attr "type" "fabs,fneg")
- (eq_attr "cpu" "!r3000,r4600,r4650,r4300,r5000"))
- 2 0)
-
-(define_function_unit "adder" 1 1
- (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "r3000,r4600,r4650,r5000"))
- 1 0)
-
-(define_function_unit "mult" 1 1
- (and (eq_attr "type" "fmul")
- (and (eq_attr "mode" "SF")
- (eq_attr "cpu" "!r3000,r6000,r4600,r4650,r4300,r5000")))
- 7 0)
-
-(define_function_unit "mult" 1 1
- (and (eq_attr "type" "fmul")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000,r5000")))
- 4 0)
-
-(define_function_unit "mult" 1 1
- (and (eq_attr "type" "fmul")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
- 5 0)
-
-(define_function_unit "mult" 1 1
- (and (eq_attr "type" "fmul")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
- 8 0)
-
-(define_function_unit "mult" 1 1
- (and (eq_attr "type" "fmul")
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r6000,r4300,r5000")))
- 8 0)
-
-(define_function_unit "mult" 1 1
- (and (eq_attr "type" "fmul")
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000,r5000")))
- 5 0)
-
-(define_function_unit "mult" 1 1
- (and (eq_attr "type" "fmul")
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
- 6 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fdiv")
- (and (eq_attr "mode" "SF")
- (eq_attr "cpu" "!r3000,r6000,r4600,r4650,r4300,r5000")))
- 23 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fdiv")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000")))
- 12 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fdiv")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
- 15 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fdiv")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
- 32 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fdiv")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r5000")))
- 21 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fdiv")
- (and (eq_attr "mode" "DF")
- (eq_attr "cpu" "!r3000,r6000,r4600,r4650,r4300")))
- 36 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fdiv")
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000")))
- 19 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fdiv")
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
- 16 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fdiv")
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650")))
- 61 0)
-
-;;; ??? Is this number right?
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fsqrt")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
- 54 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fsqrt")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
- 31 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fsqrt")
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r5000")))
- 21 0)
-
-;;; ??? Is this number right?
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fsqrt")
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
- 112 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fsqrt")
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650")))
- 60 0)
-
-(define_function_unit "divide" 1 1
- (and (eq_attr "type" "fsqrt")
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "r5000")))
- 36 0)
-
-;; R4300 FP instruction classes treated as part of the "imuldiv"
-;; functional unit:
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "fadd") (eq_attr "cpu" "r4300"))
- 3 3)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "fcmp,fabs,fneg") (eq_attr "cpu" "r4300"))
- 1 1)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4300")))
- 5 5)
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4300")))
- 8 8)
-
-(define_function_unit "imuldiv" 1 0
- (and (and (eq_attr "type" "fdiv") (eq_attr "type" "fsqrt"))
- (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4300")))
- 29 29)
-(define_function_unit "imuldiv" 1 0
- (and (and (eq_attr "type" "fdiv") (eq_attr "type" "fsqrt"))
- (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4300")))
- 58 58)
-
-;; The following functional units do not use the cpu type, and use
-;; much less memory in genattrtab.c.
-
-;; (define_function_unit "memory" 1 0 (eq_attr "type" "load") 3 0)
-;; (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
-;;
-;; (define_function_unit "fp_comp" 1 0 (eq_attr "type" "fcmp") 2 0)
-;;
-;; (define_function_unit "transfer" 1 0 (eq_attr "type" "xfer") 2 0)
-;; (define_function_unit "transfer" 1 0 (eq_attr "type" "hilo") 3 0)
-;;
-;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "imul") 17 0)
-;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "idiv") 38 0)
-;;
-;; (define_function_unit "adder" 1 1 (eq_attr "type" "fadd") 4 0)
-;; (define_function_unit "adder" 1 1 (eq_attr "type" "fabs,fneg") 2 0)
-;;
-;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "SF")) 7 0)
-;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "DF")) 8 0)
-;;
-;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "SF")) 23 0)
-;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "DF")) 36 0)
-;;
-;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "SF")) 54 0)
-;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "DF")) 112 0)
-
-
-;;
-;; ....................
-;;
-;; ADDITION
-;;
-;; ....................
-;;
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (plus:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "add.d\\t%0,%1,%2"
- [(set_attr "type" "fadd")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (plus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "add.s\\t%0,%1,%2"
- [(set_attr "type" "fadd")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_expand "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
- operands[2] = force_reg (SImode, operands[2]);
-}")
-
-(define_insn "addsi3_internal"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
- (match_operand:SI 2 "arith_operand" "dI")))]
- "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768"
- "addu\\t%0,%z1,%2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_expand "adddi3"
- [(parallel [(set (match_operand:DI 0 "register_operand" "")
- (plus:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:DI 2 "se_arith_operand" "")))
- (clobber (match_dup 3))])]
- "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
- operands[2] = force_reg (DImode, operands[2]);
-
- if (TARGET_64BIT)
- {
- emit_insn (gen_adddi3_internal_3 (operands[0], operands[1],
- operands[2]));
- DONE;
- }
-
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "adddi3_internal_1"
- [(set (match_operand:DI 0 "register_operand" "=d,&d")
- (plus:DI (match_operand:DI 1 "register_operand" "0,d")
- (match_operand:DI 2 "register_operand" "d,d")))
- (clobber (match_operand:SI 3 "register_operand" "=d,d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
- "*
-{
- return (REGNO (operands[0]) == REGNO (operands[1])
- && REGNO (operands[0]) == REGNO (operands[2]))
- ? \"srl\\t%3,%L0,31\;sll\\t%M0,%M0,1\;sll\\t%L0,%L1,1\;addu\\t%M0,%M0,%3\"
- : \"addu\\t%L0,%L1,%L2\;sltu\\t%3,%L0,%L2\;addu\\t%M0,%M1,%M2\;addu\\t%M0,%M0,%3\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "4")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (plus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
- && (REGNO (operands[0]) != REGNO (operands[1])
- || REGNO (operands[0]) != REGNO (operands[2]))"
-
- [(set (subreg:SI (match_dup 0) 0)
- (plus:SI (subreg:SI (match_dup 1) 0)
- (subreg:SI (match_dup 2) 0)))
-
- (set (match_dup 3)
- (ltu:SI (subreg:SI (match_dup 0) 0)
- (subreg:SI (match_dup 2) 0)))
-
- (set (subreg:SI (match_dup 0) 1)
- (plus:SI (subreg:SI (match_dup 1) 1)
- (subreg:SI (match_dup 2) 1)))
-
- (set (subreg:SI (match_dup 0) 1)
- (plus:SI (subreg:SI (match_dup 0) 1)
- (match_dup 3)))]
- "")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (plus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
- && (REGNO (operands[0]) != REGNO (operands[1])
- || REGNO (operands[0]) != REGNO (operands[2]))"
-
- [(set (subreg:SI (match_dup 0) 1)
- (plus:SI (subreg:SI (match_dup 1) 1)
- (subreg:SI (match_dup 2) 1)))
-
- (set (match_dup 3)
- (ltu:SI (subreg:SI (match_dup 0) 1)
- (subreg:SI (match_dup 2) 1)))
-
- (set (subreg:SI (match_dup 0) 0)
- (plus:SI (subreg:SI (match_dup 1) 0)
- (subreg:SI (match_dup 2) 0)))
-
- (set (subreg:SI (match_dup 0) 0)
- (plus:SI (subreg:SI (match_dup 0) 0)
- (match_dup 3)))]
- "")
-
-(define_insn "adddi3_internal_2"
- [(set (match_operand:DI 0 "register_operand" "=d,d,d")
- (plus:DI (match_operand:DI 1 "register_operand" "%d,%d,%d")
- (match_operand:DI 2 "small_int" "P,J,N")))
- (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
- "@
- addu\\t%L0,%L1,%2\;sltu\\t%3,%L0,%2\;addu\\t%M0,%M1,%3
- move\\t%L0,%L1\;move\\t%M0,%M1
- subu\\t%L0,%L1,%n2\;sltu\\t%3,%L0,%2\;subu\\t%M0,%M1,1\;addu\\t%M0,%M0,%3"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "3,2,4")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (plus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && INTVAL (operands[2]) > 0"
-
- [(set (subreg:SI (match_dup 0) 0)
- (plus:SI (subreg:SI (match_dup 1) 0)
- (match_dup 2)))
-
- (set (match_dup 3)
- (ltu:SI (subreg:SI (match_dup 0) 0)
- (match_dup 2)))
-
- (set (subreg:SI (match_dup 0) 1)
- (plus:SI (subreg:SI (match_dup 1) 1)
- (match_dup 3)))]
- "")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (plus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && INTVAL (operands[2]) > 0"
-
- [(set (subreg:SI (match_dup 0) 1)
- (plus:SI (subreg:SI (match_dup 1) 1)
- (match_dup 2)))
-
- (set (match_dup 3)
- (ltu:SI (subreg:SI (match_dup 0) 1)
- (match_dup 2)))
-
- (set (subreg:SI (match_dup 0) 0)
- (plus:SI (subreg:SI (match_dup 1) 0)
- (match_dup 3)))]
- "")
-
-(define_insn "adddi3_internal_3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (plus:DI (match_operand:DI 1 "se_reg_or_0_operand" "dJ")
- (match_operand:DI 2 "se_arith_operand" "dI")))]
- "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
- "*
-{
- return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- ? \"dsubu\\t%0,%z1,%n2\"
- : \"daddu\\t%0,%z1,%2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-
-(define_insn "addsi3_internal_2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (sign_extend:DI (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
- (match_operand:SI 2 "arith_operand" "dI"))))]
- "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
- "*
-{
- return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- ? \"subu\\t%0,%z1,%n2\"
- : \"addu\\t%0,%z1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-
-;;
-;; ....................
-;;
-;; SUBTRACTION
-;;
-;; ....................
-;;
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "sub.d\\t%0,%1,%2"
- [(set_attr "type" "fadd")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (minus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "sub.s\\t%0,%1,%2"
- [(set_attr "type" "fadd")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
- operands[2] = force_reg (SImode, operands[2]);
-}")
-
-(define_insn "subsi3_internal"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
- (match_operand:SI 2 "arith_operand" "dI")))]
- "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768"
- "subu\\t%0,%z1,%2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_expand "subdi3"
- [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
- (minus:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))
- (clobber (match_dup 3))])]
- "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
- "
-{
- if (TARGET_64BIT)
- {
- emit_insn (gen_subdi3_internal_3 (operands[0], operands[1],
- operands[2]));
- DONE;
- }
-
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "subdi3_internal"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (minus:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:DI 2 "register_operand" "d")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
- "sltu\\t%3,%L1,%L2\;subu\\t%L0,%L1,%L2\;subu\\t%M0,%M1,%M2\;subu\\t%M0,%M0,%3"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "4")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (minus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
-
- [(set (match_dup 3)
- (ltu:SI (subreg:SI (match_dup 1) 0)
- (subreg:SI (match_dup 2) 0)))
-
- (set (subreg:SI (match_dup 0) 0)
- (minus:SI (subreg:SI (match_dup 1) 0)
- (subreg:SI (match_dup 2) 0)))
-
- (set (subreg:SI (match_dup 0) 1)
- (minus:SI (subreg:SI (match_dup 1) 1)
- (subreg:SI (match_dup 2) 1)))
-
- (set (subreg:SI (match_dup 0) 1)
- (minus:SI (subreg:SI (match_dup 0) 1)
- (match_dup 3)))]
- "")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (minus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
-
- [(set (match_dup 3)
- (ltu:SI (subreg:SI (match_dup 1) 1)
- (subreg:SI (match_dup 2) 1)))
-
- (set (subreg:SI (match_dup 0) 1)
- (minus:SI (subreg:SI (match_dup 1) 1)
- (subreg:SI (match_dup 2) 1)))
-
- (set (subreg:SI (match_dup 0) 0)
- (minus:SI (subreg:SI (match_dup 1) 0)
- (subreg:SI (match_dup 2) 0)))
-
- (set (subreg:SI (match_dup 0) 0)
- (minus:SI (subreg:SI (match_dup 0) 0)
- (match_dup 3)))]
- "")
-
-(define_insn "subdi3_internal_2"
- [(set (match_operand:DI 0 "register_operand" "=d,d,d")
- (minus:DI (match_operand:DI 1 "register_operand" "d,d,d")
- (match_operand:DI 2 "small_int" "P,J,N")))
- (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
- "@
- sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,%3
- move\\t%L0,%L1\;move\\t%M0,%M1
- sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,1\;subu\\t%M0,%M0,%3"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "3,2,4")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (minus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && INTVAL (operands[2]) > 0"
-
- [(set (match_dup 3)
- (ltu:SI (subreg:SI (match_dup 1) 0)
- (match_dup 2)))
-
- (set (subreg:SI (match_dup 0) 0)
- (minus:SI (subreg:SI (match_dup 1) 0)
- (match_dup 2)))
-
- (set (subreg:SI (match_dup 0) 1)
- (minus:SI (subreg:SI (match_dup 1) 1)
- (match_dup 3)))]
- "")
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (minus:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && INTVAL (operands[2]) > 0"
-
- [(set (match_dup 3)
- (ltu:SI (subreg:SI (match_dup 1) 1)
- (match_dup 2)))
-
- (set (subreg:SI (match_dup 0) 1)
- (minus:SI (subreg:SI (match_dup 1) 1)
- (match_dup 2)))
-
- (set (subreg:SI (match_dup 0) 0)
- (minus:SI (subreg:SI (match_dup 1) 0)
- (match_dup 3)))]
- "")
-
-(define_insn "subdi3_internal_3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (minus:DI (match_operand:DI 1 "se_reg_or_0_operand" "dJ")
- (match_operand:DI 2 "se_arith_operand" "dI")))]
- "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
- "*
-{
- return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- ? \"daddu\\t%0,%z1,%n2\"
- : \"dsubu\\t%0,%z1,%2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-
-(define_insn "subsi3_internal_2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
- (match_operand:SI 2 "arith_operand" "dI"))))]
- "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
- "*
-{
- return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- ? \"addu\\t%0,%z1,%n2\"
- : \"subu\\t%0,%z1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-
-;;
-;; ....................
-;;
-;; MULTIPLICATION
-;;
-;; ....................
-;;
-
-;; Early Vr4300 silicon has a CPU bug where multiplies with certain
-;; operands may corrupt immediately following multiplies. This is a
-;; simple fix to insert NOPs.
-
-(define_expand "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "
-{
- if (mips_cpu != PROCESSOR_R4300)
- emit_insn (gen_muldf3_internal (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_muldf3_r4300 (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_insn "muldf3_internal"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && mips_cpu != PROCESSOR_R4300"
- "mul.d\\t%0,%1,%2"
- [(set_attr "type" "fmul")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn "muldf3_r4300"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && mips_cpu == PROCESSOR_R4300"
- "*
-{
- output_asm_insn (\"mul.d\\t%0,%1,%2\", operands);
- if (TARGET_4300_MUL_FIX)
- output_asm_insn (\"nop\", operands);
- return \"\";
-}"
- [(set_attr "type" "fmul")
- (set_attr "mode" "DF")
- (set_attr "length" "2")]) ;; mul.d + nop
-
-(define_expand "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "
-{
- if (mips_cpu != PROCESSOR_R4300)
- emit_insn( gen_mulsf3_internal (operands[0], operands[1], operands[2]));
- else
- emit_insn( gen_mulsf3_r4300 (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_insn "mulsf3_internal"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && mips_cpu != PROCESSOR_R4300"
- "mul.s\\t%0,%1,%2"
- [(set_attr "type" "fmul")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn "mulsf3_r4300"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && mips_cpu == PROCESSOR_R4300"
- "*
-{
- output_asm_insn (\"mul.s\\t%0,%1,%2\", operands);
- if (TARGET_4300_MUL_FIX)
- output_asm_insn (\"nop\", operands);
- return \"\";
-}"
- [(set_attr "type" "fmul")
- (set_attr "mode" "SF")
- (set_attr "length" "2")]) ;; mul.s + nop
-
-;; ??? The R4000 (only) has a cpu bug. If a double-word shift executes while
-;; a multiply is in progress, it may give an incorrect result. Avoid
-;; this by keeping the mflo with the mult on the R4000.
-
-(define_expand "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=l")
- (mult:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (clobber (match_scratch:SI 3 "=h"))
- (clobber (match_scratch:SI 4 "=a"))]
- ""
- "
-{
- if (TARGET_MAD)
- emit_insn (gen_mulsi3_r4650 (operands[0], operands[1], operands[2]));
- else if (mips_cpu != PROCESSOR_R4000)
- emit_insn (gen_mulsi3_internal (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_mulsi3_r4000 (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_insn "mulsi3_internal"
- [(set (match_operand:SI 0 "register_operand" "=l")
- (mult:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (clobber (match_scratch:SI 3 "=h"))
- (clobber (match_scratch:SI 4 "=a"))]
- "mips_cpu != PROCESSOR_R4000"
- "mult\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "mulsi3_r4000"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mult:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (clobber (match_scratch:SI 3 "=h"))
- (clobber (match_scratch:SI 4 "=l"))
- (clobber (match_scratch:SI 5 "=a"))]
- "mips_cpu == PROCESSOR_R4000"
- "*
-{
- rtx xoperands[10];
-
- xoperands[0] = operands[0];
- xoperands[1] = gen_rtx (REG, SImode, LO_REGNUM);
-
- output_asm_insn (\"mult\\t%1,%2\", operands);
- output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
- return \"\";
-}"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "3")]) ;; mult + mflo + delay
-
-(define_insn "mulsi3_r4650"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mult:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (clobber (match_scratch:SI 3 "=h"))
- (clobber (match_scratch:SI 4 "=l"))
- (clobber (match_scratch:SI 5 "=a"))]
- "TARGET_MAD"
- "mul\\t%0,%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_expand "muldi3"
- [(set (match_operand:DI 0 "register_operand" "=l")
- (mult:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "register_operand" "d")))
- (clobber (match_scratch:DI 3 "=h"))
- (clobber (match_scratch:DI 4 "=a"))]
- "TARGET_64BIT"
- "
-{
- if (mips_cpu != PROCESSOR_R4000)
- emit_insn (gen_muldi3_internal (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_muldi3_r4000 (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-;; Don't accept both operands using se_register_operand, because if
-;; both operands are sign extended we would prefer to use mult in the
-;; mulsidi3 pattern. Commutativity should permit either operand to be
-;; sign extended.
-
-(define_insn "muldi3_internal"
- [(set (match_operand:DI 0 "register_operand" "=l")
- (mult:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "register_operand" "d")))
- (clobber (match_scratch:DI 3 "=h"))
- (clobber (match_scratch:DI 4 "=a"))]
- "TARGET_64BIT && mips_cpu != PROCESSOR_R4000"
- "dmult\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_insn "muldi3_r4000"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (mult:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "register_operand" "d")))
- (clobber (match_scratch:DI 3 "=h"))
- (clobber (match_scratch:DI 4 "=l"))
- (clobber (match_scratch:DI 5 "=a"))]
- "TARGET_64BIT && mips_cpu == PROCESSOR_R4000"
- "*
-{
- rtx xoperands[10];
-
- xoperands[0] = operands[0];
- xoperands[1] = gen_rtx (REG, DImode, LO_REGNUM);
-
- output_asm_insn (\"dmult\\t%1,%2\", operands);
- output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
- return \"\";
-}"
- [(set_attr "type" "imul")
- (set_attr "mode" "DI")
- (set_attr "length" "3")]) ;; mult + mflo + delay
-
-;; ??? We could define a mulditi3 pattern when TARGET_64BIT.
-
-(define_expand "mulsidi3"
- [(set (match_operand:DI 0 "register_operand" "=x")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
- (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))]
- ""
- "
-{
- if (TARGET_64BIT)
- emit_insn (gen_mulsidi3_64bit (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_mulsidi3_internal (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_insn "mulsidi3_internal"
- [(set (match_operand:DI 0 "register_operand" "=x")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
- (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))
- (clobber (match_scratch:SI 3 "=a"))]
- "!TARGET_64BIT"
- "mult\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "mulsidi3_64bit"
- [(set (match_operand:DI 0 "register_operand" "=a")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
- (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=h"))]
- "TARGET_64BIT"
- "mult\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "smulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "=h")
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
- (sign_extend:DI (match_operand:SI 2 "register_operand" "d")))
- (const_int 32))))
- (clobber (match_scratch:SI 3 "=l"))
- (clobber (match_scratch:SI 4 "=a"))]
- ""
- "mult\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_expand "umulsidi3"
- [(set (match_operand:DI 0 "register_operand" "=x")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
- (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))]
- ""
- "
-{
- if (TARGET_64BIT)
- emit_insn (gen_umulsidi3_64bit (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_umulsidi3_internal (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_insn "umulsidi3_internal"
- [(set (match_operand:DI 0 "register_operand" "=x")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
- (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))
- (clobber (match_scratch:SI 3 "=a"))]
- "!TARGET_64BIT"
- "multu\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "umulsidi3_64bit"
- [(set (match_operand:DI 0 "register_operand" "=a")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
- (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=h"))]
- "TARGET_64BIT"
- "multu\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "umulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "=h")
- (truncate:SI
- (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
- (zero_extend:DI (match_operand:SI 2 "register_operand" "d")))
- (const_int 32))))
- (clobber (match_scratch:SI 3 "=l"))
- (clobber (match_scratch:SI 4 "=a"))]
- ""
- "multu\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "smuldi3_highpart"
- [(set (match_operand:DI 0 "register_operand" "=h")
- (truncate:DI
- (lshiftrt:TI (mult:TI (sign_extend:TI (match_operand:DI 1 "se_register_operand" "d"))
- (sign_extend:TI (match_operand:DI 2 "se_register_operand" "d")))
- (const_int 64))))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=a"))]
- "TARGET_64BIT"
- "dmult\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_insn "umuldi3_highpart"
- [(set (match_operand:DI 0 "register_operand" "=h")
- (truncate:DI
- (lshiftrt:TI (mult:TI (zero_extend:TI (match_operand:DI 1 "se_register_operand" "d"))
- (zero_extend:TI (match_operand:DI 2 "se_register_operand" "d")))
- (const_int 64))))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=a"))]
- "TARGET_64BIT"
- "dmultu\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-;; The R4650 supports a 32 bit multiply/ 64 bit accumulate
-;; instruction. The HI/LO registers are used as a 64 bit accumulator.
-
-(define_insn "madsi"
- [(set (match_operand:SI 0 "register_operand" "+l")
- (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d"))
- (match_dup 0)))
- (clobber (match_scratch:SI 3 "=h"))
- (clobber (match_scratch:SI 4 "=a"))]
- "TARGET_MAD"
- "mad\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "maddi"
- [(set (match_operand:DI 0 "register_operand" "+x")
- (plus:DI (mult:DI (sign_extend:DI
- (match_operand:SI 1 "register_operand" "d"))
- (sign_extend:DI
- (match_operand:SI 2 "register_operand" "d")))
- (match_dup 0)))
- (clobber (match_scratch:SI 3 "=a"))]
- "TARGET_MAD && ! TARGET_64BIT"
- "mad\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "maddi_64bit"
- [(set (match_operand:DI 0 "register_operand" "+a")
- (plus:DI (mult:DI (sign_extend:DI
- (match_operand:SI 1 "register_operand" "d"))
- (sign_extend:DI
- (match_operand:SI 2 "register_operand" "d")))
- (match_dup 0)))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=h"))]
- "TARGET_MAD && TARGET_64BIT"
- "mad\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "umaddi"
- [(set (match_operand:DI 0 "register_operand" "+x")
- (plus:DI (mult:DI (zero_extend:DI
- (match_operand:SI 1 "register_operand" "d"))
- (zero_extend:DI
- (match_operand:SI 2 "register_operand" "d")))
- (match_dup 0)))
- (clobber (match_scratch:SI 3 "=a"))]
- "TARGET_MAD && ! TARGET_64BIT"
- "madu\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "umaddi_64bit"
- [(set (match_operand:DI 0 "register_operand" "+a")
- (plus:DI (mult:DI (zero_extend:DI
- (match_operand:SI 1 "register_operand" "d"))
- (zero_extend:DI
- (match_operand:SI 2 "register_operand" "d")))
- (match_dup 0)))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=h"))]
- "TARGET_MAD && TARGET_64BIT"
- "madu\\t%1,%2"
- [(set_attr "type" "imul")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-;; Floating point multiply accumulate instructions.
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f"))
- (match_operand:DF 3 "register_operand" "f")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "madd.d\\t%0,%3,%1,%2"
- [(set_attr "type" "fmadd")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f"))
- (match_operand:SF 3 "register_operand" "f")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "madd.s\\t%0,%3,%1,%2"
- [(set_attr "type" "fmadd")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f"))
- (match_operand:DF 3 "register_operand" "f")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "msub.d\\t%0,%3,%1,%2"
- [(set_attr "type" "fmadd")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f"))
- (match_operand:SF 3 "register_operand" "f")))]
-
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "msub.s\\t%0,%3,%1,%2"
- [(set_attr "type" "fmadd")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f"))
- (match_operand:DF 3 "register_operand" "f"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "nmadd.d\\t%0,%3,%1,%2"
- [(set_attr "type" "fmadd")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f"))
- (match_operand:SF 3 "register_operand" "f"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "nmadd.s\\t%0,%3,%1,%2"
- [(set_attr "type" "fmadd")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (match_operand:DF 1 "register_operand" "f")
- (mult:DF (match_operand:DF 2 "register_operand" "f")
- (match_operand:DF 3 "register_operand" "f"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "nmsub.d\\t%0,%1,%2,%3"
- [(set_attr "type" "fmadd")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (minus:SF (match_operand:SF 1 "register_operand" "f")
- (mult:SF (match_operand:SF 2 "register_operand" "f")
- (match_operand:SF 3 "register_operand" "f"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "nmsub.s\\t%0,%1,%2,%3"
- [(set_attr "type" "fmadd")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-;;
-;; ....................
-;;
-;; DIVISION and REMAINDER
-;;
-;; ....................
-;;
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (div:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "div.d\\t%0,%1,%2"
- [(set_attr "type" "fdiv")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (div:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "div.s\\t%0,%1,%2"
- [(set_attr "type" "fdiv")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (div:DF (match_operand:DF 1 "const_float_1_operand" "")
- (match_operand:DF 2 "register_operand" "f")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && flag_fast_math"
- "recip.d\\t%0,%2"
- [(set_attr "type" "fdiv")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (div:SF (match_operand:SF 1 "const_float_1_operand" "")
- (match_operand:SF 2 "register_operand" "f")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && flag_fast_math"
- "recip.s\\t%0,%2"
- [(set_attr "type" "fdiv")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-;; If optimizing, prefer the divmod functions over separate div and
-;; mod functions, since this will allow using one instruction for both
-;; the quotient and remainder. At present, the divmod is not moved out
-;; of loops if it is constant within the loop, so allow -mdebugc to
-;; use the old method of doing things.
-
-;; 64 is the multiply/divide hi register
-;; 65 is the multiply/divide lo register
-
-;; ??? We can't accept constants here, because the MIPS assembler will replace
-;; a divide by power of 2 with a shift, and then the remainder is no longer
-;; available.
-
-(define_insn "divmodsi4"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (div:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (set (match_operand:SI 3 "register_operand" "=d")
- (mod:SI (match_dup 1)
- (match_dup 2)))
- (clobber (match_scratch:SI 4 "=l"))
- (clobber (match_scratch:SI 5 "=h"))
- (clobber (match_scratch:SI 6 "=a"))]
- "optimize"
- "*
-{
- if (find_reg_note (insn, REG_UNUSED, operands[3]))
- return \"div\\t%0,%1,%2\";
-
- if (find_reg_note (insn, REG_UNUSED, operands[0]))
- return \"rem\\t%3,%1,%2\";
-
- return \"div\\t%0,%1,%2\;mfhi\\t%3\";
-}"
- [(set_attr "type" "idiv")
- (set_attr "mode" "SI")
- (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
-
-(define_insn "divmoddi4"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (div:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))
- (set (match_operand:DI 3 "register_operand" "=d")
- (mod:DI (match_dup 1)
- (match_dup 2)))
- (clobber (match_scratch:DI 4 "=l"))
- (clobber (match_scratch:DI 5 "=h"))
- (clobber (match_scratch:DI 6 "=a"))]
- "TARGET_64BIT && optimize"
- "*
-{
- if (find_reg_note (insn, REG_UNUSED, operands[3]))
- return \"ddiv\\t%0,%1,%2\";
-
- if (find_reg_note (insn, REG_UNUSED, operands[0]))
- return \"drem\\t%3,%1,%2\";
-
- return \"ddiv\\t%0,%1,%2\;mfhi\\t%3\";
-}"
- [(set_attr "type" "idiv")
- (set_attr "mode" "DI")
- (set_attr "length" "15")]) ;; various tests for dividing by 0 and such
-
-(define_insn "udivmodsi4"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (udiv:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (set (match_operand:SI 3 "register_operand" "=d")
- (umod:SI (match_dup 1)
- (match_dup 2)))
- (clobber (match_scratch:SI 4 "=l"))
- (clobber (match_scratch:SI 5 "=h"))
- (clobber (match_scratch:SI 6 "=a"))]
- "optimize"
- "*
-{
- if (find_reg_note (insn, REG_UNUSED, operands[3]))
- return \"divu\\t%0,%1,%2\";
-
- if (find_reg_note (insn, REG_UNUSED, operands[0]))
- return \"remu\\t%3,%1,%2\";
-
- return \"divu\\t%0,%1,%2\;mfhi\\t%3\";
-}"
- [(set_attr "type" "idiv")
- (set_attr "mode" "SI")
- (set_attr "length" "8")]) ;; various tests for dividing by 0 and such
-
-(define_insn "udivmoddi4"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (udiv:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))
- (set (match_operand:DI 3 "register_operand" "=d")
- (umod:DI (match_dup 1)
- (match_dup 2)))
- (clobber (match_scratch:DI 4 "=l"))
- (clobber (match_scratch:DI 5 "=h"))
- (clobber (match_scratch:DI 6 "=a"))]
- "TARGET_64BIT && optimize"
- "*
-{
- if (find_reg_note (insn, REG_UNUSED, operands[3]))
- return \"ddivu\\t%0,%1,%2\";
-
- if (find_reg_note (insn, REG_UNUSED, operands[0]))
- return \"dremu\\t%3,%1,%2\";
-
- return \"ddivu\\t%0,%1,%2\;mfhi\\t%3\";
-}"
- [(set_attr "type" "idiv")
- (set_attr "mode" "DI")
- (set_attr "length" "8")]) ;; various tests for dividing by 0 and such
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (div:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "nonmemory_operand" "di")))
- (clobber (match_scratch:SI 3 "=l"))
- (clobber (match_scratch:SI 4 "=h"))
- (clobber (match_scratch:SI 6 "=a"))]
- "!optimize"
- "div\\t%0,%1,%2"
- [(set_attr "type" "idiv")
- (set_attr "mode" "SI")
- (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
-
-(define_insn "divdi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (div:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_nonmemory_operand" "di")))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=h"))
- (clobber (match_scratch:DI 6 "=a"))]
- "TARGET_64BIT && !optimize"
- "ddiv\\t%0,%1,%2"
- [(set_attr "type" "idiv")
- (set_attr "mode" "DI")
- (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
-
-(define_insn "modsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mod:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "nonmemory_operand" "di")))
- (clobber (match_scratch:SI 3 "=l"))
- (clobber (match_scratch:SI 4 "=h"))
- (clobber (match_scratch:SI 6 "=a"))]
- "!optimize"
- "rem\\t%0,%1,%2"
- [(set_attr "type" "idiv")
- (set_attr "mode" "SI")
- (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
-
-(define_insn "moddi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (mod:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_nonmemory_operand" "di")))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=h"))
- (clobber (match_scratch:DI 6 "=a"))]
- "TARGET_64BIT && !optimize"
- "drem\\t%0,%1,%2"
- [(set_attr "type" "idiv")
- (set_attr "mode" "DI")
- (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (udiv:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "nonmemory_operand" "di")))
- (clobber (match_scratch:SI 3 "=l"))
- (clobber (match_scratch:SI 4 "=h"))
- (clobber (match_scratch:SI 6 "=a"))]
- "!optimize"
- "divu\\t%0,%1,%2"
- [(set_attr "type" "idiv")
- (set_attr "mode" "SI")
- (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
-
-(define_insn "udivdi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (udiv:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_nonmemory_operand" "di")))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=h"))
- (clobber (match_scratch:DI 6 "=a"))]
- "TARGET_64BIT && !optimize"
- "ddivu\\t%0,%1,%2"
- [(set_attr "type" "idiv")
- (set_attr "mode" "DI")
- (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
-
-(define_insn "umodsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (umod:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "nonmemory_operand" "di")))
- (clobber (match_scratch:SI 3 "=l"))
- (clobber (match_scratch:SI 4 "=h"))
- (clobber (match_scratch:SI 6 "=a"))]
- "!optimize"
- "remu\\t%0,%1,%2"
- [(set_attr "type" "idiv")
- (set_attr "mode" "SI")
- (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
-
-(define_insn "umoddi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (umod:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_nonmemory_operand" "di")))
- (clobber (match_scratch:DI 3 "=l"))
- (clobber (match_scratch:DI 4 "=h"))
- (clobber (match_scratch:DI 6 "=a"))]
- "TARGET_64BIT && !optimize"
- "dremu\\t%0,%1,%2"
- [(set_attr "type" "idiv")
- (set_attr "mode" "DI")
- (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
-
-
-;;
-;; ....................
-;;
-;; SQUARE ROOT
-;;
-;; ....................
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && HAVE_SQRT_P() && TARGET_DOUBLE_FLOAT"
- "sqrt.d\\t%0,%1"
- [(set_attr "type" "fsqrt")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
- "sqrt.s\\t%0,%1"
- [(set_attr "type" "fsqrt")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (div:DF (match_operand:DF 1 "const_float_1_operand" "")
- (sqrt:DF (match_operand:DF 2 "register_operand" "f"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && flag_fast_math"
- "rsqrt.d\\t%0,%2"
- [(set_attr "type" "fsqrt")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (div:SF (match_operand:SF 1 "const_float_1_operand" "")
- (sqrt:SF (match_operand:SF 2 "register_operand" "f"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && flag_fast_math"
- "rsqrt.s\\t%0,%2"
- [(set_attr "type" "fsqrt")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-
-;;
-;; ....................
-;;
-;; ABSOLUTE VALUE
-;;
-;; ....................
-
-;; Do not use the integer abs macro instruction, since that signals an
-;; exception on -2147483648 (sigh).
-
-(define_insn "abssi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (abs:SI (match_operand:SI 1 "register_operand" "d")))]
- ""
- "*
-{
- dslots_jump_total++;
- dslots_jump_filled++;
- operands[2] = const0_rtx;
-
- if (REGNO (operands[0]) == REGNO (operands[1]))
- {
- if (mips_isa >= 2)
- return \"%(bltzl\\t%1,1f\\n\\tsubu\\t%0,%z2,%0\\n1:%)\";
- else
- return \"bgez\\t%1,1f%#\\n\\tsubu\\t%0,%z2,%0\\n1:\";
- }
- else
- return \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tsubu\\t%0,%z2,%0\\n1:%)\";
-}"
- [(set_attr "type" "multi")
- (set_attr "mode" "SI")
- (set_attr "length" "3")])
-
-(define_insn "absdi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (abs:DI (match_operand:DI 1 "se_register_operand" "d")))]
- "TARGET_64BIT"
- "*
-{
- dslots_jump_total++;
- dslots_jump_filled++;
- operands[2] = const0_rtx;
-
- if (REGNO (operands[0]) == REGNO (operands[1]))
- return \"%(bltzl\\t%1,1f\\n\\tdsubu\\t%0,%z2,%0\\n1:%)\";
- else
- return \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tdsubu\\t%0,%z2,%0\\n1:%)\";
-}"
- [(set_attr "type" "multi")
- (set_attr "mode" "DI")
- (set_attr "length" "3")])
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (abs:DF (match_operand:DF 1 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "abs.d\\t%0,%1"
- [(set_attr "type" "fabs")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (abs:SF (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "abs.s\\t%0,%1"
- [(set_attr "type" "fabs")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-
-;;
-;; ....................
-;;
-;; FIND FIRST BIT INSTRUCTION
-;;
-;; ....................
-;;
-
-(define_insn "ffssi2"
- [(set (match_operand:SI 0 "register_operand" "=&d")
- (ffs:SI (match_operand:SI 1 "register_operand" "d")))
- (clobber (match_scratch:SI 2 "=&d"))
- (clobber (match_scratch:SI 3 "=&d"))]
- ""
- "*
-{
- dslots_jump_total += 2;
- dslots_jump_filled += 2;
- operands[4] = const0_rtx;
-
- if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
- return \"%(\\
-move\\t%0,%z4\\n\\
-\\tbeq\\t%1,%z4,2f\\n\\
-1:\\tand\\t%2,%1,0x0001\\n\\
-\\taddu\\t%0,%0,1\\n\\
-\\tbeq\\t%2,%z4,1b\\n\\
-\\tsrl\\t%1,%1,1\\n\\
-2:%)\";
-
- return \"%(\\
-move\\t%0,%z4\\n\\
-\\tmove\\t%3,%1\\n\\
-\\tbeq\\t%3,%z4,2f\\n\\
-1:\\tand\\t%2,%3,0x0001\\n\\
-\\taddu\\t%0,%0,1\\n\\
-\\tbeq\\t%2,%z4,1b\\n\\
-\\tsrl\\t%3,%3,1\\n\\
-2:%)\";
-}"
- [(set_attr "type" "multi")
- (set_attr "mode" "SI")
- (set_attr "length" "6")])
-
-(define_insn "ffsdi2"
- [(set (match_operand:DI 0 "register_operand" "=&d")
- (ffs:DI (match_operand:DI 1 "se_register_operand" "d")))
- (clobber (match_scratch:DI 2 "=&d"))
- (clobber (match_scratch:DI 3 "=&d"))]
- "TARGET_64BIT"
- "*
-{
- dslots_jump_total += 2;
- dslots_jump_filled += 2;
- operands[4] = const0_rtx;
-
- if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
- return \"%(\\
-move\\t%0,%z4\\n\\
-\\tbeq\\t%1,%z4,2f\\n\\
-1:\\tand\\t%2,%1,0x0001\\n\\
-\\tdaddu\\t%0,%0,1\\n\\
-\\tbeq\\t%2,%z4,1b\\n\\
-\\tdsrl\\t%1,%1,1\\n\\
-2:%)\";
-
- return \"%(\\
-move\\t%0,%z4\\n\\
-\\tmove\\t%3,%1\\n\\
-\\tbeq\\t%3,%z4,2f\\n\\
-1:\\tand\\t%2,%3,0x0001\\n\\
-\\tdaddu\\t%0,%0,1\\n\\
-\\tbeq\\t%2,%z4,1b\\n\\
-\\tdsrl\\t%3,%3,1\\n\\
-2:%)\";
-}"
- [(set_attr "type" "multi")
- (set_attr "mode" "DI")
- (set_attr "length" "6")])
-
-
-;;
-;; ....................
-;;
-;; NEGATION and ONE'S COMPLEMENT
-;;
-;; ....................
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (neg:SI (match_operand:SI 1 "register_operand" "d")))]
- ""
- "*
-{
- operands[2] = const0_rtx;
- return \"subu\\t%0,%z2,%1\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_expand "negdi2"
- [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
- (neg:DI (match_operand:DI 1 "se_register_operand" "d")))
- (clobber (match_dup 2))])]
- "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
- "
-{
- if (TARGET_64BIT)
- {
- emit_insn (gen_negdi2_internal_2 (operands[0], operands[1]));
- DONE;
- }
-
- operands[2] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "negdi2_internal"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (neg:DI (match_operand:DI 1 "register_operand" "d")))
- (clobber (match_operand:SI 2 "register_operand" "=d"))]
- "! TARGET_64BIT && !TARGET_DEBUG_G_MODE"
- "*
-{
- operands[3] = const0_rtx;
- return \"subu\\t%L0,%z3,%L1\;subu\\t%M0,%z3,%M1\;sltu\\t%2,%z3,%L0\;subu\\t%M0,%M0,%2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "4")])
-
-(define_insn "negdi2_internal_2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (neg:DI (match_operand:DI 1 "se_register_operand" "d")))]
- "TARGET_64BIT"
- "*
-{
- operands[2] = const0_rtx;
- return \"dsubu\\t%0,%z2,%1\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (neg:DF (match_operand:DF 1 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "neg.d\\t%0,%1"
- [(set_attr "type" "fneg")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (neg:SF (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "neg.s\\t%0,%1"
- [(set_attr "type" "fneg")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (not:SI (match_operand:SI 1 "register_operand" "d")))]
- ""
- "*
-{
- operands[2] = const0_rtx;
- return \"nor\\t%0,%z2,%1\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "one_cmpldi2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (not:DI (match_operand:DI 1 "se_register_operand" "d")))]
- ""
- "*
-{
- operands[2] = const0_rtx;
- if (TARGET_64BIT)
- return \"nor\\t%0,%z2,%1\";
- return \"nor\\t%M0,%z2,%M1\;nor\\t%L0,%z2,%L1\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set (attr "length")
- (if_then_else (ge (symbol_ref "mips_isa") (const_int 3))
- (const_int 1)
- (const_int 2)))])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (not:DI (match_operand:DI 1 "register_operand" "")))]
- "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
-
- [(set (subreg:SI (match_dup 0) 0) (not:SI (subreg:SI (match_dup 1) 0)))
- (set (subreg:SI (match_dup 0) 1) (not:SI (subreg:SI (match_dup 1) 1)))]
- "")
-
-
-;;
-;; ....................
-;;
-;; LOGICAL
-;;
-;; ....................
-;;
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
- (match_operand:SI 2 "uns_arith_operand" "d,K")))]
- ""
- "@
- and\\t%0,%1,%2
- andi\\t%0,%1,%x2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "anddi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (and:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))]
- "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
- "*
-{
- if (TARGET_64BIT)
- return \"and\\t%0,%1,%2\";
- return \"and\\t%M0,%M1,%M2\;and\\t%L0,%L1,%L2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set (attr "length")
- (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int 0))
- (const_int 1)
- (const_int 2)))])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (and:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))]
- "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
-
- [(set (subreg:SI (match_dup 0) 0) (and:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
- (set (subreg:SI (match_dup 0) 1) (and:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
- "")
-
-(define_insn "anddi3_internal1"
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (and:DI (match_operand:DI 1 "se_register_operand" "%d,d")
- (match_operand:DI 2 "se_uns_arith_operand" "d,K")))]
- "TARGET_64BIT"
- "@
- and\\t%0,%1,%2
- andi\\t%0,%1,%x2"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
- (match_operand:SI 2 "uns_arith_operand" "d,K")))]
- ""
- "@
- or\\t%0,%1,%2
- ori\\t%0,%1,%x2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-;;; ??? There is no iordi3 pattern which accepts 'K' constants when
-;;; TARGET_64BIT
-
-(define_insn "iordi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ior:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))]
- "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
- "*
-{
- if (TARGET_64BIT)
- return \"or\\t%0,%1,%2\";
- return \"or\\t%M0,%M1,%M2\;or\\t%L0,%L1,%L2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set (attr "length")
- (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int 0))
- (const_int 1)
- (const_int 2)))])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ior:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))]
- "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
-
- [(set (subreg:SI (match_dup 0) 0) (ior:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
- (set (subreg:SI (match_dup 0) 1) (ior:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
- "")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
- (match_operand:SI 2 "uns_arith_operand" "d,K")))]
- ""
- "@
- xor\\t%0,%1,%2
- xori\\t%0,%1,%x2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-;; ??? If delete the 32-bit long long patterns, then could merge this with
-;; the following xordi3_internal pattern.
-(define_insn "xordi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (xor:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))]
- "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
- "*
-{
- if (TARGET_64BIT)
- return \"xor\\t%0,%1,%2\";
- return \"xor\\t%M0,%M1,%M2\;xor\\t%L0,%L1,%L2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set (attr "length")
- (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int 0))
- (const_int 1)
- (const_int 2)))])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (xor:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))]
- "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
-
- [(set (subreg:SI (match_dup 0) 0) (xor:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
- (set (subreg:SI (match_dup 0) 1) (xor:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
- "")
-
-(define_insn "xordi3_immed"
- [(set (match_operand:DI 0 "register_operand" "d")
- (xor:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_uns_arith_operand" "K")))]
- "TARGET_64BIT"
- "xori\\t%0,%1,%x2"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_insn "*norsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (and:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
- (not:SI (match_operand:SI 2 "register_operand" "d"))))]
- ""
- "nor\\t%0,%z1,%z2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "*nordi3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (and:DI (not:DI (match_operand:DI 1 "se_register_operand" "d"))
- (not:DI (match_operand:DI 2 "se_register_operand" "d"))))]
- ""
- "*
-{
- if (TARGET_64BIT)
- return \"nor\\t%0,%z1,%z2\";
- return \"nor\\t%M0,%M1,%M2\;nor\\t%L0,%L1,%L2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set (attr "length")
- (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int 0))
- (const_int 1)
- (const_int 2)))])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (and:DI (not:DI (match_operand:DI 1 "register_operand" ""))
- (not:DI (match_operand:DI 2 "register_operand" ""))))]
- "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
- && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
-
- [(set (subreg:SI (match_dup 0) 0) (and:SI (not:SI (subreg:SI (match_dup 1) 0)) (not:SI (subreg:SI (match_dup 2) 0))))
- (set (subreg:SI (match_dup 0) 1) (and:SI (not:SI (subreg:SI (match_dup 1) 1)) (not:SI (subreg:SI (match_dup 2) 1))))]
- "")
-
-;;
-;; ....................
-;;
-;; TRUNCATION
-;;
-;; ....................
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "cvt.s.d\\t%0,%1"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn "truncdisi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI (match_operand:DI 1 "se_register_operand" "d")))]
- "TARGET_64BIT"
- "dsll\\t%0,%1,32\;dsra\\t%0,%0,32"
- [(set_attr "type" "darith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-(define_insn "truncdihi2"
- [(set (match_operand:HI 0 "register_operand" "=d")
- (truncate:HI (match_operand:DI 1 "se_register_operand" "d")))]
- "TARGET_64BIT"
- "andi\\t%0,%1,0xffff"
- [(set_attr "type" "darith")
- (set_attr "mode" "HI")
- (set_attr "length" "1")])
-
-(define_insn "truncdiqi2"
- [(set (match_operand:QI 0 "register_operand" "=d")
- (truncate:QI (match_operand:DI 1 "se_register_operand" "d")))]
- "TARGET_64BIT"
- "andi\\t%0,%1,0x00ff"
- [(set_attr "type" "darith")
- (set_attr "mode" "QI")
- (set_attr "length" "1")])
-
-;; Combiner patterns to optimize shift/truncate combinations.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI (ashiftrt:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "small_int" "I"))))]
- "TARGET_64BIT"
- "*
-{
- int shift_amt = INTVAL (operands[2]) & 0x3f;
-
- if (shift_amt < 32)
- {
- operands[2] = GEN_INT (32 - shift_amt);
- return \"dsll\\t%0,%1,%2\;dsra\\t%0,%0,32\";
- }
- else
- {
- operands[2] = GEN_INT (shift_amt);
- return \"dsra\\t%0,%1,%2\";
- }
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI (lshiftrt:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "small_int" "I"))))]
- "TARGET_64BIT"
- "*
-{
- int shift_amt = INTVAL (operands[2]) & 0x3f;
-
- if (shift_amt < 32)
- {
- operands[2] = GEN_INT (32 - shift_amt);
- return \"dsll\\t%0,%1,%2\;dsra\\t%0,%0,32\";
- }
- else if (shift_amt == 32)
- return \"dsra\\t%0,%1,32\";
- else
- {
- operands[2] = GEN_INT (shift_amt);
- return \"dsrl\\t%0,%1,%2\";
- }
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (truncate:SI (ashift:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "small_int" "I"))))]
- "TARGET_64BIT"
- "*
-{
- int shift_amt = INTVAL (operands[2]) & 0x3f;
-
- if (shift_amt < 32)
- {
- operands[2] = GEN_INT (32 + shift_amt);
- return \"dsll\\t%0,%1,%2\;dsra\\t%0,%0,32\";
- }
- else
- return \"move\\t%0,%.\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-;; Combiner patterns to optimize truncate/zero_extend combinations.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (zero_extend:SI (truncate:HI
- (match_operand:DI 1 "se_register_operand" "d"))))]
- "TARGET_64BIT"
- "andi\\t%0,%1,0xffff"
- [(set_attr "type" "darith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d")
- (zero_extend:SI (truncate:QI
- (match_operand:DI 1 "se_register_operand" "d"))))]
- "TARGET_64BIT"
- "andi\\t%0,%1,0xff"
- [(set_attr "type" "darith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=d")
- (zero_extend:HI (truncate:QI
- (match_operand:DI 1 "se_register_operand" "d"))))]
- "TARGET_64BIT"
- "andi\\t%0,%1,0xff"
- [(set_attr "type" "darith")
- (set_attr "mode" "HI")
- (set_attr "length" "1")])
-
-;;
-;; ....................
-;;
-;; ZERO EXTENSION
-;;
-;; ....................
-
-;; Extension insns.
-;; Those for integer source operand are ordered widest source type first.
-
-(define_expand "zero_extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
- "TARGET_64BIT"
- "
-{
- if (optimize && GET_CODE (operands[1]) == MEM)
- operands[1] = force_not_mem (operands[1]);
-
- if (GET_CODE (operands[1]) != MEM)
- {
- rtx op1 = gen_lowpart (DImode, operands[1]);
- rtx temp = gen_reg_rtx (DImode);
- rtx shift = gen_rtx (CONST_INT, VOIDmode, 32);
-
- emit_insn (gen_ashldi3 (temp, op1, shift));
- emit_insn (gen_lshrdi3 (operands[0], temp, shift));
- DONE;
- }
-}")
-
-(define_insn "zero_extendsidi2_internal"
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (zero_extend:DI (match_operand:SI 1 "memory_operand" "R,m")))]
- "TARGET_64BIT"
- "* return mips_move_1word (operands, insn, TRUE);"
- [(set_attr "type" "load")
- (set_attr "mode" "DI")
- (set_attr "length" "1,2")])
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=d,d,d")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"andi\\t%0,%1,0xffff\";
- else
- return mips_move_1word (operands, insn, TRUE);
-}"
- [(set_attr "type" "arith,load,load")
- (set_attr "mode" "SI")
- (set_attr "length" "1,1,2")])
-
-(define_insn "zero_extendhidi2"
- [(set (match_operand:DI 0 "register_operand" "=d,d,d")
- (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
- "TARGET_64BIT"
- "*
-{
- if (which_alternative == 0)
- return \"andi\\t%0,%1,0xffff\";
- else
- return mips_move_1word (operands, insn, TRUE);
-}"
- [(set_attr "type" "arith,load,load")
- (set_attr "mode" "DI")
- (set_attr "length" "1,1,2")])
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=d,d,d")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"andi\\t%0,%1,0x00ff\";
- else
- return mips_move_1word (operands, insn, TRUE);
-}"
- [(set_attr "type" "arith,load,load")
- (set_attr "mode" "HI")
- (set_attr "length" "1,1,2")])
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=d,d,d")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"andi\\t%0,%1,0x00ff\";
- else
- return mips_move_1word (operands, insn, TRUE);
-}"
- [(set_attr "type" "arith,load,load")
- (set_attr "mode" "SI")
- (set_attr "length" "1,1,2")])
-
-(define_insn "zero_extendqidi2"
- [(set (match_operand:DI 0 "register_operand" "=d,d,d")
- (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
- "TARGET_64BIT"
- "*
-{
- if (which_alternative == 0)
- return \"andi\\t%0,%1,0x00ff\";
- else
- return mips_move_1word (operands, insn, TRUE);
-}"
- [(set_attr "type" "arith,load,load")
- (set_attr "mode" "DI")
- (set_attr "length" "1,1,2")])
-
-
-;;
-;; ....................
-;;
-;; SIGN EXTENSION
-;;
-;; ....................
-
-;; Extension insns.
-;; Those for integer source operand are ordered widest source type first.
-
-;; In 64 bit mode, 32 bit values in general registers are always
-;; correctly sign extended. That means that if the target is a
-;; general register, we can sign extend from SImode to DImode just by
-;; doing a move.
-
-(define_insn "extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "=d,*d,d,d")
- (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,*x,R,m")))]
- "TARGET_64BIT"
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "move,hilo,load,load")
- (set_attr "mode" "DI")
- (set_attr "length" "1,1,1,2")])
-
-;; These patterns originally accepted general_operands, however, slightly
-;; better code is generated by only accepting register_operands, and then
-;; letting combine generate the lh and lb insns.
-
-(define_expand "extendhidi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
- "TARGET_64BIT"
- "
-{
- if (optimize && GET_CODE (operands[1]) == MEM)
- operands[1] = force_not_mem (operands[1]);
-
- if (GET_CODE (operands[1]) != MEM)
- {
- rtx op1 = gen_lowpart (DImode, operands[1]);
- rtx temp = gen_reg_rtx (DImode);
- rtx shift = gen_rtx (CONST_INT, VOIDmode, 48);
-
- emit_insn (gen_ashldi3 (temp, op1, shift));
- emit_insn (gen_ashrdi3 (operands[0], temp, shift));
- DONE;
- }
-}")
-
-(define_insn "extendhidi2_internal"
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (sign_extend:DI (match_operand:HI 1 "memory_operand" "R,m")))]
- "TARGET_64BIT"
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "load")
- (set_attr "mode" "DI")
- (set_attr "length" "1,2")])
-
-(define_expand "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (optimize && GET_CODE (operands[1]) == MEM)
- operands[1] = force_not_mem (operands[1]);
-
- if (GET_CODE (operands[1]) != MEM)
- {
- rtx op1 = gen_lowpart (SImode, operands[1]);
- rtx temp = gen_reg_rtx (SImode);
- rtx shift = gen_rtx (CONST_INT, VOIDmode, 16);
-
- emit_insn (gen_ashlsi3 (temp, op1, shift));
- emit_insn (gen_ashrsi3 (operands[0], temp, shift));
- DONE;
- }
-}")
-
-(define_insn "extendhisi2_internal"
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,m")))]
- ""
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "load")
- (set_attr "mode" "SI")
- (set_attr "length" "1,2")])
-
-(define_expand "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (optimize && GET_CODE (operands[1]) == MEM)
- operands[1] = force_not_mem (operands[1]);
-
- if (GET_CODE (operands[1]) != MEM)
- {
- rtx op0 = gen_lowpart (SImode, operands[0]);
- rtx op1 = gen_lowpart (SImode, operands[1]);
- rtx temp = gen_reg_rtx (SImode);
- rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
-
- emit_insn (gen_ashlsi3 (temp, op1, shift));
- emit_insn (gen_ashrsi3 (op0, temp, shift));
- DONE;
- }
-}")
-
-(define_insn "extendqihi2_internal"
- [(set (match_operand:HI 0 "register_operand" "=d,d")
- (sign_extend:HI (match_operand:QI 1 "memory_operand" "R,m")))]
- ""
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "load")
- (set_attr "mode" "SI")
- (set_attr "length" "1,2")])
-
-
-(define_expand "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
- ""
- "
-{
- if (optimize && GET_CODE (operands[1]) == MEM)
- operands[1] = force_not_mem (operands[1]);
-
- if (GET_CODE (operands[1]) != MEM)
- {
- rtx op1 = gen_lowpart (SImode, operands[1]);
- rtx temp = gen_reg_rtx (SImode);
- rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
-
- emit_insn (gen_ashlsi3 (temp, op1, shift));
- emit_insn (gen_ashrsi3 (operands[0], temp, shift));
- DONE;
- }
-}")
-
-(define_insn "extendqisi2_insn"
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (sign_extend:SI (match_operand:QI 1 "memory_operand" "R,m")))]
- ""
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "load")
- (set_attr "mode" "SI")
- (set_attr "length" "1,2")])
-
-(define_expand "extendqidi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
- "TARGET_64BIT"
- "
-{
- if (optimize && GET_CODE (operands[1]) == MEM)
- operands[1] = force_not_mem (operands[1]);
-
- if (GET_CODE (operands[1]) != MEM)
- {
- rtx op1 = gen_lowpart (DImode, operands[1]);
- rtx temp = gen_reg_rtx (DImode);
- rtx shift = gen_rtx (CONST_INT, VOIDmode, 56);
-
- emit_insn (gen_ashldi3 (temp, op1, shift));
- emit_insn (gen_ashrdi3 (operands[0], temp, shift));
- DONE;
- }
-}")
-
-(define_insn "extendqidi2_insn"
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (sign_extend:DI (match_operand:QI 1 "memory_operand" "R,m")))]
- "TARGET_64BIT"
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "load")
- (set_attr "mode" "DI")
- (set_attr "length" "1,2")])
-
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "cvt.d.s\\t%0,%1"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-
-
-;;
-;; ....................
-;;
-;; CONVERSIONS
-;;
-;; ....................
-
-;; The SImode scratch register can not be shared with address regs used for
-;; operand zero, because then the address in the move instruction will be
-;; clobbered. We mark the scratch register as early clobbered to prevent this.
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
- (fix:SI (match_operand:DF 1 "register_operand" "f,*f,f,f")))
- (clobber (match_scratch:SI 2 "=d,*d,&d,&d"))
- (clobber (match_scratch:DF 3 "=f,*X,f,f"))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "*
-{
- rtx xoperands[10];
-
- if (which_alternative == 1)
- return \"trunc.w.d %0,%1,%2\";
-
- output_asm_insn (\"trunc.w.d %3,%1,%2\", operands);
-
- xoperands[0] = operands[0];
- xoperands[1] = operands[3];
- output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
- return \"\";
-}"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "DF")
- (set_attr "length" "11,9,10,11")])
-
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
- (fix:SI (match_operand:SF 1 "register_operand" "f,*f,f,f")))
- (clobber (match_scratch:SI 2 "=d,*d,&d,&d"))
- (clobber (match_scratch:SF 3 "=f,*X,f,f"))]
- "TARGET_HARD_FLOAT"
- "*
-{
- rtx xoperands[10];
-
- if (which_alternative == 1)
- return \"trunc.w.s %0,%1,%2\";
-
- output_asm_insn (\"trunc.w.s %3,%1,%2\", operands);
-
- xoperands[0] = operands[0];
- xoperands[1] = operands[3];
- output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
- return \"\";
-}"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "SF")
- (set_attr "length" "11,9,10,11")])
-
-
-;;; ??? trunc.l.d is mentioned in the appendix of the 1993 r4000/r4600 manuals
-;;; but not in the chapter that describes the FPU. It is not mentioned at all
-;;; in the 1991 manuals. The r4000 at Cygnus does not have this instruction.
-
-;;; Deleting this means that we now need two libgcc2.a libraries. One for
-;;; the 32 bit calling convention and one for the 64 bit calling convention.
-
-;;; If this is disabled, then fixuns_truncdfdi2 must be disabled also.
-
-(define_insn "fix_truncdfdi2"
- [(set (match_operand:DI 0 "general_operand" "=d,*f,R,o")
- (fix:DI (match_operand:DF 1 "register_operand" "f,*f,f,f")))
- (clobber (match_scratch:DF 2 "=f,*X,f,f"))]
- "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
- "*
-{
- rtx xoperands[10];
-
- if (which_alternative == 1)
- return \"trunc.l.d %0,%1\";
-
- output_asm_insn (\"trunc.l.d %2,%1\", operands);
-
- xoperands[0] = operands[0];
- xoperands[1] = operands[2];
- output_asm_insn (mips_move_2words (xoperands, insn, FALSE), xoperands);
- return \"\";
-}"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "DF")
- (set_attr "length" "2,1,2,3")])
-
-
-;;; ??? trunc.l.s is mentioned in the appendix of the 1993 r4000/r4600 manuals
-;;; but not in the chapter that describes the FPU. It is not mentioned at all
-;;; in the 1991 manuals. The r4000 at Cygnus does not have this instruction.
-(define_insn "fix_truncsfdi2"
- [(set (match_operand:DI 0 "general_operand" "=d,*f,R,o")
- (fix:DI (match_operand:SF 1 "register_operand" "f,*f,f,f")))
- (clobber (match_scratch:DF 2 "=f,*X,f,f"))]
- "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
- "*
-{
- rtx xoperands[10];
-
- if (which_alternative == 1)
- return \"trunc.l.s %0,%1\";
-
- output_asm_insn (\"trunc.l.s %2,%1\", operands);
-
- xoperands[0] = operands[0];
- xoperands[1] = operands[2];
- output_asm_insn (mips_move_2words (xoperands, insn, FALSE), xoperands);
- return \"\";
-}"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "SF")
- (set_attr "length" "2,1,2,3")])
-
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=f,f,f")
- (float:DF (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "*
-{
- dslots_load_total++;
- if (GET_CODE (operands[1]) == MEM)
- return \"l.s\\t%0,%1%#\;cvt.d.w\\t%0,%0\";
-
- return \"mtc1\\t%1,%0%#\;cvt.d.w\\t%0,%0\";
-}"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "DF")
- (set_attr "length" "3,4,3")])
-
-
-(define_insn "floatdidf2"
- [(set (match_operand:DF 0 "register_operand" "=f,f,f")
- (float:DF (match_operand:DI 1 "se_nonimmediate_operand" "d,R,m")))]
- "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
- "*
-{
- dslots_load_total++;
- if (GET_CODE (operands[1]) == MEM)
- return \"l.d\\t%0,%1%#\;cvt.d.l\\t%0,%0\";
-
- return \"dmtc1\\t%1,%0%#\;cvt.d.l\\t%0,%0\";
-}"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "DF")
- (set_attr "length" "3,4,3")])
-
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "=f,f,f")
- (float:SF (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))]
- "TARGET_HARD_FLOAT"
- "*
-{
- dslots_load_total++;
- if (GET_CODE (operands[1]) == MEM)
- return \"l.s\\t%0,%1%#\;cvt.s.w\\t%0,%0\";
-
- return \"mtc1\\t%1,%0%#\;cvt.s.w\\t%0,%0\";
-}"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "SF")
- (set_attr "length" "3,4,3")])
-
-
-(define_insn "floatdisf2"
- [(set (match_operand:SF 0 "register_operand" "=f,f,f")
- (float:SF (match_operand:DI 1 "se_nonimmediate_operand" "d,R,m")))]
- "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
- "*
-{
- dslots_load_total++;
- if (GET_CODE (operands[1]) == MEM)
- return \"l.d\\t%0,%1%#\;cvt.s.l\\t%0,%0\";
-
- return \"dmtc1\\t%1,%0%#\;cvt.s.l\\t%0,%0\";
-}"
- [(set_attr "type" "fcvt")
- (set_attr "mode" "SF")
- (set_attr "length" "3,4,3")])
-
-
-(define_expand "fixuns_truncdfsi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "
-{
- rtx reg1 = gen_reg_rtx (DFmode);
- rtx reg2 = gen_reg_rtx (DFmode);
- rtx reg3 = gen_reg_rtx (SImode);
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
- REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
-
- if (reg1) /* turn off complaints about unreached code */
- {
- emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
- do_pending_stack_adjust ();
-
- emit_insn (gen_cmpdf (operands[1], reg1));
- emit_jump_insn (gen_bge (label1));
-
- emit_insn (gen_fix_truncdfsi2 (operands[0], operands[1]));
- emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
- gen_rtx (LABEL_REF, VOIDmode, label2)));
- emit_barrier ();
-
- emit_label (label1);
- emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[1], reg1));
- emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
-
- emit_insn (gen_fix_truncdfsi2 (operands[0], reg2));
- emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
-
- emit_label (label2);
-
- /* allow REG_NOTES to be set on last insn (labels don't have enough
- fields, and can't be used for REG_NOTES anyway). */
- emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
- DONE;
- }
-}")
-
-
-(define_expand "fixuns_truncdfdi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
- "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
- "
-{
- rtx reg1 = gen_reg_rtx (DFmode);
- rtx reg2 = gen_reg_rtx (DFmode);
- rtx reg3 = gen_reg_rtx (DImode);
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
- REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 63);
-
- if (reg1) /* turn off complaints about unreached code */
- {
- emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
- do_pending_stack_adjust ();
-
- emit_insn (gen_cmpdf (operands[1], reg1));
- emit_jump_insn (gen_bge (label1));
-
- emit_insn (gen_fix_truncdfdi2 (operands[0], operands[1]));
- emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
- gen_rtx (LABEL_REF, VOIDmode, label2)));
- emit_barrier ();
-
- emit_label (label1);
- emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[1], reg1));
- emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
- emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (32)));
-
- emit_insn (gen_fix_truncdfdi2 (operands[0], reg2));
- emit_insn (gen_iordi3 (operands[0], operands[0], reg3));
-
- emit_label (label2);
-
- /* allow REG_NOTES to be set on last insn (labels don't have enough
- fields, and can't be used for REG_NOTES anyway). */
- emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
- DONE;
- }
-}")
-
-
-(define_expand "fixuns_truncsfsi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
- "TARGET_HARD_FLOAT"
- "
-{
- rtx reg1 = gen_reg_rtx (SFmode);
- rtx reg2 = gen_reg_rtx (SFmode);
- rtx reg3 = gen_reg_rtx (SImode);
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
- REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
-
- if (reg1) /* turn off complaints about unreached code */
- {
- emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
- do_pending_stack_adjust ();
-
- emit_insn (gen_cmpsf (operands[1], reg1));
- emit_jump_insn (gen_bge (label1));
-
- emit_insn (gen_fix_truncsfsi2 (operands[0], operands[1]));
- emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
- gen_rtx (LABEL_REF, VOIDmode, label2)));
- emit_barrier ();
-
- emit_label (label1);
- emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[1], reg1));
- emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
-
- emit_insn (gen_fix_truncsfsi2 (operands[0], reg2));
- emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
-
- emit_label (label2);
-
- /* allow REG_NOTES to be set on last insn (labels don't have enough
- fields, and can't be used for REG_NOTES anyway). */
- emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
- DONE;
- }
-}")
-
-
-(define_expand "fixuns_truncsfdi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
- "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
- "
-{
- rtx reg1 = gen_reg_rtx (SFmode);
- rtx reg2 = gen_reg_rtx (SFmode);
- rtx reg3 = gen_reg_rtx (DImode);
- rtx label1 = gen_label_rtx ();
- rtx label2 = gen_label_rtx ();
- REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 63);
-
- if (reg1) /* turn off complaints about unreached code */
- {
- emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
- do_pending_stack_adjust ();
-
- emit_insn (gen_cmpsf (operands[1], reg1));
- emit_jump_insn (gen_bge (label1));
-
- emit_insn (gen_fix_truncsfdi2 (operands[0], operands[1]));
- emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
- gen_rtx (LABEL_REF, VOIDmode, label2)));
- emit_barrier ();
-
- emit_label (label1);
- emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[1], reg1));
- emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
- emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (32)));
-
- emit_insn (gen_fix_truncsfdi2 (operands[0], reg2));
- emit_insn (gen_iordi3 (operands[0], operands[0], reg3));
-
- emit_label (label2);
-
- /* allow REG_NOTES to be set on last insn (labels don't have enough
- fields, and can't be used for REG_NOTES anyway). */
- emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
- DONE;
- }
-}")
-
-
-;;
-;; ....................
-;;
-;; DATA MOVEMENT
-;;
-;; ....................
-
-;; Bit field extract patterns which use lwl/lwr.
-
-;; ??? There should be DImode variants for 64 bit code, but the current
-;; bitfield scheme can't handle that. We would need to add new optabs
-;; in order to make that work.
-
-;; ??? There could be HImode variants for the ulh/ulhu/ush macros.
-;; It isn't clear whether this will give better code.
-
-(define_expand "extv"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extract:SI (match_operand:QI 1 "memory_operand" "")
- (match_operand:SI 2 "immediate_operand" "")
- (match_operand:SI 3 "immediate_operand" "")))]
- ""
- "
-{
- /* If this isn't a 32 bit field, and it doesn't start on a byte boundary
- then fail. */
- if (INTVAL (operands[2]) != 32 || (INTVAL (operands[3]) % 8) != 0)
- FAIL;
-
- /* This can happen for a 64 bit target, when extracting a value from
- a 64 bit union member. extract_bit_field doesn't verify that our
- source matches the predicate, so we force it to be a MEM here. */
- if (GET_CODE (operands[1]) != MEM)
- FAIL;
-
- /* Otherwise, emit a lwl/lwr pair to load the value. */
- emit_insn (gen_movsi_ulw (operands[0], operands[1]));
- DONE;
-}")
-
-(define_expand "extzv"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extract:SI (match_operand:QI 1 "memory_operand" "")
- (match_operand:SI 2 "immediate_operand" "")
- (match_operand:SI 3 "immediate_operand" "")))]
- ""
- "
-{
- /* If this isn't a 32 bit field, and it doesn't start on a byte boundary
- then fail. */
- if (INTVAL (operands[2]) != 32 || (INTVAL (operands[3]) % 8) != 0)
- FAIL;
-
- /* This can happen for a 64 bit target, when extracting a value from
- a 64 bit union member. extract_bit_field doesn't verify that our
- source matches the predicate, so we force it to be a MEM here. */
- if (GET_CODE (operands[1]) != MEM)
- FAIL;
-
- /* Otherwise, emit a lwl/lwr pair to load the value. */
- emit_insn (gen_movsi_ulw (operands[0], operands[1]));
- DONE;
-}")
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "")
- (match_operand:SI 1 "immediate_operand" "")
- (match_operand:SI 2 "immediate_operand" ""))
- (match_operand:SI 3 "register_operand" ""))]
- ""
- "
-{
- /* If this isn't a 32 bit field, and it doesn't start on a byte boundary
- then fail. */
- if (INTVAL (operands[1]) != 32 || (INTVAL (operands[2]) % 8) != 0)
- FAIL;
-
- /* This can happen for a 64 bit target, when storing into a 32 bit union
- member. store_bit_field doesn't verify that our target matches the
- predicate, so we force it to be a MEM here. */
- if (GET_CODE (operands[0]) != MEM)
- FAIL;
-
- /* Otherwise, emit a swl/swr pair to load the value. */
- emit_insn (gen_movsi_usw (operands[0], operands[3]));
- DONE;
-}")
-
-;; unaligned word moves generated by the bit field patterns
-
-(define_insn "movsi_ulw"
- [(set (match_operand:SI 0 "register_operand" "=&d,&d")
- (unspec [(match_operand:QI 1 "general_operand" "R,o")] 0))]
- ""
- "*
-{
- rtx offset = const0_rtx;
- rtx addr = XEXP (operands[1], 0);
- rtx mem_addr = eliminate_constant_term (addr, &offset);
- char *ret;
-
- if (TARGET_STATS)
- mips_count_memory_refs (operands[1], 2);
-
- /* The stack/frame pointers are always aligned, so we can convert
- to the faster lw if we are referencing an aligned stack location. */
-
- if ((INTVAL (offset) & 3) == 0
- && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
- ret = \"lw\\t%0,%1\";
- else
- ret = \"ulw\\t%0,%1\";
-
- return mips_fill_delay_slot (ret, DELAY_LOAD, operands, insn);
-}"
- [(set_attr "type" "load,load")
- (set_attr "mode" "SI")
- (set_attr "length" "2,4")])
-
-(define_insn "movsi_usw"
- [(set (match_operand:QI 0 "memory_operand" "=R,o")
- (unspec [(match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")] 1))]
- ""
- "*
-{
- rtx offset = const0_rtx;
- rtx addr = XEXP (operands[0], 0);
- rtx mem_addr = eliminate_constant_term (addr, &offset);
-
- if (TARGET_STATS)
- mips_count_memory_refs (operands[0], 2);
-
- /* The stack/frame pointers are always aligned, so we can convert
- to the faster sw if we are referencing an aligned stack location. */
-
- if ((INTVAL (offset) & 3) == 0
- && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
- return \"sw\\t%1,%0\";
-
- return \"usw\\t%z1,%0\";
-}"
- [(set_attr "type" "store")
- (set_attr "mode" "SI")
- (set_attr "length" "2,4")])
-
-;; These two patterns support loading addresses with two instructions instead
-;; of using the macro instruction la.
-
-;; ??? mips_move_1word has support for HIGH, so this pattern may be
-;; unnecessary.
-
-(define_insn "high"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (match_operand:SI 1 "immediate_operand" "")))]
- "mips_split_addresses"
- "lui\\t%0,%%hi(%1) # high"
- [(set_attr "type" "move")
- (set_attr "length" "1")])
-
-(define_insn "low"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "")))]
- "mips_split_addresses"
- "addiu\\t%0,%1,%%lo(%2) # low"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-;; 64-bit integer moves
-
-;; Unlike most other insns, the move insns can't be split with
-;; different predicates, because register spilling and other parts of
-;; the compiler, have memoized the insn number already.
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "nonimmediate_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{
- if (mips_split_addresses && mips_check_split (operands[1], DImode))
- {
- enum machine_mode mode = GET_MODE (operands[0]);
- rtx tem = ((reload_in_progress | reload_completed)
- ? operands[0] : gen_reg_rtx (mode));
-
- emit_insn (gen_rtx (SET, VOIDmode, tem,
- gen_rtx (HIGH, mode, operands[1])));
-
- operands[1] = gen_rtx (LO_SUM, mode, tem, operands[1]);
- }
-
- /* If we are generating embedded PIC code, and we are referring to a
- symbol in the .text section, we must use an offset from the start
- of the function. */
- if (TARGET_EMBEDDED_PIC
- && (GET_CODE (operands[1]) == LABEL_REF
- || (GET_CODE (operands[1]) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (operands[1]))))
- {
- rtx temp;
-
- temp = embedded_pic_offset (operands[1]);
- temp = gen_rtx (PLUS, Pmode, embedded_pic_fnaddr_rtx,
- force_reg (DImode, temp));
- emit_move_insn (operands[0], force_reg (DImode, temp));
- DONE;
- }
-
- /* If operands[1] is a constant address illegal for pic, then we need to
- handle it just like LEGITIMIZE_ADDRESS does. */
- if (flag_pic && pic_address_needs_scratch (operands[1]))
- {
- rtx temp = force_reg (DImode, XEXP (XEXP (operands[1], 0), 0));
- rtx temp2 = XEXP (XEXP (operands[1], 0), 1);
-
- if (! SMALL_INT (temp2))
- temp2 = force_reg (DImode, temp2);
-
- emit_move_insn (operands[0], gen_rtx (PLUS, DImode, temp, temp2));
- DONE;
- }
-
- if ((reload_in_progress | reload_completed) == 0
- && !register_operand (operands[0], DImode)
- && !register_operand (operands[1], DImode)
- && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
- && operands[1] != CONST0_RTX (DImode))
- {
- rtx temp = force_reg (DImode, operands[1]);
- emit_move_insn (operands[0], temp);
- DONE;
- }
-}")
-
-(define_insn "movdi_internal"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,R,o,*d,*x")
- (match_operand:DI 1 "general_operand" "d,iF,R,o,d,d,*x,*d"))]
- "!TARGET_64BIT
- && (register_operand (operands[0], DImode)
- || register_operand (operands[1], DImode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
- || operands[1] == CONST0_RTX (DImode))"
- "* return mips_move_2words (operands, insn); "
- [(set_attr "type" "move,arith,load,load,store,store,hilo,hilo")
- (set_attr "mode" "DI")
- (set_attr "length" "2,4,2,4,2,4,2,2")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (match_operand:DI 1 "register_operand" ""))]
- "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
-
- [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
- (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
- "")
-
-(define_insn "movdi_internal2"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*x,*a")
- (match_operand:DI 1 "movdi_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*x,*d,*I"))]
- "TARGET_64BIT
- && (register_operand (operands[0], DImode)
- || se_register_operand (operands[1], DImode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
- || operands[1] == CONST0_RTX (DImode))"
- "* return mips_move_2words (operands, insn); "
- [(set_attr "type" "move,load,arith,arith,load,load,store,store,hilo,hilo,hilo")
- (set_attr "mode" "DI")
- (set_attr "length" "1,2,1,2,1,2,1,2,1,1,2")])
-
-;; Handle input reloads in DImode.
-;; This is mainly to handle reloading HILO_REGNUM. Note that we may
-;; see it as the source or the destination, depending upon which way
-;; reload handles the instruction.
-;; Making the second operand TImode is a trick. The compiler may
-;; reuse the same register for operand 0 and operand 2. Using TImode
-;; gives us two registers, so we can always use the one which is not
-;; used.
-
-(define_expand "reload_indi"
- [(set (match_operand:DI 0 "register_operand" "=b")
- (match_operand:DI 1 "movdi_operand" "b"))
- (clobber (match_operand:TI 2 "register_operand" "=&d"))]
- "TARGET_64BIT"
- "
-{
- rtx scratch = gen_rtx (REG, DImode,
- (REGNO (operands[0]) == REGNO (operands[2])
- ? REGNO (operands[2]) + 1
- : REGNO (operands[2])));
-
- if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == HILO_REGNUM)
- {
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx memword, offword, hiword, loword;
-
- scratch = gen_rtx (REG, SImode, REGNO (scratch));
- memword = change_address (operands[1], SImode, NULL_RTX);
- offword = change_address (adj_offsettable_operand (operands[1], 4),
- SImode, NULL_RTX);
- if (BYTES_BIG_ENDIAN)
- {
- hiword = memword;
- loword = offword;
- }
- else
- {
- hiword = offword;
- loword = memword;
- }
- emit_move_insn (scratch, hiword);
- emit_move_insn (gen_rtx (REG, SImode, 64), scratch);
- emit_move_insn (scratch, loword);
- emit_move_insn (gen_rtx (REG, SImode, 65), scratch);
- }
- else
- {
- emit_insn (gen_ashrdi3 (scratch, operands[1], GEN_INT (32)));
- emit_insn (gen_movdi (gen_rtx (REG, DImode, 64), scratch));
- emit_insn (gen_ashldi3 (scratch, operands[1], GEN_INT (32)));
- emit_insn (gen_ashrdi3 (scratch, scratch, GEN_INT (32)));
- emit_insn (gen_movdi (gen_rtx (REG, DImode, 65), scratch));
- }
- DONE;
- }
- if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == HILO_REGNUM)
- {
- emit_insn (gen_movdi (scratch, gen_rtx (REG, DImode, 65)));
- emit_insn (gen_ashldi3 (scratch, scratch, GEN_INT (32)));
- emit_insn (gen_lshrdi3 (scratch, scratch, GEN_INT (32)));
- emit_insn (gen_movdi (operands[0], gen_rtx (REG, DImode, 64)));
- emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
- emit_insn (gen_iordi3 (operands[0], operands[0], scratch));
- DONE;
- }
- /* This handles moves between a float register and HI/LO. */
- emit_move_insn (scratch, operands[1]);
- emit_move_insn (operands[0], scratch);
- DONE;
-}")
-
-;; Handle output reloads in DImode.
-
-(define_expand "reload_outdi"
- [(set (match_operand:DI 0 "general_operand" "=b")
- (match_operand:DI 1 "se_register_operand" "b"))
- (clobber (match_operand:DI 2 "register_operand" "=&d"))]
- "TARGET_64BIT"
- "
-{
- if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == HILO_REGNUM)
- {
- emit_insn (gen_ashrdi3 (operands[2], operands[1], GEN_INT (32)));
- emit_insn (gen_movdi (gen_rtx (REG, DImode, 64), operands[2]));
- emit_insn (gen_ashldi3 (operands[2], operands[1], GEN_INT (32)));
- emit_insn (gen_ashrdi3 (operands[2], operands[2], GEN_INT (32)));
- emit_insn (gen_movdi (gen_rtx (REG, DImode, 65), operands[2]));
- DONE;
- }
- if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == HILO_REGNUM)
- {
- if (GET_CODE (operands[0]) == MEM)
- {
- rtx scratch, memword, offword, hiword, loword;
-
- scratch = gen_rtx (REG, SImode, REGNO (operands[2]));
- memword = change_address (operands[0], SImode, NULL_RTX);
- offword = change_address (adj_offsettable_operand (operands[0], 4),
- SImode, NULL_RTX);
- if (BYTES_BIG_ENDIAN)
- {
- hiword = memword;
- loword = offword;
- }
- else
- {
- hiword = offword;
- loword = memword;
- }
- emit_move_insn (scratch, gen_rtx (REG, SImode, 64));
- emit_move_insn (hiword, scratch);
- emit_move_insn (scratch, gen_rtx (REG, SImode, 65));
- emit_move_insn (loword, scratch);
- }
- else
- {
- emit_insn (gen_movdi (operands[2], gen_rtx (REG, DImode, 65)));
- emit_insn (gen_ashldi3 (operands[2], operands[2], GEN_INT (32)));
- emit_insn (gen_lshrdi3 (operands[2], operands[2], GEN_INT (32)));
- emit_insn (gen_movdi (operands[0], gen_rtx (REG, DImode, 64)));
- emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
- emit_insn (gen_iordi3 (operands[0], operands[0], operands[2]));
- }
- DONE;
- }
- /* This handles moves between a float register and HI/LO. */
- emit_move_insn (operands[2], operands[1]);
- emit_move_insn (operands[0], operands[2]);
- DONE;
-}")
-
-;; 32-bit Integer moves
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "large_int" ""))]
- "!TARGET_DEBUG_D_MODE"
- [(set (match_dup 0)
- (match_dup 2))
- (set (match_dup 0)
- (ior:SI (match_dup 0)
- (match_dup 3)))]
- "
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff0000);
- operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0x0000ffff);
-}")
-
-;; Unlike most other insns, the move insns can't be split with
-;; different predicates, because register spilling and other parts of
-;; the compiler, have memoized the insn number already.
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "nonimmediate_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (mips_split_addresses && mips_check_split (operands[1], SImode))
- {
- enum machine_mode mode = GET_MODE (operands[0]);
- rtx tem = ((reload_in_progress | reload_completed)
- ? operands[0] : gen_reg_rtx (mode));
-
- emit_insn (gen_rtx (SET, VOIDmode, tem,
- gen_rtx (HIGH, mode, operands[1])));
-
- operands[1] = gen_rtx (LO_SUM, mode, tem, operands[1]);
- }
-
- /* If we are generating embedded PIC code, and we are referring to a
- symbol in the .text section, we must use an offset from the start
- of the function. */
- if (TARGET_EMBEDDED_PIC
- && (GET_CODE (operands[1]) == LABEL_REF
- || (GET_CODE (operands[1]) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (operands[1]))))
- {
- rtx temp;
-
- temp = embedded_pic_offset (operands[1]);
- temp = gen_rtx (PLUS, Pmode, embedded_pic_fnaddr_rtx,
- force_reg (SImode, temp));
- emit_move_insn (operands[0], force_reg (SImode, temp));
- DONE;
- }
-
- /* If operands[1] is a constant address invalid for pic, then we need to
- handle it just like LEGITIMIZE_ADDRESS does. */
- if (flag_pic && pic_address_needs_scratch (operands[1]))
- {
- rtx temp = force_reg (SImode, XEXP (XEXP (operands[1], 0), 0));
- rtx temp2 = XEXP (XEXP (operands[1], 0), 1);
-
- if (! SMALL_INT (temp2))
- temp2 = force_reg (SImode, temp2);
-
- emit_move_insn (operands[0], gen_rtx (PLUS, SImode, temp, temp2));
- DONE;
- }
-
- if ((reload_in_progress | reload_completed) == 0
- && !register_operand (operands[0], SImode)
- && !register_operand (operands[1], SImode)
- && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
- {
- rtx temp = force_reg (SImode, operands[1]);
- emit_move_insn (operands[0], temp);
- DONE;
- }
-}")
-
-;; The difference between these two is whether or not ints are allowed
-;; in FP registers (off by default, use -mdebugh to enable).
-
-(define_insn "movsi_internal1"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*f*z,*f,*f,*f,*R,*m,*x,*x,*d,*d")
- (match_operand:SI 1 "move_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*f*z,*d,*f,*R,*m,*f,*f,I,*d,*x,*a"))]
- "TARGET_DEBUG_H_MODE
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,move,load,load,store,store,hilo,hilo,hilo,hilo")
- (set_attr "mode" "SI")
- (set_attr "length" "1,2,1,2,1,2,1,2,1,1,1,1,2,1,2,1,1,1,1")])
-
-(define_insn "movsi_internal2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*z,*x,*d,*x,*d")
- (match_operand:SI 1 "move_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*z,*d,I,*x,*d,*a"))]
- "!TARGET_DEBUG_H_MODE
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,hilo,hilo,hilo,hilo")
- (set_attr "mode" "SI")
- (set_attr "length" "1,2,1,2,1,2,1,2,1,1,1,1,1,1")])
-
-;; Reload HILO_REGNUM in SI mode. This needs a scratch register in
-;; order to set the sign bit correctly in the HI register.
-
-(define_expand "reload_outsi"
- [(set (match_operand:SI 0 "general_operand" "=b")
- (match_operand:SI 1 "register_operand" "d"))
- (clobber (match_operand:SI 2 "register_operand" "=&d"))]
- "TARGET_64BIT"
- "
-{
- if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == HILO_REGNUM)
- {
- emit_insn (gen_movsi (gen_rtx (REG, SImode, 65), operands[1]));
- emit_insn (gen_ashrsi3 (operands[2], operands[1], GEN_INT (31)));
- emit_insn (gen_movsi (gen_rtx (REG, SImode, 64), operands[2]));
- DONE;
- }
- /* This handles moves between a float register and HI/LO. */
- emit_move_insn (operands[2], operands[1]);
- emit_move_insn (operands[0], operands[2]);
- DONE;
-}")
-
-;; This insn handles moving CCmode values. It's really just a
-;; slightly simplified copy of movsi_internal2, with additional cases
-;; to move a condition register to a general register and to move
-;; between the general registers and the floating point registers.
-
-(define_insn "movcc"
- [(set (match_operand:CC 0 "nonimmediate_operand" "=d,*d,*d,*d,*R,*m,*d,*f,*f,*f,*f,*R,*m")
- (match_operand:CC 1 "general_operand" "z,*d,*R,*m,*d,*d,*f,*d,*f,*R,*m,*f,*f"))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "move,move,load,load,store,store,xfer,xfer,move,load,load,store,store")
- (set_attr "mode" "SI")
- (set_attr "length" "2,1,1,2,1,2,1,1,1,1,2,1,2")])
-
-;; Reload condition code registers. These need scratch registers.
-
-(define_expand "reload_incc"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (match_operand:CC 1 "general_operand" "z"))
- (clobber (match_operand:TF 2 "register_operand" "=&f"))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "
-{
- rtx source;
- rtx fp1, fp2;
-
- /* This is called when are copying some value into a condition code
- register. Operand 0 is the condition code register. Operand 1
- is the source. Operand 2 is a scratch register; we use TFmode
- because we actually need two floating point registers. */
- if (! ST_REG_P (true_regnum (operands[0]))
- || ! FP_REG_P (true_regnum (operands[2])))
- abort ();
-
- /* We need to get the source in SFmode so that the insn is
- recognized. */
- if (GET_CODE (operands[1]) == MEM)
- source = change_address (operands[1], SFmode, NULL_RTX);
- else if (GET_CODE (operands[1]) == REG || GET_CODE (operands[1]) == SUBREG)
- source = gen_rtx (REG, SFmode, true_regnum (operands[1]));
- else
- source = operands[1];
-
- fp1 = gen_rtx (REG, SFmode, REGNO (operands[2]));
- fp2 = gen_rtx (REG, SFmode, REGNO (operands[2]) + 1);
-
- emit_insn (gen_move_insn (fp1, source));
- emit_insn (gen_move_insn (fp2, gen_rtx (REG, SFmode, 0)));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (LT, CCmode, fp2, fp1)));
-
- DONE;
-}")
-
-(define_expand "reload_outcc"
- [(set (match_operand:CC 0 "general_operand" "=z")
- (match_operand:CC 1 "register_operand" "z"))
- (clobber (match_operand:CC 2 "register_operand" "=&d"))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "
-{
- /* This is called when we are copying a condition code register out
- to save it somewhere. Operand 0 should be the location we are
- going to save it to. Operand 1 should be the condition code
- register. Operand 2 should be a scratch general purpose register
- created for us by reload. The mips_secondary_reload_class
- function should have told reload that we don't need a scratch
- register if the destination is a general purpose register anyhow. */
- if (ST_REG_P (true_regnum (operands[0]))
- || GP_REG_P (true_regnum (operands[0]))
- || ! ST_REG_P (true_regnum (operands[1]))
- || ! GP_REG_P (true_regnum (operands[2])))
- abort ();
-
- /* All we have to do is copy the value from the condition code to
- the data register, which movcc can handle, and then store the
- value into the real final destination. */
- emit_insn (gen_move_insn (operands[2], operands[1]));
- emit_insn (gen_move_insn (operands[0], operands[2]));
-
- DONE;
-}")
-
-;; MIPS4 supports loading and storing a floating point register from
-;; the sum of two general registers. We use two versions for each of
-;; these four instructions: one where the two general registers are
-;; SImode, and one where they are DImode. This is because general
-;; registers will be in SImode when they hold 32 bit values, but,
-;; since the 32 bit values are always sign extended, the [ls][wd]xc1
-;; instructions will still work correctly.
-
-;; ??? Perhaps it would be better to support these instructions by
-;; modifying GO_IF_LEGITIMATE_ADDRESS and friends. However, since
-;; these instructions can only be used to load and store floating
-;; point registers, that would probably cause trouble in reload.
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "lwxc1\\t%0,%1(%2)"
- [(set_attr "type" "load")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mem:SF (plus:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "lwxc1\\t%0,%1(%2)"
- [(set_attr "type" "load")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "ldxc1\\t%0,%1(%2)"
- [(set_attr "type" "load")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mem:DF (plus:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d"))))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "ldxc1\\t%0,%1(%2)"
- [(set_attr "type" "load")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (match_operand:SF 0 "register_operand" "=f"))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "swxc1\\t%0,%1(%2)"
- [(set_attr "type" "store")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (mem:SF (plus:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))
- (match_operand:SF 0 "register_operand" "=f"))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "swxc1\\t%0,%1(%2)"
- [(set_attr "type" "store")
- (set_attr "mode" "SF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (match_operand:DF 0 "register_operand" "=f"))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "sdxc1\\t%0,%1(%2)"
- [(set_attr "type" "store")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-(define_insn ""
- [(set (mem:DF (plus:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))
- (match_operand:DF 0 "register_operand" "=f"))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "sdxc1\\t%0,%1(%2)"
- [(set_attr "type" "store")
- (set_attr "mode" "DF")
- (set_attr "length" "1")])
-
-;; 16-bit Integer moves
-
-;; Unlike most other insns, the move insns can't be split with
-;; different predicates, because register spilling and other parts of
-;; the compiler, have memoized the insn number already.
-;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "nonimmediate_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- if ((reload_in_progress | reload_completed) == 0
- && !register_operand (operands[0], HImode)
- && !register_operand (operands[1], HImode)
- && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
- {
- rtx temp = force_reg (HImode, operands[1]);
- emit_move_insn (operands[0], temp);
- DONE;
- }
-}")
-
-;; The difference between these two is whether or not ints are allowed
-;; in FP registers (off by default, use -mdebugh to enable).
-
-(define_insn "movhi_internal1"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f,*f*z,*x,*d")
- (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
- "TARGET_DEBUG_H_MODE
- && (register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
- "* return mips_move_1word (operands, insn, TRUE);"
- [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
- (set_attr "mode" "HI")
- (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
-
-(define_insn "movhi_internal2"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
- (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
- "!TARGET_DEBUG_H_MODE
- && (register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
- "* return mips_move_1word (operands, insn, TRUE);"
- [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
- (set_attr "mode" "HI")
- (set_attr "length" "1,1,1,2,1,2,1,1,1,1")])
-
-
-;; 8-bit Integer moves
-
-;; Unlike most other insns, the move insns can't be split with
-;; different predicates, because register spilling and other parts of
-;; the compiler, have memoized the insn number already.
-;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "nonimmediate_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- if ((reload_in_progress | reload_completed) == 0
- && !register_operand (operands[0], QImode)
- && !register_operand (operands[1], QImode)
- && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
- {
- rtx temp = force_reg (QImode, operands[1]);
- emit_move_insn (operands[0], temp);
- DONE;
- }
-}")
-
-;; The difference between these two is whether or not ints are allowed
-;; in FP registers (off by default, use -mdebugh to enable).
-
-(define_insn "movqi_internal1"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f*z,*f,*x,*d")
- (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
- "TARGET_DEBUG_H_MODE
- && (register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
- "* return mips_move_1word (operands, insn, TRUE);"
- [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
- (set_attr "mode" "QI")
- (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
-
-(define_insn "movqi_internal2"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
- (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
- "!TARGET_DEBUG_H_MODE
- && (register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
- "* return mips_move_1word (operands, insn, TRUE);"
- [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
- (set_attr "mode" "QI")
- (set_attr "length" "1,1,1,2,1,2,1,1,1,1")])
-
-
-;; 32-bit floating point moves
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "nonimmediate_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- if ((reload_in_progress | reload_completed) == 0
- && !register_operand (operands[0], SFmode)
- && !register_operand (operands[1], SFmode)
- && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
- && operands[1] != CONST0_RTX (SFmode))
- {
- rtx temp = force_reg (SFmode, operands[1]);
- emit_move_insn (operands[0], temp);
- DONE;
- }
-}")
-
-(define_insn "movsf_internal1"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,f,R,m,*f,*d,*d,*d,*d,*R,*m")
- (match_operand:SF 1 "general_operand" "f,G,R,Fm,fG,fG,*d,*f,*G*d,*R,*F*m,*d,*d"))]
- "TARGET_HARD_FLOAT
- && (register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
- || operands[1] == CONST0_RTX (SFmode))"
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "move,xfer,load,load,store,store,xfer,xfer,move,load,load,store,store")
- (set_attr "mode" "SF")
- (set_attr "length" "1,1,1,2,1,2,1,1,1,1,2,1,2")])
-
-
-(define_insn "movsf_internal2"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,d,R,m")
- (match_operand:SF 1 "general_operand" " Gd,R,Fm,d,d"))]
- "TARGET_SOFT_FLOAT
- && (register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
- || operands[1] == CONST0_RTX (SFmode))"
- "* return mips_move_1word (operands, insn, FALSE);"
- [(set_attr "type" "move,load,load,store,store")
- (set_attr "mode" "SF")
- (set_attr "length" "1,1,2,1,2")])
-
-
-;; 64-bit floating point moves
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "nonimmediate_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
-{
- if ((reload_in_progress | reload_completed) == 0
- && !register_operand (operands[0], DFmode)
- && !register_operand (operands[1], DFmode)
- && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
- && operands[1] != CONST0_RTX (DFmode))
- {
- rtx temp = force_reg (DFmode, operands[1]);
- emit_move_insn (operands[0], temp);
- DONE;
- }
-}")
-
-(define_insn "movdf_internal1"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,o,f,*f,*d,*d,*d,*d,*R,*o")
- (match_operand:DF 1 "general_operand" "f,R,o,fG,fG,F,*d,*f,*d*G,*R,*o*F,*d,*d"))]
- "TARGET_HARD_FLOAT && !(TARGET_FLOAT64 && !TARGET_64BIT)
- && TARGET_DOUBLE_FLOAT
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
- || operands[1] == CONST0_RTX (DFmode))"
- "* return mips_move_2words (operands, insn); "
- [(set_attr "type" "move,load,load,store,store,load,xfer,xfer,move,load,load,store,store")
- (set_attr "mode" "DF")
- (set_attr "length" "1,2,4,2,4,4,2,2,2,2,4,2,4")])
-
-(define_insn "movdf_internal1a"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,R,R,o,o,f,*d,*d,*d,*o,*R")
- (match_operand:DF 1 "general_operand" " f,o,f,G,f,G,F,*F,*o,*R,*d,*d"))]
- "TARGET_HARD_FLOAT && (TARGET_FLOAT64 && !TARGET_64BIT)
- && TARGET_DOUBLE_FLOAT
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode))
- || (GET_CODE (operands [0]) == MEM
- && ((GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) == 0)
- || operands[1] == CONST0_RTX (DFmode)))"
- "* return mips_move_2words (operands, insn); "
- [(set_attr "type" "move,load,store,store,store,store,load,load,load,load,store,store")
- (set_attr "mode" "DF")
- (set_attr "length" "1,2,1,1,2,2,2,2,2,1,2,1")])
-
-(define_insn "movdf_internal2"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,d,R,o")
- (match_operand:DF 1 "general_operand" "dG,R,oF,d,d"))]
- "(TARGET_SOFT_FLOAT || TARGET_SINGLE_FLOAT)
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode)
- || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
- || operands[1] == CONST0_RTX (DFmode))"
- "* return mips_move_2words (operands, insn); "
- [(set_attr "type" "move,load,load,store,store")
- (set_attr "mode" "DF")
- (set_attr "length" "2,2,4,2,4")])
-
-(define_split
- [(set (match_operand:DF 0 "register_operand" "")
- (match_operand:DF 1 "register_operand" ""))]
- "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
- && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
- [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
- (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
- "")
-
-;; Instructions to load the global pointer register.
-;; This is volatile to make sure that the scheduler won't move any symbol_ref
-;; uses in front of it. All symbol_refs implicitly use the gp reg.
-
-(define_insn "loadgp"
- [(set (reg:DI 28)
- (unspec_volatile [(match_operand:DI 0 "address_operand" "")] 2))
- (clobber (reg:DI 1))]
- ""
- "%[lui\\t$1,%%hi(%%neg(%%gp_rel(%a0)))\\n\\taddiu\\t$1,$1,%%lo(%%neg(%%gp_rel(%a0)))\\n\\tdaddu\\t$gp,$1,$25%]"
- [(set_attr "type" "move")
- (set_attr "mode" "DI")
- (set_attr "length" "3")])
-
-;; Block moves, see mips.c for more details.
-;; Argument 0 is the destination
-;; Argument 1 is the source
-;; Argument 2 is the length
-;; Argument 3 is the alignment
-
-(define_expand "movstrsi"
- [(parallel [(set (mem:BLK (match_operand:BLK 0 "general_operand" ""))
- (mem:BLK (match_operand:BLK 1 "general_operand" "")))
- (use (match_operand:SI 2 "arith32_operand" ""))
- (use (match_operand:SI 3 "immediate_operand" ""))])]
- ""
- "
-{
- if (operands[0]) /* avoid unused code messages */
- {
- expand_block_move (operands);
- DONE;
- }
-}")
-
-;; Insn generated by block moves
-
-(define_insn "movstrsi_internal"
- [(set (match_operand:BLK 0 "memory_operand" "=o") ;; destination
- (match_operand:BLK 1 "memory_operand" "o")) ;; source
- (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
- (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
- (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
- (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
- (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
- (use (match_operand:SI 3 "small_int" "I")) ;; alignment
- (use (const_int 0))] ;; normal block move
- ""
- "* return output_block_move (insn, operands, 4, BLOCK_MOVE_NORMAL);"
- [(set_attr "type" "multi")
- (set_attr "mode" "none")
- (set_attr "length" "20")])
-
-;; Split a block move into 2 parts, the first part is everything
-;; except for the last move, and the second part is just the last
-;; store, which is exactly 1 instruction (ie, not a usw), so it can
-;; fill a delay slot. This also prevents a bug in delayed branches
-;; from showing up, which reuses one of the registers in our clobbers.
-
-(define_split
- [(set (mem:BLK (match_operand:SI 0 "register_operand" ""))
- (mem:BLK (match_operand:SI 1 "register_operand" "")))
- (clobber (match_operand:SI 4 "register_operand" ""))
- (clobber (match_operand:SI 5 "register_operand" ""))
- (clobber (match_operand:SI 6 "register_operand" ""))
- (clobber (match_operand:SI 7 "register_operand" ""))
- (use (match_operand:SI 2 "small_int" ""))
- (use (match_operand:SI 3 "small_int" ""))
- (use (const_int 0))]
-
- "reload_completed && !TARGET_DEBUG_D_MODE && INTVAL (operands[2]) > 0"
-
- ;; All but the last move
- [(parallel [(set (mem:BLK (match_dup 0))
- (mem:BLK (match_dup 1)))
- (clobber (match_dup 4))
- (clobber (match_dup 5))
- (clobber (match_dup 6))
- (clobber (match_dup 7))
- (use (match_dup 2))
- (use (match_dup 3))
- (use (const_int 1))])
-
- ;; The last store, so it can fill a delay slot
- (parallel [(set (mem:BLK (match_dup 0))
- (mem:BLK (match_dup 1)))
- (clobber (match_dup 4))
- (clobber (match_dup 5))
- (clobber (match_dup 6))
- (clobber (match_dup 7))
- (use (match_dup 2))
- (use (match_dup 3))
- (use (const_int 2))])]
-
- "")
-
-(define_insn "movstrsi_internal2"
- [(set (match_operand:BLK 0 "memory_operand" "=o") ;; destination
- (match_operand:BLK 1 "memory_operand" "o")) ;; source
- (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
- (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
- (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
- (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
- (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
- (use (match_operand:SI 3 "small_int" "I")) ;; alignment
- (use (const_int 1))] ;; all but last store
- ""
- "* return output_block_move (insn, operands, 4, BLOCK_MOVE_NOT_LAST);"
- [(set_attr "type" "multi")
- (set_attr "mode" "none")
- (set_attr "length" "20")])
-
-(define_insn "movstrsi_internal3"
- [(set (match_operand:BLK 0 "memory_operand" "=Ro") ;; destination
- (match_operand:BLK 1 "memory_operand" "Ro")) ;; source
- (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
- (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
- (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
- (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
- (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
- (use (match_operand:SI 3 "small_int" "I")) ;; alignment
- (use (const_int 2))] ;; just last store of block move
- ""
- "* return output_block_move (insn, operands, 4, BLOCK_MOVE_LAST);"
- [(set_attr "type" "store")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-
-;;
-;; ....................
-;;
-;; SHIFTS
-;;
-;; ....................
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashift:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
-
- return \"sll\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-
-(define_expand "ashldi3"
- [(parallel [(set (match_operand:DI 0 "register_operand" "")
- (ashift:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:SI 2 "arith_operand" "")))
- (clobber (match_dup 3))])]
- "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
- "
-{
- if (TARGET_64BIT)
- {
- emit_insn (gen_ashldi3_internal4 (operands[0], operands[1],
- operands[2]));
- DONE;
- }
-
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-
-(define_insn "ashldi3_internal"
- [(set (match_operand:DI 0 "register_operand" "=&d")
- (ashift:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
- "*
-{
- operands[4] = const0_rtx;
- dslots_jump_total += 3;
- dslots_jump_filled += 2;
-
- return \"sll\\t%3,%2,26\\n\\
-\\tbgez\\t%3,1f\\n\\
-\\tsll\\t%M0,%L1,%2\\n\\
-\\t%(b\\t3f\\n\\
-\\tmove\\t%L0,%z4%)\\n\\
-\\n\\
-1:\\n\\
-\\t%(beq\\t%3,%z4,2f\\n\\
-\\tsll\\t%M0,%M1,%2%)\\n\\
-\\n\\
-\\tsubu\\t%3,%z4,%2\\n\\
-\\tsrl\\t%3,%L1,%3\\n\\
-\\tor\\t%M0,%M0,%3\\n\\
-2:\\n\\
-\\tsll\\t%L0,%L1,%2\\n\\
-3:\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "SI")
- (set_attr "length" "12")])
-
-
-(define_insn "ashldi3_internal2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashift:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:SI 2 "small_int" "IJK")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
- operands[4] = const0_rtx;
- return \"sll\\t%M0,%L1,%2\;move\\t%L0,%z4\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "2")])
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ashift:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 32) != 0"
-
- [(set (subreg:SI (match_dup 0) 1) (ashift:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
- (set (subreg:SI (match_dup 0) 0) (const_int 0))]
-
- "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ashift:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 32) != 0"
-
- [(set (subreg:SI (match_dup 0) 0) (ashift:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
- (set (subreg:SI (match_dup 0) 1) (const_int 0))]
-
- "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
-
-
-(define_insn "ashldi3_internal3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashift:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:SI 2 "small_int" "IJK")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE
- && (INTVAL (operands[2]) & 63) < 32
- && (INTVAL (operands[2]) & 63) != 0"
- "*
-{
- int amount = INTVAL (operands[2]);
-
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
- operands[4] = const0_rtx;
- operands[5] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
-
- return \"sll\\t%M0,%M1,%2\;srl\\t%3,%L1,%5\;or\\t%M0,%M0,%3\;sll\\t%L0,%L1,%2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "4")])
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ashift:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 63) < 32
- && (INTVAL (operands[2]) & 63) != 0"
-
- [(set (subreg:SI (match_dup 0) 1)
- (ashift:SI (subreg:SI (match_dup 1) 1)
- (match_dup 2)))
-
- (set (match_dup 3)
- (lshiftrt:SI (subreg:SI (match_dup 1) 0)
- (match_dup 4)))
-
- (set (subreg:SI (match_dup 0) 1)
- (ior:SI (subreg:SI (match_dup 0) 1)
- (match_dup 3)))
-
- (set (subreg:SI (match_dup 0) 0)
- (ashift:SI (subreg:SI (match_dup 1) 0)
- (match_dup 2)))]
- "
-{
- int amount = INTVAL (operands[2]);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
-}")
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ashift:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 63) < 32
- && (INTVAL (operands[2]) & 63) != 0"
-
- [(set (subreg:SI (match_dup 0) 0)
- (ashift:SI (subreg:SI (match_dup 1) 0)
- (match_dup 2)))
-
- (set (match_dup 3)
- (lshiftrt:SI (subreg:SI (match_dup 1) 1)
- (match_dup 4)))
-
- (set (subreg:SI (match_dup 0) 0)
- (ior:SI (subreg:SI (match_dup 0) 0)
- (match_dup 3)))
-
- (set (subreg:SI (match_dup 0) 1)
- (ashift:SI (subreg:SI (match_dup 1) 1)
- (match_dup 2)))]
- "
-{
- int amount = INTVAL (operands[2]);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
-}")
-
-
-(define_insn "ashldi3_internal4"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashift:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- "TARGET_64BIT"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
-
- return \"dsll\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
-
- return \"sra\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-
-(define_expand "ashrdi3"
- [(parallel [(set (match_operand:DI 0 "register_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:SI 2 "arith_operand" "")))
- (clobber (match_dup 3))])]
- "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
- "
-{
- if (TARGET_64BIT)
- {
- emit_insn (gen_ashrdi3_internal4 (operands[0], operands[1],
- operands[2]));
- DONE;
- }
-
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-
-(define_insn "ashrdi3_internal"
- [(set (match_operand:DI 0 "register_operand" "=&d")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
- "*
-{
- operands[4] = const0_rtx;
- dslots_jump_total += 3;
- dslots_jump_filled += 2;
-
- return \"sll\\t%3,%2,26\\n\\
-\\tbgez\\t%3,1f\\n\\
-\\tsra\\t%L0,%M1,%2\\n\\
-\\t%(b\\t3f\\n\\
-\\tsra\\t%M0,%M1,31%)\\n\\
-\\n\\
-1:\\n\\
-\\t%(beq\\t%3,%z4,2f\\n\\
-\\tsrl\\t%L0,%L1,%2%)\\n\\
-\\n\\
-\\tsubu\\t%3,%z4,%2\\n\\
-\\tsll\\t%3,%M1,%3\\n\\
-\\tor\\t%L0,%L0,%3\\n\\
-2:\\n\\
-\\tsra\\t%M0,%M1,%2\\n\\
-3:\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "12")])
-
-
-(define_insn "ashrdi3_internal2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:SI 2 "small_int" "IJK")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
- return \"sra\\t%L0,%M1,%2\;sra\\t%M0,%M1,31\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "2")])
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 32) != 0"
-
- [(set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
- (set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (const_int 31)))]
-
- "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 32) != 0"
-
- [(set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
- (set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (const_int 31)))]
-
- "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
-
-
-(define_insn "ashrdi3_internal3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:SI 2 "small_int" "IJK")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE
- && (INTVAL (operands[2]) & 63) < 32
- && (INTVAL (operands[2]) & 63) != 0"
- "*
-{
- int amount = INTVAL (operands[2]);
-
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
-
- return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;sra\\t%M0,%M1,%2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "4")])
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 63) < 32
- && (INTVAL (operands[2]) & 63) != 0"
-
- [(set (subreg:SI (match_dup 0) 0)
- (lshiftrt:SI (subreg:SI (match_dup 1) 0)
- (match_dup 2)))
-
- (set (match_dup 3)
- (ashift:SI (subreg:SI (match_dup 1) 1)
- (match_dup 4)))
-
- (set (subreg:SI (match_dup 0) 0)
- (ior:SI (subreg:SI (match_dup 0) 0)
- (match_dup 3)))
-
- (set (subreg:SI (match_dup 0) 1)
- (ashiftrt:SI (subreg:SI (match_dup 1) 1)
- (match_dup 2)))]
- "
-{
- int amount = INTVAL (operands[2]);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
-}")
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 63) < 32
- && (INTVAL (operands[2]) & 63) != 0"
-
- [(set (subreg:SI (match_dup 0) 1)
- (lshiftrt:SI (subreg:SI (match_dup 1) 1)
- (match_dup 2)))
-
- (set (match_dup 3)
- (ashift:SI (subreg:SI (match_dup 1) 0)
- (match_dup 4)))
-
- (set (subreg:SI (match_dup 0) 1)
- (ior:SI (subreg:SI (match_dup 0) 1)
- (match_dup 3)))
-
- (set (subreg:SI (match_dup 0) 0)
- (ashiftrt:SI (subreg:SI (match_dup 1) 0)
- (match_dup 2)))]
- "
-{
- int amount = INTVAL (operands[2]);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
-}")
-
-
-(define_insn "ashrdi3_internal4"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ashiftrt:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- "TARGET_64BIT"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
-
- return \"dsra\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
-
- return \"srl\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-
-(define_expand "lshrdi3"
- [(parallel [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:SI 2 "arith_operand" "")))
- (clobber (match_dup 3))])]
- "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
- "
-{
- if (TARGET_64BIT)
- {
- emit_insn (gen_lshrdi3_internal4 (operands[0], operands[1],
- operands[2]));
- DONE;
- }
-
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-
-(define_insn "lshrdi3_internal"
- [(set (match_operand:DI 0 "register_operand" "=&d")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
- "*
-{
- operands[4] = const0_rtx;
- dslots_jump_total += 3;
- dslots_jump_filled += 2;
-
- return \"sll\\t%3,%2,26\\n\\
-\\tbgez\\t%3,1f\\n\\
-\\tsrl\\t%L0,%M1,%2\\n\\
-\\t%(b\\t3f\\n\\
-\\tmove\\t%M0,%z4%)\\n\\
-\\n\\
-1:\\n\\
-\\t%(beq\\t%3,%z4,2f\\n\\
-\\tsrl\\t%L0,%L1,%2%)\\n\\
-\\n\\
-\\tsubu\\t%3,%z4,%2\\n\\
-\\tsll\\t%3,%M1,%3\\n\\
-\\tor\\t%L0,%L0,%3\\n\\
-2:\\n\\
-\\tsrl\\t%M0,%M1,%2\\n\\
-3:\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "12")])
-
-
-(define_insn "lshrdi3_internal2"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:SI 2 "small_int" "IJK")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
- operands[4] = const0_rtx;
- return \"srl\\t%L0,%M1,%2\;move\\t%M0,%z4\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "2")])
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 32) != 0"
-
- [(set (subreg:SI (match_dup 0) 0) (lshiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
- (set (subreg:SI (match_dup 0) 1) (const_int 0))]
-
- "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 32) != 0"
-
- [(set (subreg:SI (match_dup 0) 1) (lshiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
- (set (subreg:SI (match_dup 0) 0) (const_int 0))]
-
- "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
-
-
-(define_insn "lshrdi3_internal3"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
- (match_operand:SI 2 "small_int" "IJK")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_64BIT && !TARGET_DEBUG_G_MODE
- && (INTVAL (operands[2]) & 63) < 32
- && (INTVAL (operands[2]) & 63) != 0"
- "*
-{
- int amount = INTVAL (operands[2]);
-
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
-
- return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;srl\\t%M0,%M1,%2\";
-}"
- [(set_attr "type" "darith")
- (set_attr "mode" "DI")
- (set_attr "length" "4")])
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 63) < 32
- && (INTVAL (operands[2]) & 63) != 0"
-
- [(set (subreg:SI (match_dup 0) 0)
- (lshiftrt:SI (subreg:SI (match_dup 1) 0)
- (match_dup 2)))
-
- (set (match_dup 3)
- (ashift:SI (subreg:SI (match_dup 1) 1)
- (match_dup 4)))
-
- (set (subreg:SI (match_dup 0) 0)
- (ior:SI (subreg:SI (match_dup 0) 0)
- (match_dup 3)))
-
- (set (subreg:SI (match_dup 0) 1)
- (lshiftrt:SI (subreg:SI (match_dup 1) 1)
- (match_dup 2)))]
- "
-{
- int amount = INTVAL (operands[2]);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
-}")
-
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "small_int" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
- && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && (INTVAL (operands[2]) & 63) < 32
- && (INTVAL (operands[2]) & 63) != 0"
-
- [(set (subreg:SI (match_dup 0) 1)
- (lshiftrt:SI (subreg:SI (match_dup 1) 1)
- (match_dup 2)))
-
- (set (match_dup 3)
- (ashift:SI (subreg:SI (match_dup 1) 0)
- (match_dup 4)))
-
- (set (subreg:SI (match_dup 0) 1)
- (ior:SI (subreg:SI (match_dup 0) 1)
- (match_dup 3)))
-
- (set (subreg:SI (match_dup 0) 0)
- (lshiftrt:SI (subreg:SI (match_dup 1) 0)
- (match_dup 2)))]
- "
-{
- int amount = INTVAL (operands[2]);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
-}")
-
-
-(define_insn "lshrdi3_internal4"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (lshiftrt:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- "TARGET_64BIT"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
-
- return \"dsrl\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-
-;;
-;; ....................
-;;
-;; COMPARISONS
-;;
-;; ....................
-
-;; Flow here is rather complex:
-;;
-;; 1) The cmp{si,di,sf,df} routine is called. It deposits the
-;; arguments into the branch_cmp array, and the type into
-;; branch_type. No RTL is generated.
-;;
-;; 2) The appropriate branch define_expand is called, which then
-;; creates the appropriate RTL for the comparison and branch.
-;; Different CC modes are used, based on what type of branch is
-;; done, so that we can constrain things appropriately. There
-;; are assumptions in the rest of GCC that break if we fold the
-;; operands into the branchs for integer operations, and use cc0
-;; for floating point, so we use the fp status register instead.
-;; If needed, an appropriate temporary is created to hold the
-;; of the integer compare.
-
-(define_expand "cmpsi"
- [(set (cc0)
- (compare:CC (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "arith_operand" "")))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code message */
- {
- branch_cmp[0] = operands[0];
- branch_cmp[1] = operands[1];
- branch_type = CMP_SI;
- DONE;
- }
-}")
-
-(define_expand "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "register_operand" ""))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code message */
- {
- branch_cmp[0] = operands[0];
- branch_cmp[1] = const0_rtx;
- branch_type = CMP_SI;
- DONE;
- }
-}")
-
-(define_expand "cmpdi"
- [(set (cc0)
- (compare:CC (match_operand:DI 0 "se_register_operand" "")
- (match_operand:DI 1 "se_arith_operand" "")))]
- "TARGET_64BIT"
- "
-{
- if (operands[0]) /* avoid unused code message */
- {
- branch_cmp[0] = operands[0];
- branch_cmp[1] = operands[1];
- branch_type = CMP_DI;
- DONE;
- }
-}")
-
-(define_expand "tstdi"
- [(set (cc0)
- (match_operand:DI 0 "se_register_operand" ""))]
- "TARGET_64BIT"
- "
-{
- if (operands[0]) /* avoid unused code message */
- {
- branch_cmp[0] = operands[0];
- branch_cmp[1] = const0_rtx;
- branch_type = CMP_DI;
- DONE;
- }
-}")
-
-(define_expand "cmpdf"
- [(set (cc0)
- (compare:CC (match_operand:DF 0 "register_operand" "")
- (match_operand:DF 1 "register_operand" "")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "
-{
- if (operands[0]) /* avoid unused code message */
- {
- branch_cmp[0] = operands[0];
- branch_cmp[1] = operands[1];
- branch_type = CMP_DF;
- DONE;
- }
-}")
-
-(define_expand "cmpsf"
- [(set (cc0)
- (compare:CC (match_operand:SF 0 "register_operand" "")
- (match_operand:SF 1 "register_operand" "")))]
- "TARGET_HARD_FLOAT"
- "
-{
- if (operands[0]) /* avoid unused code message */
- {
- branch_cmp[0] = operands[0];
- branch_cmp[1] = operands[1];
- branch_type = CMP_SF;
- DONE;
- }
-}")
-
-
-;;
-;; ....................
-;;
-;; CONDITIONAL BRANCHES
-;;
-;; ....................
-
-(define_insn "branch_fp_ne"
- [(set (pc)
- (if_then_else (ne:CC (match_operand:CC 0 "register_operand" "z")
- (const_int 0))
- (match_operand 1 "pc_or_label_operand" "")
- (match_operand 2 "pc_or_label_operand" "")))]
- "TARGET_HARD_FLOAT"
- "*
-{
- mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
- return (operands[1] != pc_rtx) ? \"%*bc1t%?\\t%Z0%1\" : \"%*bc1f%?\\t%Z0%2\";
-}"
- [(set_attr "type" "branch")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "branch_fp_eq"
- [(set (pc)
- (if_then_else (eq:CC (match_operand:CC 0 "register_operand" "z")
- (const_int 0))
- (match_operand 1 "pc_or_label_operand" "")
- (match_operand 2 "pc_or_label_operand" "")))]
- "TARGET_HARD_FLOAT"
- "*
-{
- mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
- return (operands[1] != pc_rtx) ? \"%*bc1f%?\\t%Z0%1\" : \"%*bc1t%?\\t%Z0%2\";
-}"
- [(set_attr "type" "branch")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "branch_zero"
- [(set (pc)
- (if_then_else (match_operator:SI 0 "cmp_op"
- [(match_operand:SI 1 "register_operand" "d")
- (const_int 0)])
- (match_operand 2 "pc_or_label_operand" "")
- (match_operand 3 "pc_or_label_operand" "")))]
- ""
- "*
-{
- mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
- if (operands[2] != pc_rtx)
- { /* normal jump */
- switch (GET_CODE (operands[0]))
- {
- case EQ: return \"%*beq%?\\t%z1,%.,%2\";
- case NE: return \"%*bne%?\\t%z1,%.,%2\";
- case GTU: return \"%*bne%?\\t%z1,%.,%2\";
- case LEU: return \"%*beq%?\\t%z1,%.,%2\";
- case GEU: return \"%*j\\t%2\";
- case LTU: return \"%*bne%?\\t%.,%.,%2\";
- }
-
- return \"%*b%C0z%?\\t%z1,%2\";
- }
- else
- { /* inverted jump */
- switch (GET_CODE (operands[0]))
- {
- case EQ: return \"%*bne%?\\t%z1,%.,%3\";
- case NE: return \"%*beq%?\\t%z1,%.,%3\";
- case GTU: return \"%*beq%?\\t%z1,%.,%3\";
- case LEU: return \"%*bne%?\\t%z1,%.,%3\";
- case GEU: return \"%*beq%?\\t%.,%.,%3\";
- case LTU: return \"%*j\\t%3\";
- }
-
- return \"%*b%N0z%?\\t%z1,%3\";
- }
-}"
- [(set_attr "type" "branch")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-
-(define_insn "branch_zero_di"
- [(set (pc)
- (if_then_else (match_operator:DI 0 "cmp_op"
- [(match_operand:DI 1 "se_register_operand" "d")
- (const_int 0)])
- (match_operand 2 "pc_or_label_operand" "")
- (match_operand 3 "pc_or_label_operand" "")))]
- ""
- "*
-{
- mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
- if (operands[2] != pc_rtx)
- { /* normal jump */
- switch (GET_CODE (operands[0]))
- {
- case EQ: return \"%*beq%?\\t%z1,%.,%2\";
- case NE: return \"%*bne%?\\t%z1,%.,%2\";
- case GTU: return \"%*bne%?\\t%z1,%.,%2\";
- case LEU: return \"%*beq%?\\t%z1,%.,%2\";
- case GEU: return \"%*j\\t%2\";
- case LTU: return \"%*bne%?\\t%.,%.,%2\";
- }
-
- return \"%*b%C0z%?\\t%z1,%2\";
- }
- else
- { /* inverted jump */
- switch (GET_CODE (operands[0]))
- {
- case EQ: return \"%*bne%?\\t%z1,%.,%3\";
- case NE: return \"%*beq%?\\t%z1,%.,%3\";
- case GTU: return \"%*beq%?\\t%z1,%.,%3\";
- case LEU: return \"%*bne%?\\t%z1,%.,%3\";
- case GEU: return \"%*beq%?\\t%.,%.,%3\";
- case LTU: return \"%*j\\t%3\";
- }
-
- return \"%*b%N0z%?\\t%z1,%3\";
- }
-}"
- [(set_attr "type" "branch")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-
-(define_insn "branch_equality"
- [(set (pc)
- (if_then_else (match_operator:SI 0 "equality_op"
- [(match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")])
- (match_operand 3 "pc_or_label_operand" "")
- (match_operand 4 "pc_or_label_operand" "")))]
- ""
- "*
-{
- mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
- return (operands[3] != pc_rtx)
- ? \"%*b%C0%?\\t%z1,%z2,%3\"
- : \"%*b%N0%?\\t%z1,%z2,%4\";
-}"
- [(set_attr "type" "branch")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-
-(define_insn "branch_equality_di"
- [(set (pc)
- (if_then_else (match_operator:DI 0 "equality_op"
- [(match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")])
- (match_operand 3 "pc_or_label_operand" "")
- (match_operand 4 "pc_or_label_operand" "")))]
- ""
- "*
-{
- mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
- return (operands[3] != pc_rtx)
- ? \"%*b%C0%?\\t%z1,%z2,%3\"
- : \"%*b%N0%?\\t%z1,%z2,%4\";
-}"
- [(set_attr "type" "branch")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, EQ);
- DONE;
- }
-}")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, NE);
- DONE;
- }
-}")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, GT);
- DONE;
- }
-}")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, GE);
- DONE;
- }
-}")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, LT);
- DONE;
- }
-}")
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, LE);
- DONE;
- }
-}")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, GTU);
- DONE;
- }
-}")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, GEU);
- DONE;
- }
-}")
-
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, LTU);
- DONE;
- }
-}")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu:CC (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (operands[0]) /* avoid unused code warning */
- {
- gen_conditional_branch (operands, LEU);
- DONE;
- }
-}")
-
-
-;;
-;; ....................
-;;
-;; SETTING A REGISTER FROM A COMPARISON
-;;
-;; ....................
-
-(define_expand "seq"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (eq:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (EQ, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- operands[2] = force_reg (SImode, operands[2]);
-
- /* fall through and generate default code */
-}")
-
-
-(define_insn "seq_si_zero"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (eq:SI (match_operand:SI 1 "register_operand" "d")
- (const_int 0)))]
- ""
- "sltu\\t%0,%1,1"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "seq_di_zero"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (eq:DI (match_operand:DI 1 "se_register_operand" "d")
- (const_int 0)))]
- "TARGET_64BIT"
- "sltu\\t%0,%1,1"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_insn "seq_si"
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (eq:SI (match_operand:SI 1 "register_operand" "%d,d")
- (match_operand:SI 2 "uns_arith_operand" "d,K")))]
- "TARGET_DEBUG_C_MODE"
- "@
- xor\\t%0,%1,%2\;sltu\\t%0,%0,1
- xori\\t%0,%1,%2\;sltu\\t%0,%0,1"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (eq:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "uns_arith_operand" "")))]
- "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
- && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
- [(set (match_dup 0)
- (xor:SI (match_dup 1)
- (match_dup 2)))
- (set (match_dup 0)
- (ltu:SI (match_dup 0)
- (const_int 1)))]
- "")
-
-(define_insn "seq_di"
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (eq:DI (match_operand:DI 1 "se_register_operand" "%d,d")
- (match_operand:DI 2 "se_uns_arith_operand" "d,K")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE"
- "@
- xor\\t%0,%1,%2\;sltu\\t%0,%0,1
- xori\\t%0,%1,%2\;sltu\\t%0,%0,1"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (eq:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:DI 2 "se_uns_arith_operand" "")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
- && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
- [(set (match_dup 0)
- (xor:DI (match_dup 1)
- (match_dup 2)))
- (set (match_dup 0)
- (ltu:DI (match_dup 0)
- (const_int 1)))]
- "")
-
-(define_expand "sne"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ne:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (NE, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
- operands[2] = force_reg (SImode, operands[2]);
-
- /* fall through and generate default code */
-}")
-
-(define_insn "sne_si_zero"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ne:SI (match_operand:SI 1 "register_operand" "d")
- (const_int 0)))]
- ""
- "sltu\\t%0,%.,%1"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "sne_di_zero"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ne:DI (match_operand:DI 1 "se_register_operand" "d")
- (const_int 0)))]
- "TARGET_64BIT"
- "sltu\\t%0,%.,%1"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_insn "sne_si"
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (ne:SI (match_operand:SI 1 "register_operand" "%d,d")
- (match_operand:SI 2 "uns_arith_operand" "d,K")))]
- "TARGET_DEBUG_C_MODE"
- "@
- xor\\t%0,%1,%2\;sltu\\t%0,%.,%0
- xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (ne:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "uns_arith_operand" "")))]
- "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
- && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
- [(set (match_dup 0)
- (xor:SI (match_dup 1)
- (match_dup 2)))
- (set (match_dup 0)
- (gtu:SI (match_dup 0)
- (const_int 0)))]
- "")
-
-(define_insn "sne_di"
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (ne:DI (match_operand:DI 1 "se_register_operand" "%d,d")
- (match_operand:DI 2 "se_uns_arith_operand" "d,K")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE"
- "@
- xor\\t%0,%1,%2\;sltu\\t%0,%.,%0
- xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ne:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:DI 2 "se_uns_arith_operand" "")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
- && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
- [(set (match_dup 0)
- (xor:DI (match_dup 1)
- (match_dup 2)))
- (set (match_dup 0)
- (gtu:DI (match_dup 0)
- (const_int 0)))]
- "")
-
-(define_expand "sgt"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (gt:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (GT, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
- operands[2] = force_reg (SImode, operands[2]);
-
- /* fall through and generate default code */
-}")
-
-(define_insn "sgt_si"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (gt:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
- ""
- "slt\\t%0,%z2,%1"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "sgt_di"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (gt:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_reg_or_0_operand" "dJ")))]
- "TARGET_64BIT"
- "slt\\t%0,%z2,%1"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_expand "sge"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ge:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (GE, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- /* fall through and generate default code */
-}")
-
-(define_insn "sge_si"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ge:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- "TARGET_DEBUG_C_MODE"
- "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (ge:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "arith_operand" "")))]
- "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
- [(set (match_dup 0)
- (lt:SI (match_dup 1)
- (match_dup 2)))
- (set (match_dup 0)
- (xor:SI (match_dup 0)
- (const_int 1)))]
- "")
-
-(define_insn "sge_di"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ge:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_arith_operand" "dI")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE"
- "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (ge:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:DI 2 "se_arith_operand" "")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
- [(set (match_dup 0)
- (lt:DI (match_dup 1)
- (match_dup 2)))
- (set (match_dup 0)
- (xor:DI (match_dup 0)
- (const_int 1)))]
- "")
-
-(define_expand "slt"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (lt:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (LT, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- /* fall through and generate default code */
-}")
-
-(define_insn "slt_si"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (lt:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "slt\\t%0,%1,%2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "slt_di"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (lt:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_arith_operand" "dI")))]
- "TARGET_64BIT"
- "slt\\t%0,%1,%2"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_expand "sle"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (le:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (LE, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
- operands[2] = force_reg (SImode, operands[2]);
-
- /* fall through and generate default code */
-}")
-
-(define_insn "sle_si_const"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (le:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "small_int" "I")))]
- "INTVAL (operands[2]) < 32767"
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
- return \"slt\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "sle_di_const"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (le:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "small_int" "I")))]
- "TARGET_64BIT && INTVAL (operands[2]) < 32767"
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
- return \"slt\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_insn "sle_si_reg"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (le:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))]
- "TARGET_DEBUG_C_MODE"
- "slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (le:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))]
- "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
- [(set (match_dup 0)
- (lt:SI (match_dup 2)
- (match_dup 1)))
- (set (match_dup 0)
- (xor:SI (match_dup 0)
- (const_int 1)))]
- "")
-
-(define_insn "sle_di_reg"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (le:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE"
- "slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (le:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:DI 2 "se_register_operand" "")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
- [(set (match_dup 0)
- (lt:DI (match_dup 2)
- (match_dup 1)))
- (set (match_dup 0)
- (xor:DI (match_dup 0)
- (const_int 1)))]
- "")
-
-(define_expand "sgtu"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (gtu:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (GTU, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
- operands[2] = force_reg (SImode, operands[2]);
-
- /* fall through and generate default code */
-}")
-
-(define_insn "sgtu_si"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (gtu:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
- ""
- "sltu\\t%0,%z2,%1"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "sgtu_di"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (gtu:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_reg_or_0_operand" "dJ")))]
- "TARGET_64BIT"
- "sltu\\t%0,%z2,%1"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_expand "sgeu"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (geu:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (GEU, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- /* fall through and generate default code */
-}")
-
-(define_insn "sgeu_si"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (geu:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- "TARGET_DEBUG_C_MODE"
- "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (geu:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "arith_operand" "")))]
- "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
- [(set (match_dup 0)
- (ltu:SI (match_dup 1)
- (match_dup 2)))
- (set (match_dup 0)
- (xor:SI (match_dup 0)
- (const_int 1)))]
- "")
-
-(define_insn "sgeu_di"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (geu:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_arith_operand" "dI")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE"
- "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (geu:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:DI 2 "se_arith_operand" "")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
- [(set (match_dup 0)
- (ltu:DI (match_dup 1)
- (match_dup 2)))
- (set (match_dup 0)
- (xor:DI (match_dup 0)
- (const_int 1)))]
- "")
-
-(define_expand "sltu"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ltu:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (LTU, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- /* fall through and generate default code */
-}")
-
-(define_insn "sltu_si"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ltu:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "arith_operand" "dI")))]
- ""
- "sltu\\t%0,%1,%2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "sltu_di"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (ltu:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_arith_operand" "dI")))]
- "TARGET_64BIT"
- "sltu\\t%0,%1,%2"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_expand "sleu"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (leu:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
- FAIL;
-
- /* set up operands from compare. */
- operands[1] = branch_cmp[0];
- operands[2] = branch_cmp[1];
-
- if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
- {
- gen_int_relational (LEU, operands[0], operands[1], operands[2], (int *)0);
- DONE;
- }
-
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
- operands[2] = force_reg (SImode, operands[2]);
-
- /* fall through and generate default code */
-}")
-
-(define_insn "sleu_si_const"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (leu:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "small_int" "I")))]
- "INTVAL (operands[2]) < 32767"
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
- return \"sltu\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "1")])
-
-(define_insn "sleu_di_const"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (leu:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "small_int" "I")))]
- "TARGET_64BIT && INTVAL (operands[2]) < 32767"
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
- return \"sltu\\t%0,%1,%2\";
-}"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "1")])
-
-(define_insn "sleu_si_reg"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (leu:SI (match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")))]
- "TARGET_DEBUG_C_MODE"
- "sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (leu:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))]
- "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
- [(set (match_dup 0)
- (ltu:SI (match_dup 2)
- (match_dup 1)))
- (set (match_dup 0)
- (xor:SI (match_dup 0)
- (const_int 1)))]
- "")
-
-(define_insn "sleu_di_reg"
- [(set (match_operand:DI 0 "register_operand" "=d")
- (leu:DI (match_operand:DI 1 "se_register_operand" "d")
- (match_operand:DI 2 "se_register_operand" "d")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE"
- "sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
- [(set_attr "type" "arith")
- (set_attr "mode" "DI")
- (set_attr "length" "2")])
-
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (leu:DI (match_operand:DI 1 "se_register_operand" "")
- (match_operand:DI 2 "se_register_operand" "")))]
- "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
- [(set (match_dup 0)
- (ltu:DI (match_dup 2)
- (match_dup 1)))
- (set (match_dup 0)
- (xor:DI (match_dup 0)
- (const_int 1)))]
- "")
-
-
-;;
-;; ....................
-;;
-;; FLOATING POINT COMPARISONS
-;;
-;; ....................
-
-(define_insn "seq_df"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (eq:CC (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.eq.d\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-(define_insn "slt_df"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (lt:CC (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.lt.d\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-(define_insn "sle_df"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (le:CC (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.le.d\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-(define_insn "sgt_df"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (gt:CC (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.lt.d\\t%Z0%2,%1\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-(define_insn "sge_df"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (ge:CC (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.le.d\\t%Z0%2,%1\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-(define_insn "seq_sf"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (eq:CC (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.eq.s\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-(define_insn "slt_sf"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (lt:CC (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.lt.s\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-(define_insn "sle_sf"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (le:CC (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.le.s\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-(define_insn "sgt_sf"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (gt:CC (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.lt.s\\t%Z0%2,%1\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-(define_insn "sge_sf"
- [(set (match_operand:CC 0 "register_operand" "=z")
- (ge:CC (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "*
-{
- return mips_fill_delay_slot (\"c.le.s\\t%Z0%2,%1\", DELAY_FCMP, operands, insn);
-}"
- [(set_attr "type" "fcmp")
- (set_attr "mode" "FPSW")
- (set_attr "length" "1")])
-
-
-;;
-;; ....................
-;;
-;; UNCONDITIONAL BRANCHES
-;;
-;; ....................
-
-;; Unconditional branches.
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == REG)
- return \"%*j\\t%0\";
- /* ??? I don't know why this is necessary. This works around an
- assembler problem that appears when a label is defined, then referenced
- in a switch table, then used in a `j' instruction. */
- else if (mips_abi != ABI_32)
- return \"%*b\\t%l0\";
- else
- return \"%*j\\t%l0\";
-}"
- [(set_attr "type" "jump")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_expand "indirect_jump"
- [(set (pc) (match_operand 0 "register_operand" "d"))]
- ""
- "
-{
- rtx dest;
-
- if (operands[0]) /* eliminate unused code warnings */
- {
- dest = operands[0];
- if (GET_CODE (dest) != REG || GET_MODE (dest) != Pmode)
- operands[0] = copy_to_mode_reg (Pmode, dest);
-
- if (!TARGET_LONG64)
- emit_jump_insn (gen_indirect_jump_internal1 (operands[0]));
- else
- emit_jump_insn (gen_indirect_jump_internal2 (operands[0]));
-
- DONE;
- }
-}")
-
-(define_insn "indirect_jump_internal1"
- [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
- "!TARGET_LONG64"
- "%*j\\t%0"
- [(set_attr "type" "jump")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "indirect_jump_internal2"
- [(set (pc) (match_operand:DI 0 "se_register_operand" "d"))]
- "TARGET_LONG64"
- "%*j\\t%0"
- [(set_attr "type" "jump")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_expand "tablejump"
- [(set (pc)
- (match_operand 0 "register_operand" "d"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "
-{
- rtx dest;
-
- if (operands[0]) /* eliminate unused code warnings */
- {
- if (GET_MODE (operands[0]) != Pmode)
- abort ();
-
- if (! flag_pic)
- {
- if (!TARGET_LONG64)
- emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
- else
- emit_jump_insn (gen_tablejump_internal2 (operands[0], operands[1]));
- }
- else
- {
- if (!TARGET_LONG64)
- emit_jump_insn (gen_tablejump_internal3 (operands[0], operands[1]));
- else
- emit_jump_insn (gen_tablejump_internal4 (operands[0], operands[1]));
- }
-
- DONE;
- }
-}")
-
-(define_insn "tablejump_internal1"
- [(set (pc)
- (match_operand:SI 0 "register_operand" "d"))
- (use (label_ref (match_operand 1 "" "")))]
- "!TARGET_LONG64"
- "%*j\\t%0"
- [(set_attr "type" "jump")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "tablejump_internal2"
- [(set (pc)
- (match_operand:DI 0 "se_register_operand" "d"))
- (use (label_ref (match_operand 1 "" "")))]
- "TARGET_LONG64"
- "%*j\\t%0"
- [(set_attr "type" "jump")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_expand "tablejump_internal3"
- [(set (pc)
- (plus:SI (match_operand:SI 0 "register_operand" "d")
- (label_ref:SI (match_operand:SI 1 "" ""))))]
- ""
- "")
-
-;;; Make sure that this only matches the insn before ADDR_DIFF_VEC. Otherwise
-;;; it is not valid.
-
-;;; ??? The length depends on the ABI. It is two for o32, and one for n32.
-;;; We just use the conservative number here.
-
-(define_insn ""
- [(set (pc)
- (plus:SI (match_operand:SI 0 "register_operand" "d")
- (label_ref:SI (match_operand:SI 1 "" ""))))]
- "!TARGET_LONG64 && next_active_insn (insn) != 0
- && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
- && PREV_INSN (next_active_insn (insn)) == operands[1]"
- "*
-{
- /* .cpadd expands to add REG,REG,$gp when pic, and nothing when not pic. */
- if (mips_abi == ABI_32)
- output_asm_insn (\".cpadd\\t%0\", operands);
- return \"%*j\\t%0\";
-}"
- [(set_attr "type" "jump")
- (set_attr "mode" "none")
- (set_attr "length" "2")])
-
-(define_expand "tablejump_internal4"
- [(set (pc)
- (plus:DI (match_operand:DI 0 "se_register_operand" "d")
- (label_ref:DI (match_operand:SI 1 "" ""))))]
- ""
- "")
-
-;;; Make sure that this only matches the insn before ADDR_DIFF_VEC. Otherwise
-;;; it is not valid.
-
-(define_insn ""
- [(set (pc)
- (plus:DI (match_operand:DI 0 "se_register_operand" "d")
- (label_ref:DI (match_operand:SI 1 "" ""))))]
- "TARGET_LONG64 && next_active_insn (insn) != 0
- && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
- && PREV_INSN (next_active_insn (insn)) == operands[1]"
- "%*j\\t%0"
- [(set_attr "type" "jump")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-;; Function return, only allow after optimization, so that we can
-;; eliminate jumps to jumps if no stack space is used.
-
-;; (define_expand "return"
-;; [(set (pc) (reg:SI 31))]
-;; "simple_epilogue_p ()"
-;; "")
-
-(define_expand "return"
- [(parallel [(return)
- (use (reg:SI 31))])]
- "simple_epilogue_p ()"
- "")
-
-(define_insn "return_internal"
- [(parallel [(return)
- (use (match_operand:SI 0 "register_operand" "d"))])]
- ""
- "%*j\\t%0"
- [(set_attr "type" "jump")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-;; Implement a switch statement when generating embedded PIC code.
-;; Switches are implemented by `tablejump' when not using -membedded-pic.
-
-(define_expand "casesi"
- [(set (match_dup 5)
- (minus:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "arith_operand" "dI")))
- (set (cc0)
- (compare:CC (match_dup 5)
- (match_operand:SI 2 "arith_operand" "")))
- (set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 4 "" ""))
- (pc)))
- (parallel
- [(set (pc)
- (mem:SI (plus:SI (mult:SI (match_dup 5)
- (const_int 4))
- (label_ref (match_operand 3 "" "")))))
- (clobber (match_scratch:SI 6 ""))
- (clobber (reg:SI 31))])]
- "TARGET_EMBEDDED_PIC"
- "
-{
- /* We need slightly different code for eight byte table entries. */
- if (TARGET_LONG64)
- abort ();
-
- if (operands[0])
- {
- rtx reg = gen_reg_rtx (SImode);
-
- /* If the index is too large, go to the default label. */
- emit_insn (gen_subsi3 (reg, operands[0], operands[1]));
- emit_insn (gen_cmpsi (reg, operands[2]));
- emit_insn (gen_bgtu (operands[4]));
-
- /* Do the PIC jump. */
- emit_insn (gen_casesi_internal (reg, operands[3], gen_reg_rtx (SImode)));
-
- DONE;
- }
-}")
-
-;; An embedded PIC switch statement looks like this:
-;; bal $LS1
-;; sll $reg,$index,2
-;; $LS1:
-;; addu $reg,$reg,$31
-;; lw $reg,$L1-$LS1($reg)
-;; addu $reg,$reg,$31
-;; j $reg
-;; $L1:
-;; .word case1-$LS1
-;; .word case2-$LS1
-;; ...
-
-(define_insn "casesi_internal"
- [(set (pc)
- (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "d")
- (const_int 4))
- (label_ref (match_operand 1 "" "")))))
- (clobber (match_operand:SI 2 "register_operand" "d"))
- (clobber (reg:SI 31))]
- "TARGET_EMBEDDED_PIC"
- "*
-{
- output_asm_insn (\"%(bal\\t%S1\;sll\\t%0,2\\n%S1:\", operands);
- output_asm_insn (\"addu\\t%0,%0,$31%)\", operands);
- output_asm_insn (\"lw\\t%0,%1-%S1(%0)\;addu\\t%0,%0,$31\", operands);
- return \"j\\t%0\";
-}"
- [(set_attr "type" "jump")
- (set_attr "mode" "none")
- (set_attr "length" "6")])
-
-
-;;
-;; ....................
-;;
-;; Function prologue/epilogue
-;;
-;; ....................
-;;
-
-(define_expand "prologue"
- [(const_int 1)]
- ""
- "
-{
- if (mips_isa >= 0) /* avoid unused code warnings */
- {
- mips_expand_prologue ();
- DONE;
- }
-}")
-
-;; Block any insns from being moved before this point, since the
-;; profiling call to mcount can use various registers that aren't
-;; saved or used to pass arguments.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- ""
- [(set_attr "type" "unknown")
- (set_attr "mode" "none")
- (set_attr "length" "0")])
-
-;; At present, don't expand the epilogue, reorg.c will clobber the
-;; return register in compiling gen_lowpart (emit-rtl.c).
-;;
-;; (define_expand "epilogue"
-;; [(const_int 2)]
-;; ""
-;; "
-;; {
-;; if (mips_isa >= 0) /* avoid unused code warnings */
-;; {
-;; mips_expand_epilogue ();
-;; DONE;
-;; }
-;; }")
-
-;; When generating embedded PIC code we need to get the address of the
-;; current function. This specialized instruction does just that.
-
-(define_insn "get_fnaddr"
- [(set (match_operand 0 "register_operand" "=d")
- (unspec [(match_operand 1 "" "")] 1))
- (clobber (reg:SI 31))]
- "TARGET_EMBEDDED_PIC
- && GET_CODE (operands[1]) == SYMBOL_REF"
- "%($LF%= = . + 8\;bal\\t$LF%=\;la\\t%0,%1-$LF%=%)\;addu\\t%0,%0,$31"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "4")])
-
-
-;;
-;; ....................
-;;
-;; FUNCTION CALLS
-;;
-;; ....................
-
-;; calls.c now passes a third argument, make saber happy
-
-(define_expand "call"
- [(parallel [(call (match_operand 0 "memory_operand" "m")
- (match_operand 1 "" "i"))
- (clobber (reg:SI 31))
- (use (match_operand 2 "" "")) ;; next_arg_reg
- (use (match_operand 3 "" ""))])] ;; struct_value_size_rtx
- ""
- "
-{
- rtx addr;
-
- if (operands[0]) /* eliminate unused code warnings */
- {
- addr = XEXP (operands[0], 0);
- if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
- || ! call_insn_operand (addr, VOIDmode))
- XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, addr);
-
- /* In order to pass small structures by value in registers
- compatibly with the MIPS compiler, we need to shift the value
- into the high part of the register. Function_arg has encoded
- a PARALLEL rtx, holding a vector of adjustments to be made
- as the next_arg_reg variable, so we split up the insns,
- and emit them separately. */
-
- if (operands[2] != (rtx)0 && GET_CODE (operands[2]) == PARALLEL)
- {
- rtvec adjust = XVEC (operands[2], 0);
- int num = GET_NUM_ELEM (adjust);
- int i;
-
- for (i = 0; i < num; i++)
- emit_insn (RTVEC_ELT (adjust, i));
- }
-
- emit_call_insn (gen_call_internal0 (operands[0], operands[1],
- gen_rtx (REG, SImode, GP_REG_FIRST + 31)));
- DONE;
- }
-}")
-
-(define_expand "call_internal0"
- [(parallel [(call (match_operand 0 "" "")
- (match_operand 1 "" ""))
- (clobber (match_operand:SI 2 "" ""))])]
- ""
- "")
-
-(define_insn "call_internal1"
- [(call (mem (match_operand 0 "call_insn_operand" "ri"))
- (match_operand 1 "" "i"))
- (clobber (match_operand:SI 2 "register_operand" "=d"))]
- "!TARGET_ABICALLS && !TARGET_LONG_CALLS"
- "*
-{
- register rtx target = operands[0];
-
- if (GET_CODE (target) == SYMBOL_REF)
- return \"%*jal\\t%0\";
- else if (GET_CODE (target) == CONST_INT)
- return \"%[li\\t%@,%0\\n\\t%*jal\\t%2,%@%]\";
- else
- return \"%*jal\\t%2,%0\";
-}"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "call_internal2"
- [(call (mem (match_operand 0 "call_insn_operand" "ri"))
- (match_operand 1 "" "i"))
- (clobber (match_operand:SI 2 "register_operand" "=d"))]
- "TARGET_ABICALLS && !TARGET_LONG_CALLS"
- "*
-{
- register rtx target = operands[0];
-
- if (GET_CODE (target) == SYMBOL_REF)
- {
- if (GET_MODE (target) == SImode)
- return \"la\\t%^,%0\\n\\tjal\\t%2,%^\";
- else
- return \"dla\\t%^,%0\\n\\tjal\\t%2,%^\";
- }
- else if (GET_CODE (target) == CONST_INT)
- return \"li\\t%^,%0\\n\\tjal\\t%2,%^\";
- else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
- return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
- else
- return \"jal\\t%2,%0\";
-}"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "2")])
-
-(define_insn "call_internal3a"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
- (match_operand 1 "" "i"))
- (clobber (match_operand:SI 2 "register_operand" "=d"))]
- "!TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
- "%*jal\\t%2,%0"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "call_internal3b"
- [(call (mem:DI (match_operand:DI 0 "se_register_operand" "r"))
- (match_operand 1 "" "i"))
- (clobber (match_operand:SI 2 "register_operand" "=d"))]
- "TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
- "%*jal\\t%2,%0"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "call_internal4a"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
- (match_operand 1 "" "i"))
- (clobber (match_operand:SI 2 "register_operand" "=d"))]
- "!TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
- "*
-{
- if (REGNO (operands[0]) != PIC_FUNCTION_ADDR_REGNUM)
- return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
- else
- return \"jal\\t%2,%0\";
-}"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "2")])
-
-(define_insn "call_internal4b"
- [(call (mem:DI (match_operand:DI 0 "se_register_operand" "r"))
- (match_operand 1 "" "i"))
- (clobber (match_operand:SI 2 "register_operand" "=d"))]
- "TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
- "*
-{
- if (REGNO (operands[0]) != PIC_FUNCTION_ADDR_REGNUM)
- return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
- else
- return \"jal\\t%2,%0\";
-}"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "2")])
-
-;; calls.c now passes a fourth argument, make saber happy
-
-(define_expand "call_value"
- [(parallel [(set (match_operand 0 "register_operand" "=df")
- (call (match_operand 1 "memory_operand" "m")
- (match_operand 2 "" "i")))
- (clobber (reg:SI 31))
- (use (match_operand 3 "" ""))])] ;; next_arg_reg
- ""
- "
-{
- rtx addr;
-
- if (operands[0]) /* eliminate unused code warning */
- {
- addr = XEXP (operands[1], 0);
- if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
- || ! call_insn_operand (addr, VOIDmode))
- XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, addr);
-
- /* In order to pass small structures by value in registers
- compatibly with the MIPS compiler, we need to shift the value
- into the high part of the register. Function_arg has encoded
- a PARALLEL rtx, holding a vector of adjustments to be made
- as the next_arg_reg variable, so we split up the insns,
- and emit them separately. */
-
- if (operands[3] != (rtx)0 && GET_CODE (operands[3]) == PARALLEL)
- {
- rtvec adjust = XVEC (operands[3], 0);
- int num = GET_NUM_ELEM (adjust);
- int i;
-
- for (i = 0; i < num; i++)
- emit_insn (RTVEC_ELT (adjust, i));
- }
-
- /* Handle Irix6 function calls that have multiple non-contiguous
- results. */
- if (GET_CODE (operands[0]) == PARALLEL && XVECLEN (operands[0], 0) > 1)
- {
- emit_call_insn (gen_call_value_multiple_internal0
- (XEXP (XVECEXP (operands[0], 0, 0), 0),
- operands[1], operands[2],
- XEXP (XVECEXP (operands[0], 0, 1), 0),
- gen_rtx (REG, SImode, GP_REG_FIRST + 31)));
- DONE;
- }
-
- /* We have a call returning a DImode structure in an FP reg.
- Strip off the now unnecessary PARALLEL. */
- if (GET_CODE (operands[0]) == PARALLEL)
- operands[0] = XEXP (XVECEXP (operands[0], 0, 0), 0);
-
- emit_call_insn (gen_call_value_internal0 (operands[0], operands[1], operands[2],
- gen_rtx (REG, SImode, GP_REG_FIRST + 31)));
-
- DONE;
- }
-}")
-
-(define_expand "call_value_internal0"
- [(parallel [(set (match_operand 0 "" "")
- (call (match_operand 1 "" "")
- (match_operand 2 "" "")))
- (clobber (match_operand:SI 3 "" ""))])]
- ""
- "")
-
-(define_insn "call_value_internal1"
- [(set (match_operand 0 "register_operand" "=df")
- (call (mem (match_operand 1 "call_insn_operand" "ri"))
- (match_operand 2 "" "i")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_ABICALLS && !TARGET_LONG_CALLS"
- "*
-{
- register rtx target = operands[1];
-
- if (GET_CODE (target) == SYMBOL_REF)
- return \"%*jal\\t%1\";
- else if (GET_CODE (target) == CONST_INT)
- return \"%[li\\t%@,%1\\n\\t%*jal\\t%3,%@%]\";
- else
- return \"%*jal\\t%3,%1\";
-}"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "call_value_internal2"
- [(set (match_operand 0 "register_operand" "=df")
- (call (mem (match_operand 1 "call_insn_operand" "ri"))
- (match_operand 2 "" "i")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "TARGET_ABICALLS && !TARGET_LONG_CALLS"
- "*
-{
- register rtx target = operands[1];
-
- if (GET_CODE (target) == SYMBOL_REF)
- {
- if (GET_MODE (target) == SImode)
- return \"la\\t%^,%1\\n\\tjal\\t%3,%^\";
- else
- return \"dla\\t%^,%1\\n\\tjal\\t%3,%^\";
- }
- else if (GET_CODE (target) == CONST_INT)
- return \"li\\t%^,%1\\n\\tjal\\t%3,%^\";
- else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
- return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
- else
- return \"jal\\t%3,%1\";
-}"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "2")])
-
-(define_insn "call_value_internal3a"
- [(set (match_operand 0 "register_operand" "=df")
- (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
- (match_operand 2 "" "i")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
- "%*jal\\t%3,%1"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "call_value_internal3b"
- [(set (match_operand 0 "register_operand" "=df")
- (call (mem:DI (match_operand:DI 1 "se_register_operand" "r"))
- (match_operand 2 "" "i")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
- "%*jal\\t%3,%1"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-(define_insn "call_value_internal4a"
- [(set (match_operand 0 "register_operand" "=df")
- (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
- (match_operand 2 "" "i")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "!TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
- "*
-{
- if (REGNO (operands[1]) != PIC_FUNCTION_ADDR_REGNUM)
- return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
- else
- return \"jal\\t%3,%1\";
-}"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "2")])
-
-(define_insn "call_value_internal4b"
- [(set (match_operand 0 "register_operand" "=df")
- (call (mem:DI (match_operand:DI 1 "se_register_operand" "r"))
- (match_operand 2 "" "i")))
- (clobber (match_operand:SI 3 "register_operand" "=d"))]
- "TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
- "*
-{
- if (REGNO (operands[1]) != PIC_FUNCTION_ADDR_REGNUM)
- return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
- else
- return \"jal\\t%3,%1\";
-}"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "2")])
-
-(define_expand "call_value_multiple_internal0"
- [(parallel [(set (match_operand 0 "" "")
- (call (match_operand 1 "" "")
- (match_operand 2 "" "")))
- (set (match_operand 3 "" "")
- (call (match_dup 1)
- (match_dup 2)))
- (clobber (match_operand:SI 4 "" ""))])]
- ""
- "")
-
-;; ??? May eventually need all 6 versions of the call patterns with multiple
-;; return values.
-
-(define_insn "call_value_multiple_internal2"
- [(set (match_operand 0 "register_operand" "=df")
- (call (mem (match_operand 1 "call_insn_operand" "ri"))
- (match_operand 2 "" "i")))
- (set (match_operand 3 "register_operand" "=df")
- (call (mem (match_dup 1))
- (match_dup 2)))
- (clobber (match_operand:SI 4 "register_operand" "=d"))]
- "TARGET_ABICALLS && !TARGET_LONG_CALLS"
- "*
-{
- register rtx target = operands[1];
-
- if (GET_CODE (target) == SYMBOL_REF)
- {
- if (GET_MODE (target) == SImode)
- return \"la\\t%^,%1\\n\\tjal\\t%4,%^\";
- else
- return \"la\\t%^,%1\\n\\tjal\\t%4,%^\";
- }
- else if (GET_CODE (target) == CONST_INT)
- return \"li\\t%^,%1\\n\\tjal\\t%4,%^\";
- else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
- return \"move\\t%^,%1\\n\\tjal\\t%4,%^\";
- else
- return \"jal\\t%4,%1\";
-}"
- [(set_attr "type" "call")
- (set_attr "mode" "none")
- (set_attr "length" "2")])
-
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- if (operands[0]) /* silence statement not reached warnings */
- {
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- emit_insn (gen_blockage ());
- DONE;
- }
-}")
-
-;;
-;; ....................
-;;
-;; MISC.
-;;
-;; ....................
-;;
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "%(nop%)"
- [(set_attr "type" "nop")
- (set_attr "mode" "none")
- (set_attr "length" "1")])
-
-;; The MIPS chip does not seem to require stack probes.
-;;
-;; (define_expand "probe"
-;; [(set (match_dup 0)
-;; (match_dup 1))]
-;; ""
-;; "
-;; {
-;; operands[0] = gen_reg_rtx (SImode);
-;; operands[1] = gen_rtx (MEM, SImode, stack_pointer_rtx);
-;; MEM_VOLATILE_P (operands[1]) = TRUE;
-;;
-;; /* fall through and generate default code */
-;; }")
-;;
-
-;;
-;; MIPS4 Conditional move instructions.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (if_then_else:SI
- (match_operator 4 "equality_op"
- [(match_operand:SI 1 "register_operand" "d,d")
- (const_int 0)])
- (match_operand:SI 2 "reg_or_0_operand" "dJ,0")
- (match_operand:SI 3 "reg_or_0_operand" "0,dJ")))]
- "mips_isa >= 4"
- "@
- mov%B4\\t%0,%z2,%1
- mov%b4\\t%0,%z3,%1"
- [(set_attr "type" "move")
- (set_attr "mode" "SI")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (if_then_else:SI
- (match_operator 4 "equality_op"
- [(match_operand:DI 1 "se_register_operand" "d,d")
- (const_int 0)])
- (match_operand:SI 2 "reg_or_0_operand" "dJ,0")
- (match_operand:SI 3 "reg_or_0_operand" "0,dJ")))]
- "mips_isa >= 4"
- "@
- mov%B4\\t%0,%z2,%1
- mov%b4\\t%0,%z3,%1"
- [(set_attr "type" "move")
- (set_attr "mode" "SI")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (if_then_else:SI
- (match_operator 3 "equality_op" [(match_operand:CC 4
- "register_operand"
- "z,z")
- (const_int 0)])
- (match_operand:SI 1 "reg_or_0_operand" "dJ,0")
- (match_operand:SI 2 "reg_or_0_operand" "0,dJ")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "@
- mov%T3\\t%0,%z1,%4
- mov%t3\\t%0,%z2,%4"
- [(set_attr "type" "move")
- (set_attr "mode" "SI")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (if_then_else:DI
- (match_operator 4 "equality_op"
- [(match_operand:SI 1 "register_operand" "d,d")
- (const_int 0)])
- (match_operand:DI 2 "se_reg_or_0_operand" "dJ,0")
- (match_operand:DI 3 "se_reg_or_0_operand" "0,dJ")))]
- "mips_isa >= 4"
- "@
- mov%B4\\t%0,%z2,%1
- mov%b4\\t%0,%z3,%1"
- [(set_attr "type" "move")
- (set_attr "mode" "DI")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (if_then_else:DI
- (match_operator 4 "equality_op"
- [(match_operand:DI 1 "se_register_operand" "d,d")
- (const_int 0)])
- (match_operand:DI 2 "se_reg_or_0_operand" "dJ,0")
- (match_operand:DI 3 "se_reg_or_0_operand" "0,dJ")))]
- "mips_isa >= 4"
- "@
- mov%B4\\t%0,%z2,%1
- mov%b4\\t%0,%z3,%1"
- [(set_attr "type" "move")
- (set_attr "mode" "DI")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (if_then_else:DI
- (match_operator 3 "equality_op" [(match_operand:CC 4
- "register_operand"
- "z,z")
- (const_int 0)])
- (match_operand:DI 1 "se_reg_or_0_operand" "dJ,0")
- (match_operand:DI 2 "se_reg_or_0_operand" "0,dJ")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "@
- mov%T3\\t%0,%z1,%4
- mov%t3\\t%0,%z2,%4"
- [(set_attr "type" "move")
- (set_attr "mode" "DI")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f,f")
- (if_then_else:SF
- (match_operator 4 "equality_op"
- [(match_operand:SI 1 "register_operand" "d,d")
- (const_int 0)])
- (match_operand:SF 2 "register_operand" "f,0")
- (match_operand:SF 3 "register_operand" "0,f")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "@
- mov%B4.s\\t%0,%2,%1
- mov%b4.s\\t%0,%3,%1"
- [(set_attr "type" "move")
- (set_attr "mode" "SF")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f,f")
- (if_then_else:SF
- (match_operator 3 "equality_op" [(match_operand:CC 4
- "register_operand"
- "z,z")
- (const_int 0)])
- (match_operand:SF 1 "register_operand" "f,0")
- (match_operand:SF 2 "register_operand" "0,f")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "@
- mov%T3.s\\t%0,%1,%4
- mov%t3.s\\t%0,%2,%4"
- [(set_attr "type" "move")
- (set_attr "mode" "SF")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (if_then_else:DF
- (match_operator 4 "equality_op"
- [(match_operand:SI 1 "register_operand" "d,d")
- (const_int 0)])
- (match_operand:DF 2 "register_operand" "f,0")
- (match_operand:DF 3 "register_operand" "0,f")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "@
- mov%B4.d\\t%0,%2,%1
- mov%b4.d\\t%0,%3,%1"
- [(set_attr "type" "move")
- (set_attr "mode" "DF")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f,f")
- (if_then_else:DF
- (match_operator 3 "equality_op" [(match_operand:CC 4
- "register_operand"
- "z,z")
- (const_int 0)])
- (match_operand:DF 1 "register_operand" "f,0")
- (match_operand:DF 2 "register_operand" "0,f")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "@
- mov%T3.d\\t%0,%1,%4
- mov%t3.d\\t%0,%2,%4"
- [(set_attr "type" "move")
- (set_attr "mode" "DF")])
-
-;; These are the main define_expand's used to make conditional moves.
-
-(define_expand "movsicc"
- [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
- (set (match_operand:SI 0 "register_operand" "")
- (if_then_else:SI (match_dup 5)
- (match_operand:SI 2 "reg_or_0_operand" "")
- (match_operand:SI 3 "reg_or_0_operand" "")))]
- "mips_isa >= 4"
- "
-{
- gen_conditional_move (operands);
- DONE;
-}")
-
-(define_expand "movdicc"
- [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
- (set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI (match_dup 5)
- (match_operand:DI 2 "se_reg_or_0_operand" "")
- (match_operand:DI 3 "se_reg_or_0_operand" "")))]
- "mips_isa >= 4"
- "
-{
- gen_conditional_move (operands);
- DONE;
-}")
-
-(define_expand "movsfcc"
- [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
- (set (match_operand:SF 0 "register_operand" "")
- (if_then_else:SF (match_dup 5)
- (match_operand:SF 2 "register_operand" "")
- (match_operand:SF 3 "register_operand" "")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT"
- "
-{
- gen_conditional_move (operands);
- DONE;
-}")
-
-(define_expand "movdfcc"
- [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
- (set (match_operand:DF 0 "register_operand" "")
- (if_then_else:DF (match_dup 5)
- (match_operand:DF 2 "register_operand" "")
- (match_operand:DF 3 "register_operand" "")))]
- "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
- "
-{
- gen_conditional_move (operands);
- DONE;
-}")
diff --git a/gcc/config/mips/netbsd.h b/gcc/config/mips/netbsd.h
deleted file mode 100644
index 1973cc352cf..00000000000
--- a/gcc/config/mips/netbsd.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Definitions for DECstation running BSD as target machine for GNU compiler.
- Copyright (C) 1993, 1995, 1996 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. */
-
-#define DECSTATION
-
-/* Look for the include files in the system-defined places. */
-
-#ifndef CROSS_COMPILE
-#undef GPLUSPLUS_INCLUDE_DIR
-#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
-
-#undef GCC_INCLUDE_DIR
-#define GCC_INCLUDE_DIR "/usr/include"
-
-#undef INCLUDE_DEFAULTS
-#define INCLUDE_DEFAULTS \
- { \
- { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \
- { GCC_INCLUDE_DIR, 0, 0 }, \
- { 0, 0, 0 } \
- }
-
-/* Under NetBSD, the normal location of the various *crt*.o files is the
- /usr/lib directory. */
-
-#undef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "/usr/lib/"
-#endif
-
-/* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
- for the special GCC options -static, -assert, and -nostdlib. */
-
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
- %{!nostartfiles:%{!r*:%{!e*:-e __start}}} -dc -dp %{static:-Bstatic} %{assert*}"
-
-/* We have atexit(3). */
-
-#define HAVE_ATEXIT
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Define mips-specific netbsd predefines... */
-#ifndef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__ANSI_COMPAT \
--DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -Dmips \
--D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
--Dunix -D_R3000 \
--Asystem(unix) -Asystem(NetBSD) -Amachine(mips)"
-#endif
-
-#ifndef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
-#endif
-
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-#define STARTFILE_SPEC ""
-
-#ifndef MACHINE_TYPE
-#define MACHINE_TYPE "NetBSD/pmax"
-#endif
-
-#define TARGET_DEFAULT MASK_GAS
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#include "mips/mips.h"
-
-/*
- * Some imports from svr4.h in support of shared libraries.
- * Currently, we need the DECLARE_OBJECT_SIZE stuff.
- */
-
-/* Define the strings used for the special svr4 .type and .size directives.
- These strings generally do not vary from one system running svr4 to
- another, but if a given system (e.g. m88k running svr) needs to use
- different pseudo-op names for these, they may be overridden in the
- file which includes this one. */
-
-#undef TYPE_ASM_OP
-#undef SIZE_ASM_OP
-#undef WEAK_ASM_OP
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-#define WEAK_ASM_OP ".weak"
-
-/* The following macro defines the format used to output the second
- operand of the .type assembler directive. Different svr4 assemblers
- expect various different forms for this operand. The one given here
- is just a default. You may need to override it in your machine-
- specific tm.h file (depending upon the particulars of your assembler). */
-
-#undef TYPE_OPERAND_FMT
-#define TYPE_OPERAND_FMT "@%s"
-
-/* Write the extra assembler code needed to declare a function's result.
- Most svr4 assemblers don't require any special declaration of the
- result value, but there are exceptions. */
-
-#ifndef ASM_DECLARE_RESULT
-#define ASM_DECLARE_RESULT(FILE, RESULT)
-#endif
-
-/* These macros generate the special .type and .size directives which
- are used to set the corresponding fields of the linker symbol table
- entries in an ELF object file under SVR4. These macros also output
- the starting labels for the relevant functions/objects. */
-
-/* Write the extra assembler code needed to declare a function properly.
- Some svr4 assemblers need to also have something extra said about the
- function's return value. We allow for that here. */
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- } while (0)
-
-/* Write the extra assembler code needed to declare an object properly. */
-
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', FILE); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#undef ASM_FINISH_DECLARE_OBJECT
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } while (0)
-
-/* This is how to declare the size of a function. */
-
-#undef ASM_DECLARE_FUNCTION_SIZE
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
- do { \
- if (!flag_inhibit_size_directive) \
- { \
- char label[256]; \
- static int labelno; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ","); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } while (0)
-
-/*
- A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases.
-*/
-#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME) \
-do { \
- extern FILE *asm_out_text_file; \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
- else if ((DECL) && TREE_READONLY (DECL)) \
- fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \
- else \
- fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \
-} while (0)
-
-/* Since gas and gld are standard on NetBSD, we don't need these */
-#undef ASM_FINAL_SPEC
-#undef STARTFILE_SPEC
diff --git a/gcc/config/mips/news4.h b/gcc/config/mips/news4.h
deleted file mode 100644
index f7c464cf353..00000000000
--- a/gcc/config/mips/news4.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Definitions of target machine for GNU compiler. Sony RISC NEWS (mips)
- Copyright (C) 1991 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. */
-
-#define MIPS_NEWS
-
-#define CPP_PREDEFINES "\
--Dr3000 -Dnews3700 -DLANGUAGE_C -DMIPSEB -DSYSTYPE_BSD \
--Dsony_news -Dsony -Dunix -Dmips -Dhost_mips \
--Asystem(unix) -Asystem(bsd) -Acpu(mips) -Amachine(mips)"
-
-#define SYSTEM_INCLUDE_DIR "/usr/include2.0"
-
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc"
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
-
-#define MACHINE_TYPE "RISC NEWS-OS"
-
-#include "mips/mips.h"
diff --git a/gcc/config/mips/news5.h b/gcc/config/mips/news5.h
deleted file mode 100644
index 53abce0e525..00000000000
--- a/gcc/config/mips/news5.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Definitions of target machine for GNU compiler. Sony RISC NEWS (mips) System V version.
- Copyright (C) 1992 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. */
-
-#define MIPS_SYSV
-
-#define CPP_PREDEFINES "\
--Dmips -Dunix -Dhost_mips -Dsony -Dsonyrisc -DMIPSEB -DSYSTYPE_SYSV \
--Asystem(unix) -Asystem(svr3) -Acpu(mips) -Amachine(mips)"
-
-#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
-
-#define LIB_SPEC "\
-%{ZBSD43: -L/usr/ucblib -lucb -lresolv -lsocket -lnsl} \
--nocount %{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s values-Xt.o%s"
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:-nocount crt1.o%s -count}}"
-
-#define MACHINE_TYPE "Sony RISC NEWS (SVR4 mips)"
-
-#define NO_LIB_PROTOTYPE
-
-#define NO_DOLLAR_IN_LABEL
-
-#define NM_FLAGS "-Bp"
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Mips System V.4 doesn't have a getpagesize() function needed by the
- trampoline code, so use the POSIX sysconf function to get it.
- This is only done when compiling the trampoline code. */
-
-#ifdef L_trampoline
-#include <sys/param.h>
-#include <unistd.h>
-
-#ifdef _SC_PAGE_SIZE
-#define getpagesize() sysconf(_SC_PAGE_SIZE)
-
-#else /* older rev of OS */
-#define getpagesize() (NBPC)
-#endif /* !_SC_PAGE_SIZE */
-#endif /* L_trampoline */
-
-#include "mips/mips.h"
diff --git a/gcc/config/mips/osfrose.h b/gcc/config/mips/osfrose.h
deleted file mode 100644
index f6901e85bcb..00000000000
--- a/gcc/config/mips/osfrose.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- DECstation (OSF/1 reference port with OSF/rose) version.
- Copyright (C) 1991, 1992, 1995, 1996 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. */
-
-#define DECSTATION
-#define OSF_OS
-
-#define HALF_PIC_DEBUG TARGET_DEBUG_B_MODE
-#define HALF_PIC_PREFIX "$Lp."
-
-#include "halfpic.h"
-
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))
-
-#define CPP_PREDEFINES "\
--DOSF -DOSF1 -Dbsd4_2 -DMIPSEL -Dhost_mips -Dmips -Dunix -DR3000 -DSYSTYPE_BSD \
--Asystem(unix) -Asystem(xpg4) -Acpu(mips) -Amachine(mips)"
-
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mlong64:-D__PTRDIFF_TYPE__=long\\ int} \
-%{!mlong64:-D__PTRDIFF_TYPE__=int}"
-
-#define SUBTARGET_CPP_SPEC "\
-%{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
-%{.s: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}}"
-
-/* ??? This assumes that GNU as is always used with GNU ld, and MIPS as is
- always used with MIPS ld. */
-#define LINK_SPEC "\
-%{G*} %{EL} %{EB} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} \
-%{!mmips-as: \
- %{v*: -v} \
- %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
- %{nostdlib} %{noshrlib} %{glue}}"
-
-#define LIB_SPEC "-lc"
-
-/* Define this macro meaning that `gcc' should find the library
- `libgcc.a' by hand, rather than passing the argument `-lgcc' to
- tell the linker to do the search. */
-
-#define LINK_LIBGCC_SPECIAL 1
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
-
-#define MACHINE_TYPE "DECstation with OSF/rose objects"
-
-#ifndef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/ccs/gcc/"
-#endif
-
-#ifndef MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
-#endif
-
-/* Turn on -mpic-extern by default. */
-#define CC1_SPEC "\
-%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
-%{mips1:-mfp32 -mgp32} %{mips2:-mfp32 -mgp32} %{mips3:-mfp64 -mgp64} \
-%{G*} \
-%{pic-none: -mno-half-pic} \
-%{pic-lib: -mhalf-pic} \
-%{pic-extern: -mhalf-pic} \
-%{pic-calls: -mhalf-pic} \
-%{pic-names*: -mhalf-pic} \
-%{!pic-*: -mhalf-pic}"
-
-/* Specify size_t and wchar_t types. */
-#define SIZE_TYPE "long unsigned int"
-#define WCHAR_TYPE "unsigned int"
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-#define MAX_WCHAR_TYPE_SIZE MAX_LONG_TYPE_SIZE
-
-/* OSF/1 uses gas, not the mips assembler. */
-#define TARGET_DEFAULT MASK_GAS
-
-/* OSF/rose uses stabs, not ECOFF. */
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* enable dwarf debugging for testing */
-#define DWARF_DEBUGGING_INFO
-/* This is needed by dwarfout.c. */
-#define SET_ASM_OP ".set"
-
-/* Tell collect that the object format is OSF/rose. */
-#define OBJECT_FORMAT_ROSE
-
-/* Tell collect where the appropriate binaries are. */
-#define REAL_LD_FILE_NAME "/usr/ccs/gcc/gld"
-#define REAL_NM_FILE_NAME "/usr/ccs/bin/nm"
-#define REAL_STRIP_FILE_NAME "/usr/ccs/bin/strip"
-
-/* Default to -G 0 unless doing ecoff work. */
-#define MIPS_DEFAULT_GVALUE ((TARGET_MIPS_AS) ? 8 : 0)
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-/* A C statement to output assembler commands which will identify
- the object file as having been compiled with GNU CC (or another
- GNU compiler).
-
- If you don't define this macro, the string `gcc2_compiled.:' is
- output. This string is calculated to define a symbol which, on
- BSD systems, will never be defined for any other reason. GDB
- checks for the presence of this symbol when reading the symbol
- table of an executable.
-
- On non-BSD systems, you must arrange communication with GDB in
- some other fashion. If GDB is not used on your system, you can
- define this macro with an empty body.
-
- On OSF/1, gcc2_compiled. confuses the kernel debugger, so don't
- put it out. */
-
-#define ASM_IDENTIFY_GCC(STREAM)
-
-/* Identify the front-end which produced this file. To keep symbol
- space down, and not confuse kdb, only do this if the language is
- not C. */
-
-#define ASM_IDENTIFY_LANGUAGE(STREAM) \
-{ \
- if (strcmp (lang_identify (), "c") != 0) \
- output_lang_identify (STREAM); \
-}
-
-#include "mips/mips.h"
diff --git a/gcc/config/mips/rtems64.h b/gcc/config/mips/rtems64.h
deleted file mode 100644
index d4d8ac0ab3f..00000000000
--- a/gcc/config/mips/rtems64.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Definitions for rtems targetting a MIPS ORION using ecoff.
-
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Joel Sherrill (joel@OARcorp.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 "mips/elforion.h"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dmips -DMIPSEB -DR4000 -D_mips -D_MIPSEB -D_R4000 \
- -Drtems -D__rtems__ -Asystem(rtems)"
-
-/* end of rtems64.h */
diff --git a/gcc/config/mips/sni-gas.h b/gcc/config/mips/sni-gas.h
deleted file mode 100644
index 752866536b8..00000000000
--- a/gcc/config/mips/sni-gas.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "mips/sni-svr4.h"
-
-/* Enable debugging. */
-#define DBX_DEBUGGING_INFO
-#define SDB_DEBUGGING_INFO
-#define MIPS_DEBUGGING_INFO
-
-#define DWARF_DEBUGGING_INFO
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
-
-/* We need to use .esize and .etype instead of .size and .type to
- avoid conflicting with ELF directives. These are only recognized
- by gas, anyhow, not the native assembler. */
-#undef PUT_SDB_SIZE
-#define PUT_SDB_SIZE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.esize\t%d;", (a)); \
-} while (0)
-
-#undef PUT_SDB_TYPE
-#define PUT_SDB_TYPE(a) \
-do { \
- extern FILE *asm_out_text_file; \
- fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
-} while (0)
-
-
-/* This is how to equate one symbol to another symbol. The syntax used is
- `SYM1=SYM2'. Note that this is different from the way equates are done
- with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
-
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t"); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, " = "); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-
-
diff --git a/gcc/config/mips/sni-svr4.h b/gcc/config/mips/sni-svr4.h
deleted file mode 100644
index f42a882fb82..00000000000
--- a/gcc/config/mips/sni-svr4.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Definitions of target machine for GNU compiler. SNI SINIX version.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Marco Walther (Marco.Walther@mch.sni.de).
-
-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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#define MIPS_SVR4
-
-#define CPP_PREDEFINES "\
--Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_SVR4 \
--D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_SVR4 \
--Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(mips)"
-
-#define SUBTARGET_CPP_SIZE_SPEC "\
--D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int"
-
-#define LINK_SPEC "\
-%{G*} \
-%{!mgas: \
- %{dy} %{dn}}"
-
-#define LIB_SPEC "\
- %{p:-lprof1} \
- %{!p:%{pg:-lprof1} \
- %{!pg:-L/usr/ccs/lib/ -lc /usr/ccs/lib/crtn.o%s}}"
-
-#define STARTFILE_SPEC "\
- %{pg:gcrt0.o%s} \
- %{!pg:%{p:mcrt0.o%s} \
- %{!p:/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xt.o%s}}"
-
-/* Mips System V.4 doesn't have a getpagesize() function needed by the
- trampoline code, so use the POSIX sysconf function to get it.
- This is only done when compiling the trampoline code. */
-
-#ifdef L_trampoline
-#include <unistd.h>
-
-#define getpagesize() sysconf(_SC_PAGE_SIZE)
-#endif /* L_trampoline */
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-#define OBJECT_FORMAT_ELF
-
-#define TARGET_DEFAULT MASK_ABICALLS
-#define ABICALLS_ASM_OP ".option pic2"
-
-#define MACHINE_TYPE "SNI running SINIX 5.42"
-
-#define MIPS_DEFAULT_GVALUE 0
-
-#define NM_FLAGS "-p"
-
-/* wir haben ein Problem, wenn in einem Assembler-File keine .text-section
- erzeugt wird. Dann landen diese Pseudo-Labels in irgendeiner anderen
- section, z.B. .reginfo. Das macht den ld sehr ungluecklich. */
-
-#define ASM_IDENTIFY_GCC(mw_stream) \
- fprintf(mw_stream, "\t.ident \"gcc2_compiled.\"\n");
-
-#define ASM_IDENTIFY_LANGUAGE(STREAM)
-
-#define ASM_LONG ".word\t"
-#define ASM_GLOBAL ".rdata\n\t\t.globl\t"
-
-#include "mips/mips.h"
-
-/* We do not want to run mips-tfile! */
-#undef ASM_FINAL_SPEC
-
-#undef OBJECT_FORMAT_COFF
-
-/* We don't support debugging info for now. */
-#undef DBX_DEBUGGING_INFO
-#undef SDB_DEBUGGING_INFO
-#undef MIPS_DEBUGGING_INFO
-#undef PREFERRED_DEBUGGING_TYPE
diff --git a/gcc/config/mips/svr3-4.h b/gcc/config/mips/svr3-4.h
deleted file mode 100644
index 73402b26662..00000000000
--- a/gcc/config/mips/svr3-4.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS RISC-OS System V version.
- Copyright (C) 1991 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. */
-
-#define MIPS_SYSV
-
-#define CPP_PREDEFINES "\
--Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_SYSV \
--D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_SYSV \
--Asystem(unix) -Asystem(svr3) -Acpu(mips) -Amachine(mips)"
-
-#define STANDARD_INCLUDE_DIR "/sysv/usr/include"
-
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
--systype /sysv/"
-
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s}}"
-
-#define MACHINE_TYPE "RISC-OS System V Mips"
-
-/* Override defaults for finding the MIPS tools. */
-#define MD_STARTFILE_PREFIX "/sysv/usr/lib/cmplrs/cc/"
-#define MD_EXEC_PREFIX "/sysv/usr/lib/cmplrs/cc/"
-
-/* Mips System V doesn't have a getpagesize() function needed by the
- trampoline code, so use the POSIX sysconf function to get it.
- This is only done when compiling the trampoline code. */
-
-#ifdef L_trampoline
-#include <sys/param.h>
-#include <unistd.h>
-
-#ifdef _SC_PAGE_SIZE
-#define getpagesize() sysconf(_SC_PAGE_SIZE)
-
-#else /* older rev of OS */
-#define getpagesize() (NBPC)
-#endif /* !_SC_PAGE_SIZE */
-#endif /* L_trampoline */
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-#include "mips/mips.h"
diff --git a/gcc/config/mips/svr3-5.h b/gcc/config/mips/svr3-5.h
deleted file mode 100644
index 85bc0fc7fa7..00000000000
--- a/gcc/config/mips/svr3-5.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS RISC-OS 5.0 System V version.
- Copyright (C) 1991 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. */
-
-#define MIPS_SYSV
-
-#define CPP_PREDEFINES "\
--Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_SYSV \
--D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_SYSV \
--Asystem(unix) -Asystem(svr3) -Acpu(mips) -Amachine(mips)"
-
-#define STANDARD_INCLUDE_DIR "/sysv/usr/include"
-
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
-%{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
--systype /sysv/ "
-
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s}}"
-
-#define MACHINE_TYPE "RISC-OS System V Mips"
-
-/* Override defaults for finding the MIPS tools. */
-#define MD_STARTFILE_PREFIX "/sysv/usr/lib/cmplrs/cc/"
-#define MD_EXEC_PREFIX "/sysv/usr/lib/cmplrs/cc/"
-
-/* Mips System V doesn't have a getpagesize() function needed by the
- trampoline code, so use the POSIX sysconf function to get it.
- This is only done when compiling the trampoline code. */
-
-#ifdef L_trampoline
-#include <sys/param.h>
-#include <unistd.h>
-
-/* In at least 5.0 and 5.01, there is no _SC_PAGE_SIZE macro, only a
- _SC_PAGESIZE macro. */
-#ifdef _SC_PAGESIZE
-#define _SC_PAGE_SIZE _SC_PAGESIZE
-#endif
-
-#ifdef _SC_PAGE_SIZE
-#define getpagesize() sysconf(_SC_PAGE_SIZE)
-
-#else /* older rev of OS */
-#define getpagesize() (NBPC)
-#endif /* !_SC_PAGE_SIZE */
-#endif /* L_trampoline */
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-#include "mips/mips.h"
-
-/* Some assemblers have a bug that causes backslash escaped chars in .ascii
- to be misassembled, so we just completely avoid it. */
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- unsigned char *s; \
- int i; \
- for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++) \
- { \
- if ((i % 8) == 0) \
- fputs ("\n\t.byte\t", (FILE)); \
- fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
- } \
- fputs ("\n", (FILE)); \
-} while (0)
diff --git a/gcc/config/mips/svr4-4.h b/gcc/config/mips/svr4-4.h
deleted file mode 100644
index 62b15910600..00000000000
--- a/gcc/config/mips/svr4-4.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS RISC-OS System V.4 version.
- Copyright (C) 1992 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. */
-
-#define MIPS_SVR4
-
-#define CPP_PREDEFINES "\
--Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_SVR4 \
--D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_SVR4 \
--Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(mips)"
-
-#define STANDARD_INCLUDE_DIR "/svr4/usr/include"
-
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
--systype /svr4/"
-
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s}}"
-
-#define MACHINE_TYPE "RISC-OS System V.4 Mips"
-
-/* Override defaults for finding the MIPS tools. */
-#define MD_STARTFILE_PREFIX "/svr4/usr/lib/cmplrs/cc/"
-#define MD_EXEC_PREFIX "/svr4/usr/lib/cmplrs/cc/"
-
-/* Mips System V.4 doesn't have a getpagesize() function needed by the
- trampoline code, so use the POSIX sysconf function to get it.
- This is only done when compiling the trampoline code. */
-
-#ifdef L_trampoline
-#include <unistd.h>
-
-#define getpagesize() sysconf(_SC_PAGE_SIZE)
-#endif /* L_trampoline */
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-#include "mips/mips.h"
diff --git a/gcc/config/mips/svr4-5.h b/gcc/config/mips/svr4-5.h
deleted file mode 100644
index ad51f135da0..00000000000
--- a/gcc/config/mips/svr4-5.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Definitions of target machine for GNU compiler. MIPS RISC-OS 5.0 System V.4 version.
- Copyright (C) 1992 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. */
-
-#define MIPS_SVR4
-
-#define CPP_PREDEFINES \
-"-Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_SVR4 \
--D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_SVR4 \
--D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 \
--Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(mips)"
-
-#define STANDARD_INCLUDE_DIR "/svr4/usr/include"
-
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
-%{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
--systype /svr4/ "
-
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"
-
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s}}\
- %{ansi:/svr4/usr/ccs/lib/values-Xc.o%s} \
- %{!ansi: \
- %{traditional:/svr4/usr/ccs/lib/values-Xt.o%s} \
- %{!traditional:/svr4/usr/ccs/lib/values-Xa.o%s}}"
-
-#define MACHINE_TYPE "RISC-OS System V.4 Mips"
-
-/* Override defaults for finding the MIPS tools. */
-#define MD_STARTFILE_PREFIX "/svr4/usr/lib/cmplrs/cc/"
-#define MD_EXEC_PREFIX "/svr4/usr/lib/cmplrs/cc/"
-
-/* Mips System V.4 doesn't have a getpagesize() function needed by the
- trampoline code, so use the POSIX sysconf function to get it.
- This is only done when compiling the trampoline code. */
-
-#ifdef L_trampoline
-#include <unistd.h>
-
-/* In at least 5.0 and 5.01, there is no _SC_PAGE_SIZE macro, only a
- _SC_PAGESIZE macro. */
-#ifdef _SC_PAGESIZE
-#define _SC_PAGE_SIZE _SC_PAGESIZE
-#endif
-
-#define getpagesize() sysconf(_SC_PAGE_SIZE)
-#endif /* L_trampoline */
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-#include "mips/mips.h"
-
-/* Some assemblers have a bug that causes backslash escaped chars in .ascii
- to be misassembled, so we just completely avoid it. */
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- unsigned char *s; \
- int i; \
- for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++) \
- { \
- if ((i % 8) == 0) \
- fputs ("\n\t.byte\t", (FILE)); \
- fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
- } \
- fputs ("\n", (FILE)); \
-} while (0)
diff --git a/gcc/config/mips/svr4-t.h b/gcc/config/mips/svr4-t.h
deleted file mode 100644
index 086519485a8..00000000000
--- a/gcc/config/mips/svr4-t.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Definitions of target machine for GNU compiler. Tandem S2 w/ NonStop UX. */
-#include "mips/svr4-5.h"
-
-/* Use the default value for this. */
-#undef STANDARD_INCLUDE_DIR
-
-#undef MACHINE_TYPE
-#define MACHINE_TYPE "TANDEM System V.4 Mips"
-
-/* Use the default values in mips.h. */
-#undef MD_STARTFILE_PREFIX
-#undef MD_EXEC_PREFIX
-#define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"
-#define MD_EXEC_PREFIX "/usr/lib/cmplrs/cc/"
-
-/* These are the same as the ones in svr4-5.h, except that references to
- /svr4/ have been removed. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s}}\
- %{ansi:/usr/lib/values-Xc.o%s} \
- %{!ansi: \
- %{traditional:/usr/lib/values-Xt.o%s} \
- %{!traditional:/usr/lib/values-Xa.o%s}}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "\
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
-%{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
-%{!shared: %{!non_shared: %{!call_shared: -non_shared}}}"
diff --git a/gcc/config/mips/t-bsd b/gcc/config/mips/t-bsd
deleted file mode 100644
index f9c6fc84004..00000000000
--- a/gcc/config/mips/t-bsd
+++ /dev/null
@@ -1,12 +0,0 @@
-# Exactly the same as t-mips, except we must define SYSTEM_HEADER_DIR
-# to point to the bsd43 include files.
-SYSTEM_HEADER_DIR = /bsd43/usr/include
-
-# We have a premade insn-attrtab.c to save the hour it takes to run genattrtab.
-# PREMADE_ATTRTAB = $(srcdir)/config/mips/mips-at.c
-# PREMADE_ATTRTAB_MD = $(srcdir)/config/mips/mips-at.md
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/t-bsd-gas b/gcc/config/mips/t-bsd-gas
deleted file mode 100644
index bfa5a7ec38b..00000000000
--- a/gcc/config/mips/t-bsd-gas
+++ /dev/null
@@ -1,8 +0,0 @@
-# Exactly the same as t-mips-gas, except we must define SYSTEM_HEADER_DIR
-# to point to the bsd43 include files.
-SYSTEM_HEADER_DIR = /bsd43/usr/include
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/t-cross64 b/gcc/config/mips/t-cross64
deleted file mode 100644
index 9482412a844..00000000000
--- a/gcc/config/mips/t-cross64
+++ /dev/null
@@ -1,19 +0,0 @@
-SYSTEM_HEADER_DIR = /usr/cross64/usr/include
-
-AR = /usr/cross64/usr/bin/ar
-
-FLOAT_H = $(CROSS_FLOAT_H)
-
-# The rest of the file is identical to t-iris6.
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-MULTILIB_OPTIONS=mips1/mips2/mips3/mips4
-MULTILIB_DIRNAMES=
-MULTILIB_MATCHES=
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/mips/t-ecoff b/gcc/config/mips/t-ecoff
deleted file mode 100644
index 1b0d31702a7..00000000000
--- a/gcc/config/mips/t-ecoff
+++ /dev/null
@@ -1,75 +0,0 @@
-CONFIG2_H = $(srcdir)/config/mips/ecoff.h
-
-# We have a premade insn-attrtab.c to save the hour it takes to run genattrtab.
-# PREMADE_ATTRTAB = $(srcdir)/config/mips/mips-at.c
-# PREMADE_ATTRTAB_MD = $(srcdir)/config/mips/mips-at.md
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# We must build libgcc2.a with -G 0, in case the user wants to link
-# without the $gp register.
-LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g1 -G 0
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#ifdef __MIPSEL__' > dp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c
- echo '#endif' >> dp-bit.c
- echo '#define US_SOFTWARE_GOFAST' >> dp-bit.c
- cat $(srcdir)/config/fp-bit.c >> dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- echo '#ifdef __MIPSEL__' >> fp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
- echo '#endif' >> fp-bit.c
- echo '#define US_SOFTWARE_GOFAST' >> fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-# Build the libraries for both hard and soft floating point
-
-MULTILIB_OPTIONS = msoft-float/msingle-float EL/EB mips1/mips3
-MULTILIB_DIRNAMES = soft-float single el eb mips1 mips3
-MULTILIB_MATCHES = msingle-float=m4650
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# Add additional dependencies to recompile selected modules whenever the
-# tm.h file changes. The files compiled are:
-#
-# gcc.c (*_SPEC changes)
-# toplev.c (new switches + assembly output changes)
-# sdbout.c (debug format changes)
-# dbxout.c (debug format changes)
-# dwarfout.c (debug format changes)
-# final.c (assembly output changes)
-# varasm.c (assembly output changes)
-# cse.c (cost functions)
-# insn-output.c (possible ifdef changes in tm.h)
-# regclass.c (fixed/call used register changes)
-# cccp.c (new preprocessor macros, -v version #)
-# explow.c (GO_IF_LEGITIMATE_ADDRESS)
-# recog.c (GO_IF_LEGITIMATE_ADDRESS)
-# reload.c (GO_IF_LEGITIMATE_ADDRESS)
-
-gcc.o: $(CONFIG2_H)
-toplev.o: $(CONFIG2_H)
-sdbout.o: $(CONFIG2_H)
-dbxout.o: $(CONFIG2_H)
-dwarfout.o: $(CONFIG2_H)
-final.o: $(CONFIG2_H)
-varasm.o: $(CONFIG2_H)
-cse.o: $(CONFIG2_H)
-insn-output.o: $(CONFIG2_H)
-regclass.o: $(CONFIG2_H)
-cccp.o: $(CONFIG2_H)
-explow.o: $(CONFIG2_H)
-recog.o: $(CONFIG2_H)
-reload.o: $(CONFIG2_H)
diff --git a/gcc/config/mips/t-iris6 b/gcc/config/mips/t-iris6
deleted file mode 100644
index 85a63f06e2e..00000000000
--- a/gcc/config/mips/t-iris6
+++ /dev/null
@@ -1,20 +0,0 @@
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# ??? If no mabi=X option given, but a mipsX option is, then should deal
-# with that.
-# ??? mabi=32 is deliberately left off the list because it doesn't work yet.
-MULTILIB_OPTIONS=mabi=n32/mabi=64
-MULTILIB_DIRNAMES=
-MULTILIB_MATCHES=
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# For svr4 we build crtbegin.o and crtend.o which serve to add begin and
-# end labels to the .ctors and .dtors section when we link using gcc.
-
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o
-CRTSTUFF_T_CFLAGS=-g1
diff --git a/gcc/config/mips/t-mips b/gcc/config/mips/t-mips
deleted file mode 100644
index e57a55af5de..00000000000
--- a/gcc/config/mips/t-mips
+++ /dev/null
@@ -1,8 +0,0 @@
-# We have a premade insn-attrtab.c to save the hour it takes to run genattrtab.
-# PREMADE_ATTRTAB = $(srcdir)/config/mips/mips-at.c
-# PREMADE_ATTRTAB_MD = $(srcdir)/config/mips/mips-at.md
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/t-mips-gas b/gcc/config/mips/t-mips-gas
deleted file mode 100644
index 94f1c442b68..00000000000
--- a/gcc/config/mips/t-mips-gas
+++ /dev/null
@@ -1,4 +0,0 @@
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/t-osfrose b/gcc/config/mips/t-osfrose
deleted file mode 100644
index e57a55af5de..00000000000
--- a/gcc/config/mips/t-osfrose
+++ /dev/null
@@ -1,8 +0,0 @@
-# We have a premade insn-attrtab.c to save the hour it takes to run genattrtab.
-# PREMADE_ATTRTAB = $(srcdir)/config/mips/mips-at.c
-# PREMADE_ATTRTAB_MD = $(srcdir)/config/mips/mips-at.md
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/t-svr3 b/gcc/config/mips/t-svr3
deleted file mode 100644
index 273c710882a..00000000000
--- a/gcc/config/mips/t-svr3
+++ /dev/null
@@ -1,12 +0,0 @@
-# Exactly the same as t-mips, except we must define SYSTEM_HEADER_DIR
-# to point to the svr3 include files.
-SYSTEM_HEADER_DIR = /sysv/usr/include
-
-# We have a premade insn-attrtab.c to save the hour it takes to run genattrtab.
-# PREMADE_ATTRTAB = $(srcdir)/config/mips/mips-at.c
-# PREMADE_ATTRTAB_MD = $(srcdir)/config/mips/mips-at.md
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/t-svr3-gas b/gcc/config/mips/t-svr3-gas
deleted file mode 100644
index 99238f25928..00000000000
--- a/gcc/config/mips/t-svr3-gas
+++ /dev/null
@@ -1,8 +0,0 @@
-# Exactly the same as t-mips-gas, except we must define SYSTEM_HEADER_DIR
-# to point to the svr3 include files.
-SYSTEM_HEADER_DIR = /sysv/usr/include
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/t-svr4 b/gcc/config/mips/t-svr4
deleted file mode 100644
index 88029b92a55..00000000000
--- a/gcc/config/mips/t-svr4
+++ /dev/null
@@ -1,12 +0,0 @@
-# Exactly the same as t-mips, except we must define SYSTEM_HEADER_DIR
-# to point to the svr4 include files.
-SYSTEM_HEADER_DIR = /svr4/usr/include
-
-# We have a premade insn-attrtab.c to save the hour it takes to run genattrtab.
-# PREMADE_ATTRTAB = $(srcdir)/config/mips/mips-at.c
-# PREMADE_ATTRTAB_MD = $(srcdir)/config/mips/mips-at.md
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/t-svr4-gas b/gcc/config/mips/t-svr4-gas
deleted file mode 100644
index 845b091ef38..00000000000
--- a/gcc/config/mips/t-svr4-gas
+++ /dev/null
@@ -1,8 +0,0 @@
-# Exactly the same as t-mips-gas, except we must define SYSTEM_HEADER_DIR
-# to point to the svr4 include files.
-SYSTEM_HEADER_DIR = /svr4/usr/include
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/t-ultrix b/gcc/config/mips/t-ultrix
deleted file mode 100644
index 7c1a845ddb8..00000000000
--- a/gcc/config/mips/t-ultrix
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG2_H = $(srcdir)/config/mips/mips.h
-
-# We have a premade insn-attrtab.c to save the hour it takes to run genattrtab.
-# PREMADE_ATTRTAB = $(srcdir)/config/mips/mips-at.c
-# PREMADE_ATTRTAB_MD = $(srcdir)/config/mips/mips-at.md
-
-# Suppress building libgcc1.a, since the MIPS compiler port is complete
-# and does not need anything from libgcc1.a.
-LIBGCC1 =
-CROSS_LIBGCC1 =
diff --git a/gcc/config/mips/ultrix.h b/gcc/config/mips/ultrix.h
deleted file mode 100644
index cb18a5d4eba..00000000000
--- a/gcc/config/mips/ultrix.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Definitions of target machine for GNU compiler. DECstation (ultrix) version.
- Copyright (C) 1991 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. */
-
-#define DECSTATION
-
-#ifndef CPP_PREDEFINES
-#define CPP_PREDEFINES "\
--D__ANSI_COMPAT -DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD \
--Dbsd4_2 -Dhost_mips -Dmips -Dultrix -Dunix \
--Asystem(unix) -Asystem(bsd) -Acpu(mips) -Amachine(mips)"
-#endif
-
-#ifndef LIB_SPEC
-#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc"
-#endif
-
-#ifndef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
-#endif
-
-#ifndef MACHINE_TYPE
-#define MACHINE_TYPE "DECstation running ultrix"
-#endif
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. Ultrix 4.x has this, 3.x probably does not. */
-#define HAVE_ATEXIT
-
-/* Generate calls to memcpy, etc., not bcopy, etc. */
-#define TARGET_MEM_FUNCTIONS
-
-#include "mips/mips.h"
diff --git a/gcc/config/mips/x-dec-osf1 b/gcc/config/mips/x-dec-osf1
deleted file mode 100644
index a3aff92b37b..00000000000
--- a/gcc/config/mips/x-dec-osf1
+++ /dev/null
@@ -1,18 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds). We need to pass
-# the -Wf,-XNg1500 option so the compiler can compile the
-# G++ file cp-parse.c. Otherwise it complains about
-# too many case statements. -Olimit is so the user
-# can use -O2. Down with fixed size tables!
-
-CC = $(OLDCC)
-OPT = -O1
-OLDCC = cc -Wf,-XNg1500 -Olimit 3000 $(OPT)
-INSTALL = installbsd -c
-
-# The bison output files are machine-indep,
-# so different flags for a particular machine are not useful.
-#BISONFLAGS = -l
diff --git a/gcc/config/mips/x-iris b/gcc/config/mips/x-iris
deleted file mode 100644
index 3d49e4c7467..00000000000
--- a/gcc/config/mips/x-iris
+++ /dev/null
@@ -1,28 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds). We need to pass
-# the -Wf,-XNg1500 option so the compiler can compile the
-# G++ file cp-parse.c. Otherwise it complains about
-# too many case statements. -Olimit is so the user
-# can use -O2. Down with fixed size tables!
-# The -cckr is to turn off strict ANSI checking.
-
-CC = $(OLDCC)
-OPT = -O1
-OLDCC = cc -Wf,-XNh2000,-XNg1500 -Olimit 3000 -cckr $(OPT)
-
-# The bison output files are machine-indep,
-# so different flags for a particular machine are not useful.
-#BISONFLAGS = -l
-
-# -lmld is so we can link collect2 running native.
-# -lmalloc is supposed to be faster than the normal malloc
-CLIB = -lmld -lmalloc
-
-# Show we need to use the C version of ALLOCA
-ALLOCA = alloca.o
-
-# Find all of the declarations from the header files
-FIXPROTO_DEFINES= -D__EXTENSIONS__ -D_LANGUAGE_C_PLUS_PLUS
diff --git a/gcc/config/mips/x-iris3 b/gcc/config/mips/x-iris3
deleted file mode 100644
index d4b55dde20a..00000000000
--- a/gcc/config/mips/x-iris3
+++ /dev/null
@@ -1,28 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds). We need to pass
-# the -Wf,-XNg1500 option so the compiler can compile the
-# G++ file cp-parse.c. Otherwise it complains about
-# too many case statements. -Olimit is so the user
-# can use -O2. Down with fixed size tables!
-
-# In at least one version of Irix, v3.3.2, the compiler does not accept
-# the -cckr option, so, lets try without it for all versions of Irix 3.x.
-# The -cckr is to turn off strict ANSI checking.
-
-CC = $(OLDCC)
-OPT = -O1
-OLDCC = cc -Wf,-XNh2000,-XNg1500 -Olimit 3000 $(OPT)
-
-# The bison output files are machine-indep,
-# so different flags for a particular machine are not useful.
-#BISONFLAGS = -l
-
-# -lmld is so we can link collect2 running native.
-# -lmalloc is supposed to be faster than the normal malloc
-CLIB = -lmld -lmalloc
-
-# Show we need to use the C version of ALLOCA
-ALLOCA = alloca.o
diff --git a/gcc/config/mips/x-iris6 b/gcc/config/mips/x-iris6
deleted file mode 100644
index 88c41f4dfe4..00000000000
--- a/gcc/config/mips/x-iris6
+++ /dev/null
@@ -1,11 +0,0 @@
-# We force the use of the O32 ABI for two reasons.
-# 1) For consistency, because some versions of Irix 6 default to the O32 ABI
-# and some versions default to the N64 ABI.
-# 2) To avoid SGI compiler bugs. The v6.x and v7.0 compilers from SGI have
-# bugs that cause gcc to be miscompiled when the N32 or N64 ABIs are used.
-# The O32 ABI is known to be OK.
-CC = $(OLDCC)
-OLDCC = cc -32
-
-# Find all of the declarations from the header files
-FIXPROTO_DEFINES= -D__EXTENSIONS__ -D_SGI_SOURCE -D_LANGUAGE_C_PLUS_PLUS
diff --git a/gcc/config/mips/x-mips b/gcc/config/mips/x-mips
deleted file mode 100644
index 7b407431a81..00000000000
--- a/gcc/config/mips/x-mips
+++ /dev/null
@@ -1,20 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds). We need to pass
-# the -Wf,-XNg1500 option so the compiler can compile the
-# G++ file cp-parse.c. Otherwise it complains about
-# too many case statements. The -Olimit is so the user
-# can use -O2. Down with fixed size tables!
-
-CC = $(OLDCC)
-OPT = -O1
-OLDCC = cc -Wf,-XNg1500,-XNh2000 -Olimit 3000 $(OPT)
-
-# The bison output files are machine-indep,
-# so different flags for a particular machine are not useful.
-#BISONFLAGS = -l
-
-# This is so we can link collect2 running native.
-CLIB = -lmld
diff --git a/gcc/config/mips/x-netbsd b/gcc/config/mips/x-netbsd
deleted file mode 100644
index ed1709cc044..00000000000
--- a/gcc/config/mips/x-netbsd
+++ /dev/null
@@ -1,16 +0,0 @@
-# Don't run fixproto
-STMP_FIXPROTO =
-
-# We don't need GCC's own include files.
-USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/varargs.h \
- $(srcdir)/ginclude/va-mips.h
-XLIMITS_H =
-
-# We don't need even the files GCC insists we need.
-GENINCLUDES = Makefile.in
-
-# A lot of stuff needs to go elsewhere.
-includedir=$(exec_prefix)/include
-infodir=$(exec_prefix)/share/info
-tooldir=$(libdir)/cross/$(target)
-mandir=$(exec_prefix)/share/man/man1
diff --git a/gcc/config/mips/x-nws3250v4 b/gcc/config/mips/x-nws3250v4
deleted file mode 100644
index 4f5cf26eede..00000000000
--- a/gcc/config/mips/x-nws3250v4
+++ /dev/null
@@ -1,19 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds). We need to pass
-# the -Wf,-XNg1500 option so the compiler can compile the
-# G++ file cp-parse.c. Otherwise it complains about
-# too many case statements. Down with fixed size tables!
-
-CC = $(OLDCC)
-OLDCC = cc -Wf,-XNg1500
-CCLIBFLAGS = -G 0
-
-ALLOCA = alloca.o
-
-# The bison output files are machine-indep,
-# so different flags for a particular machine are not useful.
-#BISONFLAGS = -l
-
diff --git a/gcc/config/mips/x-osfrose b/gcc/config/mips/x-osfrose
deleted file mode 100644
index 20ed4772863..00000000000
--- a/gcc/config/mips/x-osfrose
+++ /dev/null
@@ -1,33 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds).
-
-BUILD =
-CC = $(OLDCC)
-CLIB = -lld
-X_CFLAGS = $(DEB_OPT) $(MSTATS) $(SHLIB) $(X_DEFINES)
-X_CFLAGS_NODEBUG = $(NO_DEBUG) $(MSTATS) $(OPT) $(PROFILE) $(SHLIB) $(X_DEFINES) $(XCFLAGS)
-CCLIBFLAGS = -O -pic-extern
-CPP_ABORT = # -Dabort=fancy_abort
-CPPFLAGS = $(CPP_ABORT) $(SYSTEM_INCLUDES)
-DEB_OPT = $(OPT) $(DEBUG) $(PROFILE)
-DEBUG =
-DEBUG_COLLECT = # -DDEBUG
-CCLIBFLAGS = -O -DNO_HALF_PIC
-GCC_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -B./ -DPOSIX -DNO_HALF_PIC
-INSTALL = installbsd -c
-LIBGCC2_CFLAGS = -O2 $(GCC_CFLAGS) -g1 -pic-extern
-LDFLAGS =
-MSTATS = # -mstats
-OLDCC = /usr/ccs/gcc/gcc
-OPT = -O2
-PROFILE =
-SHLIB = -pic-none
-SYSTEM_INCLUDES = # -I${BUILD}/usr/include
-X_DEFINES = -Dvfork=fork
-
-libdir = /usr/ccs
-mandir = /usr/ccs/gcc/$(target)/$(version)
-bindir = /usr/ccs/gcc/$(target)/$(version)
diff --git a/gcc/config/mips/x-sni-svr4 b/gcc/config/mips/x-sni-svr4
deleted file mode 100644
index f986f88162f..00000000000
--- a/gcc/config/mips/x-sni-svr4
+++ /dev/null
@@ -1,18 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds).
-# -Olimit is so the user can use -O2. Down with fixed
-# size tables!
-
-CC = $(OLDCC)
-OPT =
-OLDCC = cc -Olimit 3000 $(OPT)
-
-X_CFLAGS = -DNO_SYS_SIGLIST
-
-# Show we need to use the C version of ALLOCA
-# The SVR3 configurations have it, but the SVR4 configurations don't.
-# For now, just try using it for all SVR* configurations.
-ALLOCA = alloca.o
diff --git a/gcc/config/mips/x-sony b/gcc/config/mips/x-sony
deleted file mode 100644
index c64593d7d7d..00000000000
--- a/gcc/config/mips/x-sony
+++ /dev/null
@@ -1,18 +0,0 @@
-# Make internal tables bigger.
-OLDCC=cc -Wf,-XNg1500,-XNh2000 -Olimit 3000 $(OPT)
-
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds). We need to pass
-# the -Wf,-XNg1500 option so the compiler can compile the
-# G++ file cp-parse.c. Otherwise it complains about
-# too many case statements. The -Olimit is so the user
-# can use -O2. Down with fixed size tables!
-
-CC = $(OLDCC)
-OPT = -O1
-
-# This is so we can link collect2 running native.
-CLIB = -lmld
diff --git a/gcc/config/mips/x-sysv b/gcc/config/mips/x-sysv
deleted file mode 100644
index 2c173b159a5..00000000000
--- a/gcc/config/mips/x-sysv
+++ /dev/null
@@ -1,26 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds). We need to pass
-# the -Wf,-XNg1500 option so the compiler can compile the
-# G++ file cp-parse.c. Otherwise it complains about
-# too many case statements. -Olimit is so the user
-# can use -O2. Down with fixed size tables!
-
-CC = $(OLDCC)
-OPT = -O1
-OLDCC = cc -Wf,-XNg1500,-XNh2000 -Olimit 3000 $(OPT)
-
-# The bison output files are machine-indep,
-# so different flags for a particular machine are not useful.
-#BISONFLAGS = -l
-
-# This enables collect2 to link.
-# Some systems use version 2.11 of the compilers. Some use version 3.11.
-CLIB= -L/usr/lib/cmplrs/cc2.11 -L/usr/lib/cmplrs/cc3.11 -lmld
-
-# Show we need to use the C version of ALLOCA
-# The SVR3 configurations have it, but the SVR4 configurations don't.
-# For now, just try using it for all SVR* configurations.
-ALLOCA = alloca.o
diff --git a/gcc/config/mips/x-ultrix b/gcc/config/mips/x-ultrix
deleted file mode 100644
index 6e46f0eafd5..00000000000
--- a/gcc/config/mips/x-ultrix
+++ /dev/null
@@ -1,17 +0,0 @@
-# Define CC and OLDCC as the same, so that the tests:
-# if [ x"$(OLDCC)" = x"$(CC)" ] ...
-#
-# will succeed (if OLDCC != CC, it is assumed that GCC is
-# being used in secondary stage builds). We need to pass
-# the -Wf,-XNg1500 option so the compiler can compile the
-# G++ file cp-parse.c. Otherwise it complains about
-# too many case statements. -Olimit is so the user
-# can use -O2. Down with fixed size tables!
-
-CC = $(OLDCC)
-OPT = -O1
-OLDCC = cc -Wf,-XNg1500 -Olimit 3000 $(OPT)
-
-# The bison output files are machine-indep,
-# so different flags for a particular machine are not useful.
-#BISONFLAGS = -l
diff --git a/gcc/config/mips/xm-iris5.h b/gcc/config/mips/xm-iris5.h
deleted file mode 100644
index 72387b29ccc..00000000000
--- a/gcc/config/mips/xm-iris5.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "mips/xm-mips.h"
-
-#define USG
-#define HAVE_VPRINTF
-
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-
diff --git a/gcc/config/mips/xm-iris6.h b/gcc/config/mips/xm-iris6.h
deleted file mode 100644
index ed7dd316b5b..00000000000
--- a/gcc/config/mips/xm-iris6.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#define MIPS_OVERRIDE_ALLOCA
-#ifndef __GNUC__
-#include <alloca.h>
-#else
-extern void *alloca ();
-#endif
-
-#include "mips/xm-iris5.h"
-
-#undef HOST_BITS_PER_LONG
-#define HOST_BITS_PER_LONG _MIPS_SZLONG
-
-/* Declare some functions needed for this machine. We don't want to
- include these in the sources since other machines might define them
- differently. */
-
-extern void *malloc (), *realloc (), *calloc ();
-
-#ifndef inhibit_libc
-#include "string.h"
-#endif
diff --git a/gcc/config/mips/xm-mips.h b/gcc/config/mips/xm-mips.h
deleted file mode 100644
index 6c9df7c0f28..00000000000
--- a/gcc/config/mips/xm-mips.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Configuration for GNU C-compiler for MIPS Rx000 family
- Copyright (C) 1989, 1990, 1991, 1993 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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#if !defined(MIPSEL) && !defined(__MIPSEL__)
-#define HOST_WORDS_BIG_ENDIAN
-#endif
-
-/* Enable host-conditionals for MIPS machines. */
-#ifndef MIPS
-#define MIPS 1
-#endif
-
-/* A code distinguishing the floating point format of the host
- machine. There are three defined values: IEEE_FLOAT_FORMAT,
- VAX_FLOAT_FORMAT, and UNKNOWN_FLOAT_FORMAT. */
-
-#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-#ifndef __GNUC__
-/* The MIPS compiler gets it wrong, and treats enumerated bitfields
- as signed quantities, making it impossible to use an 8-bit enum
- for compiling GNU C++. */
-#define ONLY_INT_FIELDS 1
-#endif
-
-#ifndef MIPS_OVERRIDE_ALLOCA
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-
-extern char * alloca ();
-
-/* for the emacs version of alloca */
-#define STACK_DIRECTION -1
-#endif
-#endif /* not MIPS_OVERRIDE_ALLOCA */
-
-/* Say if we have vprintf. BSD Mips targets probably don't have vfprintf. */
-#if defined(__OSF1__) || defined(__OSF__) || defined(__osf__) || defined(bsd4_4)
-#define HAVE_VPRINTF
-#define HAVE_PUTENV
-
-#else
-#define NO_STAB_H /* mips doesn't typically have stab.h */
-#endif
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
deleted file mode 100644
index 10e7ae36030..00000000000
--- a/gcc/config/mn10300/mn10300.c
+++ /dev/null
@@ -1,936 +0,0 @@
-/* Subroutines for insn-output.c for Matsushita MN10300 series
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Jeff Law (law@cygnus.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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "recog.h"
-#include "expr.h"
-#include "tree.h"
-#include "obstack.h"
-
-/* Global registers known to hold the value zero.
-
- Normally we'd depend on CSE and combine to put zero into a
- register and re-use it.
-
- However, on the mn10x00 processors we implicitly use the constant
- zero in tst instructions, so we might be able to do better by
- loading the value into a register in the prologue, then re-useing
- that register throughout the function.
-
- We could perform similar optimizations for other constants, but with
- gcse due soon, it doesn't seem worth the effort.
-
- These variables hold a rtx for a register known to hold the value
- zero throughout the entire function, or NULL if no register of
- the appropriate class has such a value throughout the life of the
- function. */
-rtx zero_dreg;
-rtx zero_areg;
-
-void
-asm_file_start (file)
- FILE *file;
-{
- fprintf (file, "#\tGCC For the Matsushita MN10300\n");
- if (optimize)
- fprintf (file, "# -O%d\n", optimize);
- else
- fprintf (file, "\n\n");
- output_file_directive (file, main_input_filename);
-}
-
-
-/* Print operand X using operand code CODE to assembly language output file
- FILE. */
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- int code;
-{
- switch (code)
- {
- case 'b':
- case 'B':
- /* These are normal and reversed branches. */
- switch (code == 'b' ? GET_CODE (x) : reverse_condition (GET_CODE (x)))
- {
- case NE:
- fprintf (file, "ne");
- break;
- case EQ:
- fprintf (file, "eq");
- break;
- case GE:
- fprintf (file, "ge");
- break;
- case GT:
- fprintf (file, "gt");
- break;
- case LE:
- fprintf (file, "le");
- break;
- case LT:
- fprintf (file, "lt");
- break;
- case GEU:
- fprintf (file, "cc");
- break;
- case GTU:
- fprintf (file, "hi");
- break;
- case LEU:
- fprintf (file, "ls");
- break;
- case LTU:
- fprintf (file, "cs");
- break;
- default:
- abort ();
- }
- break;
- case 'C':
- /* This is used for the operand to a call instruction;
- if it's a REG, enclose it in parens, else output
- the operand normally. */
- if (GET_CODE (x) == REG)
- {
- fputc ('(', file);
- print_operand (file, x, 0);
- fputc (')', file);
- }
- else
- print_operand (file, x, 0);
- break;
-
- /* These are the least significant word in a 64bit value. */
- case 'L':
- switch (GET_CODE (x))
- {
- case MEM:
- fputc ('(', file);
- output_address (XEXP (x, 0));
- fputc (')', file);
- break;
-
- case REG:
- fprintf (file, "%s", reg_names[REGNO (x)]);
- break;
-
- case SUBREG:
- fprintf (file, "%s",
- reg_names[REGNO (SUBREG_REG (x)) + SUBREG_WORD (x)]);
- break;
-
- case CONST_DOUBLE:
- {
- long val[2];
- REAL_VALUE_TYPE rv;
-
- switch (GET_MODE (x))
- {
- case DFmode:
- REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
- REAL_VALUE_TO_TARGET_DOUBLE (rv, val);
- print_operand_address (file, GEN_INT (val[0]));
- break;;
- case SFmode:
- REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
- REAL_VALUE_TO_TARGET_SINGLE (rv, val[0]);
- print_operand_address (file, GEN_INT (val[0]));
- break;;
- case VOIDmode:
- case DImode:
- print_operand_address (file,
- GEN_INT (CONST_DOUBLE_LOW (x)));
- break;
- }
- break;
- }
-
- case CONST_INT:
- print_operand_address (file, x);
- break;
-
- default:
- abort ();
- }
- break;
-
- /* Similarly, but for the most significant word. */
- case 'H':
- switch (GET_CODE (x))
- {
- case MEM:
- fputc ('(', file);
- x = adj_offsettable_operand (x, 4);
- output_address (XEXP (x, 0));
- fputc (')', file);
- break;
-
- case REG:
- fprintf (file, "%s", reg_names[REGNO (x) + 1]);
- break;
-
- case SUBREG:
- fprintf (file, "%s",
- reg_names[REGNO (SUBREG_REG (x)) + SUBREG_WORD (x)] + 1);
- break;
-
- case CONST_DOUBLE:
- {
- long val[2];
- REAL_VALUE_TYPE rv;
-
- switch (GET_MODE (x))
- {
- case DFmode:
- REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
- REAL_VALUE_TO_TARGET_DOUBLE (rv, val);
- print_operand_address (file, GEN_INT (val[1]));
- break;;
- case SFmode:
- abort ();
- case VOIDmode:
- case DImode:
- print_operand_address (file,
- GEN_INT (CONST_DOUBLE_HIGH (x)));
- break;
- }
- break;
- }
-
- case CONST_INT:
- if (INTVAL (x) < 0)
- print_operand_address (file, GEN_INT (-1));
- else
- print_operand_address (file, GEN_INT (0));
- break;
- default:
- abort ();
- }
- break;
-
- case 'A':
- fputc ('(', file);
- if (GET_CODE (XEXP (x, 0)) == REG)
- output_address (gen_rtx (PLUS, SImode, XEXP (x, 0), GEN_INT (0)));
- else
- output_address (XEXP (x, 0));
- fputc (')', file);
- break;
-
- case 'N':
- output_address (GEN_INT ((~INTVAL (x)) & 0xff));
- break;
-
- default:
- switch (GET_CODE (x))
- {
- case MEM:
- fputc ('(', file);
- output_address (XEXP (x, 0));
- fputc (')', file);
- break;
-
- case PLUS:
- output_address (x);
- break;
-
- case REG:
- fprintf (file, "%s", reg_names[REGNO (x)]);
- break;
-
- case SUBREG:
- fprintf (file, "%s",
- reg_names[REGNO (SUBREG_REG (x)) + SUBREG_WORD (x)]);
- break;
-
- /* This will only be single precision.... */
- case CONST_DOUBLE:
- {
- unsigned long val;
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
- REAL_VALUE_TO_TARGET_SINGLE (rv, val);
- print_operand_address (file, GEN_INT (val));
- break;
- }
-
- case CONST_INT:
- case SYMBOL_REF:
- case CONST:
- case LABEL_REF:
- case CODE_LABEL:
- print_operand_address (file, x);
- break;
- default:
- abort ();
- }
- break;
- }
-}
-
-/* Output assembly language output for the address ADDR to FILE. */
-
-void
-print_operand_address (file, addr)
- FILE *file;
- rtx addr;
-{
- switch (GET_CODE (addr))
- {
- case REG:
- if (addr == stack_pointer_rtx)
- print_operand_address (file, gen_rtx (PLUS, SImode,
- stack_pointer_rtx,
- GEN_INT (0)));
- else
- print_operand (file, addr, 0);
- break;
- case PLUS:
- {
- rtx base, index;
- if (REG_P (XEXP (addr, 0))
- && REG_OK_FOR_BASE_P (XEXP (addr, 0)))
- base = XEXP (addr, 0), index = XEXP (addr, 1);
- else if (REG_P (XEXP (addr, 1))
- && REG_OK_FOR_BASE_P (XEXP (addr, 1)))
- base = XEXP (addr, 1), index = XEXP (addr, 0);
- else
- abort ();
- print_operand (file, index, 0);
- fputc (',', file);
- print_operand (file, base, 0);;
- break;
- }
- case SYMBOL_REF:
- output_addr_const (file, addr);
- break;
- default:
- output_addr_const (file, addr);
- break;
- }
-}
-
-int
-can_use_return_insn ()
-{
- /* SIZE includes the fixed stack space needed for function calls. */
- int size = get_frame_size () + (!leaf_function_p () ? 12 : 0);
-
- return (reload_completed
- && size == 0
- && !regs_ever_live[2]
- && !regs_ever_live[3]
- && !regs_ever_live[6]
- && !regs_ever_live[7]
- && !frame_pointer_needed);
-}
-
-/* Count the number of tst insns which compare a data or address
- register with zero. */
-static void
-count_tst_insns (dreg_countp, areg_countp)
- int *dreg_countp;
- int *areg_countp;
-{
- rtx insn;
-
- /* Assume no tst insns exist. */
- *dreg_countp = 0;
- *areg_countp = 0;
-
- /* If not optimizing, then quit now. */
- if (!optimize)
- return;
-
- /* Walk through all the insns. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- rtx pat;
-
- /* Ignore anything that is not a normal INSN. */
- if (GET_CODE (insn) != INSN)
- continue;
-
- /* Ignore anything that isn't a SET. */
- pat = PATTERN (insn);
- if (GET_CODE (pat) != SET)
- continue;
-
- /* Check for a tst insn. */
- if (SET_DEST (pat) == cc0_rtx
- && GET_CODE (SET_SRC (pat)) == REG)
- {
- if (REGNO_REG_CLASS (REGNO (SET_SRC (pat))) == DATA_REGS)
- (*dreg_countp)++;
-
- if (REGNO_REG_CLASS (REGNO (SET_SRC (pat))) == ADDRESS_REGS)
- (*areg_countp)++;
- }
-
- /* Setting an address register to zero can also be optimized,
- so count it just like a tst insn. */
- if (GET_CODE (SET_DEST (pat)) == REG
- && GET_CODE (SET_SRC (pat)) == CONST_INT
- && INTVAL (SET_SRC (pat)) == 0
- && REGNO_REG_CLASS (REGNO (SET_DEST (pat))) == ADDRESS_REGS)
- (*areg_countp)++;
- }
-}
-
-void
-expand_prologue ()
-{
- unsigned int size;
-
- /* We have to end the current sequence so leaf_function_p and
- count_tst_insns will work. We then start a new sequence to
- hold the prologue/epilogue. */
- end_sequence ();
-
- /* Determine if it is profitable to put the value zero into a register
- for the entire function. If so, set ZERO_DREG and ZERO_AREG. */
- if (regs_ever_live[2] || regs_ever_live[3]
- || regs_ever_live[6] || regs_ever_live[7]
- || frame_pointer_needed)
- {
- int dreg_count, areg_count;
-
- /* Get a count of the number of tst insns which use address and
- data registers. */
- count_tst_insns (&dreg_count, &areg_count);
-
- /* If there's more than one tst insn using a data register, then
- this optimization is a win. */
- if (dreg_count > 1
- && (!regs_ever_live[2] || !regs_ever_live[3]))
- {
- if (!regs_ever_live[2])
- {
- regs_ever_live[2] = 1;
- zero_dreg = gen_rtx (REG, SImode, 2);
- }
- else
- {
- regs_ever_live[3] = 1;
- zero_dreg = gen_rtx (REG, SImode, 3);
- }
- }
- else
- zero_dreg = NULL_RTX;
-
- /* If there's more than two tst insns using an address register,
- then this optimization is a win. */
- if (areg_count > 2
- && (!regs_ever_live[6] || !regs_ever_live[7]))
- {
- if (!regs_ever_live[6])
- {
- regs_ever_live[6] = 1;
- zero_areg = gen_rtx (REG, SImode, 6);
- }
- else
- {
- regs_ever_live[7] = 1;
- zero_areg = gen_rtx (REG, SImode, 7);
- }
- }
- else
- zero_areg = NULL_RTX;
- }
- else
- {
- zero_dreg = NULL_RTX;
- zero_areg = NULL_RTX;
- }
-
- /* SIZE includes the fixed stack space needed for function calls. */
- size = get_frame_size () + (!leaf_function_p () ? 12 : 0);
-
- /* Start a new sequence for the prologue/epilogue. */
- start_sequence ();
-
- /* If this is an old-style varargs function, then its arguments
- need to be flushed back to the stack. */
- if (current_function_varargs)
- {
- emit_move_insn (gen_rtx (MEM, SImode,
- gen_rtx (PLUS, Pmode, stack_pointer_rtx,
- GEN_INT (4))),
- gen_rtx (REG, SImode, 0));
- emit_move_insn (gen_rtx (MEM, SImode,
- gen_rtx (PLUS, Pmode, stack_pointer_rtx,
- GEN_INT (8))),
- gen_rtx (REG, SImode, 1));
- }
-
- /* And now store all the registers onto the stack with a
- single two byte instruction. */
- if (regs_ever_live[2] || regs_ever_live[3]
- || regs_ever_live[6] || regs_ever_live[7]
- || frame_pointer_needed)
- emit_insn (gen_store_movm ());
-
- /* Now put the frame pointer into the frame pointer register. */
- if (frame_pointer_needed)
- emit_move_insn (frame_pointer_rtx, stack_pointer_rtx);
-
- /* Allocate stack for this frame. */
- if (size)
- emit_insn (gen_addsi3 (stack_pointer_rtx,
- stack_pointer_rtx,
- GEN_INT (-size)));
-
- /* Load zeros into registers as needed. */
- if (zero_dreg)
- emit_move_insn (zero_dreg, const0_rtx);
-
- if (zero_areg)
- emit_move_insn (zero_areg, const0_rtx);
-}
-
-void
-expand_epilogue ()
-{
- unsigned int size;
-
- /* We have to end the current sequence so leaf_function_p will
- work. We then start a new sequence to hold the prologue/epilogue. */
- end_sequence ();
-
- /* SIZE includes the fixed stack space needed for function calls. */
- size = get_frame_size () + (!leaf_function_p () ? 12 : 0);
-
- /* Start a new sequence for the prologue/epilogue. */
- start_sequence ();
-
- /* Cut back the stack. */
- if (frame_pointer_needed)
- {
- emit_move_insn (stack_pointer_rtx, frame_pointer_rtx);
- size = 0;
- }
- else if ((regs_ever_live[2] || regs_ever_live[3]
- || regs_ever_live[6] || regs_ever_live[7])
- && size > 255)
- {
- emit_insn (gen_addsi3 (stack_pointer_rtx,
- stack_pointer_rtx,
- GEN_INT (size)));
- size = 0;
- }
-
- /* For simplicity, we just movm all the callee saved registers to
- the stack with one instruction.
-
- ?!? Only save registers which are actually used. Reduces
- stack requireents and is faster. */
- if (regs_ever_live[2] || regs_ever_live[3]
- || regs_ever_live[6] || regs_ever_live[7]
- || frame_pointer_needed)
- emit_jump_insn (gen_return_internal_regs (GEN_INT (size)));
- else
- {
- if (size)
- {
- emit_insn (gen_addsi3 (stack_pointer_rtx,
- stack_pointer_rtx,
- GEN_INT (size)));
- emit_jump_insn (gen_return_internal ());
- }
- else
- {
- emit_jump_insn (gen_return ());
- }
- }
-}
-
-/* Update the condition code from the insn. */
-
-void
-notice_update_cc (body, insn)
- rtx body;
- rtx insn;
-{
- switch (get_attr_cc (insn))
- {
- case CC_NONE:
- /* Insn does not affect CC at all. */
- break;
-
- case CC_NONE_0HIT:
- /* Insn does not change CC, but the 0'th operand has been changed. */
- if (cc_status.value1 != 0
- && reg_overlap_mentioned_p (recog_operand[0], cc_status.value1))
- cc_status.value1 = 0;
- break;
-
- case CC_SET_ZN_C0:
- /* Insn sets the Z,N flags of CC to recog_operand[0].
- V is always set to 0. C may or may not be set to 0 but that's ok
- because alter_cond will change tests to use EQ/NE. */
- CC_STATUS_INIT;
- cc_status.flags |= CC_NO_OVERFLOW | CC_OVERFLOW_UNUSABLE;
- cc_status.value1 = recog_operand[0];
- break;
-
- case CC_TST:
- /* The insn sets all the condition codes, except v is bogus. */
- CC_STATUS_INIT;
- cc_status.value1 = recog_operand[0];
- break;
-
- case CC_COMPARE:
- /* The insn is a compare instruction. */
- CC_STATUS_INIT;
- cc_status.value1 = SET_SRC (body);
- break;
-
- case CC_INVERT:
- /* The insn is a compare instruction. */
- CC_STATUS_INIT;
- cc_status.value1 = SET_SRC (body);
- cc_status.flags |= CC_INVERTED;
- break;
-
- case CC_CLOBBER:
- /* Insn doesn't leave CC in a usable state. */
- CC_STATUS_INIT;
- break;
-
- default:
- abort ();
- }
-}
-
-/* Return true if OP is a valid call operand. */
-
-int
-call_address_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == REG);
-}
-
-/* What (if any) secondary registers are needed to move IN with mode
- MODE into a register from in register class CLASS.
-
- We might be able to simplify this. */
-enum reg_class
-secondary_reload_class (class, mode, in)
- enum reg_class class;
- enum machine_mode mode;
- rtx in;
-{
- int regno;
-
- /* Memory loads less than a full word wide can't have an
- address or stack pointer destination. They must use
- a data register as an intermediate register. */
- if (GET_CODE (in) == MEM
- && (mode == QImode || mode == HImode)
- && (class == ADDRESS_REGS || class == SP_REGS))
- return DATA_REGS;
-
- /* We can't directly load sp + const_int into a data register;
- we must use an address register as an intermediate. */
- if (class != SP_REGS
- && class != ADDRESS_REGS
- && class != SP_OR_ADDRESS_REGS
- && (in == stack_pointer_rtx
- || (GET_CODE (in) == PLUS
- && (XEXP (in, 0) == stack_pointer_rtx
- || XEXP (in, 1) == stack_pointer_rtx))))
- return ADDRESS_REGS;
-
- /* Otherwise assume no secondary reloads are needed. */
- return NO_REGS;
-}
-
-int
-initial_offset (from, to)
- int from, to;
-{
- /* The difference between the argument pointer and the frame pointer
- is the size of the callee register save area. */
- if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
- {
- if (regs_ever_live[2] || regs_ever_live[3]
- || regs_ever_live[6] || regs_ever_live[7]
- || frame_pointer_needed)
- return 16;
- else
- return 0;
- }
-
- /* The difference between the argument pointer and the stack pointer is
- the sum of the size of this function's frame, the callee register save
- area, and the fixed stack space needed for function calls (if any). */
- if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- {
- if (regs_ever_live[2] || regs_ever_live[3]
- || regs_ever_live[6] || regs_ever_live[7]
- || frame_pointer_needed)
- return (get_frame_size () + 16 + (!leaf_function_p () ? 12 : 0));
- else
- return (get_frame_size () + (!leaf_function_p () ? 12 : 0));
- }
-
- /* The difference between the frame pointer and stack pointer is the sum
- of the size of this function's frame and the fixed stack space needed
- for function calls (if any). */
- if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- return get_frame_size () + (!leaf_function_p () ? 12 : 0);
-
- abort ();
-}
-
-/* Flush the argument registers to the stack for a stdarg function;
- return the new argument pointer. */
-rtx
-mn10300_builtin_saveregs (arglist)
- tree arglist;
-{
- rtx offset;
- tree fntype = TREE_TYPE (current_function_decl);
- int argadj = ((!(TYPE_ARG_TYPES (fntype) != 0
- && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
- != void_type_node)))
- ? UNITS_PER_WORD : 0);
-
- if (argadj)
- offset = plus_constant (current_function_arg_offset_rtx, argadj);
- else
- offset = current_function_arg_offset_rtx;
-
- emit_move_insn (gen_rtx (MEM, SImode, current_function_internal_arg_pointer),
- gen_rtx (REG, SImode, 0));
- emit_move_insn (gen_rtx (MEM, SImode,
- plus_constant
- (current_function_internal_arg_pointer, 4)),
- gen_rtx (REG, SImode, 1));
- return copy_to_reg (expand_binop (Pmode, add_optab,
- current_function_internal_arg_pointer,
- offset, 0, 0, OPTAB_LIB_WIDEN));
-}
-
-/* Return an RTX to represent where a value with mode MODE will be returned
- from a function. If the result is 0, the argument is pushed. */
-
-rtx
-function_arg (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- rtx result = 0;
- int size, align;
-
- /* We only support using 2 data registers as argument registers. */
- int nregs = 2;
-
- /* Figure out the size of the object to be passed. */
- if (mode == BLKmode)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
- /* Figure out the alignment of the object to be passed. */
- align = size;
-
- cum->nbytes = (cum->nbytes + 3) & ~3;
-
- /* Don't pass this arg via a register if all the argument registers
- are used up. */
- if (cum->nbytes > nregs * UNITS_PER_WORD)
- return 0;
-
- /* Don't pass this arg via a register if it would be split between
- registers and memory. */
- if (type == NULL_TREE
- && cum->nbytes + size > nregs * UNITS_PER_WORD)
- return 0;
-
- switch (cum->nbytes / UNITS_PER_WORD)
- {
- case 0:
- result = gen_rtx (REG, mode, 0);
- break;
- case 1:
- result = gen_rtx (REG, mode, 1);
- break;
- default:
- result = 0;
- }
-
- return result;
-}
-
-/* Return the number of registers to use for an argument passed partially
- in registers and partially in memory. */
-
-int
-function_arg_partial_nregs (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- int size, align;
-
- /* We only support using 2 data registers as argument registers. */
- int nregs = 2;
-
- /* Figure out the size of the object to be passed. */
- if (mode == BLKmode)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
- /* Figure out the alignment of the object to be passed. */
- align = size;
-
- cum->nbytes = (cum->nbytes + 3) & ~3;
-
- /* Don't pass this arg via a register if all the argument registers
- are used up. */
- if (cum->nbytes > nregs * UNITS_PER_WORD)
- return 0;
-
- if (cum->nbytes + size <= nregs * UNITS_PER_WORD)
- return 0;
-
- /* Don't pass this arg via a register if it would be split between
- registers and memory. */
- if (type == NULL_TREE
- && cum->nbytes + size > nregs * UNITS_PER_WORD)
- return 0;
-
- return (nregs * UNITS_PER_WORD - cum->nbytes) / UNITS_PER_WORD;
-}
-
-/* Output a tst insn. */
-char *
-output_tst (operand, insn)
- rtx operand, insn;
-{
- rtx temp;
- int past_call = 0;
-
- /* If we have a data register which is known to be zero throughout
- the function, then use it instead of doing a search. */
- if (zero_dreg && REGNO_REG_CLASS (REGNO (operand)) == DATA_REGS)
- {
- rtx xoperands[2];
- xoperands[0] = operand;
- xoperands[1] = zero_dreg;
-
- output_asm_insn ("cmp %1,%0", xoperands);
- return "";
- }
-
- /* Similarly for address registers. */
- if (zero_areg && REGNO_REG_CLASS (REGNO (operand)) == ADDRESS_REGS)
- {
- rtx xoperands[2];
- xoperands[0] = operand;
- xoperands[1] = zero_areg;
-
- output_asm_insn ("cmp %1,%0", xoperands);
- return "";
- }
-
- /* We can save a byte if we can find a register which has the value
- zero in it. */
- temp = PREV_INSN (insn);
- while (optimize && temp)
- {
- rtx set;
-
- /* We allow the search to go through call insns. We record
- the fact that we've past a CALL_INSN and reject matches which
- use call clobbered registers. */
- if (GET_CODE (temp) == CODE_LABEL
- || GET_CODE (temp) == JUMP_INSN
- || GET_CODE (temp) == BARRIER)
- break;
-
- if (GET_CODE (temp) == CALL_INSN)
- past_call = 1;
-
- if (GET_CODE (temp) == NOTE)
- {
- temp = PREV_INSN (temp);
- continue;
- }
-
- /* It must be an insn, see if it is a simple set. */
- set = single_set (temp);
- if (!set)
- {
- temp = PREV_INSN (temp);
- continue;
- }
-
- /* Are we setting a data register to zero (this does not win for
- address registers)?
-
- If it's a call clobbered register, have we past a call?
-
- Make sure the register we find isn't the same as ourself;
- the mn10300 can't encode that. */
- if (REG_P (SET_DEST (set))
- && SET_SRC (set) == CONST0_RTX (GET_MODE (SET_DEST (set)))
- && !reg_set_between_p (SET_DEST (set), temp, insn)
- && (REGNO_REG_CLASS (REGNO (SET_DEST (set)))
- == REGNO_REG_CLASS (REGNO (operand)))
- && REGNO (SET_DEST (set)) != REGNO (operand)
- && (!past_call
- || !call_used_regs[REGNO (SET_DEST (set))]))
- {
- rtx xoperands[2];
- xoperands[0] = operand;
- xoperands[1] = SET_DEST (set);
-
- output_asm_insn ("cmp %1,%0", xoperands);
- return "";
- }
- temp = PREV_INSN (temp);
- }
- return "cmp 0,%0";
-}
diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h
deleted file mode 100644
index c36c6c499f6..00000000000
--- a/gcc/config/mn10300/mn10300.h
+++ /dev/null
@@ -1,1019 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Matsushita MN10300 series
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Jeff Law (law@cygnus.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 "svr4.h"
-
-#undef ASM_SPEC
-#undef ASM_FINAL_SPEC
-#undef LIB_SPEC
-#undef ENDFILE_SPEC
-#undef LINK_SPEC
-#undef STARTFILE_SPEC
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-D__mn10300__ -D__MN10300__"
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Global registers known to hold the value zero. */
-extern struct rtx_def *zero_dreg;
-extern struct rtx_def *zero_areg;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- {{ "", TARGET_DEFAULT}}
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 0
-#endif
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fprintf (stderr, " (MN10300)");
-
-
-/* Target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is not true on the Matsushita MN1003. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* This is not true on the Matsushita MN10300. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is lowest
- numbered.
- This is not true on the Matsushita MN10300. */
-#define WORDS_BIG_ENDIAN 0
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* The stack goes in 32 bit lumps. */
-#define STACK_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function.
- 8 is the minimum boundary; it's unclear if bigger alignments
- would improve performance. */
-#define FUNCTION_BOUNDARY 8
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Define this if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 0
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
-
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-
-#define FIRST_PSEUDO_REGISTER 10
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator. */
-
-#define FIXED_REGISTERS \
- { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you
- like. */
-
-#define CALL_USED_REGISTERS \
- { 1, 1, 0, 0, 1, 1, 0, 0, 1, 1}
-
-#define REG_ALLOC_ORDER \
- { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
-
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode
- MODE. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (REGNO_REG_CLASS (REGNO) == DATA_REGS \
- ? ((REGNO) & 1) == 0 || GET_MODE_SIZE (MODE) <= 4 \
- : ((REGNO) & 1) == 0 || GET_MODE_SIZE (MODE) == 4)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (MODE1 == MODE2 || GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4)
-
-/* 4 data, and effectively 3 address registers is small as far as I'm
- concerned. */
-#define SMALL_REGISTER_CLASSES 1
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-enum reg_class {
- NO_REGS, DATA_REGS, ADDRESS_REGS, SP_REGS, DATA_OR_ADDRESS_REGS, SP_OR_ADDRESS_REGS, GENERAL_REGS, ALL_REGS, LIM_REG_CLASSES
-};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
-{ "NO_REGS", "DATA_REGS", "ADDRESS_REGS", \
- "SP_REGS", "DATA_OR_ADDRESS_REGS", "SP_OR_ADDRESS_REGS", \
- "GENERAL_REGS", "ALL_REGS", "LIM_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ 0, /* No regs */ \
- 0x00f, /* DATA_REGS */ \
- 0x1f0, /* ADDRESS_REGS */ \
- 0x200, /* SP_REGS */ \
- 0x1ff, /* DATA_OR_ADDRESS_REGS */\
- 0x1f0, /* SP_OR_ADDRESS_REGS */\
- 0x1ff, /* GENERAL_REGS */ \
- 0x3ff, /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) < 4 ? DATA_REGS : \
- (REGNO) < 9 ? ADDRESS_REGS : \
- (REGNO) == 9 ? SP_REGS: 0)
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS DATA_REGS
-#define BASE_REG_CLASS SP_OR_ADDRESS_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'd' ? DATA_REGS : \
- (C) == 'a' ? ADDRESS_REGS : \
- (C) == 'x' ? SP_REGS : NO_REGS)
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_BASE_P(regno) \
- (((regno) > 3 && regno < FIRST_PSEUDO_REGISTER) \
- || (reg_renumber[regno] > 3 && reg_renumber[regno] < FIRST_PSEUDO_REGISTER))
-
-#define REGNO_OK_FOR_INDEX_P(regno) \
- (((regno) >= 0 && regno < 4) \
- || (reg_renumber[regno] >= 0 && reg_renumber[regno] < 4))
-
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- (X == stack_pointer_rtx && CLASS != SP_REGS ? ADDRESS_REGS : CLASS)
-
-#define PREFERRED_OUTPUT_RELOAD_CLASS(X,CLASS) \
- (X == stack_pointer_rtx && CLASS != SP_REGS ? ADDRESS_REGS : CLASS)
-
-#define LIMIT_RELOAD_CLASS(MODE, CLASS) \
- ((MODE == QImode || MODE == HImode) ? DATA_REGS : CLASS)
-
-#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
- secondary_reload_class(CLASS,MODE,IN)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* The letters I, J, K, L, M, N, O, P in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C. */
-
-#define INT_8_BITS(VALUE) ((unsigned) (VALUE) + 0x80 < 0x100)
-#define INT_16_BITS(VALUE) ((unsigned) (VALUE) + 0x8000 < 0x10000)
-
-#define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
-#define CONST_OK_FOR_J(VALUE) ((VALUE) == 1)
-#define CONST_OK_FOR_K(VALUE) ((VALUE) == 2)
-#define CONST_OK_FOR_L(VALUE) ((VALUE) == 4)
-#define CONST_OK_FOR_M(VALUE) ((VALUE) == 3)
-#define CONST_OK_FOR_N(VALUE) ((VALUE) == 255 || (VALUE) == 65535)
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
- (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
- (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
- (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
- (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
- (C) == 'N' ? CONST_OK_FOR_N (VALUE) : 0)
-
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself.
-
- `G' is a floating-point zero. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
- && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) : 0)
-
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-
-#define STARTING_FRAME_OFFSET 0
-
-/* Offset of first parameter from the argument pointer register value. */
-/* Is equal to the size of the saved fp + pc, even if an fp isn't
- saved since the value is used before we know. */
-
-#define FIRST_PARM_OFFSET(FNDECL) 4
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 9
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 7
-
-/* Base register for access to arguments of the function. This
- is a fake register and will be eliminated into either the frame
- pointer or stack pointer. */
-#define ARG_POINTER_REGNUM 8
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 5
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c.
-
- We allow frame pointers to be eliminated when not having one will
- not interfere with debugging.
-
- * If this is a leaf function, then we can keep the stack pointer
- constant throughout the function, and therefore gdb can easily
- find the base of the current frame.
-
- * If this function never allocates stack space for outgoing
- args (ie calls functions with either no args, or args only
- in registers), then the stack pointer will be constant and
- gdb can easily find the base of the current frame.
-
- We'd really like to define ACCUMULATE_OUTGOING_ARGS and eliminate
- all frame pointer, but currently we can't.
-
- We probably also want a -m option to eliminate frame pointer, even
- if the resulting executable can not be debugged. */
-
-#define ELIMINABLE_REGS \
-{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
-
-#define CAN_ELIMINATE(FROM, TO) 1
-
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
- OFFSET = initial_offset (FROM, TO)
-
-#define FRAME_POINTER_REQUIRED \
- !(leaf_function_p () || current_function_outgoing_args_size == 0)
-#define CAN_DEBUG_WITHOUT_FP
-
-/* A guess for the MN10300. */
-#define PROMOTE_PROTOTYPES 1
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* We use d0/d1 for passing parameters, so allocate 8 bytes of space
- for a register flushback area. */
-#define REG_PARM_STACK_SPACE(DECL) 8
-
-/* So we can allocate space for return pointers once for the function
- instead of around every call. */
-#define STACK_POINTER_OFFSET 4
-
-/* 1 if N is a possible register number for function argument passing.
- On the MN10300, no registers are used in this way. */
-
-#define FUNCTION_ARG_REGNO_P(N) ((N) <= 1)
-
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the MN10300, this is a single integer, which is a number of bytes
- of arguments scanned so far. */
-
-#define CUMULATIVE_ARGS struct cum_arg
-struct cum_arg {int nbytes; };
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the MN10300, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM).nbytes = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM).nbytes += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the MN10300 all args are pushed. */
-
-extern struct rtx_def *function_arg ();
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- function_arg (&CUM, MODE, TYPE, NAMED)
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
- function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
-
-
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
- ((TYPE) && int_size_in_bytes (TYPE) > 8)
-
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
- ((TYPE) && int_size_in_bytes (TYPE) > 8)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
-
-/* 1 if N is a possible register number for a function value. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* Return values > 8 bytes in length in memory. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-#define RETURN_IN_MEMORY(TYPE) \
- (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode)
-
-/* Register in which address to store a structure value
- is passed to a function. On the MN10300 it's passed as
- the first parameter. */
-
-#define STRUCT_VALUE 0
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) ;
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
- do { \
- fprintf (FILE, "\tadd -4,sp\n"); \
- fprintf (FILE, "\t.long 0x0004fffa\n"); \
- fprintf (FILE, "\tmov (0,sp),a0\n"); \
- fprintf (FILE, "\tadd 4,sp\n"); \
- fprintf (FILE, "\tmov (13,a0),a1\n"); \
- fprintf (FILE, "\tmov (17,a0),a0\n"); \
- fprintf (FILE, "\tjmp (a0)\n"); \
- fprintf (FILE, "\t.long 0\n"); \
- fprintf (FILE, "\t.long 0\n"); \
- } while (0)
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 0x1b
-
-#define TRAMPOLINE_ALIGNMENT 32
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 0x14)), \
- (CXT)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 0x18)), \
- (FNADDR)); \
-}
-/* A C expression whose value is RTL representing the value of the return
- address for the frame COUNT steps up from the current frame.
-
- On the mn10300, the return address is not at a constant location
- due to the frame layout. Luckily, it is at a constant offset from
- the argument pointer, so we define RETURN_ADDR_RTX to return a
- MEM using arg_pointer_rtx. Reload will replace arg_pointer_rtx
- with a reference to the stack/frame pointer + an appropriate offset. */
-
-#define RETURN_ADDR_RTX(COUNT, FRAME) \
- ((COUNT == 0) \
- ? gen_rtx (MEM, Pmode, arg_pointer_rtx) \
- : (rtx) 0)
-
-/* Emit code for a call to builtin_saveregs. We must emit USE insns which
- reference the 2 integer arg registers.
- Ordinarily they are not call used registers, but they are for
- _builtin_saveregs, so we must make this explicit. */
-
-extern struct rtx_def *mn10300_builtin_saveregs ();
-#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) mn10300_builtin_saveregs (ARGLIST)
-
-/* Addressing modes, and classification of registers for them. */
-
-
-/* 1 if X is an rtx for a constant that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
-
-/* Extra constraints. */
-
-#define OK_FOR_R(OP) \
- (GET_CODE (OP) == MEM \
- && GET_MODE (OP) == QImode \
- && (CONSTANT_ADDRESS_P (XEXP (OP, 0)) \
- || (GET_CODE (XEXP (OP, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (OP, 0)) \
- && XEXP (OP, 0) != stack_pointer_rtx) \
- || (GET_CODE (XEXP (OP, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (OP, 0), 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (XEXP (OP, 0), 0)) \
- && XEXP (XEXP (OP, 0), 0) != stack_pointer_rtx \
- && GET_CODE (XEXP (XEXP (OP, 0), 1)) == CONST_INT \
- && INT_8_BITS (INTVAL (XEXP (XEXP (OP, 0), 1))))))
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'R' ? OK_FOR_R (OP) : (C) == 'S' ? GET_CODE (OP) == SYMBOL_REF : 0)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) \
- ((REGNO (X) >= 0 && REGNO(X) <= 3) || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- ((REGNO (X) >= 4 && REGNO(X) <= 9) || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-#else
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-#endif
-
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
- except for CONSTANT_ADDRESS_P which is actually
- machine-independent. */
-
-/* Accept either REG or SUBREG where a register is valid. */
-
-#define RTX_OK_FOR_BASE_P(X) \
- ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == SUBREG && REG_P (SUBREG_REG (X)) \
- && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ \
- if (CONSTANT_ADDRESS_P (X)) \
- goto ADDR; \
- if (RTX_OK_FOR_BASE_P (X)) \
- goto ADDR; \
- if (GET_CODE (X) == PLUS) \
- { \
- rtx base = 0, index = 0; \
- if (REG_P (XEXP (X, 0)) \
- && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
- base = XEXP (X, 0), index = XEXP (X, 1); \
- if (REG_P (XEXP (X, 1)) \
- && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
- base = XEXP (X, 1), index = XEXP (X, 0); \
- if (base != 0 && index != 0) \
- { \
- if (CONSTANT_ADDRESS_P (index)) \
- goto ADDR; \
- if (REG_P (index) \
- && REG_OK_FOR_INDEX_P (index) \
- && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (word_mode)) \
- goto ADDR; \
- } \
- } \
-}
-
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). No extra ones are needed for the vax. */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define CC_OVERFLOW_UNUSABLE 0x200
-#define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- /* Zeros are extremely cheap. */ \
- if (INTVAL (RTX) == 0 && OUTER_CODE == SET) \
- return 0; \
- /* If it fits in 8 bits, then it's still relatively cheap. */ \
- if (INT_8_BITS (INTVAL (RTX))) \
- return 1; \
- /* This is the "base" cost, includes constants where either the \
- upper or lower 16bits are all zeros. */ \
- if (INT_16_BITS (INTVAL (RTX)) \
- || (INTVAL (RTX) & 0xffff) == 0 \
- || (INTVAL (RTX) & 0xffff0000) == 0) \
- return 2; \
- return 4; \
- /* These are more costly than a CONST_INT, but we can relax them, \
- so they're less costly than a CONST_DOUBLE. */ \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 6; \
- /* We don't optimize CONST_DOUBLEs well nor do we relax them well, \
- so their cost is very high. */ \
- case CONST_DOUBLE: \
- return 8;
-
-
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) (CLASS1 != CLASS2 ? 4 : 0)
-
-/* A crude cut at RTX_COSTS for the MN10300. */
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. */
-#define RTX_COSTS(RTX,CODE,OUTER_CODE) \
- case MOD: \
- case DIV: \
- return 8; \
- case MULT: \
- return 8;
-
-/* Nonzero if access to memory by bytes or half words is no faster
- than accessing full words. */
-#define SLOW_BYTE_ACCESS 1
-
-/* Dispatch tables on the mn10300 are extremely expensive in terms of code
- and readonly data size. So we crank up the case threshold value to
- encourage a series of if/else comparisons to implement many small switch
- statements. In theory, this value could be increased much more if we
- were solely optimizing for space, but we keep it "reasonable" to avoid
- serious code efficiency lossage. */
-#define CASE_VALUES_THRESHOLD 6
-
-#define NO_FUNCTION_CSE
-
-/* According expr.c, a value of around 6 should minimize code size, and
- for the MN10300 series, that's our primary concern. */
-#define MOVE_RATIO 6
-
-#define TEXT_SECTION_ASM_OP "\t.section .text"
-#define DATA_SECTION_ASM_OP "\t.section .data"
-#define BSS_SECTION_ASM_OP "\t.section .bss"
-
-/* Output at beginning/end of assembler file. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) asm_file_start(FILE)
-
-#define ASM_COMMENT_START "#"
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "#APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* This is how to output an assembler line defining a `double' constant.
- It is .dfloat or .gfloat, depending. */
-
-#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
-do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.double %s\n", dstr); \
- } while (0)
-
-
-/* This is how to output an assembler line defining a `float' constant. */
-#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
-do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.float %s\n", dstr); \
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE, VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE, VALUE) \
-( fprintf (FILE, "\t.hword "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE, VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-#define ASM_OUTPUT_BYTE(FILE, VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* This says how to output the assembler to define a global
- uninitialized but not common symbol.
- Try to use asm_output_bss to implement this macro. */
-
-#define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
- asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE, NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE, NAME) \
- do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* This is how to output a reference to a user-level label named NAME.
- `assemble_name' uses this. */
-
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE, NAME) \
- do { \
- char* real_name; \
- STRIP_NAME_ENCODING (real_name, (NAME)); \
- fprintf (FILE, "_%s", real_name); \
- } while (0)
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
-
-/* This is how we tell the assembler that two symbols have the same value. */
-
-#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
- do { assemble_name(FILE, NAME1); \
- fputs(" = ", FILE); \
- assemble_name(FILE, NAME2); \
- fputc('\n', FILE); } while (0)
-
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3", "ap", "sp" }
-
-/* Print an instruction operand X on file FILE.
- look in mn10300.c for details */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE,X,CODE)
-
-/* Print a memory operand whose address is X, on file FILE.
- This uses a function in output-vax.c. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
-#define ASM_OUTPUT_REG_POP(FILE,REGNO)
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- asm_fprintf (FILE, "\t%s .L%d\n", ".long", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t%s .L%d-.L%d\n", ".long", VALUE, REL)
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", (LOG))
-
-/* We don't have to worry about dbx compatability for the mn10300. */
-#define DEFAULT_GDB_EXTENSIONS 1
-
-/* Use stabs debugging info by default. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#define DBX_REGISTER_NUMBER(REGNO) REGNO
-
-/* Define to use software floating point emulator for REAL_ARITHMETIC and
- decimal <-> binary conversion. */
-#define REAL_ARITHMETIC
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE Pmode
-
-/* Define this if the case instruction drops through after the table
- when the index is out of range. Don't define it if the case insn
- jumps to the default label instead. */
-#define CASE_DROPS_THROUGH
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-#define STORE_FLAG_VALUE 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* The assembler op to get a word. */
-
-#define FILE_ASM_OP "\t.file\n"
-
-extern void asm_file_start ();
-extern int const_costs ();
-extern void print_operand ();
-extern void print_operand_address ();
-extern void expand_prologue ();
-extern void expand_epilogue ();
-extern void notice_update_cc ();
-extern int call_address_operand ();
-extern enum reg_class secondary_reload_class ();
-extern int initial_offset ();
-extern char *output_tst ();
diff --git a/gcc/config/mn10300/mn10300.md b/gcc/config/mn10300/mn10300.md
deleted file mode 100644
index 13628ecf1f3..00000000000
--- a/gcc/config/mn10300/mn10300.md
+++ /dev/null
@@ -1,1426 +0,0 @@
-; GCC machine description for Matsushita MN10300
-;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-
-;; Contributed by Jeff Law (law@cygnus.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 original PO technology requires these to be ordered by speed,
-;; so that assigner will pick the fastest.
-
-;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; Condition code settings.
-;; none - insn does not affect cc
-;; none_0hit - insn does not affect cc but it does modify operand 0
-;; This attribute is used to keep track of when operand 0 changes.
-;; See the description of NOTICE_UPDATE_CC for more info.
-;; set - insn sets flags z,n. v is unusable c is set to 0.
-;; (c may not really be set to 0 but that's ok, we don't need it anyway).
-;; set_zn_c0 - insn sets z,n to usable values. v is unknown. c may or may not
-;; be known (if it isn't that's ok, we don't need it anyway).
-;; compare - compare instruction
-;; invert -- like compare, but flags are inverted.
-;; clobber - value of cc is unknown
-(define_attr "cc" "none,none_0hit,tst,set_zn_c0,compare,clobber,invert"
- (const_string "clobber"))
-
-;; ----------------------------------------------------------------------
-;; MOVE INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-;; movqi
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register */
- if (!register_operand (operand0, QImode)
- && !register_operand (operand1, QImode))
- operands[1] = copy_to_mode_reg (QImode, operand1);
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=d,a,d,a,d,a,d,a,d,m")
- (match_operand:QI 1 "general_operand" "0,0,I,I,a,d,di,ia,m,d"))]
- "register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- return \"nop\";
- case 2:
- return \"clr %0\";
- case 3:
- if (zero_areg)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg;
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %1,%0\", xoperands);
- else
- output_asm_insn (\"mov %1,%0\", xoperands);
- return \"\";
- }
-
- /* FALLTHROUGH */
- case 4:
- case 5:
- case 6:
- case 7:
- return \"mov %1,%0\";
- case 8:
- case 9:
- return \"movbu %1,%0\";
- }
-}"
- [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
-
-;; movhi
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register */
- if (!register_operand (operand1, HImode)
- && !register_operand (operand0, HImode))
- operands[1] = copy_to_mode_reg (HImode, operand1);
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=d,a,d,a,d,a,d,a,d,m")
- (match_operand:HI 1 "general_operand" "0,0,I,I,a,d,di,ia,m,d"))]
- "register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- return \"nop\";
- case 2:
- return \"clr %0\";
- case 3:
- if (zero_areg)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg;
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %1,%0\", xoperands);
- else
- output_asm_insn (\"mov %1,%0\", xoperands);
- return \"\";
- }
-
- /* FALLTHROUGH */
- case 4:
- case 5:
- case 6:
- case 7:
- return \"mov %1,%0\";
- case 8:
- case 9:
- return \"movhu %1,%0\";
- }
-}"
- [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
-
-;; movsi and helpers
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register */
- if (!register_operand (operand1, SImode)
- && !register_operand (operand0, SImode))
- operands[1] = copy_to_mode_reg (SImode, operand1);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand"
- "=d,a,d,a,dm,dm,am,am,d,d,a,a,aR,x")
- (match_operand:SI 1 "general_operand"
- "0,0,I,I,d,a,d,a,dim,aim,dim,aim,x,aR"))]
- "register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- return \"nop\";
- case 2:
- return \"clr %0\";
- case 3:
- if (zero_areg)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg;
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %1,%0\", xoperands);
- else
- output_asm_insn (\"mov %1,%0\", xoperands);
- return \"\";
- }
-
- /* FALLTHROUGH */
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- return \"mov %1,%0\";
- }
-}"
- [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register */
- if (!register_operand (operand1, SFmode)
- && !register_operand (operand0, SFmode))
- operands[1] = copy_to_mode_reg (SFmode, operand1);
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=d,a,d,a,dam,da")
- (match_operand:SF 1 "general_operand" "0,0,G,G,da,daim"))]
- "register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- case 1:
- return \"nop\";
- case 2:
- return \"clr %0\";
- case 3:
- if (zero_areg)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg;
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %1,%0\", xoperands);
- else
- output_asm_insn (\"mov %1,%0\", xoperands);
- return \"\";
- }
-
- /* FALLTHROUGH */
- case 4:
- case 5:
- return \"mov %1,%0\";
- }
-}"
- [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit")])
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register */
- if (!register_operand (operand1, DImode)
- && !register_operand (operand0, DImode))
- operands[1] = copy_to_mode_reg (DImode, operand1);
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "general_operand"
- "=d,a,d,a,dm,dm,am,am,d,d,a,a")
- (match_operand:DI 1 "general_operand"
- "0,0,I,I,d,a,d,a,dim,aim,dim,aim"))]
- "register_operand (operands[0], DImode)
- || register_operand (operands[1], DImode)"
- "*
-{
- long val[2];
- REAL_VALUE_TYPE rv;
-
- switch (which_alternative)
- {
- case 0:
- case 1:
- return \"nop\";
-
- case 2:
- return \"clr %L0\;clr %H0\";
-
- case 3:
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg ? zero_areg : operands[1];
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %L1,%L0\;mov %L0,%H0\", xoperands);
- else
- output_asm_insn (\"mov %1,%L0\;mov %L0,%H0\", xoperands);
- return \"\";
- }
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- val[0] = INTVAL (operands[1]);
- val[1] = val[0] < 0 ? -1 : 0;
- }
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- if (GET_MODE (operands[1]) == DFmode)
- {
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
- REAL_VALUE_TO_TARGET_DOUBLE (rv, val);
- }
- else if (GET_MODE (operands[1]) == VOIDmode
- || GET_MODE (operands[1]) == DImode)
- {
- val[0] = CONST_DOUBLE_LOW (operands[1]);
- val[1] = CONST_DOUBLE_HIGH (operands[1]);
- }
- }
-
- if (GET_CODE (operands[1]) == MEM
- && reg_overlap_mentioned_p (operands[0], XEXP (operands[1], 0)))
- {
- rtx temp = operands[0];
-
- while (GET_CODE (temp) == SUBREG)
- temp = SUBREG_REG (temp);
-
- if (GET_CODE (temp) != REG)
- abort ();
-
- if (reg_overlap_mentioned_p (gen_rtx (REG, SImode, REGNO (temp)),
- XEXP (operands[1], 0)))
- return \"mov %H1,%H0\;mov %L1,%L0\";
- else
- return \"mov %L1,%L0\;mov %H1,%H0\";
-
- }
- else if (GET_CODE (operands[1]) == MEM
- && CONSTANT_ADDRESS_P (XEXP (operands[1], 0))
- && REGNO_REG_CLASS (REGNO (operands[0])) == ADDRESS_REGS)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = XEXP (operands[1], 0);
-
- output_asm_insn (\"mov %1,%L0\;mov (4,%L0),%H0\;mov (%L0),%L0\",
- xoperands);
- return \"\";
- }
- else
- {
- if ((GET_CODE (operands[1]) == CONST_INT
- || GET_CODE (operands[1]) == CONST_DOUBLE)
- && val[0] == 0)
- {
- if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)
- output_asm_insn (\"clr %L0\", operands);
- else if (zero_areg)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg;
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %L0,%L0\", xoperands);
- else
- output_asm_insn (\"mov %1,%L0\", xoperands);
- }
- else
- output_asm_insn (\"mov %L1,%L0\", operands);
- }
- else
- output_asm_insn (\"mov %L1,%L0\", operands);
-
- if ((GET_CODE (operands[1]) == CONST_INT
- || GET_CODE (operands[1]) == CONST_DOUBLE)
- && val[1] == 0)
- {
- if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)
- output_asm_insn (\"clr %H0\", operands);
- else if (zero_areg)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg;
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %H0,%H0\", xoperands);
- else
- output_asm_insn (\"mov %1,%H0\", xoperands);
- }
- else
- output_asm_insn (\"mov %H1,%H0\", operands);
- }
- else if ((GET_CODE (operands[1]) == CONST_INT
- || GET_CODE (operands[1]) == CONST_DOUBLE)
- && val[0] == val[1])
- output_asm_insn (\"mov %L0,%H0\", operands);
- else
- output_asm_insn (\"mov %H1,%H0\", operands);
- return \"\";
- }
- }
-}"
- [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
-{
- /* One of the ops has to be in a register */
- if (!register_operand (operand1, DFmode)
- && !register_operand (operand0, DFmode))
- operands[1] = copy_to_mode_reg (DFmode, operand1);
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand"
- "=d,a,d,a,dm,dm,am,am,d,d,a,a")
- (match_operand:DF 1 "general_operand"
- "0,0,G,G,d,a,d,a,dim,aim,dim,aim"))]
- "register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode)"
- "*
-{
- long val[2];
- REAL_VALUE_TYPE rv;
-
- switch (which_alternative)
- {
- case 0:
- case 1:
- return \"nop\";
-
- case 2:
- return \"clr %L0\;clr %H0\";
-
- case 3:
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg ? zero_areg : operands[1];
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %L1,%L0\;mov %L0,%H0\", xoperands);
- else
- output_asm_insn (\"mov %1,%L0\;mov %L0,%H0\", xoperands);
- return \"\";
- }
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- val[0] = INTVAL (operands[1]);
- val[1] = val[0] < 0 ? -1 : 0;
- }
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- if (GET_MODE (operands[1]) == DFmode)
- {
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
- REAL_VALUE_TO_TARGET_DOUBLE (rv, val);
- }
- else if (GET_MODE (operands[1]) == VOIDmode
- || GET_MODE (operands[1]) == DImode)
- {
- val[0] = CONST_DOUBLE_LOW (operands[1]);
- val[1] = CONST_DOUBLE_HIGH (operands[1]);
- }
- }
-
- if (GET_CODE (operands[1]) == MEM
- && reg_overlap_mentioned_p (operands[0], XEXP (operands[1], 0)))
- {
- rtx temp = operands[0];
-
- while (GET_CODE (temp) == SUBREG)
- temp = SUBREG_REG (temp);
-
- if (GET_CODE (temp) != REG)
- abort ();
-
- if (reg_overlap_mentioned_p (gen_rtx (REG, SImode, REGNO (temp)),
- XEXP (operands[1], 0)))
- return \"mov %H1,%H0\;mov %L1,%L0\";
- else
- return \"mov %L1,%L0\;mov %H1,%H0\";
-
- }
- else if (GET_CODE (operands[1]) == MEM
- && CONSTANT_ADDRESS_P (XEXP (operands[1], 0))
- && REGNO_REG_CLASS (REGNO (operands[0])) == ADDRESS_REGS)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = XEXP (operands[1], 0);
-
- output_asm_insn (\"mov %1,%L0\;mov (4,%L0),%H0\;mov (%L0),%L0\",
- xoperands);
- return \"\";
- }
- else
- {
- if ((GET_CODE (operands[1]) == CONST_INT
- || GET_CODE (operands[1]) == CONST_DOUBLE)
- && val[0] == 0)
- {
- if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)
- output_asm_insn (\"clr %L0\", operands);
- else if (zero_areg)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg;
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %L0,%L0\", xoperands);
- else
- output_asm_insn (\"mov %1,%L0\", xoperands);
- }
- else
- output_asm_insn (\"mov %L1,%L0\", operands);
- }
- else
- output_asm_insn (\"mov %L1,%L0\", operands);
-
- if ((GET_CODE (operands[1]) == CONST_INT
- || GET_CODE (operands[1]) == CONST_DOUBLE)
- && val[1] == 0)
- {
- if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)
- output_asm_insn (\"clr %H0\", operands);
- else if (zero_areg)
- {
- rtx xoperands[2];
-
- xoperands[0] = operands[0];
- xoperands[1] = zero_areg;
- if (rtx_equal_p (xoperands[0], xoperands[1]))
- output_asm_insn (\"sub %H0,%H0\", xoperands);
- else
- output_asm_insn (\"mov %1,%H0\", xoperands);
- }
- else
- output_asm_insn (\"mov %H1,%H0\", operands);
- }
- else if ((GET_CODE (operands[1]) == CONST_INT
- || GET_CODE (operands[1]) == CONST_DOUBLE)
- && val[0] == val[1])
- output_asm_insn (\"mov %L0,%H0\", operands);
- else
- output_asm_insn (\"mov %H1,%H0\", operands);
- return \"\";
- }
- }
-}"
- [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])
-
-
-
-;; ----------------------------------------------------------------------
-;; TEST INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-;; Go ahead and define tstsi so we can eliminate redundant tst insns
-;; when we start trying to optimize this port.
-(define_insn "tstsi"
- [(set (cc0) (match_operand:SI 0 "register_operand" "da"))]
- ""
- "* return output_tst (operands[0], insn);"
- [(set_attr "cc" "tst")])
-
-(define_insn ""
- [(set (cc0) (zero_extend:SI (match_operand:QI 0 "memory_operand" "d")))]
- ""
- "* return output_tst (operands[0], insn);"
- [(set_attr "cc" "tst")])
-
-(define_insn ""
- [(set (cc0) (zero_extend:SI (match_operand:HI 0 "memory_operand" "d")))]
- ""
- "* return output_tst (operands[0], insn);"
- [(set_attr "cc" "tst")])
-
-
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "register_operand" "!*d*a,da")
- (match_operand:SI 1 "nonmemory_operand" "!*0,dai")))]
- ""
- "@
- add 0,%0
- cmp %1,%0"
- [(set_attr "cc" "invert,compare")])
-
-;; ----------------------------------------------------------------------
-;; ADD INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_expand "addsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- /* We can't add a variable amount directly to the stack pointer;
- so do so via a temporary register. */
- if (operands[0] == stack_pointer_rtx
- && GET_CODE (operands[1]) != CONST_INT
- && GET_CODE (operands[2]) != CONST_INT)
- {
- rtx temp = gen_reg_rtx (SImode);
- emit_move_insn (temp, gen_rtx (PLUS, SImode, operands[1], operands[2]));
- emit_move_insn (operands[0], temp);
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=d,a,a,da,x,!&da")
- (plus:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,da")
- (match_operand:SI 2 "nonmemory_operand" "J,J,L,dai,i,da")))]
- ""
- "@
- inc %0
- inc %0
- inc4 %0
- add %2,%0
- add %2,%0
- mov %2,%0\;add %1,%0"
- [(set_attr "cc" "set_zn_c0,none_0hit,none_0hit,set_zn_c0,none_0hit,none_0hit")])
-
-(define_expand "adddi3"
- [(set (reg:DI 0) (match_operand:DI 1 "register_operand" ""))
- (set (reg:DI 2) (match_operand:DI 2 "nonmemory_operand" ""))
- (set (reg:DI 0) (plus:DI (reg:DI 0) (reg:DI 2)))
- (set (match_operand:DI 0 "register_operand" "") (reg:DI 0))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- rtx reg0 = gen_rtx (REG, DImode, 0);
-
- emit_move_insn (reg0, operands[1]);
- emit_insn (gen_adddi3_const (operands[2]));
- emit_move_insn (operands[0], reg0);
- DONE;
- }
-}")
-
-;; The general adddi3 pattern.
-(define_insn ""
- [(set (reg:DI 0) (plus:DI (reg:DI 0) (reg:DI 2)))]
- ""
- "add d2,d0\;addc d3,d1"
- [(set_attr "cc" "clobber")])
-
-;; adddi3 with on operand being a constant.
-(define_insn "adddi3_const"
- [(set (reg:DI 0)
- (plus:DI (reg:DI 0) (match_operand:DI 0 "const_int_operand" "i")))
- (clobber (reg:DI 2))]
- ""
- "*
-{
- long value = INTVAL (operands[0]);
-
- if (value < 0)
- return \"mov -1,d2\;add %0,d0\;addc d2,d1\";
- else
- return \"clr d2\;add %0,d0\;addc d2,d1\";
-}"
- [(set_attr "cc" "clobber")])
-;; ----------------------------------------------------------------------
-;; SUBTRACT INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=da")
- (minus:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "nonmemory_operand" "dai")))]
- ""
- "sub %2,%0"
- [(set_attr "cc" "set_zn_c0")])
-
-(define_expand "negsi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (neg:SI (match_operand:SI 1 "register_operand" "")))]
- ""
- "
-{
- rtx target = gen_reg_rtx (SImode);
-
- emit_move_insn (target, GEN_INT (0));
- emit_insn (gen_subsi3 (target, target, operands[1]));
- emit_move_insn (operands[0], target);
- DONE;
-}")
-
-(define_expand "subdi3"
- [(set (reg:DI 0) (match_operand:DI 1 "register_operand" ""))
- (set (reg:DI 2) (match_operand:DI 2 "nonmemory_operand" ""))
- (set (reg:DI 0) (minus:DI (reg:DI 0) (reg:DI 2)))
- (set (match_operand:DI 0 "register_operand" "") (reg:DI 0))]
- ""
- "")
-
-(define_insn ""
- [(set (reg:DI 0) (minus:DI (reg:DI 0) (reg:DI 2)))]
- ""
- "sub d2,d0\;subc d3,d1"
- [(set_attr "cc" "clobber")])
-
-;; ----------------------------------------------------------------------
-;; MULTIPLY INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (mult:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "register_operand" "d")))]
- ""
- "mul %2,%0"
- [(set_attr "cc" "set_zn_c0")])
-
-(define_expand "udivmodsi4"
- [(parallel [(set (match_operand:SI 0 "register_operand" "")
- (udiv:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))
- (set (match_operand:SI 3 "register_operand" "")
- (umod:SI (match_dup 1) (match_dup 2)))])]
- ""
- "
-{
- rtx reg = gen_reg_rtx (SImode);
- emit_move_insn (reg, GEN_INT (0));
- emit_insn (gen_clear_mdr (reg));
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (udiv:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "d")))
- (set (match_operand:SI 3 "general_operand" "=d")
- (umod:SI (match_dup 1) (match_dup 2)))]
- ""
- "*
-{
- if (find_reg_note (insn, REG_UNUSED, operands[3]))
- return \"divu %2,%0\";
- else
- return \"divu %2,%0\;mov mdr,%3\";
-}"
- [(set_attr "cc" "set_zn_c0")])
-
-(define_expand "divmodsi4"
- [(parallel [(set (match_operand:SI 0 "register_operand" "")
- (div:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))
- (set (match_operand:SI 3 "register_operand" "")
- (mod:SI (match_dup 1) (match_dup 2)))])]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=d")
- (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "d")))
- (set (match_operand:SI 3 "general_operand" "=d")
- (mod:SI (match_dup 1) (match_dup 2)))]
- ""
- "*
-{
- if (find_reg_note (insn, REG_UNUSED, operands[3]))
- return \"ext %0\;div %2,%0\";
- else
- return \"ext %0\;div %2,%0\;mov mdr,%3\";
-}"
- [(set_attr "cc" "set_zn_c0")])
-
-(define_insn "clear_mdr"
- [(unspec_volatile [(const_int 2)] 0)
- (use (match_operand:SI 0 "register_operand" "d"))]
- ""
- "mov %0,mdr"
- [(set_attr "cc" "none")])
-
-;; ----------------------------------------------------------------------
-;; AND INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=d,d")
- (and:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "nonmemory_operand" "N,di")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xff)
- return \"extbu %0\";
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xffff)
- return \"exthu %0\";
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x7fffffff)
- return \"add %0,%0\;lsr 1,%0\";
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x3fffffff)
- return \"asl2 %0\;lsr 2,%0\";
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x1fffffff)
- return \"add %0,%0\;asl2 %0\;lsr 3,%0\";
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0x0fffffff)
- return \"asl2 %0,%0\;asl2 %0\;lsr 4,%0\";
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffe)
- return \"lsr 1,%0\;add %0,%0\";
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffffc)
- return \"lsr 2,%0\;asl2 %0\";
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff8)
- return \"lsr 3,%0\;add %0,%0\;asl2 %0\";
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0xfffffff0)
- return \"lsr 4,%0\;asl2 %0\;asl2 %0\";
- return \"and %2,%0\";
-}"
- [(set_attr "cc" "none_0hit,set_zn_c0")])
-
-;; ----------------------------------------------------------------------
-;; OR INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ior:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "nonmemory_operand" "di")))]
- ""
- "or %2,%0"
- [(set_attr "cc" "set_zn_c0")])
-
-;; ----------------------------------------------------------------------
-;; XOR INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (xor:SI (match_operand:SI 1 "register_operand" "%0")
- (match_operand:SI 2 "nonmemory_operand" "di")))]
- ""
- "xor %2,%0"
- [(set_attr "cc" "set_zn_c0")])
-
-;; ----------------------------------------------------------------------
-;; NOT INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (not:SI (match_operand:SI 1 "register_operand" "0")))]
- ""
- "not %0"
- [(set_attr "cc" "set_zn_c0")])
-
-;; -----------------------------------------------------------------
-;; BIT FIELDS
-;; -----------------------------------------------------------------
-
-
-;; These set/clear memory in byte sized chunks.
-;;
-;; They are no smaller/faster than loading the value into a register
-;; and storing the register, but they don't need a scratch register
-;; which may allow for better code generation.
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=R,d") (const_int 0))]
- ""
- "@
- bclr 255,%A0
- clr %0"
- [(set_attr "cc" "clobber")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=R,d") (const_int -1))]
- ""
- "@
- bset 255,%A0
- mov -1,%0"
- [(set_attr "cc" "clobber,none_0hit")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=R,d")
- (subreg:QI
- (and:SI (subreg:SI (match_dup 0) 0)
- (match_operand:SI 1 "const_int_operand" "i,i")) 0))]
- ""
- "@
- bclr %N1,%A0
- and %1,%0"
- [(set_attr "cc" "clobber,set_zn_c0")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=R,d")
- (subreg:QI
- (ior:SI (subreg:SI (match_dup 0) 0)
- (match_operand:SI 1 "const_int_operand" "i,i")) 0))]
- ""
- "@
- bset %1,%A0
- or %1,%0"
- [(set_attr "cc" "clobber")])
-
-(define_insn ""
- [(set (cc0)
- (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand 1 "const_int_operand" "")
- (match_operand 2 "const_int_operand" "")))]
- ""
- "*
-{
- int len = INTVAL (operands[1]);
- int bit = INTVAL (operands[2]);
- int mask = 0;
- rtx xoperands[2];
-
- while (len > 0)
- {
- mask |= (1 << bit);
- bit++;
- len--;
- }
-
- xoperands[0] = operands[0];
- xoperands[1] = GEN_INT (mask);
- output_asm_insn (\"btst %1,%0\", xoperands);
- return \"\";
-}"
- [(set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (cc0)
- (zero_extract:SI (match_operand:QI 0 "general_operand" "R,d")
- (match_operand 1 "const_int_operand" "")
- (match_operand 2 "const_int_operand" "")))]
- "INTVAL (operands[1]) <= 8 && INTVAL (operands[2]) <= 7"
- "*
-{
- int len = INTVAL (operands[1]);
- int bit = INTVAL (operands[2]);
- int mask = 0;
- rtx xoperands[2];
-
- while (len > 0)
- {
- mask |= (1 << bit);
- bit++;
- len--;
- }
-
- xoperands[0] = operands[0];
- xoperands[1] = GEN_INT (mask);
- if (GET_CODE (operands[0]) == REG)
- output_asm_insn (\"btst %1,%0\", xoperands);
- else
- output_asm_insn (\"btst %1,%A0\", xoperands);
- return \"\";
-}"
- [(set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (cc0) (and:SI (match_operand:SI 0 "register_operand" "d")
- (match_operand:SI 1 "const_int_operand" "")))]
- ""
- "btst %1,%0"
- [(set_attr "cc" "set_zn_c0")])
-
-(define_insn ""
- [(set (cc0)
- (and:SI
- (subreg:SI (match_operand:QI 0 "general_operand" "R,d") 0)
- (match_operand:SI 1 "const_int_operand" "")))]
- ""
- "@
- btst %1,%A0
- btst %1,%0"
- [(set_attr "cc" "set_zn_c0")])
-
-;; -----------------------------------------------------------------
-;; -----------------------------------------------------------------
-;; Scc INSTRUCTIONS
-;; -----------------------------------------------------------------
-;; It's probably worth the time to define setcc type insns too
-
-
-;; ----------------------------------------------------------------------
-;; JUMP INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-;; Conditional jump instructions
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0
- && (GET_CODE (operands[1]) == GT
- || GET_CODE (operands[1]) == GE
- || GET_CODE (operands[1]) == LE
- || GET_CODE (operands[1]) == LT))
- return 0;
- return \"b%b1 %0\";
-}"
- [(set_attr "cc" "none")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0
- && (GET_CODE (operands[1]) == GT
- || GET_CODE (operands[1]) == GE
- || GET_CODE (operands[1]) == LE
- || GET_CODE (operands[1]) == LT))
- return 0;
- return \"b%B1 %0\";
-}"
- [(set_attr "cc" "none")])
-
-;; Unconditional and other jump instructions.
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jmp %l0"
- [(set_attr "cc" "none")])
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "a"))]
- ""
- "jmp (%0)"
- [(set_attr "cc" "none")])
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "register_operand" "a"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jmp (%0)"
- [(set_attr "cc" "none")])
-
-;; Call subroutine with no return value.
-
-(define_expand "call"
- [(call (match_operand:QI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (! call_address_operand (XEXP (operands[0], 0)))
- XEXP (operands[0], 0) = force_reg (SImode, XEXP (operands[0], 0));
- emit_call_insn (gen_call_internal (XEXP (operands[0], 0), operands[1]));
- DONE;
-}")
-
-(define_insn "call_internal"
- [(call (mem:QI (match_operand:SI 0 "call_address_operand" "aS"))
- (match_operand:SI 1 "general_operand" "g"))]
- ""
- "calls %C0"
- [(set_attr "cc" "clobber")])
-
-;; Call subroutine, returning value in operand 0
-;; (which must be a hard register).
-
-(define_expand "call_value"
- [(set (match_operand 0 "" "")
- (call (match_operand:QI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")))]
- ""
- "
-{
- if (! call_address_operand (XEXP (operands[1], 0)))
- XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0));
- emit_call_insn (gen_call_value_internal (operands[0],
- XEXP (operands[1], 0),
- operands[2]));
- DONE;
-}")
-
-(define_insn "call_value_internal"
- [(set (match_operand 0 "" "=d")
- (call (mem:QI (match_operand:SI 1 "call_address_operand" "aS"))
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "calls %C1"
- [(set_attr "cc" "clobber")])
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop"
- [(set_attr "cc" "none")])
-
-;; ----------------------------------------------------------------------
-;; EXTEND INSTRUCTIONS
-;; ----------------------------------------------------------------------
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=d,d,d")
- (zero_extend:SI
- (match_operand:QI 1 "general_operand" "0,d,m")))]
- ""
- "@
- extbu %0
- mov %1,%0\;extbu %0
- movbu %1,%0"
- [(set_attr "cc" "none_0hit")])
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=d,d,d")
- (zero_extend:SI
- (match_operand:HI 1 "general_operand" "0,d,m")))]
- ""
- "@
- exthu %0
- mov %1,%0\;exthu %0
- movhu %1,%0"
- [(set_attr "cc" "none_0hit")])
-
-;;- sign extension instructions
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=d,d")
- (sign_extend:SI
- (match_operand:QI 1 "general_operand" "0,d")))]
- ""
- "@
- extb %0
- mov %1,%0\;extb %0"
- [(set_attr "cc" "none_0hit")])
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=d,d")
- (sign_extend:SI
- (match_operand:HI 1 "general_operand" "0,d")))]
- ""
- "@
- exth %0
- mov %1,%0\;exth %0"
- [(set_attr "cc" "none_0hit")])
-
-;; ----------------------------------------------------------------------
-;; SHIFTS
-;; ----------------------------------------------------------------------
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=da,d,d,d,d")
- (ashift:SI
- (match_operand:SI 1 "register_operand" "0,0,0,0,0")
- (match_operand:QI 2 "nonmemory_operand" "J,K,M,L,di")))]
- ""
- "@
- add %0,%0
- asl2 %0
- asl2 %0\;add %0,%0
- asl2 %0\;asl2 %0
- asl %2,%0"
- [(set_attr "cc" "set_zn_c0")])
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (lshiftrt:SI
- (match_operand:SI 1 "register_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "di")))]
- ""
- "lsr %2,%0"
- [(set_attr "cc" "set_zn_c0")])
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (ashiftrt:SI
- (match_operand:SI 1 "register_operand" "0")
- (match_operand:QI 2 "nonmemory_operand" "di")))]
- ""
- "asr %2,%0"
- [(set_attr "cc" "set_zn_c0")])
-
-;; ----------------------------------------------------------------------
-;; PROLOGUE/EPILOGUE
-;; ----------------------------------------------------------------------
-(define_expand "prologue"
- [(const_int 0)]
- ""
- "expand_prologue (); DONE;")
-
-(define_expand "epilogue"
- [(return)]
- ""
- "
-{
- expand_epilogue ();
- DONE;
-}")
-
-(define_insn "return_internal"
- [(const_int 2)]
- ""
- "rets"
- [(set_attr "cc" "clobber")])
-
-;; This insn restores the callee saved registers and does a return, it
-;; can also deallocate stack space.
-(define_insn "return_internal_regs"
- [(const_int 0)
- (match_operand:SI 0 "const_int_operand" "i")
- (return)]
- ""
- "ret [d2,d3,a2,a3],%0"
- [(set_attr "cc" "clobber")])
-
-(define_insn "store_movm"
- [(const_int 1)]
- ""
- "movm [d2,d3,a2,a3],(sp)"
- [(set_attr "cc" "clobber")])
-
-(define_insn "return"
- [(return)]
- "can_use_return_insn ()"
- "*
-{
- rtx next = next_active_insn (insn);
-
- if (next
- && GET_CODE (next) == JUMP_INSN
- && GET_CODE (PATTERN (next)) == RETURN)
- return \"\";
- else
- return \"rets\";
-}"
- [(set_attr "cc" "clobber")])
-
-;; Try to combine consecutive updates of the stack pointer (or any
-;; other register for that matter).
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=dax")
- (plus:SI (match_dup 0)
- (match_operand 1 "const_int_operand" "")))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (match_operand 2 "const_int_operand" "")))]
- ""
- "*
-{
- operands[1] = GEN_INT (INTVAL (operands[2]) + INTVAL (operands[1]));
- return \"add %1,%0\";
-}"
- [(set_attr "cc" "clobber")])
-
-;;
-;; We had patterns to check eq/ne, but the they don't work because
-;; 0x80000000 + 0x80000000 = 0x0 with a carry out.
-;;
-;; The Z flag and C flag would be set, and we have no way to
-;; check for the Z flag set and C flag clear.
-;;
-;; This will work on the mn10200 because we can check the ZX flag
-;; if the comparison is in HImode.
-(define_peephole
- [(set (cc0) (match_operand:SI 0 "register_operand" "d"))
- (set (pc) (if_then_else (ge (cc0) (const_int 0))
- (match_operand 1 "" "")
- (pc)))]
- "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
- "add %0,%0\;bcc %1"
- [(set_attr "cc" "clobber")])
-
-(define_peephole
- [(set (cc0) (match_operand:SI 0 "register_operand" "d"))
- (set (pc) (if_then_else (lt (cc0) (const_int 0))
- (match_operand 1 "" "")
- (pc)))]
- "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
- "add %0,%0\;bcs %1"
- [(set_attr "cc" "clobber")])
-
-(define_peephole
- [(set (cc0) (match_operand:SI 0 "register_operand" "d"))
- (set (pc) (if_then_else (ge (cc0) (const_int 0))
- (pc)
- (match_operand 1 "" "")))]
- "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
- "add %0,%0\;bcs %1"
- [(set_attr "cc" "clobber")])
-
-(define_peephole
- [(set (cc0) (match_operand:SI 0 "register_operand" "d"))
- (set (pc) (if_then_else (lt (cc0) (const_int 0))
- (pc)
- (match_operand 1 "" "")))]
- "dead_or_set_p (ins1, operands[0]) && REG_OK_FOR_INDEX_P (operands[0])"
- "add %0,%0\;bcc %1"
- [(set_attr "cc" "clobber")])
diff --git a/gcc/config/mn10300/t-mn10300 b/gcc/config/mn10300/t-mn10300
deleted file mode 100644
index 379b90fca7f..00000000000
--- a/gcc/config/mn10300/t-mn10300
+++ /dev/null
@@ -1,20 +0,0 @@
-LIBGCC1=libgcc1.null
-CROSS_LIBGCC1=libgcc1.null
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#ifdef __LITTLE_ENDIAN__' > dp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >>dp-bit.c
- echo '#endif' >> dp-bit.c
- cat $(srcdir)/config/fp-bit.c >> dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
- echo '#endif' >> fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
diff --git a/gcc/config/mn10300/xm-mn10300.h b/gcc/config/mn10300/xm-mn10300.h
deleted file mode 100644
index 4ea1bc8d6cc..00000000000
--- a/gcc/config/mn10300/xm-mn10300.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Configuration for Matsushita MN10300.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-
-#include "tm.h"
diff --git a/gcc/config/msdos/configur.bat b/gcc/config/msdos/configur.bat
deleted file mode 100644
index 03e41091686..00000000000
--- a/gcc/config/msdos/configur.bat
+++ /dev/null
@@ -1,47 +0,0 @@
-@echo off
-echo Configuring GCC for go32
-rem This batch file assumes a unix-type "sed" program
-
-if not exist config\msdos\configure.bat chdir ..\..
-
-update config\i386\xm-dos.h config.h
-update config\i386\xm-dos.h hconfig.h
-update config\i386\xm-dos.h tconfig.h
-update config\i386\go32.h tm.h
-update config\i386\i386.md md
-update config\i386\i386.c aux-output.c
-
-echo # Makefile generated by "configure.bat"> Makefile
-echo all.dos: cccp cc1 cc1obj xgcc libgcc.a s-objlist >> Makefile
-sed -f config/msdos/top.sed Makefile.in >> Makefile
-
-set LANG=
-
-if not exist ada\make-lang.in goto no_ada
-sed -f config/msdos/top.sed ada\make-lang.in >> Makefile
-sed -f config/msdos/top.sed ada\makefile.in > ada\Makefile
-set LANG=%LANG% ada.&
-:no_ada
-
-if not exist cp\make-lang.in goto no_cp
-sed -f config/msdos/top.sed cp\make-lang.in >> Makefile
-sed -f config/msdos/top.sed cp\makefile.in > cp\Makefile
-set LANG=%LANG% c++.&
-:no_cp
-
-echo lang.mostlyclean: %LANG% | sed "s/&/mostlyclean/g" >> Makefile
-echo lang.clean: %LANG% | sed "s/&/clean/g" >> Makefile
-echo lang.distclean: %LANG% | sed "s/&/distclean/g" >> Makefile
-echo lang.maintainer-clean: %LANG% | sed "s/&/maintainer-clean/g" >> Makefile
-echo /* options.h */ > options.h
-if exist cp\lang-options.h echo #include "cp/lang-options.h" >> options.h
-if exist ada\lang-options.h echo #include "ada/lang-options.h" >> options.h
-if exist f\lang-options.h echo #include "f/lang-options.h" >> options.h
-echo /* specs.h */ > specs.h
-if exist cp\lang-specs.h echo #include "cp/lang-specs.h" >> specs.h
-if exist ada\lang-specs.h echo #include "ada/lang-specs.h" >> specs.h
-if exist f\lang-specs.h echo #include "f/lang-specs.h" >> specs.h
-
-echo #define MULTILIB_SELECT ". ;" > multilib.h1
-update multilib.h1 multilib.h
-del multilib.h1
diff --git a/gcc/config/msdos/libgcc.mak b/gcc/config/msdos/libgcc.mak
deleted file mode 100644
index 5f480b152d3..00000000000
--- a/gcc/config/msdos/libgcc.mak
+++ /dev/null
@@ -1,14 +0,0 @@
-# Build libgcc.a
-
-libgcc.a : libgcc1.c libgcc2.c mklibgcc
- ./mklibgcc -c
- ./mklibgcc '$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES)' libgcc1.c $(LIB1FUNCS)
- ./mklibgcc '$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES)' libgcc2.c $(LIB2FUNCS)
- -command /c mklibnow.bat
- -command /c del libgcc.a
- ar rvs libgcc.a lgcctmp/*.o
-
-mklibgcc : config/msdos/mklibgcc.c
- gcc $(CFLAGS) $^ -o $@
-
-
diff --git a/gcc/config/msdos/mklibgcc.c b/gcc/config/msdos/mklibgcc.c
deleted file mode 100644
index 705b3d5c404..00000000000
--- a/gcc/config/msdos/mklibgcc.c
+++ /dev/null
@@ -1,98 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <dirent.h>
-
-char *skips[] = {
- "__main",
- "_ctors",
- "_exit",
- "_ctor_list",
- "_dtor_list",
- 0
-};
-
-int
-do_clean()
-{
- DIR *dir;
- struct dirent *de;
- remove("mklibnow.bat");
-
- dir = opendir("lgcctmp");
- if (!dir)
- return 0;
- while ((de=readdir(dir)))
- {
- char buf[30];
- if (de->d_name[0] == '.')
- continue;
- sprintf(buf, "lgcctmp/%s", de->d_name);
- unlink(buf);
- }
- closedir(dir);
- return 0;
-}
-
-int
-main(int argc, char **argv)
-{
- char *cc = argv[1];
- char *csrc=argv[2];
- int i;
- FILE *batfile;
- FILE *cfile;
-
- if (argc > 1 && strcmp(argv[1], "-c")==0)
- return do_clean();
-
- mkdir("lgcctmp", 0755);
-
- batfile = fopen("mklibnow.bat", "a");
- if (!batfile)
- {
- perror("mklibnow.bat");
- return 1;
- }
- fprintf(batfile, "@echo off\n");
-
- for (i=3; i<argc; i++)
- {
- char basename[30], *bp;
- int s;
- for (s=0; skips[s]; s++)
- if (strcmp(skips[s], argv[i]) == 0)
- break;
- if (skips[s])
- continue;
- strcpy(basename, "lgcctmp/");
- if (strncmp(argv[i], "_fix", 4)==0)
- {
- strcat(basename, "fx");
- strcat(basename, argv[i]+4);
- }
- else if (strncmp(argv[i], "_float", 4)==0)
- {
- strcat(basename, "flt");
- strcat(basename, argv[i]+6);
- }
- else
- {
- strcat(basename, argv[i]);
- }
- bp = basename + strlen(basename);
- fprintf(batfile, "%s -c %s.c -o %s.o\n", cc, basename, basename);
- strcpy(bp, ".c");
- cfile = fopen(basename, "w");
- if (cfile)
- {
- *bp = 0;
- fprintf(cfile, "#define L%s\n#include \"%s\"\n", argv[i], csrc);
- fclose(cfile);
- }
- else
- perror(basename);
- }
-
- fclose(batfile);
- return 0;
-}
diff --git a/gcc/config/msdos/top.sed b/gcc/config/msdos/top.sed
deleted file mode 100644
index 7881236d9b7..00000000000
--- a/gcc/config/msdos/top.sed
+++ /dev/null
@@ -1,57 +0,0 @@
-/\.o[ ]*:/ s/config.status//
-/^multilib.h/ s/multilib/not-multilib/
-/^target=/ c\
-target=go32
-/^out_file=/ c\
-out_file=config/i386/i386.c
-/^out_object_file=/ c\
-out_object_file=i386.o
-/^md_file=/ c\
-md_file=config/i386/i386.md
-/^tm_file=/ c\
-tm_file=config/i386/go32.h
-/^build_xm_file=/ c\
-build_xm_file=config/i386/xm-dos.h
-/^host_xm_file=/ c\
-host_xm_file=config/i386/xm-dos.h
-/^lang_specs_files=/ d
-/^lang_options_files=/ d
-/^xmake_file=/ d
-/^tmake_file=/ d
-/^version=/ c\
-version=2.7.2
-/^mainversion=/ c\
-mainversion=2.7.2
-s/CC = cc/CC = gcc/
-s/:\$/: \$/g
-s/^ \ *\.\// /
-s/<\ *\$(srcdir)\//< $(srcdir)\\/g
-s/^ \$(srcdir)\/move-if-change/ update/
-s/^USE_/# USE_/
-s/`echo \$(srcdir)\///g
-s/ | sed 's,\^\\\.\/,,'`//g
-s/^ cd \$(srcdir)[ ]*;/ /
-/^# USE_HOST_OBSTACK/ i\
-USE_HOST_OBSTACK=obstack.o
-/^stamp-attrtab/,/update/ {
- /\\/d
- /[ ]fi[ ]/d
- /[ ]fi$/d
- /update/ i\
- genattrtab md > t-attrtab.c
-}
-/^enquire[ ]*:/ s/\$(GCC_PARTS)//g
-/^enquire.o[ ]*:/ s/\$(GCC_PASSES)//g
-/^GCC_FOR_TARGET =/ c\
-GCC_FOR_TARGET = gcc
-s/; *@true//
-s/stamp-/s-/g
-s/tmp-/t-/g
-/> *s-objlist/ c\
- echo.exe -o s-objlist $(addprefix ../,$(OBJS) $(BC_OBJS))
-/^OBJS.*s-objlist/ s?`cat ../s-objlist`?@../s-objlist?
-s/^\(SUBDIR_OBSTACK *=\).*$/\1 ..\/obstack.o/
-s/^\(SUBDIR_USE_ALLOCA *=\).*$/\1/
-s/^\(SUBDIR_MALLOC *=\).*$/\1/
-/^# Build libgcc.a/ r config/msdos/libgcc.mak
-/^# Build libgcc.a/,/ / d
diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h
deleted file mode 100644
index 860e10107e5..00000000000
--- a/gcc/config/netbsd.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* NETBSD_NATIVE is defined when gcc is integrated into the NetBSD
- source tree so it can be configured appropriately without using
- the GNU configure/build mechanism. */
-
-#ifdef NETBSD_NATIVE
-
-/* Look for the include files in the system-defined places. */
-
-#undef GPLUSPLUS_INCLUDE_DIR
-#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
-
-#undef GCC_INCLUDE_DIR
-#define GCC_INCLUDE_DIR "/usr/include"
-
-#undef INCLUDE_DEFAULTS
-#define INCLUDE_DEFAULTS \
- { \
- { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \
- { GCC_INCLUDE_DIR, 0, 0 }, \
- { 0, 0, 0 } \
- }
-
-/* Under NetBSD, the normal location of the compiler back ends is the
- /usr/libexec directory. */
-
-#undef STANDARD_EXEC_PREFIX
-#define STANDARD_EXEC_PREFIX "/usr/libexec/"
-
-/* Under NetBSD, the normal location of the various *crt*.o files is the
- /usr/lib directory. */
-
-#undef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "/usr/lib/"
-
-#endif
-
-
-/* Provide a CPP_SPEC appropriate for NetBSD. Current we just deal with
- the GCC option `-posix'. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
-
-/* Provide an ASM_SPEC appropriate for NetBSD. Currently we only deal
- with the options for generating PIC code. */
-
-#undef ASM_SPEC
-#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
-
-/* Provide a LIB_SPEC appropriate for NetBSD. Just select the appropriate
- libc, depending on whether we're doing profiling. */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-/* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
- for the special GCC options -static, -assert, and -nostdlib. */
-
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
-
-/* This defines which switch letters take arguments. */
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
- (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
- || (CHAR) == 'R')
-
-/* We have atexit(3). */
-
-#define HAVE_ATEXIT
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Handle #pragma weak and #pragma pack. */
-
-#define HANDLE_SYSV_PRAGMA
-
-/*
- * Some imports from svr4.h in support of shared libraries.
- * Currently, we need the DECLARE_OBJECT_SIZE stuff.
- */
-
-/* Define the strings used for the .type, .size, and .set directives.
- These strings generally do not vary from one system running netbsd
- to another, but if a given system needs to use different pseudo-op
- names for these, they may be overridden in the file which includes
- this one. */
-
-#undef TYPE_ASM_OP
-#undef SIZE_ASM_OP
-#undef SET_ASM_OP
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-#define SET_ASM_OP ".set"
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#undef ASM_WEAKEN_LABEL
-#define ASM_WEAKEN_LABEL(FILE,NAME) \
- do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
- fputc ('\n', FILE); } while (0)
-
-/* The following macro defines the format used to output the second
- operand of the .type assembler directive. Different svr4 assemblers
- expect various different forms for this operand. The one given here
- is just a default. You may need to override it in your machine-
- specific tm.h file (depending upon the particulars of your assembler). */
-
-#undef TYPE_OPERAND_FMT
-#define TYPE_OPERAND_FMT "@%s"
-
-/* Write the extra assembler code needed to declare a function's result.
- Most svr4 assemblers don't require any special declaration of the
- result value, but there are exceptions. */
-
-#ifndef ASM_DECLARE_RESULT
-#define ASM_DECLARE_RESULT(FILE, RESULT)
-#endif
-
-/* These macros generate the special .type and .size directives which
- are used to set the corresponding fields of the linker symbol table
- entries in an ELF object file under SVR4. These macros also output
- the starting labels for the relevant functions/objects. */
-
-/* Write the extra assembler code needed to declare a function properly.
- Some svr4 assemblers need to also have something extra said about the
- function's return value. We allow for that here. */
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Write the extra assembler code needed to declare an object properly. */
-
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', FILE); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#undef ASM_FINISH_DECLARE_OBJECT
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } while (0)
-
-/* This is how to declare the size of a function. */
-
-#undef ASM_DECLARE_FUNCTION_SIZE
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
- do { \
- if (!flag_inhibit_size_directive) \
- { \
- char label[256]; \
- static int labelno; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ","); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } while (0)
diff --git a/gcc/config/nextstep.c b/gcc/config/nextstep.c
deleted file mode 100644
index 3d6286dcb6b..00000000000
--- a/gcc/config/nextstep.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Functions for generic NeXT as target machine for GNU C compiler.
- Copyright (C) 1989, 90-93, 1996 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. */
-
-#include <tree.h>
-
-/* Make everything that used to go in the text section really go there. */
-
-int flag_no_mach_text_sections = 0;
-
-#define OPT_STRCMP(opt) (!strncmp (opt, p, sizeof (opt)-1))
-
-/* 1 if handle_pragma has been called yet. */
-
-static int pragma_initialized;
-
-/* Initial setting of `optimize'. */
-
-static int initial_optimize_flag;
-
-extern char *get_directive_line ();
-
-/* Called from check_newline via the macro HANDLE_PRAGMA.
- FINPUT is the source file input stream.
- CH is the first character after `#pragma'.
- The result is 1 if the pragma was handled. */
-
-int
-handle_pragma (finput, node)
- FILE *finput;
- tree node;
-{
- int retval = 0;
- register char *pname;
-
- /* Record initial setting of optimize flag, so we can restore it. */
- if (!pragma_initialized)
- {
- pragma_initialized = 1;
- initial_optimize_flag = optimize;
- }
-
- if (TREE_CODE (node) != IDENTIFIER_NODE)
- return 0;
-
- pname = IDENTIFIER_POINTER (node);
-
- if (strcmp (pname, "CC_OPT_ON") == 0)
- {
- optimize = 1, obey_regdecls = 0;
- warning ("optimization turned on");
- retval = 1;
- }
- else if (strcmp (pname, "CC_OPT_OFF") == 0)
- {
- optimize = 0, obey_regdecls = 1;
- warning ("optimization turned off");
- retval = 1;
- }
- else if (strcmp (pname, "CC_OPT_RESTORE") == 0)
- {
- extern int initial_optimize_flag;
-
- if (optimize != initial_optimize_flag)
- {
- if (initial_optimize_flag)
- obey_regdecls = 0;
- else
- obey_regdecls = 1;
- optimize = initial_optimize_flag;
- }
- warning ("optimization level restored");
- retval = 1;
- }
- else if (strcmp (pname, "CC_WRITABLE_STRINGS") == 0)
- flag_writable_strings = retval = 1;
- else if (strcmp (pname, "CC_NON_WRITABLE_STRINGS") == 0)
- flag_writable_strings = 0, retval = 1;
- else if (strcmp (pname, "CC_NO_MACH_TEXT_SECTIONS") == 0)
- flag_no_mach_text_sections = retval = 1;
-
- return retval;
-}
diff --git a/gcc/config/nextstep.h b/gcc/config/nextstep.h
deleted file mode 100644
index de8fbdc8bf0..00000000000
--- a/gcc/config/nextstep.h
+++ /dev/null
@@ -1,583 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC
- for NeXTSTEP.
- Copyright (C) 1989, 90-93, 1996, 1997 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. */
-
-/* Use new NeXT include file search path.
- In a cross compiler with NeXT as target, don't expect
- the host to use Next's directory scheme. */
-
-#ifndef CROSS_COMPILE
-#undef INCLUDE_DEFAULTS
-#define INCLUDE_DEFAULTS \
- { \
- { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \
- { LOCAL_INCLUDE_DIR, 0, 1 }, \
- { TOOL_INCLUDE_DIR, 0, 1 }, \
- { GCC_INCLUDE_DIR, 0, 0 }, \
- /* These are for fixincludes-fixed ansi/bsd headers \
- which wouldn't be found otherwise. \
- (The use of string catenation here is OK since \
- NeXT's native compiler is derived from GCC.) */ \
- { GCC_INCLUDE_DIR "/ansi", 0, 0 }, \
- { GCC_INCLUDE_DIR "/bsd", 0, 0 }, \
- { "/NextDeveloper/Headers", 0, 0 }, \
- { "/NextDeveloper/Headers/ansi", 0, 0 }, \
- { "/NextDeveloper/Headers/bsd", 0, 0 }, \
- { "/LocalDeveloper/Headers", 0, 0 }, \
- { "/LocalDeveloper/Headers/ansi", 0, 0 }, \
- { "/LocalDeveloper/Headers/bsd", 0, 0 }, \
- { "/NextDeveloper/2.0CompatibleHeaders", 0, 0 }, \
- { STANDARD_INCLUDE_DIR, 0, 0 }, \
- { "/usr/include/bsd", 0, 0 }, \
- { 0, 0, 0 } \
- }
-#else /* CROSS_COMPILE */
-#undef INCLUDE_DEFAULTS
-#define INCLUDE_DEFAULTS \
- { \
- { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \
- { LOCAL_INCLUDE_DIR, 0, 1 }, \
- { GCC_INCLUDE_DIR, 0, 0 }, \
- { GCC_INCLUDE_DIR "/ansi", 0, 0 }, \
- { GCC_INCLUDE_DIR "/bsd", 0, 0 }, \
- { TOOL_INCLUDE_DIR, 0, 1 }, \
- { TOOL_INCLUDE_DIR "/ansi", 0, 0 }, \
- { TOOL_INCLUDE_DIR "/bsd", 0, 0 }, \
- { STANDARD_INCLUDE_DIR, 0, 0 }, \
- { "/usr/include/bsd", 0, 0 }, \
- { 0, 0, 0 } \
- }
-#endif /* CROSS_COMPILE */
-
-#undef EXTRA_FORMAT_FUNCTIONS
-#define EXTRA_FORMAT_FUNCTIONS \
- "NXPrintf", FALSE, 2, FALSE, \
- "NXScanf", TRUE, 2, FALSE, \
- "NXVPrintf", FALSE, 2, TRUE, \
- "NXVScanf", TRUE, 2, TRUE, \
- "DPSPrintf", FALSE, 2, FALSE, \
- "bsd_sprintf", FALSE, 2, FALSE, \
- "bsd_vsprintf", FALSE, 2, TRUE,
-
-/* Make -fnext-runtime the default. */
-
-#define NEXT_OBJC_RUNTIME
-
-/* We have atexit. */
-
-#define HAVE_ATEXIT
-
-/* Enable recent gcc to compile under the old gcc in Next release 1.0. */
-
-#define __inline inline
-
-/* wchar_t is unsigned short */
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE (BITS_PER_WORD / 2)
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-
-#undef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* These compiler options take n arguments. */
-
-#undef WORD_SWITCH_TAKES_ARG
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) ? 1 : \
- !strcmp (STR, "segalign") ? 1 : \
- !strcmp (STR, "seg1addr") ? 1 : \
- !strcmp (STR, "segaddr") ? 2 : \
- !strcmp (STR, "sectobjectsymbols") ? 2 : \
- !strcmp (STR, "segprot") ? 3 : \
- !strcmp (STR, "sectcreate") ? 3 : \
- !strcmp (STR, "sectalign") ? 3 : \
- !strcmp (STR, "segcreate") ? 3 : \
- !strcmp (STR, "sectorder") ? 3 : \
- !strcmp (STR, "siff-mask") ? 1 : \
- !strcmp (STR, "siff-filter") ? 1 : \
- !strcmp (STR, "siff-warning") ? 1 : \
- !strcmp (STR, "arch") ? 1 : \
- !strcmp (STR, "pagezero_size") ? 1 : \
- 0)
-
-#undef WORD_SWITCH
-#define WORD_SWITCH(STR) \
- (WORD_SWITCH_TAKES_ARG (STR) \
- || !strcmp (STR, "bsd") \
- || !strcmp (STR, "object") \
- || !strcmp (STR, "ObjC") \
- || !strcmp (STR, "all_load"))
-
-/* Machine dependent ccp options. */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{!traditional: -D__STDC__} \
- %{posixstrict:-D_POSIX_SOURCE} \
- %{!posixstrict:%{bsd:-D__STRICT_BSD__} \
- %{posix:-D_POSIX_SOURCE} \
- %{!ansi:-D_NEXT_SOURCE}} \
- %{MD:-MD %M} %{MMD:-MMD %M}"
-
-/* Machine dependent ld options. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{Z} %{M} \
-%{execute*} %{preload*} %{fvmlib*} \
-%{segalign*} %{seg1addr*} %{segaddr*} %{segprot*} \
-%{pagezero_size*} \
-%{seglinkedit*} %{noseglinkedit*} \
-%{sectcreate*} %{sectalign*} %{sectobjectsymbols}\
-%{segcreate*} %{Mach*} %{whyload} %{w} \
-%{sectorder*} %{whatsloaded} %{ObjC} %{all_load} %{object}"
-
-/* Machine dependent libraries. */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{!posix*:-lsys_s} %{posix*:-lposix}"
-
-/* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!posix*:%{pg:-lgcrt0.o}%{!pg: \
- %{p:%e-p profiling is no longer supported. Use -pg instead.} \
- %{!p:-lcrt0.o}}}\
- %{posix*:%{pg:-lgposixcrt0.o}%{!pg: \
- %{p:%e-p profiling is no longer supported. Use -pg instead.} \
- %{!p:-lposixcrt0.o}}}"
-
-/* Allow #sscs (but don't do anything). */
-
-#define SCCS_DIRECTIVE
-
-/* We use Dbx symbol format. */
-
-#undef SDB_DEBUGGING_INFO
-#undef XCOFF_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-
-/* This saves a fair amount of space. */
-
-#undef DBX_CONTIN_LENGTH
-#define DBX_CONTIN_LENGTH 0
-
-/* These screw up NeXT's gdb at the moment, so don't use them. */
-
-#undef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
-#define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE, FILENAME)
-
-/* These come from bsd386.h, but are specific to sequent, so make sure
- they don't bite us. */
-
-#undef DBX_NO_XREFS
-#undef DBX_CONTIN_LENGTH
-
-/* gdb needs a null N_SO at the end of each file for scattered loading. */
-
-#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
- fprintf (FILE, \
- "\t.text\n\t.stabs \"%s\",%d,0,0,Letext\nLetext:\n", \
- "" , N_SO)
-
-/* Don't use .gcc_compiled symbols to communicate with GDB;
- They interfere with numerically sorted symbol lists. */
-
-#undef ASM_IDENTIFY_GCC
-#define ASM_IDENTIFY_GCC(asm_out_file)
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP
-#undef INVOKE__main
-
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { constructor_section (); \
- ASM_OUTPUT_ALIGN (FILE, 1); \
- fprintf (FILE, "\t.long "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- fprintf (FILE, ".reference .constructors_used\n"); \
- } while (0)
-
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { destructor_section (); \
- ASM_OUTPUT_ALIGN (FILE, 1); \
- fprintf (FILE, "\t.long "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- fprintf (FILE, ".reference .destructors_used\n"); \
- } while (0)
-
-/* Don't output a .file directive. That is only used by the assembler for
- error reporting. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)
-
-#undef ASM_FILE_END
-#define ASM_FILE_END(FILE) \
- do { \
- extern char *language_string; \
- if (strcmp (language_string, "GNU C++") == 0) \
- { \
- constructor_section (); \
- destructor_section (); \
- ASM_OUTPUT_ALIGN (FILE, 1); \
- } \
- } while (0)
-
-/* How to parse #pragma's */
-
-#undef HANDLE_PRAGMA
-#define HANDLE_PRAGMA(FINPUT, NODE) handle_pragma (FINPUT, NODE)
-
-/* Give methods pretty symbol names on NeXT. */
-
-#undef OBJC_GEN_METHOD_LABEL
-#define OBJC_GEN_METHOD_LABEL(BUF,IS_INST,CLASS_NAME,CAT_NAME,SEL_NAME,NUM) \
- do { if (CAT_NAME) \
- sprintf (BUF, "%c[%s(%s) %s]", (IS_INST) ? '-' : '+', \
- (CLASS_NAME), (CAT_NAME), (SEL_NAME)); \
- else \
- sprintf (BUF, "%c[%s %s]", (IS_INST) ? '-' : '+', \
- (CLASS_NAME), (SEL_NAME)); \
- } while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX "_"
-
-/* Wrap new method names in quotes so the assembler doesn't gag.
- Make Objective-C internal symbols local. */
-
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- do { if (NAME[0] == '+' || NAME[0] == '-') fprintf (FILE, "\"%s\"", NAME); \
- else if (!strncmp (NAME, "_OBJC_", 6)) fprintf (FILE, "L%s", NAME); \
- else if (!strncmp (NAME, ".objc_class_name_", 17)) \
- fprintf (FILE, "%s", NAME); \
- else fprintf (FILE, "%s%s", USER_LABEL_PREFIX, NAME); } while (0)
-
-#undef ALIGN_ASM_OP
-#define ALIGN_ASM_OP ".align"
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG))
-
-/* Ensure correct alignment of bss data. */
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u,%u\n", (SIZE), floor_log2 ((ALIGN) / BITS_PER_UNIT)))
-
-/* Output #ident as a .ident. */
-
-#undef ASM_OUTPUT_IDENT
-#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
-
-/* The maximum alignment which the object file format can support.
- For NeXT's Mach-O format, this is 2^15. */
-
-#undef MAX_OFILE_ALIGNMENT
-#define MAX_OFILE_ALIGNMENT 0x8000
-
-/* Create new Mach-O sections. */
-
-#undef SECTION_FUNCTION
-#define SECTION_FUNCTION(FUNCTION, SECTION, DIRECTIVE, WAS_TEXT, OBJC) \
-void \
-FUNCTION () \
-{ \
- extern void text_section (); \
- extern void objc_section_init (); \
- extern int flag_no_mach_text_sections; \
- \
- if (WAS_TEXT && flag_no_mach_text_sections) \
- text_section (); \
- else if (in_section != SECTION) \
- { \
- if (OBJC) \
- objc_section_init (); \
- fprintf (asm_out_file, "%s\n", DIRECTIVE); \
- in_section = SECTION; \
- } \
-} \
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS \
- in_const, in_cstring, in_literal4, in_literal8, \
- in_constructor, in_destructor, \
- in_objc_class, in_objc_meta_class, in_objc_category, \
- in_objc_class_vars, in_objc_instance_vars, \
- in_objc_cls_meth, in_objc_inst_meth, \
- in_objc_cat_cls_meth, in_objc_cat_inst_meth, \
- in_objc_selector_refs, \
- in_objc_symbols, in_objc_module_info, \
- in_objc_protocol, in_objc_string_object, \
- in_objc_class_names, in_objc_meth_var_names, \
- in_objc_meth_var_types, in_objc_cls_refs
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
-SECTION_FUNCTION (const_section, \
- in_const, \
- ".const", 1, 0) \
-SECTION_FUNCTION (cstring_section, \
- in_cstring, \
- ".cstring", 1, 0) \
-SECTION_FUNCTION (literal4_section, \
- in_literal4, \
- ".literal4", 1, 0) \
-SECTION_FUNCTION (literal8_section, \
- in_literal8, \
- ".literal8", 1, 0) \
-SECTION_FUNCTION (constructor_section, \
- in_constructor, \
- ".constructor", 0, 0) \
-SECTION_FUNCTION (destructor_section, \
- in_destructor, \
- ".destructor", 0, 0) \
-SECTION_FUNCTION (objc_class_section, \
- in_objc_class, \
- ".objc_class", 0, 1) \
-SECTION_FUNCTION (objc_meta_class_section, \
- in_objc_meta_class, \
- ".objc_meta_class", 0, 1) \
-SECTION_FUNCTION (objc_category_section, \
- in_objc_category, \
- ".objc_category", 0, 1) \
-SECTION_FUNCTION (objc_class_vars_section, \
- in_objc_class_vars, \
- ".objc_class_vars", 0, 1) \
-SECTION_FUNCTION (objc_instance_vars_section, \
- in_objc_instance_vars, \
- ".objc_instance_vars", 0, 1) \
-SECTION_FUNCTION (objc_cls_meth_section, \
- in_objc_cls_meth, \
- ".objc_cls_meth", 0, 1) \
-SECTION_FUNCTION (objc_inst_meth_section, \
- in_objc_inst_meth, \
- ".objc_inst_meth", 0, 1) \
-SECTION_FUNCTION (objc_cat_cls_meth_section, \
- in_objc_cat_cls_meth, \
- ".objc_cat_cls_meth", 0, 1) \
-SECTION_FUNCTION (objc_cat_inst_meth_section, \
- in_objc_cat_inst_meth, \
- ".objc_cat_inst_meth", 0, 1) \
-SECTION_FUNCTION (objc_selector_refs_section, \
- in_objc_selector_refs, \
- ".objc_message_refs", 0, 1) \
-SECTION_FUNCTION (objc_symbols_section, \
- in_objc_symbols, \
- ".objc_symbols", 0, 1) \
-SECTION_FUNCTION (objc_module_info_section, \
- in_objc_module_info, \
- ".objc_module_info", 0, 1) \
-SECTION_FUNCTION (objc_protocol_section, \
- in_objc_protocol, \
- ".objc_protocol", 0, 1) \
-SECTION_FUNCTION (objc_string_object_section, \
- in_objc_string_object, \
- ".objc_string_object", 0, 1) \
-SECTION_FUNCTION (objc_class_names_section, \
- in_objc_class_names, \
- ".objc_class_names", 0, 1) \
-SECTION_FUNCTION (objc_meth_var_names_section, \
- in_objc_meth_var_names, \
- ".objc_meth_var_names", 0, 1) \
-SECTION_FUNCTION (objc_meth_var_types_section, \
- in_objc_meth_var_types, \
- ".objc_meth_var_types", 0, 1) \
-SECTION_FUNCTION (objc_cls_refs_section, \
- in_objc_cls_refs, \
- ".objc_cls_refs", 0, 1) \
- \
-void \
-objc_section_init () \
-{ \
- static int been_here = 0; \
- \
- if (been_here == 0) \
- { \
- been_here = 1; \
- objc_class_section (); \
- objc_meta_class_section (); \
- objc_cat_cls_meth_section (); \
- objc_cat_inst_meth_section (); \
- objc_cls_meth_section (); \
- objc_inst_meth_section (); \
- objc_selector_refs_section (); \
- objc_symbols_section (); \
- objc_category_section (); \
- objc_protocol_section (); \
- objc_class_vars_section (); \
- objc_instance_vars_section (); \
- objc_module_info_section (); \
- objc_string_object_section (); \
- objc_class_names_section (); \
- objc_meth_var_names_section (); \
- objc_meth_var_types_section (); \
- objc_cls_refs_section (); \
- } \
-}
-
-#undef READONLY_DATA_SECTION
-#define READONLY_DATA_SECTION const_section
-
-#undef SELECT_SECTION
-#define SELECT_SECTION(exp,reloc) \
- do \
- { \
- if (TREE_CODE (exp) == STRING_CST) \
- { \
- if (flag_writable_strings) \
- data_section (); \
- else if (TREE_STRING_LENGTH (exp) != \
- strlen (TREE_STRING_POINTER (exp)) + 1) \
- readonly_data_section (); \
- else \
- cstring_section (); \
- } \
- else if (TREE_CODE (exp) == INTEGER_CST \
- || TREE_CODE (exp) == REAL_CST) \
- { \
- tree size = TYPE_SIZE (TREE_TYPE (exp)); \
- \
- if (TREE_CODE (size) == INTEGER_CST && \
- TREE_INT_CST_LOW (size) == 4 && \
- TREE_INT_CST_HIGH (size) == 0) \
- literal4_section (); \
- else if (TREE_CODE (size) == INTEGER_CST && \
- TREE_INT_CST_LOW (size) == 8 && \
- TREE_INT_CST_HIGH (size) == 0) \
- literal8_section (); \
- else \
- readonly_data_section (); \
- } \
- else if (TREE_CODE (exp) == CONSTRUCTOR \
- && TREE_TYPE (exp) \
- && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE \
- && TYPE_NAME (TREE_TYPE (exp)) \
- && TREE_CODE (TYPE_NAME (TREE_TYPE (exp))) == IDENTIFIER_NODE \
- && IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (exp)))) \
- { \
- if (!strcmp (IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (exp))), \
- "NXConstantString")) \
- objc_string_object_section (); \
- else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp)) \
- && !TREE_SIDE_EFFECTS (exp)) \
- readonly_data_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (exp) == VAR_DECL && \
- DECL_NAME (exp) && \
- TREE_CODE (DECL_NAME (exp)) == IDENTIFIER_NODE && \
- IDENTIFIER_POINTER (DECL_NAME (exp)) && \
- !strncmp (IDENTIFIER_POINTER (DECL_NAME (exp)), "_OBJC_", 6)) \
- { \
- const char *name = IDENTIFIER_POINTER (DECL_NAME (exp)); \
- \
- if (!strncmp (name, "_OBJC_CLASS_METHODS_", 20)) \
- objc_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_INSTANCE_METHODS_", 23)) \
- objc_inst_meth_section (); \
- else if (!strncmp (name, "_OBJC_CATEGORY_CLASS_METHODS_", 20)) \
- objc_cat_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_CATEGORY_INSTANCE_METHODS_", 23)) \
- objc_cat_inst_meth_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_VARIABLES_", 22)) \
- objc_class_vars_section (); \
- else if (!strncmp (name, "_OBJC_INSTANCE_VARIABLES_", 25)) \
- objc_instance_vars_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_PROTOCOLS_", 22)) \
- objc_cat_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_NAME_", 17)) \
- objc_class_names_section (); \
- else if (!strncmp (name, "_OBJC_METH_VAR_NAME_", 20)) \
- objc_meth_var_names_section (); \
- else if (!strncmp (name, "_OBJC_METH_VAR_TYPE_", 20)) \
- objc_meth_var_types_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_REFERENCES", 22)) \
- objc_cls_refs_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_", 12)) \
- objc_class_section (); \
- else if (!strncmp (name, "_OBJC_METACLASS_", 16)) \
- objc_meta_class_section (); \
- else if (!strncmp (name, "_OBJC_CATEGORY_", 15)) \
- objc_category_section (); \
- else if (!strncmp (name, "_OBJC_SELECTOR_REFERENCES", 25)) \
- objc_selector_refs_section (); \
- else if (!strncmp (name, "_OBJC_SYMBOLS", 13)) \
- objc_symbols_section (); \
- else if (!strncmp (name, "_OBJC_MODULES", 13)) \
- objc_module_info_section (); \
- else if (!strncmp (name, "_OBJC_PROTOCOL_INSTANCE_METHODS_", 32)) \
- objc_cat_inst_meth_section (); \
- else if (!strncmp (name, "_OBJC_PROTOCOL_CLASS_METHODS_", 29)) \
- objc_cat_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_PROTOCOL_REFS_", 20)) \
- objc_cat_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_PROTOCOL_", 15)) \
- objc_protocol_section (); \
- else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp)) \
- && !TREE_SIDE_EFFECTS (exp)) \
- readonly_data_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (exp) == VAR_DECL) \
- { \
- if ((flag_pic && reloc) \
- || !TREE_READONLY (exp) || TREE_SIDE_EFFECTS (exp) \
- || !DECL_INITIAL (exp) \
- || (DECL_INITIAL (exp) != error_mark_node \
- && !TREE_CONSTANT (DECL_INITIAL (exp)))) \
- data_section (); \
- else \
- readonly_data_section (); \
- } \
- else \
- readonly_data_section (); \
- } \
- while (0)
-
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(mode, rtx) \
- do \
- { \
- if (GET_MODE_SIZE(mode) == 8) \
- literal8_section(); \
- else if (GET_MODE_SIZE(mode) == 4) \
- literal4_section(); \
- else \
- const_section (); \
- } \
- while (0)
diff --git a/gcc/config/nextstep21.h b/gcc/config/nextstep21.h
deleted file mode 100644
index 8009571672b..00000000000
--- a/gcc/config/nextstep21.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* nextstep.h -- operating system specific defines to be used when
- targeting GCC for NeXTSTEP.
- Copyright (C) 1989, 1990, 1991, 1992, 1993 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. */
-
-
-/* changed for NeXTStep 2.1, Ch. Kranz, 2/94, 3/94 */
-#include "nextstep.h"
-
-/* set flag_gnu_linker=0, use collect2 for linking */
-#undef USE_COLLECT2
-#define USE_COLLECT2
-
-/* use this until a newer gdb for NeXTStep21 is available */
-#define DEFAULT_GDB_EXTENSIONS 0
-
-/* we need the call to __main to start all global destructors and constructors
- correctly, so undef INIT_SECTION_ASM_OP, (see libgcc2.c line 1965)
- and define INVOKE_main */
-#undef INIT_SECTION_ASM_OP
-#define INVOKE__main
-
-/* We call the global destructors, constructors from __main */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-
-#undef ASM_FILE_END
-#define ASM_FILE_END(FILE) \
- do { \
- extern char *language_string; \
- if (strcmp (language_string, "GNU C++") == 0) \
- { \
- ASM_OUTPUT_ALIGN (FILE, 1); \
- } \
- } while (0)
-/* deleted: destructor_section (); \ */
-/* deleted: constructor_section (); \ */
-
-/* Ensure correct alignment of bss data. */
-/* ASM_OUTPUT_ALIGNED_LOCAL not needed */
-/* need ASM_OUTPUT_LOCAL instead for old NeXT-as */
-/* look in varasm.c, line 1062 and 1476 */
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
diff --git a/gcc/config/ns32k/encore.h b/gcc/config/ns32k/encore.h
deleted file mode 100644
index 028a6533796..00000000000
--- a/gcc/config/ns32k/encore.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/* Definitions of target machine for GNU compiler. ENCORE NS32000 version.
- Copyright (C) 1988, 1993 Free Software Foundation, Inc.
- Adapted by Robert Brown (brown@harvard.harvard.edu) from the Sequent
- version by Michael Tiemann (tiemann@mcc.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. */
-
-
-#define EXTERNAL_PREFIX '?'
-#define IMMEDIATE_PREFIX '$'
-
-#include "ns32k/ns32k.h"
-
-#define SDB_DEBUGGING_INFO
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Cause long-jump assembler to be used,
- since otherwise some files fail to be assembled right. */
-#define ASM_SPEC "-j"
-
-#undef ASM_FILE_START
-#undef ASM_GENERATE_INTERNAL_LABEL
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#undef ASM_OUTPUT_ALIGN
-#undef ASM_OUTPUT_ASCII
-#undef ASM_OUTPUT_DOUBLE
-#undef ASM_OUTPUT_INT
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#undef ASM_OUTPUT_LOCAL
-#undef CPP_PREDEFINES
-#undef FUNCTION_BOUNDARY
-#undef PRINT_OPERAND
-#undef PRINT_OPERAND_ADDRESS
-#undef TARGET_VERSION
-#undef FUNCTION_PROFILER
-#undef ASM_OUTPUT_LABELREF_AS_INT
-
-#define TARGET_DEFAULT 9 /* 32332 with 32081. */
-#define TARGET_VERSION fprintf (stderr, " (32000, Encore syntax)");
-/* Note Encore does not standardly do -Dencore. */
-/* budd: should have a -ns32332 (or -apc) switch! but no harm for now */
-#define CPP_PREDEFINES "-Dns32000 -Dn16 -Dns16000 -Dns32332 -Dunix -Asystem(unix) -Acpu(ns32k) -Amachine(ns32k)"
-
-/* Ignore certain cpp directives used in header files on sysV. */
-#define SCCS_DIRECTIVE
-
-/* Output #ident as a .ident. */
-#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
-
-/* The .file command should always begin the output. */
-#define ASM_FILE_START(FILE) \
-output_file_directive ((FILE), main_input_filename)
-
-#define FUNCTION_BOUNDARY 128 /* speed optimization */
-
-/*
- * The Encore assembler uses ".align 2" to align on 2-byte boundaries.
- */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf (FILE, "\t.align %d\n", 1 << (LOG))
-
-/* The Encore assembler doesn't seem to accept the usual second argument
- and warns that .align may not work in the text section if optimization
- is on. */
-#undef ASM_OUTPUT_ALIGN_CODE
-#define ASM_OUTPUT_ALIGN_CODE(FILE)
-
-/*
- * Internal labels are prefixed with a period.
- */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*.%s%d", PREFIX, NUM)
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.double .L%d-.LI%d\n", VALUE, REL)
-
-/*
- * Different syntax for integer constants, double constants, and
- * uninitialized locals.
- */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.double "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_LABELREF_AS_INT(STREAM, NAME) \
-do { \
- fprintf (STREAM, "\t.double\t"); \
- ASM_OUTPUT_LABELREF (STREAM, NAME); \
- fprintf (STREAM, "\n"); \
-} while (0)
-
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.long 0f%.20e\n", (VALUE))
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.bss ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ROUNDED)))
-
- /*
- * Encore assembler can't handle huge string constants like the one in
- * gcc.c. If the default routine in varasm.c were more conservative, this
- * code could be eliminated. It starts a new .ascii directive every 40
- * characters.
- */
-
-#define ASM_OUTPUT_ASCII(file, p, size) \
-do { \
- int i; \
- for (i = 0; i < (size); i++) \
- { \
- register int c = (p)[i]; \
- if ((i / 40) * 40 == i) \
- if (i == 0) \
- fprintf ((file), "\t.ascii \""); \
- else \
- fprintf ((file), "\"\n\t.ascii \""); \
- if (c == '\"' || c == '\\') \
- putc ('\\', (file)); \
- if (c >= ' ' && c < 0177) \
- putc (c, (file)); \
- else \
- { \
- fprintf ((file), "\\%o", c); \
- if (i < (size) - 1 \
- && (p)[i + 1] >= '0' && (p)[i + 1] <= '9')\
- fprintf ((file), "\"\n\t.ascii \""); \
- } \
- } \
- fprintf ((file), "\"\n"); \
-} while (0)
-
-/* Modify syntax of jsr instructions. */
-#define CALL_MEMREF_IMPLICIT
-
-#define NO_ABSOLUTE_PREFIX_IF_SYMBOLIC
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE, X, CODE)
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR)
-
-/* Change the way in which data is allocated and initialized on the
- encore so that both private and shared data are supported. Shared data
- that is initialized must be contained in the ".shrdata" section
- of the program. This is accomplished by defining the SHARED_SECTION_ASM_OP
- macro. Share data that is simply allocated, and not initialized must
- be prefixed with the ".shrcomm" or ".shrbss" pseudo op, for common or
- local data respectively. This is accomplished by redefining the
- ASM_OUTPUT_COMMON and ASM_OUTPUT_LOCAL macros. */
-
-/* Assembler pseudo-op for shared data segment. */
-
-#define SHARED_SECTION_ASM_OP ".shrdata"
-
-/* This says how to output an assembler line
- to define a shared common symbol. */
-
-#define ASM_OUTPUT_SHARED_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".shrcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a shared local symbol. */
-
-#define ASM_OUTPUT_SHARED_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.shrbss ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d,%d\n", (SIZE), (ROUNDED)))
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\taddr .LP%d,r0\n\tjsr mcount\n", (LABELNO))
-
-#define ENCORE_ASM
diff --git a/gcc/config/ns32k/genix.h b/gcc/config/ns32k/genix.h
deleted file mode 100644
index ac84cfcb90c..00000000000
--- a/gcc/config/ns32k/genix.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Definitions of target machine for GNU compiler. Genix ns32000 version.
- Copyright (C) 1987, 1988, 1994 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. */
-
-#include "ns32k/encore.h"
-
-/* We don't want the one Encore needs. */
-#undef ASM_SPEC
-
-/* The following defines override ones in ns32k.h and prevent any attempts
- to explicitly or implicitly make references to the SB register in the GCC
- generated code. It is necessary to avoid such references under Genix V.3.1
- because this OS doesn't even save/restore the SB on context switches! */
-
-#define IS_OK_REG_FOR_BASE_P(X) \
- ( (GET_CODE (X) == REG) && REG_OK_FOR_BASE_P (X) )
-
-#undef INDIRECTABLE_1_ADDRESS_P
-#define INDIRECTABLE_1_ADDRESS_P(X) \
- (CONSTANT_ADDRESS_NO_LABEL_P (X) \
- || IS_OK_REG_FOR_BASE_P (X) \
- || (GET_CODE (X) == PLUS \
- && IS_OK_REG_FOR_BASE_P (XEXP (X, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (X, 1)) ) )
-
-/* Note that for double indirects, only FP, SP, and SB are allowed
- as the inner-most base register. But we are avoiding use of SB. */
-
-#undef MEM_REG
-#define MEM_REG(X) \
- ( (GET_CODE (X) == REG) \
- && ( (REGNO (X) == FRAME_POINTER_REGNUM) \
- || (REGNO (X) == STACK_POINTER_REGNUM) ) )
-
-#undef INDIRECTABLE_2_ADDRESS_P
-#define INDIRECTABLE_2_ADDRESS_P(X) \
- (GET_CODE (X) == MEM \
- && (((xfoo0 = XEXP (X, 0), MEM_REG (xfoo0)) \
- || (GET_CODE (xfoo0) == PLUS \
- && MEM_REG (XEXP (xfoo0, 0)) \
- && CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfoo0, 1)))) \
- || CONSTANT_ADDRESS_NO_LABEL_P (xfoo0)))
-
-/* Go to ADDR if X is a valid address not using indexing.
- (This much is the easy part.) */
-#undef GO_IF_NONINDEXED_ADDRESS
-#define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
-{ register rtx xfoob = (X); \
- if (GET_CODE (xfoob) == REG) goto ADDR; \
- if (INDIRECTABLE_1_ADDRESS_P(X)) goto ADDR; \
- if (CONSTANT_P(X)) goto ADDR; \
- if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \
- if (GET_CODE (X) == PLUS) \
- if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1))) \
- if (INDIRECTABLE_2_ADDRESS_P (XEXP (X, 0))) \
- goto ADDR; \
-}
-
-/* A bug in the GNX 3.X assembler causes references to external symbols to
- be mishandled if the symbol is also used as the name of a function-local
- variable or as the name of a struct or union field. The problem only
- appears when you are also using the -g option so that SDB debugging
- directives are also being produced by GCC. In such cases, the assembler
- gets the external entity confused with the local entity and addressing
- havoc ensues. The solution is to get GCC to produce .global directives
- for all external entities which are actually referenced within the current
- source file. The following macro does this. */
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
- ASM_GLOBALIZE_LABEL(FILE,NAME);
-
-/* Genix wants 0l instead of 0f. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.long 0l%.20e\n", (VALUE))
-
-/* A bug in the GNX 3.X linker prevents symbol-table entries with a storage-
- class field of C_EFCN (-1) from being accepted. */
-
-#ifdef PUT_SDB_EPILOGUE_END
-#undef PUT_SDB_EPILOGUE_END
-#endif
-#define PUT_SDB_EPILOGUE_END(NAME)
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (32000, National syntax)");
-
-/* Same as the encore definition except
- * Different syntax for double constants.
- * Don't output `?' before external regs.
- * Output `(sb)' in certain indirect refs. */
-
-#error this has not been updated since version 1.
-#error it is certainly wrong.
-
-#undef PRINT_OPERAND
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (CODE == '$') putc ('$', FILE); \
- else if (CODE == '?'); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- { \
- rtx xfoo; \
- xfoo = XEXP (X, 0); \
- switch (GET_CODE (xfoo)) \
- { \
- case MEM: \
- if (GET_CODE (XEXP (xfoo, 0)) == REG) \
- if (REGNO (XEXP (xfoo, 0)) == STACK_POINTER_REGNUM) \
- fprintf (FILE, "0(0(sp))"); \
- else fprintf (FILE, "0(0(%s))", \
- reg_names[REGNO (XEXP (xfoo, 0))]); \
- else \
- { \
- extern int paren_base_reg_printed; \
- fprintf (FILE, "0("); \
- paren_base_reg_printed = 0; \
- output_address (xfoo); \
- if (!paren_base_reg_printed) \
- fprintf (FILE, "(sb)"); \
- putc (')', FILE); \
- } \
- break; \
- case REG: \
- fprintf (FILE, "0(%s)", reg_names[REGNO (xfoo)]); \
- break; \
- case PRE_DEC: \
- case POST_INC: \
- fprintf (FILE, "tos"); \
- break; \
- case CONST_INT: \
- fprintf (FILE, "@%d", INTVAL (xfoo)); \
- break; \
- default: \
- output_address (xfoo); \
- break; \
- } \
- } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode) \
- if (GET_MODE (X) == DFmode) \
- { union { double d; int i[2]; } u; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- fprintf (FILE, "$0l%.20e", u.d); } \
- else { union { double d; int i[2]; } u; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- fprintf (FILE, "$0f%.20e", u.d); } \
- else if (GET_CODE (X) == CONST) \
- output_addr_const (FILE, X); \
- else { putc ('$', FILE); output_addr_const (FILE, X); }}
diff --git a/gcc/config/ns32k/merlin.h b/gcc/config/ns32k/merlin.h
deleted file mode 100644
index cf5433cc2f4..00000000000
--- a/gcc/config/ns32k/merlin.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Definitions of target machine for GNU compiler. MERLIN NS32000 version.
- Copyright (C) 1990, 1994 Free Software Foundation, Inc.
- By Mark Mason (mason@reed.bitnet, pyramid!unify!mason@uunet.uu.net).
-
-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. */
-
-/* Two flags to control how addresses are printed in assembler insns. */
-
-#define SEQUENT_ADDRESS_BUG 1
-#define SEQUENT_BASE_REGS
-
-#include "ns32k/ns32k.h"
-
-/* This is BSD, so it wants DBX format. */
-#define DBX_DEBUGGING_INFO
-
-/* Sequent has some changes in the format of DBX symbols. */
-#define DBX_NO_XREFS 1
-
-/* Don't split DBX symbols into continuations. */
-#define DBX_CONTIN_LENGTH 0
-
-#define TARGET_DEFAULT 1
-
-/* Print subsidiary information on the compiler version in use. */
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (32000, UTek syntax)");
-
-/* These control the C++ compiler somehow. */
-#define FASCIST_ASSEMBLER
-#define USE_COLLECT
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dns32000 -Dns32k -Dns16000 -Dmerlin -Dunix -DUtek -Dbsd \
- -Asystem(unix) -Asystem(bsd) -Acpu(ns32k) -Amachine(ns32k)"
-
-/* This is how to align the code that follows an unconditional branch.
- Don't define it, since it confuses the assembler (we hear). */
-
-#undef ASM_OUTPUT_ALIGN_CODE
-
-/* Assembler pseudo-op for shared data segment. */
-#define SHARED_SECTION_ASM_OP ".shdata"
-
-/* %$ means print the prefix for an immediate operand. */
-
-#ifdef UTEK_ASM
-#undef PRINT_OPERAND
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (CODE == '$') putc('$', FILE); \
- else if (CODE == '?'); \
- else if (GET_CODE (X) == CONST_INT) \
- fprintf(FILE, "$%d", INTVAL(X)); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- { \
- rtx xfoo; \
- xfoo = XEXP (X, 0); \
- switch (GET_CODE (xfoo)) \
- { \
- case MEM: \
- if (GET_CODE (XEXP (xfoo, 0)) == REG) \
- if (REGNO (XEXP (xfoo, 0)) == STACK_POINTER_REGNUM) \
- fprintf (FILE, "0(0(sp))"); \
- else fprintf (FILE, "0(0(%s))", \
- reg_names[REGNO (XEXP (xfoo, 0))]); \
- else \
- { \
- if (GET_CODE (XEXP (xfoo, 0)) == SYMBOL_REF \
- || GET_CODE (XEXP (xfoo, 0)) == CONST) \
- { \
- fprintf(FILE, "0("); \
- output_address(xfoo); \
- fprintf(FILE, "(sb))"); \
- } \
- else \
- { \
- fprintf (FILE, "0("); \
- output_address (xfoo); \
- putc (')', FILE); \
- } \
- } \
- break; \
- case REG: \
- fprintf (FILE, "0(%s)", reg_names[REGNO (xfoo)]); \
- break; \
- case PRE_DEC: \
- case POST_INC: \
- fprintf (FILE, "tos"); \
- break; \
- case CONST_INT: \
- fprintf (FILE, "$%d", INTVAL (xfoo)); \
- break; \
- default: \
- output_address (xfoo); \
- break; \
- } \
- } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode) \
- if (GET_MODE (X) == DFmode) \
- { union { double d; int i[2]; } u; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- fprintf (FILE, "$0d%.20e", u.d); } \
- else { union { double d; int i[2]; } u; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- fprintf (FILE, "$0f%.20e", u.d); } \
- else output_addr_const (FILE, X); }
-
-#undef FUNCTION_PROLOGUE
-
-/* This differs from the one in ns32k.h in printing a bitmask
- rather than a register list in the enter or save instruction. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int regno, g_regs_used = 0; \
- int used_regs_buf[8], *bufp = used_regs_buf; \
- int used_fregs_buf[8], *fbufp = used_fregs_buf; \
- extern char call_used_regs[]; \
- MAIN_FUNCTION_PROLOGUE; \
- for (regno = 0; regno < 8; regno++) \
- if (regs_ever_live[regno] \
- && ! call_used_regs[regno]) \
- { \
- *bufp++ = regno; g_regs_used++; \
- } \
- *bufp = -1; \
- for (; regno < 16; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) { \
- *fbufp++ = regno; \
- } \
- *fbufp = -1; \
- bufp = used_regs_buf; \
- if (frame_pointer_needed) \
- fprintf (FILE, "\tenter "); \
- else if (g_regs_used) \
- fprintf (FILE, "\tsave "); \
- if (frame_pointer_needed || g_regs_used) \
- { \
- char mask = 0; \
- while (*bufp >= 0) \
- mask |= 1 << *bufp++; \
- fprintf (FILE, "$0x%x", (int) mask & 0xff); \
- } \
- if (frame_pointer_needed) \
- fprintf (FILE, ",%d\n", SIZE); \
- else if (g_regs_used) \
- fprintf (FILE, "\n"); \
- fbufp = used_fregs_buf; \
- while (*fbufp >= 0) \
- { \
- if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1)) \
- fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8); \
- else \
- { \
- fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8); \
- fbufp += 2; \
- } \
- } \
-}
-
-#undef FUNCTION_EPILOGUE
-
-/* This differs from the one in ns32k.h in printing a bitmask
- rather than a register list in the exit or restore instruction. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ register int regno, g_regs_used = 0, f_regs_used = 0; \
- int used_regs_buf[8], *bufp = used_regs_buf; \
- int used_fregs_buf[8], *fbufp = used_fregs_buf; \
- extern char call_used_regs[]; \
- *fbufp++ = -2; \
- for (regno = 8; regno < 16; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) { \
- *fbufp++ = regno; f_regs_used++; \
- } \
- fbufp--; \
- for (regno = 0; regno < 8; regno++) \
- if (regs_ever_live[regno] \
- && ! call_used_regs[regno]) \
- { \
- *bufp++ = regno; g_regs_used++; \
- } \
- while (fbufp > used_fregs_buf) \
- { \
- if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1) \
- { \
- fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8); \
- fbufp -= 2; \
- } \
- else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8); \
- } \
- if (frame_pointer_needed) \
- fprintf (FILE, "\texit "); \
- else if (g_regs_used) \
- fprintf (FILE, "\trestore "); \
- if (g_regs_used || frame_pointer_needed) \
- { \
- char mask = 0; \
- \
- while (bufp > used_regs_buf) \
- { \
- /* Utek assembler takes care of reversing this */ \
- mask |= 1 << *--bufp; \
- } \
- fprintf (FILE, "$0x%x\n", (int) mask & 0xff); \
- } \
- if (current_function_pops_args) \
- fprintf (FILE, "\tret %d\n", current_function_pops_args); \
- else fprintf (FILE, "\tret 0\n"); }
-
-#endif /* UTEK_ASM */
-
-#undef PRINT_OPERAND_ADDRESS
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR)
diff --git a/gcc/config/ns32k/netbsd.h b/gcc/config/ns32k/netbsd.h
deleted file mode 100644
index 4c7202cff91..00000000000
--- a/gcc/config/ns32k/netbsd.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Configuration for a ns32532 running NetBSD as the target machine.
- Copyright (C) 1988, 1994, 1995, 1996 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.
-
-*/
-
-#include <ns32k/ns32k.h>
-
-/* Compile for the floating point unit & 32532 by default;
- Don't assume SB is zero;
- Don't use bitfield instructions; */
-
-#define TARGET_DEFAULT (1 + 24 + 32 + 64)
-
-/* 32-bit alignment for efficiency */
-
-#undef POINTER_BOUNDARY
-#define POINTER_BOUNDARY 32
-
-/* 32-bit alignment for efficiency */
-
-#undef FUNCTION_BOUNDARY
-#define FUNCTION_BOUNDARY 32
-
-/* 32532 spec says it can handle any alignment. Rumor from tm-ns32k.h
- tells this might not be actually true (but it's for 32032, perhaps
- National has fixed the bug for 32532). You might have to change this
- if the bug still exists. */
-
-#undef STRICT_ALIGNMENT
-#define STRICT_ALIGNMENT 0
-
-/* Use pc relative addressing whenever possible,
- it's more efficient than absolute (ns32k.c)
- You have to fix a bug in gas 1.38.1 to make this work with gas,
- patch available from jkp@cs.hut.fi.
- (NetBSD's gas version has this patch already applied) */
-
-#define PC_RELATIVE
-
-/* Operand of bsr or jsr should be just the address. */
-
-#define CALL_MEMREF_IMPLICIT
-
-/* movd insns may have floating point constant operands. */
-
-#define MOVD_FLOAT_OK
-
-/* Get generic NetBSD definitions. */
-#include <netbsd.h>
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dns32k -Dns32000 -Dns32532 -D__NetBSD__ -Dpc532 -D__ns32k__ -Asystem(unix) -Asystem(NetBSD) -Acpu(ns32k) -Amachine(ns32k)"
-
-/* Make gcc agree with <machine/ansi.h> */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Do not break .stabs pseudos into continuations. */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* This is the char to use for continuation (in case we need to turn
- continuation back on). */
-
-#define DBX_CONTIN_CHAR '?'
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-
-#undef PCC_STATIC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/ns32k/ns32k.c b/gcc/config/ns32k/ns32k.c
deleted file mode 100644
index 0e07662fa31..00000000000
--- a/gcc/config/ns32k/ns32k.c
+++ /dev/null
@@ -1,906 +0,0 @@
-/* Subroutines for assembler code output on the NS32000.
- Copyright (C) 1988, 1994, 1995, 1996 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. */
-
-/* Some output-actions in ns32k.md need these. */
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-
-#ifdef OSF_OS
-int ns32k_num_files = 0;
-#endif
-
-void
-trace (s, s1, s2)
- char *s, *s1, *s2;
-{
- fprintf (stderr, s, s1, s2);
-}
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
-
-int
-hard_regno_mode_ok (regno, mode)
- int regno;
- enum machine_mode mode;
-{
- switch (mode)
- {
- case QImode:
- case HImode:
- case PSImode:
- case SImode:
- case PDImode:
- case VOIDmode:
- case BLKmode:
- if (regno < 8 || regno == 16 || regno == 17)
- return 1;
- else
- return 0;
-
- case DImode:
- if (regno < 8 && (regno & 1) == 0)
- return 1;
- else
- return 0;
-
- case SFmode:
- case SCmode:
- if (TARGET_32081)
- {
- if (regno < 16)
- return 1;
- else
- return 0;
- }
- else
- {
- if (regno < 8)
- return 1;
- else
- return 0;
- }
-
- case DFmode:
- case DCmode:
- if ((regno & 1) == 0)
- {
- if (TARGET_32081)
- {
- if (regno < 16)
- return 1;
- else
- return 0;
- }
- else
- {
- if (regno < 8)
- return 1;
- else
- return 0;
- }
- }
- else
- return 0;
- }
-
- /* Used to abort here, but simply saying "no" handles TImode
- much better. */
- return 0;
-}
-
-/* ADDRESS_COST calls this. This function is not optimal
- for the 32032 & 32332, but it probably is better than
- the default. */
-
-int
-calc_address_cost (operand)
- rtx operand;
-{
- int i;
- int cost = 0;
-
- if (GET_CODE (operand) == MEM)
- cost += 3;
- if (GET_CODE (operand) == MULT)
- cost += 2;
-#if 0
- if (GET_CODE (operand) == REG)
- cost += 1; /* not really, but the documentation
- says different amount of registers
- shouldn't return the same costs */
-#endif
- switch (GET_CODE (operand))
- {
- case REG:
- case CONST:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- case POST_DEC:
- case PRE_DEC:
- break;
- case MULT:
- case MEM:
- case PLUS:
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (operand)); i++)
- {
- cost += calc_address_cost (XEXP (operand, i));
- }
- default:
- break;
- }
- return cost;
-}
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
- NO_REGS is returned. */
-
-enum reg_class
-secondary_reload_class (class, mode, in)
- enum reg_class class;
- enum machine_mode mode;
- rtx in;
-{
- int regno = true_regnum (in);
-
- if (regno >= FIRST_PSEUDO_REGISTER)
- regno = -1;
-
- /* We can place anything into GENERAL_REGS and can put GENERAL_REGS
- into anything. */
- if (class == GENERAL_REGS || (regno >= 0 && regno < 8))
- return NO_REGS;
-
- /* Constants, memory, and FP registers can go into FP registers. */
- if ((regno == -1 || (regno >= 8 && regno < 16)) && (class == FLOAT_REGS))
- return NO_REGS;
-
-#if 0 /* This isn't strictly true (can't move fp to sp or vice versa),
- so it's cleaner to use PREFERRED_RELOAD_CLASS
- to make the right things happen. */
- if (regno >= 16 && class == GEN_AND_MEM_REGS)
- return NO_REGS;
-#endif
-
- /* Otherwise, we need GENERAL_REGS. */
- return GENERAL_REGS;
-}
-/* Generate the rtx that comes from an address expression in the md file */
-/* The expression to be build is BASE[INDEX:SCALE]. To recognize this,
- scale must be converted from an exponent (from ASHIFT) to a
- multiplier (for MULT). */
-rtx
-gen_indexed_expr (base, index, scale)
- rtx base, index, scale;
-{
- rtx addr;
-
- /* This generates an invalid addressing mode, if BASE is
- fp or sp. This is handled by PRINT_OPERAND_ADDRESS. */
- if (GET_CODE (base) != REG && GET_CODE (base) != CONST_INT)
- base = gen_rtx (MEM, SImode, base);
- addr = gen_rtx (MULT, SImode, index,
- gen_rtx (CONST_INT, VOIDmode, 1 << INTVAL (scale)));
- addr = gen_rtx (PLUS, SImode, base, addr);
- return addr;
-}
-
-/* Return 1 if OP is a valid operand of mode MODE. This
- predicate rejects operands which do not have a mode
- (such as CONST_INT which are VOIDmode). */
-int
-reg_or_mem_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_MODE (op) == mode
- && (GET_CODE (op) == REG
- || GET_CODE (op) == SUBREG
- || GET_CODE (op) == MEM));
-}
-
-/* Split one or more DImode RTL references into pairs of SImode
- references. The RTL can be REG, offsettable MEM, integer constant, or
- CONST_DOUBLE. "operands" is a pointer to an array of DImode RTL to
- split and "num" is its length. lo_half and hi_half are output arrays
- that parallel "operands". */
-
-void
-split_di (operands, num, lo_half, hi_half)
- rtx operands[];
- int num;
- rtx lo_half[], hi_half[];
-{
- while (num--)
- {
- if (GET_CODE (operands[num]) == REG)
- {
- lo_half[num] = gen_rtx (REG, SImode, REGNO (operands[num]));
- hi_half[num] = gen_rtx (REG, SImode, REGNO (operands[num]) + 1);
- }
- else if (CONSTANT_P (operands[num]))
- {
- split_double (operands[num], &lo_half[num], &hi_half[num]);
- }
- else if (offsettable_memref_p (operands[num]))
- {
- lo_half[num] = operands[num];
- hi_half[num] = adj_offsettable_operand (operands[num], 4);
- }
- else
- abort();
- }
-}
-
-/* Return the best assembler insn template
- for moving operands[1] into operands[0] as a fullword. */
-
-static char *
-singlemove_string (operands)
- rtx *operands;
-{
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) <= 7
- && INTVAL (operands[1]) >= -8)
- return "movqd %1,%0";
- return "movd %1,%0";
-}
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum anon1 { REGOP, OFFSOP, PUSHOP, CNSTOP, RNDOP } optype0, optype1;
- rtx latehalf[2];
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- optype0 = PUSHOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1])
- || GET_CODE (operands[1]) == CONST_DOUBLE)
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- optype1 = PUSHOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP)
- abort ();
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first,
- but if either operand is autodecrementing then we
- do the high-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], 4);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- else if (optype1 == CNSTOP)
- split_double (operands[1], &operands[1], &latehalf[1]);
- else
- latehalf[1] = operands[1];
-
- /* If insn is effectively movd N(sp),tos then we will do the
- high word first. We should use the adjusted operand 1 (which is N+4(sp))
- for the low word as well, to compensate for the first decrement of sp.
- Given this, it doesn't matter which half we do "first". */
- if (optype0 == PUSHOP
- && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM
- && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1]))
- operands[1] = latehalf[1];
-
- /* If one or both operands autodecrementing,
- do the two words, high-numbered first. */
- else if (optype0 == PUSHOP || optype1 == PUSHOP)
- {
- output_asm_insn (singlemove_string (latehalf), latehalf);
- return singlemove_string (operands);
- }
-
- /* If the first move would clobber the source of the second one,
- do them in the other order. */
-
- /* Overlapping registers. */
- if (optype0 == REGOP && optype1 == REGOP
- && REGNO (operands[0]) == REGNO (latehalf[1]))
- {
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
- /* Do low-numbered word. */
- return singlemove_string (operands);
- }
- /* Loading into a register which overlaps a register used in the address. */
- else if (optype0 == REGOP && optype1 != REGOP
- && reg_overlap_mentioned_p (operands[0], operands[1]))
- {
- if (reg_mentioned_p (operands[0], XEXP (operands[1], 0))
- && reg_mentioned_p (latehalf[0], XEXP (operands[1], 0)))
- {
- /* If both halves of dest are used in the src memory address,
- load the destination address into the low reg (operands[0]).
- Then it works to load latehalf first. */
- rtx xops[2];
- xops[0] = XEXP (operands[1], 0);
- xops[1] = operands[0];
- output_asm_insn ("addr %a0,%1", xops);
- operands[1] = gen_rtx (MEM, DImode, operands[0]);
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- /* The first half has the overlap, Do the late half first. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
- /* Then clobber. */
- return singlemove_string (operands);
- }
- if (reg_mentioned_p (operands[0], XEXP (operands[1], 0)))
- {
- /* The first half has the overlap, Do the late half first. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
- /* Then clobber. */
- return singlemove_string (operands);
- }
- }
-
- /* Normal case. Do the two words, low-numbered first. */
-
- output_asm_insn (singlemove_string (operands), operands);
-
- operands[0] = latehalf[0];
- operands[1] = latehalf[1];
- return singlemove_string (operands);
-}
-
-int
-check_reg (oper, reg)
- rtx oper;
- int reg;
-{
- register int i;
-
- if (oper == 0)
- return 0;
- switch (GET_CODE(oper))
- {
- case REG:
- return (REGNO(oper) == reg) ? 1 : 0;
- case MEM:
- return check_reg(XEXP(oper, 0), reg);
- case PLUS:
- case MULT:
- return check_reg(XEXP(oper, 0), reg) || check_reg(XEXP(oper, 1), reg);
- }
- return 0;
-}
-
-/* Returns 1 if OP contains a global symbol reference */
-
-int
-global_symbolic_reference_mentioned_p (op, f)
- rtx op;
- int f;
-{
- register char *fmt;
- register int i;
-
- if (GET_CODE (op) == SYMBOL_REF)
- {
- if (! SYMBOL_REF_FLAG (op))
- return 1;
- else
- return 0;
- }
- else if (f && GET_CODE (op) != CONST)
- return 0;
-
- fmt = GET_RTX_FORMAT (GET_CODE (op));
- for (i = GET_RTX_LENGTH (GET_CODE (op)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
-
- for (j = XVECLEN (op, i) - 1; j >= 0; j--)
- if (global_symbolic_reference_mentioned_p (XVECEXP (op, i, j), 0))
- return 1;
- }
- else if (fmt[i] == 'e'
- && global_symbolic_reference_mentioned_p (XEXP (op, i), 0))
- return 1;
- }
-
- return 0;
-}
-
-
-/* PRINT_OPERAND is defined to call this function,
- which is easier to debug than putting all the code in
- a macro definition in ns32k.h. */
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- char code;
-{
- if (code == '$')
- PUT_IMMEDIATE_PREFIX (file);
- else if (code == '?')
- PUT_EXTERNAL_PREFIX (file);
- else if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x)]);
- else if (GET_CODE (x) == MEM)
- {
- rtx tmp = XEXP (x, 0);
- output_address (XEXP (x, 0));
- }
- else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) != VOIDmode)
- {
- if (GET_MODE (x) == DFmode)
- {
- union { double d; int i[2]; } u;
- u.i[0] = CONST_DOUBLE_LOW (x); u.i[1] = CONST_DOUBLE_HIGH (x);
- PUT_IMMEDIATE_PREFIX(file);
-#ifdef SEQUENT_ASM
- /* Sequent likes it's floating point constants as integers */
- fprintf (file, "0Dx%08x%08x", u.i[1], u.i[0]);
-#else
-#ifdef ENCORE_ASM
- fprintf (file, "0f%.20e", u.d);
-#else
- fprintf (file, "0d%.20e", u.d);
-#endif
-#endif
- }
- else
- {
- union { double d; int i[2]; } u;
- u.i[0] = CONST_DOUBLE_LOW (x); u.i[1] = CONST_DOUBLE_HIGH (x);
- PUT_IMMEDIATE_PREFIX (file);
-#ifdef SEQUENT_ASM
- /* We have no way of winning if we can't get the bits
- for a sequent floating point number. */
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
- abort ();
-#endif
- {
- union { float f; long l; } uu;
- uu.f = u.d;
- fprintf (file, "0Fx%08x", uu.l);
- }
-#else
- fprintf (file, "0f%.20e", u.d);
-#endif
- }
- }
- else
- {
-#ifdef NO_IMMEDIATE_PREFIX_IF_SYMBOLIC
- if (GET_CODE (x) == CONST_INT)
-#endif
- PUT_IMMEDIATE_PREFIX (file);
- output_addr_const (file, x);
- }
-}
-
-/* PRINT_OPERAND_ADDRESS is defined to call this function,
- which is easier to debug than putting all the code in
- a macro definition in ns32k.h . */
-
-/* Completely rewritten to get this to work with Gas for PC532 Mach.
- This function didn't work and I just wasn't able (nor very willing) to
- figure out how it worked.
- 90-11-25 Tatu Yl|nen <ylo@cs.hut.fi> */
-
-print_operand_address (file, addr)
- register FILE *file;
- register rtx addr;
-{
- static char scales[] = { 'b', 'w', 'd', 0, 'q', };
- rtx offset, base, indexexp, tmp;
- int scale;
- extern int flag_pic;
-
- if (GET_CODE (addr) == PRE_DEC || GET_CODE (addr) == POST_DEC)
- {
- fprintf (file, "tos");
- return;
- }
-
- offset = NULL;
- base = NULL;
- indexexp = NULL;
- while (addr != NULL)
- {
- if (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == PLUS)
- {
- tmp = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else
- {
- tmp = XEXP (addr,0);
- addr = XEXP (addr,1);
- }
- }
- else
- {
- tmp = addr;
- addr = NULL;
- }
- switch (GET_CODE (tmp))
- {
- case PLUS:
- abort ();
- case MEM:
- if (base)
- {
- indexexp = base;
- base = tmp;
- }
- else
- base = tmp;
- break;
- case REG:
- if (REGNO (tmp) < 8)
- if (base)
- {
- indexexp = tmp;
- }
- else
- base = tmp;
- else
- if (base)
- {
- indexexp = base;
- base = tmp;
- }
- else
- base = tmp;
- break;
- case MULT:
- indexexp = tmp;
- break;
- case SYMBOL_REF:
- if (flag_pic && ! CONSTANT_POOL_ADDRESS_P (tmp)
- && ! SYMBOL_REF_FLAG (tmp))
- {
- if (base)
- {
- if (indexexp)
- abort ();
- indexexp = base;
- }
- base = tmp;
- break;
- }
- case CONST:
- if (flag_pic && GET_CODE (tmp) == CONST)
- {
- rtx sym, off, tmp1;
- tmp1 = XEXP (tmp,0);
- if (GET_CODE (tmp1) != PLUS)
- abort ();
-
- sym = XEXP (tmp1,0);
- if (GET_CODE (sym) != SYMBOL_REF)
- {
- off = sym;
- sym = XEXP (tmp1,1);
- }
- else
- off = XEXP (tmp1,1);
- if (GET_CODE (sym) == SYMBOL_REF)
- {
- if (GET_CODE (off) != CONST_INT)
- abort ();
-
- if (CONSTANT_POOL_ADDRESS_P (sym)
- || SYMBOL_REF_FLAG (sym))
- {
- SYMBOL_REF_FLAG (tmp) = 1;
- }
- else
- {
- if (base)
- {
- if (indexexp)
- abort ();
-
- indexexp = base;
- }
-
- if (offset != 0)
- abort ();
-
- base = sym;
- offset = off;
- break;
- }
- }
- }
- case CONST_INT:
- case LABEL_REF:
- if (offset)
- offset = gen_rtx (PLUS, SImode, tmp, offset);
- else
- offset = tmp;
- break;
- default:
- abort ();
- }
- }
- if (! offset)
- offset = const0_rtx;
-
- if (base
-#ifndef INDEX_RATHER_THAN_BASE
- && (flag_pic || TARGET_HIMEM)
- && GET_CODE (base) != SYMBOL_REF
- && GET_CODE (offset) != CONST_INT
-#else
- /* This is a re-implementation of the SEQUENT_ADDRESS_BUG fix. */
-#endif
- && !indexexp && GET_CODE (base) == REG
- && REG_OK_FOR_INDEX_P (base))
- {
- indexexp = base;
- base = NULL;
- }
-
- /* now, offset, base and indexexp are set */
-#ifndef BASE_REG_NEEDED
- if (! base)
- {
-#if defined (PC_RELATIVE) || defined (NO_ABSOLUTE_PREFIX_IF_SYMBOLIC)
- if (GET_CODE (offset) == CONST_INT)
-#endif
- PUT_ABSOLUTE_PREFIX (file);
- }
-#endif
-
- output_addr_const (file, offset);
- if (base) /* base can be (REG ...) or (MEM ...) */
- switch (GET_CODE (base))
- {
- /* now we must output base. Possible alternatives are:
- (rN) (REG ...)
- (sp) (REG ...)
- (fp) (REG ...)
- (pc) (REG ...) used for SYMBOL_REF and LABEL_REF, output
- (disp(fp)) (MEM ...) just before possible [rX:y]
- (disp(sp)) (MEM ...)
- (disp(sb)) (MEM ...)
- */
- case REG:
- fprintf (file, "(%s)", reg_names[REGNO (base)]);
- break;
- case SYMBOL_REF:
- if (! flag_pic)
- abort ();
-
- fprintf (file, "(");
- output_addr_const (file, base);
- fprintf (file, "(sb))");
- break;
- case MEM:
- addr = XEXP(base,0);
- base = NULL;
- offset = NULL;
- while (addr != NULL)
- {
- if (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == PLUS)
- {
- tmp = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else
- {
- tmp = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- }
- else
- {
- tmp = addr;
- addr = NULL;
- }
- switch (GET_CODE (tmp))
- {
- case REG:
- base = tmp;
- break;
- case CONST:
- case CONST_INT:
- case SYMBOL_REF:
- case LABEL_REF:
- if (offset)
- offset = gen_rtx (PLUS, SImode, tmp, offset);
- else
- offset = tmp;
- break;
- default:
- abort ();
- }
- }
- if (! offset)
- offset = const0_rtx;
- fprintf (file, "(");
- output_addr_const (file, offset);
- if (base)
- fprintf (file, "(%s)", reg_names[REGNO (base)]);
- else if (TARGET_SB)
- fprintf (file, "(sb)");
- else
- abort ();
- fprintf (file, ")");
- break;
- default:
- abort ();
- }
-#ifdef PC_RELATIVE
- else if (GET_CODE (offset) != CONST_INT)
- fprintf (file, "(pc)");
-#ifdef BASE_REG_NEEDED
- else if (TARGET_SB)
- fprintf (file, "(sb)");
- else
- abort ();
-#endif
-#endif /* PC_RELATIVE */
-
- /* now print index if we have one */
- if (indexexp)
- {
- if (GET_CODE (indexexp) == MULT)
- {
- scale = INTVAL (XEXP (indexexp, 1)) >> 1;
- indexexp = XEXP (indexexp, 0);
- }
- else
- scale = 0;
- if (GET_CODE (indexexp) != REG || REGNO (indexexp) >= 8)
- abort ();
-
-#ifdef UTEK_ASM
- fprintf (file, "[%c`%s]",
- scales[scale],
- reg_names[REGNO (indexexp)]);
-#else
- fprintf (file, "[%s:%c]",
- reg_names[REGNO (indexexp)],
- scales[scale]);
-#endif
- }
-}
-
-/* National 32032 shifting is so bad that we can get
- better performance in many common cases by using other
- techniques. */
-char *
-output_shift_insn (operands)
- rtx *operands;
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) > 0
- && INTVAL (operands[2]) <= 3)
- if (GET_CODE (operands[0]) == REG)
- {
- if (GET_CODE (operands[1]) == REG)
- {
- if (REGNO (operands[0]) == REGNO (operands[1]))
- {
- if (operands[2] == const1_rtx)
- return "addd %0,%0";
- else if (INTVAL (operands[2]) == 2)
- return "addd %0,%0\n\taddd %0,%0";
- }
- if (operands[2] == const1_rtx)
- return "movd %1,%0\n\taddd %0,%0";
-
- operands[1] = gen_indexed_expr (const0_rtx, operands[1], operands[2]);
- return "addr %a1,%0";
- }
- if (operands[2] == const1_rtx)
- return "movd %1,%0\n\taddd %0,%0";
- }
- else if (GET_CODE (operands[1]) == REG)
- {
- operands[1] = gen_indexed_expr (const0_rtx, operands[1], operands[2]);
- return "addr %a1,%0";
- }
- else if (INTVAL (operands[2]) == 1
- && GET_CODE (operands[1]) == MEM
- && rtx_equal_p (operands [0], operands[1]))
- {
- rtx temp = XEXP (operands[1], 0);
-
- if (GET_CODE (temp) == REG
- || (GET_CODE (temp) == PLUS
- && GET_CODE (XEXP (temp, 0)) == REG
- && GET_CODE (XEXP (temp, 1)) == CONST_INT))
- return "addd %0,%0";
- }
- else return "ashd %2,%0";
- return "ashd %2,%0";
-}
-
-char *
-output_move_dconst (n, s)
- int n;
- char *s;
-{
- static char r[32];
-
- if (n > -9 && n < 8)
- strcpy (r, "movqd ");
- else if (n > 0 && n < 256)
- strcpy (r, "movzbd ");
- else if (n > 0 && n < 65536)
- strcpy (r, "movzwd ");
- else if (n < 0 && n > -129)
- strcpy (r, "movxbd ");
- else if (n < 0 && n > -32769)
- strcpy (r, "movxwd ");
- else
- strcpy (r, "movd ");
- strcat (r, s);
- return r;
-}
diff --git a/gcc/config/ns32k/ns32k.h b/gcc/config/ns32k/ns32k.h
deleted file mode 100644
index 70cd9f201ae..00000000000
--- a/gcc/config/ns32k/ns32k.h
+++ /dev/null
@@ -1,1477 +0,0 @@
-/* Definitions of target machine for GNU compiler. NS32000 version.
- Copyright (C) 1988, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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. */
-
-
-/* Note that some other tm.h files include this one and then override
- many of the definitions that relate to assembler syntax. */
-
-extern enum reg_class secondary_reload_class();
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dns32000 -Dunix -Asystem(unix) -Acpu(ns32k) -Amachine(ns32k)"
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION fprintf (stderr, " (32000, GAS syntax)");
-
-
-/* ABSOLUTE PREFIX, IMMEDIATE_PREFIX and EXTERNAL_PREFIX can be defined
- to cover most NS32k addressing syntax variations. This way we don't
- need to redefine long macros in all the tm.h files for just slight
- variations in assembler syntax. */
-
-#ifndef ABSOLUTE_PREFIX
-#define ABSOLUTE_PREFIX '@'
-#endif
-
-#if defined(IMMEDIATE_PREFIX) && IMMEDIATE_PREFIX
-#define PUT_IMMEDIATE_PREFIX(FILE) putc(IMMEDIATE_PREFIX, FILE)
-#else
-#define PUT_IMMEDIATE_PREFIX(FILE)
-#endif
-#if defined(ABSOLUTE_PREFIX) && ABSOLUTE_PREFIX
-#define PUT_ABSOLUTE_PREFIX(FILE) putc(ABSOLUTE_PREFIX, FILE)
-#else
-#define PUT_ABSOLUTE_PREFIX(FILE)
-#endif
-#if defined(EXTERNAL_PREFIX) && EXTERNAL_PREFIX
-#define PUT_EXTERNAL_PREFIX(FILE) putc(EXTERNAL_PREFIX, FILE)
-#else
-#define PUT_EXTERNAL_PREFIX(FILE)
-#endif
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Compile 32081 insns for floating point (not library calls). */
-#define TARGET_32081 (target_flags & 1)
-
-/* Compile using rtd insn calling sequence.
- This will not work unless you use prototypes at least
- for all functions that can take varying numbers of args. */
-#define TARGET_RTD (target_flags & 2)
-
-/* Compile passing first two args in regs 0 and 1. */
-#define TARGET_REGPARM (target_flags & 4)
-
-/* Options to select type of CPU, for better optimization.
- The output is correct for any kind of 32000 regardless of these options. */
-#define TARGET_32532 (target_flags & 8)
-#define TARGET_32332 (target_flags & 16)
-
-/* Ok to use the static base register (and presume it's 0) */
-#define TARGET_SB ((target_flags & 32) == 0)
-#define TARGET_HIMEM (target_flags & 128)
-
-/* Compile using bitfield insns. */
-#define TARGET_BITFIELD ((target_flags & 64) == 0)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { { "32081", 1}, \
- { "soft-float", -1}, \
- { "rtd", 2}, \
- { "nortd", -2}, \
- { "regparm", 4}, \
- { "noregparm", -4}, \
- { "32532", 24}, \
- { "32332", -8}, \
- { "32332", 16}, \
- { "32032", -24}, \
- { "sb", -32}, \
- { "nosb", 32}, \
- { "bitfield", -64}, \
- { "nobitfield", 64}, \
- { "himem", 128}, \
- { "nohimem", -128}, \
- { "", TARGET_DEFAULT}}
-/* TARGET_DEFAULT is defined in encore.h, pc532.h, etc. */
-
-/* When we are generating PIC, the sb is used as a pointer
- to the GOT. */
-
-#define OVERRIDE_OPTIONS \
-{ \
- if (flag_pic || TARGET_HIMEM) target_flags |= 32; \
-}
-
-
-/* target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is not true on the ns32k. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is not true on the ns32k. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is lowest
- numbered. This is not true on the ns32k. */
-#define WORDS_BIG_ENDIAN 0
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 32000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 16
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. National claims that the NS32032
- works without strict alignment, but rumor has it that operands
- crossing a page boundary cause unpredictable results. */
-#define STRICT_ALIGNMENT 1
-
-/* If bit field type is int, dont let it cross an int,
- and give entire struct the alignment of an int. */
-/* Required on the 386 since it doesn't have a full set of bitfield insns.
- (There is no signed extv insn.) */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-#define FIRST_PSEUDO_REGISTER 18
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the ns32k, these are the FP, SP, (SB and PC are not included here). */
-#define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS {1, 1, 1, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 0, 0, 0, 0, \
- 1, 1}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
- On the ns32k, all registers are 32 bits long. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok (REGNO, MODE)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (((MODE1) == DFmode || (MODE1) == DCmode || (MODE1) == DImode) == \
- ((MODE2) == DFmode || (MODE2) == DCmode || (MODE2) == DImode))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* NS32000 pc is not overloaded on a register. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 17
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 16
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 0
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 16
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 1
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 2
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, GEN_AND_FP_REGS,
- FRAME_POINTER_REG, STACK_POINTER_REG,
- GEN_AND_MEM_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "GEN_AND_FP_REGS", \
- "FRAME_POINTER_REG", "STACK_POINTER_REG", "GEN_AND_MEM_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS {0, 0x00ff, 0xff00, 0xffff, \
- 0x10000, 0x20000, 0x300ff, 0x3ffff }
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) < 8 ? GENERAL_REGS \
- : (REGNO) < 16 ? FLOAT_REGS \
- : (REGNO) == 16 ? FRAME_POINTER_REG \
- : (REGNO) == 17 ? STACK_POINTER_REG \
- : NO_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GEN_AND_MEM_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'f' ? FLOAT_REGS \
- : (C) == 'x' ? FRAME_POINTER_REG \
- : (C) == 'y' ? STACK_POINTER_REG \
- : NO_REGS)
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- On the ns32k, these letters are used as follows:
-
- I : Matches integers which are valid shift amounts for scaled indexing.
- These are 0, 1, 2, 3 for byte, word, double, and quadword.
- Used for matching arithmetic shifts only on 32032 & 32332.
- J : Matches integers which fit a "quick" operand.
- K : Matches integers 0 to 7 (for inss and exts instructions).
- */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((VALUE) < 8 && (VALUE) + 8 >= 0 ? \
- ((C) == 'I' ? (!TARGET_32532 && 0 <= (VALUE) && (VALUE) <= 3) : \
- (C) == 'J' ? (VALUE) <= 7 : \
- (C) == 'K' ? 0 <= (VALUE) : 0) : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-/* We return GENERAL_REGS instead of GEN_AND_MEM_REGS.
- The latter offers no real additional possibilities
- and can cause spurious secondary reloading. */
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- ((CLASS) == GEN_AND_MEM_REGS ? GENERAL_REGS : (CLASS))
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On the 32000, this is the size of MODE in words */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On the 32000, sp@- in a byte insn really pushes a BYTE. */
-#define PUSH_ROUNDING(BYTES) (BYTES)
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 8
-
-/* Value is the number of byte of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the 32000, the RET insn may be used to pop them if the number
- of args is fixed, but if the number is variable then the caller
- must pop them all. RET can't be used for library calls now
- because the library is compiled with the Unix compiler.
- Use of RET is a selectable option, since it is incompatible with
- standard Unix calling sequences. If the option is not selected,
- the caller must always pop the args. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((TARGET_RTD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE) \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) \
- ? (SIZE) : 0)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On the 32000 the return value is in R0,
- or perhaps in F0 is there is fp support. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_32081 \
- ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
- : gen_rtx (REG, TYPE_MODE (VALTYPE), 0))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-/* On the 32000 the return value is in R0,
- or perhaps F0 is there is fp support. */
-
-#define LIBCALL_VALUE(MODE) \
- (((MODE) == DFmode || (MODE) == SFmode) && TARGET_32081 \
- ? gen_rtx (REG, MODE, 8) \
- : gen_rtx (REG, MODE, 0))
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-#define PCC_STATIC_STRUCT_RETURN
-
-/* 1 if N is a possible register number for a function value.
- On the 32000, R0 and F0 are the only registers thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) (((N) & ~8) == 0)
-
-/* 1 if N is a possible register number for function argument passing.
- On the 32000, no registers are used in this way. */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the ns32k, this is a single integer, which is a number of bytes
- of arguments scanned so far. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the ns32k, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the 32000 all args are pushed, except if -mregparm is specified
- then the first two words of arguments are passed in r0, r1.
- *NOTE* -mregparm does not work.
- It exists only to test register calling conventions. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-((TARGET_REGPARM && (CUM) < 8) ? gen_rtx (REG, (MODE), (CUM) / 4) : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
-((TARGET_REGPARM && (CUM) < 8 \
- && 8 < ((CUM) + ((MODE) == BLKmode \
- ? int_size_in_bytes (TYPE) \
- : GET_MODE_SIZE (MODE)))) \
- ? 2 - (CUM) / 4 : 0)
-
-#ifndef MAIN_FUNCTION_PROLOGUE
-#define MAIN_FUNCTION_PROLOGUE
-#endif
-
-/*
- * The function prologue for the ns32k is fairly simple.
- * If a frame pointer is needed (decided in reload.c ?) then
- * we need assembler of the form
- *
- * # Save the oldframe pointer, set the new frame pointer, make space
- * # on the stack and save any general purpose registers necessary
- *
- * enter [<general purpose regs to save>], <local stack space>
- *
- * movf fn, tos # Save any floating point registers necessary
- * .
- * .
- *
- * If a frame pointer is not needed we need assembler of the form
- *
- * # Make space on the stack
- *
- * adjspd <local stack space + 4>
- *
- * # Save any general purpose registers necessary
- *
- * save [<general purpose regs to save>]
- *
- * movf fn, tos # Save any floating point registers necessary
- * .
- * .
- */
-#if defined(IMMEDIATE_PREFIX) && IMMEDIATE_PREFIX
-#define ADJSP(FILE, n) \
- fprintf (FILE, "\tadjspd %c%d\n", IMMEDIATE_PREFIX, (n))
-#else
-#define ADJSP(FILE, n) \
- fprintf (FILE, "\tadjspd %d\n", (n))
-#endif
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int regno, g_regs_used = 0; \
- int used_regs_buf[8], *bufp = used_regs_buf; \
- int used_fregs_buf[8], *fbufp = used_fregs_buf; \
- extern char call_used_regs[]; \
- extern int current_function_uses_pic_offset_table, flag_pic; \
- MAIN_FUNCTION_PROLOGUE; \
- for (regno = 0; regno < 8; regno++) \
- if (regs_ever_live[regno] \
- && ! call_used_regs[regno]) \
- { \
- *bufp++ = regno; g_regs_used++; \
- } \
- *bufp = -1; \
- for (; regno < 16; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- { \
- *fbufp++ = regno; \
- } \
- *fbufp = -1; \
- bufp = used_regs_buf; \
- if (frame_pointer_needed) \
- fprintf (FILE, "\tenter ["); \
- else \
- { \
- if (SIZE) \
- ADJSP (FILE, SIZE + 4); \
- if (g_regs_used && g_regs_used > 4) \
- fprintf (FILE, "\tsave ["); \
- else \
- { \
- while (*bufp >= 0) \
- fprintf (FILE, "\tmovd r%d,tos\n", *bufp++); \
- g_regs_used = 0; \
- } \
- } \
- while (*bufp >= 0) \
- { \
- fprintf (FILE, "r%d", *bufp++); \
- if (*bufp >= 0) \
- fputc (',', FILE); \
- } \
- if (frame_pointer_needed) \
- fprintf (FILE, "],%d\n", SIZE); \
- else if (g_regs_used) \
- fprintf (FILE, "]\n"); \
- fbufp = used_fregs_buf; \
- while (*fbufp >= 0) \
- { \
- if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1)) \
- fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8); \
- else \
- { \
- fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8); \
- fbufp += 2; \
- } \
- } \
- if (flag_pic && current_function_uses_pic_offset_table) \
- { \
- fprintf (FILE, "\tsprd sb,tos\n"); \
- if (TARGET_REGPARM) \
- { \
- fprintf (FILE, "\taddr __GLOBAL_OFFSET_TABLE_(pc),tos\n"); \
- fprintf (FILE, "\tlprd sb,tos\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\taddr __GLOBAL_OFFSET_TABLE_(pc),r0\n"); \
- fprintf (FILE, "\tlprd sb,r0\n"); \
- } \
- } \
-}
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry.
-
- THIS DEFINITION FOR THE 32000 IS A GUESS. IT HAS NOT BEEN TESTED. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\taddr LP%d,r0\n\tbsr mcount\n", (LABELNO))
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero.
-
- We use 0, because using 1 requires hair in FUNCTION_EPILOGUE
- that is worse than the stack adjust we could save. */
-
-/* #define EXIT_IGNORE_STACK 1 */
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer,
- if EXIT_IGNORE_STACK is nonzero. That doesn't apply here.
-
- If a frame pointer is needed (decided in reload.c ?) then
- we need assembler of the form
-
- movf tos, fn # Restore any saved floating point registers
- .
- .
-
- # Restore any saved general purpose registers, restore the stack
- # pointer from the frame pointer, restore the old frame pointer.
- exit [<general purpose regs to save>]
-
- If a frame pointer is not needed we need assembler of the form
- # Restore any general purpose registers saved
-
- movf tos, fn # Restore any saved floating point registers
- .
- .
- .
- restore [<general purpose regs to save>]
-
- # reclaim space allocated on stack
-
- adjspd <-(local stack space + 4)> */
-
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ register int regno, g_regs_used = 0, f_regs_used = 0; \
- int used_regs_buf[8], *bufp = used_regs_buf; \
- int used_fregs_buf[8], *fbufp = used_fregs_buf; \
- extern char call_used_regs[]; \
- extern int current_function_uses_pic_offset_table, flag_pic; \
- if (flag_pic && current_function_uses_pic_offset_table) \
- fprintf (FILE, "\tlprd sb,tos\n"); \
- *fbufp++ = -2; \
- for (regno = 8; regno < 16; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- { \
- *fbufp++ = regno; f_regs_used++; \
- } \
- fbufp--; \
- for (regno = 0; regno < 8; regno++) \
- if (regs_ever_live[regno] \
- && ! call_used_regs[regno]) \
- { \
- *bufp++ = regno; g_regs_used++; \
- } \
- while (fbufp > used_fregs_buf) \
- { \
- if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1) \
- { \
- fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8); \
- fbufp -= 2; \
- } \
- else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8); \
- } \
- if (frame_pointer_needed) \
- fprintf (FILE, "\texit ["); \
- else \
- { \
- if (g_regs_used && g_regs_used > 4) \
- fprintf (FILE, "\trestore ["); \
- else \
- { \
- while (bufp > used_regs_buf) \
- fprintf (FILE, "\tmovd tos,r%d\n", *--bufp); \
- g_regs_used = 0; \
- } \
- } \
- while (bufp > used_regs_buf) \
- { \
- fprintf (FILE, "r%d", *--bufp); \
- if (bufp > used_regs_buf) \
- fputc (',', FILE); \
- } \
- if (g_regs_used || frame_pointer_needed) \
- fprintf (FILE, "]\n"); \
- if (SIZE && !frame_pointer_needed) \
- ADJSP (FILE, -(SIZE + 4)); \
- if (current_function_pops_args) \
- fprintf (FILE, "\tret %d\n", current_function_pops_args); \
- else fprintf (FILE, "\tret 0\n"); }
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
-{ \
- int regno; \
- int offset = -4; \
- extern int current_function_uses_pic_offset_table, flag_pic; \
- for (regno = 0; regno < 16; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 4; \
- if (flag_pic && current_function_uses_pic_offset_table) \
- offset += 4; \
- (DEPTH) = (offset + get_frame_size () \
- + (get_frame_size () == 0 ? 0 : 4)); \
-}
-
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On the 32k, the trampoline looks like this:
- addr 0(pc),r2
- jump @__trampoline
- .int STATIC
- .int FUNCTION
-Doing trampolines with a library assist function is easier than figuring
-out how to do stores to memory in reverse byte order (the way immediate
-operands on the 32k are stored). */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\taddr 0(pc),r2\n" ); \
- fprintf (FILE, "\tjump " ); \
- PUT_ABSOLUTE_PREFIX (FILE); \
- fprintf (FILE, "__trampoline\n" ); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 20
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 12)), CXT); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 16)), FNADDR); \
-}
-
-/* This is the library routine that is used
- to transfer control from the trampoline
- to the actual nested function. */
-
-/* The function name __transfer_from_trampoline is not actually used.
- The function definition just permits use of "asm with operands"
- (though the operand list is empty). */
-#define TRANSFER_FROM_TRAMPOLINE \
-void \
-__transfer_from_trampoline () \
-{ \
- asm (".globl __trampoline"); \
- asm ("__trampoline:"); \
- asm ("movd 16(r2),tos"); \
- asm ("movd 12(r2),r1"); \
- asm ("ret 0"); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-/* note that FP and SP cannot be used as an index. What about PC? */
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
-((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8)
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-((REGNO) < 8 || (unsigned)reg_renumber[REGNO] < 8 \
- || (REGNO) == FRAME_POINTER_REGNUM || (REGNO) == STACK_POINTER_REGNUM)
-
-#define FP_REG_P(X) (GET_CODE (X) == REG && REGNO (X) > 7 && REGNO (X) < 16)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address.
- This might not work on future ns32k processors as negative
- displacements are not officially allowed but a mode reserved
- to National. This works on processors up to 32532, though. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST \
- || (GET_CODE (X) == CONST_INT \
- && ((unsigned)INTVAL (X) >= 0xe0000000 \
- || (unsigned)INTVAL (X) < 0x20000000)))
-
-#define CONSTANT_ADDRESS_NO_LABEL_P(X) \
- (GET_CODE (X) == CONST_INT \
- && ((unsigned)INTVAL (X) >= 0xe0000000 \
- || (unsigned)INTVAL (X) < 0x20000000))
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
- NO_REGS is returned. */
-
-#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
- secondary_reload_class (CLASS, MODE, IN)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) \
- (REGNO (X) < 8 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-/* Nonzero if X is a hard reg that can be used as a base reg
- of if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) (REGNO (X) < 8 || REGNO (X) >= FRAME_POINTER_REGNUM)
-/* Nonzero if X is a floating point reg or a pseudo reg. */
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
-
-/* 1 if X is an address that we could indirect through. */
-/***** NOTE ***** There is a bug in the Sequent assembler which fails
- to fixup addressing information for symbols used as offsets
- from registers which are not FP or SP (or SB or PC). This
- makes _x(fp) valid, while _x(r0) is invalid. */
-
-#define INDIRECTABLE_1_ADDRESS_P(X) \
- (CONSTANT_ADDRESS_P (X) \
- || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && ((flag_pic || TARGET_HIMEM) ? \
- CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1)) \
- : \
- CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- && (GET_CODE (X) != CONST_INT || NS32K_DISPLACEMENT_P (INTVAL (X)))))
-
-/* 1 if integer I will fit in a 4 byte displacement field.
- Strictly speaking, we can't be sure that a symbol will fit this range.
- But, in practice, it always will. */
-
-/* idall@eleceng.adelaide.edu.au says that the 32016 and 32032
- can handle the full range of displacements--it is only the addresses
- that have a limited range. So the following was deleted:
- (((i) <= 16777215 && (i) >= -16777216)
- || ((TARGET_32532 || TARGET_32332) && ...)) */
-#define NS32K_DISPLACEMENT_P(i) \
- ((i) < (1 << 29) && (i) >= - (1 << 29))
-
-/* Check for frame pointer or stack pointer. */
-#define MEM_REG(X) \
- (GET_CODE (X) == REG && (REGNO (X) ^ 16) < 2)
-
-/* A memory ref whose address is the FP or SP, with optional integer offset,
- or (on certain machines) a constant address. */
-#define INDIRECTABLE_2_ADDRESS_P(X) \
- (GET_CODE (X) == MEM \
- && (((xfoo0 = XEXP (X, 0), MEM_REG (xfoo0)) \
- || (GET_CODE (xfoo0) == PLUS \
- && MEM_REG (XEXP (xfoo0, 0)) \
- && CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfoo0, 1)))) \
- || (TARGET_SB && CONSTANT_ADDRESS_P (xfoo0))))
-
-/* Go to ADDR if X is a valid address not using indexing.
- (This much is the easy part.) */
-#define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
-{ register rtx xfoob = (X); \
- if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; \
- if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \
- if (GET_CODE (X) == PLUS) \
- if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1))) \
- if (INDIRECTABLE_2_ADDRESS_P (XEXP (X, 0))) \
- goto ADDR; \
-}
-
-/* Go to ADDR if X is a valid address not using indexing.
- (This much is the easy part.) */
-#define GO_IF_INDEXING(X, MODE, ADDR) \
-{ register rtx xfoob = (X); \
- if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 0), MODE)) \
- GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 1), ADDR); \
- if (GET_CODE (xfoob) == PLUS && INDEX_TERM_P (XEXP (xfoob, 1), MODE)) \
- GO_IF_INDEXABLE_ADDRESS (XEXP (xfoob, 0), ADDR); } \
-
-#define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \
-{ if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) goto ADDR; \
- if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \
- if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; \
-}
-
-/* 1 if PROD is either a reg times size of mode MODE
- or just a reg, if MODE is just one byte. Actually, on the ns32k,
- since the index mode is independent of the operand size,
- we can match more stuff...
-
- This macro's expansion uses the temporary variables xfoo0, xfoo1
- and xfoo2 that must be declared in the surrounding context. */
-#define INDEX_TERM_P(PROD, MODE) \
-((GET_CODE (PROD) == REG && REG_OK_FOR_INDEX_P (PROD)) \
- || (GET_CODE (PROD) == MULT \
- && (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
- (GET_CODE (xfoo1) == CONST_INT \
- && GET_CODE (xfoo0) == REG \
- && FITS_INDEX_RANGE (INTVAL (xfoo1)) \
- && REG_OK_FOR_INDEX_P (xfoo0)))))
-
-#define FITS_INDEX_RANGE(X) \
- ((xfoo2 = (unsigned)(X)-1), \
- ((xfoo2 < 4 && xfoo2 != 2) || xfoo2 == 7))
-
-/* Note that xfoo0, xfoo1, xfoo2 are used in some of the submacros above. */
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ register rtx xfooy, xfoo0, xfoo1; \
- unsigned xfoo2; \
- extern int current_function_uses_pic_offset_table, flag_pic; \
- xfooy = X; \
- if (flag_pic && ! current_function_uses_pic_offset_table \
- && global_symbolic_reference_mentioned_p (X, 1)) \
- current_function_uses_pic_offset_table = 1; \
- GO_IF_NONINDEXED_ADDRESS (xfooy, ADDR); \
- if (GET_CODE (xfooy) == PLUS) \
- { \
- if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 1)) \
- && GET_CODE (XEXP (xfooy, 0)) == PLUS) \
- xfooy = XEXP (xfooy, 0); \
- else if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfooy, 0)) \
- && GET_CODE (XEXP (xfooy, 1)) == PLUS) \
- xfooy = XEXP (xfooy, 1); \
- GO_IF_INDEXING (xfooy, MODE, ADDR); \
- } \
- else if (INDEX_TERM_P (xfooy, MODE)) \
- goto ADDR; \
- else if (GET_CODE (xfooy) == PRE_DEC) \
- if (REGNO (XEXP (xfooy, 0)) == STACK_POINTER_REGNUM) goto ADDR; \
- else abort (); \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the ns32k, we do nothing */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Nonzero if the constant value X is a legitimate general operand
- when generating PIC code. It is given that flag_pic is on and
- that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-extern int current_function_uses_pic_offset_table, flag_pic;
-#define LEGITIMATE_PIC_OPERAND_P(X) \
- (((! current_function_uses_pic_offset_table \
- && global_symbolic_reference_mentioned_p (X, 1))? \
- (current_function_uses_pic_offset_table = 1):0 \
- ), 1)
-
-/* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- On the ns32k, if using PIC, mark a SYMBOL_REF for a non-global
- symbol or a code symbol. These symbols are referenced via pc
- and not via sb. */
-
-#define ENCODE_SECTION_INFO(DECL) \
-do \
- { \
- extern int flag_pic; \
- if (flag_pic) \
- { \
- rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
- SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
- = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
- || ! TREE_PUBLIC (DECL)); \
- } \
- } \
-while (0)
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the ns32k, only predecrement and postincrement address depend thus
- (the amount of decrement or increment being the length of the operand). */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
- goto LABEL;}
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction.
- HI mode is more efficient but the range is not wide enough for
- all programs. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-#define CASE_VECTOR_PC_RELATIVE
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of address ADDRESS. */
-
-#define ADDRESS_COST(RTX) calc_address_cost (RTX)
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) <= 7 && INTVAL (RTX) >= -8) return 0; \
- if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) \
- return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 3; \
- case CONST_DOUBLE: \
- return 5;
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-/* This bit means that what ought to be in the Z bit
- should be tested in the F bit. */
-#define CC_Z_IN_F 04000
-
-/* This bit means that what ought to be in the Z bit
- is complemented in the F bit. */
-#define CC_Z_IN_NOT_F 010000
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ if (GET_CODE (EXP) == SET) \
- { if (GET_CODE (SET_DEST (EXP)) == CC0) \
- { cc_status.flags = 0; \
- cc_status.value1 = SET_DEST (EXP); \
- cc_status.value2 = SET_SRC (EXP); \
- } \
- else if (GET_CODE (SET_SRC (EXP)) == CALL) \
- { CC_STATUS_INIT; } \
- else if (GET_CODE (SET_DEST (EXP)) == REG) \
- { if (cc_status.value1 \
- && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value1)) \
- cc_status.value1 = 0; \
- if (cc_status.value2 \
- && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value2)) \
- cc_status.value2 = 0; \
- } \
- else if (GET_CODE (SET_DEST (EXP)) == MEM) \
- { CC_STATUS_INIT; } \
- } \
- else if (GET_CODE (EXP) == PARALLEL \
- && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
- { if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == CC0) \
- { cc_status.flags = 0; \
- cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
- cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); \
- } \
- else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == REG) \
- { if (cc_status.value1 \
- && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value1)) \
- cc_status.value1 = 0; \
- if (cc_status.value2 \
- && reg_overlap_mentioned_p (SET_DEST (XVECEXP (EXP, 0, 0)), cc_status.value2)) \
- cc_status.value2 = 0; \
- } \
- else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) == MEM) \
- { CC_STATUS_INIT; } \
- } \
- else if (GET_CODE (EXP) == CALL) \
- { /* all bets are off */ CC_STATUS_INIT; } \
- else { /* nothing happens? CC_STATUS_INIT; */} \
- if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
- && cc_status.value2 \
- && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
- abort (); \
-}
-
-/* Describe the costs of the following register moves which are discouraged:
- 1.) Moves between the Floating point registers and the frame pointer and stack pointer
- 2.) Moves between the stack pointer and the frame pointer
- 3.) Moves between the floating point and general registers */
-
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- ((((CLASS1) == FLOAT_REGS && ((CLASS2) == STACK_POINTER_REG || (CLASS2) == FRAME_POINTER_REG)) \
- || ((CLASS2) == FLOAT_REGS && ((CLASS1) == STACK_POINTER_REG || (CLASS1) == FRAME_POINTER_REG)) \
- || ((CLASS1) == STACK_POINTER_REG && (CLASS2) == FRAME_POINTER_REG) \
- || ((CLASS2) == STACK_POINTER_REG && (CLASS1) == FRAME_POINTER_REG) \
- || ((CLASS1) == FLOAT_REGS && (CLASS2) == GENERAL_REGS) \
- || ((CLASS1) == GENERAL_REGS && (CLASS2) == FLOAT_REGS)) \
- ? 4 : 2)
-
-#define OUTPUT_JUMP(NORMAL, NO_OV) \
-{ if (cc_status.flags & CC_NO_OVERFLOW) \
- return NO_OV; \
- return NORMAL; }
-
-/* Dividing the output into sections */
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* Define the output Assembly Language */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n");
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "#APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* Output of Data */
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- fprintf (FILE, "\t.float 0f%.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output an assembler line defining an external/static
- address which is not in tree format (for collect.c). */
-
-#define ASM_OUTPUT_LABELREF_AS_INT(STREAM, NAME) \
-do { \
- fprintf (STREAM, "\t.long\t"); \
- ASM_OUTPUT_LABELREF (STREAM, NAME); \
- fprintf (STREAM, "\n"); \
-} while (0)
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tmovd %s,tos\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmovd tos,%s\n", reg_names[REGNO])
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
- "fp", "sp"}
-
-/* How to renumber registers for dbx and gdb.
- NS32000 may need more change in the numeration. */
-
-#define DBX_REGISTER_NUMBER(REGNO) ((REGNO < 8) ? (REGNO)+4 : (REGNO))
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#ifndef COLLECT
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-#else
-#define ASM_OUTPUT_LABEL(STREAM,NAME) \
-do { \
- fprintf (STREAM, "%s:\n", NAME); \
-} while (0)
-#endif
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#ifndef COLLECT
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-#else
-#define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
-do { \
- fprintf (STREAM, "\t.globl\t%s\n", NAME); \
-} while (0)
-#endif
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to align the code that follows an unconditional branch.
- Note that 0xa2 is a no-op. */
-
-#define ASM_OUTPUT_ALIGN_CODE(FILE) \
- fprintf (FILE, "\t.align 2,0xa2\n")
-
-/* This is how to output an element of a case-vector that is absolute.
- (The ns32k does not use such vectors,
- but we must define this macro anyway.) */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.long L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-/* ** Notice that the second element is LI format! */
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.long L%d-LI%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf (FILE, "\t.align %d\n", (LOG))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print an instruction operand X on file FILE.
- CODE is the code from the %-spec that requested printing this operand;
- if `%z3' was used to print operand 3, then CODE is 'z'. */
-
-/* %$ means print the prefix for an immediate operand. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '$' || (CODE) == '?')
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand(FILE, X, CODE)
-
-/* Print a memory operand whose address is X, on file FILE. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR)
-
-/* Define functions in ns32k.c and used in insn-output.c. */
-
-extern char *output_move_double ();
-extern char *output_shift_insn ();
-extern char *output_move_dconst ();
-
-/*
-Local variables:
-version-control: t
-End:
-*/
diff --git a/gcc/config/ns32k/ns32k.md b/gcc/config/ns32k/ns32k.md
deleted file mode 100644
index 28e65e6df91..00000000000
--- a/gcc/config/ns32k/ns32k.md
+++ /dev/null
@@ -1,2869 +0,0 @@
-;;- Machine description for GNU compiler, ns32000 Version
-;; Copyright (C) 1988, 1994, 1996 Free Software Foundation, Inc.
-;; Contributed by Michael Tiemann (tiemann@cygnus.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.
-
-
-; BUGS:
-;; Insert no-op between an insn with memory read-write operands
-;; following by a scale-indexing operation.
-;; The Sequent assembler does not allow addresses to be used
-;; except in insns which explicitly compute an effective address.
-;; I.e., one cannot say "cmpd _p,@_x"
-;; Implement unsigned multiplication??
-
-;;- Instruction patterns. When multiple patterns apply,
-;;- the first one in the file is chosen.
-;;-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-;;-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-;; We don't want to allow a constant operand for test insns because
-;; (set (cc0) (const_int foo)) has no mode information. Such insns will
-;; be folded while optimizing anyway.
-
-(define_insn "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" "rm"))]
- ""
- "*
-{ cc_status.flags |= CC_REVERSED;
- operands[1] = const0_rtx;
- return \"cmpqd %1,%0\"; }")
-
-(define_insn "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "nonimmediate_operand" "g"))]
- ""
- "*
-{ cc_status.flags |= CC_REVERSED;
- operands[1] = const0_rtx;
- return \"cmpqw %1,%0\"; }")
-
-(define_insn "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "nonimmediate_operand" "g"))]
- ""
- "*
-{ cc_status.flags |= CC_REVERSED;
- operands[1] = const0_rtx;
- return \"cmpqb %1,%0\"; }")
-
-(define_insn "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "general_operand" "fmF"))]
- "TARGET_32081"
- "*
-{ cc_status.flags |= CC_REVERSED;
- operands[1] = CONST0_RTX (DFmode);
- return \"cmpl %1,%0\"; }")
-
-(define_insn "tstsf"
- [(set (cc0)
- (match_operand:SF 0 "general_operand" "fmF"))]
- "TARGET_32081"
- "*
-{ cc_status.flags |= CC_REVERSED;
- operands[1] = CONST0_RTX (SFmode);
- return \"cmpf %1,%0\"; }")
-
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "rmn")
- (match_operand:SI 1 "general_operand" "rmn")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- int i = INTVAL (operands[1]);
- if (i <= 7 && i >= -8)
- {
- cc_status.flags |= CC_REVERSED;
- return \"cmpqd %1,%0\";
- }
- }
- cc_status.flags &= ~CC_REVERSED;
- if (GET_CODE (operands[0]) == CONST_INT)
- {
- int i = INTVAL (operands[0]);
- if (i <= 7 && i >= -8)
- return \"cmpqd %0,%1\";
- }
- return \"cmpd %0,%1\";
-}")
-
-(define_insn "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "g")
- (match_operand:HI 1 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- short i = INTVAL (operands[1]);
- if (i <= 7 && i >= -8)
- {
- cc_status.flags |= CC_REVERSED;
- if (INTVAL (operands[1]) > 7)
- operands[1] = gen_rtx(CONST_INT, VOIDmode, i);
- return \"cmpqw %1,%0\";
- }
- }
- cc_status.flags &= ~CC_REVERSED;
- if (GET_CODE (operands[0]) == CONST_INT)
- {
- short i = INTVAL (operands[0]);
- if (i <= 7 && i >= -8)
- {
- if (INTVAL (operands[0]) > 7)
- operands[0] = gen_rtx(CONST_INT, VOIDmode, i);
- return \"cmpqw %0,%1\";
- }
- }
- return \"cmpw %0,%1\";
-}")
-
-(define_insn "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "g")
- (match_operand:QI 1 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- char i = INTVAL (operands[1]);
- if (i <= 7 && i >= -8)
- {
- cc_status.flags |= CC_REVERSED;
- if (INTVAL (operands[1]) > 7)
- operands[1] = gen_rtx(CONST_INT, VOIDmode, i);
- return \"cmpqb %1,%0\";
- }
- }
- cc_status.flags &= ~CC_REVERSED;
- if (GET_CODE (operands[0]) == CONST_INT)
- {
- char i = INTVAL (operands[0]);
- if (i <= 7 && i >= -8)
- {
- if (INTVAL (operands[0]) > 7)
- operands[0] = gen_rtx(CONST_INT, VOIDmode, i);
- return \"cmpqb %0,%1\";
- }
- }
- return \"cmpb %0,%1\";
-}")
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "general_operand" "fmF")
- (match_operand:DF 1 "general_operand" "fmF")))]
- "TARGET_32081"
- "cmpl %0,%1")
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "general_operand" "fmF")
- (match_operand:SF 1 "general_operand" "fmF")))]
- "TARGET_32081"
- "cmpf %0,%1")
-
-(define_insn "movdf"
- [(set (match_operand:DF 0 "general_operand" "=fg<")
- (match_operand:DF 1 "general_operand" "fFg"))]
- ""
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]) || GET_CODE (operands[1]) == CONST_DOUBLE)
- return \"movl %1,%0\";
- if (REG_P (operands[1]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"movd %1,tos\", xoperands);
- output_asm_insn (\"movd %1,tos\", operands);
- return \"movl tos,%0\";
- }
- return \"movl %1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"movl %1,tos\;movd tos,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"movd tos,%0\";
- }
- else
- return \"movl %1,%0\";
- }
- return output_move_double (operands);
-}")
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=fg<")
- (match_operand:SF 1 "general_operand" "fFg"))]
- ""
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 8)
- return \"movd %1,tos\;movf tos,%0\";
- else
- return \"movf %1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- return \"movf %1,tos\;movd tos,%0\";
- return \"movf %1,%0\";
- }
-#if 0 /* Someone suggested this for the Sequent. Is it needed? */
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- return \"movf %1,%0\";
-#endif
-/* There was a #if 0 around this, but that was erroneous
- for many machines -- rms. */
-#ifndef MOVD_FLOAT_OK
- /* GAS understands floating constants in ordinary movd instructions
- but other assemblers might object. */
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- union {int i[2]; float f; double d;} convrt;
- convrt.i[0] = CONST_DOUBLE_LOW (operands[1]);
- convrt.i[1] = CONST_DOUBLE_HIGH (operands[1]);
- convrt.f = convrt.d;
-
- /* Is there a better machine-independent way to to this? */
- operands[1] = gen_rtx (CONST_INT, VOIDmode, convrt.i[0]);
- return \"movd %1,%0\";
- }
-#endif
- else return \"movd %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:TI 0 "memory_operand" "=m")
- (match_operand:TI 1 "memory_operand" "m"))]
- ""
- "movmd %1,%0,4")
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=g<,*f,g")
- (match_operand:DI 1 "general_operand" "gF,g,*f"))]
- ""
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]) || GET_CODE (operands[1]) == CONST_DOUBLE)
- return \"movl %1,%0\";
- if (REG_P (operands[1]))
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- output_asm_insn (\"movd %1,tos\", xoperands);
- output_asm_insn (\"movd %1,tos\", operands);
- return \"movl tos,%0\";
- }
- return \"movl %1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- {
- output_asm_insn (\"movl %1,tos\;movd tos,%0\", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"movd tos,%0\";
- }
- else
- return \"movl %1,%0\";
- }
- return output_move_double (operands);
-}")
-
-;; This special case must precede movsi.
-(define_insn ""
- [(set (reg:SI 17)
- (match_operand:SI 0 "general_operand" "rmn"))]
- ""
- "lprd sp,%0")
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=g<,g<,*f,g,x")
- (match_operand:SI 1 "general_operand" "g,?xy,g,*f,rmn"))]
- ""
- "*
-{
- extern int flag_pic; \
-
- if (FP_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 8)
- return \"movd %1,tos\;movf tos,%0\";
- else
- return \"movf %1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- return \"movf %1,tos\;movd tos,%0\";
- return \"movf %1,%0\";
- }
- if (GET_CODE (operands[0]) == REG
- && REGNO (operands[0]) == FRAME_POINTER_REGNUM)
- return \"lprd fp,%1\";
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- operands[1]
- = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (operands[1]));
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- int i = INTVAL (operands[1]);
- if (! TARGET_32532)
- {
- if (i <= 7 && i >= -8)
- return \"movqd %1,%0\";
- if (i <= 0x1fffffff && i >= -0x20000000)
-#if defined (GNX_V3) || defined (UTEK_ASM)
- return \"addr %c1,%0\";
-#else
- return \"addr @%c1,%0\";
-#endif
- return \"movd %$%1,%0\";
- }
- else
- return output_move_dconst(i, \"%$%1,%0\");
- }
- else if (GET_CODE (operands[1]) == CONST && ! flag_pic)
- {
- /* Must contain symbols so we don`t know how big it is. In
- * that case addr might lead to overflow. For PIC symbolic
- * address loads always have to be done with addr.
- */
- return \"movd %$%1,%0\";
- }
- else if (GET_CODE (operands[1]) == REG)
- {
- if (REGNO (operands[1]) < 16)
- return \"movd %1,%0\";
- else if (REGNO (operands[1]) == FRAME_POINTER_REGNUM)
- {
- if (GET_CODE(operands[0]) == REG)
- return \"sprd fp,%0\";
- else
- return \"addr 0(fp),%0\" ;
- }
- else if (REGNO (operands[1]) == STACK_POINTER_REGNUM)
- {
- if (GET_CODE(operands[0]) == REG)
- return \"sprd sp,%0\";
- else
- return \"addr 0(sp),%0\" ;
- }
- else abort ();
- }
- else if (GET_CODE (operands[1]) == MEM)
- return \"movd %1,%0\";
-
- /* Check if this effective address can be
- calculated faster by pulling it apart. */
- if (REG_P (operands[0])
- && GET_CODE (operands[1]) == MULT
- && GET_CODE (XEXP (operands[1], 1)) == CONST_INT
- && (INTVAL (XEXP (operands[1], 1)) == 2
- || INTVAL (XEXP (operands[1], 1)) == 4))
- {
- rtx xoperands[3];
- xoperands[0] = operands[0];
- xoperands[1] = XEXP (operands[1], 0);
- xoperands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (XEXP (operands[1], 1)) >> 1);
- return output_shift_insn (xoperands);
- }
- return \"addr %a1,%0\";
-}")
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=g<,*f,g")
- (match_operand:HI 1 "general_operand" "g,g,*f"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- short i = INTVAL (operands[1]);
- if (i <= 7 && i >= -8)
- {
- if (INTVAL (operands[1]) > 7)
- operands[1] =
- gen_rtx (CONST_INT, VOIDmode, i);
- return \"movqw %1,%0\";
- }
- return \"movw %1,%0\";
- }
- else if (FP_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 8)
- return \"movwf %1,tos\;movf tos,%0\";
- else
- return \"movwf %1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- return \"movf %1,tos\;movd tos,%0\";
- return \"movf %1,%0\";
- }
- else
- return \"movw %1,%0\";
-}")
-
-(define_insn "movstricthi"
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "+r"))
- (match_operand:HI 1 "general_operand" "g"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL(operands[1]) <= 7 && INTVAL(operands[1]) >= -8)
- return \"movqw %1,%0\";
- return \"movw %1,%0\";
-}")
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=g<,*f,g")
- (match_operand:QI 1 "general_operand" "g,g,*f"))]
- ""
- "*
-{ if (GET_CODE (operands[1]) == CONST_INT)
- {
- char char_val = (char)INTVAL (operands[1]);
- if (char_val <= 7 && char_val >= -8)
- {
- if (INTVAL (operands[1]) > 7)
- operands[1] =
- gen_rtx (CONST_INT, VOIDmode, char_val);
- return \"movqb %1,%0\";
- }
- return \"movb %1,%0\";
- }
- else if (FP_REG_P (operands[0]))
- {
- if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 8)
- return \"movbf %1,tos\;movf tos,%0\";
- else
- return \"movbf %1,%0\";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (REG_P (operands[0]))
- return \"movf %1,tos\;movd tos,%0\";
- return \"movf %1,%0\";
- }
- else
- return \"movb %1,%0\";
-}")
-
-(define_insn "movstrictqi"
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "+r"))
- (match_operand:QI 1 "general_operand" "g"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL(operands[1]) < 8 && INTVAL(operands[1]) > -9)
- return \"movqb %1,%0\";
- return \"movb %1,%0\";
-}")
-
-;; This is here to accept 4 arguments and pass the first 3 along
-;; to the movstrsi1 pattern that really does the work.
-(define_expand "movstrsi"
- [(set (match_operand:BLK 0 "general_operand" "=g")
- (match_operand:BLK 1 "general_operand" "g"))
- (use (match_operand:SI 2 "general_operand" "rmn"))
- (match_operand 3 "" "")]
- ""
- "
- emit_insn (gen_movstrsi1 (operands[0], operands[1], operands[2]));
- DONE;
-")
-
-;; The definition of this insn does not really explain what it does,
-;; but it should suffice
-;; that anything generated as this insn will be recognized as one
-;; and that it won't successfully combine with anything.
-(define_insn "movstrsi1"
- [(set (match_operand:BLK 0 "general_operand" "=g")
- (match_operand:BLK 1 "general_operand" "g"))
- (use (match_operand:SI 2 "general_operand" "rmn"))
- (clobber (reg:SI 0))
- (clobber (reg:SI 1))
- (clobber (reg:SI 2))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
- abort ();
- operands[0] = XEXP (operands[0], 0);
- operands[1] = XEXP (operands[1], 0);
- if (GET_CODE (operands[0]) == MEM)
- if (GET_CODE (operands[1]) == MEM)
- output_asm_insn (\"movd %0,r2\;movd %1,r1\", operands);
- else
- output_asm_insn (\"movd %0,r2\;addr %a1,r1\", operands);
- else if (GET_CODE (operands[1]) == MEM)
- output_asm_insn (\"addr %a0,r2\;movd %1,r1\", operands);
- else
- output_asm_insn (\"addr %a0,r2\;addr %a1,r1\", operands);
-
-#ifdef UTEK_ASM
- if (GET_CODE (operands[2]) == CONST_INT && (INTVAL (operands[2]) & 0x3) == 0)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) >> 2);
- if ((unsigned) INTVAL (operands[2]) <= 7)
- return \"movqd %2,r0\;movsd $0\";
- else
- return \"movd %2,r0\;movsd $0\";
- }
- else
- {
- return \"movd %2,r0\;movsb $0\";
- }
-#else
- if (GET_CODE (operands[2]) == CONST_INT && (INTVAL (operands[2]) & 0x3) == 0)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) >> 2);
- if ((unsigned) INTVAL (operands[2]) <= 7)
- return \"movqd %2,r0\;movsd\";
- else
- return \"movd %2,r0\;movsd\";
- }
- else
- {
- return \"movd %2,r0\;movsb\";
- }
-#endif
-}")
-
-;; Extension and truncation insns.
-;; Those for integer source operand
-;; are ordered widest source type first.
-
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (truncate:QI (match_operand:SI 1 "nonimmediate_operand" "rmn")))]
- ""
- "movb %1,%0")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (truncate:HI (match_operand:SI 1 "nonimmediate_operand" "rmn")))]
- ""
- "movw %1,%0")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (truncate:QI (match_operand:HI 1 "nonimmediate_operand" "g")))]
- ""
- "movb %1,%0")
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
- ""
- "movxwd %1,%0")
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "movxbw %1,%0")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "movxbd %1,%0")
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "general_operand" "=fm<")
- (float_extend:DF (match_operand:SF 1 "general_operand" "fmF")))]
- "TARGET_32081"
- "movfl %1,%0")
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "general_operand" "=fm<")
- (float_truncate:SF (match_operand:DF 1 "general_operand" "fmF")))]
- "TARGET_32081"
- "movlf %1,%0")
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
- ""
- "movzwd %1,%0")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "movzbw %1,%0")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "movzbd %1,%0")
-
-;; Fix-to-float conversion insns.
-;; Note that the ones that start with SImode come first.
-;; That is so that an operand that is a CONST_INT
-;; (and therefore lacks a specific machine mode).
-;; will be recognized as SImode (which is always valid)
-;; rather than as QImode or HImode.
-
-;; Rumor has it that the National part does not correctly convert
-;; constant ints to floats. This conversion is therefore disabled.
-;; A register must be used to perform the conversion.
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "general_operand" "=fm<")
- (float:SF (match_operand:SI 1 "general_operand" "rm")))]
- "TARGET_32081"
- "movdf %1,%0")
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "general_operand" "=fm<")
- (float:DF (match_operand:SI 1 "general_operand" "rm")))]
- "TARGET_32081"
- "movdl %1,%0")
-
-(define_insn "floathisf2"
- [(set (match_operand:SF 0 "general_operand" "=fm<")
- (float:SF (match_operand:HI 1 "general_operand" "rm")))]
- "TARGET_32081"
- "movwf %1,%0")
-
-(define_insn "floathidf2"
- [(set (match_operand:DF 0 "general_operand" "=fm<")
- (float:DF (match_operand:HI 1 "general_operand" "rm")))]
- "TARGET_32081"
- "movwl %1,%0")
-
-(define_insn "floatqisf2"
- [(set (match_operand:SF 0 "general_operand" "=fm<")
- (float:SF (match_operand:QI 1 "general_operand" "rm")))]
- "TARGET_32081"
- "movbf %1,%0")
-
-; Some assemblers warn that this insn doesn't work.
-; Maybe they know something we don't.
-;(define_insn "floatqidf2"
-; [(set (match_operand:DF 0 "general_operand" "=fm<")
-; (float:DF (match_operand:QI 1 "general_operand" "rm")))]
-; "TARGET_32081"
-; "movbl %1,%0")
-
-;; Float-to-fix conversion insns.
-;; The sequent compiler always generates "trunc" insns.
-
-(define_insn "fixsfqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (fix:QI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "truncfb %1,%0")
-
-(define_insn "fixsfhi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (fix:HI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "truncfw %1,%0")
-
-(define_insn "fixsfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "truncfd %1,%0")
-
-(define_insn "fixdfqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (fix:QI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "trunclb %1,%0")
-
-(define_insn "fixdfhi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (fix:HI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "trunclw %1,%0")
-
-(define_insn "fixdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "truncld %1,%0")
-
-;; Unsigned
-
-(define_insn "fixunssfqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (unsigned_fix:QI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "truncfb %1,%0")
-
-(define_insn "fixunssfhi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (unsigned_fix:HI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "truncfw %1,%0")
-
-(define_insn "fixunssfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (unsigned_fix:SI (fix:SF (match_operand:SF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "truncfd %1,%0")
-
-(define_insn "fixunsdfqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (unsigned_fix:QI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "trunclb %1,%0")
-
-(define_insn "fixunsdfhi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (unsigned_fix:HI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "trunclw %1,%0")
-
-(define_insn "fixunsdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (unsigned_fix:SI (fix:DF (match_operand:DF 1 "general_operand" "fm"))))]
- "TARGET_32081"
- "truncld %1,%0")
-
-;;; These are not yet used by GCC
-(define_insn "fix_truncsfqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (fix:QI (match_operand:SF 1 "general_operand" "fm")))]
- "TARGET_32081"
- "truncfb %1,%0")
-
-(define_insn "fix_truncsfhi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (fix:HI (match_operand:SF 1 "general_operand" "fm")))]
- "TARGET_32081"
- "truncfw %1,%0")
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (fix:SI (match_operand:SF 1 "general_operand" "fm")))]
- "TARGET_32081"
- "truncfd %1,%0")
-
-(define_insn "fix_truncdfqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (fix:QI (match_operand:DF 1 "general_operand" "fm")))]
- "TARGET_32081"
- "trunclb %1,%0")
-
-(define_insn "fix_truncdfhi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (fix:HI (match_operand:DF 1 "general_operand" "fm")))]
- "TARGET_32081"
- "trunclw %1,%0")
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (fix:SI (match_operand:DF 1 "general_operand" "fm")))]
- "TARGET_32081"
- "truncld %1,%0")
-
-;;- All kinds of add instructions.
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "general_operand" "=fm")
- (plus:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "fmF")))]
- "TARGET_32081"
- "addl %2,%0")
-
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "general_operand" "=fm")
- (plus:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "fmF")))]
- "TARGET_32081"
- "addf %2,%0")
-
-(define_insn ""
- [(set (reg:SI 17)
- (plus:SI (reg:SI 17)
- (match_operand:SI 0 "immediate_operand" "i")))]
- "GET_CODE (operands[0]) == CONST_INT"
- "*
-{
-#ifndef SEQUENT_ADJUST_STACK
- if (TARGET_32532)
- if (INTVAL (operands[0]) == 8)
- return \"cmpd tos,tos\";
- if (TARGET_32532 || TARGET_32332)
- if (INTVAL (operands[0]) == 4)
- return \"cmpqd %$0,tos\";
-#endif
- if (! TARGET_32532)
- {
- if (INTVAL (operands[0]) < 64 && INTVAL (operands[0]) > -64)
- return \"adjspb %$%n0\";
- else if (INTVAL (operands[0]) < 8192 && INTVAL (operands[0]) >= -8192)
- return \"adjspw %$%n0\";
- }
- return \"adjspd %$%n0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (plus:SI (reg:SI 16)
- (match_operand:SI 1 "immediate_operand" "i")))]
- "GET_CODE (operands[1]) == CONST_INT"
- "addr %c1(fp),%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (plus:SI (reg:SI 17)
- (match_operand:SI 1 "immediate_operand" "i")))]
- "GET_CODE (operands[1]) == CONST_INT"
- "addr %c1(sp),%0")
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "general_operand" "=ro")
- (plus:DI (match_operand:DI 1 "general_operand" "%0")
- (match_operand:DI 2 "general_operand" "ron")))]
- ""
- "*
-{
- rtx low[3], high[3], xops[4];
- split_di (operands, 3, low, high);
- xops[0] = low[0];
- xops[1] = high[0];
- xops[2] = low[2];
- xops[3] = high[2];
-
- if (GET_CODE (xops[2]) == CONST_INT)
- {
- int i = INTVAL (xops[2]);
-
- if (i <= 7 && i >= -8)
- {
- if (i == 0)
- {
- i = INTVAL (xops[3]);
- if (i <= 7 && i >= -8)
- output_asm_insn (\"addqd %$%3,%1\", xops);
- else
- output_asm_insn (\"addd %$%3,%1\", xops);
- }
- else
- {
- output_asm_insn (\"addqd %$%2,%0\", xops);
- output_asm_insn (\"addcd %$%3,%1\", xops);
- }
- return \"\";
- }
- }
- output_asm_insn (\"addd %2,%0\", xops);
- output_asm_insn (\"addcd %3,%1\", xops);
- return \"\";
-}")
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "general_operand" "=g,=g&<")
- (plus:SI (match_operand:SI 1 "general_operand" "%0,r")
- (match_operand:SI 2 "general_operand" "rmn,n")))]
- ""
- "*
-{
- if (which_alternative == 1)
- {
- int i = INTVAL (operands[2]);
- if (NS32K_DISPLACEMENT_P (i))
- return \"addr %c2(%1),%0\";
- else
- return \"movd %1,%0\;addd %2,%0\";
- }
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
-
- if (i <= 7 && i >= -8)
- return \"addqd %2,%0\";
- else if (! TARGET_32532 && GET_CODE (operands[0]) == REG
- && i <= 0x1fffffff && i >= -0x20000000)
- return \"addr %c2(%0),%0\";
- }
- return \"addd %2,%0\";
-}")
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (plus:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
- if (i <= 7 && i >= -8)
- return \"addqw %2,%0\";
- }
- return \"addw %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "=r"))
- (plus:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) >-9 && INTVAL(operands[1]) < 8)
- return \"addqw %2,%0\";
- return \"addw %2,%0\";
-}")
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (plus:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
- if (i <= 7 && i >= -8)
- return \"addqb %2,%0\";
- }
- return \"addb %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "=r"))
- (plus:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) >-9 && INTVAL(operands[1]) < 8)
- return \"addqb %2,%0\";
- return \"addb %2,%0\";
-}")
-
-;;- All kinds of subtract instructions.
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "general_operand" "=fm")
- (minus:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "fmF")))]
- "TARGET_32081"
- "subl %2,%0")
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "general_operand" "=fm")
- (minus:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "fmF")))]
- "TARGET_32081"
- "subf %2,%0")
-
-(define_insn ""
- [(set (reg:SI 17)
- (minus:SI (reg:SI 17)
- (match_operand:SI 0 "immediate_operand" "i")))]
- "GET_CODE (operands[0]) == CONST_INT"
- "*
-{
- if (! TARGET_32532 && GET_CODE(operands[0]) == CONST_INT
- && INTVAL(operands[0]) < 64 && INTVAL(operands[0]) > -64)
- return \"adjspb %$%0\";
- return \"adjspd %$%0\";
-}")
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "general_operand" "=ro")
- (minus:DI (match_operand:DI 1 "general_operand" "0")
- (match_operand:DI 2 "general_operand" "ron")))]
- ""
- "*
-{
- rtx low[3], high[3], xops[4];
- split_di (operands, 3, low, high);
- xops[0] = low[0];
- xops[1] = high[0];
- xops[2] = low[2];
- xops[3] = high[2];
-
- if (GET_CODE (xops[2]) == CONST_INT)
- {
- int i = INTVAL (xops[2]);
-
- if (i <= 8 && i >= -7)
- {
- if (i == 0)
- {
- i = INTVAL (xops[3]);
- if (i <= 8 && i >= -7)
- output_asm_insn (\"addqd %$%n3,%1\", xops);
- else
- output_asm_insn (\"subd %$%3,%1\", xops);
- }
- else
- {
- output_asm_insn (\"addqd %$%n2,%0\", xops);
- output_asm_insn (\"subcd %$%3,%1\", xops);
- }
- return \"\";
- }
- }
- output_asm_insn (\"subd %2,%0\", xops);
- output_asm_insn (\"subcd %3,%1\", xops);
- return \"\";
-}")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (minus:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
-
- if (i <= 8 && i >= -7)
- return \"addqd %$%n2,%0\";
- }
- return \"subd %2,%0\";
-}")
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (minus:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
-
- if (i <= 8 && i >= -7)
- return \"addqw %$%n2,%0\";
- }
- return \"subw %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:HI 0 "general_operand" "=r"))
- (minus:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) >-8 && INTVAL(operands[1]) < 9)
- return \"addqw %$%n2,%0\";
- return \"subw %2,%0\";
-}")
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (minus:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
-
- if (i <= 8 && i >= -7)
- return \"addqb %$%n2,%0\";
- }
- return \"subb %2,%0\";
-}")
-
-(define_insn ""
- [(set (strict_low_part (match_operand:QI 0 "general_operand" "=r"))
- (minus:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) >-8 && INTVAL(operands[1]) < 9)
- return \"addqb %$%n2,%0\";
- return \"subb %2,%0\";
-}")
-
-;;- Multiply instructions.
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "general_operand" "=fm")
- (mult:DF (match_operand:DF 1 "general_operand" "%0")
- (match_operand:DF 2 "general_operand" "fmF")))]
- "TARGET_32081"
- "mull %2,%0")
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "general_operand" "=fm")
- (mult:SF (match_operand:SF 1 "general_operand" "%0")
- (match_operand:SF 2 "general_operand" "fmF")))]
- "TARGET_32081"
- "mulf %2,%0")
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (mult:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "muld %2,%0")
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (mult:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "mulw %2,%0")
-
-(define_insn "mulqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (mult:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "mulb %2,%0")
-
-(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "general_operand" "=g")
- (mult:DI (zero_extend:DI
- (match_operand:SI 1 "nonimmediate_operand" "0"))
- (zero_extend:DI
- (match_operand:SI 2 "nonimmediate_operand" "rmn"))))]
- ""
- "meid %2,%0")
-
-;;- Divide instructions.
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "general_operand" "=fm")
- (div:DF (match_operand:DF 1 "general_operand" "0")
- (match_operand:DF 2 "general_operand" "fmF")))]
- "TARGET_32081"
- "divl %2,%0")
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "general_operand" "=fm")
- (div:SF (match_operand:SF 1 "general_operand" "0")
- (match_operand:SF 2 "general_operand" "fmF")))]
- "TARGET_32081"
- "divf %2,%0")
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "quod %2,%0")
-
-(define_insn "divhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (div:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "quow %2,%0")
-
-(define_insn "divqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (div:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "quob %2,%0")
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (udiv:SI (subreg:SI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "*
-{
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"deid %2,%0\;movd %1,%0\";
-}")
-
-(define_insn "udivhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (udiv:HI (subreg:HI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- operands[1] = gen_rtx (REG, HImode, REGNO (operands[0]) + 1);
- return \"deiw %2,%0\;movw %1,%0\";
-}")
-
-(define_insn "udivqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (udiv:QI (subreg:QI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- operands[1] = gen_rtx (REG, QImode, REGNO (operands[0]) + 1);
- return \"deib %2,%0\;movb %1,%0\";
-}")
-
-;; Remainder instructions.
-
-(define_insn "modsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (mod:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "remd %2,%0")
-
-(define_insn "modhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (mod:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "remw %2,%0")
-
-(define_insn "modqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (mod:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "remb %2,%0")
-
-(define_insn "umodsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (umod:SI (subreg:SI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "deid %2,%0")
-
-(define_insn "umodhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (umod:HI (subreg:HI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "deiw %2,%0")
-
-(define_insn "umodqi3"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (umod:QI (subreg:QI (match_operand:DI 1 "reg_or_mem_operand" "0") 0)
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "deib %2,%0")
-
-; This isn't be usable in its current form.
-;(define_insn "udivmoddisi4"
-; [(set (subreg:SI (match_operand:DI 0 "general_operand" "=r") 1)
-; (udiv:SI (match_operand:DI 1 "general_operand" "0")
-; (match_operand:SI 2 "general_operand" "rmn")))
-; (set (subreg:SI (match_dup 0) 0)
-; (umod:SI (match_dup 1) (match_dup 2)))]
-; ""
-; "deid %2,%0")
-
-;;- Logical Instructions: AND
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (and:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if ((INTVAL (operands[2]) | 0xff) == 0xffffffff)
- {
- if (INTVAL (operands[2]) == 0xffffff00)
- return \"movqb %$0,%0\";
- else
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & 0xff);
- return \"andb %2,%0\";
- }
- }
- if ((INTVAL (operands[2]) | 0xffff) == 0xffffffff)
- {
- if (INTVAL (operands[2]) == 0xffff0000)
- return \"movqw %$0,%0\";
- else
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & 0xffff);
- return \"andw %2,%0\";
- }
- }
- }
- return \"andd %2,%0\";
-}")
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (and:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (INTVAL (operands[2]) | 0xff) == 0xffffffff)
- {
- if (INTVAL (operands[2]) == 0xffffff00)
- return \"movqb %$0,%0\";
- else
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & 0xff);
- return \"andb %2,%0\";
- }
- }
- return \"andw %2,%0\";
-}")
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (and:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "andb %2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (and:SI (not:SI (match_operand:SI 1 "general_operand" "rmn"))
- (match_operand:SI 2 "general_operand" "0")))]
- ""
- "bicd %1,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g")
- (and:HI (not:HI (match_operand:HI 1 "general_operand" "g"))
- (match_operand:HI 2 "general_operand" "0")))]
- ""
- "bicw %1,%0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g")
- (and:QI (not:QI (match_operand:QI 1 "general_operand" "g"))
- (match_operand:QI 2 "general_operand" "0")))]
- ""
- "bicb %1,%0")
-
-;;- Bit set instructions.
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ior:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT) {
- if ((INTVAL (operands[2]) & 0xffffff00) == 0)
- return \"orb %2,%0\";
- if ((INTVAL (operands[2]) & 0xffff0000) == 0)
- return \"orw %2,%0\";
- }
- return \"ord %2,%0\";
-}")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (ior:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE(operands[2]) == CONST_INT &&
- (INTVAL(operands[2]) & 0xffffff00) == 0)
- return \"orb %2,%0\";
- return \"orw %2,%0\";
-}")
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (ior:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "orb %2,%0")
-
-;;- xor instructions.
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (xor:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT) {
- if ((INTVAL (operands[2]) & 0xffffff00) == 0)
- return \"xorb %2,%0\";
- if ((INTVAL (operands[2]) & 0xffff0000) == 0)
- return \"xorw %2,%0\";
- }
- return \"xord %2,%0\";
-}")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (xor:HI (match_operand:HI 1 "general_operand" "%0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE(operands[2]) == CONST_INT &&
- (INTVAL(operands[2]) & 0xffffff00) == 0)
- return \"xorb %2,%0\";
- return \"xorw %2,%0\";
-}")
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (xor:QI (match_operand:QI 1 "general_operand" "%0")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "xorb %2,%0")
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "general_operand" "=fm<")
- (neg:DF (match_operand:DF 1 "general_operand" "fmF")))]
- "TARGET_32081"
- "negl %1,%0")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "general_operand" "=fm<")
- (neg:SF (match_operand:SF 1 "general_operand" "fmF")))]
- "TARGET_32081"
- "negf %1,%0")
-
-(define_insn "negdi2"
- [(set (match_operand:DI 0 "general_operand" "=ro")
- (neg:DI (match_operand:DI 1 "general_operand" "ro")))]
- ""
- "*
-{
- rtx low[2], high[2], xops[4];
- split_di (operands, 2, low, high);
- xops[0] = low[0];
- xops[1] = high[0];
- xops[2] = low[1];
- xops[3] = high[1];
-
- if (rtx_equal_p (operands[0], operands[1]))
- {
- output_asm_insn (\"negd %3,%1\", xops);
- output_asm_insn (\"negd %2,%0\", xops);
- output_asm_insn (\"subcd %$0,%1\", xops);
- }
- else
- {
- output_asm_insn (\"negd %2,%0\", xops);
- output_asm_insn (\"movqd %$0,%1\", xops);
- output_asm_insn (\"subcd %3,%1\", xops);
- }
- return \"\";
-}")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (neg:SI (match_operand:SI 1 "general_operand" "rmn")))]
- ""
- "negd %1,%0")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (neg:HI (match_operand:HI 1 "general_operand" "g")))]
- ""
- "negw %1,%0")
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (neg:QI (match_operand:QI 1 "general_operand" "g")))]
- ""
- "negb %1,%0")
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (not:SI (match_operand:SI 1 "general_operand" "rmn")))]
- ""
- "comd %1,%0")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (not:HI (match_operand:HI 1 "general_operand" "g")))]
- ""
- "comw %1,%0")
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (not:QI (match_operand:QI 1 "general_operand" "g")))]
- ""
- "comb %1,%0")
-
-;; arithmetic left and right shift operations
-;; on the 32532 we will always use lshd for arithmetic left shifts,
-;; because it is three times faster. Broken programs which
-;; use negative shift counts are probably broken differently
-;; than elsewhere.
-
-;; alternative 0 never matches on the 32532
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "general_operand" "=g,g")
- (ashift:SI (match_operand:SI 1 "general_operand" "r,0")
- (match_operand:SI 2 "general_operand" "I,rmn")))]
- ""
- "*
-{ if (TARGET_32532)
- return \"lshd %2,%0\";
- else
- return output_shift_insn (operands);
-}")
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (ashift:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) == 1)
- return \"addw %0,%0\";
- else if (! TARGET_32532 && INTVAL (operands[2]) == 2)
- return \"addw %0,%0\;addw %0,%0\";
- }
- if (TARGET_32532)
- return \"lshw %2,%0\";
- else
- return \"ashw %2,%0\";
-}")
-
-(define_insn "ashlqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (ashift:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) == 1)
- return \"addb %0,%0\";
- else if (! TARGET_32532 && INTVAL (operands[2]) == 2)
- return \"addb %0,%0\;addb %0,%0\";
- }
- if (TARGET_32532)
- return \"lshb %2,%0\";
- else
- return \"ashb %2,%0\";
-}")
-
-;; Arithmetic right shift on the 32k works by negating the shift count.
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "ashd %$%n2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
- ""
- "ashd %2,%0")
-
-(define_expand "ashrhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (ashiftrt:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g")
- (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "ashw %$%n2,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g")
- (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
- ""
- "ashw %2,%0")
-
-(define_expand "ashrqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (ashiftrt:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g")
- (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "ashb %$%n2,%0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g")
- (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
- ""
- "ashb %2,%0")
-
-;; logical shift instructions
-
-;; Logical right shift on the 32k works by negating the shift count.
-(define_expand "lshrsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "lshd %$%n2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
- ""
- "lshd %2,%0")
-
-(define_expand "lshrhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (lshiftrt:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g")
- (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "lshw %$%n2,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g")
- (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
- ""
- "lshw %2,%0")
-
-(define_expand "lshrqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (lshiftrt:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g")
- (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "lshb %$%n2,%0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g")
- (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
- ""
- "lshb %2,%0")
-
-;; Rotate instructions
-
-(define_insn "rotlsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (rotate:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "rotd %2,%0")
-
-(define_insn "rotlhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (rotate:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "rotw %2,%0")
-
-(define_insn "rotlqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (rotate:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "rmn")))]
- ""
- "rotb %2,%0")
-
-;; Right rotate on the 32k works by negating the shift count.
-(define_expand "rotrsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (rotatert:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (rotatert:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "rotd %$%n2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (rotatert:SI (match_operand:SI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
- ""
- "rotd %2,%0")
-
-(define_expand "rotrhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (rotatert:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g")
- (rotatert:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "rotw %$%n2,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g")
- (rotatert:HI (match_operand:HI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
- ""
- "rotw %2,%0")
-
-(define_expand "rotrqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (rotatert:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, SImode, negate_rtx (SImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g")
- (rotatert:QI (match_operand:QI 1 "general_operand" "0")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "rotb %$%n2,%0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g")
- (rotatert:QI (match_operand:QI 1 "general_operand" "0")
- (neg:SI (match_operand:SI 2 "general_operand" "r"))))]
- ""
- "rotb %2,%0")
-
-;;- load or push effective address
-;; These come after the move, add, and multiply patterns
-;; because we don't want pushl $1 turned into pushad 1.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (match_operand:QI 1 "address_operand" "p"))]
- ""
- "*
-{
- if (REG_P (operands[0])
- && GET_CODE (operands[1]) == MULT
- && GET_CODE (XEXP (operands[1], 1)) == CONST_INT
- && (INTVAL (XEXP (operands[1], 1)) == 2
- || INTVAL (XEXP (operands[1], 1)) == 4))
- {
- rtx xoperands[3];
- xoperands[0] = operands[0];
- xoperands[1] = XEXP (operands[1], 0);
- xoperands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (XEXP (operands[1], 1)) >> 1);
- return output_shift_insn (xoperands);
- }
- return \"addr %a1,%0\";
-}")
-
-;;; Index insns. These are about the same speed as multiply-add counterparts.
-;;; but slower then using power-of-2 shifts if we can use them
-;
-;(define_insn ""
-; [(set (match_operand:SI 0 "register_operand" "=r")
-; (plus:SI (match_operand:SI 1 "general_operand" "rmn")
-; (mult:SI (match_operand:SI 2 "register_operand" "0")
-; (plus:SI (match_operand:SI 3 "general_operand" "rmn") (const_int 1)))))]
-; "GET_CODE (operands[3]) != CONST_INT || INTVAL (operands[3]) > 8"
-; "indexd %0,%3,%1")
-;
-;(define_insn ""
-; [(set (match_operand:SI 0 "register_operand" "=r")
-; (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "0")
-; (plus:SI (match_operand:SI 2 "general_operand" "rmn") (const_int 1)))
-; (match_operand:SI 3 "general_operand" "rmn")))]
-; "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 8"
-; "indexd %0,%2,%3")
-
-;; Set, Clear, and Invert bit
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "rmn"))
- (const_int 1))]
- ""
- "sbitd %1,%0")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "rmn"))
- (const_int 0))]
- ""
- "cbitd %1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "+g")
- (xor:SI (ashift:SI (const_int 1)
- (match_operand:SI 1 "general_operand" "rmn"))
- (match_dup 0)))]
- ""
- "ibitd %1,%0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g")
- (xor:QI (subreg:QI
- (ashift:SI (const_int 1)
- (match_operand:QI 1 "general_operand" "rmn")) 0)
- (match_dup 0)))]
- ""
- "ibitb %1,%0")
-
-;; Recognize jbs and jbc instructions.
-
-(define_insn ""
- [(set (cc0)
- (zero_extract (match_operand:SI 0 "general_operand" "rm")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "g")))]
- ""
- "*
-{ cc_status.flags = CC_Z_IN_F;
- return \"tbitd %1,%0\";
-}")
-
-;; extract(base, width, offset)
-;; Signed bitfield extraction is not supported in hardware on the
-;; NS 32032. It is therefore better to let GCC figure out a
-;; good strategy for generating the proper instruction sequence
-;; and represent it as rtl.
-
-;; Optimize the case of extracting a byte or word from a register.
-;; Otherwise we must load a register with the offset of the
-;; chunk we want, and perform an extract insn (each of which
-;; is very expensive). Since we use the stack to do our bit-twiddling
-;; we cannot use it for a destination. Perhaps things are fast
-;; enough on the 32532 that such hacks are not needed.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=ro")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "const_int_operand" "i")))]
- "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
- && (INTVAL (operands[3]) == 8 || INTVAL (operands[3]) == 16 || INTVAL (operands[3]) == 24)"
- "*
-{
- output_asm_insn (\"movd %1,tos\", operands);
- if (INTVAL (operands[2]) == 16)
- {
- if (INTVAL (operands[3]) == 8)
- output_asm_insn (\"movzwd 1(sp),%0\", operands);
- else
- output_asm_insn (\"movzwd 2(sp),%0\", operands);
- }
- else
- {
- if (INTVAL (operands[3]) == 8)
- output_asm_insn (\"movzbd 1(sp),%0\", operands);
- else if (INTVAL (operands[3]) == 16)
- output_asm_insn (\"movzbd 2(sp),%0\", operands);
- else
- output_asm_insn (\"movzbd 3(sp),%0\", operands);
- }
- if (TARGET_32532 || TARGET_32332)
- return \"cmpqd %$0,tos\";
- else
- return \"adjspb %$-4\";
-}")
-
-;; The exts/ext instructions have the problem that they always access
-;; 32 bits even if the bitfield is smaller. For example the instruction
-;; extsd 7(r1),r0,2,5
-;; would read not only at address 7(r1) but also at 8(r1) to 10(r1).
-;; If these addresses are in a different (unmapped) page a memory fault
-;; is the result.
-;;
-;; Timing considerations:
-;; movd 0(r1),r0 3 bytes
-;; lshd -26,r0 4
-;; andd 0x1f,r0 5
-;; takes about 13 cycles on the 532 while
-;; extsd 7(r1),r0,2,5 5 bytes
-;; takes about 21 cycles.
-;;
-;; The inss/ins instructions suffer from the same problem.
-;;
-;; A machine specific option (-mbitfield/-mnobitfield) is used
-;; to allow/disallow the use of these instructions.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "g")
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "general_operand" "rK")))]
- "TARGET_BITFIELD"
- "*
-{ if (GET_CODE (operands[3]) == CONST_INT)
- return \"extsd %1,%0,%3,%2\";
- else return \"extd %3,%1,%0,%2\";
-}")
-
-(define_insn "extzv"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (zero_extract:SI (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "general_operand" "rK")))]
- "TARGET_BITFIELD"
- "*
-{ if (GET_CODE (operands[3]) == CONST_INT)
- return \"extsd %1,%0,%3,%2\";
- else return \"extd %3,%1,%0,%2\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "memory_operand" "+o")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "general_operand" "rn"))
- (match_operand:SI 3 "general_operand" "rm"))]
- "TARGET_BITFIELD"
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) >= 8)
- {
- operands[0] = adj_offsettable_operand (operands[0],
- INTVAL (operands[2]) / 8);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) % 8);
- }
- if (INTVAL (operands[1]) <= 8)
- return \"inssb %3,%0,%2,%1\";
- else if (INTVAL (operands[1]) <= 16)
- return \"inssw %3,%0,%2,%1\";
- else
- return \"inssd %3,%0,%2,%1\";
- }
- return \"insd %2,%3,%0,%1\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "general_operand" "rK"))
- (match_operand:SI 3 "general_operand" "rm"))]
- "TARGET_BITFIELD"
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- if (INTVAL (operands[1]) <= 8)
- return \"inssb %3,%0,%2,%1\";
- else if (INTVAL (operands[1]) <= 16)
- return \"inssw %3,%0,%2,%1\";
- else
- return \"inssd %3,%0,%2,%1\";
- return \"insd %2,%3,%0,%1\";
-}")
-
-(define_insn "insv"
- [(set (zero_extract:SI (match_operand:QI 0 "general_operand" "+g")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "general_operand" "rK"))
- (match_operand:SI 3 "general_operand" "rm"))]
- "TARGET_BITFIELD"
- "*
-{ if (GET_CODE (operands[2]) == CONST_INT)
- if (INTVAL (operands[1]) <= 8)
- return \"inssb %3,%0,%2,%1\";
- else if (INTVAL (operands[1]) <= 16)
- return \"inssw %3,%0,%2,%1\";
- else
- return \"inssd %3,%0,%2,%1\";
- return \"insd %2,%3,%0,%1\";
-}")
-
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "br %l0")
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"bfc %l0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"bfs %l0\";
- else return \"beq %l0\";
-}")
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"bfs %l0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"bfc %l0\";
- else return \"bne %l0\";
-}")
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "bgt %l0")
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "bhi %l0")
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "blt %l0")
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "blo %l0")
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "bge %l0")
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "bhs %l0")
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "ble %l0")
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "bls %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"bfs %l0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"bfc %l0\";
- else return \"bne %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"bfc %l0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"bfs %l0\";
- else return \"beq %l0\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "ble %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "bls %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "bge %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "bhs %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "blt %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "blo %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "bgt %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "bhi %l0")
-
-;; Subtract-and-jump and Add-and-jump insns.
-;; These can actually be used for adding numbers in the range -8 to 7
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operand:SI 0 "general_operand" "+g")
- (match_operand:SI 1 "const_int_operand" "i"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 0)
- (minus:SI (match_dup 0)
- (match_dup 1)))]
- "INTVAL (operands[1]) > -8 && INTVAL (operands[1]) <= 8"
- "acbd %$%n1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operand:SI 0 "general_operand" "+g")
- (match_operand:SI 1 "const_int_operand" "i"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (match_operand:SI 3 "const_int_operand" "i")))]
- "INTVAL (operands[1]) == - INTVAL (operands[3])
- && INTVAL (operands[3]) >= -8 && INTVAL (operands[3]) < 8"
- "acbd %3,%0,%l2")
-
-(define_insn "call"
- [(call (match_operand:QI 0 "memory_operand" "m")
- (match_operand:QI 1 "general_operand" "g"))]
- ""
- "*
-{
-#ifndef JSR_ALWAYS
- if (GET_CODE (operands[0]) == MEM)
- {
- rtx temp = XEXP (operands[0], 0);
- if (CONSTANT_ADDRESS_P (temp))
- {
-#ifdef ENCORE_ASM
- return \"bsr %?%0\";
-#else
-#ifdef CALL_MEMREF_IMPLICIT
- operands[0] = temp;
- return \"bsr %0\";
-#else
-#ifdef GNX_V3
- return \"bsr %0\";
-#else
- return \"bsr %?%a0\";
-#endif
-#endif
-#endif
- }
- if (GET_CODE (XEXP (operands[0], 0)) == REG)
-#if defined (GNX_V3) || defined (CALL_MEMREF_IMPLICIT)
- return \"jsr %0\";
-#else
- return \"jsr %a0\";
-#endif
- }
-#endif /* not JSR_ALWAYS */
- return \"jsr %0\";
-}")
-
-(define_insn "call_value"
- [(set (match_operand 0 "" "=rf")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
-#ifndef JSR_ALWAYS
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx temp = XEXP (operands[1], 0);
- if (CONSTANT_ADDRESS_P (temp))
- {
-#ifdef ENCORE_ASM
- return \"bsr %?%1\";
-#else
-#ifdef CALL_MEMREF_IMPLICIT
- operands[1] = temp;
- return \"bsr %1\";
-#else
-#ifdef GNX_V3
- return \"bsr %1\";
-#else
- return \"bsr %?%a1\";
-#endif
-#endif
-#endif
- }
- if (GET_CODE (XEXP (operands[1], 0)) == REG)
-#if defined (GNX_V3) || defined (CALL_MEMREF_IMPLICIT)
- return \"jsr %1\";
-#else
- return \"jsr %a1\";
-#endif
- }
-#endif /* not JSR_ALWAYS */
- return \"jsr %1\";
-}")
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-(define_insn "return"
- [(return)]
- "0"
- "ret 0")
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "general_operand" "=fm<")
- (abs:SF (match_operand:SF 1 "general_operand" "fmF")))]
- "TARGET_32081"
- "absf %1,%0")
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "general_operand" "=fm<")
- (abs:DF (match_operand:DF 1 "general_operand" "fmF")))]
- "TARGET_32081"
- "absl %1,%0")
-
-(define_insn "abssi2"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (abs:SI (match_operand:SI 1 "general_operand" "rmn")))]
- ""
- "absd %1,%0")
-
-(define_insn "abshi2"
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (abs:HI (match_operand:HI 1 "general_operand" "g")))]
- ""
- "absw %1,%0")
-
-(define_insn "absqi2"
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (abs:QI (match_operand:QI 1 "general_operand" "g")))]
- ""
- "absb %1,%0")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
- ""
- "jump %0")
-
-(define_insn "tablejump"
- [(set (pc)
- (plus:SI (pc) (match_operand:SI 0 "general_operand" "g")))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "*
-{
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\",
- CODE_LABEL_NUMBER (operands[1]));
- return \"cased %0\";
-}")
-
-;; Scondi instructions
-(define_insn "seq"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (eq:SI (cc0) (const_int 0)))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"sfcd %0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"sfsd %0\";
- else return \"seqd %0\";
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (eq:HI (cc0) (const_int 0)))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"sfcw %0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"sfsw %0\";
- else return \"seqw %0\";
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (eq:QI (cc0) (const_int 0)))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"sfcb %0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"sfsb %0\";
- else return \"seqb %0\";
-}")
-
-(define_insn "sne"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (ne:SI (cc0) (const_int 0)))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"sfsd %0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"sfcd %0\";
- else return \"sned %0\";
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (ne:HI (cc0) (const_int 0)))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"sfsw %0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"sfcw %0\";
- else return \"snew %0\";
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (ne:QI (cc0) (const_int 0)))]
- ""
- "*
-{ if (cc_prev_status.flags & CC_Z_IN_F)
- return \"sfsb %0\";
- else if (cc_prev_status.flags & CC_Z_IN_NOT_F)
- return \"sfcb %0\";
- else return \"sneb %0\";
-}")
-
-(define_insn "sgt"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (gt:SI (cc0) (const_int 0)))]
- ""
- "sgtd %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (gt:HI (cc0) (const_int 0)))]
- ""
- "sgtw %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (gt:QI (cc0) (const_int 0)))]
- ""
- "sgtb %0")
-
-(define_insn "sgtu"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (gtu:SI (cc0) (const_int 0)))]
- ""
- "shid %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (gtu:HI (cc0) (const_int 0)))]
- ""
- "shiw %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (gtu:QI (cc0) (const_int 0)))]
- ""
- "shib %0")
-
-(define_insn "slt"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (lt:SI (cc0) (const_int 0)))]
- ""
- "sltd %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (lt:HI (cc0) (const_int 0)))]
- ""
- "sltw %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (lt:QI (cc0) (const_int 0)))]
- ""
- "sltb %0")
-
-(define_insn "sltu"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (ltu:SI (cc0) (const_int 0)))]
- ""
- "slod %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (ltu:HI (cc0) (const_int 0)))]
- ""
- "slow %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (ltu:QI (cc0) (const_int 0)))]
- ""
- "slob %0")
-
-(define_insn "sge"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (ge:SI (cc0) (const_int 0)))]
- ""
- "sged %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (ge:HI (cc0) (const_int 0)))]
- ""
- "sgew %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (ge:QI (cc0) (const_int 0)))]
- ""
- "sgeb %0")
-
-(define_insn "sgeu"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (geu:SI (cc0) (const_int 0)))]
- ""
- "shsd %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (geu:HI (cc0) (const_int 0)))]
- ""
- "shsw %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (geu:QI (cc0) (const_int 0)))]
- ""
- "shsb %0")
-
-(define_insn "sle"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (le:SI (cc0) (const_int 0)))]
- ""
- "sled %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (le:HI (cc0) (const_int 0)))]
- ""
- "slew %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (le:QI (cc0) (const_int 0)))]
- ""
- "sleb %0")
-
-(define_insn "sleu"
- [(set (match_operand:SI 0 "general_operand" "=g<")
- (leu:SI (cc0) (const_int 0)))]
- ""
- "slsd %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g<")
- (leu:HI (cc0) (const_int 0)))]
- ""
- "slsw %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g<")
- (leu:QI (cc0) (const_int 0)))]
- ""
- "slsb %0")
-
-;; ffs instructions
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "ro")
- (minus:SI
- (plus:SI (ffs:SI (zero_extract:SI
- (match_operand:SI 1 "general_operand" "g")
- (minus:SI (const_int 32) (match_dup 0))
- (match_dup 0)))
- (match_dup 0))
- (const_int 1)))]
- ""
- "ffsd %1,%0; bfc 1f; addqd %$-1,%0; 1:")
-
-(define_expand "ffssi2"
- [(set (match_operand:SI 0 "general_operand" "=g") (const_int 0))
- (set (match_dup 0)
- (minus:SI
- (plus:SI (ffs:SI (zero_extract:SI
- (match_operand:SI 1 "general_operand" "g")
- (minus:SI (const_int 32) (match_dup 0))
- (match_dup 0)))
- (match_dup 0))
- (const_int 1)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- ""
- "operands[1] = make_safe_from(operands[1], operands[0]);")
-
-;; Speed up stack adjust followed by a HI fixedpoint push.
-
-(define_peephole
- [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int -2)))
- (set (match_operand:HI 0 "push_operand" "=m")
- (match_operand:HI 1 "general_operand" "g"))]
- "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,tos\"),
- operands);
- else
- output_asm_insn (\"movzwd %1,tos\", operands);
- return \"\";
-}")
-
-;; Speed up stack adjust followed by a zero_extend:HI(QI) fixedpoint push.
-
-(define_peephole
- [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int -2)))
- (set (match_operand:HI 0 "push_operand" "=m")
- (zero_extend:HI (match_operand:QI 1 "general_operand" "g")))]
- "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,tos\"),
- operands);
- else
- output_asm_insn (\"movzbd %1,tos\", operands);
- return \"\";
-}")
-
-;; Speed up stack adjust followed by a sign_extend:HI(QI) fixedpoint push.
-
-(define_peephole
- [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int -2)))
- (set (match_operand:HI 0 "push_operand" "=m")
- (sign_extend:HI (match_operand:QI 1 "general_operand" "g")))]
- "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,tos\"),
- operands);
- else
- output_asm_insn (\"movxbd %1,tos\", operands);
- return \"\";
-}")
-
-;; Speed up stack adjust followed by a QI fixedpoint push.
-
-(define_peephole
- [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int -3)))
- (set (match_operand:QI 0 "push_operand" "=m")
- (match_operand:QI 1 "general_operand" "g"))]
- "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,tos\"),
- operands);
- else
- output_asm_insn (\"movzbd %1,tos\", operands);
- return \"\";
-}")
-
-;; Speed up stack adjust followed by a SI fixedpoint push.
-
-(define_peephole
- [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int 4)))
- (set (match_operand:SI 0 "push_operand" "=m")
- (match_operand:SI 1 "general_operand" "g"))]
- "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,0(sp)\"),
- operands);
- else if (GET_CODE (operands[1]) != REG
- && GET_CODE (operands[1]) != MEM
- && address_operand (operands[1], SImode))
- output_asm_insn (\"addr %a1,0(sp)\", operands);
- else
- output_asm_insn (\"movd %1,0(sp)\", operands);
- return \"\";
-}")
-
-;; Speed up stack adjust followed by two fullword fixedpoint pushes.
-
-(define_peephole
- [(set (reg:SI 17) (plus:SI (reg:SI 17) (const_int 8)))
- (set (match_operand:SI 0 "push_operand" "=m")
- (match_operand:SI 1 "general_operand" "g"))
- (set (match_operand:SI 2 "push_operand" "=m")
- (match_operand:SI 3 "general_operand" "g"))]
- "! reg_mentioned_p (stack_pointer_rtx, operands[1])
- && ! reg_mentioned_p (stack_pointer_rtx, operands[3])"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- output_asm_insn (output_move_dconst (INTVAL (operands[1]), \"%$%1,4(sp)\"),
- operands);
- else if (GET_CODE (operands[1]) != REG
- && GET_CODE (operands[1]) != MEM
- && address_operand (operands[1], SImode))
- output_asm_insn (\"addr %a1,4(sp)\", operands);
- else
- output_asm_insn (\"movd %1,4(sp)\", operands);
-
- if (GET_CODE (operands[3]) == CONST_INT)
- output_asm_insn (output_move_dconst (INTVAL (operands[3]), \"%$%3,0(sp)\"),
- operands);
- else if (GET_CODE (operands[3]) != REG
- && GET_CODE (operands[3]) != MEM
- && address_operand (operands[3], SImode))
- output_asm_insn (\"addr %a3,0(sp)\", operands);
- else
- output_asm_insn (\"movd %3,0(sp)\", operands);
- return \"\";
-}")
diff --git a/gcc/config/ns32k/pc532-mach.h b/gcc/config/ns32k/pc532-mach.h
deleted file mode 100644
index 0aeabad32d9..00000000000
--- a/gcc/config/ns32k/pc532-mach.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- PC532 with National 32532, running Mach 3.0.
- Copyright (C) 1992, 1994 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. */
-
-#include "ns32k/pc532.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dns32532 -DPC532 -DMACH=1 -Asystem(unix) -Asystem(mach) -Acpu(ns32k) -Amachine(ns32k)"
-
-/* There's a bug in the setjmp implementation that strikes
- if the caller of setjmp doesn't have a frame pointer. */
-#undef FRAME_POINTER_REQUIRED
-#define FRAME_POINTER_REQUIRED current_function_calls_setjmp
diff --git a/gcc/config/ns32k/pc532-min.h b/gcc/config/ns32k/pc532-min.h
deleted file mode 100644
index 9d3d5de7556..00000000000
--- a/gcc/config/ns32k/pc532-min.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- PC532 with National 32532, running Minix.
- Works with pc532 Minix 1.5hybrid.
- Copyright (C) 1990 Free Software Foundation, Inc.
-
- Derived from SEQUENT NS32000, written originally
- by Bruce Culbertson <culberts@hplabs.hp.com>,
- hacked for easier fit in gcc by Jyrki Kuoppala <jkp@cs.hut.fi>.
-
-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 "ns32k/pc532.h"
-
-/* Minix has crtso.o instead of crt0.o */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{pg:gcrtso.o%s}%{!pg:%{p:mcrtso.o%s}%{!p:crtso.o%s}}"
-
-/* our setjmp doesn't save registers, so we must tell gcc to save
- call-saved-regs in a function calling setjmp */
-
-#define NON_SAVING_SETJMP (current_function_calls_setjmp)
-
-/* at least with estdio there's no _cleanup() but we have atexit() */
-
-#define HAVE_ATEXIT
diff --git a/gcc/config/ns32k/pc532.h b/gcc/config/ns32k/pc532.h
deleted file mode 100644
index d98bf43d044..00000000000
--- a/gcc/config/ns32k/pc532.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- PC532 with National 32532.
- Copyright (C) 1990, 1994 Free Software Foundation, Inc.
- Contributed by Jukka Virtanen <jtv@hut.fi>, Jyrki Kuoppala <jkp@cs.hut.fi>,
- Tatu Yl|nen <ylo@ngs.fi>, Johannes Helander <jvh@cs.hut.fi>.
-
-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 "ns32k/ns32k.h"
-
-/* Compile for the floating point unit & 32532 by default;
- also presume SB is zero and no bitfield instructions */
-
-#define TARGET_DEFAULT (1 + 24 + 64)
-
-/* Write DBX debugging info for gdb to read */
-
-#define DBX_DEBUGGING_INFO
-
-/* Use the re-entrant and potentially faster method */
-
-#undef PCC_STATIC_STRUCT_RETURN
-
-/* 32-bit alignment for efficiency */
-#undef POINTER_BOUNDARY
-#define POINTER_BOUNDARY 32
-
-/* 32-bit alignment for efficiency */
-#undef FUNCTION_BOUNDARY
-#define FUNCTION_BOUNDARY 32
-
-/* 32532 spec says it can handle any alignment. Rumor from tm-ns32k.h
- tells this might not be actually true (but it's for 32032, perhaps
- National has fixed the bug for 32532). You might have to change this
- if the bug still exists. */
-
-#undef STRICT_ALIGNMENT
-#define STRICT_ALIGNMENT 0
-
-/* Maybe someone needs to know which processor we're running on */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dns32000 -Dns32532 -Dpc532 -Dunix -Asystem(unix) -Acpu(ns32k) -Amachine(ns32k)"
-
-/* Use pc relative addressing whenever possible,
- it's more efficient than absolute (ns32k.c)
- You have to fix a bug in gas 1.38.1 to make this work with gas,
- patch available from jkp@cs.hut.fi. */
-
-#define PC_RELATIVE
-
-/* Operand of bsr or jsr should be just the address. */
-
-#define CALL_MEMREF_IMPLICIT
-
-/* movd insns may have floating point constant operands. */
-
-#define MOVD_FLOAT_OK
diff --git a/gcc/config/ns32k/sequent.h b/gcc/config/ns32k/sequent.h
deleted file mode 100644
index 1165aa31d36..00000000000
--- a/gcc/config/ns32k/sequent.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Definitions of target machine for GNU compiler. SEQUENT NS32000 version.
- Copyright (C) 1987 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@mcc.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 "ns32k/ns32k.h"
-
-/* This is BSD, so it wants DBX format. */
-#define DBX_DEBUGGING_INFO
-
-/* Sequent has some changes in the format of DBX symbols. */
-#define DBX_NO_XREFS 1
-
-/* Don't split DBX symbols into continuations. */
-#define DBX_CONTIN_LENGTH 0
-
-#define TARGET_DEFAULT 9 /* 32332 with 32081 (guessing). */
-
-/* Print subsidiary information on the compiler version in use. */
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (32000, Sequent syntax)");
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dns32000 -Dsequent -Dunix -Asystem(unix) -Asystem(bsd) -Acpu(ns32k) -Amachine(ns32k)"
-
-/* Link with libg.a when debugging, for dbx's sake. */
-
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
-
-/* gcc should find libgcc.a itself, not ask linker to do so. */
-
-#define LINK_LIBGCC_SPECIAL
-
-/* GCC must match what sys/types.h uses for size_t. */
-
-#define SIZE_TYPE "int"
-
-/* This is how to align the code that follows an unconditional branch.
- Don't define it, since it confuses the assembler (we hear). */
-
-#undef ASM_OUTPUT_ALIGN_CODE
-
-/* Assembler pseudo-op for shared data segment. */
-#define SHARED_SECTION_ASM_OP ".shdata"
-
-/* Control how stack adjust insns are output. */
-#define SEQUENT_ADJUST_STACK
-
-#define NO_ABSOLUTE_PREFIX_IF_SYMBOLIC
-
-#define IMMEDIATE_PREFIX 0
-
-#define SEQUENT_ASM
-
-/* Operand of bsr or jsr should be just the address. */
-
-#define CALL_MEMREF_IMPLICIT
-
-/* Output a reg as an index rather than a base if we have the choice. */
-
-#define INDEX_RATHER_THAN_BASE
diff --git a/gcc/config/ns32k/tek6000.h b/gcc/config/ns32k/tek6000.h
deleted file mode 100644
index 00ddc96498b..00000000000
--- a/gcc/config/ns32k/tek6000.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/* Definitions of target machine for GNU compiler.
- Generic Tektronix 6000 series NS32000 version.
- See ns32k/tek6100.h and ns32k/tek6200.h, which include this file.
- Copyright (C) 1990 Free Software Foundation, Inc.
- Created by Snoopy (sopwith.uucp!snoopy).
- Based on work by Mark Mason (mason@reed.bitnet,
- pyramid!unify!mason@uunet.uu.net) and Keith Packard.
-
-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. */
-
-/* Generate syntax for the UTek assembler. */
-#ifndef UTEK_ASM
-#define UTEK_ASM
-#endif
-
-/* Two flags to control how addresses are printed in assembler insns. */
-
-/* The way PUT_ABSOLUTE_PREFIX in ns32k.h works, setting it to 0 will
- * turn it off. Define ABSOLUTE_PREFIX before including ns32k.h.
- */
-#define ABSOLUTE_PREFIX 0
-#define IMMEDIATE_PREFIX '$'
-
-#include "ns32k/ns32k.h"
-
-/* Define these after ns32k.c so we will notice if gcc tries to
- * output external mode addressing. UTek's as and ld do not support
- * external mode addressing, according to Daryl McDaniel (illian.uucp!darylm).
- * Hopefully the UTek assembler will complain if gcc feeds it this stuff.
- * They don't seem to do anything, I think that gcc is not actually
- * trying to generate external mode operands.
- */
-#undef PUT_EXTERNAL_PREFIX
-#define PUT_EXTERNAL_PREFIX(arg) fprintf(arg, " Should not be using external mode under UTek. ")
-#define EXTERNAL_PREFIX '%'
-
-/* Used in ns32k.c to control syntax. */
-#define NO_ABSOLUTE_PREFIX_IF_SYMBOLIC
-#define NO_IMMEDIATE_PREFIX_IF_SYMBOLIC
-
-/* Used in ns32k.md to specify syntax of bsr/jsr operand. */
-#define CALL_MEMREF_IMPLICIT
-
-/* #define PC_RELATIVE */ /* Seems to break things. */
-#define BASE_REG_NEEDED /* Seems to fix problem where external mode
- * syntax was being generated.
- */
-
-/* ------------ Debugging Support ----------------------------- */
-
-/* The sdb support does not yet work with UTek. Need to teach gcc
- * how to create sdb type stabs as well as dbx style stabs.
- */
-#define DBX_DEBUGGING_INFO
-/* #define SDB_DEBUGGING_INFO */
-
-/* Act the same as the UTek complier: -g for dbx, -go for sdb.
- * This is used in toplev.c.
- */
-#define PREFERRED_DEBUGGING_TYPE \
- ((len > 1 && !strncmp(str, "go", len)) ? SDB_DEBUG : DBX_DEBUG )
-
-/* Sequent has some changes in the format of DBX symbols. */
-#define DBX_NO_XREFS 1
-
-/* Don't split DBX symbols into continuations. */
-#define DBX_CONTIN_LENGTH 0
-
-/* ------------------------------------------- */
-
-#define TARGET_DEFAULT 1
-
-/* These control the C++ compiler somehow. */
-#define FASCIST_ASSEMBLER
-#define USE_COLLECT
-
-/* Print subsidiary information on the compiler version in use. */
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (ns32k, UTek syntax)");
-
-/* The tek6100.h and tek6200.h files add stratos or merlin respectively. */
-
-#define CPP_PREDEFINES_Tek6000 \
- "-Dns16000 -Dns32000 -Dns32k -Dns32016 -DUTek -DUTEK -Dbsd -DBSD \
- -Asystem(unix) -Asystem(bsd) -Acpu(ns32k) -Amachine(ns32k)"
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES CPP_PREDEFINES_Tek6000
-
-/* This is how to align the code that follows an unconditional branch.
- Don't define it, since it confuses the assembler (we hear). */
-
-#undef ASM_OUTPUT_ALIGN_CODE
-
-/* Assembler pseudo-op for shared data segment. */
-#define SHARED_SECTION_ASM_OP ".shdata"
-
-#ifdef UTEK_ASM
-#undef FUNCTION_PROLOGUE
-
-/* This differs from the one in ns32k.h in printing a bitmask
- rather than a register list in the enter or save instruction. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int regno, g_regs_used = 0; \
- int used_regs_buf[8], *bufp = used_regs_buf; \
- int used_fregs_buf[8], *fbufp = used_fregs_buf; \
- extern char call_used_regs[]; \
- MAIN_FUNCTION_PROLOGUE; \
- for (regno = 0; regno < 8; regno++) \
- if (regs_ever_live[regno] \
- && ! call_used_regs[regno]) \
- { \
- *bufp++ = regno; g_regs_used++; \
- } \
- *bufp = -1; \
- for (; regno < 16; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) { \
- *fbufp++ = regno; \
- } \
- *fbufp = -1; \
- bufp = used_regs_buf; \
- if (frame_pointer_needed) \
- fprintf (FILE, "\tenter "); \
- else if (g_regs_used) \
- fprintf (FILE, "\tsave "); \
- if (frame_pointer_needed || g_regs_used) \
- { \
- char mask = 0; \
- while (*bufp >= 0) \
- mask |= 1 << *bufp++; \
- fprintf (FILE, "$0x%x", (int) mask & 0xff); \
- } \
- if (frame_pointer_needed) \
- fprintf (FILE, ",$%d\n", SIZE); \
- else if (g_regs_used) \
- fprintf (FILE, "\n"); \
- fbufp = used_fregs_buf; \
- while (*fbufp >= 0) \
- { \
- if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1)) \
- fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8); \
- else \
- { \
- fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8); \
- fbufp += 2; \
- } \
- } \
-}
-
-#undef FUNCTION_EPILOGUE
-
-/* This differs from the one in ns32k.h in printing a bitmask
- rather than a register list in the exit or restore instruction. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ register int regno, g_regs_used = 0, f_regs_used = 0; \
- int used_regs_buf[8], *bufp = used_regs_buf; \
- int used_fregs_buf[8], *fbufp = used_fregs_buf; \
- extern char call_used_regs[]; \
- *fbufp++ = -2; \
- for (regno = 8; regno < 16; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) { \
- *fbufp++ = regno; f_regs_used++; \
- } \
- fbufp--; \
- for (regno = 0; regno < 8; regno++) \
- if (regs_ever_live[regno] \
- && ! call_used_regs[regno]) \
- { \
- *bufp++ = regno; g_regs_used++; \
- } \
- while (fbufp > used_fregs_buf) \
- { \
- if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1) \
- { \
- fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8); \
- fbufp -= 2; \
- } \
- else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8); \
- } \
- if (frame_pointer_needed) \
- fprintf (FILE, "\texit "); \
- else if (g_regs_used) \
- fprintf (FILE, "\trestore "); \
- if (g_regs_used || frame_pointer_needed) \
- { \
- char mask = 0; \
- \
- while (bufp > used_regs_buf) \
- { \
- /* Utek assembler takes care of reversing this */ \
- mask |= 1 << *--bufp; \
- } \
- fprintf (FILE, "$0x%x\n", (int) mask & 0xff); \
- } \
- if (current_function_pops_args) \
- fprintf (FILE, "\tret $%d\n", current_function_pops_args); \
- else fprintf (FILE, "\tret $0\n"); }
-
-/* UTek assembler needs "ret $0", not "ret 0". */
-#undef TRANSFER_FROM_TRAMPOLINE
-#define TRANSFER_FROM_TRAMPOLINE \
-void \
-__transfer_from_trampoline () \
-{ \
- asm ("___trampoline:"); \
- asm ("movd 16(r2),tos"); \
- asm ("movd 12(r2),r2"); \
- asm ("ret $0"); \
-}
-
-#endif /* UTEK_ASM */
-
-#undef PRINT_OPERAND_ADDRESS
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR)
-
-/* The UTek library supplies bcopy() and friends, not memcpy(). */
-#ifdef TARGET_MEM_FUNCTIONS
-#undef TARGET_MEM_FUNCTIONS
-#endif
diff --git a/gcc/config/ns32k/tek6100.h b/gcc/config/ns32k/tek6100.h
deleted file mode 100644
index e5b385f1272..00000000000
--- a/gcc/config/ns32k/tek6100.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "ns32k/tek6000.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dns32000 -Dns32k -Dns16000 -Dns32016 -DUTek -DUTEK -Dbsd -DBSD -Dstratos \
- -Asystem(unix) -Asystem(bsd) -Acpu(ns32k) -Amachine(ns32k)"
-
diff --git a/gcc/config/ns32k/tek6200.h b/gcc/config/ns32k/tek6200.h
deleted file mode 100644
index c03f25534e7..00000000000
--- a/gcc/config/ns32k/tek6200.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "ns32k/tek6000.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dns32000 -Dns32k -Dns16000 -Dns32016 -DUTek -DUTEK -Dbsd -DBSD -Dmerlin \
- -Asystem(unix) -Asystem(bsd) -Acpu(ns32k) -Amachine(ns32k)"
-
diff --git a/gcc/config/ns32k/x-genix b/gcc/config/ns32k/x-genix
deleted file mode 100644
index 0598df8a193..00000000000
--- a/gcc/config/ns32k/x-genix
+++ /dev/null
@@ -1,6 +0,0 @@
-# Makefile modifications for compilation on Genix.
-ALLOCA=alloca.o
-MALLOC = malloc.o
-
-# You must get malloc.c and getpagesize.h from GNU Emacs.
-
diff --git a/gcc/config/ns32k/xm-ns32k.h b/gcc/config/ns32k/xm-ns32k.h
deleted file mode 100644
index a5ef3375da8..00000000000
--- a/gcc/config/ns32k/xm-ns32k.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Configuration for GNU C-compiler for Vax.
- Copyright (C) 1987, 1993 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-#define memcpy(src,dst,len) bcopy ((dst),(src),(len))
-#define memset gcc_memset
-#define memcmp(left,right,len) bcmp ((left),(right),(len))
diff --git a/gcc/config/ns32k/xm-pc532-min.h b/gcc/config/ns32k/xm-pc532-min.h
deleted file mode 100644
index a200792a0b2..00000000000
--- a/gcc/config/ns32k/xm-pc532-min.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Configuration for GNU C-compiler for PC532 running Minix
- Copyright (C) 1987,1990 Free Software Foundation, Inc.
- Contributed by Jyrki Kuoppala <jkp@cs.hut.fi>, August 1990
-
-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. */
-
-/* We have USG-style include files and time functions */
-
-#define USG
-
-#include "ns32k/xm-ns32k.h"
-
-#ifndef HZ
-#define HZ 60
-#endif
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif
diff --git a/gcc/config/pa/ee.asm b/gcc/config/pa/ee.asm
deleted file mode 100644
index 787bda75c0d..00000000000
--- a/gcc/config/pa/ee.asm
+++ /dev/null
@@ -1,261 +0,0 @@
-; Subroutines for out of line prologues and epilogues on for the HPPA
-; Copyright (C) 1994, 1995, 1996 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.
-
- .SPACE $PRIVATE$
- .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
- .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
- .SPACE $TEXT$
- .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
- .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
- .SUBSPA $MILLICODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=8
-
-; This is an out-of-line prologue.
-;
-; It performs the following operations:
-;
-; * Saves the return pointer at sp - 20
-;
-; * Creates a new stack frame (sp'), size of the frame is passed in %r21
-;
-; * The old stack pointer is saved at sp (frame pointer version only).
-;
-; * Saves grs (passed in low 16 bits of %r22 into the stack frame
-; at sp' + local_fsize (passed in %r19).
-;
-; * Saves frs (passed in high 16 bits of %r22) into the stack
-; frame at sp' + local_fsize (passed in %r19).
-;
-; * Sets up a frame pointer (in %r3) (frame pointer version only).
-;
-; * Returns to the instruction _immediately_ after the call to
-; this function.
-
- .SPACE $TEXT$
- .SUBSPA $MILLICODE$
- .EXPORT __outline_prologue,MILLICODE
- .align 32
-__outline_prologue
- .PROC
- .CALLINFO FRAME=0,NO_CALLS
- .ENTRY
- copy %r30,%r20
-
- ; Subtract 4 from our return pointer so that we return to
- ; the right location.
- ldo -4(%r31),%r31
-
- ; Save off %r2
- stw %r2,-20(0,%r30)
-
- ; Make our new frame.
- add %r21,%r30,%r30
-
- ; Add in local_fsize to our frame pointer so we do register
- ; saves into the right place
- add %r20,%r19,%r20
-
- ; %r22 tells us what registers we need to save. The upper half
- ; is for fp registers, the lower half for integer registers.
- ; We put the lower half in %r1 and the upper half into %r22
- ; for later use.
- extru %r22,31,16,%r1
- extrs %r22,15,16,%r22
-
- ; %r1 now olds a value 0-18 which corresponds to the number
- ; of grs we need to save. We need to reverse that value so
- ; we can just into the table and straight-line execute to the
- ; end of the gr saves.
- comb,= %r0,%r1,L$0000
- subi 18,%r1,%r1
- blr,n %r1,%r0
- b,n L$0000
- stws,ma %r18,4(0,%r20)
- nop
- stws,ma %r17,4(0,%r20)
- nop
- stws,ma %r16,4(0,%r20)
- nop
- stws,ma %r15,4(0,%r20)
- nop
- stws,ma %r14,4(0,%r20)
- nop
- stws,ma %r13,4(0,%r20)
- nop
- stws,ma %r12,4(0,%r20)
- nop
- stws,ma %r11,4(0,%r20)
- nop
- stws,ma %r10,4(0,%r20)
- nop
- stws,ma %r9,4(0,%r20)
- nop
- stws,ma %r8,4(0,%r20)
- nop
- stws,ma %r7,4(0,%r20)
- nop
- stws,ma %r6,4(0,%r20)
- nop
- stws,ma %r5,4(0,%r20)
- nop
- stws,ma %r4,4(0,%r20)
- nop
- stws,ma %r3,4(0,%r20)
- nop
-L$0000
- ; All gr saves are done. Align the temporary frame pointer and
- ; do the fr saves.
- ldo 7(%r20),%r20
- depi 0,31,3,%r20
-
- comb,= %r0,%r22,L$0001
- subi 21,%r22,%r22
- blr,n %r22,%r0
- b,n L$0001
- fstws,ma %fr21,8(0,%r20)
- nop
- fstws,ma %fr20,8(0,%r20)
- nop
- fstws,ma %fr19,8(0,%r20)
- nop
- fstws,ma %fr18,8(0,%r20)
- nop
- fstws,ma %fr17,8(0,%r20)
- nop
- fstws,ma %fr16,8(0,%r20)
- nop
- fstws,ma %fr15,8(0,%r20)
- nop
- fstws,ma %fr14,8(0,%r20)
- nop
- fstws,ma %fr13,8(0,%r20)
- nop
- fstws,ma %fr12,8(0,%r20)
- nop
-L$0001
- ; Return
- bv,n 0(%r31)
- .EXIT
- .PROCEND
-
-
-
- .EXPORT __outline_epilogue,MILLICODE
- .align 32
-__outline_epilogue
- .PROC
- .CALLINFO FRAME=0,NO_CALLS
- .ENTRY
- ; Get our original stack pointer and put it in %r20
- sub %r30,%r21,%r20
-
- ; Subtract 4 from our return pointer so that we return to
- ; the right location.
- ldo -4(%r31),%r31
-
- ; Reload %r2
- ldw -20(0,%r20),%r2
-
- ; Add in local_fsize (%r19) to the frame pointer to find
- ; the saved registers.
- add %r20,%r19,%r20
-
- ; %r22 tells us what registers we need to restore. The upper half
- ; is for fp registers, the lower half for integer registers.
- ; We put the lower half in %r1 and the upper half into %r22
- ; for later use.
- extru %r22,31,16,%r1
- extrs %r22,15,16,%r22
-
- ; %r1 now olds a value 0-18 which corresponds to the number
- ; of grs we need to restore. We need to reverse that value so
- ; we can just into the table and straight-line execute to the
- ; end of the gr restore.
- comb,= %r0,%r1,L$0004
- subi 18,%r1,%r1
- blr,n %r1,%r0
- b,n L$0004
- ldws,ma 4(0,%r20),%r18
- nop
- ldws,ma 4(0,%r20),%r17
- nop
- ldws,ma 4(0,%r20),%r16
- nop
- ldws,ma 4(0,%r20),%r15
- nop
- ldws,ma 4(0,%r20),%r14
- nop
- ldws,ma 4(0,%r20),%r13
- nop
- ldws,ma 4(0,%r20),%r12
- nop
- ldws,ma 4(0,%r20),%r11
- nop
- ldws,ma 4(0,%r20),%r10
- nop
- ldws,ma 4(0,%r20),%r9
- nop
- ldws,ma 4(0,%r20),%r8
- nop
- ldws,ma 4(0,%r20),%r7
- nop
- ldws,ma 4(0,%r20),%r6
- nop
- ldws,ma 4(0,%r20),%r5
- nop
- ldws,ma 4(0,%r20),%r4
- nop
- ldws,ma 4(0,%r20),%r3
- nop
-L$0004
- ; All gr restore are done. Align the temporary frame pointer and
- ; do the fr restore.
- ldo 7(%r20),%r20
- depi 0,31,3,%r20
-
- comb,= %r0,%r22,L$0005
- subi 21,%r22,%r22
- blr,n %r22,%r0
- b,n L$0005
- fldws,ma 8(0,%r20),%fr21
- nop
- fldws,ma 8(0,%r20),%fr20
- nop
- fldws,ma 8(0,%r20),%fr19
- nop
- fldws,ma 8(0,%r20),%fr18
- nop
- fldws,ma 8(0,%r20),%fr17
- nop
- fldws,ma 8(0,%r20),%fr16
- nop
- fldws,ma 8(0,%r20),%fr15
- nop
- fldws,ma 8(0,%r20),%fr14
- nop
- fldws,ma 8(0,%r20),%fr13
- nop
- fldws,ma 8(0,%r20),%fr12
- nop
-L$0005
- ; Return and deallocate our frame.
- bv 0(%r31)
- sub %r30,%r21,%r30
- .EXIT
- .PROCEND
diff --git a/gcc/config/pa/ee_fp.asm b/gcc/config/pa/ee_fp.asm
deleted file mode 100644
index ef040cf7dad..00000000000
--- a/gcc/config/pa/ee_fp.asm
+++ /dev/null
@@ -1,274 +0,0 @@
-; Subroutines for out of line prologues and epilogues on for the HPPA
-; Copyright (C) 1994, 1995, 1996 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.
-
- .SPACE $PRIVATE$
- .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
- .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
- .SPACE $TEXT$
- .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
- .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
- .SUBSPA $MILLICODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=8
-
-
-; This is an out-of-line prologue.
-;
-; It performs the following operations:
-;
-; * Saves the return pointer at sp - 20
-;
-; * Creates a new stack frame (sp'), size of the frame is passed in %r21
-;
-; * The old stack pointer is saved at sp (frame pointer version only).
-;
-; * Saves grs (passed in low 16 bits of %r22 into the stack frame
-; at sp' + local_fsize (passed in %r19).
-;
-; * Saves frs (passed in high 16 bits of %r22) into the stack
-; frame at sp' + local_fsize (passed in %r19).
-;
-; * Sets up a frame pointer (in %r3) (frame pointer version only).
-;
-; * Returns to the instruction _immediately_ after the call to
-; this function.
-
- .SPACE $TEXT$
- .SUBSPA $MILLICODE$
- .EXPORT __outline_prologue_fp,MILLICODE
- .align 32
-__outline_prologue_fp
- .PROC
- .CALLINFO FRAME=0,NO_CALLS
- .ENTRY
- copy %r30,%r20
-
- ; Subtract 4 from our return pointer so that we return to
- ; the right location.
- ldo -4(%r31),%r31
-
- ; Save off %r2
- stw %r2,-20(0,%r30)
-
- ; Make our new frame.
- add %r21,%r30,%r30
-
- ; Save our old stack pointer.
- stw %r20,0(0,%r20)
-
- ; Add in local_fsize to our frame pointer so we do register
- ; saves into the right place
- add %r20,%r19,%r20
-
- ; %r22 tells us what registers we need to save. The upper half
- ; is for fp registers, the lower half for integer registers.
- ; We put the lower half in %r1 and the upper half into %r22
- ; for later use.
- extru %r22,31,16,%r1
- extrs %r22,15,16,%r22
-
- ; %r1 now olds a value 0-18 which corresponds to the number
- ; of grs we need to save. We need to reverse that value so
- ; we can just into the table and straight-line execute to the
- ; end of the gr saves.
- comb,= %r0,%r1,L$0002
- subi 18,%r1,%r1
- blr,n %r1,%r0
- b,n L$0002
- stws,ma %r18,4(0,%r20)
- nop
- stws,ma %r17,4(0,%r20)
- nop
- stws,ma %r16,4(0,%r20)
- nop
- stws,ma %r15,4(0,%r20)
- nop
- stws,ma %r14,4(0,%r20)
- nop
- stws,ma %r13,4(0,%r20)
- nop
- stws,ma %r12,4(0,%r20)
- nop
- stws,ma %r11,4(0,%r20)
- nop
- stws,ma %r10,4(0,%r20)
- nop
- stws,ma %r9,4(0,%r20)
- nop
- stws,ma %r8,4(0,%r20)
- nop
- stws,ma %r7,4(0,%r20)
- nop
- stws,ma %r6,4(0,%r20)
- nop
- stws,ma %r5,4(0,%r20)
- nop
- stws,ma %r4,4(0,%r20)
- nop
- stws,ma %r3,4(0,%r20)
- nop
-L$0002
- ; All gr saves are done. Align the temporary frame pointer and
- ; do the fr saves.
- ldo 7(%r20),%r20
- depi 0,31,3,%r20
-
- comb,= %r0,%r22,L$0003
- subi 21,%r22,%r22
- blr,n %r22,%r0
- b,n L$0003
- fstws,ma %fr21,8(0,%r20)
- nop
- fstws,ma %fr20,8(0,%r20)
- nop
- fstws,ma %fr19,8(0,%r20)
- nop
- fstws,ma %fr18,8(0,%r20)
- nop
- fstws,ma %fr17,8(0,%r20)
- nop
- fstws,ma %fr16,8(0,%r20)
- nop
- fstws,ma %fr15,8(0,%r20)
- nop
- fstws,ma %fr14,8(0,%r20)
- nop
- fstws,ma %fr13,8(0,%r20)
- nop
- fstws,ma %fr12,8(0,%r20)
- nop
-L$0003
- ; Return, setting up a frame pointer in the delay slot
- bv 0(%r31)
- sub %r30,%r21,%r3
- .EXIT
- .PROCEND
-
-
-; This is an out-of-line epilogue. It's operation is basically the reverse
-; of the out-of-line prologue.
-
- .EXPORT __outline_epilogue_fp,MILLICODE
- .align 32
-__outline_epilogue_fp
- .PROC
- .CALLINFO FRAME=0,NO_CALLS
- .ENTRY
- ; Make a copy of our frame pointer into %r20
- copy %r3,%r20
-
- ; Subtract 4 from our return pointer so that we return to
- ; the right location.
- ldo -4(%r31),%r31
-
- ; Reload %r2
- ; First save off %r2
- ldw -20(0,%r20),%r2
-
- ; Load our old stack pointer, save it in %r21.
- ldw 0(0,%r20),%r21
-
- ; Add in local_fsize (%r19) to the frame pointer to find
- ; the saved registers.
- add %r20,%r19,%r20
-
- ; %r22 tells us what registers we need to restore. The upper half
- ; is for fp registers, the lower half for integer registers.
- ; We put the lower half in %r1 and the upper half into %r22
- ; for later use.
- extru %r22,31,16,%r1
- extrs %r22,15,16,%r22
-
- ; %r1 now olds a value 0-18 which corresponds to the number
- ; of grs we need to restore. We need to reverse that value so
- ; we can just into the table and straight-line execute to the
- ; end of the gr restore.
- comb,= %r0,%r1,L$0006
- subi 18,%r1,%r1
- blr,n %r1,%r0
- b,n L$0006
- ldws,ma 4(0,%r20),%r18
- nop
- ldws,ma 4(0,%r20),%r17
- nop
- ldws,ma 4(0,%r20),%r16
- nop
- ldws,ma 4(0,%r20),%r15
- nop
- ldws,ma 4(0,%r20),%r14
- nop
- ldws,ma 4(0,%r20),%r13
- nop
- ldws,ma 4(0,%r20),%r12
- nop
- ldws,ma 4(0,%r20),%r11
- nop
- ldws,ma 4(0,%r20),%r10
- nop
- ldws,ma 4(0,%r20),%r9
- nop
- ldws,ma 4(0,%r20),%r8
- nop
- ldws,ma 4(0,%r20),%r7
- nop
- ldws,ma 4(0,%r20),%r6
- nop
- ldws,ma 4(0,%r20),%r5
- nop
- ldws,ma 4(0,%r20),%r4
- nop
- ldws,ma 4(0,%r20),%r3
- nop
-L$0006
- ; All gr restore are done. Align the temporary frame pointer and
- ; do the fr restore.
- ldo 7(%r20),%r20
- depi 0,31,3,%r20
-
- comb,= %r0,%r22,L$0007
- subi 21,%r22,%r22
- blr,n %r22,%r0
- b,n L$0007
- fldws,ma 8(0,%r20),%fr21
- nop
- fldws,ma 8(0,%r20),%fr20
- nop
- fldws,ma 8(0,%r20),%fr19
- nop
- fldws,ma 8(0,%r20),%fr18
- nop
- fldws,ma 8(0,%r20),%fr17
- nop
- fldws,ma 8(0,%r20),%fr16
- nop
- fldws,ma 8(0,%r20),%fr15
- nop
- fldws,ma 8(0,%r20),%fr14
- nop
- fldws,ma 8(0,%r20),%fr13
- nop
- fldws,ma 8(0,%r20),%fr12
- nop
-L$0007
- ; Return and deallocate our frame.
- bv 0(%r31)
- copy %r21,%r30
- .EXIT
- .PROCEND
-
-
diff --git a/gcc/config/pa/lib1funcs.asm b/gcc/config/pa/lib1funcs.asm
deleted file mode 100644
index a3e4995f929..00000000000
--- a/gcc/config/pa/lib1funcs.asm
+++ /dev/null
@@ -1,1138 +0,0 @@
-; Low level integer divide, multiply, remainder, etc routines for the HPPA.
-; Copyright (C) 1995 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.
-
-#ifdef L_dyncall
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .export $$dyncall
-$$dyncall
- .proc
- .callinfo frame=0,no_calls
- .entry
- bb,>=,n %r22,30,L$1 ; branch if not plabel address
- depi 0,31,2,%r22 ; clear the two least significant bits
- ldw 4(%sr0,%r22),%r19 ; load new LTP value
- ldw 0(%sr0,%r22),%r22 ; load address of target
-L$1 ldsid (%sr0,%r22),%r1 ; get the "space ident" selected by r22
- mtsp %r1,%sr0 ; move that space identifier into sr0
- be 0(%sr0,%r22) ; branch to the real target
- stw %r2,-24(%sr0,%r30) ; save return address into frame marker
- .exit
- .procend
-#endif
-
-
-#ifdef L_multiply
-#define op0 %r26
-#define op1 %r25
-#define res %r29
-#define ret %r31
-#define tmp %r1
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$mulU
- .export $$mulI
-$$mulU
-$$mulI
- .proc
- .callinfo frame=0,no_calls
- .entry
- addi,tr 0,%r0,res ; clear out res, skip next insn
-L$loop zdep op1,26,27,op1 ; shift up op1 by 5
-L$lo zdep op0,30,5,tmp ; extract next 5 bits and shift up
- blr tmp,%r0
- extru op0,26,27,op0 ; shift down op0 by 5
-L$0 comib,<> 0,op0,L$lo
- zdep op1,26,27,op1 ; shift up op1 by 5
- bv %r0(ret)
- nop
-L$1 b L$loop
- addl op1,res,res
- nop
- nop
-L$2 b L$loop
- sh1addl op1,res,res
- nop
- nop
-L$3 sh1addl op1,op1,tmp ; 3x
- b L$loop
- addl tmp,res,res
- nop
-L$4 b L$loop
- sh2addl op1,res,res
- nop
- nop
-L$5 sh2addl op1,op1,tmp ; 5x
- b L$loop
- addl tmp,res,res
- nop
-L$6 sh1addl op1,op1,tmp ; 3x
- b L$loop
- sh1addl tmp,res,res
- nop
-L$7 zdep op1,28,29,tmp ; 8x
- sub tmp,op1,tmp ; 7x
- b L$loop
- addl tmp,res,res
-L$8 b L$loop
- sh3addl op1,res,res
- nop
- nop
-L$9 sh3addl op1,op1,tmp ; 9x
- b L$loop
- addl tmp,res,res
- nop
-L$10 sh2addl op1,op1,tmp ; 5x
- b L$loop
- sh1addl tmp,res,res
- nop
-L$11 sh2addl op1,op1,tmp ; 5x
- sh1addl tmp,op1,tmp ; 11x
- b L$loop
- addl tmp,res,res
-L$12 sh1addl op1,op1,tmp ; 3x
- b L$loop
- sh2addl tmp,res,res
- nop
-L$13 sh1addl op1,op1,tmp ; 3x
- sh2addl tmp,op1,tmp ; 13x
- b L$loop
- addl tmp,res,res
-L$14 zdep op1,28,29,tmp ; 8x
- sub tmp,op1,tmp ; 7x
- b L$loop
- sh1addl tmp,res,res
-L$15 zdep op1,27,28,tmp ; 16x
- sub tmp,op1,tmp ; 15x
- b L$loop
- addl tmp,res,res
-L$16 zdep op1,27,28,tmp ; 16x
- b L$loop
- addl tmp,res,res
- nop
-L$17 zdep op1,27,28,tmp ; 16x
- addl tmp,op1,tmp ; 17x
- b L$loop
- addl tmp,res,res
-L$18 sh3addl op1,op1,tmp ; 9x
- b L$loop
- sh1addl tmp,res,res
- nop
-L$19 sh3addl op1,op1,tmp ; 9x
- sh1addl tmp,op1,tmp ; 19x
- b L$loop
- addl tmp,res,res
-L$20 sh2addl op1,op1,tmp ; 5x
- b L$loop
- sh2addl tmp,res,res
- nop
-L$21 sh2addl op1,op1,tmp ; 5x
- sh2addl tmp,op1,tmp ; 21x
- b L$loop
- addl tmp,res,res
-L$22 sh2addl op1,op1,tmp ; 5x
- sh1addl tmp,op1,tmp ; 11x
- b L$loop
- sh1addl tmp,res,res
-L$23 sh1addl op1,op1,tmp ; 3x
- sh3addl tmp,res,res ; += 8x3
- b L$loop
- sub res,op1,res ; -= x
-L$24 sh1addl op1,op1,tmp ; 3x
- b L$loop
- sh3addl tmp,res,res ; += 8x3
- nop
-L$25 sh2addl op1,op1,tmp ; 5x
- sh2addl tmp,tmp,tmp ; 25x
- b L$loop
- addl tmp,res,res
-L$26 sh1addl op1,op1,tmp ; 3x
- sh2addl tmp,op1,tmp ; 13x
- b L$loop
- sh1addl tmp,res,res ; += 2x13
-L$27 sh1addl op1,op1,tmp ; 3x
- sh3addl tmp,tmp,tmp ; 27x
- b L$loop
- addl tmp,res,res
-L$28 zdep op1,28,29,tmp ; 8x
- sub tmp,op1,tmp ; 7x
- b L$loop
- sh2addl tmp,res,res ; += 4x7
-L$29 sh1addl op1,op1,tmp ; 3x
- sub res,tmp,res ; -= 3x
- b L$foo
- zdep op1,26,27,tmp ; 32x
-L$30 zdep op1,27,28,tmp ; 16x
- sub tmp,op1,tmp ; 15x
- b L$loop
- sh1addl tmp,res,res ; += 2x15
-L$31 zdep op1,26,27,tmp ; 32x
- sub tmp,op1,tmp ; 31x
-L$foo b L$loop
- addl tmp,res,res
- .exit
- .procend
-#endif
-
-
-#ifdef L_divU
-#define dividend %r26
-#define divisor %r25
-#define tmp %r1
-#define quotient %r29
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU
-$$divU
- .proc
- .callinfo frame=0,no_calls
- .entry
- comb,< divisor,0,L$largedivisor
- sub %r0,divisor,%r1 ; clear cy as side-effect
- ds %r0,%r1,%r0
- addc dividend,dividend,dividend
- ds %r0,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,quotient
- ds %r1,divisor,%r1
- bv 0(ret)
- addc quotient,quotient,quotient
-L$largedivisor
- comclr,<< dividend,divisor,quotient
- ldi 1,quotient
- bv,n 0(ret)
- .exit
- .procend
-#endif
-
-
-#ifdef L_remU
-#define dividend %r26
-#define divisor %r25
-#define quotient %r29
-#define tmp %r1
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$remU
-$$remU
- .proc
- .callinfo frame=0,no_calls
- .entry
- comb,< divisor,0,L$largedivisor
- sub %r0,divisor,%r1 ; clear cy as side-effect
- ds %r0,%r1,%r0
- addc dividend,dividend,dividend
- ds %r0,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,quotient
- ds %r1,divisor,%r1
- comclr,>= %r1,%r0,%r0
- addl %r1,divisor,%r1
- bv 0(ret)
- copy %r1,quotient
-L$largedivisor
- sub,>>= dividend,divisor,quotient
- copy dividend,quotient
- bv,n 0(ret)
- .exit
- .procend
-#endif
-
-
-#ifdef L_divI
-#define dividend %r26
-#define divisor %r25
-#define quotient %r29
-#define tmp %r1
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI
-$$divI
- .proc
- .callinfo frame=0,no_calls
- .entry
- xor dividend,divisor,quotient ; result sign
- comclr,>= divisor,%r0,%r0 ; get absolute values
- sub %r0,divisor,divisor
- comclr,>= dividend,%r0,%r0
- sub %r0,dividend,dividend
-
- comb,< divisor,0,L$largedivisor
- sub %r0,divisor,%r1 ; clear cy as side-effect
- ds %r0,%r1,%r0
- addc dividend,dividend,dividend
- ds %r0,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- comclr,>= %r1,%r0,%r0
- addl %r1,divisor,%r1
- comclr,>= quotient,%r0,%r0 ; skip of no need to negate
- sub %r0,dividend,dividend
- bv 0(ret)
- copy dividend,quotient
-L$largedivisor
- comclr,<< dividend,divisor,quotient
- ldi 1,quotient
- bv,n 0(ret)
- .exit
- .procend
-#endif
-
-
-#ifdef L_remI
-#define dividend %r26
-#define divisor %r25
-#define quotient %r29
-#define tmp %r1
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$remI
-$$remI
- .proc
- .callinfo frame=0,no_calls
- .entry
- xor dividend,%r0,quotient ; result sign
- comclr,>= divisor,%r0,%r0 ; get absolute values
- sub %r0,divisor,divisor
- comclr,>= dividend,%r0,%r0
- sub %r0,dividend,dividend
-
- comb,< divisor,0,L$largedivisor
- sub %r0,divisor,%r1 ; clear cy as side-effect
- ds %r0,%r1,%r0
- addc dividend,dividend,dividend
- ds %r0,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- ds %r1,divisor,%r1
- addc dividend,dividend,dividend
- comclr,>= %r1,%r0,%r0
- addl %r1,divisor,%r1
- comclr,>= quotient,%r0,%r0 ; skip of no need to negate
- sub %r0,%r1,%r1
- bv 0(ret)
- copy %r1,quotient
-L$largedivisor
- sub,>>= dividend,divisor,quotient
- copy dividend,quotient
- bv,n 0(ret)
- .exit
- .procend
-#endif
-
-
-#if defined (L_divU_3) && !defined (SMALL_LIB)
-#undef L_divU_3
-#define dividend %r26
-#define divisor %r25
-#define tmp %r1
-#define result %r29
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_3
-$$divU_3
- .proc
- .callinfo frame=0,no_calls
- .entry
- sh2add %r26,%r26,%r29 ; r29 = lo(101 x r)
- shd %r0,%r26,30,%r1 ; r1 = hi(100 x r)
- addc %r1,%r0,%r1 ; r1 = hi(101 x r)
-; r in r1,,r29
- zdep %r29,27,28,%r25 ; r25 = lo(10000 x r)
- add %r25,%r29,%r25 ; r25 = lo(10001 x r)
- shd %r1,%r29,28,%r29 ; r29 = hi(10000 x r)
- addc %r29,%r1,%r29 ; r29 = hi(10001 x r)
-; r in r29,,r25
- zdep %r25,23,24,%r1 ; r1 = lo(100000000 x r)
- add %r1,%r25,%r1 ; r1 = lo(100000001 x r)
- shd %r29,%r25,24,%r25 ; r25 = hi(100000000 x r)
- addc %r25,%r29,%r25 ; r25 = hi(100000001 x r)
-; r in r25,,r1
- zdep %r1,15,16,%r29
- add %r29,%r1,%r29
- shd %r25,%r1,16,%r1
- addc %r1,%r25,%r1
-; r in r1,,r29
- sh1add %r29,%r26,%r0 ; r0 = lo(10 x r) + dividend
- shd %r1,%r29,31,%r29 ; r29 = hi(10 x r)
- addc %r29,%r0,%r29
- bv 0(ret)
- extru %r29,30,31,result
- .exit
- .procend
-#endif
-
-
-#if defined (L_divU_5) && !defined (SMALL_LIB)
-#undef L_divU_5
-#define dividend %r26
-#define divisor %r25
-#define tmp %r1
-#define result %r29
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_5
-$$divU_5
- .proc
- .callinfo frame=0,no_calls
- .entry
- sh1add %r26,%r26,%r29 ; r29 = lo(11 x r)
- shd %r0,%r26,31,%r1 ; r1 = hi(10 x r)
- addc %r1,%r0,%r1 ; r1 = hi(11 x r)
-; r in r1,,r29
- zdep %r29,27,28,%r25 ; r25 = lo(10000 x r)
- add %r25,%r29,%r25 ; r25 = lo(10001 x r)
- shd %r1,%r29,28,%r29 ; r29 = hi(10000 x r)
- addc %r29,%r1,%r29 ; r29 = hi(10001 x r)
-; r in r29,,r25
- zdep %r25,23,24,%r1 ; r1 = lo(100000000 x r)
- add %r1,%r25,%r1 ; r1 = lo(100000001 x r)
- shd %r29,%r25,24,%r25 ; r25 = hi(100000000 x r)
- addc %r25,%r29,%r25 ; r25 = hi(100000001 x r)
-; r in r25,,r1
- zdep %r1,15,16,%r29
- add %r29,%r1,%r29
- shd %r25,%r1,16,%r1
- addc %r1,%r25,%r1
-; r in r1,,r29
- sh2add %r29,%r26,%r0 ; r0 = lo(1000 x r) + dividend
- shd %r1,%r29,30,%r29 ; r29 = hi(1000 x r)
- addc %r29,%r0,%r29
- bv 0(ret)
- extru %r29,29,30,result
- .exit
- .procend
-#endif
-
-
-#if defined (L_divU_6) && !defined (SMALL_LIB)
-#undef L_divU_6
-#define dividend %r26
-#define divisor %r25
-#define tmp %r1
-#define result %r29
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_6
-$$divU_6
- .proc
- .callinfo frame=0,no_calls
- .entry
- sh2add %r26,%r26,%r29 ; r29 = lo(101 x r)
- shd %r0,%r26,30,%r1 ; r1 = hi(100 x r)
- addc %r1,%r0,%r1 ; r1 = hi(101 x r)
-; r in r1,,r29
- zdep %r29,27,28,%r25 ; r25 = lo(10000 x r)
- add %r25,%r29,%r25 ; r25 = lo(10001 x r)
- shd %r1,%r29,28,%r29 ; r29 = hi(10000 x r)
- addc %r29,%r1,%r29 ; r29 = hi(10001 x r)
-; r in r29,,r25
- zdep %r25,23,24,%r1 ; r1 = lo(100000000 x r)
- add %r1,%r25,%r1 ; r1 = lo(100000001 x r)
- shd %r29,%r25,24,%r25 ; r25 = hi(100000000 x r)
- addc %r25,%r29,%r25 ; r25 = hi(100000001 x r)
-; r in r25,,r1
- zdep %r1,15,16,%r29
- add %r29,%r1,%r29
- shd %r25,%r1,16,%r1
- addc %r1,%r25,%r1
-; r in r1,,r29
- sh1add %r29,%r26,%r0 ; r0 = lo(10 x r) + dividend
- shd %r1,%r29,31,%r29 ; r29 = hi(10 x r)
- addc %r29,%r0,%r29
- bv 0(ret)
- extru %r29,29,30,result
- .exit
- .procend
-#endif
-
-
-#if defined (L_divU_9) && !defined (SMALL_LIB)
-#undef L_divU_9
-#define dividend %r26
-#define divisor %r25
-#define tmp %r1
-#define result %r29
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_9
-$$divU_9
- .proc
- .callinfo frame=0,no_calls
- .entry
- zdep %r26,28,29,%r29
- sub %r29,%r26,%r29
- shd 0,%r26,29,%r1
- subb %r1,0,%r1 /* 111 */
-
- zdep %r29,25,26,%r25
- add %r25,%r29,%r25
- shd %r1,%r29,26,%r29
- addc %r29,%r1,%r29 /* 111000111 */
-
- sh3add %r25,%r26,%r1
- shd %r29,%r25,29,%r25
- addc %r25,0,%r25 /* 111000111001 */
-
- zdep %r1,16,17,%r29
- sub %r29,%r1,%r29
- shd %r25,%r1,17,%r1
- subb %r1,%r25,%r1 /* 111000111000111000111000111 */
-
- sh3add %r29,%r26,%r0
- shd %r1,%r29,29,%r29
- addc %r29,0,%r29 /* 111000111000111000111000111001 */
- bv 0(ret)
- extru %r29,30,31,result
- .exit
- .procend
-#endif
-
-
-#if defined (L_divU_10) && !defined (SMALL_LIB)
-#undef L_divU_10
-#define dividend %r26
-#define divisor %r25
-#define tmp %r1
-#define result %r29
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_10
-$$divU_10
- .proc
- .callinfo frame=0,no_calls
- .entry
- sh1add %r26,%r26,%r29 ; r29 = lo(11 x r)
- shd %r0,%r26,31,%r1 ; r1 = hi(10 x r)
- addc %r1,%r0,%r1 ; r1 = hi(11 x r)
-; r in r1,,r29
- zdep %r29,27,28,%r25 ; r25 = lo(10000 x r)
- add %r25,%r29,%r25 ; r25 = lo(10001 x r)
- shd %r1,%r29,28,%r29 ; r29 = hi(10000 x r)
- addc %r29,%r1,%r29 ; r29 = hi(10001 x r)
-; r in r29,,r25
- zdep %r25,23,24,%r1 ; r1 = lo(100000000 x r)
- add %r1,%r25,%r1 ; r1 = lo(100000001 x r)
- shd %r29,%r25,24,%r25 ; r25 = hi(100000000 x r)
- addc %r25,%r29,%r25 ; r25 = hi(100000001 x r)
-; r in r25,,r1
- zdep %r1,15,16,%r29
- add %r29,%r1,%r29
- shd %r25,%r1,16,%r1
- addc %r1,%r25,%r1
-; r in r1,,r29
- sh2add %r29,%r26,%r0 ; r0 = lo(1000 x r) + dividend
- shd %r1,%r29,30,%r29 ; r29 = hi(1000 x r)
- addc %r29,%r0,%r29
- bv 0(ret)
- extru %r29,28,29,result
- .exit
- .procend
-#endif
-
-
-#if defined (L_divU_12) && !defined (SMALL_LIB)
-#undef L_divU_12
-#define dividend %r26
-#define divisor %r25
-#define tmp %r1
-#define result %r29
-#define ret %r31
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_12
-$$divU_12
- .proc
- .callinfo frame=0,no_calls
- .entry
- sh2add %r26,%r26,%r29 ; r29 = lo(101 x r)
- shd %r0,%r26,30,%r1 ; r1 = hi(100 x r)
- addc %r1,%r0,%r1 ; r1 = hi(101 x r)
-; r in r1,,r29
- zdep %r29,27,28,%r25 ; r25 = lo(10000 x r)
- add %r25,%r29,%r25 ; r25 = lo(10001 x r)
- shd %r1,%r29,28,%r29 ; r29 = hi(10000 x r)
- addc %r29,%r1,%r29 ; r29 = hi(10001 x r)
-; r in r29,,r25
- zdep %r25,23,24,%r1 ; r1 = lo(100000000 x r)
- add %r1,%r25,%r1 ; r1 = lo(100000001 x r)
- shd %r29,%r25,24,%r25 ; r25 = hi(100000000 x r)
- addc %r25,%r29,%r25 ; r25 = hi(100000001 x r)
-; r in r25,,r1
- zdep %r1,15,16,%r29
- add %r29,%r1,%r29
- shd %r25,%r1,16,%r1
- addc %r1,%r25,%r1
-; r in r1,,r29
- sh1add %r29,%r26,%r0 ; r0 = lo(10 x r) + dividend
- shd %r1,%r29,31,%r29 ; r29 = hi(10 x r)
- addc %r29,%r0,%r29
- bv 0(ret)
- extru %r29,28,29,result
- .exit
- .procend
-#endif
-
-
-#ifdef L_divU_3
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_3
-$$divU_3
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divU
- ldi 3,%r25
- .exit
- .procend
- .import $$divU,MILLICODE
-#endif
-
-#ifdef L_divU_5
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_5
-$$divU_5
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divU
- ldi 5,%r25
- .exit
- .procend
- .import $$divU,MILLICODE
-#endif
-
-#ifdef L_divU_6
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_6
-$$divU_6
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divU
- ldi 6,%r25
- .exit
- .procend
- .import $$divU,MILLICODE
-#endif
-
-#ifdef L_divU_7
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_7
-$$divU_7
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divU
- ldi 7,%r25
- .exit
- .procend
- .import $$divU,MILLICODE
-#endif
-
-#ifdef L_divU_9
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_9
-$$divU_9
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divU
- ldi 9,%r25
- .exit
- .procend
- .import $$divU,MILLICODE
-#endif
-
-#ifdef L_divU_10
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_10
-$$divU_10
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divU
- ldi 10,%r25
- .exit
- .procend
- .import $$divU,MILLICODE
-#endif
-
-#ifdef L_divU_12
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_12
-$$divU_12
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divU
- ldi 12,%r25
- .exit
- .procend
- .import $$divU,MILLICODE
-#endif
-
-#ifdef L_divU_14
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_14
-$$divU_14
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divU
- ldi 14,%r25
- .exit
- .procend
- .import $$divU,MILLICODE
-#endif
-
-#ifdef L_divU_15
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divU_15
-$$divU_15
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divU
- ldi 15,%r25
- .exit
- .procend
- .import $$divU,MILLICODE
-#endif
-
-#ifdef L_divI_3
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI_3
-$$divI_3
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divI
- ldi 3,%r25
- .exit
- .procend
- .import $$divI,MILLICODE
-#endif
-
-#ifdef L_divI_5
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI_5
-$$divI_5
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divI
- ldi 5,%r25
- .exit
- .procend
- .import $$divI,MILLICODE
-#endif
-
-#ifdef L_divI_6
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI_6
-$$divI_6
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divI
- ldi 6,%r25
- .exit
- .procend
- .import $$divI,MILLICODE
-#endif
-
-#ifdef L_divI_7
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI_7
-$$divI_7
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divI
- ldi 7,%r25
- .exit
- .procend
- .import $$divI,MILLICODE
-#endif
-
-#ifdef L_divI_9
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI_9
-$$divI_9
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divI
- ldi 9,%r25
- .exit
- .procend
- .import $$divI,MILLICODE
-#endif
-
-#ifdef L_divI_10
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI_10
-$$divI_10
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divI
- ldi 10,%r25
- .exit
- .procend
- .import $$divI,MILLICODE
-#endif
-
-#ifdef L_divI_12
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI_12
-$$divI_12
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divI
- ldi 12,%r25
- .exit
- .procend
- .import $$divI,MILLICODE
-#endif
-
-#ifdef L_divI_14
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI_14
-$$divI_14
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divI
- ldi 14,%r25
- .exit
- .procend
- .import $$divI,MILLICODE
-#endif
-
-#ifdef L_divI_15
- .space $TEXT$
- .subspa $MILLICODE$,quad=0,align=8,access=0x2c,sort=8
- .align 4
- .export $$divI_15
-$$divI_15
- .proc
- .callinfo frame=0,no_calls
- .entry
- b $$divI
- ldi 15,%r25
- .exit
- .procend
- .import $$divI,MILLICODE
-#endif
diff --git a/gcc/config/pa/lib2funcs.asm b/gcc/config/pa/lib2funcs.asm
deleted file mode 100644
index 854aa9c62be..00000000000
--- a/gcc/config/pa/lib2funcs.asm
+++ /dev/null
@@ -1,66 +0,0 @@
-; Subroutines for calling unbound dynamic functions from within GDB for HPPA.
-; Subroutines for out of line prologues and epilogues on for the HPPA
-; Copyright (C) 1994, 1995, 1996 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.
-
- .SPACE $PRIVATE$
- .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
- .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
- .SPACE $TEXT$
- .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
- .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
- .SUBSPA $MILLICODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=8
-
- .IMPORT $$dyncall,MILLICODE
-; gcc_compiled.:
- .SPACE $TEXT$
- .SUBSPA $CODE$
-
-; Simply call with the address of the desired import stub in %r22 and
-; arguments in the normal place (%r26-%r23 and stack slots).
-;
- .align 4
- .EXPORT __gcc_plt_call,ENTRY,PRIV_LEV=3,RTNVAL=GR
-__gcc_plt_call
- .PROC
- .CALLINFO
- .ENTRY
- ; Our return address comes in %r31, not %r2!
- stw %r31,-8(0,%r30)
-
- ; An inline version of dyncall so we don't have to worry
- ; about long calls to millicode, PIC and other complexities.
- bb,>=,n %r22,30,L$foo
- depi 0,31,2,%r22
- ldw 4(%r22),%r19
- ldw 0(%r22),%r22
-L$foo
- ldsid (%r22),%r1
- mtsp %r1,%sr0
- ble 0(%sr0,%r22)
- copy %r31,%r2
- ldw -8(0,%r30),%r2
-
- ; We're going to be returning to a stack address, so we
- ; need to do an intra-space return.
- ldsid (%rp),%r1
- mtsp %r1,%sr0
- be,n 0(%sr0,%rp)
- .EXIT
- .PROCEND
diff --git a/gcc/config/pa/pa-gas.h b/gcc/config/pa/pa-gas.h
deleted file mode 100644
index d7da9e733b1..00000000000
--- a/gcc/config/pa/pa-gas.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Definitions of target machine for GNU compiler, for HP-UX using GNU as.
- Copyright (C) 1996 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0x88 /* TARGET_GAS + TARGET_JUMP_IN_DELAY */
diff --git a/gcc/config/pa/pa-hiux.h b/gcc/config/pa/pa-hiux.h
deleted file mode 100644
index f4be95b8830..00000000000
--- a/gcc/config/pa/pa-hiux.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Definitions of target machine for GNU compiler, for HI-UX.
- Copyright (C) 1993, 1995, 1996 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. */
-
-/* HIUX is just a HPUX variant. We can simply use the HPUX configuration
- for just about everything. */
-
-/* Predefines are the one noteworthy difference between HPUX and HIUX. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dhppa -DPWB -Dunix -D__H3050R -D__H3050RX -Asystem(unix) -Asystem(hiux) -Acpu(hppa) -Amachine(hppa)"
diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h
deleted file mode 100644
index e001ebe438c..00000000000
--- a/gcc/config/pa/pa-hpux.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Definitions of target machine for GNU compiler, for HP-UX.
- Copyright (C) 1991, 1995, 1996 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. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0
-
-/* Make GCC agree with types.h. */
-#undef SIZE_TYPE
-#undef PTRDIFF_TYPE
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-
-/* Like the default, except no -lg. */
-#undef LIB_SPEC
-#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p: -L/lib/libp/ -lc}%{pg: -L/lib/libp/ -lc}}"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -Asystem(unix) -Asystem(hpux) -Acpu(hppa) -Amachine(hppa)"
-
-#undef LINK_SPEC
-#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 1)
-#define LINK_SPEC \
- "%{!mpa-risc-1-0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }}%{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{g*:-a archive} %{shared:-b}"
-#else
-#define LINK_SPEC \
- "%{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{g*:-a archive} %{shared:-b}"
-#endif
-
-/* hpux8 and later have C++ compatible include files, so do not
- pretend they are `extern "C"'. */
-#define NO_IMPLICIT_EXTERN_C
diff --git a/gcc/config/pa/pa-hpux10.h b/gcc/config/pa/pa-hpux10.h
deleted file mode 100644
index 1c57d5ee6ea..00000000000
--- a/gcc/config/pa/pa-hpux10.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Definitions of target machine for GNU compiler, for HP PA-RISC 1.1
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Tim Moore (moore@defmacro.cs.utah.edu)
-
-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. */
-
-/* We can debug dynamically linked executables on hpux9; we also want
- derefercing of a NULL pointer to cause a SEGV. */
-#undef LINK_SPEC
-#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 1)
-#define LINK_SPEC \
- "%{!mpa-risc-1-0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }} -z %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:-b}"
-#else
-#define LINK_SPEC \
- "-z %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:-b}"
-#endif
-
-/* The hpux10 assembler requires a .LEVEL pseudo-op at the start of
- the assembly file. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-do { \
- if (TARGET_SNAKE) \
- fputs("\t.LEVEL 1.1\n", FILE); \
- else \
- fputs("\t.LEVEL 1.0\n", FILE); \
- fputs ("\t.SPACE $PRIVATE$\n\
-\t.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31\n\
-\t.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82\n\
-\t.SPACE $TEXT$\n\
-\t.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44\n\
-\t.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n\
-\t.IMPORT $global$,DATA\n\
-\t.IMPORT $$dyncall,MILLICODE\n", FILE);\
- if (profile_flag)\
- fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
- if (write_symbols != NO_DEBUG) \
- output_file_directive ((FILE), main_input_filename); \
- } while (0)
-
-/* Under hpux10, the normal location of the `ld' and `as' programs is the
- /usr/ccs/bin directory. */
-
-#ifndef CROSS_COMPILE
-#undef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/ccs/bin/"
-#endif
-
-/* Under hpux10, the normal location of the various *crt*.o files is the
- /usr/ccs/lib directory. */
-
-#ifndef CROSS_COMPILE
-#undef MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
-#endif
-
diff --git a/gcc/config/pa/pa-hpux7.h b/gcc/config/pa/pa-hpux7.h
deleted file mode 100644
index dc75ec28b10..00000000000
--- a/gcc/config/pa/pa-hpux7.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Definitions of target machine for GNU compiler, for HP-UX.
- Copyright (C) 1991, 1995, 1996 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. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 0
-#endif
-
-/* Make GCC agree with types.h. */
-#undef SIZE_TYPE
-#undef PTRDIFF_TYPE
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-
-/* Like the default, except no -lg. */
-#undef LIB_SPEC
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p: -L/lib/libp/ -lc}%{pg: -L/lib/libp/ -lc}"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -Asystem(unix) -Asystem(hpux) -Acpu(hppa) -Amachine(hppa)"
diff --git a/gcc/config/pa/pa-hpux9.h b/gcc/config/pa/pa-hpux9.h
deleted file mode 100644
index 95b031e8c8d..00000000000
--- a/gcc/config/pa/pa-hpux9.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Definitions of target machine for GNU compiler, for HP PA-RISC 1.1
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Tim Moore (moore@defmacro.cs.utah.edu)
-
-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. */
-
-/* We can debug dynamically linked executables on hpux9; we also want
- derefercing of a NULL pointer to cause a SEGV. */
-#undef LINK_SPEC
-#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 1)
-#define LINK_SPEC \
- "%{!mpa-risc-1-0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }} -z %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:-b}"
-#else
-#define LINK_SPEC \
- "-z %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:-b}"
-#endif
diff --git a/gcc/config/pa/pa-oldas.h b/gcc/config/pa/pa-oldas.h
deleted file mode 100644
index 8ff741f1435..00000000000
--- a/gcc/config/pa/pa-oldas.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Definitions of target machine for GNU compiler, for HP PA-RISC 1.1
- Copyright (C) 1991, 1996 Free Software Foundation, Inc.
- Contributed by Tim Moore (moore@defmacro.cs.utah.edu)
-
-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. */
-
-#define HP_FP_ARG_DESCRIPTOR_REVERSED
diff --git a/gcc/config/pa/pa-osf.h b/gcc/config/pa/pa-osf.h
deleted file mode 100644
index 047d20e34ff..00000000000
--- a/gcc/config/pa/pa-osf.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Definitions of target machine for GNU compiler, for HP PA-RISC 1.1
- Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Tim Moore (moore@defmacro.cs.utah.edu)
-
-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. */
-
-#undef CPP_PREDEFINES
-#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 1)
-#define CPP_PREDEFINES "-Dhppa -Dunix -Dhp9000 -Dspectrum -DREVARGV -Dhp700 -DHP700 -Dparisc -D__pa_risc -DPARISC -DBYTE_MSF -DBIT_MSF -Asystem(unix) -Asystem(mach) -Acpu(hppa) -Amachine(hppa)"
-#else
-#define CPP_PREDEFINES "-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -Dunix -Dhp9000 -Dhp800 -Dspectrum -DREVARGV -Dparisc -D__pa_risc -DPARISC -DBYTE_MSF -DBIT_MSF -Asystem(unix) -Asystem(mach) -Acpu(hppa) -Amachine(hppa)"
-#endif
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* OSF1 on the PA still uses 16bit wchar_t. */
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-
-#define WCHAR_TYPE "short unsigned int"
-#define WCHAR_TYPE_SIZE 16
-
-/* OSF1 wants to be different and use unsigned long as size_t. */
-#undef SIZE_TYPE
-#define SIZE_TYPE "long unsigned int"
diff --git a/gcc/config/pa/pa-pro-end.h b/gcc/config/pa/pa-pro-end.h
deleted file mode 100644
index 267057c8506..00000000000
--- a/gcc/config/pa/pa-pro-end.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Definitions of target machine for GNU compiler, for PRO.
- Copyright (C) 1996 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Make GCC agree with types.h. */
-#undef SIZE_TYPE
-#undef PTRDIFF_TYPE
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-
-/* Like the default, except no -lg. */
-#undef LIB_SPEC
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p: -L/lib/libp/ -lc}%{pg: -L/lib/libp/ -lc}"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dhppa -DPWB -Acpu(hppa) -Amachine(hppa)"
-
-/* hpux8 and later have C++ compatable include files, so do not
- pretend they are `extern "C"'. */
-#define NO_IMPLICIT_EXTERN_C
-
-/* We don't want a crt0.o to get linked in automatically, we want the
- linker script to pull it in.
- */
-#define STARTFILE_SPEC ""
diff --git a/gcc/config/pa/pa-pro.h b/gcc/config/pa/pa-pro.h
deleted file mode 100644
index f64ac2dc54c..00000000000
--- a/gcc/config/pa/pa-pro.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Definitions of target machine for GNU compiler, for PRO.
- Copyright (C) 1994, 1995, 1996 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Global constructor and destructor support. */
-/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
-
- Note that we want to give these sections the SHF_WRITE attribute
- because these sections will actually contain data (i.e. tables of
- addresses of functions in the current root executable or shared library
- file) and, in the case of a shared library, the relocatable addresses
- will have to be properly resolved/relocated (and then written into) by
- the dynamic linker when it actually attaches the given shared library
- to the executing process. */
-
-#define CTORS_SECTION_ASM_OP "\t.section\t\".ctors\",#alloc,#write"
-#define DTORS_SECTION_ASM_OP "\t.section\t\".dtors\",#alloc,#write"
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fputs ("\t.word\t ", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fputs ("\t.word\t ", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
- } while (0)
-
-/* JUMP_IN_DELAY + PORTABLE_RUNTIME + GAS + NO_SPACE_REGS + SOFT_FLOAT */
-#define TARGET_DEFAULT (4 + 8 + 64 + 128 + 256)
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
deleted file mode 100644
index 95b6c00dc81..00000000000
--- a/gcc/config/pa/pa.c
+++ /dev/null
@@ -1,6013 +0,0 @@
-/* Subroutines for insn-output.c for HPPA.
- Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Tim Moore (moore@cs.utah.edu), based on sparc.c
-
-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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "tree.h"
-#include "reload.h"
-#include "c-tree.h"
-#include "expr.h"
-#include "obstack.h"
-
-/* Save the operands last given to a compare for use when we
- generate a scc or bcc insn. */
-
-rtx hppa_compare_op0, hppa_compare_op1;
-enum cmp_type hppa_branch_type;
-
-/* Which cpu we are scheduling for. */
-enum processor_type pa_cpu;
-
-/* String to hold which cpu we are scheduling for. */
-char *pa_cpu_string;
-
-/* Set by the FUNCTION_PROFILER macro. */
-int hp_profile_labelno;
-
-/* Counts for the number of callee-saved general and floating point
- registers which were saved by the current function's prologue. */
-static int gr_saved, fr_saved;
-
-/* Whether or not the current function uses an out-of-line prologue
- and epilogue. */
-static int out_of_line_prologue_epilogue;
-
-static rtx find_addr_reg ();
-
-/* Keep track of the number of bytes we have output in the CODE subspaces
- during this compilation so we'll know when to emit inline long-calls. */
-
-unsigned int total_code_bytes;
-
-/* Variables to handle plabels that we discover are necessary at assembly
- output time. They are output after the current function. */
-
-struct defer_plab
-{
- rtx internal_label;
- rtx symbol;
-} *deferred_plabels = 0;
-int n_deferred_plabels = 0;
-
-void
-override_options ()
-{
- /* Default to 7100 scheduling. If the 7100LC scheduling ever
- gets reasonably tuned, it should be the default since that
- what most PAs sold now are. */
- if (pa_cpu_string == NULL
- || ! strcmp (pa_cpu_string, "7100"))
- {
- pa_cpu_string = "7100";
- pa_cpu = PROCESSOR_7100;
- }
- else if (! strcmp (pa_cpu_string, "700"))
- {
- pa_cpu_string = "700";
- pa_cpu = PROCESSOR_700;
- }
- else if (! strcmp (pa_cpu_string, "7100LC"))
- {
- pa_cpu_string = "7100LC";
- pa_cpu = PROCESSOR_7100LC;
- }
- else
- {
- warning ("Unknown -mschedule= option (%s).\nValid options are 700, 7100 and 7100LC\n", pa_cpu_string);
- }
-
- if (flag_pic && TARGET_PORTABLE_RUNTIME)
- {
- warning ("PIC code generation is not supported in the portable runtime model\n");
- }
-
- if (flag_pic && (TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS))
- {
- warning ("PIC code generation is not compatable with fast indirect calls\n");
- }
-
- if (flag_pic && profile_flag)
- {
- warning ("PIC code generation is not compatable with profiling\n");
- }
-
- if (TARGET_SPACE && (flag_pic || profile_flag))
- {
- warning ("Out of line entry/exit sequences are not compatable\n");
- warning ("with PIC or profiling\n");
- }
-
- if (! TARGET_GAS && write_symbols != NO_DEBUG)
- {
- warning ("-g is only supported when using GAS on this processor,");
- warning ("-g option disabled.");
- write_symbols = NO_DEBUG;
- }
-}
-
-
-/* Return non-zero only if OP is a register of mode MODE,
- or CONST0_RTX. */
-int
-reg_or_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (op == CONST0_RTX (mode) || register_operand (op, mode));
-}
-
-/* Return non-zero if OP is suitable for use in a call to a named
- function.
-
- (???) For 2.5 try to eliminate either call_operand_address or
- function_label_operand, they perform very similar functions. */
-int
-call_operand_address (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (CONSTANT_P (op) && ! TARGET_PORTABLE_RUNTIME);
-}
-
-/* Return 1 if X contains a symbolic expression. We know these
- expressions will have one of a few well defined forms, so
- we need only check those forms. */
-int
-symbolic_expression_p (x)
- register rtx x;
-{
-
- /* Strip off any HIGH. */
- if (GET_CODE (x) == HIGH)
- x = XEXP (x, 0);
-
- return (symbolic_operand (x, VOIDmode));
-}
-
-int
-symbolic_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- return 1;
- case CONST:
- op = XEXP (op, 0);
- return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (op, 0)) == LABEL_REF)
- && GET_CODE (XEXP (op, 1)) == CONST_INT);
- default:
- return 0;
- }
-}
-
-/* Return truth value of statement that OP is a symbolic memory
- operand of mode MODE. */
-
-int
-symbolic_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
- if (GET_CODE (op) != MEM)
- return 0;
- op = XEXP (op, 0);
- return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST
- || GET_CODE (op) == HIGH || GET_CODE (op) == LABEL_REF);
-}
-
-/* Return 1 if the operand is either a register or a memory operand that is
- not symbolic. */
-
-int
-reg_or_nonsymb_mem_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
-
- if (memory_operand (op, mode) && ! symbolic_memory_operand (op, mode))
- return 1;
-
- return 0;
-}
-
-/* Return 1 if the operand is either a register, zero, or a memory operand
- that is not symbolic. */
-
-int
-reg_or_0_or_nonsymb_mem_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
-
- if (op == CONST0_RTX (mode))
- return 1;
-
- if (memory_operand (op, mode) && ! symbolic_memory_operand (op, mode))
- return 1;
-
- return 0;
-}
-
-/* Accept any constant that can be moved in one instructions into a
- general register. */
-int
-cint_ok_for_move (intval)
- HOST_WIDE_INT intval;
-{
- /* OK if ldo, ldil, or zdepi, can be used. */
- return (VAL_14_BITS_P (intval) || (intval & 0x7ff) == 0
- || zdepi_cint_p (intval));
-}
-
-/* Accept anything that can be moved in one instruction into a general
- register. */
-int
-move_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
-
- if (GET_CODE (op) == CONST_INT)
- return cint_ok_for_move (INTVAL (op));
-
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
- if (GET_CODE (op) != MEM)
- return 0;
-
- op = XEXP (op, 0);
- if (GET_CODE (op) == LO_SUM)
- return (register_operand (XEXP (op, 0), Pmode)
- && CONSTANT_P (XEXP (op, 1)));
-
- /* Since move_operand is only used for source operands, we can always
- allow scaled indexing! */
- if (GET_CODE (op) == PLUS
- && ((GET_CODE (XEXP (op, 0)) == MULT
- && GET_CODE (XEXP (XEXP (op, 0), 0)) == REG
- && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (op, 0), 1)) == GET_MODE_SIZE (mode)
- && GET_CODE (XEXP (op, 1)) == REG)
- || (GET_CODE (XEXP (op, 1)) == MULT
- &&GET_CODE (XEXP (XEXP (op, 1), 0)) == REG
- && GET_CODE (XEXP (XEXP (op, 1), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (op, 1), 1)) == GET_MODE_SIZE (mode)
- && GET_CODE (XEXP (op, 0)) == REG)))
- return 1;
-
- return memory_address_p (mode, op);
-}
-
-/* Accept REG and any CONST_INT that can be moved in one instruction into a
- general register. */
-int
-reg_or_cint_move_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
-
- if (GET_CODE (op) == CONST_INT)
- return cint_ok_for_move (INTVAL (op));
-
- return 0;
-}
-
-int
-pic_label_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (!flag_pic)
- return 0;
-
- switch (GET_CODE (op))
- {
- case LABEL_REF:
- return 1;
- case CONST:
- op = XEXP (op, 0);
- return (GET_CODE (XEXP (op, 0)) == LABEL_REF
- && GET_CODE (XEXP (op, 1)) == CONST_INT);
- default:
- return 0;
- }
-}
-
-int
-fp_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return reg_renumber && FP_REG_P (op);
-}
-
-
-
-/* Return truth value of whether OP can be used as an operand in a
- three operand arithmetic insn that accepts registers of mode MODE
- or 14-bit signed integers. */
-int
-arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && INT_14_BITS (op)));
-}
-
-/* Return truth value of whether OP can be used as an operand in a
- three operand arithmetic insn that accepts registers of mode MODE
- or 11-bit signed integers. */
-int
-arith11_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && INT_11_BITS (op)));
-}
-
-/* A constant integer suitable for use in a PRE_MODIFY memory
- reference. */
-int
-pre_cint_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && INTVAL (op) >= -0x2000 && INTVAL (op) < 0x10);
-}
-
-/* A constant integer suitable for use in a POST_MODIFY memory
- reference. */
-int
-post_cint_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && INTVAL (op) < 0x2000 && INTVAL (op) >= -0x10);
-}
-
-int
-arith_double_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_DOUBLE
- && GET_MODE (op) == mode
- && VAL_14_BITS_P (CONST_DOUBLE_LOW (op))
- && (CONST_DOUBLE_HIGH (op) >= 0
- == ((CONST_DOUBLE_LOW (op) & 0x1000) == 0))));
-}
-
-/* Return truth value of whether OP is a integer which fits the
- range constraining immediate operands in three-address insns, or
- is an integer register. */
-
-int
-ireg_or_int5_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ((GET_CODE (op) == CONST_INT && INT_5_BITS (op))
- || (GET_CODE (op) == REG && REGNO (op) > 0 && REGNO (op) < 32));
-}
-
-/* Return truth value of whether OP is a integer which fits the
- range constraining immediate operands in three-address insns. */
-
-int
-int5_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && INT_5_BITS (op));
-}
-
-int
-uint5_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && INT_U5_BITS (op));
-}
-
-int
-int11_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && INT_11_BITS (op));
-}
-
-int
-uint32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
-#if HOST_BITS_PER_WIDE_INT > 32
- /* All allowed constants will fit a CONST_INT. */
- return (GET_CODE (op) == CONST_INT
- && (INTVAL (op) >= 0 && INTVAL (op) < 0x100000000L));
-#else
- return (GET_CODE (op) == CONST_INT
- || (GET_CODE (op) == CONST_DOUBLE
- && CONST_DOUBLE_HIGH (op) == 0));
-#endif
-}
-
-int
-arith5_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return register_operand (op, mode) || int5_operand (op, mode);
-}
-
-/* True iff zdepi can be used to generate this CONST_INT. */
-int
-zdepi_cint_p (x)
- unsigned HOST_WIDE_INT x;
-{
- unsigned HOST_WIDE_INT lsb_mask, t;
-
- /* This might not be obvious, but it's at least fast.
- This function is critical; we don't have the time loops would take. */
- lsb_mask = x & -x;
- t = ((x >> 4) + lsb_mask) & ~(lsb_mask - 1);
- /* Return true iff t is a power of two. */
- return ((t & (t - 1)) == 0);
-}
-
-/* True iff depi or extru can be used to compute (reg & mask).
- Accept bit pattern like these:
- 0....01....1
- 1....10....0
- 1..10..01..1 */
-int
-and_mask_p (mask)
- unsigned HOST_WIDE_INT mask;
-{
- mask = ~mask;
- mask += mask & -mask;
- return (mask & (mask - 1)) == 0;
-}
-
-/* True iff depi or extru can be used to compute (reg & OP). */
-int
-and_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && and_mask_p (INTVAL (op))));
-}
-
-/* True iff depi can be used to compute (reg | MASK). */
-int
-ior_mask_p (mask)
- unsigned HOST_WIDE_INT mask;
-{
- mask += mask & -mask;
- return (mask & (mask - 1)) == 0;
-}
-
-/* True iff depi can be used to compute (reg | OP). */
-int
-ior_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && ior_mask_p (INTVAL (op)));
-}
-
-int
-lhs_lshift_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return register_operand (op, mode) || lhs_lshift_cint_operand (op, mode);
-}
-
-/* True iff OP is a CONST_INT of the forms 0...0xxxx or 0...01...1xxxx.
- Such values can be the left hand side x in (x << r), using the zvdepi
- instruction. */
-int
-lhs_lshift_cint_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- unsigned HOST_WIDE_INT x;
- if (GET_CODE (op) != CONST_INT)
- return 0;
- x = INTVAL (op) >> 4;
- return (x & (x + 1)) == 0;
-}
-
-int
-arith32_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return register_operand (op, mode) || GET_CODE (op) == CONST_INT;
-}
-
-int
-pc_or_label_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == PC || GET_CODE (op) == LABEL_REF);
-}
-
-/* Legitimize PIC addresses. If the address is already
- position-independent, we return ORIG. Newly generated
- position-independent addresses go to REG. If we need more
- than one register, we lose. */
-
-rtx
-legitimize_pic_address (orig, mode, reg)
- rtx orig, reg;
- enum machine_mode mode;
-{
- rtx pic_ref = orig;
-
- /* Labels need special handling. */
- if (pic_label_operand (orig))
- {
- emit_insn (gen_pic_load_label (reg, orig));
- current_function_uses_pic_offset_table = 1;
- return reg;
- }
- if (GET_CODE (orig) == SYMBOL_REF)
- {
- if (reg == 0)
- abort ();
-
- if (flag_pic == 2)
- {
- emit_insn (gen_pic2_highpart (reg, pic_offset_table_rtx, orig));
- pic_ref = gen_rtx (MEM, Pmode,
- gen_rtx (LO_SUM, Pmode, reg,
- gen_rtx (UNSPEC, SImode, gen_rtvec (1, orig), 0)));
- }
- else
- pic_ref = gen_rtx (MEM, Pmode,
- gen_rtx (PLUS, Pmode, pic_offset_table_rtx, orig));
- current_function_uses_pic_offset_table = 1;
- RTX_UNCHANGING_P (pic_ref) = 1;
- emit_move_insn (reg, pic_ref);
- return reg;
- }
- else if (GET_CODE (orig) == CONST)
- {
- rtx base;
-
- if (GET_CODE (XEXP (orig, 0)) == PLUS
- && XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx)
- return orig;
-
- if (reg == 0)
- abort ();
-
- if (GET_CODE (XEXP (orig, 0)) == PLUS)
- {
- base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg);
- orig = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
- base == reg ? 0 : reg);
- }
- else abort ();
- if (GET_CODE (orig) == CONST_INT)
- {
- if (INT_14_BITS (orig))
- return plus_constant_for_output (base, INTVAL (orig));
- orig = force_reg (Pmode, orig);
- }
- pic_ref = gen_rtx (PLUS, Pmode, base, orig);
- /* Likewise, should we set special REG_NOTEs here? */
- }
- return pic_ref;
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the PA, transform:
-
- memory(X + <large int>)
-
- into:
-
- if (<large int> & mask) >= 16
- Y = (<large int> & ~mask) + mask + 1 Round up.
- else
- Y = (<large int> & ~mask) Round down.
- Z = X + Y
- memory (Z + (<large int> - Y));
-
- This is for CSE to find several similar references, and only use one Z.
-
- X can either be a SYMBOL_REF or REG, but because combine can not
- perform a 4->2 combination we do nothing for SYMBOL_REF + D where
- D will not fit in 14 bits.
-
- MODE_FLOAT references allow displacements which fit in 5 bits, so use
- 0x1f as the mask.
-
- MODE_INT references allow displacements which fit in 14 bits, so use
- 0x3fff as the mask.
-
- This relies on the fact that most mode MODE_FLOAT references will use FP
- registers and most mode MODE_INT references will use integer registers.
- (In the rare case of an FP register used in an integer MODE, we depend
- on secondary reloads to clean things up.)
-
-
- It is also beneficial to handle (plus (mult (X) (Y)) (Z)) in a special
- manner if Y is 2, 4, or 8. (allows more shadd insns and shifted indexed
- addressing modes to be used).
-
- Put X and Z into registers. Then put the entire expression into
- a register. */
-
-rtx
-hppa_legitimize_address (x, oldx, mode)
- rtx x, oldx;
- enum machine_mode mode;
-{
- rtx orig = x;
-
- if (flag_pic)
- return legitimize_pic_address (x, mode, gen_reg_rtx (Pmode));
-
- /* Strip off CONST. */
- if (GET_CODE (x) == CONST)
- x = XEXP (x, 0);
-
- /* Special case. Get the SYMBOL_REF into a register and use indexing.
- That should always be safe. */
- if (GET_CODE (x) == PLUS
- && GET_CODE (XEXP (x, 0)) == REG
- && GET_CODE (XEXP (x, 1)) == SYMBOL_REF)
- {
- rtx reg = force_reg (SImode, XEXP (x, 1));
- return force_reg (SImode, gen_rtx (PLUS, SImode, reg, XEXP (x, 0)));
- }
-
- /* Note we must reject symbols which represent function addresses
- since the assembler/linker can't handle arithmetic on plabels. */
- if (GET_CODE (x) == PLUS
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && ((GET_CODE (XEXP (x, 0)) == SYMBOL_REF
- && !FUNCTION_NAME_P (XSTR (XEXP (x, 0), 0)))
- || GET_CODE (XEXP (x, 0)) == REG))
- {
- rtx int_part, ptr_reg;
- int newoffset;
- int offset = INTVAL (XEXP (x, 1));
- int mask = GET_MODE_CLASS (mode) == MODE_FLOAT ? 0x1f : 0x3fff;
-
- /* Choose which way to round the offset. Round up if we
- are >= halfway to the next boundary. */
- if ((offset & mask) >= ((mask + 1) / 2))
- newoffset = (offset & ~ mask) + mask + 1;
- else
- newoffset = (offset & ~ mask);
-
- /* If the newoffset will not fit in 14 bits (ldo), then
- handling this would take 4 or 5 instructions (2 to load
- the SYMBOL_REF + 1 or 2 to load the newoffset + 1 to
- add the new offset and the SYMBOL_REF.) Combine can
- not handle 4->2 or 5->2 combinations, so do not create
- them. */
- if (! VAL_14_BITS_P (newoffset)
- && GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
- {
- rtx const_part = gen_rtx (CONST, VOIDmode,
- gen_rtx (PLUS, Pmode,
- XEXP (x, 0),
- GEN_INT (newoffset)));
- rtx tmp_reg
- = force_reg (Pmode,
- gen_rtx (HIGH, Pmode, const_part));
- ptr_reg
- = force_reg (Pmode,
- gen_rtx (LO_SUM, Pmode,
- tmp_reg, const_part));
- }
- else
- {
- if (! VAL_14_BITS_P (newoffset))
- int_part = force_reg (Pmode, GEN_INT (newoffset));
- else
- int_part = GEN_INT (newoffset);
-
- ptr_reg = force_reg (Pmode,
- gen_rtx (PLUS, Pmode,
- force_reg (Pmode, XEXP (x, 0)),
- int_part));
- }
- return plus_constant (ptr_reg, offset - newoffset);
- }
-
- /* Handle (plus (mult (a) (shadd_constant)) (b)). */
-
- if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 0)) == MULT
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && shadd_constant_p (INTVAL (XEXP (XEXP (x, 0), 1)))
- && (GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) == 'o'
- || GET_CODE (XEXP (x, 1)) == SUBREG)
- && GET_CODE (XEXP (x, 1)) != CONST)
- {
- int val = INTVAL (XEXP (XEXP (x, 0), 1));
- rtx reg1, reg2;
-
- reg1 = XEXP (x, 1);
- if (GET_CODE (reg1) != REG)
- reg1 = force_reg (Pmode, force_operand (reg1, 0));
-
- reg2 = XEXP (XEXP (x, 0), 0);
- if (GET_CODE (reg2) != REG)
- reg2 = force_reg (Pmode, force_operand (reg2, 0));
-
- return force_reg (Pmode, gen_rtx (PLUS, Pmode,
- gen_rtx (MULT, Pmode,
- reg2, GEN_INT (val)),
- reg1));
- }
-
- /* Similarly for (plus (plus (mult (a) (shadd_constant)) (b)) (c)).
-
- Only do so for floating point modes since this is more speculative
- and we lose if it's an integer store. */
- if (GET_CODE (x) == PLUS
- && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT
- && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == CONST_INT
- && shadd_constant_p (INTVAL (XEXP (XEXP (XEXP (x, 0), 0), 1)))
- && (mode == SFmode || mode == DFmode))
- {
-
- /* First, try and figure out what to use as a base register. */
- rtx reg1, reg2, base, idx, orig_base;
-
- reg1 = XEXP (XEXP (x, 0), 1);
- reg2 = XEXP (x, 1);
- base = NULL_RTX;
- idx = NULL_RTX;
-
- /* Make sure they're both regs. If one was a SYMBOL_REF [+ const],
- then emit_move_sequence will turn on REGNO_POINTER_FLAG so we'll
- know it's a base register below. */
- if (GET_CODE (reg1) != REG)
- reg1 = force_reg (Pmode, force_operand (reg1, 0));
-
- if (GET_CODE (reg2) != REG)
- reg2 = force_reg (Pmode, force_operand (reg2, 0));
-
- /* Figure out what the base and index are. */
-
- if (GET_CODE (reg1) == REG
- && REGNO_POINTER_FLAG (REGNO (reg1)))
- {
- base = reg1;
- orig_base = XEXP (XEXP (x, 0), 1);
- idx = gen_rtx (PLUS, Pmode,
- gen_rtx (MULT, Pmode,
- XEXP (XEXP (XEXP (x, 0), 0), 0),
- XEXP (XEXP (XEXP (x, 0), 0), 1)),
- XEXP (x, 1));
- }
- else if (GET_CODE (reg2) == REG
- && REGNO_POINTER_FLAG (REGNO (reg2)))
- {
- base = reg2;
- orig_base = XEXP (x, 1);
- idx = XEXP (x, 0);
- }
-
- if (base == 0)
- return orig;
-
- /* If the index adds a large constant, try to scale the
- constant so that it can be loaded with only one insn. */
- if (GET_CODE (XEXP (idx, 1)) == CONST_INT
- && VAL_14_BITS_P (INTVAL (XEXP (idx, 1))
- / INTVAL (XEXP (XEXP (idx, 0), 1)))
- && INTVAL (XEXP (idx, 1)) % INTVAL (XEXP (XEXP (idx, 0), 1)) == 0)
- {
- /* Divide the CONST_INT by the scale factor, then add it to A. */
- int val = INTVAL (XEXP (idx, 1));
-
- val /= INTVAL (XEXP (XEXP (idx, 0), 1));
- reg1 = XEXP (XEXP (idx, 0), 0);
- if (GET_CODE (reg1) != REG)
- reg1 = force_reg (Pmode, force_operand (reg1, 0));
-
- reg1 = force_reg (Pmode, gen_rtx (PLUS, Pmode, reg1, GEN_INT (val)));
-
- /* We can now generate a simple scaled indexed address. */
- return force_reg (Pmode, gen_rtx (PLUS, Pmode,
- gen_rtx (MULT, Pmode, reg1,
- XEXP (XEXP (idx, 0), 1)),
- base));
- }
-
- /* If B + C is still a valid base register, then add them. */
- if (GET_CODE (XEXP (idx, 1)) == CONST_INT
- && INTVAL (XEXP (idx, 1)) <= 4096
- && INTVAL (XEXP (idx, 1)) >= -4096)
- {
- int val = INTVAL (XEXP (XEXP (idx, 0), 1));
- rtx reg1, reg2;
-
- reg1 = force_reg (Pmode, gen_rtx (PLUS, Pmode, base, XEXP (idx, 1)));
-
- reg2 = XEXP (XEXP (idx, 0), 0);
- if (GET_CODE (reg2) != CONST_INT)
- reg2 = force_reg (Pmode, force_operand (reg2, 0));
-
- return force_reg (Pmode, gen_rtx (PLUS, Pmode,
- gen_rtx (MULT, Pmode,
- reg2, GEN_INT (val)),
- reg1));
- }
-
- /* Get the index into a register, then add the base + index and
- return a register holding the result. */
-
- /* First get A into a register. */
- reg1 = XEXP (XEXP (idx, 0), 0);
- if (GET_CODE (reg1) != REG)
- reg1 = force_reg (Pmode, force_operand (reg1, 0));
-
- /* And get B into a register. */
- reg2 = XEXP (idx, 1);
- if (GET_CODE (reg2) != REG)
- reg2 = force_reg (Pmode, force_operand (reg2, 0));
-
- reg1 = force_reg (Pmode, gen_rtx (PLUS, Pmode,
- gen_rtx (MULT, Pmode, reg1,
- XEXP (XEXP (idx, 0), 1)),
- reg2));
-
- /* Add the result to our base register and return. */
- return force_reg (Pmode, gen_rtx (PLUS, Pmode, base, reg1));
-
- }
-
- /* Uh-oh. We might have an address for x[n-100000]. This needs
- special handling to avoid creating an indexed memory address
- with x-100000 as the base.
-
- If the constant part is small enough, then it's still safe because
- there is a guard page at the beginning and end of the data segment.
-
- Scaled references are common enough that we want to try and rearrange the
- terms so that we can use indexing for these addresses too. Only
- do the optimization for floatint point modes. */
-
- if (GET_CODE (x) == PLUS
- && symbolic_expression_p (XEXP (x, 1)))
- {
- /* Ugly. We modify things here so that the address offset specified
- by the index expression is computed first, then added to x to form
- the entire address. */
-
- rtx regx1, regx2, regy1, regy2, y;
-
- /* Strip off any CONST. */
- y = XEXP (x, 1);
- if (GET_CODE (y) == CONST)
- y = XEXP (y, 0);
-
- if (GET_CODE (y) == PLUS || GET_CODE (y) == MINUS)
- {
- /* See if this looks like
- (plus (mult (reg) (shadd_const))
- (const (plus (symbol_ref) (const_int))))
-
- Where const_int is small. In that case the const
- expression is a valid pointer for indexing.
-
- If const_int is big, but can be divided evenly by shadd_const
- and added to (reg). This allows more scaled indexed addresses. */
- if (GET_CODE (XEXP (y, 0)) == SYMBOL_REF
- && GET_CODE (XEXP (x, 0)) == MULT
- && GET_CODE (XEXP (y, 1)) == CONST_INT
- && INTVAL (XEXP (y, 1)) >= -4096
- && INTVAL (XEXP (y, 1)) <= 4095
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && shadd_constant_p (INTVAL (XEXP (XEXP (x, 0), 1))))
- {
- int val = INTVAL (XEXP (XEXP (x, 0), 1));
- rtx reg1, reg2;
-
- reg1 = XEXP (x, 1);
- if (GET_CODE (reg1) != REG)
- reg1 = force_reg (Pmode, force_operand (reg1, 0));
-
- reg2 = XEXP (XEXP (x, 0), 0);
- if (GET_CODE (reg2) != REG)
- reg2 = force_reg (Pmode, force_operand (reg2, 0));
-
- return force_reg (Pmode, gen_rtx (PLUS, Pmode,
- gen_rtx (MULT, Pmode,
- reg2, GEN_INT (val)),
- reg1));
- }
- else if ((mode == DFmode || mode == SFmode)
- && GET_CODE (XEXP (y, 0)) == SYMBOL_REF
- && GET_CODE (XEXP (x, 0)) == MULT
- && GET_CODE (XEXP (y, 1)) == CONST_INT
- && INTVAL (XEXP (y, 1)) % INTVAL (XEXP (XEXP (x, 0), 1)) == 0
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && shadd_constant_p (INTVAL (XEXP (XEXP (x, 0), 1))))
- {
- regx1
- = force_reg (Pmode, GEN_INT (INTVAL (XEXP (y, 1))
- / INTVAL (XEXP (XEXP (x, 0), 1))));
- regx2 = XEXP (XEXP (x, 0), 0);
- if (GET_CODE (regx2) != REG)
- regx2 = force_reg (Pmode, force_operand (regx2, 0));
- regx2 = force_reg (Pmode, gen_rtx (GET_CODE (y), Pmode,
- regx2, regx1));
- return force_reg (Pmode,
- gen_rtx (PLUS, Pmode,
- gen_rtx (MULT, Pmode, regx2,
- XEXP (XEXP (x, 0), 1)),
- force_reg (Pmode, XEXP (y, 0))));
- }
- else if (GET_CODE (XEXP (y, 1)) == CONST_INT
- && INTVAL (XEXP (y, 1)) >= -4096
- && INTVAL (XEXP (y, 1)) <= 4095)
- {
- /* This is safe because of the guard page at the
- beginning and end of the data space. Just
- return the original address. */
- return orig;
- }
- else
- {
- /* Doesn't look like one we can optimize. */
- regx1 = force_reg (Pmode, force_operand (XEXP (x, 0), 0));
- regy1 = force_reg (Pmode, force_operand (XEXP (y, 0), 0));
- regy2 = force_reg (Pmode, force_operand (XEXP (y, 1), 0));
- regx1 = force_reg (Pmode,
- gen_rtx (GET_CODE (y), Pmode, regx1, regy2));
- return force_reg (Pmode, gen_rtx (PLUS, Pmode, regx1, regy1));
- }
- }
- }
-
- return orig;
-}
-
-/* For the HPPA, REG and REG+CONST is cost 0
- and addresses involving symbolic constants are cost 2.
-
- PIC addresses are very expensive.
-
- It is no coincidence that this has the same structure
- as GO_IF_LEGITIMATE_ADDRESS. */
-int
-hppa_address_cost (X)
- rtx X;
-{
- if (GET_CODE (X) == PLUS)
- return 1;
- else if (GET_CODE (X) == LO_SUM)
- return 1;
- else if (GET_CODE (X) == HIGH)
- return 2;
- return 4;
-}
-
-/* Emit insns to move operands[1] into operands[0].
-
- Return 1 if we have written out everything that needs to be done to
- do the move. Otherwise, return 0 and the caller will emit the move
- normally. */
-
-int
-emit_move_sequence (operands, mode, scratch_reg)
- rtx *operands;
- enum machine_mode mode;
- rtx scratch_reg;
-{
- register rtx operand0 = operands[0];
- register rtx operand1 = operands[1];
-
- if (reload_in_progress && GET_CODE (operand0) == REG
- && REGNO (operand0) >= FIRST_PSEUDO_REGISTER)
- operand0 = reg_equiv_mem[REGNO (operand0)];
- else if (reload_in_progress && GET_CODE (operand0) == SUBREG
- && GET_CODE (SUBREG_REG (operand0)) == REG
- && REGNO (SUBREG_REG (operand0)) >= FIRST_PSEUDO_REGISTER)
- {
- SUBREG_REG (operand0) = reg_equiv_mem[REGNO (SUBREG_REG (operand0))];
- operand0 = alter_subreg (operand0);
- }
-
- if (reload_in_progress && GET_CODE (operand1) == REG
- && REGNO (operand1) >= FIRST_PSEUDO_REGISTER)
- operand1 = reg_equiv_mem[REGNO (operand1)];
- else if (reload_in_progress && GET_CODE (operand1) == SUBREG
- && GET_CODE (SUBREG_REG (operand1)) == REG
- && REGNO (SUBREG_REG (operand1)) >= FIRST_PSEUDO_REGISTER)
- {
- SUBREG_REG (operand1) = reg_equiv_mem[REGNO (SUBREG_REG (operand1))];
- operand1 = alter_subreg (operand1);
- }
-
- /* Handle secondary reloads for loads/stores of FP registers from
- REG+D addresses where D does not fit in 5 bits, including
- (subreg (mem (addr))) cases. */
- if (fp_reg_operand (operand0, mode)
- && ((GET_CODE (operand1) == MEM
- && ! memory_address_p (DFmode, XEXP (operand1, 0)))
- || ((GET_CODE (operand1) == SUBREG
- && GET_CODE (XEXP (operand1, 0)) == MEM
- && !memory_address_p (DFmode, XEXP (XEXP (operand1, 0), 0)))))
- && scratch_reg)
- {
- if (GET_CODE (operand1) == SUBREG)
- operand1 = XEXP (operand1, 0);
-
- scratch_reg = gen_rtx (REG, SImode, REGNO (scratch_reg));
-
- /* D might not fit in 14 bits either; for such cases load D into
- scratch reg. */
- if (!memory_address_p (SImode, XEXP (operand1, 0)))
- {
- emit_move_insn (scratch_reg, XEXP (XEXP (operand1, 0), 1));
- emit_move_insn (scratch_reg, gen_rtx (GET_CODE (XEXP (operand1, 0)),
- SImode,
- XEXP (XEXP (operand1, 0), 0),
- scratch_reg));
- }
- else
- emit_move_insn (scratch_reg, XEXP (operand1, 0));
- emit_insn (gen_rtx (SET, VOIDmode, operand0, gen_rtx (MEM, mode,
- scratch_reg)));
- return 1;
- }
- else if (fp_reg_operand (operand1, mode)
- && ((GET_CODE (operand0) == MEM
- && ! memory_address_p (DFmode, XEXP (operand0, 0)))
- || ((GET_CODE (operand0) == SUBREG)
- && GET_CODE (XEXP (operand0, 0)) == MEM
- && !memory_address_p (DFmode, XEXP (XEXP (operand0, 0), 0))))
- && scratch_reg)
- {
- if (GET_CODE (operand0) == SUBREG)
- operand0 = XEXP (operand0, 0);
-
- scratch_reg = gen_rtx (REG, SImode, REGNO (scratch_reg));
- /* D might not fit in 14 bits either; for such cases load D into
- scratch reg. */
- if (!memory_address_p (SImode, XEXP (operand0, 0)))
- {
- emit_move_insn (scratch_reg, XEXP (XEXP (operand0, 0), 1));
- emit_move_insn (scratch_reg, gen_rtx (GET_CODE (XEXP (operand0, 0)),
- SImode,
- XEXP (XEXP (operand0, 0), 0),
- scratch_reg));
- }
- else
- emit_move_insn (scratch_reg, XEXP (operand0, 0));
- emit_insn (gen_rtx (SET, VOIDmode, gen_rtx (MEM, mode, scratch_reg),
- operand1));
- return 1;
- }
- /* Handle secondary reloads for loads of FP registers from constant
- expressions by forcing the constant into memory.
-
- use scratch_reg to hold the address of the memory location.
-
- ??? The proper fix is to change PREFERRED_RELOAD_CLASS to return
- NO_REGS when presented with a const_int and an register class
- containing only FP registers. Doing so unfortunately creates
- more problems than it solves. Fix this for 2.5. */
- else if (fp_reg_operand (operand0, mode)
- && CONSTANT_P (operand1)
- && scratch_reg)
- {
- rtx xoperands[2];
-
- /* Force the constant into memory and put the address of the
- memory location into scratch_reg. */
- xoperands[0] = scratch_reg;
- xoperands[1] = XEXP (force_const_mem (mode, operand1), 0);
- emit_move_sequence (xoperands, Pmode, 0);
-
- /* Now load the destination register. */
- emit_insn (gen_rtx (SET, mode, operand0,
- gen_rtx (MEM, mode, scratch_reg)));
- return 1;
- }
- /* Handle secondary reloads for SAR. These occur when trying to load
- the SAR from memory a FP register, or with a constant. */
- else if (GET_CODE (operand0) == REG
- && REGNO_REG_CLASS (REGNO (operand0)) == SHIFT_REGS
- && (GET_CODE (operand1) == MEM
- || GET_CODE (operand1) == CONST_INT
- || (GET_CODE (operand1) == REG
- && FP_REG_CLASS_P (REGNO_REG_CLASS (REGNO (operand1)))))
- && scratch_reg)
- {
- /* D might not fit in 14 bits either; for such cases load D into
- scratch reg. */
- if (GET_CODE (operand1) == MEM
- && !memory_address_p (SImode, XEXP (operand1, 0)))
- {
- emit_move_insn (scratch_reg, XEXP (XEXP (operand1, 0), 1));
- emit_move_insn (scratch_reg, gen_rtx (GET_CODE (XEXP (operand1, 0)),
- SImode,
- XEXP (XEXP (operand1, 0), 0),
- scratch_reg));
- emit_move_insn (scratch_reg, gen_rtx (MEM, GET_MODE (operand1),
- scratch_reg));
- }
- else
- emit_move_insn (scratch_reg, operand1);
- emit_move_insn (operand0, scratch_reg);
- return 1;
- }
- /* Handle most common case: storing into a register. */
- else if (register_operand (operand0, mode))
- {
- if (register_operand (operand1, mode)
- || (GET_CODE (operand1) == CONST_INT && INT_14_BITS (operand1))
- || (operand1 == CONST0_RTX (mode))
- || (GET_CODE (operand1) == HIGH
- && !symbolic_operand (XEXP (operand1, 0), VOIDmode))
- /* Only `general_operands' can come here, so MEM is ok. */
- || GET_CODE (operand1) == MEM)
- {
- /* Run this case quickly. */
- emit_insn (gen_rtx (SET, VOIDmode, operand0, operand1));
- return 1;
- }
- }
- else if (GET_CODE (operand0) == MEM)
- {
- if (mode == DFmode && operand1 == CONST0_RTX (mode)
- && !(reload_in_progress || reload_completed))
- {
- rtx temp = gen_reg_rtx (DFmode);
-
- emit_insn (gen_rtx (SET, VOIDmode, temp, operand1));
- emit_insn (gen_rtx (SET, VOIDmode, operand0, temp));
- return 1;
- }
- if (register_operand (operand1, mode) || operand1 == CONST0_RTX (mode))
- {
- /* Run this case quickly. */
- emit_insn (gen_rtx (SET, VOIDmode, operand0, operand1));
- return 1;
- }
- if (! (reload_in_progress || reload_completed))
- {
- operands[0] = validize_mem (operand0);
- operands[1] = operand1 = force_reg (mode, operand1);
- }
- }
-
- /* Simplify the source if we need to. */
- if ((GET_CODE (operand1) != HIGH && immediate_operand (operand1, mode))
- || (GET_CODE (operand1) == HIGH
- && symbolic_operand (XEXP (operand1, 0), mode)))
- {
- int ishighonly = 0;
-
- if (GET_CODE (operand1) == HIGH)
- {
- ishighonly = 1;
- operand1 = XEXP (operand1, 0);
- }
- if (symbolic_operand (operand1, mode))
- {
- rtx const_part = NULL;
-
- /* Argh. The assembler and linker can't handle arithmetic
- involving plabels. We'll have to split up operand1 here
- if it's a function label involved in an arithmetic
- expression. Luckily, this only happens with addition
- of constants to plabels, which simplifies the test.
-
- We add the constant back in just before returning to
- our caller. */
- if (GET_CODE (operand1) == CONST
- && GET_CODE (XEXP (operand1, 0)) == PLUS
- && function_label_operand (XEXP (XEXP (operand1, 0), 0), Pmode))
- {
- /* Save away the constant part of the expression. */
- const_part = XEXP (XEXP (operand1, 0), 1);
- if (GET_CODE (const_part) != CONST_INT)
- abort ();
-
- /* Set operand1 to just the SYMBOL_REF. */
- operand1 = XEXP (XEXP (operand1, 0), 0);
- }
-
- if (flag_pic)
- {
- rtx temp;
-
- if (reload_in_progress || reload_completed)
- temp = scratch_reg ? scratch_reg : operand0;
- else
- temp = gen_reg_rtx (Pmode);
-
- /* If operand1 is a function label, then we've got to
- force it to memory, then load op0 from memory. */
- if (function_label_operand (operand1, mode))
- {
- operands[1] = force_const_mem (mode, operand1);
- emit_move_sequence (operands, mode, temp);
- }
- /* Likewise for (const (plus (symbol) (const_int))) when
- generating pic code during or after reload and const_int
- will not fit in 14 bits. */
- else if (GET_CODE (operand1) == CONST
- && GET_CODE (XEXP (operand1, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (operand1, 0), 1)) == CONST_INT
- && !INT_14_BITS (XEXP (XEXP (operand1, 0), 1))
- && (reload_completed || reload_in_progress)
- && flag_pic)
- {
- operands[1] = force_const_mem (mode, operand1);
- operands[1] = legitimize_pic_address (XEXP (operands[1], 0),
- mode, temp);
- emit_move_sequence (operands, mode, temp);
- }
- else
- {
- operands[1] = legitimize_pic_address (operand1, mode, temp);
- emit_insn (gen_rtx (SET, VOIDmode, operand0, operands[1]));
- }
- }
- /* On the HPPA, references to data space are supposed to use dp,
- register 27, but showing it in the RTL inhibits various cse
- and loop optimizations. */
- else
- {
- rtx temp, set;
-
- if (reload_in_progress || reload_completed)
- temp = scratch_reg ? scratch_reg : operand0;
- else
- temp = gen_reg_rtx (mode);
-
- /* Loading a SYMBOL_REF into a register makes that register
- safe to be used as the base in an indexed address.
-
- Don't mark hard registers though. That loses. */
- if (GET_CODE (operand0) == REG
- && REGNO (operand0) >= FIRST_PSEUDO_REGISTER)
- REGNO_POINTER_FLAG (REGNO (operand0)) = 1;
- if (REGNO (temp) >= FIRST_PSEUDO_REGISTER)
- REGNO_POINTER_FLAG (REGNO (temp)) = 1;
- if (ishighonly)
- set = gen_rtx (SET, mode, operand0, temp);
- else
- set = gen_rtx (SET, VOIDmode,
- operand0,
- gen_rtx (LO_SUM, mode, temp, operand1));
-
- emit_insn (gen_rtx (SET, VOIDmode,
- temp,
- gen_rtx (HIGH, mode, operand1)));
- emit_insn (set);
-
- }
-
- /* Add back in the constant part if needed. */
- if (const_part != NULL)
- expand_inc (operand0, const_part);
- return 1;
- }
- else if (GET_CODE (operand1) != CONST_INT
- || ! cint_ok_for_move (INTVAL (operand1)))
- {
- rtx temp;
-
- if (reload_in_progress || reload_completed)
- temp = operand0;
- else
- temp = gen_reg_rtx (mode);
-
- emit_insn (gen_rtx (SET, VOIDmode, temp,
- gen_rtx (HIGH, mode, operand1)));
- operands[1] = gen_rtx (LO_SUM, mode, temp, operand1);
- }
- }
- /* Now have insn-emit do whatever it normally does. */
- return 0;
-}
-
-/* Examine EXP and return nonzero if it contains an ADDR_EXPR (meaning
- it will need a link/runtime reloc). */
-
-int
-reloc_needed (exp)
- tree exp;
-{
- int reloc = 0;
-
- switch (TREE_CODE (exp))
- {
- case ADDR_EXPR:
- return 1;
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- reloc = reloc_needed (TREE_OPERAND (exp, 0));
- reloc |= reloc_needed (TREE_OPERAND (exp, 1));
- break;
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- case NON_LVALUE_EXPR:
- reloc = reloc_needed (TREE_OPERAND (exp, 0));
- break;
-
- case CONSTRUCTOR:
- {
- register tree link;
- for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link))
- if (TREE_VALUE (link) != 0)
- reloc |= reloc_needed (TREE_VALUE (link));
- }
- break;
-
- case ERROR_MARK:
- break;
- }
- return reloc;
-}
-
-/* Does operand (which is a symbolic_operand) live in text space? If
- so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true. */
-
-int
-read_only_operand (operand)
- rtx operand;
-{
- if (GET_CODE (operand) == CONST)
- operand = XEXP (XEXP (operand, 0), 0);
- if (flag_pic)
- {
- if (GET_CODE (operand) == SYMBOL_REF)
- return SYMBOL_REF_FLAG (operand) && !CONSTANT_POOL_ADDRESS_P (operand);
- }
- else
- {
- if (GET_CODE (operand) == SYMBOL_REF)
- return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
- }
- return 1;
-}
-
-
-/* Return the best assembler insn template
- for moving operands[1] into operands[0] as a fullword. */
-char *
-singlemove_string (operands)
- rtx *operands;
-{
- HOST_WIDE_INT intval;
-
- if (GET_CODE (operands[0]) == MEM)
- return "stw %r1,%0";
- if (GET_CODE (operands[1]) == MEM)
- return "ldw %1,%0";
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- long i;
- REAL_VALUE_TYPE d;
-
- if (GET_MODE (operands[1]) != SFmode)
- abort ();
-
- /* Translate the CONST_DOUBLE to a CONST_INT with the same target
- bit pattern. */
- REAL_VALUE_FROM_CONST_DOUBLE (d, operands[1]);
- REAL_VALUE_TO_TARGET_SINGLE (d, i);
-
- operands[1] = GEN_INT (i);
- /* Fall through to CONST_INT case. */
- }
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- intval = INTVAL (operands[1]);
-
- if (VAL_14_BITS_P (intval))
- return "ldi %1,%0";
- else if ((intval & 0x7ff) == 0)
- return "ldil L'%1,%0";
- else if (zdepi_cint_p (intval))
- return "zdepi %Z1,%0";
- else
- return "ldil L'%1,%0\n\tldo R'%1(%0),%0";
- }
- return "copy %1,%0";
-}
-
-
-/* Compute position (in OP[1]) and width (in OP[2])
- useful for copying IMM to a register using the zdepi
- instructions. Store the immediate value to insert in OP[0]. */
-void
-compute_zdepi_operands (imm, op)
- unsigned HOST_WIDE_INT imm;
- unsigned *op;
-{
- int lsb, len;
-
- /* Find the least significant set bit in IMM. */
- for (lsb = 0; lsb < 32; lsb++)
- {
- if ((imm & 1) != 0)
- break;
- imm >>= 1;
- }
-
- /* Choose variants based on *sign* of the 5-bit field. */
- if ((imm & 0x10) == 0)
- len = (lsb <= 28) ? 4 : 32 - lsb;
- else
- {
- /* Find the width of the bitstring in IMM. */
- for (len = 5; len < 32; len++)
- {
- if ((imm & (1 << len)) == 0)
- break;
- }
-
- /* Sign extend IMM as a 5-bit value. */
- imm = (imm & 0xf) - 0x10;
- }
-
- op[0] = imm;
- op[1] = 31 - lsb;
- op[2] = len;
-}
-
-/* Output assembler code to perform a doubleword move insn
- with operands OPERANDS. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum { REGOP, OFFSOP, MEMOP, CNSTOP, RNDOP } optype0, optype1;
- rtx latehalf[2];
- rtx addreg0 = 0, addreg1 = 0;
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1]))
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 != REGOP && optype1 != REGOP)
- abort ();
-
- /* Handle auto decrementing and incrementing loads and stores
- specifically, since the structure of the function doesn't work
- for them without major modification. Do it better when we learn
- this port about the general inc/dec addressing of PA.
- (This was written by tege. Chide him if it doesn't work.) */
-
- if (optype0 == MEMOP)
- {
- /* We have to output the address syntax ourselves, since print_operand
- doesn't deal with the addresses we want to use. Fix this later. */
-
- rtx addr = XEXP (operands[0], 0);
- if (GET_CODE (addr) == POST_INC || GET_CODE (addr) == POST_DEC)
- {
- rtx high_reg = gen_rtx (SUBREG, SImode, operands[1], 0);
-
- operands[0] = XEXP (addr, 0);
- if (GET_CODE (operands[1]) != REG || GET_CODE (operands[0]) != REG)
- abort ();
-
- if (!reg_overlap_mentioned_p (high_reg, addr))
- {
- /* No overlap between high target register and address
- register. (We do this in a non-obvious way to
- save a register file writeback) */
- if (GET_CODE (addr) == POST_INC)
- return "stws,ma %1,8(0,%0)\n\tstw %R1,-4(0,%0)";
- return "stws,ma %1,-8(0,%0)\n\tstw %R1,12(0,%0)";
- }
- else
- abort();
- }
- else if (GET_CODE (addr) == PRE_INC || GET_CODE (addr) == PRE_DEC)
- {
- rtx high_reg = gen_rtx (SUBREG, SImode, operands[1], 0);
-
- operands[0] = XEXP (addr, 0);
- if (GET_CODE (operands[1]) != REG || GET_CODE (operands[0]) != REG)
- abort ();
-
- if (!reg_overlap_mentioned_p (high_reg, addr))
- {
- /* No overlap between high target register and address
- register. (We do this in a non-obvious way to
- save a register file writeback) */
- if (GET_CODE (addr) == PRE_INC)
- return "stws,mb %1,8(0,%0)\n\tstw %R1,4(0,%0)";
- return "stws,mb %1,-8(0,%0)\n\tstw %R1,4(0,%0)";
- }
- else
- abort();
- }
- }
- if (optype1 == MEMOP)
- {
- /* We have to output the address syntax ourselves, since print_operand
- doesn't deal with the addresses we want to use. Fix this later. */
-
- rtx addr = XEXP (operands[1], 0);
- if (GET_CODE (addr) == POST_INC || GET_CODE (addr) == POST_DEC)
- {
- rtx high_reg = gen_rtx (SUBREG, SImode, operands[0], 0);
-
- operands[1] = XEXP (addr, 0);
- if (GET_CODE (operands[0]) != REG || GET_CODE (operands[1]) != REG)
- abort ();
-
- if (!reg_overlap_mentioned_p (high_reg, addr))
- {
- /* No overlap between high target register and address
- register. (We do this in a non-obvious way to
- save a register file writeback) */
- if (GET_CODE (addr) == POST_INC)
- return "ldws,ma 8(0,%1),%0\n\tldw -4(0,%1),%R0";
- return "ldws,ma -8(0,%1),%0\n\tldw 12(0,%1),%R0";
- }
- else
- {
- /* This is an undefined situation. We should load into the
- address register *and* update that register. Probably
- we don't need to handle this at all. */
- if (GET_CODE (addr) == POST_INC)
- return "ldw 4(0,%1),%R0\n\tldws,ma 8(0,%1),%0";
- return "ldw 4(0,%1),%R0\n\tldws,ma -8(0,%1),%0";
- }
- }
- else if (GET_CODE (addr) == PRE_INC || GET_CODE (addr) == PRE_DEC)
- {
- rtx high_reg = gen_rtx (SUBREG, SImode, operands[0], 0);
-
- operands[1] = XEXP (addr, 0);
- if (GET_CODE (operands[0]) != REG || GET_CODE (operands[1]) != REG)
- abort ();
-
- if (!reg_overlap_mentioned_p (high_reg, addr))
- {
- /* No overlap between high target register and address
- register. (We do this in a non-obvious way to
- save a register file writeback) */
- if (GET_CODE (addr) == PRE_INC)
- return "ldws,mb 8(0,%1),%0\n\tldw 4(0,%1),%R0";
- return "ldws,mb -8(0,%1),%0\n\tldw 4(0,%1),%R0";
- }
- else
- {
- /* This is an undefined situation. We should load into the
- address register *and* update that register. Probably
- we don't need to handle this at all. */
- if (GET_CODE (addr) == PRE_INC)
- return "ldw 12(0,%1),%R0\n\tldws,mb 8(0,%1),%0";
- return "ldw -4(0,%1),%R0\n\tldws,mb -8(0,%1),%0";
- }
- }
- }
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (operands[0], 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (operands[1], 0));
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], 4);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- else if (optype1 == CNSTOP)
- split_double (operands[1], &operands[1], &latehalf[1]);
- else
- latehalf[1] = operands[1];
-
- /* If the first move would clobber the source of the second one,
- do them in the other order.
-
- This can happen in two cases:
-
- mem -> register where the first half of the destination register
- is the same register used in the memory's address. Reload
- can create such insns.
-
- mem in this case will be either register indirect or register
- indirect plus a valid offset.
-
- register -> register move where REGNO(dst) == REGNO(src + 1)
- someone (Tim/Tege?) claimed this can happen for parameter loads.
-
- Handle mem -> register case first. */
- if (optype0 == REGOP
- && (optype1 == MEMOP || optype1 == OFFSOP)
- && refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands[1], 0))
- {
- /* Do the late half first. */
- if (addreg1)
- output_asm_insn ("ldo 4(%0),%0", &addreg1);
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Then clobber. */
- if (addreg1)
- output_asm_insn ("ldo -4(%0),%0", &addreg1);
- return singlemove_string (operands);
- }
-
- /* Now handle register -> register case. */
- if (optype0 == REGOP && optype1 == REGOP
- && REGNO (operands[0]) == REGNO (operands[1]) + 1)
- {
- output_asm_insn (singlemove_string (latehalf), latehalf);
- return singlemove_string (operands);
- }
-
- /* Normal case: do the two words, low-numbered first. */
-
- output_asm_insn (singlemove_string (operands), operands);
-
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("ldo 4(%0),%0", &addreg0);
- if (addreg1)
- output_asm_insn ("ldo 4(%0),%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("ldo -4(%0),%0", &addreg0);
- if (addreg1)
- output_asm_insn ("ldo -4(%0),%0", &addreg1);
-
- return "";
-}
-
-char *
-output_fp_move_double (operands)
- rtx *operands;
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1])
- || operands[1] == CONST0_RTX (GET_MODE (operands[0])))
- output_asm_insn ("fcpy,dbl %r1,%0", operands);
- else
- output_asm_insn ("fldd%F1 %1,%0", operands);
- }
- else if (FP_REG_P (operands[1]))
- {
- output_asm_insn ("fstd%F0 %1,%0", operands);
- }
- else if (operands[1] == CONST0_RTX (GET_MODE (operands[0])))
- {
- if (GET_CODE (operands[0]) == REG)
- {
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- xoperands[0] = operands[0];
- output_asm_insn ("copy %%r0,%0\n\tcopy %%r0,%1", xoperands);
- }
- /* This is a pain. You have to be prepared to deal with an
- arbitrary address here including pre/post increment/decrement.
-
- so avoid this in the MD. */
- else
- abort ();
- }
- else abort ();
- return "";
-}
-
-/* Return a REG that occurs in ADDR with coefficient 1.
- ADDR can be effectively incremented by incrementing REG. */
-
-static rtx
-find_addr_reg (addr)
- rtx addr;
-{
- while (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG)
- addr = XEXP (addr, 0);
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 0)))
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 1)))
- addr = XEXP (addr, 0);
- else
- abort ();
- }
- if (GET_CODE (addr) == REG)
- return addr;
- abort ();
-}
-
-/* Emit code to perform a block move.
-
- OPERANDS[0] is the destination pointer as a REG, clobbered.
- OPERANDS[1] is the source pointer as a REG, clobbered.
- OPERANDS[2] is a register for temporary storage.
- OPERANDS[4] is the size as a CONST_INT
- OPERANDS[3] is a register for temporary storage.
- OPERANDS[5] is the alignment safe to use, as a CONST_INT.
- OPERNADS[6] is another temporary register. */
-
-char *
-output_block_move (operands, size_is_constant)
- rtx *operands;
- int size_is_constant;
-{
- int align = INTVAL (operands[5]);
- unsigned long n_bytes = INTVAL (operands[4]);
-
- /* We can't move more than four bytes at a time because the PA
- has no longer integer move insns. (Could use fp mem ops?) */
- if (align > 4)
- align = 4;
-
- /* Note that we know each loop below will execute at least twice
- (else we would have open-coded the copy). */
- switch (align)
- {
- case 4:
- /* Pre-adjust the loop counter. */
- operands[4] = GEN_INT (n_bytes - 8);
- output_asm_insn ("ldi %4,%2", operands);
-
- /* Copying loop. */
- output_asm_insn ("ldws,ma 4(0,%1),%3", operands);
- output_asm_insn ("ldws,ma 4(0,%1),%6", operands);
- output_asm_insn ("stws,ma %3,4(0,%0)", operands);
- output_asm_insn ("addib,>= -8,%2,.-12", operands);
- output_asm_insn ("stws,ma %6,4(0,%0)", operands);
-
- /* Handle the residual. There could be up to 7 bytes of
- residual to copy! */
- if (n_bytes % 8 != 0)
- {
- operands[4] = GEN_INT (n_bytes % 4);
- if (n_bytes % 8 >= 4)
- output_asm_insn ("ldws,ma 4(0,%1),%3", operands);
- if (n_bytes % 4 != 0)
- output_asm_insn ("ldw 0(0,%1),%6", operands);
- if (n_bytes % 8 >= 4)
- output_asm_insn ("stws,ma %3,4(0,%0)", operands);
- if (n_bytes % 4 != 0)
- output_asm_insn ("stbys,e %6,%4(0,%0)", operands);
- }
- return "";
-
- case 2:
- /* Pre-adjust the loop counter. */
- operands[4] = GEN_INT (n_bytes - 4);
- output_asm_insn ("ldi %4,%2", operands);
-
- /* Copying loop. */
- output_asm_insn ("ldhs,ma 2(0,%1),%3", operands);
- output_asm_insn ("ldhs,ma 2(0,%1),%6", operands);
- output_asm_insn ("sths,ma %3,2(0,%0)", operands);
- output_asm_insn ("addib,>= -4,%2,.-12", operands);
- output_asm_insn ("sths,ma %6,2(0,%0)", operands);
-
- /* Handle the residual. */
- if (n_bytes % 4 != 0)
- {
- if (n_bytes % 4 >= 2)
- output_asm_insn ("ldhs,ma 2(0,%1),%3", operands);
- if (n_bytes % 2 != 0)
- output_asm_insn ("ldb 0(0,%1),%6", operands);
- if (n_bytes % 4 >= 2)
- output_asm_insn ("sths,ma %3,2(0,%0)", operands);
- if (n_bytes % 2 != 0)
- output_asm_insn ("stb %6,0(0,%0)", operands);
- }
- return "";
-
- case 1:
- /* Pre-adjust the loop counter. */
- operands[4] = GEN_INT (n_bytes - 2);
- output_asm_insn ("ldi %4,%2", operands);
-
- /* Copying loop. */
- output_asm_insn ("ldbs,ma 1(0,%1),%3", operands);
- output_asm_insn ("ldbs,ma 1(0,%1),%6", operands);
- output_asm_insn ("stbs,ma %3,1(0,%0)", operands);
- output_asm_insn ("addib,>= -2,%2,.-12", operands);
- output_asm_insn ("stbs,ma %6,1(0,%0)", operands);
-
- /* Handle the residual. */
- if (n_bytes % 2 != 0)
- {
- output_asm_insn ("ldb 0(0,%1),%3", operands);
- output_asm_insn ("stb %3,0(0,%0)", operands);
- }
- return "";
-
- default:
- abort ();
- }
-}
-
-/* Count the number of insns necessary to handle this block move.
-
- Basic structure is the same as emit_block_move, except that we
- count insns rather than emit them. */
-
-int
-compute_movstrsi_length (insn)
- rtx insn;
-{
- rtx pat = PATTERN (insn);
- int align = INTVAL (XEXP (XVECEXP (pat, 0, 6), 0));
- unsigned long n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 5), 0));
- unsigned int n_insns = 0;
-
- /* We can't move more than four bytes at a time because the PA
- has no longer integer move insns. (Could use fp mem ops?) */
- if (align > 4)
- align = 4;
-
- /* The basic copying loop. */
- n_insns = 6;
-
- /* Residuals. */
- if (n_bytes % (2 * align) != 0)
- {
- if ((n_bytes % (2 * align)) >= align)
- n_insns += 2;
-
- if ((n_bytes % align) != 0)
- n_insns += 2;
- }
-
- /* Lengths are expressed in bytes now; each insn is 4 bytes. */
- return n_insns * 4;
-}
-
-
-char *
-output_and (operands)
- rtx *operands;
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
- {
- unsigned HOST_WIDE_INT mask = INTVAL (operands[2]);
- int ls0, ls1, ms0, p, len;
-
- for (ls0 = 0; ls0 < 32; ls0++)
- if ((mask & (1 << ls0)) == 0)
- break;
-
- for (ls1 = ls0; ls1 < 32; ls1++)
- if ((mask & (1 << ls1)) != 0)
- break;
-
- for (ms0 = ls1; ms0 < 32; ms0++)
- if ((mask & (1 << ms0)) == 0)
- break;
-
- if (ms0 != 32)
- abort();
-
- if (ls1 == 32)
- {
- len = ls0;
-
- if (len == 0)
- abort ();
-
- operands[2] = GEN_INT (len);
- return "extru %1,31,%2,%0";
- }
- else
- {
- /* We could use this `depi' for the case above as well, but `depi'
- requires one more register file access than an `extru'. */
-
- p = 31 - ls0;
- len = ls1 - ls0;
-
- operands[2] = GEN_INT (p);
- operands[3] = GEN_INT (len);
- return "depi 0,%2,%3,%0";
- }
- }
- else
- return "and %1,%2,%0";
-}
-
-char *
-output_ior (operands)
- rtx *operands;
-{
- unsigned HOST_WIDE_INT mask = INTVAL (operands[2]);
- int bs0, bs1, p, len;
-
- if (INTVAL (operands[2]) == 0)
- return "copy %1,%0";
-
- for (bs0 = 0; bs0 < 32; bs0++)
- if ((mask & (1 << bs0)) != 0)
- break;
-
- for (bs1 = bs0; bs1 < 32; bs1++)
- if ((mask & (1 << bs1)) == 0)
- break;
-
- if (bs1 != 32 && ((unsigned HOST_WIDE_INT) 1 << bs1) <= mask)
- abort();
-
- p = 31 - bs0;
- len = bs1 - bs0;
-
- operands[2] = GEN_INT (p);
- operands[3] = GEN_INT (len);
- return "depi -1,%2,%3,%0";
-}
-
-/* Output an ascii string. */
-void
-output_ascii (file, p, size)
- FILE *file;
- unsigned char *p;
- int size;
-{
- int i;
- int chars_output;
- unsigned char partial_output[16]; /* Max space 4 chars can occupy. */
-
- /* The HP assembler can only take strings of 256 characters at one
- time. This is a limitation on input line length, *not* the
- length of the string. Sigh. Even worse, it seems that the
- restriction is in number of input characters (see \xnn &
- \whatever). So we have to do this very carefully. */
-
- fputs ("\t.STRING \"", file);
-
- chars_output = 0;
- for (i = 0; i < size; i += 4)
- {
- int co = 0;
- int io = 0;
- for (io = 0, co = 0; io < MIN (4, size - i); io++)
- {
- register unsigned int c = p[i + io];
-
- if (c == '\"' || c == '\\')
- partial_output[co++] = '\\';
- if (c >= ' ' && c < 0177)
- partial_output[co++] = c;
- else
- {
- unsigned int hexd;
- partial_output[co++] = '\\';
- partial_output[co++] = 'x';
- hexd = c / 16 - 0 + '0';
- if (hexd > '9')
- hexd -= '9' - 'a' + 1;
- partial_output[co++] = hexd;
- hexd = c % 16 - 0 + '0';
- if (hexd > '9')
- hexd -= '9' - 'a' + 1;
- partial_output[co++] = hexd;
- }
- }
- if (chars_output + co > 243)
- {
- fputs ("\"\n\t.STRING \"", file);
- chars_output = 0;
- }
- fwrite (partial_output, 1, co, file);
- chars_output += co;
- co = 0;
- }
- fputs ("\"\n", file);
-}
-
-/* Try to rewrite floating point comparisons & branches to avoid
- useless add,tr insns.
-
- CHECK_NOTES is nonzero if we should examine REG_DEAD notes
- to see if FPCC is dead. CHECK_NOTES is nonzero for the
- first attempt to remove useless add,tr insns. It is zero
- for the second pass as reorg sometimes leaves bogus REG_DEAD
- notes lying around.
-
- When CHECK_NOTES is zero we can only eliminate add,tr insns
- when there's a 1:1 correspondence between fcmp and ftest/fbranch
- instructions. */
-void
-remove_useless_addtr_insns (insns, check_notes)
- rtx insns;
- int check_notes;
-{
- rtx insn;
- int all;
- static int pass = 0;
-
- /* This is fairly cheap, so always run it when optimizing. */
- if (optimize > 0)
- {
- int fcmp_count = 0;
- int fbranch_count = 0;
-
- /* Walk all the insns in this function looking for fcmp & fbranch
- instructions. Keep track of how many of each we find. */
- insns = get_insns ();
- for (insn = insns; insn; insn = next_insn (insn))
- {
- rtx tmp;
-
- /* Ignore anything that isn't an INSN or a JUMP_INSN. */
- if (GET_CODE (insn) != INSN && GET_CODE (insn) != JUMP_INSN)
- continue;
-
- tmp = PATTERN (insn);
-
- /* It must be a set. */
- if (GET_CODE (tmp) != SET)
- continue;
-
- /* If the destination is CCFP, then we've found an fcmp insn. */
- tmp = SET_DEST (tmp);
- if (GET_CODE (tmp) == REG && REGNO (tmp) == 0)
- {
- fcmp_count++;
- continue;
- }
-
- tmp = PATTERN (insn);
- /* If this is an fbranch instruction, bump the fbranch counter. */
- if (GET_CODE (tmp) == SET
- && SET_DEST (tmp) == pc_rtx
- && GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
- && GET_CODE (XEXP (SET_SRC (tmp), 0)) == NE
- && GET_CODE (XEXP (XEXP (SET_SRC (tmp), 0), 0)) == REG
- && REGNO (XEXP (XEXP (SET_SRC (tmp), 0), 0)) == 0)
- {
- fbranch_count++;
- continue;
- }
- }
-
-
- /* Find all floating point compare + branch insns. If possible,
- reverse the comparison & the branch to avoid add,tr insns. */
- for (insn = insns; insn; insn = next_insn (insn))
- {
- rtx tmp, next;
-
- /* Ignore anything that isn't an INSN. */
- if (GET_CODE (insn) != INSN)
- continue;
-
- tmp = PATTERN (insn);
-
- /* It must be a set. */
- if (GET_CODE (tmp) != SET)
- continue;
-
- /* The destination must be CCFP, which is register zero. */
- tmp = SET_DEST (tmp);
- if (GET_CODE (tmp) != REG || REGNO (tmp) != 0)
- continue;
-
- /* INSN should be a set of CCFP.
-
- See if the result of this insn is used in a reversed FP
- conditional branch. If so, reverse our condition and
- the branch. Doing so avoids useless add,tr insns. */
- next = next_insn (insn);
- while (next)
- {
- /* Jumps, calls and labels stop our search. */
- if (GET_CODE (next) == JUMP_INSN
- || GET_CODE (next) == CALL_INSN
- || GET_CODE (next) == CODE_LABEL)
- break;
-
- /* As does another fcmp insn. */
- if (GET_CODE (next) == INSN
- && GET_CODE (PATTERN (next)) == SET
- && GET_CODE (SET_DEST (PATTERN (next))) == REG
- && REGNO (SET_DEST (PATTERN (next))) == 0)
- break;
-
- next = next_insn (next);
- }
-
- /* Is NEXT_INSN a branch? */
- if (next
- && GET_CODE (next) == JUMP_INSN)
- {
- rtx pattern = PATTERN (next);
-
- /* If it a reversed fp conditional branch (eg uses add,tr)
- and CCFP dies, then reverse our conditional and the branch
- to avoid the add,tr. */
- if (GET_CODE (pattern) == SET
- && SET_DEST (pattern) == pc_rtx
- && GET_CODE (SET_SRC (pattern)) == IF_THEN_ELSE
- && GET_CODE (XEXP (SET_SRC (pattern), 0)) == NE
- && GET_CODE (XEXP (XEXP (SET_SRC (pattern), 0), 0)) == REG
- && REGNO (XEXP (XEXP (SET_SRC (pattern), 0), 0)) == 0
- && GET_CODE (XEXP (SET_SRC (pattern), 1)) == PC
- && (fcmp_count == fbranch_count
- || (check_notes
- && find_regno_note (next, REG_DEAD, 0))))
- {
- /* Reverse the branch. */
- tmp = XEXP (SET_SRC (pattern), 1);
- XEXP (SET_SRC (pattern), 1) = XEXP (SET_SRC (pattern), 2);
- XEXP (SET_SRC (pattern), 2) = tmp;
- INSN_CODE (next) = -1;
-
- /* Reverse our condition. */
- tmp = PATTERN (insn);
- PUT_CODE (XEXP (tmp, 1),
- reverse_condition (GET_CODE (XEXP (tmp, 1))));
- }
- }
- }
- }
-
- pass = !pass;
-
-}
-
-/* You may have trouble believing this, but this is the HP-PA stack
- layout. Wow.
-
- Offset Contents
-
- Variable arguments (optional; any number may be allocated)
-
- SP-(4*(N+9)) arg word N
- : :
- SP-56 arg word 5
- SP-52 arg word 4
-
- Fixed arguments (must be allocated; may remain unused)
-
- SP-48 arg word 3
- SP-44 arg word 2
- SP-40 arg word 1
- SP-36 arg word 0
-
- Frame Marker
-
- SP-32 External Data Pointer (DP)
- SP-28 External sr4
- SP-24 External/stub RP (RP')
- SP-20 Current RP
- SP-16 Static Link
- SP-12 Clean up
- SP-8 Calling Stub RP (RP'')
- SP-4 Previous SP
-
- Top of Frame
-
- SP-0 Stack Pointer (points to next available address)
-
-*/
-
-/* This function saves registers as follows. Registers marked with ' are
- this function's registers (as opposed to the previous function's).
- If a frame_pointer isn't needed, r4 is saved as a general register;
- the space for the frame pointer is still allocated, though, to keep
- things simple.
-
-
- Top of Frame
-
- SP (FP') Previous FP
- SP + 4 Alignment filler (sigh)
- SP + 8 Space for locals reserved here.
- .
- .
- .
- SP + n All call saved register used.
- .
- .
- .
- SP + o All call saved fp registers used.
- .
- .
- .
- SP + p (SP') points to next available address.
-
-*/
-
-/* Emit RTL to store REG at the memory location specified by BASE+DISP.
- Handle case where DISP > 8k by using the add_high_const pattern.
-
- Note in DISP > 8k case, we will leave the high part of the address
- in %r1. There is code in expand_hppa_{prologue,epilogue} that knows this.*/
-static void
-store_reg (reg, disp, base)
- int reg, disp, base;
-{
- if (VAL_14_BITS_P (disp))
- {
- emit_move_insn (gen_rtx (MEM, SImode,
- gen_rtx (PLUS, SImode,
- gen_rtx (REG, SImode, base),
- GEN_INT (disp))),
- gen_rtx (REG, SImode, reg));
- }
- else
- {
- emit_insn (gen_add_high_const (gen_rtx (REG, SImode, 1),
- gen_rtx (REG, SImode, base),
- GEN_INT (disp)));
- emit_move_insn (gen_rtx (MEM, SImode,
- gen_rtx (LO_SUM, SImode,
- gen_rtx (REG, SImode, 1),
- GEN_INT (disp))),
- gen_rtx (REG, SImode, reg));
- }
-}
-
-/* Emit RTL to load REG from the memory location specified by BASE+DISP.
- Handle case where DISP > 8k by using the add_high_const pattern.
-
- Note in DISP > 8k case, we will leave the high part of the address
- in %r1. There is code in expand_hppa_{prologue,epilogue} that knows this.*/
-static void
-load_reg (reg, disp, base)
- int reg, disp, base;
-{
- if (VAL_14_BITS_P (disp))
- {
- emit_move_insn (gen_rtx (REG, SImode, reg),
- gen_rtx (MEM, SImode,
- gen_rtx (PLUS, SImode,
- gen_rtx (REG, SImode, base),
- GEN_INT (disp))));
- }
- else
- {
- emit_insn (gen_add_high_const (gen_rtx (REG, SImode, 1),
- gen_rtx (REG, SImode, base),
- GEN_INT (disp)));
- emit_move_insn (gen_rtx (REG, SImode, reg),
- gen_rtx (MEM, SImode,
- gen_rtx (LO_SUM, SImode,
- gen_rtx (REG, SImode, 1),
- GEN_INT (disp))));
- }
-}
-
-/* Emit RTL to set REG to the value specified by BASE+DISP.
- Handle case where DISP > 8k by using the add_high_const pattern.
-
- Note in DISP > 8k case, we will leave the high part of the address
- in %r1. There is code in expand_hppa_{prologue,epilogue} that knows this.*/
-static void
-set_reg_plus_d(reg, base, disp)
- int reg, base, disp;
-{
- if (VAL_14_BITS_P (disp))
- {
- emit_move_insn (gen_rtx (REG, SImode, reg),
- gen_rtx (PLUS, SImode,
- gen_rtx (REG, SImode, base),
- GEN_INT (disp)));
- }
- else
- {
- emit_insn (gen_add_high_const (gen_rtx (REG, SImode, 1),
- gen_rtx (REG, SImode, base),
- GEN_INT (disp)));
- emit_move_insn (gen_rtx (REG, SImode, reg),
- gen_rtx (LO_SUM, SImode,
- gen_rtx (REG, SImode, 1),
- GEN_INT (disp)));
- }
-}
-
-/* Global variables set by FUNCTION_PROLOGUE. */
-/* Size of frame. Need to know this to emit return insns from
- leaf procedures. */
-static int actual_fsize;
-static int local_fsize, save_fregs;
-
-int
-compute_frame_size (size, fregs_live)
- int size;
- int *fregs_live;
-{
- extern int current_function_outgoing_args_size;
- int i, fsize;
-
- /* 8 is space for frame pointer + filler. If any frame is allocated
- we need to add this in because of STARTING_FRAME_OFFSET. */
- fsize = size + (size || frame_pointer_needed ? 8 : 0);
-
- /* We must leave enough space for all the callee saved registers
- from 3 .. highest used callee save register since we don't
- know if we're going to have an inline or out of line prologue
- and epilogue. */
- for (i = 18; i >= 3; i--)
- if (regs_ever_live[i])
- {
- fsize += 4 * (i - 2);
- break;
- }
-
- /* Round the stack. */
- fsize = (fsize + 7) & ~7;
-
- /* We must leave enough space for all the callee saved registers
- from 3 .. highest used callee save register since we don't
- know if we're going to have an inline or out of line prologue
- and epilogue. */
- for (i = 66; i >= 48; i -= 2)
- if (regs_ever_live[i] || regs_ever_live[i + 1])
- {
- if (fregs_live)
- *fregs_live = 1;
-
- fsize += 4 * (i - 46);
- break;
- }
-
- fsize += current_function_outgoing_args_size;
- if (! leaf_function_p () || fsize)
- fsize += 32;
- return (fsize + 63) & ~63;
-}
-
-rtx hp_profile_label_rtx;
-static char hp_profile_label_name[8];
-void
-output_function_prologue (file, size)
- FILE *file;
- int size;
-{
- /* The function's label and associated .PROC must never be
- separated and must be output *after* any profiling declarations
- to avoid changing spaces/subspaces within a procedure. */
- ASM_OUTPUT_LABEL (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
- fputs ("\t.PROC\n", file);
-
- /* hppa_expand_prologue does the dirty work now. We just need
- to output the assembler directives which denote the start
- of a function. */
- fprintf (file, "\t.CALLINFO FRAME=%d", actual_fsize);
- if (regs_ever_live[2] || profile_flag)
- fputs (",CALLS,SAVE_RP", file);
- else
- fputs (",NO_CALLS", file);
-
- if (frame_pointer_needed)
- fputs (",SAVE_SP", file);
-
- /* Pass on information about the number of callee register saves
- performed in the prologue.
-
- The compiler is supposed to pass the highest register number
- saved, the assembler then has to adjust that number before
- entering it into the unwind descriptor (to account for any
- caller saved registers with lower register numbers than the
- first callee saved register). */
- if (gr_saved)
- fprintf (file, ",ENTRY_GR=%d", gr_saved + 2);
-
- if (fr_saved)
- fprintf (file, ",ENTRY_FR=%d", fr_saved + 11);
-
- fputs ("\n\t.ENTRY\n", file);
-
- /* Horrid hack. emit_function_prologue will modify this RTL in
- place to get the expected results. */
- if (profile_flag)
- ASM_GENERATE_INTERNAL_LABEL (hp_profile_label_name, "LP",
- hp_profile_labelno);
-
- /* If we're using GAS and not using the portable runtime model, then
- we don't need to accumulate the total number of code bytes. */
- if (TARGET_GAS && ! TARGET_PORTABLE_RUNTIME)
- total_code_bytes = 0;
- else if (insn_addresses)
- {
- unsigned int old_total = total_code_bytes;
-
- total_code_bytes += insn_addresses[INSN_UID (get_last_insn())];
- total_code_bytes += FUNCTION_BOUNDARY / BITS_PER_UNIT;
-
- /* Be prepared to handle overflows. */
- total_code_bytes = old_total > total_code_bytes ? -1 : total_code_bytes;
- }
- else
- total_code_bytes = -1;
-
- remove_useless_addtr_insns (get_insns (), 0);
-}
-
-void
-hppa_expand_prologue()
-{
- extern char call_used_regs[];
- int size = get_frame_size ();
- int merge_sp_adjust_with_store = 0;
- int i, offset;
- rtx tmpreg, size_rtx;
-
- gr_saved = 0;
- fr_saved = 0;
- save_fregs = 0;
- local_fsize = size + (size || frame_pointer_needed ? 8 : 0);
- actual_fsize = compute_frame_size (size, &save_fregs);
-
- /* Compute a few things we will use often. */
- tmpreg = gen_rtx (REG, SImode, 1);
- size_rtx = GEN_INT (actual_fsize);
-
- /* Handle out of line prologues and epilogues. */
- if (TARGET_SPACE)
- {
- rtx operands[2];
- int saves = 0;
- int outline_insn_count = 0;
- int inline_insn_count = 0;
-
- /* Count the number of insns for the inline and out of line
- variants so we can choose one appropriately.
-
- No need to screw with counting actual_fsize operations -- they're
- done for both inline and out of line prologues. */
- if (regs_ever_live[2])
- inline_insn_count += 1;
-
- if (! cint_ok_for_move (local_fsize))
- outline_insn_count += 2;
- else
- outline_insn_count += 1;
-
- /* Put the register save info into %r22. */
- for (i = 18; i >= 3; i--)
- if (regs_ever_live[i] && ! call_used_regs[i])
- {
- /* -1 because the stack adjustment is normally done in
- the same insn as a register save. */
- inline_insn_count += (i - 2) - 1;
- saves = i;
- break;
- }
-
- for (i = 66; i >= 48; i -= 2)
- if (regs_ever_live[i] || regs_ever_live[i + 1])
- {
- /* +1 needed as we load %r1 with the start of the freg
- save area. */
- inline_insn_count += (i/2 - 23) + 1;
- saves |= ((i/2 - 12 ) << 16);
- break;
- }
-
- if (frame_pointer_needed)
- inline_insn_count += 3;
-
- if (! cint_ok_for_move (saves))
- outline_insn_count += 2;
- else
- outline_insn_count += 1;
-
- if (TARGET_PORTABLE_RUNTIME)
- outline_insn_count += 2;
- else
- outline_insn_count += 1;
-
- /* If there's a lot of insns in the prologue, then do it as
- an out-of-line sequence. */
- if (inline_insn_count > outline_insn_count)
- {
- /* Put the local_fisze into %r19. */
- operands[0] = gen_rtx (REG, SImode, 19);
- operands[1] = GEN_INT (local_fsize);
- emit_move_insn (operands[0], operands[1]);
-
- /* Put the stack size into %r21. */
- operands[0] = gen_rtx (REG, SImode, 21);
- operands[1] = size_rtx;
- emit_move_insn (operands[0], operands[1]);
-
- operands[0] = gen_rtx (REG, SImode, 22);
- operands[1] = GEN_INT (saves);
- emit_move_insn (operands[0], operands[1]);
-
- /* Now call the out-of-line prologue. */
- emit_insn (gen_outline_prologue_call ());
- emit_insn (gen_blockage ());
-
- /* Note that we're using an out-of-line prologue. */
- out_of_line_prologue_epilogue = 1;
- return;
- }
- }
-
- out_of_line_prologue_epilogue = 0;
-
- /* Save RP first. The calling conventions manual states RP will
- always be stored into the caller's frame at sp-20. */
- if (regs_ever_live[2] || profile_flag)
- store_reg (2, -20, STACK_POINTER_REGNUM);
-
- /* Allocate the local frame and set up the frame pointer if needed. */
- if (actual_fsize)
- if (frame_pointer_needed)
- {
- /* Copy the old frame pointer temporarily into %r1. Set up the
- new stack pointer, then store away the saved old frame pointer
- into the stack at sp+actual_fsize and at the same time update
- the stack pointer by actual_fsize bytes. Two versions, first
- handles small (<8k) frames. The second handles large (>8k)
- frames. */
- emit_move_insn (tmpreg, frame_pointer_rtx);
- emit_move_insn (frame_pointer_rtx, stack_pointer_rtx);
- if (VAL_14_BITS_P (actual_fsize))
- emit_insn (gen_post_stwm (stack_pointer_rtx, tmpreg, size_rtx));
- else
- {
- /* It is incorrect to store the saved frame pointer at *sp,
- then increment sp (writes beyond the current stack boundary).
-
- So instead use stwm to store at *sp and post-increment the
- stack pointer as an atomic operation. Then increment sp to
- finish allocating the new frame. */
- emit_insn (gen_post_stwm (stack_pointer_rtx, tmpreg, GEN_INT (64)));
- set_reg_plus_d (STACK_POINTER_REGNUM,
- STACK_POINTER_REGNUM,
- actual_fsize - 64);
- }
- }
- /* no frame pointer needed. */
- else
- {
- /* In some cases we can perform the first callee register save
- and allocating the stack frame at the same time. If so, just
- make a note of it and defer allocating the frame until saving
- the callee registers. */
- if (VAL_14_BITS_P (-actual_fsize)
- && local_fsize == 0
- && ! profile_flag
- && ! flag_pic)
- merge_sp_adjust_with_store = 1;
- /* Can not optimize. Adjust the stack frame by actual_fsize bytes. */
- else if (actual_fsize != 0)
- set_reg_plus_d (STACK_POINTER_REGNUM,
- STACK_POINTER_REGNUM,
- actual_fsize);
- }
- /* The hppa calling conventions say that that %r19, the pic offset
- register, is saved at sp - 32 (in this function's frame) when
- generating PIC code. FIXME: What is the correct thing to do
- for functions which make no calls and allocate no frame? Do
- we need to allocate a frame, or can we just omit the save? For
- now we'll just omit the save. */
- if (actual_fsize != 0 && flag_pic)
- store_reg (PIC_OFFSET_TABLE_REGNUM, -32, STACK_POINTER_REGNUM);
-
- /* Profiling code.
-
- Instead of taking one argument, the counter label, as most normal
- mcounts do, _mcount appears to behave differently on the HPPA. It
- takes the return address of the caller, the address of this routine,
- and the address of the label. Also, it isn't magic, so
- argument registers have to be preserved. */
- if (profile_flag)
- {
- int pc_offset, i, arg_offset, basereg, offsetadj;
-
- pc_offset = 4 + (frame_pointer_needed
- ? (VAL_14_BITS_P (actual_fsize) ? 12 : 20)
- : (VAL_14_BITS_P (actual_fsize) ? 4 : 8));
-
- /* When the function has a frame pointer, use it as the base
- register for saving/restore registers. Else use the stack
- pointer. Adjust the offset according to the frame size if
- this function does not have a frame pointer. */
-
- basereg = frame_pointer_needed ? FRAME_POINTER_REGNUM
- : STACK_POINTER_REGNUM;
- offsetadj = frame_pointer_needed ? 0 : actual_fsize;
-
- /* Horrid hack. emit_function_prologue will modify this RTL in
- place to get the expected results. sprintf here is just to
- put something in the name. */
- sprintf(hp_profile_label_name, "LP$%04d", -1);
- hp_profile_label_rtx = gen_rtx (SYMBOL_REF, SImode,
- hp_profile_label_name);
- if (current_function_returns_struct)
- store_reg (STRUCT_VALUE_REGNUM, - 12 - offsetadj, basereg);
-
- for (i = 26, arg_offset = -36 - offsetadj; i >= 23; i--, arg_offset -= 4)
- if (regs_ever_live [i])
- {
- store_reg (i, arg_offset, basereg);
- /* Deal with arg_offset not fitting in 14 bits. */
- pc_offset += VAL_14_BITS_P (arg_offset) ? 4 : 8;
- }
-
- emit_move_insn (gen_rtx (REG, SImode, 26), gen_rtx (REG, SImode, 2));
- emit_move_insn (tmpreg, gen_rtx (HIGH, SImode, hp_profile_label_rtx));
- emit_move_insn (gen_rtx (REG, SImode, 24),
- gen_rtx (LO_SUM, SImode, tmpreg, hp_profile_label_rtx));
- /* %r25 is set from within the output pattern. */
- emit_insn (gen_call_profiler (GEN_INT (- pc_offset - 20)));
-
- /* Restore argument registers. */
- for (i = 26, arg_offset = -36 - offsetadj; i >= 23; i--, arg_offset -= 4)
- if (regs_ever_live [i])
- load_reg (i, arg_offset, basereg);
-
- if (current_function_returns_struct)
- load_reg (STRUCT_VALUE_REGNUM, -12 - offsetadj, basereg);
-
- }
-
- /* Normal register save.
-
- Do not save the frame pointer in the frame_pointer_needed case. It
- was done earlier. */
- if (frame_pointer_needed)
- {
- for (i = 18, offset = local_fsize; i >= 4; i--)
- if (regs_ever_live[i] && ! call_used_regs[i])
- {
- store_reg (i, offset, FRAME_POINTER_REGNUM);
- offset += 4;
- gr_saved++;
- }
- /* Account for %r3 which is saved in a special place. */
- gr_saved++;
- }
- /* No frame pointer needed. */
- else
- {
- for (i = 18, offset = local_fsize - actual_fsize; i >= 3; i--)
- if (regs_ever_live[i] && ! call_used_regs[i])
- {
- /* If merge_sp_adjust_with_store is nonzero, then we can
- optimize the first GR save. */
- if (merge_sp_adjust_with_store)
- {
- merge_sp_adjust_with_store = 0;
- emit_insn (gen_post_stwm (stack_pointer_rtx,
- gen_rtx (REG, SImode, i),
- GEN_INT (-offset)));
- }
- else
- store_reg (i, offset, STACK_POINTER_REGNUM);
- offset += 4;
- gr_saved++;
- }
-
- /* If we wanted to merge the SP adjustment with a GR save, but we never
- did any GR saves, then just emit the adjustment here. */
- if (merge_sp_adjust_with_store)
- set_reg_plus_d (STACK_POINTER_REGNUM,
- STACK_POINTER_REGNUM,
- actual_fsize);
- }
-
- /* Align pointer properly (doubleword boundary). */
- offset = (offset + 7) & ~7;
-
- /* Floating point register store. */
- if (save_fregs)
- {
- /* First get the frame or stack pointer to the start of the FP register
- save area. */
- if (frame_pointer_needed)
- set_reg_plus_d (1, FRAME_POINTER_REGNUM, offset);
- else
- set_reg_plus_d (1, STACK_POINTER_REGNUM, offset);
-
- /* Now actually save the FP registers. */
- for (i = 66; i >= 48; i -= 2)
- {
- if (regs_ever_live[i] || regs_ever_live[i + 1])
- {
- emit_move_insn (gen_rtx (MEM, DFmode,
- gen_rtx (POST_INC, DFmode, tmpreg)),
- gen_rtx (REG, DFmode, i));
- fr_saved++;
- }
- }
- }
-
- /* When generating PIC code it is necessary to save/restore the
- PIC register around each function call. We used to do this
- in the call patterns themselves, but that implementation
- made incorrect assumptions about using global variables to hold
- per-function rtl code generated in the backend.
-
- So instead, we copy the PIC register into a reserved callee saved
- register in the prologue. Then after each call we reload the PIC
- register from the callee saved register. We also reload the PIC
- register from the callee saved register in the epilogue ensure the
- PIC register is valid at function exit.
-
- This may (depending on the exact characteristics of the function)
- even be more efficient.
-
- Avoid this if the callee saved register wasn't used (these are
- leaf functions). */
- if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM_SAVED])
- emit_move_insn (gen_rtx (REG, SImode, PIC_OFFSET_TABLE_REGNUM_SAVED),
- gen_rtx (REG, SImode, PIC_OFFSET_TABLE_REGNUM));
-}
-
-
-void
-output_function_epilogue (file, size)
- FILE *file;
- int size;
-{
- rtx insn = get_last_insn ();
- int i;
-
- /* hppa_expand_epilogue does the dirty work now. We just need
- to output the assembler directives which denote the end
- of a function.
-
- To make debuggers happy, emit a nop if the epilogue was completely
- eliminated due to a volatile call as the last insn in the
- current function. That way the return address (in %r2) will
- always point to a valid instruction in the current function. */
-
- /* Get the last real insn. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_real_insn (insn);
-
- /* If it is a sequence, then look inside. */
- if (insn && GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, 0);
-
- /* If insn is a CALL_INSN, then it must be a call to a volatile
- function (otherwise there would be epilogue insns). */
- if (insn && GET_CODE (insn) == CALL_INSN)
- fputs ("\tnop\n", file);
-
- fputs ("\t.EXIT\n\t.PROCEND\n", file);
-
- /* If we have deferred plabels, then we need to switch into the data
- section and align it to a 4 byte boundary before we output the
- deferred plabels. */
- if (n_deferred_plabels)
- {
- data_section ();
- ASM_OUTPUT_ALIGN (file, 2);
- }
-
- /* Now output the deferred plabels. */
- for (i = 0; i < n_deferred_plabels; i++)
- {
- ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (deferred_plabels[i].internal_label));
- assemble_integer (deferred_plabels[i].symbol, 4, 1);
- }
- n_deferred_plabels = 0;
-}
-
-void
-hppa_expand_epilogue ()
-{
- rtx tmpreg;
- int offset,i;
- int merge_sp_adjust_with_load = 0;
-
- /* Handle out of line prologues and epilogues. */
- if (TARGET_SPACE && out_of_line_prologue_epilogue)
- {
- int saves = 0;
- rtx operands[2];
-
- /* Put the register save info into %r22. */
- for (i = 18; i >= 3; i--)
- if (regs_ever_live[i] && ! call_used_regs[i])
- {
- saves = i;
- break;
- }
-
- for (i = 66; i >= 48; i -= 2)
- if (regs_ever_live[i] || regs_ever_live[i + 1])
- {
- saves |= ((i/2 - 12 ) << 16);
- break;
- }
-
- emit_insn (gen_blockage ());
-
- /* Put the local_fisze into %r19. */
- operands[0] = gen_rtx (REG, SImode, 19);
- operands[1] = GEN_INT (local_fsize);
- emit_move_insn (operands[0], operands[1]);
-
- /* Put the stack size into %r21. */
- operands[0] = gen_rtx (REG, SImode, 21);
- operands[1] = GEN_INT (actual_fsize);
- emit_move_insn (operands[0], operands[1]);
-
- operands[0] = gen_rtx (REG, SImode, 22);
- operands[1] = GEN_INT (saves);
- emit_move_insn (operands[0], operands[1]);
-
- /* Now call the out-of-line epilogue. */
- emit_insn (gen_outline_epilogue_call ());
- return;
- }
-
- /* We will use this often. */
- tmpreg = gen_rtx (REG, SImode, 1);
-
- /* Try to restore RP early to avoid load/use interlocks when
- RP gets used in the return (bv) instruction. This appears to still
- be necessary even when we schedule the prologue and epilogue. */
- if (frame_pointer_needed
- && (regs_ever_live [2] || profile_flag))
- load_reg (2, -20, FRAME_POINTER_REGNUM);
-
- /* No frame pointer, and stack is smaller than 8k. */
- else if (! frame_pointer_needed
- && VAL_14_BITS_P (actual_fsize + 20)
- && (regs_ever_live[2] || profile_flag))
- load_reg (2, - (actual_fsize + 20), STACK_POINTER_REGNUM);
-
- /* General register restores. */
- if (frame_pointer_needed)
- {
- for (i = 18, offset = local_fsize; i >= 4; i--)
- if (regs_ever_live[i] && ! call_used_regs[i])
- {
- load_reg (i, offset, FRAME_POINTER_REGNUM);
- offset += 4;
- }
- }
- else
- {
- for (i = 18, offset = local_fsize - actual_fsize; i >= 3; i--)
- {
- if (regs_ever_live[i] && ! call_used_regs[i])
- {
- /* Only for the first load.
- merge_sp_adjust_with_load holds the register load
- with which we will merge the sp adjustment. */
- if (VAL_14_BITS_P (actual_fsize + 20)
- && local_fsize == 0
- && ! merge_sp_adjust_with_load)
- merge_sp_adjust_with_load = i;
- else
- load_reg (i, offset, STACK_POINTER_REGNUM);
- offset += 4;
- }
- }
- }
-
- /* Align pointer properly (doubleword boundary). */
- offset = (offset + 7) & ~7;
-
- /* FP register restores. */
- if (save_fregs)
- {
- /* Adjust the register to index off of. */
- if (frame_pointer_needed)
- set_reg_plus_d (1, FRAME_POINTER_REGNUM, offset);
- else
- set_reg_plus_d (1, STACK_POINTER_REGNUM, offset);
-
- /* Actually do the restores now. */
- for (i = 66; i >= 48; i -= 2)
- {
- if (regs_ever_live[i] || regs_ever_live[i + 1])
- {
- emit_move_insn (gen_rtx (REG, DFmode, i),
- gen_rtx (MEM, DFmode,
- gen_rtx (POST_INC, DFmode, tmpreg)));
- }
- }
- }
-
- /* Emit a blockage insn here to keep these insns from being moved to
- an earlier spot in the epilogue, or into the main instruction stream.
-
- This is necessary as we must not cut the stack back before all the
- restores are finished. */
- emit_insn (gen_blockage ());
- /* No frame pointer, but we have a stack greater than 8k. We restore
- %r2 very late in this case. (All other cases are restored as early
- as possible.) */
- if (! frame_pointer_needed
- && ! VAL_14_BITS_P (actual_fsize + 20)
- && (regs_ever_live[2] || profile_flag))
- {
- set_reg_plus_d (STACK_POINTER_REGNUM,
- STACK_POINTER_REGNUM,
- - actual_fsize);
-
- /* This used to try and be clever by not depending on the value in
- %r30 and instead use the value held in %r1 (so that the 2nd insn
- which sets %r30 could be put in the delay slot of the return insn).
-
- That won't work since if the stack is exactly 8k set_reg_plus_d
- doesn't set %r1, just %r30. */
- load_reg (2, - 20, STACK_POINTER_REGNUM);
- }
-
- /* Reset stack pointer (and possibly frame pointer). The stack
- pointer is initially set to fp + 64 to avoid a race condition. */
- else if (frame_pointer_needed)
- {
- set_reg_plus_d (STACK_POINTER_REGNUM, FRAME_POINTER_REGNUM, 64);
- emit_insn (gen_pre_ldwm (frame_pointer_rtx,
- stack_pointer_rtx,
- GEN_INT (-64)));
- }
- /* If we were deferring a callee register restore, do it now. */
- else if (! frame_pointer_needed && merge_sp_adjust_with_load)
- emit_insn (gen_pre_ldwm (gen_rtx (REG, SImode,
- merge_sp_adjust_with_load),
- stack_pointer_rtx,
- GEN_INT (- actual_fsize)));
- else if (actual_fsize != 0)
- set_reg_plus_d (STACK_POINTER_REGNUM,
- STACK_POINTER_REGNUM,
- - actual_fsize);
-}
-
-/* Fetch the return address for the frame COUNT steps up from
- the current frame, after the prologue. FRAMEADDR is the
- frame pointer of the COUNT frame.
-
- We want to ignore any export stub remnants here.
-
- The value returned is used in two different ways:
-
- 1. To find a function's caller.
-
- 2. To change the return address for a function.
-
- This function handles most instances of case 1; however, it will
- fail if there are two levels of stubs to execute on the return
- path. The only way I believe that can happen is if the return value
- needs a parameter relocation, which never happens for C code.
-
- This function handles most instances of case 2; however, it will
- fail if we did not originally have stub code on the return path
- but will need code on the new return path. This can happen if
- the caller & callee are both in the main program, but the new
- return location is in a shared library.
-
- To handle this correctly we need to set the return pointer at
- frame-20 to point to a return stub frame-24 to point to the
- location we wish to return to. */
-
-rtx
-return_addr_rtx (count, frameaddr)
- int count;
- rtx frameaddr;
-{
- rtx label;
- rtx saved_rp;
- rtx ins;
-
- saved_rp = gen_reg_rtx (Pmode);
-
- /* First, we start off with the normal return address pointer from
- -20[frameaddr]. */
-
- emit_move_insn (saved_rp, plus_constant (frameaddr, -5 * UNITS_PER_WORD));
-
- /* Get pointer to the instruction stream. We have to mask out the
- privilege level from the two low order bits of the return address
- pointer here so that ins will point to the start of the first
- instruction that would have been executed if we returned. */
- ins = copy_to_reg (gen_rtx (AND, Pmode,
- copy_to_reg (gen_rtx (MEM, Pmode, saved_rp)),
- MASK_RETURN_ADDR));
- label = gen_label_rtx ();
-
- /* Check the instruction stream at the normal return address for the
- export stub:
-
- 0x4bc23fd1 | stub+8: ldw -18(sr0,sp),rp
- 0x004010a1 | stub+12: ldsid (sr0,rp),r1
- 0x00011820 | stub+16: mtsp r1,sr0
- 0xe0400002 | stub+20: be,n 0(sr0,rp)
-
- If it is an export stub, than our return address is really in
- -24[frameaddr]. */
-
- emit_cmp_insn (gen_rtx (MEM, SImode, ins),
- GEN_INT (0x4bc23fd1),
- NE, NULL_RTX, SImode, 1, 0);
- emit_jump_insn (gen_bne (label));
-
- emit_cmp_insn (gen_rtx (MEM, SImode, plus_constant (ins, 4)),
- GEN_INT (0x004010a1),
- NE, NULL_RTX, SImode, 1, 0);
- emit_jump_insn (gen_bne (label));
-
- emit_cmp_insn (gen_rtx (MEM, SImode, plus_constant (ins, 8)),
- GEN_INT (0x00011820),
- NE, NULL_RTX, SImode, 1, 0);
- emit_jump_insn (gen_bne (label));
-
- emit_cmp_insn (gen_rtx (MEM, SImode, plus_constant (ins, 12)),
- GEN_INT (0xe0400002),
- NE, NULL_RTX, SImode, 1, 0);
-
- /* If there is no export stub then just use our initial guess of
- -20[frameaddr]. */
-
- emit_jump_insn (gen_bne (label));
-
- /* Here we know that our return address pointer points to an export
- stub. We don't want to return the address of the export stub,
- but rather the return address that leads back into user code.
- That return address is stored at -24[frameaddr]. */
-
- emit_move_insn (saved_rp, plus_constant (frameaddr, -6 * UNITS_PER_WORD));
-
- emit_label (label);
- return gen_rtx (MEM, Pmode, memory_address (Pmode, saved_rp));
-}
-
-/* This is only valid once reload has completed because it depends on
- knowing exactly how much (if any) frame there is and...
-
- It's only valid if there is no frame marker to de-allocate and...
-
- It's only valid if %r2 hasn't been saved into the caller's frame
- (we're not profiling and %r2 isn't live anywhere). */
-int
-hppa_can_use_return_insn_p ()
-{
- return (reload_completed
- && (compute_frame_size (get_frame_size (), 0) ? 0 : 1)
- && ! profile_flag
- && ! regs_ever_live[2]
- && ! frame_pointer_needed);
-}
-
-void
-emit_bcond_fp (code, operand0)
- enum rtx_code code;
- rtx operand0;
-{
- emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
- gen_rtx (IF_THEN_ELSE, VOIDmode,
- gen_rtx (code, VOIDmode,
- gen_rtx (REG, CCFPmode, 0),
- const0_rtx),
- gen_rtx (LABEL_REF, VOIDmode, operand0),
- pc_rtx)));
-
-}
-
-rtx
-gen_cmp_fp (code, operand0, operand1)
- enum rtx_code code;
- rtx operand0, operand1;
-{
- return gen_rtx (SET, VOIDmode, gen_rtx (REG, CCFPmode, 0),
- gen_rtx (code, CCFPmode, operand0, operand1));
-}
-
-/* Adjust the cost of a scheduling dependency. Return the new cost of
- a dependency LINK or INSN on DEP_INSN. COST is the current cost. */
-
-int
-pa_adjust_cost (insn, link, dep_insn, cost)
- rtx insn;
- rtx link;
- rtx dep_insn;
- int cost;
-{
- if (! recog_memoized (insn))
- return 0;
-
- if (REG_NOTE_KIND (link) == 0)
- {
- /* Data dependency; DEP_INSN writes a register that INSN reads some
- cycles later. */
-
- if (get_attr_type (insn) == TYPE_FPSTORE)
- {
- rtx pat = PATTERN (insn);
- rtx dep_pat = PATTERN (dep_insn);
- if (GET_CODE (pat) == PARALLEL)
- {
- /* This happens for the fstXs,mb patterns. */
- pat = XVECEXP (pat, 0, 0);
- }
- if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET)
- /* If this happens, we have to extend this to schedule
- optimally. Return 0 for now. */
- return 0;
-
- if (rtx_equal_p (SET_DEST (dep_pat), SET_SRC (pat)))
- {
- if (! recog_memoized (dep_insn))
- return 0;
- /* DEP_INSN is writing its result to the register
- being stored in the fpstore INSN. */
- switch (get_attr_type (dep_insn))
- {
- case TYPE_FPLOAD:
- /* This cost 3 cycles, not 2 as the md says for the
- 700 and 7100. Note scaling of cost for 7100. */
- return cost + (pa_cpu == PROCESSOR_700) ? 1 : 2;
-
- case TYPE_FPALU:
- case TYPE_FPMULSGL:
- case TYPE_FPMULDBL:
- case TYPE_FPDIVSGL:
- case TYPE_FPDIVDBL:
- case TYPE_FPSQRTSGL:
- case TYPE_FPSQRTDBL:
- /* In these important cases, we save one cycle compared to
- when flop instruction feed each other. */
- return cost - (pa_cpu == PROCESSOR_700) ? 1 : 2;
-
- default:
- return cost;
- }
- }
- }
-
- /* For other data dependencies, the default cost specified in the
- md is correct. */
- return cost;
- }
- else if (REG_NOTE_KIND (link) == REG_DEP_ANTI)
- {
- /* Anti dependency; DEP_INSN reads a register that INSN writes some
- cycles later. */
-
- if (get_attr_type (insn) == TYPE_FPLOAD)
- {
- rtx pat = PATTERN (insn);
- rtx dep_pat = PATTERN (dep_insn);
- if (GET_CODE (pat) == PARALLEL)
- {
- /* This happens for the fldXs,mb patterns. */
- pat = XVECEXP (pat, 0, 0);
- }
- if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET)
- /* If this happens, we have to extend this to schedule
- optimally. Return 0 for now. */
- return 0;
-
- if (reg_mentioned_p (SET_DEST (pat), SET_SRC (dep_pat)))
- {
- if (! recog_memoized (dep_insn))
- return 0;
- switch (get_attr_type (dep_insn))
- {
- case TYPE_FPALU:
- case TYPE_FPMULSGL:
- case TYPE_FPMULDBL:
- case TYPE_FPDIVSGL:
- case TYPE_FPDIVDBL:
- case TYPE_FPSQRTSGL:
- case TYPE_FPSQRTDBL:
- /* A fpload can't be issued until one cycle before a
- preceding arithmetic operation has finished if
- the target of the fpload is any of the sources
- (or destination) of the arithmetic operation. */
- return cost - (pa_cpu == PROCESSOR_700) ? 1 : 2;
-
- default:
- return 0;
- }
- }
- }
- else if (get_attr_type (insn) == TYPE_FPALU)
- {
- rtx pat = PATTERN (insn);
- rtx dep_pat = PATTERN (dep_insn);
- if (GET_CODE (pat) == PARALLEL)
- {
- /* This happens for the fldXs,mb patterns. */
- pat = XVECEXP (pat, 0, 0);
- }
- if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET)
- /* If this happens, we have to extend this to schedule
- optimally. Return 0 for now. */
- return 0;
-
- if (reg_mentioned_p (SET_DEST (pat), SET_SRC (dep_pat)))
- {
- if (! recog_memoized (dep_insn))
- return 0;
- switch (get_attr_type (dep_insn))
- {
- case TYPE_FPDIVSGL:
- case TYPE_FPDIVDBL:
- case TYPE_FPSQRTSGL:
- case TYPE_FPSQRTDBL:
- /* An ALU flop can't be issued until two cycles before a
- preceding divide or sqrt operation has finished if
- the target of the ALU flop is any of the sources
- (or destination) of the divide or sqrt operation. */
- return cost - (pa_cpu == PROCESSOR_700) ? 2 : 4;
-
- default:
- return 0;
- }
- }
- }
-
- /* For other anti dependencies, the cost is 0. */
- return 0;
- }
- else if (REG_NOTE_KIND (link) == REG_DEP_OUTPUT)
- {
- /* Output dependency; DEP_INSN writes a register that INSN writes some
- cycles later. */
- if (get_attr_type (insn) == TYPE_FPLOAD)
- {
- rtx pat = PATTERN (insn);
- rtx dep_pat = PATTERN (dep_insn);
- if (GET_CODE (pat) == PARALLEL)
- {
- /* This happens for the fldXs,mb patterns. */
- pat = XVECEXP (pat, 0, 0);
- }
- if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET)
- /* If this happens, we have to extend this to schedule
- optimally. Return 0 for now. */
- return 0;
-
- if (reg_mentioned_p (SET_DEST (pat), SET_DEST (dep_pat)))
- {
- if (! recog_memoized (dep_insn))
- return 0;
- switch (get_attr_type (dep_insn))
- {
- case TYPE_FPALU:
- case TYPE_FPMULSGL:
- case TYPE_FPMULDBL:
- case TYPE_FPDIVSGL:
- case TYPE_FPDIVDBL:
- case TYPE_FPSQRTSGL:
- case TYPE_FPSQRTDBL:
- /* A fpload can't be issued until one cycle before a
- preceding arithmetic operation has finished if
- the target of the fpload is the destination of the
- arithmetic operation. */
- return cost - (pa_cpu == PROCESSOR_700) ? 1 : 2;
-
- default:
- return 0;
- }
- }
- }
- else if (get_attr_type (insn) == TYPE_FPALU)
- {
- rtx pat = PATTERN (insn);
- rtx dep_pat = PATTERN (dep_insn);
- if (GET_CODE (pat) == PARALLEL)
- {
- /* This happens for the fldXs,mb patterns. */
- pat = XVECEXP (pat, 0, 0);
- }
- if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET)
- /* If this happens, we have to extend this to schedule
- optimally. Return 0 for now. */
- return 0;
-
- if (reg_mentioned_p (SET_DEST (pat), SET_DEST (dep_pat)))
- {
- if (! recog_memoized (dep_insn))
- return 0;
- switch (get_attr_type (dep_insn))
- {
- case TYPE_FPDIVSGL:
- case TYPE_FPDIVDBL:
- case TYPE_FPSQRTSGL:
- case TYPE_FPSQRTDBL:
- /* An ALU flop can't be issued until two cycles before a
- preceding divide or sqrt operation has finished if
- the target of the ALU flop is also the target of
- of the divide or sqrt operation. */
- return cost - (pa_cpu == PROCESSOR_700) ? 2 : 4;
-
- default:
- return 0;
- }
- }
- }
-
- /* For other output dependencies, the cost is 0. */
- return 0;
- }
- else
- abort ();
-}
-
-/* Return any length adjustment needed by INSN which already has its length
- computed as LENGTH. Return zero if no adjustment is necessary.
-
- For the PA: function calls, millicode calls, and backwards short
- conditional branches with unfilled delay slots need an adjustment by +1
- (to account for the NOP which will be inserted into the instruction stream).
-
- Also compute the length of an inline block move here as it is too
- complicated to express as a length attribute in pa.md. */
-int
-pa_adjust_insn_length (insn, length)
- rtx insn;
- int length;
-{
- rtx pat = PATTERN (insn);
-
- /* Call insns which are *not* indirect and have unfilled delay slots. */
- if (GET_CODE (insn) == CALL_INSN)
- {
-
- if (GET_CODE (XVECEXP (pat, 0, 0)) == CALL
- && GET_CODE (XEXP (XEXP (XVECEXP (pat, 0, 0), 0), 0)) == SYMBOL_REF)
- return 4;
- else if (GET_CODE (XVECEXP (pat, 0, 0)) == SET
- && GET_CODE (XEXP (XEXP (XEXP (XVECEXP (pat, 0, 0), 1), 0), 0))
- == SYMBOL_REF)
- return 4;
- else
- return 0;
- }
- /* Jumps inside switch tables which have unfilled delay slots
- also need adjustment. */
- else if (GET_CODE (insn) == JUMP_INSN
- && simplejump_p (insn)
- && GET_MODE (PATTERN (insn)) == DImode)
- return 4;
- /* Millicode insn with an unfilled delay slot. */
- else if (GET_CODE (insn) == INSN
- && GET_CODE (pat) != SEQUENCE
- && GET_CODE (pat) != USE
- && GET_CODE (pat) != CLOBBER
- && get_attr_type (insn) == TYPE_MILLI)
- return 4;
- /* Block move pattern. */
- else if (GET_CODE (insn) == INSN
- && GET_CODE (pat) == PARALLEL
- && GET_CODE (XEXP (XVECEXP (pat, 0, 0), 0)) == MEM
- && GET_CODE (XEXP (XVECEXP (pat, 0, 0), 1)) == MEM
- && GET_MODE (XEXP (XVECEXP (pat, 0, 0), 0)) == BLKmode
- && GET_MODE (XEXP (XVECEXP (pat, 0, 0), 1)) == BLKmode)
- return compute_movstrsi_length (insn) - 4;
- /* Conditional branch with an unfilled delay slot. */
- else if (GET_CODE (insn) == JUMP_INSN && ! simplejump_p (insn))
- {
- /* Adjust a short backwards conditional with an unfilled delay slot. */
- if (GET_CODE (pat) == SET
- && length == 4
- && ! forward_branch_p (insn))
- return 4;
- else if (GET_CODE (pat) == PARALLEL
- && get_attr_type (insn) == TYPE_PARALLEL_BRANCH
- && length == 4)
- return 4;
- /* Adjust dbra insn with short backwards conditional branch with
- unfilled delay slot -- only for case where counter is in a
- general register register. */
- else if (GET_CODE (pat) == PARALLEL
- && GET_CODE (XVECEXP (pat, 0, 1)) == SET
- && GET_CODE (XEXP (XVECEXP (pat, 0, 1), 0)) == REG
- && ! FP_REG_P (XEXP (XVECEXP (pat, 0, 1), 0))
- && length == 4
- && ! forward_branch_p (insn))
- return 4;
- else
- return 0;
- }
- return 0;
-}
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- int code;
-{
- switch (code)
- {
- case '#':
- /* Output a 'nop' if there's nothing for the delay slot. */
- if (dbr_sequence_length () == 0)
- fputs ("\n\tnop", file);
- return;
- case '*':
- /* Output an nullification completer if there's nothing for the */
- /* delay slot or nullification is requested. */
- if (dbr_sequence_length () == 0 ||
- (final_sequence &&
- INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0))))
- fputs (",n", file);
- return;
- case 'R':
- /* Print out the second register name of a register pair.
- I.e., R (6) => 7. */
- fputs (reg_names[REGNO (x)+1], file);
- return;
- case 'r':
- /* A register or zero. */
- if (x == const0_rtx
- || (x == CONST0_RTX (DFmode))
- || (x == CONST0_RTX (SFmode)))
- {
- fputs ("0", file);
- return;
- }
- else
- break;
- case 'C': /* Plain (C)ondition */
- case 'X':
- switch (GET_CODE (x))
- {
- case EQ:
- fputs ("=", file); break;
- case NE:
- fputs ("<>", file); break;
- case GT:
- fputs (">", file); break;
- case GE:
- fputs (">=", file); break;
- case GEU:
- fputs (">>=", file); break;
- case GTU:
- fputs (">>", file); break;
- case LT:
- fputs ("<", file); break;
- case LE:
- fputs ("<=", file); break;
- case LEU:
- fputs ("<<=", file); break;
- case LTU:
- fputs ("<<", file); break;
- default:
- abort ();
- }
- return;
- case 'N': /* Condition, (N)egated */
- switch (GET_CODE (x))
- {
- case EQ:
- fputs ("<>", file); break;
- case NE:
- fputs ("=", file); break;
- case GT:
- fputs ("<=", file); break;
- case GE:
- fputs ("<", file); break;
- case GEU:
- fputs ("<<", file); break;
- case GTU:
- fputs ("<<=", file); break;
- case LT:
- fputs (">=", file); break;
- case LE:
- fputs (">", file); break;
- case LEU:
- fputs (">>", file); break;
- case LTU:
- fputs (">>=", file); break;
- default:
- abort ();
- }
- return;
- /* For floating point comparisons. Need special conditions to deal
- with NaNs properly. */
- case 'Y':
- switch (GET_CODE (x))
- {
- case EQ:
- fputs ("!=", file); break;
- case NE:
- fputs ("=", file); break;
- case GT:
- fputs ("<=", file); break;
- case GE:
- fputs ("<", file); break;
- case LT:
- fputs (">=", file); break;
- case LE:
- fputs (">", file); break;
- default:
- abort ();
- }
- return;
- case 'S': /* Condition, operands are (S)wapped. */
- switch (GET_CODE (x))
- {
- case EQ:
- fputs ("=", file); break;
- case NE:
- fputs ("<>", file); break;
- case GT:
- fputs ("<", file); break;
- case GE:
- fputs ("<=", file); break;
- case GEU:
- fputs ("<<=", file); break;
- case GTU:
- fputs ("<<", file); break;
- case LT:
- fputs (">", file); break;
- case LE:
- fputs (">=", file); break;
- case LEU:
- fputs (">>=", file); break;
- case LTU:
- fputs (">>", file); break;
- default:
- abort ();
- }
- return;
- case 'B': /* Condition, (B)oth swapped and negate. */
- switch (GET_CODE (x))
- {
- case EQ:
- fputs ("<>", file); break;
- case NE:
- fputs ("=", file); break;
- case GT:
- fputs (">=", file); break;
- case GE:
- fputs (">", file); break;
- case GEU:
- fputs (">>", file); break;
- case GTU:
- fputs (">>=", file); break;
- case LT:
- fputs ("<=", file); break;
- case LE:
- fputs ("<", file); break;
- case LEU:
- fputs ("<<", file); break;
- case LTU:
- fputs ("<<=", file); break;
- default:
- abort ();
- }
- return;
- case 'k':
- if (GET_CODE (x) == CONST_INT)
- {
- fprintf (file, "%d", ~INTVAL (x));
- return;
- }
- abort();
- case 'L':
- if (GET_CODE (x) == CONST_INT)
- {
- fprintf (file, "%d", 32 - (INTVAL (x) & 31));
- return;
- }
- abort();
- case 'O':
- if (GET_CODE (x) == CONST_INT && exact_log2 (INTVAL (x)) >= 0)
- {
- fprintf (file, "%d", exact_log2 (INTVAL (x)));
- return;
- }
- abort();
- case 'P':
- if (GET_CODE (x) == CONST_INT)
- {
- fprintf (file, "%d", 31 - (INTVAL (x) & 31));
- return;
- }
- abort();
- case 'I':
- if (GET_CODE (x) == CONST_INT)
- fputs ("i", file);
- return;
- case 'M':
- case 'F':
- switch (GET_CODE (XEXP (x, 0)))
- {
- case PRE_DEC:
- case PRE_INC:
- fputs ("s,mb", file);
- break;
- case POST_DEC:
- case POST_INC:
- fputs ("s,ma", file);
- break;
- case PLUS:
- if (GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT
- || GET_CODE (XEXP (XEXP (x, 0), 1)) == MULT)
- fputs ("x,s", file);
- else if (code == 'F')
- fputs ("s", file);
- break;
- default:
- if (code == 'F')
- fputs ("s", file);
- break;
- }
- return;
- case 'G':
- output_global_address (file, x, 0);
- return;
- case 'H':
- output_global_address (file, x, 1);
- return;
- case 0: /* Don't do anything special */
- break;
- case 'Z':
- {
- unsigned op[3];
- compute_zdepi_operands (INTVAL (x), op);
- fprintf (file, "%d,%d,%d", op[0], op[1], op[2]);
- return;
- }
- default:
- abort ();
- }
- if (GET_CODE (x) == REG)
- {
- fputs (reg_names [REGNO (x)], file);
- if (FP_REG_P (x) && GET_MODE_SIZE (GET_MODE (x)) <= 4 && (REGNO (x) & 1) == 0)
- fputs ("L", file);
- }
- else if (GET_CODE (x) == MEM)
- {
- int size = GET_MODE_SIZE (GET_MODE (x));
- rtx base = XEXP (XEXP (x, 0), 0);
- switch (GET_CODE (XEXP (x, 0)))
- {
- case PRE_DEC:
- case POST_DEC:
- fprintf (file, "-%d(0,%s)", size, reg_names [REGNO (base)]);
- break;
- case PRE_INC:
- case POST_INC:
- fprintf (file, "%d(0,%s)", size, reg_names [REGNO (base)]);
- break;
- default:
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT)
- fprintf (file, "%s(0,%s)",
- reg_names [REGNO (XEXP (XEXP (XEXP (x, 0), 0), 0))],
- reg_names [REGNO (XEXP (XEXP (x, 0), 1))]);
- else if (GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == MULT)
- fprintf (file, "%s(0,%s)",
- reg_names [REGNO (XEXP (XEXP (XEXP (x, 0), 1), 0))],
- reg_names [REGNO (XEXP (XEXP (x, 0), 0))]);
- else
- output_address (XEXP (x, 0));
- break;
- }
- }
- else
- output_addr_const (file, x);
-}
-
-/* output a SYMBOL_REF or a CONST expression involving a SYMBOL_REF. */
-
-void
-output_global_address (file, x, round_constant)
- FILE *file;
- rtx x;
- int round_constant;
-{
-
- /* Imagine (high (const (plus ...))). */
- if (GET_CODE (x) == HIGH)
- x = XEXP (x, 0);
-
- if (GET_CODE (x) == SYMBOL_REF && read_only_operand (x))
- assemble_name (file, XSTR (x, 0));
- else if (GET_CODE (x) == SYMBOL_REF && !flag_pic)
- {
- assemble_name (file, XSTR (x, 0));
- fputs ("-$global$", file);
- }
- else if (GET_CODE (x) == CONST)
- {
- char *sep = "";
- int offset = 0; /* assembler wants -$global$ at end */
- rtx base;
-
- if (GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF)
- {
- base = XEXP (XEXP (x, 0), 0);
- output_addr_const (file, base);
- }
- else if (GET_CODE (XEXP (XEXP (x, 0), 0)) == CONST_INT)
- offset = INTVAL (XEXP (XEXP (x, 0), 0));
- else abort ();
-
- if (GET_CODE (XEXP (XEXP (x, 0), 1)) == SYMBOL_REF)
- {
- base = XEXP (XEXP (x, 0), 1);
- output_addr_const (file, base);
- }
- else if (GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)
- offset = INTVAL (XEXP (XEXP (x, 0),1));
- else abort ();
-
- /* How bogus. The compiler is apparently responsible for
- rounding the constant if it uses an LR field selector.
-
- The linker and/or assembler seem a better place since
- they have to do this kind of thing already.
-
- If we fail to do this, HP's optimizing linker may eliminate
- an addil, but not update the ldw/stw/ldo instruction that
- uses the result of the addil. */
- if (round_constant)
- offset = ((offset + 0x1000) & ~0x1fff);
-
- if (GET_CODE (XEXP (x, 0)) == PLUS)
- {
- if (offset < 0)
- {
- offset = -offset;
- sep = "-";
- }
- else
- sep = "+";
- }
- else if (GET_CODE (XEXP (x, 0)) == MINUS
- && (GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF))
- sep = "-";
- else abort ();
-
- if (!read_only_operand (base) && !flag_pic)
- fputs ("-$global$", file);
- if (offset)
- fprintf (file,"%s%d", sep, offset);
- }
- else
- output_addr_const (file, x);
-}
-
-/* HP's millicode routines mean something special to the assembler.
- Keep track of which ones we have used. */
-
-enum millicodes { remI, remU, divI, divU, mulI, mulU, end1000 };
-static char imported[(int)end1000];
-static char *milli_names[] = {"remI", "remU", "divI", "divU", "mulI", "mulU"};
-static char import_string[] = ".IMPORT $$....,MILLICODE";
-#define MILLI_START 10
-
-static void
-import_milli (code)
- enum millicodes code;
-{
- char str[sizeof (import_string)];
-
- if (!imported[(int)code])
- {
- imported[(int)code] = 1;
- strcpy (str, import_string);
- strncpy (str + MILLI_START, milli_names[(int)code], 4);
- output_asm_insn (str, 0);
- }
-}
-
-/* The register constraints have put the operands and return value in
- the proper registers. */
-
-char *
-output_mul_insn (unsignedp, insn)
- int unsignedp;
- rtx insn;
-{
- import_milli (mulI);
- return output_millicode_call (insn, gen_rtx (SYMBOL_REF, SImode, "$$mulI"));
-}
-
-/* Emit the rtl for doing a division by a constant. */
-
-/* Do magic division millicodes exist for this value? */
-static int magic_milli[]= {0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0,
- 1, 1};
-
-/* We'll use an array to keep track of the magic millicodes and
- whether or not we've used them already. [n][0] is signed, [n][1] is
- unsigned. */
-
-static int div_milli[16][2];
-
-int
-div_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (mode == SImode
- && ((GET_CODE (op) == REG && REGNO (op) == 25)
- || (GET_CODE (op) == CONST_INT && INTVAL (op) > 0
- && INTVAL (op) < 16 && magic_milli[INTVAL (op)])));
-}
-
-int
-emit_hpdiv_const (operands, unsignedp)
- rtx *operands;
- int unsignedp;
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) > 0
- && INTVAL (operands[2]) < 16
- && magic_milli[INTVAL (operands[2])])
- {
- emit_move_insn ( gen_rtx (REG, SImode, 26), operands[1]);
- emit
- (gen_rtx
- (PARALLEL, VOIDmode,
- gen_rtvec (5, gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, 29),
- gen_rtx (unsignedp ? UDIV : DIV, SImode,
- gen_rtx (REG, SImode, 26),
- operands[2])),
- gen_rtx (CLOBBER, VOIDmode, operands[3]),
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (REG, SImode, 26)),
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (REG, SImode, 25)),
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (REG, SImode, 31)))));
- emit_move_insn (operands[0], gen_rtx (REG, SImode, 29));
- return 1;
- }
- return 0;
-}
-
-char *
-output_div_insn (operands, unsignedp, insn)
- rtx *operands;
- int unsignedp;
- rtx insn;
-{
- int divisor;
-
- /* If the divisor is a constant, try to use one of the special
- opcodes .*/
- if (GET_CODE (operands[0]) == CONST_INT)
- {
- static char buf[100];
- divisor = INTVAL (operands[0]);
- if (!div_milli[divisor][unsignedp])
- {
- div_milli[divisor][unsignedp] = 1;
- if (unsignedp)
- output_asm_insn (".IMPORT $$divU_%0,MILLICODE", operands);
- else
- output_asm_insn (".IMPORT $$divI_%0,MILLICODE", operands);
- }
- if (unsignedp)
- {
- sprintf (buf, "$$divU_%d", INTVAL (operands[0]));
- return output_millicode_call (insn,
- gen_rtx (SYMBOL_REF, SImode, buf));
- }
- else
- {
- sprintf (buf, "$$divI_%d", INTVAL (operands[0]));
- return output_millicode_call (insn,
- gen_rtx (SYMBOL_REF, SImode, buf));
- }
- }
- /* Divisor isn't a special constant. */
- else
- {
- if (unsignedp)
- {
- import_milli (divU);
- return output_millicode_call (insn,
- gen_rtx (SYMBOL_REF, SImode, "$$divU"));
- }
- else
- {
- import_milli (divI);
- return output_millicode_call (insn,
- gen_rtx (SYMBOL_REF, SImode, "$$divI"));
- }
- }
-}
-
-/* Output a $$rem millicode to do mod. */
-
-char *
-output_mod_insn (unsignedp, insn)
- int unsignedp;
- rtx insn;
-{
- if (unsignedp)
- {
- import_milli (remU);
- return output_millicode_call (insn,
- gen_rtx (SYMBOL_REF, SImode, "$$remU"));
- }
- else
- {
- import_milli (remI);
- return output_millicode_call (insn,
- gen_rtx (SYMBOL_REF, SImode, "$$remI"));
- }
-}
-
-void
-output_arg_descriptor (call_insn)
- rtx call_insn;
-{
- char *arg_regs[4];
- enum machine_mode arg_mode;
- rtx link;
- int i, output_flag = 0;
- int regno;
-
- for (i = 0; i < 4; i++)
- arg_regs[i] = 0;
-
- /* Specify explicitly that no argument relocations should take place
- if using the portable runtime calling conventions. */
- if (TARGET_PORTABLE_RUNTIME)
- {
- fputs ("\t.CALL ARGW0=NO,ARGW1=NO,ARGW2=NO,ARGW3=NO,RETVAL=NO\n",
- asm_out_file);
- return;
- }
-
- if (GET_CODE (call_insn) != CALL_INSN)
- abort ();
- for (link = CALL_INSN_FUNCTION_USAGE (call_insn); link; link = XEXP (link, 1))
- {
- rtx use = XEXP (link, 0);
-
- if (! (GET_CODE (use) == USE
- && GET_CODE (XEXP (use, 0)) == REG
- && FUNCTION_ARG_REGNO_P (REGNO (XEXP (use, 0)))))
- continue;
-
- arg_mode = GET_MODE (XEXP (use, 0));
- regno = REGNO (XEXP (use, 0));
- if (regno >= 23 && regno <= 26)
- {
- arg_regs[26 - regno] = "GR";
- if (arg_mode == DImode)
- arg_regs[25 - regno] = "GR";
- }
- else if (regno >= 32 && regno <= 39)
- {
- if (arg_mode == SFmode)
- arg_regs[(regno - 32) / 2] = "FR";
- else
- {
-#ifndef HP_FP_ARG_DESCRIPTOR_REVERSED
- arg_regs[(regno - 34) / 2] = "FR";
- arg_regs[(regno - 34) / 2 + 1] = "FU";
-#else
- arg_regs[(regno - 34) / 2] = "FU";
- arg_regs[(regno - 34) / 2 + 1] = "FR";
-#endif
- }
- }
- }
- fputs ("\t.CALL ", asm_out_file);
- for (i = 0; i < 4; i++)
- {
- if (arg_regs[i])
- {
- if (output_flag++)
- fputc (',', asm_out_file);
- fprintf (asm_out_file, "ARGW%d=%s", i, arg_regs[i]);
- }
- }
- fputc ('\n', asm_out_file);
-}
-
-/* Return the class of any secondary reload register that is needed to
- move IN into a register in class CLASS using mode MODE.
-
- Profiling has showed this routine and its descendants account for
- a significant amount of compile time (~7%). So it has been
- optimized to reduce redundant computations and eliminate useless
- function calls.
-
- It might be worthwhile to try and make this a leaf function too. */
-
-enum reg_class
-secondary_reload_class (class, mode, in)
- enum reg_class class;
- enum machine_mode mode;
- rtx in;
-{
- int regno, is_symbolic;
-
- /* Trying to load a constant into a FP register during PIC code
- generation will require %r1 as a scratch register. */
- if (flag_pic == 2
- && GET_MODE_CLASS (mode) == MODE_INT
- && FP_REG_CLASS_P (class)
- && (GET_CODE (in) == CONST_INT || GET_CODE (in) == CONST_DOUBLE))
- return R1_REGS;
-
- /* Profiling showed the PA port spends about 1.3% of its compilation
- time in true_regnum from calls inside secondary_reload_class. */
-
- if (GET_CODE (in) == REG)
- {
- regno = REGNO (in);
- if (regno >= FIRST_PSEUDO_REGISTER)
- regno = true_regnum (in);
- }
- else if (GET_CODE (in) == SUBREG)
- regno = true_regnum (in);
- else
- regno = -1;
-
- if (((regno >= FIRST_PSEUDO_REGISTER || regno == -1)
- && GET_MODE_CLASS (mode) == MODE_INT
- && FP_REG_CLASS_P (class))
- || (class == SHIFT_REGS && (regno <= 0 || regno >= 32)))
- return GENERAL_REGS;
-
- if (GET_CODE (in) == HIGH)
- in = XEXP (in, 0);
-
- /* Profiling has showed GCC spends about 2.6% of its compilation
- time in symbolic_operand from calls inside secondary_reload_class.
-
- We use an inline copy and only compute its return value once to avoid
- useless work. */
- switch (GET_CODE (in))
- {
- rtx tmp;
-
- case SYMBOL_REF:
- case LABEL_REF:
- is_symbolic = 1;
- break;
- case CONST:
- tmp = XEXP (in, 0);
- is_symbolic = ((GET_CODE (XEXP (tmp, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (tmp, 0)) == LABEL_REF)
- && GET_CODE (XEXP (tmp, 1)) == CONST_INT);
- break;
- default:
- is_symbolic = 0;
- break;
- }
-
- if (!flag_pic
- && is_symbolic
- && read_only_operand (in))
- return NO_REGS;
-
- if (class != R1_REGS && is_symbolic)
- return R1_REGS;
-
- return NO_REGS;
-}
-
-enum direction
-function_arg_padding (mode, type)
- enum machine_mode mode;
- tree type;
-{
- int size;
-
- if (mode == BLKmode)
- {
- if (type && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
- size = int_size_in_bytes (type) * BITS_PER_UNIT;
- else
- return upward; /* Don't know if this is right, but */
- /* same as old definition. */
- }
- else
- size = GET_MODE_BITSIZE (mode);
- if (size < PARM_BOUNDARY)
- return downward;
- else if (size % PARM_BOUNDARY)
- return upward;
- else
- return none;
-}
-
-
-/* Do what is necessary for `va_start'. The argument is ignored;
- We look at the current function to determine if stdargs or varargs
- is used and fill in an initial va_list. A pointer to this constructor
- is returned. */
-
-struct rtx_def *
-hppa_builtin_saveregs (arglist)
- tree arglist;
-{
- rtx offset;
- tree fntype = TREE_TYPE (current_function_decl);
- int argadj = ((!(TYPE_ARG_TYPES (fntype) != 0
- && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
- != void_type_node)))
- ? UNITS_PER_WORD : 0);
-
- if (argadj)
- offset = plus_constant (current_function_arg_offset_rtx, argadj);
- else
- offset = current_function_arg_offset_rtx;
-
- /* Store general registers on the stack. */
- move_block_from_reg (23,
- gen_rtx (MEM, BLKmode,
- plus_constant
- (current_function_internal_arg_pointer, -16)),
- 4, 4 * UNITS_PER_WORD);
- return copy_to_reg (expand_binop (Pmode, add_optab,
- current_function_internal_arg_pointer,
- offset, 0, 0, OPTAB_LIB_WIDEN));
-}
-
-/* This routine handles all the normal conditional branch sequences we
- might need to generate. It handles compare immediate vs compare
- register, nullification of delay slots, varying length branches,
- negated branches, and all combinations of the above. It returns the
- output appropriate to emit the branch corresponding to all given
- parameters. */
-
-char *
-output_cbranch (operands, nullify, length, negated, insn)
- rtx *operands;
- int nullify, length, negated;
- rtx insn;
-{
- static char buf[100];
- int useskip = 0;
-
- /* A conditional branch to the following instruction (eg the delay slot) is
- asking for a disaster. This can happen when not optimizing.
-
- In such cases it is safe to emit nothing. */
-
- if (next_active_insn (JUMP_LABEL (insn)) == next_active_insn (insn))
- return "";
-
- /* If this is a long branch with its delay slot unfilled, set `nullify'
- as it can nullify the delay slot and save a nop. */
- if (length == 8 && dbr_sequence_length () == 0)
- nullify = 1;
-
- /* If this is a short forward conditional branch which did not get
- its delay slot filled, the delay slot can still be nullified. */
- if (! nullify && length == 4 && dbr_sequence_length () == 0)
- nullify = forward_branch_p (insn);
-
- /* A forward branch over a single nullified insn can be done with a
- comclr instruction. This avoids a single cycle penalty due to
- mis-predicted branch if we fall through (branch not taken). */
- if (length == 4
- && next_real_insn (insn) != 0
- && get_attr_length (next_real_insn (insn)) == 4
- && JUMP_LABEL (insn) == next_nonnote_insn (next_real_insn (insn))
- && nullify)
- useskip = 1;
-
- switch (length)
- {
- /* All short conditional branches except backwards with an unfilled
- delay slot. */
- case 4:
- if (useskip)
- strcpy (buf, "com%I2clr,");
- else
- strcpy (buf, "com%I2b,");
- if (negated)
- strcat (buf, "%B3");
- else
- strcat (buf, "%S3");
- if (useskip)
- strcat (buf, " %2,%1,0");
- else if (nullify)
- strcat (buf, ",n %2,%1,%0");
- else
- strcat (buf, " %2,%1,%0");
- break;
-
- /* All long conditionals. Note an short backward branch with an
- unfilled delay slot is treated just like a long backward branch
- with an unfilled delay slot. */
- case 8:
- /* Handle weird backwards branch with a filled delay slot
- with is nullified. */
- if (dbr_sequence_length () != 0
- && ! forward_branch_p (insn)
- && nullify)
- {
- strcpy (buf, "com%I2b,");
- if (negated)
- strcat (buf, "%S3");
- else
- strcat (buf, "%B3");
- strcat (buf, ",n %2,%1,.+12\n\tbl %0,0");
- }
- /* Handle short backwards branch with an unfilled delay slot.
- Using a comb;nop rather than comiclr;bl saves 1 cycle for both
- taken and untaken branches. */
- else if (dbr_sequence_length () == 0
- && ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
- {
- strcpy (buf, "com%I2b,");
- if (negated)
- strcat (buf, "%B3 %2,%1,%0%#");
- else
- strcat (buf, "%S3 %2,%1,%0%#");
- }
- else
- {
- strcpy (buf, "com%I2clr,");
- if (negated)
- strcat (buf, "%S3");
- else
- strcat (buf, "%B3");
- if (nullify)
- strcat (buf, " %2,%1,0\n\tbl,n %0,0");
- else
- strcat (buf, " %2,%1,0\n\tbl %0,0");
- }
- break;
-
- default:
- abort();
- }
- return buf;
-}
-
-/* This routine handles all the branch-on-bit conditional branch sequences we
- might need to generate. It handles nullification of delay slots,
- varying length branches, negated branches and all combinations of the
- above. it returns the appropriate output template to emit the branch. */
-
-char *
-output_bb (operands, nullify, length, negated, insn, which)
- rtx *operands;
- int nullify, length, negated;
- rtx insn;
- int which;
-{
- static char buf[100];
- int useskip = 0;
-
- /* A conditional branch to the following instruction (eg the delay slot) is
- asking for a disaster. I do not think this can happen as this pattern
- is only used when optimizing; jump optimization should eliminate the
- jump. But be prepared just in case. */
-
- if (next_active_insn (JUMP_LABEL (insn)) == next_active_insn (insn))
- return "";
-
- /* If this is a long branch with its delay slot unfilled, set `nullify'
- as it can nullify the delay slot and save a nop. */
- if (length == 8 && dbr_sequence_length () == 0)
- nullify = 1;
-
- /* If this is a short forward conditional branch which did not get
- its delay slot filled, the delay slot can still be nullified. */
- if (! nullify && length == 4 && dbr_sequence_length () == 0)
- nullify = forward_branch_p (insn);
-
- /* A forward branch over a single nullified insn can be done with a
- extrs instruction. This avoids a single cycle penalty due to
- mis-predicted branch if we fall through (branch not taken). */
-
- if (length == 4
- && next_real_insn (insn) != 0
- && get_attr_length (next_real_insn (insn)) == 4
- && JUMP_LABEL (insn) == next_nonnote_insn (next_real_insn (insn))
- && nullify)
- useskip = 1;
-
- switch (length)
- {
-
- /* All short conditional branches except backwards with an unfilled
- delay slot. */
- case 4:
- if (useskip)
- strcpy (buf, "extrs,");
- else
- strcpy (buf, "bb,");
- if ((which == 0 && negated)
- || (which == 1 && ! negated))
- strcat (buf, ">=");
- else
- strcat (buf, "<");
- if (useskip)
- strcat (buf, " %0,%1,1,0");
- else if (nullify && negated)
- strcat (buf, ",n %0,%1,%3");
- else if (nullify && ! negated)
- strcat (buf, ",n %0,%1,%2");
- else if (! nullify && negated)
- strcat (buf, "%0,%1,%3");
- else if (! nullify && ! negated)
- strcat (buf, " %0,%1,%2");
- break;
-
- /* All long conditionals. Note an short backward branch with an
- unfilled delay slot is treated just like a long backward branch
- with an unfilled delay slot. */
- case 8:
- /* Handle weird backwards branch with a filled delay slot
- with is nullified. */
- if (dbr_sequence_length () != 0
- && ! forward_branch_p (insn)
- && nullify)
- {
- strcpy (buf, "bb,");
- if ((which == 0 && negated)
- || (which == 1 && ! negated))
- strcat (buf, "<");
- else
- strcat (buf, ">=");
- if (negated)
- strcat (buf, ",n %0,%1,.+12\n\tbl %3,0");
- else
- strcat (buf, ",n %0,%1,.+12\n\tbl %2,0");
- }
- /* Handle short backwards branch with an unfilled delay slot.
- Using a bb;nop rather than extrs;bl saves 1 cycle for both
- taken and untaken branches. */
- else if (dbr_sequence_length () == 0
- && ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
- {
- strcpy (buf, "bb,");
- if ((which == 0 && negated)
- || (which == 1 && ! negated))
- strcat (buf, ">=");
- else
- strcat (buf, "<");
- if (negated)
- strcat (buf, " %0,%1,%3%#");
- else
- strcat (buf, " %0,%1,%2%#");
- }
- else
- {
- strcpy (buf, "extrs,");
- if ((which == 0 && negated)
- || (which == 1 && ! negated))
- strcat (buf, "<");
- else
- strcat (buf, ">=");
- if (nullify && negated)
- strcat (buf, " %0,%1,1,0\n\tbl,n %3,0");
- else if (nullify && ! negated)
- strcat (buf, " %0,%1,1,0\n\tbl,n %2,0");
- else if (negated)
- strcat (buf, " %0,%1,1,0\n\tbl %3,0");
- else
- strcat (buf, " %0,%1,1,0\n\tbl %2,0");
- }
- break;
-
- default:
- abort();
- }
- return buf;
-}
-
-/* This routine handles all the branch-on-variable-bit conditional branch
- sequences we might need to generate. It handles nullification of delay
- slots, varying length branches, negated branches and all combinations
- of the above. it returns the appropriate output template to emit the
- branch. */
-
-char *
-output_bvb (operands, nullify, length, negated, insn, which)
- rtx *operands;
- int nullify, length, negated;
- rtx insn;
- int which;
-{
- static char buf[100];
- int useskip = 0;
-
- /* A conditional branch to the following instruction (eg the delay slot) is
- asking for a disaster. I do not think this can happen as this pattern
- is only used when optimizing; jump optimization should eliminate the
- jump. But be prepared just in case. */
-
- if (next_active_insn (JUMP_LABEL (insn)) == next_active_insn (insn))
- return "";
-
- /* If this is a long branch with its delay slot unfilled, set `nullify'
- as it can nullify the delay slot and save a nop. */
- if (length == 8 && dbr_sequence_length () == 0)
- nullify = 1;
-
- /* If this is a short forward conditional branch which did not get
- its delay slot filled, the delay slot can still be nullified. */
- if (! nullify && length == 4 && dbr_sequence_length () == 0)
- nullify = forward_branch_p (insn);
-
- /* A forward branch over a single nullified insn can be done with a
- extrs instruction. This avoids a single cycle penalty due to
- mis-predicted branch if we fall through (branch not taken). */
-
- if (length == 4
- && next_real_insn (insn) != 0
- && get_attr_length (next_real_insn (insn)) == 4
- && JUMP_LABEL (insn) == next_nonnote_insn (next_real_insn (insn))
- && nullify)
- useskip = 1;
-
- switch (length)
- {
-
- /* All short conditional branches except backwards with an unfilled
- delay slot. */
- case 4:
- if (useskip)
- strcpy (buf, "vextrs,");
- else
- strcpy (buf, "bvb,");
- if ((which == 0 && negated)
- || (which == 1 && ! negated))
- strcat (buf, ">=");
- else
- strcat (buf, "<");
- if (useskip)
- strcat (buf, " %0,1,0");
- else if (nullify && negated)
- strcat (buf, ",n %0,%3");
- else if (nullify && ! negated)
- strcat (buf, ",n %0,%2");
- else if (! nullify && negated)
- strcat (buf, "%0,%3");
- else if (! nullify && ! negated)
- strcat (buf, " %0,%2");
- break;
-
- /* All long conditionals. Note an short backward branch with an
- unfilled delay slot is treated just like a long backward branch
- with an unfilled delay slot. */
- case 8:
- /* Handle weird backwards branch with a filled delay slot
- with is nullified. */
- if (dbr_sequence_length () != 0
- && ! forward_branch_p (insn)
- && nullify)
- {
- strcpy (buf, "bvb,");
- if ((which == 0 && negated)
- || (which == 1 && ! negated))
- strcat (buf, "<");
- else
- strcat (buf, ">=");
- if (negated)
- strcat (buf, ",n %0,.+12\n\tbl %3,0");
- else
- strcat (buf, ",n %0,.+12\n\tbl %2,0");
- }
- /* Handle short backwards branch with an unfilled delay slot.
- Using a bb;nop rather than extrs;bl saves 1 cycle for both
- taken and untaken branches. */
- else if (dbr_sequence_length () == 0
- && ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
- {
- strcpy (buf, "bvb,");
- if ((which == 0 && negated)
- || (which == 1 && ! negated))
- strcat (buf, ">=");
- else
- strcat (buf, "<");
- if (negated)
- strcat (buf, " %0,%3%#");
- else
- strcat (buf, " %0,%2%#");
- }
- else
- {
- strcpy (buf, "vextrs,");
- if ((which == 0 && negated)
- || (which == 1 && ! negated))
- strcat (buf, "<");
- else
- strcat (buf, ">=");
- if (nullify && negated)
- strcat (buf, " %0,1,0\n\tbl,n %3,0");
- else if (nullify && ! negated)
- strcat (buf, " %0,1,0\n\tbl,n %2,0");
- else if (negated)
- strcat (buf, " %0,1,0\n\tbl %3,0");
- else
- strcat (buf, " %0,1,0\n\tbl %2,0");
- }
- break;
-
- default:
- abort();
- }
- return buf;
-}
-
-/* Return the output template for emitting a dbra type insn.
-
- Note it may perform some output operations on its own before
- returning the final output string. */
-char *
-output_dbra (operands, insn, which_alternative)
- rtx *operands;
- rtx insn;
- int which_alternative;
-{
-
- /* A conditional branch to the following instruction (eg the delay slot) is
- asking for a disaster. Be prepared! */
-
- if (next_active_insn (JUMP_LABEL (insn)) == next_active_insn (insn))
- {
- if (which_alternative == 0)
- return "ldo %1(%0),%0";
- else if (which_alternative == 1)
- {
- output_asm_insn ("fstws %0,-16(0,%%r30)",operands);
- output_asm_insn ("ldw -16(0,%%r30),%4",operands);
- output_asm_insn ("ldo %1(%4),%4\n\tstw %4,-16(0,%%r30)", operands);
- return "fldws -16(0,%%r30),%0";
- }
- else
- {
- output_asm_insn ("ldw %0,%4", operands);
- return "ldo %1(%4),%4\n\tstw %4,%0";
- }
- }
-
- if (which_alternative == 0)
- {
- int nullify = INSN_ANNULLED_BRANCH_P (insn);
- int length = get_attr_length (insn);
-
- /* If this is a long branch with its delay slot unfilled, set `nullify'
- as it can nullify the delay slot and save a nop. */
- if (length == 8 && dbr_sequence_length () == 0)
- nullify = 1;
-
- /* If this is a short forward conditional branch which did not get
- its delay slot filled, the delay slot can still be nullified. */
- if (! nullify && length == 4 && dbr_sequence_length () == 0)
- nullify = forward_branch_p (insn);
-
- /* Handle short versions first. */
- if (length == 4 && nullify)
- return "addib,%C2,n %1,%0,%3";
- else if (length == 4 && ! nullify)
- return "addib,%C2 %1,%0,%3";
- else if (length == 8)
- {
- /* Handle weird backwards branch with a fulled delay slot
- which is nullified. */
- if (dbr_sequence_length () != 0
- && ! forward_branch_p (insn)
- && nullify)
- return "addib,%N2,n %1,%0,.+12\n\tbl %3,0";
- /* Handle short backwards branch with an unfilled delay slot.
- Using a addb;nop rather than addi;bl saves 1 cycle for both
- taken and untaken branches. */
- else if (dbr_sequence_length () == 0
- && ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
- return "addib,%C2 %1,%0,%3%#";
-
- /* Handle normal cases. */
- if (nullify)
- return "addi,%N2 %1,%0,%0\n\tbl,n %3,0";
- else
- return "addi,%N2 %1,%0,%0\n\tbl %3,0";
- }
- else
- abort();
- }
- /* Deal with gross reload from FP register case. */
- else if (which_alternative == 1)
- {
- /* Move loop counter from FP register to MEM then into a GR,
- increment the GR, store the GR into MEM, and finally reload
- the FP register from MEM from within the branch's delay slot. */
- output_asm_insn ("fstws %0,-16(0,%%r30)\n\tldw -16(0,%%r30),%4",operands);
- output_asm_insn ("ldo %1(%4),%4\n\tstw %4,-16(0,%%r30)", operands);
- if (get_attr_length (insn) == 24)
- return "comb,%S2 0,%4,%3\n\tfldws -16(0,%%r30),%0";
- else
- return "comclr,%B2 0,%4,0\n\tbl %3,0\n\tfldws -16(0,%%r30),%0";
- }
- /* Deal with gross reload from memory case. */
- else
- {
- /* Reload loop counter from memory, the store back to memory
- happens in the branch's delay slot. */
- output_asm_insn ("ldw %0,%4", operands);
- if (get_attr_length (insn) == 12)
- return "addib,%C2 %1,%4,%3\n\tstw %4,%0";
- else
- return "addi,%N2 %1,%4,%4\n\tbl %3,0\n\tstw %4,%0";
- }
-}
-
-/* Return the output template for emitting a dbra type insn.
-
- Note it may perform some output operations on its own before
- returning the final output string. */
-char *
-output_movb (operands, insn, which_alternative, reverse_comparison)
- rtx *operands;
- rtx insn;
- int which_alternative;
- int reverse_comparison;
-{
-
- /* A conditional branch to the following instruction (eg the delay slot) is
- asking for a disaster. Be prepared! */
-
- if (next_active_insn (JUMP_LABEL (insn)) == next_active_insn (insn))
- {
- if (which_alternative == 0)
- return "copy %1,%0";
- else if (which_alternative == 1)
- {
- output_asm_insn ("stw %1,-16(0,%%r30)",operands);
- return "fldws -16(0,%%r30),%0";
- }
- else if (which_alternative == 2)
- return "stw %1,%0";
- else
- return "mtsar %r1";
- }
-
- /* Support the second variant. */
- if (reverse_comparison)
- PUT_CODE (operands[2], reverse_condition (GET_CODE (operands[2])));
-
- if (which_alternative == 0)
- {
- int nullify = INSN_ANNULLED_BRANCH_P (insn);
- int length = get_attr_length (insn);
-
- /* If this is a long branch with its delay slot unfilled, set `nullify'
- as it can nullify the delay slot and save a nop. */
- if (length == 8 && dbr_sequence_length () == 0)
- nullify = 1;
-
- /* If this is a short forward conditional branch which did not get
- its delay slot filled, the delay slot can still be nullified. */
- if (! nullify && length == 4 && dbr_sequence_length () == 0)
- nullify = forward_branch_p (insn);
-
- /* Handle short versions first. */
- if (length == 4 && nullify)
- return "movb,%C2,n %1,%0,%3";
- else if (length == 4 && ! nullify)
- return "movb,%C2 %1,%0,%3";
- else if (length == 8)
- {
- /* Handle weird backwards branch with a filled delay slot
- which is nullified. */
- if (dbr_sequence_length () != 0
- && ! forward_branch_p (insn)
- && nullify)
- return "movb,%N2,n %1,%0,.+12\n\tbl %3,0";
-
- /* Handle short backwards branch with an unfilled delay slot.
- Using a movb;nop rather than or;bl saves 1 cycle for both
- taken and untaken branches. */
- else if (dbr_sequence_length () == 0
- && ! forward_branch_p (insn)
- && insn_addresses
- && VAL_14_BITS_P (insn_addresses[INSN_UID (JUMP_LABEL (insn))]
- - insn_addresses[INSN_UID (insn)] - 8))
- return "movb,%C2 %1,%0,%3%#";
- /* Handle normal cases. */
- if (nullify)
- return "or,%N2 %1,%%r0,%0\n\tbl,n %3,0";
- else
- return "or,%N2 %1,%%r0,%0\n\tbl %3,0";
- }
- else
- abort();
- }
- /* Deal with gross reload from FP register case. */
- else if (which_alternative == 1)
- {
- /* Move loop counter from FP register to MEM then into a GR,
- increment the GR, store the GR into MEM, and finally reload
- the FP register from MEM from within the branch's delay slot. */
- output_asm_insn ("stw %1,-16(0,%%r30)",operands);
- if (get_attr_length (insn) == 12)
- return "comb,%S2 0,%1,%3\n\tfldws -16(0,%%r30),%0";
- else
- return "comclr,%B2 0,%1,0\n\tbl %3,0\n\tfldws -16(0,%%r30),%0";
- }
- /* Deal with gross reload from memory case. */
- else if (which_alternative == 2)
- {
- /* Reload loop counter from memory, the store back to memory
- happens in the branch's delay slot. */
- if (get_attr_length (insn) == 8)
- return "comb,%S2 0,%1,%3\n\tstw %1,%0";
- else
- return "comclr,%B2 0,%1,0\n\tbl %3,0\n\tstw %1,%0";
- }
- /* Handle SAR as a destination. */
- else
- {
- if (get_attr_length (insn) == 8)
- return "comb,%S2 0,%1,%3\n\tmtsar %r1";
- else
- return "comclr,%B2 0,%1,0\n\tbl %3,0\n\tmtsar %r1";
- }
-}
-
-
-/* INSN is a millicode call. It may have an unconditional jump in its delay
- slot.
-
- CALL_DEST is the routine we are calling. */
-
-char *
-output_millicode_call (insn, call_dest)
- rtx insn;
- rtx call_dest;
-{
- int distance;
- rtx xoperands[4];
- rtx seq_insn;
-
- /* Handle common case -- empty delay slot or no jump in the delay slot,
- and we're sure that the branch will reach the beginning of the $CODE$
- subspace. */
- if ((dbr_sequence_length () == 0
- && (get_attr_length (insn) == 8 || get_attr_length (insn) == 28))
- || (dbr_sequence_length () != 0
- && GET_CODE (NEXT_INSN (insn)) != JUMP_INSN
- && get_attr_length (insn) == 4))
- {
- xoperands[0] = call_dest;
- output_asm_insn ("bl %0,%%r31%#", xoperands);
- return "";
- }
-
- /* This call may not reach the beginning of the $CODE$ subspace. */
- if (get_attr_length (insn) > 4)
- {
- int delay_insn_deleted = 0;
- rtx xoperands[2];
- rtx link;
-
- /* We need to emit an inline long-call branch. */
- if (dbr_sequence_length () != 0
- && GET_CODE (NEXT_INSN (insn)) != JUMP_INSN)
- {
- /* A non-jump insn in the delay slot. By definition we can
- emit this insn before the call. */
- final_scan_insn (NEXT_INSN (insn), asm_out_file, optimize, 0, 0);
-
- /* Now delete the delay insn. */
- PUT_CODE (NEXT_INSN (insn), NOTE);
- NOTE_LINE_NUMBER (NEXT_INSN (insn)) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (NEXT_INSN (insn)) = 0;
- delay_insn_deleted = 1;
- }
-
- /* If we're allowed to use be/ble instructions, then this is the
- best sequence to use for a long millicode call. */
- if (TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS
- || ! (flag_pic || TARGET_PORTABLE_RUNTIME))
- {
- xoperands[0] = call_dest;
- output_asm_insn ("ldil L%%%0,%%r31", xoperands);
- output_asm_insn ("ble R%%%0(%%sr4,%%r31)", xoperands);
- output_asm_insn ("nop", xoperands);
- }
- /* Pure portable runtime doesn't allow be/ble; we also don't have
- PIC support int he assembler/linker, so this sequence is needed. */
- else if (TARGET_PORTABLE_RUNTIME)
- {
- xoperands[0] = call_dest;
- /* Get the address of our target into %r29. */
- output_asm_insn ("ldil L%%%0,%%r29", xoperands);
- output_asm_insn ("ldo R%%%0(%%r29),%%r29", xoperands);
-
- /* Get our return address into %r31. */
- output_asm_insn ("blr 0,%%r31", xoperands);
-
- /* Jump to our target address in %r29. */
- output_asm_insn ("bv,n 0(%%r29)", xoperands);
-
- /* Empty delay slot. Note this insn gets fetched twice and
- executed once. To be safe we use a nop. */
- output_asm_insn ("nop", xoperands);
- return "";
- }
- /* PIC long millicode call sequence. */
- else
- {
- xoperands[0] = call_dest;
- xoperands[1] = gen_label_rtx ();
- /* Get our address + 8 into %r1. */
- output_asm_insn ("bl .+8,%%r1", xoperands);
-
- /* Add %r1 to the offset of our target from the next insn. */
- output_asm_insn ("addil L%%%0-%1,%%r1", xoperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (xoperands[1]));
- output_asm_insn ("ldo R%%%0-%1(%%r1),%%r1", xoperands);
-
- /* Get the return address into %r31. */
- output_asm_insn ("blr 0,%%r31", xoperands);
-
- /* Branch to our target which is in %r1. */
- output_asm_insn ("bv,n 0(%%r1)", xoperands);
-
- /* Empty delay slot. Note this insn gets fetched twice and
- executed once. To be safe we use a nop. */
- output_asm_insn ("nop", xoperands);
- }
-
- /* If we had a jump in the call's delay slot, output it now. */
- if (dbr_sequence_length () != 0
- && !delay_insn_deleted)
- {
- xoperands[0] = XEXP (PATTERN (NEXT_INSN (insn)), 1);
- output_asm_insn ("b,n %0", xoperands);
-
- /* Now delete the delay insn. */
- PUT_CODE (NEXT_INSN (insn), NOTE);
- NOTE_LINE_NUMBER (NEXT_INSN (insn)) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (NEXT_INSN (insn)) = 0;
- }
- return "";
- }
-
- /* This call has an unconditional jump in its delay slot and the
- call is known to reach its target or the beginning of the current
- subspace. */
-
- /* Use the containing sequence insn's address. */
- seq_insn = NEXT_INSN (PREV_INSN (XVECEXP (final_sequence, 0, 0)));
-
- distance = insn_addresses[INSN_UID (JUMP_LABEL (NEXT_INSN (insn)))]
- - insn_addresses[INSN_UID (seq_insn)] - 8;
-
- /* If the branch was too far away, emit a normal call followed
- by a nop, followed by the unconditional branch.
-
- If the branch is close, then adjust %r2 from within the
- call's delay slot. */
-
- xoperands[0] = call_dest;
- xoperands[1] = XEXP (PATTERN (NEXT_INSN (insn)), 1);
- if (! VAL_14_BITS_P (distance))
- output_asm_insn ("bl %0,%%r31\n\tnop\n\tbl,n %1,%%r0", xoperands);
- else
- {
- xoperands[3] = gen_label_rtx ();
- output_asm_insn ("\n\tbl %0,%%r31\n\tldo %1-%3(%%r31),%%r31", xoperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (xoperands[3]));
- }
-
- /* Delete the jump. */
- PUT_CODE (NEXT_INSN (insn), NOTE);
- NOTE_LINE_NUMBER (NEXT_INSN (insn)) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (NEXT_INSN (insn)) = 0;
- return "";
-}
-
-/* INSN is either a function call. It may have an unconditional jump
- in its delay slot.
-
- CALL_DEST is the routine we are calling. */
-
-char *
-output_call (insn, call_dest)
- rtx insn;
- rtx call_dest;
-{
- int distance;
- rtx xoperands[4];
- rtx seq_insn;
-
- /* Handle common case -- empty delay slot or no jump in the delay slot,
- and we're sure that the branch will reach the beginning of the $CODE$
- subspace. */
- if ((dbr_sequence_length () == 0
- && get_attr_length (insn) == 8)
- || (dbr_sequence_length () != 0
- && GET_CODE (NEXT_INSN (insn)) != JUMP_INSN
- && get_attr_length (insn) == 4))
- {
- xoperands[0] = call_dest;
- output_asm_insn ("bl %0,%%r2%#", xoperands);
- return "";
- }
-
- /* This call may not reach the beginning of the $CODE$ subspace. */
- if (get_attr_length (insn) > 8)
- {
- int delay_insn_deleted = 0;
- rtx xoperands[2];
- rtx link;
-
- /* We need to emit an inline long-call branch. Furthermore,
- because we're changing a named function call into an indirect
- function call well after the parameters have been set up, we
- need to make sure any FP args appear in both the integer
- and FP registers. Also, we need move any delay slot insn
- out of the delay slot. And finally, we can't rely on the linker
- being able to fix the call to $$dyncall! -- Yuk!. */
- if (dbr_sequence_length () != 0
- && GET_CODE (NEXT_INSN (insn)) != JUMP_INSN)
- {
- /* A non-jump insn in the delay slot. By definition we can
- emit this insn before the call (and in fact before argument
- relocating. */
- final_scan_insn (NEXT_INSN (insn), asm_out_file, optimize, 0, 0);
-
- /* Now delete the delay insn. */
- PUT_CODE (NEXT_INSN (insn), NOTE);
- NOTE_LINE_NUMBER (NEXT_INSN (insn)) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (NEXT_INSN (insn)) = 0;
- delay_insn_deleted = 1;
- }
-
- /* Now copy any FP arguments into integer registers. */
- for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
- {
- int arg_mode, regno;
- rtx use = XEXP (link, 0);
- if (! (GET_CODE (use) == USE
- && GET_CODE (XEXP (use, 0)) == REG
- && FUNCTION_ARG_REGNO_P (REGNO (XEXP (use, 0)))))
- continue;
-
- arg_mode = GET_MODE (XEXP (use, 0));
- regno = REGNO (XEXP (use, 0));
- /* Is it a floating point register? */
- if (regno >= 32 && regno <= 39)
- {
- /* Copy from the FP register into an integer register
- (via memory). */
- if (arg_mode == SFmode)
- {
- xoperands[0] = XEXP (use, 0);
- xoperands[1] = gen_rtx (REG, SImode, 26 - (regno - 32) / 2);
- output_asm_insn ("fstws %0,-16(%%sr0,%%r30)", xoperands);
- output_asm_insn ("ldw -16(%%sr0,%%r30),%1", xoperands);
- }
- else
- {
- xoperands[0] = XEXP (use, 0);
- xoperands[1] = gen_rtx (REG, DImode, 25 - (regno - 34) / 2);
- output_asm_insn ("fstds %0,-16(%%sr0,%%r30)", xoperands);
- output_asm_insn ("ldw -12(%%sr0,%%r30),%R1", xoperands);
- output_asm_insn ("ldw -16(%%sr0,%%r30),%1", xoperands);
- }
-
- }
- }
-
- /* Don't have to worry about TARGET_PORTABLE_RUNTIME here since
- we don't have any direct calls in that case. */
- if (flag_pic)
- {
- /* We have to load the address of the function using a procedure
- label (plabel). The LP and RP relocs don't work reliably for PIC,
- so we make a plain 32 bit plabel in the data segment instead. We
- have to defer outputting it of course... Not pretty. */
-
- xoperands[0] = gen_label_rtx ();
- xoperands[1] = gen_label_rtx ();
- output_asm_insn ("addil LT%%%0,%%r19", xoperands);
- output_asm_insn ("ldw RT%%%0(%%r1),%%r22", xoperands);
- output_asm_insn ("ldw 0(0,%%r22),%%r22", xoperands);
-
- if (deferred_plabels == 0)
- deferred_plabels = (struct defer_plab *)
- xmalloc (1 * sizeof (struct defer_plab));
- else
- deferred_plabels = (struct defer_plab *)
- xrealloc (deferred_plabels,
- (n_deferred_plabels + 1) * sizeof (struct defer_plab));
- deferred_plabels[n_deferred_plabels].internal_label = xoperands[0];
- deferred_plabels[n_deferred_plabels].symbol = call_dest;
- n_deferred_plabels++;
-
- /* Get our address + 8 into %r1. */
- output_asm_insn ("bl .+8,%%r1", xoperands);
-
- /* Add %r1 to the offset of dyncall from the next insn. */
- output_asm_insn ("addil L%%$$dyncall-%1,%%r1", xoperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (xoperands[1]));
- output_asm_insn ("ldo R%%$$dyncall-%1(%%r1),%%r1", xoperands);
-
- /* Get the return address into %r31. */
- output_asm_insn ("blr 0,%%r31", xoperands);
-
- /* Branch to our target which is in %r1. */
- output_asm_insn ("bv 0(%%r1)", xoperands);
-
- /* Copy the return address into %r2 also. */
- output_asm_insn ("copy %%r31,%%r2", xoperands);
- }
- else
- {
- /* No PIC stuff to worry about. We can use ldil;ble. */
- xoperands[0] = call_dest;
-
- /* Get the address of our target into %r22. */
- output_asm_insn ("ldil LP%%%0,%%r22", xoperands);
- output_asm_insn ("ldo RP%%%0(%%r22),%%r22", xoperands);
-
- /* Get the high part of the address of $dyncall into %r2, then
- add in the low part in the branch instruction. */
- output_asm_insn ("ldil L%%$$dyncall,%%r2", xoperands);
- output_asm_insn ("ble R%%$$dyncall(%%sr4,%%r2)", xoperands);
-
- /* Copy the return pointer into both %r31 and %r2. */
- output_asm_insn ("copy %%r31,%%r2", xoperands);
- }
-
- /* If we had a jump in the call's delay slot, output it now. */
- if (dbr_sequence_length () != 0
- && !delay_insn_deleted)
- {
- xoperands[0] = XEXP (PATTERN (NEXT_INSN (insn)), 1);
- output_asm_insn ("b,n %0", xoperands);
-
- /* Now delete the delay insn. */
- PUT_CODE (NEXT_INSN (insn), NOTE);
- NOTE_LINE_NUMBER (NEXT_INSN (insn)) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (NEXT_INSN (insn)) = 0;
- }
- return "";
- }
-
- /* This call has an unconditional jump in its delay slot and the
- call is known to reach its target or the beginning of the current
- subspace. */
-
- /* Use the containing sequence insn's address. */
- seq_insn = NEXT_INSN (PREV_INSN (XVECEXP (final_sequence, 0, 0)));
-
- distance = insn_addresses[INSN_UID (JUMP_LABEL (NEXT_INSN (insn)))]
- - insn_addresses[INSN_UID (seq_insn)] - 8;
-
- /* If the branch was too far away, emit a normal call followed
- by a nop, followed by the unconditional branch.
-
- If the branch is close, then adjust %r2 from within the
- call's delay slot. */
-
- xoperands[0] = call_dest;
- xoperands[1] = XEXP (PATTERN (NEXT_INSN (insn)), 1);
- if (! VAL_14_BITS_P (distance))
- output_asm_insn ("bl %0,%%r2\n\tnop\n\tbl,n %1,%%r0", xoperands);
- else
- {
- xoperands[3] = gen_label_rtx ();
- output_asm_insn ("\n\tbl %0,%%r2\n\tldo %1-%3(%%r2),%%r2", xoperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (xoperands[3]));
- }
-
- /* Delete the jump. */
- PUT_CODE (NEXT_INSN (insn), NOTE);
- NOTE_LINE_NUMBER (NEXT_INSN (insn)) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (NEXT_INSN (insn)) = 0;
- return "";
-}
-
-extern struct obstack permanent_obstack;
-extern struct obstack *saveable_obstack;
-
-/* In HPUX 8.0's shared library scheme, special relocations are needed
- for function labels if they might be passed to a function
- in a shared library (because shared libraries don't live in code
- space), and special magic is needed to construct their address.
-
- For reasons too disgusting to describe storage for the new name
- is allocated either on the saveable_obstack (released at function
- exit) or on the permanent_obstack for things that can never change
- (libcall names for example). */
-
-void
-hppa_encode_label (sym, permanent)
- rtx sym;
- int permanent;
-{
- char *str = XSTR (sym, 0);
- int len = strlen (str);
- char *newstr;
-
- newstr = obstack_alloc ((permanent ? &permanent_obstack : saveable_obstack),
- len + 2);
-
- if (str[0] == '*')
- *newstr++ = *str++;
- strcpy (newstr + 1, str);
- *newstr = '@';
- XSTR (sym,0) = newstr;
-}
-
-int
-function_label_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == SYMBOL_REF && FUNCTION_NAME_P (XSTR (op, 0));
-}
-
-/* Returns 1 if OP is a function label involved in a simple addition
- with a constant. Used to keep certain patterns from matching
- during instruction combination. */
-int
-is_function_label_plus_const (op)
- rtx op;
-{
- /* Strip off any CONST. */
- if (GET_CODE (op) == CONST)
- op = XEXP (op, 0);
-
- return (GET_CODE (op) == PLUS
- && function_label_operand (XEXP (op, 0), Pmode)
- && GET_CODE (XEXP (op, 1)) == CONST_INT);
-}
-
-/* Returns 1 if the 6 operands specified in OPERANDS are suitable for
- use in fmpyadd instructions. */
-int
-fmpyaddoperands (operands)
- rtx *operands;
-{
- enum machine_mode mode = GET_MODE (operands[0]);
-
- /* Must be a floating point mode. */
- if (mode != SFmode && mode != DFmode)
- return 0;
-
- /* All modes must be the same. */
- if (! (mode == GET_MODE (operands[1])
- && mode == GET_MODE (operands[2])
- && mode == GET_MODE (operands[3])
- && mode == GET_MODE (operands[4])
- && mode == GET_MODE (operands[5])))
- return 0;
-
- /* All operands must be registers. */
- if (! (GET_CODE (operands[1]) == REG
- && GET_CODE (operands[2]) == REG
- && GET_CODE (operands[3]) == REG
- && GET_CODE (operands[4]) == REG
- && GET_CODE (operands[5]) == REG))
- return 0;
-
- /* Only 2 real operands to the addition. One of the input operands must
- be the same as the output operand. */
- if (! rtx_equal_p (operands[3], operands[4])
- && ! rtx_equal_p (operands[3], operands[5]))
- return 0;
-
- /* Inout operand of add can not conflict with any operands from multiply. */
- if (rtx_equal_p (operands[3], operands[0])
- || rtx_equal_p (operands[3], operands[1])
- || rtx_equal_p (operands[3], operands[2]))
- return 0;
-
- /* multiply can not feed into addition operands. */
- if (rtx_equal_p (operands[4], operands[0])
- || rtx_equal_p (operands[5], operands[0]))
- return 0;
-
- /* SFmode limits the registers to the upper 32 of the 32bit FP regs. */
- if (mode == SFmode
- && (REGNO (operands[0]) < 57
- || REGNO (operands[1]) < 57
- || REGNO (operands[2]) < 57
- || REGNO (operands[3]) < 57
- || REGNO (operands[4]) < 57
- || REGNO (operands[5]) < 57))
- return 0;
-
- /* Passed. Operands are suitable for fmpyadd. */
- return 1;
-}
-
-/* Returns 1 if the 6 operands specified in OPERANDS are suitable for
- use in fmpysub instructions. */
-int
-fmpysuboperands (operands)
- rtx *operands;
-{
- enum machine_mode mode = GET_MODE (operands[0]);
-
- /* Must be a floating point mode. */
- if (mode != SFmode && mode != DFmode)
- return 0;
-
- /* All modes must be the same. */
- if (! (mode == GET_MODE (operands[1])
- && mode == GET_MODE (operands[2])
- && mode == GET_MODE (operands[3])
- && mode == GET_MODE (operands[4])
- && mode == GET_MODE (operands[5])))
- return 0;
-
- /* All operands must be registers. */
- if (! (GET_CODE (operands[1]) == REG
- && GET_CODE (operands[2]) == REG
- && GET_CODE (operands[3]) == REG
- && GET_CODE (operands[4]) == REG
- && GET_CODE (operands[5]) == REG))
- return 0;
-
- /* Only 2 real operands to the subtraction. Subtraction is not a commutative
- operation, so operands[4] must be the same as operand[3]. */
- if (! rtx_equal_p (operands[3], operands[4]))
- return 0;
-
- /* multiply can not feed into subtraction. */
- if (rtx_equal_p (operands[5], operands[0]))
- return 0;
-
- /* Inout operand of sub can not conflict with any operands from multiply. */
- if (rtx_equal_p (operands[3], operands[0])
- || rtx_equal_p (operands[3], operands[1])
- || rtx_equal_p (operands[3], operands[2]))
- return 0;
-
- /* SFmode limits the registers to the upper 32 of the 32bit FP regs. */
- if (mode == SFmode
- && (REGNO (operands[0]) < 57
- || REGNO (operands[1]) < 57
- || REGNO (operands[2]) < 57
- || REGNO (operands[3]) < 57
- || REGNO (operands[4]) < 57
- || REGNO (operands[5]) < 57))
- return 0;
-
- /* Passed. Operands are suitable for fmpysub. */
- return 1;
-}
-
-int
-plus_xor_ior_operator (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == PLUS || GET_CODE (op) == XOR
- || GET_CODE (op) == IOR);
-}
-
-/* Return 1 if the given constant is 2, 4, or 8. These are the valid
- constants for shadd instructions. */
-int
-shadd_constant_p (val)
- int val;
-{
- if (val == 2 || val == 4 || val == 8)
- return 1;
- else
- return 0;
-}
-
-/* Return 1 if OP is a CONST_INT with the value 2, 4, or 8. These are
- the valid constant for shadd instructions. */
-int
-shadd_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && shadd_constant_p (INTVAL (op)));
-}
-
-/* Return 1 if OP is valid as a base register in a reg + reg address. */
-
-int
-basereg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- /* cse will create some unscaled indexed addresses, however; it
- generally isn't a win on the PA, so avoid creating unscaled
- indexed addresses until after cse is finished. */
- if (!cse_not_expected)
- return 0;
-
- /* Once reload has started everything is considered valid. Reload should
- only create indexed addresses using the stack/frame pointer, and any
- others were checked for validity when created by the combine pass.
-
- Also allow any register when TARGET_NO_SPACE_REGS is in effect since
- we don't have to worry about the braindamaged implicit space register
- selection using the basereg only (rather than effective address)
- screwing us over. */
- if (TARGET_NO_SPACE_REGS || reload_in_progress || reload_completed)
- return (GET_CODE (op) == REG);
-
- /* Stack is always OK for indexing. */
- if (op == stack_pointer_rtx)
- return 1;
-
- /* While it's always safe to index off the frame pointer, it's not
- always profitable, particularly when the frame pointer is being
- eliminated. */
- if (! flag_omit_frame_pointer && op == frame_pointer_rtx)
- return 1;
-
- /* The only other valid OPs are pseudo registers with
- REGNO_POINTER_FLAG set. */
- if (GET_CODE (op) != REG
- || REGNO (op) < FIRST_PSEUDO_REGISTER
- || ! register_operand (op, mode))
- return 0;
-
- return REGNO_POINTER_FLAG (REGNO (op));
-}
-
-/* Return 1 if this operand is anything other than a hard register. */
-
-int
-non_hard_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ! (GET_CODE (op) == REG && REGNO (op) < FIRST_PSEUDO_REGISTER);
-}
-
-/* Return 1 if INSN branches forward. Should be using insn_addresses
- to avoid walking through all the insns... */
-int
-forward_branch_p (insn)
- rtx insn;
-{
- rtx label = JUMP_LABEL (insn);
-
- while (insn)
- {
- if (insn == label)
- break;
- else
- insn = NEXT_INSN (insn);
- }
-
- return (insn == label);
-}
-
-/* Return 1 if OP is an equality comparison, else return 0. */
-int
-eq_neq_comparison_operator (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == EQ || GET_CODE (op) == NE);
-}
-
-/* Return 1 if OP is an operator suitable for use in a movb instruction. */
-int
-movb_comparison_operator (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == EQ || GET_CODE (op) == NE
- || GET_CODE (op) == LT || GET_CODE (op) == GE);
-}
-
-/* Return 1 if INSN is in the delay slot of a call instruction. */
-int
-jump_in_call_delay (insn)
- rtx insn;
-{
-
- if (GET_CODE (insn) != JUMP_INSN)
- return 0;
-
- if (PREV_INSN (insn)
- && PREV_INSN (PREV_INSN (insn))
- && GET_CODE (next_active_insn (PREV_INSN (PREV_INSN (insn)))) == INSN)
- {
- rtx test_insn = next_active_insn (PREV_INSN (PREV_INSN (insn)));
-
- return (GET_CODE (PATTERN (test_insn)) == SEQUENCE
- && XVECEXP (PATTERN (test_insn), 0, 1) == insn);
-
- }
- else
- return 0;
-}
-
-/* Output an unconditional move and branch insn. */
-
-char *
-output_parallel_movb (operands, length)
- rtx *operands;
- int length;
-{
- /* These are the cases in which we win. */
- if (length == 4)
- return "mov%I1b,tr %1,%0,%2";
-
- /* None of these cases wins, but they don't lose either. */
- if (dbr_sequence_length () == 0)
- {
- /* Nothing in the delay slot, fake it by putting the combined
- insn (the copy or add) in the delay slot of a bl. */
- if (GET_CODE (operands[1]) == CONST_INT)
- return "bl %2,0\n\tldi %1,%0";
- else
- return "bl %2,0\n\tcopy %1,%0";
- }
- else
- {
- /* Something in the delay slot, but we've got a long branch. */
- if (GET_CODE (operands[1]) == CONST_INT)
- return "ldi %1,%0\n\tbl %2,0";
- else
- return "copy %1,%0\n\tbl %2,0";
- }
-}
-
-/* Output an unconditional add and branch insn. */
-
-char *
-output_parallel_addb (operands, length)
- rtx *operands;
- int length;
-{
- /* To make life easy we want operand0 to be the shared input/output
- operand and operand1 to be the readonly operand. */
- if (operands[0] == operands[1])
- operands[1] = operands[2];
-
- /* These are the cases in which we win. */
- if (length == 4)
- return "add%I1b,tr %1,%0,%3";
-
- /* None of these cases win, but they don't lose either. */
- if (dbr_sequence_length () == 0)
- {
- /* Nothing in the delay slot, fake it by putting the combined
- insn (the copy or add) in the delay slot of a bl. */
- return "bl %3,0\n\tadd%I1 %1,%0,%0";
- }
- else
- {
- /* Something in the delay slot, but we've got a long branch. */
- return "add%I1 %1,%0,%0\n\tbl %3,0";
- }
-}
-
-/* Return nonzero if INSN (a jump insn) immediately follows a call. This
- is used to discourage creating parallel movb/addb insns since a jump
- which immediately follows a call can execute in the delay slot of the
- call. */
-
-following_call (insn)
- rtx insn;
-{
- /* Find the previous real insn, skipping NOTEs. */
- insn = PREV_INSN (insn);
- while (insn && GET_CODE (insn) == NOTE)
- insn = PREV_INSN (insn);
-
- /* Check for CALL_INSNs and millicode calls. */
- if (insn
- && (GET_CODE (insn) == CALL_INSN
- || (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) != SEQUENCE
- && GET_CODE (PATTERN (insn)) != USE
- && GET_CODE (PATTERN (insn)) != CLOBBER
- && get_attr_type (insn) == TYPE_MILLI)))
- return 1;
-
- return 0;
-}
-
-/* We use this hook to perform a PA specific optimization which is difficult
- to do in earlier passes.
-
- We want the delay slots of branches within jump tables to be filled.
- None of the compiler passes at the moment even has the notion that a
- PA jump table doesn't contain addresses, but instead contains actual
- instructions!
-
- Because we actually jump into the table, the addresses of each entry
- must stay constant in relation to the beginning of the table (which
- itself must stay constant relative to the instruction to jump into
- it). I don't believe we can guarantee earlier passes of the compiler
- will adhere to those rules.
-
- So, late in the compilation process we find all the jump tables, and
- expand them into real code -- eg each entry in the jump table vector
- will get an appropriate label followed by a jump to the final target.
-
- Reorg and the final jump pass can then optimize these branches and
- fill their delay slots. We end up with smaller, more efficient code.
-
- The jump instructions within the table are special; we must be able
- to identify them during assembly output (if the jumps don't get filled
- we need to emit a nop rather than nullifying the delay slot)). We
- identify jumps in switch tables by marking the SET with DImode. */
-
-pa_reorg (insns)
- rtx insns;
-{
- rtx insn;
-
- remove_useless_addtr_insns (insns, 1);
-
- pa_combine_instructions (get_insns ());
-
- /* This is fairly cheap, so always run it if optimizing. */
- if (optimize > 0)
- {
- /* Find and explode all ADDR_VEC insns. */
- insns = get_insns ();
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- {
- rtx pattern, tmp, location;
- unsigned int length, i;
-
- /* Find an ADDR_VEC insn to explode. */
- if (GET_CODE (insn) != JUMP_INSN
- || GET_CODE (PATTERN (insn)) != ADDR_VEC)
- continue;
-
- /* If needed, emit marker for the beginning of the branch table. */
- if (TARGET_GAS)
- emit_insn_before (gen_begin_brtab (), insn);
-
- pattern = PATTERN (insn);
- location = PREV_INSN (insn);
- length = XVECLEN (pattern, 0);
-
- for (i = 0; i < length; i++)
- {
- /* Emit the jump itself. */
- tmp = gen_switch_jump (XEXP (XVECEXP (pattern, 0, i), 0));
- tmp = emit_jump_insn_after (tmp, location);
- JUMP_LABEL (tmp) = XEXP (XVECEXP (pattern, 0, i), 0);
- LABEL_NUSES (JUMP_LABEL (tmp))++;
-
- /* Emit a BARRIER after the jump. */
- location = NEXT_INSN (location);
- emit_barrier_after (location);
-
- /* Put a CODE_LABEL before each so jump.c does not optimize
- the jumps away. */
- location = NEXT_INSN (location);
- tmp = gen_label_rtx ();
- LABEL_NUSES (tmp) = 1;
- emit_label_after (tmp, location);
- location = NEXT_INSN (location);
- }
-
- /* If needed, emit marker for the end of the branch table. */
- if (TARGET_GAS)
- emit_insn_before (gen_end_brtab (), location);
- /* Delete the ADDR_VEC. */
- delete_insn (insn);
- }
- }
- else if (TARGET_GAS)
- {
- /* Sill need an end_brtab insn. */
- insns = get_insns ();
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- {
- /* Find an ADDR_VEC insn. */
- if (GET_CODE (insn) != JUMP_INSN
- || GET_CODE (PATTERN (insn)) != ADDR_VEC)
- continue;
-
- /* Now generate markers for the beginning and end of the
- branc table. */
- emit_insn_before (gen_begin_brtab (), insn);
- emit_insn_after (gen_end_brtab (), insn);
- }
- }
-}
-
-/* The PA has a number of odd instructions which can perform multiple
- tasks at once. On first generation PA machines (PA1.0 and PA1.1)
- it may be profitable to combine two instructions into one instruction
- with two outputs. It's not profitable PA2.0 machines because the
- two outputs would take two slots in the reorder buffers.
-
- This routine finds instructions which can be combined and combines
- them. We only support some of the potential combinations, and we
- only try common ways to find suitable instructions.
-
- * addb can add two registers or a register and a small integer
- and jump to a nearby (+-8k) location. Normally the jump to the
- nearby location is conditional on the result of the add, but by
- using the "true" condition we can make the jump unconditional.
- Thus addb can perform two independent operations in one insn.
-
- * movb is similar to addb in that it can perform a reg->reg
- or small immediate->reg copy and jump to a nearby (+-8k location).
-
- * fmpyadd and fmpysub can perform a FP multiply and either an
- FP add or FP sub if the operands of the multiply and add/sub are
- independent (there are other minor restrictions). Note both
- the fmpy and fadd/fsub can in theory move to better spots according
- to data dependencies, but for now we require the fmpy stay at a
- fixed location.
-
- * Many of the memory operations can perform pre & post updates
- of index registers. GCC's pre/post increment/decrement addressing
- is far too simple to take advantage of all the possibilities. This
- pass may not be suitable since those insns may not be independent.
-
- * comclr can compare two ints or an int and a register, nullify
- the following instruction and zero some other register. This
- is more difficult to use as it's harder to find an insn which
- will generate a comclr than finding something like an unconditional
- branch. (conditional moves & long branches create comclr insns).
-
- * Most arithmetic operations can conditionally skip the next
- instruction. They can be viewed as "perform this operation
- and conditionally jump to this nearby location" (where nearby
- is an insns away). These are difficult to use due to the
- branch length restrictions. */
-
-pa_combine_instructions (insns)
- rtx insns;
-{
- rtx anchor, new;
-
- /* This can get expensive since the basic algorithm is on the
- order of O(n^2) (or worse). Only do it for -O2 or higher
- levels of optimizaton. */
- if (optimize < 2)
- return;
-
- /* Walk down the list of insns looking for "anchor" insns which
- may be combined with "floating" insns. As the name implies,
- "anchor" instructions don't move, while "floating" insns may
- move around. */
- new = gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2, NULL_RTX, NULL_RTX));
- new = make_insn_raw (new);
-
- for (anchor = get_insns (); anchor; anchor = NEXT_INSN (anchor))
- {
- enum attr_pa_combine_type anchor_attr;
- enum attr_pa_combine_type floater_attr;
-
- /* We only care about INSNs, JUMP_INSNs, and CALL_INSNs.
- Also ignore any special USE insns. */
- if (GET_CODE (anchor) != INSN
- && GET_CODE (anchor) != JUMP_INSN
- && GET_CODE (anchor) != CALL_INSN
- || GET_CODE (PATTERN (anchor)) == USE
- || GET_CODE (PATTERN (anchor)) == CLOBBER
- || GET_CODE (PATTERN (anchor)) == ADDR_VEC
- || GET_CODE (PATTERN (anchor)) == ADDR_DIFF_VEC)
- continue;
-
- anchor_attr = get_attr_pa_combine_type (anchor);
- /* See if anchor is an insn suitable for combination. */
- if (anchor_attr == PA_COMBINE_TYPE_FMPY
- || anchor_attr == PA_COMBINE_TYPE_FADDSUB
- || (anchor_attr == PA_COMBINE_TYPE_UNCOND_BRANCH
- && ! forward_branch_p (anchor)))
- {
- rtx floater;
-
- for (floater = PREV_INSN (anchor);
- floater;
- floater = PREV_INSN (floater))
- {
- if (GET_CODE (floater) == NOTE
- || (GET_CODE (floater) == INSN
- && (GET_CODE (PATTERN (floater)) == USE
- || GET_CODE (PATTERN (floater)) == CLOBBER)))
- continue;
-
- /* Anything except a regular INSN will stop our search. */
- if (GET_CODE (floater) != INSN
- || GET_CODE (PATTERN (floater)) == ADDR_VEC
- || GET_CODE (PATTERN (floater)) == ADDR_DIFF_VEC)
- {
- floater = NULL_RTX;
- break;
- }
-
- /* See if FLOATER is suitable for combination with the
- anchor. */
- floater_attr = get_attr_pa_combine_type (floater);
- if ((anchor_attr == PA_COMBINE_TYPE_FMPY
- && floater_attr == PA_COMBINE_TYPE_FADDSUB)
- || (anchor_attr == PA_COMBINE_TYPE_FADDSUB
- && floater_attr == PA_COMBINE_TYPE_FMPY))
- {
- /* If ANCHOR and FLOATER can be combined, then we're
- done with this pass. */
- if (pa_can_combine_p (new, anchor, floater, 0,
- SET_DEST (PATTERN (floater)),
- XEXP (SET_SRC (PATTERN (floater)), 0),
- XEXP (SET_SRC (PATTERN (floater)), 1)))
- break;
- }
-
- else if (anchor_attr == PA_COMBINE_TYPE_UNCOND_BRANCH
- && floater_attr == PA_COMBINE_TYPE_ADDMOVE)
- {
- if (GET_CODE (SET_SRC (PATTERN (floater))) == PLUS)
- {
- if (pa_can_combine_p (new, anchor, floater, 0,
- SET_DEST (PATTERN (floater)),
- XEXP (SET_SRC (PATTERN (floater)), 0),
- XEXP (SET_SRC (PATTERN (floater)), 1)))
- break;
- }
- else
- {
- if (pa_can_combine_p (new, anchor, floater, 0,
- SET_DEST (PATTERN (floater)),
- SET_SRC (PATTERN (floater)),
- SET_SRC (PATTERN (floater))))
- break;
- }
- }
- }
-
- /* If we didn't find anything on the backwards scan try forwards. */
- if (!floater
- && (anchor_attr == PA_COMBINE_TYPE_FMPY
- || anchor_attr == PA_COMBINE_TYPE_FADDSUB))
- {
- for (floater = anchor; floater; floater = NEXT_INSN (floater))
- {
- if (GET_CODE (floater) == NOTE
- || (GET_CODE (floater) == INSN
- && (GET_CODE (PATTERN (floater)) == USE
- || GET_CODE (PATTERN (floater)) == CLOBBER)))
-
- continue;
-
- /* Anything except a regular INSN will stop our search. */
- if (GET_CODE (floater) != INSN
- || GET_CODE (PATTERN (floater)) == ADDR_VEC
- || GET_CODE (PATTERN (floater)) == ADDR_DIFF_VEC)
- {
- floater = NULL_RTX;
- break;
- }
-
- /* See if FLOATER is suitable for combination with the
- anchor. */
- floater_attr = get_attr_pa_combine_type (floater);
- if ((anchor_attr == PA_COMBINE_TYPE_FMPY
- && floater_attr == PA_COMBINE_TYPE_FADDSUB)
- || (anchor_attr == PA_COMBINE_TYPE_FADDSUB
- && floater_attr == PA_COMBINE_TYPE_FMPY))
- {
- /* If ANCHOR and FLOATER can be combined, then we're
- done with this pass. */
- if (pa_can_combine_p (new, anchor, floater, 1,
- SET_DEST (PATTERN (floater)),
- XEXP (SET_SRC (PATTERN(floater)),0),
- XEXP(SET_SRC(PATTERN(floater)),1)))
- break;
- }
- }
- }
-
- /* FLOATER will be nonzero if we found a suitable floating
- insn for combination with ANCHOR. */
- if (floater
- && (anchor_attr == PA_COMBINE_TYPE_FADDSUB
- || anchor_attr == PA_COMBINE_TYPE_FMPY))
- {
- /* Emit the new instruction and delete the old anchor. */
- emit_insn_before (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (2, PATTERN (anchor),
- PATTERN (floater))),
- anchor);
- PUT_CODE (anchor, NOTE);
- NOTE_LINE_NUMBER (anchor) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (anchor) = 0;
-
- /* Emit a special USE insn for FLOATER, then delete
- the floating insn. */
- emit_insn_before (gen_rtx (USE, VOIDmode, floater), floater);
- delete_insn (floater);
-
- continue;
- }
- else if (floater
- && anchor_attr == PA_COMBINE_TYPE_UNCOND_BRANCH)
- {
- rtx temp;
- /* Emit the new_jump instruction and delete the old anchor. */
- temp = emit_jump_insn_before (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (2, PATTERN (anchor),
- PATTERN (floater))),
- anchor);
- JUMP_LABEL (temp) = JUMP_LABEL (anchor);
- PUT_CODE (anchor, NOTE);
- NOTE_LINE_NUMBER (anchor) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (anchor) = 0;
-
- /* Emit a special USE insn for FLOATER, then delete
- the floating insn. */
- emit_insn_before (gen_rtx (USE, VOIDmode, floater), floater);
- delete_insn (floater);
- continue;
- }
- }
- }
-}
-
-int
-pa_can_combine_p (new, anchor, floater, reversed, dest, src1, src2)
- rtx new, anchor, floater;
- int reversed;
- rtx dest, src1, src2;
-{
- int insn_code_number;
- rtx start, end;
-
- /* Create a PARALLEL with the patterns of ANCHOR and
- FLOATER, try to recognize it, then test constraints
- for the resulting pattern.
-
- If the pattern doesn't match or the constraints
- aren't met keep searching for a suitable floater
- insn. */
- XVECEXP (PATTERN (new), 0, 0) = PATTERN (anchor);
- XVECEXP (PATTERN (new), 0, 1) = PATTERN (floater);
- INSN_CODE (new) = -1;
- insn_code_number = recog_memoized (new);
- if (insn_code_number < 0
- || !constrain_operands (insn_code_number, 1))
- return 0;
-
- if (reversed)
- {
- start = anchor;
- end = floater;
- }
- else
- {
- start = floater;
- end = anchor;
- }
-
- /* There's up to three operands to consider. One
- output and two inputs.
-
- The output must not be used between FLOATER & ANCHOR
- exclusive. The inputs must not be set between
- FLOATER and ANCHOR exclusive. */
-
- if (reg_used_between_p (dest, start, end))
- return 0;
-
- if (reg_set_between_p (src1, start, end))
- return 0;
-
- if (reg_set_between_p (src2, start, end))
- return 0;
-
- /* If we get here, then everything is good. */
- return 1;
-}
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
deleted file mode 100644
index f9d05e4603a..00000000000
--- a/gcc/config/pa/pa.h
+++ /dev/null
@@ -1,2390 +0,0 @@
-/* Definitions of target machine for GNU compiler, for the HP Spectrum.
- Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.com) of Cygnus Support
- and Tim Moore (moore@defmacro.cs.utah.edu) of the Center for
- Software Science at the University of Utah.
-
-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 1, 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. */
-
-enum cmp_type /* comparison type */
-{
- CMP_SI, /* compare integers */
- CMP_SF, /* compare single precision floats */
- CMP_DF, /* compare double precision floats */
- CMP_MAX /* max comparison type */
-};
-
-/* For long call handling. */
-extern unsigned int total_code_bytes;
-
-/* Which processor to schedule for. */
-
-enum processor_type
-{
- PROCESSOR_700,
- PROCESSOR_7100,
- PROCESSOR_7100LC,
-};
-
-#define pa_cpu_attr ((enum attr_cpu)pa_cpu)
-
-/* For -mschedule= option. */
-extern char *pa_cpu_string;
-extern enum processor_type pa_cpu;
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fputs (" (hppa)", stderr);
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* compile code for HP-PA 1.1 ("Snake") */
-
-#define TARGET_SNAKE (target_flags & 1)
-
-/* Disable all FP registers (they all become fixed). This may be necessary
- for compiling kernels which perform lazy context switching of FP regs.
- Note if you use this option and try to perform floating point operations
- the compiler will abort! */
-
-#define TARGET_DISABLE_FPREGS (target_flags & 2)
-
-/* Generate code which assumes that calls through function pointers will
- never cross a space boundary. Such assumptions are generally safe for
- building kernels and statically linked executables. Code compiled with
- this option will fail miserably if the executable is dynamically linked
- or uses nested functions!
-
- This is also used to trigger agressive unscaled index addressing. */
-#define TARGET_NO_SPACE_REGS (target_flags & 4)
-
-/* Allow unconditional jumps in the delay slots of call instructions. */
-#define TARGET_JUMP_IN_DELAY (target_flags & 8)
-
-/* Optimize for space. Currently this only turns on out of line
- prologues and epilogues. */
-#define TARGET_SPACE (target_flags & 16)
-
-/* Disable indexed addressing modes. */
-
-#define TARGET_DISABLE_INDEXING (target_flags & 32)
-
-/* Emit code which follows the new portable runtime calling conventions
- HP wants everyone to use for ELF objects. If at all possible you want
- to avoid this since it's a performance loss for non-prototyped code.
-
- Note TARGET_PORTABLE_RUNTIME also forces all calls to use inline
- long-call stubs which is quite expensive. */
-
-#define TARGET_PORTABLE_RUNTIME (target_flags & 64)
-
-/* Emit directives only understood by GAS. This allows parameter
- relocations to work for static functions. There is no way
- to make them work the HP assembler at this time. */
-
-#define TARGET_GAS (target_flags & 128)
-
-/* Emit code for processors which do not have an FPU. */
-
-#define TARGET_SOFT_FLOAT (target_flags & 256)
-
-/* Use 3-insn load/store sequences for access to large data segments
- in shared libraries on hpux10. */
-#define TARGET_LONG_LOAD_STORE (target_flags & 512)
-
-/* Use a faster sequence for indirect calls. */
-#define TARGET_FAST_INDIRECT_CALLS (target_flags & 1024)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- {{"snake", 1}, \
- {"nosnake", -1}, \
- {"pa-risc-1-0", -1}, \
- {"pa-risc-1-1", 1}, \
- {"disable-fpregs", 2}, \
- {"no-disable-fpregs", -2}, \
- {"no-space-regs", 4}, \
- {"space-regs", -4}, \
- {"jump-in-delay", 8}, \
- {"no-jump-in-delay", -8}, \
- {"space", 16}, \
- {"no-space", -16}, \
- {"disable-indexing", 32}, \
- {"no-disable-indexing", -32},\
- {"portable-runtime", 64}, \
- {"no-portable-runtime", -64},\
- {"gas", 128}, \
- {"no-gas", -128}, \
- {"soft-float", 256}, \
- {"no-soft-float", -256}, \
- {"long-load-store", 512}, \
- {"no-long-load-store", -512},\
- {"fast-indirect-calls", 1024},\
- {"no-fast-indirect-calls", -1024},\
- {"linker-opt", 0}, \
- { "", TARGET_DEFAULT | TARGET_CPU_DEFAULT}}
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 0x88 /* TARGET_GAS + TARGET_JUMP_IN_DELAY */
-#endif
-
-#ifndef TARGET_CPU_DEFAULT
-#define TARGET_CPU_DEFAULT 0
-#endif
-
-#define TARGET_OPTIONS \
-{ \
- { "schedule=", &pa_cpu_string }\
-}
-
-#define OVERRIDE_OPTIONS override_options ()
-
-#define DBX_DEBUGGING_INFO
-#define DEFAULT_GDB_EXTENSIONS 1
-
-/* This is the way other stabs-in-XXX tools do things. We will be
- compatible. */
-#define DBX_BLOCKS_FUNCTION_RELATIVE 1
-
-/* Likewise for linenos.
-
- We make the first line stab special to avoid adding several
- gross hacks to GAS. */
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- { static int sym_lineno = 1; \
- static tree last_function_decl = NULL; \
- if (current_function_decl == last_function_decl) \
- fprintf (file, "\t.stabn 68,0,%d,L$M%d-%s\nL$M%d:\n", \
- line, sym_lineno, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0) + 1, \
- sym_lineno); \
- else \
- fprintf (file, "\t.stabn 68,0,%d,0\n", line); \
- last_function_decl = current_function_decl; \
- sym_lineno += 1; }
-
-/* But, to make this work, we have to output the stabs for the function
- name *first*... */
-#define DBX_FUNCTION_FIRST
-
-/* Only labels should ever begin in column zero. */
-#define ASM_STABS_OP "\t.stabs"
-#define ASM_STABN_OP "\t.stabn"
-
-/* GDB always assumes the current function's frame begins at the value
- of the stack pointer upon entry to the current function. Accessing
- local variables and parameters passed on the stack is done using the
- base of the frame + an offset provided by GCC.
-
- For functions which have frame pointers this method works fine;
- the (frame pointer) == (stack pointer at function entry) and GCC provides
- an offset relative to the frame pointer.
-
- This loses for functions without a frame pointer; GCC provides an offset
- which is relative to the stack pointer after adjusting for the function's
- frame size. GDB would prefer the offset to be relative to the value of
- the stack pointer at the function's entry. Yuk! */
-#define DEBUGGER_AUTO_OFFSET(X) \
- ((GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) \
- + (frame_pointer_needed ? 0 : compute_frame_size (get_frame_size (), 0)))
-
-#define DEBUGGER_ARG_OFFSET(OFFSET, X) \
- ((GET_CODE (X) == PLUS ? OFFSET : 0) \
- + (frame_pointer_needed ? 0 : compute_frame_size (get_frame_size (), 0)))
-
-/* gdb needs a null N_SO at the end of each file for scattered loading. */
-
-#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
- text_section (); \
- if (!TARGET_PORTABLE_RUNTIME) \
- fputs ("\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE); \
- else \
- fprintf (FILE, "%s\n", TEXT_SECTION_ASM_OP); \
- fprintf (FILE, \
- "\t.stabs \"\",%d,0,0,L$text_end0000\nL$text_end0000:\n", N_SO)
-
-#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 1) == 0
-#define CPP_SPEC "%{msnake:-D__hp9000s700 -D_PA_RISC1_1}\
- %{mpa-risc-1-1:-D__hp9000s700 -D_PA_RISC1_1}\
- %{!ansi: -D_HPUX_SOURCE -D_HIUX_SOURCE}"
-#else
-#define CPP_SPEC "%{!mpa-risc-1-0:%{!mnosnake:%{!msoft-float:-D__hp9000s700 -D_PA_RISC1_1}}} %{!ansi: -D_HPUX_SOURCE -D_HIUX_SOURCE}"
-#endif
-
-/* Defines for a K&R CC */
-
-#define CC1_SPEC "%{pg:} %{p:}"
-
-#define LINK_SPEC "%{mlinker-opt:-O} %{!shared:-u main} %{shared:-b}"
-
-/* We don't want -lg. */
-#ifndef LIB_SPEC
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-#endif
-
-/* Make gcc agree with <machine/ansi.h> */
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-#define WCHAR_TYPE "unsigned int"
-#define WCHAR_TYPE_SIZE 32
-
-/* Show we can debug even without a frame pointer. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* Machine dependent reorg pass. */
-#define MACHINE_DEPENDENT_REORG(X) pa_reorg(X)
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -Dunix -Dhp9000 -Dhp800 -Dspectrum -DREVARGV -Asystem(unix) -Asystem(bsd) -Acpu(hppa) -Amachine(hppa)"
-
-/* HPUX has a program 'chatr' to list the dependencies of dynamically
- linked executables and shared libraries. */
-#define LDD_SUFFIX "chatr"
-/* Look for lines like "dynamic /usr/lib/X11R5/libX11.sl"
- or "static /usr/lib/X11R5/libX11.sl".
-
- HPUX 10.20 also has lines like "static branch prediction ..."
- so we filter that out explcitly.
-
- We also try to bound our search for libraries with marker
- lines. What a pain. */
-#define PARSE_LDD_OUTPUT(PTR) \
-do { \
- static int in_shlib_list = 0; \
- while (*PTR == ' ') PTR++; \
- if (strncmp (PTR, "shared library list:", \
- sizeof ("shared library list:") - 1) == 0) \
- { \
- PTR = 0; \
- in_shlib_list = 1; \
- } \
- else if (strncmp (PTR, "shared library binding:", \
- sizeof ("shared library binding:") - 1) == 0)\
- { \
- PTR = 0; \
- in_shlib_list = 0; \
- } \
- else if (strncmp (PTR, "static branch prediction disabled", \
- sizeof ("static branch prediction disabled") - 1) == 0)\
- { \
- PTR = 0; \
- in_shlib_list = 0; \
- } \
- else if (in_shlib_list \
- && strncmp (PTR, "dynamic", sizeof ("dynamic") - 1) == 0) \
- { \
- PTR += sizeof ("dynamic") - 1; \
- while (*p == ' ') PTR++; \
- } \
- else if (in_shlib_list \
- && strncmp (PTR, "static", sizeof ("static") - 1) == 0) \
- { \
- PTR += sizeof ("static") - 1; \
- while (*p == ' ') PTR++; \
- } \
- else \
- PTR = 0; \
-} while (0)
-
-/* target machine storage layout */
-
-/* Define for cross-compilation from a host with a different float format
- or endianness (e.g. VAX, x86). */
-#define REAL_ARITHMETIC
-
-/* Define this macro if it is advisable to hold scalars in registers
- in a wider mode than that declared by the program. In such cases,
- the value is constrained to be within the bounds of the declared
- type, but kept valid in the wider mode. The signedness of the
- extension may differ from that of the type. */
-
-#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < 4) \
- (MODE) = SImode;
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is true on the HP-PA. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is lowest
- numbered. */
-#define WORDS_BIG_ENDIAN 1
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Largest alignment required for any stack parameter, in bits.
- Don't define this if it is equal to PARM_BOUNDARY */
-#define MAX_PARM_BOUNDARY 64
-
-/* Boundary (in *bits*) on which stack pointer is always aligned;
- certain optimizations in combine depend on this.
-
- GCC for the PA always rounds its stacks to a 512bit boundary,
- but that happens late in the compilation process. */
-#define STACK_BOUNDARY 64
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 64
-
-/* The .align directive in the HP assembler allows up to a 32 alignment. */
-#define MAX_OFILE_ALIGNMENT 32768
-
-/* Get around hp-ux assembler bug, and make strcpy of constants fast. */
-#define CONSTANT_ALIGNMENT(CODE, TYPEALIGN) \
- ((TYPEALIGN) < 32 ? 32 : (TYPEALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Generate calls to memcpy, memcmp and memset. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- HP-PA 1.0 has 32 fullword registers and 16 floating point
- registers. The floating point registers hold either word or double
- word values.
-
- 16 additional registers are reserved.
-
- HP-PA 1.1 has 32 fullword registers and 32 floating point
- registers. However, the floating point registers behave
- differently: the left and right halves of registers are addressable
- as 32 bit registers. So, we will set things up like the 68k which
- has different fp units: define separate register sets for the 1.0
- and 1.1 fp units. */
-
-#define FIRST_PSEUDO_REGISTER 89 /* 32 general regs + 56 fp regs +
- + 1 shift reg */
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
-
- On the HP-PA, these are:
- Reg 0 = 0 (hardware). However, 0 is used for condition code,
- so is not fixed.
- Reg 1 = ADDIL target/Temporary (hardware).
- Reg 2 = Return Pointer
- Reg 3 = Frame Pointer
- Reg 4 = Frame Pointer (>8k varying frame with HP compilers only)
- Reg 4-18 = Preserved Registers
- Reg 19 = Linkage Table Register in HPUX 8.0 shared library scheme.
- Reg 20-22 = Temporary Registers
- Reg 23-26 = Temporary/Parameter Registers
- Reg 27 = Global Data Pointer (hp)
- Reg 28 = Temporary/???/Return Value register
- Reg 29 = Temporary/Static Chain/Return Value register #2
- Reg 30 = stack pointer
- Reg 31 = Temporary/Millicode Return Pointer (hp)
-
- Freg 0-3 = Status Registers -- Not known to the compiler.
- Freg 4-7 = Arguments/Return Value
- Freg 8-11 = Temporary Registers
- Freg 12-15 = Preserved Registers
-
- Freg 16-31 = Reserved
-
- On the Snake, fp regs are
-
- Freg 0-3 = Status Registers -- Not known to the compiler.
- Freg 4L-7R = Arguments/Return Value
- Freg 8L-11R = Temporary Registers
- Freg 12L-21R = Preserved Registers
- Freg 22L-31R = Temporary Registers
-
-*/
-
-#define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 1, 0, 0, 1, 0, \
- /* fp registers */ \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- /* fp registers */ \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1}
-
-#define CONDITIONAL_REGISTER_USAGE \
-{ \
- if (!TARGET_SNAKE) \
- { \
- for (i = 56; i < 88; i++) \
- fixed_regs[i] = call_used_regs[i] = 1; \
- for (i = 33; i < 88; i += 2) \
- fixed_regs[i] = call_used_regs[i] = 1; \
- } \
- if (TARGET_DISABLE_FPREGS || TARGET_SOFT_FLOAT)\
- { \
- for (i = 32; i < 88; i++) \
- fixed_regs[i] = call_used_regs[i] = 1; \
- } \
- if (flag_pic) \
- { \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- } \
-}
-
-/* Allocate the call used registers first. This should minimize
- the number of registers that need to be saved (as call used
- registers will generally not be allocated across a call).
-
- Experimentation has shown slightly better results by allocating
- FP registers first. */
-
-#define REG_ALLOC_ORDER \
- { \
- /* caller-saved fp regs. */ \
- 68, 69, 70, 71, 72, 73, 74, 75, \
- 76, 77, 78, 79, 80, 81, 82, 83, \
- 84, 85, 86, 87, \
- 40, 41, 42, 43, 44, 45, 46, 47, \
- 32, 33, 34, 35, 36, 37, 38, 39, \
- /* caller-saved general regs. */ \
- 19, 20, 21, 22, 23, 24, 25, 26, \
- 27, 28, 29, 31, 2, \
- /* callee-saved fp regs. */ \
- 48, 49, 50, 51, 52, 53, 54, 55, \
- 56, 57, 58, 59, 60, 61, 62, 63, \
- 64, 65, 66, 67, \
- /* callee-saved general regs. */ \
- 3, 4, 5, 6, 7, 8, 9, 10, \
- 11, 12, 13, 14, 15, 16, 17, 18, \
- /* special registers. */ \
- 1, 30, 0, 88}
-
-
-/* True if register is floating-point. */
-#define FP_REGNO_P(N) ((N) >= 32 && (N) <= 87)
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On the HP-PA, ordinary registers hold 32 bits worth;
- The floating point registers are 64 bits wide. Snake fp regs are 32
- bits wide */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (!TARGET_SNAKE && FP_REGNO_P (REGNO) ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the HP-PA, the cpu registers can hold any mode. We
- force this to be an even register is it cannot hold the full mode. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((REGNO) == 0 ? (MODE) == CCmode || (MODE) == CCFPmode \
- /* On 1.0 machines, don't allow wide non-fp modes in fp regs. */ \
- : !TARGET_SNAKE && FP_REGNO_P (REGNO) \
- ? GET_MODE_SIZE (MODE) <= 4 || GET_MODE_CLASS (MODE) == MODE_FLOAT \
- /* Make wide modes be in aligned registers. */ \
- : GET_MODE_SIZE (MODE) <= 4 || ((REGNO) & 1) == 0)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* The HP-PA pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 30
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 3
-
-/* Value should be nonzero if functions must have frame pointers. */
-#define FRAME_POINTER_REQUIRED \
- (current_function_calls_alloca)
-
-/* C statement to store the difference between the frame pointer
- and the stack pointer values immediately after the function prologue.
-
- Note, we always pretend that this is a leaf function because if
- it's not, there's no point in trying to eliminate the
- frame pointer. If it is a leaf function, we guessed right! */
-#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
- do {(VAR) = - compute_frame_size (get_frame_size (), 0);} while (0)
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 3
-
-/* Register in which static-chain is passed to a function. */
-/* ??? */
-#define STATIC_CHAIN_REGNUM 29
-
-/* Register which holds offset table for position-independent
- data references. */
-
-#define PIC_OFFSET_TABLE_REGNUM 19
-#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 1
-
-/* Register into which we save the PIC_OFFEST_TABLE_REGNUM so that it
- can be restore across function calls. */
-#define PIC_OFFSET_TABLE_REGNUM_SAVED 4
-
-/* SOM ABI says that objects larger than 64 bits are returned in memory. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-#define RETURN_IN_MEMORY(TYPE) \
- (int_size_in_bytes (TYPE) > 8)
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 28
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
- /* The HP-PA has four kinds of registers: general regs, 1.0 fp regs,
- 1.1 fp regs, and the high 1.1 fp regs, to which the operands of
- fmpyadd and fmpysub are restricted. */
-
-enum reg_class { NO_REGS, R1_REGS, GENERAL_REGS, FP_REGS, GENERAL_OR_FP_REGS,
- SHIFT_REGS, ALL_REGS, LIM_REG_CLASSES};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "R1_REGS", "GENERAL_REGS", "FP_REGS", \
- "GENERAL_OR_FP_REGS", "SHIFT_REGS", "ALL_REGS"}
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. Register 0, the "condition code" register,
- is in no class. */
-
-#define REG_CLASS_CONTENTS \
- {{0x00000000, 0x00000000, 0x00000000}, /* NO_REGS */ \
- {0x00000002, 0x00000000, 0x00000000}, /* R1_REGS */ \
- {0xfffffffe, 0x00000000, 0x00000000}, /* GENERAL_REGS */ \
- {0x00000000, 0xffffffff, 0x00ffffff}, /* FP_REGS */ \
- {0xfffffffe, 0xffffffff, 0x00ffffff}, /* GENERAL_OR_FP_REGS */ \
- {0x00000000, 0x00000000, 0x01000000}, /* SHIFT_REGS */ \
- {0xfffffffe, 0xffffffff, 0x01ffffff}} /* ALL_REGS */
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) == 0 ? NO_REGS \
- : (REGNO) == 1 ? R1_REGS \
- : (REGNO) < 32 ? GENERAL_REGS \
- : (REGNO) < 88 ? FP_REGS \
- : SHIFT_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-#define FP_REG_CLASS_P(CLASS) \
- ((CLASS) == FP_REGS)
-
-/* Get reg_class from a letter such as appears in the machine description. */
-/* Keep 'x' for backward compatibility with user asm. */
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'f' ? FP_REGS : \
- (C) == 'x' ? FP_REGS : \
- (C) == 'q' ? SHIFT_REGS : \
- (C) == 'a' ? R1_REGS : \
- (C) == 'Z' ? ALL_REGS : NO_REGS)
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- `I' is used for the 11 bit constants.
- `J' is used for the 14 bit constants.
- `K' is used for values that can be moved with a zdepi insn.
- `L' is used for the 5 bit constants.
- `M' is used for 0.
- `N' is used for values with the least significant 11 bits equal to zero.
- `O' is used for numbers n such that n+1 is a power of 2.
- */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? VAL_11_BITS_P (VALUE) \
- : (C) == 'J' ? VAL_14_BITS_P (VALUE) \
- : (C) == 'K' ? zdepi_cint_p (VALUE) \
- : (C) == 'L' ? VAL_5_BITS_P (VALUE) \
- : (C) == 'M' ? (VALUE) == 0 \
- : (C) == 'N' ? ((VALUE) & 0x7ff) == 0 \
- : (C) == 'O' ? (((VALUE) & ((VALUE) + 1)) == 0) \
- : (C) == 'P' ? and_mask_p (VALUE) \
- : 0)
-
-/* Similar, but for floating or large integer constants, and defining letters
- G and H. Here VALUE is the CONST_DOUBLE rtx itself.
-
- For PA, `G' is the floating-point constant zero. `H' is undefined. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \
- && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \
- : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly
- NO_REGS is returned.
-
- Avoid doing any work for the common case calls. */
-
-#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
- ((CLASS == BASE_REG_CLASS && GET_CODE (IN) == REG \
- && REGNO (IN) < FIRST_PSEUDO_REGISTER) \
- ? NO_REGS : secondary_reload_class (CLASS, MODE, IN))
-
-/* On the PA it is not possible to directly move data between
- GENERAL_REGS and FP_REGS. */
-#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
- (FP_REG_CLASS_P (CLASS1) != FP_REG_CLASS_P (CLASS2))
-
-/* Return the stack location to use for secondary memory needed reloads. */
-#define SECONDARY_MEMORY_NEEDED_RTX(MODE) \
- gen_rtx (MEM, MODE, gen_rtx (PLUS, Pmode, stack_pointer_rtx, GEN_INT (-16)))
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- (!TARGET_SNAKE && (CLASS) == FP_REGS ? 1 : \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-/* #define STACK_GROWS_DOWNWARD */
-
-/* Believe it or not. */
-#define ARGS_GROW_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-/* #define FRAME_GROWS_DOWNWARD */
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 8
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On the HP-PA, don't define this because there are no push insns. */
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* Offset of first parameter from the argument pointer register value.
- This value will be negated because the arguments grow down.
- Also note that on STACK_GROWS_UPWARD machines (such as this one)
- this is the distance from the frame pointer to the end of the first
- argument, not it's beginning. To get the real offset of the first
- argument, the size of the argument must be added.
-
- ??? Have to check on this.*/
-
-#define FIRST_PARM_OFFSET(FNDECL) -32
-
-/* Absolute value of offset from top-of-stack address to location to store the
- function parameter if it can't go in a register.
- Addresses for following parameters are computed relative to this one. */
-#define FIRST_PARM_CALLER_OFFSET(FNDECL) -32
-
-
-/* When a parameter is passed in a register, stack space is still
- allocated for it. */
-#define REG_PARM_STACK_SPACE(DECL) 16
-
-/* Define this if the above stack space is to be considered part of the
- space allocated by the caller. */
-#define OUTGOING_REG_PARM_STACK_SPACE
-
-/* Keep the stack pointer constant throughout the function.
- This is both an optimization and a necessity: longjmp
- doesn't behave itself when the stack pointer moves within
- the function! */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* The weird HPPA calling conventions require a minimum of 48 bytes on
- the stack: 16 bytes for register saves, and 32 bytes for magic.
- This is the difference between the logical top of stack and the
- actual sp. */
-#define STACK_POINTER_OFFSET -32
-
-#define STACK_DYNAMIC_OFFSET(FNDECL) \
- ((STACK_POINTER_OFFSET) - current_function_outgoing_args_size)
-
-/* Value is 1 if returning from a function call automatically
- pops the arguments described by the number-of-args field in the call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On the HP-PA the value is found in register(s) 28(-29), unless
- the mode is SF or DF. Then the value is returned in fr4 (32, ) */
-
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), ((! TARGET_SOFT_FLOAT \
- && (TYPE_MODE (VALTYPE) == SFmode || \
- TYPE_MODE (VALTYPE) == DFmode)) ? \
- 32 : 28))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, MODE, \
- (! TARGET_SOFT_FLOAT \
- && ((MODE) == SFmode || (MODE) == DFmode) ? 32 : 28))
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller. */
-
-#define FUNCTION_VALUE_REGNO_P(N) \
- ((N) == 28 || (! TARGET_SOFT_FLOAT && (N) == 32))
-
-/* 1 if N is a possible register number for function argument passing. */
-
-#define FUNCTION_ARG_REGNO_P(N) \
- (((N) >= 23 && (N) <= 26) || (! TARGET_SOFT_FLOAT && (N) >= 32 && (N) <= 39))
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the HP-PA, this is a single integer, which is a number of words
- of arguments scanned so far (including the invisible argument,
- if any, which holds the structure-value-address).
- Thus 4 or more means all following args should go on the stack. */
-
-struct hppa_args {int words, nargs_prototype, indirect; };
-
-#define CUMULATIVE_ARGS struct hppa_args
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- (CUM).words = 0, \
- (CUM).indirect = INDIRECT, \
- (CUM).nargs_prototype = (FNTYPE && TYPE_ARG_TYPES (FNTYPE) \
- ? (list_length (TYPE_ARG_TYPES (FNTYPE)) - 1 \
- + (TYPE_MODE (TREE_TYPE (FNTYPE)) == BLKmode \
- || RETURN_IN_MEMORY (TREE_TYPE (FNTYPE)))) \
- : 0)
-
-
-
-/* Similar, but when scanning the definition of a procedure. We always
- set NARGS_PROTOTYPE large so we never return a PARALLEL. */
-
-#define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,IGNORE) \
- (CUM).words = 0, \
- (CUM).indirect = 0, \
- (CUM).nargs_prototype = 1000
-
-/* Figure out the size in words of the function argument. */
-
-#define FUNCTION_ARG_SIZE(MODE, TYPE) \
- ((((MODE) != BLKmode ? GET_MODE_SIZE (MODE) : int_size_in_bytes (TYPE))+3)/4)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
-{ (CUM).nargs_prototype--; \
- ((((CUM).words & 01) && (TYPE) != 0 \
- && FUNCTION_ARG_SIZE(MODE, TYPE) > 1) \
- && (CUM).words++), \
- (CUM).words += FUNCTION_ARG_SIZE(MODE, TYPE); \
-}
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- On the HP-PA the first four words of args are normally in registers
- and the rest are pushed. But any arg that won't entirely fit in regs
- is pushed.
-
- Arguments passed in registers are either 1 or 2 words long.
-
- The caller must make a distinction between calls to explicitly named
- functions and calls through pointers to functions -- the conventions
- are different! Calls through pointers to functions only use general
- registers for the first four argument words.
-
- Of course all this is different for the portable runtime model
- HP wants everyone to use for ELF. Ugh. Here's a quick description
- of how it's supposed to work.
-
- 1) callee side remains unchanged. It expects integer args to be
- in the integer registers, float args in the float registers and
- unnamed args in integer registers.
-
- 2) caller side now depends on if the function being called has
- a prototype in scope (rather than if it's being called indirectly).
-
- 2a) If there is a prototype in scope, then arguments are passed
- according to their type (ints in integer registers, floats in float
- registers, unnamed args in integer registers.
-
- 2b) If there is no prototype in scope, then floating point arguments
- are passed in both integer and float registers. egad.
-
- FYI: The portable parameter passing conventions are almost exactly like
- the standard parameter passing conventions on the RS6000. That's why
- you'll see lots of similar code in rs6000.h. */
-
-#define FUNCTION_ARG_PADDING(MODE, TYPE) function_arg_padding ((MODE), (TYPE))
-
-/* Do not expect to understand this without reading it several times. I'm
- tempted to try and simply it, but I worry about breaking something. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- (4 >= ((CUM).words + FUNCTION_ARG_SIZE ((MODE), (TYPE))) \
- ? (!TARGET_PORTABLE_RUNTIME || (TYPE) == 0 \
- || !FLOAT_MODE_P (MODE) || TARGET_SOFT_FLOAT \
- || (CUM).nargs_prototype > 0) \
- ? gen_rtx (REG, (MODE), \
- (FUNCTION_ARG_SIZE ((MODE), (TYPE)) > 1 \
- ? (((!(CUM).indirect \
- || TARGET_PORTABLE_RUNTIME) \
- && (MODE) == DFmode \
- && ! TARGET_SOFT_FLOAT) \
- ? ((CUM).words ? 38 : 34) \
- : ((CUM).words ? 23 : 25)) \
- : (((!(CUM).indirect \
- || TARGET_PORTABLE_RUNTIME) \
- && (MODE) == SFmode \
- && ! TARGET_SOFT_FLOAT) \
- ? (32 + 2 * (CUM).words) \
- : (27 - (CUM).words - FUNCTION_ARG_SIZE ((MODE), \
- (TYPE))))))\
- /* We are calling a non-prototyped function with floating point \
- arguments using the portable conventions. */ \
- : gen_rtx (PARALLEL, (MODE), \
- gen_rtvec \
- (2, \
- gen_rtx (EXPR_LIST, VOIDmode, \
- gen_rtx (REG, (MODE), \
- (FUNCTION_ARG_SIZE ((MODE), (TYPE)) > 1 \
- ? ((CUM).words ? 38 : 34) \
- : (32 + 2 * (CUM).words))), \
- const0_rtx), \
- gen_rtx (EXPR_LIST, VOIDmode, \
- gen_rtx (REG, (MODE), \
- (FUNCTION_ARG_SIZE ((MODE), (TYPE)) > 1 \
- ? ((CUM).words ? 23 : 25) \
- : (27 - (CUM).words - \
- FUNCTION_ARG_SIZE ((MODE), \
- (TYPE))))), \
- const0_rtx))) \
- /* Pass this parameter in the stack. */ \
- : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
-
-/* If defined, a C expression that gives the alignment boundary, in
- bits, of an argument with the specified mode and type. If it is
- not defined, `PARM_BOUNDARY' is used for all arguments. */
-
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
- (((TYPE) != 0) \
- ? (((int_size_in_bytes (TYPE)) + 3) / 4) * BITS_PER_WORD \
- : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \
- ? PARM_BOUNDARY \
- : GET_MODE_ALIGNMENT(MODE)))
-
-/* Arguments larger than eight bytes are passed by invisible reference */
-
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
- ((TYPE) && int_size_in_bytes (TYPE) > 8)
-
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
- ((TYPE) && int_size_in_bytes (TYPE) > 8)
-
-
-extern struct rtx_def *hppa_compare_op0, *hppa_compare_op1;
-extern enum cmp_type hppa_branch_type;
-
-/* Output the label for a function definition. */
-#ifndef HP_FP_ARG_DESCRIPTOR_REVERSED
-#define ASM_DOUBLE_ARG_DESCRIPTORS(FILE, ARG0, ARG1) \
- do { fprintf (FILE, ",ARGW%d=FR", (ARG0)); \
- fprintf (FILE, ",ARGW%d=FU", (ARG1));} while (0)
-#else
-#define ASM_DOUBLE_ARG_DESCRIPTORS(FILE, ARG0, ARG1) \
- do { fprintf (FILE, ",ARGW%d=FU", (ARG0)); \
- fprintf (FILE, ",ARGW%d=FR", (ARG1));} while (0)
-#endif
-
-#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
-{ char *my_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (THUNK_FNDECL)); \
- char *target_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION)); \
- output_function_prologue (FILE, 0); \
- if (VAL_14_BITS_P (DELTA)) \
- fprintf (FILE, "\tb %s\n\tldo %d(%%r26),%%r26\n", target_name, DELTA); \
- else \
- fprintf (FILE, "\taddil L%%%d,%r26\n\tb %s\n\tldo R%%%d(%%r1),%%r26\n", \
- DELTA, target_name, DELTA); \
- fprintf (FILE, "\n\t.EXIT\n\t.PROCEND\n"); \
-}
-
-#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, NAME) \
- { \
- char *name; \
- STRIP_NAME_ENCODING (name, NAME); \
- if (!TARGET_PORTABLE_RUNTIME && TARGET_GAS && in_section == in_text) \
- fputs ("\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE); \
- else if (! TARGET_PORTABLE_RUNTIME && TARGET_GAS) \
- fprintf (FILE, \
- "\t.SUBSPA %s\n", name); \
- }
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { tree fntype = TREE_TYPE (TREE_TYPE (DECL)); \
- tree tree_type = TREE_TYPE (DECL); \
- tree parm; \
- int i; \
- if (TREE_PUBLIC (DECL) || TARGET_GAS) \
- { extern int current_function_varargs; \
- if (TREE_PUBLIC (DECL)) \
- { \
- fputs ("\t.EXPORT ", FILE); \
- assemble_name (FILE, NAME); \
- fputs (",ENTRY,PRIV_LEV=3", FILE); \
- } \
- else \
- { \
- fputs ("\t.PARAM ", FILE); \
- assemble_name (FILE, NAME); \
- } \
- if (TARGET_PORTABLE_RUNTIME) \
- { \
- fputs (",ARGW0=NO,ARGW1=NO,ARGW2=NO,ARGW3=NO,", FILE); \
- fputs ("RTNVAL=NO\n", FILE); \
- break; \
- } \
- for (parm = DECL_ARGUMENTS (DECL), i = 0; parm && i < 4; \
- parm = TREE_CHAIN (parm)) \
- { \
- if (TYPE_MODE (DECL_ARG_TYPE (parm)) == SFmode \
- && ! TARGET_SOFT_FLOAT) \
- fprintf (FILE, ",ARGW%d=FR", i++); \
- else if (TYPE_MODE (DECL_ARG_TYPE (parm)) == DFmode \
- && ! TARGET_SOFT_FLOAT) \
- { \
- if (i <= 2) \
- { \
- if (i == 1) i++; \
- ASM_DOUBLE_ARG_DESCRIPTORS (FILE, i++, i++); \
- } \
- else \
- break; \
- } \
- else \
- { \
- int arg_size = \
- FUNCTION_ARG_SIZE (TYPE_MODE (DECL_ARG_TYPE (parm)),\
- DECL_ARG_TYPE (parm)); \
- /* Passing structs by invisible reference uses \
- one general register. */ \
- if (arg_size > 2 \
- || TREE_ADDRESSABLE (DECL_ARG_TYPE (parm))) \
- arg_size = 1; \
- if (arg_size == 2 && i <= 2) \
- { \
- if (i == 1) i++; \
- fprintf (FILE, ",ARGW%d=GR", i++); \
- fprintf (FILE, ",ARGW%d=GR", i++); \
- } \
- else if (arg_size == 1) \
- fprintf (FILE, ",ARGW%d=GR", i++); \
- else \
- i += arg_size; \
- } \
- } \
- /* anonymous args */ \
- if ((TYPE_ARG_TYPES (tree_type) != 0 \
- && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (tree_type)))\
- != void_type_node)) \
- || current_function_varargs) \
- { \
- for (; i < 4; i++) \
- fprintf (FILE, ",ARGW%d=GR", i); \
- } \
- if (TYPE_MODE (fntype) == DFmode && ! TARGET_SOFT_FLOAT) \
- fputs (",RTNVAL=FR", FILE); \
- else if (TYPE_MODE (fntype) == SFmode && ! TARGET_SOFT_FLOAT) \
- fputs (",RTNVAL=FU", FILE); \
- else if (fntype != void_type_node) \
- fputs (",RTNVAL=GR", FILE); \
- fputs ("\n", FILE); \
- }} while (0)
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-/* On HP-PA, move-double insns between fpu and cpu need an 8-byte block
- of memory. If any fpu reg is used in the function, we allocate
- such a block here, at the bottom of the frame, just in case it's needed.
-
- If this function is a leaf procedure, then we may choose not
- to do a "save" insn. The decision about whether or not
- to do this is made in regclass.c. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
- output_function_prologue (FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry.
-
- Because HPUX _mcount is so different, we actually emit the
- profiling code in function_prologue. This just stores LABELNO for
- that. */
-
-#define PROFILE_BEFORE_PROLOGUE
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-{ extern int hp_profile_labelno; hp_profile_labelno = (LABELNO);}
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-extern int may_call_alloca;
-extern int current_function_pretend_args_size;
-
-#define EXIT_IGNORE_STACK \
- (get_frame_size () != 0 \
- || current_function_calls_alloca || current_function_outgoing_args_size)
-
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-/* This declaration is needed due to traditional/ANSI
- incompatibilities which cannot be #ifdefed away
- because they occur inside of macros. Sigh. */
-extern union tree_node *current_function_decl;
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
- output_function_epilogue (FILE, SIZE)
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.\
-
- The trampoline sets the static chain pointer to STATIC_CHAIN_REGNUM
- and then branches to the specified routine.
-
- This code template is copied from text segment to stack location
- and then patched with INITIALIZE_TRAMPOLINE to contain
- valid values, and then entered as a subroutine.
-
- It is best to keep this as small as possible to avoid having to
- flush multiple lines in the cache. */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
- { \
- fputs ("\tldw 36(0,%r22),%r21\n", FILE); \
- fputs ("\tbb,>=,n %r21,30,.+16\n", FILE); \
- fputs ("\tdepi 0,31,2,%r21\n", FILE); \
- fputs ("\tldw 4(0,%r21),%r19\n", FILE); \
- fputs ("\tldw 0(0,%r21),%r21\n", FILE); \
- fputs ("\tldsid (0,%r21),%r1\n", FILE); \
- fputs ("\tmtsp %r1,%sr0\n", FILE); \
- fputs ("\tbe 0(%sr0,%r21)\n", FILE); \
- fputs ("\tldw 40(0,%r22),%r29\n", FILE); \
- fputs ("\t.word 0\n", FILE); \
- fputs ("\t.word 0\n", FILE); \
- }
-
-/* Length in units of the trampoline for entering a nested function.
-
- Flush the cache entries corresponding to the first and last addresses
- of the trampoline. This is necessary as the trampoline may cross two
- cache lines.
-
- If the code part of the trampoline ever grows to > 32 bytes, then it
- will become necessary to hack on the cacheflush pattern in pa.md. */
-
-#define TRAMPOLINE_SIZE (11 * 4)
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function.
-
- Move the function address to the trampoline template at offset 12.
- Move the static chain value to trampoline template at offset 16. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- rtx start_addr, end_addr; \
- \
- start_addr = memory_address (Pmode, plus_constant ((TRAMP), 36)); \
- emit_move_insn (gen_rtx (MEM, Pmode, start_addr), (FNADDR)); \
- start_addr = memory_address (Pmode, plus_constant ((TRAMP), 40)); \
- emit_move_insn (gen_rtx (MEM, Pmode, start_addr), (CXT)); \
- /* fdc and fic only use registers for the address to flush, \
- they do not accept integer displacements. */ \
- start_addr = force_reg (SImode, (TRAMP)); \
- end_addr = force_reg (SImode, plus_constant ((TRAMP), 32)); \
- emit_insn (gen_dcacheflush (start_addr, end_addr)); \
- end_addr = force_reg (SImode, plus_constant (start_addr, 32)); \
- emit_insn (gen_icacheflush (start_addr, end_addr, start_addr, \
- gen_reg_rtx (SImode), gen_reg_rtx (SImode)));\
-}
-
-/* Emit code for a call to builtin_saveregs. We must emit USE insns which
- reference the 4 integer arg registers and 4 fp arg registers.
- Ordinarily they are not call used registers, but they are for
- _builtin_saveregs, so we must make this explicit. */
-
-extern struct rtx_def *hppa_builtin_saveregs ();
-#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) hppa_builtin_saveregs (ARGLIST)
-
-
-/* Addressing modes, and classification of registers for them. */
-
-#define HAVE_POST_INCREMENT
-#define HAVE_POST_DECREMENT
-
-#define HAVE_PRE_DECREMENT
-#define HAVE_PRE_INCREMENT
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
- ((REGNO) && ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32))
-#define REGNO_OK_FOR_BASE_P(REGNO) \
- ((REGNO) && ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32))
-#define REGNO_OK_FOR_FP_P(REGNO) \
- (FP_REGNO_P (REGNO) || FP_REGNO_P (reg_renumber[REGNO]))
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-
- These macros are specific to the the HP-PA, and may be used only
- in code for printing assembler insns and in conditions for
- define_optimization. */
-
-/* 1 if X is an fp register. */
-
-#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address except
- for symbolic addresses. We get better CSE by rejecting them
- here and allowing hppa_legitimize_address to break them up. We
- use most of the constants accepted by CONSTANT_P, except CONST_DOUBLE. */
-
-#define CONSTANT_ADDRESS_P(X) \
- ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH) \
- && (reload_in_progress || reload_completed || ! symbolic_expression_p (X)))
-
-/* Include all constant integers and constant doubles, but not
- floating-point, except for floating-point zero. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- ((GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
- || (X) == CONST0_RTX (GET_MODE (X))) \
- && !(flag_pic && function_label_operand (X, VOIDmode)))
-
-/* Subroutine for EXTRA_CONSTRAINT.
-
- Return 1 iff OP is a pseudo which did not get a hard register and
- we are running the reload pass. */
-
-#define IS_RELOADING_PSEUDO_P(OP) \
- ((reload_in_progress \
- && GET_CODE (OP) == REG \
- && REGNO (OP) >= FIRST_PSEUDO_REGISTER \
- && reg_renumber [REGNO (OP)] < 0))
-
-/* Optional extra constraints for this machine. Borrowed from sparc.h.
-
- For the HPPA, `Q' means that this is a memory operand but not a
- symbolic memory operand. Note that an unassigned pseudo register
- is such a memory operand. Needed because reload will generate
- these things in insns and then not re-recognize the insns, causing
- constrain_operands to fail.
-
- `R' is unused.
-
- `S' is unused.
-
- `T' is for fp loads and stores. */
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' ? \
- (IS_RELOADING_PSEUDO_P (OP) \
- || (GET_CODE (OP) == MEM \
- && (memory_address_p (GET_MODE (OP), XEXP (OP, 0))\
- || reload_in_progress) \
- && ! symbolic_memory_operand (OP, VOIDmode) \
- && !(GET_CODE (XEXP (OP, 0)) == PLUS \
- && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT\
- || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT))))\
- : ((C) == 'R' ? \
- (GET_CODE (OP) == MEM \
- && GET_CODE (XEXP (OP, 0)) == PLUS \
- && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT \
- || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT) \
- && (move_operand (OP, GET_MODE (OP)) \
- || memory_address_p (GET_MODE (OP), XEXP (OP, 0))\
- || reload_in_progress)) \
- : ((C) == 'T' ? \
- (GET_CODE (OP) == MEM \
- /* Using DFmode forces only short displacements \
- to be recognized as valid in reg+d addresses. */\
- && memory_address_p (DFmode, XEXP (OP, 0)) \
- && !(GET_CODE (XEXP (OP, 0)) == PLUS \
- && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT\
- || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT))) : 0)))
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) \
-(REGNO (X) && (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER))
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
-(REGNO (X) && (REGNO (X) < 32 || REGNO (X) >= FIRST_PSEUDO_REGISTER))
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On the HP-PA, the actual legitimate addresses must be
- REG+REG, REG+(REG*SCALE) or REG+SMALLINT.
- But we can treat a SYMBOL_REF as legitimate if it is part of this
- function's constant-pool, because such addresses can actually
- be output as REG+SMALLINT.
-
- Note we only allow 5 bit immediates for access to a constant address;
- doing so avoids losing for loading/storing a FP register at an address
- which will not fit in 5 bits. */
-
-#define VAL_5_BITS_P(X) ((unsigned)(X) + 0x10 < 0x20)
-#define INT_5_BITS(X) VAL_5_BITS_P (INTVAL (X))
-
-#define VAL_U5_BITS_P(X) ((unsigned)(X) < 0x20)
-#define INT_U5_BITS(X) VAL_U5_BITS_P (INTVAL (X))
-
-#define VAL_11_BITS_P(X) ((unsigned)(X) + 0x400 < 0x800)
-#define INT_11_BITS(X) VAL_11_BITS_P (INTVAL (X))
-
-#define VAL_14_BITS_P(X) ((unsigned)(X) + 0x2000 < 0x4000)
-#define INT_14_BITS(X) VAL_14_BITS_P (INTVAL (X))
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ \
- if ((REG_P (X) && REG_OK_FOR_BASE_P (X)) \
- || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_DEC \
- || GET_CODE (X) == PRE_INC || GET_CODE (X) == POST_INC) \
- && REG_P (XEXP (X, 0)) \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)))) \
- goto ADDR; \
- else if (GET_CODE (X) == PLUS) \
- { \
- rtx base = 0, index; \
- if (flag_pic && XEXP (X, 0) == pic_offset_table_rtx)\
- { \
- if (GET_CODE (XEXP (X, 1)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
- goto ADDR; \
- else if (flag_pic == 1 \
- && GET_CODE (XEXP (X, 1)) == SYMBOL_REF)\
- goto ADDR; \
- } \
- else if (REG_P (XEXP (X, 0)) \
- && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
- base = XEXP (X, 0), index = XEXP (X, 1); \
- else if (REG_P (XEXP (X, 1)) \
- && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
- base = XEXP (X, 1), index = XEXP (X, 0); \
- if (base != 0) \
- if (GET_CODE (index) == CONST_INT \
- && ((INT_14_BITS (index) \
- && (TARGET_SOFT_FLOAT \
- || ((MODE) != SFmode && (MODE) != DFmode))) \
- || INT_5_BITS (index))) \
- goto ADDR; \
- if (! TARGET_SOFT_FLOAT \
- && base \
- && (mode == SFmode || mode == DFmode) \
- && GET_CODE (index) == MULT \
- && GET_CODE (XEXP (index, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (index, 0)) \
- && GET_CODE (XEXP (index, 1)) == CONST_INT \
- && INTVAL (XEXP (index, 1)) == (mode == SFmode ? 4 : 8))\
- goto ADDR; \
- } \
- else if (GET_CODE (X) == LO_SUM \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && CONSTANT_P (XEXP (X, 1)) \
- && (TARGET_SOFT_FLOAT \
- || ((MODE) != SFmode \
- && (MODE) != DFmode))) \
- goto ADDR; \
- else if (GET_CODE (X) == LO_SUM \
- && GET_CODE (XEXP (X, 0)) == SUBREG \
- && GET_CODE (SUBREG_REG (XEXP (X, 0))) == REG\
- && REG_OK_FOR_BASE_P (SUBREG_REG (XEXP (X, 0)))\
- && CONSTANT_P (XEXP (X, 1)) \
- && (TARGET_SOFT_FLOAT \
- || ((MODE) != SFmode \
- && (MODE) != DFmode))) \
- goto ADDR; \
- else if (GET_CODE (X) == LABEL_REF \
- || (GET_CODE (X) == CONST_INT \
- && INT_5_BITS (X))) \
- goto ADDR; \
- /* Needed for -fPIC */ \
- else if (GET_CODE (X) == LO_SUM \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && GET_CODE (XEXP (X, 1)) == UNSPEC) \
- goto ADDR; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-extern struct rtx_def *hppa_legitimize_address ();
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-{ rtx orig_x = (X); \
- (X) = hppa_legitimize_address (X, OLDX, MODE); \
- if ((X) != orig_x && memory_address_p (MODE, X)) \
- goto WIN; }
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- if (GET_CODE (ADDR) == PRE_DEC \
- || GET_CODE (ADDR) == POST_DEC \
- || GET_CODE (ADDR) == PRE_INC \
- || GET_CODE (ADDR) == POST_INC) \
- goto LABEL
-
-/* Define this macro if references to a symbol must be treated
- differently depending on something about the variable or
- function named by the symbol (such as what section it is in).
-
- The macro definition, if any, is executed immediately after the
- rtl for DECL or other node is created.
- The value of the rtl will be a `mem' whose address is a
- `symbol_ref'.
-
- The usual thing for this macro to do is to a flag in the
- `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
- name string in the `symbol_ref' (if one bit is not enough
- information).
-
- On the HP-PA we use this to indicate if a symbol is in text or
- data space. Also, function labels need special treatment. */
-
-#define TEXT_SPACE_P(DECL)\
- (TREE_CODE (DECL) == FUNCTION_DECL \
- || (TREE_CODE (DECL) == VAR_DECL \
- && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL) \
- && (! DECL_INITIAL (DECL) || ! reloc_needed (DECL_INITIAL (DECL))) \
- && !flag_pic) \
- || (*tree_code_type[(int) TREE_CODE (DECL)] == 'c' \
- && !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings)))
-
-#define FUNCTION_NAME_P(NAME) \
-(*(NAME) == '@' || (*(NAME) == '*' && *((NAME) + 1) == '@'))
-
-#define ENCODE_SECTION_INFO(DECL)\
-do \
- { if (TEXT_SPACE_P (DECL)) \
- { rtx _rtl; \
- if (TREE_CODE (DECL) == FUNCTION_DECL \
- || TREE_CODE (DECL) == VAR_DECL) \
- _rtl = DECL_RTL (DECL); \
- else \
- _rtl = TREE_CST_RTL (DECL); \
- SYMBOL_REF_FLAG (XEXP (_rtl, 0)) = 1; \
- if (TREE_CODE (DECL) == FUNCTION_DECL) \
- hppa_encode_label (XEXP (DECL_RTL (DECL), 0), 0);\
- } \
- } \
-while (0)
-
-/* Store the user-specified part of SYMBOL_NAME in VAR.
- This is sort of inverse to ENCODE_SECTION_INFO. */
-
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
- (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' ? \
- 1 + (SYMBOL_NAME)[1] == '@'\
- : (SYMBOL_NAME)[0] == '@'))
-
-/* On hpux10, the linker will give an error if we have a reference
- in the read-only data section to a symbol defined in a shared
- library. Therefore, expressions that might require a reloc can
- not be placed in the read-only data section. */
-#define SELECT_SECTION(EXP,RELOC) \
- if (TREE_CODE (EXP) == VAR_DECL \
- && TREE_READONLY (EXP) \
- && !TREE_THIS_VOLATILE (EXP) \
- && DECL_INITIAL (EXP) \
- && (DECL_INITIAL (EXP) == error_mark_node \
- || TREE_CONSTANT (DECL_INITIAL (EXP))) \
- && !reloc) \
- readonly_data_section (); \
- else if (TREE_CODE_CLASS (TREE_CODE (EXP)) == 'c' \
- && !(TREE_CODE (EXP) == STRING_CST && flag_writable_strings) \
- && !reloc) \
- readonly_data_section (); \
- else \
- data_section ();
-
-/* Arghh. This is used for stuff in the constant pool; this may include
- function addresses on the PA, which during PIC code generation must
- reside in the data space. Unfortunately, there's no way to determine
- if a particular label in the constant pool refers to a function address.
- So just force everything into the data space during PIC generation. */
-#define SELECT_RTX_SECTION(RTX,MODE) \
- if (flag_pic) \
- data_section (); \
- else \
- readonly_data_section ();
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE DImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-#define CASE_DROPS_THROUGH
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 8
-
-/* Higher than the default as we prefer to use simple move insns
- (better scheduling and delay slot filling) and because our
- built-in block move is really a 2X unrolled loop. */
-#define MOVE_RATIO 4
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 1
-
-/* Do not break .stabs pseudos into continuations. */
-#define DBX_CONTIN_LENGTH 4000
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE 1
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* Add any extra modes needed to represent the condition code.
-
- HPPA floating comparisons produce condition codes. */
-#define EXTRA_CC_MODES CCFPmode
-
-/* Define the names for the modes specified above. */
-#define EXTRA_CC_NAMES "CCFP"
-
-/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
- return the mode to be used for the comparison. For floating-point, CCFPmode
- should be used. CC_NOOVmode should be used when the first operand is a
- PLUS, MINUS, or NEG. CCmode should be used when no special processing is
- needed. */
-#define SELECT_CC_MODE(OP,X,Y) \
- (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode : CCmode) \
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE SImode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-#define NO_FUNCTION_CSE
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) == 0) return 0; \
- if (INT_14_BITS (RTX)) return 1; \
- case HIGH: \
- return 2; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 4; \
- case CONST_DOUBLE: \
- if (RTX == CONST0_RTX (DFmode) || RTX == CONST0_RTX (SFmode)\
- && OUTER_CODE != SET) \
- return 0; \
- else \
- return 8;
-
-#define ADDRESS_COST(RTX) \
- (GET_CODE (RTX) == REG ? 1 : hppa_address_cost (RTX))
-
-/* Compute extra cost of moving data between one register class
- and another.
-
- Make moves from SAR so expensive they should never happen. We used to
- have 0xffff here, but that generates overflow in rare cases.
-
- Copies involving a FP register and a non-FP register are relatively
- expensive because they must go through memory.
-
- Other copies are reasonably cheap. */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- (CLASS1 == SHIFT_REGS ? 0x100 \
- : FP_REG_CLASS_P (CLASS1) && ! FP_REG_CLASS_P (CLASS2) ? 16 \
- : FP_REG_CLASS_P (CLASS2) && ! FP_REG_CLASS_P (CLASS1) ? 16 \
- : 2)
-
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. The purpose for the cost of MULT is to encourage
- `synth_mult' to find a synthetic multiply when reasonable. */
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MULT: \
- if (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
- return COSTS_N_INSNS (3); \
- return (TARGET_SNAKE && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT) \
- ? COSTS_N_INSNS (8) : COSTS_N_INSNS (20); \
- case DIV: \
- if (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
- return COSTS_N_INSNS (14); \
- case UDIV: \
- case MOD: \
- case UMOD: \
- return COSTS_N_INSNS (60); \
- case PLUS: /* this includes shNadd insns */ \
- case MINUS: \
- if (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
- return COSTS_N_INSNS (3); \
- return COSTS_N_INSNS (1); \
- case ASHIFT: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- return COSTS_N_INSNS (1);
-
-/* Adjust the cost of dependencies. */
-
-#define ADJUST_COST(INSN,LINK,DEP,COST) \
- (COST) = pa_adjust_cost (INSN, LINK, DEP, COST)
-
-/* Adjust scheduling priorities. We use this to try and keep addil
- and the next use of %r1 close together. */
-#define ADJUST_PRIORITY(PREV) \
- { \
- rtx set = single_set (PREV); \
- rtx src, dest; \
- if (set) \
- { \
- src = SET_SRC (set); \
- dest = SET_DEST (set); \
- if (GET_CODE (src) == LO_SUM \
- && symbolic_operand (XEXP (src, 1), VOIDmode) \
- && ! read_only_operand (XEXP (src, 1), VOIDmode)) \
- INSN_PRIORITY (PREV) >>= 3; \
- else if (GET_CODE (src) == MEM \
- && GET_CODE (XEXP (src, 0)) == LO_SUM \
- && symbolic_operand (XEXP (XEXP (src, 0), 1), VOIDmode)\
- && ! read_only_operand (XEXP (XEXP (src, 0), 1), VOIDmode))\
- INSN_PRIORITY (PREV) >>= 1; \
- else if (GET_CODE (dest) == MEM \
- && GET_CODE (XEXP (dest, 0)) == LO_SUM \
- && symbolic_operand (XEXP (XEXP (dest, 0), 1), VOIDmode)\
- && ! read_only_operand (XEXP (XEXP (dest, 0), 1), VOIDmode))\
- INSN_PRIORITY (PREV) >>= 3; \
- } \
- }
-
-/* Handling the special cases is going to get too complicated for a macro,
- just call `pa_adjust_insn_length' to do the real work. */
-#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
- LENGTH += pa_adjust_insn_length (INSN, LENGTH);
-
-/* Enable a bug fix. (This is for extra caution.) */
-#define SHORTEN_WITH_ADJUST_INSN_LENGTH
-
-/* Millicode insns are actually function calls with some special
- constraints on arguments and register usage.
-
- Millicode calls always expect their arguments in the integer argument
- registers, and always return their result in %r29 (ret1). They
- are expected to clobber their arguments, %r1, %r29, and %r31 and
- nothing else.
-
- These macros tell reorg that the references to arguments and
- register clobbers for millicode calls do not appear to happen
- until after the millicode call. This allows reorg to put insns
- which set the argument registers into the delay slot of the millicode
- call -- thus they act more like traditional CALL_INSNs.
-
- get_attr_type will try to recognize the given insn, so make sure to
- filter out things it will not accept -- SEQUENCE, USE and CLOBBER insns
- in particular. */
-#define INSN_SETS_ARE_DELAYED(X) \
- ((GET_CODE (X) == INSN \
- && GET_CODE (PATTERN (X)) != SEQUENCE \
- && GET_CODE (PATTERN (X)) != USE \
- && GET_CODE (PATTERN (X)) != CLOBBER \
- && get_attr_type (X) == TYPE_MILLI))
-
-#define INSN_REFERENCES_ARE_DELAYED(X) \
- ((GET_CODE (X) == INSN \
- && GET_CODE (PATTERN (X)) != SEQUENCE \
- && GET_CODE (PATTERN (X)) != USE \
- && GET_CODE (PATTERN (X)) != CLOBBER \
- && get_attr_type (X) == TYPE_MILLI))
-
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) \
-do { fputs ("\t.SPACE $PRIVATE$\n\
-\t.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31\n\
-\t.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82\n\
-\t.SPACE $TEXT$\n\
-\t.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44\n\
-\t.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n\
-\t.IMPORT $global$,DATA\n\
-\t.IMPORT $$dyncall,MILLICODE\n", FILE);\
- if (profile_flag)\
- fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
- if (write_symbols != NO_DEBUG) \
- output_file_directive ((FILE), main_input_filename); \
- } while (0)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* We don't yet know how to identify GCC to HP-PA machines. */
-#define ASM_IDENTIFY_GCC(FILE) fputs ("; gcc_compiled.:\n", FILE)
-
-/* Output before code. */
-
-/* Supposedly the assembler rejects the command if there is no tab! */
-#define TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$\n"
-
-/* Output before read-only data. */
-
-/* Supposedly the assembler rejects the command if there is no tab! */
-#define READONLY_DATA_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $LIT$\n"
-
-#define READONLY_DATA_SECTION readonly_data
-
-/* Output before writable data. */
-
-/* Supposedly the assembler rejects the command if there is no tab! */
-#define DATA_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $DATA$\n"
-
-/* Output before uninitialized data. */
-
-#define BSS_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $BSS$\n"
-
-/* Define the .bss section for ASM_OUTPUT_LOCAL to use. */
-
-#ifndef CTORS_SECTION_FUNCTION
-#define EXTRA_SECTIONS in_readonly_data
-#define CTORS_SECTION_FUNCTION
-#define DTORS_SECTION_FUNCTION
-#else
-#define EXTRA_SECTIONS in_readonly_data, in_ctors, in_dtors
-#endif
-
-/* Switch into a generic section.
- This is currently only used to support section attributes.
-
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- { \
- fputs ("\t.SPACE $TEXT$\n", FILE); \
- fprintf (FILE, \
- "\t.SUBSPA %s%s%s,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY,SORT=24\n",\
- TARGET_GAS ? "" : "$", NAME, TARGET_GAS ? "" : "$"); \
- } \
- else if (DECL && TREE_READONLY (DECL)) \
- { \
- fputs ("\t.SPACE $TEXT$\n", FILE); \
- fprintf (FILE, \
- "\t.SUBSPA %s%s%s,QUAD=0,ALIGN=8,ACCESS=44,SORT=16\n", \
- TARGET_GAS ? "" : "$", NAME, TARGET_GAS ? "" : "$"); \
- } \
- else \
- { \
- fputs ("\t.SPACE $PRIVATE$\n", FILE); \
- fprintf (FILE, \
- "\t.SUBSPA %s,QUAD=1,ALIGN=8,ACCESS=31,SORT=16\n", \
- TARGET_GAS ? "" : "$", NAME, TARGET_GAS ? "" : "$"); \
- }
-
-/* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups
- which reference data within the $TEXT$ space (for example constant
- strings in the $LIT$ subspace).
-
- The assemblers (GAS and HP as) both have problems with handling
- the difference of two symbols which is the other correct way to
- reference constant data during PIC code generation.
-
- So, there's no way to reference constant data which is in the
- $TEXT$ space during PIC generation. Instead place all constant
- data into the $PRIVATE$ subspace (this reduces sharing, but it
- works correctly). */
-
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-readonly_data () \
-{ \
- if (in_section != in_readonly_data) \
- { \
- if (flag_pic) \
- fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP); \
- else \
- fprintf (asm_out_file, "%s\n", READONLY_DATA_ASM_OP); \
- in_section = in_readonly_data; \
- } \
-} \
-CTORS_SECTION_FUNCTION \
-DTORS_SECTION_FUNCTION
-
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7", \
- "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", \
- "%r16", "%r17", "%r18", "%r19", "%r20", "%r21", "%r22", "%r23", \
- "%r24", "%r25", "%r26", "%r27", "%r28", "%r29", "%r30", "%r31", \
- "%fr4", "%fr4R", "%fr5", "%fr5R", "%fr6", "%fr6R", "%fr7", "%fr7R", \
- "%fr8", "%fr8R", "%fr9", "%fr9R", "%fr10", "%fr10R", "%fr11", "%fr11R", \
- "%fr12", "%fr12R", "%fr13", "%fr13R", "%fr14", "%fr14R", "%fr15", "%fr15R", \
- "%fr16", "%fr16R", "%fr17", "%fr17R", "%fr18", "%fr18R", "%fr19", "%fr19R", \
- "%fr20", "%fr20R", "%fr21", "%fr21R", "%fr22", "%fr22R", "%fr23", "%fr23R", \
- "%fr24", "%fr24R", "%fr25", "%fr25R", "%fr26", "%fr26R", "%fr27", "%fr27R", \
- "%fr28", "%fr28R", "%fr29", "%fr29R", "%fr30", "%fr30R", "%fr31", "%fr31R", \
- "SAR"}
-
-#define ADDITIONAL_REGISTER_NAMES \
-{{"%fr4L",32}, {"%fr5L",34}, {"%fr6L",36}, {"%fr7L",38}, \
- {"%fr8L",40}, {"%fr9L",42}, {"%fr10L",44}, {"%fr11L",46}, \
- {"%fr12L",48}, {"%fr13L",50}, {"%fr14L",52}, {"%fr15L",54}, \
- {"%fr16L",56}, {"%fr17L",58}, {"%fr18L",60}, {"%fr19L",62}, \
- {"%fr20L",64}, {"%fr21L",66}, {"%fr22L",68}, {"%fr23L",70}, \
- {"%fr24L",72}, {"%fr25L",74}, {"%fr26L",76}, {"%fr27L",78}, \
- {"%fr28L",80}, {"%fr29L",82}, {"%fr30L",84}, {"%fr31R",86}, \
- {"%cr11",88}}
-
-/* How to renumber registers for dbx and gdb.
-
- Registers 0 - 31 remain unchanged.
-
- Registers 32 - 87 are mapped to 72 - 127
-
- Register 88 is mapped to 32. */
-
-#define DBX_REGISTER_NUMBER(REGNO) \
- ((REGNO) <= 31 ? (REGNO) : \
- ((REGNO) > 31 && (REGNO) <= 87 ? (REGNO) + 40 : 32))
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE, NAME) \
- do { assemble_name (FILE, NAME); \
- fputc ('\n', FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files.
-
- We call assemble_name, which in turn sets TREE_SYMBOL_REFERENCED. This
- macro will restore the original value of TREE_SYMBOL_REFERENCED to avoid
- placing useless function definitions in the output file. */
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
- do { int save_referenced; \
- save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)); \
- fputs ("\t.IMPORT ", FILE); \
- assemble_name (FILE, NAME); \
- if (FUNCTION_NAME_P (NAME)) \
- fputs (",CODE\n", FILE); \
- else \
- fputs (",DATA\n", FILE); \
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = save_referenced; \
- } while (0)
-
-/* The bogus HP assembler requires ALL external references to be
- "imported", even library calls. They look a bit different, so
- here's this macro.
-
- Also note not all libcall names are passed to ENCODE_SECTION_INFO
- (__main for example). To make sure all libcall names have section
- info recorded in them, we do it here. */
-
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, RTL) \
- do { fputs ("\t.IMPORT ", FILE); \
- if (!function_label_operand (RTL, VOIDmode)) \
- hppa_encode_label (RTL, 1); \
- assemble_name (FILE, XSTR ((RTL), 0)); \
- fputs (",CODE\n", FILE); \
- } while (0)
-
-#define ASM_GLOBALIZE_LABEL(FILE, NAME) \
- do { \
- /* We only handle DATA objects here, functions are globalized in \
- ASM_DECLARE_FUNCTION_NAME. */ \
- if (! FUNCTION_NAME_P (NAME)) \
- { \
- fputs ("\t.EXPORT ", FILE); \
- assemble_name (FILE, NAME); \
- fputs (",DATA\n", FILE); \
- } \
- } while (0)
-
-/* This is how to output a reference to a user-level label named NAME.
- `assemble_name' uses this. */
-
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- fprintf ((FILE), "%s", (NAME) + (FUNCTION_NAME_P (NAME) ? 1 : 0))
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- {fprintf (FILE, "%c$%s%04d\n", (PREFIX)[0], (PREFIX) + 1, NUM);}
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%c$%s%04d", (PREFIX)[0], (PREFIX) + 1, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- do { long l[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
- fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", l[0], l[1]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { long l; \
- REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
- fprintf (FILE, "\t.word 0x%lx\n", l); \
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant.
-
- This is made more complicated by the fact that functions must be
- prefixed by a P% as well as code label references for the exception
- table -- otherwise the linker chokes. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-{ fputs ("\t.word ", FILE); \
- if (function_label_operand (VALUE, VOIDmode) \
- && !TARGET_PORTABLE_RUNTIME) \
- fputs ("P%", FILE); \
- output_addr_const (FILE, (VALUE)); \
- fputs ("\n", FILE);}
-
-/* Likewise for `short' and `char' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fputs ("\t.half ", FILE), \
- output_addr_const (FILE, (VALUE)), \
- fputs ("\n", FILE))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fputs ("\t.byte ", FILE), \
- output_addr_const (FILE, (VALUE)), \
- fputs ("\n", FILE))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-#define ASM_OUTPUT_ASCII(FILE, P, SIZE) \
- output_ascii ((FILE), (P), (SIZE))
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO)
-#define ASM_OUTPUT_REG_POP(FILE,REGNO)
-/* This is how to output an element of a case-vector that is absolute.
- Note that this method makes filling these branch delay slots
- impossible. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
-
-/* Jump tables are executable code and live in the TEXT section on the PA. */
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* This is how to output an element of a case-vector that is relative.
- This must be defined correctly as it is used when generating PIC code.
-
- I believe it safe to use the same definition as ASM_OUTPUT_ADDR_VEC_ELT
- on the PA since ASM_OUTPUT_ADDR_VEC_ELT uses pc-relative jump instructions
- rather than a table of absolute addresses. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\tb L$%04d\n\tnop\n", VALUE)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf (FILE, "\t.align %d\n", (1<<(LOG)))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.blockz %d\n", (SIZE))
-
-/* This says how to output an assembler line to define a global common symbol
- with size SIZE (in bytes) and alignment ALIGN (in bits). */
-
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNED) \
-{ bss_section (); \
- assemble_name ((FILE), (NAME)); \
- fputs ("\t.comm ", (FILE)); \
- fprintf ((FILE), "%d\n", MAX ((SIZE), ((ALIGNED) / BITS_PER_UNIT)));}
-
-/* This says how to output an assembler line to define a local common symbol
- with size SIZE (in bytes) and alignment ALIGN (in bits). */
-
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNED) \
-{ bss_section (); \
- fprintf ((FILE), "\t.align %d\n", ((ALIGNED) / BITS_PER_UNIT)); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), "\n\t.block %d\n", (SIZE));}
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
- sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* All HP assemblers use "!" to separate logical lines. */
-#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '!')
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
- ((CHAR) == '@' || (CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^')
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
-
- On the HP-PA, the CODE can be `r', meaning this is a register-only operand
- and an immediate zero should be represented as `r0'.
-
- Several % codes are defined:
- O an operation
- C compare conditions
- N extract conditions
- M modifier to handle preincrement addressing for memory refs.
- F modifier to handle preincrement addressing for fp memory refs */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx addr = ADDR; \
- register rtx base; \
- int offset; \
- switch (GET_CODE (addr)) \
- { \
- case REG: \
- fprintf (FILE, "0(0,%s)", reg_names [REGNO (addr)]); \
- break; \
- case PLUS: \
- if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
- offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1); \
- else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
- offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0); \
- else \
- abort (); \
- fprintf (FILE, "%d(0,%s)", offset, reg_names [REGNO (base)]); \
- break; \
- case LO_SUM: \
- if (!symbolic_operand (XEXP (addr, 1))) \
- fputs ("R'", FILE); \
- else if (flag_pic == 0) \
- fputs ("RR'", FILE); \
- else if (flag_pic == 1) \
- abort (); \
- else if (flag_pic == 2) \
- fputs ("RT'", FILE); \
- output_global_address (FILE, XEXP (addr, 1), 0); \
- fputs ("(", FILE); \
- output_operand (XEXP (addr, 0), 0); \
- fputs (")", FILE); \
- break; \
- case CONST_INT: \
- fprintf (FILE, "%d(0,0)", INTVAL (addr)); \
- break; \
- default: \
- output_addr_const (FILE, addr); \
- }}
-
-
-/* Define functions in pa.c and used in insn-output.c. */
-
-extern char *output_and ();
-extern char *output_ior ();
-extern char *output_move_double ();
-extern char *output_fp_move_double ();
-extern char *output_block_move ();
-extern char *output_cbranch ();
-extern char *output_bb ();
-extern char *output_bvb ();
-extern char *output_dbra ();
-extern char *output_movb ();
-extern char *output_parallel_movb ();
-extern char *output_parallel_addb ();
-extern char *output_return ();
-extern char *output_call ();
-extern char *output_millicode_call ();
-extern char *output_mul_insn ();
-extern char *output_div_insn ();
-extern char *output_mod_insn ();
-extern char *singlemove_string ();
-extern void output_arg_descriptor ();
-extern void output_global_address ();
-extern struct rtx_def *legitimize_pic_address ();
-extern struct rtx_def *gen_cmp_fp ();
-extern void hppa_encode_label ();
-
-/* Declare functions defined in pa.c and used in templates. */
-
-extern struct rtx_def *return_addr_rtx ();
-
-/* We want __gcc_plt_call to appear in every program built by
- gcc, so we make a reference to it out of __main.
- We use the asm statement to fool the optimizer into not
- removing the dead (but important) initialization of
- REFERENCE. */
-
-#define DO_GLOBAL_DTORS_BODY \
-do { \
- extern void __gcc_plt_call (); \
- void (*reference)() = &__gcc_plt_call; \
- func_ptr *p; \
- __asm__ ("" : : "r" (reference)); \
- for (p = __DTOR_LIST__ + 1; *p; ) \
- (*p++) (); \
-} while (0)
-
-/* Find the return address associated with the frame given by
- FRAMEADDR. */
-#define RETURN_ADDR_RTX(COUNT, FRAMEADDR) \
- (return_addr_rtx (COUNT, FRAMEADDR))
-
-/* Used to mask out junk bits from the return address, such as
- processor state, interrupt status, condition codes and the like. */
-#define MASK_RETURN_ADDR \
- /* The privilege level is in the two low order bits, mask em out \
- of the return address. */ \
- (GEN_INT (0xfffffffc))
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
deleted file mode 100644
index b89dbb76091..00000000000
--- a/gcc/config/pa/pa.md
+++ /dev/null
@@ -1,5158 +0,0 @@
-;;- Machine description for HP PA-RISC architecture for GNU C compiler
-;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997
-;; Free Software Foundation, Inc.
-;; Contributed by the Center for Software Science at the University
-;; of Utah.
-
-;; 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 gcc Version 2 machine description is inspired by sparc.md and
-;; mips.md.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; Insn type. Used to default other attribute values.
-
-;; type "unary" insns have one input operand (1) and one output operand (0)
-;; type "binary" insns have two input operands (1,2) and one output (0)
-
-(define_attr "type"
- "move,unary,binary,shift,nullshift,compare,load,store,uncond_branch,branch,cbranch,fbranch,call,dyncall,fpload,fpstore,fpalu,fpcc,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,multi,milli,parallel_branch"
- (const_string "binary"))
-
-(define_attr "pa_combine_type"
- "fmpy,faddsub,uncond_branch,addmove,none"
- (const_string "none"))
-
-;; Processor type (for scheduling, not code generation) -- this attribute
-;; must exactly match the processor_type enumeration in pa.h.
-;;
-;; FIXME: Add 800 scheduling for completeness?
-
-(define_attr "cpu" "700,7100,7100LC" (const (symbol_ref "pa_cpu_attr")))
-
-;; Length (in # of insns).
-(define_attr "length" ""
- (cond [(eq_attr "type" "load,fpload")
- (if_then_else (match_operand 1 "symbolic_memory_operand" "")
- (const_int 8) (const_int 4))
-
- (eq_attr "type" "store,fpstore")
- (if_then_else (match_operand 0 "symbolic_memory_operand" "")
- (const_int 8) (const_int 4))
-
- (eq_attr "type" "binary,shift,nullshift")
- (if_then_else (match_operand 2 "arith_operand" "")
- (const_int 4) (const_int 12))
-
- (eq_attr "type" "move,unary,shift,nullshift")
- (if_then_else (match_operand 1 "arith_operand" "")
- (const_int 4) (const_int 8))]
-
- (const_int 4)))
-
-(define_asm_attributes
- [(set_attr "length" "4")
- (set_attr "type" "multi")])
-
-;; Attributes for instruction and branch scheduling
-
-;; For conditional branches.
-(define_attr "in_branch_delay" "false,true"
- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
- (eq_attr "length" "4"))
- (const_string "true")
- (const_string "false")))
-
-;; Disallow instructions which use the FPU since they will tie up the FPU
-;; even if the instruction is nullified.
-(define_attr "in_nullified_branch_delay" "false,true"
- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpdivdbl,fpsqrtsgl,fpsqrtdbl,parallel_branch")
- (eq_attr "length" "4"))
- (const_string "true")
- (const_string "false")))
-
-;; For calls and millicode calls. Allow unconditional branches in the
-;; delay slot.
-(define_attr "in_call_delay" "false,true"
- (cond [(and (eq_attr "type" "!uncond_branch,branch,cbranch,fbranch,call,dyncall,multi,milli,parallel_branch")
- (eq_attr "length" "4"))
- (const_string "true")
- (eq_attr "type" "uncond_branch")
- (if_then_else (ne (symbol_ref "TARGET_JUMP_IN_DELAY")
- (const_int 0))
- (const_string "true")
- (const_string "false"))]
- (const_string "false")))
-
-
-;; Call delay slot description.
-(define_delay (eq_attr "type" "call")
- [(eq_attr "in_call_delay" "true") (nil) (nil)])
-
-;; millicode call delay slot description. Note it disallows delay slot
-;; when TARGET_PORTABLE_RUNTIME is true.
-(define_delay (eq_attr "type" "milli")
- [(and (eq_attr "in_call_delay" "true")
- (eq (symbol_ref "TARGET_PORTABLE_RUNTIME") (const_int 0)))
- (nil) (nil)])
-
-;; Return and other similar instructions.
-(define_delay (eq_attr "type" "branch,parallel_branch")
- [(eq_attr "in_branch_delay" "true") (nil) (nil)])
-
-;; Floating point conditional branch delay slot description and
-(define_delay (eq_attr "type" "fbranch")
- [(eq_attr "in_branch_delay" "true")
- (eq_attr "in_nullified_branch_delay" "true")
- (nil)])
-
-;; Integer conditional branch delay slot description.
-;; Nullification of conditional branches on the PA is dependent on the
-;; direction of the branch. Forward branches nullify true and
-;; backward branches nullify false. If the direction is unknown
-;; then nullification is not allowed.
-(define_delay (eq_attr "type" "cbranch")
- [(eq_attr "in_branch_delay" "true")
- (and (eq_attr "in_nullified_branch_delay" "true")
- (attr_flag "forward"))
- (and (eq_attr "in_nullified_branch_delay" "true")
- (attr_flag "backward"))])
-
-(define_delay (and (eq_attr "type" "uncond_branch")
- (eq (symbol_ref "following_call (insn)")
- (const_int 0)))
- [(eq_attr "in_branch_delay" "true") (nil) (nil)])
-
-;; Function units of the HPPA. The following data is for the 700 CPUs
-;; (Mustang CPU + Timex FPU aka PA-89) because that's what I have the docs for.
-;; Scheduling instructions for PA-83 machines according to the Snake
-;; constraints shouldn't hurt.
-
-;; (define_function_unit {name} {num-units} {n-users} {test}
-;; {ready-delay} {issue-delay} [{conflict-list}])
-
-;; The integer ALU.
-;; (Noted only for documentation; units that take one cycle do not need to
-;; be specified.)
-
-;; (define_function_unit "alu" 1 0
-;; (and (eq_attr "type" "unary,shift,nullshift,binary,move,address")
-;; (eq_attr "cpu" "700"))
-;; 1 0)
-
-
-;; Memory. Disregarding Cache misses, the Mustang memory times are:
-;; load: 2, fpload: 3
-;; store, fpstore: 3, no D-cache operations should be scheduled.
-
-(define_function_unit "pa700memory" 1 0
- (and (eq_attr "type" "load,fpload")
- (eq_attr "cpu" "700")) 2 0)
-(define_function_unit "pa700memory" 1 0
- (and (eq_attr "type" "store,fpstore")
- (eq_attr "cpu" "700")) 3 3)
-
-;; The Timex (aka 700) has two floating-point units: ALU, and MUL/DIV/SQRT.
-;; Timings:
-;; Instruction Time Unit Minimum Distance (unit contention)
-;; fcpy 3 ALU 2
-;; fabs 3 ALU 2
-;; fadd 3 ALU 2
-;; fsub 3 ALU 2
-;; fcmp 3 ALU 2
-;; fcnv 3 ALU 2
-;; fmpyadd 3 ALU,MPY 2
-;; fmpysub 3 ALU,MPY 2
-;; fmpycfxt 3 ALU,MPY 2
-;; fmpy 3 MPY 2
-;; fmpyi 3 MPY 2
-;; fdiv,sgl 10 MPY 10
-;; fdiv,dbl 12 MPY 12
-;; fsqrt,sgl 14 MPY 14
-;; fsqrt,dbl 18 MPY 18
-
-(define_function_unit "pa700fp_alu" 1 0
- (and (eq_attr "type" "fpcc")
- (eq_attr "cpu" "700")) 4 2)
-(define_function_unit "pa700fp_alu" 1 0
- (and (eq_attr "type" "fpalu")
- (eq_attr "cpu" "700")) 3 2)
-(define_function_unit "pa700fp_mpy" 1 0
- (and (eq_attr "type" "fpmulsgl,fpmuldbl")
- (eq_attr "cpu" "700")) 3 2)
-(define_function_unit "pa700fp_mpy" 1 0
- (and (eq_attr "type" "fpdivsgl")
- (eq_attr "cpu" "700")) 10 10)
-(define_function_unit "pa700fp_mpy" 1 0
- (and (eq_attr "type" "fpdivdbl")
- (eq_attr "cpu" "700")) 12 12)
-(define_function_unit "pa700fp_mpy" 1 0
- (and (eq_attr "type" "fpsqrtsgl")
- (eq_attr "cpu" "700")) 14 14)
-(define_function_unit "pa700fp_mpy" 1 0
- (and (eq_attr "type" "fpsqrtdbl")
- (eq_attr "cpu" "700")) 18 18)
-
-;; Function units for the 7100 and 7150. The 7100/7150 can dual-issue
-;; floating point computations with non-floating point computations (fp loads
-;; and stores are not fp computations).
-;;
-;; As with the alpha we multiply the ready delay by two to encourage
-;; schedules which will allow the 7100/7150 to dual issue as many instructions
-;; as possible.
-
-;; Memory. Disregarding Cache misses, memory loads take two cycles; stores also
-;; take two cycles, during which no Dcache operations should be scheduled.
-;; Any special cases are handled in pa_adjust_cost. The 7100, 7150 and 7100LC
-;; all have the same memory characteristics if one disregards cache misses.
-(define_function_unit "pa7100memory" 1 0
- (and (eq_attr "type" "load,fpload")
- (eq_attr "cpu" "7100,7100LC")) 4 0)
-(define_function_unit "pa7100memory" 1 0
- (and (eq_attr "type" "store,fpstore")
- (eq_attr "cpu" "7100,7100LC")) 4 4)
-
-;; The 7100/7150 has three floating-point units: ALU, MUL, and DIV.
-;; Timings:
-;; Instruction Time Unit Minimum Distance (unit contention)
-;; fcpy 2 ALU 1
-;; fabs 2 ALU 1
-;; fadd 2 ALU 1
-;; fsub 2 ALU 1
-;; fcmp 2 ALU 1
-;; fcnv 2 ALU 1
-;; fmpyadd 2 ALU,MPY 1
-;; fmpysub 2 ALU,MPY 1
-;; fmpycfxt 2 ALU,MPY 1
-;; fmpy 2 MPY 1
-;; fmpyi 2 MPY 1
-;; fdiv,sgl 8 DIV 8
-;; fdiv,dbl 15 DIV 15
-;; fsqrt,sgl 8 DIV 8
-;; fsqrt,dbl 15 DIV 15
-
-(define_function_unit "pa7100fp_alu" 1 0
- (and (eq_attr "type" "fpcc,fpalu")
- (eq_attr "cpu" "7100")) 4 2)
-(define_function_unit "pa7100fp_mpy" 1 0
- (and (eq_attr "type" "fpmulsgl,fpmuldbl")
- (eq_attr "cpu" "7100")) 4 2)
-(define_function_unit "pa7100fp_div" 1 0
- (and (eq_attr "type" "fpdivsgl,fpsqrtsgl")
- (eq_attr "cpu" "7100")) 16 16)
-(define_function_unit "pa7100fp_div" 1 0
- (and (eq_attr "type" "fpdivdbl,fpsqrtdbl")
- (eq_attr "cpu" "7100")) 30 30)
-
-;; To encourage dual issue we define function units corresponding to
-;; the instructions which can be dual issued. This is a rather crude
-;; approximation, the "pa7100nonflop" test in particular could be refined.
-(define_function_unit "pa7100flop" 1 1
- (and
- (eq_attr "type" "fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl")
- (eq_attr "cpu" "7100,7100LC")) 2 2)
-
-(define_function_unit "pa7100nonflop" 1 1
- (and
- (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl")
- (eq_attr "cpu" "7100")) 2 2)
-
-
-;; Memory subsystem works just like 7100/7150 (except for cache miss times which
-;; we don't model here).
-
-;; The 7100LC has three floating-point units: ALU, MUL, and DIV.
-;; Note divides and sqrt flops lock the cpu until the flop is
-;; finished. fmpy and xmpyu (fmpyi) lock the cpu for one cycle.
-;; There's no way to avoid the penalty.
-;; Timings:
-;; Instruction Time Unit Minimum Distance (unit contention)
-;; fcpy 2 ALU 1
-;; fabs 2 ALU 1
-;; fadd 2 ALU 1
-;; fsub 2 ALU 1
-;; fcmp 2 ALU 1
-;; fcnv 2 ALU 1
-;; fmpyadd,sgl 2 ALU,MPY 1
-;; fmpyadd,dbl 3 ALU,MPY 2
-;; fmpysub,sgl 2 ALU,MPY 1
-;; fmpysub,dbl 3 ALU,MPY 2
-;; fmpycfxt,sgl 2 ALU,MPY 1
-;; fmpycfxt,dbl 3 ALU,MPY 2
-;; fmpy,sgl 2 MPY 1
-;; fmpy,dbl 3 MPY 2
-;; fmpyi 3 MPY 2
-;; fdiv,sgl 8 DIV 8
-;; fdiv,dbl 15 DIV 15
-;; fsqrt,sgl 8 DIV 8
-;; fsqrt,dbl 15 DIV 15
-
-(define_function_unit "pa7100LCfp_alu" 1 0
- (and (eq_attr "type" "fpcc,fpalu")
- (eq_attr "cpu" "7100LC")) 4 2)
-(define_function_unit "pa7100LCfp_mpy" 1 0
- (and (eq_attr "type" "fpmulsgl")
- (eq_attr "cpu" "7100LC")) 4 2)
-(define_function_unit "pa7100LCfp_mpy" 1 0
- (and (eq_attr "type" "fpmuldbl")
- (eq_attr "cpu" "7100LC")) 6 4)
-(define_function_unit "pa7100LCfp_div" 1 0
- (and (eq_attr "type" "fpdivsgl,fpsqrtsgl")
- (eq_attr "cpu" "7100LC")) 16 16)
-(define_function_unit "pa7100LCfp_div" 1 0
- (and (eq_attr "type" "fpdivdbl,fpsqrtdbl")
- (eq_attr "cpu" "7100LC")) 30 30)
-
-;; Define the various functional units for dual-issue.
-;; The 7100LC shares the generic "flop" unit specification with the 7100/7150.
-
-;; The 7100LC has two basic integer which allow dual issue of most integer
-;; instructions. This needs further refinement to deal with the nullify,
-;; carry/borrow possible the ldw/ldw stw/stw special dual issue cases, and
-;; of course it needs to know about hte 2nd alu.
-(define_function_unit "pa7100LCnonflop" 1 1
- (and
- (eq_attr "type" "!fpcc,fpalu,fpmulsgl,fpmuldbl,fpdivsgl,fpsqrtsgl,fpdivdbl,fpsqrtdbl,load,fpload,store,fpstore,shift,nullshift")
- (eq_attr "cpu" "7100LC")) 2 2)
-
-(define_function_unit "pa7100LCshifter" 1 1
- (and
- (eq_attr "type" "shift,nullshift")
- (eq_attr "cpu" "7100LC")) 2 2)
-
-(define_function_unit "pa7100LCmem" 1 1
- (and
- (eq_attr "type" "load,fpload,store,fpstore")
- (eq_attr "cpu" "7100LC")) 2 2)
-
-
-;; Compare instructions.
-;; This controls RTL generation and register allocation.
-
-;; We generate RTL for comparisons and branches by having the cmpxx
-;; patterns store away the operands. Then, the scc and bcc patterns
-;; emit RTL for both the compare and the branch.
-;;
-
-(define_expand "cmpsi"
- [(set (reg:CC 0)
- (compare:CC (match_operand:SI 0 "reg_or_0_operand" "")
- (match_operand:SI 1 "arith5_operand" "")))]
- ""
- "
-{
- hppa_compare_op0 = operands[0];
- hppa_compare_op1 = operands[1];
- hppa_branch_type = CMP_SI;
- DONE;
-}")
-
-(define_expand "cmpsf"
- [(set (reg:CCFP 0)
- (compare:CCFP (match_operand:SF 0 "reg_or_0_operand" "")
- (match_operand:SF 1 "reg_or_0_operand" "")))]
- "! TARGET_SOFT_FLOAT"
- "
-{
- hppa_compare_op0 = operands[0];
- hppa_compare_op1 = operands[1];
- hppa_branch_type = CMP_SF;
- DONE;
-}")
-
-(define_expand "cmpdf"
- [(set (reg:CCFP 0)
- (compare:CCFP (match_operand:DF 0 "reg_or_0_operand" "")
- (match_operand:DF 1 "reg_or_0_operand" "")))]
- "! TARGET_SOFT_FLOAT"
- "
-{
- hppa_compare_op0 = operands[0];
- hppa_compare_op1 = operands[1];
- hppa_branch_type = CMP_DF;
- DONE;
-}")
-
-(define_insn ""
- [(set (reg:CCFP 0)
- (match_operator:CCFP 2 "comparison_operator"
- [(match_operand:SF 0 "reg_or_0_operand" "fG")
- (match_operand:SF 1 "reg_or_0_operand" "fG")]))]
- "! TARGET_SOFT_FLOAT"
- "fcmp,sgl,%Y2 %r0,%r1"
- [(set_attr "length" "4")
- (set_attr "type" "fpcc")])
-
-(define_insn ""
- [(set (reg:CCFP 0)
- (match_operator:CCFP 2 "comparison_operator"
- [(match_operand:DF 0 "reg_or_0_operand" "fG")
- (match_operand:DF 1 "reg_or_0_operand" "fG")]))]
- "! TARGET_SOFT_FLOAT"
- "fcmp,dbl,%Y2 %r0,%r1"
- [(set_attr "length" "4")
- (set_attr "type" "fpcc")])
-
-;; scc insns.
-
-(define_expand "seq"
- [(set (match_operand:SI 0 "register_operand" "")
- (eq:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- /* fp scc patterns rarely match, and are not a win on the PA. */
- if (hppa_branch_type != CMP_SI)
- FAIL;
- /* set up operands from compare. */
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
- /* fall through and generate default code */
-}")
-
-(define_expand "sne"
- [(set (match_operand:SI 0 "register_operand" "")
- (ne:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- /* fp scc patterns rarely match, and are not a win on the PA. */
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "slt"
- [(set (match_operand:SI 0 "register_operand" "")
- (lt:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- /* fp scc patterns rarely match, and are not a win on the PA. */
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "sgt"
- [(set (match_operand:SI 0 "register_operand" "")
- (gt:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- /* fp scc patterns rarely match, and are not a win on the PA. */
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "sle"
- [(set (match_operand:SI 0 "register_operand" "")
- (le:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- /* fp scc patterns rarely match, and are not a win on the PA. */
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "sge"
- [(set (match_operand:SI 0 "register_operand" "")
- (ge:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- /* fp scc patterns rarely match, and are not a win on the PA. */
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "sltu"
- [(set (match_operand:SI 0 "register_operand" "")
- (ltu:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "sgtu"
- [(set (match_operand:SI 0 "register_operand" "")
- (gtu:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "sleu"
- [(set (match_operand:SI 0 "register_operand" "")
- (leu:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "sgeu"
- [(set (match_operand:SI 0 "register_operand" "")
- (geu:SI (match_dup 1)
- (match_dup 2)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-;; Instruction canonicalization puts immediate operands second, which
-;; is the reverse of what we want.
-
-(define_insn "scc"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operator:SI 3 "comparison_operator"
- [(match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith11_operand" "rI")]))]
- ""
- "com%I2clr,%B3 %2,%1,%0\;ldi 1,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn "iorscc"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operator:SI 3 "comparison_operator"
- [(match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith11_operand" "rI")])
- (match_operator:SI 6 "comparison_operator"
- [(match_operand:SI 4 "register_operand" "r")
- (match_operand:SI 5 "arith11_operand" "rI")])))]
- ""
- "com%I2clr,%S3 %2,%1,0\;com%I5clr,%B6 %5,%4,%0\;ldi 1,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "12")])
-
-;; Combiner patterns for common operations performed with the output
-;; from an scc insn (negscc and incscc).
-(define_insn "negscc"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operator:SI 3 "comparison_operator"
- [(match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith11_operand" "rI")])))]
- ""
- "com%I2clr,%B3 %2,%1,%0\;ldi -1,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-;; Patterns for adding/subtracting the result of a boolean expression from
-;; a register. First we have special patterns that make use of the carry
-;; bit, and output only two instructions. For the cases we can't in
-;; general do in two instructions, the incscc pattern at the end outputs
-;; two or three instructions.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (leu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "arith11_operand" "rI"))
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "sub%I3 %3,%2,0\;addc 0,%1,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-; This need only accept registers for op3, since canonicalization
-; replaces geu with gtu when op3 is an integer.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (geu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "register_operand" "r"))
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "sub %2,%3,0\;addc 0,%1,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-; Match only integers for op3 here. This is used as canonical form of the
-; geu pattern when op3 is an integer. Don't match registers since we can't
-; make better code than the general incscc pattern.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (gtu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "int11_operand" "I"))
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "addi %k3,%2,0\;addc 0,%1,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn "incscc"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (plus:SI (match_operator:SI 4 "comparison_operator"
- [(match_operand:SI 2 "register_operand" "r,r")
- (match_operand:SI 3 "arith11_operand" "rI,rI")])
- (match_operand:SI 1 "register_operand" "0,?r")))]
- ""
- "@
- com%I3clr,%B4 %3,%2,0\;addi 1,%0,%0
- com%I3clr,%B4 %3,%2,0\;addi,tr 1,%1,%0\;copy %1,%0"
- [(set_attr "type" "binary,binary")
- (set_attr "length" "8,12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (gtu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "arith11_operand" "rI"))))]
- ""
- "sub%I3 %3,%2,0\;subb %1,0,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
- (gtu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "arith11_operand" "rI")))
- (match_operand:SI 4 "register_operand" "r")))]
- ""
- "sub%I3 %3,%2,0\;subb %1,%4,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-; This need only accept registers for op3, since canonicalization
-; replaces ltu with leu when op3 is an integer.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (ltu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "register_operand" "r"))))]
- ""
- "sub %2,%3,0\;subb %1,0,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
- (ltu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "register_operand" "r")))
- (match_operand:SI 4 "register_operand" "r")))]
- ""
- "sub %2,%3,0\;subb %1,%4,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-; Match only integers for op3 here. This is used as canonical form of the
-; ltu pattern when op3 is an integer. Don't match registers since we can't
-; make better code than the general incscc pattern.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (leu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "int11_operand" "I"))))]
- ""
- "addi %k3,%2,0\;subb %1,0,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
- (leu:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "int11_operand" "I")))
- (match_operand:SI 4 "register_operand" "r")))]
- ""
- "addi %k3,%2,0\;subb %1,%4,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn "decscc"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (minus:SI (match_operand:SI 1 "register_operand" "0,?r")
- (match_operator:SI 4 "comparison_operator"
- [(match_operand:SI 2 "register_operand" "r,r")
- (match_operand:SI 3 "arith11_operand" "rI,rI")])))]
- ""
- "@
- com%I3clr,%B4 %3,%2,0\;addi -1,%0,%0
- com%I3clr,%B4 %3,%2,0\;addi,tr -1,%1,%0\;copy %1,%0"
- [(set_attr "type" "binary,binary")
- (set_attr "length" "8,12")])
-
-; Patterns for max and min. (There is no need for an earlyclobber in the
-; last alternative since the middle alternative will match if op0 == op1.)
-
-(define_insn "sminsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (smin:SI (match_operand:SI 1 "register_operand" "%0,0,r")
- (match_operand:SI 2 "arith11_operand" "r,I,M")))]
- ""
- "@
- comclr,> %2,%0,0\;copy %2,%0
- comiclr,> %2,%0,0\;ldi %2,%0
- comclr,> %1,%2,%0\;copy %1,%0"
-[(set_attr "type" "multi,multi,multi")
- (set_attr "length" "8,8,8")])
-
-(define_insn "uminsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (umin:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "arith11_operand" "r,I")))]
- ""
- "@
- comclr,>> %2,%0,0\;copy %2,%0
- comiclr,>> %2,%0,0\;ldi %2,%0"
-[(set_attr "type" "multi,multi")
- (set_attr "length" "8,8")])
-
-(define_insn "smaxsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (smax:SI (match_operand:SI 1 "register_operand" "%0,0,r")
- (match_operand:SI 2 "arith11_operand" "r,I,M")))]
- ""
- "@
- comclr,< %2,%0,0\;copy %2,%0
- comiclr,< %2,%0,0\;ldi %2,%0
- comclr,< %1,%2,%0\;copy %1,%0"
-[(set_attr "type" "multi,multi,multi")
- (set_attr "length" "8,8,8")])
-
-(define_insn "umaxsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (umax:SI (match_operand:SI 1 "register_operand" "%0,0")
- (match_operand:SI 2 "arith11_operand" "r,I")))]
- ""
- "@
- comclr,<< %2,%0,0\;copy %2,%0
- comiclr,<< %2,%0,0\;ldi %2,%0"
-[(set_attr "type" "multi,multi")
- (set_attr "length" "8,8")])
-
-(define_insn "abssi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (abs:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "or,>= %%r0,%1,%0\;subi 0,%0,%0"
- [(set_attr "type" "multi")
- (set_attr "length" "8")])
-
-;;; Experimental conditional move patterns
-
-(define_expand "movsicc"
- [(set (match_operand:SI 0 "register_operand" "")
- (if_then_else:SI
- (match_operator 1 "comparison_operator"
- [(match_dup 4)
- (match_dup 5)])
- (match_operand:SI 2 "reg_or_cint_move_operand" "")
- (match_operand:SI 3 "reg_or_cint_move_operand" "")))]
- ""
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
-
- if (hppa_branch_type != CMP_SI)
- FAIL;
-
- /* operands[1] is currently the result of compare_from_rtx. We want to
- emit a compare of the original operands. */
- operands[1] = gen_rtx (code, SImode, hppa_compare_op0, hppa_compare_op1);
- operands[4] = hppa_compare_op0;
- operands[5] = hppa_compare_op1;
-}")
-
-; We need the first constraint alternative in order to avoid
-; earlyclobbers on all other alternatives.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand:SI 3 "register_operand" "r,r,r,r,r")
- (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI,rI")])
- (match_operand:SI 1 "reg_or_cint_move_operand" "0,r,J,N,K")
- (const_int 0)))]
- ""
- "@
- com%I4clr,%S5 %4,%3,0\;ldi 0,%0
- com%I4clr,%B5 %4,%3,%0\;copy %1,%0
- com%I4clr,%B5 %4,%3,%0\;ldi %1,%0
- com%I4clr,%B5 %4,%3,%0\;ldil L'%1,%0
- com%I4clr,%B5 %4,%3,%0\;zdepi %Z1,%0"
- [(set_attr "type" "multi,multi,multi,multi,nullshift")
- (set_attr "length" "8,8,8,8,8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r,r")
- (if_then_else:SI
- (match_operator 5 "comparison_operator"
- [(match_operand:SI 3 "register_operand" "r,r,r,r,r,r,r,r")
- (match_operand:SI 4 "arith11_operand" "rI,rI,rI,rI,rI,rI,rI,rI")])
- (match_operand:SI 1 "reg_or_cint_move_operand" "0,0,0,0,r,J,N,K")
- (match_operand:SI 2 "reg_or_cint_move_operand" "r,J,N,K,0,0,0,0")))]
- ""
- "@
- com%I4clr,%S5 %4,%3,0\;copy %2,%0
- com%I4clr,%S5 %4,%3,0\;ldi %2,%0
- com%I4clr,%S5 %4,%3,0\;ldil L'%2,%0
- com%I4clr,%S5 %4,%3,0\;zdepi %Z2,%0
- com%I4clr,%B5 %4,%3,0\;copy %1,%0
- com%I4clr,%B5 %4,%3,0\;ldi %1,%0
- com%I4clr,%B5 %4,%3,0\;ldil L'%1,%0
- com%I4clr,%B5 %4,%3,0\;zdepi %Z1,%0"
- [(set_attr "type" "multi,multi,multi,nullshift,multi,multi,multi,nullshift")
- (set_attr "length" "8,8,8,8,8,8,8,8")])
-
-;; Conditional Branches
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- {
- emit_insn (gen_cmp_fp (EQ, hppa_compare_op0, hppa_compare_op1));
- emit_bcond_fp (NE, operands[0]);
- DONE;
- }
- /* set up operands from compare. */
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
- /* fall through and generate default code */
-}")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- {
- emit_insn (gen_cmp_fp (NE, hppa_compare_op0, hppa_compare_op1));
- emit_bcond_fp (NE, operands[0]);
- DONE;
- }
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- {
- emit_insn (gen_cmp_fp (GT, hppa_compare_op0, hppa_compare_op1));
- emit_bcond_fp (NE, operands[0]);
- DONE;
- }
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- {
- emit_insn (gen_cmp_fp (LT, hppa_compare_op0, hppa_compare_op1));
- emit_bcond_fp (NE, operands[0]);
- DONE;
- }
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- {
- emit_insn (gen_cmp_fp (GE, hppa_compare_op0, hppa_compare_op1));
- emit_bcond_fp (NE, operands[0]);
- DONE;
- }
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- {
- emit_insn (gen_cmp_fp (LE, hppa_compare_op0, hppa_compare_op1));
- emit_bcond_fp (NE, operands[0]);
- DONE;
- }
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (match_dup 1) (match_dup 2))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (hppa_branch_type != CMP_SI)
- FAIL;
- operands[1] = hppa_compare_op0;
- operands[2] = hppa_compare_op1;
-}")
-
-;; Match the branch patterns.
-
-
-;; Note a long backward conditional branch with an annulled delay slot
-;; has a length of 12.
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 3 "comparison_operator"
- [(match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith5_operand" "rL")])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 0, insn);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-;; Match the negated branch.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 3 "comparison_operator"
- [(match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith5_operand" "rL")])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- return output_cbranch (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 1, insn);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-;; Branch on Bit patterns.
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "uint5_operand" ""))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "*
-{
- return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 0, insn, 0);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "uint5_operand" ""))
- (const_int 0))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "*
-{
- return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 1, insn, 0);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "uint5_operand" ""))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "*
-{
- return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 0, insn, 1);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "uint5_operand" ""))
- (const_int 0))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "*
-{
- return output_bb (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 1, insn, 1);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-;; Branch on Variable Bit patterns.
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "register_operand" "q"))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "*
-{
- return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 0, insn, 0);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "register_operand" "q"))
- (const_int 0))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "*
-{
- return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 1, insn, 0);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "register_operand" "q"))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "*
-{
- return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 0, insn, 1);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 1 "register_operand" "q"))
- (const_int 0))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "*
-{
- return output_bvb (operands, INSN_ANNULLED_BRANCH_P (insn),
- get_attr_length (insn), 1, insn, 1);
-}"
-[(set_attr "type" "cbranch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-;; Floating point branches
-(define_insn ""
- [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- "! TARGET_SOFT_FLOAT"
- "*
-{
- if (INSN_ANNULLED_BRANCH_P (insn))
- return \"ftest\;bl,n %0,0\";
- else
- return \"ftest\;bl%* %0,0\";
-}"
- [(set_attr "type" "fbranch")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (pc) (if_then_else (ne (reg:CCFP 0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- "! TARGET_SOFT_FLOAT"
- "*
-{
- if (INSN_ANNULLED_BRANCH_P (insn))
- return \"ftest\;add,tr 0,0,0\;bl,n %0,0\";
- else
- return \"ftest\;add,tr 0,0,0\;bl%* %0,0\";
-}"
- [(set_attr "type" "fbranch")
- (set_attr "length" "12")])
-
-;; Move instructions
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, SImode, 0))
- DONE;
-}")
-
-;; Reloading an SImode or DImode value requires a scratch register if
-;; going in to or out of float point registers.
-
-(define_expand "reload_insi"
- [(set (match_operand:SI 0 "register_operand" "=Z")
- (match_operand:SI 1 "non_hard_reg_operand" ""))
- (clobber (match_operand:SI 2 "register_operand" "=&r"))]
- ""
- "
-{
- if (emit_move_sequence (operands, SImode, operands[2]))
- DONE;
-
- /* We don't want the clobber emitted, so handle this ourselves. */
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-(define_expand "reload_outsi"
- [(set (match_operand:SI 0 "non_hard_reg_operand" "")
- (match_operand:SI 1 "register_operand" "Z"))
- (clobber (match_operand:SI 2 "register_operand" "=&r"))]
- ""
- "
-{
- if (emit_move_sequence (operands, SImode, operands[2]))
- DONE;
-
- /* We don't want the clobber emitted, so handle this ourselves. */
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-;;; pic symbol references
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "symbolic_operand" ""))))]
- "flag_pic && operands[1] == pic_offset_table_rtx"
- "ldw T'%2(%1),%0"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand"
- "=r,r,r,r,r,Q,*q,!f,f,*TR")
- (match_operand:SI 1 "move_operand"
- "r,J,N,K,RQ,rM,rM,!fM,*RT,f"))]
- "(register_operand (operands[0], SImode)
- || reg_or_0_operand (operands[1], SImode))
- && ! TARGET_SOFT_FLOAT"
- "@
- copy %1,%0
- ldi %1,%0
- ldil L'%1,%0
- zdepi %Z1,%0
- ldw%M1 %1,%0
- stw%M0 %r1,%0
- mtsar %r1
- fcpy,sgl %r1,%0
- fldw%F1 %1,%0
- fstw%F0 %1,%0"
- [(set_attr "type" "move,move,move,shift,load,store,move,fpalu,fpload,fpstore")
- (set_attr "pa_combine_type" "addmove")
- (set_attr "length" "4,4,4,4,4,4,4,4,4,4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand"
- "=r,r,r,r,r,Q,*q")
- (match_operand:SI 1 "move_operand"
- "r,J,N,K,RQ,rM,rM"))]
- "(register_operand (operands[0], SImode)
- || reg_or_0_operand (operands[1], SImode))
- && TARGET_SOFT_FLOAT"
- "@
- copy %1,%0
- ldi %1,%0
- ldil L'%1,%0
- zdepi %Z1,%0
- ldw%M1 %1,%0
- stw%M0 %r1,%0
- mtsar %r1"
- [(set_attr "type" "move,move,move,move,load,store,move")
- (set_attr "pa_combine_type" "addmove")
- (set_attr "length" "4,4,4,4,4,4,4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (plus:SI (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"ldwx %1(0,%2),%0\";
- else
- return \"ldwx %2(0,%1),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"ldwx %2(0,%1),%0\";
- else
- return \"ldwx %1(0,%2),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-;; Load or store with base-register modification.
-
-(define_insn "pre_ldwm"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "=r")
- (match_operand:SI 2 "pre_cint_operand" ""))))
- (set (match_dup 1)
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "*
-{
- if (INTVAL (operands[2]) < 0)
- return \"ldwm %2(0,%1),%0\";
- return \"ldws,mb %2(0,%1),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn "pre_stwm"
- [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "pre_cint_operand" "")))
- (match_operand:SI 2 "reg_or_0_operand" "rM"))
- (set (match_dup 0)
- (plus:SI (match_dup 0) (match_dup 1)))]
- ""
- "*
-{
- if (INTVAL (operands[1]) < 0)
- return \"stwm %r2,%1(0,%0)\";
- return \"stws,mb %r2,%1(0,%0)\";
-}"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
-
-(define_insn "post_ldwm"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (match_operand:SI 1 "register_operand" "=r")))
- (set (match_dup 1)
- (plus:SI (match_dup 1)
- (match_operand:SI 2 "post_cint_operand" "")))]
- ""
- "*
-{
- if (INTVAL (operands[2]) > 0)
- return \"ldwm %2(0,%1),%0\";
- return \"ldws,ma %2(0,%1),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn "post_stwm"
- [(set (mem:SI (match_operand:SI 0 "register_operand" "=r"))
- (match_operand:SI 1 "reg_or_0_operand" "rM"))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (match_operand:SI 2 "post_cint_operand" "")))]
- ""
- "*
-{
- if (INTVAL (operands[2]) > 0)
- return \"stwm %r1,%2(0,%0)\";
- return \"stws,ma %r1,%2(0,%0)\";
-}"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
-
-;; For pic
-;; Note since this pattern can be created at reload time (via movsi), all
-;; the same rules for movsi apply here. (no new pseudos, no temporaries).
-(define_insn "pic_load_label"
- [(set (match_operand:SI 0 "register_operand" "=a")
- (match_operand:SI 1 "pic_label_operand" ""))]
- ""
- "*
-{
- rtx label_rtx = gen_label_rtx ();
- rtx xoperands[3];
- extern FILE *asm_out_file;
-
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- xoperands[2] = label_rtx;
- output_asm_insn (\"bl .+8,%0\", xoperands);
- output_asm_insn (\"depi 0,31,2,%0\", xoperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (label_rtx));
-
- /* If we're trying to load the address of a label that happens to be
- close, then we can use a shorter sequence. */
- if (GET_CODE (operands[1]) == LABEL_REF
- && insn_addresses
- && abs (insn_addresses[INSN_UID (XEXP (operands[1], 0))]
- - insn_addresses[INSN_UID (insn)]) < 8100)
- {
- /* Prefixing with R% here is wrong, it extracts just 11 bits and is
- always non-negative. */
- output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
- }
- else
- {
- output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
- output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
- }
- return \"\";
-}"
- [(set_attr "type" "multi")
- (set_attr "length" "16")]) ; 12 or 16
-
-(define_insn "pic2_highpart"
- [(set (match_operand:SI 0 "register_operand" "=a")
- (plus:SI (match_operand:SI 1 "register_operand" "r")
- (high:SI (match_operand 2 "" ""))))]
- "symbolic_operand (operands[2], Pmode)
- && ! function_label_operand (operands[2])
- && flag_pic == 2"
- "addil LT'%G2,%1"
- [(set_attr "type" "binary")
- (set_attr "length" "4")])
-
-; We need this to make sure CSE doesn't simplify a memory load with a
-; symbolic address, whose content it think it knows. For PIC, what CSE
-; think is the real value will be the address of that value.
-(define_insn "pic2_lo_sum"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (unspec:SI [(match_operand:SI 2 "symbolic_operand" "")] 0))))]
- ""
- "*
-{
- if (flag_pic != 2)
- abort ();
- return \"ldw RT'%G2(%1),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-
-;; Always use addil rather than ldil;add sequences. This allows the
-;; HP linker to eliminate the dp relocation if the symbolic operand
-;; lives in the TEXT space.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=a")
- (high:SI (match_operand 1 "" "")))]
- "symbolic_operand (operands[1], Pmode)
- && ! function_label_operand (operands[1])
- && ! read_only_operand (operands[1])
- && ! flag_pic"
- "*
-{
- if (TARGET_LONG_LOAD_STORE)
- return \"addil NLR'%H1,%%r27\;ldo N'%H1(%%r1),%%r1\";
- else
- return \"addil LR'%H1,%%r27\";
-}"
- [(set_attr "type" "binary")
- (set (attr "length")
- (if_then_else (eq (symbol_ref "TARGET_LONG_LOAD_STORE") (const_int 0))
- (const_int 4)
- (const_int 8)))])
-
-
-;; This is for use in the prologue/epilogue code. We need it
-;; to add large constants to a stack pointer or frame pointer.
-;; Because of the additional %r1 pressure, we probably do not
-;; want to use this in general code, so make it available
-;; only after reload.
-(define_insn "add_high_const"
- [(set (match_operand:SI 0 "register_operand" "=!a,*r")
- (plus:SI (match_operand:SI 1 "register_operand" "r,r")
- (high:SI (match_operand 2 "const_int_operand" ""))))]
- "reload_completed"
- "@
- addil L'%G2,%1
- ldil L'%G2,%0\;addl %0,%1,%0"
- [(set_attr "type" "binary,binary")
- (set_attr "length" "4,8")])
-
-;; For function addresses.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (match_operand:SI 1 "function_label_operand" "")))]
- "!TARGET_PORTABLE_RUNTIME"
- "ldil LP'%G1,%0"
- [(set_attr "type" "move")
- (set_attr "length" "4")])
-
-;; This version is used only for the portable runtime conventions model
-;; (it does not use/support plabels)
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (match_operand:SI 1 "function_label_operand" "")))]
- "TARGET_PORTABLE_RUNTIME"
- "ldil L'%G1,%0"
- [(set_attr "type" "move")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (match_operand 1 "" "")))]
- "(!flag_pic || !symbolic_operand (operands[1]), Pmode)
- && !is_function_label_plus_const (operands[1])"
- "*
-{
- if (symbolic_operand (operands[1], Pmode))
- return \"ldil LR'%H1,%0\";
- else
- return \"ldil L'%G1,%0\";
-}"
- [(set_attr "type" "move")
- (set_attr "length" "4")])
-
-;; lo_sum of a function address.
-;;
-;; Note since we are not supporting MPE style external calls we can
-;; use the short ldil;ldo sequence. If one wanted to support
-;; MPE external calls you would want to generate something like
-;; ldil;ldo;extru;ldw;add. See the HP compiler's output for details.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "function_label_operand" "")))]
- "!TARGET_PORTABLE_RUNTIME"
- "ldo RP'%G2(%1),%0"
- [(set_attr "type" "move")
- (set_attr "length" "4")])
-
-;; This version is used only for the portable runtime conventions model
-;; (it does not use/support plabels)
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "function_label_operand" "")))]
- "TARGET_PORTABLE_RUNTIME"
- "ldo R'%G2(%1),%0"
- [(set_attr "type" "move")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "i")))]
- "!is_function_label_plus_const (operands[2])"
- "*
-{
- if (flag_pic && symbolic_operand (operands[2], Pmode))
- abort ();
- else if (symbolic_operand (operands[2], Pmode))
- return \"ldo RR'%G2(%1),%0\";
- else
- return \"ldo R'%G2(%1),%0\";
-}"
- [(set_attr "type" "move")
- (set_attr "length" "4")])
-
-;; Now that a symbolic_address plus a constant is broken up early
-;; in the compilation phase (for better CSE) we need a special
-;; combiner pattern to load the symbolic address plus the constant
-;; in only 2 instructions. (For cases where the symbolic address
-;; was not a common subexpression.)
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "symbolic_operand" ""))
- (clobber (match_operand:SI 2 "register_operand" ""))]
- "! (flag_pic && pic_label_operand (operands[1], SImode))"
- [(set (match_dup 2) (high:SI (match_dup 1)))
- (set (match_dup 0) (lo_sum:SI (match_dup 2) (match_dup 1)))]
- "")
-
-;; hppa_legitimize_address goes to a great deal of trouble to
-;; create addresses which use indexing. In some cases, this
-;; is a lose because there isn't any store instructions which
-;; allow indexed addresses (with integer register source).
-;;
-;; These define_splits try to turn a 3 insn store into
-;; a 2 insn store with some creative RTL rewriting.
-(define_split
- [(set (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "shadd_operand" ""))
- (plus:SI (match_operand:SI 2 "register_operand" "")
- (match_operand:SI 3 "const_int_operand" ""))))
- (match_operand:SI 4 "register_operand" ""))
- (clobber (match_operand:SI 5 "register_operand" ""))]
- ""
- [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
- (match_dup 2)))
- (set (mem:SI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
- "")
-
-(define_split
- [(set (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "shadd_operand" ""))
- (plus:SI (match_operand:SI 2 "register_operand" "")
- (match_operand:SI 3 "const_int_operand" ""))))
- (match_operand:HI 4 "register_operand" ""))
- (clobber (match_operand:SI 5 "register_operand" ""))]
- ""
- [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
- (match_dup 2)))
- (set (mem:HI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
- "")
-
-(define_split
- [(set (mem:QI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "shadd_operand" ""))
- (plus:SI (match_operand:SI 2 "register_operand" "")
- (match_operand:SI 3 "const_int_operand" ""))))
- (match_operand:QI 4 "register_operand" ""))
- (clobber (match_operand:SI 5 "register_operand" ""))]
- ""
- [(set (match_dup 5) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
- (match_dup 2)))
- (set (mem:QI (plus:SI (match_dup 5) (match_dup 3))) (match_dup 4))]
- "")
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, HImode, 0))
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,Q,*q,!f")
- (match_operand:HI 1 "move_operand" "r,J,N,K,RQ,rM,rM,!fM"))]
- "register_operand (operands[0], HImode)
- || reg_or_0_operand (operands[1], HImode)"
- "@
- copy %1,%0
- ldi %1,%0
- ldil L'%1,%0
- zdepi %Z1,%0
- ldh%M1 %1,%0
- sth%M0 %r1,%0
- mtsar %r1
- fcpy,sgl %r1,%0"
- [(set_attr "type" "move,move,move,shift,load,store,move,fpalu")
- (set_attr "pa_combine_type" "addmove")
- (set_attr "length" "4,4,4,4,4,4,4,4")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (mem:HI (plus:SI (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"ldhx %1(0,%2),%0\";
- else
- return \"ldhx %2(0,%1),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"ldhx %2(0,%1),%0\";
- else
- return \"ldhx %1(0,%2),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-; Now zero extended variants.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (mem:HI
- (plus:SI
- (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r")))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"ldhx %1(0,%2),%0\";
- else
- return \"ldhx %2(0,%1),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (mem:HI
- (plus:SI
- (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r")))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"ldhx %2(0,%1),%0\";
- else
- return \"ldhx %1(0,%2),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "=r")
- (match_operand:SI 2 "int5_operand" "L"))))
- (set (match_dup 1)
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "ldhs,mb %2(0,%1),%0"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-; And a zero extended variant.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (mem:HI
- (plus:SI
- (match_operand:SI 1 "register_operand" "=r")
- (match_operand:SI 2 "int5_operand" "L")))))
- (set (match_dup 1)
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "ldhs,mb %2(0,%1),%0"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "int5_operand" "L")))
- (match_operand:HI 2 "reg_or_0_operand" "rM"))
- (set (match_dup 0)
- (plus:SI (match_dup 0) (match_dup 1)))]
- ""
- "sths,mb %r2,%1(0,%0)"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (high:HI (match_operand 1 "const_int_operand" "")))]
- ""
- "ldil L'%G1,%0"
- [(set_attr "type" "move")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (lo_sum:HI (match_operand:HI 1 "register_operand" "r")
- (match_operand 2 "const_int_operand" "")))]
- ""
- "ldo R'%G2(%1),%0"
- [(set_attr "type" "move")
- (set_attr "length" "4")])
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, QImode, 0))
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,Q,*q,!f")
- (match_operand:QI 1 "move_operand" "r,J,N,K,RQ,rM,rM,!fM"))]
- "register_operand (operands[0], QImode)
- || reg_or_0_operand (operands[1], QImode)"
- "@
- copy %1,%0
- ldi %1,%0
- ldil L'%1,%0
- zdepi %Z1,%0
- ldb%M1 %1,%0
- stb%M0 %r1,%0
- mtsar %r1
- fcpy,sgl %r1,%0"
- [(set_attr "type" "move,move,move,shift,load,store,move,fpalu")
- (set_attr "pa_combine_type" "addmove")
- (set_attr "length" "4,4,4,4,4,4,4,4")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (mem:QI (plus:SI (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"ldbx %1(0,%2),%0\";
- else
- return \"ldbx %2(0,%1),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"ldbx %2(0,%1),%0\";
- else
- return \"ldbx %1(0,%2),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-; Indexed byte load with zero extension to SImode or HImode.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (mem:QI
- (plus:SI
- (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r")))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"ldbx %1(0,%2),%0\";
- else
- return \"ldbx %2(0,%1),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (mem:QI
- (plus:SI
- (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r")))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"ldbx %2(0,%1),%0\";
- else
- return \"ldbx %1(0,%2),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (zero_extend:HI (mem:QI
- (plus:SI
- (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r")))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"ldbx %1(0,%2),%0\";
- else
- return \"ldbx %2(0,%1),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (zero_extend:HI (mem:QI
- (plus:SI
- (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r")))))]
- "! TARGET_DISABLE_INDEXING"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"ldbx %2(0,%1),%0\";
- else
- return \"ldbx %1(0,%2),%0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=r")
- (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "=r")
- (match_operand:SI 2 "int5_operand" "L"))))
- (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "ldbs,mb %2(0,%1),%0"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-; Now the same thing with zero extensions.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (mem:QI (plus:SI
- (match_operand:SI 1 "register_operand" "=r")
- (match_operand:SI 2 "int5_operand" "L")))))
- (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "ldbs,mb %2(0,%1),%0"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (zero_extend:HI (mem:QI (plus:SI
- (match_operand:SI 1 "register_operand" "=r")
- (match_operand:SI 2 "int5_operand" "L")))))
- (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "ldbs,mb %2(0,%1),%0"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (mem:QI (plus:SI (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "int5_operand" "L")))
- (match_operand:QI 2 "reg_or_0_operand" "rM"))
- (set (match_dup 0)
- (plus:SI (match_dup 0) (match_dup 1)))]
- ""
- "stbs,mb %r2,%1(0,%0)"
- [(set_attr "type" "store")
- (set_attr "length" "4")])
-
-;; The definition of this insn does not really explain what it does,
-;; but it should suffice
-;; that anything generated as this insn will be recognized as one
-;; and that it will not successfully combine with anything.
-(define_expand "movstrsi"
- [(parallel [(set (mem:BLK (match_operand:BLK 0 "" ""))
- (mem:BLK (match_operand:BLK 1 "" "")))
- (clobber (match_dup 0))
- (clobber (match_dup 1))
- (clobber (match_dup 4))
- (clobber (match_dup 5))
- (use (match_operand:SI 2 "arith_operand" ""))
- (use (match_operand:SI 3 "const_int_operand" ""))])]
- ""
- "
-{
- int size, align;
- /* HP provides very fast block move library routine for the PA;
- this routine includes:
-
- 4x4 byte at a time block moves,
- 1x4 byte at a time with alignment checked at runtime with
- attempts to align the source and destination as needed
- 1x1 byte loop
-
- With that in mind, here's the heuristics to try and guess when
- the inlined block move will be better than the library block
- move:
-
- If the size isn't constant, then always use the library routines.
-
- If the size is large in respect to the known alignment, then use
- the library routines.
-
- If the size is small in repsect to the known alignment, then open
- code the copy (since that will lead to better scheduling).
-
- Else use the block move pattern. */
-
- /* Undetermined size, use the library routine. */
- if (GET_CODE (operands[2]) != CONST_INT)
- FAIL;
-
- size = INTVAL (operands[2]);
- align = INTVAL (operands[3]);
- align = align > 4 ? 4 : align;
-
- /* If size/alignment > 8 (eg size is large in respect to alignment),
- then use the library routines. */
- if (size/align > 16)
- FAIL;
-
- /* This does happen, but not often enough to worry much about. */
- if (size/align < MOVE_RATIO)
- FAIL;
-
- /* Fall through means we're going to use our block move pattern. */
- operands[0] = copy_to_mode_reg (SImode, XEXP (operands[0], 0));
- operands[1] = copy_to_mode_reg (SImode, XEXP (operands[1], 0));
- operands[4] = gen_reg_rtx (SImode);
- operands[5] = gen_reg_rtx (SImode);
- emit_insn (gen_movstrsi_internal (operands[0], operands[1], operands[4],
- operands[5], operands[2], operands[3],
- gen_reg_rtx (SImode)));
- DONE;
-}")
-
-;; The operand constraints are written like this to support both compile-time
-;; and run-time determined byte count. If the count is run-time determined,
-;; the register with the byte count is clobbered by the copying code, and
-;; therefore it is forced to operand 2. If the count is compile-time
-;; determined, we need two scratch registers for the unrolled code.
-(define_insn "movstrsi_internal"
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r,r"))
- (mem:BLK (match_operand:SI 1 "register_operand" "+r,r")))
- (clobber (match_dup 0))
- (clobber (match_dup 1))
- (clobber (match_operand:SI 2 "register_operand" "=r,r")) ;loop cnt/tmp
- (clobber (match_operand:SI 3 "register_operand" "=&r,&r")) ;item tmp
- (clobber (match_operand:SI 6 "register_operand" "=&r,&r")) ;item tmp2
- (use (match_operand:SI 4 "arith_operand" "J,2")) ;byte count
- (use (match_operand:SI 5 "const_int_operand" "n,n"))] ;alignment
- ""
- "* return output_block_move (operands, !which_alternative);"
- [(set_attr "type" "multi,multi")])
-
-;; Floating point move insns
-
-;; This pattern forces (set (reg:DF ...) (const_double ...))
-;; to be reloaded by putting the constant into memory when
-;; reg is a floating point register.
-;;
-;; For integer registers we use ldil;ldo to set the appropriate
-;; value.
-;;
-;; This must come before the movdf pattern, and it must be present
-;; to handle obscure reloading cases.
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=?r,f")
- (match_operand:DF 1 "" "?F,m"))]
- "GET_CODE (operands[1]) == CONST_DOUBLE
- && operands[1] != CONST0_RTX (DFmode)
- && ! TARGET_SOFT_FLOAT"
- "* return (which_alternative == 0 ? output_move_double (operands)
- : \"fldd%F1 %1,%0\");"
- [(set_attr "type" "move,fpload")
- (set_attr "length" "16,4")])
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, DFmode, 0))
- DONE;
-}")
-
-;; Reloading an SImode or DImode value requires a scratch register if
-;; going in to or out of float point registers.
-
-(define_expand "reload_indf"
- [(set (match_operand:DF 0 "register_operand" "=Z")
- (match_operand:DF 1 "non_hard_reg_operand" ""))
- (clobber (match_operand:DF 2 "register_operand" "=&r"))]
- ""
- "
-{
- if (emit_move_sequence (operands, DFmode, operands[2]))
- DONE;
-
- /* We don't want the clobber emitted, so handle this ourselves. */
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-(define_expand "reload_outdf"
- [(set (match_operand:DF 0 "non_hard_reg_operand" "")
- (match_operand:DF 1 "register_operand" "Z"))
- (clobber (match_operand:DF 2 "register_operand" "=&r"))]
- ""
- "
-{
- if (emit_move_sequence (operands, DFmode, operands[2]))
- DONE;
-
- /* We don't want the clobber emitted, so handle this ourselves. */
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand"
- "=f,*r,RQ,?o,?Q,f,*r,*r")
- (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
- "fG,*rG,f,*r,*r,RQ,o,Q"))]
- "(register_operand (operands[0], DFmode)
- || reg_or_0_operand (operands[1], DFmode))
- && ! (GET_CODE (operands[1]) == CONST_DOUBLE
- && GET_CODE (operands[0]) == MEM)
- && ! TARGET_SOFT_FLOAT"
- "*
-{
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1])
- || operands[1] == CONST0_RTX (DFmode))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}"
- [(set_attr "type" "fpalu,move,fpstore,store,store,fpload,load,load")
- (set_attr "length" "4,8,4,8,16,4,8,16")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand"
- "=r,?o,?Q,r,r")
- (match_operand:DF 1 "reg_or_0_or_nonsymb_mem_operand"
- "rG,r,r,o,Q"))]
- "(register_operand (operands[0], DFmode)
- || reg_or_0_operand (operands[1], DFmode))
- && TARGET_SOFT_FLOAT"
- "*
-{
- return output_move_double (operands);
-}"
- [(set_attr "type" "move,store,store,load,load")
- (set_attr "length" "8,8,16,8,16")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=fx")
- (mem:DF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"flddx %1(0,%2),%0\";
- else
- return \"flddx %2(0,%1),%0\";
-}"
- [(set_attr "type" "fpload")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=fx")
- (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"flddx %2(0,%1),%0\";
- else
- return \"flddx %1(0,%2),%0\";
-}"
- [(set_attr "type" "fpload")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (mem:DF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r")))
- (match_operand:DF 0 "register_operand" "fx"))]
- "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"fstdx %0,%1(0,%2)\";
- else
- return \"fstdx %0,%2(0,%1)\";
-}"
- [(set_attr "type" "fpstore")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r")))
- (match_operand:DF 0 "register_operand" "fx"))]
- "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"fstdx %0,%2(0,%1)\";
- else
- return \"fstdx %0,%1(0,%2)\";
-}"
- [(set_attr "type" "fpstore")
- (set_attr "length" "4")])
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, DImode, 0))
- DONE;
-}")
-
-(define_expand "reload_indi"
- [(set (match_operand:DI 0 "register_operand" "=f")
- (match_operand:DI 1 "non_hard_reg_operand" ""))
- (clobber (match_operand:SI 2 "register_operand" "=&r"))]
- ""
- "
-{
- if (emit_move_sequence (operands, DImode, operands[2]))
- DONE;
-
- /* We don't want the clobber emitted, so handle this ourselves. */
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-(define_expand "reload_outdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "register_operand" "f"))
- (clobber (match_operand:SI 2 "register_operand" "=&r"))]
- ""
- "
-{
- if (emit_move_sequence (operands, DImode, operands[2]))
- DONE;
-
- /* We don't want the clobber emitted, so handle this ourselves. */
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (high:DI (match_operand 1 "" "")))]
- ""
- "*
-{
- rtx op0 = operands[0];
- rtx op1 = operands[1];
-
- if (GET_CODE (op1) == CONST_INT)
- {
- operands[0] = operand_subword (op0, 1, 0, DImode);
- output_asm_insn (\"ldil L'%1,%0\", operands);
-
- operands[0] = operand_subword (op0, 0, 0, DImode);
- if (INTVAL (op1) < 0)
- output_asm_insn (\"ldi -1,%0\", operands);
- else
- output_asm_insn (\"ldi 0,%0\", operands);
- return \"\";
- }
- else if (GET_CODE (op1) == CONST_DOUBLE)
- {
- operands[0] = operand_subword (op0, 1, 0, DImode);
- operands[1] = GEN_INT (CONST_DOUBLE_LOW (op1));
- output_asm_insn (\"ldil L'%1,%0\", operands);
-
- operands[0] = operand_subword (op0, 0, 0, DImode);
- operands[1] = GEN_INT (CONST_DOUBLE_HIGH (op1));
- output_asm_insn (singlemove_string (operands), operands);
- return \"\";
- }
- else
- abort ();
-}"
- [(set_attr "type" "move")
- (set_attr "length" "8")])
-
-;;; Experimental
-
-(define_insn ""
- [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand"
- "=r,o,Q,r,r,r,f,f,*TR")
- (match_operand:DI 1 "general_operand"
- "rM,r,r,o,Q,i,fM,*TR,f"))]
- "(register_operand (operands[0], DImode)
- || reg_or_0_operand (operands[1], DImode))
- && ! TARGET_SOFT_FLOAT"
- "*
-{
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1])
- || (operands[1] == CONST0_RTX (DImode)))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}"
- [(set_attr "type" "move,store,store,load,load,multi,fpalu,fpload,fpstore")
- (set_attr "length" "8,8,16,8,16,16,4,4,4")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand"
- "=r,o,Q,r,r,r")
- (match_operand:DI 1 "general_operand"
- "rM,r,r,o,Q,i"))]
- "(register_operand (operands[0], DImode)
- || reg_or_0_operand (operands[1], DImode))
- && TARGET_SOFT_FLOAT"
- "*
-{
- return output_move_double (operands);
-}"
- [(set_attr "type" "move,store,store,load,load,multi")
- (set_attr "length" "8,8,16,8,16,16")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r,&r")
- (lo_sum:DI (match_operand:DI 1 "register_operand" "0,r")
- (match_operand:DI 2 "immediate_operand" "i,i")))]
- ""
- "*
-{
- /* Don't output a 64 bit constant, since we can't trust the assembler to
- handle it correctly. */
- if (GET_CODE (operands[2]) == CONST_DOUBLE)
- operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[2]));
- if (which_alternative == 1)
- output_asm_insn (\"copy %1,%0\", operands);
- return \"ldo R'%G2(%R1),%R0\";
-}"
- [(set_attr "type" "move,move")
- (set_attr "length" "4,8")])
-
-;; This pattern forces (set (reg:SF ...) (const_double ...))
-;; to be reloaded by putting the constant into memory when
-;; reg is a floating point register.
-;;
-;; For integer registers we use ldil;ldo to set the appropriate
-;; value.
-;;
-;; This must come before the movsf pattern, and it must be present
-;; to handle obscure reloading cases.
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=?r,f")
- (match_operand:SF 1 "" "?F,m"))]
- "GET_CODE (operands[1]) == CONST_DOUBLE
- && operands[1] != CONST0_RTX (SFmode)
- && ! TARGET_SOFT_FLOAT"
- "* return (which_alternative == 0 ? singlemove_string (operands)
- : \" fldw%F1 %1,%0\");"
- [(set_attr "type" "move,fpload")
- (set_attr "length" "8,4")])
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, SFmode, 0))
- DONE;
-}")
-
-;; Reloading an SImode or DImode value requires a scratch register if
-;; going in to or out of float point registers.
-
-(define_expand "reload_insf"
- [(set (match_operand:SF 0 "register_operand" "=Z")
- (match_operand:SF 1 "non_hard_reg_operand" ""))
- (clobber (match_operand:SF 2 "register_operand" "=&r"))]
- ""
- "
-{
- if (emit_move_sequence (operands, SFmode, operands[2]))
- DONE;
-
- /* We don't want the clobber emitted, so handle this ourselves. */
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-(define_expand "reload_outsf"
- [(set (match_operand:SF 0 "non_hard_reg_operand" "")
- (match_operand:SF 1 "register_operand" "Z"))
- (clobber (match_operand:SF 2 "register_operand" "=&r"))]
- ""
- "
-{
- if (emit_move_sequence (operands, SFmode, operands[2]))
- DONE;
-
- /* We don't want the clobber emitted, so handle this ourselves. */
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:SF 0 "reg_or_nonsymb_mem_operand"
- "=f,r,f,r,RQ,Q")
- (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
- "fG,rG,RQ,RQ,f,rG"))]
- "(register_operand (operands[0], SFmode)
- || reg_or_0_operand (operands[1], SFmode))
- && ! TARGET_SOFT_FLOAT"
- "@
- fcpy,sgl %r1,%0
- copy %r1,%0
- fldw%F1 %1,%0
- ldw%M1 %1,%0
- fstw%F0 %r1,%0
- stw%M0 %r1,%0"
- [(set_attr "type" "fpalu,move,fpload,load,fpstore,store")
- (set_attr "pa_combine_type" "addmove")
- (set_attr "length" "4,4,4,4,4,4")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "reg_or_nonsymb_mem_operand"
- "=r,r,Q")
- (match_operand:SF 1 "reg_or_0_or_nonsymb_mem_operand"
- "rG,RQ,rG"))]
- "(register_operand (operands[0], SFmode)
- || reg_or_0_operand (operands[1], SFmode))
- && TARGET_SOFT_FLOAT"
- "@
- copy %r1,%0
- ldw%M1 %1,%0
- stw%M0 %r1,%0"
- [(set_attr "type" "move,load,store")
- (set_attr "pa_combine_type" "addmove")
- (set_attr "length" "4,4,4")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=fx")
- (mem:SF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"fldwx %1(0,%2),%0\";
- else
- return \"fldwx %2(0,%1),%0\";
-}"
- [(set_attr "type" "fpload")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=fx")
- (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r"))))]
- "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"fldwx %2(0,%1),%0\";
- else
- return \"fldwx %1(0,%2),%0\";
-}"
- [(set_attr "type" "fpload")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (mem:SF (plus:SI (match_operand:SI 1 "basereg_operand" "r")
- (match_operand:SI 2 "register_operand" "r")))
- (match_operand:SF 0 "register_operand" "fx"))]
- "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[2] == hard_frame_pointer_rtx
- || operands[2] == stack_pointer_rtx)
- return \"fstwx %0,%1(0,%2)\";
- else
- return \"fstwx %0,%2(0,%1)\";
-}"
- [(set_attr "type" "fpstore")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "basereg_operand" "r")))
- (match_operand:SF 0 "register_operand" "fx"))]
- "! TARGET_DISABLE_INDEXING && ! TARGET_SOFT_FLOAT"
- "*
-{
- /* Reload can create backwards (relative to cse) unscaled index
- address modes when eliminating registers and possibly for
- pseudos that don't get hard registers. Deal with it. */
- if (operands[1] == hard_frame_pointer_rtx
- || operands[1] == stack_pointer_rtx)
- return \"fstwx %0,%2(0,%1)\";
- else
- return \"fstwx %0,%1(0,%2)\";
-}"
- [(set_attr "type" "fpstore")
- (set_attr "length" "4")])
-
-
-;;- zero extension instructions
-;; We have define_expand for zero extension patterns to make sure the
-;; operands get loaded into registers. The define_insns accept
-;; memory operands. This gives us better overall code than just
-;; having a pattern that does or does not accept memory operands.
-
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI
- (match_operand:HI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI
- (match_operand:HI 1 "move_operand" "r,RQ")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- extru %1,31,16,%0
- ldh%M1 %1,%0"
- [(set_attr "type" "shift,load")
- (set_attr "length" "4,4")])
-
-(define_expand "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (zero_extend:HI
- (match_operand:QI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (zero_extend:HI
- (match_operand:QI 1 "move_operand" "r,RQ")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- extru %1,31,8,%0
- ldb%M1 %1,%0"
- [(set_attr "type" "shift,load")
- (set_attr "length" "4,4")])
-
-(define_expand "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI
- (match_operand:QI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI
- (match_operand:QI 1 "move_operand" "r,RQ")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- extru %1,31,8,%0
- ldb%M1 %1,%0"
- [(set_attr "type" "shift,load")
- (set_attr "length" "4,4")])
-
-;;- sign extension instructions
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
- ""
- "extrs %1,31,16,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
- ""
- "extrs %1,31,8,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
- ""
- "extrs %1,31,8,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-;; Conversions between float and double.
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float_extend:DF
- (match_operand:SF 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fcnvff,sgl,dbl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float_truncate:SF
- (match_operand:DF 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fcnvff,dbl,sgl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-;; Conversion between fixed point and floating point.
-;; Note that among the fix-to-float insns
-;; the ones that start with SImode come first.
-;; That is so that an operand that is a CONST_INT
-;; (and therefore lacks a specific machine mode).
-;; will be recognized as SImode (which is always valid)
-;; rather than as QImode or HImode.
-
-;; This pattern forces (set (reg:SF ...) (float:SF (const_int ...)))
-;; to be reloaded by putting the constant into memory.
-;; It must come before the more general floatsisf2 pattern.
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:SI 1 "const_int_operand" "m")))]
- "! TARGET_SOFT_FLOAT"
- "fldw%F1 %1,%0\;fcnvxf,sgl,sgl %0,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "8")])
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:SI 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fcnvxf,sgl,sgl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-;; This pattern forces (set (reg:DF ...) (float:DF (const_int ...)))
-;; to be reloaded by putting the constant into memory.
-;; It must come before the more general floatsidf2 pattern.
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:SI 1 "const_int_operand" "m")))]
- "! TARGET_SOFT_FLOAT"
- "fldw%F1 %1,%0\;fcnvxf,sgl,dbl %0,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "8")])
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:SI 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fcnvxf,sgl,dbl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_expand "floatunssisf2"
- [(set (subreg:SI (match_dup 2) 1)
- (match_operand:SI 1 "register_operand" ""))
- (set (subreg:SI (match_dup 2) 0)
- (const_int 0))
- (set (match_operand:SF 0 "register_operand" "")
- (float:SF (match_dup 2)))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT"
- "operands[2] = gen_reg_rtx (DImode);")
-
-(define_expand "floatunssidf2"
- [(set (subreg:SI (match_dup 2) 1)
- (match_operand:SI 1 "register_operand" ""))
- (set (subreg:SI (match_dup 2) 0)
- (const_int 0))
- (set (match_operand:DF 0 "register_operand" "")
- (float:DF (match_dup 2)))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT"
- "operands[2] = gen_reg_rtx (DImode);")
-
-(define_insn "floatdisf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:DI 1 "register_operand" "f")))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT"
- "fcnvxf,dbl,sgl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn "floatdidf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (float:DF (match_operand:DI 1 "register_operand" "f")))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT"
- "fcnvxf,dbl,dbl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-;; Convert a float to an actual integer.
-;; Truncation is performed as part of the conversion.
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "register_operand" "=f")
- (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
- "! TARGET_SOFT_FLOAT"
- "fcnvfxt,sgl,sgl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "register_operand" "=f")
- (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
- "! TARGET_SOFT_FLOAT"
- "fcnvfxt,dbl,sgl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn "fix_truncsfdi2"
- [(set (match_operand:DI 0 "register_operand" "=f")
- (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT"
- "fcnvfxt,sgl,dbl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn "fix_truncdfdi2"
- [(set (match_operand:DI 0 "register_operand" "=f")
- (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT"
- "fcnvfxt,dbl,dbl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-;;- arithmetic instructions
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_operand:DI 1 "register_operand" "%r")
- (match_operand:DI 2 "arith11_operand" "rI")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- if (INTVAL (operands[2]) >= 0)
- return \"addi %2,%R1,%R0\;addc %1,0,%0\";
- else
- return \"addi %2,%R1,%R0\;subb %1,0,%0\";
- }
- else
- return \"add %R2,%R1,%R0\;addc %2,%1,%0\";
-}"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "uaddcm %2,%1,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "4")])
-
-;; define_splits to optimize cases of adding a constant integer
-;; to a register when the constant does not fit in 14 bits. */
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "const_int_operand" "")))
- (clobber (match_operand:SI 4 "register_operand" ""))]
- "! cint_ok_for_move (INTVAL (operands[2]))
- && VAL_14_BITS_P (INTVAL (operands[2]) >> 1)"
- [(set (match_dup 4) (plus:SI (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (plus:SI (match_dup 4) (match_dup 3)))]
- "
-{
- int val = INTVAL (operands[2]);
- int low = (val < 0) ? -0x2000 : 0x1fff;
- int rest = val - low;
-
- operands[2] = GEN_INT (rest);
- operands[3] = GEN_INT (low);
-}")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "const_int_operand" "")))
- (clobber (match_operand:SI 4 "register_operand" ""))]
- "! cint_ok_for_move (INTVAL (operands[2]))"
- [(set (match_dup 4) (match_dup 2))
- (set (match_dup 0) (plus:SI (mult:SI (match_dup 4) (match_dup 3))
- (match_dup 1)))]
- "
-{
- HOST_WIDE_INT intval = INTVAL (operands[2]);
-
- /* Try dividing the constant by 2, then 4, and finally 8 to see
- if we can get a constant which can be loaded into a register
- in a single instruction (cint_ok_for_move).
-
- If that fails, try to negate the constant and subtract it
- from our input operand. */
- if (intval % 2 == 0 && cint_ok_for_move (intval / 2))
- {
- operands[2] = GEN_INT (intval / 2);
- operands[3] = GEN_INT (2);
- }
- else if (intval % 4 == 0 && cint_ok_for_move (intval / 4))
- {
- operands[2] = GEN_INT (intval / 4);
- operands[3] = GEN_INT (4);
- }
- else if (intval % 8 == 0 && cint_ok_for_move (intval / 8))
- {
- operands[2] = GEN_INT (intval / 8);
- operands[3] = GEN_INT (8);
- }
- else if (cint_ok_for_move (-intval))
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[4], GEN_INT (-intval)));
- emit_insn (gen_subsi3 (operands[0], operands[1], operands[4]));
- DONE;
- }
- else
- FAIL;
-}")
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
- (match_operand:SI 2 "arith_operand" "r,J")))]
- ""
- "@
- addl %1,%2,%0
- ldo %2(%1),%0"
- [(set_attr "type" "binary,binary")
- (set_attr "pa_combine_type" "addmove")
- (set_attr "length" "4,4")])
-
-;; Disgusting kludge to work around reload bugs with frame pointer
-;; elimination. Similar to other magic reload patterns in the
-;; indexed memory operations.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (plus:SI (plus:SI (match_operand:SI 1 "register_operand" "%r")
- (match_operand:SI 2 "register_operand" "r"))
- (match_operand:SI 3 "const_int_operand" "rL")))]
- "reload_in_progress"
- "*
-{
- if (GET_CODE (operands[3]) == CONST_INT)
- return \"ldo %3(%2),%0\;addl %1,%0,%0\";
- else
- return \"addl %3,%2,%0\;addl %1,%0,%0\";
-}"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "register_operand" "r")))]
- ""
- "sub %R1,%R2,%R0\;subb %1,%2,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (minus:SI (match_operand:SI 1 "arith11_operand" "r,I")
- (match_operand:SI 2 "register_operand" "r,r")))]
- ""
- "@
- sub %1,%2,%0
- subi %1,%2,%0"
- [(set_attr "type" "binary,binary")
- (set_attr "length" "4,4")])
-
-;; Clobbering a "register_operand" instead of a match_scratch
-;; in operand3 of millicode calls avoids spilling %r1 and
-;; produces better code.
-
-;; The mulsi3 insns set up registers for the millicode call.
-(define_expand "mulsi3"
- [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
- (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
- (parallel [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
- (clobber (match_dup 3))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))])
- (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
- ""
- "
-{
- if (TARGET_SNAKE && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT)
- {
- rtx scratch = gen_reg_rtx (DImode);
- operands[1] = force_reg (SImode, operands[1]);
- operands[2] = force_reg (SImode, operands[2]);
- emit_insn (gen_umulsidi3 (scratch, operands[1], operands[2]));
- emit_insn (gen_rtx (SET, VOIDmode,
- operands[0],
- gen_rtx (SUBREG, SImode, scratch, 1)));
- DONE;
- }
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
- (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "f"))))]
- "TARGET_SNAKE && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
- "xmpyu %1,%2,%0"
- [(set_attr "type" "fpmuldbl")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "nonimmediate_operand" "=f")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "f"))
- (match_operand:DI 2 "uint32_operand" "f")))]
- "TARGET_SNAKE && ! TARGET_DISABLE_FPREGS && ! TARGET_SOFT_FLOAT"
- "xmpyu %1,%R2,%0"
- [(set_attr "type" "fpmuldbl")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (reg:SI 29) (mult:SI (reg:SI 26) (reg:SI 25)))
- (clobber (match_operand:SI 0 "register_operand" "=a"))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))]
- ""
- "* return output_mul_insn (0, insn);"
- [(set_attr "type" "milli")
- (set (attr "length")
- (cond [
-;; Target (or stub) within reach
- (and (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0)))
- (const_int 4)
-
-;; NO_SPACE_REGS
- (ne (symbol_ref "TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS")
- (const_int 0))
- (const_int 8)
-
-;; Out of reach, but not PIC or PORTABLE_RUNTIME
-;; same as NO_SPACE_REGS code
- (and (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (eq (symbol_ref "flag_pic")
- (const_int 0)))
- (const_int 8)]
-
-;; Out of range and either PIC or PORTABLE_RUNTIME
- (const_int 24)))])
-
-;;; Division and mod.
-(define_expand "divsi3"
- [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
- (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
- (parallel [(set (reg:SI 29) (div:SI (reg:SI 26) (reg:SI 25)))
- (clobber (match_dup 3))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))])
- (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
- ""
- "
-{
- operands[3] = gen_reg_rtx (SImode);
- if (GET_CODE (operands[2]) == CONST_INT && emit_hpdiv_const (operands, 0))
- DONE;
-}")
-
-(define_insn ""
- [(set (reg:SI 29)
- (div:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
- (clobber (match_operand:SI 1 "register_operand" "=a"))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))]
- ""
- "*
- return output_div_insn (operands, 0, insn);"
- [(set_attr "type" "milli")
- (set (attr "length")
- (cond [
-;; Target (or stub) within reach
- (and (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0)))
- (const_int 4)
-
-;; NO_SPACE_REGS
- (ne (symbol_ref "TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS")
- (const_int 0))
- (const_int 8)
-
-;; Out of reach, but not PIC or PORTABLE_RUNTIME
-;; same as NO_SPACE_REGS code
- (and (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (eq (symbol_ref "flag_pic")
- (const_int 0)))
- (const_int 8)]
-
-;; Out of range and either PIC or PORTABLE_RUNTIME
- (const_int 24)))])
-
-(define_expand "udivsi3"
- [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
- (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
- (parallel [(set (reg:SI 29) (udiv:SI (reg:SI 26) (reg:SI 25)))
- (clobber (match_dup 3))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))])
- (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
- ""
- "
-{
- operands[3] = gen_reg_rtx (SImode);
- if (GET_CODE (operands[2]) == CONST_INT && emit_hpdiv_const (operands, 1))
- DONE;
-}")
-
-(define_insn ""
- [(set (reg:SI 29)
- (udiv:SI (reg:SI 26) (match_operand:SI 0 "div_operand" "")))
- (clobber (match_operand:SI 1 "register_operand" "=a"))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))]
- ""
- "*
- return output_div_insn (operands, 1, insn);"
- [(set_attr "type" "milli")
- (set (attr "length")
- (cond [
-;; Target (or stub) within reach
- (and (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0)))
- (const_int 4)
-
-;; NO_SPACE_REGS
- (ne (symbol_ref "TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS")
- (const_int 0))
- (const_int 8)
-
-;; Out of reach, but not PIC or PORTABLE_RUNTIME
-;; same as NO_SPACE_REGS code
- (and (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (eq (symbol_ref "flag_pic")
- (const_int 0)))
- (const_int 8)]
-
-;; Out of range and either PIC or PORTABLE_RUNTIME
- (const_int 24)))])
-
-(define_expand "modsi3"
- [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
- (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
- (parallel [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
- (clobber (match_dup 3))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))])
- (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
- ""
- "
-{
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-(define_insn ""
- [(set (reg:SI 29) (mod:SI (reg:SI 26) (reg:SI 25)))
- (clobber (match_operand:SI 0 "register_operand" "=a"))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))]
- ""
- "*
- return output_mod_insn (0, insn);"
- [(set_attr "type" "milli")
- (set (attr "length")
- (cond [
-;; Target (or stub) within reach
- (and (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0)))
- (const_int 4)
-
-;; NO_SPACE_REGS
- (ne (symbol_ref "TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS")
- (const_int 0))
- (const_int 8)
-
-;; Out of reach, but not PIC or PORTABLE_RUNTIME
-;; same as NO_SPACE_REGS code
- (and (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (eq (symbol_ref "flag_pic")
- (const_int 0)))
- (const_int 8)]
-
-;; Out of range and either PIC or PORTABLE_RUNTIME
- (const_int 24)))])
-
-(define_expand "umodsi3"
- [(set (reg:SI 26) (match_operand:SI 1 "move_operand" ""))
- (set (reg:SI 25) (match_operand:SI 2 "move_operand" ""))
- (parallel [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
- (clobber (match_dup 3))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))])
- (set (match_operand:SI 0 "general_operand" "") (reg:SI 29))]
- ""
- "
-{
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-(define_insn ""
- [(set (reg:SI 29) (umod:SI (reg:SI 26) (reg:SI 25)))
- (clobber (match_operand:SI 0 "register_operand" "=a"))
- (clobber (reg:SI 26))
- (clobber (reg:SI 25))
- (clobber (reg:SI 31))]
- ""
- "*
- return output_mod_insn (1, insn);"
- [(set_attr "type" "milli")
- (set (attr "length")
- (cond [
-;; Target (or stub) within reach
- (and (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0)))
- (const_int 4)
-
-;; NO_SPACE_REGS
- (ne (symbol_ref "TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS")
- (const_int 0))
- (const_int 8)
-
-;; Out of reach, but not PIC or PORTABLE_RUNTIME
-;; same as NO_SPACE_REGS code
- (and (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (eq (symbol_ref "flag_pic")
- (const_int 0)))
- (const_int 8)]
-
-;; Out of range and either PIC or PORTABLE_RUNTIME
- (const_int 24)))])
-
-;;- and instructions
-;; We define DImode `and` so with DImode `not` we can get
-;; DImode `andn`. Other combinations are possible.
-
-(define_expand "anddi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (and:DI (match_operand:DI 1 "arith_double_operand" "")
- (match_operand:DI 2 "arith_double_operand" "")))]
- ""
- "
-{
- if (! register_operand (operands[1], DImode)
- || ! register_operand (operands[2], DImode))
- /* Let GCC break this into word-at-a-time operations. */
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (match_operand:DI 1 "register_operand" "%r")
- (match_operand:DI 2 "register_operand" "r")))]
- ""
- "and %1,%2,%0\;and %R1,%R2,%R0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-; The ? for op1 makes reload prefer zdepi instead of loading a huge
-; constant with ldil;ldo.
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (and:SI (match_operand:SI 1 "register_operand" "%?r,0")
- (match_operand:SI 2 "and_operand" "rO,P")))]
- ""
- "* return output_and (operands); "
- [(set_attr "type" "binary,shift")
- (set_attr "length" "4,4")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
- (match_operand:DI 2 "register_operand" "r")))]
- ""
- "andcm %2,%1,%0\;andcm %R2,%R1,%R0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "andcm %2,%1,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "4")])
-
-(define_expand "iordi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (ior:DI (match_operand:DI 1 "arith_double_operand" "")
- (match_operand:DI 2 "arith_double_operand" "")))]
- ""
- "
-{
- if (! register_operand (operands[1], DImode)
- || ! register_operand (operands[2], DImode))
- /* Let GCC break this into word-at-a-time operations. */
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ior:DI (match_operand:DI 1 "register_operand" "%r")
- (match_operand:DI 2 "register_operand" "r")))]
- ""
- "or %1,%2,%0\;or %R1,%R2,%R0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-;; Need a define_expand because we've run out of CONST_OK... characters.
-(define_expand "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ior:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (! (ior_operand (operands[2]) || register_operand (operands[2])))
- operands[2] = force_reg (SImode, operands[2]);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (ior:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "ior_operand" "M,i")))]
- ""
- "* return output_ior (operands); "
- [(set_attr "type" "binary,shift")
- (set_attr "length" "4,4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operand:SI 1 "register_operand" "%r")
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "or %1,%2,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "4")])
-
-(define_expand "xordi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (xor:DI (match_operand:DI 1 "arith_double_operand" "")
- (match_operand:DI 2 "arith_double_operand" "")))]
- ""
- "
-{
- if (! register_operand (operands[1], DImode)
- || ! register_operand (operands[2], DImode))
- /* Let GCC break this into word-at-a-time operations. */
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (xor:DI (match_operand:DI 1 "register_operand" "%r")
- (match_operand:DI 2 "register_operand" "r")))]
- ""
- "xor %1,%2,%0\;xor %R1,%R2,%R0"
- [(set_attr "type" "binary")
- (set_attr "length" "8")])
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (xor:SI (match_operand:SI 1 "register_operand" "%r")
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "xor %1,%2,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "4")])
-
-(define_insn "negdi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (match_operand:DI 1 "register_operand" "r")))]
- ""
- "sub 0,%R1,%R0\;subb 0,%1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "8")])
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "sub 0,%1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "4")])
-
-(define_expand "one_cmpldi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (not:DI (match_operand:DI 1 "arith_double_operand" "")))]
- ""
- "
-{
- if (! register_operand (operands[1], DImode))
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (match_operand:DI 1 "register_operand" "r")))]
- ""
- "uaddcm 0,%1,%0\;uaddcm 0,%R1,%R0"
- [(set_attr "type" "unary")
- (set_attr "length" "8")])
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "uaddcm 0,%1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "4")])
-
-;; Floating point arithmetic instructions.
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (plus:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fadd,dbl %1,%2,%0"
- [(set_attr "type" "fpalu")
- (set_attr "pa_combine_type" "faddsub")
- (set_attr "length" "4")])
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (plus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fadd,sgl %1,%2,%0"
- [(set_attr "type" "fpalu")
- (set_attr "pa_combine_type" "faddsub")
- (set_attr "length" "4")])
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fsub,dbl %1,%2,%0"
- [(set_attr "type" "fpalu")
- (set_attr "pa_combine_type" "faddsub")
- (set_attr "length" "4")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (minus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fsub,sgl %1,%2,%0"
- [(set_attr "type" "fpalu")
- (set_attr "pa_combine_type" "faddsub")
- (set_attr "length" "4")])
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fmpy,dbl %1,%2,%0"
- [(set_attr "type" "fpmuldbl")
- (set_attr "pa_combine_type" "fmpy")
- (set_attr "length" "4")])
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fmpy,sgl %1,%2,%0"
- [(set_attr "type" "fpmulsgl")
- (set_attr "pa_combine_type" "fmpy")
- (set_attr "length" "4")])
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (div:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fdiv,dbl %1,%2,%0"
- [(set_attr "type" "fpdivdbl")
- (set_attr "length" "4")])
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (div:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fdiv,sgl %1,%2,%0"
- [(set_attr "type" "fpdivsgl")
- (set_attr "length" "4")])
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (neg:DF (match_operand:DF 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fsub,dbl 0,%1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (neg:SF (match_operand:SF 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fsub,sgl 0,%1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (abs:DF (match_operand:DF 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fabs,dbl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (abs:SF (match_operand:SF 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fabs,sgl %1,%0"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fsqrt,dbl %1,%0"
- [(set_attr "type" "fpsqrtdbl")
- (set_attr "length" "4")])
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
- "! TARGET_SOFT_FLOAT"
- "fsqrt,sgl %1,%0"
- [(set_attr "type" "fpsqrtsgl")
- (set_attr "length" "4")])
-
-;;- Shift instructions
-
-;; Optimized special case of shifting.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 24)))]
- ""
- "ldb%M1 %1,%0"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
- (const_int 16)))]
- ""
- "ldh%M1 %1,%0"
- [(set_attr "type" "load")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (mult:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 3 "shadd_operand" ""))
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "sh%O3addl %2,%1,%0"
- [(set_attr "type" "binary")
- (set_attr "length" "4")])
-
-;; This variant of the above insn can occur if the first operand
-;; is the frame pointer. This is a kludge, but there doesn't
-;; seem to be a way around it. Only recognize it while reloading.
-;; Note how operand 3 uses a predicate of "const_int_operand", but
-;; has constraints allowing a register. I don't know how this works,
-;; but it somehow makes sure that out-of-range constants are placed
-;; in a register which somehow magically is a "const_int_operand".
-;; (this was stolen from alpha.md, I'm not going to try and change it.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r,r")
- (plus:SI (plus:SI (mult:SI (match_operand:SI 2 "register_operand" "r,r")
- (match_operand:SI 4 "shadd_operand" ""))
- (match_operand:SI 1 "register_operand" "r,r"))
- (match_operand:SI 3 "const_int_operand" "r,J")))]
- "reload_in_progress"
- "@
- sh%O4addl %2,%1,%0\;addl %3,%0,%0
- sh%O4addl %2,%1,%0\;ldo %3(%0),%0"
- [(set_attr "type" "multi")
- (set_attr "length" "8")])
-
-(define_expand "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashift:SI (match_operand:SI 1 "lhs_lshift_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- {
- rtx temp = gen_reg_rtx (SImode);
- emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
- if (GET_CODE (operands[1]) == CONST_INT)
- emit_insn (gen_zvdep_imm (operands[0], operands[1], temp));
- else
- emit_insn (gen_zvdep32 (operands[0], operands[1], temp));
- DONE;
- }
- /* Make sure both inputs are not constants,
- there are no patterns for that. */
- operands[1] = force_reg (SImode, operands[1]);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "zdep %1,%P2,%L2,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-; Match cases of op1 a CONST_INT here that zvdep_imm doesn't handle.
-; Doing it like this makes slightly better code since reload can
-; replace a register with a known value in range -16..15 with a
-; constant. Ideally, we would like to merge zvdep32 and zvdep_imm,
-; but since we have no more CONST_OK... characters, that is not
-; possible.
-(define_insn "zvdep32"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (ashift:SI (match_operand:SI 1 "arith5_operand" "r,L")
- (minus:SI (const_int 31)
- (match_operand:SI 2 "register_operand" "q,q"))))]
- ""
- "@
- zvdep %1,32,%0
- zvdepi %1,32,%0"
- [(set_attr "type" "shift,shift")
- (set_attr "length" "4,4")])
-
-(define_insn "zvdep_imm"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "lhs_lshift_cint_operand" "")
- (minus:SI (const_int 31)
- (match_operand:SI 2 "register_operand" "q"))))]
- ""
- "*
-{
- int x = INTVAL (operands[1]);
- operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1));
- operands[1] = GEN_INT ((x & 0xf) - 0x10);
- return \"zvdepi %1,%2,%0\";
-}"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn "vdepi_ior"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (ashift:SI (match_operand:SI 1 "const_int_operand" "")
- (minus:SI (const_int 31)
- (match_operand:SI 2 "register_operand" "q")))
- (match_operand:SI 3 "register_operand" "0")))]
- ; accept ...0001...1, can this be generalized?
- "exact_log2 (INTVAL (operands[1]) + 1) >= 0"
- "*
-{
- int x = INTVAL (operands[1]);
- operands[2] = GEN_INT (exact_log2 (x + 1));
- return \"vdepi -1,%2,%0\";
-}"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn "vdepi_and"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (rotate:SI (match_operand:SI 1 "const_int_operand" "")
- (minus:SI (const_int 31)
- (match_operand:SI 2 "register_operand" "q")))
- (match_operand:SI 3 "register_operand" "0")))]
- ; this can be generalized...!
- "INTVAL (operands[1]) == -2"
- "*
-{
- int x = INTVAL (operands[1]);
- operands[2] = GEN_INT (exact_log2 ((~x) + 1));
- return \"vdepi 0,%2,%0\";
-}"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "arith32_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- {
- rtx temp = gen_reg_rtx (SImode);
- emit_insn (gen_subsi3 (temp, GEN_INT (31), operands[2]));
- emit_insn (gen_vextrs32 (operands[0], operands[1], temp));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "const_int_operand" "n")))]
- ""
- "extrs %1,%P2,%L2,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn "vextrs32"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
- (minus:SI (const_int 31)
- (match_operand:SI 2 "register_operand" "q"))))]
- ""
- "vextrs %1,32,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
- (match_operand:SI 2 "arith32_operand" "q,n")))]
- ""
- "@
- vshd 0,%1,%0
- extru %1,%P2,%L2,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn "rotrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
- (match_operand:SI 2 "arith32_operand" "q,n")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- operands[2] = GEN_INT (INTVAL (operands[2]) & 31);
- return \"shd %1,%1,%2,%0\";
- }
- else
- return \"vshd %1,%1,%0\";
-}"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operator:SI 5 "plus_xor_ior_operator"
- [(ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 3 "const_int_operand" "n"))
- (lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 4 "const_int_operand" "n"))]))]
- "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
- "shd %1,%2,%4,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operator:SI 5 "plus_xor_ior_operator"
- [(lshiftrt:SI (match_operand:SI 2 "register_operand" "r")
- (match_operand:SI 4 "const_int_operand" "n"))
- (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 3 "const_int_operand" "n"))]))]
- "INTVAL (operands[3]) + INTVAL (operands[4]) == 32"
- "shd %1,%2,%4,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "const_int_operand" ""))
- (match_operand:SI 3 "const_int_operand" "")))]
- "exact_log2 (1 + (INTVAL (operands[3]) >> (INTVAL (operands[2]) & 31))) >= 0"
- "*
-{
- int cnt = INTVAL (operands[2]) & 31;
- operands[3] = GEN_INT (exact_log2 (1 + (INTVAL (operands[3]) >> cnt)));
- operands[2] = GEN_INT (31 - cnt);
- return \"zdep %1,%2,%3,%0\";
-}"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-;; Unconditional and other jump instructions.
-
-(define_insn "return"
- [(return)]
- "hppa_can_use_return_insn_p ()"
- "bv%* 0(%%r2)"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
-
-;; Use a different pattern for functions which have non-trivial
-;; epilogues so as not to confuse jump and reorg.
-(define_insn "return_internal"
- [(use (reg:SI 2))
- (return)]
- ""
- "bv%* 0(%%r2)"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
-
-(define_expand "prologue"
- [(const_int 0)]
- ""
- "hppa_expand_prologue ();DONE;")
-
-(define_expand "epilogue"
- [(return)]
- ""
- "
-{
- /* Try to use the trivial return first. Else use the full
- epilogue. */
- if (hppa_can_use_return_insn_p ())
- emit_jump_insn (gen_return ());
- else
- {
- hppa_expand_epilogue ();
- emit_jump_insn (gen_return_internal ());
- }
- DONE;
-}")
-
-;; Special because we use the value placed in %r2 by the bl instruction
-;; from within its delay slot to set the value for the 2nd parameter to
-;; the call.
-(define_insn "call_profiler"
- [(unspec_volatile [(const_int 0)] 0)
- (use (match_operand:SI 0 "const_int_operand" ""))]
- ""
- "bl _mcount,%%r2\;ldo %0(%%r2),%%r25"
- [(set_attr "type" "multi")
- (set_attr "length" "8")])
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 2)] 0)]
- ""
- ""
- [(set_attr "length" "0")])
-
-(define_insn "switch_jump"
- [(set:DI (pc) (label_ref (match_operand 0 "" "")))]
- ""
- "bl %l0,0%#"
- [(set_attr "type" "uncond_branch")
- (set_attr "length" "4")])
-
-(define_insn "jump"
- [(set (pc) (label_ref (match_operand 0 "" "")))]
- ""
- "bl%* %l0,0"
- [(set_attr "type" "uncond_branch")
- (set_attr "pa_combine_type" "uncond_branch")
- (set (attr "length")
- (cond [(eq (symbol_ref "jump_in_call_delay (insn)") (const_int 0))
- (const_int 4)
-;; If the jump is in the delay slot of a call, then its length depends
-;; on whether or not we can add the proper offset to %r2 with an ldo
-;; instruction.
- (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)]
- (const_int 8)))])
-
-;; Subroutines of "casesi".
-;; operand 0 is index
-;; operand 1 is the minimum bound
-;; operand 2 is the maximum bound - minimum bound + 1
-;; operand 3 is CODE_LABEL for the table;
-;; operand 4 is the CODE_LABEL to go to if index out of range.
-
-(define_expand "casesi"
- [(match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "const_int_operand" "")
- (match_operand:SI 2 "const_int_operand" "")
- (match_operand 3 "" "")
- (match_operand 4 "" "")]
- ""
- "
-{
- if (GET_CODE (operands[0]) != REG)
- operands[0] = force_reg (SImode, operands[0]);
-
- if (operands[1] != const0_rtx)
- {
- rtx reg = gen_reg_rtx (SImode);
-
- operands[1] = GEN_INT (-INTVAL (operands[1]));
- if (!INT_14_BITS (operands[1]))
- operands[1] = force_reg (SImode, operands[1]);
- emit_insn (gen_addsi3 (reg, operands[0], operands[1]));
-
- operands[0] = reg;
- }
-
- if (!INT_11_BITS (operands[2]))
- operands[2] = force_reg (SImode, operands[2]);
-
- emit_jump_insn (gen_casesi0 (operands[0], operands[2],
- operands[3], operands[4]));
- DONE;
-}")
-
-(define_insn "casesi0"
- [(set (pc)
- (if_then_else (leu (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "arith11_operand" "rI"))
- (plus:SI (mem:SI (plus:SI (pc) (match_dup 0)))
- (label_ref (match_operand 2 "" "")))
- (pc)))
- (use (label_ref (match_operand 3 "" "")))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- operands[1] = GEN_INT (~INTVAL (operands[1]));
- return \"addi,uv %1,%0,0\;blr,n %0,0\;b,n %l3\";
- }
- else
- {
- return \"sub,>> %0,%1,0\;blr,n %0,0\;b,n %l3\";
- }
-}"
- [(set_attr "type" "multi")
- (set_attr "length" "12")])
-
-;; Need nops for the calls because execution is supposed to continue
-;; past; we don't want to nullify an instruction that we need.
-;;- jump to subroutine
-
-(define_expand "call"
- [(parallel [(call (match_operand:SI 0 "" "")
- (match_operand 1 "" ""))
- (clobber (reg:SI 2))])]
- ""
- "
-{
- rtx op;
- rtx call_insn;
-
- if (TARGET_PORTABLE_RUNTIME)
- op = force_reg (SImode, XEXP (operands[0], 0));
- else
- op = XEXP (operands[0], 0);
-
- /* Use two different patterns for calls to explicitly named functions
- and calls through function pointers. This is necessary as these two
- types of calls use different calling conventions, and CSE might try
- to change the named call into an indirect call in some cases (using
- two patterns keeps CSE from performing this optimization). */
- if (GET_CODE (op) == SYMBOL_REF)
- call_insn = emit_call_insn (gen_call_internal_symref (op, operands[1]));
- else
- {
- rtx tmpreg = gen_rtx (REG, SImode, 22);
- emit_move_insn (tmpreg, force_reg (SImode, op));
- call_insn = emit_call_insn (gen_call_internal_reg (operands[1]));
- }
-
- if (flag_pic)
- {
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
-
- /* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx (REG, SImode, PIC_OFFSET_TABLE_REGNUM_SAVED));
- emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
-
- /* Gross. We have to keep the scheduler from moving the restore
- of the PIC register away from the call. SCHED_GROUP_P is
- supposed to do this, but for some reason the compiler will
- go into an infinite loop when we use that.
-
- This method (blockage insn) may make worse code (then again
- it may not since calls are nearly blockages anyway), but at
- least it should work. */
- emit_insn (gen_blockage ());
- }
- DONE;
-}")
-
-(define_insn "call_internal_symref"
- [(call (mem:SI (match_operand:SI 0 "call_operand_address" ""))
- (match_operand 1 "" "i"))
- (clobber (reg:SI 2))
- (use (const_int 0))]
- "! TARGET_PORTABLE_RUNTIME"
- "*
-{
- output_arg_descriptor (insn);
- return output_call (insn, operands[0], gen_rtx (REG, SImode, 2));
-}"
- [(set_attr "type" "call")
- (set (attr "length")
-;; If we're sure that we can either reach the target or that the
-;; linker can use a long-branch stub, then the length is 4 bytes.
-;;
-;; For long-calls the length will be either 52 bytes (non-pic)
-;; or 68 bytes (pic). */
-;; Else we have to use a long-call;
- (if_then_else (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (const_int 4)
- (if_then_else (eq (symbol_ref "flag_pic")
- (const_int 0))
- (const_int 52)
- (const_int 68))))])
-
-(define_insn "call_internal_reg"
- [(call (mem:SI (reg:SI 22))
- (match_operand 0 "" "i"))
- (clobber (reg:SI 2))
- (use (const_int 1))]
- ""
- "*
-{
- rtx xoperands[2];
-
- /* First the special case for kernels, level 0 systems, etc. */
- if (TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS)
- return \"ble 0(%%sr4,%%r22)\;copy %%r31,%%r2\";
-
- /* Now the normal case -- we can reach $$dyncall directly or
- we're sure that we can get there via a long-branch stub.
-
- No need to check target flags as the length uniquely identifies
- the remaining cases. */
- if (get_attr_length (insn) == 8)
- return \".CALL\\tARGW0=GR\;bl $$dyncall,%%r31\;copy %%r31,%%r2\";
-
- /* Long millicode call, but we are not generating PIC or portable runtime
- code. */
- if (get_attr_length (insn) == 12)
- return \"CALL\\tARGW0=GR\;ldil L%%$$dyncall,%%r2\;ble R%%$$dyncall(%%sr4,%%r2)\;copy %%r31,%%r2\";
-
- /* Long millicode call for portable runtime. */
- if (get_attr_length (insn) == 20)
- return \"ldil L%%$$dyncall,%%r31\;ldo R%%$$dyncall(%%r31),%%r31\;blr 0,%%r2\;bv,n 0(%%r31)\;nop\";
-
- /* If we're generating PIC code. */
- xoperands[0] = operands[0];
- xoperands[1] = gen_label_rtx ();
- output_asm_insn (\"bl .+8,%%r1\", xoperands);
- output_asm_insn (\"addil L%%$$dyncall-%1,%%r1\", xoperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xoperands[1]));
- output_asm_insn (\"ldo R%%$$dyncall-%1(%%r1),%%r1\", xoperands);
- output_asm_insn (\"blr 0,%%r2\", xoperands);
- output_asm_insn (\"bv,n 0(%%r1)\\n\\tnop\", xoperands);
- return \"\";
-}"
- [(set_attr "type" "dyncall")
- (set (attr "length")
- (cond [
-;; First NO_SPACE_REGS
- (ne (symbol_ref "TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS")
- (const_int 0))
- (const_int 8)
-
-;; Target (or stub) within reach
- (and (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0)))
- (const_int 8)
-
-;; Out of reach, but not PIC or PORTABLE_RUNTIME
- (and (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (eq (symbol_ref "flag_pic")
- (const_int 0)))
- (const_int 12)
-
- (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (const_int 20)]
-
-;; Out of range PIC case
- (const_int 24)))])
-
-(define_expand "call_value"
- [(parallel [(set (match_operand 0 "" "")
- (call (match_operand:SI 1 "" "")
- (match_operand 2 "" "")))
- (clobber (reg:SI 2))])]
- ""
- "
-{
- rtx op;
- rtx call_insn;
-
- if (TARGET_PORTABLE_RUNTIME)
- op = force_reg (SImode, XEXP (operands[1], 0));
- else
- op = XEXP (operands[1], 0);
-
- /* Use two different patterns for calls to explicitly named functions
- and calls through function pointers. This is necessary as these two
- types of calls use different calling conventions, and CSE might try
- to change the named call into an indirect call in some cases (using
- two patterns keeps CSE from performing this optimization). */
- if (GET_CODE (op) == SYMBOL_REF)
- call_insn = emit_call_insn (gen_call_value_internal_symref (operands[0],
- op,
- operands[2]));
- else
- {
- rtx tmpreg = gen_rtx (REG, SImode, 22);
- emit_move_insn (tmpreg, force_reg (SImode, op));
- call_insn = emit_call_insn (gen_call_value_internal_reg (operands[0],
- operands[2]));
- }
- if (flag_pic)
- {
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
-
- /* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx (REG, SImode, PIC_OFFSET_TABLE_REGNUM_SAVED));
- emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
-
- /* Gross. We have to keep the scheduler from moving the restore
- of the PIC register away from the call. SCHED_GROUP_P is
- supposed to do this, but for some reason the compiler will
- go into an infinite loop when we use that.
-
- This method (blockage insn) may make worse code (then again
- it may not since calls are nearly blockages anyway), but at
- least it should work. */
- emit_insn (gen_blockage ());
- }
- DONE;
-}")
-
-(define_insn "call_value_internal_symref"
- [(set (match_operand 0 "" "=rf")
- (call (mem:SI (match_operand:SI 1 "call_operand_address" ""))
- (match_operand 2 "" "i")))
- (clobber (reg:SI 2))
- (use (const_int 0))]
- ;;- Don't use operand 1 for most machines.
- "! TARGET_PORTABLE_RUNTIME"
- "*
-{
- output_arg_descriptor (insn);
- return output_call (insn, operands[1], gen_rtx (REG, SImode, 2));
-}"
- [(set_attr "type" "call")
- (set (attr "length")
-;; If we're sure that we can either reach the target or that the
-;; linker can use a long-branch stub, then the length is 4 bytes.
-;;
-;; For long-calls the length will be either 52 bytes (non-pic)
-;; or 68 bytes (pic). */
-;; Else we have to use a long-call;
- (if_then_else (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (const_int 4)
- (if_then_else (eq (symbol_ref "flag_pic")
- (const_int 0))
- (const_int 52)
- (const_int 68))))])
-
-(define_insn "call_value_internal_reg"
- [(set (match_operand 0 "" "=rf")
- (call (mem:SI (reg:SI 22))
- (match_operand 1 "" "i")))
- (clobber (reg:SI 2))
- (use (const_int 1))]
- ""
- "*
-{
- rtx xoperands[2];
-
- /* First the special case for kernels, level 0 systems, etc. */
- if (TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS)
- return \"ble 0(%%sr4,%%r22)\;copy %%r31,%%r2\";
-
- /* Now the normal case -- we can reach $$dyncall directly or
- we're sure that we can get there via a long-branch stub.
-
- No need to check target flags as the length uniquely identifies
- the remaining cases. */
- if (get_attr_length (insn) == 8)
- return \".CALL\\tARGW0=GR\;bl $$dyncall,%%r31\;copy %%r31,%%r2\";
-
- /* Long millicode call, but we are not generating PIC or portable runtime
- code. */
- if (get_attr_length (insn) == 12)
- return \".CALL\\tARGW0=GR\;ldil L%%$$dyncall,%%r2\;ble R%%$$dyncall(%%sr4,%%r2)\;copy %%r31,%%r2\";
-
- /* Long millicode call for portable runtime. */
- if (get_attr_length (insn) == 20)
- return \"ldil L%%$$dyncall,%%r31\;ldo R%%$$dyncall(%%r31),%%r31\;blr 0,%%r2\;bv,n 0(%%r31)\;nop\";
-
- /* If we're generating PIC code. */
- xoperands[0] = operands[1];
- xoperands[1] = gen_label_rtx ();
- output_asm_insn (\"bl .+8,%%r1\", xoperands);
- output_asm_insn (\"addil L%%$$dyncall-%1,%%r1\", xoperands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xoperands[1]));
- output_asm_insn (\"ldo R%%$$dyncall-%1(%%r1),%%r1\", xoperands);
- output_asm_insn (\"blr 0,%%r2\", xoperands);
- output_asm_insn (\"bv,n 0(%%r1)\\n\\tnop\", xoperands);
- return \"\";
-}"
- [(set_attr "type" "dyncall")
- (set (attr "length")
- (cond [
-;; First NO_SPACE_REGS
- (ne (symbol_ref "TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS")
- (const_int 0))
- (const_int 8)
-
-;; Target (or stub) within reach
- (and (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0)))
- (const_int 8)
-
-;; Out of reach, but not PIC or PORTABLE_RUNTIME
- (and (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (eq (symbol_ref "flag_pic")
- (const_int 0)))
- (const_int 12)
-
- (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (const_int 20)]
-
-;; Out of range PIC case
- (const_int 24)))])
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop"
- [(set_attr "type" "move")
- (set_attr "length" "4")])
-
-;; These are just placeholders so we know where branch tables
-;; begin and end.
-(define_insn "begin_brtab"
- [(const_int 1)]
- "TARGET_GAS"
- ".begin_brtab"
- [(set_attr "type" "move")
- (set_attr "length" "0")])
-
-(define_insn "end_brtab"
- [(const_int 2)]
- "TARGET_GAS"
- ".end_brtab"
- [(set_attr "type" "move")
- (set_attr "length" "0")])
-
-;;; Hope this is only within a function...
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
- ""
- "bv%* 0(%0)"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
-
-(define_insn "extzv"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "uint5_operand" "")
- (match_operand:SI 3 "uint5_operand" "")))]
- ""
- "extru %1,%3+%2-1,%2,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 3 "register_operand" "q")))]
- ""
- "vextru %1,1,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn "extv"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "uint5_operand" "")
- (match_operand:SI 3 "uint5_operand" "")))]
- ""
- "extrs %1,%3+%2-1,%2,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 1)
- (match_operand:SI 3 "register_operand" "q")))]
- ""
- "vextrs %1,1,%0"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-(define_insn "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r,r")
- (match_operand:SI 1 "uint5_operand" "")
- (match_operand:SI 2 "uint5_operand" ""))
- (match_operand:SI 3 "arith5_operand" "r,L"))]
- ""
- "@
- dep %3,%2+%1-1,%1,%0
- depi %3,%2+%1-1,%1,%0"
- [(set_attr "type" "shift,shift")
- (set_attr "length" "4,4")])
-
-;; Optimize insertion of const_int values of type 1...1xxxx.
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
- (match_operand:SI 1 "uint5_operand" "")
- (match_operand:SI 2 "uint5_operand" ""))
- (match_operand:SI 3 "const_int_operand" ""))]
- "(INTVAL (operands[3]) & 0x10) != 0 &&
- (~INTVAL (operands[3]) & (1L << INTVAL (operands[1])) - 1 & ~0xf) == 0"
- "*
-{
- operands[3] = GEN_INT ((INTVAL (operands[3]) & 0xf) - 0x10);
- return \"depi %3,%2+%1-1,%1,%0\";
-}"
- [(set_attr "type" "shift")
- (set_attr "length" "4")])
-
-;; This insn is used for some loop tests, typically loops reversed when
-;; strength reduction is used. It is actually created when the instruction
-;; combination phase combines the special loop test. Since this insn
-;; is both a jump insn and has an output, it must deal with it's own
-;; reloads, hence the `m' constraints. The `!' constraints direct reload
-;; to not choose the register alternatives in the event a reload is needed.
-(define_insn "decrement_and_branch_until_zero"
- [(set (pc)
- (if_then_else
- (match_operator 2 "comparison_operator"
- [(plus:SI (match_operand:SI 0 "register_operand" "+!r,!*f,!*m")
- (match_operand:SI 1 "int5_operand" "L,L,L"))
- (const_int 0)])
- (label_ref (match_operand 3 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0) (match_dup 1)))
- (clobber (match_scratch:SI 4 "=X,r,r"))]
- ""
- "* return output_dbra (operands, insn, which_alternative); "
-;; Do not expect to understand this the first time through.
-[(set_attr "type" "cbranch,multi,multi")
- (set (attr "length")
- (if_then_else (eq_attr "alternative" "0")
-;; Loop counter in register case
-;; Short branch has length of 4
-;; Long branch has length of 8
- (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8))
-
-;; Loop counter in FP reg case.
-;; Extra goo to deal with additional reload insns.
- (if_then_else (eq_attr "alternative" "1")
- (if_then_else (lt (match_dup 3) (pc))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
- (const_int 8184))
- (const_int 24)
- (const_int 28))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 24)
- (const_int 28)))
-;; Loop counter in memory case.
-;; Extra goo to deal with additional reload insns.
- (if_then_else (lt (match_dup 3) (pc))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
- (const_int 8184))
- (const_int 12)
- (const_int 16))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 12)
- (const_int 16))))))])
-
-;; Simply another variant of the dbra pattern. More restrictive
-;; in testing the comparison operator as it must worry about overflow
-;; problems.
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 2 "eq_neq_comparison_operator"
- [(match_operand:SI 0 "register_operand" "+!r,!*f,!*m")
- (match_operand:SI 5 "const_int_operand" "")])
- (label_ref (match_operand 3 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0) (match_operand:SI 1 "int5_operand" "L,L,L")))
- (clobber (match_scratch:SI 4 "=X,r,r"))]
- "INTVAL (operands[5]) == - INTVAL (operands[1])"
-"* return output_dbra (operands, insn, which_alternative);"
-;; Do not expect to understand this the first time through.
-[(set_attr "type" "cbranch,multi,multi")
- (set (attr "length")
- (if_then_else (eq_attr "alternative" "0")
-;; Loop counter in register case
-;; Short branch has length of 4
-;; Long branch has length of 8
- (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8))
-
-;; Loop counter in FP reg case.
-;; Extra goo to deal with additional reload insns.
- (if_then_else (eq_attr "alternative" "1")
- (if_then_else (lt (match_dup 3) (pc))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 24))))
- (const_int 8184))
- (const_int 24)
- (const_int 28))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 24)
- (const_int 28)))
-;; Loop counter in memory case.
-;; Extra goo to deal with additional reload insns.
- (if_then_else (lt (match_dup 3) (pc))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
- (const_int 8184))
- (const_int 12)
- (const_int 16))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 12)
- (const_int 16))))))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 2 "movb_comparison_operator"
- [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
- (label_ref (match_operand 3 "" ""))
- (pc)))
- (set (match_operand:SI 0 "register_operand" "=!r,!*f,!*m,!*q")
- (match_dup 1))]
- ""
-"* return output_movb (operands, insn, which_alternative, 0); "
-;; Do not expect to understand this the first time through.
-[(set_attr "type" "cbranch,multi,multi,multi")
- (set (attr "length")
- (if_then_else (eq_attr "alternative" "0")
-;; Loop counter in register case
-;; Short branch has length of 4
-;; Long branch has length of 8
- (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8))
-
-;; Loop counter in FP reg case.
-;; Extra goo to deal with additional reload insns.
- (if_then_else (eq_attr "alternative" "1")
- (if_then_else (lt (match_dup 3) (pc))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
- (const_int 8184))
- (const_int 12)
- (const_int 16))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 12)
- (const_int 16)))
-;; Loop counter in memory or sar case.
-;; Extra goo to deal with additional reload insns.
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 8)
- (const_int 12)))))])
-
-;; Handle negated branch.
-(define_insn ""
- [(set (pc)
- (if_then_else
- (match_operator 2 "movb_comparison_operator"
- [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)])
- (pc)
- (label_ref (match_operand 3 "" ""))))
- (set (match_operand:SI 0 "register_operand" "=!r,!*f,!*m,!*q")
- (match_dup 1))]
- ""
-"* return output_movb (operands, insn, which_alternative, 1); "
-;; Do not expect to understand this the first time through.
-[(set_attr "type" "cbranch,multi,multi,multi")
- (set (attr "length")
- (if_then_else (eq_attr "alternative" "0")
-;; Loop counter in register case
-;; Short branch has length of 4
-;; Long branch has length of 8
- (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8))
-
-;; Loop counter in FP reg case.
-;; Extra goo to deal with additional reload insns.
- (if_then_else (eq_attr "alternative" "1")
- (if_then_else (lt (match_dup 3) (pc))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 12))))
- (const_int 8184))
- (const_int 12)
- (const_int 16))
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 12)
- (const_int 16)))
-;; Loop counter in memory or SAR case.
-;; Extra goo to deal with additional reload insns.
- (if_then_else
- (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 8)
- (const_int 12)))))])
-
-;; The next several patterns (parallel_addb, parallel_movb, fmpyadd and
-;; fmpysub aren't currently used by the FSF sources, but will be soon.
-;;
-;; They're in the FSF tree for documentation and to make Cygnus<->FSF
-;; merging easier.
-(define_insn ""
- [(set (pc) (label_ref (match_operand 3 "" "" )))
- (set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "ireg_or_int5_operand" "rL")))]
- "reload_completed && operands[0] == operands[1] || operands[0] == operands[2]"
- "*
-{
- return output_parallel_addb (operands, get_attr_length (insn));
-}"
- [(set_attr "type" "parallel_branch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 3) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc) (label_ref (match_operand 2 "" "" )))
- (set (match_operand:SF 0 "register_operand" "=r")
- (match_operand:SF 1 "ireg_or_int5_operand" "rL"))]
- "reload_completed"
- "*
-{
- return output_parallel_movb (operands, get_attr_length (insn));
-}"
- [(set_attr "type" "parallel_branch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc) (label_ref (match_operand 2 "" "" )))
- (set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "ireg_or_int5_operand" "rL"))]
- "reload_completed"
- "*
-{
- return output_parallel_movb (operands, get_attr_length (insn));
-}"
- [(set_attr "type" "parallel_branch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc) (label_ref (match_operand 2 "" "" )))
- (set (match_operand:HI 0 "register_operand" "=r")
- (match_operand:HI 1 "ireg_or_int5_operand" "rL"))]
- "reload_completed"
- "*
-{
- return output_parallel_movb (operands, get_attr_length (insn));
-}"
- [(set_attr "type" "parallel_branch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (pc) (label_ref (match_operand 2 "" "" )))
- (set (match_operand:QI 0 "register_operand" "=r")
- (match_operand:QI 1 "ireg_or_int5_operand" "rL"))]
- "reload_completed"
- "*
-{
- return output_parallel_movb (operands, get_attr_length (insn));
-}"
- [(set_attr "type" "parallel_branch")
- (set (attr "length")
- (if_then_else (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8))))
- (const_int 8184))
- (const_int 4)
- (const_int 8)))])
-
-(define_insn ""
- [(set (match_operand 0 "register_operand" "=f")
- (mult (match_operand 1 "register_operand" "f")
- (match_operand 2 "register_operand" "f")))
- (set (match_operand 3 "register_operand" "+f")
- (plus (match_operand 4 "register_operand" "f")
- (match_operand 5 "register_operand" "f")))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT
- && reload_completed && fmpyaddoperands (operands)"
- "*
-{
- if (GET_MODE (operands[0]) == DFmode)
- {
- if (rtx_equal_p (operands[3], operands[5]))
- return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
- else
- return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
- }
- else
- {
- if (rtx_equal_p (operands[3], operands[5]))
- return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
- else
- return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
- }
-}"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand 3 "register_operand" "+f")
- (plus (match_operand 4 "register_operand" "f")
- (match_operand 5 "register_operand" "f")))
- (set (match_operand 0 "register_operand" "=f")
- (mult (match_operand 1 "register_operand" "f")
- (match_operand 2 "register_operand" "f")))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT
- && reload_completed && fmpyaddoperands (operands)"
- "*
-{
- if (GET_MODE (operands[0]) == DFmode)
- {
- if (rtx_equal_p (operands[3], operands[5]))
- return \"fmpyadd,dbl %1,%2,%0,%4,%3\";
- else
- return \"fmpyadd,dbl %1,%2,%0,%5,%3\";
- }
- else
- {
- if (rtx_equal_p (operands[3], operands[5]))
- return \"fmpyadd,sgl %1,%2,%0,%4,%3\";
- else
- return \"fmpyadd,sgl %1,%2,%0,%5,%3\";
- }
-}"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand 0 "register_operand" "=f")
- (mult (match_operand 1 "register_operand" "f")
- (match_operand 2 "register_operand" "f")))
- (set (match_operand 3 "register_operand" "+f")
- (minus (match_operand 4 "register_operand" "f")
- (match_operand 5 "register_operand" "f")))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT
- && reload_completed && fmpysuboperands (operands)"
- "*
-{
- if (GET_MODE (operands[0]) == DFmode)
- return \"fmpysub,dbl %1,%2,%0,%5,%3\";
- else
- return \"fmpysub,sgl %1,%2,%0,%5,%3\";
-}"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-(define_insn ""
- [(set (match_operand 3 "register_operand" "+f")
- (minus (match_operand 4 "register_operand" "f")
- (match_operand 5 "register_operand" "f")))
- (set (match_operand 0 "register_operand" "=f")
- (mult (match_operand 1 "register_operand" "f")
- (match_operand 2 "register_operand" "f")))]
- "TARGET_SNAKE && ! TARGET_SOFT_FLOAT
- && reload_completed && fmpysuboperands (operands)"
- "*
-{
- if (GET_MODE (operands[0]) == DFmode)
- return \"fmpysub,dbl %1,%2,%0,%5,%3\";
- else
- return \"fmpysub,sgl %1,%2,%0,%5,%3\";
-}"
- [(set_attr "type" "fpalu")
- (set_attr "length" "4")])
-
-;; Clean up turds left by reload.
-(define_peephole
- [(set (match_operand 0 "reg_or_nonsymb_mem_operand" "")
- (match_operand 1 "register_operand" "f"))
- (set (match_operand 2 "register_operand" "f")
- (match_dup 0))]
- "! TARGET_SOFT_FLOAT
- && GET_CODE (operands[0]) == MEM
- && ! MEM_VOLATILE_P (operands[0])
- && GET_MODE (operands[0]) == GET_MODE (operands[1])
- && GET_MODE (operands[0]) == GET_MODE (operands[2])
- && GET_MODE (operands[0]) == DFmode
- && REGNO_REG_CLASS (REGNO (operands[1]))
- == REGNO_REG_CLASS (REGNO (operands[2]))"
- "*
-{
- enum machine_mode mode = GET_MODE (operands[0]);
- rtx xoperands[2];
-
- if (FP_REG_P (operands[1]))
- output_asm_insn (output_fp_move_double (operands), operands);
- else
- output_asm_insn (output_move_double (operands), operands);
-
- if (rtx_equal_p (operands[1], operands[2]))
- return \"\";
-
- xoperands[0] = operands[2];
- xoperands[1] = operands[1];
-
- if (FP_REG_P (xoperands[1]))
- output_asm_insn (output_fp_move_double (xoperands), xoperands);
- else
- output_asm_insn (output_move_double (xoperands), xoperands);
-
- return \"\";
-}")
-
-(define_peephole
- [(set (match_operand 0 "register_operand" "f")
- (match_operand 1 "reg_or_nonsymb_mem_operand" ""))
- (set (match_operand 2 "register_operand" "f")
- (match_dup 1))]
- "! TARGET_SOFT_FLOAT
- && GET_CODE (operands[1]) == MEM
- && ! MEM_VOLATILE_P (operands[1])
- && GET_MODE (operands[0]) == GET_MODE (operands[1])
- && GET_MODE (operands[0]) == GET_MODE (operands[2])
- && GET_MODE (operands[0]) == DFmode
- && REGNO_REG_CLASS (REGNO (operands[1]))
- == REGNO_REG_CLASS (REGNO (operands[2]))"
- "*
-{
- enum machine_mode mode = GET_MODE (operands[0]);
- rtx xoperands[2];
-
- if (FP_REG_P (operands[0]))
- output_asm_insn (output_fp_move_double (operands), operands);
- else
- output_asm_insn (output_move_double (operands), operands);
-
- xoperands[0] = operands[2];
- xoperands[1] = operands[0];
-
- if (FP_REG_P (xoperands[1]))
- output_asm_insn (output_fp_move_double (xoperands), xoperands);
- else
- output_asm_insn (output_move_double (xoperands), xoperands);
-
- return \"\";
-}")
-
-;; Flush the I and D cache line found at the address in operand 0.
-;; This is used by the trampoline code for nested functions.
-;; So long as the trampoline itself is less than 32 bytes this
-;; is sufficient.
-
-(define_insn "dcacheflush"
- [(unspec_volatile [(const_int 1)] 0)
- (use (mem:SI (match_operand:SI 0 "register_operand" "r")))
- (use (mem:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "fdc 0(0,%0)\;fdc 0(0,%1)\;sync"
- [(set_attr "type" "multi")
- (set_attr "length" "12")])
-
-(define_insn "icacheflush"
- [(unspec_volatile [(const_int 2)] 0)
- (use (mem:SI (match_operand:SI 0 "register_operand" "r")))
- (use (mem:SI (match_operand:SI 1 "register_operand" "r")))
- (use (match_operand:SI 2 "register_operand" "r"))
- (clobber (match_operand:SI 3 "register_operand" "=&r"))
- (clobber (match_operand:SI 4 "register_operand" "=&r"))]
- ""
- "mfsp %%sr0,%4\;ldsid (0,%2),%3\;mtsp %3,%%sr0\;fic 0(%%sr0,%0)\;fic 0(%%sr0,%1)\;sync\;mtsp %4,%%sr0\;nop\;nop\;nop\;nop\;nop\;nop"
- [(set_attr "type" "multi")
- (set_attr "length" "52")])
-
-;; An out-of-line prologue.
-(define_insn "outline_prologue_call"
- [(unspec_volatile [(const_int 0)] 0)
- (clobber (reg:SI 31))
- (clobber (reg:SI 22))
- (clobber (reg:SI 21))
- (clobber (reg:SI 20))
- (clobber (reg:SI 19))
- (clobber (reg:SI 1))]
- ""
- "*
-{
- extern int frame_pointer_needed;
-
- /* We need two different versions depending on whether or not we
- need a frame pointer. Also note that we return to the instruction
- immediately after the branch rather than two instructions after the
- break as normally is the case. */
- if (frame_pointer_needed)
- {
- /* Must import the magic millicode routine(s). */
- output_asm_insn (\".IMPORT __outline_prologue_fp,MILLICODE\", NULL);
-
- if (TARGET_PORTABLE_RUNTIME)
- {
- output_asm_insn (\"ldil L'__outline_prologue_fp,%%r31\", NULL);
- output_asm_insn (\"ble,n R'__outline_prologue_fp(%%sr0,%%r31)\",
- NULL);
- }
- else
- output_asm_insn (\"bl,n __outline_prologue_fp,%%r31\", NULL);
- }
- else
- {
- /* Must import the magic millicode routine(s). */
- output_asm_insn (\".IMPORT __outline_prologue,MILLICODE\", NULL);
-
- if (TARGET_PORTABLE_RUNTIME)
- {
- output_asm_insn (\"ldil L'__outline_prologue,%%r31\", NULL);
- output_asm_insn (\"ble,n R'__outline_prologue(%%sr0,%%r31)\", NULL);
- }
- else
- output_asm_insn (\"bl,n __outline_prologue,%%r31\", NULL);
- }
- return \"\";
-}"
- [(set_attr "type" "multi")
- (set_attr "length" "8")])
-
-;; An out-of-line epilogue.
-(define_insn "outline_epilogue_call"
- [(unspec_volatile [(const_int 1)] 0)
- (use (reg:SI 29))
- (use (reg:SI 28))
- (clobber (reg:SI 31))
- (clobber (reg:SI 22))
- (clobber (reg:SI 21))
- (clobber (reg:SI 20))
- (clobber (reg:SI 19))
- (clobber (reg:SI 2))
- (clobber (reg:SI 1))]
- ""
- "*
-{
- extern int frame_pointer_needed;
-
- /* We need two different versions depending on whether or not we
- need a frame pointer. Also note that we return to the instruction
- immediately after the branch rather than two instructions after the
- break as normally is the case. */
- if (frame_pointer_needed)
- {
- /* Must import the magic millicode routine. */
- output_asm_insn (\".IMPORT __outline_epilogue_fp,MILLICODE\", NULL);
-
- /* The out-of-line prologue will make sure we return to the right
- instruction. */
- if (TARGET_PORTABLE_RUNTIME)
- {
- output_asm_insn (\"ldil L'__outline_epilogue_fp,%%r31\", NULL);
- output_asm_insn (\"ble,n R'__outline_epilogue_fp(%%sr0,%%r31)\",
- NULL);
- }
- else
- output_asm_insn (\"bl,n __outline_epilogue_fp,%%r31\", NULL);
- }
- else
- {
- /* Must import the magic millicode routine. */
- output_asm_insn (\".IMPORT __outline_epilogue,MILLICODE\", NULL);
-
- /* The out-of-line prologue will make sure we return to the right
- instruction. */
- if (TARGET_PORTABLE_RUNTIME)
- {
- output_asm_insn (\"ldil L'__outline_epilogue,%%r31\", NULL);
- output_asm_insn (\"ble,n R'__outline_epilogue(%%sr0,%%r31)\", NULL);
- }
- else
- output_asm_insn (\"bl,n __outline_epilogue,%%r31\", NULL);
- }
- return \"\";
-}"
- [(set_attr "type" "multi")
- (set_attr "length" "8")])
-
-;; Given a function pointer, canonicalize it so it can be
-;; reliably compared to another function pointer. */
-(define_expand "canonicalize_funcptr_for_compare"
- [(set (reg:SI 26) (match_operand:SI 1 "register_operand" ""))
- (parallel [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] 0))
- (clobber (match_dup 2))
- (clobber (reg:SI 26))
- (clobber (reg:SI 22))
- (clobber (reg:SI 31))])
- (set (match_operand:SI 0 "register_operand" "")
- (reg:SI 29))]
- "! TARGET_PORTABLE_RUNTIME"
- "
-{
- operands[2] = gen_reg_rtx (SImode);
- if (GET_CODE (operands[1]) != REG)
- {
- rtx tmp = gen_reg_rtx (Pmode);
- emit_move_insn (tmp, operands[1]);
- operands[1] = tmp;
- }
-}")
-
-(define_insn ""
- [(set (reg:SI 29) (unspec:SI [(reg:SI 26)] 0))
- (clobber (match_operand:SI 0 "register_operand" "=a"))
- (clobber (reg:SI 26))
- (clobber (reg:SI 22))
- (clobber (reg:SI 31))]
- ""
- "*
-{
- /* Must import the magic millicode routine. */
- output_asm_insn (\".IMPORT $$sh_func_adrs,MILLICODE\", NULL);
-
- /* This is absolutely fucking amazing.
-
- First, copy our input parameter into %r29 just in case we don't
- need to call $$sh_func_adrs. */
- output_asm_insn (\"copy %%r26,%%r29\", NULL);
-
- /* Next, examine the low two bits in %r26, if they aren't 0x2, then
- we use %r26 unchanged. */
- if (get_attr_length (insn) == 32)
- output_asm_insn (\"extru %%r26,31,2,%%r31\;comib,<>,n 2,%%r31,.+24\", NULL);
- else if (get_attr_length (insn) == 40)
- output_asm_insn (\"extru %%r26,31,2,%%r31\;comib,<>,n 2,%%r31,.+32\", NULL);
- else if (get_attr_length (insn) == 44)
- output_asm_insn (\"extru %%r26,31,2,%%r31\;comib,<>,n 2,%%r31,.+36\", NULL);
- else
- output_asm_insn (\"extru %%r26,31,2,%%r31\;comib,<>,n 2,%%r31,.+20\", NULL);
-
- /* Next, compare %r26 with 4096, if %r26 is less than or equal to
- 4096, then we use %r26 unchanged. */
- if (get_attr_length (insn) == 32)
- output_asm_insn (\"ldi 4096,%%r31\;comb,<<,n %%r26,%%r31,.+16\", NULL);
- else if (get_attr_length (insn) == 40)
- output_asm_insn (\"ldi 4096,%%r31\;comb,<<,n %%r26,%%r31,.+24\", NULL);
- else if (get_attr_length (insn) == 44)
- output_asm_insn (\"ldi 4096,%%r31\;comb,<<,n %%r26,%%r31,.+28\", NULL);
- else
- output_asm_insn (\"ldi 4096,%%r31\;comb,<<,n %%r26,%%r31,.+12\", NULL);
-
- /* Else call $$sh_func_adrs to extract the function's real add24. */
- return output_millicode_call (insn,
- gen_rtx (SYMBOL_REF, SImode,
- \"$$sh_func_adrs\"));
-}"
- [(set_attr "type" "multi")
- (set (attr "length")
- (cond [
-;; Target (or stub) within reach
- (and (lt (plus (symbol_ref "total_code_bytes") (pc))
- (const_int 240000))
- (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0)))
- (const_int 28)
-
-;; NO_SPACE_REGS
- (ne (symbol_ref "TARGET_NO_SPACE_REGS || TARGET_FAST_INDIRECT_CALLS")
- (const_int 0))
- (const_int 32)
-
-;; Out of reach, but not PIC or PORTABLE_RUNTIME
-;; same as NO_SPACE_REGS code
- (and (eq (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (eq (symbol_ref "flag_pic")
- (const_int 0)))
- (const_int 32)
-
-;; PORTABLE_RUTNIME
- (ne (symbol_ref "TARGET_PORTABLE_RUNTIME")
- (const_int 0))
- (const_int 40)]
-
-;; Out of range and PIC
- (const_int 44)))])
-
-
diff --git a/gcc/config/pa/pa1.h b/gcc/config/pa/pa1.h
deleted file mode 100644
index 418de750c02..00000000000
--- a/gcc/config/pa/pa1.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Definitions of target machine for GNU compiler, for HP PA-RISC 1.1
- Copyright (C) 1991 Free Software Foundation, Inc.
- Contributed by Tim Moore (moore@defmacro.cs.utah.edu)
-
-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. */
-
-#define TARGET_DEFAULT 0x89 /* TARGET_SNAKE + TARGET_GAS
- + TARGET_JUMP_IN_DELAY */
-
-/* This is the same as pa.h, except that we generate snake code by
- default. */
-
-#include "pa/pa.h"
diff --git a/gcc/config/pa/t-pa b/gcc/config/pa/t-pa
deleted file mode 100644
index a359918a125..00000000000
--- a/gcc/config/pa/t-pa
+++ /dev/null
@@ -1,18 +0,0 @@
-LIBGCC1=libgcc1.null
-CROSS_LIBGCC1=libgcc1.null
-ADA_CFLAGS=-mdisable-indexing
-LIB2FUNCS_EXTRA=lib2funcs.asm ee.asm ee_fp.asm
-
-lib2funcs.asm: $(srcdir)/config/pa/lib2funcs.asm
- rm -f lib2funcs.asm
- cp $(srcdir)/config/pa/lib2funcs.asm .
-
-ee.asm: $(srcdir)/config/pa/ee.asm
- rm -f ee.asm
- cp $(srcdir)/config/pa/ee.asm .
-
-ee_fp.asm: $(srcdir)/config/pa/ee_fp.asm
- rm -f ee_fp.asm
- cp $(srcdir)/config/pa/ee_fp.asm .
-
-TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/pa/t-pro b/gcc/config/pa/t-pro
deleted file mode 100644
index f40b2e4e4d7..00000000000
--- a/gcc/config/pa/t-pro
+++ /dev/null
@@ -1,38 +0,0 @@
-LIBGCC1=libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-LIB1ASMSRC =
-LIB1ASMFUNCS =
-
-LIBGCC1_TEST =
-
-ADA_CFLAGS=-mdisable-indexing
-
-LIB2FUNCS_EXTRA=fp-bit.c dp-bit.c lib2funcs.asm ee.asm ee_fp.asm
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-lib2funcs.asm: $(srcdir)/config/pa/lib2funcs.asm
- rm -f lib2funcs.asm
- cp $(srcdir)/config/pa/lib2funcs.asm .
-
-ee.asm: $(srcdir)/config/pa/ee.asm
- rm -f ee.asm
- cp $(srcdir)/config/pa/ee.asm .
-
-ee_fp.asm: $(srcdir)/config/pa/ee_fp.asm
- rm -f ee_fp.asm
- cp $(srcdir)/config/pa/ee_fp.asm .
-
-# Build the libraries for both speed and space optimizations
-
-MULTILIB_OPTIONS=mspace
-MULTILIB_DIRNAMES=space
-MULTILIB_MATCHES=
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/pa/x-pa b/gcc/config/pa/x-pa
deleted file mode 100644
index c1409ab77b4..00000000000
--- a/gcc/config/pa/x-pa
+++ /dev/null
@@ -1,3 +0,0 @@
-# BSD on the PA already has ANSI include files which are c++ compatible.
-INSTALL_HEADERS=
-STMP_FIXPROTO=
diff --git a/gcc/config/pa/x-pa-hpux b/gcc/config/pa/x-pa-hpux
deleted file mode 100644
index 1b8bb9fa733..00000000000
--- a/gcc/config/pa/x-pa-hpux
+++ /dev/null
@@ -1,4 +0,0 @@
-ALLOCA=alloca.o
-
-# So putenv and other functions get seen by fixproto.
-FIXPROTO_DEFINES = -D_HPUX_SOURCE
diff --git a/gcc/config/pa/xm-pa.h b/gcc/config/pa/xm-pa.h
deleted file mode 100644
index 3d86e88986c..00000000000
--- a/gcc/config/pa/xm-pa.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Configuration for GNU C-compiler for PA-RISC.
- Copyright (C) 1988, 1995 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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. */
-
-extern int errno;
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Doubles are stored in memory with the high order word first. This
- matters when cross-compiling. */
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* Place any machine-dependent include files here, in case we
- are bootstrapping. */
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* Don't try to use sys_siglist. */
-#define NO_SYS_SIGLIST
-
-/* We have strerror, don't try to use sys_errlist. */
-#define HAVE_STRERROR
-
-/* 4.3BSD, OSF1 and Lites on the PA are all derived from NET2 or
- later code from Berkeley. */
-#define __BSD_NET2__
-
-/* HP's compiler has problems with enum bitfields. */
-#define ONLY_INT_FIELDS
-
-/* Always claim to use C alloca; this prevents losing if building with
- gcc -fno-builtin ... */
-#define USE_C_ALLOCA
diff --git a/gcc/config/pa/xm-pahpux.h b/gcc/config/pa/xm-pahpux.h
deleted file mode 100644
index 97e9403b158..00000000000
--- a/gcc/config/pa/xm-pahpux.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Configuration for GNU C-compiler for PA-RISC.
- Copyright (C) 1988, 1995 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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. */
-
-
-/* HP-UX is a flavor of System V */
-#define USG
-
-/* Use System V memory functions. */
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define bcmp(a,b,c) memcmp (a,b,c)
-
-#define rindex strrchr
-#define index strchr
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Doubles are stored in memory with the high order word first. This
- matters when cross-compiling. */
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* Place any machine-dependent include files here, in case we
- are bootstrapping. */
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* Don't try to use sys_siglist. */
-#define NO_SYS_SIGLIST
-
-/* HP's compiler has problems with enum bitfields. */
-#define ONLY_INT_FIELDS
-
-/* Always claim to use C alloca; this prevents losing if building with
- gcc -fno-builtin ... " */
-#define USE_C_ALLOCA
diff --git a/gcc/config/pa/xm-papro.h b/gcc/config/pa/xm-papro.h
deleted file mode 100644
index 66ec811b4ac..00000000000
--- a/gcc/config/pa/xm-papro.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Configuration for GNU C-compiler for PA-RISC.
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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. */
-
-extern int errno;
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Doubles are stored in memory with the high order word first. This
- matters when cross-compiling. */
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* Place any machine-dependent include files here, in case we
- are bootstrapping. */
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* Don't try to use sys_siglist. */
-#define NO_SYS_SIGLIST
-
-/* We have strerror, don't try to use sys_errlist. */
-#define HAVE_STRERROR
-
-/* HP's compiler has problems with enum bitfields. */
-#define ONLY_INT_FIELDS
-
-/* Always claim to use C alloca; this prevents losing if building with
- gcc -fno-builtin ... */
-#define USE_C_ALLOCA
diff --git a/gcc/config/pdp11/2bsd.h b/gcc/config/pdp11/2bsd.h
deleted file mode 100644
index 3cc97dbace3..00000000000
--- a/gcc/config/pdp11/2bsd.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Definitions of target machine for GNU compiler, for a PDP with 2BSD
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
-
-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 1, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* This macro generates the assembly code for function entry. */
-#undef FUNCTION_PROLOGUE
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-do { \
-fprintf(FILE, "\tjsr r5, csv\n"); \
-if ((SIZE) != 0) \
- { \
- fprintf(FILE, "\t/*abuse empty parameter slot for locals!*/\n"); \
- if ((SIZE) > 2) \
- fprintf(FILE, "\tsub $%d, sp\n", (SIZE)-2); \
- }; \
-} while (0)
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#undef EXIT_IGNORE_STACK
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-*/
-
-#undef FUNCTION_EPILOGUE
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-do { \
-fprintf(FILE, "\t/* SP ignored by cret? */\n"); \
-fprintf(FILE, "\tjmp cret\n"); \
-} while (0)
-
-#undef INITIAL_FRAME_POINTER_OFFSET
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH_VAR) \
-{ \
- int offset, regno; \
- offset = get_frame_size(); \
- offset = (offset <= 2)? 0: (offset -2); \
- (DEPTH_VAR) = offset+10; \
-}
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c.
- */
-
-#undef FRAME_POINTER_REQUIRED
-#define FRAME_POINTER_REQUIRED 1
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#undef STARTING_FRAME_OFFSET
-#define STARTING_FRAME_OFFSET -8
-
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
-do { \
-ASM_OUTPUT_LABEL (STREAM, NAME); \
-fprintf (STREAM, "~~%s:\n", NAME); \
-} while (0)
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
deleted file mode 100644
index 19b41485e7d..00000000000
--- a/gcc/config/pdp11/pdp11.c
+++ /dev/null
@@ -1,1423 +0,0 @@
-/* Subroutines for gcc2 for pdp11.
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
-
-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 1, 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 FILE
-#include <stdio.h>
-#endif
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-
-/*
-#define FPU_REG_P(X) ((X)>=8 && (X)<14)
-#define CPU_REG_P(X) ((X)>=0 && (X)<8)
-*/
-
-/* this is the current value returned by the macro FIRST_PARM_OFFSET
- defined in tm.h */
-int current_first_parm_offset;
-
-/* This is where the condition code register lives. */
-/* rtx cc0_reg_rtx; - no longer needed? */
-
-static rtx find_addr_reg ();
-
-/* Nonzero if OP is a valid second operand for an arithmetic insn. */
-
-int
-arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode) || GET_CODE (op) == CONST_INT);
-}
-
-int
-const_immediate_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT);
-}
-
-int
-immediate15_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && ((INTVAL (op) & 0x8000) == 0x0000));
-}
-
-int
-expand_shift_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && abs (INTVAL(op)) > 1
- && abs (INTVAL(op)) <= 4);
-}
-
-/*
- stream is a stdio stream to output the code to.
- size is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used.
-*/
-
-void
-output_function_prologue(stream, size)
- FILE *stream;
- int size;
-{
- int fsize = ((size) + 1) & ~1;
- int regno, nregs, i;
- int offset = 0;
-
- int via_ac = -1;
-
- fprintf (stream, "\n\t; /* function prologue %s*/\n", current_function_name);
-
- /* if we are outputting code for main,
- the switch FPU to right mode if TARGET_FPU */
- if ( (strcmp ("main", current_function_name) == 0)
- && TARGET_FPU)
- {
- fprintf(stream, "\t;/* switch cpu to double float, single integer */\n");
- fprintf(stream, "\tsetd\n");
- fprintf(stream, "\tseti\n\n");
- }
-
- if (frame_pointer_needed)
- {
- fprintf(stream, "\tmov fp, -(sp)\n");
- fprintf(stream, "\tmov sp, fp\n");
- }
- else
- {
- /* DON'T SAVE FP */
- }
-
- /* make frame */
- if (fsize)
- fprintf (stream, "\tsub $%d, sp\n", fsize);
-
- /* save CPU registers */
- for (regno = 0; regno < 8; regno++)
- if (regs_ever_live[regno] && ! call_used_regs[regno])
- if (! ((regno == FRAME_POINTER_REGNUM)
- && frame_pointer_needed))
- fprintf (stream, "\tmov %s, -(sp)\n", reg_names[regno]);
- /* fpu regs saving */
-
- /* via_ac specifies the ac to use for saving ac4, ac5 */
- via_ac = -1;
-
- for (regno = 8; regno < FIRST_PSEUDO_REGISTER ; regno++)
- {
- /* ac0 - ac3 */
- if (LOAD_FPU_REG_P(regno)
- && regs_ever_live[regno]
- && ! call_used_regs[regno])
- {
- fprintf (stream, "\tfstd %s, -(sp)\n", reg_names[regno]);
- via_ac = regno;
- }
-
- /* maybe make ac4, ac5 call used regs?? */
- /* ac4 - ac5 */
- if (NO_LOAD_FPU_REG_P(regno)
- && regs_ever_live[regno]
- && ! call_used_regs[regno])
- {
- if (via_ac == -1)
- abort();
-
- fprintf (stream, "\tfldd %s, %s\n", reg_names[regno], reg_names[via_ac]);
- fprintf (stream, "\tfstd %s, -(sp)\n", reg_names[via_ac]);
- }
- }
-
- fprintf (stream, "\t;/* end of prologue */\n\n");
-}
-
-/*
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-/* maybe we can make leaf functions faster by switching to the
- second register file - this way we don't have to save regs!
- leaf functions are ~ 50% of all functions (dynamically!)
-
- set/clear bit 11 (dec. 2048) of status word for switching register files -
- but how can we do this? the pdp11/45 manual says bit may only
- be set (p.24), but not cleared!
-
- switching to kernel is probably more expensive, so we'll leave it
- like this and not use the second set of registers...
-
- maybe as option if you want to generate code for kernel mode? */
-
-
-void
-output_function_epilogue(stream, size)
- FILE *stream;
- int size;
-{
- extern int may_call_alloca;
-
- int fsize = ((size) + 1) & ~1;
- int nregs, regno, i, j, k, adjust_fp;
-
- int via_ac;
-
- fprintf (stream, "\n\t; /*function epilogue */\n");
-
- if (frame_pointer_needed)
- {
- /* hope this is safe - m68k does it also .... */
- regs_ever_live[FRAME_POINTER_REGNUM] = 0;
-
- for (i =7, j = 0 ; i >= 0 ; i--)
- if (regs_ever_live[i] && ! call_used_regs[i])
- j++;
-
- /* remember # of pushed bytes for CPU regs */
- k = 2*j;
-
- for (i =7 ; i >= 0 ; i--)
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf(stream, "\tmov %d(fp), %s\n",-fsize-2*j--, reg_names[i]);
-
- /* get ACs */
- via_ac = FIRST_PSEUDO_REGISTER -1;
-
- for (i = FIRST_PSEUDO_REGISTER; i > 7; i--)
- if (regs_ever_live[i] && ! call_used_regs[i])
- {
- via_ac = i;
- k += 8;
- }
-
- for (i = FIRST_PSEUDO_REGISTER; i > 7; i--)
- {
- if (LOAD_FPU_REG_P(i)
- && regs_ever_live[i]
- && ! call_used_regs[i])
- {
- fprintf(stream, "\tfldd %d(fp), %s\n", -fsize-k, reg_names[i]);
- k -= 8;
- }
-
- if (NO_LOAD_FPU_REG_P(i)
- && regs_ever_live[i]
- && ! call_used_regs[i])
- {
- if (! LOAD_FPU_REG_P(via_ac))
- abort();
-
- fprintf(stream, "\tfldd %d(fp), %s\n", -fsize-k, reg_names[via_ac]);
- fprintf(stream, "\tfstd %s, %s\n", reg_names[via_ac], reg_names[i]);
- k -= 8;
- }
- }
-
- fprintf(stream, "\tmov fp, sp\n");
- fprintf (stream, "\tmov (sp)+, fp\n");
- }
- else
- {
- via_ac = FIRST_PSEUDO_REGISTER -1;
-
- /* get ACs */
- for (i = FIRST_PSEUDO_REGISTER; i > 7; i--)
- if (regs_ever_live[i] && call_used_regs[i])
- via_ac = i;
-
- for (i = FIRST_PSEUDO_REGISTER; i > 7; i--)
- {
- if (LOAD_FPU_REG_P(i)
- && regs_ever_live[i]
- && ! call_used_regs[i])
- fprintf(stream, "\tfldd (sp)+, %s\n", reg_names[i]);
-
- if (NO_LOAD_FPU_REG_P(i)
- && regs_ever_live[i]
- && ! call_used_regs[i])
- {
- if (! LOAD_FPU_REG_P(via_ac))
- abort();
-
- fprintf(stream, "\tfldd (sp)+, %s\n", reg_names[via_ac]);
- fprintf(stream, "\tfstd %s, %s\n", reg_names[via_ac], reg_names[i]);
- }
- }
-
- for (i=7; i >= 0; i--)
- if (regs_ever_live[i] && !call_used_regs[i])
- fprintf(stream, "\tmov (sp)+, %s\n", reg_names[i]);
-
- if (fsize)
- fprintf((stream), "\tadd $%d, sp\n", fsize);
- }
-
- fprintf (stream, "\trts pc\n");
- fprintf (stream, "\t;/* end of epilogue*/\n\n\n");
-}
-
-/* Return the best assembler insn template
- for moving operands[1] into operands[0] as a fullword. */
-static char *
-singlemove_string (operands)
- rtx *operands;
-{
- if (operands[1] != const0_rtx)
- return "mov %1,%0";
-
- return "clr %0";
-}
-
-
-/* Output assembler code to perform a doubleword move insn
- with operands OPERANDS. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum { REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP } optype0, optype1;
- rtx latehalf[2];
- rtx addreg0 = 0, addreg1 = 0;
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- optype0 = POPOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- optype0 = PUSHOP;
- else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1]))
-#if 0
- || GET_CODE (operands[1]) == CONST_DOUBLE)
-#endif
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC)
- optype1 = POPOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- optype1 = PUSHOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP)
- abort ();
-
- /* If one operand is decrementing and one is incrementing
- decrement the former register explicitly
- and change that operand into ordinary indexing. */
-
- if (optype0 == PUSHOP && optype1 == POPOP)
- {
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
- output_asm_insn ("sub $4,%0", operands);
- operands[0] = gen_rtx (MEM, SImode, operands[0]);
- optype0 = OFFSOP;
- }
- if (optype0 == POPOP && optype1 == PUSHOP)
- {
- operands[1] = XEXP (XEXP (operands[1], 0), 0);
- output_asm_insn ("sub $4,%1", operands);
- operands[1] = gen_rtx (MEM, SImode, operands[1]);
- optype1 = OFFSOP;
- }
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (operands[0], 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (operands[1], 0));
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first,
- but if either operand is autodecrementing then we
- do the high-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, HImode, REGNO (operands[0]) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], 2);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, HImode, REGNO (operands[1]) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], 2);
- else if (optype1 == CNSTOP)
- {
- if (CONSTANT_P (operands[1]))
- {
- /* now the mess begins, high word is in lower word???
-
- that's what ashc makes me think, but I don't remember :-( */
- latehalf[1] = gen_rtx(CONST_INT, VOIDmode,
- INTVAL(operands[1])>>16);
- operands[1] = gen_rtx(CONST_INT, VOIDmode,
- INTVAL(operands[1])&0xff);
- }
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- /* immediate 32 bit values not allowed */
- abort();
- }
- }
- else
- latehalf[1] = operands[1];
-
- /* If insn is effectively movd N(sp),-(sp) then we will do the
- high word first. We should use the adjusted operand 1 (which is N+4(sp))
- for the low word as well, to compensate for the first decrement of sp. */
- if (optype0 == PUSHOP
- && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM
- && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1]))
- operands[1] = latehalf[1];
-
- /* If one or both operands autodecrementing,
- do the two words, high-numbered first. */
-
- /* Likewise, the first move would clobber the source of the second one,
- do them in the other order. This happens only for registers;
- such overlap can't happen in memory unless the user explicitly
- sets it up, and that is an undefined circumstance. */
-
- if (optype0 == PUSHOP || optype1 == PUSHOP
- || (optype0 == REGOP && optype1 == REGOP
- && REGNO (operands[0]) == REGNO (latehalf[1])))
- {
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("add $2,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add $2,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("sub $2,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("sub $2,%0", &addreg1);
-
- /* Do low-numbered word. */
- return singlemove_string (operands);
- }
-
- /* Normal case: do the two words, low-numbered first. */
-
- output_asm_insn (singlemove_string (operands), operands);
-
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("add $2,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add $2,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("sub $2,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("sub $2,%0", &addreg1);
-
- return "";
-}
-/* Output assembler code to perform a quadword move insn
- with operands OPERANDS. */
-
-char *
-output_move_quad (operands)
- rtx *operands;
-{
- enum { REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP } optype0, optype1;
- rtx latehalf[2];
- rtx addreg0 = 0, addreg1 = 0;
-
- output_asm_insn(";; movdi/df: %1 -> %0", operands);
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
- optype0 = POPOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- optype0 = PUSHOP;
- else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1])
- || GET_CODE (operands[1]) == CONST_DOUBLE)
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC)
- optype1 = POPOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
- optype1 = PUSHOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP)
- abort ();
-
- /* check if we move a CPU reg to an FPU reg, or vice versa! */
- if (optype0 == REGOP && optype1 == REGOP)
- /* bogus - 64 bit cannot reside in CPU! */
- if (CPU_REG_P(REGNO(operands[0]))
- || CPU_REG_P (REGNO(operands[1])))
- abort();
-
- if (optype0 == REGOP || optype1 == REGOP)
- {
- /* check for use of clrd????
- if you ever allow ac4 and ac5 (now we require secondary load)
- you must check whether
- you want to load into them or store from them -
- then dump ac0 into $help$ movce ac4/5 to ac0, do the
- store from ac0, and restore ac0 - if you can find
- an unused ac[0-3], use that and you save a store and a load!*/
-
- if (FPU_REG_P(REGNO(operands[0])))
- {
- if (GET_CODE(operands[1]) == CONST_DOUBLE)
- {
- union { double d; int i[2]; } u;
- u.i[0] = CONST_DOUBLE_LOW (operands[1]);
- u.i[1] = CONST_DOUBLE_HIGH (operands[1]);
-
- if (u.d == 0.0)
- return "clrd %0";
- }
-
- return "ldd %1, %0";
- }
-
- if (FPU_REG_P(REGNO(operands[1])))
- return "std %1, %0";
- }
-
- /* If one operand is decrementing and one is incrementing
- decrement the former register explicitly
- and change that operand into ordinary indexing. */
-
- if (optype0 == PUSHOP && optype1 == POPOP)
- {
- operands[0] = XEXP (XEXP (operands[0], 0), 0);
- output_asm_insn ("sub $8,%0", operands);
- operands[0] = gen_rtx (MEM, DImode, operands[0]);
- optype0 = OFFSOP;
- }
- if (optype0 == POPOP && optype1 == PUSHOP)
- {
- operands[1] = XEXP (XEXP (operands[1], 0), 0);
- output_asm_insn ("sub $8,%1", operands);
- operands[1] = gen_rtx (MEM, SImode, operands[1]);
- optype1 = OFFSOP;
- }
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (operands[0], 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (operands[1], 0));
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first,
- but if either operand is autodecrementing then we
- do the high-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 2);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], 4);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- else if (optype1 == CNSTOP)
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- /* floats only. not yet supported!
-
- -- compute it into PDP float format, - internally,
- just use IEEE and ignore possible problems ;-)
-
- we might get away with it !!!! */
-
- abort();
-
-#ifndef HOST_WORDS_BIG_ENDIAN
- latehalf[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[1]));
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[1]));
-#else /* HOST_WORDS_BIG_ENDIAN */
- latehalf[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[1]));
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[1]));
-#endif /* HOST_WORDS_BIG_ENDIAN */
- }
- else if (GET_CODE(operands[1]) == CONST_INT)
- {
- latehalf[1] = gen_rtx (CONST_INT, VOIDmode, 0);
- }
- else
- abort();
-
- }
- else
- latehalf[1] = operands[1];
-
- /* If insn is effectively movd N(sp),-(sp) then we will do the
- high word first. We should use the adjusted operand 1 (which is N+4(sp))
- for the low word as well, to compensate for the first decrement of sp. */
- if (optype0 == PUSHOP
- && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM
- && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1]))
- operands[1] = latehalf[1];
-
- /* If one or both operands autodecrementing,
- do the two words, high-numbered first. */
-
- /* Likewise, the first move would clobber the source of the second one,
- do them in the other order. This happens only for registers;
- such overlap can't happen in memory unless the user explicitly
- sets it up, and that is an undefined circumstance. */
-
- if (optype0 == PUSHOP || optype1 == PUSHOP
- || (optype0 == REGOP && optype1 == REGOP
- && REGNO (operands[0]) == REGNO (latehalf[1])))
- {
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("add $4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add $4,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn(output_move_double(latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("sub $4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("sub $4,%0", &addreg1);
-
- /* Do low-numbered word. */
- return output_move_double (operands);
- }
-
- /* Normal case: do the two words, low-numbered first. */
-
- output_asm_insn (output_move_double (operands), operands);
-
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("add $4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add $4,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (output_move_double (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("sub $4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("sub $4,%0", &addreg1);
-
- return "";
-}
-
-
-/* Return a REG that occurs in ADDR with coefficient 1.
- ADDR can be effectively incremented by incrementing REG. */
-
-static rtx
-find_addr_reg (addr)
- rtx addr;
-{
- while (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG)
- addr = XEXP (addr, 0);
- if (GET_CODE (XEXP (addr, 1)) == REG)
- addr = XEXP (addr, 1);
- if (CONSTANT_P (XEXP (addr, 0)))
- addr = XEXP (addr, 1);
- if (CONSTANT_P (XEXP (addr, 1)))
- addr = XEXP (addr, 0);
- }
- if (GET_CODE (addr) == REG)
- return addr;
- return 0;
-}
-
-/* Output an ascii string. */
-output_ascii (file, p, size)
- FILE *file;
- char *p;
- int size;
-{
- int i;
-
- fprintf (file, "\t.byte \"");
-
- for (i = 0; i < size; i++)
- {
- register int c = p[i];
- if (c == '\"' || c == '\\')
- putc ('\\', file);
- if (c >= ' ' && c < 0177)
- putc (c, file);
- else
- {
- fprintf (file, "\\%03o", c);
- /* After an octal-escape, if a digit follows,
- terminate one string constant and start another.
- The Vax assembler fails to stop reading the escape
- after three digits, so this is the only way we
- can get it to parse the data properly. */
- if (i < size - 1 && p[i + 1] >= '0' && p[i + 1] <= '9')
- fprintf (file, "\"\n\tstring \"");
- }
- }
- fprintf (file, "\"\n");
-}
-
-
-/* --- stole from out-vax, needs changes */
-
-print_operand_address (file, addr)
- FILE *file;
- register rtx addr;
-{
- register rtx reg1, reg2, breg, ireg;
- rtx offset;
-
- retry:
-
- switch (GET_CODE (addr))
- {
- case MEM:
- fprintf (file, "@");
- addr = XEXP (addr, 0);
- goto retry;
-
- case REG:
- fprintf (file, "(%s)", reg_names[REGNO (addr)]);
- break;
-
- case PRE_DEC:
- fprintf (file, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]);
- break;
-
- case POST_INC:
- fprintf (file, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]);
- break;
-
- case PLUS:
- reg1 = 0; reg2 = 0;
- ireg = 0; breg = 0;
- offset = 0;
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))
- || GET_CODE (XEXP (addr, 0)) == MEM)
- {
- offset = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))
- || GET_CODE (XEXP (addr, 1)) == MEM)
- {
- offset = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- if (GET_CODE (addr) != PLUS)
- ;
- else if (GET_CODE (XEXP (addr, 0)) == MULT)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == MULT)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 0)) == REG)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT)
- {
- if (reg1 == 0)
- reg1 = addr;
- else
- reg2 = addr;
- addr = 0;
- }
- if (offset != 0)
- {
- if (addr != 0) abort ();
- addr = offset;
- }
- if (reg1 != 0 && GET_CODE (reg1) == MULT)
- {
- breg = reg2;
- ireg = reg1;
- }
- else if (reg2 != 0 && GET_CODE (reg2) == MULT)
- {
- breg = reg1;
- ireg = reg2;
- }
- else if (reg2 != 0 || GET_CODE (addr) == MEM)
- {
- breg = reg2;
- ireg = reg1;
- }
- else
- {
- breg = reg1;
- ireg = reg2;
- }
- if (addr != 0)
- output_address (addr);
- if (breg != 0)
- {
- if (GET_CODE (breg) != REG)
- abort ();
- fprintf (file, "(%s)", reg_names[REGNO (breg)]);
- }
- if (ireg != 0)
- {
- if (GET_CODE (ireg) == MULT)
- ireg = XEXP (ireg, 0);
- if (GET_CODE (ireg) != REG)
- abort ();
- abort();
- fprintf (file, "[%s]", reg_names[REGNO (ireg)]);
- }
- break;
-
- default:
- output_addr_const (file, addr);
- }
-}
-
-/* register move costs, indexed by regs */
-
-static int move_costs[N_REG_CLASSES][N_REG_CLASSES] =
-{
- /* NO MUL GEN LFPU NLFPU FPU ALL */
-
-/* NO */ { 0, 0, 0, 0, 0, 0, 0},
-/* MUL */ { 0, 2, 2, 10, 22, 22, 22},
-/* GEN */ { 0, 2, 2, 10, 22, 22, 22},
-/* LFPU */ { 0, 10, 10, 2, 2, 2, 10},
-/* NLFPU */ { 0, 22, 22, 2, 2, 2, 22},
-/* FPU */ { 0, 22, 22, 2, 2, 2, 22},
-/* ALL */ { 0, 22, 22, 10, 22, 22, 22}
-} ;
-
-
-/* -- note that some moves are tremendously expensive,
- because they require lots of tricks! do we have to
- charge the costs incurred by secondary reload class
- -- as we do here with 22 -- or not ? */
-
-int
-register_move_cost(c1, c2)
- enum reg_class c1, c2;
-{
- return move_costs[(int)c1][(int)c2];
-}
-
-char *
-output_jump(pos, neg, length)
- int length;
- char *pos, *neg;
-{
- static int x = 0;
-
- static char buf[1000];
-
-#if 0
-/* currently we don't need this, because the tstdf and cmpdf
- copy the condition code immediately, and other float operations are not
- yet recognized as changing the FCC - if so, then the length-cost of all
- jump insns increases by one, because we have to potentially copy the
- FCC! */
- if (cc_status.flags & CC_IN_FPU)
- output_asm_insn("cfcc", NULL);
-#endif
-
- switch (length)
- {
- case 1:
-
- strcpy(buf, pos);
- strcat(buf, " %l0");
-
- return buf;
-
- case 3:
-
- sprintf(buf, "%s JMP_%d\n\tjmp %%l0\nJMP_%d:", neg, x, x);
-
- x++;
-
- return buf;
-
- default:
-
- abort();
- }
-
-}
-
-void
-notice_update_cc_on_set(exp, insn)
- rtx exp;
- rtx insn;
-{
- if (GET_CODE (SET_DEST (exp)) == CC0)
- {
- cc_status.flags = 0;
- cc_status.value1 = SET_DEST (exp);
- cc_status.value2 = SET_SRC (exp);
-
-/*
- if (GET_MODE(SET_SRC(exp)) == DFmode)
- cc_status.flags |= CC_IN_FPU;
-*/
- }
- else if ((GET_CODE (SET_DEST (exp)) == REG
- || GET_CODE (SET_DEST (exp)) == MEM)
- && GET_CODE (SET_SRC (exp)) != PC
- && (GET_MODE (SET_DEST(exp)) == HImode
- || GET_MODE (SET_DEST(exp)) == QImode)
- && (GET_CODE (SET_SRC(exp)) == PLUS
- || GET_CODE (SET_SRC(exp)) == MINUS
- || GET_CODE (SET_SRC(exp)) == AND
- || GET_CODE (SET_SRC(exp)) == IOR
- || GET_CODE (SET_SRC(exp)) == XOR
- || GET_CODE (SET_SRC(exp)) == NOT
- || GET_CODE (SET_SRC(exp)) == NEG
- || GET_CODE (SET_SRC(exp)) == REG
- || GET_CODE (SET_SRC(exp)) == MEM))
- {
- cc_status.flags = 0;
- cc_status.value1 = SET_SRC (exp);
- cc_status.value2 = SET_DEST (exp);
-
- if (cc_status.value1 && GET_CODE (cc_status.value1) == REG
- && cc_status.value2
- && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2))
- cc_status.value2 = 0;
- if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM
- && cc_status.value2
- && GET_CODE (cc_status.value2) == MEM)
- cc_status.value2 = 0;
- }
- else if (GET_CODE (SET_SRC (exp)) == CALL)
- {
- CC_STATUS_INIT;
- }
- else if (GET_CODE (SET_DEST (exp)) == REG)
- /* what's this ? */
- {
- if ((cc_status.value1
- && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value1)))
- cc_status.value1 = 0;
- if ((cc_status.value2
- && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2)))
- cc_status.value2 = 0;
- }
- else if (SET_DEST(exp) == pc_rtx)
- {
- /* jump */
- }
- else /* if (GET_CODE (SET_DEST (exp)) == MEM) */
- {
- /* the last else is a bit paranoiac, but since nearly all instructions
- play with condition codes, it's reasonable! */
-
- CC_STATUS_INIT; /* paranoia*/
- }
-}
-
-
-int simple_memory_operand(op, mode)
- rtx op;
- enum machine_mode mode;
-{
- rtx addr, plus0, plus1;
- int offset = 0;
-
- /* Eliminate non-memory operations */
- if (GET_CODE (op) != MEM)
- return FALSE;
-
-#if 0
- /* dword operations really put out 2 instructions, so eliminate them. */
- if (GET_MODE_SIZE (GET_MODE (op)) > (HAVE_64BIT_P () ? 8 : 4))
- return FALSE;
-#endif
-
- /* Decode the address now. */
-
- indirection:
-
- addr = XEXP (op, 0);
-
- switch (GET_CODE (addr))
- {
- case REG:
- /* (R0) - no extra cost */
- return 1;
-
- case PRE_DEC:
- case POST_INC:
- /* -(R0), (R0)+ - cheap! */
- return 0;
-
- case MEM:
- /* cheap - is encoded in addressing mode info!
-
- -- except for @(R0), which has to be @0(R0) !!! */
-
- if (GET_CODE (XEXP (addr, 0)) == REG)
- return 0;
-
- op=addr;
- goto indirection;
-
- case CONST_INT:
- case LABEL_REF:
- case CONST:
- case SYMBOL_REF:
- /* @#address - extra cost */
- return 0;
-
- case PLUS:
- /* X(R0) - extra cost */
- return 0;
- }
-
- return FALSE;
-}
-
-
-/*
- * output a block move:
- *
- * operands[0] ... to
- * operands[1] ... from
- * operands[2] ... length
- * operands[3] ... alignment
- * operands[4] ... scratch register
- */
-
-
-char *
-output_block_move(operands)
- rtx *operands;
-{
- static int count = 0;
- char buf[200];
-
- if (GET_CODE(operands[2]) == CONST_INT
- && TARGET_TIME)
- {
- if (INTVAL(operands[2]) < 16
- && INTVAL(operands[3]) == 1)
- {
- register int i;
-
- for (i = 1; i <= INTVAL(operands[2]); i++)
- output_asm_insn("movb (%1)+, (%0)+", operands);
-
- return "";
- }
- else if (INTVAL(operands[2]) < 32)
- {
- register int i;
-
- for (i = 1; i <= INTVAL(operands[2])/2; i++)
- output_asm_insn("mov (%1)+, (%0)+", operands);
-
- /* may I assume that moved quantity is
- multiple of alignment ???
-
- I HOPE SO !
- */
-
- return "";
- }
-
-
- /* can do other clever things, maybe... */
- }
-
- if (CONSTANT_P(operands[2]) )
- {
- /* just move count to scratch */
- output_asm_insn("mov %2, %4", operands);
- }
- else
- {
- /* just clobber the register */
- operands[4] = operands[2];
- }
-
-
- /* switch over alignment */
- switch (INTVAL(operands[3]))
- {
- case 1:
-
- /*
- x:
- movb (%1)+, (%0)+
-
- if (TARGET_45)
- sob %4,x
- else
- dec %4
- bgt x
-
- */
-
- sprintf(buf, "\nmovestrhi%d:", count);
- output_asm_insn(buf, NULL);
-
- output_asm_insn("movb (%1)+, (%0)+", operands);
-
- if (TARGET_45)
- {
- sprintf(buf, "sob %%4, movestrhi%d", count);
- output_asm_insn(buf, operands);
- }
- else
- {
- output_asm_insn("dec %4", operands);
-
- sprintf(buf, "bgt movestrhi%d", count);
- output_asm_insn(buf, NULL);
- }
-
- count ++;
- break;
-
- case 2:
-
- /*
- asr %4
-
- x:
-
- mov (%1)+, (%0)+
-
- if (TARGET_45)
- sob %4, x
- else
- dec %4
- bgt x
- */
-
- generate_compact_code:
-
- output_asm_insn("asr %4", operands);
-
- sprintf(buf, "\nmovestrhi%d:", count);
- output_asm_insn(buf, NULL);
-
- output_asm_insn("mov (%1)+, (%0)+", operands);
-
- if (TARGET_45)
- {
- sprintf(buf, "sob %%4, movestrhi%d", count);
- output_asm_insn(buf, operands);
- }
- else
- {
- output_asm_insn("dec %4", operands);
-
- sprintf(buf, "bgt movestrhi%d", count);
- output_asm_insn(buf, NULL);
- }
-
- count ++;
- break;
-
- case 4:
-
- /*
-
- asr %4
- asr %4
-
- x:
-
- mov (%1)+, (%0)+
- mov (%1)+, (%0)+
-
- if (TARGET_45)
- sob %4, x
- else
- dec %4
- bgt x
- */
-
- if (TARGET_SPACE)
- goto generate_compact_code;
-
- output_asm_insn("asr %4", operands);
- output_asm_insn("asr %4", operands);
-
- sprintf(buf, "\nmovestrhi%d:", count);
- output_asm_insn(buf, NULL);
-
- output_asm_insn("mov (%1)+, (%0)+", operands);
- output_asm_insn("mov (%1)+, (%0)+", operands);
-
- if (TARGET_45)
- {
- sprintf(buf, "sob %%4, movestrhi%d", count);
- output_asm_insn(buf, operands);
- }
- else
- {
- output_asm_insn("dec %4", operands);
-
- sprintf(buf, "bgt movestrhi%d", count);
- output_asm_insn(buf, NULL);
- }
-
- count ++;
- break;
-
- default:
-
- /*
-
- asr %4
- asr %4
- asr %4
-
- x:
-
- mov (%1)+, (%0)+
- mov (%1)+, (%0)+
- mov (%1)+, (%0)+
- mov (%1)+, (%0)+
-
- if (TARGET_45)
- sob %4, x
- else
- dec %4
- bgt x
- */
-
-
- if (TARGET_SPACE)
- goto generate_compact_code;
-
- output_asm_insn("asr %4", operands);
- output_asm_insn("asr %4", operands);
- output_asm_insn("asr %4", operands);
-
- sprintf(buf, "\nmovestrhi%d:", count);
- output_asm_insn(buf, NULL);
-
- output_asm_insn("mov (%1)+, (%0)+", operands);
- output_asm_insn("mov (%1)+, (%0)+", operands);
- output_asm_insn("mov (%1)+, (%0)+", operands);
- output_asm_insn("mov (%1)+, (%0)+", operands);
-
- if (TARGET_45)
- {
- sprintf(buf, "sob %%4, movestrhi%d", count);
- output_asm_insn(buf, operands);
- }
- else
- {
- output_asm_insn("dec %4", operands);
-
- sprintf(buf, "bgt movestrhi%d", count);
- output_asm_insn(buf, NULL);
- }
-
- count ++;
- break;
-
- ;
-
- }
-
- return "";
-}
-
-/* for future use */
-int
-comparison_operator_index(op)
- rtx op;
-{
- switch (GET_CODE(op))
- {
- case NE:
- return 0;
-
- case EQ:
- return 1;
-
- case GE:
- return 2;
-
- case GT:
- return 3;
-
- case LE:
- return 4;
-
- case LT:
- return 5;
-
- case GEU:
- return 6;
-
- case GTU:
- return 7;
-
- case LEU:
- return 8;
-
- case LTU:
- return 9;
-
- default:
- return -1;
- }
-}
-
-/* tests whether the rtx is a comparison operator */
-int
-comp_operator (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return comparison_operator_index(op) >= 0;
-}
-
-
-int
-legitimate_address_p (mode, address)
- enum machine_mode mode;
- rtx address;
-{
-/* #define REG_OK_STRICT */
- GO_IF_LEGITIMATE_ADDRESS(mode, address, win);
-
- return 0;
-
- win:
- return 1;
-
-/* #undef REG_OK_STRICT */
-}
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
deleted file mode 100644
index 9f755c1227e..00000000000
--- a/gcc/config/pdp11/pdp11.h
+++ /dev/null
@@ -1,1397 +0,0 @@
-/* Definitions of target machine for GNU compiler, for the pdp-11
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
-
-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 1, 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. */
-
-
-/* declarations */
-char *output_jump();
-char *output_move_double();
-char *output_move_quad();
-char *output_block_move();
-
-/* check whether load_fpu_reg or not */
-#define LOAD_FPU_REG_P(x) ((x)>=8 && (x)<=11)
-#define NO_LOAD_FPU_REG_P(x) ((x)==12 || (x)==13)
-#define FPU_REG_P(x) (LOAD_FPU_REG_P(x) || NO_LOAD_FPU_REG_P(x))
-#define CPU_REG_P(x) ((x)<8)
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dpdp11"
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION fprintf (stderr, " (pdp11)");
-
-
-/* Generate DBX debugging information. */
-
-/* #define DBX_DEBUGGING_INFO */
-
-/* Run-time compilation parameters selecting different hardware subsets.
-*/
-
-extern int target_flags;
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
-{ { "fpu", 1}, \
- { "soft-float", -1}, \
-/* return float result in ac0 */\
- { "ac0", 2}, \
- { "no-ac0", -2}, \
-/* is 11/40 */ \
- { "40", 4}, \
- { "no-40", -4}, \
-/* is 11/45 */ \
- { "45", 8}, \
- { "no-45", -8}, \
-/* is 11/10 */ \
- { "10", -12}, \
-/* use movstrhi for bcopy */ \
- { "bcopy", 16}, \
- { "bcopy-builtin", -16}, \
-/* use 32 bit for int */ \
- { "int32", 32}, \
- { "no-int16", 32}, \
- { "int16", -32}, \
- { "no-int32", -32}, \
-/* use 32 bit for float */ \
- { "float32", 64}, \
- { "no-float64", 64}, \
- { "float64", -64}, \
- { "no-float32", -64}, \
-/* allow abshi pattern? - can trigger "optimizations" which make code SLOW! */\
- { "abshi", 128}, \
- { "no-abshi", -128}, \
-/* is branching expensive - on a PDP, it's actually really cheap */ \
-/* this is just to play around and check what code gcc generates */ \
- { "branch-expensive", 256}, \
- { "branch-cheap", -256}, \
-/* optimize for space instead of time - just in a couple of places */ \
- { "space", 512 }, \
- { "time", -512 }, \
-/* split instruction and data memory? */ \
- { "split", 1024 }, \
- { "no-split", -1024 }, \
-/* default */ \
- { "", TARGET_DEFAULT} \
-}
-
-#define TARGET_DEFAULT (1 | 8 | 128)
-
-#define TARGET_FPU (target_flags & 1)
-#define TARGET_SOFT_FLOAT (!TARGET_FPU)
-
-#define TARGET_AC0 ((target_flags & 2) && TARGET_FPU)
-#define TARGET_NO_AC0 (! TARGET_AC0)
-
-#define TARGET_45 (target_flags & 8)
-#define TARGET_40_PLUS ((target_flags & 4) || (target_flags))
-#define TARGET_10 (! TARGET_40_PLUS)
-
-#define TARGET_BCOPY_BUILTIN (! (target_flags & 16))
-
-#define TARGET_INT16 (! TARGET_INT32)
-#define TARGET_INT32 (target_flags & 32)
-
-#define TARGET_FLOAT32 (target_flags & 64)
-#define TARGET_FLOAT64 (! TARGET_FLOAT32)
-
-#define TARGET_ABSHI_BUILTIN (target_flags & 128)
-
-#define TARGET_BRANCH_EXPENSIVE (target_flags & 256)
-#define TARGET_BRANCH_CHEAP (!TARGET_BRANCH_EXPENSIVE)
-
-#define TARGET_SPACE (target_flags & 512)
-#define TARGET_TIME (! TARGET_SPACE)
-
-#define TARGET_SPLIT (target_flags & 1024)
-#define TARGET_NOSPLIT (! TARGET_SPLIT)
-
-
-/* TYPE SIZES */
-#define CHAR_TYPE_SIZE 8
-#define SHORT_TYPE_SIZE 16
-#define INT_TYPE_SIZE (TARGET_INT16 ? 16 : 32)
-#define LONG_TYPE_SIZE 32
-#define LONG_LONG_TYPE_SIZE 64
-
-/* if we set FLOAT_TYPE_SIZE to 32, we could have the benefit
- of saving core for huge arrays - the definitions are
- already in md - but floats can never reside in
- an FPU register - we keep the FPU in double float mode
- all the time !! */
-#define FLOAT_TYPE_SIZE (TARGET_FLOAT32 ? 32 : 64)
-#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* machine types from ansi */
-#define SIZE_TYPE "unsigned int" /* definition of size_t */
-
-/* is used in cexp.y - we don't have target_flags there,
- so just give default definition
-
- hope it does not come back to haunt us! */
-#define WCHAR_TYPE "int" /* or long int???? */
-#define WCHAR_TYPE_SIZE 16
-
-#define PTRDIFF_TYPE "int"
-
-/* target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is numbered. */
-#define WORDS_BIG_ENDIAN 1
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-/* This is a machine with 16-bit registers */
-#define BITS_PER_WORD 16
-
-/* Width of a word, in units (bytes).
-
- UNITS OR BYTES - seems like units */
-#define UNITS_PER_WORD 2
-
-/* Maximum sized of reasonable data type
- DImode or Dfmode ...*/
-#define MAX_FIXED_MODE_SIZE 64
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 16
-
-/* Allocation boundary (in *bits*) for storing pointers in memory. */
-#define POINTER_BOUNDARY 16
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 16
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 16
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 16
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 16
-
-/* Define this if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- we have 8 integer registers, plus 6 float
- (don't use scratch float !) */
-
-#define FIRST_PSEUDO_REGISTER 14
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
-
- On the pdp, these are:
- Reg 7 = pc;
- reg 6 = sp;
- reg 5 = fp; not necessarily!
-*/
-
-/* don't let them touch fp regs for the time being !*/
-
-#define FIXED_REGISTERS \
-{0, 0, 0, 0, 0, 0, 1, 1, \
- 0, 0, 0, 0, 0, 0 }
-
-
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-
-/* don't know about fp */
-#define CALL_USED_REGISTERS \
-{1, 1, 0, 0, 0, 0, 1, 1, \
- 0, 0, 0, 0, 0, 0 }
-
-
-/* Make sure everything's fine if we *don't* have an FPU.
- This assumes that putting a register in fixed_regs will keep the
- compiler's mitts completely off it. We don't bother to zero it out
- of register classes.
-*/
-#define CONDITIONAL_REGISTER_USAGE \
-{ \
- int i; \
- HARD_REG_SET x; \
- if (!TARGET_FPU) \
- { \
- COPY_HARD_REG_SET (x, reg_class_contents[(int)FPU_REGS]); \
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
- if (TEST_HARD_REG_BIT (x, i)) \
- fixed_regs[i] = call_used_regs[i] = 1; \
- } \
- \
- if (TARGET_AC0) \
- call_used_regs[8] = 1; \
-}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-*/
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
-((REGNO < 8)? \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) \
- :1)
-
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the pdp, the cpu registers can hold any mode - check alignment
-
- FPU can only hold DF - simplifies life!
-*/
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-((REGNO < 8)? \
- ((GET_MODE_BITSIZE(MODE) <= 16) \
- || (GET_MODE_BITSIZE(MODE) == 32 && !(REGNO & 1))) \
- :(MODE) == DFmode)
-
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) 0
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* the pdp11 pc overloaded on a register that the compiler knows about. */
-#define PC_REGNUM 7
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 6
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 5
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c.
- */
-
-#define FRAME_POINTER_REQUIRED 0
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 5
-
-/* Register in which static-chain is passed to a function. */
-/* ??? - i don't want to give up a reg for this! */
-#define STATIC_CHAIN_REGNUM 4
-
-/* Register in which address to store a structure value
- is passed to a function.
- let's make it an invisible first argument!!! */
-
-#define STRUCT_VALUE 0
-
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The pdp has a couple of classes:
-
-MUL_REGS are used for odd numbered regs, to use in 16 bit multiplication
- (even numbered do 32 bit multiply)
-LMUL_REGS long multiply registers (even numbered regs )
- (don't need them, all 32 bit regs are even numbered!)
-GENERAL_REGS is all cpu
-LOAD_FPU_REGS is the first four cpu regs, they are easier to load
-NO_LOAD_FPU_REGS is ac4 and ac5, currently - difficult to load them
-FPU_REGS is all fpu regs
-*/
-
-enum reg_class { NO_REGS, MUL_REGS, GENERAL_REGS, LOAD_FPU_REGS, NO_LOAD_FPU_REGS, FPU_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* have to allow this till cmpsi/tstsi are fixed in a better way !! */
-#define SMALL_REGISTER_CLASSES 1
-
-/* Since GENERAL_REGS is the same class as ALL_REGS,
- don't give it a different class number; just make it an alias. */
-
-/* #define GENERAL_REGS ALL_REGS */
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES {"NO_REGS", "MUL_REGS", "GENERAL_REGS", "LOAD_FPU_REGS", "NO_LOAD_FPU_REGS", "FPU_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS {0, 0x00aa, 0x00ff, 0x0f00, 0x3000, 0x3f00, 0x3fff}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
-((REGNO)>=8?((REGNO)<=11?LOAD_FPU_REGS:NO_LOAD_FPU_REGS):((REGNO&1)?MUL_REGS:GENERAL_REGS))
-
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
-((C) == 'f' ? FPU_REGS : \
- ((C) == 'd' ? MUL_REGS : \
- ((C) == 'a' ? LOAD_FPU_REGS : NO_REGS)))
-
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- I bits 31-16 0000
- J bits 15-00 0000
- K completely random 32 bit
- L,M,N -1,1,0 respectively
- O where doing shifts in sequence is faster than
- one big shift
-*/
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? ((VALUE) & 0xffff0000) == 0 \
- : (C) == 'J' ? ((VALUE) & 0x0000ffff) == 0 \
- : (C) == 'K' ? (((VALUE) & 0xffff0000) != 0 \
- && ((VALUE) & 0x0000ffff) != 0) \
- : (C) == 'L' ? ((VALUE) == 1) \
- : (C) == 'M' ? ((VALUE) == -1) \
- : (C) == 'N' ? ((VALUE) == 0) \
- : (C) == 'O' ? (abs(VALUE) >1 && abs(VALUE) <= 4) \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' && XINT (VALUE, 0) == 0 && XINT (VALUE, 1) == 0)
-
-
-/* Letters in the range `Q' through `U' may be defined in a
- machine-dependent fashion to stand for arbitrary operand types.
- The machine description macro `EXTRA_CONSTRAINT' is passed the
- operand as its first argument and the constraint letter as its
- second operand.
-
- `Q' is for memory references using take more than 1 instruction.
- `R' is for memory references which take 1 word for the instruction. */
-
-#define EXTRA_CONSTRAINT(OP,CODE) \
- ((GET_CODE (OP) != MEM) ? 0 \
- : !legitimate_address_p (GET_MODE (OP), XEXP (OP, 0)) ? 0 \
- : ((CODE) == 'Q') ? !simple_memory_operand (OP, GET_MODE (OP)) \
- : ((CODE) == 'R') ? simple_memory_operand (OP, GET_MODE (OP)) \
- : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
-
-loading is easier into LOAD_FPU_REGS than FPU_REGS! */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
-(((CLASS) != FPU_REGS)?(CLASS):LOAD_FPU_REGS)
-
-#define SECONDARY_RELOAD_CLASS(CLASS,MODE,x) \
-(((CLASS) == NO_LOAD_FPU_REGS && !(REG_P(x) && LOAD_FPU_REG_P(REGNO(x))))?LOAD_FPU_REGS:NO_REGS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
-((CLASS == GENERAL_REGS || CLASS == MUL_REGS)? \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD): \
- 1 \
-)
-
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame.
-*/
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On the pdp11, the stack is on an even boundary */
-#define PUSH_ROUNDING(BYTES) ((BYTES + 1) & ~1)
-
-/* current_first_parm_offset stores the # of registers pushed on the
- stack */
-extern int current_first_parm_offset;
-
-/* Offset of first parameter from the argument pointer register value.
- For the pdp11, this is non-zero to account for the return address.
- 1 - return address
- 2 - frame pointer (always saved, even when not used!!!!)
- -- chnage some day !!!:q!
-
-*/
-#define FIRST_PARM_OFFSET(FNDECL) 4
-
-/* Value is 1 if returning from a function call automatically
- pops the arguments described by the number-of-args field in the call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-#define BASE_RETURN_VALUE_REG(MODE) \
- ((MODE) == DFmode ? 8 : 0)
-
-/* On the pdp11 the value is found in R0 (or ac0???
-not without FPU!!!! ) */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
-
-/* and the called function leaves it in the first register.
- Difference only on machines with register windows. */
-
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG(TYPE_MODE(VALTYPE)))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, BASE_RETURN_VALUE_REG(MODE))
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller.
- On the pdp, the first "output" reg is the only register thus used.
-
-maybe ac0 ? - as option someday! */
-
-#define FUNCTION_VALUE_REGNO_P(N) (((N) == 0) || (TARGET_AC0 && (N) == 8))
-
-/* should probably return DImode and DFmode in memory,lest
- we fill up all regs!
-
- have to, else we crash - exception: maybe return result in
- ac0 if DFmode and FPU present - compatibility problem with
- libraries for non-floating point ...
-*/
-
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE(TYPE) == DImode || (TYPE_MODE(TYPE) == DFmode && ! TARGET_AC0))
-
-
-/* 1 if N is a possible register number for function argument passing.
- - not used on pdp */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
-*/
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- ...., the offset normally starts at 0, but starts at 1 word
- when the function gets a structure-value-address as an
- invisible first argument. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.)
-
-*/
-
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE)) \
- : (int_size_in_bytes (TYPE))))
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
-
-/* Define where a function finds its arguments.
- This would be different from FUNCTION_ARG if we had register windows. */
-/*
-#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
- FUNCTION_ARG (CUM, MODE, TYPE, NAMED)
-*/
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
-
-/* This macro generates the assembly code for function entry. */
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
- output_function_prologue(FILE, SIZE);
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- abort ();
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-extern int may_call_alloca;
-extern int current_function_pretend_args_size;
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-*/
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
- output_function_epilogue(FILE, SIZE);
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH_VAR) \
-{ \
- int offset, regno; \
- offset = get_frame_size(); \
- for (regno = 0; regno < 8; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 2; \
- for (regno = 8; regno < 14; regno++) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- offset += 8; \
- /* offset -= 2; no fp on stack frame */ \
- (DEPTH_VAR) = offset; \
-}
-
-
-/* Addressing modes, and classification of registers for them. */
-
-#define HAVE_POST_INCREMENT
-/* #define HAVE_POST_DECREMENT */
-
-#define HAVE_PRE_DECREMENT
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
- ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
-#define REGNO_OK_FOR_BASE_P(REGNO) \
- ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-*/
-
-
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) (1)
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) (1)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) (1)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
-*/
-
-#define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
-{ \
- rtx xfoob; \
- \
- /* accept (R0) */ \
- if (GET_CODE (operand) == REG \
- && REG_OK_FOR_BASE_P(operand)) \
- goto ADDR; \
- \
- /* accept @#address */ \
- if (CONSTANT_ADDRESS_P (operand)) \
- goto ADDR; \
- \
- /* accept X(R0) */ \
- if (GET_CODE (operand) == PLUS \
- && GET_CODE (XEXP (operand, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (operand, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (operand, 1))) \
- goto ADDR; \
- \
- /* accept -(R0) */ \
- if (GET_CODE (operand) == PRE_DEC \
- && GET_CODE (XEXP (operand, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (operand, 0))) \
- goto ADDR; \
- \
- /* accept (R0)+ */ \
- if (GET_CODE (operand) == POST_INC \
- && GET_CODE (XEXP (operand, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (operand, 0))) \
- goto ADDR; \
- \
- /* handle another level of indirection ! */ \
- if (GET_CODE(operand) != MEM) \
- goto fail; \
- \
- xfoob = XEXP (operand, 0); \
- \
- /* (MEM:xx (MEM:xx ())) is not valid for SI, DI and currently */ \
- /* also forbidden for float, because we have to handle this */ \
- /* in output_move_double and/or output_move_quad() - we could */ \
- /* do it, but currently it's not worth it!!! */ \
- /* now that DFmode cannot go into CPU register file, */ \
- /* maybe I should allow float ... */ \
- /* but then I have to handle memory-to-memory moves in movdf ?? */ \
- \
- if (GET_MODE_BITSIZE(mode) > 16) \
- goto fail; \
- \
- /* accept @(R0) - which is @0(R0) */ \
- if (GET_CODE (xfoob) == REG \
- && REG_OK_FOR_BASE_P(xfoob)) \
- goto ADDR; \
- \
- /* accept @address */ \
- if (CONSTANT_ADDRESS_P (xfoob)) \
- goto ADDR; \
- \
- /* accept @X(R0) */ \
- if (GET_CODE (xfoob) == PLUS \
- && GET_CODE (XEXP (xfoob, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (xfoob, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (xfoob, 1))) \
- goto ADDR; \
- \
- /* accept @-(R0) */ \
- if (GET_CODE (xfoob) == PRE_DEC \
- && GET_CODE (XEXP (xfoob, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (xfoob, 0))) \
- goto ADDR; \
- \
- /* accept @(R0)+ */ \
- if (GET_CODE (xfoob) == POST_INC \
- && GET_CODE (XEXP (xfoob, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (xfoob, 0))) \
- goto ADDR; \
- \
- /* anything else is invalid */ \
- fail: ; \
-}
-
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the the pdp this is for predec/postinc */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
- goto LABEL; \
- }
-
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE HImode
-
-/* Define this if a raw index is all that is needed for a
- `tablejump' insn. */
-#define CASE_TAKES_INDEX_RAW
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction.
-*/
-
-#define MOVE_MAX 2
-
-/* Zero extension is faster if the target is known to be zero */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by byte is slow and undesirable. -
-*/
-#define SLOW_BYTE_ACCESS 0
-
-/* Do not break .stabs pseudos into continuations. */
-#define DBX_CONTIN_LENGTH 0
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-
-/* Add any extra modes needed to represent the condition code.
-
- CCFPmode is used for FPU, but should we use a separate reg? */
-#define EXTRA_CC_MODES CCFPmode
-
-/* the name for the mode above */
-#define EXTRA_CC_NAMES "CCFPmode"
-
-/* Give a comparison code (EQ, NE etc) and the first operand of a COMPARE,
- return the mode to be used for the comparison. For floating-point, CCFPmode
- should be used. */
-
-#define SELECT_CC_MODE(OP,X,Y) \
-(GET_MODE_CLASS(GET_MODE(X)) == MODE_FLOAT? CCFPmode : CCmode)
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-/* #define STORE_FLAG_VALUE 1 */
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode HImode
-
-/* A function address in a call instruction
- is a word address (for indexing purposes)
- so give the MEM rtx a word's mode. */
-#define FUNCTION_MODE HImode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-/* #define NO_FUNCTION_CSE */
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch.
-
- -1, 0, 1 are cheaper for add, sub ...
-*/
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL(RTX) == 0 \
- || INTVAL(RTX) == -1 \
- || INTVAL(RTX) == 1) \
- return 0; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- /* twice as expensive as REG */ \
- return 2; \
- case CONST_DOUBLE: \
- /* twice (or 4 times) as expensive as 16 bit */ \
- return 4;
-
-/* cost of moving one register class to another */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) register_move_cost(CLASS1, CLASS2)
-
-/* Tell emit-rtl.c how to initialize special values on a per-function base. */
-extern int optimize;
-extern struct rtx_def *cc0_reg_rtx;
-
-#define CC_STATUS_MDEP rtx
-
-#define CC_STATUS_MDEP_INIT (cc_status.mdep = 0)
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-#define CC_IN_FPU 04000
-
-/* Do UPDATE_CC if EXP is a set, used in
- NOTICE_UPDATE_CC
-
- floats only do compare correctly, else nullify ...
-
- get cc0 out soon ...
-*/
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ if (GET_CODE (EXP) == SET) \
- { \
- notice_update_cc_on_set(EXP, INSN); \
- } \
- else if (GET_CODE (EXP) == PARALLEL \
- && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
- { \
- notice_update_cc_on_set(XVECEXP (EXP, 0, 0), INSN); \
- } \
- else if (GET_CODE (EXP) == CALL) \
- { /* all bets are off */ CC_STATUS_INIT; } \
- if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
- && cc_status.value2 \
- && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
- printf ("here!\n", cc_status.value2 = 0); \
-}
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#if 0
-#define ASM_FILE_START(FILE) \
-( \
-fprintf (FILE, "\t.data\n"), \
-fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n") \
-/* do we need reg def's R0 = %0 etc ??? */ \
-)
-#else
-#define ASM_FILE_START(FILE) (0)
-#endif
-
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP "\t.text\n"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP "\t.data\n"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "r2", "r3", "r4", "fp", "sp", "pc", \
- "ac0", "ac1", "ac2", "ac3", "ac4", "ac5" }
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs ("\t.globl ", FILE); assemble_name (FILE, NAME); fputs("\n", FILE); } while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s_%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s_%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\tdouble %.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- fprintf (FILE, "\tfloat %.12e\n", (VALUE))
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `short' and `char' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, " /*short*/\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, " /* char */\n"))
-
-/* This is how to output an assembler line for a numeric constant byte.-
-
- do we really NEED it ? let's output it with a comment and grep the
- assembly source ;-)
-*/
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-#define ASM_OUTPUT_ASCII(FILE, P, SIZE) \
- output_ascii (FILE, P, SIZE)
-
-#define ASM_OUTPUT_ADDR_VEC_PROLOGUE(FILE, MODE, LEN) \
- fprintf (FILE, "\t/* HELP! */\n");
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.word L_%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative.
- Don't define this if it is not supported. */
-
-/* #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) */
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes.
-
- who needs this????
-*/
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", 1<<(LOG))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.=.+ %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fprintf ((FILE), ".globl "), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), "\n"), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ": .=.+ %d\n", (ROUNDED)) \
-)
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ":\t.=.+ %d\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
-
-*/
-
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (CODE == '#') fprintf (FILE, "#"); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != SImode) \
- { union { double d; int i[2]; } u; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- fprintf (FILE, "#%.20e", u.d); } \
- else { putc ('$', FILE); output_addr_const (FILE, X); }}
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address (FILE, ADDR)
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
-( \
- fprintf (FILE, "\tmov %s, -(sp)\n", reg_names[REGNO]) \
-)
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
-( \
- fprintf (FILE, "\tmov (sp)+, %s\n", reg_names[REGNO]) \
-)
-
-
-#define ASM_IDENTIFY_GCC(FILE) \
- fprintf(FILE, "gcc_compiled:\n")
-
-#define ASM_OUTPUT_DOUBLE_INT(a,b) fprintf(a,"%d", b)
-
-/* trampoline - how should i do it in separate i+d ?
- have some allocate_trampoline magic???
-
- the following should work for shared I/D: */
-
-/* lets see whether this works as trampoline:
-MV #STATIC, $4 0x940Y 0x0000 <- STATIC; Y = STATIC_CHAIN_REGNUM
-JMP FUNCTION 0x0058 0x0000 <- FUNCTION
-*/
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- if (TARGET_SPLIT) \
- abort(); \
- \
- ASM_OUTPUT_INT (FILE, gen_rtx(CONST_INT, VOIDmode, 0x9400+STATIC_CHAIN_REGNUM)); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
- ASM_OUTPUT_INT (FILE, gen_rtx(CONST_INT, VOIDmode, 0x0058)); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
-}
-
-#define TRAMPOLINE_SIZE 8
-#define TRAMPOLINE_ALIGN 16
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP,FNADDR,CXT) \
-{ \
- if (TARGET_SPLIT) \
- abort(); \
- \
- emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 2)), CXT); \
- emit_move_insn (gen_rtx (MEM, HImode, plus_constant (TRAMP, 6)), FNADDR); \
-}
-
-
-/* Some machines may desire to change what optimizations are
- performed for various optimization levels. This macro, if
- defined, is executed once just after the optimization level is
- determined and before the remainder of the command options have
- been parsed. Values set in this macro are used as the default
- values for the other command line options.
-
- LEVEL is the optimization level specified; 2 if -O2 is
- specified, 1 if -O is specified, and 0 if neither is specified. */
-
-#define OPTIMIZATION_OPTIONS(LEVEL) \
-{ \
- if (LEVEL >= 3) \
- { \
- flag_inline_functions = 1; \
- flag_omit_frame_pointer = 1; \
- /* flag_unroll_loops = 1; */ \
- } \
-}
-
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE.
-
- we don't say how expensive SImode is - pretty expensive!!!
-
- there is something wrong in MULT because MULT is not
- as cheap as total = 2 even if we can shift!
-
- if TARGET_SPACE make mult etc cheap, but not 1, so when
- in doubt the faster insn is chosen.
-*/
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MULT: \
- if (TARGET_SPACE) \
- total = COSTS_N_INSNS(2); \
- else \
- total = COSTS_N_INSNS (11); \
- break; \
- case DIV: \
- if (TARGET_SPACE) \
- total = COSTS_N_INSNS(2); \
- else \
- total = COSTS_N_INSNS (25); \
- break; \
- case MOD: \
- if (TARGET_SPACE) \
- total = COSTS_N_INSNS(2); \
- else \
- total = COSTS_N_INSNS (26); \
- break; \
- case ABS: \
- /* equivalent to length, so same for TARGET_SPACE */ \
- total = COSTS_N_INSNS (3); \
- break; \
- case ZERO_EXTEND: \
- /* only used for: qi->hi */ \
- total = COSTS_N_INSNS(1); \
- break; \
- case SIGN_EXTEND: \
- if (GET_MODE(X) == HImode) \
- total = COSTS_N_INSNS(1); \
- else if (GET_MODE(X) == SImode) \
- total = COSTS_N_INSNS(6); \
- else \
- total = COSTS_N_INSNS(2); \
- break; \
- /* case LSHIFT: */ \
- case ASHIFT: \
- case LSHIFTRT: \
- case ASHIFTRT: \
- if (TARGET_SPACE) \
- total = COSTS_N_INSNS(1); \
- else if (GET_MODE(X) == QImode) \
- { \
- if (GET_CODE(XEXP (X,1)) != CONST_INT) \
- total = COSTS_N_INSNS(8); /* worst case */ \
- else \
- total = COSTS_N_INSNS(INTVAL(XEXP (X,1))); \
- } \
- else if (GET_MODE(X) == HImode) \
- { \
- if (GET_CODE(XEXP (X,1)) == CONST_INT) \
- { \
- if (abs (INTVAL (XEXP (X, 1))) == 1) \
- total = COSTS_N_INSNS(1); \
- else \
- total = COSTS_N_INSNS(2.5 + 0.5 *INTVAL(XEXP(X,1))); \
- } \
- else /* worst case */ \
- total = COSTS_N_INSNS (10); \
- } \
- else if (GET_MODE(X) == SImode) \
- { \
- if (GET_CODE(XEXP (X,1)) == CONST_INT) \
- total = COSTS_N_INSNS(2.5 + 0.5 *INTVAL(XEXP(X,1))); \
- else /* worst case */ \
- total = COSTS_N_INSNS(18); \
- } \
- break;
-
-
-/* there is no point in avoiding branches on a pdp,
- since branches are really cheap - I just want to find out
- how much difference the BRANCH_COST macro makes in code */
-#define BRANCH_COST (TARGET_BRANCH_CHEAP ? 0 : 1)
-
-
-#define COMPARE_FLAG_MODE HImode
-
diff --git a/gcc/config/pdp11/pdp11.md b/gcc/config/pdp11/pdp11.md
deleted file mode 100644
index d23c2cd6657..00000000000
--- a/gcc/config/pdp11/pdp11.md
+++ /dev/null
@@ -1,1818 +0,0 @@
-;;- Machine description for the pdp11 for GNU C compiler
-;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
-;; Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
-
-;; 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 1, 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, 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
-;; HI is 16 bit
-;; QI is 8 bit
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-;;- Operand classes for the register allocator:
-
-;; Compare instructions.
-
-;; currently we only support df floats, which saves us quite some
-;; hassle switching the FP mode!
-;; we assume that CPU is always in long float mode, and
-;; 16 bit integer mode - currently, the prologue for main does this,
-;; but maybe we should just set up a NEW crt0 properly,
-;; -- and what about signal handling code?
-;; (we don't even let sf floats in the register file, so
-;; we only should have to worry about truncating and widening
-;; when going to memory)
-
-;; abort() call by g++ - must define libfunc for cmp_optab
-;; and ucmp_optab for mode SImode, because we don't have that!!!
-;; - yet since no libfunc is there, we abort ()
-
-;; The only thing that remains to be done then is output
-;; the floats in a way the assembler can handle it (and
-;; if you're really into it, use a PDP11 float emulation
-;; libary to do floating point constant folding - but
-;; I guess you'll get reasonable results even when not
-;; doing this)
-;; the last thing to do is fix the UPDATE_CC macro to check
-;; for floating point condition codes, and set cc_status
-;; properly, also setting the CC_IN_FCCR flag.
-
-;; define attributes
-;; currently type is only fpu or arith or unknown, maybe branch later ?
-;; default is arith
-(define_attr "type" "unknown,arith,fp" (const_string "arith"))
-
-;; length default is 1 word each
-(define_attr "length" "" (const_int 1))
-
-;; a user's asm statement
-(define_asm_attributes
- [(set_attr "type" "unknown")
-; all bets are off how long it is - make it 256, forces long jumps
-; whenever jumping around it !!!
- (set_attr "length" "256")])
-
-;; define function units
-
-;; arithmetic - values here immediately when next insn issued
-;; or does it mean the number of cycles after this insn was issued?
-;; how do I say that fpu insns use cpu also? (pre-interaction phase)
-
-;(define_function_unit "cpu" 1 1 (eq_attr "type" "arith") 0 0)
-;(define_function_unit "fpu" 1 1 (eq_attr "type" "fp") 0 0)
-
-;; compare
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "general_operand" "fR,Q,F")
- (match_operand:DF 1 "register_operand" "a,a,a")))]
- "TARGET_FPU"
- "*
-{
- cc_status.flags = CC_IN_FPU;
- return \"cmpd %0, %1\;cfcc\";
-}"
- [(set_attr "length" "2,3,6")])
-
-;; a bit of brain damage, maybe inline later -
-;; problem is - gcc seems to NEED SImode because
-;; of the cmp weirdness - maybe change gcc to handle this?
-
-(define_expand "cmpsi"
- [(set (reg:SI 0)
- (match_operand:SI 0 "general_operand" "g"))
- (set (reg:SI 2)
- (match_operand:SI 1 "general_operand" "g"))
- (parallel [(set (cc0)
- (compare (reg:SI 0)
- (reg:SI 2)))
- (clobber (reg:SI 0))])]
- "0" ;; disable for test
- "")
-
-;; check for next insn for branch code - does this still
-;; work in gcc 2.* ?
-
-(define_insn ""
- [(set (cc0)
- (compare (reg:SI 0)
- (reg:SI 2)))
- (clobber (reg:SI 0))]
- ""
- "*
-{
- rtx br_insn = NEXT_INSN (insn);
- RTX_CODE br_code;
-
- if (GET_CODE (br_insn) != JUMP_INSN)
- abort();
- br_code = GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
-
- switch(br_code)
- {
- case GEU:
- case LTU:
- case GTU:
- case LEU:
-
- return \"jsr pc, ___ucmpsi\;cmp $1,r0\";
-
- case GE:
- case LT:
- case GT:
- case LE:
- case EQ:
- case NE:
-
- return \"jsr pc, ___cmpsi\;tst r0\";
-
- default:
-
- abort();
- }
-}"
- [(set_attr "length" "4")])
-
-
-(define_insn "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "general_operand" "rR,rR,Qi,Qi")
- (match_operand:HI 1 "general_operand" "rR,Qi,rR,Qi")))]
- ""
- "cmp %0,%1"
- [(set_attr "length" "1,2,2,3")])
-
-(define_insn "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "general_operand" "rR,rR,Qi,Qi")
- (match_operand:QI 1 "general_operand" "rR,Qi,rR,Qi")))]
- ""
- "cmpb %0,%1"
- [(set_attr "length" "1,2,2,3")])
-
-
-;; We have to have this because cse can optimize the previous pattern
-;; into this one.
-
-(define_insn "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "general_operand" "fR,Q"))]
- "TARGET_FPU"
- "*
-{
- cc_status.flags = CC_IN_FPU;
- return \"tstd %0\;cfcc\";
-}"
- [(set_attr "length" "2,3")])
-
-
-(define_expand "tstsi"
- [(set (reg:SI 0)
- (match_operand:SI 0 "general_operand" "g"))
- (parallel [(set (cc0)
- (reg:SI 0))
- (clobber (reg:SI 0))])]
- "0" ;; disable for test
- "")
-
-(define_insn ""
- [(set (cc0)
- (reg:SI 0))
- (clobber (reg:SI 0))]
- ""
- "jsr pc, ___tstsi\;tst r0"
- [(set_attr "length" "3")])
-
-
-(define_insn "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "general_operand" "rR,Q"))]
- ""
- "tst %0"
- [(set_attr "length" "1,2")])
-
-(define_insn "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "general_operand" "rR,Q"))]
- ""
- "tstb %0"
- [(set_attr "length" "1,2")])
-
-;; sob instruction - we need an assembler which can make this instruction
-;; valid under _all_ circumstances!
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (plus:HI (match_operand:HI 0 "register_operand" "r")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:HI (match_dup 0)
- (const_int -1)))]
- "TARGET_40_PLUS"
- "*
-{
- static int labelcount = 0;
- static char buf[1000];
-
- if (get_attr_length (insn) == 1)
- return \"sob %0, %l1\";
-
- /* emulate sob */
- output_asm_insn (\"dec %0\", operands);
-
- sprintf (buf, \"bge LONG_SOB%d\", labelcount);
- output_asm_insn (buf, NULL);
-
- output_asm_insn (\"jmp %l1\", operands);
-
- sprintf (buf, \"LONG_SOB%d:\", labelcount++);
- output_asm_insn (buf, NULL);
-
- return \"\";
-}"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -256))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 0)))
- (const_int 4)
- (const_int 1)))])
-
-;; These control RTL generation for conditional jump insns
-;; and match them for register allocation.
-
-;; problem with too short jump distance! we need an assembler which can
-;; make this valid for all jump distances!
-;; e.g. gas!
-
-;; these must be changed to check for CC_IN_FCCR if float is to be
-;; enabled
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"beq\", \"bne\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"bne\", \"beq\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"bgt\", \"ble\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"bhi\", \"blos\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"blt\", \"bge\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"blo\", \"bhis\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"bge\", \"blt\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"bhis\", \"blo\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"ble\", \"bgt\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_jump(\"blos\", \"bhi\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-
-;; These match inverted jump insns for register allocation.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"bne\", \"beq\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"beq\", \"bne\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"ble\", \"bgt\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"blos\", \"bhi\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"bge\", \"blt\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"bhis\", \"blo\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"blt\", \"bge\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"blo\", \"bhis\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"bgt\", \"ble\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_jump(\"bhi\", \"blos\", get_attr_length(insn));"
- [(set (attr "length") (if_then_else (ior (le (minus (match_dup 0)
- (pc))
- (const_int -128))
- (ge (minus (match_dup 0)
- (pc))
- (const_int 128)))
- (const_int 3)
- (const_int 1)))])
-
-;; Move instructions
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=g")
- (match_operand:DI 1 "general_operand" "g"))]
- ""
- "* return output_move_quad (operands);"
-;; what's the mose expensive code - say twice movsi = 16
- [(set_attr "length" "16")])
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=r,r,r,rm,m")
- (match_operand:SI 1 "general_operand" "rN,IJ,K,m,r"))]
- ""
- "* return output_move_double (operands);"
-;; what's the most expensive code ? - I think 8!
-;; we could split it up and make several sub-cases...
- [(set_attr "length" "2,3,4,8,8")])
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=rR,rR,Q,Q")
- (match_operand:HI 1 "general_operand" "rRN,Qi,rRN,Qi"))]
- ""
- "*
-{
- if (operands[1] == const0_rtx)
- return \"clr %0\";
-
- return \"mov %1, %0\";
-}"
- [(set_attr "length" "1,2,2,3")])
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=rR,rR,Q,Q")
- (match_operand:QI 1 "general_operand" "rRN,Qi,rRN,Qi"))]
- ""
- "*
-{
- if (operands[1] == const0_rtx)
- return \"clrb %0\";
-
- return \"movb %1, %0\";
-}"
- [(set_attr "length" "1,2,2,3")])
-
-;; do we have to supply all these moves? e.g. to
-;; NO_LOAD_FPU_REGs ?
-(define_insn "movdf"
- [(set (match_operand:DF 0 "general_operand" "=f,R,f,Q,f,m")
- (match_operand:DF 1 "general_operand" "fR,f,Q,f,F,m"))]
- ""
- "* return output_move_quad (operands);"
-;; just a guess..
- [(set_attr "length" "1,1,2,2,5,16")])
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=g,r,g")
- (match_operand:SF 1 "general_operand" "r,rmF,g"))]
- "TARGET_FPU"
- "* return output_move_double (operands);"
- [(set_attr "length" "8,8,8")])
-
-;; maybe fiddle a bit with move_ratio, then
-;; let constraints only accept a register ...
-
-(define_expand "movstrhi"
- [(parallel [(set (mem:BLK (match_operand:BLK 0 "general_operand" "=g,g"))
- (mem:BLK (match_operand:BLK 1 "general_operand" "g,g")))
- (use (match_operand:HI 2 "arith_operand" "n,&mr"))
- (use (match_operand:HI 3 "immediate_operand" "i,i"))
- (clobber (match_scratch:HI 4 "=&r,X"))
- (clobber (match_dup 0))
- (clobber (match_dup 1))
- (clobber (match_dup 2))])]
- "(TARGET_BCOPY_BUILTIN)"
- "
-{
- operands[0] = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
- operands[1] = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
- operands[2] = force_not_mem (operands[2]);
-}")
-
-
-(define_insn "" ; "movstrhi"
- [(set (mem:BLK (match_operand:HI 0 "general_operand" "=r,r"))
- (mem:BLK (match_operand:HI 1 "general_operand" "r,r")))
- (use (match_operand:HI 2 "arith_operand" "n,&r"))
- (use (match_operand:HI 3 "immediate_operand" "i,i"))
- (clobber (match_scratch:HI 4 "=&r,X"))
- (clobber (match_dup 0))
- (clobber (match_dup 1))
- (clobber (match_dup 2))]
- "(TARGET_BCOPY_BUILTIN)"
- "* return output_block_move (operands);"
-;;; just a guess
- [(set_attr "length" "40")])
-
-
-
-;;- truncation instructions
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "general_operand" "=r,R,Q")
- (float_truncate:SF (match_operand:DF 1 "register_operand" "a,a,a")))]
- "TARGET_FPU"
- "* if (which_alternative ==0)
- {
- output_asm_insn(\"stcdf %1, -(sp)\", operands);
- output_asm_insn(\"mov (sp)+, %0\", operands);
- operands[0] = gen_rtx(REG, HImode, REGNO (operands[0])+1);
- output_asm_insn(\"mov (sp)+, %0\", operands);
- return \"\";
- }
- else if (which_alternative == 1)
- return \"stcdf %1, %0\";
- else
- return \"stcdf %1, %0\";
- "
- [(set_attr "length" "3,1,2")])
-
-
-(define_expand "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (subreg:HI
- (match_operand:SI 1 "general_operand" "or")
- 0))]
- ""
- "")
-
-
-;;- zero extension instructions
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=r")
- (zero_extend:HI (match_operand:QI 1 "general_operand" "0")))]
- ""
- "bic $(256*255), %0"
- [(set_attr "length" "2")])
-
-(define_expand "zero_extendhisi2"
- [(set (subreg:HI
- (match_dup 0)
- 1)
- (match_operand:HI 1 "register_operand" "r"))
- (set (subreg:HI
- (match_operand:SI 0 "register_operand" "=r")
- 0)
- (const_int 0))]
- ""
- "/* operands[1] = make_safe_from (operands[1], operands[0]); */")
-
-
-;;- sign extension instructions
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=a,a,a")
- (float_extend:SF (match_operand:SF 1 "general_operand" "r,R,Q")))]
- "TARGET_FPU"
- "@
- mov %1, -(sp)\;ldcfd (sp)+,%0
- ldcfd %1, %0
- ldcfd %1, %0"
- [(set_attr "length" "2,1,2")])
-
-;; does movb sign extend in register-to-register move?
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (sign_extend:HI (match_operand:QI 1 "general_operand" "rR,Q")))]
- ""
- "movb %1, %0"
- [(set_attr "length" "1,2")])
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (sign_extend:SI (match_operand:QI 1 "general_operand" "rR,Q")))]
- "TARGET_40_PLUS"
- "*
-{
- rtx latehalf[2];
-
- /* make register pair available */
- latehalf[0] = operands[0];
- operands[0] = gen_rtx(REG, HImode, REGNO (operands[0])+1);
-
- output_asm_insn(\"movb %1, %0\", operands);
- output_asm_insn(\"sxt %0\", latehalf);
-
- return \"\";
-}"
- [(set_attr "length" "2,3")])
-
-;; maybe we have to use define_expand to say that we have the instruction,
-;; unconditionally, and then match dependent on CPU type:
-
-(define_expand "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (sign_extend:SI (match_operand:HI 1 "general_operand" "g")))]
- ""
- "")
-
-(define_insn "" ; "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=o,<,r")
- (sign_extend:SI (match_operand:HI 1 "general_operand" "g,g,g")))]
- "TARGET_40_PLUS"
- "*
-{
- rtx latehalf[2];
-
- /* we don't want to mess with auto increment */
-
- switch(which_alternative)
- {
- case 0:
-
- latehalf[0] = operands[0];
- operands[0] = adj_offsettable_operand(operands[0], 2);
-
- output_asm_insn(\"mov %1, %0\", operands);
- output_asm_insn(\"sxt %0\", latehalf);
-
- return \"\";
-
- case 1:
-
- /* - auto-decrement - right direction ;-) */
- output_asm_insn(\"mov %1, %0\", operands);
- output_asm_insn(\"sxt %0\", operands);
-
- return \"\";
-
- case 2:
-
- /* make register pair available */
- latehalf[0] = operands[0];
- operands[0] = gen_rtx(REG, HImode, REGNO (operands[0])+1);
-
- output_asm_insn(\"mov %1, %0\", operands);
- output_asm_insn(\"sxt %0\", latehalf);
-
- return \"\";
-
- default:
-
- abort();
- }
-}"
- [(set_attr "length" "5,3,3")])
-
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI (match_operand:HI 1 "general_operand" "0")))]
- "(! TARGET_40_PLUS)"
- "*
-{
- static count = 0;
- char buf[100];
- rtx lateoperands[2];
-
- lateoperands[0] = operands[0];
- operands[0] = gen_rtx(REG, HImode, REGNO (operands[0])+1);
-
- output_asm_insn(\"tst %0\", operands);
- sprintf(buf, \"bge extendhisi%d\", count);
- output_asm_insn(buf, NULL);
- output_asm_insn(\"mov -1, %0\", lateoperands);
- sprintf(buf, \"bne extendhisi%d\", count+1);
- output_asm_insn(buf, NULL);
- sprintf(buf, \"\\nextendhisi%d:\", count);
- output_asm_insn(buf, NULL);
- output_asm_insn(\"clr %0\", lateoperands);
- sprintf(buf, \"\\nextendhisi%d:\", count+1);
- output_asm_insn(buf, NULL);
-
- count += 2;
-
- return \"\";
-}"
- [(set_attr "length" "6")])
-
-;; make float to int and vice versa
-;; using the cc_status.flag field we could probably cut down
-;; on seti and setl
-;; assume that we are normally in double and integer mode -
-;; what do pdp library routines do to fpu mode ?
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=a,a,a")
- (float:DF (match_operand:SI 1 "general_operand" "r,R,Q")))]
- "TARGET_FPU"
- "* if (which_alternative ==0)
- {
- rtx latehalf[2];
-
- latehalf[0] = NULL;
- latehalf[1] = gen_rtx(REG, HImode, REGNO (operands[0])+1);
- output_asm_insn(\"mov %1, -(sp)\", latehalf);
- output_asm_insn(\"mov %1, -(sp)\", operands);
-
- output_asm_insn(\"setl\", operands);
- output_asm_insn(\"ldcld (sp)+, %0\", operands);
- output_asm_insn(\"seti\", operands);
- return \"\";
- }
- else if (which_alternative == 1)
- return \"setl\;ldcld %1, %0\;seti\";
- else
- return \"setl\;ldcld %1, %0\;seti\";
- "
- [(set_attr "length" "5,3,4")])
-
-(define_insn "floathidf2"
- [(set (match_operand:DF 0 "register_operand" "=a,a")
- (float:DF (match_operand:HI 1 "general_operand" "rR,Qi")))]
- "TARGET_FPU"
- "ldcid %1, %0"
- [(set_attr "length" "1,2")])
-
-;; cut float to int
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=r,R,Q")
- (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "a,a,a"))))]
- "TARGET_FPU"
- "* if (which_alternative ==0)
- {
- output_asm_insn(\"setl\", operands);
- output_asm_insn(\"stcdl %1, -(sp)\", operands);
- output_asm_insn(\"seti\", operands);
- output_asm_insn(\"mov (sp)+, %0\", operands);
- operands[0] = gen_rtx(REG, HImode, REGNO (operands[0])+1);
- output_asm_insn(\"mov (sp)+, %0\", operands);
- return \"\";
- }
- else if (which_alternative == 1)
- return \"setl\;stcdl %1, %0\;seti\";
- else
- return \"setl\;stcdl %1, %0\;seti\";
- "
- [(set_attr "length" "5,3,4")])
-
-(define_insn "fix_truncdfhi2"
- [(set (match_operand:HI 0 "general_operand" "=rR,Q")
- (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "a,a"))))]
- "TARGET_FPU"
- "stcdi %1, %0"
- [(set_attr "length" "1,2")])
-
-
-;;- arithmetic instructions
-;;- add instructions
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=a,a,a")
- (plus:DF (match_operand:DF 1 "register_operand" "%0,0,0")
- (match_operand:DF 2 "general_operand" "fR,Q,F")))]
- "TARGET_FPU"
- "addd %2, %0"
- [(set_attr "length" "1,2,5")])
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "general_operand" "=r,r,o,o,r,r,r,o,o,o")
- (plus:SI (match_operand:SI 1 "general_operand" "%0,0,0,0,0,0,0,0,0,0")
- (match_operand:SI 2 "general_operand" "r,o,r,o,I,J,K,I,J,K")))]
- ""
- "*
-{ /* Here we trust that operands don't overlap
-
- or is lateoperands the low word?? - looks like it! */
-
- unsigned int i;
- rtx lateoperands[3];
-
- lateoperands[0] = operands[0];
-
- if (REG_P (operands[0]))
- operands[0] = gen_rtx(REG, HImode, REGNO(operands[0]) + 1);
- else
- operands[0] = adj_offsettable_operand (operands[0], 2);
-
- if (! CONSTANT_P(operands[2]))
- {
- lateoperands[2] = operands[2];
-
- if (REG_P (operands[2]))
- operands[2] = gen_rtx(REG, HImode, REGNO(operands[2]) + 1);
- else
- operands[2] = adj_offsettable_operand(operands[2], 2);
-
- output_asm_insn (\"add %2, %0\", operands);
- output_asm_insn (\"adc %0\", lateoperands);
- output_asm_insn (\"add %2, %0\", lateoperands);
- return \"\";
- }
-
- lateoperands[2] = gen_rtx(CONST_INT, VOIDmode, (INTVAL(operands[2]) >> 16) & 0xffff);
- operands[2] = gen_rtx(CONST_INT, VOIDmode, INTVAL(operands[2]) & 0xffff);
-
- if (INTVAL(operands[2]))
- {
- output_asm_insn (\"add %2, %0\", operands);
- output_asm_insn (\"adc %0\", lateoperands);
- }
-
- if (INTVAL(lateoperands[2]))
- output_asm_insn (\"add %2, %0\", lateoperands);
-
- return \"\";
-}"
- [(set_attr "length" "3,5,6,8,3,1,5,5,3,8")])
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "general_operand" "=rR,rR,Q,Q")
- (plus:HI (match_operand:HI 1 "general_operand" "%0,0,0,0")
- (match_operand:HI 2 "general_operand" "rRLM,Qi,rRLM,Qi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- if (INTVAL(operands[2]) == 1)
- return \"inc %0\";
- else if (INTVAL(operands[2]) == -1)
- return \"dec %0\";
-
- return \"add %2, %0\";
-}"
- [(set_attr "length" "1,2,2,3")])
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "general_operand" "=rR,rR,Q,Q")
- (plus:QI (match_operand:QI 1 "general_operand" "%0,0,0,0")
- (match_operand:QI 2 "general_operand" "rRLM,Qi,rRLM,Qi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- if (INTVAL(operands[2]) == 1)
- return \"incb %0\";
- else if (INTVAL(operands[2]) == -1)
- return \"decb %0\";
-
- return \"addb %2, %0\";
-}"
- [(set_attr "length" "1,2,2,3")])
-
-
-;;- subtract instructions
-;; we don't have to care for constant second
-;; args, since they are canonical plus:xx now!
-;; also for minus:DF ??
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=a,a")
- (minus:DF (match_operand:DF 1 "register_operand" "0,0")
- (match_operand:DF 2 "general_operand" "fR,Q")))]
- "TARGET_FPU"
- "subd %2, %0"
- [(set_attr "length" "1,2")])
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "general_operand" "=r,r,o,o")
- (minus:SI (match_operand:SI 1 "general_operand" "0,0,0,0")
- (match_operand:SI 2 "general_operand" "r,o,r,o")))]
- ""
- "*
-{ /* Here we trust that operands don't overlap
-
- or is lateoperands the low word?? - looks like it! */
-
- unsigned int i;
- rtx lateoperands[3];
-
- lateoperands[0] = operands[0];
-
- if (REG_P (operands[0]))
- operands[0] = gen_rtx(REG, HImode, REGNO(operands[0]) + 1);
- else
- operands[0] = adj_offsettable_operand (operands[0], 2);
-
- lateoperands[2] = operands[2];
-
- if (REG_P (operands[2]))
- operands[2] = gen_rtx(REG, HImode, REGNO(operands[2]) + 1);
- else
- operands[2] = adj_offsettable_operand(operands[2], 2);
-
- output_asm_insn (\"sub %2, %0\", operands);
- output_asm_insn (\"sbc %0\", lateoperands);
- output_asm_insn (\"sub %2, %0\", lateoperands);
- return \"\";
-}"
-;; offsettable memory addresses always are expensive!!!
- [(set_attr "length" "3,5,6,8")])
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "general_operand" "=rR,rR,Q,Q")
- (minus:HI (match_operand:HI 1 "general_operand" "0,0,0,0")
- (match_operand:HI 2 "general_operand" "rR,Qi,rR,Qi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- abort();
-
- return \"sub %2, %0\";
-}"
- [(set_attr "length" "1,2,2,3")])
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "general_operand" "=rR,rR,Q,Q")
- (minus:QI (match_operand:QI 1 "general_operand" "0,0,0,0")
- (match_operand:QI 2 "general_operand" "rR,Qi,rR,Qi")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- abort();
-
- return \"subb %2, %0\";
-}"
- [(set_attr "length" "1,2,2,3")])
-
-;;;;- and instructions
-;; Bit-and on the pdp (like on the vax) is done with a clear-bits insn.
-(define_expand "andsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (and:SI (match_operand:SI 1 "general_operand" "0")
- (not:SI (match_operand:SI 2 "general_operand" "g"))))]
- ""
- "
-{
- extern rtx expand_unop ();
- if (GET_CODE (operands[2]) == CONST_INT)
- operands[2] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
- else
- operands[2] = expand_unop (SImode, one_cmpl_optab, operands[2], 0, 1);
-}")
-
-(define_expand "andhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (and:HI (match_operand:HI 1 "general_operand" "0")
- (not:HI (match_operand:HI 2 "general_operand" "g"))))]
- ""
- "
-{
- extern rtx expand_unop ();
- if (GET_CODE (operands[2]) == CONST_INT)
- operands[2] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
- else
- operands[2] = expand_unop (HImode, one_cmpl_optab, operands[2], 0, 1);
-}")
-
-(define_expand "andqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (and:QI (match_operand:QI 1 "general_operand" "0")
- (not:QI (match_operand:QI 2 "general_operand" "g"))))]
- ""
- "
-{
- extern rtx expand_unop ();
- rtx op = operands[2];
- if (GET_CODE (op) == CONST_INT)
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- ((1 << 8) - 1) & ~INTVAL (op));
- else
- operands[2] = expand_unop (QImode, one_cmpl_optab, op, 0, 1);
-}")
-
-(define_insn "andcbsi3"
- [(set (match_operand:SI 0 "general_operand" "=r,r,o,o,r,r,r,o,o,o")
- (and:SI (match_operand:SI 1 "general_operand" "%0,0,0,0,0,0,0,0,0,0")
- (not:SI (match_operand:SI 2 "general_operand" "r,o,r,o,I,J,K,I,J,K"))))]
- ""
- "*
-{ /* Here we trust that operands don't overlap
-
- or is lateoperands the low word?? - looks like it! */
-
- unsigned int i;
- rtx lateoperands[3];
-
- lateoperands[0] = operands[0];
-
- if (REG_P (operands[0]))
- operands[0] = gen_rtx(REG, HImode, REGNO(operands[0]) + 1);
- else
- operands[0] = adj_offsettable_operand (operands[0], 2);
-
- if (! CONSTANT_P(operands[2]))
- {
- lateoperands[2] = operands[2];
-
- if (REG_P (operands[2]))
- operands[2] = gen_rtx(REG, HImode, REGNO(operands[2]) + 1);
- else
- operands[2] = adj_offsettable_operand(operands[2], 2);
-
- output_asm_insn (\"bic %2, %0\", operands);
- output_asm_insn (\"bic %2, %0\", lateoperands);
- return \"\";
- }
-
- lateoperands[2] = gen_rtx(CONST_INT, VOIDmode, (INTVAL(operands[2]) >> 16) & 0xffff);
- operands[2] = gen_rtx(CONST_INT, VOIDmode, INTVAL(operands[2]) & 0xffff);
-
- /* these have different lengths, so we should have
- different constraints! */
- if (INTVAL(operands[2]))
- output_asm_insn (\"bic %2, %0\", operands);
-
- if (INTVAL(lateoperands[2]))
- output_asm_insn (\"bic %2, %0\", lateoperands);
-
- return \"\";
-}"
- [(set_attr "length" "2,4,4,6,2,2,4,3,3,6")])
-
-(define_insn "andcbhi3"
- [(set (match_operand:HI 0 "general_operand" "=rR,rR,Q,Q")
- (and:HI (match_operand:HI 1 "general_operand" "0,0,0,0")
- (not:HI (match_operand:HI 2 "general_operand" "rR,Qi,rR,Qi"))))]
- ""
- "bic %2, %0"
- [(set_attr "length" "1,2,2,3")])
-
-(define_insn "andcbqi3"
- [(set (match_operand:QI 0 "general_operand" "=rR,rR,Q,Q")
- (and:QI (match_operand:QI 1 "general_operand" "0,0,0,0")
- (not:QI (match_operand:QI 2 "general_operand" "rR,Qi,rR,Qi"))))]
- ""
- "bicb %2, %0"
- [(set_attr "length" "1,2,2,3")])
-
-;;- Bit set (inclusive or) instructions
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "general_operand" "=r,r,o,o,r,r,r,o,o,o")
- (ior:SI (match_operand:SI 1 "general_operand" "%0,0,0,0,0,0,0,0,0,0")
- (match_operand:SI 2 "general_operand" "r,o,r,o,I,J,K,I,J,K")))]
- ""
- "*
-{ /* Here we trust that operands don't overlap
-
- or is lateoperands the low word?? - looks like it! */
-
- unsigned int i;
- rtx lateoperands[3];
-
- lateoperands[0] = operands[0];
-
- if (REG_P (operands[0]))
- operands[0] = gen_rtx(REG, HImode, REGNO(operands[0]) + 1);
- else
- operands[0] = adj_offsettable_operand (operands[0], 2);
-
- if (! CONSTANT_P(operands[2]))
- {
- lateoperands[2] = operands[2];
-
- if (REG_P (operands[2]))
- operands[2] = gen_rtx(REG, HImode, REGNO(operands[2]) + 1);
- else
- operands[2] = adj_offsettable_operand(operands[2], 2);
-
- output_asm_insn (\"bis %2, %0\", operands);
- output_asm_insn (\"bis %2, %0\", lateoperands);
- return \"\";
- }
-
- lateoperands[2] = gen_rtx(CONST_INT, VOIDmode, (INTVAL(operands[2]) >> 16) & 0xffff);
- operands[2] = gen_rtx(CONST_INT, VOIDmode, INTVAL(operands[2]) & 0xffff);
-
- /* these have different lengths, so we should have
- different constraints! */
- if (INTVAL(operands[2]))
- output_asm_insn (\"bis %2, %0\", operands);
-
- if (INTVAL(lateoperands[2]))
- output_asm_insn (\"bis %2, %0\", lateoperands);
-
- return \"\";
-}"
- [(set_attr "length" "2,4,4,6,2,2,4,3,3,6")])
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "general_operand" "=rR,rR,Q,Q")
- (ior:HI (match_operand:HI 1 "general_operand" "%0,0,0,0")
- (match_operand:HI 2 "general_operand" "rR,Qi,rR,Qi")))]
- ""
- "bis %2, %0"
- [(set_attr "length" "1,2,2,3")])
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "general_operand" "=rR,rR,Q,Q")
- (ior:QI (match_operand:QI 1 "general_operand" "%0,0,0,0")
- (match_operand:QI 2 "general_operand" "rR,Qi,rR,Qi")))]
- ""
- "bisb %2, %0")
-
-;;- xor instructions
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
- (xor:SI (match_operand:SI 1 "register_operand" "%0,0,0,0")
- (match_operand:SI 2 "arith_operand" "r,I,J,K")))]
- "TARGET_40_PLUS"
- "*
-{ /* Here we trust that operands don't overlap */
-
- unsigned int i;
- rtx lateoperands[3];
-
- lateoperands[0] = operands[0];
- operands[0] = gen_rtx(REG, HImode, REGNO(operands[0]) + 1);
-
- if (REG_P(operands[2]))
- {
- lateoperands[2] = operands[2];
- operands[2] = gen_rtx(REG, HImode, REGNO(operands[2]) + 1);
-
- output_asm_insn (\"xor %2, %0\", operands);
- output_asm_insn (\"xor %2, %0\", lateoperands);
-
- return \"\";
- }
-
- lateoperands[2] = gen_rtx(CONST_INT, VOIDmode, (INTVAL(operands[2]) >> 16) & 0xffff);
- operands[2] = gen_rtx(CONST_INT, VOIDmode, INTVAL(operands[2]) & 0xffff);
-
- if (INTVAL(operands[2]))
- output_asm_insn (\"xor %2, %0\", operands);
-
- if (INTVAL(lateoperands[2]))
- output_asm_insn (\"xor %2, %0\", lateoperands);
-
- return \"\";
-}"
- [(set_attr "length" "2,1,1,2")])
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "general_operand" "=rR,Q")
- (xor:HI (match_operand:HI 1 "general_operand" "%0,0")
- (match_operand:HI 2 "register_operand" "r,r")))]
- "TARGET_40_PLUS"
- "xor %2, %0"
- [(set_attr "length" "1,2")])
-
-;;- one complement instructions
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "general_operand" "=rR,Q")
- (not:HI (match_operand:HI 1 "general_operand" "0,0")))]
- ""
- "com %0"
- [(set_attr "length" "1,2")])
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "general_operand" "=rR,Q")
- (not:QI (match_operand:QI 1 "general_operand" "0,0")))]
- ""
- "comb %0"
- [(set_attr "length" "1,2")])
-
-;;- arithmetic shift instructions
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:HI 2 "general_operand" "rR,Qi")))]
- "TARGET_45"
- "ashc %2,%0"
- [(set_attr "length" "1,2")])
-
-;; Arithmetic right shift on the pdp works by negating the shift count.
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "
-{
- operands[2] = negate_rtx (HImode, operands[2]);
-}")
-
-;; define asl aslb asr asrb - ashc missing!
-
-;; asl
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=rR,Q")
- (ashift:HI (match_operand:HI 1 "general_operand" "0,0")
- (const_int 1)))]
- ""
- "asl %0"
- [(set_attr "length" "1,2")])
-
-;; and another possibility for asr is << -1
-;; might cause problems since -1 can also be encoded as 65535!
-;; not in gcc2 ???
-
-;; asr
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=rR,Q")
- (ashift:HI (match_operand:HI 1 "general_operand" "0,0")
- (const_int -1)))]
- ""
- "asr %0"
- [(set_attr "length" "1,2")])
-
-;; shift is by arbitrary count is expensive,
-;; shift by one cheap - so let's do that, if
-;; space doesn't matter
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=r")
- (ashift:HI (match_operand:HI 1 "general_operand" "0")
- (match_operand:HI 2 "expand_shift_operand" "O")))]
- "TARGET_TIME"
- "*
-{
- register int i;
-
- for (i = 1; i <= abs(INTVAL(operands[2])); i++)
- if (INTVAL(operands[2]) < 0)
- output_asm_insn(\"asr %0\", operands);
- else
- output_asm_insn(\"asl %0\", operands);
-
- return \"\";
-}"
-;; longest is 4
- [(set (attr "length") (const_int 4))])
-
-;; aslb
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=r,o")
- (ashift:QI (match_operand:QI 1 "general_operand" "0,0")
- (match_operand:HI 2 "const_immediate_operand" "n,n")))]
- ""
- "*
-{ /* allowing predec or post_inc is possible, but hairy! */
- int i, cnt;
-
- cnt = INTVAL(operands[2]) & 0x0007;
-
- for (i=0 ; i < cnt ; i++)
- output_asm_insn(\"aslb %0\", operands);
-
- return \"\";
-}"
-;; set attribute length ( match_dup 2 & 7 ) *(1 or 2) !!!
- [(set_attr_alternative "length"
- [(const_int 7)
- (const_int 14)])])
-
-;;; asr
-;(define_insn ""
-; [(set (match_operand:HI 0 "general_operand" "=rR,Q")
-; (ashiftrt:HI (match_operand:HI 1 "general_operand" "0,0")
-; (const_int 1)))]
-; ""
-; "asr %0"
-; [(set_attr "length" "1,2")])
-
-;; asrb
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=r,o")
- (ashiftrt:QI (match_operand:QI 1 "general_operand" "0,0")
- (match_operand:HI 2 "const_immediate_operand" "n,n")))]
- ""
- "*
-{ /* allowing predec or post_inc is possible, but hairy! */
- int i, cnt;
-
- cnt = INTVAL(operands[2]) & 0x0007;
-
- for (i=0 ; i < cnt ; i++)
- output_asm_insn(\"asrb %0\", operands);
-
- return \"\";
-}"
- [(set_attr_alternative "length"
- [(const_int 7)
- (const_int 14)])])
-
-;; the following is invalid - too complex!!! - just say 14 !!!
-; [(set (attr "length") (plus (and (match_dup 2)
-; (const_int 7))
-; (and (match_dup 2)
-; (const_int 7))))])
-
-
-
-;; can we get +-1 in the next pattern? should
-;; have been caught by previous patterns!
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (ashift:HI (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:HI 2 "general_operand" "rR,Qi")))]
- ""
- "*
-{
- if (GET_CODE(operands[2]) == CONST_INT)
- if (INTVAL(operands[2]) == 1)
- return \"asl %0\";
- else if (INTVAL(operands[2]) == -1)
- return \"asr %0\";
-
- return \"ash %2,%0\";
-}"
- [(set_attr "length" "1,2")])
-
-;; Arithmetic right shift on the pdp works by negating the shift count.
-(define_expand "ashrhi3"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (ashift:HI (match_operand:HI 1 "register_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "
-{
- operands[2] = negate_rtx (HImode, operands[2]);
-}")
-
-;;;;- logical shift instructions
-;;(define_insn "lshrsi3"
-;; [(set (match_operand:HI 0 "register_operand" "=r")
-;; (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
-;; (match_operand:HI 2 "arith_operand" "rI")))]
-;; ""
-;; "srl %0,%2")
-
-;; absolute
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "general_operand" "=fR,Q")
- (abs:DF (match_operand:DF 1 "general_operand" "0,0")))]
- "TARGET_FPU"
- "absd %0"
- [(set_attr "length" "1,2")])
-
-(define_insn "abshi2"
- [(set (match_operand:HI 0 "general_operand" "=r,o")
- (abs:HI (match_operand:HI 1 "general_operand" "0,0")))]
- "TARGET_ABSHI_BUILTIN"
- "*
-{
- static count = 0;
- char buf[200];
-
- output_asm_insn(\"tst %0\", operands);
- sprintf(buf, \"bge abshi%d\", count);
- output_asm_insn(buf, NULL);
- output_asm_insn(\"neg %0\", operands);
- sprintf(buf, \"\\nabshi%d:\", count++);
- output_asm_insn(buf, NULL);
-
- return \"\";
-}"
- [(set_attr "length" "3,5")])
-
-
-;; define expand abshi - is much better !!! - but
-;; will it be optimized into an abshi2 ?
-;; it will leave better code, because the tsthi might be
-;; optimized away!!
-; -- just a thought - don't have time to check
-;
-;(define_expand "abshi2"
-; [(match_operand:HI 0 "general_operand" "")
-; (match_operand:HI 1 "general_operand" "")]
-; ""
-; "
-;{
-; rtx label = gen_label_rtx ();
-;
-; /* do I need this? */
-; do_pending_stack_adjust ();
-;
-; emit_move_insn (operands[0], operands[1]);
-;
-; emit_insn (gen_tsthi (operands[0]));
-; emit_insn (gen_bge (label1));
-;
-; emit_insn (gen_neghi(operands[0], operands[0])
-;
-; emit_barrier ();
-;
-; emit_label (label);
-;
-; /* allow REG_NOTES to be set on last insn (labels don't have enough
-; fields, and can't be used for REG_NOTES anyway). */
-; emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
-; DONE;
-;}")
-
-;; negate insns
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "general_operand" "=fR,Q")
- (neg:DF (match_operand:DF 1 "register_operand" "0,0")))]
- "TARGET_FPU"
- "negd %0"
- [(set_attr "length" "1,2")])
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "general_operand" "=rR,Q")
- (neg:HI (match_operand:HI 1 "general_operand" "0,0")))]
- ""
- "neg %0"
- [(set_attr "length" "1,2")])
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "general_operand" "=rR,Q")
- (neg:QI (match_operand:QI 1 "general_operand" "0,0")))]
- ""
- "negb %0"
- [(set_attr "length" "1,2")])
-
-
-;; Unconditional and other jump instructions
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jmp %l0"
- [(set_attr "length" "2")])
-
-(define_insn ""
- [(set (pc)
- (label_ref (match_operand 0 "" "")))
- (clobber (const_int 1))]
- ""
- "jmp %l0"
- [(set_attr "length" "2")])
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:HI 0 "general_operand" "rR,Q"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jmp %0"
- [(set_attr "length" "1,2")])
-
-;; indirect jump - let's be conservative!
-;; allow only register_operand, even though we could also
-;; allow labels etc.
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:HI 0 "register_operand" "r"))]
- ""
- "jmp (%0)")
-
-;;- jump to subroutine
-
-(define_insn "call"
- [(call (match_operand:HI 0 "general_operand" "R,Q")
- (match_operand:HI 1 "general_operand" "g,g"))
-;; (use (reg:HI 0)) what was that ???
- ]
- ;;- Don't use operand 1 for most machines.
- ""
- "jsr pc, %0"
- [(set_attr "length" "1,2")])
-
-;;- jump to subroutine
-(define_insn "call_value"
- [(set (match_operand 0 "" "")
- (call (match_operand:HI 1 "general_operand" "R,Q")
- (match_operand:HI 2 "general_operand" "g,g")))
-;; (use (reg:HI 0)) - what was that ????
- ]
- ;;- Don't use operand 2 for most machines.
- ""
- "jsr pc, %1"
- [(set_attr "length" "1,2")])
-
-;;- nop instruction
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-
-;;- multiply
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=a,a,a")
- (mult:DF (match_operand:DF 1 "register_operand" "%0,0,0")
- (match_operand:DF 2 "general_operand" "fR,Q,F")))]
- "TARGET_FPU"
- "muld %2, %0"
- [(set_attr "length" "1,2,5")])
-
-;; 16 bit result multiply:
-;; currently we multiply only into odd registers, so we don't use two
-;; registers - but this is a bit inefficient at times. If we define
-;; a register class for each register, then we can specify properly
-;; which register need which scratch register ....
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "register_operand" "=d,d") ; multiply regs
- (mult:HI (match_operand:HI 1 "register_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "rR,Qi")))]
- "TARGET_45"
- "mul %2, %0"
- [(set_attr "length" "1,2")])
-
-;; 32 bit result
-(define_expand "mulhisi3"
- [(set (match_dup 3)
- (match_operand:HI 1 "general_operand" "g,g"))
- (set (match_operand:SI 0 "register_operand" "=r,r") ; even numbered!
- (mult:SI (truncate:HI
- (match_dup 0))
- (match_operand:HI 2 "general_operand" "rR,Qi")))]
- "TARGET_45"
- "operands[3] = gen_lowpart(HImode, operands[1]);")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r") ; even numbered!
- (mult:SI (truncate:HI
- (match_operand:SI 1 "register_operand" "%0,0"))
- (match_operand:HI 2 "general_operand" "rR,Qi")))]
- "TARGET_45"
- "mul %2, %0"
- [(set_attr "length" "1,2")])
-
-;(define_insn "mulhisi3"
-; [(set (match_operand:SI 0 "register_operand" "=r,r") ; even numbered!
-; (mult:SI (truncate:HI
-; (match_operand:SI 1 "register_operand" "%0,0"))
-; (match_operand:HI 2 "general_operand" "rR,Qi")))]
-; "TARGET_45"
-; "mul %2, %0"
-; [(set_attr "length" "1,2")])
-
-;;- divide
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=a,a,a")
- (div:DF (match_operand:DF 1 "register_operand" "0,0,0")
- (match_operand:DF 2 "general_operand" "fR,Q,F")))]
- "TARGET_FPU"
- "divd %2, %0"
- [(set_attr "length" "1,2,5")])
-
-
-(define_expand "divhi3"
- [(set (subreg:HI (match_dup 1) 0)
- (div:HI (match_operand:SI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))
- (set (match_operand:HI 0 "general_operand" "=r")
- (subreg:HI (match_dup 1) 0))]
- "TARGET_45"
- "")
-
-(define_insn ""
- [(set (subreg:HI (match_operand:SI 0 "general_operand" "=r") 0)
- (div:HI (match_operand:SI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- "TARGET_45"
- "div %2,%0"
- [(set_attr "length" "2")])
-
-(define_expand "modhi3"
- [(set (subreg:HI (match_dup 1) 1)
- (mod:HI (match_operand:SI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))
- (set (match_operand:HI 0 "general_operand" "=r")
- (subreg:HI (match_dup 1) 1))]
- "TARGET_45"
- "")
-
-(define_insn ""
- [(set (subreg:HI (match_operand:SI 0 "general_operand" "=r") 1)
- (mod:HI (match_operand:SI 1 "general_operand" "0")
- (match_operand:HI 2 "general_operand" "g")))]
- "TARGET_45"
- "div %2,%0"
- [(set_attr "length" "2")])
-
-;(define_expand "divmodhi4"
-; [(parallel [(set (subreg:HI (match_dup 1) 0)
-; (div:HI (match_operand:SI 1 "general_operand" "0")
-; (match_operand:HI 2 "general_operand" "g")))
-; (set (subreg:HI (match_dup 1) 1)
-; (mod:HI (match_dup 1)
-; (match_dup 2)))])
-; (set (match_operand:HI 3 "general_operand" "=r")
-; (subreg:HI (match_dup 1) 1))
-; (set (match_operand:HI 0 "general_operand" "=r")
-; (subreg:HI (match_dup 1) 0))]
-; "TARGET_45"
-; "")
-;
-;(define_insn ""
-; [(set (subreg:HI (match_operand:SI 0 "general_operand" "=r") 0)
-; (div:HI (match_operand:SI 1 "general_operand" "0")
-; (match_operand:HI 2 "general_operand" "g")))
-; (set (subreg:HI (match_dup 0) 1)
-; (mod:HI (match_dup 1)
-; (match_dup 2)))]
-; "TARGET_45"
-; "div %2, %0")
-;
-
-;; is rotate doing the right thing to be included here ????
diff --git a/gcc/config/pdp11/t-pdp11 b/gcc/config/pdp11/t-pdp11
deleted file mode 100644
index ebcdbb3a352..00000000000
--- a/gcc/config/pdp11/t-pdp11
+++ /dev/null
@@ -1,8 +0,0 @@
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-
-# forget the libgcc1...
-LIBGCC1_TEST =
-
-TARGET_LIBGCC2_CFLAGS = -O2 -mfloat32
-#LIB2FUNCS_EXTRA =
diff --git a/gcc/config/pdp11/xm-pdp11.h b/gcc/config/pdp11/xm-pdp11.h
deleted file mode 100644
index f6a5467ea4c..00000000000
--- a/gcc/config/pdp11/xm-pdp11.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Configuration for GNU C-compiler for pdp-11 family.
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
- Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at).
-
-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. */
-
-/* gcc can never run on a PDP, since it needs too much memory */
-/* but we need the xm-pdp.h file to compile libgcc2 */
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
diff --git a/gcc/config/psos.h b/gcc/config/psos.h
deleted file mode 100644
index 0299a35d8ec..00000000000
--- a/gcc/config/psos.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for some
- embedded system running pSOS. We assume GNU tools with ELF, but
- try to maintain compatibility with the MRI tools. Based on svr4.h.
- Copyright (C) 1996 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.
-
- To use this file, make up a file with a name like:
-
- ?????-psos.h
-
- where ????? is replaced by the name of the basic hardware that you
- are targeting for. Then, in the file ?????-psos.h, put something
- like:
-
- #include "?????.h"
- #include "psos.h"
-
- followed by any really system-specific defines (or overrides of
- defines) which you find that you need.
-*/
-
-
-/* Define a symbol indicating that we are using psos.h. */
-
-#define USING_PSOS_H
-
-
-/* All pSOS targets currently use the ELF object file format. */
-
-#define OBJECT_FORMAT_ELF
-
-
-/* Provide a NULL STARTFILE_SPEC. The startfile cannot be specified
- here because it depends on the architecture (e.g. 68K), the
- board-support package (e.g. M162) and the run-time configuration
- (e.g. application vs. ram-image vs. rom-image). Specify the
- startfile in a linker-script created from the generic
- architecture-specific linker-scripts. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
-
-
-/* Predefined macros (independent of processor type). */
-
-#define CPP_PREDEFINES "-Dpsos"
-
-
-/* Implicit library calls should use ANSI memcpy rather than BSD
- bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-
-/* When using stabs, gcc2_compiled must be a stabs entry, not an
- ordinary symbol, or gdb won't see it. The stabs entry must be
- before the N_SO in order for gdb to find it. */
-
-#define ASM_IDENTIFY_GCC(FILE) \
-do \
- { \
- fputs (".stabs \"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \
- } \
-while (0)
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#define ASM_WEAKEN_LABEL(FILE,NAME) \
- do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
- fputc ('\n', FILE); } while (0)
-
-/* Switch into a generic section. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
- (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
- (DECL) && TREE_READONLY (DECL) ? "a" : "aw")
-
-
-/* Define the pseudo-ops used to switch to the .ctors and .dtors
- sections. */
-
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
-
-/* A default list of other sections which we might be "in" at any given
- time. For targets that use additional sections (e.g. .tdesc) you
- should override this definition in the target-specific file which
- includes this file. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A default list of extra section function definitions. For targets
- that use additional sections (e.g. .tdesc) you should override this
- definition in the target-specific file which includes this file. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-extern void text_section ();
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-
-#ifndef INT_ASM_OP
-#define INT_ASM_OP ".long"
-#endif
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-
-/* Use DBX debugging info by default. */
-
-#ifndef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-#endif
-
-/* For pSOS we use DBX debugging info. */
-
-#define DBX_DEBUGGING_INFO
-
-
-/* Prevent generation of an exit function. */
-
-#define HAVE_ATEXIT
-
diff --git a/gcc/config/ptx4.h b/gcc/config/ptx4.h
deleted file mode 100644
index 7bda47c9235..00000000000
--- a/gcc/config/ptx4.h
+++ /dev/null
@@ -1,859 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for some
- generic System V Release 4 system.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@monkeys.com).
- Renamed and changed to suit Dynix/ptx v4 and later.
- Modified by Tim Wright (timw@sequent.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.
-
-*/
-
-/* Define a symbol indicating that we are using svr4.h. */
-#define USING_SVR4_H
-
-/* For the sake of libgcc2.c, indicate target supports atexit. */
-#define HAVE_ATEXIT
-
-/* Cpp, assembler, linker, library, and startfile spec's. */
-
-/* This defines which switch letters take arguments. On svr4, most of
- the normal cases (defined in gcc.c) apply, and we also have -h* and
- -z* options (for the linker). Note however that there is no such
- thing as a -T option for svr4. */
-
-#define SWITCH_TAKES_ARG(CHAR) \
- ( (CHAR) == 'D' \
- || (CHAR) == 'U' \
- || (CHAR) == 'o' \
- || (CHAR) == 'e' \
- || (CHAR) == 'u' \
- || (CHAR) == 'I' \
- || (CHAR) == 'm' \
- || (CHAR) == 'L' \
- || (CHAR) == 'A' \
- || (CHAR) == 'h' \
- || (CHAR) == 'z')
-
-/* This defines which multi-letter switches take arguments. On svr4,
- there are no such switches except those implemented by GCC itself. */
-
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
- && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
- && strcmp (STR, "Tbss"))
-
-/* You should redefine CPP_PREDEFINES in any file which includes this one.
- The definition should be appropriate for the type of target system
- involved, and it should include any -A (assertion) options which are
- appropriate for the given target system. */
-#undef CPP_PREDEFINES
-
-/* Provide an ASM_SPEC appropriate for svr4. Here we try to support as
- many of the specialized svr4 assembler options as seems reasonable,
- given that there are certain options which we can't (or shouldn't)
- support directly due to the fact that they conflict with other options
- for other svr4 tools (e.g. ld) or with other options for GCC itself.
- For example, we don't support the -o (output file) or -R (remove
- input file) options because GCC already handles these things. We
- also don't support the -m (run m4) option for the assembler because
- that conflicts with the -m (produce load map) option of the svr4
- linker. We do however allow passing arbitrary options to the svr4
- assembler via the -Wa, option.
-
- Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
- option.
-*/
-
-#undef ASM_SPEC
-#define ASM_SPEC \
- "-no_0f_fix %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
-
-/* svr4 assemblers need the `-' (indicating input from stdin) to come after
- the -o option (and its argument) for some reason. If we try to put it
- before the -o option, the assembler will try to read the file named as
- the output file in the -o option as an input file (after it has already
- written some stuff to it) and the binary stuff contained therein will
- cause totally confuse the assembler, resulting in many spurious error
- messages. */
-
-#undef ASM_FINAL_SPEC
-#define ASM_FINAL_SPEC "%{pipe:-}"
-
-/* Provide a LIB_SPEC appropriate for svr4. Here we tack on the default
- standard C library (unless we are building a shared library). */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
-
-/* Provide a LIBGCC_SPEC appropriate for svr4. We also want to exclude
- libgcc when -symbolic. */
-
-#undef LIBGCC_SPEC
-#define LIBGCC_SPEC "%{!shared:%{!symbolic:-lgcc}}"
-
-/* Provide an ENDFILE_SPEC appropriate for svr4. Here we tack on our own
- magical crtend.o file (see crtstuff.c) which provides part of the
- support for getting C++ file-scope static object constructed before
- entering `main', followed by the normal svr3/svr4 "finalizer" file,
- which is either `gcrtn.o' or `crtn.o'. */
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o}%{!pg:crtn.o%s}"
-
-/* Provide a LINK_SPEC appropriate for svr4. Here we provide support
- for the special GCC options -static, -shared, and -symbolic which
- allow us to link things in one of these three modes by applying the
- appropriate combinations of options at link-time. We also provide
- support here for as many of the other svr4 linker options as seems
- reasonable, given that some of them conflict with options for other
- svr4 tools (e.g. the assembler). In particular, we do support the
- -h*, -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*,
- -l*, -o*, -r, -s, -u*, and -L* options are directly supported
- by gcc.c itself. We don't directly support the -m (generate load
- map) option because that conflicts with the -m (run m4) option of
- the svr4 assembler. We also don't directly support the svr4 linker's
- -I* or -M* options because these conflict with existing GCC options.
- We do however allow passing arbitrary options to the svr4 linker
- via the -Wl, option. We don't support the svr4 linker's -a option
- at all because it is totally useless and because it conflicts with
- GCC's own -a option.
-
- Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
-
- When the -G link option is used (-shared and -symbolic) a final link is
- not being done. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{h*} %{v:-V} \
- %{b} %{Wl,*:%*} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy -z text %{!h*:%{o*:-h %*}}} \
- %{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}} \
- %{G:-G} \
- %{YP,*} \
- %{!YP,*:%{p:-Y P,/lib/libp:/usr/lib/libp:/lib:/usr/lib} \
- %{!p:-Y P,/lib:/usr/lib}} \
- %{Qy:} %{!Qn:-Qy}"
-
-/* Gcc automatically adds in one of the files /lib/values-Xc.o,
- /lib/values-Xa.o, or /lib/values-Xt.o for each final link
- step (depending upon the other gcc options selected, such as
- -traditional and -ansi). These files each contain one (initialized)
- copy of a special variable called `_lib_version'. Each one of these
- files has `_lib_version' initialized to a different (enum) value.
- The SVR4 library routines query the value of `_lib_version' at run
- to decide how they should behave. Specifically, they decide (based
- upon the value of `_lib_version') if they will act in a strictly ANSI
- conforming manner or not.
-*/
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared: \
- %{!symbolic: \
- %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
- %{pg:gcrti.o%s}%{!pg:crti.o%s} \
- %{ansi:values-Xc.o%s} \
- %{!ansi: \
- %{traditional:values-Xt.o%s} \
- %{!traditional:values-Xa.o%s}} \
- crtbegin.o%s"
-
-/* Attach a special .ident directive to the end of the file to identify
- the version of GCC which compiled this code. The format of the
- .ident string is patterned after the ones produced by native svr4
- C compilers. */
-
-#define IDENT_ASM_OP ".ident"
-
-#define ASM_FILE_END(FILE) \
-do { \
- fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \
- IDENT_ASM_OP, version_string); \
- } while (0)
-
-/* Allow #sccs in preprocessor. */
-
-#define SCCS_DIRECTIVE
-
-/* Output #ident as a .ident. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
-
-/* Use periods rather than dollar signs in special g++ assembler names. */
-
-#define NO_DOLLAR_IN_LABEL
-
-/* Writing `int' for a bitfield forces int alignment for the structure. */
-
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Handle #pragma weak and #pragma pack. */
-
-#define HANDLE_SYSV_PRAGMA
-
-/* System V Release 4 uses DWARF debugging info. */
-
-#define DWARF_DEBUGGING_INFO
-
-/* The numbers used to denote specific machine registers in the System V
- Release 4 DWARF debugging information are quite likely to be totally
- different from the numbers used in BSD stabs debugging information
- for the same kind of target machine. Thus, we undefine the macro
- DBX_REGISTER_NUMBER here as an extra inducement to get people to
- provide proper machine-specific definitions of DBX_REGISTER_NUMBER
- (which is also used to provide DWARF registers numbers in dwarfout.c)
- in their tm.h files which include this file. */
-
-#undef DBX_REGISTER_NUMBER
-
-/* gas on SVR4 supports the use of .stabs. Permit -gstabs to be used
- in general, although it will only work when using gas. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Use DWARF debugging info by default. */
-
-#ifndef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
-#endif
-
-/* Make LBRAC and RBRAC addresses relative to the start of the
- function. The native Solaris stabs debugging format works this
- way, gdb expects it, and it reduces the number of relocation
- entries. */
-
-#define DBX_BLOCKS_FUNCTION_RELATIVE 1
-
-/* When using stabs, gcc2_compiled must be a stabs entry, not an
- ordinary symbol, or gdb won't see it. The stabs entry must be
- before the N_SO in order for gdb to find it. */
-
-#define ASM_IDENTIFY_GCC(FILE) \
-do \
- { \
- if (write_symbols != DBX_DEBUG) \
- fputs ("gcc2_compiled.:\n", FILE); \
- else \
- fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \
- } \
-while (0)
-
-/* Like block addresses, stabs line numbers are relative to the
- current function. */
-
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
-do \
- { \
- static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,.LM%d-", \
- line, sym_lineno); \
- assemble_name (file, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
- fprintf (file, "\n.LM%d:\n", sym_lineno); \
- sym_lineno += 1; \
- } \
-while (0)
-
-/* In order for relative line numbers to work, we must output the
- stabs entry for the function name first. */
-
-#define DBX_FUNCTION_FIRST
-
-/* Generate a blank trailing N_SO to mark the end of the .o file, since
- we can't depend upon the linker to mark .o file boundaries with
- embedded stabs. */
-
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
- fprintf (FILE, \
- "\t.text\n\t.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO)
-
-/* Define the actual types of some ANSI-mandated types. (These
- definitions should work for most SVR4 systems). */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-/* This causes trouble, because it requires the host machine
- to support ANSI C. */
-/* #define MULTIBYTE_CHARS */
-
-#undef ASM_BYTE_OP
-#define ASM_BYTE_OP ".byte"
-
-#undef SET_ASM_OP
-#define SET_ASM_OP ".set"
-
-/* This is how to begin an assembly language file. Most svr4 assemblers want
- at least a .file directive to come first, and some want to see a .version
- directive come right after that. Here we just establish a default
- which generates only the .file directive. If you need a .version
- directive for any specific target, you should override this definition
- in the target-specific file which includes this one. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- output_file_directive ((FILE), main_input_filename)
-
-/* This is how to allocate empty space in some section. The .zero
- pseudo-op is used for this on most svr4 assemblers. */
-
-#define SKIP_ASM_OP ".zero"
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE))
-
-/* The prefix to add to user-visible assembler symbols. */
-
- For System V Release 4 the convention is *not* to prepend a leading
- underscore onto user-level symbol names. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
-
- For most svr4 systems, the convention is that any symbol which begins
- with a period is not put into the linker symbol table by the assembler. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
-do { \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \
-} while (0)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'.
-
- For most svr4 systems, the convention is that any symbol which begins
- with a period is not put into the linker symbol table by the assembler. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
-do { \
- sprintf (LABEL, "*.%s%d", PREFIX, NUM); \
-} while (0)
-
-/* Output the label which precedes a jumptable. Note that for all svr4
- systems where we actually generate jumptables (which is to say every
- svr4 target except i386, where we use casesi instead) we put the jump-
- tables into the .rodata section and since other stuff could have been
- put into the .rodata section prior to any given jumptable, we have to
- make sure that the location counter for the .rodata section gets pro-
- perly re-aligned prior to the actual beginning of the jump table. */
-
-#define ALIGN_ASM_OP ".align"
-
-#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
-#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- ASM_OUTPUT_ALIGN ((FILE), 2);
-#endif
-
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
- do { \
- ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \
- } while (0)
-
-/* The standard SVR4 assembler seems to require that certain builtin
- library routines (e.g. .udiv) be explicitly declared as .globl
- in each assembly file where they are referenced. */
-
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
- ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
-
-/* This says how to output assembler code to declare an
- uninitialized external linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here. */
-
-#define COMMON_ASM_OP ".comm"
-
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
-} while (0)
-
-/* This says how to output assembler code to declare an
- uninitialized internal linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here. */
-
-#define LOCAL_ASM_OP ".local"
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), "\n"); \
- ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
-} while (0)
-
-/* This is the pseudo-op used to generate a 32-bit word of data with a
- specific value in some section. This is the same for all known svr4
- assemblers. */
-
-#define INT_ASM_OP ".long"
-
-/* This is the pseudo-op used to generate a contiguous sequence of byte
- values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
- AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */
-
-#undef ASCII_DATA_ASM_OP
-#define ASCII_DATA_ASM_OP ".ascii"
-
-/* Support const sections and the ctors and dtors sections for g++.
- Note that there appears to be two different ways to support const
- sections at the moment. You can either #define the symbol
- READONLY_DATA_SECTION (giving it some code which switches to the
- readonly data section) or else you can #define the symbols
- EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
- SELECT_RTX_SECTION. We do both here just to be on the safe side. */
-
-#define USE_CONST_SECTION 1
-
-#define CONST_SECTION_ASM_OP ".section\t.rodata"
-
-/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
-
- Note that we want to give these sections the SHF_WRITE attribute
- because these sections will actually contain data (i.e. tables of
- addresses of functions in the current root executable or shared library
- file) and, in the case of a shared library, the relocatable addresses
- will have to be properly resolved/relocated (and then written into) by
- the dynamic linker when it actually attaches the given shared library
- to the executing process. (Note that on SVR4, you may wish to use the
- `-z text' option to the ELF linker, when building a shared library, as
- an additional check that you are doing everything right. But if you do
- use the `-z text' option when building a shared library, you will get
- errors unless the .ctors and .dtors sections are marked as writable
- via the SHF_WRITE attribute.) */
-
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
-
-/* On svr4, we *do* have support for the .init and .fini sections, and we
- can put stuff in there to be executed before and after `main'. We let
- crtstuff.c and other files know this by defining the following symbols.
- The definitions say how to change sections to the .init and .fini
- sections. This is the same for all known svr4 assemblers. */
-
-#define INIT_SECTION_ASM_OP ".section\t.init"
-#define FINI_SECTION_ASM_OP ".section\t.fini"
-
-/* A default list of other sections which we might be "in" at any given
- time. For targets that use additional sections (e.g. .tdesc) you
- should override this definition in the target-specific file which
- includes this file. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
-
-/* A default list of extra section function definitions. For targets
- that use additional sections (e.g. .tdesc) you should override this
- definition in the target-specific file which includes this file. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define READONLY_DATA_SECTION() const_section ()
-
-extern void text_section ();
-
-#define CONST_SECTION_FUNCTION \
-void \
-const_section () \
-{ \
- if (!USE_CONST_SECTION) \
- text_section(); \
- else if (in_section != in_const) \
- { \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
- in_section = in_const; \
- } \
-}
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-/* Switch into a generic section.
- This is currently only used to support section attributes.
-
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
- (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
- (DECL) && TREE_READONLY (DECL) ? "a" : "aw")
-
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement or statements to switch to the appropriate
- section for output of DECL. DECL is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether forming
- the initial value of DECL requires link-time relocations. */
-
-#define SELECT_SECTION(DECL,RELOC) \
-{ \
- if (TREE_CODE (DECL) == STRING_CST) \
- { \
- if (! flag_writable_strings) \
- const_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
- if ((flag_pic && RELOC) \
- || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
- || !DECL_INITIAL (DECL) \
- || (DECL_INITIAL (DECL) != error_mark_node \
- && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
- data_section (); \
- else \
- const_section (); \
- } \
- else \
- const_section (); \
-}
-
-/* A C statement or statements to switch to the appropriate
- section for output of RTX in mode MODE. RTX is some kind
- of constant in RTL. The argument MODE is redundant except
- in the case of a `const_int' rtx. Currently, these always
- go into the const section. */
-
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE,RTX) const_section()
-
-/* Define the strings used for the special svr4 .type and .size directives.
- These strings generally do not vary from one system running svr4 to
- another, but if a given system (e.g. m88k running svr) needs to use
- different pseudo-op names for these, they may be overridden in the
- file which includes this one. */
-
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#define ASM_WEAKEN_LABEL(FILE,NAME) \
- do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
- fputc ('\n', FILE); } while (0)
-
-/* The following macro defines the format used to output the second
- operand of the .type assembler directive. Different svr4 assemblers
- expect various different forms for this operand. The one given here
- is just a default. You may need to override it in your machine-
- specific tm.h file (depending upon the particulars of your assembler). */
-
-#define TYPE_OPERAND_FMT "@%s"
-
-/* Write the extra assembler code needed to declare a function's result.
- Most svr4 assemblers don't require any special declaration of the
- result value, but there are exceptions. */
-
-#ifndef ASM_DECLARE_RESULT
-#define ASM_DECLARE_RESULT(FILE, RESULT)
-#endif
-
-/* These macros generate the special .type and .size directives which
- are used to set the corresponding fields of the linker symbol table
- entries in an ELF object file under SVR4. These macros also output
- the starting labels for the relevant functions/objects. */
-
-/* Write the extra assembler code needed to declare a function properly.
- Some svr4 assemblers need to also have something extra said about the
- function's return value. We allow for that here. */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Write the extra assembler code needed to declare an object properly. */
-
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', FILE); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } while (0)
-
-/* This is how to declare the size of a function. */
-
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
- do { \
- if (!flag_inhibit_size_directive) \
- { \
- char label[256]; \
- static int labelno; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ","); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } while (0)
-
-/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
- ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
- corresponds to a particular byte value [0..255]. For any
- given byte value, if the value in the corresponding table
- position is zero, the given character can be output directly.
- If the table value is 1, the byte must be output as a \ooo
- octal escape. If the tables value is anything else, then the
- byte value should be output as a \ followed by the value
- in the table. Note that we can use standard UN*X escape
- sequences for many control characters, but we don't use
- \a to represent BEL because some svr4 assemblers (e.g. on
- the i386) don't know about that. Also, we don't use \v
- since some versions of gas, such as 2.2 did not accept it. */
-
-#define ESCAPES \
-"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
-
-/* Some svr4 assemblers have a limit on the number of characters which
- can appear in the operand of a .string directive. If your assembler
- has such a limitation, you should define STRING_LIMIT to reflect that
- limit. Note that at least some svr4 assemblers have a limit on the
- actual number of bytes in the double-quoted string, and that they
- count each character in an escape sequence as one byte. Thus, an
- escape sequence like \377 would count as four bytes.
-
- If your target assembler doesn't support the .string directive, you
- should define this to zero.
-*/
-
-#define STRING_LIMIT ((unsigned) 256)
-
-#define STRING_ASM_OP ".string"
-
-/* The routine used to output NUL terminated strings. We use a special
- version of this for most svr4 targets because doing so makes the
- generated assembly code more compact (and thus faster to assemble)
- as well as more readable, especially for targets like the i386
- (where the only alternative is to output character sequences as
- comma separated lists of numbers). */
-
-#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
- do \
- { \
- register unsigned char *_limited_str = (unsigned char *) (STR); \
- register unsigned ch; \
- fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \
- for (; ch = *_limited_str; _limited_str++) \
- { \
- register int escape; \
- switch (escape = ESCAPES[ch]) \
- { \
- case 0: \
- putc (ch, (FILE)); \
- break; \
- case 1: \
- fprintf ((FILE), "\\%03o", ch); \
- break; \
- default: \
- putc ('\\', (FILE)); \
- putc (escape, (FILE)); \
- break; \
- } \
- } \
- fprintf ((FILE), "\"\n"); \
- } \
- while (0)
-
-/* The routine used to output sequences of byte values. We use a special
- version of this for most svr4 targets because doing so makes the
- generated assembly code more compact (and thus faster to assemble)
- as well as more readable. Note that if we find subparts of the
- character sequence which end with NUL (and which are shorter than
- STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
- do \
- { \
- register unsigned char *_ascii_bytes = (unsigned char *) (STR); \
- register unsigned char *limit = _ascii_bytes + (LENGTH); \
- register unsigned bytes_in_chunk = 0; \
- for (; _ascii_bytes < limit; _ascii_bytes++) \
- { \
- register unsigned char *p; \
- if (bytes_in_chunk >= 60) \
- { \
- fprintf ((FILE), "\"\n"); \
- bytes_in_chunk = 0; \
- } \
- for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
- continue; \
- if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
- { \
- if (bytes_in_chunk > 0) \
- { \
- fprintf ((FILE), "\"\n"); \
- bytes_in_chunk = 0; \
- } \
- ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
- _ascii_bytes = p; \
- } \
- else \
- { \
- register int escape; \
- register unsigned ch; \
- if (bytes_in_chunk == 0) \
- fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP); \
- switch (escape = ESCAPES[ch = *_ascii_bytes]) \
- { \
- case 0: \
- putc (ch, (FILE)); \
- bytes_in_chunk++; \
- break; \
- case 1: \
- fprintf ((FILE), "\\%03o", ch); \
- bytes_in_chunk += 4; \
- break; \
- default: \
- putc ('\\', (FILE)); \
- putc (escape, (FILE)); \
- bytes_in_chunk += 2; \
- break; \
- } \
- } \
- } \
- if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\"\n"); \
- } \
- while (0)
-
-/* All SVR4 targets use the ELF object file format. */
-#define OBJECT_FORMAT_ELF
diff --git a/gcc/config/pyr/pyr.c b/gcc/config/pyr/pyr.c
deleted file mode 100644
index 3203377e2c7..00000000000
--- a/gcc/config/pyr/pyr.c
+++ /dev/null
@@ -1,864 +0,0 @@
-/* Subroutines for insn-output.c for Pyramid 90x, 9000, and MIServer Series.
- Copyright (C) 1989, 1991 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. */
-
-/* Some output-actions in pyr.md need these. */
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "tree.h"
-
-/*
- * Do FUNCTION_ARG.
- * This cannot be defined as a macro on pyramids, because Pyramid Technology's
- * C compiler dies on (several equivalent definitions of) this macro.
- * The only way around this cc bug was to make this a function.
- * While it would be possible to use a macro version for gcc, it seems
- * more reliable to have a single version of the code.
- */
-void *
-pyr_function_arg(cum, mode, type, named)
- CUMULATIVE_ARGS cum;
- enum machine_mode mode;
- tree type;
-{
- return (void *)(FUNCTION_ARG_HELPER (cum, mode,type,named));
-}
-
-/* Do the hard part of PARAM_SAFE_FOR_REG_P.
- * This cannot be defined as a macro on pyramids, because Pyramid Technology's
- * C compiler dies on (several equivalent definitions of) this macro.
- * The only way around this cc bug was to make this a function.
- */
-int
-inner_param_safe_helper (type)
- tree type;
-{
- return (INNER_PARAM_SAFE_HELPER(type));
-}
-
-
-/* Return 1 if OP is a non-indexed operand of mode MODE.
- This is either a register reference, a memory reference,
- or a constant. In the case of a memory reference, the address
- is checked to make sure it isn't indexed.
-
- Register and memory references must have mode MODE in order to be valid,
- but some constants have no machine mode and are valid for any mode.
-
- If MODE is VOIDmode, OP is checked for validity for whatever mode
- it has.
-
- The main use of this function is as a predicate in match_operand
- expressions in the machine description.
-
- It is useful to compare this with general_operand(). They should
- be identical except for one line.
-
- This function seems necessary because of the non-orthogonality of
- Pyramid insns.
- For any 2-operand insn, and any combination of operand modes,
- if indexing is valid for the isn's second operand, it is invalid
- for the first operand to be indexed. */
-
-extern int volatile_ok;
-
-int
-nonindexed_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- register RTX_CODE code = GET_CODE (op);
- int mode_altering_drug = 0;
-
- if (mode == VOIDmode)
- mode = GET_MODE (op);
-
- /* Don't accept CONST_INT or anything similar
- if the caller wants something floating. */
- if (GET_MODE (op) == VOIDmode && mode != VOIDmode
- && GET_MODE_CLASS (mode) != MODE_INT)
- return 0;
-
- if (CONSTANT_P (op))
- return ((GET_MODE (op) == VOIDmode || GET_MODE (op) == mode)
- && LEGITIMATE_CONSTANT_P (op));
-
- /* Except for certain constants with VOIDmode, already checked for,
- OP's mode must match MODE if MODE specifies a mode. */
-
- if (GET_MODE (op) != mode)
- return 0;
-
- while (code == SUBREG)
- {
- op = SUBREG_REG (op);
- code = GET_CODE (op);
-#if 0
- /* No longer needed, since (SUBREG (MEM...))
- will load the MEM into a reload reg in the MEM's own mode. */
- mode_altering_drug = 1;
-#endif
- }
- if (code == REG)
- return 1;
- if (code == CONST_DOUBLE)
- return LEGITIMATE_CONSTANT_P (op);
- if (code == MEM)
- {
- register rtx y = XEXP (op, 0);
- if (! volatile_ok && MEM_VOLATILE_P (op))
- return 0;
- GO_IF_NONINDEXED_ADDRESS (y, win);
- }
- return 0;
-
- win:
- if (mode_altering_drug)
- return ! mode_dependent_address_p (XEXP (op, 0));
- return 1;
-}
-
-/* Return non-zero if the rtx OP has an immediate component. An
- immediate component or additive term equal to zero is rejected
- due to assembler problems. */
-
-int
-has_direct_base (op)
- rtx op;
-{
- if ((CONSTANT_ADDRESS_P (op)
- && op != const0_rtx)
- || (GET_CODE (op) == PLUS
- && ((CONSTANT_ADDRESS_P (XEXP (op, 1))
- && XEXP (op, 1) != const0_rtx)
- || (CONSTANT_ADDRESS_P (XEXP (op, 0))
- && XEXP (op, 0) != const0_rtx))))
- return 1;
-
- return 0;
-}
-
-/* Return zero if the rtx OP has a (scaled) index. */
-
-int
-has_index (op)
- rtx op;
-{
- if (GET_CODE (op) == PLUS
- && (GET_CODE (XEXP (op, 0)) == MULT
- || (GET_CODE (XEXP (op, 1)) == MULT)))
- return 1;
- else
- return 0;
-}
-
-int swap_operands;
-
-/* weird_memory_memory -- return 1 if OP1 and OP2 can be compared (or
- exchanged with xchw) with one instruction. If the operands need to
- be swapped, set the global variable SWAP_OPERANDS. This function
- silently assumes that both OP0 and OP1 are valid memory references.
- */
-
-int
-weird_memory_memory (op0, op1)
- rtx op0, op1;
-{
- RTX_CODE code0, code1;
-
- op0 = XEXP (op0, 0);
- op1 = XEXP (op1, 0);
- code0 = GET_CODE (op0);
- code1 = GET_CODE (op1);
-
- swap_operands = 0;
-
- if (code1 == REG || code1 == SUBREG)
- {
- return 1;
- }
- if (code0 == REG || code0 == SUBREG)
- {
- swap_operands = 1;
- return 1;
- }
- if (has_direct_base (op0) && has_direct_base (op1))
- {
- if (has_index (op1))
- {
- if (has_index (op0))
- return 0;
- swap_operands = 1;
- }
-
- return 1;
- }
- return 0;
-}
-
-int
-signed_comparison (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- return ! TRULY_UNSIGNED_COMPARE_P (GET_CODE (x));
-}
-
-extern rtx force_reg ();
-rtx test_op0, test_op1;
-enum machine_mode test_mode;
-
-/* Sign-extend or zero-extend constant X from FROM_MODE to TO_MODE. */
-
-rtx
-extend_const (x, extop, from_mode, to_mode)
- rtx x;
- RTX_CODE extop;
- enum machine_mode from_mode, to_mode;
-{
- int val;
- int negative;
- if (from_mode == to_mode)
- return x;
- if (GET_CODE (x) != CONST_INT)
- abort ();
- val = INTVAL (x);
- negative = val & (1 << (GET_MODE_BITSIZE (from_mode) - 1));
- if (GET_MODE_BITSIZE (from_mode) == HOST_BITS_PER_INT)
- abort ();
- if (negative && extop == SIGN_EXTEND)
- val = val | ((-1) << (GET_MODE_BITSIZE (from_mode)));
- else
- val = val & ~((-1) << (GET_MODE_BITSIZE (from_mode)));
- if (GET_MODE_BITSIZE (to_mode) == HOST_BITS_PER_INT)
- return gen_rtx (CONST_INT, VOIDmode, val);
- return gen_rtx (CONST_INT, VOIDmode,
- val & ~((-1) << (GET_MODE_BITSIZE (to_mode))));
-}
-
-rtx
-ensure_extended (op, extop, from_mode)
- rtx op;
- RTX_CODE extop;
- enum machine_mode from_mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return extend_const (op, extop, from_mode, SImode);
- else
- return force_reg (SImode, gen_rtx (extop, SImode, op));
-}
-
-/* Emit rtl for a branch, as well as any delayed (integer) compare insns.
- The compare insn to perform is determined by the global variables
- test_op0 and test_op1. */
-
-void
-extend_and_branch (extop)
- RTX_CODE extop;
-{
- rtx op0, op1;
- RTX_CODE code0, code1;
-
- op0 = test_op0, op1 = test_op1;
- if (op0 == 0)
- return;
-
- code0 = GET_CODE (op0);
- if (op1 != 0)
- code1 = GET_CODE (op1);
- test_op0 = test_op1 = 0;
-
- if (op1 == 0)
- {
- op0 = ensure_extended (op0, extop, test_mode);
- emit_insn (gen_rtx (SET, VOIDmode, cc0_rtx, op0));
- }
- else
- {
- if (CONSTANT_P (op0) && CONSTANT_P (op1))
- {
- op0 = ensure_extended (op0, extop, test_mode);
- op1 = ensure_extended (op1, extop, test_mode);
- }
- else if (extop == ZERO_EXTEND && test_mode == HImode)
- {
- /* Pyramids have no unsigned "cmphi" instructions. We need to
- zero extend unsigned halfwords into temporary registers. */
- op0 = ensure_extended (op0, extop, test_mode);
- op1 = ensure_extended (op1, extop, test_mode);
- }
- else if (CONSTANT_P (op0))
- {
- op0 = ensure_extended (op0, extop, test_mode);
- op1 = ensure_extended (op1, extop, test_mode);
- }
- else if (CONSTANT_P (op1))
- {
- op1 = ensure_extended (op1, extop, test_mode);
- op0 = ensure_extended (op0, extop, test_mode);
- }
- else if ((code0 == REG || code0 == SUBREG)
- && (code1 == REG || code1 == SUBREG))
- {
- /* I could do this case without extension, by using the virtual
- register address (but that would lose for global regs). */
- op0 = ensure_extended (op0, extop, test_mode);
- op1 = ensure_extended (op1, extop, test_mode);
- }
- else if (code0 == MEM && code1 == MEM)
- {
- /* Load into a reg if the address combination can't be handled
- directly. */
- if (! weird_memory_memory (op0, op1))
- op0 = force_reg (test_mode, op0);
- }
-
- emit_insn (gen_rtx (SET, VOIDmode, cc0_rtx,
- gen_rtx (COMPARE, VOIDmode, op0, op1)));
- }
-}
-
-/* Return non-zero if the two single-word moves with operands[0]
- and operands[1] for the first single-word move, and operands[2]
- and operands[3] for the second single-word move, is possible to
- combine to a double word move.
-
- The criterion is whether the operands are in consecutive memory cells,
- registers, etc. */
-
-int
-movdi_possible (operands)
- rtx operands[];
-{
- int cnst_diff0, cnst_diff1;
- RTX_CODE code0 = GET_CODE (operands[0]);
- RTX_CODE code1 = GET_CODE (operands[1]);
-
- /* Don't dare to combine (possibly overlapping) memory -> memory moves. */
- /* It would be possible to detect the cases where we dare, by using
- constant_diff (operands[0], operands[1])!!! */
- if (code0 == MEM && code1 == MEM)
- return 0;
-
- cnst_diff0 = consecutive_operands (operands[0], operands[2]);
- if (cnst_diff0 == 0)
- return 0;
-
- cnst_diff1 = consecutive_operands (operands[1], operands[3]);
- if (cnst_diff1 == 0)
- return 0;
-
- if (cnst_diff0 & cnst_diff1)
- {
- /* The source and destination operands are consecutive. */
-
- /* If the first move writes into the source of the second move,
- we cannot combine. */
- if ((code0 == REG
- && reg_overlap_mentioned_p (operands[0], operands[3]))
- || (code0 == SUBREG
- && subreg_overlap_mentioned_p (operands[0], operands[3])))
- return 0;
-
- if (cnst_diff0 & 1)
- /* operands[0],[1] has higher addresses than operands[2],[3]. */
- swap_operands = 0;
- else
- /* operands[0],[1] has lower addresses than operands[2],[3]. */
- swap_operands = 1;
- return 1;
- }
- return 0;
-}
-
-/* Like reg_overlap_mentioned_p, but accepts a subreg rtx instead
- of a reg. */
-
-int
-subreg_overlap_mentioned_p (subreg, x)
- rtx subreg, x;
-{
- rtx reg = SUBREG_REG (subreg);
- int regno = REGNO (reg) + SUBREG_WORD (subreg);
- int endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (subreg));
- return refers_to_regno_p (regno, endregno, x, 0);
-}
-
-/* Return 1 if OP0 is a consecutive operand to OP1, 2 if OP1 is a
- consecutive operand to OP0.
-
- This function is used to determine if addresses are consecutive,
- and therefore possible to combine to fewer instructions. */
-
-int
-consecutive_operands (op0, op1)
- rtx op0, op1;
-{
- RTX_CODE code0, code1;
- int cnst_diff;
- int regno_off0, regno_off1;
-
- code0 = GET_CODE (op0);
- code1 = GET_CODE (op1);
-
- regno_off0 = 0;
- if (code0 == SUBREG)
- {
- if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0))) <= UNITS_PER_WORD)
- return 0;
- regno_off0 = SUBREG_WORD (op0);
- op0 = SUBREG_REG (op0);
- code0 = REG;
- }
-
- regno_off1 = 0;
- if (code1 == SUBREG)
- {
- if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (op1))) <= UNITS_PER_WORD)
- return 0;
- regno_off1 = SUBREG_WORD (op1);
- op1 = SUBREG_REG (op1);
- code1 = REG;
- }
-
- if (code0 != code1)
- return 0;
-
- switch (code0)
- {
- case CONST_INT:
- /* Cannot permit any symbolic constants, even if the consecutive
- operand is 0, since a movl really performs sign extension. */
- if (code1 != CONST_INT)
- return 0;
- if ((INTVAL (op0) == 0 && INTVAL (op1) == 0)
- || (INTVAL (op0) == -1 && INTVAL (op1) == -1))
- return 3;
- if ((INTVAL (op0) == 0 && INTVAL (op1) > 0)
- || (INTVAL (op0) == -1 && INTVAL (op1) < 0))
- return 2;
- if ((INTVAL (op1) == 0 && INTVAL (op0) > 0)
- || (INTVAL (op1) == -1 && INTVAL (op0) < 0))
- return 1;
- break;
-
- case REG:
- regno_off0 = REGNO (op0) + regno_off0;
- regno_off1 = REGNO (op1) + regno_off1;
-
- cnst_diff = regno_off0 - regno_off1;
- if (cnst_diff == 1)
- {
- /* movl with the highest numbered parameter (local) register as
- source or destination, doesn't wrap to the lowest numbered local
- (temporary) register. */
-
- if (regno_off0 % 16 != 0)
- return 1;
- else
- return 0;
- }
- else if (cnst_diff == -1)
- {
- if (regno_off1 % 16 != 0)
- return 2;
- else
- return 0;
- }
- break;
-
- case MEM:
- op0 = XEXP (op0, 0);
- op1 = XEXP (op1, 0);
- if (GET_CODE (op0) == CONST)
- op0 = XEXP (op0, 0);
- if (GET_CODE (op1) == CONST)
- op1 = XEXP (op1, 0);
-
- cnst_diff = constant_diff (op0, op1);
- if (cnst_diff)
- {
- if (cnst_diff == 4)
- return 1;
- else if (cnst_diff == -4)
- return 2;
- }
- break;
- }
- return 0;
-}
-
-/* Return the constant difference of the rtx expressions OP0 and OP1,
- or 0 if they don't have a constant difference.
-
- This function is used to determine if addresses are consecutive,
- and therefore possible to combine to fewer instructions. */
-
-int
-constant_diff (op0, op1)
- rtx op0, op1;
-{
- RTX_CODE code0, code1;
- int cnst_diff;
-
- code0 = GET_CODE (op0);
- code1 = GET_CODE (op1);
-
- if (code0 != code1)
- {
- if (code0 == PLUS)
- {
- if (GET_CODE (XEXP (op0, 1)) == CONST_INT
- && rtx_equal_p (op1, XEXP (op0, 0)))
- return INTVAL (XEXP (op0, 1));
- }
- else if (code1 == PLUS)
- {
- if (GET_CODE (XEXP (op1, 1)) == CONST_INT
- && rtx_equal_p (op0, XEXP (op1, 0)))
- return -INTVAL (XEXP (op1, 1));
- }
- return 0;
- }
-
- if (code0 == CONST_INT)
- return INTVAL (op0) - INTVAL (op1);
-
- if (code0 == PLUS)
- {
- cnst_diff = constant_diff (XEXP (op0, 0), XEXP (op1, 0));
- if (cnst_diff)
- return (rtx_equal_p (XEXP (op0, 1), XEXP (op1, 1)))
- ? cnst_diff : 0;
- cnst_diff = constant_diff (XEXP (op0, 1), XEXP (op1, 1));
- if (cnst_diff)
- return (rtx_equal_p (XEXP (op0, 0), XEXP (op1, 0)))
- ? cnst_diff : 0;
- }
-
- return 0;
-}
-
-int
-already_sign_extended (insn, from_mode, op)
- rtx insn;
- enum machine_mode from_mode;
- rtx op;
-{
- rtx xinsn, xdest, xsrc;
-
- for (;;)
- {
- insn = PREV_INSN (insn);
- if (insn == 0)
- return 0;
- if (GET_CODE (insn) == NOTE || GET_CODE (insn) == JUMP_INSN)
- continue;
- if (GET_CODE (insn) == CALL_INSN && ! call_used_regs[REGNO (op)])
- continue;
- if (GET_CODE (insn) != INSN)
- return 0;
- xinsn = PATTERN (insn);
-
- if (GET_CODE (xinsn) != SET)
- return 0;
-
- xdest = SET_DEST (xinsn);
- xsrc = SET_SRC (xinsn);
-
- if (GET_CODE (xdest) == SUBREG)
- abort ();
-
- if ( ! REG_P (xdest))
- continue;
-
- if (REGNO (op) == REGNO (xdest)
- && ((GET_CODE (xsrc) == SIGN_EXTEND
- && GET_MODE (XEXP (xsrc, 0)) == from_mode)
- || (GET_CODE (xsrc) == MEM
- && GET_MODE (xsrc) == from_mode)))
- return 1;
-
- /* The register is modified by another operation. */
- if (reg_overlap_mentioned_p (xdest, op))
- return 0;
- }
-}
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- if (GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT)
- {
- /* In an integer, the low-order word is in CONST_DOUBLE_LOW. */
- rtx const_op = operands[1];
- if ((CONST_DOUBLE_HIGH (const_op) == 0
- && CONST_DOUBLE_LOW (const_op) >= 0)
- || (CONST_DOUBLE_HIGH (const_op) == -1
- && CONST_DOUBLE_LOW (const_op) < 0))
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (const_op));
- return "movl %1,%0";
- }
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (const_op));
- output_asm_insn ("movw %1,%0", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (const_op));
- return "movw %1,%0";
- }
- else
- {
- /* In a real, the low-address word is in CONST_DOUBLE_LOW. */
- rtx const_op = operands[1];
- if ((CONST_DOUBLE_LOW (const_op) == 0
- && CONST_DOUBLE_HIGH (const_op) >= 0)
- || (CONST_DOUBLE_LOW (const_op) == -1
- && CONST_DOUBLE_HIGH (const_op) < 0))
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (const_op));
- return "movl %1,%0";
- }
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (const_op));
- output_asm_insn ("movw %1,%0", operands);
- operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (const_op));
- return "movw %1,%0";
- }
- }
-
- return "movl %1,%0";
-}
-
-/* Output a shift insns, after having reduced integer arguments to
- avoid as warnings. */
-
-char *
-output_shift (pattern, op2, mod)
- char *pattern;
- rtx op2;
- int mod;
-{
- if (GET_CODE (op2) == CONST_INT)
- {
- int cnt = INTVAL (op2) % mod;
- if (cnt == 0)
- {
- cc_status = cc_prev_status;
- return "";
- }
- op2 = gen_rtx (CONST_INT, VOIDmode, cnt);
- }
- return pattern;
-}
-
-/* Return non-zero if the code of this rtx pattern is a relop. */
-
-int
-relop (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case EQ:
- case NE:
- case LT:
- case LE:
- case GE:
- case GT:
- case LTU:
- case LEU:
- case GEU:
- case GTU:
- return 1;
- }
- return 0;
-}
-
-void
-notice_update_cc (EXP, INSN)
- rtx EXP, INSN;
-{
- switch (GET_CODE (EXP))
- {
- case SET:
- switch (GET_CODE (SET_DEST (EXP)))
- {
- case CC0:
- cc_status.mdep = 0;
- cc_status.flags = 0;
- cc_status.value1 = 0;
- cc_status.value2 = SET_SRC (EXP);
- break;
-
- case PC:
- break;
-
- case REG:
- switch (GET_CODE (SET_SRC (EXP)))
- {
- case CALL:
- goto call;
- case MEM:
- if (GET_MODE (SET_SRC (EXP)) == QImode
- || GET_MODE (SET_SRC (EXP)) == HImode)
- {
- cc_status.mdep = 0;
- cc_status.flags = CC_NO_OVERFLOW;
- cc_status.value1 = SET_DEST (EXP);
- cc_status.value2 = SET_SRC (EXP);
- break;
- }
- /* else: Fall through. */
- case CONST_INT:
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST:
- case CONST_DOUBLE:
- case REG:
- if (cc_status.value1
- && reg_overlap_mentioned_p (SET_DEST (EXP),
- cc_status.value1))
- cc_status.value1 = 0;
- if (cc_status.value2
- && reg_overlap_mentioned_p (SET_DEST (EXP),
- cc_status.value2))
- cc_status.value2 = 0;
- break;
-
- case UDIV:
- case UMOD:
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- cc_status.flags = CC_NO_OVERFLOW;
- cc_status.value1 = SET_DEST (EXP);
- cc_status.value2 = SET_SRC (EXP);
- break;
- default:
- cc_status.mdep = 0;
- cc_status.flags = CC_NO_OVERFLOW;
- cc_status.value1 = SET_DEST (EXP);
- cc_status.value2 = SET_SRC (EXP);
- break;
- }
- break;
-
- case MEM:
- switch (GET_CODE (SET_SRC (EXP)))
- {
- case REG:
- if (GET_MODE (SET_SRC (EXP)) == QImode
- || GET_MODE (SET_SRC (EXP)) == HImode)
- {
- cc_status.flags = CC_NO_OVERFLOW;
- cc_status.value1 = SET_DEST (EXP);
- cc_status.value2 = SET_SRC (EXP);
- cc_status.mdep = 0;
- break;
- }
- /* else: Fall through. */
- case CONST_INT:
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST:
- case CONST_DOUBLE:
- case MEM:
- /* Need to forget cc_status about memory positions each
- time a memory store is made, even if the memory store
- insns in question doesn't modify the condition codes. */
- if (cc_status.value1 &&
- GET_CODE (cc_status.value1) == MEM)
- cc_status.value1 = 0;
- if (cc_status.value2 &&
- GET_CODE (cc_status.value2) == MEM)
- cc_status.value2 = 0;
- break;
- case SIGN_EXTEND:
- case FLOAT_EXTEND:
- case FLOAT_TRUNCATE:
- case FLOAT:
- case FIX:
- cc_status.flags = CC_NO_OVERFLOW;
- cc_status.value1 = SET_DEST (EXP);
- cc_status.value2 = SET_SRC (EXP);
- cc_status.mdep = 0;
- break;
-
- default:
- abort ();
- }
- break;
-
- default:
- abort ();
- }
- break;
-
- case CALL:
- call:
- CC_STATUS_INIT;
- break;
- /* Do calls preserve the condition codes? (At least forget
- cc_status expressions if they refer to registers
- not preserved across calls. Also forget expressions
- about memory contents.) */
- if (cc_status.value1
- && (refers_to_regno_p (PYR_TREG (0), PYR_TREG (15),
- cc_status.value1, 0)
- || GET_CODE (cc_status.value1) == MEM))
- cc_status.value1 = 0;
- if (cc_status.value2
- && (refers_to_regno_p (PYR_TREG (0), PYR_TREG (15),
- cc_status.value2, 0)
- || GET_CODE (cc_status.value2) == MEM))
- cc_status.value2 = 0;
- break;
-
- default:
- CC_STATUS_INIT;
- }
-}
-
-void
-forget_cc_if_dependent (op)
- rtx op;
-{
- cc_status = cc_prev_status;
- if (cc_status.value1 && reg_overlap_mentioned_p (op, cc_status.value1))
- cc_status.value1 = 0;
- if (cc_status.value2 && reg_overlap_mentioned_p (op, cc_status.value2))
- cc_status.value2 = 0;
-}
diff --git a/gcc/config/pyr/pyr.h b/gcc/config/pyr/pyr.h
deleted file mode 100644
index ea88ee4ba10..00000000000
--- a/gcc/config/pyr/pyr.h
+++ /dev/null
@@ -1,1505 +0,0 @@
-/* Definitions of target machine parameters for GNU compiler,
- for Pyramid 90x, 9000, and MIServer Series.
- Copyright (C) 1989, 1995, 1996, 1997 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. */
-
-/*
- * If you're going to change this, and you haven't already,
- * you should get and read
- * ``OSx Operating System Porting Guide'',
- * publication number 4100-0066-A
- * Revision A
- * Pyramid Technology Corporation.
- *
- * or whatever the most recent version is. In any case, page and
- * section number references given herein refer to this document.
- *
- * The instruction table for gdb lists the available insns and
- * the valid addressing modes.
- *
- * Any other information on the Pyramid architecture is proprietary
- * and hard to get. (Pyramid cc -S and adb are also useful.)
- *
- */
-
-/*** Run-time compilation parameters selecting different hardware subsets. ***/
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dpyr -Dunix -Asystem(unix) -Acpu(pyr) -Amachine(pyr)"
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fprintf (stderr, " (pyr)");
-
-extern int target_flags;
-
-/* Nonzero if compiling code that Unix assembler can assemble. */
-#define TARGET_UNIX_ASM (target_flags & 1)
-
-/* Implement stdarg in the same fashion used on all other machines. */
-#define TARGET_GNU_STDARG (target_flags & 2)
-
-/* Compile using RETD to pop off the args.
- This will not work unless you use prototypes at least
- for all functions that can take varying numbers of args.
- This contravenes the Pyramid calling convention, so we don't
- do it yet. */
-
-#define TARGET_RETD (target_flags & 4)
-
-/* Macros used in the machine description to test the flags. */
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE.
-
- -mgnu will be useful if we ever have GAS on a pyramid. */
-
-#define TARGET_SWITCHES \
- { {"unix", 1}, \
- {"gnu", -1}, \
- {"gnu-stdarg", 2}, \
- {"nognu-stdarg", -2}, \
- {"retd", 4}, \
- {"no-retd", -4}, \
- { "", TARGET_DEFAULT}}
-
-/* Default target_flags if no switches specified.
-
- (equivalent to "-munix -mindex -mgnu-stdarg") */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (1 + 2)
-#endif
-
-/* Make GCC agree with types.h. */
-#ifdef SIZE_TYPE
-#undef SIZE_TYPE
-#endif
-#define SIZE_TYPE "unsigned int"
-
-/* Assembler does not permit $ in labels */
-
-#define NO_DOLLAR_IN_LABEL
-
-/* Maybe it doesn't permit dot either. */
-#define NO_DOT_IN_LABEL
-
-/* Never allow $ in identifiers */
-
-#define DOLLARS_IN_IDENTIFIERS 0
-
-/*** Target machine storage layout ***/
-
-/* Define this to non-zero if most significant bit is lowest
- numbered in instructions that operate on numbered bit-fields.
- This is not true on the pyramid. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this to non-zero if most significant byte of a word is
- the lowest numbered. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this to non-zero if most significant word of a multiword
- number is the lowest numbered. */
-#define WORDS_BIG_ENDIAN 1
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 32
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* Specified types of bitfields affect alignment of those fields
- and of the structure as a whole. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Make strings word-aligned so strcpy from constants will be faster.
- Pyramid documentation says the best alignment is to align
- on the size of a cache line, which is 32 bytes.
- Newer pyrs have single insns that do strcmp() and strcpy(), so this
- may not actually win anything. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- (TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/*** Standard register usage. ***/
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-
-/* Nota Bene:
- Pyramids have 64 addressable 32-bit registers, arranged as four
- groups of sixteen registers each. Pyramid names the groups
- global, parameter, local, and temporary.
-
- The sixteen global registers are fairly conventional; the last
- four are overloaded with a PSW, frame pointer, stack pointer, and pc.
- The non-dedicated global registers used to be reserved for Pyramid
- operating systems, and still have cryptic and undocumented uses for
- certain library calls. We do not use global registers gr0 through
- gr11.
-
- The parameter, local, and temporary registers provide register
- windowing. Each procedure call has its own set of these 48
- registers, which constitute its call frame. (These frames are
- not allocated on the conventional stack, but contiguously
- on a separate stack called the control stack.)
- Register windowing is a facility whereby the temporary registers
- of frame n become the parameter registers of frame n+1, viz.:
-
- 0 15 0 15 0 15
- +------------+------------+------------+
-frame n+1 | | | |
- +------------+------------+------------+
- Parameter Local Temporary
-
- ^
- | These 16 regs are the same.
- v
-
- 0 15 0 15 0 15
- +------------+------------+------------+
-frame n | | | |
- +------------+------------+------------+
- Parameter Local Temporary
-
- New frames are automatically allocated on the control stack by the
- call instruction and de-allocated by the return insns "ret" and
- "retd". The control-stack grows contiguously upward from a
- well-known address in memory; programs are free to allocate
- a variable sized, conventional frame on the data stack, which
- grows downwards in memory from just below the control stack.
-
- Temporary registers are used for parameter passing, and are not
- preserved across calls. TR0 through TR11 correspond to
- gcc's ``input'' registers; PR0 through TR11 the ``output''
- registers. The call insn stores the PC and PSW in PR14 and PR15 of
- the frame it creates; the return insns restore these into the PC
- and PSW. The same is true for interrupts; TR14 and TR15 of the
- current frame are reserved and should never be used, since an
- interrupt may occur at any time and clobber them.
-
- An interesting quirk is the ability to take the address of a
- variable in a windowed register. This done by adding the memory
- address of the base of the current window frame, to the offset
- within the frame of the desired register. The resulting address
- can be treated just like any other pointer; if a quantity is stored
- into that address, the appropriate register also changes.
- GCC does not, and according to RMS will not, support this feature,
- even though some programs rely on this (mis)feature.
- */
-
-#define PYR_GREG(n) (n)
-#define PYR_PREG(n) (16+(n))
-#define PYR_LREG(n) (32+(n))
-#define PYR_TREG(n) (48+(n))
-
-/* Define this macro if the target machine has "register windows". This
- C expression returns the register number as seen by the called function
- corresponding to register number OUT as seen by the calling function.
- Return OUT if register number OUT is not an outbound register. */
-
-#define INCOMING_REGNO(OUT) \
- (((OUT) < 48 || (OUT) > 63) ? (OUT) : (OUT) - 32)
-
-/* Define this macro if the target machine has "register windows". This
- C expression returns the register number as seen by the calling function
- corresponding to register number IN as seen by the called function.
- Return IN if register number IN is not an inbound register. */
-
-#define OUTGOING_REGNO(IN) \
- (((IN) < 15 || (IN) > 31) ? (IN) : (IN) + 32)
-
-#define FIRST_PSEUDO_REGISTER 64
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
-
- On the pyramid, these are LOGPSW, SP, and PC. */
-
-#define FIXED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
-
-/* #define DEFAULT_CALLER_SAVES */
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
- On the pyramid, all registers are one word long. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the pyramid, all registers can hold all modes. */
-
-/* -->FIXME: this is not the case for 64-bit quantities in tr11/12 through
- --> TR14/15. This should be fixed, but to do it correctly, we also
- --> need to fix MODES_TIEABLE_P. Yuk. We ignore this, since GCC should
- --> do the "right" thing due to FIXED_REGISTERS. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) 1
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* Pyramid pc is overloaded on global register 15. */
-#define PC_REGNUM PYR_GREG(15)
-
-/* Register to use for pushing function arguments.
- --> on Pyramids, the data stack pointer. */
-#define STACK_POINTER_REGNUM PYR_GREG(14)
-
-/* Base register for access to local variables of the function.
- Pyramid uses CFP (GR13) as both frame pointer and argument pointer. */
-#define FRAME_POINTER_REGNUM 13 /* pyr cpp fails on PYR_GREG(13) */
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c.
-
- Setting this to 1 can't break anything. Since the Pyramid has
- register windows, I don't know if defining this to be zero can
- win anything. It could changed later, if it wins. */
-#define FRAME_POINTER_REQUIRED 1
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 13 /* PYR_GREG(13) */
-
-/* Register in which static-chain is passed to a function. */
-/* If needed, Pyramid says to use temporary register 12. */
-#define STATIC_CHAIN_REGNUM PYR_TREG(12)
-
-/* If register windows are used, STATIC_CHAIN_INCOMING_REGNUM
- is the register number as seen by the called function, while
- STATIC_CHAIN_REGNUM is the register number as seen by the calling
- function. */
-#define STATIC_CHAIN_INCOMING_REGNUM PYR_PREG(12)
-
-/* Register in which address to store a structure value
- is passed to a function.
- On a Pyramid, this is temporary register 0 (TR0). */
-
-#define STRUCT_VALUE_REGNUM PYR_TREG(0)
-#define STRUCT_VALUE_INCOMING_REGNUM PYR_PREG(0)
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The pyramid has only one kind of registers, so NO_REGS and ALL_REGS
- are the only classes. */
-
-enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Since GENERAL_REGS is the same class as ALL_REGS,
- don't give it a different class number; just make it an alias. */
-
-#define GENERAL_REGS ALL_REGS
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS {{0,0}, {0xffffffff,0xffffffff}}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) ALL_REGS
-
-/* The class value for index registers, and the one for base regs. */
-
-#define BASE_REG_CLASS ALL_REGS
-#define INDEX_REG_CLASS ALL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) NO_REGS
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On the pyramid, this is always the size of MODE in words,
- since all registers are the same size. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- --> For the Pyramid, 'I' can be used for the 6-bit signed integers
- --> (-32 to 31) allowed as immediate short operands in many
- --> instructions. 'J' cane be used for any value that doesn't fit
- --> in 6 bits. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (VALUE) >= -32 && (VALUE) < 32 : \
- (C) == 'J' ? (VALUE) < -32 || (VALUE) >= 32 : \
- (C) == 'K' ? (VALUE) == 0xff || (VALUE) == 0xffff : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
-
-
-/*** Stack layout; function entry, exit and calling. ***/
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-/* FIXME: this used to work when defined as 0. But that makes gnu
- stdargs clobber the first arg. What gives?? */
-#define STARTING_FRAME_OFFSET 0
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- The Pyramid OSx Porting Guide says we are never to do this;
- using RETD in this way violates the Pyramid calling convention.
- We may nevertheless provide this as an option. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((TARGET_RETD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE) \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) \
- ? (SIZE) : 0)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* --> Pyramid has register windows.
- --> The caller sees the return value is in TR0(/TR1) regardless of
- --> its type. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_TREG(0))
-
-/* --> but the callee has to leave it in PR0(/PR1) */
-
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), PYR_PREG(0))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-/* --> On Pyramid the return value is in TR0/TR1 regardless. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, PYR_TREG(0))
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-#define PCC_STATIC_STRUCT_RETURN
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller.
-
- On the Pyramid, TR0 is the only register thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == PYR_TREG(0))
-
-/* 1 if N is a possible register number for function argument passing.
- On the Pyramid, the first twelve temporary registers are available. */
-
-/* FIXME FIXME FIXME
- it's not clear whether this macro should be defined from the point
- of view of the caller or the callee. Since it's never actually used
- in GNU CC, the point is somewhat moot :-).
-
- This definition is consistent with register usage in the md's for
- other register-window architectures (sparc and spur).
- */
-#define FUNCTION_ARG_REGNO_P(N) ((PYR_TREG(0) <= (N)) && ((N) <= PYR_TREG(11)))
-
-/*** Parameter passing: FUNCTION_ARG and FUNCTION_INCOMING_ARG ***/
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On Pyramids, each parameter is passed either completely on the stack
- or completely in registers. No parameter larger than a double may
- be passed in a register. Also, no struct or union may be passed in
- a register, even if it would fit.
-
- So parameters are not necessarily passed "consecutively".
- Thus we need a vector data type: one element to record how many
- parameters have been passed in registers and on the stack,
- respectively.
-
- ((These constraints seem like a gross waste of registers. But if we
- ignore the constraint about structs & unions, we won`t be able to
- freely mix gcc-compiled code and pyr cc-compiled code. It looks
- like better argument passing conventions, and a machine-dependent
- flag to enable them, might be a win.)) */
-
-
-#define CUMULATIVE_ARGS int
-
-/* Define the number of registers that can hold parameters.
- This macro is used only in other macro definitions below. */
-#define NPARM_REGS 12
-
-/* Decide whether or not a parameter can be put in a register.
- (We may still have problems with libcalls. GCC doesn't seem
- to know about anything more than the machine mode. I trust
- structures are never passed to a libcall...
-
- If compiling with -mgnu-stdarg, this definition should make
- functions using the gcc-supplied stdarg, and calls to such
- functions (declared with an arglist ending in"..."), work.
- But such fns won't be able to call pyr cc-compiled
- varargs fns (eg, printf(), _doprnt.)
-
- If compiling with -mnognu-stdarg, this definition should make
- calls to pyr cc-compiled functions work. Functions using
- the gcc-supplied stdarg will be utterly broken.
- There will be no better solution until RMS can be persuaded that
- one is needed.
-
- This macro is used only in other macro definitions below.
- (well, it may be used in pyr.c, because the damn pyramid cc
- can't handle the macro definition of PARAM_SAFE_FOR_REG_P ! */
-
-
-#define INNER_PARAM_SAFE_HELPER(TYPE) \
- ((TARGET_GNU_STDARG ? (! TREE_ADDRESSABLE ((tree)TYPE)): 1) \
- && (TREE_CODE ((tree)TYPE) != RECORD_TYPE) \
- && (TREE_CODE ((tree)TYPE) != UNION_TYPE))
-
-#ifdef __GNUC__
-#define PARAM_SAFE_HELPER(TYPE) \
- INNER_PARAM_SAFE_HELPER((TYPE))
-#else
-extern int inner_param_safe_helper();
-#define PARAM_SAFE_HELPER(TYPE) \
- inner_param_safe_helper((tree)(TYPE))
-#endif
-
-/* Be careful with the expression (long) (TYPE) == 0.
- Writing it in more obvious/correct forms makes the Pyr cc
- dump core! */
-#define PARAM_SAFE_FOR_REG_P(MODE, TYPE, NAMED) \
- (((MODE) != BLKmode) \
- && ((TARGET_GNU_STDARG) ? (NAMED) : 1) \
- && ((((long)(TYPE))==0) || PARAM_SAFE_HELPER((TYPE))))
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = (FNTYPE && !flag_pcc_struct_return \
- && aggregate_value_p (TREE_TYPE (FNTYPE))))
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-#define FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED) \
-(PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \
- ? (NPARM_REGS >= ((CUM) \
- + ((MODE) == BLKmode \
- ? (int_size_in_bytes (TYPE) + 3) / 4 \
- : (GET_MODE_SIZE (MODE) + 3) / 4)) \
- ? gen_rtx (REG, (MODE), PYR_TREG(CUM)) \
- : 0) \
- : 0)
-#ifdef __GNUC__
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- FUNCTION_ARG_HELPER(CUM, MODE, TYPE, NAMED)
-#else
-/***************** Avoid bug in Pyramid OSx compiler... ******************/
-#define FUNCTION_ARG (rtx) pyr_function_arg
-extern void* pyr_function_arg ();
-#endif
-
-/* Define where a function finds its arguments.
- This is different from FUNCTION_ARG because of register windows. */
-
-#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
-(PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \
- ? (NPARM_REGS >= ((CUM) \
- + ((MODE) == BLKmode \
- ? (int_size_in_bytes (TYPE) + 3) / 4 \
- : (GET_MODE_SIZE (MODE) + 3) / 4)) \
- ? gen_rtx (REG, (MODE), PYR_PREG(CUM)) \
- : 0) \
- : 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM,MODE,TYPE,NAMED) \
-((CUM) += (PARAM_SAFE_FOR_REG_P(MODE,TYPE,NAMED) \
- ? ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) / 4 \
- : (int_size_in_bytes (TYPE) + 3) / 4) \
- : 0))
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#if FRAME_POINTER_REQUIRED
-
-/* We always have frame pointers */
-
-/* Don't set up a frame pointer if it's not referenced. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ \
- int _size = (SIZE) + current_function_pretend_args_size; \
- if (_size + current_function_args_size != 0 \
- || current_function_calls_alloca) \
- { \
- fprintf (FILE, "\tadsf $%d\n", _size); \
- if (current_function_pretend_args_size > 0) \
- fprintf (FILE, "\tsubw $%d,cfp\n", \
- current_function_pretend_args_size); \
- } \
-}
-
-#else /* !FRAME_POINTER_REQUIRED */
-
-/* Don't set up a frame pointer if `frame_pointer_needed' tells us
- there is no need. Also, don't set up a frame pointer if it's not
- referenced. */
-
-/* The definition used to be broken. Write a new one. */
-
-#endif /* !FRAME_POINTER_REQUIRED */
-
-/* the trampoline stuff was taken from convex.h - S.P. */
-
-/* A C statement to output, on the stream FILE, assembler code for a
- block of data that contains the constant parts of a trampoline. This
- code should not include a label - the label is taken care of
- automatically.
- We use TR12/PR12 for the static chain.
- movew $<STATIC>,pr12 # I2R
- jump $<func> # S2R
- */
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x2100001C)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x40000000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); }
-
-#define TRAMPOLINE_SIZE 16
-#define TRAMPOLINE_ALIGNMENT 32
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 4)), CXT); \
- emit_move_insn (gen_rtx (MEM, Pmode, plus_constant (TRAMP, 12)), FNADDR); \
- emit_call_insn (gen_call (gen_rtx (MEM, QImode, \
- gen_rtx (SYMBOL_REF, Pmode, \
- "__enable_execute_stack")), \
- const0_rtx)); \
-}
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tmova LP%d,tr0\n\tcall mcount\n", (LABELNO));
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done.
- Don't know if this works on Pyrs. */
-
-#if 0 /* don't do basic_block profiling yet */
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- fprintf (FILE, \
- "\tmtstw LPBX0,tr0\n\tbne LPI%d\n\tmova LP%d,TR0\n\tcall __bb_init_func\nLPI%d:\n", \
- LABELNO, LABELNO);
-
-/* Output assembler code to increment the count associated with
- the basic block number BLOCKNO. Not sure how to do this on pyrs. */
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
- fprintf (FILE, "\taddw", 4 * BLOCKNO)
-#endif /* don't do basic_block profiling yet */
-
-/* When returning from a function, the stack pointer does not matter
- (as long as there is a frame pointer). */
-
-/* This should return non-zero when we really set up a frame pointer.
- Otherwise, GCC is directed to preserve sp by returning zero. */
-extern int current_function_pretend_args_size;
-extern int current_function_args_size;
-extern int current_function_calls_alloca;
-#define EXIT_IGNORE_STACK \
- (get_frame_size () + current_function_pretend_args_size \
- + current_function_args_size != 0 \
- || current_function_calls_alloca) \
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved.
-
- On the Pyramid, FRAME_POINTER_REQUIRED is always 1, so the definition
- of this macro doesn't matter. But it must be defined. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0;
-
-/*** Addressing modes, and classification of registers for them. ***/
-
-/* #define HAVE_POST_INCREMENT */ /* pyramid has none of these */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-/* All registers except gr0 OK as index or base registers. */
-
-#define REGNO_OK_FOR_BASE_P(regno) \
-((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
-
-#define REGNO_OK_FOR_INDEX_P(regno) \
-((unsigned) (regno) - 1 < FIRST_PSEUDO_REGISTER - 1 \
- || reg_renumber[regno] > 0)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2 /* check MAX_REGS_PER_ADDRESS */
-
-/* 1 if X is an rtx for a constant that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) (REGNO (X) > 0)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) 1
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
- except for CONSTANT_ADDRESS_P which is actually machine-independent. */
-
-
-/* Go to ADDR if X is indexable -- i.e., neither indexed nor offset. */
-#define GO_IF_INDEXABLE_ADDRESS(X, ADDR) \
-{ register rtx xfoob = (X); \
- if ((CONSTANT_ADDRESS_P (xfoob)) \
- || (GET_CODE (xfoob) == REG && (REG_OK_FOR_BASE_P (xfoob)))) \
- goto ADDR; \
- }
-
-
-/* Go to label ADDR if X is a valid address that doesn't use indexing.
- This is so if X is either a simple address, or the contents of a register
- plus an offset.
- This macro also gets used in output-pyramid.h in the function that
- recognizes non-indexed operands. */
-
-#define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
-{ \
- if (GET_CODE (X) == REG) \
- goto ADDR; \
- GO_IF_INDEXABLE_ADDRESS (X, ADDR); \
- if (GET_CODE (X) == PLUS) \
- { /* Handle offset(reg) represented with offset on left */ \
- if (CONSTANT_ADDRESS_P (XEXP (X, 0))) \
- { if (GET_CODE (XEXP (X, 1)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
- goto ADDR; \
- } \
- /* Handle offset(reg) represented with offset on right */ \
- if (CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- { if (GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
- goto ADDR; \
- } \
- } \
-}
-
-/* 1 if PROD is either a reg or a reg times a valid offset multiplier
- (ie, 2, 4, or 8).
- This macro's expansion uses the temporary variables xfoo0 and xfoo1
- that must be declared in the surrounding context. */
-#define INDEX_TERM_P(PROD, MODE) \
-((GET_CODE (PROD) == REG && REG_OK_FOR_BASE_P (PROD)) \
- || (GET_CODE (PROD) == MULT \
- && \
- (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
- ((GET_CODE (xfoo0) == CONST_INT \
- && (INTVAL (xfoo0) == 1 \
- || INTVAL (xfoo0) == 2 \
- || INTVAL (xfoo0) == 4 \
- || INTVAL (xfoo0) == 8) \
- && GET_CODE (xfoo1) == REG \
- && REG_OK_FOR_INDEX_P (xfoo1)) \
- || \
- (GET_CODE (xfoo1) == CONST_INT \
- && (INTVAL (xfoo1) == 1 \
- || INTVAL (xfoo1) == 2 \
- || INTVAL (xfoo1) == 4 \
- || INTVAL (xfoo1) == 8) \
- && GET_CODE (xfoo0) == REG \
- && REG_OK_FOR_INDEX_P (xfoo0))))))
-
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ register rtx xone, xtwo, xfoo0, xfoo1; \
- GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
- if (GET_CODE (X) == PLUS) \
- { \
- /* Handle <address>[index] represented with index-sum outermost */\
- xone = XEXP (X, 0); \
- xtwo = XEXP (X, 1); \
- if (INDEX_TERM_P (xone, MODE)) \
- { GO_IF_INDEXABLE_ADDRESS (xtwo, ADDR); } \
- /* Handle <address>[index] represented with index-sum innermost */\
- if (INDEX_TERM_P (xtwo, MODE)) \
- { GO_IF_INDEXABLE_ADDRESS (xone, ADDR); } \
- } \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- --> FIXME: We haven't yet figured out what optimizations are useful
- --> on Pyramids. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- There don't seem to be any such modes on pyramids. */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
-/*** Miscellaneous Parameters ***/
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/*#define CASE_VECTOR_PC_RELATIVE*/
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case.
- It's just a guess. I have no idea of insn cost on pyrs. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
-/* This is untrue for pyramid. The cvtdw instruction generates a trap
- for input operands that are out-of-range for a signed int. */
-/* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */
-
-/* Define this macro if the preprocessor should silently ignore
- '#sccs' directives. */
-/* #define SCCS_DIRECTIVE */
-
-/* Define this macro if the preprocessor should silently ignore
- '#ident' directives. */
-/* #define IDENT_DIRECTIVE */
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 8
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* number of bits in an 'int' on target machine */
-#define INT_TYPE_SIZE 32
-
-/* 1 if byte access requires more than one instruction */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Define this macro if it is as good or better to call a constant
- function address than to call an address kept in a register. */
-/* #define NO_FUNCTION_CSE */
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
-
-/* There are no flag store insns on a pyr. */
-/* #define STORE_FLAG_VALUE */
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (CONST_OK_FOR_LETTER_P (INTVAL (RTX),'I')) return 0; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 4; \
- case CONST_DOUBLE: \
- return 6;
-
-/* A flag which says to swap the operands of certain insns
- when they are output. */
-extern int swap_operands;
-
-/*** Condition Code Information ***/
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). No extra ones are needed for the pyr. */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-/* This is a very simple definition of NOTICE_UPDATE_CC.
- Many cases can be optimized, to improve condition code usage.
- Maybe we should handle this entirely in the md, since it complicated
- to describe the way pyr sets cc. */
-
-#define TRULY_UNSIGNED_COMPARE_P(X) \
- (X == GEU || X == GTU || X == LEU || X == LTU)
-#define CC_VALID_FOR_UNSIGNED 2
-
-#define CC_STATUS_MDEP_INIT cc_status.mdep = 0
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
- notice_update_cc(EXP, INSN)
-
-/*** Output of Assembler Code ***/
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) \
- fprintf (FILE, ((TARGET_UNIX_ASM)? "" : "#NO_APP\n"));
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ((TARGET_UNIX_ASM) ? "" : "#APP\n")
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ((TARGET_UNIX_ASM) ? "" : "#NO_APP\n")
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"gr0", "gr1", "gr2", "gr3", "gr4", "gr5", "gr6", "gr7", "gr8", \
- "gr9", "gr10", "gr11", "logpsw", "cfp", "sp", "pc", \
- "pr0", "pr1", "pr2", "pr3", "pr4", "pr5", "pr6", "pr7", \
- "pr8", "pr9", "pr10", "pr11", "pr12", "pr13", "pr14", "pr15", \
- "lr0", "lr1", "lr2", "lr3", "lr4", "lr5", "lr6", "lr7", \
- "lr8", "lr9", "lr10", "lr11", "lr12", "lr13", "lr14", "lr15", \
- "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7", \
- "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"}
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Our preference is for dbx rather than sdb.
- Yours may be different. */
-#define DBX_DEBUGGING_INFO
-/* #define SDB_DEBUGGING_INFO */
-
-/* Don't use the `xsfoo;' construct in DBX output; this system
- doesn't support it. */
-
-#define DBX_NO_XREFS 1
-
-/* Do not break .stabs pseudos into continuations. */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* This is the char to use for continuation (in case we need to turn
- continuation back on). */
-
-#define DBX_CONTIN_CHAR '?'
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- fprintf (FILE, "\t.float 0f%.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.half "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tsubw $4,sp\n\tmovw %s,(sp)\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmovw (sp),%s\n\taddw $4,sp\n", reg_names[REGNO])
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.word L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes.
-
- On Pyramids, the text segment must always be word aligned.
- On Pyramids, .align takes only args between 2 and 5.
- */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf (FILE, "\t.align %d\n", (LOG) < 2 ? 2 : (LOG))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
- On the Pyr, we support the conventional CODE characters:
-
- 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
- which are never used. */
-
-/* FIXME : should be more robust with CONST_DOUBLE. */
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names [REGNO (X) + ((CODE) == 'R')]); \
- \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
- { union { double d; int i[2]; } u; \
- union { float f; int i; } u1; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- u1.f = u.d; \
- if (CODE == 'f') \
- fprintf (FILE, "$0f%.0e", u1.f); \
- else \
- fprintf (FILE, "$0x%x", u1.i); } \
- \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode) \
- { union { double d; int i[2]; } u; \
- u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
- fprintf (FILE, "$0d%.20e", u.d); } \
- \
- else if (CODE == 'N') \
- switch (GET_CODE (X)) \
- { \
- case EQ: fputs ("eq", FILE); break; \
- case NE: fputs ("ne", FILE); break; \
- case GT: \
- case GTU: fputs ("gt", FILE); break; \
- case LT: \
- case LTU: fputs ("lt", FILE); break; \
- case GE: \
- case GEU: fputs ("ge", FILE); break; \
- case LE: \
- case LEU: fputs ("le", FILE); break; \
- } \
- \
- else if (CODE == 'C') \
- switch (GET_CODE (X)) \
- { \
- case EQ: fputs ("ne", FILE); break; \
- case NE: fputs ("eq", FILE); break; \
- case GT: \
- case GTU: fputs ("le", FILE); break; \
- case LT: \
- case LTU: fputs ("ge", FILE); break; \
- case GE: \
- case GEU: fputs ("lt", FILE); break; \
- case LE: \
- case LEU: fputs ("gt", FILE); break; \
- } \
- \
- else if (CODE == 'R') \
- switch (GET_CODE (X)) \
- { \
- case EQ: fputs ("eq", FILE); break; \
- case NE: fputs ("ne", FILE); break; \
- case GT: \
- case GTU: fputs ("lt", FILE); break; \
- case LT: \
- case LTU: fputs ("gt", FILE); break; \
- case GE: \
- case GEU: fputs ("le", FILE); break; \
- case LE: \
- case LEU: fputs ("ge", FILE); break; \
- } \
- \
- else { putc ('$', FILE); output_addr_const (FILE, X); } \
-}
-
-/* Print a memory operand whose address is ADDR, on file FILE. */
-/* This is horrendously complicated. */
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ \
- register rtx reg1, reg2, breg, ireg; \
- register rtx addr = ADDR; \
- rtx offset, scale; \
- retry: \
- switch (GET_CODE (addr)) \
- { \
- case MEM: \
- fprintf (stderr, "bad Mem "); debug_rtx (addr); \
- addr = XEXP (addr, 0); \
- abort (); \
- case REG: \
- fprintf (FILE, "(%s)", reg_names [REGNO (addr)]); \
- break; \
- case PLUS: \
- reg1 = 0; reg2 = 0; \
- ireg = 0; breg = 0; \
- offset = 0; \
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0)) \
- || GET_CODE (XEXP (addr, 0)) == MEM) \
- { \
- offset = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)) \
- || GET_CODE (XEXP (addr, 1)) == MEM) \
- { \
- offset = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) != PLUS) ; \
- else if (GET_CODE (XEXP (addr, 0)) == MULT) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == MULT) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- else if (GET_CODE (XEXP (addr, 0)) == REG) \
- { \
- reg1 = XEXP (addr, 0); \
- addr = XEXP (addr, 1); \
- } \
- else if (GET_CODE (XEXP (addr, 1)) == REG) \
- { \
- reg1 = XEXP (addr, 1); \
- addr = XEXP (addr, 0); \
- } \
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT) \
- { \
- if (reg1 == 0) \
- reg1 = addr; \
- else \
- reg2 = addr; \
- addr = 0; \
- } \
- if (offset != 0) \
- { \
- if (addr != 0) { \
- fprintf (stderr, "\nBad addr "); debug_rtx (addr); \
- abort ();} \
- addr = offset; \
- } \
- if (reg1 != 0 && GET_CODE (reg1) == MULT) \
- { breg = reg2; ireg = reg1; } \
- else if (reg2 != 0 && GET_CODE (reg2) == MULT) \
- { breg = reg1; ireg = reg2; } \
- else if (reg2 != 0 || GET_CODE (addr) == MEM) \
- { breg = reg2; ireg = reg1; } \
- else \
- { breg = reg1; ireg = reg2; } \
- if (addr != 0) \
- output_address (offset); \
- if (breg != 0) \
- { if (GET_CODE (breg) != REG) \
- { \
- fprintf (stderr, "bad Breg"); debug_rtx (addr); \
- abort (); \
- } \
- fprintf (FILE, "(%s)", reg_names[REGNO (breg)]); } \
- if (ireg != 0) \
- { \
- if (GET_CODE (ireg) == MULT) \
- { \
- scale = XEXP (ireg, 1); \
- ireg = XEXP (ireg, 0); \
- if (GET_CODE (ireg) != REG) \
- { register rtx tem; \
- tem = ireg; ireg = scale; scale = tem; \
- } \
- if (GET_CODE (ireg) != REG) { \
- fprintf (stderr, "bad idx "); debug_rtx (addr); \
- abort (); } \
- if ((GET_CODE (scale) == CONST_INT) && (INTVAL(scale) >= 1))\
- fprintf (FILE, "[%s*0x%x]", reg_names[REGNO (ireg)], \
- INTVAL(scale)); \
- else \
- fprintf (FILE, "[%s*1]", reg_names[REGNO (ireg)]); \
- } \
- else if (GET_CODE (ireg) == REG) \
- fprintf (FILE, "[%s*1]", reg_names[REGNO (ireg)]); \
- else \
- { \
- fprintf (stderr, "Not indexed at all!"); debug_rtx (addr);\
- abort (); \
- } \
- } \
- break; \
- default: \
- output_addr_const (FILE, addr); \
- } \
-}
diff --git a/gcc/config/pyr/pyr.md b/gcc/config/pyr/pyr.md
deleted file mode 100644
index 3c03beaec6f..00000000000
--- a/gcc/config/pyr/pyr.md
+++ /dev/null
@@ -1,1375 +0,0 @@
-;; GNU C machine description for Pyramid 90x, 9000, MIServer Series
-;; Copyright (C) 1989, 1990, 1995 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.
-
-;; Instruction patterns. When multiple patterns apply,
-;; the first one in the file is chosen.
-;;
-;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
-;;
-;; cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;; updates for most instructions.
-
-;; These comments are mostly obsolete. Written for gcc version 1.XX.
-;; * Try using define_insn instead of some peepholes in more places.
-;; * Set REG_NOTES:REG_EQUIV for cvt[bh]w loads. This would make the
-;; backward scan in sign_extend needless.
-;; * Match (pc) (label_ref) case in peephole patterns.
-;; * Should optimize
-;; "cmpX op1,op2; b{eq,ne} LY; ucmpX op1.op2; b{lt,le,gt,ge} LZ"
-;; to
-;; "ucmpX op1,op2; b{eq,ne} LY; b{lt,le,gt,ge} LZ"
-;; by pre-scanning insn and running notice_update_cc for them.
-;; * Is it necessary to do copy_rtx in the test and compare patterns?
-;; * Fix true frame pointer omission.
-;; * Make the jump tables contain branches, not addresses! This would
-;; save us one instruction.
-;; * Could the complicated scheme for compares be simplified, if we had
-;; no named cmpqi or cmphi patterns, and instead anonymous patterns for
-;; the less-than-word compare cases pyr can handle???
-;; * The jump insn seems to accept more than just IR addressing. Would
-;; we win by telling GCC? Or can we use movw into the global reg which
-;; is a synonym for pc?
-;; * More DImode patterns.
-;; * Scan backwards in "zero_extendhisi2", "zero_extendqisi2" to find out
-;; if the extension can be omitted.
-;; * "divmodsi" with Pyramid "ediv" insn. Is it possible in rtl??
-;; * Would "rcsp tmpreg; u?cmp[bh] op1_regdispl(tmpreg),op2" win in
-;; comparison with the two extensions and single test generated now?
-;; The rcsp insn could be expanded, and moved out of loops by the
-;; optimizer, making 1 (64 bit) insn of 3 (32 bit) insns in loops.
-;; The rcsp insn could be followed by an add insn, making non-displacement
-;; IR addressing sufficient.
-
-;______________________________________________________________________
-;
-; Test and Compare Patterns.
-;______________________________________________________________________
-
-; The argument for the rather complicated test and compare expansion
-; scheme, is the irregular pyramid instructions for these operations.
-; 1) Pyramid has different signed and unsigned compares. 2) HImode
-; and QImode integers are memory-memory and immediate-memory only. 3)
-; Unsigned HImode compares doesn't exist. 4) Only certain
-; combinations of addresses are allowed for memory-memory compares.
-; Whenever necessary, in order to fulfill these addressing
-; constraints, the compare operands are swapped.
-
-(define_expand "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "general_operand" ""))]
- "" "operands[0] = force_reg (SImode, operands[0]);")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:SI 0 "memory_operand" "m")
- (match_operand:SI 1 "memory_operand" "m")))]
- "weird_memory_memory (operands[0], operands[1])"
- "*
-{
- rtx br_insn = NEXT_INSN (insn);
- RTX_CODE br_code;
-
- if (GET_CODE (br_insn) != JUMP_INSN)
- abort();
- br_code = GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
-
- weird_memory_memory (operands[0], operands[1]);
-
- if (swap_operands)
- {
- cc_status.flags = CC_REVERSED;
- if (TRULY_UNSIGNED_COMPARE_P (br_code))
- {
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- return \"ucmpw %0,%1\";
- }
- return \"cmpw %0,%1\";
- }
-
- if (TRULY_UNSIGNED_COMPARE_P (br_code))
- {
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- return \"ucmpw %1,%0\";
- }
- return \"cmpw %1,%0\";
-}")
-
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "r,g")
- (match_operand:SI 1 "general_operand" "g,r")))]
- ""
- "*
-{
- rtx br_insn = NEXT_INSN (insn);
- RTX_CODE br_code;
-
- if (GET_CODE (br_insn) != JUMP_INSN)
- abort();
- br_code = GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
-
- if (which_alternative != 0)
- {
- cc_status.flags = CC_REVERSED;
- if (TRULY_UNSIGNED_COMPARE_P (br_code))
- {
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- return \"ucmpw %0,%1\";
- }
- return \"cmpw %0,%1\";
- }
-
- if (TRULY_UNSIGNED_COMPARE_P (br_code))
- {
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- return \"ucmpw %1,%0\";
- }
- return \"cmpw %1,%0\";
-}")
-
-(define_insn ""
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" "r"))]
- ""
- "*
-{
-#if 0
- cc_status.flags |= CC_NO_OVERFLOW;
- return \"cmpw $0,%0\";
-#endif
- rtx br_insn = NEXT_INSN (insn);
- RTX_CODE br_code;
-
- if (GET_CODE (br_insn) != JUMP_INSN)
- abort();
- br_code = GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
-
- if (TRULY_UNSIGNED_COMPARE_P (br_code))
- {
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- return \"ucmpw $0,%0\";
- }
- return \"mtstw %0,%0\";
-}")
-
-(define_expand "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "")
- (match_operand:HI 1 "general_operand" "")))]
- ""
- "
-{
- extern rtx test_op0, test_op1; extern enum machine_mode test_mode;
- test_op0 = copy_rtx (operands[0]);
- test_op1 = copy_rtx (operands[1]);
- test_mode = HImode;
- DONE;
-}")
-
-(define_expand "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "nonimmediate_operand" ""))]
- ""
- "
-{
- extern rtx test_op0; extern enum machine_mode test_mode;
- test_op0 = copy_rtx (operands[0]);
- test_mode = HImode;
- DONE;
-}")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:HI 0 "memory_operand" "m")
- (match_operand:HI 1 "memory_operand" "m")))]
- "(!TRULY_UNSIGNED_COMPARE_P (GET_CODE (XEXP (SET_SRC (PATTERN (NEXT_INSN (insn))), 0))))
- && weird_memory_memory (operands[0], operands[1])"
- "*
-{
- rtx br_insn = NEXT_INSN (insn);
-
- if (GET_CODE (br_insn) != JUMP_INSN)
- abort();
-
- weird_memory_memory (operands[0], operands[1]);
-
- if (swap_operands)
- {
- cc_status.flags = CC_REVERSED;
- return \"cmph %0,%1\";
- }
-
- return \"cmph %1,%0\";
-}")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "r,m")
- (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
- "(!TRULY_UNSIGNED_COMPARE_P (GET_CODE (XEXP (SET_SRC (PATTERN (NEXT_INSN (insn))), 0))))
- && ((GET_CODE (operands[0]) == MEM) != (GET_CODE (operands[1]) == MEM))"
- "*
-{
- rtx br_insn = NEXT_INSN (insn);
-
- if (GET_CODE (br_insn) != JUMP_INSN)
- abort();
-
- if (which_alternative != 0)
- {
- cc_status.flags = CC_REVERSED;
- return \"cmph %0,%1\";
- }
-
- return \"cmph %1,%0\";
-}")
-
-(define_expand "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "")
- (match_operand:QI 1 "general_operand" "")))]
- ""
- "
-{
- extern rtx test_op0, test_op1; extern enum machine_mode test_mode;
- test_op0 = copy_rtx (operands[0]);
- test_op1 = copy_rtx (operands[1]);
- test_mode = QImode;
- DONE;
-}")
-
-(define_expand "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "nonimmediate_operand" ""))]
- ""
- "
-{
- extern rtx test_op0; extern enum machine_mode test_mode;
- test_op0 = copy_rtx (operands[0]);
- test_mode = QImode;
- DONE;
-}")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:QI 0 "memory_operand" "m")
- (match_operand:QI 1 "memory_operand" "m")))]
- "weird_memory_memory (operands[0], operands[1])"
- "*
-{
- rtx br_insn = NEXT_INSN (insn);
- RTX_CODE br_code;
-
- if (GET_CODE (br_insn) != JUMP_INSN)
- abort();
- br_code = GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
-
- weird_memory_memory (operands[0], operands[1]);
-
- if (swap_operands)
- {
- cc_status.flags = CC_REVERSED;
- if (TRULY_UNSIGNED_COMPARE_P (br_code))
- {
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- return \"ucmpb %0,%1\";
- }
- return \"cmpb %0,%1\";
- }
-
- if (TRULY_UNSIGNED_COMPARE_P (br_code))
- {
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- return \"ucmpb %1,%0\";
- }
- return \"cmpb %1,%0\";
-}")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "r,m")
- (match_operand:QI 1 "nonimmediate_operand" "m,r")))]
- "((GET_CODE (operands[0]) == MEM) != (GET_CODE (operands[1]) == MEM))"
- "*
-{
- rtx br_insn = NEXT_INSN (insn);
- RTX_CODE br_code;
-
- if (GET_CODE (br_insn) != JUMP_INSN)
- abort();
- br_code = GET_CODE (XEXP (XEXP (PATTERN (br_insn), 1), 0));
-
- if (which_alternative != 0)
- {
- cc_status.flags = CC_REVERSED;
- if (TRULY_UNSIGNED_COMPARE_P (br_code))
- {
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- return \"ucmpb %0,%1\";
- }
- return \"cmpb %0,%1\";
- }
-
- if (TRULY_UNSIGNED_COMPARE_P (br_code))
- {
- cc_status.mdep = CC_VALID_FOR_UNSIGNED;
- return \"ucmpb %1,%0\";
- }
- return \"cmpb %1,%0\";
-}")
-
-(define_expand "bgt"
- [(set (pc) (if_then_else (gt (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (SIGN_EXTEND);")
-
-(define_expand "blt"
- [(set (pc) (if_then_else (lt (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (SIGN_EXTEND);")
-
-(define_expand "bge"
- [(set (pc) (if_then_else (ge (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (SIGN_EXTEND);")
-
-(define_expand "ble"
- [(set (pc) (if_then_else (le (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (SIGN_EXTEND);")
-
-(define_expand "beq"
- [(set (pc) (if_then_else (eq (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (SIGN_EXTEND);")
-
-(define_expand "bne"
- [(set (pc) (if_then_else (ne (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (SIGN_EXTEND);")
-
-(define_expand "bgtu"
- [(set (pc) (if_then_else (gtu (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (ZERO_EXTEND);")
-
-(define_expand "bltu"
- [(set (pc) (if_then_else (ltu (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (ZERO_EXTEND);")
-
-(define_expand "bgeu"
- [(set (pc) (if_then_else (geu (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (ZERO_EXTEND);")
-
-(define_expand "bleu"
- [(set (pc) (if_then_else (leu (cc0) (const_int 0))
- (label_ref (match_operand 0 "" "")) (pc)))]
- "" "extend_and_branch (ZERO_EXTEND);")
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "register_operand" "r")
- (match_operand:DF 1 "register_operand" "r")))]
- ""
- "cmpd %1,%0")
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "register_operand" "r")
- (match_operand:SF 1 "register_operand" "r")))]
- ""
- "cmpf %1,%0")
-
-(define_insn "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "register_operand" "r"))]
- ""
- "mtstd %0,%0")
-
-(define_insn "tstsf"
- [(set (cc0)
- (match_operand:SF 0 "register_operand" "r"))]
- ""
- "mtstf %0,%0")
-
-;______________________________________________________________________
-;
-; Fixed-point Arithmetic.
-;______________________________________________________________________
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,!r")
- (plus:SI (match_operand:SI 1 "general_operand" "%0,r")
- (match_operand:SI 2 "general_operand" "g,rJ")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 32
- ? \"subw %n2,%0\" : \"addw %2,%0\");
- else
- {
- forget_cc_if_dependent (operands[0]);
- return \"mova %a2[%1*1],%0\";
- }
-}")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (minus:SI (match_operand:SI 1 "general_operand" "0,g")
- (match_operand:SI 2 "general_operand" "g,0")))]
- ""
- "* return (which_alternative == 0) ? \"subw %2,%0\" : \"rsubw %1,%0\";")
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mult:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "mulw %2,%0")
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (div:SI (match_operand:SI 1 "general_operand" "0,g")
- (match_operand:SI 2 "general_operand" "g,0")))]
- ""
- "* return (which_alternative == 0) ? \"divw %2,%0\" : \"rdivw %1,%0\";")
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (udiv:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "udivw %2,%0")
-
-(define_insn "modsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mod:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "modw %2,%0")
-
-(define_insn "umodsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (umod:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "umodw %2,%0")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))]
- ""
- "mnegw %1,%0")
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))]
- ""
- "mcomw %1,%0")
-
-(define_insn "abssi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (abs:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))]
- ""
- "mabsw %1,%0")
-
-;______________________________________________________________________
-;
-; Floating-point Arithmetic.
-;______________________________________________________________________
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (plus:DF (match_operand:DF 1 "register_operand" "%0")
- (match_operand:DF 2 "register_operand" "r")))]
- ""
- "addd %2,%0")
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (plus:SF (match_operand:SF 1 "register_operand" "%0")
- (match_operand:SF 2 "register_operand" "r")))]
- ""
- "addf %2,%0")
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (minus:DF (match_operand:DF 1 "register_operand" "0")
- (match_operand:DF 2 "register_operand" "r")))]
- ""
- "subd %2,%0")
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (minus:SF (match_operand:SF 1 "register_operand" "0")
- (match_operand:SF 2 "register_operand" "r")))]
- ""
- "subf %2,%0")
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (mult:DF (match_operand:DF 1 "register_operand" "%0")
- (match_operand:DF 2 "register_operand" "r")))]
- ""
- "muld %2,%0")
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (mult:SF (match_operand:SF 1 "register_operand" "%0")
- (match_operand:SF 2 "register_operand" "r")))]
- ""
- "mulf %2,%0")
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (div:DF (match_operand:DF 1 "register_operand" "0")
- (match_operand:DF 2 "register_operand" "r")))]
- ""
- "divd %2,%0")
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (div:SF (match_operand:SF 1 "register_operand" "0")
- (match_operand:SF 2 "register_operand" "r")))]
- ""
- "divf %2,%0")
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (neg:DF (match_operand:DF 1 "register_operand" "r")))]
- ""
- "mnegd %1,%0")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (neg:SF (match_operand:SF 1 "register_operand" "r")))]
- ""
- "mnegf %1,%0")
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=r")
- (abs:DF (match_operand:DF 1 "register_operand" "r")))]
- ""
- "mabsd %1,%0")
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=r")
- (abs:SF (match_operand:SF 1 "register_operand" "r")))]
- ""
- "mabsf %1,%0")
-
-;______________________________________________________________________
-;
-; Logical and Shift Instructions.
-;______________________________________________________________________
-
-(define_insn ""
- [(set (cc0)
- (and:SI (match_operand:SI 0 "general_operand" "%r")
- (match_operand:SI 1 "general_operand" "g")))]
- ""
- "*
-{
- cc_status.flags |= CC_NO_OVERFLOW;
- return \"bitw %1,%0\";
-}")
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (and:SI (match_operand:SI 1 "general_operand" "%0,r")
- (match_operand:SI 2 "general_operand" "g,K")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"andw %2,%0\";
-
- cc_status.flags = CC_NOT_NEGATIVE;
- return (INTVAL (operands[2]) == 255
- ? \"movzbw %1,%0\" : \"movzhw %1,%0\");
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (not:SI (match_operand:SI 1 "general_operand" "g"))
- (match_operand:SI 2 "register_operand" "0")))]
- ""
- "bicw %1,%0")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "orw %2,%0")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (xor:SI (match_operand:SI 1 "general_operand" "%0")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "xorw %2,%0")
-
-; The arithmetic left shift instructions work strangely on pyramids.
-; They fail to modify the sign bit. Therefore, use logic shifts.
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "rnm")))]
- ""
- "*
-{
- extern char *output_shift ();
- return output_shift (\"lshlw %2,%0\", operands[2], 32);
-}")
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "rnm")))]
- ""
- "*
-{
- extern char *output_shift ();
- return output_shift (\"ashrw %2,%0\", operands[2], 32);
-}")
-
-(define_insn "ashrdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "rnm")))]
- ""
- "*
-{
- extern char *output_shift ();
- return output_shift (\"ashrl %2,%0\", operands[2], 64);
-}")
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "rnm")))]
- ""
- "*
-{
- extern char *output_shift ();
- return output_shift (\"lshrw %2,%0\", operands[2], 32);
-}")
-
-(define_insn "rotlsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (rotate:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "rnm")))]
- ""
- "*
-{
- extern char *output_shift ();
- return output_shift (\"rotlw %2,%0\", operands[2], 32);
-}")
-
-(define_insn "rotrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (rotatert:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "general_operand" "rnm")))]
- ""
- "*
-{
- extern char *output_shift ();
- return output_shift (\"rotrw %2,%0\", operands[2], 32);
-}")
-
-;______________________________________________________________________
-;
-; Fixed and Floating Moves.
-;______________________________________________________________________
-
-;; If the destination is a memory operand, indexed source operands are
-;; disallowed. Big DImode constants are always loaded into a reg pair,
-;; although offsettable memory addresses really could be dealt with.
-
-(define_insn ""
- [(set (match_operand:DI 0 "memory_operand" "=m")
- (match_operand:DI 1 "nonindexed_operand" "gF"))]
- "(GET_CODE (operands[1]) == CONST_DOUBLE
- ? ((CONST_DOUBLE_HIGH (operands[1]) == 0
- && CONST_DOUBLE_LOW (operands[1]) >= 0)
- || (CONST_DOUBLE_HIGH (operands[1]) == -1
- && CONST_DOUBLE_LOW (operands[1]) < 0))
- : 1)"
- "*
-{
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[1]));
- return \"movl %1,%0\";
-}")
-
-;; Force the destination to a register, so all source operands are allowed.
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=r")
- (match_operand:DI 1 "general_operand" "gF"))]
- ""
- "*
-{
- extern char *output_move_double ();
- return output_move_double (operands);
-}")
-
-;; If the destination is a memory address, indexed source operands are
-;; disallowed.
-
-(define_insn ""
- [(set (match_operand:SI 0 "memory_operand" "=m")
- (match_operand:SI 1 "nonindexed_operand" "g"))]
- ""
- "movw %1,%0")
-
-;; Force the destination to a register, so all source operands are allowed.
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=r")
- (match_operand:SI 1 "general_operand" "g"))]
- ""
- "movw %1,%0")
-
-;; If the destination is a memory address, indexed source operands are
-;; disallowed.
-
-(define_insn ""
- [(set (match_operand:HI 0 "memory_operand" "=m")
- (match_operand:HI 1 "nonindexed_operand" "g"))]
- ""
- "*
-{
- if (REG_P (operands[1]))
- return \"cvtwh %1,%0\"; /* reg -> mem */
- else
- return \"movh %1,%0\"; /* mem imm -> mem */
-}")
-
-;; Force the destination to a register, so all source operands are allowed.
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=r")
- (match_operand:HI 1 "general_operand" "g"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) != MEM)
- return \"movw %1,%0\"; /* reg imm -> reg */
- return \"cvthw %1,%0\"; /* mem -> reg */
-}")
-
-;; If the destination is a memory address, indexed source operands are
-;; disallowed.
-
-(define_insn ""
- [(set (match_operand:QI 0 "memory_operand" "=m")
- (match_operand:QI 1 "nonindexed_operand" "g"))]
- ""
- "*
-{
- if (REG_P (operands[1]))
- return \"cvtwb %1,%0\"; /* reg -> mem */
- else
- return \"movb %1,%0\"; /* mem imm -> mem */
-}")
-
-;; Force the destination to a register, so all source operands are allowed.
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=r")
- (match_operand:QI 1 "general_operand" "g"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) != MEM)
- return \"movw %1,%0\"; /* reg imm -> reg */
- return \"cvtbw %1,%0\"; /* mem -> reg */
-}")
-
-;; If the destination is a memory address, indexed source operands are
-;; disallowed.
-
-(define_insn ""
- [(set (match_operand:DF 0 "memory_operand" "=m")
- (match_operand:DF 1 "nonindexed_operand" "g"))]
- "GET_CODE (operands[1]) != CONST_DOUBLE"
- "movl %1,%0")
-
-;; Force the destination to a register, so all source operands are allowed.
-
-(define_insn "movdf"
- [(set (match_operand:DF 0 "general_operand" "=r")
- (match_operand:DF 1 "general_operand" "gF"))]
- ""
- "*
-{
- extern char *output_move_double ();
- return output_move_double (operands);
-}")
-
-;; If the destination is a memory address, indexed source operands are
-;; disallowed.
-
-(define_insn ""
- [(set (match_operand:SF 0 "memory_operand" "=m")
- (match_operand:SF 1 "nonindexed_operand" "g"))]
- ""
- "movw %1,%0")
-
-;; Force the destination to a register, so all source operands are allowed.
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=r")
- (match_operand:SF 1 "general_operand" "g"))]
- ""
- "movw %1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:QI 1 "address_operand" "p"))]
- ""
- "*
-{
- forget_cc_if_dependent (operands[0]);
- return \"mova %a1,%0\";
-}")
-
-;______________________________________________________________________
-;
-; Conversion patterns.
-;______________________________________________________________________
-
-;; The trunc patterns are used only when non compile-time constants are used.
-
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (truncate:QI (match_operand:SI 1 "nonimmediate_operand" "rm")))]
- ""
- "*
-{
- if (REG_P (operands[0]) && REG_P (operands[1])
- && REGNO (operands[0]) == REGNO (operands[1]))
- {
- cc_status = cc_prev_status;
- return \"\";
- }
- forget_cc_if_dependent (operands[0]);
- return \"movw %1,%0\";
-}")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (truncate:HI (match_operand:SI 1 "nonimmediate_operand" "rm")))]
- ""
- "*
-{
- if (REG_P (operands[0]) && REG_P (operands[1])
- && REGNO (operands[0]) == REGNO (operands[1]))
- {
- cc_status = cc_prev_status;
- return \"\";
- }
- forget_cc_if_dependent (operands[0]);
- return \"movw %1,%0\";
-}")
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=r,m")
- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm,r")))]
- ""
- "*
-{
- extern int optimize;
- if (optimize && REG_P (operands[0]) && REG_P (operands[1])
- && REGNO (operands[0]) == REGNO (operands[1])
- && already_sign_extended (insn, HImode, operands[0]))
- {
- cc_status = cc_prev_status;
- return \"\";
- }
- return \"cvthw %1,%0\";
-}")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=r,m")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rm,r")))]
- ""
- "*
-{
- extern int optimize;
- if (optimize && REG_P (operands[0]) && REG_P (operands[1])
- && REGNO (operands[0]) == REGNO (operands[1])
- && already_sign_extended (insn, QImode, operands[0]))
- {
- cc_status = cc_prev_status;
- return \"\";
- }
- return \"cvtbw %1,%0\";
-}")
-
-; Pyramid doesn't have insns *called* "cvtbh" or "movzbh".
-; But we can cvtbw/movzbw into a register, where there is no distinction
-; between words and halfwords.
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "rm")))]
- ""
- "cvtbw %1,%0")
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))]
- ""
- "*
-{
- cc_status.flags = CC_NOT_NEGATIVE;
- return \"movzhw %1,%0\";
-}")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rm")))]
- ""
- "*
-{
- cc_status.flags = CC_NOT_NEGATIVE;
- return \"movzbw %1,%0\";
-}")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "rm")))]
- ""
- "*
-{
- cc_status.flags = CC_NOT_NEGATIVE;
- return \"movzbw %1,%0\";
-}")
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "general_operand" "=&r,m")
- (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "rm,r")))]
- ""
- "cvtfd %1,%0")
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "general_operand" "=&r,m")
- (float_truncate:SF (match_operand:DF 1 "nonimmediate_operand" "rm,r")))]
- ""
- "cvtdf %1,%0")
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "general_operand" "=&r,m")
- (float:SF (match_operand:SI 1 "nonimmediate_operand" "rm,r")))]
- ""
- "cvtwf %1,%0")
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "general_operand" "=&r,m")
- (float:DF (match_operand:SI 1 "nonimmediate_operand" "rm,r")))]
- ""
- "cvtwd %1,%0")
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "general_operand" "=&r,m")
- (fix:SI (fix:SF (match_operand:SF 1 "nonimmediate_operand" "rm,r"))))]
- ""
- "cvtfw %1,%0")
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=&r,m")
- (fix:SI (fix:DF (match_operand:DF 1 "nonimmediate_operand" "rm,r"))))]
- ""
- "cvtdw %1,%0")
-
-;______________________________________________________________________
-;
-; Flow Control Patterns.
-;______________________________________________________________________
-
-;; Prefer "br" to "jump" for unconditional jumps, since it's faster.
-;; (The assembler can manage with out-of-range branches.)
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "br %l0")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "relop" [(cc0) (const_int 0)])
- (label_ref (match_operand 1 "" ""))
- (pc)))]
- ""
- "*
-{
- extern int optimize;
- if (optimize)
- switch (GET_CODE (operands[0]))
- {
- case EQ: case NE:
- break;
- case LT: case LE: case GE: case GT:
- if (cc_prev_status.mdep == CC_VALID_FOR_UNSIGNED)
- return 0;
- break;
- case LTU: case LEU: case GEU: case GTU:
- if (cc_prev_status.mdep != CC_VALID_FOR_UNSIGNED)
- return 0;
- break;
- }
-
- return \"b%N0 %l1\";
-}")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "relop" [(cc0) (const_int 0)])
- (pc)
- (label_ref (match_operand 1 "" ""))))]
- ""
- "*
-{
- extern int optimize;
- if (optimize)
- switch (GET_CODE (operands[0]))
- {
- case EQ: case NE:
- break;
- case LT: case LE: case GE: case GT:
- if (cc_prev_status.mdep == CC_VALID_FOR_UNSIGNED)
- return 0;
- break;
- case LTU: case LEU: case GEU: case GTU:
- if (cc_prev_status.mdep != CC_VALID_FOR_UNSIGNED)
- return 0;
- break;
- }
-
- return \"b%C0 %l1\";
-}")
-
-(define_insn "call"
- [(call (match_operand:QI 0 "memory_operand" "m")
- (match_operand:SI 1 "immediate_operand" "n"))]
- ""
- "call %0")
-
-(define_insn "call_value"
- [(set (match_operand 0 "" "=r")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:SI 2 "immediate_operand" "n")))]
- ;; Operand 2 not really used on Pyramid architecture.
- ""
- "call %1")
-
-(define_insn "return"
- [(return)]
- ""
- "*
-{
- if (get_frame_size () + current_function_pretend_args_size
- + current_function_args_size != 0
- || current_function_calls_alloca)
- {
- int dealloc_size = current_function_pretend_args_size;
- if (current_function_pops_args)
- dealloc_size += current_function_args_size;
- operands[0] = gen_rtx (CONST_INT, VOIDmode, dealloc_size);
- return \"retd %0\";
- }
- else
- return \"ret\";
-}")
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jump (%0)")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "movw gr0,gr0 # nop")
-
-;______________________________________________________________________
-;
-; Peep-hole Optimization Patterns.
-;______________________________________________________________________
-
-;; Optimize fullword move followed by a test of the moved value.
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "nonimmediate_operand" "rm"))
- (set (cc0) (match_operand:SI 2 "nonimmediate_operand" "rm"))]
- "rtx_equal_p (operands[2], operands[0])
- || rtx_equal_p (operands[2], operands[1])"
- "*
- cc_status.flags |= CC_NO_OVERFLOW;
- return \"mtstw %1,%0\";
-")
-
-;; Optimize loops with an incremented/decremented variable.
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0)
- (const_int -1)))
- (set (cc0)
- (compare (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "nonmemory_operand" "ri")))
- (set (pc)
- (if_then_else (match_operator:SI 3 "signed_comparison"
- [(cc0) (const_int 0)])
- (label_ref (match_operand 4 "" ""))
- (pc)))]
- "(GET_CODE (operands[2]) == CONST_INT
- ? (unsigned)INTVAL (operands[2]) + 32 >= 64
- : 1) && (rtx_equal_p (operands[0], operands[1])
- || rtx_equal_p (operands[0], operands[2]))"
- "*
- if (rtx_equal_p (operands[0], operands[1]))
- {
- output_asm_insn (\"dcmpw %2,%0\", operands);
- return \"b%N3 %l4\";
- }
- else
- {
- output_asm_insn (\"dcmpw %1,%0\", operands);
- return \"b%R3 %l4\";
- }
-")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0)
- (const_int 1)))
- (set (cc0)
- (compare (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "nonmemory_operand" "ri")))
- (set (pc)
- (if_then_else (match_operator:SI 3 "signed_comparison"
- [(cc0) (const_int 0)])
- (label_ref (match_operand 4 "" ""))
- (pc)))]
- "(GET_CODE (operands[2]) == CONST_INT
- ? (unsigned)INTVAL (operands[2]) + 32 >= 64
- : 1) && (rtx_equal_p (operands[0], operands[1])
- || rtx_equal_p (operands[0], operands[2]))"
- "*
- if (rtx_equal_p (operands[0], operands[1]))
- {
- output_asm_insn (\"icmpw %2,%0\", operands);
- return \"b%N3 %l4\";
- }
- else
- {
- output_asm_insn (\"icmpw %1,%0\", operands);
- return \"b%R3 %l4\";
- }
-")
-
-;; Combine two word moves with consecutive operands into one long move.
-;; Also combines immediate moves, if the high-order destination operand
-;; is loaded with 0 or -1 and the low-order destination operand is loaded
-;; with a constant with the same sign.
-
-(define_peephole
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:SI 1 "general_operand" "g"))
- (set (match_operand:SI 2 "general_operand" "=g")
- (match_operand:SI 3 "general_operand" "g"))]
- "movdi_possible (operands)"
- "*
-{
- output_asm_insn (\"# COMBINE movw %1,%0\", operands);
- output_asm_insn (\"# COMBINE movw %3,%2\", operands);
- movdi_possible (operands);
- if (CONSTANT_P (operands[1]))
- return (swap_operands ? \"movl %3,%0\" : \"movl %1,%2\");
-
- return (swap_operands ? \"movl %1,%0\" : \"movl %3,%2\");
-}")
-
-;; Optimize certain tests after memory stores.
-
-(define_peephole
- [(set (match_operand 0 "memory_operand" "=m")
- (match_operand 1 "register_operand" "r"))
- (set (match_operand:SI 2 "register_operand" "=r")
- (sign_extend:SI (match_dup 1)))
- (set (cc0)
- (match_dup 2))]
- "dead_or_set_p (insn, operands[2])"
- "*
- cc_status.flags |= CC_NO_OVERFLOW;
- if (GET_MODE (operands[0]) == QImode)
- return \"cvtwb %1,%0\";
- else
- return \"cvtwh %1,%0\";
-")
-
-;______________________________________________________________________
-;
-; DImode Patterns.
-;______________________________________________________________________
-
-(define_expand "extendsidi2"
- [(set (subreg:SI (match_operand:DI 0 "register_operand" "=r") 1)
- (match_operand:SI 1 "general_operand" "g"))
- (set (subreg:SI (match_dup 0) 0)
- (subreg:SI (match_dup 0) 1))
- (set (subreg:SI (match_dup 0) 0)
- (ashiftrt:SI (subreg:SI (match_dup 0) 0)
- (const_int 31)))]
- ""
- "")
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_operand:DI 1 "nonmemory_operand" "%0")
- (match_operand:DI 2 "nonmemory_operand" "rF")))]
- ""
- "*
-{
- rtx xoperands[2];
- CC_STATUS_INIT;
- xoperands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (REG_P (operands[2]))
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
- else
- {
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[2]));
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[2]));
- }
- output_asm_insn (\"addw %1,%0\", xoperands);
- return \"addwc %2,%0\";
-}")
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:DI 2 "nonmemory_operand" "rF")))]
- ""
- "*
-{
- rtx xoperands[2];
- CC_STATUS_INIT;
- xoperands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (REG_P (operands[2]))
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
- else
- {
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[2]));
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[2]));
- }
- output_asm_insn (\"subw %1,%0\", xoperands);
- return \"subwb %2,%0\";
-}")
-
-(define_insn "iordi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ior:DI (match_operand:DI 1 "nonmemory_operand" "%0")
- (match_operand:DI 2 "nonmemory_operand" "rF")))]
- ""
- "*
-{
- rtx xoperands[2];
- CC_STATUS_INIT;
- xoperands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (REG_P (operands[2]))
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
- else
- {
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[2]));
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[2]));
- }
- output_asm_insn (\"orw %1,%0\", xoperands);
- return \"orw %2,%0\";
-}")
-
-(define_insn "anddi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (match_operand:DI 1 "nonmemory_operand" "%0")
- (match_operand:DI 2 "nonmemory_operand" "rF")))]
- ""
- "*
-{
- rtx xoperands[2];
- CC_STATUS_INIT;
- xoperands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (REG_P (operands[2]))
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
- else
- {
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[2]));
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[2]));
- }
- output_asm_insn (\"andw %1,%0\", xoperands);
- return \"andw %2,%0\";
-}")
-
-(define_insn "xordi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (xor:DI (match_operand:DI 1 "nonmemory_operand" "%0")
- (match_operand:DI 2 "nonmemory_operand" "rF")))]
- ""
- "*
-{
- rtx xoperands[2];
- CC_STATUS_INIT;
- xoperands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- if (REG_P (operands[2]))
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
- else
- {
- xoperands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[2]));
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[2]));
- }
- output_asm_insn (\"xorw %1,%0\", xoperands);
- return \"xorw %2,%0\";
-}")
-
-;; My version, modelled after Jonathan Stone's and "tablejump" - S.P.
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "general_operand" "r"))]
- ""
- "jump (%0)")
diff --git a/gcc/config/pyr/x-pyr b/gcc/config/pyr/x-pyr
deleted file mode 100644
index 5ee249a423a..00000000000
--- a/gcc/config/pyr/x-pyr
+++ /dev/null
@@ -1,2 +0,0 @@
-CLIB=-lc /usr/.attlib/libPW.a
-
diff --git a/gcc/config/pyr/xm-pyr.h b/gcc/config/pyr/xm-pyr.h
deleted file mode 100644
index d3e1168af4e..00000000000
--- a/gcc/config/pyr/xm-pyr.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Configuration for GNU compiler, for Pyramid 90x, 9000, and MIServer Series.
- Copyright (C) 1989, 1993 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
diff --git a/gcc/config/romp/romp.c b/gcc/config/romp/romp.c
deleted file mode 100644
index 5926b74dce7..00000000000
--- a/gcc/config/romp/romp.c
+++ /dev/null
@@ -1,2038 +0,0 @@
-/* Subroutines used for code generation on ROMP.
- Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@nyu.edu)
-
-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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "recog.h"
-#include "expr.h"
-#include "obstack.h"
-#include "tree.h"
-
-#define min(A,B) ((A) < (B) ? (A) : (B))
-#define max(A,B) ((A) > (B) ? (A) : (B))
-
-static int unsigned_comparisons_p ();
-static void output_loadsave_fpregs ();
-static void output_fpops ();
-static void init_fpops ();
-
-/* Return 1 if the insn using CC0 set by INSN does not contain
- any unsigned tests applied to the condition codes.
-
- Based on `next_insn_tests_no_inequality' in recog.c. */
-
-int
-next_insn_tests_no_unsigned (insn)
- rtx insn;
-{
- register rtx next = next_cc0_user (insn);
-
- if (next == 0)
- {
- if (find_reg_note (insn, REG_UNUSED, cc0_rtx))
- return 1;
- else
- abort ();
- }
-
- return ((GET_CODE (next) == JUMP_INSN
- || GET_CODE (next) == INSN
- || GET_CODE (next) == CALL_INSN)
- && ! unsigned_comparisons_p (PATTERN (next)));
-}
-
-static int
-unsigned_comparisons_p (x)
- rtx x;
-{
- register char *fmt;
- register int len, i;
- register enum rtx_code code = GET_CODE (x);
-
- switch (code)
- {
- case REG:
- case PC:
- case CC0:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case LABEL_REF:
- case SYMBOL_REF:
- return 0;
-
- case LTU:
- case GTU:
- case LEU:
- case GEU:
- return (XEXP (x, 0) == cc0_rtx || XEXP (x, 1) == cc0_rtx);
- }
-
- len = GET_RTX_LENGTH (code);
- fmt = GET_RTX_FORMAT (code);
-
- for (i = 0; i < len; i++)
- {
- if (fmt[i] == 'e')
- {
- if (unsigned_comparisons_p (XEXP (x, i)))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (unsigned_comparisons_p (XVECEXP (x, i, j)))
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Update the condition code from the insn. Look mostly at the first
- byte of the machine-specific insn description information.
-
- cc_state.value[12] refer to two possible values that might correspond
- to the CC. We only store register values. */
-
-update_cc (body, insn)
- rtx body;
- rtx insn;
-{
- switch (get_attr_cc (insn))
- {
- case CC_NONE:
- /* Insn does not affect the CC at all. */
- break;
-
- case CC_CHANGE0:
- /* Insn doesn't affect the CC but does modify operand[0], known to be
- a register. */
- if (cc_status.value1 != 0
- && reg_overlap_mentioned_p (recog_operand[0], cc_status.value1))
- cc_status.value1 = 0;
-
- if (cc_status.value2 != 0
- && reg_overlap_mentioned_p (recog_operand[0], cc_status.value2))
- cc_status.value2 = 0;
-
- break;
-
- case CC_COPY1TO0:
- /* Insn copies operand[1] to operand[0], both registers, but doesn't
- affect the CC. */
- if (cc_status.value1 != 0
- && reg_overlap_mentioned_p (recog_operand[0], cc_status.value1))
- cc_status.value1 = 0;
-
- if (cc_status.value2 != 0
- && reg_overlap_mentioned_p (recog_operand[0], cc_status.value2))
- cc_status.value2 = 0;
-
- if (cc_status.value1 != 0
- && rtx_equal_p (cc_status.value1, recog_operand[1]))
- cc_status.value2 = recog_operand[0];
-
- if (cc_status.value2 != 0
- && rtx_equal_p (cc_status.value2, recog_operand[1]))
- cc_status.value1 = recog_operand[0];
-
- break;
-
- case CC_CLOBBER:
- /* Insn clobbers CC. */
- CC_STATUS_INIT;
- break;
-
- case CC_SETS:
- /* Insn sets CC to recog_operand[0], but overflow is impossible. */
- CC_STATUS_INIT;
- cc_status.flags |= CC_NO_OVERFLOW;
- cc_status.value1 = recog_operand[0];
- break;
-
- case CC_COMPARE:
- /* Insn is a compare which sets the CC fully. Update CC_STATUS for this
- compare and mark whether the test will be signed or unsigned. */
- {
- register rtx p = PATTERN (insn);
-
- CC_STATUS_INIT;
-
- if (GET_CODE (p) == PARALLEL)
- p = XVECEXP (p, 0, 0);
- cc_status.value1 = SET_SRC (p);
-
- if (GET_CODE (SET_SRC (p)) == REG)
- cc_status.flags |= CC_NO_OVERFLOW;
- if (! next_insn_tests_no_unsigned (insn))
- cc_status.flags |= CC_UNSIGNED;
- }
- break;
-
- case CC_TBIT:
- /* Insn sets T bit if result is non-zero. Next insn must be branch. */
- CC_STATUS_INIT;
- cc_status.flags = CC_IN_TB | CC_NOT_NEGATIVE;
- break;
-
- default:
- abort ();
- }
-}
-
-/* Return 1 if a previous compare needs to be re-issued. This will happen
- if two compares tested the same objects, but one was signed and the
- other unsigned. OP is the comparison operation being performed. */
-
-int
-restore_compare_p (op)
- rtx op;
-{
- enum rtx_code code = GET_CODE (op);
-
- return (((code == GEU || code == LEU || code == GTU || code == LTU)
- && ! (cc_status.flags & CC_UNSIGNED))
- || ((code == GE || code == LE || code == GT || code == LT)
- && (cc_status.flags & CC_UNSIGNED)));
-}
-
-/* Generate the (long) string corresponding to an inline multiply insn.
- Note that `r10' does not refer to the register r10, but rather to the
- SCR used as the MQ. */
-char *
-output_in_line_mul ()
-{
- static char insns[200];
- int i;
-
- strcpy (insns, "s %0,%0\n");
- strcat (insns, "\tmts r10,%1\n");
- for (i = 0; i < 16; i++)
- strcat (insns, "\tm %0,%2\n");
- strcat (insns, "\tmfs r10,%0");
-
- return insns;
-}
-
-/* Returns 1 if OP is a memory reference with an offset from a register within
- the range specified. The offset must also be a multiple of the size of the
- mode. */
-
-static int
-memory_offset_in_range_p (op, mode, low, high)
- register rtx op;
- enum machine_mode mode;
- int low, high;
-{
- int offset = 0;
-
- if (! memory_operand (op, mode))
- return 0;
-
- while (GET_CODE (op) == SUBREG)
- {
- offset += SUBREG_WORD (op) * UNITS_PER_WORD;
-#if BYTES_BIG_ENDIAN
- offset -= (min (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (op)))
- - min (UNITS_PER_WORD,
- GET_MODE_SIZE (GET_MODE (SUBREG_REG (op)))));
-#endif
- op = SUBREG_REG (op);
- }
-
- /* We must now have either (mem (reg (x)), (mem (plus (reg (x)) (c))),
- or a constant pool address. */
- if (GET_CODE (op) != MEM)
- abort ();
-
- /* Now use the actual mode and get the address. */
- mode = GET_MODE (op);
- op = XEXP (op, 0);
- if (GET_CODE (op) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (op))
- offset = get_pool_offset (op) + 12;
- else if (GET_CODE (op) == PLUS)
- {
- if (GET_CODE (XEXP (op, 1)) != CONST_INT
- || ! register_operand (XEXP (op, 0), Pmode))
- return 0;
-
- offset += INTVAL (XEXP (op, 1));
- }
-
- else if (! register_operand (op, Pmode))
- return 0;
-
- return (offset >= low && offset <= high
- && (offset % GET_MODE_SIZE (mode) == 0));
-}
-
-/* Return 1 if OP is a valid operand for a memory reference insn that can
- only reference indirect through a register. */
-
-int
-zero_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return memory_offset_in_range_p (op, mode, 0, 0);
-}
-
-/* Return 1 if OP is a valid operand for a `short' memory reference insn. */
-
-int
-short_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (mode == VOIDmode)
- mode = GET_MODE (op);
-
- return memory_offset_in_range_p (op, mode, 0,
- 15 * min (UNITS_PER_WORD,
- GET_MODE_SIZE (mode)));
-}
-
-/* Returns 1 if OP is a memory reference involving a symbolic constant
- that is not in the constant pool. */
-
-int
-symbolic_memory_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (! memory_operand (op, mode))
- return 0;
-
- while (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
-
- if (GET_CODE (op) != MEM)
- abort ();
-
- op = XEXP (op, 0);
- if (constant_pool_address_operand (op, VOIDmode))
- return 0;
- else
- return romp_symbolic_operand (op, Pmode)
- || (GET_CODE (op) == PLUS && register_operand (XEXP (op, 0), Pmode)
- && romp_symbolic_operand (XEXP (op, 1), Pmode));
-}
-
-
-/* Returns 1 if OP is a constant pool reference to the current function. */
-
-int
-current_function_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != MEM || GET_CODE (XEXP (op, 0)) != SYMBOL_REF
- || ! CONSTANT_POOL_ADDRESS_P (XEXP (op, 0)))
- return 0;
-
- op = get_pool_constant (XEXP (op, 0));
- return (GET_CODE (op) == SYMBOL_REF
- && ! strcmp (current_function_name, XSTR (op, 0)));
-}
-
-/* Return non-zero if this function is known to have a null epilogue. */
-
-int
-null_epilogue ()
-{
- return (reload_completed
- && first_reg_to_save () == 16
- && ! romp_pushes_stack ());
-}
-
-/* Returns 1 if OP is the address of a location in the constant pool. */
-
-int
-constant_pool_address_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ((GET_CODE (op) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (op))
- || (GET_CODE (op) == CONST && GET_CODE (XEXP (op, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT
- && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (XEXP (op, 0), 0))));
-}
-
-/* Returns 1 if OP is either a symbol reference or a sum of a symbol
- reference and a constant. */
-
-int
-romp_symbolic_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- return ! op->integrated;
-
- case CONST:
- op = XEXP (op, 0);
- return (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (op, 0)) == LABEL_REF)
- && GET_CODE (XEXP (op, 1)) == CONST_INT;
-
- default:
- return 0;
- }
-}
-
-/* Returns 1 if OP is a valid constant for the ROMP. */
-
-int
-constant_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case LABEL_REF:
- case SYMBOL_REF:
- case PLUS:
- case CONST:
- return romp_symbolic_operand (op,mode);
-
- case CONST_INT:
- return (unsigned int) (INTVAL (op) + 0x8000) < 0x10000
- || (INTVAL (op) & 0xffff) == 0 || (INTVAL (op) & 0xffff0000) == 0;
-
- default:
- return 0;
- }
-}
-
-/* Returns 1 if OP is either a constant integer valid for the ROMP or a
- register. If a register, it must be in the proper mode unless MODE is
- VOIDmode. */
-
-int
-reg_or_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return constant_operand (op, mode);
-
- return register_operand (op, mode);
-}
-
-/* Return 1 is the operand is either a register or ANY constant integer. */
-
-int
-reg_or_any_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == CONST_INT || register_operand (op, mode);
-}
-
-/* Return 1 if the operand is either a register or a valid D-type operand. */
-
-int
-reg_or_D_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return (unsigned) (INTVAL (op) + 0x8000) < 0x10000;
-
- return register_operand (op, mode);
-}
-
-/* Return 1 if the operand is either a register or an item that can be
- used as the operand of an SI add insn. */
-
-int
-reg_or_add_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return reg_or_D_operand (op, mode) || romp_symbolic_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && (INTVAL (op) & 0xffff) == 0);
-}
-
-/* Return 1 if the operand is either a register or an item that can be
- used as the operand of a ROMP logical AND insn. */
-
-int
-reg_or_and_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (reg_or_cint_operand (op, mode))
- return 1;
-
- if (GET_CODE (op) != CONST_INT)
- return 0;
-
- return (INTVAL (op) & 0xffff) == 0xffff
- || (INTVAL (op) & 0xffff0000) == 0xffff0000;
-}
-
-/* Return 1 if the operand is a register or memory operand. */
-
-int
-reg_or_mem_operand (op, mode)
- register rtx op;
- register enum machine_mode mode;
-{
- return register_operand (op, mode) || memory_operand (op, mode);
-}
-
-/* Return 1 if the operand is either a register or a memory operand that is
- not symbolic. */
-
-int
-reg_or_nonsymb_mem_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
-
- if (memory_operand (op, mode) && ! symbolic_memory_operand (op, mode))
- return 1;
-
- return 0;
-}
-
-/* Return 1 if this operand is valid for the ROMP. This is any operand except
- certain constant integers. */
-
-int
-romp_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return constant_operand (op, mode);
-
- return general_operand (op, mode);
-}
-
-/* Return 1 if the operand is (reg:mode 0). */
-
-int
-reg_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ((mode == VOIDmode || mode == GET_MODE (op))
- && GET_CODE (op) == REG && REGNO (op) == 0);
-}
-
-/* Return 1 if the operand is (reg:mode 15). */
-
-int
-reg_15_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return ((mode == VOIDmode || mode == GET_MODE (op))
- && GET_CODE (op) == REG && REGNO (op) == 15);
-}
-
-/* Return 1 if this is a binary floating-point operation. */
-
-int
-float_binary (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (mode != VOIDmode && mode != GET_MODE (op))
- return 0;
-
- if (GET_MODE (op) != SFmode && GET_MODE (op) != DFmode)
- return 0;
-
- switch (GET_CODE (op))
- {
- case PLUS:
- case MINUS:
- case MULT:
- case DIV:
- return GET_MODE (XEXP (op, 0)) == GET_MODE (op)
- && GET_MODE (XEXP (op, 1)) == GET_MODE (op);
-
- default:
- return 0;
- }
-}
-
-/* Return 1 if this is a unary floating-point operation. */
-
-int
-float_unary (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (mode != VOIDmode && mode != GET_MODE (op))
- return 0;
-
- if (GET_MODE (op) != SFmode && GET_MODE (op) != DFmode)
- return 0;
-
- return (GET_CODE (op) == NEG || GET_CODE (op) == ABS)
- && GET_MODE (XEXP (op, 0)) == GET_MODE (op);
-}
-
-/* Return 1 if this is a valid floating-point conversion that can be done
- as part of an operation by the RT floating-point routines. */
-
-int
-float_conversion (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (mode != VOIDmode && mode != GET_MODE (op))
- return 0;
-
- switch (GET_CODE (op))
- {
- case FLOAT_TRUNCATE:
- return GET_MODE (op) == SFmode && GET_MODE (XEXP (op, 0)) == DFmode;
-
- case FLOAT_EXTEND:
- return GET_MODE (op) == DFmode && GET_MODE (XEXP (op, 0)) == SFmode;
-
- case FLOAT:
- return ((GET_MODE (XEXP (op, 0)) == SImode
- || GET_CODE (XEXP (op, 0)) == CONST_INT)
- && (GET_MODE (op) == SFmode || GET_MODE (op) == DFmode));
-
- case FIX:
- return ((GET_MODE (op) == SImode
- || GET_CODE (XEXP (op, 0)) == CONST_INT)
- && (GET_MODE (XEXP (op, 0)) == SFmode
- || GET_MODE (XEXP (op, 0)) == DFmode));
-
- default:
- return 0;
- }
-}
-
-/* Print an operand. Recognize special options, documented below. */
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- char code;
-{
- int i;
-
- switch (code)
- {
- case 'B':
- /* Byte number (const/8) */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%B value");
-
- fprintf (file, "%d", INTVAL (x) / 8);
- break;
-
- case 'L':
- /* Low order 16 bits of constant. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%L value");
-
- fprintf (file, "%d", INTVAL (x) & 0xffff);
- break;
-
- case 's':
- /* Null or "16" depending on whether the constant is greater than 16. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%s value");
-
- if (INTVAL (x) >= 16)
- fprintf (file, "16");
-
- break;
-
- case 'S':
- /* For shifts: 's' will have given the half. Just give the amount
- within 16. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%S value");
-
- fprintf (file, "%d", INTVAL (x) & 15);
- break;
-
- case 'b':
- /* The number of a single bit set or cleared, mod 16. Note that the ROMP
- numbers bits with the high-order bit 31. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%b value");
-
- if ((i = exact_log2 (INTVAL (x))) >= 0)
- fprintf (file, "%d", (31 - i) % 16);
- else if ((i = exact_log2 (~ INTVAL (x))) >= 0)
- fprintf (file, "%d", (31 - i) % 16);
- else
- output_operand_lossage ("invalid %%b value");
-
- break;
-
- case 'h':
- /* "l" or "u" depending on which half of the constant is zero. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%h value");
-
- if ((INTVAL (x) & 0xffff0000) == 0)
- fprintf (file, "l");
- else if ((INTVAL (x) & 0xffff) == 0)
- fprintf (file, "u");
- else
- output_operand_lossage ("invalid %%h value");
-
- break;
-
- case 'H':
- /* Upper or lower half, depending on which half is zero. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%H value");
-
- if ((INTVAL (x) & 0xffff0000) == 0)
- fprintf (file, "%d", INTVAL (x) & 0xffff);
- else if ((INTVAL (x) & 0xffff) == 0)
- fprintf (file, "%d", (INTVAL (x) >> 16) & 0xffff);
- else
- output_operand_lossage ("invalid %%H value");
-
- break;
-
- case 'z':
- /* Write two characters:
- 'lo' if the high order part is all ones
- 'lz' if the high order part is all zeros
- 'uo' if the low order part is all ones
- 'uz' if the low order part is all zeros
- */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%z value");
-
- if ((INTVAL (x) & 0xffff0000) == 0)
- fprintf (file, "lz");
- else if ((INTVAL (x) & 0xffff0000) == 0xffff0000)
- fprintf (file, "lo");
- else if ((INTVAL (x) & 0xffff) == 0)
- fprintf (file, "uz");
- else if ((INTVAL (x) & 0xffff) == 0xffff)
- fprintf (file, "uo");
- else
- output_operand_lossage ("invalid %%z value");
-
- break;
-
- case 'Z':
- /* Upper or lower half, depending on which is non-zero or not
- all ones. Must be consistent with 'z' above. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%Z value");
-
- if ((INTVAL (x) & 0xffff0000) == 0
- || (INTVAL (x) & 0xffff0000) == 0xffff0000)
- fprintf (file, "%d", INTVAL (x) & 0xffff);
- else if ((INTVAL (x) & 0xffff) == 0 || (INTVAL (x) & 0xffff) == 0xffff)
- fprintf (file, "%d", (INTVAL (x) >> 16) & 0xffff);
- else
- output_operand_lossage ("invalid %%Z value");
-
- break;
-
- case 'k':
- /* Same as 'z', except the trailing 'o' or 'z' is not written. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%k value");
-
- if ((INTVAL (x) & 0xffff0000) == 0
- || (INTVAL (x) & 0xffff0000) == 0xffff0000)
- fprintf (file, "l");
- else if ((INTVAL (x) & 0xffff) == 0
- || (INTVAL (x) & 0xffff) == 0xffff)
- fprintf (file, "u");
- else
- output_operand_lossage ("invalid %%k value");
-
- break;
-
- case 't':
- /* Similar to 's', except that we write 'h' or 'u'. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%k value");
-
- if (INTVAL (x) < 16)
- fprintf (file, "u");
- else
- fprintf (file, "l");
- break;
-
- case 'M':
- /* For memory operations, write 's' if the operand is a short
- memory operand. */
- if (short_memory_operand (x, VOIDmode))
- fprintf (file, "s");
- break;
-
- case 'N':
- /* Like 'M', but check for zero memory offset. */
- if (zero_memory_operand (x, VOIDmode))
- fprintf (file, "s");
- break;
-
- case 'O':
- /* Write low-order part of DImode or DFmode. Supported for MEM
- and REG only. */
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x) + 1]);
- else if (GET_CODE (x) == MEM)
- print_operand (file, gen_rtx (MEM, GET_MODE (x),
- plus_constant (XEXP (x, 0), 4)), 0);
- else
- abort ();
- break;
-
- case 'C':
- /* Offset in constant pool for constant pool address. */
- if (! constant_pool_address_operand (x, VOIDmode))
- abort ();
- if (GET_CODE (x) == SYMBOL_REF)
- fprintf (file, "%d", get_pool_offset (x) + 12);
- else
- /* Must be (const (plus (symbol_ref) (const_int))) */
- fprintf (file, "%d",
- (get_pool_offset (XEXP (XEXP (x, 0), 0)) + 12
- + INTVAL (XEXP (XEXP (x, 0), 1))));
- break;
-
- case 'j':
- /* Branch opcode. Check for condition in test bit for eq/ne. */
- switch (GET_CODE (x))
- {
- case EQ:
- if (cc_status.flags & CC_IN_TB)
- fprintf (file, "ntb");
- else
- fprintf (file, "eq");
- break;
-
- case NE:
- if (cc_status.flags & CC_IN_TB)
- fprintf (file, "tb");
- else
- fprintf (file, "ne");
- break;
-
- case GT:
- case GTU:
- fprintf (file, "h");
- break;
-
- case LT:
- case LTU:
- fprintf (file, "l");
- break;
-
- case GE:
- case GEU:
- fprintf (file, "he");
- break;
-
- case LE:
- case LEU:
- fprintf (file, "le");
- break;
-
- default:
- output_operand_lossage ("invalid %%j value");
- }
- break;
-
- case 'J':
- /* Reversed branch opcode. */
- switch (GET_CODE (x))
- {
- case EQ:
- if (cc_status.flags & CC_IN_TB)
- fprintf (file, "tb");
- else
- fprintf (file, "ne");
- break;
-
- case NE:
- if (cc_status.flags & CC_IN_TB)
- fprintf (file, "ntb");
- else
- fprintf (file, "eq");
- break;
-
- case GT:
- case GTU:
- fprintf (file, "le");
- break;
-
- case LT:
- case LTU:
- fprintf (file, "he");
- break;
-
- case GE:
- case GEU:
- fprintf (file, "l");
- break;
-
- case LE:
- case LEU:
- fprintf (file, "h");
- break;
-
- default:
- output_operand_lossage ("invalid %%j value");
- }
- break;
-
- case '.':
- /* Output nothing. Used as delimiter in, e.g., "mc%B1%.3 " */
- break;
-
- case '#':
- /* Output 'x' if this insn has a delay slot, else nothing. */
- if (dbr_sequence_length ())
- fprintf (file, "x");
- break;
-
- case 0:
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x)]);
- else if (GET_CODE (x) == MEM)
- {
- if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
- && current_function_operand (x, Pmode))
- fprintf (file, "r14");
- else
- output_address (XEXP (x, 0));
- }
- else
- output_addr_const (file, x);
- break;
-
- default:
- output_operand_lossage ("invalid %%xn code");
- }
-}
-
-/* This page contains routines that are used to determine what the function
- prologue and epilogue code will do and write them out. */
-
-/* Return the first register that is required to be saved. 16 if none. */
-
-int
-first_reg_to_save()
-{
- int first_reg;
-
- /* Find lowest numbered live register. */
- for (first_reg = 6; first_reg <= 15; first_reg++)
- if (regs_ever_live[first_reg])
- break;
-
- /* If we think that we do not have to save r14, see if it will be used
- to be sure. */
- if (first_reg > 14 && romp_using_r14 ())
- first_reg = 14;
-
- return first_reg;
-}
-
-/* Compute the size of the save area in the stack, including the space for
- the first four incoming arguments. */
-
-int
-romp_sa_size ()
-{
- int size;
- int i;
-
- /* We have the 4 words corresponding to the arguments passed in registers,
- 4 reserved words, space for static chain, general register save area,
- and floating-point save area. */
- size = 4 + 4 + 1 + (16 - first_reg_to_save ());
-
- /* The documentation says we have to leave 18 words in the save area if
- any floating-point registers at all are saved, not the three words
- per register you might otherwise expect. */
- for (i = 2 + (TARGET_FP_REGS != 0); i <= 7; i++)
- if (regs_ever_live[i + 17])
- {
- size += 18;
- break;
- }
-
- return size * 4;
-}
-
-/* Return non-zero if this function makes calls or has fp operations
- (which are really calls). */
-
-int
-romp_makes_calls ()
-{
- rtx insn;
-
- for (insn = get_insns (); insn; insn = next_insn (insn))
- {
- if (GET_CODE (insn) == CALL_INSN)
- return 1;
- else if (GET_CODE (insn) == INSN)
- {
- rtx body = PATTERN (insn);
-
- if (GET_CODE (body) != USE && GET_CODE (body) != CLOBBER
- && GET_CODE (body) != ADDR_VEC
- && GET_CODE (body) != ADDR_DIFF_VEC
- && get_attr_type (insn) == TYPE_FP)
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Return non-zero if this function will use r14 as a pointer to its
- constant pool. */
-
-int
-romp_using_r14 ()
-{
- /* If we are debugging, profiling, have a non-empty constant pool, or
- call a function, we need r14. */
- return (write_symbols != NO_DEBUG || profile_flag || get_pool_size () != 0
- || romp_makes_calls ());
-}
-
-/* Return non-zero if this function needs to push space on the stack. */
-
-int
-romp_pushes_stack ()
-{
- /* We need to push the stack if a frame pointer is needed (because the
- stack might be dynamically adjusted), if we are debugging, if the
- total required size is more than 100 bytes, or if we make calls. */
-
- return (frame_pointer_needed || write_symbols != NO_DEBUG
- || (romp_sa_size () + get_frame_size ()) > 100
- || romp_makes_calls ());
-}
-
-/* Write function prologue.
-
- We compute the size of the fixed area required as follows:
-
- We always allocate 4 words for incoming arguments, 4 word reserved, 1
- word for static link, as many words as required for general register
- save area, plus 2 words for each FP reg 2-7 that must be saved. */
-
-void
-output_prolog (file, size)
- FILE *file;
- int size;
-{
- int first_reg;
- int reg_save_offset;
- int fp_save = size + current_function_outgoing_args_size;
-
- init_fpops ();
-
- /* Add in fixed size plus output argument area. */
- size += romp_sa_size () + current_function_outgoing_args_size;
-
- /* Compute first register to save and perform the save operation if anything
- needs to be saved. */
- first_reg = first_reg_to_save();
- reg_save_offset = - (4 + 4 + 1 + (16 - first_reg)) * 4;
- if (first_reg == 15)
- fprintf (file, "\tst r15,%d(r1)\n", reg_save_offset);
- else if (first_reg < 16)
- fprintf (file, "\tstm r%d,%d(r1)\n", first_reg, reg_save_offset);
-
- /* Set up pointer to data area if it is needed. */
- if (romp_using_r14 ())
- fprintf (file, "\tcas r14,r0,r0\n");
-
- /* Set up frame pointer if needed. */
- if (frame_pointer_needed)
- fprintf (file, "\tcal r13,-%d(r1)\n", romp_sa_size () + 64);
-
- /* Push stack if neeeded. There are a couple of ways of doing this. */
- if (romp_pushes_stack ())
- {
- if (size >= 32768)
- {
- if (size >= 65536)
- {
- fprintf (file, "\tcau r0,%d(r0)\n", size >> 16);
- fprintf (file, "\toil r0,r0,%d\n", size & 0xffff);
- }
- else
- fprintf (file, "\tcal16 r0,%d(r0)\n", size);
- fprintf (file, "\ts r1,r0\n");
- }
- else
- fprintf (file, "\tcal r1,-%d(r1)\n", size);
- }
-
- /* Save floating-point registers. */
- output_loadsave_fpregs (file, USE,
- plus_constant (stack_pointer_rtx, fp_save));
-}
-
-/* Output the offset information used by debuggers.
- This is the exactly the total_size value of output_epilog
- which is added to the frame pointer. However the value in the debug
- table is encoded in a space-saving way as follows:
-
- The first byte contains two fields: a 2-bit size field and the first
- 6 bits of an offset value. The 2-bit size field is in the high-order
- position and specifies how many subsequent bytes follow after
- this one. An offset value is at most 4-bytes long.
-
- The last 6 bits of the first byte initialize the offset value. In many
- cases where procedures have small local storage, this is enough and, in
- this case, the high-order size field is zero so the byte can (almost) be
- used as is (see below). Thus, the byte value of 0x0d is encodes a offset
- size of 13 words, or 52 bytes.
-
- For procedures with a local space larger than 60 bytes, the 6 bits
- are the high-order 6 bits. The remaining bytes follow as necessary,
- in Big Endian order. Thus, the short value of 16907 (= 16384+523)
- encodes an offset of 2092 bytes (523 words).
-
- The total offset value is in words (not bytes), so the final value has to
- be multiplied by 4 before it can be used in address computations by a
- debugger. */
-
-void
-output_encoded_offset (file, reg_offset)
- FILE *file;
- unsigned reg_offset;
-{
- /* Convert the offset value to 4-byte words rather than bytes. */
- reg_offset = (reg_offset + 3) / 4;
-
- /* Now output 1-4 bytes in encoded form. */
- if (reg_offset < (1 << 6))
- /* Fits into one byte */
- fprintf (file, "\t.byte %d\n", reg_offset);
- else if (reg_offset < (1 << (6 + 8)))
- /* Fits into two bytes */
- fprintf (file, "\t.short %d\n", (1 << (6 + 8)) + reg_offset);
- else if (reg_offset < (1 << (6 + 8 + 8)))
- {
- /* Fits in three bytes */
- fprintf (file, "\t.byte %d\n", (2 << 6) + (reg_offset >> ( 6+ 8)));
- fprintf (file, "\t.short %d\n", reg_offset % (1 << (6 + 8)));
- }
- else
- {
- /* Use 4 bytes. */
- fprintf (file, "\t.short %d", (3 << (6 + 8)) + (reg_offset >> (6 + 8)));
- fprintf (file, "\t.short %d\n", reg_offset % (1 << (6 + 8)));
- }
-}
-
-/* Write function epilogue. */
-
-void
-output_epilog (file, size)
- FILE *file;
- int size;
-{
- int first_reg = first_reg_to_save();
- int pushes_stack = romp_pushes_stack ();
- int reg_save_offset = - ((16 - first_reg) + 1 + 4 + 4) * 4;
- int total_size = (size + romp_sa_size ()
- + current_function_outgoing_args_size);
- int fp_save = size + current_function_outgoing_args_size;
- int long_frame = total_size >= 32768;
- rtx insn = get_last_insn ();
- int write_code = 1;
-
- int nargs = 0; /* words of arguments */
- tree argptr;
-
- /* Compute the number of words of arguments. Since this is just for
- the traceback table, we ignore arguments that don't have a size or
- don't have a fixed size. */
-
- for (argptr = DECL_ARGUMENTS (current_function_decl);
- argptr; argptr = TREE_CHAIN (argptr))
- {
- int this_size = int_size_in_bytes (TREE_TYPE (argptr));
-
- if (this_size > 0)
- nargs += (this_size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
- }
-
- /* If the last insn was a BARRIER, we don't have to write anything except
- the trace table. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
- if (insn && GET_CODE (insn) == BARRIER)
- write_code = 0;
-
- /* Restore floating-point registers. */
- if (write_code)
- output_loadsave_fpregs (file, CLOBBER,
- gen_rtx (PLUS, Pmode, gen_rtx (REG, Pmode, 1),
- gen_rtx (CONST_INT, VOIDmode, fp_save)));
-
- /* If we push the stack and do not have size > 32K, adjust the register
- save location to the current position of sp. Otherwise, if long frame,
- restore sp from fp. */
- if (pushes_stack && ! long_frame)
- reg_save_offset += total_size;
- else if (long_frame && write_code)
- fprintf (file, "\tcal r1,%d(r13)\n", romp_sa_size () + 64);
-
- /* Restore registers. */
- if (first_reg == 15 && write_code)
- fprintf (file, "\tl r15,%d(r1)\n", reg_save_offset);
- else if (first_reg < 16 && write_code)
- fprintf (file, "\tlm r%d,%d(r1)\n", first_reg, reg_save_offset);
- if (first_reg == 16) first_reg = 0;
-
- /* Handle popping stack, if needed and write debug table entry. */
- if (pushes_stack)
- {
- if (write_code)
- {
- if (long_frame)
- fprintf (file, "\tbr r15\n");
- else
- fprintf (file, "\tbrx r15\n\tcal r1,%d(r1)\n", total_size);
- }
-
- /* Table header (0xdf), usual-type stack frame (0x07),
- table header (0xdf), and first register saved.
-
- The final 0x08 means that there is a byte following this one
- describing the number of parameter words and the register used as
- stack pointer.
-
- If GCC passed floating-point parameters in floating-point registers,
- it would be necessary to change the final byte from 0x08 to 0x0c.
- Also an additional entry byte would be need to be emitted to specify
- the first floating-point register.
-
- (See also Section 11 (Trace Tables) in ``IBM/4.3 Linkage Convention,''
- pages IBM/4.3-PSD:5-7 of Volume III of the IBM Academic Operating
- System Manual dated July 1987.) */
-
- fprintf (file, "\t.long 0x%x\n", 0xdf07df08 + first_reg * 0x10);
-
- if (nargs > 15) nargs = 15;
-
- /* The number of parameter words and the register used as the stack
- pointer (encoded here as r1).
-
- Note: The MetWare Hich C Compiler R2.1y actually gets this wrong;
- it erroneously lists r13 but uses r1 as the stack too. But a bug in
- dbx 1.5 nullifies this mistake---most of the time.
- (Dbx retrieves the value of r13 saved on the stack which is often
- the value of r1 before the call.) */
-
- fprintf (file, "\t.byte 0x%x1\n", nargs);
- output_encoded_offset (file, total_size);
- }
- else
- {
- if (write_code)
- fprintf (file, "\tbr r15\n");
-
- /* Table header (0xdf), no stack frame (0x02),
- table header (0xdf) and no parameters saved (0x00).
-
- If GCC passed floating-point parameters in floating-point registers,
- it might be necessary to change the final byte from 0x00 to 0x04.
- Also a byte would be needed to specify the first floating-point
- register. */
- fprintf (file, "\t.long 0xdf02df00\n");
- }
-
- /* Output any pending floating-point operations. */
- output_fpops (file);
-}
-
-/* For the ROMP we need to make new SYMBOL_REFs for the actual name of a
- called routine. To keep them unique we maintain a hash table of all
- that have been created so far. */
-
-struct symref_hashent {
- rtx symref; /* Created SYMBOL_REF rtx. */
- struct symref_hashent *next; /* Next with same hash code. */
-};
-
-#define SYMHASHSIZE 151
-#define HASHBITS 65535
-
-/* Define the hash table itself. */
-
-static struct symref_hashent *symref_hash_table[SYMHASHSIZE];
-
-/* Given a name (allocatable in temporary storage), return a SYMBOL_REF
- for the name. The rtx is allocated from the current rtl_obstack, while
- the name string is allocated from the permanent obstack. */
-rtx
-get_symref (name)
- register char *name;
-{
- extern struct obstack permanent_obstack;
- register char *sp = name;
- unsigned int hash = 0;
- struct symref_hashent *p, **last_p;
-
- /* Compute the hash code for the string. */
- while (*sp)
- hash = (hash << 4) + *sp++;
-
- /* Search for a matching entry in the hash table, keeping track of the
- insertion location as we do so. */
- hash = (hash & HASHBITS) % SYMHASHSIZE;
- for (last_p = &symref_hash_table[hash], p = *last_p;
- p; last_p = &p->next, p = *last_p)
- if (strcmp (name, XSTR (p->symref, 0)) == 0)
- break;
-
- /* If couldn't find matching SYMBOL_REF, make a new one. */
- if (p == 0)
- {
- /* Ensure SYMBOL_REF will stay around. */
- end_temporary_allocation ();
- p = *last_p = (struct symref_hashent *)
- permalloc (sizeof (struct symref_hashent));
- p->symref = gen_rtx (SYMBOL_REF, Pmode,
- obstack_copy0 (&permanent_obstack,
- name, strlen (name)));
- p->next = 0;
- resume_temporary_allocation ();
- }
-
- return p->symref;
-}
-
-/* Validate the precision of a floating-point operation.
-
- We merge conversions from integers and between floating-point modes into
- the insn. However, this must not effect the desired precision of the
- insn. The RT floating-point system uses the widest of the operand modes.
- If this should be a double-precision insn, ensure that one operand
- passed to the floating-point processor has double mode.
-
- Note that since we don't check anything if the mode is single precision,
- it, strictly speaking, isn't necessary to call this for those insns.
- However, we do so in case something else needs to be checked in the
- future.
-
- This routine returns 1 if the operation is OK. */
-
-int
-check_precision (opmode, op1, op2)
- enum machine_mode opmode;
- rtx op1, op2;
-{
- if (opmode == SFmode)
- return 1;
-
- /* If operand is not a conversion from an integer mode or an extension from
- single-precision, it must be a double-precision value. */
- if (GET_CODE (op1) != FLOAT && GET_CODE (op1) != FLOAT_EXTEND)
- return 1;
-
- if (op2 && GET_CODE (op2) != FLOAT && GET_CODE (op2) != FLOAT_EXTEND)
- return 1;
-
- return 0;
-}
-
-/* Floating-point on the RT is done by creating an operation block in the data
- area that describes the operation. If two floating-point operations are the
- same in a single function, they can use the same block.
-
- These routines are responsible for managing these blocks. */
-
-/* Structure to describe a floating-point operation. */
-
-struct fp_op {
- struct fp_op *next_same_hash; /* Next op with same hash code. */
- struct fp_op *next_in_mem; /* Next op in memory. */
- int mem_offset; /* Offset from data area. */
- short size; /* Size of block in bytes. */
- short noperands; /* Number of operands in block. */
- rtx ops[3]; /* RTL for operands. */
- enum rtx_code opcode; /* Operation being performed. */
-};
-
-/* Size of hash table. */
-#define FP_HASH_SIZE 101
-
-/* Hash table of floating-point operation blocks. */
-static struct fp_op *fp_hash_table[FP_HASH_SIZE];
-
-/* First floating-point block in data area. */
-static struct fp_op *first_fpop;
-
-/* Last block in data area so far. */
-static struct fp_op *last_fpop_in_mem;
-
-/* Subroutine number in file, to get unique "LF" labels. */
-static int subr_number = 0;
-
-/* Current word offset in data area (includes header and any constant pool). */
-int data_offset;
-
-/* Compute hash code for an RTX used in floating-point. */
-
-static unsigned int
-hash_rtx (x)
- register rtx x;
-{
- register unsigned int hash = (((int) GET_CODE (x) << 10)
- + ((int) GET_MODE (x) << 20));
- register int i;
- register char *fmt = GET_RTX_FORMAT (GET_CODE (x));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (x)); i++)
- if (fmt[i] == 'e')
- hash += hash_rtx (XEXP (x, i));
- else if (fmt[i] == 'u')
- hash += (unsigned HOST_WIDE_INT) XEXP (x, i);
- else if (fmt[i] == 'i')
- hash += XINT (x, i);
- else if (fmt[i] == 's')
- hash += (unsigned HOST_WIDE_INT) XSTR (x, i);
-
- return hash;
-}
-
-/* Given an operation code and up to three operands, return a character string
- corresponding to the code to emit to branch to a floating-point operation
- block. INSN is provided to see if the delay slot has been filled or not.
-
- A new floating-point operation block is created if this operation has not
- been seen before. */
-
-char *
-output_fpop (code, op0, op1, op2, insn)
- enum rtx_code code;
- rtx op0, op1, op2;
- rtx insn;
-{
- static char outbuf[40];
- unsigned int hash, hash0, hash1, hash2;
- int size, i;
- register struct fp_op *fpop, *last_fpop;
- int dyadic = (op2 != 0);
- enum machine_mode opmode;
- int noperands;
- rtx tem;
- unsigned int tem_hash;
- int fr0_avail = 0;
-
- /* Compute hash code for each operand. If the operation is commutative,
- put the one with the smaller hash code first. This will make us see
- more operations as identical. */
- hash0 = op0 ? hash_rtx (op0) : 0;
- hash1 = op1 ? hash_rtx (op1) : 0;
- hash2 = op2 ? hash_rtx (op2) : 0;
-
- if (hash0 > hash1 && code == EQ)
- {
- tem = op0; op0 = op1; op1 = tem;
- tem_hash = hash0; hash0 = hash1; hash1 = tem_hash;
- }
- else if (hash1 > hash2 && (code == PLUS || code == MULT))
- {
- tem = op1; op1 = op2; op2 = tem;
- tem_hash = hash1; hash1 = hash2; hash2 = tem_hash;
- }
-
- /* If operation is commutative and the first and third operands are equal,
- swap the second and third operands. Note that we must consider two
- operands equal if they are the same register even if different modes. */
- if (op2 && (code == PLUS || code == MULT)
- && (rtx_equal_p (op0, op2)
- || (GET_CODE (op0) == REG && GET_CODE (op2) == REG
- && REGNO (op0) == REGNO (op2))))
- {
- tem = op1; op1 = op2; op2 = tem;
- tem_hash = hash1; hash1 = hash2; hash2 = tem_hash;
- }
-
- /* If the first and second operands are the same, merge them. Don't do this
- for SFmode or SImode in general registers because this triggers a bug in
- the RT fp code. */
- if (op1 && rtx_equal_p (op0, op1)
- && code != EQ && code != GE && code != SET
- && ((GET_MODE (op1) != SFmode && GET_MODE (op1) != SImode)
- || GET_CODE (op0) != REG || FP_REGNO_P (REGNO (op0))))
- {
- op1 = op2;
- op2 = 0;
- }
-
- noperands = 1 + (op1 != 0) + (op2 != 0);
-
- /* Compute hash code for entire expression and see if operation block
- already exists. */
- hash = ((int) code << 13) + (hash0 << 2) + (hash1 << 1) + hash2;
-
- hash %= FP_HASH_SIZE;
- for (fpop = fp_hash_table[hash], last_fpop = 0;
- fpop;
- last_fpop = fpop, fpop = fpop->next_same_hash)
- if (fpop->opcode == code && noperands == fpop->noperands
- && (op0 == 0 || rtx_equal_p (op0, fpop->ops[0]))
- && (op1 == 0 || rtx_equal_p (op1, fpop->ops[1]))
- && (op2 == 0 || rtx_equal_p (op2, fpop->ops[2])))
- goto win;
-
- /* We have never seen this operation before. */
- fpop = (struct fp_op *) oballoc (sizeof (struct fp_op));
- fpop->mem_offset = data_offset;
- fpop->opcode = code;
- fpop->noperands = noperands;
- fpop->ops[0] = op0;
- fpop->ops[1] = op1;
- fpop->ops[2] = op2;
-
- /* Compute the size using the rules in Appendix A of the RT Linkage
- Convention (4.3/RT-PSD:5) manual. These rules are a bit ambiguous,
- but if we guess wrong, it will effect only efficiency, not correctness. */
-
- /* Size = 24 + 32 for each non-fp (or fr7) */
- size = 24;
- if (op0 && (GET_CODE (op0) != REG
- || ! FP_REGNO_P (REGNO (op0)) || REGNO (op0) == 23))
- size += 32;
-
- if (op1 && (GET_CODE (op1) != REG
- || ! FP_REGNO_P (REGNO (op1)) || REGNO (op1) == 23))
- size += 32;
-
- if (op2 && (GET_CODE (op2) != REG
- || ! FP_REGNO_P (REGNO (op2)) || REGNO (op2) == 23))
- size += 32;
-
- /* Size + 12 for each conversion. First get operation mode. */
- if ((op0 && GET_MODE (op0) == DFmode)
- || (op1 && GET_MODE (op1) == DFmode)
- || (op2 && GET_MODE (op2) == DFmode))
- opmode = DFmode;
- else
- opmode = SFmode;
-
- if (op0 && GET_MODE (op0) != opmode)
- size += 12;
- if (op1 && GET_MODE (op1) != opmode)
- size += 12;
- if (op2 && GET_MODE (op2) != opmode)
- size += 12;
-
- /* 12 more if first and third operand types not the same. */
- if (op2 && GET_MODE (op0) != GET_MODE (op2))
- size += 12;
-
- /* CMP and CMPT need additional. Also, compute size of save/restore here. */
- if (code == EQ)
- size += 32;
- else if (code == GE)
- size += 64;
- else if (code == USE || code == CLOBBER)
- {
- /* 34 + 24 for each additional register plus 8 if fr7 saved. (We
- call it 36 because we need to keep the block length a multiple
- of four. */
- size = 36 - 24;
- for (i = 0; i <= 7; i++)
- if (INTVAL (op0) & (1 << (7-i)))
- size += 24 + 8 * (i == 7);
- }
-
- /* We provide no general-purpose scratch registers. */
- size +=16;
-
- /* No floating-point scratch registers are provided. Compute extra
- length due to this. This logic is that shown in the referenced
- appendix. */
-
- i = 0;
- if (op0 && GET_CODE (op0) == REG && FP_REGNO_P (REGNO (op0)))
- i++;
- if (op1 && GET_CODE (op1) == REG && FP_REGNO_P (REGNO (op1)))
- i++;
- if (op2 && GET_CODE (op2) == REG && FP_REGNO_P (REGNO (op2)))
- i++;
-
- if ((op0 == 0 || GET_CODE (op0) != REG || REGNO(op0) != 17)
- && (op1 == 0 || GET_CODE (op1) != REG || REGNO(op1) != 17)
- && (op2 == 0 || GET_CODE (op2) != REG || REGNO(op2) != 17))
- fr0_avail = 1;
-
- if (dyadic)
- {
- if (i == 0)
- size += fr0_avail ? 64 : 112;
- else if (fpop->noperands == 2 && i == 1)
- size += fr0_avail ? 0 : 64;
- else if (fpop->noperands == 3)
- {
- if (GET_CODE (op0) == REG && FP_REGNO_P (REGNO (op0))
- && GET_CODE (op2) == REG && FP_REGNO_P (REGNO (op2)))
- {
- if (REGNO (op0) == REGNO (op2))
-#if 1
- /* This triggers a bug on the RT. */
- abort ();
-#else
- size += fr0_avail ? 0 : 64;
-#endif
- }
- else
- {
- i = 0;
- if (GET_CODE (op0) == REG && FP_REGNO_P (REGNO (op0)))
- i++;
- if (GET_CODE (op2) == REG && FP_REGNO_P (REGNO (op2)))
- i++;
- if (i == 0)
- size += fr0_avail ? 64 : 112;
- else if (i == 1)
- size += fr0_avail ? 0 : 64;
- }
- }
- }
- else if (code != USE && code != CLOBBER
- && (GET_CODE (op0) != REG || ! FP_REGNO_P (REGNO (op0))))
- size += 64;
-
- if (! TARGET_FULL_FP_BLOCKS)
- {
- /* If we are not to pad the blocks, just compute its actual length. */
- size = 12; /* Header + opcode */
- if (code == USE || code == CLOBBER)
- size += 2;
- else
- {
- if (op0) size += 2;
- if (op1) size += 2;
- if (op2) size += 2;
- }
-
- /* If in the middle of a word, round. */
- if (size % UNITS_PER_WORD)
- size += 2;
-
- /* Handle any immediates. */
- if (code != USE && code != CLOBBER && op0 && GET_CODE (op0) != REG)
- size += 4;
- if (op1 && GET_CODE (op1) != REG)
- size += 4;
- if (op2 && GET_CODE (op2) != REG)
- size += 4;
-
- if (code != USE && code != CLOBBER &&
- op0 && GET_CODE (op0) == CONST_DOUBLE && GET_MODE (op0) == DFmode)
- size += 4;
- if (op1 && GET_CODE (op1) == CONST_DOUBLE && GET_MODE (op1) == DFmode)
- size += 4;
- if (op2 && GET_CODE (op2) == CONST_DOUBLE && GET_MODE (op2) == DFmode)
- size += 4;
- }
-
- /* Done with size computation! Chain this in. */
- fpop->size = size;
- data_offset += size / UNITS_PER_WORD;
- fpop->next_in_mem = 0;
- fpop->next_same_hash = 0;
-
- if (last_fpop_in_mem)
- last_fpop_in_mem->next_in_mem = fpop;
- else
- first_fpop = fpop;
- last_fpop_in_mem = fpop;
-
- if (last_fpop)
- last_fpop->next_same_hash = fpop;
- else
- fp_hash_table[hash] = fpop;
-
-win:
- /* FPOP describes the operation to be performed. Return a string to branch
- to it. */
- if (fpop->mem_offset < 32768 / UNITS_PER_WORD)
- sprintf (outbuf, "cal r15,%d(r14)\n\tbalr%s r15,r15",
- fpop->mem_offset * UNITS_PER_WORD,
- dbr_sequence_length () ? "x" : "");
- else
- sprintf (outbuf, "get r15,$L%dF%d\n\tbalr%s r15,r15",
- subr_number, fpop->mem_offset * UNITS_PER_WORD,
- dbr_sequence_length () ? "x" : "");
- return outbuf;
-}
-
-/* If necessary, output a floating-point operation to save or restore all
- floating-point registers.
-
- file is the file to write the operation to, CODE is USE for save, CLOBBER
- for restore, and ADDR is the address of the same area, as RTL. */
-
-static void
-output_loadsave_fpregs (file, code, addr)
- FILE *file;
- enum rtx_code code;
- rtx addr;
-{
- register int i;
- register int mask = 0;
-
- for (i = 2 + (TARGET_FP_REGS != 0); i <= 7; i++)
- if (regs_ever_live[i + 17])
- mask |= 1 << (7 - i);
-
- if (mask)
- fprintf (file, "\t%s\n",
- output_fpop (code, gen_rtx (CONST_INT, VOIDmode, mask),
- gen_rtx (MEM, Pmode, addr),
- 0, const0_rtx));
-
-}
-
-/* Output any floating-point operations at the end of the routine. */
-
-static void
-output_fpops (file)
- FILE *file;
-{
- register struct fp_op *fpop;
- register int size_so_far;
- register int i;
- rtx immed[3];
-
- if (first_fpop == 0)
- return;
-
- data_section ();
-
- ASM_OUTPUT_ALIGN (file, 2);
-
- for (fpop = first_fpop; fpop; fpop = fpop->next_in_mem)
- {
- if (fpop->mem_offset < 32768 / UNITS_PER_WORD)
- fprintf (file, "# data area offset = %d\n",
- fpop->mem_offset * UNITS_PER_WORD);
- else
- fprintf (file, "L%dF%d:\n",
- subr_number, fpop->mem_offset * UNITS_PER_WORD);
-
- fprintf (file, "\tcas r0,r15,r0\n");
- fprintf (file, "\t.long FPGLUE\n");
- switch (fpop->opcode)
- {
- case USE:
- fprintf (file, "\t.byte 0x1d\t# STOREM\n");
- break;
- case CLOBBER:
- fprintf (file, "\t.byte 0x0f\t# LOADM\n");
- break;
- case ABS:
- fprintf (file, "\t.byte 0x00\t# ABS\n");
- break;
- case PLUS:
- fprintf (file, "\t.byte 0x02\t# ADD\n");
- break;
- case EQ:
- fprintf (file, "\t.byte 0x07\t# CMP\n");
- break;
- case GE:
- fprintf (file, "\t.byte 0x08\t# CMPT\n");
- break;
- case DIV:
- fprintf (file, "\t.byte 0x0c\t# DIV\n");
- break;
- case SET:
- fprintf (file, "\t.byte 0x14\t# MOVE\n");
- break;
- case MULT:
- fprintf (file, "\t.byte 0x15\t# MUL\n");
- break;
- case NEG:
- fprintf (file, "\t.byte 0x16\t# NEG\n");
- break;
- case SQRT:
- fprintf (file, "\t.byte 0x1c\t# SQRT\n");
- break;
- case MINUS:
- fprintf (file, "\t.byte 0x1e\t# SUB\n");
- break;
- default:
- abort ();
- }
-
- fprintf (file, "\t.byte %d\n", fpop->noperands);
- fprintf (file, "\t.short 0x8001\n");
-
- if ((fpop->ops[0] == 0
- || GET_CODE (fpop->ops[0]) != REG || REGNO(fpop->ops[0]) != 17)
- && (fpop->ops[1] == 0 || GET_CODE (fpop->ops[1]) != REG
- || REGNO(fpop->ops[1]) != 17)
- && (fpop->ops[2] == 0 || GET_CODE (fpop->ops[2]) != REG
- || REGNO(fpop->ops[2]) != 17))
- fprintf (file, "\t.byte %d, 0x80\n", fpop->size);
- else
- fprintf (file, "\t.byte %d, 0\n", fpop->size);
- size_so_far = 12;
- for (i = 0; i < fpop->noperands; i++)
- {
- register int type;
- register int opbyte;
- register char *desc0;
- char desc1[50];
-
- immed[i] = 0;
- switch (GET_MODE (fpop->ops[i]))
- {
- case SImode:
- case VOIDmode:
- desc0 = "int";
- type = 0;
- break;
- case SFmode:
- desc0 = "float";
- type = 2;
- break;
- case DFmode:
- desc0 = "double";
- type = 3;
- break;
- default:
- abort ();
- }
-
- switch (GET_CODE (fpop->ops[i]))
- {
- case REG:
- strcpy(desc1, reg_names[REGNO (fpop->ops[i])]);
- if (FP_REGNO_P (REGNO (fpop->ops[i])))
- {
- type += 0x10;
- opbyte = REGNO (fpop->ops[i]) - 17;
- }
- else
- {
- type += 0x00;
- opbyte = REGNO (fpop->ops[i]);
- if (type == 3)
- opbyte = (opbyte << 4) + opbyte + 1;
- }
- break;
-
- case MEM:
- type += 0x30;
- if (GET_CODE (XEXP (fpop->ops[i], 0)) == PLUS)
- {
- immed[i] = XEXP (XEXP (fpop->ops[i], 0), 1);
- opbyte = REGNO (XEXP (XEXP (fpop->ops[i], 0), 0));
- if (GET_CODE (immed[i]) == CONST_INT)
- sprintf (desc1, "%d(%s)", INTVAL (immed[i]),
- reg_names[opbyte]);
- else
- sprintf (desc1, "<memory> (%s)", reg_names[opbyte]);
- }
- else if (GET_CODE (XEXP (fpop->ops[i], 0)) == REG)
- {
- opbyte = REGNO (XEXP (fpop->ops[i], 0));
- immed[i] = const0_rtx;
- sprintf (desc1, "(%s)", reg_names[opbyte]);
- }
- else
- {
- immed[i] = XEXP (fpop->ops[i], 0);
- opbyte = 0;
- sprintf(desc1, "<memory>");
- }
- break;
-
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- type += 0x20;
- opbyte = 0;
- immed[i] = fpop->ops[i];
- desc1[0] = '$';
- desc1[1] = '\0';
- break;
-
- default:
- abort ();
- }
-
- /* Save/restore is special. */
- if (i == 0 && (fpop->opcode == USE || fpop->opcode == CLOBBER))
- type = 0xff, opbyte = INTVAL (fpop->ops[0]), immed[i] = 0;
-
- fprintf (file, "\t.byte 0x%x,0x%x # (%s) %s\n",
- type, opbyte, desc0, desc1);
-
- size_so_far += 2;
- }
-
- /* If in the middle of a word, round. */
- if (size_so_far % UNITS_PER_WORD)
- {
- fprintf (file, "\t.space 2\n");
- size_so_far += 2;
- }
-
- for (i = 0; i < fpop->noperands; i++)
- if (immed[i])
- switch (GET_MODE (immed[i]))
- {
- case SImode:
- case VOIDmode:
- size_so_far += 4;
- fprintf (file, "\t.long ");
- output_addr_const (file, immed[i]);
- fprintf (file, "\n");
- break;
-
- case DFmode:
- size_so_far += 4;
- case SFmode:
- size_so_far += 4;
- if (GET_CODE (immed[i]) == CONST_DOUBLE)
- {
- union real_extract u;
-
- bcopy ((char *) &CONST_DOUBLE_LOW (immed[i]),
- (char *) &u, sizeof u);
- if (GET_MODE (immed[i]) == DFmode)
- ASM_OUTPUT_DOUBLE (file, u.d);
- else
- ASM_OUTPUT_FLOAT (file, u.d);
- }
- else
- abort ();
- break;
-
- default:
- abort ();
- }
-
- if (size_so_far != fpop->size)
- {
- if (TARGET_FULL_FP_BLOCKS)
- fprintf (file, "\t.space %d\n", fpop->size - size_so_far);
- else
- abort ();
- }
- }
-
- /* Update for next subroutine. */
- subr_number++;
- text_section ();
-}
-
- /* Initialize floating-point operation table. */
-
-static void
-init_fpops()
-{
- register int i;
-
- first_fpop = last_fpop_in_mem = 0;
- for (i = 0; i < FP_HASH_SIZE; i++)
- fp_hash_table[i] = 0;
-}
-
-/* Return the offset value of an automatic variable (N_LSYM) having
- the given offset. Basically, we correct by going from a frame pointer to
- stack pointer value.
-*/
-
-int
-romp_debugger_auto_correction(offset)
- int offset;
-{
- int fp_to_sp;
-
- /* We really want to go from STACK_POINTER_REGNUM to
- FRAME_POINTER_REGNUM, but this isn't defined. So go the other
- direction and negate. */
- INITIAL_ELIMINATION_OFFSET (FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM,
- fp_to_sp);
-
- /* The offset value points somewhere between the frame pointer and
- the stack pointer. What is up from the frame pointer is down from the
- stack pointer. Therefore the negation in the offset value too. */
-
- return -(offset+fp_to_sp+4);
-}
-
-/* Return the offset value of an argument having
- the given offset. Basically, we correct by going from a arg pointer to
- stack pointer value. */
-
-int
-romp_debugger_arg_correction (offset)
- int offset;
-{
- int fp_to_argp;
-
- INITIAL_ELIMINATION_OFFSET (ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM,
- fp_to_argp);
-
- /* Actually, something different happens if offset is from a floating-point
- register argument, but we don't handle it here. */
-
- return (offset - fp_to_argp);
-}
diff --git a/gcc/config/romp/romp.h b/gcc/config/romp/romp.h
deleted file mode 100644
index be12d367fbb..00000000000
--- a/gcc/config/romp/romp.h
+++ /dev/null
@@ -1,1636 +0,0 @@
-/* Definitions of target machine for GNU compiler, for ROMP chip.
- Copyright (C) 1989, 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@nyu.edu)
-
-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. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dibm032 -Dunix -Asystem(unix) -Asystem(bsd) -Acpu(ibm032) -Amachine(ibm032)"
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION ;
-
-/* Add -lfp_p when running with -p or -pg. */
-#define LIB_SPEC "%{pg:-lfp_p}%{p:-lfp_p} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-/* Flag to generate all multiplies as an in-line sequence of multiply-step
- insns instead of calling a library routine. */
-#define TARGET_IN_LINE_MUL (target_flags & 1)
-
-/* Flag to generate padded floating-point data blocks. Otherwise, we generate
- them the minimum size. This trades off execution speed against size. */
-#define TARGET_FULL_FP_BLOCKS (target_flags & 2)
-
-/* Flag to pass and return floating point values in floating point registers.
- Since this violates the linkage convention, we feel free to destroy fr2
- and fr3 on function calls.
- fr1-fr3 are used to pass the arguments. */
-#define TARGET_FP_REGS (target_flags & 4)
-
-/* Flag to return structures of more than one word in memory. This is for
- compatibility with the MetaWare HighC (hc) compiler. */
-#define TARGET_HC_STRUCT_RETURN (target_flags & 010)
-
-extern int target_flags;
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { {"in-line-mul", 1}, \
- {"call-lib-mul", -1}, \
- {"full-fp-blocks", 2}, \
- {"minimum-fp-blocks", -2}, \
- {"fp-arg-in-fpregs", 4}, \
- {"fp-arg-in-gregs", -4}, \
- {"hc-struct-return", 010}, \
- {"nohc-struct-return", - 010}, \
- { "", TARGET_DEFAULT}}
-
-#define TARGET_DEFAULT 3
-
-/* target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-/* That is true on ROMP. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is true on ROMP. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is lowest
- numbered.
-
- For ROMP we can decide arbitrarily since there are no machine instructions
- for them. Might as well be consistent with bits and bytes. */
-#define WORDS_BIG_ENDIAN 1
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 16
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Make strings word-aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- (TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- ROMP has 16 fullword registers and 8 floating point registers.
-
- In addition, the difference between the frame and argument pointers is
- a function of the number of registers saved, so we need to have a register
- to use for AP that will later be eliminated in favor of sp or fp. This is
- a normal register, but it is fixed. */
-
-#define FIRST_PSEUDO_REGISTER 25
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
-
- On ROMP, r1 is used for the stack and r14 is used for a
- data area pointer.
-
- HACK WARNING: On the RT, there is a bug in code generation for
- the MC68881 when the first and third operands are the same floating-point
- register. See the definition of the FINAL_PRESCAN_INSN macro for details.
- Here we need to reserve fr0 for this purpose. */
-#define FIXED_REGISTERS \
- {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, \
- 1, 0, 0, 0, 0, 0, 0, 0}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, \
- 1, 1, 0, 0, 0, 0, 0, 0}
-
-/* List the order in which to allocate registers. Each register must be
- listed once, even those in FIXED_REGISTERS.
-
- We allocate in the following order:
- fr0, fr1 (not saved)
- fr2 ... fr6
- fr7 (more expensive for some FPA's)
- r0 (not saved and won't conflict with parameter register)
- r4, r3, r2 (not saved, highest used first to make less conflict)
- r5 (not saved, but forces r6 to be saved if DI/DFmode)
- r15, r14, r13, r12, r11, r10, r9, r8, r7, r6 (less to save)
- r1, ap */
-
-#define REG_ALLOC_ORDER \
- {17, 18, \
- 19, 20, 21, 22, 23, \
- 24, \
- 0, \
- 4, 3, 2, \
- 5, \
- 15, 14, 13, 12, 11, 10, \
- 9, 8, 7, 6, \
- 1, 16}
-
-/* True if register is floating-point. */
-#define FP_REGNO_P(N) ((N) >= 17)
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On ROMP, ordinary registers hold 32 bits worth;
- a single floating point register is always enough for
- anything that can be stored in them at all. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (FP_REGNO_P (REGNO) ? GET_MODE_NUNITS (MODE) \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On ROMP, the cpu registers can hold any mode but the float registers
- can hold only floating point. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (! FP_REGNO_P (REGNO) || GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- ((GET_MODE_CLASS (MODE1) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
- == (GET_MODE_CLASS (MODE2) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT))
-
-/* A C expression returning the cost of moving data from a register of class
- CLASS1 to one of CLASS2.
-
- On the ROMP, access to floating-point registers is expensive (even between
- two FP regs.) */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- (2 + 10 * ((CLASS1) == FP_REGS) + 10 * (CLASS2 == FP_REGS))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* ROMP pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 1
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 13
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 0
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 16
-
-/* Place to put static chain when calling a function that requires it. */
-#define STATIC_CHAIN \
- gen_rtx (MEM, Pmode, gen_rtx (PLUS, Pmode, stack_pointer_rtx, \
- gen_rtx (CONST_INT, VOIDmode, -36)))
-
-/* Place where static chain is found upon entry to routine. */
-#define STATIC_CHAIN_INCOMING \
- gen_rtx (MEM, Pmode, gen_rtx (PLUS, Pmode, arg_pointer_rtx, \
- gen_rtx (CONST_INT, VOIDmode, -20)))
-
-/* Place that structure value return address is placed.
-
- On the ROMP, it is passed as an extra parameter. */
-#define STRUCT_VALUE 0
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The ROMP has two types of registers, general and floating-point.
-
- However, r0 is special in that it cannot be used as a base register.
- So make a class for registers valid as base registers.
-
- For floating-point support, add classes that just consist of r0 and
- r15, respectively. */
-
-enum reg_class { NO_REGS, R0_REGS, R15_REGS, BASE_REGS, GENERAL_REGS,
- FP_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "R0_REGS", "R15_REGS", "BASE_REGS", "GENERAL_REGS", \
- "FP_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS {0, 0x00001, 0x08000, 0x1fffe, 0x1ffff, \
- 0x1fe0000, 0x1ffffff }
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) == 0 ? GENERAL_REGS : FP_REGNO_P (REGNO) ? FP_REGS : BASE_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS BASE_REGS
-#define BASE_REG_CLASS BASE_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'f' ? FP_REGS \
- : (C) == 'b' ? BASE_REGS \
- : (C) == 'z' ? R0_REGS \
- : (C) == 't' ? R15_REGS \
- : NO_REGS)
-
-/* The letters I, J, K, L, M, N, and P in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- `I' is constants less than 16
- `J' is negative constants greater than -16
- `K' is the range for a normal D insn.
- `L' is a constant with only the low-order 16 bits set
- `M' is a constant with only the high-order 16 bits set
- `N' is a single-bit constant
- `O' is a constant with either the high-order or low-order 16 bits all ones
- `P' is the complement of a single-bit constant
- */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ( (C) == 'I' ? (unsigned) (VALUE) < 0x10 \
- : (C) == 'J' ? (VALUE) < 0 && (VALUE) > -16 \
- : (C) == 'K' ? (unsigned) ((VALUE) + 0x8000) < 0x10000 \
- : (C) == 'L' ? ((VALUE) & 0xffff0000) == 0 \
- : (C) == 'M' ? ((VALUE) & 0xffff) == 0 \
- : (C) == 'N' ? exact_log2 (VALUE) >= 0 \
- : (C) == 'O' ? ((VALUE) & 0xffff) == 0xffff \
- || ((VALUE) & 0xffff0000) == 0xffff0000 \
- : (C) == 'P' ? exact_log2 (~ (VALUE)) >= 0 \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself.
- No floating-point constants on ROMP. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
-
-/* Optional extra constraints for this machine.
-
- For the ROMP, `Q' means that this is a memory operand but not a symbolic
- memory operand. Note that an unassigned pseudo register is such a
- memory operand. If register allocation has not been done, we reject
- pseudos, since we assume (hope) that they will get hard registers.
-
- `R' means that this is a constant pool reference to the current function.
- This is just r14 and so can be treated as a register. We bother with this
- just in move insns as that is the only place it is likely to occur.
-
- `S' means that this is the address of a constant pool location. This is
- equal to r14 plus a constant. We also only check for this in move insns. */
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' ? \
- ((GET_CODE (OP) == REG \
- && REGNO (OP) >= FIRST_PSEUDO_REGISTER \
- && reg_renumber != 0 \
- && reg_renumber[REGNO (OP)] < 0) \
- || (GET_CODE (OP) == MEM \
- && ! symbolic_memory_operand (OP, VOIDmode))) \
- : (C) == 'R' ? current_function_operand (OP, VOIDmode) \
- : (C) == 'S' ? constant_pool_address_operand (OP, VOIDmode) \
- : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
-
- For the ROMP, if X is a memory reference that involves a symbol,
- we must use a BASE_REGS register instead of GENERAL_REGS
- to do the reload. The argument of MEM be either REG, PLUS, or SYMBOL_REF
- to be valid, so we assume that this is the case.
-
- Also, if X is an integer class, ensure that floating-point registers
- aren't used. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- ((CLASS) == FP_REGS && GET_MODE_CLASS (GET_MODE (X)) == MODE_INT \
- ? GENERAL_REGS : \
- (CLASS) != GENERAL_REGS ? (CLASS) : \
- GET_CODE (X) != MEM ? GENERAL_REGS : \
- GET_CODE (XEXP (X, 0)) == SYMBOL_REF ? BASE_REGS : \
- GET_CODE (XEXP (X, 0)) == LABEL_REF ? BASE_REGS : \
- GET_CODE (XEXP (X, 0)) == CONST ? BASE_REGS : \
- GET_CODE (XEXP (X, 0)) == REG ? GENERAL_REGS : \
- GET_CODE (XEXP (X, 0)) != PLUS ? GENERAL_REGS : \
- GET_CODE (XEXP (XEXP (X, 0), 1)) == SYMBOL_REF ? BASE_REGS : \
- GET_CODE (XEXP (XEXP (X, 0), 1)) == LABEL_REF ? BASE_REGS : \
- GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST ? BASE_REGS : GENERAL_REGS)
-
-/* Return the register class of a scratch register needed to store into
- OUT from a register of class CLASS in MODE.
-
- On the ROMP, we cannot store into a symbolic memory address from an
- integer register; we need a BASE_REGS register as a scratch to do it. */
-
-#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT) \
- (GET_MODE_CLASS (MODE) == MODE_INT && symbolic_memory_operand (OUT, MODE) \
- ? BASE_REGS : NO_REGS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS.
-
- On ROMP, this is the size of MODE in words,
- except in the FP regs, where a single reg is always enough. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FP_REGS ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated.
- On the ROMP, if we set the frame pointer to 15 words below the highest
- address of the highest local variable, the first 16 words will be
- addressable via D-short insns. */
-#define STARTING_FRAME_OFFSET 64
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On ROMP, don't define this because there are no push insns. */
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* Offset of first parameter from the argument pointer register value.
- On the ROMP, we define the argument pointer to the start of the argument
- area. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Define this if stack space is still allocated for a parameter passed
- in a register. The value is the number of bytes. */
-#define REG_PARM_STACK_SPACE(FNDECL) 16
-
-/* This is the difference between the logical top of stack and the actual sp.
-
- For the ROMP, sp points past the words allocated for the first four outgoing
- arguments (they are part of the callee's frame). */
-#define STACK_POINTER_OFFSET -16
-
-/* Define this if the maximum size of all the outgoing args is to be
- accumulated and pushed during the prologue. The amount can be
- found in the variable current_function_outgoing_args_size. */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0.
-
- On ROMP the value is found in r2, unless the machine specific option
- fp-arg-in-fpregs is selected, in which case FP return values are in fr1 */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), \
- (TARGET_FP_REGS && \
- GET_MODE_CLASS (TYPE_MODE (VALTYPE)) == MODE_FLOAT) ? 18 : 2)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 2)
-
-/* The definition of this macro implies that there are cases where
- a scalar value cannot be returned in registers.
-
- For the ROMP, if compatibility with HC is required, anything of
- type DImode is returned in memory. */
-
-#define RETURN_IN_MEMORY(type) \
- (TYPE_MODE (type) == BLKmode \
- || (TARGET_HC_STRUCT_RETURN && TYPE_MODE (type) == DImode))
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller.
-
- On ROMP, r2 is the only register thus used unless fp values are to be
- returned in fp regs, in which case fr1 is also used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 2 || ((N) == 18 && TARGET_FP_REGS))
-
-/* 1 if N is a possible register number for function argument passing.
- On ROMP, these are r2-r5 (and fr1-fr4 if fp regs are used). */
-
-#define FUNCTION_ARG_REGNO_P(N) \
- (((N) <= 5 && (N) >= 2) || (TARGET_FP_REGS && (N) > 17 && (N) < 21))
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the ROMP, this is a structure. The first word is the number of
- words of (integer only if -mfp-arg-in-fpregs is specified) arguments
- scanned so far (including the invisible argument, if any, which holds
- the structure-value-address). The second word hold the corresponding
- value for floating-point arguments, except that both single and double
- count as one register. */
-
-struct rt_cargs {int gregs, fregs; };
-#define CUMULATIVE_ARGS struct rt_cargs
-
-#define USE_FP_REG(MODE,CUM) \
- (TARGET_FP_REGS && GET_MODE_CLASS (MODE) == MODE_FLOAT \
- && (CUM).fregs < 3)
-
-/* Define intermediate macro to compute the size (in registers) of an argument
- for the ROMP. */
-
-#define ROMP_ARG_SIZE(MODE, TYPE, NAMED) \
-(! (NAMED) ? 0 \
- : (MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
- : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On ROMP, the offset normally starts at 0, but starts at 4 bytes
- when the function gets a structure-value-address as an
- invisible first argument. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- (CUM).gregs = 0, \
- (CUM).fregs = 0
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
-{ if (NAMED) \
- { \
- if (USE_FP_REG(MODE, CUM)) \
- (CUM).fregs++; \
- else \
- (CUM).gregs += ROMP_ARG_SIZE (MODE, TYPE, NAMED); \
- } \
-}
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- On ROMP the first four words of args are normally in registers
- and the rest are pushed. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- (! (NAMED) ? 0 \
- : ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST) ? 0 \
- : USE_FP_REG(MODE,CUM) ? gen_rtx(REG, (MODE),(CUM.fregs) + 17) \
- : (CUM).gregs < 4 ? gen_rtx(REG, (MODE), 2 + (CUM).gregs) : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
- (! (NAMED) ? 0 \
- : USE_FP_REG(MODE,CUM) ? 0 \
- : (((CUM).gregs < 4 \
- && 4 < ((CUM).gregs + ROMP_ARG_SIZE (MODE, TYPE, NAMED))) \
- ? 4 - (CUM).gregs : 0))
-
-/* Perform any needed actions needed for a function that is receiving a
- variable number of arguments.
-
- CUM is as above.
-
- MODE and TYPE are the mode and type of the current parameter.
-
- PRETEND_SIZE is a variable that should be set to the amount of stack
- that must be pushed by the prolog to pretend that our caller pushed
- it.
-
- Normally, this macro will push all remaining incoming registers on the
- stack and set PRETEND_SIZE to the length of the registers pushed. */
-
-#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
-{ if (TARGET_FP_REGS) \
- error ("can't have varargs with -mfp-arg-in-fp-regs"); \
- else if ((CUM).gregs < 4) \
- { \
- int first_reg_offset = (CUM).gregs; \
- \
- if (MUST_PASS_IN_STACK (MODE, TYPE)) \
- first_reg_offset += ROMP_ARG_SIZE (TYPE_MODE (TYPE), TYPE, 1); \
- \
- if (first_reg_offset > 4) \
- first_reg_offset = 4; \
- \
- if (! NO_RTL && first_reg_offset != 4) \
- move_block_from_reg \
- (2 + first_reg_offset, \
- gen_rtx (MEM, BLKmode, \
- plus_constant (virtual_incoming_args_rtx, \
- first_reg_offset * 4)), \
- 4 - first_reg_offset, (4 - first_reg_offset) * UNITS_PER_WORD); \
- PRETEND_SIZE = (4 - first_reg_offset) * UNITS_PER_WORD; \
- } \
-}
-
-/* This macro produces the initial definition of a function name.
- On the ROMP, we need to place an extra '.' in the function name. */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
-{ if (TREE_PUBLIC(DECL)) \
- fprintf (FILE, "\t.globl _.%s\n", NAME); \
- fprintf (FILE, "_.%s:\n", NAME); \
-}
-
-/* This macro is used to output the start of the data area.
-
- On the ROMP, the _name is a pointer to the data area. At that
- location is the address of _.name, which is really the name of
- the function. We need to set all this up here.
-
- The global declaration of the data area, if needed, is done in
- `assemble_function', where it thinks it is globalizing the function
- itself. */
-
-#define ASM_OUTPUT_POOL_PROLOGUE(FILE, NAME, DECL, SIZE) \
-{ extern int data_offset; \
- data_section (); \
- fprintf (FILE, "\t.align 2\n"); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
- fprintf (FILE, "\t.long _.%s, 0, ", NAME); \
- if (current_function_calls_alloca) \
- fprintf (FILE, "0x%x\n", \
- 0xf6900000 + current_function_outgoing_args_size); \
- else \
- fprintf (FILE, "0\n"); \
- data_offset = ((SIZE) + 12 + 3) / 4; \
-}
-
-/* Select section for constant in constant pool.
-
- On ROMP, all constants are in the data area. */
-
-#define SELECT_RTX_SECTION(MODE, X) data_section ()
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf(FILE, "\tcas r0,r15,r0\n\tbali r15,mcount\n");
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-/* #define EXIT_IGNORE_STACK 1 */
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- The trampoline should set the static chain pointer to value placed
- into the trampoline and should branch to the specified routine.
-
- On the ROMP, we have a problem. There are no free registers to use
- to construct the static chain and function addresses. Hence we use
- the following kludge: r15 (the return address) is first saved in mq.
- Then we use r15 to form the function address. We then branch to the
- function and restore r15 in the delay slot. This makes it appear that
- the function was called directly from the caller.
-
- (Note that the function address built is actually that of the data block.
- This is passed in r0 and the actual routine address is loaded into r15.)
-
- In addition, note that the address of the "called function", in this case
- the trampoline, is actually the address of the data area. So we need to
- make a fake data area that will contain the address of the trampoline.
- Note that this must be defined as two half-words, since the trampoline
- template (as opposed to the trampoline on the stack) is only half-word
- aligned. */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\t.short 0,0\n"); \
- fprintf (FILE, "\tcau r0,0(r0)\n"); \
- fprintf (FILE, "\toil r0,r0,0\n"); \
- fprintf (FILE, "\tmts r10,r15\n"); \
- fprintf (FILE, "\tst r0,-36(r1)\n"); \
- fprintf (FILE, "\tcau r15,0(r0)\n"); \
- fprintf (FILE, "\toil r15,r15,0\n"); \
- fprintf (FILE, "\tcas r0,r15,r0\n"); \
- fprintf (FILE, "\tls r15,0(r15)\n"); \
- fprintf (FILE, "\tbrx r15\n"); \
- fprintf (FILE, "\tmfs r10,r15\n"); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 36
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function.
-
- On the RT, the static chain and function addresses are written in
- two 16-bit sections.
-
- We also need to write the address of the first instruction in
- the trampoline into the first word of the trampoline to simulate a
- data area. */
-
-#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
-{ \
- rtx _addr, _temp; \
- rtx _val; \
- \
- _temp = expand_binop (SImode, add_optab, ADDR, \
- gen_rtx (CONST_INT, VOIDmode, 4), \
- 0, 1, OPTAB_LIB_WIDEN); \
- emit_move_insn (gen_rtx (MEM, SImode, \
- memory_address (SImode, ADDR)), _temp); \
- \
- _val = force_reg (SImode, CXT); \
- _addr = memory_address (HImode, plus_constant (ADDR, 10)); \
- emit_move_insn (gen_rtx (MEM, HImode, _addr), \
- gen_lowpart (HImode, _val)); \
- _temp = expand_shift (RSHIFT_EXPR, SImode, _val, \
- build_int_2 (16, 0), 0, 1); \
- _addr = memory_address (HImode, plus_constant (ADDR, 6)); \
- emit_move_insn (gen_rtx (MEM, HImode, _addr), \
- gen_lowpart (HImode, _temp)); \
- \
- _val = force_reg (SImode, FNADDR); \
- _addr = memory_address (HImode, plus_constant (ADDR, 24)); \
- emit_move_insn (gen_rtx (MEM, HImode, _addr), \
- gen_lowpart (HImode, _val)); \
- _temp = expand_shift (RSHIFT_EXPR, SImode, _val, \
- build_int_2 (16, 0), 0, 1); \
- _addr = memory_address (HImode, plus_constant (ADDR, 20)); \
- emit_move_insn (gen_rtx (MEM, HImode, _addr), \
- gen_lowpart (HImode, _temp)); \
- \
-}
-
-/* Definitions for register eliminations.
-
- We have two registers that can be eliminated on the ROMP. First, the
- frame pointer register can often be eliminated in favor of the stack
- pointer register. Secondly, the argument pointer register can always be
- eliminated; it is replaced with either the stack or frame pointer.
-
- In addition, we use the elimination mechanism to see if r14 is needed.
- Initially we assume that it isn't. If it is, we spill it. This is done
- by making it an eliminable register. It doesn't matter what we replace
- it with, since it will never occur in the rtl at this point. */
-
-/* This is an array of structures. Each structure initializes one pair
- of eliminable registers. The "from" register number is given first,
- followed by "to". Eliminations of the same "from" register are listed
- in order of preference. */
-#define ELIMINABLE_REGS \
-{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- { 14, 0}}
-
-/* Given FROM and TO register numbers, say whether this elimination is allowed.
- Frame pointer elimination is automatically handled.
-
- For the ROMP, if frame pointer elimination is being done, we would like to
- convert ap into fp, not sp.
-
- We need r14 if various conditions (tested in romp_using_r14) are true.
-
- All other eliminations are valid. */
-#define CAN_ELIMINATE(FROM, TO) \
- ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
- ? ! frame_pointer_needed \
- : (FROM) == 14 ? ! romp_using_r14 () \
- : 1)
-
-/* Define the offset between two registers, one to be eliminated, and the other
- its replacement, at the start of a routine. */
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- { \
- if (romp_pushes_stack ()) \
- (OFFSET) = ((get_frame_size () - 64) \
- + current_function_outgoing_args_size); \
- else \
- (OFFSET) = - (romp_sa_size () + 64); \
- } \
- else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
- (OFFSET) = romp_sa_size () - 16 + 64; \
- else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- { \
- if (romp_pushes_stack ()) \
- (OFFSET) = (get_frame_size () + (romp_sa_size () - 16) \
- + current_function_outgoing_args_size); \
- else \
- (OFFSET) = -16; \
- } \
- else if ((FROM) == 14) \
- (OFFSET) = 0; \
- else \
- abort (); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) 0
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-((REGNO) < FIRST_PSEUDO_REGISTER \
- ? (REGNO) < 16 && (REGNO) != 0 && (REGNO) != 16 \
- : (reg_renumber[REGNO] < 16 && reg_renumber[REGNO] >= 0 \
- && reg_renumber[REGNO] != 16))
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 1
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
-
- On the ROMP, there is a bit of a hack here. Basically, we wish to
- only issue instructions that are not `as' macros. However, in the
- case of `get', `load', and `store', if the operand is a relocatable
- symbol (possibly +/- an integer), there is no way to express the
- resulting split-relocation except with the macro. Therefore, allow
- either a constant valid in a normal (sign-extended) D-format insn or
- a relocatable expression.
-
- Also, for DFmode and DImode, we must ensure that both words are
- addressable.
-
- We define two macros: The first is given an offset (0 or 4) and indicates
- that the operand is a CONST_INT that is valid for that offset. The second
- indicates a valid non-CONST_INT constant. */
-
-#define LEGITIMATE_ADDRESS_INTEGER_P(X,OFFSET) \
- (GET_CODE (X) == CONST_INT \
- && (unsigned) (INTVAL (X) + (OFFSET) + 0x8000) < 0x10000)
-
-#define LEGITIMATE_ADDRESS_CONSTANT_P(X) \
- (GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == LABEL_REF \
- || (GET_CODE (X) == CONST \
- && (GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF \
- || GET_CODE (XEXP (XEXP (X, 0), 0)) == LABEL_REF) \
- && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT))
-
-/* Include all constant integers and constant double, but exclude
- SYMBOL_REFs that are to be obtained from the data area (see below). */
-#define LEGITIMATE_CONSTANT_P(X) \
- ((LEGITIMATE_ADDRESS_CONSTANT_P (X) \
- || GET_CODE (X) == CONST_INT \
- || GET_CODE (X) == CONST_DOUBLE) \
- && ! (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)))
-
-/* For no good reason, we do the same as the other RT compilers and load
- the addresses of data areas for a function from our data area. That means
- that we need to mark such SYMBOL_REFs. We do so here. */
-#define ENCODE_SECTION_INFO(DECL) \
- if (TREE_CODE (TREE_TYPE (DECL)) == FUNCTION_TYPE) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) 0
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- (REGNO (X) != 0 && (REGNO (X) < 17 || REGNO (X) >= FIRST_PSEUDO_REGISTER))
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On the ROMP, a legitimate address is either a legitimate constant,
- a register plus a legitimate constant, or a register. See the
- discussion at the LEGITIMATE_ADDRESS_CONSTANT_P macro. */
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- goto ADDR; \
- if (GET_CODE (X) != CONST_INT && LEGITIMATE_ADDRESS_CONSTANT_P (X)) \
- goto ADDR; \
- if (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && LEGITIMATE_ADDRESS_CONSTANT_P (XEXP (X, 1))) \
- goto ADDR; \
- if (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 0) \
- && (((MODE) != DFmode && (MODE) != DImode) \
- || (LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 4)))) \
- goto ADDR; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- On ROMP, check for the sum of a register with a constant
- integer that is out of range. If so, generate code to add the
- constant with the low-order 16 bits masked to the register and force
- this result into another register (this can be done with `cau').
- Then generate an address of REG+(CONST&0xffff), allowing for the
- possibility of bit 16 being a one.
-
- If the register is not OK for a base register, abort. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (unsigned) (INTVAL (XEXP (X, 1)) + 0x8000) >= 0x10000) \
- { int high_int, low_int; \
- if (! REG_OK_FOR_BASE_P (XEXP (X, 0))) \
- abort (); \
- high_int = INTVAL (XEXP (X, 1)) >> 16; \
- low_int = INTVAL (XEXP (X, 1)) & 0xffff; \
- if (low_int & 0x8000) \
- high_int += 1, low_int |= 0xffff0000; \
- (X) = gen_rtx (PLUS, SImode, \
- force_operand \
- (gen_rtx (PLUS, SImode, XEXP (X, 0), \
- gen_rtx (CONST_INT, VOIDmode, \
- high_int << 16)), 0),\
- gen_rtx (CONST_INT, VOIDmode, low_int)); \
- } \
-}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
-
- On the ROMP this is true only if the address is valid with a zero offset
- but not with an offset of four (this means it cannot be used as an
- address for DImode or DFmode). Since we know it is valid, we just check
- for an address that is not valid with an offset of four. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
-{ if (GET_CODE (ADDR) == PLUS \
- && ! LEGITIMATE_ADDRESS_CONSTANT_P (XEXP (ADDR, 1)) \
- && ! LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 4)) \
- goto LABEL; \
-}
-
-/* Define this if some processing needs to be done immediately before
- emitting code for an insn.
-
- This is used on the ROMP, to compensate for a bug in the floating-point
- code. When a floating-point operation is done with the first and third
- operands both the same floating-point register, it will generate bad code
- for the MC68881. So we must detect this. If it occurs, we patch the
- first operand to be fr0 and insert a move insn to move it to the desired
- destination. */
-#define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) \
- { rtx op0, op1, op2, operation, tem; \
- if (NOPERANDS >= 3 && get_attr_type (INSN) == TYPE_FP) \
- { \
- op0 = OPERANDS[0]; \
- operation = OPERANDS[1]; \
- if (float_conversion (operation, VOIDmode)) \
- operation = XEXP (operation, 0); \
- if (float_binary (operation, VOIDmode)) \
- { \
- op1 = XEXP (operation, 0), op2 = XEXP (operation, 1); \
- if (float_conversion (op1, VOIDmode)) \
- op1 = XEXP (op1, 0); \
- if (float_conversion (op2, VOIDmode)) \
- op2 = XEXP (op2, 0); \
- if (rtx_equal_p (op0, op2) \
- && (GET_CODE (operation) == PLUS \
- || GET_CODE (operation) == MULT)) \
- tem = op1, op1 = op2, op2 = tem; \
- if (GET_CODE (op0) == REG && FP_REGNO_P (REGNO (op0)) \
- && GET_CODE (op2) == REG && FP_REGNO_P (REGNO (op2)) \
- && REGNO (op0) == REGNO (op2)) \
- { \
- tem = gen_rtx (REG, GET_MODE (op0), 17); \
- emit_insn_after (gen_move_insn (op0, tem), INSN); \
- SET_DEST (XVECEXP (PATTERN (INSN), 0, 0)) = tem; \
- OPERANDS[0] = tem; \
- } \
- } \
- } \
- }
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 0
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one.
-
- We actually lie a bit here as overflow conditions are different. But
- they aren't being checked anyway. */
-
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Nonzero if access to memory by bytes is no faster than for words.
- Also non-zero if doing byte operations (specifically shifts) in registers
- is undesirable. */
-#define SLOW_BYTE_ACCESS 1
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-
-/* This is BSD, so it wants DBX format. */
-#define DBX_DEBUGGING_INFO
-
-/* Define the letter code used in a stabs entry for parameters passed
- with the register attribute.
-
- GCC's default value, 'P', is used by dbx to refers to an external
- procedure. The section 5 manual page for dbx implies that 'R' would be the
- right letter, but dbx 1.5 has a bug in it that precludes its use.
- Probably that is why neither hc or pcc use this. pcc puts in two
- stabs entries: one for the parameter location and one for the register
- location. The letter `r' (register)
- would be okay, but it loses parameter attribute of the stabs entry. */
-#define DBX_REGPARM_STABS_LETTER 'R'
-
-/* A C expression for the integer offset value of an automatic variable
- (N_LSYM) having address X (an RTX). This gets used in .stabs entries
- for the local variables. Compare with the default definition. */
-extern int romp_debugger_auto_correction();
-#define DEBUGGER_AUTO_OFFSET(X) \
- (GET_CODE (X) == PLUS \
- ? romp_debugger_auto_correction (INTVAL (XEXP (X, 1)) ) \
- : 0 )
-
-/* A C expression for the integer offset value of an argument (N_PSYM)
- having address X (an RTX). The nominal offset is OFFSET. */
-extern int romp_debugger_arg_correction();
-#define DEBUGGER_ARG_OFFSET(OFFSET, X) \
- romp_debugger_arg_correction (OFFSET);
-
-/* We don't have GAS for the RT yet, so don't write out special
- .stabs in cc1plus. */
-
-#define FASCIST_ASSEMBLER
-
-/* Do not break .stabs pseudos into continuations. */
-#define DBX_CONTIN_LENGTH 0
-
-/* Don't try to use the `x' type-cross-reference character in DBX data.
- Also has the consequence of putting each struct, union or enum
- into a separate .stabs, containing only cross-refs to the others. */
-#define DBX_NO_XREFS
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* Mode of a function address in a call instruction (for indexing purposes).
-
- Doesn't matter on ROMP. */
-#define FUNCTION_MODE SImode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-#define NO_FUNCTION_CSE
-
-/* Define this if shift instructions ignore all but the low-order
- few bits.
-
- This is not true on the RT since it uses the low-order 6, not 5, bits.
- At some point, this should be extended to see how to express that. */
-
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Compute the cost of computing a constant rtl expression RTX whose
- rtx-code is CODE, contained within an expression of code OUTER_CODE.
- The body of this macro is a portion of a switch statement. If the
- code is computed here, return it with a return statement. Otherwise,
- break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if ((OUTER_CODE) == IOR && exact_log2 (INTVAL (RTX)) >= 0 \
- || (OUTER_CODE) == AND && exact_log2 (~INTVAL (RTX)) >= 0 \
- || (((OUTER_CODE) == PLUS || (OUTER_CODE) == MINUS) \
- && (unsigned int) (INTVAL (RTX) + 15) < 31) \
- || ((OUTER_CODE) == SET && (unsigned int) INTVAL (RTX) < 16))\
- return 0; \
- return ((unsigned int) (INTVAL(RTX) + 0x8000) < 0x10000 \
- || (INTVAL (RTX) & 0xffff0000) == 0) ? 0 : COSTS_N_INSNS (2);\
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- if (current_function_operand (RTX, Pmode)) return 0; \
- return COSTS_N_INSNS (2); \
- case CONST_DOUBLE: \
- if ((RTX) == CONST0_RTX (GET_MODE (RTX))) return 2; \
- return ((GET_MODE_CLASS (GET_MODE (RTX)) == MODE_FLOAT) \
- ? COSTS_N_INSNS (5) : COSTS_N_INSNS (4));
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE.
-
- References to our own data area are really references to r14, so they
- are very cheap. Multiples and divides are very expensive. */
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MEM: \
- return current_function_operand (X, Pmode) ? 0 : COSTS_N_INSNS (2); \
- case MULT: \
- return (TARGET_IN_LINE_MUL && GET_MODE_CLASS (GET_MODE (X)) == MODE_INT)\
- ? COSTS_N_INSNS (19) : COSTS_N_INSNS (25); \
- case DIV: \
- case UDIV: \
- case MOD: \
- case UMOD: \
- return COSTS_N_INSNS (45);
-
-/* Compute the cost of an address. This is meant to approximate the size
- and/or execution delay of an insn using that address. If the cost is
- approximated by the RTL complexity, including CONST_COSTS above, as
- is usually the case for CISC machines, this macro should not be defined.
- For aggressively RISCy machines, only one insn format is allowed, so
- this macro should be a constant. The value of this macro only matters
- for valid addresses.
-
- For the ROMP, everything is cost 0 except for addresses involving
- symbolic constants, which are cost 1. */
-
-#define ADDRESS_COST(RTX) \
- ((GET_CODE (RTX) == SYMBOL_REF \
- && ! CONSTANT_POOL_ADDRESS_P (RTX)) \
- || GET_CODE (RTX) == LABEL_REF \
- || (GET_CODE (RTX) == CONST \
- && ! constant_pool_address_operand (RTX, Pmode)) \
- || (GET_CODE (RTX) == PLUS \
- && ((GET_CODE (XEXP (RTX, 1)) == SYMBOL_REF \
- && ! CONSTANT_POOL_ADDRESS_P (XEXP (RTX, 0))) \
- || GET_CODE (XEXP (RTX, 1)) == LABEL_REF \
- || GET_CODE (XEXP (RTX, 1)) == CONST)))
-
-/* Adjust the length of an INSN. LENGTH is the currently-computed length and
- should be adjusted to reflect any required changes. This macro is used when
- there is some systematic length adjustment required that would be difficult
- to express in the length attribute.
-
- On the ROMP, there are two adjustments: First, a 2-byte insn in the delay
- slot of a CALL (including floating-point operations) actually takes four
- bytes. Second, we have to make the worst-case alignment assumption for
- address vectors. */
-
-#define ADJUST_INSN_LENGTH(X,LENGTH) \
- if (GET_CODE (X) == INSN && GET_CODE (PATTERN (X)) == SEQUENCE \
- && GET_CODE (XVECEXP (PATTERN (X), 0, 0)) != JUMP_INSN \
- && get_attr_length (XVECEXP (PATTERN (X), 0, 1)) == 2) \
- (LENGTH) += 2; \
- else if (GET_CODE (X) == JUMP_INSN && GET_CODE (PATTERN (X)) == ADDR_VEC) \
- (LENGTH) += 2;
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-/* Set if condition code (really not-Z) is stored in `test bit'. */
-#define CC_IN_TB 01000
-
-/* Set if condition code is set by an unsigned compare. */
-#define CC_UNSIGNED 02000
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(BODY,INSN) \
- update_cc (BODY, INSN)
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) \
-{ extern char *version_string; \
- char *p; \
- \
- fprintf (FILE, "\t.globl .oVncs\n\t.set .oVncs,0\n") ; \
- fprintf (FILE, "\t.globl .oVgcc"); \
- for (p = version_string; *p != ' ' && *p != 0; p++) \
- fprintf (FILE, "%c", *p); \
- fprintf (FILE, "\n\t.set .oVgcc"); \
- for (p = version_string; *p != ' ' && *p != 0; p++) \
- fprintf (FILE, "%c", *p); \
- fprintf (FILE, ",0\n"); \
-}
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* Output before instructions and read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \
- "r10", "r11", "r12", "r13", "r14", "r15", "ap", \
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7" }
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs ("\t.globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to output a label for a jump table. Arguments are the same as
- for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
- passed. */
-
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
-{ ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining a `float' constant.
-
- WARNING: Believe it or not, the ROMP assembler has a bug in its
- handling of single-precision floating-point values making it impossible
- to output such values in the expected way. Therefore, it must be output
- in hex. THIS WILL NOT WORK IF CROSS-COMPILING FROM A MACHINE THAT DOES
- NOT USE IEEE-FORMAT FLOATING-POINT, but there is nothing that can be done
- about it short of fixing the assembler. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { union { int i; float f; } u_i_f; \
- u_i_f.f = (VALUE); \
- fprintf (FILE, "\t.long 0x%x\n", u_i_f.i);\
- } while (0)
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.short "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output code to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tsis r1,4\n\tsts %s,0(r1)\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tls r1,0(r1)\n\tais r1,4\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.long L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative.
- Don't define this if it is not supported. */
-
-/* #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) */
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", (LOG))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-/* Define which CODE values are valid. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '.' || (CODE) == '#')
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx addr = ADDR; \
- register rtx base = 0, offset = addr; \
- if (GET_CODE (addr) == REG) \
- base = addr, offset = const0_rtx; \
- else if (GET_CODE (addr) == PLUS \
- && GET_CODE (XEXP (addr, 0)) == REG) \
- base = XEXP (addr, 0), offset = XEXP (addr, 1); \
- else if (GET_CODE (addr) == SYMBOL_REF \
- && CONSTANT_POOL_ADDRESS_P (addr)) \
- { \
- offset = gen_rtx (CONST_INT, VOIDmode, get_pool_offset (addr) + 12); \
- base = gen_rtx (REG, SImode, 14); \
- } \
- else if (GET_CODE (addr) == CONST \
- && GET_CODE (XEXP (addr, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST_INT \
- && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF \
- && CONSTANT_POOL_ADDRESS_P (XEXP (XEXP (addr, 0), 0))) \
- { \
- offset = plus_constant (XEXP (XEXP (addr, 0), 1), \
- (get_pool_offset (XEXP (XEXP (addr, 0), 0)) \
- + 12)); \
- base = gen_rtx (REG, SImode, 14); \
- } \
- output_addr_const (FILE, offset); \
- if (base) \
- fprintf (FILE, "(%s)", reg_names [REGNO (base)]); \
-}
-
-/* Define the codes that are matched by predicates in aux-output.c. */
-
-#define PREDICATE_CODES \
- {"zero_memory_operand", {SUBREG, MEM}}, \
- {"short_memory_operand", {SUBREG, MEM}}, \
- {"symbolic_memory_operand", {SUBREG, MEM}}, \
- {"current_function_operand", {MEM}}, \
- {"constant_pool_address_operand", {SUBREG, CONST}}, \
- {"romp_symbolic_operand", {LABEL_REF, SYMBOL_REF, CONST}}, \
- {"constant_operand", {LABEL_REF, SYMBOL_REF, PLUS, CONST, CONST_INT}}, \
- {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_any_cint_operand", {SUBREG, REG, CONST_INT}}, \
- {"short_cint_operand", {CONST_INT}}, \
- {"reg_or_D_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_add_operand", {SUBREG, REG, LABEL_REF, SYMBOL_REF, \
- PLUS, CONST, CONST_INT}}, \
- {"reg_or_and_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_mem_operand", {SUBREG, REG, MEM}}, \
- {"reg_or_nonsymb_mem_operand", {SUBREG, REG, MEM}}, \
- {"romp_operand", {SUBREG, MEM, REG, CONST_INT, CONST, LABEL_REF, \
- SYMBOL_REF, CONST_DOUBLE}}, \
- {"reg_0_operand", {REG}}, \
- {"reg_15_operand", {REG}}, \
- {"float_binary", {PLUS, MINUS, MULT, DIV}}, \
- {"float_unary", {NEG, ABS}}, \
- {"float_conversion", {FLOAT_TRUNCATE, FLOAT_EXTEND, FLOAT, FIX}},
-
-/* Define functions defined in aux-output.c and used in templates. */
-
-extern char *output_in_line_mul ();
-extern char *output_fpop ();
diff --git a/gcc/config/romp/romp.md b/gcc/config/romp/romp.md
deleted file mode 100644
index 2177c191065..00000000000
--- a/gcc/config/romp/romp.md
+++ /dev/null
@@ -1,2778 +0,0 @@
-;;- Machine description for ROMP chip for GNU C compiler
-;; Copyright (C) 1988, 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
-;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-;; 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.
-
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; Define the attributes for the ROMP.
-
-;; Insn type. Used to default other attribute values.
-
-(define_attr "type"
- "branch,ibranch,return,fp,load,loadz,store,call,address,arith,compare,multi,misc"
- (const_string "arith"))
-
-;; Length in bytes.
-
-(define_attr "length" ""
- (cond [(eq_attr "type" "branch")
- (if_then_else (and (ge (minus (pc) (match_dup 0))
- (const_int -256))
- (le (minus (pc) (match_dup 0))
- (const_int 254)))
- (const_int 2)
- (const_int 4))
- (eq_attr "type" "return,ibranch") (const_int 2)
- (eq_attr "type" "fp") (const_int 10)
- (eq_attr "type" "call") (const_int 4)
- (eq_attr "type" "load")
- (cond [(match_operand 1 "short_memory_operand" "") (const_int 2)
- (match_operand 1 "symbolic_memory_operand" "") (const_int 8)]
- (const_int 4))
- (eq_attr "type" "loadz")
- (cond [(match_operand 1 "zero_memory_operand" "") (const_int 2)
- (match_operand 1 "symbolic_memory_operand" "") (const_int 8)]
- (const_string "4"))
- (eq_attr "type" "store")
- (cond [(match_operand 0 "short_memory_operand" "") (const_int 2)
- (match_operand 0 "symbolic_memory_operand" "") (const_int 8)]
- (const_int 4))]
- (const_int 4)))
-
-;; Whether insn can be placed in a delay slot.
-
-(define_attr "in_delay_slot" "yes,no"
- (cond [(eq_attr "length" "8,10,38") (const_string "no")
- (eq_attr "type" "branch,ibranch,return,call,multi")
- (const_string "no")]
- (const_string "yes")))
-
-;; Whether insn needs a delay slot. We have to say that two-byte
-;; branches do not need a delay slot. Otherwise, branch shortening will
-;; try to do something with delay slot insns (we want it to on the PA).
-;; This is a kludge, which should be cleaned up at some point.
-
-(define_attr "needs_delay_slot" "yes,no"
- (if_then_else (ior (and (eq_attr "type" "branch")
- (eq_attr "length" "4"))
- (eq_attr "type" "ibranch,return,call"))
- (const_string "yes") (const_string "no")))
-
-;; What insn does to the condition code.
-
-(define_attr "cc"
- "clobber,none,sets,change0,copy1to0,compare,tbit"
- (cond [(eq_attr "type" "load,loadz") (const_string "change0")
- (eq_attr "type" "store") (const_string "none")
- (eq_attr "type" "fp,call") (const_string "clobber")
- (eq_attr "type" "branch,ibranch,return") (const_string "none")
- (eq_attr "type" "address") (const_string "change0")
- (eq_attr "type" "compare") (const_string "compare")
- (eq_attr "type" "arith") (const_string "sets")]
- (const_string "clobber")))
-
-;; Define attributes for `asm' insns.
-
-(define_asm_attributes [(set_attr "type" "misc")
- (set_attr "length" "8")
- (set_attr "in_delay_slot" "no")
- (set_attr "cc" "clobber")])
-
-;; Define the delay slot requirements for branches and calls. We don't have
-;; any annulled insns.
-;;
-(define_delay (eq_attr "needs_delay_slot" "yes")
- [(eq_attr "in_delay_slot" "yes") (nil) (nil)])
-
-;; We cannot give a floating-point comparison a delay slot, even though it
-;; could make use of it. This is because it would confuse next_cc0_user
-;; to do so. Other fp insns can't get a delay slow because they set their
-;; result and use their input after the delay slot insn is executed. This
-;; isn't what reorg.c expects.
-
-;; Define load & store delays. These were obtained by measurements done by
-;; jfc@athena.mit.edu.
-;;
-;; In general, the memory unit can support at most two simultaneous operations.
-;;
-;; Loads take 5 cycles to return the data and can be pipelined up to the
-;; limit of two simultaneous operations.
-(define_function_unit "memory" 1 2 (eq_attr "type" "load,loadz") 5 0)
-
-;; Stores do not return data, but tie up the memory unit for 2 cycles if the
-;; next insn is also a store.
-(define_function_unit "memory" 1 2 (eq_attr "type" "store") 1 2
- [(eq_attr "type" "store")])
-
-;; Move word instructions.
-;;
-;; If destination is memory but source is not register, force source to
-;; register.
-;;
-;; If source is a constant that is too large to load in a single insn, build
-;; it in two pieces.
-;;
-;; If destination is memory and source is a register, a temporary register
-;; will be needed. In that case, make a PARALLEL of the SET and a
-;; CLOBBER of a SCRATCH to allocate the required temporary.
-;;
-;; This temporary is ACTUALLY only needed when the destination is a
-;; relocatable expression. For generating RTL, however, we always
-;; place the CLOBBER. In insns where it is not needed, the SCRATCH will
-;; not be allocated to a register.
-;;
-;; Also, avoid creating pseudo-registers or SCRATCH rtx's during reload as
-;; they will not be correctly handled. We never need pseudos for that
-;; case anyway.
-;;
-;; We do not use DEFINE_SPLIT for loading constants because the number
-;; of cases in the resulting unsplit insn would be too high to deal
-;; with practically.
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{ rtx op0 = operands[0];
- rtx op1 = operands[1];
-
- if (GET_CODE (op1) == REG && REGNO (op1) == 16)
- DONE;
-
- if (GET_CODE (op0) == REG && REGNO (op0) == 16)
- DONE;
-
- if (GET_CODE (op0) == MEM && ! reload_in_progress)
- {
- emit_insn (gen_storesi (operands[0], force_reg (SImode, operands[1])));
- DONE;
- }
- else if (GET_CODE (op1) == CONST_INT)
- {
- int const_val = INTVAL (op1);
-
- /* Try a number of cases to see how to best load the constant. */
- if ((const_val & 0xffff) == 0
- || (const_val & 0xffff0000) == 0
- || (unsigned) (const_val + 0x8000) < 0x10000)
- /* Can do this in one insn, so generate it. */
- ;
- else if (((- const_val) & 0xffff) == 0
- || ((- const_val) & 0xffff0000) == 0
- || (unsigned) ((- const_val) + 0x8000) < 0x10000)
- {
- /* Can do this by loading the negative constant and then negating. */
- emit_move_insn (operands[0],
- gen_rtx (CONST_INT, VOIDmode, - const_val));
- emit_insn (gen_negsi2 (operands[0], operands[0]));
- DONE;
- }
- else
- /* Do this the long way. */
- {
- unsigned int high_part = const_val & 0xffff0000;
- unsigned int low_part = const_val & 0xffff;
- int i;
-
- if (low_part >= 0x10 && exact_log2 (low_part) >= 0)
- i = high_part, high_part = low_part, low_part = i;
-
- emit_move_insn (operands[0],
- gen_rtx (CONST_INT, VOIDmode, low_part));
- emit_insn (gen_iorsi3 (operands[0], operands[0],
- gen_rtx (CONST_INT, VOIDmode, high_part)));
- DONE;
- }
- }
-}")
-
-;; Move from a symbolic memory location to a register is special. In this
-;; case, we know in advance that the register cannot be r0, so we can improve
-;; register allocation by treating it separately.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=b")
- (match_operand:SI 1 "symbolic_memory_operand" "m"))]
- ""
- "load %0,%1"
- [(set_attr "type" "load")])
-
-;; Generic single-word move insn. We avoid the case where the destination is
-;; a symbolic address, as that needs a temporary register.
-
-(define_insn ""
- [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,r,r,r,b,Q")
- (match_operand:SI 1 "romp_operand" "rR,I,K,L,M,S,s,Q,m,r"))]
- "register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)"
- "@
- cas %0,%1,r0
- lis %0,%1
- cal %0,%1(r0)
- cal16 %0,%1(r0)
- cau %0,%H1(r0)
- ail %0,r14,%C1
- get %0,$%1
- l%M1 %0,%1
- load %0,%1
- st%M0 %1,%0"
- [(set_attr "type" "address,address,address,address,address,arith,misc,load,load,store")
- (set_attr "length" "2,2,4,4,4,4,8,*,*,*")])
-
-(define_insn "storesi"
- [(set (match_operand:SI 0 "memory_operand" "=Q,m")
- (match_operand:SI 1 "register_operand" "r,r"))
- (clobber (match_scratch:SI 2 "=X,&b"))]
- ""
- "@
- st%M0 %1,%0
- store %1,%0,%2"
- [(set_attr "type" "store")])
-
-;; This pattern is used by reload when we store into a symbolic address. It
-;; provides the temporary register required. This pattern is only used
-;; when SECONDARY_OUTPUT_RELOAD_CLASS returns something other than
-;; NO_REGS, so we need not have any predicates here.
-
-(define_expand "reload_outsi"
- [(parallel [(set (match_operand:SI 0 "symbolic_memory_operand" "=m")
- (match_operand:SI 1 "" "r"))
- (clobber (match_operand:SI 2 "" "=&b"))])]
- ""
- "")
-
-;; Now do the same for the QI move instructions.
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{ rtx op0 = operands[0];
-
- if (GET_CODE (op0) == MEM && ! reload_in_progress)
- {
- emit_insn (gen_storeqi (operands[0], force_reg (QImode, operands[1])));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "register_operand" "=b")
- (match_operand:QI 1 "symbolic_memory_operand" "m"))]
- ""
- "loadc %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:QI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,b,Q")
- (match_operand:QI 1 "romp_operand" "r,I,n,s,Q,m,r"))]
- "register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode)"
- "@
- cas %0,%1,r0
- lis %0,%1
- cal %0,%L1(r0)
- get %0,$%1
- lc%M1 %0,%1
- loadc %0,%1
- stc%M0 %1,%0"
- [(set_attr "type" "address,address,address,misc,load,load,store")
- (set_attr "length" "2,2,4,8,*,*,*")])
-
-(define_insn "storeqi"
- [(set (match_operand:QI 0 "memory_operand" "=Q,m")
- (match_operand:QI 1 "register_operand" "r,r"))
- (clobber (match_scratch:SI 2 "=X,&b"))]
- ""
- "@
- stc%M0 %1,%0
- storec %1,%0,%2"
- [(set_attr "type" "store")])
-
-(define_expand "reload_outqi"
- [(parallel [(set (match_operand:QI 0 "symbolic_memory_operand" "=m")
- (match_operand:QI 1 "" "r"))
- (clobber (match_operand:SI 2 "" "=&b"))])]
- ""
- "")
-
-;; Finally, the HI instructions.
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{ rtx op0 = operands[0];
-
- if (GET_CODE (op0) == MEM && ! reload_in_progress)
- {
- emit_insn (gen_storehi (operands[0], force_reg (HImode, operands[1])));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=b")
- (match_operand:HI 1 "symbolic_memory_operand" "m"))]
- ""
- "loadha %0,%1"
- [(set_attr "type" "load")])
-
-
-;; use cal16 instead of cal for constant source because combine requires
-;; the high bits of the register to be 0 after a HImode load of a constant
-
-(define_insn ""
- [(set (match_operand:HI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,b,Q")
- (match_operand:HI 1 "romp_operand" "r,I,n,s,Q,m,r"))]
- "register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode)"
- "@
- cas %0,%1,r0
- lis %0,%1
- cal16 %0,%L1(r0)
- get %0,$%1
- lh%N1 %0,%1
- loadh %0,%1
- sth%M0 %1,%0"
- [(set_attr "type" "address,address,address,misc,loadz,loadz,store")
- (set_attr "length" "2,2,4,8,*,*,*")])
-
-(define_insn "storehi"
- [(set (match_operand:HI 0 "memory_operand" "=Q,m")
- (match_operand:HI 1 "register_operand" "r,r"))
- (clobber (match_scratch:SI 2 "=X,&b"))]
- ""
- "@
- sth%M0 %1,%0
- storeh %1,%0,%2"
- [(set_attr "type" "store")])
-
-(define_expand "reload_outhi"
- [(parallel [(set (match_operand:HI 0 "symbolic_memory_operand" "=m")
- (match_operand:HI 1 "" "r"))
- (clobber (match_operand:SI 2 "" "=&b"))])]
- ""
- "")
-
-;; For DI move, if we have a constant, break the operation apart into
-;; two SImode moves because the optimizer may be able to do a better job
-;; with the resulting code.
-;;
-;; For memory stores, make the required pseudo for a temporary in case we
-;; are storing into an absolute address.
-;;
-;; We need to be careful about the cases where the output is a register that is
-;; the second register of the input.
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{ rtx op0 = operands[0];
- rtx op1 = operands[1];
-
- if (CONSTANT_P (op1))
- {
- rtx insns;
-
- start_sequence ();
- emit_move_insn (operand_subword (op0, 0, 1, DImode),
- operand_subword (op1, 0, 1, DImode));
- emit_move_insn (operand_subword (op0, 1, 1, DImode),
- operand_subword (op1, 1, 1, DImode));
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, op0, op1, 0, op1);
- DONE;
- }
-
- if (GET_CODE (op0) == MEM && ! reload_in_progress)
- {
- emit_insn (gen_storedi (operands[0], force_reg (DImode, operands[1])));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,Q")
- (match_operand:DI 1 "reg_or_mem_operand" "r,Q,m,r"))]
- "register_operand (operands[0], DImode)
- || register_operand (operands[1], DImode)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
- return \"cas %O0,%O1,r0\;cas %0,%1,r0\";
- else
- return \"cas %0,%1,r0\;cas %O0,%O1,r0\";
- case 1:
- /* Here we must see which word to load first. We default to the
- low-order word unless it occurs in the address. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands[1], 0))
- return \"l%M1 %O0,%O1\;l%M1 %0,%1\";
- else
- return \"l%M1 %0,%1\;l%M1 %O0,%O1\";
- case 2:
- return \"get %O0,$%1\;ls %0,0(%O0)\;ls %O0,4(%O0)\";
- case 3:
- return \"st%M0 %1,%0\;st%M0 %O1,%O0\";
- }
-}"
- [(set_attr "type" "multi")
- (set_attr "cc" "change0,change0,change0,none")
- (set_attr "length" "4,12,8,8")])
-
-(define_insn "storedi"
- [(set (match_operand:DI 0 "memory_operand" "=Q,m")
- (match_operand:DI 1 "register_operand" "r,r"))
- (clobber (match_scratch:SI 2 "=X,&b"))]
- ""
- "@
- st%M0 %1,%0\;st%M0 %O1,%O0
- get %2,$%0\;sts %1,0(%2)\;sts %O1,4(%2)"
- [(set_attr "type" "multi,multi")
- (set_attr "cc" "none,none")
- (set_attr "length" "8,12")])
-
-(define_expand "reload_outdi"
- [(parallel [(set (match_operand:DI 0 "symbolic_memory_operand" "=m")
- (match_operand:DI 1 "" "r"))
- (clobber (match_operand:SI 2 "" "=&b"))])]
- ""
- "")
-
-;; Split symbolic memory operands differently. We first load the address
-;; into a register and then do the two loads or stores. We can only do
-;; this if operand_subword won't produce a SUBREG, which is only when
-;; operands[0] is a hard register. Thus, these won't be used during the
-;; first insn scheduling pass.
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (match_operand:DI 1 "symbolic_memory_operand" ""))]
- "GET_CODE (operands[0]) == REG
- && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))
- (set (match_dup 6) (match_dup 7))]
- "
-{ operands[2] = operand_subword (operands[0], 1, 0, DImode);
- operands[3] = XEXP (operands[1], 0);
- operands[4] = operand_subword (operands[0], 0, 0, DImode);
- operands[5] = gen_rtx (MEM, SImode, operands[2]);
- operands[6] = operands[2];
- operands[7] = gen_rtx (MEM, SImode,
- gen_rtx (PLUS, SImode, operands[2],
- gen_rtx (CONST_INT, VOIDmode, 4)));
-
- if (operands[2] == 0 || operands[4] == 0)
- FAIL;
-}")
-
-(define_split
- [(set (match_operand:DI 0 "symbolic_memory_operand" "")
- (match_operand:DI 1 "register_operand" ""))
- (clobber (match_operand:SI 2 "register_operand" ""))]
- "GET_CODE (operands[0]) == REG
- && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))
- (set (match_dup 6) (match_dup 7))]
- "
-{ operands[3] = XEXP (operands[0], 0);
- operands[4] = gen_rtx (MEM, SImode, operands[2]);
- operands[5] = operand_subword (operands[1], 0, 0, DImode);
- operands[6] = gen_rtx (MEM, SImode,
- gen_rtx (PLUS, SImode, operands[2],
- gen_rtx (CONST_INT, VOIDmode, 4)));
- operands[7] = operand_subword (operands[1], 1, 0, DImode);
-
- if (operands[5] == 0 || operands[7] == 0)
- FAIL;
-}")
-
-;; If the output is a register and the input is memory, we have to be careful
-;; and see which word needs to be loaded first.
-;;
-;; Note that this case doesn't have a CLOBBER. Therefore, we must either
-;; be after reload or operand[0] must not be a MEM. So we don't need a
-;; CLOBBER on the new insns either.
-;;
-;; Due to a bug in sched.c, we do not want to split this insn if both
-;; operands are registers and they overlap unless reload has completed.
-(define_split
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- "! symbolic_memory_operand (operands[0], DImode)
- && ! symbolic_memory_operand (operands[1], DImode)
- && ! (GET_CODE (operands[0]) == REG
- && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
- && ! (GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
- && ! (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
- && ! reload_completed
- && reg_overlap_mentioned_p (operands[0], operands[1]))"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))]
- "
-{ if (GET_CODE (operands[0]) != REG
- || ! refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands[1], 0))
- {
- operands[2] = operand_subword (operands[0], 0, 0, DImode);
- operands[3] = operand_subword (operands[1], 0, 0, DImode);
- operands[4] = operand_subword (operands[0], 1, 0, DImode);
- operands[5] = operand_subword (operands[1], 1, 0, DImode);
- }
- else
- {
- operands[2] = operand_subword (operands[0], 1, 0, DImode);
- operands[3] = operand_subword (operands[1], 1, 0, DImode);
- operands[4] = operand_subword (operands[0], 0, 0, DImode);
- operands[5] = operand_subword (operands[1], 0, 0, DImode);
- }
-
- if (operands[2] == 0 || operands[3] == 0
- || operands[4] == 0 || operands[5] == 0)
- FAIL;
-}")
-
-(define_split
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "general_operand" ""))
- (clobber (match_operand:SI 6 "register_operand" ""))]
- "! symbolic_memory_operand (operands[0], DImode)
- && ! symbolic_memory_operand (operands[1], DImode)
- && ! (GET_CODE (operands[0]) == REG
- && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
- && ! (GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
- && ! (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
- && ! reload_completed
- && reg_overlap_mentioned_p (operands[0], operands[1]))"
- [(parallel [(set (match_dup 2) (match_dup 3))
- (clobber (match_dup 7))])
- (parallel [(set (match_dup 4) (match_dup 5))
- (clobber (match_dup 8))])]
- "
-{ if (GET_CODE (operands[0]) != REG
- || ! refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands[1], 0))
- {
- operands[2] = operand_subword (operands[0], 0, 0, DImode);
- operands[3] = operand_subword (operands[1], 0, 0, DImode);
- operands[4] = operand_subword (operands[0], 1, 0, DImode);
- operands[5] = operand_subword (operands[1], 1, 0, DImode);
- }
- else
- {
- operands[2] = operand_subword (operands[0], 1, 0, DImode);
- operands[3] = operand_subword (operands[1], 1, 0, DImode);
- operands[4] = operand_subword (operands[0], 0, 0, DImode);
- operands[5] = operand_subword (operands[1], 0, 0, DImode);
- }
-
- if (operands[2] == 0 || operands[3] == 0
- || operands[4] == 0 || operands[5] == 0)
- FAIL;
-
- /* We must be sure to make two different SCRATCH operands, since they
- are not allowed to be shared. After reload, however, we only have
- a SCRATCH if we won't use the operand, so it is allowed to share it
- then. */
- if (reload_completed || GET_CODE (operands[6]) != SCRATCH)
- operands[7] = operands[8] = operands[6];
- else
- {
- operands[7] = gen_rtx (SCRATCH, SImode);
- operands[8] = gen_rtx (SCRATCH, SImode);
- }
-}")
-
-;; Define move insns for SF, and DF.
-;;
-;; For register-register copies or a copy of something to itself, emit a
-;; single SET insn since it will likely be optimized away.
-;;
-;; Otherwise, emit a floating-point move operation unless both input and
-;; output are either constant, memory, or a non-floating-point hard register.
-(define_expand "movdf"
- [(parallel [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "
-{ rtx op0 = operands[0];
- rtx op1 = operands[1];
-
- if (op0 == op1)
- {
- emit_insn (gen_rtx (SET, VOIDmode, op0, op1));
- DONE;
- }
-
- if ((GET_CODE (op0) == MEM
- || (GET_CODE (op0) == REG && REGNO (op0) < FIRST_PSEUDO_REGISTER
- && ! FP_REGNO_P (REGNO (op0))))
- && (GET_CODE (op1) == MEM
- || GET_CODE (op1) == CONST_DOUBLE
- || (GET_CODE (op1) == REG && REGNO (op1) < FIRST_PSEUDO_REGISTER
- && ! FP_REGNO_P (REGNO (op1)) && ! rtx_equal_p (op0, op1))))
- {
- rtx insns;
-
- if (GET_CODE (op1) == CONST_DOUBLE)
- op1 = force_const_mem (DFmode, op1);
-
- start_sequence ();
- if (GET_CODE (operands[0]) != REG
- || ! refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands[1]), 0)
- {
- emit_move_insn (operand_subword (op0, 0, 1, DFmode),
- operand_subword_force (op1, 0, DFmode));
- emit_move_insn (operand_subword (op0, 1, 1, DFmode),
- operand_subword_force (op1, 1, DFmode));
- }
- else
- {
- emit_move_insn (operand_subword (op0, 1, 1, DFmode),
- operand_subword_force (op1, 1, DFmode));
- emit_move_insn (operand_subword (op0, 0, 1, DFmode),
- operand_subword_force (op1, 0, DFmode));
- }
-
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, op0, op1, 0, op1);
- DONE;
- }
-}")
-
-(define_expand "movsf"
- [(parallel [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "
-{ rtx op0 = operands[0];
- rtx op1 = operands[1];
-
- if (op0 == op1)
- {
- emit_insn (gen_rtx (SET, VOIDmode, op0, op1));
- DONE;
- }
-
- if ((GET_CODE (op0) == MEM
- || (GET_CODE (op0) == REG && REGNO (op0) < FIRST_PSEUDO_REGISTER
- && ! FP_REGNO_P (REGNO (op0))))
- && (GET_CODE (op1) == MEM
- || GET_CODE (op1) == CONST_DOUBLE
- || (GET_CODE (op1) == REG && REGNO (op1) < FIRST_PSEUDO_REGISTER
- && ! FP_REGNO_P (REGNO (op1)))))
- {
- rtx last;
-
- if (GET_CODE (op1) == CONST_DOUBLE)
- op1 = force_const_mem (SFmode, op1);
-
- last = emit_move_insn (operand_subword (op0, 0, 1, SFmode),
- operand_subword_force (op1, 0, SFmode));
-
- REG_NOTES (last) = gen_rtx (EXPR_LIST, REG_EQUAL, op1, REG_NOTES (last));
- DONE;
- }
-}")
-
-;; Define the move insns for SF and DF. Check for all general regs
-;; in the FP insns and make them non-FP if so. Do the same if the input and
-;; output are the same (the insn will be deleted in this case and we don't
-;; want to think there are FP insns when there might not be).
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=*frg")
- (match_dup 0))]
- ""
- "nopr r0"
- [(set_attr "type" "address")
- (set_attr "length" "2")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "general_operand" "=r,*fr,r,r,Q,m,frg")
- (match_operand:SF 1 "general_operand" "r,0,Q,m,r,r,frg"))
- (clobber (match_operand:SI 2 "reg_0_operand" "=&z,z,z,z,z,z,z"))
- (clobber (match_operand:SI 3 "reg_15_operand" "=&t,t,t,t,t,t,t"))]
- ""
- "*
-{ switch (which_alternative)
- {
- case 0:
- return \"cas %0,%1,r0\";
- case 1:
- return \"nopr r0\";
- case 2:
- return \"l%M1 %0,%1\";
- case 3:
- return \"load %0,%1\";
- case 4:
- return \"st%M0 %1,%0\";
- case 5:
- return \"store %1,%0,%3\";
- default:
- return output_fpop (SET, operands[0], operands[1], 0, insn);
- }
-}"
- [(set_attr "type" "address,address,load,load,store,store,fp")
- (set_attr "length" "2,2,*,*,*,*,*")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=*frg")
- (match_dup 0))]
- ""
- "nopr r0"
- [(set_attr "type" "address")
- (set_attr "length" "2")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=r,*fr,r,r,Q,m,frg")
- (match_operand:DF 1 "general_operand" "r,0,Q,m,r,r,*frg"))
- (clobber (match_operand:SI 2 "reg_0_operand" "=&z,z,z,z,z,z,z"))
- (clobber (match_operand:SI 3 "reg_15_operand" "=&t,t,t,t,t,t,t"))]
- ""
- "*
-{ switch (which_alternative)
- {
- case 0:
- if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
- return \"cas %O0,%O1,r0\;cas %0,%1,r0\";
- else
- return \"cas %0,%1,r0\;cas %O0,%O1,r0\";
- case 1:
- return \"nopr r0\";
- case 2:
- /* Here we must see which word to load first. We default to the
- low-order word unless it occurs in the address. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands[1], 0))
- return \"l%M1 %O0,%O1\;l%M1 %0,%1\";
- else
- return \"l%M1 %0,%1\;l%M1 %O0,%O1\";
- case 3:
- return \"get %3,$%1\;ls %0,0(%3)\;ls %O0,4(%3)\";
- case 4:
- return \"st%M0 %1,%0\;st%M0 %O1,%O0\";
- case 5:
- return \"get %3,$%0\;sts %1,0(%3)\;sts %O1,4(%3)\";
- default:
- return output_fpop (SET, operands[0], operands[1], 0, insn);
- }
-}"
- [(set_attr "type" "address,multi,multi,multi,multi,multi,fp")
- (set_attr "length" "2,4,*,*,*,*,*")])
-
-;; Split all the above cases that involve multiple insns and no floating-point
-;; data block. If before reload, we can make a SCRATCH. Otherwise, use
-;; register 15.
-
-(define_split
- [(set (match_operand:DF 0 "register_operand" "")
- (match_operand:DF 1 "symbolic_memory_operand" ""))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))]
- "GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 16"
- [(set (reg:SI 15) (match_dup 2))
- (set (match_dup 3) (match_dup 4))
- (set (match_dup 5) (match_dup 6))]
- "
-{ operands[2] = XEXP (operands[1], 0);
- operands[3] = operand_subword (operands[0], 0, 0, DFmode);
- operands[4] = gen_rtx (MEM, SImode, gen_rtx (REG, SImode, 15));
- operands[5] = operand_subword (operands[0], 1, 0, DFmode);
- operands[6] = gen_rtx (MEM, SImode,
- gen_rtx (PLUS, SImode, gen_rtx (REG, SImode, 15),
- gen_rtx (CONST_INT, VOIDmode, 4)));
-
- if (operands[3] == 0 || operands[5] == 0)
- FAIL;
-}")
-
-(define_split
- [(set (match_operand:DF 0 "symbolic_memory_operand" "")
- (match_operand:DF 1 "register_operand" ""))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))]
- "GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 16"
- [(set (reg:SI 15) (match_dup 2))
- (set (match_dup 3) (match_dup 4))
- (set (match_dup 5) (match_dup 6))]
- "
-{ operands[2] = XEXP (operands[0], 0);
- operands[3] = gen_rtx (MEM, SImode, gen_rtx (REG, SImode, 15));
- operands[4] = operand_subword (operands[1], 0, 0, DFmode);
- operands[5] = gen_rtx (MEM, SImode,
- gen_rtx (PLUS, SImode, gen_rtx (REG, SImode, 15),
- gen_rtx (CONST_INT, VOIDmode, 4)));
- operands[6] = operand_subword (operands[1], 1, 0, DFmode);
-
- if (operands[4] == 0 || operands[6] == 0)
- FAIL;
-}")
-
-;; If the output is a register and the input is memory, we have to be careful
-;; and see which word needs to be loaded first. We also cannot to the
-;; split if the input is a constant because it would result in invalid
-;; insns. When the output is a MEM, we must put a CLOBBER on each of the
-;; resulting insn, when it is not a MEM, we must not.
-(define_split
- [(set (match_operand:DF 0 "memory_operand" "")
- (match_operand:DF 1 "register_operand" ""))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))]
- "GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 15"
- [(parallel [(set (match_dup 2) (match_dup 3))
- (clobber (match_dup 6))])
- (parallel [(set (match_dup 4) (match_dup 5))
- (clobber (match_dup 7))])]
- "
-{ operands[2] = operand_subword (operands[0], 0, 0, DFmode);
- operands[3] = operand_subword (operands[1], 0, 0, DFmode);
- operands[4] = operand_subword (operands[0], 1, 0, DFmode);
- operands[5] = operand_subword (operands[1], 1, 0, DFmode);
-
- if (operands[2] == 0 || operands[3] == 0
- || operands[4] == 0 || operands[5] == 0)
- FAIL;
-
- if (reload_completed)
- operands[6] = operands[7] = gen_rtx (REG, SImode, 15);
- else
- {
- operands[6] = gen_rtx (SCRATCH, SImode);
- operands[7] = gen_rtx (SCRATCH, SImode);
- }
-}")
-
-(define_split
- [(set (match_operand:DF 0 "nonmemory_operand" "")
- (match_operand:DF 1 "general_operand" ""))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))]
- "! symbolic_memory_operand (operands[1], DFmode)
- && GET_CODE (operands[1]) != CONST_DOUBLE
- && (GET_CODE (operands[0]) != REG || REGNO (operands[0]) < 15)
- && (GET_CODE (operands[1]) != REG || REGNO (operands[1]) < 15)
- && (GET_CODE (operands[0]) == REG || GET_CODE (operands[1]) == REG)
- && ! (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
- && ! reload_completed
- && reg_overlap_mentioned_p (operands[0], operands[1]))"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))]
- "
-{ if (GET_CODE (operands[0]) != REG
- || ! refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands[1], 0))
- {
- operands[2] = operand_subword (operands[0], 0, 0, DFmode);
- operands[3] = operand_subword (operands[1], 0, 0, DFmode);
- operands[4] = operand_subword (operands[0], 1, 0, DFmode);
- operands[5] = operand_subword (operands[1], 1, 0, DFmode);
- }
- else
- {
- operands[2] = operand_subword (operands[0], 1, 0, DFmode);
- operands[3] = operand_subword (operands[1], 1, 0, DFmode);
- operands[4] = operand_subword (operands[0], 0, 0, DFmode);
- operands[5] = operand_subword (operands[1], 0, 0, DFmode);
- }
-
- if (operands[2] == 0 || operands[3] == 0
- || operands[4] == 0 || operands[5] == 0)
- FAIL;
-}")
-
-;; Conversions from one integer mode to another.
-;; It is possible sometimes to sign- or zero-extend while fetching from memory.
-;;
-;; First, sign-extensions:
-(define_expand "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=b")
- (sign_extend:SI (match_operand:HI 1 "symbolic_memory_operand" "m")))]
- ""
- "loadha %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,b")
- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Q,m")))]
- ""
- "@
- exts %0,%1
- lha%M1 %0,%1
- loadha %0,%1"
- [(set_attr "type" "arith,load,load")
- (set_attr "length" "2,*,*")])
-
-(define_expand "extendqisi2"
- [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "register_operand" "")
- (const_int 24)))
- (set (match_operand:SI 0 "register_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))]
- ""
- "
-{ operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode); }")
-
-(define_expand "extendqihi2"
- [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "register_operand" "")
- (const_int 24)))
- (set (match_operand:HI 0 "register_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))]
- ""
- "
-{ operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode); }")
-
-;; Define peepholes to eliminate an instruction when we are doing a sign
-;; extension but cannot clobber the input.
-;;
-;; In this case we will shift left 24 bits, but need a copy first. The shift
-;; can be replaced by a "mc03" instruction, but this can only be done if
-;; followed by the right shift of 24 or more bits.
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "")
- (subreg:SI (match_operand:QI 1 "register_operand" "") 0))
- (set (match_dup 0)
- (ashift:SI (match_dup 0)
- (const_int 24)))
- (set (match_dup 0)
- (ashiftrt:SI (match_dup 0)
- (match_operand:SI 2 "const_int_operand" "")))]
- "INTVAL (operands[2]) >= 24"
- "mc03 %0,%1\;sari16 %0,%S2"
- [(set_attr "type" "multi")
- (set_attr "length" "4")
- (set_attr "cc" "sets")])
-
-;; Now zero extensions:
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=b")
- (zero_extend:SI (match_operand:HI 1 "symbolic_memory_operand" "m")))]
- ""
- "loadh %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,b")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Q,m")))]
- ""
- "@
- nilz %0,%1,65535
- lh%N1 %0,%1
- loadh %0,%1"
- [(set_attr "type" "arith,loadz,load")])
-
-(define_expand "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=b")
- (zero_extend:SI (match_operand:QI 1 "symbolic_memory_operand" "m")))]
- ""
- "loadc %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,b")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,Q,m")))]
- ""
- "@
- nilz %0,%1,255
- lc%M1 %0,%1
- loadc %0,%1"
- [(set_attr "type" "arith,load,load")])
-
-(define_expand "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=b")
- (zero_extend:HI (match_operand:QI 1 "symbolic_memory_operand" "m")))]
- ""
- "loadc %0,%1"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r,r,b")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,Q,m")))]
- ""
- "@
- nilz %0,%1,255
- lc%M1 %0,%1
- loadc %0,%1"
- [(set_attr "type" "arith,load,load")])
-
-;; Various extract and insertion operations.
-(define_expand "extzv"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "const_int_operand" "")
- (match_operand:SI 3 "const_int_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 8)
- FAIL;
-
- if (GET_CODE (operands[3]) != CONST_INT)
- FAIL;
-
- if (INTVAL (operands[3]) != 0 && INTVAL (operands[3]) != 8
- && INTVAL (operands[3]) != 16 && INTVAL (operands[3]) != 24)
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 8)
- (match_operand:SI 2 "const_int_operand" "n")))]
- "(INTVAL (operands[2]) & 7) == 0"
- "lis %0,0\;mc3%B2 %0,%1"
- [(set_attr "type" "multi")
- (set_attr "cc" "change0")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 8)
- (match_operand:SI 2 "const_int_operand" "n")))]
- "(INTVAL (operands[2]) & 7) == 0"
- [(set (match_dup 0) (const_int 0))
- (set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 24))
- (zero_extract:SI (match_dup 1) (const_int 8) (match_dup 2)))]
- "")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
- (const_int 8)
- (const_int 24))
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 8)
- (match_operand:SI 2 "const_int_operand" "n")))]
- "(INTVAL (operands[2]) & 7) == 0"
- "mc3%B2 %0,%1"
- [(set_attr "type" "address")
- (set_attr "length" "2")])
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "const_int_operand" "")
- (match_operand:SI 2 "const_int_operand" ""))
- (match_operand:SI 3 "register_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- FAIL;
-
- if (GET_CODE (operands[1]) != CONST_INT)
- FAIL;
-
- if (INTVAL (operands[1]) == 1)
- {
- emit_insn (gen_bit_insv (operands[0], operands[1], operands[2],
- operands[3]));
- DONE;
- }
- else if (INTVAL (operands[1]) == 8
- && (INTVAL (operands[2]) % 8 == 0))
- ; /* Accept aligned byte-wide field. */
- else
- FAIL;
-}")
-
-;; For a single-bit insert, it is better to explicitly generate references
-;; to the T bit. We will call the T bit "CC0" because it can be clobbered
-;; by some CC0 sets (single-bit tests).
-
-(define_expand "bit_insv"
- [(set (cc0)
- (zero_extract:SI (match_operand:SI 3 "register_operand" "")
- (const_int 1)
- (const_int 31)))
- (parallel [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "const_int_operand" "")
- (match_operand:SI 2 "const_int_operand" ""))
- (ne (cc0) (const_int 0)))
- (clobber (match_scratch:SI 4 ""))])]
- ""
- "")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
- (const_int 8)
- (match_operand:SI 1 "const_int_operand" "n"))
- (match_operand:SI 2 "register_operand" "r"))]
- "(INTVAL (operands[1]) & 7) == 0"
- "mc%B1%.3 %0,%2"
- [(set_attr "type" "address")
- (set_attr "length" "2")])
-
-;; This pattern cannot have any input reloads since if references CC0.
-;; So we have to add code to support memory, which is the only other
-;; thing that a "register_operand" can become. There is still a problem
-;; if the address isn't valid and *it* needs a reload, but there is no
-;; way to solve that problem, so let's hope it never happens.
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r,m")
- (const_int 1)
- (match_operand:SI 1 "const_int_operand" "n,m"))
- (ne (cc0) (const_int 0)))
- (clobber (match_scratch:SI 2 "=X,b"))]
- ""
- "@
- mftbi%t1 %0,%S1
- l%M0 %2,%0\;mftb%t1 %2,%S1\;st%M0 %2,%0"
- [(set_attr "type" "*,multi")
- (set_attr "cc" "none,none")
- (set_attr "length" "2,10")])
-
-;; Arithmetic instructions. First, add and subtract.
-;;
-;; It may be that the second input is either large or small enough that
-;; the operation cannot be done in a single insn. In that case, emit two.
-(define_expand "addsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (INTVAL (operands[2]) + 0x8000) >= 0x10000
- && (INTVAL (operands[2]) & 0xffff) != 0)
- {
- int low = INTVAL (operands[2]) & 0xffff;
- int high = (unsigned) INTVAL (operands[2]) >> 16;
-
- if (low & 0x8000)
- high++, low |= 0xffff0000;
-
- emit_insn (gen_addsi3 (operands[0], operands[1],
- gen_rtx (CONST_INT, VOIDmode, high << 16)));
- operands[1] = operands[0];
- operands[2] = gen_rtx (CONST_INT, VOIDmode, low);
- }
-}")
-
-;; Put the insn to add a symbolic constant to a register separately to
-;; improve register allocation since it has different register requirements.
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=b")
- (plus:SI (match_operand:SI 1 "register_operand" "%b")
- (match_operand:SI 2 "romp_symbolic_operand" "s")))]
- ""
- "get %0,$%2(%1)"
- [(set_attr "type" "address")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,b")
- (plus:SI (match_operand:SI 1 "reg_or_add_operand" "%0,0,r,b,0,r,b")
- (match_operand:SI 2 "reg_or_add_operand" "I,J,K,M,r,b,s")))]
- "register_operand (operands[1], SImode)
- || register_operand (operands[2], SImode)"
- "@
- ais %0,%2
- sis %0,%n2
- ail %0,%1,%2
- cau %0,%H2(%1)
- a %0,%2
- cas %0,%1,%2
- get %0,$%2(%1)"
- [(set_attr "type" "arith,arith,arith,address,arith,address,misc")
- (set_attr "length" "2,2,4,4,2,2,8")])
-
-;; Now subtract.
-;;
-;; 1. If third operand is constant integer, convert it to add of the negative
-;; of that integer.
-;; 2. If the second operand is not a valid constant integer, force it into a
-;; register.
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (minus:SI (match_operand:SI 1 "reg_or_any_cint_operand" "")
- (match_operand:SI 2 "reg_or_any_cint_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands [2]) == CONST_INT)
- {
- emit_insn (gen_addsi3 (operands[0], operands[1],
- gen_rtx (CONST_INT,
- VOIDmode, - INTVAL (operands[2]))));
- DONE;
- }
- else
- operands[2] = force_reg (SImode, operands[2]);
-
- if (GET_CODE (operands[1]) != CONST_INT
- || (unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000)
- operands[1] = force_reg (SImode, operands[1]);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (minus:SI (match_operand:SI 1 "reg_or_D_operand" "K,0,r")
- (match_operand:SI 2 "register_operand" "r,r,0")))]
- ""
- "@
- sfi %0,%2,%1
- s %0,%2
- sf %0,%1"
- [(set_attr "length" "4,2,2")])
-
-;; Multiply either calls a special RT routine or is done in-line, depending
-;; on the value of a -m flag.
-;;
-;; First define the way we call the subroutine.
-(define_expand "mulsi3_subr"
- [(set (reg:SI 2) (match_operand:SI 1 "register_operand" ""))
- (set (reg:SI 3) (match_operand:SI 2 "register_operand" ""))
- (parallel [(set (reg:SI 2) (mult:SI (reg:SI 2) (reg:SI 3)))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])
- (set (match_operand:SI 0 "register_operand" "")
- (reg:SI 2))]
- ""
- "")
-
-(define_expand "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (mult:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))]
- ""
- "
-{
- if (! TARGET_IN_LINE_MUL)
- {
- emit_insn (gen_mulsi3_subr (operands[0], operands[1], operands[2]));
- DONE;
- }
-}")
-
-;; Define the patterns to match.
-;; We would like to provide a delay slot for the insns that call internal
-;; routines, but doing so is risky since reorg will think that the use of
-;; r2 and r3 is completed in the insn needing the delay slot. Also, it
-;; won't know that the cc will be clobbered. So take the safe approach
-;; and don't give them delay slots.
-(define_insn ""
- [(set (reg:SI 2)
- (mult:SI (reg:SI 2) (reg:SI 3)))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))]
- "! TARGET_IN_LINE_MUL"
- "bali%# r15,lmul$$"
- [(set_attr "type" "misc")
- (set_attr "in_delay_slot" "no")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (mult:SI (match_operand:SI 1 "register_operand" "%r")
- (match_operand:SI 2 "register_operand" "r")))]
- "TARGET_IN_LINE_MUL"
- "*
-{ return output_in_line_mul (); }"
- [(set_attr "length" "38")
- (set_attr "type" "multi")])
-
-;; Handle divide and modulus. The same function returns both values,
-;; so use divmodsi4. This divides arg 1 by arg 2 with quotient to go
-;; into arg 0 and remainder in arg 3.
-;;
-;; We want to put REG_EQUAL notes for the two outputs. So we need a
-;; function to do everything else.
-(define_expand "divmodsi4_doit"
- [(set (reg:SI 2)
- (match_operand:SI 0 "register_operand" ""))
- (set (reg:SI 3)
- (match_operand:SI 1 "register_operand" ""))
- (parallel [(set (reg:SI 2) (div:SI (reg:SI 2) (reg:SI 3)))
- (set (reg:SI 3) (mod:SI (reg:SI 2) (reg:SI 3)))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "divmodsi4"
- [(parallel [(set (match_operand:SI 0 "register_operand" "")
- (div:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))
- (set (match_operand:SI 3 "register_operand" "")
- (mod:SI (match_dup 1) (match_dup 2)))])]
- ""
- "
-{
- rtx insn;
-
- emit_insn (gen_divmodsi4_doit (operands[1], operands[2]));
- insn = emit_move_insn (operands[0], gen_rtx (REG, SImode, 2));
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (DIV, SImode, operands[1],
- operands[2]),
- REG_NOTES (insn));
- insn = emit_move_insn (operands[3], gen_rtx (REG, SImode, 3));
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (MOD, SImode, operands[1],
- operands[2]),
- REG_NOTES (insn));
- DONE;
-}")
-
-(define_insn ""
- [(set (reg:SI 2)
- (div:SI (reg:SI 2) (reg:SI 3)))
- (set (reg:SI 3)
- (mod:SI (reg:SI 2) (reg:SI 3)))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))]
- ""
- "bali%# r15,ldiv$$"
- [(set_attr "type" "misc")
- (set_attr "in_delay_slot" "no")])
-
-;; Similarly for unsigned divide.
-(define_expand "udivmodsi4_doit"
- [(set (reg:SI 2)
- (match_operand:SI 0 "register_operand" ""))
- (set (reg:SI 3)
- (match_operand:SI 1 "register_operand" ""))
- (parallel [(set (reg:SI 2) (udiv:SI (reg:SI 2) (reg:SI 3)))
- (set (reg:SI 3) (umod:SI (reg:SI 2) (reg:SI 3)))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "udivmodsi4"
- [(parallel [(set (match_operand:SI 0 "register_operand" "")
- (udiv:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))
- (set (match_operand:SI 3 "register_operand" "")
- (umod:SI (match_dup 1) (match_dup 2)))])]
- ""
- "
-{
- rtx insn;
-
- emit_insn (gen_udivmodsi4_doit (operands[1], operands[2]));
- insn = emit_move_insn (operands[0], gen_rtx (REG, SImode, 2));
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (UDIV, SImode, operands[1],
- operands[2]),
- REG_NOTES (insn));
- insn = emit_move_insn (operands[3], gen_rtx (REG, SImode, 3));
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (UMOD, SImode, operands[1],
- operands[2]),
- REG_NOTES (insn));
- DONE;
-}")
-
-(define_insn ""
- [(set (reg:SI 2)
- (udiv:SI (reg:SI 2) (reg:SI 3)))
- (set (reg:SI 3)
- (umod:SI (reg:SI 2) (reg:SI 3)))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))]
- ""
- "bali%# r15,uldiv$$"
- [(set_attr "type" "misc")
- (set_attr "in_delay_slot" "no")])
-
-;; Define DImode arithmetic operations.
-;;
-;; It is possible to do certain adds and subtracts with constants in a single
-;; insn, but it doesn't seem worth the trouble.
-;;
-;; Don't use DEFINE_SPLIT on these because the dependency on CC can't be
-;; easily tracked in that case!
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_operand:DI 1 "register_operand" "%0")
- (match_operand:DI 2 "register_operand" "r")))]
- ""
- "a %O0,%O2\;ae %0,%2"
- [(set_attr "type" "multi")])
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:DI 2 "register_operand" "r")))]
- ""
- "s %O0,%O2\;se %0,%2"
- [(set_attr "type" "multi")])
-
-(define_insn "negdi2"
- [(set (match_operand:DI 0 "register_operand" "=r,&r")
- (neg:DI (match_operand:DI 1 "register_operand" "0,r")))]
- ""
- "twoc %O0,%O1\;onec %0,%1\;aei %0,%0,0"
- [(set_attr "type" "multi")
- (set_attr "length" "8")])
-
-;; Unary arithmetic operations.
-(define_insn "abssi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (abs:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "abs %0,%1"
- [(set_attr "length" "2")])
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "twoc %0,%1"
- [(set_attr "length" "2")])
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "onec %0,%1"
- [(set_attr "length" "2")])
-
-
-;; Logical insns: AND, IOR, and XOR
-;;
-;; If the operation is being performed on a 32-bit constant such that
-;; it cannot be done in one insn, do it in two. We may lose a bit on
-;; CSE in pathological cases, but it seems better doing it this way.
-(define_expand "andsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (and:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "reg_or_any_cint_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int top = (unsigned) INTVAL (operands[2]) >> 16;
- int bottom = INTVAL (operands[2]) & 0xffff;
-
- if (top != 0 && top != 0xffff && bottom != 0 && bottom != 0xffff)
- {
- emit_insn (gen_andsi3 (operands[0], operands[1],
- gen_rtx (CONST_INT, VOIDmode,
- (top << 16) | 0xffff)));
- operands[1] = operands[0];
- operands[2] = gen_rtx (CONST_INT, VOIDmode, 0xffff0000 | bottom);
- }
- }
-}");
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (and:SI (match_operand:SI 1 "reg_or_and_operand" "%0,r,0")
- (match_operand:SI 2 "reg_or_and_operand" "P,LMO,r")))]
- "register_operand (operands[1], SImode)
- || register_operand (operands[2], SImode)"
- "@
- clrb%k2 %0,%b2
- ni%z2 %0,%1,%Z2
- n %0,%2"
- [(set_attr "length" "2,4,2")])
-
-;; logical OR (IOR)
-(define_expand "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ior:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "reg_or_any_cint_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int top = (unsigned) INTVAL (operands[2]) >> 16;
- int bottom = INTVAL (operands[2]) & 0xffff;
-
- if (top != 0 && bottom != 0)
- {
- emit_insn (gen_iorsi3 (operands[0], operands[1],
- gen_rtx (CONST_INT, VOIDmode, (top << 16))));
- operands[1] = operands[0];
- operands[2] = gen_rtx (CONST_INT, VOIDmode, bottom);
- }
- }
-}");
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r,r")
- (ior:SI (match_operand:SI 1 "reg_or_cint_operand" "%0,r,0")
- (match_operand:SI 2 "reg_or_cint_operand" "N,LM,r")))]
- "register_operand (operands[1], SImode)
- || register_operand (operands[2], SImode)"
- "@
- setb%h2 %0,%b2
- oi%h2 %0,%1,%H2
- o %0,%2"
- [(set_attr "length" "2,4,2")])
-
-;; exclusive-or (XOR)
-(define_expand "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (xor:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "reg_or_any_cint_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- int top = (unsigned) INTVAL (operands[2]) >> 16;
- int bottom = INTVAL (operands[2]) & 0xffff;
-
- if (top == 0xffff && bottom == 0xffff)
- {
- emit_insn (gen_one_cmplsi2 (operands[0], operands[1]));
- DONE;
- }
- else if (top != 0 && bottom != 0)
- {
- emit_insn (gen_xorsi3 (operands[0], operands[1],
- gen_rtx (CONST_INT, VOIDmode, (top << 16))));
- operands[1] = operands[0];
- operands[2] = gen_rtx (CONST_INT, VOIDmode, bottom);
- }
- }
-}");
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (xor:SI (match_operand:SI 1 "reg_or_cint_operand" "%r,0")
- (match_operand:SI 2 "reg_or_cint_operand" "LM,r")))]
- "register_operand (operands[1], SImode)
- || register_operand (operands[2], SImode)"
- "@
- xi%h2 %0,%1,%H2
- x %0,%2"
- [(set_attr "length" "4,2")])
-
-;; Various shift insns
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "reg_or_cint_operand" "r,n")))]
- ""
- "@
- sar %0,%2
- sari%s2 %0,%S2"
- [(set_attr "length" "2")])
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "reg_or_cint_operand" "r,n")))]
- ""
- "@
- sr %0,%2
- sri%s2 %0,%S2"
- [(set_attr "length" "2")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "register_operand" "b")
- (const_int 1)))]
- ""
- "cas %0,%1,%1"
- [(set_attr "length" "2")
- (set_attr "type" "address")])
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "reg_or_cint_operand" "r,n")))]
- ""
- "@
- sl %0,%2
- sli%s2 %0,%S2"
- [(set_attr "length" "2")])
-
-;; Function call insns:
-;;
-;; On the ROMP, &fcn is actually a pointer to the data area, which is passed
-;; to the function in r0. &.fcn is the actual starting address of the
-;; function. Also, the word at &fcn contains &.fcn.
-;;
-;; For both functions that do and don't return values, there are two cases:
-;; where the function's address is a constant, and where it isn't.
-;;
-;; Operand 1 (2 for `call_value') is the number of arguments and is not used.
-(define_expand "call"
- [(use (match_operand:SI 0 "address_operand" ""))
- (use (match_operand 1 "" ""))]
- ""
- "
-{
- rtx reg0 = gen_rtx (REG, SImode, 0);
- rtx call_insn;
-
- if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
- abort();
-
- operands[0] = XEXP (operands[0], 0);
- if (GET_CODE (operands[0]) == SYMBOL_REF)
- {
- extern rtx get_symref ();
- char *real_fcnname =
- (char *) alloca (strlen (XSTR (operands[0], 0)) + 2);
-
- /* Copy the data area address to r0. */
- emit_move_insn (reg0, force_reg (SImode, operands[0]));
- strcpy (real_fcnname, \".\");
- strcat (real_fcnname, XSTR (operands[0], 0));
- operands[0] = get_symref (real_fcnname);
- }
- else
- {
- rtx data_access;
-
- emit_move_insn (reg0, force_reg (SImode, operands[0]));
- data_access = gen_rtx (MEM, SImode, operands[0]);
- RTX_UNCHANGING_P (data_access) = 1;
- operands[0] = copy_to_reg (data_access);
- }
-
- call_insn = emit_call_insn (gen_call_internal (operands[0], operands[1]));
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), reg0);
- DONE;
-}")
-
-(define_insn "call_internal"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
- (match_operand 1 "" "g"))
- (clobber (reg:SI 15))]
- ""
- "balr%# r15,%0"
- [(set_attr "type" "call")
- (set_attr "length" "2")])
-
-(define_insn ""
- [(call (mem:SI (match_operand:SI 0 "romp_symbolic_operand" "i"))
- (match_operand 1 "" "g"))
- (clobber (reg:SI 15))]
- "GET_CODE (operands[0]) == SYMBOL_REF"
- "bali%# r15,%0"
- [(set_attr "type" "call")])
-
-;; Call a function and return a value.
-(define_expand "call_value"
- [(use (match_operand 0 "" ""))
- (use (match_operand:SI 1 "address_operand" ""))
- (use (match_operand 2 "" ""))]
- ""
- "
-{
- rtx reg0 = gen_rtx (REG, SImode, 0);
- rtx call_insn;
-
- if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
- abort();
-
- operands[1] = XEXP (operands[1], 0);
- if (GET_CODE (operands[1]) == SYMBOL_REF)
- {
- extern rtx get_symref ();
- char *real_fcnname =
- (char *) alloca (strlen (XSTR (operands[1], 0)) + 2);
-
- /* Copy the data area address to r0. */
- emit_move_insn (reg0,force_reg (SImode, operands[1]));
- strcpy (real_fcnname, \".\");
- strcat (real_fcnname, XSTR (operands[1], 0));
- operands[1] = get_symref (real_fcnname);
- }
- else
- {
- rtx data_access;
-
- emit_move_insn (reg0,force_reg (SImode, operands[1]));
- data_access = gen_rtx (MEM, SImode, operands[1]);
- RTX_UNCHANGING_P (data_access) = 1;
- operands[1] = copy_to_reg (data_access);
- }
-
- call_insn = emit_call_insn (gen_call_value_internal (operands[0],
- operands[1],
- operands[2]));
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), reg0);
- DONE;
-}")
-
-(define_insn "call_value_internal"
- [(set (match_operand 0 "" "=fg")
- (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
- (match_operand 2 "" "g")))
- (clobber (reg:SI 15))]
- ""
- "balr%# r15,%1"
- [(set_attr "length" "2")
- (set_attr "type" "call")])
-
-(define_insn ""
- [(set (match_operand 0 "" "=fg")
- (call (mem:SI (match_operand:SI 1 "romp_symbolic_operand" "i"))
- (match_operand 2 "" "g")))
- (clobber (reg:SI 15))]
- "GET_CODE (operands[1]) == SYMBOL_REF"
- "bali%# r15,%1"
- [(set_attr "type" "call")])
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-;; No operation insn.
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nopr r0"
- [(set_attr "type" "address")
- (set_attr "length" "2")
- (set_attr "cc" "none")])
-
-;; Here are the floating-point operations.
-;;
-;; Start by providing DEFINE_EXPAND for each operation.
-;; The insns will be handled with MATCH_OPERATOR; the methodology will be
-;; discussed below.
-
-;; First the conversion operations.
-
-(define_expand "truncdfsf2"
- [(parallel [(set (match_operand:SF 0 "general_operand" "")
- (float_truncate:SF (match_operand:DF 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "extendsfdf2"
- [(parallel [(set (match_operand:DF 0 "general_operand" "")
- (float_extend:DF (match_operand:SF 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "floatsisf2"
- [(parallel [(set (match_operand:SF 0 "general_operand" "")
- (float:SF (match_operand:SI 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "floatsidf2"
- [(parallel [(set (match_operand:DF 0 "general_operand" "")
- (float:DF (match_operand:SI 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "fix_truncsfsi2"
- [(parallel [(set (match_operand:SI 0 "general_operand" "")
- (fix:SI (match_operand:SF 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "fix_truncdfsi2"
- [(parallel [(set (match_operand:SI 0 "general_operand" "")
- (fix:SI (match_operand:DF 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-;; Now the binary operations.
-
-(define_expand "addsf3"
- [(parallel [(set (match_operand:SF 0 "general_operand" "")
- (plus:SF (match_operand:SF 1 "general_operand" "")
- (match_operand:SF 2 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "adddf3"
- [(parallel [(set (match_operand:DF 0 "general_operand" "")
- (plus:DF (match_operand:DF 1 "general_operand" "")
- (match_operand:DF 2 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "subsf3"
- [(parallel [(set (match_operand:SF 0 "general_operand" "")
- (minus:SF (match_operand:SF 1 "general_operand" "")
- (match_operand:SF 2 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "subdf3"
- [(parallel [(set (match_operand:DF 0 "general_operand" "")
- (minus:DF (match_operand:DF 1 "general_operand" "")
- (match_operand:DF 2 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "mulsf3"
- [(parallel [(set (match_operand:SF 0 "general_operand" "")
- (mult:SF (match_operand:SF 1 "general_operand" "")
- (match_operand:SF 2 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "muldf3"
- [(parallel [(set (match_operand:DF 0 "general_operand" "")
- (mult:DF (match_operand:DF 1 "general_operand" "")
- (match_operand:DF 2 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "divsf3"
- [(parallel [(set (match_operand:SF 0 "general_operand" "")
- (div:SF (match_operand:SF 1 "general_operand" "")
- (match_operand:SF 2 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "divdf3"
- [(parallel [(set (match_operand:DF 0 "general_operand" "")
- (div:DF (match_operand:DF 1 "general_operand" "")
- (match_operand:DF 2 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-;; Unary floating-point operations.
-;;
-;; Negations can be done without floating-point, since this is IEEE.
-;; But we cannot do this if an operand is a hard FP register, since
-;; the SUBREG we create would not be valid.
-(define_expand "negsf2"
- [(set (match_operand:SF 0 "register_operand" "")
- (neg:SF (match_operand:SF 1 "register_operand" "")))]
- ""
- "
-{
- if (! (GET_CODE (operands[0]) == REG
- && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && FP_REGNO_P (REGNO (operands[0])))
- && ! (GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && FP_REGNO_P (REGNO (operands[1]))))
- {
- rtx result;
- rtx target = operand_subword (operands[0], 0, 1, SFmode);
-
- result = expand_binop (SImode, xor_optab,
- operand_subword_force (operands[1], 0, SFmode),
- gen_rtx (CONST_INT, VOIDmode, 0x80000000),
- target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- /* Make a place for REG_EQUAL. */
- emit_move_insn (operands[0], operands[0]);
- DONE;
- }
-}")
-
-(define_expand "negdf2"
- [(set (match_operand:DF 0 "register_operand" "")
- (neg:DF (match_operand:DF 1 "register_operand" "")))]
- ""
- "
-{
- if (! (GET_CODE (operands[0]) == REG
- && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
- && FP_REGNO_P (REGNO (operands[0])))
- && ! (GET_CODE (operands[1]) == REG
- && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
- && FP_REGNO_P (REGNO (operands[1]))))
- {
- rtx result;
- rtx target = operand_subword (operands[0], 0, 1, DFmode);
- rtx insns;
-
- start_sequence ();
- result = expand_binop (SImode, xor_optab,
- operand_subword_force (operands[1], 0, DFmode),
- gen_rtx (CONST_INT, VOIDmode, 0x80000000),
- target, 0, OPTAB_WIDEN);
- if (result == 0)
- abort ();
-
- if (result != target)
- emit_move_insn (result, target);
-
- emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
- operand_subword_force (operands[1], 1, DFmode));
-
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
- DONE;
- }
-}")
-
-(define_expand "abssf2"
- [(parallel [(set (match_operand:SF 0 "general_operand" "")
- (abs:SF (match_operand:SF 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "absdf2"
- [(parallel [(set (match_operand:DF 0 "general_operand" "")
- (abs:DF (match_operand:DF 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-;; Any floating-point operation can be either SFmode or DFmode, and each
-;; operand (including the output) can be either a normal operand or a
-;; conversion from a normal operand.
-;;
-;; We use MATCH_OPERATOR to match a floating-point binary or unary operator
-;; and input and output conversions. So we need 2^N patterns for each type
-;; of operation, where N is the number of operands, including the output.
-;; There are thus a total of 14 patterns, 8 for binary operations, 4 for
-;; unary operations and two for conversion/move operations (only one
-;; operand can have a conversion for move operations). In addition, we have
-;; to be careful that a floating-point reload register doesn't get allocated
-;; for an integer. We take care of this for inputs with PREFERRED_RELOAD_CLASS
-;; but need to have two different constraints for outputs. This means that
-;; we have to duplicate each pattern where the output could be an integer.
-;; This adds another 7 patterns, for a total of 21.
-
-;; Start with conversion operations (moves are done above).
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operator 1 "float_conversion"
- [(match_operand 2 "general_operand" "frg")]))
- (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
- ""
- "*
-{ return output_fpop (SET, operands[0], operands[2], 0, insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_conversion"
- [(match_operand 2 "general_operand" "frg")]))
- (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
- ""
- "*
-{ return output_fpop (SET, operands[0], operands[2], 0, insn);
-}"
- [(set_attr "type" "fp")])
-
-;; Next, binary floating-point operations.
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_binary"
- [(match_operand 2 "general_operand" "frg")
- (match_operand 3 "general_operand" "frg")]))
- (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[1]), operands[2], operands[3])"
- "*
-{ return output_fpop (GET_CODE (operands[1]), operands[0],
- operands[2], operands[3], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_binary"
- [(match_operand 2 "general_operand" "frg")
- (match_operator 3 "float_conversion"
- [(match_operand 4 "general_operand" "frg")])]))
- (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[1]), operands[2], operands[4])"
- "*
-{ return output_fpop (GET_CODE (operands[1]), operands[0],
- operands[2], operands[4], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_binary"
- [(match_operator 2 "float_conversion"
- [(match_operand 3 "general_operand" "frg")])
- (match_operand 4 "general_operand" "frg")]))
- (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[1]), operands[3], operands[4])"
- "*
-{ return output_fpop (GET_CODE (operands[1]), operands[0],
- operands[3], operands[4], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_binary"
- [(match_operator 2 "float_conversion"
- [(match_operand 3 "general_operand" "frg")])
- (match_operator 4 "float_conversion"
- [(match_operand 5 "general_operand" "frg")])]))
- (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[1]), operands[3], operands[5])"
- "*
-{ return output_fpop (GET_CODE (operands[1]), operands[0],
- operands[3], operands[5], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_binary"
- [(match_operand 3 "general_operand" "frg")
- (match_operand 4 "general_operand" "frg")])]))
- (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[3], operands[4])"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0],
- operands[3], operands[4], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_binary"
- [(match_operand 3 "general_operand" "frg")
- (match_operand 4 "general_operand" "frg")])]))
- (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[3], operands[4])"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0],
- operands[3], operands[4], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_binary"
- [(match_operand 3 "general_operand" "frg")
- (match_operator 4 "float_conversion"
- [(match_operand 5 "general_operand" "frg")])])]))
- (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[3], operands[4])"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0],
- operands[3], operands[5], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_binary"
- [(match_operand 3 "general_operand" "frg")
- (match_operator 4 "float_conversion"
- [(match_operand 5 "general_operand" "frg")])])]))
- (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[3], operands[4])"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0],
- operands[3], operands[5], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_binary"
- [(match_operator 3 "float_conversion"
- [(match_operand 4 "general_operand" "frg")])
- (match_operand 5 "general_operand" "frg")])]))
- (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[4], operands[5])"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0],
- operands[4], operands[5], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_binary"
- [(match_operator 3 "float_conversion"
- [(match_operand 4 "general_operand" "frg")])
- (match_operand 5 "general_operand" "frg")])]))
- (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[4], operands[5])"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0],
- operands[4], operands[5], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_binary"
- [(match_operator 3 "float_conversion"
- [(match_operand 4 "general_operand" "frg")])
- (match_operator 5 "float_conversion"
- [(match_operand 6 "general_operand" "frg")])])]))
- (clobber (match_operand:SI 7 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 8 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[4], operands[6])"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0],
- operands[4], operands[6], insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_binary"
- [(match_operator 3 "float_conversion"
- [(match_operand 4 "general_operand" "frg")])
- (match_operator 5 "float_conversion"
- [(match_operand 6 "general_operand" "frg")])])]))
- (clobber (match_operand:SI 7 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 8 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[4], operands[6])"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0],
- operands[4], operands[6], insn);
-}"
- [(set_attr "type" "fp")])
-
-;; Unary floating-point operations.
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_unary"
- [(match_operand 2 "general_operand" "frg")]))
- (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[1]), operands[2], 0)"
- "*
-{ return output_fpop (GET_CODE (operands[1]), operands[0], operands[2],
- 0, insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_unary"
- [(match_operator 2 "float_conversion"
- [(match_operand 3 "general_operand" "frg")])]))
- (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[1]), operands[3], 0)"
- "*
-{ return output_fpop (GET_CODE (operands[1]), operands[0], operands[3],
- 0, insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_unary"
- [(match_operand 3 "general_operand" "frg")])]))
- (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[3], 0)"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0], operands[3],
- 0, insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_unary"
- [(match_operand 3 "general_operand" "frg")])]))
- (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[3], 0)"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0], operands[3],
- 0, insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_unary"
- [(match_operator 3 "float_conversion"
- [(match_operand 4 "general_operand" "frg")])])]))
- (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[4], 0)"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0], operands[4],
- 0, insn);
-}"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand 0 "general_operand" "=frg")
- (match_operator 1 "float_conversion"
- [(match_operator 2 "float_unary"
- [(match_operator 3 "float_conversion"
- [(match_operand 4 "general_operand" "frg")])])]))
- (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
- "check_precision (GET_MODE (operands[2]), operands[4], 0)"
- "*
-{ return output_fpop (GET_CODE (operands[2]), operands[0], operands[4],
- 0, insn);
-}"
- [(set_attr "type" "fp")])
-
-;; Compare insns are next. Note that the ROMP has two types of compares,
-;; signed & unsigned, and one type of branch. Use the routine
-;; `next_insn_tests_no_unsigned' to see which type to use.
-(define_expand "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "register_operand" "r"))]
- ""
- "")
-
-(define_expand "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "reg_or_cint_operand" "")))]
- ""
- "")
-
-;; Signed compare, `test' first.
-
-(define_insn ""
- [(set (cc0)
- (match_operand:SI 0 "register_operand" "r"))]
- "next_insn_tests_no_unsigned (insn)"
- "cis %0,0"
- [(set_attr "length" "2")
- (set_attr "type" "compare")])
-
-(define_insn ""
- [(set (cc0) (match_operand:SI 0 "register_operand" "r,r,r"))
- (set (match_operand:SI 1 "reg_or_nonsymb_mem_operand" "=0,r,Q")
- (match_dup 0))]
- "next_insn_tests_no_unsigned (insn)"
- "@
- cis %1,0
- nilo %1,%0,65535
- st%M1 %0,%1\;cis %0,0"
- [(set_attr "type" "compare,compare,store")
- (set_attr "length" "2,4,6")
- (set_attr "cc" "compare")])
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:SI 0 "register_operand" "r,r,r")
- (match_operand:SI 1 "reg_or_cint_operand" "I,K,r")))]
- "next_insn_tests_no_unsigned (insn)"
- "@
- cis %0,%1
- cil %0,%1
- c %0,%1"
- [(set_attr "length" "2,4,2")
- (set_attr "type" "compare")])
-
-;; Unsigned comparisons, `test' first, again.
-(define_insn ""
- [(set (cc0)
- (match_operand:SI 0 "register_operand" "r"))]
- "! next_insn_tests_no_unsigned (insn)"
- "clil %0,0"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:SI 0 "register_operand" "r,r")
- (match_operand:SI 1 "reg_or_cint_operand" "K,r")))]
- "! next_insn_tests_no_unsigned (insn)"
- "@
- clil %0,%1
- cl %0,%1"
- [(set_attr "length" "4,2")
- (set_attr "type" "compare")])
-
-;; Bit test insn. Many cases are converted into this by combine. This
-;; uses the ROMP test bit.
-
-(define_insn ""
- [(set (cc0)
- (zero_extract (match_operand:SI 0 "register_operand" "r,r")
- (const_int 1)
- (match_operand:SI 1 "reg_or_any_cint_operand" "r,n")))]
- "next_insn_tests_no_inequality (insn)"
- "@
- mttb %0,%1
- mttbi%t1 %0,%S1"
- [(set_attr "length" "2")
- (set_attr "type" "compare")
- (set_attr "cc" "tbit")])
-
-;; Floating-point comparisons. There are two, equality and order.
-;; The difference will be that a trap for NaN will be given on the orderr
-;; comparisons only.
-
-(define_expand "cmpsf"
- [(parallel [(set (cc0) (compare (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "cmpdf"
- [(parallel [(set (cc0) (compare (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" "")))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "tstsf"
- [(parallel [(set (cc0) (match_operand:SF 0 "general_operand" ""))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-(define_expand "tstdf"
- [(parallel [(set (cc0) (match_operand:DF 0 "general_operand" ""))
- (clobber (reg:SI 0))
- (clobber (reg:SI 15))])]
- ""
- "")
-
-;; There are four cases for compare and two for test. These correspond
-;; to each input having a floating-point conversion or not.
-
-(define_insn ""
- [(set (cc0) (compare (match_operand 0 "general_operand" "frg")
- (match_operand 1 "general_operand" "frg")))
- (clobber (match_operand:SI 2 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 3 "reg_15_operand" "=&t"))]
- "GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode"
- "*
-{ return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
- operands[0], operands[1], 0, insn);
-}"
- [(set_attr "type" "fp")
- (set_attr "cc" "compare")])
-
-(define_insn ""
- [(set (cc0) (compare (match_operand 0 "general_operand" "frg")
- (match_operator 1 "float_conversion"
- [(match_operand 2 "general_operand" "frg")])))
- (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
- ""
- "*
-{ return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
- operands[0], operands[2], 0, insn);
-}"
- [(set_attr "type" "fp")
- (set_attr "cc" "compare")])
-
-(define_insn ""
- [(set (cc0) (compare (match_operator 0 "float_conversion"
- [(match_operand 1 "general_operand" "frg")])
- (match_operand 2 "general_operand" "frg")))
- (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
- ""
- "*
-{ return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
- operands[1], operands[2], 0, insn);
-}"
- [(set_attr "type" "fp")
- (set_attr "cc" "compare")])
-
-(define_insn ""
- [(set (cc0) (compare (match_operator 0 "float_conversion"
- [(match_operand 1 "general_operand" "frg")])
- (match_operator 2 "float_conversion"
- [(match_operand 3 "general_operand" "frg")])))
- (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
- ""
- "*
-{ return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
- operands[1], operands[3], 0, insn);
-}"
- [(set_attr "type" "fp")
- (set_attr "cc" "compare")])
-
-(define_insn ""
- [(set (cc0) (match_operand 0 "general_operand" "frg"))
- (clobber (match_operand:SI 1 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 2 "reg_15_operand" "=&t"))]
- "GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode"
- "*
-{ return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
- operands[0], CONST0_RTX (GET_MODE (operands[0])),
- 0, insn);
-}"
- [(set_attr "type" "fp")
- (set_attr "cc" "compare")])
-
-(define_insn ""
- [(set (cc0) (match_operator 0 "float_conversion"
- [(match_operand 1 "general_operand" "frg")]))
- (clobber (match_operand:SI 2 "reg_0_operand" "=&z"))
- (clobber (match_operand:SI 3 "reg_15_operand" "=&t"))]
- ""
- "*
-{ return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
- operands[1], CONST0_RTX (GET_MODE (operands[1])),
- 0, insn);
-}"
- [(set_attr "type" "fp")
- (set_attr "cc" "compare")])
-
-;; Branch insns. Unsigned vs. signed have already
-;; been taken care of. The only insns that need to be concerned about the
-;; test bit are beq and bne because the rest are either always true,
-;; always false, or converted to EQ or NE.
-
-;; For conditional branches, we use `define_expand' and just have two patterns
-;; that match them. Operand printing does most of the work.
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "")
-
-;; Define both directions of branch and return.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (restore_compare_p (operands[1]))
- return 0;
- else if (get_attr_length (insn) == 2)
- return \"j%j1 %l0\";
- else
- return \"b%j1%# %l0\";
-}"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(cc0) (const_int 0)])
- (return)
- (pc)))]
- "null_epilogue ()"
- "*
-{
- if (restore_compare_p (operands[0]))
- return 0;
- else
- return \"b%j0r%# r15\";
-}"
- [(set_attr "type" "return")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(cc0) (const_int 0)])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if (restore_compare_p (operands[1]))
- return 0;
- else if (get_attr_length (insn) == 2)
- return \"j%J1 %l0\";
- else
- return \"b%J1%# %l0\";
-}"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(cc0) (const_int 0)])
- (pc)
- (return)))]
- "null_epilogue ()"
- "*
-{
- if (restore_compare_p (operands[0]))
- return 0;
- else
- return \"b%J0r%# r15\";
-}"
- [(set_attr "type" "return")])
-
-;; Unconditional branch and return.
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
-{
- if (get_attr_length (insn) == 2)
- return \"j %l0\";
- else
- return \"b%# %l0\";
-}"
- [(set_attr "type" "branch")])
-
-(define_insn "return"
- [(return)]
- "null_epilogue ()"
- "br%# r15"
- [(set_attr "type" "return")])
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
- ""
- "br%# %0"
- [(set_attr "type" "ibranch")])
-
-;; Table jump for switch statements:
-(define_insn "tablejump"
- [(set (pc)
- (match_operand:SI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "br%# %0"
- [(set_attr "type" "ibranch")])
diff --git a/gcc/config/romp/x-mach b/gcc/config/romp/x-mach
deleted file mode 100644
index a181e1bbbce..00000000000
--- a/gcc/config/romp/x-mach
+++ /dev/null
@@ -1,5 +0,0 @@
-# Ensure that CPATH is used and suppress lots of warnings.
-CC=hc2 -Hcpp -w
-
-# The default `make' on the RT doesn't define MAKE, so do it here.
-MAKE=make
diff --git a/gcc/config/romp/x-romp b/gcc/config/romp/x-romp
deleted file mode 100644
index 82f9e643942..00000000000
--- a/gcc/config/romp/x-romp
+++ /dev/null
@@ -1,11 +0,0 @@
-# obstack.h assumes that if __STDC__ is defined an ANSI C preprocessor is
-# being used. -Hnocpp makes hc use its builtin preprocessor instead of
-# /lib/cpp. gcc doesn't use <sys/ioctl.h>, so it doesn't matter whether
-# fixincludes has been run.
-#
-# hc's warnings do nothing but obscure the output, hence the -w.
-#
-CC=hc -Hnocpp -w -U__STDC__
-
-# The default `make' on the RT doesn't define MAKE, so do it here.
-MAKE=make
diff --git a/gcc/config/romp/xm-romp.h b/gcc/config/romp/xm-romp.h
deleted file mode 100644
index 37de6de8d38..00000000000
--- a/gcc/config/romp/xm-romp.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Configuration for GNU C-compiler for IBM RT PC.
- Copyright (C) 1989, 1991, 1993 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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* If compiled with hc, use the built-in alloca and memcpy.
- These definitions assume hc version 2. */
-#ifdef __HIGHC__
-#define alloca _Alloca
-#define bcopy(s,d,l) memcpy(d,s,l)
-#define FUNCTION_CONVERSION_BUG
-#endif
-
-/* We cannot allow cccp.o to contain a copy of BCOPY as this will
- cause multiple definitions since BLT and BCOPY share an object file
- in libc.a and the library references BLT. */
-#define BSTRING
diff --git a/gcc/config/rs6000/aix31.h b/gcc/config/rs6000/aix31.h
deleted file mode 100644
index 644cee532b6..00000000000
--- a/gcc/config/rs6000/aix31.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Definitions of target machine for GNU compiler,
- for IBM RS/6000 running AIX version 3.1.
- Copyright (C) 1993 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@nyu.edu)
-
-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 "rs6000/rs6000.h"
-
-/* AIX 3.2 defined _AIX32, but older versions do not. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D_IBMR2 -D_AIX -Asystem(unix) -Asystem(aix) -Acpu(rs6000) -Amachine(rs6000)"
-
-/* AIX 3.1 uses bit 15 in CROR as the magic nop. */
-#undef RS6000_CALL_GLUE
-#define RS6000_CALL_GLUE "cror 15,15,15"
diff --git a/gcc/config/rs6000/aix3newas.h b/gcc/config/rs6000/aix3newas.h
deleted file mode 100644
index 9659794d7c8..00000000000
--- a/gcc/config/rs6000/aix3newas.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Definitions of target machine for GNU compiler,
- for IBM RS/6000 POWER running AIX version 3.x with the fixed assembler.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Jason Merrill (jason@cygnus.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. */
-
-
-/* Enable AIX XL compiler calling convention breakage compatibility. */
-#define MASK_XL_CALL 0x40000000
-#define TARGET_XL_CALL (target_flags & MASK_XL_CALL)
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- {"xl-call", MASK_XL_CALL}, \
- {"no-xl-call", - MASK_XL_CALL},
-
-#include "rs6000/rs6000.h"
-
-/* Tell the assembler to assume that all undefined names are external. */
-
-#undef ASM_SPEC
-#define ASM_SPEC "-u %(asm_cpu)"
-
-#undef ASM_DEFAULT_SPEC
-#define ASM_DEFAULT_SPEC "-mpwr"
-
-/* Define the options for the binder: Start text at 512, align all segments
- to 512 bytes, and warn if there is text relocation.
-
- The -bhalt:4 option supposedly changes the level at which ld will abort,
- but it also suppresses warnings about multiply defined symbols and is
- used by the AIX cc command. So we use it here.
-
- -bnodelcsect undoes a poor choice of default relating to multiply-defined
- csects. See AIX documentation for more information about this.
-
- -bM:SRE tells the linker that the output file is Shared REusable. Note
- that to actually build a shared library you will also need to specify an
- export list with the -Wl,-bE option.
-
- If -mcpu=common, export the architecture dependent multiply/divide routines
- as per README.RS6000. */
-
-#undef LINK_SPEC
-#ifndef CROSS_COMPILE
-#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
- %{static:-bnso -bI:/lib/syscalls.exp} \
- %{mcpu=common: milli.exp%s} \
- %{!shared:%{g*:-bexport:/usr/lib/libg.exp}} %{shared:-bM:SRE}"
-#else
-#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
- %{static:-bnso} \
- %{mcpu=common: milli.exp%s} \
- %{shared:-bM:SRE}"
-#endif
-
-/* These are not necessary when we pass -u to the assembler, and undefining
- them saves a great deal of space in object files. */
-
-#undef ASM_OUTPUT_EXTERNAL
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
-{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
- if ((TREE_CODE (DECL) == VAR_DECL \
- || TREE_CODE (DECL) == FUNCTION_DECL) \
- && (NAME)[strlen (NAME) - 1] != ']') \
- { \
- char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
- strcpy (_name, XSTR (_symref, 0)); \
- strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
- XSTR (_symref, 0) = _name; \
- } \
-}
diff --git a/gcc/config/rs6000/aix41.h b/gcc/config/rs6000/aix41.h
deleted file mode 100644
index fe4d757de79..00000000000
--- a/gcc/config/rs6000/aix41.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Definitions of target machine for GNU compiler,
- for IBM RS/6000 POWER running AIX version 4.1.
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by David Edelsohn (edelsohn@npac.syr.edu).
-
-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. */
-
-
-/* Enable AIX XL compiler calling convention breakage compatibility. */
-#define MASK_XL_CALL 0x40000000
-#define TARGET_XL_CALL (target_flags & MASK_XL_CALL)
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- {"xl-call", MASK_XL_CALL}, \
- {"no-xl-call", - MASK_XL_CALL}, \
- {"threads", 0}, \
- {"pe", 0},
-
-#include "rs6000/rs6000.h"
-
-#undef ASM_SPEC
-#define ASM_SPEC "-u %(asm_cpu)"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_AIX41 \
--Asystem(unix) -Asystem(aix)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
- %{mpe: -I/usr/lpp/ppe.poe/include}\
- %{mthreads: -D_THREAD_SAFE}\
- %(cpp_cpu)"
-
-#undef CPP_DEFAULT_SPEC
-#define CPP_DEFAULT_SPEC "-D_ARCH_COM"
-
-#undef ASM_DEFAULT_SPEC
-#define ASM_DEFAULT_SPEC "-mcom"
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT MASK_NEW_MNEMONICS
-
-#undef PROCESSOR_DEFAULT
-#define PROCESSOR_DEFAULT PROCESSOR_PPC601
-
-/* Define this macro as a C expression for the initializer of an
- array of string to tell the driver program which options are
- defaults for this target and thus do not need to be handled
- specially when using `MULTILIB_OPTIONS'.
-
- Do not define this macro if `MULTILIB_OPTIONS' is not defined in
- the target makefile fragment or if none of the options listed in
- `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
-
-#undef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS { "mcpu=common" }
-
-/* These are not necessary when we pass -u to the assembler, and undefining
- them saves a great deal of space in object files. */
-
-#undef ASM_OUTPUT_EXTERNAL
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
-{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
- if ((TREE_CODE (DECL) == VAR_DECL \
- || TREE_CODE (DECL) == FUNCTION_DECL) \
- && (NAME)[strlen (NAME) - 1] != ']') \
- { \
- char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
- strcpy (_name, XSTR (_symref, 0)); \
- strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
- XSTR (_symref, 0) = _name; \
- } \
-}
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
- %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}}\
- %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
- %{mthreads: -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\
- %{!mthreads: -lc}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
- %{static:-bnso %(link_syscalls) } %{!shared: %{g*: %(link_libg) }}\
- %{shared:-bM:SRE %{!e:-bnoentry}}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared:\
- %{mpe:%{pg:/usr/lpp/ppe.poe/lib/gcrt0.o}\
- %{!pg:%{p:/usr/lpp/ppe.poe/lib/mcrt0.o}\
- %{!p:/usr/lpp/ppe.poe/lib/crt0.o}}}\
- %{!mpe:\
- %{mthreads:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\
- %{!mthreads:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}"
-
diff --git a/gcc/config/rs6000/cygwin32.h b/gcc/config/rs6000/cygwin32.h
deleted file mode 100644
index 557b3016ad9..00000000000
--- a/gcc/config/rs6000/cygwin32.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for
- hosting on Windows NT 3.x, using the Cygnus API
-
- This is different to the winnt.h file, since that is used
- to build GCC for use with a windows style library and tool
- set, winnt.h uses the Microsoft tools to do that.
-
- Copyright (C) 1996 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. */
-
-
-/* Ugly hack */
-#include "rs6000/win-nt.h"
-
-
-#ifdef CPP_PREDEFINES
-#undef CPP_PREDEFINES
-#endif
-
-#define CPP_PREDEFINES "-D_WIN32 -DWINNT -D__CYGWIN32__ -DPOSIX \
- -D_POWER -D_ARCH_PPC -D__PPC__ -Asystem(winnt) -Acpu(powerpc) -Amachine(powerpc)"
-
-/* We have to dynamic link to get to the system DLLs. All of libc, libm and
- the Unix stuff is in cygwin.dll. The import library is called
- 'libcygwin.a'. For Windows applications, include more libraries, but
- always include kernel32. We'd like to specific subsystem windows to
- ld, but that doesn't work just yet. */
-
-#undef LIB_SPEC
-#define LIB_SPEC "-lcygwin %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32"
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{v:-V}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "crti%O%s crt0%O%s"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtn%O%s"
-
-#define PTRDIFF_TYPE "int"
-#define WCHAR_UNSIGNED 1
-#define WCHAR_TYPE_SIZE 16
-#define WCHAR_TYPE "short unsigned int"
-
-#define DBX_DEBUGGING_INFO
-#undef SDB_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
diff --git a/gcc/config/rs6000/eabi-ci.asm b/gcc/config/rs6000/eabi-ci.asm
deleted file mode 100644
index 6b753ca1239..00000000000
--- a/gcc/config/rs6000/eabi-ci.asm
+++ /dev/null
@@ -1,119 +0,0 @@
-# crti.s for eabi
-
-# Copyright (C) 1996 Free Software Foundation, Inc.
-# Written By Michael Meissner
-#
-# 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, or (at your option) any
-# later version.
-#
-# In addition to the permissions in the GNU General Public License, the
-# Free Software Foundation gives you unlimited permission to link the
-# compiled version of this file with other programs, and to distribute
-# those programs without any restriction coming from the use of this
-# file. (The General Public License restrictions do apply in other
-# respects; for example, they cover modification of the file, and
-# distribution when not linked into another program.)
-#
-# This file 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; 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 link this library with files
-# compiled with GCC to produce an executable, this does not 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.
-#
-
-# This file just supplies labeled starting points for the .got* and other
-# special sections. It is linked in first before other modules.
-
- .file "crti.s"
- .ident "GNU C crti.s"
-
-#include <ppc-asm.h>
-
- .section ".got","aw"
- .globl __GOT_START__
- .type __GOT_START__,@object
-__GOT_START__:
-
- .section ".got1","aw"
- .globl __GOT1_START__
- .type __GOT1_START__,@object
-__GOT1_START__:
-
- .section ".got2","aw"
- .globl __GOT2_START__
- .type __GOT2_START__,@object
-__GOT2_START__:
-
- .section ".fixup","aw"
- .globl __FIXUP_START__
- .type __FIXUP_START__,@object
-__FIXUP_START__:
-
- .section ".ctors","aw"
- .globl __CTOR_LIST__
- .type __CTOR_LIST__,@object
-__CTOR_LIST__:
-
- .section ".dtors","aw"
- .globl __DTOR_LIST__
- .type __DTOR_LIST__,@object
-__DTOR_LIST__:
-
- .section ".sdata","aw"
- .globl __SDATA_START__
- .type __SDATA_START__,@object
- .weak _SDA_BASE_
- .type _SDA_BASE_,@object
-__SDATA_START__:
-_SDA_BASE_:
-
- .section ".sbss","aw",@nobits
- .globl __SBSS_START__
- .type __SBSS_START__,@object
-__SBSS_START__:
-
- .section ".sdata2","a"
- .weak _SDA2_BASE_
- .type _SDA2_BASE_,@object
- .globl __SDATA2_START__
- .type __SDATA2_START__,@object
-__SDATA2_START__:
-_SDA2_BASE_:
-
- .section ".sbss2","a"
- .globl __SBSS2_START__
- .type __SBSS2_START__,@object
-__SBSS2_START__:
-
- .section ".gcc_except_table","aw"
- .globl __EXCEPT_START__
- .type __EXCEPT_START__,@object
-__EXCEPT_START__:
-
-# Head of __init function used for static constructors in Solaris
- .section ".init","ax"
- .align 2
-FUNC_START(__init)
- stwu 1,-8(1)
- mflr 0
- stw 0,12(1)
-
-# Head of __fini function used for static destructors in Solaris
- .section ".fini","ax"
- .align 2
-FUNC_START(__fini)
- stwu 1,-8(1)
- mflr 0
- stw 0,12(1)
diff --git a/gcc/config/rs6000/eabi-cn.asm b/gcc/config/rs6000/eabi-cn.asm
deleted file mode 100644
index 06e895638dc..00000000000
--- a/gcc/config/rs6000/eabi-cn.asm
+++ /dev/null
@@ -1,109 +0,0 @@
-# crtn.s for eabi
-
-# Copyright (C) 1996 Free Software Foundation, Inc.
-# Written By Michael Meissner
-#
-# 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, or (at your option) any
-# later version.
-#
-# In addition to the permissions in the GNU General Public License, the
-# Free Software Foundation gives you unlimited permission to link the
-# compiled version of this file with other programs, and to distribute
-# those programs without any restriction coming from the use of this
-# file. (The General Public License restrictions do apply in other
-# respects; for example, they cover modification of the file, and
-# distribution when not linked into another program.)
-#
-# This file 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; 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 link this library with files
-# compiled with GCC to produce an executable, this does not 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.
-#
-
-# This file just supplies labeled ending points for the .got* and other
-# special sections. It is linked in last after other modules.
-
- .file "crtn.s"
- .ident "GNU C crtn.s"
-
- .section ".got","aw"
- .globl __GOT_END__
- .type __GOT_END__,@object
-__GOT_END__:
-
- .section ".got1","aw"
- .globl __GOT1_END__
- .type __GOT1_END__,@object
-__GOT1_END__:
-
- .section ".got2","aw"
- .globl __GOT2_END__
- .type __GOT2_END__,@object
-__GOT2_END__:
-
- .section ".fixup","aw"
- .globl __FIXUP_END__
- .type __FIXUP_END__,@object
-__FIXUP_END__:
-
- .section ".ctors","aw"
- .globl __CTOR_END__
- .type __CTOR_END__,@object
-__CTOR_END__:
-
- .section ".dtors","aw"
- .globl __DTOR_END__
- .type __DTOR_END__,@object
-__DTOR_END__:
-
- .section ".sdata","aw"
- .globl __SDATA_END__
- .type __SDATA_END__,@object
-__SDATA_END__:
-
- .section ".sbss","aw",@nobits
- .globl __SBSS_END__
- .type __SBSS_END__,@object
-__SBSS_END__:
-
- .section ".sdata2","a"
- .globl __SDATA2_END__
- .type __SDATA2_END__,@object
-__SDATA2_END__:
-
- .section ".sbss2","a"
- .globl __SBSS2_END__
- .type __SBSS2_END__,@object
-__SBSS2_END__:
-
- .section ".gcc_except_table","aw"
- .globl __EXCEPT_END__
- .type __EXCEPT_END__,@object
-__EXCEPT_END__:
-
-# Tail of __init used for static constructors in Solaris
- .section ".init","ax"
- lwz 0,12(1)
- mtlr 0
- addi 1,1,8
- blr
-
-# Tail of __fini used for static destructors in Solaris
- .section ".fini","ax"
- lwz 0,12(1)
- mtlr 0
- addi 1,1,8
- blr
diff --git a/gcc/config/rs6000/eabi-ctors.c b/gcc/config/rs6000/eabi-ctors.c
deleted file mode 100644
index ebc23ded35c..00000000000
--- a/gcc/config/rs6000/eabi-ctors.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Stripped down support to run global constructors and destructors on
- embedded PowerPC systems.
-
- Copyright (C) 1995 Free Software Foundation, Inc.
- Contributed by Michael Meissner (meissner@cygnus.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. */
-
-/* As a special exception, if you link this library with other files,
- some of which are compiled with GCC, to produce an executable,
- this library 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. */
-
-
-/* Declare a pointer to void function type. */
-
-typedef void (*func_ptr) (void);
-
-/* Declare the set of symbols use as begin and end markers for the lists
- of global object constructors and global object destructors. */
-
-extern func_ptr __CTOR_LIST__[];
-extern func_ptr __CTOR_END__ [];
-extern func_ptr __DTOR_LIST__[];
-extern func_ptr __DTOR_END__ [];
-
-extern void __do_global_ctors (void);
-extern void __do_global_dtors (void);
-
-extern void __init (), __fini ();
-
-/* The Solaris linker seems to incorrectly relocate PC relative relocations
- to a different section (ie, calls to __init, __fini), so avoid it by
- using a function pointer. */
-static void (*init_ptr) (void) = __init;
-static void (*fini_ptr) (void) = __fini;
-
-void (*__atexit)(func_ptr);
-
-/* Call all global constructors */
-void
-__do_global_ctors (void)
-{
- func_ptr *ptr = &__CTOR_LIST__[0];
- func_ptr *end = &__CTOR_END__[0];
-
- if (__atexit)
- __atexit (__do_global_dtors);
-
- /* Call the constructors collected in the .ctors section. */
- for ( ; ptr != end; ptr++)
- if (*ptr)
- (*ptr)();
-
- /* Call the initialization function in the .init section. */
- (*init_ptr) ();
-}
-
-/* Call all global destructors */
-void
-__do_global_dtors (void)
-{
- func_ptr *ptr = &__DTOR_END__[0] - 1;
- func_ptr *start = &__DTOR_LIST__[0];
-
- /* Call the termination function in the .fini section. */
- (*fini_ptr) ();
-
- /* Call the destructors collected in the .dtors section. Run
- the destructors in reverse order. */
- for ( ; ptr >= start; ptr--)
- if (*ptr)
- (*ptr)();
-}
-
diff --git a/gcc/config/rs6000/eabi.asm b/gcc/config/rs6000/eabi.asm
deleted file mode 100644
index 879a63e87ad..00000000000
--- a/gcc/config/rs6000/eabi.asm
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * special support for eabi
- *
- * Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- * Written By Michael Meissner
- *
- * 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, or (at your option) any
- * later version.
- *
- * In addition to the permissions in the GNU General Public License, the
- * Free Software Foundation gives you unlimited permission to link the
- * compiled version of this file with other programs, and to distribute
- * those programs without any restriction coming from the use of this
- * file. (The General Public License restrictions do apply in other
- * respects; for example, they cover modification of the file, and
- * distribution when not linked into another program.)
- *
- * This file 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; 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 link this library with files
- * compiled with GCC to produce an executable, this does not 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.
- */
-
-/* Do any initializations needed for the eabi environment */
-
- .file "eabi.asm"
- .section ".text"
- #include "ppc-asm.h"
-
- .section ".got2","aw"
- .align 2
-.LCTOC1 = . /* +32768 */
-
-/* Table of addresses */
-.Ltable = .-.LCTOC1
- .long .LCTOC1 /* address we are really at */
-
-.Lsda = .-.LCTOC1
- .long _SDA_BASE_ /* address of the first small data area */
-
-.Lsdas = .-.LCTOC1
- .long __SDATA_START__ /* start of .sdata/.sbss section */
-
-.Lsdae = .-.LCTOC1
- .long __SBSS_END__ /* end of .sdata/.sbss section */
-
-.Lsda2 = .-.LCTOC1
- .long _SDA2_BASE_ /* address of the second small data area */
-
-.Lsda2s = .-.LCTOC1
- .long __SDATA2_START__ /* start of .sdata2/.sbss2 section */
-
-.Lsda2e = .-.LCTOC1
- .long __SBSS2_END__ /* end of .sdata2/.sbss2 section */
-
-#ifdef _RELOCATABLE
-.Lgots = .-.LCTOC1
- .long __GOT_START__ /* Global offset table start */
-
-.Lgotm1 = .-.LCTOC1
- .long _GLOBAL_OFFSET_TABLE_-4 /* end of GOT ptrs before BLCL + 3 reserved words */
-
-.Lgotm2 = .-.LCTOC1
- .long _GLOBAL_OFFSET_TABLE_+12 /* start of GOT ptrs after BLCL + 3 reserved words */
-
-.Lgote = .-.LCTOC1
- .long __GOT_END__ /* Global offset table end */
-
-.Lgot2s = .-.LCTOC1
- .long __GOT2_START__ /* -mrelocatable GOT pointers start */
-
-.Lgot2e = .-.LCTOC1
- .long __GOT2_END__ /* -mrelocatable GOT pointers end */
-
-.Lfixups = .-.LCTOC1
- .long __FIXUP_START__ /* start of .fixup section */
-
-.Lfixupe = .-.LCTOC1
- .long __FIXUP_END__ /* end of .fixup section */
-
-.Lctors = .-.LCTOC1
- .long __CTOR_LIST__ /* start of .ctor section */
-
-.Lctore = .-.LCTOC1
- .long __CTOR_END__ /* end of .ctor section */
-
-.Ldtors = .-.LCTOC1
- .long __DTOR_LIST__ /* start of .dtor section */
-
-.Ldtore = .-.LCTOC1
- .long __DTOR_END__ /* end of .dtor section */
-
-.Lexcepts = .-.LCTOC1
- .long __EXCEPT_START__ /* start of .gcc_except_table section */
-
-.Lexcepte = .-.LCTOC1
- .long __EXCEPT_END__ /* end of .gcc_except_table section */
-
-.Linit = .-.LCTOC1
- .long .Linit_p /* address of variable to say we've been called */
-
- .text
- .align 2
-.Lptr:
- .long .LCTOC1-.Laddr /* PC relative pointer to .got2 */
-#endif
-
- .data
- .align 2
-.Linit_p:
- .long 0
-
- .text
-
-FUNC_START(__eabi)
-
-/* Eliminate -mrelocatable code if not -mrelocatable, so that this file can
- be assembled with other assemblers than GAS, such as the Solaris PowerPC
- assembler. */
-
-#ifndef _RELOCATABLE
- addis 10,0,.Linit_p@ha /* init flag */
- addis 11,0,.LCTOC1@ha /* load address of .LCTOC1 */
- lwz 9,.Linit_p@l(10) /* init flag */
- addi 11,11,.LCTOC1@l
- cmplwi 2,9,0 /* init flag != 0? */
- bnelr 2 /* return now, if we've been called already */
- stw 1,.Linit_p@l(10) /* store a non-zero value in the done flag */
-
-#else /* -mrelocatable */
- mflr 0
- bl .Laddr /* get current address */
-.Laddr:
- mflr 12 /* real address of .Laddr */
- lwz 11,(.Lptr-.Laddr)(12) /* linker generated address of .LCTOC1 */
- add 11,11,12 /* correct to real pointer */
- lwz 12,.Ltable(11) /* get linker's idea of where .Laddr is */
- lwz 10,.Linit(11) /* address of init flag */
- subf. 12,12,11 /* calculate difference */
- lwzx 9,10,12 /* done flag */
- cmplwi 2,9,0 /* init flag != 0? */
- bnelr 2 /* return now, if we've been called already */
- stwx 1,10,12 /* store a non-zero value in the done flag */
- beq+ 0,.Lsdata /* skip if we don't need to relocate */
-
-/* We need to relocate the .got2 pointers. */
-
- lwz 3,.Lgot2s(11) /* GOT2 pointers start */
- lwz 4,.Lgot2e(11) /* GOT2 pointers end */
- add 3,12,3 /* adjust pointers */
- add 4,12,4
- bl FUNC_NAME(__eabi_convert) /* convert pointers in .got2 section */
-
-/* Fixup the .ctor section for static constructors */
-
- lwz 3,.Lctors(11) /* constructors pointers start */
- lwz 4,.Lctore(11) /* constructors pointers end */
- bl FUNC_NAME(__eabi_convert) /* convert constructors */
-
-/* Fixup the .dtor section for static destructors */
-
- lwz 3,.Ldtors(11) /* destructors pointers start */
- lwz 4,.Ldtore(11) /* destructors pointers end */
- bl FUNC_NAME(__eabi_convert) /* convert destructors */
-
-/* Fixup the .gcc_except_table section for G++ exceptions */
-
- lwz 3,.Lexcepts(11) /* exception table pointers start */
- lwz 4,.Lexcepte(11) /* exception table pointers end */
- bl FUNC_NAME(__eabi_convert) /* convert exceptions */
-
-/* Fixup the the addresses in the GOT below _GLOBAL_OFFSET_TABLE_-4 */
-
- lwz 3,.Lgots(11) /* GOT table pointers start */
- lwz 4,.Lgotm1(11) /* GOT table pointers below _GLOBAL_OFFSET_TABLE-4 */
- bl FUNC_NAME(__eabi_convert) /* convert lower GOT */
-
-/* Fixup the the addresses in the GOT above _GLOBAL_OFFSET_TABLE_+12 */
-
- lwz 3,.Lgotm2(11) /* GOT table pointers above _GLOBAL_OFFSET_TABLE+12 */
- lwz 4,.Lgote(11) /* GOT table pointers end */
- bl FUNC_NAME(__eabi_convert) /* convert lower GOT */
-
-/* Fixup any user initialized pointers now (the compiler drops pointers to */
-/* each of the relocs that it does in the .fixup section). */
-
-.Lfix:
- lwz 3,.Lfixups(11) /* fixup pointers start */
- lwz 4,.Lfixupe(11) /* fixup pointers end */
- bl FUNC_NAME(__eabi_uconvert) /* convert user initialized pointers */
-
-.Lsdata:
- mtlr 0 /* restore link register */
-#endif /* _RELOCATABLE */
-
-/* Only load up register 13 if there is a .sdata and/or .sbss section */
- lwz 3,.Lsdas(11) /* start of .sdata/.sbss section */
- lwz 4,.Lsdae(11) /* end of .sdata/.sbss section */
- cmpw 1,3,4 /* .sdata/.sbss section non-empty? */
- beq- 1,.Lsda2l /* skip loading r13 */
-
- lwz 13,.Lsda(11) /* load r13 with _SDA_BASE_ address */
-
-/* Only load up register 2 if there is a .sdata2 and/or .sbss2 section */
-
-.Lsda2l:
- lwz 3,.Lsda2s(11) /* start of .sdata/.sbss section */
- lwz 4,.Lsda2e(11) /* end of .sdata/.sbss section */
- cmpw 1,3,4 /* .sdata/.sbss section non-empty? */
- beq+ 1,.Ldone /* skip loading r2 */
-
- lwz 2,.Lsda2(11) /* load r2 with _SDA2_BASE_ address */
-
-/* Done adjusting pointers, return by way of doing the C++ global constructors. */
-
-.Ldone:
- b FUNC_NAME(__do_global_ctors) /* do any C++ global constructors (which returns to caller) */
-FUNC_END(__eabi)
-
-/* Special subroutine to convert a bunch of pointers directly.
- r0 has original link register
- r3 has low pointer to convert
- r4 has high pointer to convert
- r5 .. r10 are scratch registers
- r11 has the address of .LCTOC1 in it.
- r12 has the value to add to each pointer
- r13 .. r31 are unchanged */
-
-FUNC_START(__eabi_convert)
- cmplw 1,3,4 /* any pointers to convert? */
- subf 5,3,4 /* calculate number of words to convert */
- bclr 4,4 /* return if no pointers */
-
- srawi 5,5,2
- addi 3,3,-4 /* start-4 for use with lwzu */
- mtctr 5
-
-.Lcvt:
- lwzu 6,4(3) /* pointer to convert */
- cmpi 0,6,0
- beq- .Lcvt2 /* if pointer is null, don't convert */
-
- add 6,6,12 /* convert pointer */
- stw 6,0(3)
-.Lcvt2:
- bdnz+ .Lcvt
- blr
-
-FUNC_END(__eabi_convert)
-
-/* Special subroutine to convert the pointers the user has initialized. The
- compiler has placed the address of the initialized pointer into the .fixup
- section.
-
- r0 has original link register
- r3 has low pointer to convert
- r4 has high pointer to convert
- r5 .. r10 are scratch registers
- r11 has the address of .LCTOC1 in it.
- r12 has the value to add to each pointer
- r13 .. r31 are unchanged */
-
-FUNC_START(__eabi_uconvert)
- cmplw 1,3,4 /* any pointers to convert? */
- subf 5,3,4 /* calculate number of words to convert */
- bclr 4,4 /* return if no pointers */
-
- srawi 5,5,2
- addi 3,3,-4 /* start-4 for use with lwzu */
- mtctr 5
-
-.Lucvt:
- lwzu 6,4(3) /* next pointer to pointer to convert */
- add 6,6,12 /* adjust pointer */
- lwz 7,0(6) /* get the pointer it points to */
- stw 6,0(3) /* store adjusted pointer */
- add 7,7,12 /* adjust */
- stw 7,0(6)
- bdnz+ .Lucvt
- blr
-
-FUNC_END(__eabi_uconvert)
-
-/* Routines for saving floating point registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the floating point save area. */
-
-FUNC_START(_savefpr_14) stfd 14,-144(11) /* save fp registers */
-FUNC_START(_savefpr_15) stfd 15,-136(11)
-FUNC_START(_savefpr_16) stfd 16,-128(11)
-FUNC_START(_savefpr_17) stfd 17,-120(11)
-FUNC_START(_savefpr_18) stfd 18,-112(11)
-FUNC_START(_savefpr_19) stfd 19,-104(11)
-FUNC_START(_savefpr_20) stfd 20,-96(11)
-FUNC_START(_savefpr_21) stfd 21,-88(11)
-FUNC_START(_savefpr_22) stfd 22,-80(11)
-FUNC_START(_savefpr_23) stfd 23,-72(11)
-FUNC_START(_savefpr_24) stfd 24,-64(11)
-FUNC_START(_savefpr_25) stfd 25,-56(11)
-FUNC_START(_savefpr_26) stfd 26,-48(11)
-FUNC_START(_savefpr_27) stfd 27,-40(11)
-FUNC_START(_savefpr_28) stfd 28,-32(11)
-FUNC_START(_savefpr_29) stfd 29,-24(11)
-FUNC_START(_savefpr_30) stfd 30,-16(11)
-FUNC_START(_savefpr_31) stfd 31,-8(11)
- blr
-FUNC_END(_savefpr_31)
-FUNC_END(_savefpr_30)
-FUNC_END(_savefpr_29)
-FUNC_END(_savefpr_28)
-FUNC_END(_savefpr_27)
-FUNC_END(_savefpr_26)
-FUNC_END(_savefpr_25)
-FUNC_END(_savefpr_24)
-FUNC_END(_savefpr_23)
-FUNC_END(_savefpr_22)
-FUNC_END(_savefpr_21)
-FUNC_END(_savefpr_20)
-FUNC_END(_savefpr_19)
-FUNC_END(_savefpr_18)
-FUNC_END(_savefpr_17)
-FUNC_END(_savefpr_16)
-FUNC_END(_savefpr_15)
-FUNC_END(_savefpr_14)
-
-/* Routines for saving integer registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the integer save area. */
-
-FUNC_START(_savegpr_14) stw 14,-72(11) /* save gp registers */
-FUNC_START(_savegpr_15) stw 15,-68(11)
-FUNC_START(_savegpr_16) stw 16,-64(11)
-FUNC_START(_savegpr_17) stw 17,-60(11)
-FUNC_START(_savegpr_18) stw 18,-56(11)
-FUNC_START(_savegpr_19) stw 19,-52(11)
-FUNC_START(_savegpr_20) stw 20,-48(11)
-FUNC_START(_savegpr_21) stw 21,-44(11)
-FUNC_START(_savegpr_22) stw 22,-40(11)
-FUNC_START(_savegpr_23) stw 23,-36(11)
-FUNC_START(_savegpr_24) stw 24,-32(11)
-FUNC_START(_savegpr_25) stw 25,-28(11)
-FUNC_START(_savegpr_26) stw 26,-24(11)
-FUNC_START(_savegpr_27) stw 27,-20(11)
-FUNC_START(_savegpr_28) stw 28,-16(11)
-FUNC_START(_savegpr_29) stw 29,-12(11)
-FUNC_START(_savegpr_30) stw 30,-8(11)
-FUNC_START(_savegpr_31) stw 31,-4(11)
- blr
-FUNC_END(_savegpr_31)
-FUNC_END(_savegpr_30)
-FUNC_END(_savegpr_29)
-FUNC_END(_savegpr_28)
-FUNC_END(_savegpr_27)
-FUNC_END(_savegpr_26)
-FUNC_END(_savegpr_25)
-FUNC_END(_savegpr_24)
-FUNC_END(_savegpr_23)
-FUNC_END(_savegpr_22)
-FUNC_END(_savegpr_21)
-FUNC_END(_savegpr_20)
-FUNC_END(_savegpr_19)
-FUNC_END(_savegpr_18)
-FUNC_END(_savegpr_17)
-FUNC_END(_savegpr_16)
-FUNC_END(_savegpr_15)
-FUNC_END(_savegpr_14)
-
-/* Routines for restoring floating point registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the floating point save area. */
-
-FUNC_START(_restfpr_14) lfd 14,-144(11) /* restore fp registers */
-FUNC_START(_restfpr_15) lfd 15,-136(11)
-FUNC_START(_restfpr_16) lfd 16,-128(11)
-FUNC_START(_restfpr_17) lfd 17,-120(11)
-FUNC_START(_restfpr_18) lfd 18,-112(11)
-FUNC_START(_restfpr_19) lfd 19,-104(11)
-FUNC_START(_restfpr_20) lfd 20,-96(11)
-FUNC_START(_restfpr_21) lfd 21,-88(11)
-FUNC_START(_restfpr_22) lfd 22,-80(11)
-FUNC_START(_restfpr_23) lfd 23,-72(11)
-FUNC_START(_restfpr_24) lfd 24,-64(11)
-FUNC_START(_restfpr_25) lfd 25,-56(11)
-FUNC_START(_restfpr_26) lfd 26,-48(11)
-FUNC_START(_restfpr_27) lfd 27,-40(11)
-FUNC_START(_restfpr_28) lfd 28,-32(11)
-FUNC_START(_restfpr_29) lfd 29,-24(11)
-FUNC_START(_restfpr_30) lfd 30,-16(11)
-FUNC_START(_restfpr_31) lfd 31,-8(11)
- blr
-FUNC_END(_restfpr_31)
-FUNC_END(_restfpr_30)
-FUNC_END(_restfpr_29)
-FUNC_END(_restfpr_28)
-FUNC_END(_restfpr_27)
-FUNC_END(_restfpr_26)
-FUNC_END(_restfpr_25)
-FUNC_END(_restfpr_24)
-FUNC_END(_restfpr_23)
-FUNC_END(_restfpr_22)
-FUNC_END(_restfpr_21)
-FUNC_END(_restfpr_20)
-FUNC_END(_restfpr_19)
-FUNC_END(_restfpr_18)
-FUNC_END(_restfpr_17)
-FUNC_END(_restfpr_16)
-FUNC_END(_restfpr_15)
-FUNC_END(_restfpr_14)
-
-/* Routines for restoring integer registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the integer restore area. */
-
-FUNC_START(_restgpr_14) lwz 14,-72(11) /* restore gp registers */
-FUNC_START(_restgpr_15) lwz 15,-68(11)
-FUNC_START(_restgpr_16) lwz 16,-64(11)
-FUNC_START(_restgpr_17) lwz 17,-60(11)
-FUNC_START(_restgpr_18) lwz 18,-56(11)
-FUNC_START(_restgpr_19) lwz 19,-52(11)
-FUNC_START(_restgpr_20) lwz 20,-48(11)
-FUNC_START(_restgpr_21) lwz 21,-44(11)
-FUNC_START(_restgpr_22) lwz 22,-40(11)
-FUNC_START(_restgpr_23) lwz 23,-36(11)
-FUNC_START(_restgpr_24) lwz 24,-32(11)
-FUNC_START(_restgpr_25) lwz 25,-28(11)
-FUNC_START(_restgpr_26) lwz 26,-24(11)
-FUNC_START(_restgpr_27) lwz 27,-20(11)
-FUNC_START(_restgpr_28) lwz 28,-16(11)
-FUNC_START(_restgpr_29) lwz 29,-12(11)
-FUNC_START(_restgpr_30) lwz 30,-8(11)
-FUNC_START(_restgpr_31) lwz 31,-4(11)
- blr
-FUNC_END(_restgpr_31)
-FUNC_END(_restgpr_30)
-FUNC_END(_restgpr_29)
-FUNC_END(_restgpr_28)
-FUNC_END(_restgpr_27)
-FUNC_END(_restgpr_26)
-FUNC_END(_restgpr_25)
-FUNC_END(_restgpr_24)
-FUNC_END(_restgpr_23)
-FUNC_END(_restgpr_22)
-FUNC_END(_restgpr_21)
-FUNC_END(_restgpr_20)
-FUNC_END(_restgpr_19)
-FUNC_END(_restgpr_18)
-FUNC_END(_restgpr_17)
-FUNC_END(_restgpr_16)
-FUNC_END(_restgpr_15)
-FUNC_END(_restgpr_14)
-
-/* Routines for restoring floating point registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the floating point save area. */
-/* In addition to restoring the fp registers, it will return to the caller's */
-/* caller */
-
-FUNC_START(_restfpr_14_x) lfd 14,-144(11) /* restore fp registers */
-FUNC_START(_restfpr_15_x) lfd 15,-136(11)
-FUNC_START(_restfpr_16_x) lfd 16,-128(11)
-FUNC_START(_restfpr_17_x) lfd 17,-120(11)
-FUNC_START(_restfpr_18_x) lfd 18,-112(11)
-FUNC_START(_restfpr_19_x) lfd 19,-104(11)
-FUNC_START(_restfpr_20_x) lfd 20,-96(11)
-FUNC_START(_restfpr_21_x) lfd 21,-88(11)
-FUNC_START(_restfpr_22_x) lfd 22,-80(11)
-FUNC_START(_restfpr_23_x) lfd 23,-72(11)
-FUNC_START(_restfpr_24_x) lfd 24,-64(11)
-FUNC_START(_restfpr_25_x) lfd 25,-56(11)
-FUNC_START(_restfpr_26_x) lfd 26,-48(11)
-FUNC_START(_restfpr_27_x) lfd 27,-40(11)
-FUNC_START(_restfpr_28_x) lfd 28,-32(11)
-FUNC_START(_restfpr_29_x) lfd 29,-24(11)
-FUNC_START(_restfpr_30_x) lfd 30,-16(11)
-FUNC_START(_restfpr_31_x) lwz 0,4(11)
- lfd 31,-8(11)
- mtlr 0
- mr 1,11
- blr
-FUNC_END(_restfpr_31_x)
-FUNC_END(_restfpr_30_x)
-FUNC_END(_restfpr_29_x)
-FUNC_END(_restfpr_28_x)
-FUNC_END(_restfpr_27_x)
-FUNC_END(_restfpr_26_x)
-FUNC_END(_restfpr_25_x)
-FUNC_END(_restfpr_24_x)
-FUNC_END(_restfpr_23_x)
-FUNC_END(_restfpr_22_x)
-FUNC_END(_restfpr_21_x)
-FUNC_END(_restfpr_20_x)
-FUNC_END(_restfpr_19_x)
-FUNC_END(_restfpr_18_x)
-FUNC_END(_restfpr_17_x)
-FUNC_END(_restfpr_16_x)
-FUNC_END(_restfpr_15_x)
-FUNC_END(_restfpr_14_x)
-
-/* Routines for restoring integer registers, called by the compiler. */
-/* Called with r11 pointing to the stack header word of the caller of the */
-/* function, just beyond the end of the integer restore area. */
-
-FUNC_START(_restgpr_14_x) lwz 14,-72(11) /* restore gp registers */
-FUNC_START(_restgpr_15_x) lwz 15,-68(11)
-FUNC_START(_restgpr_16_x) lwz 16,-64(11)
-FUNC_START(_restgpr_17_x) lwz 17,-60(11)
-FUNC_START(_restgpr_18_x) lwz 18,-56(11)
-FUNC_START(_restgpr_19_x) lwz 19,-52(11)
-FUNC_START(_restgpr_20_x) lwz 20,-48(11)
-FUNC_START(_restgpr_21_x) lwz 21,-44(11)
-FUNC_START(_restgpr_22_x) lwz 22,-40(11)
-FUNC_START(_restgpr_23_x) lwz 23,-36(11)
-FUNC_START(_restgpr_24_x) lwz 24,-32(11)
-FUNC_START(_restgpr_25_x) lwz 25,-28(11)
-FUNC_START(_restgpr_26_x) lwz 26,-24(11)
-FUNC_START(_restgpr_27_x) lwz 27,-20(11)
-FUNC_START(_restgpr_28_x) lwz 28,-16(11)
-FUNC_START(_restgpr_29_x) lwz 29,-12(11)
-FUNC_START(_restgpr_30_x) lwz 30,-8(11)
-FUNC_START(_restgpr_31_x) lwz 0,4(11)
- lwz 31,-4(11)
- mtlr 0
- mr 1,11
- blr
-FUNC_END(_restgpr_31_x)
-FUNC_END(_restgpr_30_x)
-FUNC_END(_restgpr_29_x)
-FUNC_END(_restgpr_28_x)
-FUNC_END(_restgpr_27_x)
-FUNC_END(_restgpr_26_x)
-FUNC_END(_restgpr_25_x)
-FUNC_END(_restgpr_24_x)
-FUNC_END(_restgpr_23_x)
-FUNC_END(_restgpr_22_x)
-FUNC_END(_restgpr_21_x)
-FUNC_END(_restgpr_20_x)
-FUNC_END(_restgpr_19_x)
-FUNC_END(_restgpr_18_x)
-FUNC_END(_restgpr_17_x)
-FUNC_END(_restgpr_16_x)
-FUNC_END(_restgpr_15_x)
-FUNC_END(_restgpr_14_x)
diff --git a/gcc/config/rs6000/eabi.h b/gcc/config/rs6000/eabi.h
deleted file mode 100644
index 1c225ea35dc..00000000000
--- a/gcc/config/rs6000/eabi.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Core target definitions for GNU compiler
- for IBM RS/6000 PowerPC targeted to embedded ELF systems.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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 "rs6000/sysv4.h"
-
-/* Add -meabi to target flags */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI)
-
-/* Invoke an initializer function to set up the GOT */
-#define NAME__MAIN "__eabi"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (PowerPC Embedded)");
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-DPPC -D__embedded__ -Asystem(embedded) -Acpu(powerpc) -Amachine(powerpc)"
-
-#undef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
diff --git a/gcc/config/rs6000/eabiaix.h b/gcc/config/rs6000/eabiaix.h
deleted file mode 100644
index 5cfd890a03e..00000000000
--- a/gcc/config/rs6000/eabiaix.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Embedded ELF system support, using old AIX based calling sequence.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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 "rs6000/eabi.h"
-
-/* Default ABI to use */
-#undef RS6000_ABI_NAME
-#define RS6000_ABI_NAME "aix"
-
-#undef CPP_SYSV_DEFAULT_SPEC
-#define CPP_SYSV_DEFAULT_SPEC "-D_CALL_AIX"
-
-/* Define this macro as a C expression for the initializer of an
- array of string to tell the driver program which options are
- defaults for this target and thus do not need to be handled
- specially when using `MULTILIB_OPTIONS'.
-
- Do not define this macro if `MULTILIB_OPTIONS' is not defined in
- the target makefile fragment or if none of the options listed in
- `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
-
-#undef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS { "mbig", "mcall-aix" }
diff --git a/gcc/config/rs6000/eabile.h b/gcc/config/rs6000/eabile.h
deleted file mode 100644
index 78dc7bc89c4..00000000000
--- a/gcc/config/rs6000/eabile.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Core target definitions for GNU compiler for PowerPC targeted to
- little endian embedded ELF systems.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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 "rs6000/eabi.h"
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_LITTLE_ENDIAN | MASK_EABI)
-
-#undef CPP_ENDIAN_DEFAULT_SPEC
-#define CPP_ENDIAN_DEFAULT_SPEC "%(cpp_endian_little)"
-
-#undef LINK_TARGET_SPEC
-#define LINK_TARGET_SPEC "\
-%{mbig: -oformat elf32-powerpc } %{mbig-endian: -oformat elf32-powerpc } \
-%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-linux: -oformat elf32-powerpc}}}}}"
-
-/* Define this macro as a C expression for the initializer of an
- array of string to tell the driver program which options are
- defaults for this target and thus do not need to be handled
- specially when using `MULTILIB_OPTIONS'.
-
- Do not define this macro if `MULTILIB_OPTIONS' is not defined in
- the target makefile fragment or if none of the options listed in
- `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
-
-#undef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS { "mlittle", "mcall-sysv" }
diff --git a/gcc/config/rs6000/eabilesim.h b/gcc/config/rs6000/eabilesim.h
deleted file mode 100644
index 7ced05c7cb2..00000000000
--- a/gcc/config/rs6000/eabilesim.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Support for GCC on simulated PowerPC systems targeted to embedded ELF
- systems.
- Copyright (C) 1995 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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 "rs6000/eabile.h"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (PowerPC Simulated)");
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-DPPC -D__embedded__ -D__simulator__ -Asystem(embedded) -Asystem(simulator) -Acpu(powerpc) -Amachine(powerpc)"
-
-/* Make the simulator the default */
-#undef LIB_DEFAULT_SPEC
-#define LIB_DEFAULT_SPEC "%(lib_sim)"
-
-#undef STARTFILE_DEFAULT_SPEC
-#define STARTFILE_DEFAULT_SPEC "%(startfile_sim)"
-
-#undef ENDFILE_DEFAULT_SPEC
-#define ENDFILE_DEFAULT_SPEC "%(endfile_sim)"
-
-#undef LINK_START_DEFAULT_SPEC
-#define LINK_START_DEFAULT_SPEC "%(link_start_sim)"
-
-#undef LINK_OS_DEFAULT_SPEC
-#define LINK_OS_DEFAULT_SPEC "%(link_start_sim)"
diff --git a/gcc/config/rs6000/eabisim.h b/gcc/config/rs6000/eabisim.h
deleted file mode 100644
index 0fc590bd6f2..00000000000
--- a/gcc/config/rs6000/eabisim.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Support for GCC on simulated PowerPC systems targeted to embedded ELF
- systems.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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 "rs6000/eabi.h"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (PowerPC Simulated)");
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-DPPC -D__embedded__ -D__simulator__ -Asystem(embedded) -Asystem(simulator) -Acpu(powerpc) -Amachine(powerpc)"
-
-/* Make the simulator the default */
-#undef LIB_DEFAULT_SPEC
-#define LIB_DEFAULT_SPEC "%(lib_sim)"
-
-#undef STARTFILE_DEFAULT_SPEC
-#define STARTFILE_DEFAULT_SPEC "%(startfile_sim)"
-
-#undef ENDFILE_DEFAULT_SPEC
-#define ENDFILE_DEFAULT_SPEC "%(endfile_sim)"
-
-#undef LINK_START_DEFAULT_SPEC
-#define LINK_START_DEFAULT_SPEC "%(link_start_sim)"
-
-#undef LINK_OS_DEFAULT_SPEC
-#define LINK_OS_DEFAULT_SPEC "%(link_os_sim)"
diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
deleted file mode 100644
index 7540f62dd6b..00000000000
--- a/gcc/config/rs6000/linux.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Definitions of target machine for GNU compiler,
- for IBM RS/6000 running AIX version 3.1.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Michael Meissner (meissner@cygnus.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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "rs6000/sysv4.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-DPPC -Dunix -Dlinux -Dpowerpc -Asystem(unix) -Asystem(linux) -Acpu(powerpc) -Amachine(powerpc)"
-
-/* For now, remove most of the System V.4 stuff */
-#undef LINK_SPEC
-#define LINK_SPEC ""
-
-#undef LIB_DEFAULT_SPEC
-#define LIB_DEFAULT_SPEC "%(lib_linux)"
-
-#undef STARTFILE_DEFAULT_SPEC
-#define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
-
-#undef ENDFILE_DEFAULT_SPEC
-#define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
-
-#undef LINK_START_DEFAULT_SPEC
-#define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
-
-#undef LINK_OS_DEFAULT_SPEC
-#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (PowerPC Linux)");
-
-/* Define this macro as a C expression for the initializer of an
- array of string to tell the driver program which options are
- defaults for this target and thus do not need to be handled
- specially when using `MULTILIB_OPTIONS'.
-
- Do not define this macro if `MULTILIB_OPTIONS' is not defined in
- the target makefile fragment or if none of the options listed in
- `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
-
-#undef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS { "mbig", "mcall-linux" }
diff --git a/gcc/config/rs6000/lynx.h b/gcc/config/rs6000/lynx.h
deleted file mode 100644
index e2fe6339fe4..00000000000
--- a/gcc/config/rs6000/lynx.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Definitions for Rs6000 running LynxOS.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by David Henkel-Wallace, Cygnus Support (gumby@cygnus.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 <lynx.h>
-
-/* Definitions we want to override with those from rs6000.h: */
-#undef LIB_SPEC
-#undef PTRDIFF_TYPE
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-#undef ASM_FILE_START
-#undef EXTRA_SECTIONS
-#undef READONLY_DATA_SECTION
-#undef EXTRA_SECTION_FUNCTIONS
-#undef SELECT_RTX_SECTION
-#undef SELECT_SECTION
-#undef USER_LABEL_PREFIX
-#undef ASM_OUTPUT_LABELREF
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#undef ASM_GENERATE_INTERNAL_LABEL
-#undef ASM_OUTPUT_COMMON
-#undef ASM_OUTPUT_LOCAL
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-#undef CTORS_SECTION_FUNCTION
-#undef DTORS_SECTION_FUNCTION
-
-#undef SDB_DEBUGGING_INFO
-#undef DBX_DEBUGGING_INFO
-#undef PREFERRED_DEBUGGING_TYPE
-
-#undef FUNCTION_PROFILER
-
-#include <rs6000/rs6000.h>
-
-/* LynxOS has signed chars, regardless of what most R/S 6000 systems do */
-#undef DEFAULT_SIGNED_CHAR
-#define DEFAULT_SIGNED_CHAR 1
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Acpu(rs6000) -Amachine(rs6000) -Asystem(lynx) -Asystem(unix) -DLynx -D_IBMR2 -Dunix -Drs6000 -Dlynx -DLYNX"
-
-#undef LINK_SPEC
-#define LINK_SPEC "-T0x10001000 -H0x1000 -D0x20000000 -btextro -bhalt:4 -bnodelcsect -bnso -bro -bnoglink %{v} %{b*}"
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{mthreads:-L/lib/thread/} \
- %{msystem-v:-lc_v -lm.v} \
- %{!msystem-v:%{mposix:-lc_p} -lc -lm}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{p:%{mthreads:thread/pinit.o%s}%{!mthreads:pinit.o%s}}%{!p:%{msystem-v:vinit.o%s -e_start}%{!msystem-v:%{mthreads:thread/init.o%s}%{!mthreads:init.o%s}}}"
-
-#undef ENDFILE_SPEC
-
-/* This can become more refined as we have more powerpc options. */
-#undef ASM_SPEC
-#define ASM_SPEC "-u %(asm_cpu)"
-
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- {"threads", MASK_THREADS}, \
- {"posix", MASK_POSIX}, \
- {"system-v", MASK_SYSTEM_V},
-
-#undef SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-do { \
- if (TARGET_SYSTEM_V && profile_flag) \
- warning ("-msystem-v and -p are incompatible"); \
- if (TARGET_SYSTEM_V && TARGET_THREADS) \
- warning ("-msystem-v and -mthreads are incompatible"); \
-} while (0)
-
-/* For collect2 */
-#define OBJECT_FORMAT_NONE
-#undef OBJECT_FORMAT_COFF
-#undef OBJECT_FORMAT_ROSE
-#undef MD_EXEC_PREFIX
-#undef REAL_LD_FILE_NAME
-#undef REAL_NM_FILE_NAME
-#undef REAL_STRIP_FILE_NAME
-
-/* LynxOS doesn't have mcount. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(file, profile_label_no)
diff --git a/gcc/config/rs6000/mach.h b/gcc/config/rs6000/mach.h
deleted file mode 100644
index bb4e8b4df84..00000000000
--- a/gcc/config/rs6000/mach.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Definitions of target machine for GNU compiler,
- for IBM RS/6000 running MACH.
- Copyright (C) 1992 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@nyu.edu)
-
-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. */
-
-#define TARGET_AIX 0
-
-#include "rs6000/rs6000.h"
-
-/* We don't define AIX under MACH; instead we define `unix'. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Drios -D_IBMR2 -Dunix -Asystem(unix) -Asystem(mach) -Acpu(rs6000) -Amachine(rs6000)"
-
-/* Define different binder options for MACH. */
-#undef LINK_SPEC
-#define LINK_SPEC \
- "-T0x10000000 -D0x20000000 -K %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
- -bnoso -berrmsg -btextro -bhalt:4 -bnodelcsect"
-
-/* MACH doesn't have atexit. */
-#undef HAVE_ATEXIT
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/rs6000/milli.exp b/gcc/config/rs6000/milli.exp
deleted file mode 100644
index ea3a2b757fe..00000000000
--- a/gcc/config/rs6000/milli.exp
+++ /dev/null
@@ -1,7 +0,0 @@
-#!
-__mulh 0x3100
-__mull 0x3180
-__divss 0x3200
-__divus 0x3280
-__quoss 0x3300
-__quous 0x3380
diff --git a/gcc/config/rs6000/netware.h b/gcc/config/rs6000/netware.h
deleted file mode 100644
index f6de2aab0ea..00000000000
--- a/gcc/config/rs6000/netware.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/* Core target definitions for GNU compiler
- for IBM RS/6000 PowerPC running NetWare
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#define TARGET_AIX 0
-
-#include "rs6000/powerpc.h"
-
-/* Don't generate XCOFF debugging information. */
-
-#undef XCOFF_DEBUGGING_INFO
-
-/* Don't use the COFF object file format. */
-
-#undef OBJECT_FORMAT_COFF
-
-/* The XCOFF support uses weird symbol suffixes, which we don't want
- for ELF. */
-
-#undef STRIP_NAME_ENCODING
-
-/* Don't bother to output .extern pseudo-ops. They are not needed by
- ELF assemblers. */
-
-#undef ASM_OUTPUT_EXTERNAL
-
-/* Undefine some things which are defined by the generic svr4.h. */
-
-#undef ASM_FILE_END
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-#undef READONLY_DATA_SECTION
-#undef SELECT_SECTION
-#undef ASM_DECLARE_FUNCTION_NAME
-
-/* Use the regular svr4 definitions. */
-
-#include "svr4.h"
-#include "netware.h"
-
-/* Create a function descriptor when we declare a function name. This
- is a mixture of the ASM_DECLARE_FUNCTION_NAME macros in rs6000.h
- and svr4.h. The unmodified function name is used to name the
- descriptor. The function name with an initial `.' is used to name
- the code. */
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- if (TREE_PUBLIC (DECL)) \
- { \
- fprintf (FILE, "\t.globl ."); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } \
- data_section (); \
- ASM_OUTPUT_ALIGN (FILE, 2); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
- fprintf (FILE, "\t.long ."); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ", __GOT0, 0\n"); \
- text_section (); \
- fprintf (FILE, "."); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
- } while (0)
-
-/* We need to override the .size output in order to put a `.' before
- the function name. */
-
-#undef ASM_DECLARE_FUNCTION_SIZE
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
- do { \
- if (!flag_inhibit_size_directive) \
- { \
- char label[256]; \
- static int labelno; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ","); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-."); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } while (0)
-
-/* Use ELF style section commands. */
-
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
-
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP "\t.section\t\".data\""
-
-/* Besides the usual ELF sections, we need a toc section. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
- TOC_SECTION_FUNCTION
-
-#define TOC_SECTION_FUNCTION \
-void \
-toc_section () \
-{ \
- if (TARGET_MINIMAL_TOC) \
- { \
- static int toc_initialized = 0; \
- \
- if (! toc_initialized) \
- { \
- fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
- fprintf (asm_out_file, ".LCTOC0:\n"); \
- fprintf (asm_out_file, "\t.tc .LCTOC1\n"); \
- fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
- fprintf (asm_out_file, ".LCTOC1:\n"); \
- toc_initialized = 1; \
- } \
- } \
- \
- if (in_section != in_toc) \
- { \
- fprintf (asm_out_file, "%s\n", \
- (TARGET_MINIMAL_TOC \
- ? MINIMAL_TOC_SECTION_ASM_OP \
- : TOC_SECTION_ASM_OP)); \
- in_section = in_toc; \
- } \
-}
-
-#define TOC_SECTION_ASM_OP "\t.section\t.got,\"aw\""
-#define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t.got1,\"aw\""
-
-/* Use the TOC section for TOC entries. */
-
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE, X) \
-{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
- toc_section (); \
- else \
- const_section (); \
-}
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL_PREFIX
-#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
- fprintf (FILE, ".%s", PREFIX)
-
-#undef ASM_SPEC
-#define ASM_SPEC "-u %(asm_cpu) \
-{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
-/* This is the end of what might become sysv4.h. */
-
-/* Enable output of DBX (stabs) debugging information when asked for it. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Prefer DBX (stabs) debugging information over the native (DWARF) format. */
-
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* Line numbers are relative to the current function. */
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- { static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,.LM%d-.%s\n.LM%d:\n",\
- line, sym_lineno, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0), \
- sym_lineno); \
- sym_lineno += 1; }
-
-/* But, to make this work, we have to output the stabs for the function
- name *first*... */
-
-#define DBX_FUNCTION_FIRST
-
-/* We need to output LBRAC and RBRAC lines specially to include the
- dot in from of the text symbol for a function. */
-
-#define DBX_OUTPUT_LBRAC(FILE, BUF) \
-do \
- { \
- fprintf (FILE, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \
- assemble_name (FILE, BUF); \
- fprintf (FILE, "-."); \
- assemble_name (asmfile, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- fprintf (asmfile, "\n"); \
- } \
-while (0)
-
-#define DBX_OUTPUT_RBRAC(FILE, BUF) \
-do \
- { \
- fprintf (FILE, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \
- assemble_name (FILE, BUF); \
- fprintf (FILE, "-."); \
- assemble_name (asmfile, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- fprintf (asmfile, "\n"); \
- } \
-while (0)
-
-/* We are using function descriptors, so the value of a function
- symbol is in the .data section. However, we want the stabs entry
- for that function to point at the actual function code in the .text
- section, which we get by prefixing the symbol with a dot. */
-
-#define DBX_FINISH_SYMBOL(sym) \
-do { \
- int line = 0; \
- if (use_gnu_debug_info_extensions && sym != 0) \
- line = DECL_SOURCE_LINE (sym); \
- \
- fprintf (asmfile, "\",%d,0,%d,", current_sym_code, line); \
- if (current_sym_addr) \
- { \
- if (TREE_CODE (sym) == FUNCTION_DECL) \
- fprintf (asmfile, "."); \
- output_addr_const (asmfile, current_sym_addr); \
- } \
- else \
- fprintf (asmfile, "%d", current_sym_value); \
- putc ('\n', asmfile); \
-} while (0)
-
-/* This is the end of what might become sysv4dbx.h. */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (PowerPC Netware)");
-
-/* FIXME: These should actually indicate PowerPC, when there is some
- standard way of expressing that. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-DPPC D__netware__ -Asystem(netware) -Acpu(powerpc) -Amachine(powerpc)"
diff --git a/gcc/config/rs6000/nt-ci.asm b/gcc/config/rs6000/nt-ci.asm
deleted file mode 100644
index 67ca9564abf..00000000000
--- a/gcc/config/rs6000/nt-ci.asm
+++ /dev/null
@@ -1,48 +0,0 @@
-# crti.s for Windows NT
-
-# Copyright (C) 1996 Free Software Foundation, Inc.
-# Written By Michael Meissner
-#
-# 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, or (at your option) any
-# later version.
-#
-# In addition to the permissions in the GNU General Public License, the
-# Free Software Foundation gives you unlimited permission to link the
-# compiled version of this file with other programs, and to distribute
-# those programs without any restriction coming from the use of this
-# file. (The General Public License restrictions do apply in other
-# respects; for example, they cover modification of the file, and
-# distribution when not linked into another program.)
-#
-# This file 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; 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 link this library with files
-# compiled with GCC to produce an executable, this does not 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.
-#
-
-# This file just supplies labeled starting points for the static constructors
-# and destructors. It is linked in first before other modules.
-
- .file "crti.s"
- .ident "GNU C crti.s"
-
- .section .ctors,"w"
- .globl __CTOR_LIST__
-__CTOR_LIST__:
-
- .section .dtors,"w"
- .globl __DTOR_LIST__
-__DTOR_LIST__:
diff --git a/gcc/config/rs6000/nt-cn.asm b/gcc/config/rs6000/nt-cn.asm
deleted file mode 100644
index dd6daf29b2e..00000000000
--- a/gcc/config/rs6000/nt-cn.asm
+++ /dev/null
@@ -1,48 +0,0 @@
-# crtn.s for Windows NT
-
-# Copyright (C) 1996 Free Software Foundation, Inc.
-# Written By Michael Meissner
-#
-# 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, or (at your option) any
-# later version.
-#
-# In addition to the permissions in the GNU General Public License, the
-# Free Software Foundation gives you unlimited permission to link the
-# compiled version of this file with other programs, and to distribute
-# those programs without any restriction coming from the use of this
-# file. (The General Public License restrictions do apply in other
-# respects; for example, they cover modification of the file, and
-# distribution when not linked into another program.)
-#
-# This file 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; 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 link this library with files
-# compiled with GCC to produce an executable, this does not 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.
-#
-
-# This file just supplies labeled ending points for the static constructors
-# and destructors. It is linked in last after other modules.
-
- .file "crtn.s"
- .ident "GNU C crtn.s"
-
- .section .ctors,"w"
- .globl __CTOR_END__
-__CTOR_END__:
-
- .section .dtors,"w"
- .globl __DTOR_END__
-__DTOR_END__:
diff --git a/gcc/config/rs6000/ntstack.asm b/gcc/config/rs6000/ntstack.asm
deleted file mode 100644
index aa4179e7a79..00000000000
--- a/gcc/config/rs6000/ntstack.asm
+++ /dev/null
@@ -1,42 +0,0 @@
-# Allocate stack for NT, inserting stack probes every 4k pages
-
- .file "ntstack.asm"
-
-# Setup MS Structured-Exception-Handling
- .pdata
- .align 2
- .ualong ..__allocate_stack,__allocate_stack.e,0,0,__allocate_stack.b
-
-# Switch to the relocation section
- .reldata
- .globl __allocate_stack
- .globl ..__allocate_stack
-__allocate_stack:
- .ualong ..__allocate_stack,.toc
-
- .text
- .align 2
-..__allocate_stack:
- .function ..__allocate_stack
-__allocate_stack.b:
- addi 3,3,15 # round up to 16 byte alignment
- lwz 0,0(1) # old stack link
- rlwinm 3,3,0,0,28
- srawi. 4,3,12 # get # of pages to check
- neg 3,3 # negate so we can use stwux
- bgt- 0,.Lcheck
- stwux 0,1,3 # small request, just decrement and return
- blr
-
-.Lcheck:
- mtctr 4 # number of pages to check
- mr 5,1 # tmp pointer
-.Lloop:
- lwzu 6,-4096(5) # touch the page
- bdnz+ .Lloop # and loop back
-
- stwux 0,1,3 # update stack pointer
- blr
-
-__allocate_stack.e:
-FE_MOT_RESVD..__allocate_stack:
diff --git a/gcc/config/rs6000/powerpc.h b/gcc/config/rs6000/powerpc.h
deleted file mode 100644
index 9f1ffd606cc..00000000000
--- a/gcc/config/rs6000/powerpc.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Definitions of target machine for GNU compiler,
- for IBM RS/6000 PowerPC running AIX version 3.2.
- Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by David Edelsohn (edelsohn@npac.syr.edu).
-
-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 "rs6000/rs6000.h"
-
-#undef ASM_SPEC
-#define ASM_SPEC "-u %(asm_cpu)"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 \
--Asystem(unix) -Asystem(aix) -Acpu(powerpc) -Amachine(powerpc)"
-
-#undef CPP_DEFAULT_SPEC
-#define CPP_DEFAULT_SPEC "-D_ARCH_PPC"
-
-#undef ASM_DEFAULT_SPEC
-#define ASM_DEFAULT_SPEC "-mppc"
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
-
-#undef PROCESSOR_DEFAULT
-#define PROCESSOR_DEFAULT PROCESSOR_PPC601
-
-/* These are not necessary when we pass -u to the assembler, and undefining
- them saves a great deal of space in object files. */
-
-#undef ASM_OUTPUT_EXTERNAL
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
-{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
- if ((TREE_CODE (DECL) == VAR_DECL \
- || TREE_CODE (DECL) == FUNCTION_DECL) \
- && (NAME)[strlen (NAME) - 1] != ']') \
- { \
- char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
- strcpy (_name, XSTR (_symref, 0)); \
- strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
- XSTR (_symref, 0) = _name; \
- } \
-}
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
deleted file mode 100644
index bf1f76c9d52..00000000000
--- a/gcc/config/rs6000/rs6000.c
+++ /dev/null
@@ -1,4845 +0,0 @@
-/* Subroutines used for code generation on IBM RS/6000.
- Copyright (C) 1991, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-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 <stdio.h>
-#include <ctype.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "recog.h"
-#include "expr.h"
-#include "obstack.h"
-#include "tree.h"
-#include "except.h"
-#include "function.h"
-
-#ifndef TARGET_NO_PROTOTYPE
-#define TARGET_NO_PROTOTYPE 0
-#endif
-
-extern char *language_string;
-extern int profile_block_flag;
-
-#define min(A,B) ((A) < (B) ? (A) : (B))
-#define max(A,B) ((A) > (B) ? (A) : (B))
-
-/* Target cpu type */
-
-enum processor_type rs6000_cpu;
-struct rs6000_cpu_select rs6000_select[3] =
-{
- /* switch name, tune arch */
- { (char *)0, "--with-cpu=", 1, 1 },
- { (char *)0, "-mcpu=", 1, 1 },
- { (char *)0, "-mtune=", 1, 0 },
-};
-
-/* Set to non-zero by "fix" operation to indicate that itrunc and
- uitrunc must be defined. */
-
-int rs6000_trunc_used;
-
-/* Set to non-zero once they have been defined. */
-
-static int trunc_defined;
-
-/* Set to non-zero once AIX common-mode calls have been defined. */
-static int common_mode_defined;
-
-/* Save information from a "cmpxx" operation until the branch or scc is
- emitted. */
-rtx rs6000_compare_op0, rs6000_compare_op1;
-int rs6000_compare_fp_p;
-
-#ifdef USING_SVR4_H
-/* Label number of label created for -mrelocatable, to call to so we can
- get the address of the GOT section */
-int rs6000_pic_labelno;
-
-/* Which abi to adhere to */
-char *rs6000_abi_name = RS6000_ABI_NAME;
-
-/* Semantics of the small data area */
-enum rs6000_sdata_type rs6000_sdata = SDATA_DATA;
-
-/* Which small data model to use */
-char *rs6000_sdata_name = (char *)0;
-#endif
-
-/* Whether a System V.4 varargs area was created. */
-int rs6000_sysv_varargs_p;
-
-/* ABI enumeration available for subtarget to use. */
-enum rs6000_abi rs6000_current_abi;
-
-/* Offset & size for fpmem stack locations used for converting between
- float and integral types. */
-int rs6000_fpmem_offset;
-int rs6000_fpmem_size;
-
-
-/* Default register names. */
-char rs6000_reg_names[][8] =
-{
- "0", "1", "2", "3", "4", "5", "6", "7",
- "8", "9", "10", "11", "12", "13", "14", "15",
- "16", "17", "18", "19", "20", "21", "22", "23",
- "24", "25", "26", "27", "28", "29", "30", "31",
- "0", "1", "2", "3", "4", "5", "6", "7",
- "8", "9", "10", "11", "12", "13", "14", "15",
- "16", "17", "18", "19", "20", "21", "22", "23",
- "24", "25", "26", "27", "28", "29", "30", "31",
- "mq", "lr", "ctr","ap",
- "0", "1", "2", "3", "4", "5", "6", "7",
- "fpmem"
-};
-
-#ifdef TARGET_REGNAMES
-static char alt_reg_names[][8] =
-{
- "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7",
- "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
- "%r16", "%r17", "%r18", "%r19", "%r20", "%r21", "%r22", "%r23",
- "%r24", "%r25", "%r26", "%r27", "%r28", "%r29", "%r30", "%r31",
- "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
- "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15",
- "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23",
- "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31",
- "mq", "lr", "ctr", "ap",
- "%cr0", "%cr1", "%cr2", "%cr3", "%cr4", "%cr5", "%cr6", "%cr7",
- "fpmem"
-};
-#endif
-
-/* Override command line options. Mostly we process the processor
- type and sometimes adjust other TARGET_ options. */
-
-void
-rs6000_override_options (default_cpu)
- char *default_cpu;
-{
- int i, j;
- struct rs6000_cpu_select *ptr;
-
- /* Simplify the entries below by making a mask for any POWER
- variant and any PowerPC variant. */
-
-#define POWER_MASKS (MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING)
-#define POWERPC_MASKS (MASK_POWERPC | MASK_PPC_GPOPT \
- | MASK_PPC_GFXOPT | MASK_POWERPC64)
-#define POWERPC_OPT_MASKS (MASK_PPC_GPOPT | MASK_PPC_GFXOPT)
-
- static struct ptt
- {
- char *name; /* Canonical processor name. */
- enum processor_type processor; /* Processor type enum value. */
- int target_enable; /* Target flags to enable. */
- int target_disable; /* Target flags to disable. */
- } processor_target_table[]
- = {{"common", PROCESSOR_COMMON, MASK_NEW_MNEMONICS,
- POWER_MASKS | POWERPC_MASKS},
- {"power", PROCESSOR_POWER,
- MASK_POWER | MASK_MULTIPLE | MASK_STRING,
- MASK_POWER2 | POWERPC_MASKS | MASK_NEW_MNEMONICS},
- {"power2", PROCESSOR_POWER,
- MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING,
- POWERPC_MASKS | MASK_NEW_MNEMONICS},
- {"powerpc", PROCESSOR_POWERPC,
- MASK_POWERPC | MASK_NEW_MNEMONICS,
- POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64},
- {"rios", PROCESSOR_RIOS1,
- MASK_POWER | MASK_MULTIPLE | MASK_STRING,
- MASK_POWER2 | POWERPC_MASKS | MASK_NEW_MNEMONICS},
- {"rios1", PROCESSOR_RIOS1,
- MASK_POWER | MASK_MULTIPLE | MASK_STRING,
- MASK_POWER2 | POWERPC_MASKS | MASK_NEW_MNEMONICS},
- {"rsc", PROCESSOR_PPC601,
- MASK_POWER | MASK_MULTIPLE | MASK_STRING,
- MASK_POWER2 | POWERPC_MASKS | MASK_NEW_MNEMONICS},
- {"rsc1", PROCESSOR_PPC601,
- MASK_POWER | MASK_MULTIPLE | MASK_STRING,
- MASK_POWER2 | POWERPC_MASKS | MASK_NEW_MNEMONICS},
- {"rios2", PROCESSOR_RIOS2,
- MASK_POWER | MASK_MULTIPLE | MASK_STRING | MASK_POWER2,
- POWERPC_MASKS | MASK_NEW_MNEMONICS},
- {"403", PROCESSOR_PPC403,
- MASK_POWERPC | MASK_SOFT_FLOAT | MASK_NEW_MNEMONICS,
- POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64},
- {"505", PROCESSOR_MPCCORE,
- MASK_POWERPC | MASK_NEW_MNEMONICS,
- POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64},
- {"601", PROCESSOR_PPC601,
- MASK_POWER | MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_MULTIPLE | MASK_STRING,
- MASK_POWER2 | POWERPC_OPT_MASKS | MASK_POWERPC64},
- {"602", PROCESSOR_PPC603,
- MASK_POWERPC | MASK_PPC_GFXOPT | MASK_NEW_MNEMONICS,
- POWER_MASKS | MASK_PPC_GPOPT | MASK_POWERPC64},
- {"603", PROCESSOR_PPC603,
- MASK_POWERPC | MASK_PPC_GFXOPT | MASK_NEW_MNEMONICS,
- POWER_MASKS | MASK_PPC_GPOPT | MASK_POWERPC64},
- {"603e", PROCESSOR_PPC603,
- MASK_POWERPC | MASK_PPC_GFXOPT | MASK_NEW_MNEMONICS,
- POWER_MASKS | MASK_PPC_GPOPT | MASK_POWERPC64},
- {"604", PROCESSOR_PPC604,
- MASK_POWERPC | MASK_PPC_GFXOPT | MASK_NEW_MNEMONICS,
- POWER_MASKS | MASK_PPC_GPOPT | MASK_POWERPC64},
- {"620", PROCESSOR_PPC620,
- MASK_POWERPC | MASK_PPC_GFXOPT | MASK_NEW_MNEMONICS,
- POWER_MASKS | MASK_PPC_GPOPT | MASK_POWERPC64},
- {"821", PROCESSOR_MPCCORE,
- MASK_POWERPC | MASK_SOFT_FLOAT | MASK_NEW_MNEMONICS,
- POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64},
- {"860", PROCESSOR_MPCCORE,
- MASK_POWERPC | MASK_SOFT_FLOAT | MASK_NEW_MNEMONICS,
- POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64}};
-
- int ptt_size = sizeof (processor_target_table) / sizeof (struct ptt);
-
- int multiple = TARGET_MULTIPLE; /* save current -mmultiple/-mno-multiple status */
- int string = TARGET_STRING; /* save current -mstring/-mno-string status */
-
- profile_block_flag = 0;
-
- /* Identify the processor type */
- rs6000_select[0].string = default_cpu;
- rs6000_cpu = PROCESSOR_DEFAULT;
-
- for (i = 0; i < sizeof (rs6000_select) / sizeof (rs6000_select[0]); i++)
- {
- ptr = &rs6000_select[i];
- if (ptr->string != (char *)0 && ptr->string[0] != '\0')
- {
- for (j = 0; j < ptt_size; j++)
- if (! strcmp (ptr->string, processor_target_table[j].name))
- {
- if (ptr->set_tune_p)
- rs6000_cpu = processor_target_table[j].processor;
-
- if (ptr->set_arch_p)
- {
- target_flags |= processor_target_table[j].target_enable;
- target_flags &= ~processor_target_table[j].target_disable;
- }
- break;
- }
-
- if (i == ptt_size)
- error ("bad value (%s) for %s switch", ptr->string, ptr->name);
- }
- }
-
- /* If -mmultiple or -mno-multiple was explicitly used, don't
- override with the processor default */
- if (TARGET_MULTIPLE_SET)
- target_flags = (target_flags & ~MASK_MULTIPLE) | multiple;
-
- /* If -mstring or -mno-string was explicitly used, don't
- override with the processor default */
- if (TARGET_STRING_SET)
- target_flags = (target_flags & ~MASK_STRING) | string;
-
- /* Don't allow -mmultiple or -mstring on little endian systems, because the
- hardware doesn't support the instructions used in little endian mode */
- if (!BYTES_BIG_ENDIAN)
- {
- if (TARGET_MULTIPLE)
- {
- target_flags &= ~MASK_MULTIPLE;
- if (TARGET_MULTIPLE_SET)
- warning ("-mmultiple is not supported on little endian systems");
- }
-
- if (TARGET_STRING)
- {
- target_flags &= ~MASK_STRING;
- if (TARGET_STRING_SET)
- warning ("-mstring is not supported on little endian systems");
- }
- }
-
-#ifdef TARGET_REGNAMES
- /* If the user desires alternate register names, copy in the alternate names
- now. */
- if (TARGET_REGNAMES)
- bcopy ((char *)alt_reg_names, (char *)rs6000_reg_names, sizeof (rs6000_reg_names));
-#endif
-
-#ifdef SUBTARGET_OVERRIDE_OPTIONS
- SUBTARGET_OVERRIDE_OPTIONS;
-#endif
-}
-
-/* Do anything needed at the start of the asm file. */
-
-void
-rs6000_file_start (file, default_cpu)
- FILE *file;
- char *default_cpu;
-{
- int i;
- char buffer[80];
- char *start = buffer;
- struct rs6000_cpu_select *ptr;
-
- if (flag_verbose_asm)
- {
- sprintf (buffer, "\n%s rs6000/powerpc options:", ASM_COMMENT_START);
- rs6000_select[0].string = default_cpu;
-
- for (i = 0; i < sizeof (rs6000_select) / sizeof (rs6000_select[0]); i++)
- {
- ptr = &rs6000_select[i];
- if (ptr->string != (char *)0 && ptr->string[0] != '\0')
- {
- fprintf (file, "%s %s%s", start, ptr->name, ptr->string);
- start = "";
- }
- }
-
-#ifdef USING_SVR4_H
- switch (rs6000_sdata)
- {
- case SDATA_NONE: fprintf (file, "%s -msdata=none", start); start = ""; break;
- case SDATA_DATA: fprintf (file, "%s -msdata=data", start); start = ""; break;
- case SDATA_SYSV: fprintf (file, "%s -msdata=sysv", start); start = ""; break;
- case SDATA_EABI: fprintf (file, "%s -msdata=eabi", start); start = ""; break;
- }
-
- if (rs6000_sdata && g_switch_value)
- {
- fprintf (file, "%s -G %d", start, g_switch_value);
- start = "";
- }
-#endif
-
- if (*start == '\0')
- fputs ("\n", file);
- }
-}
-
-
-/* Create a CONST_DOUBLE from a string. */
-
-struct rtx_def *
-rs6000_float_const (string, mode)
- char *string;
- enum machine_mode mode;
-{
- REAL_VALUE_TYPE value = REAL_VALUE_ATOF (string, mode);
- return immed_real_const_1 (value, mode);
-}
-
-
-/* Create a CONST_DOUBLE like immed_double_const, except reverse the
- two parts of the constant if the target is little endian. */
-
-struct rtx_def *
-rs6000_immed_double_const (i0, i1, mode)
- HOST_WIDE_INT i0, i1;
- enum machine_mode mode;
-{
- if (! WORDS_BIG_ENDIAN)
- return immed_double_const (i1, i0, mode);
-
- return immed_double_const (i0, i1, mode);
-}
-
-
-/* Return non-zero if this function is known to have a null epilogue. */
-
-int
-direct_return ()
-{
- if (reload_completed)
- {
- rs6000_stack_t *info = rs6000_stack_info ();
-
- if (info->first_gp_reg_save == 32
- && info->first_fp_reg_save == 64
- && !info->lr_save_p
- && !info->cr_save_p
- && !info->push_p)
- return 1;
- }
-
- return 0;
-}
-
-/* Returns 1 always. */
-
-int
-any_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return 1;
-}
-
-/* Returns 1 if op is the count register */
-int count_register_operand(op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != REG)
- return 0;
-
- if (REGNO (op) == COUNT_REGISTER_REGNUM)
- return 1;
-
- if (REGNO (op) > FIRST_PSEUDO_REGISTER)
- return 1;
-
- return 0;
-}
-
-/* Returns 1 if op is memory location for float/int conversions that masquerades
- as a register. */
-int fpmem_operand(op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != REG)
- return 0;
-
- if (FPMEM_REGNO_P (REGNO (op)))
- return 1;
-
-#if 0
- if (REGNO (op) > FIRST_PSEUDO_REGISTER)
- return 1;
-#endif
-
- return 0;
-}
-
-/* Return 1 if OP is a constant that can fit in a D field. */
-
-int
-short_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && (unsigned HOST_WIDE_INT) (INTVAL (op) + 0x8000) < 0x10000);
-}
-
-/* Similar for a unsigned D field. */
-
-int
-u_short_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && (INTVAL (op) & 0xffff0000) == 0);
-}
-
-/* Return 1 if OP is a CONST_INT that cannot fit in a signed D field. */
-
-int
-non_short_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && (unsigned HOST_WIDE_INT) (INTVAL (op) + 0x8000) >= 0x10000);
-}
-
-/* Returns 1 if OP is a register that is not special (i.e., not MQ,
- ctr, or lr). */
-
-int
-gpc_reg_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- && (GET_CODE (op) != REG
- || (REGNO (op) >= 67 && !FPMEM_REGNO_P (REGNO (op)))
- || REGNO (op) < 64));
-}
-
-/* Returns 1 if OP is either a pseudo-register or a register denoting a
- CR field. */
-
-int
-cc_reg_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- && (GET_CODE (op) != REG
- || REGNO (op) >= FIRST_PSEUDO_REGISTER
- || CR_REGNO_P (REGNO (op))));
-}
-
-/* Returns 1 if OP is either a constant integer valid for a D-field or a
- non-special register. If a register, it must be in the proper mode unless
- MODE is VOIDmode. */
-
-int
-reg_or_short_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return short_cint_operand (op, mode) || gpc_reg_operand (op, mode);
-}
-
-/* Similar, except check if the negation of the constant would be valid for
- a D-field. */
-
-int
-reg_or_neg_short_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return CONST_OK_FOR_LETTER_P (INTVAL (op), 'P');
-
- return gpc_reg_operand (op, mode);
-}
-
-/* Return 1 if the operand is either a register or an integer whose high-order
- 16 bits are zero. */
-
-int
-reg_or_u_short_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT
- && (INTVAL (op) & 0xffff0000) == 0)
- return 1;
-
- return gpc_reg_operand (op, mode);
-}
-
-/* Return 1 is the operand is either a non-special register or ANY
- constant integer. */
-
-int
-reg_or_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == CONST_INT || gpc_reg_operand (op, mode);
-}
-
-/* Return 1 if the operand is an operand that can be loaded via the GOT */
-
-int
-got_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == SYMBOL_REF
- || GET_CODE (op) == CONST
- || GET_CODE (op) == LABEL_REF);
-}
-
-/* Return the number of instructions it takes to form a constant in an
- integer register. */
-
-static int
-num_insns_constant_wide (value)
- HOST_WIDE_INT value;
-{
- /* signed constant loadable with {cal|addi} */
- if (((unsigned HOST_WIDE_INT)value + 0x8000) < 0x10000)
- return 1;
-
-#if HOST_BITS_PER_WIDE_INT == 32
- /* constant loadable with {cau|addis} */
- else if ((value & 0xffff) == 0)
- return 1;
-
-#else
- /* constant loadable with {cau|addis} */
- else if ((value & 0xffff) == 0 && (value & ~0xffffffff) == 0)
- return 1;
-
- else if (TARGET_64BIT)
- {
- HOST_WIDE_INT low = value & 0xffffffff;
- HOST_WIDE_INT high = value >> 32;
-
- if (high == 0 && (low & 0x80000000) == 0)
- return 2;
-
- else if (high == 0xffffffff && (low & 0x80000000) != 0)
- return 2;
-
- else if (!low)
- return num_insns_constant_wide (high) + 1;
-
- else
- return (num_insns_constant_wide (high)
- + num_insns_constant_wide (low) + 1);
- }
-#endif
-
- else
- return 2;
-}
-
-int
-num_insns_constant (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == CONST_INT)
- return num_insns_constant_wide (INTVAL (op));
-
- else if (GET_CODE (op) == CONST_DOUBLE && mode == SFmode)
- {
- long l;
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
- REAL_VALUE_TO_TARGET_SINGLE (rv, l);
- return num_insns_constant_wide ((HOST_WIDE_INT)l);
- }
-
- else if (GET_CODE (op) == CONST_DOUBLE && TARGET_32BIT)
- return (num_insns_constant_wide (CONST_DOUBLE_LOW (op))
- + num_insns_constant_wide (CONST_DOUBLE_HIGH (op)));
-
- else if (GET_CODE (op) == CONST_DOUBLE && TARGET_64BIT)
- {
- HOST_WIDE_INT low = CONST_DOUBLE_LOW (op);
- HOST_WIDE_INT high = CONST_DOUBLE_HIGH (op);
-
- if (high == 0 && (low & 0x80000000) == 0)
- return num_insns_constant_wide (low);
-
- else if (((high & 0xffffffff) == 0xffffffff)
- && ((low & 0x80000000) != 0))
- return num_insns_constant_wide (low);
-
- else if (low == 0)
- return num_insns_constant_wide (high) + 1;
-
- else
- return (num_insns_constant_wide (high)
- + num_insns_constant_wide (low) + 1);
- }
-
- else
- abort ();
-}
-
-/* Return 1 if the operand is a CONST_DOUBLE and it can be put into a register
- with one instruction per word. We only do this if we can safely read
- CONST_DOUBLE_{LOW,HIGH}. */
-
-int
-easy_fp_constant (op, mode)
- register rtx op;
- register enum machine_mode mode;
-{
- if (GET_CODE (op) != CONST_DOUBLE
- || GET_MODE (op) != mode
- || (GET_MODE_CLASS (mode) != MODE_FLOAT && mode != DImode))
- return 0;
-
- /* Consider all constants with -msoft-float to be easy */
- if (TARGET_SOFT_FLOAT && mode != DImode)
- return 1;
-
- /* If we are using V.4 style PIC, consider all constants to be hard */
- if (flag_pic && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS))
- return 0;
-
-#ifdef TARGET_RELOCATABLE
- /* Similarly if we are using -mrelocatable, consider all constants to be hard */
- if (TARGET_RELOCATABLE)
- return 0;
-#endif
-
- if (mode == DFmode)
- {
- long k[2];
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
- REAL_VALUE_TO_TARGET_DOUBLE (rv, k);
-
- return (num_insns_constant_wide ((HOST_WIDE_INT)k[0]) == 1
- && num_insns_constant_wide ((HOST_WIDE_INT)k[1]) == 1);
- }
-
- else if (mode == SFmode)
- {
- long l;
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
- REAL_VALUE_TO_TARGET_SINGLE (rv, l);
-
- return num_insns_constant_wide (l) == 1;
- }
-
- else if (mode == DImode && TARGET_32BIT)
- return num_insns_constant (op, DImode) == 2;
-
- else
- abort ();
-}
-
-/* Return 1 if the operand is in volatile memory. Note that during the
- RTL generation phase, memory_operand does not return TRUE for
- volatile memory references. So this function allows us to
- recognize volatile references where its safe. */
-
-int
-volatile_mem_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != MEM)
- return 0;
-
- if (!MEM_VOLATILE_P (op))
- return 0;
-
- if (mode != GET_MODE (op))
- return 0;
-
- if (reload_completed)
- return memory_operand (op, mode);
-
- if (reload_in_progress)
- return strict_memory_address_p (mode, XEXP (op, 0));
-
- return memory_address_p (mode, XEXP (op, 0));
-}
-
-/* Return 1 if the operand is an offsettable memory address. */
-
-int
-offsettable_addr_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return offsettable_address_p (reload_completed | reload_in_progress,
- mode, op);
-}
-
-/* Return 1 if the operand is either an easy FP constant (see above) or
- memory. */
-
-int
-mem_or_easy_const_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return memory_operand (op, mode) || easy_fp_constant (op, mode);
-}
-
-/* Return 1 if the operand is either a non-special register or an item
- that can be used as the operand of an SI add insn. */
-
-int
-add_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (reg_or_short_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && (INTVAL (op) & 0xffff) == 0));
-}
-
-/* Return 1 if OP is a constant but not a valid add_operand. */
-
-int
-non_add_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && (unsigned HOST_WIDE_INT) (INTVAL (op) + 0x8000) >= 0x10000
- && (INTVAL (op) & 0xffff) != 0);
-}
-
-/* Return 1 if the operand is a non-special register or a constant that
- can be used as the operand of an OR or XOR insn on the RS/6000. */
-
-int
-logical_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (gpc_reg_operand (op, mode)
- || (GET_CODE (op) == CONST_INT
- && ((INTVAL (op) & 0xffff0000) == 0
- || (INTVAL (op) & 0xffff) == 0)));
-}
-
-/* Return 1 if C is a constant that is not a logical operand (as
- above). */
-
-int
-non_logical_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT
- && (INTVAL (op) & 0xffff0000) != 0
- && (INTVAL (op) & 0xffff) != 0);
-}
-
-/* Return 1 if C is a constant that can be encoded in a mask on the
- RS/6000. It is if there are no more than two 1->0 or 0->1 transitions.
- Reject all ones and all zeros, since these should have been optimized
- away and confuse the making of MB and ME. */
-
-int
-mask_constant (c)
- register int c;
-{
- int i;
- int last_bit_value;
- int transitions = 0;
-
- if (c == 0 || c == ~0)
- return 0;
-
- last_bit_value = c & 1;
-
- for (i = 1; i < 32; i++)
- if (((c >>= 1) & 1) != last_bit_value)
- last_bit_value ^= 1, transitions++;
-
- return transitions <= 2;
-}
-
-/* Return 1 if the operand is a constant that is a mask on the RS/6000. */
-
-int
-mask_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == CONST_INT && mask_constant (INTVAL (op));
-}
-
-/* Return 1 if the operand is either a non-special register or a
- constant that can be used as the operand of an RS/6000 logical AND insn. */
-
-int
-and_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (reg_or_short_operand (op, mode)
- || logical_operand (op, mode)
- || mask_operand (op, mode));
-}
-
-/* Return 1 if the operand is a constant but not a valid operand for an AND
- insn. */
-
-int
-non_and_cint_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == CONST_INT && ! and_operand (op, mode);
-}
-
-/* Return 1 if the operand is a general register or memory operand. */
-
-int
-reg_or_mem_operand (op, mode)
- register rtx op;
- register enum machine_mode mode;
-{
- return (gpc_reg_operand (op, mode)
- || memory_operand (op, mode)
- || volatile_mem_operand (op, mode));
-}
-
-/* Return 1 if the operand is a general register or memory operand without
- pre-inc or pre_dec which produces invalid form of PowerPC lwa
- instruction. */
-
-int
-lwa_operand (op, mode)
- register rtx op;
- register enum machine_mode mode;
-{
- rtx inner = op;
-
- if (reload_completed && GET_CODE (inner) == SUBREG)
- inner = SUBREG_REG (inner);
-
- return gpc_reg_operand (inner, mode)
- || (memory_operand (inner, mode)
- && GET_CODE (XEXP (inner, 0)) != PRE_INC
- && GET_CODE (XEXP (inner, 0)) != PRE_DEC);
-}
-
-/* Return 1 if the operand, used inside a MEM, is a valid first argument
- to CALL. This is a SYMBOL_REF or a pseudo-register, which will be
- forced to lr. */
-
-int
-call_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (mode != VOIDmode && GET_MODE (op) != mode)
- return 0;
-
- return (GET_CODE (op) == SYMBOL_REF
- || (GET_CODE (op) == REG && REGNO (op) >= FIRST_PSEUDO_REGISTER));
-}
-
-
-/* Return 1 if the operand is a SYMBOL_REF for a function known to be in
- this file. */
-
-int
-current_file_function_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == SYMBOL_REF
- && (SYMBOL_REF_FLAG (op)
- || op == XEXP (DECL_RTL (current_function_decl), 0)));
-}
-
-
-/* Return 1 if this operand is a valid input for a move insn. */
-
-int
-input_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- /* Memory is always valid. */
- if (memory_operand (op, mode))
- return 1;
-
- /* For floating-point, easy constants are valid. */
- if (GET_MODE_CLASS (mode) == MODE_FLOAT
- && CONSTANT_P (op)
- && easy_fp_constant (op, mode))
- return 1;
-
- /* Allow any integer constant. */
- if (GET_MODE_CLASS (mode) == MODE_INT
- && (GET_CODE (op) == CONST_INT || GET_CODE (op) == CONST_DOUBLE))
- return 1;
-
- /* For floating-point or multi-word mode, the only remaining valid type
- is a register. */
- if (GET_MODE_CLASS (mode) == MODE_FLOAT
- || GET_MODE_SIZE (mode) > UNITS_PER_WORD)
- return register_operand (op, mode);
-
- /* The only cases left are integral modes one word or smaller (we
- do not get called for MODE_CC values). These can be in any
- register. */
- if (register_operand (op, mode))
- return 1;
-
- /* A SYMBOL_REF referring to the TOC is valid. */
- if (LEGITIMATE_CONSTANT_POOL_ADDRESS_P (op))
- return 1;
-
- /* Windows NT allows SYMBOL_REFs and LABEL_REFs against the TOC
- directly in the instruction stream */
- if (DEFAULT_ABI == ABI_NT
- && (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF))
- return 1;
-
- /* V.4 allows SYMBOL_REFs and CONSTs that are in the small data region
- to be valid. */
- if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- && (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST)
- && small_data_operand (op, Pmode))
- return 1;
-
- return 0;
-}
-
-/* Return 1 for an operand in small memory on V.4/eabi */
-
-int
-small_data_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
-#ifdef TARGET_SDATA
- rtx sym_ref, const_part;
-
- if (rs6000_sdata == SDATA_NONE || rs6000_sdata == SDATA_DATA)
- return 0;
-
- if (DEFAULT_ABI != ABI_V4 && DEFAULT_ABI != ABI_SOLARIS)
- return 0;
-
- if (GET_CODE (op) == SYMBOL_REF)
- sym_ref = op;
-
- else if (GET_CODE (op) != CONST
- || GET_CODE (XEXP (op, 0)) != PLUS
- || GET_CODE (XEXP (XEXP (op, 0), 0)) != SYMBOL_REF
- || GET_CODE (XEXP (XEXP (op, 0), 1)) != CONST_INT)
- return 0;
-
- else
- sym_ref = XEXP (XEXP (op, 0), 0);
-
- if (*XSTR (sym_ref, 0) != '@')
- return 0;
-
- return 1;
-
-#else
- return 0;
-#endif
-}
-
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- For incoming args we set the number of arguments in the prototype large
- so we never return a PARALLEL. */
-
-void
-init_cumulative_args (cum, fntype, libname, incoming)
- CUMULATIVE_ARGS *cum;
- tree fntype;
- rtx libname;
- int incoming;
-{
- static CUMULATIVE_ARGS zero_cumulative;
- enum rs6000_abi abi = DEFAULT_ABI;
-
- *cum = zero_cumulative;
- cum->words = 0;
- cum->fregno = FP_ARG_MIN_REG;
- cum->prototype = (fntype && TYPE_ARG_TYPES (fntype));
- cum->call_cookie = CALL_NORMAL;
-
- if (incoming)
- {
- cum->nargs_prototype = 1000; /* don't return a PARALLEL */
- if (abi == ABI_V4 || abi == ABI_SOLARIS)
- cum->varargs_offset = RS6000_VARARGS_OFFSET;
- }
-
- else if (cum->prototype)
- cum->nargs_prototype = (list_length (TYPE_ARG_TYPES (fntype)) - 1
- + (TYPE_MODE (TREE_TYPE (fntype)) == BLKmode
- || RETURN_IN_MEMORY (TREE_TYPE (fntype))));
-
- else
- cum->nargs_prototype = 0;
-
- cum->orig_nargs = cum->nargs_prototype;
-
- /* Check for DLL import functions */
- if (abi == ABI_NT
- && fntype
- && lookup_attribute ("dllimport", TYPE_ATTRIBUTES (fntype)))
- cum->call_cookie = CALL_NT_DLLIMPORT;
-
- /* Also check for longcall's */
- else if (fntype && lookup_attribute ("longcall", TYPE_ATTRIBUTES (fntype)))
- cum->call_cookie = CALL_LONG;
-
- if (TARGET_DEBUG_ARG)
- {
- fprintf (stderr, "\ninit_cumulative_args:");
- if (fntype)
- {
- tree ret_type = TREE_TYPE (fntype);
- fprintf (stderr, " ret code = %s,",
- tree_code_name[ (int)TREE_CODE (ret_type) ]);
- }
-
- if ((abi == ABI_V4 || abi == ABI_SOLARIS) && incoming)
- fprintf (stderr, " varargs = %d, ", cum->varargs_offset);
-
- if (cum->call_cookie & CALL_NT_DLLIMPORT)
- fprintf (stderr, " dllimport,");
-
- if (cum->call_cookie & CALL_LONG)
- fprintf (stderr, " longcall,");
-
- fprintf (stderr, " proto = %d, nargs = %d\n",
- cum->prototype, cum->nargs_prototype);
- }
-}
-
-/* If defined, a C expression that gives the alignment boundary, in bits,
- of an argument with the specified mode and type. If it is not defined,
- PARM_BOUNDARY is used for all arguments.
-
- Windows NT wants anything >= 8 bytes to be double word aligned.
-
- V.4 wants long longs to be double word aligned. */
-
-int
-function_arg_boundary (mode, type)
- enum machine_mode mode;
- tree type;
-{
- if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && mode == DImode)
- return 64;
-
- if (DEFAULT_ABI != ABI_NT || TARGET_64BIT)
- return PARM_BOUNDARY;
-
- if (mode != BLKmode)
- return (GET_MODE_SIZE (mode)) >= 8 ? 64 : 32;
-
- return (int_size_in_bytes (type) >= 8) ? 64 : 32;
-}
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-void
-function_arg_advance (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- int align = ((cum->words & 1) != 0 && function_arg_boundary (mode, type) == 64) ? 1 : 0;
- cum->words += align;
- cum->nargs_prototype--;
-
- if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- {
- /* Long longs must not be split between registers and stack */
- if ((GET_MODE_CLASS (mode) != MODE_FLOAT || TARGET_SOFT_FLOAT)
- && type && !AGGREGATE_TYPE_P (type)
- && cum->words < GP_ARG_NUM_REG
- && cum->words + RS6000_ARG_SIZE (mode, type, named) > GP_ARG_NUM_REG)
- {
- cum->words = GP_ARG_NUM_REG;
- }
-
- /* Aggregates get passed as pointers */
- if (type && AGGREGATE_TYPE_P (type))
- cum->words++;
-
- /* Floats go in registers, & don't occupy space in the GP registers
- like they do for AIX unless software floating point. */
- else if (GET_MODE_CLASS (mode) == MODE_FLOAT
- && TARGET_HARD_FLOAT
- && cum->fregno <= FP_ARG_V4_MAX_REG)
- cum->fregno++;
-
- else
- cum->words += RS6000_ARG_SIZE (mode, type, 1);
- }
- else
- if (named)
- {
- cum->words += RS6000_ARG_SIZE (mode, type, named);
- if (GET_MODE_CLASS (mode) == MODE_FLOAT && TARGET_HARD_FLOAT)
- cum->fregno++;
- }
-
- if (TARGET_DEBUG_ARG)
- fprintf (stderr,
- "function_adv: words = %2d, fregno = %2d, nargs = %4d, proto = %d, mode = %4s, named = %d, align = %d\n",
- cum->words, cum->fregno, cum->nargs_prototype, cum->prototype, GET_MODE_NAME (mode), named, align);
-}
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- On RS/6000 the first eight words of non-FP are normally in registers
- and the rest are pushed. Under AIX, the first 13 FP args are in registers.
- Under V.4, the first 8 FP args are in registers.
-
- If this is floating-point and no prototype is specified, we use
- both an FP and integer register (or possibly FP reg and stack). Library
- functions (when TYPE is zero) always have the proper types for args,
- so we can pass the FP value just in one register. emit_library_function
- doesn't support PARALLEL anyway. */
-
-struct rtx_def *
-function_arg (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- int align = ((cum->words & 1) != 0 && function_arg_boundary (mode, type) == 64) ? 1 : 0;
- int align_words = cum->words + align;
-
- if (TARGET_DEBUG_ARG)
- fprintf (stderr,
- "function_arg: words = %2d, fregno = %2d, nargs = %4d, proto = %d, mode = %4s, named = %d, align = %d\n",
- cum->words, cum->fregno, cum->nargs_prototype, cum->prototype, GET_MODE_NAME (mode), named, align);
-
- /* Return a marker to indicate whether CR1 needs to set or clear the bit that V.4
- uses to say fp args were passed in registers. Assume that we don't need the
- marker for software floating point, or compiler generated library calls. */
- if (mode == VOIDmode)
- {
- enum rs6000_abi abi = DEFAULT_ABI;
-
- if ((abi == ABI_V4 || abi == ABI_SOLARIS)
- && TARGET_HARD_FLOAT
- && cum->nargs_prototype < 0
- && type && (cum->prototype || TARGET_NO_PROTOTYPE))
- {
- return GEN_INT (cum->call_cookie
- | ((cum->fregno == FP_ARG_MIN_REG)
- ? CALL_V4_SET_FP_ARGS
- : CALL_V4_CLEAR_FP_ARGS));
- }
-
- return GEN_INT (cum->call_cookie);
- }
-
- if (!named)
- {
- if (DEFAULT_ABI != ABI_V4 && DEFAULT_ABI != ABI_SOLARIS)
- return NULL_RTX;
- }
-
- if (type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- return NULL_RTX;
-
- if (USE_FP_FOR_ARG_P (*cum, mode, type))
- {
- if (DEFAULT_ABI == ABI_V4 /* V.4 never passes FP values in GP registers */
- || DEFAULT_ABI == ABI_SOLARIS
- || ! type
- || ((cum->nargs_prototype > 0)
- /* IBM AIX extended its linkage convention definition always to
- require FP args after register save area hole on the stack. */
- && (DEFAULT_ABI != ABI_AIX
- || ! TARGET_XL_CALL
- || (align_words < GP_ARG_NUM_REG))))
- return gen_rtx (REG, mode, cum->fregno);
-
- return gen_rtx (PARALLEL, mode,
- gen_rtvec
- (2,
- gen_rtx (EXPR_LIST, VOIDmode,
- ((align_words >= GP_ARG_NUM_REG)
- ? NULL_RTX
- : (align_words
- + RS6000_ARG_SIZE (mode, type, named)
- > GP_ARG_NUM_REG
- /* If this is partially on the stack, then
- we only include the portion actually
- in registers here. */
- ? gen_rtx (REG, SImode,
- GP_ARG_MIN_REG + align_words)
- : gen_rtx (REG, mode,
- GP_ARG_MIN_REG + align_words))),
- const0_rtx),
- gen_rtx (EXPR_LIST, VOIDmode,
- gen_rtx (REG, mode, cum->fregno),
- const0_rtx)));
- }
-
- /* Long longs won't be split between register and stack */
- else if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) &&
- align_words + RS6000_ARG_SIZE (mode, type, named) > GP_ARG_NUM_REG)
- {
- return NULL_RTX;
- }
-
- else if (align_words < GP_ARG_NUM_REG)
- return gen_rtx (REG, mode, GP_ARG_MIN_REG + align_words);
-
- return NULL_RTX;
-}
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-int
-function_arg_partial_nregs (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- if (! named)
- return 0;
-
- if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- return 0;
-
- if (USE_FP_FOR_ARG_P (*cum, mode, type))
- {
- if (cum->nargs_prototype >= 0)
- return 0;
- }
-
- if (cum->words < GP_ARG_NUM_REG
- && GP_ARG_NUM_REG < (cum->words + RS6000_ARG_SIZE (mode, type, named)))
- {
- int ret = GP_ARG_NUM_REG - cum->words;
- if (ret && TARGET_DEBUG_ARG)
- fprintf (stderr, "function_arg_partial_nregs: %d\n", ret);
-
- return ret;
- }
-
- return 0;
-}
-
-/* A C expression that indicates when an argument must be passed by
- reference. If nonzero for an argument, a copy of that argument is
- made in memory and a pointer to the argument is passed instead of
- the argument itself. The pointer is passed in whatever way is
- appropriate for passing a pointer to that type.
-
- Under V.4, structures and unions are passed by reference. */
-
-int
-function_arg_pass_by_reference (cum, mode, type, named)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int named;
-{
- if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- && type && AGGREGATE_TYPE_P (type))
- {
- if (TARGET_DEBUG_ARG)
- fprintf (stderr, "function_arg_pass_by_reference: aggregate\n");
-
- return 1;
- }
-
- return 0;
-}
-
-
-/* Perform any needed actions needed for a function that is receiving a
- variable number of arguments.
-
- CUM is as above.
-
- MODE and TYPE are the mode and type of the current parameter.
-
- PRETEND_SIZE is a variable that should be set to the amount of stack
- that must be pushed by the prolog to pretend that our caller pushed
- it.
-
- Normally, this macro will push all remaining incoming registers on the
- stack and set PRETEND_SIZE to the length of the registers pushed. */
-
-void
-setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl)
- CUMULATIVE_ARGS *cum;
- enum machine_mode mode;
- tree type;
- int *pretend_size;
- int no_rtl;
-
-{
- rtx save_area = virtual_incoming_args_rtx;
- int reg_size = (TARGET_64BIT) ? 8 : 4;
-
- if (TARGET_DEBUG_ARG)
- fprintf (stderr,
- "setup_vararg: words = %2d, fregno = %2d, nargs = %4d, proto = %d, mode = %4s, no_rtl= %d\n",
- cum->words, cum->fregno, cum->nargs_prototype, cum->prototype, GET_MODE_NAME (mode), no_rtl);
-
- if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && !no_rtl)
- {
- rs6000_sysv_varargs_p = 1;
- save_area = plus_constant (frame_pointer_rtx, RS6000_VARARGS_OFFSET);
- }
-
- if (cum->words < 8)
- {
- int first_reg_offset = cum->words;
-
- if (MUST_PASS_IN_STACK (mode, type))
- first_reg_offset += RS6000_ARG_SIZE (TYPE_MODE (type), type, 1);
-
- if (first_reg_offset > GP_ARG_NUM_REG)
- first_reg_offset = GP_ARG_NUM_REG;
-
- if (!no_rtl && first_reg_offset != GP_ARG_NUM_REG)
- move_block_from_reg
- (GP_ARG_MIN_REG + first_reg_offset,
- gen_rtx (MEM, BLKmode,
- plus_constant (save_area, first_reg_offset * reg_size)),
- GP_ARG_NUM_REG - first_reg_offset,
- (GP_ARG_NUM_REG - first_reg_offset) * UNITS_PER_WORD);
-
- *pretend_size = (GP_ARG_NUM_REG - first_reg_offset) * UNITS_PER_WORD;
- }
-
- /* Save FP registers if needed. */
- if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && TARGET_HARD_FLOAT && !no_rtl)
- {
- int fregno = cum->fregno;
- int num_fp_reg = FP_ARG_V4_MAX_REG + 1 - fregno;
-
- if (num_fp_reg >= 0)
- {
- rtx cr1 = gen_rtx (REG, CCmode, 69);
- rtx lab = gen_label_rtx ();
- int off = (GP_ARG_NUM_REG * reg_size) + ((fregno - FP_ARG_MIN_REG) * 8);
-
- emit_jump_insn (gen_rtx (SET, VOIDmode,
- pc_rtx,
- gen_rtx (IF_THEN_ELSE, VOIDmode,
- gen_rtx (NE, VOIDmode, cr1, const0_rtx),
- gen_rtx (LABEL_REF, VOIDmode, lab),
- pc_rtx)));
-
- while ( num_fp_reg-- >= 0)
- {
- emit_move_insn (gen_rtx (MEM, DFmode, plus_constant (save_area, off)),
- gen_rtx (REG, DFmode, fregno++));
- off += 8;
- }
-
- emit_label (lab);
- }
- }
-}
-
-/* If defined, is a C expression that produces the machine-specific
- code for a call to `__builtin_saveregs'. This code will be moved
- to the very beginning of the function, before any parameter access
- are made. The return value of this function should be an RTX that
- contains the value to use as the return of `__builtin_saveregs'.
-
- The argument ARGS is a `tree_list' containing the arguments that
- were passed to `__builtin_saveregs'.
-
- If this macro is not defined, the compiler will output an ordinary
- call to the library function `__builtin_saveregs'.
-
- On the Power/PowerPC return the address of the area on the stack
- used to hold arguments. Under AIX, this includes the 8 word register
- save area. Under V.4 this does not. */
-
-struct rtx_def *
-expand_builtin_saveregs (args)
- tree args;
-{
- return virtual_incoming_args_rtx;
-}
-
-
-/* Generate a memory reference for expand_block_move, copying volatile,
- and other bits from an original memory reference. */
-
-static rtx
-expand_block_move_mem (mode, addr, orig_mem)
- enum machine_mode mode;
- rtx addr;
- rtx orig_mem;
-{
- rtx mem = gen_rtx (MEM, mode, addr);
-
- RTX_UNCHANGING_P (mem) = RTX_UNCHANGING_P (orig_mem);
- MEM_VOLATILE_P (mem) = MEM_VOLATILE_P (orig_mem);
- MEM_IN_STRUCT_P (mem) = MEM_IN_STRUCT_P (orig_mem);
-#ifdef MEM_UNALIGNED_P
- MEM_UNALIGNED_P (mem) = MEM_UNALIGNED_P (orig_mem);
-#endif
- return mem;
-}
-
-/* Expand a block move operation, and return 1 if successful. Return 0
- if we should let the compiler generate normal code.
-
- operands[0] is the destination
- operands[1] is the source
- operands[2] is the length
- operands[3] is the alignment */
-
-#define MAX_MOVE_REG 4
-
-int
-expand_block_move (operands)
- rtx operands[];
-{
- rtx orig_dest = operands[0];
- rtx orig_src = operands[1];
- rtx bytes_rtx = operands[2];
- rtx align_rtx = operands[3];
- int constp = (GET_CODE (bytes_rtx) == CONST_INT);
- int align = XINT (align_rtx, 0);
- int bytes;
- int offset;
- int num_reg;
- int i;
- rtx src_reg;
- rtx dest_reg;
- rtx src_addr;
- rtx dest_addr;
- rtx tmp_reg;
- rtx stores[MAX_MOVE_REG];
- int move_bytes;
-
- /* If this is not a fixed size move, just call memcpy */
- if (!constp)
- return 0;
-
- /* Anything to move? */
- bytes = INTVAL (bytes_rtx);
- if (bytes <= 0)
- return 1;
-
- /* Don't support real large moves. If string instructions are not used,
- then don't generate more than 8 loads. */
- if (TARGET_STRING)
- {
- if (bytes > 4*8)
- return 0;
- }
- else if (!STRICT_ALIGNMENT)
- {
- if (bytes > 4*8)
- return 0;
- }
- else if (bytes > 8*align)
- return 0;
-
- /* Move the address into scratch registers. */
- dest_reg = copy_addr_to_reg (XEXP (orig_dest, 0));
- src_reg = copy_addr_to_reg (XEXP (orig_src, 0));
-
- if (TARGET_STRING) /* string instructions are available */
- {
- for ( ; bytes > 0; bytes -= move_bytes)
- {
- if (bytes > 24 /* move up to 32 bytes at a time */
- && !fixed_regs[5]
- && !fixed_regs[6]
- && !fixed_regs[7]
- && !fixed_regs[8]
- && !fixed_regs[9]
- && !fixed_regs[10]
- && !fixed_regs[11]
- && !fixed_regs[12])
- {
- move_bytes = (bytes > 32) ? 32 : bytes;
- emit_insn (gen_movstrsi_8reg (expand_block_move_mem (BLKmode, dest_reg, orig_dest),
- expand_block_move_mem (BLKmode, src_reg, orig_src),
- GEN_INT ((move_bytes == 32) ? 0 : move_bytes),
- align_rtx));
- }
- else if (bytes > 16 /* move up to 24 bytes at a time */
- && !fixed_regs[7]
- && !fixed_regs[8]
- && !fixed_regs[9]
- && !fixed_regs[10]
- && !fixed_regs[11]
- && !fixed_regs[12])
- {
- move_bytes = (bytes > 24) ? 24 : bytes;
- emit_insn (gen_movstrsi_6reg (expand_block_move_mem (BLKmode, dest_reg, orig_dest),
- expand_block_move_mem (BLKmode, src_reg, orig_src),
- GEN_INT (move_bytes),
- align_rtx));
- }
- else if (bytes > 8 /* move up to 16 bytes at a time */
- && !fixed_regs[9]
- && !fixed_regs[10]
- && !fixed_regs[11]
- && !fixed_regs[12])
- {
- move_bytes = (bytes > 16) ? 16 : bytes;
- emit_insn (gen_movstrsi_4reg (expand_block_move_mem (BLKmode, dest_reg, orig_dest),
- expand_block_move_mem (BLKmode, src_reg, orig_src),
- GEN_INT (move_bytes),
- align_rtx));
- }
- else if (bytes > 4 && !TARGET_64BIT)
- { /* move up to 8 bytes at a time */
- move_bytes = (bytes > 8) ? 8 : bytes;
- emit_insn (gen_movstrsi_2reg (expand_block_move_mem (BLKmode, dest_reg, orig_dest),
- expand_block_move_mem (BLKmode, src_reg, orig_src),
- GEN_INT (move_bytes),
- align_rtx));
- }
- else if (bytes >= 4 && (align >= 4 || !STRICT_ALIGNMENT))
- { /* move 4 bytes */
- move_bytes = 4;
- tmp_reg = gen_reg_rtx (SImode);
- emit_move_insn (tmp_reg, expand_block_move_mem (SImode, src_reg, orig_src));
- emit_move_insn (expand_block_move_mem (SImode, dest_reg, orig_dest), tmp_reg);
- }
- else if (bytes == 2 && (align >= 2 || !STRICT_ALIGNMENT))
- { /* move 2 bytes */
- move_bytes = 2;
- tmp_reg = gen_reg_rtx (HImode);
- emit_move_insn (tmp_reg, expand_block_move_mem (HImode, src_reg, orig_src));
- emit_move_insn (expand_block_move_mem (HImode, dest_reg, orig_dest), tmp_reg);
- }
- else if (bytes == 1) /* move 1 byte */
- {
- move_bytes = 1;
- tmp_reg = gen_reg_rtx (QImode);
- emit_move_insn (tmp_reg, expand_block_move_mem (QImode, src_reg, orig_src));
- emit_move_insn (expand_block_move_mem (QImode, dest_reg, orig_dest), tmp_reg);
- }
- else
- { /* move up to 4 bytes at a time */
- move_bytes = (bytes > 4) ? 4 : bytes;
- emit_insn (gen_movstrsi_1reg (expand_block_move_mem (BLKmode, dest_reg, orig_dest),
- expand_block_move_mem (BLKmode, src_reg, orig_src),
- GEN_INT (move_bytes),
- align_rtx));
- }
-
- if (bytes > move_bytes)
- {
- emit_insn (gen_addsi3 (src_reg, src_reg, GEN_INT (move_bytes)));
- emit_insn (gen_addsi3 (dest_reg, dest_reg, GEN_INT (move_bytes)));
- }
- }
- }
-
- else /* string instructions not available */
- {
- num_reg = offset = 0;
- for ( ; bytes > 0; (bytes -= move_bytes), (offset += move_bytes))
- {
- /* Calculate the correct offset for src/dest */
- if (offset == 0)
- {
- src_addr = src_reg;
- dest_addr = dest_reg;
- }
- else
- {
- src_addr = gen_rtx (PLUS, Pmode, src_reg, GEN_INT (offset));
- dest_addr = gen_rtx (PLUS, Pmode, dest_reg, GEN_INT (offset));
- }
-
- /* Generate the appropriate load and store, saving the stores for later */
- if (bytes >= 8 && TARGET_64BIT && (align >= 8 || !STRICT_ALIGNMENT))
- {
- move_bytes = 8;
- tmp_reg = gen_reg_rtx (DImode);
- emit_insn (gen_movdi (tmp_reg, expand_block_move_mem (DImode, src_addr, orig_src)));
- stores[ num_reg++ ] = gen_movdi (expand_block_move_mem (DImode, dest_addr, orig_dest), tmp_reg);
- }
- else if (bytes >= 4 && (align >= 4 || !STRICT_ALIGNMENT))
- {
- move_bytes = 4;
- tmp_reg = gen_reg_rtx (SImode);
- emit_insn (gen_movsi (tmp_reg, expand_block_move_mem (SImode, src_addr, orig_src)));
- stores[ num_reg++ ] = gen_movsi (expand_block_move_mem (SImode, dest_addr, orig_dest), tmp_reg);
- }
- else if (bytes >= 2 && (align >= 2 || !STRICT_ALIGNMENT))
- {
- move_bytes = 2;
- tmp_reg = gen_reg_rtx (HImode);
- emit_insn (gen_movsi (tmp_reg, expand_block_move_mem (HImode, src_addr, orig_src)));
- stores[ num_reg++ ] = gen_movhi (expand_block_move_mem (HImode, dest_addr, orig_dest), tmp_reg);
- }
- else
- {
- move_bytes = 1;
- tmp_reg = gen_reg_rtx (QImode);
- emit_insn (gen_movsi (tmp_reg, expand_block_move_mem (QImode, src_addr, orig_src)));
- stores[ num_reg++ ] = gen_movqi (expand_block_move_mem (QImode, dest_addr, orig_dest), tmp_reg);
- }
-
- if (num_reg >= MAX_MOVE_REG)
- {
- for (i = 0; i < num_reg; i++)
- emit_insn (stores[i]);
- num_reg = 0;
- }
- }
-
- for (i = 0; i < num_reg; i++)
- emit_insn (stores[i]);
- }
-
- return 1;
-}
-
-
-/* Return 1 if OP is a load multiple operation. It is known to be a
- PARALLEL and the first section will be tested. */
-
-int
-load_multiple_operation (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int count = XVECLEN (op, 0);
- int dest_regno;
- rtx src_addr;
- int i;
-
- /* Perform a quick check so we don't blow up below. */
- if (count <= 1
- || GET_CODE (XVECEXP (op, 0, 0)) != SET
- || GET_CODE (SET_DEST (XVECEXP (op, 0, 0))) != REG
- || GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != MEM)
- return 0;
-
- dest_regno = REGNO (SET_DEST (XVECEXP (op, 0, 0)));
- src_addr = XEXP (SET_SRC (XVECEXP (op, 0, 0)), 0);
-
- for (i = 1; i < count; i++)
- {
- rtx elt = XVECEXP (op, 0, i);
-
- if (GET_CODE (elt) != SET
- || GET_CODE (SET_DEST (elt)) != REG
- || GET_MODE (SET_DEST (elt)) != SImode
- || REGNO (SET_DEST (elt)) != dest_regno + i
- || GET_CODE (SET_SRC (elt)) != MEM
- || GET_MODE (SET_SRC (elt)) != SImode
- || GET_CODE (XEXP (SET_SRC (elt), 0)) != PLUS
- || ! rtx_equal_p (XEXP (XEXP (SET_SRC (elt), 0), 0), src_addr)
- || GET_CODE (XEXP (XEXP (SET_SRC (elt), 0), 1)) != CONST_INT
- || INTVAL (XEXP (XEXP (SET_SRC (elt), 0), 1)) != i * 4)
- return 0;
- }
-
- return 1;
-}
-
-/* Similar, but tests for store multiple. Here, the second vector element
- is a CLOBBER. It will be tested later. */
-
-int
-store_multiple_operation (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- int count = XVECLEN (op, 0) - 1;
- int src_regno;
- rtx dest_addr;
- int i;
-
- /* Perform a quick check so we don't blow up below. */
- if (count <= 1
- || GET_CODE (XVECEXP (op, 0, 0)) != SET
- || GET_CODE (SET_DEST (XVECEXP (op, 0, 0))) != MEM
- || GET_CODE (SET_SRC (XVECEXP (op, 0, 0))) != REG)
- return 0;
-
- src_regno = REGNO (SET_SRC (XVECEXP (op, 0, 0)));
- dest_addr = XEXP (SET_DEST (XVECEXP (op, 0, 0)), 0);
-
- for (i = 1; i < count; i++)
- {
- rtx elt = XVECEXP (op, 0, i + 1);
-
- if (GET_CODE (elt) != SET
- || GET_CODE (SET_SRC (elt)) != REG
- || GET_MODE (SET_SRC (elt)) != SImode
- || REGNO (SET_SRC (elt)) != src_regno + i
- || GET_CODE (SET_DEST (elt)) != MEM
- || GET_MODE (SET_DEST (elt)) != SImode
- || GET_CODE (XEXP (SET_DEST (elt), 0)) != PLUS
- || ! rtx_equal_p (XEXP (XEXP (SET_DEST (elt), 0), 0), dest_addr)
- || GET_CODE (XEXP (XEXP (SET_DEST (elt), 0), 1)) != CONST_INT
- || INTVAL (XEXP (XEXP (SET_DEST (elt), 0), 1)) != i * 4)
- return 0;
- }
-
- return 1;
-}
-
-/* Return 1 if OP is a comparison operation that is valid for a branch insn.
- We only check the opcode against the mode of the CC value here. */
-
-int
-branch_comparison_operator (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (op);
- enum machine_mode cc_mode;
-
- if (GET_RTX_CLASS (code) != '<')
- return 0;
-
- cc_mode = GET_MODE (XEXP (op, 0));
- if (GET_MODE_CLASS (cc_mode) != MODE_CC)
- return 0;
-
- if ((code == GT || code == LT || code == GE || code == LE)
- && cc_mode == CCUNSmode)
- return 0;
-
- if ((code == GTU || code == LTU || code == GEU || code == LEU)
- && (cc_mode != CCUNSmode))
- return 0;
-
- return 1;
-}
-
-/* Return 1 if OP is a comparison operation that is valid for an scc insn.
- We check the opcode against the mode of the CC value and disallow EQ or
- NE comparisons for integers. */
-
-int
-scc_comparison_operator (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (op);
- enum machine_mode cc_mode;
-
- if (GET_MODE (op) != mode && mode != VOIDmode)
- return 0;
-
- if (GET_RTX_CLASS (code) != '<')
- return 0;
-
- cc_mode = GET_MODE (XEXP (op, 0));
- if (GET_MODE_CLASS (cc_mode) != MODE_CC)
- return 0;
-
- if (code == NE && cc_mode != CCFPmode)
- return 0;
-
- if ((code == GT || code == LT || code == GE || code == LE)
- && cc_mode == CCUNSmode)
- return 0;
-
- if ((code == GTU || code == LTU || code == GEU || code == LEU)
- && (cc_mode != CCUNSmode))
- return 0;
-
- if (cc_mode == CCEQmode && code != EQ && code != NE)
- return 0;
-
- return 1;
-}
-
-/* Return 1 if ANDOP is a mask that has no bits on that are not in the
- mask required to convert the result of a rotate insn into a shift
- left insn of SHIFTOP bits. Both are known to be CONST_INT. */
-
-int
-includes_lshift_p (shiftop, andop)
- register rtx shiftop;
- register rtx andop;
-{
- int shift_mask = (~0 << INTVAL (shiftop));
-
- return (INTVAL (andop) & ~shift_mask) == 0;
-}
-
-/* Similar, but for right shift. */
-
-int
-includes_rshift_p (shiftop, andop)
- register rtx shiftop;
- register rtx andop;
-{
- unsigned HOST_WIDE_INT shift_mask = ~(unsigned HOST_WIDE_INT) 0;
-
- shift_mask >>= INTVAL (shiftop);
-
- return (INTVAL (andop) & ~ shift_mask) == 0;
-}
-
-/* Return 1 if REGNO (reg1) == REGNO (reg2) - 1 making them candidates
- for lfq and stfq insns.
-
- Note reg1 and reg2 *must* be hard registers. To be sure we will
- abort if we are passed pseudo registers. */
-
-int
-registers_ok_for_quad_peep (reg1, reg2)
- rtx reg1, reg2;
-{
- /* We might have been passed a SUBREG. */
- if (GET_CODE (reg1) != REG || GET_CODE (reg2) != REG)
- return 0;
-
- return (REGNO (reg1) == REGNO (reg2) - 1);
-}
-
-/* Return 1 if addr1 and addr2 are suitable for lfq or stfq insn. addr1 and
- addr2 must be in consecutive memory locations (addr2 == addr1 + 8). */
-
-int
-addrs_ok_for_quad_peep (addr1, addr2)
- register rtx addr1;
- register rtx addr2;
-{
- int reg1;
- int offset1;
-
- /* Extract an offset (if used) from the first addr. */
- if (GET_CODE (addr1) == PLUS)
- {
- /* If not a REG, return zero. */
- if (GET_CODE (XEXP (addr1, 0)) != REG)
- return 0;
- else
- {
- reg1 = REGNO (XEXP (addr1, 0));
- /* The offset must be constant! */
- if (GET_CODE (XEXP (addr1, 1)) != CONST_INT)
- return 0;
- offset1 = INTVAL (XEXP (addr1, 1));
- }
- }
- else if (GET_CODE (addr1) != REG)
- return 0;
- else
- {
- reg1 = REGNO (addr1);
- /* This was a simple (mem (reg)) expression. Offset is 0. */
- offset1 = 0;
- }
-
- /* Make sure the second address is a (mem (plus (reg) (const_int). */
- if (GET_CODE (addr2) != PLUS)
- return 0;
-
- if (GET_CODE (XEXP (addr2, 0)) != REG
- || GET_CODE (XEXP (addr2, 1)) != CONST_INT)
- return 0;
-
- if (reg1 != REGNO (XEXP (addr2, 0)))
- return 0;
-
- /* The offset for the second addr must be 8 more than the first addr. */
- if (INTVAL (XEXP (addr2, 1)) != offset1 + 8)
- return 0;
-
- /* All the tests passed. addr1 and addr2 are valid for lfq or stfq
- instructions. */
- return 1;
-}
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
- NO_REGS is returned. */
-
-enum reg_class
-secondary_reload_class (class, mode, in)
- enum reg_class class;
- enum machine_mode mode;
- rtx in;
-{
- int regno = true_regnum (in);
-
- if (regno >= FIRST_PSEUDO_REGISTER)
- regno = -1;
-
- /* We can place anything into GENERAL_REGS and can put GENERAL_REGS
- into anything. */
- if (class == GENERAL_REGS || class == BASE_REGS
- || (regno >= 0 && INT_REGNO_P (regno)))
- return NO_REGS;
-
- /* Constants, memory, and FP registers can go into FP registers. */
- if ((regno == -1 || FP_REGNO_P (regno))
- && (class == FLOAT_REGS || class == NON_SPECIAL_REGS))
- return NO_REGS;
-
- /* We can copy among the CR registers. */
- if ((class == CR_REGS || class == CR0_REGS)
- && regno >= 0 && CR_REGNO_P (regno))
- return NO_REGS;
-
- /* Otherwise, we need GENERAL_REGS. */
- return GENERAL_REGS;
-}
-
-/* Given a comparison operation, return the bit number in CCR to test. We
- know this is a valid comparison.
-
- SCC_P is 1 if this is for an scc. That means that %D will have been
- used instead of %C, so the bits will be in different places.
-
- Return -1 if OP isn't a valid comparison for some reason. */
-
-int
-ccr_bit (op, scc_p)
- register rtx op;
- int scc_p;
-{
- enum rtx_code code = GET_CODE (op);
- enum machine_mode cc_mode;
- int cc_regnum;
- int base_bit;
-
- if (GET_RTX_CLASS (code) != '<')
- return -1;
-
- cc_mode = GET_MODE (XEXP (op, 0));
- cc_regnum = REGNO (XEXP (op, 0));
- base_bit = 4 * (cc_regnum - 68);
-
- /* In CCEQmode cases we have made sure that the result is always in the
- third bit of the CR field. */
-
- if (cc_mode == CCEQmode)
- return base_bit + 3;
-
- switch (code)
- {
- case NE:
- return scc_p ? base_bit + 3 : base_bit + 2;
- case EQ:
- return base_bit + 2;
- case GT: case GTU:
- return base_bit + 1;
- case LT: case LTU:
- return base_bit;
-
- case GE: case GEU:
- /* If floating-point, we will have done a cror to put the bit in the
- unordered position. So test that bit. For integer, this is ! LT
- unless this is an scc insn. */
- return cc_mode == CCFPmode || scc_p ? base_bit + 3 : base_bit;
-
- case LE: case LEU:
- return cc_mode == CCFPmode || scc_p ? base_bit + 3 : base_bit + 1;
-
- default:
- abort ();
- }
-}
-
-/* Return the GOT register, creating it if needed. */
-
-struct rtx_def *
-rs6000_got_register (value)
- rtx value;
-{
- if (!current_function_uses_pic_offset_table || !pic_offset_table_rtx)
- {
- if (reload_in_progress || reload_completed)
- fatal_insn ("internal error -- needed new GOT register during reload phase to load:", value);
-
- current_function_uses_pic_offset_table = 1;
- pic_offset_table_rtx = gen_rtx (REG, Pmode, GOT_TOC_REGNUM);
- }
-
- return pic_offset_table_rtx;
-}
-
-
-/* Replace all occurances of register FROM with an new pseduo register in an insn X.
- Store the pseudo register used in REG.
- This is only safe during FINALIZE_PIC, since the registers haven't been setup
- yet. */
-
-static rtx
-rs6000_replace_regno (x, from, reg)
- rtx x;
- int from;
- rtx *reg;
-{
- register int i, j;
- register char *fmt;
-
- /* Allow this function to make replacements in EXPR_LISTs. */
- if (!x)
- return x;
-
- switch (GET_CODE (x))
- {
- case SCRATCH:
- case PC:
- case CC0:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- return x;
-
- case REG:
- if (REGNO (x) == from)
- {
- if (! *reg)
- *reg = pic_offset_table_rtx = gen_reg_rtx (Pmode);
-
- return *reg;
- }
-
- return x;
- }
-
- fmt = GET_RTX_FORMAT (GET_CODE (x));
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- XEXP (x, i) = rs6000_replace_regno (XEXP (x, i), from, reg);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- XVECEXP (x, i, j) = rs6000_replace_regno (XVECEXP (x, i, j), from, reg);
- }
-
- return x;
-}
-
-
-/* By generating position-independent code, when two different
- programs (A and B) share a common library (libC.a), the text of
- the library can be shared whether or not the library is linked at
- the same address for both programs. In some of these
- environments, position-independent code requires not only the use
- of different addressing modes, but also special code to enable the
- use of these addressing modes.
-
- The `FINALIZE_PIC' macro serves as a hook to emit these special
- codes once the function is being compiled into assembly code, but
- not before. (It is not done before, because in the case of
- compiling an inline function, it would lead to multiple PIC
- prologues being included in functions which used inline functions
- and were compiled to assembly language.) */
-
-void
-rs6000_finalize_pic ()
-{
- /* Loop through all of the insns, replacing the special GOT_TOC_REGNUM
- with an appropriate pseduo register. If we find we need GOT/TOC,
- add the appropriate init code. */
- if (flag_pic && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS))
- {
- rtx insn = get_insns ();
- rtx reg = NULL_RTX;
- rtx first_insn;
-
- if (GET_CODE (insn) == NOTE)
- insn = next_nonnote_insn (insn);
-
- first_insn = insn;
- for ( ; insn != NULL_RTX; insn = NEXT_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- PATTERN (insn) = rs6000_replace_regno (PATTERN (insn),
- GOT_TOC_REGNUM,
- &reg);
-
- if (REG_NOTES (insn))
- REG_NOTES (insn) = rs6000_replace_regno (REG_NOTES (insn),
- GOT_TOC_REGNUM,
- &reg);
- }
- }
-
- if (reg)
- {
- rtx init = gen_init_v4_pic (reg);
- emit_insn_before (init, first_insn);
- }
- }
-}
-
-
-/* Search for any occurrance of the GOT_TOC register marker that should
- have been eliminated, but may have crept back in. */
-
-void
-rs6000_reorg (insn)
- rtx insn;
-{
- if (flag_pic && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS))
- {
- rtx got_reg = gen_rtx (REG, Pmode, GOT_TOC_REGNUM);
- for ( ; insn != NULL_RTX; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_mentioned_p (got_reg, PATTERN (insn)))
- fatal_insn ("GOT/TOC register marker not removed:", PATTERN (insn));
- }
-}
-
-
-/* Define the structure for the machine field in struct function. */
-struct machine_function
-{
- int sysv_varargs_p;
- int save_toc_p;
- int fpmem_size;
- int fpmem_offset;
-};
-
-/* Functions to save and restore rs6000_fpmem_size.
- These will be called, via pointer variables,
- from push_function_context and pop_function_context. */
-
-void
-rs6000_save_machine_status (p)
- struct function *p;
-{
- struct machine_function *machine =
- (struct machine_function *) xmalloc (sizeof (struct machine_function));
-
- p->machine = machine;
- machine->sysv_varargs_p = rs6000_sysv_varargs_p;
- machine->fpmem_size = rs6000_fpmem_size;
- machine->fpmem_offset = rs6000_fpmem_offset;
-}
-
-void
-rs6000_restore_machine_status (p)
- struct function *p;
-{
- struct machine_function *machine = p->machine;
-
- rs6000_sysv_varargs_p = machine->sysv_varargs_p;
- rs6000_fpmem_size = machine->fpmem_size;
- rs6000_fpmem_offset = machine->fpmem_offset;
-
- free (machine);
- p->machine = (struct machine_function *)0;
-}
-
-/* Do anything needed before RTL is emitted for each function. */
-
-void
-rs6000_init_expanders ()
-{
- /* Reset varargs and save TOC indicator */
- rs6000_sysv_varargs_p = 0;
- rs6000_fpmem_size = 0;
- rs6000_fpmem_offset = 0;
- pic_offset_table_rtx = (rtx)0;
-
- /* Arrange to save and restore machine status around nested functions. */
- save_machine_status = rs6000_save_machine_status;
- restore_machine_status = rs6000_restore_machine_status;
-}
-
-
-/* Print an operand. Recognize special options, documented below. */
-
-#ifdef TARGET_SDATA
-#define SMALL_DATA_RELOC ((rs6000_sdata == SDATA_EABI) ? "sda21" : "sdarel")
-#else
-#define SMALL_DATA_RELOC "sda21"
-#endif
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- char code;
-{
- int i;
- int val;
-
- /* These macros test for integers and extract the low-order bits. */
-#define INT_P(X) \
-((GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE) \
- && GET_MODE (X) == VOIDmode)
-
-#define INT_LOWPART(X) \
- (GET_CODE (X) == CONST_INT ? INTVAL (X) : CONST_DOUBLE_LOW (X))
-
- switch (code)
- {
- case '.':
- /* Write out an instruction after the call which may be replaced
- with glue code by the loader. This depends on the AIX version. */
- asm_fprintf (file, RS6000_CALL_GLUE);
- return;
-
- case '*':
- /* Write the register number of the TOC register. */
- fputs (TARGET_MINIMAL_TOC ? reg_names[30] : reg_names[2], file);
- return;
-
- case '$':
- /* Write out either a '.' or '$' for the current location, depending
- on whether this is Solaris or not. */
- putc ((DEFAULT_ABI == ABI_SOLARIS) ? '.' : '$', file);
- return;
-
- case 'A':
- /* If X is a constant integer whose low-order 5 bits are zero,
- write 'l'. Otherwise, write 'r'. This is a kludge to fix a bug
- in the AIX assembler where "sri" with a zero shift count
- write a trash instruction. */
- if (GET_CODE (x) == CONST_INT && (INTVAL (x) & 31) == 0)
- putc ('l', file);
- else
- putc ('r', file);
- return;
-
- case 'b':
- /* Low-order 16 bits of constant, unsigned. */
- if (! INT_P (x))
- output_operand_lossage ("invalid %%b value");
-
- fprintf (file, "%d", INT_LOWPART (x) & 0xffff);
- return;
-
- case 'C':
- /* This is an optional cror needed for LE or GE floating-point
- comparisons. Otherwise write nothing. */
- if ((GET_CODE (x) == LE || GET_CODE (x) == GE)
- && GET_MODE (XEXP (x, 0)) == CCFPmode)
- {
- int base_bit = 4 * (REGNO (XEXP (x, 0)) - 68);
-
- fprintf (file, "cror %d,%d,%d\n\t", base_bit + 3,
- base_bit + 2, base_bit + (GET_CODE (x) == GE));
- }
- return;
-
- case 'D':
- /* Similar, except that this is for an scc, so we must be able to
- encode the test in a single bit that is one. We do the above
- for any LE, GE, GEU, or LEU and invert the bit for NE. */
- if (GET_CODE (x) == LE || GET_CODE (x) == GE
- || GET_CODE (x) == LEU || GET_CODE (x) == GEU)
- {
- int base_bit = 4 * (REGNO (XEXP (x, 0)) - 68);
-
- fprintf (file, "cror %d,%d,%d\n\t", base_bit + 3,
- base_bit + 2,
- base_bit + (GET_CODE (x) == GE || GET_CODE (x) == GEU));
- }
-
- else if (GET_CODE (x) == NE)
- {
- int base_bit = 4 * (REGNO (XEXP (x, 0)) - 68);
-
- fprintf (file, "crnor %d,%d,%d\n\t", base_bit + 3,
- base_bit + 2, base_bit + 2);
- }
- return;
-
- case 'E':
- /* X is a CR register. Print the number of the third bit of the CR */
- if (GET_CODE (x) != REG || ! CR_REGNO_P (REGNO (x)))
- output_operand_lossage ("invalid %%E value");
-
- fprintf(file, "%d", 4 * (REGNO (x) - 68) + 3);
- return;
-
- case 'f':
- /* X is a CR register. Print the shift count needed to move it
- to the high-order four bits. */
- if (GET_CODE (x) != REG || ! CR_REGNO_P (REGNO (x)))
- output_operand_lossage ("invalid %%f value");
- else
- fprintf (file, "%d", 4 * (REGNO (x) - 68));
- return;
-
- case 'F':
- /* Similar, but print the count for the rotate in the opposite
- direction. */
- if (GET_CODE (x) != REG || ! CR_REGNO_P (REGNO (x)))
- output_operand_lossage ("invalid %%F value");
- else
- fprintf (file, "%d", 32 - 4 * (REGNO (x) - 68));
- return;
-
- case 'G':
- /* X is a constant integer. If it is negative, print "m",
- otherwise print "z". This is to make a aze or ame insn. */
- if (GET_CODE (x) != CONST_INT)
- output_operand_lossage ("invalid %%G value");
- else if (INTVAL (x) >= 0)
- putc ('z', file);
- else
- putc ('m', file);
- return;
-
- case 'h':
- /* If constant, output low-order five bits. Otherwise,
- write normally. */
- if (INT_P (x))
- fprintf (file, "%d", INT_LOWPART (x) & 31);
- else
- print_operand (file, x, 0);
- return;
-
- case 'H':
- /* If constant, output low-order six bits. Otherwise,
- write normally. */
- if (INT_P (x))
- fprintf (file, "%d", INT_LOWPART (x) & 63);
- else
- print_operand (file, x, 0);
- return;
-
- case 'I':
- /* Print `i' if this is a constant, else nothing. */
- if (INT_P (x))
- putc ('i', file);
- return;
-
- case 'j':
- /* Write the bit number in CCR for jump. */
- i = ccr_bit (x, 0);
- if (i == -1)
- output_operand_lossage ("invalid %%j code");
- else
- fprintf (file, "%d", i);
- return;
-
- case 'J':
- /* Similar, but add one for shift count in rlinm for scc and pass
- scc flag to `ccr_bit'. */
- i = ccr_bit (x, 1);
- if (i == -1)
- output_operand_lossage ("invalid %%J code");
- else
- /* If we want bit 31, write a shift count of zero, not 32. */
- fprintf (file, "%d", i == 31 ? 0 : i + 1);
- return;
-
- case 'k':
- /* X must be a constant. Write the 1's complement of the
- constant. */
- if (! INT_P (x))
- output_operand_lossage ("invalid %%k value");
-
- fprintf (file, "%d", ~ INT_LOWPART (x));
- return;
-
- case 'L':
- /* Write second word of DImode or DFmode reference. Works on register
- or non-indexed memory only. */
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x) + 1]);
- else if (GET_CODE (x) == MEM)
- {
- /* Handle possible auto-increment. Since it is pre-increment and
- we have already done it, we can just use an offset of four. */
- if (GET_CODE (XEXP (x, 0)) == PRE_INC
- || GET_CODE (XEXP (x, 0)) == PRE_DEC)
- output_address (plus_constant (XEXP (XEXP (x, 0), 0), 4));
- else
- output_address (plus_constant (XEXP (x, 0), 4));
- if (small_data_operand (x, GET_MODE (x)))
- fprintf (file, "@%s(%s)", SMALL_DATA_RELOC, reg_names[0]);
- }
- return;
-
- case 'm':
- /* MB value for a mask operand. */
- if (! mask_operand (x, VOIDmode))
- output_operand_lossage ("invalid %%m value");
-
- val = INT_LOWPART (x);
-
- /* If the high bit is set and the low bit is not, the value is zero.
- If the high bit is zero, the value is the first 1 bit we find from
- the left. */
- if (val < 0 && (val & 1) == 0)
- {
- putc ('0', file);
- return;
- }
- else if (val >= 0)
- {
- for (i = 1; i < 32; i++)
- if ((val <<= 1) < 0)
- break;
- fprintf (file, "%d", i);
- return;
- }
-
- /* Otherwise, look for the first 0 bit from the right. The result is its
- number plus 1. We know the low-order bit is one. */
- for (i = 0; i < 32; i++)
- if (((val >>= 1) & 1) == 0)
- break;
-
- /* If we ended in ...01, I would be 0. The correct value is 31, so
- we want 31 - i. */
- fprintf (file, "%d", 31 - i);
- return;
-
- case 'M':
- /* ME value for a mask operand. */
- if (! mask_operand (x, VOIDmode))
- output_operand_lossage ("invalid %%m value");
-
- val = INT_LOWPART (x);
-
- /* If the low bit is set and the high bit is not, the value is 31.
- If the low bit is zero, the value is the first 1 bit we find from
- the right. */
- if ((val & 1) && val >= 0)
- {
- fputs ("31", file);
- return;
- }
- else if ((val & 1) == 0)
- {
- for (i = 0; i < 32; i++)
- if ((val >>= 1) & 1)
- break;
-
- /* If we had ....10, I would be 0. The result should be
- 30, so we need 30 - i. */
- fprintf (file, "%d", 30 - i);
- return;
- }
-
- /* Otherwise, look for the first 0 bit from the left. The result is its
- number minus 1. We know the high-order bit is one. */
- for (i = 0; i < 32; i++)
- if ((val <<= 1) >= 0)
- break;
-
- fprintf (file, "%d", i);
- return;
-
- case 'N':
- /* Write the number of elements in the vector times 4. */
- if (GET_CODE (x) != PARALLEL)
- output_operand_lossage ("invalid %%N value");
-
- fprintf (file, "%d", XVECLEN (x, 0) * 4);
- return;
-
- case 'O':
- /* Similar, but subtract 1 first. */
- if (GET_CODE (x) != PARALLEL)
- output_operand_lossage ("invalid %%N value");
-
- fprintf (file, "%d", (XVECLEN (x, 0) - 1) * 4);
- return;
-
- case 'p':
- /* X is a CONST_INT that is a power of two. Output the logarithm. */
- if (! INT_P (x)
- || (i = exact_log2 (INT_LOWPART (x))) < 0)
- output_operand_lossage ("invalid %%p value");
-
- fprintf (file, "%d", i);
- return;
-
- case 'P':
- /* The operand must be an indirect memory reference. The result
- is the register number. */
- if (GET_CODE (x) != MEM || GET_CODE (XEXP (x, 0)) != REG
- || REGNO (XEXP (x, 0)) >= 32)
- output_operand_lossage ("invalid %%P value");
-
- fprintf (file, "%d", REGNO (XEXP (x, 0)));
- return;
-
- case 'R':
- /* X is a CR register. Print the mask for `mtcrf'. */
- if (GET_CODE (x) != REG || ! CR_REGNO_P (REGNO (x)))
- output_operand_lossage ("invalid %%R value");
- else
- fprintf (file, "%d", 128 >> (REGNO (x) - 68));
- return;
-
- case 's':
- /* Low 5 bits of 32 - value */
- if (! INT_P (x))
- output_operand_lossage ("invalid %%s value");
-
- fprintf (file, "%d", (32 - INT_LOWPART (x)) & 31);
- return;
-
- case 't':
- /* Write 12 if this jump operation will branch if true, 4 otherwise.
- All floating-point operations except NE branch true and integer
- EQ, LT, GT, LTU and GTU also branch true. */
- if (GET_RTX_CLASS (GET_CODE (x)) != '<')
- output_operand_lossage ("invalid %%t value");
-
- else if ((GET_MODE (XEXP (x, 0)) == CCFPmode
- && GET_CODE (x) != NE)
- || GET_CODE (x) == EQ
- || GET_CODE (x) == LT || GET_CODE (x) == GT
- || GET_CODE (x) == LTU || GET_CODE (x) == GTU)
- fputs ("12", file);
- else
- putc ('4', file);
- return;
-
- case 'T':
- /* Opposite of 't': write 4 if this jump operation will branch if true,
- 12 otherwise. */
- if (GET_RTX_CLASS (GET_CODE (x)) != '<')
- output_operand_lossage ("invalid %%t value");
-
- else if ((GET_MODE (XEXP (x, 0)) == CCFPmode
- && GET_CODE (x) != NE)
- || GET_CODE (x) == EQ
- || GET_CODE (x) == LT || GET_CODE (x) == GT
- || GET_CODE (x) == LTU || GET_CODE (x) == GTU)
- putc ('4', file);
- else
- fputs ("12", file);
- return;
-
- case 'u':
- /* High-order 16 bits of constant for use in unsigned operand. */
- if (! INT_P (x))
- output_operand_lossage ("invalid %%u value");
-
- fprintf (file, "0x%x", (INT_LOWPART (x) >> 16) & 0xffff);
- return;
-
- case 'v':
- /* High-order 16 bits of constant for use in signed operand. */
- if (! INT_P (x))
- output_operand_lossage ("invalid %%v value");
-
- {
- int value = (INT_LOWPART (x) >> 16) & 0xffff;
-
- /* Solaris assembler doesn't like lis 0,0x80000 */
- if (DEFAULT_ABI == ABI_SOLARIS && (value & 0x8000) != 0)
- fprintf (file, "%d", value | (~0 << 16));
- else
- fprintf (file, "0x%x", value);
- return;
- }
-
- case 'U':
- /* Print `u' if this has an auto-increment or auto-decrement. */
- if (GET_CODE (x) == MEM
- && (GET_CODE (XEXP (x, 0)) == PRE_INC
- || GET_CODE (XEXP (x, 0)) == PRE_DEC))
- putc ('u', file);
- return;
-
- case 'w':
- /* If constant, low-order 16 bits of constant, signed. Otherwise, write
- normally. */
- if (INT_P (x))
- fprintf (file, "%d",
- (INT_LOWPART (x) & 0xffff) - 2 * (INT_LOWPART (x) & 0x8000));
- else
- print_operand (file, x, 0);
- return;
-
- case 'W':
- /* If constant, low-order 16 bits of constant, unsigned.
- Otherwise, write normally. */
- if (INT_P (x))
- fprintf (file, "%d", INT_LOWPART (x) & 0xffff);
- else
- print_operand (file, x, 0);
- return;
-
- case 'X':
- if (GET_CODE (x) == MEM
- && LEGITIMATE_INDEXED_ADDRESS_P (XEXP (x, 0)))
- putc ('x', file);
- return;
-
- case 'Y':
- /* Like 'L', for third word of TImode */
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x) + 2]);
- else if (GET_CODE (x) == MEM)
- {
- if (GET_CODE (XEXP (x, 0)) == PRE_INC
- || GET_CODE (XEXP (x, 0)) == PRE_DEC)
- output_address (plus_constant (XEXP (XEXP (x, 0), 0), 8));
- else
- output_address (plus_constant (XEXP (x, 0), 8));
- if (small_data_operand (x, GET_MODE (x)))
- fprintf (file, "@%s(%s)", SMALL_DATA_RELOC, reg_names[0]);
- }
- return;
-
- case 'z':
- /* X is a SYMBOL_REF. Write out the name preceded by a
- period and without any trailing data in brackets. Used for function
- names. If we are configured for System V (or the embedded ABI) on
- the PowerPC, do not emit the period, since those systems do not use
- TOCs and the like. */
- if (GET_CODE (x) != SYMBOL_REF)
- abort ();
-
- if (XSTR (x, 0)[0] != '.')
- {
- switch (DEFAULT_ABI)
- {
- default:
- abort ();
-
- case ABI_AIX:
- putc ('.', file);
- break;
-
- case ABI_V4:
- case ABI_AIX_NODESC:
- case ABI_SOLARIS:
- break;
-
- case ABI_NT:
- fputs ("..", file);
- break;
- }
- }
- RS6000_OUTPUT_BASENAME (file, XSTR (x, 0));
- return;
-
- case 'Z':
- /* Like 'L', for last word of TImode. */
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x) + 3]);
- else if (GET_CODE (x) == MEM)
- {
- if (GET_CODE (XEXP (x, 0)) == PRE_INC
- || GET_CODE (XEXP (x, 0)) == PRE_DEC)
- output_address (plus_constant (XEXP (XEXP (x, 0), 0), 12));
- else
- output_address (plus_constant (XEXP (x, 0), 12));
- if (small_data_operand (x, GET_MODE (x)))
- fprintf (file, "@%s(%s)", SMALL_DATA_RELOC, reg_names[0]);
- }
- return;
-
- case 0:
- if (GET_CODE (x) == REG)
- fprintf (file, "%s", reg_names[REGNO (x)]);
- else if (GET_CODE (x) == MEM)
- {
- /* We need to handle PRE_INC and PRE_DEC here, since we need to
- know the width from the mode. */
- if (GET_CODE (XEXP (x, 0)) == PRE_INC)
- fprintf (file, "%d(%d)", GET_MODE_SIZE (GET_MODE (x)),
- REGNO (XEXP (XEXP (x, 0), 0)));
- else if (GET_CODE (XEXP (x, 0)) == PRE_DEC)
- fprintf (file, "%d(%d)", - GET_MODE_SIZE (GET_MODE (x)),
- REGNO (XEXP (XEXP (x, 0), 0)));
- else
- output_address (XEXP (x, 0));
- }
- else
- output_addr_const (file, x);
- return;
-
- default:
- output_operand_lossage ("invalid %%xn code");
- }
-}
-
-/* Print the address of an operand. */
-
-void
-print_operand_address (file, x)
- FILE *file;
- register rtx x;
-{
- if (GET_CODE (x) == REG)
- fprintf (file, "0(%s)", reg_names[ REGNO (x) ]);
- else if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == CONST || GET_CODE (x) == LABEL_REF)
- {
- output_addr_const (file, x);
- if (small_data_operand (x, GET_MODE (x)))
- fprintf (file, "@%s(%s)", SMALL_DATA_RELOC, reg_names[0]);
-
-#ifdef TARGET_NO_TOC
- else if (TARGET_NO_TOC)
- ;
-#endif
- else
- fprintf (file, "(%s)", reg_names[ TARGET_MINIMAL_TOC ? 30 : 2 ]);
- }
- else if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 1)) == REG)
- {
- if (REGNO (XEXP (x, 0)) == 0)
- fprintf (file, "%s,%s", reg_names[ REGNO (XEXP (x, 1)) ],
- reg_names[ REGNO (XEXP (x, 0)) ]);
- else
- fprintf (file, "%s,%s", reg_names[ REGNO (XEXP (x, 0)) ],
- reg_names[ REGNO (XEXP (x, 1)) ]);
- }
- else if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 1)) == CONST_INT)
- fprintf (file, "%d(%s)", INTVAL (XEXP (x, 1)), reg_names[ REGNO (XEXP (x, 0)) ]);
- else if (TARGET_ELF && !TARGET_64BIT && GET_CODE (x) == LO_SUM
- && GET_CODE (XEXP (x, 0)) == REG && CONSTANT_P (XEXP (x, 1)))
- {
- output_addr_const (file, XEXP (x, 1));
- fprintf (file, "@l(%s)", reg_names[ REGNO (XEXP (x, 0)) ]);
- }
- else
- abort ();
-}
-
-/* This page contains routines that are used to determine what the function
- prologue and epilogue code will do and write them out. */
-
-/* Return the first fixed-point register that is required to be saved. 32 if
- none. */
-
-int
-first_reg_to_save ()
-{
- int first_reg;
-
- /* Find lowest numbered live register. */
- for (first_reg = 13; first_reg <= 31; first_reg++)
- if (regs_ever_live[first_reg])
- break;
-
- /* If profiling, then we must save/restore every register that contains
- a parameter before/after the .mcount call. Use registers from 30 down
- to 23 to do this. Don't use the frame pointer in reg 31.
-
- For now, save enough room for all of the parameter registers. */
- if (DEFAULT_ABI == ABI_AIX && profile_flag)
- if (first_reg > 23)
- first_reg = 23;
-
- return first_reg;
-}
-
-/* Similar, for FP regs. */
-
-int
-first_fp_reg_to_save ()
-{
- int first_reg;
-
- /* Find lowest numbered live register. */
- for (first_reg = 14 + 32; first_reg <= 63; first_reg++)
- if (regs_ever_live[first_reg])
- break;
-
- return first_reg;
-}
-
-/* Return non-zero if this function makes calls. */
-
-int
-rs6000_makes_calls ()
-{
- rtx insn;
-
- /* If we are profiling, we will be making a call to mcount. */
- if (profile_flag)
- return 1;
-
- for (insn = get_insns (); insn; insn = next_insn (insn))
- if (GET_CODE (insn) == CALL_INSN)
- return 1;
-
- return 0;
-}
-
-
-/* Calculate the stack information for the current function. This is
- complicated by having two separate calling sequences, the AIX calling
- sequence and the V.4 calling sequence.
-
- AIX stack frames look like:
-
- SP----> +---------------------------------------+
- | back chain to caller | 0
- +---------------------------------------+
- | saved CR | 4
- +---------------------------------------+
- | saved LR | 8
- +---------------------------------------+
- | reserved for compilers | 12
- +---------------------------------------+
- | reserved for binders | 16
- +---------------------------------------+
- | saved TOC pointer | 20
- +---------------------------------------+
- | Parameter save area (P) | 24
- +---------------------------------------+
- | Alloca space (A) | 24+P
- +---------------------------------------+
- | Local variable space (L) | 24+P+A
- +---------------------------------------+
- | Float/int conversion temporary (X) | 24+P+A+L
- +---------------------------------------+
- | Save area for GP registers (G) | 24+P+A+X+L
- +---------------------------------------+
- | Save area for FP registers (F) | 24+P+A+X+L+G
- +---------------------------------------+
- old SP->| back chain to caller's caller |
- +---------------------------------------+
-
- V.4 stack frames look like:
-
- SP----> +---------------------------------------+
- | back chain to caller | 0
- +---------------------------------------+
- | caller's saved LR | 4
- +---------------------------------------+
- | Parameter save area (P) | 8
- +---------------------------------------+
- | Alloca space (A) | 8+P
- +---------------------------------------+
- | Varargs save area (V) | 8+P+A
- +---------------------------------------+
- | Local variable space (L) | 8+P+A+V
- +---------------------------------------+
- | Float/int conversion temporary (X) | 8+P+A+V+L
- +---------------------------------------+
- | saved CR (C) | 8+P+A+V+L+X
- +---------------------------------------+
- | Save area for GP registers (G) | 8+P+A+V+L+X+C
- +---------------------------------------+
- | Save area for FP registers (F) | 8+P+A+V+L+X+C+G
- +---------------------------------------+
- old SP->| back chain to caller's caller |
- +---------------------------------------+
-
-
- A PowerPC Windows/NT frame looks like:
-
- SP----> +---------------------------------------+
- | back chain to caller | 0
- +---------------------------------------+
- | reserved | 4
- +---------------------------------------+
- | reserved | 8
- +---------------------------------------+
- | reserved | 12
- +---------------------------------------+
- | reserved | 16
- +---------------------------------------+
- | reserved | 20
- +---------------------------------------+
- | Parameter save area (P) | 24
- +---------------------------------------+
- | Alloca space (A) | 24+P
- +---------------------------------------+
- | Local variable space (L) | 24+P+A
- +---------------------------------------+
- | Float/int conversion temporary (X) | 24+P+A+L
- +---------------------------------------+
- | Save area for FP registers (F) | 24+P+A+L+X
- +---------------------------------------+
- | Possible alignment area (Y) | 24+P+A+L+X+F
- +---------------------------------------+
- | Save area for GP registers (G) | 24+P+A+L+X+F+Y
- +---------------------------------------+
- | Save area for CR (C) | 24+P+A+L+X+F+Y+G
- +---------------------------------------+
- | Save area for TOC (T) | 24+P+A+L+X+F+Y+G+C
- +---------------------------------------+
- | Save area for LR (R) | 24+P+A+L+X+F+Y+G+C+T
- +---------------------------------------+
- old SP->| back chain to caller's caller |
- +---------------------------------------+
-
- For NT, there is no specific order to save the registers, but in
- order to support __builtin_return_address, the save area for the
- link register needs to be in a known place, so we use -4 off of the
- old SP. To support calls through pointers, we also allocate a
- fixed slot to store the TOC, -8 off the old SP. */
-
-#ifndef ABI_STACK_BOUNDARY
-#define ABI_STACK_BOUNDARY STACK_BOUNDARY
-#endif
-
-rs6000_stack_t *
-rs6000_stack_info ()
-{
- static rs6000_stack_t info, zero_info;
- rs6000_stack_t *info_ptr = &info;
- int reg_size = TARGET_64BIT ? 8 : 4;
- enum rs6000_abi abi;
- int total_raw_size;
-
- /* Zero all fields portably */
- info = zero_info;
-
- /* Select which calling sequence */
- info_ptr->abi = abi = DEFAULT_ABI;
-
- /* Calculate which registers need to be saved & save area size */
- info_ptr->first_gp_reg_save = first_reg_to_save ();
- info_ptr->gp_size = reg_size * (32 - info_ptr->first_gp_reg_save);
-
- info_ptr->first_fp_reg_save = first_fp_reg_to_save ();
- info_ptr->fp_size = 8 * (64 - info_ptr->first_fp_reg_save);
-
- /* Does this function call anything? */
- info_ptr->calls_p = rs6000_makes_calls ();
-
- /* Allocate space to save the toc. */
- if (abi == ABI_NT && info_ptr->calls_p)
- {
- info_ptr->toc_save_p = 1;
- info_ptr->toc_size = reg_size;
- }
-
- /* Does this machine need the float/int conversion area? */
- info_ptr->fpmem_p = regs_ever_live[FPMEM_REGNUM];
-
- /* If this is main and we need to call a function to set things up,
- save main's arguments around the call. */
-#ifdef TARGET_EABI
- if (TARGET_EABI)
-#endif
- {
- if (strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)), "main") == 0)
- {
- info_ptr->main_p = 1;
-
-#ifdef NAME__MAIN
- info_ptr->calls_p = 1;
-
- if (DECL_ARGUMENTS (current_function_decl))
- {
- int i;
- tree arg;
-
- info_ptr->main_save_p = 1;
- info_ptr->main_size = 0;
-
- for ((i = 0), (arg = DECL_ARGUMENTS (current_function_decl));
- arg != NULL_TREE && i < 8;
- (arg = TREE_CHAIN (arg)), i++)
- {
- info_ptr->main_size += reg_size;
- }
- }
-#endif
- }
- }
-
-
- /* Determine if we need to save the link register */
- if (regs_ever_live[65] || profile_flag
-#ifdef TARGET_RELOCATABLE
- || (TARGET_RELOCATABLE && (get_pool_size () != 0))
-#endif
- || (info_ptr->first_fp_reg_save != 64
- && !FP_SAVE_INLINE (info_ptr->first_fp_reg_save))
- || (abi == ABI_V4 && current_function_calls_alloca)
- || (abi == ABI_SOLARIS && current_function_calls_alloca)
- || info_ptr->calls_p)
- {
- info_ptr->lr_save_p = 1;
- regs_ever_live[65] = 1;
- if (abi == ABI_NT)
- info_ptr->lr_size = reg_size;
- }
-
- /* Determine if we need to save the condition code registers */
- if (regs_ever_live[70] || regs_ever_live[71] || regs_ever_live[72])
- {
- info_ptr->cr_save_p = 1;
- if (abi == ABI_V4 || abi == ABI_NT || abi == ABI_SOLARIS)
- info_ptr->cr_size = reg_size;
- }
-
- /* Determine various sizes */
- info_ptr->reg_size = reg_size;
- info_ptr->fixed_size = RS6000_SAVE_AREA;
- info_ptr->varargs_size = RS6000_VARARGS_AREA;
- info_ptr->vars_size = ALIGN (get_frame_size (), 8);
- info_ptr->parm_size = ALIGN (current_function_outgoing_args_size, 8);
- info_ptr->fpmem_size = (info_ptr->fpmem_p) ? 8 : 0;
- info_ptr->save_size = ALIGN (info_ptr->fp_size
- + info_ptr->gp_size
- + info_ptr->cr_size
- + info_ptr->lr_size
- + info_ptr->toc_size
- + info_ptr->main_size, 8);
-
- total_raw_size = (info_ptr->vars_size
- + info_ptr->parm_size
- + info_ptr->fpmem_size
- + info_ptr->save_size
- + info_ptr->varargs_size
- + info_ptr->fixed_size);
-
- info_ptr->total_size = ALIGN (total_raw_size, ABI_STACK_BOUNDARY / BITS_PER_UNIT);
-
- /* Determine if we need to allocate any stack frame.
- For AIX We need to push the stack if a frame pointer is needed (because
- the stack might be dynamically adjusted), if we are debugging, if the
- total stack size is more than 220 bytes, or if we make calls.
-
- For V.4 we don't have the stack cushion that AIX uses, but assume that
- the debugger can handle stackless frames. */
-
- if (info_ptr->calls_p)
- info_ptr->push_p = 1;
-
- else if (abi == ABI_V4 || abi == ABI_NT || abi == ABI_SOLARIS)
- info_ptr->push_p = (total_raw_size > info_ptr->fixed_size
- || info_ptr->lr_save_p);
-
- else
- info_ptr->push_p = (frame_pointer_needed
- || write_symbols != NO_DEBUG
- || info_ptr->total_size > 220);
-
- /* Calculate the offsets */
- switch (abi)
- {
- case ABI_NONE:
- default:
- abort ();
-
- case ABI_AIX:
- case ABI_AIX_NODESC:
- info_ptr->fp_save_offset = - info_ptr->fp_size;
- info_ptr->gp_save_offset = info_ptr->fp_save_offset - info_ptr->gp_size;
- info_ptr->main_save_offset = info_ptr->gp_save_offset - info_ptr->main_size;
- info_ptr->cr_save_offset = 4;
- info_ptr->lr_save_offset = 8;
- break;
-
- case ABI_V4:
- case ABI_SOLARIS:
- info_ptr->fp_save_offset = - info_ptr->fp_size;
- info_ptr->gp_save_offset = info_ptr->fp_save_offset - info_ptr->gp_size;
- info_ptr->cr_save_offset = info_ptr->gp_save_offset - info_ptr->cr_size;
- info_ptr->toc_save_offset = info_ptr->cr_save_offset - info_ptr->toc_size;
- info_ptr->main_save_offset = info_ptr->toc_save_offset - info_ptr->main_size;
- info_ptr->lr_save_offset = reg_size;
- break;
-
- case ABI_NT:
- info_ptr->lr_save_offset = -4;
- info_ptr->toc_save_offset = info_ptr->lr_save_offset - info_ptr->lr_size;
- info_ptr->cr_save_offset = info_ptr->toc_save_offset - info_ptr->toc_size;
- info_ptr->gp_save_offset = info_ptr->cr_save_offset - info_ptr->cr_size - info_ptr->gp_size + reg_size;
- info_ptr->fp_save_offset = info_ptr->gp_save_offset - info_ptr->fp_size;
- if (info_ptr->fp_size && ((- info_ptr->fp_save_offset) % 8) != 0)
- info_ptr->fp_save_offset -= 4;
-
- info_ptr->main_save_offset = info_ptr->fp_save_offset - info_ptr->main_size;
- break;
- }
-
- if (info_ptr->fpmem_p)
- info_ptr->fpmem_offset = STARTING_FRAME_OFFSET - info_ptr->total_size + info_ptr->vars_size;
-
- /* Zero offsets if we're not saving those registers */
- if (!info_ptr->fp_size)
- info_ptr->fp_save_offset = 0;
-
- if (!info_ptr->gp_size)
- info_ptr->gp_save_offset = 0;
-
- if (!info_ptr->lr_save_p)
- info_ptr->lr_save_offset = 0;
-
- if (!info_ptr->cr_save_p)
- info_ptr->cr_save_offset = 0;
-
- if (!info_ptr->toc_save_p)
- info_ptr->toc_save_offset = 0;
-
- if (!info_ptr->main_save_p)
- info_ptr->main_save_offset = 0;
-
- if (!info_ptr->fpmem_p)
- info_ptr->fpmem_offset = 0;
- else
- {
- rs6000_fpmem_size = info_ptr->fpmem_size;
- rs6000_fpmem_offset = info_ptr->total_size + info_ptr->fpmem_offset;
- }
-
- return info_ptr;
-}
-
-void
-debug_stack_info (info)
- rs6000_stack_t *info;
-{
- char *abi_string;
-
- if (!info)
- info = rs6000_stack_info ();
-
- fprintf (stderr, "\nStack information for function %s:\n",
- ((current_function_decl && DECL_NAME (current_function_decl))
- ? IDENTIFIER_POINTER (DECL_NAME (current_function_decl))
- : "<unknown>"));
-
- switch (info->abi)
- {
- default: abi_string = "Unknown"; break;
- case ABI_NONE: abi_string = "NONE"; break;
- case ABI_AIX: abi_string = "AIX"; break;
- case ABI_AIX_NODESC: abi_string = "AIX"; break;
- case ABI_V4: abi_string = "V.4"; break;
- case ABI_SOLARIS: abi_string = "Solaris"; break;
- case ABI_NT: abi_string = "NT"; break;
- }
-
- fprintf (stderr, "\tABI = %5s\n", abi_string);
-
- if (info->first_gp_reg_save != 32)
- fprintf (stderr, "\tfirst_gp_reg_save = %5d\n", info->first_gp_reg_save);
-
- if (info->first_fp_reg_save != 64)
- fprintf (stderr, "\tfirst_fp_reg_save = %5d\n", info->first_fp_reg_save);
-
- if (info->lr_save_p)
- fprintf (stderr, "\tlr_save_p = %5d\n", info->lr_save_p);
-
- if (info->cr_save_p)
- fprintf (stderr, "\tcr_save_p = %5d\n", info->cr_save_p);
-
- if (info->toc_save_p)
- fprintf (stderr, "\ttoc_save_p = %5d\n", info->toc_save_p);
-
- if (info->push_p)
- fprintf (stderr, "\tpush_p = %5d\n", info->push_p);
-
- if (info->calls_p)
- fprintf (stderr, "\tcalls_p = %5d\n", info->calls_p);
-
- if (info->main_p)
- fprintf (stderr, "\tmain_p = %5d\n", info->main_p);
-
- if (info->main_save_p)
- fprintf (stderr, "\tmain_save_p = %5d\n", info->main_save_p);
-
- if (info->fpmem_p)
- fprintf (stderr, "\tfpmem_p = %5d\n", info->fpmem_p);
-
- if (info->gp_save_offset)
- fprintf (stderr, "\tgp_save_offset = %5d\n", info->gp_save_offset);
-
- if (info->fp_save_offset)
- fprintf (stderr, "\tfp_save_offset = %5d\n", info->fp_save_offset);
-
- if (info->lr_save_offset)
- fprintf (stderr, "\tlr_save_offset = %5d\n", info->lr_save_offset);
-
- if (info->cr_save_offset)
- fprintf (stderr, "\tcr_save_offset = %5d\n", info->cr_save_offset);
-
- if (info->toc_save_offset)
- fprintf (stderr, "\ttoc_save_offset = %5d\n", info->toc_save_offset);
-
- if (info->varargs_save_offset)
- fprintf (stderr, "\tvarargs_save_offset = %5d\n", info->varargs_save_offset);
-
- if (info->main_save_offset)
- fprintf (stderr, "\tmain_save_offset = %5d\n", info->main_save_offset);
-
- if (info->fpmem_offset)
- fprintf (stderr, "\tfpmem_offset = %5d\n", info->fpmem_offset);
-
- if (info->total_size)
- fprintf (stderr, "\ttotal_size = %5d\n", info->total_size);
-
- if (info->varargs_size)
- fprintf (stderr, "\tvarargs_size = %5d\n", info->varargs_size);
-
- if (info->vars_size)
- fprintf (stderr, "\tvars_size = %5d\n", info->vars_size);
-
- if (info->parm_size)
- fprintf (stderr, "\tparm_size = %5d\n", info->parm_size);
-
- if (info->fpmem_size)
- fprintf (stderr, "\tfpmem_size = %5d\n", info->fpmem_size);
-
- if (info->fixed_size)
- fprintf (stderr, "\tfixed_size = %5d\n", info->fixed_size);
-
- if (info->gp_size)
- fprintf (stderr, "\tgp_size = %5d\n", info->gp_size);
-
- if (info->fp_size)
- fprintf (stderr, "\tfp_size = %5d\n", info->fp_size);
-
- if (info->lr_size)
- fprintf (stderr, "\tlr_size = %5d\n", info->cr_size);
-
- if (info->cr_size)
- fprintf (stderr, "\tcr_size = %5d\n", info->cr_size);
-
- if (info->toc_size)
- fprintf (stderr, "\ttoc_size = %5d\n", info->toc_size);
-
- if (info->main_size)
- fprintf (stderr, "\tmain_size = %5d\n", info->main_size);
-
- if (info->save_size)
- fprintf (stderr, "\tsave_size = %5d\n", info->save_size);
-
- if (info->reg_size != 4)
- fprintf (stderr, "\treg_size = %5d\n", info->reg_size);
-
- fprintf (stderr, "\n");
-}
-
-
-/* Write function prologue. */
-void
-output_prolog (file, size)
- FILE *file;
- int size;
-{
- rs6000_stack_t *info = rs6000_stack_info ();
- int reg_size = info->reg_size;
- char *store_reg;
- char *load_reg;
- int sp_reg = 1;
- int sp_offset = 0;
-
- if (TARGET_32BIT)
- {
- store_reg = "\t{st|stw} %s,%d(%s)\n";
- load_reg = "\t{l|lwz} %s,%d(%s)\n";
- }
- else
- {
- store_reg = "\tstd %s,%d(%s)\n";
- load_reg = "\tlld %s,%d(%s)\n";
- }
-
- if (TARGET_DEBUG_STACK)
- debug_stack_info (info);
-
- /* Write .extern for any function we will call to save and restore fp
- values. */
- if (info->first_fp_reg_save < 64 && !FP_SAVE_INLINE (info->first_fp_reg_save))
- fprintf (file, "\t.extern %s%d%s\n\t.extern %s%d%s\n",
- SAVE_FP_PREFIX, info->first_fp_reg_save - 32, SAVE_FP_SUFFIX,
- RESTORE_FP_PREFIX, info->first_fp_reg_save - 32, RESTORE_FP_SUFFIX);
-
- /* Write .extern for truncation routines, if needed. */
- if (rs6000_trunc_used && ! trunc_defined)
- {
- fprintf (file, "\t.extern .%s\n\t.extern .%s\n",
- RS6000_ITRUNC, RS6000_UITRUNC);
- trunc_defined = 1;
- }
-
- /* Write .extern for AIX common mode routines, if needed. */
- if (! TARGET_POWER && ! TARGET_POWERPC && ! common_mode_defined)
- {
- fputs ("\t.extern __mulh\n", file);
- fputs ("\t.extern __mull\n", file);
- fputs ("\t.extern __divss\n", file);
- fputs ("\t.extern __divus\n", file);
- fputs ("\t.extern __quoss\n", file);
- fputs ("\t.extern __quous\n", file);
- common_mode_defined = 1;
- }
-
- /* For V.4, update stack before we do any saving and set back pointer. */
- if (info->push_p && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS))
- {
- if (info->total_size < 32767)
- {
- asm_fprintf (file,
- (TARGET_32BIT) ? "\t{stu|stwu} %s,%d(%s)\n" : "\tstdu %s,%d(%s)\n",
- reg_names[1], - info->total_size, reg_names[1]);
- sp_offset = info->total_size;
- }
- else
- {
- int neg_size = - info->total_size;
- sp_reg = 12;
- asm_fprintf (file, "\tmr %s,%s\n", reg_names[12], reg_names[1]);
- asm_fprintf (file, "\t{liu|lis} %s,%d\n\t{oril|ori} %s,%s,%d\n",
- reg_names[0], (neg_size >> 16) & 0xffff,
- reg_names[0], reg_names[0], neg_size & 0xffff);
- asm_fprintf (file,
- (TARGET_32BIT) ? "\t{stux|stwux} %s,%s,%s\n" : "\tstdux %s,%s,%s\n",
- reg_names[1], reg_names[1], reg_names[0]);
- }
- }
-
- /* If we use the link register, get it into r0. */
- if (info->lr_save_p)
- asm_fprintf (file, "\tmflr %s\n", reg_names[0]);
-
- /* If we need to save CR, put it into r12. */
- if (info->cr_save_p && sp_reg != 12)
- asm_fprintf (file, "\tmfcr %s\n", reg_names[12]);
-
- /* Do any required saving of fpr's. If only one or two to save, do it
- ourself. Otherwise, call function. Note that since they are statically
- linked, we do not need a nop following them. */
- if (FP_SAVE_INLINE (info->first_fp_reg_save))
- {
- int regno = info->first_fp_reg_save;
- int loc = info->fp_save_offset + sp_offset;
-
- for ( ; regno < 64; regno++, loc += 8)
- asm_fprintf (file, "\tstfd %s,%d(%s)\n", reg_names[regno], loc, reg_names[sp_reg]);
- }
- else if (info->first_fp_reg_save != 64)
- asm_fprintf (file, "\tbl %s%d%s\n", SAVE_FP_PREFIX,
- info->first_fp_reg_save - 32, SAVE_FP_SUFFIX);
-
- /* Now save gpr's. */
- if (! TARGET_MULTIPLE || info->first_gp_reg_save == 31 || TARGET_64BIT)
- {
- int regno = info->first_gp_reg_save;
- int loc = info->gp_save_offset + sp_offset;
-
- for ( ; regno < 32; regno++, loc += reg_size)
- asm_fprintf (file, store_reg, reg_names[regno], loc, reg_names[sp_reg]);
- }
-
- else if (info->first_gp_reg_save != 32)
- asm_fprintf (file, "\t{stm|stmw} %s,%d(%s)\n",
- reg_names[info->first_gp_reg_save],
- info->gp_save_offset + sp_offset,
- reg_names[sp_reg]);
-
- /* Save main's arguments if we need to call a function */
-#ifdef NAME__MAIN
- if (info->main_save_p)
- {
- int regno;
- int loc = info->main_save_offset + sp_offset;
- int size = info->main_size;
-
- for (regno = 3; size > 0; regno++, loc -= reg_size, size -= reg_size)
- asm_fprintf (file, store_reg, reg_names[regno], loc, reg_names[sp_reg]);
- }
-#endif
-
- /* Save lr if we used it. */
- if (info->lr_save_p)
- asm_fprintf (file, store_reg, reg_names[0], info->lr_save_offset + sp_offset,
- reg_names[sp_reg]);
-
- /* Save CR if we use any that must be preserved. */
- if (info->cr_save_p)
- {
- if (sp_reg == 12) /* If r12 is used to hold the original sp, copy cr now */
- {
- asm_fprintf (file, "\tmfcr %s\n", reg_names[0]);
- asm_fprintf (file, store_reg, reg_names[0],
- info->cr_save_offset + sp_offset,
- reg_names[sp_reg]);
- }
- else
- asm_fprintf (file, store_reg, reg_names[12], info->cr_save_offset + sp_offset,
- reg_names[sp_reg]);
- }
-
- /* NT needs us to probe the stack frame every 4k pages for large frames, so
- do it here. */
- if (DEFAULT_ABI == ABI_NT && info->total_size > 4096)
- {
- if (info->total_size < 32768)
- {
- int probe_offset = 4096;
- while (probe_offset < info->total_size)
- {
- asm_fprintf (file, "\t{l|lwz} %s,%d(%s)\n", reg_names[0], -probe_offset, reg_names[1]);
- probe_offset += 4096;
- }
- }
- else
- {
- int probe_iterations = info->total_size / 4096;
- static int probe_labelno = 0;
- char buf[256];
-
- if (probe_iterations < 32768)
- asm_fprintf (file, "\tli %s,%d\n", reg_names[12], probe_iterations);
- else
- {
- asm_fprintf (file, "\tlis %s,%d\n", reg_names[12], probe_iterations >> 16);
- if (probe_iterations & 0xffff)
- asm_fprintf (file, "\tori %s,%s,%d\n", reg_names[12], reg_names[12],
- probe_iterations & 0xffff);
- }
- asm_fprintf (file, "\tmtctr %s\n", reg_names[12]);
- asm_fprintf (file, "\tmr %s,%s\n", reg_names[12], reg_names[1]);
- ASM_OUTPUT_INTERNAL_LABEL (file, "LCprobe", probe_labelno);
- asm_fprintf (file, "\t{lu|lwzu} %s,-4096(%s)\n", reg_names[0], reg_names[12]);
- ASM_GENERATE_INTERNAL_LABEL (buf, "LCprobe", probe_labelno++);
- fputs ("\tbdnz ", file);
- assemble_name (file, buf);
- fputs ("\n", file);
- }
- }
-
- /* Update stack and set back pointer and we have already done so for V.4. */
- if (info->push_p && DEFAULT_ABI != ABI_V4 && DEFAULT_ABI != ABI_SOLARIS)
- {
- if (info->total_size < 32767)
- asm_fprintf (file,
- (TARGET_32BIT) ? "\t{stu|stwu} %s,%d(%s)\n" : "\tstdu %s,%d(%s)\n",
- reg_names[1], - info->total_size, reg_names[1]);
- else
- {
- int neg_size = - info->total_size;
- asm_fprintf (file, "\t{liu|lis} %s,%d\n\t{oril|ori} %s,%s,%d\n",
- reg_names[0], (neg_size >> 16) & 0xffff,
- reg_names[0], reg_names[0], neg_size & 0xffff);
- asm_fprintf (file,
- (TARGET_32BIT) ? "\t{stux|stwux} %s,%s,%s\n" : "\tstdux %s,%s,%s\n",
- reg_names[1], reg_names[1], reg_names[0]);
- }
- }
-
- /* Set frame pointer, if needed. */
- if (frame_pointer_needed)
- asm_fprintf (file, "\tmr %s,%s\n", reg_names[31], reg_names[1]);
-
-#ifdef NAME__MAIN
- /* If we need to call a function to set things up for main, do so now
- before dealing with the TOC. */
- if (info->main_p)
- {
- char *prefix = "";
-
- switch (DEFAULT_ABI)
- {
- case ABI_AIX: prefix = "."; break;
- case ABI_NT: prefix = ".."; break;
- }
-
- fprintf (file, "\tbl %s%s\n", prefix, NAME__MAIN);
-#ifdef RS6000_CALL_GLUE2
- fprintf (file, "\t%s%s%s\n", RS6000_CALL_GLUE2, prefix, NAME_MAIN);
-#else
-#ifdef RS6000_CALL_GLUE
- if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
- fprintf (file, "\t%s\n", RS6000_CALL_GLUE);
-#endif
-#endif
-
- if (info->main_save_p)
- {
- int regno;
- int loc;
- int size = info->main_size;
-
- if (info->total_size < 32767)
- {
- loc = info->total_size + info->main_save_offset;
- for (regno = 3; size > 0; regno++, size -= reg_size, loc -= reg_size)
- asm_fprintf (file, load_reg, reg_names[regno], loc, reg_names[1]);
- }
- else
- {
- int neg_size = info->main_save_offset - info->total_size;
- loc = 0;
- asm_fprintf (file, "\t{liu|lis} %s,%d\n\t{oril|ori} %s,%s,%d\n",
- reg_names[0], (neg_size >> 16) & 0xffff,
- reg_names[0], reg_names[0], neg_size & 0xffff);
-
- asm_fprintf (file, "\t{sf|subf} %s,%s,%s\n", reg_names[0], reg_names[0],
- reg_names[1]);
-
- for (regno = 3; size > 0; regno++, size -= reg_size, loc -= reg_size)
- asm_fprintf (file, load_reg, reg_names[regno], loc, reg_names[0]);
- }
- }
- }
-#endif
-
-
- /* If TARGET_MINIMAL_TOC, and the constant pool is needed, then load the
- TOC_TABLE address into register 30. */
- if (TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
- {
- char buf[256];
-
-#ifdef TARGET_RELOCATABLE
- if (TARGET_RELOCATABLE)
- {
- ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno);
- fputs ("\tbl ", file);
- assemble_name (file, buf);
- putc ('\n', file);
-
- ASM_OUTPUT_INTERNAL_LABEL (file, "LCF", rs6000_pic_labelno);
- fprintf (file, "\tmflr %s\n", reg_names[30]);
-
- asm_fprintf (file, (TARGET_32BIT) ? "\t{l|lwz}" : "\tld");
- fprintf (file, " %s,(", reg_names[0]);
- ASM_GENERATE_INTERNAL_LABEL (buf, "LCL", rs6000_pic_labelno);
- assemble_name (file, buf);
- putc ('-', file);
- ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno);
- assemble_name (file, buf);
- fprintf (file, ")(%s)\n", reg_names[30]);
- asm_fprintf (file, "\t{cax|add} %s,%s,%s\n",
- reg_names[30], reg_names[0], reg_names[30]);
- rs6000_pic_labelno++;
- }
- else
-#endif
-
- switch (DEFAULT_ABI)
- {
- case ABI_V4:
- case ABI_SOLARIS:
- case ABI_AIX_NODESC:
- if (TARGET_32BIT)
- {
- ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1);
- asm_fprintf (file, "\t{cau|addis} %s,%s,", reg_names[30], reg_names[0]);
- assemble_name (file, buf);
- asm_fprintf (file, "@ha\n");
- if (TARGET_NEW_MNEMONICS)
- {
- asm_fprintf (file, "\taddi %s,%s,", reg_names[30], reg_names[30]);
- assemble_name (file, buf);
- asm_fprintf (file, "@l\n");
- }
- else
- {
- asm_fprintf (file, "\tcal %s,", reg_names[30]);
- assemble_name (file, buf);
- asm_fprintf (file, "@l(%s)\n", reg_names[30]);
- }
- }
- else
- abort ();
-
- break;
-
- case ABI_NT:
- case ABI_AIX:
- ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 0);
- asm_fprintf (file, "\t{l|lwz} %s,", reg_names[30]);
- assemble_name (file, buf);
- asm_fprintf (file, "(%s)\n", reg_names[2]);
- break;
- }
- }
-
- if (DEFAULT_ABI == ABI_NT)
- {
- assemble_name (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
- fputs (".b:\n", file);
- }
-}
-
-/* Write function epilogue. */
-
-void
-output_epilog (file, size)
- FILE *file;
- int size;
-{
- rs6000_stack_t *info = rs6000_stack_info ();
- char *load_reg = (TARGET_32BIT) ? "\t{l|lwz} %s,%d(%s)\n" : "\tld %s,%d(%s)\n";
- rtx insn = get_last_insn ();
- int sp_reg = 1;
- int sp_offset = 0;
- int i;
-
- /* If the last insn was a BARRIER, we don't have to write anything except
- the trace table. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
- if (insn == 0 || GET_CODE (insn) != BARRIER)
- {
- /* If we have a frame pointer, a call to alloca, or a large stack
- frame, restore the old stack pointer using the backchain. Otherwise,
- we know what size to update it with. */
- if (frame_pointer_needed || current_function_calls_alloca
- || info->total_size > 32767)
- {
- /* Under V.4, don't reset the stack pointer until after we're done
- loading the saved registers. */
- if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- sp_reg = 11;
-
- asm_fprintf (file, load_reg, reg_names[sp_reg], 0, reg_names[1]);
- }
- else if (info->push_p)
- {
- if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- sp_offset = info->total_size;
- else if (TARGET_NEW_MNEMONICS)
- asm_fprintf (file, "\taddi %s,%s,%d\n", reg_names[1], reg_names[1], info->total_size);
- else
- asm_fprintf (file, "\tcal %s,%d(%s)\n", reg_names[1], info->total_size, reg_names[1]);
- }
-
- /* Get the old lr if we saved it. */
- if (info->lr_save_p)
- asm_fprintf (file, load_reg, reg_names[0], info->lr_save_offset + sp_offset, reg_names[sp_reg]);
-
- /* Get the old cr if we saved it. */
- if (info->cr_save_p)
- asm_fprintf (file, load_reg, reg_names[12], info->cr_save_offset + sp_offset, reg_names[sp_reg]);
-
- /* Set LR here to try to overlap restores below. */
- if (info->lr_save_p)
- asm_fprintf (file, "\tmtlr %s\n", reg_names[0]);
-
- /* Restore gpr's. */
- if (! TARGET_MULTIPLE || info->first_gp_reg_save == 31 || TARGET_64BIT)
- {
- int regno = info->first_gp_reg_save;
- int loc = info->gp_save_offset + sp_offset;
- int reg_size = (TARGET_32BIT) ? 4 : 8;
-
- for ( ; regno < 32; regno++, loc += reg_size)
- asm_fprintf (file, load_reg, reg_names[regno], loc, reg_names[sp_reg]);
- }
-
- else if (info->first_gp_reg_save != 32)
- asm_fprintf (file, "\t{lm|lmw} %s,%d(%s)\n",
- reg_names[info->first_gp_reg_save],
- info->gp_save_offset + sp_offset,
- reg_names[sp_reg]);
-
- /* Restore fpr's if we can do it without calling a function. */
- if (FP_SAVE_INLINE (info->first_fp_reg_save))
- {
- int regno = info->first_fp_reg_save;
- int loc = info->fp_save_offset + sp_offset;
-
- for ( ; regno < 64; regno++, loc += 8)
- asm_fprintf (file, "\tlfd %s,%d(%s)\n", reg_names[regno], loc, reg_names[sp_reg]);
- }
-
- /* If we saved cr, restore it here. Just those of cr2, cr3, and cr4
- that were used. */
- if (info->cr_save_p)
- asm_fprintf (file, "\tmtcrf %d,%s\n",
- (regs_ever_live[70] != 0) * 0x20
- + (regs_ever_live[71] != 0) * 0x10
- + (regs_ever_live[72] != 0) * 0x8, reg_names[12]);
-
- /* If this is V.4, unwind the stack pointer after all of the loads have been done */
- if (sp_offset)
- {
- if (TARGET_NEW_MNEMONICS)
- asm_fprintf (file, "\taddi %s,%s,%d\n", reg_names[1], reg_names[1], sp_offset);
- else
- asm_fprintf (file, "\tcal %s,%d(%s)\n", reg_names[1], sp_offset, reg_names[1]);
- }
- else if (sp_reg != 1)
- asm_fprintf (file, "\tmr %s,%s\n", reg_names[1], reg_names[sp_reg]);
-
- /* If we have to restore more than two FP registers, branch to the
- restore function. It will return to our caller. */
- if (info->first_fp_reg_save != 64 && !FP_SAVE_INLINE (info->first_fp_reg_save))
- asm_fprintf (file, "\tb %s%d%s\n", RESTORE_FP_PREFIX,
- info->first_fp_reg_save - 32, RESTORE_FP_SUFFIX);
- else
- asm_fprintf (file, "\t{br|blr}\n");
- }
-
- /* Output a traceback table here. See /usr/include/sys/debug.h for info
- on its format.
-
- We don't output a traceback table if -finhibit-size-directive was
- used. The documentation for -finhibit-size-directive reads
- ``don't output a @code{.size} 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.'' The traceback table has this property, since it
- includes the offset from the start of the function to the
- traceback table itself.
-
- System V.4 Powerpc's (and the embedded ABI derived from it) use a
- different traceback table. */
- if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive)
- {
- char *fname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
- int fixed_parms, float_parms, parm_info;
- int i;
-
- while (*fname == '.') /* V.4 encodes . in the name */
- fname++;
-
- /* Need label immediately before tbtab, so we can compute its offset
- from the function start. */
- if (*fname == '*')
- ++fname;
- ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LT");
- ASM_OUTPUT_LABEL (file, fname);
-
- /* The .tbtab pseudo-op can only be used for the first eight
- expressions, since it can't handle the possibly variable
- length fields that follow. However, if you omit the optional
- fields, the assembler outputs zeros for all optional fields
- anyways, giving each variable length field is minimum length
- (as defined in sys/debug.h). Thus we can not use the .tbtab
- pseudo-op at all. */
-
- /* An all-zero word flags the start of the tbtab, for debuggers
- that have to find it by searching forward from the entry
- point or from the current pc. */
- fputs ("\t.long 0\n", file);
-
- /* Tbtab format type. Use format type 0. */
- fputs ("\t.byte 0,", file);
-
- /* Language type. Unfortunately, there doesn't seem to be any
- official way to get this info, so we use language_string. C
- is 0. C++ is 9. No number defined for Obj-C, so use the
- value for C for now. */
- if (! strcmp (language_string, "GNU C")
- || ! strcmp (language_string, "GNU Obj-C"))
- i = 0;
- else if (! strcmp (language_string, "GNU F77"))
- i = 1;
- else if (! strcmp (language_string, "GNU Ada"))
- i = 3;
- else if (! strcmp (language_string, "GNU PASCAL"))
- i = 2;
- else if (! strcmp (language_string, "GNU C++"))
- i = 9;
- else
- abort ();
- fprintf (file, "%d,", i);
-
- /* 8 single bit fields: global linkage (not set for C extern linkage,
- apparently a PL/I convention?), out-of-line epilogue/prologue, offset
- from start of procedure stored in tbtab, internal function, function
- has controlled storage, function has no toc, function uses fp,
- function logs/aborts fp operations. */
- /* Assume that fp operations are used if any fp reg must be saved. */
- fprintf (file, "%d,", (1 << 5) | ((info->first_fp_reg_save != 64) << 1));
-
- /* 6 bitfields: function is interrupt handler, name present in
- proc table, function calls alloca, on condition directives
- (controls stack walks, 3 bits), saves condition reg, saves
- link reg. */
- /* The `function calls alloca' bit seems to be set whenever reg 31 is
- set up as a frame pointer, even when there is no alloca call. */
- fprintf (file, "%d,",
- ((1 << 6) | (frame_pointer_needed << 5)
- | (info->cr_save_p << 1) | (info->lr_save_p)));
-
- /* 3 bitfields: saves backchain, spare bit, number of fpr saved
- (6 bits). */
- fprintf (file, "%d,",
- (info->push_p << 7) | (64 - info->first_fp_reg_save));
-
- /* 2 bitfields: spare bits (2 bits), number of gpr saved (6 bits). */
- fprintf (file, "%d,", (32 - first_reg_to_save ()));
-
- {
- /* Compute the parameter info from the function decl argument
- list. */
- tree decl;
- int next_parm_info_bit;
-
- next_parm_info_bit = 31;
- parm_info = 0;
- fixed_parms = 0;
- float_parms = 0;
-
- for (decl = DECL_ARGUMENTS (current_function_decl);
- decl; decl = TREE_CHAIN (decl))
- {
- rtx parameter = DECL_INCOMING_RTL (decl);
- enum machine_mode mode = GET_MODE (parameter);
-
- if (GET_CODE (parameter) == REG)
- {
- if (GET_MODE_CLASS (mode) == MODE_FLOAT)
- {
- int bits;
-
- float_parms++;
-
- if (mode == SFmode)
- bits = 0x2;
- else if (mode == DFmode)
- bits = 0x3;
- else
- abort ();
-
- /* If only one bit will fit, don't or in this entry. */
- if (next_parm_info_bit > 0)
- parm_info |= (bits << (next_parm_info_bit - 1));
- next_parm_info_bit -= 2;
- }
- else
- {
- fixed_parms += ((GET_MODE_SIZE (mode)
- + (UNITS_PER_WORD - 1))
- / UNITS_PER_WORD);
- next_parm_info_bit -= 1;
- }
- }
- }
- }
-
- /* Number of fixed point parameters. */
- /* This is actually the number of words of fixed point parameters; thus
- an 8 byte struct counts as 2; and thus the maximum value is 8. */
- fprintf (file, "%d,", fixed_parms);
-
- /* 2 bitfields: number of floating point parameters (7 bits), parameters
- all on stack. */
- /* This is actually the number of fp registers that hold parameters;
- and thus the maximum value is 13. */
- /* Set parameters on stack bit if parameters are not in their original
- registers, regardless of whether they are on the stack? Xlc
- seems to set the bit when not optimizing. */
- fprintf (file, "%d\n", ((float_parms << 1) | (! optimize)));
-
- /* Optional fields follow. Some are variable length. */
-
- /* Parameter types, left adjusted bit fields: 0 fixed, 10 single float,
- 11 double float. */
- /* There is an entry for each parameter in a register, in the order that
- they occur in the parameter list. Any intervening arguments on the
- stack are ignored. If the list overflows a long (max possible length
- 34 bits) then completely leave off all elements that don't fit. */
- /* Only emit this long if there was at least one parameter. */
- if (fixed_parms || float_parms)
- fprintf (file, "\t.long %d\n", parm_info);
-
- /* Offset from start of code to tb table. */
- fputs ("\t.long ", file);
- ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LT");
- RS6000_OUTPUT_BASENAME (file, fname);
- fputs ("-.", file);
- RS6000_OUTPUT_BASENAME (file, fname);
- putc ('\n', file);
-
- /* Interrupt handler mask. */
- /* Omit this long, since we never set the interrupt handler bit
- above. */
-
- /* Number of CTL (controlled storage) anchors. */
- /* Omit this long, since the has_ctl bit is never set above. */
-
- /* Displacement into stack of each CTL anchor. */
- /* Omit this list of longs, because there are no CTL anchors. */
-
- /* Length of function name. */
- fprintf (file, "\t.short %d\n", strlen (fname));
-
- /* Function name. */
- assemble_string (fname, strlen (fname));
-
- /* Register for alloca automatic storage; this is always reg 31.
- Only emit this if the alloca bit was set above. */
- if (frame_pointer_needed)
- fputs ("\t.byte 31\n", file);
- }
-
- if (DEFAULT_ABI == ABI_NT)
- {
- RS6000_OUTPUT_BASENAME (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
- fputs (".e:\nFE_MOT_RESVD..", file);
- RS6000_OUTPUT_BASENAME (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
- fputs (":\n", file);
- }
-}
-
-/* Output a TOC entry. We derive the entry name from what is
- being written. */
-
-void
-output_toc (file, x, labelno)
- FILE *file;
- rtx x;
- int labelno;
-{
- char buf[256];
- char *name = buf;
- char *real_name;
- rtx base = x;
- int offset = 0;
-
- if (TARGET_NO_TOC)
- abort ();
-
- /* if we're going to put a double constant in the TOC, make sure it's
- aligned properly when strict alignment is on. */
- if (GET_CODE (x) == CONST_DOUBLE
- && STRICT_ALIGNMENT
- && GET_MODE (x) == DFmode
- && ! (TARGET_NO_FP_IN_TOC && ! TARGET_MINIMAL_TOC)) {
- ASM_OUTPUT_ALIGN (file, 3);
- }
-
-
- if (TARGET_ELF && TARGET_MINIMAL_TOC)
- {
- ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LC");
- fprintf (file, "%d = .-", labelno);
- ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LCTOC");
- fputs ("1\n", file);
- }
- else
- ASM_OUTPUT_INTERNAL_LABEL (file, "LC", labelno);
-
- /* Handle FP constants specially. Note that if we have a minimal
- TOC, things we put here aren't actually in the TOC, so we can allow
- FP constants. */
- if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == DFmode
- && ! (TARGET_NO_FP_IN_TOC && ! TARGET_MINIMAL_TOC))
- {
- REAL_VALUE_TYPE rv;
- long k[2];
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
- REAL_VALUE_TO_TARGET_DOUBLE (rv, k);
- if (TARGET_MINIMAL_TOC)
- fprintf (file, "\t.long %ld\n\t.long %ld\n", k[0], k[1]);
- else
- fprintf (file, "\t.tc FD_%lx_%lx[TC],%ld,%ld\n",
- k[0], k[1], k[0], k[1]);
- return;
- }
- else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == SFmode
- && ! (TARGET_NO_FP_IN_TOC && ! TARGET_MINIMAL_TOC))
- {
- REAL_VALUE_TYPE rv;
- long l;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, x);
- REAL_VALUE_TO_TARGET_SINGLE (rv, l);
-
- if (TARGET_MINIMAL_TOC)
- fprintf (file, "\t.long %ld\n", l);
- else
- fprintf (file, "\t.tc FS_%lx[TC],%ld\n", l, l);
- return;
- }
- else if (GET_MODE (x) == DImode
- && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)
- && ! (TARGET_NO_FP_IN_TOC && ! TARGET_MINIMAL_TOC))
- {
- HOST_WIDE_INT low;
- HOST_WIDE_INT high;
-
- if (GET_CODE (x) == CONST_DOUBLE)
- {
- low = CONST_DOUBLE_LOW (x);
- high = CONST_DOUBLE_HIGH (x);
- }
- else
-#if HOST_BITS_PER_WIDE_INT == 32
- {
- low = INTVAL (x);
- high = (low < 0) ? ~0 : 0;
- }
-#else
- {
- low = INTVAL (x) & 0xffffffff;
- high = (HOST_WIDE_INT) INTVAL (x) >> 32;
- }
-#endif
-
- if (TARGET_MINIMAL_TOC)
- fprintf (file, "\t.long %ld\n\t.long %ld\n", (long)high, (long)low);
- else
- fprintf (file, "\t.tc ID_%lx_%lx[TC],%ld,%ld\n",
- (long)high, (long)low, (long)high, (long)low);
- return;
- }
-
- if (GET_CODE (x) == CONST)
- {
- base = XEXP (XEXP (x, 0), 0);
- offset = INTVAL (XEXP (XEXP (x, 0), 1));
- }
-
- if (GET_CODE (base) == SYMBOL_REF)
- name = XSTR (base, 0);
- else if (GET_CODE (base) == LABEL_REF)
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (XEXP (base, 0)));
- else if (GET_CODE (base) == CODE_LABEL)
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (base));
- else
- abort ();
-
- STRIP_NAME_ENCODING (real_name, name);
- if (TARGET_MINIMAL_TOC)
- fputs ("\t.long ", file);
- else
- {
- fprintf (file, "\t.tc %s", real_name);
-
- if (offset < 0)
- fprintf (file, ".N%d", - offset);
- else if (offset)
- fprintf (file, ".P%d", offset);
-
- fputs ("[TC],", file);
- }
-
- /* Currently C++ toc references to vtables can be emitted before it
- is decided whether the vtable is public or private. If this is
- the case, then the linker will eventually complain that there is
- a TOC reference to an unknown section. Thus, for vtables only,
- we emit the TOC reference to reference the symbol and not the
- section. */
- if (!strncmp ("_vt.", name, 4))
- {
- RS6000_OUTPUT_BASENAME (file, name);
- if (offset < 0)
- fprintf (file, "%d", offset);
- else if (offset > 0)
- fprintf (file, "+%d", offset);
- }
- else
- output_addr_const (file, x);
- putc ('\n', file);
-}
-
-/* Output an assembler pseudo-op to write an ASCII string of N characters
- starting at P to FILE.
-
- On the RS/6000, we have to do this using the .byte operation and
- write out special characters outside the quoted string.
- Also, the assembler is broken; very long strings are truncated,
- so we must artificially break them up early. */
-
-void
-output_ascii (file, p, n)
- FILE *file;
- char *p;
- int n;
-{
- char c;
- int i, count_string;
- char *for_string = "\t.byte \"";
- char *for_decimal = "\t.byte ";
- char *to_close = NULL;
-
- count_string = 0;
- for (i = 0; i < n; i++)
- {
- c = *p++;
- if (c >= ' ' && c < 0177)
- {
- if (for_string)
- fputs (for_string, file);
- putc (c, file);
-
- /* Write two quotes to get one. */
- if (c == '"')
- {
- putc (c, file);
- ++count_string;
- }
-
- for_string = NULL;
- for_decimal = "\"\n\t.byte ";
- to_close = "\"\n";
- ++count_string;
-
- if (count_string >= 512)
- {
- fputs (to_close, file);
-
- for_string = "\t.byte \"";
- for_decimal = "\t.byte ";
- to_close = NULL;
- count_string = 0;
- }
- }
- else
- {
- if (for_decimal)
- fputs (for_decimal, file);
- fprintf (file, "%d", c);
-
- for_string = "\n\t.byte \"";
- for_decimal = ", ";
- to_close = "\n";
- count_string = 0;
- }
- }
-
- /* Now close the string if we have written one. Then end the line. */
- if (to_close)
- fprintf (file, to_close);
-}
-
-/* Generate a unique section name for FILENAME for a section type
- represented by SECTION_DESC. Output goes into BUF.
-
- SECTION_DESC can be any string, as long as it is different for each
- possible section type.
-
- We name the section in the same manner as xlc. The name begins with an
- underscore followed by the filename (after stripping any leading directory
- names) with the last period replaced by the string SECTION_DESC. If
- FILENAME does not contain a period, SECTION_DESC is appended to the end of
- the name. */
-
-void
-rs6000_gen_section_name (buf, filename, section_desc)
- char **buf;
- char *filename;
- char *section_desc;
-{
- char *q, *after_last_slash, *last_period;
- char *p;
- int len;
-
- after_last_slash = filename;
- for (q = filename; *q; q++)
- {
- if (*q == '/')
- after_last_slash = q + 1;
- else if (*q == '.')
- last_period = q;
- }
-
- len = strlen (after_last_slash) + strlen (section_desc) + 2;
- *buf = (char *) permalloc (len);
-
- p = *buf;
- *p++ = '_';
-
- for (q = after_last_slash; *q; q++)
- {
- if (q == last_period)
- {
- strcpy (p, section_desc);
- p += strlen (section_desc);
- }
-
- else if (isalnum (*q))
- *p++ = *q;
- }
-
- if (last_period == 0)
- strcpy (p, section_desc);
- else
- *p = '\0';
-}
-
-/* Write function profiler code. */
-
-void
-output_function_profiler (file, labelno)
- FILE *file;
- int labelno;
-{
- /* The last used parameter register. */
- int last_parm_reg;
- int i, j;
- char buf[100];
-
- if (DEFAULT_ABI != ABI_AIX)
- abort ();
-
- /* Set up a TOC entry for the profiler label. */
- toc_section ();
- ASM_OUTPUT_INTERNAL_LABEL (file, "LPC", labelno);
- ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
- if (TARGET_MINIMAL_TOC)
- {
- fputs ("\t.long ", file);
- assemble_name (file, buf);
- putc ('\n', file);
- }
- else
- {
- fputs ("\t.tc\t", file);
- assemble_name (file, buf);
- fputs ("[TC],", file);
- assemble_name (file, buf);
- putc ('\n', file);
- }
- text_section ();
-
- /* Figure out last used parameter register. The proper thing to do is
- to walk incoming args of the function. A function might have live
- parameter registers even if it has no incoming args. */
-
- for (last_parm_reg = 10;
- last_parm_reg > 2 && ! regs_ever_live [last_parm_reg];
- last_parm_reg--)
- ;
-
- /* Save parameter registers in regs 23-30. Don't overwrite reg 31, since
- it might be set up as the frame pointer. */
-
- for (i = 3, j = 30; i <= last_parm_reg; i++, j--)
- asm_fprintf (file, "\tmr %d,%d\n", j, i);
-
- /* Load location address into r3, and call mcount. */
-
- ASM_GENERATE_INTERNAL_LABEL (buf, "LPC", labelno);
- asm_fprintf (file, "\t{l|lwz} %s,", reg_names[3]);
- assemble_name (file, buf);
- asm_fprintf (file, "(%s)\n\tbl .mcount\n", reg_names[2]);
-
- /* Restore parameter registers. */
-
- for (i = 3, j = 30; i <= last_parm_reg; i++, j--)
- asm_fprintf (file, "\tmr %d,%d\n", i, j);
-}
-
-/* Adjust the cost of a scheduling dependency. Return the new cost of
- a dependency LINK or INSN on DEP_INSN. COST is the current cost. */
-
-int
-rs6000_adjust_cost (insn, link, dep_insn, cost)
- rtx insn;
- rtx link;
- rtx dep_insn;
- int cost;
-{
- if (! recog_memoized (insn))
- return 0;
-
- if (REG_NOTE_KIND (link) != 0)
- return 0;
-
- if (REG_NOTE_KIND (link) == 0)
- {
- /* Data dependency; DEP_INSN writes a register that INSN reads some
- cycles later. */
-
- /* Tell the first scheduling pass about the latency between a mtctr
- and bctr (and mtlr and br/blr). The first scheduling pass will not
- know about this latency since the mtctr instruction, which has the
- latency associated to it, will be generated by reload. */
- if (get_attr_type (insn) == TYPE_JMPREG)
- return TARGET_POWER ? 5 : 4;
-
- /* Fall out to return default cost. */
- }
-
- return cost;
-}
-
-/* Return how many instructions the machine can issue per cycle */
-int get_issue_rate()
-{
- switch (rs6000_cpu_attr) {
- case CPU_RIOS1:
- return 3; /* ? */
- case CPU_RIOS2:
- return 4;
- case CPU_PPC601:
- return 3; /* ? */
- case CPU_PPC603:
- return 2;
- case CPU_PPC604:
- return 4;
- case CPU_PPC620:
- return 4;
- default:
- return 1;
- }
-}
-
-
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- The trampoline should set the static chain pointer to value placed
- into the trampoline and should branch to the specified routine. */
-
-void
-rs6000_trampoline_template (file)
- FILE *file;
-{
- char *sc = reg_names[STATIC_CHAIN_REGNUM];
- char *r0 = reg_names[0];
- char *r2 = reg_names[2];
-
- switch (DEFAULT_ABI)
- {
- default:
- abort ();
-
- /* Under AIX, this is not code at all, but merely a data area,
- since that is the way all functions are called. The first word is
- the address of the function, the second word is the TOC pointer (r2),
- and the third word is the static chain value. */
- case ABI_AIX:
- break;
-
-
- /* V.4/eabi function pointers are just a single pointer, so we need to
- do the full gory code to load up the static chain. */
- case ABI_V4:
- case ABI_SOLARIS:
- case ABI_AIX_NODESC:
- break;
-
- /* NT function pointers point to a two word area (real address, TOC)
- which unfortunately does not include a static chain field. So we
- use the function field to point to ..LTRAMP1 and the toc field
- to point to the whole table. */
- case ABI_NT:
- if (STATIC_CHAIN_REGNUM == 0
- || STATIC_CHAIN_REGNUM == 2
- || TARGET_64BIT
- || !TARGET_NEW_MNEMONICS)
- abort ();
-
- fprintf (file, "\t.ualong 0\n"); /* offset 0 */
- fprintf (file, "\t.ualong 0\n"); /* offset 4 */
- fprintf (file, "\t.ualong 0\n"); /* offset 8 */
- fprintf (file, "\t.ualong 0\n"); /* offset 12 */
- fprintf (file, "\t.ualong 0\n"); /* offset 16 */
- fprintf (file, "..LTRAMP1..0:\n"); /* offset 20 */
- fprintf (file, "\tlwz %s,8(%s)\n", r0, r2); /* offset 24 */
- fprintf (file, "\tlwz %s,12(%s)\n", sc, r2); /* offset 28 */
- fprintf (file, "\tmtctr %s\n", r0); /* offset 32 */
- fprintf (file, "\tlwz %s,16(%s)\n", r2, r2); /* offset 36 */
- fprintf (file, "\tbctr\n"); /* offset 40 */
- break;
- }
-
- return;
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-int
-rs6000_trampoline_size ()
-{
- int ret = 0;
-
- switch (DEFAULT_ABI)
- {
- default:
- abort ();
-
- case ABI_AIX:
- ret = (TARGET_32BIT) ? 12 : 24;
- break;
-
- case ABI_V4:
- case ABI_SOLARIS:
- case ABI_AIX_NODESC:
- ret = (TARGET_32BIT) ? 40 : 48;
- break;
-
- case ABI_NT:
- ret = 20;
- break;
- }
-
- return ret;
-}
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-void
-rs6000_initialize_trampoline (addr, fnaddr, cxt)
- rtx addr;
- rtx fnaddr;
- rtx cxt;
-{
- enum machine_mode pmode = Pmode;
- int regsize = (TARGET_32BIT) ? 4 : 8;
- rtx ctx_reg = force_reg (pmode, cxt);
-
- switch (DEFAULT_ABI)
- {
- default:
- abort ();
-
-/* Macros to shorten the code expansions below. */
-#define MEM_DEREF(addr) gen_rtx (MEM, pmode, memory_address (pmode, addr))
-#define MEM_PLUS(addr,offset) gen_rtx (MEM, pmode, memory_address (pmode, plus_constant (addr, offset)))
-
- /* Under AIX, just build the 3 word function descriptor */
- case ABI_AIX:
- {
- rtx fn_reg = gen_reg_rtx (pmode);
- rtx toc_reg = gen_reg_rtx (pmode);
- emit_move_insn (fn_reg, MEM_DEREF (fnaddr));
- emit_move_insn (toc_reg, MEM_PLUS (fnaddr, 4));
- emit_move_insn (MEM_DEREF (addr), fn_reg);
- emit_move_insn (MEM_PLUS (addr, regsize), toc_reg);
- emit_move_insn (MEM_PLUS (addr, 2*regsize), ctx_reg);
- }
- break;
-
- /* Under V.4/eabi, call __trampoline_setup to do the real work. */
- case ABI_V4:
- case ABI_SOLARIS:
- case ABI_AIX_NODESC:
- emit_library_call (gen_rtx (SYMBOL_REF, SImode, "__trampoline_setup"),
- FALSE, VOIDmode, 4,
- addr, pmode,
- GEN_INT (rs6000_trampoline_size ()), SImode,
- fnaddr, pmode,
- ctx_reg, pmode);
- break;
-
- /* Under NT, update the first word to point to the ..LTRAMP1..0 header,
- the second word will point to the whole trampoline, third-fifth words
- will then have the real address, static chain, and toc value. */
- case ABI_NT:
- {
- rtx tramp_reg = gen_reg_rtx (pmode);
- rtx fn_reg = gen_reg_rtx (pmode);
- rtx toc_reg = gen_reg_rtx (pmode);
-
- emit_move_insn (tramp_reg, gen_rtx (SYMBOL_REF, pmode, "..LTRAMP1..0"));
- addr = force_reg (pmode, addr);
- emit_move_insn (fn_reg, MEM_DEREF (fnaddr));
- emit_move_insn (toc_reg, MEM_PLUS (fnaddr, regsize));
- emit_move_insn (MEM_DEREF (addr), tramp_reg);
- emit_move_insn (MEM_PLUS (addr, regsize), addr);
- emit_move_insn (MEM_PLUS (addr, 2*regsize), fn_reg);
- emit_move_insn (MEM_PLUS (addr, 3*regsize), ctx_reg);
- emit_move_insn (MEM_PLUS (addr, 4*regsize), gen_rtx (REG, pmode, 2));
- }
- break;
- }
-
- return;
-}
-
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
- with arguments ARGS is a valid machine specific attribute for DECL.
- The attributes in ATTRIBUTES have previously been assigned to DECL. */
-
-int
-rs6000_valid_decl_attribute_p (decl, attributes, identifier, args)
- tree decl;
- tree attributes;
- tree identifier;
- tree args;
-{
- return 0;
-}
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
- with arguments ARGS is a valid machine specific attribute for TYPE.
- The attributes in ATTRIBUTES have previously been assigned to TYPE. */
-
-int
-rs6000_valid_type_attribute_p (type, attributes, identifier, args)
- tree type;
- tree attributes;
- tree identifier;
- tree args;
-{
- if (TREE_CODE (type) != FUNCTION_TYPE
- && TREE_CODE (type) != FIELD_DECL
- && TREE_CODE (type) != TYPE_DECL)
- return 0;
-
- /* Longcall attribute says that the function is not within 2**26 bytes
- of the current function, and to do an indirect call. */
- if (is_attribute_p ("longcall", identifier))
- return (args == NULL_TREE);
-
- if (DEFAULT_ABI == ABI_NT)
- {
- /* Stdcall attribute says callee is responsible for popping arguments
- if they are not variable. */
- if (is_attribute_p ("stdcall", identifier))
- return (args == NULL_TREE);
-
- /* Cdecl attribute says the callee is a normal C declaration */
- if (is_attribute_p ("cdecl", identifier))
- return (args == NULL_TREE);
-
- /* Dllimport attribute says says the caller is to call the function
- indirectly through a __imp_<name> pointer. */
- if (is_attribute_p ("dllimport", identifier))
- return (args == NULL_TREE);
-
- /* Dllexport attribute says says the callee is to create a __imp_<name>
- pointer. */
- if (is_attribute_p ("dllexport", identifier))
- return (args == NULL_TREE);
-
- /* Exception attribute allows the user to specify 1-2 strings or identifiers
- that will fill in the 3rd and 4th fields of the structured exception
- table. */
- if (is_attribute_p ("exception", identifier))
- {
- int i;
-
- if (args == NULL_TREE)
- return 0;
-
- for (i = 0; i < 2 && args != NULL_TREE; i++)
- {
- tree this_arg = TREE_VALUE (args);
- args = TREE_PURPOSE (args);
-
- if (TREE_CODE (this_arg) != STRING_CST
- && TREE_CODE (this_arg) != IDENTIFIER_NODE)
- return 0;
- }
-
- return (args == NULL_TREE);
- }
- }
-
- return 0;
-}
-
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-
-int
-rs6000_comp_type_attributes (type1, type2)
- tree type1;
- tree type2;
-{
- return 1;
-}
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-void
-rs6000_set_default_type_attributes (type)
- tree type;
-{
-}
-
-/* Return a dll import reference corresponding to to a call's SYMBOL_REF */
-struct rtx_def *
-rs6000_dll_import_ref (call_ref)
- rtx call_ref;
-{
- char *call_name;
- int len;
- char *p;
- rtx reg1, reg2;
- tree node;
-
- if (GET_CODE (call_ref) != SYMBOL_REF)
- abort ();
-
- call_name = XSTR (call_ref, 0);
- len = sizeof ("__imp_") + strlen (call_name);
- p = alloca (len);
- reg2 = gen_reg_rtx (Pmode);
-
- strcpy (p, "__imp_");
- strcat (p, call_name);
- node = get_identifier (p);
-
- reg1 = force_reg (Pmode, gen_rtx (SYMBOL_REF, VOIDmode, IDENTIFIER_POINTER (node)));
- emit_move_insn (reg2, gen_rtx (MEM, Pmode, reg1));
-
- return reg2;
-}
-
-/* Return a reference suitable for calling a function with the longcall attribute. */
-struct rtx_def *
-rs6000_longcall_ref (call_ref)
- rtx call_ref;
-{
- char *call_name;
- int len;
- char *p;
- rtx reg1, reg2;
- tree node;
-
- if (GET_CODE (call_ref) != SYMBOL_REF)
- return call_ref;
-
- /* System V adds '.' to the internal name, so skip them. */
- call_name = XSTR (call_ref, 0);
- if (*call_name == '.')
- {
- while (*call_name == '.')
- call_name++;
-
- node = get_identifier (call_name);
- call_ref = gen_rtx (SYMBOL_REF, VOIDmode, IDENTIFIER_POINTER (node));
- }
-
- return force_reg (Pmode, call_ref);
-}
-
-
-/* A C statement or statements to switch to the appropriate section
- for output of RTX in mode MODE. You can assume that RTX is some
- kind of constant in RTL. The argument MODE is redundant except in
- the case of a `const_int' rtx. Select the section by calling
- `text_section' or one of the alternatives for other sections.
-
- Do not define this macro if you put all constants in the read-only
- data section. */
-
-#ifdef USING_SVR4_H
-
-void
-rs6000_select_rtx_section (mode, x)
- enum machine_mode mode;
- rtx x;
-{
- if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (x))
- toc_section ();
- else
- const_section ();
-}
-
-/* A C statement or statements to switch to the appropriate
- section for output of DECL. DECL is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether forming
- the initial value of DECL requires link-time relocations. */
-
-void
-rs6000_select_section (decl, reloc)
- tree decl;
- int reloc;
-{
- int size = int_size_in_bytes (TREE_TYPE (decl));
-
- if (TREE_CODE (decl) == STRING_CST)
- {
- if (! flag_writable_strings)
- const_section ();
- else
- data_section ();
- }
- else if (TREE_CODE (decl) == VAR_DECL)
- {
- if ((flag_pic && reloc)
- || !TREE_READONLY (decl)
- || TREE_SIDE_EFFECTS (decl)
- || !DECL_INITIAL (decl)
- || (DECL_INITIAL (decl) != error_mark_node
- && !TREE_CONSTANT (DECL_INITIAL (decl))))
- {
- if (rs6000_sdata != SDATA_NONE && (size > 0) && (size <= g_switch_value))
- sdata_section ();
- else
- data_section ();
- }
- else
- {
- if (rs6000_sdata != SDATA_NONE && (size > 0) && (size <= g_switch_value))
- {
- if (rs6000_sdata == SDATA_EABI)
- sdata2_section ();
- else
- sdata_section (); /* System V doesn't have .sdata2/.sbss2 */
- }
- else
- const_section ();
- }
- }
- else
- const_section ();
-}
-
-
-
-/* If we are referencing a function that is static or is known to be
- in this file, make the SYMBOL_REF special. We can use this to indicate
- that we can branch to this function without emitting a no-op after the
- call. For real AIX and NT calling sequences, we also replace the
- function name with the real name (1 or 2 leading .'s), rather than
- the function descriptor name. This saves a lot of overriding code
- to readd the prefixes. */
-
-void
-rs6000_encode_section_info (decl)
- tree decl;
-{
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- rtx sym_ref = XEXP (DECL_RTL (decl), 0);
- if (TREE_ASM_WRITTEN (decl) || ! TREE_PUBLIC (decl))
- SYMBOL_REF_FLAG (sym_ref) = 1;
-
- if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
- {
- char *prefix = (DEFAULT_ABI == ABI_AIX) ? "." : "..";
- char *str = permalloc (strlen (prefix) + 1
- + strlen (XSTR (sym_ref, 0)));
- strcpy (str, prefix);
- strcat (str, XSTR (sym_ref, 0));
- XSTR (sym_ref, 0) = str;
- }
- }
- else if (rs6000_sdata != SDATA_NONE
- && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- && TREE_CODE (decl) == VAR_DECL)
- {
- int size = int_size_in_bytes (TREE_TYPE (decl));
- tree section_name = DECL_SECTION_NAME (decl);
- char *name = (char *)0;
- int len = 0;
-
- if (section_name)
- {
- if (TREE_CODE (section_name) == STRING_CST)
- {
- name = TREE_STRING_POINTER (section_name);
- len = TREE_STRING_LENGTH (section_name);
- }
- else
- abort ();
- }
-
- if ((size > 0 && size <= g_switch_value)
- || (name
- && ((len == sizeof (".sdata")-1 && strcmp (name, ".sdata") == 0)
- || (len == sizeof (".sdata2")-1 && strcmp (name, ".sdata2") == 0)
- || (len == sizeof (".sbss")-1 && strcmp (name, ".sbss") == 0)
- || (len == sizeof (".sbss2")-1 && strcmp (name, ".sbss2") == 0)
- || (len == sizeof (".PPC.EMB.sdata0")-1 && strcmp (name, ".PPC.EMB.sdata0") == 0)
- || (len == sizeof (".PPC.EMB.sbss0")-1 && strcmp (name, ".PPC.EMB.sbss0") == 0))))
- {
- rtx sym_ref = XEXP (DECL_RTL (decl), 0);
- char *str = permalloc (2 + strlen (XSTR (sym_ref, 0)));
- strcpy (str, "@");
- strcat (str, XSTR (sym_ref, 0));
- XSTR (sym_ref, 0) = str;
- }
- }
-}
-
-#endif /* USING_SVR4_H */
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
deleted file mode 100644
index eac6df393ae..00000000000
--- a/gcc/config/rs6000/rs6000.h
+++ /dev/null
@@ -1,3125 +0,0 @@
-/* Definitions of target machine for GNU compiler, for IBM RS/6000.
- Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-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. */
-
-
-/* Note that some other tm.h files include this one and then override
- many of the definitions that relate to assembler syntax. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 \
--Asystem(unix) -Asystem(aix) -Acpu(rs6000) -Amachine(rs6000)"
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION ;
-
-/* Default string to use for cpu if not specified. */
-#ifndef TARGET_CPU_DEFAULT
-#define TARGET_CPU_DEFAULT ((char *)0)
-#endif
-
-/* Tell the assembler to assume that all undefined names are external.
-
- Don't do this until the fixed IBM assembler is more generally available.
- When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL,
- ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no
- longer be needed. Also, the extern declaration of mcount in ASM_FILE_START
- will no longer be needed. */
-
-/* #define ASM_SPEC "-u %(asm_cpu)" */
-
-/* Define appropriate architecture macros for preprocessor depending on
- target switches. */
-
-#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_cpu)"
-
-/* Common CPP definitions used by CPP_SPEC amonst the various targets
- for handling -mcpu=xxx switches. */
-#define CPP_CPU_SPEC \
-"%{!mcpu*: \
- %{mpower: %{!mpower2: -D_ARCH_PWR}} \
- %{mpower2: -D_ARCH_PWR2} \
- %{mpowerpc*: -D_ARCH_PPC} \
- %{mno-power: %{!mpowerpc*: -D_ARCH_COM}} \
- %{!mno-power: %{!mpower2: %(cpp_default)}}} \
-%{mcpu=common: -D_ARCH_COM} \
-%{mcpu=power: -D_ARCH_PWR} \
-%{mcpu=power2: -D_ARCH_PWR2} \
-%{mcpu=powerpc: -D_ARCH_PPC} \
-%{mcpu=rios: -D_ARCH_PWR} \
-%{mcpu=rios1: -D_ARCH_PWR} \
-%{mcpu=rios2: -D_ARCH_PWR2} \
-%{mcpu=rsc: -D_ARCH_PWR} \
-%{mcpu=rsc1: -D_ARCH_PWR} \
-%{mcpu=403: -D_ARCH_PPC} \
-%{mcpu=505: -D_ARCH_PPC} \
-%{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \
-%{mcpu=602: -D_ARCH_PPC} \
-%{mcpu=603: -D_ARCH_PPC} \
-%{mcpu=603e: -D_ARCH_PPC} \
-%{mcpu=604: -D_ARCH_PPC} \
-%{mcpu=620: -D_ARCH_PPC} \
-%{mcpu=821: -D_ARCH_PPC} \
-%{mcpu=860: -D_ARCH_PPC}"
-
-#ifndef CPP_DEFAULT_SPEC
-#define CPP_DEFAULT_SPEC "-D_ARCH_PWR"
-#endif
-
-#ifndef CPP_SYSV_SPEC
-#define CPP_SYSV_SPEC ""
-#endif
-
-#ifndef CPP_ENDIAN_SPEC
-#define CPP_ENDIAN_SPEC ""
-#endif
-
-#ifndef CPP_ENDIAN_DEFAULT_SPEC
-#define CPP_ENDIAN_DEFAULT_SPEC ""
-#endif
-
-#ifndef CPP_SYSV_DEFAULT_SPEC
-#define CPP_SYSV_DEFAULT_SPEC ""
-#endif
-
-/* Common ASM definitions used by ASM_SPEC amonst the various targets
- for handling -mcpu=xxx switches. */
-#define ASM_CPU_SPEC \
-"%{!mcpu*: \
- %{mpower: %{!mpower2: -mpwr}} \
- %{mpower2: -mpwrx} \
- %{mpowerpc*: -mppc} \
- %{mno-power: %{!mpowerpc*: -mcom}} \
- %{!mno-power: %{!mpower2: %(asm_default)}}} \
-%{mcpu=common: -mcom} \
-%{mcpu=power: -mpwr} \
-%{mcpu=power2: -mpwrx} \
-%{mcpu=powerpc: -mppc} \
-%{mcpu=rios: -mpwr} \
-%{mcpu=rios1: -mpwr} \
-%{mcpu=rios2: -mpwrx} \
-%{mcpu=rsc: -mpwr} \
-%{mcpu=rsc1: -mpwr} \
-%{mcpu=403: -mppc} \
-%{mcpu=505: -mppc} \
-%{mcpu=601: -m601} \
-%{mcpu=602: -mppc} \
-%{mcpu=603: -mppc} \
-%{mcpu=603e: -mppc} \
-%{mcpu=604: -mppc} \
-%{mcpu=620: -mppc} \
-%{mcpu=821: -mppc} \
-%{mcpu=860: -mppc}"
-
-#ifndef ASM_DEFAULT_SPEC
-#define ASM_DEFAULT_SPEC ""
-#endif
-
-/* This macro defines names of additional specifications to put in the specs
- that can be used in various specifications like CC1_SPEC. Its definition
- is an initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- specification name, and a string constant that used by the GNU CC driver
- 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_cpu", CPP_CPU_SPEC }, \
- { "cpp_default", CPP_DEFAULT_SPEC }, \
- { "cpp_sysv", CPP_SYSV_SPEC }, \
- { "cpp_sysv_default", CPP_SYSV_DEFAULT_SPEC }, \
- { "cpp_endian_default", CPP_ENDIAN_DEFAULT_SPEC }, \
- { "cpp_endian", CPP_ENDIAN_SPEC }, \
- { "asm_cpu", ASM_CPU_SPEC }, \
- { "asm_default", ASM_DEFAULT_SPEC }, \
- { "link_syscalls", LINK_SYSCALLS_SPEC }, \
- { "link_libg", LINK_LIBG_SPEC }, \
- SUBTARGET_EXTRA_SPECS
-
-/* Default location of syscalls.exp under AIX */
-#ifndef CROSS_COMPILE
-#define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
-#else
-#define LINK_SYSCALLS_SPEC ""
-#endif
-
-/* Default location of libg.exp under AIX */
-#ifndef CROSS_COMPILE
-#define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp"
-#else
-#define LINK_LIBG_SPEC ""
-#endif
-
-/* Define the options for the binder: Start text at 512, align all segments
- to 512 bytes, and warn if there is text relocation.
-
- The -bhalt:4 option supposedly changes the level at which ld will abort,
- but it also suppresses warnings about multiply defined symbols and is
- used by the AIX cc command. So we use it here.
-
- -bnodelcsect undoes a poor choice of default relating to multiply-defined
- csects. See AIX documentation for more information about this.
-
- -bM:SRE tells the linker that the output file is Shared REusable. Note
- that to actually build a shared library you will also need to specify an
- export list with the -Wl,-bE option. */
-
-#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
- %{static:-bnso %(link_syscalls) } \
- %{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}"
-
-/* Profiled library versions are used by linking with special directories. */
-#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
- %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
-
-/* gcc must do the search itself to find libgcc.a, not use -l. */
-#define LIBGCC_SPEC "libgcc.a%s"
-
-/* Don't turn -B into -L if the argument specifies a relative file name. */
-#define RELATIVE_PREFIX_NOT_LINKDIR
-
-/* Architecture type. */
-
-extern int target_flags;
-
-/* Use POWER architecture instructions and MQ register. */
-#define MASK_POWER 0x01
-
-/* Use POWER2 extensions to POWER architecture. */
-#define MASK_POWER2 0x02
-
-/* Use PowerPC architecture instructions. */
-#define MASK_POWERPC 0x04
-
-/* Use PowerPC General Purpose group optional instructions, e.g. fsqrt. */
-#define MASK_PPC_GPOPT 0x08
-
-/* Use PowerPC Graphics group optional instructions, e.g. fsel. */
-#define MASK_PPC_GFXOPT 0x10
-
-/* Use PowerPC-64 architecture instructions. */
-#define MASK_POWERPC64 0x20
-
-/* Use revised mnemonic names defined for PowerPC architecture. */
-#define MASK_NEW_MNEMONICS 0x40
-
-/* Disable placing fp constants in the TOC; can be turned on when the
- TOC overflows. */
-#define MASK_NO_FP_IN_TOC 0x80
-
-/* Disable placing symbol+offset constants in the TOC; can be turned on when
- the TOC overflows. */
-#define MASK_NO_SUM_IN_TOC 0x100
-
-/* Output only one TOC entry per module. Normally linking fails if
- there are more than 16K unique variables/constants in an executable. With
- this option, linking fails only if there are more than 16K modules, or
- if there are more than 16K unique variables/constant in a single module.
-
- This is at the cost of having 2 extra loads and one extra store per
- function, and one less allocatable register. */
-#define MASK_MINIMAL_TOC 0x200
-
-/* Nonzero for the 64bit model: ints, longs, and pointers are 64 bits. */
-#define MASK_64BIT 0x400
-
-/* Disable use of FPRs. */
-#define MASK_SOFT_FLOAT 0x800
-
-/* Enable load/store multiple, even on powerpc */
-#define MASK_MULTIPLE 0x1000
-#define MASK_MULTIPLE_SET 0x2000
-
-/* Use string instructions for block moves */
-#define MASK_STRING 0x4000
-#define MASK_STRING_SET 0x8000
-
-/* Temporary debug switches */
-#define MASK_DEBUG_STACK 0x10000
-#define MASK_DEBUG_ARG 0x20000
-
-#define TARGET_POWER (target_flags & MASK_POWER)
-#define TARGET_POWER2 (target_flags & MASK_POWER2)
-#define TARGET_POWERPC (target_flags & MASK_POWERPC)
-#define TARGET_PPC_GPOPT (target_flags & MASK_PPC_GPOPT)
-#define TARGET_PPC_GFXOPT (target_flags & MASK_PPC_GFXOPT)
-#define TARGET_POWERPC64 (target_flags & MASK_POWERPC64)
-#define TARGET_NEW_MNEMONICS (target_flags & MASK_NEW_MNEMONICS)
-#define TARGET_NO_FP_IN_TOC (target_flags & MASK_NO_FP_IN_TOC)
-#define TARGET_NO_SUM_IN_TOC (target_flags & MASK_NO_SUM_IN_TOC)
-#define TARGET_MINIMAL_TOC (target_flags & MASK_MINIMAL_TOC)
-#define TARGET_64BIT (target_flags & MASK_64BIT)
-#define TARGET_SOFT_FLOAT (target_flags & MASK_SOFT_FLOAT)
-#define TARGET_MULTIPLE (target_flags & MASK_MULTIPLE)
-#define TARGET_MULTIPLE_SET (target_flags & MASK_MULTIPLE_SET)
-#define TARGET_STRING (target_flags & MASK_STRING)
-#define TARGET_STRING_SET (target_flags & MASK_STRING_SET)
-#define TARGET_DEBUG_STACK (target_flags & MASK_DEBUG_STACK)
-#define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
-
-#define TARGET_32BIT (! TARGET_64BIT)
-#define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
-
-/* Pseudo target to indicate whether the object format is ELF
- (to get around not having conditional compilation in the md file) */
-#ifndef TARGET_ELF
-#define TARGET_ELF 0
-#endif
-
-/* If this isn't V.4, don't support -mno-toc. */
-#ifndef TARGET_NO_TOC
-#define TARGET_NO_TOC 0
-#define TARGET_TOC 1
-#endif
-
-/* Pseudo target to say whether this is Windows NT */
-#ifndef TARGET_WINDOWS_NT
-#define TARGET_WINDOWS_NT 0
-#endif
-
-/* Pseudo target to say whether this is MAC */
-#ifndef TARGET_MACOS
-#define TARGET_MACOS 0
-#endif
-
-/* Pseudo target to say whether this is AIX */
-#ifndef TARGET_AIX
-#if (TARGET_ELF || TARGET_WINDOWS_NT || TARGET_MACOS)
-#define TARGET_AIX 0
-#else
-#define TARGET_AIX 1
-#endif
-#endif
-
-#ifndef TARGET_XL_CALL
-#define TARGET_XL_CALL 0
-#endif
-
-/* Run-time compilation parameters selecting different hardware subsets.
-
- Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-/* This is meant to be redefined in the host dependent files */
-#ifndef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES
-#endif
-
-#define TARGET_SWITCHES \
- {{"power", MASK_POWER | MASK_MULTIPLE | MASK_STRING}, \
- {"power2", (MASK_POWER | MASK_MULTIPLE | MASK_STRING \
- | MASK_POWER2)}, \
- {"no-power2", - MASK_POWER2}, \
- {"no-power", - (MASK_POWER | MASK_POWER2 | MASK_MULTIPLE \
- | MASK_STRING)}, \
- {"powerpc", MASK_POWERPC}, \
- {"no-powerpc", - (MASK_POWERPC | MASK_PPC_GPOPT \
- | MASK_PPC_GFXOPT | MASK_POWERPC64)}, \
- {"powerpc-gpopt", MASK_POWERPC | MASK_PPC_GPOPT}, \
- {"no-powerpc-gpopt", - MASK_PPC_GPOPT}, \
- {"powerpc-gfxopt", MASK_POWERPC | MASK_PPC_GFXOPT}, \
- {"no-powerpc-gfxopt", - MASK_PPC_GFXOPT}, \
- {"new-mnemonics", MASK_NEW_MNEMONICS}, \
- {"old-mnemonics", -MASK_NEW_MNEMONICS}, \
- {"full-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC \
- | MASK_MINIMAL_TOC)}, \
- {"fp-in-toc", - MASK_NO_FP_IN_TOC}, \
- {"no-fp-in-toc", MASK_NO_FP_IN_TOC}, \
- {"sum-in-toc", - MASK_NO_SUM_IN_TOC}, \
- {"no-sum-in-toc", MASK_NO_SUM_IN_TOC}, \
- {"minimal-toc", MASK_MINIMAL_TOC}, \
- {"minimal-toc", - (MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)}, \
- {"no-minimal-toc", - MASK_MINIMAL_TOC}, \
- {"hard-float", - MASK_SOFT_FLOAT}, \
- {"soft-float", MASK_SOFT_FLOAT}, \
- {"multiple", MASK_MULTIPLE | MASK_MULTIPLE_SET}, \
- {"no-multiple", - MASK_MULTIPLE}, \
- {"no-multiple", MASK_MULTIPLE_SET}, \
- {"string", MASK_STRING | MASK_STRING_SET}, \
- {"no-string", - MASK_STRING}, \
- {"no-string", MASK_STRING_SET}, \
- {"debug-stack", MASK_DEBUG_STACK}, \
- {"debug-arg", MASK_DEBUG_ARG}, \
- SUBTARGET_SWITCHES \
- {"", TARGET_DEFAULT}}
-
-#define TARGET_DEFAULT (MASK_POWER | MASK_MULTIPLE | MASK_STRING)
-
-/* Processor type. */
-enum processor_type
- {PROCESSOR_RIOS1,
- PROCESSOR_RIOS2,
- PROCESSOR_MPCCORE,
- PROCESSOR_PPC403,
- PROCESSOR_PPC601,
- PROCESSOR_PPC603,
- PROCESSOR_PPC604,
- PROCESSOR_PPC620};
-
-extern enum processor_type rs6000_cpu;
-
-/* Recast the processor type to the cpu attribute. */
-#define rs6000_cpu_attr ((enum attr_cpu)rs6000_cpu)
-
-/* Define generic processor types based upon current deployment. */
-#define PROCESSOR_COMMON PROCESSOR_PPC601
-#define PROCESSOR_POWER PROCESSOR_RIOS1
-#define PROCESSOR_POWERPC PROCESSOR_PPC604
-
-/* Define the default processor. This is overridden by other tm.h files. */
-#define PROCESSOR_DEFAULT PROCESSOR_RIOS1
-
-/* Specify the dialect of assembler to use. New mnemonics is dialect one
- and the old mnemonics are dialect zero. */
-#define ASSEMBLER_DIALECT TARGET_NEW_MNEMONICS ? 1 : 0
-
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
- command options that have values. Its definition is an
- initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- fixed part of the option name, and the address of a variable.
- The variable, type `char *', is set to the variable part of the
- given option if the fixed part matches. The actual option name
- is made by appending `-m' to the specified name.
-
- Here is an example which defines `-mshort-data-NUMBER'. If the
- given option is `-mshort-data-512', the variable `m88k_short_data'
- will be set to the string `"512"'.
-
- extern char *m88k_short_data;
- #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
-
-/* This is meant to be overriden in target specific files. */
-#ifndef SUBTARGET_OPTIONS
-#define SUBTARGET_OPTIONS
-#endif
-
-#define TARGET_OPTIONS \
-{ \
- {"cpu=", &rs6000_select[1].string}, \
- {"tune=", &rs6000_select[2].string}, \
- SUBTARGET_OPTIONS \
-}
-
-/* rs6000_select[0] is reserved for the default cpu defined via --with-cpu */
-struct rs6000_cpu_select
-{
- char *string;
- char *name;
- int set_tune_p;
- int set_arch_p;
-};
-
-extern struct rs6000_cpu_select rs6000_select[];
-
-/* Sometimes certain combinations of command options do not make sense
- on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed.
-
- On the RS/6000 this is used to define the target cpu type. */
-
-#define OVERRIDE_OPTIONS rs6000_override_options (TARGET_CPU_DEFAULT)
-
-/* Show we can debug even without a frame pointer. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* target machine storage layout */
-
-/* Define to support cross compilation to an RS6000 target. */
-#define REAL_ARITHMETIC
-
-/* Define this macro if it is advisable to hold scalars in registers
- in a wider mode than that declared by the program. In such cases,
- the value is constrained to be within the bounds of the declared
- type, but kept valid in the wider mode. The signedness of the
- extension may differ from that of the type. */
-
-#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < 4) \
- (MODE) = SImode;
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-/* That is true on RS/6000. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is true on RS/6000. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is lowest
- numbered.
-
- For RS/6000 we can decide arbitrarily since there are no machine
- instructions for them. Might as well be consistent with bits and bytes. */
-#define WORDS_BIG_ENDIAN 1
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD (! TARGET_POWERPC64 ? 32 : 64)
-#define MAX_BITS_PER_WORD 64
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD (! TARGET_POWERPC64 ? 4 : 8)
-#define MIN_UNITS_PER_WORD 4
-#define UNITS_PER_FP_WORD 8
-
-/* Type used for ptrdiff_t, as a string used in a declaration. */
-#define PTRDIFF_TYPE "int"
-
-/* Type used for wchar_t, as a string used in a declaration. */
-#define WCHAR_TYPE "short unsigned int"
-
-/* Width of wchar_t in bits. */
-#define WCHAR_TYPE_SIZE 16
-
-/* A C expression for the size in bits of the type `short' on the
- target machine. If you don't define this, the default is half a
- word. (If this would be less than one storage unit, it is
- rounded up to one unit.) */
-#define SHORT_TYPE_SIZE 16
-
-/* A C expression for the size in bits of the type `int' on the
- target machine. If you don't define this, the default is one
- word. */
-#define INT_TYPE_SIZE 32
-
-/* A C expression for the size in bits of the type `long' on the
- target machine. If you don't define this, the default is one
- word. */
-#define LONG_TYPE_SIZE (TARGET_32BIT ? 32 : 64)
-#define MAX_LONG_TYPE_SIZE 64
-
-/* A C expression for the size in bits of the type `long long' on the
- target machine. If you don't define this, the default is two
- words. */
-#define LONG_LONG_TYPE_SIZE 64
-
-/* A C expression for the size in bits of the type `char' on the
- target machine. If you don't define this, the default is one
- quarter of a word. (If this would be less than one storage unit,
- it is rounded up to one unit.) */
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-
-/* A C expression for the size in bits of the type `float' on the
- target machine. If you don't define this, the default is one
- word. */
-#define FLOAT_TYPE_SIZE 32
-
-/* A C expression for the size in bits of the type `double' on the
- target machine. If you don't define this, the default is two
- words. */
-#define DOUBLE_TYPE_SIZE 64
-
-/* A C expression for the size in bits of the type `long double' on
- the target machine. If you don't define this, the default is two
- words. */
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE (TARGET_32BIT ? 32 : 64)
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY (TARGET_32BIT ? 32 : 64)
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 64
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 32
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 64
-
-/* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
-#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
- (DECL_MODE (FIELD) != DFmode ? (COMPUTED) : MIN ((COMPUTED), 32))
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* AIX 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) \
- && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \
- ? MAX (MAX ((COMPUTED), (SPECIFIED)), BIGGEST_ALIGNMENT) \
- : MAX ((COMPUTED), (SPECIFIED)))
-
-/* Make strings word-aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- (TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
-
-/* Non-zero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 0
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- RS/6000 has 32 fixed-point registers, 32 floating-point registers,
- an MQ register, a count register, a link register, and 8 condition
- register fields, which we view here as separate registers.
-
- In addition, the difference between the frame and argument pointers is
- a function of the number of registers saved, so we need to have a
- register for AP that will later be eliminated in favor of SP or FP.
- This is a normal register, but it is fixed.
-
- We also create a pseudo register for float/int conversions, that will
- really represent the memory location used. It is represented here as
- a register, in order to work around problems in allocating stack storage
- in inline functions. */
-
-#define FIRST_PSEUDO_REGISTER 77
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
-
- On RS/6000, r1 is used for the stack and r2 is used as the TOC pointer.
-
- cr5 is not supposed to be used.
-
- On System V implementations, r13 is fixed and not available for use. */
-
-#ifndef FIXED_R13
-#define FIXED_R13 0
-#endif
-
-#define FIXED_REGISTERS \
- {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FIXED_R13, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, FIXED_R13, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1}
-
-/* List the order in which to allocate registers. Each register must be
- listed once, even those in FIXED_REGISTERS.
-
- We allocate in the following order:
- fp0 (not saved or used for anything)
- fp13 - fp2 (not saved; incoming fp arg registers)
- fp1 (not saved; return value)
- fp31 - fp14 (saved; order given to save least number)
- cr1, cr6, cr7 (not saved or special)
- cr0 (not saved, but used for arithmetic operations)
- cr2, cr3, cr4 (saved)
- r0 (not saved; cannot be base reg)
- r9 (not saved; best for TImode)
- r11, r10, r8-r4 (not saved; highest used first to make less conflict)
- r3 (not saved; return value register)
- r31 - r13 (saved; order given to save least number)
- r12 (not saved; if used for DImode or DFmode would use r13)
- mq (not saved; best to use it if we can)
- ctr (not saved; when we have the choice ctr is better)
- lr (saved)
- cr5, r1, r2, ap (fixed) */
-
-#define REG_ALLOC_ORDER \
- {32, \
- 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, \
- 33, \
- 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
- 50, 49, 48, 47, 46, \
- 69, 74, 75, 68, 70, 71, 72, \
- 0, \
- 9, 11, 10, 8, 7, 6, 5, 4, \
- 3, \
- 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, \
- 18, 17, 16, 15, 14, 13, 12, \
- 64, 66, 65, \
- 73, 1, 2, 67, 76}
-
-/* True if register is floating-point. */
-#define FP_REGNO_P(N) ((N) >= 32 && (N) <= 63)
-
-/* True if register is a condition register. */
-#define CR_REGNO_P(N) ((N) >= 68 && (N) <= 75)
-
-/* True if register is an integer register. */
-#define INT_REGNO_P(N) ((N) <= 31 || (N) == 67)
-
-/* True if register is the temporary memory location used for int/float
- conversion. */
-#define FPMEM_REGNO_P(N) ((N) == FPMEM_REGNUM)
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On RS/6000, ordinary registers hold 32 bits worth;
- a single floating point register holds 64 bits worth. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (FP_REGNO_P (REGNO) || FPMEM_REGNO_P (REGNO) \
- ? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* 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 the float
- registers only can hold floating modes and DImode, and CR register only
- can hold CC modes. We cannot put TImode anywhere except general
- register and it must be able to fit within the register set. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (FP_REGNO_P (REGNO) ? \
- (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) == UNITS_PER_FP_WORD)) \
- : CR_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_CC \
- : FPMEM_REGNO_P (REGNO) ? ((MODE) == DImode || (MODE) == DFmode) \
- : ! INT_REGNO_P (REGNO) ? (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
- : 1)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (GET_MODE_CLASS (MODE1) == MODE_FLOAT \
- ? GET_MODE_CLASS (MODE2) == MODE_FLOAT \
- : GET_MODE_CLASS (MODE2) == MODE_FLOAT \
- ? GET_MODE_CLASS (MODE1) == MODE_FLOAT \
- : GET_MODE_CLASS (MODE1) == MODE_CC \
- ? GET_MODE_CLASS (MODE2) == MODE_CC \
- : GET_MODE_CLASS (MODE2) == MODE_CC \
- ? GET_MODE_CLASS (MODE1) == MODE_CC \
- : 1)
-
-/* A C expression returning the cost of moving data from a register of class
- CLASS1 to one of CLASS2.
-
- On the RS/6000, copying between floating-point and fixed-point
- registers is expensive. */
-
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- ((CLASS1) == FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 2 \
- : (CLASS1) == FLOAT_REGS && (CLASS2) != FLOAT_REGS ? 10 \
- : (CLASS1) != FLOAT_REGS && (CLASS2) == FLOAT_REGS ? 10 \
- : (((CLASS1) == SPECIAL_REGS || (CLASS1) == MQ_REGS \
- || (CLASS1) == LINK_REGS || (CLASS1) == CTR_REGS \
- || (CLASS1) == LINK_OR_CTR_REGS) \
- && ((CLASS2) == SPECIAL_REGS || (CLASS2) == MQ_REGS \
- || (CLASS2) == LINK_REGS || (CLASS2) == CTR_REGS \
- || (CLASS2) == LINK_OR_CTR_REGS)) ? 10 \
- : 2)
-
-/* A C expressions returning the cost of moving data of MODE from a register to
- or from memory.
-
- On the RS/6000, bump this up a bit. */
-
-#define MEMORY_MOVE_COST(MODE) \
- ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
- && (rs6000_cpu == PROCESSOR_RIOS1 || rs6000_cpu == PROCESSOR_PPC601) \
- ? 3 : 2) \
- + 4)
-
-/* Specify the cost of a branch insn; roughly the number of extra insns that
- should be added to avoid a branch.
-
- Set this to 3 on the RS/6000 since that is roughly the average cost of an
- unscheduled conditional branch. */
-
-#define BRANCH_COST 3
-
-/* A C statement (sans semicolon) to update the integer variable COST
- based on the relationship between INSN that is dependent on
- DEP_INSN through the dependence LINK. The default is to make no
- adjustment to COST. On the RS/6000, ignore the cost of anti- and
- output-dependencies. In fact, output dependencies on the CR do have
- a cost, but it is probably not worthwhile to track it. */
-
-#define ADJUST_COST(INSN,LINK,DEP_INSN,COST) \
- (COST) = rs6000_adjust_cost (INSN,LINK,DEP_INSN,COST)
-
-/* Define this macro to change register usage conditional on target flags.
- Set MQ register fixed (already call_used) if not POWER architecture
- (RIOS1, RIOS2, RSC, and PPC601) so that it will not be allocated.
- Conditionally disable FPRs. */
-
-#define CONDITIONAL_REGISTER_USAGE \
-{ \
- if (! TARGET_POWER) \
- fixed_regs[64] = 1; \
- if (TARGET_SOFT_FLOAT) \
- for (i = 32; i < 64; i++) \
- fixed_regs[i] = call_used_regs[i] = 1; \
-}
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* RS/6000 pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 1
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 31
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 0
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 67
-
-/* Place to put static chain when calling a function that requires it. */
-#define STATIC_CHAIN_REGNUM 11
-
-/* count register number for special purposes */
-#define COUNT_REGISTER_REGNUM 66
-
-/* Special register that represents memory, used for float/int conversions. */
-#define FPMEM_REGNUM 76
-
-/* Register to use as a placeholder for the GOT/allocated TOC register.
- FINALIZE_PIC will change all uses of this register to a an appropriate
- pseudo register when it adds the code to setup the GOT. We use r2
- because it is a reserved register in all of the ABI's. */
-#define GOT_TOC_REGNUM 2
-
-/* Place that structure value return address is placed.
-
- On the RS/6000, it is passed as an extra parameter. */
-#define STRUCT_VALUE 0
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The RS/6000 has three types of registers, fixed-point, floating-point,
- and condition registers, plus three special registers, MQ, CTR, and the
- link register.
-
- However, r0 is special in that it cannot be used as a base register.
- So make a class for registers valid as base registers.
-
- Also, cr0 is the only condition code register that can be used in
- arithmetic insns, so make a separate class for it.
-
- There is a special 'registrer' (76), which is not a register, but a
- placeholder for memory allocated to convert between floating point and
- integral types. This works around a problem where if we allocate memory
- with allocate_stack_{local,temp} and the function is an inline function, the
- memory allocated will clobber memory in the caller. So we use a special
- register, and if that is used, we allocate stack space for it. */
-
-enum reg_class
-{
- NO_REGS,
- BASE_REGS,
- GENERAL_REGS,
- FLOAT_REGS,
- NON_SPECIAL_REGS,
- MQ_REGS,
- LINK_REGS,
- CTR_REGS,
- LINK_OR_CTR_REGS,
- SPECIAL_REGS,
- SPEC_OR_GEN_REGS,
- CR0_REGS,
- CR_REGS,
- NON_FLOAT_REGS,
- FPMEM_REGS,
- FLOAT_OR_FPMEM_REGS,
- ALL_REGS,
- LIM_REG_CLASSES
-};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
-{ \
- "NO_REGS", \
- "BASE_REGS", \
- "GENERAL_REGS", \
- "FLOAT_REGS", \
- "NON_SPECIAL_REGS", \
- "MQ_REGS", \
- "LINK_REGS", \
- "CTR_REGS", \
- "LINK_OR_CTR_REGS", \
- "SPECIAL_REGS", \
- "SPEC_OR_GEN_REGS", \
- "CR0_REGS", \
- "CR_REGS", \
- "NON_FLOAT_REGS", \
- "FPMEM_REGS", \
- "FLOAT_OR_FPMEM_REGS", \
- "ALL_REGS" \
-}
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ \
- { 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
- { 0xfffffffe, 0x00000000, 0x00000008 }, /* BASE_REGS */ \
- { 0xffffffff, 0x00000000, 0x00000008 }, /* GENERAL_REGS */ \
- { 0x00000000, 0xffffffff, 0x00000000 }, /* FLOAT_REGS */ \
- { 0xffffffff, 0xffffffff, 0x00000008 }, /* NON_SPECIAL_REGS */ \
- { 0x00000000, 0x00000000, 0x00000001 }, /* MQ_REGS */ \
- { 0x00000000, 0x00000000, 0x00000002 }, /* LINK_REGS */ \
- { 0x00000000, 0x00000000, 0x00000004 }, /* CTR_REGS */ \
- { 0x00000000, 0x00000000, 0x00000006 }, /* LINK_OR_CTR_REGS */ \
- { 0x00000000, 0x00000000, 0x00000007 }, /* SPECIAL_REGS */ \
- { 0xffffffff, 0x00000000, 0x0000000f }, /* SPEC_OR_GEN_REGS */ \
- { 0x00000000, 0x00000000, 0x00000010 }, /* CR0_REGS */ \
- { 0x00000000, 0x00000000, 0x00000ff0 }, /* CR_REGS */ \
- { 0xffffffff, 0x00000000, 0x0000ffff }, /* NON_FLOAT_REGS */ \
- { 0x00000000, 0x00000000, 0x00010000 }, /* FPMEM_REGS */ \
- { 0x00000000, 0xffffffff, 0x00010000 }, /* FLOAT_OR_FPMEM_REGS */ \
- { 0xffffffff, 0xffffffff, 0x0001ffff } /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) == 0 ? GENERAL_REGS \
- : (REGNO) < 32 ? BASE_REGS \
- : FP_REGNO_P (REGNO) ? FLOAT_REGS \
- : (REGNO) == 68 ? CR0_REGS \
- : CR_REGNO_P (REGNO) ? CR_REGS \
- : (REGNO) == 64 ? MQ_REGS \
- : (REGNO) == 65 ? LINK_REGS \
- : (REGNO) == 66 ? CTR_REGS \
- : (REGNO) == 67 ? BASE_REGS \
- : (REGNO) == 76 ? FPMEM_REGS \
- : NO_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS BASE_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'f' ? FLOAT_REGS \
- : (C) == 'b' ? BASE_REGS \
- : (C) == 'h' ? SPECIAL_REGS \
- : (C) == 'q' ? MQ_REGS \
- : (C) == 'c' ? CTR_REGS \
- : (C) == 'l' ? LINK_REGS \
- : (C) == 'x' ? CR0_REGS \
- : (C) == 'y' ? CR_REGS \
- : (C) == 'z' ? FPMEM_REGS \
- : NO_REGS)
-
-/* The letters I, J, K, L, M, N, and P in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- `I' is signed 16-bit constants
- `J' is a constant with only the high-order 16 bits non-zero
- `K' is a constant with only the low-order 16 bits non-zero
- `L' is a constant that can be placed into a mask operand
- `M' is a constant that is greater than 31
- `N' is a constant that is an exact power of two
- `O' is the constant zero
- `P' is a constant whose negation is a signed 16-bit constant */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ( (C) == 'I' ? (unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000 \
- : (C) == 'J' ? ((VALUE) & 0xffff) == 0 \
- : (C) == 'K' ? ((VALUE) & 0xffff0000) == 0 \
- : (C) == 'L' ? mask_constant (VALUE) \
- : (C) == 'M' ? (VALUE) > 31 \
- : (C) == 'N' ? exact_log2 (VALUE) >= 0 \
- : (C) == 'O' ? (VALUE) == 0 \
- : (C) == 'P' ? (unsigned HOST_WIDE_INT) ((- (VALUE)) + 0x8000) < 0x1000 \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself.
-
- We flag for special constants when we can copy the constant into
- a general register in two insns for DF/DI and one insn for SF.
-
- 'H' is used for DI/DF constants that take 3 insns. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ( (C) == 'G' ? (num_insns_constant (VALUE, GET_MODE (VALUE)) \
- == ((GET_MODE (VALUE) == SFmode) ? 1 : 2)) \
- : (C) == 'H' ? (num_insns_constant (VALUE, GET_MODE (VALUE)) == 3) \
- : 0)
-
-/* Optional extra constraints for this machine.
-
- 'Q' means that is a memory operand that is just an offset from a reg.
- 'R' is for AIX TOC entries.
- 'S' is for Windows NT SYMBOL_REFs
- 'T' is for Windows NT LABEL_REFs.
- 'U' is for V.4 small data references. */
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' ? GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG \
- : (C) == 'R' ? LEGITIMATE_CONSTANT_POOL_ADDRESS_P (OP) \
- : (C) == 'S' ? (TARGET_WINDOWS_NT && DEFAULT_ABI == ABI_NT && GET_CODE (OP) == SYMBOL_REF)\
- : (C) == 'T' ? (TARGET_WINDOWS_NT && DEFAULT_ABI == ABI_NT && GET_CODE (OP) == LABEL_REF) \
- : (C) == 'U' ? ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
- && small_data_operand (OP, GET_MODE (OP))) \
- : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class.
-
- On the RS/6000, we have to return NO_REGS when we want to reload a
- floating-point CONST_DOUBLE to force it to be copied to memory. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- ((GET_CODE (X) == CONST_DOUBLE \
- && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
- ? NO_REGS : (CLASS))
-
-/* Return the register class of a scratch register needed to copy IN into
- or out of a register in CLASS in MODE. If it can be done directly,
- NO_REGS is returned. */
-
-#define SECONDARY_RELOAD_CLASS(CLASS,MODE,IN) \
- secondary_reload_class (CLASS, MODE, IN)
-
-/* If we are copying between FP registers and anything else, we need a memory
- location. */
-
-#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \
- ((CLASS1) != (CLASS2) && ((CLASS1) == FLOAT_REGS || (CLASS2) == FLOAT_REGS))
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS.
-
- On RS/6000, this is the size of MODE in words,
- except in the FP regs, where a single reg is enough for two words. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- (((CLASS) == FLOAT_REGS || (CLASS) == FPMEM_REGS \
- || (CLASS) == FLOAT_OR_FPMEM_REGS) \
- ? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* If defined, gives a class of registers that cannot be used as the
- operand of a SUBREG that changes the size of the object. */
-
-#define CLASS_CANNOT_CHANGE_SIZE FLOAT_OR_FPMEM_REGS
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Enumeration to give which calling sequence to use. */
-enum rs6000_abi {
- ABI_NONE,
- ABI_AIX, /* IBM's AIX */
- ABI_AIX_NODESC, /* AIX calling sequence minus function descriptors */
- ABI_V4, /* System V.4/eabi */
- ABI_NT, /* Windows/NT */
- ABI_SOLARIS /* Solaris */
-};
-
-extern enum rs6000_abi rs6000_current_abi; /* available for use by subtarget */
-
-/* Default ABI to compile code for */
-#ifndef DEFAULT_ABI
-#define DEFAULT_ABI ABI_AIX
-/* The prefix to add to user-visible assembler symbols. */
-#define USER_LABEL_PREFIX "."
-#endif
-
-/* Structure used to define the rs6000 stack */
-typedef struct rs6000_stack {
- int first_gp_reg_save; /* first callee saved GP register used */
- int first_fp_reg_save; /* first callee saved FP register used */
- int lr_save_p; /* true if the link reg needs to be saved */
- int cr_save_p; /* true if the CR reg needs to be saved */
- int toc_save_p; /* true if the TOC needs to be saved */
- int push_p; /* true if we need to allocate stack space */
- int calls_p; /* true if the function makes any calls */
- int main_p; /* true if this is main */
- int main_save_p; /* true if this is main and we need to save args */
- int fpmem_p; /* true if float/int conversion temp needed */
- enum rs6000_abi abi; /* which ABI to use */
- int gp_save_offset; /* offset to save GP regs from initial SP */
- int fp_save_offset; /* offset to save FP regs from initial SP */
- int lr_save_offset; /* offset to save LR from initial SP */
- int cr_save_offset; /* offset to save CR from initial SP */
- int toc_save_offset; /* offset to save the TOC pointer */
- int varargs_save_offset; /* offset to save the varargs registers */
- int main_save_offset; /* offset to save main's args */
- int fpmem_offset; /* offset for float/int conversion temp */
- int reg_size; /* register size (4 or 8) */
- int varargs_size; /* size to hold V.4 args passed in regs */
- int vars_size; /* variable save area size */
- int parm_size; /* outgoing parameter size */
- int main_size; /* size to hold saving main's args */
- int save_size; /* save area size */
- int fixed_size; /* fixed size of stack frame */
- int gp_size; /* size of saved GP registers */
- int fp_size; /* size of saved FP registers */
- int cr_size; /* size to hold CR if not in save_size */
- int lr_size; /* size to hold LR if not in save_size */
- int fpmem_size; /* size to hold float/int conversion */
- int toc_size; /* size to hold TOC if not in save_size */
- int total_size; /* total bytes allocated for stack */
-} rs6000_stack_t;
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame.
-
- On the RS/6000, we grow upwards, from the area after the outgoing
- arguments. */
-/* #define FRAME_GROWS_DOWNWARD */
-
-/* Size of the outgoing register save area */
-#define RS6000_REG_SAVE (TARGET_32BIT ? 32 : 64)
-
-/* Size of the fixed area on the stack */
-#define RS6000_SAVE_AREA (TARGET_32BIT ? 24 : 48)
-
-/* Address to save the TOC register */
-#define RS6000_SAVE_TOC plus_constant (stack_pointer_rtx, 20)
-
-/* Offset & size for fpmem stack locations used for converting between
- float and integral types. */
-extern int rs6000_fpmem_offset;
-extern int rs6000_fpmem_size;
-
-/* Size of the V.4 varargs area if needed */
-#define RS6000_VARARGS_AREA 0
-
-/* Whether a V.4 varargs area is needed */
-extern int rs6000_sysv_varargs_p;
-
-/* Align an address */
-#define ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1))
-
-/* Initialize data used by insn expanders. This is called from
- init_emit, once for each function, before code is generated. */
-#define INIT_EXPANDERS rs6000_init_expanders ()
-
-/* Size of V.4 varargs area in bytes */
-#define RS6000_VARARGS_SIZE \
- ((GP_ARG_NUM_REG * (TARGET_32BIT ? 4 : 8)) + (FP_ARG_NUM_REG * 8) + 8)
-
-/* Offset of V.4 varargs area */
-#define RS6000_VARARGS_OFFSET \
- (ALIGN (current_function_outgoing_args_size, 8) \
- + RS6000_SAVE_AREA)
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated.
-
- On the RS/6000, the frame pointer is the same as the stack pointer,
- except for dynamic allocations. So we start after the fixed area and
- outgoing parameter area. */
-
-#define STARTING_FRAME_OFFSET \
- (ALIGN (current_function_outgoing_args_size, 8) \
- + RS6000_VARARGS_AREA \
- + RS6000_SAVE_AREA)
-
-/* Offset from the stack pointer register to an item dynamically
- allocated on the stack, e.g., by `alloca'.
-
- The default value for this macro is `STACK_POINTER_OFFSET' plus the
- length of the outgoing arguments. The default is correct for most
- machines. See `function.c' for details. */
-#define STACK_DYNAMIC_OFFSET(FUNDECL) \
- (ALIGN (current_function_outgoing_args_size, 8) \
- + (STACK_POINTER_OFFSET))
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On RS/6000, don't define this because there are no push insns. */
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* Offset of first parameter from the argument pointer register value.
- On the RS/6000, we define the argument pointer to the start of the fixed
- area. */
-#define FIRST_PARM_OFFSET(FNDECL) RS6000_SAVE_AREA
-
-/* Define this if stack space is still allocated for a parameter passed
- in a register. The value is the number of bytes allocated to this
- area. */
-#define REG_PARM_STACK_SPACE(FNDECL) RS6000_REG_SAVE
-
-/* Define this if the above stack space is to be considered part of the
- space allocated by the caller. */
-#define OUTGOING_REG_PARM_STACK_SPACE
-
-/* This is the difference between the logical top of stack and the actual sp.
-
- For the RS/6000, sp points past the fixed area. */
-#define STACK_POINTER_OFFSET RS6000_SAVE_AREA
-
-/* Define this if the maximum size of all the outgoing args is to be
- accumulated and pushed during the prologue. The amount can be
- found in the variable current_function_outgoing_args_size. */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0.
-
- On RS/6000 an integer value is in r3 and a floating-point value is in
- fp1, unless -msoft-float. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), \
- TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_HARD_FLOAT ? 33 : 3)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, MODE, GET_MODE_CLASS (MODE) == MODE_FLOAT && TARGET_HARD_FLOAT ? 33 : 3)
-
-/* The definition of this macro implies that there are cases where
- a scalar value cannot be returned in registers.
-
- For the RS/6000, any structure or union type is returned in memory, except for
- Solaris, which returns structures <= 8 bytes in registers. */
-
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE (TYPE) == BLKmode \
- && (DEFAULT_ABI != ABI_SOLARIS || int_size_in_bytes (TYPE) > 8))
-
-/* Minimum and maximum general purpose registers used to hold arguments. */
-#define GP_ARG_MIN_REG 3
-#define GP_ARG_MAX_REG 10
-#define GP_ARG_NUM_REG (GP_ARG_MAX_REG - GP_ARG_MIN_REG + 1)
-
-/* Minimum and maximum floating point registers used to hold arguments. */
-#define FP_ARG_MIN_REG 33
-#define FP_ARG_AIX_MAX_REG 45
-#define FP_ARG_V4_MAX_REG 40
-#define FP_ARG_MAX_REG FP_ARG_AIX_MAX_REG
-#define FP_ARG_NUM_REG (FP_ARG_MAX_REG - FP_ARG_MIN_REG + 1)
-
-/* Return registers */
-#define GP_ARG_RETURN GP_ARG_MIN_REG
-#define FP_ARG_RETURN FP_ARG_MIN_REG
-
-/* Flags for the call/call_value rtl operations set up by function_arg */
-#define CALL_NORMAL 0x00000000 /* no special processing */
-#define CALL_NT_DLLIMPORT 0x00000001 /* NT, this is a DLL import call */
-#define CALL_V4_CLEAR_FP_ARGS 0x00000002 /* V.4, no FP args passed */
-#define CALL_V4_SET_FP_ARGS 0x00000004 /* V.4, FP args were passed */
-#define CALL_LONG 0x00000008 /* always call indirect */
-
-/* Define cutoff for using external functions to save floating point */
-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller.
-
- On RS/6000, this is r3 and fp1. */
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_ARG_RETURN || ((N) == FP_ARG_RETURN))
-
-/* 1 if N is a possible register number for function argument passing.
- On RS/6000, these are r3-r10 and fp1-fp13. */
-#define FUNCTION_ARG_REGNO_P(N) \
- (((unsigned)((N) - GP_ARG_MIN_REG) < (unsigned)(GP_ARG_NUM_REG)) \
- || ((unsigned)((N) - FP_ARG_MIN_REG) < (unsigned)(FP_ARG_NUM_REG)))
-
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the RS/6000, this is a structure. The first element is the number of
- total argument words, the second is used to store the next
- floating-point register number, and the third says how many more args we
- have prototype types for.
-
- The System V.4 varargs/stdarg support requires that this structure's size
- be a multiple of sizeof(int), and that WORDS, FREGNO, NARGS_PROTOTYPE,
- ORIG_NARGS, and VARARGS_OFFSET be the first five ints. */
-
-typedef struct rs6000_args
-{
- int words; /* # words uses for passing GP registers */
- int fregno; /* next available FP register */
- int nargs_prototype; /* # args left in the current prototype */
- int orig_nargs; /* Original value of nargs_prototype */
- int varargs_offset; /* offset of the varargs save area */
- int prototype; /* Whether a prototype was defined */
- int call_cookie; /* Do special things for this call */
-} CUMULATIVE_ARGS;
-
-/* Define intermediate macro to compute the size (in registers) of an argument
- for the RS/6000. */
-
-#define RS6000_ARG_SIZE(MODE, TYPE, NAMED) \
-(! (NAMED) ? 0 \
- : (MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \
- : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- init_cumulative_args (&CUM, FNTYPE, LIBNAME, FALSE)
-
-/* Similar, but when scanning the definition of a procedure. We always
- set NARGS_PROTOTYPE large so we never return an EXPR_LIST. */
-
-#define INIT_CUMULATIVE_INCOMING_ARGS(CUM,FNTYPE,LIBNAME) \
- init_cumulative_args (&CUM, FNTYPE, LIBNAME, TRUE)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- function_arg_advance (&CUM, MODE, TYPE, NAMED)
-
-/* Non-zero if we can use a floating-point register to pass this arg. */
-#define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \
- (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- && (CUM).fregno <= FP_ARG_MAX_REG \
- && TARGET_HARD_FLOAT)
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- On RS/6000 the first eight words of non-FP are normally in registers
- and the rest are pushed. The first 13 FP args are in registers.
-
- If this is floating-point and no prototype is specified, we use
- both an FP and integer register (or possibly FP reg and stack). Library
- functions (when TYPE is zero) always have the proper types for args,
- so we can pass the FP value just in one register. emit_library_function
- doesn't support EXPR_LIST anyway. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- function_arg (&CUM, MODE, TYPE, NAMED)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
- function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
-
-/* A C expression that indicates when an argument must be passed by
- reference. If nonzero for an argument, a copy of that argument is
- made in memory and a pointer to the argument is passed instead of
- the argument itself. The pointer is passed in whatever way is
- appropriate for passing a pointer to that type. */
-
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
- function_arg_pass_by_reference(&CUM, MODE, TYPE, NAMED)
-
-/* If defined, a C expression that gives the alignment boundary, in bits,
- of an argument with the specified mode and type. If it is not defined,
- PARM_BOUNDARY is used for all arguments. */
-
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
- function_arg_boundary (MODE, TYPE)
-
-/* Perform any needed actions needed for a function that is receiving a
- variable number of arguments.
-
- CUM is as above.
-
- MODE and TYPE are the mode and type of the current parameter.
-
- PRETEND_SIZE is a variable that should be set to the amount of stack
- that must be pushed by the prolog to pretend that our caller pushed
- it.
-
- Normally, this macro will push all remaining incoming registers on the
- stack and set PRETEND_SIZE to the length of the registers pushed. */
-
-#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
- setup_incoming_varargs (&CUM, MODE, TYPE, &PRETEND_SIZE, NO_RTL)
-
-/* If defined, is a C expression that produces the machine-specific
- code for a call to `__builtin_saveregs'. This code will be moved
- to the very beginning of the function, before any parameter access
- are made. The return value of this function should be an RTX that
- contains the value to use as the return of `__builtin_saveregs'.
-
- The argument ARGS is a `tree_list' containing the arguments that
- were passed to `__builtin_saveregs'.
-
- If this macro is not defined, the compiler will output an ordinary
- call to the library function `__builtin_saveregs'. */
-
-#define EXPAND_BUILTIN_SAVEREGS(ARGS) \
- expand_builtin_saveregs (ARGS)
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) output_prolog (FILE, SIZE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- output_function_profiler ((FILE), (LABELNO));
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. No definition is equivalent to
- always zero.
-
- On the RS/6000, this is non-zero because we can restore the stack from
- its backpointer, which we maintain. */
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) output_epilog (FILE, SIZE)
-
-/* TRAMPOLINE_TEMPLATE deleted */
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE rs6000_trampoline_size ()
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
- rs6000_initialize_trampoline (ADDR, FNADDR, CXT)
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
- with arguments ARGS is a valid machine specific attribute for DECL.
- The attributes in ATTRIBUTES have previously been assigned to DECL. */
-
-#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
- (rs6000_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))
-
-/* If defined, a C expression whose value is nonzero if IDENTIFIER
- with arguments ARGS is a valid machine specific attribute for TYPE.
- The attributes in ATTRIBUTES have previously been assigned to TYPE. */
-
-#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \
- (rs6000_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS))
-
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (rs6000_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
- (rs6000_set_default_type_attributes (TYPE))
-
-
-/* Definitions for __builtin_return_address and __builtin_frame_address.
- __builtin_return_address (0) should give link register (65), enable
- this. */
-/* This should be uncommented, so that the link register is used, but
- currently this would result in unmatched insns and spilling fixed
- registers so we'll leave it for another day. When these problems are
- taken care of one additional fetch will be necessary in RETURN_ADDR_RTX.
- (mrs) */
-/* #define RETURN_ADDR_IN_PREVIOUS_FRAME */
-
-/* Number of bytes into the frame return addresses can be found. See
- rs6000_stack_info in rs6000.c for more information on how the different
- abi's store the return address. */
-#define RETURN_ADDRESS_OFFSET \
- ((DEFAULT_ABI == ABI_AIX \
- || DEFAULT_ABI == ABI_AIX_NODESC) ? 8 : \
- (DEFAULT_ABI == ABI_V4 \
- || DEFAULT_ABI == ABI_SOLARIS) ? (TARGET_32BIT ? 4 : 8) : \
- (DEFAULT_ABI == ABI_NT) ? -4 : \
- (fatal ("RETURN_ADDRESS_OFFSET not supported"), 0))
-
-/* The current return address is in link register (65). The return address
- of anything farther back is accessed normally at an offset of 8 from the
- frame pointer. */
-#define RETURN_ADDR_RTX(count, frame) \
- ((count == -1) \
- ? gen_rtx (REG, Pmode, 65) \
- : gen_rtx (MEM, Pmode, \
- memory_address (Pmode, \
- plus_constant (copy_to_reg (gen_rtx (MEM, Pmode, \
- memory_address (Pmode, frame))), \
- RETURN_ADDRESS_OFFSET))))
-
-/* Definitions for register eliminations.
-
- We have two registers that can be eliminated on the RS/6000. First, the
- frame pointer register can often be eliminated in favor of the stack
- pointer register. Secondly, the argument pointer register can always be
- eliminated; it is replaced with either the stack or frame pointer.
-
- In addition, we use the elimination mechanism to see if r30 is needed
- Initially we assume that it isn't. If it is, we spill it. This is done
- by making it an eliminable register. We replace it with itself so that
- if it isn't needed, then existing uses won't be modified. */
-
-/* This is an array of structures. Each structure initializes one pair
- of eliminable registers. The "from" register number is given first,
- followed by "to". Eliminations of the same "from" register are listed
- in order of preference. */
-#define ELIMINABLE_REGS \
-{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- { 30, 30} }
-
-/* Given FROM and TO register numbers, say whether this elimination is allowed.
- Frame pointer elimination is automatically handled.
-
- For the RS/6000, if frame pointer elimination is being done, we would like
- to convert ap into fp, not sp.
-
- We need r30 if -mminimal-toc was specified, and there are constant pool
- references. */
-
-#define CAN_ELIMINATE(FROM, TO) \
- ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \
- ? ! frame_pointer_needed \
- : (FROM) == 30 ? ! TARGET_MINIMAL_TOC || TARGET_NO_TOC || get_pool_size () == 0 \
- : 1)
-
-/* Define the offset between two registers, one to be eliminated, and the other
- its replacement, at the start of a routine. */
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ \
- rs6000_stack_t *info = rs6000_stack_info (); \
- \
- if ((FROM) == FRAME_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- (OFFSET) = (info->push_p) ? 0 : - info->total_size; \
- else if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \
- (OFFSET) = info->total_size; \
- else if ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM) \
- (OFFSET) = (info->push_p) ? info->total_size : 0; \
- else if ((FROM) == 30) \
- (OFFSET) = 0; \
- else \
- abort (); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-#define HAVE_PRE_DECREMENT
-#define HAVE_PRE_INCREMENT
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
-((REGNO) < FIRST_PSEUDO_REGISTER \
- ? (REGNO) <= 31 || (REGNO) == 67 \
- : (reg_renumber[REGNO] >= 0 \
- && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
-
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-((REGNO) < FIRST_PSEUDO_REGISTER \
- ? ((REGNO) > 0 && (REGNO) <= 31) || (REGNO) == 67 \
- : (reg_renumber[REGNO] > 0 \
- && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67)))
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
-
- 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_MODE (X) == VOIDmode \
- || easy_fp_constant (X, GET_MODE (X)))
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) \
- (REGNO (X) <= 31 || REGNO (X) == 67 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- (REGNO (X) > 0 && REG_OK_FOR_INDEX_P (X))
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On the RS/6000, there are four valid address: a SYMBOL_REF that
- refers to a constant pool entry of an address (or the sum of it
- plus a constant), a short (16-bit signed) constant plus a register,
- the sum of two registers, or a register indirect, possibly with an
- auto-increment. For DFmode and DImode with an constant plus register,
- we must ensure that both words are addressable or PowerPC64 with offset
- word aligned. */
-
-#define LEGITIMATE_CONSTANT_POOL_BASE_P(X) \
- (TARGET_TOC && GET_CODE (X) == SYMBOL_REF \
- && CONSTANT_POOL_ADDRESS_P (X) \
- && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (X)))
-
-/* TARGET_64BIT TOC64 guaranteed to have 64 bit alignment. */
-#define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) \
- (LEGITIMATE_CONSTANT_POOL_BASE_P (X) \
- || (TARGET_TOC \
- && GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
- && LEGITIMATE_CONSTANT_POOL_BASE_P (XEXP (XEXP (X, 0), 0))))
-
-#define LEGITIMATE_SMALL_DATA_P(MODE, X) \
- ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
- && !flag_pic && !TARGET_TOC \
- && (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST) \
- && small_data_operand (X, MODE))
-
-#define LEGITIMATE_ADDRESS_INTEGER_P(X,OFFSET) \
- (GET_CODE (X) == CONST_INT \
- && (unsigned HOST_WIDE_INT) (INTVAL (X) + (OFFSET) + 0x8000) < 0x10000)
-
-#define LEGITIMATE_OFFSET_ADDRESS_P(MODE,X) \
- (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 0) \
- && (((MODE) != DFmode && (MODE) != DImode) \
- || (TARGET_32BIT \
- ? LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 4) \
- : ! (INTVAL (XEXP (X, 1)) & 3))) \
- && ((MODE) != TImode \
- || (TARGET_32BIT \
- ? LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 12) \
- : (LEGITIMATE_ADDRESS_INTEGER_P (XEXP (X, 1), 8) \
- && ! (INTVAL (XEXP (X, 1)) & 3)))))
-
-#define LEGITIMATE_INDEXED_ADDRESS_P(X) \
- (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && GET_CODE (XEXP (X, 1)) == REG \
- && ((REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && REG_OK_FOR_INDEX_P (XEXP (X, 1))) \
- || (REG_OK_FOR_BASE_P (XEXP (X, 1)) \
- && REG_OK_FOR_INDEX_P (XEXP (X, 0)))))
-
-#define LEGITIMATE_INDIRECT_ADDRESS_P(X) \
- (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))
-
-#define LEGITIMATE_LO_SUM_ADDRESS_P(MODE, X) \
- (TARGET_ELF \
- && !flag_pic && !TARGET_TOC \
- && (MODE) != DImode \
- && (MODE) != TImode \
- && (TARGET_HARD_FLOAT || (MODE) != DFmode) \
- && GET_CODE (X) == LO_SUM \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && CONSTANT_P (XEXP (X, 1)))
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ if (LEGITIMATE_INDIRECT_ADDRESS_P (X)) \
- goto ADDR; \
- if ((GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC) \
- && LEGITIMATE_INDIRECT_ADDRESS_P (XEXP (X, 0))) \
- goto ADDR; \
- if (LEGITIMATE_SMALL_DATA_P (MODE, X)) \
- goto ADDR; \
- if (LEGITIMATE_CONSTANT_POOL_ADDRESS_P (X)) \
- goto ADDR; \
- if (LEGITIMATE_OFFSET_ADDRESS_P (MODE, X)) \
- goto ADDR; \
- if ((MODE) != TImode \
- && (TARGET_HARD_FLOAT || TARGET_64BIT || (MODE) != DFmode) \
- && (TARGET_64BIT || (MODE) != DImode) \
- && LEGITIMATE_INDEXED_ADDRESS_P (X)) \
- goto ADDR; \
- if (LEGITIMATE_LO_SUM_ADDRESS_P (MODE, X)) \
- goto ADDR; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- On RS/6000, first check for the sum of a register with a constant
- integer that is out of range. If so, generate code to add the
- constant with the low-order 16 bits masked to the register and force
- this result into another register (this can be done with `cau').
- Then generate an address of REG+(CONST&0xffff), allowing for the
- possibility of bit 16 being a one.
-
- Then check for the sum of a register and something not constant, try to
- load the other things into a register and return the sum. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (unsigned HOST_WIDE_INT) (INTVAL (XEXP (X, 1)) + 0x8000) >= 0x10000) \
- { HOST_WIDE_INT high_int, low_int; \
- rtx sum; \
- high_int = INTVAL (XEXP (X, 1)) & (~ (HOST_WIDE_INT) 0xffff); \
- low_int = INTVAL (XEXP (X, 1)) & 0xffff; \
- if (low_int & 0x8000) \
- high_int += 0x10000, low_int |= ((HOST_WIDE_INT) -1) << 16; \
- sum = force_operand (gen_rtx (PLUS, Pmode, XEXP (X, 0), \
- GEN_INT (high_int)), 0); \
- (X) = gen_rtx (PLUS, Pmode, sum, GEN_INT (low_int)); \
- goto WIN; \
- } \
- else if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \
- && GET_CODE (XEXP (X, 1)) != CONST_INT \
- && (TARGET_HARD_FLOAT || TARGET_64BIT || (MODE) != DFmode) \
- && (TARGET_64BIT || (MODE) != DImode) \
- && (MODE) != TImode) \
- { \
- (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
- force_reg (Pmode, force_operand (XEXP (X, 1), 0))); \
- goto WIN; \
- } \
- else if (TARGET_ELF && TARGET_32BIT && TARGET_NO_TOC \
- && !flag_pic \
- && GET_CODE (X) != CONST_INT \
- && GET_CODE (X) != CONST_DOUBLE && CONSTANT_P (X) \
- && (TARGET_HARD_FLOAT || (MODE) != DFmode) \
- && (MODE) != DImode && (MODE) != TImode) \
- { \
- rtx reg = gen_reg_rtx (Pmode); \
- emit_insn (gen_elf_high (reg, (X))); \
- (X) = gen_rtx (LO_SUM, Pmode, reg, (X)); \
- } \
-}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
-
- On the RS/6000 this is true if the address is valid with a zero offset
- but not with an offset of four (this means it cannot be used as an
- address for DImode or DFmode) or is a pre-increment or decrement. Since
- we know it is valid, we just check for an address that is not valid with
- an offset of four. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
-{ if (GET_CODE (ADDR) == PLUS \
- && LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), 0) \
- && ! LEGITIMATE_ADDRESS_INTEGER_P (XEXP (ADDR, 1), \
- (TARGET_32BIT ? 4 : 8))) \
- goto LABEL; \
- if (GET_CODE (ADDR) == PRE_INC) \
- goto LABEL; \
- if (GET_CODE (ADDR) == PRE_DEC) \
- goto LABEL; \
- if (GET_CODE (ADDR) == LO_SUM) \
- goto LABEL; \
-}
-
-/* The register number of the register used to address a table of
- static data addresses in memory. In some cases this register is
- defined by a processor's "application binary interface" (ABI).
- When this macro is defined, RTL is generated for this register
- once, as with the stack pointer and frame pointer registers. If
- this macro is not defined, it is up to the machine-dependent files
- to allocate such a register (if necessary). */
-
-/* #define PIC_OFFSET_TABLE_REGNUM */
-
-/* Define this macro if the register defined by
- `PIC_OFFSET_TABLE_REGNUM' is clobbered by calls. Do not define
- this macro if `PPIC_OFFSET_TABLE_REGNUM' is not defined. */
-
-/* #define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED */
-
-/* By generating position-independent code, when two different
- programs (A and B) share a common library (libC.a), the text of
- the library can be shared whether or not the library is linked at
- the same address for both programs. In some of these
- environments, position-independent code requires not only the use
- of different addressing modes, but also special code to enable the
- use of these addressing modes.
-
- The `FINALIZE_PIC' macro serves as a hook to emit these special
- codes once the function is being compiled into assembly code, but
- not before. (It is not done before, because in the case of
- compiling an inline function, it would lead to multiple PIC
- prologues being included in functions which used inline functions
- and were compiled to assembly language.) */
-
-#define FINALIZE_PIC rs6000_finalize_pic ()
-
-/* A C expression that is nonzero if X is a legitimate immediate
- operand on the target machine when generating position independent
- code. You can assume that X satisfies `CONSTANT_P', so you need
- not check this. You can also assume FLAG_PIC is true, so you need
- not check it either. You need not define this macro if all
- constants (including `SYMBOL_REF') can be immediate operands when
- generating position independent code. */
-
-/* #define LEGITIMATE_PIC_OPERAND_P (X) */
-
-/* In rare cases, correct code generation requires extra machine
- dependent processing between the second jump optimization pass and
- delayed branch scheduling. On those machines, define this macro
- as a C statement to act on the code starting at INSN.
-
- On the RS/6000, we use it to make sure the GOT_TOC register marker
- that FINALIZE_PIC is supposed to remove actually got removed. */
-
-#define MACHINE_DEPENDENT_REORG(INSN) rs6000_reorg (INSN)
-
-
-/* Define this if some processing needs to be done immediately before
- emitting code for an insn. */
-
-/* #define FINAL_PRESCAN_INSN(INSN,OPERANDS,NOPERANDS) */
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE (TARGET_32BIT ? SImode : DImode)
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-#define CASE_VECTOR_PC_RELATIVE
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 0
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
-
-/* #define FIXUNS_TRUNC_LIKE_FIX_TRUNC */
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX (! TARGET_POWERPC64 ? 4 : 8)
-#define MAX_MOVE_MAX 8
-
-/* Nonzero if access to memory by bytes is no faster than for words.
- Also non-zero if doing byte operations (specifically shifts) in registers
- is undesirable. */
-#define SLOW_BYTE_ACCESS 1
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-
-/* Define if loading short immediate values into registers sign extends. */
-#define SHORT_IMMEDIATES_SIGN_EXTEND
-
-/* The RS/6000 uses the XCOFF format. */
-
-#define XCOFF_DEBUGGING_INFO
-
-/* Define if the object format being used is COFF or a superset. */
-#define OBJECT_FORMAT_COFF
-
-/* Define the magic numbers that we recognize as COFF. */
-
-#define MY_ISCOFF(magic) \
- ((magic) == U802WRMAGIC || (magic) == U802ROMAGIC || (magic) == U802TOCMAGIC)
-
-/* This is the only version of nm that collect2 can work with. */
-#define REAL_NM_FILE_NAME "/usr/ucb/nm"
-
-/* We don't have GAS for the RS/6000 yet, so don't write out special
- .stabs in cc1plus. */
-
-#define FASCIST_ASSEMBLER
-
-#ifndef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(file, name)
-#endif
-#ifndef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(file, name)
-#endif
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode (TARGET_32BIT ? SImode : DImode)
-
-/* Mode of a function address in a call instruction (for indexing purposes).
-
- Doesn't matter on RS/6000. */
-#define FUNCTION_MODE (TARGET_32BIT ? SImode : DImode)
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-#define NO_FUNCTION_CSE
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits.
-
- The sle and sre instructions which allow SHIFT_COUNT_TRUNCATED
- have been dropped from the PowerPC architecture. */
-
-#define SHIFT_COUNT_TRUNCATED (TARGET_POWER ? 1 : 0)
-
-/* Use atexit for static constructors/destructors, instead of defining
- our own exit function. */
-#define HAVE_ATEXIT
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch.
-
- On the RS/6000, if it is valid in the insn, it is free. So this
- always returns 0. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- case CONST_DOUBLE: \
- case HIGH: \
- return 0;
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. */
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MULT: \
- switch (rs6000_cpu) \
- { \
- case PROCESSOR_RIOS1: \
- 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_RIOS2: \
- case PROCESSOR_MPCCORE: \
- return COSTS_N_INSNS (2); \
- case PROCESSOR_PPC601: \
- return COSTS_N_INSNS (5); \
- case PROCESSOR_PPC603: \
- 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_PPC403: \
- case PROCESSOR_PPC604: \
- case PROCESSOR_PPC620: \
- return COSTS_N_INSNS (4); \
- } \
- case DIV: \
- case MOD: \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && exact_log2 (INTVAL (XEXP (X, 1))) >= 0) \
- return COSTS_N_INSNS (2); \
- /* otherwise fall through to normal divide. */ \
- case UDIV: \
- case UMOD: \
- switch (rs6000_cpu) \
- { \
- case PROCESSOR_RIOS1: \
- return COSTS_N_INSNS (19); \
- case PROCESSOR_RIOS2: \
- return COSTS_N_INSNS (13); \
- case PROCESSOR_MPCCORE: \
- return COSTS_N_INSNS (6); \
- case PROCESSOR_PPC403: \
- return COSTS_N_INSNS (33); \
- case PROCESSOR_PPC601: \
- return COSTS_N_INSNS (36); \
- case PROCESSOR_PPC603: \
- return COSTS_N_INSNS (37); \
- case PROCESSOR_PPC604: \
- case PROCESSOR_PPC620: \
- return COSTS_N_INSNS (20); \
- } \
- case FFS: \
- return COSTS_N_INSNS (4); \
- case MEM: \
- /* MEM should be slightly more expensive than (plus (reg) (const)) */ \
- return 5;
-
-/* Compute the cost of an address. This is meant to approximate the size
- and/or execution delay of an insn using that address. If the cost is
- approximated by the RTL complexity, including CONST_COSTS above, as
- is usually the case for CISC machines, this macro should not be defined.
- For aggressively RISCy machines, only one insn format is allowed, so
- this macro should be a constant. The value of this macro only matters
- for valid addresses.
-
- For the RS/6000, everything is cost 0. */
-
-#define ADDRESS_COST(RTX) 0
-
-/* Adjust the length of an INSN. LENGTH is the currently-computed length and
- should be adjusted to reflect any required changes. This macro is used when
- there is some systematic length adjustment required that would be difficult
- to express in the length attribute. */
-
-/* #define ADJUST_INSN_LENGTH(X,LENGTH) */
-
-/* Add any extra modes needed to represent the condition code.
-
- For the RS/6000, we need separate modes when unsigned (logical) comparisons
- are being done and we need a separate mode for floating-point. We also
- use a mode for the case when we are comparing the results of two
- comparisons. */
-
-#define EXTRA_CC_MODES CCUNSmode, CCFPmode, CCEQmode
-
-/* Define the names for the modes specified above. */
-#define EXTRA_CC_NAMES "CCUNS", "CCFP", "CCEQ"
-
-/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
- return the mode to be used for the comparison. For floating-point, CCFPmode
- should be used. CCUNSmode should be used for unsigned comparisons.
- CCEQmode should be used when we are doing an inequality comparison on
- the result of a comparison. CCmode should be used in all other cases. */
-
-#define SELECT_CC_MODE(OP,X,Y) \
- (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT ? CCFPmode \
- : (OP) == GTU || (OP) == LTU || (OP) == GEU || (OP) == LEU ? CCUNSmode \
- : (((OP) == EQ || (OP) == NE) && GET_RTX_CLASS (GET_CODE (X)) == '<' \
- ? CCEQmode : CCmode))
-
-/* Define the information needed to generate branch and scc insns. This is
- stored from the compare operation. Note that we can't use "rtx" here
- since it hasn't been defined! */
-
-extern struct rtx_def *rs6000_compare_op0, *rs6000_compare_op1;
-extern int rs6000_compare_fp_p;
-
-/* Set to non-zero by "fix" operation to indicate that itrunc and
- uitrunc must be defined. */
-
-extern int rs6000_trunc_used;
-
-/* Function names to call to do floating point truncation. */
-
-#define RS6000_ITRUNC "itrunc"
-#define RS6000_UITRUNC "uitrunc"
-
-/* Prefix and suffix to use to saving floating point */
-#ifndef SAVE_FP_PREFIX
-#define SAVE_FP_PREFIX "._savef"
-#define SAVE_FP_SUFFIX ""
-#endif
-
-/* Prefix and suffix to use to restoring floating point */
-#ifndef RESTORE_FP_PREFIX
-#define RESTORE_FP_PREFIX "._restf"
-#define RESTORE_FP_SUFFIX ""
-#endif
-
-
-/* Control the assembler format that we output. */
-
-/* A C string constant describing how to begin a comment in the target
- assembler language. The compiler assumes that the comment will end at
- the end of the line. */
-#define ASM_COMMENT_START " #"
-
-/* Output at beginning of assembler file.
-
- Initialize the section names for the RS/6000 at this point.
-
- Specify filename to assembler.
-
- We want to go into the TOC section so at least one .toc will be emitted.
- Also, in order to output proper .bs/.es pairs, we need at least one static
- [RW] section emitted.
-
- We then switch back to text to force the gcc2_compiled. label and the space
- allocated after it (when profiling) into the text section.
-
- Finally, declare mcount when profiling to make the assembler happy. */
-
-#define ASM_FILE_START(FILE) \
-{ \
- rs6000_gen_section_name (&xcoff_bss_section_name, \
- main_input_filename, ".bss_"); \
- rs6000_gen_section_name (&xcoff_private_data_section_name, \
- main_input_filename, ".rw_"); \
- rs6000_gen_section_name (&xcoff_read_only_section_name, \
- main_input_filename, ".ro_"); \
- \
- output_file_directive (FILE, main_input_filename); \
- toc_section (); \
- if (write_symbols != NO_DEBUG) \
- private_data_section (); \
- text_section (); \
- if (profile_flag) \
- fputs ("\t.extern .mcount\n", FILE); \
- rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
-}
-
-/* Output at end of assembler file.
-
- On the RS/6000, referencing data should automatically pull in text. */
-
-#define ASM_FILE_END(FILE) \
-{ \
- text_section (); \
- fputs ("_section_.text:\n", FILE); \
- data_section (); \
- fputs ("\t.long _section_.text\n", FILE); \
-}
-
-/* We define this to prevent the name mangler from putting dollar signs into
- function names. */
-
-#define NO_DOLLAR_IN_LABEL
-
-/* We define this to 0 so that gcc will never accept a dollar sign in a
- variable name. This is needed because the AIX assembler will not accept
- dollar signs. */
-
-#define DOLLARS_IN_IDENTIFIERS 0
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Define the extra sections we need. We define three: one is the read-only
- data section which is used for constants. This is a csect whose name is
- derived from the name of the input file. The second is for initialized
- global variables. This is a csect whose name is that of the variable.
- The third is the TOC. */
-
-#define EXTRA_SECTIONS \
- read_only_data, private_data, read_only_private_data, toc, bss
-
-/* Define the name of our readonly data section. */
-
-#define READONLY_DATA_SECTION read_only_data_section
-
-
-/* Define the name of the section to use for the exception tables.
- TODO: test and see if we can use read_only_data_section, if so,
- remove this. */
-
-#define EXCEPTION_SECTION data_section
-
-/* If we are referencing a function that is static or is known to be
- in this file, make the SYMBOL_REF special. We can use this to indicate
- that we can branch to this function without emitting a no-op after the
- call. */
-
-#define ENCODE_SECTION_INFO(DECL) \
- if (TREE_CODE (DECL) == FUNCTION_DECL \
- && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL))) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
-
-/* Indicate that jump tables go in the text section. */
-
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* Define the routines to implement these extra sections. */
-
-#define EXTRA_SECTION_FUNCTIONS \
- \
-void \
-read_only_data_section () \
-{ \
- if (in_section != read_only_data) \
- { \
- fprintf (asm_out_file, ".csect %s[RO]\n", \
- xcoff_read_only_section_name); \
- in_section = read_only_data; \
- } \
-} \
- \
-void \
-private_data_section () \
-{ \
- if (in_section != private_data) \
- { \
- fprintf (asm_out_file, ".csect %s[RW]\n", \
- xcoff_private_data_section_name); \
- \
- in_section = private_data; \
- } \
-} \
- \
-void \
-read_only_private_data_section () \
-{ \
- if (in_section != read_only_private_data) \
- { \
- fprintf (asm_out_file, ".csect %s[RO]\n", \
- xcoff_private_data_section_name); \
- in_section = read_only_private_data; \
- } \
-} \
- \
-void \
-toc_section () \
-{ \
- if (TARGET_MINIMAL_TOC) \
- { \
- static int toc_initialized = 0; \
- \
- /* toc_section is always called at least once from ASM_FILE_START, \
- so this is guaranteed to always be defined once and only once \
- in each file. */ \
- if (! toc_initialized) \
- { \
- fputs (".toc\nLCTOC..0:\n", asm_out_file); \
- fputs ("\t.tc toc_table[TC],toc_table[RW]\n", asm_out_file); \
- toc_initialized = 1; \
- } \
- \
- if (in_section != toc) \
- fputs (".csect toc_table[RW]\n", asm_out_file); \
- } \
- else \
- { \
- if (in_section != toc) \
- fputs (".toc\n", asm_out_file); \
- } \
- in_section = toc; \
-}
-
-/* This macro produces the initial definition of a function name.
- On the RS/6000, we need to place an extra '.' in the function name and
- output the function descriptor.
-
- The csect for the function will have already been created by the
- `text_section' call previously done. We do have to go back to that
- csect, however. */
-
-/* ??? What do the 16 and 044 in the .function line really mean? */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
-{ if (TREE_PUBLIC (DECL)) \
- { \
- fputs ("\t.globl .", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, NAME); \
- putc ('\n', FILE); \
- } \
- else \
- { \
- fputs ("\t.lglobl .", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, NAME); \
- putc ('\n', FILE); \
- } \
- fputs (".csect ", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, NAME); \
- fputs ("[DS]\n", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, NAME); \
- fputs (":\n", FILE); \
- fputs ((TARGET_32BIT) ? "\t.long ." : "\t.llong .", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, NAME); \
- fputs (", TOC[tc0], 0\n", FILE); \
- fputs (".csect .text[PR]\n.", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, NAME); \
- fputs (":\n", FILE); \
- if (write_symbols == XCOFF_DEBUG) \
- xcoffout_declare_function (FILE, DECL, NAME); \
-}
-
-/* Return non-zero if this entry is to be written into the constant pool
- in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
- containing one of them. If -mfp-in-toc (the default), we also do
- this for floating-point constants. We actually can only do this
- if the FP formats of the target and host machines are the same, but
- we can't check that since not every file that uses
- GO_IF_LEGITIMATE_ADDRESS_P includes real.h. */
-
-#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
- (TARGET_TOC \
- && (GET_CODE (X) == SYMBOL_REF \
- || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
- || GET_CODE (X) == LABEL_REF \
- || (! (TARGET_NO_FP_IN_TOC && ! TARGET_MINIMAL_TOC) \
- && GET_CODE (X) == CONST_DOUBLE \
- && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- && BITS_PER_WORD == HOST_BITS_PER_INT)))
-
-/* Select section for constant in constant pool.
-
- On RS/6000, all constants are in the private read-only data area.
- However, if this is being placed in the TOC it must be output as a
- toc entry. */
-
-#define SELECT_RTX_SECTION(MODE, X) \
-{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
- toc_section (); \
- else \
- read_only_private_data_section (); \
-}
-
-/* Macro to output a special constant pool entry. Go to WIN if we output
- it. Otherwise, it is written the usual way.
-
- On the RS/6000, toc entries are handled this way. */
-
-#define ASM_OUTPUT_SPECIAL_POOL_ENTRY(FILE, X, MODE, ALIGN, LABELNO, WIN) \
-{ if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \
- { \
- output_toc (FILE, X, LABELNO); \
- goto WIN; \
- } \
-}
-
-/* Select the section for an initialized data object.
-
- On the RS/6000, we have a special section for all variables except those
- that are static. */
-
-#define SELECT_SECTION(EXP,RELOC) \
-{ \
- if ((TREE_CODE (EXP) == STRING_CST \
- && !flag_writable_strings) \
- || (TREE_CODE_CLASS (TREE_CODE (EXP)) == 'd' \
- && TREE_READONLY (EXP) && ! TREE_THIS_VOLATILE (EXP) \
- && DECL_INITIAL (EXP) \
- && (DECL_INITIAL (EXP) == error_mark_node \
- || TREE_CONSTANT (DECL_INITIAL (EXP))) \
- && ! (RELOC))) \
- { \
- if (TREE_PUBLIC (EXP)) \
- read_only_data_section (); \
- else \
- read_only_private_data_section (); \
- } \
- else \
- { \
- if (TREE_PUBLIC (EXP)) \
- data_section (); \
- else \
- private_data_section (); \
- } \
-}
-
-/* This outputs NAME to FILE up to the first null or '['. */
-
-#define RS6000_OUTPUT_BASENAME(FILE, NAME) \
- { \
- char *_p; \
- \
- STRIP_NAME_ENCODING (_p, (NAME)); \
- assemble_name ((FILE), _p); \
- }
-
-/* Remove any trailing [DS] or the like from the symbol name. */
-
-#define STRIP_NAME_ENCODING(VAR,NAME) \
- do \
- { \
- char *_name = (NAME); \
- int _len; \
- if (_name[0] == '*') \
- _name++; \
- _len = strlen (_name); \
- if (_name[_len - 1] != ']') \
- (VAR) = _name; \
- else \
- { \
- (VAR) = (char *) alloca (_len + 1); \
- strcpy ((VAR), _name); \
- (VAR)[_len - 4] = '\0'; \
- } \
- } \
- while (0)
-
-/* Output something to declare an external symbol to the assembler. Most
- assemblers don't need this.
-
- If we haven't already, add "[RW]" (or "[DS]" for a function) to the
- name. Normally we write this out along with the name. In the few cases
- where we can't, it gets stripped off. */
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
-{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
- if ((TREE_CODE (DECL) == VAR_DECL \
- || TREE_CODE (DECL) == FUNCTION_DECL) \
- && (NAME)[strlen (NAME) - 1] != ']') \
- { \
- char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
- strcpy (_name, XSTR (_symref, 0)); \
- strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
- XSTR (_symref, 0) = _name; \
- } \
- fputs ("\t.extern ", FILE); \
- assemble_name (FILE, XSTR (_symref, 0)); \
- if (TREE_CODE (DECL) == FUNCTION_DECL) \
- { \
- fputs ("\n\t.extern .", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
- } \
- putc ('\n', FILE); \
-}
-
-/* Similar, but for libcall. We only have to worry about the function name,
- not that of the descriptor. */
-
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
-{ fputs ("\t.extern .", FILE); \
- assemble_name (FILE, XSTR (FUN, 0)); \
- putc ('\n', FILE); \
-}
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* Output before instructions. */
-
-#define TEXT_SECTION_ASM_OP ".csect .text[PR]"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".csect .data[RW]"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-extern char rs6000_reg_names[][8]; /* register names (0 vs. %r0). */
-
-#define REGISTER_NAMES \
-{ \
- &rs6000_reg_names[ 0][0], /* r0 */ \
- &rs6000_reg_names[ 1][0], /* r1 */ \
- &rs6000_reg_names[ 2][0], /* r2 */ \
- &rs6000_reg_names[ 3][0], /* r3 */ \
- &rs6000_reg_names[ 4][0], /* r4 */ \
- &rs6000_reg_names[ 5][0], /* r5 */ \
- &rs6000_reg_names[ 6][0], /* r6 */ \
- &rs6000_reg_names[ 7][0], /* r7 */ \
- &rs6000_reg_names[ 8][0], /* r8 */ \
- &rs6000_reg_names[ 9][0], /* r9 */ \
- &rs6000_reg_names[10][0], /* r10 */ \
- &rs6000_reg_names[11][0], /* r11 */ \
- &rs6000_reg_names[12][0], /* r12 */ \
- &rs6000_reg_names[13][0], /* r13 */ \
- &rs6000_reg_names[14][0], /* r14 */ \
- &rs6000_reg_names[15][0], /* r15 */ \
- &rs6000_reg_names[16][0], /* r16 */ \
- &rs6000_reg_names[17][0], /* r17 */ \
- &rs6000_reg_names[18][0], /* r18 */ \
- &rs6000_reg_names[19][0], /* r19 */ \
- &rs6000_reg_names[20][0], /* r20 */ \
- &rs6000_reg_names[21][0], /* r21 */ \
- &rs6000_reg_names[22][0], /* r22 */ \
- &rs6000_reg_names[23][0], /* r23 */ \
- &rs6000_reg_names[24][0], /* r24 */ \
- &rs6000_reg_names[25][0], /* r25 */ \
- &rs6000_reg_names[26][0], /* r26 */ \
- &rs6000_reg_names[27][0], /* r27 */ \
- &rs6000_reg_names[28][0], /* r28 */ \
- &rs6000_reg_names[29][0], /* r29 */ \
- &rs6000_reg_names[30][0], /* r30 */ \
- &rs6000_reg_names[31][0], /* r31 */ \
- \
- &rs6000_reg_names[32][0], /* fr0 */ \
- &rs6000_reg_names[33][0], /* fr1 */ \
- &rs6000_reg_names[34][0], /* fr2 */ \
- &rs6000_reg_names[35][0], /* fr3 */ \
- &rs6000_reg_names[36][0], /* fr4 */ \
- &rs6000_reg_names[37][0], /* fr5 */ \
- &rs6000_reg_names[38][0], /* fr6 */ \
- &rs6000_reg_names[39][0], /* fr7 */ \
- &rs6000_reg_names[40][0], /* fr8 */ \
- &rs6000_reg_names[41][0], /* fr9 */ \
- &rs6000_reg_names[42][0], /* fr10 */ \
- &rs6000_reg_names[43][0], /* fr11 */ \
- &rs6000_reg_names[44][0], /* fr12 */ \
- &rs6000_reg_names[45][0], /* fr13 */ \
- &rs6000_reg_names[46][0], /* fr14 */ \
- &rs6000_reg_names[47][0], /* fr15 */ \
- &rs6000_reg_names[48][0], /* fr16 */ \
- &rs6000_reg_names[49][0], /* fr17 */ \
- &rs6000_reg_names[50][0], /* fr18 */ \
- &rs6000_reg_names[51][0], /* fr19 */ \
- &rs6000_reg_names[52][0], /* fr20 */ \
- &rs6000_reg_names[53][0], /* fr21 */ \
- &rs6000_reg_names[54][0], /* fr22 */ \
- &rs6000_reg_names[55][0], /* fr23 */ \
- &rs6000_reg_names[56][0], /* fr24 */ \
- &rs6000_reg_names[57][0], /* fr25 */ \
- &rs6000_reg_names[58][0], /* fr26 */ \
- &rs6000_reg_names[59][0], /* fr27 */ \
- &rs6000_reg_names[60][0], /* fr28 */ \
- &rs6000_reg_names[61][0], /* fr29 */ \
- &rs6000_reg_names[62][0], /* fr30 */ \
- &rs6000_reg_names[63][0], /* fr31 */ \
- \
- &rs6000_reg_names[64][0], /* mq */ \
- &rs6000_reg_names[65][0], /* lr */ \
- &rs6000_reg_names[66][0], /* ctr */ \
- &rs6000_reg_names[67][0], /* ap */ \
- \
- &rs6000_reg_names[68][0], /* cr0 */ \
- &rs6000_reg_names[69][0], /* cr1 */ \
- &rs6000_reg_names[70][0], /* cr2 */ \
- &rs6000_reg_names[71][0], /* cr3 */ \
- &rs6000_reg_names[72][0], /* cr4 */ \
- &rs6000_reg_names[73][0], /* cr5 */ \
- &rs6000_reg_names[74][0], /* cr6 */ \
- &rs6000_reg_names[75][0], /* cr7 */ \
- \
- &rs6000_reg_names[76][0], /* fpmem */ \
-}
-
-/* print-rtl can't handle the above REGISTER_NAMES, so define the
- following for it. Switch to use the alternate names since
- they are more mnemonic. */
-
-#define DEBUG_REGISTER_NAMES \
-{ \
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
- "mq", "lr", "ctr", "ap", \
- "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
- "fpmem" \
-}
-
-/* Table of additional register names to use in user input. */
-
-#define ADDITIONAL_REGISTER_NAMES \
- {"r0", 0, "r1", 1, "r2", 2, "r3", 3, \
- "r4", 4, "r5", 5, "r6", 6, "r7", 7, \
- "r8", 8, "r9", 9, "r10", 10, "r11", 11, \
- "r12", 12, "r13", 13, "r14", 14, "r15", 15, \
- "r16", 16, "r17", 17, "r18", 18, "r19", 19, \
- "r20", 20, "r21", 21, "r22", 22, "r23", 23, \
- "r24", 24, "r25", 25, "r26", 26, "r27", 27, \
- "r28", 28, "r29", 29, "r30", 30, "r31", 31, \
- "fr0", 32, "fr1", 33, "fr2", 34, "fr3", 35, \
- "fr4", 36, "fr5", 37, "fr6", 38, "fr7", 39, \
- "fr8", 40, "fr9", 41, "fr10", 42, "fr11", 43, \
- "fr12", 44, "fr13", 45, "fr14", 46, "fr15", 47, \
- "fr16", 48, "fr17", 49, "fr18", 50, "fr19", 51, \
- "fr20", 52, "fr21", 53, "fr22", 54, "fr23", 55, \
- "fr24", 56, "fr25", 57, "fr26", 58, "fr27", 59, \
- "fr28", 60, "fr29", 61, "fr30", 62, "fr31", 63, \
- /* no additional names for: mq, lr, ctr, ap */ \
- "cr0", 68, "cr1", 69, "cr2", 70, "cr3", 71, \
- "cr4", 72, "cr5", 73, "cr6", 74, "cr7", 75, \
- "cc", 68, "sp", 1, "toc", 2 }
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Text to write out after a CALL that may be replaced by glue code by
- the loader. This depends on the AIX version. */
-#define RS6000_CALL_GLUE "cror 31,31,31"
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs ("\t.globl ", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* This is how to output a reference to a user-level label named NAME.
- `assemble_name' uses this. */
-
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- fputs (NAME, FILE)
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s..%d:\n", PREFIX, NUM)
-
-/* This is how to output an internal label prefix. rs6000.c uses this
- when generating traceback tables. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
- fprintf (FILE, "%s..", PREFIX)
-
-/* This is how to output a label for a jump table. Arguments are the same as
- for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
- passed. */
-
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
-{ ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s..%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
- fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", \
- t[0] & 0xffffffff, t[1] & 0xffffffff); \
- } \
- else \
- { \
- char str[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
- fprintf (FILE, "\t.double 0d%s\n", str); \
- } \
- }
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
- fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
- } \
- else \
- { \
- char str[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
- fprintf (FILE, "\t.float 0d%s\n", str); \
- } \
- }
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
-do { \
- if (TARGET_32BIT) \
- { \
- assemble_integer (operand_subword ((VALUE), 0, 0, DImode), \
- UNITS_PER_WORD, 1); \
- assemble_integer (operand_subword ((VALUE), 1, 0, DImode), \
- UNITS_PER_WORD, 1); \
- } \
- else \
- { \
- fputs ("\t.llong ", FILE); \
- output_addr_const (FILE, (VALUE)); \
- putc ('\n', FILE); \
- } \
-} while (0)
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fputs ("\t.long ", FILE), \
- output_addr_const (FILE, (VALUE)), \
- putc ('\n', FILE))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fputs ("\t.short ", FILE), \
- output_addr_const (FILE, (VALUE)), \
- putc ('\n', FILE))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fputs ("\t.byte ", FILE), \
- output_addr_const (FILE, (VALUE)), \
- putc ('\n', FILE))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output an assembler line to define N characters starting
- at P to FILE. */
-
-#define ASM_OUTPUT_ASCII(FILE, P, N) output_ascii ((FILE), (P), (N))
-
-/* This is how to output code to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
-do { \
- extern char *reg_names[]; \
- asm_fprintf (FILE, "\{tstu|stwu} %s,-4(%s)\n", reg_names[REGNO], \
- reg_names[1]); \
-} while (0)
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
-do { \
- extern char *reg_names[]; \
- asm_fprintf (FILE, "\t{l|lwz} %s,0(%s)\n\t{ai|addic} %s,%s,4\n", \
- reg_names[REGNO], reg_names[1], reg_names[1], \
- reg_names[1]); \
-} while (0)
-
-/* This is how to output an element of a case-vector that is absolute.
- (RS/6000 does not use such vectors, but we must define this macro
- anyway.) */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- do { char buf[100]; \
- fputs ((TARGET_32BIT) ? "\t.long " : "\t.llong ", FILE); \
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
- assemble_name (FILE, buf); \
- putc ('\n', FILE); \
- } while (0)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- do { char buf[100]; \
- fputs ((TARGET_32BIT) ? "\t.long " : "\t.llong ", FILE); \
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
- assemble_name (FILE, buf); \
- putc ('-', FILE); \
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", REL); \
- assemble_name (FILE, buf); \
- putc ('\n', FILE); \
- } while (0)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", (LOG))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT) \
- do { fputs (".comm ", (FILE)); \
- RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
- if ( (SIZE) > 4) \
- fprintf ((FILE), ",%d,3\n", (SIZE)); \
- else \
- fprintf( (FILE), ",%d\n", (SIZE)); \
- } while (0)
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
- do { fputs (".lcomm ", (FILE)); \
- RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
- fprintf ((FILE), ",%d,%s\n", (SIZE), xcoff_bss_section_name); \
- } while (0)
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-/* Define which CODE values are valid. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '.' || (CODE) == '*' || (CODE) == '$')
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-
-/* Define the codes that are matched by predicates in rs6000.c. */
-
-#define PREDICATE_CODES \
- {"short_cint_operand", {CONST_INT}}, \
- {"u_short_cint_operand", {CONST_INT}}, \
- {"non_short_cint_operand", {CONST_INT}}, \
- {"gpc_reg_operand", {SUBREG, REG}}, \
- {"cc_reg_operand", {SUBREG, REG}}, \
- {"reg_or_short_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_neg_short_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_u_short_operand", {SUBREG, REG, CONST_INT}}, \
- {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \
- {"got_operand", {SYMBOL_REF, CONST, LABEL_REF}}, \
- {"easy_fp_constant", {CONST_DOUBLE}}, \
- {"reg_or_mem_operand", {SUBREG, MEM, REG}}, \
- {"lwa_operand", {SUBREG, MEM, REG}}, \
- {"volatile_mem_operand", {MEM}}, \
- {"offsettable_addr_operand", {REG, SUBREG, PLUS}}, \
- {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}}, \
- {"add_operand", {SUBREG, REG, CONST_INT}}, \
- {"non_add_cint_operand", {CONST_INT}}, \
- {"and_operand", {SUBREG, REG, CONST_INT}}, \
- {"non_and_cint_operand", {CONST_INT}}, \
- {"logical_operand", {SUBREG, REG, CONST_INT}}, \
- {"non_logical_cint_operand", {CONST_INT}}, \
- {"mask_operand", {CONST_INT}}, \
- {"count_register_operand", {REG}}, \
- {"fpmem_operand", {REG}}, \
- {"call_operand", {SYMBOL_REF, REG}}, \
- {"current_file_function_operand", {SYMBOL_REF}}, \
- {"input_operand", {SUBREG, MEM, REG, CONST_INT, SYMBOL_REF}}, \
- {"load_multiple_operation", {PARALLEL}}, \
- {"store_multiple_operation", {PARALLEL}}, \
- {"branch_comparison_operator", {EQ, NE, LE, LT, GE, \
- GT, LEU, LTU, GEU, GTU}}, \
- {"scc_comparison_operator", {EQ, NE, LE, LT, GE, \
- GT, LEU, LTU, GEU, GTU}},
-
-
-/* uncomment for disabling the corresponding default options */
-/* #define MACHINE_no_sched_interblock */
-/* #define MACHINE_no_sched_speculative */
-/* #define MACHINE_no_sched_speculative_load */
-
-/* indicate that issue rate is defined for this machine
- (no need to use the default) */
-#define MACHINE_issue_rate
-
-/* General flags. */
-extern int flag_pic;
-extern int optimize;
-extern int flag_expensive_optimizations;
-extern int frame_pointer_needed;
-
-/* Declare functions in rs6000.c */
-extern void output_options ();
-extern void rs6000_override_options ();
-extern void rs6000_file_start ();
-extern struct rtx_def *rs6000_float_const ();
-extern struct rtx_def *rs6000_immed_double_const ();
-extern struct rtx_def *rs6000_got_register ();
-extern int direct_return ();
-extern int any_operand ();
-extern int short_cint_operand ();
-extern int u_short_cint_operand ();
-extern int non_short_cint_operand ();
-extern int gpc_reg_operand ();
-extern int cc_reg_operand ();
-extern int reg_or_short_operand ();
-extern int reg_or_neg_short_operand ();
-extern int reg_or_u_short_operand ();
-extern int reg_or_cint_operand ();
-extern int got_operand ();
-extern int num_insns_constant ();
-extern int easy_fp_constant ();
-extern int volatile_mem_operand ();
-extern int offsettable_addr_operand ();
-extern int mem_or_easy_const_operand ();
-extern int add_operand ();
-extern int non_add_cint_operand ();
-extern int logical_operand ();
-extern int non_logical_operand ();
-extern int mask_constant ();
-extern int mask_operand ();
-extern int and_operand ();
-extern int count_register_operand ();
-extern int fpmem_operand ();
-extern int non_and_cint_operand ();
-extern int reg_or_mem_operand ();
-extern int lwa_operand ();
-extern int call_operand ();
-extern int current_file_function_operand ();
-extern int input_operand ();
-extern int small_data_operand ();
-extern void init_cumulative_args ();
-extern void function_arg_advance ();
-extern int function_arg_boundary ();
-extern struct rtx_def *function_arg ();
-extern int function_arg_partial_nregs ();
-extern int function_arg_pass_by_reference ();
-extern void setup_incoming_varargs ();
-extern struct rtx_def *expand_builtin_saveregs ();
-extern struct rtx_def *rs6000_stack_temp ();
-extern int expand_block_move ();
-extern int load_multiple_operation ();
-extern int store_multiple_operation ();
-extern int branch_comparison_operator ();
-extern int scc_comparison_operator ();
-extern int includes_lshift_p ();
-extern int includes_rshift_p ();
-extern int registers_ok_for_quad_peep ();
-extern int addrs_ok_for_quad_peep ();
-extern enum reg_class secondary_reload_class ();
-extern int ccr_bit ();
-extern void rs6000_finalize_pic ();
-extern void rs6000_reorg ();
-extern void rs6000_save_machine_status ();
-extern void rs6000_restore_machine_status ();
-extern void rs6000_init_expanders ();
-extern void print_operand ();
-extern void print_operand_address ();
-extern int first_reg_to_save ();
-extern int first_fp_reg_to_save ();
-extern int rs6000_makes_calls ();
-extern rs6000_stack_t *rs6000_stack_info ();
-extern void output_prolog ();
-extern void output_epilog ();
-extern void output_toc ();
-extern void output_ascii ();
-extern void rs6000_gen_section_name ();
-extern void output_function_profiler ();
-extern int rs6000_adjust_cost ();
-extern void rs6000_trampoline_template ();
-extern int rs6000_trampoline_size ();
-extern void rs6000_initialize_trampoline ();
-extern int rs6000_comp_type_attributes ();
-extern int rs6000_valid_decl_attribute_p ();
-extern int rs6000_valid_type_attribute_p ();
-extern void rs6000_set_default_type_attributes ();
-extern struct rtx_def *rs6000_dll_import_ref ();
-extern struct rtx_def *rs6000_longcall_ref ();
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
deleted file mode 100644
index c64c4f1efce..00000000000
--- a/gcc/config/rs6000/rs6000.md
+++ /dev/null
@@ -1,9496 +0,0 @@
-;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
-;; Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
-;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-;; 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.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; Define an insn type attribute. This is used in function unit delay
-;; computations.
-(define_attr "type" "integer,load,store,fpload,fpstore,imul,idiv,branch,compare,delayed_compare,fpcompare,mtjmpr,fp,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg"
- (const_string "integer"))
-
-;; Length (in bytes).
-(define_attr "length" ""
- (if_then_else (eq_attr "type" "branch")
- (if_then_else (and (ge (minus (pc) (match_dup 0))
- (const_int -32768))
- (lt (minus (pc) (match_dup 0))
- (const_int 32767)))
- (const_int 8)
- (const_int 12))
- (const_int 4)))
-
-;; Processor type -- this attribute must exactly match the processor_type
-;; enumeration in rs6000.h.
-
-(define_attr "cpu" "rios1,rios2,mpccore,ppc403,ppc601,ppc603,ppc604,ppc620"
- (const (symbol_ref "rs6000_cpu_attr")))
-
-; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
-; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
-
-; Load/Store Unit -- pure PowerPC only
-; (POWER and 601 use Integer Unit)
-(define_function_unit "lsu" 1 0
- (and (eq_attr "type" "load")
- (eq_attr "cpu" "mpccore,ppc603,ppc604,ppc620"))
- 2 1)
-
-(define_function_unit "lsu" 1 0
- (and (eq_attr "type" "store,fpstore")
- (eq_attr "cpu" "mpccore,ppc603,ppc604,ppc620"))
- 1 1)
-
-(define_function_unit "lsu" 1 0
- (and (eq_attr "type" "fpload")
- (eq_attr "cpu" "mpccore,ppc603"))
- 2 1)
-
-(define_function_unit "lsu" 1 0
- (and (eq_attr "type" "fpload")
- (eq_attr "cpu" "ppc604,ppc620"))
- 3 1)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "load")
- (eq_attr "cpu" "rios1,ppc403,ppc601"))
- 2 1)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "store,fpstore")
- (eq_attr "cpu" "rios1,ppc403,ppc601"))
- 1 1)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "fpstore")
- (eq_attr "cpu" "rios1,ppc601"))
- 0 1)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "fpload")
- (eq_attr "cpu" "rios1"))
- 2 1)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "fpload")
- (eq_attr "cpu" "ppc601"))
- 3 1)
-
-(define_function_unit "iu2" 2 0
- (and (eq_attr "type" "load,fpload")
- (eq_attr "cpu" "rios2"))
- 2 1)
-
-(define_function_unit "iu2" 2 0
- (and (eq_attr "type" "store,fpstore")
- (eq_attr "cpu" "rios2"))
- 1 1)
-
-; Integer Unit (RIOS1, PPC601, PPC603)
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "integer")
- (eq_attr "cpu" "rios1,mpccore,ppc403,ppc601,ppc603"))
- 1 1)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "imul")
- (eq_attr "cpu" "ppc403"))
- 4 4)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "imul")
- (eq_attr "cpu" "rios1,ppc601,ppc603"))
- 5 5)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "idiv")
- (eq_attr "cpu" "rios1"))
- 19 19)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "idiv")
- (eq_attr "cpu" "ppc403"))
- 33 33)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "idiv")
- (eq_attr "cpu" "ppc601"))
- 36 36)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "idiv")
- (eq_attr "cpu" "ppc603"))
- 37 36)
-
-; RIOS2 has two integer units: a primary one which can perform all
-; operations and a secondary one which is fed in lock step with the first
-; and can perform "simple" integer operations.
-; To catch this we define a 'dummy' imuldiv-unit that is also needed
-; for the complex insns.
-(define_function_unit "iu2" 2 0
- (and (eq_attr "type" "integer")
- (eq_attr "cpu" "rios2"))
- 1 1)
-
-(define_function_unit "iu2" 2 0
- (and (eq_attr "type" "imul")
- (eq_attr "cpu" "rios2"))
- 2 2)
-
-(define_function_unit "iu2" 2 0
- (and (eq_attr "type" "idiv")
- (eq_attr "cpu" "rios2"))
- 13 13)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul")
- (eq_attr "cpu" "rios2"))
- 2 2)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (eq_attr "cpu" "rios2"))
- 13 13)
-
-; MPCCORE has separate IMUL/IDIV unit for multicycle instructions
-; Divide latency varies greatly from 2-11, use 6 as average
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul")
- (eq_attr "cpu" "mpccore"))
- 2 1)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (eq_attr "cpu" "mpccore"))
- 6 6)
-
-; PPC604 has two units that perform integer operations
-; and one unit for divide/multiply operations (and move
-; from/to spr).
-(define_function_unit "iu2" 2 0
- (and (eq_attr "type" "integer")
- (eq_attr "cpu" "ppc604,ppc620"))
- 1 1)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "imul")
- (eq_attr "cpu" "ppc604,ppc620"))
- 4 2)
-
-(define_function_unit "imuldiv" 1 0
- (and (eq_attr "type" "idiv")
- (eq_attr "cpu" "ppc604,ppc620"))
- 20 19)
-
-; compare is done on integer unit, but feeds insns which
-; execute on the branch unit.
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "compare")
- (eq_attr "cpu" "rios1"))
- 4 1)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "delayed_compare")
- (eq_attr "cpu" "rios1"))
- 5 1)
-
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "compare,delayed_compare")
- (eq_attr "cpu" "mpccore,ppc403,ppc601,ppc603,ppc604,ppc620"))
- 3 1)
-
-(define_function_unit "iu2" 2 0
- (and (eq_attr "type" "compare,delayed_compare")
- (eq_attr "cpu" "rios2"))
- 3 1)
-
-(define_function_unit "iu2" 2 0
- (and (eq_attr "type" "compare,delayed_compare")
- (eq_attr "cpu" "ppc604,ppc620"))
- 1 1)
-
-; fp compare uses fp unit
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "fpcompare")
- (eq_attr "cpu" "rios1"))
- 9 1)
-
-; rios1 and rios2 have different fpcompare delays
-(define_function_unit "fpu2" 2 0
- (and (eq_attr "type" "fpcompare")
- (eq_attr "cpu" "rios2"))
- 5 1)
-
-; on ppc601 and ppc603, fpcompare takes also 2 cycles from
-; the integer unit
-; here we do not define delays, just occupy the unit. The dependencies
-; will be assigned by the fpcompare definition in the fpu.
-(define_function_unit "iu" 1 0
- (and (eq_attr "type" "fpcompare")
- (eq_attr "cpu" "ppc601,ppc603"))
- 0 2)
-
-; fp compare uses fp unit
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "fpcompare")
- (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
- 5 1)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "fpcompare")
- (eq_attr "cpu" "mpccore"))
- 1 1)
-
-(define_function_unit "bpu" 1 0
- (and (eq_attr "type" "mtjmpr")
- (eq_attr "cpu" "rios1,rios2"))
- 5 1)
-
-(define_function_unit "bpu" 1 0
- (and (eq_attr "type" "mtjmpr")
- (eq_attr "cpu" "mpccore,ppc403,ppc601,ppc603,ppc604,ppc620"))
- 4 1)
-
-; all jumps/branches are executing on the bpu, in 1 cycle, for all machines.
-(define_function_unit "bpu" 1 0
- (eq_attr "type" "jmpreg")
- 1 1)
-
-(define_function_unit "bpu" 1 0
- (eq_attr "type" "branch")
- 1 1)
-
-; Floating Point Unit
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "fp,dmul")
- (eq_attr "cpu" "rios1"))
- 2 1)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "fp")
- (eq_attr "cpu" "mpccore"))
- 4 4)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "fp")
- (eq_attr "cpu" "ppc601"))
- 4 1)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "fp")
- (eq_attr "cpu" "ppc603,ppc604,ppc620"))
- 3 1)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "dmul")
- (eq_attr "cpu" "mpccore"))
- 5 5)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "dmul")
- (eq_attr "cpu" "ppc601"))
- 5 2)
-
-; is this true?
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "dmul")
- (eq_attr "cpu" "ppc603"))
- 4 2)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "dmul")
- (eq_attr "cpu" "ppc604,ppc620"))
- 3 1)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "sdiv,ddiv")
- (eq_attr "cpu" "rios1"))
- 19 19)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "sdiv")
- (eq_attr "cpu" "ppc601"))
- 17 17)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "sdiv")
- (eq_attr "cpu" "mpccore"))
- 10 10)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "sdiv")
- (eq_attr "cpu" "ppc603,ppc604,ppc620"))
- 18 18)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "ddiv")
- (eq_attr "cpu" "mpccore"))
- 17 17)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "ddiv")
- (eq_attr "cpu" "ppc601,ppc604,ppc620"))
- 31 31)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "ddiv")
- (eq_attr "cpu" "ppc603"))
- 33 33)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "ssqrt")
- (eq_attr "cpu" "ppc620"))
- 31 31)
-
-(define_function_unit "fpu" 1 0
- (and (eq_attr "type" "dsqrt")
- (eq_attr "cpu" "ppc620"))
- 31 31)
-
-; RIOS2 has two symmetric FPUs.
-(define_function_unit "fpu2" 2 0
- (and (eq_attr "type" "fp")
- (eq_attr "cpu" "rios2"))
- 2 1)
-
-(define_function_unit "fpu2" 2 0
- (and (eq_attr "type" "dmul")
- (eq_attr "cpu" "rios2"))
- 2 1)
-
-(define_function_unit "fpu2" 2 0
- (and (eq_attr "type" "sdiv,ddiv")
- (eq_attr "cpu" "rios2"))
- 17 17)
-
-(define_function_unit "fpu2" 2 0
- (and (eq_attr "type" "ssqrt,dsqrt")
- (eq_attr "cpu" "rios2"))
- 26 26)
-
-
-;; Start with fixed-point load and store insns. Here we put only the more
-;; complex forms. Basic data transfer is done later.
-
-(define_expand "zero_extendqidi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
- "TARGET_POWERPC64"
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
- (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
- "TARGET_POWERPC64"
- "@
- lbz%U1%X1 %0,%1
- rldicl %0,%1,0,56"
- [(set_attr "type" "load,*")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 2 "=r"))]
- "TARGET_POWERPC64"
- "rldicl. %2,%1,0,56"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (zero_extend:DI (match_dup 1)))]
- "TARGET_POWERPC64"
- "rldicl. %0,%1,0,56"
- [(set_attr "type" "compare")])
-
-(define_insn "extendqidi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC64"
- "extsb %0,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 2 "=r"))]
- "TARGET_POWERPC64"
- "extsb. %2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (sign_extend:DI (match_dup 1)))]
- "TARGET_POWERPC64"
- "extsb. %0,%1"
- [(set_attr "type" "compare")])
-
-(define_expand "zero_extendhidi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
- "TARGET_POWERPC64"
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
- (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
- "TARGET_POWERPC64"
- "@
- lhz%U1%X1 %0,%1
- rldicl %0,%1,0,48"
- [(set_attr "type" "load,*")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 2 "=r"))]
- "TARGET_POWERPC64"
- "rldicl. %2,%1,0,48"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (zero_extend:DI (match_dup 1)))]
- "TARGET_POWERPC64"
- "rldicl. %0,%1,0,48"
- [(set_attr "type" "compare")])
-
-(define_expand "extendhidi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
- "TARGET_POWERPC64"
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
- (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
- "TARGET_POWERPC64"
- "@
- lha%U1%X1 %0,%1
- extsh %0,%1"
- [(set_attr "type" "load,*")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 2 "=r"))]
- "TARGET_POWERPC64"
- "extsh. %2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (sign_extend:DI (match_dup 1)))]
- "TARGET_POWERPC64"
- "extsh. %0,%1"
- [(set_attr "type" "compare")])
-
-(define_expand "zero_extendsidi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
- "TARGET_POWERPC64"
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
- (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
- "TARGET_POWERPC64"
- "@
- lwz%U1%X1 %0,%1
- rldicl %0,%1,0,32"
- [(set_attr "type" "load,*")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 2 "=r"))]
- "TARGET_POWERPC64"
- "rldicl. %2,%1,0,32"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (zero_extend:DI (match_dup 1)))]
- "TARGET_POWERPC64"
- "rldicl. %0,%1,0,32"
- [(set_attr "type" "compare")])
-
-(define_expand "extendsidi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
- "TARGET_POWERPC64"
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
- (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
- "TARGET_POWERPC64"
- "@
- lwa%U1%X1 %0,%1
- extsw %0,%1"
- [(set_attr "type" "load,*")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 2 "=r"))]
- "TARGET_POWERPC64"
- "extsw. %2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (sign_extend:DI (match_dup 1)))]
- "TARGET_POWERPC64"
- "extsw. %0,%1"
- [(set_attr "type" "compare")])
-
-(define_expand "zero_extendqisi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
- ""
- "@
- lbz%U1%X1 %0,%1
- {rlinm|rlwinm} %0,%1,0,0xff"
- [(set_attr "type" "load,*")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 2 "=r"))]
- ""
- "{andil.|andi.} %2,%1,0xff"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (match_dup 1)))]
- ""
- "{andil.|andi.} %0,%1,0xff"
- [(set_attr "type" "compare")])
-
-(define_expand "extendqisi2"
- [(use (match_operand:SI 0 "gpc_reg_operand" ""))
- (use (match_operand:QI 1 "gpc_reg_operand" ""))]
- ""
- "
-{
- if (TARGET_POWERPC)
- emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
- else if (TARGET_POWER)
- emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
- else
- emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
- DONE;
-}")
-
-(define_insn "extendqisi2_ppc"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC"
- "extsb %0,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 2 "=r"))]
- "TARGET_POWERPC"
- "extsb. %2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (sign_extend:SI (match_dup 1)))]
- "TARGET_POWERPC"
- "extsb. %0,%1"
- [(set_attr "type" "compare")])
-
-(define_expand "extendqisi2_power"
- [(parallel [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
- (const_int 24)))
- (clobber (scratch:SI))])
- (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))
- (clobber (scratch:SI))])]
- "TARGET_POWER"
- "
-{ operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode); }")
-
-(define_expand "extendqisi2_no_power"
- [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
- (const_int 24)))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))]
- "! TARGET_POWER && ! TARGET_POWERPC"
- "
-{ operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode); }")
-
-(define_expand "zero_extendqihi2"
- [(set (match_operand:HI 0 "gpc_reg_operand" "")
- (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
- (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
- ""
- "@
- lbz%U1%X1 %0,%1
- {rlinm|rlwinm} %0,%1,0,0xff"
- [(set_attr "type" "load,*")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:HI 2 "=r"))]
- ""
- "{andil.|andi.} %2,%1,0xff"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:HI 0 "gpc_reg_operand" "=r")
- (zero_extend:HI (match_dup 1)))]
- ""
- "{andil.|andi.} %0,%1,0xff"
- [(set_attr "type" "compare")])
-
-(define_expand "extendqihi2"
- [(use (match_operand:HI 0 "gpc_reg_operand" ""))
- (use (match_operand:QI 1 "gpc_reg_operand" ""))]
- ""
- "
-{
- if (TARGET_POWERPC)
- emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
- else if (TARGET_POWER)
- emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
- else
- emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
- DONE;
-}")
-
-(define_insn "extendqihi2_ppc"
- [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
- (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC"
- "extsb %0,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:HI 2 "=r"))]
- "TARGET_POWERPC"
- "extsb. %2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:HI 0 "gpc_reg_operand" "=r")
- (sign_extend:HI (match_dup 1)))]
- "TARGET_POWERPC"
- "extsb. %0,%1"
- [(set_attr "type" "compare")])
-
-(define_expand "extendqihi2_power"
- [(parallel [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
- (const_int 24)))
- (clobber (scratch:SI))])
- (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))
- (clobber (scratch:SI))])]
- "TARGET_POWER"
- "
-{ operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode); }")
-
-(define_expand "extendqihi2_no_power"
- [(set (match_dup 2)
- (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
- (const_int 24)))
- (set (match_operand:HI 0 "gpc_reg_operand" "")
- (ashiftrt:SI (match_dup 2)
- (const_int 24)))]
- "! TARGET_POWER && ! TARGET_POWERPC"
- "
-{ operands[0] = gen_lowpart (SImode, operands[0]);
- operands[1] = gen_lowpart (SImode, operands[1]);
- operands[2] = gen_reg_rtx (SImode); }")
-
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
- ""
- "@
- lhz%U1%X1 %0,%1
- {rlinm|rlwinm} %0,%1,0,0xffff"
- [(set_attr "type" "load,*")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 2 "=r"))]
- ""
- "{andil.|andi.} %2,%1,0xffff"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (match_dup 1)))]
- ""
- "{andil.|andi.} %0,%1,0xffff"
- [(set_attr "type" "compare")])
-
-(define_expand "extendhisi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
- ""
- "@
- lha%U1%X1 %0,%1
- {exts|extsh} %0,%1"
- [(set_attr "type" "load,*")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 2 "=r"))]
- ""
- "{exts.|extsh.} %2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (sign_extend:SI (match_dup 1)))]
- ""
- "{exts.|extsh.} %0,%1"
- [(set_attr "type" "compare")])
-
-;; Fixed-point arithmetic insns.
-
-;; Discourage ai/addic because of carry but provide it in an alternative
-;; allowing register zero as source.
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
- (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
- (match_operand:SI 2 "add_operand" "r,I,I,J")))]
- ""
- "@
- {cax|add} %0,%1,%2
- {cal %0,%2(%1)|addi %0,%1,%2}
- {ai|addic} %0,%1,%2
- {cau|addis} %0,%1,%v2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,I"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r,r"))]
- ""
- "@
- {cax.|add.} %3,%1,%2
- {ai.|addic.} %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
- (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,I"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- {cax.|add.} %0,%1,%2
- {ai.|addic.} %0,%1,%2"
- [(set_attr "type" "compare")])
-
-;; Split an add that we can't do in one insn into two insns, each of which
-;; does one 16-bit part. This is used by combine. Note that the low-order
-;; add should be last in case the result gets used in an address.
-
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "non_add_cint_operand" "")))]
- ""
- [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
-"
-{
- HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
- HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
-
- if (low & 0x8000)
- high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
-
- operands[3] = GEN_INT (high);
- operands[4] = GEN_INT (low);
-}")
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
- ""
- "nor %0,%1,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 2 "=r"))]
- ""
- "nor. %2,%1,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (not:SI (match_dup 1)))]
- ""
- "nor. %0,%1,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
- (match_operand:SI 2 "gpc_reg_operand" "r")))]
- "! TARGET_POWERPC"
- "{sf%I1|subf%I1c} %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
- (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
- "TARGET_POWERPC"
- "@
- subf %0,%2,%1
- subfic %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- "! TARGET_POWERPC"
- "{sf.|subfc.} %3,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- "TARGET_POWERPC"
- "subf. %3,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- "! TARGET_POWERPC"
- "{sf.|subfc.} %0,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC"
- "subf. %0,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
- (match_operand:SI 2 "reg_or_cint_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- emit_insn (gen_addsi3 (operands[0], operands[1],
- negate_rtx (SImode, operands[2])));
- DONE;
- }
-}")
-
-;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
-;; instruction and some auxiliary computations. Then we just have a single
-;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
-;; combine.
-
-(define_expand "sminsi3"
- [(set (match_dup 3)
- (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_short_operand" ""))
- (const_int 0)
- (minus:SI (match_dup 2) (match_dup 1))))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (minus:SI (match_dup 2) (match_dup 3)))]
- "TARGET_POWER"
- "
-{ operands[3] = gen_reg_rtx (SImode); }")
-
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_short_operand" "")))
- (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
- "TARGET_POWER"
- [(set (match_dup 3)
- (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
- (const_int 0)
- (minus:SI (match_dup 2) (match_dup 1))))
- (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
- "")
-
-(define_expand "smaxsi3"
- [(set (match_dup 3)
- (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_short_operand" ""))
- (const_int 0)
- (minus:SI (match_dup 2) (match_dup 1))))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (plus:SI (match_dup 3) (match_dup 1)))]
- "TARGET_POWER"
- "
-{ operands[3] = gen_reg_rtx (SImode); }")
-
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_short_operand" "")))
- (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
- "TARGET_POWER"
- [(set (match_dup 3)
- (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
- (const_int 0)
- (minus:SI (match_dup 2) (match_dup 1))))
- (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
- "")
-
-(define_expand "uminsi3"
- [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_dup 5)))
- (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
- (match_dup 5)))
- (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
- (const_int 0)
- (minus:SI (match_dup 4) (match_dup 3))))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (minus:SI (match_dup 2) (match_dup 3)))]
- "TARGET_POWER"
- "
-{
- operands[3] = gen_reg_rtx (SImode);
- operands[4] = gen_reg_rtx (SImode);
- operands[5] = GEN_INT (-2147483647 - 1);
-}")
-
-(define_expand "umaxsi3"
- [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_dup 5)))
- (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
- (match_dup 5)))
- (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
- (const_int 0)
- (minus:SI (match_dup 4) (match_dup 3))))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (plus:SI (match_dup 3) (match_dup 1)))]
- "TARGET_POWER"
- "
-{
- operands[3] = gen_reg_rtx (SImode);
- operands[4] = gen_reg_rtx (SImode);
- operands[5] = GEN_INT (-2147483647 - 1);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (const_int 0)
- (minus:SI (match_dup 2) (match_dup 1))))]
- "TARGET_POWER"
- "doz%I2 %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (const_int 0)
- (minus:SI (match_dup 2) (match_dup 1)))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- "TARGET_POWER"
- "doz%I2. %3,%1,%2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC
- (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (const_int 0)
- (minus:SI (match_dup 2) (match_dup 1)))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (if_then_else:SI (gt (match_dup 1) (match_dup 2))
- (const_int 0)
- (minus:SI (match_dup 2) (match_dup 1))))]
- "TARGET_POWER"
- "doz%I2. %0,%1,%2"
- [(set_attr "type" "delayed_compare")])
-
-;; We don't need abs with condition code because such comparisons should
-;; never be done.
-(define_expand "abssi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
- ""
- "
-{
- if (!TARGET_POWER)
- {
- emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
- DONE;
- }
-}")
-
-(define_insn "abssi2_power"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
- "TARGET_POWER"
- "abs %0,%1")
-
-(define_insn "abssi2_nopower"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
- (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
- (clobber (match_scratch:SI 2 "=&r,&r"))]
- "!TARGET_POWER"
- "*
-{
- return (TARGET_POWERPC)
- ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0\"
- : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%2,%0\";
-}"
- [(set_attr "length" "12")])
-
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
- (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
- (clobber (match_scratch:SI 2 "=&r,&r"))]
- "!TARGET_POWER && reload_completed"
- [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
- (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
- (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
- "TARGET_POWER"
- "nabs %0,%1")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
- (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
- (clobber (match_scratch:SI 2 "=&r,&r"))]
- "!TARGET_POWER"
- "*
-{
- return (TARGET_POWERPC)
- ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2\"
- : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%0,%2\";
-}"
- [(set_attr "length" "12")])
-
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
- (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
- (clobber (match_scratch:SI 2 "=&r,&r"))]
- "!TARGET_POWER && reload_completed"
- [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
- (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
- (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
- "")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
- ""
- "neg %0,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 2 "=r"))]
- ""
- "neg. %2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (match_dup 1)))]
- ""
- "neg. %0,%1"
- [(set_attr "type" "compare")])
-
-(define_insn "ffssi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
- (ffs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
- ""
- "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
- [(set_attr "length" "16")])
-
-(define_expand "mulsi3"
- [(use (match_operand:SI 0 "gpc_reg_operand" ""))
- (use (match_operand:SI 1 "gpc_reg_operand" ""))
- (use (match_operand:SI 2 "reg_or_short_operand" ""))]
- ""
- "
-{
- if (TARGET_POWER)
- emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_insn "mulsi3_mq"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))
- (clobber (match_scratch:SI 3 "=q,q"))]
- "TARGET_POWER"
- "@
- {muls|mullw} %0,%1,%2
- {muli|mulli} %0,%1,%2"
- [(set_attr "type" "imul")])
-
-(define_insn "mulsi3_no_mq"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
- "! TARGET_POWER"
- "@
- {muls|mullw} %0,%1,%2
- {muli|mulli} %0,%1,%2"
- [(set_attr "type" "imul")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))
- (clobber (match_scratch:SI 4 "=q"))]
- "TARGET_POWER"
- "{muls.|mullw.} %3,%1,%2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- "! TARGET_POWER"
- "{muls.|mullw.} %3,%1,%2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (mult:SI (match_dup 1) (match_dup 2)))
- (clobber (match_scratch:SI 4 "=q"))]
- "TARGET_POWER"
- "{muls.|mullw.} %0,%1,%2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (mult:SI (match_dup 1) (match_dup 2)))]
- "! TARGET_POWER"
- "{muls.|mullw.} %0,%1,%2"
- [(set_attr "type" "delayed_compare")])
-
-;; Operand 1 is divided by operand 2; quotient goes to operand
-;; 0 and remainder to operand 3.
-;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
-
-(define_expand "divmodsi4"
- [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "gpc_reg_operand" "")))
- (set (match_operand:SI 3 "gpc_reg_operand" "")
- (mod:SI (match_dup 1) (match_dup 2)))])]
- "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
- "
-{
- if (! TARGET_POWER && ! TARGET_POWERPC)
- {
- emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
- emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
- emit_insn (gen_divss_call ());
- emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
- emit_move_insn (operands[3], gen_rtx (REG, SImode, 4));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (set (match_operand:SI 3 "gpc_reg_operand" "=q")
- (mod:SI (match_dup 1) (match_dup 2)))]
- "TARGET_POWER"
- "divs %0,%1,%2"
- [(set_attr "type" "idiv")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC"
- "divw %0,%1,%2"
- [(set_attr "type" "idiv")])
-
-(define_expand "udivsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "gpc_reg_operand" "")))]
- "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
- "
-{
- if (! TARGET_POWER && ! TARGET_POWERPC)
- {
- emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
- emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
- emit_insn (gen_quous_call ());
- emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC"
- "divwu %0,%1,%2"
- [(set_attr "type" "idiv")])
-
-;; For powers of two we can do srai/aze for divide and then adjust for
-;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
-;; used; for PowerPC, force operands into register and do a normal divide;
-;; for AIX common-mode, use quoss call on register operands.
-(define_expand "divsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_cint_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && exact_log2 (INTVAL (operands[2])) >= 0)
- ;
- else if (TARGET_POWERPC)
- operands[2] = force_reg (SImode, operands[2]);
- else if (TARGET_POWER)
- FAIL;
- else
- {
- emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
- emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
- emit_insn (gen_quoss_call ());
- emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
- DONE;
- }
-}")
-
-(define_expand "modsi3"
- [(use (match_operand:SI 0 "gpc_reg_operand" ""))
- (use (match_operand:SI 1 "gpc_reg_operand" ""))
- (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
- ""
- "
-{
- int i = exact_log2 (INTVAL (operands[2]));
- rtx temp1;
- rtx temp2;
-
- if (GET_CODE (operands[2]) != CONST_INT || i < 0)
- FAIL;
-
- temp1 = gen_reg_rtx (SImode);
- temp2 = gen_reg_rtx (SImode);
-
- emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
- emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
- emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "N")))]
- "exact_log2 (INTVAL (operands[2])) >= 0"
- "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "N"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- "exact_log2 (INTVAL (operands[2])) >= 0"
- "{srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "N"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (div:SI (match_dup 1) (match_dup 2)))]
- "exact_log2 (INTVAL (operands[2])) >= 0"
- "{srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (udiv:SI
- (plus:DI (ashift:DI
- (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 32))
- (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
- (match_operand:SI 3 "gpc_reg_operand" "r")))
- (set (match_operand:SI 2 "register_operand" "=*q")
- (umod:SI
- (plus:DI (ashift:DI
- (zero_extend:DI (match_dup 1)) (const_int 32))
- (zero_extend:DI (match_dup 4)))
- (match_dup 3)))]
- "TARGET_POWER"
- "div %0,%1,%3"
- [(set_attr "type" "idiv")])
-
-;; To do unsigned divide we handle the cases of the divisor looking like a
-;; negative number. If it is a constant that is less than 2**31, we don't
-;; have to worry about the branches. So make a few subroutines here.
-;;
-;; First comes the normal case.
-(define_expand "udivmodsi4_normal"
- [(set (match_dup 4) (const_int 0))
- (parallel [(set (match_operand:SI 0 "" "")
- (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
- (const_int 32))
- (zero_extend:DI (match_operand:SI 1 "" "")))
- (match_operand:SI 2 "" "")))
- (set (match_operand:SI 3 "" "")
- (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
- (const_int 32))
- (zero_extend:DI (match_dup 1)))
- (match_dup 2)))])]
- "TARGET_POWER"
- "
-{ operands[4] = gen_reg_rtx (SImode); }")
-
-;; This handles the branches.
-(define_expand "udivmodsi4_tests"
- [(set (match_operand:SI 0 "" "") (const_int 0))
- (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
- (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
- (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
- (label_ref (match_operand:SI 4 "" "")) (pc)))
- (set (match_dup 0) (const_int 1))
- (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
- (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
- (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
- (label_ref (match_dup 4)) (pc)))]
- "TARGET_POWER"
- "
-{ operands[5] = gen_reg_rtx (CCUNSmode);
- operands[6] = gen_reg_rtx (CCmode);
-}")
-
-(define_expand "udivmodsi4"
- [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_cint_operand" "")))
- (set (match_operand:SI 3 "gpc_reg_operand" "")
- (umod:SI (match_dup 1) (match_dup 2)))])]
- ""
- "
-{
- rtx label = 0;
-
- if (! TARGET_POWER)
- if (! TARGET_POWERPC)
- {
- emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
- emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
- emit_insn (gen_divus_call ());
- emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
- emit_move_insn (operands[3], gen_rtx (REG, SImode, 4));
- DONE;
- }
- else
- FAIL;
-
- if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
- {
- operands[2] = force_reg (SImode, operands[2]);
- label = gen_label_rtx ();
- emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
- operands[3], label));
- }
- else
- operands[2] = force_reg (SImode, operands[2]);
-
- emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
- operands[3]));
- if (label)
- emit_label (label);
-
- DONE;
-}")
-
-;; AIX architecture-independent common-mode multiply (DImode),
-;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
-;; R4; results in R3 and sometimes R4; link register always clobbered by bla
-;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
-;; assumed unused if generating common-mode, so ignore.
-(define_insn "mulh_call"
- [(set (reg:SI 3)
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
- (sign_extend:DI (reg:SI 4)))
- (const_int 32))))
- (clobber (match_scratch:SI 0 "=l"))]
- "! TARGET_POWER && ! TARGET_POWERPC"
- "bla __mulh"
- [(set_attr "type" "imul")])
-
-(define_insn "mull_call"
- [(set (reg:DI 3)
- (mult:DI (sign_extend:DI (reg:SI 3))
- (sign_extend:DI (reg:SI 4))))
- (clobber (match_scratch:SI 0 "=l"))
- (clobber (reg:SI 0))]
- "! TARGET_POWER && ! TARGET_POWERPC"
- "bla __mull"
- [(set_attr "type" "imul")])
-
-(define_insn "divss_call"
- [(set (reg:SI 3)
- (div:SI (reg:SI 3) (reg:SI 4)))
- (set (reg:SI 4)
- (mod:SI (reg:SI 3) (reg:SI 4)))
- (clobber (match_scratch:SI 0 "=l"))
- (clobber (reg:SI 0))]
- "! TARGET_POWER && ! TARGET_POWERPC"
- "bla __divss"
- [(set_attr "type" "idiv")])
-
-(define_insn "divus_call"
- [(set (reg:SI 3)
- (udiv:SI (reg:SI 3) (reg:SI 4)))
- (set (reg:SI 4)
- (umod:SI (reg:SI 3) (reg:SI 4)))
- (clobber (match_scratch:SI 0 "=l"))
- (clobber (reg:SI 0))
- (clobber (match_scratch:CC 1 "=x"))
- (clobber (reg:CC 69))]
- "! TARGET_POWER && ! TARGET_POWERPC"
- "bla __divus"
- [(set_attr "type" "idiv")])
-
-(define_insn "quoss_call"
- [(set (reg:SI 3)
- (div:SI (reg:SI 3) (reg:SI 4)))
- (clobber (match_scratch:SI 0 "=l"))]
- "! TARGET_POWER && ! TARGET_POWERPC"
- "bla __quoss"
- [(set_attr "type" "idiv")])
-
-(define_insn "quous_call"
- [(set (reg:SI 3)
- (udiv:SI (reg:SI 3) (reg:SI 4)))
- (clobber (match_scratch:SI 0 "=l"))
- (clobber (reg:SI 0))
- (clobber (match_scratch:CC 1 "=x"))
- (clobber (reg:CC 69))]
- "! TARGET_POWER && ! TARGET_POWERPC"
- "bla __quous"
- [(set_attr "type" "idiv")])
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
- (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
- (match_operand:SI 2 "and_operand" "?r,L,K,J")))
- (clobber (match_scratch:CC 3 "=X,X,x,x"))]
- ""
- "@
- and %0,%1,%2
- {rlinm|rlwinm} %0,%1,0,%m2,%M2
- {andil.|andi.} %0,%1,%b2
- {andiu.|andis.} %0,%1,%u2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
- (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
- (match_operand:SI 2 "and_operand" "r,K,J,L"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r,r,r,r"))]
- ""
- "@
- and. %3,%1,%2
- {andil.|andi.} %3,%1,%b2
- {andiu.|andis.} %3,%1,%u2
- {rlinm.|rlwinm.} %3,%1,0,%m2,%M2"
- [(set_attr "type" "compare,compare,compare,delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
- (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
- (match_operand:SI 2 "and_operand" "r,K,J,L"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
- (and:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- and. %0,%1,%2
- {andil.|andi.} %0,%1,%b2
- {andiu.|andis.} %0,%1,%u2
- {rlinm.|rlwinm.} %0,%1,0,%m2,%M2"
- [(set_attr "type" "compare,compare,compare,delayed_compare")])
-
-;; Take a AND with a constant that cannot be done in a single insn and try to
-;; split it into two insns. This does not verify that the insns are valid
-;; since this need not be done as combine will do it.
-
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "non_and_cint_operand" "")))]
- ""
- [(set (match_dup 0) (and:SI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))]
- "
-{
- int maskval = INTVAL (operands[2]);
- int i, transitions, last_bit_value;
- int orig = maskval, first_c = maskval, second_c;
-
- /* We know that MASKVAL must have more than 2 bit-transitions. Start at
- the low-order bit and count for the third transition. When we get there,
- make a first mask that has everything to the left of that position
- a one. Then make the second mask to turn off whatever else is needed. */
-
- for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
- {
- if (((maskval >>= 1) & 1) != last_bit_value)
- last_bit_value ^= 1, transitions++;
-
- if (transitions > 2)
- {
- first_c |= (~0) << i;
- break;
- }
- }
-
- second_c = orig | ~ first_c;
-
- operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
- operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
-}")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
- (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
- (match_operand:SI 2 "logical_operand" "r,K,J")))]
- ""
- "@
- or %0,%1,%2
- {oril|ori} %0,%1,%b2
- {oriu|oris} %0,%1,%u2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "or. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (match_dup 1) (match_dup 2)))]
- ""
- "or. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-;; Split an IOR 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
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "non_logical_cint_operand" "")))]
- ""
- [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))]
-"
-{
- operands[3] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & 0xffff0000);
- operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
-}")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
- (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
- (match_operand:SI 2 "logical_operand" "r,K,J")))]
- ""
- "@
- xor %0,%1,%2
- {xoril|xori} %0,%1,%b2
- {xoriu|xoris} %0,%1,%u2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "xor. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (xor:SI (match_dup 1) (match_dup 2)))]
- ""
- "xor. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-;; Split an XOR 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
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "non_logical_cint_operand" "")))]
- ""
- [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))]
-"
-{
- operands[3] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & 0xffff0000);
- operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))))]
- ""
- "eqv %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "eqv. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
- ""
- "eqv. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (match_operand:SI 2 "gpc_reg_operand" "r")))]
- ""
- "andc %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "andc. %3,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (not:SI (match_dup 1)) (match_dup 2)))]
- ""
- "andc. %0,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (match_operand:SI 2 "gpc_reg_operand" "r")))]
- ""
- "orc %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "orc. %3,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
- ""
- "orc. %0,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
- ""
- "nand %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "nand. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
- ""
- "nand. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
- ""
- "nor %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "nor. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
- ""
- "nor. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-;; maskir insn. We need four forms because things might be in arbitrary
-;; orders. Don't define forms that only set CR fields because these
-;; would modify an input register.
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
- (match_operand:SI 1 "gpc_reg_operand" "0"))
- (and:SI (match_dup 2)
- (match_operand:SI 3 "gpc_reg_operand" "r"))))]
- "TARGET_POWER"
- "maskir %0,%3,%2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
- (match_operand:SI 1 "gpc_reg_operand" "0"))
- (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
- (match_dup 2))))]
- "TARGET_POWER"
- "maskir %0,%3,%2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (and:SI (not:SI (match_dup 2))
- (match_operand:SI 1 "gpc_reg_operand" "0"))))]
- "TARGET_POWER"
- "maskir %0,%3,%2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (and:SI (not:SI (match_dup 2))
- (match_operand:SI 1 "gpc_reg_operand" "0"))))]
- "TARGET_POWER"
- "maskir %0,%3,%2")
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
- (match_operand:SI 1 "gpc_reg_operand" "0"))
- (and:SI (match_dup 2)
- (match_operand:SI 3 "gpc_reg_operand" "r")))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
- (and:SI (match_dup 2) (match_dup 3))))]
- "TARGET_POWER"
- "maskir. %0,%3,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
- (match_operand:SI 1 "gpc_reg_operand" "0"))
- (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
- (match_dup 2)))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
- (and:SI (match_dup 3) (match_dup 2))))]
- "TARGET_POWER"
- "maskir. %0,%3,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (and:SI (not:SI (match_dup 2))
- (match_operand:SI 1 "gpc_reg_operand" "0")))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (match_dup 2) (match_dup 3))
- (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
- "TARGET_POWER"
- "maskir. %0,%3,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (and:SI (not:SI (match_dup 2))
- (match_operand:SI 1 "gpc_reg_operand" "0")))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ior:SI (and:SI (match_dup 3) (match_dup 2))
- (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
- "TARGET_POWER"
- "maskir. %0,%3,%2"
- [(set_attr "type" "compare")])
-
-;; Rotate and shift insns, in all their variants. These support shifts,
-;; field inserts and extracts, and various combinations thereof.
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "const_int_operand" "i"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))]
- ""
- "
-{
- /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
- the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
- compiler if the address of the structure is taken later. */
- if (GET_CODE (operands[0]) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
- FAIL;
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "const_int_operand" "i"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))]
- ""
- "*
-{
- int start = INTVAL (operands[2]) & 31;
- int size = INTVAL (operands[1]) & 31;
-
- operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size);
- operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
- return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "const_int_operand" "i"))
- (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
- (match_operand:SI 4 "const_int_operand" "i")))]
- ""
- "*
-{
- int shift = INTVAL (operands[4]) & 31;
- int start = INTVAL (operands[2]) & 31;
- int size = INTVAL (operands[1]) & 31;
-
- operands[4] = gen_rtx (CONST_INT, VOIDmode, shift - start - size);
- operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
- return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "const_int_operand" "i"))
- (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
- (match_operand:SI 4 "const_int_operand" "i")))]
- ""
- "*
-{
- int shift = INTVAL (operands[4]) & 31;
- int start = INTVAL (operands[2]) & 31;
- int size = INTVAL (operands[1]) & 31;
-
- operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - shift - start - size);
- operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
- return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "const_int_operand" "i"))
- (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
- (match_operand:SI 4 "const_int_operand" "i")))]
- ""
- "*
-{
- int shift = INTVAL (operands[4]) & 31;
- int start = INTVAL (operands[2]) & 31;
- int size = INTVAL (operands[1]) & 31;
-
- operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - shift - start - size);
- operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
- return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
-}")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (match_operand:SI 1 "const_int_operand" "i")
- (match_operand:SI 2 "const_int_operand" "i"))
- (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
- (match_operand:SI 4 "const_int_operand" "i")
- (match_operand:SI 5 "const_int_operand" "i")))]
- "INTVAL (operands[4]) >= INTVAL (operands[1])"
- "*
-{
- int extract_start = INTVAL (operands[5]) & 31;
- int extract_size = INTVAL (operands[4]) & 31;
- int insert_start = INTVAL (operands[2]) & 31;
- int insert_size = INTVAL (operands[1]) & 31;
-
-/* Align extract field with insert field */
- operands[5] = gen_rtx (CONST_INT, VOIDmode,
- extract_start + extract_size - insert_start - insert_size);
- operands[1] = gen_rtx (CONST_INT, VOIDmode, insert_start + insert_size - 1);
- return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
-}")
-
-(define_insn ""
- [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
- (match_operand:DI 1 "const_int_operand" "i")
- (match_operand:DI 2 "const_int_operand" "i"))
- (match_operand:DI 3 "gpc_reg_operand" "r"))]
- "TARGET_POWERPC64"
- "*
-{
- int start = INTVAL (operands[2]) & 63;
- int size = INTVAL (operands[1]) & 63;
-
- operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - start - size);
- return \"rldimi %0,%3,%H2,%H1\";
-}")
-
-(define_expand "extzv"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "const_int_operand" "i")))]
- ""
- "
-{
- /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
- the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
- compiler if the address of the structure is taken later. */
- if (GET_CODE (operands[0]) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "const_int_operand" "i")))]
- ""
- "*
-{
- int start = INTVAL (operands[3]) & 31;
- int size = INTVAL (operands[2]) & 31;
-
- if (start + size >= 32)
- operands[3] = const0_rtx;
- else
- operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
- return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
-}")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "const_int_operand" "i"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=r"))]
- ""
- "*
-{
- int start = INTVAL (operands[3]) & 31;
- int size = INTVAL (operands[2]) & 31;
-
- /* If the bitfield being tested fits in the upper or lower half of a
- word, it is possible to use andiu. or andil. to test it. This is
- useful because the condition register set-use delay is smaller for
- andi[ul]. than for rlinm. This doesn't work when the starting bit
- position is 0 because the LT and GT bits may be set wrong. */
-
- if ((start > 0 && start + size <= 16) || start >= 16)
- {
- operands[3] = gen_rtx (CONST_INT, VOIDmode,
- ((1 << (16 - (start & 15)))
- - (1 << (16 - (start & 15) - size))));
- if (start < 16)
- return \"{andiu.|andis.} %4,%1,%3\";
- else
- return \"{andil.|andi.} %4,%1,%3\";
- }
-
- if (start + size >= 32)
- operands[3] = const0_rtx;
- else
- operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
- return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
-}"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")
- (match_operand:SI 3 "const_int_operand" "i"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
- ""
- "*
-{
- int start = INTVAL (operands[3]) & 31;
- int size = INTVAL (operands[2]) & 31;
-
- if (start >= 16 && start + size == 32)
- {
- operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1);
- return \"{andil.|andi.} %0,%1,%3\";
- }
-
- if (start + size >= 32)
- operands[3] = const0_rtx;
- else
- operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
- return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
-}"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "const_int_operand" "i")
- (match_operand:DI 3 "const_int_operand" "i")))]
- "TARGET_POWERPC64"
- "*
-{
- int start = INTVAL (operands[3]) & 63;
- int size = INTVAL (operands[2]) & 63;
-
- if (start + size >= 64)
- operands[3] = const0_rtx;
- else
- operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - size);
- return \"rldicl %0,%1,%3,%2\";
-}")
-
-(define_insn ""
- [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
- (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "const_int_operand" "i")
- (match_operand:DI 3 "const_int_operand" "i"))
- (const_int 0)))
- (clobber (match_scratch:DI 4 "=r"))]
- "TARGET_POWERPC64"
- "*
-{
- int start = INTVAL (operands[3]) & 63;
- int size = INTVAL (operands[2]) & 63;
-
- if (start + size >= 64)
- operands[3] = const0_rtx;
- else
- operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - size);
- return \"rldicl. %4,%1,%3,%2\";
-}")
-
-(define_insn ""
- [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
- (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "const_int_operand" "i")
- (match_operand:DI 3 "const_int_operand" "i"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
- "TARGET_POWERPC64"
- "*
-{
- int start = INTVAL (operands[3]) & 63;
- int size = INTVAL (operands[2]) & 63;
-
- if (start + size >= 64)
- operands[3] = const0_rtx;
- else
- operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
- operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - size);
- return \"rldicl. %0,%1,%3,%2\";
-}")
-
-(define_insn "rotlsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
- ""
- "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (rotate:SI (match_dup 1) (match_dup 2)))]
- ""
- "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (match_operand:SI 3 "mask_operand" "L")))]
- ""
- "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (and:SI
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (match_operand:SI 3 "mask_operand" "L"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=r"))]
- ""
- "{rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC (and:SI
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (match_operand:SI 3 "mask_operand" "L"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
- ""
- "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI
- (subreg:QI
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
- ""
- "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:SI
- (subreg:QI
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:SI
- (subreg:QI
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
- ""
- "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI
- (subreg:HI
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
- ""
- "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:SI
- (subreg:HI
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- ""
- "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (zero_extend:SI
- (subreg:HI
- (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
- ""
- "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff"
- [(set_attr "type" "delayed_compare")])
-
-;; Note that we use "sle." instead of "sl." so that we can set
-;; SHIFT_COUNT_TRUNCATED.
-
-(define_expand "ashlsi3"
- [(use (match_operand:SI 0 "gpc_reg_operand" ""))
- (use (match_operand:SI 1 "gpc_reg_operand" ""))
- (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
- ""
- "
-{
- if (TARGET_POWER)
- emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_insn "ashlsi3_power"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
- (clobber (match_scratch:SI 3 "=q,X"))]
- "TARGET_POWER"
- "@
- sle %0,%1,%2
- {sli|slwi} %0,%1,%h2"
- [(set_attr "length" "8")])
-
-(define_insn "ashlsi3_no_power"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
- "! TARGET_POWER"
- "{sl|slw}%I2 %0,%1,%h2"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r,r"))
- (clobber (match_scratch:SI 4 "=q,X"))]
- "TARGET_POWER"
- "@
- sle. %3,%1,%2
- {sli.|slwi.} %3,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- "! TARGET_POWER"
- "{sl|slw}%I2. %3,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
- (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (ashift:SI (match_dup 1) (match_dup 2)))
- (clobber (match_scratch:SI 4 "=q,X"))]
- "TARGET_POWER"
- "@
- sle. %0,%1,%2
- {sli.|slwi.} %0,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ashift:SI (match_dup 1) (match_dup 2)))]
- "! TARGET_POWER"
- "{sl|slw}%I2. %0,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i"))
- (match_operand:SI 3 "mask_operand" "L")))]
- "includes_lshift_p (operands[2], operands[3])"
- "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i"))
- (match_operand:SI 3 "mask_operand" "L"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=r"))]
- "includes_lshift_p (operands[2], operands[3])"
- "{rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i"))
- (match_operand:SI 3 "mask_operand" "L"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
- "includes_lshift_p (operands[2], operands[3])"
- "{rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3"
- [(set_attr "type" "delayed_compare")])
-
-;; The AIX assembler mis-handles "sri x,x,0", so write that case as
-;; "sli x,x,0".
-(define_expand "lshrsi3"
- [(use (match_operand:SI 0 "gpc_reg_operand" ""))
- (use (match_operand:SI 1 "gpc_reg_operand" ""))
- (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
- ""
- "
-{
- if (TARGET_POWER)
- emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_insn "lshrsi3_power"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
- (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
- (clobber (match_scratch:SI 3 "=q,X,X"))]
- "TARGET_POWER"
- "@
- sre %0,%1,%2
- mr %0,%1
- {s%A2i|s%A2wi} %0,%1,%h2")
-
-(define_insn "lshrsi3_no_power"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
- "! TARGET_POWER"
- "@
- mr %0,%1
- {sr|srw}%I2 %0,%1,%h2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
- (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,O,i"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r,X,r"))
- (clobber (match_scratch:SI 4 "=q,X,X"))]
- "TARGET_POWER"
- "@
- sre. %3,%1,%2
- mr. %1,%1
- {s%A2i.|s%A2wi.} %3,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "O,ri"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=X,r"))]
- "! TARGET_POWER"
- "@
- mr. %1,%1
- {sr|srw}%I2. %3,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x")
- (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,O,i"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
- (lshiftrt:SI (match_dup 1) (match_dup 2)))
- (clobber (match_scratch:SI 4 "=q,X,X"))]
- "TARGET_POWER"
- "@
- sre. %0,%1,%2
- mr. %0,%1
- {s%A2i.|s%A2wi.} %0,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
- (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "O,ri"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (lshiftrt:SI (match_dup 1) (match_dup 2)))]
- "! TARGET_POWER"
- "@
- mr. %0,%1
- {sr|srw}%I2. %0,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i"))
- (match_operand:SI 3 "mask_operand" "L")))]
- "includes_rshift_p (operands[2], operands[3])"
- "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i"))
- (match_operand:SI 3 "mask_operand" "L"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=r"))]
- "includes_rshift_p (operands[2], operands[3])"
- "{rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i"))
- (match_operand:SI 3 "mask_operand" "L"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
- "includes_rshift_p (operands[2], operands[3])"
- "{rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI
- (subreg:QI
- (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")) 0)))]
- "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
- "{rlinm|rlwinm} %0,%1,%s2,0xff")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (zero_extend:SI
- (subreg:QI
- (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")) 0))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
- "{rlinm.|rlwinm.} %3,%1,%s2,0xff"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC
- (zero_extend:SI
- (subreg:QI
- (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")) 0))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
- "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
- "{rlinm.|rlwinm.} %0,%1,%s2,0xff"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI
- (subreg:HI
- (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")) 0)))]
- "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
- "{rlinm|rlwinm} %0,%1,%s2,0xffff")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (zero_extend:SI
- (subreg:HI
- (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")) 0))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
- "{rlinm.|rlwinm.} %3,%1,%s2,0xffff"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC
- (zero_extend:SI
- (subreg:HI
- (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "const_int_operand" "i")) 0))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
- "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
- "{rlinm.|rlwinm.} %0,%1,%s2,0xffff"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (const_int 1)
- (match_operand:SI 1 "gpc_reg_operand" "r"))
- (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
- (const_int 31)))]
- "TARGET_POWER"
- "rrib %0,%1,%2")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (const_int 1)
- (match_operand:SI 1 "gpc_reg_operand" "r"))
- (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
- (const_int 31)))]
- "TARGET_POWER"
- "rrib %0,%1,%2")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
- (const_int 1)
- (match_operand:SI 1 "gpc_reg_operand" "r"))
- (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
- (const_int 1)
- (const_int 0)))]
- "TARGET_POWER"
- "rrib %0,%1,%2")
-
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_cint_operand" "")))]
- ""
- "
-{
- if (TARGET_POWER)
- emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
- else
- emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
- DONE;
-}")
-
-(define_insn "ashrsi3_power"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
- (clobber (match_scratch:SI 3 "=q,X"))]
- "TARGET_POWER"
- "@
- srea %0,%1,%2
- {srai|srawi} %0,%1,%h2")
-
-(define_insn "ashrsi3_no_power"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
- "! TARGET_POWER"
- "{sra|sraw}%I2 %0,%1,%h2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r,r"))
- (clobber (match_scratch:SI 4 "=q,X"))]
- "TARGET_POWER"
- "@
- srea. %3,%1,%2
- {srai.|srawi.} %3,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=r"))]
- "! TARGET_POWER"
- "{sra|sraw}%I2. %3,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
- (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (ashiftrt:SI (match_dup 1) (match_dup 2)))
- (clobber (match_scratch:SI 4 "=q,X"))]
- "TARGET_POWER"
- "@
- srea. %0,%1,%2
- {srai.|srawi.} %0,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ashiftrt:SI (match_dup 1) (match_dup 2)))]
- "! TARGET_POWER"
- "{sra|sraw}%I2. %0,%1,%h2"
- [(set_attr "type" "delayed_compare")])
-
-;; Floating-point insns, excluding normal data motion.
-;;
-;; PowerPC has a full set of single-precision floating point instructions.
-;;
-;; For the POWER architecture, we pretend that we have both SFmode and
-;; DFmode insns, while, in fact, all fp insns are actually done in double.
-;; The only conversions we will do will be when storing to memory. In that
-;; case, we will use the "frsp" instruction before storing.
-;;
-;; Note that when we store into a single-precision memory location, we need to
-;; use the frsp insn first. If the register being stored isn't dead, we
-;; need a scratch register for the frsp. But this is difficult when the store
-;; is done by reload. It is not incorrect to do the frsp on the register in
-;; this case, we just lose precision that we would have otherwise gotten but
-;; is not guaranteed. Perhaps this should be tightened up at some point.
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "*
-{
- if (REGNO (operands[0]) == REGNO (operands[1]))
- return \"\";
- else
- return \"fmr %0,%1\";
-}"
- [(set_attr "type" "fp")])
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "frsp %0,%1"
- [(set_attr "type" "fp")])
-
-(define_insn "aux_truncdfsf2"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
- "! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "frsp %0,%1"
- [(set_attr "type" "fp")])
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "fneg %0,%1"
- [(set_attr "type" "fp")])
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "fabs %0,%1"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "fnabs %0,%1"
- [(set_attr "type" "fp")])
-
-(define_expand "addsf3"
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
- (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
- (match_operand:SF 2 "gpc_reg_operand" "")))]
- "TARGET_HARD_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
- "TARGET_POWERPC && TARGET_HARD_FLOAT"
- "fadds %0,%1,%2"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
- "! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "{fa|fadd} %0,%1,%2"
- [(set_attr "type" "fp")])
-
-(define_expand "subsf3"
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
- (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
- (match_operand:SF 2 "gpc_reg_operand" "")))]
- "TARGET_HARD_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
- "TARGET_POWERPC && TARGET_HARD_FLOAT"
- "fsubs %0,%1,%2"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
- "! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "{fs|fsub} %0,%1,%2"
- [(set_attr "type" "fp")])
-
-(define_expand "mulsf3"
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
- (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
- (match_operand:SF 2 "gpc_reg_operand" "")))]
- "TARGET_HARD_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
- "TARGET_POWERPC && TARGET_HARD_FLOAT"
- "fmuls %0,%1,%2"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
- "! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "{fm|fmul} %0,%1,%2"
- [(set_attr "type" "dmul")])
-
-(define_expand "divsf3"
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
- (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
- (match_operand:SF 2 "gpc_reg_operand" "")))]
- "TARGET_HARD_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
- "TARGET_POWERPC && TARGET_HARD_FLOAT"
- "fdivs %0,%1,%2"
- [(set_attr "type" "sdiv")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
- "! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "{fd|fdiv} %0,%1,%2"
- [(set_attr "type" "ddiv")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f"))
- (match_operand:SF 3 "gpc_reg_operand" "f")))]
- "TARGET_POWERPC && TARGET_HARD_FLOAT"
- "fmadds %0,%1,%2,%3"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f"))
- (match_operand:SF 3 "gpc_reg_operand" "f")))]
- "! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "{fma|fmadd} %0,%1,%2,%3"
- [(set_attr "type" "dmul")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f"))
- (match_operand:SF 3 "gpc_reg_operand" "f")))]
- "TARGET_POWERPC && TARGET_HARD_FLOAT"
- "fmsubs %0,%1,%2,%3"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f"))
- (match_operand:SF 3 "gpc_reg_operand" "f")))]
- "! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "{fms|fmsub} %0,%1,%2,%3"
- [(set_attr "type" "dmul")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f"))
- (match_operand:SF 3 "gpc_reg_operand" "f"))))]
- "TARGET_POWERPC && TARGET_HARD_FLOAT"
- "fnmadds %0,%1,%2,%3"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f"))
- (match_operand:SF 3 "gpc_reg_operand" "f"))))]
- "! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "{fnma|fnmadd} %0,%1,%2,%3"
- [(set_attr "type" "dmul")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f"))
- (match_operand:SF 3 "gpc_reg_operand" "f"))))]
- "TARGET_POWERPC && TARGET_HARD_FLOAT"
- "fnmsubs %0,%1,%2,%3"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
- (match_operand:SF 2 "gpc_reg_operand" "f"))
- (match_operand:SF 3 "gpc_reg_operand" "f"))))]
- "! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "{fnms|fnmsub} %0,%1,%2,%3"
- [(set_attr "type" "dmul")])
-
-(define_expand "sqrtsf2"
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
- (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
- "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
- "")
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
- "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT"
- "fsqrts %0,%1"
- [(set_attr "type" "ssqrt")])
-
-(define_insn ""
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
- "TARGET_POWER2 && TARGET_HARD_FLOAT"
- "fsqrt %0,%1"
- [(set_attr "type" "dsqrt")])
-
-;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
-;; fsel instruction and some auxiliary computations. Then we just have a
-;; single DEFINE_INSN for fsel and the define_splits to make them if made by
-;; combine.
-(define_expand "maxsf3"
- [(set (match_dup 3)
- (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
- (match_operand:SF 2 "gpc_reg_operand" "")))
- (set (match_operand:SF 0 "gpc_reg_operand" "")
- (if_then_else:SF (ge (match_dup 3)
- (const_int 0))
- (match_dup 1)
- (match_dup 2)))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- "
-{ operands[3] = gen_reg_rtx (SFmode); }")
-
-(define_split
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
- (smax:SF (match_operand:SF 1 "gpc_reg_operand" "")
- (match_operand:SF 2 "gpc_reg_operand" "")))
- (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- [(set (match_dup 3)
- (minus:SF (match_dup 1) (match_dup 2)))
- (set (match_dup 0)
- (if_then_else:SF (ge (match_dup 3)
- (const_int 0))
- (match_dup 1)
- (match_dup 2)))]
- "")
-
-(define_expand "minsf3"
- [(set (match_dup 3)
- (minus:SF (match_operand:SF 2 "gpc_reg_operand" "")
- (match_operand:SF 1 "gpc_reg_operand" "")))
- (set (match_operand:SF 0 "gpc_reg_operand" "")
- (if_then_else:SF (ge (match_dup 3)
- (const_int 0))
- (match_dup 1)
- (match_dup 2)))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- "
-{ operands[3] = gen_reg_rtx (SFmode); }")
-
-(define_split
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
- (smin:SF (match_operand:SF 1 "gpc_reg_operand" "")
- (match_operand:SF 2 "gpc_reg_operand" "")))
- (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- [(set (match_dup 3)
- (minus:SF (match_dup 2) (match_dup 1)))
- (set (match_dup 0)
- (if_then_else:SF (ge (match_dup 3)
- (const_int 0))
- (match_dup 1)
- (match_dup 2)))]
- "")
-
-(define_expand "movsfcc"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (if_then_else:SF (match_operand 1 "comparison_operator" "")
- (match_operand:SF 2 "gpc_reg_operand" "f")
- (match_operand:SF 3 "gpc_reg_operand" "f")))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- "
-{
- rtx temp, op0, op1;
- enum rtx_code code = GET_CODE (operands[1]);
- if (! rs6000_compare_fp_p)
- FAIL;
- switch (code)
- {
- case GE: case EQ: case NE:
- op0 = rs6000_compare_op0;
- op1 = rs6000_compare_op1;
- break;
- case GT:
- op0 = rs6000_compare_op1;
- op1 = rs6000_compare_op0;
- temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
- break;
- case LE:
- op0 = rs6000_compare_op1;
- op1 = rs6000_compare_op0;
- break;
- case LT:
- op0 = rs6000_compare_op0;
- op1 = rs6000_compare_op1;
- temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
- break;
- default:
- FAIL;
- }
- if (GET_MODE (rs6000_compare_op0) == DFmode)
- {
- temp = gen_reg_rtx (DFmode);
- emit_insn (gen_subdf3 (temp, op0, op1));
- emit_insn (gen_fseldfsf4 (operands[0], temp, operands[2], operands[3]));
- if (code == EQ)
- {
- emit_insn (gen_negdf2 (temp, temp));
- emit_insn (gen_fseldfsf4 (operands[0], temp, operands[0], operands[3]));
- }
- if (code == NE)
- {
- emit_insn (gen_negdf2 (temp, temp));
- emit_insn (gen_fseldfsf4 (operands[0], temp, operands[3], operands[0]));
- }
- }
- else
- {
- temp = gen_reg_rtx (SFmode);
- emit_insn (gen_subsf3 (temp, op0, op1));
- emit_insn (gen_fselsfsf4 (operands[0], temp, operands[2], operands[3]));
- if (code == EQ)
- {
- emit_insn (gen_negsf2 (temp, temp));
- emit_insn (gen_fselsfsf4 (operands[0], temp, operands[0], operands[3]));
- }
- if (code == NE)
- {
- emit_insn (gen_negsf2 (temp, temp));
- emit_insn (gen_fselsfsf4 (operands[0], temp, operands[3], operands[0]));
- }
- }
- DONE;
-}")
-
-(define_insn "fselsfsf4"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
- (const_int 0))
- (match_operand:SF 2 "gpc_reg_operand" "f")
- (match_operand:SF 3 "gpc_reg_operand" "f")))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- "fsel %0,%1,%2,%3"
- [(set_attr "type" "fp")])
-
-(define_insn "fseldfsf4"
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
- (const_int 0))
- (match_operand:SF 2 "gpc_reg_operand" "f")
- (match_operand:SF 3 "gpc_reg_operand" "f")))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- "fsel %0,%1,%2,%3"
- [(set_attr "type" "fp")])
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "fneg %0,%1"
- [(set_attr "type" "fp")])
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "fabs %0,%1"
- [(set_attr "type" "fp")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "fnabs %0,%1"
- [(set_attr "type" "fp")])
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "{fa|fadd} %0,%1,%2"
- [(set_attr "type" "fp")])
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
- (match_operand:DF 2 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "{fs|fsub} %0,%1,%2"
- [(set_attr "type" "fp")])
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "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"
- "{fm|fmul} %0,%1,%2"
- [(set_attr "type" "dmul")])
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
- (match_operand:DF 2 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "{fd|fdiv} %0,%1,%2"
- [(set_attr "type" "ddiv")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f"))
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "{fma|fmadd} %0,%1,%2,%3"
- [(set_attr "type" "dmul")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f"))
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "{fms|fmsub} %0,%1,%2,%3"
- [(set_attr "type" "dmul")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f"))
- (match_operand:DF 3 "gpc_reg_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "{fnma|fnmadd} %0,%1,%2,%3"
- [(set_attr "type" "dmul")])
-
-(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f"))
- (match_operand:DF 3 "gpc_reg_operand" "f"))))]
- "TARGET_HARD_FLOAT"
- "{fnms|fnmsub} %0,%1,%2,%3"
- [(set_attr "type" "dmul")])
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
- "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
- "fsqrt %0,%1"
- [(set_attr "type" "dsqrt")])
-
-;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
-;; fsel instruction and some auxiliary computations. Then we just have a
-;; single DEFINE_INSN for fsel and the define_splits to make them if made by
-;; combine.
-
-(define_expand "maxdf3"
- [(set (match_dup 3)
- (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
- (match_operand:DF 2 "gpc_reg_operand" "")))
- (set (match_operand:DF 0 "gpc_reg_operand" "")
- (if_then_else:DF (ge (match_dup 3)
- (const_int 0))
- (match_dup 1)
- (match_dup 2)))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- "
-{ operands[3] = gen_reg_rtx (DFmode); }")
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (smax:DF (match_operand:DF 1 "gpc_reg_operand" "")
- (match_operand:DF 2 "gpc_reg_operand" "")))
- (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- [(set (match_dup 3)
- (minus:DF (match_dup 1) (match_dup 2)))
- (set (match_dup 0)
- (if_then_else:DF (ge (match_dup 3)
- (const_int 0))
- (match_dup 1)
- (match_dup 2)))]
- "")
-
-(define_expand "mindf3"
- [(set (match_dup 3)
- (minus:DF (match_operand:DF 2 "gpc_reg_operand" "")
- (match_operand:DF 1 "gpc_reg_operand" "")))
- (set (match_operand:DF 0 "gpc_reg_operand" "")
- (if_then_else:DF (ge (match_dup 3)
- (const_int 0))
- (match_dup 1)
- (match_dup 2)))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- "
-{ operands[3] = gen_reg_rtx (DFmode); }")
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (smin:DF (match_operand:DF 1 "gpc_reg_operand" "")
- (match_operand:DF 2 "gpc_reg_operand" "")))
- (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- [(set (match_dup 3)
- (minus:DF (match_dup 2) (match_dup 1)))
- (set (match_dup 0)
- (if_then_else:DF (ge (match_dup 3)
- (const_int 0))
- (match_dup 1)
- (match_dup 2)))]
- "")
-
-(define_expand "movdfcc"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (if_then_else:DF (match_operand 1 "comparison_operator" "")
- (match_operand:DF 2 "gpc_reg_operand" "f")
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- "
-{
- rtx temp, op0, op1;
- enum rtx_code code = GET_CODE (operands[1]);
- if (! rs6000_compare_fp_p)
- FAIL;
- switch (code)
- {
- case GE: case EQ: case NE:
- op0 = rs6000_compare_op0;
- op1 = rs6000_compare_op1;
- break;
- case GT:
- op0 = rs6000_compare_op1;
- op1 = rs6000_compare_op0;
- temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
- break;
- case LE:
- op0 = rs6000_compare_op1;
- op1 = rs6000_compare_op0;
- break;
- case LT:
- op0 = rs6000_compare_op0;
- op1 = rs6000_compare_op1;
- temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
- break;
- default:
- FAIL;
- }
- if (GET_MODE (rs6000_compare_op0) == DFmode)
- {
- temp = gen_reg_rtx (DFmode);
- emit_insn (gen_subdf3 (temp, op0, op1));
- emit_insn (gen_fseldfdf4 (operands[0], temp, operands[2], operands[3]));
- if (code == EQ)
- {
- emit_insn (gen_negdf2 (temp, temp));
- emit_insn (gen_fseldfdf4 (operands[0], temp, operands[0], operands[3]));
- }
- if (code == NE)
- {
- emit_insn (gen_negdf2 (temp, temp));
- emit_insn (gen_fseldfdf4 (operands[0], temp, operands[3], operands[0]));
- }
- }
- else
- {
- temp = gen_reg_rtx (SFmode);
- emit_insn (gen_subsf3 (temp, op0, op1));
- emit_insn (gen_fselsfdf4 (operands[0], temp, operands[2], operands[3]));
- if (code == EQ)
- {
- emit_insn (gen_negsf2 (temp, temp));
- emit_insn (gen_fselsfdf4 (operands[0], temp, operands[0], operands[3]));
- }
- if (code == NE)
- {
- emit_insn (gen_negsf2 (temp, temp));
- emit_insn (gen_fselsfdf4 (operands[0], temp, operands[3], operands[0]));
- }
- }
- DONE;
-}")
-
-(define_insn "fseldfdf4"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
- (const_int 0))
- (match_operand:DF 2 "gpc_reg_operand" "f")
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
- "fsel %0,%1,%2,%3"
- [(set_attr "type" "fp")])
-
-(define_insn "fselsfdf4"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
- (const_int 0))
- (match_operand:DF 2 "gpc_reg_operand" "f")
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
- "TARGET_PPC_GFXOPT"
- "fsel %0,%1,%2,%3"
- [(set_attr "type" "fp")])
-
-;; Conversions to and from floating-point.
-
-(define_expand "floatsidf2"
- [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
- (use (match_dup 2))
- (use (match_dup 3))
- (clobber (match_dup 4))
- (clobber (match_dup 5))
- (clobber (reg:DF 76))])]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- "
-{
- operands[2] = force_reg (SImode, GEN_INT (0x43300000));
- operands[3] = force_reg (DFmode, rs6000_float_const (\"4503601774854144\", DFmode));
- operands[4] = gen_reg_rtx (SImode);
- operands[5] = gen_reg_rtx (Pmode);
-}")
-
-(define_insn "*floatsidf2_internal"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
- (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
- (use (match_operand:SI 2 "gpc_reg_operand" "r"))
- (use (match_operand:DF 3 "gpc_reg_operand" "f"))
- (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
- (clobber (match_operand:SI 5 "gpc_reg_operand" "=b"))
- (clobber (reg:DF 76))]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- "#"
- [(set_attr "length" "24")])
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
- (use (match_operand:SI 2 "gpc_reg_operand" ""))
- (use (match_operand:DF 3 "gpc_reg_operand" ""))
- (clobber (match_operand:SI 4 "gpc_reg_operand" ""))
- (clobber (match_operand:SI 5 "gpc_reg_operand" ""))
- (clobber (reg:DF 76))]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- [(set (match_dup 4)
- (xor:SI (match_dup 1)
- (match_dup 6)))
- (set (match_dup 5)
- (unspec [(const_int 0)] 11))
- (set (match_dup 7)
- (unspec [(match_dup 4)
- (match_dup 5)] 12)) ;; low word
- (set (match_dup 7)
- (unspec [(match_dup 2)
- (match_dup 5)
- (match_dup 7)] 13)) ;; high word
- (set (match_dup 0)
- (unspec [(match_dup 7)
- (match_dup 5)] 14))
- (set (match_dup 0)
- (minus:DF (match_dup 0)
- (match_dup 3)))]
- "
-{
- operands[6] = GEN_INT (0x80000000);
- operands[7] = gen_rtx (REG, DFmode, FPMEM_REGNUM);
-}")
-
-(define_expand "floatunssidf2"
- [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
- (use (match_dup 2))
- (use (match_dup 3))
- (clobber (match_dup 4))
- (clobber (reg:DF 76))])]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- "
-{
- operands[2] = force_reg (SImode, GEN_INT (0x43300000));
- operands[3] = force_reg (DFmode, rs6000_float_const (\"4503599627370496\", DFmode));
- operands[4] = gen_reg_rtx (Pmode);
-}")
-
-(define_insn "*floatunssidf2_internal"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
- (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
- (use (match_operand:SI 2 "gpc_reg_operand" "r"))
- (use (match_operand:DF 3 "gpc_reg_operand" "f"))
- (clobber (match_operand:SI 4 "gpc_reg_operand" "=b"))
- (clobber (reg:DF 76))]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- "#"
- [(set_attr "length" "20")])
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
- (use (match_operand:SI 2 "gpc_reg_operand" ""))
- (use (match_operand:DF 3 "gpc_reg_operand" ""))
- (clobber (match_operand:SI 4 "gpc_reg_operand" "=b"))
- (clobber (reg:DF 76))]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- [(set (match_dup 4)
- (unspec [(const_int 0)] 11))
- (set (match_dup 5)
- (unspec [(match_dup 1)
- (match_dup 4)] 12)) ;; low word
- (set (match_dup 5)
- (unspec [(match_dup 2)
- (match_dup 4)
- (match_dup 5)] 13)) ;; high word
- (set (match_dup 0)
- (unspec [(match_dup 5)
- (reg:SI 1)] 14))
- (set (match_dup 0)
- (minus:DF (match_dup 0)
- (match_dup 3)))]
- "operands[5] = gen_rtx (REG, DFmode, FPMEM_REGNUM);")
-
-;; Load up scratch register with base address + offset if needed
-(define_insn "*floatsidf2_loadaddr"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
- (unspec [(const_int 0)] 11))]
- "TARGET_HARD_FLOAT"
- "*
-{
- if (rs6000_fpmem_offset > 32760)
- {
- rtx xop[3];
-
- xop[0] = operands[0];
- xop[1] = (frame_pointer_needed) ? frame_pointer_rtx : stack_pointer_rtx;
- xop[2] = GEN_INT ((rs6000_fpmem_offset >> 16) + ((rs6000_fpmem_offset & 0x8000) >> 15));
- output_asm_insn (\"{cau|addis} %0,%1,%2\", xop);
- }
- else if (rs6000_fpmem_offset < 0)
- abort ();
-
- return \"\";
-}"
- [(set_attr "length" "4")])
-
-(define_insn "*floatsidf2_store1"
- [(set (reg:DF 76)
- (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
- (match_operand:SI 1 "gpc_reg_operand" "r")] 12))]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- "*
-{
- rtx indx;
-
- if (rs6000_fpmem_offset > 32760)
- indx = operands[1];
- else if (frame_pointer_needed)
- indx = frame_pointer_rtx;
- else
- indx = stack_pointer_rtx;
-
- operands[2] = gen_rtx (MEM, SImode,
- gen_rtx (PLUS, Pmode,
- indx,
- GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
- + ((WORDS_BIG_ENDIAN != 0) * 4))));
-
- return \"{st|stw} %0,%2\";
-}"
- [(set_attr "type" "store")])
-
-(define_insn "*floatsidf2_store2"
- [(set (reg:DF 76)
- (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
- (match_operand:SI 1 "gpc_reg_operand" "r")
- (reg:DF 76)] 13))]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- "*
-{
- rtx indx;
-
- if (rs6000_fpmem_offset > 32760)
- indx = operands[1];
- else if (frame_pointer_needed)
- indx = frame_pointer_rtx;
- else
- indx = stack_pointer_rtx;
-
- operands[2] = gen_rtx (MEM, SImode,
- gen_rtx (PLUS, Pmode,
- indx,
- GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
- + ((WORDS_BIG_ENDIAN == 0) * 4))));
-
- return \"{st|stw} %0,%2\";
-}"
- [(set_attr "type" "store")])
-
-(define_insn "*floatsidf2_load"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (unspec [(reg:DF 76)
- (match_operand:SI 1 "gpc_reg_operand" "b")] 14))]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- "*
-{
- rtx indx;
- HOST_WIDE_INT offset = rs6000_fpmem_offset;
-
- if (rs6000_fpmem_offset > 32760)
- {
- indx = operands[1];
- offset = (((offset & 0xffff) ^ 0x8000) - 0x8000);
- }
- else if (frame_pointer_needed)
- indx = frame_pointer_rtx;
- else
- indx = stack_pointer_rtx;
-
- operands[2] = gen_rtx (MEM, SImode,
- gen_rtx (PLUS, Pmode, indx, GEN_INT (offset)));
-
- return \"lfd %0,%2\";
-}"
- [(set_attr "type" "fpload")])
-
-(define_expand "fix_truncdfsi2"
- [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
- (clobber (match_dup 2))
- (clobber (match_dup 3))
- (clobber (match_dup 4))])]
- "TARGET_HARD_FLOAT"
- "
-{
- if (!TARGET_POWER2 && !TARGET_POWERPC)
- {
- emit_insn (gen_trunc_call (operands[0], operands[1],
- gen_rtx (SYMBOL_REF, Pmode, RS6000_ITRUNC)));
- DONE;
- }
-
- operands[2] = gen_reg_rtx (DImode);
- operands[3] = gen_reg_rtx (Pmode);
- operands[4] = gen_rtx (REG, DImode, FPMEM_REGNUM);
-}")
-
-(define_insn "*fix_truncdfsi2_internal"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
- (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
- (clobber (match_operand:SI 3 "gpc_reg_operand" "=b"))
- (clobber (reg:DI 76))]
- "TARGET_HARD_FLOAT"
- "#"
- [(set_attr "length" "12")])
-
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
- (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
- (clobber (match_operand:SI 3 "gpc_reg_operand" ""))
- (clobber (reg:DI 76))]
- "TARGET_HARD_FLOAT"
- [(set (match_dup 2)
- (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" ""))))
- (set (match_dup 3)
- (unspec [(const_int 0)] 11))
- (set (match_dup 4)
- (unspec [(match_dup 2)
- (match_dup 3)] 15))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (unspec [(match_dup 4)
- (match_dup 3)] 16))]
- "operands[4] = gen_rtx (REG, DImode, FPMEM_REGNUM);")
-
-(define_insn "*fctiwz"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
- (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))))]
- "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
- "{fcirz|fctiwz} %0,%1"
- [(set_attr "type" "fp")])
-
-(define_insn "*fix_truncdfsi2_store"
- [(set (reg:DI 76)
- (unspec [(match_operand:DI 0 "gpc_reg_operand" "f")
- (match_operand:SI 1 "gpc_reg_operand" "b")] 15))]
- "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
- "*
-{
- rtx indx;
-
- if (rs6000_fpmem_offset > 32760)
- indx = operands[1];
- else if (frame_pointer_needed)
- indx = frame_pointer_rtx;
- else
- indx = stack_pointer_rtx;
-
- operands[2] = gen_rtx (MEM, DFmode,
- gen_rtx (PLUS, Pmode,
- indx,
- GEN_INT ((((rs6000_fpmem_offset & 0xffff)
- ^ 0x8000) - 0x8000))));
-
- return \"stfd %0,%w2\";
-}"
- [(set_attr "type" "fpstore")])
-
-(define_insn "*fix_truncdfsi2_load"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (unspec [(reg:DI 76)
- (match_operand:SI 1 "gpc_reg_operand" "b")] 16))]
- "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
- "*
-{
- rtx indx;
-
- if (rs6000_fpmem_offset > 32760)
- indx = operands[1];
- else if (frame_pointer_needed)
- indx = frame_pointer_rtx;
- else
- indx = stack_pointer_rtx;
-
- operands[2] = gen_rtx (MEM, DFmode,
- gen_rtx (PLUS, Pmode,
- indx,
- GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
- + ((WORDS_BIG_ENDIAN) ? 4 : 0))));
-
- return \"{l|lwz} %0,%2\";
-}"
- [(set_attr "type" "load")])
-
-(define_expand "fixuns_truncdfsi2"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
- "! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT"
- "
-{
- emit_insn (gen_trunc_call (operands[0], operands[1],
- gen_rtx (SYMBOL_REF, Pmode, RS6000_UITRUNC)));
- DONE;
-}")
-
-(define_expand "trunc_call"
- [(parallel [(set (match_operand:SI 0 "" "")
- (fix:SI (match_operand:DF 1 "" "")))
- (use (match_operand:SI 2 "" ""))])]
- "TARGET_HARD_FLOAT"
- "
-{
- rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
- rtx first = XVECEXP (insns, 0, 0);
- rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
-
- REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
- REG_NOTES (first));
- REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
-
- emit_insn (insns);
- DONE;
-}")
-
-(define_expand "trunc_call_rtl"
- [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
- (use (reg:DF 33))
- (parallel [(set (reg:SI 3)
- (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
- (use (const_int 0))
- (clobber (scratch:SI))])
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (reg:SI 3))]
- "TARGET_HARD_FLOAT"
- "
-{
- rs6000_trunc_used = 1;
-}")
-
-(define_insn "floatdidf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (float:DF (match_operand:DI 1 "gpc_reg_operand" "f")))]
- "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- "fcfid %0,%1"
- [(set_attr "type" "fp")])
-
-(define_insn "fix_truncdfdi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
- (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
- "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
- "fctidz %0,%1"
- [(set_attr "type" "fp")])
-
-;; Define the DImode operations that can be done in a small number
-;; of instructions. The & constraints are to prevent the register
-;; allocator from allocating registers that overlap with the inputs
-;; (for example, having an input in 7,8 and an output in 6,7). We
-;; also allow for the the output being the same as one of the inputs.
-
-(define_insn "*adddi3_noppc64"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
- (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
- (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
- "! TARGET_POWERPC64"
- "*
-{
- if (WORDS_BIG_ENDIAN)
- return (GET_CODE (operands[2])) != CONST_INT
- ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
- : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
- else
- return (GET_CODE (operands[2])) != CONST_INT
- ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
- : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
-}"
- [(set_attr "length" "8")])
-
-(define_insn "*subdi3_noppc64"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
- (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
- (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
- "! TARGET_POWERPC64"
- "*
-{
- if (WORDS_BIG_ENDIAN)
- return (GET_CODE (operands[1]) != CONST_INT)
- ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
- : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
- else
- return (GET_CODE (operands[1]) != CONST_INT)
- ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
- : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
-}"
- [(set_attr "length" "8")])
-
-(define_insn "*negdi2_noppc64"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
- (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
- "! TARGET_POWERPC64"
- "*
-{
- return (WORDS_BIG_ENDIAN)
- ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
- : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
-}"
- [(set_attr "length" "8")])
-
-(define_expand "mulsidi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
- (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
- ""
- "
-{
- if (! TARGET_POWER && ! TARGET_POWERPC)
- {
- emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
- emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
- emit_insn (gen_mull_call ());
- if (WORDS_BIG_ENDIAN)
- emit_move_insn (operands[0], gen_rtx (REG, DImode, 3));
- else
- {
- emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
- gen_rtx (REG, SImode, 3));
- emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
- gen_rtx (REG, SImode, 4));
- }
- DONE;
- }
- else if (TARGET_POWER)
- {
- emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
- DONE;
- }
-}")
-
-(define_insn "mulsidi3_mq"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
- (clobber (match_scratch:SI 3 "=q"))]
- "TARGET_POWER"
- "mul %0,%1,%2\;mfmq %L0"
- [(set_attr "type" "imul")
- (set_attr "length" "8")])
-
-(define_insn "*mulsidi3_powerpc"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
- "TARGET_POWERPC && ! TARGET_POWERPC64"
- "*
-{
- return (WORDS_BIG_ENDIAN)
- ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
- : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
-}"
- [(set_attr "type" "imul")
- (set_attr "length" "8")])
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
- (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
- "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
- [(set (match_dup 3)
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
- (sign_extend:DI (match_dup 2)))
- (const_int 32))))
- (set (match_dup 4)
- (mult:SI (match_dup 1)
- (match_dup 2)))]
- "
-{
- int endian = (WORDS_BIG_ENDIAN == 0);
- operands[3] = operand_subword (operands[0], endian, 0, DImode);
- operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
-}")
-
-(define_insn "umulsidi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
- "TARGET_POWERPC && ! TARGET_POWERPC64"
- "*
-{
- return (WORDS_BIG_ENDIAN)
- ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
- : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
-}"
- [(set_attr "type" "imul")
- (set_attr "length" "8")])
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
- (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
- "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
- [(set (match_dup 3)
- (truncate:SI
- (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
- (zero_extend:DI (match_dup 2)))
- (const_int 32))))
- (set (match_dup 4)
- (mult:SI (match_dup 1)
- (match_dup 2)))]
- "
-{
- int endian = (WORDS_BIG_ENDIAN == 0);
- operands[3] = operand_subword (operands[0], endian, 0, DImode);
- operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
-}")
-
-(define_expand "smulsi3_highpart"
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI
- (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (sign_extend:DI
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 32))))]
- ""
- "
-{
- if (! TARGET_POWER && ! TARGET_POWERPC)
- {
- emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
- emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
- emit_insn (gen_mulh_call ());
- emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
- DONE;
- }
- else if (TARGET_POWER)
- {
- emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
- DONE;
- }
-}")
-
-(define_insn "smulsi3_highpart_mq"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI
- (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (sign_extend:DI
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 32))))
- (clobber (match_scratch:SI 3 "=q"))]
- "TARGET_POWER"
- "mul %0,%1,%2"
- [(set_attr "type" "imul")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI
- (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (sign_extend:DI
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 32))))]
- "TARGET_POWERPC"
- "mulhw %0,%1,%2"
- [(set_attr "type" "imul")])
-
-(define_insn "umulsi3_highpart"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (truncate:SI
- (lshiftrt:DI (mult:DI (zero_extend:DI
- (match_operand:SI 1 "gpc_reg_operand" "%r"))
- (zero_extend:DI
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (const_int 32))))]
- "TARGET_POWERPC"
- "mulhwu %0,%1,%2"
- [(set_attr "type" "imul")])
-
-;; If operands 0 and 2 are in the same register, we have a problem. But
-;; operands 0 and 1 (the usual case) can be in the same register. That's
-;; why we have the strange constraints below.
-(define_insn "ashldi3_power"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
- (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
- (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
- (clobber (match_scratch:SI 3 "=X,q,q,q"))]
- "TARGET_POWER"
- "@
- {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
- sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
- sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
- sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
- [(set_attr "length" "8")])
-
-(define_insn "lshrdi3_power"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r")
- (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
- (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
- (clobber (match_scratch:SI 3 "=X,q,q,q"))]
- "TARGET_POWER"
- "@
- {cal %0,0(0)|li %0,0}\;{s%A2i|s%A2wi} %L0,%1,%h2
- sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
- sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
- sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
- [(set_attr "length" "8")])
-
-;; Shift by a variable amount is too complex to be worth open-coding. We
-;; just handle shifts by constants.
-(define_insn "ashrdi3_power"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
- (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "const_int_operand" "M,i")))
- (clobber (match_scratch:SI 3 "=X,q"))]
- "TARGET_POWER"
- "@
- {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
- sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
- [(set_attr "length" "8")])
-
-;; PowerPC64 DImode operations.
-
-(define_expand "adddi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
- (match_operand:DI 2 "add_operand" "")))]
- ""
- "
-{
- if (! TARGET_POWERPC64 && non_short_cint_operand (operands[2], DImode))
- FAIL;
-}")
-
-;; Discourage ai/addic because of carry but provide it in an alternative
-;; allowing register zero as source.
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
- (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
- (match_operand:DI 2 "add_operand" "r,I,I,J")))]
- "TARGET_POWERPC64"
- "@
- add %0,%1,%2
- addi %0,%1,%2
- addic %0,%1,%2
- addis %0,%1,%v2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
- (match_operand:DI 2 "reg_or_short_operand" "r,I"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r,r"))]
- "TARGET_POWERPC64"
- "@
- add. %3,%1,%2
- addic. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
- (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
- (match_operand:DI 2 "reg_or_short_operand" "r,I"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
- (plus:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "@
- add. %0,%1,%2
- addic. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-;; Split an add that we can't do in one insn into two insns, each of which
-;; does one 16-bit part. This is used by combine. Note that the low-order
-;; add should be last in case the result gets used in an address.
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
- (match_operand:DI 2 "non_add_cint_operand" "")))]
- "TARGET_POWERPC64"
- [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
-"
-{
- HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
- HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
-
- if (low & 0x8000)
- high+=0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
-
- operands[3] = GEN_INT (high);
- operands[4] = GEN_INT (low);
-}")
-
-(define_insn "one_cmpldi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC64"
- "nor %0,%1,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 2 "=r"))]
- "TARGET_POWERPC64"
- "nor. %2,%1,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (not:DI (match_dup 1)))]
- "TARGET_POWERPC64"
- "nor. %0,%1,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
- (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
- (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
- "TARGET_POWERPC64"
- "@
- subf %0,%2,%1
- subfic %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "subf. %3,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (minus:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "subf. %0,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_expand "subdi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
- (match_operand:DI 2 "reg_or_cint_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- emit_insn (gen_adddi3 (operands[0], operands[1],
- negate_rtx (DImode, operands[2])));
- DONE;
- }
-}")
-
-(define_insn "absdi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
- (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
- (clobber (match_scratch:DI 2 "=&r,&r"))]
- "TARGET_POWERPC64"
- "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0"
- [(set_attr "length" "12")])
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
- (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
- (clobber (match_scratch:DI 2 "=&r,&r"))]
- "TARGET_POWERPC64 && reload_completed"
- [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
- (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
- (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
- (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
- (clobber (match_scratch:DI 2 "=&r,&r"))]
- "TARGET_POWERPC64"
- "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2"
- [(set_attr "length" "12")])
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
- (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
- (clobber (match_scratch:DI 2 "=&r,&r"))]
- "TARGET_POWERPC64 && reload_completed"
- [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
- (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
- (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
- "")
-
-(define_expand "negdi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC64"
- "neg %0,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 2 "=r"))]
- "TARGET_POWERPC64"
- "neg. %2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (neg:DI (match_dup 1)))]
- "TARGET_POWERPC64"
- "neg. %0,%1"
- [(set_attr "type" "compare")])
-
-(define_insn "ffsdi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
- (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC64"
- "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
- [(set_attr "length" "16")])
-
-(define_insn "muldi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
- (match_operand:DI 2 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC64"
- "mulld %0,%1,%2"
- [(set_attr "type" "imul")])
-
-(define_insn "smuldi3_highpart"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (truncate:DI
- (lshiftrt:TI (mult:TI (sign_extend:TI
- (match_operand:DI 1 "gpc_reg_operand" "%r"))
- (sign_extend:TI
- (match_operand:DI 2 "gpc_reg_operand" "r")))
- (const_int 64))))]
- "TARGET_POWERPC64"
- "mulhd %0,%1,%2"
- [(set_attr "type" "imul")])
-
-(define_insn "umuldi3_highpart"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (truncate:DI
- (lshiftrt:TI (mult:TI (zero_extend:TI
- (match_operand:DI 1 "gpc_reg_operand" "%r"))
- (zero_extend:TI
- (match_operand:DI 2 "gpc_reg_operand" "r")))
- (const_int 64))))]
- "TARGET_POWERPC64"
- "mulhdu %0,%1,%2"
- [(set_attr "type" "imul")])
-
-(define_expand "divdi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
- (match_operand:DI 2 "reg_or_cint_operand" "")))]
- "TARGET_POWERPC64"
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && exact_log2 (INTVAL (operands[2])) >= 0)
- ;
- else
- operands[2] = force_reg (DImode, operands[2]);
-}")
-
-(define_expand "moddi3"
- [(use (match_operand:DI 0 "gpc_reg_operand" ""))
- (use (match_operand:DI 1 "gpc_reg_operand" ""))
- (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
- "TARGET_POWERPC64"
- "
-{
- int i = exact_log2 (INTVAL (operands[2]));
- rtx temp1;
- rtx temp2;
-
- if (GET_CODE (operands[2]) != CONST_INT || i < 0)
- FAIL;
-
- temp1 = gen_reg_rtx (DImode);
- temp2 = gen_reg_rtx (DImode);
-
- emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
- emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
- emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
- DONE;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "const_int_operand" "N")))]
- "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
- "sradi %0,%1,%p2\;addze %0,%0"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "const_int_operand" "N"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
- "sradi %3,%1,%p2\;addze. %3,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "const_int_operand" "N"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (div:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
- "sradi %0,%1,%p2\;addze. %0,%0"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC64"
- "divd %0,%1,%2"
- [(set_attr "type" "idiv")])
-
-(define_insn "udivdi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC64"
- "divdu %0,%1,%2"
- [(set_attr "type" "idiv")])
-
-(define_insn "rotldi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
- "TARGET_POWERPC64"
- "rld%I2cl %0,%1,%H2,0")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "rld%I2cl. %3,%1,%H2,0"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (rotate:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "rld%I2cl. %0,%1,%H2,0"
- [(set_attr "type" "delayed_compare")])
-
-(define_expand "ashldi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_cint_operand" "")))]
- "TARGET_POWERPC64 || TARGET_POWER"
- "
-{
- if (TARGET_POWERPC64)
- ;
- else if (TARGET_POWER)
- {
- emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
- DONE;
- }
- else
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
- "TARGET_POWERPC64"
- "sld%I2 %0,%1,%H2"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "sld%I2. %3,%1,%H2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (ashift:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "sld%I2. %0,%1,%H2"
- [(set_attr "type" "delayed_compare")])
-
-(define_expand "lshrdi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_cint_operand" "")))]
- "TARGET_POWERPC64 || TARGET_POWER"
- "
-{
- if (TARGET_POWERPC64)
- ;
- else if (TARGET_POWER)
- {
- emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
- DONE;
- }
- else
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
- "TARGET_POWERPC64"
- "srd%I2 %0,%1,%H2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "srd%I2. %3,%1,%H2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (lshiftrt:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "srd%I2. %0,%1,%H2"
- [(set_attr "type" "delayed_compare")])
-
-(define_expand "ashrdi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "reg_or_cint_operand" "")))]
- "TARGET_POWERPC64 || TARGET_POWER"
- "
-{
- if (TARGET_POWERPC64)
- ;
- else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
- {
- emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
- DONE;
- }
- else
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
- "TARGET_POWERPC64"
- "srad%I2 %0,%1,%H2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "srad%I2. %3,%1,%H2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_cint_operand" "ri"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (ashiftrt:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "srad%I2. %0,%1,%H2"
- [(set_attr "type" "delayed_compare")])
-
-(define_insn "anddi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
- (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
- (match_operand:DI 2 "and_operand" "?r,K,J")))
- (clobber (match_scratch:CC 3 "=X,x,x"))]
- "TARGET_POWERPC64"
- "@
- and %0,%1,%2
- andi. %0,%1,%b2
- andis. %0,%1,%u2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
- (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
- (match_operand:DI 2 "and_operand" "r,K,J"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r,r,r"))]
- "TARGET_POWERPC64"
- "@
- and. %3,%1,%2
- andi. %3,%1,%b2
- andis. %3,%1,%u2"
- [(set_attr "type" "compare,compare,compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x")
- (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
- (match_operand:DI 2 "and_operand" "r,K,J"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
- (and:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "@
- and. %0,%1,%2
- andi. %0,%1,%b2
- andis. %0,%1,%u2"
- [(set_attr "type" "compare,compare,compare")])
-
-;; Take a AND with a constant that cannot be done in a single insn and try to
-;; split it into two insns. This does not verify that the insns are valid
-;; since this need not be done as combine will do it.
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
- (match_operand:DI 2 "non_and_cint_operand" "")))]
- "TARGET_POWERPC64"
- [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
- "
-{
- int maskval = INTVAL (operands[2]);
- int i, transitions, last_bit_value;
- int orig = maskval, first_c = maskval, second_c;
-
- /* We know that MASKVAL must have more than 2 bit-transitions. Start at
- the low-order bit and count for the third transition. When we get there,
- make a first mask that has everything to the left of that position
- a one. Then make the second mask to turn off whatever else is needed. */
-
- for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
- {
- if (((maskval >>= 1) & 1) != last_bit_value)
- last_bit_value ^= 1, transitions++;
-
- if (transitions > 2)
- {
- first_c |= (~0) << i;
- break;
- }
- }
-
- second_c = orig | ~ first_c;
-
- operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
- operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
-}")
-
-(define_insn "iordi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
- (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
- (match_operand:DI 2 "logical_operand" "r,K,J")))]
- "TARGET_POWERPC64"
- "@
- or %0,%1,%2
- ori %0,%1,%b2
- oris %0,%1,%u2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "or. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (ior:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "or. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-;; Split an IOR 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
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
- (match_operand:DI 2 "non_logical_cint_operand" "")))]
- "TARGET_POWERPC64"
- [(set (match_dup 0) (ior:DI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (ior:DI (match_dup 0) (match_dup 4)))]
-"
-{
- operands[3] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
- operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
-}")
-
-(define_insn "xordi3"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
- (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
- (match_operand:DI 2 "logical_operand" "r,K,J")))]
- "TARGET_POWERPC64"
- "@
- xor %0,%1,%2
- xori %0,%1,%b2
- xoris %0,%1,%u2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "xor. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (xor:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "xor. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-;; Split an XOR 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
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
- (match_operand:DI 2 "non_logical_cint_operand" "")))]
- "TARGET_POWERPC64"
- [(set (match_dup 0) (xor:DI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 4)))]
-"
-{
- operands[3] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[2]) & 0xffff0000);
- operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
-}")
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
- (match_operand:DI 2 "gpc_reg_operand" "r"))))]
- "TARGET_POWERPC64"
- "eqv %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
- (match_operand:DI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "eqv. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
- (match_operand:DI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (not:DI (xor:DI (match_dup 1) (match_dup 2))))]
- "TARGET_POWERPC64"
- "eqv. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (match_operand:DI 2 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC64"
- "andc %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "andc. %3,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (and:DI (not:DI (match_dup 1)) (match_dup 2)))]
- "TARGET_POWERPC64"
- "andc. %0,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (match_operand:DI 2 "gpc_reg_operand" "r")))]
- "TARGET_POWERPC64"
- "orc %0,%2,%1")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "orc. %3,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
- (match_operand:DI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (ior:DI (not:DI (match_dup 1)) (match_dup 2)))]
- "TARGET_POWERPC64"
- "orc. %0,%2,%1"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
- (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
- "TARGET_POWERPC64"
- "nand %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
- (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "nand. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
- (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (ior:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
- "TARGET_POWERPC64"
- "nand. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
- (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
- "TARGET_POWERPC64"
- "nor %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
- (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (clobber (match_scratch:DI 3 "=r"))]
- "TARGET_POWERPC64"
- "nor. %3,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
- (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (and:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
- "TARGET_POWERPC64"
- "nor. %0,%1,%2"
- [(set_attr "type" "compare")])
-
-;; Now define ways of moving data around.
-
-;; Elf specific ways of loading addresses for non-PIC code.
-;; The output of this could be r0, but we limit it to base
-;; registers, since almost all uses of this will need it
-;; in a base register shortly.
-(define_insn "elf_high"
- [(set (match_operand:SI 0 "register_operand" "=b")
- (high:SI (match_operand 1 "" "")))]
- "TARGET_ELF && !TARGET_64BIT"
- "{cau|addis} %0,0,%1@ha")
-
-(define_insn "elf_low"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "b")
- (match_operand 2 "" "")))]
- "TARGET_ELF && !TARGET_64BIT"
- "{cal %0,%a2@l(%1)|addi %0,%1,%2@l}")
-
-;; Set up a register with a value from the GOT table
-
-(define_expand "movsi_got"
- [(set (match_operand:SI 0 "register_operand" "")
- (unspec [(match_operand:SI 1 "got_operand" "")
- (match_dup 2)] 8))]
- "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
- "
-{
- operands[2] = rs6000_got_register (operands[1]);
-}")
-
-(define_insn "*movsi_got_internal"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (unspec [(match_operand:SI 1 "got_operand" "")
- (match_operand:SI 2 "register_operand" "b")] 8))]
- "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
- "{l|lwz} %0,%a1@got(%2)"
- [(set_attr "type" "load")])
-
-;; For SI, we special-case integers that can't be loaded in one insn. We
-;; do the load 16-bits at a time. We could do this by loading from memory,
-;; and this is even supposed to be faster, but it is simpler not to get
-;; integers in the TOC.
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "any_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (SImode, operands[1]);
-
- /* Convert a move of a CONST_DOUBLE into a CONST_INT */
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
-
- /* Use default pattern for address of ELF small data */
- if (TARGET_ELF
- && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- && (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
- && small_data_operand (operands[1], SImode))
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
- }
-
- if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- && flag_pic == 1 && got_operand (operands[1], SImode))
- {
- emit_insn (gen_movsi_got (operands[0], operands[1]));
- DONE;
- }
-
- if (TARGET_ELF && TARGET_NO_TOC && !TARGET_64BIT
- && !flag_pic
- && CONSTANT_P (operands[1])
- && GET_CODE (operands[1]) != HIGH
- && GET_CODE (operands[1]) != CONST_INT)
- {
- rtx target = (reload_completed || reload_in_progress)
- ? operands[0] : gen_reg_rtx (SImode);
-
- /* If this is a function address on -mcall-aixdesc or -mcall-nt,
- convert it to the address of the descriptor. */
- if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
- && GET_CODE (operands[1]) == SYMBOL_REF
- && XSTR (operands[1], 0)[0] == '.')
- {
- char *name = XSTR (operands[1], 0);
- rtx new_ref;
- while (*name == '.')
- name++;
- new_ref = gen_rtx (SYMBOL_REF, Pmode, name);
- CONSTANT_POOL_ADDRESS_P (new_ref) = CONSTANT_POOL_ADDRESS_P (operands[1]);
- SYMBOL_REF_FLAG (new_ref) = SYMBOL_REF_FLAG (operands[1]);
- SYMBOL_REF_USED (new_ref) = SYMBOL_REF_USED (operands[1]);
- operands[1] = new_ref;
- }
-
- emit_insn (gen_elf_high (target, operands[1]));
- emit_insn (gen_elf_low (operands[0], target, operands[1]));
- DONE;
- }
-
- if (GET_CODE (operands[1]) == CONST
- && DEFAULT_ABI == ABI_NT
- && !side_effects_p (operands[0]))
- {
- rtx const_term = const0_rtx;
- rtx sym = eliminate_constant_term (XEXP (operands[1], 0), &const_term);
- if (sym && GET_CODE (const_term) == CONST_INT
- && (GET_CODE (sym) == SYMBOL_REF || GET_CODE (sym) == LABEL_REF))
- {
- unsigned HOST_WIDE_INT value = INTVAL (const_term);
- int new_reg_p = (flag_expensive_optimizations
- && !reload_completed
- && !reload_in_progress);
- rtx tmp1 = (new_reg_p && value != 0) ? gen_reg_rtx (SImode) : operands[0];
-
- emit_insn (gen_movsi (tmp1, sym));
- if (INTVAL (const_term) != 0)
- {
- if (value + 0x8000 < 0x10000)
- emit_insn (gen_addsi3 (operands[0], tmp1, GEN_INT (value)));
-
- else
- {
- HOST_WIDE_INT high_int = value & (~ (HOST_WIDE_INT) 0xffff);
- HOST_WIDE_INT low_int = value & 0xffff;
- rtx tmp2 = (!new_reg_p || !low_int) ? operands[0] : gen_reg_rtx (Pmode);
-
- if (low_int & 0x8000)
- high_int += 0x10000, low_int |= ((HOST_WIDE_INT) -1) << 16;
-
- emit_insn (gen_addsi3 (tmp2, tmp1, GEN_INT (high_int)));
- if (low_int)
- emit_insn (gen_addsi3 (operands[0], tmp2, GEN_INT (low_int)));
- }
- }
- DONE;
- }
- else
- fatal_insn (\"bad address\", operands[1]);
- }
-
- if ((!TARGET_WINDOWS_NT || DEFAULT_ABI != ABI_NT)
- && CONSTANT_P (operands[1])
- && GET_CODE (operands[1]) != CONST_INT
- && GET_CODE (operands[1]) != HIGH
- && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
- {
- /* Emit a USE operation so that the constant isn't deleted if
- expensive optimizations are turned on because nobody
- references it. This should only be done for operands that
- contain SYMBOL_REFs with CONSTANT_POOL_ADDRESS_P set.
- This should not be done for operands that contain LABEL_REFs.
- For now, we just handle the obvious case. */
- if (GET_CODE (operands[1]) != LABEL_REF)
- emit_insn (gen_rtx (USE, VOIDmode, operands[1]));
-
- /* If we are to limit the number of things we put in the TOC and
- this is a symbol plus a constant we can add in one insn,
- just put the symbol in the TOC and add the constant. Don't do
- this if reload is in progress. */
- if (GET_CODE (operands[1]) == CONST
- && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
- && GET_CODE (XEXP (operands[1], 0)) == PLUS
- && add_operand (XEXP (XEXP (operands[1], 0), 1), SImode)
- && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
- || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
- && ! side_effects_p (operands[0]))
- {
- rtx sym = force_const_mem (SImode, XEXP (XEXP (operands[1], 0), 0));
- rtx other = XEXP (XEXP (operands[1], 0), 1);
-
- emit_insn (gen_addsi3 (operands[0], force_reg (SImode, sym), other));
- DONE;
- }
-
- operands[1] = force_const_mem (SImode, operands[1]);
- if (! memory_address_p (SImode, XEXP (operands[1], 0))
- && ! reload_in_progress)
- operands[1] = change_address (operands[1], SImode,
- XEXP (operands[1], 0));
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,r,r,r,r,r,*q,*c*l,*h")
- (match_operand:SI 1 "input_operand" "r,S,T,U,m,r,I,J,n,R,*h,r,r,0"))]
- "gpc_reg_operand (operands[0], SImode)
- || gpc_reg_operand (operands[1], SImode)"
- "@
- mr %0,%1
- {l|lwz} %0,[toc]%1(2)
- {l|lwz} %0,[toc]%l1(2)
- {cal|la} %0,%a1
- {l%U1%X1|lwz%U1%X1} %0,%1
- {st%U0%X0|stw%U0%X0} %1,%0
- {lil|li} %0,%1
- {liu|lis} %0,%v1
- #
- {cal|la} %0,%1(%*)
- mf%1 %0
- mt%0 %1
- mt%0 %1
- cror 0,0,0"
- [(set_attr "type" "*,load,load,*,load,store,*,*,*,*,*,*,mtjmpr,*")
- (set_attr "length" "4,4,4,4,4,4,4,4,8,4,4,4,4,4")])
-
-;; Split a load of a large constant into the appropriate two-insn
-;; sequence.
-
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (match_operand:SI 1 "const_int_operand" ""))]
- "(unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
- && (INTVAL (operands[1]) & 0xffff) != 0"
- [(set (match_dup 0)
- (match_dup 2))
- (set (match_dup 0)
- (ior:SI (match_dup 0)
- (match_dup 3)))]
- "
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[1]) & 0xffff0000);
- operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
-}")
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
- ""
- "mr. %0,%1"
- [(set_attr "type" "compare")])
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "any_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (HImode, operands[1]);
-
- if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
- {
- operands[1] = force_const_mem (HImode, operands[1]);
- if (! memory_address_p (HImode, XEXP (operands[1], 0))
- && ! reload_in_progress)
- operands[1] = change_address (operands[1], HImode,
- XEXP (operands[1], 0));
- }
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
- (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
- "gpc_reg_operand (operands[0], HImode)
- || gpc_reg_operand (operands[1], HImode)"
- "@
- mr %0,%1
- lhz%U1%X1 %0,%1
- sth%U0%X0 %1,%0
- {lil|li} %0,%w1
- mf%1 %0
- mt%0 %1
- mt%0 %1
- cror 0,0,0"
- [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "any_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (QImode, operands[1]);
-
- if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
- {
- operands[1] = force_const_mem (QImode, operands[1]);
- if (! memory_address_p (QImode, XEXP (operands[1], 0))
- && ! reload_in_progress)
- operands[1] = change_address (operands[1], QImode,
- XEXP (operands[1], 0));
- }
-}")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
- (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
- "gpc_reg_operand (operands[0], QImode)
- || gpc_reg_operand (operands[1], QImode)"
- "@
- mr %0,%1
- lbz%U1%X1 %0,%1
- stb%U0%X0 %1,%0
- {lil|li} %0,%1
- mf%1 %0
- mt%0 %1
- mt%0 %1
- cror 0,0,0"
- [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
-
-;; Here is how to move condition codes around. When we store CC data in
-;; an integer register or memory, we store just the high-order 4 bits.
-;; This lets us not shift in the most common case of CR0.
-(define_expand "movcc"
- [(set (match_operand:CC 0 "nonimmediate_operand" "")
- (match_operand:CC 1 "nonimmediate_operand" ""))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
- (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
- "register_operand (operands[0], CCmode)
- || register_operand (operands[1], CCmode)"
- "@
- mcrf %0,%1
- mtcrf 128,%1
- {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
- mfcr %0
- mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
- mr %0,%1
- {l%U1%X1|lwz%U1%X1} %0,%1
- {st%U0%U1|stw%U0%U1} %1,%0"
- [(set_attr "type" "*,*,*,compare,*,*,load,store")
- (set_attr "length" "*,*,12,*,8,*,*,*")])
-
-;; For floating-point, we normally deal with the floating-point registers
-;; unless -msoft-float is used. The sole exception is that parameter passing
-;; can produce floating-point values in fixed-point registers. Unless the
-;; value is a simple constant or already in memory, we deal with this by
-;; allocating memory and copying the value explicitly via that memory location.
-(define_expand "movsf"
- [(set (match_operand:SF 0 "nonimmediate_operand" "")
- (match_operand:SF 1 "any_operand" ""))]
- ""
- "
-{
- /* If we are called from reload, we might be getting a SUBREG of a hard
- reg. So expand it. */
- if (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
- operands[0] = alter_subreg (operands[0]);
- if (GET_CODE (operands[1]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[1])) == REG
- && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
- operands[1] = alter_subreg (operands[1]);
-
- if (TARGET_SOFT_FLOAT && GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (SFmode, operands[1]);
-
- else if (TARGET_HARD_FLOAT)
- {
- if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
- {
- /* If this is a store to memory or another integer register do the
- move directly. Otherwise store to a temporary stack slot and
- load from there into a floating point register. */
-
- if (GET_CODE (operands[0]) == MEM
- || (GET_CODE (operands[0]) == REG
- && (REGNO (operands[0]) < 32
- || (reload_in_progress
- && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))))
- {
- emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
- operand_subword (operands[1], 0, 0, SFmode));
- DONE;
- }
- else
- {
- rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
-
- emit_move_insn (stack_slot, operands[1]);
- emit_move_insn (operands[0], stack_slot);
- DONE;
- }
- }
-
- if (GET_CODE (operands[0]) == MEM)
- {
- /* If operands[1] is a register, it may have double-precision data
- in it, so truncate it to single precision. We need not do
- this for POWERPC. */
- if (! TARGET_POWERPC && TARGET_HARD_FLOAT
- && GET_CODE (operands[1]) == REG)
- {
- rtx newreg
- = reload_in_progress ? operands[1] : gen_reg_rtx (SFmode);
- emit_insn (gen_aux_truncdfsf2 (newreg, operands[1]));
- operands[1] = newreg;
- }
-
- operands[1] = force_reg (SFmode, operands[1]);
- }
-
- if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
- {
- if (GET_CODE (operands[1]) == MEM
-#if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
- || GET_CODE (operands[1]) == CONST_DOUBLE
-#endif
- || (GET_CODE (operands[1]) == REG
- && (REGNO (operands[1]) < 32
- || (reload_in_progress
- && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))))
- {
- emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
- operand_subword (operands[1], 0, 0, SFmode));
- DONE;
- }
- else
- {
- rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
-
- emit_move_insn (stack_slot, operands[1]);
- emit_move_insn (operands[0], stack_slot);
- DONE;
- }
- }
- }
-
- if (CONSTANT_P (operands[1]) && TARGET_HARD_FLOAT)
- {
- operands[1] = force_const_mem (SFmode, operands[1]);
- if (! memory_address_p (SFmode, XEXP (operands[1], 0))
- && ! reload_in_progress)
- operands[1] = change_address (operands[1], SFmode,
- XEXP (operands[1], 0));
- }
-}")
-
-(define_split
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
- (match_operand:SF 1 "const_double_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], SFmode) <= 1
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
- [(set (match_dup 2) (match_dup 3))]
- "
-{
- long l;
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
- REAL_VALUE_TO_TARGET_SINGLE (rv, l);
-
- operands[2] = operand_subword (operands[0], 0, 0, SFmode);
- operands[3] = GEN_INT(l);
-}")
-
-(define_split
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
- (match_operand:SF 1 "const_double_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], SFmode) == 2
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 4)))]
- "
-{
- long l;
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
- REAL_VALUE_TO_TARGET_SINGLE (rv, l);
-
- operands[2] = operand_subword (operands[0], 0, 0, SFmode);
- operands[3] = GEN_INT(l & 0xffff0000);
- operands[4] = GEN_INT(l & 0x0000ffff);
-}")
-
-(define_insn "*movsf_hardfloat"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,m,!r,!r")
- (match_operand:SF 1 "input_operand" "f,m,f,G,Fn"))]
- "(gpc_reg_operand (operands[0], SFmode)
- || gpc_reg_operand (operands[1], SFmode)) && TARGET_HARD_FLOAT"
- "@
- fmr %0,%1
- lfs%U1%X1 %0,%1
- stfs%U0%X0 %1,%0
- #
- #"
- [(set_attr "type" "fp,fpload,fpstore,*,*")
- (set_attr "length" "4,4,4,4,8")])
-
-(define_insn "*movsf_softfloat"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,r")
- (match_operand:SF 1 "input_operand" "r,m,r,I,J,R,G,Fn"))]
- "(gpc_reg_operand (operands[0], SFmode)
- || gpc_reg_operand (operands[1], SFmode)) && TARGET_SOFT_FLOAT"
- "@
- mr %0,%1
- {l%U1%X1|lwz%U1%X1} %0,%1
- {st%U0%X0|stw%U0%X0} %1,%0
- {lil|li} %0,%1
- {liu|lis} %0,%v1
- {cal|la} %0,%1(%*)
- #
- #"
- [(set_attr "type" "*,load,store,*,*,*,*,*")
- (set_attr "length" "4,4,4,4,4,4,4,8")])
-
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "nonimmediate_operand" "")
- (match_operand:DF 1 "any_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (DFmode, operands[1]);
-
- /* Stores between FPR and any non-FPR registers must go through a
- temporary stack slot. */
-
- if (TARGET_POWERPC64
- && GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
- && ((FP_REGNO_P (REGNO (operands[0]))
- && ! FP_REGNO_P (REGNO (operands[1])))
- || (FP_REGNO_P (REGNO (operands[1]))
- && ! FP_REGNO_P (REGNO (operands[0])))))
- {
- rtx stack_slot = assign_stack_temp (DFmode, 8, 0);
-
- emit_move_insn (stack_slot, operands[1]);
- emit_move_insn (operands[0], stack_slot);
- DONE;
- }
-
- if (CONSTANT_P (operands[1]) && ! easy_fp_constant (operands[1], DFmode))
- {
- operands[1] = force_const_mem (DFmode, operands[1]);
- if (! memory_address_p (DFmode, XEXP (operands[1], 0))
- && ! reload_in_progress)
- operands[1] = change_address (operands[1], DFmode,
- XEXP (operands[1], 0));
- }
-}")
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (match_operand:DF 1 "const_int_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) <= 1
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
- [(set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (match_dup 1))]
- "
-{
- int endian = (WORDS_BIG_ENDIAN == 0);
- operands[2] = operand_subword (operands[0], endian, 0, DFmode);
- operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
- operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
-}")
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (match_operand:DF 1 "const_int_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) >= 2
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
- [(set (match_dup 3) (match_dup 5))
- (set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 6)))]
- "
-{
- HOST_WIDE_INT value = INTVAL (operands[1]);
- int endian = (WORDS_BIG_ENDIAN == 0);
- operands[2] = operand_subword (operands[0], endian, 0, DFmode);
- operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
- operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
- operands[5] = GEN_INT (value & 0xffff0000);
- operands[6] = GEN_INT (value & 0x0000ffff);
-}")
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (match_operand:DF 1 "const_double_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) <= 2
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
- [(set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (match_dup 5))]
- "
-{
- int endian = (WORDS_BIG_ENDIAN == 0);
- operands[2] = operand_subword (operands[0], endian, 0, DFmode);
- operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
-
-#ifdef HOST_WORDS_BIG_ENDIAN
- operands[4] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
- operands[5] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
-#else
- operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
- operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
-#endif
-}")
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (match_operand:DF 1 "const_double_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) == 3
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
- [(set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (match_dup 5))
- (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))]
- "
-{
- HOST_WIDE_INT high;
- HOST_WIDE_INT low;
- int endian = (WORDS_BIG_ENDIAN == 0);
- rtx high_reg = operand_subword (operands[0], endian, 0, DFmode);
- rtx low_reg = operand_subword (operands[0], 1 - endian, 0, DFmode);
-
-#ifdef HOST_WORDS_BIG_ENDIAN
- high = CONST_DOUBLE_LOW (operands[1]);
- low = CONST_DOUBLE_HIGH (operands[1]);
-#else
- high = CONST_DOUBLE_HIGH (operands[1]);
- low = CONST_DOUBLE_LOW (operands[1]);
-#endif
-
- if (((unsigned HOST_WIDE_INT) (low + 0x8000) < 0x10000)
- || (low & 0xffff) == 0)
- {
- operands[2] = high_reg;
- operands[3] = low_reg;
- operands[4] = GEN_INT (high & 0xffff0000);
- operands[5] = GEN_INT (low);
- operands[6] = GEN_INT (high & 0x0000ffff);
- }
- else
- {
- operands[2] = low_reg;
- operands[3] = high_reg;
- operands[4] = GEN_INT (low & 0xffff0000);
- operands[5] = GEN_INT (high);
- operands[6] = GEN_INT (low & 0x0000ffff);
- }
-}")
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (match_operand:DF 1 "const_double_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) >= 4
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
- [(set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (match_dup 5))
- (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))
- (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 7)))]
- "
-{
- HOST_WIDE_INT high = CONST_DOUBLE_HIGH (operands[1]);
- HOST_WIDE_INT low = CONST_DOUBLE_LOW (operands[1]);
- int endian = (WORDS_BIG_ENDIAN == 0);
-
- operands[2] = operand_subword (operands[0], endian, 0, DFmode);
- operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
- operands[4] = GEN_INT (high & 0xffff0000);
- operands[5] = GEN_INT (low & 0xffff0000);
- operands[6] = GEN_INT (high & 0x0000ffff);
- operands[7] = GEN_INT (low & 0x0000ffff);
-}")
-
-(define_split
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
- (match_operand:DF 1 "easy_fp_constant" ""))]
- "TARGET_64BIT && reload_completed
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
- || (GET_CODE (operands[0]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[0])) == REG
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
- [(set (match_dup 2) (subreg:DI (match_dup 1) 0))]
- "
-{ operands[2] = gen_lowpart (DImode, operands[0]); }")
-
-;; Don't have reload use general registers to load a constant. First,
-;; it might not work if the output operand has is the equivalent of
-;; a non-offsettable memref, but also it is less efficient than loading
-;; the constant into an FP register, since it will probably be used there.
-;; The "??" is a kludge until we can figure out a more reasonable way
-;; of handling these non-offsettable values.
-(define_insn "*movdf_hardfloat32"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,!r,!r,f,f,m")
- (match_operand:DF 1 "input_operand" "r,o,r,G,H,F,f,m,f"))]
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- /* We normally copy the low-numbered register first. However, if
- the first register operand 0 is the same as the second register of
- operand 1, we must copy in the opposite order. */
- if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
- return \"mr %L0,%L1\;mr %0,%1\";
- else
- return \"mr %0,%1\;mr %L0,%L1\";
- case 1:
- /* If the low-address word is used in the address, we must load it
- last. Otherwise, load it first. Note that we cannot have
- auto-increment in that case since the address register is known to be
- dead. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands [1], 0))
- return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
- else
- return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
- case 2:
- return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
- case 3:
- case 4:
- case 5:
- return \"#\";
- case 6:
- return \"fmr %0,%1\";
- case 7:
- return \"lfd%U1%X1 %0,%1\";
- case 8:
- return \"stfd%U0%X0 %1,%0\";
- }
-}"
- [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
- (set_attr "length" "8,8,8,8,12,16,*,*,*")])
-
-(define_insn "*movdf_softfloat32"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r,r,r")
- (match_operand:DF 1 "input_operand" "r,o,r,G,H,F"))]
- "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- /* We normally copy the low-numbered register first. However, if
- the first register operand 0 is the same as the second register of
- operand 1, we must copy in the opposite order. */
- if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
- return \"mr %L0,%L1\;mr %0,%1\";
- else
- return \"mr %0,%1\;mr %L0,%L1\";
- case 1:
- /* If the low-address word is used in the address, we must load it
- last. Otherwise, load it first. Note that we cannot have
- auto-increment in that case since the address register is known to be
- dead. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands [1], 0))
- return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
- else
- return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
- case 2:
- return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
- case 3:
- case 4:
- case 5:
- return \"#\";
- }
-}"
- [(set_attr "type" "*,load,store,*,*,*")
- (set_attr "length" "8,8,8,8,12,16")])
-
-(define_insn "*movdf_hardfloat64"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,!r,!r,f,f,m")
- (match_operand:DF 1 "input_operand" "r,o,r,G,H,F,f,m,f"))]
- "TARGET_POWERPC64 && TARGET_HARD_FLOAT
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode))"
- "@
- mr %0,%1
- ld%U1%X1 %0,%1
- std%U0%X0 %1,%0
- #
- #
- #
- fmr %0,%1
- lfd%U1%X1 %0,%1
- stfd%U0%X0 %1,%0"
- [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
- (set_attr "length" "4,4,4,8,12,16,4,4,4")])
-
-(define_insn "*movdf_softfloat64"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r,r,r")
- (match_operand:DF 1 "input_operand" "r,o,r,G,H,F"))]
- "TARGET_POWERPC64 && TARGET_SOFT_FLOAT
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode))"
- "@
- mr %0,%1
- ld%U1%X1 %0,%1
- std%U0%X0 %1,%0
- #
- #
- #"
- [(set_attr "type" "*,load,store,*,*,*")
- (set_attr "length" "*,*,*,8,12,16")])
-
-;; Next come the multi-word integer load and store and the load and store
-;; multiple insns.
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_operand" "")
- (match_operand:DI 1 "any_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) != REG)
- operands[1] = force_reg (DImode, operands[1]);
-
- if (TARGET_64BIT
- && (GET_CODE (operands[1]) == CONST_DOUBLE
- || GET_CODE (operands[1]) == CONST_INT))
- {
- HOST_WIDE_INT low;
- HOST_WIDE_INT high;
-
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- low = CONST_DOUBLE_LOW (operands[1]);
- high = CONST_DOUBLE_HIGH (operands[1]);
- }
- else
-#if HOST_BITS_PER_WIDE_INT == 32
- {
- low = INTVAL (operands[1]);
- high = (low < 0) ? ~0 : 0;
- }
-#else
- {
- low = INTVAL (operands[1]) & 0xffffffff;
- high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
- }
-#endif
-
- if (high)
- {
- emit_move_insn (operands[0], GEN_INT (high));
- emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT(32)));
- if (low)
- {
- HOST_WIDE_INT low_low = low & 0xffff;
- HOST_WIDE_INT low_high = low & (~ (HOST_WIDE_INT) 0xffff);
- if (low_high)
- emit_insn (gen_iordi3 (operands[0], operands[0],
- GEN_INT (low_high)));
- if (low_low)
- emit_insn (gen_iordi3 (operands[0], operands[0],
- GEN_INT (low_low)));
- }
- DONE;
- }
- }
-
- /* Stores between FPR and any non-FPR registers must go through a
- temporary stack slot. */
-
- if (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
- && ((FP_REGNO_P (REGNO (operands[0]))
- && ! FP_REGNO_P (REGNO (operands[1])))
- || (FP_REGNO_P (REGNO (operands[1]))
- && ! FP_REGNO_P (REGNO (operands[0])))))
- {
- rtx stack_slot = assign_stack_temp (DImode, 8, 0);
-
- emit_move_insn (stack_slot, operands[1]);
- emit_move_insn (operands[0], stack_slot);
- DONE;
- }
-}")
-
-(define_insn "*movdi_32"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
- (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
- "TARGET_32BIT
- && (gpc_reg_operand (operands[0], DImode)
- || gpc_reg_operand (operands[1], DImode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- /* We normally copy the low-numbered register first. However, if
- the first register operand 0 is the same as the second register of
- operand 1, we must copy in the opposite order. */
- if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
- return \"mr %L0,%L1\;mr %0,%1\";
- else
- return \"mr %0,%1\;mr %L0,%L1\";
- case 1:
- /* If the low-address word is used in the address, we must load it
- last. Otherwise, load it first. Note that we cannot have
- auto-increment in that case since the address register is known to be
- dead. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands [1], 0))
- return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
- else
- return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
- case 2:
- return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
- case 3:
- return \"fmr %0,%1\";
- case 4:
- return \"lfd%U1%X1 %0,%1\";
- case 5:
- return \"stfd%U0%X0 %1,%0\";
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- return \"#\";
- }
-}"
- [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
- (set_attr "length" "8,8,8,*,*,*,8,12,8,12,16")])
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (match_operand:DI 1 "const_int_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) <= 1"
- [(set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (match_dup 1))]
- "
-{
- operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
- operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
- operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
-}")
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (match_operand:DI 1 "const_int_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) >= 2"
- [(set (match_dup 3) (match_dup 5))
- (set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 6)))]
- "
-{
- HOST_WIDE_INT value = INTVAL (operands[1]);
- operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
- operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
- operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
- operands[5] = GEN_INT (value & 0xffff0000);
- operands[6] = GEN_INT (value & 0x0000ffff);
-}")
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (match_operand:DI 1 "const_double_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) <= 2"
- [(set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (match_dup 5))]
- "
-{
- operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
- operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
- operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
- operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
-}")
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (match_operand:DI 1 "const_double_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) == 3"
- [(set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (match_dup 5))
- (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))]
- "
-{
- HOST_WIDE_INT high = CONST_DOUBLE_HIGH (operands[1]);
- HOST_WIDE_INT low = CONST_DOUBLE_LOW (operands[1]);
- rtx high_reg = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
- rtx low_reg = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
-
- if (((unsigned HOST_WIDE_INT) (low + 0x8000) < 0x10000)
- || (low & 0xffff) == 0)
- {
- operands[2] = high_reg;
- operands[3] = low_reg;
- operands[4] = GEN_INT (high & 0xffff0000);
- operands[5] = GEN_INT (low);
- operands[6] = GEN_INT (high & 0x0000ffff);
- }
- else
- {
- operands[2] = low_reg;
- operands[3] = high_reg;
- operands[4] = GEN_INT (low & 0xffff0000);
- operands[5] = GEN_INT (high);
- operands[6] = GEN_INT (low & 0x0000ffff);
- }
-}")
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (match_operand:DI 1 "const_double_operand" ""))]
- "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) >= 4"
- [(set (match_dup 2) (match_dup 4))
- (set (match_dup 3) (match_dup 5))
- (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))
- (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 7)))]
- "
-{
- HOST_WIDE_INT high = CONST_DOUBLE_HIGH (operands[1]);
- HOST_WIDE_INT low = CONST_DOUBLE_LOW (operands[1]);
-
- operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
- operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
- operands[4] = GEN_INT (high & 0xffff0000);
- operands[5] = GEN_INT (low & 0xffff0000);
- operands[6] = GEN_INT (high & 0x0000ffff);
- operands[7] = GEN_INT (low & 0x0000ffff);
-}")
-
-(define_insn "*movdi_64"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,f,f,m,r,*h,*h")
- (match_operand:DI 1 "input_operand" "r,m,r,I,J,nF,R,f,m,f,*h,r,0"))]
- "TARGET_64BIT
- && (gpc_reg_operand (operands[0], DImode)
- || gpc_reg_operand (operands[1], DImode))"
- "@
- mr %0,%1
- ld%U1%X1 %0,%1
- std%U0%X0 %1,%0
- li %0,%1
- lis %0,%v1
- #
- {cal|la} %0,%1(%*)
- fmr %0,%1
- lfd%U1%X1 %0,%1
- stfd%U0%X0 %1,%0
- mf%1 %0
- mt%0 %1
- cror 0,0,0"
- [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
- (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
-
-;; Split a load of a large constant into the appropriate five-instruction
-;; sequence. The expansion in movdi tries to perform the minimum number of
-;; steps, but here we have to handle anything in a constant number of insns.
-
-(define_split
- [(set (match_operand:DI 0 "gpc_reg_operand" "")
- (match_operand:DI 1 "const_double_operand" ""))]
- "TARGET_64BIT && num_insns_constant (operands[1], DImode) > 1"
- [(set (match_dup 0)
- (match_dup 2))
- (set (match_dup 0)
- (ior:DI (match_dup 0)
- (match_dup 3)))
- (set (match_dup 0)
- (ashift:DI (match_dup 0)
- (const_int 32)))
- (set (match_dup 0)
- (ior:DI (match_dup 0)
- (match_dup 4)))
- (set (match_dup 0)
- (ior:DI (match_dup 0)
- (match_dup 5)))]
- "
-{
- HOST_WIDE_INT low;
- HOST_WIDE_INT high;
-
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- low = CONST_DOUBLE_LOW (operands[1]);
- high = CONST_DOUBLE_HIGH (operands[1]);
- }
- else
-#if HOST_BITS_PER_WIDE_INT == 32
- {
- low = INTVAL (operands[1]);
- high = (low < 0) ? ~0 : 0;
- }
-#else
- {
- low = INTVAL (operands[1]) & 0xffffffff;
- high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
- }
-#endif
-
- if ((high + 0x8000) < 0x10000
- && ((low & 0xffff) == 0 || (low & (~ (HOST_WIDE_INT) 0xffff)) == 0))
- FAIL;
-
- operands[2] = GEN_INT (high & (~ (HOST_WIDE_INT) 0xffff));
- operands[3] = GEN_INT (high & 0xffff);
- operands[4] = GEN_INT (low & (~ (HOST_WIDE_INT) 0xffff));
- operands[5] = GEN_INT (low & 0xffff);
-}")
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
- (const_int 0)))
- (set (match_operand:DI 0 "gpc_reg_operand" "=r") (match_dup 1))]
- "TARGET_POWERPC64"
- "mr. %0,%1"
- [(set_attr "type" "compare")])
-
-;; TImode is similar, except that we usually want to compute the address into
-;; a register and use lsi/stsi (the exception is during reload). MQ is also
-;; clobbered in stsi for POWER, so we need a SCRATCH for it.
-(define_expand "movti"
- [(parallel [(set (match_operand:TI 0 "general_operand" "")
- (match_operand:TI 1 "general_operand" ""))
- (clobber (scratch:SI))])]
- "TARGET_STRING || TARGET_POWERPC64"
- "
-{
- if (GET_CODE (operands[0]) == MEM)
- operands[1] = force_reg (TImode, operands[1]);
-
- if (GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) != REG
- && ! reload_in_progress)
- operands[0] = change_address (operands[0], TImode,
- copy_addr_to_reg (XEXP (operands[0], 0)));
-
- if (GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1], 0)) != REG
- && ! reload_in_progress)
- operands[1] = change_address (operands[1], TImode,
- copy_addr_to_reg (XEXP (operands[1], 0)));
-}")
-
-;; We say that MQ is clobbered in the last alternative because the first
-;; alternative would never get used otherwise since it would need a reload
-;; while the 2nd alternative would not. We put memory cases first so they
-;; are preferred. Otherwise, we'd try to reload the output instead of
-;; giving the SCRATCH mq.
-(define_insn ""
- [(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_STRING && TARGET_POWER && ! TARGET_POWERPC64
- && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
- "*
-{
- switch (which_alternative)
- {
- default:
- abort ();
-
- case 0:
- return \"{stsi|stswi} %1,%P0,16\";
-
- case 1:
- return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
-
- case 2:
- /* Normally copy registers with lowest numbered register copied first.
- But copy in the other order if the first register of the output
- is the second, third, or fourth register in the input. */
- if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
- && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
- return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
- else
- return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
- case 3:
- /* If the address is not used in the output, we can use lsi. Otherwise,
- fall through to generating four loads. */
- if (! reg_overlap_mentioned_p (operands[0], operands[1]))
- return \"{lsi|lswi} %0,%P1,16\";
- /* ... fall through ... */
- case 4:
- /* If the address register is the same as the register for the lowest-
- addressed word, load it last. Similarly for the next two words.
- Otherwise load lowest address to highest. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands[1], 0))
- return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
- else if (refers_to_regno_p (REGNO (operands[0]) + 1,
- REGNO (operands[0]) + 2, operands[1], 0))
- return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
- else if (refers_to_regno_p (REGNO (operands[0]) + 2,
- REGNO (operands[0]) + 3, operands[1], 0))
- return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
- else
- return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
- }
-}"
- [(set_attr "type" "store,store,*,load,load")
- (set_attr "length" "*,16,16,*,16")])
-
-(define_insn ""
- [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
- (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
- (clobber (match_scratch:SI 2 "=X,X,X"))]
- "TARGET_STRING && !TARGET_POWER && ! TARGET_POWERPC64
- && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
- "*
-{
- switch (which_alternative)
- {
- default:
- abort ();
-
- case 0:
- return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
-
- case 1:
- /* Normally copy registers with lowest numbered register copied first.
- But copy in the other order if the first register of the output
- is the second, third, or fourth register in the input. */
- if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
- && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
- return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
- else
- return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
- case 2:
- /* If the address register is the same as the register for the lowest-
- addressed word, load it last. Similarly for the next two words.
- Otherwise load lowest address to highest. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands[1], 0))
- return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
- else if (refers_to_regno_p (REGNO (operands[0]) + 1,
- REGNO (operands[0]) + 2, operands[1], 0))
- return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
- else if (refers_to_regno_p (REGNO (operands[0]) + 2,
- REGNO (operands[0]) + 3, operands[1], 0))
- return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
- else
- return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
- }
-}"
- [(set_attr "type" "store,*,load")
- (set_attr "length" "16,16,16")])
-
-(define_insn ""
- [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
- (match_operand:TI 1 "input_operand" "r,m,r"))]
- "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
- || gpc_reg_operand (operands[1], TImode))"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- /* We normally copy the low-numbered register first. However, if
- the first register operand 0 is the same as the second register of
- operand 1, we must copy in the opposite order. */
- if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
- return \"mr %L0,%L1\;mr %0,%1\";
- else
- return \"mr %0,%1\;mr %L0,%L1\";
- case 1:
- /* If the low-address word is used in the address, we must load it
- last. Otherwise, load it first. Note that we cannot have
- auto-increment in that case since the address register is known to be
- dead. */
- if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
- operands [1], 0))
- return \"ld %L0,%L1\;ld %0,%1\";
- else
- return \"ld%U1 %0,%1\;ld %L0,%L1\";
- case 2:
- return \"std%U0 %1,%0\;std %L1,%L0\";
- }
-}"
- [(set_attr "type" "*,load,store")
- (set_attr "length" "8,8,8")])
-
-(define_expand "load_multiple"
- [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
- (match_operand:SI 1 "" ""))
- (use (match_operand:SI 2 "" ""))])]
- "TARGET_STRING"
- "
-{
- int regno;
- int count;
- rtx from;
- int i;
-
- /* Support only loading a constant number of fixed-point registers from
- memory and only bother with this if more than two; the machine
- doesn't support more than eight. */
- if (GET_CODE (operands[2]) != CONST_INT
- || INTVAL (operands[2]) <= 2
- || INTVAL (operands[2]) > 8
- || GET_CODE (operands[1]) != MEM
- || GET_CODE (operands[0]) != REG
- || REGNO (operands[0]) >= 32)
- FAIL;
-
- count = INTVAL (operands[2]);
- regno = REGNO (operands[0]);
-
- operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
- from = force_reg (SImode, XEXP (operands[1], 0));
-
- for (i = 0; i < count; i++)
- XVECEXP (operands[3], 0, i)
- = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
- change_address (operands[1], SImode,
- plus_constant (from, i * 4)));
-}")
-
-(define_insn ""
- [(match_parallel 0 "load_multiple_operation"
- [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
- (mem:SI (match_operand:SI 2 "register_operand" "b")))])]
- "TARGET_STRING"
- "*
-{
- /* We have to handle the case where the pseudo used to contain the address
- is assigned to one of the output registers. */
- int i, j;
- int words = XVECLEN (operands[0], 0);
- rtx xop[10];
-
- if (XVECLEN (operands[0], 0) == 1)
- return \"{l|lwz} %1,0(%2)\";
-
- for (i = 0; i < words; i++)
- if (refers_to_regno_p (REGNO (operands[1]) + i,
- REGNO (operands[1]) + i + 1, operands[2], 0))
- {
- if (i == words-1)
- {
- xop[0] = operands[1];
- xop[1] = operands[2];
- xop[2] = GEN_INT (4 * (words-1));
- output_asm_insn (\"{lsi|lswi} %0,%1,%2\;{l|lwz} %1,%2(%1)\", xop);
- return \"\";
- }
- else if (i == 0)
- {
- xop[0] = operands[1];
- xop[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- xop[2] = GEN_INT (4 * (words-1));
- output_asm_insn (\"{cal %0,4(%0)|addi %0,%0,4}\;{lsi|lswi} %1,%0,%2\;{l|lwz} %0,-4(%0)\", xop);
- return \"\";
- }
- else
- {
- for (j = 0; j < words; j++)
- if (j != i)
- {
- xop[0] = gen_rtx (REG, SImode, REGNO (operands[1]) + j);
- xop[1] = operands[2];
- xop[2] = GEN_INT (j * 4);
- output_asm_insn (\"{l|lwz} %0,%2(%1)\", xop);
- }
- xop[0] = operands[2];
- xop[1] = GEN_INT (i * 4);
- output_asm_insn (\"{l|lwz} %0,%1(%0)\", xop);
- return \"\";
- }
- }
-
- return \"{lsi|lswi} %1,%2,%N0\";
-}"
- [(set_attr "type" "load")
- (set_attr "length" "32")])
-
-
-(define_expand "store_multiple"
- [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
- (match_operand:SI 1 "" ""))
- (clobber (scratch:SI))
- (use (match_operand:SI 2 "" ""))])]
- "TARGET_STRING"
- "
-{
- int regno;
- int count;
- rtx to;
- int i;
-
- /* Support only storing a constant number of fixed-point registers to
- memory and only bother with this if more than two; the machine
- doesn't support more than eight. */
- if (GET_CODE (operands[2]) != CONST_INT
- || INTVAL (operands[2]) <= 2
- || INTVAL (operands[2]) > 8
- || GET_CODE (operands[0]) != MEM
- || GET_CODE (operands[1]) != REG
- || REGNO (operands[1]) >= 32)
- FAIL;
-
- count = INTVAL (operands[2]);
- regno = REGNO (operands[1]);
-
- operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
- to = force_reg (SImode, XEXP (operands[0], 0));
-
- XVECEXP (operands[3], 0, 0)
- = gen_rtx (SET, VOIDmode, change_address (operands[0], SImode, to),
- operands[1]);
- XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (SCRATCH, SImode));
-
- for (i = 1; i < count; i++)
- XVECEXP (operands[3], 0, i + 1)
- = gen_rtx (SET, VOIDmode,
- change_address (operands[0], SImode,
- plus_constant (to, i * 4)),
- gen_rtx (REG, SImode, regno + i));
-}")
-
-(define_insn ""
- [(match_parallel 0 "store_multiple_operation"
- [(set (match_operand:SI 1 "indirect_operand" "=Q")
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (clobber (match_scratch:SI 3 "=q"))])]
- "TARGET_STRING && TARGET_POWER"
- "{stsi|stswi} %2,%P1,%O0"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(match_parallel 0 "store_multiple_operation"
- [(set (mem:SI (match_operand:SI 1 "register_operand" "b"))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (clobber (match_scratch:SI 3 "X"))])]
- "TARGET_STRING && !TARGET_POWER"
- "{stsi|stswi} %2,%1,%O0"
- [(set_attr "type" "store")])
-
-
-;; String/block move insn.
-;; Argument 0 is the destination
-;; Argument 1 is the source
-;; Argument 2 is the length
-;; Argument 3 is the alignment
-
-(define_expand "movstrsi"
- [(parallel [(set (match_operand:BLK 0 "" "")
- (match_operand:BLK 1 "" ""))
- (use (match_operand:SI 2 "" ""))
- (use (match_operand:SI 3 "" ""))])]
- ""
- "
-{
- if (expand_block_move (operands))
- DONE;
- else
- FAIL;
-}")
-
-;; Move up to 32 bytes at a time. The fixed registers are needed because the
-;; register allocator doesn't have a clue about allocating 8 word registers
-(define_expand "movstrsi_8reg"
- [(parallel [(set (match_operand 0 "" "")
- (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))
- (use (match_operand 3 "" ""))
- (clobber (reg:SI 5))
- (clobber (reg:SI 6))
- (clobber (reg:SI 7))
- (clobber (reg:SI 8))
- (clobber (reg:SI 9))
- (clobber (reg:SI 10))
- (clobber (reg:SI 11))
- (clobber (reg:SI 12))
- (clobber (match_scratch:SI 4 ""))])]
- "TARGET_STRING"
- "")
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_operand:SI 4 "register_operand" "=r"))
- (clobber (reg:SI 6))
- (clobber (reg:SI 7))
- (clobber (reg:SI 8))
- (clobber (reg:SI 9))
- (clobber (reg:SI 10))
- (clobber (reg:SI 11))
- (clobber (reg:SI 12))
- (clobber (match_scratch:SI 5 "=q"))]
- "TARGET_STRING && TARGET_POWER
- && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
- && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
- && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
- && REGNO (operands[4]) == 5"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_operand:SI 4 "register_operand" "=r"))
- (clobber (reg:SI 6))
- (clobber (reg:SI 7))
- (clobber (reg:SI 8))
- (clobber (reg:SI 9))
- (clobber (reg:SI 10))
- (clobber (reg:SI 11))
- (clobber (reg:SI 12))
- (clobber (match_scratch:SI 5 "X"))]
- "TARGET_STRING && !TARGET_POWER
- && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
- && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
- && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
- && REGNO (operands[4]) == 5"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-;; Move up to 24 bytes at a time. The fixed registers are needed because the
-;; register allocator doesn't have a clue about allocating 6 word registers
-(define_expand "movstrsi_6reg"
- [(parallel [(set (match_operand 0 "" "")
- (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))
- (use (match_operand 3 "" ""))
- (clobber (reg:SI 7))
- (clobber (reg:SI 8))
- (clobber (reg:SI 9))
- (clobber (reg:SI 10))
- (clobber (reg:SI 11))
- (clobber (reg:SI 12))
- (clobber (match_scratch:SI 4 ""))])]
- "TARGET_STRING"
- "")
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_operand:SI 4 "register_operand" "=r"))
- (clobber (reg:SI 8))
- (clobber (reg:SI 9))
- (clobber (reg:SI 10))
- (clobber (reg:SI 11))
- (clobber (reg:SI 12))
- (clobber (match_scratch:SI 5 "=q"))]
- "TARGET_STRING && TARGET_POWER
- && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
- && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
- && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
- && REGNO (operands[4]) == 7"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_operand:SI 4 "register_operand" "=r"))
- (clobber (reg:SI 8))
- (clobber (reg:SI 9))
- (clobber (reg:SI 10))
- (clobber (reg:SI 11))
- (clobber (reg:SI 12))
- (clobber (match_scratch:SI 5 "X"))]
- "TARGET_STRING && !TARGET_POWER
- && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
- && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
- && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
- && REGNO (operands[4]) == 7"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill problems
-;; with TImode
-(define_expand "movstrsi_4reg"
- [(parallel [(set (match_operand 0 "" "")
- (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))
- (use (match_operand 3 "" ""))
- (clobber (reg:SI 9))
- (clobber (reg:SI 10))
- (clobber (reg:SI 11))
- (clobber (reg:SI 12))
- (clobber (match_scratch:SI 4 ""))])]
- "TARGET_STRING"
- "")
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_operand:SI 4 "register_operand" "=r"))
- (clobber (reg:SI 10))
- (clobber (reg:SI 11))
- (clobber (reg:SI 12))
- (clobber (match_scratch:SI 5 "=q"))]
- "TARGET_STRING && TARGET_POWER
- && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
- && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
- && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
- && REGNO (operands[4]) == 9"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_operand:SI 4 "register_operand" "=r"))
- (clobber (reg:SI 10))
- (clobber (reg:SI 11))
- (clobber (reg:SI 12))
- (clobber (match_scratch:SI 5 "X"))]
- "TARGET_STRING && !TARGET_POWER
- && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
- && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
- && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
- && REGNO (operands[4]) == 9"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-;; Move up to 8 bytes at a time.
-(define_expand "movstrsi_2reg"
- [(parallel [(set (match_operand 0 "" "")
- (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))
- (use (match_operand 3 "" ""))
- (clobber (match_scratch:DI 4 ""))
- (clobber (match_scratch:SI 5 ""))])]
- "TARGET_STRING && !TARGET_64BIT"
- "")
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_scratch:DI 4 "=&r"))
- (clobber (match_scratch:SI 5 "=q"))]
- "TARGET_STRING && TARGET_POWER && !TARGET_64BIT
- && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_scratch:DI 4 "=&r"))
- (clobber (match_scratch:SI 5 "X"))]
- "TARGET_STRING && !TARGET_POWER && !TARGET_64BIT
- && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-;; Move up to 4 bytes at a time.
-(define_expand "movstrsi_1reg"
- [(parallel [(set (match_operand 0 "" "")
- (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))
- (use (match_operand 3 "" ""))
- (clobber (match_scratch:SI 4 ""))
- (clobber (match_scratch:SI 5 ""))])]
- "TARGET_STRING"
- "")
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_scratch:SI 4 "=&r"))
- (clobber (match_scratch:SI 5 "=q"))]
- "TARGET_STRING && TARGET_POWER
- && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
- (mem:BLK (match_operand:SI 1 "register_operand" "b")))
- (use (match_operand:SI 2 "immediate_operand" "i"))
- (use (match_operand:SI 3 "immediate_operand" "i"))
- (clobber (match_scratch:SI 4 "=&r"))
- (clobber (match_scratch:SI 5 "X"))]
- "TARGET_STRING && !TARGET_POWER
- && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
- "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
- [(set_attr "type" "load")
- (set_attr "length" "8")])
-
-
-;; Define insns that do load or store with update. Some of these we can
-;; get by using pre-decrement or pre-increment, but the hardware can also
-;; do cases where the increment is not the size of the object.
-;;
-;; In all these cases, we use operands 0 and 1 for the register being
-;; incremented because those are the operands that local-alloc will
-;; tie and these are the pair most likely to be tieable (and the ones
-;; that will benefit the most).
-
-(define_insn ""
- [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
- (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
- (match_operand:DI 2 "reg_or_short_operand" "r,I"))))
- (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
- (plus:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "@
- ldux %3,%0,%2
- ldu %3,%2(%0)"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
- (sign_extend:DI
- (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
- (match_operand:DI 2 "gpc_reg_operand" "r")))))
- (set (match_operand:DI 0 "gpc_reg_operand" "=b")
- (plus:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "lwaux %3,%0,%2"
- [(set_attr "type" "load")])
-
-(define_insn "movdi_update"
- [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
- (match_operand:DI 2 "reg_or_short_operand" "r,I")))
- (match_operand:DI 3 "gpc_reg_operand" "r,r"))
- (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
- (plus:DI (match_dup 1) (match_dup 2)))]
- "TARGET_POWERPC64"
- "@
- stdux %3,%0,%2
- stdu %3,%2(%0)"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
- (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- {lux|lwzux} %3,%0,%2
- {lu|lwzu} %3,%2(%0)"
- [(set_attr "type" "load")])
-
-(define_insn "movsi_update"
- [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- {stux|stwux} %3,%0,%2
- {stu|stwu} %3,%2(%0)"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
- (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- lhzux %3,%0,%2
- lhzu %3,%2(%0)"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
- (zero_extend:SI
- (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- lhzux %3,%0,%2
- lhzu %3,%2(%0)"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
- (sign_extend:SI
- (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- lhaux %3,%0,%2
- lhau %3,%2(%0)"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))
- (match_operand:HI 3 "gpc_reg_operand" "r,r"))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- sthux %3,%0,%2
- sthu %3,%2(%0)"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
- (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- lbzux %3,%0,%2
- lbzu %3,%2(%0)"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
- (zero_extend:SI
- (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- lbzux %3,%0,%2
- lbzu %3,%2(%0)"
- [(set_attr "type" "load")])
-
-(define_insn ""
- [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))
- (match_operand:QI 3 "gpc_reg_operand" "r,r"))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- stbux %3,%0,%2
- stbu %3,%2(%0)"
- [(set_attr "type" "store")])
-
-(define_insn ""
- [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
- (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "TARGET_HARD_FLOAT"
- "@
- lfsux %3,%0,%2
- lfsu %3,%2(%0)"
- [(set_attr "type" "fpload")])
-
-(define_insn ""
- [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))
- (match_operand:SF 3 "gpc_reg_operand" "f,f"))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "TARGET_HARD_FLOAT"
- "@
- stfsux %3,%0,%2
- stfsu %3,%2(%0)"
- [(set_attr "type" "fpstore")])
-
-(define_insn ""
- [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
- (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "TARGET_HARD_FLOAT"
- "@
- lfdux %3,%0,%2
- lfdu %3,%2(%0)"
- [(set_attr "type" "fpload")])
-
-(define_insn ""
- [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
- (match_operand:SI 2 "reg_or_short_operand" "r,I")))
- (match_operand:DF 3 "gpc_reg_operand" "f,f"))
- (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
- (plus:SI (match_dup 1) (match_dup 2)))]
- "TARGET_HARD_FLOAT"
- "@
- stfdux %3,%0,%2
- stfdu %3,%2(%0)"
- [(set_attr "type" "fpstore")])
-
-;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
-
-(define_peephole
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (match_operand:DF 1 "memory_operand" ""))
- (set (match_operand:DF 2 "gpc_reg_operand" "=f")
- (match_operand:DF 3 "memory_operand" ""))]
- "TARGET_POWER2
- && TARGET_HARD_FLOAT
- && registers_ok_for_quad_peep (operands[0], operands[2])
- && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
- && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
- "lfq%U1%X1 %0,%1")
-
-(define_peephole
- [(set (match_operand:DF 0 "memory_operand" "")
- (match_operand:DF 1 "gpc_reg_operand" "f"))
- (set (match_operand:DF 2 "memory_operand" "")
- (match_operand:DF 3 "gpc_reg_operand" "f"))]
- "TARGET_POWER2
- && TARGET_HARD_FLOAT
- && registers_ok_for_quad_peep (operands[1], operands[3])
- && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
- && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
- "stfq%U0%X0 %1,%0")
-
-;; Next come insns related to the calling sequence.
-;;
-;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
-;; We move the back-chain and decrement the stack pointer.
-
-(define_expand "allocate_stack"
- [(set (reg:SI 1)
- (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))]
- ""
- "
-{ rtx chain = gen_reg_rtx (Pmode);
- rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
- rtx neg_op0;
-
- emit_move_insn (chain, stack_bot);
-
- /* Under Windows NT, we need to add stack probes for large/variable allocations,
- so do it via a call to the external function alloca, instead of doing it
- inline. */
- if (DEFAULT_ABI == ABI_NT
- && (GET_CODE (operands[0]) != CONST_INT || INTVAL (operands[0]) > 4096))
- {
- rtx tmp = gen_reg_rtx (SImode);
- emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"__allocate_stack\"),
- tmp, 0, SImode, 1, operands[0], Pmode);
- emit_insn (gen_set_sp (tmp));
- DONE;
- }
-
- if (GET_CODE (operands[0]) != CONST_INT
- || INTVAL (operands[0]) < -32767
- || INTVAL (operands[0]) > 32768)
- {
- neg_op0 = gen_reg_rtx (Pmode);
- if (TARGET_32BIT)
- emit_insn (gen_negsi2 (neg_op0, operands[0]));
- else
- emit_insn (gen_negdi2 (neg_op0, operands[0]));
- }
- else
- neg_op0 = GEN_INT (- INTVAL (operands[0]));
-
- if (TARGET_32BIT)
- emit_insn (gen_movsi_update (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
- else
- emit_insn (gen_movdi_update (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
-
- DONE;
-}")
-
-;; Marker to indicate that the stack pointer was changed under NT in
-;; ways not known to the compiler
-
-(define_insn "set_sp"
- [(set (reg:SI 1)
- (unspec [(match_operand:SI 0 "register_operand" "r")] 7))]
- ""
- ""
- [(set_attr "length" "0")])
-
-;; These patterns say how to save and restore the stack pointer. We need not
-;; save the stack pointer at function level since we are careful to
-;; preserve the backchain. At block level, we have to restore the backchain
-;; when we restore the stack pointer.
-;;
-;; For nonlocal gotos, we must save both the stack pointer and its
-;; backchain and restore both. Note that in the nonlocal case, the
-;; save area is a memory location.
-
-(define_expand "save_stack_function"
- [(use (const_int 0))]
- ""
- "")
-
-(define_expand "restore_stack_function"
- [(use (const_int 0))]
- ""
- "")
-
-(define_expand "restore_stack_block"
- [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
- (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
- (set (mem:SI (match_dup 0)) (match_dup 2))]
- ""
- "
-{ operands[2] = gen_reg_rtx (SImode); }")
-
-(define_expand "save_stack_nonlocal"
- [(match_operand:DI 0 "memory_operand" "")
- (match_operand:SI 1 "register_operand" "")]
- ""
- "
-{
- rtx temp = gen_reg_rtx (SImode);
-
- /* Copy the backchain to the first word, sp to the second. */
- emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
- emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
- emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
- DONE;
-}")
-
-(define_expand "restore_stack_nonlocal"
- [(match_operand:SI 0 "register_operand" "")
- (match_operand:DI 1 "memory_operand" "")]
- ""
- "
-{
- rtx temp = gen_reg_rtx (SImode);
-
- /* Restore the backchain from the first word, sp from the second. */
- emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
- emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
- emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
- DONE;
-}")
-
-
-;; A function pointer under AIX is a pointer to a data area whose first word
-;; contains the actual address of the function, whose second word contains a
-;; pointer to its TOC, and whose third word contains a value to place in the
-;; static chain register (r11). Note that if we load the static chain, our
-;; "trampoline" need not have any executable code.
-;;
-;; operands[0] is a register pointing to the 3 word descriptor (aka, the function address)
-;; operands[1] is the stack size to clean up
-;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for AIX)
-;; operands[3] is location to store the TOC
-;; operands[4] is the TOC register
-;; operands[5] is the static chain register
-;;
-;; We do not break this into separate insns, so that the scheduler will not try
-;; to move the load of the new TOC before any loads from the TOC.
-
-(define_insn "call_indirect_aix"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
- (match_operand 1 "const_int_operand" "n"))
- (use (match_operand 2 "const_int_operand" "n"))
- (use (match_operand 3 "offsettable_addr_operand" "p"))
- (use (match_operand 4 "register_operand" "r"))
- (clobber (match_operand 5 "register_operand" "=r"))
- (clobber (match_scratch:SI 6 "=&r"))
- (clobber (match_scratch:SI 7 "=l"))]
- "DEFAULT_ABI == ABI_AIX
- && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
- "{st|stw} %4,%a3\;{l|lwz} %6,0(%0)\;{l|lwz} %4,4(%0)\;mt%7 %6\;{l|lwz} %5,8(%0)\;{brl|blrl}\;{l|lwz} %4,%a3"
- [(set_attr "type" "load")
- (set_attr "length" "28")])
-
-(define_insn "call_value_indirect_aix"
- [(set (match_operand 0 "register_operand" "fg")
- (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
- (match_operand 2 "const_int_operand" "n")))
- (use (match_operand 3 "const_int_operand" "n"))
- (use (match_operand 4 "offsettable_addr_operand" "p"))
- (use (match_operand 5 "register_operand" "r"))
- (clobber (match_operand 6 "register_operand" "=r"))
- (clobber (match_scratch:SI 7 "=&r"))
- (clobber (match_scratch:SI 8 "=l"))]
- "DEFAULT_ABI == ABI_AIX
- && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
- "{st|stw} %5,%a4\;{l|lwz} %7,0(%1)\;{l|lwz} %5,4(%1);\;mt%8 %7\;{l|lwz} %6,8(%1)\;{brl|blrl}\;{l|lwz} %5,%a4"
- [(set_attr "type" "load")
- (set_attr "length" "28")])
-
-;; A function pointer undef NT is a pointer to a data area whose first word
-;; contains the actual address of the function, whose second word contains a
-;; pointer to its TOC. The static chain is not stored under NT, which means
-;; that we need a trampoline.
-;;
-;; operands[0] is an SImode pseudo in which we place the address of the function.
-;; operands[1] is the stack size to clean up
-;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for NT)
-;; operands[3] is location to store the TOC
-;; operands[4] is the TOC register
-;;
-;; We do not break this into separate insns, so that the scheduler will not try
-;; to move the load of the new TOC before any loads from the TOC.
-
-(define_insn "call_indirect_nt"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
- (match_operand 1 "const_int_operand" "n"))
- (use (match_operand 2 "const_int_operand" "n"))
- (use (match_operand 3 "offsettable_addr_operand" "p"))
- (use (match_operand 4 "register_operand" "r"))
- (clobber (match_scratch:SI 5 "=&r"))
- (clobber (match_scratch:SI 6 "=l"))]
- "DEFAULT_ABI == ABI_NT
- && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
- "{st|stw} %4,%a3\;{l|lwz} %5,0(%0)\;{l|lwz} %4,4(%0)\;mt%6 %5\;{brl|blrl}\;{l|lwz} %4,%a3"
- [(set_attr "type" "load")
- (set_attr "length" "24")])
-
-(define_insn "call_value_indirect_nt"
- [(set (match_operand 0 "register_operand" "fg")
- (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
- (match_operand 2 "const_int_operand" "n")))
- (use (match_operand 3 "const_int_operand" "n"))
- (use (match_operand 4 "offsettable_addr_operand" "p"))
- (use (match_operand 5 "register_operand" "r"))
- (clobber (match_scratch:SI 6 "=&r"))
- (clobber (match_scratch:SI 7 "=l"))]
- "DEFAULT_ABI == ABI_NT
- && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
- "{st|stw} %5,%a4\;{l|lwz} %6,0(%1)\;{l|lwz} %5,4(%1)\;mt%7 %6\;{brl|blrl}\;{l|lwz} %5,%a4"
- [(set_attr "type" "load")
- (set_attr "length" "24")])
-
-;; A function pointer under System V is just a normal pointer
-;; operands[0] is the function pointer
-;; operands[1] is the stack size to clean up
-;; operands[2] is the value FUNCTION_ARG returns for the VOID argument which indicates how to set cr1
-
-(define_insn "call_indirect_sysv"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "l,l"))
- (match_operand 1 "const_int_operand" "n,n"))
- (use (match_operand 2 "const_int_operand" "O,n"))
- (clobber (match_scratch:SI 3 "=l,l"))]
- "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
- "*
-{
- if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn (\"crxor 6,6,6\", operands);
-
- else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn (\"creqv 6,6,6\", operands);
-
- return \"{brl|blrl}\";
-}"
- [(set_attr "type" "jmpreg")
- (set_attr "length" "4,8")])
-
-(define_insn "call_value_indirect_sysv"
- [(set (match_operand 0 "register_operand" "=fg,fg")
- (call (mem:SI (match_operand:SI 1 "register_operand" "l,l"))
- (match_operand 2 "const_int_operand" "n,n")))
- (use (match_operand 3 "const_int_operand" "O,n"))
- (clobber (match_scratch:SI 4 "=l,l"))]
- "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
- "*
-{
- if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn (\"crxor 6,6,6\", operands);
-
- else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn (\"creqv 6,6,6\", operands);
-
- return \"{brl|blrl}\";
-}"
- [(set_attr "type" "jmpreg")
- (set_attr "length" "4,8")])
-
-;; Now the definitions for the call and call_value insns
-(define_expand "call"
- [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
- (match_operand 1 "" ""))
- (use (match_operand 2 "" ""))
- (clobber (scratch:SI))])]
- ""
- "
-{
- if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
- abort ();
-
- operands[0] = XEXP (operands[0], 0);
-
- /* Convert NT DLL imports into an indirect call. */
- if (GET_CODE (operands[0]) == SYMBOL_REF
- && (INTVAL (operands[2]) & CALL_NT_DLLIMPORT) != 0)
- {
- operands[0] = rs6000_dll_import_ref (operands[0]);
- operands[2] = GEN_INT ((int)CALL_NORMAL);
- }
-
- if (GET_CODE (operands[0]) != SYMBOL_REF
- || (INTVAL (operands[2]) & CALL_LONG) != 0)
- {
- if (INTVAL (operands[2]) & CALL_LONG)
- operands[0] = rs6000_longcall_ref (operands[0]);
-
- if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
- emit_call_insn (gen_call_indirect_sysv (force_reg (Pmode, operands[0]),
- operands[1], operands[2]));
- else
- {
- rtx toc_reg = gen_rtx (REG, Pmode, 2);
- rtx toc_addr = RS6000_SAVE_TOC;
-
- if (DEFAULT_ABI == ABI_AIX)
- {
- /* AIX function pointers are really pointers to a three word area */
- rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
- emit_call_insn (gen_call_indirect_aix (force_reg (Pmode, operands[0]),
- operands[1], operands[2],
- toc_addr, toc_reg, static_chain));
- }
- else if (DEFAULT_ABI == ABI_NT)
- {
- /* NT function pointers are really pointers to a two word area */
- emit_call_insn (gen_call_indirect_nt (force_reg (Pmode, operands[0]),
- operands[1], operands[2],
- toc_addr, toc_reg));
- }
- else
- abort ();
- }
- DONE;
- }
-}")
-
-(define_expand "call_value"
- [(parallel [(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "address_operand" ""))
- (match_operand 2 "" "")))
- (use (match_operand 3 "" ""))
- (clobber (scratch:SI))])]
- ""
- "
-{
- if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
- abort ();
-
- operands[1] = XEXP (operands[1], 0);
-
- /* Convert NT DLL imports into an indirect call. */
- if (GET_CODE (operands[1]) == SYMBOL_REF
- && (INTVAL (operands[3]) & CALL_NT_DLLIMPORT) != 0)
- {
- operands[1] = rs6000_dll_import_ref (operands[1]);
- operands[3] = GEN_INT ((int)CALL_NORMAL);
- }
-
- if (GET_CODE (operands[1]) != SYMBOL_REF
- || (INTVAL (operands[3]) & CALL_LONG) != 0)
- {
- if (INTVAL (operands[2]) & CALL_LONG)
- operands[1] = rs6000_longcall_ref (operands[1]);
-
- if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
- emit_call_insn (gen_call_value_indirect_sysv (operands[0], operands[1],
- operands[2], operands[3]));
- else
- {
- rtx toc_reg = gen_rtx (REG, Pmode, 2);
- rtx toc_addr = RS6000_SAVE_TOC;
-
- if (DEFAULT_ABI == ABI_AIX)
- {
- /* AIX function pointers are really pointers to a three word area */
- rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
- emit_call_insn (gen_call_value_indirect_aix (operands[0],
- force_reg (Pmode, operands[1]),
- operands[2], operands[3],
- toc_addr, toc_reg, static_chain));
- }
- else if (DEFAULT_ABI == ABI_NT)
- {
- /* NT function pointers are really pointers to a two word area */
- emit_call_insn (gen_call_value_indirect_nt (operands[0],
- force_reg (Pmode, operands[1]),
- operands[2], operands[3],
- toc_addr, toc_reg));
- }
- else
- abort ();
- }
- DONE;
- }
-}")
-
-;; Call to function in current module. No TOC pointer reload needed.
-;; Operand2 is non-zero if we are using the V.4 calling sequence and
-;; either the function was not prototyped, or it was prototyped as a
-;; variable argument function. It is > 0 if FP registers were passed
-;; and < 0 if they were not.
-
-(define_insn ""
- [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
- (match_operand 1 "" "g,g"))
- (use (match_operand:SI 2 "immediate_operand" "O,n"))
- (clobber (match_scratch:SI 3 "=l,l"))]
- "(INTVAL (operands[2]) & CALL_LONG) == 0"
- "*
-{
- if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn (\"crxor 6,6,6\", operands);
-
- else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn (\"creqv 6,6,6\", operands);
-
- return \"bl %z0\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "4,8")])
-
-;; Call to function which may be in another module. Restore the TOC
-;; pointer (r2) after the call unless this is System V.
-;; Operand2 is non-zero if we are using the V.4 calling sequence and
-;; either the function was not prototyped, or it was prototyped as a
-;; variable argument function. It is > 0 if FP registers were passed
-;; and < 0 if they were not.
-
-(define_insn ""
- [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
- (match_operand 1 "" "fg,fg"))
- (use (match_operand:SI 2 "immediate_operand" "O,n"))
- (clobber (match_scratch:SI 3 "=l,l"))]
- "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
- && (INTVAL (operands[2]) & CALL_LONG) == 0"
- "*
-{
- /* Indirect calls should go through call_indirect */
- if (GET_CODE (operands[0]) == REG)
- abort ();
-
- if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn (\"crxor 6,6,6\", operands);
-
- else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn (\"creqv 6,6,6\", operands);
-
- return (TARGET_WINDOWS_NT) ? \"bl %z0\;.znop %z0\" : \"bl %z0\;%.\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "8,12")])
-
-(define_insn ""
- [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
- (match_operand 1 "" "fg,fg"))
- (use (match_operand:SI 2 "immediate_operand" "O,n"))
- (clobber (match_scratch:SI 3 "=l,l"))]
- "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- && (INTVAL (operands[2]) & CALL_LONG) == 0"
- "*
-{
- /* Indirect calls should go through call_indirect */
- if (GET_CODE (operands[0]) == REG)
- abort ();
-
- if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn (\"crxor 6,6,6\", operands);
-
- else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn (\"creqv 6,6,6\", operands);
-
- return (flag_pic == 1) ? \"bl %z0@plt\" : \"bl %z0\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "4,8")])
-
-(define_insn ""
- [(set (match_operand 0 "" "=fg,fg")
- (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
- (match_operand 2 "" "g,g")))
- (use (match_operand:SI 3 "immediate_operand" "O,n"))
- (clobber (match_scratch:SI 4 "=l,l"))]
- "(INTVAL (operands[3]) & CALL_LONG) == 0"
- "*
-{
- if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn (\"crxor 6,6,6\", operands);
-
- else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn (\"creqv 6,6,6\", operands);
-
- return \"bl %z1\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "4,8")])
-
-(define_insn ""
- [(set (match_operand 0 "" "=fg,fg")
- (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
- (match_operand 2 "" "fg,fg")))
- (use (match_operand:SI 3 "immediate_operand" "O,n"))
- (clobber (match_scratch:SI 4 "=l,l"))]
- "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
- && (INTVAL (operands[3]) & CALL_LONG) == 0"
- "*
-{
- /* This should be handled by call_value_indirect */
- if (GET_CODE (operands[1]) == REG)
- abort ();
-
- if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn (\"crxor 6,6,6\", operands);
-
- else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn (\"creqv 6,6,6\", operands);
-
- return (TARGET_WINDOWS_NT) ? \"bl %z1\;.znop %z1\" : \"bl %z1\;%.\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "8,12")])
-
-(define_insn ""
- [(set (match_operand 0 "" "=fg,fg")
- (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
- (match_operand 2 "" "fg,fg")))
- (use (match_operand:SI 3 "immediate_operand" "O,n"))
- (clobber (match_scratch:SI 4 "=l,l"))]
- "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
- && (INTVAL (operands[3]) & CALL_LONG) == 0"
- "*
-{
- /* This should be handled by call_value_indirect */
- if (GET_CODE (operands[1]) == REG)
- abort ();
-
- if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
- output_asm_insn (\"crxor 6,6,6\", operands);
-
- else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
- output_asm_insn (\"creqv 6,6,6\", operands);
-
- return (flag_pic == 1) ? \"bl %z1@plt\" : \"bl %z1\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "4,8")])
-
-;; Call subroutine returning any type.
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-;; V.4 specific code to initialize the PIC register
-
-(define_insn "init_v4_pic"
- [(set (match_operand:SI 0 "register_operand" "=l")
- (unspec [(const_int 0)] 7))]
- "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS"
- "bl _GLOBAL_OFFSET_TABLE_@local-4"
- [(set_attr "type" "branch")
- (set_attr "length" "4")])
-
-
-;; Compare insns are next. Note that the RS/6000 has two types of compares,
-;; signed & unsigned, and one type of branch.
-;;
-;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
-;; insns, and branches. We store the operands of compares until we see
-;; how it is used.
-(define_expand "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "gpc_reg_operand" "")
- (match_operand:SI 1 "reg_or_short_operand" "")))]
- ""
- "
-{
- /* Take care of the possibility that operands[1] might be negative but
- this might be a logical operation. That insn doesn't exist. */
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) < 0)
- operands[1] = force_reg (SImode, operands[1]);
-
- rs6000_compare_op0 = operands[0];
- rs6000_compare_op1 = operands[1];
- rs6000_compare_fp_p = 0;
- DONE;
-}")
-
-(define_expand "cmpdi"
- [(set (cc0)
- (compare (match_operand:DI 0 "gpc_reg_operand" "")
- (match_operand:DI 1 "reg_or_short_operand" "")))]
- "TARGET_POWERPC64"
- "
-{
- /* Take care of the possibility that operands[1] might be negative but
- this might be a logical operation. That insn doesn't exist. */
- if (GET_CODE (operands[1]) == CONST_INT
- && INTVAL (operands[1]) < 0)
- operands[1] = force_reg (DImode, operands[1]);
-
- rs6000_compare_op0 = operands[0];
- rs6000_compare_op1 = operands[1];
- rs6000_compare_fp_p = 0;
- DONE;
-}")
-
-(define_expand "cmpsf"
- [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
- (match_operand:SF 1 "gpc_reg_operand" "")))]
- "TARGET_HARD_FLOAT"
- "
-{
- rs6000_compare_op0 = operands[0];
- rs6000_compare_op1 = operands[1];
- rs6000_compare_fp_p = 1;
- DONE;
-}")
-
-(define_expand "cmpdf"
- [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
- (match_operand:DF 1 "gpc_reg_operand" "")))]
- "TARGET_HARD_FLOAT"
- "
-{
- rs6000_compare_op0 = operands[0];
- rs6000_compare_op1 = operands[1];
- rs6000_compare_fp_p = 1;
- DONE;
-}")
-
-(define_expand "beq"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (eq (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-(define_expand "bne"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (ne (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-(define_expand "blt"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (lt (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-(define_expand "bgt"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (gt (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-(define_expand "ble"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (le (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-(define_expand "bge"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (ge (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-(define_expand "bgtu"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (gtu (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_rtx (COMPARE, CCUNSmode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (CCUNSmode);
-}")
-
-(define_expand "bltu"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (ltu (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_rtx (COMPARE, CCUNSmode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (CCUNSmode);
-}")
-
-(define_expand "bgeu"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (geu (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_rtx (COMPARE, CCUNSmode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (CCUNSmode);
-}")
-
-(define_expand "bleu"
- [(set (match_dup 2) (match_dup 1))
- (set (pc)
- (if_then_else (leu (match_dup 2)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_rtx (COMPARE, CCUNSmode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (CCUNSmode);
-}")
-
-;; For SNE, we would prefer that the xor/abs sequence be used for integers.
-;; For SEQ, likewise, except that comparisons with zero should be done
-;; with an scc insns. However, due to the order that combine see the
-;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
-;; the cases we don't want to handle.
-(define_expand "seq"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (eq:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-(define_expand "sne"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (ne:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ if (! rs6000_compare_fp_p)
- FAIL;
-
- operands[1] = gen_rtx (COMPARE, CCFPmode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (CCFPmode);
-}")
-
-;; A > 0 is best done using the portable sequence, so fail in that case.
-(define_expand "sgt"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (gt:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
-
- if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
- FAIL;
-
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-;; A < 0 is best done in the portable way for A an integer.
-(define_expand "slt"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (lt:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
-
- if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
- FAIL;
-
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-(define_expand "sge"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (ge:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-;; A <= 0 is best done the portable way for A an integer.
-(define_expand "sle"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (le:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
-
- if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
- FAIL;
-
- operands[1] = gen_rtx (COMPARE, mode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (mode);
-}")
-
-(define_expand "sgtu"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (gtu:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ operands[1] = gen_rtx (COMPARE, CCUNSmode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (CCUNSmode);
-}")
-
-(define_expand "sltu"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (ltu:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ operands[1] = gen_rtx (COMPARE, CCUNSmode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (CCUNSmode);
-}")
-
-(define_expand "sgeu"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (geu:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ operands[1] = gen_rtx (COMPARE, CCUNSmode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (CCUNSmode);
-}")
-
-(define_expand "sleu"
- [(set (match_dup 2) (match_dup 1))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (leu:SI (match_dup 2) (const_int 0)))]
- ""
- "
-{ operands[1] = gen_rtx (COMPARE, CCUNSmode,
- rs6000_compare_op0, rs6000_compare_op1);
- operands[2] = gen_reg_rtx (CCUNSmode);
-}")
-
-;; Here are the actual compare insns.
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=y")
- (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI")))]
- ""
- "{cmp%I2|cmpw%I2} %0,%1,%2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=y")
- (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "reg_or_short_operand" "rI")))]
- "TARGET_POWERPC64"
- "cmpd%I2 %0,%1,%2"
- [(set_attr "type" "compare")])
-
-;; If we are comparing a register for equality with a large constant,
-;; we can do this with an XOR followed by a compare. But we need a scratch
-;; register for the result of the XOR.
-
-(define_split
- [(set (match_operand:CC 0 "cc_reg_operand" "")
- (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "non_short_cint_operand" "")))
- (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
- "find_single_use (operands[0], insn, 0)
- && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
- || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
- [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
- (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
- "
-{
- /* Get the constant we are comparing against, C, and see what it looks like
- sign-extended to 16 bits. Then see what constant could be XOR'ed
- with C to get the sign-extended value. */
-
- int c = INTVAL (operands[2]);
- int sextc = (c << 16) >> 16;
- int xorv = c ^ sextc;
-
- operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
- operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
-}")
-
-(define_insn ""
- [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
- (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
- ""
- "{cmpl%I2|cmplw%I2} %0,%1,%W2"
- [(set_attr "type" "compare")])
-
-(define_insn ""
- [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
- (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
- (match_operand:DI 2 "reg_or_u_short_operand" "rI")))]
- ""
- "cmpld%I2 %0,%1,%W2"
- [(set_attr "type" "compare")])
-
-;; The following two insns don't exist as single insns, but if we provide
-;; them, we can swap an add and compare, which will enable us to overlap more
-;; of the required delay between a compare and branch. We generate code for
-;; them by splitting.
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=y")
- (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "short_cint_operand" "i")))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
- ""
- "#"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
- (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "u_short_cint_operand" "i")))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
- ""
- "#"
- [(set_attr "length" "8")])
-
-(define_split
- [(set (match_operand:CC 3 "cc_reg_operand" "")
- (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "short_cint_operand" "")))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
- ""
- [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
-
-(define_split
- [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
- (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
- (match_operand:SI 2 "u_short_cint_operand" "")))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
- ""
- [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
- (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
-
-(define_insn ""
- [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
- (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "fcmpu %0,%1,%2"
- [(set_attr "type" "fpcompare")])
-
-(define_insn ""
- [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
- (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
- (match_operand:DF 2 "gpc_reg_operand" "f")))]
- "TARGET_HARD_FLOAT"
- "fcmpu %0,%1,%2"
- [(set_attr "type" "fpcompare")])
-
-;; Now we have the scc insns. We can do some combinations because of the
-;; way the machine works.
-;;
-;; Note that this is probably faster if we can put an insn between the
-;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
-;; cases the insns below which don't use an intermediate CR field will
-;; be used instead.
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (match_operator:SI 1 "scc_comparison_operator"
- [(match_operand 2 "cc_reg_operand" "y")
- (const_int 0)]))]
- ""
- "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC (match_operator:SI 1 "scc_comparison_operator"
- [(match_operand 2 "cc_reg_operand" "y")
- (const_int 0)])
- (const_int 0)))
- (set (match_operand:SI 3 "gpc_reg_operand" "=r")
- (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
- ""
- "%D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1"
- [(set_attr "type" "delayed_compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
- [(match_operand 2 "cc_reg_operand" "y")
- (const_int 0)])
- (match_operand:SI 3 "const_int_operand" "n")))]
- ""
- "*
-{
- int is_bit = ccr_bit (operands[1], 1);
- int put_bit = 31 - (INTVAL (operands[3]) & 31);
- int count;
-
- if (is_bit >= put_bit)
- count = is_bit - put_bit;
- else
- count = 32 - (put_bit - is_bit);
-
- operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
- operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
-
- return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
-}"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
- [(match_operand 2 "cc_reg_operand" "y")
- (const_int 0)])
- (match_operand:SI 3 "const_int_operand" "n"))
- (const_int 0)))
- (set (match_operand:SI 4 "gpc_reg_operand" "=r")
- (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
- (match_dup 3)))]
- ""
- "*
-{
- int is_bit = ccr_bit (operands[1], 1);
- int put_bit = 31 - (INTVAL (operands[3]) & 31);
- int count;
-
- if (is_bit >= put_bit)
- count = is_bit - put_bit;
- else
- count = 32 - (put_bit - is_bit);
-
- operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
- operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
-
- return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
-}"
- [(set_attr "type" "delayed_compare")
- (set_attr "length" "12")])
-
-;; If we are comparing the result of two comparisons, this can be done
-;; using creqv or crxor.
-
-(define_insn ""
- [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
- (compare:CCEQ (match_operator 1 "scc_comparison_operator"
- [(match_operand 2 "cc_reg_operand" "y")
- (const_int 0)])
- (match_operator 3 "scc_comparison_operator"
- [(match_operand 4 "cc_reg_operand" "y")
- (const_int 0)])))]
- "REGNO (operands[2]) != REGNO (operands[4])"
- "*
-{
- enum rtx_code code1, code2;
-
- code1 = GET_CODE (operands[1]);
- code2 = GET_CODE (operands[3]);
-
- if ((code1 == EQ || code1 == LT || code1 == GT
- || code1 == LTU || code1 == GTU
- || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
- !=
- (code2 == EQ || code2 == LT || code2 == GT
- || code2 == LTU || code2 == GTU
- || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
- return \"%C1%C3crxor %E0,%j1,%j3\";
- else
- return \"%C1%C3creqv %E0,%j1,%j3\";
-}"
- [(set_attr "length" "12")])
-
-;; There is a 3 cycle delay between consecutive mfcr instructions
-;; so it is useful to combine 2 scc instructions to use only one mfcr.
-
-(define_peephole
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (match_operator:SI 1 "scc_comparison_operator"
- [(match_operand 2 "cc_reg_operand" "y")
- (const_int 0)]))
- (set (match_operand:SI 3 "gpc_reg_operand" "=r")
- (match_operator:SI 4 "scc_comparison_operator"
- [(match_operand 5 "cc_reg_operand" "y")
- (const_int 0)]))]
- "REGNO (operands[2]) != REGNO (operands[5])"
- "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
- [(set_attr "length" "20")])
-
-;; There are some scc insns that can be done directly, without a compare.
-;; These are faster because they don't involve the communications between
-;; the FXU and branch units. In fact, we will be replacing all of the
-;; integer scc insns here or in the portable methods in emit_store_flag.
-;;
-;; Also support (neg (scc ..)) since that construct is used to replace
-;; branches, (plus (scc ..) ..) since that construct is common and
-;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
-;; cases where it is no more expensive than (neg (scc ..)).
-
-;; Have reload force a constant into a register for the simple insns that
-;; otherwise won't accept constants. We do this because it is faster than
-;; the cmp/mfcr sequence we would otherwise generate.
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
- (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
- (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
- ""
- "@
- xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
- {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
- {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
- {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
- {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
- [(set_attr "length" "12,8,12,12,12")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
- (compare:CC
- (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
- (eq:SI (match_dup 1) (match_dup 2)))
- (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
- ""
- "@
- xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
- {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
- {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
- {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
- {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0"
- [(set_attr "type" "compare")
- (set_attr "length" "12,8,12,12,12")])
-
-;; We have insns of the form shown by the first define_insn below. If
-;; there is something inside the comparison operation, we must split it.
-(define_split
- [(set (match_operand:SI 0 "gpc_reg_operand" "")
- (plus:SI (match_operator 1 "comparison_operator"
- [(match_operand:SI 2 "" "")
- (match_operand:SI 3
- "reg_or_cint_operand" "")])
- (match_operand:SI 4 "gpc_reg_operand" "")))
- (clobber (match_operand:SI 5 "register_operand" ""))]
- "! gpc_reg_operand (operands[2], SImode)"
- [(set (match_dup 5) (match_dup 2))
- (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
- (match_dup 4)))])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
- (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
- (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
- ""
- "@
- xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
- {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3
- {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
- {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
- {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
- [(set_attr "length" "12,8,12,12,12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
- (compare:CC
- (plus:SI
- (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
- ""
- "@
- xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
- {sfi|subfic} %4,%1,0\;{aze.|addze.} %0,%3
- {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
- {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
- {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12,8,12,12,12")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
- (compare:CC
- (plus:SI
- (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
- (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
- ""
- "@
- xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
- {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
- {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
- {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
- {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12,8,12,12,12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
- (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
- (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
- ""
- "@
- xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
- {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
- {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
- {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
- {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
- [(set_attr "length" "12,8,12,12,12")])
-
-;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
-;; since it nabs/sr is just as fast.
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
- (const_int 31)))
- (clobber (match_scratch:SI 2 "=&r"))]
- "!TARGET_POWER"
- "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
- [(set_attr "length" "8")])
-
-;; This is what (plus (ne X (const_int 0)) Y) looks like.
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (lshiftrt:SI
- (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
- (const_int 31))
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (clobber (match_scratch:SI 3 "=&r"))]
- ""
- "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (lshiftrt:SI
- (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
- (const_int 31))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=&r"))]
- ""
- "{ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (lshiftrt:SI
- (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
- (const_int 31))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
- (match_dup 2)))
- (clobber (match_scratch:SI 3 "=&r"))]
- ""
- "{ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,O")))
- (clobber (match_scratch:SI 3 "=r,X"))]
- "TARGET_POWER"
- "@
- doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
- {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
- (compare:CC
- (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,O"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (le:SI (match_dup 1) (match_dup 2)))
- (clobber (match_scratch:SI 3 "=r,X"))]
- "TARGET_POWER"
- "@
- doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
- {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31"
- [(set_attr "type" "compare,delayed_compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,O"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r")))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- "TARGET_POWER"
- "@
- doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
- {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC
- (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,O"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- "TARGET_POWER"
- "@
- doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
- {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
- (compare:CC
- (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,O"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- "TARGET_POWER"
- "@
- doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
- {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
- "TARGET_POWER"
- "@
- doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
- {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI")))]
- ""
- "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC
- (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (leu:SI (match_dup 1) (match_dup 2)))]
- ""
- "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (match_operand:SI 3 "gpc_reg_operand" "r")))
- (clobber (match_scratch:SI 4 "=&r"))]
- ""
- "{sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r"))]
- ""
- "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r"))]
- ""
- "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
- ""
- "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (neg:SI
- (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI")))
- (match_operand:SI 3 "gpc_reg_operand" "r")))
- (clobber (match_scratch:SI 4 "=&r"))]
- ""
- "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (and:SI (neg:SI
- (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI")))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r"))]
- ""
- "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x")
- (compare:CC
- (and:SI (neg:SI
- (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI")))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r"))]
- ""
- "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI")))]
- "TARGET_POWER"
- "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC
- (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (lt:SI (match_dup 1) (match_dup 2)))]
- "TARGET_POWER"
- "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
- [(set_attr "type" "delayed_compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (match_operand:SI 3 "gpc_reg_operand" "r")))
- (clobber (match_scratch:SI 4 "=&r"))]
- "TARGET_POWER"
- "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r"))]
- "TARGET_POWER"
- "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r"))]
- "TARGET_POWER"
- "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
- "TARGET_POWER"
- "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
- ""
- "@
- {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
- {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
- (compare:CC
- (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (ltu:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
- {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
- (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
- (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
- (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
- ""
- "@
- {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
- {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
- {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
- {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC
- (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
- {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
- (compare:CC
- (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
- {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
- ""
- "@
- {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
- {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI")))
- (clobber (match_scratch:SI 3 "=r"))]
- "TARGET_POWER"
- "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (ge:SI (match_dup 1) (match_dup 2)))
- (clobber (match_scratch:SI 3 "=r"))]
- "TARGET_POWER"
- "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (match_operand:SI 3 "gpc_reg_operand" "r")))
- (clobber (match_scratch:SI 4 "=&r"))]
- "TARGET_POWER"
- "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r"))]
- "TARGET_POWER"
- "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r"))]
- "TARGET_POWER"
- "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
- "TARGET_POWER"
- "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
- [(set_attr "length" "12")])
-
-;; This is (and (neg (ge X (const_int 0))) Y).
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (neg:SI
- (lshiftrt:SI
- (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 31)))
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (clobber (match_scratch:SI 3 "=&r"))]
- ""
- "{srai|srawi} %3,%1,31\;andc %0,%2,%3"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (and:SI (neg:SI
- (lshiftrt:SI
- (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 31)))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=&r"))]
- ""
- "{srai|srawi} %3,%1,31\;andc. %3,%2,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (and:SI (neg:SI
- (lshiftrt:SI
- (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
- (const_int 31)))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
- (const_int 31)))
- (match_dup 2)))
- (clobber (match_scratch:SI 3 "=&r"))]
- ""
- "{srai|srawi} %3,%1,31\;andc. %0,%2,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
- ""
- "@
- {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
- {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
- (compare:CC
- (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (geu:SI (match_dup 1) (match_dup 2)))]
- ""
- "@
- {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
- {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r")))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3
- {ai|addic} %4,%1,%n2\;{aze|addze} %0,%3"
- [(set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC
- (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
- {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
- (compare:CC
- (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
- {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
- ""
- "@
- {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
- {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (and:SI (neg:SI
- (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
- (match_operand:SI 3 "gpc_reg_operand" "r,r")))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
- {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC
- (and:SI (neg:SI
- (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
- {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
- (compare:CC
- (and:SI (neg:SI
- (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
- {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0)))]
- ""
- "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 2 "cc_reg_operand" "=x")
- (compare:CC
- (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (gt:SI (match_dup 1) (const_int 0)))]
- ""
- "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31"
- [(set_attr "type" "delayed_compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "r")))]
- "TARGET_POWER"
- "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC
- (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (gt:SI (match_dup 1) (match_dup 2)))]
- "TARGET_POWER"
- "doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
- [(set_attr "type" "delayed_compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0))
- (match_operand:SI 2 "gpc_reg_operand" "r")))
- (clobber (match_scratch:SI 3 "=&r"))]
- ""
- "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %0,%2"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=&r"))]
- ""
- "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %0,%2"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 4 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0))
- (match_operand:SI 2 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
- (clobber (match_scratch:SI 3 "=&r"))]
- ""
- "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "r"))
- (match_operand:SI 3 "gpc_reg_operand" "r")))
- (clobber (match_scratch:SI 4 "=&r"))]
- "TARGET_POWER"
- "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "r"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r"))]
- "TARGET_POWER"
- "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x")
- (compare:CC
- (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "r"))
- (match_operand:SI 3 "gpc_reg_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r"))]
- "TARGET_POWER"
- "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (const_int 0))))]
- ""
- "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "r"))))]
- "TARGET_POWER"
- "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI")))]
- ""
- "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
- [(set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:CC 3 "cc_reg_operand" "=x")
- (compare:CC
- (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (gtu:SI (match_dup 1) (match_dup 2)))]
- ""
- "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
- [(set_attr "type" "compare")
- (set_attr "length" "12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
- (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
- (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
- (match_operand:SI 3 "reg_or_short_operand" "r,r,I")))
- (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
- ""
- "@
- {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3
- {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
- {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
- [(set_attr "length" "8,12,12")])
-
-(define_insn ""
- [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
- (compare:CC
- (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_short_operand" "I,r"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
- {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8,12")])
-
-(define_insn ""
- [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
- (compare:CC
- (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
- (match_operand:SI 2 "reg_or_short_operand" "I,r"))
- (match_operand:SI 3 "gpc_reg_operand" "r,r"))
- (const_int 0)))
- (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
- (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
- (clobber (match_scratch:SI 4 "=&r,&r"))]
- ""
- "@
- {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
- {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
- [(set_attr "type" "compare")
- (set_attr "length" "8,12")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
- (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
- ""
- "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
- [(set_attr "length" "8")])
-
-;; Define both directions of branch and return. If we need a reload
-;; register, we'd rather use CR0 since it is much easier to copy a
-;; register CC value to there.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "branch_comparison_operator"
- [(match_operand 2
- "cc_reg_operand" "x,?y")
- (const_int 0)])
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "*
-{
- if (get_attr_length (insn) == 8)
- return \"%C1bc %t1,%j1,%l0\";
- else
- return \"%C1bc %T1,%j1,%$+8\;b %l0\";
-
-}"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "branch_comparison_operator"
- [(match_operand 1
- "cc_reg_operand" "x,?y")
- (const_int 0)])
- (return)
- (pc)))]
- "direct_return ()"
- "{%C0bcr|%C0bclr} %t0,%j0"
- [(set_attr "type" "branch")
- (set_attr "length" "8")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 1 "branch_comparison_operator"
- [(match_operand 2
- "cc_reg_operand" "x,?y")
- (const_int 0)])
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "*
-{
- if (get_attr_length (insn) == 8)
- return \"%C1bc %T1,%j1,%l0\";
- else
- return \"%C1bc %t1,%j1,%$+8\;b %l0\";
-}"
- [(set_attr "type" "branch")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "branch_comparison_operator"
- [(match_operand 1
- "cc_reg_operand" "x,?y")
- (const_int 0)])
- (pc)
- (return)))]
- "direct_return ()"
- "{%C0bcr|%C0bclr} %T0,%j0"
- [(set_attr "type" "branch")
- (set_attr "length" "8")])
-
-;; Unconditional branch and return.
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "b %l0"
- [(set_attr "type" "branch")])
-
-(define_insn "return"
- [(return)]
- "direct_return ()"
- "{br|blr}"
- [(set_attr "type" "jmpreg")])
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
- ""
- "@
- bctr
- {br|blr}"
- [(set_attr "type" "jmpreg")])
-
-(define_insn ""
- [(set (pc) (match_operand:DI 0 "register_operand" "c,l"))]
- "TARGET_POWERPC64"
- "@
- bctr
- {br|blr}"
- [(set_attr "type" "jmpreg")])
-
-;; Table jump for switch statements:
-(define_expand "tablejump"
- [(use (match_operand 0 "" ""))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "
-{
- if (TARGET_32BIT)
- emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
- else
- emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
- DONE;
-}")
-
-(define_expand "tablejumpsi"
- [(set (match_dup 3)
- (plus:SI (match_operand:SI 0 "" "")
- (match_dup 2)))
- (parallel [(set (pc) (match_dup 3))
- (use (label_ref (match_operand 1 "" "")))])]
- ""
- "
-{ operands[0] = force_reg (SImode, operands[0]);
- operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-(define_expand "tablejumpdi"
- [(set (match_dup 3)
- (plus:DI (match_operand:DI 0 "" "")
- (match_dup 2)))
- (parallel [(set (pc) (match_dup 3))
- (use (label_ref (match_operand 1 "" "")))])]
- ""
- "
-{ operands[0] = force_reg (DImode, operands[0]);
- operands[2] = force_reg (DImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
- operands[3] = gen_reg_rtx (DImode);
-}")
-
-(define_insn ""
- [(set (pc)
- (match_operand:SI 0 "register_operand" "c,l"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "@
- bctr
- {br|blr}"
- [(set_attr "type" "jmpreg")])
-
-(define_insn ""
- [(set (pc)
- (match_operand:DI 0 "register_operand" "c,l"))
- (use (label_ref (match_operand 1 "" "")))]
- "TARGET_POWERPC64"
- "@
- bctr
- {br|blr}"
- [(set_attr "type" "jmpreg")])
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "{cror 0,0,0|nop}")
-
-;; Define the subtract-one-and-jump insns, starting with the template
-;; so loop.c knows what to generate.
-
-(define_expand "decrement_and_branch_on_count"
- [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "")
- (const_int 1))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))
- (clobber (match_scratch:CC 2 ""))
- (clobber (match_scratch:SI 3 ""))])]
- ""
- "")
-
-;; We need to be able to do this for any operand, including MEM, or we
-;; will cause reload to blow up since we don't allow output reloads on
-;; JUMP_INSNs.
-;; In order that the length attribute is calculated correctly, the
-;; label MUST be operand 0.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
- (const_int 1))
- (label_ref (match_operand 0 "" ""))
- (pc)))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
- (plus:SI (match_dup 1)
- (const_int -1)))
- (clobber (match_scratch:CC 3 "=X,&x,&x"))
- (clobber (match_scratch:SI 4 "=X,X,r"))]
- ""
- "*
-{
- if (which_alternative != 0)
- return \"#\";
- else if (get_attr_length (insn) == 8)
- return \"{bdn|bdnz} %l0\";
- else
- return \"bdz %$+8\;b %l0\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "*,12,16")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
- (const_int 1))
- (pc)
- (label_ref (match_operand 0 "" ""))))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
- (plus:SI (match_dup 1)
- (const_int -1)))
- (clobber (match_scratch:CC 3 "=X,&x,&x"))
- (clobber (match_scratch:SI 4 "=X,X,r"))]
- ""
- "*
-{
- if (which_alternative != 0)
- return \"#\";
- else if (get_attr_length (insn) == 8)
- return \"bdz %l0\";
- else
- return \"{bdn|bdnz} %$+8\;b %l0\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "*,12,16")])
-
-;; Similar, but we can use GE since we have a REG_NONNEG.
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
- (plus:SI (match_dup 1)
- (const_int -1)))
- (clobber (match_scratch:CC 3 "=X,&x,&X"))
- (clobber (match_scratch:SI 4 "=X,X,r"))]
- "find_reg_note (insn, REG_NONNEG, 0)"
- "*
-{
- if (which_alternative != 0)
- return \"#\";
- else if (get_attr_length (insn) == 8)
- return \"{bdn|bdnz} %l0\";
- else
- return \"bdz %$+8\;b %l0\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "*,12,16")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
- (plus:SI (match_dup 1)
- (const_int -1)))
- (clobber (match_scratch:CC 3 "=X,&x,&X"))
- (clobber (match_scratch:SI 4 "=X,X,r"))]
- "find_reg_note (insn, REG_NONNEG, 0)"
- "*
-{
- if (which_alternative != 0)
- return \"#\";
- else if (get_attr_length (insn) == 8)
- return \"bdz %l0\";
- else
- return \"{bdn|bdnz} %$+8\;b %l0\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "*,12,16")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
- (const_int 1))
- (label_ref (match_operand 0 "" ""))
- (pc)))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
- (plus:SI (match_dup 1)
- (const_int -1)))
- (clobber (match_scratch:CC 3 "=X,&x,&x"))
- (clobber (match_scratch:SI 4 "=X,X,r"))]
- ""
- "*
-{
- if (which_alternative != 0)
- return \"#\";
- else if (get_attr_length (insn) == 8)
- return \"bdz %l0\";
- else
- return \"{bdn|bdnz} %$+8\;b %l0\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "*,12,16")])
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
- (const_int 1))
- (pc)
- (label_ref (match_operand 0 "" ""))))
- (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
- (plus:SI (match_dup 1)
- (const_int -1)))
- (clobber (match_scratch:CC 3 "=X,&x,&x"))
- (clobber (match_scratch:SI 4 "=X,X,r"))]
- ""
- "*
-{
- if (which_alternative != 0)
- return \"#\";
- else if (get_attr_length (insn) == 8)
- return \"{bdn|bdnz} %l0\";
- else
- return \"bdz %$+8\;b %l0\";
-}"
- [(set_attr "type" "branch")
- (set_attr "length" "*,12,16")])
-
-(define_split
- [(set (pc)
- (if_then_else (match_operator 2 "comparison_operator"
- [(match_operand:SI 1 "gpc_reg_operand" "")
- (const_int 1)])
- (match_operand 5 "" "")
- (match_operand 6 "" "")))
- (set (match_operand:SI 0 "gpc_reg_operand" "")
- (plus:SI (match_dup 1)
- (const_int -1)))
- (clobber (match_scratch:CC 3 ""))
- (clobber (match_scratch:SI 4 ""))]
- "reload_completed"
- [(parallel [(set (match_dup 3)
- (compare:CC (plus:SI (match_dup 1)
- (const_int -1))
- (const_int 0)))
- (set (match_dup 0)
- (plus:SI (match_dup 1)
- (const_int -1)))])
- (set (pc) (if_then_else (match_dup 7)
- (match_dup 5)
- (match_dup 6)))]
- "
-{ operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
- const0_rtx); }")
-
-(define_split
- [(set (pc)
- (if_then_else (match_operator 2 "comparison_operator"
- [(match_operand:SI 1 "gpc_reg_operand" "")
- (const_int 1)])
- (match_operand 5 "" "")
- (match_operand 6 "" "")))
- (set (match_operand:SI 0 "general_operand" "")
- (plus:SI (match_dup 1) (const_int -1)))
- (clobber (match_scratch:CC 3 ""))
- (clobber (match_scratch:SI 4 ""))]
- "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
- [(parallel [(set (match_dup 3)
- (compare:CC (plus:SI (match_dup 1)
- (const_int -1))
- (const_int 0)))
- (set (match_dup 4)
- (plus:SI (match_dup 1)
- (const_int -1)))])
- (set (match_dup 0)
- (match_dup 4))
- (set (pc) (if_then_else (match_dup 7)
- (match_dup 5)
- (match_dup 6)))]
- "
-{ operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
- const0_rtx); }")
diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h
deleted file mode 100644
index b63b44c5747..00000000000
--- a/gcc/config/rs6000/rtems.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Definitions for rtems targetting a PowerPC using elf.
-
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Joel Sherrill (joel@OARcorp.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 "rs6000/eabi.h"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-DPPC -Drtems -D__rtems__ \
- -Asystem(rtems) -Acpu(powerpc) -Amachine(powerpc)"
-
-/* rtems is in the SUBTARGET_SWITCHES in rs6000/sysv4.h */
-
-/* end of powerpc-rtems.h */
diff --git a/gcc/config/rs6000/sol-c0.c b/gcc/config/rs6000/sol-c0.c
deleted file mode 100644
index bf935c3d371..00000000000
--- a/gcc/config/rs6000/sol-c0.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Solaris PowerPC startfile. */
-/* Copyright (C) 1996 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. */
-
-/* As a special exception, if you link this library with other files,
- some of which are compiled with GCC, to produce an executable,
- this library 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. */
-
-extern char **_environ;
-
-extern int atexit (void (*__func) (void));
-extern void __init (void) __attribute__ ((__longcall__));
-extern void __fini (void) __attribute__ ((__longcall__));
-
-typedef void (*func_ptr) (void);
-int (*__atexit)(func_ptr) = atexit;
-
-/* Exception handling */
-struct ex_shared1 {
- void *prev;
- void *next;
- char *text_start;
- char *range_start;
- char *text_end;
- char *range_end;
-};
-
-struct ex_shared {
- void (*ex_register) (struct ex_shared1 *);
- void (*ex_deregister) (struct ex_shared1 *);
- struct ex_shared1 shared_info;
-};
-
-extern char _ex_text0[], _ex_text1[];
-extern char _ex_range0[], _ex_range1[];
-extern void _ex_register (struct ex_shared1 *);
-extern void _ex_deregister (struct ex_shared1 *);
-extern char _SDA_BASE_[];
-extern char _SDA2_BASE_[];
-
-struct ex_shared shared __attribute__((section(".ex_shared"))) = {
- _ex_register,
- _ex_deregister,
- {
- (void *)0,
- (void *)0,
- _ex_text0,
- _ex_range0,
- _ex_text1,
- _ex_range1
- }
-};
-
-static void
-deregister (void)
-{
- (* shared.ex_deregister) (&shared.shared_info);
-}
-
-/* Start function. */
-void
-_start(int argc, char *argv[], char *envp[], void *auxp, void (*termfunc)())
-{
- int ret;
- int dummy = 0;
-
-#if 0
- /* Disable this for now, it causes an impossible reload. */
- /* Load up r13/r2 before we do anything else. */
- __asm__ volatile ("mr %%r13,%0;mr %%r2,%1" : "=r" (dummy) : "r" (&_SDA_BASE_[0]), "r" (&_SDA2_BASE_[0]), "r" (dummy));
-#endif
-
- _environ = envp + dummy;
-
- /* Register loader termination function (the || dummy is to make sure the above asm
- is not optimized away). */
- if (termfunc)
- atexit (termfunc);
-
- /* Register exception handler if needed */
- if (shared.ex_register)
- (* shared.ex_register) (&shared.shared_info);
-
- if (shared.ex_deregister)
- atexit (deregister);
-
- /* Call any global constructors and destructors. */
- __init ();
-
- atexit (__fini);
-
- /* Call the main program now */
- ret = main (argc, argv, envp, auxp);
-
- /* Return to the os */
- exit (ret);
-}
-
-/* Provide a dummy __eabi in case main got compiled without -mcall-solaris. */
-void
-__eabi ()
-{
-}
diff --git a/gcc/config/rs6000/sol-ci.asm b/gcc/config/rs6000/sol-ci.asm
deleted file mode 100644
index d0eced3a09c..00000000000
--- a/gcc/config/rs6000/sol-ci.asm
+++ /dev/null
@@ -1,104 +0,0 @@
-# crti.s for solaris
-
-# Copyright (C) 1996 Free Software Foundation, Inc.
-# Written By Michael Meissner
-#
-# 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, or (at your option) any
-# later version.
-#
-# In addition to the permissions in the GNU General Public License, the
-# Free Software Foundation gives you unlimited permission to link the
-# compiled version of this file with other programs, and to distribute
-# those programs without any restriction coming from the use of this
-# file. (The General Public License restrictions do apply in other
-# respects; for example, they cover modification of the file, and
-# distribution when not linked into another program.)
-#
-# This file 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; 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 link this library with files
-# compiled with GCC to produce an executable, this does not 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.
-#
-
-# This file just supplies labeled starting points for the .got* and other
-# special sections. It is linked in first before other modules.
-
- .file "scrti.s"
- .ident "GNU C scrti.s"
-
-# Start of .text
- .section ".text"
- .globl _ex_text0
-_ex_text0:
-
-# Exception range
- .section ".exception_ranges","aw"
- .globl _ex_range0
-_ex_range0:
-
-# List of C++ constructors
- .section ".ctors","aw"
- .globl __CTOR_LIST__
- .type __CTOR_LIST__,@object
-__CTOR_LIST__:
-
-# List of C++ destructors
- .section ".dtors","aw"
- .globl __DTOR_LIST__
- .type __DTOR_LIST__,@object
-__DTOR_LIST__:
-
-# Head of __init function used for static constructors in Solaris
- .section ".init","ax"
- .align 2
- .globl __init
- .type __init,@function
-__init: stwu %r1,-16(%r1)
- mflr %r0
- stw %r31,12(%r1)
- stw %r0,16(%r1)
-
- bl _GLOBAL_OFFSET_TABLE_-4 # get the GOT address
- mflr %r31
-
-# lwz %r3,_ex_shared0@got(%r31)
-# lwz %r4,-8(%r3) # _ex_register or 0
-# cmpi %cr0,%r4,0
-# beq .Lno_reg
-# mtlr %r4
-# blrl
-#.Lno_reg:
-
-# Head of __fini function used for static destructors in Solaris
- .section ".fini","ax"
- .align 2
- .globl __fini
- .type __fini,@function
-__fini: stwu %r1,-16(%r1)
- mflr %r0
- stw %r31,12(%r1)
- stw %r0,16(%r1)
-
- bl _GLOBAL_OFFSET_TABLE_-4 # get the GOT address
- mflr %r31
-
-# _environ and its evil twin environ, pointing to the environment
- .section ".sdata","aw"
- .align 2
- .globl _environ
- .space 4
- .weak environ
- .set environ,_environ
diff --git a/gcc/config/rs6000/sol-cn.asm b/gcc/config/rs6000/sol-cn.asm
deleted file mode 100644
index 2bc992e1391..00000000000
--- a/gcc/config/rs6000/sol-cn.asm
+++ /dev/null
@@ -1,82 +0,0 @@
-# crtn.s for solaris
-
-# Copyright (C) 1996 Free Software Foundation, Inc.
-# Written By Michael Meissner
-#
-# 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, or (at your option) any
-# later version.
-#
-# In addition to the permissions in the GNU General Public License, the
-# Free Software Foundation gives you unlimited permission to link the
-# compiled version of this file with other programs, and to distribute
-# those programs without any restriction coming from the use of this
-# file. (The General Public License restrictions do apply in other
-# respects; for example, they cover modification of the file, and
-# distribution when not linked into another program.)
-#
-# This file 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; 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 link this library with files
-# compiled with GCC to produce an executable, this does not 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.
-#
-
-# This file just supplies labeled ending points for the .got* and other
-# special sections. It is linked in last after other modules.
-
- .file "scrtn.s"
- .ident "GNU C scrtn.s"
-
-# Default versions of exception handling register/deregister
- .weak _ex_register
- .weak _ex_deregister
- .set _ex_register,0
- .set _ex_deregister,0
-
-# End list of C++ constructors
- .section ".ctors","aw"
- .globl __CTOR_END__
- .type __CTOR_END__,@object
-__CTOR_END__:
-
-# End list of C++ destructors
- .section ".dtors","aw"
- .globl __DTOR_END__
- .type __DTOR_END__,@object
-__DTOR_END__:
-
- .section ".text"
- .globl _ex_text1
-_ex_text1:
-
- .section ".exception_ranges","aw"
- .globl _ex_range1
-_ex_range1:
-
-# Tail of __init used for static constructors in Solaris
- .section ".init","ax"
- lwz %r0,16(%r1)
- lwz %r31,12(%r1)
- mtlr %r0
- addi %r1,%r1,16
- blr
-
-# Tail of __fini used for static destructors in Solaris
- .section ".fini","ax"
- lwz %r0,16(%r1)
- lwz %r31,12(%r1)
- mtlr %r0
- addi %r1,%r1,16
- blr
diff --git a/gcc/config/rs6000/sol2.h b/gcc/config/rs6000/sol2.h
deleted file mode 100644
index f75ad2b5885..00000000000
--- a/gcc/config/rs6000/sol2.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Definitions of target machine for GNU compiler,
- for IBM RS/6000 running AIX version 3.1.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by David Reese (Dave.Reese@East.Sun.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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "rs6000/sysv4le.h"
-
-/* Default ABI to use */
-#undef RS6000_ABI_NAME
-#define RS6000_ABI_NAME "solaris"
-
-#undef ASM_CPU_SPEC
-#define ASM_CPU_SPEC "-le -s"
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | \
- MASK_NEW_MNEMONICS | \
- MASK_LITTLE_ENDIAN | \
- MASK_REGNAMES)
-
-#undef LIB_DEFAULT_SPEC
-#define LIB_DEFAULT_SPEC "%(lib_solaris)"
-
-#undef STARTFILE_DEFAULT_SPEC
-#define STARTFILE_DEFAULT_SPEC "%(startfile_solaris)"
-
-#undef ENDFILE_DEFAULT_SPEC
-#define ENDFILE_DEFAULT_SPEC "%(endfile_solaris)"
-
-#undef LINK_START_DEFAULT_SPEC
-#define LINK_START_DEFAULT_SPEC "%(link_start_solaris)"
-
-#undef CPP_OS_DEFAULT_SPEC
-#define CPP_OS_DEFAULT_SPEC "%(cpp_os_solaris)"
-
-#undef LINK_OS_DEFAULT_SPEC
-#define LINK_OS_DEFAULT_SPEC "%(link_os_solaris)"
-
-#undef CPP_ENDIAN_LITTLE_SPEC
-#define CPP_ENDIAN_LITTLE_SPEC CPP_ENDIAN_SOLARIS_SPEC
-
-/* Don't turn -B into -L if the argument specifies a relative file name. */
-#undef RELATIVE_PREFIX_NOT_LINKDIR
-
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (PowerPC Solaris)");
-
-
-/* Macros to check register numbers against specific register classes. */
-
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-
-#if 0
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "\t%s\t", ".lcomm"); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
-} while (0)
-#endif
-
-/* Like block addresses, stabs line numbers are relative to the
- current function. */
-
-/* use .stabd instead of .stabn */
-
-#define ASM_STABN_OP ".stabd"
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
-do \
- { \
- static int sym_lineno = 1; \
- char *_p; \
- fprintf (file, "\t.stabd 68,0,%d,.LM%d-", \
- line, sym_lineno); \
- STRIP_NAME_ENCODING (_p, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
- assemble_name (file, _p); \
- fprintf (file, "\n.LM%d:\n", sym_lineno); \
- sym_lineno += 1; \
- } \
-while (0)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
- fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", \
- t[0] & 0xffffffff, t[1] & 0xffffffff); \
- } \
- else \
- { \
- char str[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
- fprintf (FILE, "\t.double %s\n", str); \
- } \
- }
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
- fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \
- } \
- else \
- { \
- char str[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
- fprintf (FILE, "\t.float %s\n", str); \
- } \
- }
-
-
-/* Sun-ppc assembler does not permit '.' in some symbol names.
- Use 'name_.labelno' instead. */
-#undef ASM_FORMAT_PRIVATE_NAME
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s_.%d", (NAME), (LABELNO)))
-
-
-/* Define this macro as a C expression for the initializer of an
- array of string to tell the driver program which options are
- defaults for this target and thus do not need to be handled
- specially when using `MULTILIB_OPTIONS'.
-
- Do not define this macro if `MULTILIB_OPTIONS' is not defined in
- the target makefile fragment or if none of the options listed in
- `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
-
-#undef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS { "mlittle", "mcall-solaris" }
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
deleted file mode 100644
index 867b32868a5..00000000000
--- a/gcc/config/rs6000/sysv4.h
+++ /dev/null
@@ -1,1359 +0,0 @@
-/* Target definitions for GNU compiler for PowerPC running System V.4
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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. */
-
-/* Small data support types */
-enum rs6000_sdata_type {
- SDATA_NONE, /* no small data support */
- SDATA_DATA, /* just put data in .sbss/.sdata, don't use relocs */
- SDATA_SYSV, /* Use r13 to point to .sdata/.sbss */
- SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2 */
-};
-
-extern enum rs6000_sdata_type rs6000_sdata;
-
-/* V.4/eabi switches */
-#define MASK_NO_BITFIELD_TYPE 0x40000000 /* Set PCC_BITFIELD_TYPE_MATTERS to 0 */
-#define MASK_STRICT_ALIGN 0x20000000 /* Set STRICT_ALIGNMENT to 1. */
-#define MASK_RELOCATABLE 0x10000000 /* GOT pointers are PC relative */
-#define MASK_SDATA 0x08000000 /* use small data areas */
-#define MASK_LITTLE_ENDIAN 0x04000000 /* target is little endian */
-#define MASK_REGNAMES 0x02000000 /* use alternate register names. */
-#define MASK_PROTOTYPE 0x01000000 /* Only prototyped fcns pass variable args */
-#define MASK_EABI 0x00800000 /* Adhere to eabi, not System V spec */
-
-#define TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
-#define TARGET_STRICT_ALIGN (target_flags & MASK_STRICT_ALIGN)
-#define TARGET_RELOCATABLE (target_flags & MASK_RELOCATABLE)
-#define TARGET_SDATA (target_flags & MASK_SDATA)
-#define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
-#define TARGET_REGNAMES (target_flags & MASK_REGNAMES)
-#define TARGET_PROTOTYPE (target_flags & MASK_PROTOTYPE)
-#define TARGET_EABI (target_flags & MASK_EABI)
-#define TARGET_TOC ((target_flags & MASK_64BIT) \
- || ((target_flags & (MASK_RELOCATABLE \
- | MASK_MINIMAL_TOC)) \
- && flag_pic > 1) \
- || DEFAULT_ABI == ABI_AIX \
- || DEFAULT_ABI == ABI_NT)
-
-#define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
-#define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
-#define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
-#define TARGET_NO_TOC (! TARGET_TOC)
-#define TARGET_NO_EABI (! TARGET_EABI)
-
-/* Pseudo target to indicate whether the object format is ELF
- (to get around not having conditional compilation in the md file) */
-#define TARGET_ELF 1
-
-/* Note, V.4 no longer uses a normal TOC, so make -mfull-toc, be just
- the same as -mminimal-toc. */
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- { "bit-align", -MASK_NO_BITFIELD_TYPE }, \
- { "no-bit-align", MASK_NO_BITFIELD_TYPE }, \
- { "strict-align", MASK_STRICT_ALIGN }, \
- { "no-strict-align", -MASK_STRICT_ALIGN }, \
- { "relocatable", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
- { "relocatable", -MASK_SDATA }, \
- { "no-relocatable", -MASK_RELOCATABLE }, \
- { "relocatable-lib", MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC }, \
- { "relocatable-lib", -MASK_SDATA }, \
- { "no-relocatable-lib", -MASK_RELOCATABLE }, \
- { "sdata", MASK_SDATA }, \
- { "no-sdata", -MASK_SDATA }, \
- { "little-endian", MASK_LITTLE_ENDIAN }, \
- { "little", MASK_LITTLE_ENDIAN }, \
- { "big-endian", -MASK_LITTLE_ENDIAN }, \
- { "big", -MASK_LITTLE_ENDIAN }, \
- { "no-toc", 0 }, \
- { "toc", MASK_MINIMAL_TOC }, \
- { "full-toc", MASK_MINIMAL_TOC }, \
- { "prototype", MASK_PROTOTYPE }, \
- { "no-prototype", -MASK_PROTOTYPE }, \
- { "no-traceback", 0 }, \
- { "eabi", MASK_EABI }, \
- { "no-eabi", -MASK_EABI }, \
- { "regnames", MASK_REGNAMES }, \
- { "no-regnames", -MASK_REGNAMES }, \
- { "sim", 0 }, \
- { "mvme", 0 }, \
- { "emb", 0 }, \
- { "solaris-cclib", 0 }, \
- { "shlib", 0 }, \
- { "newlib", 0 },
-
-/* Default ABI to use */
-#define RS6000_ABI_NAME "sysv"
-
-/* Strings provided by SUBTARGET_OPTIONS */
-extern char *rs6000_abi_name;
-extern char *rs6000_sdata_name;
-
-#define SUBTARGET_OPTIONS \
- { "call-", &rs6000_abi_name}, \
- { "sdata=", &rs6000_sdata_name}
-
-/* Max # of bytes for variables to automatically be put into the .sdata
- or .sdata2 sections. */
-extern int g_switch_value; /* value of the -G xx switch */
-extern int g_switch_set; /* whether -G xx was passed. */
-
-#ifndef SDATA_DEFAULT_SIZE
-#define SDATA_DEFAULT_SIZE 8
-#endif
-
-/* Sometimes certain combinations of command options do not make sense
- on a particular target machine. You can define a macro
- `OVERRIDE_OPTIONS' to take account of this. This macro, if
- defined, is executed once just after all the command options have
- been parsed.
-
- The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
- get control. */
-
-#define SUBTARGET_OVERRIDE_OPTIONS \
-do { \
- if (!g_switch_set) \
- g_switch_value = SDATA_DEFAULT_SIZE; \
- \
- if (!strcmp (rs6000_abi_name, "sysv")) \
- rs6000_current_abi = ABI_V4; \
- else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
- { \
- rs6000_current_abi = ABI_V4; \
- target_flags &= ~ MASK_EABI; \
- } \
- else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
- || !strcmp (rs6000_abi_name, "eabi")) \
- { \
- rs6000_current_abi = ABI_V4; \
- target_flags |= MASK_EABI; \
- } \
- else if (!strcmp (rs6000_abi_name, "aix")) \
- { \
- rs6000_current_abi = ABI_AIX_NODESC; \
- target_flags |= MASK_EABI; \
- } \
- else if (!strcmp (rs6000_abi_name, "aixdesc")) \
- rs6000_current_abi = ABI_AIX; \
- else if (!strcmp (rs6000_abi_name, "nt")) \
- rs6000_current_abi = ABI_NT; \
- else if (!strcmp (rs6000_abi_name, "linux")) \
- rs6000_current_abi = ABI_V4; \
- else if (!strcmp (rs6000_abi_name, "solaris")) \
- rs6000_current_abi = ABI_SOLARIS; \
- else \
- { \
- rs6000_current_abi = ABI_V4; \
- error ("Bad value for -mcall-%s", rs6000_abi_name); \
- } \
- \
- if (rs6000_sdata_name) \
- { \
- target_flags |= MASK_SDATA; \
- if (!strcmp (rs6000_sdata_name, "none")) \
- { \
- rs6000_sdata = SDATA_NONE; \
- target_flags &= ~MASK_SDATA; \
- } \
- else if (!strcmp (rs6000_sdata_name, "data")) \
- rs6000_sdata = SDATA_DATA; \
- else if (!strcmp (rs6000_sdata_name, "default")) \
- rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \
- else if (!strcmp (rs6000_sdata_name, "sysv")) \
- rs6000_sdata = SDATA_SYSV; \
- else if (!strcmp (rs6000_sdata_name, "eabi")) \
- rs6000_sdata = SDATA_EABI; \
- else \
- error ("Bad value for -msdata=%s", rs6000_sdata_name); \
- } \
- else if (TARGET_SDATA && TARGET_EABI) \
- { \
- rs6000_sdata = SDATA_EABI; \
- rs6000_sdata_name = "eabi"; \
- } \
- else if (TARGET_SDATA) \
- { \
- rs6000_sdata = SDATA_SYSV; \
- rs6000_sdata_name = "sysv"; \
- } \
- else if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
- { \
- rs6000_sdata = SDATA_DATA; \
- rs6000_sdata_name = "data"; \
- target_flags |= MASK_SDATA; \
- } \
- else \
- { \
- rs6000_sdata = SDATA_NONE; \
- rs6000_sdata_name = "none"; \
- } \
- \
- if (TARGET_RELOCATABLE && \
- (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
- { \
- rs6000_sdata = SDATA_DATA; \
- error ("-mrelocatable and -msdata=%s are incompatible.", \
- rs6000_sdata_name); \
- } \
- \
- else if (flag_pic && \
- (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
- { \
- rs6000_sdata = SDATA_DATA; \
- error ("-f%s and -msdata=%s are incompatible.", \
- (flag_pic > 1) ? "PIC" : "pic", \
- rs6000_sdata_name); \
- } \
- \
- if (TARGET_SDATA && DEFAULT_ABI != ABI_V4 && DEFAULT_ABI != ABI_SOLARIS) \
- { \
- target_flags &= ~MASK_SDATA; \
- error ("-msdata and -mcall-%s are incompatible.", rs6000_abi_name); \
- } \
- \
- if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
- { \
- target_flags |= MASK_MINIMAL_TOC; \
- error ("-mrelocatable and -mno-minimal-toc are incompatible."); \
- } \
- \
- if (TARGET_RELOCATABLE && \
- (rs6000_current_abi == ABI_AIX || rs6000_current_abi == ABI_NT)) \
- { \
- target_flags &= ~MASK_RELOCATABLE; \
- error ("-mrelocatable and -mcall-%s are incompatible.", \
- rs6000_abi_name); \
- } \
- \
- if (flag_pic > 1 && \
- (rs6000_current_abi == ABI_AIX || rs6000_current_abi == ABI_NT)) \
- { \
- flag_pic = 0; \
- error ("-fPIC and -mcall-%s are incompatible.", \
- rs6000_abi_name); \
- } \
- \
- if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
- { \
- target_flags &= ~MASK_LITTLE_ENDIAN; \
- error ("-mcall-aixdesc must be big endian"); \
- } \
- \
- if (rs6000_current_abi == ABI_NT && TARGET_BIG_ENDIAN) \
- { \
- target_flags |= MASK_LITTLE_ENDIAN; \
- error ("-mcall-nt must be little endian"); \
- } \
- \
- /* Treat -fPIC the same as -mrelocatable */ \
- if (flag_pic > 1) \
- target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
- \
- else if (TARGET_RELOCATABLE) \
- flag_pic = 2; \
- \
-} while (0)
-
-/* Default ABI to compile code for */
-#define DEFAULT_ABI rs6000_current_abi
-
-#include "rs6000/powerpc.h"
-
-/* System V.4 uses register 13 as a pointer to the small data area,
- so it is not available to the normal user. */
-
-#undef FIXED_R13
-#define FIXED_R13 1
-
-/* System V.4 passes the first 8 floating arguments in registers,
- instead of the first 13 like AIX does. */
-#undef FP_ARG_MAX_REG
-#define FP_ARG_MAX_REG ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC) \
- ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)
-
-/* Size of the V.4 varargs area if needed */
-#undef RS6000_VARARGS_AREA
-#define RS6000_VARARGS_AREA ((rs6000_sysv_varargs_p) ? RS6000_VARARGS_SIZE : 0)
-
-/* Override default big endianism */
-#undef BYTES_BIG_ENDIAN
-#undef WORDS_BIG_ENDIAN
-#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
-#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
-
-/* Define this to set the endianness to use in libgcc2.c, which can
- not depend on target_flags. */
-#if !defined(_LITTLE_ENDIAN) && !defined(__sun__)
-#define LIBGCC2_WORDS_BIG_ENDIAN 1
-#else
-#define LIBGCC2_WORDS_BIG_ENDIAN 0
-#endif
-
-/* Size of the outgoing register save area */
-#undef RS6000_REG_SAVE
-#define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX \
- || DEFAULT_ABI == ABI_AIX_NODESC) \
- ? (TARGET_64BIT ? 64 : 32) \
- : 0)
-
-/* Size of the fixed area on the stack. For AIX, use the standard 6 word
- area, otherwise use 2 words to store back chain & LR. */
-#undef RS6000_SAVE_AREA
-#define RS6000_SAVE_AREA \
- (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC) ? 24 : 8) << (TARGET_64BIT ? 1 : 0))
-
-/* Define cutoff for using external functions to save floating point.
- Currently on V.4, always use inline stores */
-#undef FP_SAVE_INLINE
-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
-
-/* Don't generate XCOFF debugging information. */
-
-#undef XCOFF_DEBUGGING_INFO
-
-/* Don't use the COFF object file format. */
-
-#undef OBJECT_FORMAT_COFF
-
-/* Don't bother to output .extern pseudo-ops. They are not needed by
- ELF assemblers. */
-
-#undef ASM_OUTPUT_EXTERNAL
-
-/* Undefine some things which are defined by the generic svr4.h. */
-
-#undef ASM_FILE_END
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-#undef READONLY_DATA_SECTION
-#undef SELECT_SECTION
-#undef ASM_DECLARE_FUNCTION_NAME
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-
-/* Use the regular svr4 definitions. */
-
-#include "svr4.h"
-
-/* Prefix and suffix to use to saving floating point */
-#undef SAVE_FP_PREFIX
-#undef SAVE_FP_SUFFIX
-#define SAVE_FP_PREFIX "_savefpr_"
-#define SAVE_FP_SUFFIX "_l"
-
-/* Prefix and suffix to use to restoring floating point */
-#undef RESTORE_FP_PREFIX
-#undef RESTORE_FP_SUFFIX
-#define RESTORE_FP_PREFIX "_restfpr_"
-#define RESTORE_FP_SUFFIX "_l"
-
-/* Type used for ptrdiff_t, as a string used in a declaration. */
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-/* Type used for wchar_t, as a string used in a declaration. */
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-
-/* Width of wchar_t in bits. */
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 16
-
-/* Make int foo : 8 not cause structures to be aligned to an int boundary */
-
-#undef PCC_BITFIELD_TYPE_MATTERS
-#define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
-
-/* Define this macro to be the value 1 if instructions will fail to
- work if given data not on the nominal alignment. If instructions
- will merely go slower in that case, define this macro as 0.
-
- Note, little endian systems trap on unaligned addresses, so never
- turn off strict alignment in that case. */
-#undef STRICT_ALIGNMENT
-#define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN || TARGET_LITTLE_ENDIAN)
-
-/* Alignment in bits of the stack boundary. Note, in order to allow building
- one set of libraries with -mno-eabi instead of eabi libraries and non-eabi
- versions, just use 64 as the stack boundary. */
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY 64
-
-/* Real stack boundary as mandated by the appropriate ABI */
-#define ABI_STACK_BOUNDARY ((TARGET_EABI) ? 64 : 128)
-
-/* No data type wants to be aligned rounder than this. */
-#undef BIGGEST_ALIGNMENT
-#define BIGGEST_ALIGNMENT ((TARGET_EABI) ? 64 : 128)
-
-#undef BIGGEST_FIELD_ALIGNMENT
-#undef ADJUST_FIELD_ALIGN
-#undef ROUND_TYPE_ALIGN
-
-/* Use ELF style section commands. */
-
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP "\t.section \".text\""
-
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP "\t.section \".data\""
-
-#undef BSS_SECTION_ASM_OP
-#define BSS_SECTION_ASM_OP "\t.section \".bss\""
-
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP "\t.section \".init\",\"ax\""
-
-#undef FINI_SECTION_ASM_OP
-#define FINI_SECTION_ASM_OP "\t.section \".fini\",\"ax\""
-
-#define TOC_SECTION_ASM_OP "\t.section \".got\",\"aw\""
-
-/* Put PC relative got entries in .got2 */
-#define MINIMAL_TOC_SECTION_ASM_OP \
- ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
-
-/* Put relocatable data in .data, not .rodata so initialized pointers can be updated */
-#undef CONST_SECTION_ASM_OP
-#define CONST_SECTION_ASM_OP \
- ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".data\"\t# .rodata" : "\t.section\t\".rodata\"")
-
-
-#define SDATA_SECTION_ASM_OP "\t.section \".sdata\",\"aw\""
-#define SDATA2_SECTION_ASM_OP "\t.section \".sdata2\",\"a\""
-#define SBSS_SECTION_ASM_OP \
- ((DEFAULT_ABI == ABI_SOLARIS) ? "\t.section \".sbss\",\"aw\"" : "\t.section \".sbss\",\"aw\",@nobits")
-
-
-/* Besides the usual ELF sections, we need a toc section. */
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
- TOC_SECTION_FUNCTION \
- SDATA_SECTION_FUNCTION \
- SDATA2_SECTION_FUNCTION \
- SBSS_SECTION_FUNCTION \
- INIT_SECTION_FUNCTION \
- FINI_SECTION_FUNCTION
-
-extern void toc_section (), sdata_section (), sdata2_section ();
-extern void sbss_section ();
-
-#define TOC_SECTION_FUNCTION \
-void \
-toc_section () \
-{ \
- static int toc_initialized = 0; \
- \
- if (in_section != in_toc) \
- { \
- in_section = in_toc; \
- if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
- && TARGET_MINIMAL_TOC \
- && !TARGET_RELOCATABLE) \
- { \
- if (! toc_initialized) \
- { \
- toc_initialized = 1; \
- fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LCTOC", 0); \
- fprintf (asm_out_file, "\t.tc "); \
- ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
- ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
- fprintf (asm_out_file, "\n"); \
- \
- fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
- ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
- fprintf (asm_out_file, " = .+32768\n"); \
- } \
- else \
- fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
- } \
- else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
- && !TARGET_RELOCATABLE) \
- fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \
- else \
- { \
- fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
- if (! toc_initialized) \
- { \
- ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
- fprintf (asm_out_file, " = .+32768\n"); \
- toc_initialized = 1; \
- } \
- } \
- } \
-}
-
-#define SDATA_SECTION_FUNCTION \
-void \
-sdata_section () \
-{ \
- if (in_section != in_sdata) \
- { \
- in_section = in_sdata; \
- fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
- } \
-}
-
-#define SDATA2_SECTION_FUNCTION \
-void \
-sdata2_section () \
-{ \
- if (in_section != in_sdata2) \
- { \
- in_section = in_sdata2; \
- fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP); \
- } \
-}
-
-#define SBSS_SECTION_FUNCTION \
-void \
-sbss_section () \
-{ \
- if (in_section != in_sbss) \
- { \
- in_section = in_sbss; \
- fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP); \
- } \
-}
-
-#define INIT_SECTION_FUNCTION \
-void \
-init_section () \
-{ \
- if (in_section != in_init) \
- { \
- in_section = in_init; \
- fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \
- } \
-}
-
-#define FINI_SECTION_FUNCTION \
-void \
-fini_section () \
-{ \
- if (in_section != in_fini) \
- { \
- in_section = in_fini; \
- fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \
- } \
-}
-
-/* A C statement or statements to switch to the appropriate section
- for output of RTX in mode MODE. You can assume that RTX is some
- kind of constant in RTL. The argument MODE is redundant except in
- the case of a `const_int' rtx. Select the section by calling
- `text_section' or one of the alternatives for other sections.
-
- Do not define this macro if you put all constants in the read-only
- data section. */
-
-extern void rs6000_select_rtx_section (), rs6000_select_section ();
-
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE, X) rs6000_select_rtx_section (MODE, X)
-
-/* A C statement or statements to switch to the appropriate
- section for output of DECL. DECL is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether forming
- the initial value of DECL requires link-time relocations. */
-
-#undef SELECT_SECTION
-#define SELECT_SECTION(DECL,RELOC) rs6000_select_section (DECL, RELOC)
-
-/* Return non-zero if this entry is to be written into the constant pool
- in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
- containing one of them. If -mfp-in-toc (the default), we also do
- this for floating-point constants. We actually can only do this
- if the FP formats of the target and host machines are the same, but
- we can't check that since not every file that uses
- GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
-
- Unlike AIX, we don't key off of -mmininal-toc, but instead do not
- allow floating point constants in the TOC if -mrelocatable. */
-
-#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
-#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X) \
- (TARGET_TOC \
- && (GET_CODE (X) == SYMBOL_REF \
- || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
- || GET_CODE (X) == LABEL_REF \
- || (!TARGET_NO_FP_IN_TOC \
- && !TARGET_RELOCATABLE \
- && GET_CODE (X) == CONST_DOUBLE \
- && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- && BITS_PER_WORD == HOST_BITS_PER_INT)))
-
-/* These macros generate the special .type and .size directives which
- are used to set the corresponding fields of the linker symbol table
- entries in an ELF object file under SVR4. These macros also output
- the starting labels for the relevant functions/objects. */
-
-/* Write the extra assembler code needed to declare a function properly.
- Some svr4 assemblers need to also have something extra said about the
- function's return value. We allow for that here. */
-
-extern int rs6000_pic_labelno;
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { \
- char *orig_name; \
- char *init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
- STRIP_NAME_ENCODING (orig_name, NAME); \
- \
- if (TARGET_RELOCATABLE && get_pool_size () != 0) \
- { \
- char buf[256], *buf_ptr; \
- \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \
- \
- ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \
- STRIP_NAME_ENCODING (buf_ptr, buf); \
- fprintf (FILE, "\t%s %s-", init_ptr, buf_ptr); \
- \
- ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \
- fprintf (FILE, "%s\n", buf_ptr); \
- } \
- \
- fprintf (FILE, "\t%s\t %s,", TYPE_ASM_OP, orig_name); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- \
- if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT) \
- { \
- char *desc_name = orig_name; \
- \
- while (*desc_name == '.') \
- desc_name++; \
- \
- if (TREE_PUBLIC (DECL)) \
- fprintf (FILE, "\t.globl %s\n", desc_name); \
- \
- fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
- fprintf (FILE, "%s:\n", desc_name); \
- fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \
- fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
- if (DEFAULT_ABI == ABI_AIX) \
- fprintf (FILE, "\t%s 0\n", init_ptr); \
- fprintf (FILE, "\t.previous\n"); \
- } \
- fprintf (FILE, "%s:\n", orig_name); \
- } while (0)
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL_PREFIX
-#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \
- fprintf (FILE, ".%s", PREFIX)
-
-/* This is how to allocate empty space in some section. Use .space
- instead of .zero because the Solaris PowerPC assembler doesn't
- like it, and gas accepts either syntax. */
-
-#undef SKIP_ASM_OP
-#define SKIP_ASM_OP ".space"
-
-/* This says how to output assembler code to declare an
- uninitialized internal linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here. */
-
-#ifndef LOCAL_ASM_OP
-#define LOCAL_ASM_OP ".local"
-#endif
-
-#ifndef LCOMM_ASM_OP
-#define LCOMM_ASM_OP ".lcomm"
-#endif
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- if (TARGET_SDATA && (SIZE) > 0 && (SIZE) <= g_switch_value) \
- { \
- sdata_section (); \
- ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
- ASM_OUTPUT_SKIP (FILE, SIZE); \
- if (!flag_inhibit_size_directive && (SIZE) > 0) \
- { \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", SIZE); \
- } \
- } \
- else \
- { \
- fprintf (FILE, "\t%s\t", LCOMM_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
- } \
-} while (0)
-
-/* Describe how to emit unitialized external linkage items */
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
-do { \
- ASM_GLOBALIZE_LABEL (FILE, NAME); \
- ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
-} while (0)
-
-/* Switch Recognition by gcc.c. Add -G xx support */
-
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
- ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
- || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
- || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
- || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
- || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
-
-/* Output .file. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-do { \
- output_file_directive ((FILE), main_input_filename); \
- rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
-} while (0)
-
-
-/* This is how to output an assembler line defining an `int' constant.
- For -mrelocatable, we mark all addresses that need to be fixed up
- in the .fixup section. */
-#undef ASM_OUTPUT_INT
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-do { \
- static int recurse = 0; \
- if ((TARGET_RELOCATABLE || flag_pic) \
- && in_section != in_toc \
- && in_section != in_text \
- && in_section != in_ctors \
- && in_section != in_dtors \
- && !recurse \
- && GET_CODE (VALUE) != CONST_INT \
- && GET_CODE (VALUE) != CONST_DOUBLE \
- && CONSTANT_P (VALUE)) \
- { \
- static int labelno = 0; \
- char buf[256], *p; \
- \
- recurse = 1; \
- ASM_GENERATE_INTERNAL_LABEL (buf, "LCP", labelno++); \
- STRIP_NAME_ENCODING (p, buf); \
- fprintf (FILE, "%s:\n", p); \
- fprintf (FILE, "\t.long ("); \
- output_addr_const (FILE, (VALUE)); \
- fprintf (FILE, ")@fixup\n"); \
- fprintf (FILE, "\t.section \".fixup\",\"aw\"\n"); \
- ASM_OUTPUT_ALIGN (FILE, 2); \
- fprintf (FILE, "\t.long\t%s\n", p); \
- fprintf (FILE, "\t.previous\n"); \
- recurse = 0; \
- } \
- /* Remove initial .'s to turn a -mcall-aixdesc or -mcall-nt function \
- address into the address of the descriptor, not the function \
- itself. */ \
- else if (GET_CODE (VALUE) == SYMBOL_REF \
- && XSTR (VALUE, 0)[0] == '.' \
- && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)) \
- { \
- char *name = XSTR (VALUE, 0); \
- while (*name == '.') \
- name++; \
- \
- fprintf (FILE, "\t.long %s\n", name); \
- } \
- else \
- { \
- fprintf (FILE, "\t.long "); \
- output_addr_const (FILE, (VALUE)); \
- fprintf (FILE, "\n"); \
- } \
-} while (0)
-
-/* This is the end of what might become sysv4.h. */
-
-/* Allow stabs and dwarf, for now, make stabs the default debugging type,
- not dwarf since G++ doesn't support dwarf. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#define DBX_DEBUGGING_INFO
-#define DWARF_DEBUGGING_INFO
-
-/* If we are referencing a function that is static or is known to be
- in this file, make the SYMBOL_REF special. We can use this to indicate
- that we can branch to this function without emitting a no-op after the
- call. For real AIX and NT calling sequences, we also replace the
- function name with the real name (1 or 2 leading .'s), rather than
- the function descriptor name. This saves a lot of overriding code
- to readd the prefixes. */
-
-#undef ENCODE_SECTION_INFO
-#define ENCODE_SECTION_INFO(DECL) rs6000_encode_section_info (DECL)
-
-extern void rs6000_encode_section_info ();
-
-/* This macro gets just the user-specified name
- out of the string in a SYMBOL_REF. Discard
- a leading * or @. */
-#undef STRIP_NAME_ENCODING
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
-do { \
- char *_name = SYMBOL_NAME; \
- while (*_name == '*' || *_name == '@') \
- _name++; \
- (VAR) = _name; \
-} while (0)
-
-/* This is how to output a reference to a user-level label named NAME.
- `assemble_name' uses this. */
-
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
-do { \
- char *_name = NAME; \
- while (*_name == '*' || *_name == '@') \
- _name++; \
- fputs (_name, FILE); \
-} while (0)
-
-/*
- * Switch into a generic section.
- *
- * We make the section read-only and executable for a function decl,
- * read-only for a const data decl, and writable for a non-const data decl.
- *
- * If the section has already been defined, we must not
- * emit the attributes here. The SVR4 assembler does not
- * recognize section redefinitions.
- * If DECL is NULL, no attributes are emitted.
- *
- * Note, Solaris as doesn't like @nobits, and gas can handle .sbss without
- * needing @nobits.
- */
-
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
-do { \
- static struct section_info \
- { \
- struct section_info *next; \
- char *name; \
- enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
- } *sections; \
- struct section_info *s; \
- char *mode; \
- enum sect_enum type; \
- \
- for (s = sections; s; s = s->next) \
- if (!strcmp (NAME, s->name)) \
- break; \
- \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- type = SECT_EXEC, mode = "ax"; \
- else if (DECL && TREE_READONLY (DECL) && !TARGET_RELOCATABLE && !flag_pic) \
- type = SECT_RO, mode = "a"; \
- else \
- type = SECT_RW, mode = "aw"; \
- \
- if (s == 0) \
- { \
- s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
- s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
- strcpy (s->name, NAME); \
- s->type = type; \
- s->next = sections; \
- sections = s; \
- fprintf (FILE, ".section\t%s,\"%s\"\n", NAME, mode); \
- } \
- else \
- { \
- if (DECL && s->type != type) \
- error_with_decl (DECL, "%s causes a section type conflict"); \
- \
- fprintf (FILE, ".section\t%s\n", NAME); \
- } \
-} while (0)
-
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- if (DEFAULT_ABI != ABI_SOLARIS) \
- { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- } \
- else \
- { \
- init_section (); \
- fputs ("\tbl ", FILE); \
- assemble_name (FILE, NAME); \
- } \
- fputs ("\n", FILE); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- if (DEFAULT_ABI != ABI_SOLARIS) \
- { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- } \
- else \
- { \
- fini_section (); \
- fputs ("\tbl ", FILE); \
- assemble_name (FILE, NAME); \
- } \
- fputs ("\n", FILE); \
- } while (0)
-
-/* But, to make this work, we have to output the stabs for the function
- name *first*... */
-
-#define DBX_FUNCTION_FIRST
-
-/* This is the end of what might become sysv4dbx.h. */
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-DPPC -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(powerpc) -Amachine(powerpc)"
-
-/* Pass various options to the assembler */
-#undef ASM_SPEC
-#define ASM_SPEC "%(asm_cpu) %{mregnames} %{mno-regnames} \
-%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
-%{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
-%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \
-%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
- %{mcall-solaris: -mlittle -msolaris} %{mcall-linux: -mbig} }}}}"
-
-#undef CC1_SPEC
-/* Pass -G xxx to the compiler and set correct endian mode */
-#define CC1_SPEC "%{G*} \
-%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
- %{mcall-nt: -mlittle } \
- %{mcall-aixdesc: -mbig } \
- %{mcall-solaris: -mlittle } \
- %{mcall-linux: -mbig} }}}} \
-%{mcall-solaris: -mregnames } \
-%{mno-sdata: -msdata=none } \
-%{meabi: %{!mcall-*: -mcall-sysv }} \
-%{!meabi: %{!mno-eabi: \
- %{mrelocatable: -meabi } \
- %{mcall-solaris: -mno-eabi } \
- %{mcall-linux: -mno-eabi }}}"
-
-/* Don't put -Y P,<path> for cross compilers */
-#undef LINK_PATH_SPEC
-#ifndef CROSS_COMPILE
-#define LINK_PATH_SPEC "\
-%{!R*:%{L*:-R %*}} \
-%{!nostdlib: %{!YP,*: \
- %{compat-bsd: \
- %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
- %{!R*: %{!L*: -R /usr/ucblib}} \
- %{!compat-bsd: \
- %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}"
-
-#else
-#define LINK_PATH_SPEC ""
-#endif
-
-/* Default starting address if specified */
-#ifndef LINK_START_SPEC
-#define LINK_START_SPEC "\
-%{mmvme: %(link_start_mvme) } \
-%{msim: %(link_start_sim) } \
-%{mcall-linux: %(link_start_linux) } \
-%{mcall-solaris: %(link_start_solaris) } \
-%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_start_default) }}}}"
-#endif
-
-#ifndef LINK_START_DEFAULT_SPEC
-#define LINK_START_DEFAULT_SPEC ""
-#endif
-
-#undef LINK_SPEC
-#define LINK_SPEC "\
-%{h*} %{v:-V} %{G*} \
-%{Wl,*:%*} %{YP,*} %{R*} \
-%{Qy:} %{!Qn:-Qy} \
-%(link_shlib) \
-%{!Ttext*: %(link_start) } \
-%(link_target) \
-%(link_os)"
-
-/* For now, turn off shared libraries by default. */
-#ifndef SHARED_LIB_SUPPORT
-#define NO_SHARED_LIB_SUPPORT
-#endif
-
-#undef LINK_SHLIB_SPEC
-#ifndef NO_SHARED_LIB_SUPPORT
-/* Shared libaries are default. */
-#define LINK_SHLIB_SPEC "\
-%{!static: %(link_path) %{!R*:%{L*:-R %*}}} \
-%{mshlib: } \
-%{static:-dn -Bstatic} \
-%{shared:-G -dy -z text %{!h*:%{o*:-h %*}}} \
-%{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}}"
-
-#else
-/* Shared libraries are not default. */
-#define LINK_SHLIB_SPEC "\
-%{mshlib: %(link_path) } \
-%{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \
-%{static: } \
-%{shared:-G -dy -z text %{!h*:%{o*:-h %*}} %(link_path) } \
-%{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}} %(link_path) }"
-#endif
-
-/* Override the default target of the linker. */
-#undef LINK_TARGET_SPEC
-#define LINK_TARGET_SPEC "\
-%{mlittle: -oformat elf32-powerpcle } %{mlittle-endian: -oformat elf32-powerpcle } \
-%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-solaris: -oformat elf32-powerpcle}}}}}"
-
-/* Any specific OS flags */
-#ifndef LINK_OS_SPEC
-#define LINK_OS_SPEC "\
-%{mmvme: %(link_os_mvme) } \
-%{msim: %(link_os_sim) } \
-%{mcall-linux: %(link_os_linux) } \
-%{mcall-solaris: %(link_os_solaris) } \
-%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_os_default) }}}}"
-#endif
-
-#ifndef LINK_OS_DEFAULT_SPEC
-#define LINK_OS_DEFAULT_SPEC ""
-#endif
-
-#undef CPP_SYSV_SPEC
-#define CPP_SYSV_SPEC \
-"%{mrelocatable*: -D_RELOCATABLE} \
-%{fpic: -D__PIC__=1 -D__pic__=1} \
-%{fPIC: -D__PIC__=2 -D__pic__=2} \
-%{mcall-sysv: -D_CALL_SYSV} %{mcall-nt: -D_CALL_NT} \
-%{mcall-aix: -D_CALL_AIX} %{mcall-aixdesc: -D_CALL_AIX -D_CALL_AIXDESC} \
-%{!mcall-sysv: %{!mcall-aix: %{!mcall-aixdesc: %{!mcall-nt: %(cpp_sysv_default) }}}} \
-%{msoft-float: -D_SOFT_FLOAT} %{mcpu=403: -D_SOFT_FLOAT}"
-
-#undef CPP_SYSV_DEFAULT_SPEC
-#define CPP_SYSV_DEFAULT_SPEC "-D_CALL_SYSV"
-
-#ifndef CPP_ENDIAN_BIG_SPEC
-#define CPP_ENDIAN_BIG_SPEC "-D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian)"
-#endif
-
-#ifndef CPP_ENDIAN_LITTLE_SPEC
-#define CPP_ENDIAN_LITTLE_SPEC "-D_LITTLE_ENDIAN -D__LITTLE_ENDIAN__ -Amachine(littleendian)"
-#endif
-
-#ifndef CPP_ENDIAN_SOLARIS_SPEC
-#define CPP_ENDIAN_SOLARIS_SPEC "-D__LITTLE_ENDIAN__ -Amachine(littleendian)"
-#endif
-
-/* For solaris, don't define _LITTLE_ENDIAN, it conflicts with a header file. */
-#undef CPP_ENDIAN_SPEC
-#define CPP_ENDIAN_SPEC \
-"%{mlittle: %(cpp_endian_little) } \
-%{mlittle-endian: %(cpp_endian_little) } \
-%{mbig: %(cpp_endian_big) } \
-%{mbig-endian: %(cpp_endian_big) } \
-%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
- %{mcall-solaris: %(cpp_endian_solaris) } \
- %{mcall-nt: %(cpp_endian_little) } \
- %{mcall-linux: %(cpp_endian_big) } \
- %{mcall-aixdesc: %(cpp_endian_big) } \
- %{!mcall-solaris: %{!mcall-linux: %{!mcall-nt: %{!mcall-aixdesc: %(cpp_endian_default) }}}}}}}}"
-
-#undef CPP_ENDIAN_DEFAULT_SPEC
-#define CPP_ENDIAN_DEFAULT_SPEC "%(cpp_endian_big)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
-%{mmvme: %(cpp_os_mvme) } \
-%{msim: %(cpp_os_sim) } \
-%{mcall-linux: %(cpp_os_linux) } \
-%{mcall-solaris: %(cpp_os_solaris) } \
-%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(cpp_os_default) }}}}"
-
-#ifndef CPP_OS_DEFAULT_SPEC
-#define CPP_OS_DEFAULT_SPEC ""
-#endif
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "\
-%{mmvme: %(startfile_mvme) } \
-%{msim: %(startfile_sim) } \
-%{mcall-linux: %(startfile_linux) } \
-%{mcall-solaris: %(startfile_solaris) } \
-%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(startfile_default) }}}}"
-
-#undef STARTFILE_DEFAULT_SPEC
-#define STARTFILE_DEFAULT_SPEC ""
-
-#undef LIB_SPEC
-#define LIB_SPEC "\
-%{mmvme: %(lib_mvme) } \
-%{msim: %(lib_sim) } \
-%{mcall-linux: %(lib_linux) } \
-%{mcall-solaris: %(lib_solaris) } \
-%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(lib_default) }}}}"
-
-#undef LIBGCC_SPEC
-#define LIBGCC_SPEC "libgcc.a%s"
-
-#ifndef LIB_DEFAULT_SPEC
-#define LIB_DEFAULT_SPEC ""
-#endif
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "\
-%{mmvme: ecrtn.o%s} \
-%{msim: ecrtn.o%s} \
-%{mcall-linux: } \
-%{mcall-solaris: scrtn.o%s} \
-%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(endfile_default) }}}}"
-
-#undef ENDFILE_DEFAULT_SPEC
-#define ENDFILE_DEFAULT_SPEC ""
-
-/* Motorola MVME support. */
-#ifndef LIB_MVME_SPEC
-#define LIB_MVME_SPEC "-( -lmvme -lc -)"
-#endif
-
-#ifndef STARTFILE_MVME_SPEC
-#define STARTFILE_MVME_SPEC "ecrti.o%s mvme-crt0.o%s"
-#endif
-
-#ifndef ENDFILE_MVME_SPEC
-#define ENDFILE_MVME_SPEC "ecrtn.o%s"
-#endif
-
-#ifndef LINK_START_MVME_SPEC
-#define LINK_START_MVME_SPEC ""
-#endif
-
-#ifndef LINK_OS_MVME_SPEC
-#define LINK_OS_MVME_SPEC ""
-#endif
-
-#ifndef CPP_OS_MVME_SPEC
-#define CPP_OS_MVME_SPEC ""
-#endif
-
-/* PowerPC simulator based on netbsd system calls support. */
-#ifndef LIB_SIM_SPEC
-#define LIB_SIM_SPEC "-( -lsim -lc -)"
-#endif
-
-#ifndef STARTFILE_SIM_SPEC
-#define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s"
-#endif
-
-#ifndef ENDFILE_SIM_SPEC
-#define ENDFILE_SIM_SPEC "ecrtn.o%s"
-#endif
-
-#ifndef LINK_START_SIM_SPEC
-#define LINK_START_SIM_SPEC "-Ttext 0x10000074"
-#endif
-
-#ifndef LINK_OS_SIM_SPEC
-#define LINK_OS_SIM_SPEC ""
-#endif
-
-#ifndef CPP_OS_SIM_SPEC
-#define CPP_OS_SIM_SPEC ""
-#endif
-
-/* Linux support. */
-#ifndef LIB_LINUX_SPEC
-#define LIB_LINUX_SPEC "%{mnewlib: -( -llinux -lc -) } %{!mnewlib: -lc }"
-#endif
-
-#ifndef STARTFILE_LINUX_SPEC
-#define STARTFILE_LINUX_SPEC "\
-%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \
-%{mnewlib: ecrti.o%s} \
-%{!mnewlib: crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
-#endif
-
-#ifndef ENDFILE_LINUX_SPEC
-#define ENDFILE_LINUX_SPEC "\
-%{mnewlib: ecrtn.o%s} \
-%{!mnewlib: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s}"
-#endif
-
-#ifndef LINK_START_LINUX_SPEC
-#define LINK_START_LINUX_SPEC "-Ttext 0x400074"
-#endif
-
-#ifndef LINK_OS_LINUX_SPEC
-#define LINK_OS_LINUX_SPEC ""
-#endif
-
-#ifndef CPP_OS_LINUX_SPEC
-#define CPP_OS_LINUX_SPEC "-D__unix__ -D__linux__ \
-%{!ansi: -Dunix -Dlinux } \
--Asystem(unix) -Asystem(linux)"
-#endif
-
-#ifndef CPP_OS_LINUX_SPEC
-#define CPP_OS_LINUX_SPEC ""
-#endif
-
-/* Solaris support. */
-/* For Solaris, Gcc automatically adds in one of the files
- /usr/ccs/lib/values-Xc.o, /usr/ccs/lib/values-Xa.o, or
- /usr/ccs/lib/values-Xt.o for each final link step (depending upon the other
- gcc options selected, such as -traditional and -ansi). These files each
- contain one (initialized) copy of a special variable called `_lib_version'.
- Each one of these files has `_lib_version' initialized to a different (enum)
- value. The SVR4 library routines query the value of `_lib_version' at run
- to decide how they should behave. Specifically, they decide (based upon the
- value of `_lib_version') if they will act in a strictly ANSI conforming
- manner or not. */
-
-#ifndef LIB_SOLARIS_SPEC
-#define LIB_SOLARIS_SPEC "\
-%{mnewlib: -( -lsolaris -lc -) } \
-%{!mnewlib: \
- %{ansi:values-Xc.o%s} \
- %{!ansi: \
- %{traditional:values-Xt.o%s} \
- %{!traditional:values-Xa.o%s}} \
- %{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
- %{solaris-cclib: /opt/SUNWspro/SC4.0/lib/libabi.a} \
- %{!shared: %{!symbolic: -lc }}}"
-#endif
-
-#ifndef STARTFILE_SOLARIS_SPEC
-#define STARTFILE_SOLARIS_SPEC "\
-%{!msolaris-cclib: scrti.o%s scrt0.o%s} \
-%{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crti.o%s /opt/SUNWspro/SC4.0/lib/crt1.o%s}"
-#endif
-
-#ifndef ENDFILE_SOLARIS_SPEC
-#define ENDFILE_SOLARIS_SPEC "\
-%{!msolaris-cclib: scrtn.o%s} \
-%{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crtn.o%s}"
-#endif
-
-#ifndef LINK_START_SOLARIS_SPEC
-#ifdef CROSS_COMPILER
-#define LINK_START_SOLARIS_SPEC "-Ttext 0x2000074"
-#else
-#define LINK_START_SOLARIS_SPEC ""
-#endif
-#endif
-
-#ifndef LINK_OS_SOLARIS_SPEC
-#define LINK_OS_SOLARIS_SPEC ""
-#endif
-
-#ifndef CPP_OS_SOLARIS_SPEC
-#define CPP_OS_SOLARIS_SPEC "-D__ppc -D__sun__=1 -D__unix__ -D__svr4__ -D__SVR4__ \
-%{!ansi: -Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__ } \
--Amachine(prep)"
-#endif
-
-/* Define any extra SPECS that the compiler needs to generate. */
-#undef SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS \
- { "lib_mvme", LIB_MVME_SPEC }, \
- { "lib_sim", LIB_SIM_SPEC }, \
- { "lib_linux", LIB_LINUX_SPEC }, \
- { "lib_solaris", LIB_SOLARIS_SPEC }, \
- { "lib_default", LIB_DEFAULT_SPEC }, \
- { "startfile_mvme", STARTFILE_MVME_SPEC }, \
- { "startfile_sim", STARTFILE_SIM_SPEC }, \
- { "startfile_linux", STARTFILE_LINUX_SPEC }, \
- { "startfile_solaris", STARTFILE_SOLARIS_SPEC }, \
- { "startfile_default", STARTFILE_DEFAULT_SPEC }, \
- { "endfile_mvme", ENDFILE_MVME_SPEC }, \
- { "endfile_sim", ENDFILE_SIM_SPEC }, \
- { "endfile_linux", ENDFILE_LINUX_SPEC }, \
- { "endfile_solaris", ENDFILE_SOLARIS_SPEC }, \
- { "endfile_default", ENDFILE_DEFAULT_SPEC }, \
- { "link_path", LINK_PATH_SPEC }, \
- { "link_shlib", LINK_SHLIB_SPEC }, \
- { "link_target", LINK_TARGET_SPEC }, \
- { "link_start", LINK_START_SPEC }, \
- { "link_start_mvme", LINK_START_MVME_SPEC }, \
- { "link_start_sim", LINK_START_SIM_SPEC }, \
- { "link_start_linux", LINK_START_LINUX_SPEC }, \
- { "link_start_solaris", LINK_START_SOLARIS_SPEC }, \
- { "link_start_default", LINK_START_DEFAULT_SPEC }, \
- { "link_os", LINK_OS_SPEC }, \
- { "link_os_mvme", LINK_OS_MVME_SPEC }, \
- { "link_os_sim", LINK_OS_SIM_SPEC }, \
- { "link_os_linux", LINK_OS_LINUX_SPEC }, \
- { "link_os_solaris", LINK_OS_SOLARIS_SPEC }, \
- { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
- { "cpp_endian_big", CPP_ENDIAN_BIG_SPEC }, \
- { "cpp_endian_little", CPP_ENDIAN_LITTLE_SPEC }, \
- { "cpp_endian_solaris", CPP_ENDIAN_SOLARIS_SPEC }, \
- { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
- { "cpp_os_sim", CPP_OS_SIM_SPEC }, \
- { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
- { "cpp_os_solaris", CPP_OS_SOLARIS_SPEC }, \
- { "cpp_os_default", CPP_OS_DEFAULT_SPEC },
-
-/* Define this macro as a C expression for the initializer of an
- array of string to tell the driver program which options are
- defaults for this target and thus do not need to be handled
- specially when using `MULTILIB_OPTIONS'.
-
- Do not define this macro if `MULTILIB_OPTIONS' is not defined in
- the target makefile fragment or if none of the options listed in
- `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
-
-#undef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" }
diff --git a/gcc/config/rs6000/sysv4le.h b/gcc/config/rs6000/sysv4le.h
deleted file mode 100644
index 0cf2ec49019..00000000000
--- a/gcc/config/rs6000/sysv4le.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Target definitions for GNU compiler for a little endian PowerPC
- running System V.4
- Copyright (C) 1995, Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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 "rs6000/sysv4.h"
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_LITTLE_ENDIAN)
-
-#undef CPP_ENDIAN_DEFAULT_SPEC
-#define CPP_ENDIAN_DEFAULT_SPEC "%(cpp_endian_little)"
-
-#undef LINK_TARGET_SPEC
-#define LINK_TARGET_SPEC "\
-%{mbig: -oformat elf32-powerpc } %{mbig-endian: -oformat elf32-powerpc } \
-%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-linux: -oformat elf32-powerpc}}}}}"
-
-/* Define this macro as a C expression for the initializer of an
- array of string to tell the driver program which options are
- defaults for this target and thus do not need to be handled
- specially when using `MULTILIB_OPTIONS'.
-
- Do not define this macro if `MULTILIB_OPTIONS' is not defined in
- the target makefile fragment or if none of the options listed in
- `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
-
-#undef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS { "mlittle", "mcall-sysv" }
diff --git a/gcc/config/rs6000/t-newas b/gcc/config/rs6000/t-newas
deleted file mode 100644
index 823b03b4b56..00000000000
--- a/gcc/config/rs6000/t-newas
+++ /dev/null
@@ -1,52 +0,0 @@
-# Do not build libgcc1.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-# Build the libraries for both hard and soft floating point and all of the
-# different processor models
-
-MULTILIB_OPTIONS = msoft-float \
- mcpu=common/mcpu=power/mcpu=powerpc
-
-MULTILIB_DIRNAMES = soft-float \
- common power powerpc
-
-MULTILIB_MATCHES = msoft-float=mcpu?403 \
- mcpu?power=mpower \
- mcpu?power=mrios1 \
- mcpu?power=mcpu?rios1 \
- mcpu?power=mcpu?rsc \
- mcpu?power=mcpu?rsc1 \
- mcpu?power=mpower2 \
- mcpu?power=mrios2 \
- mcpu?power=mcpu=rios2 \
- mcpu?powerpc=mcpu?601 \
- mcpu?powerpc=mcpu?602 \
- mcpu?powerpc=mcpu?603 \
- mcpu?powerpc=mcpu?603e \
- mcpu?powerpc=mcpu?604 \
- mcpu?powerpc=mcpu?620 \
- mcpu?powerpc=mcpu?403 \
- mcpu?powerpc=mpowerpc \
- mcpu?powerpc=mpowerpc-gpopt \
- mcpu?powerpc=mpowerpc-gfxopt
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# Aix 3.2.x needs milli.exp for -mcpu=common
-EXTRA_PARTS = milli.exp
-milli.exp: $(srcdir)/config/rs6000/milli.exp
- rm -f milli.exp
- cp $(srcdir)/config/rs6000/milli.exp ./milli.exp
diff --git a/gcc/config/rs6000/t-ppc b/gcc/config/rs6000/t-ppc
deleted file mode 100644
index 0b5bea99b51..00000000000
--- a/gcc/config/rs6000/t-ppc
+++ /dev/null
@@ -1,12 +0,0 @@
-# PowerPC support without gas
-
-# Build libgcc.a with different options. If no gas support, don't build
-# explicit little endian or big endian libraries, since it depends on the
-# -mbig/-mlittle switches passed to gas. The -mrelocatable support also needs
-# -mrelocatable passed to gas, so don't use it either.
-
-MULTILIB_OPTIONS = msoft-float
-MULTILIB_DIRNAMES = nof
-MULTILIB_EXCEPTIONS =
-MULTILIB_EXTRA_OPTS =
-MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT}
diff --git a/gcc/config/rs6000/t-ppccomm b/gcc/config/rs6000/t-ppccomm
deleted file mode 100644
index 145fcaede22..00000000000
--- a/gcc/config/rs6000/t-ppccomm
+++ /dev/null
@@ -1,69 +0,0 @@
-# Common support for PowerPC eabi, System V targets.
-
-# Do not build libgcc1.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c eabi.S eabi-ctors.c tramp.S
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-eabi.S: $(srcdir)/config/rs6000/eabi.asm
- cat $(srcdir)/config/rs6000/eabi.asm > eabi.S
-
-eabi-ctors.c: $(srcdir)/config/rs6000/eabi-ctors.c
- cat $(srcdir)/config/rs6000/eabi-ctors.c > eabi-ctors.c
-
-tramp.S: $(srcdir)/config/rs6000/tramp.asm
- cat $(srcdir)/config/rs6000/tramp.asm > tramp.S
-
-# Switch synonyms
-MULTILIB_MATCHES_FLOAT = msoft-float=mcpu?403 msoft-float=mcpu?821 msoft-float=mcpu?860
-MULTILIB_MATCHES_ENDIAN = mlittle=mlittle-endian mbig=mbig-endian
-MULTILIB_MATCHES_SYSV = mcall-sysv=mcall-sysv-eabi mcall-sysv=mcall-sysv-noeabi
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-EXTRA_MULTILIB_PARTS = ecrti$(objext) ecrtn$(objext) scrt0$(objext) scrti$(objext) scrtn$(objext)
-
-# We build {e,s}crti.o, {e,s}crtn.o, and scrt0.o which serve to add begin and
-# end labels to all of the special sections used when we link using gcc.
-
-# Assemble startup files.
-ecrti.S: $(srcdir)/config/rs6000/eabi-ci.asm
- cat $(srcdir)/config/rs6000/eabi-ci.asm >ecrti.S
-
-ecrtn.S: $(srcdir)/config/rs6000/eabi-cn.asm
- cat $(srcdir)/config/rs6000/eabi-cn.asm >ecrtn.S
-
-scrti.S: $(srcdir)/config/rs6000/sol-ci.asm
- cat $(srcdir)/config/rs6000/sol-ci.asm >scrti.S
-
-scrtn.S: $(srcdir)/config/rs6000/sol-cn.asm
- cat $(srcdir)/config/rs6000/sol-cn.asm >scrtn.S
-
-scrt0.c: $(srcdir)/config/rs6000/sol-c0.c
- cat $(srcdir)/config/rs6000/sol-c0.c >scrt0.c
-
-# Build multiple copies of ?crt{i,n}.o, one for each target switch.
-$(T)ecrti$(objext): ecrti.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ecrti.S -o $(T)ecrti$(objext)
-
-$(T)ecrtn$(objext): ecrtn.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ecrtn.S -o $(T)ecrtn$(objext)
-
-$(T)scrti$(objext): scrti.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c scrti.S -o $(T)scrti$(objext)
-
-$(T)scrtn$(objext): scrtn.S
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c scrtn.S -o $(T)scrtn$(objext)
-
-$(T)scrt0$(objext): scrt0.c
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c scrt0.c -o $(T)scrt0$(objext)
diff --git a/gcc/config/rs6000/t-ppcgas b/gcc/config/rs6000/t-ppcgas
deleted file mode 100644
index da4e87fa4a3..00000000000
--- a/gcc/config/rs6000/t-ppcgas
+++ /dev/null
@@ -1,22 +0,0 @@
-# PowerPC embedded support with gas.
-# Build libgcc.a with different options.
-
-MULTILIB_OPTIONS = msoft-float \
- mlittle/mbig \
- mcall-sysv/mcall-aix/mcall-solaris/mcall-linux
-
-MULTILIB_DIRNAMES = nof \
- le be \
- cs ca sol lin
-
-MULTILIB_EXTRA_OPTS = mrelocatable-lib mno-eabi
-MULTILIB_EXCEPTIONS = *mbig/*mcall-solaris* \
- *mlittle/*mcall-solaris* \
- *msoft-float/*mcall-solaris* \
- *mbig/*mcall-linux* \
- *mlittle/*mcall-linux* \
- *msoft-float/*mcall-linux*
-
-MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT} \
- ${MULTILIB_MATCHES_ENDIAN} \
- ${MULTILIB_MATCHES_SYSV}
diff --git a/gcc/config/rs6000/t-ppcos b/gcc/config/rs6000/t-ppcos
deleted file mode 100644
index fe1d6ad64c1..00000000000
--- a/gcc/config/rs6000/t-ppcos
+++ /dev/null
@@ -1,11 +0,0 @@
-# Target config file for a System V based system (Solaris, Linux, Netbsd) with gas
-
-# Build libgcc.a with different options. With gas, build pic libraries
-# as well no floating point
-MULTILIB_OPTIONS = msoft-float fPIC
-MULTILIB_DIRNAMES = nof pic
-MULTILIB_EXCEPTIONS =
-MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT} \
- fPIC=mrelocatable-lib \
- fPIC=mrelocatable \
- fPIC=fpic
diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
deleted file mode 100644
index 4c659a629d7..00000000000
--- a/gcc/config/rs6000/t-rs6000
+++ /dev/null
@@ -1,22 +0,0 @@
-# Do not build libgcc1.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-# Build the libraries for both hard and soft floating point
-
-MULTILIB_OPTIONS = msoft-float
-MULTILIB_DIRNAMES = soft-float
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/rs6000/t-winnt b/gcc/config/rs6000/t-winnt
deleted file mode 100644
index f58aefed523..00000000000
--- a/gcc/config/rs6000/t-winnt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Do not build libgcc1.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-EXTRA_PARTS = crti.o crtn.o
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c ntstack.S
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-ntstack.S: $(srcdir)/config/rs6000/ntstack.asm
- cat $(srcdir)/config/rs6000/ntstack.asm > ntstack.S
-
-# For NT we build crti.o and crtn.o which serve to add begin and
-# end labels for the static constructors and destructors.
-
-# Assemble startup files.
-crti.s: $(srcdir)/config/rs6000/nt-ci.asm
- cat $(srcdir)/config/rs6000/nt-ci.asm >crti.s
-
-crtn.s: $(srcdir)/config/rs6000/nt-cn.asm
- cat $(srcdir)/config/rs6000/nt-cn.asm >crtn.s
-
-crti.o: crti.s
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o crti.o crti.s
-
-crtn.o: crtn.s
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o crtn.o crtn.s
diff --git a/gcc/config/rs6000/t-xnewas b/gcc/config/rs6000/t-xnewas
deleted file mode 100644
index 285f8259d07..00000000000
--- a/gcc/config/rs6000/t-xnewas
+++ /dev/null
@@ -1,58 +0,0 @@
-# Same as t-newas, except don't build libgcc1-test. This is because
-# the compiler emits code to call external functions to save the
-# arguments that are in libc, but since libgcc1-test is linked without
-# libc, they will show up as errors.
-LIBGCC1_TEST =
-
-# Do not build libgcc1.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-# Build the libraries for both hard and soft floating point and all of the
-# different processor models
-
-MULTILIB_OPTIONS = msoft-float \
- mcpu=common/mcpu=power/mcpu=powerpc
-
-MULTILIB_DIRNAMES = soft-float \
- common power powerpc
-
-MULTILIB_MATCHES = msoft-float=mcpu?403 \
- mcpu?power=mpower \
- mcpu?power=mrios1 \
- mcpu?power=mcpu?rios1 \
- mcpu?power=mcpu?rsc \
- mcpu?power=mcpu?rsc1 \
- mcpu?power=mpower2 \
- mcpu?power=mrios2 \
- mcpu?power=mcpu=rios2 \
- mcpu?powerpc=mcpu?601 \
- mcpu?powerpc=mcpu?602 \
- mcpu?powerpc=mcpu?603 \
- mcpu?powerpc=mcpu?603e \
- mcpu?powerpc=mcpu?604 \
- mcpu?powerpc=mcpu?620 \
- mcpu?powerpc=mcpu?403 \
- mcpu?powerpc=mpowerpc \
- mcpu?powerpc=mpowerpc-gpopt \
- mcpu?powerpc=mpowerpc-gfxopt
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# Aix 3.2.x needs milli.exp for -mcpu=common
-EXTRA_PARTS = milli.exp
-milli.exp: $(srcdir)/config/rs6000/milli.exp
- rm -f milli.exp
- cp $(srcdir)/config/rs6000/milli.exp ./milli.exp
diff --git a/gcc/config/rs6000/t-xrs6000 b/gcc/config/rs6000/t-xrs6000
deleted file mode 100644
index f5d34d658b7..00000000000
--- a/gcc/config/rs6000/t-xrs6000
+++ /dev/null
@@ -1,28 +0,0 @@
-# Same as t-rs6000, except don't build libgcc1-test. This is because
-# the compiler emits code to call external functions to save the
-# arguments that are in libc, but since libgcc1-test is linked without
-# libc, they will show up as errors.
-LIBGCC1_TEST =
-
-# Do not build libgcc1.
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-# Build the libraries for both hard and soft floating point
-
-MULTILIB_OPTIONS = msoft-float
-MULTILIB_DIRNAMES = soft-float
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/rs6000/tramp.asm b/gcc/config/rs6000/tramp.asm
deleted file mode 100644
index 57b47013748..00000000000
--- a/gcc/config/rs6000/tramp.asm
+++ /dev/null
@@ -1,122 +0,0 @@
-/* CYGNUS LOCAL -- waiting for FSF sources to be restored/meissner */
-/*
- * special support for trampolines
- *
- * Copyright (C) 1996 Free Software Foundation, Inc.
- * Written By Michael Meissner
- *
- * 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, or (at your option) any
- * later version.
- *
- * In addition to the permissions in the GNU General Public License, the
- * Free Software Foundation gives you unlimited permission to link the
- * compiled version of this file with other programs, and to distribute
- * those programs without any restriction coming from the use of this
- * file. (The General Public License restrictions do apply in other
- * respects; for example, they cover modification of the file, and
- * distribution when not linked into another program.)
- *
- * This file 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; 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 link this library with files
- * compiled with GCC to produce an executable, this does not 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.
- */
-
-/* Set up trampolines */
-
- .file "tramp.asm"
- .section ".text"
- #include "ppc-asm.h"
-
- .globl __trampoline_initial
- .type __trampoline_initial,@object
- .align 2
-__trampoline_initial:
- mflr r0
- bl 1f
-.Lfunc = .-__trampoline_initial
- .long 0 /* will be replaced with function address */
-.Lchain = .-__trampoline_initial
- .long 0 /* will be replaced with static chain */
-1: mflr r11
- mtlr r0
- lwz r0,0(r11) /* function address */
- lwz r11,4(r11) /* static chain */
- mtctr r0
- bctr
-
-__trampoline_size = .-__trampoline_initial
- .size __trampoline_initial,__trampoline_size
-
- .section ".got2","aw"
-.LCTOC1 = .+32768
-.Ltramp = .-.LCTOC1
- .long __trampoline_initial-4
-
- .section ".text"
-.LCL0:
- .long .LCTOC1-.LCF0
-
-/* R3 = stack address to store trampoline */
-/* R4 = length of trampoline area */
-/* R5 = function address */
-/* R6 = static chain */
-
-FUNC_START(__trampoline_setup)
- mflr r0 /* save return address */
- bl .LCF0 /* load up __trampoline_initial into r7 */
-.LCF0:
- mflr r11
- lwz r12,(.LCL0-.LCF0)(r11)
- add r11,r12,r11
- lwz r7,.Ltramp(r11) /* trampoline addres -4 */
-
- li r8,__trampoline_size /* verify that the trampoline is big enough */
- cmpw cr1,r8,r4
- srwi r4,r4,2 /* # words to move */
- addi r9,r3,-4 /* adjust pointer for lwzu */
- mtctr r4
- blt cr1,.Labort
-
- mtlr r0
-
- /* Copy the instructions to the stack */
-.Lmove:
- lwzu r10,4(r7)
- stwu r10,4(r9)
- bdnz .Lmove
-
- /* Store correct function and static chain */
- stw r5,.Lfunc(r3)
- stw r6,.Lchain(r3)
-
- /* Now flush both caches */
- mtctr r4
-.Lcache:
- icbi 0,r3
- dcbf 0,r3
- addi r3,r3,4
- bdnz .Lcache
-
- /* Finally synchronize things & return */
- sync
- isync
- blr
-
-.Labort:
- bl abort
-FUNC_END(__trampoline_setup)
-/* END CYGNUS LOCAL -- waiting for FSF sources to be restored/meissner */
diff --git a/gcc/config/rs6000/vxppc.h b/gcc/config/rs6000/vxppc.h
deleted file mode 100644
index 0dddc498325..00000000000
--- a/gcc/config/rs6000/vxppc.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Definitions of target machine for GNU compiler. Vxworks PowerPC version.
- Copyright (C) 1996 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 just exists to give specs for the PowerPC running on VxWorks. */
-
-#include "rs6000/sysv4.h"
-
-#undef CPP_SPEC
-#define CPP_SPEC "\
-%{posix: -D_POSIX_SOURCE} \
-%{!mcpu*: \
- %{mpowerpc*: -D_ARCH_PPC -DCPU=PPC603} \
- %{!mno-powerpc: -D_ARCH_PPC -DCPU=PPC603}} \
-%{mcpu=powerpc: -D_ARCH_PPC -DCPU=PPC603} \
-%{mcpu=403: -D_ARCH_PPC -DCPU=PPC403} \
-%{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR -DCPU=PPC601} \
-%{mcpu=603: -D_ARCH_PPC -DCPU=PPC603} \
-%{mcpu=604: -D_ARCH_PPC -DCPU=PPC604}"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "\
--D__vxworks -D__vxworks__ -Asystem(vxworks) -Asystem(embedded) \
--Acpu(powerpc) -Amachine(powerpc)"
-
-/* VxWorks does all the library stuff itself. */
-
-#undef LIB_SPEC
-#define LIB_SPEC ""
-
-/* VxWorks uses object files, not loadable images. make linker just
- combine objects. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "-r"
-
-/* VxWorks provides the functionality of crt0.o and friends itself. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC ""
-
-/* We use stabs-in-elf for debugging */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
diff --git a/gcc/config/rs6000/win-nt.h b/gcc/config/rs6000/win-nt.h
deleted file mode 100644
index 7c11c1b2ae6..00000000000
--- a/gcc/config/rs6000/win-nt.h
+++ /dev/null
@@ -1,478 +0,0 @@
-/* Definitions of target machine for GNU compiler, for PowerPC
- running Windows/NT.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
-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. */
-
-/* Say this is Windows/NT for the other config files. */
-#define WINDOWS_NT 1
-#define COFF_WITH_PE 1
-
-/* Default ABI to compile code for */
-#define DEFAULT_ABI ABI_NT
-
-#include "rs6000/powerpc.h"
-
-/* Pseudo target that we can test in the md file. */
-#undef TARGET_WINDOWS_NT
-#define TARGET_WINDOWS_NT 1
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-DWIN32 -D_WIN32 \
- -DWINNT -D__STDC__=0 -DALMOST_STDC \
- -D_POWER -D_ARCH_PPC -D__PPC__ -Asystem(winnt) -Acpu(powerpc) -Amachine(powerpc)"
-
-#if 0
-#include "winnt/win-nt.h"
-#endif
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{mwindows:-subsystem:windows -entry:WinMainCRTStartup \
- USER32.LIB GDI32.LIB COMDLG32.LIB WINSPOOL.LIB} \
- %{!mwindows:-subsystem console -e mainCRTStartup} \
- %{mcrtmt:LIBCMT.LIB KERNEL32.LIB} %{!mcrtmt:-lkernel32 -lcygwin} \
- %{v}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{v:-V}"
-
-/* Allow switches specified in LIB_SPEC, but don't do anything with them
- in the compiler. */
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
- { "windows", 0 }, \
- { "crtmt", 0 },
-
-#undef XCOFF_DEBUGGING_INFO
-
-/* this is pure coff, not xcoff */
-#define SDB_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-
-#undef SDB_DELIM
-#define SDB_DELIM ";"
-
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#undef PROCESSOR_DEFAULT
-#define PROCESSOR_DEFAULT PROCESSOR_POWERPC
-
-/* NT always runs little endian */
-#undef BYTES_BIG_ENDIAN
-#define BYTES_BIG_ENDIAN 0
-
-#undef WORDS_BIG_ENDIAN
-#define WORDS_BIG_ENDIAN 0
-
-/* Define cutoff for using external functions to save floating point.
- Currently on NT, always use inline stores */
-#undef FP_SAVE_INLINE
-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
-
-/* Note, little endian systems trap on unaligned addresses, so never
- turn off strict alignment in that case. */
-
-#undef STRICT_ALIGNMENT
-#define STRICT_ALIGNMENT 1
-
-/* Align stack to 16 byte boundaries */
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY 128
-
-/* No data type wants to be aligned rounder than this. */
-#undef BIGGEST_ALIGNMENT
-#define BIGGEST_ALIGNMENT 128
-
-/* NT aligns internal doubles in structures on dword boundaries. */
-#undef BIGGEST_FIELD_ALIGNMENT
-#define BIGGEST_FIELD_ALIGNMENT 64
-
-#undef ADJUST_FIELD_ALIGN
-#undef ROUND_TYPE_ALIGN
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (PowerPC PE)");
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)
-
-#undef PROCESSOR_DEFAULT
-#define PROCESSOR_DEFAULT PROCESSOR_PPC601
-
-/* Address to save the TOC register */
-#undef RS6000_SAVE_TOC
-#define RS6000_SAVE_TOC plus_constant (virtual_incoming_args_rtx, -RS6000_SAVE_AREA - 8)
-
-/* Windows NT specifies that r13 is reserved to the OS, so it is not available
- to the normal user. */
-
-#undef FIXED_R13
-#define FIXED_R13 1
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT) \
- do { fputs ("\t.comm \t", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- if ( (SIZE) > 4) \
- fprintf ((FILE), ",%d,%d\n", (SIZE), 3); \
- else \
- fprintf( (FILE), ",%d\n", (SIZE)); \
- } while (0)
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#undef ASM_OUTPUT_COMMON
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
- do { fputs ("\t.comm \t", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%d\n", (SIZE)); } while (0)
-
-/* This says how to output an assembler line
- to define an aligned local common symbol. */
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- bss_section (); \
- ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
- ASM_OUTPUT_SKIP (FILE, SIZE); \
-} while (0)
-
-/* Describe how to emit unitialized external linkage items */
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
-do { \
- ASM_GLOBALIZE_LABEL (FILE, NAME); \
- ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
-} while (0)
-
-/* This says out to put a global symbol in the BSS section */
-#undef ASM_OUTPUT_ALIGNED_BSS
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
- asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
-
-
-/* Stuff to force fit us into the Motorola PPC assembler */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-do { \
- output_file_directive ((FILE), main_input_filename); \
- rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
- data_section (); \
-} while (0)
-
-#undef ASM_FILE_END
-
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
-{ \
- tree exception_args; \
- int i; \
- \
- if (TREE_PUBLIC (DECL)) \
- { \
- fprintf (FILE, "\t.globl .."); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } \
- \
- fprintf (FILE, "\n#\tFunction: '.."); \
- assemble_name (FILE, NAME); \
- fputs ("'\n", FILE); \
- fputs ("#\tText in section: <default>\n\n", FILE); \
- fputs ("#\tSetup MS Structured-Exception-Handling\n", FILE); \
- fputs ("\t.pdata\n", FILE); \
- fputs ("\t.align 2\n", FILE); \
- fputs ("\t.ualong ..", FILE); \
- assemble_name (FILE, NAME); \
- fputs (",", FILE); \
- assemble_name (FILE, NAME); \
- fputs (".e,", FILE); \
- exception_args = lookup_attribute ("exception", \
- TYPE_ATTRIBUTES (TREE_TYPE (DECL))); \
- \
- if (exception_args) \
- exception_args = TREE_VALUE (exception_args); \
- \
- for (i = 0; i < 2; i++) \
- { \
- if (!exception_args) \
- fputs ("0,", FILE); \
- else \
- { \
- tree field = TREE_VALUE (exception_args); \
- exception_args = TREE_PURPOSE (exception_args); \
- if (TREE_CODE (field) == STRING_CST) \
- fprintf (FILE, "%.*s,", TREE_STRING_LENGTH (field), \
- TREE_STRING_POINTER (field)); \
- else if (TREE_CODE (field) == IDENTIFIER_NODE) \
- fprintf (FILE, "%.*s,", IDENTIFIER_LENGTH (field), \
- IDENTIFIER_POINTER (field)); \
- else \
- abort (); \
- } \
- } \
- \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ".b\n\n"); \
- fprintf (FILE, "#\tSwitch to the relocation section\n"); \
- fprintf (FILE, "\t.reldata\n"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ":\n"); \
- fprintf (FILE, "\t.ualong .."); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",.toc\n"); \
- \
- if (lookup_attribute ("dllexport", \
- TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
- { \
- fprintf (FILE, "\t.globl __imp_"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n__imp_"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ":\n\t.ulong "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } \
- \
- fprintf (FILE, "\t.section .text\n\t.align 2\n.."); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ":\n"); \
- fprintf (FILE, "\t.function\t.."); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
-}
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
- fprintf (FILE, "\t.ualong 0x%lx\n\t.long 0x%lx\n", \
- t[0] & 0xffffffff, t[1] & 0xffffffff); \
- } \
- else \
- { \
- char str[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
- fprintf (FILE, "\t.double %s\n", str); \
- } \
- }
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE, VALUE) \
- { \
- if (REAL_VALUE_ISINF (VALUE) \
- || REAL_VALUE_ISNAN (VALUE) \
- || REAL_VALUE_MINUS_ZERO (VALUE)) \
- { \
- long t; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
- fprintf (FILE, "\t.ualong 0x%lx\n", t & 0xffffffff); \
- } \
- else \
- { \
- char str[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
- fprintf (FILE, "\t.float %s\n", str); \
- } \
- }
-
-/* Output before instructions. */
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP "\t.text"
-
-/* Output before writable data. */
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP "\t.data"
-
-/* Output to the bss section. */
-#undef BSS_SECTION_ASM_OP
-#define BSS_SECTION_ASM_OP "\t.section .bss"
-
-/* Define the extra sections we need. We define a dummy TOC section,
- plus sections to hold the list of static constructors (.ctors) and
- destructors (.dtors). */
-
-#undef READONLY_DATA_SECTION
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_toc, in_ctors, in_dtors
-
-/* Define the routines to implement these extra sections. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
- TOC_SECTION_FUNCTION \
-
-#define TOC_SECTION_FUNCTION \
-void \
-toc_section () \
-{ \
-}
-
-#define CTORS_SECTION_ASM_OP ".section\t.ctors"
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_ASM_OP ".section\t.dtors"
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-#undef SELECT_SECTION
-#undef SELECT_RTX_SECTION
-
-/* Make sure __main gets called */
-#define INVOKE__main 1
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t.ualong "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t.ualong "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-
-/* Text to write out after a CALL that may be replaced by glue code by
- the loader. The motorola asm demands that, for dll support, a .znop
- be issued after a bl instruction, and the symbol on the .znop is the
- symbol on the bl instruction */
-
-#undef RS6000_CALL_GLUE
-#define RS6000_CALL_GLUE "nop #\tFIXME: only works for non-dll calls."
-
-#define RS6000_CALL_GLUE2 ".znop "
-
-#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
-
-/* Output something to declare an external symbol to the assembler. Most
- assemblers don't need this. */
-
-#undef ASM_OUTPUT_EXTERNAL
-
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
-{ \
- char *_name; \
- rtx _symref = XEXP (DECL_RTL (DECL), 0); \
- if ((TREE_CODE (DECL) == VAR_DECL \
- || TREE_CODE (DECL) == FUNCTION_DECL) \
- && (NAME)[strlen (NAME) - 1] != ']') \
- { \
- _name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
- strcpy (_name, XSTR (_symref, 0)); \
- XSTR (_symref, 0) = _name; \
- } \
- else \
- _name = XSTR (_symref, 0); \
- \
- if (DECL_FUNCTION_CODE (DECL) == 0) \
- { \
- fputs ("\t.extern ", FILE); \
- assemble_name (FILE, _name); \
- putc ('\n', FILE); \
- if (TREE_CODE (DECL) == FUNCTION_DECL) \
- { \
- fputs ("\t.extern ..", FILE); \
- assemble_name (FILE, _name); \
- putc ('\n', FILE); \
- } \
- } \
-}
-
-/* Similar, but for libcall. We only have to worry about the function name,
- not that of the descriptor. */
-
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
-
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
-{ fprintf (FILE, "\t.extern .."); \
- assemble_name (FILE, XSTR (FUN, 0)); \
- fprintf (FILE, "\n"); \
-}
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX ".."
-
-/* Eliminate AIX style constant pool processing */
-#undef LEGITIMATE_CONSTANT_POOL_BASE_P
-#define LEGITIMATE_CONSTANT_POOL_BASE_P(X) 0
-
-#undef LEGITIMATE_CONSTANT_POOL_ADDRESS_P
-#define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) 0
-
-#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
-
-#undef ASM_IDENTIFY_GCC
-#define ASM_IDENTIFY_GCC(x)
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- The trampoline should set the static chain pointer to value placed
- into the trampoline and should branch to the specified routine. */
-#define TRAMPOLINE_TEMPLATE(FILE) rs6000_trampoline_template (FILE)
diff --git a/gcc/config/rs6000/x-aix31 b/gcc/config/rs6000/x-aix31
deleted file mode 100644
index 635167c2ed7..00000000000
--- a/gcc/config/rs6000/x-aix31
+++ /dev/null
@@ -1,11 +0,0 @@
-# configuration for IBM rs6000 running aix
-INSTALL=/usr/ucb/install -c
-
-# Show we need to use the C version of ALLOCA
-ALLOCA=alloca.o
-
-# For some reason, we need -lm for cc1.
-# We need -lld for collect2 (actually this only matters
-# for a native compiler, but this is as good a place as any
-# to define the symbol).
-CLIB=-lm -lld
diff --git a/gcc/config/rs6000/x-cygwin32 b/gcc/config/rs6000/x-cygwin32
deleted file mode 100644
index 5e796a0e916..00000000000
--- a/gcc/config/rs6000/x-cygwin32
+++ /dev/null
@@ -1,4 +0,0 @@
-# Don't run fixproto
-STMP_FIXPROTO =
-# Don't need collect2
-USE_COLLECT2 =
diff --git a/gcc/config/rs6000/x-lynx b/gcc/config/rs6000/x-lynx
deleted file mode 100644
index a1a2a73ed80..00000000000
--- a/gcc/config/rs6000/x-lynx
+++ /dev/null
@@ -1,14 +0,0 @@
-# /bin/cc is hopelessly broken, so we must use /bin/gcc instead.
-CC = $(OLDCC)
-OLDCC = /bin/gcc
-
-# /bin/sh is too buggy, so use /bin/bash instead.
-SHELL = /bin/bash
-
-# Show we need to use the C version of ALLOCA
-ALLOCA=alloca.o
-
-# configuration for IBM rs6000 running lynx
-
-# For some reason, we need -lm for cc1.
-CLIB=-lm
diff --git a/gcc/config/rs6000/x-mach b/gcc/config/rs6000/x-mach
deleted file mode 100644
index 64f39a5cf04..00000000000
--- a/gcc/config/rs6000/x-mach
+++ /dev/null
@@ -1,7 +0,0 @@
-# configuration for IBM rs6000 running MACH
-
-# Show we need to use the C version of ALLOCA
-ALLOCA=alloca.o
-
-# For some reason, we need -lm for cc1.
-CLIB=-lm
diff --git a/gcc/config/rs6000/x-rs6000 b/gcc/config/rs6000/x-rs6000
deleted file mode 100644
index ecfc0899079..00000000000
--- a/gcc/config/rs6000/x-rs6000
+++ /dev/null
@@ -1,10 +0,0 @@
-# configuration for IBM rs6000 running aix
-INSTALL=/usr/ucb/install -c
-
-# Show we need to use the C version of ALLOCA
-ALLOCA=alloca.o
-
-# We need -lld for collect2 (actually this only matters
-# for a native compiler, but this is as good a place as any
-# to define the symbol).
-CLIB=-lld
diff --git a/gcc/config/rs6000/x-sysv4 b/gcc/config/rs6000/x-sysv4
deleted file mode 100644
index 2a661e35999..00000000000
--- a/gcc/config/rs6000/x-sysv4
+++ /dev/null
@@ -1,2 +0,0 @@
-X_CFLAGS=-DSVR4
-ALLOCA=alloca.o
diff --git a/gcc/config/rs6000/xm-cygwin32.h b/gcc/config/rs6000/xm-cygwin32.h
deleted file mode 100644
index f7e30a15524..00000000000
--- a/gcc/config/rs6000/xm-cygwin32.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Configuration for GNU C-compiler for hosting on Windows NT.
- using a unix style C library.
- Copyright (C) 1995 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
-#define NO_STAB_H
-
-#include "rs6000/xm-rs6000.h"
-
-#define HAVE_STRERROR
-#define HAVE_RUSAGE
-#define HAVE_FILE_H
-#define EXECUTABLE_SUFFIX ".exe"
diff --git a/gcc/config/rs6000/xm-lynx.h b/gcc/config/rs6000/xm-lynx.h
deleted file mode 100644
index 1c093c203a2..00000000000
--- a/gcc/config/rs6000/xm-lynx.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Configuration for GNU C-compiler for rs6000 platforms running LynxOS.
- Copyright (C) 1995 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. */
-
-#include <xm-lynx.h>
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-
-#include "tm.h"
diff --git a/gcc/config/rs6000/xm-mach.h b/gcc/config/rs6000/xm-mach.h
deleted file mode 100644
index 105a59d67f4..00000000000
--- a/gcc/config/rs6000/xm-mach.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Configuration for GNU C-compiler for IBM RS/6000 on MACH.
- Copyright (C) 1992 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@nyu.edu).
-
-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 "rs6000/xm-rs6000.h"
-#undef USG
-#undef COLLECT_EXPORT_LIST
diff --git a/gcc/config/rs6000/xm-rs6000.h b/gcc/config/rs6000/xm-rs6000.h
deleted file mode 100644
index df6e4e7ad97..00000000000
--- a/gcc/config/rs6000/xm-rs6000.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Configuration for GNU C-compiler for IBM RS/6000.
- Copyright (C) 1990, 1993, 1995 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu).
-
-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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* If not compiled with GNU C, use the C alloca and use only int bitfields. */
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-extern char *alloca ();
-#define ONLY_INT_FIELDS
-#endif
-
-/* AIX is a flavor of System V */
-#define USG
-
-/* Big buffers improve performance. */
-#define IO_BUFFER_SIZE (0x8000 - 4096)
-
-#ifndef CROSS_COMPILE
-/* The AIX linker will discard static constructors in object files before
- collect has a chance to see them, so scan the object files directly. */
-#define COLLECT_EXPORT_LIST
-#endif
-
-#ifndef __STDC__
-extern char *malloc (), *realloc (), *calloc ();
-#else
-extern void *malloc (), *realloc (), *calloc ();
-#endif
-extern void free ();
diff --git a/gcc/config/rs6000/xm-sysv4.h b/gcc/config/rs6000/xm-sysv4.h
deleted file mode 100644
index 5283dfcf98a..00000000000
--- a/gcc/config/rs6000/xm-sysv4.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Configuration for GNU C-compiler for PowerPC running System V.4.
- Copyright (C) 1995 Free Software Foundation, Inc.
-
- Cloned from sparc/xm-sysv4.h by Michael Meissner (meissner@cygnus.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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#if 0
-#define HOST_BITS_PER_LONGLONG 64
-#endif
-
-/* Doubles are stored in memory with the high order word first. This
- matters when cross-compiling. */
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-#include "xm-svr4.h"
-
-/* if not compiled with GNU C, use the C alloca and use only int bitfields. */
-#ifndef __GNUC__
-#define USE_C_ALLOCA
-extern char *alloca ();
-#undef ONLY_INT_FIELDS
-#define ONLY_INT_FIELDS
-#endif
-
-/* Solaris has a different declaration of sys_siglist than collect uses. */
-#define DONT_DECLARE_SYS_SIGLIST
-
-/* We have STRERROR */
-#define HAVE_STRERROR
-
-#ifdef __PPC__
-#ifndef __STDC__
-extern char *malloc (), *realloc (), *calloc ();
-#else
-extern void *malloc (), *realloc (), *calloc ();
-#endif
-extern void free ();
-#endif
diff --git a/gcc/config/sh/elf.h b/gcc/config/sh/elf.h
deleted file mode 100644
index 2c3294b4935..00000000000
--- a/gcc/config/sh/elf.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Definitions of target machine for gcc for Hitachi Super-H using ELF.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Ian Lance Taylor <ian@cygnus.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. */
-
-/* Mostly like the regular SH configuration. */
-#include "sh/sh.h"
-
-/* No SDB debugging info. */
-#undef SDB_DEBUGGING_INFO
-
-/* Prefer stabs. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* Undefine some macros defined in both sh.h and svr4.h. */
-#undef IDENT_ASM_OP
-#undef ASM_FILE_END
-#undef ASM_OUTPUT_SOURCE_LINE
-#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
-#undef CTORS_SECTION_ASM_OP
-#undef DTORS_SECTION_ASM_OP
-#undef ASM_OUTPUT_SECTION_NAME
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-#undef ASM_DECLARE_FUNCTION_NAME
-
-/* Be ELF-like. */
-#include "svr4.h"
-
-/* Let code know that this is ELF. */
-#define CPP_PREDEFINES "-D__sh__ -D__ELF__ -Acpu(sh) -Amachine(sh)"
-
-/* Pass -ml and -mrelax to the assembler and linker. */
-#undef ASM_SPEC
-#define ASM_SPEC "%{ml:-little} %{mrelax:-relax}"
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{ml:-m shl} %{mrelax:-relax}"
-
-/* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
- again. */
-#define DBX_REGISTER_NUMBER(REGNO) \
- (((REGNO) >= 22 && (REGNO) <= 39) ? ((REGNO) + 1) : (REGNO))
-
-/* SH ELF, unlike most ELF implementations, uses underscores before
- symbol names. */
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(STREAM,NAME) \
- fprintf (STREAM, "_%s", NAME)
-
-/* Because SH ELF uses underscores, we don't put a '.' before local
- labels, for easy compatibility with the COFF implementation. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
- sprintf (STRING, "*%s%d", PREFIX, NUM)
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-#undef ASM_OUTPUT_SOURCE_LINE
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
-do \
- { \
- static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,LM%d-", \
- line, sym_lineno); \
- assemble_name (file, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
- fprintf (file, "\nLM%d:\n", sym_lineno); \
- sym_lineno += 1; \
- } \
-while (0)
-
-#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
-do { \
- text_section (); \
- fprintf (FILE, "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \
-} while (0)
-
-/* Arrange to call __main, rather than using crtbegin.o and crtend.o
- and relying on .init and .fini being executed at appropriate times. */
-#undef INIT_SECTION_ASM_OP
-#undef FINI_SECTION_ASM_OP
-#undef STARTFILE_SPEC
-#undef ENDFILE_SPEC
diff --git a/gcc/config/sh/lib1funcs.asm b/gcc/config/sh/lib1funcs.asm
deleted file mode 100644
index 6d8d3e8ffb4..00000000000
--- a/gcc/config/sh/lib1funcs.asm
+++ /dev/null
@@ -1,955 +0,0 @@
-/* Copyright (C) 1994, 1995 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, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file 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; 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 link this library with other files,
- some of which are compiled with GCC, to produce an executable,
- this library 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. */
-
-
-!! libgcc1 routines for the Hitachi SH cpu.
-!! Contributed by Steve Chamberlain.
-!! sac@cygnus.com
-
-!! ashiftrt_r4_x, ___ashrsi3, ___ashlsi3, ___lshrsi3 routines
-!! recoded in assembly by Toshiyasu Morita
-!! tm@netcom.com
-
-#ifdef L_ashiftrt
- .global ___ashiftrt_r4_0
- .global ___ashiftrt_r4_1
- .global ___ashiftrt_r4_2
- .global ___ashiftrt_r4_3
- .global ___ashiftrt_r4_4
- .global ___ashiftrt_r4_5
- .global ___ashiftrt_r4_6
- .global ___ashiftrt_r4_7
- .global ___ashiftrt_r4_8
- .global ___ashiftrt_r4_9
- .global ___ashiftrt_r4_10
- .global ___ashiftrt_r4_11
- .global ___ashiftrt_r4_12
- .global ___ashiftrt_r4_13
- .global ___ashiftrt_r4_14
- .global ___ashiftrt_r4_15
- .global ___ashiftrt_r4_16
- .global ___ashiftrt_r4_17
- .global ___ashiftrt_r4_18
- .global ___ashiftrt_r4_19
- .global ___ashiftrt_r4_20
- .global ___ashiftrt_r4_21
- .global ___ashiftrt_r4_22
- .global ___ashiftrt_r4_23
- .global ___ashiftrt_r4_24
- .global ___ashiftrt_r4_25
- .global ___ashiftrt_r4_26
- .global ___ashiftrt_r4_27
- .global ___ashiftrt_r4_28
- .global ___ashiftrt_r4_29
- .global ___ashiftrt_r4_30
- .global ___ashiftrt_r4_31
- .global ___ashiftrt_r4_32
-
- .align 1
-___ashiftrt_r4_32:
-___ashiftrt_r4_31:
- rotcl r4
- rts
- subc r4,r4
-
-___ashiftrt_r4_30:
- shar r4
-___ashiftrt_r4_29:
- shar r4
-___ashiftrt_r4_28:
- shar r4
-___ashiftrt_r4_27:
- shar r4
-___ashiftrt_r4_26:
- shar r4
-___ashiftrt_r4_25:
- shar r4
-___ashiftrt_r4_24:
- shlr16 r4
- shlr8 r4
- rts
- exts.b r4,r4
-
-___ashiftrt_r4_23:
- shar r4
-___ashiftrt_r4_22:
- shar r4
-___ashiftrt_r4_21:
- shar r4
-___ashiftrt_r4_20:
- shar r4
-___ashiftrt_r4_19:
- shar r4
-___ashiftrt_r4_18:
- shar r4
-___ashiftrt_r4_17:
- shar r4
-___ashiftrt_r4_16:
- shlr16 r4
- rts
- exts.w r4,r4
-
-___ashiftrt_r4_15:
- shar r4
-___ashiftrt_r4_14:
- shar r4
-___ashiftrt_r4_13:
- shar r4
-___ashiftrt_r4_12:
- shar r4
-___ashiftrt_r4_11:
- shar r4
-___ashiftrt_r4_10:
- shar r4
-___ashiftrt_r4_9:
- shar r4
-___ashiftrt_r4_8:
- shar r4
-___ashiftrt_r4_7:
- shar r4
-___ashiftrt_r4_6:
- shar r4
-___ashiftrt_r4_5:
- shar r4
-___ashiftrt_r4_4:
- shar r4
-___ashiftrt_r4_3:
- shar r4
-___ashiftrt_r4_2:
- shar r4
-___ashiftrt_r4_1:
- rts
- shar r4
-
-___ashiftrt_r4_0:
- rts
- nop
-#endif
-
-#ifdef L_ashiftrt_n
-
-!
-! ___ashrsi3
-!
-! Entry:
-!
-! r4: Value to shift
-! r5: Shifts
-!
-! Exit:
-!
-! r0: Result
-!
-! Destroys:
-!
-! (none)
-!
-
- .global ___ashrsi3
- .align 2
-___ashrsi3:
- mov #31,r0
- cmp/hi r0,r5
- bt L_ashrsi3_31
- mova L_ashrsi3_table,r0
- mov.b @(r0,r5),r5
- add r5,r0 ! Change to braf when gas is fixed
- jmp @r0
- mov r4,r0
-
-L_ashrsi3_table:
- .byte L_ashrsi3_0-L_ashrsi3_table
- .byte L_ashrsi3_1-L_ashrsi3_table
- .byte L_ashrsi3_2-L_ashrsi3_table
- .byte L_ashrsi3_3-L_ashrsi3_table
- .byte L_ashrsi3_4-L_ashrsi3_table
- .byte L_ashrsi3_5-L_ashrsi3_table
- .byte L_ashrsi3_6-L_ashrsi3_table
- .byte L_ashrsi3_7-L_ashrsi3_table
- .byte L_ashrsi3_8-L_ashrsi3_table
- .byte L_ashrsi3_9-L_ashrsi3_table
- .byte L_ashrsi3_10-L_ashrsi3_table
- .byte L_ashrsi3_11-L_ashrsi3_table
- .byte L_ashrsi3_12-L_ashrsi3_table
- .byte L_ashrsi3_13-L_ashrsi3_table
- .byte L_ashrsi3_14-L_ashrsi3_table
- .byte L_ashrsi3_15-L_ashrsi3_table
- .byte L_ashrsi3_16-L_ashrsi3_table
- .byte L_ashrsi3_17-L_ashrsi3_table
- .byte L_ashrsi3_18-L_ashrsi3_table
- .byte L_ashrsi3_19-L_ashrsi3_table
- .byte L_ashrsi3_20-L_ashrsi3_table
- .byte L_ashrsi3_21-L_ashrsi3_table
- .byte L_ashrsi3_22-L_ashrsi3_table
- .byte L_ashrsi3_23-L_ashrsi3_table
- .byte L_ashrsi3_24-L_ashrsi3_table
- .byte L_ashrsi3_25-L_ashrsi3_table
- .byte L_ashrsi3_26-L_ashrsi3_table
- .byte L_ashrsi3_27-L_ashrsi3_table
- .byte L_ashrsi3_28-L_ashrsi3_table
- .byte L_ashrsi3_29-L_ashrsi3_table
- .byte L_ashrsi3_30-L_ashrsi3_table
- .byte L_ashrsi3_31-L_ashrsi3_table
-
-L_ashrsi3_31:
- rotcl r0
- rts
- subc r0,r0
-
-L_ashrsi3_30:
- shar r0
-L_ashrsi3_29:
- shar r0
-L_ashrsi3_28:
- shar r0
-L_ashrsi3_27:
- shar r0
-L_ashrsi3_26:
- shar r0
-L_ashrsi3_25:
- shar r0
-L_ashrsi3_24:
- shlr16 r0
- shlr8 r0
- rts
- exts.b r0,r0
-
-L_ashrsi3_23:
- shar r0
-L_ashrsi3_22:
- shar r0
-L_ashrsi3_21:
- shar r0
-L_ashrsi3_20:
- shar r0
-L_ashrsi3_19:
- shar r0
-L_ashrsi3_18:
- shar r0
-L_ashrsi3_17:
- shar r0
-L_ashrsi3_16:
- shlr16 r0
- rts
- exts.w r0,r0
-
-L_ashrsi3_15:
- shar r0
-L_ashrsi3_14:
- shar r0
-L_ashrsi3_13:
- shar r0
-L_ashrsi3_12:
- shar r0
-L_ashrsi3_11:
- shar r0
-L_ashrsi3_10:
- shar r0
-L_ashrsi3_9:
- shar r0
-L_ashrsi3_8:
- shar r0
-L_ashrsi3_7:
- shar r0
-L_ashrsi3_6:
- shar r0
-L_ashrsi3_5:
- shar r0
-L_ashrsi3_4:
- shar r0
-L_ashrsi3_3:
- shar r0
-L_ashrsi3_2:
- shar r0
-L_ashrsi3_1:
- rts
- shar r0
-
-L_ashrsi3_0:
- rts
- nop
-
-#endif
-
-#ifdef L_ashiftlt
-
-!
-! ___ashlsi3
-!
-! Entry:
-!
-! r4: Value to shift
-! r5: Shifts
-!
-! Exit:
-!
-! r0: Result
-!
-! Destroys:
-!
-! (none)
-!
- .global ___ashlsi3
- .align 2
-___ashlsi3:
- mov #31,r0
- cmp/hi r0,r5
- bt L_ashlsi3_32
- mova L_ashlsi3_table,r0
- mov.b @(r0,r5),r5
- add r5,r0 ! Change to braf when gas is fixed
- jmp @r0
- mov r4,r0
-
-L_ashlsi3_table:
- .byte L_ashlsi3_0-L_ashlsi3_table
- .byte L_ashlsi3_1-L_ashlsi3_table
- .byte L_ashlsi3_2-L_ashlsi3_table
- .byte L_ashlsi3_3-L_ashlsi3_table
- .byte L_ashlsi3_4-L_ashlsi3_table
- .byte L_ashlsi3_5-L_ashlsi3_table
- .byte L_ashlsi3_6-L_ashlsi3_table
- .byte L_ashlsi3_7-L_ashlsi3_table
- .byte L_ashlsi3_8-L_ashlsi3_table
- .byte L_ashlsi3_9-L_ashlsi3_table
- .byte L_ashlsi3_10-L_ashlsi3_table
- .byte L_ashlsi3_11-L_ashlsi3_table
- .byte L_ashlsi3_12-L_ashlsi3_table
- .byte L_ashlsi3_13-L_ashlsi3_table
- .byte L_ashlsi3_14-L_ashlsi3_table
- .byte L_ashlsi3_15-L_ashlsi3_table
- .byte L_ashlsi3_16-L_ashlsi3_table
- .byte L_ashlsi3_17-L_ashlsi3_table
- .byte L_ashlsi3_18-L_ashlsi3_table
- .byte L_ashlsi3_19-L_ashlsi3_table
- .byte L_ashlsi3_20-L_ashlsi3_table
- .byte L_ashlsi3_21-L_ashlsi3_table
- .byte L_ashlsi3_22-L_ashlsi3_table
- .byte L_ashlsi3_23-L_ashlsi3_table
- .byte L_ashlsi3_24-L_ashlsi3_table
- .byte L_ashlsi3_25-L_ashlsi3_table
- .byte L_ashlsi3_26-L_ashlsi3_table
- .byte L_ashlsi3_27-L_ashlsi3_table
- .byte L_ashlsi3_28-L_ashlsi3_table
- .byte L_ashlsi3_29-L_ashlsi3_table
- .byte L_ashlsi3_30-L_ashlsi3_table
- .byte L_ashlsi3_31-L_ashlsi3_table
-
-L_ashlsi3_6:
- shll2 r0
-L_ashlsi3_4:
- shll2 r0
-L_ashlsi3_2:
- rts
- shll2 r0
-
-L_ashlsi3_7:
- shll2 r0
-L_ashlsi3_5:
- shll2 r0
-L_ashlsi3_3:
- shll2 r0
-L_ashlsi3_1:
- rts
- shll r0
-
-L_ashlsi3_14:
- shll2 r0
-L_ashlsi3_12:
- shll2 r0
-L_ashlsi3_10:
- shll2 r0
-L_ashlsi3_8:
- rts
- shll8 r0
-
-L_ashlsi3_15:
- shll2 r0
-L_ashlsi3_13:
- shll2 r0
-L_ashlsi3_11:
- shll2 r0
-L_ashlsi3_9:
- shll8 r0
- rts
- shll r0
-
-L_ashlsi3_22:
- shll2 r0
-L_ashlsi3_20:
- shll2 r0
-L_ashlsi3_18:
- shll2 r0
-L_ashlsi3_16:
- rts
- shll16 r0
-
-L_ashlsi3_23:
- shll2 r0
-L_ashlsi3_21:
- shll2 r0
-L_ashlsi3_19:
- shll2 r0
-L_ashlsi3_17:
- shll16 r0
- rts
- shll r0
-
-L_ashlsi3_30:
- shll2 r0
-L_ashlsi3_28:
- shll2 r0
-L_ashlsi3_26:
- shll2 r0
-L_ashlsi3_24:
- shll16 r0
- rts
- shll8 r0
-
-L_ashlsi3_31:
- shll2 r0
-L_ashlsi3_29:
- shll2 r0
-L_ashlsi3_27:
- shll2 r0
-L_ashlsi3_25:
- shll16 r0
- shll8 r0
- rts
- shll r0
-
-L_ashlsi3_32:
- rts
- mov #0,r0
-
-L_ashlsi3_0:
- rts
- nop
-
-#endif
-
-#ifdef L_lshiftrt
-
-!
-! ___lshrsi3
-!
-! Entry:
-!
-! r4: Value to shift
-! r5: Shifts
-!
-! Exit:
-!
-! r0: Result
-!
-! Destroys:
-!
-! (none)
-!
- .global ___lshrsi3
- .align 2
-___lshrsi3:
- mov #31,r0
- cmp/hi r0,r5
- bt L_lshrsi3_32
- mova L_lshrsi3_table,r0
- mov.b @(r0,r5),r5
- add r5,r0 ! Change to braf when gas is fixed
- jmp @r0
- mov r4,r0
-
-L_lshrsi3_table:
- .byte L_lshrsi3_0-L_lshrsi3_table
- .byte L_lshrsi3_1-L_lshrsi3_table
- .byte L_lshrsi3_2-L_lshrsi3_table
- .byte L_lshrsi3_3-L_lshrsi3_table
- .byte L_lshrsi3_4-L_lshrsi3_table
- .byte L_lshrsi3_5-L_lshrsi3_table
- .byte L_lshrsi3_6-L_lshrsi3_table
- .byte L_lshrsi3_7-L_lshrsi3_table
- .byte L_lshrsi3_8-L_lshrsi3_table
- .byte L_lshrsi3_9-L_lshrsi3_table
- .byte L_lshrsi3_10-L_lshrsi3_table
- .byte L_lshrsi3_11-L_lshrsi3_table
- .byte L_lshrsi3_12-L_lshrsi3_table
- .byte L_lshrsi3_13-L_lshrsi3_table
- .byte L_lshrsi3_14-L_lshrsi3_table
- .byte L_lshrsi3_15-L_lshrsi3_table
- .byte L_lshrsi3_16-L_lshrsi3_table
- .byte L_lshrsi3_17-L_lshrsi3_table
- .byte L_lshrsi3_18-L_lshrsi3_table
- .byte L_lshrsi3_19-L_lshrsi3_table
- .byte L_lshrsi3_20-L_lshrsi3_table
- .byte L_lshrsi3_21-L_lshrsi3_table
- .byte L_lshrsi3_22-L_lshrsi3_table
- .byte L_lshrsi3_23-L_lshrsi3_table
- .byte L_lshrsi3_24-L_lshrsi3_table
- .byte L_lshrsi3_25-L_lshrsi3_table
- .byte L_lshrsi3_26-L_lshrsi3_table
- .byte L_lshrsi3_27-L_lshrsi3_table
- .byte L_lshrsi3_28-L_lshrsi3_table
- .byte L_lshrsi3_29-L_lshrsi3_table
- .byte L_lshrsi3_30-L_lshrsi3_table
- .byte L_lshrsi3_31-L_lshrsi3_table
-
-L_lshrsi3_6:
- shlr2 r0
-L_lshrsi3_4:
- shlr2 r0
-L_lshrsi3_2:
- rts
- shlr2 r0
-
-L_lshrsi3_7:
- shlr2 r0
-L_lshrsi3_5:
- shlr2 r0
-L_lshrsi3_3:
- shlr2 r0
-L_lshrsi3_1:
- rts
- shlr r0
-
-L_lshrsi3_14:
- shlr2 r0
-L_lshrsi3_12:
- shlr2 r0
-L_lshrsi3_10:
- shlr2 r0
-L_lshrsi3_8:
- rts
- shlr8 r0
-
-L_lshrsi3_15:
- shlr2 r0
-L_lshrsi3_13:
- shlr2 r0
-L_lshrsi3_11:
- shlr2 r0
-L_lshrsi3_9:
- shlr8 r0
- rts
- shlr r0
-
-L_lshrsi3_22:
- shlr2 r0
-L_lshrsi3_20:
- shlr2 r0
-L_lshrsi3_18:
- shlr2 r0
-L_lshrsi3_16:
- rts
- shlr16 r0
-
-L_lshrsi3_23:
- shlr2 r0
-L_lshrsi3_21:
- shlr2 r0
-L_lshrsi3_19:
- shlr2 r0
-L_lshrsi3_17:
- shlr16 r0
- rts
- shlr r0
-
-L_lshrsi3_30:
- shlr2 r0
-L_lshrsi3_28:
- shlr2 r0
-L_lshrsi3_26:
- shlr2 r0
-L_lshrsi3_24:
- shlr16 r0
- rts
- shlr8 r0
-
-L_lshrsi3_31:
- shlr2 r0
-L_lshrsi3_29:
- shlr2 r0
-L_lshrsi3_27:
- shlr2 r0
-L_lshrsi3_25:
- shlr16 r0
- shlr8 r0
- rts
- shlr r0
-
-L_lshrsi3_32:
- rts
- mov #0,r0
-
-L_lshrsi3_0:
- rts
- nop
-
-#endif
-
-#ifdef L_movstr
- .text
-! done all the large groups, do the remainder
-
-! jump to movstr+
-done:
- add #64,r5
- mova ___movstrSI0,r0
- shll2 r6
- add r6,r0
- jmp @r0
- add #64,r4
- .align 4
- .global ___movstrSI64
-___movstrSI64:
- mov.l @(60,r5),r0
- mov.l r0,@(60,r4)
- .global ___movstrSI60
-___movstrSI60:
- mov.l @(56,r5),r0
- mov.l r0,@(56,r4)
- .global ___movstrSI56
-___movstrSI56:
- mov.l @(52,r5),r0
- mov.l r0,@(52,r4)
- .global ___movstrSI52
-___movstrSI52:
- mov.l @(48,r5),r0
- mov.l r0,@(48,r4)
- .global ___movstrSI48
-___movstrSI48:
- mov.l @(44,r5),r0
- mov.l r0,@(44,r4)
- .global ___movstrSI44
-___movstrSI44:
- mov.l @(40,r5),r0
- mov.l r0,@(40,r4)
- .global ___movstrSI40
-___movstrSI40:
- mov.l @(36,r5),r0
- mov.l r0,@(36,r4)
- .global ___movstrSI36
-___movstrSI36:
- mov.l @(32,r5),r0
- mov.l r0,@(32,r4)
- .global ___movstrSI32
-___movstrSI32:
- mov.l @(28,r5),r0
- mov.l r0,@(28,r4)
- .global ___movstrSI28
-___movstrSI28:
- mov.l @(24,r5),r0
- mov.l r0,@(24,r4)
- .global ___movstrSI24
-___movstrSI24:
- mov.l @(20,r5),r0
- mov.l r0,@(20,r4)
- .global ___movstrSI20
-___movstrSI20:
- mov.l @(16,r5),r0
- mov.l r0,@(16,r4)
- .global ___movstrSI16
-___movstrSI16:
- mov.l @(12,r5),r0
- mov.l r0,@(12,r4)
- .global ___movstrSI12
-___movstrSI12:
- mov.l @(8,r5),r0
- mov.l r0,@(8,r4)
- .global ___movstrSI8
-___movstrSI8:
- mov.l @(4,r5),r0
- mov.l r0,@(4,r4)
- .global ___movstrSI4
-___movstrSI4:
- mov.l @(0,r5),r0
- mov.l r0,@(0,r4)
-___movstrSI0:
- rts
- or r0,r0,r0
-
- .align 4
-
- .global ___movstr
-___movstr:
- mov.l @(60,r5),r0
- mov.l r0,@(60,r4)
-
- mov.l @(56,r5),r0
- mov.l r0,@(56,r4)
-
- mov.l @(52,r5),r0
- mov.l r0,@(52,r4)
-
- mov.l @(48,r5),r0
- mov.l r0,@(48,r4)
-
- mov.l @(44,r5),r0
- mov.l r0,@(44,r4)
-
- mov.l @(40,r5),r0
- mov.l r0,@(40,r4)
-
- mov.l @(36,r5),r0
- mov.l r0,@(36,r4)
-
- mov.l @(32,r5),r0
- mov.l r0,@(32,r4)
-
- mov.l @(28,r5),r0
- mov.l r0,@(28,r4)
-
- mov.l @(24,r5),r0
- mov.l r0,@(24,r4)
-
- mov.l @(20,r5),r0
- mov.l r0,@(20,r4)
-
- mov.l @(16,r5),r0
- mov.l r0,@(16,r4)
-
- mov.l @(12,r5),r0
- mov.l r0,@(12,r4)
-
- mov.l @(8,r5),r0
- mov.l r0,@(8,r4)
-
- mov.l @(4,r5),r0
- mov.l r0,@(4,r4)
-
- mov.l @(0,r5),r0
- mov.l r0,@(0,r4)
-
- add #-16,r6
- cmp/pl r6
- bf done
-
- add #64,r5
- bra ___movstr
- add #64,r4
-#endif
-
-#ifdef L_mulsi3
-
-
- .global ___mulsi3
-
-! r4 = aabb
-! r5 = ccdd
-! r0 = aabb*ccdd via partial products
-!
-! if aa == 0 and cc = 0
-! r0 = bb*dd
-!
-! else
-! aa = bb*dd + (aa*dd*65536) + (cc*bb*65536)
-!
-
-___mulsi3:
- mulu r4,r5 ! multiply the lsws macl=bb*dd
- mov r5,r3 ! r3 = ccdd
- swap.w r4,r2 ! r2 = bbaa
- xtrct r2,r3 ! r3 = aacc
- tst r3,r3 ! msws zero ?
- bf hiset
- rts ! yes - then we have the answer
- sts macl,r0
-
-hiset: sts macl,r0 ! r0 = bb*dd
- mulu r2,r5 | brewing macl = aa*dd
- sts macl,r1
- mulu r3,r4 | brewing macl = cc*bb
- sts macl,r2
- add r1,r2
- shll16 r2
- rts
- add r2,r0
-
-
-#endif
-#ifdef L_sdivsi3
- .title "SH DIVIDE"
-!! 4 byte integer Divide code for the Hitachi SH
-!!
-!! Steve Chamberlain
-!! sac@cygnus.com
-!!
-!!
-
-!! args in r4 and r5, result in r0 clobber r1,r2,r3
-
- .global ___sdivsi3
-___sdivsi3:
- mov r4,r1
- mov r5,r0
-
- tst r0,r0
- bt div0
- mov #0,r2
- div0s r2,r1
- subc r3,r3
- subc r2,r1
- div0s r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- div1 r0,r3
- rotcl r1
- addc r2,r1
- rts
- mov r1,r0
-
-
-div0: rts
- mov #0,r0
-
-#endif
-#ifdef L_udivsi3
-
- .title "SH DIVIDE"
-!! 4 byte integer Divide code for the Hitachi SH
-!!
-!! Steve Chamberlain
-!! sac@cygnus.com
-!!
-!!
-
-!! args in r4 and r5, result in r0, clobbers r4, pr, and t bit
- .global ___udivsi3
-
-___udivsi3:
-longway:
- mov #0,r0
- div0u
- ! get one bit from the msb of the numerator into the T
- ! bit and divide it by whats in r5. Put the answer bit
- ! into the T bit so it can come out again at the bottom
-
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
-
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
-shortway:
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
-
-vshortway:
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4 ; div1 r5,r0
- rotcl r4
-ret: rts
- mov r4,r0
-
-#endif
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
deleted file mode 100644
index dd540b77310..00000000000
--- a/gcc/config/sh/sh.c
+++ /dev/null
@@ -1,3118 +0,0 @@
-/* Output routines for GCC for Hitachi Super-H.
- Copyright (C) 1993, 1994, 1995, 1996 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. */
-
-/* Contributed by Steve Chamberlain (sac@cygnus.com).
- Improved by Jim Wilson (wilson@cygnus.com). */
-
-#include "config.h"
-
-#include <stdio.h>
-
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "insn-flags.h"
-#include "expr.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "output.h"
-#include "insn-attr.h"
-
-#define MSW (TARGET_LITTLE_ENDIAN ? 1 : 0)
-#define LSW (TARGET_LITTLE_ENDIAN ? 0 : 1)
-
-/* ??? The pragma interrupt support will not work for SH3. */
-/* This is set by #pragma interrupt and #pragma trapa, and causes gcc to
- output code for the next function appropriate for an interrupt handler. */
-int pragma_interrupt;
-
-/* This is set by #pragma trapa, and is similar to the above, except that
- the compiler doesn't emit code to preserve all registers. */
-static int pragma_trapa;
-
-/* This is set by #pragma nosave_low_regs. This is useful on the SH3,
- which has a separate set of low regs for User and Supervisor modes.
- This should only be used for the lowest level of interrupts. Higher levels
- of interrupts must save the registers in case they themselves are
- interrupted. */
-int pragma_nosave_low_regs;
-
-/* This is used for communication between SETUP_INCOMING_VARARGS and
- sh_expand_prologue. */
-int current_function_anonymous_args;
-
-/* Global variables from toplev.c and final.c that are used within, but
- not declared in any header file. */
-extern char *version_string;
-extern int *insn_addresses;
-
-/* Global variables for machine-dependent things. */
-
-/* Which cpu are we scheduling for. */
-enum processor_type sh_cpu;
-
-/* Saved operands from the last compare to use when we generate an scc
- or bcc insn. */
-
-rtx sh_compare_op0;
-rtx sh_compare_op1;
-
-/* Provides the class number of the smallest class containing
- reg number. */
-
-int regno_reg_class[FIRST_PSEUDO_REGISTER] =
-{
- R0_REGS, GENERAL_REGS, GENERAL_REGS, GENERAL_REGS,
- GENERAL_REGS, GENERAL_REGS, GENERAL_REGS, GENERAL_REGS,
- GENERAL_REGS, GENERAL_REGS, GENERAL_REGS, GENERAL_REGS,
- GENERAL_REGS, GENERAL_REGS, GENERAL_REGS, GENERAL_REGS,
- GENERAL_REGS, PR_REGS, T_REGS, NO_REGS,
- MAC_REGS, MAC_REGS, FPUL_REGS, GENERAL_REGS,
- FP0_REGS,FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
- FP_REGS, FP_REGS, FP_REGS, FP_REGS,
-};
-
-/* Provide reg_class from a letter such as appears in the machine
- description. */
-
-enum reg_class reg_class_from_letter[] =
-{
- /* a */ NO_REGS, /* b */ NO_REGS, /* c */ NO_REGS, /* d */ NO_REGS,
- /* e */ NO_REGS, /* f */ FP_REGS, /* g */ NO_REGS, /* h */ NO_REGS,
- /* i */ NO_REGS, /* j */ NO_REGS, /* k */ NO_REGS, /* l */ PR_REGS,
- /* m */ NO_REGS, /* n */ NO_REGS, /* o */ NO_REGS, /* p */ NO_REGS,
- /* q */ NO_REGS, /* r */ NO_REGS, /* s */ NO_REGS, /* t */ T_REGS,
- /* u */ NO_REGS, /* v */ NO_REGS, /* w */ FP0_REGS, /* x */ MAC_REGS,
- /* y */ FPUL_REGS, /* z */ R0_REGS
-};
-
-/* Print the operand address in x to the stream. */
-
-void
-print_operand_address (stream, x)
- FILE *stream;
- rtx x;
-{
- switch (GET_CODE (x))
- {
- case REG:
- fprintf (stream, "@%s", reg_names[REGNO (x)]);
- break;
-
- case PLUS:
- {
- rtx base = XEXP (x, 0);
- rtx index = XEXP (x, 1);
-
- switch (GET_CODE (index))
- {
- case CONST_INT:
- fprintf (stream, "@(%d,%s)", INTVAL (index),
- reg_names[REGNO (base)]);
- break;
-
- case REG:
- fprintf (stream, "@(r0,%s)",
- reg_names[MAX (REGNO (base), REGNO (index))]);
- break;
-
- default:
- debug_rtx (x);
- abort ();
- }
- }
- break;
-
- case PRE_DEC:
- fprintf (stream, "@-%s", reg_names[REGNO (XEXP (x, 0))]);
- break;
-
- case POST_INC:
- fprintf (stream, "@%s+", reg_names[REGNO (XEXP (x, 0))]);
- break;
-
- default:
- output_addr_const (stream, x);
- break;
- }
-}
-
-/* Print operand x (an rtx) in assembler syntax to file stream
- according to modifier code.
-
- '.' print a .s if insn needs delay slot
- '@' print rte or rts depending upon pragma interruptness
- '#' output a nop if there is nothing to put in the delay slot
- 'O' print a constant without the #
- 'R' print the LSW of a dp value - changes if in little endian
- 'S' print the MSW of a dp value - changes if in little endian
- 'T' print the next word of a dp value - same as 'R' in big endian mode. */
-
-void
-print_operand (stream, x, code)
- FILE *stream;
- rtx x;
- int code;
-{
- switch (code)
- {
- case '.':
- if (final_sequence
- && ! INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0)))
- fprintf (stream, ".s");
- break;
- case '@':
- if (pragma_interrupt)
- fprintf (stream, "rte");
- else
- fprintf (stream, "rts");
- break;
- case '#':
- /* Output a nop if there's nothing in the delay slot. */
- if (dbr_sequence_length () == 0)
- fprintf (stream, "\n\tnop");
- break;
- case 'O':
- output_addr_const (stream, x);
- break;
- case 'R':
- fputs (reg_names[REGNO (x) + LSW], (stream));
- break;
- case 'S':
- fputs (reg_names[REGNO (x) + MSW], (stream));
- break;
- case 'T':
- /* Next word of a double. */
- switch (GET_CODE (x))
- {
- case REG:
- fputs (reg_names[REGNO (x) + 1], (stream));
- break;
- case MEM:
- print_operand_address (stream,
- XEXP (adj_offsettable_operand (x, 4), 0));
- break;
- }
- break;
- default:
- switch (GET_CODE (x))
- {
- case REG:
- fputs (reg_names[REGNO (x)], (stream));
- break;
- case MEM:
- output_address (XEXP (x, 0));
- break;
- default:
- fputc ('#', stream);
- output_addr_const (stream, x);
- break;
- }
- break;
- }
-}
-
-/* Emit code to perform a block move. Choose the best method.
-
- OPERANDS[0] is the destination.
- OPERANDS[1] is the source.
- OPERANDS[2] is the size.
- OPERANDS[3] is the alignment safe to use. */
-
-int
-expand_block_move (operands)
- rtx *operands;
-{
- int align = INTVAL (operands[3]);
- int constp = (GET_CODE (operands[2]) == CONST_INT);
- int bytes = (constp ? INTVAL (operands[2]) : 0);
-
- /* If it isn't a constant number of bytes, or if it doesn't have 4 byte
- alignment, or if it isn't a multiple of 4 bytes, then fail. */
- if (! constp || align < 4 || (bytes % 4 != 0))
- return 0;
-
- if (bytes < 64)
- {
- char entry[30];
- tree entry_name;
- rtx func_addr_rtx;
- rtx r4 = gen_rtx (REG, SImode, 4);
- rtx r5 = gen_rtx (REG, SImode, 5);
-
- sprintf (entry, "__movstrSI%d", bytes);
- entry_name = get_identifier (entry);
-
- func_addr_rtx
- = copy_to_mode_reg (Pmode,
- gen_rtx (SYMBOL_REF, Pmode,
- IDENTIFIER_POINTER (entry_name)));
- emit_insn (gen_move_insn (r4, XEXP (operands[0], 0)));
- emit_insn (gen_move_insn (r5, XEXP (operands[1], 0)));
- emit_insn (gen_block_move_real (func_addr_rtx));
- return 1;
- }
-
- /* This is the same number of bytes as a memcpy call, but to a different
- less common function name, so this will occasionally use more space. */
- if (! TARGET_SMALLCODE)
- {
- tree entry_name;
- rtx func_addr_rtx;
- int final_switch, while_loop;
- rtx r4 = gen_rtx (REG, SImode, 4);
- rtx r5 = gen_rtx (REG, SImode, 5);
- rtx r6 = gen_rtx (REG, SImode, 6);
-
- entry_name = get_identifier ("__movstr");
- func_addr_rtx
- = copy_to_mode_reg (Pmode,
- gen_rtx (SYMBOL_REF, Pmode,
- IDENTIFIER_POINTER (entry_name)));
- emit_insn (gen_move_insn (r4, XEXP (operands[0], 0)));
- emit_insn (gen_move_insn (r5, XEXP (operands[1], 0)));
-
- /* r6 controls the size of the move. 16 is decremented from it
- for each 64 bytes moved. Then the negative bit left over is used
- as an index into a list of move instructions. e.g., a 72 byte move
- would be set up with size(r6) = 14, for one iteration through the
- big while loop, and a switch of -2 for the last part. */
-
- final_switch = 16 - ((bytes / 4) % 16);
- while_loop = ((bytes / 4) / 16 - 1) * 16;
- emit_insn (gen_move_insn (r6, GEN_INT (while_loop + final_switch)));
- emit_insn (gen_block_lump_real (func_addr_rtx));
- return 1;
- }
-
- return 0;
-}
-
-/* Prepare operands for a move define_expand; specifically, one of the
- operands must be in a register. */
-
-int
-prepare_move_operands (operands, mode)
- rtx operands[];
- enum machine_mode mode;
-{
- if (! reload_in_progress && ! reload_completed)
- {
- /* Copy the source to a register if both operands aren't registers. */
- if (! register_operand (operands[0], mode)
- && ! register_operand (operands[1], mode))
- operands[1] = copy_to_mode_reg (mode, operands[1]);
-
- /* This case can happen while generating code to move the result
- of a library call to the target. Reject `st r0,@(rX,rY)' because
- reload will fail to find a spill register for rX, since r0 is already
- being used for the source. */
- else if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 0
- && GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PLUS
- && GET_CODE (XEXP (XEXP (operands[0], 0), 1)) == REG)
- operands[1] = copy_to_mode_reg (mode, operands[1]);
- }
-
- return 0;
-}
-
-/* Prepare the operands for an scc instruction; make sure that the
- compare has been done. */
-rtx
-prepare_scc_operands (code)
- enum rtx_code code;
-{
- rtx t_reg = gen_rtx (REG, SImode, T_REG);
- enum rtx_code oldcode = code;
- enum machine_mode mode;
-
- /* First need a compare insn. */
- switch (code)
- {
- case NE:
- /* It isn't possible to handle this case. */
- abort ();
- case LT:
- code = GT;
- break;
- case LE:
- code = GE;
- break;
- case LTU:
- code = GTU;
- break;
- case LEU:
- code = GEU;
- break;
- }
- if (code != oldcode)
- {
- rtx tmp = sh_compare_op0;
- sh_compare_op0 = sh_compare_op1;
- sh_compare_op1 = tmp;
- }
-
- mode = GET_MODE (sh_compare_op0);
- if (mode == VOIDmode)
- mode = GET_MODE (sh_compare_op1);
-
- sh_compare_op0 = force_reg (mode, sh_compare_op0);
- if (code != EQ && code != NE
- && (sh_compare_op1 != const0_rtx
- || code == GTU || code == GEU || code == LTU || code == LEU))
- sh_compare_op1 = force_reg (mode, sh_compare_op1);
-
- /* ??? This should be `mode' not `SImode' in the compare, but that would
- require fixing the branch patterns too. */
- emit_insn (gen_rtx (SET, VOIDmode, t_reg,
- gen_rtx (code, SImode, sh_compare_op0,
- sh_compare_op1)));
-
- return t_reg;
-}
-
-/* Called from the md file, set up the operands of a compare instruction. */
-
-void
-from_compare (operands, code)
- rtx *operands;
- int code;
-{
- if (code != EQ && code != NE)
- {
- enum machine_mode mode = GET_MODE (sh_compare_op0);
- if (mode == VOIDmode)
- mode = GET_MODE (sh_compare_op1);
-
- /* Force args into regs, since we can't use constants here. */
- sh_compare_op0 = force_reg (mode, sh_compare_op0);
- if (sh_compare_op1 != const0_rtx
- || code == GTU || code == GEU || code == LTU || code == LEU)
- sh_compare_op1 = force_reg (mode, sh_compare_op1);
- }
- operands[1] = sh_compare_op0;
- operands[2] = sh_compare_op1;
-}
-
-/* Functions to output assembly code. */
-
-/* Return a sequence of instructions to perform DI or DF move.
-
- Since the SH cannot move a DI or DF in one instruction, we have
- to take care when we see overlapping source and dest registers. */
-
-char *
-output_movedouble (insn, operands, mode)
- rtx insn;
- rtx operands[];
- enum machine_mode mode;
-{
- rtx dst = operands[0];
- rtx src = operands[1];
-
- if (GET_CODE (dst) == MEM
- && GET_CODE (XEXP (dst, 0)) == PRE_DEC)
- return "mov.l %T1,%0\n\tmov.l %1,%0";
-
- if (register_operand (dst, mode)
- && register_operand (src, mode))
- {
- if (REGNO (src) == MACH_REG)
- return "sts mach,%S0\n\tsts macl,%R0";
-
- /* When mov.d r1,r2 do r2->r3 then r1->r2;
- when mov.d r1,r0 do r1->r0 then r2->r1. */
-
- if (REGNO (src) + 1 == REGNO (dst))
- return "mov %T1,%T0\n\tmov %1,%0";
- else
- return "mov %1,%0\n\tmov %T1,%T0";
- }
- else if (GET_CODE (src) == CONST_INT)
- {
- if (INTVAL (src) < 0)
- output_asm_insn ("mov #-1,%S0", operands);
- else
- output_asm_insn ("mov #0,%S0", operands);
-
- return "mov %1,%R0";
- }
- else if (GET_CODE (src) == MEM)
- {
- int ptrreg = -1;
- int dreg = REGNO (dst);
- rtx inside = XEXP (src, 0);
-
- if (GET_CODE (inside) == REG)
- ptrreg = REGNO (inside);
- else if (GET_CODE (inside) == SUBREG)
- ptrreg = REGNO (SUBREG_REG (inside)) + SUBREG_WORD (inside);
- else if (GET_CODE (inside) == PLUS)
- {
- ptrreg = REGNO (XEXP (inside, 0));
- /* ??? A r0+REG address shouldn't be possible here, because it isn't
- an offsettable address. Unfortunately, offsettable addresses use
- QImode to check the offset, and a QImode offsettable address
- requires r0 for the other operand, which is not currently
- supported, so we can't use the 'o' constraint.
- Thus we must check for and handle r0+REG addresses here.
- We punt for now, since this is likely very rare. */
- if (GET_CODE (XEXP (inside, 1)) == REG)
- abort ();
- }
- else if (GET_CODE (inside) == LABEL_REF)
- return "mov.l %1,%0\n\tmov.l %1+4,%T0";
- else if (GET_CODE (inside) == POST_INC)
- return "mov.l %1,%0\n\tmov.l %1,%T0";
- else
- abort ();
-
- /* Work out the safe way to copy. Copy into the second half first. */
- if (dreg == ptrreg)
- return "mov.l %T1,%T0\n\tmov.l %1,%0";
- }
-
- return "mov.l %1,%0\n\tmov.l %T1,%T0";
-}
-
-/* Print an instruction which would have gone into a delay slot after
- another instruction, but couldn't because the other instruction expanded
- into a sequence where putting the slot insn at the end wouldn't work. */
-
-static void
-print_slot (insn)
- rtx insn;
-{
- final_scan_insn (XVECEXP (insn, 0, 1), asm_out_file, optimize, 0, 1);
-
- INSN_DELETED_P (XVECEXP (insn, 0, 1)) = 1;
-}
-
-/* We can't tell if we need a register as a scratch for the jump
- until after branch shortening, and then it's too late to allocate a
- register the 'proper' way. These instruction sequences are rare
- anyway, so to avoid always using a reg up from our limited set, we'll
- grab one when we need one on output. */
-
-/* ??? Should fix compiler so that using a clobber scratch in jump
- instructions works, and then this will be unnecessary. */
-
-char *
-output_far_jump (insn, op)
- rtx insn;
- rtx op;
-{
- rtx thislab = gen_label_rtx ();
-
- /* Output the delay slot insn first if any. */
- if (dbr_sequence_length ())
- print_slot (final_sequence);
-
- output_asm_insn ("mov.l r13,@-r15", 0);
- output_asm_insn ("mov.l %O0,r13", &thislab);
- output_asm_insn ("jmp @r13", 0);
- output_asm_insn ("mov.l @r15+,r13", 0);
- output_asm_insn (".align 2", 0);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (thislab));
- output_asm_insn (".long %O0", &op);
- return "";
-}
-
-/* Local label counter, used for constants in the pool and inside
- pattern branches. */
-
-static int lf = 100;
-
-/* Output code for ordinary branches. */
-
-char *
-output_branch (logic, insn, operands)
- int logic;
- rtx insn;
- rtx *operands;
-{
- int label = lf++;
- int length = get_attr_length (insn);
- int adjusted_length;
-
- /* Undo the effects of ADJUST_INSN_LENGTH, so that we get the real
- length. If NEXT_INSN (PREV_INSN (insn)) != insn, then the insn
- is inside a sequence, and ADJUST_INSN_LENGTH was not called on
- it. */
- if (PREV_INSN (insn) == NULL
- || NEXT_INSN (PREV_INSN (insn)) == insn)
- {
- adjusted_length = length;
- ADJUST_INSN_LENGTH (insn, adjusted_length);
- length -= (adjusted_length - length);
- }
-
- switch (length)
- {
- case 2:
- /* A branch with an unfilled delay slot. */
- case 4:
- /* Simple branch in range -252..+258 bytes */
- return logic ? "bt%. %l0" : "bf%. %l0";
-
- case 6:
- /* A branch with an unfilled delay slot. */
- case 8:
- /* Branch in range -4092..+4098 bytes. */
- {
- /* The call to print_slot will clobber the operands. */
- rtx op0 = operands[0];
-
- /* If the instruction in the delay slot is annulled (true), then
- there is no delay slot where we can put it now. The only safe
- place for it is after the label. */
-
- if (final_sequence)
- {
- fprintf (asm_out_file, "\tb%c%s\tLF%d\n", logic ? 'f' : 't',
- INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0))
- ? "" : ".s", label);
- if (! INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0)))
- print_slot (final_sequence);
- }
- else
- fprintf (asm_out_file, "\tb%c\tLF%d\n", logic ? 'f' : 't', label);
-
- output_asm_insn ("bra %l0", &op0);
- fprintf (asm_out_file, "\tnop\n");
- fprintf (asm_out_file, "LF%d:\n", label);
-
- if (final_sequence
- && INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0)))
- print_slot (final_sequence);
- }
- return "";
-
- case 16:
- /* A branch with an unfilled delay slot. */
- case 18:
- /* Branches a long way away. */
- {
- /* The call to print_slot will clobber the operands. */
- rtx op0 = operands[0];
-
- /* If the instruction in the delay slot is annulled (true), then
- there is no delay slot where we can put it now. The only safe
- place for it is after the label. */
-
- if (final_sequence)
- {
- fprintf (asm_out_file, "\tb%c%s\tLF%d\n", logic ? 'f' : 't',
- INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0))
- ? "" : ".s", label);
- if (! INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0)))
- print_slot (final_sequence);
- }
- else
- fprintf (asm_out_file, "\tb%c\tLF%d\n", logic ? 'f' : 't', label);
-
- output_far_jump (insn, op0);
- fprintf (asm_out_file, "LF%d:\n", label);
-
- if (final_sequence
- && INSN_ANNULLED_BRANCH_P (XVECEXP (final_sequence, 0, 0)))
- print_slot (final_sequence);
- }
- return "";
- }
-
- abort ();
-}
-
-/* Output to FILE the start of the assembler file. */
-
-void
-output_file_start (file)
- FILE *file;
-{
- register int pos;
-
- output_file_directive (file, main_input_filename);
-
- /* Switch to the data section so that the coffsem symbol and the
- gcc2_compiled. symbol aren't in the text section. */
- data_section ();
-
- if (TARGET_LITTLE_ENDIAN)
- fprintf (file, "\t.little\n");
-}
-
-/* Actual number of instructions used to make a shift by N. */
-static char ashiftrt_insns[] =
- { 0,1,2,3,4,5,8,8,8,8,8,8,8,8,8,8,2,3,4,5,8,8,8,8,8,8,8,8,8,8,8,2};
-
-/* Left shift and logical right shift are the same. */
-static char shift_insns[] =
- { 0,1,1,2,2,3,3,4,1,2,2,3,3,4,3,3,1,2,2,3,3,4,3,3,2,3,3,4,4,4,3,3};
-
-/* Individual shift amounts needed to get the above length sequences.
- One bit right shifts clobber the T bit, so when possible, put one bit
- shifts in the middle of the sequence, so the ends are eligible for
- branch delay slots. */
-static short shift_amounts[32][5] = {
- {0}, {1}, {2}, {2, 1},
- {2, 2}, {2, 1, 2}, {2, 2, 2}, {2, 2, 1, 2},
- {8}, {8, 1}, {8, 2}, {8, 1, 2},
- {8, 2, 2}, {8, 2, 1, 2}, {8, -2, 8}, {8, -1, 8},
- {16}, {16, 1}, {16, 2}, {16, 1, 2},
- {16, 2, 2}, {16, 2, 1, 2}, {16, -2, 8}, {16, -1, 8},
- {16, 8}, {16, 1, 8}, {16, 8, 2}, {16, 8, 1, 2},
- {16, 8, 2, 2}, {16, -1, -2, 16}, {16, -2, 16}, {16, -1, 16}};
-
-/* Likewise, but for shift amounts < 16, up to three highmost bits
- might be clobbered. This is typically used when combined with some
- kind of sign or zero extension. */
-
-static char ext_shift_insns[] =
- { 0,1,1,2,2,3,2,2,1,2,2,3,3,3,2,2,1,2,2,3,3,4,3,3,2,3,3,4,4,4,3,3};
-
-static short ext_shift_amounts[32][4] = {
- {0}, {1}, {2}, {2, 1},
- {2, 2}, {2, 1, 2}, {8, -2}, {8, -1},
- {8}, {8, 1}, {8, 2}, {8, 1, 2},
- {8, 2, 2}, {16, -2, -1}, {16, -2}, {16, -1},
- {16}, {16, 1}, {16, 2}, {16, 1, 2},
- {16, 2, 2}, {16, 2, 1, 2}, {16, -2, 8}, {16, -1, 8},
- {16, 8}, {16, 1, 8}, {16, 8, 2}, {16, 8, 1, 2},
- {16, 8, 2, 2}, {16, -1, -2, 16}, {16, -2, 16}, {16, -1, 16}};
-
-/* Assuming we have a value that has been sign-extended by at least one bit,
- can we use the ext_shift_amounts with the last shift turned to an arithmetic shift
- to shift it by N without data loss, and quicker than by other means? */
-#define EXT_SHIFT_SIGNED(n) (((n) | 8) == 15)
-
-/* This is used in length attributes in sh.md to help compute the length
- of arbitrary constant shift instructions. */
-
-int
-shift_insns_rtx (insn)
- rtx insn;
-{
- rtx set_src = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
- int shift_count = INTVAL (XEXP (set_src, 1));
- enum rtx_code shift_code = GET_CODE (set_src);
-
- switch (shift_code)
- {
- case ASHIFTRT:
- return ashiftrt_insns[shift_count];
- case LSHIFTRT:
- case ASHIFT:
- return shift_insns[shift_count];
- default:
- abort();
- }
-}
-
-/* Return the cost of a shift. */
-
-int
-shiftcosts (x)
- rtx x;
-{
- int value = INTVAL (XEXP (x, 1));
-
- /* If shift by a non constant, then this will be expensive. */
- if (GET_CODE (XEXP (x, 1)) != CONST_INT)
- {
- if (TARGET_SH3)
- return 2;
- /* If not an sh3 then we don't even have an instruction for it. */
- return 20;
- }
-
- /* Otherwise, return the true cost in instructions. */
- if (GET_CODE (x) == ASHIFTRT)
- {
- int cost = ashiftrt_insns[value];
- /* If SH3, then we put the constant in a reg and use shad. */
- if (TARGET_SH3 && cost > 3)
- cost = 3;
- return cost;
- }
- else
- return shift_insns[value];
-}
-
-/* Return the cost of an AND operation. */
-
-int
-andcosts (x)
- rtx x;
-{
- int i;
-
- /* Anding with a register is a single cycle and instruction. */
- if (GET_CODE (XEXP (x, 1)) != CONST_INT)
- return 1;
-
- i = INTVAL (XEXP (x, 1));
- /* These constants are single cycle extu.[bw] instructions. */
- if (i == 0xff || i == 0xffff)
- return 1;
- /* Constants that can be used in an and immediate instruction is a single
- cycle, but this requires r0, so make it a little more expensive. */
- if (CONST_OK_FOR_L (i))
- return 2;
- /* Constants that can be loaded with a mov immediate and an and.
- This case is probably unnecessary. */
- if (CONST_OK_FOR_I (i))
- return 2;
- /* Any other constants requires a 2 cycle pc-relative load plus an and.
- This case is probably unnecessary. */
- return 3;
-}
-
-/* Return the cost of a multiply. */
-int
-multcosts (x)
- rtx x;
-{
- if (TARGET_SH2)
- {
- /* We have a mul insn, so we can never take more than the mul and the
- read of the mac reg, but count more because of the latency and extra
- reg usage. */
- if (TARGET_SMALLCODE)
- return 2;
- return 3;
- }
-
- /* If we're aiming at small code, then just count the number of
- insns in a multiply call sequence. */
- if (TARGET_SMALLCODE)
- return 5;
-
- /* Otherwise count all the insns in the routine we'd be calling too. */
- return 20;
-}
-
-/* Code to expand a shift. */
-
-void
-gen_ashift (type, n, reg)
- int type;
- int n;
- rtx reg;
-{
- /* Negative values here come from the shift_amounts array. */
- if (n < 0)
- {
- if (type == ASHIFT)
- type = LSHIFTRT;
- else
- type = ASHIFT;
- n = -n;
- }
-
- switch (type)
- {
- case ASHIFTRT:
- emit_insn (gen_ashrsi3_k (reg, reg, GEN_INT (n)));
- break;
- case LSHIFTRT:
- if (n == 1)
- emit_insn (gen_lshrsi3_m (reg, reg, GEN_INT (n)));
- else
- emit_insn (gen_lshrsi3_k (reg, reg, GEN_INT (n)));
- break;
- case ASHIFT:
- emit_insn (gen_ashlsi3_k (reg, reg, GEN_INT (n)));
- break;
- }
-}
-
-/* Same for HImode */
-
-void
-gen_ashift_hi (type, n, reg)
- int type;
- int n;
- rtx reg;
-{
- /* Negative values here come from the shift_amounts array. */
- if (n < 0)
- {
- if (type == ASHIFT)
- type = LSHIFTRT;
- else
- type = ASHIFT;
- n = -n;
- }
-
- switch (type)
- {
- case ASHIFTRT:
- emit_insn (gen_ashrhi3_k (reg, reg, GEN_INT (n)));
- break;
- case LSHIFTRT:
- if (n == 1)
- emit_insn (gen_lshrhi3_m (reg, reg, GEN_INT (n)));
- else
- emit_insn (gen_lshrhi3_k (reg, reg, GEN_INT (n)));
- break;
- case ASHIFT:
- emit_insn (gen_ashlhi3_k (reg, reg, GEN_INT (n)));
- break;
- }
-}
-
-/* Output RTL to split a constant shift into its component SH constant
- shift instructions. */
-
-int
-gen_shifty_op (code, operands)
- int code;
- rtx *operands;
-{
- int value = INTVAL (operands[2]);
- int max, i;
-
- /* Truncate the shift count in case it is out of bounds. */
- value = value & 0x1f;
-
- if (value == 31)
- {
- if (code == LSHIFTRT)
- {
- emit_insn (gen_rotlsi3_1 (operands[0], operands[0]));
- emit_insn (gen_movt (operands[0]));
- return;
- }
- else if (code == ASHIFT)
- {
- /* There is a two instruction sequence for 31 bit left shifts,
- but it requires r0. */
- if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 0)
- {
- emit_insn (gen_andsi3 (operands[0], operands[0], const1_rtx));
- emit_insn (gen_rotlsi3_31 (operands[0], operands[0]));
- return;
- }
- }
- }
- else if (value == 0)
- {
- /* This can happen when not optimizing. We must output something here
- to prevent the compiler from aborting in final.c after the try_split
- call. */
- emit_insn (gen_nop ());
- return;
- }
-
- max = shift_insns[value];
- for (i = 0; i < max; i++)
- gen_ashift (code, shift_amounts[value][i], operands[0]);
-}
-
-/* Same as above, but optimized for values where the topmost bits don't
- matter. */
-
-int
-gen_shifty_hi_op (code, operands)
- int code;
- rtx *operands;
-{
- int value = INTVAL (operands[2]);
- int max, i;
- void (*gen_fun)();
-
- /* This operation is used by and_shl for SImode values with a few
- high bits known to be cleared. */
- value &= 31;
- if (value == 0)
- {
- emit_insn (gen_nop ());
- return;
- }
-
- gen_fun = GET_MODE (operands[0]) == HImode ? gen_ashift_hi : gen_ashift;
- if (code == ASHIFT)
- {
- max = ext_shift_insns[value];
- for (i = 0; i < max; i++)
- gen_fun (code, ext_shift_amounts[value][i], operands[0]);
- }
- else
- /* When shifting right, emit the shifts in reverse order, so that
- solitary negative values come first. */
- for (i = ext_shift_insns[value] - 1; i >= 0; i--)
- gen_fun (code, ext_shift_amounts[value][i], operands[0]);
-}
-
-/* Output RTL for an arithmetic right shift. */
-
-/* ??? Rewrite to use super-optimizer sequences. */
-
-int
-expand_ashiftrt (operands)
- rtx *operands;
-{
- rtx wrk;
- char func[18];
- tree func_name;
- int value;
-
- if (TARGET_SH3)
- {
- if (GET_CODE (operands[2]) != CONST_INT)
- {
- rtx count = copy_to_mode_reg (SImode, operands[2]);
- emit_insn (gen_negsi2 (count, count));
- emit_insn (gen_ashrsi3_d (operands[0], operands[1], count));
- return 1;
- }
- else if (ashiftrt_insns[INTVAL (operands[2])] > 3)
- {
- rtx count = force_reg (SImode, GEN_INT (- INTVAL (operands[2])));
- emit_insn (gen_ashrsi3_d (operands[0], operands[1], count));
- return 1;
- }
- }
- if (GET_CODE (operands[2]) != CONST_INT)
- return 0;
-
- value = INTVAL (operands[2]);
-
- if (value == 31)
- {
- emit_insn (gen_ashrsi2_31 (operands[0], operands[1]));
- return 1;
- }
- else if (value >= 16 && value <= 19)
- {
- wrk = gen_reg_rtx (SImode);
- emit_insn (gen_ashrsi2_16 (wrk, operands[1]));
- value -= 16;
- while (value--)
- gen_ashift (ASHIFTRT, 1, wrk);
- emit_move_insn (operands[0], wrk);
- return 1;
- }
- /* Expand a short sequence inline, longer call a magic routine. */
- else if (value <= 5)
- {
- wrk = gen_reg_rtx (SImode);
- emit_move_insn (wrk, operands[1]);
- while (value--)
- gen_ashift (ASHIFTRT, 1, wrk);
- emit_move_insn (operands[0], wrk);
- return 1;
- }
-
- wrk = gen_reg_rtx (Pmode);
-
- /* Load the value into an arg reg and call a helper. */
- emit_move_insn (gen_rtx (REG, SImode, 4), operands[1]);
- sprintf (func, "__ashiftrt_r4_%d", value);
- func_name = get_identifier (func);
- emit_move_insn (wrk, gen_rtx (SYMBOL_REF, Pmode,
- IDENTIFIER_POINTER (func_name)));
- emit_insn (gen_ashrsi3_n (GEN_INT (value), wrk));
- emit_move_insn (operands[0], gen_rtx (REG, SImode, 4));
- return 1;
-}
-
-/* Try to find a good way to implement the combiner pattern
- [(set (match_operand:SI 0 "register_operand" "r")
- (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n"))) .
- LEFT_RTX is operand 2 in the above pattern, and MASK_RTX is operand 3.
- return 0 for simple right / left or left/right shift combination.
- return 1 for a combination of shifts with zero_extend.
- return 2 for a combination of shifts with an AND that needs r0.
- return 3 for a combination of shifts with an AND that needs an extra
- scratch register, when the three highmost bits of the AND mask are clear.
- return 4 for a combination of shifts with an AND that needs an extra
- scratch register, when any of the three highmost bits of the AND mask
- is set.
- If ATTRP is set, store an initial right shift width in ATTRP[0],
- and the instruction length in ATTRP[1] . These values are not valid
- when returning 0.
- When ATTRP is set and returning 1, ATTRP[2] gets set to the index into
- shift_amounts for the last shift value that is to be used before the
- sign extend. */
-int
-shl_and_kind (left_rtx, mask_rtx, attrp)
- rtx left_rtx, mask_rtx;
- int *attrp;
-{
- unsigned HOST_WIDE_INT mask, lsb, mask2, lsb2;
- int left = INTVAL (left_rtx), right;
- int best = 0;
- int cost, best_cost = 10000;
- int best_right = 0, best_len = 0;
- int i;
- int can_ext;
-
- if (left < 0 || left > 31)
- return 0;
- if (GET_CODE (mask_rtx) == CONST_INT)
- mask = (unsigned HOST_WIDE_INT) INTVAL (mask_rtx) >> left;
- else
- mask = (unsigned HOST_WIDE_INT) GET_MODE_MASK (SImode) >> left;
- /* Can this be expressed as a right shift / left shift pair ? */
- lsb = ((mask ^ (mask - 1)) >> 1) + 1;
- right = exact_log2 (lsb);
- mask2 = ~(mask + lsb - 1);
- lsb2 = ((mask2 ^ (mask2 - 1)) >> 1) + 1;
- /* mask has no zeroes but trailing zeroes <==> ! mask2 */
- if (! mask2)
- best_cost = shift_insns[right] + shift_insns[right + left];
- /* mask has no trailing zeroes <==> ! right */
- else if (! right && mask2 == ~(lsb2 - 1))
- {
- int late_right = exact_log2 (lsb2);
- best_cost = shift_insns[left + late_right] + shift_insns[late_right];
- }
- /* Try to use zero extend */
- if (mask2 == ~(lsb2 - 1))
- {
- int width, first;
-
- for (width = 8; width <= 16; width += 8)
- {
- /* Can we zero-extend right away? */
- if (lsb2 == (HOST_WIDE_INT)1 << width)
- {
- cost
- = 1 + ext_shift_insns[right] + ext_shift_insns[left + right];
- if (cost < best_cost)
- {
- best = 1;
- best_cost = cost;
- best_right = right;
- best_len = cost;
- if (attrp)
- attrp[2] = -1;
- }
- continue;
- }
- /* ??? Could try to put zero extend into initial right shift,
- or even shift a bit left before the right shift. */
- /* Determine value of first part of left shift, to get to the
- zero extend cut-off point. */
- first = width - exact_log2 (lsb2) + right;
- if (first >= 0 && right + left - first >= 0)
- {
- cost = ext_shift_insns[right] + ext_shift_insns[first] + 1
- + ext_shift_insns[right + left - first];
- if (cost < best_cost)
- {
- best = 1;
- best_cost = cost;
- best_right = right;
- best_len = cost;
- if (attrp)
- attrp[2] = first;
- }
- }
- }
- }
- /* Try to use r0 AND pattern */
- for (i = 0; i <= 2; i++)
- {
- if (i > right)
- break;
- if (! CONST_OK_FOR_L (mask >> i))
- continue;
- cost = (i != 0) + 2 + ext_shift_insns[left + i];
- if (cost < best_cost)
- {
- best = 2;
- best_cost = cost;
- best_right = i;
- best_len = cost - 1;
- }
- }
- /* Try to use a scratch register to hold the AND operand. */
- can_ext = ((mask << left) & 0xe0000000) == 0;
- for (i = 0; i <= 2; i++)
- {
- if (i > right)
- break;
- cost = (i != 0) + (CONST_OK_FOR_I (mask >> i) ? 2 : 3)
- + (can_ext ? ext_shift_insns : shift_insns)[left + i];
- if (cost < best_cost)
- {
- best = 4 - can_ext;
- best_cost = cost;
- best_right = i;
- best_len = cost - 1 - ! CONST_OK_FOR_I (mask >> i);
- }
- }
-
- if (attrp)
- {
- attrp[0] = best_right;
- attrp[1] = best_len;
- }
- return best;
-}
-
-/* This is used in length attributes of the unnamed instructions
- corresponding to shl_and_kind return values of 1 and 2. */
-int
-shl_and_length (insn)
- rtx insn;
-{
- rtx set_src, left_rtx, mask_rtx;
- int attributes[3];
-
- set_src = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
- left_rtx = XEXP (XEXP (set_src, 0), 1);
- mask_rtx = XEXP (set_src, 1);
- shl_and_kind (left_rtx, mask_rtx, attributes);
- return attributes[1];
-}
-
-/* This is used in length attribute of the and_shl_scratch instruction. */
-
-int
-shl_and_scr_length (insn)
- rtx insn;
-{
- rtx set_src = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
- int len = shift_insns[INTVAL (XEXP (set_src, 1))];
- rtx op = XEXP (set_src, 0);
- len += shift_insns[INTVAL (XEXP (op, 1))] + 1;
- op = XEXP (XEXP (op, 0), 0);
- return len + shift_insns[INTVAL (XEXP (op, 1))];
-}
-
-/* Generating rtl? */
-extern int rtx_equal_function_value_matters;
-
-/* Generate rtl for instructions for which shl_and_kind advised a particular
- method of generating them, i.e. returned zero. */
-
-int
-gen_shl_and (dest, left_rtx, mask_rtx, source)
- rtx dest, left_rtx, mask_rtx, source;
-{
- int attributes[3];
- unsigned HOST_WIDE_INT mask;
- int kind = shl_and_kind (left_rtx, mask_rtx, attributes);
- int right, total_shift;
- int (*shift_gen_fun) PROTO((int, rtx*)) = gen_shifty_hi_op;
-
- right = attributes[0];
- total_shift = INTVAL (left_rtx) + right;
- mask = (unsigned HOST_WIDE_INT) INTVAL (mask_rtx) >> total_shift;
- switch (kind)
- {
- default:
- return -1;
- case 1:
- {
- int first = attributes[2];
- rtx operands[3];
-
- if (first < 0)
- {
- emit_insn ((mask << right) == 0xff
- ? gen_zero_extendqisi2(dest,
- gen_lowpart (QImode, source))
- : gen_zero_extendhisi2(dest,
- gen_lowpart (HImode, source)));
- source = dest;
- }
- if (source != dest)
- emit_insn (gen_movsi (dest, source));
- operands[0] = dest;
- if (right)
- {
- operands[2] = GEN_INT (right);
- gen_shifty_hi_op (LSHIFTRT, operands);
- }
- if (first > 0)
- {
- operands[2] = GEN_INT (first);
- gen_shifty_hi_op (ASHIFT, operands);
- total_shift -= first;
- mask <<= first;
- }
- if (first >= 0)
- emit_insn (mask == 0xff
- ? gen_zero_extendqisi2(dest, gen_lowpart (QImode, dest))
- : gen_zero_extendhisi2(dest, gen_lowpart (HImode, dest)));
- if (total_shift > 0)
- {
- operands[2] = GEN_INT (total_shift);
- gen_shifty_hi_op (ASHIFT, operands);
- }
- break;
- }
- case 4:
- shift_gen_fun = gen_shifty_op;
- case 2:
- case 3:
- /* If the topmost bit that matters is set, set the topmost bits
- that don't matter. This way, we might be able to get a shorter
- signed constant. */
- if (mask & ((HOST_WIDE_INT)1 << 31 - total_shift))
- mask |= (HOST_WIDE_INT)~0 << (31 - total_shift);
- /* Don't expand fine-grained when combining, because that will
- make the pattern fail. */
- if (rtx_equal_function_value_matters
- || reload_in_progress || reload_completed)
- {
- rtx operands[3];
-
- if (right)
- {
- emit_insn (gen_lshrsi3 (dest, source, GEN_INT (right)));
- source = dest;
- }
- emit_insn (gen_andsi3 (dest, source, GEN_INT (mask)));
- if (total_shift)
- {
- operands[0] = dest;
- operands[1] = dest;
- operands[2] = GEN_INT (total_shift);
- shift_gen_fun (ASHIFT, operands);
- }
- break;
- }
- else
- {
- int neg = 0;
- if (kind != 4 && total_shift < 16)
- {
- neg = -ext_shift_amounts[total_shift][1];
- if (neg > 0)
- neg -= ext_shift_amounts[total_shift][2];
- else
- neg = 0;
- }
- emit_insn (gen_and_shl_scratch (dest, source,
- GEN_INT (right),
- GEN_INT (mask),
- GEN_INT (total_shift + neg),
- GEN_INT (neg)));
- emit_insn (gen_movsi (dest, dest));
- break;
- }
- }
- return 0;
-}
-
-/* Try to find a good way to implement the combiner pattern
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extract:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "const_int_operand" "n")
- (match_operand:SI 3 "const_int_operand" "n")
- (const_int 0)))
- (clobber (reg:SI 18))]
- LEFT_RTX is operand 2 in the above pattern, and SIZE_RTX is operand 3.
- return 0 for simple left / right shift combination.
- return 1 for left shift / 8 bit sign extend / left shift.
- return 2 for left shift / 16 bit sign extend / left shift.
- return 3 for left shift / 8 bit sign extend / shift / sign extend.
- return 4 for left shift / 16 bit sign extend / shift / sign extend.
- return 5 for left shift / 16 bit sign extend / right shift
- return 6 for < 8 bit sign extend / left shift.
- return 7 for < 8 bit sign extend / left shift / single right shift.
- If COSTP is nonzero, assign the calculated cost to *COSTP. */
-
-int
-shl_sext_kind (left_rtx, size_rtx, costp)
- rtx left_rtx, size_rtx;
- int *costp;
-{
- int left, size, insize, ext;
- int cost, best_cost;
- int kind;
-
- left = INTVAL (left_rtx);
- size = INTVAL (size_rtx);
- insize = size - left;
- if (insize <= 0)
- abort ();
- /* Default to left / right shift. */
- kind = 0;
- best_cost = shift_insns[32 - insize] + ashiftrt_insns[32 - size];
- if (size <= 16)
- {
- /* 16 bit shift / sign extend / 16 bit shift */
- cost = shift_insns[16 - insize] + 1 + ashiftrt_insns[16 - size];
- /* If ashiftrt_insns[16 - size] is 8, this choice will be overridden
- below, by alternative 3 or something even better. */
- if (cost < best_cost)
- {
- kind = 5;
- best_cost = cost;
- }
- }
- /* Try a plain sign extend between two shifts. */
- for (ext = 16; ext >= insize; ext -= 8)
- {
- if (ext <= size)
- {
- cost = ext_shift_insns[ext - insize] + 1 + shift_insns[size - ext];
- if (cost < best_cost)
- {
- kind = ext / 8U;
- best_cost = cost;
- }
- }
- /* Check if we can do a sloppy shift with a final signed shift
- restoring the sign. */
- if (EXT_SHIFT_SIGNED (size - ext))
- cost = ext_shift_insns[ext - insize] + ext_shift_insns[size - ext] + 1;
- /* If not, maybe it's still cheaper to do the second shift sloppy,
- and do a final sign extend? */
- else if (size <= 16)
- cost = ext_shift_insns[ext - insize] + 1
- + ext_shift_insns[size > ext ? size - ext : ext - size] + 1;
- else
- continue;
- if (cost < best_cost)
- {
- kind = ext / 8U + 2;
- best_cost = cost;
- }
- }
- /* Check if we can sign extend in r0 */
- if (insize < 8)
- {
- cost = 3 + shift_insns[left];
- if (cost < best_cost)
- {
- kind = 6;
- best_cost = cost;
- }
- /* Try the same with a final signed shift. */
- if (left < 31)
- {
- cost = 3 + ext_shift_insns[left + 1] + 1;
- if (cost < best_cost)
- {
- kind = 7;
- best_cost = cost;
- }
- }
- }
- if (TARGET_SH3)
- {
- /* Try to use a dynamic shift. */
- cost = shift_insns[32 - insize] + 3;
- if (cost < best_cost)
- {
- kind = 0;
- best_cost = cost;
- }
- }
- if (costp)
- *costp = cost;
- return kind;
-}
-
-/* Function to be used in the length attribute of the instructions
- implementing this pattern. */
-
-int
-shl_sext_length (insn)
- rtx insn;
-{
- rtx set_src, left_rtx, size_rtx;
- int cost;
-
- set_src = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
- left_rtx = XEXP (XEXP (set_src, 0), 1);
- size_rtx = XEXP (set_src, 1);
- shl_sext_kind (left_rtx, size_rtx, &cost);
- return cost;
-}
-
-/* Generate rtl for this pattern */
-
-int
-gen_shl_sext (dest, left_rtx, size_rtx, source)
- rtx dest, left_rtx, size_rtx, source;
-{
- int kind;
- int left, size, insize, cost;
- rtx operands[3];
-
- kind = shl_sext_kind (left_rtx, size_rtx, &cost);
- left = INTVAL (left_rtx);
- size = INTVAL (size_rtx);
- insize = size - left;
- switch (kind)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- {
- int ext = kind & 1 ? 8 : 16;
- int shift2 = size - ext;
-
- /* Don't expand fine-grained when combining, because that will
- make the pattern fail. */
- if (! rtx_equal_function_value_matters
- && ! reload_in_progress && ! reload_completed)
- {
- emit_insn (gen_shl_sext_ext (dest, source, left_rtx, size_rtx));
- emit_insn (gen_movsi (dest, source));
- break;
- }
- if (dest != source)
- emit_insn (gen_movsi (dest, source));
- operands[0] = dest;
- if (ext - insize)
- {
- operands[2] = GEN_INT (ext - insize);
- gen_shifty_hi_op (ASHIFT, operands);
- }
- emit_insn (kind & 1
- ? gen_extendqisi2(dest, gen_lowpart (QImode, dest))
- : gen_extendhisi2(dest, gen_lowpart (HImode, dest)));
- if (kind <= 2)
- {
- if (shift2)
- {
- operands[2] = GEN_INT (shift2);
- gen_shifty_op (ASHIFT, operands);
- }
- }
- else
- {
- if (shift2 > 0)
- {
- if (EXT_SHIFT_SIGNED (shift2))
- {
- operands[2] = GEN_INT (shift2 + 1);
- gen_shifty_op (ASHIFT, operands);
- operands[2] = GEN_INT (1);
- gen_shifty_op (ASHIFTRT, operands);
- break;
- }
- operands[2] = GEN_INT (shift2);
- gen_shifty_hi_op (ASHIFT, operands);
- }
- else if (shift2)
- {
- operands[2] = GEN_INT (-shift2);
- gen_shifty_hi_op (LSHIFTRT, operands);
- }
- emit_insn (size <= 8
- ? gen_extendqisi2 (dest, gen_lowpart (QImode, dest))
- : gen_extendhisi2 (dest, gen_lowpart (HImode, dest)));
- }
- break;
- }
- case 5:
- {
- int i = 16 - size;
- emit_insn (gen_shl_sext_ext (dest, source, GEN_INT (16 - insize),
- GEN_INT (16)));
- /* Don't use gen_ashrsi3 because it generates new pseudos. */
- while (--i >= 0)
- gen_ashift (ASHIFTRT, 1, dest);
- break;
- }
- case 6:
- case 7:
- /* Don't expand fine-grained when combining, because that will
- make the pattern fail. */
- if (! rtx_equal_function_value_matters
- && ! reload_in_progress && ! reload_completed)
- {
- emit_insn (gen_shl_sext_ext (dest, source, left_rtx, size_rtx));
- emit_insn (gen_movsi (dest, source));
- break;
- }
- emit_insn (gen_andsi3 (dest, source, GEN_INT ((1 << insize) - 1)));
- emit_insn (gen_xorsi3 (dest, dest, GEN_INT (1 << (insize - 1))));
- emit_insn (gen_addsi3 (dest, dest, GEN_INT (-1 << (insize - 1))));
- operands[0] = dest;
- operands[2] = kind == 7 ? GEN_INT (left + 1) : left_rtx;
- gen_shifty_op (ASHIFT, operands);
- if (kind == 7)
- emit_insn (gen_ashrsi3_k (dest, dest, GEN_INT (1)));
- break;
- default:
- return -1;
- }
- return 0;
-}
-
-/* The SH cannot load a large constant into a register, constants have to
- come from a pc relative load. The reference of a pc relative load
- instruction must be less than 1k infront of the instruction. This
- means that we often have to dump a constant inside a function, and
- generate code to branch around it.
-
- It is important to minimize this, since the branches will slow things
- down and make things bigger.
-
- Worst case code looks like:
-
- mov.l L1,rn
- bra L2
- nop
- align
- L1: .long value
- L2:
- ..
-
- mov.l L3,rn
- bra L4
- nop
- align
- L3: .long value
- L4:
- ..
-
- We fix this by performing a scan before scheduling, which notices which
- instructions need to have their operands fetched from the constant table
- and builds the table.
-
- The algorithm is:
-
- scan, find an instruction which needs a pcrel move. Look forward, find the
- last barrier which is within MAX_COUNT bytes of the requirement.
- If there isn't one, make one. Process all the instructions between
- the find and the barrier.
-
- In the above example, we can tell that L3 is within 1k of L1, so
- the first move can be shrunk from the 3 insn+constant sequence into
- just 1 insn, and the constant moved to L3 to make:
-
- mov.l L1,rn
- ..
- mov.l L3,rn
- bra L4
- nop
- align
- L3:.long value
- L4:.long value
-
- Then the second move becomes the target for the shortening process. */
-
-typedef struct
-{
- rtx value; /* Value in table. */
- rtx label; /* Label of value. */
- enum machine_mode mode; /* Mode of value. */
-} pool_node;
-
-/* The maximum number of constants that can fit into one pool, since
- the pc relative range is 0...1020 bytes and constants are at least 4
- bytes long. */
-
-#define MAX_POOL_SIZE (1020/4)
-static pool_node pool_vector[MAX_POOL_SIZE];
-static int pool_size;
-
-/* ??? If we need a constant in HImode which is the truncated value of a
- constant we need in SImode, we could combine the two entries thus saving
- two bytes. Is this common enough to be worth the effort of implementing
- it? */
-
-/* ??? This stuff should be done at the same time that we shorten branches.
- As it is now, we must assume that all branches are the maximum size, and
- this causes us to almost always output constant pools sooner than
- necessary. */
-
-/* Add a constant to the pool and return its label. */
-
-static rtx
-add_constant (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- int i;
- rtx lab;
-
- /* First see if we've already got it. */
- for (i = 0; i < pool_size; i++)
- {
- if (x->code == pool_vector[i].value->code
- && mode == pool_vector[i].mode)
- {
- if (x->code == CODE_LABEL)
- {
- if (XINT (x, 3) != XINT (pool_vector[i].value, 3))
- continue;
- }
- if (rtx_equal_p (x, pool_vector[i].value))
- return pool_vector[i].label;
- }
- }
-
- /* Need a new one. */
- pool_vector[pool_size].value = x;
- lab = gen_label_rtx ();
- pool_vector[pool_size].mode = mode;
- pool_vector[pool_size].label = lab;
- pool_size++;
- return lab;
-}
-
-/* Output the literal table. */
-
-static void
-dump_table (scan)
- rtx scan;
-{
- int i;
- int need_align = 1;
-
- /* Do two passes, first time dump out the HI sized constants. */
-
- for (i = 0; i < pool_size; i++)
- {
- pool_node *p = &pool_vector[i];
-
- if (p->mode == HImode)
- {
- if (need_align)
- {
- scan = emit_insn_after (gen_align_2 (), scan);
- need_align = 0;
- }
- scan = emit_label_after (p->label, scan);
- scan = emit_insn_after (gen_consttable_2 (p->value), scan);
- }
- }
-
- need_align = 1;
-
- for (i = 0; i < pool_size; i++)
- {
- pool_node *p = &pool_vector[i];
-
- switch (p->mode)
- {
- case HImode:
- break;
- case SImode:
- case SFmode:
- if (need_align)
- {
- need_align = 0;
- scan = emit_label_after (gen_label_rtx (), scan);
- scan = emit_insn_after (gen_align_4 (), scan);
- }
- scan = emit_label_after (p->label, scan);
- scan = emit_insn_after (gen_consttable_4 (p->value), scan);
- break;
- case DFmode:
- case DImode:
- if (need_align)
- {
- need_align = 0;
- scan = emit_label_after (gen_label_rtx (), scan);
- scan = emit_insn_after (gen_align_4 (), scan);
- }
- scan = emit_label_after (p->label, scan);
- scan = emit_insn_after (gen_consttable_8 (p->value), scan);
- break;
- default:
- abort ();
- break;
- }
- }
-
- scan = emit_insn_after (gen_consttable_end (), scan);
- scan = emit_barrier_after (scan);
- pool_size = 0;
-}
-
-/* Return non-zero if constant would be an ok source for a
- mov.w instead of a mov.l. */
-
-static int
-hi_const (src)
- rtx src;
-{
- return (GET_CODE (src) == CONST_INT
- && INTVAL (src) >= -32768
- && INTVAL (src) <= 32767);
-}
-
-/* Non-zero if the insn is a move instruction which needs to be fixed. */
-
-/* ??? For a DImode/DFmode moves, we don't need to fix it if each half of the
- CONST_DOUBLE input value is CONST_OK_FOR_I. For a SFmode move, we don't
- need to fix it if the input value is CONST_OK_FOR_I. */
-
-static int
-broken_move (insn)
- rtx insn;
-{
- if (GET_CODE (insn) == INSN)
- {
- rtx pat = PATTERN (insn);
- if (GET_CODE (pat) == PARALLEL)
- pat = XVECEXP (pat, 0, 0);
- if (GET_CODE (pat) == SET
- /* We can load any 8 bit value if we don't care what the high
- order bits end up as. */
- && GET_MODE (SET_DEST (pat)) != QImode
- && CONSTANT_P (SET_SRC (pat))
- && ! (GET_CODE (SET_SRC (pat)) == CONST_DOUBLE
- && (fp_zero_operand (SET_SRC (pat))
- || fp_one_operand (SET_SRC (pat)))
- && GET_CODE (SET_DEST (pat)) == REG
- && REGNO (SET_DEST (pat)) >= FIRST_FP_REG
- && REGNO (SET_DEST (pat)) <= LAST_FP_REG)
- && (GET_CODE (SET_SRC (pat)) != CONST_INT
- || ! CONST_OK_FOR_I (INTVAL (SET_SRC (pat)))))
- return 1;
- }
-
- return 0;
-}
-
-/* Find the last barrier from insn FROM which is close enough to hold the
- constant pool. If we can't find one, then create one near the end of
- the range. */
-
-/* ??? It would be good to put constant pool tables between a case jump and
- the jump table. This fails for two reasons. First, there is no
- barrier after the case jump. This is a bug in the casesi pattern.
- Second, inserting the table here may break the mova instruction that
- loads the jump table address, by moving the jump table too far away.
- We fix that problem by never outputting the constant pool between a mova
- and its label. */
-
-static rtx
-find_barrier (from)
- rtx from;
-{
- int count_si = 0;
- int count_hi = 0;
- int found_hi = 0;
- int found_si = 0;
- rtx found_barrier = 0;
- rtx found_mova = 0;
- int si_limit;
- int hi_limit;
-
- /* For HImode: range is 510, add 4 because pc counts from address of
- second instruction after this one, subtract 2 for the jump instruction
- that we may need to emit before the table, subtract 2 for the instruction
- that fills the jump delay slot (in very rare cases, reorg will take an
- instruction from after the constant pool or will leave the delay slot
- empty). This gives 510.
- For SImode: range is 1020, add 4 because pc counts from address of
- second instruction after this one, subtract 2 in case pc is 2 byte
- aligned, subtract 2 for the jump instruction that we may need to emit
- before the table, subtract 2 for the instruction that fills the jump
- delay slot. This gives 1018. */
-
- /* If not optimizing, then it is possible that the jump instruction we add
- won't be shortened, and thus will have a length of 14 instead of 2.
- We must adjust the limits downwards to account for this, giving a limit
- of 1008 for SImode and 500 for HImode. */
-
- if (optimize)
- {
- si_limit = 1018;
- hi_limit = 510;
- }
- else
- {
- si_limit = 1008;
- hi_limit = 500;
- }
-
- /* If not optimizing for space, then the constant pool will be
- aligned to a 4 to 16 byte boundary. We must make room for that
- alignment that by reducing the limits.
- ??? It would be better to not align the constant pool, but
- ASM_OUTPUT_ALIGN_CODE does not make any provision for basing the
- alignment on the instruction. */
-
- if (! TARGET_SMALLCODE)
- {
- if (TARGET_SH3 || TARGET_SH3E)
- {
- si_limit -= 14;
- hi_limit -= 14;
- }
- else
- {
- si_limit -= 2;
- hi_limit -= 2;
- }
- }
-
- while (from && count_si < si_limit && count_hi < hi_limit)
- {
- int inc = get_attr_length (from);
-
- if (GET_CODE (from) == BARRIER)
- found_barrier = from;
-
- if (broken_move (from))
- {
- rtx pat = PATTERN (from);
- rtx src = SET_SRC (pat);
- rtx dst = SET_DEST (pat);
- enum machine_mode mode = GET_MODE (dst);
-
- /* We must explicitly check the mode, because sometimes the
- front end will generate code to load unsigned constants into
- HImode targets without properly sign extending them. */
- if (mode == HImode || (mode == SImode && hi_const (src)))
- {
- found_hi = 1;
- /* We put the short constants before the long constants, so
- we must count the length of short constants in the range
- for the long constants. */
- /* ??? This isn't optimal, but is easy to do. */
- if (found_si)
- count_si += 2;
- }
- else
- found_si = 1;
- }
-
- if (GET_CODE (from) == INSN
- && GET_CODE (PATTERN (from)) == SET
- && GET_CODE (SET_SRC (PATTERN (from))) == UNSPEC
- && XINT (SET_SRC (PATTERN (from)), 1) == 1)
- found_mova = from;
- else if (GET_CODE (from) == JUMP_INSN
- && (GET_CODE (PATTERN (from)) == ADDR_VEC
- || GET_CODE (PATTERN (from)) == ADDR_DIFF_VEC))
- found_mova = 0;
-
- if (found_si)
- count_si += inc;
- if (found_hi)
- count_hi += inc;
- from = NEXT_INSN (from);
- }
-
- /* Insert the constant pool table before the mova instruction, to prevent
- the mova label reference from going out of range. */
- if (found_mova)
- from = found_mova;
-
- if (! found_barrier)
- {
- /* We didn't find a barrier in time to dump our stuff,
- so we'll make one. */
- rtx label = gen_label_rtx ();
-
- /* If we exceeded the range, then we must back up over the last
- instruction we looked at. Otherwise, we just need to undo the
- NEXT_INSN at the end of the loop. */
- if (count_hi > hi_limit || count_si > si_limit)
- from = PREV_INSN (PREV_INSN (from));
- else
- from = PREV_INSN (from);
-
- /* Walk back to be just before any jump or label.
- Putting it before a label reduces the number of times the branch
- around the constant pool table will be hit. Putting it before
- a jump makes it more likely that the bra delay slot will be
- filled. */
- while (GET_CODE (from) == JUMP_INSN || GET_CODE (from) == NOTE
- || GET_CODE (from) == CODE_LABEL)
- from = PREV_INSN (from);
-
- from = emit_jump_insn_after (gen_jump (label), from);
- JUMP_LABEL (from) = label;
- LABEL_NUSES (label) = 1;
- found_barrier = emit_barrier_after (from);
- emit_label_after (label, found_barrier);
- }
-
- return found_barrier;
-}
-
-/* If the instruction INSN is implemented by a special function, and we can
- positively find the register that is used to call the sfunc, and this
- register is not used anywhere else in this instruction - except as the
- destination of a set, return this register; else, return 0. */
-static rtx
-sfunc_uses_reg (insn)
- rtx insn;
-{
- int i;
- rtx pattern, part, reg_part, reg;
-
- if (GET_CODE (insn) != INSN)
- return 0;
- pattern = PATTERN (insn);
- if (GET_CODE (pattern) != PARALLEL || get_attr_type (insn) != TYPE_SFUNC)
- return 0;
-
- for (reg_part = 0, i = XVECLEN (pattern, 0) - 1; i >= 1; i--)
- {
- part = XVECEXP (pattern, 0, i);
- if (GET_CODE (part) == USE)
- reg_part = part;
- }
- if (! reg_part)
- return 0;
- reg = XEXP (reg_part, 0);
- for (i = XVECLEN (pattern, 0) - 1; i >= 0; i--)
- {
- part = XVECEXP (pattern, 0, i);
- if (part == reg_part)
- continue;
- if (reg_mentioned_p (reg, ((GET_CODE (part) == SET
- && GET_CODE (SET_DEST (part)) == REG)
- ? SET_SRC (part) : part)))
- return 0;
- }
- return reg;
-}
-
-/* See if the only way in which INSN uses REG is by calling it, or by
- setting it while calling it. Set *SET to a SET rtx if the register
- is set by INSN. */
-
-static int
-noncall_uses_reg (reg, insn, set)
- rtx reg;
- rtx insn;
- rtx *set;
-{
- rtx pattern, reg2;
-
- *set = NULL_RTX;
-
- reg2 = sfunc_uses_reg (insn);
- if (reg2 && REGNO (reg2) == REGNO (reg))
- {
- pattern = single_set (insn);
- if (pattern
- && GET_CODE (SET_DEST (pattern)) == REG
- && REGNO (reg) == REGNO (SET_DEST (pattern)))
- *set = pattern;
- return 0;
- }
- if (GET_CODE (insn) != CALL_INSN)
- {
- /* We don't use rtx_equal_p because we don't care if the mode is
- different. */
- pattern = single_set (insn);
- if (pattern
- && GET_CODE (SET_DEST (pattern)) == REG
- && REGNO (reg) == REGNO (SET_DEST (pattern)))
- {
- rtx par, part;
- int i;
-
- *set = pattern;
- par = PATTERN (insn);
- if (GET_CODE (par) == PARALLEL)
- for (i = XVECLEN (par, 0) - 1; i >= 0; i--)
- {
- part = XVECEXP (par, 0, i);
- if (GET_CODE (part) != SET && reg_mentioned_p (reg, part))
- return 1;
- }
- return reg_mentioned_p (reg, SET_SRC (pattern));
- }
-
- return 1;
- }
-
- pattern = PATTERN (insn);
-
- if (GET_CODE (pattern) == PARALLEL)
- {
- int i;
-
- for (i = XVECLEN (pattern, 0) - 1; i >= 1; i--)
- if (reg_mentioned_p (reg, XVECEXP (pattern, 0, i)))
- return 1;
- pattern = XVECEXP (pattern, 0, 0);
- }
-
- if (GET_CODE (pattern) == SET)
- {
- if (reg_mentioned_p (reg, SET_DEST (pattern)))
- {
- /* We don't use rtx_equal_p, because we don't care if the
- mode is different. */
- if (GET_CODE (SET_DEST (pattern)) != REG
- || REGNO (reg) != REGNO (SET_DEST (pattern)))
- return 1;
-
- *set = pattern;
- }
-
- pattern = SET_SRC (pattern);
- }
-
- if (GET_CODE (pattern) != CALL
- || GET_CODE (XEXP (pattern, 0)) != MEM
- || ! rtx_equal_p (reg, XEXP (XEXP (pattern, 0), 0)))
- return 1;
-
- return 0;
-}
-
-/* Exported to toplev.c.
-
- Do a final pass over the function, just before delayed branch
- scheduling. */
-
-void
-machine_dependent_reorg (first)
- rtx first;
-{
- rtx insn;
-
- /* If relaxing, generate pseudo-ops to associate function calls with
- the symbols they call. It does no harm to not generate these
- pseudo-ops. However, when we can generate them, it enables to
- linker to potentially relax the jsr to a bsr, and eliminate the
- register load and, possibly, the constant pool entry. */
-
- if (TARGET_RELAX)
- {
- /* Remove all REG_LABEL notes. We want to use them for our own
- purposes. This works because none of the remaining passes
- need to look at them.
-
- ??? But it may break in the future. We should use a machine
- dependent REG_NOTE, or some other approach entirely. */
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- rtx note;
-
- while ((note = find_reg_note (insn, REG_LABEL, NULL_RTX)) != 0)
- remove_note (insn, note);
- }
- }
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- rtx pattern, reg, link, set, scan, dies, label;
- int rescan = 0, foundinsn = 0;
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- pattern = PATTERN (insn);
-
- if (GET_CODE (pattern) == PARALLEL)
- pattern = XVECEXP (pattern, 0, 0);
- if (GET_CODE (pattern) == SET)
- pattern = SET_SRC (pattern);
-
- if (GET_CODE (pattern) != CALL
- || GET_CODE (XEXP (pattern, 0)) != MEM)
- continue;
-
- reg = XEXP (XEXP (pattern, 0), 0);
- }
- else
- {
- reg = sfunc_uses_reg (insn);
- if (! reg)
- continue;
- }
-
- if (GET_CODE (reg) != REG)
- continue;
-
- /* This is a function call via REG. If the only uses of REG
- between the time that it is set and the time that it dies
- are in function calls, then we can associate all the
- function calls with the setting of REG. */
-
- for (link = LOG_LINKS (insn); link; link = XEXP (link, 1))
- {
- if (REG_NOTE_KIND (link) != 0)
- continue;
- set = single_set (XEXP (link, 0));
- if (set && rtx_equal_p (reg, SET_DEST (set)))
- {
- link = XEXP (link, 0);
- break;
- }
- }
-
- if (! link)
- {
- /* ??? Sometimes global register allocation will have
- deleted the insn pointed to by LOG_LINKS. Try
- scanning backward to find where the register is set. */
- for (scan = PREV_INSN (insn);
- scan && GET_CODE (scan) != CODE_LABEL;
- scan = PREV_INSN (scan))
- {
- if (GET_RTX_CLASS (GET_CODE (scan)) != 'i')
- continue;
-
- if (! reg_mentioned_p (reg, scan))
- continue;
-
- if (noncall_uses_reg (reg, scan, &set))
- break;
-
- if (set)
- {
- link = scan;
- break;
- }
- }
- }
-
- if (! link)
- continue;
-
- /* The register is set at LINK. */
-
- /* We can only optimize the function call if the register is
- being set to a symbol. In theory, we could sometimes
- optimize calls to a constant location, but the assembler
- and linker do not support that at present. */
- if (GET_CODE (SET_SRC (set)) != SYMBOL_REF
- && GET_CODE (SET_SRC (set)) != LABEL_REF)
- continue;
-
- /* Scan forward from LINK to the place where REG dies, and
- make sure that the only insns which use REG are
- themselves function calls. */
-
- /* ??? This doesn't work for call targets that were allocated
- by reload, since there may not be a REG_DEAD note for the
- register. */
-
- dies = NULL_RTX;
- for (scan = NEXT_INSN (link); scan; scan = NEXT_INSN (scan))
- {
- rtx scanset;
-
- /* Don't try to trace forward past a CODE_LABEL if we haven't
- seen INSN yet. Ordinarily, we will only find the setting insn
- in LOG_LINKS if it is in the same basic block. However,
- cross-jumping can insert code labels in between the load and
- the call, and can result in situations where a single call
- insn may have two targets depending on where we came from. */
-
- if (GET_CODE (scan) == CODE_LABEL && ! foundinsn)
- break;
-
- if (GET_RTX_CLASS (GET_CODE (scan)) != 'i')
- continue;
-
- /* Don't try to trace forward past a JUMP. To optimize
- safely, we would have to check that all the
- instructions at the jump destination did not use REG. */
-
- if (GET_CODE (scan) == JUMP_INSN)
- break;
-
- if (! reg_mentioned_p (reg, scan))
- continue;
-
- if (noncall_uses_reg (reg, scan, &scanset))
- break;
-
- if (scan == insn)
- foundinsn = 1;
-
- if (scan != insn
- && (GET_CODE (scan) == CALL_INSN || sfunc_uses_reg (scan)))
- {
- /* There is a function call to this register other
- than the one we are checking. If we optimize
- this call, we need to rescan again below. */
- rescan = 1;
- }
-
- /* ??? We shouldn't have to worry about SCANSET here.
- We should just be able to check for a REG_DEAD note
- on a function call. However, the REG_DEAD notes are
- apparently not dependable around libcalls; c-torture
- execute/920501-2 is a test case. If SCANSET is set,
- then this insn sets the register, so it must have
- died earlier. Unfortunately, this will only handle
- the cases in which the register is, in fact, set in a
- later insn. */
-
- /* ??? We shouldn't have to use FOUNDINSN here.
- However, the LOG_LINKS fields are apparently not
- entirely reliable around libcalls;
- newlib/libm/math/e_pow.c is a test case. Sometimes
- an insn will appear in LOG_LINKS even though it is
- not the most recent insn which sets the register. */
-
- if (foundinsn
- && (scanset
- || find_reg_note (scan, REG_DEAD, reg)))
- {
- dies = scan;
- break;
- }
- }
-
- if (! dies)
- {
- /* Either there was a branch, or some insn used REG
- other than as a function call address. */
- continue;
- }
-
- /* Create a code label, and put it in a REG_LABEL note on
- the insn which sets the register, and on each call insn
- which uses the register. In final_prescan_insn we look
- for the REG_LABEL notes, and output the appropriate label
- or pseudo-op. */
-
- label = gen_label_rtx ();
- REG_NOTES (link) = gen_rtx (EXPR_LIST, REG_LABEL, label,
- REG_NOTES (link));
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_LABEL, label,
- REG_NOTES (insn));
- if (rescan)
- {
- scan = link;
- do
- {
- rtx reg2;
-
- scan = NEXT_INSN (scan);
- if (scan != insn
- && ((GET_CODE (scan) == CALL_INSN
- && reg_mentioned_p (reg, scan))
- || ((reg2 = sfunc_uses_reg (scan))
- && REGNO (reg2) == REGNO (reg))))
- REG_NOTES (scan) = gen_rtx (EXPR_LIST, REG_LABEL,
- label, REG_NOTES (scan));
- }
- while (scan != dies);
- }
- }
- }
-
- /* Scan the function looking for move instructions which have to be
- changed to pc-relative loads and insert the literal tables. */
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- if (broken_move (insn))
- {
- rtx scan;
- /* Scan ahead looking for a barrier to stick the constant table
- behind. */
- rtx barrier = find_barrier (insn);
-
- /* Now find all the moves between the points and modify them. */
- for (scan = insn; scan != barrier; scan = NEXT_INSN (scan))
- {
- if (broken_move (scan))
- {
- rtx *patp = &PATTERN (scan), pat = *patp;
- rtx src, dst;
- rtx lab;
- rtx newinsn;
- rtx newsrc;
- enum machine_mode mode;
-
- if (GET_CODE (pat) == PARALLEL)
- patp = &XVECEXP (pat, 0, 0), pat = *patp;
- src = SET_SRC (pat);
- dst = SET_DEST (pat);
- mode = GET_MODE (dst);
-
- if (mode == SImode && hi_const (src))
- {
- int offset = 0;
-
- mode = HImode;
- while (GET_CODE (dst) == SUBREG)
- {
- offset += SUBREG_WORD (dst);
- dst = SUBREG_REG (dst);
- }
- dst = gen_rtx (REG, HImode, REGNO (dst) + offset);
- }
-
- lab = add_constant (src, mode);
- newsrc = gen_rtx (MEM, mode,
- gen_rtx (LABEL_REF, VOIDmode, lab));
- RTX_UNCHANGING_P (newsrc) = 1;
- *patp = gen_rtx (SET, VOIDmode, dst, newsrc);
- INSN_CODE (scan) = -1;
- }
- }
- dump_table (barrier);
- }
- }
-}
-
-/* Dump out instruction addresses, which is useful for debugging the
- constant pool table stuff.
-
- If relaxing, output the label and pseudo-ops used to link together
- calls and the instruction which set the registers. */
-
-/* ??? This is unnecessary, and probably should be deleted. This makes
- the insn_addresses declaration above unnecessary. */
-
-/* ??? The addresses printed by this routine for insns are nonsense for
- insns which are inside of a sequence where none of the inner insns have
- variable length. This is because the second pass of shorten_branches
- does not bother to update them. */
-
-void
-final_prescan_insn (insn, opvec, noperands)
- rtx insn;
- rtx *opvec;
- int noperands;
-{
- if (TARGET_DUMPISIZE)
- fprintf (asm_out_file, "\n! at %04x\n", insn_addresses[INSN_UID (insn)]);
-
- if (TARGET_RELAX)
- {
- rtx note;
-
- note = find_reg_note (insn, REG_LABEL, NULL_RTX);
- if (note)
- {
- rtx pattern;
-
- pattern = PATTERN (insn);
- if (GET_CODE (pattern) == PARALLEL)
- pattern = XVECEXP (pattern, 0, 0);
- if (GET_CODE (pattern) == CALL
- || (GET_CODE (pattern) == SET
- && (GET_CODE (SET_SRC (pattern)) == CALL
- || get_attr_type (insn) == TYPE_SFUNC)))
- fprintf (asm_out_file, "\t.uses L%d\n",
- CODE_LABEL_NUMBER (XEXP (note, 0)));
- else if (GET_CODE (pattern) == SET)
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (XEXP (note, 0)));
- else
- abort ();
- }
- }
-}
-
-/* Dump out any constants accumulated in the final pass. These will
- will only be labels. */
-
-char *
-output_jump_label_table ()
-{
- int i;
-
- if (pool_size)
- {
- fprintf (asm_out_file, "\t.align 2\n");
- for (i = 0; i < pool_size; i++)
- {
- pool_node *p = &pool_vector[i];
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
- CODE_LABEL_NUMBER (p->label));
- output_asm_insn (".long %O0", &p->value);
- }
- pool_size = 0;
- }
-
- return "";
-}
-
-/* A full frame looks like:
-
- arg-5
- arg-4
- [ if current_function_anonymous_args
- arg-3
- arg-2
- arg-1
- arg-0 ]
- saved-fp
- saved-r10
- saved-r11
- saved-r12
- saved-pr
- local-n
- ..
- local-1
- local-0 <- fp points here. */
-
-/* Number of bytes pushed for anonymous args, used to pass information
- between expand_prologue and expand_epilogue. */
-
-static int extra_push;
-
-/* Adjust the stack by SIZE bytes. REG holds the rtl of the register
- to be adjusted, and TEMP, if nonnegative, holds the register number
- of a general register that we may clobber. */
-
-static void
-output_stack_adjust (size, reg, temp)
- int size;
- rtx reg;
- int temp;
-{
- if (size)
- {
- if (CONST_OK_FOR_I (size))
- emit_insn (gen_addsi3 (reg, reg, GEN_INT (size)));
- /* Try to do it with two partial adjustments; however, we must make
- sure that the stack is properly aligned at all times, in case
- an interrupt occurs between the two partial adjustments. */
- else if (CONST_OK_FOR_I (size / 2 & -4)
- && CONST_OK_FOR_I (size - (size / 2 & -4)))
- {
- emit_insn (gen_addsi3 (reg, reg, GEN_INT (size / 2 & -4)));
- emit_insn (gen_addsi3 (reg, reg, GEN_INT (size - (size / 2 & -4))));
- }
- else
- {
- rtx const_reg;
-
- /* If TEMP is invalid, we could temporarily save a general
- register to MACL. However, there is currently no need
- to handle this case, so just abort when we see it. */
- if (temp < 0)
- abort ();
- const_reg = gen_rtx (REG, SImode, temp);
-
- /* If SIZE is negative, subtract the positive value.
- This sometimes allows a constant pool entry to be shared
- between prologue and epilogue code. */
- if (size < 0)
- {
- emit_insn (gen_movsi (const_reg, GEN_INT (-size)));
- emit_insn (gen_subsi3 (reg, reg, const_reg));
- }
- else
- {
- emit_insn (gen_movsi (const_reg, GEN_INT (size)));
- emit_insn (gen_addsi3 (reg, reg, const_reg));
- }
- }
- }
-}
-
-/* Output RTL to push register RN onto the stack. */
-
-static void
-push (rn)
- int rn;
-{
- rtx x;
- if ((rn >= FIRST_FP_REG && rn <= LAST_FP_REG)
- || rn == FPUL_REG)
- x = emit_insn (gen_push_e (gen_rtx (REG, SFmode, rn)));
- else
- x = emit_insn (gen_push (gen_rtx (REG, SImode, rn)));
-
- REG_NOTES (x) = gen_rtx (EXPR_LIST, REG_INC,
- gen_rtx(REG, SImode, STACK_POINTER_REGNUM), 0);
-}
-
-/* Output RTL to pop register RN from the stack. */
-
-static void
-pop (rn)
- int rn;
-{
- rtx x;
- if ((rn >= FIRST_FP_REG && rn <= LAST_FP_REG)
- || rn == FPUL_REG)
- x = emit_insn (gen_pop_e (gen_rtx (REG, SFmode, rn)));
- else
- x = emit_insn (gen_pop (gen_rtx (REG, SImode, rn)));
-
- REG_NOTES (x) = gen_rtx (EXPR_LIST, REG_INC,
- gen_rtx(REG, SImode, STACK_POINTER_REGNUM), 0);
-}
-
-/* Generate code to push the regs specified in the mask, and return
- the number of bytes the insns take. */
-
-static void
-push_regs (mask, mask2)
- int mask, mask2;
-{
- int i;
-
- for (i = 0; i < 32; i++)
- if (mask & (1 << i))
- push (i);
- for (i = 32; i < FIRST_PSEUDO_REGISTER; i++)
- if (mask2 & (1 << (i - 32)))
- push (i);
-}
-
-/* Work out the registers which need to be saved, both as a mask and a
- count.
-
- If doing a pragma interrupt function, then push all regs used by the
- function, and if we call another function (we can tell by looking at PR),
- make sure that all the regs it clobbers are safe too. */
-
-static int
-calc_live_regs (count_ptr, live_regs_mask2)
- int *count_ptr;
- int *live_regs_mask2;
-{
- int reg;
- int live_regs_mask = 0;
- int count = 0;
-
- *live_regs_mask2 = 0;
- for (reg = 0; reg < FIRST_PSEUDO_REGISTER; reg++)
- {
- if (pragma_interrupt && ! pragma_trapa)
- {
- /* Need to save all the regs ever live. */
- if ((regs_ever_live[reg]
- || (call_used_regs[reg]
- && (! fixed_regs[reg] || reg == MACH_REG || reg == MACL_REG)
- && regs_ever_live[PR_REG]))
- && reg != STACK_POINTER_REGNUM && reg != ARG_POINTER_REGNUM
- && reg != RETURN_ADDRESS_POINTER_REGNUM
- && reg != T_REG && reg != GBR_REG)
- {
- if (reg >= 32)
- *live_regs_mask2 |= 1 << (reg - 32);
- else
- live_regs_mask |= 1 << reg;
- count++;
- }
- }
- else
- {
- /* Only push those regs which are used and need to be saved. */
- if (regs_ever_live[reg] && ! call_used_regs[reg])
- {
- if (reg >= 32)
- *live_regs_mask2 |= 1 << (reg - 32);
- else
- live_regs_mask |= (1 << reg);
- count++;
- }
- }
- }
-
- *count_ptr = count;
- return live_regs_mask;
-}
-
-/* Code to generate prologue and epilogue sequences */
-
-void
-sh_expand_prologue ()
-{
- int live_regs_mask;
- int d, i;
- int live_regs_mask2;
- live_regs_mask = calc_live_regs (&d, &live_regs_mask2);
-
- /* We have pretend args if we had an object sent partially in registers
- and partially on the stack, e.g. a large structure. */
- output_stack_adjust (-current_function_pretend_args_size,
- stack_pointer_rtx, 3);
-
- extra_push = 0;
-
- /* This is set by SETUP_VARARGS to indicate that this is a varargs
- routine. Clear it here so that the next function isn't affected. */
- if (current_function_anonymous_args)
- {
- current_function_anonymous_args = 0;
-
- /* This is not used by the SH3E calling convention */
- if (!TARGET_SH3E)
- {
- /* Push arg regs as if they'd been provided by caller in stack. */
- for (i = 0; i < NPARM_REGS(SImode); i++)
- {
- int rn = NPARM_REGS(SImode) + FIRST_PARM_REG - i - 1;
- if (i > (NPARM_REGS(SImode)
- - current_function_args_info.arg_count[(int) SH_ARG_INT]
- - current_function_varargs))
- break;
- push (rn);
- extra_push += 4;
- }
- }
- }
-
- push_regs (live_regs_mask, live_regs_mask2);
-
- output_stack_adjust (-get_frame_size (), stack_pointer_rtx, 3);
-
- if (frame_pointer_needed)
- emit_insn (gen_movsi (frame_pointer_rtx, stack_pointer_rtx));
-}
-
-void
-sh_expand_epilogue ()
-{
- int live_regs_mask;
- int d, i;
-
- int live_regs_mask2;
- live_regs_mask = calc_live_regs (&d, &live_regs_mask2);
-
- if (frame_pointer_needed)
- {
- /* We deliberately make the add dependent on the frame_pointer,
- to ensure that instruction scheduling won't move the stack pointer
- adjust before instructions reading from the frame. This can fail
- if there is an interrupt which then writes to the stack. */
- output_stack_adjust (get_frame_size (), frame_pointer_rtx, 7);
- emit_insn (gen_movsi (stack_pointer_rtx, frame_pointer_rtx));
- }
- else
- output_stack_adjust (get_frame_size (), stack_pointer_rtx, 7);
-
- /* Pop all the registers. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- int j = (FIRST_PSEUDO_REGISTER - 1) - i;
- if (j < 32 && (live_regs_mask & (1 << j)))
- pop (j);
- else if (j >= 32 && (live_regs_mask2 & (1 << (j - 32))))
- pop (j);
- }
-
- output_stack_adjust (extra_push + current_function_pretend_args_size,
- stack_pointer_rtx, 7);
-}
-
-/* Clear variables at function end. */
-
-void
-function_epilogue (stream, size)
- FILE *stream;
- int size;
-{
- pragma_interrupt = pragma_trapa = pragma_nosave_low_regs = 0;
-}
-
-rtx
-sh_builtin_saveregs (arglist)
- tree arglist;
-{
- tree fntype = TREE_TYPE (current_function_decl);
- /* First unnamed integer register. */
- int first_intreg = current_function_args_info.arg_count[(int) SH_ARG_INT];
- /* Number of integer registers we need to save. */
- int n_intregs = MAX (0, NPARM_REGS (SImode) - first_intreg);
- /* First unnamed SFmode float reg */
- int first_floatreg = current_function_args_info.arg_count[(int) SH_ARG_FLOAT];
- /* Number of SFmode float regs to save. */
- int n_floatregs = MAX (0, NPARM_REGS (SFmode) - first_floatreg);
- int ptrsize = GET_MODE_SIZE (Pmode);
- rtx valist, regbuf, fpregs;
- int bufsize, regno;
-
- /* Allocate block of memory for the regs. */
- /* ??? If n_intregs + n_floatregs == 0, should we allocate at least 1 byte?
- Or can assign_stack_local accept a 0 SIZE argument? */
- bufsize = (n_intregs * UNITS_PER_WORD) + (n_floatregs * UNITS_PER_WORD);
-
- regbuf = assign_stack_local (BLKmode, bufsize, 0);
- MEM_IN_STRUCT_P (regbuf) = 1;
-
- /* Save int args.
- This is optimized to only save the regs that are necessary. Explicitly
- named args need not be saved. */
- if (n_intregs > 0)
- move_block_from_reg (BASE_ARG_REG (SImode) + first_intreg,
- gen_rtx (MEM, BLKmode,
- plus_constant (XEXP (regbuf, 0),
- n_floatregs * UNITS_PER_WORD)),
- n_intregs, n_intregs * UNITS_PER_WORD);
-
- /* Save float args.
- This is optimized to only save the regs that are necessary. Explicitly
- named args need not be saved.
- We explicitly build a pointer to the buffer because it halves the insn
- count when not optimizing (otherwise the pointer is built for each reg
- saved). */
-
- fpregs = gen_reg_rtx (Pmode);
- emit_move_insn (fpregs, XEXP (regbuf, 0));
- for (regno = first_floatreg; regno < NPARM_REGS (SFmode); regno ++)
- emit_move_insn (gen_rtx (MEM, SFmode,
- plus_constant (fpregs,
- GET_MODE_SIZE (SFmode)
- * (regno - first_floatreg))),
- gen_rtx (REG, SFmode,
- BASE_ARG_REG (SFmode) + regno));
-
- /* Return the address of the regbuf. */
- return XEXP (regbuf, 0);
-}
-
-/* Define the offset between two registers, one to be eliminated, and
- the other its replacement, at the start of a routine. */
-
-int
-initial_elimination_offset (from, to)
- int from;
- int to;
-{
- int regs_saved;
- int total_saved_regs_space;
- int total_auto_space = get_frame_size ();
-
- int live_regs_mask, live_regs_mask2;
- live_regs_mask = calc_live_regs (&regs_saved, &live_regs_mask2);
-
- total_saved_regs_space = (regs_saved) * 4;
-
- if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
- return total_saved_regs_space + total_auto_space;
-
- if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- return total_saved_regs_space + total_auto_space;
-
- /* Initial gap between fp and sp is 0. */
- if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- return 0;
-
- if (from == RETURN_ADDRESS_POINTER_REGNUM
- && (to == FRAME_POINTER_REGNUM || to == STACK_POINTER_REGNUM))
- {
- int i, n = 0;
- for (i = PR_REG+1; i < 32; i++)
- if (live_regs_mask & (1 << i))
- n += 4;
- for (i = 32; i < FIRST_PSEUDO_REGISTER; i++)
- if (live_regs_mask2 & (1 << (i - 32)))
- n += 4;
- return n + total_auto_space;
- }
-
- abort ();
-}
-
-/* Handle machine specific pragmas to be semi-compatible with Hitachi
- compiler. */
-
-int
-handle_pragma (file, t)
- FILE *file;
- tree t;
-{
- int retval = 0;
- register char *pname;
-
- if (TREE_CODE (t) != IDENTIFIER_NODE)
- return 0;
-
- pname = IDENTIFIER_POINTER (t);
- if (strcmp (pname, "interrupt") == 0)
- pragma_interrupt = retval = 1;
- else if (strcmp (pname, "trapa") == 0)
- pragma_interrupt = pragma_trapa = retval = 1;
- else if (strcmp (pname, "nosave_low_regs") == 0)
- pragma_nosave_low_regs = retval = 1;
-
- return retval;
-}
-
-/* Predicates used by the templates. */
-
-/* Returns 1 if OP is MACL, MACH or PR. The input must be a REG rtx.
- Used only in general_movsrc_operand. */
-
-int
-system_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (REGNO (op))
- {
- case PR_REG:
- case MACL_REG:
- case MACH_REG:
- return 1;
- }
- return 0;
-}
-
-/* Returns 1 if OP can be source of a simple move operation.
- Same as general_operand, but a LABEL_REF is valid, PRE_DEC is
- invalid as are subregs of system registers. */
-
-int
-general_movsrc_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == MEM)
- {
- rtx inside = XEXP (op, 0);
- if (GET_CODE (inside) == CONST)
- inside = XEXP (inside, 0);
-
- if (GET_CODE (inside) == LABEL_REF)
- return 1;
-
- if (GET_CODE (inside) == PLUS
- && GET_CODE (XEXP (inside, 0)) == LABEL_REF
- && GET_CODE (XEXP (inside, 1)) == CONST_INT)
- return 1;
-
- /* Only post inc allowed. */
- if (GET_CODE (inside) == PRE_DEC)
- return 0;
- }
-
- if ((mode == QImode || mode == HImode)
- && (GET_CODE (op) == SUBREG
- && GET_CODE (XEXP (op, 0)) == REG
- && system_reg_operand (XEXP (op, 0), mode)))
- return 0;
-
- return general_operand (op, mode);
-}
-
-/* Returns 1 if OP can be a destination of a move.
- Same as general_operand, but no preinc allowed. */
-
-int
-general_movdst_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- /* Only pre dec allowed. */
- if (GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) == POST_INC)
- return 0;
-
- return general_operand (op, mode);
-}
-
-/* Returns 1 if OP is a normal arithmetic register. */
-
-int
-arith_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- {
- int regno;
-
- if (GET_CODE (op) == REG)
- regno = REGNO (op);
- else if (GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == REG)
- regno = REGNO (SUBREG_REG (op));
- else
- return 1;
-
- return (regno != T_REG && regno != PR_REG && regno != FPUL_REG
- && regno != MACH_REG && regno != MACL_REG);
- }
- return 0;
-}
-
-/* Returns 1 if OP is a valid source operand for an arithmetic insn. */
-
-int
-arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (arith_reg_operand (op, mode))
- return 1;
-
- if (GET_CODE (op) == CONST_INT && CONST_OK_FOR_I (INTVAL (op)))
- return 1;
-
- return 0;
-}
-
-/* Returns 1 if OP is a valid source operand for a compare insn. */
-
-int
-arith_reg_or_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (arith_reg_operand (op, mode))
- return 1;
-
- if (GET_CODE (op) == CONST_INT && CONST_OK_FOR_N (INTVAL (op)))
- return 1;
-
- return 0;
-}
-
-/* Returns 1 if OP is a valid source operand for a logical operation. */
-
-int
-logical_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (arith_reg_operand (op, mode))
- return 1;
-
- if (GET_CODE (op) == CONST_INT && CONST_OK_FOR_L (INTVAL (op)))
- return 1;
-
- return 0;
-}
-
-/* Nonzero if OP is a floating point value with value 0.0. */
-
-int
-fp_zero_operand (op)
- rtx op;
-{
- REAL_VALUE_TYPE r;
-
- if (GET_MODE (op) != SFmode)
- return 0;
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, op);
- return REAL_VALUES_EQUAL (r, dconst0) && ! REAL_VALUE_MINUS_ZERO (r);
-}
-
-/* Nonzero if OP is a floating point value with value 1.0. */
-
-int
-fp_one_operand (op)
- rtx op;
-{
- REAL_VALUE_TYPE r;
-
- if (GET_MODE (op) != SFmode)
- return 0;
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, op);
- return REAL_VALUES_EQUAL (r, dconst1);
-}
-
-/* Return non-zero if REG is not used after INSN.
- We assume REG is a reload reg, and therefore does
- not live past labels. It may live past calls or jumps though. */
-int
-reg_unused_after (reg, insn)
- rtx reg;
- rtx insn;
-{
- enum rtx_code code;
- rtx set;
-
- /* If the reg is set by this instruction, then it is safe for our
- case. Disregard the case where this is a store to memory, since
- we are checking a register used in the store address. */
- set = single_set (insn);
- if (set && GET_CODE (SET_DEST (set)) != MEM
- && reg_overlap_mentioned_p (reg, SET_DEST (set)))
- return 1;
-
- while (insn = NEXT_INSN (insn))
- {
- code = GET_CODE (insn);
-
-#if 0
- /* If this is a label that existed before reload, then the register
- if dead here. However, if this is a label added by reorg, then
- the register may still be live here. We can't tell the difference,
- so we just ignore labels completely. */
- if (code == CODE_LABEL)
- return 1;
- /* else */
-#endif
-
- if (code == JUMP_INSN)
- return 0;
-
- /* If this is a sequence, we must handle them all at once.
- We could have for instance a call that sets the target register,
- and a insn in a delay slot that uses the register. In this case,
- we must return 0. */
- else if (code == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE)
- {
- int i;
- int retval = 0;
-
- for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
- {
- rtx this_insn = XVECEXP (PATTERN (insn), 0, i);
- rtx set = single_set (this_insn);
-
- if (GET_CODE (this_insn) == CALL_INSN)
- code = CALL_INSN;
- else if (GET_CODE (this_insn) == JUMP_INSN)
- {
- if (INSN_ANNULLED_BRANCH_P (this_insn))
- return 0;
- code = JUMP_INSN;
- }
-
- if (set && reg_overlap_mentioned_p (reg, SET_SRC (set)))
- return 0;
- if (set && reg_overlap_mentioned_p (reg, SET_DEST (set)))
- {
- if (GET_CODE (SET_DEST (set)) != MEM)
- retval = 1;
- else
- return 0;
- }
- if (set == 0
- && reg_overlap_mentioned_p (reg, PATTERN (this_insn)))
- return 0;
- }
- if (retval == 1)
- return 1;
- else if (code == JUMP_INSN)
- return 0;
- }
- else if (GET_RTX_CLASS (code) == 'i')
- {
- rtx set = single_set (insn);
-
- if (set && reg_overlap_mentioned_p (reg, SET_SRC (set)))
- return 0;
- if (set && reg_overlap_mentioned_p (reg, SET_DEST (set)))
- return GET_CODE (SET_DEST (set)) != MEM;
- if (set == 0 && reg_overlap_mentioned_p (reg, PATTERN (insn)))
- return 0;
- }
-
- if (code == CALL_INSN && call_used_regs[REGNO (reg)])
- return 1;
- }
- return 1;
-}
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
deleted file mode 100644
index e88fa08be89..00000000000
--- a/gcc/config/sh/sh.h
+++ /dev/null
@@ -1,1773 +0,0 @@
-/* Definitions of target machine for GNU compiler for Hitachi Super-H.
- Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Steve Chamberlain (sac@cygnus.com).
- Improved by Jim Wilson (wilson@cygnus.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. */
-
-
-#define TARGET_VERSION \
- fputs (" (Hitachi SH)", stderr);
-
-/* Generate SDB debugging information. */
-
-#define SDB_DEBUGGING_INFO
-
-/* Output DBX (stabs) debugging information if doing -gstabs. */
-
-#include "dbxcoff.h"
-
-#define SDB_DELIM ";"
-
-#define CPP_SPEC "%{ml:-D__LITTLE_ENDIAN__} \
-%{m1:-D__sh1__} \
-%{m2:-D__sh2__} \
-%{m3:-D__sh3__} \
-%{m3e:-D__SH3E__}"
-
-#define CPP_PREDEFINES "-D__sh__ -Acpu(sh) -Amachine(sh)"
-
-#define ASM_SPEC "%{ml:-little} %{mrelax:-relax}"
-
-#define LINK_SPEC "%{ml:-m shl} %{mrelax:-relax}"
-
-/* We can not debug without a frame pointer. */
-/* #define CAN_DEBUG_WITHOUT_FP */
-
-#define CONDITIONAL_REGISTER_USAGE \
- if (! TARGET_SH3E) \
- { \
- int regno; \
- for (regno = FIRST_FP_REG; regno <= LAST_FP_REG; regno++) \
- fixed_regs[regno] = call_used_regs[regno] = 1; \
- } \
- /* Hitachi saves and restores mac registers on call. */ \
- if (TARGET_HITACHI) \
- { \
- call_used_regs[MACH_REG] = 0; \
- call_used_regs[MACL_REG] = 0; \
- }
-
-/* ??? Need to write documentation for all SH options and add it to the
- invoke.texi file. */
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-#define ISIZE_BIT (1<<1)
-#define DALIGN_BIT (1<<6)
-#define SH0_BIT (1<<7)
-#define SH1_BIT (1<<8)
-#define SH2_BIT (1<<9)
-#define SH3_BIT (1<<10)
-#define SH3E_BIT (1<<11)
-#define SPACE_BIT (1<<13)
-#define BIGTABLE_BIT (1<<14)
-#define RELAX_BIT (1<<15)
-#define HITACHI_BIT (1<<22)
-#define PADSTRUCT_BIT (1<<28)
-#define LITTLE_ENDIAN_BIT (1<<29)
-
-/* Nonzero if we should dump out instruction size info. */
-#define TARGET_DUMPISIZE (target_flags & ISIZE_BIT)
-
-/* Nonzero to align doubles on 64 bit boundaries. */
-#define TARGET_ALIGN_DOUBLE (target_flags & DALIGN_BIT)
-
-/* Nonzero if we should generate code using type 0 insns. */
-/* ??? Is there such a thing as SH0? If not, we should delete all
- references to it. */
-#define TARGET_SH0 (target_flags & SH0_BIT)
-
-/* Nonzero if we should generate code using type 1 insns. */
-#define TARGET_SH1 (target_flags & SH1_BIT)
-
-/* Nonzero if we should generate code using type 2 insns. */
-#define TARGET_SH2 (target_flags & SH2_BIT)
-
-/* Nonzero if we should generate code using type 3 insns. */
-#define TARGET_SH3 (target_flags & SH3_BIT)
-
-/* Nonzero if we should generate code using type 3E insns. */
-#define TARGET_SH3E (target_flags & SH3E_BIT)
-
-/* Nonzero if we should generate smaller code rather than faster code. */
-#define TARGET_SMALLCODE (target_flags & SPACE_BIT)
-
-/* Nonzero to use long jump tables. */
-#define TARGET_BIGTABLE (target_flags & BIGTABLE_BIT)
-
-/* Nonzero to generate pseudo-ops needed by the assembler and linker
- to do function call relaxing. */
-#define TARGET_RELAX (target_flags & RELAX_BIT)
-
-/* Nonzero if using Hitachi's calling convention. */
-#define TARGET_HITACHI (target_flags & HITACHI_BIT)
-
-/* Nonzero if padding structures to a multiple of 4 bytes. This is
- incompatible with Hitachi's compiler, and gives unusual structure layouts
- which confuse programmers.
- ??? This option is not useful, but is retained in case there are people
- who are still relying on it. It may be deleted in the future. */
-#define TARGET_PADSTRUCT (target_flags & PADSTRUCT_BIT)
-
-/* Nonzero if generating code for a little endian SH. */
-#define TARGET_LITTLE_ENDIAN (target_flags & LITTLE_ENDIAN_BIT)
-
-#define TARGET_SWITCHES \
-{ {"0", SH0_BIT}, \
- {"1", SH1_BIT}, \
- {"2", SH2_BIT}, \
- {"3", SH3_BIT|SH2_BIT}, \
- {"3e", SH3E_BIT|SH3_BIT|SH2_BIT}, \
- {"b", -LITTLE_ENDIAN_BIT}, \
- {"bigtable", BIGTABLE_BIT}, \
- {"dalign", DALIGN_BIT}, \
- {"hitachi", HITACHI_BIT}, \
- {"isize", ISIZE_BIT}, \
- {"l", LITTLE_ENDIAN_BIT}, \
- {"padstruct", PADSTRUCT_BIT}, \
- {"relax", RELAX_BIT}, \
- {"space", SPACE_BIT}, \
- {"", TARGET_DEFAULT} \
-}
-
-#define TARGET_DEFAULT (0)
-
-#define PRESERVE_DEATH_INFO_REGNO_P(regno) (TARGET_RELAX || optimize)
-
-#define OVERRIDE_OPTIONS \
-do { \
- sh_cpu = CPU_SH0; \
- if (TARGET_SH1) \
- sh_cpu = CPU_SH1; \
- if (TARGET_SH2) \
- sh_cpu = CPU_SH2; \
- if (TARGET_SH3) \
- sh_cpu = CPU_SH3; \
- if (TARGET_SH3E) \
- sh_cpu = CPU_SH3E; \
- \
- /* Never run scheduling before reload, since that can \
- break global alloc, and generates slower code anyway due \
- to the pressure on R0. */ \
- flag_schedule_insns = 0; \
-} while (0)
-
-/* Target machine storage layout. */
-
-/* Define to use software floating point emulator for REAL_ARITHMETIC and
- decimal <-> binary conversion. */
-#define REAL_ARITHMETIC
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-#define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-#define WORDS_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
-
-/* Define this to set the endianness to use in libgcc2.c, which can
- not depend on target_flags. */
-#if defined(__LITTLE_ENDIAN__)
-#define LIBGCC2_WORDS_BIG_ENDIAN 0
-#else
-#define LIBGCC2_WORDS_BIG_ENDIAN 1
-#endif
-
-/* Number of bits in an addressable storage unit. */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-#define MAX_BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function.
- 32 bit alignment is faster, because instructions are always fetched as a
- pair from a longword boundary. */
-#define FUNCTION_BOUNDARY (TARGET_SMALLCODE ? 16 : 32)
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
-
-/* The best alignment to use in cases where we have a choice. */
-#define FASTEST_ALIGNMENT 32
-
-/* Make strings word-aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- ((TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < FASTEST_ALIGNMENT) \
- ? FASTEST_ALIGNMENT : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
-
-/* Number of bits which any structure or union's size must be a
- multiple of. Each structure or union's size is rounded up to a
- multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY (TARGET_PADSTRUCT ? 32 : 8)
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Standard register usage. */
-
-/* Register allocation for the Hitachi calling convention:
-
- r0 arg return
- r1..r3 scratch
- r4..r7 args in
- r8..r13 call saved
- r14 frame pointer/call saved
- r15 stack pointer
- ap arg pointer (doesn't really exist, always eliminated)
- pr subroutine return address
- t t bit
- mach multiply/accumulate result, high part
- macl multiply/accumulate result, low part.
- fpul fp/int communication register
- rap return address pointer register
- fr0 fp arg return
- fr1..fr3 scratch floating point registers
- fr4..fr11 fp args in
- fr12..fr15 call saved floating point registers */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-
-#define AP_REG 16
-#define PR_REG 17
-#define T_REG 18
-#define GBR_REG 19
-#define MACH_REG 20
-#define MACL_REG 21
-#define SPECIAL_REG(REGNO) ((REGNO) >= 18 && (REGNO) <= 21)
-#define FPUL_REG 22
-#define RAP_REG 23
-#define FIRST_FP_REG 24
-#define LAST_FP_REG 39
-
-#define FIRST_PSEUDO_REGISTER 40
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
-
- Mach register is fixed 'cause it's only 10 bits wide for SH1.
- It is 32 bits wide for SH2. */
-
-#define FIXED_REGISTERS \
- { 0, 0, 0, 0, \
- 0, 0, 0, 0, \
- 0, 0, 0, 0, \
- 0, 0, 0, 1, \
- 1, 1, 1, 1, \
- 1, 1, 1, 1, \
- 0, 0, 0, 0, \
- 0, 0, 0, 0, \
- 0, 0, 0, 0, \
- 0, 0, 0, 0 \
-}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-
-#define CALL_USED_REGISTERS \
- { 1, 1, 1, 1, \
- 1, 1, 1, 1, \
- 0, 0, 0, 0, \
- 0, 0, 0, 1, \
- 1, 0, 1, 1, \
- 1, 1, 1, 1, \
- 1, 1, 1, 1, \
- 1, 1, 1, 1, \
- 1, 1, 1, 1, \
- 0, 0, 0, 0 \
-}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On the SH regs are UNITS_PER_WORD bits wide. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- We can allow any mode in any general register. The special registers
- only allow SImode. Don't allow any mode in the PR. */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (SPECIAL_REG (REGNO) ? (MODE) == SImode \
- : (REGNO) == FPUL_REG ? (MODE) == SImode || (MODE) == SFmode \
- : (REGNO) >= FIRST_FP_REG && (REGNO) <= LAST_FP_REG ? (MODE) == SFmode \
- : (REGNO) == PR_REG ? 0 \
- : 1)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- ((MODE1) == (MODE2) || GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* Define this if the program counter is overloaded on a register. */
-/* #define PC_REGNUM 15*/
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 15
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 14
-
-/* Fake register that holds the address on the stack of the
- current function's return address. */
-#define RETURN_ADDRESS_POINTER_REGNUM 23
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms may be accessed
- via the stack pointer) in functions that seem suitable. */
-
-#define FRAME_POINTER_REQUIRED 0
-
-/* Definitions for register eliminations.
-
- We have three registers that can be eliminated on the SH. First, the
- frame pointer register can often be eliminated in favor of the stack
- pointer register. Secondly, the argument pointer register can always be
- eliminated; it is replaced with either the stack or frame pointer.
- Third, there is the retuen address pointer, which can also be replaced
- with either the stack or the frame pointer. */
-
-/* This is an array of structures. Each structure initializes one pair
- of eliminable registers. The "from" register number is given first,
- followed by "to". Eliminations of the same "from" register are listed
- in order of preference. */
-
-/* If you add any registers here that are not actually hard registers,
- and that have any alternative of elimination that doesn't always
- apply, you need to amend calc_live_regs to exclude it, because
- reload spills all eliminable registers where it sees an
- can_eliminate == 0 entry, thus making them 'live' .
- If you add any hard registers that can be eliminated in different
- ways, you have to patch reload to spill them only when all alternatives
- of elimination fail. */
-
-#define ELIMINABLE_REGS \
-{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { RETURN_ADDRESS_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM},}
-
-/* Given FROM and TO register numbers, say whether this elimination
- is allowed. */
-#define CAN_ELIMINATE(FROM, TO) \
- (!((FROM) == FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED))
-
-/* Define the offset between two registers, one to be eliminated, and the other
- its replacement, at the start of a routine. */
-
-#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
- OFFSET = initial_elimination_offset (FROM, TO)
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 16
-
-/* Register in which the static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 13
-
-/* The register in which a struct value address is passed. */
-
-#define STRUCT_VALUE_REGNUM 2
-
-/* If the structure value address is not passed in a register, define
- `STRUCT_VALUE' as an expression returning an RTX for the place
- where the address is passed. If it returns 0, the address is
- passed as an "invisible" first argument. */
-
-/*#define STRUCT_VALUE ((rtx)0)*/
-
-/* Don't default to pcc-struct-return, because we have already specified
- exactly how to return structures in the RETURN_IN_MEMORY macro. */
-
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The SH has two sorts of general registers, R0 and the rest. R0 can
- be used as the destination of some of the arithmetic ops. There are
- also some special purpose registers; the T bit register, the
- Procedure Return Register and the Multiply Accumulate Registers. */
-
-enum reg_class
-{
- NO_REGS,
- R0_REGS,
- PR_REGS,
- T_REGS,
- MAC_REGS,
- GENERAL_REGS,
- FPUL_REGS,
- FP0_REGS,
- FP_REGS,
- GENERAL_FP_REGS,
- ALL_REGS,
- LIM_REG_CLASSES
-};
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-#define REG_CLASS_NAMES \
-{ \
- "NO_REGS", \
- "R0_REGS", \
- "PR_REGS", \
- "T_REGS", \
- "MAC_REGS", \
- "GENERAL_REGS", \
- "FPUL_REGS", \
- "FP0_REGS", \
- "FP_REGS", \
- "GENERAL_FP_REGS", \
- "ALL_REGS", \
-}
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ \
- { 0x00000000, 0x00000000 }, /* NO_REGS */ \
- { 0x00000001, 0x00000000 }, /* R0_REGS */ \
- { 0x00020000, 0x00000000 }, /* PR_REGS */ \
- { 0x00040000, 0x00000000 }, /* T_REGS */ \
- { 0x00300000, 0x00000000 }, /* MAC_REGS */ \
- { 0x0081FFFF, 0x00000000 }, /* GENERAL_REGS */ \
- { 0x00400000, 0x00000000 }, /* FPUL_REGS */ \
- { 0x01000000, 0x00000000 }, /* FP0_REGS */ \
- { 0xFF000000, 0x000000FF }, /* FP_REGS */ \
- { 0xFF81FFFF, 0x000000FF }, /* GENERAL_FP_REGS */ \
- { 0xFFFFFFFF, 0x000000FF }, /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-extern int regno_reg_class[];
-#define REGNO_REG_CLASS(REGNO) regno_reg_class[REGNO]
-
-/* When defined, the compiler allows registers explicitly used in the
- rtl to be used as spill registers but prevents the compiler from
- extending the lifetime of these registers. */
-
-#define SMALL_REGISTER_CLASSES 1
-
-/* The order in which register should be allocated. */
-#define REG_ALLOC_ORDER \
- { 1,2,3,7,6,5,4,0,8,9,10,11,12,13,14, \
- 24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39, \
- 22,15,16,17,18,19,20,21,23 }
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS R0_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine
- description. */
-extern enum reg_class reg_class_from_letter[];
-
-#define REG_CLASS_FROM_LETTER(C) \
- ( (C) >= 'a' && (C) <= 'z' ? reg_class_from_letter[(C)-'a'] : NO_REGS )
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
- I: arithmetic operand -127..128, as used in add, sub, etc
- K: shift operand 1,2,8 or 16
- L: logical operand 0..255, as used in and, or, etc.
- M: constant 1
- N: constant 0 */
-
-#define CONST_OK_FOR_I(VALUE) (((int)(VALUE))>= -128 && ((int)(VALUE)) <= 127)
-#define CONST_OK_FOR_K(VALUE) ((VALUE)==1||(VALUE)==2||(VALUE)==8||(VALUE)==16)
-#define CONST_OK_FOR_L(VALUE) (((int)(VALUE))>= 0 && ((int)(VALUE)) <= 255)
-#define CONST_OK_FOR_M(VALUE) ((VALUE)==1)
-#define CONST_OK_FOR_N(VALUE) ((VALUE)==0)
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? CONST_OK_FOR_I (VALUE) \
- : (C) == 'K' ? CONST_OK_FOR_K (VALUE) \
- : (C) == 'L' ? CONST_OK_FOR_L (VALUE) \
- : (C) == 'M' ? CONST_OK_FOR_M (VALUE) \
- : (C) == 'N' ? CONST_OK_FOR_N (VALUE) \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
-((C) == 'G' ? fp_zero_operand (VALUE) \
- : (C) == 'H' ? fp_one_operand (VALUE) \
- : (C) == 'F')
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X, CLASS) CLASS
-
-/* ??? Should make FPUL register a nn-fixed register and make it's
- use explicit in the rtl; then change this definition here to
- ... ? FPUL_REGS : NO_REGS) . */
-#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,X) \
- ((((CLASS == FP_REGS || CLASS == FP0_REGS) \
- && GET_CODE (X) == REG && REGNO (X) <= AP_REG) \
- || (CLASS == GENERAL_REGS && GET_CODE (X) == REG \
- && REGNO (X) <= FIRST_FP_REG && REGNO (X) >= LAST_FP_REG)) \
- ? /* FPUL_REGS */ NO_REGS : NO_REGS)
-
-#define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,X) \
- (((CLASS == FP_REGS || CLASS == FP0_REGS) && immediate_operand (X, MODE)\
- && ! (fp_one_operand (X) || fp_one_operand (X))) \
- ? R0_REGS : SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,X))
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS.
-
- On SH this is the size of MODE in words. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define the number of registers that can hold parameters.
- These macros are used only in other macro definitions below. */
-
-#define NPARM_REGS(MODE) \
- ((TARGET_SH3E && ((MODE) == SFmode)) ? 8 : 4)
-
-#define FIRST_PARM_REG 4
-#define FIRST_RET_REG 0
-
-#define FIRST_FP_PARM_REG (FIRST_FP_REG + 4)
-#define FIRST_FP_RET_REG FIRST_FP_REG
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* Define this macro if the addresses of local variable slots are at
- negative offsets from the frame pointer.
-
- The SH only has positive indexes, so grow the frame up. */
-/* #define FRAME_GROWS_DOWNWARD */
-
-/* Offset from the frame pointer to the first local variable slot to
- be allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by. */
-#define PUSH_ROUNDING(NPUSHED) (((NPUSHED) + 3) & ~3)
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Value is the number of byte of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the SH, the caller does not pop any of its arguments that were passed
- on the stack. */
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Some subroutine macros specific to this machine. */
-
-#define BASE_RETURN_VALUE_REG(MODE) \
- ((TARGET_SH3E && ((MODE) == SFmode)) \
- ? FIRST_FP_RET_REG \
- : FIRST_RET_REG)
-
-#define BASE_ARG_REG(MODE) \
- ((TARGET_SH3E && ((MODE) == SFmode)) \
- ? FIRST_FP_PARM_REG \
- : FIRST_PARM_REG)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- LIBCALL_VALUE (TYPE_MODE (VALTYPE))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, MODE, BASE_RETURN_VALUE_REG (MODE));
-
-/* 1 if N is a possible register number for a function value. */
-#define FUNCTION_VALUE_REGNO_P(REGNO) \
- ((REGNO) == FIRST_RET_REG || (TARGET_SH3E && (REGNO) == FIRST_FP_RET_REG))
-
-/* 1 if N is a possible register number for function argument passing. */
-#define FUNCTION_ARG_REGNO_P(REGNO) \
- (((REGNO) >= FIRST_PARM_REG && (REGNO) < (FIRST_PARM_REG + 4)) \
- || (TARGET_SH3E \
- && (REGNO) >= FIRST_FP_PARM_REG && (REGNO) < (FIRST_FP_PARM_REG + 8)))
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On SH, this is a single integer, which is a number of words
- of arguments scanned so far (including the invisible argument,
- if any, which holds the structure-value-address).
- Thus NARGREGS or more means all following args should go on the stack. */
-
-enum sh_arg_class { SH_ARG_INT = 0, SH_ARG_FLOAT = 1 };
-struct sh_args {
- int arg_count[2];
-};
-
-#define CUMULATIVE_ARGS struct sh_args
-
-#define GET_SH_ARG_CLASS(MODE) \
- ((TARGET_SH3E && ((MODE) == SFmode)) ? SH_ARG_FLOAT : SH_ARG_INT)
-
-#define ROUND_ADVANCE(SIZE) \
- ((SIZE + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Round a register number up to a proper boundary for an arg of mode
- MODE.
-
- The SH doesn't care about double alignment, so we only
- round doubles to even regs when asked to explicitly. */
-
-#define ROUND_REG(CUM, MODE) \
- ((TARGET_ALIGN_DOUBLE \
- && GET_MODE_UNIT_SIZE ((MODE)) > UNITS_PER_WORD) \
- ? ((CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)] \
- + ((CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)] & 1)) \
- : (CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)])
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On SH, the offset always starts at 0: the first parm reg is always
- the same reg. */
-
-#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
- do { \
- (CUM).arg_count[(int) SH_ARG_INT] = 0; \
- (CUM).arg_count[(int) SH_ARG_FLOAT] = 0; \
- } while (0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be
- available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM).arg_count[(int) GET_SH_ARG_CLASS (MODE)] = \
- (ROUND_REG ((CUM), (MODE)) \
- + ((MODE) != BLKmode \
- ? ROUND_ADVANCE (GET_MODE_SIZE (MODE)) \
- : ROUND_ADVANCE (int_size_in_bytes (TYPE)))))
-
-/* Return boolean indicating arg of mode MODE will be passed in a reg.
- This macro is only used in this file. */
-
-#define PASS_IN_REG_P(CUM, MODE, TYPE) \
- (ROUND_REG ((CUM), (MODE)) < NPARM_REGS (MODE) \
- && ((TYPE) == 0 || ! TREE_ADDRESSABLE ((tree)(TYPE))) \
- && (! TARGET_SH3E || (ROUND_REG((CUM), (MODE)) + (GET_MODE_SIZE(MODE)/4) <= NPARM_REGS (MODE))))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
-
- On SH the first args are normally in registers
- and the rest are pushed. Any arg that starts within the first
- NPARM_REGS words is at least partially passed in a register unless
- its data type forbids. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- ((PASS_IN_REG_P ((CUM), (MODE), (TYPE)) \
- && (NAMED || TARGET_SH3E)) \
- ? gen_rtx (REG, (MODE), \
- (BASE_ARG_REG (MODE) + ROUND_REG ((CUM), (MODE)))) \
- : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero.
-
- We sometimes split args. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
- ((PASS_IN_REG_P ((CUM), (MODE), (TYPE)) \
- && (NAMED || TARGET_SH3E) \
- && (ROUND_REG ((CUM), (MODE)) \
- + (MODE != BLKmode \
- ? ROUND_ADVANCE (GET_MODE_SIZE (MODE)) \
- : ROUND_ADVANCE (int_size_in_bytes (TYPE))) \
- - NPARM_REGS (MODE) > 0)) \
- ? NPARM_REGS (MODE) - ROUND_REG ((CUM), (MODE)) \
- : 0)
-
-extern int current_function_anonymous_args;
-
-/* Perform any needed actions needed for a function that is receiving a
- variable number of arguments. */
-
-#define SETUP_INCOMING_VARARGS(ASF, MODE, TYPE, PAS, ST) \
- current_function_anonymous_args = 1;
-
-/* Call the function profiler with a given profile label.
- We use two .aligns, so as to make sure that both the .long is aligned
- on a 4 byte boundary, and that the .long is a fixed distance (2 bytes)
- from the trapa instruction. */
-
-#define FUNCTION_PROFILER(STREAM,LABELNO) \
-{ \
- fprintf(STREAM, " .align 2\n"); \
- fprintf(STREAM, " trapa #33\n"); \
- fprintf(STREAM, " .align 2\n"); \
- fprintf(STREAM, " .long LP%d\n", (LABELNO)); \
-}
-
-/* Define this macro if the code for function profiling should come
- before the function prologue. Normally, the profiling code comes
- after. */
-
-#define PROFILE_BEFORE_PROLOGUE
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* Generate the assembly code for function exit
- Just dump out any accumulated constant table. */
-
-#define FUNCTION_EPILOGUE(STREAM, SIZE) function_epilogue (STREAM, SIZE)
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- On the SH, the trampoline looks like
- 1 0000 D301 mov.l l1,r3
- 2 0002 DD02 mov.l l2,r13
- 3 0004 4D2B jmp @r13
- 4 0006 200B or r0,r0
- 5 0008 00000000 l1: .long function
- 6 000c 00000000 l2: .long area */
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf ((FILE), " .word 0xd301\n"); \
- fprintf ((FILE), " .word 0xdd02\n"); \
- fprintf ((FILE), " .word 0x4d2b\n"); \
- fprintf ((FILE), " .word 0x200b\n"); \
- fprintf ((FILE), " .long 0\n"); \
- fprintf ((FILE), " .long 0\n"); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-#define TRAMPOLINE_SIZE 16
-
-/* Alignment required for a trampoline in units. */
-#define TRAMPOLINE_ALIGN 4
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 8)), \
- (CXT)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant ((TRAMP), 12)), \
- (FNADDR)); \
-}
-
-/* A C expression whose value is RTL representing the value of the return
- address for the frame COUNT steps up from the current frame.
- FRAMEADDR is already the frame pointer of the COUNT frame, so we
- can ignore COUNT. */
-
-#define RETURN_ADDR_RTX(COUNT, FRAME) \
- ((COUNT == 0) \
- ? gen_rtx (MEM, Pmode, gen_rtx (REG, Pmode, RETURN_ADDRESS_POINTER_REGNUM)) \
- : (rtx) 0)
-
-/* Generate necessary RTL for __builtin_saveregs().
- ARGLIST is the argument list; see expr.c. */
-extern struct rtx_def *sh_builtin_saveregs ();
-#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) sh_builtin_saveregs (ARGLIST)
-
-/* Addressing modes, and classification of registers for them. */
-#define HAVE_POST_INCREMENT 1
-/*#define HAVE_PRE_INCREMENT 1*/
-/*#define HAVE_POST_DECREMENT 1*/
-#define HAVE_PRE_DECREMENT 1
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_BASE_P(REGNO) \
- ((REGNO) < PR_REG || (unsigned) reg_renumber[(REGNO)] < PR_REG)
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
- ((REGNO) == 0 || (unsigned) reg_renumber[(REGNO)] == 0)
-
-/* Maximum number of registers that can appear in a valid memory
- address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) (GET_CODE (X) == LABEL_REF)
-
-/* Nonzero if the constant value X is a legitimate general operand. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- (GET_CODE (X) != CONST_DOUBLE \
- || GET_MODE (X) == DFmode || GET_MODE (X) == SFmode \
- || (TARGET_SH3E && (fp_zero_operand (X) || fp_one_operand (X))))
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- (REGNO (X) <= 16 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) \
- (REGNO (X) == 0 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-/* Nonzero if X/OFFSET is a hard reg that can be used as an index
- or if X is a pseudo reg. */
-#define SUBREG_OK_FOR_INDEX_P(X, OFFSET) \
- ((REGNO (X) == 0 && OFFSET == 0) || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) \
- REGNO_OK_FOR_BASE_P (REGNO (X))
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) \
- REGNO_OK_FOR_INDEX_P (REGNO (X))
-
-/* Nonzero if X/OFFSET is a hard reg that can be used as an index. */
-#define SUBREG_OK_FOR_INDEX_P(X, OFFSET) \
- (REGNO_OK_FOR_INDEX_P (REGNO (X)) && OFFSET == 0)
-
-#endif
-
-/* The 'Q' constraint is a pc relative load operand. */
-#define EXTRA_CONSTRAINT_Q(OP) \
- (GET_CODE (OP) == MEM && \
- ((GET_CODE (XEXP (OP, 0)) == LABEL_REF) \
- || (GET_CODE (XEXP (OP, 0)) == CONST \
- && GET_CODE (XEXP (XEXP (OP, 0), 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 0)) == LABEL_REF \
- && GET_CODE (XEXP (XEXP (XEXP (OP, 0), 0), 1)) == CONST_INT)))
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' ? EXTRA_CONSTRAINT_Q (OP) \
- : 0)
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
-
-#define MODE_DISP_OK_4(X,MODE) \
-(GET_MODE_SIZE (MODE) == 4 && (unsigned) INTVAL (X) < 64 \
- && ! (INTVAL (X) & 3) && ! (TARGET_SH3E && MODE == SFmode))
-#define MODE_DISP_OK_8(X,MODE) ((GET_MODE_SIZE(MODE)==8) && ((unsigned)INTVAL(X)<60) && (!(INTVAL(X) &3)))
-
-#define BASE_REGISTER_RTX_P(X) \
- ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
-
-/* Since this must be r0, which is a single register class, we must check
- SUBREGs more carefully, to be sure that we don't accept one that extends
- outside the class. */
-#define INDEX_REGISTER_RTX_P(X) \
- ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && SUBREG_OK_FOR_INDEX_P (SUBREG_REG (X), SUBREG_WORD (X))))
-
-/* Jump to LABEL if X is a valid address RTX. This must also take
- REG_OK_STRICT into account when deciding about valid registers, but it uses
- the above macros so we are in luck.
-
- Allow REG
- REG+disp
- REG+r0
- REG++
- --REG */
-
-/* ??? The SH3e does not have the REG+disp addressing mode when loading values
- into the FRx registers. We implement this by setting the maximum offset
- to zero when the value is SFmode. This also restricts loading of SFmode
- values into the integer registers, but that can't be helped. */
-
-/* The SH allows a displacement in a QI or HI amode, but only when the
- other operand is R0. GCC doesn't handle this very well, so we forgo
- all of that.
-
- A legitimate index for a QI or HI is 0, SI can be any number 0..63,
- DI can be any number 0..60. */
-
-#define GO_IF_LEGITIMATE_INDEX(MODE, OP, LABEL) \
- do { \
- if (GET_CODE (OP) == CONST_INT) \
- { \
- if (MODE_DISP_OK_4 (OP, MODE)) goto LABEL; \
- if (MODE_DISP_OK_8 (OP, MODE)) goto LABEL; \
- } \
- } while(0)
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
-{ \
- if (BASE_REGISTER_RTX_P (X)) \
- goto LABEL; \
- else if ((GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC) \
- && BASE_REGISTER_RTX_P (XEXP (X, 0))) \
- goto LABEL; \
- else if (GET_CODE (X) == PLUS) \
- { \
- rtx xop0 = XEXP (X, 0); \
- rtx xop1 = XEXP (X, 1); \
- if (GET_MODE_SIZE (MODE) <= 8 && BASE_REGISTER_RTX_P (xop0)) \
- GO_IF_LEGITIMATE_INDEX (MODE, xop1, LABEL); \
- if (GET_MODE_SIZE (MODE) <= 4) \
- { \
- if (BASE_REGISTER_RTX_P (xop1) && INDEX_REGISTER_RTX_P (xop0))\
- goto LABEL; \
- if (INDEX_REGISTER_RTX_P (xop1) && BASE_REGISTER_RTX_P (xop0))\
- goto LABEL; \
- } \
- } \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the SH, if X is almost suitable for indexing, but the offset is
- out of range, convert it into a normal form so that cse has a chance
- of reducing the number of address registers used. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ \
- if (GET_CODE (X) == PLUS \
- && (GET_MODE_SIZE (MODE) == 4 \
- || GET_MODE_SIZE (MODE) == 8) \
- && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && BASE_REGISTER_RTX_P (XEXP (X, 0)) \
- && ! (TARGET_SH3E && MODE == SFmode)) \
- { \
- rtx index_rtx = XEXP (X, 1); \
- HOST_WIDE_INT offset = INTVAL (index_rtx), offset_base; \
- rtx sum; \
- \
- GO_IF_LEGITIMATE_INDEX (MODE, index_rtx, WIN); \
- /* On rare occasions, we might get an unaligned pointer \
- that is indexed in a way to give an aligned address. \
- Therefore, keep the lower two bits in offset_base. */ \
- /* Instead of offset_base 128..131 use 124..127, so that \
- simple add suffices. */ \
- if (offset > 127) \
- { \
- offset_base = ((offset + 4) & ~60) - 4; \
- } \
- else \
- offset_base = offset & ~60; \
- /* Sometimes the normal form does not suit DImode. We \
- could avoid that by using smaller ranges, but that \
- would give less optimized code when SImode is \
- prevalent. */ \
- if (GET_MODE_SIZE (MODE) + offset - offset_base <= 64) \
- { \
- sum = expand_binop (Pmode, add_optab, XEXP (X, 0), \
- GEN_INT (offset_base), NULL_RTX, 0, \
- OPTAB_LIB_WIDEN); \
- \
- (X) = gen_rtx (PLUS, Pmode, sum, GEN_INT (offset - offset_base)); \
- goto WIN; \
- } \
- } \
-}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for. */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
-{ \
- if (GET_CODE(ADDR) == PRE_DEC || GET_CODE(ADDR) == POST_INC) \
- goto LABEL; \
-}
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE (TARGET_BIGTABLE ? SImode : HImode)
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-#define CASE_VECTOR_PC_RELATIVE
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Since the SH3e has only `float' support, it is desirable to make all
- floating point types equivalent to `float'. */
-#define DOUBLE_TYPE_SIZE (TARGET_SH3E ? 32 : 64)
-
-/* 'char' is signed by default. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* The type of size_t unsigned int. */
-#define SIZE_TYPE "unsigned int"
-
-#define WCHAR_TYPE "short unsigned int"
-#define WCHAR_TYPE_SIZE 16
-
-/* Don't cse the address of the function being compiled. */
-/*#define NO_RECURSIVE_FUNCTION_CSE 1*/
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) SIGN_EXTEND
-
-/* Define if loading short immediate values into registers sign extends. */
-#define SHORT_IMMEDIATES_SIGN_EXTEND
-
-/* Define this if zero-extension is slow (more than one real instruction).
- On the SH, it's only one instruction. */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE 1
-
-/* Immediate shift counts are truncated by the output routines (or was it
- the assembler?). Shift counts in a register are truncated by SH. Note
- that the native compiler puts too large (> 32) immediate shift counts
- into a register and shifts by the register, letting the SH decide what
- to do instead of doing that itself. */
-/* ??? This is defined, but the library routines in lib1funcs.asm do not
- truncate the shift count. This may result in incorrect results for
- unusual cases. Truncating the shift counts in the library routines would
- make them faster. However, the SH3 has hardware shifts that do not
- truncate, so it appears that we need to leave this undefined for correct
- SH3 code. We can still using truncation in the library routines though to
- make them faster. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* All integers have the same format so truncation is easy. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC,INPREC) 1
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-/*#define NO_FUNCTION_CSE 1*/
-
-/* Chars and shorts should be passed as ints. */
-#define PROMOTE_PROTOTYPES 1
-
-/* The machine modes of pointers and functions. */
-#define Pmode SImode
-#define FUNCTION_MODE Pmode
-
-/* The relative costs of various types of constants. Note that cse.c defines
- REG = 1, SUBREG = 2, any node = (2 + sum of subnodes). */
-
-#define CONST_COSTS(RTX, CODE, OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) == 0) \
- return 0; \
- else if (CONST_OK_FOR_I (INTVAL (RTX))) \
- return 1; \
- else if ((OUTER_CODE == AND || OUTER_CODE == IOR || OUTER_CODE == XOR) \
- && CONST_OK_FOR_L (INTVAL (RTX))) \
- return 1; \
- else \
- return 8; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 5; \
- case CONST_DOUBLE: \
- return 10;
-
-#define RTX_COSTS(X, CODE, OUTER_CODE) \
- case AND: \
- return COSTS_N_INSNS (andcosts (X)); \
- case MULT: \
- return COSTS_N_INSNS (multcosts (X)); \
- case ASHIFT: \
- case ASHIFTRT: \
- case LSHIFTRT: \
- return COSTS_N_INSNS (shiftcosts (X)) ; \
- case DIV: \
- case UDIV: \
- case MOD: \
- case UMOD: \
- return COSTS_N_INSNS (20); \
- case FLOAT: \
- case FIX: \
- return 100;
-
-/* The multiply insn on the SH1 and the divide insns on the SH1 and SH2
- are actually function calls with some special constraints on arguments
- and register usage.
-
- These macros tell reorg that the references to arguments and
- register clobbers for insns of type sfunc do not appear to happen
- until after the millicode call. This allows reorg to put insns
- which set the argument registers into the delay slot of the millicode
- call -- thus they act more like traditional CALL_INSNs.
-
- get_attr_type will try to recognize the given insn, so make sure to
- filter out things it will not accept -- SEQUENCE, USE and CLOBBER insns
- in particular. */
-
-#define INSN_SETS_ARE_DELAYED(X) \
- ((GET_CODE (X) == INSN \
- && GET_CODE (PATTERN (X)) != SEQUENCE \
- && GET_CODE (PATTERN (X)) != USE \
- && GET_CODE (PATTERN (X)) != CLOBBER \
- && get_attr_type (X) == TYPE_SFUNC))
-
-#define INSN_REFERENCES_ARE_DELAYED(X) \
- ((GET_CODE (X) == INSN \
- && GET_CODE (PATTERN (X)) != SEQUENCE \
- && GET_CODE (PATTERN (X)) != USE \
- && GET_CODE (PATTERN (X)) != CLOBBER \
- && get_attr_type (X) == TYPE_SFUNC))
-
-/* Compute the cost of an address. For the SH, all valid addresses are
- the same cost. */
-/* ??? Perhaps we should make reg+reg addresses have higher cost because
- they add to register pressure on r0. */
-
-#define ADDRESS_COST(RTX) 1
-
-/* Compute extra cost of moving data between one register class
- and another.
-
- On the SH it is hard to move into the T reg, but simple to load
- from it. */
-
-#define REGISTER_MOVE_COST(SRCCLASS, DSTCLASS) \
- (((DSTCLASS == T_REGS) || (DSTCLASS == PR_REG)) ? 10 \
- : ((DSTCLASS == FP_REGS && SRCCLASS == GENERAL_REGS) \
- || (DSTCLASS == GENERAL_REGS && SRCCLASS == FP_REGS)) ? 4 \
- : 1)
-
-/* ??? Perhaps make MEMORY_MOVE_COST depend on compiler option? This
- would be so that people would slow memory systems could generate
- different code that does fewer memory accesses. */
-
-/* Assembler output control. */
-
-/* A C string constant describing how to begin a comment in the target
- assembler language. The compiler assumes that the comment will end at
- the end of the line. */
-#define ASM_COMMENT_START "!"
-
-/* The text to go at the start of the assembler file. */
-#define ASM_FILE_START(STREAM) \
- output_file_start (STREAM)
-
-#define ASM_FILE_END(STREAM)
-
-#define ASM_APP_ON ""
-#define ASM_APP_OFF ""
-#define FILE_ASM_OP "\t.file\n"
-#define IDENT_ASM_OP "\t.ident\n"
-#define SET_ASM_OP ".set"
-
-/* How to change between sections. */
-
-#define TEXT_SECTION_ASM_OP "\t.text"
-#define DATA_SECTION_ASM_OP "\t.data"
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors\n"
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors\n"
-#define EXTRA_SECTIONS in_ctors, in_dtors
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-ctors_section() \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-} \
-void \
-dtors_section() \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-/* Define this so that jump tables go in same section as the current function,
- which could be text or it could be a user defined section. */
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- do { fprintf (FILE, ".section\t%s\n", NAME); } while (0)
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { ctors_section(); fprintf(FILE,"\t.long\t_%s\n", NAME); } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { dtors_section(); fprintf(FILE,"\t.long\t_%s\n", NAME); } while (0)
-
-#undef DO_GLOBAL_CTORS_BODY
-
-#define DO_GLOBAL_CTORS_BODY \
-{ \
- typedef (*pfunc)(); \
- extern pfunc __ctors[]; \
- extern pfunc __ctors_end[]; \
- pfunc *p; \
- for (p = __ctors_end; p > __ctors; ) \
- { \
- (*--p)(); \
- } \
-}
-
-#undef DO_GLOBAL_DTORS_BODY
-#define DO_GLOBAL_DTORS_BODY \
-{ \
- typedef (*pfunc)(); \
- extern pfunc __dtors[]; \
- extern pfunc __dtors_end[]; \
- pfunc *p; \
- for (p = __dtors; p < __dtors_end; p++) \
- { \
- (*p)(); \
- } \
-}
-
-#define ASM_OUTPUT_REG_PUSH(file, v) \
- fprintf (file, "\tmov.l r%s,-@r15\n", v);
-
-#define ASM_OUTPUT_REG_POP(file, v) \
- fprintf (file, "\tmov.l @r15+,r%s\n", v);
-
-/* The assembler's names for the registers. RFP need not always be used as
- the Real framepointer; it can also be used as a normal general register.
- Note that the name `fp' is horribly misleading since `fp' is in fact only
- the argument-and-return-context pointer. */
-#define REGISTER_NAMES \
-{ \
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
- "ap", "pr", "t", "gbr", "mach","macl", "fpul","rap", \
- "fr0","fr1","fr2", "fr3", "fr4", "fr5", "fr6", "fr7", \
- "fr8","fr9","fr10","fr11","fr12","fr13","fr14","fr15",\
-}
-
-/* DBX register number for a given compiler register number. */
-/* GDB has FPUL at 23 and FP0 at 25, so we must add one to all FP registers
- to match gdb. */
-#define DBX_REGISTER_NUMBER(REGNO) \
- (((REGNO) >= 22 && (REGNO) <= 39) ? ((REGNO) + 1) : (REGNO))
-
-/* Output a label definition. */
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", LOG)
-
-/* Output a function label definition. */
-#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
- ASM_OUTPUT_LABEL(STREAM, NAME)
-
-/* Output a globalising directive for a label. */
-#define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
- (fprintf (STREAM, "\t.global\t"), \
- assemble_name (STREAM, NAME), \
- fputc ('\n',STREAM))
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* Make an internal label into a string. */
-#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
- sprintf (STRING, "*%s%d", PREFIX, NUM)
-
-/* Output an internal label definition. */
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* #define ASM_OUTPUT_CASE_END(STREAM,NUM,TABLE) */
-
-/* Construct a private name. */
-#define ASM_FORMAT_PRIVATE_NAME(OUTVAR,NAME,NUMBER) \
- ((OUTVAR) = (char *) alloca (strlen (NAME) + 10), \
- sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER)))
-
-/* Jump tables must be 32 bit aligned, no matter the size of the element. */
-#define ASM_OUTPUT_CASE_LABEL(STREAM,PREFIX,NUM,TABLE) \
- fprintf (STREAM, "\t.align 2\n%s%d:\n", PREFIX, NUM);
-
-/* Output a relative address table. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,VALUE,REL) \
- if (TARGET_BIGTABLE) \
- fprintf (STREAM, "\t.long L%d-L%d\n", VALUE,REL); \
- else \
- fprintf (STREAM, "\t.word L%d-L%d\n", VALUE,REL); \
-
-/* Output an absolute table element. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \
- if (TARGET_BIGTABLE) \
- fprintf (STREAM, "\t.long L%d\n", VALUE); \
- else \
- fprintf (STREAM, "\t.word L%d\n", VALUE); \
-
-/* Output various types of constants. */
-
-/* This is how to output an assembler line defining a `double'. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.double %s\n", dstr); \
- } while (0)
-
-/* This is how to output an assembler line defining a `float' constant. */
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
- fprintf (FILE, "\t.float %s\n", dstr); \
- } while (0)
-
-#define ASM_OUTPUT_INT(STREAM, EXP) \
- (fprintf (STREAM, "\t.long\t"), \
- output_addr_const (STREAM, (EXP)), \
- fputc ('\n', STREAM))
-
-#define ASM_OUTPUT_SHORT(STREAM, EXP) \
- (fprintf (STREAM, "\t.short\t"), \
- output_addr_const (STREAM, (EXP)), \
- fputc ('\n', STREAM))
-
-#define ASM_OUTPUT_CHAR(STREAM, EXP) \
- (fprintf (STREAM, "\t.byte\t"), \
- output_addr_const (STREAM, (EXP)), \
- fputc ('\n', STREAM))
-
-#define ASM_OUTPUT_BYTE(STREAM, VALUE) \
- fprintf (STREAM, "\t.byte\t%d\n", VALUE) \
-
-/* Align loops and labels after unconditional branches to get faster
- code. */
-
-#define ASM_OUTPUT_LOOP_ALIGN(FILE) \
- if (! TARGET_SMALLCODE) \
- ASM_OUTPUT_ALIGN ((FILE), 2)
-
-#define ASM_OUTPUT_ALIGN_CODE(FILE) \
- if (! TARGET_SMALLCODE) \
- ASM_OUTPUT_ALIGN ((FILE), (TARGET_SH3 || TARGET_SH3E) ? 4 : 2)
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %d\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
-( fputs ("\t.lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%d\n", (SIZE)))
-
-/* The assembler's parentheses characters. */
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Target characters. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Only perform branch elimination (by making instructions conditional) if
- we're optimizing. Otherwise it's of no use anyway. */
-#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \
- final_prescan_insn (INSN, OPVEC, NOPERANDS)
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(STREAM,X) print_operand_address (STREAM, X)
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
- ((CHAR)=='.' || (CHAR) == '#' || (CHAR)=='@')
-
-extern struct rtx_def *sh_compare_op0;
-extern struct rtx_def *sh_compare_op1;
-extern struct rtx_def *prepare_scc_operands();
-
-/* Which processor to schedule for. The elements of the enumeration must
- match exactly the cpu attribute in the sh.md file. */
-
-enum processor_type {
- PROCESSOR_SH0,
- PROCESSOR_SH1,
- PROCESSOR_SH2,
- PROCESSOR_SH3,
- PROCESSOR_SH3E
-};
-
-#define sh_cpu_attr ((enum attr_cpu)sh_cpu)
-extern enum processor_type sh_cpu;
-
-/* Declare functions defined in sh.c and used in templates. */
-
-extern char *output_branch();
-extern char *output_shift();
-extern char *output_movedouble();
-extern char *output_movepcrel();
-extern char *output_jump_label_table();
-extern char *output_far_jump();
-
-#define MACHINE_DEPENDENT_REORG(X) machine_dependent_reorg(X)
-
-/* Generate calls to memcpy, memcmp and memset. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Define this macro if you want to implement any pragmas. If defined, it
- is a C expression to be executed when #pragma is seen. The
- argument FILE is the stdio input stream from which the source
- text can be read. CH is the first character after the #pragma. The
- result of the expression is the terminating character found
- (newline or EOF). */
-#define HANDLE_PRAGMA(FILE, NODE) handle_pragma (FILE, NODE)
-
-/* Set when processing a function with pragma interrupt turned on. */
-
-extern int pragma_interrupt;
-
-#define MOVE_RATIO (TARGET_SMALLCODE ? 2 : 16)
-
-/* Instructions with unfilled delay slots take up an extra two bytes for
- the nop in the delay slot. Instructions at the start of loops, or
- after unconditional branches, may take up extra room when they are
- aligned. ??? We would get more accurate results if we did instruction
- alignment based on the value of INSN_CURRENT_ADDRESS; the approach used
- here is too conservative. */
-
-#define ADJUST_INSN_LENGTH(X, LENGTH) \
- if (((GET_CODE (X) == INSN \
- && GET_CODE (PATTERN (X)) != SEQUENCE \
- && GET_CODE (PATTERN (X)) != USE \
- && GET_CODE (PATTERN (X)) != CLOBBER) \
- || GET_CODE (X) == CALL_INSN \
- || (GET_CODE (X) == JUMP_INSN \
- && GET_CODE (PATTERN (X)) != ADDR_DIFF_VEC \
- && GET_CODE (PATTERN (X)) != ADDR_VEC)) \
- && get_attr_needs_delay_slot (X) == NEEDS_DELAY_SLOT_YES) \
- LENGTH += 2; \
- if (! TARGET_SMALLCODE) \
- { \
- /* After the folowing loop, PAD will be an upper bound \
- for the number of padding bytes the alignment will \
- require. */ \
- rtx aip; \
- int pad = 0; \
- for (aip = PREV_INSN (X); aip; aip = PREV_INSN (aip)) \
- { \
- if (GET_CODE (aip) == BARRIER) \
- { \
- if (TARGET_SH3 || TARGET_SH3E) \
- pad = 14; \
- else \
- pad = 2; \
- break; \
- } \
- else if ((GET_CODE (aip) == NOTE \
- && NOTE_LINE_NUMBER (aip) == NOTE_INSN_LOOP_BEG)) \
- { \
- pad = 2; \
- /* Don't break here, because there might be a \
- preceding BARRIER, which requires mores \
- alignment for SH3[E] . */ \
- } \
- else if (GET_CODE (aip) != NOTE \
- && GET_CODE (aip) != CODE_LABEL) \
- break; \
- } \
- LENGTH += pad; \
- }
-
-/* Enable a bug fix for the shorten_branches pass. */
-#define SHORTEN_WITH_ADJUST_INSN_LENGTH
-
-/* Define the codes that are matched by predicates in sh.c. */
-#define PREDICATE_CODES \
- {"arith_reg_operand", {SUBREG, REG}}, \
- {"arith_operand", {SUBREG, REG, CONST_INT}}, \
- {"arith_reg_or_0_operand", {SUBREG, REG, CONST_INT}}, \
- {"logical_operand", {SUBREG, REG, CONST_INT}}, \
- {"general_movsrc_operand", {SUBREG, REG, CONST_INT, MEM}}, \
- {"general_movdst_operand", {SUBREG, REG, CONST_INT, MEM}},
-
-/* Define this macro if it is advisable to hold scalars in registers
- in a wider mode than that declared by the program. In such cases,
- the value is constrained to be within the bounds of the declared
- type, but kept valid in the wider mode. The signedness of the
- extension may differ from that of the type.
-
- Leaving the unsignedp unchanged gives better code than always setting it
- to 0. This is despite the fact that we have only signed char and short
- load instructions. */
-#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
- MODE = SImode;
-
-/* Defining PROMOTE_FUNCTION_ARGS eliminates some unnecessary zero/sign
- extensions applied to char/short functions arguments. Defining
- PROMOTE_FUNCTION_RETURN does the same for function returns. */
-
-#define PROMOTE_FUNCTION_ARGS
-#define PROMOTE_FUNCTION_RETURN
-
-/* ??? Define ACCUMULATE_OUTGOING_ARGS? This is more efficient than pushing
- and poping arguments. However, we do have push/pop instructions, and
- rather limited offsets (4 bits) in load/store instructions, so it isn't
- clear if this would give better code. If implemented, should check for
- compatibility problems. */
-
-/* A C statement (sans semicolon) to update the integer variable COST
- based on the relationship between INSN that is dependent on
- DEP_INSN through the dependence LINK. The default is to make no
- adjustment to COST. This can be used for example to specify to
- the scheduler that an output- or anti-dependence does not incur
- the same cost as a data-dependence. */
-
-/* ??? Should anticipate the effect of delayed branch scheduling
- and arrange for a second instruction to be put between the
- load of the function's address and the call. */
-
-#define ADJUST_COST(insn,link,dep_insn,cost) \
- if (GET_CODE(insn) == CALL_INSN) \
- { \
- /* The only input for a call that is timing-critical is the \
- function's address. */ \
- rtx call = PATTERN (insn); \
- \
- if (GET_CODE (call) == PARALLEL) \
- call = XVECEXP (call, 0 ,0); \
- if (GET_CODE (call) == SET) \
- call = SET_SRC (call); \
- if (GET_CODE (call) == CALL && GET_CODE (XEXP (call, 0)) == MEM) \
- { \
- rtx set = single_set (dep_insn); \
- \
- if (set && ! rtx_equal_p (SET_DEST (set), XEXP (XEXP (call, 0), 0)))\
- (cost) = 0; \
- } \
- }
-
-/* Since the SH architecture lacks negative address offsets,
- the givs should be sorted smallest to largest so combine_givs
- has maximum opportunity to combine givs. */
-#define GIV_SORT_CRITERION(X, Y) \
- if (GET_CODE ((X)->add_val) == CONST_INT \
- && GET_CODE ((Y)->add_val) == CONST_INT) \
- return INTVAL ((X)->add_val) - INTVAL ((Y)->add_val);
-
-/* For the sake of libgcc2.c, indicate target supports atexit. */
-#define HAVE_ATEXIT
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
deleted file mode 100644
index 342b3e40911..00000000000
--- a/gcc/config/sh/sh.md
+++ /dev/null
@@ -1,2809 +0,0 @@
-;;- Machine description for the Hitachi SH.
-;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
-;; Contributed by Steve Chamberlain (sac@cygnus.com).
-;; Improved by Jim Wilson (wilson@cygnus.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.
-
-
-;; ??? Should prepend a * to all pattern names which are not used.
-;; This will make the compiler smaller, and rebuilds after changes faster.
-
-;; ??? Should be enhanced to include support for many more GNU superoptimizer
-;; sequences. Especially the sequences for arithmetic right shifts.
-
-;; ??? Should check all DImode patterns for consistency and usefulness.
-
-;; ??? The MAC.W and MAC.L instructions are not supported. There is no
-;; way to generate them.
-
-;; ??? The cmp/str instruction is not supported. Perhaps it can be used
-;; for a str* inline function.
-
-;; BSR is not generated by the compiler proper, but when relaxing, it
-;; generates .uses pseudo-ops that allow linker relaxation to create
-;; BSR. This is actually implemented in bfd/{coff,elf32}-sh.c
-
-;; Special constraints for SH machine description:
-;;
-;; t -- T
-;; x -- mac
-;; l -- pr
-;; z -- r0
-;;
-;; Special formats used for outputting SH instructions:
-;;
-;; %. -- print a .s if insn needs delay slot
-;; %@ -- print rte/rts if is/isn't an interrupt function
-;; %# -- output a nop if there is nothing to put in the delay slot
-;; %O -- print a constant without the #
-;; %R -- print the lsw reg of a double
-;; %S -- print the msw reg of a double
-;; %T -- print next word of a double REG or MEM
-;;
-;; Special predicates:
-;;
-;; arith_operand -- operand is valid source for arithmetic op
-;; arith_reg_operand -- operand is valid register for arithmetic op
-;; general_movdst_operand -- operand is valid move destination
-;; general_movsrc_operand -- operand is valid move source
-;; logical_operand -- operand is valid source for logical op
-;; -------------------------------------------------------------------------
-;; Attributes
-;; -------------------------------------------------------------------------
-
-;; Target CPU.
-
-(define_attr "cpu" "sh0,sh1,sh2,sh3,sh3e"
- (const (symbol_ref "sh_cpu_attr")))
-
-;; cbranch conditional branch instructions
-;; jump unconditional jumps
-;; arith ordinary arithmetic
-;; load from memory
-;; store to memory
-;; move register to register
-;; smpy word precision integer multiply
-;; dmpy longword or doublelongword precision integer multiply
-;; return rts
-;; pload load of pr reg, which can't be put into delay slot of rts
-;; pstore store of pr reg, which can't be put into delay slot of jsr
-;; pcload pc relative load of constant value
-;; rte return from exception
-;; sfunc special function call with known used registers
-;; call function call
-;; fp floating point
-;; fdiv floating point divide (or square root)
-
-(define_attr "type"
- "cbranch,jump,arith,other,load,store,move,smpy,dmpy,return,pload,pstore,pcload,rte,sfunc,call,fp,fdiv"
- (const_string "other"))
-
-; If a conditional branch destination is within -252..258 bytes away
-; from the instruction it can be 2 bytes long. Something in the
-; range -4090..4100 bytes can be 6 bytes long. All other conditional
-; branches are 16 bytes long.
-
-; An unconditional jump in the range -4092..4098 can be 2 bytes long.
-; Otherwise, it must be 14 bytes long.
-
-; All other instructions are two bytes long by default.
-
-; All positive offsets have an adjustment added, which is the number of bytes
-; difference between this instruction length and the next larger instruction
-; length. This is because shorten_branches starts with the largest
-; instruction size and then tries to reduce them.
-
-(define_attr "length" ""
- (cond [(eq_attr "type" "cbranch")
- (if_then_else (and (ge (minus (match_dup 0) (pc))
- (const_int -252))
- (le (minus (match_dup 0) (pc))
- (const_int 262)))
- (const_int 2)
- (if_then_else (and (ge (minus (match_dup 0) (pc))
- (const_int -4090))
- (le (minus (match_dup 0) (pc))
- (const_int 4110)))
- (const_int 6)
- (const_int 16)))
-
- (eq_attr "type" "jump")
- (if_then_else (and (ge (minus (match_dup 0) (pc))
- (const_int -4092))
- (le (minus (match_dup 0) (pc))
- (const_int 4110)))
- (const_int 2)
- (const_int 14))
- ] (const_int 2)))
-
-;; (define_function_unit {name} {num-units} {n-users} {test}
-;; {ready-delay} {issue-delay} [{conflict-list}])
-
-;; Load and store instructions save a cycle if they are aligned on a
-;; four byte boundary. Using a function unit for stores encourages
-;; gcc to separate load and store instructions by one instruction,
-;; which makes it more likely that the linker will be able to word
-;; align them when relaxing.
-(define_function_unit "memory" 1 0
- (eq_attr "type" "load,pcload,pload,store,pstore") 2 2)
-
-;; ??? These are approximations.
-(define_function_unit "mpy" 1 0 (eq_attr "type" "smpy") 2 2)
-(define_function_unit "mpy" 1 0 (eq_attr "type" "dmpy") 3 3)
-
-(define_function_unit "fp" 1 0 (eq_attr "type" "fp") 2 1)
-(define_function_unit "fp" 1 0 (eq_attr "type" "fdiv") 13 12)
-
-; Definitions for filling branch delay slots.
-
-(define_attr "needs_delay_slot" "yes,no" (const_string "no"))
-
-(define_attr "hit_stack" "yes,no" (const_string "no"))
-
-(define_attr "interrupt_function" "no,yes"
- (const (symbol_ref "pragma_interrupt")))
-
-(define_attr "in_delay_slot" "yes,no"
- (cond [(eq_attr "type" "cbranch") (const_string "no")
- (eq_attr "type" "pcload") (const_string "no")
- (eq_attr "needs_delay_slot" "yes") (const_string "no")
- (eq_attr "length" "2") (const_string "yes")
- ] (const_string "no")))
-
-(define_delay
- (eq_attr "needs_delay_slot" "yes")
- [(eq_attr "in_delay_slot" "yes") (nil) (nil)])
-
-;; On the SH and SH2, the rte instruction reads the return pc from the stack,
-;; and thus we can't put a pop instruction in its delay slot.
-;; ??? On the SH3, the rte instruction does not use the stack, so a pop
-;; instruction can go in the delay slot.
-
-;; Since a normal return (rts) implicitly uses the PR register,
-;; we can't allow PR register loads in an rts delay slot.
-
-(define_delay
- (eq_attr "type" "return")
- [(and (eq_attr "in_delay_slot" "yes")
- (ior (and (eq_attr "interrupt_function" "no")
- (eq_attr "type" "!pload"))
- (and (eq_attr "interrupt_function" "yes")
- (eq_attr "hit_stack" "no")))) (nil) (nil)])
-
-;; Since a call implicitly uses the PR register, we can't allow
-;; a PR register store in a jsr delay slot.
-
-(define_delay
- (ior (eq_attr "type" "call") (eq_attr "type" "sfunc"))
- [(and (eq_attr "in_delay_slot" "yes")
- (eq_attr "type" "!pstore")) (nil) (nil)])
-
-;; Say that we have annulled true branches, since this gives smaller and
-;; faster code when branches are predicted as not taken.
-
-;; ??? Branches which are out-of-range actually have two delay slots,
-;; the first is either always executed or else annulled false, and the
-;; second is always annulled false. Handling these differently from
-;; in range branches would give better code.
-
-(define_delay
- (and (eq_attr "type" "cbranch")
- (eq_attr "cpu" "sh2,sh3"))
- [(eq_attr "in_delay_slot" "yes") (eq_attr "in_delay_slot" "yes") (nil)])
-
-;; -------------------------------------------------------------------------
-;; SImode signed integer comparisons
-;; -------------------------------------------------------------------------
-
-(define_insn ""
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (eq:SI (reg:SI 18)
- (const_int 1)))]
- ""
- "movt %0")
-
-(define_insn ""
- [(set (reg:SI 18)
- (eq:SI (and:SI (match_operand:SI 0 "arith_reg_operand" "z,r")
- (match_operand:SI 1 "arith_operand" "L,r"))
- (const_int 0)))]
- ""
- "tst %1,%0")
-
-;; ??? Perhaps should only accept reg/constant if the register is reg 0.
-;; That would still allow reload to create cmpi instructions, but would
-;; perhaps allow forcing the constant into a register when that is better.
-;; Probably should use r0 for mem/imm compares, but force constant into a
-;; register for pseudo/imm compares.
-
-(define_insn "cmpeqsi_t"
- [(set (reg:SI 18) (eq:SI (match_operand:SI 0 "arith_reg_operand" "r,z,r")
- (match_operand:SI 1 "arith_operand" "N,rI,r")))]
- ""
- "@
- tst %0,%0
- cmp/eq %1,%0
- cmp/eq %1,%0")
-
-(define_insn "cmpgtsi_t"
- [(set (reg:SI 18) (gt:SI (match_operand:SI 0 "arith_reg_operand" "r,r")
- (match_operand:SI 1 "arith_reg_or_0_operand" "r,N")))]
- ""
- "@
- cmp/gt %1,%0
- cmp/pl %0")
-
-(define_insn "cmpgesi_t"
- [(set (reg:SI 18) (ge:SI (match_operand:SI 0 "arith_reg_operand" "r,r")
- (match_operand:SI 1 "arith_reg_or_0_operand" "r,N")))]
- ""
- "@
- cmp/ge %1,%0
- cmp/pz %0")
-
-;; -------------------------------------------------------------------------
-;; SImode unsigned integer comparisons
-;; -------------------------------------------------------------------------
-
-(define_insn "cmpgeusi_t"
- [(set (reg:SI 18) (geu:SI (match_operand:SI 0 "arith_reg_operand" "r")
- (match_operand:SI 1 "arith_reg_operand" "r")))]
- ""
- "cmp/hs %1,%0")
-
-(define_insn "cmpgtusi_t"
- [(set (reg:SI 18) (gtu:SI (match_operand:SI 0 "arith_reg_operand" "r")
- (match_operand:SI 1 "arith_reg_operand" "r")))]
- ""
- "cmp/hi %1,%0")
-
-;; We save the compare operands in the cmpxx patterns and use them when
-;; we generate the branch.
-
-(define_expand "cmpsi"
- [(set (reg:SI 18) (compare (match_operand:SI 0 "arith_operand" "")
- (match_operand:SI 1 "arith_operand" "")))]
- ""
- "
-{
- sh_compare_op0 = operands[0];
- sh_compare_op1 = operands[1];
- DONE;
-}")
-
-;; -------------------------------------------------------------------------
-;; Addition instructions
-;; -------------------------------------------------------------------------
-
-;; ??? This should be a define expand.
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "arith_reg_operand" "=r")
- (plus:DI (match_operand:DI 1 "arith_reg_operand" "%0")
- (match_operand:DI 2 "arith_reg_operand" "r")))
- (clobber (reg:SI 18))]
- ""
- "clrt\;addc %R2,%R0\;addc %S2,%S0"
- [(set_attr "length" "6")])
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (plus:SI (match_operand:SI 1 "arith_operand" "%0")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "add %2,%0"
- [(set_attr "type" "arith")])
-
-;; -------------------------------------------------------------------------
-;; Subtraction instructions
-;; -------------------------------------------------------------------------
-
-;; ??? This should be a define expand.
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "arith_reg_operand" "=r")
- (minus:DI (match_operand:DI 1 "arith_reg_operand" "0")
- (match_operand:DI 2 "arith_reg_operand" "r")))
- (clobber (reg:SI 18))]
- ""
- "clrt\;subc %R2,%R0\;subc %S2,%S0"
- [(set_attr "length" "6")])
-
-(define_insn "*subsi3_internal"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (minus:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (match_operand:SI 2 "arith_reg_operand" "r")))]
- ""
- "sub %2,%0"
- [(set_attr "type" "arith")])
-
-;; Convert `constant - reg' to `neg rX; add rX, #const' since this
-;; will sometimes save one instruction. Otherwise we might get
-;; `mov #const, rY; sub rY,rX; mov rX, rY' if the source and dest regs
-;; are the same.
-
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (minus:SI (match_operand:SI 1 "arith_operand" "")
- (match_operand:SI 2 "arith_reg_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- emit_insn (gen_negsi2 (operands[0], operands[2]));
- emit_insn (gen_addsi3 (operands[0], operands[0], operands[1]));
- DONE;
- }
-}")
-
-;; -------------------------------------------------------------------------
-;; Division instructions
-;; -------------------------------------------------------------------------
-
-;; We take advantage of the library routines which don't clobber as many
-;; registers as a normal function call would.
-
-;; We must use a pseudo-reg forced to reg 0 in the SET_DEST rather than
-;; hard register 0. If we used hard register 0, then the next instruction
-;; would be a move from hard register 0 to a pseudo-reg. If the pseudo-reg
-;; gets allocated to a stack slot that needs its address reloaded, then
-;; there is nothing to prevent reload from using r0 to reload the address.
-;; This reload would clobber the value in r0 we are trying to store.
-;; If we let reload allocate r0, then this problem can never happen.
-
-(define_insn ""
- [(set (match_operand:SI 1 "register_operand" "=z")
- (udiv:SI (reg:SI 4) (reg:SI 5)))
- (clobber (reg:SI 18))
- (clobber (reg:SI 17))
- (clobber (reg:SI 4))
- (use (match_operand:SI 0 "arith_reg_operand" "r"))]
- ""
- "jsr @%0%#"
- [(set_attr "type" "sfunc")
- (set_attr "needs_delay_slot" "yes")])
-
-(define_expand "udivsi3"
- [(set (reg:SI 4) (match_operand:SI 1 "general_operand" ""))
- (set (reg:SI 5) (match_operand:SI 2 "general_operand" ""))
- (set (match_dup 3) (symbol_ref:SI "__udivsi3"))
- (parallel [(set (match_operand:SI 0 "register_operand" "")
- (udiv:SI (reg:SI 4)
- (reg:SI 5)))
- (clobber (reg:SI 18))
- (clobber (reg:SI 17))
- (clobber (reg:SI 4))
- (use (match_dup 3))])]
- ""
- "operands[3] = gen_reg_rtx(SImode);")
-
-(define_insn ""
- [(set (match_operand:SI 1 "register_operand" "=z")
- (div:SI (reg:SI 4) (reg:SI 5)))
- (clobber (reg:SI 18))
- (clobber (reg:SI 17))
- (clobber (reg:SI 1))
- (clobber (reg:SI 2))
- (clobber (reg:SI 3))
- (use (match_operand:SI 0 "arith_reg_operand" "r"))]
- ""
- "jsr @%0%#"
- [(set_attr "type" "sfunc")
- (set_attr "needs_delay_slot" "yes")])
-
-(define_expand "divsi3"
- [(set (reg:SI 4) (match_operand:SI 1 "general_operand" ""))
- (set (reg:SI 5) (match_operand:SI 2 "general_operand" ""))
- (set (match_dup 3) (symbol_ref:SI "__sdivsi3"))
- (parallel [(set (match_operand:SI 0 "register_operand" "")
- (div:SI (reg:SI 4)
- (reg:SI 5)))
- (clobber (reg:SI 18))
- (clobber (reg:SI 17))
- (clobber (reg:SI 1))
- (clobber (reg:SI 2))
- (clobber (reg:SI 3))
- (use (match_dup 3))])]
- ""
- "operands[3] = gen_reg_rtx(SImode);")
-
-;; -------------------------------------------------------------------------
-;; Multiplication instructions
-;; -------------------------------------------------------------------------
-
-(define_insn ""
- [(set (reg:SI 21)
- (mult:SI (zero_extend:SI (match_operand:HI 0 "arith_reg_operand" "r"))
- (zero_extend:SI (match_operand:HI 1 "arith_reg_operand" "r"))))]
- ""
- "mulu %1,%0"
- [(set_attr "type" "smpy")])
-
-(define_insn ""
- [(set (reg:SI 21)
- (mult:SI (sign_extend:SI
- (match_operand:HI 0 "arith_reg_operand" "r"))
- (sign_extend:SI
- (match_operand:HI 1 "arith_reg_operand" "r"))))]
- ""
- "muls %1,%0"
- [(set_attr "type" "smpy")])
-
-(define_expand "mulhisi3"
- [(set (reg:SI 21)
- (mult:SI (sign_extend:SI
- (match_operand:HI 1 "arith_reg_operand" ""))
- (sign_extend:SI
- (match_operand:HI 2 "arith_reg_operand" ""))))
- (set (match_operand:SI 0 "arith_reg_operand" "")
- (reg:SI 21))]
- ""
- "")
-
-(define_expand "umulhisi3"
- [(set (reg:SI 21)
- (mult:SI (zero_extend:SI
- (match_operand:HI 1 "arith_reg_operand" ""))
- (zero_extend:SI
- (match_operand:HI 2 "arith_reg_operand" ""))))
- (set (match_operand:SI 0 "arith_reg_operand" "")
- (reg:SI 21))]
- ""
- "")
-
-;; mulsi3 on the SH2 can be done in one instruction, on the SH1 we generate
-;; a call to a routine which clobbers known registers.
-
-(define_insn ""
- [(set (match_operand:SI 1 "register_operand" "=z")
- (mult:SI (reg:SI 4) (reg:SI 5)))
- (clobber (reg:SI 21))
- (clobber (reg:SI 18))
- (clobber (reg:SI 17))
- (clobber (reg:SI 3))
- (clobber (reg:SI 2))
- (clobber (reg:SI 1))
- (use (match_operand:SI 0 "arith_reg_operand" "r"))]
- ""
- "jsr @%0%#"
- [(set_attr "type" "sfunc")
- (set_attr "needs_delay_slot" "yes")])
-
-(define_expand "mulsi3_call"
- [(set (reg:SI 4) (match_operand:SI 1 "general_operand" ""))
- (set (reg:SI 5) (match_operand:SI 2 "general_operand" ""))
- (set (match_dup 3) (symbol_ref:SI "__mulsi3"))
- (parallel[(set (match_operand:SI 0 "register_operand" "")
- (mult:SI (reg:SI 4)
- (reg:SI 5)))
- (clobber (reg:SI 21))
- (clobber (reg:SI 18))
- (clobber (reg:SI 17))
- (clobber (reg:SI 3))
- (clobber (reg:SI 2))
- (clobber (reg:SI 1))
- (use (match_dup 3))])]
- ""
- "operands[3] = gen_reg_rtx(SImode);")
-
-(define_insn "mul_l"
- [(set (reg:SI 21)
- (mult:SI (match_operand:SI 0 "arith_reg_operand" "r")
- (match_operand:SI 1 "arith_reg_operand" "r")))]
- "TARGET_SH2"
- "mul.l %1,%0"
- [(set_attr "type" "dmpy")])
-
-(define_expand "mulsi3"
- [(set (reg:SI 21)
- (mult:SI (match_operand:SI 1 "arith_reg_operand" "")
- (match_operand:SI 2 "arith_reg_operand" "")))
- (set (match_operand:SI 0 "arith_reg_operand" "")
- (reg:SI 21))]
- ""
- "
-{
- if (!TARGET_SH2)
- {
- FAIL;
- /* ??? Does this give worse or better code? */
- emit_insn (gen_mulsi3_call (operands[0], operands[1], operands[2]));
- DONE;
- }
-}")
-
-(define_insn "mulsidi3_i"
- [(set (reg:DI 20)
- (mult:DI (sign_extend:DI (match_operand:SI 0 "arith_reg_operand" "r"))
- (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "r"))))]
- "TARGET_SH2"
- "dmuls.l %1,%0"
- [(set_attr "type" "dmpy")])
-
-(define_expand "mulsidi3"
- [(set (reg:DI 20)
- (mult:DI (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" ""))
- (sign_extend:DI (match_operand:SI 2 "arith_reg_operand" ""))))
- (set (match_operand:DI 0 "arith_reg_operand" "")
- (reg:DI 20))]
- "TARGET_SH2"
- "
-{
- /* We must swap the two words when copying them from MACH/MACL to the
- output register. */
- if (TARGET_LITTLE_ENDIAN)
- {
- rtx low_dst = operand_subword (operands[0], 0, 1, DImode);
- rtx high_dst = operand_subword (operands[0], 1, 1, DImode);
-
- emit_insn (gen_mulsidi3_i (operands[1], operands[2]));
-
- emit_insn (gen_rtx (CLOBBER, VOIDmode, operands[0]));
- emit_move_insn (low_dst, gen_rtx (REG, SImode, 21));
- emit_move_insn (high_dst, gen_rtx (REG, SImode, 20));
- DONE;
- }
-}")
-
-(define_insn "umulsidi3_i"
- [(set (reg:DI 20)
- (mult:DI (zero_extend:DI (match_operand:SI 0 "arith_reg_operand" "r"))
- (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "r"))))]
- "TARGET_SH2"
- "dmulu.l %1,%0"
- [(set_attr "type" "dmpy")])
-
-(define_expand "umulsidi3"
- [(set (reg:DI 20)
- (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" ""))
- (zero_extend:DI (match_operand:SI 2 "arith_reg_operand" ""))))
- (set (match_operand:DI 0 "arith_reg_operand" "")
- (reg:DI 20))]
- "TARGET_SH2"
- "
-{
- /* We must swap the two words when copying them from MACH/MACL to the
- output register. */
- if (TARGET_LITTLE_ENDIAN)
- {
- rtx low_dst = operand_subword (operands[0], 0, 1, DImode);
- rtx high_dst = operand_subword (operands[0], 1, 1, DImode);
-
- emit_insn (gen_umulsidi3_i (operands[1], operands[2]));
-
- emit_insn (gen_rtx (CLOBBER, VOIDmode, operands[0]));
- emit_move_insn (low_dst, gen_rtx (REG, SImode, 21));
- emit_move_insn (high_dst, gen_rtx (REG, SImode, 20));
- DONE;
- }
-}")
-
-(define_insn ""
- [(set (reg:SI 20)
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 0 "arith_reg_operand" "r"))
- (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")))
- (const_int 32))))
- (clobber (reg:SI 21))]
- "TARGET_SH2"
- "dmuls.l %1,%0"
- [(set_attr "type" "dmpy")])
-
-(define_expand "smulsi3_highpart"
- [(parallel [(set (reg:SI 20)
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" ""))
- (sign_extend:DI (match_operand:SI 2 "arith_reg_operand" "")))
- (const_int 32))))
- (clobber (reg:SI 21))])
- (set (match_operand:SI 0 "arith_reg_operand" "")
- (reg:SI 20))]
- "TARGET_SH2"
- "")
-
-(define_insn ""
- [(set (reg:SI 20)
- (truncate:SI
- (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 0 "arith_reg_operand" "r"))
- (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")))
- (const_int 32))))
- (clobber (reg:SI 21))]
- "TARGET_SH2"
- "dmulu.l %1,%0"
- [(set_attr "type" "dmpy")])
-
-(define_expand "umulsi3_highpart"
- [(parallel [(set (reg:SI 20)
- (truncate:SI
- (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" ""))
- (zero_extend:DI (match_operand:SI 2 "arith_reg_operand" "")))
- (const_int 32))))
- (clobber (reg:SI 21))])
- (set (match_operand:SI 0 "arith_reg_operand" "")
- (reg:SI 20))]
- "TARGET_SH2"
- "")
-
-;; -------------------------------------------------------------------------
-;; Logical operations
-;; -------------------------------------------------------------------------
-
-(define_insn ""
- [(set (match_operand:SI 0 "arith_reg_operand" "=r,z")
- (and:SI (match_operand:SI 1 "arith_reg_operand" "%0,0")
- (match_operand:SI 2 "logical_operand" "r,L")))]
- ""
- "and %2,%0"
- [(set_attr "type" "arith")])
-
-;; If the constant is 255, then emit a extu.b instruction instead of an
-;; and, since that will give better code.
-
-(define_expand "andsi3"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (and:SI (match_operand:SI 1 "arith_reg_operand" "")
- (match_operand:SI 2 "logical_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 255)
- {
- emit_insn (gen_zero_extendqisi2 (operands[0],
- gen_lowpart (QImode, operands[1])));
- DONE;
- }
-}")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r,z")
- (ior:SI (match_operand:SI 1 "arith_reg_operand" "%0,0")
- (match_operand:SI 2 "logical_operand" "r,L")))]
- ""
- "or %2,%0")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "arith_reg_operand" "=z,r")
- (xor:SI (match_operand:SI 1 "arith_reg_operand" "%0,0")
- (match_operand:SI 2 "logical_operand" "L,r")))]
- ""
- "xor %2,%0"
- [(set_attr "type" "arith")])
-
-;; -------------------------------------------------------------------------
-;; Shifts and rotates
-;; -------------------------------------------------------------------------
-
-(define_insn "rotlsi3_1"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (rotate:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (const_int 1)))
- (set (reg:SI 18)
- (lshiftrt:SI (match_dup 1) (const_int 31)))]
- ""
- "rotl %0")
-
-(define_insn "rotlsi3_31"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (rotate:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (const_int 31)))
- (clobber (reg:SI 18))]
- ""
- "rotr %0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (rotate:SI (match_operand:SI 1 "arith_reg_operand" "r")
- (const_int 16)))]
- ""
- "swap.w %1,%0")
-
-(define_expand "rotlsi3"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (rotate:SI (match_operand:SI 1 "arith_reg_operand" "")
- (match_operand:SI 2 "immediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- FAIL;
-
- if (INTVAL (operands[2]) == 1)
- {
- emit_insn (gen_rotlsi3_1 (operands[0], operands[1]));
- DONE;
- }
- else if (INTVAL (operands[2]) == 31)
- {
- emit_insn (gen_rotlsi3_31 (operands[0], operands[1]));
- DONE;
- }
- else if (INTVAL (operands[2]) != 16)
- FAIL;
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "arith_reg_operand" "=r")
- (rotate:HI (match_operand:HI 1 "arith_reg_operand" "r")
- (const_int 8)))]
- ""
- "swap.b %1,%0")
-
-(define_expand "rotlhi3"
- [(set (match_operand:HI 0 "arith_reg_operand" "")
- (rotate:HI (match_operand:HI 1 "arith_reg_operand" "")
- (match_operand:HI 2 "immediate_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 8)
- FAIL;
-}")
-
-;;
-;; shift left
-
-(define_insn "ashlsi3_d"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (match_operand:SI 2 "arith_reg_operand" "r")))]
- "TARGET_SH3"
- "shld %2,%0")
-
-(define_insn "ashlsi3_k"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r,r")
- (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0,0")
- (match_operand:SI 2 "const_int_operand" "M,K")))]
- "CONST_OK_FOR_K (INTVAL (operands[2]))"
- "@
- add %0,%0
- shll%O2 %0")
-
-(define_insn "ashlhi3_k"
- [(set (match_operand:HI 0 "arith_reg_operand" "=r,r")
- (ashift:HI (match_operand:HI 1 "arith_reg_operand" "0,0")
- (match_operand:HI 2 "const_int_operand" "M,K")))]
- "CONST_OK_FOR_K (INTVAL (operands[2]))"
- "@
- add %0,%0
- shll%O2 %0")
-
-(define_insn "ashlsi3_n"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- ""
- "#"
- [(set (attr "length")
- (cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1))
- (const_string "2")
- (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2))
- (const_string "4")
- (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 3))
- (const_string "6")]
- (const_string "8")))
- (set_attr "type" "arith")])
-
-(define_split
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (ashift:SI (match_operand:SI 1 "arith_reg_operand" "")
- (match_operand:SI 2 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- ""
- [(use (reg:SI 0))]
- "
-{
- gen_shifty_op (ASHIFT, operands);
- DONE;
-}")
-
-(define_expand "ashlsi3"
- [(parallel [(set (match_operand:SI 0 "arith_reg_operand" "")
- (ashift:SI (match_operand:SI 1 "arith_reg_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))
- (clobber (reg:SI 18))])]
- ""
- "
-{
- if (TARGET_SH3 && arith_reg_operand (operands[2], GET_MODE (operands[2])))
- {
- emit_insn (gen_ashlsi3_d (operands[0], operands[1], operands[2]));
- DONE;
- }
- if (! immediate_operand (operands[2], GET_MODE (operands[2])))
- FAIL;
-}")
-
-(define_insn "ashlhi3"
- [(set (match_operand:HI 0 "arith_reg_operand" "=r")
- (ashift:HI (match_operand:HI 1 "arith_reg_operand" "0")
- (match_operand:HI 2 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- ""
- "#"
- [(set (attr "length")
- (cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1))
- (const_string "2")
- (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2))
- (const_string "4")]
- (const_string "6")))
- (set_attr "type" "arith")])
-
-(define_split
- [(set (match_operand:HI 0 "arith_reg_operand" "")
- (ashift:HI (match_operand:HI 1 "arith_reg_operand" "")
- (match_operand:HI 2 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- ""
- [(use (reg:SI 0))]
- "
-{
- gen_shifty_hi_op (ASHIFT, operands);
- DONE;
-}")
-
-;
-; arithmetic shift right
-;
-
-(define_insn "ashrsi3_k"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "M")))
- (clobber (reg:SI 18))]
- "INTVAL (operands[2]) == 1"
- "shar %0"
- [(set_attr "type" "arith")])
-
-(define_insn "ashrhi3_k"
- [(set (match_operand:HI 0 "arith_reg_operand" "=r")
- (ashiftrt:HI (match_operand:HI 1 "arith_reg_operand" "0")
- (match_operand:HI 2 "const_int_operand" "M")))
- (clobber (reg:SI 18))]
- "INTVAL (operands[2]) == 1"
- "shar %0"
- [(set_attr "type" "arith")])
-
-;; ??? This should be a define expand.
-
-(define_insn "ashrsi2_16"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "r")
- (const_int 16)))]
- ""
- "swap.w %1,%0\;exts.w %0,%0"
- [(set_attr "length" "4")])
-
-;; ??? This should be a define expand.
-
-(define_insn "ashrsi2_31"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (const_int 31)))
- (clobber (reg:SI 18))]
- ""
- "@
- shll %0\;subc %0,%0"
- [(set_attr "length" "4")])
-
-(define_insn "ashrsi3_d"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "arith_reg_operand" "r"))))]
- "TARGET_SH3"
- "shad %2,%0")
-
-(define_insn "ashrsi3_n"
- [(set (reg:SI 4)
- (ashiftrt:SI (reg:SI 4)
- (match_operand:SI 0 "const_int_operand" "i")))
- (clobber (reg:SI 18))
- (clobber (reg:SI 17))
- (use (match_operand:SI 1 "arith_reg_operand" "r"))]
- ""
- "jsr @%1%#"
- [(set_attr "type" "sfunc")
- (set_attr "needs_delay_slot" "yes")])
-
-(define_expand "ashrsi3"
- [(parallel [(set (match_operand:SI 0 "arith_reg_operand" "")
- (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))
- (clobber (reg:SI 18))])]
- ""
- "if (expand_ashiftrt (operands)) DONE; else FAIL;")
-
-;; logical shift right
-
-(define_insn "lshrsi3_d"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (neg:SI (match_operand:SI 2 "arith_reg_operand" "r"))))]
- "TARGET_SH3"
- "shld %2,%0")
-
-;; Only the single bit shift clobbers the T bit.
-
-(define_insn "lshrsi3_m"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "M")))
- (clobber (reg:SI 18))]
- "CONST_OK_FOR_M (INTVAL (operands[2]))"
- "shlr %0")
-
-(define_insn "lshrsi3_k"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "K")))]
- "CONST_OK_FOR_K (INTVAL (operands[2]))
- && ! CONST_OK_FOR_M (INTVAL (operands[2]))"
- "shlr%O2 %0")
-
-(define_insn "lshrhi3_m"
- [(set (match_operand:HI 0 "arith_reg_operand" "=r")
- (lshiftrt:HI (match_operand:HI 1 "arith_reg_operand" "0")
- (match_operand:HI 2 "const_int_operand" "M")))
- (clobber (reg:SI 18))]
- "CONST_OK_FOR_M (INTVAL (operands[2]))"
- "shlr %0")
-
-(define_insn "lshrhi3_k"
- [(set (match_operand:HI 0 "arith_reg_operand" "=r")
- (lshiftrt:HI (match_operand:HI 1 "arith_reg_operand" "0")
- (match_operand:HI 2 "const_int_operand" "K")))]
- "CONST_OK_FOR_K (INTVAL (operands[2]))
- && ! CONST_OK_FOR_M (INTVAL (operands[2]))"
- "shlr%O2 %0")
-
-(define_insn "lshrsi3_n"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- ""
- "#"
- [(set (attr "length")
- (cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1))
- (const_string "2")
- (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2))
- (const_string "4")
- (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 3))
- (const_string "6")]
- (const_string "8")))
- (set_attr "type" "arith")])
-
-(define_split
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "")
- (match_operand:SI 2 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- ""
- [(use (reg:SI 0))]
- "
-{
- gen_shifty_op (LSHIFTRT, operands);
- DONE;
-}")
-
-(define_expand "lshrsi3"
- [(parallel [(set (match_operand:SI 0 "arith_reg_operand" "")
- (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))
- (clobber (reg:SI 18))])]
- ""
- "
-{
- if (TARGET_SH3 && arith_reg_operand (operands[2], GET_MODE (operands[2])))
- {
- rtx count = copy_to_mode_reg (SImode, operands[2]);
- emit_insn (gen_negsi2 (count, count));
- emit_insn (gen_lshrsi3_d (operands[0], operands[1], count));
- DONE;
- }
- if (! immediate_operand (operands[2], GET_MODE (operands[2])))
- FAIL;
-}")
-
-(define_insn "lshrhi3"
- [(set (match_operand:HI 0 "arith_reg_operand" "=r")
- (lshiftrt:HI (match_operand:HI 1 "arith_reg_operand" "0")
- (match_operand:HI 2 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- ""
- "#"
-;; ??? length attribute is sometimes six instead of four.
- [(set (attr "length")
- (cond [(eq (symbol_ref "shift_insns_rtx (insn)") (const_int 1))
- (const_string "2")
- (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2))
- (const_string "4")]
- (const_string "6")))
- (set_attr "type" "arith")])
-
-(define_split
- [(set (match_operand:HI 0 "arith_reg_operand" "")
- (lshiftrt:HI (match_operand:HI 1 "arith_reg_operand" "")
- (match_operand:HI 2 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- ""
- [(use (reg:SI 0))]
- "
-{
- gen_shifty_hi_op (LSHIFTRT, operands);
- DONE;
-}")
-
-;; ??? This should be a define expand.
-
-(define_insn "ashldi3_k"
- [(set (match_operand:DI 0 "arith_reg_operand" "=r")
- (ashift:DI (match_operand:DI 1 "arith_reg_operand" "0")
- (const_int 1)))
- (clobber (reg:SI 18))]
- ""
- "shll %R0\;rotcl %S0"
- [(set_attr "length" "4")])
-
-(define_expand "ashldi3"
- [(parallel [(set (match_operand:DI 0 "arith_reg_operand" "")
- (ashift:DI (match_operand:DI 1 "arith_reg_operand" "")
- (match_operand:DI 2 "immediate_operand" "")))
- (clobber (reg:SI 18))])]
- ""
- "{ if (GET_CODE (operands[2]) != CONST_INT
- || INTVAL (operands[2]) != 1) FAIL;} ")
-
-;; ??? This should be a define expand.
-
-(define_insn "lshrdi3_k"
- [(set (match_operand:DI 0 "arith_reg_operand" "=r")
- (lshiftrt:DI (match_operand:DI 1 "arith_reg_operand" "0")
- (const_int 1)))
- (clobber (reg:SI 18))]
- ""
- "shlr %S0\;rotcr %R0"
- [(set_attr "length" "4")])
-
-(define_expand "lshrdi3"
- [(parallel [(set (match_operand:DI 0 "arith_reg_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "arith_reg_operand" "")
- (match_operand:DI 2 "immediate_operand" "")))
- (clobber (reg:SI 18))])]
- ""
- "{ if (GET_CODE (operands[2]) != CONST_INT
- || INTVAL (operands[2]) != 1) FAIL;} ")
-
-;; ??? This should be a define expand.
-
-(define_insn "ashrdi3_k"
- [(set (match_operand:DI 0 "arith_reg_operand" "=r")
- (ashiftrt:DI (match_operand:DI 1 "arith_reg_operand" "0")
- (const_int 1)))
- (clobber (reg:SI 18))]
- ""
- "shar %S0\;rotcr %R0"
- [(set_attr "length" "4")])
-
-(define_expand "ashrdi3"
- [(parallel [(set (match_operand:DI 0 "arith_reg_operand" "")
- (ashiftrt:DI (match_operand:DI 1 "arith_reg_operand" "")
- (match_operand:DI 2 "immediate_operand" "")))
- (clobber (reg:SI 18))])]
- ""
- "{ if (GET_CODE (operands[2]) != CONST_INT
- || INTVAL (operands[2]) != 1) FAIL; } ")
-
-;; combined left/right shift
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n")))]
- "(unsigned)INTVAL (operands[2]) < 32"
- [(use (reg:SI 0))]
- "if (gen_shl_and (operands[0], operands[2], operands[3], operands[1])) FAIL;
- DONE;")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- "(unsigned)INTVAL (operands[2]) < 32"
- [(use (reg:SI 0))]
- "if (gen_shl_and (operands[0], operands[2], operands[3], operands[1])) FAIL;
- DONE;")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- "shl_and_kind (operands[2], operands[3], 0) == 1"
- "#"
- [(set (attr "length")
- (cond [(eq (symbol_ref "shl_and_length (insn)") (const_int 2))
- (const_string "4")
- (eq (symbol_ref "shl_and_length (insn)") (const_int 3))
- (const_string "6")
- (eq (symbol_ref "shl_and_length (insn)") (const_int 4))
- (const_string "8")
- (eq (symbol_ref "shl_and_length (insn)") (const_int 5))
- (const_string "10")
- (eq (symbol_ref "shl_and_length (insn)") (const_int 6))
- (const_string "12")
- (eq (symbol_ref "shl_and_length (insn)") (const_int 7))
- (const_string "14")
- (eq (symbol_ref "shl_and_length (insn)") (const_int 8))
- (const_string "16")]
- (const_string "18")))
- (set_attr "type" "arith")])
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=z")
- (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n")))
- (clobber (reg:SI 18))]
- "shl_and_kind (operands[2], operands[3], 0) == 2"
- "#"
- [(set (attr "length")
- (cond [(eq (symbol_ref "shl_and_length (insn)") (const_int 2))
- (const_string "4")
- (eq (symbol_ref "shl_and_length (insn)") (const_int 3))
- (const_string "6")
- (eq (symbol_ref "shl_and_length (insn)") (const_int 4))
- (const_string "8")]
- (const_string "10")))
- (set_attr "type" "arith")])
-
-;; shift left / and combination with a scratch register: The combine pass
-;; does not accept the individual instructions, even though they are
-;; cheap. But it needs a precise description so that it is usable after
-;; reload.
-(define_insn "and_shl_scratch"
- [(set (match_operand:SI 0 "register_operand" "=r,&r")
- (lshiftrt:SI (ashift:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,0")
- (match_operand:SI 2 "const_int_operand" "N,n"))
- (match_operand:SI 3 "" "0,r"))
- (match_operand:SI 4 "const_int_operand" "n,n"))
- (match_operand:SI 5 "const_int_operand" "n,n")))
- (clobber (reg:SI 18))]
- ""
- "#"
- [(set (attr "length")
- (cond [(eq (symbol_ref "shl_and_scr_length (insn)") (const_int 2))
- (const_string "4")
- (eq (symbol_ref "shl_and_scr_length (insn)") (const_int 3))
- (const_string "6")
- (eq (symbol_ref "shl_and_scr_length (insn)") (const_int 4))
- (const_string "8")
- (eq (symbol_ref "shl_and_scr_length (insn)") (const_int 5))
- (const_string "10")]
- (const_string "12")))
- (set_attr "type" "arith")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r,&r")
- (lshiftrt:SI (ashift:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,0")
- (match_operand:SI 2 "const_int_operand" "N,n"))
- (match_operand:SI 3 "register_operand" "0,r"))
- (match_operand:SI 4 "const_int_operand" "n,n"))
- (match_operand:SI 5 "const_int_operand" "n,n")))
- (clobber (reg:SI 18))]
- ""
- [(use (reg:SI 0))]
- "
-{
- rtx and_source = operands[rtx_equal_p (operands[0], operands[1]) ? 3 : 1];
-
- if (INTVAL (operands[2]))
- {
- gen_shifty_op (LSHIFTRT, operands);
- }
- emit_insn (gen_andsi3 (operands[0], operands[0], and_source));
- operands[2] = operands[4];
- gen_shifty_op (ASHIFT, operands);
- if (INTVAL (operands[5]))
- {
- operands[2] = operands[5];
- gen_shifty_op (LSHIFTRT, operands);
- }
- DONE;
-}")
-
-;; signed left/right shift combination.
-(define_split
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extract:SI (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n")
- (const_int 0)))
- (clobber (reg:SI 18))]
- ""
- [(use (reg:SI 0))]
- "if (gen_shl_sext (operands[0], operands[2], operands[3], operands[1])) FAIL;
- DONE;")
-
-(define_insn "shl_sext_ext"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extract:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n")
- (const_int 0)))
- (clobber (reg:SI 18))]
- "(unsigned)shl_sext_kind (operands[2], operands[3], 0) - 1 < 5"
- "#"
- [(set (attr "length")
- (cond [(eq (symbol_ref "shl_sext_length (insn)") (const_int 1))
- (const_string "2")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 2))
- (const_string "4")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 3))
- (const_string "6")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 4))
- (const_string "8")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 5))
- (const_string "10")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 6))
- (const_string "12")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 7))
- (const_string "14")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 8))
- (const_string "16")]
- (const_string "18")))
- (set_attr "type" "arith")])
-
-(define_insn "shl_sext_sub"
- [(set (match_operand:SI 0 "register_operand" "=z")
- (sign_extract:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n")
- (const_int 0)))
- (clobber (reg:SI 18))]
- "(shl_sext_kind (operands[2], operands[3], 0) & ~1) == 6"
- "#"
- [(set (attr "length")
- (cond [(eq (symbol_ref "shl_sext_length (insn)") (const_int 3))
- (const_string "6")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 4))
- (const_string "8")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 5))
- (const_string "10")
- (eq (symbol_ref "shl_sext_length (insn)") (const_int 6))
- (const_string "12")]
- (const_string "14")))
- (set_attr "type" "arith")])
-
-
-;; -------------------------------------------------------------------------
-;; Unary arithmetic
-;; -------------------------------------------------------------------------
-
-(define_insn "negc"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (neg:SI (plus:SI (reg:SI 18)
- (match_operand:SI 1 "arith_reg_operand" "r"))))
- (set (reg:SI 18)
- (ne:SI (ior:SI (reg:SI 18) (match_dup 1))
- (const_int 0)))]
- ""
- "negc %1,%0"
- [(set_attr "type" "arith")])
-
-(define_expand "negdi2"
- [(set (match_operand:DI 0 "arith_reg_operand" "")
- (neg:DI (match_operand:DI 1 "arith_reg_operand" "")))
- (clobber (reg:SI 18))]
- ""
- "
-{
- int low_word = (TARGET_LITTLE_ENDIAN ? 0 : 1);
- int high_word = (TARGET_LITTLE_ENDIAN ? 1 : 0);
-
- rtx low_src = operand_subword (operands[1], low_word, 0, DImode);
- rtx high_src = operand_subword (operands[1], high_word, 0, DImode);
-
- rtx low_dst = operand_subword (operands[0], low_word, 1, DImode);
- rtx high_dst = operand_subword (operands[0], high_word, 1, DImode);
-
- emit_insn (gen_clrt ());
- emit_insn (gen_negc (low_dst, low_src));
- emit_insn (gen_negc (high_dst, high_src));
- DONE;
-}")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (neg:SI (match_operand:SI 1 "arith_reg_operand" "r")))]
- ""
- "neg %1,%0"
- [(set_attr "type" "arith")])
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (not:SI (match_operand:SI 1 "arith_reg_operand" "r")))]
- ""
- "not %1,%0"
- [(set_attr "type" "arith")])
-
-;; -------------------------------------------------------------------------
-;; Zero extension instructions
-;; -------------------------------------------------------------------------
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (zero_extend:SI (match_operand:HI 1 "arith_reg_operand" "r")))]
- ""
- "extu.w %1,%0"
- [(set_attr "type" "arith")])
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (zero_extend:SI (match_operand:QI 1 "arith_reg_operand" "r")))]
- ""
- "extu.b %1,%0"
- [(set_attr "type" "arith")])
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "arith_reg_operand" "=r")
- (zero_extend:HI (match_operand:QI 1 "arith_reg_operand" "r")))]
- ""
- "extu.b %1,%0"
- [(set_attr "type" "arith")])
-
-;; -------------------------------------------------------------------------
-;; Sign extension instructions
-;; -------------------------------------------------------------------------
-
-;; ??? This should be a define expand.
-;; ??? Or perhaps it should be dropped?
-
-(define_insn "extendsidi2"
- [(set (match_operand:DI 0 "arith_reg_operand" "=r")
- (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")))
- (clobber (reg:SI 18))]
- ""
- "mov %1,%S0\;mov %1,%R0\;shll %S0\;subc %S0,%S0"
- [(set_attr "length" "8")])
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r,r")
- (sign_extend:SI (match_operand:HI 1 "general_movsrc_operand" "r,m")))]
- ""
- "@
- exts.w %1,%0
- mov.w %1,%0"
- [(set_attr "type" "arith,load")])
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r,r")
- (sign_extend:SI (match_operand:QI 1 "general_movsrc_operand" "r,m")))]
- ""
- "@
- exts.b %1,%0
- mov.b %1,%0"
- [(set_attr "type" "arith,load")])
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "arith_reg_operand" "=r,r")
- (sign_extend:HI (match_operand:QI 1 "general_movsrc_operand" "r,m")))]
- ""
- "@
- exts.b %1,%0
- mov.b %1,%0"
- [(set_attr "type" "arith,load")])
-
-;; -------------------------------------------------------------------------
-;; Move instructions
-;; -------------------------------------------------------------------------
-
-;; define push and pop so it is easy for sh.c
-
-(define_insn "push"
- [(set (mem:SI (pre_dec:SI (reg:SI 15)))
- (match_operand:SI 0 "register_operand" "r,l,x"))]
- ""
- "@
- mov.l %0,@-r15
- sts.l %0,@-r15
- sts.l %0,@-r15"
- [(set_attr "type" "store,pstore,store")
- (set_attr "hit_stack" "yes")])
-
-(define_insn "pop"
- [(set (match_operand:SI 0 "register_operand" "=r,l,x")
- (mem:SI (post_inc:SI (reg:SI 15))))]
- ""
- "@
- mov.l @r15+,%0
- lds.l @r15+,%0
- lds.l @r15+,%0"
- [(set_attr "type" "load,pload,load")
- (set_attr "hit_stack" "yes")])
-
-(define_insn "push_e"
- [(set (mem:SF (pre_dec:SI (reg:SI 15)))
- (match_operand:SF 0 "register_operand" "r,f,y"))]
- "TARGET_SH3E"
- "@
- mov.l %0,@-r15
- fmov.s %0,@-r15
- sts.l %0,@-r15"
- [(set_attr "type" "store")
- (set_attr "hit_stack" "yes")])
-
-(define_insn "pop_e"
- [(set (match_operand:SF 0 "register_operand" "=r,f,y")
- (mem:SF (post_inc:SI (reg:SI 15))))]
- "TARGET_SH3E"
- "@
- mov.l @r15+,%0
- fmov.s @r15+,%0
- lds.l @r15+,%0"
- [(set_attr "type" "load")
- (set_attr "hit_stack" "yes")])
-
-;; These two patterns can happen as the result of optimization, when
-;; comparisons get simplified to a move of zero or 1 into the T reg.
-;; They don't disappear completely, because the T reg is a fixed hard reg.
-
-(define_insn "clrt"
- [(set (reg:SI 18) (const_int 0))]
- ""
- "clrt")
-
-(define_insn "sett"
- [(set (reg:SI 18) (const_int 1))]
- ""
- "sett")
-
-;; t/z is first, so that it will be preferred over r/r when reloading a move
-;; of a pseudo-reg into the T reg
-(define_insn "movsi_i"
- [(set (match_operand:SI 0 "general_movdst_operand" "=t,r,r,r,r,r,m,<,xl,xl,r")
- (match_operand:SI 1 "general_movsrc_operand" "z,Q,rI,m,xl,t,r,xl,r,>,i"))]
- "
- ! TARGET_SH3E &&
- (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode))"
- "@
- tst %1,%1\;rotcl %1\;xor #1,%1\;rotcr %1
- mov.l %1,%0
- mov %1,%0
- mov.l %1,%0
- sts %1,%0
- movt %0
- mov.l %1,%0
- sts.l %1,%0
- lds %1,%0
- lds.l %1,%0
- fake %1,%0"
- [(set_attr "type" "move,pcload,move,load,move,store,store,move,load,move,pcload")
- (set_attr "length" "8,*,*,*,*,*,*,*,*,*,*")])
-
-;; t/z is first, so that it will be preferred over r/r when reloading a move
-;; of a pseudo-reg into the T reg
-;; ??? This allows moves from macl to fpul to be recognized, but these moves
-;; will require a reload.
-(define_insn "movsi_ie"
- [(set (match_operand:SI 0 "general_movdst_operand" "=t,r,r,r,r,r,m,<,xl,xl,r,y,r")
- (match_operand:SI 1 "general_movsrc_operand" "z,Q,rI,m,xl,t,r,xl,r,>,i,r,y"))]
- "TARGET_SH3E
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode))"
- "@
- tst %1,%1\;rotcl %1\;xor #1,%1\;rotcr %1
- mov.l %1,%0
- mov %1,%0
- mov.l %1,%0
- sts %1,%0
- movt %0
- mov.l %1,%0
- sts.l %1,%0
- lds %1,%0
- lds.l %1,%0
- fake %1,%0
- lds %1,%0
- sts %1,%0"
- [(set_attr "type" "move,pcload,move,load,move,store,store,move,load,move,pcload,move,move")
- (set_attr "length" "8,*,*,*,*,*,*,*,*,*,*,*,*")])
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_movdst_operand" "")
- (match_operand:SI 1 "general_movsrc_operand" ""))]
- ""
- "{ if (prepare_move_operands (operands, SImode)) DONE; }")
-
-(define_insn "movqi_i"
- [(set (match_operand:QI 0 "general_movdst_operand" "=r,r,m,r,r,l")
- (match_operand:QI 1 "general_movsrc_operand" "ri,m,r,t,l,r"))]
- "arith_reg_operand (operands[0], QImode)
- || arith_reg_operand (operands[1], QImode)"
- "@
- mov %1,%0
- mov.b %1,%0
- mov.b %1,%0
- movt %0
- sts %1,%0
- lds %1,%0"
- [(set_attr "type" "move,load,store,move,move,move")])
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "{ if (prepare_move_operands (operands, QImode)) DONE; }")
-
-(define_insn "movhi_i"
- [(set (match_operand:HI 0 "general_movdst_operand" "=r,r,r,r,m,r,l,r")
- (match_operand:HI 1 "general_movsrc_operand" "Q,rI,m,t,r,l,r,i"))]
- "arith_reg_operand (operands[0], HImode)
- || arith_reg_operand (operands[1], HImode)"
- "@
- mov.w %1,%0
- mov %1,%0
- mov.w %1,%0
- movt %0
- mov.w %1,%0
- sts %1,%0
- lds %1,%0
- fake %1,%0"
- [(set_attr "type" "pcload,move,load,move,store,move,move,pcload")])
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_movdst_operand" "")
- (match_operand:HI 1 "general_movsrc_operand" ""))]
- ""
- "{ if (prepare_move_operands (operands, HImode)) DONE; }")
-
-;; ??? This should be a define expand.
-
-(define_insn ""
- [(set (match_operand:DI 0 "general_movdst_operand" "=r,r,r,m,r,r,r")
- (match_operand:DI 1 "general_movsrc_operand" "Q,r,m,r,I,i,x"))]
- "arith_reg_operand (operands[0], DImode)
- || arith_reg_operand (operands[1], DImode)"
- "* return output_movedouble (insn, operands, DImode);"
- [(set_attr "length" "4")
- (set_attr "type" "pcload,move,load,store,move,pcload,move")])
-
-;; If the output is a register and the input is memory or a register, we have
-;; to be careful and see which word needs to be loaded first.
-
-(define_split
- [(set (match_operand:DI 0 "general_movdst_operand" "")
- (match_operand:DI 1 "general_movsrc_operand" ""))]
- "reload_completed"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))]
- "
-{
- int regno;
-
- if ((GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- || (GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1], 0)) == POST_INC))
- FAIL;
-
- if (GET_CODE (operands[0]) == REG)
- regno = REGNO (operands[0]);
- else if (GET_CODE (operands[0]) == SUBREG)
- regno = REGNO (SUBREG_REG (operands[0])) + SUBREG_WORD (operands[0]);
- else if (GET_CODE (operands[0]) == MEM)
- regno = -1;
-
- if (regno == -1
- || ! refers_to_regno_p (regno, regno + 1, operands[1], 0))
- {
- operands[2] = operand_subword (operands[0], 0, 0, DImode);
- operands[3] = operand_subword (operands[1], 0, 0, DImode);
- operands[4] = operand_subword (operands[0], 1, 0, DImode);
- operands[5] = operand_subword (operands[1], 1, 0, DImode);
- }
- else
- {
- operands[2] = operand_subword (operands[0], 1, 0, DImode);
- operands[3] = operand_subword (operands[1], 1, 0, DImode);
- operands[4] = operand_subword (operands[0], 0, 0, DImode);
- operands[5] = operand_subword (operands[1], 0, 0, DImode);
- }
-
- if (operands[2] == 0 || operands[3] == 0
- || operands[4] == 0 || operands[5] == 0)
- FAIL;
-}")
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "general_movdst_operand" "")
- (match_operand:DI 1 "general_movsrc_operand" ""))]
- ""
- "{ if ( prepare_move_operands (operands, DImode)) DONE; }")
-
-;; ??? This should be a define expand.
-
-(define_insn "movdf_k"
- [(set (match_operand:DF 0 "general_movdst_operand" "=r,r,r,m")
- (match_operand:DF 1 "general_movsrc_operand" "r,FQ,m,r"))]
- "arith_reg_operand (operands[0], DFmode)
- || arith_reg_operand (operands[1], DFmode)"
- "* return output_movedouble (insn, operands, DFmode);"
- [(set_attr "length" "4")
- (set_attr "type" "move,pcload,load,store")])
-
-;; If the output is a register and the input is memory or a register, we have
-;; to be careful and see which word needs to be loaded first.
-
-(define_split
- [(set (match_operand:DF 0 "general_movdst_operand" "")
- (match_operand:DF 1 "general_movsrc_operand" ""))]
- "reload_completed"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))]
- "
-{
- int regno;
-
- if ((GET_CODE (operands[0]) == MEM
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
- || (GET_CODE (operands[1]) == MEM
- && GET_CODE (XEXP (operands[1], 0)) == POST_INC))
- FAIL;
-
- if (GET_CODE (operands[0]) == REG)
- regno = REGNO (operands[0]);
- else if (GET_CODE (operands[0]) == SUBREG)
- regno = REGNO (SUBREG_REG (operands[0])) + SUBREG_WORD (operands[0]);
- else if (GET_CODE (operands[0]) == MEM)
- regno = -1;
-
- if (regno == -1
- || ! refers_to_regno_p (regno, regno + 1, operands[1], 0))
- {
- operands[2] = operand_subword (operands[0], 0, 0, DFmode);
- operands[3] = operand_subword (operands[1], 0, 0, DFmode);
- operands[4] = operand_subword (operands[0], 1, 0, DFmode);
- operands[5] = operand_subword (operands[1], 1, 0, DFmode);
- }
- else
- {
- operands[2] = operand_subword (operands[0], 1, 0, DFmode);
- operands[3] = operand_subword (operands[1], 1, 0, DFmode);
- operands[4] = operand_subword (operands[0], 0, 0, DFmode);
- operands[5] = operand_subword (operands[1], 0, 0, DFmode);
- }
-
- if (operands[2] == 0 || operands[3] == 0
- || operands[4] == 0 || operands[5] == 0)
- FAIL;
-}")
-
-;; If a base address generated by LEGITIMIZE_ADDRESS for SImode is
-;; used only once, let combine add in the index again.
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "" ""))
- (clobber (match_operand 2 "register_operand" ""))]
- "! reload_in_progress && ! reload_completed"
- [(use (reg:SI 0))]
- "
-{
- rtx addr, reg, const_int;
-
- if (GET_CODE (operands[1]) != MEM)
- FAIL;
- addr = XEXP (operands[1], 0);
- if (GET_CODE (addr) != PLUS)
- FAIL;
- reg = XEXP (addr, 0);
- const_int = XEXP (addr, 1);
- if (GET_CODE (reg) != REG || GET_CODE (const_int) != CONST_INT)
- FAIL;
- emit_move_insn (operands[2], const_int);
- emit_move_insn (operands[0],
- change_address (operands[1], VOIDmode,
- gen_rtx (PLUS, SImode, reg, operands[2])));
- DONE;
-}")
-
-(define_split
- [(set (match_operand:SI 1 "" "")
- (match_operand:SI 0 "register_operand" ""))
- (clobber (match_operand 2 "register_operand" ""))]
- "! reload_in_progress && ! reload_completed"
- [(use (reg:SI 0))]
- "
-{
- rtx addr, reg, const_int;
-
- if (GET_CODE (operands[1]) != MEM)
- FAIL;
- addr = XEXP (operands[1], 0);
- if (GET_CODE (addr) != PLUS)
- FAIL;
- reg = XEXP (addr, 0);
- const_int = XEXP (addr, 1);
- if (GET_CODE (reg) != REG || GET_CODE (const_int) != CONST_INT)
- FAIL;
- emit_move_insn (operands[2], const_int);
- emit_move_insn (change_address (operands[1], VOIDmode,
- gen_rtx (PLUS, SImode, reg, operands[2])),
- operands[0]);
- DONE;
-}")
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_movdst_operand" "")
- (match_operand:DF 1 "general_movsrc_operand" ""))]
- ""
- "{ if (prepare_move_operands (operands, DFmode)) DONE; }")
-
-(define_insn "movsf_i"
- [(set (match_operand:SF 0 "general_movdst_operand" "=r,r,r,r,m,l,r")
- (match_operand:SF 1 "general_movsrc_operand" "r,I,FQ,m,r,r,l"))]
- "
- ! TARGET_SH3E &&
- (arith_reg_operand (operands[0], SFmode)
- || arith_reg_operand (operands[1], SFmode))"
- "@
- mov %1,%0
- mov %1,%0
- mov.l %1,%0
- mov.l %1,%0
- mov.l %1,%0
- lds %1,%0
- sts %1,%0"
- [(set_attr "type" "move,move,pcload,load,store,move,move")])
-
-(define_insn "movsf_ie"
- [(set (match_operand:SF 0 "general_movdst_operand"
- "=f,r,f,f,?f,f,m,r,r,m,!??r,!??f")
- (match_operand:SF 1 "general_movsrc_operand"
- "f,r,G,H,FQ,m,f,FQ,m,r,f,r"))
- (clobber (match_scratch:SI 2 "=X,X,X,X,&z,X,X,X,X,X,X,X"))]
-
- "TARGET_SH3E
- && (arith_reg_operand (operands[0], SFmode)
- || arith_reg_operand (operands[1], SFmode))"
- "@
- fmov %1,%0
- mov %1,%0
- fldi0 %0
- fldi1 %0
- #
- fmov.s %1,%0
- fmov.s %1,%0
- mov.l %1,%0
- mov.l %1,%0
- mov.l %1,%0
- flds %1,fpul\;sts fpul,%0
- lds %1,fpul\;fsts fpul,%0"
- [(set_attr "type" "move,move,fp,fp,pcload,load,store,pcload,load,store,move,fp")
- (set_attr "length" "*,*,*,*,4,*,*,*,*,*,4,4")])
-
-(define_split
- [(set (match_operand:SF 0 "general_movdst_operand" "")
- (match_operand:SF 1 "general_movsrc_operand" ""))
- (clobber (reg:SI 0))]
- "GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER"
- [(parallel [(set (match_dup 0) (match_dup 1))
- (clobber (scratch:SI))])]
- "
-{
- if (REGNO (operands[0]) >= FIRST_FP_REG && REGNO (operands[0]) <= LAST_FP_REG)
- {
- if (GET_CODE (operands[1]) != MEM)
- FAIL;
- emit_insn (gen_mova (XEXP (operands[1], 0)));
- XEXP (operands[1], 0) = gen_rtx (REG, Pmode, 0);
- }
-}")
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_movdst_operand" "")
- (match_operand:SF 1 "general_movsrc_operand" ""))]
- ""
- "
-{
- if (prepare_move_operands (operands, SFmode))
- DONE;
- if (TARGET_SH3E)
- {
- emit_insn (gen_movsf_ie (operands[0], operands[1]));
- DONE;
- }
-}")
-
-(define_expand "reload_insf"
- [(parallel [(set (match_operand:SF 0 "register_operand" "=f")
- (match_operand:SF 1 "immediate_operand" "FQ"))
- (clobber (match_operand:SI 2 "register_operand" "=&z"))])]
- ""
- "")
-
-;; ------------------------------------------------------------------------
-;; Define the real conditional branch instructions.
-;; ------------------------------------------------------------------------
-
-(define_insn "branch_true"
- [(set (pc) (if_then_else (ne (reg:SI 18) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_branch (1, insn, operands);"
- [(set_attr "type" "cbranch")])
-
-(define_insn "branch_false"
- [(set (pc) (if_then_else (eq (reg:SI 18) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_branch (0, insn, operands);"
- [(set_attr "type" "cbranch")])
-
-(define_insn "inverse_branch_true"
- [(set (pc) (if_then_else (ne (reg:SI 18) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_branch (0, insn, operands);"
- [(set_attr "type" "cbranch")])
-
-(define_insn "inverse_branch_false"
- [(set (pc) (if_then_else (eq (reg:SI 18) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_branch (1, insn, operands);"
- [(set_attr "type" "cbranch")])
-
-;; Conditional branch insns
-
-(define_expand "beq"
- [(set (reg:SI 18) (eq:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "from_compare (operands, EQ);")
-
-; There is no bne compare, so we reverse the branch arms.
-
-(define_expand "bne"
- [(set (reg:SI 18) (eq:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "from_compare (operands, NE);")
-
-(define_expand "bgt"
- [(set (reg:SI 18) (gt:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "from_compare (operands, GT);")
-
-(define_expand "blt"
- [(set (reg:SI 18) (ge:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "
-{
- if (GET_MODE (sh_compare_op0) == SFmode)
- {
- rtx tmp = sh_compare_op0;
- sh_compare_op0 = sh_compare_op1;
- sh_compare_op1 = tmp;
- emit_insn (gen_bgt (operands[0]));
- DONE;
- }
- from_compare (operands, LT);
-}")
-
-(define_expand "ble"
- [(set (reg:SI 18) (gt:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "from_compare (operands, LE);")
-
-(define_expand "bge"
- [(set (reg:SI 18) (ge:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (GET_MODE (sh_compare_op0) == SFmode)
- {
- rtx tmp = sh_compare_op0;
- sh_compare_op0 = sh_compare_op1;
- sh_compare_op1 = tmp;
- emit_insn (gen_ble (operands[0]));
- DONE;
- }
- from_compare (operands, GE);
-}")
-
-(define_expand "bgtu"
- [(set (reg:SI 18) (gtu:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "from_compare (operands, GTU); ")
-
-(define_expand "bltu"
- [(set (reg:SI 18) (geu:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "from_compare (operands, LTU);")
-
-(define_expand "bgeu"
- [(set (reg:SI 18) (geu:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "from_compare (operands, GEU);")
-
-(define_expand "bleu"
- [(set (reg:SI 18) (gtu:SI (match_dup 1) (match_dup 2)))
- (set (pc)
- (if_then_else (ne (reg:SI 18) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "from_compare (operands, LEU);")
-
-;; ------------------------------------------------------------------------
-;; Jump and linkage insns
-;; ------------------------------------------------------------------------
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
-{
- /* The length is 16 if the delay slot is unfilled. */
- if (get_attr_length(insn) >= 14)
- return output_far_jump(insn, operands[0]);
- else
- return \"bra %l0%#\";
-}"
- [(set_attr "type" "jump")
- (set_attr "needs_delay_slot" "yes")])
-
-(define_insn "calli"
- [(call (mem:SI (match_operand:SI 0 "arith_reg_operand" "r"))
- (match_operand 1 "" ""))
- (clobber (reg:SI 17))]
- ""
- "jsr @%0%#"
- [(set_attr "type" "call")
- (set_attr "needs_delay_slot" "yes")])
-
-(define_insn "call_valuei"
- [(set (match_operand 0 "" "=rf")
- (call (mem:SI (match_operand:SI 1 "arith_reg_operand" "r"))
- (match_operand 2 "" "")))
- (clobber (reg:SI 17))]
- ""
- "jsr @%1%#"
- [(set_attr "type" "call")
- (set_attr "needs_delay_slot" "yes")])
-
-(define_expand "call"
- [(parallel [(call (mem:SI (match_operand 0 "arith_reg_operand" ""))
- (match_operand 1 "" ""))
- (clobber (reg:SI 17))])]
- ""
- "operands[0] = force_reg (SImode, XEXP (operands[0], 0));")
-
-(define_expand "call_value"
- [(parallel [(set (match_operand 0 "arith_reg_operand" "")
- (call (mem:SI (match_operand 1 "arith_reg_operand" ""))
- (match_operand 2 "" "")))
- (clobber (reg:SI 17))])]
- ""
- "operands[1] = force_reg (SImode, XEXP (operands[1], 0));")
-
-(define_insn "indirect_jump"
- [(set (pc)
- (match_operand:SI 0 "arith_reg_operand" "r"))]
- ""
- "jmp @%0%#"
- [(set_attr "needs_delay_slot" "yes")])
-
-;; This might seem redundant, but it helps us distinguish case table jumps
-;; which can be present in structured code from indirect jumps which can not
-;; be present in structured code. This allows -fprofile-arcs to work.
-
-(define_insn "*casesi_jump"
- [(set (pc)
- (match_operand:SI 0 "arith_reg_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jmp @%0%#"
- [(set_attr "needs_delay_slot" "yes")])
-
-;; Call subroutine returning any type.
-;; ??? This probably doesn't work.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- "TARGET_SH3E"
- "
-{
- int i;
-
- emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; ------------------------------------------------------------------------
-;; Misc insns
-;; ------------------------------------------------------------------------
-
-(define_insn "dect"
- [(set (reg:SI 18)
- (eq:SI (match_operand:SI 0 "arith_reg_operand" "+r") (const_int 1)))
- (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))]
- "TARGET_SH2"
- "dt %0")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-;; Load address of a label. This is only generated by the casesi expand.
-;; This must use unspec, because this only works immediately before a casesi.
-
-(define_insn "mova"
- [(set (reg:SI 0)
- (unspec [(label_ref (match_operand 0 "" ""))] 1))]
- ""
- "mova %O0,r0"
- [(set_attr "in_delay_slot" "no")])
-
-;; case instruction for switch statements.
-
-;; Operand 0 is index
-;; operand 1 is the minimum bound
-;; operand 2 is the maximum bound - minimum bound + 1
-;; operand 3 is CODE_LABEL for the table;
-;; operand 4 is the CODE_LABEL to go to if index out of range.
-
-;; ??? There should be a barrier after the jump at the end.
-
-(define_expand "casesi"
- [(set (match_dup 5) (match_operand:SI 0 "arith_reg_operand" ""))
- (set (match_dup 5) (minus:SI (match_dup 5)
- (match_operand:SI 1 "arith_operand" "")))
- (set (reg:SI 18)
- (gtu:SI (match_dup 5)
- (match_operand:SI 2 "arith_reg_operand" "")))
- (set (pc)
- (if_then_else (ne (reg:SI 18)
- (const_int 0))
- (label_ref (match_operand 4 "" ""))
- (pc)))
- (set (match_dup 6) (match_dup 5))
- (set (match_dup 6) (ashift:SI (match_dup 6) (match_dup 7)))
- (set (reg:SI 0) (unspec [(label_ref (match_operand 3 "" ""))] 1))
- (parallel [(set (reg:SI 0) (plus:SI (reg:SI 0)
- (mem:HI (plus:SI (reg:SI 0)
- (match_dup 6)))))
- (set (match_dup 6) (mem:HI (plus:SI (reg:SI 0) (match_dup 6))))])
- (parallel [(set (pc) (reg:SI 0))
- (use (label_ref (match_dup 3)))])]
- ""
- "
-{
- operands[1] = copy_to_mode_reg (SImode, operands[1]);
- operands[2] = copy_to_mode_reg (SImode, operands[2]);
- operands[5] = gen_reg_rtx (SImode);
- operands[6] = gen_reg_rtx (SImode);
- operands[7] = GEN_INT (TARGET_BIGTABLE ? 2 : 1);
-}")
-
-(define_insn "casesi_worker"
- [(set (reg:SI 0)
- (plus:SI (reg:SI 0)
- (mem:HI (plus:SI (reg:SI 0)
- (match_operand:SI 0 "arith_reg_operand" "+r")))))
- (set (match_dup 0) (mem:HI (plus:SI (reg:SI 0)
- (match_dup 0))))]
- ""
- "*
-{
- if (TARGET_BIGTABLE)
- return \"mov.l @(r0,%0),%0\;add %0,r0\";
- else
- return \"mov.w @(r0,%0),%0\;add %0,r0\";
-}"
- [(set_attr "length" "4")])
-
-(define_insn "return"
- [(return)]
- "reload_completed"
- "%@ %#"
- [(set_attr "type" "return")
- (set_attr "needs_delay_slot" "yes")])
-
-(define_expand "prologue"
- [(const_int 0)]
- ""
- "sh_expand_prologue (); DONE;")
-
-(define_expand "epilogue"
- [(return)]
- ""
- "sh_expand_epilogue ();")
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- ""
- [(set_attr "length" "0")])
-
-;; ------------------------------------------------------------------------
-;; Scc instructions
-;; ------------------------------------------------------------------------
-
-(define_insn "movt"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (eq:SI (reg:SI 18) (const_int 1)))]
- ""
- "movt %0")
-
-(define_expand "seq"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = prepare_scc_operands (EQ);")
-
-(define_expand "slt"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = prepare_scc_operands (LT);")
-
-(define_expand "sle"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (GET_MODE (sh_compare_op0) == SFmode)
- {
- emit_insn (gen_sgt (operands[0]));
- emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx));
- DONE;
- }
- operands[1] = prepare_scc_operands (LE);
-}")
-
-(define_expand "sgt"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = prepare_scc_operands (GT);")
-
-(define_expand "sge"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (match_dup 1))]
- ""
- "
-{
- if (GET_MODE (sh_compare_op0) == SFmode)
- {
- emit_insn (gen_slt (operands[0]));
- emit_insn (gen_xorsi3 (operands[0], operands[0], const1_rtx));
- DONE;
- }
- operands[1] = prepare_scc_operands (GE);
-}")
-
-(define_expand "sgtu"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = prepare_scc_operands (GTU);")
-
-(define_expand "sltu"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = prepare_scc_operands (LTU);")
-
-(define_expand "sleu"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = prepare_scc_operands (LEU);")
-
-(define_expand "sgeu"
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (match_dup 1))]
- ""
- "operands[1] = prepare_scc_operands (GEU);")
-
-;; sne moves the complement of the T reg to DEST like this:
-;; cmp/eq ...
-;; mov #-1,temp
-;; negc temp,dest
-;; This is better than xoring compare result with 1 because it does
-;; not require r0 and further, the -1 may be CSE-ed or lifted out of a
-;; loop.
-
-(define_expand "sne"
- [(set (match_dup 2) (const_int -1))
- (parallel [(set (match_operand:SI 0 "arith_reg_operand" "")
- (neg:SI (plus:SI (match_dup 1)
- (match_dup 2))))
- (set (reg:SI 18)
- (ne:SI (ior:SI (match_dup 1) (match_dup 2))
- (const_int 0)))])]
- ""
- "
-{
- operands[1] = prepare_scc_operands (EQ);
- operands[2] = gen_reg_rtx (SImode);
-}")
-
-;; Recognize mov #-1/negc/neg sequence, and change it to movt/add #-1.
-;; This prevents a regression that occured when we switched from xor to
-;; mov/neg for sne.
-
-(define_split
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (plus:SI (reg:SI 18)
- (const_int -1)))]
- ""
- [(set (match_dup 0) (eq:SI (reg:SI 18) (const_int 1)))
- (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))]
- "")
-
-;; -------------------------------------------------------------------------
-;; Instructions to cope with inline literal tables
-;; -------------------------------------------------------------------------
-
-; 2 byte integer in line
-
-(define_insn "consttable_2"
- [(unspec_volatile [(match_operand:SI 0 "general_operand" "=g")] 2)]
- ""
- "*
-{
- assemble_integer (operands[0], 2, 1);
- return \"\";
-}"
- [(set_attr "length" "2")
- (set_attr "in_delay_slot" "no")])
-
-; 4 byte integer in line
-
-(define_insn "consttable_4"
- [(unspec_volatile [(match_operand:SI 0 "general_operand" "=g")] 4)]
- ""
- "*
-{
- assemble_integer (operands[0], 4, 1);
- return \"\";
-}"
- [(set_attr "length" "4")
- (set_attr "in_delay_slot" "no")])
-
-; 8 byte integer in line
-
-(define_insn "consttable_8"
- [(unspec_volatile [(match_operand:SI 0 "general_operand" "=g")] 6)]
- ""
- "*
-{
- assemble_integer (operands[0], 8, 1);
- return \"\";
-}"
- [(set_attr "length" "8")
- (set_attr "in_delay_slot" "no")])
-
-; 4 byte floating point
-
-(define_insn "consttable_sf"
- [(unspec_volatile [(match_operand:SF 0 "general_operand" "=g")] 4)]
- ""
- "*
-{
- union real_extract u;
- bcopy ((char *) &CONST_DOUBLE_LOW (operands[0]), (char *) &u, sizeof u);
- assemble_real (u.d, SFmode);
- return \"\";
-}"
- [(set_attr "length" "4")
- (set_attr "in_delay_slot" "no")])
-
-; 8 byte floating point
-
-(define_insn "consttable_df"
- [(unspec_volatile [(match_operand:DF 0 "general_operand" "=g")] 6)]
- ""
- "*
-{
- union real_extract u;
- bcopy ((char *) &CONST_DOUBLE_LOW (operands[0]), (char *) &u, sizeof u);
- assemble_real (u.d, DFmode);
- return \"\";
-}"
- [(set_attr "length" "8")
- (set_attr "in_delay_slot" "no")])
-
-; align to a two byte boundary
-
-(define_insn "align_2"
- [(unspec_volatile [(const_int 0)] 10)]
- ""
- ".align 1"
- [(set_attr "length" "0")
- (set_attr "in_delay_slot" "no")])
-
-; align to a four byte boundary
-
-(define_insn "align_4"
- [(unspec_volatile [(const_int 0)] 5)]
- ""
- ".align 2"
- [(set_attr "in_delay_slot" "no")])
-
-; emitted at the end of the literal table, used to emit the
-; 32bit branch labels if needed.
-
-(define_insn "consttable_end"
- [(unspec_volatile [(const_int 0)] 11)]
- ""
- "* return output_jump_label_table ();"
- [(set_attr "in_delay_slot" "no")])
-
-;; -------------------------------------------------------------------------
-;; Misc
-;; -------------------------------------------------------------------------
-
-;; String/block move insn.
-
-(define_expand "movstrsi"
- [(parallel [(set (mem:BLK (match_operand:BLK 0 "" ""))
- (mem:BLK (match_operand:BLK 1 "" "")))
- (use (match_operand:SI 2 "nonmemory_operand" ""))
- (use (match_operand:SI 3 "immediate_operand" ""))
- (clobber (reg:SI 17))
- (clobber (reg:SI 4))
- (clobber (reg:SI 5))
- (clobber (reg:SI 0))])]
- ""
- "
-{
- if(expand_block_move (operands))
- DONE;
- else FAIL;
-}")
-
-(define_insn "block_move_real"
- [(parallel [(set (mem:BLK (reg:SI 4))
- (mem:BLK (reg:SI 5)))
- (use (match_operand:SI 0 "arith_reg_operand" "r"))
- (clobber (reg:SI 17))
- (clobber (reg:SI 0))])]
- ""
- "jsr @%0%#"
- [(set_attr "type" "sfunc")
- (set_attr "needs_delay_slot" "yes")])
-
-(define_insn "block_lump_real"
- [(parallel [(set (mem:BLK (reg:SI 4))
- (mem:BLK (reg:SI 5)))
- (use (match_operand:SI 0 "arith_reg_operand" "r"))
- (use (reg:SI 6))
- (clobber (reg:SI 17))
- (clobber (reg:SI 4))
- (clobber (reg:SI 5))
- (clobber (reg:SI 6))
- (clobber (reg:SI 0))])]
- ""
- "jsr @%0%#"
- [(set_attr "type" "sfunc")
- (set_attr "needs_delay_slot" "yes")])
-
-;; -------------------------------------------------------------------------
-;; Floating point instructions.
-;; -------------------------------------------------------------------------
-
-;; ??? All patterns should have a type attribute.
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "arith_reg_operand" "=f")
- (plus:SF (match_operand:SF 1 "arith_reg_operand" "%0")
- (match_operand:SF 2 "arith_reg_operand" "f")))]
- "TARGET_SH3E"
- "fadd %2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "arith_reg_operand" "=f")
- (minus:SF (match_operand:SF 1 "arith_reg_operand" "0")
- (match_operand:SF 2 "arith_reg_operand" "f")))]
- "TARGET_SH3E"
- "fsub %2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "arith_reg_operand" "=f")
- (mult:SF (match_operand:SF 1 "arith_reg_operand" "%0")
- (match_operand:SF 2 "arith_reg_operand" "f")))]
- "TARGET_SH3E"
- "fmul %2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "*macsf3"
- [(set (match_operand:SF 0 "arith_reg_operand" "=f")
- (plus:SF (mult:SF (match_operand:SF 1 "arith_reg_operand" "%w")
- (match_operand:SF 2 "arith_reg_operand" "f"))
- (match_operand:SF 3 "arith_reg_operand" "0")))]
- "TARGET_SH3E"
- "fmac fr0,%2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "arith_reg_operand" "=f")
- (div:SF (match_operand:SF 1 "arith_reg_operand" "0")
- (match_operand:SF 2 "arith_reg_operand" "f")))]
- "TARGET_SH3E"
- "fdiv %2,%0"
- [(set_attr "type" "fdiv")])
-
-;; ??? This is the right solution, but it fails because the movs[if] patterns
-;; silently clobber FPUL (r22) for int<->fp moves. Thus we can not explicitly
-;; use FPUL here.
-;;
-;;(define_expand "floatsisf2"
-;; [(set (reg:SI 22)
-;; (match_operand:SI 1 "arith_reg_operand" ""))
-;; (set (match_operand:SF 0 "arith_reg_operand" "")
-;; (float:SF (reg:SI 22)))]
-;; "TARGET_SH3E"
-;; "")
-;;
-;;(define_insn "*floatsisf"
-;; [(set (match_operand:SF 0 "arith_reg_operand" "=f")
-;; (float:SF (reg:SI 22)))]
-;; "TARGET_SH3E"
-;; "float fpul,%0")
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "arith_reg_operand" "=f")
- (float:SF (match_operand:SI 1 "arith_reg_operand" "r")))]
- "TARGET_SH3E"
- "lds %1,fpul\;float fpul,%0"
- [(set_attr "length" "4")
- (set_attr "type" "fp")])
-
-;; ??? This is the right solution, but it fails because the movs[if] patterns
-;; silently clobber FPUL (r22) for int<->fp moves. Thus we can not explicitly
-;; use FPUL here.
-;;
-;;(define_expand "fix_truncsfsi2"
-;; [(set (reg:SI 22)
-;; (fix:SI (match_operand:SF 1 "arith_reg_operand" "f")))
-;; (set (match_operand:SI 0 "arith_reg_operand" "=r")
-;; (reg:SI 22))]
-;; "TARGET_SH3E"
-;; "")
-;;
-;;(define_insn "*fixsfsi"
-;; [(set (reg:SI 22)
-;; (fix:SI (match_operand:SF 0 "arith_reg_operand" "f")))]
-;; "TARGET_SH3E"
-;; "ftrc %0,fpul")
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (fix:SI (match_operand:SF 1 "arith_reg_operand" "f")))]
- "TARGET_SH3E"
- "ftrc %1,fpul\;sts fpul,%0"
- [(set_attr "length" "4")
- (set_attr "type" "move")])
-
-;; ??? This should be SFmode not SImode in the compare, but that would
-;; require fixing the branch patterns too.
-(define_insn "*cmpgtsf_t"
- [(set (reg:SI 18) (gt:SI (match_operand:SF 0 "arith_reg_operand" "f")
- (match_operand:SF 1 "arith_reg_operand" "f")))]
- "TARGET_SH3E"
- "fcmp/gt %1,%0"
- [(set_attr "type" "fp")])
-
-;; ??? This should be SFmode not SImode in the compare, but that would
-;; require fixing the branch patterns too.
-(define_insn "*cmpeqsf_t"
- [(set (reg:SI 18) (eq:SI (match_operand:SF 0 "arith_reg_operand" "f")
- (match_operand:SF 1 "arith_reg_operand" "f")))]
- "TARGET_SH3E"
- "fcmp/eq %1,%0"
- [(set_attr "type" "fp")])
-
-(define_expand "cmpsf"
- [(set (reg:SI 18) (compare (match_operand:SF 0 "arith_operand" "")
- (match_operand:SF 1 "arith_operand" "")))]
- "TARGET_SH3E"
- "
-{
- sh_compare_op0 = operands[0];
- sh_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "arith_reg_operand" "=f")
- (neg:SF (match_operand:SF 1 "arith_reg_operand" "0")))]
- "TARGET_SH3E"
- "fneg %0"
- [(set_attr "type" "fp")])
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "arith_reg_operand" "=f")
- (sqrt:DF (match_operand:SF 1 "arith_reg_operand" "0")))]
- "TARGET_SH3E"
- "fsqrt %0"
- [(set_attr "type" "fdiv")])
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "arith_reg_operand" "=f")
- (abs:SF (match_operand:SF 1 "arith_reg_operand" "0")))]
- "TARGET_SH3E"
- "fabs %0"
- [(set_attr "type" "fp")])
-
-;; Bit field extract patterns. These give better code for packed bitfields,
-;; because they allow auto-increment addresses to be generated.
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "")
- (match_operand:SI 1 "immediate_operand" "")
- (match_operand:SI 2 "immediate_operand" ""))
- (match_operand:SI 3 "general_operand" ""))]
- "! TARGET_LITTLE_ENDIAN"
- "
-{
- rtx addr_target, orig_address, shift_reg;
- HOST_WIDE_INT size;
-
- /* ??? expmed doesn't care for non-register predicates. */
- if (! memory_operand (operands[0], VOIDmode)
- || ! immediate_operand (operands[1], VOIDmode)
- || ! immediate_operand (operands[2], VOIDmode)
- || ! general_operand (operands[3], VOIDmode))
- FAIL;
- /* If this isn't a 16 / 24 / 32 bit field, or if
- it doesn't start on a byte boundary, then fail. */
- size = INTVAL (operands[1]);
- if (size < 16 || size > 32 || size % 8 != 0
- || (INTVAL (operands[2]) % 8) != 0)
- FAIL;
-
- size /= 8;
- orig_address = XEXP (operands[0], 0);
- addr_target = gen_reg_rtx (SImode);
- shift_reg = gen_reg_rtx (SImode);
- emit_insn (gen_movsi (shift_reg, operands[3]));
- emit_insn (gen_addsi3 (addr_target, orig_address, GEN_INT (size - 1)));
-
- operands[0] = change_address (operands[0], QImode, addr_target);
- emit_insn (gen_movqi (operands[0], gen_rtx (SUBREG, QImode, shift_reg, 0)));
-
- while (size -= 1)
- {
- emit_insn (gen_lshrsi3_k (shift_reg, shift_reg, GEN_INT (8)));
- emit_insn (gen_addsi3 (addr_target, addr_target, GEN_INT (-1)));
- emit_insn (gen_movqi (operands[0],
- gen_rtx (SUBREG, QImode, shift_reg, 0)));
- }
-
- DONE;
-}")
-
-;; -------------------------------------------------------------------------
-;; Peepholes
-;; -------------------------------------------------------------------------
-
-;; This matches cases where a stack pointer increment at the start of the
-;; epilogue combines with a stack slot read loading the return value.
-
-(define_peephole
- [(set (match_operand:SI 0 "arith_reg_operand" "")
- (mem:SI (match_operand:SI 1 "arith_reg_operand" "")))
- (set (match_dup 1) (plus:SI (match_dup 1) (const_int 4)))]
- "REGNO (operands[1]) != REGNO (operands[0])"
- "mov.l @%1+,%0")
-
-;; See the comment on the dt combiner pattern above.
-
-(define_peephole
- [(set (match_operand:SI 0 "arith_reg_operand" "=r")
- (plus:SI (match_dup 0)
- (const_int -1)))
- (set (reg:SI 18)
- (eq:SI (match_dup 0)
- (const_int 0)))]
- "TARGET_SH2"
- "dt %0")
-
-;; These convert sequences such as `mov #k,r0; add r15,r0; mov.l @r0,rn'
-;; to `mov #k,r0; mov.l @(r0,r15),rn'. These sequences are generated by
-;; reload when the constant is too large for a reg+offset address.
-
-;; ??? We would get much better code if this was done in reload. This would
-;; require modifying find_reloads_address to recognize that if the constant
-;; is out-of-range for an immediate add, then we get better code by reloading
-;; the constant into a register than by reloading the sum into a register,
-;; since the former is one instruction shorter if the address does not need
-;; to be offsettable. Unfortunately this does not work, because there is
-;; only one register, r0, that can be used as an index register. This register
-;; is also the function return value register. So, if we try to force reload
-;; to use double-reg addresses, then we end up with some instructions that
-;; need to use r0 twice. The only way to fix this is to change the calling
-;; convention so that r0 is not used to return values.
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (mem:SI (match_dup 0))
- (match_operand:SI 2 "general_movsrc_operand" ""))]
- "REGNO (operands[0]) == 0 && reg_unused_after (operands[0], insn)"
- "mov.l %2,@(%0,%1)")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (match_operand:SI 2 "general_movdst_operand" "")
- (mem:SI (match_dup 0)))]
- "REGNO (operands[0]) == 0 && reg_unused_after (operands[0], insn)"
- "mov.l @(%0,%1),%2")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (mem:HI (match_dup 0))
- (match_operand:HI 2 "general_movsrc_operand" ""))]
- "REGNO (operands[0]) == 0 && reg_unused_after (operands[0], insn)"
- "mov.w %2,@(%0,%1)")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (match_operand:HI 2 "general_movdst_operand" "")
- (mem:HI (match_dup 0)))]
- "REGNO (operands[0]) == 0 && reg_unused_after (operands[0], insn)"
- "mov.w @(%0,%1),%2")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (mem:QI (match_dup 0))
- (match_operand:QI 2 "general_movsrc_operand" ""))]
- "REGNO (operands[0]) == 0 && reg_unused_after (operands[0], insn)"
- "mov.b %2,@(%0,%1)")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (match_operand:QI 2 "general_movdst_operand" "")
- (mem:QI (match_dup 0)))]
- "REGNO (operands[0]) == 0 && reg_unused_after (operands[0], insn)"
- "mov.b @(%0,%1),%2")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (mem:SF (match_dup 0))
- (match_operand:SF 2 "general_movsrc_operand" ""))]
- "REGNO (operands[0]) == 0
- && ((GET_CODE (operands[2]) == REG && REGNO (operands[2]) < 16)
- || (GET_CODE (operands[2]) == SUBREG
- && REGNO (SUBREG_REG (operands[2])) < 16))
- && reg_unused_after (operands[0], insn)"
- "mov.l %2,@(%0,%1)")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (match_operand:SF 2 "general_movdst_operand" "")
-
- (mem:SF (match_dup 0)))]
- "REGNO (operands[0]) == 0
- && ((GET_CODE (operands[2]) == REG && REGNO (operands[2]) < 16)
- || (GET_CODE (operands[2]) == SUBREG
- && REGNO (SUBREG_REG (operands[2])) < 16))
- && reg_unused_after (operands[0], insn)"
- "mov.l @(%0,%1),%2")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (mem:SF (match_dup 0))
- (match_operand:SF 2 "general_movsrc_operand" ""))]
- "REGNO (operands[0]) == 0
- && ((GET_CODE (operands[2]) == REG && REGNO (operands[2]) >= FIRST_FP_REG)
- || (GET_CODE (operands[2]) == SUBREG
- && REGNO (SUBREG_REG (operands[2])) >= FIRST_FP_REG))
- && reg_unused_after (operands[0], insn)"
- "fmov.s %2,@(%0,%1)")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 0) (match_operand:SI 1 "register_operand" "r")))
- (set (match_operand:SF 2 "general_movdst_operand" "")
-
- (mem:SF (match_dup 0)))]
- "REGNO (operands[0]) == 0
- && ((GET_CODE (operands[2]) == REG && REGNO (operands[2]) >= FIRST_FP_REG)
- || (GET_CODE (operands[2]) == SUBREG
- && REGNO (SUBREG_REG (operands[2])) >= FIRST_FP_REG))
- && reg_unused_after (operands[0], insn)"
- "fmov.s @(%0,%1),%2")
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
deleted file mode 100644
index 7f925529c4f..00000000000
--- a/gcc/config/sh/t-sh
+++ /dev/null
@@ -1,29 +0,0 @@
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = sh/lib1funcs.asm
-LIB1ASMFUNCS = _ashiftrt _ashiftrt_n _ashiftlt _lshiftrt _movstr \
- _mulsi3 _sdivsi3 _udivsi3
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#ifdef __LITTLE_ENDIAN__' > dp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >>dp-bit.c
- echo '#endif' >> dp-bit.c
- cat $(srcdir)/config/fp-bit.c >> dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
- echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
- echo '#endif' >> fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-MULTILIB_OPTIONS= ml m2/m3e
-MULTILIB_DIRNAMES=
-MULTILIB_MATCHES = m2=m3
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/sh/xm-sh.h b/gcc/config/sh/xm-sh.h
deleted file mode 100644
index 3d8ef8410b8..00000000000
--- a/gcc/config/sh/xm-sh.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Configuration for GNU C-compiler for Hitachi SH.
- Copyright (C) 1993 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-
-/* If compiled with GNU C, use the built-in alloca. */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#endif
-
-/* We have the vprintf function. */
-#define HAVE_VPRINTF 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
diff --git a/gcc/config/sparc/aout.h b/gcc/config/sparc/aout.h
deleted file mode 100644
index 478d710f82f..00000000000
--- a/gcc/config/sparc/aout.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SPARC using a.out.
- Copyright (C) 1994, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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 "sparc/sparc.h" /* SPARC definitions */
-#include "aoutos.h" /* A.out definitions */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dsparc -Acpu(sparc) -Amachine(sparc)"
diff --git a/gcc/config/sparc/bsd.h b/gcc/config/sparc/bsd.h
deleted file mode 100644
index 761abe2671b..00000000000
--- a/gcc/config/sparc/bsd.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "sparc/sparc.h"
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:gcrt0.o%s}%{!p:crt0.o%s}}"
diff --git a/gcc/config/sparc/gmon-sol2.c b/gcc/config/sparc/gmon-sol2.c
deleted file mode 100644
index 9b41c649297..00000000000
--- a/gcc/config/sparc/gmon-sol2.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* Mangled into a form that works on Sparc Solaris 2 by Mark Eichin
- * for Cygnus Support, July 1992.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91";
-#endif /* not lint */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <unistd.h>
-
-#if 0
-#include "sparc/gmon.h"
-#else
-struct phdr {
- char *lpc;
- char *hpc;
- int ncnt;
-};
-#define HISTFRACTION 2
-#define HISTCOUNTER unsigned short
-#define HASHFRACTION 1
-#define ARCDENSITY 2
-#define MINARCS 50
-struct tostruct {
- char *selfpc;
- long count;
- unsigned short link;
-};
-struct rawarc {
- unsigned long raw_frompc;
- unsigned long raw_selfpc;
- long raw_count;
-};
-#define ROUNDDOWN(x,y) (((x)/(y))*(y))
-#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
-
-#endif
-
-/* extern mcount() asm ("mcount"); */
-/*extern*/ char *minbrk /* asm ("minbrk") */;
-
- /*
- * froms is actually a bunch of unsigned shorts indexing tos
- */
-static int profiling = 3;
-static unsigned short *froms;
-static struct tostruct *tos = 0;
-static long tolimit = 0;
-static char *s_lowpc = 0;
-static char *s_highpc = 0;
-static unsigned long s_textsize = 0;
-
-static int ssiz;
-static char *sbuf;
-static int s_scale;
- /* see profil(2) where this is describe (incorrectly) */
-#define SCALE_1_TO_1 0x10000L
-
-#define MSG "No space for profiling buffer(s)\n"
-
-monstartup(lowpc, highpc)
- char *lowpc;
- char *highpc;
-{
- int monsize;
- char *buffer;
- register int o;
-
- /*
- * round lowpc and highpc to multiples of the density we're using
- * so the rest of the scaling (here and in gprof) stays in ints.
- */
- lowpc = (char *)
- ROUNDDOWN((unsigned)lowpc, HISTFRACTION*sizeof(HISTCOUNTER));
- s_lowpc = lowpc;
- highpc = (char *)
- ROUNDUP((unsigned)highpc, HISTFRACTION*sizeof(HISTCOUNTER));
- s_highpc = highpc;
- s_textsize = highpc - lowpc;
- monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr);
- buffer = sbrk( monsize );
- if ( buffer == (char *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- return;
- }
- froms = (unsigned short *) sbrk( s_textsize / HASHFRACTION );
- if ( froms == (unsigned short *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- froms = 0;
- return;
- }
- tolimit = s_textsize * ARCDENSITY / 100;
- if ( tolimit < MINARCS ) {
- tolimit = MINARCS;
- } else if ( tolimit > 65534 ) {
- tolimit = 65534;
- }
- tos = (struct tostruct *) sbrk( tolimit * sizeof( struct tostruct ) );
- if ( tos == (struct tostruct *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- froms = 0;
- tos = 0;
- return;
- }
- minbrk = sbrk(0);
- tos[0].link = 0;
- sbuf = buffer;
- ssiz = monsize;
- ( (struct phdr *) buffer ) -> lpc = lowpc;
- ( (struct phdr *) buffer ) -> hpc = highpc;
- ( (struct phdr *) buffer ) -> ncnt = ssiz;
- monsize -= sizeof(struct phdr);
- if ( monsize <= 0 )
- return;
- o = highpc - lowpc;
- if( monsize < o )
-#ifndef hp300
- s_scale = ( (float) monsize / o ) * SCALE_1_TO_1;
-#else /* avoid floating point */
- {
- int quot = o / monsize;
-
- if (quot >= 0x10000)
- s_scale = 1;
- else if (quot >= 0x100)
- s_scale = 0x10000 / quot;
- else if (o >= 0x800000)
- s_scale = 0x1000000 / (o / (monsize >> 8));
- else
- s_scale = 0x1000000 / ((o << 8) / monsize);
- }
-#endif
- else
- s_scale = SCALE_1_TO_1;
- moncontrol(1);
-}
-
-void
-_mcleanup()
-{
- int fd;
- int fromindex;
- int endfrom;
- char *frompc;
- int toindex;
- struct rawarc rawarc;
- char *profdir;
- char *proffile;
- char *progname;
- char buf[PATH_MAX];
- extern char **___Argv;
-
- moncontrol(0);
-
- if ((profdir = getenv("PROFDIR")) != NULL) {
- /* If PROFDIR contains a null value, no profiling output is produced */
- if (*profdir == '\0') {
- return;
- }
-
- progname=strrchr(___Argv[0], '/');
- if (progname == NULL)
- progname=___Argv[0];
- else
- progname++;
-
- sprintf(buf, "%s/%d.%s", profdir, getpid(), progname);
- proffile = buf;
- } else {
- proffile = "gmon.out";
- }
-
- fd = creat( proffile, 0666 );
- if ( fd < 0 ) {
- perror( proffile );
- return;
- }
-# ifdef DEBUG
- fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
-# endif DEBUG
- write( fd , sbuf , ssiz );
- endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
- for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) {
- if ( froms[fromindex] == 0 ) {
- continue;
- }
- frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms));
- for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) {
-# ifdef DEBUG
- fprintf( stderr ,
- "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
- frompc , tos[toindex].selfpc , tos[toindex].count );
-# endif DEBUG
- rawarc.raw_frompc = (unsigned long) frompc;
- rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
- rawarc.raw_count = tos[toindex].count;
- write( fd , &rawarc , sizeof rawarc );
- }
- }
- close( fd );
-}
-
-/*
- * The Sparc stack frame is only held together by the frame pointers
- * in the register windows. According to the SVR4 SPARC ABI
- * Supplement, Low Level System Information/Operating System
- * Interface/Software Trap Types, a type 3 trap will flush all of the
- * register windows to the stack, which will make it possible to walk
- * the frames and find the return addresses.
- * However, it seems awfully expensive to incur a trap (system
- * call) for every function call. It turns out that "call" simply puts
- * the return address in %o7 expecting the "save" in the procedure to
- * shift it into %i7; this means that before the "save" occurs, %o7
- * contains the address of the call to mcount, and %i7 still contains
- * the caller above that. The asm mcount here simply saves those
- * registers in argument registers and branches to internal_mcount,
- * simulating a call with arguments.
- * Kludges:
- * 1) the branch to internal_mcount is hard coded; it should be
- * possible to tell asm to use the assembler-name of a symbol.
- * 2) in theory, the function calling mcount could have saved %i7
- * somewhere and reused the register; in practice, I *think* this will
- * break longjmp (and maybe the debugger) but I'm not certain. (I take
- * some comfort in the knowledge that it will break the native mcount
- * as well.)
- * 3) if builtin_return_address worked, this could be portable.
- * However, it would really have to be optimized for arguments of 0
- * and 1 and do something like what we have here in order to avoid the
- * trap per function call performance hit.
- * 4) the atexit and monsetup calls prevent this from simply
- * being a leaf routine that doesn't do a "save" (and would thus have
- * access to %o7 and %i7 directly) but the call to write() at the end
- * would have also prevented this.
- *
- * -- [eichin:19920702.1107EST]
- */
-
-/* i7 == last ret, -> frompcindex */
-/* o7 == current ret, -> selfpc */
-/* Solaris 2 libraries use _mcount. */
-asm(".global _mcount; _mcount: mov %i7,%o1; mov %o7,%o0;b,a internal_mcount");
-/* This is for compatibility with old versions of gcc which used mcount. */
-asm(".global mcount; mcount: mov %i7,%o1; mov %o7,%o0;b,a internal_mcount");
-
-static internal_mcount(selfpc, frompcindex)
- register char *selfpc;
- register unsigned short *frompcindex;
-{
- register char *nextframe;
- register struct tostruct *top;
- register struct tostruct *prevtop;
- register long toindex;
- static char already_setup;
-
- /*
- * find the return address for mcount,
- * and the return address for mcount's caller.
- */
-
- if(!already_setup) {
- extern etext();
- already_setup = 1;
- monstartup(0, etext);
-#ifdef USE_ONEXIT
- on_exit(_mcleanup, 0);
-#else
- atexit(_mcleanup);
-#endif
- }
- /*
- * check that we are profiling
- * and that we aren't recursively invoked.
- */
- if (profiling) {
- goto out;
- }
- profiling++;
- /*
- * check that frompcindex is a reasonable pc value.
- * for example: signal catchers get called from the stack,
- * not from text space. too bad.
- */
- frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc);
- if ((unsigned long)frompcindex > s_textsize) {
- goto done;
- }
- frompcindex =
- &froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))];
- toindex = *frompcindex;
- if (toindex == 0) {
- /*
- * first time traversing this arc
- */
- toindex = ++tos[0].link;
- if (toindex >= tolimit) {
- goto overflow;
- }
- *frompcindex = toindex;
- top = &tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = 0;
- goto done;
- }
- top = &tos[toindex];
- if (top->selfpc == selfpc) {
- /*
- * arc at front of chain; usual case.
- */
- top->count++;
- goto done;
- }
- /*
- * have to go looking down chain for it.
- * top points to what we are looking at,
- * prevtop points to previous top.
- * we know it is not at the head of the chain.
- */
- for (; /* goto done */; ) {
- if (top->link == 0) {
- /*
- * top is end of the chain and none of the chain
- * had top->selfpc == selfpc.
- * so we allocate a new tostruct
- * and link it to the head of the chain.
- */
- toindex = ++tos[0].link;
- if (toindex >= tolimit) {
- goto overflow;
- }
- top = &tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
- /*
- * otherwise, check the next arc on the chain.
- */
- prevtop = top;
- top = &tos[top->link];
- if (top->selfpc == selfpc) {
- /*
- * there it is.
- * increment its count
- * move it to the head of the chain.
- */
- top->count++;
- toindex = prevtop->link;
- prevtop->link = top->link;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
-
- }
-done:
- profiling--;
- /* and fall through */
-out:
- return; /* normal return restores saved registers */
-
-overflow:
- profiling++; /* halt further profiling */
-# define TOLIMIT "mcount: tos overflow\n"
- write(2, TOLIMIT, sizeof(TOLIMIT));
- goto out;
-}
-
-/*
- * Control profiling
- * profiling is what mcount checks to see if
- * all the data structures are ready.
- */
-moncontrol(mode)
- int mode;
-{
- if (mode) {
- /* start */
- profil((unsigned short *)(sbuf + sizeof(struct phdr)),
- ssiz - sizeof(struct phdr),
- (int)s_lowpc, s_scale);
- profiling = 0;
- } else {
- /* stop */
- profil((unsigned short *)0, 0, 0, 0);
- profiling = 3;
- }
-}
diff --git a/gcc/config/sparc/lb1spc.asm b/gcc/config/sparc/lb1spc.asm
deleted file mode 100644
index ec9532d3ec0..00000000000
--- a/gcc/config/sparc/lb1spc.asm
+++ /dev/null
@@ -1,486 +0,0 @@
-/* This is an assembly language implementation of libgcc1.c for the sparc
- processor.
-
- These routines are derived from the Sparc Architecture Manual, version 8,
- slightly edited to match the desired calling convention, and also to
- optimize them for our purposes. */
-
-#ifdef L_mulsi3
-.text
- .align 4
- .global .umul
- .proc 4
-.umul:
- or %o0, %o1, %o4 ! logical or of multiplier and multiplicand
- mov %o0, %y ! multiplier to Y register
- andncc %o4, 0xfff, %o5 ! mask out lower 12 bits
- be mul_shortway ! can do it the short way
- andcc %g0, %g0, %o4 ! zero the partial product and clear NV cc
- !
- ! long multiply
- !
- mulscc %o4, %o1, %o4 ! first iteration of 33
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4 ! 32nd iteration
- mulscc %o4, %g0, %o4 ! last iteration only shifts
- ! the upper 32 bits of product are wrong, but we do not care
- retl
- rd %y, %o0
- !
- ! short multiply
- !
-mul_shortway:
- mulscc %o4, %o1, %o4 ! first iteration of 13
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4 ! 12th iteration
- mulscc %o4, %g0, %o4 ! last iteration only shifts
- rd %y, %o5
- sll %o4, 12, %o4 ! left shift partial product by 12 bits
- srl %o5, 20, %o5 ! right shift partial product by 20 bits
- retl
- or %o5, %o4, %o0 ! merge for true product
-#endif
-
-#ifdef L_divsi3
-.text
- .align 4
- .global .udiv
- .proc 4
-.udiv:
- save %sp, -64, %sp
- b divide
- mov 0, %l2 ! result always positive
- .global .div
- .proc 4
-.div:
- save %sp, -64, %sp
- orcc %i1, %i0, %g0 ! is either operand negative
- bge divide ! if not, skip this junk
- xor %i1, %i0, %l2 ! record sign of result in sign of %l2
- tst %i1
- bge 2f
- tst %i0
- ! %i1 < 0
- bge divide
- neg %i1
-2: ! %i0 < 0
- neg %i0
- ! FALL THROUGH
-divide:
- ! Compute size of quotient, scale comparand.
- orcc %i1, %g0, %l1 ! movcc %i1, %l1
- te 2 ! if %i1 = 0
- mov %i0, %i3
- mov 0, %i2
- sethi %hi(1<<(32-4-1)), %l3
- cmp %i3, %l3
- blu not_really_big
- mov 0, %l0
- !
- ! Here, the %i0 is >= 2^(31-3) or so. We must be careful here,
- ! as our usual 3-at-a-shot divide step will cause overflow and havoc.
- ! The total number of bits in the result here is 3*%l0+%l4, where
- ! %l4 <= 3.
- ! Compute %l0 in an unorthodox manner: know we need to Shift %l1 into
- ! the top decade: so do not even bother to compare to %i3.
-1: cmp %l1, %l3
- bgeu 3f
- mov 1, %l4
- sll %l1, 3, %l1
- b 1b
- inc %l0
- !
- ! Now compute %l4
- !
-2: addcc %l1, %l1, %l1
- bcc not_too_big
- add %l4, 1, %l4
- !
- ! We are here if the %i1 overflowed when Shifting.
- ! This means that %i3 has the high-order bit set.
- ! Restore %l1 and subtract from %i3.
- sll %l3, 4, %l3
- srl %l1, 1, %l1
- add %l1, %l3, %l1
- b do_single_div
- dec %l4
-not_too_big:
-3: cmp %l1, %i3
- blu 2b
- nop
- be do_single_div
- nop
- ! %l1 > %i3: went too far: back up 1 step
- ! srl %l1, 1, %l1
- ! dec %l4
- ! do single-bit divide steps
- !
- ! We have to be careful here. We know that %i3 >= %l1, so we can do the
- ! first divide step without thinking. BUT, the others are conditional,
- ! and are only done if %i3 >= 0. Because both %i3 and %l1 may have the
- ! high-order bit set in the first step, just falling into the regular
- ! division loop will mess up the first time around.
- ! So we unroll slightly...
-do_single_div:
- deccc %l4
- bl end_regular_divide
- nop
- sub %i3, %l1, %i3
- mov 1, %i2
- b end_single_divloop
- nop
-single_divloop:
- sll %i2, 1, %i2
- bl 1f
- srl %l1, 1, %l1
- ! %i3 >= 0
- sub %i3, %l1, %i3
- b 2f
- inc %i2
-1: ! %i3 < 0
- add %i3, %l1, %i3
- dec %i2
-end_single_divloop:
-2: deccc %l4
- bge single_divloop
- tst %i3
- b end_regular_divide
- nop
-not_really_big:
-1: sll %l1, 3, %l1
- cmp %l1, %i3
- bleu 1b
- inccc %l0
- be got_result
- dec %l0
-do_regular_divide:
- ! Do the main division iteration
- tst %i3
- ! Fall through into divide loop
-divloop:
- sll %i2, 3, %i2
- ! depth 1, accumulated bits 0
- bl L.1.8
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- ! depth 2, accumulated bits 1
- bl L.2.9
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- ! depth 3, accumulated bits 3
- bl L.3.11
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- b 9f
- add %i2, (3*2+1), %i2
-L.3.11: ! remainder is negative
- addcc %i3,%l1,%i3
- b 9f
- add %i2, (3*2-1), %i2
-L.2.9: ! remainder is negative
- addcc %i3,%l1,%i3
- ! depth 3, accumulated bits 1
- bl L.3.9
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- b 9f
- add %i2, (1*2+1), %i2
-L.3.9: ! remainder is negative
- addcc %i3,%l1,%i3
- b 9f
- add %i2, (1*2-1), %i2
-L.1.8: ! remainder is negative
- addcc %i3,%l1,%i3
- ! depth 2, accumulated bits -1
- bl L.2.7
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- ! depth 3, accumulated bits -1
- bl L.3.7
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- b 9f
- add %i2, (-1*2+1), %i2
-L.3.7: ! remainder is negative
- addcc %i3,%l1,%i3
- b 9f
- add %i2, (-1*2-1), %i2
-L.2.7: ! remainder is negative
- addcc %i3,%l1,%i3
- ! depth 3, accumulated bits -3
- bl L.3.5
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- b 9f
- add %i2, (-3*2+1), %i2
-L.3.5: ! remainder is negative
- addcc %i3,%l1,%i3
- b 9f
- add %i2, (-3*2-1), %i2
-end_regular_divide:
-9: deccc %l0
- bge divloop
- tst %i3
- bge got_result
- nop
- ! non-restoring fixup here
- dec %i2
-got_result:
- tst %l2
- bge 1f
- restore
- ! answer < 0
- retl ! leaf-routine return
- neg %o2, %o0 ! quotient <- -%i2
-1: retl ! leaf-routine return
- mov %o2, %o0 ! quotient <- %i2
-#endif
-
-#ifdef L_modsi3
-.text
- .align 4
- .global .urem
- .proc 4
-.urem:
- save %sp, -64, %sp
- b divide
- mov 0, %l2 ! result always positive
- .global .rem
- .proc 4
-.rem:
- save %sp, -64, %sp
- orcc %i1, %i0, %g0 ! is either operand negative
- bge divide ! if not, skip this junk
- mov %i0, %l2 ! record sign of result in sign of %i2
- tst %i1
- bge 2f
- tst %i0
- ! %i1 < 0
- bge divide
- neg %i1
-2: ! %i0 < 0
- neg %i0
- ! FALL THROUGH
-divide:
- ! Compute size of quotient, scale comparand.
- orcc %i1, %g0, %l1 ! movcc %i1, %l1
- te 2 ! if %i1 = 0
- mov %i0, %i3
- mov 0, %i2
- sethi %hi(1<<(32-4-1)), %l3
- cmp %i3, %l3
- blu not_really_big
- mov 0, %l0
- !
- ! Here, the %i0 is >= 2^(31-3) or so. We must be careful here,
- ! as our usual 3-at-a-shot divide step will cause overflow and havoc.
- ! The total number of bits in the result here is 3*%l0+%l4, where
- ! %l4 <= 3.
- ! Compute %l0 in an unorthodox manner: know we need to Shift %l1 into
- ! the top decade: so do not even bother to compare to %i3.
-1: cmp %l1, %l3
- bgeu 3f
- mov 1, %l4
- sll %l1, 3, %l1
- b 1b
- inc %l0
- !
- ! Now compute %l4
- !
-2: addcc %l1, %l1, %l1
- bcc not_too_big
- add %l4, 1, %l4
- !
- ! We are here if the %i1 overflowed when Shifting.
- ! This means that %i3 has the high-order bit set.
- ! Restore %l1 and subtract from %i3.
- sll %l3, 4, %l3
- srl %l1, 1, %l1
- add %l1, %l3, %l1
- b do_single_div
- dec %l4
-not_too_big:
-3: cmp %l1, %i3
- blu 2b
- nop
- be do_single_div
- nop
- ! %l1 > %i3: went too far: back up 1 step
- ! srl %l1, 1, %l1
- ! dec %l4
- ! do single-bit divide steps
- !
- ! We have to be careful here. We know that %i3 >= %l1, so we can do the
- ! first divide step without thinking. BUT, the others are conditional,
- ! and are only done if %i3 >= 0. Because both %i3 and %l1 may have the
- ! high-order bit set in the first step, just falling into the regular
- ! division loop will mess up the first time around.
- ! So we unroll slightly...
-do_single_div:
- deccc %l4
- bl end_regular_divide
- nop
- sub %i3, %l1, %i3
- mov 1, %i2
- b end_single_divloop
- nop
-single_divloop:
- sll %i2, 1, %i2
- bl 1f
- srl %l1, 1, %l1
- ! %i3 >= 0
- sub %i3, %l1, %i3
- b 2f
- inc %i2
-1: ! %i3 < 0
- add %i3, %l1, %i3
- dec %i2
-end_single_divloop:
-2: deccc %l4
- bge single_divloop
- tst %i3
- b end_regular_divide
- nop
-not_really_big:
-1: sll %l1, 3, %l1
- cmp %l1, %i3
- bleu 1b
- inccc %l0
- be got_result
- dec %l0
-do_regular_divide:
- ! Do the main division iteration
- tst %i3
- ! Fall through into divide loop
-divloop:
- sll %i2, 3, %i2
- ! depth 1, accumulated bits 0
- bl L.1.8
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- ! depth 2, accumulated bits 1
- bl L.2.9
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- ! depth 3, accumulated bits 3
- bl L.3.11
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- b 9f
- add %i2, (3*2+1), %i2
-L.3.11: ! remainder is negative
- addcc %i3,%l1,%i3
- b 9f
- add %i2, (3*2-1), %i2
-L.2.9: ! remainder is negative
- addcc %i3,%l1,%i3
- ! depth 3, accumulated bits 1
- bl L.3.9
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- b 9f
- add %i2, (1*2+1), %i2
-L.3.9: ! remainder is negative
- addcc %i3,%l1,%i3
- b 9f
- add %i2, (1*2-1), %i2
-L.1.8: ! remainder is negative
- addcc %i3,%l1,%i3
- ! depth 2, accumulated bits -1
- bl L.2.7
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- ! depth 3, accumulated bits -1
- bl L.3.7
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- b 9f
- add %i2, (-1*2+1), %i2
-L.3.7: ! remainder is negative
- addcc %i3,%l1,%i3
- b 9f
- add %i2, (-1*2-1), %i2
-L.2.7: ! remainder is negative
- addcc %i3,%l1,%i3
- ! depth 3, accumulated bits -3
- bl L.3.5
- srl %l1,1,%l1
- ! remainder is positive
- subcc %i3,%l1,%i3
- b 9f
- add %i2, (-3*2+1), %i2
-L.3.5: ! remainder is negative
- addcc %i3,%l1,%i3
- b 9f
- add %i2, (-3*2-1), %i2
-end_regular_divide:
-9: deccc %l0
- bge divloop
- tst %i3
- bge got_result
- nop
- ! non-restoring fixup here
- add %i3, %i1, %i3
-got_result:
- tst %l2
- bge 1f
- restore
- ! answer < 0
- retl ! leaf-routine return
- neg %o3, %o0 ! remainder <- -%i3
-1: retl ! leaf-routine return
- mov %o3, %o0 ! remainder <- %i3
-#endif
-
-
diff --git a/gcc/config/sparc/lb1spl.asm b/gcc/config/sparc/lb1spl.asm
deleted file mode 100644
index 4c8bc30b83d..00000000000
--- a/gcc/config/sparc/lb1spl.asm
+++ /dev/null
@@ -1,246 +0,0 @@
-/* This is an assembly language implementation of libgcc1.c for the sparclite
- processor.
-
- These routines are all from the Sparclite User's Guide, slightly edited
- to match the desired calling convention, and also to optimize them. */
-
-#ifdef L_udivsi3
-.text
- .align 4
- .global .udiv
- .proc 04
-.udiv:
- wr %g0,%g0,%y ! Not a delayed write for sparclite
- tst %g0
- divscc %o0,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- retl
- divscc %g1,%o1,%o0
-#endif
-
-#ifdef L_umodsi3
-.text
- .align 4
- .global .urem
- .proc 04
-.urem:
- wr %g0,%g0,%y ! Not a delayed write for sparclite
- tst %g0
- divscc %o0,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- divscc %g1,%o1,%g1
- bl 1f
- rd %y,%o0
- retl
- nop
-1: retl
- add %o0,%o1,%o0
-#endif
-
-#ifdef L_divsi3
-.text
- .align 4
- .global .div
- .proc 04
-! ??? This routine could be made faster if was optimized, and if it was
-! rewritten to only calculate the quotient.
-.div:
- wr %g0,%g0,%y ! Not a delayed write for sparclite
- mov %o1,%o4
- tst %o1
- bl,a 1f
- sub %g0,%o4,%o4
-1: tst %o0
- bl,a 2f
- mov -1,%y
-2: divscc %o0,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- be 6f
- mov %y,%o3
- bg 4f
- addcc %o3,%o4,%g0
- be,a 6f
- mov %g0,%o3
- tst %o0
- bl 5f
- tst %g1
- ba 5f
- add %o3,%o4,%o3
-4: subcc %o3,%o4,%g0
- be,a 6f
- mov %g0,%o3
- tst %o0
- bge 5f
- tst %g1
- sub %o3,%o4,%o3
-5: bl,a 6f
- add %g1,1,%g1
-6: tst %o1
- bl,a 7f
- sub %g0,%g1,%g1
-7: retl
- mov %g1,%o0 ! Quotient is in %g1.
-#endif
-
-#ifdef L_modsi3
-.text
- .align 4
- .global .rem
- .proc 04
-! ??? This routine could be made faster if was optimized, and if it was
-! rewritten to only calculate the remainder.
-.rem:
- wr %g0,%g0,%y ! Not a delayed write for sparclite
- mov %o1,%o4
- tst %o1
- bl,a 1f
- sub %g0,%o4,%o4
-1: tst %o0
- bl,a 2f
- mov -1,%y
-2: divscc %o0,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- divscc %g1,%o4,%g1
- be 6f
- mov %y,%o3
- bg 4f
- addcc %o3,%o4,%g0
- be,a 6f
- mov %g0,%o3
- tst %o0
- bl 5f
- tst %g1
- ba 5f
- add %o3,%o4,%o3
-4: subcc %o3,%o4,%g0
- be,a 6f
- mov %g0,%o3
- tst %o0
- bge 5f
- tst %g1
- sub %o3,%o4,%o3
-5: bl,a 6f
- add %g1,1,%g1
-6: tst %o1
- bl,a 7f
- sub %g0,%g1,%g1
-7: retl
- mov %o3,%o0 ! Remainder is in %o3.
-#endif
diff --git a/gcc/config/sparc/linux-aout.h b/gcc/config/sparc/linux-aout.h
deleted file mode 100644
index f48d7f3e017..00000000000
--- a/gcc/config/sparc/linux-aout.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Definitions for SPARC running Linux with a.out
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Eddie C. Dost (ecd@skynet.be)
-
-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 <aoutos.h>
-#include <sparc/sparc.h>
-
-/* Don't assume anything about the header files. */
-#define NO_IMPLICIT_EXTERN_C
-
-#undef HAVE_ATEXIT
-#define HAVE_ATEXIT
-
-/* Linux uses ctype from glibc.a. I am not sure how complete it is.
- For now, we play safe. It may change later. */
-
-#if 0
-#undef MULTIBYTE_CHARS
-#define MULTIBYTE_CHARS 1
-#endif
-
-/* There are conflicting reports about whether this system uses
- a different assembler syntax. wilson@cygnus.com says # is right. */
-#undef COMMENT_BEGIN
-#define COMMENT_BEGIN "#"
-
-/* We need that too. */
-#define HANDLE_SYSV_PRAGMA
-
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- output_file_directive (FILE, main_input_filename); \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- } while (0)
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static}"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (sparc Linux/a.out)");
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dsparc -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(sparc) -Amachine(sparc)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{msparclite:-D__sparclite__} %{mv8:-D__sparc_v8__} %{msupersparc:-D__supersparc__ -D__sparc_v8__} %{posix:-D_POSIX_SOURCE}"
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler,
- and we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-#undef LIB_SPEC
-
-#if 1
-/* We no longer link with libc_p.a or libg.a by default. If you
- * want to profile or debug the Linux C library, please add
- * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
- */
-#define LIB_SPEC \
-"%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}"
-#else
-#define LIB_SPEC \
-"%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
- %{!p:%{!pg:%{!g*:-lc} %{g*:-lg -static}}}"
-#endif
-
-#undef LINK_SPEC
-#define LINK_SPEC "-m sparclinux"
-
-/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
- It's safe to pass -s always, even if -g is not used. */
-#undef ASM_SPEC
-#define ASM_SPEC \
- "%{V} %{v:%{!V:-V}} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}"
-
-#if 0
-/* Define for support of TFmode long double and REAL_ARITHMETIC.
- Sparc ABI says that long double is 4 words. Linux does not support
- long double yet. */
-#define LONG_DOUBLE_TYPE_SIZE 128
-#endif
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
deleted file mode 100644
index 0a3420de487..00000000000
--- a/gcc/config/sparc/linux.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Definitions for SPARC running Linux with ELF
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Eddie C. Dost (ecd@skynet.be)
-
-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. */
-
-#define LINUX_DEFAULT_ELF
-
-/* Don't assume anything about the header files. */
-#define NO_IMPLICIT_EXTERN_C
-
-#undef HAVE_ATEXIT
-#define HAVE_ATEXIT
-
-/* Linux uses ctype from glibc.a. I am not sure how complete it is.
- For now, we play safe. It may change later. */
-
-#if 0
-#undef MULTIBYTE_CHARS
-#define MULTIBYTE_CHARS 1
-#endif
-
-/* There are conflicting reports about whether this system uses
- a different assembler syntax. wilson@cygnus.com says # is right. */
-#undef COMMENT_BEGIN
-#define COMMENT_BEGIN "#"
-
-/* Use stabs instead of DWARF debug format. */
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-#include <sparc/sysv4.h>
-
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { \
- output_file_directive (FILE, main_input_filename); \
- fprintf (FILE, "\t.version\t\"01.01\"\n"); \
- } while (0)
-
-#undef LIBGCC_SPEC
-#define LIBGCC_SPEC \
- "%{!shared:-lgcc}"
-
-/* Provide a STARTFILE_SPEC appropriate for Linux. Here we add
- the Linux magical crtbegin.o file (see crtstuff.c) which
- provides part of the support for getting C++ file-scope static
- object constructed before entering `main'. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!shared: \
- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
-
-/* Provide a ENDFILE_SPEC appropriate for Linux. Here we tack on
- the Linux magical crtend.o file (see crtstuff.c) which
- provides part of the support for getting C++ file-scope static
- object constructed before entering `main', followed by a normal
- Linux "finalizer" file, `crtn.o'. */
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (sparc Linux/ELF)");
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__ELF__ -Dunix -Dsparc -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(sparc) -Amachine(sparc)"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{msparclite:-D__sparclite__} %{mv8:-D__sparc_v8__} %{msupersparc:-D__supersparc__ -D__sparc_v8__} %{posix:-D_POSIX_SOURCE}"
-
-#undef LIB_SPEC
-#if 1
-/* We no longer link with libc_p.a or libg.a by default. If you
- * want to profile or debug the Linux C library, please add
- * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
- */
-#define LIB_SPEC \
- "%{!shared: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \
- %{!ggdb:-lc} %{ggdb:-lg}}"
-#else
-#define LIB_SPEC \
- "%{!shared: \
- %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
- %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
-#endif
-
-/* Provide a LINK_SPEC appropriate for Linux. Here we provide support
- for the special GCC options -static and -shared, which allow us to
- link things in one of these three modes by applying the appropriate
- combinations of options at link-time. We like to support here for
- as many of the other GNU linker options as possible. But I don't
- have the time to search for those flags. I am sure how to add
- support for -soname shared_object_name. H.J.
-
- I took out %{v:%{!V:-V}}. It is too much :-(. They can use
- -Wl,-V.
-
- When the -shared link option is used a final link is not being
- done. */
-
-/* If ELF is the default format, we should not use /lib/elf. */
-
-#undef LINK_SPEC
-#ifndef LINUX_DEFAULT_ELF
-#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
- %{!shared: \
- %{!ibcs: \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \
- %{!rpath:-rpath /lib/elf/}} %{static:-static}}}"
-#else
-#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
- %{!shared: \
- %{!ibcs: \
- %{!static: \
- %{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
- %{static:-static}}}"
-#endif
-
-/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
- It's safe to pass -s always, even if -g is not used. */
-#undef ASM_SPEC
-#define ASM_SPEC \
- "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}"
-
-/* Same as sparc.h */
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* We use stabs-in-elf for debugging, because that is what the native
- toolchain uses. XXX */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- fputs ("\t.local\t", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- putc ('\n', (FILE)); \
- ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
-} while (0)
-
-#undef COMMON_ASM_OP
-#define COMMON_ASM_OP "\t.common"
-
-/* This is how to output a definition of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
-
-/* This is how to output a reference to an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABELREF
-#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
- fprintf (FILE, ".L%s%d", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
-
-
-#if 0
-/* Define for support of TFmode long double and REAL_ARITHMETIC.
- Sparc ABI says that long double is 4 words. Linux does not support
- long double yet. */
-#define LONG_DOUBLE_TYPE_SIZE 128
-#endif
diff --git a/gcc/config/sparc/lite.h b/gcc/config/sparc/lite.h
deleted file mode 100644
index 55c232ac779..00000000000
--- a/gcc/config/sparc/lite.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SPARClite w/o FPU.
- Copyright (C) 1993, 1996 Free Software Foundation, Inc.
- Contributed by Jim Wilson (wilson@cygnus.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 "sparc/sparc.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dsparc -Dsparclite -Acpu(sparc) -Amachine(sparc)"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (sparclite)");
-
-/* Enable app-regs and epilogue options. Do not enable the fpu. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE)
-
-/* US Software GOFAST library support. */
-#include "gofast.h"
-#undef INIT_SUBTARGET_OPTABS
-#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
diff --git a/gcc/config/sparc/litecoff.h b/gcc/config/sparc/litecoff.h
deleted file mode 100644
index bd89e1b4686..00000000000
--- a/gcc/config/sparc/litecoff.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SPARClite w/o FPU, COFF.
- Copyright (C) 1994, 1996 Free Software Foundation, Inc.
- Written by Ken Raeburn (raeburn@cygnus.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 "sparc/lite.h"
-
-#undef ASM_OUTPUT_IDENT
-
-#undef SELECT_SECTION
-#undef SELECT_RTX_SECTION
-#define BSS_SECTION_ASM_OP ".section\t\".bss\""
-
-#include "svr3.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dsparc -Dsparclite -Acpu(sparc) -Amachine(sparc)"
-
-/* Default to stabs in COFF. */
-
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#include "dbxcoff.h"
-
-/* Support the ctors and dtors sections for g++. */
-
-#undef INIT_SECTION_ASM_OP
-
-/* Support the ctors and dtors sections for g++. */
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\""
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-#define INT_ASM_OP ".long"
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#undef DO_GLOBAL_CTORS_BODY
-#undef DO_GLOBAL_DTORS_BODY
diff --git a/gcc/config/sparc/lynx-ng.h b/gcc/config/sparc/lynx-ng.h
deleted file mode 100644
index 9e9f82cf10b..00000000000
--- a/gcc/config/sparc/lynx-ng.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Definitions for SPARC running LynxOS, using Lynx's old as and ld.
- Copyright (C) 1993, 1995 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. */
-
-#include <sparc/sparc.h>
-#include <lynx-ng.h>
-
-/* ??? Must redefine to get sparclite and v8 defines. Can this be done
- differently? */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
- %{mposix:-D_POSIX_SOURCE} \
- %{msystem-v:-I/usr/include_v} \
- %(cpp_cpu)"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dsparc -DLynx -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(sparc) -Amachine(sparc)"
-
-/* Provide required defaults for linker switches. */
-
-#undef LINK_SPEC
-#define LINK_SPEC "-e __main -T 0 %{msystem-v:-V} %{mcoff:-k}"
diff --git a/gcc/config/sparc/lynx.h b/gcc/config/sparc/lynx.h
deleted file mode 100644
index 99b319a0df2..00000000000
--- a/gcc/config/sparc/lynx.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Definitions for SPARC running LynxOS.
- Copyright (C) 1993, 1995, 1996 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. */
-
-#include <sparc/sparc.h>
-
-#undef ASM_OUTPUT_IDENT
-#undef SELECT_SECTION
-#undef SELECT_RTX_SECTION
-
-#define BSS_SECTION_ASM_OP ".section\t\".bss\""
-
-#include <lynx.h>
-
-/* ??? Must redefine to get sparclite and v8 defines. Can this be done
- differently? */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
- %{mposix:-D_POSIX_SOURCE} \
- %{msystem-v:-I/usr/include_v} \
- %(cpp_cpu)"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dsparc -DSPARC -DLynx -DLYNX -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(sparc) -Amachine(sparc)"
-
-#undef LINK_SPEC
-
-/* Sparc version of libc.a has references to libm.a (printf calls pow for
- instance), so we must always link both. */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{mthreads:-L/lib/thread/} \
- %{msystem-v:-lc_v -lm_v -lc_v} \
- %{!msystem-v:%{mposix:-lc_p} -lc -lm -lc}"
diff --git a/gcc/config/sparc/netbsd.h b/gcc/config/sparc/netbsd.h
deleted file mode 100644
index 4bb9537b905..00000000000
--- a/gcc/config/sparc/netbsd.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <sparc/sparc.h>
-
-/* Get generic NetBSD definitions. */
-
-#include <netbsd.h>
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dsparc -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(sparc) -Amachine(sparc)"
-
-/* Make gcc agree with <machine/ansi.h> */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* This is the char to use for continuation (in case we need to turn
- continuation back on). */
-
-#define DBX_CONTIN_CHAR '?'
-
-/* Don't default to pcc-struct-return, because gcc is the only compiler, and
- we want to retain compatibility with older gcc versions. */
-#define DEFAULT_PCC_STRUCT_RETURN 0
diff --git a/gcc/config/sparc/pbd.h b/gcc/config/sparc/pbd.h
deleted file mode 100644
index 6fb6cb621e8..00000000000
--- a/gcc/config/sparc/pbd.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/* Definitions of target machine for GNU compiler, Citicorp/TTI Unicom PBD
- version (using GAS and COFF (encapsulated is unacceptable) )
- Copyright (C) 1990, 1996 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. */
-
-#include "sparc/sparc.h"
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dsparc -DUnicomPBD -Dunix -D__GCC_NEW_VARARGS__ -Asystem(unix) -Acpu(sparc) -Amachine(sparc)"
-
-/* We want DBX format for use with gdb under COFF. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Generate calls to memcpy, memcmp and memset. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* we use /lib/libp/lib* when profiling */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc"
-
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-/*
- * The loader directive file gcc.ifile defines how to merge the constructor
- * sections into the data section. Also, since gas only puts out those
- * sections in response to N_SETT stabs, and does not (yet) have a
- * ".sections" directive, gcc.ifile also defines the list symbols
- * __DTOR_LIST__ and __CTOR_LIST__.
- *
- * Finally, we must explicitly specify the file from libgcc.a that defines
- * exit(), otherwise if the user specifies (for example) "-lc_s" on the
- * command line, the wrong exit() will be used and global destructors will
- * not get called .
- */
-
-#define STARTFILE_SPEC \
-"%{!r: gcc.ifile%s} %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} \
-%{!r:_exit.o%s}"
-
-#define ENDFILE_SPEC "crtn.o%s"
-
-/* cpp has to support a #sccs directive for the /usr/include files */
-
-#define SCCS_DIRECTIVE
-
-/* LINK_SPEC is needed only for SunOS 4. */
-
-#undef LINK_SPEC
-
-/* Although the gas we use can create .ctor and .dtor sections from N_SETT
- stabs, it does not support section directives, so we need to have the loader
- define the lists.
- */
-#define CTOR_LISTS_DEFINED_EXTERNALLY
-
-/* similar to default, but allows for the table defined by ld with gcc.ifile.
- nptrs is always 0. So we need to instead check that __DTOR_LIST__[1] != 0.
- The old check is left in so that the same macro can be used if and when
- a future version of gas does support section directives. */
-
-#define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \
- if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0)) \
- for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++); \
- for (i = nptrs; i >= 1; i--) \
- __DTOR_LIST__[i] (); }
-
-/*
- * Here is an example gcc.ifile. I've tested it on PBD sparc
- * systems. The NEXT(0x200000) works on just about all 386 and m68k systems,
- * but can be reduced to any power of 2 that is >= NBPS (0x40000 on a pbd).
-
- SECTIONS {
- .text BIND(0x41000200) BLOCK (0x200) :
- { *(.init) *(.text) vfork = fork; *(.fini) }
-
- GROUP BIND( NEXT(0x200000) + ADDR(.text) + SIZEOF(.text)):
- { .data : { __CTOR_LIST__ = . ; . += 4; *(.ctor) . += 4 ;
- __DTOR_LIST__ = . ; . += 4; *(.dtor) . += 4 ; }
- .bss : { }
- }
- }
- */
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* fixes: */
-/*
- * Internal labels are prefixed with a period.
- */
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*.%s%d", PREFIX, NUM)
-
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#undef ASM_OUTPUT_ADDR_DIFF_ELT
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
-
-/* This is how to output an element of a case-vector that is absolute.
- (The 68000 does not use such vectors,
- but we must define this macro anyway.) */
-
-#undef ASM_OUTPUT_ADDR_VEC_ELT
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.word .L%d\n", VALUE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tsethi %%hi(.LP%d),%%o0\n\tcall mcount\n\tor %%lo(.LP%d),%%o0,%%o0\n", \
- (LABELNO), (LABELNO))
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-
-#undef FUNCTION_BLOCK_PROFILER
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tsethi %%hi(.LPBX0),%%o0\n\tld [%%lo(.LPBX0)+%%o0],%%o1\n\ttst %%o1\n\tbne .LPY%d\n\tnop\n\tcall ___bb_init_func\n\tnop\n.LPY%d:\n", \
- (LABELNO), (LABELNO))
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. */
-
-#undef BLOCK_PROFILER
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
-{ \
- int blockn = (BLOCKNO); \
- fprintf (FILE, "\tsethi %%hi(.LPBX2+%d),%%g1\n\tld [%%lo(.LPBX2+%d)+%%g1],%%g2\n\
-\tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(.LPBX2+%d)+%%g1]\n", \
- 4 * blockn, 4 * blockn, 4 * blockn); \
- CC_STATUS_INIT; /* We have clobbered %g1. Also %g2. */ \
-}
-/* This is needed for SunOS 4.0, and should not hurt for 3.2
- versions either. */
-#undef ASM_OUTPUT_SOURCE_LINE(file, line)
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- { static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,.LM%d\n.LM%d:\n", \
- line, sym_lineno, sym_lineno); \
- sym_lineno += 1; }
-
-#define ASM_INT_OP ".long "
diff --git a/gcc/config/sparc/rtems.h b/gcc/config/sparc/rtems.h
deleted file mode 100644
index 5e5ea14b1ee..00000000000
--- a/gcc/config/sparc/rtems.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Definitions for rtems targetting a SPARC using a.out.
-
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Joel Sherrill (joel@OARcorp.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 "sparc/aout.h"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dsparc -D__GCC_NEW_VARARGS__ -Drtems -D__rtems__ \
- -Asystem(rtems) -Acpu(sparc) -Amachine(sparc)"
-
-/* end of sparc-rtems.h */
diff --git a/gcc/config/sparc/sol2-c1.asm b/gcc/config/sparc/sol2-c1.asm
deleted file mode 100644
index 618d698e900..00000000000
--- a/gcc/config/sparc/sol2-c1.asm
+++ /dev/null
@@ -1,86 +0,0 @@
-! crt1.s for solaris 2.0.
-
-! Copyright (C) 1992 Free Software Foundation, Inc.
-! Written By David Vinayak Henkel-Wallace, June 1992
-!
-! 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, or (at your option) any
-! later version.
-!
-! In addition to the permissions in the GNU General Public License, the
-! Free Software Foundation gives you unlimited permission to link the
-! compiled version of this file with other programs, and to distribute
-! those programs without any restriction coming from the use of this
-! file. (The General Public License restrictions do apply in other
-! respects; for example, they cover modification of the file, and
-! distribution when not linked into another program.)
-!
-! This file 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; 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 link this library with files
-! compiled with GCC to produce an executable, this does not 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.
-!
-
-! This file takes control of the process from the kernel, as specified
-! in section 3 of the SVr4 ABI.
-! This file is the first thing linked into any executable.
-
- .section ".text"
- .proc 022
- .global _start
-
-_start:
- mov 0, %fp ! Mark bottom frame pointer
- ld [%sp + 64], %l0 ! argc
- add %sp, 68, %l1 ! argv
-
- ! Leave some room for a call. Sun leaves 32 octets (to sit on
- ! a cache line?) so we do too.
- sub %sp, 32, %sp
-
- ! %g1 may contain a function to be registered w/atexit
- orcc %g0, %g1, %g0
- be .nope
- mov %g1, %o0
- call atexit
- nop
-.nope:
- ! Now make sure constructors and destructors are handled.
- set _fini, %o0
- call atexit, 1
- nop
- call _init, 0
- nop
-
- ! We ignore the auxiliary vector; there's no defined way to
- ! access those data anyway. Instead, go straight to main:
- mov %l0, %o0 ! argc
- mov %l1, %o1 ! argv
- ! Skip argc words past argv, to env:
- sll %l0, 2, %o2
- add %o2, 4, %o2
- add %l1, %o2, %o2 ! env
- set _environ, %o3
- st %o2, [%o3] ! *_environ
- call main, 4
- nop
- call exit, 0
- nop
- call _exit, 0
- nop
- ! We should never get here.
-
- .type _start,#function
- .size _start,.-_start
diff --git a/gcc/config/sparc/sol2-ci.asm b/gcc/config/sparc/sol2-ci.asm
deleted file mode 100644
index dd09a34e84e..00000000000
--- a/gcc/config/sparc/sol2-ci.asm
+++ /dev/null
@@ -1,60 +0,0 @@
-! crti.s for solaris 2.0.
-
-! Copyright (C) 1992 Free Software Foundation, Inc.
-! Written By David Vinayak Henkel-Wallace, June 1992
-!
-! 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, or (at your option) any
-! later version.
-!
-! In addition to the permissions in the GNU General Public License, the
-! Free Software Foundation gives you unlimited permission to link the
-! compiled version of this file with other programs, and to distribute
-! those programs without any restriction coming from the use of this
-! file. (The General Public License restrictions do apply in other
-! respects; for example, they cover modification of the file, and
-! distribution when not linked into another program.)
-!
-! This file 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; 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 link this library with files
-! compiled with GCC to produce an executable, this does not 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.
-!
-
-! This file just make a stack frame for the contents of the .fini and
-! .init sections. Users may put any desired instructions in those
-! sections.
-
-! This file is linked in before the Values-Xx.o files and also before
-! crtbegin, with which perhaps it should be merged.
-
- .file "crti.s"
-
- .section ".init"
- .proc 022
- .global _init
- .type _init,#function
- .align 4
-_init:
- save %sp, -96, %sp
-
-
- .section ".fini"
- .proc 022
- .global _fini
- .type _fini,#function
- .align 4
-_fini:
- save %sp, -96, %sp
diff --git a/gcc/config/sparc/sol2-cn.asm b/gcc/config/sparc/sol2-cn.asm
deleted file mode 100644
index 3c5d508c743..00000000000
--- a/gcc/config/sparc/sol2-cn.asm
+++ /dev/null
@@ -1,54 +0,0 @@
-! crtn.s for solaris 2.0.
-
-! Copyright (C) 1992 Free Software Foundation, Inc.
-! Written By David Vinayak Henkel-Wallace, June 1992
-!
-! 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, or (at your option) any
-! later version.
-!
-! In addition to the permissions in the GNU General Public License, the
-! Free Software Foundation gives you unlimited permission to link the
-! compiled version of this file with other programs, and to distribute
-! those programs without any restriction coming from the use of this
-! file. (The General Public License restrictions do apply in other
-! respects; for example, they cover modification of the file, and
-! distribution when not linked into another program.)
-!
-! This file 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; 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 link this library with files
-! compiled with GCC to produce an executable, this does not 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.
-!
-
-! This file just makes sure that the .fini and .init sections do in
-! fact return. Users may put any desired instructions in those sections.
-! This file is the last thing linked into any executable.
-
- .file "crtn.s"
-
- .section ".init"
- .align 4
-
- ret
- restore
-
- .section ".fini"
- .align 4
-
- ret
- restore
-
-! Th-th-th-that's all folks!
diff --git a/gcc/config/sparc/sol2-g1.asm b/gcc/config/sparc/sol2-g1.asm
deleted file mode 100644
index b9d878856f8..00000000000
--- a/gcc/config/sparc/sol2-g1.asm
+++ /dev/null
@@ -1,88 +0,0 @@
-! gcrt1.s for solaris 2.0.
-
-! Copyright (C) 1992 Free Software Foundation, Inc.
-! Written By David Vinayak Henkel-Wallace, June 1992
-!
-! 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, or (at your option) any
-! later version.
-!
-! In addition to the permissions in the GNU General Public License, the
-! Free Software Foundation gives you unlimited permission to link the
-! compiled version of this file with other programs, and to distribute
-! those programs without any restriction coming from the use of this
-! file. (The General Public License restrictions do apply in other
-! respects; for example, they cover modification of the file, and
-! distribution when not linked into another program.)
-!
-! This file 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; 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 link this library with files
-! compiled with GCC to produce an executable, this does not 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.
-!
-
-! This file takes control of the process from the kernel, as specified
-! in section 3 of the SVr4 ABI.
-! This file is the first thing linked into any executable.
-
- .section ".text"
- .proc 022
- .global _start
-
-_start:
- mov 0, %fp ! Mark bottom frame pointer
- ld [%sp + 64], %l0 ! argc
- add %sp, 68, %l1 ! argv
-
- ! Leave some room for a call. Sun leaves 32 octets (to sit on
- ! a cache line?) so we do too.
- sub %sp, 32, %sp
-
- ! %g1 may contain a function to be registered w/atexit
- orcc %g0, %g1, %g0
- be .nope
- mov %g1, %o0
- call atexit
- nop
-.nope:
- ! Now make sure constructors and destructors are handled.
- set _fini, %o0
- call atexit, 1
- nop
- call _init, 0
- nop
-
- ! We ignore the auxiliary vector; there's no defined way to
- ! access those data anyway. Instead, go straight to main:
- mov %l0, %o0 ! argc
- mov %l1, %o1 ! argv
- set ___Argv, %o3
- st %o1, [%o3] ! *___Argv
- ! Skip argc words past argv, to env:
- sll %l0, 2, %o2
- add %o2, 4, %o2
- add %l1, %o2, %o2 ! env
- set _environ, %o3
- st %o2, [%o3] ! *_environ
- call main, 4
- nop
- call exit, 0
- nop
- call _exit, 0
- nop
- ! We should never get here.
-
- .type _start,#function
- .size _start,.-_start
diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
deleted file mode 100644
index fca28be7b11..00000000000
--- a/gcc/config/sparc/sol2.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SPARC running Solaris 2
- Copyright 1992, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@netcom.com).
- Additional changes by David V. Henkel-Wallace (gumby@cygnus.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. */
-
-/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
-#include "sparc/sysv4.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dsun -Dsparc -Dunix -D__svr4__ -D__SVR4 \
- -Asystem(unix) -Asystem(svr4) -Acpu(sparc) -Amachine(sparc)\
- -D__GCC_NEW_VARARGS__"
-
-#undef CPP_SPEC
-#define CPP_SPEC "\
-%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \
-%(cpp_cpu) \
-"
-
-/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
- It's safe to pass -s always, even if -g is not used. */
-#undef ASM_SPEC
-#define ASM_SPEC "\
-%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
-%{fpic:-K PIC} %{fPIC:-K PIC} \
-%(asm_cpu) \
-"
-
-/* This is here rather than in sparc.h because it's not known what
- other assemblers will accept. */
-#if TARGET_CPU_DEFAULT == TARGET_CPU_sparc64
-#undef ASM_DEFAULT_SPEC
-#define ASM_DEFAULT_SPEC "-xarch=v8plus"
-#endif
-#undef ASM_CPU_SPEC
-#define ASM_CPU_SPEC "\
-%{mcpu=v8plus:-xarch=v8plus} \
-%{mcpu=ultrasparc:-xarch=v8plus} \
-%{!mcpu*:%(asm_default)} \
-"
-
-/* However it appears that Solaris 2.0 uses the same reg numbering as
- the old BSD-style system did. */
-
-#undef DBX_REGISTER_NUMBER
-/* Same as sparc.h */
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* We use stabs-in-elf for debugging, because that is what the native
- toolchain uses. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* The Solaris 2 assembler uses .skip, not .zero, so put this back. */
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.skip %u\n", (SIZE))
-
-/* Use .uahalf/.uaword so packed structure members don't generate
- assembler errors when using the native assembler. */
-#undef ASM_SHORT
-#define ASM_SHORT ".uahalf"
-#undef ASM_LONG
-#define ASM_LONG ".uaword"
-
-/* This is how to output a definition of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
-
-/* This is how to output a reference to an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABELREF
-#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
- fprintf (FILE, ".L%s%d", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
-
-
-/* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us.
- We don't use the standard LIB_SPEC only because we don't yet support c++ */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared: \
- %{!symbolic: \
- %{p:mcrt1.o%s} \
- %{!p: \
- %{pg:gcrt1.o%s gmon.o%s} \
- %{!pg:crt1.o%s}}}} \
- crti.o%s \
- %{ansi:values-Xc.o%s} \
- %{!ansi: \
- %{traditional:values-Xt.o%s} \
- %{!traditional:values-Xa.o%s}} \
- crtbegin.o%s"
-
-/* ??? Note: in order for -compat-bsd to work fully,
- we must somehow arrange to fixincludes /usr/ucbinclude
- and put the result in $(libsubdir)/ucbinclude. */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} %{!shared:%{!symbolic:-lc}}"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
-
-/* This should be the same as in svr4.h, except with -R added. */
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{h*} %{v:-V} \
- %{b} %{Wl,*:%*} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy %{!mimpure-text:-z text} %{!h*:%{o*:-h %*}}} \
- %{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}} \
- %{G:-G} \
- %{YP,*} \
- %{R*} \
- %{compat-bsd: \
- %{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
- -R /usr/ucblib} \
- %{!compat-bsd: \
- %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}} \
- %{Qy:} %{!Qn:-Qy}"
-
-/* This defines which switch letters take arguments.
- It is as in svr4.h but with -R added. */
-
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
- (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
- || (CHAR) == 'R' \
- || (CHAR) == 'h' \
- || (CHAR) == 'x' \
- || (CHAR) == 'z')
-
-/* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h.
- Instead, it is enabled here, because it does work under Solaris. */
-/* Define for support of TFmode long double and REAL_ARITHMETIC.
- Sparc ABI says that long double is 4 words. */
-#define LONG_DOUBLE_TYPE_SIZE 128
diff --git a/gcc/config/sparc/sp64-aout.h b/gcc/config/sparc/sp64-aout.h
deleted file mode 100644
index f17cd6dfb1f..00000000000
--- a/gcc/config/sparc/sp64-aout.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SPARC64, a.out.
- Copyright (C) 1994, 1996 Free Software Foundation, Inc.
- Contributed by Doug Evans, dje@cygnus.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 is a v9 only compiler. -mv8 is not expected to work. If you want
- a v8/v9 compiler, this isn't the place to do it.
-
- The only code model supported is Medium/Low. */
-
-#define SPARC_V9 1 /* See sparc.h. */
-#define SPARC_ARCH64 1
-
-#include "sparc/sparc.h"
-#include "aoutos.h"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (sparc64-aout)")
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT \
- (MASK_V9 + MASK_ARCH64 + MASK_PTR64 + MASK_HARD_QUAD \
- + MASK_MEDLOW + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
diff --git a/gcc/config/sparc/sp64-elf.h b/gcc/config/sparc/sp64-elf.h
deleted file mode 100644
index f0a36e6a1d1..00000000000
--- a/gcc/config/sparc/sp64-elf.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SPARC64, ELF.
- Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Doug Evans, dje@cygnus.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 is a v9 only compiler. -mv8 is not expected to work. If you want
- a v8/v9 compiler, this isn't the place to do it. */
-
-#define SPARC_V9 1 /* See sparc.h. */
-#define SPARC_ARCH64 1
-
-/* ??? We're taking the scheme of including another file and then overriding
- the values we don't like a bit too far here. The alternative is to more or
- less duplicate all of svr4.h, sparc/sysv4.h, and sparc/sol2.h here
- (suitably cleaned up). */
-
-#include "sparc/sol2.h"
-
-#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (sparc64-elf)")
-
-/* A v9 compiler with stack-bias, 32 bit integers and 64 bit pointers,
- in a Medium/Anywhere code model environment. */
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT \
- (MASK_V9 + MASK_ARCH64 + MASK_PTR64 + MASK_HARD_QUAD \
- + MASK_STACK_BIAS + MASK_MEDANY + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
-
-/* __svr4__ is used by the C library */
-/* ??? __arch64__ is subject to change. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "\
--D__sparc__ -D__sparc_v9__ -D__arch64__ -D__svr4__ \
--Acpu(sparc64) -Amachine(sparc64) \
-"
-
-#undef CPP_SPEC
-#define CPP_SPEC "\
-%{mint64:-D__INT_MAX__=9223372036854775807LL -D__LONG_MAX__=9223372036854775807LL} \
-%{mlong64:-D__LONG_MAX__=9223372036854775807LL} \
-%{mlittle-endian:-D__LITTLE_ENDIAN__} \
-"
-
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
-#undef ASM_SPEC
-#define ASM_SPEC "\
-%{v:-V} -s %{fpic:-K PIC} %{fPIC:-K PIC} \
-%{mlittle-endian:-EL} \
-"
-
-/* This is taken from sol2.h. */
-#undef LINK_SPEC
-#define LINK_SPEC "\
-%{v:-V} \
-%{mlittle-endian:-EL} \
-"
-
-/* We need something a little simpler for the embedded environment.
- Profiling doesn't really work yet so we just copy the default. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "\
-%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}} \
-crtbegin.o%s \
-"
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s"
-
-/* Use the default (for now). */
-#undef LIB_SPEC
-
-/* V9 chips can handle either endianness. */
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
-{"big-endian", -MASK_LITTLE_ENDIAN}, \
-{"little-endian", MASK_LITTLE_ENDIAN},
-
-#undef BYTES_BIG_ENDIAN
-#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
-
-#undef WORDS_BIG_ENDIAN
-#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
-
-/* Unfortunately, svr4.h redefines these so we have to restore them to
- their original values in sparc.h. */
-/* ??? It might be possible to eventually get svr4.h to do the right thing. */
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long long int"
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "long long unsigned int"
-
-/* ??? This should be 32 bits for v9 but what can we do? */
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "short unsigned int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 16
-
-/* The medium/anywhere code model practically requires us to put jump tables
- in the text section as gcc is unable to distinguish LABEL_REF's of jump
- tables from other label refs (when we need to). */
-#undef JUMP_TABLES_IN_TEXT_SECTION
-#define JUMP_TABLES_IN_TEXT_SECTION
-
-/* System V Release 4 uses DWARF debugging info.
- GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF
- anyway so it is the default. */
-
-#define DWARF_DEBUGGING_INFO
-#define DBX_DEBUGGING_INFO
-
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
-
-/* Stabs doesn't use this, and it confuses a simulator. */
-/* ??? Need to see what DWARF needs, if anything. */
-#undef ASM_IDENTIFY_GCC
-#define ASM_IDENTIFY_GCC(FILE)
-
-/* Define the names of various pseudo-ops used by the Sparc/svr4 assembler.
- ??? If ints are 64 bits then UNALIGNED_INT_ASM_OP (defined elsewhere) is
- misnamed. These should all refer to explicit sizes (half/word/xword?),
- anything other than short/int/long/etc. */
-
-#define UNALIGNED_LONGLONG_ASM_OP ".uaxword"
-
-/* DWARF stuff. */
-
-#define ASM_OUTPUT_DWARF_ADDR(FILE, LABEL) \
-do { \
- fprintf ((FILE), "\t%s\t", UNALIGNED_LONGLONG_ASM_OP); \
- assemble_name ((FILE), (LABEL)); \
- fprintf ((FILE), "\n"); \
-} while (0)
-
-#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, RTX) \
-do { \
- fprintf ((FILE), "\t%s\t", UNALIGNED_LONGLONG_ASM_OP); \
- output_addr_const ((FILE), (RTX)); \
- fputc ('\n', (FILE)); \
-} while (0)
-
-/* ??? Not sure if this should be 4 or 8 bytes. 4 works for now. */
-#define ASM_OUTPUT_DWARF_REF(FILE, LABEL) \
-do { \
- fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \
- assemble_name ((FILE), (LABEL)); \
- fprintf ((FILE), "\n"); \
-} while (0)
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
deleted file mode 100644
index 21f230cd0c6..00000000000
--- a/gcc/config/sparc/sparc.c
+++ /dev/null
@@ -1,5093 +0,0 @@
-/* Subroutines for insn-output.c for Sun SPARC.
- Copyright (C) 1987, 88, 89, 92-95, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.com)
- 64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
- at Cygnus Support.
-
-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 <stdio.h>
-#include "config.h"
-#include "tree.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#include "flags.h"
-#include "expr.h"
-#include "recog.h"
-
-/* 1 if the caller has placed an "unimp" insn immediately after the call.
- This is used in v8 code when calling a function that returns a structure.
- v9 doesn't have this. Be careful to have this test be the same as that
- used on the call. */
-
-#define SKIP_CALLERS_UNIMP_P \
-(!TARGET_ARCH64 && current_function_returns_struct \
- && ! integer_zerop (DECL_SIZE (DECL_RESULT (current_function_decl))) \
- && (TREE_CODE (DECL_SIZE (DECL_RESULT (current_function_decl))) \
- == INTEGER_CST))
-
-/* Global variables for machine-dependent things. */
-
-/* Size of frame. Need to know this to emit return insns from leaf procedures.
- ACTUAL_FSIZE is set by compute_frame_size() which is called during the
- reload pass. This is important as the value is later used in insn
- scheduling (to see what can go in a delay slot).
- APPARENT_FSIZE is the size of the stack less the register save area and less
- the outgoing argument area. It is used when saving call preserved regs. */
-static int apparent_fsize;
-static int actual_fsize;
-
-/* Save the operands last given to a compare for use when we
- generate a scc or bcc insn. */
-
-rtx sparc_compare_op0, sparc_compare_op1;
-
-/* Count of named arguments (v9 only).
- ??? INIT_CUMULATIVE_ARGS initializes these, and FUNCTION_ARG_ADVANCE
- increments SPARC_ARG_COUNT. They are then used by
- FUNCTION_ARG_CALLEE_COPIES to determine if the argument is really a named
- argument or not. This hack is necessary because the NAMED argument to the
- FUNCTION_ARG_XXX macros is not what it says it is: it does not include the
- last named argument. */
-
-int sparc_arg_count;
-int sparc_n_named_args;
-
-/* We may need an epilogue if we spill too many registers.
- If this is non-zero, then we branch here for the epilogue. */
-static rtx leaf_label;
-
-#ifdef LEAF_REGISTERS
-
-/* Vector to say how input registers are mapped to output
- registers. FRAME_POINTER_REGNUM cannot be remapped by
- this function to eliminate it. You must use -fomit-frame-pointer
- to get that. */
-char leaf_reg_remap[] =
-{ 0, 1, 2, 3, 4, 5, 6, 7,
- -1, -1, -1, -1, -1, -1, 14, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 8, 9, 10, 11, 12, 13, -1, 15,
-
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100};
-
-#endif
-
-/* Name of where we pretend to think the frame pointer points.
- Normally, this is "%fp", but if we are in a leaf procedure,
- this is "%sp+something". We record "something" separately as it may be
- too big for reg+constant addressing. */
-
-static char *frame_base_name;
-static int frame_base_offset;
-
-static rtx find_addr_reg ();
-static void sparc_init_modes ();
-
-/* Option handling. */
-
-struct sparc_cpu_select sparc_select[] =
-{
- /* switch name, tune arch */
- { (char *)0, "default", 1, 1 },
- { (char *)0, "-mcpu=", 1, 1 },
- { (char *)0, "-mtune=", 1, 0 },
- { 0, 0 }
-};
-
-/* CPU type. This is set from TARGET_CPU_DEFAULT and -m{cpu,tune}=xxx. */
-enum processor_type sparc_cpu;
-
-/* Validate and override various options, and do some machine dependent
- initialization. */
-
-void
-sparc_override_options ()
-{
- /* Map TARGET_CPU_DEFAULT to value for -m{arch,tune}=. */
- static struct cpu_default {
- int cpu;
- char *name;
- } cpu_default[] = {
- { TARGET_CPU_sparc, "cypress" },
- { TARGET_CPU_v8, "v8" },
- { TARGET_CPU_supersparc, "supersparc" },
- { TARGET_CPU_sparclet, "tsc701" },
- { TARGET_CPU_sparclite, "f930" },
- { TARGET_CPU_ultrasparc, "ultrasparc" },
- { 0 }
- };
- struct cpu_default *def;
- /* Table of values for -m{cpu,tune}=. */
- static struct cpu_table {
- char *name;
- enum processor_type processor;
- int disable;
- int enable;
- } cpu_table[] = {
- { "v7", PROCESSOR_V7, MASK_ISA, 0 },
- { "cypress", PROCESSOR_CYPRESS, MASK_ISA, 0 },
- { "v8", PROCESSOR_V8, MASK_ISA, MASK_V8 },
- /* TI TMS390Z55 supersparc */
- { "supersparc", PROCESSOR_SUPERSPARC, MASK_ISA, MASK_V8 },
- { "sparclite", PROCESSOR_SPARCLITE, MASK_ISA, MASK_SPARCLITE },
- /* The Fujitsu MB86930 is the original sparclite chip, with no fpu.
- The Fujitsu MB86934 is the recent sparclite chip, with an fpu. */
- { "f930", PROCESSOR_F930, MASK_ISA|MASK_FPU, MASK_SPARCLITE },
- { "f934", PROCESSOR_F934, MASK_ISA, MASK_SPARCLITE|MASK_FPU },
- { "sparclet", PROCESSOR_SPARCLET, MASK_ISA, MASK_SPARCLET },
- /* TEMIC sparclet */
- { "tsc701", PROCESSOR_TSC701, MASK_ISA, MASK_SPARCLET },
- /* "v9" is used to specify a true 64 bit architecture.
- "v8plus" is what Sun calls Solaris2 running on UltraSPARC's. */
- { "v8plus", PROCESSOR_V8PLUS, MASK_ISA, MASK_V9 },
-#if SPARC_ARCH64
- { "v9", PROCESSOR_V9, MASK_ISA, MASK_V9 },
-#endif
- /* TI ultrasparc */
- { "ultrasparc", PROCESSOR_ULTRASPARC, MASK_ISA, MASK_V9 },
- { 0 }
- };
- struct cpu_table *cpu;
- struct sparc_cpu_select *sel;
-
- int fpu = TARGET_FPU; /* save current -mfpu status */
-
- /* Set the default. */
- for (def = &cpu_default[0]; def->name; ++def)
- if (def->cpu == TARGET_CPU_DEFAULT)
- break;
- if (! def->name)
- abort ();
- sparc_select[0].string = def->name;
-
- for (sel = &sparc_select[0]; sel->name; ++sel)
- {
- if (sel->string)
- {
- for (cpu = &cpu_table[0]; cpu->name; ++cpu)
- if (! strcmp (sel->string, cpu->name))
- {
- if (sel->set_tune_p)
- sparc_cpu = cpu->processor;
-
- if (sel->set_arch_p)
- {
- target_flags &= ~cpu->disable;
- target_flags |= cpu->enable;
- }
- break;
- }
-
- if (! cpu->name)
- error ("bad value (%s) for %s switch", sel->string, sel->name);
- }
- }
-
- /* If -mfpu or -mno-fpu was explicitly used, don't override with
- the processor default. */
- if (TARGET_FPU_SET)
- target_flags = (target_flags & ~MASK_FPU) | fpu;
-
- /* Use the deprecated v8 insns for sparc64 in 32 bit mode. */
- if (TARGET_V9 && TARGET_ARCH32)
- target_flags |= MASK_DEPRECATED_V8_INSNS;
-
- /* Do various machine dependent initializations. */
- sparc_init_modes ();
-}
-
-/* Float conversions (v9 only).
-
- The floating point registers cannot hold DImode values because SUBREG's
- on them get the wrong register. "(subreg:SI (reg:DI M int-reg) 0)" is the
- same as "(subreg:SI (reg:DI N float-reg) 1)", but gcc doesn't know how to
- turn the "0" to a "1". Therefore, we must explicitly do the conversions
- to/from int/fp regs. `sparc64_fpconv_stack_slot' is the address of an
- 8 byte stack slot used during the transfer.
- ??? I could have used [%fp-16] but I didn't want to add yet another
- dependence on this. */
-/* ??? Can we use assign_stack_temp here? */
-
-static rtx fpconv_stack_temp;
-
-/* Called once for each function. */
-
-void
-sparc64_init_expanders ()
-{
- fpconv_stack_temp = NULL_RTX;
-}
-
-/* Assign a stack temp for fp/int DImode conversions. */
-
-rtx
-sparc64_fpconv_stack_temp ()
-{
- if (fpconv_stack_temp == NULL_RTX)
- fpconv_stack_temp =
- assign_stack_local (DImode, GET_MODE_SIZE (DImode), 0);
-
- return fpconv_stack_temp;
-}
-
-/* Miscellaneous utilities. */
-
-/* Nonzero if CODE, a comparison, is suitable for use in v9 conditional move
- or branch on register contents instructions. */
-
-int
-v9_regcmp_p (code)
- enum rtx_code code;
-{
- return (code == EQ || code == NE || code == GE || code == LT
- || code == LE || code == GT);
-}
-
-/* Operand constraints. */
-
-/* Return non-zero only if OP is a register of mode MODE,
- or const0_rtx. Don't allow const0_rtx if TARGET_LIVE_G0 because
- %g0 may contain anything. */
-
-int
-reg_or_0_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
- if (TARGET_LIVE_G0)
- return 0;
- if (op == const0_rtx)
- return 1;
- if (GET_MODE (op) == VOIDmode && GET_CODE (op) == CONST_DOUBLE
- && CONST_DOUBLE_HIGH (op) == 0
- && CONST_DOUBLE_LOW (op) == 0)
- return 1;
- if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT
- && GET_CODE (op) == CONST_DOUBLE
- && fp_zero_operand (op))
- return 1;
- return 0;
-}
-
-/* Nonzero if OP is a floating point value with value 0.0. */
-
-int
-fp_zero_operand (op)
- rtx op;
-{
- REAL_VALUE_TYPE r;
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, op);
- return (REAL_VALUES_EQUAL (r, dconst0) && ! REAL_VALUE_MINUS_ZERO (r));
-}
-
-/* Nonzero if OP is an integer register. */
-
-int
-intreg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, SImode)
- || (TARGET_ARCH64 && register_operand (op, DImode)));
-}
-
-/* Nonzero if OP is a floating point condition code register. */
-
-int
-fcc_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- /* This can happen when recog is called from combine. Op may be a MEM.
- Fail instead of calling abort in this case. */
- if (GET_CODE (op) != REG)
- return 0;
-
- if (mode != VOIDmode && mode != GET_MODE (op))
- return 0;
- if (mode == VOIDmode
- && (GET_MODE (op) != CCFPmode && GET_MODE (op) != CCFPEmode))
- return 0;
-
-#if 0 /* ??? ==> 1 when %fcc0-3 are pseudos first. See gen_compare_reg(). */
- if (reg_renumber == 0)
- return REGNO (op) >= FIRST_PSEUDO_REGISTER;
- return REGNO_OK_FOR_CCFP_P (REGNO (op));
-#else
- return (unsigned) REGNO (op) - SPARC_FIRST_V9_FCC_REG < 4;
-#endif
-}
-
-/* Nonzero if OP is an integer or floating point condition code register. */
-
-int
-icc_or_fcc_reg_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == REG && REGNO (op) == SPARC_ICC_REG)
- {
- if (mode != VOIDmode && mode != GET_MODE (op))
- return 0;
- if (mode == VOIDmode
- && GET_MODE (op) != CCmode && GET_MODE (op) != CCXmode)
- return 0;
- return 1;
- }
-
- return fcc_reg_operand (op, mode);
-}
-
-/* Nonzero if OP can appear as the dest of a RESTORE insn. */
-int
-restore_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == REG && GET_MODE (op) == mode
- && (REGNO (op) < 8 || (REGNO (op) >= 24 && REGNO (op) < 32)));
-}
-
-/* Call insn on SPARC can take a PC-relative constant address, or any regular
- memory address. */
-
-int
-call_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != MEM)
- abort ();
- op = XEXP (op, 0);
- return (symbolic_operand (op, mode) || memory_address_p (Pmode, op));
-}
-
-int
-call_operand_address (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (symbolic_operand (op, mode) || memory_address_p (Pmode, op));
-}
-
-/* Returns 1 if OP is either a symbol reference or a sum of a symbol
- reference and a constant. */
-
-int
-symbolic_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- return 1;
-
- case CONST:
- op = XEXP (op, 0);
- return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (op, 0)) == LABEL_REF)
- && GET_CODE (XEXP (op, 1)) == CONST_INT);
-
- /* ??? This clause seems to be irrelevant. */
- case CONST_DOUBLE:
- return GET_MODE (op) == mode;
-
- default:
- return 0;
- }
-}
-
-/* Return truth value of statement that OP is a symbolic memory
- operand of mode MODE. */
-
-int
-symbolic_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
- if (GET_CODE (op) != MEM)
- return 0;
- op = XEXP (op, 0);
- return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST
- || GET_CODE (op) == HIGH || GET_CODE (op) == LABEL_REF);
-}
-
-/* Return truth value of statement that OP is a LABEL_REF of mode MODE. */
-
-int
-label_ref_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != LABEL_REF)
- return 0;
- if (GET_MODE (op) != mode)
- return 0;
- return 1;
-}
-
-/* Return 1 if the operand is an argument used in generating pic references
- in either the medium/low or medium/anywhere code models of sparc64. */
-
-int
-sp64_medium_pic_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- /* Check for (const (minus (symbol_ref:GOT)
- (const (minus (label) (pc))))). */
- if (GET_CODE (op) != CONST)
- return 0;
- op = XEXP (op, 0);
- if (GET_CODE (op) != MINUS)
- return 0;
- if (GET_CODE (XEXP (op, 0)) != SYMBOL_REF)
- return 0;
- /* ??? Ensure symbol is GOT. */
- if (GET_CODE (XEXP (op, 1)) != CONST)
- return 0;
- if (GET_CODE (XEXP (XEXP (op, 1), 0)) != MINUS)
- return 0;
- return 1;
-}
-
-/* Return 1 if the operand is a data segment reference. This includes
- the readonly data segment, or in other words anything but the text segment.
- This is needed in the medium/anywhere code model on v9. These values
- are accessed with MEDANY_BASE_REG. */
-
-int
-data_segment_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case SYMBOL_REF :
- return ! SYMBOL_REF_FLAG (op);
- case PLUS :
- /* Assume canonical format of symbol + constant.
- Fall through. */
- case CONST :
- return data_segment_operand (XEXP (op, 0));
- default :
- return 0;
- }
-}
-
-/* Return 1 if the operand is a text segment reference.
- This is needed in the medium/anywhere code model on v9. */
-
-int
-text_segment_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- switch (GET_CODE (op))
- {
- case LABEL_REF :
- return 1;
- case SYMBOL_REF :
- return SYMBOL_REF_FLAG (op);
- case PLUS :
- /* Assume canonical format of symbol + constant.
- Fall through. */
- case CONST :
- return text_segment_operand (XEXP (op, 0));
- default :
- return 0;
- }
-}
-
-/* Return 1 if the operand is either a register or a memory operand that is
- not symbolic. */
-
-int
-reg_or_nonsymb_mem_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
-
- if (memory_operand (op, mode) && ! symbolic_memory_operand (op, mode))
- return 1;
-
- return 0;
-}
-
-int
-sparc_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (register_operand (op, mode))
- return 1;
- if (GET_CODE (op) == CONST_INT)
- return SMALL_INT (op);
- if (GET_MODE (op) != mode)
- return 0;
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
- if (GET_CODE (op) != MEM)
- return 0;
-
- op = XEXP (op, 0);
- if (GET_CODE (op) == LO_SUM)
- return (GET_CODE (XEXP (op, 0)) == REG
- && symbolic_operand (XEXP (op, 1), Pmode));
- return memory_address_p (mode, op);
-}
-
-int
-move_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (mode == DImode && arith_double_operand (op, mode))
- return 1;
- if (register_operand (op, mode))
- return 1;
- if (GET_CODE (op) == CONST_INT)
- return (SMALL_INT (op) || (INTVAL (op) & 0x3ff) == 0);
-
- if (GET_MODE (op) != mode)
- return 0;
- if (GET_CODE (op) == SUBREG)
- op = SUBREG_REG (op);
- if (GET_CODE (op) != MEM)
- return 0;
- op = XEXP (op, 0);
- if (GET_CODE (op) == LO_SUM)
- return (register_operand (XEXP (op, 0), Pmode)
- && CONSTANT_P (XEXP (op, 1)));
- return memory_address_p (mode, op);
-}
-
-int
-splittable_symbolic_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != MEM)
- return 0;
- if (! symbolic_operand (XEXP (op, 0), Pmode))
- return 0;
- return 1;
-}
-
-int
-splittable_immediate_memory_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != MEM)
- return 0;
- if (! immediate_operand (XEXP (op, 0), Pmode))
- return 0;
- return 1;
-}
-
-/* Return truth value of whether OP is EQ or NE. */
-
-int
-eq_or_neq (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == EQ || GET_CODE (op) == NE);
-}
-
-/* Return 1 if this is a comparison operator, but not an EQ, NE, GEU,
- or LTU for non-floating-point. We handle those specially. */
-
-int
-normal_comp_operator (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (op);
-
- if (GET_RTX_CLASS (code) != '<')
- return 0;
-
- if (GET_MODE (XEXP (op, 0)) == CCFPmode
- || GET_MODE (XEXP (op, 0)) == CCFPEmode)
- return 1;
-
- return (code != NE && code != EQ && code != GEU && code != LTU);
-}
-
-/* Return 1 if this is a comparison operator. This allows the use of
- MATCH_OPERATOR to recognize all the branch insns. */
-
-int
-noov_compare_op (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (op);
-
- if (GET_RTX_CLASS (code) != '<')
- return 0;
-
- if (GET_MODE (XEXP (op, 0)) == CC_NOOVmode)
- /* These are the only branches which work with CC_NOOVmode. */
- return (code == EQ || code == NE || code == GE || code == LT);
- return 1;
-}
-
-/* Nonzero if OP is a comparison operator suitable for use in v9
- conditional move or branch on register contents instructions. */
-
-int
-v9_regcmp_op (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- enum rtx_code code = GET_CODE (op);
-
- if (GET_RTX_CLASS (code) != '<')
- return 0;
-
- return v9_regcmp_p (code);
-}
-
-/* Return 1 if this is a SIGN_EXTEND or ZERO_EXTEND operation. */
-
-int
-extend_op (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == SIGN_EXTEND || GET_CODE (op) == ZERO_EXTEND;
-}
-
-/* Return nonzero if OP is an operator of mode MODE which can set
- the condition codes explicitly. We do not include PLUS and MINUS
- because these require CC_NOOVmode, which we handle explicitly. */
-
-int
-cc_arithop (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) == AND
- || GET_CODE (op) == IOR
- || GET_CODE (op) == XOR)
- return 1;
-
- return 0;
-}
-
-/* Return nonzero if OP is an operator of mode MODE which can bitwise
- complement its second operand and set the condition codes explicitly. */
-
-int
-cc_arithopn (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- /* XOR is not here because combine canonicalizes (xor (not ...) ...)
- and (xor ... (not ...)) to (not (xor ...)). */
- return (GET_CODE (op) == AND
- || GET_CODE (op) == IOR);
-}
-
-/* Return true if OP is a register, or is a CONST_INT that can fit in a
- signed 13 bit immediate field. This is an acceptable SImode operand for
- most 3 address instructions. */
-
-int
-arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && SMALL_INT (op)));
-}
-
-/* Return true if OP is a register, or is a CONST_INT that can fit in a
- signed 11 bit immediate field. This is an acceptable SImode operand for
- the movcc instructions. */
-
-int
-arith11_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && SPARC_SIMM11_P (INTVAL (op))));
-}
-
-/* Return true if OP is a register, or is a CONST_INT that can fit in a
- signed 10 bit immediate field. This is an acceptable SImode operand for
- the movrcc instructions. */
-
-int
-arith10_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && SPARC_SIMM10_P (INTVAL (op))));
-}
-
-/* Return true if OP is a register, is a CONST_INT that fits in a 13 bit
- immediate field, or is a CONST_DOUBLE whose both parts fit in a 13 bit
- immediate field.
- v9: Return true if OP is a register, or is a CONST_INT or CONST_DOUBLE that
- can fit in a 13 bit immediate field. This is an acceptable DImode operand
- for most 3 address instructions. */
-
-int
-arith_double_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_INT && SMALL_INT (op))
- || (! TARGET_ARCH64
- && GET_CODE (op) == CONST_DOUBLE
- && (unsigned) (CONST_DOUBLE_LOW (op) + 0x1000) < 0x2000
- && (unsigned) (CONST_DOUBLE_HIGH (op) + 0x1000) < 0x2000)
- || (TARGET_ARCH64
- && GET_CODE (op) == CONST_DOUBLE
- && (unsigned) (CONST_DOUBLE_LOW (op) + 0x1000) < 0x2000
- && ((CONST_DOUBLE_HIGH (op) == -1
- && (CONST_DOUBLE_LOW (op) & 0x1000) == 0x1000)
- || (CONST_DOUBLE_HIGH (op) == 0
- && (CONST_DOUBLE_LOW (op) & 0x1000) == 0))));
-}
-
-/* Return true if OP is a register, or is a CONST_INT or CONST_DOUBLE that
- can fit in an 11 bit immediate field. This is an acceptable DImode
- operand for the movcc instructions. */
-/* ??? Replace with arith11_operand? */
-
-int
-arith11_double_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_DOUBLE
- && (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode)
- && (unsigned) (CONST_DOUBLE_LOW (op) + 0x400) < 0x800
- && ((CONST_DOUBLE_HIGH (op) == -1
- && (CONST_DOUBLE_LOW (op) & 0x400) == 0x400)
- || (CONST_DOUBLE_HIGH (op) == 0
- && (CONST_DOUBLE_LOW (op) & 0x400) == 0)))
- || (GET_CODE (op) == CONST_INT
- && (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode)
- && (unsigned) (INTVAL (op) + 0x400) < 0x800));
-}
-
-/* Return true if OP is a register, or is a CONST_INT or CONST_DOUBLE that
- can fit in an 10 bit immediate field. This is an acceptable DImode
- operand for the movrcc instructions. */
-/* ??? Replace with arith10_operand? */
-
-int
-arith10_double_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (register_operand (op, mode)
- || (GET_CODE (op) == CONST_DOUBLE
- && (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode)
- && (unsigned) (CONST_DOUBLE_LOW (op) + 0x200) < 0x400
- && ((CONST_DOUBLE_HIGH (op) == -1
- && (CONST_DOUBLE_LOW (op) & 0x200) == 0x200)
- || (CONST_DOUBLE_HIGH (op) == 0
- && (CONST_DOUBLE_LOW (op) & 0x200) == 0)))
- || (GET_CODE (op) == CONST_INT
- && (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode)
- && (unsigned) (INTVAL (op) + 0x200) < 0x400));
-}
-
-/* Return truth value of whether OP is a integer which fits the
- range constraining immediate operands in most three-address insns,
- which have a 13 bit immediate field. */
-
-int
-small_int (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT && SMALL_INT (op));
-}
-
-/* Recognize operand values for the umul instruction. That instruction sign
- extends immediate values just like all other sparc instructions, but
- interprets the extended result as an unsigned number. */
-
-int
-uns_small_int (op, mode)
- rtx op;
- enum machine_mode mode;
-{
-#if HOST_BITS_PER_WIDE_INT > 32
- /* All allowed constants will fit a CONST_INT. */
- return (GET_CODE (op) == CONST_INT
- && ((INTVAL (op) >= 0 && INTVAL (op) < 0x1000)
- || (INTVAL (op) >= 0xFFFFF000 && INTVAL (op) < 0x100000000L)));
-#else
- return ((GET_CODE (op) == CONST_INT && (unsigned) INTVAL (op) < 0x1000)
- || (GET_CODE (op) == CONST_DOUBLE
- && CONST_DOUBLE_HIGH (op) == 0
- && (unsigned) CONST_DOUBLE_LOW (op) - 0xFFFFF000 < 0x1000));
-#endif
-}
-
-int
-uns_arith_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return register_operand (op, mode) || uns_small_int (op, mode);
-}
-
-/* Return truth value of statement that OP is a call-clobbered register. */
-int
-clobbered_register (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == REG && call_used_regs[REGNO (op)]);
-}
-
-/* X and Y are two things to compare using CODE. Emit the compare insn and
- return the rtx for the cc reg in the proper mode. */
-
-rtx
-gen_compare_reg (code, x, y)
- enum rtx_code code;
- rtx x, y;
-{
- enum machine_mode mode = SELECT_CC_MODE (code, x, y);
- rtx cc_reg;
-
- /* ??? We don't have movcc patterns so we cannot generate pseudo regs for the
- fcc regs (cse can't tell they're really call clobbered regs and will
- remove a duplicate comparison even if there is an intervening function
- call - it will then try to reload the cc reg via an int reg which is why
- we need the movcc patterns). It is possible to provide the movcc
- patterns by using the ldxfsr/stxfsr v9 insns. I tried it: you need two
- registers (say %g1,%g5) and it takes about 6 insns. A better fix would be
- to tell cse that CCFPE mode registers (even pseudos) are call
- clobbered. */
-
- /* ??? This is an experiment. Rather than making changes to cse which may
- or may not be easy/clean, we do our own cse. This is possible because
- we will generate hard registers. Cse knows they're call clobbered (it
- doesn't know the same thing about pseudos). If we guess wrong, no big
- deal, but if we win, great! */
-
- if (TARGET_V9 && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
-#if 1 /* experiment */
- {
- int reg;
- /* We cycle through the registers to ensure they're all exercised. */
- static int next_fcc_reg = 0;
- /* Previous x,y for each fcc reg. */
- static rtx prev_args[4][2];
-
- /* Scan prev_args for x,y. */
- for (reg = 0; reg < 4; reg++)
- if (prev_args[reg][0] == x && prev_args[reg][1] == y)
- break;
- if (reg == 4)
- {
- reg = next_fcc_reg;
- prev_args[reg][0] = x;
- prev_args[reg][1] = y;
- next_fcc_reg = (next_fcc_reg + 1) & 3;
- }
- cc_reg = gen_rtx (REG, mode, reg + SPARC_FIRST_V9_FCC_REG);
- }
-#else
- cc_reg = gen_reg_rtx (mode);
-#endif /* ! experiment */
- else if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- cc_reg = gen_rtx (REG, mode, SPARC_FCC_REG);
- else
- cc_reg = gen_rtx (REG, mode, SPARC_ICC_REG);
-
- emit_insn (gen_rtx (SET, VOIDmode, cc_reg,
- gen_rtx (COMPARE, mode, x, y)));
-
- return cc_reg;
-}
-
-/* This function is used for v9 only.
- CODE is the code for an Scc's comparison.
- OPERANDS[0] is the target of the Scc insn.
- OPERANDS[1] is the value we compare against const0_rtx (which hasn't
- been generated yet).
-
- This function is needed to turn
-
- (set (reg:SI 110)
- (gt (reg:CCX 0 %g0)
- (const_int 0)))
- into
- (set (reg:SI 110)
- (gt:DI (reg:CCX 0 %g0)
- (const_int 0)))
-
- IE: The instruction recognizer needs to see the mode of the comparison to
- find the right instruction. We could use "gt:DI" right in the
- define_expand, but leaving it out allows us to handle DI, SI, etc.
-
- We refer to the global sparc compare operands sparc_compare_op0 and
- sparc_compare_op1.
-
- ??? Some of this is outdated as the scc insns set the mode of the
- comparison now.
-
- ??? We optimize for the case where op1 is 0 and the comparison allows us to
- use the "movrCC" insns. This reduces the generated code from three to two
- insns. This way seems too brute force though. Is there a more elegant way
- to achieve the same effect?
-*/
-
-int
-gen_v9_scc (compare_code, operands)
- enum rtx_code compare_code;
- register rtx *operands;
-{
- rtx temp;
-
- /* It might be that we'll never be called if this is true,
- but keep this here for documentation at least. */
- if (! TARGET_ARCH64
- && (GET_MODE (sparc_compare_op0) == DImode
- || GET_MODE (operands[0]) == DImode))
- return 0;
-
- /* Try to use the movrCC insns. */
- if (TARGET_ARCH64
- && GET_MODE_CLASS (GET_MODE (sparc_compare_op0)) == MODE_INT
- && sparc_compare_op1 == const0_rtx
- && v9_regcmp_p (compare_code))
- {
- /* Special case for op0 != 0. This can be done with one instruction if
- op0 can be clobbered. We store to a temp, and then clobber the temp,
- but the combiner will remove the first insn. */
-
- if (compare_code == NE
- && GET_MODE (operands[0]) == DImode
- && GET_MODE (sparc_compare_op0) == DImode)
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], sparc_compare_op0));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (IF_THEN_ELSE, DImode,
- gen_rtx (compare_code, DImode,
- sparc_compare_op0, const0_rtx),
- const1_rtx,
- operands[0])));
- return 1;
- }
-
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], const0_rtx));
- if (GET_MODE (sparc_compare_op0) != DImode)
- {
- temp = gen_reg_rtx (DImode);
- convert_move (temp, sparc_compare_op0, 0);
- }
- else
- {
- temp = sparc_compare_op0;
- }
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (IF_THEN_ELSE, GET_MODE (operands[0]),
- gen_rtx (compare_code, DImode,
- temp, const0_rtx),
- const1_rtx,
- operands[0])));
- return 1;
- }
- else
- {
- operands[1] = gen_compare_reg (compare_code,
- sparc_compare_op0, sparc_compare_op1);
-
- switch (GET_MODE (operands[1]))
- {
- case CCmode :
- case CCXmode :
- case CCFPEmode :
- case CCFPmode :
- break;
- default :
- abort ();
- }
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], const0_rtx));
- emit_insn (gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (IF_THEN_ELSE, GET_MODE (operands[0]),
- gen_rtx (compare_code,
- GET_MODE (operands[1]),
- operands[1], const0_rtx),
- const1_rtx, operands[0])));
- return 1;
- }
-}
-
-/* Emit a conditional jump insn for the v9 architecture using comparison code
- CODE and jump target LABEL.
- This function exists to take advantage of the v9 brxx insns. */
-
-void
-emit_v9_brxx_insn (code, op0, label)
- enum rtx_code code;
- rtx op0, label;
-{
- emit_jump_insn (gen_rtx (SET, VOIDmode,
- pc_rtx,
- gen_rtx (IF_THEN_ELSE, VOIDmode,
- gen_rtx (code, GET_MODE (op0),
- op0, const0_rtx),
- gen_rtx (LABEL_REF, VOIDmode, label),
- pc_rtx)));
-}
-
-/* Return nonzero if a return peephole merging return with
- setting of output register is ok. */
-int
-leaf_return_peephole_ok ()
-{
- return (actual_fsize == 0);
-}
-
-/* Return nonzero if TRIAL can go into the function epilogue's
- delay slot. SLOT is the slot we are trying to fill. */
-
-int
-eligible_for_epilogue_delay (trial, slot)
- rtx trial;
- int slot;
-{
- rtx pat, src;
-
- if (slot >= 1)
- return 0;
- if (GET_CODE (trial) != INSN
- || GET_CODE (PATTERN (trial)) != SET)
- return 0;
- if (get_attr_length (trial) != 1)
- return 0;
-
- /* If %g0 is live, there are lots of things we can't handle.
- Rather than trying to find them all now, let's punt and only
- optimize things as necessary. */
- if (TARGET_LIVE_G0)
- return 0;
-
- /* In the case of a true leaf function, anything can go into the delay slot.
- A delay slot only exists however if the frame size is zero, otherwise
- we will put an insn to adjust the stack after the return. */
- if (leaf_function)
- {
- if (leaf_return_peephole_ok ())
- return (get_attr_in_uncond_branch_delay (trial) == IN_BRANCH_DELAY_TRUE);
- return 0;
- }
- /* If only trivial `restore' insns work, nothing can go in the
- delay slot. */
- else if (TARGET_BROKEN_SAVERESTORE)
- return 0;
-
- pat = PATTERN (trial);
-
- /* Otherwise, only operations which can be done in tandem with
- a `restore' insn can go into the delay slot. */
- if (GET_CODE (SET_DEST (pat)) != REG
- || REGNO (SET_DEST (pat)) >= 32
- || REGNO (SET_DEST (pat)) < 24)
- return 0;
-
- src = SET_SRC (pat);
- if (arith_operand (src, GET_MODE (src)))
- return GET_MODE_SIZE (GET_MODE (src)) <= GET_MODE_SIZE (SImode);
- if (arith_double_operand (src, GET_MODE (src)))
- return GET_MODE_SIZE (GET_MODE (src)) <= GET_MODE_SIZE (DImode);
- if (GET_CODE (src) == PLUS)
- {
- if (register_operand (XEXP (src, 0), SImode)
- && arith_operand (XEXP (src, 1), SImode))
- return 1;
- if (register_operand (XEXP (src, 1), SImode)
- && arith_operand (XEXP (src, 0), SImode))
- return 1;
- if (register_operand (XEXP (src, 0), DImode)
- && arith_double_operand (XEXP (src, 1), DImode))
- return 1;
- if (register_operand (XEXP (src, 1), DImode)
- && arith_double_operand (XEXP (src, 0), DImode))
- return 1;
- }
- if (GET_CODE (src) == MINUS
- && register_operand (XEXP (src, 0), SImode)
- && small_int (XEXP (src, 1), VOIDmode))
- return 1;
- if (GET_CODE (src) == MINUS
- && register_operand (XEXP (src, 0), DImode)
- && !register_operand (XEXP (src, 1), DImode)
- && arith_double_operand (XEXP (src, 1), DImode))
- return 1;
- return 0;
-}
-
-int
-short_branch (uid1, uid2)
- int uid1, uid2;
-{
- unsigned int delta = insn_addresses[uid1] - insn_addresses[uid2];
- if (delta + 1024 < 2048)
- return 1;
- /* warning ("long branch, distance %d", delta); */
- return 0;
-}
-
-/* Return non-zero if REG is not used after INSN.
- We assume REG is a reload reg, and therefore does
- not live past labels or calls or jumps. */
-int
-reg_unused_after (reg, insn)
- rtx reg;
- rtx insn;
-{
- enum rtx_code code, prev_code = UNKNOWN;
-
- while (insn = NEXT_INSN (insn))
- {
- if (prev_code == CALL_INSN && call_used_regs[REGNO (reg)])
- return 1;
-
- code = GET_CODE (insn);
- if (GET_CODE (insn) == CODE_LABEL)
- return 1;
-
- if (GET_RTX_CLASS (code) == 'i')
- {
- rtx set = single_set (insn);
- int in_src = set && reg_overlap_mentioned_p (reg, SET_SRC (set));
- if (set && in_src)
- return 0;
- if (set && reg_overlap_mentioned_p (reg, SET_DEST (set)))
- return 1;
- if (set == 0 && reg_overlap_mentioned_p (reg, PATTERN (insn)))
- return 0;
- }
- prev_code = code;
- }
- return 1;
-}
-
-/* The rtx for the global offset table which is a special form
- that *is* a position independent symbolic constant. */
-static rtx pic_pc_rtx;
-
-/* Ensure that we are not using patterns that are not OK with PIC. */
-
-int
-check_pic (i)
- int i;
-{
- switch (flag_pic)
- {
- case 1:
- if (GET_CODE (recog_operand[i]) == SYMBOL_REF
- || (GET_CODE (recog_operand[i]) == CONST
- && ! rtx_equal_p (pic_pc_rtx, recog_operand[i])))
- abort ();
- case 2:
- default:
- return 1;
- }
-}
-
-/* Return true if X is an address which needs a temporary register when
- reloaded while generating PIC code. */
-
-int
-pic_address_needs_scratch (x)
- rtx x;
-{
- /* An address which is a symbolic plus a non SMALL_INT needs a temp reg. */
- if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && ! SMALL_INT (XEXP (XEXP (x, 0), 1)))
- return 1;
-
- return 0;
-}
-
-/* Legitimize PIC addresses. If the address is already position-independent,
- we return ORIG. Newly generated position-independent addresses go into a
- reg. This is REG if non zero, otherwise we allocate register(s) as
- necessary. */
-
-rtx
-legitimize_pic_address (orig, mode, reg)
- rtx orig;
- enum machine_mode mode;
- rtx reg;
-{
- if (GET_CODE (orig) == SYMBOL_REF)
- {
- rtx pic_ref, address;
- rtx insn;
-
- if (reg == 0)
- {
- if (reload_in_progress || reload_completed)
- abort ();
- else
- reg = gen_reg_rtx (Pmode);
- }
-
- if (flag_pic == 2)
- {
- /* If not during reload, allocate another temp reg here for loading
- in the address, so that these instructions can be optimized
- properly. */
- rtx temp_reg = ((reload_in_progress || reload_completed)
- ? reg : gen_reg_rtx (Pmode));
-
- /* Must put the SYMBOL_REF inside an UNSPEC here so that cse
- won't get confused into thinking that these two instructions
- are loading in the true address of the symbol. If in the
- future a PIC rtx exists, that should be used instead. */
- emit_insn (gen_pic_sethi_si (temp_reg, orig));
- emit_insn (gen_pic_lo_sum_si (temp_reg, temp_reg, orig));
-
- address = temp_reg;
- }
- else
- address = orig;
-
- pic_ref = gen_rtx (MEM, Pmode,
- gen_rtx (PLUS, Pmode,
- pic_offset_table_rtx, address));
- current_function_uses_pic_offset_table = 1;
- RTX_UNCHANGING_P (pic_ref) = 1;
- insn = emit_move_insn (reg, pic_ref);
- /* Put a REG_EQUAL note on this insn, so that it can be optimized
- by loop. */
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL, orig,
- REG_NOTES (insn));
- return reg;
- }
- else if (GET_CODE (orig) == CONST)
- {
- rtx base, offset;
-
- if (GET_CODE (XEXP (orig, 0)) == PLUS
- && XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx)
- return orig;
-
- if (reg == 0)
- {
- if (reload_in_progress || reload_completed)
- abort ();
- else
- reg = gen_reg_rtx (Pmode);
- }
-
- if (GET_CODE (XEXP (orig, 0)) == PLUS)
- {
- base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg);
- offset = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
- base == reg ? 0 : reg);
- }
- else
- abort ();
-
- if (GET_CODE (offset) == CONST_INT)
- {
- if (SMALL_INT (offset))
- return plus_constant_for_output (base, INTVAL (offset));
- else if (! reload_in_progress && ! reload_completed)
- offset = force_reg (Pmode, offset);
- else
- /* If we reach here, then something is seriously wrong. */
- abort ();
- }
- return gen_rtx (PLUS, Pmode, base, offset);
- }
- else if (GET_CODE (orig) == LABEL_REF)
- /* ??? Why do we do this? */
- current_function_uses_pic_offset_table = 1;
-
- return orig;
-}
-
-/* Set up PIC-specific rtl. This should not cause any insns
- to be emitted. */
-
-void
-initialize_pic ()
-{
-}
-
-/* Emit special PIC prologues and epilogues. */
-
-void
-finalize_pic ()
-{
- /* The table we use to reference PIC data. */
- rtx global_offset_table;
- /* Labels to get the PC in the prologue of this function. */
- rtx l1, l2;
- rtx seq;
- int orig_flag_pic = flag_pic;
-
- if (current_function_uses_pic_offset_table == 0)
- return;
-
- if (! flag_pic)
- abort ();
-
- flag_pic = 0;
-
- /* ??? sparc64 pic currently under construction. */
-
- start_sequence ();
-
- l1 = gen_label_rtx ();
-
- /* Initialize every time through, since we can't easily
- know this to be permanent. */
- global_offset_table = gen_rtx (SYMBOL_REF, Pmode, "_GLOBAL_OFFSET_TABLE_");
- pic_pc_rtx = gen_rtx (CONST, Pmode,
- gen_rtx (MINUS, Pmode,
- global_offset_table,
- gen_rtx (CONST, Pmode,
- gen_rtx (MINUS, Pmode,
- gen_rtx (LABEL_REF, VOIDmode, l1),
- pc_rtx))));
-
- if (! TARGET_ARCH64)
- {
- l2 = gen_label_rtx ();
- emit_label (l1);
- /* Note that we pun calls and jumps here! */
- emit_jump_insn (gen_get_pc_sp32 (l2));
- emit_label (l2);
-
- emit_insn (gen_rtx (SET, VOIDmode, pic_offset_table_rtx,
- gen_rtx (HIGH, Pmode, pic_pc_rtx)));
-
- emit_insn (gen_rtx (SET, VOIDmode,
- pic_offset_table_rtx,
- gen_rtx (LO_SUM, Pmode,
- pic_offset_table_rtx, pic_pc_rtx)));
- emit_insn (gen_rtx (SET, VOIDmode,
- pic_offset_table_rtx,
- gen_rtx (PLUS, Pmode,
- pic_offset_table_rtx,
- gen_rtx (REG, Pmode, 15))));
-
- /* emit_insn (gen_rtx (ASM_INPUT, VOIDmode, "!#PROLOGUE# 1")); */
- LABEL_PRESERVE_P (l1) = 1;
- LABEL_PRESERVE_P (l2) = 1;
- }
- else
- {
- /* ??? This definately isn't right for -mfullany. */
- /* ??? And it doesn't quite seem right for the others either. */
- emit_label (l1);
- emit_insn (gen_get_pc_sp64 (gen_rtx (REG, Pmode, 1)));
-
- /* Don't let the scheduler separate the previous insn from `l1'. */
- emit_insn (gen_blockage ());
-
- emit_insn (gen_rtx (SET, VOIDmode, pic_offset_table_rtx,
- gen_rtx (HIGH, Pmode, pic_pc_rtx)));
-
- emit_insn (gen_rtx (SET, VOIDmode,
- pic_offset_table_rtx,
- gen_rtx (LO_SUM, Pmode,
- pic_offset_table_rtx, pic_pc_rtx)));
- emit_insn (gen_rtx (SET, VOIDmode,
- pic_offset_table_rtx,
- gen_rtx (PLUS, Pmode,
- pic_offset_table_rtx, gen_rtx (REG, Pmode, 1))));
-
- /* emit_insn (gen_rtx (ASM_INPUT, VOIDmode, "!#PROLOGUE# 1")); */
- LABEL_PRESERVE_P (l1) = 1;
- }
-
- flag_pic = orig_flag_pic;
-
- seq = gen_sequence ();
- end_sequence ();
- emit_insn_after (seq, get_insns ());
-
- /* Need to emit this whether or not we obey regdecls,
- since setjmp/longjmp can cause life info to screw up. */
- emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
-}
-
-/* Emit insns to move operands[1] into operands[0].
-
- Return 1 if we have written out everything that needs to be done to
- do the move. Otherwise, return 0 and the caller will emit the move
- normally. */
-
-int
-emit_move_sequence (operands, mode)
- rtx *operands;
- enum machine_mode mode;
-{
- register rtx operand0 = operands[0];
- register rtx operand1 = operands[1];
-
- if (CONSTANT_P (operand1) && flag_pic
- && pic_address_needs_scratch (operand1))
- operands[1] = operand1 = legitimize_pic_address (operand1, mode, 0);
-
- /* Handle most common case first: storing into a register. */
- if (register_operand (operand0, mode))
- {
- if (register_operand (operand1, mode)
- || (GET_CODE (operand1) == CONST_INT && SMALL_INT (operand1))
- || (GET_CODE (operand1) == CONST_DOUBLE
- && arith_double_operand (operand1, DImode))
- || (GET_CODE (operand1) == HIGH && GET_MODE (operand1) != DImode)
- /* Only `general_operands' can come here, so MEM is ok. */
- || GET_CODE (operand1) == MEM)
- {
- /* Run this case quickly. */
- emit_insn (gen_rtx (SET, VOIDmode, operand0, operand1));
- return 1;
- }
- }
- else if (GET_CODE (operand0) == MEM)
- {
- if (register_operand (operand1, mode)
- || (operand1 == const0_rtx && ! TARGET_LIVE_G0))
- {
- /* Run this case quickly. */
- emit_insn (gen_rtx (SET, VOIDmode, operand0, operand1));
- return 1;
- }
- if (! reload_in_progress)
- {
- operands[0] = validize_mem (operand0);
- operands[1] = operand1 = force_reg (mode, operand1);
- }
- }
-
- if (GET_CODE (operand1) == LABEL_REF
- && mode == SImode && flag_pic)
- {
- if (TARGET_ARCH64)
- abort ();
- emit_insn (gen_move_pic_label_si (operand0, operand1));
- return 1;
- }
- /* Non-pic LABEL_REF's in sparc64 are expensive to do the normal way,
- so always use special code. */
- else if (GET_CODE (operand1) == LABEL_REF
- && mode == DImode)
- {
- if (! TARGET_ARCH64)
- abort ();
- emit_insn (gen_move_label_di (operand0, operand1));
- return 1;
- }
- /* DImode HIGH values in sparc64 need a clobber added. */
- else if (TARGET_ARCH64
- && GET_CODE (operand1) == HIGH && GET_MODE (operand1) == DImode)
- {
- emit_insn (gen_sethi_di_sp64 (operand0, XEXP (operand1, 0)));
- return 1;
- }
- /* Simplify the source if we need to. */
- else if (GET_CODE (operand1) != HIGH && immediate_operand (operand1, mode))
- {
- if (flag_pic && symbolic_operand (operand1, mode))
- {
- rtx temp_reg = reload_in_progress ? operand0 : 0;
-
- operands[1] = legitimize_pic_address (operand1, mode, temp_reg);
- }
- else if (GET_CODE (operand1) == CONST_INT
- ? (! SMALL_INT (operand1)
- && (INTVAL (operand1) & 0x3ff) != 0)
- : (GET_CODE (operand1) == CONST_DOUBLE
- ? ! arith_double_operand (operand1, DImode)
- : 1))
- {
- /* For DImode values, temp must be operand0 because of the way
- HI and LO_SUM work. The LO_SUM operator only copies half of
- the LSW from the dest of the HI operator. If the LO_SUM dest is
- not the same as the HI dest, then the MSW of the LO_SUM dest will
- never be set.
-
- ??? The real problem here is that the ...(HI:DImode pattern emits
- multiple instructions, and the ...(LO_SUM:DImode pattern emits
- one instruction. This fails, because the compiler assumes that
- LO_SUM copies all bits of the first operand to its dest. Better
- would be to have the HI pattern emit one instruction and the
- LO_SUM pattern multiple instructions. Even better would be
- to use four rtl insns. */
- rtx temp = ((reload_in_progress || mode == DImode)
- ? operand0 : gen_reg_rtx (mode));
-
- if (TARGET_ARCH64 && mode == DImode)
- emit_insn (gen_sethi_di_sp64 (temp, operand1));
- else
- emit_insn (gen_rtx (SET, VOIDmode, temp,
- gen_rtx (HIGH, mode, operand1)));
-
- operands[1] = gen_rtx (LO_SUM, mode, temp, operand1);
- }
- }
-
- /* Now have insn-emit do whatever it normally does. */
- return 0;
-}
-
-/* Return the best assembler insn template
- for moving operands[1] into operands[0] as a fullword. */
-
-char *
-singlemove_string (operands)
- rtx *operands;
-{
- if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (operands[1]) != MEM)
- return "st %r1,%0";
- else
- abort ();
- }
- else if (GET_CODE (operands[1]) == MEM)
- return "ld %1,%0";
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- REAL_VALUE_TYPE r;
- long i;
-
- /* Must be SFmode, otherwise this doesn't make sense. */
- if (GET_MODE (operands[1]) != SFmode)
- abort ();
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
- REAL_VALUE_TO_TARGET_SINGLE (r, i);
- operands[1] = gen_rtx (CONST_INT, VOIDmode, i);
-
- if (CONST_OK_FOR_LETTER_P (i, 'I'))
- return "mov %1,%0";
- else if ((i & 0x000003FF) != 0)
- return "sethi %%hi(%a1),%0\n\tor %0,%%lo(%a1),%0";
- else
- return "sethi %%hi(%a1),%0";
- }
- else if (GET_CODE (operands[1]) == CONST_INT
- && ! CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'I'))
- {
- int i = INTVAL (operands[1]);
-
- /* If all low order 10 bits are clear, then we only need a single
- sethi insn to load the constant. */
- if ((i & 0x000003FF) != 0)
- return "sethi %%hi(%a1),%0\n\tor %0,%%lo(%a1),%0";
- else
- return "sethi %%hi(%a1),%0";
- }
- /* Operand 1 must be a register, or a 'I' type CONST_INT. */
- return "mov %1,%0";
-}
-
-/* Return non-zero if it is OK to assume that the given memory operand is
- aligned at least to a 8-byte boundary. This should only be called
- for memory accesses whose size is 8 bytes or larger. */
-
-int
-mem_aligned_8 (mem)
- register rtx mem;
-{
- register rtx addr;
- register rtx base;
- register rtx offset;
-
- if (GET_CODE (mem) != MEM)
- return 0; /* It's gotta be a MEM! */
-
- addr = XEXP (mem, 0);
-
- /* Now that all misaligned double parms are copied on function entry,
- we can assume any 64-bit object is 64-bit aligned except those which
- are at unaligned offsets from the stack or frame pointer. If the
- TARGET_UNALIGNED_DOUBLES switch is given, we do not make this
- assumption. */
-
- /* See what register we use in the address. */
- base = 0;
- if (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG
- && GET_CODE (XEXP (addr, 1)) == CONST_INT)
- {
- base = XEXP (addr, 0);
- offset = XEXP (addr, 1);
- }
- }
- else if (GET_CODE (addr) == REG)
- {
- base = addr;
- offset = const0_rtx;
- }
-
- /* If it's the stack or frame pointer, check offset alignment.
- We can have improper alignment in the function entry code. */
- if (base
- && (REGNO (base) == FRAME_POINTER_REGNUM
- || REGNO (base) == STACK_POINTER_REGNUM))
- {
- if (((INTVAL (offset) - SPARC_STACK_BIAS) & 0x7) == 0)
- return 1;
- }
- /* Anything else we know is properly aligned unless TARGET_UNALIGNED_DOUBLES
- is true, in which case we can only assume that an access is aligned if
- it is to a constant address, or the address involves a LO_SUM.
-
- We used to assume an address was aligned if MEM_IN_STRUCT_P was true.
- That assumption was deleted so that gcc generated code can be used with
- memory allocators that only guarantee 4 byte alignment. */
- else if (! TARGET_UNALIGNED_DOUBLES || CONSTANT_P (addr)
- || GET_CODE (addr) == LO_SUM)
- return 1;
-
- /* An obviously unaligned address. */
- return 0;
-}
-
-enum optype { REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP };
-
-/* Output assembler code to perform a doubleword move insn
- with operands OPERANDS. This is very similar to the following
- output_move_quad function. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- register rtx op0 = operands[0];
- register rtx op1 = operands[1];
- register enum optype optype0;
- register enum optype optype1;
- rtx latehalf[2];
- rtx addreg0 = 0;
- rtx addreg1 = 0;
- int highest_first = 0;
- int no_addreg1_decrement = 0;
-
- /* First classify both operands. */
-
- if (REG_P (op0))
- optype0 = REGOP;
- else if (offsettable_memref_p (op0))
- optype0 = OFFSOP;
- else if (GET_CODE (op0) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (op1))
- optype1 = REGOP;
- else if (CONSTANT_P (op1))
- optype1 = CNSTOP;
- else if (offsettable_memref_p (op1))
- optype1 = OFFSOP;
- else if (GET_CODE (op1) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP
- || (optype0 == MEM && optype1 == MEM))
- abort ();
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (op0, 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (op1, 0));
-
- /* Ok, we can do one word at a time.
- Set up in LATEHALF the operands to use for the
- high-numbered (least significant) word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (op0) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (op0, 4);
- else
- latehalf[0] = op0;
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (op1) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (op1, 4);
- else if (optype1 == CNSTOP)
- {
- if (TARGET_ARCH64)
- {
- if (arith_double_operand (op1, DImode))
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (op1));
- return "mov %1,%0";
- }
- else
- {
- /* The only way to handle CONST_DOUBLEs or other 64 bit
- constants here is to use a temporary, such as is done
- for the V9 DImode sethi insn pattern. This is not
- a practical solution, so abort if we reach here.
- The md file should always force such constants to
- memory. */
- abort ();
- }
- }
- else
- split_double (op1, &operands[1], &latehalf[1]);
- }
- else
- latehalf[1] = op1;
-
- /* Easy case: try moving both words at once. Check for moving between
- an even/odd register pair and a memory location. */
- if ((optype0 == REGOP && optype1 != REGOP && optype1 != CNSTOP
- && (TARGET_ARCH64 || (REGNO (op0) & 1) == 0))
- || (optype0 != REGOP && optype0 != CNSTOP && optype1 == REGOP
- && (TARGET_ARCH64 || (REGNO (op1) & 1) == 0)))
- {
- register rtx mem,reg;
-
- if (optype0 == REGOP)
- mem = op1, reg = op0;
- else
- mem = op0, reg = op1;
-
- /* In v9, ldd can be used for word aligned addresses, so technically
- some of this logic is unneeded. We still avoid ldd if the address
- is obviously unaligned though. */
-
- if (mem_aligned_8 (mem)
- /* If this is a floating point register higher than %f31,
- then we *must* use an aligned load, since `ld' will not accept
- the register number. */
- || (TARGET_V9 && REGNO (reg) >= 64))
- {
- if (FP_REG_P (reg) || ! TARGET_ARCH64)
- return (mem == op1 ? "ldd %1,%0" : "std %1,%0");
- else
- return (mem == op1 ? "ldx %1,%0" : "stx %1,%0");
- }
- }
-
- if (TARGET_ARCH64)
- {
- if (optype0 == REGOP && optype1 == REGOP)
- {
- if (FP_REG_P (op0))
- return "fmovd %1,%0";
- else
- return "mov %1,%0";
- }
- }
-
- /* If the first move would clobber the source of the second one,
- do them in the other order. */
-
- /* Overlapping registers. */
- if (optype0 == REGOP && optype1 == REGOP
- && REGNO (op0) == REGNO (latehalf[1]))
- {
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
- /* Do low-numbered word. */
- return singlemove_string (operands);
- }
- /* Loading into a register which overlaps a register used in the address. */
- else if (optype0 == REGOP && optype1 != REGOP
- && reg_overlap_mentioned_p (op0, op1))
- {
- /* If both halves of dest are used in the src memory address,
- add the two regs and put them in the low reg (op0).
- Then it works to load latehalf first. */
- if (reg_mentioned_p (op0, XEXP (op1, 0))
- && reg_mentioned_p (latehalf[0], XEXP (op1, 0)))
- {
- rtx xops[2];
- xops[0] = latehalf[0];
- xops[1] = op0;
- output_asm_insn ("add %1,%0,%1", xops);
- operands[1] = gen_rtx (MEM, DImode, op0);
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- addreg1 = 0;
- highest_first = 1;
- }
- /* Only one register in the dest is used in the src memory address,
- and this is the first register of the dest, so we want to do
- the late half first here also. */
- else if (! reg_mentioned_p (latehalf[0], XEXP (op1, 0)))
- highest_first = 1;
- /* Only one register in the dest is used in the src memory address,
- and this is the second register of the dest, so we want to do
- the late half last. If addreg1 is set, and addreg1 is the same
- register as latehalf, then we must suppress the trailing decrement,
- because it would clobber the value just loaded. */
- else if (addreg1 && reg_mentioned_p (addreg1, latehalf[0]))
- no_addreg1_decrement = 1;
- }
-
- /* Normal case: do the two words, low-numbered first.
- Overlap case (highest_first set): do high-numbered word first. */
-
- if (! highest_first)
- output_asm_insn (singlemove_string (operands), operands);
-
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("add %0,0x4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add %0,0x4,%0", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("add %0,-0x4,%0", &addreg0);
- if (addreg1 && ! no_addreg1_decrement)
- output_asm_insn ("add %0,-0x4,%0", &addreg1);
-
- if (highest_first)
- output_asm_insn (singlemove_string (operands), operands);
-
- return "";
-}
-
-/* Output assembler code to perform a quadword move insn
- with operands OPERANDS. This is very similar to the preceding
- output_move_double function. */
-
-char *
-output_move_quad (operands)
- rtx *operands;
-{
- register rtx op0 = operands[0];
- register rtx op1 = operands[1];
- register enum optype optype0;
- register enum optype optype1;
- rtx wordpart[4][2];
- rtx addreg0 = 0;
- rtx addreg1 = 0;
-
- /* First classify both operands. */
-
- if (REG_P (op0))
- optype0 = REGOP;
- else if (offsettable_memref_p (op0))
- optype0 = OFFSOP;
- else if (GET_CODE (op0) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (op1))
- optype1 = REGOP;
- else if (CONSTANT_P (op1))
- optype1 = CNSTOP;
- else if (offsettable_memref_p (op1))
- optype1 = OFFSOP;
- else if (GET_CODE (op1) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP
- || (optype0 == MEM && optype1 == MEM))
- abort ();
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the later words. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (op0, 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (op1, 0));
-
- /* Ok, we can do one word at a time.
- Set up in wordpart the operands to use for each word of the arguments. */
-
- if (optype0 == REGOP)
- {
- wordpart[0][0] = gen_rtx (REG, SImode, REGNO (op0) + 0);
- wordpart[1][0] = gen_rtx (REG, SImode, REGNO (op0) + 1);
- wordpart[2][0] = gen_rtx (REG, SImode, REGNO (op0) + 2);
- wordpart[3][0] = gen_rtx (REG, SImode, REGNO (op0) + 3);
- }
- else if (optype0 == OFFSOP)
- {
- wordpart[0][0] = adj_offsettable_operand (op0, 0);
- wordpart[1][0] = adj_offsettable_operand (op0, 4);
- wordpart[2][0] = adj_offsettable_operand (op0, 8);
- wordpart[3][0] = adj_offsettable_operand (op0, 12);
- }
- else
- {
- wordpart[0][0] = op0;
- wordpart[1][0] = op0;
- wordpart[2][0] = op0;
- wordpart[3][0] = op0;
- }
-
- if (optype1 == REGOP)
- {
- wordpart[0][1] = gen_rtx (REG, SImode, REGNO (op1) + 0);
- wordpart[1][1] = gen_rtx (REG, SImode, REGNO (op1) + 1);
- wordpart[2][1] = gen_rtx (REG, SImode, REGNO (op1) + 2);
- wordpart[3][1] = gen_rtx (REG, SImode, REGNO (op1) + 3);
- }
- else if (optype1 == OFFSOP)
- {
- wordpart[0][1] = adj_offsettable_operand (op1, 0);
- wordpart[1][1] = adj_offsettable_operand (op1, 4);
- wordpart[2][1] = adj_offsettable_operand (op1, 8);
- wordpart[3][1] = adj_offsettable_operand (op1, 12);
- }
- else if (optype1 == CNSTOP)
- {
- REAL_VALUE_TYPE r;
- long l[4];
-
- /* This only works for TFmode floating point constants. */
- if (GET_CODE (op1) != CONST_DOUBLE || GET_MODE (op1) != TFmode)
- abort ();
-
- REAL_VALUE_FROM_CONST_DOUBLE (r, op1);
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l);
-
- wordpart[0][1] = GEN_INT (l[0]);
- wordpart[1][1] = GEN_INT (l[1]);
- wordpart[2][1] = GEN_INT (l[2]);
- wordpart[3][1] = GEN_INT (l[3]);
- }
- else
- {
- wordpart[0][1] = op1;
- wordpart[1][1] = op1;
- wordpart[2][1] = op1;
- wordpart[3][1] = op1;
- }
-
- /* Easy case: try moving the quad as two pairs. Check for moving between
- an even/odd register pair and a memory location.
- Also handle new v9 fp regs here. */
- /* ??? Should also handle the case of non-offsettable addresses here.
- We can at least do the first pair as a ldd/std, and then do the third
- and fourth words individually. */
- if ((optype0 == REGOP && optype1 == OFFSOP && (REGNO (op0) & 1) == 0)
- || (optype0 == OFFSOP && optype1 == REGOP && (REGNO (op1) & 1) == 0))
- {
- rtx mem, reg;
-
- if (optype0 == REGOP)
- mem = op1, reg = op0;
- else
- mem = op0, reg = op1;
-
- if (mem_aligned_8 (mem)
- /* If this is a floating point register higher than %f31,
- then we *must* use an aligned load, since `ld' will not accept
- the register number. */
- || (TARGET_V9 && REGNO (reg) >= 64))
- {
- if (TARGET_V9 && FP_REG_P (reg) && TARGET_HARD_QUAD)
- {
- if ((REGNO (reg) & 3) != 0)
- abort ();
- return (mem == op1 ? "ldq %1,%0" : "stq %1,%0");
- }
- operands[2] = adj_offsettable_operand (mem, 8);
- /* ??? In arch64 case, shouldn't we use ldd/std for fp regs. */
- if (mem == op1)
- return TARGET_ARCH64 ? "ldx %1,%0;ldx %2,%R0" : "ldd %1,%0;ldd %2,%S0";
- else
- return TARGET_ARCH64 ? "stx %1,%0;stx %R1,%2" : "std %1,%0;std %S1,%2";
- }
- }
-
- /* If the first move would clobber the source of the second one,
- do them in the other order. */
-
- /* Overlapping registers. */
- if (optype0 == REGOP && optype1 == REGOP
- && (REGNO (op0) == REGNO (wordpart[1][3])
- || REGNO (op0) == REGNO (wordpart[1][2])
- || REGNO (op0) == REGNO (wordpart[1][1])))
- {
- /* Do fourth word. */
- output_asm_insn (singlemove_string (wordpart[3]), wordpart[3]);
- /* Do the third word. */
- output_asm_insn (singlemove_string (wordpart[2]), wordpart[2]);
- /* Do the second word. */
- output_asm_insn (singlemove_string (wordpart[1]), wordpart[1]);
- /* Do lowest-numbered word. */
- return singlemove_string (wordpart[0]);
- }
- /* Loading into a register which overlaps a register used in the address. */
- if (optype0 == REGOP && optype1 != REGOP
- && reg_overlap_mentioned_p (op0, op1))
- {
- /* ??? Not implemented yet. This is a bit complicated, because we
- must load which ever part overlaps the address last. If the address
- is a double-reg address, then there are two parts which need to
- be done last, which is impossible. We would need a scratch register
- in that case. */
- abort ();
- }
-
- /* Normal case: move the four words in lowest to highest address order. */
-
- output_asm_insn (singlemove_string (wordpart[0]), wordpart[0]);
-
- /* Make any unoffsettable addresses point at the second word. */
- if (addreg0)
- output_asm_insn ("add %0,0x4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add %0,0x4,%0", &addreg1);
-
- /* Do the second word. */
- output_asm_insn (singlemove_string (wordpart[1]), wordpart[1]);
-
- /* Make any unoffsettable addresses point at the third word. */
- if (addreg0)
- output_asm_insn ("add %0,0x4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add %0,0x4,%0", &addreg1);
-
- /* Do the third word. */
- output_asm_insn (singlemove_string (wordpart[2]), wordpart[2]);
-
- /* Make any unoffsettable addresses point at the fourth word. */
- if (addreg0)
- output_asm_insn ("add %0,0x4,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add %0,0x4,%0", &addreg1);
-
- /* Do the fourth word. */
- output_asm_insn (singlemove_string (wordpart[3]), wordpart[3]);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("add %0,-0xc,%0", &addreg0);
- if (addreg1)
- output_asm_insn ("add %0,-0xc,%0", &addreg1);
-
- return "";
-}
-
-/* Output assembler code to perform a doubleword move insn with operands
- OPERANDS, one of which must be a floating point register. */
-
-char *
-output_fp_move_double (operands)
- rtx *operands;
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- {
- if (TARGET_V9)
- return "fmovd %1,%0";
- else
- return "fmovs %1,%0\n\tfmovs %R1,%R0";
- }
- else if (GET_CODE (operands[1]) == REG)
- abort ();
- else
- return output_move_double (operands);
- }
- else if (FP_REG_P (operands[1]))
- {
- if (GET_CODE (operands[0]) == REG)
- abort ();
- else
- return output_move_double (operands);
- }
- else abort ();
-}
-
-/* Output assembler code to perform a quadword move insn with operands
- OPERANDS, one of which must be a floating point register. */
-
-char *
-output_fp_move_quad (operands)
- rtx *operands;
-{
- register rtx op0 = operands[0];
- register rtx op1 = operands[1];
-
- if (FP_REG_P (op0))
- {
- if (FP_REG_P (op1))
- {
- if (TARGET_V9)
- return "fmovq %1,%0";
- else
- return "fmovs %1,%0\n\tfmovs %R1,%R0\n\tfmovs %S1,%S0\n\tfmovs %T1,%T0";
- }
- else if (GET_CODE (op1) == REG)
- abort ();
- else
- return output_move_quad (operands);
- }
- else if (FP_REG_P (op1))
- {
- if (GET_CODE (op0) == REG)
- abort ();
- else
- return output_move_quad (operands);
- }
- else
- abort ();
-}
-
-/* Return a REG that occurs in ADDR with coefficient 1.
- ADDR can be effectively incremented by incrementing REG. */
-
-static rtx
-find_addr_reg (addr)
- rtx addr;
-{
- while (GET_CODE (addr) == PLUS)
- {
- /* We absolutely can not fudge the frame pointer here, because the
- frame pointer must always be 8 byte aligned. It also confuses
- debuggers. */
- if (GET_CODE (XEXP (addr, 0)) == REG
- && REGNO (XEXP (addr, 0)) != FRAME_POINTER_REGNUM)
- addr = XEXP (addr, 0);
- else if (GET_CODE (XEXP (addr, 1)) == REG
- && REGNO (XEXP (addr, 1)) != FRAME_POINTER_REGNUM)
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 0)))
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 1)))
- addr = XEXP (addr, 0);
- else
- abort ();
- }
- if (GET_CODE (addr) == REG)
- return addr;
- abort ();
-}
-
-#if 0 /* not currently used */
-
-void
-output_sized_memop (opname, mode, signedp)
- char *opname;
- enum machine_mode mode;
- int signedp;
-{
- static char *ld_size_suffix_u[] = { "ub", "uh", "", "?", "d" };
- static char *ld_size_suffix_s[] = { "sb", "sh", "", "?", "d" };
- static char *st_size_suffix[] = { "b", "h", "", "?", "d" };
- char **opnametab, *modename;
-
- if (opname[0] == 'l')
- if (signedp)
- opnametab = ld_size_suffix_s;
- else
- opnametab = ld_size_suffix_u;
- else
- opnametab = st_size_suffix;
- modename = opnametab[GET_MODE_SIZE (mode) >> 1];
-
- fprintf (asm_out_file, "\t%s%s", opname, modename);
-}
-
-void
-output_move_with_extension (operands)
- rtx *operands;
-{
- if (GET_MODE (operands[2]) == HImode)
- output_asm_insn ("sll %2,0x10,%0", operands);
- else if (GET_MODE (operands[2]) == QImode)
- output_asm_insn ("sll %2,0x18,%0", operands);
- else
- abort ();
-}
-#endif /* not currently used */
-
-#if 0
-/* ??? These are only used by the movstrsi pattern, but we get better code
- in general without that, because emit_block_move can do just as good a
- job as this function does when alignment and size are known. When they
- aren't known, a call to strcpy may be faster anyways, because it is
- likely to be carefully crafted assembly language code, and below we just
- do a byte-wise copy.
-
- Also, emit_block_move expands into multiple read/write RTL insns, which
- can then be optimized, whereas our movstrsi pattern can not be optimized
- at all. */
-
-/* Load the address specified by OPERANDS[3] into the register
- specified by OPERANDS[0].
-
- OPERANDS[3] may be the result of a sum, hence it could either be:
-
- (1) CONST
- (2) REG
- (2) REG + CONST_INT
- (3) REG + REG + CONST_INT
- (4) REG + REG (special case of 3).
-
- Note that (3) is not a legitimate address.
- All cases are handled here. */
-
-void
-output_load_address (operands)
- rtx *operands;
-{
- rtx base, offset;
-
- if (CONSTANT_P (operands[3]))
- {
- output_asm_insn ("set %3,%0", operands);
- return;
- }
-
- if (REG_P (operands[3]))
- {
- if (REGNO (operands[0]) != REGNO (operands[3]))
- output_asm_insn ("mov %3,%0", operands);
- return;
- }
-
- if (GET_CODE (operands[3]) != PLUS)
- abort ();
-
- base = XEXP (operands[3], 0);
- offset = XEXP (operands[3], 1);
-
- if (GET_CODE (base) == CONST_INT)
- {
- rtx tmp = base;
- base = offset;
- offset = tmp;
- }
-
- if (GET_CODE (offset) != CONST_INT)
- {
- /* Operand is (PLUS (REG) (REG)). */
- base = operands[3];
- offset = const0_rtx;
- }
-
- if (REG_P (base))
- {
- operands[6] = base;
- operands[7] = offset;
- if (SMALL_INT (offset))
- output_asm_insn ("add %6,%7,%0", operands);
- else
- output_asm_insn ("set %7,%0\n\tadd %0,%6,%0", operands);
- }
- else if (GET_CODE (base) == PLUS)
- {
- operands[6] = XEXP (base, 0);
- operands[7] = XEXP (base, 1);
- operands[8] = offset;
-
- if (SMALL_INT (offset))
- output_asm_insn ("add %6,%7,%0\n\tadd %0,%8,%0", operands);
- else
- output_asm_insn ("set %8,%0\n\tadd %0,%6,%0\n\tadd %0,%7,%0", operands);
- }
- else
- abort ();
-}
-
-/* Output code to place a size count SIZE in register REG.
- ALIGN is the size of the unit of transfer.
-
- Because block moves are pipelined, we don't include the
- first element in the transfer of SIZE to REG. */
-
-static void
-output_size_for_block_move (size, reg, align)
- rtx size, reg;
- rtx align;
-{
- rtx xoperands[3];
-
- xoperands[0] = reg;
- xoperands[1] = size;
- xoperands[2] = align;
- if (GET_CODE (size) == REG)
- output_asm_insn ("sub %1,%2,%0", xoperands);
- else
- {
- xoperands[1]
- = gen_rtx (CONST_INT, VOIDmode, INTVAL (size) - INTVAL (align));
- output_asm_insn ("set %1,%0", xoperands);
- }
-}
-
-/* Emit code to perform a block move.
-
- OPERANDS[0] is the destination.
- OPERANDS[1] is the source.
- OPERANDS[2] is the size.
- OPERANDS[3] is the alignment safe to use.
- OPERANDS[4] is a register we can safely clobber as a temp. */
-
-char *
-output_block_move (operands)
- rtx *operands;
-{
- /* A vector for our computed operands. Note that load_output_address
- makes use of (and can clobber) up to the 8th element of this vector. */
- rtx xoperands[10];
- rtx zoperands[10];
- static int movstrsi_label = 0;
- int i;
- rtx temp1 = operands[4];
- rtx sizertx = operands[2];
- rtx alignrtx = operands[3];
- int align = INTVAL (alignrtx);
- char label3[30], label5[30];
-
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- xoperands[2] = temp1;
-
- /* We can't move more than this many bytes at a time because we have only
- one register, %g1, to move them through. */
- if (align > UNITS_PER_WORD)
- {
- align = UNITS_PER_WORD;
- alignrtx = gen_rtx (CONST_INT, VOIDmode, UNITS_PER_WORD);
- }
-
- /* We consider 8 ld/st pairs, for a total of 16 inline insns to be
- reasonable here. (Actually will emit a maximum of 18 inline insns for
- the case of size == 31 and align == 4). */
-
- if (GET_CODE (sizertx) == CONST_INT && (INTVAL (sizertx) / align) <= 8
- && memory_address_p (QImode, plus_constant_for_output (xoperands[0],
- INTVAL (sizertx)))
- && memory_address_p (QImode, plus_constant_for_output (xoperands[1],
- INTVAL (sizertx))))
- {
- int size = INTVAL (sizertx);
- int offset = 0;
-
- /* We will store different integers into this particular RTX. */
- xoperands[2] = rtx_alloc (CONST_INT);
- PUT_MODE (xoperands[2], VOIDmode);
-
- /* This case is currently not handled. Abort instead of generating
- bad code. */
- if (align > UNITS_PER_WORD)
- abort ();
-
- if (TARGET_ARCH64 && align >= 8)
- {
- for (i = (size >> 3) - 1; i >= 0; i--)
- {
- INTVAL (xoperands[2]) = (i << 3) + offset;
- output_asm_insn ("ldx [%a1+%2],%%g1\n\tstx %%g1,[%a0+%2]",
- xoperands);
- }
- offset += (size & ~0x7);
- size = size & 0x7;
- if (size == 0)
- return "";
- }
-
- if (align >= 4)
- {
- for (i = (size >> 2) - 1; i >= 0; i--)
- {
- INTVAL (xoperands[2]) = (i << 2) + offset;
- output_asm_insn ("ld [%a1+%2],%%g1\n\tst %%g1,[%a0+%2]",
- xoperands);
- }
- offset += (size & ~0x3);
- size = size & 0x3;
- if (size == 0)
- return "";
- }
-
- if (align >= 2)
- {
- for (i = (size >> 1) - 1; i >= 0; i--)
- {
- INTVAL (xoperands[2]) = (i << 1) + offset;
- output_asm_insn ("lduh [%a1+%2],%%g1\n\tsth %%g1,[%a0+%2]",
- xoperands);
- }
- offset += (size & ~0x1);
- size = size & 0x1;
- if (size == 0)
- return "";
- }
-
- if (align >= 1)
- {
- for (i = size - 1; i >= 0; i--)
- {
- INTVAL (xoperands[2]) = i + offset;
- output_asm_insn ("ldub [%a1+%2],%%g1\n\tstb %%g1,[%a0+%2]",
- xoperands);
- }
- return "";
- }
-
- /* We should never reach here. */
- abort ();
- }
-
- /* If the size isn't known to be a multiple of the alignment,
- we have to do it in smaller pieces. If we could determine that
- the size was a multiple of 2 (or whatever), we could be smarter
- about this. */
- if (GET_CODE (sizertx) != CONST_INT)
- align = 1;
- else
- {
- int size = INTVAL (sizertx);
- while (size % align)
- align >>= 1;
- }
-
- if (align != INTVAL (alignrtx))
- alignrtx = gen_rtx (CONST_INT, VOIDmode, align);
-
- xoperands[3] = gen_rtx (CONST_INT, VOIDmode, movstrsi_label++);
- xoperands[4] = gen_rtx (CONST_INT, VOIDmode, align);
- xoperands[5] = gen_rtx (CONST_INT, VOIDmode, movstrsi_label++);
-
- ASM_GENERATE_INTERNAL_LABEL (label3, "Lm", INTVAL (xoperands[3]));
- ASM_GENERATE_INTERNAL_LABEL (label5, "Lm", INTVAL (xoperands[5]));
-
- /* This is the size of the transfer. Emit code to decrement the size
- value by ALIGN, and store the result in the temp1 register. */
- output_size_for_block_move (sizertx, temp1, alignrtx);
-
- /* Must handle the case when the size is zero or negative, so the first thing
- we do is compare the size against zero, and only copy bytes if it is
- zero or greater. Note that we have already subtracted off the alignment
- once, so we must copy 1 alignment worth of bytes if the size is zero
- here.
-
- The SUN assembler complains about labels in branch delay slots, so we
- do this before outputting the load address, so that there will always
- be a harmless insn between the branch here and the next label emitted
- below. */
-
- {
- char pattern[100];
-
- sprintf (pattern, "cmp %%2,0\n\tbl %s", &label5[1]);
- output_asm_insn (pattern, xoperands);
- }
-
- zoperands[0] = operands[0];
- zoperands[3] = plus_constant_for_output (operands[0], align);
- output_load_address (zoperands);
-
- /* ??? This might be much faster if the loops below were preconditioned
- and unrolled.
-
- That is, at run time, copy enough bytes one at a time to ensure that the
- target and source addresses are aligned to the the largest possible
- alignment. Then use a preconditioned unrolled loop to copy say 16
- bytes at a time. Then copy bytes one at a time until finish the rest. */
-
- /* Output the first label separately, so that it is spaced properly. */
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "Lm", INTVAL (xoperands[3]));
-
- {
- char pattern[200];
- register char *ld_suffix = ((align == 1) ? "ub" : (align == 2) ? "uh"
- : (align == 8 && TARGET_ARCH64) ? "x" : "");
- register char *st_suffix = ((align == 1) ? "b" : (align == 2) ? "h"
- : (align == 8 && TARGET_ARCH64) ? "x" : "");
-
- sprintf (pattern, "ld%s [%%1+%%2],%%%%g1\n\tsubcc %%2,%%4,%%2\n\tbge %s\n\tst%s %%%%g1,[%%0+%%2]\n%s:", ld_suffix, &label3[1], st_suffix, &label5[1]);
- output_asm_insn (pattern, xoperands);
- }
-
- return "";
-}
-#endif
-
-/* Output reasonable peephole for set-on-condition-code insns.
- Note that these insns assume a particular way of defining
- labels. Therefore, *both* sparc.h and this function must
- be changed if a new syntax is needed. */
-
-char *
-output_scc_insn (operands, insn)
- rtx operands[];
- rtx insn;
-{
- static char string[100];
- rtx label = 0, next = insn;
- int need_label = 0;
-
- /* Try doing a jump optimization which jump.c can't do for us
- because we did not expose that setcc works by using branches.
-
- If this scc insn is followed by an unconditional branch, then have
- the jump insn emitted here jump to that location, instead of to
- the end of the scc sequence as usual. */
-
- do
- {
- if (GET_CODE (next) == CODE_LABEL)
- label = next;
- next = NEXT_INSN (next);
- if (next == 0)
- break;
- }
- while (GET_CODE (next) == NOTE || GET_CODE (next) == CODE_LABEL);
-
- /* If we are in a sequence, and the following insn is a sequence also,
- then just following the current insn's next field will take us to the
- first insn of the next sequence, which is the wrong place. We don't
- want to optimize with a branch that has had its delay slot filled.
- Avoid this by verifying that NEXT_INSN (PREV_INSN (next)) == next
- which fails only if NEXT is such a branch. */
-
- if (next && GET_CODE (next) == JUMP_INSN && simplejump_p (next)
- && (! final_sequence || NEXT_INSN (PREV_INSN (next)) == next))
- label = JUMP_LABEL (next);
- /* If not optimizing, jump label fields are not set. To be safe, always
- check here to whether label is still zero. */
- if (label == 0)
- {
- label = gen_label_rtx ();
- need_label = 1;
- }
-
- LABEL_NUSES (label) += 1;
-
- /* operands[3] is an unused slot. */
- operands[3] = label;
-
- /* If we are in a delay slot, assume it is the delay slot of an fpcc
- insn since our type isn't allowed anywhere else. */
-
- /* ??? Fpcc instructions no longer have delay slots, so this code is
- probably obsolete. */
-
- /* The fastest way to emit code for this is an annulled branch followed
- by two move insns. This will take two cycles if the branch is taken,
- and three cycles if the branch is not taken.
-
- However, if we are in the delay slot of another branch, this won't work,
- because we can't put a branch in the delay slot of another branch.
- The above sequence would effectively take 3 or 4 cycles respectively
- since a no op would have be inserted between the two branches.
- In this case, we want to emit a move, annulled branch, and then the
- second move. This sequence always takes 3 cycles, and hence is faster
- when we are in a branch delay slot. */
-
- if (final_sequence)
- {
- strcpy (string, "mov 0,%0\n\t");
- strcat (string, output_cbranch (operands[2], 3, 0, 1, 0));
- strcat (string, "\n\tmov 1,%0");
- }
- else
- {
- strcpy (string, output_cbranch (operands[2], 3, 0, 1, 0));
- strcat (string, "\n\tmov 1,%0\n\tmov 0,%0");
- }
-
- if (need_label)
- strcat (string, "\n%l3:");
-
- return string;
-}
-
-/* Vectors to keep interesting information about registers where it can easily
- be got. We use to use the actual mode value as the bit number, but there
- are more than 32 modes now. Instead we use two tables: one indexed by
- hard register number, and one indexed by mode. */
-
-/* The purpose of sparc_mode_class is to shrink the range of modes so that
- they all fit (as bit numbers) in a 32 bit word (again). Each real mode is
- mapped into one sparc_mode_class mode. */
-
-enum sparc_mode_class {
- S_MODE, D_MODE, T_MODE, O_MODE,
- SF_MODE, DF_MODE, TF_MODE, OF_MODE,
- CC_MODE, CCFP_MODE
-};
-
-/* Modes for single-word and smaller quantities. */
-#define S_MODES ((1 << (int) S_MODE) | (1 << (int) SF_MODE))
-
-/* Modes for double-word and smaller quantities. */
-#define D_MODES (S_MODES | (1 << (int) D_MODE) | (1 << DF_MODE))
-
-/* Modes for quad-word and smaller quantities. */
-#define T_MODES (D_MODES | (1 << (int) T_MODE) | (1 << (int) TF_MODE))
-
-/* Modes for single-float quantities. We must allow any single word or
- smaller quantity. This is because the fix/float conversion instructions
- take integer inputs/outputs from the float registers. */
-#define SF_MODES (S_MODES)
-
-/* Modes for double-float and smaller quantities. */
-#define DF_MODES (S_MODES | D_MODES)
-
-/* ??? Sparc64 fp regs cannot hold DImode values. */
-#define DF_MODES64 (SF_MODES | DF_MODE /* | D_MODE*/)
-
-/* Modes for double-float only quantities. */
-/* ??? Sparc64 fp regs cannot hold DImode values.
- See fix_truncsfdi2. */
-#define DF_ONLY_MODES ((1 << (int) DF_MODE) /*| (1 << (int) D_MODE)*/)
-
-/* Modes for double-float and larger quantities. */
-#define DF_UP_MODES (DF_ONLY_MODES | TF_ONLY_MODES)
-
-/* Modes for quad-float only quantities. */
-#define TF_ONLY_MODES (1 << (int) TF_MODE)
-
-/* Modes for quad-float and smaller quantities. */
-#define TF_MODES (DF_MODES | TF_ONLY_MODES)
-
-/* ??? Sparc64 fp regs cannot hold DImode values.
- See fix_truncsfdi2. */
-#define TF_MODES64 (DF_MODES64 | TF_ONLY_MODES)
-
-/* Modes for condition codes. */
-#define CC_MODES (1 << (int) CC_MODE)
-#define CCFP_MODES (1 << (int) CCFP_MODE)
-
-/* Value is 1 if register/mode pair is acceptable on sparc.
- The funny mixture of D and T modes is because integer operations
- do not specially operate on tetra quantities, so non-quad-aligned
- registers can hold quadword quantities (except %o4 and %i4 because
- they cross fixed registers). */
-
-/* This points to either the 32 bit or the 64 bit version. */
-int *hard_regno_mode_classes;
-
-static int hard_32bit_mode_classes[] = {
- S_MODES, S_MODES, T_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES,
- T_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES, D_MODES, S_MODES,
- T_MODES, S_MODES, T_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES,
- T_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES, D_MODES, S_MODES,
-
- TF_MODES, SF_MODES, DF_MODES, SF_MODES, TF_MODES, SF_MODES, DF_MODES, SF_MODES,
- TF_MODES, SF_MODES, DF_MODES, SF_MODES, TF_MODES, SF_MODES, DF_MODES, SF_MODES,
- TF_MODES, SF_MODES, DF_MODES, SF_MODES, TF_MODES, SF_MODES, DF_MODES, SF_MODES,
- TF_MODES, SF_MODES, DF_MODES, SF_MODES, TF_MODES, SF_MODES, DF_MODES, SF_MODES,
-
- /* FP regs f32 to f63. Only the even numbered registers actually exist,
- and none can hold SFmode/SImode values. */
- DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0,
- DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0,
- DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0,
- DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0,
-
- /* %fcc[0123] */
- CCFP_MODES, CCFP_MODES, CCFP_MODES, CCFP_MODES,
-
- /* %icc */
- CC_MODES
-};
-
-static int hard_64bit_mode_classes[] = {
- D_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES,
- T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES,
- T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES,
- T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES,
-
- TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, TF_MODES64, SF_MODES, DF_MODES64, SF_MODES,
- TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, TF_MODES64, SF_MODES, DF_MODES64, SF_MODES,
- TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, TF_MODES64, SF_MODES, DF_MODES64, SF_MODES,
- TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, TF_MODES64, SF_MODES, DF_MODES64, SF_MODES,
-
- /* FP regs f32 to f63. Only the even numbered registers actually exist,
- and none can hold SFmode/SImode values. */
- DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0,
- DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0,
- DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0,
- DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0,
-
- /* %fcc[0123] */
- CCFP_MODES, CCFP_MODES, CCFP_MODES, CCFP_MODES,
-
- /* %icc */
- CC_MODES
-};
-
-int sparc_mode_class [NUM_MACHINE_MODES];
-
-enum reg_class sparc_regno_reg_class[FIRST_PSEUDO_REGISTER];
-
-static void
-sparc_init_modes ()
-{
- int i;
-
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- {
- switch (GET_MODE_CLASS (i))
- {
- case MODE_INT:
- case MODE_PARTIAL_INT:
- case MODE_COMPLEX_INT:
- if (GET_MODE_SIZE (i) <= 4)
- sparc_mode_class[i] = 1 << (int) S_MODE;
- else if (GET_MODE_SIZE (i) == 8)
- sparc_mode_class[i] = 1 << (int) D_MODE;
- else if (GET_MODE_SIZE (i) == 16)
- sparc_mode_class[i] = 1 << (int) T_MODE;
- else if (GET_MODE_SIZE (i) == 32)
- sparc_mode_class[i] = 1 << (int) O_MODE;
- else
- sparc_mode_class[i] = 0;
- break;
- case MODE_FLOAT:
- case MODE_COMPLEX_FLOAT:
- if (GET_MODE_SIZE (i) <= 4)
- sparc_mode_class[i] = 1 << (int) SF_MODE;
- else if (GET_MODE_SIZE (i) == 8)
- sparc_mode_class[i] = 1 << (int) DF_MODE;
- else if (GET_MODE_SIZE (i) == 16)
- sparc_mode_class[i] = 1 << (int) TF_MODE;
- else if (GET_MODE_SIZE (i) == 32)
- sparc_mode_class[i] = 1 << (int) OF_MODE;
- else
- sparc_mode_class[i] = 0;
- break;
- case MODE_CC:
- default:
- /* mode_class hasn't been initialized yet for EXTRA_CC_MODES, so
- we must explicitly check for them here. */
- if (i == (int) CCFPmode || i == (int) CCFPEmode)
- sparc_mode_class[i] = 1 << (int) CCFP_MODE;
- else if (i == (int) CCmode || i == (int) CC_NOOVmode
- || i == (int) CCXmode || i == (int) CCX_NOOVmode)
- sparc_mode_class[i] = 1 << (int) CC_MODE;
- else
- sparc_mode_class[i] = 0;
- break;
- }
- }
-
- if (TARGET_ARCH64)
- hard_regno_mode_classes = hard_64bit_mode_classes;
- else
- hard_regno_mode_classes = hard_32bit_mode_classes;
-
- /* Initialize the array used by REGNO_REG_CLASS. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (i < 32)
- sparc_regno_reg_class[i] = GENERAL_REGS;
- else if (i < 64)
- sparc_regno_reg_class[i] = FP_REGS;
- else if (i < 96)
- sparc_regno_reg_class[i] = EXTRA_FP_REGS;
- else if (i < 100)
- sparc_regno_reg_class[i] = FPCC_REGS;
- else
- sparc_regno_reg_class[i] = NO_REGS;
- }
-}
-
-/* Save non call used registers from LOW to HIGH at BASE+OFFSET.
- N_REGS is the number of 4-byte regs saved thus far. This applies even to
- v9 int regs as it simplifies the code. */
-
-#ifdef __GNUC__
-__inline__
-#endif
-static int
-save_regs (file, low, high, base, offset, n_regs)
- FILE *file;
- int low, high;
- char *base;
- int offset;
- int n_regs;
-{
- int i;
-
- if (TARGET_ARCH64 && high <= 32)
- {
- for (i = low; i < high; i++)
- {
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (file, "\tstx %s,[%s+%d]\n",
- reg_names[i], base, offset + 4 * n_regs),
- n_regs += 2;
- }
- }
- else
- {
- for (i = low; i < high; i += 2)
- {
- if (regs_ever_live[i] && ! call_used_regs[i])
- if (regs_ever_live[i+1] && ! call_used_regs[i+1])
- fprintf (file, "\tstd %s,[%s+%d]\n",
- reg_names[i], base, offset + 4 * n_regs),
- n_regs += 2;
- else
- fprintf (file, "\tst %s,[%s+%d]\n",
- reg_names[i], base, offset + 4 * n_regs),
- n_regs += 2;
- else if (regs_ever_live[i+1] && ! call_used_regs[i+1])
- fprintf (file, "\tst %s,[%s+%d]\n",
- reg_names[i+1], base, offset + 4 * n_regs + 4),
- n_regs += 2;
- }
- }
- return n_regs;
-}
-
-/* Restore non call used registers from LOW to HIGH at BASE+OFFSET.
-
- N_REGS is the number of 4-byte regs saved thus far. This applies even to
- v9 int regs as it simplifies the code. */
-
-#ifdef __GNUC__
-__inline__
-#endif
-static int
-restore_regs (file, low, high, base, offset, n_regs)
- FILE *file;
- int low, high;
- char *base;
- int offset;
- int n_regs;
-{
- int i;
-
- if (TARGET_ARCH64 && high <= 32)
- {
- for (i = low; i < high; i++)
- {
- if (regs_ever_live[i] && ! call_used_regs[i])
- fprintf (file, "\tldx [%s+%d], %s\n",
- base, offset + 4 * n_regs, reg_names[i]),
- n_regs += 2;
- }
- }
- else
- {
- for (i = low; i < high; i += 2)
- {
- if (regs_ever_live[i] && ! call_used_regs[i])
- if (regs_ever_live[i+1] && ! call_used_regs[i+1])
- fprintf (file, "\tldd [%s+%d], %s\n",
- base, offset + 4 * n_regs, reg_names[i]),
- n_regs += 2;
- else
- fprintf (file, "\tld [%s+%d],%s\n",
- base, offset + 4 * n_regs, reg_names[i]),
- n_regs += 2;
- else if (regs_ever_live[i+1] && ! call_used_regs[i+1])
- fprintf (file, "\tld [%s+%d],%s\n",
- base, offset + 4 * n_regs + 4, reg_names[i+1]),
- n_regs += 2;
- }
- }
- return n_regs;
-}
-
-/* Static variables we want to share between prologue and epilogue. */
-
-/* Number of live general or floating point registers needed to be saved
- (as 4-byte quantities). This is only done if TARGET_EPILOGUE. */
-static int num_gfregs;
-
-/* Compute the frame size required by the function. This function is called
- during the reload pass and also by output_function_prologue(). */
-
-int
-compute_frame_size (size, leaf_function)
- int size;
- int leaf_function;
-{
- int n_regs = 0, i;
- int outgoing_args_size = (current_function_outgoing_args_size
-#if ! SPARC_ARCH64
- + REG_PARM_STACK_SPACE (current_function_decl)
-#endif
- );
-
- if (TARGET_EPILOGUE)
- {
- /* N_REGS is the number of 4-byte regs saved thus far. This applies
- even to v9 int regs to be consistent with save_regs/restore_regs. */
-
- if (TARGET_ARCH64)
- {
- for (i = 0; i < 8; i++)
- if (regs_ever_live[i] && ! call_used_regs[i])
- n_regs += 2;
- }
- else
- {
- for (i = 0; i < 8; i += 2)
- if ((regs_ever_live[i] && ! call_used_regs[i])
- || (regs_ever_live[i+1] && ! call_used_regs[i+1]))
- n_regs += 2;
- }
-
- for (i = 32; i < (TARGET_V9 ? 96 : 64); i += 2)
- if ((regs_ever_live[i] && ! call_used_regs[i])
- || (regs_ever_live[i+1] && ! call_used_regs[i+1]))
- n_regs += 2;
- }
-
- /* Set up values for use in `function_epilogue'. */
- num_gfregs = n_regs;
-
- if (leaf_function && n_regs == 0
- && size == 0 && current_function_outgoing_args_size == 0)
- {
- actual_fsize = apparent_fsize = 0;
- }
- else
- {
- /* We subtract STARTING_FRAME_OFFSET, remember it's negative.
- The stack bias (if any) is taken out to undo its effects. */
- apparent_fsize = (size - STARTING_FRAME_OFFSET + SPARC_STACK_BIAS + 7) & -8;
- apparent_fsize += n_regs * 4;
- actual_fsize = apparent_fsize + ((outgoing_args_size + 7) & -8);
- }
-
- /* Make sure nothing can clobber our register windows.
- If a SAVE must be done, or there is a stack-local variable,
- the register window area must be allocated.
- ??? For v9 we need an additional 8 bytes of reserved space, apparently
- it's needed by v8 as well. */
- if (leaf_function == 0 || size > 0)
- actual_fsize += (16 * UNITS_PER_WORD) + 8;
-
- return SPARC_STACK_ALIGN (actual_fsize);
-}
-
-/* Build a (32 bit) big number in a register. */
-/* ??? We may be able to use the set macro here too. */
-
-static void
-build_big_number (file, num, reg)
- FILE *file;
- int num;
- char *reg;
-{
- if (num >= 0 || ! TARGET_ARCH64)
- {
- fprintf (file, "\tsethi %%hi(%d),%s\n", num, reg);
- if ((num & 0x3ff) != 0)
- fprintf (file, "\tor %s,%%lo(%d),%s\n", reg, num, reg);
- }
- else /* num < 0 && TARGET_ARCH64 */
- {
- /* Sethi does not sign extend, so we must use a little trickery
- to use it for negative numbers. Invert the constant before
- loading it in, then use xor immediate to invert the loaded bits
- (along with the upper 32 bits) to the desired constant. This
- works because the sethi and immediate fields overlap. */
- int asize = num;
- int inv = ~asize;
- int low = -0x400 + (asize & 0x3FF);
-
- fprintf (file, "\tsethi %%hi(%d),%s\n\txor %s,%d,%s\n",
- inv, reg, reg, low, reg);
- }
-}
-
-/* Output code for the function prologue. */
-
-void
-output_function_prologue (file, size, leaf_function)
- FILE *file;
- int size;
- int leaf_function;
-{
- /* Need to use actual_fsize, since we are also allocating
- space for our callee (and our own register save area). */
- actual_fsize = compute_frame_size (size, leaf_function);
-
- if (leaf_function)
- {
- frame_base_name = "%sp";
- frame_base_offset = actual_fsize + SPARC_STACK_BIAS;
- }
- else
- {
- frame_base_name = "%fp";
- frame_base_offset = SPARC_STACK_BIAS;
- }
-
- /* This is only for the human reader. */
- fprintf (file, "\t!#PROLOGUE# 0\n");
-
- if (actual_fsize == 0)
- /* do nothing. */ ;
- else if (! leaf_function && ! TARGET_BROKEN_SAVERESTORE)
- {
- if (actual_fsize <= 4096)
- fprintf (file, "\tsave %%sp,-%d,%%sp\n", actual_fsize);
- else if (actual_fsize <= 8192)
- {
- fprintf (file, "\tsave %%sp,-4096,%%sp\n");
- fprintf (file, "\tadd %%sp,-%d,%%sp\n", actual_fsize - 4096);
- }
- else
- {
- build_big_number (file, -actual_fsize, "%g1");
- fprintf (file, "\tsave %%sp,%%g1,%%sp\n");
- }
- }
- else if (! leaf_function && TARGET_BROKEN_SAVERESTORE)
- {
- /* We assume the environment will properly handle or otherwise avoid
- trouble associated with an interrupt occuring after the `save' or
- trap occuring during it. */
- fprintf (file, "\tsave\n");
-
- if (actual_fsize <= 4096)
- fprintf (file, "\tadd %%fp,-%d,%%sp\n", actual_fsize);
- else if (actual_fsize <= 8192)
- {
- fprintf (file, "\tadd %%fp,-4096,%%sp\n");
- fprintf (file, "\tadd %%fp,-%d,%%sp\n", actual_fsize - 4096);
- }
- else
- {
- build_big_number (file, -actual_fsize, "%g1");
- fprintf (file, "\tadd %%fp,%%g1,%%sp\n");
- }
- }
- else /* leaf function */
- {
- if (actual_fsize <= 4096)
- fprintf (file, "\tadd %%sp,-%d,%%sp\n", actual_fsize);
- else if (actual_fsize <= 8192)
- {
- fprintf (file, "\tadd %%sp,-4096,%%sp\n");
- fprintf (file, "\tadd %%sp,-%d,%%sp\n", actual_fsize - 4096);
- }
- else
- {
- build_big_number (file, -actual_fsize, "%g1");
- fprintf (file, "\tadd %%sp,%%g1,%%sp\n");
- }
- }
-
- /* If doing anything with PIC, do it now. */
- if (! flag_pic)
- fprintf (file, "\t!#PROLOGUE# 1\n");
-
- /* Call saved registers are saved just above the outgoing argument area. */
- if (num_gfregs)
- {
- int offset, n_regs;
- char *base;
-
- offset = -apparent_fsize + frame_base_offset;
- if (offset < -4096 || offset + num_gfregs * 4 > 4096)
- {
- /* ??? This might be optimized a little as %g1 might already have a
- value close enough that a single add insn will do. */
- /* ??? Although, all of this is probably only a temporary fix
- because if %g1 can hold a function result, then
- output_function_epilogue will lose (the result will get
- clobbered). */
- build_big_number (file, offset, "%g1");
- fprintf (file, "\tadd %s,%%g1,%%g1\n", frame_base_name);
- base = "%g1";
- offset = 0;
- }
- else
- {
- base = frame_base_name;
- }
-
- if (TARGET_EPILOGUE && ! leaf_function)
- /* ??? Originally saved regs 0-15 here. */
- n_regs = save_regs (file, 0, 8, base, offset, 0);
- else if (leaf_function)
- /* ??? Originally saved regs 0-31 here. */
- n_regs = save_regs (file, 0, 8, base, offset, 0);
- if (TARGET_EPILOGUE)
- save_regs (file, 32, TARGET_V9 ? 96 : 64, base, offset, n_regs);
- }
-
- leaf_label = 0;
- if (leaf_function && actual_fsize != 0)
- {
- /* warning ("leaf procedure with frame size %d", actual_fsize); */
- if (! TARGET_EPILOGUE)
- leaf_label = gen_label_rtx ();
- }
-}
-
-/* Output code for the function epilogue. */
-
-void
-output_function_epilogue (file, size, leaf_function)
- FILE *file;
- int size;
- int leaf_function;
-{
- char *ret;
-
- if (leaf_label)
- {
- emit_label_after (leaf_label, get_last_insn ());
- final_scan_insn (get_last_insn (), file, 0, 0, 1);
- }
-
-#ifdef FUNCTION_BLOCK_PROFILER_EXIT
- else if (profile_block_flag == 2)
- {
- FUNCTION_BLOCK_PROFILER_EXIT(file);
- }
-#endif
-
- /* Restore any call saved registers. */
- if (num_gfregs)
- {
- int offset, n_regs;
- char *base;
-
- offset = -apparent_fsize + frame_base_offset;
- if (offset < -4096 || offset + num_gfregs * 4 > 4096 - 8 /*double*/)
- {
- build_big_number (file, offset, "%g1");
- fprintf (file, "\tadd %s,%%g1,%%g1\n", frame_base_name);
- base = "%g1";
- offset = 0;
- }
- else
- {
- base = frame_base_name;
- }
-
- if (TARGET_EPILOGUE && ! leaf_function)
- /* ??? Originally saved regs 0-15 here. */
- n_regs = restore_regs (file, 0, 8, base, offset, 0);
- else if (leaf_function)
- /* ??? Originally saved regs 0-31 here. */
- n_regs = restore_regs (file, 0, 8, base, offset, 0);
- if (TARGET_EPILOGUE)
- restore_regs (file, 32, TARGET_V9 ? 96 : 64, base, offset, n_regs);
- }
-
- /* Work out how to skip the caller's unimp instruction if required. */
- if (leaf_function)
- ret = (SKIP_CALLERS_UNIMP_P ? "jmp %o7+12" : "retl");
- else
- ret = (SKIP_CALLERS_UNIMP_P ? "jmp %i7+12" : "ret");
-
- if (TARGET_EPILOGUE || leaf_label)
- {
- int old_target_epilogue = TARGET_EPILOGUE;
- target_flags &= ~old_target_epilogue;
-
- if (! leaf_function)
- {
- /* If we wound up with things in our delay slot, flush them here. */
- if (current_function_epilogue_delay_list)
- {
- rtx insn = emit_jump_insn_after (gen_rtx (RETURN, VOIDmode),
- get_last_insn ());
- PATTERN (insn) = gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (2,
- PATTERN (XEXP (current_function_epilogue_delay_list, 0)),
- PATTERN (insn)));
- final_scan_insn (insn, file, 1, 0, 1);
- }
- else
- fprintf (file, "\t%s\n\trestore\n", ret);
- }
- /* All of the following cases are for leaf functions. */
- else if (current_function_epilogue_delay_list)
- {
- /* eligible_for_epilogue_delay_slot ensures that if this is a
- leaf function, then we will only have insn in the delay slot
- if the frame size is zero, thus no adjust for the stack is
- needed here. */
- if (actual_fsize != 0)
- abort ();
- fprintf (file, "\t%s\n", ret);
- final_scan_insn (XEXP (current_function_epilogue_delay_list, 0),
- file, 1, 0, 1);
- }
- /* Output 'nop' instead of 'sub %sp,-0,%sp' when no frame, so as to
- avoid generating confusing assembly language output. */
- else if (actual_fsize == 0)
- fprintf (file, "\t%s\n\tnop\n", ret);
- else if (actual_fsize <= 4096)
- fprintf (file, "\t%s\n\tsub %%sp,-%d,%%sp\n", ret, actual_fsize);
- else if (actual_fsize <= 8192)
- fprintf (file, "\tsub %%sp,-4096,%%sp\n\t%s\n\tsub %%sp,-%d,%%sp\n",
- ret, actual_fsize - 4096);
- else if ((actual_fsize & 0x3ff) == 0)
- fprintf (file, "\tsethi %%hi(%d),%%g1\n\t%s\n\tadd %%sp,%%g1,%%sp\n",
- actual_fsize, ret);
- else
- fprintf (file, "\tsethi %%hi(%d),%%g1\n\tor %%g1,%%lo(%d),%%g1\n\t%s\n\tadd %%sp,%%g1,%%sp\n",
- actual_fsize, actual_fsize, ret);
- target_flags |= old_target_epilogue;
- }
-}
-
-/* Do what is necessary for `va_start'. The argument is ignored.
- !v9: We look at the current function to determine if stdarg or varargs
- is used and return the address of the first unnamed parameter.
- v9: We save the argument integer and floating point regs in a buffer, and
- return the address of this buffer. The rest is handled in va-sparc.h. */
-/* ??? This is currently conditioned on SPARC_ARCH64 because
- current_function_args_info is different in each compiler. */
-
-#if SPARC_ARCH64
-
-rtx
-sparc_builtin_saveregs (arglist)
- tree arglist;
-{
- tree fntype = TREE_TYPE (current_function_decl);
- /* First unnamed integer register. */
- int first_intreg = current_function_args_info.arg_count[(int) SPARC_ARG_INT];
- /* Number of integer registers we need to save. */
- int n_intregs = MAX (0, NPARM_REGS (SImode) - first_intreg);
- /* First unnamed SFmode float reg (no, you can't pass SFmode floats as
- unnamed arguments, we just number them that way). We must round up to
- the next double word float reg - that is the first one to save. */
- int first_floatreg = current_function_args_info.arg_count[(int) SPARC_ARG_FLOAT] + 1 & ~1;
- /* Number of SFmode float regs to save. */
- int n_floatregs = MAX (0, NPARM_REGS (SFmode) - first_floatreg);
- int ptrsize = GET_MODE_SIZE (Pmode);
- rtx valist, regbuf, fpregs;
- int bufsize, adjust, regno;
-
- /* Allocate block of memory for the regs.
- We only allocate as much as we need, but we must ensure quadword float
- regs are stored with the appropriate alignment. */
- /* ??? If n_intregs + n_floatregs == 0, should we allocate at least 1 byte?
- Or can assign_stack_local accept a 0 SIZE argument? */
-
- bufsize = (n_intregs * UNITS_PER_WORD) + (n_floatregs * (UNITS_PER_WORD / 2));
- /* Add space in front of the int regs to ensure proper alignment of quadword
- fp regs. We must add the space in front because va_start assumes this. */
- if (n_floatregs >= 4)
- adjust = ((n_intregs + first_floatreg / 2) % 2) * UNITS_PER_WORD;
- else
- adjust = 0;
-
- regbuf = assign_stack_local (BLKmode, bufsize + adjust,
- GET_MODE_BITSIZE (TFmode));
- regbuf = gen_rtx (MEM, BLKmode, plus_constant (XEXP (regbuf, 0), adjust));
- MEM_IN_STRUCT_P (regbuf) = 1;
-
- /* Save int args.
- This is optimized to only save the regs that are necessary. Explicitly
- named args need not be saved. */
-
- if (n_intregs > 0)
- move_block_from_reg (BASE_INCOMING_ARG_REG (SImode) + first_intreg,
- regbuf, n_intregs, n_intregs * UNITS_PER_WORD);
-
- /* Save float args.
- This is optimized to only save the regs that are necessary. Explicitly
- named args need not be saved.
- We explicitly build a pointer to the buffer because it halves the insn
- count when not optimizing (otherwise the pointer is built for each reg
- saved). */
-
- fpregs = gen_reg_rtx (Pmode);
- emit_move_insn (fpregs, plus_constant (XEXP (regbuf, 0),
- n_intregs * UNITS_PER_WORD));
- for (regno = first_floatreg; regno < NPARM_REGS (SFmode); regno += 2)
- emit_move_insn (gen_rtx (MEM, DFmode,
- plus_constant (fpregs,
- GET_MODE_SIZE (SFmode)
- * (regno - first_floatreg))),
- gen_rtx (REG, DFmode,
- BASE_INCOMING_ARG_REG (DFmode) + regno));
-
- /* Return the address of the regbuf. */
-
- return XEXP (regbuf, 0);
-}
-
-#else /* ! SPARC_ARCH64 */
-
-rtx
-sparc_builtin_saveregs (arglist)
- tree arglist;
-{
- tree fntype = TREE_TYPE (current_function_decl);
- int stdarg = (TYPE_ARG_TYPES (fntype) != 0
- && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
- != void_type_node));
- int first_reg = current_function_args_info;
- rtx address;
- int regno;
-
-#if 0 /* This code seemed to have no effect except to make
- varargs not work right when va_list wasn't the first arg. */
- if (! stdarg)
- first_reg = 0;
-#endif
-
- for (regno = first_reg; regno < NPARM_REGS (SImode); regno++)
- emit_move_insn (gen_rtx (MEM, word_mode,
- gen_rtx (PLUS, Pmode,
- frame_pointer_rtx,
- GEN_INT (STACK_POINTER_OFFSET
- + UNITS_PER_WORD * regno))),
- gen_rtx (REG, word_mode, BASE_INCOMING_ARG_REG (word_mode)
- + regno));
-
- address = gen_rtx (PLUS, Pmode,
- frame_pointer_rtx,
- GEN_INT (STACK_POINTER_OFFSET
- + UNITS_PER_WORD * first_reg));
-
- return address;
-}
-
-#endif /* ! SPARC_ARCH64 */
-
-/* Return the string to output a conditional branch to LABEL, which is
- the operand number of the label. OP is the conditional expression.
- XEXP (OP, 0) is assumed to be a condition code register (integer or
- floating point) and its mode specifies what kind of comparison we made.
-
- REVERSED is non-zero if we should reverse the sense of the comparison.
-
- ANNUL is non-zero if we should generate an annulling branch.
-
- NOOP is non-zero if we have to follow this branch by a noop. */
-
-char *
-output_cbranch (op, label, reversed, annul, noop)
- rtx op;
- int label;
- int reversed, annul, noop;
-{
- static char string[20];
- enum rtx_code code = GET_CODE (op);
- rtx cc_reg = XEXP (op, 0);
- enum machine_mode mode = GET_MODE (cc_reg);
- static char v8_labelno[] = " %lX";
- static char v9_icc_labelno[] = " %%icc,%lX";
- static char v9_xcc_labelno[] = " %%xcc,%lX";
- static char v9_fcc_labelno[] = " %%fccX,%lY";
- char *labelno;
- int labeloff;
-
- /* ??? !v9: FP branches cannot be preceded by another floating point insn.
- Because there is currently no concept of pre-delay slots, we can fix
- this only by always emitting a nop before a floating point branch. */
-
- if ((mode == CCFPmode || mode == CCFPEmode) && ! TARGET_V9)
- strcpy (string, "nop\n\t");
- else
- string[0] = '\0';
-
- /* If not floating-point or if EQ or NE, we can just reverse the code. */
- if (reversed
- && ((mode != CCFPmode && mode != CCFPEmode) || code == EQ || code == NE))
- code = reverse_condition (code), reversed = 0;
-
- /* Start by writing the branch condition. */
- switch (code)
- {
- case NE:
- if (mode == CCFPmode || mode == CCFPEmode)
- strcat (string, "fbne");
- else
- strcpy (string, "bne");
- break;
-
- case EQ:
- if (mode == CCFPmode || mode == CCFPEmode)
- strcat (string, "fbe");
- else
- strcpy (string, "be");
- break;
-
- case GE:
- if (mode == CCFPmode || mode == CCFPEmode)
- {
- if (reversed)
- strcat (string, "fbul");
- else
- strcat (string, "fbge");
- }
- else if (mode == CC_NOOVmode)
- strcpy (string, "bpos");
- else
- strcpy (string, "bge");
- break;
-
- case GT:
- if (mode == CCFPmode || mode == CCFPEmode)
- {
- if (reversed)
- strcat (string, "fbule");
- else
- strcat (string, "fbg");
- }
- else
- strcpy (string, "bg");
- break;
-
- case LE:
- if (mode == CCFPmode || mode == CCFPEmode)
- {
- if (reversed)
- strcat (string, "fbug");
- else
- strcat (string, "fble");
- }
- else
- strcpy (string, "ble");
- break;
-
- case LT:
- if (mode == CCFPmode || mode == CCFPEmode)
- {
- if (reversed)
- strcat (string, "fbuge");
- else
- strcat (string, "fbl");
- }
- else if (mode == CC_NOOVmode)
- strcpy (string, "bneg");
- else
- strcpy (string, "bl");
- break;
-
- case GEU:
- strcpy (string, "bgeu");
- break;
-
- case GTU:
- strcpy (string, "bgu");
- break;
-
- case LEU:
- strcpy (string, "bleu");
- break;
-
- case LTU:
- strcpy (string, "blu");
- break;
- }
-
- /* Now add the annulling, the label, and a possible noop. */
- if (annul)
- strcat (string, ",a");
-
- /* ??? If v9, optional prediction bit ",pt" or ",pf" goes here. */
-
- if (! TARGET_V9)
- {
- labeloff = 3;
- labelno = v8_labelno;
- }
- else
- {
- labeloff = 9;
- if (mode == CCFPmode || mode == CCFPEmode)
- {
- labeloff = 10;
- labelno = v9_fcc_labelno;
- /* Set the char indicating the number of the fcc reg to use. */
- labelno[6] = REGNO (cc_reg) - SPARC_FIRST_V9_FCC_REG + '0';
- }
- else if (mode == CCXmode || mode == CCX_NOOVmode)
- labelno = v9_xcc_labelno;
- else
- labelno = v9_icc_labelno;
- }
- /* Set the char indicating the number of the operand containing the
- label_ref. */
- labelno[labeloff] = label + '0';
- strcat (string, labelno);
-
- if (noop)
- strcat (string, "\n\tnop");
-
- return string;
-}
-
-/* Return the string to output a conditional branch to LABEL, testing
- register REG. LABEL is the operand number of the label; REG is the
- operand number of the reg. OP is the conditional expression. The mode
- of REG says what kind of comparison we made.
-
- REVERSED is non-zero if we should reverse the sense of the comparison.
-
- ANNUL is non-zero if we should generate an annulling branch.
-
- NOOP is non-zero if we have to follow this branch by a noop. */
-
-char *
-output_v9branch (op, reg, label, reversed, annul, noop)
- rtx op;
- int reg, label;
- int reversed, annul, noop;
-{
- static char string[20];
- enum rtx_code code = GET_CODE (op);
- enum machine_mode mode = GET_MODE (XEXP (op, 0));
- static char labelno[] = " %X,%lX";
-
- /* If not floating-point or if EQ or NE, we can just reverse the code. */
- if (reversed)
- code = reverse_condition (code), reversed = 0;
-
- /* Only 64 bit versions of these instructions exist. */
- if (mode != DImode)
- abort ();
-
- /* Start by writing the branch condition. */
-
- switch (code)
- {
- case NE:
- strcpy (string, "brnz");
- break;
-
- case EQ:
- strcpy (string, "brz");
- break;
-
- case GE:
- strcpy (string, "brgez");
- break;
-
- case LT:
- strcpy (string, "brlz");
- break;
-
- case LE:
- strcpy (string, "brlez");
- break;
-
- case GT:
- strcpy (string, "brgz");
- break;
-
- default:
- abort ();
- }
-
- /* Now add the annulling, reg, label, and nop. */
- if (annul)
- strcat (string, ",a");
-
- /* ??? Optional prediction bit ",pt" or ",pf" goes here. */
-
- labelno[2] = reg + '0';
- labelno[6] = label + '0';
- strcat (string, labelno);
-
- if (noop)
- strcat (string, "\n\tnop");
-
- return string;
-}
-
-/* Output assembler code to return from a function. */
-
-/* ??? v9: Update to use the new `return' instruction. Also, add patterns to
- md file for the `return' instruction. */
-
-char *
-output_return (operands)
- rtx *operands;
-{
- if (leaf_label)
- {
- operands[0] = leaf_label;
- return "b,a %l0";
- }
- else if (leaf_function)
- {
- /* If we didn't allocate a frame pointer for the current function,
- the stack pointer might have been adjusted. Output code to
- restore it now. */
-
- operands[0] = gen_rtx (CONST_INT, VOIDmode, actual_fsize);
-
- /* Use sub of negated value in first two cases instead of add to
- allow actual_fsize == 4096. */
-
- if (actual_fsize <= 4096)
- {
- if (SKIP_CALLERS_UNIMP_P)
- return "jmp %%o7+12\n\tsub %%sp,-%0,%%sp";
- else
- return "retl\n\tsub %%sp,-%0,%%sp";
- }
- else if (actual_fsize <= 8192)
- {
- operands[0] = gen_rtx (CONST_INT, VOIDmode, actual_fsize - 4096);
- if (SKIP_CALLERS_UNIMP_P)
- return "sub %%sp,-4096,%%sp\n\tjmp %%o7+12\n\tsub %%sp,-%0,%%sp";
- else
- return "sub %%sp,-4096,%%sp\n\tretl\n\tsub %%sp,-%0,%%sp";
- }
- else if (SKIP_CALLERS_UNIMP_P)
- {
- if ((actual_fsize & 0x3ff) != 0)
- return "sethi %%hi(%a0),%%g1\n\tor %%g1,%%lo(%a0),%%g1\n\tjmp %%o7+12\n\tadd %%sp,%%g1,%%sp";
- else
- return "sethi %%hi(%a0),%%g1\n\tjmp %%o7+12\n\tadd %%sp,%%g1,%%sp";
- }
- else
- {
- if ((actual_fsize & 0x3ff) != 0)
- return "sethi %%hi(%a0),%%g1\n\tor %%g1,%%lo(%a0),%%g1\n\tretl\n\tadd %%sp,%%g1,%%sp";
- else
- return "sethi %%hi(%a0),%%g1\n\tretl\n\tadd %%sp,%%g1,%%sp";
- }
- }
- else
- {
- if (SKIP_CALLERS_UNIMP_P)
- return "jmp %%i7+12\n\trestore";
- else
- return "ret\n\trestore";
- }
-}
-
-/* Leaf functions and non-leaf functions have different needs. */
-
-static int
-reg_leaf_alloc_order[] = REG_LEAF_ALLOC_ORDER;
-
-static int
-reg_nonleaf_alloc_order[] = REG_ALLOC_ORDER;
-
-static int *reg_alloc_orders[] = {
- reg_leaf_alloc_order,
- reg_nonleaf_alloc_order};
-
-void
-order_regs_for_local_alloc ()
-{
- static int last_order_nonleaf = 1;
-
- if (regs_ever_live[15] != last_order_nonleaf)
- {
- last_order_nonleaf = !last_order_nonleaf;
- bcopy ((char *) reg_alloc_orders[last_order_nonleaf],
- (char *) reg_alloc_order, FIRST_PSEUDO_REGISTER * sizeof (int));
- }
-}
-
-/* Return 1 if REGNO (reg1) is even and REGNO (reg1) == REGNO (reg2) - 1.
- This makes them candidates for using ldd and std insns.
-
- Note reg1 and reg2 *must* be hard registers. To be sure we will
- abort if we are passed pseudo registers. */
-
-int
-registers_ok_for_ldd_peep (reg1, reg2)
- rtx reg1, reg2;
-{
- /* We might have been passed a SUBREG. */
- if (GET_CODE (reg1) != REG || GET_CODE (reg2) != REG)
- return 0;
-
- if (REGNO (reg1) % 2 != 0)
- return 0;
-
- return (REGNO (reg1) == REGNO (reg2) - 1);
-}
-
-/* Return 1 if addr1 and addr2 are suitable for use in an ldd or
- std insn.
-
- This can only happen when addr1 and addr2 are consecutive memory
- locations (addr1 + 4 == addr2). addr1 must also be aligned on a
- 64 bit boundary (addr1 % 8 == 0).
-
- We know %sp and %fp are kept aligned on a 64 bit boundary. Other
- registers are assumed to *never* be properly aligned and are
- rejected.
-
- Knowing %sp and %fp are kept aligned on a 64 bit boundary, we
- need only check that the offset for addr1 % 8 == 0. */
-
-int
-addrs_ok_for_ldd_peep (addr1, addr2)
- rtx addr1, addr2;
-{
- int reg1, offset1;
-
- /* Extract a register number and offset (if used) from the first addr. */
- if (GET_CODE (addr1) == PLUS)
- {
- /* If not a REG, return zero. */
- if (GET_CODE (XEXP (addr1, 0)) != REG)
- return 0;
- else
- {
- reg1 = REGNO (XEXP (addr1, 0));
- /* The offset must be constant! */
- if (GET_CODE (XEXP (addr1, 1)) != CONST_INT)
- return 0;
- offset1 = INTVAL (XEXP (addr1, 1));
- }
- }
- else if (GET_CODE (addr1) != REG)
- return 0;
- else
- {
- reg1 = REGNO (addr1);
- /* This was a simple (mem (reg)) expression. Offset is 0. */
- offset1 = 0;
- }
-
- /* Make sure the second address is a (mem (plus (reg) (const_int). */
- if (GET_CODE (addr2) != PLUS)
- return 0;
-
- if (GET_CODE (XEXP (addr2, 0)) != REG
- || GET_CODE (XEXP (addr2, 1)) != CONST_INT)
- return 0;
-
- /* Only %fp and %sp are allowed. Additionally both addresses must
- use the same register. */
- if (reg1 != FRAME_POINTER_REGNUM && reg1 != STACK_POINTER_REGNUM)
- return 0;
-
- if (reg1 != REGNO (XEXP (addr2, 0)))
- return 0;
-
- /* The first offset must be evenly divisible by 8 to ensure the
- address is 64 bit aligned. */
- if (offset1 % 8 != 0)
- return 0;
-
- /* The offset for the second addr must be 4 more than the first addr. */
- if (INTVAL (XEXP (addr2, 1)) != offset1 + 4)
- return 0;
-
- /* All the tests passed. addr1 and addr2 are valid for ldd and std
- instructions. */
- return 1;
-}
-
-/* Return 1 if reg is a pseudo, or is the first register in
- a hard register pair. This makes it a candidate for use in
- ldd and std insns. */
-
-int
-register_ok_for_ldd (reg)
- rtx reg;
-{
- /* We might have been passed a SUBREG. */
- if (GET_CODE (reg) != REG)
- return 0;
-
- if (REGNO (reg) < FIRST_PSEUDO_REGISTER)
- return (REGNO (reg) % 2 == 0);
- else
- return 1;
-}
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-void
-print_operand (file, x, code)
- FILE *file;
- rtx x;
- int code;
-{
- switch (code)
- {
- case '#':
- /* Output a 'nop' if there's nothing for the delay slot. */
- if (dbr_sequence_length () == 0)
- fputs ("\n\tnop", file);
- return;
- case '*':
- /* Output an annul flag if there's nothing for the delay slot and we
- are optimizing. This is always used with '(' below. */
- /* Sun OS 4.1.1 dbx can't handle an annulled unconditional branch;
- this is a dbx bug. So, we only do this when optimizing. */
- if (dbr_sequence_length () == 0 && optimize)
- fputs (",a", file);
- return;
- case '(':
- /* Output a 'nop' if there's nothing for the delay slot and we are
- not optimizing. This is always used with '*' above. */
- if (dbr_sequence_length () == 0 && ! optimize)
- fputs ("\n\tnop", file);
- return;
- case '_':
- /* Output the Medium/Anywhere code model base register. */
- fputs (MEDANY_BASE_REG, file);
- return;
- case '@':
- /* Print out what we are using as the frame pointer. This might
- be %fp, or might be %sp+offset. */
- /* ??? What if offset is too big? Perhaps the caller knows it isn't? */
- fprintf (file, "%s+%d", frame_base_name, frame_base_offset);
- return;
- case 'Y':
- /* Adjust the operand to take into account a RESTORE operation. */
- if (GET_CODE (x) != REG)
- output_operand_lossage ("Invalid %%Y operand");
- else if (REGNO (x) < 8)
- fputs (reg_names[REGNO (x)], file);
- else if (REGNO (x) >= 24 && REGNO (x) < 32)
- fputs (reg_names[REGNO (x)-16], file);
- else
- output_operand_lossage ("Invalid %%Y operand");
- return;
- case 'L':
- /* Print out the low order register name of a register pair. */
- if (WORDS_BIG_ENDIAN)
- fputs (reg_names[REGNO (x)+1], file);
- else
- fputs (reg_names[REGNO (x)], file);
- return;
- case 'H':
- /* Print out the high order register name of a register pair. */
- if (WORDS_BIG_ENDIAN)
- fputs (reg_names[REGNO (x)], file);
- else
- fputs (reg_names[REGNO (x)+1], file);
- return;
- case 'R':
- /* Print out the second register name of a register pair or quad.
- I.e., R (%o0) => %o1. */
- fputs (reg_names[REGNO (x)+1], file);
- return;
- case 'S':
- /* Print out the third register name of a register quad.
- I.e., S (%o0) => %o2. */
- fputs (reg_names[REGNO (x)+2], file);
- return;
- case 'T':
- /* Print out the fourth register name of a register quad.
- I.e., T (%o0) => %o3. */
- fputs (reg_names[REGNO (x)+3], file);
- return;
- case 'x':
- /* Print a condition code register. */
- if (REGNO (x) == SPARC_ICC_REG)
- {
- /* We don't handle CC[X]_NOOVmode because they're not supposed
- to occur here. */
- if (GET_MODE (x) == CCmode)
- fputs ("%icc", file);
- else if (GET_MODE (x) == CCXmode)
- fputs ("%xcc", file);
- else
- abort ();
- }
- else
- /* %fccN register */
- fputs (reg_names[REGNO (x)], file);
- return;
- case 'm':
- /* Print the operand's address only. */
- output_address (XEXP (x, 0));
- return;
- case 'r':
- /* In this case we need a register. Use %g0 if the
- operand is const0_rtx. */
- if (x == const0_rtx
- || (GET_MODE (x) != VOIDmode && x == CONST0_RTX (GET_MODE (x))))
- {
- fputs ("%g0", file);
- return;
- }
- else
- break;
-
- case 'A':
- switch (GET_CODE (x))
- {
- case IOR: fputs ("or", file); break;
- case AND: fputs ("and", file); break;
- case XOR: fputs ("xor", file); break;
- default: output_operand_lossage ("Invalid %%A operand");
- }
- return;
-
- case 'B':
- switch (GET_CODE (x))
- {
- case IOR: fputs ("orn", file); break;
- case AND: fputs ("andn", file); break;
- case XOR: fputs ("xnor", file); break;
- default: output_operand_lossage ("Invalid %%B operand");
- }
- return;
-
- /* These are used by the conditional move instructions. */
- case 'c' :
- case 'C':
- {
- enum rtx_code rc = (code == 'c'
- ? reverse_condition (GET_CODE (x))
- : GET_CODE (x));
- switch (rc)
- {
- case NE: fputs ("ne", file); break;
- case EQ: fputs ("e", file); break;
- case GE: fputs ("ge", file); break;
- case GT: fputs ("g", file); break;
- case LE: fputs ("le", file); break;
- case LT: fputs ("l", file); break;
- case GEU: fputs ("geu", file); break;
- case GTU: fputs ("gu", file); break;
- case LEU: fputs ("leu", file); break;
- case LTU: fputs ("lu", file); break;
- default: output_operand_lossage (code == 'c'
- ? "Invalid %%c operand"
- : "Invalid %%C operand");
- }
- return;
- }
-
- /* These are used by the movr instruction pattern. */
- case 'd':
- case 'D':
- {
- enum rtx_code rc = (code == 'd'
- ? reverse_condition (GET_CODE (x))
- : GET_CODE (x));
- switch (rc)
- {
- case NE: fputs ("ne", file); break;
- case EQ: fputs ("e", file); break;
- case GE: fputs ("gez", file); break;
- case LT: fputs ("lz", file); break;
- case LE: fputs ("lez", file); break;
- case GT: fputs ("gz", file); break;
- default: output_operand_lossage (code == 'd'
- ? "Invalid %%d operand"
- : "Invalid %%D operand");
- }
- return;
- }
-
- case 'b':
- {
- /* Print a sign-extended character. */
- int i = INTVAL (x) & 0xff;
- if (i & 0x80)
- i |= 0xffffff00;
- fprintf (file, "%d", i);
- return;
- }
-
- case 'f':
- /* Operand must be a MEM; write its address. */
- if (GET_CODE (x) != MEM)
- output_operand_lossage ("Invalid %%f operand");
- output_address (XEXP (x, 0));
- return;
-
- case 0:
- /* Do nothing special. */
- break;
-
- default:
- /* Undocumented flag. */
- output_operand_lossage ("invalid operand output code");
- }
-
- if (GET_CODE (x) == REG)
- fputs (reg_names[REGNO (x)], file);
- else if (GET_CODE (x) == MEM)
- {
- fputc ('[', file);
- /* Poor Sun assembler doesn't understand absolute addressing. */
- if (CONSTANT_P (XEXP (x, 0))
- && ! TARGET_LIVE_G0)
- fputs ("%g0+", file);
- output_address (XEXP (x, 0));
- fputc (']', file);
- }
- else if (GET_CODE (x) == HIGH)
- {
- fputs ("%hi(", file);
- output_addr_const (file, XEXP (x, 0));
- fputc (')', file);
- }
- else if (GET_CODE (x) == LO_SUM)
- {
- print_operand (file, XEXP (x, 0), 0);
- fputs ("+%lo(", file);
- output_addr_const (file, XEXP (x, 1));
- fputc (')', file);
- }
- else if (GET_CODE (x) == CONST_DOUBLE
- && (GET_MODE (x) == VOIDmode
- || GET_MODE_CLASS (GET_MODE (x)) == MODE_INT))
- {
- if (CONST_DOUBLE_HIGH (x) == 0)
- fprintf (file, "%u", CONST_DOUBLE_LOW (x));
- else if (CONST_DOUBLE_HIGH (x) == -1
- && CONST_DOUBLE_LOW (x) < 0)
- fprintf (file, "%d", CONST_DOUBLE_LOW (x));
- else
- output_operand_lossage ("long long constant not a valid immediate operand");
- }
- else if (GET_CODE (x) == CONST_DOUBLE)
- output_operand_lossage ("floating point constant not a valid immediate operand");
- else { output_addr_const (file, x); }
-}
-
-/* This function outputs assembler code for VALUE to FILE, where VALUE is
- a 64 bit (DImode) value. */
-
-/* ??? If there is a 64 bit counterpart to .word that the assembler
- understands, then using that would simply this code greatly. */
-/* ??? We only output .xword's for symbols and only then in environments
- where the assembler can handle them. */
-
-void
-output_double_int (file, value)
- FILE *file;
- rtx value;
-{
- if (GET_CODE (value) == CONST_INT)
- {
- if (INTVAL (value) < 0)
- ASM_OUTPUT_INT (file, constm1_rtx);
- else
- ASM_OUTPUT_INT (file, const0_rtx);
- ASM_OUTPUT_INT (file, value);
- }
- else if (GET_CODE (value) == CONST_DOUBLE)
- {
- ASM_OUTPUT_INT (file, gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (value)));
- ASM_OUTPUT_INT (file, gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (value)));
- }
- else if (GET_CODE (value) == SYMBOL_REF
- || GET_CODE (value) == CONST
- || GET_CODE (value) == PLUS
- || (TARGET_ARCH64 &&
- (GET_CODE (value) == LABEL_REF
- || GET_CODE (value) == CODE_LABEL
- || GET_CODE (value) == MINUS)))
- {
- if (!TARGET_V9 || TARGET_MEDLOW)
- {
- ASM_OUTPUT_INT (file, const0_rtx);
- ASM_OUTPUT_INT (file, value);
- }
- else
- {
- fprintf (file, "\t%s\t", ASM_LONGLONG);
- output_addr_const (file, value);
- fprintf (file, "\n");
- }
- }
- else
- abort ();
-}
-
-/* Return the value of a code used in the .proc pseudo-op that says
- what kind of result this function returns. For non-C types, we pick
- the closest C type. */
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * 2)
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-unsigned long
-sparc_type_code (type)
- register tree type;
-{
- register unsigned long qualifiers = 0;
- register unsigned shift = 6;
-
- /* Only the first 30 bits of the qualifier are valid. We must refrain from
- setting more, since some assemblers will give an error for this. Also,
- we must be careful to avoid shifts of 32 bits or more to avoid getting
- unpredictable results. */
-
- for (;;)
- {
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- return qualifiers;
-
- case ARRAY_TYPE:
- if (shift < 30)
- qualifiers |= (3 << shift);
- shift += 2;
- type = TREE_TYPE (type);
- break;
-
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- if (shift < 30)
- qualifiers |= (2 << shift);
- shift += 2;
- type = TREE_TYPE (type);
- break;
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- case OFFSET_TYPE:
- if (shift < 30)
- qualifiers |= (1 << shift);
- shift += 2;
- type = TREE_TYPE (type);
- break;
-
- case RECORD_TYPE:
- return (qualifiers | 8);
-
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- return (qualifiers | 9);
-
- case ENUMERAL_TYPE:
- return (qualifiers | 10);
-
- case VOID_TYPE:
- return (qualifiers | 16);
-
- case INTEGER_TYPE:
- /* If this is a range type, consider it to be the underlying
- type. */
- if (TREE_TYPE (type) != 0)
- {
- type = TREE_TYPE (type);
- break;
- }
-
- /* Carefully distinguish all the standard types of C,
- without messing up if the language is not C. We do this by
- testing TYPE_PRECISION and TREE_UNSIGNED. The old code used to
- look at both the names and the above fields, but that's redundant.
- Any type whose size is between two C types will be considered
- to be the wider of the two types. Also, we do not have a
- special code to use for "long long", so anything wider than
- long is treated the same. Note that we can't distinguish
- between "int" and "long" in this code if they are the same
- size, but that's fine, since neither can the assembler. */
-
- if (TYPE_PRECISION (type) <= CHAR_TYPE_SIZE)
- return (qualifiers | (TREE_UNSIGNED (type) ? 12 : 2));
-
- else if (TYPE_PRECISION (type) <= SHORT_TYPE_SIZE)
- return (qualifiers | (TREE_UNSIGNED (type) ? 13 : 3));
-
- else if (TYPE_PRECISION (type) <= INT_TYPE_SIZE)
- return (qualifiers | (TREE_UNSIGNED (type) ? 14 : 4));
-
- else
- return (qualifiers | (TREE_UNSIGNED (type) ? 15 : 5));
-
- case REAL_TYPE:
- /* Carefully distinguish all the standard types of C,
- without messing up if the language is not C. */
-
- if (TYPE_PRECISION (type) == FLOAT_TYPE_SIZE)
- return (qualifiers | 6);
-
- else
- return (qualifiers | 7);
-
- case COMPLEX_TYPE: /* GNU Fortran COMPLEX type. */
- /* ??? We need to distinguish between double and float complex types,
- but I don't know how yet because I can't reach this code from
- existing front-ends. */
- return (qualifiers | 7); /* Who knows? */
-
- case CHAR_TYPE: /* GNU Pascal CHAR type. Not used in C. */
- case BOOLEAN_TYPE: /* GNU Fortran BOOLEAN type. */
- case FILE_TYPE: /* GNU Pascal FILE type. */
- case SET_TYPE: /* GNU Pascal SET type. */
- case LANG_TYPE: /* ? */
- return qualifiers;
-
- default:
- abort (); /* Not a type! */
- }
- }
-}
-
-/* Nested function support. */
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function.
-
- This takes 16 insns: 2 shifts & 2 ands (to split up addresses), 4 sethi
- (to load in opcodes), 4 iors (to merge address and opcodes), and 4 writes
- (to store insns). This is a bit excessive. Perhaps a different
- mechanism would be better here.
-
- Emit enough FLUSH insns to synchronize the data and instruction caches. */
-
-void
-sparc_initialize_trampoline (tramp, fnaddr, cxt)
- rtx tramp, fnaddr, cxt;
-{
- rtx high_cxt = expand_shift (RSHIFT_EXPR, SImode, cxt,
- size_int (10), 0, 1);
- rtx high_fn = expand_shift (RSHIFT_EXPR, SImode, fnaddr,
- size_int (10), 0, 1);
- rtx low_cxt = expand_and (cxt, gen_rtx (CONST_INT, VOIDmode, 0x3ff), 0);
- rtx low_fn = expand_and (fnaddr, gen_rtx (CONST_INT, VOIDmode, 0x3ff), 0);
- rtx g1_sethi = gen_rtx (HIGH, SImode,
- gen_rtx (CONST_INT, VOIDmode, 0x03000000));
- rtx g2_sethi = gen_rtx (HIGH, SImode,
- gen_rtx (CONST_INT, VOIDmode, 0x05000000));
- rtx g1_ori = gen_rtx (HIGH, SImode,
- gen_rtx (CONST_INT, VOIDmode, 0x82106000));
- rtx g2_ori = gen_rtx (HIGH, SImode,
- gen_rtx (CONST_INT, VOIDmode, 0x8410A000));
- rtx tem = gen_reg_rtx (SImode);
- emit_move_insn (tem, g1_sethi);
- emit_insn (gen_iorsi3 (high_fn, high_fn, tem));
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (tramp, 0)), high_fn);
- emit_move_insn (tem, g1_ori);
- emit_insn (gen_iorsi3 (low_fn, low_fn, tem));
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (tramp, 4)), low_fn);
- emit_move_insn (tem, g2_sethi);
- emit_insn (gen_iorsi3 (high_cxt, high_cxt, tem));
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (tramp, 8)), high_cxt);
- emit_move_insn (tem, g2_ori);
- emit_insn (gen_iorsi3 (low_cxt, low_cxt, tem));
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (tramp, 16)), low_cxt);
- emit_insn (gen_flush (validize_mem (gen_rtx (MEM, SImode, tramp))));
- emit_insn (gen_flush (validize_mem (gen_rtx (MEM, SImode,
- plus_constant (tramp, 8)))));
- emit_insn (gen_flush (validize_mem (gen_rtx (MEM, SImode,
- plus_constant (tramp, 16)))));
-}
-
-/* The 64 bit version is simpler because it makes more sense to load the
- values as "immediate" data out of the trampoline. It's also easier since
- we can read the PC without clobbering a register. */
-
-void
-sparc64_initialize_trampoline (tramp, fnaddr, cxt)
- rtx tramp, fnaddr, cxt;
-{
- emit_move_insn (gen_rtx (MEM, DImode, plus_constant (tramp, 24)), cxt);
- emit_move_insn (gen_rtx (MEM, DImode, plus_constant (tramp, 32)), fnaddr);
- emit_insn (gen_flush (validize_mem (gen_rtx (MEM, DImode, tramp))));
- emit_insn (gen_flush (validize_mem (gen_rtx (MEM, DImode,
- plus_constant (tramp, 8)))));
- emit_insn (gen_flush (validize_mem (gen_rtx (MEM, DImode,
- plus_constant (tramp, 16)))));
- emit_insn (gen_flush (validize_mem (gen_rtx (MEM, DImode,
- plus_constant (tramp, 24)))));
- emit_insn (gen_flush (validize_mem (gen_rtx (MEM, DImode,
- plus_constant (tramp, 32)))));
-}
-
-/* Subroutines to support a flat (single) register window calling
- convention. */
-
-/* Single-register window sparc stack frames look like:
-
- Before call After call
- +-----------------------+ +-----------------------+
- high | | | |
- mem | caller's temps. | | caller's temps. |
- | | | |
- +-----------------------+ +-----------------------+
- | | | |
- | arguments on stack. | | arguments on stack. |
- | | | |
- +-----------------------+FP+92->+-----------------------+
- | 6 words to save | | 6 words to save |
- | arguments passed | | arguments passed |
- | in registers, even | | in registers, even |
- | if not passed. | | if not passed. |
- SP+68->+-----------------------+FP+68->+-----------------------+
- | 1 word struct addr | | 1 word struct addr |
- +-----------------------+FP+64->+-----------------------+
- | | | |
- | 16 word reg save area | | 16 word reg save area |
- | | | |
- SP->+-----------------------+ FP->+-----------------------+
- | 4 word area for |
- | fp/alu reg moves |
- FP-16->+-----------------------+
- | |
- | local variables |
- | |
- +-----------------------+
- | |
- | fp register save |
- | |
- +-----------------------+
- | |
- | gp register save |
- | |
- +-----------------------+
- | |
- | alloca allocations |
- | |
- +-----------------------+
- | |
- | arguments on stack |
- | |
- SP+92->+-----------------------+
- | 6 words to save |
- | arguments passed |
- | in registers, even |
- low | if not passed. |
- memory SP+68->+-----------------------+
- | 1 word struct addr |
- SP+64->+-----------------------+
- | |
- I 16 word reg save area |
- | |
- SP->+-----------------------+ */
-
-/* Structure to be filled in by sparc_flat_compute_frame_size with register
- save masks, and offsets for the current function. */
-
-struct sparc_frame_info
-{
- unsigned long total_size; /* # bytes that the entire frame takes up. */
- unsigned long var_size; /* # bytes that variables take up. */
- unsigned long args_size; /* # bytes that outgoing arguments take up. */
- unsigned long extra_size; /* # bytes of extra gunk. */
- unsigned int gp_reg_size; /* # bytes needed to store gp regs. */
- unsigned int fp_reg_size; /* # bytes needed to store fp regs. */
- unsigned long gmask; /* Mask of saved gp registers. */
- unsigned long fmask; /* Mask of saved fp registers. */
- unsigned long reg_offset; /* Offset from new sp to store regs. */
- int initialized; /* Nonzero if frame size already calculated. */
-};
-
-/* Current frame information calculated by sparc_flat_compute_frame_size. */
-struct sparc_frame_info current_frame_info;
-
-/* Zero structure to initialize current_frame_info. */
-struct sparc_frame_info zero_frame_info;
-
-/* Tell prologue and epilogue if register REGNO should be saved / restored. */
-
-#define RETURN_ADDR_REGNUM 15
-#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
-#define RETURN_ADDR_MASK (1 << (RETURN_ADDR_REGNUM))
-
-#define MUST_SAVE_REGISTER(regno) \
- ((regs_ever_live[regno] && !call_used_regs[regno]) \
- || (regno == FRAME_POINTER_REGNUM && frame_pointer_needed) \
- || (regno == RETURN_ADDR_REGNUM && regs_ever_live[RETURN_ADDR_REGNUM]))
-
-/* Return the bytes needed to compute the frame pointer from the current
- stack pointer. */
-
-unsigned long
-sparc_flat_compute_frame_size (size)
- int size; /* # of var. bytes allocated. */
-{
- int regno;
- unsigned long total_size; /* # bytes that the entire frame takes up. */
- unsigned long var_size; /* # bytes that variables take up. */
- unsigned long args_size; /* # bytes that outgoing arguments take up. */
- unsigned long extra_size; /* # extra bytes. */
- unsigned int gp_reg_size; /* # bytes needed to store gp regs. */
- unsigned int fp_reg_size; /* # bytes needed to store fp regs. */
- unsigned long gmask; /* Mask of saved gp registers. */
- unsigned long fmask; /* Mask of saved fp registers. */
- unsigned long reg_offset; /* Offset to register save area. */
- int need_aligned_p; /* 1 if need the save area 8 byte aligned. */
-
- /* This is the size of the 16 word reg save area, 1 word struct addr
- area, and 4 word fp/alu register copy area. */
- extra_size = -STARTING_FRAME_OFFSET + FIRST_PARM_OFFSET(0);
- var_size = size;
- /* Also include the size needed for the 6 parameter registers. */
- args_size = current_function_outgoing_args_size + 24;
- total_size = var_size + args_size + extra_size;
- gp_reg_size = 0;
- fp_reg_size = 0;
- gmask = 0;
- fmask = 0;
- reg_offset = 0;
- need_aligned_p = 0;
-
- /* Calculate space needed for gp registers. */
- for (regno = 1; regno <= 31; regno++)
- {
- if (MUST_SAVE_REGISTER (regno))
- {
- /* If we need to save two regs in a row, ensure there's room to bump
- up the address to align it to a doubleword boundary. */
- if ((regno & 0x1) == 0 && MUST_SAVE_REGISTER (regno+1))
- {
- if (gp_reg_size % 8 != 0)
- gp_reg_size += 4;
- gp_reg_size += 2 * UNITS_PER_WORD;
- gmask |= 3 << regno;
- regno++;
- need_aligned_p = 1;
- }
- else
- {
- gp_reg_size += UNITS_PER_WORD;
- gmask |= 1 << regno;
- }
- }
- }
-
- /* Calculate space needed for fp registers. */
- for (regno = 32; regno <= 63; regno++)
- {
- if (regs_ever_live[regno] && !call_used_regs[regno])
- {
- fp_reg_size += UNITS_PER_WORD;
- fmask |= 1 << (regno - 32);
- }
- }
-
- if (gmask || fmask)
- {
- int n;
- reg_offset = FIRST_PARM_OFFSET(0) + args_size;
- /* Ensure save area is 8 byte aligned if we need it. */
- n = reg_offset % 8;
- if (need_aligned_p && n != 0)
- {
- total_size += 8 - n;
- reg_offset += 8 - n;
- }
- total_size += gp_reg_size + fp_reg_size;
- }
-
- /* ??? This looks a little suspicious. Clarify. */
- if (total_size == extra_size)
- total_size = extra_size = 0;
-
- total_size = SPARC_STACK_ALIGN (total_size);
-
- /* Save other computed information. */
- current_frame_info.total_size = total_size;
- current_frame_info.var_size = var_size;
- current_frame_info.args_size = args_size;
- current_frame_info.extra_size = extra_size;
- current_frame_info.gp_reg_size = gp_reg_size;
- current_frame_info.fp_reg_size = fp_reg_size;
- current_frame_info.gmask = gmask;
- current_frame_info.fmask = fmask;
- current_frame_info.reg_offset = reg_offset;
- current_frame_info.initialized = reload_completed;
-
- /* Ok, we're done. */
- return total_size;
-}
-
-/* Save/restore registers in GMASK and FMASK at register BASE_REG plus offset
- OFFSET.
-
- BASE_REG must be 8 byte aligned. This allows us to test OFFSET for
- appropriate alignment and use DOUBLEWORD_OP when we can. We assume
- [BASE_REG+OFFSET] will always be a valid address.
-
- WORD_OP is either "st" for save, "ld" for restore.
- DOUBLEWORD_OP is either "std" for save, "ldd" for restore. */
-
-void
-sparc_flat_save_restore (file, base_reg, offset, gmask, fmask, word_op, doubleword_op)
- FILE *file;
- char *base_reg;
- unsigned int offset;
- unsigned long gmask;
- unsigned long fmask;
- char *word_op;
- char *doubleword_op;
-{
- int regno;
-
- if (gmask == 0 && fmask == 0)
- return;
-
- /* Save registers starting from high to low. We've already saved the
- previous frame pointer and previous return address for the debugger's
- sake. The debugger allows us to not need a nop in the epilog if at least
- one register is reloaded in addition to return address. */
-
- if (gmask)
- {
- for (regno = 1; regno <= 31; regno++)
- {
- if ((gmask & (1L << regno)) != 0)
- {
- if ((regno & 0x1) == 0 && ((gmask & (1L << (regno+1))) != 0))
- {
- /* We can save two registers in a row. If we're not at a
- double word boundary, move to one.
- sparc_flat_compute_frame_size ensures there's room to do
- this. */
- if (offset % 8 != 0)
- offset += UNITS_PER_WORD;
-
- if (word_op[0] == 's')
- fprintf (file, "\t%s %s,[%s+%d]\n",
- doubleword_op, reg_names[regno],
- base_reg, offset);
- else
- fprintf (file, "\t%s [%s+%d],%s\n",
- doubleword_op, base_reg, offset,
- reg_names[regno]);
-
- offset += 2 * UNITS_PER_WORD;
- regno++;
- }
- else
- {
- if (word_op[0] == 's')
- fprintf (file, "\t%s %s,[%s+%d]\n",
- word_op, reg_names[regno],
- base_reg, offset);
- else
- fprintf (file, "\t%s [%s+%d],%s\n",
- word_op, base_reg, offset, reg_names[regno]);
-
- offset += UNITS_PER_WORD;
- }
- }
- }
- }
-
- if (fmask)
- {
- for (regno = 32; regno <= 63; regno++)
- {
- if ((fmask & (1L << (regno - 32))) != 0)
- {
- if (word_op[0] == 's')
- fprintf (file, "\t%s %s,[%s+%d]\n",
- word_op, reg_names[regno],
- base_reg, offset);
- else
- fprintf (file, "\t%s [%s+%d],%s\n",
- word_op, base_reg, offset, reg_names[regno]);
-
- offset += UNITS_PER_WORD;
- }
- }
- }
-}
-
-/* Set up the stack and frame (if desired) for the function. */
-
-void
-sparc_flat_output_function_prologue (file, size)
- FILE *file;
- int size;
-{
- char *sp_str = reg_names[STACK_POINTER_REGNUM];
- unsigned long gmask = current_frame_info.gmask;
-
- /* This is only for the human reader. */
- fprintf (file, "\t!#PROLOGUE# 0\n");
- fprintf (file, "\t!# vars= %d, regs= %d/%d, args= %d, extra= %d\n",
- current_frame_info.var_size,
- current_frame_info.gp_reg_size / 4,
- current_frame_info.fp_reg_size / 4,
- current_function_outgoing_args_size,
- current_frame_info.extra_size);
-
- size = SPARC_STACK_ALIGN (size);
- size = (! current_frame_info.initialized
- ? sparc_flat_compute_frame_size (size)
- : current_frame_info.total_size);
-
- /* These cases shouldn't happen. Catch them now. */
- if (size == 0 && (gmask || current_frame_info.fmask))
- abort ();
-
- /* Allocate our stack frame by decrementing %sp.
- At present, the only algorithm gdb can use to determine if this is a
- flat frame is if we always set %i7 if we set %sp. This can be optimized
- in the future by putting in some sort of debugging information that says
- this is a `flat' function. However, there is still the case of debugging
- code without such debugging information (including cases where most fns
- have such info, but there is one that doesn't). So, always do this now
- so we don't get a lot of code out there that gdb can't handle.
- If the frame pointer isn't needn't then that's ok - gdb won't be able to
- distinguish us from a non-flat function but there won't (and shouldn't)
- be any differences anyway. The return pc is saved (if necessary) right
- after %i7 so gdb won't have to look too far to find it. */
- if (size > 0)
- {
- unsigned int reg_offset = current_frame_info.reg_offset;
- char *fp_str = reg_names[FRAME_POINTER_REGNUM];
- char *t1_str = "%g1";
-
- /* Things get a little tricky if local variables take up more than ~4096
- bytes and outgoing arguments take up more than ~4096 bytes. When that
- happens, the register save area can't be accessed from either end of
- the frame. Handle this by decrementing %sp to the start of the gp
- register save area, save the regs, update %i7, and then set %sp to its
- final value. Given that we only have one scratch register to play
- with it is the cheapest solution, and it helps gdb out as it won't
- slow down recognition of flat functions.
- Don't change the order of insns emitted here without checking with
- the gdb folk first. */
-
- /* Is the entire register save area offsettable from %sp? */
- if (reg_offset < 4096 - 64 * UNITS_PER_WORD)
- {
- if (size <= 4096)
- {
- fprintf (file, "\tadd %s,%d,%s\n",
- sp_str, -size, sp_str);
- if (gmask & FRAME_POINTER_MASK)
- {
- fprintf (file, "\tst %s,[%s+%d]\n",
- fp_str, sp_str, reg_offset);
- fprintf (file, "\tsub %s,%d,%s\t!# set up frame pointer\n",
- sp_str, -size, fp_str);
- reg_offset += 4;
- }
- }
- else
- {
- fprintf (file, "\tset %d,%s\n\tsub %s,%s,%s\n",
- size, t1_str, sp_str, t1_str, sp_str);
- if (gmask & FRAME_POINTER_MASK)
- {
- fprintf (file, "\tst %s,[%s+%d]\n",
- fp_str, sp_str, reg_offset);
- fprintf (file, "\tadd %s,%s,%s\t!# set up frame pointer\n",
- sp_str, t1_str, fp_str);
- reg_offset += 4;
- }
- }
- if (gmask & RETURN_ADDR_MASK)
- {
- fprintf (file, "\tst %s,[%s+%d]\n",
- reg_names[RETURN_ADDR_REGNUM], sp_str, reg_offset);
- reg_offset += 4;
- }
- sparc_flat_save_restore (file, sp_str, reg_offset,
- gmask & ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK),
- current_frame_info.fmask,
- "st", "std");
- }
- else
- {
- /* Subtract %sp in two steps, but make sure there is always a
- 64 byte register save area, and %sp is properly aligned. */
- /* Amount to decrement %sp by, the first time. */
- unsigned int size1 = ((size - reg_offset + 64) + 15) & -16;
- /* Offset to register save area from %sp. */
- unsigned int offset = size1 - (size - reg_offset);
-
- if (size1 <= 4096)
- {
- fprintf (file, "\tadd %s,%d,%s\n",
- sp_str, -size1, sp_str);
- if (gmask & FRAME_POINTER_MASK)
- {
- fprintf (file, "\tst %s,[%s+%d]\n\tsub %s,%d,%s\t!# set up frame pointer\n",
- fp_str, sp_str, offset, sp_str, -size1, fp_str);
- offset += 4;
- }
- }
- else
- {
- fprintf (file, "\tset %d,%s\n\tsub %s,%s,%s\n",
- size1, t1_str, sp_str, t1_str, sp_str);
- if (gmask & FRAME_POINTER_MASK)
- {
- fprintf (file, "\tst %s,[%s+%d]\n\tadd %s,%s,%s\t!# set up frame pointer\n",
- fp_str, sp_str, offset, sp_str, t1_str, fp_str);
- offset += 4;
- }
- }
- if (gmask & RETURN_ADDR_MASK)
- {
- fprintf (file, "\tst %s,[%s+%d]\n",
- reg_names[RETURN_ADDR_REGNUM], sp_str, offset);
- offset += 4;
- }
- sparc_flat_save_restore (file, sp_str, offset,
- gmask & ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK),
- current_frame_info.fmask,
- "st", "std");
- fprintf (file, "\tset %d,%s\n\tsub %s,%s,%s\n",
- size - size1, t1_str, sp_str, t1_str, sp_str);
- }
- }
-
- fprintf (file, "\t!#PROLOGUE# 1\n");
-}
-
-/* Do any necessary cleanup after a function to restore stack, frame,
- and regs. */
-
-void
-sparc_flat_output_function_epilogue (file, size)
- FILE *file;
- int size;
-{
- rtx epilogue_delay = current_function_epilogue_delay_list;
- int noepilogue = FALSE;
-
- /* This is only for the human reader. */
- fprintf (file, "\t!#EPILOGUE#\n");
-
- /* The epilogue does not depend on any registers, but the stack
- registers, so we assume that if we have 1 pending nop, it can be
- ignored, and 2 it must be filled (2 nops occur for integer
- multiply and divide). */
-
- size = SPARC_STACK_ALIGN (size);
- size = (!current_frame_info.initialized
- ? sparc_flat_compute_frame_size (size)
- : current_frame_info.total_size);
-
- if (size == 0 && epilogue_delay == 0)
- {
- rtx insn = get_last_insn ();
-
- /* If the last insn was a BARRIER, we don't have to write any code
- because a jump (aka return) was put there. */
- if (GET_CODE (insn) == NOTE)
- insn = prev_nonnote_insn (insn);
- if (insn && GET_CODE (insn) == BARRIER)
- noepilogue = TRUE;
- }
-
- if (!noepilogue)
- {
- unsigned int reg_offset = current_frame_info.reg_offset;
- unsigned int size1;
- char *sp_str = reg_names[STACK_POINTER_REGNUM];
- char *fp_str = reg_names[FRAME_POINTER_REGNUM];
- char *t1_str = "%g1";
-
- /* In the reload sequence, we don't need to fill the load delay
- slots for most of the loads, also see if we can fill the final
- delay slot if not otherwise filled by the reload sequence. */
-
- if (size > 4095)
- fprintf (file, "\tset %d,%s\n", size, t1_str);
-
- if (frame_pointer_needed)
- {
- if (size > 4095)
- fprintf (file,"\tsub %s,%s,%s\t\t!# sp not trusted here\n",
- fp_str, t1_str, sp_str);
- else
- fprintf (file,"\tsub %s,%d,%s\t\t!# sp not trusted here\n",
- fp_str, size, sp_str);
- }
-
- /* Is the entire register save area offsettable from %sp? */
- if (reg_offset < 4096 - 64 * UNITS_PER_WORD)
- {
- size1 = 0;
- }
- else
- {
- /* Restore %sp in two steps, but make sure there is always a
- 64 byte register save area, and %sp is properly aligned. */
- /* Amount to increment %sp by, the first time. */
- size1 = ((reg_offset - 64 - 16) + 15) & -16;
- /* Offset to register save area from %sp. */
- reg_offset = size1 - reg_offset;
-
- fprintf (file, "\tset %d,%s\n\tadd %s,%s,%s\n",
- size1, t1_str, sp_str, t1_str, sp_str);
- }
-
- /* We must restore the frame pointer and return address reg first
- because they are treated specially by the prologue output code. */
- if (current_frame_info.gmask & FRAME_POINTER_MASK)
- {
- fprintf (file, "\tld [%s+%d],%s\n",
- sp_str, reg_offset, fp_str);
- reg_offset += 4;
- }
- if (current_frame_info.gmask & RETURN_ADDR_MASK)
- {
- fprintf (file, "\tld [%s+%d],%s\n",
- sp_str, reg_offset, reg_names[RETURN_ADDR_REGNUM]);
- reg_offset += 4;
- }
-
- /* Restore any remaining saved registers. */
- sparc_flat_save_restore (file, sp_str, reg_offset,
- current_frame_info.gmask & ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK),
- current_frame_info.fmask,
- "ld", "ldd");
-
- /* If we had to increment %sp in two steps, record it so the second
- restoration in the epilogue finishes up. */
- if (size1 > 0)
- {
- size -= size1;
- if (size > 4095)
- fprintf (file, "\tset %d,%s\n",
- size, t1_str);
- }
-
- if (current_function_returns_struct)
- fprintf (file, "\tjmp %%o7+12\n");
- else
- fprintf (file, "\tretl\n");
-
- /* If the only register saved is the return address, we need a
- nop, unless we have an instruction to put into it. Otherwise
- we don't since reloading multiple registers doesn't reference
- the register being loaded. */
-
- if (epilogue_delay)
- {
- if (size)
- abort ();
- final_scan_insn (XEXP (epilogue_delay, 0), file, 1, -2, 1);
- }
-
- else if (size > 4095)
- fprintf (file, "\tadd %s,%s,%s\n", sp_str, t1_str, sp_str);
-
- else if (size > 0)
- fprintf (file, "\tadd %s,%d,%s\n", sp_str, size, sp_str);
-
- else
- fprintf (file, "\tnop\n");
- }
-
- /* Reset state info for each function. */
- current_frame_info = zero_frame_info;
-}
-
-/* Define the number of delay slots needed for the function epilogue.
-
- On the sparc, we need a slot if either no stack has been allocated,
- or the only register saved is the return register. */
-
-int
-sparc_flat_epilogue_delay_slots ()
-{
- if (!current_frame_info.initialized)
- (void) sparc_flat_compute_frame_size (get_frame_size ());
-
- if (current_frame_info.total_size == 0)
- return 1;
-
- return 0;
-}
-
-/* Return true is TRIAL is a valid insn for the epilogue delay slot.
- Any single length instruction which doesn't reference the stack or frame
- pointer is OK. */
-
-int
-sparc_flat_eligible_for_epilogue_delay (trial, slot)
- rtx trial;
- int slot;
-{
- rtx pat = PATTERN (trial);
-
- if (get_attr_length (trial) != 1)
- return 0;
-
- /* If %g0 is live, there are lots of things we can't handle.
- Rather than trying to find them all now, let's punt and only
- optimize things as necessary. */
- if (TARGET_LIVE_G0)
- return 0;
-
- if (! reg_mentioned_p (stack_pointer_rtx, pat)
- && ! reg_mentioned_p (frame_pointer_rtx, pat))
- return 1;
-
- return 0;
-}
-
-/* Adjust the cost of a scheduling dependency. Return the new cost of
- a dependency LINK or INSN on DEP_INSN. COST is the current cost. */
-
-int
-supersparc_adjust_cost (insn, link, dep_insn, cost)
- rtx insn;
- rtx link;
- rtx dep_insn;
- int cost;
-{
- enum attr_type insn_type;
-
- if (! recog_memoized (insn))
- return 0;
-
- insn_type = get_attr_type (insn);
-
- if (REG_NOTE_KIND (link) == 0)
- {
- /* Data dependency; DEP_INSN writes a register that INSN reads some
- cycles later. */
-
- /* if a load, then the dependence must be on the memory address;
- add an extra 'cycle'. Note that the cost could be two cycles
- if the reg was written late in an instruction group; we can't tell
- here. */
- if (insn_type == TYPE_LOAD || insn_type == TYPE_FPLOAD)
- return cost + 3;
-
- /* Get the delay only if the address of the store is the dependence. */
- if (insn_type == TYPE_STORE || insn_type == TYPE_FPSTORE)
- {
- rtx pat = PATTERN(insn);
- rtx dep_pat = PATTERN (dep_insn);
-
- if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET)
- return cost; /* This shouldn't happen! */
-
- /* The dependency between the two instructions was on the data that
- is being stored. Assume that this implies that the address of the
- store is not dependent. */
- if (rtx_equal_p (SET_DEST (dep_pat), SET_SRC (pat)))
- return cost;
-
- return cost + 3; /* An approximation. */
- }
-
- /* A shift instruction cannot receive its data from an instruction
- in the same cycle; add a one cycle penalty. */
- if (insn_type == TYPE_SHIFT)
- return cost + 3; /* Split before cascade into shift. */
- }
- else
- {
- /* Anti- or output- dependency; DEP_INSN reads/writes a register that
- INSN writes some cycles later. */
-
- /* These are only significant for the fpu unit; writing a fp reg before
- the fpu has finished with it stalls the processor. */
-
- /* Reusing an integer register causes no problems. */
- if (insn_type == TYPE_IALU || insn_type == TYPE_SHIFT)
- return 0;
- }
-
- return cost;
-}
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
deleted file mode 100644
index d19f6226df3..00000000000
--- a/gcc/config/sparc/sparc.h
+++ /dev/null
@@ -1,3103 +0,0 @@
-/* Definitions of target machine for GNU compiler, for Sun SPARC.
- Copyright (C) 1987, 88, 89, 92, 94, 95, 96, 1997 Free Software Foundation,
- Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.com).
- 64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
- at Cygnus Support.
-
-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. */
-
-/* Note that some other tm.h files include this one and then override
- many of the definitions that relate to assembler syntax. */
-
-/* Sparc64 support has been added by trying to allow for a day when one
- compiler can handle both v8 and v9. There are a few cases where this
- isn't doable, but keep them to a minimum!
-
- TARGET_V9 is used to select at runtime the sparc64 chip.
- TARGET_ARCH64 is used to select at runtime a 64 bit environment.
- SPARC_V9 is defined as 0 or 1 (so it may be used inside and outside
- #define's), and says whether the cpu is a sparc64 chip (which may be
- running in a 32 or 64 bit environment).
- SPARC_ARCH64 is defined as 0 for a 32 bit environment and 1 for a 64 bit
- environment.
-
- In places where it is possible to choose at runtime, use TARGET_V9 and
- TARGET_ARCH64. In places where it is currently not possible to select
- between the two at runtime use SPARC_{V9,ARCH64}. Again, keep uses of
- SPARC_{V9,ARCH64} to a minimum. No attempt is made to support both v8
- and v9 in the v9 compiler.
-
- ??? All uses of SPARC_V9 have been removed. Try not to add new ones.
-*/
-
-#ifndef SPARC_V9
-#define SPARC_V9 0
-#endif
-#ifndef SPARC_ARCH64
-#define SPARC_ARCH64 0
-#endif
-
-/* Values of TARGET_CPU_DEFAULT, set via -D in the Makefile. */
-#define TARGET_CPU_sparc 0
-#define TARGET_CPU_v7 0 /* alias for previous */
-#define TARGET_CPU_sparclet 1
-#define TARGET_CPU_sparclite 2
-#define TARGET_CPU_v8 3
-#define TARGET_CPU_supersparc 4
-#define TARGET_CPU_ultrasparc 5
-#define TARGET_CPU_sparc64 5 /* alias for ultrasparc */
-
-#if TARGET_CPU_DEFAULT == TARGET_CPU_sparc || TARGET_CPU_DEFAULT == TARGET_CPU_v8 || TARGET_CPU_DEFAULT == TARGET_CPU_supersparc
-#define CPP_DEFAULT_SPEC ""
-#define ASM_DEFAULT_SPEC ""
-#else
-#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclet
-#define CPP_DEFAULT_SPEC "-D__sparclet__"
-#define ASM_DEFAULT_SPEC "-Asparclet"
-#else
-#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclite
-#define CPP_DEFAULT_SPEC "-D__sparclite__"
-#define ASM_DEFAULT_SPEC "-Asparclite"
-#else
-#if TARGET_CPU_DEFAULT == TARGET_CPU_sparc64
-/* ??? What does Sun's CC pass? */
-#define CPP_DEFAULT_SPEC "-D__sparc_v9__"
-/* ??? It's not clear how other assemblers will handle this, so by default
- use GAS. Sun's Solaris assembler recognizes -xarch=v8plus, but this case
- is handled in sol2.h. */
-#define ASM_DEFAULT_SPEC "-Av9"
-#else
-Unrecognized value in TARGET_CPU_DEFAULT.
-#endif
-#endif
-#endif
-#endif
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-/* ??? The GCC_NEW_VARARGS macro is now obsolete, because gcc always uses
- the right varags.h file when bootstrapping. */
-/* ??? It's not clear what value we want to use for -Acpu/machine for
- sparc64 in 32 bit environments, so for now we only use `sparc64' in
- 64 bit environments. */
-/* ??? __arch64__ is subject to change. */
-
-#if SPARC_ARCH64
-#define CPP_PREDEFINES \
- "-Dsparc -Dsun -Dunix -D__arch64__ \
- -Asystem(unix) -Asystem(bsd) -Acpu(sparc64) -Amachine(sparc64)"
-#else
-#define CPP_PREDEFINES \
- "-Dsparc -Dsun -Dunix -D__GCC_NEW_VARARGS__ \
- -Asystem(unix) -Asystem(bsd) -Acpu(sparc) -Amachine(sparc)"
-#endif
-
-/* Define macros to distinguish architectures. */
-
-#if SPARC_ARCH64
-#define CPP_SPEC "\
-%{mint64:-D__INT_MAX__=9223372036854775807LL -D__LONG_MAX__=9223372036854775807LL} \
-%{mlong64:-D__LONG_MAX__=9223372036854775807LL} \
-"
-#else
-#define CPP_SPEC "%(cpp_cpu)"
-#endif
-
-/* Common CPP definitions used by CPP_SPEC amongst the various targets
- for handling -mcpu=xxx switches. */
-/* ??? v8plus/v9/ultrasparc handling is tentative */
-#define CPP_CPU_SPEC "\
-%{mcypress:} \
-%{msparclite:-D__sparclite__} \
-%{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \
-%{mv8:-D__sparc_v8__} \
-%{msupersparc:-D__supersparc__ -D__sparc_v8__} \
-%{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \
-%{mcpu=sparclite:-D__sparclite__} \
-%{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \
-%{mcpu=v8:-D__sparc_v8__} \
-%{mcpu=supersparc:-D__supersparc__ -D__sparc_v8__} \
-%{mcpu=v8plus:-D__sparc_v9__} \
-%{mcpu=v9:-D__sparc_v9__} \
-%{mcpu=ultrasparc:-D__sparc_v9__} \
-%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_default)}}}}}}} \
-"
-
-/* Prevent error on `-sun4' and `-target sun4' options. */
-/* This used to translate -dalign to -malign, but that is no good
- because it can't turn off the usual meaning of making debugging dumps. */
-/* Translate old style -m<cpu> into new style -mcpu=<cpu>.
- ??? Delete support for -m<cpu> for 2.9. */
-
-#define CC1_SPEC "\
-%{sun4:} %{target:} \
-%{mcypress:-mcpu=cypress} \
-%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
-%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
-"
-
-#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}"
-
-/* Provide required defaults for linker -e and -d switches. */
-
-#define LINK_SPEC \
- "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \
- %{assert*} %{shared:%{!mimpure-text:-assert pure-text}}"
-
-/* Special flags to the Sun-4 assembler when using pipe for input. */
-
-#define ASM_SPEC "\
-%| %{R} %{!pg:%{!p:%{fpic:-k} %{fPIC:-k}}} %{keep-local-as-symbols:-L} \
-%(asm_cpu) \
-"
-
-/* Override in target specific files. */
-#define ASM_CPU_SPEC "\
-%{mcpu=sparclet:-Asparclet} %{mcpu=tsc701:-Asparclet} \
-%{msparclite:-Asparclite} \
-%{mf930:-Asparclite} %{mf934:-Asparclite} \
-%{mcpu=sparclite:-Asparclite} \
-%{mcpu=f930:-Asparclite} %{mcpu=f934:-Asparclite} \
-%{mcpu=v8plus:-Av9} \
-%{mcpu=v9:-Av9} \
-%{mcpu=ultrasparc:-Av9} \
-%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(asm_default)}}}}}}} \
-"
-
-/* This macro defines names of additional specifications to put in the specs
- that can be used in various specifications like CC1_SPEC. Its definition
- is an initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- specification name, and a string constant that used by the GNU CC driver
- program.
-
- Do not define this macro if it does not need to do anything. */
-
-#define EXTRA_SPECS \
- { "cpp_cpu", CPP_CPU_SPEC }, \
- { "cpp_default", CPP_DEFAULT_SPEC }, \
- { "asm_cpu", ASM_CPU_SPEC }, \
- { "asm_default", ASM_DEFAULT_SPEC }, \
- SUBTARGET_EXTRA_SPECS
-
-#define SUBTARGET_EXTRA_SPECS
-
-#if SPARC_ARCH64
-#define PTRDIFF_TYPE "long long int"
-#define SIZE_TYPE "long long unsigned int"
-#else
-#define PTRDIFF_TYPE "int"
-/* The default value for SIZE_TYPE is "unsigned int" which is what we want. */
-#endif
-
-/* ??? This should be 32 bits for v9 but what can we do? */
-#define WCHAR_TYPE "short unsigned int"
-#define WCHAR_TYPE_SIZE 16
-#define MAX_WCHAR_TYPE_SIZE 16
-
-/* Show we can debug even without a frame pointer. */
-#define CAN_DEBUG_WITHOUT_FP
-
-/* To make profiling work with -f{pic,PIC}, we need to emit the profiling
- code into the rtl. Also, if we are profiling, we cannot eliminate
- the frame pointer (because the return address will get smashed). */
-
-void sparc_override_options ();
-
-#define OVERRIDE_OPTIONS \
- do { \
- if (profile_flag || profile_block_flag || profile_arc_flag) \
- { \
- if (flag_pic) \
- { \
- char *pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC"; \
- warning ("%s and profiling conflict: disabling %s", \
- pic_string, pic_string); \
- flag_pic = 0; \
- } \
- flag_omit_frame_pointer = 0; \
- } \
- sparc_override_options (); \
- SUBTARGET_OVERRIDE_OPTIONS; \
- } while (0)
-
-/* This is meant to be redefined in the host dependent files. */
-#define SUBTARGET_OVERRIDE_OPTIONS
-
-/* These compiler options take an argument. We ignore -target for now. */
-
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
- || !strcmp (STR, "target") || !strcmp (STR, "assert"))
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fprintf (stderr, " (sparc)");
-
-/* Generate DBX debugging information. */
-
-#define DBX_DEBUGGING_INFO
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Nonzero if we should generate code to use the fpu. */
-#define MASK_FPU 1
-#define TARGET_FPU (target_flags & MASK_FPU)
-
-/* Nonzero if we should use FUNCTION_EPILOGUE. Otherwise, we
- use fast return insns, but lose some generality. */
-#define MASK_EPILOGUE 2
-#define TARGET_EPILOGUE (target_flags & MASK_EPILOGUE)
-
-/* Nonzero if we should assume that double pointers might be unaligned.
- This can happen when linking gcc compiled code with other compilers,
- because the ABI only guarantees 4 byte alignment. */
-#define MASK_UNALIGNED_DOUBLES 4
-#define TARGET_UNALIGNED_DOUBLES (target_flags & MASK_UNALIGNED_DOUBLES)
-
-/* Nonzero means that we should generate code for a v8 sparc. */
-#define MASK_V8 0x8
-#define TARGET_V8 (target_flags & MASK_V8)
-
-/* Nonzero means that we should generate code for a sparclite.
- This enables the sparclite specific instructions, but does not affect
- whether FPU instructions are emitted. */
-#define MASK_SPARCLITE 0x10
-#define TARGET_SPARCLITE (target_flags & MASK_SPARCLITE)
-
-/* Nonzero if we're compiling for the sparclet. */
-#define MASK_SPARCLET 0x20
-#define TARGET_SPARCLET (target_flags & MASK_SPARCLET)
-
-/* Nonzero if we're compiling for v9 sparc.
- Note that v9's can run in 32 bit mode so this doesn't necessarily mean
- the word size is 64. */
-#define MASK_V9 0x40
-#define TARGET_V9 (target_flags & MASK_V9)
-
-/* Non-zero to generate code that uses the instructions deprecated in
- the v9 architecture. This option only applies to v9 systems. */
-/* ??? This isn't user selectable yet. It's used to enable such insns
- on 32 bit v9 systems and for the moment they're permanently disabled
- on 64 bit v9 systems. */
-#define MASK_DEPRECATED_V8_INSNS 0x80
-#define TARGET_DEPRECATED_V8_INSNS (target_flags & MASK_DEPRECATED_V8_INSNS)
-
-/* Mask of all CPU selection flags. */
-#define MASK_ISA \
-(MASK_V8 + MASK_SPARCLITE + MASK_SPARCLET + MASK_V9 + MASK_DEPRECATED_V8_INSNS)
-
-/* Non-zero means don't pass `-assert pure-text' to the linker. */
-#define MASK_IMPURE_TEXT 0x100
-#define TARGET_IMPURE_TEXT (target_flags & MASK_IMPURE_TEXT)
-
-/* Nonzero means that we should generate code using a flat register window
- model, i.e. no save/restore instructions are generated, which is
- compatible with normal sparc code.
- The frame pointer is %i7 instead of %fp. */
-#define MASK_FLAT 0x200
-#define TARGET_FLAT (target_flags & MASK_FLAT)
-
-/* Nonzero means use the registers that the Sparc ABI reserves for
- application software. This must be the default to coincide with the
- setting in FIXED_REGISTERS. */
-#define MASK_APP_REGS 0x400
-#define TARGET_APP_REGS (target_flags & MASK_APP_REGS)
-
-/* Option to select how quad word floating point is implemented.
- When TARGET_HARD_QUAD is true, we use the hardware quad instructions.
- Otherwise, we use the SPARC ABI quad library functions. */
-#define MASK_HARD_QUAD 0x800
-#define TARGET_HARD_QUAD (target_flags & MASK_HARD_QUAD)
-
-/* Non-zero on little-endian machines. */
-/* ??? Little endian support currently only exists for sparclet-aout and
- sparc64-elf configurations. May eventually want to expand the support
- to all targets, but for now it's kept local to only those two. */
-#define MASK_LITTLE_ENDIAN 0x1000
-#define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN)
-
-/* Nonzero if ints are 64 bits.
- This automatically implies longs are 64 bits too.
- This option is for v9 only. */
-#define MASK_INT64 0x2000
-#define TARGET_INT64 (target_flags & MASK_INT64)
-
-/* Nonzero if longs are 64 bits.
- This option is for v9 only. */
-#define MASK_LONG64 0x4000
-#define TARGET_LONG64 (target_flags & MASK_LONG64)
-
-/* Nonzero if pointers are 64 bits.
- This is not a user selectable option, though it may be one day -
- so it is used to determine pointer size instead of an architecture flag. */
-#define MASK_PTR64 0x8000
-#define TARGET_PTR64 (target_flags & MASK_PTR64)
-
-/* Nonzero if generating code to run in a 64 bit environment. */
-#define MASK_ARCH64 0x10000
-#define TARGET_ARCH64 (target_flags & MASK_ARCH64)
-#define TARGET_ARCH32 (! TARGET_ARCH64)
-
-/* SPARC64 memory models.
- TARGET_MEDLOW: 32 bit address space, top 32 bits = 0,
- avoid generating %uhi and %ulo terms.
- (pointers can be 32 or 64 bits)
- TARGET_MEDANY: 64 bit address space, data segment restricted to 4G, but
- can be loaded anywhere (use %g4 as offset).
- TARGET_FULLANY: 64 bit address space, no restrictions.
- This option is not fully supported yet.
- These options are for v9 only. All mask values are nonzero so the v8
- compiler can assume this stuff won't interfere. */
-#define MASK_MEDLOW 0x20000
-#define MASK_MEDANY 0x40000
-#define MASK_FULLANY 0x60000
-#define MASK_CODE_MODEL (MASK_MEDLOW + MASK_MEDANY)
-#define TARGET_MEDLOW ((target_flags & MASK_CODE_MODEL) == MASK_MEDLOW)
-#define TARGET_MEDANY ((target_flags & MASK_CODE_MODEL) == MASK_MEDANY)
-#define TARGET_FULLANY ((target_flags & MASK_CODE_MODEL) == MASK_FULLANY)
-
-/* ??? There are hardcoded references to this reg in the .md file. */
-#define MEDANY_BASE_REG "%g4"
-
-/* Non-zero means use a stack bias of 2047. Stack offsets are obtained by
- adding 2047 to %sp. This option is for v9 only and is the default. */
-#define MASK_STACK_BIAS 0x80000
-#define TARGET_STACK_BIAS (target_flags & MASK_STACK_BIAS)
-
-/* Non-zero means %g0 is a normal register.
- We still clobber it as necessary, but we can't rely on it always having
- a zero value.
- We don't bother to support this in true 64 bit mode. */
-#define MASK_LIVE_G0 0x100000
-#define TARGET_LIVE_G0 (target_flags & MASK_LIVE_G0)
-
-/* Non-zero means the cpu has broken `save' and `restore' insns, only
- the trivial versions work (save %g0,%g0,%g0; restore %g0,%g0,%g0).
- We assume the environment will properly handle or otherwise avoid
- trouble associated with an interrupt occuring after the `save' or trap
- occuring during it. */
-#define MASK_BROKEN_SAVERESTORE 0x200000
-#define TARGET_BROKEN_SAVERESTORE (target_flags & MASK_BROKEN_SAVERESTORE)
-
-/* Non-zero means -m{,no-}fpu was passed on the command line. */
-#define MASK_FPU_SET 0x400000
-#define TARGET_FPU_SET (target_flags & MASK_FPU_SET)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { {"fpu", MASK_FPU | MASK_FPU_SET}, \
- {"no-fpu", -MASK_FPU}, \
- {"no-fpu", MASK_FPU_SET}, \
- {"hard-float", MASK_FPU | MASK_FPU_SET}, \
- {"soft-float", -MASK_FPU}, \
- {"soft-float", MASK_FPU_SET}, \
- {"epilogue", MASK_EPILOGUE}, \
- {"no-epilogue", -MASK_EPILOGUE}, \
- {"unaligned-doubles", MASK_UNALIGNED_DOUBLES}, \
- {"no-unaligned-doubles", -MASK_UNALIGNED_DOUBLES}, \
- {"impure-text", MASK_IMPURE_TEXT}, \
- {"no-impure-text", -MASK_IMPURE_TEXT}, \
- {"flat", MASK_FLAT}, \
- {"no-flat", -MASK_FLAT}, \
- {"app-regs", MASK_APP_REGS}, \
- {"no-app-regs", -MASK_APP_REGS}, \
- {"hard-quad-float", MASK_HARD_QUAD}, \
- {"soft-quad-float", -MASK_HARD_QUAD}, \
- /* ??? These are coerced to -mcpu=. Delete in 2.9. */ \
- {"cypress", 0}, \
- {"sparclite", 0}, \
- {"f930", 0}, \
- {"f934", 0}, \
- {"v8", 0}, \
- {"supersparc", 0}, \
- SUBTARGET_SWITCHES \
- ARCH64_SWITCHES \
- { "", TARGET_DEFAULT}}
-
-/* MASK_APP_REGS must always be the default because that's what
- FIXED_REGISTERS is set to and -ffixed- is processed before
- CONDITIONAL_REGISTER_USAGE is called (where we process -mno-app-regs). */
-#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
-
-/* This is meant to be redefined in target specific files. */
-#define SUBTARGET_SWITCHES
-
-/* ??? Until we support a combination 32/64 bit compiler, these options
- are only defined for the v9 compiler in a true 64 bit environment. */
-#if SPARC_ARCH64
-#define ARCH64_SWITCHES \
-/* {"arch32", -MASK_ARCH64}, */ \
-/* {"arch64", MASK_ARCH64}, */ \
- {"int64", MASK_INT64+MASK_LONG64}, \
- {"int32", -MASK_INT64}, \
- {"int32", MASK_LONG64}, \
- {"long64", -MASK_INT64}, \
- {"long64", MASK_LONG64}, \
- {"long32", -(MASK_INT64+MASK_LONG64)}, \
-/* {"ptr64", MASK_PTR64}, */ \
-/* {"ptr32", -MASK_PTR64}, */ \
- {"stack-bias", MASK_STACK_BIAS}, \
- {"no-stack-bias", -MASK_STACK_BIAS}, \
- {"medlow", -MASK_CODE_MODEL}, \
- {"medlow", MASK_MEDLOW}, \
- {"medany", -MASK_CODE_MODEL}, \
- {"medany", MASK_MEDANY}, \
- {"fullany", -MASK_CODE_MODEL}, \
- {"fullany", MASK_FULLANY},
-#else
-#define ARCH64_SWITCHES
-#endif
-
-/* Processor type.
- These must match the values for the cpu attribute in sparc.md. */
-enum processor_type {
- PROCESSOR_V7,
- PROCESSOR_CYPRESS,
- PROCESSOR_V8,
- PROCESSOR_SUPERSPARC,
- PROCESSOR_SPARCLITE,
- PROCESSOR_F930,
- PROCESSOR_F934,
- PROCESSOR_SPARCLET,
- PROCESSOR_TSC701,
- PROCESSOR_V8PLUS,
- PROCESSOR_V9,
- PROCESSOR_ULTRASPARC
-};
-
-/* This is set from -m{cpu,tune}=xxx. */
-extern enum processor_type sparc_cpu;
-
-/* Recast the cpu class to be the cpu attribute.
- Every file includes us, but not every file includes insn-attr.h. */
-#define sparc_cpu_attr ((enum attr_cpu) sparc_cpu)
-
-/* This macro is similar to `TARGET_SWITCHES' but defines names of
- command options that have values. Its definition is an
- initializer with a subgrouping for each command option.
-
- Each subgrouping contains a string constant, that defines the
- fixed part of the option name, and the address of a variable.
- The variable, type `char *', is set to the variable part of the
- given option if the fixed part matches. The actual option name
- is made by appending `-m' to the specified name.
-
- Here is an example which defines `-mshort-data-NUMBER'. If the
- given option is `-mshort-data-512', the variable `m88k_short_data'
- will be set to the string `"512"'.
-
- extern char *m88k_short_data;
- #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */
-
-#define TARGET_OPTIONS \
-{ \
- {"cpu=", &sparc_select[1].string}, \
- {"tune=", &sparc_select[2].string}, \
- SUBTARGET_OPTIONS \
-}
-
-/* This is meant to be redefined in target specific files. */
-#define SUBTARGET_OPTIONS
-
-/* sparc_select[0] is reserved for the default cpu. */
-struct sparc_cpu_select
-{
- char *string;
- char *name;
- int set_tune_p;
- int set_arch_p;
-};
-
-extern struct sparc_cpu_select sparc_select[];
-
-/* target machine storage layout */
-
-/* Define for cross-compilation to a sparc target with no TFmode from a host
- with a different float format (e.g. VAX). */
-#define REAL_ARITHMETIC
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-#define BITS_BIG_ENDIAN 1
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-#define WORDS_BIG_ENDIAN 1
-
-/* Define this to set the endianness to use in libgcc2.c, which can
- not depend on target_flags. */
-#if defined (__LITTLE_ENDIAN__)
-#define LIBGCC2_WORDS_BIG_ENDIAN 0
-#else
-#define LIBGCC2_WORDS_BIG_ENDIAN 1
-#endif
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD (TARGET_ARCH64 ? 64 : 32)
-#define MAX_BITS_PER_WORD 64
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD (TARGET_ARCH64 ? 8 : 4)
-#define MIN_UNITS_PER_WORD 4
-
-/* Now define the sizes of the C data types. */
-
-#define SHORT_TYPE_SIZE 16
-#define INT_TYPE_SIZE (TARGET_INT64 ? 64 : 32)
-#define LONG_TYPE_SIZE (TARGET_LONG64 ? 64 : 32)
-#define LONG_LONG_TYPE_SIZE 64
-#define FLOAT_TYPE_SIZE 32
-#define DOUBLE_TYPE_SIZE 64
-
-#define MAX_INT_TYPE_SIZE 64
-#define MAX_LONG_TYPE_SIZE 64
-
-#if SPARC_ARCH64
-/* ??? This does not work in SunOS 4.x, so it is not enabled here.
- Instead, it is enabled in sol2.h, because it does work under Solaris. */
-/* Define for support of TFmode long double and REAL_ARITHMETIC.
- Sparc ABI says that long double is 4 words. */
-#define LONG_DOUBLE_TYPE_SIZE 128
-#endif
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE (TARGET_PTR64 ? 64 : 32)
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY (TARGET_ARCH64 ? 64 : 32)
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY (TARGET_ARCH64 ? 128 : 64)
-
-/* ALIGN FRAMES on double word boundaries */
-
-#define SPARC_STACK_ALIGN(LOC) \
- (TARGET_ARCH64 ? (((LOC)+15) & ~15) : (((LOC)+7) & ~7))
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-/* ??? Should this be based on TARGET_INT64? */
-#define EMPTY_FIELD_BOUNDARY (TARGET_ARCH64 ? 64 : 32)
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64)
-
-/* The best alignment to use in cases where we have a choice. */
-#define FASTEST_ALIGNMENT 64
-
-/* Make strings word-aligned so strcpy from constants will be faster. */
-#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
- ((TREE_CODE (EXP) == STRING_CST \
- && (ALIGN) < FASTEST_ALIGNMENT) \
- ? FASTEST_ALIGNMENT : (ALIGN))
-
-/* Make arrays of chars word-aligned for the same reasons. */
-#define DATA_ALIGNMENT(TYPE, ALIGN) \
- (TREE_CODE (TYPE) == ARRAY_TYPE \
- && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
- && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN))
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Things that must be doubleword aligned cannot go in the text section,
- because the linker fails to align the text section enough!
- Put them in the data section. This macro is only used in this file. */
-#define MAX_TEXT_ALIGN 32
-
-/* This forces all variables and constants to the data section when PIC.
- This is because the SunOS 4 shared library scheme thinks everything in
- text is a function, and patches the address to point to a loader stub. */
-/* This is defined to zero for every system which doesn't use the a.out object
- file format. */
-#ifndef SUNOS4_SHARED_LIBRARIES
-#define SUNOS4_SHARED_LIBRARIES 0
-#endif
-
-/* This is defined differently for v9 in a cover file. */
-#define SELECT_SECTION(T,RELOC) \
-{ \
- if (TREE_CODE (T) == VAR_DECL) \
- { \
- if (TREE_READONLY (T) && ! TREE_SIDE_EFFECTS (T) \
- && DECL_INITIAL (T) \
- && (DECL_INITIAL (T) == error_mark_node \
- || TREE_CONSTANT (DECL_INITIAL (T))) \
- && DECL_ALIGN (T) <= MAX_TEXT_ALIGN \
- && ! (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES))) \
- text_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (T) == CONSTRUCTOR) \
- { \
- if (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES)) \
- data_section (); \
- } \
- else if (TREE_CODE_CLASS (TREE_CODE (T)) == 'c') \
- { \
- if ((TREE_CODE (T) == STRING_CST && flag_writable_strings) \
- || TYPE_ALIGN (TREE_TYPE (T)) > MAX_TEXT_ALIGN \
- || (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES))) \
- data_section (); \
- else \
- text_section (); \
- } \
-}
-
-/* Use text section for a constant
- unless we need more alignment than that offers. */
-/* This is defined differently for v9 in a cover file. */
-#define SELECT_RTX_SECTION(MODE, X) \
-{ \
- if (GET_MODE_BITSIZE (MODE) <= MAX_TEXT_ALIGN \
- && ! (flag_pic && (symbolic_operand (X) || SUNOS4_SHARED_LIBRARIES))) \
- text_section (); \
- else \
- data_section (); \
-}
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- SPARC has 32 integer registers and 32 floating point registers.
- 64 bit SPARC has 32 additional fp regs, but the odd numbered ones are not
- accessible. We still account for them to simplify register computations
- (eg: in CLASS_MAX_NREGS). There are also 4 fp condition code registers, so
- 32+32+32+4 == 100.
- Register 100 is used as the integer condition code register. */
-
-#define FIRST_PSEUDO_REGISTER 101
-
-/* Additional V9 fp regs. */
-#define SPARC_FIRST_V9_FP_REG 64
-#define SPARC_LAST_V9_FP_REG 95
-/* V9 %fcc[0123]. V8 uses (figuratively) %fcc0. */
-#define SPARC_FIRST_V9_FCC_REG 96
-#define SPARC_LAST_V9_FCC_REG 99
-/* V8 fcc reg. */
-#define SPARC_FCC_REG 96
-/* Integer CC reg. We don't distinguish %icc from %xcc. */
-#define SPARC_ICC_REG 100
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On non-v9 systems:
- g1 is free to use as temporary.
- g2-g4 are reserved for applications. Gcc normally uses them as
- temporaries, but this can be disabled via the -mno-app-regs option.
- g5 through g7 are reserved for the operating system.
- On v9 systems:
- g1 and g5 are free to use as temporaries.
- g2-g4 are reserved for applications. Gcc normally uses them as
- temporaries, but this can be disabled via the -mno-app-regs option.
- g6-g7 are reserved for the operating system.
- ??? Register 1 is used as a temporary by the 64 bit sethi pattern, so must
- currently be a fixed register until this pattern is rewritten.
- Register 1 is also used when restoring call-preserved registers in large
- stack frames.
-
- Registers fixed in arch32 and not arch64 (or vice-versa) are marked in
- CONDITIONAL_REGISTER_USAGE in order to properly handle -ffixed-.
-*/
-
-#define FIXED_REGISTERS \
- {1, 0, 0, 0, 0, 0, 1, 1, \
- 0, 0, 0, 0, 0, 0, 1, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 1, 1, \
- \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- \
- 0, 0, 0, 0, 0}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 1, 1, \
- \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- \
- 1, 1, 1, 1, 1}
-
-/* If !TARGET_FPU, then make the fp registers and fp cc regs fixed so that
- they won't be allocated. */
-
-#define CONDITIONAL_REGISTER_USAGE \
-do \
- { \
- if (! SPARC_ARCH64) \
- { \
- fixed_regs[5] = 1; \
- } \
- if (SPARC_ARCH64) \
- { \
- int regno; \
- fixed_regs[1] = 1; \
- /* ??? We need to scan argv for -fcall-used-. */ \
- for (regno = 48; regno < 80; regno++) \
- call_used_regs[regno] = 0; \
- } \
- if (! TARGET_V9) \
- { \
- int regno; \
- for (regno = SPARC_FIRST_V9_FP_REG; \
- regno <= SPARC_LAST_V9_FP_REG; \
- regno++) \
- fixed_regs[regno] = 1; \
- /* %fcc0 is used by v8 and v9. */ \
- for (regno = SPARC_FIRST_V9_FCC_REG + 1; \
- regno <= SPARC_LAST_V9_FCC_REG; \
- regno++) \
- fixed_regs[regno] = 1; \
- } \
- if (! TARGET_FPU) \
- { \
- int regno; \
- for (regno = 32; regno < SPARC_LAST_V9_FCC_REG; regno++) \
- fixed_regs[regno] = 1; \
- } \
- /* Don't unfix g2-g4 if they were fixed with -ffixed-. */ \
- fixed_regs[2] |= ! TARGET_APP_REGS; \
- fixed_regs[3] |= ! TARGET_APP_REGS; \
- fixed_regs[4] |= ! TARGET_APP_REGS || TARGET_MEDANY; \
- if (TARGET_FLAT) \
- { \
- /* Let the compiler believe the frame pointer is still \
- %fp, but output it as %i7. */ \
- fixed_regs[31] = 1; \
- reg_names[FRAME_POINTER_REGNUM] = "%i7"; \
- /* ??? This is a hack to disable leaf functions. */ \
- global_regs[7] = 1; \
- } \
- if (profile_block_flag) \
- { \
- /* %g1 and %g2 must be fixed, because BLOCK_PROFILER \
- uses them. */ \
- fixed_regs[1] = 1; \
- fixed_regs[2] = 1; \
- } \
- } \
-while (0)
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On SPARC, ordinary registers hold 32 bits worth;
- this means both integer and floating point registers.
- On v9, integer regs hold 64 bits worth; floating point regs hold
- 32 bits worth (this includes the new fp regs as even the odd ones are
- included in the hard register count). */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (TARGET_ARCH64 \
- ? ((REGNO) < 32 \
- ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD \
- : (GET_MODE_SIZE (MODE) + 3) / 4) \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- See sparc.c for how we initialize this. */
-extern int *hard_regno_mode_classes;
-extern int sparc_mode_class[];
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((hard_regno_mode_classes[REGNO] & sparc_mode_class[MODE]) != 0)
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output.
-
- For V9: SFmode can't be combined with other float modes, because they can't
- be allocated to the %d registers. Also, DFmode won't fit in odd %f
- registers, but SFmode will. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- ((MODE1) == (MODE2) \
- || (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2) \
- && (! TARGET_V9 \
- || (GET_MODE_CLASS (MODE1) != MODE_FLOAT \
- || (MODE1 != SFmode && MODE2 != SFmode)))))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* SPARC pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 14
-
-/* Actual top-of-stack address is 92/136 greater than the contents of the
- stack pointer register for !v9/v9. That is:
- - !v9: 64 bytes for the in and local registers, 4 bytes for structure return
- address, and 24 bytes for the 6 register parameters.
- - v9: 128 bytes for the in and local registers + 8 bytes reserved. */
-#define STACK_POINTER_OFFSET FIRST_PARM_OFFSET(0)
-
-/* The stack bias (amount by which the hardware register is offset by). */
-#define SPARC_STACK_BIAS (TARGET_STACK_BIAS ? 2047 : 0)
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 30
-
-#if 0
-/* Register that is used for the return address for the flat model. */
-#define RETURN_ADDR_REGNUM 15
-#endif
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c.
- Used in flow.c, global.c, and reload1.c.
-
- Being a non-leaf function does not mean a frame pointer is needed in the
- flat window model. However, the debugger won't be able to backtrace through
- us with out it. */
-#define FRAME_POINTER_REQUIRED \
- (TARGET_FLAT ? (current_function_calls_alloca || current_function_varargs \
- || !leaf_function_p ()) \
- : ! (leaf_function_p () && only_leaf_regs_used ()))
-
-/* C statement to store the difference between the frame pointer
- and the stack pointer values immediately after the function prologue.
-
- Note, we always pretend that this is a leaf function because if
- it's not, there's no point in trying to eliminate the
- frame pointer. If it is a leaf function, we guessed right! */
-#define INITIAL_FRAME_POINTER_OFFSET(VAR) \
- ((VAR) = (TARGET_FLAT ? sparc_flat_compute_frame_size (get_frame_size ()) \
- : compute_frame_size (get_frame_size (), 1)))
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
-
-/* Register in which static-chain is passed to a function. This must
- not be a register used by the prologue. */
-#define STATIC_CHAIN_REGNUM (TARGET_ARCH64 ? 5 : 2)
-
-/* Register which holds offset table for position-independent
- data references. */
-
-#define PIC_OFFSET_TABLE_REGNUM 23
-
-#define INITIALIZE_PIC initialize_pic ()
-#define FINALIZE_PIC finalize_pic ()
-
-/* Sparc ABI says that quad-precision floats and all structures are returned
- in memory.
- For v9, all aggregates are returned in memory. */
-#define RETURN_IN_MEMORY(TYPE) \
- (TYPE_MODE (TYPE) == BLKmode \
- || (! TARGET_ARCH64 && (TYPE_MODE (TYPE) == TFmode \
- || TYPE_MODE (TYPE) == TCmode)))
-
-/* Functions which return large structures get the address
- to place the wanted value at offset 64 from the frame.
- Must reserve 64 bytes for the in and local registers.
- v9: Functions which return large structures get the address to place the
- wanted value from an invisible first argument. */
-/* Used only in other #defines in this file. */
-#define STRUCT_VALUE_OFFSET 64
-
-#define STRUCT_VALUE \
- (TARGET_ARCH64 \
- ? 0 \
- : gen_rtx (MEM, Pmode, \
- gen_rtx (PLUS, Pmode, stack_pointer_rtx, \
- gen_rtx (CONST_INT, VOIDmode, STRUCT_VALUE_OFFSET))))
-#define STRUCT_VALUE_INCOMING \
- (TARGET_ARCH64 \
- ? 0 \
- : gen_rtx (MEM, Pmode, \
- gen_rtx (PLUS, Pmode, frame_pointer_rtx, \
- gen_rtx (CONST_INT, VOIDmode, STRUCT_VALUE_OFFSET))))
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The SPARC has two kinds of registers, general and floating point.
-
- For v9 we must distinguish between the upper and lower floating point
- registers because the upper ones can't hold SFmode values.
- HARD_REGNO_MODE_OK won't help here because reload assumes that register(s)
- satisfying a group need for a class will also satisfy a single need for
- that class. EXTRA_FP_REGS is a bit of a misnomer as it covers all 64 fp
- regs.
-
- It is important that one class contains all the general and all the standard
- fp regs. Otherwise find_reg() won't properly allocate int regs for moves,
- because reg_class_record() will bias the selection in favor of fp regs,
- because reg_class_subunion[GENERAL_REGS][FP_REGS] will yield FP_REGS,
- because FP_REGS > GENERAL_REGS.
-
- It is also important that one class contain all the general and all the
- fp regs. Otherwise when spilling a DFmode reg, it may be from EXTRA_FP_REGS
- but find_reloads() may use class GENERAL_OR_FP_REGS. This will cause
- allocate_reload_reg() to bypass it causing an abort because the compiler
- thinks it doesn't have a spill reg when in fact it does.
-
- v9 also has 4 floating point condition code registers. Since we don't
- have a class that is the union of FPCC_REGS with either of the others,
- it is important that it appear first. Otherwise the compiler will die
- trying to compile _fixunsdfsi because fix_truncdfsi2 won't match its
- constraints.
-
- It is important that SPARC_ICC_REG have class NO_REGS. Otherwise combine
- may try to use it to hold an SImode value. See register_operand.
- ??? Should %fcc[0123] be handled similarily?
-*/
-
-enum reg_class { NO_REGS, FPCC_REGS, GENERAL_REGS, FP_REGS, EXTRA_FP_REGS,
- GENERAL_OR_FP_REGS, GENERAL_OR_EXTRA_FP_REGS,
- ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- { "NO_REGS", "FPCC_REGS", "GENERAL_REGS", "FP_REGS", "EXTRA_FP_REGS", \
- "GENERAL_OR_FP_REGS", "GENERAL_OR_EXTRA_FP_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
- {{0, 0, 0, 0}, {0, 0, 0, 0xf}, \
- {-1, 0, 0, 0}, {0, -1, 0, 0}, {0, -1, -1, 0}, \
- {-1, -1, 0, 0}, {-1, -1, -1, 0}, {-1, -1, -1, 0x1f}}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-extern enum reg_class sparc_regno_reg_class[];
-
-#define REGNO_REG_CLASS(REGNO) sparc_regno_reg_class[(REGNO)]
-
-/* This is the order in which to allocate registers normally.
-
- We put %f0/%f1 last among the float registers, so as to make it more
- likely that a pseudo-register which dies in the float return register
- will get allocated to the float return register, thus saving a move
- instruction at the end of the function.
-
- The float registers are ordered a little "funny" because in the 64 bit
- architecture, some of them (%f16-%f47) are call-preserved. */
-
-#define REG_ALLOC_ORDER \
-{ 8, 9, 10, 11, 12, 13, 2, 3, \
- 15, 16, 17, 18, 19, 20, 21, 22, \
- 23, 24, 25, 26, 27, 28, 29, 31, \
- 34, 35, 36, 37, 38, 39, /* %f2-%f7 */ \
- 40, 41, 42, 43, 44, 45, 46, 47, /* %f8-%f15 */ \
- 80, 81, 82, 83, 84, 85, 86, 87, /* %f48-%f55 */ \
- 88, 89, 90, 91, 92, 93, 94, 95, /* %f56-%f63 */ \
- 48, 49, 50, 51, 52, 53, 54, 55, /* %f16-%f23 */ \
- 56, 57, 58, 59, 60, 61, 62, 63, /* %f24-%f31 */ \
- 64, 65, 66, 67, 68, 69, 70, 71, /* %f32-%f39 */ \
- 72, 73, 74, 75, 76, 77, 78, 79, /* %f40-%f47 */ \
- 32, 33, /* %f0,%f1 */ \
- 96, 97, 98, 99, 100, /* %fcc0-3, %icc */ \
- 1, 4, 5, 6, 7, 0, 14, 30}
-
-/* This is the order in which to allocate registers for
- leaf functions. If all registers can fit in the "i" registers,
- then we have the possibility of having a leaf function.
- The floating point registers are ordered a little "funny" because in the
- 64 bit architecture some of them (%f16-%f47) are call-preserved. */
-
-#define REG_LEAF_ALLOC_ORDER \
-{ 2, 3, 24, 25, 26, 27, 28, 29, \
- 15, 8, 9, 10, 11, 12, 13, \
- 16, 17, 18, 19, 20, 21, 22, 23, \
- 34, 35, 36, 37, 38, 39, \
- 40, 41, 42, 43, 44, 45, 46, 47, \
- 80, 81, 82, 83, 84, 85, 86, 87, \
- 88, 89, 90, 91, 92, 93, 94, 95, \
- 48, 49, 50, 51, 52, 53, 54, 55, \
- 56, 57, 58, 59, 60, 61, 62, 63, \
- 64, 65, 66, 67, 68, 69, 70, 71, \
- 72, 73, 74, 75, 76, 77, 78, 79, \
- 32, 33, \
- 96, 97, 98, 99, 100, \
- 1, 4, 5, 6, 7, 0, 14, 30, 31}
-
-#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
-
-/* ??? %g7 is not a leaf register to effectively #undef LEAF_REGISTERS when
- -mflat is used. Function only_leaf_regs_used will return 0 if a global
- register is used and is not permitted in a leaf function. We make %g7
- a global reg if -mflat and voila. Since %g7 is a system register and is
- fixed it won't be used by gcc anyway. */
-
-#define LEAF_REGISTERS \
-{ 1, 1, 1, 1, 1, 1, 1, 0, \
- 0, 0, 0, 0, 0, 0, 1, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 0, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1}
-
-extern char leaf_reg_remap[];
-#define LEAF_REG_REMAP(REGNO) (leaf_reg_remap[REGNO])
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Local macro to handle the two v9 classes of FP regs. */
-#define FP_REG_CLASS_P(CLASS) ((CLASS) == FP_REGS || (CLASS) == EXTRA_FP_REGS)
-
-/* Get reg_class from a letter such as appears in the machine description.
- In the not-v9 case, coerce v9's 'e' class to 'f', so we can use 'e' in the
- .md file for v8 and v9. */
-
-#define REG_CLASS_FROM_LETTER(C) \
-(TARGET_V9 \
- ? ((C) == 'f' ? FP_REGS \
- : (C) == 'e' ? EXTRA_FP_REGS \
- : (C) == 'c' ? FPCC_REGS \
- : NO_REGS) \
- : ((C) == 'f' ? FP_REGS \
- : (C) == 'e' ? FP_REGS \
- : (C) == 'c' ? FPCC_REGS \
- : NO_REGS))
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- `I' is used for the range of constants an insn can actually contain.
- `J' is used for the range which is just zero (since that is R0).
- `K' is used for constants which can be loaded with a single sethi insn.
- `L' is used for the range of constants supported by the movcc insns.
- `M' is used for the range of constants supported by the movrcc insns. */
-
-#define SPARC_SIMM10_P(X) ((unsigned HOST_WIDE_INT) ((X) + 0x200) < 0x400)
-#define SPARC_SIMM11_P(X) ((unsigned HOST_WIDE_INT) ((X) + 0x400) < 0x800)
-#define SPARC_SIMM13_P(X) ((unsigned HOST_WIDE_INT) ((X) + 0x1000) < 0x2000)
-/* 10 and 11 bit immediates are only used for a few specific insns.
- SMALL_INT is used throughout the port so we continue to use it. */
-#define SMALL_INT(X) (SPARC_SIMM13_P (INTVAL (X)))
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? SPARC_SIMM13_P (VALUE) \
- : (C) == 'J' ? (VALUE) == 0 \
- : (C) == 'K' ? ((VALUE) & 0x3ff) == 0 \
- : (C) == 'L' ? SPARC_SIMM11_P (VALUE) \
- : (C) == 'M' ? SPARC_SIMM10_P (VALUE) \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? fp_zero_operand (VALUE) \
- : (C) == 'H' ? arith_double_operand (VALUE, DImode) \
- : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-/* We can't load constants into FP registers. We can't load any FP constant
- if an 'E' constraint fails to match it. */
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- (CONSTANT_P (X) \
- && (FP_REG_CLASS_P (CLASS) \
- || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- && (HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT \
- || HOST_BITS_PER_INT != BITS_PER_WORD))) \
- ? NO_REGS : (CLASS))
-
-/* Return the register class of a scratch register needed to load IN into
- a register of class CLASS in MODE.
-
- On the SPARC, when PIC, we need a temporary when loading some addresses
- into a register.
-
- Also, we need a temporary when loading/storing a HImode/QImode value
- between memory and the FPU registers. This can happen when combine puts
- a paradoxical subreg in a float/fix conversion insn. */
-
-#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN) \
- ((FP_REG_CLASS_P (CLASS) && ((MODE) == HImode || (MODE) == QImode) \
- && (GET_CODE (IN) == MEM \
- || ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG) \
- && true_regnum (IN) == -1))) ? GENERAL_REGS : NO_REGS)
-
-#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, IN) \
- ((FP_REG_CLASS_P (CLASS) && ((MODE) == HImode || (MODE) == QImode) \
- && (GET_CODE (IN) == MEM \
- || ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG) \
- && true_regnum (IN) == -1))) ? GENERAL_REGS : NO_REGS)
-
-/* On SPARC it is not possible to directly move data between
- GENERAL_REGS and FP_REGS. */
-#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
- (FP_REG_CLASS_P (CLASS1) != FP_REG_CLASS_P (CLASS2))
-
-/* Return the stack location to use for secondary memory needed reloads.
- We want to use the reserved location just below the frame pointer.
- However, we must ensure that there is a frame, so use assign_stack_local
- if the frame size is zero. */
-#define SECONDARY_MEMORY_NEEDED_RTX(MODE) \
- (get_frame_size () == 0 \
- ? assign_stack_local (MODE, GET_MODE_SIZE (MODE), 0) \
- : gen_rtx (MEM, MODE, gen_rtx (PLUS, Pmode, frame_pointer_rtx, \
- GEN_INT (STARTING_FRAME_OFFSET))))
-
-/* Get_secondary_mem widens it's argument to BITS_PER_WORD which loses on v9
- because the movsi and movsf patterns don't handle r/f moves.
- For v8 we copy the default definition. */
-#define SECONDARY_MEMORY_NEEDED_MODE(MODE) \
- (TARGET_ARCH64 \
- ? (GET_MODE_BITSIZE (MODE) < 32 \
- ? mode_for_size (32, GET_MODE_CLASS (MODE), 0) \
- : MODE) \
- : (GET_MODE_BITSIZE (MODE) < BITS_PER_WORD \
- ? mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0) \
- : MODE))
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On SPARC, this is the size of MODE in words. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- (FP_REG_CLASS_P (CLASS) ? (GET_MODE_SIZE (MODE) + 3) / 4 \
- : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define the number of register that can hold parameters.
- These two macros are used only in other macro definitions below.
- MODE is the mode of the argument.
- !v9: All args are passed in %o0-%o5.
- v9: Non-float args are passed in %o0-5 and float args are passed in
- %f0-%f15. */
-#define NPARM_REGS(MODE) \
- (TARGET_ARCH64 ? (GET_MODE_CLASS (MODE) == MODE_FLOAT ? 16 : 6) : 6)
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-/* This allows space for one TFmode floating point value. */
-#define STARTING_FRAME_OFFSET \
- (TARGET_ARCH64 ? (SPARC_STACK_BIAS - 16) \
- : (-SPARC_STACK_ALIGN (LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)))
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On SPARC, don't define this because there are no push insns. */
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* Offset of first parameter from the argument pointer register value.
- !v9: This is 64 for the ins and locals, plus 4 for the struct-return reg
- even if this function isn't going to use it.
- v9: This is 128 for the ins and locals, plus a reserved space of 8. */
-#define FIRST_PARM_OFFSET(FNDECL) \
- (TARGET_ARCH64 ? (SPARC_STACK_BIAS + 136) \
- : (STRUCT_VALUE_OFFSET + UNITS_PER_WORD))
-
-/* When a parameter is passed in a register, stack space is still
- allocated for it. */
-#if ! SPARC_ARCH64
-#define REG_PARM_STACK_SPACE(DECL) (NPARM_REGS (SImode) * UNITS_PER_WORD)
-#endif
-
-/* Keep the stack pointer constant throughout the function.
- This is both an optimization and a necessity: longjmp
- doesn't behave itself when the stack pointer moves within
- the function! */
-#define ACCUMULATE_OUTGOING_ARGS
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Some subroutine macros specific to this machine.
- When !TARGET_FPU, put float return values in the general registers,
- since we don't have any fp registers. */
-#define BASE_RETURN_VALUE_REG(MODE) \
- (TARGET_ARCH64 \
- ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 8) \
- : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32 : 8))
-#define BASE_OUTGOING_VALUE_REG(MODE) \
- (TARGET_ARCH64 \
- ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 \
- : TARGET_FLAT ? 8 : 24) \
- : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32 \
- : (TARGET_FLAT ? 8 : 24)))
-#define BASE_PASSING_ARG_REG(MODE) \
- (TARGET_ARCH64 \
- ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 8) \
- : 8)
-#define BASE_INCOMING_ARG_REG(MODE) \
- (TARGET_ARCH64 \
- ? (TARGET_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 \
- : TARGET_FLAT ? 8 : 24) \
- : (TARGET_FLAT ? 8 : 24))
-
-/* Define this macro if the target machine has "register windows". This
- C expression returns the register number as seen by the called function
- corresponding to register number OUT as seen by the calling function.
- Return OUT if register number OUT is not an outbound register. */
-
-#define INCOMING_REGNO(OUT) \
- ((TARGET_FLAT || (OUT) < 8 || (OUT) > 15) ? (OUT) : (OUT) + 16)
-
-/* Define this macro if the target machine has "register windows". This
- C expression returns the register number as seen by the calling function
- corresponding to register number IN as seen by the called function.
- Return IN if register number IN is not an inbound register. */
-
-#define OUTGOING_REGNO(IN) \
- ((TARGET_FLAT || (IN) < 24 || (IN) > 31) ? (IN) : (IN) - 16)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On SPARC the value is found in the first "output" register. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_RETURN_VALUE_REG (TYPE_MODE (VALTYPE)))
-
-/* But the called function leaves it in the first "input" register. */
-
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), BASE_OUTGOING_VALUE_REG (TYPE_MODE (VALTYPE)))
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx (REG, MODE, BASE_RETURN_VALUE_REG (MODE))
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller.
- On SPARC, the first "output" reg is used for integer values,
- and the first floating point register is used for floating point values. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 8 || (N) == 32)
-
-/* Define the size of space to allocate for the return value of an
- untyped_call. */
-
-#define APPLY_RESULT_SIZE 16
-
-/* 1 if N is a possible register number for function argument passing.
- On SPARC, these are the "output" registers. v9 also uses %f0-%f15. */
-
-#define FUNCTION_ARG_REGNO_P(N) \
- (TARGET_ARCH64 ? (((N) < 14 && (N) > 7) || (N) > 31 && (N) < 48) \
- : ((N) < 14 && (N) > 7))
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On SPARC (!v9), this is a single integer, which is a number of words
- of arguments scanned so far (including the invisible argument,
- if any, which holds the structure-value-address).
- Thus 7 or more means all following args should go on the stack.
-
- For v9, we record how many of each type has been passed. Different
- types get passed differently.
-
- - Float args are passed in %f0-15, after which they go to the stack
- where floats and doubles are passed 8 byte aligned and long doubles
- are passed 16 byte aligned.
- - All aggregates are passed by reference. The callee copies
- the structure if necessary, except if stdarg/varargs and the struct
- matches the ellipse in which case the caller makes a copy.
- - Any non-float argument might be split between memory and reg %o5.
- ??? I don't think this can ever happen now that structs are no
- longer passed in regs.
-
- For v9 return values:
-
- - For all aggregates, the caller allocates space for the return value,
- and passes the pointer as an implicit first argument, which is
- allocated like all other arguments.
- - The unimp instruction stuff for structure returns is gone. */
-
-#if SPARC_ARCH64
-enum sparc_arg_class { SPARC_ARG_INT = 0, SPARC_ARG_FLOAT = 1 };
-struct sparc_args {
- int arg_count[2]; /* must be int! (for __builtin_args_info) */
-};
-#define CUMULATIVE_ARGS struct sparc_args
-
-/* Return index into CUMULATIVE_ARGS. */
-
-#define GET_SPARC_ARG_CLASS(MODE) \
- (GET_MODE_CLASS (MODE) == MODE_FLOAT ? SPARC_ARG_FLOAT : SPARC_ARG_INT)
-
-/* Round a register number up to a proper boundary for an arg of mode MODE.
- This macro is only used in this file.
-
- The "& (0x10000 - ...)" is used to round up to the next appropriate reg. */
-
-#define ROUND_REG(CUM, MODE) \
- (GET_MODE_CLASS (MODE) != MODE_FLOAT \
- ? (CUM).arg_count[(int) GET_SPARC_ARG_CLASS (MODE)] \
- : ((CUM).arg_count[(int) GET_SPARC_ARG_CLASS (MODE)] \
- + GET_MODE_UNIT_SIZE (MODE) / 4 - 1) \
- & (0x10000 - GET_MODE_UNIT_SIZE (MODE) / 4))
-
-#define ROUND_ADVANCE(SIZE) \
- (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-#else /* ! SPARC_ARCH64 */
-
-#define CUMULATIVE_ARGS int
-
-#define ROUND_REG(CUM, MODE) (CUM)
-
-#define ROUND_ADVANCE(SIZE) \
- ((SIZE + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-#endif /* ! SPARC_ARCH64 */
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On SPARC, the offset always starts at 0: the first parm reg is always
- the same reg. */
-
-#if SPARC_ARCH64
-extern int sparc_arg_count,sparc_n_named_args;
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- do { \
- (CUM).arg_count[(int) SPARC_ARG_INT] = 0; \
- (CUM).arg_count[(int) SPARC_ARG_FLOAT] = 0; \
- sparc_arg_count = 0; \
- sparc_n_named_args = \
- ((FNTYPE) && TYPE_ARG_TYPES (FNTYPE) \
- ? (list_length (TYPE_ARG_TYPES (FNTYPE)) \
- + (TREE_CODE (TREE_TYPE (FNTYPE)) == RECORD_TYPE \
- || TREE_CODE (TREE_TYPE (FNTYPE)) == QUAL_UNION_TYPE\
- || TREE_CODE (TREE_TYPE (FNTYPE)) == SET_TYPE \
- || TREE_CODE (TREE_TYPE (FNTYPE)) == UNION_TYPE)) \
- /* Can't tell, treat 'em all as named. */ \
- : 10000); \
- } while (0)
-#else
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) ((CUM) = 0)
-#endif
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#if SPARC_ARCH64
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- do { \
- (CUM).arg_count[(int) GET_SPARC_ARG_CLASS (MODE)] = \
- ROUND_REG ((CUM), (MODE)) \
- + (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- ? GET_MODE_SIZE (MODE) / 4 \
- : ROUND_ADVANCE ((MODE) == BLKmode \
- ? GET_MODE_SIZE (Pmode) \
- : GET_MODE_SIZE (MODE))); \
- sparc_arg_count++; \
- } while (0)
-#else
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? ROUND_ADVANCE (GET_MODE_SIZE (MODE)) \
- : ROUND_ADVANCE (int_size_in_bytes (TYPE))))
-#endif
-
-/* Return boolean indicating arg of mode MODE will be passed in a reg.
- This macro is only used in this file. */
-
-#if SPARC_ARCH64
-#define PASS_IN_REG_P(CUM, MODE, TYPE) \
- (ROUND_REG ((CUM), (MODE)) < NPARM_REGS (MODE) \
- && ((TYPE)==0 || ! TREE_ADDRESSABLE ((tree)(TYPE))) \
- && ((TYPE)==0 || (MODE) != BLKmode))
-#else
-#define PASS_IN_REG_P(CUM, MODE, TYPE) \
- ((CUM) < NPARM_REGS (SImode) \
- && ((TYPE)==0 || ! TREE_ADDRESSABLE ((tree)(TYPE))) \
- && ((TYPE)==0 || (MODE) != BLKmode \
- || (TYPE_ALIGN (TYPE) % PARM_BOUNDARY == 0)))
-#endif
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On SPARC the first six args are normally in registers
- and the rest are pushed. Any arg that starts within the first 6 words
- is at least partially passed in a register unless its data type forbids.
- For v9, the first 6 int args are passed in regs and the first N
- float args are passed in regs (where N is such that %f0-15 are filled).
- The rest are pushed. Any arg that starts within the first 6 words
- is at least partially passed in a register unless its data type forbids. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
- (PASS_IN_REG_P ((CUM), (MODE), (TYPE)) \
- ? gen_rtx (REG, (MODE), \
- (BASE_PASSING_ARG_REG (MODE) + ROUND_REG ((CUM), (MODE))))\
- : 0)
-
-/* Define where a function finds its arguments.
- This is different from FUNCTION_ARG because of register windows. */
-
-#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
- (PASS_IN_REG_P ((CUM), (MODE), (TYPE)) \
- ? gen_rtx (REG, (MODE), \
- (BASE_INCOMING_ARG_REG (MODE) + ROUND_REG ((CUM), (MODE))))\
- : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero.
- Any arg that starts in the first 6 regs but won't entirely fit in them
- needs partial registers on the Sparc (!v9). On v9, there are no arguments
- that are passed partially in registers (??? complex values?). */
-
-#if ! SPARC_ARCH64
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
- (PASS_IN_REG_P ((CUM), (MODE), (TYPE)) \
- && ((CUM) + ((MODE) == BLKmode \
- ? ROUND_ADVANCE (int_size_in_bytes (TYPE)) \
- : ROUND_ADVANCE (GET_MODE_SIZE (MODE))) - NPARM_REGS (SImode) > 0)\
- ? (NPARM_REGS (SImode) - (CUM)) \
- : 0)
-#endif
-
-/* The SPARC ABI stipulates passing struct arguments (of any size) and
- (!v9) quad-precision floats by invisible reference.
- For Pascal, also pass arrays by reference. */
-#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
- ((TYPE && AGGREGATE_TYPE_P (TYPE)) \
- || (!TARGET_ARCH64 && MODE == TFmode))
-
-/* A C expression that indicates when it is the called function's
- responsibility to make copies of arguments passed by reference.
- If the callee can determine that the argument won't be modified, it can
- avoid the copy. */
-/* ??? We'd love to be able to use NAMED here. Unfortunately, it doesn't
- include the last named argument so we keep track of the args ourselves. */
-
-#if SPARC_ARCH64
-#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) \
- (sparc_arg_count < sparc_n_named_args)
-#endif
-
-/* Initialize data used by insn expanders. This is called from
- init_emit, once for each function, before code is generated.
- For v9, clear the temp slot used by float/int DImode conversions.
- ??? There is the 16 bytes at [%fp-16], however we'd like to delete this
- space at some point.
- ??? Use assign_stack_temp? */
-
-extern void sparc64_init_expanders ();
-extern struct rtx_def *sparc64_fpconv_stack_temp ();
-#if SPARC_ARCH64
-#define INIT_EXPANDERS sparc64_init_expanders ()
-#endif
-
-/* Define the information needed to generate branch and scc insns. This is
- stored from the compare operation. Note that we can't use "rtx" here
- since it hasn't been defined! */
-
-extern struct rtx_def *sparc_compare_op0, *sparc_compare_op1;
-
-/* Define the function that build the compare insn for scc and bcc. */
-
-extern struct rtx_def *gen_compare_reg ();
-
-/* This function handles all v9 scc insns */
-
-extern int gen_v9_scc ();
-
-/* Generate the special assembly code needed to tell the assembler whatever
- it might need to know about the return value of a function.
-
- For Sparc assemblers, we need to output a .proc pseudo-op which conveys
- information to the assembler relating to peephole optimization (done in
- the assembler). */
-
-#define ASM_DECLARE_RESULT(FILE, RESULT) \
- fprintf ((FILE), "\t.proc\t0%o\n", sparc_type_code (TREE_TYPE (RESULT)))
-
-/* Output the label for a function definition. */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
-do { \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- ASM_OUTPUT_LABEL (FILE, NAME); \
-} while (0)
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-/* On SPARC, move-double insns between fpu and cpu need an 8-byte block
- of memory. If any fpu reg is used in the function, we allocate
- such a block here, at the bottom of the frame, just in case it's needed.
-
- If this function is a leaf procedure, then we may choose not
- to do a "save" insn. The decision about whether or not
- to do this is made in regclass.c. */
-
-extern int leaf_function;
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
- (TARGET_FLAT ? sparc_flat_output_function_prologue (FILE, SIZE) \
- : output_function_prologue (FILE, SIZE, leaf_function))
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry.
-
- 32 bit sparc uses %g2 as the STATIC_CHAIN_REGNUM which gets clobbered
- during profiling so we need to save/restore it around the call to mcount.
- We're guaranteed that a save has just been done, and we use the space
- allocated for intreg/fpreg value passing. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- do { \
- char buf[20]; \
- ASM_GENERATE_INTERNAL_LABEL (buf, "LP", (LABELNO)); \
- if (! TARGET_ARCH64) \
- fputs ("\tst %g2,[%fp-4]\n", FILE); \
- fputs ("\tsethi %hi(", FILE); \
- assemble_name (FILE, buf); \
- fputs ("),%o0\n", FILE); \
- if (TARGET_MEDANY) \
- fprintf (FILE, "\tadd %o0,%s,%o0\n", MEDANY_BASE_REG); \
- fputs ("\tcall mcount\n\tadd %o0,%lo(", FILE); \
- assemble_name (FILE, buf); \
- fputs ("),%o0\n", FILE); \
- if (! TARGET_ARCH64) \
- fputs ("\tld [%fp-4],%g2\n", FILE); \
- } while (0)
-
-/* There are three profiling modes for basic blocks available.
- The modes are selected at compile time by using the options
- -a or -ax of the gnu compiler.
- The variable `profile_block_flag' will be set according to the
- selected option.
-
- profile_block_flag == 0, no option used:
-
- No profiling done.
-
- profile_block_flag == 1, -a option used.
-
- Count frequency of execution of every basic block.
-
- profile_block_flag == 2, -ax option used.
-
- Generate code to allow several different profiling modes at run time.
- Available modes are:
- Produce a trace of all basic blocks.
- Count frequency of jump instructions executed.
- In every mode it is possible to start profiling upon entering
- certain functions and to disable profiling of some other functions.
-
- The result of basic-block profiling will be written to a file `bb.out'.
- If the -ax option is used parameters for the profiling will be read
- from file `bb.in'.
-
-*/
-
-/* The following macro shall output assembler code to FILE
- to initialize basic-block profiling.
-
- If profile_block_flag == 2
-
- Output code to call the subroutine `__bb_init_trace_func'
- and pass two parameters to it. The first parameter is
- the address of a block allocated in the object module.
- The second parameter is the number of the first basic block
- of the function.
-
- The name of the block is a local symbol made with this statement:
-
- ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
-
- Of course, since you are writing the definition of
- `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
- can take a short cut in the definition of this macro and use the
- name that you know will result.
-
- The number of the first basic block of the function is
- passed to the macro in BLOCK_OR_LABEL.
-
- If described in a virtual assembler language the code to be
- output looks like:
-
- parameter1 <- LPBX0
- parameter2 <- BLOCK_OR_LABEL
- call __bb_init_trace_func
-
- else if profile_block_flag != 0
-
- Output code to call the subroutine `__bb_init_func'
- and pass one single parameter to it, which is the same
- as the first parameter to `__bb_init_trace_func'.
-
- The first word of this parameter is a flag which will be nonzero if
- the object module has already been initialized. So test this word
- first, and do not call `__bb_init_func' if the flag is nonzero.
- Note: When profile_block_flag == 2 the test need not be done
- but `__bb_init_trace_func' *must* be called.
-
- BLOCK_OR_LABEL may be used to generate a label number as a
- branch destination in case `__bb_init_func' will not be called.
-
- If described in a virtual assembler language the code to be
- output looks like:
-
- cmp (LPBX0),0
- jne local_label
- parameter1 <- LPBX0
- call __bb_init_func
-local_label:
-
-*/
-
-#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
-do \
- { \
- int bol = (BLOCK_OR_LABEL); \
- switch (profile_block_flag) \
- { \
- case 2: \
- if (TARGET_MEDANY) \
- fprintf (FILE, "\tsethi %%hi(LPBX0),%%o0\n\tor %%0,%%lo(LPBX0),%%o0\n\tadd %%o0,%s,%%o0\n\tsethi %%hi(%d),%%o1\n\tcall ___bb_init_trace_func\n\tadd %g0,%%lo(%d),%%o1\n",\
- MEDANY_BASE_REG, bol, bol); \
- else \
- fprintf (FILE, "\tsethi %%hi(LPBX0),%%o0\n\tor %%o0,%%lo(LPBX0),%%o0\n\tsethi %%hi(%d),%%o1\n\tcall ___bb_init_trace_func\n\tor %%o1,%%lo(%d),%%o1\n",\
- bol, bol); \
- break; \
- default: \
- if (TARGET_MEDANY) \
- fprintf (FILE, "\tsethi %%hi(LPBX0),%%o0\n\tor %%0,%%lo(LPBX0),%%o0\n\tld [%s+%%o0],%%o1\n\ttst %%o1\n\tbne LPY%d\n\tadd %%o0,%s,%%o0\n\tcall ___bb_init_func\n\tnop\nLPY%d:\n",\
- MEDANY_BASE_REG, bol, MEDANY_BASE_REG, bol);\
- else \
- fprintf (FILE, "\tsethi %%hi(LPBX0),%%o0\n\tld [%%lo(LPBX0)+%%o0],%%o1\n\ttst %%o1\n\tbne LPY%d\n\tadd %%o0,%%lo(LPBX0),%%o0\n\tcall ___bb_init_func\n\tnop\nLPY%d:\n",\
- bol, bol); \
- break; \
- } \
- } \
-while (0)
-
-/* The following macro shall output assembler code to FILE
- to increment a counter associated with basic block number BLOCKNO.
-
- If profile_block_flag == 2
-
- Output code to initialize the global structure `__bb' and
- call the function `__bb_trace_func' which will increment the
- counter.
-
- `__bb' consists of two words. In the first word the number
- of the basic block has to be stored. In the second word
- the address of a block allocated in the object module
- has to be stored.
-
- The basic block number is given by BLOCKNO.
-
- The address of the block is given by the label created with
-
- ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
-
- by FUNCTION_BLOCK_PROFILER.
-
- Of course, since you are writing the definition of
- `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
- can take a short cut in the definition of this macro and use the
- name that you know will result.
-
- If described in a virtual assembler language the code to be
- output looks like:
-
- move BLOCKNO -> (__bb)
- move LPBX0 -> (__bb+4)
- call __bb_trace_func
-
- Note that function `__bb_trace_func' must not change the
- machine state, especially the flag register. To grant
- this, you must output code to save and restore registers
- either in this macro or in the macros MACHINE_STATE_SAVE
- and MACHINE_STATE_RESTORE. The last two macros will be
- used in the function `__bb_trace_func', so you must make
- sure that the function prologue does not change any
- register prior to saving it with MACHINE_STATE_SAVE.
-
- else if profile_block_flag != 0
-
- Output code to increment the counter directly.
- Basic blocks are numbered separately from zero within each
- compiled object module. The count associated with block number
- BLOCKNO is at index BLOCKNO in an array of words; the name of
- this array is a local symbol made with this statement:
-
- ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
-
- Of course, since you are writing the definition of
- `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
- can take a short cut in the definition of this macro and use the
- name that you know will result.
-
- If described in a virtual assembler language, the code to be
- output looks like:
-
- inc (LPBX2+4*BLOCKNO)
-
-*/
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
-do \
- { \
- int blockn = (BLOCKNO); \
- switch (profile_block_flag) \
- { \
- case 2: \
- if (TARGET_MEDANY) \
- fprintf (FILE, "\tsethi %%hi(___bb),%%g1\n\tor %%0,%%lo(___bb),%%g1\n\tsethi %%hi(%d),%%g2\n\tor %%g2,%%lo(%d),%%g2\n\tst %%g2,[%s+%%g1]\n\tsethi %%hi(LPBX0),%%g2\n\tor %%0,%%lo(LPBX0),%%g2\n\tadd %%g2,%s,%%g2\n\tadd 4,%%g1,%%g1\n\tst %%g2,[%%g1+%%lo(___bb)]\n\tmov %%o7,%%g2\n\tcall ___bb_trace_func\n\tnop\n\tmov %%g2,%%o7\n",\
- blockn, blockn, MEDANY_BASE_REG, MEDANY_BASE_REG); \
- else \
- fprintf (FILE, "\tsethi %%hi(___bb),%%g1\n\tsethi %%hi(%d),%%g2\n\tor %%g2,%%lo(%d),%%g2\n\tst %%g2,[%%lo(___bb)+%%g1]\n\tsethi %%hi(LPBX0),%%g2\n\tor %%g2,%%lo(LPBX0),%%g2\n\tadd 4,%%g1,%%g1\n\tst %%g2,[%%lo(___bb)+%%g1]\n\tmov %%o7,%%g2\n\tcall ___bb_trace_func\n\tnop\n\tmov %%g2,%%o7\n",\
- blockn, blockn); \
- break; \
- default: \
- if (TARGET_MEDANY) \
- fprintf (FILE, "\tsethi %%hi(LPBX2+%d),%%g1\n\tor %%g1,%%lo(LPBX2+%d),%%g1\n\tld [%%g1+%s],%%g2\n\tadd %%g2,1,%%g2\n\tst %%g2,[%%g1+%s]\n", \
- 4 * blockn, 4 * blockn, MEDANY_BASE_REG, MEDANY_BASE_REG); \
- else \
- fprintf (FILE, "\tsethi %%hi(LPBX2+%d),%%g1\n\tld [%%lo(LPBX2+%d)+%%g1],%%g2\n\
-\tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(LPBX2+%d)+%%g1]\n", \
- 4 * blockn, 4 * blockn, 4 * blockn); \
- break; \
- } \
- } \
-while(0)
-
-/* The following macro shall output assembler code to FILE
- to indicate a return from function during basic-block profiling.
-
- If profiling_block_flag == 2:
-
- Output assembler code to call function `__bb_trace_ret'.
-
- Note that function `__bb_trace_ret' must not change the
- machine state, especially the flag register. To grant
- this, you must output code to save and restore registers
- either in this macro or in the macros MACHINE_STATE_SAVE_RET
- and MACHINE_STATE_RESTORE_RET. The last two macros will be
- used in the function `__bb_trace_ret', so you must make
- sure that the function prologue does not change any
- register prior to saving it with MACHINE_STATE_SAVE_RET.
-
- else if profiling_block_flag != 0:
-
- The macro will not be used, so it need not distinguish
- these cases.
-*/
-
-#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \
- fprintf (FILE, "\tcall ___bb_trace_ret\n\tnop\n" );
-
-/* The function `__bb_trace_func' is called in every basic block
- and is not allowed to change the machine state. Saving (restoring)
- the state can either be done in the BLOCK_PROFILER macro,
- before calling function (rsp. after returning from function)
- `__bb_trace_func', or it can be done inside the function by
- defining the macros:
-
- MACHINE_STATE_SAVE(ID)
- MACHINE_STATE_RESTORE(ID)
-
- In the latter case care must be taken, that the prologue code
- of function `__bb_trace_func' does not already change the
- state prior to saving it with MACHINE_STATE_SAVE.
-
- The parameter `ID' is a string identifying a unique macro use.
-
- On sparc it is sufficient to save the psw register to memory.
- Unfortunately the psw register can be read in supervisor mode only,
- so we read only the condition codes by using branch instructions
- and hope that this is enough. */
-
-#define MACHINE_STATE_SAVE(ID) \
- asm (" mov %g0,%l0");\
- asm (" be,a LFLGNZ" ID);\
- asm (" or %l0,4,%l0");\
- asm ("LFLGNZ" ID ": bcs,a LFLGNC" ID);\
- asm (" or %l0,1,%l0");\
- asm ("LFLGNC" ID ": bvs,a LFLGNV" ID);\
- asm (" or %l0,2,%l0");\
- asm ("LFLGNV" ID ": bneg,a LFLGNN" ID);\
- asm (" or %l0,8,%l0");\
- asm ("LFLGNN" ID ": sethi %hi(LFLAGS" ID "),%l1");\
- asm (" st %l0,[%l1+%lo(LFLAGS" ID ")]"); \
- asm (" st %g2,[%l1+%lo(LSAVRET" ID ")]");
-
-/* On sparc MACHINE_STATE_RESTORE restores the psw register from memory.
- The psw register can be written in supervisor mode only,
- which is true even for simple condition codes.
- We use some combination of instructions to produce the
- proper condition codes, but some flag combinations can not
- be generated in this way. If this happens an unimplemented
- instruction will be executed to abort the program. */
-
-#define MACHINE_STATE_RESTORE(ID) \
- asm (" sethi %hi(LFLGTAB" ID "),%l1");\
- asm (" ld [%l1+%lo(LFLGTAB" ID "-(LFLGTAB" ID "-LFLAGS" ID "))],%l0");\
- asm (" ld [%l1+%lo(LFLGTAB" ID "-(LFLGTAB" ID "-LSAVRET" ID "))],%g2");\
- asm (" sll %l0,2,%l0");\
- asm (" add %l0,%l1,%l0");\
- asm (" ld [%l0+%lo(LFLGTAB" ID ")],%l1");\
- asm (" jmp %l1");\
- asm (" nop");\
- asm (".data");\
- asm (" .align 4");\
- asm ("LFLAGS" ID ":");\
- asm (" .word 0");\
- asm ("LSAVRET" ID ":");\
- asm (" .word 0");\
- asm ("LFLGTAB" ID ": ");\
- asm (" .word LSFLG0" ID);\
- asm (" .word LSFLGC" ID);\
- asm (" .word LSFLGV" ID);\
- asm (" .word LSFLGVC" ID);\
- asm (" .word LSFLGZ" ID);\
- asm (" .word LSFLGZC" ID);\
- asm (" .word LSFLGZV" ID);\
- asm (" .word LSFLGZVC" ID);\
- asm (" .word LSFLGN" ID);\
- asm (" .word LSFLGNC" ID);\
- asm (" .word LSFLGNV" ID);\
- asm (" .word LSFLGNVC" ID);\
- asm (" .word LSFLGNZ" ID);\
- asm (" .word LSFLGNZC" ID);\
- asm (" .word LSFLGNZV" ID);\
- asm (" .word LSFLGNZVC" ID);\
- asm (".text");\
- asm ("LSFLGVC" ID ": mov -1,%l0");\
- asm (" addcc 2,%l0,%g0");\
- asm (" sethi %hi(0x80000000),%l0");\
- asm (" mov %l0,%l1");\
- asm (" ba LFLGRET" ID);\
- asm (" addxcc %l0,%l1,%l0");\
- asm ("LSFLGC" ID ": mov -1,%l0");\
- asm (" ba LFLGRET" ID);\
- asm (" addcc 2,%l0,%g0");\
- asm ("LSFLGZC" ID ": mov -1,%l0");\
- asm (" ba LFLGRET" ID);\
- asm (" addcc 1,%l0,%l0");\
- asm ("LSFLGZVC" ID ": sethi %hi(0x80000000),%l0");\
- asm (" mov %l0,%l1");\
- asm (" ba LFLGRET" ID);\
- asm (" addcc %l0,%l1,%l0");\
- asm ("LSFLGZ" ID ": ba LFLGRET" ID);\
- asm (" subcc %g0,%g0,%g0");\
- asm ("LSFLGNC" ID ": add %g0,1,%l0");\
- asm (" ba LFLGRET" ID);\
- asm (" subcc %g0,%l0,%g0");\
- asm ("LSFLG0" ID ": ba LFLGRET" ID);\
- asm (" orcc 1,%g0,%g0");\
- asm ("LSFLGN" ID ": ba LFLGRET" ID);\
- asm (" orcc -1,%g0,%g0");\
- asm ("LSFLGV" ID ":");\
- asm ("LSFLGZV" ID ":");\
- asm ("LSFLGNV" ID ":");\
- asm ("LSFLGNVC" ID ":");\
- asm ("LSFLGNZ" ID ":");\
- asm ("LSFLGNZC" ID ":");\
- asm ("LSFLGNZV" ID ":");\
- asm ("LSFLGNZVC" ID ":");\
- asm (" unimp");\
- asm ("LFLGRET" ID ":");
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-extern int current_function_calls_alloca;
-extern int current_function_outgoing_args_size;
-
-#define EXIT_IGNORE_STACK \
- (get_frame_size () != 0 \
- || current_function_calls_alloca || current_function_outgoing_args_size)
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-/* This declaration is needed due to traditional/ANSI
- incompatibilities which cannot be #ifdefed away
- because they occur inside of macros. Sigh. */
-extern union tree_node *current_function_decl;
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
- (TARGET_FLAT ? sparc_flat_output_function_epilogue (FILE, SIZE) \
- : output_function_epilogue (FILE, SIZE, leaf_function))
-
-#define DELAY_SLOTS_FOR_EPILOGUE \
- (TARGET_FLAT ? sparc_flat_epilogue_delay_slots () : 1)
-#define ELIGIBLE_FOR_EPILOGUE_DELAY(trial, slots_filled) \
- (TARGET_FLAT ? sparc_flat_eligible_for_epilogue_delay (trial, slots_filled) \
- : eligible_for_epilogue_delay (trial, slots_filled))
-
-/* Define registers used by the epilogue and return instruction. */
-#define EPILOGUE_USES(REGNO) \
- (!TARGET_FLAT && REGNO == 31)
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On 32 bit sparcs, the trampoline contains five instructions:
- sethi #TOP_OF_FUNCTION,%g1
- or #BOTTOM_OF_FUNCTION,%g1,%g1
- sethi #TOP_OF_STATIC,%g2
- jmp g1
- or #BOTTOM_OF_STATIC,%g2,%g2
-
- On 64 bit sparcs, the trampoline contains 4 insns and two pseudo-immediate
- constants (plus some padding):
- rd %pc,%g1
- ldx[%g1+20],%g5
- ldx[%g1+28],%g1
- jmp %g1
- nop
- nop
- .xword context
- .xword function */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-do { \
- if (TARGET_ARCH64) \
- { \
- fprintf (FILE, "\trd %%pc,%%g1\n"); \
- fprintf (FILE, "\tldx [%%g1+24],%%g5\n"); \
- fprintf (FILE, "\tldx [%%g1+32],%%g1\n"); \
- fprintf (FILE, "\tjmp %%g1\n"); \
- fprintf (FILE, "\tnop\n"); \
- fprintf (FILE, "\tnop\n"); \
- /* -mmedlow shouldn't generate .xwords, so don't use them at all */ \
- fprintf (FILE, "\t.word 0,0,0,0\n"); \
- } \
- else \
- { \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x81C04000)); \
- ASM_OUTPUT_INT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x00000000)); \
- } \
-} while (0)
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE (TARGET_ARCH64 ? 40 : 20)
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-void sparc_initialize_trampoline ();
-void sparc64_initialize_trampoline ();
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
- do { \
- if (TARGET_ARCH64) \
- sparc64_initialize_trampoline (TRAMP, FNADDR, CXT); \
- else \
- sparc_initialize_trampoline (TRAMP, FNADDR, CXT); \
- } while (0)
-
-/* Generate necessary RTL for __builtin_saveregs().
- ARGLIST is the argument list; see expr.c. */
-extern struct rtx_def *sparc_builtin_saveregs ();
-#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) sparc_builtin_saveregs (ARGLIST)
-
-/* Generate RTL to flush the register windows so as to make arbitrary frames
- available. */
-#define SETUP_FRAME_ADDRESSES() \
- emit_insn (gen_flush_register_windows ())
-
-/* Given an rtx for the address of a frame,
- return an rtx for the address of the word in the frame
- that holds the dynamic chain--the previous frame's address.
- ??? -mflat support? */
-#define DYNAMIC_CHAIN_ADDRESS(frame) \
- gen_rtx (PLUS, Pmode, frame, gen_rtx (CONST_INT, VOIDmode, 14 * UNITS_PER_WORD))
-
-/* The return address isn't on the stack, it is in a register, so we can't
- access it from the current frame pointer. We can access it from the
- previous frame pointer though by reading a value from the register window
- save area. */
-#define RETURN_ADDR_IN_PREVIOUS_FRAME
-
-/* This is the offset of the return address to the true next instruction to be
- executed for the current function. */
-#define RETURN_ADDR_OFFSET \
- (8 + 4 * (! TARGET_ARCH64 && current_function_returns_struct))
-
-/* The current return address is in %i7. The return address of anything
- farther back is in the register window save area at [%fp+60]. */
-/* ??? This ignores the fact that the actual return address is +8 for normal
- returns, and +12 for structure returns. */
-#define RETURN_ADDR_RTX(count, frame) \
- ((count == -1) \
- ? gen_rtx (REG, Pmode, 31) \
- : gen_rtx (MEM, Pmode, \
- memory_address (Pmode, plus_constant (frame, 15 * UNITS_PER_WORD))))
-
-#define DOESNT_NEED_UNWINDER (! TARGET_FLAT)
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
-((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
-#define REGNO_OK_FOR_FP_P(REGNO) \
- (((unsigned) (REGNO) - 32 < (TARGET_V9 ? 64 : 32)) \
- || ((unsigned) reg_renumber[REGNO] - 32 < (TARGET_V9 ? 64 : 32)))
-#define REGNO_OK_FOR_CCFP_P(REGNO) \
- (TARGET_V9 \
- && (((unsigned) (REGNO) - 96 < 4) \
- || ((unsigned) reg_renumber[REGNO] - 96 < 4)))
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-
- These macros are specific to the SPARC, and may be used only
- in code for printing assembler insns and in conditions for
- define_optimization. */
-
-/* 1 if X is an fp register. */
-
-#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address.
- When PIC, we do not accept an address that would require a scratch reg
- to load into a register. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \
- || (GET_CODE (X) == CONST \
- && ! (flag_pic && pic_address_needs_scratch (X))))
-
-/* Define this, so that when PIC, reload won't try to reload invalid
- addresses which require two reload registers. */
-
-#define LEGITIMATE_PIC_OPERAND_P(X) (! pic_address_needs_scratch (X))
-
-/* Nonzero if the constant value X is a legitimate general operand.
- Anything can be made to work except floating point constants. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode)
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-/* Optional extra constraints for this machine. Borrowed from romp.h.
-
- For the SPARC, `Q' means that this is a memory operand but not a
- symbolic memory operand. Note that an unassigned pseudo register
- is such a memory operand. Needed because reload will generate
- these things in insns and then not re-recognize the insns, causing
- constrain_operands to fail.
-
- `S' handles constraints for calls. ??? So where is it? */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) \
- (((unsigned) REGNO (X)) - 32 >= (FIRST_PSEUDO_REGISTER - 32))
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- (((unsigned) REGNO (X)) - 32 >= (FIRST_PSEUDO_REGISTER - 32))
-
-/* 'T', 'U' are for aligned memory loads which aren't needed for v9. */
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' \
- ? ((GET_CODE (OP) == MEM \
- && memory_address_p (GET_MODE (OP), XEXP (OP, 0)) \
- && ! symbolic_memory_operand (OP, VOIDmode)) \
- || (reload_in_progress && GET_CODE (OP) == REG \
- && REGNO (OP) >= FIRST_PSEUDO_REGISTER)) \
- : (! TARGET_ARCH64 && (C) == 'T') \
- ? (mem_aligned_8 (OP)) \
- : (! TARGET_ARCH64 && (C) == 'U') \
- ? (register_ok_for_ldd (OP)) \
- : 0)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' \
- ? (GET_CODE (OP) == REG \
- ? (REGNO (OP) >= FIRST_PSEUDO_REGISTER \
- && reg_renumber[REGNO (OP)] < 0) \
- : GET_CODE (OP) == MEM) \
- : (! TARGET_ARCH64 && (C) == 'T') \
- ? mem_aligned_8 (OP) && strict_memory_address_p (Pmode, XEXP (OP, 0)) \
- : (! TARGET_ARCH64 && (C) == 'U') \
- ? (GET_CODE (OP) == REG \
- && (REGNO (OP) < FIRST_PSEUDO_REGISTER \
- || reg_renumber[REGNO (OP)] >= 0) \
- && register_ok_for_ldd (OP)) \
- : 0)
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On SPARC, the actual legitimate addresses must be REG+REG or REG+SMALLINT
- ordinarily. This changes a bit when generating PIC.
-
- If you change this, execute "rm explow.o recog.o reload.o". */
-
-#define RTX_OK_FOR_BASE_P(X) \
- ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
-
-#define RTX_OK_FOR_INDEX_P(X) \
- ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
- || (GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
-
-#define RTX_OK_FOR_OFFSET_P(X) \
- (GET_CODE (X) == CONST_INT && INTVAL (X) >= -0x1000 && INTVAL (X) < 0x1000)
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ if (RTX_OK_FOR_BASE_P (X)) \
- goto ADDR; \
- else if (GET_CODE (X) == PLUS) \
- { \
- register rtx op0 = XEXP (X, 0); \
- register rtx op1 = XEXP (X, 1); \
- if (flag_pic && op0 == pic_offset_table_rtx) \
- { \
- if (RTX_OK_FOR_BASE_P (op1)) \
- goto ADDR; \
- else if (flag_pic == 1 \
- && GET_CODE (op1) != REG \
- && GET_CODE (op1) != LO_SUM \
- && GET_CODE (op1) != MEM \
- && (GET_CODE (op1) != CONST_INT \
- || SMALL_INT (op1))) \
- goto ADDR; \
- } \
- else if (RTX_OK_FOR_BASE_P (op0)) \
- { \
- if (RTX_OK_FOR_INDEX_P (op1) \
- || RTX_OK_FOR_OFFSET_P (op1)) \
- goto ADDR; \
- } \
- else if (RTX_OK_FOR_BASE_P (op1)) \
- { \
- if (RTX_OK_FOR_INDEX_P (op0) \
- || RTX_OK_FOR_OFFSET_P (op0)) \
- goto ADDR; \
- } \
- } \
- else if (GET_CODE (X) == LO_SUM) \
- { \
- register rtx op0 = XEXP (X, 0); \
- register rtx op1 = XEXP (X, 1); \
- if (RTX_OK_FOR_BASE_P (op0) \
- && CONSTANT_P (op1) \
- /* We can't allow TFmode, because an offset \
- greater than or equal to the alignment (8) \
- may cause the LO_SUM to overflow. */ \
- && MODE != TFmode) \
- goto ADDR; \
- } \
- else if (GET_CODE (X) == CONST_INT && SMALL_INT (X)) \
- goto ADDR; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-/* On SPARC, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
-extern struct rtx_def *legitimize_pic_address ();
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ rtx sparc_x = (X); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
- (X) = gen_rtx (PLUS, Pmode, XEXP (X, 1), \
- force_operand (XEXP (X, 0), NULL_RTX)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
- (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
- force_operand (XEXP (X, 1), NULL_RTX)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \
- (X) = gen_rtx (PLUS, Pmode, force_operand (XEXP (X, 0), NULL_RTX),\
- XEXP (X, 1)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \
- (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
- force_operand (XEXP (X, 1), NULL_RTX)); \
- if (sparc_x != (X) && memory_address_p (MODE, X)) \
- goto WIN; \
- if (flag_pic) (X) = legitimize_pic_address (X, MODE, 0); \
- else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0), \
- copy_to_mode_reg (Pmode, XEXP (X, 1))); \
- else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
- (X) = gen_rtx (PLUS, Pmode, XEXP (X, 1), \
- copy_to_mode_reg (Pmode, XEXP (X, 0))); \
- else if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
- || GET_CODE (X) == LABEL_REF) \
- (X) = gen_rtx (LO_SUM, Pmode, \
- copy_to_mode_reg (Pmode, gen_rtx (HIGH, Pmode, X)), X); \
- if (memory_address_p (MODE, X)) \
- goto WIN; }
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the SPARC this is never true. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
-/* If we are referencing a function make the SYMBOL_REF special.
- In the Medium/Anywhere code model, %g4 points to the data segment so we
- must not add it to function addresses. */
-
-#define ENCODE_SECTION_INFO(DECL) \
- do { \
- if (TARGET_MEDANY && TREE_CODE (DECL) == FUNCTION_DECL) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
- } while (0)
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE Pmode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 8
-
-#if 0 /* Sun 4 has matherr, so this is no good. */
-/* This is the value of the error code EDOM for this machine,
- used by the sqrt instruction. */
-#define TARGET_EDOM 33
-
-/* This is how to refer to the variable errno. */
-#define GEN_ERRNO_RTX \
- gen_rtx (MEM, SImode, gen_rtx (SYMBOL_REF, Pmode, "errno"))
-#endif /* 0 */
-
-/* Define if operations between registers always perform the operation
- on the full register even if a narrower mode is specified. */
-#define WORD_REGISTER_OPERATIONS
-
-/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD
- will either zero-extend or sign-extend. The value of this macro should
- be the code that says which one of the two operations is implicitly
- done, NIL if none. */
-#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-
-/* Nonzero if access to memory by bytes is slow and undesirable.
- For RISC chips, it means that access to memory by bytes is no
- better than access by words when possible, so grab a whole word
- and maybe make use of that. */
-#define SLOW_BYTE_ACCESS 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE 1
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode (TARGET_PTR64 ? DImode : SImode)
-
-/* Generate calls to memcpy, memcmp and memset. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Add any extra modes needed to represent the condition code.
-
- On the Sparc, we have a "no-overflow" mode which is used when an add or
- subtract insn is used to set the condition code. Different branches are
- used in this case for some operations.
-
- We also have two modes to indicate that the relevant condition code is
- in the floating-point condition code register. One for comparisons which
- will generate an exception if the result is unordered (CCFPEmode) and
- one for comparisons which will never trap (CCFPmode).
-
- CCXmode and CCX_NOOVmode are only used by v9. */
-
-#define EXTRA_CC_MODES CCXmode, CC_NOOVmode, CCX_NOOVmode, CCFPmode, CCFPEmode
-
-/* Define the names for the modes specified above. */
-
-#define EXTRA_CC_NAMES "CCX", "CC_NOOV", "CCX_NOOV", "CCFP", "CCFPE"
-
-/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
- return the mode to be used for the comparison. For floating-point,
- CCFP[E]mode is used. CC_NOOVmode should be used when the first operand is a
- PLUS, MINUS, NEG, or ASHIFT. CCmode should be used when no special
- processing is needed. */
-#define SELECT_CC_MODE(OP,X,Y) \
- (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
- : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
- || GET_CODE (X) == NEG || GET_CODE (X) == ASHIFT) \
- ? (TARGET_ARCH64 && GET_MODE (X) == DImode ? CCX_NOOVmode : CC_NOOVmode) \
- : (TARGET_ARCH64 && GET_MODE (X) == DImode ? CCXmode : CCmode)))
-
-/* Return non-zero if SELECT_CC_MODE will never return MODE for a
- floating point inequality comparison. */
-
-#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE SImode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-#define NO_FUNCTION_CSE
-
-/* alloca should avoid clobbering the old register save area. */
-#define SETJMP_VIA_SAVE_AREA
-
-/* Define subroutines to call to handle multiply and divide.
- Use the subroutines that Sun's library provides.
- The `*' prevents an underscore from being prepended by the compiler. */
-
-#define DIVSI3_LIBCALL "*.div"
-#define UDIVSI3_LIBCALL "*.udiv"
-#define MODSI3_LIBCALL "*.rem"
-#define UMODSI3_LIBCALL "*.urem"
-/* .umul is a little faster than .mul. */
-#define MULSI3_LIBCALL "*.umul"
-
-/* Define library calls for quad FP operations. These are all part of the
- SPARC ABI. */
-#define ADDTF3_LIBCALL "_Q_add"
-#define SUBTF3_LIBCALL "_Q_sub"
-#define NEGTF2_LIBCALL "_Q_neg"
-#define MULTF3_LIBCALL "_Q_mul"
-#define DIVTF3_LIBCALL "_Q_div"
-#define FLOATSITF2_LIBCALL "_Q_itoq"
-#define FIX_TRUNCTFSI2_LIBCALL "_Q_qtoi"
-#define FIXUNS_TRUNCTFSI2_LIBCALL "_Q_qtou"
-#define EXTENDSFTF2_LIBCALL "_Q_stoq"
-#define TRUNCTFSF2_LIBCALL "_Q_qtos"
-#define EXTENDDFTF2_LIBCALL "_Q_dtoq"
-#define TRUNCTFDF2_LIBCALL "_Q_qtod"
-#define EQTF2_LIBCALL "_Q_feq"
-#define NETF2_LIBCALL "_Q_fne"
-#define GTTF2_LIBCALL "_Q_fgt"
-#define GETF2_LIBCALL "_Q_fge"
-#define LTTF2_LIBCALL "_Q_flt"
-#define LETF2_LIBCALL "_Q_fle"
-
-/* We can define the TFmode sqrt optab only if TARGET_FPU. This is because
- with soft-float, the SFmode and DFmode sqrt instructions will be absent,
- and the compiler will notice and try to use the TFmode sqrt instruction
- for calls to the builtin function sqrt, but this fails. */
-#define INIT_TARGET_OPTABS \
- do { \
- add_optab->handlers[(int) TFmode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, ADDTF3_LIBCALL); \
- sub_optab->handlers[(int) TFmode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, SUBTF3_LIBCALL); \
- neg_optab->handlers[(int) TFmode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, NEGTF2_LIBCALL); \
- smul_optab->handlers[(int) TFmode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, MULTF3_LIBCALL); \
- flodiv_optab->handlers[(int) TFmode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, DIVTF3_LIBCALL); \
- eqtf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, EQTF2_LIBCALL); \
- netf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, NETF2_LIBCALL); \
- gttf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, GTTF2_LIBCALL); \
- getf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, GETF2_LIBCALL); \
- lttf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, LTTF2_LIBCALL); \
- letf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, LETF2_LIBCALL); \
- trunctfsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, TRUNCTFSF2_LIBCALL); \
- trunctfdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, TRUNCTFDF2_LIBCALL); \
- extendsftf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, EXTENDSFTF2_LIBCALL); \
- extenddftf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, EXTENDDFTF2_LIBCALL); \
- floatsitf_libfunc = gen_rtx (SYMBOL_REF, Pmode, FLOATSITF2_LIBCALL); \
- fixtfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, FIX_TRUNCTFSI2_LIBCALL); \
- fixunstfsi_libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, FIXUNS_TRUNCTFSI2_LIBCALL); \
- if (TARGET_FPU) \
- sqrt_optab->handlers[(int) TFmode].libfunc \
- = gen_rtx (SYMBOL_REF, Pmode, "_Q_sqrt"); \
- INIT_SUBTARGET_OPTABS; \
- } while (0)
-
-/* This is meant to be redefined in the host dependent files */
-#define INIT_SUBTARGET_OPTABS
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) < 0x1000 && INTVAL (RTX) >= -0x1000) \
- return 0; \
- case HIGH: \
- return 2; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 4; \
- case CONST_DOUBLE: \
- if (GET_MODE (RTX) == DImode) \
- if ((XINT (RTX, 3) == 0 \
- && (unsigned) XINT (RTX, 2) < 0x1000) \
- || (XINT (RTX, 3) == -1 \
- && XINT (RTX, 2) < 0 \
- && XINT (RTX, 2) >= -0x1000)) \
- return 0; \
- return 8;
-
-/* Compute the cost of an address. For the sparc, all valid addresses are
- the same cost.
- ??? Is this true for v9? */
-
-#define ADDRESS_COST(RTX) 1
-
-/* Compute extra cost of moving data between one register class
- and another.
- ??? v9: We ignore FPCC_REGS on the assumption they'll never be seen. */
-#define REGISTER_MOVE_COST(CLASS1, CLASS2) \
- (((FP_REG_CLASS_P (CLASS1) && (CLASS2) == GENERAL_REGS) \
- || ((CLASS1) == GENERAL_REGS && FP_REG_CLASS_P (CLASS2))) ? 6 : 2)
-
-/* Provide the costs of a rtl expression. This is in the body of a
- switch on CODE. The purpose for the cost of MULT is to encourage
- `synth_mult' to find a synthetic multiply when reasonable.
-
- If we need more than 12 insns to do a multiply, then go out-of-line,
- since the call overhead will be < 10% of the cost of the multiply. */
-
-#define RTX_COSTS(X,CODE,OUTER_CODE) \
- case MULT: \
- return (TARGET_V8 || TARGET_SPARCLITE || TARGET_V9) \
- ? COSTS_N_INSNS (5) : COSTS_N_INSNS (25); \
- case DIV: \
- case UDIV: \
- case MOD: \
- case UMOD: \
- return COSTS_N_INSNS (25); \
- /* Make FLOAT and FIX more expensive than CONST_DOUBLE,\
- so that cse will favor the latter. */ \
- case FLOAT: \
- case FIX: \
- return 19;
-
-/* Adjust the cost of dependencies. */
-#define ADJUST_COST(INSN,LINK,DEP,COST) \
- if (sparc_cpu == PROCESSOR_SUPERSPARC) \
- (COST) = supersparc_adjust_cost (INSN, LINK, DEP, COST)
-
-/* Conditional branches with empty delay slots have a length of two. */
-#define ADJUST_INSN_LENGTH(INSN, LENGTH) \
- if (GET_CODE (INSN) == CALL_INSN \
- || (GET_CODE (INSN) == JUMP_INSN && ! simplejump_p (insn))) \
- LENGTH += 1;
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(file)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* ??? Try to make the style consistent here (_OP?). */
-
-#define ASM_LONGLONG ".xword"
-#define ASM_LONG ".word"
-#define ASM_SHORT ".half"
-#define ASM_BYTE_OP ".byte"
-#define ASM_FLOAT ".single"
-#define ASM_DOUBLE ".double"
-#define ASM_LONGDOUBLE ".xxx" /* ??? Not known (or used yet). */
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7", \
- "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7", \
- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
- "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7", \
- "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", \
- "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15", \
- "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23", \
- "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31", \
- "%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39", \
- "%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47", \
- "%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55", \
- "%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63", \
- "%fcc0", "%fcc1", "%fcc2", "%fcc3", "%icc"}
-
-/* Define additional names for use in asm clobbers and asm declarations. */
-
-#define ADDITIONAL_REGISTER_NAMES \
-{{"ccr", SPARC_ICC_REG}, {"cc", SPARC_ICC_REG}}
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* On Sun 4, this limit is 2048. We use 1500 to be safe,
- since the length can run past this up to a continuation point. */
-#define DBX_CONTIN_LENGTH 1500
-
-/* This is how to output a note to DBX telling it the line number
- to which the following sequence of instructions corresponds.
-
- This is needed for SunOS 4.0, and should not hurt for 3.2
- versions either. */
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
- { static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,LM%d\nLM%d:\n", \
- line, sym_lineno, sym_lineno); \
- sym_lineno += 1; }
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output a definition of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- { \
- long t[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
- fprintf (FILE, "\t%s\t0x%lx\n\t%s\t0x%lx\n", \
- ASM_LONG, t[0], ASM_LONG, t[1]); \
- }
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- { \
- long t; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
- fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t); \
- } \
-
-/* This is how to output an assembler line defining a `long double'
- constant. */
-
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
- { \
- long t[4]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), t); \
- fprintf (FILE, "\t%s\t0x%lx\n\t%s\t0x%lx\n\t%s\t0x%lx\n\t%s\t0x%lx\n", \
- ASM_LONG, t[0], ASM_LONG, t[1], ASM_LONG, t[2], ASM_LONG, t[3]); \
- }
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t%s\t", ASM_LONG), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line defining a DImode constant. */
-#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \
- output_double_int (FILE, VALUE)
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t%s\t", ASM_SHORT), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t%s\t", ASM_BYTE_OP), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE))
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
-do { \
- char label[30]; \
- ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
- if (Pmode == SImode) \
- fprintf (FILE, "\t.word\t"); \
- else if (TARGET_MEDLOW) \
- fprintf (FILE, "\t.word\t0\n\t.word\t"); \
- else \
- fprintf (FILE, "\t.xword\t"); \
- assemble_name (FILE, label); \
- fprintf (FILE, "\n"); \
-} while (0)
-
-/* This is how to output an element of a case-vector that is relative.
- (SPARC uses such vectors only when generating PIC.) */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
-do { \
- char label[30]; \
- ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \
- if (Pmode == SImode) \
- fprintf (FILE, "\t.word\t"); \
- else if (TARGET_MEDLOW) \
- fprintf (FILE, "\t.word\t0\n\t.word\t"); \
- else \
- fprintf (FILE, "\t.xword\t"); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-1b\n"); \
-} while (0)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", (1<<(LOG)))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.skip %u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.common ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u,\"bss\"\n", (SIZE)))
-
-/* This says how to output an assembler line to define a local common
- symbol. */
-
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNED) \
-( fputs ("\t.reserve ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u,\"bss\",%u\n", \
- (SIZE), ((ALIGNED) / BITS_PER_UNIT)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-#define IDENT_ASM_OP ".ident"
-
-/* Output #ident as a .ident. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
- Used for C++ multiple inheritance. */
-#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
-do { \
- int big_delta = (DELTA) >= 4096 || (DELTA) < -4096; \
- if (big_delta) \
- fprintf (FILE, "\tset %d,%%g1\n\tadd %%o0,%%g1,%%o0\n", (DELTA)); \
- if (TARGET_MEDANY || TARGET_FULLANY) \
- { \
- fprintf (FILE, "\tsetx "); \
- assemble_name \
- (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
- fprintf (FILE, ",%%g5,%%g1\n\tjmp %%g1\n"); \
- } \
- else \
- { \
- fprintf (FILE, "\tsethi %%hi("); \
- assemble_name \
- (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
- fprintf (FILE, "),%%g1\n\tjmp %%g1+%%lo("); \
- assemble_name \
- (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
- fprintf (FILE, ")\n"); \
- } \
- if (big_delta) fprintf (FILE, "\tnop\n"); \
- else fprintf (FILE, "\tadd %%o0,%d,%%o0\n", DELTA); \
-} while (0)
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \
- ((CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^' || (CHAR) == '(')
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx base, index = 0; \
- int offset = 0; \
- register rtx addr = ADDR; \
- if (GET_CODE (addr) == REG) \
- fputs (reg_names[REGNO (addr)], FILE); \
- else if (GET_CODE (addr) == PLUS) \
- { \
- if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
- offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);\
- else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
- offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);\
- else \
- base = XEXP (addr, 0), index = XEXP (addr, 1); \
- fputs (reg_names[REGNO (base)], FILE); \
- if (index == 0) \
- fprintf (FILE, "%+d", offset); \
- else if (GET_CODE (index) == REG) \
- fprintf (FILE, "+%s", reg_names[REGNO (index)]); \
- else if (GET_CODE (index) == SYMBOL_REF \
- || GET_CODE (index) == CONST) \
- fputc ('+', FILE), output_addr_const (FILE, index); \
- else abort (); \
- } \
- else if (GET_CODE (addr) == MINUS \
- && GET_CODE (XEXP (addr, 1)) == LABEL_REF) \
- { \
- output_addr_const (FILE, XEXP (addr, 0)); \
- fputs ("-(", FILE); \
- output_addr_const (FILE, XEXP (addr, 1)); \
- fputs ("-.)", FILE); \
- } \
- else if (GET_CODE (addr) == LO_SUM) \
- { \
- output_operand (XEXP (addr, 0), 0); \
- fputs ("+%lo(", FILE); \
- output_address (XEXP (addr, 1)); \
- fputc (')', FILE); \
- } \
- else if (flag_pic && GET_CODE (addr) == CONST \
- && GET_CODE (XEXP (addr, 0)) == MINUS \
- && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST \
- && GET_CODE (XEXP (XEXP (XEXP (addr, 0), 1), 0)) == MINUS \
- && XEXP (XEXP (XEXP (XEXP (addr, 0), 1), 0), 1) == pc_rtx) \
- { \
- addr = XEXP (addr, 0); \
- output_addr_const (FILE, XEXP (addr, 0)); \
- /* Group the args of the second CONST in parenthesis. */ \
- fputs ("-(", FILE); \
- /* Skip past the second CONST--it does nothing for us. */\
- output_addr_const (FILE, XEXP (XEXP (addr, 1), 0)); \
- /* Close the parenthesis. */ \
- fputc (')', FILE); \
- } \
- else \
- { \
- output_addr_const (FILE, addr); \
- } \
-}
-
-/* Declare functions defined in sparc.c and used in templates. */
-
-extern char *singlemove_string ();
-extern char *output_move_double ();
-extern char *output_move_quad ();
-extern char *output_fp_move_double ();
-extern char *output_fp_move_quad ();
-extern char *output_block_move ();
-extern char *output_scc_insn ();
-extern char *output_cbranch ();
-extern char *output_v9branch ();
-extern char *output_return ();
-
-/* Defined in flags.h, but insn-emit.c does not include flags.h. */
-
-extern int flag_pic;
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
deleted file mode 100644
index 196b2f1078f..00000000000
--- a/gcc/config/sparc/sparc.md
+++ /dev/null
@@ -1,6076 +0,0 @@
-;;- Machine description for SPARC chip for GNU C compiler
-;; Copyright (C) 1987, 88, 89, 92-95, 1996 Free Software Foundation, Inc.
-;; Contributed by Michael Tiemann (tiemann@cygnus.com)
-;; 64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
-;; at Cygnus Support.
-
-;; 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.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;; The upper 32 fp regs on the v9 can't hold SFmode values. To deal with this
-;; a second register class, EXTRA_FP_REGS, exists for the v9 chip. The name
-;; is a bit of a misnomer as it covers all 64 fp regs. The corresponding
-;; constraint letter is 'e'. To avoid any confusion, 'e' is used instead of
-;; 'f' for all DF/TFmode values, including those that are specific to the v8.
-;;
-;; -mlive-g0 is *not* supported for TARGET_ARCH64, so we don't bother to
-;; test TARGET_LIVE_G0 if we have TARGET_ARCH64.
-
-;; Attribute for cpu type.
-;; These must match the values for enum processor_type in sparc.h.
-(define_attr "cpu" "v7,cypress,v8,supersparc,sparclite,f930,f934,sparclet,tsc701,v8plus,v9,ultrasparc"
- (const (symbol_ref "sparc_cpu_attr")))
-
-;; Attribute for the instruction set.
-;; At present we only need to distinguish v9/!v9, but for clarity we
-;; test TARGET_V8 too.
-(define_attr "isa" "v6,v8,v9,sparclet"
- (const
- (cond [(symbol_ref "TARGET_V9") (const_string "v9")
- (symbol_ref "TARGET_V8") (const_string "v8")
- (symbol_ref "TARGET_SPARCLET") (const_string "sparclet")]
- (const_string "v6"))))
-
-;; Architecture size.
-(define_attr "arch" "arch32bit,arch64bit"
- (const
- (cond [(symbol_ref "TARGET_ARCH64") (const_string "arch64bit")]
- (const_string "arch32bit"))))
-
-;; Whether -mlive-g0 is in effect.
-(define_attr "live_g0" "no,yes"
- (const
- (cond [(symbol_ref "TARGET_LIVE_G0") (const_string "yes")]
- (const_string "no"))))
-
-;; Insn type. Used to default other attribute values.
-
-;; type "unary" insns have one input operand (1) and one output operand (0)
-;; type "binary" insns have two input operands (1,2) and one output (0)
-;; type "compare" insns have one or two input operands (0,1) and no output
-;; type "call_no_delay_slot" is a call followed by an unimp instruction.
-
-(define_attr "type"
- "move,unary,binary,compare,load,store,ialu,shift,uncond_branch,branch,call,call_no_delay_slot,address,imul,fpload,fpstore,fp,fpcmp,fpmul,fpdivs,fpdivd,fpsqrt,cmove,multi,misc"
- (const_string "binary"))
-
-;; Set true if insn uses call-clobbered intermediate register.
-(define_attr "use_clobbered" "false,true"
- (if_then_else (and (eq_attr "type" "address")
- (match_operand 0 "clobbered_register" ""))
- (const_string "true")
- (const_string "false")))
-
-;; Length (in # of insns).
-(define_attr "length" ""
- (cond [(eq_attr "type" "load,fpload")
- (if_then_else (match_operand 1 "symbolic_memory_operand" "")
- (const_int 2) (const_int 1))
-
- (eq_attr "type" "store,fpstore")
- (if_then_else (match_operand 0 "symbolic_memory_operand" "")
- (const_int 2) (const_int 1))
-
- (eq_attr "type" "address") (const_int 2)
-
- (eq_attr "type" "binary")
- (if_then_else (ior (match_operand 2 "arith_operand" "")
- (match_operand 2 "arith_double_operand" ""))
- (const_int 1) (const_int 3))
-
- (eq_attr "type" "multi") (const_int 2)
-
- (eq_attr "type" "move,unary")
- (if_then_else (ior (match_operand 1 "arith_operand" "")
- (match_operand 1 "arith_double_operand" ""))
- (const_int 1) (const_int 2))]
-
- (const_int 1)))
-
-(define_asm_attributes
- [(set_attr "length" "1")
- (set_attr "type" "multi")])
-
-;; Attributes for instruction and branch scheduling
-
-(define_attr "in_call_delay" "false,true"
- (cond [(eq_attr "type" "uncond_branch,branch,call,call_no_delay_slot,multi")
- (const_string "false")
- (eq_attr "type" "load,fpload,store,fpstore")
- (if_then_else (eq_attr "length" "1")
- (const_string "true")
- (const_string "false"))
- (eq_attr "type" "address")
- (if_then_else (eq_attr "use_clobbered" "false")
- (const_string "true")
- (const_string "false"))]
- (if_then_else (eq_attr "length" "1")
- (const_string "true")
- (const_string "false"))))
-
-(define_delay (eq_attr "type" "call")
- [(eq_attr "in_call_delay" "true") (nil) (nil)])
-
-;; ??? Should implement the notion of predelay slots for floating point
-;; branches. This would allow us to remove the nop always inserted before
-;; a floating point branch.
-
-;; ??? It is OK for fill_simple_delay_slots to put load/store instructions
-;; in a delay slot, but it is not OK for fill_eager_delay_slots to do so.
-;; This is because doing so will add several pipeline stalls to the path
-;; that the load/store did not come from. Unfortunately, there is no way
-;; to prevent fill_eager_delay_slots from using load/store without completely
-;; disabling them. For the SPEC benchmark set, this is a serious lose,
-;; because it prevents us from moving back the final store of inner loops.
-
-(define_attr "in_branch_delay" "false,true"
- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,call,call_no_delay_slot,multi")
- (eq_attr "length" "1"))
- (const_string "true")
- (const_string "false")))
-
-(define_attr "in_uncond_branch_delay" "false,true"
- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,call,call_no_delay_slot,multi")
- (eq_attr "length" "1"))
- (const_string "true")
- (const_string "false")))
-
-(define_attr "in_annul_branch_delay" "false,true"
- (if_then_else (and (eq_attr "type" "!uncond_branch,branch,call,call_no_delay_slot,multi")
- (eq_attr "length" "1"))
- (const_string "true")
- (const_string "false")))
-
-(define_delay (eq_attr "type" "branch")
- [(eq_attr "in_branch_delay" "true")
- (nil) (eq_attr "in_annul_branch_delay" "true")])
-
-(define_delay (eq_attr "type" "uncond_branch")
- [(eq_attr "in_uncond_branch_delay" "true")
- (nil) (nil)])
-
-;; Function units of the SPARC
-
-;; (define_function_unit {name} {num-units} {n-users} {test}
-;; {ready-delay} {issue-delay} [{conflict-list}])
-
-;; The integer ALU.
-;; (Noted only for documentation; units that take one cycle do not need to
-;; be specified.)
-
-;; On the sparclite, integer multiply takes 1, 3, or 5 cycles depending on
-;; the inputs.
-
-;; (define_function_unit "alu" 1 0
-;; (eq_attr "type" "unary,binary,move,address") 1 0)
-
-;; ---- cypress CY7C602 scheduling:
-;; Memory with load-delay of 1 (i.e., 2 cycle load).
-(define_function_unit "memory" 1 0
- (and (eq_attr "type" "load,fpload") (eq_attr "cpu" "cypress")) 2 2)
-
-;; SPARC has two floating-point units: the FP ALU,
-;; and the FP MUL/DIV/SQRT unit.
-;; Instruction timings on the CY7C602 are as follows
-;; FABSs 4
-;; FADDs/d 5/5
-;; FCMPs/d 4/4
-;; FDIVs/d 23/37
-;; FMOVs 4
-;; FMULs/d 5/7
-;; FNEGs 4
-;; FSQRTs/d 34/63
-;; FSUBs/d 5/5
-;; FdTOi/s 5/5
-;; FsTOi/d 5/5
-;; FiTOs/d 9/5
-
-;; The CY7C602 can only support 2 fp isnsn simultaneously.
-;; More insns cause the chip to stall.
-
-(define_function_unit "fp_alu" 1 0
- (and (eq_attr "type" "fp") (eq_attr "cpu" "cypress")) 5 5)
-(define_function_unit "fp_mds" 1 0
- (and (eq_attr "type" "fpmul") (eq_attr "cpu" "cypress")) 7 7)
-(define_function_unit "fp_mds" 1 0
- (and (eq_attr "type" "fpdivs,fpdivd") (eq_attr "cpu" "cypress")) 37 37)
-(define_function_unit "fp_mds" 1 0
- (and (eq_attr "type" "fpsqrt") (eq_attr "cpu" "cypress")) 63 63)
-
-;; ----- The TMS390Z55 scheduling
-;; The Supersparc can issue 1 - 3 insns per cycle; here we assume
-;; three insns/cycle, and hence multiply all costs by three.
-;; Combinations up to two integer, one ld/st, one fp.
-;; Memory delivers its result in one cycle to IU, zero cycles to FP
-(define_function_unit "memory" 1 0
- (and (eq_attr "type" "load") (eq_attr "cpu" "supersparc")) 3 3)
-(define_function_unit "memory" 1 0
- (and (eq_attr "type" "fpload") (eq_attr "cpu" "supersparc")) 1 3)
-;; at least one in three instructions can be a mem opt.
-(define_function_unit "memory" 1 0
- (and (eq_attr "type" "store,fpstore") (eq_attr "cpu" "supersparc")) 1 3)
-;; at least one in three instructions can be a shift op.
-(define_function_unit "shift" 1 0
- (and (eq_attr "type" "shift") (eq_attr "cpu" "supersparc")) 1 3)
-
-;; There are only two write ports to the integer register file
-;; A store also uses a write port
-(define_function_unit "iwport" 2 0
- (and (eq_attr "type" "load,store,shift,ialu") (eq_attr "cpu" "supersparc")) 1 3)
-
-;; Timings; throughput/latency
-;; FADD 1/3 add/sub, format conv, compar, abs, neg
-;; FMUL 1/3
-;; FDIVs 4/6
-;; FDIVd 7/9
-;; FSQRTs 6/8
-;; FSQRTd 10/12
-;; IMUL 4/4
-
-(define_function_unit "fp_alu" 1 0
- (and (eq_attr "type" "fp,fpcmp") (eq_attr "cpu" "supersparc")) 9 3)
-(define_function_unit "fp_mds" 1 0
- (and (eq_attr "type" "fpmul") (eq_attr "cpu" "supersparc")) 9 3)
-(define_function_unit "fp_mds" 1 0
- (and (eq_attr "type" "fpdivs") (eq_attr "cpu" "supersparc")) 18 12)
-(define_function_unit "fp_mds" 1 0
- (and (eq_attr "type" "fpdivd") (eq_attr "cpu" "supersparc")) 27 21)
-(define_function_unit "fp_mds" 1 0
- (and (eq_attr "type" "fpsqrt") (eq_attr "cpu" "supersparc")) 36 30)
-(define_function_unit "fp_mds" 1 0
- (and (eq_attr "type" "imul") (eq_attr "cpu" "supersparc")) 12 12)
-
-;; ----- sparclet tsc701 scheduling
-;; The tsc701 issues 1 insn per cycle.
-;; Results may be written back out of order.
-
-;; Loads take 2 extra cycles to complete and 4 can be buffered at a time.
-(define_function_unit "tsc701_load" 4 1
- (and (eq_attr "type" "load") (eq_attr "cpu" "tsc701")) 3 1)
-;; Stores take 2(?) extra cycles to complete.
-;; It is desirable to not have any memory operation in the following 2 cycles.
-;; (??? or 2 memory ops in the case of std).
-(define_function_unit "tsc701_store" 1 0
- (and (eq_attr "type" "store") (eq_attr "cpu" "tsc701")) 3 3
- [(eq_attr "type" "load,store")])
-;; The multiply unit has a latency of 5.
-(define_function_unit "tsc701_mul" 1 0
- (and (eq_attr "type" "imul") (eq_attr "cpu" "tsc701")) 5 5)
-
-;; Compare instructions.
-;; This controls RTL generation and register allocation.
-
-;; We generate RTL for comparisons and branches by having the cmpxx
-;; patterns store away the operands. Then, the scc and bcc patterns
-;; emit RTL for both the compare and the branch.
-;;
-;; We do this because we want to generate different code for an sne and
-;; seq insn. In those cases, if the second operand of the compare is not
-;; const0_rtx, we want to compute the xor of the two operands and test
-;; it against zero.
-;;
-;; We start with the DEFINE_EXPANDs, then the DEFINE_INSNs to match
-;; the patterns. Finally, we have the DEFINE_SPLITs for some of the scc
-;; insns that actually require more than one machine instruction.
-
-;; Put cmpsi first among compare insns so it matches two CONST_INT operands.
-
-(define_expand "cmpsi"
- [(set (reg:CC 100)
- (compare:CC (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "arith_operand" "")))]
- ""
- "
-{
- sparc_compare_op0 = operands[0];
- sparc_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_expand "cmpdi"
- [(set (reg:CCX 100)
- (compare:CCX (match_operand:DI 0 "register_operand" "")
- (match_operand:DI 1 "arith_double_operand" "")))]
- "TARGET_ARCH64"
- "
-{
- sparc_compare_op0 = operands[0];
- sparc_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_expand "cmpsf"
- ;; The 96 here isn't ever used by anyone.
- [(set (reg:CCFP 96)
- (compare:CCFP (match_operand:SF 0 "register_operand" "")
- (match_operand:SF 1 "register_operand" "")))]
- "TARGET_FPU"
- "
-{
- sparc_compare_op0 = operands[0];
- sparc_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_expand "cmpdf"
- ;; The 96 here isn't ever used by anyone.
- [(set (reg:CCFP 96)
- (compare:CCFP (match_operand:DF 0 "register_operand" "")
- (match_operand:DF 1 "register_operand" "")))]
- "TARGET_FPU"
- "
-{
- sparc_compare_op0 = operands[0];
- sparc_compare_op1 = operands[1];
- DONE;
-}")
-
-(define_expand "cmptf"
- ;; The 96 here isn't ever used by anyone.
- [(set (reg:CCFP 96)
- (compare:CCFP (match_operand:TF 0 "register_operand" "")
- (match_operand:TF 1 "register_operand" "")))]
- "TARGET_FPU"
- "
-{
- sparc_compare_op0 = operands[0];
- sparc_compare_op1 = operands[1];
- DONE;
-}")
-
-;; Now the compare DEFINE_INSNs.
-
-(define_insn "*cmpsi_insn"
- [(set (reg:CC 100)
- (compare:CC (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "arith_operand" "rI")))]
- ""
- "cmp %0,%1"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmpdi_sp64"
- [(set (reg:CCX 100)
- (compare:CCX (match_operand:DI 0 "register_operand" "r")
- (match_operand:DI 1 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "cmp %0,%1"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmpsf_fpe"
- [(set (match_operand:CCFPE 0 "fcc_reg_operand" "=c")
- (compare:CCFPE (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "*
-{
- if (TARGET_V9)
- return \"fcmpes %0,%1,%2\";
- return \"fcmpes %1,%2\";
-}"
- [(set_attr "type" "fpcmp")])
-
-(define_insn "*cmpdf_fpe"
- [(set (match_operand:CCFPE 0 "fcc_reg_operand" "=c")
- (compare:CCFPE (match_operand:DF 1 "register_operand" "e")
- (match_operand:DF 2 "register_operand" "e")))]
- "TARGET_FPU"
- "*
-{
- if (TARGET_V9)
- return \"fcmped %0,%1,%2\";
- return \"fcmped %1,%2\";
-}"
- [(set_attr "type" "fpcmp")])
-
-(define_insn "*cmptf_fpe"
- [(set (match_operand:CCFPE 0 "fcc_reg_operand" "=c")
- (compare:CCFPE (match_operand:TF 1 "register_operand" "e")
- (match_operand:TF 2 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "*
-{
- if (TARGET_V9)
- return \"fcmpeq %0,%1,%2\";
- return \"fcmpeq %1,%2\";
-}"
- [(set_attr "type" "fpcmp")])
-
-(define_insn "*cmpsf_fp"
- [(set (match_operand:CCFP 0 "fcc_reg_operand" "=c")
- (compare:CCFP (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "*
-{
- if (TARGET_V9)
- return \"fcmps %0,%1,%2\";
- return \"fcmps %1,%2\";
-}"
- [(set_attr "type" "fpcmp")])
-
-(define_insn "*cmpdf_fp"
- [(set (match_operand:CCFP 0 "fcc_reg_operand" "=c")
- (compare:CCFP (match_operand:DF 1 "register_operand" "e")
- (match_operand:DF 2 "register_operand" "e")))]
- "TARGET_FPU"
- "*
-{
- if (TARGET_V9)
- return \"fcmpd %0,%1,%2\";
- return \"fcmpd %1,%2\";
-}"
- [(set_attr "type" "fpcmp")])
-
-(define_insn "*cmptf_fp"
- [(set (match_operand:CCFP 0 "fcc_reg_operand" "=c")
- (compare:CCFP (match_operand:TF 1 "register_operand" "e")
- (match_operand:TF 2 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "*
-{
- if (TARGET_V9)
- return \"fcmpq %0,%1,%2\";
- return \"fcmpq %1,%2\";
-}"
- [(set_attr "type" "fpcmp")])
-
-;; Next come the scc insns. For seq, sne, sgeu, and sltu, we can do this
-;; without jumps using the addx/subx instructions. For seq/sne on v9 we use
-;; the same code as v8 (the addx/subx method has more applications). The
-;; exception to this is "reg != 0" which can be done in one instruction on v9
-;; (so we do it). For the rest, on v9 we use conditional moves; on v8, we do
-;; branches.
-
-;; Seq_special[_xxx] and sne_special[_xxx] clobber the CC reg, because they
-;; generate addcc/subcc instructions.
-
-(define_expand "seqsi_special"
- [(set (match_dup 3)
- (xor:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))
- (parallel [(set (match_operand:SI 0 "register_operand" "")
- (eq:SI (match_dup 3) (const_int 0)))
- (clobber (reg:CC 100))])]
- "! TARGET_LIVE_G0"
- "{ operands[3] = gen_reg_rtx (SImode); }")
-
-(define_expand "seqdi_special"
- [(set (match_dup 3)
- (xor:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))
- (parallel [(set (match_operand:DI 0 "register_operand" "")
- (eq:DI (match_dup 3) (const_int 0)))
- (clobber (reg:CCX 100))])]
- "TARGET_ARCH64"
- "{ operands[3] = gen_reg_rtx (DImode); }")
-
-(define_expand "snesi_special"
- [(set (match_dup 3)
- (xor:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))
- (parallel [(set (match_operand:SI 0 "register_operand" "")
- (ne:SI (match_dup 3) (const_int 0)))
- (clobber (reg:CC 100))])]
- "! TARGET_LIVE_G0"
- "{ operands[3] = gen_reg_rtx (SImode); }")
-
-(define_expand "snedi_special"
- [(set (match_dup 3)
- (xor:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))
- (parallel [(set (match_operand:DI 0 "register_operand" "")
- (ne:DI (match_dup 3) (const_int 0)))
- (clobber (reg:CCX 100))])]
- "TARGET_ARCH64"
- "{ operands[3] = gen_reg_rtx (DImode); }")
-
-(define_expand "seqdi_special_trunc"
- [(set (match_dup 3)
- (xor:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))
- (parallel [(set (match_operand:SI 0 "register_operand" "")
- (eq:DI (match_dup 3) (const_int 0)))
- (clobber (reg:CCX 100))])]
- "TARGET_ARCH64"
- "{ operands[3] = gen_reg_rtx (DImode); }")
-
-(define_expand "snedi_special_trunc"
- [(set (match_dup 3)
- (xor:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:DI 2 "register_operand" "")))
- (parallel [(set (match_operand:SI 0 "register_operand" "")
- (ne:DI (match_dup 3) (const_int 0)))
- (clobber (reg:CCX 100))])]
- "TARGET_ARCH64"
- "{ operands[3] = gen_reg_rtx (DImode); }")
-
-(define_expand "seqsi_special_extend"
- [(set (match_dup 3)
- (xor:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))
- (parallel [(set (match_operand:DI 0 "register_operand" "")
- (eq:SI (match_dup 3) (const_int 0)))
- (clobber (reg:CC 100))])]
- "TARGET_ARCH64"
- "{ operands[3] = gen_reg_rtx (SImode); }")
-
-(define_expand "snesi_special_extend"
- [(set (match_dup 3)
- (xor:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "register_operand" "")))
- (parallel [(set (match_operand:DI 0 "register_operand" "")
- (ne:SI (match_dup 3) (const_int 0)))
- (clobber (reg:CC 100))])]
- "TARGET_ARCH64"
- "{ operands[3] = gen_reg_rtx (SImode); }")
-
-;; ??? v9: Operand 0 needs a mode, so SImode was chosen.
-;; However, the code handles both SImode and DImode.
-(define_expand "seq"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (eq:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (GET_MODE (sparc_compare_op0) == SImode)
- {
- rtx pat;
-
- if (GET_MODE (operands[0]) == SImode)
- pat = gen_seqsi_special (operands[0], sparc_compare_op0,
- sparc_compare_op1);
- else if (! TARGET_ARCH64)
- FAIL;
- else
- pat = gen_seqsi_special_extend (operands[0], sparc_compare_op0,
- sparc_compare_op1);
- emit_insn (pat);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == DImode)
- {
- rtx pat;
-
- if (! TARGET_ARCH64)
- FAIL;
- else if (GET_MODE (operands[0]) == SImode)
- pat = gen_seqdi_special_trunc (operands[0], sparc_compare_op0,
- sparc_compare_op1);
- else
- pat = gen_seqdi_special (operands[0], sparc_compare_op0,
- sparc_compare_op1);
- emit_insn (pat);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, EQ);
- emit_insn (gen_sne (operands[0]));
- DONE;
- }
- else if (TARGET_V9)
- {
- if (gen_v9_scc (EQ, operands))
- DONE;
- /* fall through */
- }
- operands[1] = gen_compare_reg (EQ, sparc_compare_op0, sparc_compare_op1);
-}")
-
-;; ??? v9: Operand 0 needs a mode, so SImode was chosen.
-;; However, the code handles both SImode and DImode.
-(define_expand "sne"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (ne:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (GET_MODE (sparc_compare_op0) == SImode)
- {
- rtx pat;
-
- if (GET_MODE (operands[0]) == SImode)
- pat = gen_snesi_special (operands[0], sparc_compare_op0,
- sparc_compare_op1);
- else if (! TARGET_ARCH64)
- FAIL;
- else
- pat = gen_snesi_special_extend (operands[0], sparc_compare_op0,
- sparc_compare_op1);
- emit_insn (pat);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == DImode)
- {
- rtx pat;
-
- if (! TARGET_ARCH64)
- FAIL;
- else if (GET_MODE (operands[0]) == SImode)
- pat = gen_snedi_special_trunc (operands[0], sparc_compare_op0,
- sparc_compare_op1);
- else
- pat = gen_snedi_special (operands[0], sparc_compare_op0,
- sparc_compare_op1);
- emit_insn (pat);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, NE);
- emit_insn (gen_sne (operands[0]));
- DONE;
- }
- else if (TARGET_V9)
- {
- if (gen_v9_scc (NE, operands))
- DONE;
- /* fall through */
- }
- operands[1] = gen_compare_reg (NE, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "sgt"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (gt:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GT);
- emit_insn (gen_sne (operands[0]));
- DONE;
- }
- else if (TARGET_V9)
- {
- if (gen_v9_scc (GT, operands))
- DONE;
- /* fall through */
- }
- operands[1] = gen_compare_reg (GT, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "slt"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (lt:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LT);
- emit_insn (gen_sne (operands[0]));
- DONE;
- }
- else if (TARGET_V9)
- {
- if (gen_v9_scc (LT, operands))
- DONE;
- /* fall through */
- }
- operands[1] = gen_compare_reg (LT, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "sge"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (ge:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GE);
- emit_insn (gen_sne (operands[0]));
- DONE;
- }
- else if (TARGET_V9)
- {
- if (gen_v9_scc (GE, operands))
- DONE;
- /* fall through */
- }
- operands[1] = gen_compare_reg (GE, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "sle"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (le:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LE);
- emit_insn (gen_sne (operands[0]));
- DONE;
- }
- else if (TARGET_V9)
- {
- if (gen_v9_scc (LE, operands))
- DONE;
- /* fall through */
- }
- operands[1] = gen_compare_reg (LE, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "sgtu"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (gtu:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (! TARGET_V9)
- {
- rtx tem;
-
- /* We can do ltu easily, so if both operands are registers, swap them and
- do a LTU. */
- if ((GET_CODE (sparc_compare_op0) == REG
- || GET_CODE (sparc_compare_op0) == SUBREG)
- && (GET_CODE (sparc_compare_op1) == REG
- || GET_CODE (sparc_compare_op1) == SUBREG))
- {
- tem = sparc_compare_op0;
- sparc_compare_op0 = sparc_compare_op1;
- sparc_compare_op1 = tem;
- emit_insn (gen_sltu (operands[0]));
- DONE;
- }
- }
- else
- {
- if (gen_v9_scc (GTU, operands))
- DONE;
- }
- operands[1] = gen_compare_reg (GTU, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "sltu"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (ltu:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (TARGET_V9)
- {
- if (gen_v9_scc (LTU, operands))
- DONE;
- }
- operands[1] = gen_compare_reg (LTU, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "sgeu"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (geu:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (TARGET_V9)
- {
- if (gen_v9_scc (GEU, operands))
- DONE;
- }
- operands[1] = gen_compare_reg (GEU, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "sleu"
- [(set (match_operand:SI 0 "intreg_operand" "")
- (leu:SI (match_dup 1) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "
-{
- if (! TARGET_V9)
- {
- rtx tem;
-
- /* We can do geu easily, so if both operands are registers, swap them and
- do a GEU. */
- if ((GET_CODE (sparc_compare_op0) == REG
- || GET_CODE (sparc_compare_op0) == SUBREG)
- && (GET_CODE (sparc_compare_op1) == REG
- || GET_CODE (sparc_compare_op1) == SUBREG))
- {
- tem = sparc_compare_op0;
- sparc_compare_op0 = sparc_compare_op1;
- sparc_compare_op1 = tem;
- emit_insn (gen_sgeu (operands[0]));
- DONE;
- }
- }
- else
- {
- if (gen_v9_scc (LEU, operands))
- DONE;
- }
- operands[1] = gen_compare_reg (LEU, sparc_compare_op0, sparc_compare_op1);
-}")
-
-;; Now the DEFINE_INSNs for the scc cases.
-
-;; The SEQ and SNE patterns are special because they can be done
-;; without any branching and do not involve a COMPARE.
-
-(define_insn "*snesi_zero"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ne:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CC 100))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%1,%%g0\;addx %%g0,0,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*neg_snesi_zero"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (ne:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0))))
- (clobber (reg:CC 100))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%1,%%g0\;subx %%g0,0,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*snesi_zero_extend"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ne:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CC 100))]
- "TARGET_ARCH64"
- "subcc %%g0,%1,%%g0\;addx %%g0,0,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*snedi_zero"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ne:DI (match_operand:DI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CCX 100))]
- "TARGET_ARCH64"
- "mov 0,%0\;movrnz %1,1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*neg_snedi_zero"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (ne:DI (match_operand:DI 1 "register_operand" "r")
- (const_int 0))))
- (clobber (reg:CCX 100))]
- "TARGET_ARCH64"
- "mov 0,%0\;movrnz %1,-1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*snedi_zero_trunc_sp32"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ne:DI (match_operand:DI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CCX 100))]
- "! TARGET_ARCH64 && ! TARGET_LIVE_G0"
- "xor %1,%R1,%0\;subcc %%g0,%0,%%g0\;addx %%g0,0,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "3")])
-
-(define_insn "*snedi_zero_trunc_sp64"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ne:DI (match_operand:DI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CCX 100))]
- "TARGET_ARCH64"
- "mov 0,%0\;movrnz %1,1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*seqsi_zero"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (eq:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CC 100))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%1,%%g0\;subx %%g0,-1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*neg_seqsi_zero"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (eq:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0))))
- (clobber (reg:CC 100))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%1,%%g0\;addx %%g0,-1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*seqsi_zero_extend"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (eq:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CC 100))]
- "TARGET_ARCH64"
- "subcc %%g0,%1,%%g0\;subx %%g0,-1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*seqdi_zero"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (eq:DI (match_operand:DI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CCX 100))]
- "TARGET_ARCH64"
- "mov 0,%0\;movrz %1,1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*neg_seqdi_zero"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (eq:DI (match_operand:DI 1 "register_operand" "r")
- (const_int 0))))
- (clobber (reg:CCX 100))]
- "TARGET_ARCH64"
- "mov 0,%0\;movrz %1,-1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*seqdi_zero_trunc_sp32"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (eq:DI (match_operand:DI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CCX 100))]
- "! TARGET_ARCH64 && ! TARGET_LIVE_G0"
- "xor %1,%R1,%0\;subcc %%g0,%0,%%g0\;subx %%g0,-1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "3")])
-
-(define_insn "*seqdi_zero_trunc_sp64"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (eq:DI (match_operand:DI 1 "register_operand" "r")
- (const_int 0)))
- (clobber (reg:CCX 100))]
- "TARGET_ARCH64"
- "mov 0,%0\;movrz %1,1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-;; We can also do (x + (i == 0)) and related, so put them in.
-;; ??? The addx/subx insns use the 32 bit carry flag so there are no DImode
-;; versions for v9.
-
-(define_insn "*x_plus_i_ne_0"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (ne:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0))
- (match_operand:SI 2 "register_operand" "r")))
- (clobber (reg:CC 100))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%1,%%g0\;addx %2,0,%0"
- [(set_attr "length" "2")])
-
-(define_insn "*x_minus_i_ne_0"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 2 "register_operand" "r")
- (ne:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0))))
- (clobber (reg:CC 100))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%1,%%g0\;subx %2,0,%0"
- [(set_attr "length" "2")])
-
-(define_insn "*x_plus_i_eq_0"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (eq:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0))
- (match_operand:SI 2 "register_operand" "r")))
- (clobber (reg:CC 100))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%1,%%g0\;subx %2,-1,%0"
- [(set_attr "length" "2")])
-
-(define_insn "*x_minus_i_eq_0"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 2 "register_operand" "r")
- (eq:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 0))))
- (clobber (reg:CC 100))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%1,%%g0\;addx %2,-1,%0"
- [(set_attr "length" "2")])
-
-;; We can also do GEU and LTU directly, but these operate after a compare.
-;; ??? The addx/subx insns use the 32 bit carry flag so there are no DImode
-;; versions for v9.
-
-(define_insn "*sltu_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ltu:SI (reg:CC 100) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "addx %%g0,0,%0"
- [(set_attr "type" "misc")])
-
-(define_insn "*neg_sltu_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (ltu:SI (reg:CC 100) (const_int 0))))]
- "! TARGET_LIVE_G0"
- "subx %%g0,0,%0"
- [(set_attr "type" "misc")])
-
-;; ??? Combine should canonicalize these next two to the same pattern.
-(define_insn "*neg_sltu_minus_x"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (neg:SI (ltu:SI (reg:CC 100) (const_int 0)))
- (match_operand:SI 1 "arith_operand" "rI")))]
- "! TARGET_LIVE_G0"
- "subx %%g0,%1,%0"
- [(set_attr "type" "unary")])
-
-(define_insn "*neg_sltu_plus_x"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (plus:SI (ltu:SI (reg:CC 100) (const_int 0))
- (match_operand:SI 1 "arith_operand" "rI"))))]
- "! TARGET_LIVE_G0"
- "subx %%g0,%1,%0"
- [(set_attr "type" "unary")])
-
-(define_insn "*sgeu_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (geu:SI (reg:CC 100) (const_int 0)))]
- "! TARGET_LIVE_G0"
- "subx %%g0,-1,%0"
- [(set_attr "type" "misc")])
-
-(define_insn "*neg_sgeu_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (geu:SI (reg:CC 100) (const_int 0))))]
- "! TARGET_LIVE_G0"
- "addx %%g0,-1,%0"
- [(set_attr "type" "misc")])
-
-;; We can also do (x + ((unsigned) i >= 0)) and related, so put them in.
-;; ??? The addx/subx insns use the 32 bit carry flag so there are no DImode
-;; versions for v9.
-
-(define_insn "*sltu_plus_x"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (ltu:SI (reg:CC 100) (const_int 0))
- (match_operand:SI 1 "arith_operand" "rI")))]
- "! TARGET_LIVE_G0"
- "addx %%g0,%1,%0"
- [(set_attr "type" "unary")])
-
-(define_insn "*sltu_plus_x_plus_y"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (ltu:SI (reg:CC 100) (const_int 0))
- (plus:SI (match_operand:SI 1 "arith_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI"))))]
- ""
- "addx %1,%2,%0")
-
-(define_insn "*x_minus_sltu"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (ltu:SI (reg:CC 100) (const_int 0))))]
- ""
- "subx %1,0,%0"
- [(set_attr "type" "unary")])
-
-;; ??? Combine should canonicalize these next two to the same pattern.
-(define_insn "*x_minus_y_minus_sltu"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (minus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI"))
- (ltu:SI (reg:CC 100) (const_int 0))))]
- ""
- "subx %1,%2,%0")
-
-(define_insn "*x_minus_sltu_plus_y"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (plus:SI (ltu:SI (reg:CC 100) (const_int 0))
- (match_operand:SI 2 "arith_operand" "rI"))))]
- ""
- "subx %1,%2,%0")
-
-(define_insn "*sgeu_plus_x"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (geu:SI (reg:CC 100) (const_int 0))
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "subx %1,-1,%0"
- [(set_attr "type" "unary")])
-
-(define_insn "*x_minus_sgeu"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (geu:SI (reg:CC 100) (const_int 0))))]
- ""
- "addx %1,-1,%0"
- [(set_attr "type" "unary")])
-
-;; Now we have the generic scc insns.
-;; !v9: These will be done using a jump.
-;; v9: Use conditional moves which are defined elsewhere.
-;; We have to exclude the cases above, since we will not want combine to
-;; turn something that does not require a jump into something that does.
-
-(define_insn "*scc_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operator:SI 2 "noov_compare_op"
- [(match_operand 1 "icc_or_fcc_reg_operand" "")
- (const_int 0)]))]
- ""
- "* return output_scc_insn (operands, insn); "
- [(set_attr "type" "multi")
- (set_attr "length" "3")])
-
-(define_insn "*scc_di"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operator:DI 2 "noov_compare_op"
- [(match_operand 1 "icc_or_fcc_reg_operand" "")
- (const_int 0)]))]
- "TARGET_ARCH64"
- "* return output_scc_insn (operands, insn); "
- [(set_attr "type" "multi")
- (set_attr "length" "3")])
-
-;; These control RTL generation for conditional jump insns
-
-;; The quad-word fp compare library routines all return nonzero to indicate
-;; true, which is different from the equivalent libgcc routines, so we must
-;; handle them specially here.
-
-(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode)
- {
- emit_v9_brxx_insn (EQ, sparc_compare_op0, operands[0]);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, EQ);
- emit_jump_insn (gen_bne (operands[0]));
- DONE;
- }
- operands[1] = gen_compare_reg (EQ, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode)
- {
- emit_v9_brxx_insn (NE, sparc_compare_op0, operands[0]);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, NE);
- emit_jump_insn (gen_bne (operands[0]));
- DONE;
- }
- operands[1] = gen_compare_reg (NE, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode)
- {
- emit_v9_brxx_insn (GT, sparc_compare_op0, operands[0]);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GT);
- emit_jump_insn (gen_bne (operands[0]));
- DONE;
- }
- operands[1] = gen_compare_reg (GT, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (GTU, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode)
- {
- emit_v9_brxx_insn (LT, sparc_compare_op0, operands[0]);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LT);
- emit_jump_insn (gen_bne (operands[0]));
- DONE;
- }
- operands[1] = gen_compare_reg (LT, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (LTU, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode)
- {
- emit_v9_brxx_insn (GE, sparc_compare_op0, operands[0]);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GE);
- emit_jump_insn (gen_bne (operands[0]));
- DONE;
- }
- operands[1] = gen_compare_reg (GE, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (GEU, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "ble"
- [(set (pc)
- (if_then_else (le (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{
- if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode)
- {
- emit_v9_brxx_insn (LE, sparc_compare_op0, operands[0]);
- DONE;
- }
- else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD)
- {
- emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LE);
- emit_jump_insn (gen_bne (operands[0]));
- DONE;
- }
- operands[1] = gen_compare_reg (LE, sparc_compare_op0, sparc_compare_op1);
-}")
-
-(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (match_dup 1) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "
-{ operands[1] = gen_compare_reg (LEU, sparc_compare_op0, sparc_compare_op1);
-}")
-
-;; Now match both normal and inverted jump.
-
-(define_insn "*normal_branch"
- [(set (pc)
- (if_then_else (match_operator 0 "noov_compare_op"
- [(reg 100) (const_int 0)])
- (label_ref (match_operand 1 "" ""))
- (pc)))]
- ""
- "*
-{
- return output_cbranch (operands[0], 1, 0,
- final_sequence && INSN_ANNULLED_BRANCH_P (insn),
- ! final_sequence);
-}"
- [(set_attr "type" "branch")])
-
-(define_insn "*inverted_branch"
- [(set (pc)
- (if_then_else (match_operator 0 "noov_compare_op"
- [(reg 100) (const_int 0)])
- (pc)
- (label_ref (match_operand 1 "" ""))))]
- ""
- "*
-{
- return output_cbranch (operands[0], 1, 1,
- final_sequence && INSN_ANNULLED_BRANCH_P (insn),
- ! final_sequence);
-}"
- [(set_attr "type" "branch")])
-
-(define_insn "*normal_fp_branch"
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(match_operand:CCFP 0 "fcc_reg_operand" "c")
- (const_int 0)])
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "*
-{
- return output_cbranch (operands[1], 2, 0,
- final_sequence && INSN_ANNULLED_BRANCH_P (insn),
- ! final_sequence);
-}"
- [(set_attr "type" "branch")])
-
-(define_insn "*inverted_fp_branch"
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(match_operand:CCFP 0 "fcc_reg_operand" "c")
- (const_int 0)])
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "*
-{
- return output_cbranch (operands[1], 2, 1,
- final_sequence && INSN_ANNULLED_BRANCH_P (insn),
- ! final_sequence);
-}"
- [(set_attr "type" "branch")])
-
-(define_insn "*normal_fpe_branch"
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(match_operand:CCFPE 0 "fcc_reg_operand" "c")
- (const_int 0)])
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "*
-{
- return output_cbranch (operands[1], 2, 0,
- final_sequence && INSN_ANNULLED_BRANCH_P (insn),
- ! final_sequence);
-}"
- [(set_attr "type" "branch")])
-
-(define_insn "*inverted_fpe_branch"
- [(set (pc)
- (if_then_else (match_operator 1 "comparison_operator"
- [(match_operand:CCFPE 0 "fcc_reg_operand" "c")
- (const_int 0)])
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "*
-{
- return output_cbranch (operands[1], 2, 1,
- final_sequence && INSN_ANNULLED_BRANCH_P (insn),
- ! final_sequence);
-}"
- [(set_attr "type" "branch")])
-
-;; Sparc V9-specific jump insns. None of these are guaranteed to be
-;; in the architecture.
-
-;; There are no 32 bit brreg insns.
-
-(define_insn "*normal_int_branch_sp64"
- [(set (pc)
- (if_then_else (match_operator 0 "v9_regcmp_op"
- [(match_operand:DI 1 "register_operand" "r")
- (const_int 0)])
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- "TARGET_ARCH64"
- "*
-{
- return output_v9branch (operands[0], 1, 2, 0,
- final_sequence && INSN_ANNULLED_BRANCH_P (insn),
- ! final_sequence);
-}"
- [(set_attr "type" "branch")])
-
-(define_insn "*inverted_int_branch_sp64"
- [(set (pc)
- (if_then_else (match_operator 0 "v9_regcmp_op"
- [(match_operand:DI 1 "register_operand" "r")
- (const_int 0)])
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- "TARGET_ARCH64"
- "*
-{
- return output_v9branch (operands[0], 1, 2, 1,
- final_sequence && INSN_ANNULLED_BRANCH_P (insn),
- ! final_sequence);
-}"
- [(set_attr "type" "branch")])
-
-;; Esoteric move insns (lo_sum, high, pic).
-
-(define_insn "*lo_sum_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "in")))]
- ""
- ;; V9 needs "add" because of the code models. We still use "or" for v8
- ;; so we can compare the old compiler with the new.
- "* return TARGET_ARCH64 ? \"add %1,%%lo(%a2),%0\" : \"or %1,%%lo(%a2),%0\";"
- ;; Need to set length for this arith insn because operand2
- ;; is not an "arith_operand".
- [(set_attr "length" "1")])
-
-;; For PIC, symbol_refs are put inside unspec so that the optimizer will not
-;; confuse them with real addresses.
-(define_insn "pic_lo_sum_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (unspec:SI [(match_operand:SI 2 "immediate_operand" "in")] 0)))]
- "flag_pic"
- ;; V9 needs "add" because of the code models. We still use "or" for v8
- ;; so we can compare the old compiler with the new.
- "* return TARGET_ARCH64 ? \"add %1,%%lo(%a2),%0\" : \"or %1,%%lo(%a2),%0\";"
- ;; Need to set length for this arith insn because operand2
- ;; is not an "arith_operand".
- [(set_attr "length" "1")])
-
-;; The PIC version of sethi must appear before the non-pic case so that
-;; the unspec will not be matched as part of the operand.
-;; For PIC, symbol_refs are put inside unspec so that the optimizer will not
-;; confuse them with real addresses.
-(define_insn "pic_sethi_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (unspec:SI [(match_operand 1 "" "")] 0)))]
- "flag_pic && check_pic (1)"
- "sethi %%hi(%a1),%0"
- [(set_attr "type" "move")
- (set_attr "length" "1")])
-
-(define_insn "*sethi_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (high:SI (match_operand 1 "" "")))]
- "check_pic (1)"
- "sethi %%hi(%a1),%0"
- [(set_attr "type" "move")
- (set_attr "length" "1")])
-
-(define_insn "*sethi_hi"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (high:HI (match_operand 1 "" "")))]
- "check_pic (1)"
- "sethi %%hi(%a1),%0"
- [(set_attr "type" "move")
- (set_attr "length" "1")])
-
-(define_insn "get_pc_sp32"
- [(set (pc) (label_ref (match_operand 0 "" "")))
- (set (reg:SI 15) (label_ref (match_dup 0)))]
- "! TARGET_PTR64"
- "call %l0%#"
- [(set_attr "type" "uncond_branch")])
-
-(define_insn "get_pc_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r") (pc))]
- "TARGET_PTR64"
- "rd %%pc,%0"
- [(set_attr "type" "move")])
-
-;; Special pic pattern, for loading the address of a label into a register.
-;; It clobbers o7 because the call puts the return address (i.e. pc value)
-;; there. The pic tablejump pattern also uses this.
-
-(define_insn "move_pic_label_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- ; This was previously (label_ref:SI (match_operand 1 "" "")) but that
- ; loses the volatil and other flags of the original label_ref.
- (match_operand:SI 1 "label_ref_operand" ""))
- (set (reg:SI 15) (pc))]
- "flag_pic"
- "*
-{
- if (get_attr_length (insn) == 2)
- return \"\\n1:\;call 2f\;add %%o7,%%lo(%l1-1b),%0\\n2:\";
- else
- return \"\\n1:\;call 2f\;sethi %%hi(%l1-1b),%0\\n2:\\tor %0,%%lo(%l1-1b),%0\;add %0,%%o7,%0\";
-}"
- [(set_attr "type" "multi")
- ; 960 = 4096 bytes / 4 bytes/insn - 64 (for not always perfect length calcs)
- (set (attr "length") (if_then_else (ltu (minus (match_dup 1) (pc))
- (const_int 960))
- (const_int 2)
- (const_int 4)))])
-
-;; Special sparc64 pattern for loading the address of a label into a register.
-;; The pic and non-pic cases are the same since it's the most efficient way.
-;;
-;; ??? The non-pic case doesn't need to use %o7, we could use a scratch
-;; instead. But the pic case doesn't need to use %o7 either. We handle them
-;; both here so that when this is fixed, they can both be fixed together.
-;; Don't forget that the pic jump table stuff uses %o7 (that will need to be
-;; changed too).
-
-(define_insn "move_label_di"
- [(set (match_operand:DI 0 "register_operand" "=r")
- ; This was previously (label_ref:DI (match_operand 1 "" "")) but that
- ; loses the volatil and other flags of the original label_ref.
- (match_operand:DI 1 "label_ref_operand" ""))
- (set (reg:DI 15) (pc))]
- "TARGET_ARCH64"
- "*
-{
- if (get_attr_length (insn) == 2)
- return \"\\n1:\;rd %%pc,%%o7\;add %%o7,%l1-1b,%0\";
- else
- return \"\\n1:\;rd %%pc,%%o7\;sethi %%hi(%l1-1b),%0\;add %0,%%lo(%l1-1b),%0\;sra %0,0,%0\;add %0,%%o7,%0\";
-}"
- [(set_attr "type" "multi")
- ; 960 = 4096 bytes / 4 bytes/insn - 64 (for not always perfect length calcs)
- (set (attr "length") (if_then_else (ltu (minus (match_dup 1) (pc))
- (const_int 960))
- (const_int 2)
- (const_int 5)))])
-
-(define_insn "*lo_sum_di_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (lo_sum:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:DI 2 "immediate_operand" "in")))]
- "! TARGET_ARCH64"
- "*
-{
- /* Don't output a 64 bit constant, since we can't trust the assembler to
- handle it correctly. */
- if (GET_CODE (operands[2]) == CONST_DOUBLE)
- operands[2] = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (operands[2]));
- return \"or %L1,%%lo(%a2),%L0\";
-}"
- ;; Need to set length for this arith insn because operand2
- ;; is not an "arith_operand".
- [(set_attr "length" "1")])
-
-;; ??? Optimizer does not handle "or %o1,%lo(0),%o1". How about add?
-
-(define_insn "*lo_sum_di_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (lo_sum:DI (match_operand:DI 1 "register_operand" "0")
- (match_operand:DI 2 "immediate_operand" "in")))]
- "TARGET_ARCH64"
- "*
-{
- /* Don't output a 64 bit constant, since we can't trust the assembler to
- handle it correctly. */
- if (GET_CODE (operands[2]) == CONST_DOUBLE)
- operands[2] = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (operands[2]));
- /* Note that we use add here. This is important because Medium/Anywhere
- code model support depends on it. */
- return \"add %1,%%lo(%a2),%0\";
-}"
- ;; Need to set length for this arith insn because operand2
- ;; is not an "arith_operand".
- [(set_attr "length" "1")])
-
-(define_insn "*sethi_di_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (high:DI (match_operand 1 "" "")))]
- "! TARGET_ARCH64 && check_pic (1)"
- "*
-{
- rtx op0 = operands[0];
- rtx op1 = operands[1];
-
- if (GET_CODE (op1) == CONST_INT)
- {
- operands[0] = operand_subword (op0, 1, 0, DImode);
- output_asm_insn (\"sethi %%hi(%a1),%0\", operands);
-
- operands[0] = operand_subword (op0, 0, 0, DImode);
- if (INTVAL (op1) < 0)
- return \"mov -1,%0\";
- else
- return \"mov 0,%0\";
- }
- else if (GET_CODE (op1) == CONST_DOUBLE)
- {
- operands[0] = operand_subword (op0, 1, 0, DImode);
- operands[1] = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (op1));
- output_asm_insn (\"sethi %%hi(%a1),%0\", operands);
-
- operands[0] = operand_subword (op0, 0, 0, DImode);
- operands[1] = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_HIGH (op1));
- return singlemove_string (operands);
- }
- else
- abort ();
- return \"\";
-}"
- [(set_attr "type" "move")
- (set_attr "length" "2")])
-
-;;; ??? This pattern originally clobbered a scratch register. However, this
-;;; is invalid, the movdi pattern may not use a temp register because it
-;;; may be called from reload to reload a DImode value. In that case, we
-;;; end up with a scratch register that never gets allocated. To avoid this,
-;;; we use global register 1 which is never otherwise used by gcc as a temp.
-;;; The correct solution here might be to force DImode constants to memory,
-;;; e.g. by using a toc like the romp and rs6000 ports do for addresses, reg
-;;; 1 will then no longer need to be considered a fixed reg.
-
-(define_expand "sethi_di_sp64"
- [(parallel
- [(set (match_operand:DI 0 "register_operand" "")
- (high:DI (match_operand 1 "general_operand" "")))
- (clobber (reg:DI 1))])]
- "TARGET_ARCH64"
- "")
-
-(define_insn "*sethi_di_sp64_const"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (high:DI (match_operand 1 "const_double_operand" "")))
- (clobber (reg:DI 1))]
- "TARGET_ARCH64 && check_pic (1)"
- "*
-{
- rtx high, low;
-
- split_double (operands[1], &high, &low);
-
- if (high == const0_rtx)
- {
- operands[1] = low;
- output_asm_insn (\"sethi %%hi(%a1),%0\", operands);
- }
- else
- {
- operands[1] = high;
- output_asm_insn (singlemove_string (operands), operands);
-
- operands[1] = low;
- output_asm_insn (\"sllx %0,32,%0\", operands);
- if (low != const0_rtx)
- output_asm_insn (\"sethi %%hi(%a1),%%g1; or %0,%%g1,%0\", operands);
- }
-
- return \"\";
-}"
- [(set_attr "type" "move")
- (set_attr "length" "5")])
-
-;; Most of the required support for the various code models is here.
-;; We can do this because sparcs need the high insn to load the address. We
-;; just need to get high to do the right thing for each code model. Then each
-;; uses the same "%X+%lo(...)" in the load/store insn.
-
-;; When TARGET_MEDLOW, assume that the upper 32 bits of symbol addresses are
-;; always 0.
-;; When TARGET_MEDANY, the text and data segments have a maximum size of 32
-;; bits and may be located anywhere. MEDANY_BASE_REG contains the start
-;; address of the data segment, currently %g4.
-;; When TARGET_FULLANY, symbolic addresses are 64 bits.
-
-(define_insn "*sethi_di_medlow"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (high:DI (match_operand 1 "" "")))
- ;; The clobber is here because emit_move_sequence assumes the worst case.
- (clobber (reg:DI 1))]
- "TARGET_MEDLOW && check_pic (1)"
- "sethi %%hi(%a1),%0"
- [(set_attr "type" "move")
- (set_attr "length" "1")])
-
-(define_insn "*sethi_di_medium_pic"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (high:DI (match_operand 1 "sp64_medium_pic_operand" "")))]
- "(TARGET_MEDLOW || TARGET_MEDANY) && check_pic (1)"
- "sethi %%hi(%a1),%0"
- [(set_attr "type" "move")
- (set_attr "length" "1")])
-
-;; WARNING: %0 gets %hi(%1)+%g4.
-;; You cannot OR in %lo(%1), it must be added in.
-
-(define_insn "*sethi_di_medany_data"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (high:DI (match_operand 1 "data_segment_operand" "")))
- ;; The clobber is here because emit_move_sequence assumes the worst case.
- (clobber (reg:DI 1))]
- "TARGET_MEDANY && check_pic (1)"
- "sethi %%hi(%a1),%0; add %0,%%g4,%0"
- [(set_attr "type" "move")
- (set_attr "length" "2")])
-
-(define_insn "*sethi_di_medany_text"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (high:DI (match_operand 1 "text_segment_operand" "")))
- ;; The clobber is here because emit_move_sequence assumes the worst case.
- (clobber (reg:DI 1))]
- "TARGET_MEDANY && check_pic (1)"
- "sethi %%uhi(%a1),%%g1; or %%g1,%%ulo(%a1),%%g1; sllx %%g1,32,%%g1; sethi %%hi(%a1),%0; or %0,%%g1,%0"
- [(set_attr "type" "move")
- (set_attr "length" "5")])
-
-(define_insn "*sethi_di_fullany"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (high:DI (match_operand 1 "" "")))
- (clobber (reg:DI 1))]
- "TARGET_FULLANY && check_pic (1)"
- "sethi %%uhi(%a1),%%g1; or %%g1,%%ulo(%a1),%%g1; sllx %%g1,32,%%g1; sethi %%hi(%a1),%0; or %0,%%g1,%0"
- [(set_attr "type" "move")
- (set_attr "length" "5")])
-
-;; Move instructions
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, QImode))
- DONE;
-}")
-
-(define_insn "*movqi_insn"
- [(set (match_operand:QI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,Q")
- (match_operand:QI 1 "move_operand" "rI,K,Q,rJ"))]
- "! TARGET_LIVE_G0
- && (register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode)
- || operands[1] == const0_rtx)"
- "@
- mov %1,%0
- sethi %%hi(%a1),%0
- ldub %1,%0
- stb %r1,%0"
- [(set_attr "type" "move,move,load,store")
- (set_attr "length" "1")])
-
-(define_insn "*movqi_insn_liveg0"
- [(set (match_operand:QI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,Q")
- (match_operand:QI 1 "move_operand" "r,J,I,K,Q,r"))]
- "TARGET_LIVE_G0
- && (register_operand (operands[0], QImode)
- || register_operand (operands[1], QImode))"
- "@
- mov %1,%0
- and %0,0,%0
- and %0,0,%0\;or %0,%1,%0
- sethi %%hi(%a1),%0
- ldub %1,%0
- stb %1,%0"
- [(set_attr "type" "move,move,move,move,load,store")
- (set_attr "length" "1,1,2,1,1,1")])
-
-(define_insn "*lo_sum_qi"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (subreg:QI (lo_sum:SI (match_operand:QI 1 "register_operand" "r")
- (match_operand 2 "immediate_operand" "in")) 0))]
- ""
- "or %1,%%lo(%a2),%0"
- [(set_attr "length" "1")])
-
-(define_insn "*store_qi"
- [(set (mem:QI (match_operand:SI 0 "symbolic_operand" ""))
- (match_operand:QI 1 "reg_or_0_operand" "rJ"))
- (clobber (match_scratch:SI 2 "=&r"))]
- "(reload_completed || reload_in_progress)
- && ! TARGET_PTR64"
- "sethi %%hi(%a0),%2\;stb %r1,[%2+%%lo(%a0)]"
- [(set_attr "type" "store")
- (set_attr "length" "2")])
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, HImode))
- DONE;
-}")
-
-(define_insn "*movhi_insn"
- [(set (match_operand:HI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,Q")
- (match_operand:HI 1 "move_operand" "rI,K,Q,rJ"))]
- "! TARGET_LIVE_G0
- && (register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode)
- || operands[1] == const0_rtx)"
- "@
- mov %1,%0
- sethi %%hi(%a1),%0
- lduh %1,%0
- sth %r1,%0"
- [(set_attr "type" "move,move,load,store")
- (set_attr "length" "1")])
-
-(define_insn "*movhi_insn_liveg0"
- [(set (match_operand:HI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,Q")
- (match_operand:HI 1 "move_operand" "r,J,I,K,Q,r"))]
- "TARGET_LIVE_G0
- && (register_operand (operands[0], HImode)
- || register_operand (operands[1], HImode))"
- "@
- mov %1,%0
- and %0,0,%0
- and %0,0,%0\;or %0,%1,%0
- sethi %%hi(%a1),%0
- lduh %1,%0
- sth %1,%0"
- [(set_attr "type" "move,move,move,move,load,store")
- (set_attr "length" "1,1,2,1,1,1")])
-
-(define_insn "*lo_sum_hi"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (lo_sum:HI (match_operand:HI 1 "register_operand" "r")
- (match_operand 2 "immediate_operand" "in")))]
- ""
- "or %1,%%lo(%a2),%0"
- [(set_attr "length" "1")])
-
-(define_insn "*store_hi"
- [(set (mem:HI (match_operand:SI 0 "symbolic_operand" ""))
- (match_operand:HI 1 "reg_or_0_operand" "rJ"))
- (clobber (match_scratch:SI 2 "=&r"))]
- "(reload_completed || reload_in_progress)
- && ! TARGET_PTR64"
- "sethi %%hi(%a0),%2\;sth %r1,[%2+%%lo(%a0)]"
- [(set_attr "type" "store")
- (set_attr "length" "2")])
-
-(define_expand "movsi"
- [(set (match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, SImode))
- DONE;
-}")
-
-;; We must support both 'r' and 'f' registers here, because combine may
-;; convert SFmode hard registers to SImode hard registers when simplifying
-;; subreg sets.
-
-;; We cannot combine the similar 'r' and 'f' constraints, because it causes
-;; problems with register allocation. Reload might try to put an integer
-;; in an fp register, or an fp number is an integer register.
-
-(define_insn "*movsi_insn"
- [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand" "=r,f,r,r,f,Q,Q")
- (match_operand:SI 1 "move_operand" "rI,!f,K,Q,!Q,rJ,!f"))]
- "! TARGET_LIVE_G0
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode)
- || operands[1] == const0_rtx)"
- "@
- mov %1,%0
- fmovs %1,%0
- sethi %%hi(%a1),%0
- ld %1,%0
- ld %1,%0
- st %r1,%0
- st %1,%0"
- [(set_attr "type" "move,fp,move,load,fpload,store,fpstore")
- (set_attr "length" "1")])
-
-(define_insn "*movsi_insn_liveg0"
- [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,f,r,r,f,Q,Q")
- (match_operand:SI 1 "move_operand" "r,J,I,!f,K,Q,!Q,r,!f"))]
- "TARGET_LIVE_G0
- && (register_operand (operands[0], SImode)
- || register_operand (operands[1], SImode))"
- "@
- mov %1,%0
- and %0,0,%0
- and %0,0,%0\;or %0,%1,%0
- fmovs %1,%0
- sethi %%hi(%a1),%0
- ld %1,%0
- ld %1,%0
- st %1,%0
- st %1,%0"
- [(set_attr "type" "move,move,move,fp,move,load,fpload,store,fpstore")
- (set_attr "length" "1,1,2,1,1,1,1,1,1")])
-
-(define_insn "*store_si"
- [(set (mem:SI (match_operand:SI 0 "symbolic_operand" ""))
- (match_operand:SI 1 "reg_or_0_operand" "rJ"))
- (clobber (match_scratch:SI 2 "=&r"))]
- "(reload_completed || reload_in_progress)
- && ! TARGET_PTR64"
- "sethi %%hi(%a0),%2\;st %r1,[%2+%%lo(%a0)]"
- [(set_attr "type" "store")
- (set_attr "length" "2")])
-
-(define_expand "movdi"
- [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand" "")
- (match_operand:DI 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, DImode))
- DONE;
-}")
-
-(define_insn "*movdi_sp32_insn"
- [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand" "=r,T,U,Q,r,r,?f,?f,?Q")
- (match_operand:DI 1 "general_operand" "r,U,T,r,Q,i,f,Q,f"))]
- "! TARGET_ARCH64
- && (register_operand (operands[0], DImode)
- || register_operand (operands[1], DImode)
- || operands[1] == const0_rtx)"
- "*
-{
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}"
- [(set_attr "type" "move,store,load,store,load,multi,fp,fpload,fpstore")
- (set_attr "length" "2,1,1,3,3,3,2,3,3")])
-
-;;; ??? The trick used below can be extended to load any negative 32 bit
-;;; constant in two instructions. Currently the compiler will use HIGH/LO_SUM
-;;; for anything not matching the HIK constraints, which results in 5
-;;; instructions. Positive 32 bit constants can be loaded in the obvious way
-;;; with sethi/ori. To extend the trick, in the xor instruction, use
-;;; xor %o0, ((op1 & 0x3ff) | -0x400), %o0
-;;; This needs the original value of operands[1], not the inverted value.
-
-(define_insn "*movdi_sp64_insn"
- [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,Q,?f,?f,?Q")
- (match_operand:DI 1 "move_operand" "rI,K,Q,rJ,f,Q,f"))]
- "TARGET_ARCH64
- && (register_operand (operands[0], DImode)
- || register_operand (operands[1], DImode)
- || operands[1] == const0_rtx)"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- return \"mov %1,%0\";
- case 1:
- /* Sethi does not sign extend, so we must use a little trickery
- to use it for negative numbers. Invert the constant before
- loading it in, then use a xor immediate to invert the loaded bits
- (along with the upper 32 bits) to the desired constant. This
- works because the sethi and immediate fields overlap. */
-
- if ((INTVAL (operands[1]) & 0x80000000) == 0)
- return \"sethi %%hi(%a1),%0\";
- else
- {
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- ~ INTVAL (operands[1]));
- output_asm_insn (\"sethi %%hi(%a1),%0\", operands);
- /* The low 10 bits are already zero, but invert the rest.
- Assemblers don't accept 0x1c00, so use -0x400 instead. */
- return \"xor %0,-0x400,%0\";
- }
- case 2:
- return \"ldx %1,%0\";
- case 3:
- return \"stx %r1,%0\";
- case 4:
- return \"mov %1,%0\";
- case 5:
- return \"ldd %1,%0\";
- case 6:
- return \"std %1,%0\";
- }
-}"
- [(set_attr "type" "move,move,load,store,fp,fpload,fpstore")
- (set_attr "length" "1,2,1,1,1,1,1")])
-
-;; ??? There's no symbolic (set (mem:DI ...) ...).
-;; Experimentation with v9 suggested one isn't needed.
-
-;; Block move insns.
-
-;; ??? We get better code without it. See output_block_move in sparc.c.
-
-;; The definition of this insn does not really explain what it does,
-;; but it should suffice
-;; that anything generated as this insn will be recognized as one
-;; and that it will not successfully combine with anything.
-;(define_expand "movstrsi"
-; [(parallel [(set (mem:BLK (match_operand:BLK 0 "general_operand" ""))
-; (mem:BLK (match_operand:BLK 1 "general_operand" "")))
-; (use (match_operand:SI 2 "nonmemory_operand" ""))
-; (use (match_operand:SI 3 "immediate_operand" ""))
-; (clobber (match_dup 0))
-; (clobber (match_dup 1))
-; (clobber (match_scratch:SI 4 ""))
-; (clobber (reg:SI 100))
-; (clobber (reg:SI 1))])]
-; ""
-; "
-;{
-; /* If the size isn't known, don't emit inline code. output_block_move
-; would output code that's much slower than the library function.
-; Also don't output code for large blocks. */
-; if (GET_CODE (operands[2]) != CONST_INT
-; || GET_CODE (operands[3]) != CONST_INT
-; || INTVAL (operands[2]) / INTVAL (operands[3]) > 16)
-; FAIL;
-;
-; operands[0] = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
-; operands[1] = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
-; operands[2] = force_not_mem (operands[2]);
-;}")
-
-;(define_insn "*block_move_insn"
-; [(set (mem:BLK (match_operand:SI 0 "register_operand" "+r"))
-; (mem:BLK (match_operand:SI 1 "register_operand" "+r")))
-; (use (match_operand:SI 2 "nonmemory_operand" "rn"))
-; (use (match_operand:SI 3 "immediate_operand" "i"))
-; (clobber (match_dup 0))
-; (clobber (match_dup 1))
-; (clobber (match_scratch:SI 4 "=&r"))
-; (clobber (reg:SI 100))
-; (clobber (reg:SI 1))]
-; ""
-; "* return output_block_move (operands);"
-; [(set_attr "type" "multi")
-; (set_attr "length" "6")])
-
-;; Floating point move insns
-
-;; This pattern forces (set (reg:SF ...) (const_double ...))
-;; to be reloaded by putting the constant into memory.
-;; It must come before the more general movsf pattern.
-(define_insn "*movsf_const_insn"
- [(set (match_operand:SF 0 "general_operand" "=?r,f,m")
- (match_operand:SF 1 "" "?F,m,G"))]
- "TARGET_FPU && GET_CODE (operands[1]) == CONST_DOUBLE"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- return singlemove_string (operands);
- case 1:
- return \"ld %1,%0\";
- case 2:
- return \"st %%g0,%0\";
- }
-}"
- [(set_attr "type" "load,fpload,store")
- (set_attr "length" "2,1,1")])
-
-(define_expand "movsf"
- [(set (match_operand:SF 0 "general_operand" "")
- (match_operand:SF 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, SFmode))
- DONE;
-}")
-
-(define_insn "*movsf_insn"
- [(set (match_operand:SF 0 "reg_or_nonsymb_mem_operand" "=f,r,f,r,Q,Q")
- (match_operand:SF 1 "reg_or_nonsymb_mem_operand" "f,r,Q,Q,f,r"))]
- "TARGET_FPU
- && (register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode))"
- "@
- fmovs %1,%0
- mov %1,%0
- ld %1,%0
- ld %1,%0
- st %1,%0
- st %1,%0"
- [(set_attr "type" "fp,move,fpload,load,fpstore,store")])
-
-;; Exactly the same as above, except that all `f' cases are deleted.
-;; This is necessary to prevent reload from ever trying to use a `f' reg
-;; when -mno-fpu.
-
-(define_insn "*movsf_no_f_insn"
- [(set (match_operand:SF 0 "reg_or_nonsymb_mem_operand" "=r,r,Q")
- (match_operand:SF 1 "reg_or_nonsymb_mem_operand" "r,Q,r"))]
- "! TARGET_FPU
- && (register_operand (operands[0], SFmode)
- || register_operand (operands[1], SFmode))"
- "@
- mov %1,%0
- ld %1,%0
- st %1,%0"
- [(set_attr "type" "move,load,store")])
-
-(define_insn "*store_sf"
- [(set (mem:SF (match_operand:SI 0 "symbolic_operand" "i"))
- (match_operand:SF 1 "reg_or_0_operand" "rfG"))
- (clobber (match_scratch:SI 2 "=&r"))]
- "(reload_completed || reload_in_progress)
- && ! TARGET_PTR64"
- "sethi %%hi(%a0),%2\;st %r1,[%2+%%lo(%a0)]"
- [(set_attr "type" "store")
- (set_attr "length" "2")])
-
-;; This pattern forces (set (reg:DF ...) (const_double ...))
-;; to be reloaded by putting the constant into memory.
-;; It must come before the more general movdf pattern.
-
-(define_insn "*movdf_const_insn"
- [(set (match_operand:DF 0 "general_operand" "=?r,e,o")
- (match_operand:DF 1 "" "?F,m,G"))]
- "TARGET_FPU && GET_CODE (operands[1]) == CONST_DOUBLE"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- return output_move_double (operands);
- case 1:
- return output_fp_move_double (operands);
- case 2:
- if (TARGET_ARCH64)
- {
- return \"stx %%g0,%0\";
- }
- else
- {
- operands[1] = adj_offsettable_operand (operands[0], 4);
- return \"st %%g0,%0\;st %%g0,%1\";
- }
- }
-}"
- [(set_attr "type" "load,fpload,store")
- (set_attr "length" "3,3,3")])
-
-(define_expand "movdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (match_operand:DF 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, DFmode))
- DONE;
-}")
-
-(define_insn "*movdf_insn"
- [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand" "=T,U,e,r,Q,Q,e,r")
- (match_operand:DF 1 "reg_or_nonsymb_mem_operand" "U,T,e,r,e,r,Q,Q"))]
- "TARGET_FPU
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode))"
- "*
-{
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}"
- [(set_attr "type" "fpstore,fpload,fp,move,fpstore,store,fpload,load")
- (set_attr "length" "1,1,2,2,3,3,3,3")])
-
-;; Exactly the same as above, except that all `e' cases are deleted.
-;; This is necessary to prevent reload from ever trying to use a `e' reg
-;; when -mno-fpu.
-
-(define_insn "*movdf_no_e_insn"
- [(set (match_operand:DF 0 "reg_or_nonsymb_mem_operand" "=T,U,r,Q,&r")
- (match_operand:DF 1 "reg_or_nonsymb_mem_operand" "U,T,r,r,Q"))]
- "! TARGET_FPU
- && (register_operand (operands[0], DFmode)
- || register_operand (operands[1], DFmode))"
- "* return output_move_double (operands);"
- [(set_attr "type" "store,load,move,store,load")
- (set_attr "length" "1,1,2,3,3")])
-
-;; Must handle overlapping registers here, since parameters can be unaligned
-;; in registers.
-
-(define_split
- [(set (match_operand:DF 0 "register_operand" "")
- (match_operand:DF 1 "register_operand" ""))]
- "! TARGET_ARCH64 && reload_completed
- && REGNO (operands[0]) < SPARC_FIRST_V9_FP_REG
- && REGNO (operands[1]) < SPARC_FIRST_V9_FP_REG"
- [(set (match_dup 2) (match_dup 3))
- (set (match_dup 4) (match_dup 5))]
- "
-{
- rtx first_set = operand_subword (operands[0], 0, 0, DFmode);
- rtx second_use = operand_subword (operands[1], 1, 0, DFmode);
-
- if (REGNO (first_set) == REGNO (second_use))
- {
- operands[2] = operand_subword (operands[0], 1, 0, DFmode);
- operands[3] = second_use;
- operands[4] = first_set;
- operands[5] = operand_subword (operands[1], 0, 0, DFmode);
- }
- else
- {
- operands[2] = first_set;
- operands[3] = operand_subword (operands[1], 0, 0, DFmode);
- operands[4] = operand_subword (operands[0], 1, 0, DFmode);
- operands[5] = second_use;
- }
-}")
-
-(define_insn "*store_df"
- [(set (mem:DF (match_operand:SI 0 "symbolic_operand" "i,i"))
- (match_operand:DF 1 "reg_or_0_operand" "re,G"))
- (clobber (match_scratch:SI 2 "=&r,&r"))]
- "(reload_completed || reload_in_progress)
- && ! TARGET_PTR64"
- "*
-{
- output_asm_insn (\"sethi %%hi(%a0),%2\", operands);
- if (which_alternative == 0)
- return \"std %1,[%2+%%lo(%a0)]\";
- else
- return \"st %%g0,[%2+%%lo(%a0)]\;st %%g0,[%2+%%lo(%a0+4)]\";
-}"
- [(set_attr "type" "store")
- (set_attr "length" "3")])
-
-;; This pattern forces (set (reg:TF ...) (const_double ...))
-;; to be reloaded by putting the constant into memory.
-;; It must come before the more general movtf pattern.
-(define_insn "*movtf_const_insn"
- [(set (match_operand:TF 0 "general_operand" "=?r,e,o")
- (match_operand:TF 1 "" "?F,m,G"))]
- "TARGET_FPU && GET_CODE (operands[1]) == CONST_DOUBLE"
- "*
-{
- switch (which_alternative)
- {
- case 0:
- return output_move_quad (operands);
- case 1:
- return output_fp_move_quad (operands);
- case 2:
- if (TARGET_ARCH64)
- {
- operands[1] = adj_offsettable_operand (operands[0], 8);
- return \"stx %%g0,%0\;stx %%g0,%1\";
- }
- else
- {
- /* ??? Do we run off the end of the array here? */
- operands[1] = adj_offsettable_operand (operands[0], 4);
- operands[2] = adj_offsettable_operand (operands[0], 8);
- operands[3] = adj_offsettable_operand (operands[0], 12);
- return \"st %%g0,%0\;st %%g0,%1\;st %%g0,%2\;st %%g0,%3\";
- }
- }
-}"
- [(set_attr "type" "load,fpload,store")
- (set_attr "length" "5,5,5")])
-
-(define_expand "movtf"
- [(set (match_operand:TF 0 "general_operand" "")
- (match_operand:TF 1 "general_operand" ""))]
- ""
- "
-{
- if (emit_move_sequence (operands, TFmode))
- DONE;
-}")
-
-(define_insn "*movtf_insn"
- [(set (match_operand:TF 0 "reg_or_nonsymb_mem_operand" "=e,r,Q,Q,e,&r")
- (match_operand:TF 1 "reg_or_nonsymb_mem_operand" "e,r,e,r,Q,Q"))]
- "TARGET_FPU
- && (register_operand (operands[0], TFmode)
- || register_operand (operands[1], TFmode))"
- "*
-{
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return output_fp_move_quad (operands);
- return output_move_quad (operands);
-}"
- [(set_attr "type" "fp,move,fpstore,store,fpload,load")
- (set_attr "length" "4,4,5,5,5,5")])
-
-;; Exactly the same as above, except that all `e' cases are deleted.
-;; This is necessary to prevent reload from ever trying to use a `e' reg
-;; when -mno-fpu.
-
-(define_insn "*movtf_no_e_insn"
- [(set (match_operand:TF 0 "reg_or_nonsymb_mem_operand" "=r,Q,&r")
- (match_operand:TF 1 "reg_or_nonsymb_mem_operand" "r,r,Q"))]
- "! TARGET_FPU
- && (register_operand (operands[0], TFmode)
- || register_operand (operands[1], TFmode))"
- "*
-{
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return output_fp_move_quad (operands);
- return output_move_quad (operands);
-}"
- [(set_attr "type" "move,store,load")
- (set_attr "length" "4,5,5")])
-
-;; This is disabled because it does not work. Long doubles have only 8
-;; byte alignment. Adding an offset of 8 or 12 to an 8 byte aligned %lo may
-;; cause it to overflow. See also GO_IF_LEGITIMATE_ADDRESS.
-(define_insn "*store_tf"
- [(set (mem:TF (match_operand:SI 0 "symbolic_operand" "i,i"))
- (match_operand:TF 1 "reg_or_0_operand" "re,G"))
- (clobber (match_scratch:SI 2 "=&r,&r"))]
- "0 && (reload_completed || reload_in_progress)
- && ! TARGET_PTR64"
- "*
-{
- output_asm_insn (\"sethi %%hi(%a0),%2\", operands);
- if (which_alternative == 0)
- return \"std %1,[%2+%%lo(%a0)]\;std %S1,[%2+%%lo(%a0+8)]\";
- else
- return \"st %%g0,[%2+%%lo(%a0)]\;st %%g0,[%2+%%lo(%a0+4)]\; st %%g0,[%2+%%lo(%a0+8)]\;st %%g0,[%2+%%lo(%a0+12)]\";
-}"
- [(set_attr "type" "store")
- (set_attr "length" "5")])
-
-;; Sparc V9 conditional move instructions.
-
-;; We can handle larger constants here for some flavors, but for now we keep
-;; it simple and only allow those constants supported by all flavours.
-;; Note that emit_conditional_move canonicalizes operands 2,3 so that operand
-;; 3 contains the constant if one is present, but we handle either for
-;; generality (sparc.c puts a constant in operand 2).
-
-(define_expand "movqicc"
- [(set (match_operand:QI 0 "register_operand" "")
- (if_then_else:QI (match_operand 1 "comparison_operator" "")
- (match_operand:QI 2 "arith10_operand" "")
- (match_operand:QI 3 "arith10_operand" "")))]
- "TARGET_V9"
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
-
- if (GET_MODE (sparc_compare_op0) == DImode
- && ! TARGET_ARCH64)
- FAIL;
-
- if (sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode
- && v9_regcmp_p (code))
- {
- operands[1] = gen_rtx (code, DImode,
- sparc_compare_op0, sparc_compare_op1);
- }
- else
- {
- rtx cc_reg = gen_compare_reg (code,
- sparc_compare_op0, sparc_compare_op1);
- operands[1] = gen_rtx (code, GET_MODE (cc_reg), cc_reg, const0_rtx);
- }
-}")
-
-(define_expand "movhicc"
- [(set (match_operand:HI 0 "register_operand" "")
- (if_then_else:HI (match_operand 1 "comparison_operator" "")
- (match_operand:HI 2 "arith10_operand" "")
- (match_operand:HI 3 "arith10_operand" "")))]
- "TARGET_V9"
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
-
- if (GET_MODE (sparc_compare_op0) == DImode
- && ! TARGET_ARCH64)
- FAIL;
-
- if (sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode
- && v9_regcmp_p (code))
- {
- operands[1] = gen_rtx (code, DImode,
- sparc_compare_op0, sparc_compare_op1);
- }
- else
- {
- rtx cc_reg = gen_compare_reg (code,
- sparc_compare_op0, sparc_compare_op1);
- operands[1] = gen_rtx (code, GET_MODE (cc_reg), cc_reg, const0_rtx);
- }
-}")
-
-(define_expand "movsicc"
- [(set (match_operand:SI 0 "register_operand" "")
- (if_then_else:SI (match_operand 1 "comparison_operator" "")
- (match_operand:SI 2 "arith10_operand" "")
- (match_operand:SI 3 "arith10_operand" "")))]
- "TARGET_V9"
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
-
- if (GET_MODE (sparc_compare_op0) == DImode
- && ! TARGET_ARCH64)
- FAIL;
-
- if (sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode
- && v9_regcmp_p (code))
- {
- operands[1] = gen_rtx (code, DImode,
- sparc_compare_op0, sparc_compare_op1);
- }
- else
- {
- rtx cc_reg = gen_compare_reg (code,
- sparc_compare_op0, sparc_compare_op1);
- operands[1] = gen_rtx (code, GET_MODE (cc_reg), cc_reg, const0_rtx);
- }
-}")
-
-(define_expand "movdicc"
- [(set (match_operand:DI 0 "register_operand" "")
- (if_then_else:DI (match_operand 1 "comparison_operator" "")
- (match_operand:DI 2 "arith10_double_operand" "")
- (match_operand:DI 3 "arith10_double_operand" "")))]
- "TARGET_ARCH64"
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
-
- if (sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode
- && v9_regcmp_p (code))
- {
- operands[1] = gen_rtx (code, DImode,
- sparc_compare_op0, sparc_compare_op1);
- }
- else
- {
- rtx cc_reg = gen_compare_reg (code,
- sparc_compare_op0, sparc_compare_op1);
- operands[1] = gen_rtx (code, GET_MODE (cc_reg), cc_reg, const0_rtx);
- }
-}")
-
-(define_expand "movsfcc"
- [(set (match_operand:SF 0 "register_operand" "")
- (if_then_else:SF (match_operand 1 "comparison_operator" "")
- (match_operand:SF 2 "register_operand" "")
- (match_operand:SF 3 "register_operand" "")))]
- "TARGET_V9 && TARGET_FPU"
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
-
- if (GET_MODE (sparc_compare_op0) == DImode
- && ! TARGET_ARCH64)
- FAIL;
-
- if (sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode
- && v9_regcmp_p (code))
- {
- operands[1] = gen_rtx (code, DImode,
- sparc_compare_op0, sparc_compare_op1);
- }
- else
- {
- rtx cc_reg = gen_compare_reg (code,
- sparc_compare_op0, sparc_compare_op1);
- operands[1] = gen_rtx (code, GET_MODE (cc_reg), cc_reg, const0_rtx);
- }
-}")
-
-(define_expand "movdfcc"
- [(set (match_operand:DF 0 "register_operand" "")
- (if_then_else:DF (match_operand 1 "comparison_operator" "")
- (match_operand:DF 2 "register_operand" "")
- (match_operand:DF 3 "register_operand" "")))]
- "TARGET_V9 && TARGET_FPU"
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
-
- if (GET_MODE (sparc_compare_op0) == DImode
- && ! TARGET_ARCH64)
- FAIL;
-
- if (sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode
- && v9_regcmp_p (code))
- {
- operands[1] = gen_rtx (code, DImode,
- sparc_compare_op0, sparc_compare_op1);
- }
- else
- {
- rtx cc_reg = gen_compare_reg (code,
- sparc_compare_op0, sparc_compare_op1);
- operands[1] = gen_rtx (code, GET_MODE (cc_reg), cc_reg, const0_rtx);
- }
-}")
-
-(define_expand "movtfcc"
- [(set (match_operand:TF 0 "register_operand" "")
- (if_then_else:TF (match_operand 1 "comparison_operator" "")
- (match_operand:TF 2 "register_operand" "")
- (match_operand:TF 3 "register_operand" "")))]
- "TARGET_V9 && TARGET_FPU"
- "
-{
- enum rtx_code code = GET_CODE (operands[1]);
-
- if (GET_MODE (sparc_compare_op0) == DImode
- && ! TARGET_ARCH64)
- FAIL;
-
- if (sparc_compare_op1 == const0_rtx
- && GET_CODE (sparc_compare_op0) == REG
- && GET_MODE (sparc_compare_op0) == DImode
- && v9_regcmp_p (code))
- {
- operands[1] = gen_rtx (code, DImode,
- sparc_compare_op0, sparc_compare_op1);
- }
- else
- {
- rtx cc_reg = gen_compare_reg (code,
- sparc_compare_op0, sparc_compare_op1);
- operands[1] = gen_rtx (code, GET_MODE (cc_reg), cc_reg, const0_rtx);
- }
-}")
-
-;; Conditional move define_insns.
-
-(define_insn "*movqi_cc_sp64"
- [(set (match_operand:QI 0 "register_operand" "=r,r")
- (if_then_else:QI (match_operator 1 "comparison_operator"
- [(match_operand 2 "icc_or_fcc_reg_operand" "X,X")
- (const_int 0)])
- (match_operand:QI 3 "arith11_operand" "rL,0")
- (match_operand:QI 4 "arith11_operand" "0,rL")))]
- "TARGET_V9"
- "@
- mov%C1 %x2,%3,%0
- mov%c1 %x2,%4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movhi_cc_sp64"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (if_then_else:HI (match_operator 1 "comparison_operator"
- [(match_operand 2 "icc_or_fcc_reg_operand" "X,X")
- (const_int 0)])
- (match_operand:HI 3 "arith11_operand" "rL,0")
- (match_operand:HI 4 "arith11_operand" "0,rL")))]
- "TARGET_V9"
- "@
- mov%C1 %x2,%3,%0
- mov%c1 %x2,%4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movsi_cc_sp64"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (if_then_else:SI (match_operator 1 "comparison_operator"
- [(match_operand 2 "icc_or_fcc_reg_operand" "X,X")
- (const_int 0)])
- (match_operand:SI 3 "arith11_operand" "rL,0")
- (match_operand:SI 4 "arith11_operand" "0,rL")))]
- "TARGET_V9"
- "@
- mov%C1 %x2,%3,%0
- mov%c1 %x2,%4,%0"
- [(set_attr "type" "cmove")])
-
-;; ??? The constraints of operands 3,4 need work.
-(define_insn "*movdi_cc_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (if_then_else:DI (match_operator 1 "comparison_operator"
- [(match_operand 2 "icc_or_fcc_reg_operand" "X,X")
- (const_int 0)])
- (match_operand:DI 3 "arith11_double_operand" "rLH,0")
- (match_operand:DI 4 "arith11_double_operand" "0,rLH")))]
- "TARGET_ARCH64"
- "@
- mov%C1 %x2,%3,%0
- mov%c1 %x2,%4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movsf_cc_sp64"
- [(set (match_operand:SF 0 "register_operand" "=f,f")
- (if_then_else:SF (match_operator 1 "comparison_operator"
- [(match_operand 2 "icc_or_fcc_reg_operand" "X,X")
- (const_int 0)])
- (match_operand:SF 3 "register_operand" "f,0")
- (match_operand:SF 4 "register_operand" "0,f")))]
- "TARGET_V9 && TARGET_FPU"
- "@
- fmovs%C1 %x2,%3,%0
- fmovs%c1 %x2,%4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movdf_cc_sp64"
- [(set (match_operand:DF 0 "register_operand" "=e,e")
- (if_then_else:DF (match_operator 1 "comparison_operator"
- [(match_operand 2 "icc_or_fcc_reg_operand" "X,X")
- (const_int 0)])
- (match_operand:DF 3 "register_operand" "e,0")
- (match_operand:DF 4 "register_operand" "0,e")))]
- "TARGET_V9 && TARGET_FPU"
- "@
- fmovd%C1 %x2,%3,%0
- fmovd%c1 %x2,%4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movtf_cc_sp64"
- [(set (match_operand:TF 0 "register_operand" "=e,e")
- (if_then_else:TF (match_operator 1 "comparison_operator"
- [(match_operand 2 "icc_or_fcc_reg_operand" "X,X")
- (const_int 0)])
- (match_operand:TF 3 "register_operand" "e,0")
- (match_operand:TF 4 "register_operand" "0,e")))]
- "TARGET_V9 && TARGET_FPU"
- "@
- fmovq%C1 %x2,%3,%0
- fmovq%c1 %x2,%4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movqi_cc_reg_sp64"
- [(set (match_operand:QI 0 "register_operand" "=r,r")
- (if_then_else:QI (match_operator 1 "v9_regcmp_op"
- [(match_operand:DI 2 "register_operand" "r,r")
- (const_int 0)])
- (match_operand:QI 3 "arith10_operand" "rM,0")
- (match_operand:QI 4 "arith10_operand" "0,rM")))]
- "TARGET_ARCH64"
- "@
- movr%D1 %2,%r3,%0
- movr%d1 %2,%r4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movhi_cc_reg_sp64"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (if_then_else:HI (match_operator 1 "v9_regcmp_op"
- [(match_operand:DI 2 "register_operand" "r,r")
- (const_int 0)])
- (match_operand:HI 3 "arith10_operand" "rM,0")
- (match_operand:HI 4 "arith10_operand" "0,rM")))]
- "TARGET_ARCH64"
- "@
- movr%D1 %2,%r3,%0
- movr%d1 %2,%r4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movsi_cc_reg_sp64"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (if_then_else:SI (match_operator 1 "v9_regcmp_op"
- [(match_operand:DI 2 "register_operand" "r,r")
- (const_int 0)])
- (match_operand:SI 3 "arith10_operand" "rM,0")
- (match_operand:SI 4 "arith10_operand" "0,rM")))]
- "TARGET_ARCH64"
- "@
- movr%D1 %2,%r3,%0
- movr%d1 %2,%r4,%0"
- [(set_attr "type" "cmove")])
-
-;; ??? The constraints of operands 3,4 need work.
-(define_insn "*movdi_cc_reg_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (if_then_else:DI (match_operator 1 "v9_regcmp_op"
- [(match_operand:DI 2 "register_operand" "r,r")
- (const_int 0)])
- (match_operand:DI 3 "arith10_double_operand" "rMH,0")
- (match_operand:DI 4 "arith10_double_operand" "0,rMH")))]
- "TARGET_ARCH64"
- "@
- movr%D1 %2,%r3,%0
- movr%d1 %2,%r4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movsf_cc_reg_sp64"
- [(set (match_operand:SF 0 "register_operand" "=f,f")
- (if_then_else:SF (match_operator 1 "v9_regcmp_op"
- [(match_operand:DI 2 "register_operand" "r,r")
- (const_int 0)])
- (match_operand:SF 3 "register_operand" "f,0")
- (match_operand:SF 4 "register_operand" "0,f")))]
- "TARGET_ARCH64 && TARGET_FPU"
- "@
- fmovrs%D1 %2,%3,%0
- fmovrs%d1 %2,%4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movdf_cc_reg_sp64"
- [(set (match_operand:DF 0 "register_operand" "=e,e")
- (if_then_else:DF (match_operator 1 "v9_regcmp_op"
- [(match_operand:DI 2 "register_operand" "r,r")
- (const_int 0)])
- (match_operand:DF 3 "register_operand" "e,0")
- (match_operand:DF 4 "register_operand" "0,e")))]
- "TARGET_ARCH64 && TARGET_FPU"
- "@
- fmovrd%D1 %2,%3,%0
- fmovrd%d1 %2,%4,%0"
- [(set_attr "type" "cmove")])
-
-(define_insn "*movtf_cc_reg_sp64"
- [(set (match_operand:TF 0 "register_operand" "=e,e")
- (if_then_else:TF (match_operator 1 "v9_regcmp_op"
- [(match_operand:DI 2 "register_operand" "r,r")
- (const_int 0)])
- (match_operand:TF 3 "register_operand" "e,0")
- (match_operand:TF 4 "register_operand" "0,e")))]
- "TARGET_ARCH64 && TARGET_FPU"
- "@
- fmovrq%D1 %2,%3,%0
- fmovrq%d1 %2,%4,%0"
- [(set_attr "type" "cmove")])
-
-;;- zero extension instructions
-
-;; These patterns originally accepted general_operands, however, slightly
-;; better code is generated by only accepting register_operands, and then
-;; letting combine generate the ldu[hb] insns.
-
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
- ""
- "
-{
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_16 = gen_rtx (CONST_INT, VOIDmode, 16);
- int op1_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
-
- emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
- op1_subword),
- shift_16));
- emit_insn (gen_lshrsi3 (operand0, temp, shift_16));
- DONE;
-}")
-
-(define_insn "*zero_extendhisi2_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
- ""
- "lduh %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn "*zero_extendqihi2_insn"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (zero_extend:HI (match_operand:QI 1 "sparc_operand" "r,Q")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- and %1,0xff,%0
- ldub %1,%0"
- [(set_attr "type" "unary,load")
- (set_attr "length" "1")])
-
-(define_expand "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn "*zero_extendqisi2_insn"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (zero_extend:SI (match_operand:QI 1 "sparc_operand" "r,Q")))]
- "GET_CODE (operands[1]) != CONST_INT"
- "@
- and %1,0xff,%0
- ldub %1,%0"
- [(set_attr "type" "unary,load")
- (set_attr "length" "1")])
-
-(define_expand "zero_extendqidi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
- "TARGET_ARCH64"
- "")
-
-(define_insn "*zero_extendqidi2_insn"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (zero_extend:DI (match_operand:QI 1 "sparc_operand" "r,Q")))]
- "TARGET_ARCH64 && GET_CODE (operands[1]) != CONST_INT"
- "@
- and %1,0xff,%0
- ldub %1,%0"
- [(set_attr "type" "unary,load")
- (set_attr "length" "1")])
-
-(define_expand "zero_extendhidi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
- "TARGET_ARCH64"
- "
-{
- rtx temp = gen_reg_rtx (DImode);
- rtx shift_48 = gen_rtx (CONST_INT, VOIDmode, 48);
- int op1_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
-
- emit_insn (gen_ashldi3 (temp, gen_rtx (SUBREG, DImode, operand1,
- op1_subword),
- shift_48));
- emit_insn (gen_lshrdi3 (operand0, temp, shift_48));
- DONE;
-}")
-
-(define_insn "*zero_extendhidi2_insn"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
- "TARGET_ARCH64"
- "lduh %1,%0"
- [(set_attr "type" "load")])
-
-;; ??? Write truncdisi pattern using sra?
-
-(define_expand "zero_extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (zero_extend:DI (match_operand:SI 1 "register_operand" "")))]
- "TARGET_ARCH64"
- "")
-
-(define_insn "*zero_extendsidi2_insn"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (zero_extend:DI (match_operand:SI 1 "sparc_operand" "r,Q")))]
- "TARGET_ARCH64 && GET_CODE (operands[1]) != CONST_INT"
- "@
- srl %1,0,%0
- lduw %1,%0"
- [(set_attr "type" "unary,load")
- (set_attr "length" "1")])
-
-;; Simplify comparisons of extended values.
-
-(define_insn "*cmp_zero_extendqisi2"
- [(set (reg:CC 100)
- (compare:CC (zero_extend:SI (match_operand:QI 0 "register_operand" "r"))
- (const_int 0)))]
- ""
- "andcc %0,0xff,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_zero_extendqisi2_set"
- [(set (reg:CC 100)
- (compare:CC (zero_extend:SI (match_operand:QI 1 "register_operand" "r"))
- (const_int 0)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI (match_dup 1)))]
- ""
- "andcc %1,0xff,%0"
- [(set_attr "type" "unary")])
-
-;; Similarly, handle SI->QI mode truncation followed by a compare.
-
-(define_insn "*cmp_siqi_trunc"
- [(set (reg:CC 100)
- (compare:CC (subreg:QI (match_operand:SI 0 "register_operand" "r") 0)
- (const_int 0)))]
- ""
- "andcc %0,0xff,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_siqi_trunc_set"
- [(set (reg:CC 100)
- (compare:CC (subreg:QI (match_operand:SI 1 "register_operand" "r") 0)
- (const_int 0)))
- (set (match_operand:QI 0 "register_operand" "=r")
- (match_dup 1))]
- ""
- "andcc %1,0xff,%0"
- [(set_attr "type" "unary")])
-
-;;- sign extension instructions
-
-;; These patterns originally accepted general_operands, however, slightly
-;; better code is generated by only accepting register_operands, and then
-;; letting combine generate the lds[hb] insns.
-
-(define_expand "extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
- ""
- "
-{
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_16 = gen_rtx (CONST_INT, VOIDmode, 16);
- int op1_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
-
- emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
- op1_subword),
- shift_16));
- emit_insn (gen_ashrsi3 (operand0, temp, shift_16));
- DONE;
-}")
-
-(define_insn "*sign_extendhisi2_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
- ""
- "ldsh %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "")
- (sign_extend:HI (match_operand:QI 1 "register_operand" "")))]
- ""
- "
-{
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
- int op1_subword = 0;
- int op0_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
- if (GET_CODE (operand0) == SUBREG)
- {
- op0_subword = SUBREG_WORD (operand0);
- operand0 = XEXP (operand0, 0);
- }
- emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
- op1_subword),
- shift_24));
- if (GET_MODE (operand0) != SImode)
- operand0 = gen_rtx (SUBREG, SImode, operand0, op0_subword);
- emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
- DONE;
-}")
-
-(define_insn "*sign_extendqihi2_insn"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
- ""
- "ldsb %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
- ""
- "
-{
- rtx temp = gen_reg_rtx (SImode);
- rtx shift_24 = gen_rtx (CONST_INT, VOIDmode, 24);
- int op1_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
-
- emit_insn (gen_ashlsi3 (temp, gen_rtx (SUBREG, SImode, operand1,
- op1_subword),
- shift_24));
- emit_insn (gen_ashrsi3 (operand0, temp, shift_24));
- DONE;
-}")
-
-(define_insn "*sign_extendqisi2_insn"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
- ""
- "ldsb %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "extendqidi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
- "TARGET_ARCH64"
- "
-{
- rtx temp = gen_reg_rtx (DImode);
- rtx shift_56 = gen_rtx (CONST_INT, VOIDmode, 56);
- int op1_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
-
- emit_insn (gen_ashldi3 (temp, gen_rtx (SUBREG, DImode, operand1,
- op1_subword),
- shift_56));
- emit_insn (gen_ashrdi3 (operand0, temp, shift_56));
- DONE;
-}")
-
-(define_insn "*sign_extendqidi2_insn"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
- "TARGET_ARCH64"
- "ldsb %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "extendhidi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
- "TARGET_ARCH64"
- "
-{
- rtx temp = gen_reg_rtx (DImode);
- rtx shift_48 = gen_rtx (CONST_INT, VOIDmode, 48);
- int op1_subword = 0;
-
- if (GET_CODE (operand1) == SUBREG)
- {
- op1_subword = SUBREG_WORD (operand1);
- operand1 = XEXP (operand1, 0);
- }
-
- emit_insn (gen_ashldi3 (temp, gen_rtx (SUBREG, DImode, operand1,
- op1_subword),
- shift_48));
- emit_insn (gen_ashrdi3 (operand0, temp, shift_48));
- DONE;
-}")
-
-(define_insn "*sign_extendhidi2_insn"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
- "TARGET_ARCH64"
- "ldsh %1,%0"
- [(set_attr "type" "load")])
-
-(define_expand "extendsidi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (sign_extend:DI (match_operand:SI 1 "register_operand" "")))]
- "TARGET_ARCH64"
- "")
-
-(define_insn "*sign_extendsidi2_insn"
- [(set (match_operand:DI 0 "register_operand" "=r,r")
- (sign_extend:DI (match_operand:SI 1 "sparc_operand" "r,Q")))]
- "TARGET_ARCH64"
- "@
- sra %1,0,%0
- ldsw %1,%0"
- [(set_attr "type" "unary,load")
- (set_attr "length" "1")])
-
-;; Special pattern for optimizing bit-field compares. This is needed
-;; because combine uses this as a canonical form.
-
-(define_insn "*cmp_zero_extract"
- [(set (reg:CC 100)
- (compare:CC
- (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "small_int" "n")
- (match_operand:SI 2 "small_int" "n"))
- (const_int 0)))]
- "INTVAL (operands[2]) > 19"
- "*
-{
- int len = INTVAL (operands[1]);
- int pos = 32 - INTVAL (operands[2]) - len;
- unsigned mask = ((1 << len) - 1) << pos;
-
- operands[1] = gen_rtx (CONST_INT, VOIDmode, mask);
- return \"andcc %0,%1,%%g0\";
-}")
-
-(define_insn "*cmp_zero_extract_sp64"
- [(set (reg:CCX 100)
- (compare:CCX
- (zero_extract:DI (match_operand:DI 0 "register_operand" "r")
- (match_operand:SI 1 "small_int" "n")
- (match_operand:SI 2 "small_int" "n"))
- (const_int 0)))]
- "TARGET_ARCH64 && INTVAL (operands[2]) > 51"
- "*
-{
- int len = INTVAL (operands[1]);
- int pos = 64 - INTVAL (operands[2]) - len;
- unsigned mask = ((1 << len) - 1) << pos;
-
- operands[1] = gen_rtx (CONST_INT, VOIDmode, mask);
- return \"andcc %0,%1,%%g0\";
-}")
-
-;; Conversions between float, double and long double.
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (float_extend:DF
- (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_FPU"
- "fstod %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "extendsftf2"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (float_extend:TF
- (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fstoq %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "extenddftf2"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (float_extend:TF
- (match_operand:DF 1 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fdtoq %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float_truncate:SF
- (match_operand:DF 1 "register_operand" "e")))]
- "TARGET_FPU"
- "fdtos %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "trunctfsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float_truncate:SF
- (match_operand:TF 1 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fqtos %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "trunctfdf2"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (float_truncate:DF
- (match_operand:TF 1 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fqtod %1,%0"
- [(set_attr "type" "fp")])
-
-;; Conversion between fixed point and floating point.
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:SI 1 "register_operand" "f")))]
- "TARGET_FPU"
- "fitos %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (float:DF (match_operand:SI 1 "register_operand" "f")))]
- "TARGET_FPU"
- "fitod %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "floatsitf2"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (float:TF (match_operand:SI 1 "register_operand" "f")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fitoq %1,%0"
- [(set_attr "type" "fp")])
-
-;; Now the same for 64 bit sources.
-;; ??? We cannot put DImode values in fp regs (see below near fix_truncdfsi2).
-
-(define_expand "floatdisf2"
- [(parallel [(set (match_operand:SF 0 "register_operand" "")
- (float:SF (match_operand:DI 1 "general_operand" "")))
- (clobber (match_dup 2))
- (clobber (match_dup 3))])]
- "TARGET_ARCH64 && TARGET_FPU"
- "
-{
- operands[2] = gen_reg_rtx (DFmode);
- operands[3] = sparc64_fpconv_stack_temp ();
-}")
-
-(define_expand "floatdidf2"
- [(parallel [(set (match_operand:DF 0 "register_operand" "")
- (float:DF (match_operand:DI 1 "general_operand" "")))
- (clobber (match_dup 2))
- (clobber (match_dup 3))])]
- "TARGET_ARCH64 && TARGET_FPU"
- "
-{
- operands[2] = gen_reg_rtx (DFmode);
- operands[3] = sparc64_fpconv_stack_temp ();
-}")
-
-(define_expand "floatditf2"
- [(parallel [(set (match_operand:TF 0 "register_operand" "")
- (float:TF (match_operand:DI 1 "general_operand" "")))
- (clobber (match_dup 2))
- (clobber (match_dup 3))])]
- "TARGET_ARCH64 && TARGET_FPU && TARGET_HARD_QUAD"
- "
-{
- operands[2] = gen_reg_rtx (DFmode);
- operands[3] = sparc64_fpconv_stack_temp ();
-}")
-
-(define_insn "*floatdisf2_insn"
- [(parallel [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:DI 1 "general_operand" "rm")))
- (clobber (match_operand:DF 2 "register_operand" "=&e"))
- (clobber (match_operand:DI 3 "memory_operand" "m"))])]
- "TARGET_ARCH64 && TARGET_FPU"
- "*
-{
- if (GET_CODE (operands[1]) == MEM)
- output_asm_insn (\"ldd %1,%2\", operands);
- else
- output_asm_insn (\"stx %1,%3\;ldd %3,%2\", operands);
- return \"fxtos %2,%0\";
-}"
- [(set_attr "type" "fp")
- (set_attr "length" "3")])
-
-(define_insn "*floatdidf2_insn"
- [(parallel [(set (match_operand:DF 0 "register_operand" "=e")
- (float:DF (match_operand:DI 1 "general_operand" "rm")))
- (clobber (match_operand:DF 2 "register_operand" "=&e"))
- (clobber (match_operand:DI 3 "memory_operand" "m"))])]
- "TARGET_ARCH64 && TARGET_FPU"
- "*
-{
- if (GET_CODE (operands[1]) == MEM)
- output_asm_insn (\"ldd %1,%2\", operands);
- else
- output_asm_insn (\"stx %1,%3\;ldd %3,%2\", operands);
- return \"fxtod %2,%0\";
-}"
- [(set_attr "type" "fp")
- (set_attr "length" "3")])
-
-(define_insn "*floatditf2_insn"
- [(parallel [(set (match_operand:TF 0 "register_operand" "=e")
- (float:TF (match_operand:DI 1 "general_operand" "rm")))
- (clobber (match_operand:DF 2 "register_operand" "=&e"))
- (clobber (match_operand:DI 3 "memory_operand" "m"))])]
- "TARGET_ARCH64 && TARGET_FPU && TARGET_HARD_QUAD"
- "*
-{
- if (GET_CODE (operands[1]) == MEM)
- output_asm_insn (\"ldd %1,%2\", operands);
- else
- output_asm_insn (\"stx %1,%3\;ldd %3,%2\", operands);
- return \"fxtoq %2,%0\";
-}"
- [(set_attr "type" "fp")
- (set_attr "length" "3")])
-
-;; ??? Ideally, these are what we would like to use.
-
-(define_insn "floatdisf2_sp64"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (float:SF (match_operand:DI 1 "register_operand" "e")))]
- "0 && TARGET_ARCH64 && TARGET_FPU"
- "fxtos %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "floatdidf2_sp64"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (float:DF (match_operand:DI 1 "register_operand" "e")))]
- "0 && TARGET_ARCH64 && TARGET_FPU"
- "fxtod %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "floatditf2_sp64"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (float:TF (match_operand:DI 1 "register_operand" "e")))]
- "0 && TARGET_ARCH64 && TARGET_FPU && TARGET_HARD_QUAD"
- "fxtoq %1,%0"
- [(set_attr "type" "fp")])
-
-;; Convert a float to an actual integer.
-;; Truncation is performed as part of the conversion.
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "register_operand" "=f")
- (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
- "TARGET_FPU"
- "fstoi %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "register_operand" "=f")
- (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "e"))))]
- "TARGET_FPU"
- "fdtoi %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "fix_trunctfsi2"
- [(set (match_operand:SI 0 "register_operand" "=f")
- (fix:SI (fix:TF (match_operand:TF 1 "register_operand" "e"))))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fqtoi %1,%0"
- [(set_attr "type" "fp")])
-
-;; Now the same, for 64-bit targets
-;; ??? We try to work around an interesting problem.
-;; If gcc tries to do a subreg on the result it will get the wrong answer:
-;; "(subreg:SI (reg:DI M int-reg) 0)" is the same as
-;; "(subreg:SI (reg:DI N float-reg) 1)", but gcc does not know how to change
-;; the "0" to a "1". One could enhance alter_subreg but it is not clear how to
-;; do this cleanly.
-
-(define_expand "fix_truncsfdi2"
- [(parallel [(set (match_operand:DI 0 "general_operand" "")
- (fix:DI (fix:SF (match_operand:SF 1 "register_operand" ""))))
- (clobber (match_dup 2))
- (clobber (match_dup 3))])]
- "TARGET_ARCH64 && TARGET_FPU"
- "
-{
- operands[2] = gen_reg_rtx (DFmode);
- operands[3] = sparc64_fpconv_stack_temp ();
-}")
-
-(define_expand "fix_truncdfdi2"
- [(parallel [(set (match_operand:DI 0 "general_operand" "")
- (fix:DI (fix:DF (match_operand:DF 1 "register_operand" ""))))
- (clobber (match_dup 2))
- (clobber (match_dup 3))])]
- "TARGET_ARCH64 && TARGET_FPU"
- "
-{
- operands[2] = gen_reg_rtx (DFmode);
- operands[3] = sparc64_fpconv_stack_temp ();
-}")
-
-(define_expand "fix_trunctfdi2"
- [(parallel [(set (match_operand:DI 0 "general_operand" "")
- (fix:DI (fix:TF (match_operand:TF 1 "register_operand" ""))))
- (clobber (match_dup 2))
- (clobber (match_dup 3))])]
- "TARGET_ARCH64 && TARGET_FPU && TARGET_HARD_QUAD"
- "
-{
- operands[2] = gen_reg_rtx (DFmode);
- operands[3] = sparc64_fpconv_stack_temp ();
-}")
-
-(define_insn "*fix_truncsfdi2_insn"
- [(parallel [(set (match_operand:DI 0 "general_operand" "=rm")
- (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))
- (clobber (match_operand:DF 2 "register_operand" "=&e"))
- (clobber (match_operand:DI 3 "memory_operand" "m"))])]
- "TARGET_ARCH64 && TARGET_FPU"
- "*
-{
- output_asm_insn (\"fstox %1,%2\", operands);
- if (GET_CODE (operands[0]) == MEM)
- return \"std %2,%0\";
- else
- return \"std %2,%3\;ldx %3,%0\";
-}"
- [(set_attr "type" "fp")
- (set_attr "length" "3")])
-
-(define_insn "*fix_truncdfdi2_insn"
- [(parallel [(set (match_operand:DI 0 "general_operand" "=rm")
- (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "e"))))
- (clobber (match_operand:DF 2 "register_operand" "=&e"))
- (clobber (match_operand:DI 3 "memory_operand" "m"))])]
- "TARGET_ARCH64 && TARGET_FPU"
- "*
-{
- output_asm_insn (\"fdtox %1,%2\", operands);
- if (GET_CODE (operands[0]) == MEM)
- return \"std %2,%0\";
- else
- return \"std %2,%3\;ldx %3,%0\";
-}"
- [(set_attr "type" "fp")
- (set_attr "length" "3")])
-
-(define_insn "*fix_trunctfdi2_insn"
- [(parallel [(set (match_operand:DI 0 "general_operand" "=rm")
- (fix:DI (fix:TF (match_operand:TF 1 "register_operand" "e"))))
- (clobber (match_operand:DF 2 "register_operand" "=&e"))
- (clobber (match_operand:DI 3 "memory_operand" "m"))])]
- "TARGET_ARCH64 && TARGET_FPU && TARGET_HARD_QUAD"
- "*
-{
- output_asm_insn (\"fqtox %1,%2\", operands);
- if (GET_CODE (operands[0]) == MEM)
- return \"std %2,%0\";
- else
- return \"std %2,%3\;ldx %3,%0\";
-}"
- [(set_attr "type" "fp")
- (set_attr "length" "3")])
-
-;; ??? Ideally, these are what we would like to use.
-
-(define_insn "fix_truncsfdi2_sp64"
- [(set (match_operand:DI 0 "register_operand" "=e")
- (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
- "0 && TARGET_ARCH64 && TARGET_FPU"
- "fstox %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "fix_truncdfdi2_sp64"
- [(set (match_operand:DI 0 "register_operand" "=e")
- (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "e"))))]
- "0 && TARGET_ARCH64 && TARGET_FPU"
- "fdtox %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "fix_trunctfdi2_sp64"
- [(set (match_operand:DI 0 "register_operand" "=e")
- (fix:DI (fix:TF (match_operand:TF 1 "register_operand" "e"))))]
- "0 && TARGET_ARCH64 && TARGET_FPU && TARGET_HARD_QUAD"
- "fqtox %1,%0"
- [(set_attr "type" "fp")])
-
-;;- arithmetic instructions
-
-(define_expand "adddi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- ""
- "
-{
- if (! TARGET_ARCH64)
- {
- emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
- gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (PLUS, DImode, operands[1],
- operands[2])),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (REG, SImode, SPARC_ICC_REG)))));
- DONE;
- }
-}")
-
-(define_insn "*adddi3_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))
- (clobber (reg:SI 100))]
- "! TARGET_ARCH64"
- "*
-{
- rtx op2 = operands[2];
-
- if (GET_CODE (op2) == CONST_INT
- || GET_CODE (op2) == CONST_DOUBLE)
- {
- rtx xoperands[4];
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- if (WORDS_BIG_ENDIAN)
- split_double (op2, &xoperands[2], &xoperands[3]);
- else
- split_double (op2, &xoperands[3], &xoperands[2]);
- if (xoperands[3] == const0_rtx && xoperands[0] == xoperands[1])
- output_asm_insn (\"add %H1,%2,%H0\", xoperands);
- else
- output_asm_insn (\"addcc %L1,%3,%L0\;addx %H1,%2,%H0\", xoperands);
- return \"\";
- }
- return \"addcc %L1,%L2,%L0\;addx %H1,%H2,%H0\";
-}"
- [(set_attr "length" "2")])
-
-(define_insn "*adddi3_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "add %1,%2,%0")
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_operand:SI 1 "arith_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "add %1,%2,%0"
- [(set_attr "type" "ialu")])
-
-(define_insn "*cmp_cc_plus"
- [(set (reg:CC_NOOV 100)
- (compare:CC_NOOV (plus:SI (match_operand:SI 0 "arith_operand" "%r")
- (match_operand:SI 1 "arith_operand" "rI"))
- (const_int 0)))]
- ""
- "addcc %0,%1,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_ccx_plus"
- [(set (reg:CCX_NOOV 100)
- (compare:CCX_NOOV (plus:DI (match_operand:DI 0 "arith_double_operand" "%r")
- (match_operand:DI 1 "arith_double_operand" "rHI"))
- (const_int 0)))]
- "TARGET_ARCH64"
- "addcc %0,%1,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_cc_plus_set"
- [(set (reg:CC_NOOV 100)
- (compare:CC_NOOV (plus:SI (match_operand:SI 1 "arith_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_dup 1) (match_dup 2)))]
- ""
- "addcc %1,%2,%0")
-
-(define_insn "*cmp_ccx_plus_set"
- [(set (reg:CCX_NOOV 100)
- (compare:CCX_NOOV (plus:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI"))
- (const_int 0)))
- (set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (match_dup 1) (match_dup 2)))]
- "TARGET_ARCH64"
- "addcc %1,%2,%0")
-
-(define_expand "subdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- ""
- "
-{
- if (! TARGET_ARCH64)
- {
- emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
- gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (MINUS, DImode, operands[1],
- operands[2])),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (REG, SImode, SPARC_ICC_REG)))));
- DONE;
- }
-}")
-
-(define_insn "*subdi3_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))
- (clobber (reg:SI 100))]
- "! TARGET_ARCH64"
- "*
-{
- rtx op2 = operands[2];
-
- if (GET_CODE (op2) == CONST_INT
- || GET_CODE (op2) == CONST_DOUBLE)
- {
- rtx xoperands[4];
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- if (WORDS_BIG_ENDIAN)
- split_double (op2, &xoperands[2], &xoperands[3]);
- else
- split_double (op2, &xoperands[3], &xoperands[2]);
- if (xoperands[3] == const0_rtx && xoperands[0] == xoperands[1])
- output_asm_insn (\"sub %H1,%2,%H0\", xoperands);
- else
- output_asm_insn (\"subcc %L1,%3,%L0\;subx %H1,%2,%H0\", xoperands);
- return \"\";
- }
- return \"subcc %L1,%L2,%L0\;subx %H1,%H2,%H0\";
-}"
- [(set_attr "length" "2")])
-
-(define_insn "*subdi3_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "sub %1,%2,%0")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "sub %1,%2,%0"
- [(set_attr "type" "ialu")])
-
-(define_insn "*cmp_minus_cc"
- [(set (reg:CC_NOOV 100)
- (compare:CC_NOOV (minus:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "arith_operand" "rI"))
- (const_int 0)))]
- ""
- "subcc %0,%1,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_minus_ccx"
- [(set (reg:CCX_NOOV 100)
- (compare:CCX_NOOV (minus:DI (match_operand:DI 0 "register_operand" "r")
- (match_operand:DI 1 "arith_double_operand" "rHI"))
- (const_int 0)))]
- "TARGET_ARCH64"
- "subcc %0,%1,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_minus_cc_set"
- [(set (reg:CC_NOOV 100)
- (compare:CC_NOOV (minus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_dup 1) (match_dup 2)))]
- ""
- "subcc %1,%2,%0")
-
-(define_insn "*cmp_minus_ccx_set"
- [(set (reg:CCX_NOOV 100)
- (compare:CCX_NOOV (minus:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "arith_double_operand" "rHI"))
- (const_int 0)))
- (set (match_operand:DI 0 "register_operand" "=r")
- (minus:DI (match_dup 1) (match_dup 2)))]
- "TARGET_ARCH64"
- "subcc %1,%2,%0")
-
-;; Integer Multiply/Divide.
-
-;; The 32 bit multiply/divide instructions are deprecated on v9 and shouldn't
-;; we used. We still use them in 32 bit v9 compilers.
-;; The 64 bit v9 compiler will (/should) widen the args and use muldi3.
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mult:SI (match_operand:SI 1 "arith_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "smul %1,%2,%0"
- [(set_attr "type" "imul")])
-
-(define_insn "muldi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (mult:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "mulx %1,%2,%0")
-
-;; It is not known whether this will match.
-
-(define_insn "*cmp_mul_set"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mult:SI (match_operand:SI 1 "arith_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI")))
- (set (reg:CC_NOOV 100)
- (compare:CC_NOOV (mult:SI (match_dup 1) (match_dup 2))
- (const_int 0)))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_DEPRECATED_V8_INSNS"
- "smulcc %1,%2,%0"
- [(set_attr "type" "imul")])
-
-(define_expand "mulsidi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
- (sign_extend:DI (match_operand:SI 2 "arith_operand" ""))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "
-{
- if (CONSTANT_P (operands[2]))
- {
- emit_insn (gen_const_mulsidi3 (operands[0], operands[1], operands[2]));
- DONE;
- }
-}")
-
-(define_insn "*mulsidi3_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "*
-{
- return TARGET_SPARCLET ? \"smuld %1,%2,%L0\" : \"smul %1,%2,%L0\;rd %%y,%H0\";
-}"
- [(set (attr "length")
- (if_then_else (eq_attr "isa" "sparclet")
- (const_int 1) (const_int 2)))])
-
-;; Extra pattern, because sign_extend of a constant isn't valid.
-
-(define_insn "const_mulsidi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "small_int" "I")))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "*
-{
- return TARGET_SPARCLET ? \"smuld %1,%2,%L0\" : \"smul %1,%2,%L0\;rd %%y,%H0\";
-}"
- [(set (attr "length")
- (if_then_else (eq_attr "isa" "sparclet")
- (const_int 1) (const_int 2)))])
-
-(define_expand "smulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "")
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
- (sign_extend:DI (match_operand:SI 2 "arith_operand" "")))
- (const_int 32))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "
-{
- if (CONSTANT_P (operands[2]))
- {
- emit_insn (gen_const_smulsi3_highpart (operands[0], operands[1], operands[2]));
- DONE;
- }
-}")
-
-(define_insn "*smulsidi3_highpart_sp32"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (sign_extend:DI (match_operand:SI 2 "register_operand" "r")))
- (const_int 32))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "smul %1,%2,%%g0\;rd %%y,%0"
- [(set_attr "length" "2")])
-
-(define_insn "const_smulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (truncate:SI
- (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "register_operand" "r"))
- (const_int 32))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "smul %1,%2,%%g0\;rd %%y,%0"
- [(set_attr "length" "2")])
-
-(define_expand "umulsidi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
- (zero_extend:DI (match_operand:SI 2 "uns_arith_operand" ""))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "
-{
- if (CONSTANT_P (operands[2]))
- {
- emit_insn (gen_const_umulsidi3 (operands[0], operands[1], operands[2]));
- DONE;
- }
-}")
-
-(define_insn "*umulsidi3_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "*
-{
- return TARGET_SPARCLET ? \"umuld %1,%2,%L0\" : \"umul %1,%2,%L0\;rd %%y,%H0\";
-}"
- [(set (attr "length")
- (if_then_else (eq_attr "isa" "sparclet")
- (const_int 1) (const_int 2)))])
-
-;; Extra pattern, because sign_extend of a constant isn't valid.
-
-(define_insn "const_umulsidi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "uns_small_int" "")))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "*
-{
- return TARGET_SPARCLET ? \"umuld %1,%2,%L0\" : \"umul %1,%2,%L0\;rd %%y,%H0\";
-}"
- [(set (attr "length")
- (if_then_else (eq_attr "isa" "sparclet")
- (const_int 1) (const_int 2)))])
-
-(define_expand "umulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "")
- (truncate:SI
- (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
- (zero_extend:DI (match_operand:SI 2 "uns_arith_operand" "")))
- (const_int 32))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "
-{
- if (CONSTANT_P (operands[2]))
- {
- emit_insn (gen_const_umulsi3_highpart (operands[0], operands[1], operands[2]));
- DONE;
- }
-}")
-
-(define_insn "*umulsidi3_highpart_sp32"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (truncate:SI
- (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (zero_extend:DI (match_operand:SI 2 "register_operand" "r")))
- (const_int 32))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "umul %1,%2,%%g0\;rd %%y,%0"
- [(set_attr "length" "2")])
-
-(define_insn "const_umulsi3_highpart"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (truncate:SI
- (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "uns_small_int" ""))
- (const_int 32))))]
- "TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS"
- "umul %1,%2,%%g0\;rd %%y,%0"
- [(set_attr "length" "2")])
-
-;; The v8 architecture specifies that there must be 3 instructions between
-;; a y register write and a use of it for correct results.
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (div:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))
- (clobber (match_scratch:SI 3 "=&r"))]
- "TARGET_V8 || TARGET_DEPRECATED_V8_INSNS"
- "*
-{
- if (TARGET_V9)
- return \"sra %1,31,%3\;wr %%g0,%3,%%y\;sdiv %1,%2,%0\";
- else
- return \"sra %1,31,%3\;wr %%g0,%3,%%y\;nop\;nop\;nop\;sdiv %1,%2,%0\";
-}"
- [(set (attr "length")
- (if_then_else (eq_attr "isa" "v9")
- (const_int 3) (const_int 6)))])
-
-(define_insn "divdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (div:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "sdivx %1,%2,%0")
-
-;; It is not known whether this will match.
-
-(define_insn "*cmp_sdiv_cc_set"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (div:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))
- (set (reg:CC 100)
- (compare:CC (div:SI (match_dup 1) (match_dup 2))
- (const_int 0)))
- (clobber (match_scratch:SI 3 "=&r"))]
- "TARGET_V8 || TARGET_DEPRECATED_V8_INSNS"
- "*
-{
- if (TARGET_V9)
- return \"sra %1,31,%3\;wr %%g0,%3,%%y\;sdivcc %1,%2,%0\";
- else
- return \"sra %1,31,%3\;wr %%g0,%3,%%y\;nop\;nop\;nop\;sdivcc %1,%2,%0\";
-}"
- [(set (attr "length")
- (if_then_else (eq_attr "isa" "v9")
- (const_int 3) (const_int 6)))])
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (udiv:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- "TARGET_V8 || TARGET_DEPRECATED_V8_INSNS"
- "*
-{
- if (TARGET_V9)
- return \"wr %%g0,%%g0,%%y\;udiv %1,%2,%0\";
- else
- return \"wr %%g0,%%g0,%%y\;nop\;nop\;nop\;udiv %1,%2,%0\";
-}"
- [(set (attr "length")
- (if_then_else (eq_attr "isa" "v9")
- (const_int 2) (const_int 5)))])
-
-(define_insn "udivdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (udiv:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "udivx %1,%2,%0")
-
-;; It is not known whether this will match.
-
-(define_insn "*cmp_udiv_cc_set"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (udiv:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))
- (set (reg:CC 100)
- (compare:CC (udiv:SI (match_dup 1) (match_dup 2))
- (const_int 0)))]
- "TARGET_V8 || TARGET_DEPRECATED_V8_INSNS"
- "*
-{
- if (TARGET_V9)
- return \"wr %%g0,%%g0,%%y\;udivcc %1,%2,%0\";
- else
- return \"wr %%g0,%%g0,%%y\;nop\;nop\;nop\;udivcc %1,%2,%0\";
-}"
- [(set (attr "length")
- (if_then_else (eq_attr "isa" "v9")
- (const_int 2) (const_int 5)))])
-
-; sparclet multiply/accumulate insns
-
-(define_insn "*smacsi"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI"))
- (match_operand:SI 3 "register_operand" "0")))]
- "TARGET_SPARCLET"
- "smac %1,%2,%0"
- [(set_attr "type" "imul")])
-
-(define_insn "*smacdi"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (mult:DI (sign_extend:DI
- (match_operand:SI 1 "register_operand" "%r"))
- (sign_extend:DI
- (match_operand:SI 2 "register_operand" "r")))
- (match_operand:DI 3 "register_operand" "0")))]
- "TARGET_SPARCLET"
- "smacd %1,%2,%L0"
- [(set_attr "type" "imul")])
-
-(define_insn "*umacdi"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (plus:DI (mult:DI (zero_extend:DI
- (match_operand:SI 1 "register_operand" "%r"))
- (zero_extend:DI
- (match_operand:SI 2 "register_operand" "r")))
- (match_operand:DI 3 "register_operand" "0")))]
- "TARGET_SPARCLET"
- "umacd %1,%2,%L0"
- [(set_attr "type" "imul")])
-
-;;- Boolean instructions
-;; We define DImode `and' so with DImode `not' we can get
-;; DImode `andn'. Other combinations are possible.
-
-(define_expand "anddi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (and:DI (match_operand:DI 1 "arith_double_operand" "")
- (match_operand:DI 2 "arith_double_operand" "")))]
- ""
- "")
-
-(define_insn "*anddi3_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "! TARGET_ARCH64"
- "*
-{
- rtx op2 = operands[2];
-
- if (GET_CODE (op2) == CONST_INT
- || GET_CODE (op2) == CONST_DOUBLE)
- {
- rtx xoperands[4];
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- if (WORDS_BIG_ENDIAN)
- split_double (op2, &xoperands[2], &xoperands[3]);
- else
- split_double (op2, &xoperands[3], &xoperands[2]);
- output_asm_insn (\"and %L1,%3,%L0\;and %H1,%2,%H0\", xoperands);
- return \"\";
- }
- return \"and %1,%2,%0\;and %R1,%R2,%R0\";
-}"
- [(set_attr "length" "2")])
-
-(define_insn "*anddi3_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "and %1,%2,%0")
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (match_operand:SI 1 "arith_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "and %1,%2,%0"
- [(set_attr "type" "ialu")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (and:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "GET_CODE (operands[2]) == CONST_INT
- && !SMALL_INT (operands[2])
- && (INTVAL (operands[2]) & 0x3ff) == 0x3ff"
- [(set (match_dup 3) (match_dup 4))
- (set (match_dup 0) (and:SI (not:SI (match_dup 3)) (match_dup 1)))]
- "
-{
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
-}")
-
-(define_insn "*and_not_di_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
- (match_operand:DI 2 "register_operand" "r")))]
- "! TARGET_ARCH64"
- "andn %2,%1,%0\;andn %R2,%R1,%R0"
- [(set_attr "length" "2")])
-
-(define_insn "*and_not_di_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (and:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
- (match_operand:DI 2 "register_operand" "r")))]
- "TARGET_ARCH64"
- "andn %2,%1,%0")
-
-(define_insn "*and_not_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "andn %2,%1,%0"
- [(set_attr "type" "ialu")])
-
-(define_expand "iordi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (ior:DI (match_operand:DI 1 "arith_double_operand" "")
- (match_operand:DI 2 "arith_double_operand" "")))]
- ""
- "")
-
-(define_insn "*iordi3_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ior:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "! TARGET_ARCH64"
- "*
-{
- rtx op2 = operands[2];
-
- if (GET_CODE (op2) == CONST_INT
- || GET_CODE (op2) == CONST_DOUBLE)
- {
- rtx xoperands[4];
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- if (WORDS_BIG_ENDIAN)
- split_double (op2, &xoperands[2], &xoperands[3]);
- else
- split_double (op2, &xoperands[3], &xoperands[2]);
- output_asm_insn (\"or %L1,%3,%L0\;or %H1,%2,%H0\", xoperands);
- return \"\";
- }
- return \"or %1,%2,%0\;or %R1,%R2,%R0\";
-}"
- [(set_attr "length" "2")])
-
-(define_insn "*iordi3_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ior:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "or %1,%2,%0")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operand:SI 1 "arith_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "or %1,%2,%0"
- [(set_attr "type" "ialu")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (ior:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "GET_CODE (operands[2]) == CONST_INT
- && !SMALL_INT (operands[2])
- && (INTVAL (operands[2]) & 0x3ff) == 0x3ff"
- [(set (match_dup 3) (match_dup 4))
- (set (match_dup 0) (ior:SI (not:SI (match_dup 3)) (match_dup 1)))]
- "
-{
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
-}")
-
-(define_insn "*or_not_di_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ior:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
- (match_operand:DI 2 "register_operand" "r")))]
- "! TARGET_ARCH64"
- "orn %2,%1,%0\;orn %R2,%R1,%R0"
- [(set_attr "length" "2")])
-
-(define_insn "*or_not_di_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ior:DI (not:DI (match_operand:DI 1 "register_operand" "r"))
- (match_operand:DI 2 "register_operand" "r")))]
- "TARGET_ARCH64"
- "orn %2,%1,%0")
-
-(define_insn "*or_not_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (not:SI (match_operand:SI 1 "register_operand" "r"))
- (match_operand:SI 2 "register_operand" "r")))]
- ""
- "orn %2,%1,%0"
- [(set_attr "type" "ialu")])
-
-(define_expand "xordi3"
- [(set (match_operand:DI 0 "register_operand" "")
- (xor:DI (match_operand:DI 1 "arith_double_operand" "")
- (match_operand:DI 2 "arith_double_operand" "")))]
- ""
- "")
-
-(define_insn "*xorsi3_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (xor:DI (match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "! TARGET_ARCH64"
- "*
-{
- rtx op2 = operands[2];
-
- if (GET_CODE (op2) == CONST_INT
- || GET_CODE (op2) == CONST_DOUBLE)
- {
- rtx xoperands[4];
- xoperands[0] = operands[0];
- xoperands[1] = operands[1];
- if (WORDS_BIG_ENDIAN)
- split_double (op2, &xoperands[2], &xoperands[3]);
- else
- split_double (op2, &xoperands[3], &xoperands[2]);
- output_asm_insn (\"xor %L1,%3,%L0\;xor %H1,%2,%H0\", xoperands);
- return \"\";
- }
- return \"xor %1,%2,%0\;xor %R1,%R2,%R0\";
-}"
- [(set_attr "length" "2")])
-
-(define_insn "*xordi3_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (xor:DI (match_operand:DI 1 "arith_double_operand" "%rJ")
- (match_operand:DI 2 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "xor %r1,%2,%0")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (xor:SI (match_operand:SI 1 "arith_operand" "%rJ")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "xor %r1,%2,%0"
- [(set_attr "type" "ialu")])
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (xor:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "" "")))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "GET_CODE (operands[2]) == CONST_INT
- && !SMALL_INT (operands[2])
- && (INTVAL (operands[2]) & 0x3ff) == 0x3ff"
- [(set (match_dup 3) (match_dup 4))
- (set (match_dup 0) (not:SI (xor:SI (match_dup 3) (match_dup 1))))]
- "
-{
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
-}")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (not:SI (xor:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "" ""))))
- (clobber (match_operand:SI 3 "register_operand" ""))]
- "GET_CODE (operands[2]) == CONST_INT
- && !SMALL_INT (operands[2])
- && (INTVAL (operands[2]) & 0x3ff) == 0x3ff"
- [(set (match_dup 3) (match_dup 4))
- (set (match_dup 0) (xor:SI (match_dup 3) (match_dup 1)))]
- "
-{
- operands[4] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (operands[2]));
-}")
-
-;; xnor patterns. Note that (a ^ ~b) == (~a ^ b) == ~(a ^ b).
-;; Combine now canonicalizes to the rightmost expression.
-(define_insn "*xor_not_di_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (xor:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:DI 2 "register_operand" "r"))))]
- "! TARGET_ARCH64"
- "xnor %1,%2,%0\;xnor %R1,%R2,%R0"
- [(set_attr "length" "2")])
-
-(define_insn "*xor_not_di_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (xor:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
- (match_operand:DI 2 "arith_double_operand" "rHI"))))]
- "TARGET_ARCH64"
- "xnor %r1,%2,%0")
-
-(define_insn "*xor_not_si"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (xor:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
- (match_operand:SI 2 "arith_operand" "rI"))))]
- ""
- "xnor %r1,%2,%0"
- [(set_attr "type" "ialu")])
-
-;; These correspond to the above in the case where we also (or only)
-;; want to set the condition code.
-
-(define_insn "*cmp_cc_arith_op"
- [(set (reg:CC 100)
- (compare:CC
- (match_operator:SI 2 "cc_arithop"
- [(match_operand:SI 0 "arith_operand" "%r")
- (match_operand:SI 1 "arith_operand" "rI")])
- (const_int 0)))]
- ""
- "%A2cc %0,%1,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_ccx_arith_op"
- [(set (reg:CCX 100)
- (compare:CCX
- (match_operator:DI 2 "cc_arithop"
- [(match_operand:DI 0 "arith_double_operand" "%r")
- (match_operand:DI 1 "arith_double_operand" "rHI")])
- (const_int 0)))]
- "TARGET_ARCH64"
- "%A2cc %0,%1,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_cc_arith_op_set"
- [(set (reg:CC 100)
- (compare:CC
- (match_operator:SI 3 "cc_arithop"
- [(match_operand:SI 1 "arith_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI")])
- (const_int 0)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (match_dup 3))]
- ""
- "%A3cc %1,%2,%0")
-
-(define_insn "*cmp_ccx_arith_op_set"
- [(set (reg:CCX 100)
- (compare:CCX
- (match_operator:DI 3 "cc_arithop"
- [(match_operand:DI 1 "arith_double_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")])
- (const_int 0)))
- (set (match_operand:DI 0 "register_operand" "=r")
- (match_dup 3))]
- "TARGET_ARCH64"
- "%A3cc %1,%2,%0")
-
-(define_insn "*cmp_cc_xor_not"
- [(set (reg:CC 100)
- (compare:CC
- (not:SI (xor:SI (match_operand:SI 0 "reg_or_0_operand" "%rJ")
- (match_operand:SI 1 "arith_operand" "rI")))
- (const_int 0)))]
- ""
- "xnorcc %r0,%1,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_ccx_xor_not"
- [(set (reg:CCX 100)
- (compare:CCX
- (not:DI (xor:DI (match_operand:DI 0 "reg_or_0_operand" "%rJ")
- (match_operand:DI 1 "arith_double_operand" "rHI")))
- (const_int 0)))]
- "TARGET_ARCH64"
- "xnorcc %r0,%1,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_cc_xor_not_set"
- [(set (reg:CC 100)
- (compare:CC
- (not:SI (xor:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
- (match_operand:SI 2 "arith_operand" "rI")))
- (const_int 0)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
- ""
- "xnorcc %r1,%2,%0")
-
-(define_insn "*cmp_ccx_xor_not_set"
- [(set (reg:CCX 100)
- (compare:CCX
- (not:DI (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
- (match_operand:DI 2 "arith_double_operand" "rHI")))
- (const_int 0)))
- (set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (xor:DI (match_dup 1) (match_dup 2))))]
- "TARGET_ARCH64"
- "xnorcc %r1,%2,%0")
-
-(define_insn "*cmp_cc_arith_op_not"
- [(set (reg:CC 100)
- (compare:CC
- (match_operator:SI 2 "cc_arithopn"
- [(not:SI (match_operand:SI 0 "arith_operand" "rI"))
- (match_operand:SI 1 "reg_or_0_operand" "rJ")])
- (const_int 0)))]
- ""
- "%B2cc %r1,%0,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_ccx_arith_op_not"
- [(set (reg:CCX 100)
- (compare:CCX
- (match_operator:DI 2 "cc_arithopn"
- [(not:DI (match_operand:DI 0 "arith_double_operand" "rHI"))
- (match_operand:DI 1 "reg_or_0_operand" "rJ")])
- (const_int 0)))]
- "TARGET_ARCH64"
- "%B2cc %r1,%0,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_cc_arith_op_not_set"
- [(set (reg:CC 100)
- (compare:CC
- (match_operator:SI 3 "cc_arithopn"
- [(not:SI (match_operand:SI 1 "arith_operand" "rI"))
- (match_operand:SI 2 "reg_or_0_operand" "rJ")])
- (const_int 0)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (match_dup 3))]
- ""
- "%B3cc %r2,%1,%0")
-
-(define_insn "*cmp_ccx_arith_op_not_set"
- [(set (reg:CCX 100)
- (compare:CCX
- (match_operator:DI 3 "cc_arithopn"
- [(not:DI (match_operand:DI 1 "arith_double_operand" "rHI"))
- (match_operand:DI 2 "reg_or_0_operand" "rJ")])
- (const_int 0)))
- (set (match_operand:DI 0 "register_operand" "=r")
- (match_dup 3))]
- "TARGET_ARCH64"
- "%B3cc %r2,%1,%0")
-
-;; We cannot use the "neg" pseudo insn because the Sun assembler
-;; does not know how to make it work for constants.
-
-(define_expand "negdi2"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (match_operand:DI 1 "register_operand" "r")))]
- ""
- "
-{
- if (! TARGET_ARCH64)
- {
- emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
- gen_rtx (SET, VOIDmode, operand0,
- gen_rtx (NEG, DImode, operand1)),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (REG, SImode, SPARC_ICC_REG)))));
- DONE;
- }
-}")
-
-(define_insn "*negdi2_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (match_operand:DI 1 "register_operand" "r")))
- (clobber (reg:SI 100))]
- "! TARGET_ARCH64"
- "*
-{
- if (TARGET_LIVE_G0)
- output_asm_insn (\"and %%g0,0,%%g0\", operands);
- return \"subcc %%g0,%L1,%L0\;subx %%g0,%H1,%H0\";
-}"
- [(set_attr "type" "unary")
- ;; ??? This is wrong for TARGET_LIVE_G0 but it's not critical.
- (set_attr "length" "2")])
-
-(define_insn "*negdi2_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (match_operand:DI 1 "register_operand" "r")))]
- "TARGET_ARCH64"
- "sub %%g0,%1,%0"
- [(set_attr "type" "unary")
- (set_attr "length" "1")])
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "arith_operand" "rI")))]
- ""
- "*
-{
- if (TARGET_LIVE_G0)
- return \"and %%g0,0,%%g0\;sub %%g0,%1,%0\";
- return \"sub %%g0,%1,%0\";
-}"
- [(set_attr "type" "unary")
- (set (attr "length")
- (if_then_else (eq_attr "live_g0" "yes") (const_int 2) (const_int 1)))])
-
-(define_insn "*cmp_cc_neg"
- [(set (reg:CC_NOOV 100)
- (compare:CC_NOOV (neg:SI (match_operand:SI 0 "arith_operand" "rI"))
- (const_int 0)))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%0,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_ccx_neg"
- [(set (reg:CCX_NOOV 100)
- (compare:CCX_NOOV (neg:DI (match_operand:DI 0 "arith_double_operand" "rHI"))
- (const_int 0)))]
- "TARGET_ARCH64"
- "subcc %%g0,%0,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_cc_set_neg"
- [(set (reg:CC_NOOV 100)
- (compare:CC_NOOV (neg:SI (match_operand:SI 1 "arith_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_dup 1)))]
- "! TARGET_LIVE_G0"
- "subcc %%g0,%1,%0"
- [(set_attr "type" "unary")])
-
-(define_insn "*cmp_ccx_set_neg"
- [(set (reg:CCX_NOOV 100)
- (compare:CCX_NOOV (neg:DI (match_operand:DI 1 "arith_double_operand" "rHI"))
- (const_int 0)))
- (set (match_operand:DI 0 "register_operand" "=r")
- (neg:DI (match_dup 1)))]
- "TARGET_ARCH64"
- "subcc %%g0,%1,%0"
- [(set_attr "type" "unary")])
-
-;; We cannot use the "not" pseudo insn because the Sun assembler
-;; does not know how to make it work for constants.
-(define_expand "one_cmpldi2"
- [(set (match_operand:DI 0 "register_operand" "")
- (not:DI (match_operand:DI 1 "register_operand" "")))]
- ""
- "")
-
-(define_insn "*one_cmpldi2_sp32"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (match_operand:DI 1 "register_operand" "r")))]
- "! TARGET_ARCH64"
- "xnor %1,0,%0\;xnor %R1,0,%R0"
- [(set_attr "type" "unary")
- (set_attr "length" "2")])
-
-(define_insn "*one_cmpldi2_sp64"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (match_operand:DI 1 "arith_double_operand" "rHI")))]
- "TARGET_ARCH64"
- "xnor %1,0,%0"
- [(set_attr "type" "unary")])
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (not:SI (match_operand:SI 1 "arith_operand" "r,I")))]
- ""
- "*
-{
- if (which_alternative == 0)
- return \"xnor %1,0,%0\";
- if (TARGET_LIVE_G0)
- output_asm_insn (\"and %%g0,0,%%g0\", operands);
- return \"xnor %%g0,%1,%0\";
-}"
- [(set_attr "type" "unary")
- (set_attr_alternative "length"
- [(const_int 1)
- (if_then_else (eq_attr "live_g0" "yes") (const_int 2) (const_int 1))])])
-
-(define_insn "*cmp_cc_not"
- [(set (reg:CC 100)
- (compare:CC (not:SI (match_operand:SI 0 "arith_operand" "rI"))
- (const_int 0)))]
- "! TARGET_LIVE_G0"
- "xnorcc %%g0,%0,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_ccx_not"
- [(set (reg:CCX 100)
- (compare:CCX (not:DI (match_operand:DI 0 "arith_double_operand" "rHI"))
- (const_int 0)))]
- "TARGET_ARCH64"
- "xnorcc %%g0,%0,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_cc_set_not"
- [(set (reg:CC 100)
- (compare:CC (not:SI (match_operand:SI 1 "arith_operand" "rI"))
- (const_int 0)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_dup 1)))]
- "! TARGET_LIVE_G0"
- "xnorcc %%g0,%1,%0"
- [(set_attr "type" "unary")])
-
-(define_insn "*cmp_ccx_set_not"
- [(set (reg:CCX 100)
- (compare:CCX (not:DI (match_operand:DI 1 "arith_double_operand" "rHI"))
- (const_int 0)))
- (set (match_operand:DI 0 "register_operand" "=r")
- (not:DI (match_dup 1)))]
- "TARGET_ARCH64"
- "xnorcc %%g0,%1,%0"
- [(set_attr "type" "unary")])
-
-;; Floating point arithmetic instructions.
-
-(define_insn "addtf3"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (plus:TF (match_operand:TF 1 "register_operand" "e")
- (match_operand:TF 2 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "faddq %1,%2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (plus:DF (match_operand:DF 1 "register_operand" "e")
- (match_operand:DF 2 "register_operand" "e")))]
- "TARGET_FPU"
- "faddd %1,%2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (plus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fadds %1,%2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "subtf3"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (minus:TF (match_operand:TF 1 "register_operand" "e")
- (match_operand:TF 2 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fsubq %1,%2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (minus:DF (match_operand:DF 1 "register_operand" "e")
- (match_operand:DF 2 "register_operand" "e")))]
- "TARGET_FPU"
- "fsubd %1,%2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (minus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fsubs %1,%2,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "multf3"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (mult:TF (match_operand:TF 1 "register_operand" "e")
- (match_operand:TF 2 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fmulq %1,%2,%0"
- [(set_attr "type" "fpmul")])
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (mult:DF (match_operand:DF 1 "register_operand" "e")
- (match_operand:DF 2 "register_operand" "e")))]
- "TARGET_FPU"
- "fmuld %1,%2,%0"
- [(set_attr "type" "fpmul")])
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fmuls %1,%2,%0"
- [(set_attr "type" "fpmul")])
-
-(define_insn "*muldf3_extend"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (mult:DF (float_extend:DF (match_operand:SF 1 "register_operand" "f"))
- (float_extend:DF (match_operand:SF 2 "register_operand" "f"))))]
- "(TARGET_V8 || TARGET_V9) && TARGET_FPU"
- "fsmuld %1,%2,%0"
- [(set_attr "type" "fpmul")])
-
-(define_insn "*multf3_extend"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (mult:TF (float_extend:TF (match_operand:DF 1 "register_operand" "e"))
- (float_extend:TF (match_operand:DF 2 "register_operand" "e"))))]
- "(TARGET_V8 || TARGET_V9) && TARGET_FPU && TARGET_HARD_QUAD"
- "fdmulq %1,%2,%0"
- [(set_attr "type" "fpmul")])
-
-;; don't have timing for quad-prec. divide.
-(define_insn "divtf3"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (div:TF (match_operand:TF 1 "register_operand" "e")
- (match_operand:TF 2 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fdivq %1,%2,%0"
- [(set_attr "type" "fpdivd")])
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (div:DF (match_operand:DF 1 "register_operand" "e")
- (match_operand:DF 2 "register_operand" "e")))]
- "TARGET_FPU"
- "fdivd %1,%2,%0"
- [(set_attr "type" "fpdivd")])
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (div:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fdivs %1,%2,%0"
- [(set_attr "type" "fpdivs")])
-
-(define_insn "negtf2"
- [(set (match_operand:TF 0 "register_operand" "=e,e")
- (neg:TF (match_operand:TF 1 "register_operand" "0,e")))]
- ; We don't use quad float insns here so we don't need TARGET_HARD_QUAD.
- "TARGET_FPU"
- "*
-{
- /* v9: can't use fnegs, won't work with upper regs. */
- if (which_alternative == 0)
- return TARGET_V9 ? \"fnegd %0,%0\" : \"fnegs %0,%0\";
- else
- return TARGET_V9 ? \"fnegd %1,%0\;fmovd %S1,%S0\"
- : \"fnegs %1,%0\;fmovs %R1,%R0\;fmovs %S1,%S0\;fmovs %T1,%T0\";
-}"
- [(set_attr "type" "fp")
- (set_attr_alternative "length"
- [(const_int 1)
- (if_then_else (eq_attr "isa" "v9") (const_int 2) (const_int 4))])])
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=e,e")
- (neg:DF (match_operand:DF 1 "register_operand" "0,e")))]
- "TARGET_FPU"
- "*
-{
- if (TARGET_V9)
- return \"fnegd %1,%0\";
- else if (which_alternative == 0)
- return \"fnegs %0,%0\";
- else
- return \"fnegs %1,%0\;fmovs %R1,%R0\";
-}"
- [(set_attr "type" "fp")
- (set_attr_alternative "length"
- [(const_int 1)
- (if_then_else (eq_attr "isa" "v9") (const_int 1) (const_int 2))])])
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (neg:SF (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_FPU"
- "fnegs %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "abstf2"
- [(set (match_operand:TF 0 "register_operand" "=e,e")
- (abs:TF (match_operand:TF 1 "register_operand" "0,e")))]
- ; We don't use quad float insns here so we don't need TARGET_HARD_QUAD.
- "TARGET_FPU"
- "*
-{
- /* v9: can't use fabss, won't work with upper regs. */
- if (which_alternative == 0)
- return TARGET_V9 ? \"fabsd %0,%0\" : \"fabss %0,%0\";
- else
- return TARGET_V9 ? \"fabsd %1,%0\;fmovd %S1,%S0\"
- : \"fabss %1,%0\;fmovs %R1,%R0\;fmovs %S1,%S0\;fmovs %T1,%T0\";
-}"
- [(set_attr "type" "fp")
- (set_attr_alternative "length"
- [(const_int 1)
- (if_then_else (eq_attr "isa" "v9") (const_int 2) (const_int 4))])])
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=e,e")
- (abs:DF (match_operand:DF 1 "register_operand" "0,e")))]
- "TARGET_FPU"
- "*
-{
- if (TARGET_V9)
- return \"fabsd %1,%0\";
- else if (which_alternative == 0)
- return \"fabss %0,%0\";
- else
- return \"fabss %1,%0\;fmovs %R1,%R0\";
-}"
- [(set_attr "type" "fp")
- (set_attr_alternative "length"
- [(const_int 1)
- (if_then_else (eq_attr "isa" "v9") (const_int 1) (const_int 2))])])
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (abs:SF (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_FPU"
- "fabss %1,%0"
- [(set_attr "type" "fp")])
-
-(define_insn "sqrttf2"
- [(set (match_operand:TF 0 "register_operand" "=e")
- (sqrt:TF (match_operand:TF 1 "register_operand" "e")))]
- "TARGET_FPU && TARGET_HARD_QUAD"
- "fsqrtq %1,%0"
- [(set_attr "type" "fpsqrt")])
-
-(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "register_operand" "=e")
- (sqrt:DF (match_operand:DF 1 "register_operand" "e")))]
- "TARGET_FPU"
- "fsqrtd %1,%0"
- [(set_attr "type" "fpsqrt")])
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
- "TARGET_FPU"
- "fsqrts %1,%0"
- [(set_attr "type" "fpsqrt")])
-
-;;- arithmetic shift instructions
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) INTVAL (operands[2]) > 31)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
-
- return \"sll %1,%2,%0\";
-}"
- [(set_attr "type" "shift")])
-
-(define_insn "ashldi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashift:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- "TARGET_ARCH64"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) INTVAL (operands[2]) > 63)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
-
- return \"sllx %1,%2,%0\";
-}")
-
-(define_insn "*cmp_cc_ashift_1"
- [(set (reg:CC_NOOV 100)
- (compare:CC_NOOV (ashift:SI (match_operand:SI 0 "register_operand" "r")
- (const_int 1))
- (const_int 0)))]
- ""
- "addcc %0,%0,%%g0"
- [(set_attr "type" "compare")])
-
-(define_insn "*cmp_cc_set_ashift_1"
- [(set (reg:CC_NOOV 100)
- (compare:CC_NOOV (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 1))
- (const_int 0)))
- (set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_dup 1) (const_int 1)))]
- ""
- "addcc %1,%1,%0")
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) INTVAL (operands[2]) > 31)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
-
- return \"sra %1,%2,%0\";
-}"
- [(set_attr "type" "shift")])
-
-(define_insn "ashrdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- "TARGET_ARCH64"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) INTVAL (operands[2]) > 63)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
-
- return \"srax %1,%2,%0\";
-}")
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- ""
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) INTVAL (operands[2]) > 31)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
-
- return \"srl %1,%2,%0\";
-}"
- [(set_attr "type" "shift")])
-
-(define_insn "lshrdi3"
- [(set (match_operand:DI 0 "register_operand" "=r")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "r")
- (match_operand:SI 2 "arith_operand" "rI")))]
- "TARGET_ARCH64"
- "*
-{
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) INTVAL (operands[2]) > 63)
- operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
-
- return \"srlx %1,%2,%0\";
-}")
-
-;; Unconditional and other jump instructions
-;; On the Sparc, by setting the annul bit on an unconditional branch, the
-;; following insn is never executed. This saves us a nop. Dbx does not
-;; handle such branches though, so we only use them when optimizing.
-(define_insn "jump"
- [(set (pc) (label_ref (match_operand 0 "" "")))]
- ""
- "b%* %l0%("
- [(set_attr "type" "uncond_branch")])
-
-(define_expand "tablejump"
- [(parallel [(set (pc) (match_operand 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))])]
- ""
- "
-{
- if (GET_MODE (operands[0]) != Pmode)
- abort ();
-
- /* We need to use the PC value in %o7 that was set up when the address
- of the label was loaded into a register, so we need different RTL. */
- if (flag_pic)
- {
- if (!TARGET_PTR64)
- emit_jump_insn (gen_pic_tablejump_32 (operands[0], operands[1]));
- else
- emit_jump_insn (gen_pic_tablejump_64 (operands[0], operands[1]));
- DONE;
- }
-}")
-
-(define_insn "pic_tablejump_32"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))
- (use (reg:SI 15))]
- "! TARGET_PTR64"
- "jmp %%o7+%0%#"
- [(set_attr "type" "uncond_branch")])
-
-(define_insn "pic_tablejump_64"
- [(set (pc) (match_operand:DI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))
- (use (reg:DI 15))]
- "TARGET_PTR64"
- "jmp %%o7+%0%#"
- [(set_attr "type" "uncond_branch")])
-
-(define_insn "*tablejump_sp32"
- [(set (pc) (match_operand:SI 0 "address_operand" "p"))
- (use (label_ref (match_operand 1 "" "")))]
- "! TARGET_PTR64"
- "jmp %a0%#"
- [(set_attr "type" "uncond_branch")])
-
-(define_insn "*tablejump_sp64"
- [(set (pc) (match_operand:DI 0 "address_operand" "p"))
- (use (label_ref (match_operand 1 "" "")))]
- "TARGET_PTR64"
- "jmp %a0%#"
- [(set_attr "type" "uncond_branch")])
-
-;; This pattern recognizes the "instruction" that appears in
-;; a function call that wants a structure value,
-;; to inform the called function if compiled with Sun CC.
-;(define_insn "*unimp_insn"
-; [(match_operand:SI 0 "immediate_operand" "")]
-; "GET_CODE (operands[0]) == CONST_INT && INTVAL (operands[0]) > 0"
-; "unimp %0"
-; [(set_attr "type" "marker")])
-
-;;- jump to subroutine
-(define_expand "call"
- ;; Note that this expression is not used for generating RTL.
- ;; All the RTL is generated explicitly below.
- [(call (match_operand 0 "call_operand" "")
- (match_operand 3 "" "i"))]
- ;; operands[2] is next_arg_register
- ;; operands[3] is struct_value_size_rtx.
- ""
- "
-{
- rtx fn_rtx, nregs_rtx;
-
- if (GET_MODE (operands[0]) != FUNCTION_MODE)
- abort ();
-
- if (GET_CODE (XEXP (operands[0], 0)) == LABEL_REF)
- {
- /* This is really a PIC sequence. We want to represent
- it as a funny jump so it's delay slots can be filled.
-
- ??? But if this really *is* a CALL, will not it clobber the
- call-clobbered registers? We lose this if it is a JUMP_INSN.
- Why cannot we have delay slots filled if it were a CALL? */
-
- if (! TARGET_ARCH64 && INTVAL (operands[3]) != 0)
- emit_jump_insn
- (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (3,
- gen_rtx (SET, VOIDmode, pc_rtx,
- XEXP (operands[0], 0)),
- GEN_INT (INTVAL (operands[3]) & 0xfff),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (REG, Pmode, 15)))));
- else
- emit_jump_insn
- (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (2,
- gen_rtx (SET, VOIDmode, pc_rtx,
- XEXP (operands[0], 0)),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (REG, Pmode, 15)))));
- goto finish_call;
- }
-
- fn_rtx = operands[0];
-
- /* Count the number of parameter registers being used by this call.
- if that argument is NULL, it means we are using them all, which
- means 6 on the sparc. */
-#if 0
- if (operands[2])
- nregs_rtx = gen_rtx (CONST_INT, VOIDmode, REGNO (operands[2]) - 8);
- else
- nregs_rtx = gen_rtx (CONST_INT, VOIDmode, 6);
-#else
- nregs_rtx = const0_rtx;
-#endif
-
- if (! TARGET_ARCH64 && INTVAL (operands[3]) != 0)
- emit_call_insn
- (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (3, gen_rtx (CALL, VOIDmode, fn_rtx, nregs_rtx),
- GEN_INT (INTVAL (operands[3]) & 0xfff),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (REG, Pmode, 15)))));
- else
- emit_call_insn
- (gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (2, gen_rtx (CALL, VOIDmode, fn_rtx, nregs_rtx),
- gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (REG, Pmode, 15)))));
-
- finish_call:
-#if 0
- /* If this call wants a structure value,
- emit an unimp insn to let the called function know about this. */
- if (! TARGET_ARCH64 && INTVAL (operands[3]) > 0)
- {
- rtx insn = emit_insn (operands[3]);
- SCHED_GROUP_P (insn) = 1;
- }
-#endif
-
- DONE;
-}")
-
-;; We can't use the same pattern for these two insns, because then registers
-;; in the address may not be properly reloaded.
-
-(define_insn "*call_address_sp32"
- [(call (mem:SI (match_operand:SI 0 "address_operand" "p"))
- (match_operand 1 "" ""))
- (clobber (reg:SI 15))]
- ;;- Do not use operand 1 for most machines.
- "! TARGET_PTR64"
- "call %a0,%1%#"
- [(set_attr "type" "call")])
-
-(define_insn "*call_symbolic_sp32"
- [(call (mem:SI (match_operand:SI 0 "symbolic_operand" "s"))
- (match_operand 1 "" ""))
- (clobber (reg:SI 15))]
- ;;- Do not use operand 1 for most machines.
- "! TARGET_PTR64"
- "call %a0,%1%#"
- [(set_attr "type" "call")])
-
-(define_insn "*call_address_sp64"
- [(call (mem:SI (match_operand:DI 0 "address_operand" "p"))
- (match_operand 1 "" ""))
- (clobber (reg:DI 15))]
- ;;- Do not use operand 1 for most machines.
- "TARGET_PTR64"
- "call %a0,%1%#"
- [(set_attr "type" "call")])
-
-(define_insn "*call_symbolic_sp64"
- [(call (mem:SI (match_operand:DI 0 "symbolic_operand" "s"))
- (match_operand 1 "" ""))
- (clobber (reg:DI 15))]
- ;;- Do not use operand 1 for most machines.
- "TARGET_PTR64"
- "call %a0,%1%#"
- [(set_attr "type" "call")])
-
-;; This is a call that wants a structure value.
-;; There is no such critter for v9 (??? we may need one anyway).
-(define_insn "*call_address_struct_value_sp32"
- [(call (mem:SI (match_operand:SI 0 "address_operand" "p"))
- (match_operand 1 "" ""))
- (match_operand 2 "immediate_operand" "")
- (clobber (reg:SI 15))]
- ;;- Do not use operand 1 for most machines.
- "! TARGET_ARCH64 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0"
- "call %a0,%1\;nop\;unimp %2"
- [(set_attr "type" "call_no_delay_slot")])
-
-;; This is a call that wants a structure value.
-;; There is no such critter for v9 (??? we may need one anyway).
-(define_insn "*call_symbolic_struct_value_sp32"
- [(call (mem:SI (match_operand:SI 0 "symbolic_operand" "s"))
- (match_operand 1 "" ""))
- (match_operand 2 "immediate_operand" "")
- (clobber (reg:SI 15))]
- ;;- Do not use operand 1 for most machines.
- "! TARGET_ARCH64 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0"
- "call %a0,%1\;nop\;unimp %2"
- [(set_attr "type" "call_no_delay_slot")])
-
-;; This is a call that may want a structure value. This is used for
-;; untyped_calls.
-(define_insn "*call_address_untyped_struct_value_sp32"
- [(call (mem:SI (match_operand:SI 0 "address_operand" "p"))
- (match_operand 1 "" ""))
- (match_operand 2 "immediate_operand" "")
- (clobber (reg:SI 15))]
- ;;- Do not use operand 1 for most machines.
- "! TARGET_ARCH64 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0"
- "call %a0,%1\;nop\;nop"
- [(set_attr "type" "call_no_delay_slot")])
-
-;; This is a call that wants a structure value.
-(define_insn "*call_symbolic_untyped_struct_value_sp32"
- [(call (mem:SI (match_operand:SI 0 "symbolic_operand" "s"))
- (match_operand 1 "" ""))
- (match_operand 2 "immediate_operand" "")
- (clobber (reg:SI 15))]
- ;;- Do not use operand 1 for most machines.
- "! TARGET_ARCH64 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0"
- "call %a0,%1\;nop\;nop"
- [(set_attr "type" "call_no_delay_slot")])
-
-(define_expand "call_value"
- ;; Note that this expression is not used for generating RTL.
- ;; All the RTL is generated explicitly below.
- [(set (match_operand 0 "register_operand" "=rf")
- (call (match_operand:SI 1 "" "")
- (match_operand 4 "" "")))]
- ;; operand 2 is stack_size_rtx
- ;; operand 3 is next_arg_register
- ""
- "
-{
- rtx fn_rtx, nregs_rtx;
- rtvec vec;
-
- if (GET_MODE (operands[1]) != FUNCTION_MODE)
- abort ();
-
- fn_rtx = operands[1];
-
-#if 0
- if (operands[3])
- nregs_rtx = gen_rtx (CONST_INT, VOIDmode, REGNO (operands[3]) - 8);
- else
- nregs_rtx = gen_rtx (CONST_INT, VOIDmode, 6);
-#else
- nregs_rtx = const0_rtx;
-#endif
-
- vec = gen_rtvec (2,
- gen_rtx (SET, VOIDmode, operands[0],
- gen_rtx (CALL, VOIDmode, fn_rtx, nregs_rtx)),
- gen_rtx (CLOBBER, VOIDmode, gen_rtx (REG, Pmode, 15)));
-
- emit_call_insn (gen_rtx (PARALLEL, VOIDmode, vec));
-
- DONE;
-}")
-
-(define_insn "*call_value_address_sp32"
- [(set (match_operand 0 "" "=rf")
- (call (mem:SI (match_operand:SI 1 "address_operand" "p"))
- (match_operand 2 "" "")))
- (clobber (reg:SI 15))]
- ;;- Do not use operand 2 for most machines.
- "! TARGET_PTR64"
- "call %a1,%2%#"
- [(set_attr "type" "call")])
-
-(define_insn "*call_value_symbolic_sp32"
- [(set (match_operand 0 "" "=rf")
- (call (mem:SI (match_operand:SI 1 "symbolic_operand" "s"))
- (match_operand 2 "" "")))
- (clobber (reg:SI 15))]
- ;;- Do not use operand 2 for most machines.
- "! TARGET_PTR64"
- "call %a1,%2%#"
- [(set_attr "type" "call")])
-
-(define_insn "*call_value_address_sp64"
- [(set (match_operand 0 "" "=rf")
- (call (mem:SI (match_operand:DI 1 "address_operand" "p"))
- (match_operand 2 "" "")))
- (clobber (reg:DI 15))]
- ;;- Do not use operand 2 for most machines.
- "TARGET_PTR64"
- "call %a1,%2%#"
- [(set_attr "type" "call")])
-
-(define_insn "*call_value_symbolic_sp64"
- [(set (match_operand 0 "" "=rf")
- (call (mem:SI (match_operand:DI 1 "symbolic_operand" "s"))
- (match_operand 2 "" "")))
- (clobber (reg:DI 15))]
- ;;- Do not use operand 2 for most machines.
- "TARGET_PTR64"
- "call %a1,%2%#"
- [(set_attr "type" "call")])
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- /* Pass constm1 to indicate that it may expect a structure value, but
- we don't know what size it is. */
- emit_call_insn (gen_call (operands[0], const0_rtx, NULL, constm1_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-;; Prepare to return any type including a structure value.
-
-(define_expand "untyped_return"
- [(match_operand:BLK 0 "memory_operand" "")
- (match_operand 1 "" "")]
- ""
- "
-{
- rtx valreg1 = gen_rtx (REG, DImode, 24);
- rtx valreg2 = gen_rtx (REG, TARGET_ARCH64 ? TFmode : DFmode, 32);
- rtx result = operands[0];
-
- if (! TARGET_ARCH64)
- {
- rtx rtnreg = gen_rtx (REG, SImode, (leaf_function ? 15 : 31));
- rtx value = gen_reg_rtx (SImode);
-
- /* Fetch the instruction where we will return to and see if it's an unimp
- instruction (the most significant 10 bits will be zero). If so,
- update the return address to skip the unimp instruction. */
- emit_move_insn (value,
- gen_rtx (MEM, SImode, plus_constant (rtnreg, 8)));
- emit_insn (gen_lshrsi3 (value, value, GEN_INT (22)));
- emit_insn (gen_update_return (rtnreg, value));
- }
-
- /* Reload the function value registers. */
- emit_move_insn (valreg1, change_address (result, DImode, XEXP (result, 0)));
- emit_move_insn (valreg2,
- change_address (result, TARGET_ARCH64 ? TFmode : DFmode,
- plus_constant (XEXP (result, 0), 8)));
-
- /* Put USE insns before the return. */
- emit_insn (gen_rtx (USE, VOIDmode, valreg1));
- emit_insn (gen_rtx (USE, VOIDmode, valreg2));
-
- /* Construct the return. */
- expand_null_return ();
-
- DONE;
-}")
-
-;; This is a bit of a hack. We're incrementing a fixed register (%i7),
-;; and parts of the compiler don't want to believe that the add is needed.
-
-(define_insn "update_return"
- [(unspec:SI [(match_operand:SI 0 "register_operand" "r")
- (match_operand:SI 1 "register_operand" "r")] 0)]
- "! TARGET_ARCH64"
- "cmp %1,0\;be,a .+8\;add %0,4,%0"
- [(set_attr "type" "multi")])
-
-(define_insn "return"
- [(return)
- (use (reg:SI 31))]
- "! TARGET_EPILOGUE"
- "* return output_return (operands);"
- [(set_attr "type" "multi")])
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-(define_expand "indirect_jump"
- [(set (pc) (match_operand 0 "address_operand" "p"))]
- ""
- "")
-
-(define_insn "*branch_sp32"
- [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
- "! TARGET_PTR64"
- "jmp %a0%#"
- [(set_attr "type" "uncond_branch")])
-
-(define_insn "*branch_sp64"
- [(set (pc) (match_operand:DI 0 "address_operand" "p"))]
- "TARGET_PTR64"
- "jmp %a0%#"
- [(set_attr "type" "uncond_branch")])
-
-;; ??? Doesn't work with -mflat.
-(define_expand "nonlocal_goto"
- [(match_operand:SI 0 "general_operand" "")
- (match_operand:SI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" "")
- (match_operand:SI 3 "" "")]
- ""
- "
-{
- /* Trap instruction to flush all the register windows. */
- emit_insn (gen_flush_register_windows ());
- /* Load the fp value for the containing fn into %fp.
- This is needed because operands[2] refers to %fp.
- Virtual register instantiation fails if the virtual %fp isn't set from a
- register. Thus we must copy operands[0] into a register if it isn't
- already one. */
- if (GET_CODE (operands[0]) != REG)
- operands[0] = force_reg (Pmode, operands[0]);
- emit_move_insn (virtual_stack_vars_rtx, operands[0]);
- /* Find the containing function's current nonlocal goto handler,
- which will do any cleanups and then jump to the label. */
- emit_move_insn (gen_rtx (REG, Pmode, 8), operands[1]);
- /* Restore %fp from stack pointer value for containing function.
- The restore insn that follows will move this to %sp,
- and reload the appropriate value into %fp. */
- emit_move_insn (frame_pointer_rtx, operands[2]);
- /* Put in the static chain register the nonlocal label address. */
- emit_move_insn (static_chain_rtx, operands[3]);
- /* USE of frame_pointer_rtx added for consistency; not clear if
- really needed. */
- emit_insn (gen_rtx (USE, VOIDmode, frame_pointer_rtx));
- emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
- emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
- /* Return, restoring reg window and jumping to goto handler. */
- emit_insn (gen_goto_handler_and_restore ());
- emit_barrier ();
- DONE;
-}")
-
-;; Special trap insn to flush register windows.
-(define_insn "flush_register_windows"
- [(unspec_volatile [(const_int 0)] 1)]
- ""
- ;; ??? Use TARGET_V9 instead?
- "* return TARGET_ARCH64 ? \"flushw\" : \"ta 3\";"
- [(set_attr "type" "misc")])
-
-(define_insn "goto_handler_and_restore"
- [(unspec_volatile [(const_int 0)] 2)
- (use (reg:SI 8))]
- ""
- "jmp %%o0+0\;restore"
- [(set_attr "type" "misc")
- (set_attr "length" "2")])
-
-;; Pattern for use after a setjmp to store FP and the return register
-;; into the stack area.
-
-(define_expand "setjmp"
- [(const_int 0)]
- ""
- "
-{
- if (TARGET_ARCH64)
- emit_insn (gen_setjmp_64 ());
- else
- emit_insn (gen_setjmp_32 ());
-
- DONE;
-}")
-
-(define_expand "setjmp_32"
- [(set (mem:SI (plus:SI (reg:SI 14) (const_int 56))) (match_dup 0))
- (set (mem:SI (plus:SI (reg:SI 14) (const_int 60))) (reg:SI 31))]
- ""
- "
-{ operands[0] = frame_pointer_rtx; }")
-
-(define_expand "setjmp_64"
- [(set (mem:DI (plus:DI (reg:DI 14) (const_int 112))) (match_dup 0))
- (set (mem:DI (plus:DI (reg:DI 14) (const_int 120))) (reg:DI 31))]
- ""
- "
-{ operands[0] = frame_pointer_rtx; }")
-
-;; Special pattern for the FLUSH instruction.
-
-(define_insn "flush"
- [(unspec_volatile [(match_operand 0 "memory_operand" "m")] 3)]
- ""
- "* return TARGET_V9 ? \"flush %f0\" : \"iflush %f0\";"
- [(set_attr "type" "misc")])
-
-;; find first set.
-
-;; The scan instruction searches from the most significant bit while ffs
-;; searches from the least significant bit. The bit index and treatment of
-;; zero also differ. It takes at least 7 instructions to get the proper
-;; result. Here is an obvious 8 instruction sequence.
-
-(define_insn "ffssi2"
- [(set (match_operand:SI 0 "register_operand" "=&r")
- (ffs:SI (match_operand:SI 1 "register_operand" "r")))
- (clobber (match_scratch:SI 2 "=&r"))]
- "TARGET_SPARCLITE || TARGET_SPARCLET"
- "*
-{
- if (TARGET_LIVE_G0)
- output_asm_insn (\"and %%g0,0,%%g0\", operands);
- return \"sub %%g0,%1,%0\;and %0,%1,%0\;scan %0,0,%0\;mov 32,%2\;sub %2,%0,%0\;sra %0,31,%2\;and %2,31,%2\;add %2,%0,%0\";
-}"
- [(set_attr "type" "multi")
- (set_attr "length" "8")])
-
-;; ??? This should be a define expand, so that the extra instruction have
-;; a chance of being optimized away.
-
-(define_insn "ffsdi2"
- [(set (match_operand:DI 0 "register_operand" "=&r")
- (ffs:DI (match_operand:DI 1 "register_operand" "r")))
- (clobber (match_scratch:DI 2 "=&r"))]
- "TARGET_ARCH64"
- "neg %1,%2\;not %2,%2\;xor %1,%2,%2\;popc %2,%0\;movrz %1,0,%0"
- [(set_attr "type" "multi")
- (set_attr "length" "5")])
-
-;; Split up troublesome insns for better scheduling. */
-
-;; The following patterns are straightforward. They can be applied
-;; either before or after register allocation.
-
-(define_split
- [(set (match_operand 0 "splittable_symbolic_memory_operand" "")
- (match_operand 1 "reg_or_0_operand" ""))
- (clobber (match_operand:SI 2 "register_operand" ""))]
- "! flag_pic"
- [(set (match_dup 2) (high:SI (match_dup 3)))
- (set (match_dup 4) (match_dup 1))]
- "
-{
- operands[3] = XEXP (operands[0], 0);
- operands[4] = gen_rtx (MEM, GET_MODE (operands[0]),
- gen_rtx (LO_SUM, SImode, operands[2], operands[3]));
- MEM_IN_STRUCT_P (operands[4]) = MEM_IN_STRUCT_P (operands[0]);
- MEM_VOLATILE_P (operands[4]) = MEM_VOLATILE_P (operands[0]);
- RTX_UNCHANGING_P (operands[4]) = RTX_UNCHANGING_P (operands[0]);
-}")
-
-(define_split
- [(set (match_operand 0 "splittable_immediate_memory_operand" "")
- (match_operand 1 "general_operand" ""))
- (clobber (match_operand:SI 2 "register_operand" ""))]
- "flag_pic"
- [(set (match_dup 3) (match_dup 1))]
- "
-{
- rtx addr = legitimize_pic_address (XEXP (operands[0], 0),
- GET_MODE (operands[0]),
- operands[2]);
- operands[3] = gen_rtx (MEM, GET_MODE (operands[0]), addr);
- MEM_IN_STRUCT_P (operands[3]) = MEM_IN_STRUCT_P (operands[0]);
- MEM_VOLATILE_P (operands[3]) = MEM_VOLATILE_P (operands[0]);
- RTX_UNCHANGING_P (operands[3]) = RTX_UNCHANGING_P (operands[0]);
-}")
-
-(define_split
- [(set (match_operand 0 "register_operand" "")
- (match_operand 1 "splittable_immediate_memory_operand" ""))]
- "flag_pic"
- [(set (match_dup 0) (match_dup 2))]
- "
-{
- rtx addr = legitimize_pic_address (XEXP (operands[1], 0),
- GET_MODE (operands[1]),
- operands[0]);
- operands[2] = gen_rtx (MEM, GET_MODE (operands[1]), addr);
- MEM_IN_STRUCT_P (operands[2]) = MEM_IN_STRUCT_P (operands[1]);
- MEM_VOLATILE_P (operands[2]) = MEM_VOLATILE_P (operands[1]);
- RTX_UNCHANGING_P (operands[2]) = RTX_UNCHANGING_P (operands[1]);
-}")
-
-;; Sign- and Zero-extend operations can have symbolic memory operands.
-
-(define_split
- [(set (match_operand 0 "register_operand" "")
- (match_operator 1 "extend_op" [(match_operand 2 "splittable_immediate_memory_operand" "")]))]
- "flag_pic"
- [(set (match_dup 0) (match_op_dup 1 [(match_dup 3)]))]
- "
-{
- rtx addr = legitimize_pic_address (XEXP (operands[2], 0),
- GET_MODE (operands[2]),
- operands[0]);
- operands[3] = gen_rtx (MEM, GET_MODE (operands[2]), addr);
- MEM_IN_STRUCT_P (operands[3]) = MEM_IN_STRUCT_P (operands[2]);
- MEM_VOLATILE_P (operands[3]) = MEM_VOLATILE_P (operands[2]);
- RTX_UNCHANGING_P (operands[3]) = RTX_UNCHANGING_P (operands[2]);
-}")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "immediate_operand" ""))]
- "! flag_pic && (GET_CODE (operands[1]) == SYMBOL_REF
- || GET_CODE (operands[1]) == CONST
- || GET_CODE (operands[1]) == LABEL_REF)"
- [(set (match_dup 0) (high:SI (match_dup 1)))
- (set (match_dup 0)
- (lo_sum:SI (match_dup 0) (match_dup 1)))]
- "")
-
-;; LABEL_REFs are not modified by `legitimize_pic_address'
-;; so do not recurse infinitely in the PIC case.
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "immediate_operand" ""))]
- "flag_pic && (GET_CODE (operands[1]) == SYMBOL_REF
- || GET_CODE (operands[1]) == CONST)"
- [(set (match_dup 0) (match_dup 1))]
- "
-{
- operands[1] = legitimize_pic_address (operands[1], Pmode, operands[0]);
-}")
-
-;; These split sne/seq insns. The forms of the resulting insns are
-;; somewhat bogus, but they avoid extra patterns and show data dependency.
-;; Nothing will look at these in detail after splitting has occurred.
-
-;; ??? v9 DImode versions are missing because addc and subc use %icc.
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (ne:SI (match_operand:SI 1 "register_operand" "")
- (const_int 0)))
- (clobber (reg:CC 100))]
- ""
- [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (ltu:SI (reg:CC 100) (const_int 0)))]
- "")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (neg:SI (ne:SI (match_operand:SI 1 "register_operand" "")
- (const_int 0))))
- (clobber (reg:CC 100))]
- ""
- [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (neg:SI (ltu:SI (reg:CC 100) (const_int 0))))]
- "")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (eq:SI (match_operand:SI 1 "register_operand" "")
- (const_int 0)))
- (clobber (reg:CC 100))]
- ""
- [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (geu:SI (reg:CC 100) (const_int 0)))]
- "")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (neg:SI (eq:SI (match_operand:SI 1 "register_operand" "")
- (const_int 0))))
- (clobber (reg:CC 100))]
- ""
- [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (neg:SI (geu:SI (reg:CC 100) (const_int 0))))]
- "")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (ne:SI (match_operand:SI 1 "register_operand" "")
- (const_int 0))
- (match_operand:SI 2 "register_operand" "")))
- (clobber (reg:CC 100))]
- ""
- [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (plus:SI (ltu:SI (reg:CC 100) (const_int 0))
- (match_dup 2)))]
- "")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (minus:SI (match_operand:SI 2 "register_operand" "")
- (ne:SI (match_operand:SI 1 "register_operand" "")
- (const_int 0))))
- (clobber (reg:CC 100))]
- ""
- [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (minus:SI (match_dup 2)
- (ltu:SI (reg:CC 100) (const_int 0))))]
- "")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (eq:SI (match_operand:SI 1 "register_operand" "")
- (const_int 0))
- (match_operand:SI 2 "register_operand" "")))
- (clobber (reg:CC 100))]
- ""
- [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (plus:SI (geu:SI (reg:CC 100) (const_int 0))
- (match_dup 2)))]
- "")
-
-(define_split
- [(set (match_operand:SI 0 "register_operand" "")
- (minus:SI (match_operand:SI 2 "register_operand" "")
- (eq:SI (match_operand:SI 1 "register_operand" "")
- (const_int 0))))
- (clobber (reg:CC 100))]
- ""
- [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1))
- (const_int 0)))
- (set (match_dup 0) (minus:SI (match_dup 2)
- (geu:SI (reg:CC 100) (const_int 0))))]
- "")
-
-;; Peepholes go at the end.
-
-;; Optimize consecutive loads or stores into ldd and std when possible.
-;; The conditions in which we do this are very restricted and are
-;; explained in the code for {registers,memory}_ok_for_ldd functions.
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=rf")
- (match_operand:SI 1 "memory_operand" ""))
- (set (match_operand:SI 2 "register_operand" "=rf")
- (match_operand:SI 3 "memory_operand" ""))]
- "! TARGET_ARCH64
- && registers_ok_for_ldd_peep (operands[0], operands[2])
- && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
- && addrs_ok_for_ldd_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
- "ldd %1,%0")
-
-(define_peephole
- [(set (match_operand:SI 0 "memory_operand" "")
- (match_operand:SI 1 "register_operand" "rf"))
- (set (match_operand:SI 2 "memory_operand" "")
- (match_operand:SI 3 "register_operand" "rf"))]
- "! TARGET_ARCH64
- && registers_ok_for_ldd_peep (operands[1], operands[3])
- && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
- && addrs_ok_for_ldd_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
- "std %1,%0")
-
-(define_peephole
- [(set (match_operand:SF 0 "register_operand" "=fr")
- (match_operand:SF 1 "memory_operand" ""))
- (set (match_operand:SF 2 "register_operand" "=fr")
- (match_operand:SF 3 "memory_operand" ""))]
- "! TARGET_ARCH64
- && registers_ok_for_ldd_peep (operands[0], operands[2])
- && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
- && addrs_ok_for_ldd_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
- "ldd %1,%0")
-
-(define_peephole
- [(set (match_operand:SF 0 "memory_operand" "")
- (match_operand:SF 1 "register_operand" "fr"))
- (set (match_operand:SF 2 "memory_operand" "")
- (match_operand:SF 3 "register_operand" "fr"))]
- "! TARGET_ARCH64
- && registers_ok_for_ldd_peep (operands[1], operands[3])
- && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
- && addrs_ok_for_ldd_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
- "std %1,%0")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=rf")
- (match_operand:SI 1 "memory_operand" ""))
- (set (match_operand:SI 2 "register_operand" "=rf")
- (match_operand:SI 3 "memory_operand" ""))]
- "! TARGET_ARCH64
- && registers_ok_for_ldd_peep (operands[2], operands[0])
- && ! MEM_VOLATILE_P (operands[3]) && ! MEM_VOLATILE_P (operands[1])
- && addrs_ok_for_ldd_peep (XEXP (operands[3], 0), XEXP (operands[1], 0))"
- "ldd %3,%2")
-
-(define_peephole
- [(set (match_operand:SI 0 "memory_operand" "")
- (match_operand:SI 1 "register_operand" "rf"))
- (set (match_operand:SI 2 "memory_operand" "")
- (match_operand:SI 3 "register_operand" "rf"))]
- "! TARGET_ARCH64
- && registers_ok_for_ldd_peep (operands[3], operands[1])
- && ! MEM_VOLATILE_P (operands[2]) && ! MEM_VOLATILE_P (operands[0])
- && addrs_ok_for_ldd_peep (XEXP (operands[2], 0), XEXP (operands[0], 0))"
- "std %3,%2")
-
-(define_peephole
- [(set (match_operand:SF 0 "register_operand" "=fr")
- (match_operand:SF 1 "memory_operand" ""))
- (set (match_operand:SF 2 "register_operand" "=fr")
- (match_operand:SF 3 "memory_operand" ""))]
- "! TARGET_ARCH64
- && registers_ok_for_ldd_peep (operands[2], operands[0])
- && ! MEM_VOLATILE_P (operands[3]) && ! MEM_VOLATILE_P (operands[1])
- && addrs_ok_for_ldd_peep (XEXP (operands[3], 0), XEXP (operands[1], 0))"
- "ldd %3,%2")
-
-(define_peephole
- [(set (match_operand:SF 0 "memory_operand" "")
- (match_operand:SF 1 "register_operand" "fr"))
- (set (match_operand:SF 2 "memory_operand" "")
- (match_operand:SF 3 "register_operand" "fr"))]
- "! TARGET_ARCH64
- && registers_ok_for_ldd_peep (operands[3], operands[1])
- && ! MEM_VOLATILE_P (operands[2]) && ! MEM_VOLATILE_P (operands[0])
- && addrs_ok_for_ldd_peep (XEXP (operands[2], 0), XEXP (operands[0], 0))"
- "std %3,%2")
-
-;; Optimize the case of following a reg-reg move with a test
-;; of reg just moved. Don't allow floating point regs for operand 0 or 1.
-;; This can result from a float to fix conversion.
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (match_operand:SI 1 "register_operand" "r"))
- (set (reg:CC 100)
- (compare:CC (match_operand:SI 2 "register_operand" "r")
- (const_int 0)))]
- "(rtx_equal_p (operands[2], operands[0])
- || rtx_equal_p (operands[2], operands[1]))
- && ! FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
- "orcc %1,0,%0")
-
-(define_peephole
- [(set (match_operand:DI 0 "register_operand" "=r")
- (match_operand:DI 1 "register_operand" "r"))
- (set (reg:CCX 100)
- (compare:CCX (match_operand:DI 2 "register_operand" "r")
- (const_int 0)))]
- "TARGET_ARCH64
- && (rtx_equal_p (operands[2], operands[0])
- || rtx_equal_p (operands[2], operands[1]))
- && ! FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
- "orcc %1,0,%0")
-
-;; Do {sign,zero}-extended compares somewhat more efficiently.
-;; ??? Is this now the Right Way to do this? Or will SCRATCH
-;; eventually have some impact here?
-
-(define_peephole
- [(set (match_operand:HI 0 "register_operand" "")
- (match_operand:HI 1 "memory_operand" ""))
- (set (match_operand:SI 2 "register_operand" "")
- (sign_extend:SI (match_dup 0)))
- (set (reg:CC 100)
- (compare:CC (match_dup 2)
- (const_int 0)))]
- ""
- "ldsh %1,%0\;orcc %0,0,%2")
-
-(define_peephole
- [(set (match_operand:HI 0 "register_operand" "")
- (match_operand:HI 1 "memory_operand" ""))
- (set (match_operand:DI 2 "register_operand" "")
- (sign_extend:DI (match_dup 0)))
- (set (reg:CCX 100)
- (compare:CCX (match_dup 2)
- (const_int 0)))]
- "TARGET_ARCH64"
- "ldsh %1,%0\;orcc %0,0,%2")
-
-(define_peephole
- [(set (match_operand:QI 0 "register_operand" "")
- (match_operand:QI 1 "memory_operand" ""))
- (set (match_operand:SI 2 "register_operand" "")
- (sign_extend:SI (match_dup 0)))
- (set (reg:CC 100)
- (compare:CC (match_dup 2)
- (const_int 0)))]
- ""
- "ldsb %1,%0\;orcc %0,0,%2")
-
-(define_peephole
- [(set (match_operand:QI 0 "register_operand" "")
- (match_operand:QI 1 "memory_operand" ""))
- (set (match_operand:DI 2 "register_operand" "")
- (sign_extend:DI (match_dup 0)))
- (set (reg:CCX 100)
- (compare:CCX (match_dup 2)
- (const_int 0)))]
- "TARGET_ARCH64"
- "ldsb %1,%0\;orcc %0,0,%2")
-
-;; Floating-point move peepholes
-;; ??? v9: Do we want similar ones?
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_dup 0)
- (match_operand:SI 1 "immediate_operand" "i")))
- (set (match_operand:DF 2 "register_operand" "=er")
- (mem:DF (match_dup 0)))]
- "RTX_UNCHANGING_P (operands[1]) && reg_unused_after (operands[0], insn)"
- "*
-{
- /* Go by way of output_move_double in case the register in operand 2
- is not properly aligned for ldd. */
- operands[1] = gen_rtx (MEM, DFmode,
- gen_rtx (LO_SUM, SImode, operands[0], operands[1]));
- operands[0] = operands[2];
- return output_move_double (operands);
-}")
-
-(define_peephole
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lo_sum:SI (match_dup 0)
- (match_operand:SI 1 "immediate_operand" "i")))
- (set (match_operand:SF 2 "register_operand" "=fr")
- (mem:SF (match_dup 0)))]
- "RTX_UNCHANGING_P (operands[1]) && reg_unused_after (operands[0], insn)"
- "ld [%0+%%lo(%a1)],%2")
-
-;; Return peepholes. First the "normal" ones.
-;; These are necessary to catch insns ending up in the epilogue delay list.
-
-(define_insn "*return_qi"
- [(set (match_operand:QI 0 "restore_operand" "")
- (match_operand:QI 1 "arith_operand" "rI"))
- (return)]
- "! TARGET_EPILOGUE && ! TARGET_LIVE_G0"
- "*
-{
- if (! TARGET_ARCH64 && current_function_returns_struct)
- return \"jmp %%i7+12\;restore %%g0,%1,%Y0\";
- else
- return \"ret\;restore %%g0,%1,%Y0\";
-}"
- [(set_attr "type" "multi")])
-
-(define_insn "*return_hi"
- [(set (match_operand:HI 0 "restore_operand" "")
- (match_operand:HI 1 "arith_operand" "rI"))
- (return)]
- "! TARGET_EPILOGUE && ! TARGET_LIVE_G0"
- "*
-{
- if (! TARGET_ARCH64 && current_function_returns_struct)
- return \"jmp %%i7+12\;restore %%g0,%1,%Y0\";
- else
- return \"ret\;restore %%g0,%1,%Y0\";
-}"
- [(set_attr "type" "multi")])
-
-(define_insn "*return_si"
- [(set (match_operand:SI 0 "restore_operand" "")
- (match_operand:SI 1 "arith_operand" "rI"))
- (return)]
- "! TARGET_EPILOGUE && ! TARGET_LIVE_G0"
- "*
-{
- if (! TARGET_ARCH64 && current_function_returns_struct)
- return \"jmp %%i7+12\;restore %%g0,%1,%Y0\";
- else
- return \"ret\;restore %%g0,%1,%Y0\";
-}"
- [(set_attr "type" "multi")])
-
-;; The following pattern is only generated by delayed-branch scheduling,
-;; when the insn winds up in the epilogue. This can only happen when
-;; ! TARGET_FPU because otherwise fp return values are in %f0.
-(define_insn "*return_sf_no_fpu"
- [(set (match_operand:SF 0 "restore_operand" "r")
- (match_operand:SF 1 "register_operand" "r"))
- (return)]
- "! TARGET_FPU && ! TARGET_EPILOGUE && ! TARGET_LIVE_G0"
- "*
-{
- if (! TARGET_ARCH64 && current_function_returns_struct)
- return \"jmp %%i7+12\;restore %%g0,%1,%Y0\";
- else
- return \"ret\;restore %%g0,%1,%Y0\";
-}"
- [(set_attr "type" "multi")])
-
-(define_insn "*return_addsi"
- [(set (match_operand:SI 0 "restore_operand" "")
- (plus:SI (match_operand:SI 1 "arith_operand" "%r")
- (match_operand:SI 2 "arith_operand" "rI")))
- (return)]
- "! TARGET_EPILOGUE && ! TARGET_LIVE_G0"
- "*
-{
- if (! TARGET_ARCH64 && current_function_returns_struct)
- return \"jmp %%i7+12\;restore %r1,%2,%Y0\";
- else
- return \"ret\;restore %r1,%2,%Y0\";
-}"
- [(set_attr "type" "multi")])
-
-(define_insn "*return_di"
- [(set (match_operand:DI 0 "restore_operand" "")
- (match_operand:DI 1 "arith_double_operand" "rHI"))
- (return)]
- "TARGET_ARCH64 && ! TARGET_EPILOGUE"
- "ret\;restore %%g0,%1,%Y0"
- [(set_attr "type" "multi")])
-
-(define_insn "*return_adddi"
- [(set (match_operand:DI 0 "restore_operand" "")
- (plus:DI (match_operand:DI 1 "arith_operand" "%r")
- (match_operand:DI 2 "arith_double_operand" "rHI")))
- (return)]
- "TARGET_ARCH64 && ! TARGET_EPILOGUE"
- "ret\;restore %r1,%2,%Y0"
- [(set_attr "type" "multi")])
-
-;; Turned off because it should never match (subtracting a constant
-;; is turned into addition) and because it would do the wrong thing
-;; when operand 2 is -4096 (--4096 == 4096 is not a valid immediate).
-;;(define_insn "*minus_const"
-;; [(set (match_operand:SI 0 "restore_operand" "")
-;; (minus:SI (match_operand:SI 1 "register_operand" "r")
-;; (match_operand:SI 2 "small_int" "I")))
-;; (return)]
-;; "! TARGET_EPILOGUE"
-;; "ret\;restore %1,-(%2),%Y0"
-;; [(set_attr "type" "multi")])
-
-;; The following pattern is only generated by delayed-branch scheduling,
-;; when the insn winds up in the epilogue.
-(define_insn "*return_sf"
- [(set (reg:SF 32)
- (match_operand:SF 0 "register_operand" "f"))
- (return)]
- "! TARGET_EPILOGUE"
- "ret\;fmovs %0,%%f0"
- [(set_attr "type" "multi")])
-
-;; Now peepholes to do a call followed by a jump.
-
-(define_peephole
- [(parallel [(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "call_operand_address" "ps"))
- (match_operand 2 "" "")))
- (clobber (reg:SI 15))])
- (set (pc) (label_ref (match_operand 3 "" "")))]
- "short_branch (INSN_UID (insn), INSN_UID (operands[3]))"
- "call %a1,%2\;add %%o7,(%l3-.-4),%%o7")
-
-(define_peephole
- [(parallel [(call (mem:SI (match_operand:SI 0 "call_operand_address" "ps"))
- (match_operand 1 "" ""))
- (clobber (reg:SI 15))])
- (set (pc) (label_ref (match_operand 2 "" "")))]
- "short_branch (INSN_UID (insn), INSN_UID (operands[2]))"
- "*
-{
- return \"call %a0,%1\;add %%o7,(%l2-.-4),%%o7\";
-}")
-
-(define_peephole
- [(parallel [(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:DI 1 "call_operand_address" "ps"))
- (match_operand 2 "" "")))
- (clobber (reg:DI 15))])
- (set (pc) (label_ref (match_operand 3 "" "")))]
- "TARGET_ARCH64 && short_branch (INSN_UID (insn), INSN_UID (operands[3]))"
- "call %a1,%2\;add %%o7,(%l3-.-4),%%o7")
-
-(define_peephole
- [(parallel [(call (mem:SI (match_operand:DI 0 "call_operand_address" "ps"))
- (match_operand 1 "" ""))
- (clobber (reg:DI 15))])
- (set (pc) (label_ref (match_operand 2 "" "")))]
- "TARGET_ARCH64 && short_branch (INSN_UID (insn), INSN_UID (operands[2]))"
- "call %a0,%1\;add %%o7,(%l2-.-4),%%o7")
-
-;; Other miscellaneous peepholes.
-
-;; (reg:SI 100) is created by the {add,neg,sub}di patterns.
-(define_peephole
- [(parallel [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
- (reg:SI 100)))
- (clobber (reg:CC 100))])
- (set (reg:CC 100) (compare (match_dup 0) (const_int 0)))]
- ""
- "subxcc %r1,0,%0")
diff --git a/gcc/config/sparc/splet.h b/gcc/config/sparc/splet.h
deleted file mode 100644
index 9c2eface23d..00000000000
--- a/gcc/config/sparc/splet.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SPARClet.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Doug Evans (dje@cygnus.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 "sparc/aout.h"
-
-/* -mbroken-saverestore is not included here because the long term
- default is -mno-broken-saverestore. */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE)
-
-/* -mlive-g0 is only supported on the sparclet. */
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
-{"big-endian", -MASK_LITTLE_ENDIAN}, \
-{"little-endian", MASK_LITTLE_ENDIAN}, \
-{"live-g0", MASK_LIVE_G0}, \
-{"no-live-g0", -MASK_LIVE_G0}, \
-{"broken-saverestore", MASK_BROKEN_SAVERESTORE}, \
-{"no-broken-saverestore", -MASK_BROKEN_SAVERESTORE},
-
-#undef CPP_SPEC
-#define CPP_SPEC "\
-%(cpp_cpu) \
-%{mlittle-endian:-D__LITTLE_ENDIAN__} \
-"
-
-#undef ASM_SPEC
-#define ASM_SPEC "%{mlittle-endian:-EL} %(asm_cpu)"
-
-/* Require the user to supply crt0.o. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
-
-#undef LINK_SPEC
-#define LINK_SPEC "%{mlittle-endian:-EL}"
-
-/* sparclet chips are bi-endian. */
-#undef BYTES_BIG_ENDIAN
-#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
-#undef WORDS_BIG_ENDIAN
-#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
diff --git a/gcc/config/sparc/sun4o3.h b/gcc/config/sparc/sun4o3.h
deleted file mode 100644
index 5fcb72f4a63..00000000000
--- a/gcc/config/sparc/sun4o3.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "sparc/sparc.h"
-
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tsethi %%hi(LP%d),%%o0\n\tcall .mcount\n\tor %%lo(LP%d),%%o0,%%o0\n", \
- (LABELNO), (LABELNO))
-
-/* LINK_SPEC is needed only for Sunos 4. */
-
-#undef LINK_SPEC
diff --git a/gcc/config/sparc/sunos4.h b/gcc/config/sparc/sunos4.h
deleted file mode 100644
index 1b58a17d282..00000000000
--- a/gcc/config/sparc/sunos4.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SunOS 4.x
- Copyright (C) 1994 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. */
-
-#define SUNOS4_SHARED_LIBRARIES 1
-
-/* Use N_BINCL stabs. */
-
-#define DBX_USE_BINCL
-
-#include "sparc/sparc.h"
diff --git a/gcc/config/sparc/sysv4.h b/gcc/config/sparc/sysv4.h
deleted file mode 100644
index 4dfde2af3d0..00000000000
--- a/gcc/config/sparc/sysv4.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/* Target definitions for GNU compiler for Sparc running System V.4
- Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
-
- Written by Ron Guilmette (rfg@netcom.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 "sparc/sparc.h"
-
-/* Undefine some symbols which are defined in "sparc.h" but which are
- appropriate only for SunOS 4.x, and not for svr4. */
-
-#undef WORD_SWITCH_TAKES_ARG
-#undef ASM_OUTPUT_SOURCE_LINE
-#undef SELECT_SECTION
-#undef ASM_DECLARE_FUNCTION_NAME
-#undef TEXT_SECTION_ASM_OP
-#undef DATA_SECTION_ASM_OP
-
-#include "svr4.h"
-
-/* Undefined some symbols which are defined in "svr4.h" but which are
- appropriate only for typical svr4 systems, but not for the specific
- case of svr4 running on a Sparc. */
-
-#undef INIT_SECTION_ASM_OP
-#undef FINI_SECTION_ASM_OP
-#undef CONST_SECTION_ASM_OP
-#undef TYPE_OPERAND_FMT
-#undef PUSHSECTION_FORMAT
-#undef STRING_ASM_OP
-#undef COMMON_ASM_OP
-#undef SKIP_ASM_OP
-#undef SET_ASM_OP /* Has no equivalent. See ASM_OUTPUT_DEF below. */
-
-/* Provide a set of pre-definitions and pre-assertions appropriate for
- the Sparc running svr4. __svr4__ is our extension. */
-
-#define CPP_PREDEFINES \
- "-Dsparc -Dunix -D__svr4__ \
- -Asystem(unix) -Asystem(svr4) -Acpu(sparc) -Amachine(sparc) \
- -D__GCC_NEW_VARARGS__"
-
-/* The native assembler can't compute differences between symbols in different
- sections when generating pic code, so we must put jump tables in the
- text section. */
-#define JUMP_TABLES_IN_TEXT_SECTION 1
-
-/* Pass -K to the assembler when PIC. */
-#undef ASM_SPEC
-#define ASM_SPEC \
- "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
- %{fpic:-K PIC} %{fPIC:-K PIC} %(asm_cpu)"
-
-/* Must use data section for relocatable constants when pic. */
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE,RTX) \
-{ \
- if (flag_pic && symbolic_operand (RTX)) \
- data_section (); \
- else \
- const_section (); \
-}
-
-/* This is the string used to begin an assembly language comment for the
- Sparc/svr4 assembler. */
-
-#define ASM_COMMENT_START "!"
-
-/* Define the names of various pseudo-op used by the Sparc/svr4 assembler.
- Note that many of these are different from the typical pseudo-ops used
- by most svr4 assemblers. That is probably due to a (misguided?) attempt
- to keep the Sparc/svr4 assembler somewhat compatible with the Sparc/SunOS
- assembler. */
-
-#define STRING_ASM_OP ".asciz"
-#define COMMON_ASM_OP ".common"
-#define SKIP_ASM_OP ".skip"
-#define UNALIGNED_INT_ASM_OP ".uaword"
-#define UNALIGNED_SHORT_ASM_OP ".uahalf"
-#define PUSHSECTION_ASM_OP ".pushsection"
-#define POPSECTION_ASM_OP ".popsection"
-
-/* This is defined in sparc.h but is not used by svr4.h. */
-#undef ASM_LONG
-#define ASM_LONG ".long"
-
-/* This is the format used to print the second operand of a .type pseudo-op
- for the Sparc/svr4 assembler. */
-
-#define TYPE_OPERAND_FMT "#%s"
-
-/* This is the format used to print a .pushsection pseudo-op (and its operand)
- for the Sparc/svr4 assembler. */
-
-#define PUSHSECTION_FORMAT "\t%s\t\"%s\"\n"
-
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
-do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \
- ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM); \
- } while (0)
-
-/* This is how to equate one symbol to another symbol. The syntax used is
- `SYM1=SYM2'. Note that this is different from the way equates are done
- with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
-
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t"); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, " = "); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* Define how the Sparc registers should be numbered for Dwarf output.
- The numbering provided here should be compatible with the native
- svr4 SDB debugger in the Sparc/svr4 reference port. The numbering
- is as follows:
-
- Assembly name gcc internal regno Dwarf regno
- ----------------------------------------------------------
- g0-g7 0-7 0-7
- o0-o7 8-15 8-15
- l0-l7 16-23 16-23
- i0-i7 24-31 24-31
- f0-f31 32-63 40-71
-*/
-
-#define DBX_REGISTER_NUMBER(REGNO) \
- (((REGNO) < 32) ? (REGNO) \
- : ((REGNO) < 63) ? ((REGNO) + 8) \
- : (abort (), 0))
-
-/* A set of symbol definitions for assembly pseudo-ops which will
- get us switched to various sections of interest. These are used
- in all places where we simply want to switch to a section, and
- *not* to push the previous section name onto the assembler's
- section names stack (as we do often in dwarfout.c). */
-
-#define TEXT_SECTION_ASM_OP ".section\t\".text\""
-#define DATA_SECTION_ASM_OP ".section\t\".data\""
-#define BSS_SECTION_ASM_OP ".section\t\".bss\""
-#define CONST_SECTION_ASM_OP ".section\t\".rodata\""
-#define INIT_SECTION_ASM_OP ".section\t\".init\""
-#define FINI_SECTION_ASM_OP ".section\t\".fini\""
-
-/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
-
- Note that we want to give these sections the SHF_WRITE attribute
- because these sections will actually contain data (i.e. tables of
- addresses of functions in the current root executable or shared library
- file) and, in the case of a shared library, the relocatable addresses
- will have to be properly resolved/relocated (and then written into) by
- the dynamic linker when it actually attaches the given shared library
- to the executing process. (Note that on SVR4, you may wish to use the
- `-z text' option to the ELF linker, when building a shared library, as
- an additional check that you are doing everything right. But if you do
- use the `-z text' option when building a shared library, you will get
- errors unless the .ctors and .dtors sections are marked as writable
- via the SHF_WRITE attribute.) */
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP ".section\t\".ctors\",#alloc,#write"
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP ".section\t\".dtors\",#alloc,#write"
-
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#undef ASM_OUTPUT_SECTION_NAME /* Override svr4.h's definition. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
-do { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (FILE, ".section\t\"%s%s\",#alloc,#execinstr\n", \
- flag_function_sections ? ".text%" : "", (NAME)); \
- else if ((DECL) && TREE_READONLY (DECL)) \
- fprintf (FILE, ".section\t\"%s\",#alloc\n", (NAME)); \
- else \
- fprintf (FILE, ".section\t\"%s\",#alloc,#write\n", (NAME)); \
-} while (0)
-
-/* This is how to output assembly code to define a `float' constant.
- We always have to use a .long pseudo-op to do this because the native
- SVR4 ELF assembler is buggy and it generates incorrect values when we
- try to use the .float pseudo-op instead. */
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { long value; \
- REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value); \
- fprintf((FILE), "\t%s\t0x%x\n", ASM_LONG, value); \
- } while (0)
-
-/* This is how to output assembly code to define a `double' constant.
- We always have to use a pair of .long pseudo-ops to do this because
- the native SVR4 ELF assembler is buggy and it generates incorrect
- values when we try to use the the .double pseudo-op instead. */
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { long value[2]; \
- REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value); \
- fprintf((FILE), "\t%s\t0x%x\n", ASM_LONG, value[0]); \
- fprintf((FILE), "\t%s\t0x%x\n", ASM_LONG, value[1]); \
- } while (0)
-
-/* This is how to output an assembler line defining a `long double'
- constant. */
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
-do { long value[4]; \
- REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value); \
- fprintf((FILE), "\t%s\t0x%x\n", ASM_LONG, value[0]); \
- fprintf((FILE), "\t%s\t0x%x\n", ASM_LONG, value[1]); \
- fprintf((FILE), "\t%s\t0x%x\n", ASM_LONG, value[2]); \
- fprintf((FILE), "\t%s\t0x%x\n", ASM_LONG, value[3]); \
- } while (0)
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-
-#undef FUNCTION_BLOCK_PROFILER
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- do { \
- if (TARGET_MEDANY) \
- fprintf (FILE, "\tsethi %%hi(.LLPBX0),%%o0\n\tor %%0,%%lo(.LLPBX0),%%o0\n\tld [%s+%%o0],%%o1\n\ttst %%o1\n\tbne .LLPY%d\n\tadd %%o0,%s,%%o0\n\tcall __bb_init_func\n\tnop\nLPY%d:\n", \
- MEDANY_BASE_REG, (LABELNO), MEDANY_BASE_REG, (LABELNO)); \
- else \
- fprintf (FILE, "\tsethi %%hi(.LLPBX0),%%o0\n\tld [%%lo(.LLPBX0)+%%o0],%%o1\n\ttst %%o1\n\tbne LPY%d\n\tadd %%o0,%%lo(.LLPBX0),%%o0\n\tcall __bb_init_func\n\tnop\nLPY%d:\n", \
- (LABELNO), (LABELNO)); \
- } while (0)
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. */
-
-#undef BLOCK_PROFILER
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
-{ \
- int blockn = (BLOCKNO); \
- if (TARGET_MEDANY) \
- fprintf (FILE, "\tsethi %%hi(.LLPBX2+%d),%%g1\n\tor %%g1,%%lo(.LLPBX2+%d),%%g1\n\tld [%%g1+%s],%%g2\n\tadd %%g2,1,%%g2\n\tst %%g2,[%%g1+%s]\n", \
- 4 * blockn, 4 * blockn, MEDANY_BASE_REG, MEDANY_BASE_REG); \
- else \
- fprintf (FILE, "\tsethi %%hi(.LLPBX2+%d),%%g1\n\tld [%%lo(.LLPBX2+%d)+%%g1],%%g2\n\
-\tadd %%g2,1,%%g2\n\tst %%g2,[%%lo(.LLPBX2+%d)+%%g1]\n", \
- 4 * blockn, 4 * blockn, 4 * blockn); \
-}
-
-/* A C statement (sans semicolon) to output to the stdio stream
- FILE the assembler definition of uninitialized global DECL named
- NAME whose size is SIZE bytes and alignment is ALIGN bytes.
- Try to use asm_output_aligned_bss to implement this macro. */
-
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
- asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
diff --git a/gcc/config/sparc/t-sol2 b/gcc/config/sparc/t-sol2
deleted file mode 100644
index d41254adb44..00000000000
--- a/gcc/config/sparc/t-sol2
+++ /dev/null
@@ -1,30 +0,0 @@
-# we need to supply our own assembly versions of libgcc1.c files,
-# since the user may not have native 'cc' available
-
-LIBGCC1 =
-CROSS_LIBGCC1 =
-LIBGCC1_TEST =
-
-# gmon build rule:
-gmon.o: $(srcdir)/config/sparc/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) stmp-int-hdrs
- $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \
- -c $(srcdir)/config/sparc/gmon-sol2.c -o gmon.o
-
-# Assemble startup files.
-crt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o crt1.o -x assembler $(srcdir)/config/sparc/sol2-c1.asm
-crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/sparc/sol2-ci.asm
-crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/sparc/sol2-cn.asm
-gcrt1.o: $(srcdir)/config/sparc/sol2-g1.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o gcrt1.o -x assembler $(srcdir)/config/sparc/sol2-g1.asm
-
-# We need to use -fPIC when we are using gcc to compile the routines in
-# crtstuff.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fPIC when compiling the
-# routines in crtstuff.c.
-
-CRTSTUFF_T_CFLAGS = -fPIC
-TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/sparc/t-sp64 b/gcc/config/sparc/t-sp64
deleted file mode 100644
index e0de5edd98a..00000000000
--- a/gcc/config/sparc/t-sp64
+++ /dev/null
@@ -1,3 +0,0 @@
-LIBGCC1 =
-CROSS_LIBGCC1 =
-LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g1
diff --git a/gcc/config/sparc/t-sparcbare b/gcc/config/sparc/t-sparcbare
deleted file mode 100644
index 3c7c740b138..00000000000
--- a/gcc/config/sparc/t-sparcbare
+++ /dev/null
@@ -1,26 +0,0 @@
-# configuration file for a bare sparc cpu, aout format files
-
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = sparc/lb1spc.asm
-LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-# MULTILIB_OPTIONS should have msparclite too, but we'd have to make
-# gas build...
-MULTILIB_OPTIONS = msoft-float mcpu=v8
-MULTILIB_DIRNAMES = soft v8
-MULTILIB_MATCHES = msoft-float=mno-fpu mcpu?v8=mv8
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/sparc/t-sparclite b/gcc/config/sparc/t-sparclite
deleted file mode 100644
index 7cdfbb04551..00000000000
--- a/gcc/config/sparc/t-sparclite
+++ /dev/null
@@ -1,24 +0,0 @@
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = sparc/lb1spl.asm
-LIB1ASMFUNCS = _divsi3 _udivsi3 _modsi3 _umodsi3
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define US_SOFTWARE_GOFAST' > dp-bit.c
- cat $(srcdir)/config/fp-bit.c >> dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- echo '#define US_SOFTWARE_GOFAST' >> fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-MULTILIB_OPTIONS = mfpu mflat
-MULTILIB_DIRNAMES =
-MULTILIB_MATCHES = mfpu=mhard-float mfpu=mcpu?f934
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/sparc/t-splet b/gcc/config/sparc/t-splet
deleted file mode 100644
index 3409f5dfe88..00000000000
--- a/gcc/config/sparc/t-splet
+++ /dev/null
@@ -1,23 +0,0 @@
-# configuration file for a bare sparclet cpu, aout format files
-
-CROSS_LIBGCC1 = libgcc1-asm.a
-LIB1ASMSRC = sparc/lb1spc.asm
-LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
-
-# These are really part of libgcc1, but this will cause them to be
-# built correctly, so...
-
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
-
-dp-bit.c: $(srcdir)/config/fp-bit.c
- cat $(srcdir)/config/fp-bit.c > dp-bit.c
-
-fp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#define FLOAT' > fp-bit.c
- cat $(srcdir)/config/fp-bit.c >> fp-bit.c
-
-MULTILIB_OPTIONS = mlittle-endian mlive-g0 mbroken-saverestore
-MULTILIB_DIRNAMES = little live-g0 brknsave
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/sparc/t-sunos40 b/gcc/config/sparc/t-sunos40
deleted file mode 100644
index 3e10575eaea..00000000000
--- a/gcc/config/sparc/t-sunos40
+++ /dev/null
@@ -1,7 +0,0 @@
-# SunOS 4.0.*
-# /bin/as doesn't recognize the v8 instructions, so we can't do a v8
-# multilib build.
-
-LIBGCC1 =
-CROSS_LIBGCC1 =
-LIBGCC1_TEST =
diff --git a/gcc/config/sparc/t-sunos41 b/gcc/config/sparc/t-sunos41
deleted file mode 100644
index 5783d6a2625..00000000000
--- a/gcc/config/sparc/t-sunos41
+++ /dev/null
@@ -1,16 +0,0 @@
-# SunOS 4.1.*
-
-LIBGCC1 =
-CROSS_LIBGCC1 =
-LIBGCC1_TEST =
-
-MULTILIB_OPTIONS = fpic/fPIC mcpu=v8
-MULTILIB_DIRNAMES = pic ucpic v8
-MULTILIB_MATCHES = mcpu?v8=mv8
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
-
-# The native linker doesn't handle linking -fpic code with -fPIC code. Ugh.
-# We cope by building both variants of libgcc.
-#TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/sparc/t-vxsparc b/gcc/config/sparc/t-vxsparc
deleted file mode 100644
index 3adba438bd9..00000000000
--- a/gcc/config/sparc/t-vxsparc
+++ /dev/null
@@ -1,17 +0,0 @@
-LIBGCC1 =
-CROSS_LIBGCC1 =
-
-# We don't want to build .umul, etc., because VxWorks provides them,
-# which means that libgcc1-test will fail.
-LIBGCC1_TEST =
-
-# We don't want to put exit in libgcc.a for VxWorks, because VxWorks
-# does not have _exit.
-LIBGCC2_CFLAGS = -O2 $(GCC_CFLAGS) -g1 -Dexit=unused_exit
-
-MULTILIB_OPTIONS=msoft-float mv8
-MULTILIB_DIRNAMES=soft v8
-MULTILIB_MATCHES=msoft-float=mno-fpu
-
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
diff --git a/gcc/config/sparc/vxsim.h b/gcc/config/sparc/vxsim.h
deleted file mode 100644
index 6c80375f56b..00000000000
--- a/gcc/config/sparc/vxsim.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SPARC VxSim
- Copyright 1996 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. */
-
-/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
-#include "sparc/sysv4.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-DCPU=SIMSPARCSOLARIS -D__vxworks -D__vxworks__ -Dsparc -D__svr4__ -D__SVR4 \
- -Asystem(embedded) -Asystem(svr4) -Acpu(sparc) -Amachine(sparc)\
- -D__GCC_NEW_VARARGS__"
-
-#undef CPP_SPEC
-#define CPP_SPEC ""
-
-#undef CC1_SPEC
-#define CC1_SPEC "-fno-builtin %{sun4:} %{target:}"
-
-/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
- It's safe to pass -s always, even if -g is not used. */
-#undef ASM_SPEC
-#define ASM_SPEC \
- "%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
- %{fpic:-K PIC} %{fPIC:-K PIC}"
-
-/* However it appears that Solaris 2.0 uses the same reg numbering as
- the old BSD-style system did. */
-
-#undef DBX_REGISTER_NUMBER
-/* Same as sparc.h */
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* We use stabs-in-elf for debugging, because that is what the native
- toolchain uses. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* The Solaris 2 assembler uses .skip, not .zero, so put this back. */
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.skip %u\n", (SIZE))
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- fputs ("\t.local\t", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- putc ('\n', (FILE)); \
- ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
-} while (0)
-
-#undef COMMON_ASM_OP
-#define COMMON_ASM_OP "\t.common"
-
-/* This is how to output a definition of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
-
-/* This is how to output a reference to an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#undef ASM_OUTPUT_INTERNAL_LABELREF
-#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
- fprintf (FILE, ".L%s%d", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
-
-
-
-#undef LIB_SPEC
-#define LIB_SPEC ""
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC ""
-
-#undef LINK_SPEC
-#define LINK_SPEC "-r"
-
-/* This defines which switch letters take arguments.
- It is as in svr4.h but with -R added. */
-
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
- ( (CHAR) == 'D' \
- || (CHAR) == 'U' \
- || (CHAR) == 'o' \
- || (CHAR) == 'e' \
- || (CHAR) == 'u' \
- || (CHAR) == 'I' \
- || (CHAR) == 'm' \
- || (CHAR) == 'L' \
- || (CHAR) == 'R' \
- || (CHAR) == 'A' \
- || (CHAR) == 'h' \
- || (CHAR) == 'z')
-
-/* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h.
- Instead, it is enabled here, because it does work under Solaris. */
-/* Define for support of TFmode long double and REAL_ARITHMETIC.
- Sparc ABI says that long double is 4 words. */
-#define LONG_DOUBLE_TYPE_SIZE 64
diff --git a/gcc/config/sparc/vxsparc.h b/gcc/config/sparc/vxsparc.h
deleted file mode 100644
index f2e95543add..00000000000
--- a/gcc/config/sparc/vxsparc.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Definitions of target machine for GNU compiler. Vxworks SPARC version.
- Copyright (C) 1994, 1996 Free Software Foundation, Inc.
- Contributed by David Henkel-Wallace (gumby@cygnus.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 "sparc/aout.h"
-
-/* Specify what to link with. */
-/* VxWorks does all the library stuff itself. */
-
-#undef LIB_SPEC
-#define LIB_SPEC ""
-
-/* Provide required defaults for linker -e. */
-#undef LINK_SPEC
-#define LINK_SPEC "%{!nostdlib:%{!r*:%{!e*:-e start}}}"
-
-/* VxWorks provides the functionality of crt0.o and friends itself. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dsparc -Acpu(sparc) -Amachine(sparc) -DCPU=SPARC"
-
-#undef PTRDIFF_TYPE
-#undef SIZE_TYPE
-#undef WCHAR_TYPE
-#undef WCHAR_TYPE_SIZE
-
-#define PTRDIFF_TYPE "long int"
-#define SIZE_TYPE "unsigned int"
-#define WCHAR_TYPE "char"
-#define WCHAR_TYPE_SIZE 8
-
-/* US Software GOFAST library support. */
-#include "gofast.h"
-#undef INIT_SUBTARGET_OPTABS
-#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
diff --git a/gcc/config/sparc/x-sysv4 b/gcc/config/sparc/x-sysv4
deleted file mode 100644
index 2a661e35999..00000000000
--- a/gcc/config/sparc/x-sysv4
+++ /dev/null
@@ -1,2 +0,0 @@
-X_CFLAGS=-DSVR4
-ALLOCA=alloca.o
diff --git a/gcc/config/sparc/xm-linux.h b/gcc/config/sparc/xm-linux.h
deleted file mode 100644
index 64dc7c8ddf9..00000000000
--- a/gcc/config/sparc/xm-linux.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Configuration for GCC for SPARC running Linux.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Eddie C. Dost (ecd@skynet.be)
-
-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 <sparc/xm-sparc.h>
-#include <xm-linux.h>
diff --git a/gcc/config/sparc/xm-lynx.h b/gcc/config/sparc/xm-lynx.h
deleted file mode 100644
index 90fef8543b9..00000000000
--- a/gcc/config/sparc/xm-lynx.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Configuration for GNU C-compiler for sparc platforms running LynxOS.
- Copyright (C) 1995 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. */
-
-#include <xm-lynx.h>
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* Include <sys/wait.h> to define the exit status access macros. */
-#include <sys/types.h>
-#include <sys/wait.h>
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-
-#include "tm.h"
diff --git a/gcc/config/sparc/xm-sol2.h b/gcc/config/sparc/xm-sol2.h
deleted file mode 100644
index 234ed999d05..00000000000
--- a/gcc/config/sparc/xm-sol2.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "sparc/xm-sysv4.h"
-
-/* If not compiled with GNU C, include the system's <alloca.h> header. */
-#ifndef __GNUC__
-#include <alloca.h>
-#endif
-
-/* We have _sys_siglist, but the declaration in <signal.h> conflicts with
- the declarations in collect2.c and mips-tfile.c, so disable the declarations
- in those files. */
-
-#define DONT_DECLARE_SYS_SIGLIST
diff --git a/gcc/config/sparc/xm-sparc.h b/gcc/config/sparc/xm-sparc.h
deleted file mode 100644
index afc44ae889d..00000000000
--- a/gcc/config/sparc/xm-sparc.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Configuration for GNU C-compiler for Sun Sparc.
- Copyright (C) 1988, 1993, 1995 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Doubles are stored in memory with the high order word first. This
- matters when cross-compiling. */
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-#define HAVE_POPEN
-
-/* If compiled with Sun CC, the use of alloca requires this #include. */
-#ifndef __GNUC__
-#include "alloca.h"
-#endif
diff --git a/gcc/config/sparc/xm-sysv4.h b/gcc/config/sparc/xm-sysv4.h
deleted file mode 100644
index e72c49922fd..00000000000
--- a/gcc/config/sparc/xm-sysv4.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Configuration for GNU C-compiler for Sun Sparc running System V.4.
- Copyright (C) 1992, 1993 Free Software Foundation, Inc.
-
- Written by Ron Guilmette (rfg@netcom.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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* Doubles are stored in memory with the high order word first. This
- matters when cross-compiling. */
-#define HOST_WORDS_BIG_ENDIAN 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-#include "xm-svr4.h"
-
-#ifndef __GNUC__
-#define ONLY_INT_FIELDS
-#endif
diff --git a/gcc/config/spur/spur.c b/gcc/config/spur/spur.c
deleted file mode 100644
index 5837cbbfe3a..00000000000
--- a/gcc/config/spur/spur.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/* Subroutines for insn-output.c for SPUR. Adapted from routines for
- the Motorola 68000 family.
- Copyright (C) 1988, 1991 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. */
-
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-
-static rtx find_addr_reg ();
-
-char *
-output_compare (operands, opcode, exchange_opcode,
- neg_opcode, neg_exchange_opcode)
- rtx *operands;
- char *opcode;
- char *exchange_opcode;
- char *neg_opcode;
- char *neg_exchange_opcode;
-{
- static char buf[100];
- operands[2] = operands[0];
- if (GET_CODE (cc_prev_status.value1) == CONST_INT)
- {
- operands[1] = cc_prev_status.value1;
- operands[0] = cc_prev_status.value2;
- opcode = exchange_opcode, neg_opcode = neg_exchange_opcode;
- }
- else
- {
- operands[0] = cc_prev_status.value1;
- operands[1] = cc_prev_status.value2;
- }
- if (TARGET_LONG_JUMPS)
- sprintf (buf,
- "cmp_br_delayed %s,%%0,%%1,1f\n\tnop\n\tjump %%l2\n\tnop\n1:",
- neg_opcode);
- else
- sprintf (buf, "cmp_br_delayed %s,%%0,%%1,%%l2\n\tnop", opcode);
- return buf;
-}
-
-/* Return the best assembler insn template
- for moving operands[1] into operands[0] as a fullword. */
-
-static char *
-singlemove_string (operands)
- rtx *operands;
-{
- if (GET_CODE (operands[0]) == MEM)
- return "st_32 %r1,%0";
- if (GET_CODE (operands[1]) == MEM)
- return "ld_32 %0,%1\n\tnop";
- if (GET_CODE (operands[1]) == REG)
- return "add_nt %0,%1,$0";
- return "add_nt %0,r0,%1";
-}
-
-/* Output assembler code to perform a doubleword move insn
- with operands OPERANDS. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum { REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP } optype0, optype1;
- rtx latehalf[2];
- rtx addreg0 = 0, addreg1 = 0;
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if (CONSTANT_P (operands[1]))
- optype1 = CNSTOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else
- optype1 = RNDOP;
-
- /* Check for the cases that the operand constraints are not
- supposed to allow to happen. Abort if we get one,
- because generating code for these cases is painful. */
-
- if (optype0 == RNDOP || optype1 == RNDOP)
- abort ();
-
- /* If an operand is an unoffsettable memory ref, find a register
- we can increment temporarily to make it refer to the second word. */
-
- if (optype0 == MEMOP)
- addreg0 = find_addr_reg (XEXP (operands[0], 0));
-
- if (optype1 == MEMOP)
- addreg1 = find_addr_reg (XEXP (operands[1], 0));
-
- /* Ok, we can do one word at a time.
- Normally we do the low-numbered word first,
- but if either operand is autodecrementing then we
- do the high-numbered word first.
-
- In either case, set up in LATEHALF the operands to use
- for the high-numbered word and in some cases alter the
- operands in OPERANDS to be suitable for the low-numbered word. */
-
- if (optype0 == REGOP)
- latehalf[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (optype0 == OFFSOP)
- latehalf[0] = adj_offsettable_operand (operands[0], 4);
- else
- latehalf[0] = operands[0];
-
- if (optype1 == REGOP)
- latehalf[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- else if (optype1 == OFFSOP)
- latehalf[1] = adj_offsettable_operand (operands[1], 4);
- else if (optype1 == CNSTOP)
- {
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- latehalf[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (operands[1]));
- operands[1] = gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_LOW (operands[1]));
- }
- else if (CONSTANT_P (operands[1]))
- latehalf[1] = const0_rtx;
- }
- else
- latehalf[1] = operands[1];
-
- /* If the first move would clobber the source of the second one,
- do them in the other order. This happens only for registers;
- such overlap can't happen in memory unless the user explicitly
- sets it up, and that is an undefined circumstance. */
-
- if (optype0 == REGOP && optype1 == REGOP
- && REGNO (operands[0]) == REGNO (latehalf[1]))
- {
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("add_nt %0,%0,$4", &addreg0);
- if (addreg1)
- output_asm_insn ("add_nt %0,%0,$4", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("add_nt %0,%0,$-4", &addreg0);
- if (addreg1)
- output_asm_insn ("add_nt %0,%0,$-4", &addreg0);
-
- /* Do low-numbered word. */
- return singlemove_string (operands);
- }
-
- /* Normal case: do the two words, low-numbered first. */
-
- output_asm_insn (singlemove_string (operands), operands);
-
- /* Make any unoffsettable addresses point at high-numbered word. */
- if (addreg0)
- output_asm_insn ("add_nt %0,%0,$4", &addreg0);
- if (addreg1)
- output_asm_insn ("add_nt %0,%0,$4", &addreg1);
-
- /* Do that word. */
- output_asm_insn (singlemove_string (latehalf), latehalf);
-
- /* Undo the adds we just did. */
- if (addreg0)
- output_asm_insn ("add_nt %0,%0,$-4", &addreg0);
- if (addreg1)
- output_asm_insn ("add_nt %0,%0,$-4", &addreg1);
-
- return "";
-}
-
-static char *
-output_fp_move_double (operands)
- rtx *operands;
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return "fmov %0,%1";
- if (GET_CODE (operands[1]) == REG)
- {
- rtx xoperands[2];
- int offset = - get_frame_size () - 8;
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- xoperands[0] = gen_rtx (CONST_INT, VOIDmode, offset + 4);
- output_asm_insn ("st_32 %1,r25,%0", xoperands);
- xoperands[1] = operands[1];
- xoperands[0] = gen_rtx (CONST_INT, VOIDmode, offset);
- output_asm_insn ("st_32 %1,r25,%0", xoperands);
- xoperands[1] = operands[0];
- output_asm_insn ("ld_dbl %1,r25,%0\n\tnop", xoperands);
- return "";
- }
- return "ld_dbl %0,%1\n\tnop";
- }
- else if (FP_REG_P (operands[1]))
- {
- if (GET_CODE (operands[0]) == REG)
- {
- rtx xoperands[2];
- int offset = - get_frame_size () - 8;
- xoperands[0] = gen_rtx (CONST_INT, VOIDmode, offset);
- xoperands[1] = operands[1];
- output_asm_insn ("st_dbl %1,r25,%0", xoperands);
- xoperands[1] = operands[0];
- output_asm_insn ("ld_32 %1,r25,%0\n\tnop", xoperands);
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- xoperands[0] = gen_rtx (CONST_INT, VOIDmode, offset + 4);
- output_asm_insn ("ld_32 %1,r25,%0\n\tnop", xoperands);
- return "";
- }
- return "st_dbl %1,%0";
- }
-}
-
-/* Return a REG that occurs in ADDR with coefficient 1.
- ADDR can be effectively incremented by incrementing REG. */
-
-static rtx
-find_addr_reg (addr)
- rtx addr;
-{
- while (GET_CODE (addr) == PLUS)
- {
- if (GET_CODE (XEXP (addr, 0)) == REG)
- addr = XEXP (addr, 0);
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 0)))
- addr = XEXP (addr, 1);
- else if (CONSTANT_P (XEXP (addr, 1)))
- addr = XEXP (addr, 0);
- else
- abort ();
- }
- if (GET_CODE (addr) == REG)
- return addr;
- abort ();
-}
-
-/* Generate code to add a large integer constant to register, reg, storing
- * the result in a register, target. Offset must be 27-bit signed quantity */
-
-static char *
-output_add_large_offset (target, reg, offset)
- rtx target, reg;
- int offset;
-{
- rtx operands[3];
- int high, n, i;
- operands[0] = target, operands[1] = reg;
-
- for (high = offset, n = 0;
- (unsigned) (high + 0x2000) >= 0x4000;
- high >>= 1, n += 1)
- ;
- operands[2] = gen_rtx (CONST_INT, VOIDmode, high);
- output_asm_insn ("add_nt r2,r0,%2", operands);
- i = n;
- while (i >= 3)
- output_asm_insn ("sll r2,r2,$3", operands), i -= 3;
- if (i == 2)
- output_asm_insn ("sll r2,r2,$2", operands);
- else if (i == 1)
- output_asm_insn ("sll r2,r2,$1", operands);
- output_asm_insn ("add_nt %0,r2,%1", operands);
- if (offset - (high << n) != 0)
- {
- operands[2] = gen_rtx (CONST_INT, VOIDmode, offset - (high << n));
- output_asm_insn ("add_nt %0,%0,%2", operands);
- }
- return "";
-}
-
-/* Additional TESTFN for matching. Like immediate_operand, but matches big
- * constants */
-
-int
-big_immediate_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- return (GET_CODE (op) == CONST_INT);
-}
diff --git a/gcc/config/spur/spur.h b/gcc/config/spur/spur.h
deleted file mode 100644
index 51e1add1b27..00000000000
--- a/gcc/config/spur/spur.h
+++ /dev/null
@@ -1,1050 +0,0 @@
-/* Definitions of target machine for GNU compiler, for SPUR chip.
- Copyright (C) 1988, 1995, 1996 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. */
-
-
-/* Note that some other tm.h files include this one and then override
- many of the definitions that relate to assembler syntax. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dspur -Acpu(spur) -Amachine(spur)"
-
-/* Link with libg.a when debugging, for dbx's sake. */
-
-#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
-
-/* Print subsidiary information on the compiler version in use. */
-#define TARGET_VERSION fprintf (stderr, " (spur)");
-
-/* Run-time compilation parameters selecting different hardware subsets.
-
- On the SPUR, we don't yet need any. */
-
-extern int target_flags;
-
-/* Nonzero if we should generate code to use the fpu. */
-#define TARGET_FPU (target_flags & 1)
-
-/* Nonzero if we should expand constant shifts into series of shift
- instructions. */
-#define TARGET_EXPAND_SHIFTS (target_flags & 2)
-
-/* Nonzero if we should generate long jumps for compares. */
-#define TARGET_LONG_JUMPS (target_flags & 4)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { {"fpu", 1}, \
- {"soft-float", -1}, \
- {"expand-shifts", 2}, \
- {"lib-shifts", -2}, \
- {"long-jumps", 4}, \
- {"short-jumps", -4}, \
- { "", TARGET_DEFAULT}}
-
-#define TARGET_DEFAULT 0
-
-/* target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is a moot question on the SPUR due to the lack of bit-field insns. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is not true on SPUR. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-/* For SPUR we can decide arbitrarily
- since there are no machine instructions for them. */
-#define WORDS_BIG_ENDIAN 0
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 64
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 64
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 32
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 64
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers.
-
- SPUR has 32 fullword registers and 15 floating point registers. */
-
-#define FIRST_PSEUDO_REGISTER 47
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On SPUR, this includes all the global registers
- and the callee return address register. */
-#define FIXED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
- 1, 0, 0, 0, 0, 0, \
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
- 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
-
- On SPUR, ordinary registers hold 32 bits worth;
- a single floating point register is always enough for
- anything that can be stored in them at all. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((REGNO) >= 32 ? GET_MODE_NUNITS ((MODE)) \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On SPUR, the cpu registers can hold any mode but the float registers
- can hold only floating point. And they can't hold anything if use
- of hardware floating point is disabled. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (((REGNO) < 32 \
- && (REGNO) + ((GET_MODE_UNIT_SIZE ((MODE)) + 3) / 4) <= 32) \
- || (TARGET_FPU && ((MODE) == SFmode || (MODE) == DFmode \
- || (MODE) == SCmode || (MODE) == DCmode)))
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (((MODE1) == SFmode || (MODE1) == DFmode \
- || (MODE1) == SCmode || (MODE1) == DCmode) \
- == ((MODE2) == SFmode || (MODE2) == DFmode \
- || (MODE2) == SCmode || (MODE2) == DCmode))
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* SPUR pc isn't overloaded on a register that the compiler knows about. */
-/* #define PC_REGNUM */
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 4
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 25
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 1
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 25
-
-/* Register in which static-chain is passed to a function. */
-/* ??? */
-#define STATIC_CHAIN_REGNUM 8
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 27
-#define STRUCT_VALUE_INCOMING_REGNUM 11
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The 68000 has two kinds of registers, hence four classes. */
-
-enum reg_class { NO_REGS, GENERAL_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "GENERAL_REGS", "FP_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS {{0, 0}, {-1, 0}, {0, 0x7fff}, {-1, 0x7fff}}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- ((REGNO) >= 32 ? FP_REGS : GENERAL_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-#define INDEX_REG_CLASS GENERAL_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'f' ? FP_REGS : NO_REGS)
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- For SPUR, `I' is used for the range of constants an insn
- can actually contain.
- `J' is used for the range which is just zero (since that is R0).
- `K' is used for the 5-bit operand of a compare insns. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (unsigned) ((VALUE) + 0x2000) < 0x4000 \
- : (C) == 'J' ? (VALUE) == 0 \
- : (C) == 'K' ? (unsigned) (VALUE) < 0x20 \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' && CONST_DOUBLE_HIGH (VALUE) == 0 \
- && CONST_DOUBLE_LOW (VALUE) == 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On SPUR, this is the size of MODE in words,
- except in the FP regs, where a single reg is always enough. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((CLASS) == FP_REGS ? 1 \
- : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On SPUR, don't define this because there are no push insns. */
-/* #define PUSH_ROUNDING(BYTES) */
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On SPUR the value is found in the second "output" register. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), 27)
-
-/* But the called function leaves it in the second "input" register. */
-
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), 11)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 27)
-
-/* 1 if N is a possible register number for a function value
- as seen by the caller.
- On SPUR, the first "output" reg is the only register thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 27)
-
-/* 1 if N is a possible register number for function argument passing.
- On SPUR, these are the "output" registers. */
-
-#define FUNCTION_ARG_REGNO_P(N) ((N) < 32 && (N) > 26)
-
-/* Define this macro if the target machine has "register windows". This
- C expression returns the register number as seen by the called function
- corresponding to register number OUT as seen by the calling function.
- Return OUT if register number OUT is not an outbound register. */
-
-#define INCOMING_REGNO(OUT) \
- (((OUT) < 27 || (OUT) > 31) ? (OUT) : (OUT) - 16)
-
-/* Define this macro if the target machine has "register windows". This
- C expression returns the register number as seen by the calling function
- corresponding to register number IN as seen by the called function.
- Return IN if register number IN is not an inbound register. */
-
-#define OUTGOING_REGNO(IN) \
- (((IN) < 11 || (IN) > 15) ? (IN) : (IN) + 16)
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On SPUR, this is a single integer, which is a number of words
- of arguments scanned so far (including the invisible argument,
- if any, which holds the structure-value-address).
- Thus 5 or more means all following args should go on the stack. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On SPUR, the offset normally starts at 0, but starts at 4 bytes
- when the function gets a structure-value-address as an
- invisible first argument. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = ((FNTYPE) != 0 && aggregate_value_p (TREE_TYPE ((FNTYPE)))))
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) / 4 \
- : (int_size_in_bytes (TYPE) + 3) / 4))
-
-/* Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On SPUR the first five words of args are normally in registers
- and the rest are pushed. But any arg that won't entirely fit in regs
- is pushed. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-(5 >= ((CUM) \
- + ((MODE) == BLKmode \
- ? (int_size_in_bytes (TYPE) + 3) / 4 \
- : (GET_MODE_SIZE (MODE) + 3) / 4)) \
- ? gen_rtx (REG, (MODE), 27 + (CUM)) \
- : 0)
-
-/* Define where a function finds its arguments.
- This is different from FUNCTION_ARG because of register windows. */
-
-#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
-(5 >= ((CUM) \
- + ((MODE) == BLKmode \
- ? (int_size_in_bytes (TYPE) + 3) / 4 \
- : (GET_MODE_SIZE (MODE) + 3) / 4)) \
- ? gen_rtx (REG, (MODE), 11 + (CUM)) \
- : 0)
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-/* On spur, move-double insns between fpu and cpu need an 8-byte block
- of memory. If any fpu reg is used in the function, we allocate
- such a block here, at the bottom of the frame, just in case it's needed. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ \
- extern char call_used_regs[]; \
- extern int current_function_pretend_args_size; \
- int fsize = ((SIZE) + 7) & ~7; \
- int nregs, i, fp_used = 0; \
- for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
- { \
- if (regs_ever_live[i] && ! call_used_regs[i]) \
- nregs++; \
- if (regs_ever_live[i]) fp_used = 1; \
- } \
- if (fp_used) fsize += 8; \
- fprintf (FILE, "0:\trd_special r24,pc\n"); \
- fprintf (FILE, "\tand r24,r24,$~0x3\n"); \
- fprintf (FILE, "\tadd_nt r25,r4,$%d\n", \
- - current_function_pretend_args_size); \
- if (fsize + nregs != 0 || current_function_pretend_args_size > 0)\
- { \
- int n = - fsize - nregs * 16; \
- if (n >= -8192) \
- fprintf (FILE, "\tadd_nt r4,r25,$%d\n", n); \
- else \
- { \
- fprintf (FILE, "\tadd_nt r4,r25,$-8192\n"); \
- n += 8192; \
- while (n < -8192) \
- fprintf (FILE, "\tadd_nt r4,r4,$-8192\n"), n += 8192; \
- if (n != 0) \
- fprintf (FILE, "\tadd_nt r4,r4,$%d\n", n); \
- } \
- } \
- for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
- if (regs_ever_live[i] && ! call_used_regs[i]) \
- { \
- fprintf (FILE, "\tst_ext1 %s,r4,$%d\n", \
- reg_names[i], 8 * nregs++); \
- fprintf (FILE, "\tst_ext2 %s,r4,$%d\n", \
- reg_names[i], 8 * nregs++); \
- } \
-}
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- abort ();
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-extern int current_function_calls_alloca;
-extern int current_function_pretend_args_size;
-
-#define EXIT_IGNORE_STACK \
- (get_frame_size () != 0 \
- || current_function_calls_alloca || current_function_pretend_args_size)
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ \
- extern char call_used_regs[]; \
- extern int current_function_calls_alloca; \
- extern int current_function_pretend_args_size; \
- int fsize = ((SIZE) + 7) & ~7; \
- int nregs, i, fp_used = 0; \
- for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
- { \
- if (regs_ever_live[i] && ! call_used_regs[i]) \
- nregs++; \
- if (regs_ever_live[i]) fp_used = 1; \
- } \
- if (fp_used) fsize += 8; \
- if (nregs != 0) \
- { \
- fprintf (FILE, "\tadd_nt r4,r25,$%d\n", - fsize - nregs * 16); \
- for (i = 32, nregs = 0; i < FIRST_PSEUDO_REGISTER; i++) \
- if (regs_ever_live[i] && ! call_used_regs[i]) \
- { \
- fprintf (FILE, "\tld_ext1 %s,r4,$%d\n\tnop\n", \
- reg_names[i], 8 * nregs++); \
- fprintf (FILE, "\tld_ext2 %s,r4,$%d\n\tnop\n", \
- reg_names[i], 8 * nregs++); \
- } \
- } \
- if (fsize != 0 || nregs != 0 || current_function_calls_alloca \
- || current_function_pretend_args_size > 0) \
- fprintf (FILE, "\tadd_nt r4,r25,$%d\n", \
- current_function_pretend_args_size); \
- fprintf (FILE, "\treturn r10,$8\n\tnop\n"); \
-}
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) \
-((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
-#define REGNO_OK_FOR_BASE_P(REGNO) \
-((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
-#define REGNO_OK_FOR_FP_P(REGNO) \
-(((REGNO) ^ 0x20) < 14 || (unsigned) (reg_renumber[REGNO] ^ 0x20) < 14)
-
-/* Now macros that check whether X is a register and also,
- strictly, whether it is in a specified class.
-
- These macros are specific to the SPUR, and may be used only
- in code for printing assembler insns and in conditions for
- define_optimization. */
-
-/* 1 if X is an fp register. */
-
-#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- ((GET_CODE (X) == CONST_INT \
- && (unsigned) (INTVAL (X) + 0x2000) < 0x4000)\
- || (GET_CODE (X) == SYMBOL_REF && (X)->unchanging))
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) (((unsigned) REGNO (X)) - 32 >= 14)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- On SPUR, the actual legitimate addresses must be REG+SMALLINT or REG+REG.
- Actually, REG+REG is not legitimate for stores, so
- it is obtained only by combination on loads.
- We can treat a SYMBOL_REF as legitimate if it is part of this
- function's constant-pool, because such addresses can actually
- be output as REG+SMALLINT. */
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ if (GET_CODE (X) == REG \
- && REG_OK_FOR_BASE_P (X)) \
- goto ADDR; \
- if (GET_CODE (X) == SYMBOL_REF && (X)->unchanging) \
- goto ADDR; \
- if (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
- { \
- if (GET_CODE (XEXP (X, 1)) == CONST_INT \
- && INTVAL (XEXP (X, 1)) >= -0x2000 \
- && INTVAL (XEXP (X, 1)) < 0x2000) \
- goto ADDR; \
- } \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-/* On SPUR, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
- copy_to_mode_reg (SImode, XEXP (X, 1))); \
- if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
- copy_to_mode_reg (SImode, XEXP (X, 0))); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 1), \
- force_operand (XEXP (X, 0), 0)); \
- if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \
- (X) = gen_rtx (PLUS, SImode, XEXP (X, 0), \
- force_operand (XEXP (X, 1), 0)); \
- if (memory_address_p (MODE, X)) \
- goto WIN; }
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the SPUR this is never true. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 0
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 1
-
-/* This is BSD, so it wants DBX format. */
-#define DBX_DEBUGGING_INFO
-
-/* Do not break .stabs pseudos into continuations. */
-#define DBX_CONTIN_LENGTH 0
-
-/* Don't try to use the `x' type-cross-reference character in DBX data.
- Also has the consequence of putting each struct, union or enum
- into a separate .stabs, containing only cross-refs to the others. */
-#define DBX_NO_XREFS
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE SImode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- Desirable on machines where ordinary constants are expensive
- but a CALL with constant address is cheap. */
-#define NO_FUNCTION_CSE
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) < 0x2000 && INTVAL (RTX) >= -0x2000) return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 2; \
- case CONST_DOUBLE: \
- return 4;
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-/* (None are needed on SPUR.) */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-/* The SPUR does not really have a condition code. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ CC_STATUS_INIT; }
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON ""
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF ""
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", \
- "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", \
- "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \
- "r30", "r31", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", \
- "f10", "f11", "f12", "f13", "f14" }
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.double %.20e\n", (VALUE))
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- fprintf (FILE, "\t.single %.12e\n", (VALUE))
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output code to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tadd_nt r4,r4,$-4\n\tst_32 %s,r4,$0\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tld_32 %s,r4,$0\n\tadd_nt r4,r4,$4\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.long L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative.
- (SPUR does not use such vectors,
- but we must define this macro anyway.) */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", (LOG))
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null.
-
- On SPUR, the CODE can be `r', meaning this is a register-only operand
- and an immediate zero should be represented as `r0'. */
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else if (GET_CODE (X) == CONST_DOUBLE) \
- abort (); \
- else if ((CODE) == 'r' && (X) == const0_rtx) \
- fprintf (FILE, "r0"); \
- else { putc ('$', FILE); output_addr_const (FILE, X); }}
-
-/* Print a memory address as an operand to reference that memory location. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx base, index = 0; \
- int offset = 0; \
- register rtx addr = ADDR; \
- if (GET_CODE (addr) == REG) \
- { \
- fprintf (FILE, "%s,$0", reg_names[REGNO (addr)]); \
- } \
- else if (GET_CODE (addr) == PLUS) \
- { \
- if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \
- offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);\
- else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \
- offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);\
- else \
- base = XEXP (addr, 0), index = XEXP (addr, 1); \
- fprintf (FILE, "%s,", reg_names[REGNO (base)]); \
- if (index == 0) \
- fprintf (FILE, "$%d", offset); \
- else \
- fprintf (FILE, "%s,", reg_names[REGNO (index)]); \
- } \
- else \
- { \
- fprintf (FILE, "r24,$("); \
- output_addr_const (FILE, addr); \
- fprintf (FILE, "-0b)"); \
- } \
-}
diff --git a/gcc/config/spur/spur.md b/gcc/config/spur/spur.md
deleted file mode 100644
index f95e8e04695..00000000000
--- a/gcc/config/spur/spur.md
+++ /dev/null
@@ -1,1093 +0,0 @@
-;;- Machine description for SPUR chip for GNU C compiler
-;; Copyright (C) 1988 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.
-
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-;;- Operand classes for the register allocator:
-
-;; Compare instructions.
-;; This pattern is used for generating an "insn"
-;; which does just a compare and sets a (fictitious) condition code.
-
-;; The actual SPUR insns are compare-and-conditional-jump.
-;; The define_peephole's below recognize the combinations of
-;; compares and jumps, and output each pair as a single assembler insn.
-
-;; This controls RTL generation and register allocation.
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "register_operand" "rK")
- (match_operand:SI 1 "nonmemory_operand" "rK")))]
- ""
- "*
-{
- cc_status.value1 = operands[0], cc_status.value2 = operands[1];
- return \"\";
-}")
-
-;; We have to have this because cse can optimize the previous pattern
-;; into this one.
-
-(define_insn "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "register_operand" "r"))]
- ""
- "*
-{
- cc_status.value1 = operands[0], cc_status.value2 = const0_rtx;
- return \"\";
-}")
-
-
-;; These control RTL generation for conditional jump insns
-;; and match them for register allocation.
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"eq\", \"eq\", \"ne\", \"ne\"); ")
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"ne\", \"ne\", \"eq\", \"eq\"); ")
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"gt\", \"lt\", \"le\", \"ge\"); ")
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"ugt\", \"ult\", \"ule\", \"uge\"); ")
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"lt\", \"gt\", \"ge\", \"le\"); ")
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"ult\", \"ugt\", \"uge\", \"ule\"); ")
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"ge\", \"le\", \"lt\", \"gt\"); ")
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"uge\", \"ule\", \"ult\", \"ugt\"); ")
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"le\", \"ge\", \"gt\", \"lt\"); ")
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "* return output_compare (operands, \"ule\", \"uge\", \"ugt\", \"ult\"); ")
-
-;; These match inverted jump insns for register allocation.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"ne\", \"ne\", \"eq\", \"eq\"); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"eq\", \"eq\", \"ne\", \"ne\"); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"le\", \"ge\", \"gt\", \"lt\"); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"ule\", \"uge\", \"ugt\", \"ult\"); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"ge\", \"le\", \"lt\", \"gt\"); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"uge\", \"ule\", \"ult\", \"ugt\"); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"lt\", \"gt\", \"ge\", \"le\"); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"ult\", \"ugt\", \"uge\", \"ule\"); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"gt\", \"lt\", \"le\", \"ge\"); ")
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "* return output_compare (operands, \"ugt\", \"ult\", \"ule\", \"uge\"); ")
-
-;; Move instructions
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=r,m")
- (match_operand:SI 1 "general_operand" "rmi,rJ"))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- return \"st_32 %r1,%0\";
- if (GET_CODE (operands[1]) == MEM)
- return \"ld_32 %0,%1\;nop\";
- if (GET_CODE (operands[1]) == REG)
- return \"add_nt %0,%1,$0\";
- if (GET_CODE (operands[1]) == SYMBOL_REF && operands[1]->unchanging)
- return \"add_nt %0,r24,$(%1-0b)\";
- return \"add_nt %0,r0,%1\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "register_operand" "r"))))]
- ""
- "ld_32 %0,%1,%2\;nop")
-
-;; Generate insns for moving single bytes.
-
-(define_expand "movqi"
- [(set (match_operand:QI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- operands[1] = copy_to_reg (operands[1]);
-
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx tem = gen_reg_rtx (SImode);
- rtx addr = force_reg (SImode, XEXP (operands[1], 0));
- rtx subreg;
-
- emit_move_insn (tem, gen_rtx (MEM, SImode, addr));
- if (GET_CODE (operands[0]) == SUBREG)
- subreg = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[0]),
- SUBREG_WORD (operands[0]));
- else
- subreg = gen_rtx (SUBREG, SImode, operands[0], 0);
-
- emit_insn (gen_rtx (SET, VOIDmode, subreg,
- gen_rtx (ZERO_EXTRACT, SImode, tem,
- gen_rtx (CONST_INT, VOIDmode, 8),
- addr)));
- }
- else if (GET_CODE (operands[0]) == MEM)
- {
- rtx tem = gen_reg_rtx (SImode);
- rtx addr = force_reg (SImode, XEXP (operands[0], 0));
- rtx subreg;
-
- emit_move_insn (tem, gen_rtx (MEM, SImode, addr));
- if (! CONSTANT_ADDRESS_P (operands[1]))
- {
- if (GET_CODE (operands[1]) == SUBREG)
- subreg = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
- SUBREG_WORD (operands[1]));
- else
- subreg = gen_rtx (SUBREG, SImode, operands[1], 0);
- }
-
- emit_insn (gen_rtx (SET, VOIDmode,
- gen_rtx (ZERO_EXTRACT, SImode, tem,
- gen_rtx (CONST_INT, VOIDmode, 8),
- addr),
- subreg));
- emit_move_insn (gen_rtx (MEM, SImode, addr), tem);
- }
- else
- {
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- }
- DONE;
-}")
-
-;; Recognize insns generated for moving single bytes.
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=r,m")
- (match_operand:QI 1 "general_operand" "rmi,r"))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- return \"st_32 %1,%0\";
- if (GET_CODE (operands[1]) == MEM)
- return \"ld_32 %0,%1\;nop\";
- if (GET_CODE (operands[1]) == REG)
- return \"add_nt %0,%1,$0\";
- return \"add_nt %0,r0,%1\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (const_int 8)
- (match_operand:SI 2 "nonmemory_operand" "rI")))]
- ""
- "extract %0,%1,%2")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
- (const_int 8)
- (match_operand:SI 1 "nonmemory_operand" "rI"))
- (match_operand:SI 2 "nonmemory_operand" "ri"))]
- ""
- "wr_insert %1\;insert %0,%0,%2")
-
-;; Constant propagation can optimize the previous pattern into this pattern.
-;[Not any more. It could when the position-operand contains a MULT.]
-
-;(define_insn ""
-; [(set (zero_extract:QI (match_operand:SI 0 "register_operand" "+r")
-; (const_int 8)
-; (match_operand:SI 1 "immediate_operand" "I"))
-; (match_operand:QI 2 "register_operand" "r"))]
-; "GET_CODE (operands[1]) == CONST_INT
-; && INTVAL (operands[1]) % 8 == 0
-; && (unsigned) INTVAL (operands[1]) < 32"
-; "*
-;{
-; operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) / 8);
-; return \"wr_insert 0,0,%1\;insert %0,%0,%2\";
-;}")
-
-;; The three define_expand patterns on this page
-;; serve as subroutines of "movhi".
-
-;; Generate code to fetch an aligned halfword from memory.
-;; Operand 0 is the destination register (HImode).
-;; Operand 1 is the memory address (SImode).
-;; Operand 2 is a temporary (SImode).
-;; Operand 3 is a temporary (SImode).
-;; Operand 4 is a temporary (QImode).
-
-;; Operand 5 is an internal temporary (HImode).
-
-(define_expand "loadhi"
- [(set (match_operand:SI 2 "register_operand" "")
- (mem:SI (match_operand:SI 1 "register_operand" "")))
- ;; Extract the low byte.
- (set (subreg:SI (match_dup 5) 0)
- (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 1)))
- ;; Form address of high byte.
- (set (match_operand:SI 3 "register_operand" "")
- (plus:SI (match_dup 1) (const_int 1)))
- ;; Extract the high byte.
- (set (subreg:SI (match_operand:QI 4 "register_operand" "") 0)
- (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 3)))
- ;; Put the high byte in with the low one.
- (set (zero_extract:SI (match_dup 5) (const_int 8) (const_int 1))
- (subreg:SI (match_dup 4) 0))
- (set (match_operand:HI 0 "register_operand" "") (match_dup 5))]
- ""
- "operands[5] = gen_reg_rtx (HImode);")
-
-;; Generate code to store an aligned halfword into memory.
-;; Operand 0 is the destination address (SImode).
-;; Operand 1 is the source register (HImode, not constant).
-;; Operand 2 is a temporary (SImode).
-;; Operand 3 is a temporary (SImode).
-;; Operand 4 is a temporary (QImode).
-
-;; Operand 5 is an internal variable made from operand 1.
-
-(define_expand "storehi"
- [(set (match_operand:SI 2 "register_operand" "")
- (mem:SI (match_operand:SI 0 "register_operand" "")))
- ;; Insert the low byte.
- (set (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 0))
- (match_dup 5))
- ;; Form address of high byte.
- (set (match_operand:SI 3 "register_operand" "")
- (plus:SI (match_dup 0) (const_int 1)))
- ;; Extract the high byte from the source.
- (set (subreg:SI (match_operand:QI 4 "register_operand" "") 0)
- (zero_extract:SI (match_operand:HI 1 "register_operand" "")
- (const_int 8) (const_int 1)))
- ;; Store high byte into the memory word
- (set (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 3))
- (subreg:SI (match_dup 4) 0))
- ;; Put memory word back into memory.
- (set (mem:SI (match_dup 0))
- (match_dup 2))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == SUBREG)
- operands[5] = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
- SUBREG_WORD (operands[1]));
- else
- operands[5] = gen_rtx (SUBREG, SImode, operands[1], 0);
-}")
-
-;; Like storehi but operands[1] is a CONST_INT.
-
-(define_expand "storeinthi"
- [(set (match_operand:SI 2 "register_operand" "")
- (mem:SI (match_operand:SI 0 "register_operand" "")))
- ;; Insert the low byte.
- (set (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 0))
- (match_dup 5))
- ;; Form address of high byte.
- (set (match_operand:SI 3 "register_operand" "")
- (plus:SI (match_dup 0) (const_int 1)))
- ;; Store high byte into the memory word
- (set (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 3))
- (match_dup 6))
- ;; Put memory word back into memory.
- (set (mem:SI (match_dup 0))
- (match_dup 2))]
- ""
- " operands[5] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 255);
- operands[6] = gen_rtx (CONST_INT, VOIDmode,
- (INTVAL (operands[1]) >> 8) & 255);
-")
-
-;; Main entry for generating insns to move halfwords.
-
-(define_expand "movhi"
- [(set (match_operand:HI 0 "general_operand" "")
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "
-{
- if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
- operands[1] = copy_to_reg (operands[1]);
-
- if (GET_CODE (operands[1]) == MEM)
- {
- rtx insn =
- emit_insn (gen_loadhi (operands[0],
- force_reg (SImode, XEXP (operands[1], 0)),
- gen_reg_rtx (SImode), gen_reg_rtx (SImode),
- gen_reg_rtx (QImode)));
- /* Tell cse what value the loadhi produces, so it detect duplicates. */
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL, operands[1],
- REG_NOTES (insn));
- }
- else if (GET_CODE (operands[0]) == MEM)
- {
- if (GET_CODE (operands[1]) == CONST_INT)
- emit_insn (gen_storeinthi (force_reg (SImode, XEXP (operands[0], 0)),
- operands[1],
- gen_reg_rtx (SImode), gen_reg_rtx (SImode),
- gen_reg_rtx (QImode)));
- else
- {
- if (CONSTANT_P (operands[1]))
- operands[1] = force_reg (HImode, operands[1]);
- emit_insn (gen_storehi (force_reg (SImode, XEXP (operands[0], 0)),
- operands[1],
- gen_reg_rtx (SImode), gen_reg_rtx (SImode),
- gen_reg_rtx (QImode)));
- }
- }
- else
- emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
- DONE;
-}")
-
-;; Recognize insns generated for moving halfwords.
-;; (Note that the extract and insert patterns for single-byte moves
-;; are also involved in recognizing some of the insns used for this purpose.)
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=r,m")
- (match_operand:HI 1 "general_operand" "rmi,r"))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) == MEM)
- return \"st_32 %1,%0\";
- if (GET_CODE (operands[1]) == MEM)
- return \"ld_32 %0,%1\;nop\";
- if (GET_CODE (operands[1]) == REG)
- return \"add_nt %0,%1,$0\";
- return \"add_nt %0,r0,%1\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extract:SI (match_operand:HI 1 "register_operand" "r")
- (const_int 8)
- (match_operand:SI 2 "nonmemory_operand" "rI")))]
- ""
- "extract %0,%1,%2")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:HI 0 "register_operand" "+r")
- (const_int 8)
- (match_operand:SI 1 "nonmemory_operand" "rI"))
- (match_operand:SI 2 "nonmemory_operand" "ri"))]
- ""
- "wr_insert %1\;insert %0,%0,%2")
-
-;; Constant propagation can optimize the previous pattern into this pattern.
-
-;(define_insn ""
-; [(set (zero_extract:QI (match_operand:HI 0 "register_operand" "+r")
-; (const_int 8)
-; (match_operand:SI 1 "immediate_operand" "I"))
-; (match_operand:QI 2 "register_operand" "r"))]
-; "GET_CODE (operands[1]) == CONST_INT
-; && INTVAL (operands[1]) % 8 == 0
-; && (unsigned) INTVAL (operands[1]) < 32"
-; "*
-;{
-; operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) / 8);
-; return \"wr_insert 0,0,%1\;insert %0,%0,%2\";
-;}")
-
-;; This pattern forces (set (reg:DF ...) (const_double ...))
-;; to be reloaded by putting the constant into memory.
-;; It must come before the more general movdf pattern.
-(define_insn ""
- [(set (match_operand:DF 0 "general_operand" "=&r,f,&o")
- (match_operand:DF 1 "" "mG,m,G"))]
- "GET_CODE (operands[1]) == CONST_DOUBLE"
- "*
-{
- if (FP_REG_P (operands[0]))
- return output_fp_move_double (operands);
- if (operands[1] == CONST0_RTX (DFmode) && GET_CODE (operands[0]) == REG)
- {
- operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- return \"add_nt %0,r0,$0\;add_nt %1,r0,$0\";
- }
- if (operands[1] == CONST0_RTX (DFmode) && GET_CODE (operands[0]) == MEM)
- {
- operands[1] = adj_offsettable_operand (operands[0], 4);
- return \"st_32 r0,%0\;st_32 r0,%1\";
- }
- return output_move_double (operands);
-}
-")
-
-(define_insn "movdf"
- [(set (match_operand:DF 0 "general_operand" "=r,&r,m,?f,?rm")
- (match_operand:DF 1 "general_operand" "r,m,r,rfm,f"))]
- ""
- "*
-{
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}
-")
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=r,&r,m,?f,?rm")
- (match_operand:DI 1 "general_operand" "r,m,r,rfm,f"))]
- ""
- "*
-{
- if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
- return output_fp_move_double (operands);
- return output_move_double (operands);
-}
-")
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=rf,m")
- (match_operand:SF 1 "general_operand" "rfm,rf"))]
- ""
- "*
-{
- if (FP_REG_P (operands[0]))
- {
- if (FP_REG_P (operands[1]))
- return \"fmov %0,%1\";
- if (GET_CODE (operands[1]) == REG)
- {
- rtx xoperands[2];
- int offset = - get_frame_size () - 8;
- xoperands[1] = operands[1];
- xoperands[0] = gen_rtx (CONST_INT, VOIDmode, offset);
- output_asm_insn (\"st_32 %1,r25,%0\", xoperands);
- xoperands[1] = operands[0];
- output_asm_insn (\"ld_sgl %1,r25,%0\;nop\", xoperands);
- return \"\";
- }
- return \"ld_sgl %0,%1\;nop\";
- }
- if (FP_REG_P (operands[1]))
- {
- if (GET_CODE (operands[0]) == REG)
- {
- rtx xoperands[2];
- int offset = - get_frame_size () - 8;
- xoperands[0] = gen_rtx (CONST_INT, VOIDmode, offset);
- xoperands[1] = operands[1];
- output_asm_insn (\"st_sgl %1,r25,%0\", xoperands);
- xoperands[1] = operands[0];
- output_asm_insn (\"ld_32 %1,r25,%0\;nop\", xoperands);
- return \"\";
- }
- return \"st_sgl %1,%0\";
- }
- if (GET_CODE (operands[0]) == MEM)
- return \"st_32 %r1,%0\";
- if (GET_CODE (operands[1]) == MEM)
- return \"ld_32 %0,%1\;nop\";
- if (GET_CODE (operands[1]) == REG)
- return \"add_nt %0,%1,$0\";
- return \"add_nt %0,r0,%1\";
-}")
-
-;;- truncation instructions
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (truncate:QI
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "add_nt %0,%1,$0")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "register_operand" "=r")
- (truncate:QI
- (match_operand:HI 1 "register_operand" "r")))]
- ""
- "add_nt %0,%1,$0")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (truncate:HI
- (match_operand:SI 1 "register_operand" "r")))]
- ""
- "add_nt %0,%1,$0")
-
-;;- zero extension instructions
-
-;; Note that the one starting from HImode comes before those for QImode
-;; so that a constant operand will match HImode, not QImode.
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (and:SI (match_operand:HI 1 "register_operand" "") ;Changed to SI below
- ;; This constant is invalid, but reloading will handle it.
- ;; It's useless to generate here the insns to construct it
- ;; because constant propagation would simplify them anyway.
- (match_dup 2)))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == SUBREG)
- operands[1] = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
- SUBREG_WORD (operands[1]));
- else
- operands[1] = gen_rtx (SUBREG, SImode, operands[1], 0);
-
- operands[2] = force_reg (SImode, gen_rtx (CONST_INT, VOIDmode, 65535));
-}")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "register_operand" "=r")
- (zero_extend:HI
- (match_operand:QI 1 "register_operand" "r")))]
- ""
- "extract %0,%1,$0")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (zero_extend:SI
- (match_operand:QI 1 "register_operand" "r")))]
- ""
- "extract %0,%1,$0")
-
-;;- sign extension instructions
-;; Note that the one starting from HImode comes before those for QImode
-;; so that a constant operand will match HImode, not QImode.
-
-(define_expand "extendhisi2"
- [(set (match_dup 2)
- (and:SI (match_operand:HI 1 "register_operand" "") ;Changed to SI below
- (match_dup 4)))
- (set (match_dup 3) (plus:SI (match_dup 2) (match_dup 5)))
- (set (match_operand:SI 0 "register_operand" "")
- (xor:SI (match_dup 3) (match_dup 5)))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == SUBREG)
- operands[1] = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
- SUBREG_WORD (operands[1]));
- else
- operands[1] = gen_rtx (SUBREG, SImode, operands[1], 0);
-
- operands[2] = gen_reg_rtx (SImode);
- operands[3] = gen_reg_rtx (SImode);
- operands[4] = force_reg (SImode, gen_rtx (CONST_INT, VOIDmode, 65535));
- operands[5] = force_reg (SImode, gen_rtx (CONST_INT, VOIDmode, -32768));
-}")
-
-(define_expand "extendqihi2"
- [(set (match_dup 2)
- (and:HI (match_operand:QI 1 "register_operand" "") ;Changed to SI below
- (const_int 255)))
- (set (match_dup 3)
- (plus:SI (match_dup 2) (const_int -128)))
- (set (match_operand:HI 0 "register_operand" "")
- (xor:SI (match_dup 3) (const_int -128)))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == SUBREG)
- operands[1] = gen_rtx (SUBREG, HImode, SUBREG_REG (operands[1]),
- SUBREG_WORD (operands[1]));
- else
- operands[1] = gen_rtx (SUBREG, HImode, operands[1], 0);
-
- operands[2] = gen_reg_rtx (HImode);
- operands[3] = gen_reg_rtx (HImode);
-}")
-
-(define_expand "extendqisi2"
- [(set (match_dup 2)
- (and:SI (match_operand:QI 1 "register_operand" "") ;Changed to SI below
- (const_int 255)))
- (set (match_dup 3) (plus:SI (match_dup 2) (const_int -128)))
- (set (match_operand:SI 0 "register_operand" "")
- (xor:SI (match_dup 3) (const_int -128)))]
- ""
- "
-{
- if (GET_CODE (operands[1]) == SUBREG)
- operands[1] = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
- SUBREG_WORD (operands[1]));
- else
- operands[1] = gen_rtx (SUBREG, SImode, operands[1], 0);
-
- operands[2] = gen_reg_rtx (SImode);
- operands[3] = gen_reg_rtx (SImode);
-}")
-
-;;- arithmetic instructions
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_operand:SI 1 "nonmemory_operand" "%r")
- (match_operand:SI 2 "nonmemory_operand" "rI")))]
- ""
- "add %0,%1,%2")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_operand:SI 1 "nonmemory_operand" "%r")
- (match_operand:SI 2 "big_immediate_operand" "g")))]
- "GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (INTVAL (operands[2]) + 0x8000000) < 0x10000000"
- "*
-{
- return
- output_add_large_offset (operands[0], operands[1], INTVAL (operands[2]));
-}")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "nonmemory_operand" "rI")))]
- ""
- "sub %0,%1,%2")
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (and:SI (match_operand:SI 1 "nonmemory_operand" "%r")
- (match_operand:SI 2 "nonmemory_operand" "rI")))]
- ""
- "and %0,%1,%2")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ior:SI (match_operand:SI 1 "nonmemory_operand" "%r")
- (match_operand:SI 2 "nonmemory_operand" "rI")))]
- ""
- "or %0,%1,%2")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (xor:SI (match_operand:SI 1 "nonmemory_operand" "%r")
- (match_operand:SI 2 "nonmemory_operand" "rI")))]
- ""
- "xor %0,%1,%2")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (match_operand:SI 1 "nonmemory_operand" "rI")))]
- ""
- "sub %0,r0,%1")
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "register_operand" "=r")
- (not:SI (match_operand:SI 1 "register_operand" "r")))]
- ""
- "xor %0,%1,$-1")
-
-;; Floating point arithmetic instructions.
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (plus:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fadd %0,%1,%2")
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (plus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fadd %0,%1,%2")
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (minus:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fsub %0,%1,%2")
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (minus:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fsub %0,%1,%2")
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (mult:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fmul %0,%1,%2")
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (mult:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fmul %0,%1,%2")
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (div:DF (match_operand:DF 1 "register_operand" "f")
- (match_operand:DF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fdiv %0,%1,%2")
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (div:SF (match_operand:SF 1 "register_operand" "f")
- (match_operand:SF 2 "register_operand" "f")))]
- "TARGET_FPU"
- "fdiv %0,%1,%2")
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (neg:DF (match_operand:DF 1 "nonmemory_operand" "f")))]
- "TARGET_FPU"
- "fneg %0,%1")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (neg:SF (match_operand:SF 1 "nonmemory_operand" "f")))]
- "TARGET_FPU"
- "fneg %0,%1")
-
-(define_insn "absdf2"
- [(set (match_operand:DF 0 "register_operand" "=f")
- (abs:DF (match_operand:DF 1 "nonmemory_operand" "f")))]
- "TARGET_FPU"
- "fabs %0,%1")
-
-(define_insn "abssf2"
- [(set (match_operand:SF 0 "register_operand" "=f")
- (abs:SF (match_operand:SF 1 "nonmemory_operand" "f")))]
- "TARGET_FPU"
- "fabs %0,%1")
-
-;; Shift instructions
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashift:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "I")))]
- "GET_CODE (operands[2]) == CONST_INT"
- "*
-{
- unsigned int amount = INTVAL (operands[2]);
-
- switch (amount)
- {
- case 0:
- return \"add_nt %0,%1,$0\";
- case 1:
- return \"sll %0,%1,$1\";
- case 2:
- return \"sll %0,%1,$2\";
- default:
- output_asm_insn (\"sll %0,%1,$3\", operands);
-
- for (amount -= 3; amount >= 3; amount -= 3)
- output_asm_insn (\"sll %0,%0,$3\", operands);
-
- if (amount > 0)
- output_asm_insn (amount == 1 ? \"sll %0,%0,$1\" : \"sll %0,%0,$2\",
- operands);
- return \"\";
- }
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "I")))]
- "GET_CODE (operands[2]) == CONST_INT"
- "*
-{
- unsigned int amount = INTVAL (operands[2]);
-
- if (amount == 0)
- return \"add_nt %0,%1,$0\";
- else
- output_asm_insn (\"sra %0,%1,$1\", operands);
-
- for (amount -= 1; amount > 0; amount -= 1)
- output_asm_insn (\"sra %0,%0,$1\", operands);
-
- return \"\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
- (match_operand:SI 2 "immediate_operand" "I")))]
- "GET_CODE (operands[2]) == CONST_INT"
- "*
-{
- unsigned int amount = INTVAL (operands[2]);
-
- if (amount == 0)
- return \"add_nt %0,%1,$0\";
- else
- output_asm_insn (\"srl %0,%1,$1\", operands);
-
- for (amount -= 1; amount > 0; amount -= 1)
- output_asm_insn (\"srl %0,%0,$1\", operands);
-
- return \"\";
-}")
-
-(define_expand "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashift:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT
- || (! TARGET_EXPAND_SHIFTS && (unsigned) INTVAL (operands[2]) > 3))
- FAIL;
-}")
-
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT
- || (! TARGET_EXPAND_SHIFTS && (unsigned) INTVAL (operands[2]) > 1))
- FAIL;
-}")
-
-(define_expand "lshrsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT
- || (! TARGET_EXPAND_SHIFTS && (unsigned) INTVAL (operands[2]) > 1))
- FAIL;
-}")
-
-;; Unconditional and other jump instructions
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jump %l0\;nop")
-
-(define_insn "tablejump"
- [(set (pc) (match_operand:SI 0 "register_operand" "r"))
- (use (label_ref (match_operand 1 "" "")))]
- ""
- "jump_reg r0,%0\;nop")
-
-;;- jump to subroutine
-(define_insn "call"
- [(call (match_operand:SI 0 "memory_operand" "m")
- (match_operand:SI 1 "general_operand" "g"))]
- ;;- Don't use operand 1 for most machines.
- ""
- "add_nt r2,%0\;call .+8\;jump_reg r0,r2\;nop")
-
-(define_insn "call_value"
- [(set (match_operand 0 "" "=g")
- (call (match_operand:SI 1 "memory_operand" "m")
- (match_operand:SI 2 "general_operand" "g")))]
- ;;- Don't use operand 1 for most machines.
- ""
- "add_nt r2,%1\;call .+8\;jump_reg r0,r2\;nop")
-
-;; A memory ref with constant address is not normally valid.
-;; But it is valid in a call insns. This pattern allows the
-;; loading of the address to combine with the call.
-(define_insn ""
- [(call (mem:SI (match_operand:SI 0 "" "i"))
- (match_operand:SI 1 "general_operand" "g"))]
- ;;- Don't use operand 1 for most machines.
- "GET_CODE (operands[0]) == SYMBOL_REF"
- "call %0\;nop")
-
-(define_insn ""
- [(set (match_operand 0 "" "=g")
- (call (mem:SI (match_operand:SI 1 "" "i"))
- (match_operand:SI 2 "general_operand" "g")))]
- ;;- Don't use operand 1 for most machines.
- "GET_CODE (operands[1]) == SYMBOL_REF"
- "call %1\;nop")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
diff --git a/gcc/config/spur/xm-spur.h b/gcc/config/spur/xm-spur.h
deleted file mode 100644
index 1d30053bc53..00000000000
--- a/gcc/config/spur/xm-spur.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Configuration for GNU C-compiler for Berkeley SPUR processor.
- Copyright (C) 1988, 1993 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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
diff --git a/gcc/config/svr3.h b/gcc/config/svr3.h
deleted file mode 100644
index 3475561799b..00000000000
--- a/gcc/config/svr3.h
+++ /dev/null
@@ -1,375 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for
- generic System V Release 3 system.
- Copyright (C) 1991, 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@monkeys.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.
-
- To use this file, make up a file with a name like:
-
- ?????svr3.h
-
- where ????? is replaced by the name of the basic hardware that you
- are targeting for. Then, in the file ?????svr3.h, put something
- like:
-
- #include "?????.h"
- #include "svr3.h"
-
- followed by any really system-specific defines (or overrides of
- defines) which you find that you need. For example, CPP_PREDEFINES
- is defined here with only the defined -Dunix and -DSVR3. You should
- probably override that in your target-specific ?????svr3.h file
- with a set of defines that includes these, but also contains an
- appropriate define for the type of hardware that you are targeting.
-*/
-
-/* Define a symbol indicating that we are using svr3.h. */
-#define USING_SVR3_H
-
-/* Define a symbol so that libgcc* can know what sort of operating
- environment and assembler syntax we are targeting for. */
-#define SVR3_target
-
-/* Cpp, assembler, linker, library, and startfile spec's. */
-
-/* You should redefine CPP_PREDEFINES in any file which includes this one.
- The definition should be appropriate for the type of target system
- involved, and it should include any -A (assertion) options which are
- appropriate for the given target system. */
-
-#undef CPP_PREDEFINES
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- do { output_file_directive ((FILE), main_input_filename); \
- if (optimize) ASM_FILE_START_1 (FILE); \
- } while (0)
-
-/* By default, do nothing: a few machines support .optim, but not most. */
-#undef ASM_FILE_START_1
-#define ASM_FILE_START_1(FILE)
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-/* We don't use ROUNDED because the standard compiler doesn't,
- and the linker gives error messages if a common symbol
- has more than one length value. */
-
-#undef ASM_OUTPUT_COMMON
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-/* Note that using bss_section here caused errors
- in building shared libraries on system V.3. */
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- do { \
- int align = exact_log2 (ROUNDED); \
- if (align > 2) align = 2; \
- data_section (); \
- ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \
- ASM_OUTPUT_LABEL ((FILE), (NAME)); \
- fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)); \
- } while (0)
-
-#if 0 /* For now, let's leave these machine-specific. */
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#define STARTFILE_SPEC \
- "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
-
-#ifdef CROSS_COMPILE
-#define LIB_SPEC "-lc crtn.o%s"
-#else
-#define LIB_SPEC "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} -lc crtn.o%s"
-#endif
-
-/* Special flags for the linker. I don't know what they do. */
-
-#define LINK_SPEC "%{T*} %{z:-lm}"
-#endif
-
-/* Allow #sccs in preprocessor. */
-
-#define SCCS_DIRECTIVE
-
-/* Output #ident as a .ident. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf (FILE, "\t.ident \"%s\"\n", NAME);
-
-/* Use periods rather than dollar signs in special g++ assembler names. */
-
-#define NO_DOLLAR_IN_LABEL
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* System V Release 3 uses COFF debugging info. */
-
-#define SDB_DEBUGGING_INFO
-
-/* We don't want to output DBX debugging information. */
-
-#undef DBX_DEBUGGING_INFO
-
-/* Define the actual types of some ANSI-mandated types. These
- definitions should work for most SVR3 systems. */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-/* Assembler pseudos to introduce constants of various size. These
- definitions should work for most svr3 systems. */
-
-#undef ASM_BYTE_OP
-#define ASM_BYTE_OP "\t.byte"
-
-/* The prefix to add to user-visible assembler symbols.
-
- For System V Release 3 the convention is to prepend a leading
- underscore onto user-level symbol names. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
-
- For most svr3 systems, the convention is that any symbol which begins
- with a period is not put into the linker symbol table by the assembler. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'.
-
- For most svr3 systems, the convention is that any symbol which begins
- with a period is not put into the linker symbol table by the assembler. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
-
-/* We want local labels to start with period if made with asm_fprintf. */
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
-/* Support const sections and the ctors and dtors sections for g++.
- Note that there appears to be two different ways to support const
- sections at the moment. You can either #define the symbol
- READONLY_DATA_SECTION (giving it some code which switches to the
- readonly data section) or else you can #define the symbols
- EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
- SELECT_RTX_SECTION. We do both here just to be on the safe side.
- However, use of the const section is turned off by default
- unless the specific tm.h file turns it on by defining
- USE_CONST_SECTION as 1. */
-
-/* Define a few machine-specific details of the implementation of
- constructors.
-
- The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
- and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- Define ASM_OUTPUT_CONSTRUCTOR to push the address of the constructor. */
-
-#define USE_CONST_SECTION 0
-
-#define INIT_SECTION_ASM_OP ".section\t.init"
-#define FINI_SECTION_ASM_OP ".section .fini,\"x\""
-#define CONST_SECTION_ASM_OP ".section\t.rodata, \"x\""
-#define CTORS_SECTION_ASM_OP INIT_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP
-
-/* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
- because they push on the stack. */
-
-#ifndef STACK_GROWS_DOWNWARD
-
-/* Constructor list on stack is in reverse order. Go to the end of the
- list and go backwards to call constructors in the right order. */
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *p, *beg = alloca (0); \
- for (p = beg; *p; p++) \
- ; \
- while (p != beg) \
- (*--p) (); \
-} while (0)
-
-#else
-
-/* Constructor list on stack is in correct order. Just call them. */
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *p, *beg = alloca (0); \
- for (p = beg; *p; ) \
- (*p++) (); \
-} while (0)
-
-#endif /* STACK_GROWS_DOWNWARD */
-
-/* Add extra sections .rodata, .init and .fini. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_init, in_fini
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- INIT_SECTION_FUNCTION \
- FINI_SECTION_FUNCTION
-
-#define INIT_SECTION_FUNCTION \
-void \
-init_section () \
-{ \
- if (in_section != in_init) \
- { \
- fprintf (asm_out_file, "\t%s\n", INIT_SECTION_ASM_OP); \
- in_section = in_init; \
- } \
-}
-
-#define FINI_SECTION_FUNCTION \
-void \
-fini_section () \
-{ \
- if (in_section != in_fini) \
- { \
- fprintf (asm_out_file, "\t%s\n", FINI_SECTION_ASM_OP); \
- in_section = in_fini; \
- } \
-}
-
-#define READONLY_DATA_SECTION() const_section ()
-
-#define CONST_SECTION_FUNCTION \
-void \
-const_section () \
-{ \
- extern void text_section(); \
- if (!USE_CONST_SECTION) \
- text_section(); \
- else if (in_section != in_const) \
- { \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
- in_section = in_const; \
- } \
-}
-
-/* The ctors and dtors sections are not normally put into use
- by EXTRA_SECTIONS and EXTRA_SECTION_FUNCTIONS as defined in svr3.h,
- but it can't hurt to define these macros for whatever systems use them. */
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-/* This is machine-dependent
- because it needs to push something on the stack. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- fini_section (); \
- fprintf (FILE, "%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement or statements to switch to the appropriate
- section for output of DECL. DECL is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether forming
- the initial value of DECL requires link-time relocations. */
-
-#define SELECT_SECTION(DECL,RELOC) \
-{ \
- if (TREE_CODE (DECL) == STRING_CST) \
- { \
- if (! flag_writable_strings) \
- const_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
- if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \
- || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
- || !DECL_INITIAL (DECL) \
- || (DECL_INITIAL (DECL) != error_mark_node \
- && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
- data_section (); \
- else \
- const_section (); \
- } \
- else \
- const_section (); \
-}
-
-/* A C statement or statements to switch to the appropriate
- section for output of RTX in mode MODE. RTX is some kind
- of constant in RTL. The argument MODE is redundant except
- in the case of a `const_int' rtx. Currently, these always
- go into the const section. */
-
-#define SELECT_RTX_SECTION(MODE,RTX) const_section()
diff --git a/gcc/config/svr4.h b/gcc/config/svr4.h
deleted file mode 100644
index 19d566dbd72..00000000000
--- a/gcc/config/svr4.h
+++ /dev/null
@@ -1,986 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for some
- generic System V Release 4 system.
- Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@monkeys.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.
-
- To use this file, make up a file with a name like:
-
- ?????svr4.h
-
- where ????? is replaced by the name of the basic hardware that you
- are targeting for. Then, in the file ?????svr4.h, put something
- like:
-
- #include "?????.h"
- #include "svr4.h"
-
- followed by any really system-specific defines (or overrides of
- defines) which you find that you need. For example, CPP_PREDEFINES
- is defined here with only the defined -Dunix and -DSVR4. You should
- probably override that in your target-specific ?????svr4.h file
- with a set of defines that includes these, but also contains an
- appropriate define for the type of hardware that you are targeting.
-*/
-
-/* Define a symbol indicating that we are using svr4.h. */
-#define USING_SVR4_H
-
-/* For the sake of libgcc2.c, indicate target supports atexit. */
-#define HAVE_ATEXIT
-
-/* Cpp, assembler, linker, library, and startfile spec's. */
-
-/* This defines which switch letters take arguments. On svr4, most of
- the normal cases (defined in gcc.c) apply, and we also have -h* and
- -z* options (for the linker). Note however that there is no such
- thing as a -T option for svr4. */
-
-#define SWITCH_TAKES_ARG(CHAR) \
- (DEFAULT_SWITCH_TAKES_ARG (CHAR) \
- || (CHAR) == 'h' \
- || (CHAR) == 'x' \
- || (CHAR) == 'z')
-
-/* This defines which multi-letter switches take arguments. On svr4,
- there are no such switches except those implemented by GCC itself. */
-
-#define WORD_SWITCH_TAKES_ARG(STR) \
- (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
- && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \
- && strcmp (STR, "Tbss"))
-
-/* You should redefine CPP_PREDEFINES in any file which includes this one.
- The definition should be appropriate for the type of target system
- involved, and it should include any -A (assertion) options which are
- appropriate for the given target system. */
-#undef CPP_PREDEFINES
-
-/* Provide an ASM_SPEC appropriate for svr4. Here we try to support as
- many of the specialized svr4 assembler options as seems reasonable,
- given that there are certain options which we can't (or shouldn't)
- support directly due to the fact that they conflict with other options
- for other svr4 tools (e.g. ld) or with other options for GCC itself.
- For example, we don't support the -o (output file) or -R (remove
- input file) options because GCC already handles these things. We
- also don't support the -m (run m4) option for the assembler because
- that conflicts with the -m (produce load map) option of the svr4
- linker. We do however allow passing arbitrary options to the svr4
- assembler via the -Wa, option.
-
- Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,*
- option.
-*/
-
-#undef ASM_SPEC
-#define ASM_SPEC \
- "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
-
-/* svr4 assemblers need the `-' (indicating input from stdin) to come after
- the -o option (and its argument) for some reason. If we try to put it
- before the -o option, the assembler will try to read the file named as
- the output file in the -o option as an input file (after it has already
- written some stuff to it) and the binary stuff contained therein will
- cause totally confuse the assembler, resulting in many spurious error
- messages. */
-
-#undef ASM_FINAL_SPEC
-#define ASM_FINAL_SPEC "%|"
-
-/* Under svr4, the normal location of the `ld' and `as' programs is the
- /usr/ccs/bin directory. */
-
-#ifndef CROSS_COMPILE
-#undef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/ccs/bin/"
-#endif
-
-/* Under svr4, the normal location of the various *crt*.o files is the
- /usr/ccs/lib directory. */
-
-#ifndef CROSS_COMPILE
-#undef MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
-#endif
-
-/* Provide a LIB_SPEC appropriate for svr4. Here we tack on the default
- standard C library (unless we are building a shared library). */
-
-#undef LIB_SPEC
-#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}"
-
-/* Provide an ENDFILE_SPEC appropriate for svr4. Here we tack on our own
- magical crtend.o file (see crtstuff.c) which provides part of the
- support for getting C++ file-scope static object constructed before
- entering `main', followed by the normal svr3/svr4 "finalizer" file,
- which is either `gcrtn.o' or `crtn.o'. */
-
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o%s}%{!pg:crtn.o%s}"
-
-/* Provide a LINK_SPEC appropriate for svr4. Here we provide support
- for the special GCC options -static, -shared, and -symbolic which
- allow us to link things in one of these three modes by applying the
- appropriate combinations of options at link-time. We also provide
- support here for as many of the other svr4 linker options as seems
- reasonable, given that some of them conflict with options for other
- svr4 tools (e.g. the assembler). In particular, we do support the
- -h*, -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*,
- -l*, -o*, -r, -s, -u*, and -L* options are directly supported
- by gcc.c itself. We don't directly support the -m (generate load
- map) option because that conflicts with the -m (run m4) option of
- the svr4 assembler. We also don't directly support the svr4 linker's
- -I* or -M* options because these conflict with existing GCC options.
- We do however allow passing arbitrary options to the svr4 linker
- via the -Wl, option. We don't support the svr4 linker's -a option
- at all because it is totally useless and because it conflicts with
- GCC's own -a option.
-
- Note that gcc doesn't allow a space to follow -Y in a -YP,* option.
-
- When the -G link option is used (-shared and -symbolic) a final link is
- not being done. */
-
-#undef LINK_SPEC
-#ifdef CROSS_COMPILE
-#define LINK_SPEC "%{h*} %{v:-V} \
- %{b} %{Wl,*:%*} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy -z text %{!h*:%{o*:-h %*}}} \
- %{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}} \
- %{G:-G} \
- %{YP,*} \
- %{Qy:} %{!Qn:-Qy}"
-#else
-#define LINK_SPEC "%{h*} %{v:-V} \
- %{b} %{Wl,*:%*} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy -z text %{!h*:%{o*:-h %*}}} \
- %{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}} \
- %{G:-G} \
- %{YP,*} \
- %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!p:-Y P,/usr/ccs/lib:/usr/lib}} \
- %{Qy:} %{!Qn:-Qy}"
-#endif
-
-/* Gcc automatically adds in one of the files /usr/ccs/lib/values-Xc.o,
- /usr/ccs/lib/values-Xa.o, or /usr/ccs/lib/values-Xt.o for each final
- link step (depending upon the other gcc options selected, such as
- -traditional and -ansi). These files each contain one (initialized)
- copy of a special variable called `_lib_version'. Each one of these
- files has `_lib_version' initialized to a different (enum) value.
- The SVR4 library routines query the value of `_lib_version' at run
- to decide how they should behave. Specifically, they decide (based
- upon the value of `_lib_version') if they will act in a strictly ANSI
- conforming manner or not.
-*/
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared: \
- %{!symbolic: \
- %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
- %{pg:gcrti.o%s}%{!pg:crti.o%s} \
- %{ansi:values-Xc.o%s} \
- %{!ansi: \
- %{traditional:values-Xt.o%s} \
- %{!traditional:values-Xa.o%s}} \
- crtbegin.o%s"
-
-/* Attach a special .ident directive to the end of the file to identify
- the version of GCC which compiled this code. The format of the
- .ident string is patterned after the ones produced by native svr4
- C compilers. */
-
-#define IDENT_ASM_OP ".ident"
-
-#define ASM_FILE_END(FILE) \
-do { \
- fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \
- IDENT_ASM_OP, version_string); \
- } while (0)
-
-/* Allow #sccs in preprocessor. */
-
-#define SCCS_DIRECTIVE
-
-/* Output #ident as a .ident. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
- fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
-
-/* Use periods rather than dollar signs in special g++ assembler names. */
-
-#define NO_DOLLAR_IN_LABEL
-
-/* Writing `int' for a bitfield forces int alignment for the structure. */
-
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Implicit library calls should use memcpy, not bcopy, etc. */
-
-#define TARGET_MEM_FUNCTIONS
-
-/* Handle #pragma weak and #pragma pack. */
-
-#define HANDLE_SYSV_PRAGMA
-
-/* System V Release 4 uses DWARF debugging info. */
-
-#define DWARF_DEBUGGING_INFO
-
-/* All ELF targets can support DWARF-2. */
-
-#define DWARF2_DEBUGGING_INFO
-
-/* The numbers used to denote specific machine registers in the System V
- Release 4 DWARF debugging information are quite likely to be totally
- different from the numbers used in BSD stabs debugging information
- for the same kind of target machine. Thus, we undefine the macro
- DBX_REGISTER_NUMBER here as an extra inducement to get people to
- provide proper machine-specific definitions of DBX_REGISTER_NUMBER
- (which is also used to provide DWARF registers numbers in dwarfout.c)
- in their tm.h files which include this file. */
-
-#undef DBX_REGISTER_NUMBER
-
-/* gas on SVR4 supports the use of .stabs. Permit -gstabs to be used
- in general, although it will only work when using gas. */
-
-#define DBX_DEBUGGING_INFO
-
-/* When generating stabs debugging, use N_BINCL entries. */
-
-#define DBX_USE_BINCL
-
-/* Use DWARF debugging info by default. */
-
-#ifndef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
-#endif
-
-/* Make LBRAC and RBRAC addresses relative to the start of the
- function. The native Solaris stabs debugging format works this
- way, gdb expects it, and it reduces the number of relocation
- entries. */
-
-#define DBX_BLOCKS_FUNCTION_RELATIVE 1
-
-/* When using stabs, gcc2_compiled must be a stabs entry, not an
- ordinary symbol, or gdb won't see it. Furthermore, since gdb reads
- the input piecemeal, starting with each N_SO, it's a lot easier if
- the gcc2 flag symbol is *after* the N_SO rather than before it. So
- we emit an N_OPT stab there. */
-
-#define ASM_IDENTIFY_GCC(FILE) \
-do \
- { \
- if (write_symbols != DBX_DEBUG) \
- fputs ("gcc2_compiled.:\n", FILE); \
- } \
-while (0)
-
-#define ASM_IDENTIFY_GCC_AFTER_SOURCE(FILE) \
-do \
- { \
- if (write_symbols == DBX_DEBUG) \
- fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \
- } \
-while (0)
-
-/* Like block addresses, stabs line numbers are relative to the
- current function. */
-
-#define ASM_OUTPUT_SOURCE_LINE(file, line) \
-do \
- { \
- static int sym_lineno = 1; \
- fprintf (file, ".stabn 68,0,%d,.LM%d-", \
- line, sym_lineno); \
- assemble_name (file, \
- XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
- fprintf (file, "\n.LM%d:\n", sym_lineno); \
- sym_lineno += 1; \
- } \
-while (0)
-
-/* In order for relative line numbers to work, we must output the
- stabs entry for the function name first. */
-
-#define DBX_FUNCTION_FIRST
-
-/* Generate a blank trailing N_SO to mark the end of the .o file, since
- we can't depend upon the linker to mark .o file boundaries with
- embedded stabs. */
-
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
-do \
- { \
- text_section (); \
- fprintf (FILE, \
- "\t.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO); \
- } \
-while (0)
-
-/* Define the actual types of some ANSI-mandated types. (These
- definitions should work for most SVR4 systems). */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-/* This causes trouble, because it requires the host machine
- to support ANSI C. */
-/* #define MULTIBYTE_CHARS */
-
-#undef ASM_BYTE_OP
-#define ASM_BYTE_OP ".byte"
-
-#undef SET_ASM_OP
-#define SET_ASM_OP ".set"
-
-/* This is how to begin an assembly language file. Most svr4 assemblers want
- at least a .file directive to come first, and some want to see a .version
- directive come right after that. Here we just establish a default
- which generates only the .file directive. If you need a .version
- directive for any specific target, you should override this definition
- in the target-specific file which includes this one. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- output_file_directive ((FILE), main_input_filename)
-
-/* This is how to allocate empty space in some section. The .zero
- pseudo-op is used for this on most svr4 assemblers. */
-
-#define SKIP_ASM_OP ".zero"
-
-#undef ASM_OUTPUT_SKIP
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE))
-
-/* The prefix to add to user-visible assembler symbols.
-
- For System V Release 4 the convention is *not* to prepend a leading
- underscore onto user-level symbol names. */
-
-#undef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
-
- For most svr4 systems, the convention is that any symbol which begins
- with a period is not put into the linker symbol table by the assembler. */
-
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
-do { \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \
-} while (0)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'.
-
- For most svr4 systems, the convention is that any symbol which begins
- with a period is not put into the linker symbol table by the assembler. */
-
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
-do { \
- sprintf (LABEL, "*.%s%d", PREFIX, NUM); \
-} while (0)
-
-/* Output the label which precedes a jumptable. Note that for all svr4
- systems where we actually generate jumptables (which is to say every
- svr4 target except i386, where we use casesi instead) we put the jump-
- tables into the .rodata section and since other stuff could have been
- put into the .rodata section prior to any given jumptable, we have to
- make sure that the location counter for the .rodata section gets pro-
- perly re-aligned prior to the actual beginning of the jump table. */
-
-#define ALIGN_ASM_OP ".align"
-
-#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
-#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- ASM_OUTPUT_ALIGN ((FILE), 2);
-#endif
-
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \
- do { \
- ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \
- } while (0)
-
-/* The standard SVR4 assembler seems to require that certain builtin
- library routines (e.g. .udiv) be explicitly declared as .globl
- in each assembly file where they are referenced. */
-
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
- ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
-
-/* This says how to output assembler code to declare an
- uninitialized external linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here. */
-
-#define COMMON_ASM_OP ".comm"
-
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
-} while (0)
-
-/* This says how to output assembler code to declare an
- uninitialized internal linkage data object. Under SVR4,
- the linker seems to want the alignment of data objects
- to depend on their types. We do exactly that here. */
-
-#define LOCAL_ASM_OP ".local"
-
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), "\n"); \
- ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
-} while (0)
-
-/* Biggest alignment supported by the object file format of this
- machine. Use this macro to limit the alignment which can be
- specified using the `__attribute__ ((aligned (N)))' construct. If
- not defined, the default value is `BIGGEST_ALIGNMENT'. */
-
-#define MAX_OFILE_ALIGNMENT (32768*8)
-
-/* This is the pseudo-op used to generate a 32-bit word of data with a
- specific value in some section. This is the same for all known svr4
- assemblers. */
-
-#define INT_ASM_OP ".long"
-
-/* This is the pseudo-op used to generate a contiguous sequence of byte
- values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
- AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */
-
-#undef ASCII_DATA_ASM_OP
-#define ASCII_DATA_ASM_OP ".ascii"
-
-/* Support const sections and the ctors and dtors sections for g++.
- Note that there appears to be two different ways to support const
- sections at the moment. You can either #define the symbol
- READONLY_DATA_SECTION (giving it some code which switches to the
- readonly data section) or else you can #define the symbols
- EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
- SELECT_RTX_SECTION. We do both here just to be on the safe side. */
-
-#define USE_CONST_SECTION 1
-
-#define CONST_SECTION_ASM_OP ".section\t.rodata"
-
-/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
-
- Note that we want to give these sections the SHF_WRITE attribute
- because these sections will actually contain data (i.e. tables of
- addresses of functions in the current root executable or shared library
- file) and, in the case of a shared library, the relocatable addresses
- will have to be properly resolved/relocated (and then written into) by
- the dynamic linker when it actually attaches the given shared library
- to the executing process. (Note that on SVR4, you may wish to use the
- `-z text' option to the ELF linker, when building a shared library, as
- an additional check that you are doing everything right. But if you do
- use the `-z text' option when building a shared library, you will get
- errors unless the .ctors and .dtors sections are marked as writable
- via the SHF_WRITE attribute.) */
-
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
-
-/* On svr4, we *do* have support for the .init and .fini sections, and we
- can put stuff in there to be executed before and after `main'. We let
- crtstuff.c and other files know this by defining the following symbols.
- The definitions say how to change sections to the .init and .fini
- sections. This is the same for all known svr4 assemblers. */
-
-#define INIT_SECTION_ASM_OP ".section\t.init"
-#define FINI_SECTION_ASM_OP ".section\t.fini"
-
-/* A default list of other sections which we might be "in" at any given
- time. For targets that use additional sections (e.g. .tdesc) you
- should override this definition in the target-specific file which
- includes this file. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
-
-/* A default list of extra section function definitions. For targets
- that use additional sections (e.g. .tdesc) you should override this
- definition in the target-specific file which includes this file. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define READONLY_DATA_SECTION() const_section ()
-
-extern void text_section ();
-
-#define CONST_SECTION_FUNCTION \
-void \
-const_section () \
-{ \
- if (!USE_CONST_SECTION) \
- text_section(); \
- else if (in_section != in_const) \
- { \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
- in_section = in_const; \
- } \
-}
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
-
-
-/*
- * Switch into a generic section.
- *
- * We make the section read-only and executable for a function decl,
- * read-only for a const data decl, and writable for a non-const data decl.
- *
- * If the section has already been defined, we must not
- * emit the attributes here. The SVR4 assembler does not
- * recognize section redefinitions.
- * If DECL is NULL, no attributes are emitted.
- */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
-do { \
- static struct section_info \
- { \
- struct section_info *next; \
- char *name; \
- enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
- } *sections; \
- struct section_info *s; \
- char *mode; \
- enum sect_enum type; \
- \
- for (s = sections; s; s = s->next) \
- if (!strcmp (NAME, s->name)) \
- break; \
- \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- type = SECT_EXEC, mode = "ax"; \
- else if (DECL && TREE_READONLY (DECL)) \
- type = SECT_RO, mode = "a"; \
- else \
- type = SECT_RW, mode = "aw"; \
- \
- if (s == 0) \
- { \
- s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
- s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
- strcpy (s->name, NAME); \
- s->type = type; \
- s->next = sections; \
- sections = s; \
- fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, mode); \
- } \
- else \
- { \
- if (DECL && s->type != type) \
- error_with_decl (DECL, "%s causes a section type conflict"); \
- \
- fprintf (FILE, ".section\t%s\n", NAME); \
- } \
-} while (0)
-
-/* A C statement (sans semicolon) to mark DECL to be emitted as a
- public symbol such that extra copies in multiple translation units will
- be discarded by the linker. */
-#define MAKE_DECL_ONE_ONLY(DECL) \
-do { \
- int len; \
- char *name, *string, *prefix; \
- \
- DECL_WEAK (DECL) = 1; \
- \
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
- \
- if (TREE_CODE (DECL) == FUNCTION_DECL) \
- prefix = ".gnu.linkonce.t."; \
- else if (TREE_READONLY (DECL)) \
- prefix = ".gnu.linkonce.r."; \
- else \
- prefix = ".gnu.linkonce.d."; \
- \
- len = strlen (name) + strlen (prefix); \
- string = alloca (len + 1); \
- sprintf (string, "%s%s", prefix, name); \
- \
- DECL_SECTION_NAME (DECL) = build_string (len, string); \
-} while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement or statements to switch to the appropriate
- section for output of DECL. DECL is either a `VAR_DECL' node
- or a constant of some sort. RELOC indicates whether forming
- the initial value of DECL requires link-time relocations. */
-
-#define SELECT_SECTION(DECL,RELOC) \
-{ \
- if (flag_pic && RELOC) \
- data_section (); \
- else if (TREE_CODE (DECL) == STRING_CST) \
- { \
- if (! flag_writable_strings) \
- const_section (); \
- else \
- data_section (); \
- } \
- else if (TREE_CODE (DECL) == VAR_DECL) \
- { \
- if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \
- || !DECL_INITIAL (DECL) \
- || (DECL_INITIAL (DECL) != error_mark_node \
- && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \
- data_section (); \
- else \
- const_section (); \
- } \
- else \
- const_section (); \
-}
-
-/* A C statement or statements to switch to the appropriate
- section for output of RTX in mode MODE. RTX is some kind
- of constant in RTL. The argument MODE is redundant except
- in the case of a `const_int' rtx. Currently, these always
- go into the const section. */
-
-#undef SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE,RTX) const_section()
-
-/* Define the strings used for the special svr4 .type and .size directives.
- These strings generally do not vary from one system running svr4 to
- another, but if a given system (e.g. m88k running svr) needs to use
- different pseudo-op names for these, they may be overridden in the
- file which includes this one. */
-
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#define ASM_WEAKEN_LABEL(FILE,NAME) \
- do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
- fputc ('\n', FILE); } while (0)
-
-/* The following macro defines the format used to output the second
- operand of the .type assembler directive. Different svr4 assemblers
- expect various different forms for this operand. The one given here
- is just a default. You may need to override it in your machine-
- specific tm.h file (depending upon the particulars of your assembler). */
-
-#define TYPE_OPERAND_FMT "@%s"
-
-/* Write the extra assembler code needed to declare a function's result.
- Most svr4 assemblers don't require any special declaration of the
- result value, but there are exceptions. */
-
-#ifndef ASM_DECLARE_RESULT
-#define ASM_DECLARE_RESULT(FILE, RESULT)
-#endif
-
-/* These macros generate the special .type and .size directives which
- are used to set the corresponding fields of the linker symbol table
- entries in an ELF object file under SVR4. These macros also output
- the starting labels for the relevant functions/objects. */
-
-/* Write the extra assembler code needed to declare a function properly.
- Some svr4 assemblers need to also have something extra said about the
- function's return value. We allow for that here. */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
- putc ('\n', FILE); \
- ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Write the extra assembler code needed to declare an object properly. */
-
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
- assemble_name (FILE, NAME); \
- putc (',', FILE); \
- fprintf (FILE, TYPE_OPERAND_FMT, "object"); \
- putc ('\n', FILE); \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- ASM_OUTPUT_LABEL(FILE, NAME); \
- } while (0)
-
-/* Output the size directive for a decl in rest_of_decl_compilation
- in the case where we did not do so before the initializer.
- Once we find the error_mark_node, we know that the value of
- size_directive_output was set
- by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
-
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
-do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
- if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
- && ! AT_END && TOP_LEVEL \
- && DECL_INITIAL (DECL) == error_mark_node \
- && !size_directive_output) \
- { \
- size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
- } \
- } while (0)
-
-/* This is how to declare the size of a function. */
-
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
- do { \
- if (!flag_inhibit_size_directive) \
- { \
- char label[256]; \
- static int labelno; \
- labelno++; \
- ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ","); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } while (0)
-
-/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
- ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
- corresponds to a particular byte value [0..255]. For any
- given byte value, if the value in the corresponding table
- position is zero, the given character can be output directly.
- If the table value is 1, the byte must be output as a \ooo
- octal escape. If the tables value is anything else, then the
- byte value should be output as a \ followed by the value
- in the table. Note that we can use standard UN*X escape
- sequences for many control characters, but we don't use
- \a to represent BEL because some svr4 assemblers (e.g. on
- the i386) don't know about that. Also, we don't use \v
- since some versions of gas, such as 2.2 did not accept it. */
-
-#define ESCAPES \
-"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
-\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
-
-/* Some svr4 assemblers have a limit on the number of characters which
- can appear in the operand of a .string directive. If your assembler
- has such a limitation, you should define STRING_LIMIT to reflect that
- limit. Note that at least some svr4 assemblers have a limit on the
- actual number of bytes in the double-quoted string, and that they
- count each character in an escape sequence as one byte. Thus, an
- escape sequence like \377 would count as four bytes.
-
- If your target assembler doesn't support the .string directive, you
- should define this to zero.
-*/
-
-#define STRING_LIMIT ((unsigned) 256)
-
-#define STRING_ASM_OP ".string"
-
-/* The routine used to output NUL terminated strings. We use a special
- version of this for most svr4 targets because doing so makes the
- generated assembly code more compact (and thus faster to assemble)
- as well as more readable, especially for targets like the i386
- (where the only alternative is to output character sequences as
- comma separated lists of numbers). */
-
-#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
- do \
- { \
- register unsigned char *_limited_str = (unsigned char *) (STR); \
- register unsigned ch; \
- fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \
- for (; ch = *_limited_str; _limited_str++) \
- { \
- register int escape; \
- switch (escape = ESCAPES[ch]) \
- { \
- case 0: \
- putc (ch, (FILE)); \
- break; \
- case 1: \
- fprintf ((FILE), "\\%03o", ch); \
- break; \
- default: \
- putc ('\\', (FILE)); \
- putc (escape, (FILE)); \
- break; \
- } \
- } \
- fprintf ((FILE), "\"\n"); \
- } \
- while (0)
-
-/* The routine used to output sequences of byte values. We use a special
- version of this for most svr4 targets because doing so makes the
- generated assembly code more compact (and thus faster to assemble)
- as well as more readable. Note that if we find subparts of the
- character sequence which end with NUL (and which are shorter than
- STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
- do \
- { \
- register unsigned char *_ascii_bytes = (unsigned char *) (STR); \
- register unsigned char *limit = _ascii_bytes + (LENGTH); \
- register unsigned bytes_in_chunk = 0; \
- for (; _ascii_bytes < limit; _ascii_bytes++) \
- { \
- register unsigned char *p; \
- if (bytes_in_chunk >= 60) \
- { \
- fprintf ((FILE), "\"\n"); \
- bytes_in_chunk = 0; \
- } \
- for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
- continue; \
- if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \
- { \
- if (bytes_in_chunk > 0) \
- { \
- fprintf ((FILE), "\"\n"); \
- bytes_in_chunk = 0; \
- } \
- ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
- _ascii_bytes = p; \
- } \
- else \
- { \
- register int escape; \
- register unsigned ch; \
- if (bytes_in_chunk == 0) \
- fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP); \
- switch (escape = ESCAPES[ch = *_ascii_bytes]) \
- { \
- case 0: \
- putc (ch, (FILE)); \
- bytes_in_chunk++; \
- break; \
- case 1: \
- fprintf ((FILE), "\\%03o", ch); \
- bytes_in_chunk += 4; \
- break; \
- default: \
- putc ('\\', (FILE)); \
- putc (escape, (FILE)); \
- bytes_in_chunk += 2; \
- break; \
- } \
- } \
- } \
- if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\"\n"); \
- } \
- while (0)
-
-/* All SVR4 targets use the ELF object file format. */
-#define OBJECT_FORMAT_ELF
diff --git a/gcc/config/t-gnu b/gcc/config/t-gnu
deleted file mode 100644
index 58969f21e20..00000000000
--- a/gcc/config/t-gnu
+++ /dev/null
@@ -1,13 +0,0 @@
-LIBGCC1=libgcc1.null
-CROSS_LIBGCC1=libgcc1.null
-
-# The pushl in CTOR initialization interferes with frame pointer elimination.
-
-# We need to use -fPIC when we are using gcc to compile the routines in
-# crtstuff.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fPIC when compiling the
-# routines in crtstuff.c.
-
-CRTSTUFF_T_CFLAGS = -fPIC -fno-omit-frame-pointer
-TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/t-libc-ok b/gcc/config/t-libc-ok
deleted file mode 100644
index 43e4f5e9e04..00000000000
--- a/gcc/config/t-libc-ok
+++ /dev/null
@@ -1,3 +0,0 @@
-LIBGCC1=libgcc1.null
-CROSS_LIBGCC1=libgcc1.null
-CRTSTUFF_T_FLAGS_S=-fPIC
diff --git a/gcc/config/t-linux b/gcc/config/t-linux
deleted file mode 100644
index 843fa1bdf79..00000000000
--- a/gcc/config/t-linux
+++ /dev/null
@@ -1,10 +0,0 @@
-# Don't run fixproto
-STMP_FIXPROTO =
-
-# Don't install "assert.h" in gcc. We use the one in glibc.
-INSTALL_ASSERT_H =
-
-# Compile crtbeginS.o and crtendS.o with pic.
-CRTSTUFF_T_CFLAGS_S = -fPIC
-# Compile libgcc2.a with pic.
-TARGET_LIBGCC2_CFLAGS = -fPIC
diff --git a/gcc/config/t-linux-aout b/gcc/config/t-linux-aout
deleted file mode 100644
index a7c091799e8..00000000000
--- a/gcc/config/t-linux-aout
+++ /dev/null
@@ -1,5 +0,0 @@
-# Don't run fixproto
-STMP_FIXPROTO =
-
-# Don't install "assert.h" in gcc. We use the one in glibc.
-INSTALL_ASSERT_H =
diff --git a/gcc/config/t-rtems b/gcc/config/t-rtems
deleted file mode 100644
index 25dd398dd52..00000000000
--- a/gcc/config/t-rtems
+++ /dev/null
@@ -1,2 +0,0 @@
-# RTEMS uses newlib which does not require prototype fixing
-STMP_FIXPROTO =
diff --git a/gcc/config/t-svr4 b/gcc/config/t-svr4
deleted file mode 100644
index d4abf488905..00000000000
--- a/gcc/config/t-svr4
+++ /dev/null
@@ -1,7 +0,0 @@
-# We need to use -fPIC when we are using gcc to compile the routines in
-# crtstuff.c. This is only really needed when we are going to use gcc/g++
-# to produce a shared library, but since we don't know ahead of time when
-# we will be doing that, we just always use -fPIC when compiling the
-# routines in crtstuff.c.
-
-CRTSTUFF_T_CFLAGS = -fPIC
diff --git a/gcc/config/tahoe/harris.h b/gcc/config/tahoe/harris.h
deleted file mode 100644
index 9226445ed98..00000000000
--- a/gcc/config/tahoe/harris.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Definitions of target machine for GNU compiler. Harris tahoe version.
- Copyright (C) 1989, 1993 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. */
-
-
-#include "tahoe/tahoe.h"
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dtahoe -Dunix -Dhcx -Asystem(unix) -Acpu(tahoe) -Amachine(tahoe)"
-
-#undef DBX_DEBUGGING_INFO
-#define SDB_DEBUGGING_INFO
-
-#undef LIB_SPEC
-
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 1
-
-/* urem and udiv don't exist on this system. */
-#undef UDIVSI3_LIBCALL
-#undef UMODSI3_LIBCALL
-
-/* Operand of .align is not logarithmic. */
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- LOG ? fprintf (FILE, "\t.align %d\n", 1 << (LOG)) : 0
-
-/* For the same reason, we need .align 2 after casesi. */
-#undef PRINT_OPERAND
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (CODE == '@') \
- putc ('2', FILE); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else { putc ('$', FILE); output_addr_const (FILE, X); }}
-
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".bss ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u,4\n", (ROUNDED)))
-
-/* Output at beginning of assembler file. */
-/* The .file command should always begin the output. */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
- output_file_directive ((FILE), main_input_filename);
-
-#define ASM_OUTPUT_ASCII(FILE, PTR, SIZE) \
-do { \
- unsigned char *_p = (PTR); \
- int _thissize = (SIZE); \
- fprintf ((FILE), "\t.ascii \""); \
- for (i = 0; i < _thissize; i++) \
- { \
- register int c = _p[i]; \
- if (c >= ' ' && c < 0177 && c != '\"' && c != '\\') \
- putc (c, (FILE)); \
- else \
- { \
- fprintf ((FILE), "\\%o", c); \
- if (i < _thissize - 1 \
- && _p[i + 1] >= '0' && _p[i + 1] <= '9') \
- fprintf ((FILE), "\"\n\t.ascii \""); \
- } \
- } \
- fprintf ((FILE), "\"\n"); \
-} while (0)
diff --git a/gcc/config/tahoe/tahoe.c b/gcc/config/tahoe/tahoe.c
deleted file mode 100644
index 6fec44418f4..00000000000
--- a/gcc/config/tahoe/tahoe.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/* Subroutines for insn-output.c for Tahoe.
- Copyright (C) 1989, 1991 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. */
-
-
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-
-/*
- * File: output-tahoe.c
- *
- * Original port made at the University of Buffalo by Devon Bowen,
- * Dale Wiles and Kevin Zachmann.
- *
- * Changes for HCX by Piet van Oostrum,
- * University of Utrecht, The Netherlands (piet@cs.ruu.nl)
- *
- * Speed tweaks by Michael Tiemann (tiemann@lurch.stanford.edu).
- *
- * Mail bugs reports or fixes to: gcc@cs.buffalo.edu
- */
-
-
-/* On tahoe, you have to go to memory to convert a register
- from sub-word to word. */
-
-rtx tahoe_reg_conversion_loc;
-
-int
-extendable_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if ((GET_CODE (op) == REG
- || (GET_CODE (op) == SUBREG
- && GET_CODE (SUBREG_REG (op)) == REG))
- && tahoe_reg_conversion_loc == 0)
- tahoe_reg_conversion_loc = assign_stack_local (SImode, GET_MODE_SIZE (SImode));
- return general_operand (op, mode);
-}
-
-/* most of the print_operand_address function was taken from the vax */
-/* since the modes are basically the same. I had to add a special case, */
-/* though, for symbol references with offsets. */
-
-#include <stdio.h>
-
-print_operand_address (file, addr)
- FILE *file;
- register rtx addr;
-{
- register rtx reg1, reg2, breg, ireg;
- rtx offset;
- static char *reg_name[] = REGISTER_NAMES;
-
- retry:
- switch (GET_CODE (addr))
- {
- case MEM:
- fprintf (file, "*");
- addr = XEXP (addr, 0);
- goto retry;
-
- case REG:
- fprintf (file, "(%s)", reg_name [REGNO (addr)]);
- break;
-
- case PRE_DEC:
- fprintf (file, "-(%s)", reg_name [REGNO (XEXP (addr, 0))]);
- break;
-
- case POST_INC:
- fprintf (file, "(%s)+", reg_name [REGNO (XEXP (addr, 0))]);
- break;
-
- case PLUS:
- reg1 = 0; reg2 = 0;
- ireg = 0; breg = 0;
- offset = 0;
-
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))
- && GET_CODE (XEXP (addr, 1)) == CONST_INT)
- output_addr_const (file, addr);
-
- if (CONSTANT_ADDRESS_P (XEXP (addr, 1))
- && GET_CODE (XEXP (addr, 0)) == CONST_INT)
- output_addr_const (file, addr);
-
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))
- || GET_CODE (XEXP (addr, 0)) == MEM)
- {
- offset = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))
- || GET_CODE (XEXP (addr, 1)) == MEM)
- {
- offset = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- if (GET_CODE (addr) != PLUS)
- ;
- else if (GET_CODE (XEXP (addr, 0)) == MULT)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == MULT)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 0)) == REG)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT)
- {
- if (reg1 == 0)
- reg1 = addr;
- else
- reg2 = addr;
- addr = 0;
- }
- if (offset != 0)
- {
- if (addr != 0) abort ();
- addr = offset;
- }
- if (reg1 != 0 && GET_CODE (reg1) == MULT)
- {
- breg = reg2;
- ireg = reg1;
- }
- else if (reg2 != 0 && GET_CODE (reg2) == MULT)
- {
- breg = reg1;
- ireg = reg2;
- }
- else if (reg2 != 0 || GET_CODE (addr) == MEM)
- {
- breg = reg2;
- ireg = reg1;
- }
- else
- {
- breg = reg1;
- ireg = reg2;
- }
- if (addr != 0)
- output_address (offset);
- if (breg != 0)
- {
- if (GET_CODE (breg) != REG)
- abort ();
- fprintf (file, "(%s)", reg_name[REGNO (breg)]);
- }
- if (ireg != 0)
- {
- if (GET_CODE (ireg) == MULT)
- ireg = XEXP (ireg, 0);
- if (GET_CODE (ireg) != REG)
- abort ();
- fprintf (file, "[%s]", reg_name[REGNO (ireg)]);
- }
- break;
-
- default:
- output_addr_const (file, addr);
- }
-}
-
-/* Do a quick check and find out what the best way to do the */
-/* mini-move is. Could be a push or a move..... */
-
-static char *
-singlemove_string (operands)
- rtx *operands;
-{
- if (operands[1] == const0_rtx)
- return "clrl %0";
- if (push_operand (operands[0], SImode))
- return "pushl %1";
- return "movl %1,%0";
-}
-
-/* given the rtx for an address, return true if the given */
-/* register number is used in the address somewhere. */
-
-regisused(addr,regnum)
-rtx addr;
-int regnum;
-{
- if (GET_CODE(addr) == REG)
- if (REGNO(addr) == regnum)
- return (1);
- else
- return (0);
-
- if (GET_CODE(addr) == MEM)
- return regisused(XEXP(addr,0),regnum);
-
- if ((GET_CODE(addr) == MULT) || (GET_CODE(addr) == PLUS))
- return ((regisused(XEXP(addr,0),regnum)) ||
- (regisused(XEXP(addr,1),regnum)));
-
- return 0;
-}
-
-
-/* Given some rtx, traverse it and return the register used in a */
-/* index. If no index is found, return 0. */
-
-rtx
-index_reg(addr)
-rtx addr;
-{
- rtx temp;
-
- if (GET_CODE(addr) == MEM)
- return index_reg(XEXP(addr,0));
-
- if (GET_CODE(addr) == MULT)
- if (GET_CODE(XEXP(addr,0)) == REG)
- return XEXP(addr,0);
- else
- return XEXP(addr,1);
-
- if (GET_CODE(addr) == PLUS)
- if (temp = index_reg(XEXP(addr,0)))
- return temp;
- else
- return index_reg(XEXP(addr,1));
-
- return 0;
-}
-
-
-/* simulate the move double by generating two movl's. You have */
-/* to be careful about mixing modes here. */
-
-char *
-output_move_double (operands)
- rtx *operands;
-{
- enum { REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, INDOP, CNSTOP, RNDOP }
- optype0, optype1;
- rtx latehalf[2];
- rtx shftreg0 = 0, shftreg1 = 0;
- rtx temp0 = 0, temp1 = 0;
- rtx addreg0 = 0, addreg1 = 0;
- int dohighfirst = 0;
-
- /* First classify both operands. */
-
- if (REG_P (operands[0]))
- optype0 = REGOP;
- else if ((GET_CODE(operands[0])==MEM) && (shftreg0=index_reg(operands[0])))
- optype0 = INDOP;
- else if (offsettable_memref_p (operands[0]))
- optype0 = OFFSOP;
- else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC) {
- optype0 = PUSHOP;
- dohighfirst++;
- } else if (GET_CODE (operands[0]) == MEM)
- optype0 = MEMOP;
- else
- optype0 = RNDOP;
-
- if (REG_P (operands[1]))
- optype1 = REGOP;
- else if ((GET_CODE(operands[1])==MEM) && (shftreg1=index_reg(operands[1])))
- optype1 = INDOP;
- else if (offsettable_memref_p (operands[1]))
- optype1 = OFFSOP;
- else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC)
- optype1 = POPOP;
- else if (GET_CODE (operands[1]) == MEM)
- optype1 = MEMOP;
- else if (CONSTANT_P (operands[1]))
- optype1 = CNSTOP;
- else
- optype1 = RNDOP;
-
- /* set up for the high byte move for operand zero */
-
- switch (optype0) {
-
- /* if it's a register, just use the next highest in the */
- /* high address move. */
-
- case REGOP : latehalf[0] = gen_rtx (REG,SImode,REGNO(operands[0])+1);
- break;
-
- /* for an offsettable address, use the gcc function to */
- /* modify the operand to get an offset of 4 higher for */
- /* the second move. */
-
- case OFFSOP : latehalf[0] = adj_offsettable_operand (operands[0], 4);
- break;
-
- /* if the operand is MEMOP type, it must be a pointer */
- /* to a pointer. So just remember to increase the mem */
- /* location and use the same operand. */
-
- case MEMOP : latehalf[0] = operands[0];
- addreg0 = XEXP(operands[0],0);
- break;
-
- /* if we're dealing with a push instruction, just leave */
- /* the operand alone since it auto-increments. */
-
- case PUSHOP : latehalf[0] = operands[0];
- break;
-
- /* YUCK! Indexed addressing!! If the address is considered */
- /* offsettable, go use the offset in the high part. Otherwise */
- /* find what exactly is being added to the multiplication. If */
- /* it's a mem reference, increment that with the high part */
- /* being unchanged to cause the shift. If it's a reg, do the */
- /* same. If you can't identify it, abort. Remember that the */
- /* shift register was already set during identification. */
-
- case INDOP : if (offsettable_memref_p(operands[0])) {
- latehalf[0] = adj_offsettable_operand(operands[0],4);
- break;
- }
-
- latehalf[0] = operands[0];
-
- temp0 = XEXP(XEXP(operands[0],0),0);
- if (GET_CODE(temp0) == MULT) {
- temp1 = temp0;
- temp0 = XEXP(XEXP(operands[0],0),1);
- } else {
- temp1 = XEXP(XEXP(operands[0],0),1);
- if (GET_CODE(temp1) != MULT)
- abort();
- }
-
- if (GET_CODE(temp0) == MEM)
- addreg0 = temp0;
- else if (GET_CODE(temp0) == REG)
- addreg0 = temp0;
- else
- abort();
-
- break;
-
- /* if we don't know the operand type, print a friendly */
- /* little error message... 8-) */
-
- case RNDOP :
- default : abort();
- }
-
- /* do the same setup for operand one */
-
- switch (optype1) {
-
- case REGOP : latehalf[1] = gen_rtx(REG,SImode,REGNO(operands[1])+1);
- break;
-
- case OFFSOP : latehalf[1] = adj_offsettable_operand (operands[1], 4);
- break;
-
- case MEMOP : latehalf[1] = operands[1];
- addreg1 = XEXP(operands[1],0);
- break;
-
- case POPOP : latehalf[1] = operands[1];
- break;
-
- case INDOP : if (offsettable_memref_p(operands[1])) {
- latehalf[1] = adj_offsettable_operand(operands[1],4);
- break;
- }
-
- latehalf[1] = operands[1];
-
- temp0 = XEXP(XEXP(operands[1],0),0);
- if (GET_CODE(temp0) == MULT) {
- temp1 = temp0;
- temp0 = XEXP(XEXP(operands[1],0),1);
- } else {
- temp1 = XEXP(XEXP(operands[1],0),1);
- if (GET_CODE(temp1) != MULT)
- abort();
- }
-
- if (GET_CODE(temp0) == MEM)
- addreg1 = temp0;
- else if (GET_CODE(temp0) == REG)
- addreg1 = temp0;
- else
- abort();
-
- break;
-
- case CNSTOP :
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- split_double (operands[1], &operands[1], &latehalf[1]);
- else if (CONSTANT_P (operands[1]))
- latehalf[1] = const0_rtx;
- else abort ();
- break;
-
- case RNDOP :
- default : abort();
- }
-
-
- /* double the register used for shifting in both of the operands */
- /* but make sure the same register isn't doubled twice! */
-
- if (shftreg0 && shftreg1 && (rtx_equal_p(shftreg0,shftreg1)))
- output_asm_insn("addl2 %0,%0", &shftreg0);
- else {
- if (shftreg0)
- output_asm_insn("addl2 %0,%0", &shftreg0);
- if (shftreg1)
- output_asm_insn("addl2 %0,%0", &shftreg1);
- }
-
- /* if the destination is a register and that register is needed in */
- /* the source addressing mode, swap the order of the moves since we */
- /* don't want this destroyed til last. If both regs are used, not */
- /* much we can do, so abort. If these becomes a problem, maybe we */
- /* can do it on the stack? */
-
- if (GET_CODE(operands[0])==REG && regisused(operands[1],REGNO(operands[0])))
- if (regisused(latehalf[1],REGNO(latehalf[0])))
- 8;
- else
- dohighfirst++;
-
- /* if we're pushing, do the high address part first. */
-
- if (dohighfirst) {
-
- if (addreg0 && addreg1 && (rtx_equal_p(addreg0,addreg1)))
- output_asm_insn("addl2 $4,%0", &addreg0);
- else {
- if (addreg0)
- output_asm_insn("addl2 $4,%0", &addreg0);
- if (addreg1)
- output_asm_insn("addl2 $4,%0", &addreg1);
- }
-
- output_asm_insn(singlemove_string(latehalf), latehalf);
-
- if (addreg0 && addreg1 && (rtx_equal_p(addreg0,addreg1)))
- output_asm_insn("subl2 $4,%0", &addreg0);
- else {
- if (addreg0)
- output_asm_insn("subl2 $4,%0", &addreg0);
- if (addreg1)
- output_asm_insn("subl2 $4,%0", &addreg1);
- }
-
- return singlemove_string(operands);
- }
-
- output_asm_insn(singlemove_string(operands), operands);
-
- if (addreg0 && addreg1 && (rtx_equal_p(addreg0,addreg1)))
- output_asm_insn("addl2 $4,%0", &addreg0);
- else {
- if (addreg0)
- output_asm_insn("addl2 $4,%0", &addreg0);
- if (addreg1)
- output_asm_insn("addl2 $4,%0", &addreg1);
- }
-
- output_asm_insn(singlemove_string(latehalf), latehalf);
-
- if (addreg0 && addreg1 && (rtx_equal_p(addreg0,addreg1)))
- output_asm_insn("subl2 $4,%0", &addreg0);
- else {
- if (addreg0)
- output_asm_insn("subl2 $4,%0", &addreg0);
- if (addreg1)
- output_asm_insn("subl2 $4,%0", &addreg1);
- }
-
- if (shftreg0 && shftreg1 && (rtx_equal_p(shftreg0,shftreg1)))
- output_asm_insn("shar $1,%0,%0", &shftreg0);
- else {
- if (shftreg0)
- output_asm_insn("shar $1,%0,%0", &shftreg0);
- if (shftreg1)
- output_asm_insn("shar $1,%0,%0", &shftreg1);
- }
-
- return "";
-}
-
-
-/* This checks if a zero_extended cmp[bw] can be replaced by a sign_extended
- cmp[bw]. This can be done if the operand is a constant that fits in a
- byte/word or a memory operand. Besides that the next instruction must be an
- unsigned compare. Some of these tests are done by the machine description */
-
-int
-tahoe_cmp_check (insn, op, max)
-rtx insn, op; int max;
-{
- if (GET_CODE (op) == CONST_INT
- && ( INTVAL (op) < 0 || INTVAL (op) > max ))
- return 0;
- {
- register rtx next = NEXT_INSN (insn);
-
- if ((GET_CODE (next) == JUMP_INSN
- || GET_CODE (next) == INSN
- || GET_CODE (next) == CALL_INSN))
- {
- next = PATTERN (next);
- if (GET_CODE (next) == SET
- && SET_DEST (next) == pc_rtx
- && GET_CODE (SET_SRC (next)) == IF_THEN_ELSE)
- switch (GET_CODE (XEXP (SET_SRC (next), 0)))
- {
- case EQ:
- case NE:
- case LTU:
- case GTU:
- case LEU:
- case GEU:
- return 1;
- }
- }
- }
- return 0;
-}
diff --git a/gcc/config/tahoe/tahoe.h b/gcc/config/tahoe/tahoe.h
deleted file mode 100644
index b4076ce53b3..00000000000
--- a/gcc/config/tahoe/tahoe.h
+++ /dev/null
@@ -1,1015 +0,0 @@
-/* Definitions of target machine for GNU compiler. Tahoe version.
- Copyright (C) 1989, 1993, 1994, 1995, 1996 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. */
-
-/*
- * Original port made at the University of Buffalo by Devon Bowen,
- * Dale Wiles and Kevin Zachmann.
- *
- * HCX/UX version by Piet van Oostrum (piet@cs.ruu.nl)
- *
- * Performance hacking by Michael Tiemann (tiemann@cygnus.com)
- */
-
-/* define this for the HCX/UX version */
-
-/* #define HCX_UX */
-
-/*
- * Run-time Target Specification
- */
-
-#ifdef HCX_UX
-/* no predefines, see Makefile and hcx-universe.c */
-/* have cc1 print that this is the hcx version */
-#define TARGET_VERSION printf (" (hcx)");
-#else
-/* we want "tahoe" and "unix" defined for all future compilations */
-#define CPP_PREDEFINES "-Dtahoe -Dunix -Asystem(unix) -Acpu(tahoe) -Amachine(tahoe)"
-/* have cc1 print that this is the tahoe version */
-#define TARGET_VERSION printf (" (tahoe)");
-#endif
-
-/* this is required in all tm files to hold flags */
-
-extern int target_flags;
-
-/* Zero if it is safe to output .dfloat and .float pseudos. */
-#define TARGET_HEX_FLOAT (target_flags & 1)
-
-#define TARGET_DEFAULT 1
-
-#define TARGET_SWITCHES \
- { {"hex-float", 1}, \
- {"no-hex-float", -1}, \
- { "", TARGET_DEFAULT} }
-
-
-/*
- * Storage Layout
- */
-
-/* This symbol was previously not mentioned, so apparently the tahoe
- is little-endian for bits, or else doesn't care. */
-#define BITS_BIG_ENDIAN 0
-
-/* tahoe uses a big endian byte order */
-
-#define BYTES_BIG_ENDIAN 1
-
-/* tahoe uses a big endian word order */
-
-#define WORDS_BIG_ENDIAN 1
-
-/* standard byte size is usable on tahoe */
-
-#define BITS_PER_UNIT 8
-
-/* longs on the tahoe are 4 byte groups */
-
-#define BITS_PER_WORD 32
-
-/* from the last two params we get 4 bytes per word */
-
-#define UNITS_PER_WORD 4
-
-/* addresses are 32 bits (one word) */
-
-#define POINTER_SIZE 32
-
-/* all parameters line up on 32 boundaries */
-
-#define PARM_BOUNDARY 32
-
-/* stack should line up on 32 boundaries */
-
-#define STACK_BOUNDARY 32
-
-/* line functions up on 32 bits */
-
-#define FUNCTION_BOUNDARY 32
-
-/* the biggest alignment the tahoe needs in 32 bits */
-
-#define BIGGEST_ALIGNMENT 32
-
-/* we have to align after an 'int : 0' in a structure */
-
-#define EMPTY_FIELD_BOUNDARY 32
-
-#ifdef HCX_UX
-/* structures must be made of full words */
-
-#define STRUCTURE_SIZE_BOUNDARY 32
-#else
-/* structures must be made of full bytes */
-
-#define STRUCTURE_SIZE_BOUNDARY 8
-#endif
-
-/* tahoe is picky about data alignment */
-
-#define STRICT_ALIGNMENT 1
-
-/* keep things standard with pcc */
-
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* this section is borrowed from the vax version since the */
-/* formats are the same in both of the architectures */
-
-#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
- if (OVERFLOW) \
- (D) = 1.7014117331926443e+38; \
- else if ((MODE) == SFmode) \
- { \
- if ((D) > 1.7014117331926443e+38) \
- (OVERFLOW) = 1, (D) = 1.7014117331926443e+38; \
- else if ((D) < -1.7014117331926443e+38) \
- (OVERFLOW) = 1, (D) = -1.7014117331926443e+38; \
- else if (((D) > 0) && ((D) < 2.9387358770557188e-39)) \
- (OVERFLOW) = 1, (D) = 0.0; \
- else if (((D) < 0) && ((D) > -2.9387358770557188e-39)) \
- (OVERFLOW) = 1, (D) = 0.0; \
- }
-
-
-/*
- * Register Usage
- */
-
-/* define 15 general regs plus one for the floating point reg (FPP) */
-
-#define FIRST_PSEUDO_REGISTER 17
-
-/* let the compiler know what the fp, sp and pc are */
-
-#define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0}
-
-/* lots of regs aren't guaranteed to return from a call. The FPP reg */
-/* must be included in these since it can't be saved by the reg mask */
-
-#define CALL_USED_REGISTERS {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
-
-/* A single fp reg can handle any type of float.
- CPU regs hold just 32 bits. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- (REGNO != 16 ? ((GET_MODE_SIZE(MODE)+UNITS_PER_WORD-1) / UNITS_PER_WORD) \
- : GET_MODE_NUNITS ((MODE)))
-
-/* any mode greater than 4 bytes (doubles) can only go in an even regs */
-/* and the FPP can only hold SFmode and DFmode */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- (REGNO != 16 \
- ? (GET_MODE_UNIT_SIZE (MODE) <= 4 ? 1 : (REGNO % 2 - 1)) \
- : ((MODE) == SFmode || (MODE) == DFmode \
- || (MODE) == SCmode || (MODE) == DCmode))
-
-/* if mode1 or mode2, but not both, are doubles then modes cannot be tied */
-
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- (((MODE1) == DFmode || (MODE1) == DCmode) \
- == ((MODE2) == DFmode || (MODE2) == DCmode))
-
-/* return nonzero if register variable of mode MODE is not
- a priori a bad idea. Used only if defined. */
-#define MODE_OK_FOR_USERVAR(MODE) \
- ((MODE) == SImode)
-
-/* the program counter is reg 15 */
-
-#define PC_REGNUM 15
-
-/* the stack pointer is reg 14 */
-
-#define STACK_POINTER_REGNUM 14
-
-/* the frame pointer is reg 13 */
-
-#define FRAME_POINTER_REGNUM 13
-
-/* tahoe does require an fp */
-
-#define FRAME_POINTER_REQUIRED 1
-
-/* since tahoe doesn't have a argument pointer, make it the fp */
-
-#define ARG_POINTER_REGNUM 13
-
-/* this isn't currently used since C doesn't support this feature */
-
-#define STATIC_CHAIN_REGNUM 0
-
-/* we'll use reg 1 for structure passing cause the destination */
-/* of the eventual movblk requires it to be there anyway. */
-
-#define STRUCT_VALUE_REGNUM 1
-
-
-/*
- * Register Classes
- */
-
-/* tahoe has two types of regs. GENERAL_REGS are all the regs up */
-/* to number 15. FPP_REG is the special floating point processor */
-/* register class (only one reg). */
-
-enum reg_class {NO_REGS,GENERAL_REGS,FPP_REG,ALL_REGS,LIM_REG_CLASSES};
-
-/* defines the number of reg classes. */
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* this defines what the classes are officially named for debugging */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS","GENERAL_REGS","FPP_REG","ALL_REGS"}
-
-/* set general regs to be the first 16 regs and the fpp reg to be 17th */
-
-#define REG_CLASS_CONTENTS {0,0xffff,0x10000,0x1ffff}
-
-/* register class for the fpp reg is FPP_REG, all others are GENERAL_REGS */
-
-#define REGNO_REG_CLASS(REGNO) (REGNO == 16 ? FPP_REG : GENERAL_REGS)
-
-/* only general registers can be used as a base reg */
-
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* only general registers can be used to index */
-
-#define INDEX_REG_CLASS GENERAL_REGS
-
-/* 'a' as a constraint in the md file means the FFP_REG class */
-
-#define REG_CLASS_FROM_LETTER(C) (C == 'a' ? FPP_REG : NO_REGS)
-
-/* any general reg but the fpp can be a base reg */
-
-#define REGNO_OK_FOR_BASE_P(regno) \
-((regno) < FIRST_PSEUDO_REGISTER - 1 || reg_renumber[regno] >= 0)
-
-/* any general reg except the pc and fpp can be an index reg */
-
-#define REGNO_OK_FOR_INDEX_P(regno) \
-((regno) < FIRST_PSEUDO_REGISTER - 2 || reg_renumber[regno] >= 0)
-
-/* if your loading a floating point constant, it can't be done */
-/* through a register. Force it to be a memory constant. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) \
- ((GET_CODE (X) == CONST_DOUBLE) ? NO_REGS : CLASS)
-
-/* for the fpp reg, all modes fit; for any others, you need two for doubles */
-
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- (CLASS != FPP_REG ? ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) : 1)
-
-/* we don't define any special constant sizes so all should fail */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) 0
-
-/* we don't define any special double sizes so all should fail */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
-
-
-/*
- * Describing Stack Layout
- */
-
-/* tahoe stack grows from high to low memory */
-
-#define STACK_GROWS_DOWNWARD
-
-/* Define this if longjmp restores from saved registers
- rather than from what setjmp saved. */
-#define LONGJMP_RESTORE_FROM_STACK
-
-/* tahoe call frames grow from high to low memory on the stack */
-
-#define FRAME_GROWS_DOWNWARD
-
-/* the tahoe fp points to the *top* of the frame instead of the */
-/* bottom, so we have to make this offset a constant large enough */
-/* to jump over the biggest frame possible. */
-
-#define STARTING_FRAME_OFFSET -52
-
-/* tahoe always pushes 4 bytes unless it's a double in which case */
-/* it pushes a full 8 bytes. */
-
-#define PUSH_ROUNDING(BYTES) (BYTES <= 4 ? 4 : 8)
-
-/* the first parameter in a function is at the fp + 4 */
-
-#define FIRST_PARM_OFFSET(FNDECL) 4
-
-/* the tahoe return function takes care of everything on the stack */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (SIZE)
-
-/* function values for all types are returned in register 0 */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
-
-/* library routines also return things in reg 0 */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
-
-/* Tahoe doesn't return structures in a reentrant way */
-
-#define PCC_STATIC_STRUCT_RETURN
-
-/* we only return values from a function in reg 0 */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* we never pass args through a register */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
-
-/* int is fine to hold the argument summary in FUNCTION_ARG */
-
-#define CUMULATIVE_ARGS int
-
-/* we just set CUM to 0 before the FUNCTION_ARG call. No matter what */
-/* we make it, FUNCTION_ARG will return 0 anyway */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = 0)
-
-/* all modes push their size rounded to the nearest word boundary */
-/* except block which is the size of the block rounded up */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* this is always false since we never pass params in regs */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* this code calculates the register entry mask and sets up */
-/* the stack pointer for the function. The stack is set down */
-/* far enough from the fp to jump over any push regs and local */
-/* vars. This is a problem since the tahoe has the fp pointing */
-/* to the top of the frame and the compiler must know the off- */
-/* set off the fp to the local vars. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int regno; \
- register int mask = 0; \
- extern char call_used_regs[]; \
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER-1; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- mask |= 1 << regno; \
- fprintf (FILE, "\t.word 0x%x\n", mask); \
- if (SIZE != 0) fprintf (FILE, "\tsubl3 $%d,fp,sp\n", (SIZE) - STARTING_FRAME_OFFSET); }
-
-/* Zero out global variable in case it was used in this function. */
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ extern rtx tahoe_reg_conversion_loc; \
- tahoe_reg_conversion_loc = 0; \
-}
-
-#ifdef HCX_UX
-
-/* to call the profiler, the address of the counter var is placed */
-/* on the stack and then passed into mcount this way */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tpushal LP%d\n\tcallf $8,mcount\n", (LABELNO));
-
-#else
-
-/* to call the profiler, push the variable value onto the stack */
-/* and call mcount like a regular function. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tpushl $LP%d\n\tcallf $8,mcount\n", (LABELNO));
-
-#endif
-
-/* all stack handling at the end of a function is handled by the */
-/* return command. */
-
-#define EXIT_IGNORE_STACK 1
-
-/*
- * Library Subroutine Names
- */
-
-/* udiv is a valid C library routine in libc.a, so we call that */
-
-#define UDIVSI3_LIBCALL "*udiv"
-
-/* urem is a valid C library routine in libc.a, so we call that */
-/* but not so on hcx/ux */
-
-#ifdef HCX_UX
-#undef UMODSI3_LIBCALL
-#else
-#define UMODSI3_LIBCALL "*urem"
-#endif
-
-
-/*
- * Addressing Modes
- */
-
-/* constant addresses can be treated exactly the same as normal constants */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* we can have as many as two regs in any given address */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* The following is all the code for GO_IF_LEGITIMATE_ADDRESS */
-/* most of this taken directly from the vax tm file since the */
-/* tahoe and vax addressing modes are nearly identical. */
-
-/* Is x an indirectable address? */
-
-#define INDIRECTABLE_ADDRESS_P(X) \
- (CONSTANT_ADDRESS_P (X) \
- || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (X, 1))))
-
-/* If x is a non-indexed-address, go to ADDR. */
-
-#define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
-{ register rtx xfoob = (X); \
- if (GET_CODE (xfoob) == REG) goto ADDR; \
- if (INDIRECTABLE_ADDRESS_P (xfoob)) goto ADDR; \
- xfoob = XEXP (X, 0); \
- if (GET_CODE (X) == MEM && INDIRECTABLE_ADDRESS_P (xfoob)) \
- goto ADDR; \
- if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
- && GET_CODE (xfoob) == REG && REGNO (xfoob) == 14) \
- goto ADDR; }
-
-/* Is PROD an index term in mode MODE. */
-
-#define INDEX_TERM_P(PROD, MODE) \
-(GET_MODE_SIZE (MODE) == 1 \
- ? (GET_CODE (PROD) == REG && REG_OK_FOR_BASE_P (PROD)) \
- : (GET_CODE (PROD) == MULT \
- && \
- (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
- ((GET_CODE (xfoo0) == CONST_INT \
- && INTVAL (xfoo0) == GET_MODE_SIZE (MODE) \
- && GET_CODE (xfoo1) == REG \
- && REG_OK_FOR_INDEX_P (xfoo1)) \
- || \
- (GET_CODE (xfoo1) == CONST_INT \
- && INTVAL (xfoo1) == GET_MODE_SIZE (MODE) \
- && GET_CODE (xfoo0) == REG \
- && REG_OK_FOR_INDEX_P (xfoo0))))))
-
-/* Is the addition to the index a reg? */
-
-#define GO_IF_REG_PLUS_INDEX(X, MODE, ADDR) \
-{ register rtx xfooa; \
- if (GET_CODE (X) == PLUS) \
- { if (GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && (xfooa = XEXP (X, 1), \
- INDEX_TERM_P (xfooa, MODE))) \
- goto ADDR; \
- if (GET_CODE (XEXP (X, 1)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 1)) \
- && (xfooa = XEXP (X, 0), \
- INDEX_TERM_P (xfooa, MODE))) \
- goto ADDR; } }
-
-/* Is the rtx X a valid memory address for operand of mode MODE? */
-/* If it is, go to ADDR */
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ register rtx xfoo, xfoo0, xfoo1; \
- GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
- if (GET_CODE (X) == PLUS) \
- { xfoo = XEXP (X, 0); \
- if (INDEX_TERM_P (xfoo, MODE)) \
- { GO_IF_NONINDEXED_ADDRESS (XEXP (X, 1), ADDR); } \
- xfoo = XEXP (X, 1); \
- if (INDEX_TERM_P (xfoo, MODE)) \
- { GO_IF_NONINDEXED_ADDRESS (XEXP (X, 0), ADDR); } \
- if (CONSTANT_ADDRESS_P (XEXP (X, 0))) \
- { if (GET_CODE (XEXP (X, 1)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
- goto ADDR; \
- GO_IF_REG_PLUS_INDEX (XEXP (X, 1), MODE, ADDR); } \
- if (CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- { if (GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
- goto ADDR; \
- GO_IF_REG_PLUS_INDEX (XEXP (X, 0), MODE, ADDR); } } }
-
-/* Register 16 can never be used for index or base */
-
-#ifndef REG_OK_STRICT
-#define REG_OK_FOR_INDEX_P(X) (REGNO(X) != 16)
-#define REG_OK_FOR_BASE_P(X) (REGNO(X) != 16)
-#else
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-#endif
-
-/* Addressing is too simple to allow optimizing here */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Post_inc and pre_dec always adds 4 */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- { if (GET_CODE(ADDR) == POST_INC || GET_CODE(ADDR) == PRE_DEC) \
- goto LABEL; \
- if (GET_CODE (ADDR) == PLUS) \
- { if (CONSTANT_ADDRESS_P (XEXP (ADDR, 0)) \
- && GET_CODE (XEXP (ADDR, 1)) == REG); \
- else if (CONSTANT_ADDRESS_P (XEXP (ADDR, 1)) \
- && GET_CODE (XEXP (ADDR, 0)) == REG); \
- else goto LABEL; }}
-
-/* Double's are not legitimate as immediate operands */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- (GET_CODE (X) != CONST_DOUBLE)
-
-
-/*
- * Miscellaneous Parameters
- */
-
-/* the elements in the case jump table are all words */
-
-#define CASE_VECTOR_MODE HImode
-
-/* each of the table elements in a case are relative to the jump address */
-
-#define CASE_VECTOR_PC_RELATIVE
-
-/* tahoe case instructions just fall through to the next instruction */
-/* if not satisfied. It doesn't support a default action */
-
-#define CASE_DROPS_THROUGH
-
-/* the standard answer is given here and work ok */
-
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* in a general div case, it's easiest to use TRUNC_DIV_EXPR */
-
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* the standard seems to be leaving char's as signed so we left it */
-/* this way even though we think they should be unsigned! */
-
-#define DEFAULT_SIGNED_CHAR 1
-
-/* the most we can move without cutting down speed is 4 bytes */
-
-#define MOVE_MAX 4
-
-/* our int is 32 bits */
-
-#define INT_TYPE_SIZE 32
-
-/* byte access isn't really slower than anything else */
-
-#define SLOW_BYTE_ACCESS 0
-
-/* zero extension is more than one instruction so try to avoid it */
-
-#define SLOW_ZERO_EXTEND
-
-/* any bits higher than the low 4 are ignored in the shift count */
-/* so don't bother zero extending or sign extending them */
-
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* we don't need to officially convert from one fixed type to another */
-/* in order to use it as that type. We can just assume it's the same */
-
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* pass chars as ints */
-
-#define PROMOTE_PROTOTYPES
-
-/* pointers can be represented by an si mode expression */
-
-#define Pmode SImode
-
-/* function addresses are made by specifying a byte address */
-
-#define FUNCTION_MODE QImode
-
-/* Define this if addresses of constant functions
- shouldn't be put through pseudo regs where they can be cse'd.
- On the tahoe a call with a constant address is much faster than one with a
- register. */
-
-#define NO_FUNCTION_CSE
-
-/* specify the costs of various sorts of constants,
- and also indicate that multiplication is cheap on this machine. */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- /* Constant zero is super cheap due to clr instruction. */ \
- if (RTX == const0_rtx) return 0; \
- if ((unsigned) INTVAL (RTX) < 077) return 1; \
- if (INTVAL (RTX) <= 127 && INTVAL (RTX) >= -128) return 2; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 3; \
- case CONST_DOUBLE: \
- return 5; \
- case MULT: \
- total = 2;
-
-
-/*
- * Condition Code Information
- */
-
-/* Nonzero if the results of the previous comparison are
- in the floating point condition code register. */
-
-#define CC_UNCHANGED 04000
-
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ if (cc_status.flags & CC_UNCHANGED) \
- /* Happens for cvtld and a few other insns. */ \
- cc_status.flags &= ~CC_UNCHANGED; \
- else if (GET_CODE (EXP) == SET) \
- { if (GET_CODE (SET_SRC (EXP)) == CALL) \
- CC_STATUS_INIT; \
- else if (GET_CODE (SET_DEST (EXP)) != PC) \
- { cc_status.flags = 0; \
- cc_status.value1 = SET_DEST (EXP); \
- cc_status.value2 = SET_SRC (EXP); } } \
- else if (GET_CODE (EXP) == PARALLEL \
- && GET_CODE (XVECEXP (EXP, 0, 0)) == SET \
- && GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) != PC) \
- { cc_status.flags = 0; \
- cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
- cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); } \
- /* PARALLELs whose first element sets the PC are aob, sob insns. \
- They do change the cc's. So drop through and forget the cc's. */ \
- else CC_STATUS_INIT; \
- if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
- && cc_status.value2 \
- && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
- cc_status.value2 = 0; \
- if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM \
- && cc_status.value2 \
- && GET_CODE (cc_status.value2) == MEM) \
- cc_status.value2 = 0; }
-/* Actual condition, one line up, should be that value2's address
- depends on value1, but that is too much of a pain. */
-
-
-/*
- * Output of Assembler Code
- */
-
-/* print which tahoe version compiled this code and print a directive */
-/* to the gnu assembler to say that the following is normal assembly */
-
-#ifdef HCX_UX
-#define ASM_FILE_START(FILE) \
-{ fprintf (FILE, "#gcc hcx 1.0\n\n"); \
- output_file_directive ((FILE), main_input_filename);} while (0)
-#else
-#define ASM_FILE_START(FILE) fprintf (FILE, "#gcc tahoe 1.0\n#NO_APP\n");
-#endif
-
-/* the instruction that turns on the APP for the gnu assembler */
-
-#define ASM_APP_ON "#APP\n"
-
-/* the instruction that turns off the APP for the gnu assembler */
-
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* what to output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* what to output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* this is what we call each of the regs. notice that the FPP reg is */
-/* called "ac". This should never get used due to the way we've set */
-/* up FPP instructions in the md file. But we call it "ac" here to */
-/* fill the list. */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
- "r9", "r10", "r11", "r12", "fp", "sp", "pc", "ac"}
-
-#ifdef HCX_UX
-/* allow generation of sdb info in the assembly */
-#define SDB_DEBUGGING_INFO
-#else
-/* allow generation of dbx info in the assembly */
-
-#define DBX_DEBUGGING_INFO
-
-/* our dbx doesn't support this */
-
-#define DBX_NO_XREFS
-
-/* we don't want symbols broken up */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* this'll really never be used, but we'll leave it at this */
-
-#define DBX_CONTIN_CHAR '?'
-
-#endif /* HCX_UX */
-
-/* registers are called the same thing in dbx anything else */
-/* This is necessary even if we generate SDB output */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* labels are the label followed by a colon and a newline */
-/* must be a statement, so surround it in a null loop */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* use the .globl directive to make labels global for the linker */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* use the standard format for printing internal labels */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* a * is used for label indirection in unix assembly */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* outputting a double is easy cause we only have one kind */
-
-#ifdef HCX_UX
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.double 0d%.20e\n", (VALUE))
-#else
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-{ \
- union { int i[2]; double d;} temp; \
- temp.d = (VALUE); \
- if (TARGET_HEX_FLOAT) \
- fprintf ((FILE), "\t.long 0x%x,0x%x # %.20e\n", \
- temp.i[0], temp.i[1], temp.d); \
- else \
- fprintf (FILE, "\t.dfloat 0d%.20e\n", temp.d); \
-}
-#endif
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#ifdef HCX_UX
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- fprintf (FILE, "\t.float 0f%.20e\n", (VALUE))
-#else
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-{ \
- union { int i; float f;} temp; \
- temp.f = (float) (VALUE); \
- if (TARGET_HEX_FLOAT) \
- fprintf ((FILE), "\t.long 0x%x # %.20e\n", \
- temp.i, temp.f); \
- else \
- fprintf (FILE, "\t.float 0f%.20e\n", temp.f); \
-}
-#endif
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#ifdef HCX_UX
-/* This is how to output an assembler line for an ASCII string. */
-
-#define ASM_OUTPUT_ASCII(FILE, p, size) \
-do { register int i; \
- fprintf ((FILE), "\t.ascii \""); \
- for (i = 0; i < (size); i++) \
- { \
- register int c = (p)[i]; \
- if (c == '\'' || c == '\\') \
- putc ('\\', (FILE)); \
- if (c >= ' ' && c < 0177 && c != '\"') \
- putc (c, (FILE)); \
- else \
- { \
- fprintf ((FILE), "\\%03o", c); \
- } \
- } \
- fprintf ((FILE), "\"\n"); } while (0)
-#endif
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* this is the insn to push a register onto the stack */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tpushl %s\n", reg_names[REGNO])
-
-/* this is the insn to pop a register from the stack */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmovl (sp)+,%s\n", reg_names[REGNO])
-
-/* this is required even thought tahoe doesn't support it */
-/* cause the C code expects it to be defined */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.long L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#ifdef HCX_UX
-#define CASE_ALIGNMENT 2
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
-#else
-#define CASE_ALIGNMENT 1
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- LOG ? fprintf (FILE, "\t.align %d\n", (LOG)) : 0
-#endif
-
-/* This is how to skip over some space */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %u\n", (SIZE))
-
-/* This defines common variables across files */
-
-#ifdef HCX_UX
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE)))
-#else
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-#endif
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#ifdef HCX_UX
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.bss ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u,4\n", (SIZE),(ROUNDED)))
-#else
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-#endif
-
-/* code to generate a label */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print an instruction operand X on file FILE.
- CODE is the code from the %-spec that requested printing this operand;
- if `%z3' was used to print operand 3, then CODE is 'z'.
- On the Vax, the only code used is `#', indicating that either
- `d' or `g' should be printed, depending on whether we're using dfloat
- or gfloat. */
-/* Print an operand. Some difference from the vax code,
- since the tahoe can't support immediate floats and doubles.
-
- %@ means print the proper alignment operand for aligning after a casesi.
- This depends on the assembler syntax.
- This is 1 for our assembler, since .align is logarithmic.
-
- %s means the number given is supposed to be a shift value, but on
- the tahoe it should be converted to a number that can be used as a
- multiplicative constant (cause multiplication is a whole lot faster
- than shifting). So make the number 2^n instead. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '@')
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ if (CODE == '@') \
- putc ('0' + CASE_ALIGNMENT, FILE); \
- else if (CODE == 's') \
- fprintf (FILE, "$%d", 1 << INTVAL(X)); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else { putc ('$', FILE); output_addr_const (FILE, X); }}
-
-/* When the operand is an address, call print_operand_address to */
-/* do the work from output-tahoe.c. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address (FILE, ADDR)
-
-/* This is for G++ */
-
-#define CRT0_DUMMIES
-#define DOT_GLOBAL_START
-#ifdef HCX_UX
-#define NO_GNU_LD /* because of COFF format */
-#define LINK_SPEC "-L/usr/staff/lib"
-#endif
diff --git a/gcc/config/tahoe/tahoe.md b/gcc/config/tahoe/tahoe.md
deleted file mode 100644
index 101d69f6822..00000000000
--- a/gcc/config/tahoe/tahoe.md
+++ /dev/null
@@ -1,2113 +0,0 @@
-;; Machine description for GNU compiler, Tahoe version
-;; Copyright (C) 1989, 1994, 1996 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.
-
-
-; File: tahoe.md
-;
-; Original port made at the University of Buffalo by Devon Bowen,
-; Dale Wiles and Kevin Zachmann.
-;
-; Piet van Oostrum (piet@cs.ruu.nl) made changes for HCX/UX, fixed
-; some bugs and made some improvements (hopefully).
-;
-; Mail bugs reports or fixes to: gcc@cs.buffalo.edu
-
-
-; movdi must call the output_move_double routine to move it around since
-; the tahoe doesn't efficiently support 8 bit moves.
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=g")
- (match_operand:DI 1 "general_operand" "g"))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return output_move_double (operands);
-}")
-
-
-; the trick in the movsi is accessing the contents of the sp register. The
-; tahoe doesn't allow you to access it directly so you have to access the
-; address of the top of the stack instead.
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:SI 1 "general_operand" "g"))]
- ""
- "*
-{
- rtx link;
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- return \"incl %0\";
- if (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
- {
- if (push_operand (operands[0], SImode))
- return \"pushab %a1\";
- return \"movab %a1,%0\";
- }
- if (operands[1] == const0_rtx)
- return \"clrl %0\";
- if (push_operand (operands[0], SImode))
- return \"pushl %1\";
- if (GET_CODE(operands[1]) == REG && REGNO(operands[1]) == 14)
- return \"moval (sp),%0\";
- return \"movl %1,%0\";
-}")
-
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (match_operand:HI 1 "general_operand" "g"))]
- ""
- "*
-{
- rtx link;
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- return \"incw %0\";
- if (operands[1] == const0_rtx)
- return \"clrw %0\";
- return \"movw %1,%0\";
-}")
-
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (match_operand:QI 1 "general_operand" "g"))]
- ""
- "*
-{
- if (operands[1] == const0_rtx)
- return \"clrb %0\";
- return \"movb %1,%0\";
-}")
-
-
-; movsf has three cases since they can move from one place to another
-; or to/from the fpp and since different instructions are needed for
-; each case. The fpp related instructions don't set the flags properly.
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=g,=a,=g")
- (match_operand:SF 1 "general_operand" "g,g,a"))]
- ""
- "*
-{
- CC_STATUS_INIT;
- switch (which_alternative)
- {
- case 0: return \"movl %1,%0\";
- case 1: return \"ldf %1\";
- case 2: return \"stf %0\";
- }
-}")
-
-
-; movdf has a number of different cases. If it's going to or from
-; the fpp, use the special instructions to do it. If not, use the
-; output_move_double function.
-
-(define_insn "movdf"
- [(set (match_operand:DF 0 "general_operand" "=a,=g,?=g")
- (match_operand:DF 1 "general_operand" "g,a,g"))]
- ""
- "*
-{
- CC_STATUS_INIT;
- switch (which_alternative)
- {
- case 0:
- return \"ldd %1\";
- case 1:
- if (push_operand (operands[0], DFmode))
- return \"pushd\";
- else
- return \"std %0\";
- case 2:
- return output_move_double (operands);
- }
-}")
-
-
-;========================================================================
-; The tahoe has the following semantics for byte (and similar for word)
-; operands: if the operand is a register or immediate, it takes the full 32
-; bit operand, if the operand is memory, it sign-extends the byte. The
-; operation is performed on the 32 bit values. If the destination is a
-; register, the full 32 bit result is stored, if the destination is memory,
-; of course only the low part is stored. The condition code is based on the
-; 32 bit operation. Only on the movz instructions the byte from memory is
-; zero-extended rather than sign-extended.
-
-; This means that for arithmetic instructions we can use addb etc. to
-; perform a long add from a signed byte from memory to a register. Of
-; course this would also work for logical operations, but that doesn't seem
-; very useful.
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (sign_extend:SI (match_operand:QI 1 "memory_operand" "m"))
- (sign_extend:SI (match_operand:QI 2 "memory_operand" "m"))))]
- ""
- "addb3 %1,%2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_operand:SI 1 "nonmemory_operand" "%ri")
- (sign_extend:SI (match_operand:QI 2 "memory_operand" "m"))))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"addb2 %2,%0\";
- return \"addb3 %1,%2,%0\";
-}")
-
-; We can also consider the result to be a half integer
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (plus:HI (sign_extend:HI (match_operand:QI 1 "memory_operand" "m"))
- (sign_extend:HI (match_operand:QI 2 "memory_operand" "m"))))]
- ""
- "addb3 %1,%2,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (plus:HI (match_operand:HI 1 "nonmemory_operand" "%ri")
- (sign_extend:HI (match_operand:QI 2 "memory_operand" "m"))))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"addb2 %2,%0\";
- return \"addb3 %1,%2,%0\";
-}")
-
-; The same applies to words (HI)
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (sign_extend:SI (match_operand:HI 1 "memory_operand" "m"))
- (sign_extend:SI (match_operand:HI 2 "memory_operand" "m"))))]
- ""
- "addw3 %1,%2,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (plus:SI (match_operand:SI 1 "nonmemory_operand" "%ri")
- (sign_extend:SI (match_operand:HI 2 "memory_operand" "m"))))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"addw2 %2,%0\";
- return \"addw3 %1,%2,%0\";
-}")
-
-; ======================= Now for subtract ==============================
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (sign_extend:SI (match_operand:QI 1 "memory_operand" "m"))
- (sign_extend:SI (match_operand:QI 2 "memory_operand" "m"))))]
- ""
- "subb3 %2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "nonmemory_operand" "ri")
- (sign_extend:SI (match_operand:QI 2 "memory_operand" "m"))))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"subb2 %2,%0\";
- return \"subb3 %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (sign_extend:SI (match_operand:QI 1 "memory_operand" "m"))
- (match_operand:SI 2 "nonmemory_operand" "ri")))]
- ""
- "subb3 %2,%1,%0")
-
-; We can also consider the result to be a half integer
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (minus:HI (sign_extend:HI (match_operand:QI 1 "memory_operand" "m"))
- (sign_extend:HI (match_operand:QI 2 "memory_operand" "m"))))]
- ""
- "subb3 %2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (minus:HI (match_operand:HI 1 "nonmemory_operand" "%ri")
- (sign_extend:HI (match_operand:QI 2 "memory_operand" "m"))))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"subb2 %2,%0\";
- return \"subb3 %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (minus:HI (sign_extend:HI (match_operand:QI 1 "memory_operand" "m"))
- (match_operand:HI 2 "nonmemory_operand" "ri")))]
- ""
- "subb3 %2,%1,%0")
-
-; The same applies to words (HI)
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (sign_extend:SI (match_operand:HI 1 "memory_operand" "m"))
- (sign_extend:SI (match_operand:HI 2 "memory_operand" "m"))))]
- ""
- "subw3 %2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (match_operand:SI 1 "nonmemory_operand" "ri")
- (sign_extend:SI (match_operand:HI 2 "memory_operand" "m"))))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"subw2 %2,%0\";
- return \"subw3 %2,%1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (minus:SI (sign_extend:SI (match_operand:HI 1 "memory_operand" "m"))
- (match_operand:SI 2 "nonmemory_operand" "ri")))]
- ""
- "subw3 %2,%1,%0")
-
-; ======================= Now for neg ==============================
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (sign_extend:SI (match_operand:QI 1 "memory_operand" "m"))))]
- ""
- "mnegb %1,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "register_operand" "=r")
- (neg:HI (sign_extend:HI (match_operand:QI 1 "memory_operand" "m"))))]
- ""
- "mnegb %1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "register_operand" "=r")
- (neg:SI (sign_extend:SI (match_operand:HI 1 "memory_operand" "m"))))]
- ""
- "mnegw %1,%0")
-
-;========================================================================
-
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (plus:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (operands[2] == const1_rtx)
- return \"incl %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) == -1)
- return \"decl %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subl2 $%n2,%0\";
- return \"addl2 %2,%0\";
- }
- if (rtx_equal_p (operands[0], operands[2]))
- return \"addl2 %1,%0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && GET_CODE (operands[1]) == REG)
- {
- if (push_operand (operands[0], SImode))
- return \"pushab %c2(%1)\";
- return \"movab %c2(%1),%0\";
- }
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subl3 $%n2,%1,%0\";
- return \"addl3 %1,%2,%0\";
-}")
-
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (plus:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (operands[2] == const1_rtx)
- return \"incw %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) == -1)
- return \"decw %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subw2 $%n2,%0\";
- return \"addw2 %2,%0\";
- }
- if (rtx_equal_p (operands[0], operands[2]))
- return \"addw2 %1,%0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subw3 $%n2,%1,%0\";
- return \"addw3 %1,%2,%0\";
-}")
-
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (plus:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (operands[2] == const1_rtx)
- return \"incb %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) == -1)
- return \"decb %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subb2 $%n2,%0\";
- return \"addb2 %2,%0\";
- }
- if (rtx_equal_p (operands[0], operands[2]))
- return \"addb2 %1,%0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subb3 $%n2,%1,%0\";
- return \"addb3 %1,%2,%0\";
-}")
-
-; addsf3 can only add into the fpp register since the fpp is treated
-; as a separate unit in the machine. It also doesn't set the flags at
-; all.
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "register_operand" "=a")
- (plus:SF (match_operand:SF 1 "register_operand" "%0")
- (match_operand:SF 2 "general_operand" "g")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"addf %2\";
-}")
-
-
-; adddf3 can only add into the fpp reg since the fpp is treated as a
-; separate entity. Doubles can only be read from a register or memory
-; since a double is not an immediate mode. Flags are not set by this
-; instruction.
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "register_operand" "=a")
- (plus:DF (match_operand:DF 1 "register_operand" "%0")
- (match_operand:DF 2 "general_operand" "rm")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"addd %2\";
-}")
-
-
-; Subtraction from the sp (needed by the built in alloc function) needs
-; to be different since the sp cannot be directly read on the tahoe.
-; If it's a simple constant, you just use displacement. Otherwise, you
-; push the sp, and then do the subtraction off the stack.
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (minus:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (operands[2] == const1_rtx)
- return \"decl %0\";
- if (GET_CODE(operands[0]) == REG && REGNO(operands[0]) == 14)
- {
- if (GET_CODE(operands[2]) == CONST_INT)
- return \"movab %n2(sp),sp\";
- else
- return \"pushab (sp)\;subl3 %2,(sp),sp\";
- }
- return \"subl2 %2,%0\";
- }
- if (rtx_equal_p (operands[1], operands[2]))
- return \"clrl %0\";
- return \"subl3 %2,%1,%0\";
-}")
-
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (minus:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (operands[2] == const1_rtx)
- return \"decw %0\";
- return \"subw2 %2,%0\";
- }
- if (rtx_equal_p (operands[1], operands[2]))
- return \"clrw %0\";
- return \"subw3 %2,%1,%0\";
-}")
-
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (minus:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (operands[2] == const1_rtx)
- return \"decb %0\";
- return \"subb2 %2,%0\";
- }
- if (rtx_equal_p (operands[1], operands[2]))
- return \"clrb %0\";
- return \"subb3 %2,%1,%0\";
-}")
-
-
-; subsf3 can only subtract into the fpp accumulator due to the way
-; the fpp reg is limited by the instruction set. This also doesn't
-; bother setting up flags.
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "register_operand" "=a")
- (minus:SF (match_operand:SF 1 "register_operand" "0")
- (match_operand:SF 2 "general_operand" "g")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"subf %2\";
-}")
-
-
-; subdf3 is set up to subtract into the fpp reg due to limitations
-; of the fpp instruction set. Doubles can not be immediate. This
-; instruction does not set the flags.
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "register_operand" "=a")
- (minus:DF (match_operand:DF 1 "register_operand" "0")
- (match_operand:DF 2 "general_operand" "rm")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"subd %2\";
-}")
-
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (mult:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"mull2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"mull2 %1,%0\";
- return \"mull3 %1,%2,%0\";
-}")
-
-
-; mulsf3 can only multiply into the fpp accumulator due to limitations
-; of the fpp. It also does not set the condition codes properly.
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "register_operand" "=a")
- (mult:SF (match_operand:SF 1 "register_operand" "%0")
- (match_operand:SF 2 "general_operand" "g")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"mulf %2\";
-}")
-
-
-; muldf3 can only multiply into the fpp reg since the fpp is limited
-; from the rest. Doubles may not be immediate mode. This does not set
-; the flags like gcc would expect.
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "register_operand" "=a")
- (mult:DF (match_operand:DF 1 "register_operand" "%0")
- (match_operand:DF 2 "general_operand" "rm")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"muld %2\";
-}")
-
-
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (div:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[1], operands[2]))
- return \"movl $1,%0\";
- if (operands[1] == const0_rtx)
- return \"clrl %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) == -1)
- return \"mnegl %1,%0\";
- if (rtx_equal_p (operands[0], operands[1]))
- return \"divl2 %2,%0\";
- return \"divl3 %2,%1,%0\";
-}")
-
-
-; divsf3 must divide into the fpp accumulator. Flags are not set by
-; this instruction, so they are cleared.
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "register_operand" "=a")
- (div:SF (match_operand:SF 1 "register_operand" "0")
- (match_operand:SF 2 "general_operand" "g")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"divf %2\";
-}")
-
-
-; divdf3 also must divide into the fpp reg so optimization isn't
-; possible. Note that doubles cannot be immediate. The flags here
-; are not set correctly so they must be ignored.
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "register_operand" "=a")
- (div:DF (match_operand:DF 1 "register_operand" "0")
- (match_operand:DF 2 "general_operand" "rm")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"divd %2\";
-}")
-
-
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (and:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"andl2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"andl2 %1,%0\";
- return \"andl3 %2,%1,%0\";
-}")
-
-
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (and:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"andw2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"andw2 %1,%0\";
- return \"andw3 %2,%1,%0\";
-}")
-
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (and:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"andb2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"andb2 %1,%0\";
- return \"andb3 %2,%1,%0\";
-}")
-
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ior:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"orl2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"orl2 %1,%0\";
- return \"orl3 %2,%1,%0\";
-}")
-
-
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (ior:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"orw2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"orw2 %1,%0\";
- return \"orw3 %2,%1,%0\";
-}")
-
-
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (ior:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"orb2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"orb2 %1,%0\";
- return \"orb3 %2,%1,%0\";
-}")
-
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (xor:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"xorl2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"xorl2 %1,%0\";
- return \"xorl3 %2,%1,%0\";
-}")
-
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (xor:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"xorw2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"xorw2 %1,%0\";
- return \"xorw3 %2,%1,%0\";
-}")
-
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (xor:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- return \"xorb2 %2,%0\";
- if (rtx_equal_p (operands[0], operands[2]))
- return \"xorb2 %1,%0\";
- return \"xorb3 %2,%1,%0\";
-}")
-
-
-; shifts on the tahoe are expensive, try some magic first...
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ashift:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE(operands[2]) == REG)
- return \"mull3 ___shtab[%2],%1,%0\";
- /* if (GET_CODE(operands[2]) == REG)
- if (rtx_equal_p (operands[0], operands[1]))
- return \"mull2 ___shtab[%2],%1\";
- else
- return \"mull3 ___shtab[%2],%1,%0\"; */
- if (GET_CODE(operands[1]) == REG)
- {
- if (operands[2] == const1_rtx)
- {
- CC_STATUS_INIT;
- return \"movaw 0[%1],%0\";
- }
- if (GET_CODE(operands[2]) == CONST_INT && INTVAL(operands[2]) == 2)
- {
- CC_STATUS_INIT;
- return \"moval 0[%1],%0\";
- }
- }
- if (GET_CODE(operands[2]) != CONST_INT || INTVAL(operands[2]) == 1)
- return \"shal %2,%1,%0\";
- if (rtx_equal_p (operands[0], operands[1]))
- return \"mull2 %s2,%1\";
- else
- return \"mull3 %s2,%1,%0\";
-}")
-
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "shar %2,%1,%0")
-
-
-; shifts are very expensive, try some magic first...
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "shrl %2,%1,%0")
-
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (neg:SI (match_operand:SI 1 "general_operand" "g")))]
- ""
- "mnegl %1,%0")
-
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (neg:HI (match_operand:HI 1 "general_operand" "g")))]
- ""
- "mnegw %1,%0")
-
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (neg:QI (match_operand:QI 1 "general_operand" "g")))]
- ""
- "mnegb %1,%0")
-
-
-; negsf2 can only negate the value already in the fpp accumulator.
-; The value remains in the fpp accumulator. No flags are set.
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "register_operand" "=a,=a")
- (neg:SF (match_operand:SF 1 "register_operand" "a,g")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- switch (which_alternative)
- {
- case 0: return \"negf\";
- case 1: return \"lnf %1\";
- }
-}")
-
-
-; negdf2 can only negate the value already in the fpp accumulator.
-; The value remains in the fpp accumulator. No flags are set.
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "register_operand" "=a,=a")
- (neg:DF (match_operand:DF 1 "register_operand" "a,g")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- switch (which_alternative)
- {
- case 0: return \"negd\";
- case 1: return \"lnd %1\";
- }
-}")
-
-
-; sqrtsf2 tahoe can calculate the square root of a float in the
-; fpp accumulator. The answer remains in the fpp accumulator. No
-; flags are set by this function.
-
-(define_insn "sqrtsf2"
- [(set (match_operand:SF 0 "register_operand" "=a")
- (sqrt:SF (match_operand:SF 1 "register_operand" "0")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"sqrtf\";
-}")
-
-
-; ffssi2 tahoe instruction gives one less than gcc desired result for
-; any given input. So the increment is necessary here.
-
-(define_insn "ffssi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ffs:SI (match_operand:SI 1 "general_operand" "g")))]
- ""
- "*
-{
- if (push_operand(operands[0], SImode))
- return \"ffs %1,%0\;incl (sp)\";
- return \"ffs %1,%0\;incl %0\";
-}")
-
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (not:SI (match_operand:SI 1 "general_operand" "g")))]
- ""
- "mcoml %1,%0")
-
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (not:HI (match_operand:HI 1 "general_operand" "g")))]
- ""
- "mcomw %1,%0")
-
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (not:QI (match_operand:QI 1 "general_operand" "g")))]
- ""
- "mcomb %1,%0")
-
-
-; cmpsi works fine, but due to microcode problems, the tahoe doesn't
-; properly compare hi's and qi's. Leaving them out seems to be acceptable
-; to the compiler, so they were left out. Compares of the stack are
-; possible, though.
-
-; There are optimized cases possible, however. These follow first.
-
-(define_insn ""
- [(set (cc0)
- (compare (sign_extend:SI (match_operand:HI 0 "memory_operand" "m"))
- (sign_extend:SI (match_operand:HI 1 "memory_operand" "m"))))]
- ""
- "cmpw %0,%1")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:SI 0 "nonmemory_operand" "ri")
- (sign_extend:SI (match_operand:HI 1 "memory_operand" "m"))))]
- ""
- "cmpw %0,%1")
-
-(define_insn ""
- [(set (cc0)
- (compare (sign_extend:SI (match_operand:HI 0 "memory_operand" "m"))
- (match_operand:SI 1 "nonmemory_operand" "ri")))]
- ""
- "cmpw %0,%1")
-
-; zero-extended compares give the same result as sign-extended compares, if
-; the compare is unsigned. Just see: if both operands are <65536 they are the
-; same in both cases. If both are >=65536 the you effectively compare x+D
-; with y+D, where D=2**32-2**16, so the result is the same. if x<65536 and
-; y>=65536 then you compare x with y+D, and in both cases the result is x<y.
-
-(define_insn ""
- [(set (cc0)
- (compare (zero_extend:SI (match_operand:HI 0 "memory_operand" "m"))
- (zero_extend:SI (match_operand:HI 1 "memory_operand" "m"))))]
- "tahoe_cmp_check (insn, operands[0], 0)"
- "cmpw %0,%1")
-
-(define_insn ""
- [(set (cc0)
- (compare (zero_extend:SI (match_operand:HI 0 "memory_operand" "m"))
- (match_operand:SI 1 "immediate_operand" "i")))]
- "tahoe_cmp_check(insn, operands[1], 65535)"
- "*
-{
- if (INTVAL (operands[1]) > 32767)
- operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) + 0xffff0000);
- return \"cmpw %0,%1\";
-}")
-
-
-(define_insn ""
- [(set (cc0)
- (compare (sign_extend:SI (match_operand:QI 0 "memory_operand" "m"))
- (sign_extend:SI (match_operand:QI 1 "memory_operand" "m"))))]
- ""
- "cmpb %0,%1")
-
-(define_insn ""
- [(set (cc0)
- (compare (match_operand:SI 0 "nonmemory_operand" "ri")
- (sign_extend:SI (match_operand:QI 1 "memory_operand" "m"))))]
- ""
- "cmpb %0,%1")
-
-(define_insn ""
- [(set (cc0)
- (compare (sign_extend:SI (match_operand:QI 0 "memory_operand" "m"))
- (match_operand:SI 1 "nonmemory_operand" "ri")))]
- ""
- "cmpb %0,%1")
-
-; zero-extended compares give the same result as sign-extended compares, if
-; the compare is unsigned. Just see: if both operands are <128 they are the
-; same in both cases. If both are >=128 the you effectively compare x+D
-; with y+D, where D=2**32-2**8, so the result is the same. if x<128 and
-; y>=128 then you compare x with y+D, and in both cases the result is x<y.
-
-(define_insn ""
- [(set (cc0)
- (compare (zero_extend:SI (match_operand:QI 0 "memory_operand" "m"))
- (zero_extend:SI (match_operand:QI 1 "memory_operand" "m"))))]
- "tahoe_cmp_check (insn, operands[0], 0)"
- "cmpb %0,%1")
-
-(define_insn ""
- [(set (cc0)
- (compare (zero_extend:SI (match_operand:QI 0 "memory_operand" "m"))
- (match_operand:SI 1 "immediate_operand" "i")))]
- "tahoe_cmp_check(insn, operands[1], 255)"
- "*
-{
- if (INTVAL (operands[1]) > 127)
- operands[1] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) + 0xffffff00);
- return \"cmpb %0,%1\";
-}")
-
-
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "g")
- (match_operand:SI 1 "general_operand" "g")))]
- ""
- "cmpl %0,%1")
-
-
-; cmpsf similar to vax, but first operand is expected to be in the
-; fpp accumulator.
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "general_operand" "a,g")
- (match_operand:SF 1 "general_operand" "g,g")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0: return \"cmpf %1\";
- case 1: return \"cmpf2 %0,%1\";
- }
-}")
-
-
-; cmpdf similar to vax, but first operand is expected to be in the
-; fpp accumulator. Immediate doubles not allowed.
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "general_operand" "a,rm")
- (match_operand:DF 1 "general_operand" "rm,rm")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0: return \"cmpd %1\";
- case 1: return \"cmpd2 %0,%1\";
- }
-}")
-
-;; We don't want to allow a constant operand for test insns because
-;; (set (cc0) (const_int foo)) has no mode information. Such insns will
-;; be folded while optimizing anyway.
-
-(define_insn "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" "g"))]
- ""
- "tstl %0")
-
-
-; small tests from memory are normal, but testing from registers doesn't
-; expand the data properly. So test in this case does a convert and tests
-; the new register data from the stack.
-
-; First some special cases that do work
-
-
-(define_insn ""
- [(set (cc0)
- (sign_extend:SI (match_operand:HI 0 "memory_operand" "m")))]
- ""
- "tstw %0")
-
-(define_insn ""
- [(set (cc0)
- (zero_extend:SI (match_operand:HI 0 "memory_operand" "m")))]
- "tahoe_cmp_check (insn, operands[0], 0)"
- "tstw %0")
-
-
-(define_insn "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "extendable_operand" "m,!r"))]
- "GET_MODE (operands[0]) != VOIDmode"
- "*
-{
- rtx xoperands[2];
- extern rtx tahoe_reg_conversion_loc;
- switch (which_alternative)
- {
- case 0:
- return \"tstw %0\";
- case 1:
- xoperands[0] = operands[0];
- xoperands[1] = tahoe_reg_conversion_loc;
- output_asm_insn (\"movl %0,%1\", xoperands);
- xoperands[1] = plus_constant (XEXP (tahoe_reg_conversion_loc, 0), 2);
- output_asm_insn (\"tstw %a1\", xoperands);
- return \"\";
- }
-}")
-
-
-(define_insn ""
- [(set (cc0)
- (sign_extend:SI (match_operand:QI 0 "memory_operand" "m")))]
- ""
- "tstb %0")
-
-(define_insn ""
- [(set (cc0)
- (zero_extend:SI (match_operand:QI 0 "memory_operand" "m")))]
- "tahoe_cmp_check (insn, operands[0], 0)"
- "tstb %0")
-
-
-(define_insn "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "extendable_operand" "m,!r"))]
- "GET_MODE (operands[0]) != VOIDmode"
- "*
-{
- rtx xoperands[2];
- extern rtx tahoe_reg_conversion_loc;
- switch (which_alternative)
- {
- case 0:
- return \"tstb %0\";
- case 1:
- xoperands[0] = operands[0];
- xoperands[1] = tahoe_reg_conversion_loc;
- output_asm_insn (\"movl %0,%1\", xoperands);
- xoperands[1] = plus_constant (XEXP (tahoe_reg_conversion_loc, 0), 3);
- output_asm_insn (\"tstb %a1\", xoperands);
- return \"\";
- }
-}")
-
-; tstsf compares a given value to a value already in the fpp accumulator.
-; No flags are set by this so ignore them.
-
-(define_insn "tstsf"
- [(set (cc0)
- (match_operand:SF 0 "register_operand" "a"))]
- ""
- "tstf")
-
-
-; tstdf compares a given value to a value already in the fpp accumulator.
-; immediate doubles not allowed. Flags are ignored after this.
-
-(define_insn "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "register_operand" "a"))]
- ""
- "tstd")
-
-
-
-; movstrhi tahoe instruction does not load registers by itself like
-; the vax counterpart does. registers 0-2 must be primed by hand.
-; we have loaded the registers in the order: dst, src, count.
-
-(define_insn "movstrhi"
- [(set (match_operand:BLK 0 "general_operand" "p")
- (match_operand:BLK 1 "general_operand" "p"))
- (use (match_operand:HI 2 "general_operand" "g"))
- (clobber (reg:SI 0))
- (clobber (reg:SI 1))
- (clobber (reg:SI 2))]
- ""
- "movab %0,r1\;movab %1,r0\;movl %2,r2\;movblk")
-
-
-; floatsisf2 on tahoe converts the long from reg/mem into the fpp
-; accumulator. There are no hi and qi counterparts. Flags are not
-; set correctly here.
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "register_operand" "=a")
- (float:SF (match_operand:SI 1 "general_operand" "g")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"cvlf %1\";
-}")
-
-
-; floatsidf2 on tahoe converts the long from reg/mem into the fpp
-; accumulator. There are no hi and qi counterparts. Flags are not
-; set correctly here.
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "register_operand" "=a")
- (float:DF (match_operand:SI 1 "general_operand" "g")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"cvld %1\";
-}")
-
-
-; fix_truncsfsi2 to convert a float to long, tahoe must have the float
-; in the fpp accumulator. Flags are not set here.
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "a"))))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"cvfl %0\";
-}")
-
-
-; fix_truncsfsi2 to convert a double to long, tahoe must have the double
-; in the fpp accumulator. Flags are not set here.
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "a"))))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"cvdl %0\";
-}")
-
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (truncate:HI (match_operand:SI 1 "general_operand" "g")))]
- ""
- "cvtlw %1,%0")
-
-
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (truncate:QI (match_operand:SI 1 "general_operand" "g")))]
- ""
- "cvtlb %1,%0")
-
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (truncate:QI (match_operand:HI 1 "general_operand" "g")))]
- ""
- "cvtwb %1,%0")
-
-
-; The fpp related instructions don't set flags, so ignore them
-; after this instruction.
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "register_operand" "=a")
- (float_truncate:SF (match_operand:DF 1 "register_operand" "0")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"cvdf\";
-}")
-
-
-; This monster is to cover for the Tahoe's nasty habit of not extending
-; a number if the source is in a register. (It just moves it!) Case 0 is
-; a normal extend from memory. Case 1 does the extension from the top of
-; the stack. Extension from the stack doesn't set the flags right since
-; the moval changes them.
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=g,?=g")
- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0:
- return \"cvtwl %1,%0\";
- case 1:
- if (push_operand (operands[0], SImode))
- return \"pushl %1\;cvtwl 2(sp),(sp)\";
- else
- {
- CC_STATUS_INIT;
- return \"pushl %1\;cvtwl 2(sp),%0\;moval 4(sp),sp\";
- }
- }
-}")
-
-; This monster is to cover for the Tahoe's nasty habit of not extending
-; a number if the source is in a register. (It just moves it!) Case 0 is
-; a normal extend from memory. Case 1 does the extension from the top of
-; the stack. Extension from the stack doesn't set the flags right since
-; the moval changes them.
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=g,?=g")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "m,r")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0:
- return \"cvtbl %1,%0\";
- case 1:
- if (push_operand (operands[0], SImode))
- return \"pushl %1\;cvtbl 3(sp),(sp)\";
- else
- {
- CC_STATUS_INIT;
- return \"pushl %1\;cvtbl 3(sp),%0\;moval 4(sp),sp\";
- }
- }
-}")
-
-
-; This monster is to cover for the Tahoe's nasty habit of not extending
-; a number if the source is in a register. (It just moves it!) Case 0 is
-; a normal extend from memory. Case 1 does the extension from the top of
-; the stack. Extension from the stack doesn't set the flags right since
-; the moval changes them.
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=g,?=g")
- (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m,r")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0:
- return \"cvtbw %1,%0\";
- case 1:
- if (push_operand (operands[0], SImode))
- return \"pushl %1\;cvtbw 3(sp),(sp)\";
- else
- {
- CC_STATUS_INIT;
- return \"pushl %1\;cvtbw 3(sp),%0\;moval 4(sp),sp\";
- }
- }
-}")
-
-
-; extendsfdf2 tahoe uses the fpp accumulator to do the extension.
-; It takes a float and loads it up directly as a double.
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "register_operand" "=a")
- (float_extend:DF (match_operand:SF 1 "general_operand" "g")))]
- ""
- "*
-{
- CC_STATUS_INIT;
- return \"ldfd %1\";
-}")
-
-
-; movz works fine from memory but not from register for the same reasons
-; the cvt instructions don't work right. So we use the normal instruction
-; from memory and we use an and to simulate it from register. This is faster
-; than pulling it off the stack.
-
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=g,?=g")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "m,r")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0: return \"movzwl %1,%0\";
- case 1: return \"andl3 $0xffff,%1,%0\";
- }
-}")
-
-; movz works fine from memory but not from register for the same reasons
-; the cvt instructions don't work right. So we use the normal instruction
-; from memory and we use an and to simulate it from register. This is faster
-; than pulling it off the stack.
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=g,?=g")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "m,r")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0: return \"movzbw %1,%0\";
- case 1: return \"andw3 $0xff,%1,%0\";
- }
-}")
-
-
-; movz works fine from memory but not from register for the same reasons
-; the cvt instructions don't work right. So we use the normal instruction
-; from memory and we use an and to simulate it from register. This is faster
-; than pulling it off the stack.
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=g,?=g")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "m,r")))]
- ""
- "*
-{
- switch (which_alternative)
- {
- case 0: return \"movzbl %1,%0\";
- case 1: return \"andl3 $0xff,%1,%0\";
- }
-}")
-
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jeql %l0")
-
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jneq %l0")
-
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgtr %l0")
-
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgtru %l0")
-
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jlss %l0")
-
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jlssu %l0")
-
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgeq %l0")
-
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgequ %l0")
-
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jleq %l0")
-
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jlequ %l0")
-
-
-; gcc does not account for register mask/argc longword. Thus the number
-; for the call = number bytes for args + 4
-
-(define_insn "call"
- [(call (match_operand:QI 0 "memory_operand" "m")
- (match_operand:QI 1 "general_operand" "g"))]
- ""
- "*
-{
- operands[1] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[1]) + 4));
- if (GET_CODE(operands[0]) == MEM
- && CONSTANT_ADDRESS_P (XEXP(operands[0], 0))
- && INTVAL (operands[1]) < 64)
- return \"callf %1,%0\"; /* this is much faster */
- return \"calls %1,%0\";
-}")
-
-; gcc does not account for register mask/argc longword. Thus the number
-; for the call = number bytes for args + 4
-
-(define_insn "call_value"
- [(set (match_operand 0 "" "=g")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[2]) + 4));
- if (GET_CODE(operands[1]) == MEM
- && CONSTANT_ADDRESS_P (XEXP(operands[1], 0))
- && INTVAL (operands[2]) < 64)
- return \"callf %2,%1\"; /* this is much faster */
- return \"calls %2,%1\";
-}")
-
-
-(define_insn "return"
- [(return)]
- ""
- "ret")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-; casesi this code extracted from the vax code. The instructions are
-; very similar. Tahoe requires that the table be word aligned. GCC
-; places the table immediately after, thus the alignment directive.
-
-(define_insn "casesi"
- [(set (pc)
- (if_then_else (le (minus:SI (match_operand:SI 0 "general_operand" "g")
- (match_operand:SI 1 "general_operand" "g"))
- (match_operand:SI 2 "general_operand" "g"))
- (plus:SI (sign_extend:SI
- (mem:HI (plus:SI (pc)
- (minus:SI (match_dup 0)
- (match_dup 1)))))
- (label_ref:SI (match_operand 3 "" "")))
- (pc)))]
- ""
- "casel %0,%1,%2\;.align %@")
-
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jbr %l0")
-
-
-;; This is the list of all the non-standard insn patterns
-
-
-; This is used to access the address of a byte. This is similar to
-; movqi, but the second operand had to be "address_operand" type, so
-; it had to be an unnamed one.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:QI 1 "address_operand" "p"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"pushab %a1\";
- return \"movab %a1,%0\";
-}")
-
-; This is used to access the address of a word. This is similar to
-; movhi, but the second operand had to be "address_operand" type, so
-; it had to be an unnamed one.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:HI 1 "address_operand" "p"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"pushaw %a1\";
- return \"movaw %a1,%0\";
-}")
-
-; This is used to access the address of a long. This is similar to
-; movsi, but the second operand had to be "address_operand" type, so
-; it had to be an unnamed one.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:SI 1 "address_operand" "p"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"pushal %a1\";
- return \"moval %a1,%0\";
-}")
-
-
-; bit test longword instruction, same as vax
-
-(define_insn ""
- [(set (cc0)
- (and:SI (match_operand:SI 0 "general_operand" "g")
- (match_operand:SI 1 "general_operand" "g")))]
- ""
- "bitl %0,%1")
-
-
-; bit test word instructions, same as vax
-
-(define_insn ""
- [(set (cc0)
- (and:HI (match_operand:HI 0 "general_operand" "g")
- (match_operand:HI 1 "general_operand" "g")))]
- ""
- "bitw %0,%1")
-
-
-; bit test instructions, same as vax
-
-(define_insn ""
- [(set (cc0)
- (and:QI (match_operand:QI 0 "general_operand" "g")
- (match_operand:QI 1 "general_operand" "g")))]
- ""
- "bitb %0,%1")
-
-
-; bne counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jneq %l0")
-
-
-; beq counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jeql %l0")
-
-
-; ble counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jleq %l0")
-
-
-; bleu counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jlequ %l0")
-
-
-; bge counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jgeq %l0")
-
-
-; bgeu counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jgequ %l0")
-
-
-; blt counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jlss %l0")
-
-
-; bltu counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jlssu %l0")
-
-
-; bgt counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jgtr %l0")
-
-
-; bgtu counterpart. in case gcc reverses the conditional.
-
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jgtru %l0")
-
-
-; casesi alternate form as found in vax code. this form is to
-; compensate for the table's offset being no distance (0 displacement)
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (match_operand:SI 0 "general_operand" "g")
- (match_operand:SI 1 "general_operand" "g"))
- (plus:SI (sign_extend:SI
- (mem:HI (plus:SI (pc)
- (minus:SI (match_dup 0)
- (const_int 0)))))
- (label_ref:SI (match_operand 3 "" "")))
- (pc)))]
- ""
- "casel %0,$0,%1\;.align %@")
-
-
-; casesi alternate form as found in vax code. another form to
-; compensate for the table's offset being no distance (0 displacement)
-
-(define_insn ""
- [(set (pc)
- (if_then_else (le (match_operand:SI 0 "general_operand" "g")
- (match_operand:SI 1 "general_operand" "g"))
- (plus:SI (sign_extend:SI
- (mem:HI (plus:SI (pc)
- (match_dup 0))))
- (label_ref:SI (match_operand 3 "" "")))
- (pc)))]
- ""
- "casel %0,$0,%1 \;.align %@")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (lt (plus:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int 1))
- (match_operand:SI 1 "general_operand" "g"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- ""
- "aoblss %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (le (plus:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int 1))
- (match_operand:SI 1 "general_operand" "g"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- ""
- "aobleq %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ge (plus:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int 1))
- (match_operand:SI 1 "general_operand" "g"))
- (pc)
- (label_ref (match_operand 2 "" ""))))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- ""
- "aoblss %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (gt (plus:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int 1))
- (match_operand:SI 1 "general_operand" "g"))
- (pc)
- (label_ref (match_operand 2 "" ""))))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- ""
- "aobleq %1,%0,%l2")
-
-; bbs/bbc
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (sign_extract:SI (match_operand:SI 0 "register_operand" "rm")
- (const_int 1)
- (subreg:QI (match_operand:SI 1 "general_operand" "g") 0))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "bbs %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (sign_extract:SI (match_operand:SI 0 "register_operand" "rm")
- (const_int 1)
- (subreg:QI (match_operand:SI 1 "general_operand" "g") 0))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "bbc %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (sign_extract:SI (match_operand:SI 0 "register_operand" "rm")
- (const_int 1)
- (subreg:QI (match_operand:SI 1 "general_operand" "g") 0))
- (const_int 0))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "bbc %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (sign_extract:SI (match_operand:SI 0 "register_operand" "rm")
- (const_int 1)
- (subreg:QI (match_operand:SI 1 "general_operand" "g") 0))
- (const_int 0))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "bbs %1,%0,%l2")
-
-; if the shift count is a byte in a register we can use it as a long
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (sign_extract:SI (match_operand:SI 0 "register_operand" "rm")
- (const_int 1)
- (match_operand:QI 1 "register_operand" "r"))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "bbs %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (sign_extract:SI (match_operand:SI 0 "register_operand" "rm")
- (const_int 1)
- (match_operand:QI 1 "register_operand" "r"))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "bbc %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (sign_extract:SI (match_operand:SI 0 "register_operand" "rm")
- (const_int 1)
- (match_operand:QI 1 "register_operand" "r"))
- (const_int 0))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "bbc %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (sign_extract:SI (match_operand:SI 0 "register_operand" "rm")
- (const_int 1)
- (match_operand:QI 1 "register_operand" "r"))
- (const_int 0))
- (pc)
- (label_ref (match_operand 2 "" ""))))]
- ""
- "bbs %1,%0,%l2")
-
-; special case for 1 << constant. We don't do these because they are slower
-; than the bitl instruction
-
-;(define_insn ""
-; [(set (pc)
-; (if_then_else
-; (ne (and:SI (match_operand:SI 0 "nonimmediate_operand" "%rm")
-; (match_operand:SI 1 "immediate_operand" "i"))
-; (const_int 0))
-; (label_ref (match_operand 2 "" ""))
-; (pc)))]
-; "GET_CODE (operands[1]) == CONST_INT
-; && exact_log2 (INTVAL (operands[1])) >= 0"
-; "*
-;{
-; operands[1]
-; = gen_rtx (CONST_INT, VOIDmode, exact_log2 (INTVAL (operands[1])));
-; return \"bbs %1,%0,%l2\";
-;}")
-;
-;(define_insn ""
-; [(set (pc)
-; (if_then_else
-; (eq (and:SI (match_operand:SI 0 "nonimmediate_operand" "%rm")
-; (match_operand:SI 1 "immediate_operand" "i"))
-; (const_int 0))
-; (label_ref (match_operand 2 "" ""))
-; (pc)))]
-; "GET_CODE (operands[1]) == CONST_INT
-; && exact_log2 (INTVAL (operands[1])) >= 0"
-; "*
-;{
-; operands[1]
-; = gen_rtx (CONST_INT, VOIDmode, exact_log2 (INTVAL (operands[1])));
-; return \"bbc %1,%0,%l2\";
-;}")
-;
-;(define_insn ""
-; [(set (pc)
-; (if_then_else
-; (ne (and:SI (match_operand:SI 0 "nonimmediate_operand" "%rm")
-; (match_operand:SI 1 "immediate_operand" "i"))
-; (const_int 0))
-; (pc)
-; (label_ref (match_operand 2 "" ""))))]
-; "GET_CODE (operands[1]) == CONST_INT
-; && exact_log2 (INTVAL (operands[1])) >= 0"
-; "*
-;{
-; operands[1]
-; = gen_rtx (CONST_INT, VOIDmode, exact_log2 (INTVAL (operands[1])));
-; return \"bbc %1,%0,%l2\";
-;}")
-;
-;(define_insn ""
-; [(set (pc)
-; (if_then_else
-; (eq (and:SI (match_operand:SI 0 "nonimmediate_operand" "%rm")
-; (match_operand:SI 1 "immediate_operand" "i"))
-; (const_int 0))
-; (pc)
-; (label_ref (match_operand 2 "" ""))))]
-; "GET_CODE (operands[1]) == CONST_INT
-; && exact_log2 (INTVAL (operands[1])) >= 0"
-; "*
-;{
-; operands[1]
-; = gen_rtx (CONST_INT, VOIDmode, exact_log2 (INTVAL (operands[1])));
-; return \"bbs %1,%0,%l2\";
-;}")
diff --git a/gcc/config/tahoe/xm-tahoe.h b/gcc/config/tahoe/xm-tahoe.h
deleted file mode 100644
index 1af7bdda31e..00000000000
--- a/gcc/config/tahoe/xm-tahoe.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Configuration for GNU C-compiler for Tahoe.
- Copyright (C) 1987, 1993 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. */
-
-/*
- * File: xm-tahoe.h
- *
- * Original port made at the University of Buffalo by Devon Bowen,
- * Dale Wiles and Kevin Zachmann.
- *
- * Changes for HCX by Piet van Oostrum,
- * University of Utrecht, The Netherlands (piet@cs.ruu.nl)
- *
- * Mail bugs reports or fixes to: gcc@cs.buffalo.edu
- */
-
-
-/* This file has the same stuff the vax version does */
-
-/* defines that need visibility everywhere */
-
-#define FALSE 0
-#define TRUE 1
-
-/* target machine dependencies
- tm.h is a symbolic link to the actual target specific file. */
-
-#include "tm.h"
-
-/* This describes the machine the compiler is hosted on. */
-
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN
-
-/* Arguments to use with `exit'. */
-
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
diff --git a/gcc/config/vax/netbsd.h b/gcc/config/vax/netbsd.h
deleted file mode 100644
index 1bbda32b4e4..00000000000
--- a/gcc/config/vax/netbsd.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Dvax -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(vax) -Amachine(vax)"
-
-/* Make gcc agree with <machine/ansi.h> */
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
-
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
diff --git a/gcc/config/vax/ultrix.h b/gcc/config/vax/ultrix.h
deleted file mode 100644
index 7181e5b0019..00000000000
--- a/gcc/config/vax/ultrix.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES " -Dvax -Dunix -Dultrix -Dbsd4_2 -D__vax -D__unix -D__ultrix -D__bsd4_2 -Asystem(unix) -Asystem(bsd) -Acpu(vax) -Amachine(vax)"
-
-/* These are as defined in /usr/include/sys/stdtypes.h.
- These values are for ultrix 4.2 on the vax. */
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-#define WCHAR_TYPE "unsigned int"
-#define WCHAR_TYPE_SIZE 32
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
deleted file mode 100644
index 35448cb5fa5..00000000000
--- a/gcc/config/vax/vax.c
+++ /dev/null
@@ -1,835 +0,0 @@
-/* Subroutines for insn-output.c for Vax.
- Copyright (C) 1987, 1994, 1995, 1997 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. */
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "real.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "insn-flags.h"
-#include "output.h"
-#include "insn-attr.h"
-#ifdef VMS_TARGET
-#include "tree.h"
-#endif
-
-/* This is like nonimmediate_operand with a restriction on the type of MEM. */
-
-void
-split_quadword_operands (operands, low, n)
- rtx *operands, *low;
- int n;
-{
- int i;
- /* Split operands. */
-
- low[0] = low[1] = low[2] = 0;
- for (i = 0; i < 3; i++)
- {
- if (low[i])
- /* it's already been figured out */;
- else if (GET_CODE (operands[i]) == MEM
- && (GET_CODE (XEXP (operands[i], 0)) == POST_INC))
- {
- rtx addr = XEXP (operands[i], 0);
- operands[i] = low[i] = gen_rtx (MEM, SImode, addr);
- if (which_alternative == 0 && i == 0)
- {
- addr = XEXP (operands[i], 0);
- operands[i+1] = low[i+1] = gen_rtx (MEM, SImode, addr);
- }
- }
- else
- {
- low[i] = operand_subword (operands[i], 0, 0, DImode);
- operands[i] = operand_subword (operands[i], 1, 0, DImode);
- }
- }
-}
-
-print_operand_address (file, addr)
- FILE *file;
- register rtx addr;
-{
- register rtx reg1, reg2, breg, ireg;
- rtx offset;
-
- retry:
- switch (GET_CODE (addr))
- {
- case MEM:
- fprintf (file, "*");
- addr = XEXP (addr, 0);
- goto retry;
-
- case REG:
- fprintf (file, "(%s)", reg_names[REGNO (addr)]);
- break;
-
- case PRE_DEC:
- fprintf (file, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]);
- break;
-
- case POST_INC:
- fprintf (file, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]);
- break;
-
- case PLUS:
- /* There can be either two or three things added here. One must be a
- REG. One can be either a REG or a MULT of a REG and an appropriate
- constant, and the third can only be a constant or a MEM.
-
- We get these two or three things and put the constant or MEM in
- OFFSET, the MULT or REG in IREG, and the REG in BREG. If we have
- a register and can't tell yet if it is a base or index register,
- put it into REG1. */
-
- reg1 = 0; ireg = 0; breg = 0; offset = 0;
-
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))
- || GET_CODE (XEXP (addr, 0)) == MEM)
- {
- offset = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))
- || GET_CODE (XEXP (addr, 1)) == MEM)
- {
- offset = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 1)) == MULT)
- {
- ireg = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 0)) == MULT)
- {
- ireg = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- {
- reg1 = XEXP (addr, 1);
- addr = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 0)) == REG)
- {
- reg1 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- }
- else
- abort ();
-
- if (GET_CODE (addr) == REG)
- {
- if (reg1)
- ireg = addr;
- else
- reg1 = addr;
- }
- else if (GET_CODE (addr) == MULT)
- ireg = addr;
- else if (GET_CODE (addr) == PLUS)
- {
- if (CONSTANT_ADDRESS_P (XEXP (addr, 0))
- || GET_CODE (XEXP (addr, 0)) == MEM)
- {
- if (offset)
- {
- if (GET_CODE (offset) == CONST_INT)
- offset = plus_constant (XEXP (addr, 0), INTVAL (offset));
- else if (GET_CODE (XEXP (addr, 0)) == CONST_INT)
- offset = plus_constant (offset, INTVAL (XEXP (addr, 0)));
- else
- abort ();
- }
- offset = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 0)) == REG)
- {
- if (reg1)
- ireg = reg1, breg = XEXP (addr, 0), reg1 = 0;
- else
- reg1 = XEXP (addr, 0);
- }
- else if (GET_CODE (XEXP (addr, 0)) == MULT)
- {
- if (ireg)
- abort ();
- ireg = XEXP (addr, 0);
- }
- else
- abort ();
-
- if (CONSTANT_ADDRESS_P (XEXP (addr, 1))
- || GET_CODE (XEXP (addr, 1)) == MEM)
- {
- if (offset)
- {
- if (GET_CODE (offset) == CONST_INT)
- offset = plus_constant (XEXP (addr, 1), INTVAL (offset));
- else if (GET_CODE (XEXP (addr, 1)) == CONST_INT)
- offset = plus_constant (offset, INTVAL (XEXP (addr, 1)));
- else
- abort ();
- }
- offset = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == REG)
- {
- if (reg1)
- ireg = reg1, breg = XEXP (addr, 1), reg1 = 0;
- else
- reg1 = XEXP (addr, 1);
- }
- else if (GET_CODE (XEXP (addr, 1)) == MULT)
- {
- if (ireg)
- abort ();
- ireg = XEXP (addr, 1);
- }
- else
- abort ();
- }
- else
- abort ();
-
- /* If REG1 is non-zero, figure out if it is a base or index register. */
- if (reg1)
- {
- if (breg != 0 || (offset && GET_CODE (offset) == MEM))
- {
- if (ireg)
- abort ();
- ireg = reg1;
- }
- else
- breg = reg1;
- }
-
- if (offset != 0)
- output_address (offset);
-
- if (breg != 0)
- fprintf (file, "(%s)", reg_names[REGNO (breg)]);
-
- if (ireg != 0)
- {
- if (GET_CODE (ireg) == MULT)
- ireg = XEXP (ireg, 0);
- if (GET_CODE (ireg) != REG)
- abort ();
- fprintf (file, "[%s]", reg_names[REGNO (ireg)]);
- }
- break;
-
- default:
- output_addr_const (file, addr);
- }
-}
-
-char *
-rev_cond_name (op)
- rtx op;
-{
- switch (GET_CODE (op))
- {
- case EQ:
- return "neq";
- case NE:
- return "eql";
- case LT:
- return "geq";
- case LE:
- return "gtr";
- case GT:
- return "leq";
- case GE:
- return "lss";
- case LTU:
- return "gequ";
- case LEU:
- return "gtru";
- case GTU:
- return "lequ";
- case GEU:
- return "lssu";
-
- default:
- abort ();
- }
-}
-
-int
-vax_float_literal(c)
- register rtx c;
-{
- register enum machine_mode mode;
- int i;
- union {double d; int i[2];} val;
-
- if (GET_CODE (c) != CONST_DOUBLE)
- return 0;
-
- mode = GET_MODE (c);
-
- if (c == const_tiny_rtx[(int) mode][0]
- || c == const_tiny_rtx[(int) mode][1]
- || c == const_tiny_rtx[(int) mode][2])
- return 1;
-
-#if HOST_FLOAT_FORMAT == VAX_FLOAT_FORMAT
-
- val.i[0] = CONST_DOUBLE_LOW (c);
- val.i[1] = CONST_DOUBLE_HIGH (c);
-
- for (i = 0; i < 7; i ++)
- if (val.d == 1 << i || val.d == 1 / (1 << i))
- return 1;
-#endif
- return 0;
-}
-
-
-/* Return the cost in cycles of a memory address, relative to register
- indirect.
-
- Each of the following adds the indicated number of cycles:
-
- 1 - symbolic address
- 1 - pre-decrement
- 1 - indexing and/or offset(register)
- 2 - indirect */
-
-
-int vax_address_cost(addr)
- register rtx addr;
-{
- int reg = 0, indexed = 0, indir = 0, offset = 0, predec = 0;
- rtx plus_op0 = 0, plus_op1 = 0;
- restart:
- switch (GET_CODE (addr))
- {
- case PRE_DEC:
- predec = 1;
- case REG:
- case SUBREG:
- case POST_INC:
- reg = 1;
- break;
- case MULT:
- indexed = 1; /* 2 on VAX 2 */
- break;
- case CONST_INT:
- /* byte offsets cost nothing (on a VAX 2, they cost 1 cycle) */
- if (offset == 0)
- offset = (unsigned)(INTVAL(addr)+128) > 256;
- break;
- case CONST:
- case SYMBOL_REF:
- offset = 1; /* 2 on VAX 2 */
- break;
- case LABEL_REF: /* this is probably a byte offset from the pc */
- if (offset == 0)
- offset = 1;
- break;
- case PLUS:
- if (plus_op0)
- plus_op1 = XEXP (addr, 0);
- else
- plus_op0 = XEXP (addr, 0);
- addr = XEXP (addr, 1);
- goto restart;
- case MEM:
- indir = 2; /* 3 on VAX 2 */
- addr = XEXP (addr, 0);
- goto restart;
- }
-
- /* Up to 3 things can be added in an address. They are stored in
- plus_op0, plus_op1, and addr. */
-
- if (plus_op0)
- {
- addr = plus_op0;
- plus_op0 = 0;
- goto restart;
- }
- if (plus_op1)
- {
- addr = plus_op1;
- plus_op1 = 0;
- goto restart;
- }
- /* Indexing and register+offset can both be used (except on a VAX 2)
- without increasing execution time over either one alone. */
- if (reg && indexed && offset)
- return reg + indir + offset + predec;
- return reg + indexed + indir + offset + predec;
-}
-
-
-/* Cost of an expression on a VAX. This version has costs tuned for the
- CVAX chip (found in the VAX 3 series) with comments for variations on
- other models. */
-
-int
-vax_rtx_cost (x)
- register rtx x;
-{
- register enum rtx_code code = GET_CODE (x);
- enum machine_mode mode = GET_MODE (x);
- register int c;
- int i = 0; /* may be modified in switch */
- char *fmt = GET_RTX_FORMAT (code); /* may be modified in switch */
-
- switch (code)
- {
- case POST_INC:
- return 2;
- case PRE_DEC:
- return 3;
- case MULT:
- switch (mode)
- {
- case DFmode:
- c = 16; /* 4 on VAX 9000 */
- break;
- case SFmode:
- c = 9; /* 4 on VAX 9000, 12 on VAX 2 */
- break;
- case DImode:
- c = 16; /* 6 on VAX 9000, 28 on VAX 2 */
- break;
- case SImode:
- case HImode:
- case QImode:
- c = 10; /* 3-4 on VAX 9000, 20-28 on VAX 2 */
- break;
- }
- break;
- case UDIV:
- c = 17;
- break;
- case DIV:
- if (mode == DImode)
- c = 30; /* highly variable */
- else if (mode == DFmode)
- /* divide takes 28 cycles if the result is not zero, 13 otherwise */
- c = 24;
- else
- c = 11; /* 25 on VAX 2 */
- break;
- case MOD:
- c = 23;
- break;
- case UMOD:
- c = 29;
- break;
- case FLOAT:
- c = 6 + (mode == DFmode) + (GET_MODE (XEXP (x, 0)) != SImode);
- /* 4 on VAX 9000 */
- break;
- case FIX:
- c = 7; /* 17 on VAX 2 */
- break;
- case ASHIFT:
- case LSHIFTRT:
- case ASHIFTRT:
- if (mode == DImode)
- c = 12;
- else
- c = 10; /* 6 on VAX 9000 */
- break;
- case ROTATE:
- case ROTATERT:
- c = 6; /* 5 on VAX 2, 4 on VAX 9000 */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- fmt = "e"; /* all constant rotate counts are short */
- break;
- case PLUS:
- /* Check for small negative integer operand: subl2 can be used with
- a short positive constant instead. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- if ((unsigned)(INTVAL (XEXP (x, 1)) + 63) < 127)
- fmt = "e";
- case MINUS:
- c = (mode == DFmode) ? 13 : 8; /* 6/8 on VAX 9000, 16/15 on VAX 2 */
- case IOR:
- case XOR:
- c = 3;
- break;
- case AND:
- /* AND is special because the first operand is complemented. */
- c = 3;
- if (GET_CODE (XEXP (x, 0)) == CONST_INT)
- {
- if ((unsigned)~INTVAL (XEXP (x, 0)) > 63)
- c = 4;
- fmt = "e";
- i = 1;
- }
- break;
- case NEG:
- if (mode == DFmode)
- return 9;
- else if (mode == SFmode)
- return 6;
- else if (mode == DImode)
- return 4;
- case NOT:
- return 2;
- case ZERO_EXTRACT:
- case SIGN_EXTRACT:
- c = 15;
- break;
- case MEM:
- if (mode == DImode || mode == DFmode)
- c = 5; /* 7 on VAX 2 */
- else
- c = 3; /* 4 on VAX 2 */
- x = XEXP (x, 0);
- if (GET_CODE (x) == REG || GET_CODE (x) == POST_INC)
- return c;
- return c + vax_address_cost (x);
- default:
- c = 3;
- break;
- }
-
-
- /* Now look inside the expression. Operands which are not registers or
- short constants add to the cost.
-
- FMT and I may have been adjusted in the switch above for instructions
- which require special handling */
-
- while (*fmt++ == 'e')
- {
- register rtx op = XEXP (x, i++);
- code = GET_CODE (op);
-
- /* A NOT is likely to be found as the first operand of an AND
- (in which case the relevant cost is of the operand inside
- the not) and not likely to be found anywhere else. */
- if (code == NOT)
- op = XEXP (op, 0), code = GET_CODE (op);
-
- switch (code)
- {
- case CONST_INT:
- if ((unsigned)INTVAL (op) > 63 && GET_MODE (x) != QImode)
- c += 1; /* 2 on VAX 2 */
- break;
- case CONST:
- case LABEL_REF:
- case SYMBOL_REF:
- c += 1; /* 2 on VAX 2 */
- break;
- case CONST_DOUBLE:
- if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT)
- {
- /* Registers are faster than floating point constants -- even
- those constants which can be encoded in a single byte. */
- if (vax_float_literal (op))
- c++;
- else
- c += (GET_MODE (x) == DFmode) ? 3 : 2;
- }
- else
- {
- if (CONST_DOUBLE_HIGH (op) != 0
- || (unsigned)CONST_DOUBLE_LOW (op) > 63)
- c += 2;
- }
- break;
- case MEM:
- c += 1; /* 2 on VAX 2 */
- if (GET_CODE (XEXP (op, 0)) != REG)
- c += vax_address_cost (XEXP (op, 0));
- break;
- case REG:
- case SUBREG:
- break;
- default:
- c += 1;
- break;
- }
- }
- return c;
-}
-
-/* Check a `double' value for validity for a particular machine mode. */
-
-static char *float_strings[] =
-{
- "1.70141173319264430e+38", /* 2^127 (2^24 - 1) / 2^24 */
- "-1.70141173319264430e+38",
- "2.93873587705571877e-39", /* 2^-128 */
- "-2.93873587705571877e-39"
-};
-
-static REAL_VALUE_TYPE float_values[4];
-
-static int inited_float_values = 0;
-
-
-int
-check_float_value (mode, d, overflow)
- enum machine_mode mode;
- REAL_VALUE_TYPE *d;
- int overflow;
-{
- if (inited_float_values == 0)
- {
- int i;
- for (i = 0; i < 4; i++)
- {
- float_values[i] = REAL_VALUE_ATOF (float_strings[i], DFmode);
- }
-
- inited_float_values = 1;
- }
-
- if (overflow)
- {
- bcopy (&float_values[0], d, sizeof (REAL_VALUE_TYPE));
- return 1;
- }
-
- if ((mode) == SFmode)
- {
- REAL_VALUE_TYPE r;
- bcopy (d, &r, sizeof (REAL_VALUE_TYPE));
- if (REAL_VALUES_LESS (float_values[0], r))
- {
- bcopy (&float_values[0], d, sizeof (REAL_VALUE_TYPE));
- return 1;
- }
- else if (REAL_VALUES_LESS (r, float_values[1]))
- {
- bcopy (&float_values[1], d, sizeof (REAL_VALUE_TYPE));
- return 1;
- }
- else if (REAL_VALUES_LESS (dconst0, r)
- && REAL_VALUES_LESS (r, float_values[2]))
- {
- bcopy (&dconst0, d, sizeof (REAL_VALUE_TYPE));
- return 1;
- }
- else if (REAL_VALUES_LESS (r, dconst0)
- && REAL_VALUES_LESS (float_values[3], r))
- {
- bcopy (&dconst0, d, sizeof (REAL_VALUE_TYPE));
- return 1;
- }
- }
-
- return 0;
-}
-
-#ifdef VMS_TARGET
-/* Additional support code for VMS target. */
-
-/* Linked list of all externals that are to be emitted when optimizing
- for the global pointer if they haven't been declared by the end of
- the program with an appropriate .comm or initialization. */
-
-static
-struct extern_list {
- struct extern_list *next; /* next external */
- char *name; /* name of the external */
- int size; /* external's actual size */
- int in_const; /* section type flag */
-} *extern_head = 0, *pending_head = 0;
-
-/* Check whether NAME is already on the external definition list. If not,
- add it to either that list or the pending definition list. */
-
-void
-vms_check_external (decl, name, pending)
- tree decl;
- char *name;
- int pending;
-{
- register struct extern_list *p, *p0;
-
- for (p = extern_head; p; p = p->next)
- if (!strcmp (p->name, name))
- return;
-
- for (p = pending_head, p0 = 0; p; p0 = p, p = p->next)
- if (!strcmp (p->name, name))
- {
- if (pending)
- return;
-
- /* Was pending, but has now been defined; move it to other list. */
- if (p == pending_head)
- pending_head = p->next;
- else
- p0->next = p->next;
- p->next = extern_head;
- extern_head = p;
- return;
- }
-
- /* Not previously seen; create a new list entry. */
- p = (struct extern_list *)permalloc ((long) sizeof (struct extern_list));
- p->name = name;
-
- if (pending)
- {
- /* Save the size and section type and link to `pending' list. */
- p->size = (DECL_SIZE (decl) == 0) ? 0 :
- TREE_INT_CST_LOW (size_binop (CEIL_DIV_EXPR, DECL_SIZE (decl),
- size_int (BITS_PER_UNIT)));
- p->in_const = (TREE_READONLY (decl) && ! TREE_THIS_VOLATILE (decl));
-
- p->next = pending_head;
- pending_head = p;
- }
- else
- {
- /* Size and section type don't matter; link to `declared' list. */
- p->size = p->in_const = 0; /* arbitrary init */
-
- p->next = extern_head;
- extern_head = p;
- }
- return;
-}
-
-void
-vms_flush_pending_externals (file)
- FILE *file;
-{
- register struct extern_list *p;
-
- while (pending_head)
- {
- /* Move next pending declaration to the "done" list. */
- p = pending_head;
- pending_head = p->next;
- p->next = extern_head;
- extern_head = p;
-
- /* Now output the actual declaration. */
- if (p->in_const)
- const_section ();
- else
- data_section ();
- fputs (".comm ", file);
- assemble_name (file, p->name);
- fprintf (file, ",%d\n", p->size);
- }
-}
-#endif /* VMS_TARGET */
-
-#ifdef VMS
-/* Additional support code for VMS host. */
-
-#ifdef QSORT_WORKAROUND
- /*
- Do not use VAXCRTL's qsort() due to a severe bug: once you've
- sorted something which has a size that's an exact multiple of 4
- and is longword aligned, you cannot safely sort anything which
- is either not a multiple of 4 in size or not longword aligned.
- A static "move-by-longword" optimization flag inside qsort() is
- never reset. This is known of affect VMS V4.6 through VMS V5.5-1,
- and was finally fixed in VMS V5.5-2.
-
- In this work-around an insertion sort is used for simplicity.
- The qsort code from glibc should probably be used instead.
- */
-void
-not_qsort (array, count, size, compare)
- void *array;
- unsigned count, size;
- int (*compare)();
-{
-
- if (size == sizeof (short))
- {
- register int i;
- register short *next, *prev;
- short tmp, *base = array;
-
- for (next = base, i = count - 1; i > 0; i--)
- {
- prev = next++;
- if ((*compare)(next, prev) < 0)
- {
- tmp = *next;
- do *(prev + 1) = *prev;
- while (--prev >= base ? (*compare)(&tmp, prev) < 0 : 0);
- *(prev + 1) = tmp;
- }
- }
- }
- else if (size == sizeof (long))
- {
- register int i;
- register long *next, *prev;
- long tmp, *base = array;
-
- for (next = base, i = count - 1; i > 0; i--)
- {
- prev = next++;
- if ((*compare)(next, prev) < 0)
- {
- tmp = *next;
- do *(prev + 1) = *prev;
- while (--prev >= base ? (*compare)(&tmp, prev) < 0 : 0);
- *(prev + 1) = tmp;
- }
- }
- }
- else /* arbitrary size */
- {
- register int i;
- register char *next, *prev, *tmp = alloca (size), *base = array;
-
- for (next = base, i = count - 1; i > 0; i--)
- { /* count-1 forward iterations */
- prev = next, next += size; /* increment front pointer */
- if ((*compare)(next, prev) < 0)
- { /* found element out of order; move others up then re-insert */
- memcpy (tmp, next, size); /* save smaller element */
- do { memcpy (prev + size, prev, size); /* move larger elem. up */
- prev -= size; /* decrement back pointer */
- } while (prev >= base ? (*compare)(tmp, prev) < 0 : 0);
- memcpy (prev + size, tmp, size); /* restore small element */
- }
- }
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
- }
-
- return;
-}
-#endif /* QSORT_WORKAROUND */
-
-#endif /* VMS */
diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h
deleted file mode 100644
index 1d4d67ddb38..00000000000
--- a/gcc/config/vax/vax.h
+++ /dev/null
@@ -1,1312 +0,0 @@
-/* Definitions of target machine for GNU compiler. Vax version.
- Copyright (C) 1987, 88, 91, 93-96, 1997 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. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dvax -D__vax__ -Dunix -Asystem(unix) -Asystem(bsd) -Acpu(vax) -Amachine(vax)"
-
-/* If using g-format floating point, alter math.h. */
-
-#define CPP_SPEC "%{mg:-DGFLOAT}"
-
-/* Choose proper libraries depending on float format.
- Note that there are no profiling libraries for g-format.
- Also use -lg for the sake of dbx. */
-
-#define LIB_SPEC "%{g:-lg}\
- %{mg:%{lm:-lmg} -lcg \
- %{p:%eprofiling not supported with -mg\n}\
- %{pg:%eprofiling not supported with -mg\n}}\
- %{!mg:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"
-
-/* Print subsidiary information on the compiler version in use. */
-
-#ifndef TARGET_NAME /* A more specific value might be supplied via -D. */
-#define TARGET_NAME "vax"
-#endif
-#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME)
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Nonzero if compiling code that Unix assembler can assemble. */
-#define TARGET_UNIX_ASM (target_flags & 1)
-
-/* Nonzero if compiling with VAX-11 "C" style structure alignment */
-#define TARGET_VAXC_ALIGNMENT (target_flags & 2)
-
-/* Nonzero if compiling with `G'-format floating point */
-#define TARGET_G_FLOAT (target_flags & 4)
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { {"unix", 1}, \
- {"gnu", -1}, \
- {"vaxc-alignment", 2}, \
- {"g", 4}, \
- {"g-float", 4}, \
- {"d", -4}, \
- {"d-float", -4}, \
- { "", TARGET_DEFAULT}}
-
-/* Default target_flags if no switches specified. */
-
-#ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT 1
-#endif
-
-/* Target machine storage layout */
-
-/* Define for software floating point emulation of VAX format
- when cross compiling from a non-VAX host. */
-/* #define REAL_ARITHMETIC */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields.
- This is not true on the vax. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is not true on the vax. */
-#define BYTES_BIG_ENDIAN 0
-
-/* Define this if most significant word of a multiword number is the lowest
- numbered. */
-/* This is not true on the vax. */
-#define WORDS_BIG_ENDIAN 0
-
-/* Number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a 68000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 16
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY (TARGET_VAXC_ALIGNMENT ? 8 : 32)
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 8
-
-/* A bitfield declared as `int' forces `int' alignment for the struct. */
-#define PCC_BITFIELD_TYPE_MATTERS (! TARGET_VAXC_ALIGNMENT)
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* No structure field wants to be aligned rounder than this. */
-#define BIGGEST_FIELD_ALIGNMENT (TARGET_VAXC_ALIGNMENT ? 8 : 32)
-
-/* Set this nonzero if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 0
-
-/* Let's keep the stack somewhat aligned. */
-#define STACK_BOUNDARY 32
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-#define FIRST_PSEUDO_REGISTER 16
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator.
- On the vax, these are the AP, FP, SP and PC. */
-#define FIXED_REGISTERS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers.
- On the vax, all registers are one word long. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
- On the vax, all registers can hold all modes. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) 1
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* Vax pc is overloaded on a register. */
-#define PC_REGNUM 15
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 14
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 13
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 1
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 12
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 0
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 1
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-/* The vax has only one kind of registers, so NO_REGS and ALL_REGS
- are the only classes. */
-
-enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Since GENERAL_REGS is the same class as ALL_REGS,
- don't give it a different class number; just make it an alias. */
-
-#define GENERAL_REGS ALL_REGS
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- {"NO_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS {0, 0xffff}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) ALL_REGS
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS ALL_REGS
-#define BASE_REG_CLASS ALL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description. */
-
-#define REG_CLASS_FROM_LETTER(C) NO_REGS
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C.
-
- `I' is the constant zero. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'I' ? (VALUE) == 0 \
- : 0)
-
-/* Similar, but for floating constants, and defining letters G and H.
- Here VALUE is the CONST_DOUBLE rtx itself.
-
- `G' is a floating-point zero. */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
- ((C) == 'G' ? ((VALUE) == CONST0_RTX (DFmode) \
- || (VALUE) == CONST0_RTX (SFmode)) \
- : 0)
-
-/* Optional extra constraints for this machine.
-
- For the VAX, `Q' means that OP is a MEM that does not have a mode-dependent
- address. */
-
-#define EXTRA_CONSTRAINT(OP, C) \
- ((C) == 'Q' \
- ? GET_CODE (OP) == MEM && ! mode_dependent_address_p (XEXP (OP, 0)) \
- : 0)
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-/* On the vax, this is always the size of MODE in words,
- since all registers are the same size. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-#define STACK_GROWS_DOWNWARD
-
-/* Define this if longjmp restores from saved registers
- rather than from what setjmp saved. */
-#define LONGJMP_RESTORE_FROM_STACK
-
-/* 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
- goes at a more negative offset in the frame. */
-#define FRAME_GROWS_DOWNWARD
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* Given an rtx for the address of a frame,
- return an rtx for the address of the word in the frame
- that holds the dynamic chain--the previous frame's address. */
-#define DYNAMIC_CHAIN_ADDRESS(frame) \
-gen_rtx (PLUS, Pmode, frame, gen_rtx (CONST_INT, VOIDmode, 12))
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by.
- On the vax, -(sp) pushes only the bytes of the operands. */
-#define PUSH_ROUNDING(BYTES) (BYTES)
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 4
-
-/* Value is the number of bytes of arguments automatically
- popped when returning from a subroutine call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name.
- SIZE is the number of bytes of arguments passed on the stack.
-
- On the Vax, the RET insn always pops all the args for any function. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (SIZE)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On the Vax the return value is in R0 regardless. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-/* On the Vax the return value is in R0 regardless. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-#define PCC_STATIC_STRUCT_RETURN
-
-/* 1 if N is a possible register number for a function value.
- On the Vax, R0 is the only register thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* 1 if N is a possible register number for function argument passing.
- On the Vax, no registers are used in this way. */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the vax, this is a single integer, which is a number of bytes
- of arguments scanned so far. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the vax, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the vax all args are pushed. */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate,
- adjusted by STARTING_FRAME_OFFSET to accomodate vms.h.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int regno; \
- register int mask = 0; \
- register int size = SIZE - STARTING_FRAME_OFFSET; \
- extern char call_used_regs[]; \
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) \
- if (regs_ever_live[regno] && !call_used_regs[regno]) \
- mask |= 1 << regno; \
- fprintf (FILE, "\t.word 0x%x\n", mask); \
- MAYBE_VMS_FUNCTION_PROLOGUE(FILE) \
- if ((size) >= 64) fprintf (FILE, "\tmovab %d(sp),sp\n", -size);\
- else if (size) fprintf (FILE, "\tsubl2 $%d,sp\n", (size)); }
-
-/* vms.h redefines this. */
-#define MAYBE_VMS_FUNCTION_PROLOGUE(FILE)
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tmovab LP%d,r0\n\tjsb mcount\n", (LABELNO));
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\ttstl LPBX0\n\tjneq LPI%d\n\tpushal LPBX0\n\tcalls $1,__bb_init_func\nLPI%d:\n", \
- LABELNO, LABELNO);
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. This is a real pain in the
- sphincter on a VAX, since we do not want to change any of the bits in the
- processor status word. The way it is done here, it is pushed onto the stack
- before any flags have changed, and then the stack is fixed up to account for
- the fact that the instruction to restore the flags only reads a word.
- It may seem a bit clumsy, but at least it works.
-*/
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
- fprintf (FILE, "\tmovpsl -(sp)\n\tmovw (sp),2(sp)\n\taddl2 $2,sp\n\taddl2 $1,LPBX2+%d\n\tbicpsw $255\n\tbispsw (sp)+\n", \
- 4 * BLOCKNO)
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 1
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE. */
-
-/* #define FUNCTION_EPILOGUE(FILE, SIZE) */
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved.
-
- On the Vax, FRAME_POINTER_REQUIRED is always 1, so the definition of this
- macro doesn't matter. But it must be defined. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0;
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On the vax, the trampoline contains an entry mask and two instructions:
- .word NN
- movl $STATIC,r0 (store the functions static chain)
- jmp *$FUNCTION (jump to function code at address FUNCTION) */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x8fd0)); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
- ASM_OUTPUT_BYTE (FILE, 0x50+STATIC_CHAIN_REGNUM); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x9f17)); \
- ASM_OUTPUT_INT (FILE, const0_rtx); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 15
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-/* We copy the register-mask from the function's pure code
- to the start of the trampoline. */
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_insn (gen_rtx (ASM_INPUT, VOIDmode, \
- "movpsl -(sp)\n\tpushal 1(pc)\n\trei")); \
- emit_move_insn (gen_rtx (MEM, HImode, TRAMP), \
- gen_rtx (MEM, HImode, FNADDR)); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 4)), CXT);\
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 11)), \
- plus_constant (FNADDR, 2)); \
-}
-
-/* Byte offset of return address in a stack frame. The "saved PC" field
- is in element [4] when treating the frame as an array of longwords. */
-
-#define RETURN_ADDRESS_OFFSET (4 * UNITS_PER_WORD) /* 16 */
-
-/* A C expression whose value is RTL representing the value of the return
- address for the frame COUNT steps up from the current frame.
- FRAMEADDR is already the frame pointer of the COUNT frame, so we
- can ignore COUNT. */
-
-#define RETURN_ADDR_RTX(COUNT, FRAME) \
- ((COUNT == 0) \
- ? gen_rtx (MEM, Pmode, plus_constant (FRAME, RETURN_ADDRESS_OFFSET)) \
- : (rtx) 0)
-
-
-/* Addressing modes, and classification of registers for them. */
-
-#define HAVE_POST_INCREMENT
-/* #define HAVE_POST_DECREMENT */
-
-#define HAVE_PRE_DECREMENT
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(regno) \
-((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
-#define REGNO_OK_FOR_BASE_P(regno) \
-((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 2
-
-/* 1 if X is an rtx for a constant that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) 1
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) 1
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
- The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
- except for CONSTANT_ADDRESS_P which is actually machine-independent. */
-
-#ifdef NO_EXTERNAL_INDIRECT_ADDRESS
-
-/* Zero if this contains a (CONST (PLUS (SYMBOL_REF) (...))) and the
- symbol in the SYMBOL_REF is an external symbol. */
-
-#define INDIRECTABLE_CONSTANT_P(X) \
- (! (GET_CODE ((X)) == CONST \
- && GET_CODE (XEXP ((X), 0)) == PLUS \
- && GET_CODE (XEXP (XEXP ((X), 0), 0)) == SYMBOL_REF \
- && SYMBOL_REF_FLAG (XEXP (XEXP ((X), 0), 0))))
-
-/* Re-definition of CONSTANT_ADDRESS_P, which is true only when there
- are no SYMBOL_REFs for external symbols present. */
-
-#define INDIRECTABLE_CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF \
- || (GET_CODE (X) == SYMBOL_REF && !SYMBOL_REF_FLAG (X)) \
- || (GET_CODE (X) == CONST && INDIRECTABLE_CONSTANT_P(X)) \
- || GET_CODE (X) == CONST_INT)
-
-
-/* Non-zero if X is an address which can be indirected. External symbols
- could be in a sharable image library, so we disallow those. */
-
-#define INDIRECTABLE_ADDRESS_P(X) \
- (INDIRECTABLE_CONSTANT_ADDRESS_P (X) \
- || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && INDIRECTABLE_CONSTANT_ADDRESS_P (XEXP (X, 1))))
-
-#else /* not NO_EXTERNAL_INDIRECT_ADDRESS */
-
-#define INDIRECTABLE_CONSTANT_ADDRESS_P(X) CONSTANT_ADDRESS_P(X)
-
-/* Non-zero if X is an address which can be indirected. */
-#define INDIRECTABLE_ADDRESS_P(X) \
- (CONSTANT_ADDRESS_P (X) \
- || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
- || (GET_CODE (X) == PLUS \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (X, 1))))
-
-#endif /* not NO_EXTERNAL_INDIRECT_ADDRESS */
-
-/* Go to ADDR if X is a valid address not using indexing.
- (This much is the easy part.) */
-#define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
-{ register rtx xfoob = (X); \
- if (GET_CODE (xfoob) == REG) \
- { \
- extern rtx *reg_equiv_mem; \
- if (! reload_in_progress \
- || reg_equiv_mem[REGNO (xfoob)] == 0 \
- || INDIRECTABLE_ADDRESS_P (reg_equiv_mem[REGNO (xfoob)])) \
- goto ADDR; \
- } \
- if (CONSTANT_ADDRESS_P (xfoob)) goto ADDR; \
- if (INDIRECTABLE_ADDRESS_P (xfoob)) goto ADDR; \
- xfoob = XEXP (X, 0); \
- if (GET_CODE (X) == MEM && INDIRECTABLE_ADDRESS_P (xfoob)) \
- goto ADDR; \
- if ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
- && GET_CODE (xfoob) == REG && REG_OK_FOR_BASE_P (xfoob)) \
- goto ADDR; }
-
-/* 1 if PROD is either a reg times size of mode MODE
- or just a reg, if MODE is just one byte.
- This macro's expansion uses the temporary variables xfoo0 and xfoo1
- that must be declared in the surrounding context. */
-#define INDEX_TERM_P(PROD, MODE) \
-(GET_MODE_SIZE (MODE) == 1 \
- ? (GET_CODE (PROD) == REG && REG_OK_FOR_BASE_P (PROD)) \
- : (GET_CODE (PROD) == MULT \
- && \
- (xfoo0 = XEXP (PROD, 0), xfoo1 = XEXP (PROD, 1), \
- ((GET_CODE (xfoo0) == CONST_INT \
- && INTVAL (xfoo0) == GET_MODE_SIZE (MODE) \
- && GET_CODE (xfoo1) == REG \
- && REG_OK_FOR_INDEX_P (xfoo1)) \
- || \
- (GET_CODE (xfoo1) == CONST_INT \
- && INTVAL (xfoo1) == GET_MODE_SIZE (MODE) \
- && GET_CODE (xfoo0) == REG \
- && REG_OK_FOR_INDEX_P (xfoo0))))))
-
-/* Go to ADDR if X is the sum of a register
- and a valid index term for mode MODE. */
-#define GO_IF_REG_PLUS_INDEX(X, MODE, ADDR) \
-{ register rtx xfooa; \
- if (GET_CODE (X) == PLUS) \
- { if (GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0)) \
- && (xfooa = XEXP (X, 1), \
- INDEX_TERM_P (xfooa, MODE))) \
- goto ADDR; \
- if (GET_CODE (XEXP (X, 1)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 1)) \
- && (xfooa = XEXP (X, 0), \
- INDEX_TERM_P (xfooa, MODE))) \
- goto ADDR; } }
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
-{ register rtx xfoo, xfoo0, xfoo1; \
- GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
- if (GET_CODE (X) == PLUS) \
- { /* Handle <address>[index] represented with index-sum outermost */\
- xfoo = XEXP (X, 0); \
- if (INDEX_TERM_P (xfoo, MODE)) \
- { GO_IF_NONINDEXED_ADDRESS (XEXP (X, 1), ADDR); } \
- xfoo = XEXP (X, 1); \
- if (INDEX_TERM_P (xfoo, MODE)) \
- { GO_IF_NONINDEXED_ADDRESS (XEXP (X, 0), ADDR); } \
- /* Handle offset(reg)[index] with offset added outermost */ \
- if (INDIRECTABLE_CONSTANT_ADDRESS_P (XEXP (X, 0))) \
- { if (GET_CODE (XEXP (X, 1)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 1))) \
- goto ADDR; \
- GO_IF_REG_PLUS_INDEX (XEXP (X, 1), MODE, ADDR); } \
- if (INDIRECTABLE_CONSTANT_ADDRESS_P (XEXP (X, 1))) \
- { if (GET_CODE (XEXP (X, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (X, 0))) \
- goto ADDR; \
- GO_IF_REG_PLUS_INDEX (XEXP (X, 0), MODE, ADDR); } } }
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output.
-
- For the vax, nothing needs to be done. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for.
- On the VAX, the predecrement and postincrement address depend thus
- (the amount of decrement or increment being the length of the operand)
- and all indexed address depend thus (because the index scale factor
- is the length of the operand). */
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
- { if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
- goto LABEL; \
- if (GET_CODE (ADDR) == PLUS) \
- { if (CONSTANT_ADDRESS_P (XEXP (ADDR, 0)) \
- && GET_CODE (XEXP (ADDR, 1)) == REG); \
- else if (CONSTANT_ADDRESS_P (XEXP (ADDR, 1)) \
- && GET_CODE (XEXP (ADDR, 0)) == REG); \
- else goto LABEL; }}
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE HImode
-
-/* Define this if the case instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-#define CASE_VECTOR_PC_RELATIVE
-
-/* Define this if the case instruction drops through after the table
- when the index is out of range. Don't define it if the case insn
- jumps to the default label instead. */
-#define CASE_DROPS_THROUGH
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 1
-
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 8
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define if shifts truncate the shift count
- which implies one can omit a sign-extension or zero-extension
- of a shift count. */
-/* #define SHIFT_COUNT_TRUNCATED */
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* This machine doesn't use IEEE floats. */
-
-#define TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-/* On a VAX, constants from 0..63 are cheap because they can use the
- 1 byte literal constant format. compare to -1 should be made cheap
- so that decrement-and-branch insns can be formed more easily (if
- the value -1 is copied to a register some decrement-and-branch patterns
- will not match). */
-
-#define CONST_COSTS(RTX,CODE,OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) == 0) return 0; \
- if ((OUTER_CODE) == AND) \
- return ((unsigned) ~INTVAL (RTX) <= 077) ? 1 : 2; \
- if ((unsigned) INTVAL (RTX) <= 077) return 1; \
- if ((OUTER_CODE) == COMPARE && INTVAL (RTX) == -1) \
- return 1; \
- if ((OUTER_CODE) == PLUS && (unsigned) -INTVAL (RTX) <= 077)\
- return 1; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 3; \
- case CONST_DOUBLE: \
- if (GET_MODE_CLASS (GET_MODE (RTX)) == MODE_FLOAT) \
- return vax_float_literal (RTX) ? 5 : 8; \
- else \
- return (((CONST_DOUBLE_HIGH (RTX) == 0 \
- && (unsigned) CONST_DOUBLE_LOW (RTX) < 64) \
- || ((OUTER_CODE) == PLUS \
- && CONST_DOUBLE_HIGH (RTX) == -1 \
- && (unsigned)-CONST_DOUBLE_LOW (RTX) < 64)) \
- ? 2 : 5);
-
-#define RTX_COSTS(RTX,CODE,OUTER_CODE) case FIX: case FLOAT: \
- case MULT: case DIV: case UDIV: case MOD: case UMOD: \
- case ASHIFT: case LSHIFTRT: case ASHIFTRT: \
- case ROTATE: case ROTATERT: case PLUS: case MINUS: case IOR: \
- case XOR: case AND: case NEG: case NOT: case ZERO_EXTRACT: \
- case SIGN_EXTRACT: case MEM: return vax_rtx_cost(RTX)
-
-#define ADDRESS_COST(RTX) (1 + (GET_CODE (RTX) == REG ? 0 : vax_address_cost(RTX)))
-
-/* Specify the cost of a branch insn; roughly the number of extra insns that
- should be added to avoid a branch.
-
- Branches are extremely cheap on the VAX while the shift insns often
- used to replace branches can be expensive. */
-
-#define BRANCH_COST 0
-
-/*
- * We can use the BSD C library routines for the libgcc calls that are
- * still generated, since that's what they boil down to anyways.
- */
-
-#define UDIVSI3_LIBCALL "*udiv"
-#define UMODSI3_LIBCALL "*urem"
-
-/* Check a `double' value for validity for a particular machine mode. */
-
-/* note that it is very hard to accidentally create a number that fits in a
- double but not in a float, since their ranges are almost the same */
-
-#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
- ((OVERFLOW) = check_float_value (MODE, &D, OVERFLOW))
-
-/* For future reference:
- D Float: 9 bit, sign magnitude, excess 128 binary exponent
- normalized 56 bit fraction, redundant bit not represented
- approximately 16 decimal digits of precision
-
- The values to use if we trust decimal to binary conversions:
-#define MAX_D_FLOAT 1.7014118346046923e+38
-#define MIN_D_FLOAT .29387358770557188e-38
-
- G float: 12 bit, sign magnitude, excess 1024 binary exponent
- normalized 53 bit fraction, redundant bit not represented
- approximately 15 decimal digits precision
-
- The values to use if we trust decimal to binary conversions:
-#define MAX_G_FLOAT .898846567431157e+308
-#define MIN_G_FLOAT .556268464626800e-308
-*/
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). No extra ones are needed for the vax. */
-
-/* Store in cc_status the expressions
- that the condition codes will describe
- after execution of an instruction whose pattern is EXP.
- Do not alter them if the instruction would not alter the cc's. */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ if (GET_CODE (EXP) == SET) \
- { if (GET_CODE (SET_SRC (EXP)) == CALL) \
- CC_STATUS_INIT; \
- else if (GET_CODE (SET_DEST (EXP)) != ZERO_EXTRACT \
- && GET_CODE (SET_DEST (EXP)) != PC) \
- { cc_status.flags = 0; \
- cc_status.value1 = SET_DEST (EXP); \
- cc_status.value2 = SET_SRC (EXP); } } \
- else if (GET_CODE (EXP) == PARALLEL \
- && GET_CODE (XVECEXP (EXP, 0, 0)) == SET) \
- { \
- if (GET_CODE (SET_SRC (XVECEXP (EXP, 0, 0))) == CALL) \
- CC_STATUS_INIT; \
- else if (GET_CODE (SET_DEST (XVECEXP (EXP, 0, 0))) != PC) \
- { cc_status.flags = 0; \
- cc_status.value1 = SET_DEST (XVECEXP (EXP, 0, 0)); \
- cc_status.value2 = SET_SRC (XVECEXP (EXP, 0, 0)); } \
- else \
- /* PARALLELs whose first element sets the PC are aob, \
- sob insns. They do change the cc's. */ \
- CC_STATUS_INIT; } \
- else CC_STATUS_INIT; \
- if (cc_status.value1 && GET_CODE (cc_status.value1) == REG \
- && cc_status.value2 \
- && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2)) \
- cc_status.value2 = 0; \
- if (cc_status.value1 && GET_CODE (cc_status.value1) == MEM \
- && cc_status.value2 \
- && GET_CODE (cc_status.value2) == MEM) \
- cc_status.value2 = 0; }
-/* Actual condition, one line up, should be that value2's address
- depends on value1, but that is too much of a pain. */
-
-#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
-{ if (cc_status.flags & CC_NO_OVERFLOW) \
- return NO_OV; \
- return NORMAL; }
-
-/* Control the assembler format that we output. */
-
-/* Output at beginning of assembler file. */
-
-#define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n");
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "#APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* Output before read-only data. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
- "r9", "r10", "r11", "ap", "fp", "sp", "pc"}
-
-/* This is BSD, so it wants DBX format. */
-
-#define DBX_DEBUGGING_INFO
-
-/* How to renumber registers for dbx and gdb.
- Vax needs no change in the numeration. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Do not break .stabs pseudos into continuations. */
-
-#define DBX_CONTIN_LENGTH 0
-
-/* This is the char to use for continuation (in case we need to turn
- continuation back on). */
-
-#define DBX_CONTIN_CHAR '?'
-
-/* Don't use the `xsfoo;' construct in DBX output; this system
- doesn't support it. */
-
-#define DBX_NO_XREFS
-
-/* Output the .stabs for a C `static' variable in the data section. */
-#define DBX_STATIC_STAB_DATA_SECTION
-
-/* Vax specific: which type character is used for type double? */
-
-#define ASM_DOUBLE_CHAR (TARGET_G_FLOAT ? 'g' : 'd')
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX "_"
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, "%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%s%d", PREFIX, NUM)
-
-/* This is how to output an assembler line defining a `double' constant.
- It is .dfloat or .gfloat, depending. */
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", dstr); \
- fprintf (FILE, "\t.%cfloat 0%c%s\n", ASM_DOUBLE_CHAR, \
- ASM_DOUBLE_CHAR, dstr); \
- } while (0);
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", dstr); \
- fprintf (FILE, "\t.float 0f%s\n", dstr); } while (0);
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.long "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tpushl %s\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tmovl (sp)+,%s\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute.
- (The Vax does not use such vectors,
- but we must define this macro anyway.) */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.long L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word L%d-L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf (FILE, "\t.align %d\n", (LOG))
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space %u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
-( fputs (".lcomm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (ROUNDED)))
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* When debugging, we want to output an extra dummy label so that gas
- can distinguish between D_float and G_float prior to processing the
- .stabs directive identifying type double. */
-
-#define ASM_IDENTIFY_LANGUAGE(FILE) \
- do { \
- output_lang_identify (FILE); \
- if (write_symbols == DBX_DEBUG) \
- fprintf (FILE, "___vax_%c_doubles:\n", ASM_DOUBLE_CHAR); \
- } while (0)
-
-/* Output code to add DELTA to the first argument, and then jump to FUNCTION.
- Used for C++ multiple inheritance.
- .mask ^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11> #conservative entry mask
- addl2 $DELTA, 4(ap) #adjust first argument
- jmp FUNCTION+2 #jump beyond FUNCTION's entry mask
- */
-#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
-do { \
- fprintf (FILE, "\t.word 0x0ffc\n"); \
- fprintf (FILE, "\taddl2 $%d,4(ap)\n", DELTA); \
- fprintf (FILE, "\tjmp "); \
- assemble_name (FILE, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (FUNCTION))); \
- fprintf (FILE, "+2\n"); \
-} while (0)
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print an instruction operand X on file FILE.
- CODE is the code from the %-spec that requested printing this operand;
- if `%z3' was used to print operand 3, then CODE is 'z'.
-
-VAX operand formatting codes:
-
- letter print
- C reverse branch condition
- D 64-bit immediate operand
- B the low 8 bits of the complement of a constant operand
- H the low 16 bits of the complement of a constant operand
- M a mask for the N highest bits of a word
- N the complement of a constant integer operand
- P constant operand plus 1
- R 32 - constant operand
- b the low 8 bits of a negated constant operand
- h the low 16 bits of a negated constant operand
- # 'd' or 'g' depending on whether dfloat or gfloat is used */
-
-/* The purpose of D is to get around a quirk or bug in vax assembler
- whereby -1 in a 64-bit immediate operand means 0x00000000ffffffff,
- which is not a 64-bit minus one. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '#')
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ extern char *rev_cond_name (); \
- if (CODE == '#') fputc (ASM_DOUBLE_CHAR, FILE); \
- else if (CODE == 'C') \
- fputs (rev_cond_name (X), FILE); \
- else if (CODE == 'D' && GET_CODE (X) == CONST_INT && INTVAL (X) < 0) \
- fprintf (FILE, "$0xffffffff%08x", INTVAL (X)); \
- else if (CODE == 'P' && GET_CODE (X) == CONST_INT) \
- fprintf (FILE, "$%d", INTVAL (X) + 1); \
- else if (CODE == 'N' && GET_CODE (X) == CONST_INT) \
- fprintf (FILE, "$%d", ~ INTVAL (X)); \
- /* rotl instruction cannot deal with negative arguments. */ \
- else if (CODE == 'R' && GET_CODE (X) == CONST_INT) \
- fprintf (FILE, "$%d", 32 - INTVAL (X)); \
- else if (CODE == 'H' && GET_CODE (X) == CONST_INT) \
- fprintf (FILE, "$%d", 0xffff & ~ INTVAL (X)); \
- else if (CODE == 'h' && GET_CODE (X) == CONST_INT) \
- fprintf (FILE, "$%d", (short) - INTVAL (x)); \
- else if (CODE == 'B' && GET_CODE (X) == CONST_INT) \
- fprintf (FILE, "$%d", 0xff & ~ INTVAL (X)); \
- else if (CODE == 'b' && GET_CODE (X) == CONST_INT) \
- fprintf (FILE, "$%d", 0xff & - INTVAL (X)); \
- else if (CODE == 'M' && GET_CODE (X) == CONST_INT) \
- fprintf (FILE, "$%d", ~((1 << INTVAL (x)) - 1)); \
- else if (GET_CODE (X) == REG) \
- fprintf (FILE, "%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
- { REAL_VALUE_TYPE r; char dstr[30]; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- REAL_VALUE_TO_DECIMAL (r, "%.20e", dstr); \
- fprintf (FILE, "$0f%s", dstr); } \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
- { REAL_VALUE_TYPE r; char dstr[30]; \
- REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
- REAL_VALUE_TO_DECIMAL (r, "%.20e", dstr); \
- fprintf (FILE, "$0%c%s", ASM_DOUBLE_CHAR, dstr); } \
- else { putc ('$', FILE); output_addr_const (FILE, X); }}
-
-/* Print a memory operand whose address is X, on file FILE.
- This uses a function in output-vax.c. */
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
- print_operand_address (FILE, ADDR)
diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md
deleted file mode 100644
index c3a2ae39588..00000000000
--- a/gcc/config/vax/vax.md
+++ /dev/null
@@ -1,2134 +0,0 @@
-;;- Machine description for GNU compiler, Vax Version
-;; Copyright (C) 1987, 88, 91, 94, 95, 1996 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.
-
-
-;;- Instruction patterns. When multiple patterns apply,
-;;- the first one in the file is chosen.
-;;-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-;;-
-;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
-;;- updates for most instructions.
-
-;; We don't want to allow a constant operand for test insns because
-;; (set (cc0) (const_int foo)) has no mode information. Such insns will
-;; be folded while optimizing anyway.
-
-(define_insn "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "nonimmediate_operand" "g"))]
- ""
- "tstl %0")
-
-(define_insn "tsthi"
- [(set (cc0)
- (match_operand:HI 0 "nonimmediate_operand" "g"))]
- ""
- "tstw %0")
-
-(define_insn "tstqi"
- [(set (cc0)
- (match_operand:QI 0 "nonimmediate_operand" "g"))]
- ""
- "tstb %0")
-
-(define_insn "tstdf"
- [(set (cc0)
- (match_operand:DF 0 "general_operand" "gF"))]
- ""
- "tst%# %0")
-
-(define_insn "tstsf"
- [(set (cc0)
- (match_operand:SF 0 "general_operand" "gF"))]
- ""
- "tstf %0")
-
-(define_insn "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "nonimmediate_operand" "g")
- (match_operand:SI 1 "general_operand" "g")))]
- ""
- "cmpl %0,%1")
-
-(define_insn "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "nonimmediate_operand" "g")
- (match_operand:HI 1 "general_operand" "g")))]
- ""
- "cmpw %0,%1")
-
-(define_insn "cmpqi"
- [(set (cc0)
- (compare (match_operand:QI 0 "nonimmediate_operand" "g")
- (match_operand:QI 1 "general_operand" "g")))]
- ""
- "cmpb %0,%1")
-
-(define_insn "cmpdf"
- [(set (cc0)
- (compare (match_operand:DF 0 "general_operand" "gF,gF")
- (match_operand:DF 1 "general_operand" "G,gF")))]
- ""
- "@
- tst%# %0
- cmp%# %0,%1")
-
-(define_insn "cmpsf"
- [(set (cc0)
- (compare (match_operand:SF 0 "general_operand" "gF,gF")
- (match_operand:SF 1 "general_operand" "G,gF")))]
- ""
- "@
- tstf %0
- cmpf %0,%1")
-
-(define_insn ""
- [(set (cc0)
- (and:SI (match_operand:SI 0 "general_operand" "g")
- (match_operand:SI 1 "general_operand" "g")))]
- ""
- "bitl %0,%1")
-
-(define_insn ""
- [(set (cc0)
- (and:HI (match_operand:HI 0 "general_operand" "g")
- (match_operand:HI 1 "general_operand" "g")))]
- ""
- "bitw %0,%1")
-
-(define_insn ""
- [(set (cc0)
- (and:QI (match_operand:QI 0 "general_operand" "g")
- (match_operand:QI 1 "general_operand" "g")))]
- ""
- "bitb %0,%1")
-
-;; The vax has no sltu or sgeu patterns, but does have two-operand
-;; add/subtract with carry. This is still better than the alternative.
-;; Since the cc0-using insn cannot be separated from the cc0-setting insn,
-;; and the two are created independently, we can't just use a define_expand
-;; to try to optimize this. (The "movl" and "clrl" insns alter the cc0
-;; flags, but leave the carry flag alone, but that can't easily be expressed.)
-;;
-;; Several two-operator combinations could be added to make slightly more
-;; optimal code, but they'd have to cover all combinations of plus and minus
-;; using match_dup. If you want to do this, I'd suggest changing the "sgeu"
-;; pattern to something like (minus (const_int 1) (ltu ...)), so fewer
-;; patterns need to be recognized.
-;; -- Ken Raeburn (Raeburn@Watch.COM) 24 August 1991.
-
-(define_insn "sltu"
- [(set (match_operand:SI 0 "general_operand" "=ro")
- (ltu (cc0) (const_int 0)))]
- ""
- "clrl %0\;adwc $0,%0")
-
-(define_insn "sgeu"
- [(set (match_operand:SI 0 "general_operand" "=ro")
- (geu (cc0) (const_int 0)))]
- ""
- "movl $1,%0\;sbwc $0,%0")
-
-(define_insn "movdf"
- [(set (match_operand:DF 0 "general_operand" "=g,g")
- (match_operand:DF 1 "general_operand" "G,gF"))]
- ""
- "@
- clr%# %0
- mov%# %1,%0")
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "general_operand" "=g,g")
- (match_operand:SF 1 "general_operand" "G,gF"))]
- ""
- "@
- clrf %0
- movf %1,%0")
-
-;; Some vaxes don't support this instruction.
-;;(define_insn "movti"
-;; [(set (match_operand:TI 0 "general_operand" "=g")
-;; (match_operand:TI 1 "general_operand" "g"))]
-;; ""
-;; "movh %1,%0")
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "general_operand" "=g,g")
- (match_operand:DI 1 "general_operand" "I,g"))]
- ""
- "@
- clrq %0
- movq %D1,%0")
-
-;; The VAX move instructions have space-time tradeoffs. On a microVAX
-;; register-register mov instructions take 3 bytes and 2 CPU cycles. clrl
-;; takes 2 bytes and 3 cycles. mov from constant to register takes 2 cycles
-;; if the constant is smaller than 4 bytes, 3 cycles for a longword
-;; constant. movz, mneg, and mcom are as fast as mov, so movzwl is faster
-;; than movl for positive constants that fit in 16 bits but not 6 bits. cvt
-;; instructions take 4 cycles. inc takes 3 cycles. The machine description
-;; is willing to trade 1 byte for 1 cycle (clrl instead of movl $0; cvtwl
-;; instead of movl).
-
-;; Cycle counts for other models may vary (on a VAX 750 they are similar,
-;; but on a VAX 9000 most move and add instructions with one constant
-;; operand take 1 cycle).
-
-;; Loads of constants between 64 and 128 used to be done with
-;; "addl3 $63,#,dst" but this is slower than movzbl and takes as much space.
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:SI 1 "general_operand" "g"))]
- ""
- "*
-{
- rtx link;
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- return \"incl %0\";
- if (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
- {
- if (push_operand (operands[0], SImode))
- return \"pushab %a1\";
- return \"movab %a1,%0\";
- }
- if (operands[1] == const0_rtx)
- return \"clrl %0\";
- if (GET_CODE (operands[1]) == CONST_INT
- && (unsigned) INTVAL (operands[1]) >= 64)
- {
- int i = INTVAL (operands[1]);
- if ((unsigned)(~i) < 64)
- return \"mcoml %N1,%0\";
- if ((unsigned)i < 0x100)
- return \"movzbl %1,%0\";
- if (i >= -0x80 && i < 0)
- return \"cvtbl %1,%0\";
- if ((unsigned)i < 0x10000)
- return \"movzwl %1,%0\";
- if (i >= -0x8000 && i < 0)
- return \"cvtwl %1,%0\";
- }
- if (push_operand (operands[0], SImode))
- return \"pushl %1\";
- return \"movl %1,%0\";
-}")
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (match_operand:HI 1 "general_operand" "g"))]
- ""
- "*
-{
- rtx link;
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- return \"incw %0\";
-
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- int i = INTVAL (operands[1]);
- if (i == 0)
- return \"clrw %0\";
- else if ((unsigned int)i < 64)
- return \"movw %1,%0\";
- else if ((unsigned int)~i < 64)
- return \"mcomw %H1,%0\";
- else if ((unsigned int)i < 256)
- return \"movzbw %1,%0\";
- }
- return \"movw %1,%0\";
-}")
-
-(define_insn "movstricthi"
- [(set (strict_low_part (match_operand:HI 0 "register_operand" "=g"))
- (match_operand:HI 1 "general_operand" "g"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- int i = INTVAL (operands[1]);
- if (i == 0)
- return \"clrw %0\";
- else if ((unsigned int)i < 64)
- return \"movw %1,%0\";
- else if ((unsigned int)~i < 64)
- return \"mcomw %H1,%0\";
- else if ((unsigned int)i < 256)
- return \"movzbw %1,%0\";
- }
- return \"movw %1,%0\";
-}")
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (match_operand:QI 1 "general_operand" "g"))]
- ""
- "*
-{
- rtx link;
- if (operands[1] == const1_rtx
- && (link = find_reg_note (insn, REG_WAS_0, 0))
- /* Make sure the insn that stored the 0 is still present. */
- && ! INSN_DELETED_P (XEXP (link, 0))
- && GET_CODE (XEXP (link, 0)) != NOTE
- /* Make sure cross jumping didn't happen here. */
- && no_labels_between_p (XEXP (link, 0), insn)
- /* Make sure the reg hasn't been clobbered. */
- && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
- return \"incb %0\";
-
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- int i = INTVAL (operands[1]);
- if (i == 0)
- return \"clrb %0\";
- else if ((unsigned int)~i < 64)
- return \"mcomb %B1,%0\";
- }
- return \"movb %1,%0\";
-}")
-
-(define_insn "movstrictqi"
- [(set (strict_low_part (match_operand:QI 0 "register_operand" "=g"))
- (match_operand:QI 1 "general_operand" "g"))]
- ""
- "*
-{
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- int i = INTVAL (operands[1]);
- if (i == 0)
- return \"clrb %0\";
- else if ((unsigned int)~i < 64)
- return \"mcomb %B1,%0\";
- }
- return \"movb %1,%0\";
-}")
-
-;; This is here to accept 4 arguments and pass the first 3 along
-;; to the movstrhi1 pattern that really does the work.
-(define_expand "movstrhi"
- [(set (match_operand:BLK 0 "general_operand" "=g")
- (match_operand:BLK 1 "general_operand" "g"))
- (use (match_operand:HI 2 "general_operand" "g"))
- (match_operand 3 "" "")]
- ""
- "
- emit_insn (gen_movstrhi1 (operands[0], operands[1], operands[2]));
- DONE;
-")
-
-;; The definition of this insn does not really explain what it does,
-;; but it should suffice
-;; that anything generated as this insn will be recognized as one
-;; and that it won't successfully combine with anything.
-(define_insn "movstrhi1"
- [(set (match_operand:BLK 0 "general_operand" "=g")
- (match_operand:BLK 1 "general_operand" "g"))
- (use (match_operand:HI 2 "general_operand" "g"))
- (clobber (reg:SI 0))
- (clobber (reg:SI 1))
- (clobber (reg:SI 2))
- (clobber (reg:SI 3))
- (clobber (reg:SI 4))
- (clobber (reg:SI 5))]
- ""
- "movc3 %2,%1,%0")
-
-;; Extension and truncation insns.
-
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (truncate:QI (match_operand:SI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtlb %1,%0")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (truncate:HI (match_operand:SI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtlw %1,%0")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (truncate:QI (match_operand:HI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtwb %1,%0")
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtwl %1,%0")
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtbw %1,%0")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtbl %1,%0")
-
-(define_insn "extendsfdf2"
- [(set (match_operand:DF 0 "general_operand" "=g")
- (float_extend:DF (match_operand:SF 1 "general_operand" "gF")))]
- ""
- "cvtf%# %1,%0")
-
-(define_insn "truncdfsf2"
- [(set (match_operand:SF 0 "general_operand" "=g")
- (float_truncate:SF (match_operand:DF 1 "general_operand" "gF")))]
- ""
- "cvt%#f %1,%0")
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
- ""
- "movzwl %1,%0")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "movzbw %1,%0")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "movzbl %1,%0")
-
-;; Fix-to-float conversion insns.
-
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "general_operand" "=g")
- (float:SF (match_operand:SI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtlf %1,%0")
-
-(define_insn "floatsidf2"
- [(set (match_operand:DF 0 "general_operand" "=g")
- (float:DF (match_operand:SI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtl%# %1,%0")
-
-(define_insn "floathisf2"
- [(set (match_operand:SF 0 "general_operand" "=g")
- (float:SF (match_operand:HI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtwf %1,%0")
-
-(define_insn "floathidf2"
- [(set (match_operand:DF 0 "general_operand" "=g")
- (float:DF (match_operand:HI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtw%# %1,%0")
-
-(define_insn "floatqisf2"
- [(set (match_operand:SF 0 "general_operand" "=g")
- (float:SF (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtbf %1,%0")
-
-(define_insn "floatqidf2"
- [(set (match_operand:DF 0 "general_operand" "=g")
- (float:DF (match_operand:QI 1 "nonimmediate_operand" "g")))]
- ""
- "cvtb%# %1,%0")
-
-;; Float-to-fix conversion insns.
-
-(define_insn "fix_truncsfqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (fix:QI (fix:SF (match_operand:SF 1 "general_operand" "gF"))))]
- ""
- "cvtfb %1,%0")
-
-(define_insn "fix_truncsfhi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (fix:HI (fix:SF (match_operand:SF 1 "general_operand" "gF"))))]
- ""
- "cvtfw %1,%0")
-
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "gF"))))]
- ""
- "cvtfl %1,%0")
-
-(define_insn "fix_truncdfqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (fix:QI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))]
- ""
- "cvt%#b %1,%0")
-
-(define_insn "fix_truncdfhi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (fix:HI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))]
- ""
- "cvt%#w %1,%0")
-
-(define_insn "fix_truncdfsi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))]
- ""
- "cvt%#l %1,%0")
-
-;;- All kinds of add instructions.
-
-(define_insn "adddf3"
- [(set (match_operand:DF 0 "general_operand" "=g,g,g")
- (plus:DF (match_operand:DF 1 "general_operand" "0,gF,gF")
- (match_operand:DF 2 "general_operand" "gF,0,gF")))]
- ""
- "@
- add%#2 %2,%0
- add%#2 %1,%0
- add%#3 %1,%2,%0")
-
-(define_insn "addsf3"
- [(set (match_operand:SF 0 "general_operand" "=g,g,g")
- (plus:SF (match_operand:SF 1 "general_operand" "0,gF,gF")
- (match_operand:SF 2 "general_operand" "gF,0,gF")))]
- ""
- "@
- addf2 %2,%0
- addf2 %1,%0
- addf3 %1,%2,%0")
-
-/* The space-time-opcode tradeoffs for addition vary by model of VAX.
-
- On a VAX 3 "movab (r1)[r2],r3" is faster than "addl3 r1,r2,r3",
- but it not faster on other models.
-
- "movab #(r1),r2" is usually shorter than "addl3 #,r1,r2", and is
- faster on a VAX 3, but some VAXes (e.g. VAX 9000) will stall if
- a register is used in an address too soon after it is set.
- Compromise by using movab only when it is shorter than the add
- or the base register in the address is one of sp, ap, and fp,
- which are not modified very often. */
-
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (plus:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (operands[2] == const1_rtx)
- return \"incl %0\";
- if (operands[2] == constm1_rtx)
- return \"decl %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subl2 $%n2,%0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) INTVAL (operands[2]) >= 64
- && GET_CODE (operands[1]) == REG
- && ((INTVAL (operands[2]) < 32767 && INTVAL (operands[2]) > -32768)
- || REGNO (operands[1]) > 11))
- return \"movab %c2(%1),%0\";
- return \"addl2 %2,%0\";
- }
- if (rtx_equal_p (operands[0], operands[2]))
- return \"addl2 %1,%0\";
-
- if (GET_CODE (operands[2]) == CONST_INT
- && INTVAL (operands[2]) < 32767
- && INTVAL (operands[2]) > -32768
- && GET_CODE (operands[1]) == REG
- && push_operand (operands[0], SImode))
- return \"pushab %c2(%1)\";
-
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subl3 $%n2,%1,%0\";
-
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) INTVAL (operands[2]) >= 64
- && GET_CODE (operands[1]) == REG
- && ((INTVAL (operands[2]) < 32767 && INTVAL (operands[2]) > -32768)
- || REGNO (operands[1]) > 11))
- return \"movab %c2(%1),%0\";
-
- /* Add this if using gcc on a VAX 3xxx:
- if (REG_P (operands[1]) && REG_P (operands[2]))
- return \"movab (%1)[%2],%0\";
- */
- return \"addl3 %1,%2,%0\";
-}")
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (plus:HI (match_operand:HI 1 "general_operand" "g")
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (operands[2] == const1_rtx)
- return \"incw %0\";
- if (operands[2] == constm1_rtx)
- return \"decw %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subw2 $%n2,%0\";
- return \"addw2 %2,%0\";
- }
- if (rtx_equal_p (operands[0], operands[2]))
- return \"addw2 %1,%0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subw3 $%n2,%1,%0\";
- return \"addw3 %1,%2,%0\";
-}")
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (plus:QI (match_operand:QI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (operands[2] == const1_rtx)
- return \"incb %0\";
- if (operands[2] == constm1_rtx)
- return \"decb %0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subb2 $%n2,%0\";
- return \"addb2 %2,%0\";
- }
- if (rtx_equal_p (operands[0], operands[2]))
- return \"addb2 %1,%0\";
- if (GET_CODE (operands[2]) == CONST_INT
- && (unsigned) (- INTVAL (operands[2])) < 64)
- return \"subb3 $%n2,%1,%0\";
- return \"addb3 %1,%2,%0\";
-}")
-
-;; The add-with-carry (adwc) instruction only accepts two operands.
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "general_operand" "=ro>,ro>")
- (plus:DI (match_operand:DI 1 "general_operand" "%0,ro>")
- (match_operand:DI 2 "general_operand" "Fro,F")))]
- ""
- "*
-{
- rtx low[3];
- char *pattern;
- int carry = 1;
-
- split_quadword_operands (operands, low, 3);
- /* Add low parts. */
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (low[2] == const0_rtx)
- /* Should examine operand, punt if not POST_INC. */
- pattern = \"tstl %0\", carry = 0;
- else if (low[2] == const1_rtx)
- pattern = \"incl %0\";
- else
- pattern = \"addl2 %2,%0\";
- }
- else
- {
- if (low[2] == const0_rtx)
- pattern = \"movl %1,%0\", carry = 0;
- else
- pattern = \"addl3 %2,%1,%0\";
- }
- if (pattern)
- output_asm_insn (pattern, low);
- if (!carry)
- /* If CARRY is 0, we don't have any carry value to worry about. */
- return OUT_FCN (CODE_FOR_addsi3) (operands, insn);
- /* %0 = C + %1 + %2 */
- if (!rtx_equal_p (operands[0], operands[1]))
- output_asm_insn ((operands[1] == const0_rtx
- ? \"clrl %0\"
- : \"movl %1,%0\"), operands);
- return \"adwc %2,%0\";
-}")
-
-;;- All kinds of subtract instructions.
-
-(define_insn "subdf3"
- [(set (match_operand:DF 0 "general_operand" "=g,g")
- (minus:DF (match_operand:DF 1 "general_operand" "0,gF")
- (match_operand:DF 2 "general_operand" "gF,gF")))]
- ""
- "@
- sub%#2 %2,%0
- sub%#3 %2,%1,%0")
-
-(define_insn "subsf3"
- [(set (match_operand:SF 0 "general_operand" "=g,g")
- (minus:SF (match_operand:SF 1 "general_operand" "0,gF")
- (match_operand:SF 2 "general_operand" "gF,gF")))]
- ""
- "@
- subf2 %2,%0
- subf3 %2,%1,%0")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "general_operand" "=g,g")
- (minus:SI (match_operand:SI 1 "general_operand" "0,g")
- (match_operand:SI 2 "general_operand" "g,g")))]
- ""
- "@
- subl2 %2,%0
- subl3 %2,%1,%0")
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "general_operand" "=g,g")
- (minus:HI (match_operand:HI 1 "general_operand" "0,g")
- (match_operand:HI 2 "general_operand" "g,g")))]
- ""
- "@
- subw2 %2,%0
- subw3 %2,%1,%0")
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "general_operand" "=g,g")
- (minus:QI (match_operand:QI 1 "general_operand" "0,g")
- (match_operand:QI 2 "general_operand" "g,g")))]
- ""
- "@
- subb2 %2,%0
- subb3 %2,%1,%0")
-
-;; The subtract-with-carry (sbwc) instruction only takes two operands.
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "general_operand" "=or>,or>")
- (minus:DI (match_operand:DI 1 "general_operand" "0,or>")
- (match_operand:DI 2 "general_operand" "For,F")))]
- ""
- "*
-{
- rtx low[3];
- char *pattern;
- int carry = 1;
-
- split_quadword_operands (operands, low, 3);
- /* Subtract low parts. */
- if (rtx_equal_p (operands[0], operands[1]))
- {
- if (low[2] == const0_rtx)
- pattern = 0, carry = 0;
- else if (low[2] == constm1_rtx)
- pattern = \"decl %0\";
- else
- pattern = \"subl2 %2,%0\";
- }
- else
- {
- if (low[2] == constm1_rtx)
- pattern = \"decl %0\";
- else if (low[2] == const0_rtx)
- pattern = OUT_FCN (CODE_FOR_movsi) (low, insn), carry = 0;
- else
- pattern = \"subl3 %2,%1,%0\";
- }
- if (pattern)
- output_asm_insn (pattern, low);
- if (carry)
- {
- if (!rtx_equal_p (operands[0], operands[1]))
- return \"movl %1,%0\;sbwc %2,%0\";
- return \"sbwc %2,%0\";
- /* %0 = %2 - %1 - C */
- }
- return OUT_FCN (CODE_FOR_subsi3) (operands, insn);
-}")
-
-;;- Multiply instructions.
-
-(define_insn "muldf3"
- [(set (match_operand:DF 0 "general_operand" "=g,g,g")
- (mult:DF (match_operand:DF 1 "general_operand" "0,gF,gF")
- (match_operand:DF 2 "general_operand" "gF,0,gF")))]
- ""
- "@
- mul%#2 %2,%0
- mul%#2 %1,%0
- mul%#3 %1,%2,%0")
-
-(define_insn "mulsf3"
- [(set (match_operand:SF 0 "general_operand" "=g,g,g")
- (mult:SF (match_operand:SF 1 "general_operand" "0,gF,gF")
- (match_operand:SF 2 "general_operand" "gF,0,gF")))]
- ""
- "@
- mulf2 %2,%0
- mulf2 %1,%0
- mulf3 %1,%2,%0")
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "general_operand" "=g,g,g")
- (mult:SI (match_operand:SI 1 "general_operand" "0,g,g")
- (match_operand:SI 2 "general_operand" "g,0,g")))]
- ""
- "@
- mull2 %2,%0
- mull2 %1,%0
- mull3 %1,%2,%0")
-
-(define_insn "mulhi3"
- [(set (match_operand:HI 0 "general_operand" "=g,g,")
- (mult:HI (match_operand:HI 1 "general_operand" "0,g,g")
- (match_operand:HI 2 "general_operand" "g,0,g")))]
- ""
- "@
- mulw2 %2,%0
- mulw2 %1,%0
- mulw3 %1,%2,%0")
-
-(define_insn "mulqi3"
- [(set (match_operand:QI 0 "general_operand" "=g,g,g")
- (mult:QI (match_operand:QI 1 "general_operand" "0,g,g")
- (match_operand:QI 2 "general_operand" "g,0,g")))]
- ""
- "@
- mulb2 %2,%0
- mulb2 %1,%0
- mulb3 %1,%2,%0")
-
-(define_insn "mulsidi3"
- [(set (match_operand:DI 0 "general_operand" "=g")
- (mult:DI (sign_extend:DI
- (match_operand:SI 1 "nonimmediate_operand" "g"))
- (sign_extend:DI
- (match_operand:SI 2 "nonimmediate_operand" "g"))))]
- ""
- "emul %1,%2,$0,%0")
-
-(define_insn ""
- [(set (match_operand:DI 0 "general_operand" "=g")
- (plus:DI
- (mult:DI (sign_extend:DI
- (match_operand:SI 1 "nonimmediate_operand" "g"))
- (sign_extend:DI
- (match_operand:SI 2 "nonimmediate_operand" "g")))
- (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "g"))))]
- ""
- "emul %1,%2,%3,%0")
-
-;; 'F' constraint means type CONST_DOUBLE
-(define_insn ""
- [(set (match_operand:DI 0 "general_operand" "=g")
- (plus:DI
- (mult:DI (sign_extend:DI
- (match_operand:SI 1 "nonimmediate_operand" "g"))
- (sign_extend:DI
- (match_operand:SI 2 "nonimmediate_operand" "g")))
- (match_operand:DI 3 "immediate_operand" "F")))]
- "GET_CODE (operands[3]) == CONST_DOUBLE
- && CONST_DOUBLE_HIGH (operands[3]) == (CONST_DOUBLE_LOW (operands[3]) >> 31)"
- "*
-{
- if (CONST_DOUBLE_HIGH (operands[3]))
- operands[3] = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (operands[3]));
- return \"emul %1,%2,%3,%0\";
-}")
-
-;;- Divide instructions.
-
-(define_insn "divdf3"
- [(set (match_operand:DF 0 "general_operand" "=g,g")
- (div:DF (match_operand:DF 1 "general_operand" "0,gF")
- (match_operand:DF 2 "general_operand" "gF,gF")))]
- ""
- "@
- div%#2 %2,%0
- div%#3 %2,%1,%0")
-
-(define_insn "divsf3"
- [(set (match_operand:SF 0 "general_operand" "=g,g")
- (div:SF (match_operand:SF 1 "general_operand" "0,gF")
- (match_operand:SF 2 "general_operand" "gF,gF")))]
- ""
- "@
- divf2 %2,%0
- divf3 %2,%1,%0")
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "general_operand" "=g,g")
- (div:SI (match_operand:SI 1 "general_operand" "0,g")
- (match_operand:SI 2 "general_operand" "g,g")))]
- ""
- "@
- divl2 %2,%0
- divl3 %2,%1,%0")
-
-(define_insn "divhi3"
- [(set (match_operand:HI 0 "general_operand" "=g,g")
- (div:HI (match_operand:HI 1 "general_operand" "0,g")
- (match_operand:HI 2 "general_operand" "g,g")))]
- ""
- "@
- divw2 %2,%0
- divw3 %2,%1,%0")
-
-(define_insn "divqi3"
- [(set (match_operand:QI 0 "general_operand" "=g,g")
- (div:QI (match_operand:QI 1 "general_operand" "0,g")
- (match_operand:QI 2 "general_operand" "g,g")))]
- ""
- "@
- divb2 %2,%0
- divb3 %2,%1,%0")
-
-;This is left out because it is very slow;
-;we are better off programming around the "lack" of this insn.
-;(define_insn "divmoddisi4"
-; [(set (match_operand:SI 0 "general_operand" "=g")
-; (div:SI (match_operand:DI 1 "general_operand" "g")
-; (match_operand:SI 2 "general_operand" "g")))
-; (set (match_operand:SI 3 "general_operand" "=g")
-; (mod:SI (match_operand:DI 1 "general_operand" "g")
-; (match_operand:SI 2 "general_operand" "g")))]
-; ""
-; "ediv %2,%1,%0,%3")
-
-;; Bit-and on the vax is done with a clear-bits insn.
-(define_expand "andsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (and:SI (not:SI (match_operand:SI 1 "general_operand" "g"))
- (match_operand:SI 2 "general_operand" "g")))]
- ""
- "
-{
- rtx op1 = operands[1];
-
- /* If there is a constant argument, complement that one. */
- if (GET_CODE (operands[2]) == CONST_INT && GET_CODE (op1) != CONST_INT)
- {
- operands[1] = operands[2];
- operands[2] = op1;
- op1 = operands[1];
- }
-
- if (GET_CODE (op1) == CONST_INT)
- operands[1] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (op1));
- else
- operands[1] = expand_unop (SImode, one_cmpl_optab, op1, 0, 1);
-}")
-
-(define_expand "andhi3"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (and:HI (not:HI (match_operand:HI 1 "general_operand" "g"))
- (match_operand:HI 2 "general_operand" "g")))]
- ""
- "
-{
- rtx op1 = operands[1];
-
- if (GET_CODE (operands[2]) == CONST_INT && GET_CODE (op1) != CONST_INT)
- {
- operands[1] = operands[2];
- operands[2] = op1;
- op1 = operands[1];
- }
-
- if (GET_CODE (op1) == CONST_INT)
- operands[1] = gen_rtx (CONST_INT, VOIDmode, 65535 & ~INTVAL (op1));
- else
- operands[1] = expand_unop (HImode, one_cmpl_optab, op1, 0, 1);
-}")
-
-(define_expand "andqi3"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (and:QI (not:QI (match_operand:QI 1 "general_operand" "g"))
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "
-{
- rtx op1 = operands[1];
-
- if (GET_CODE (operands[2]) == CONST_INT && GET_CODE (op1) != CONST_INT)
- {
- operands[1] = operands[2];
- operands[2] = op1;
- op1 = operands[1];
- }
-
- if (GET_CODE (op1) == CONST_INT)
- operands[1] = gen_rtx (CONST_INT, VOIDmode, 255 & ~INTVAL (op1));
- else
- operands[1] = expand_unop (QImode, one_cmpl_optab, op1, 0, 1);
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g,g")
- (and:SI (not:SI (match_operand:SI 1 "general_operand" "g,g"))
- (match_operand:SI 2 "general_operand" "0,g")))]
- ""
- "@
- bicl2 %1,%0
- bicl3 %1,%2,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g,g")
- (and:HI (not:HI (match_operand:HI 1 "general_operand" "g,g"))
- (match_operand:HI 2 "general_operand" "0,g")))]
- ""
- "@
- bicw2 %1,%0
- bicw3 %1,%2,%0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g,g")
- (and:QI (not:QI (match_operand:QI 1 "general_operand" "g,g"))
- (match_operand:QI 2 "general_operand" "0,g")))]
- ""
- "@
- bicb2 %1,%0
- bicb3 %1,%2,%0")
-
-;; The following used to be needed because constant propagation can
-;; create them starting from the bic insn patterns above. This is no
-;; longer a problem. However, having these patterns allows optimization
-;; opportunities in combine.c.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g,g")
- (and:SI (match_operand:SI 1 "general_operand" "0,g")
- (match_operand:SI 2 "const_int_operand" "n,n")))]
- ""
- "@
- bicl2 %N2,%0
- bicl3 %N2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "general_operand" "=g,g")
- (and:HI (match_operand:HI 1 "general_operand" "0,g")
- (match_operand:HI 2 "const_int_operand" "n,n")))]
- ""
- "@
- bicw2 %H2,%0
- bicw3 %H2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "general_operand" "=g,g")
- (and:QI (match_operand:QI 1 "general_operand" "0,g")
- (match_operand:QI 2 "const_int_operand" "n,n")))]
- ""
- "@
- bicb2 %B2,%0
- bicb3 %B2,%1,%0")
-
-;;- Bit set instructions.
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "general_operand" "=g,g,g")
- (ior:SI (match_operand:SI 1 "general_operand" "0,g,g")
- (match_operand:SI 2 "general_operand" "g,0,g")))]
- ""
- "@
- bisl2 %2,%0
- bisl2 %1,%0
- bisl3 %2,%1,%0")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "general_operand" "=g,g,g")
- (ior:HI (match_operand:HI 1 "general_operand" "0,g,g")
- (match_operand:HI 2 "general_operand" "g,0,g")))]
- ""
- "@
- bisw2 %2,%0
- bisw2 %1,%0
- bisw3 %2,%1,%0")
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "general_operand" "=g,g,g")
- (ior:QI (match_operand:QI 1 "general_operand" "0,g,g")
- (match_operand:QI 2 "general_operand" "g,0,g")))]
- ""
- "@
- bisb2 %2,%0
- bisb2 %1,%0
- bisb3 %2,%1,%0")
-
-;;- xor instructions.
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "general_operand" "=g,g,g")
- (xor:SI (match_operand:SI 1 "general_operand" "0,g,g")
- (match_operand:SI 2 "general_operand" "g,0,g")))]
- ""
- "@
- xorl2 %2,%0
- xorl2 %1,%0
- xorl3 %2,%1,%0")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "general_operand" "=g,g,g")
- (xor:HI (match_operand:HI 1 "general_operand" "0,g,g")
- (match_operand:HI 2 "general_operand" "g,0,g")))]
- ""
- "@
- xorw2 %2,%0
- xorw2 %1,%0
- xorw3 %2,%1,%0")
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "general_operand" "=g,g,g")
- (xor:QI (match_operand:QI 1 "general_operand" "0,g,g")
- (match_operand:QI 2 "general_operand" "g,0,g")))]
- ""
- "@
- xorb2 %2,%0
- xorb2 %1,%0
- xorb3 %2,%1,%0")
-
-(define_insn "negdf2"
- [(set (match_operand:DF 0 "general_operand" "=g")
- (neg:DF (match_operand:DF 1 "general_operand" "gF")))]
- ""
- "mneg%# %1,%0")
-
-(define_insn "negsf2"
- [(set (match_operand:SF 0 "general_operand" "=g")
- (neg:SF (match_operand:SF 1 "general_operand" "gF")))]
- ""
- "mnegf %1,%0")
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (neg:SI (match_operand:SI 1 "general_operand" "g")))]
- ""
- "mnegl %1,%0")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (neg:HI (match_operand:HI 1 "general_operand" "g")))]
- ""
- "mnegw %1,%0")
-
-(define_insn "negqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (neg:QI (match_operand:QI 1 "general_operand" "g")))]
- ""
- "mnegb %1,%0")
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (not:SI (match_operand:SI 1 "general_operand" "g")))]
- ""
- "mcoml %1,%0")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "general_operand" "=g")
- (not:HI (match_operand:HI 1 "general_operand" "g")))]
- ""
- "mcomw %1,%0")
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "general_operand" "=g")
- (not:QI (match_operand:QI 1 "general_operand" "g")))]
- ""
- "mcomb %1,%0")
-
-;; Arithmetic right shift on the vax works by negating the shift count,
-;; then emitting a right shift with the shift count negated. This means
-;; that all actual shift counts in the RTL will be positive. This
-;; prevents converting shifts to ZERO_EXTRACTs with negative positions,
-;; which isn't valid.
-(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "const_int_operand" "n")))]
- ""
- "ashl $%n2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
- (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
- ""
- "ashl %2,%1,%0")
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (ashift:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "*
-{
- if (operands[2] == const1_rtx && rtx_equal_p (operands[0], operands[1]))
- return \"addl2 %0,%0\";
- if (GET_CODE (operands[1]) == REG
- && GET_CODE (operands[2]) == CONST_INT)
- {
- int i = INTVAL (operands[2]);
- if (i == 1)
- return \"addl3 %1,%1,%0\";
- if (i == 2)
- return \"moval 0[%1],%0\";
- if (i == 3)
- return \"movad 0[%1],%0\";
- }
- return \"ashl %2,%1,%0\";
-}")
-
-;; Arithmetic right shift on the vax works by negating the shift count.
-(define_expand "ashrdi3"
- [(set (match_operand:DI 0 "general_operand" "=g")
- (ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "
-{
- operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
-}")
-
-(define_insn "ashldi3"
- [(set (match_operand:DI 0 "general_operand" "=g")
- (ashift:DI (match_operand:DI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "ashq %2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:DI 0 "general_operand" "=g")
- (ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
- (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
- ""
- "ashq %2,%1,%0")
-
-;; We used to have expand_shift handle logical right shifts by using extzv,
-;; but this make it very difficult to do lshrdi3. Since the VAX is the
-;; only machine with this kludge, it's better to just do this with a
-;; define_expand and remove that case from expand_shift.
-
-(define_expand "lshrsi3"
- [(set (match_dup 3)
- (minus:QI (const_int 32)
- (match_dup 4)))
- (set (match_operand:SI 0 "general_operand" "=g")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
- (match_dup 3)
- (match_operand:SI 2 "register_operand" "g")))]
- ""
- "
-{
- operands[3] = gen_reg_rtx (QImode);
- operands[4] = gen_lowpart (QImode, operands[2]);
-}")
-
-;; Rotate right on the vax works by negating the shift count.
-(define_expand "rotrsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (rotatert:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "
-{
- if (GET_CODE (operands[2]) != CONST_INT)
- operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
-}")
-
-(define_insn "rotlsi3"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (rotate:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "general_operand" "g")))]
- ""
- "rotl %2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (rotatert:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "const_int_operand" "n")))]
- ""
- "rotl %R2,%1,%0")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (rotatert:SI (match_operand:SI 1 "general_operand" "g")
- (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
- ""
- "rotl %2,%1,%0")
-
-;This insn is probably slower than a multiply and an add.
-;(define_insn ""
-; [(set (match_operand:SI 0 "general_operand" "=g")
-; (mult:SI (plus:SI (match_operand:SI 1 "general_operand" "g")
-; (match_operand:SI 2 "general_operand" "g"))
-; (match_operand:SI 3 "general_operand" "g")))]
-; ""
-; "index %1,$0x80000000,$0x7fffffff,%3,%2,%0")
-
-;; Special cases of bit-field insns which we should
-;; recognize in preference to the general case.
-;; These handle aligned 8-bit and 16-bit fields,
-;; which can usually be done with move instructions.
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+ro")
- (match_operand:QI 1 "const_int_operand" "n")
- (match_operand:SI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "general_operand" "g"))]
- "(INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
- && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
- && (GET_CODE (operands[0]) == REG
- || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
- "*
-{
- if (REG_P (operands[0]))
- {
- if (INTVAL (operands[2]) != 0)
- return \"insv %3,%2,%1,%0\";
- }
- else
- operands[0]
- = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
-
- CC_STATUS_INIT;
- if (INTVAL (operands[1]) == 8)
- return \"movb %3,%0\";
- return \"movw %3,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=&g")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "ro")
- (match_operand:QI 2 "const_int_operand" "n")
- (match_operand:SI 3 "const_int_operand" "n")))]
- "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
- && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
- && (GET_CODE (operands[1]) == REG
- || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
- "*
-{
- if (REG_P (operands[1]))
- {
- if (INTVAL (operands[3]) != 0)
- return \"extzv %3,%2,%1,%0\";
- }
- else
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- if (INTVAL (operands[2]) == 8)
- return \"movzbl %1,%0\";
- return \"movzwl %1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "ro")
- (match_operand:QI 2 "const_int_operand" "n")
- (match_operand:SI 3 "const_int_operand" "n")))]
- "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
- && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
- && (GET_CODE (operands[1]) == REG
- || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
- "*
-{
- if (REG_P (operands[1]))
- {
- if (INTVAL (operands[3]) != 0)
- return \"extv %3,%2,%1,%0\";
- }
- else
- operands[1]
- = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
-
- if (INTVAL (operands[2]) == 8)
- return \"cvtbl %1,%0\";
- return \"cvtwl %1,%0\";
-}")
-
-;; Register-only SImode cases of bit-field insns.
-
-(define_insn ""
- [(set (cc0)
- (compare
- (sign_extract:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g"))
- (match_operand:SI 3 "general_operand" "g")))]
- ""
- "cmpv %2,%1,%0,%3")
-
-(define_insn ""
- [(set (cc0)
- (compare
- (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
- (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g"))
- (match_operand:SI 3 "general_operand" "g")))]
- ""
- "cmpzv %2,%1,%0,%3")
-
-;; When the field position and size are constant and the destination
-;; is a register, extv and extzv are much slower than a rotate followed
-;; by a bicl or sign extension. Because we might end up choosing ext[z]v
-;; anyway, we can't allow immediate values for the primary source operand.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (sign_extract:SI (match_operand:SI 1 "register_operand" "ro")
- (match_operand:QI 2 "general_operand" "g")
- (match_operand:SI 3 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[3]) != CONST_INT || GET_CODE (operands[2]) != CONST_INT
- || GET_CODE (operands[0]) != REG
- || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16))
- return \"extv %3,%2,%1,%0\";
- if (INTVAL (operands[2]) == 8)
- return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
- return \"rotl %R3,%1,%0\;cvtwl %0,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (zero_extract:SI (match_operand:SI 1 "register_operand" "ro")
- (match_operand:QI 2 "general_operand" "g")
- (match_operand:SI 3 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[3]) != CONST_INT || GET_CODE (operands[2]) != CONST_INT
- || GET_CODE (operands[0]) != REG)
- return \"extzv %3,%2,%1,%0\";
- if (INTVAL (operands[2]) == 8)
- return \"rotl %R3,%1,%0\;movzbl %0,%0\";
- if (INTVAL (operands[2]) == 16)
- return \"rotl %R3,%1,%0\;movzwl %0,%0\";
- if (INTVAL (operands[3]) & 31)
- return \"rotl %R3,%1,%0\;bicl2 %M2,%0\";
- if (rtx_equal_p (operands[0], operands[1]))
- return \"bicl2 %M2,%0\";
- return \"bicl3 %M2,%1,%0\";
-}")
-
-;; Non-register cases.
-;; nonimmediate_operand is used to make sure that mode-ambiguous cases
-;; don't match these (and therefore match the cases above instead).
-
-(define_insn ""
- [(set (cc0)
- (compare
- (sign_extract:SI (match_operand:QI 0 "memory_operand" "m")
- (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g"))
- (match_operand:SI 3 "general_operand" "g")))]
- ""
- "cmpv %2,%1,%0,%3")
-
-(define_insn ""
- [(set (cc0)
- (compare
- (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "rm")
- (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g"))
- (match_operand:SI 3 "general_operand" "g")))]
- ""
- "cmpzv %2,%1,%0,%3")
-
-(define_insn "extv"
- [(set (match_operand:SI 0 "general_operand" "=g")
- (sign_extract:SI (match_operand:QI 1 "memory_operand" "m")
- (match_operand:QI 2 "general_operand" "g")
- (match_operand:SI 3 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) != REG || GET_CODE (operands[2]) != CONST_INT
- || GET_CODE (operands[3]) != CONST_INT
- || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16)
- || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
- || side_effects_p (operands[1])
- || (GET_CODE (operands[1]) == MEM
- && mode_dependent_address_p (XEXP (operands[1], 0))))
- return \"extv %3,%2,%1,%0\";
- if (INTVAL (operands[2]) == 8)
- return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
- return \"rotl %R3,%1,%0\;cvtwl %0,%0\";
-}")
-
-(define_expand "extzv"
- [(set (match_operand:SI 0 "general_operand" "")
- (zero_extract:SI (match_operand:SI 1 "general_operand" "")
- (match_operand:QI 2 "general_operand" "")
- (match_operand:SI 3 "general_operand" "")))]
- ""
- "")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (zero_extract:SI (match_operand:QI 1 "memory_operand" "m")
- (match_operand:QI 2 "general_operand" "g")
- (match_operand:SI 3 "general_operand" "g")))]
- ""
- "*
-{
- if (GET_CODE (operands[0]) != REG || GET_CODE (operands[2]) != CONST_INT
- || GET_CODE (operands[3]) != CONST_INT
- || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
- || side_effects_p (operands[1])
- || (GET_CODE (operands[1]) == MEM
- && mode_dependent_address_p (XEXP (operands[1], 0))))
- return \"extzv %3,%2,%1,%0\";
- if (INTVAL (operands[2]) == 8)
- return \"rotl %R3,%1,%0\;movzbl %0,%0\";
- if (INTVAL (operands[2]) == 16)
- return \"rotl %R3,%1,%0\;movzwl %0,%0\";
- return \"rotl %R3,%1,%0\;bicl2 %M2,%0\";
-}")
-
-(define_expand "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "")
- (match_operand:QI 1 "general_operand" "")
- (match_operand:SI 2 "general_operand" ""))
- (match_operand:SI 3 "general_operand" ""))]
- ""
- "")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+g")
- (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g"))
- (match_operand:SI 3 "general_operand" "g"))]
- ""
- "insv %3,%2,%1,%0")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
- (match_operand:QI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g"))
- (match_operand:SI 3 "general_operand" "g"))]
- ""
- "insv %3,%2,%1,%0")
-
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "jbr %l0")
-
-(define_insn "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jeql %l0")
-
-(define_insn "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jneq %l0")
-
-(define_insn "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgtr %l0")
-
-(define_insn "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgtru %l0")
-
-(define_insn "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jlss %l0")
-
-(define_insn "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jlssu %l0")
-
-(define_insn "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgeq %l0")
-
-(define_insn "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgequ %l0")
-
-(define_insn "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jleq %l0")
-
-(define_insn "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jlequ %l0")
-
-;; Recognize reversed jumps.
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(cc0)
- (const_int 0)])
- (pc)
- (label_ref (match_operand 1 "" ""))))]
- ""
- "j%C0 %l1") ; %C0 negates condition
-
-;; Recognize jbs, jlbs, jbc and jlbc instructions. Note that the operand
-;; of jlbs and jlbc insns are SImode in the hardware. However, if it is
-;; memory, we use QImode in the insn. So we can't use those instructions
-;; for mode-dependent addresses.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,g")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "I,g"))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "@
- jlbs %0,%l2
- jbs %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,g")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "I,g"))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "@
- jlbc %0,%l2
- jbc %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r,r")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "I,g"))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "@
- jlbs %0,%l2
- jbs %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r,r")
- (const_int 1)
- (match_operand:SI 1 "general_operand" "I,g"))
- (const_int 0))
- (label_ref (match_operand 2 "" ""))
- (pc)))]
- ""
- "@
- jlbc %0,%l2
- jbc %1,%0,%l2")
-
-;; Subtract-and-jump and Add-and-jump insns.
-;; These are not used when output is for the Unix assembler
-;; because it does not know how to modify them to reach far.
-
-;; Normal sob insns.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (gt (plus:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- "!TARGET_UNIX_ASM"
- "jsobgtr %0,%l1")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ge (plus:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- "!TARGET_UNIX_ASM"
- "jsobgeq %0,%l1")
-
-;; Normal aob insns. Define a version for when operands[1] is a constant.
-(define_insn ""
- [(set (pc)
- (if_then_else
- (lt (plus:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int 1))
- (match_operand:SI 1 "general_operand" "g"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- "!TARGET_UNIX_ASM"
- "jaoblss %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (lt (match_operand:SI 0 "general_operand" "+g")
- (match_operand:SI 1 "general_operand" "g"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- "!TARGET_UNIX_ASM && GET_CODE (operands[1]) == CONST_INT"
- "jaoblss %P1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (le (plus:SI (match_operand:SI 0 "general_operand" "+g")
- (const_int 1))
- (match_operand:SI 1 "general_operand" "g"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- "!TARGET_UNIX_ASM"
- "jaobleq %1,%0,%l2")
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (le (match_operand:SI 0 "general_operand" "+g")
- (match_operand:SI 1 "general_operand" "g"))
- (label_ref (match_operand 2 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int 1)))]
- "!TARGET_UNIX_ASM && GET_CODE (operands[1]) == CONST_INT"
- "jaobleq %P1,%0,%l2")
-
-;; Something like a sob insn, but compares against -1.
-;; This finds `while (foo--)' which was changed to `while (--foo != -1)'.
-
-(define_insn ""
- [(set (pc)
- (if_then_else
- (ne (match_operand:SI 0 "general_operand" "g")
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
- (set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
- ""
- "decl %0\;jgequ %l1")
-
-;; Note that operand 1 is total size of args, in bytes,
-;; and what the call insn wants is the number of words.
-(define_insn "call_pop"
- [(call (match_operand:QI 0 "memory_operand" "m")
- (match_operand:QI 1 "general_operand" "g"))
- (set (reg:SI 14) (plus:SI (reg:SI 14)
- (match_operand:SI 3 "immediate_operand" "i")))]
- ""
- "*
- if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 255 * 4)
- /* Vax `calls' really uses only one byte of #args, so pop explicitly. */
- return \"calls $0,%0\;addl2 %1,sp\";
- operands[1] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[1]) + 3)/ 4);
- return \"calls %1,%0\";
-")
-
-(define_insn "call_value_pop"
- [(set (match_operand 0 "" "=g")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:QI 2 "general_operand" "g")))
- (set (reg:SI 14) (plus:SI (reg:SI 14)
- (match_operand:SI 4 "immediate_operand" "i")))]
- ""
- "*
- if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 255 * 4)
- /* Vax `calls' really uses only one byte of #args, so pop explicitly. */
- return \"calls $0,%1\;addl2 %2,sp\";
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[2]) + 3)/ 4);
- return \"calls %2,%1\";
-")
-
-;; Define another set of these for the case of functions with no
-;; operands. In that case, combine may simplify the adjustment of sp.
-(define_insn ""
- [(call (match_operand:QI 0 "memory_operand" "m")
- (match_operand:QI 1 "general_operand" "g"))
- (set (reg:SI 14) (reg:SI 14))]
- ""
- "*
- if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 255 * 4)
- /* Vax `calls' really uses only one byte of #args, so pop explicitly. */
- return \"calls $0,%0\;addl2 %1,sp\";
- operands[1] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[1]) + 3)/ 4);
- return \"calls %1,%0\";
-")
-
-(define_insn ""
- [(set (match_operand 0 "" "=g")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:QI 2 "general_operand" "g")))
- (set (reg:SI 14) (reg:SI 14))]
- ""
- "*
- if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 255 * 4)
- /* Vax `calls' really uses only one byte of #args, so pop explicitly. */
- return \"calls $0,%1\;addl2 %2,sp\";
- operands[2] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[2]) + 3)/ 4);
- return \"calls %2,%1\";
-")
-
-;; Call subroutine returning any type.
-
-(define_expand "untyped_call"
- [(parallel [(call (match_operand 0 "" "")
- (const_int 0))
- (match_operand 1 "" "")
- (match_operand 2 "" "")])]
- ""
- "
-{
- int i;
-
- emit_call_insn (gen_call_pop (operands[0], const0_rtx, NULL, const0_rtx));
-
- for (i = 0; i < XVECLEN (operands[2], 0); i++)
- {
- rtx set = XVECEXP (operands[2], 0, i);
- emit_move_insn (SET_DEST (set), SET_SRC (set));
- }
-
- /* The optimizer does not know that the call sets the function value
- registers we stored in the result block. We avoid problems by
- claiming that all hard registers are used and clobbered at this
- point. */
- emit_insn (gen_blockage ());
-
- DONE;
-}")
-
-;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
-;; all of memory. This blocks insns from being moved across this point.
-
-(define_insn "blockage"
- [(unspec_volatile [(const_int 0)] 0)]
- ""
- "")
-
-(define_insn "return"
- [(return)]
- ""
- "ret")
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "nop")
-
-;; This had a wider constraint once, and it had trouble.
-;; If you are tempted to try `g', please don't--it's not worth
-;; the risk we will reopen the same bug.
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "general_operand" "r"))]
- ""
- "jmp (%0)")
-
-;; This is here to accept 5 arguments (as passed by expand_end_case)
-;; and pass the first 4 along to the casesi1 pattern that really does the work.
-(define_expand "casesi"
- [(set (pc)
- (if_then_else (leu (minus:SI (match_operand:SI 0 "general_operand" "g")
- (match_operand:SI 1 "general_operand" "g"))
- (match_operand:SI 2 "general_operand" "g"))
- (plus:SI (sign_extend:SI
- (mem:HI
- (plus:SI (pc)
- (mult:SI (minus:SI (match_dup 0)
- (match_dup 1))
- (const_int 2)))))
- (label_ref:SI (match_operand 3 "" "")))
- (pc)))
- (match_operand 4 "" "")]
- ""
- "
- emit_insn (gen_casesi1 (operands[0], operands[1], operands[2], operands[3]));
- DONE;
-")
-
-(define_insn "casesi1"
- [(set (pc)
- (if_then_else (leu (minus:SI (match_operand:SI 0 "general_operand" "g")
- (match_operand:SI 1 "general_operand" "g"))
- (match_operand:SI 2 "general_operand" "g"))
- (plus:SI (sign_extend:SI
- (mem:HI
- (plus:SI (pc)
- (mult:SI (minus:SI (match_dup 0)
- (match_dup 1))
- (const_int 2)))))
- (label_ref:SI (match_operand 3 "" "")))
- (pc)))]
- ""
- "casel %0,%1,%2")
-
-;; This used to arise from the preceding by simplification
-;; if operand 1 is zero. Perhaps it is no longer necessary.
-(define_insn ""
- [(set (pc)
- (if_then_else (leu (match_operand:SI 0 "general_operand" "g")
- (match_operand:SI 1 "general_operand" "g"))
- (plus:SI (sign_extend:SI
- (mem:HI
- (plus:SI (pc)
- (mult:SI (minus:SI (match_dup 0)
- (const_int 0))
- (const_int 2)))))
- (label_ref:SI (match_operand 3 "" "")))
- (pc)))]
- ""
- "casel %0,$0,%1")
-
-;;- load or push effective address
-;; These come after the move and add/sub patterns
-;; because we don't want pushl $1 turned into pushad 1.
-;; or addl3 r1,r2,r3 turned into movab 0(r1)[r2],r3.
-
-;; It does not work to use constraints to distinguish pushes from moves,
-;; because < matches any autodecrement, not just a push.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:QI 1 "address_operand" "p"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"pushab %a1\";
- else
- return \"movab %a1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:HI 1 "address_operand" "p"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"pushaw %a1\";
- else
- return \"movaw %a1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:SI 1 "address_operand" "p"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"pushal %a1\";
- else
- return \"moval %a1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:DI 1 "address_operand" "p"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"pushaq %a1\";
- else
- return \"movaq %a1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:SF 1 "address_operand" "p"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"pushaf %a1\";
- else
- return \"movaf %a1,%0\";
-}")
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=g")
- (match_operand:DF 1 "address_operand" "p"))]
- ""
- "*
-{
- if (push_operand (operands[0], SImode))
- return \"pushad %a1\";
- else
- return \"movad %a1,%0\";
-}")
-
-;; These used to be peepholes, but it is more straightforward to do them
-;; as single insns. However, we must force the output to be a register
-;; if it is not an offsettable address so that we know that we can assign
-;; to it twice.
-
-;; If we had a good way of evaluating the relative costs, these could be
-;; machine-independent.
-
-;; Optimize extzv ...,z; andl2 ...,z
-;; or ashl ...,z; andl2 ...,z
-;; with other operands constant. This is what the combiner converts the
-;; above sequences to before attempting to recognize the new insn.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=ro")
- (and:SI (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n")))]
- "(INTVAL (operands[3]) & ~((1 << (32 - INTVAL (operands[2]))) - 1)) == 0"
- "*
-{
- unsigned long mask1 = INTVAL (operands[3]);
- unsigned long mask2 = (1 << (32 - INTVAL (operands[2]))) - 1;
-
- if ((mask1 & mask2) != mask1)
- operands[3] = gen_rtx (CONST_INT, VOIDmode, mask1 & mask2);
-
- return \"rotl %R2,%1,%0\;bicl2 %N3,%0\";
-}")
-
-;; left-shift and mask
-;; The only case where `ashl' is better is if the mask only turns off
-;; bits that the ashl would anyways, in which case it should have been
-;; optimized away.
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=ro")
- (and:SI (ashift:SI (match_operand:SI 1 "general_operand" "g")
- (match_operand:QI 2 "const_int_operand" "n"))
- (match_operand:SI 3 "const_int_operand" "n")))]
- ""
- "*
-{
- operands[3] = gen_rtx (CONST_INT, VOIDmode,
- INTVAL (operands[3]) & ~((1 << INTVAL (operands[2])) - 1));
- return \"rotl %2,%1,%0\;bicl2 %N3,%0\";
-}")
diff --git a/gcc/config/vax/vaxv.h b/gcc/config/vax/vaxv.h
deleted file mode 100644
index 57dff406b91..00000000000
--- a/gcc/config/vax/vaxv.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Definitions of target machine for GNU compiler. Vax sysV version.
- Copyright (C) 1988, 1993, 1996 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. */
-
-/* Cope with these under SysV */
-
-#define SCCS_DIRECTIVE
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dvax -Dunix -Asystem(unix) -Asystem(svr3) -Acpu(vax) -Amachine(vax)"
-
-/* Output #ident as a .ident. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
-
-#undef DBX_DEBUGGING_INFO
-#define SDB_DEBUGGING_INFO
-
-#undef LIB_SPEC
-
-/* The .file command should always begin the output. */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-output_file_directive ((FILE), main_input_filename)
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- fprintf(FILE, "\t.align %d\n", 1 << (LOG))
-
-#undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_LOCAL(FILE,NAME,SIZE,ROUNDED) \
-( data_section (), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ":\n\t.space %u\n", (ROUNDED)))
-
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- unsigned char *s; \
- int i; \
- for (i = 0, s = (PTR); i < (LEN); s++, i++) \
- { \
- if ((i % 8) == 0) \
- fputs ("\n\t.byte\t", (FILE)); \
- fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
- } \
- fputs ("\n", (FILE)); \
-} while (0)
-
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { char dstr[30]; \
- REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", dstr); \
- fprintf (FILE, "\t.double 0d%s\n", dstr); \
- } while (0)
diff --git a/gcc/config/vax/vms.h b/gcc/config/vax/vms.h
deleted file mode 100644
index d8580b5c1a1..00000000000
--- a/gcc/config/vax/vms.h
+++ /dev/null
@@ -1,359 +0,0 @@
-/* Output variables, constants and external declarations, for GNU compiler.
- Copyright (C) 1988, 1994, 1995, 1996, 1997 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. */
-
-#define VMS_TARGET
-
-/* This enables certain macros in vax.h, which will make an indirect
- reference to an external symbol an invalid address. This needs to be
- defined before we include vax.h, since it determines which macros
- are used for GO_IF_*. */
-
-#define NO_EXTERNAL_INDIRECT_ADDRESS
-
-#include "vax/vax.h"
-
-#undef LIB_SPEC
-#undef CPP_PREDEFINES
-#undef TARGET_NAME
-#undef TARGET_DEFAULT
-#undef CALL_USED_REGISTERS
-#undef MAYBE_VMS_FUNCTION_PROLOGUE
-#undef STARTING_FRAME_OFFSET
-
-/* Predefine this in CPP because VMS limits the size of command options
- and GNU CPP is not used on VMS except with GNU C. */
-#define CPP_PREDEFINES \
-"-Dvax -Dvms -DVMS -D__vax__ -D__vms__ -D__VMS__\
- -D__GNUC__=2 -D__GNUC_MINOR__=7 -Asystem(vms) -Acpu(vax) -Amachine(vax)"
-
-/* These match the definitions used in VAXCRTL, the VMS C run-time library */
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-#define WCHAR_TYPE "unsigned int"
-#define WCHAR_TYPE_SIZE 32 /* in bits */
-
-/* Use memcpy for structure copying, and so forth. */
-#define TARGET_MEM_FUNCTIONS
-
-/* Strictly speaking, VMS does not use DBX at all, but the interpreter built
- into gas only speaks straight DBX. */
-
-#define DEFAULT_GDB_EXTENSIONS 0
-
-#define TARGET_DEFAULT 1
-#define TARGET_NAME "vax/vms"
-
-/* The structure return address arrives as an "argument" on VMS. */
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE 0
-#undef PCC_STATIC_STRUCT_RETURN
-
-#define CALL_USED_REGISTERS {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}
-
-/* The run-time library routine VAXC$ESTABLISH (necessary when mixing
- VMS exception handling and setjmp/longjmp in the same program) requires
- that a hidden automatic variable at the top of the stack be reserved
- for its use. We accomplish this by simply adding 4 bytes to the local
- stack for all functions, and making sure that normal local variables
- are 4 bytes lower on the stack then they would otherwise have been. */
-
-#define STARTING_FRAME_OFFSET -4
-
-#define __MAIN_NAME " main("
-/*
- * The MAYBE_VMS_FUNCTION_PROLOGUE macro works for both gcc and g++. It
- * first checks to see if the current routine is "main", which will only
- * happen for GCC, and add the jsb if it is. If is not the case then try and
- * see if __MAIN_NAME is part of current_function_name, which will only happen
- * if we are running g++, and add the jsb if it is. In gcc there should never
- * be a paren in the function name, and in g++ there is always a "(" in the
- * function name, thus there should never be any confusion.
- *
- * Adjusting the stack pointer by 4 before calling C$MAIN_ARGS is required
- * when linking with the VMS POSIX version of the C run-time library; using
- * `subl2 $4,r0' is adequate but we use `clrl -(sp)' instead. The extra 4
- * bytes could be removed after the call because STARTING_FRAME_OFFSET's
- * setting of -4 will end up adding them right back again, but don't bother.
- */
-#define MAYBE_VMS_FUNCTION_PROLOGUE(FILE) \
-{ extern char *current_function_name; \
- char *p = current_function_name; \
- int is_main = strcmp ("main", p) == 0; \
- while (!is_main && *p != '\0') \
- { \
- if (*p == *__MAIN_NAME \
- && strncmp (p, __MAIN_NAME, sizeof __MAIN_NAME - sizeof "") == 0) \
- is_main = 1; \
- else \
- p++; \
- } \
- if (is_main) \
- fprintf (FILE, "\t%s\n\t%s\n", "clrl -(sp)", "jsb _C$MAIN_ARGS"); \
-}
-
-/* This macro definition sets up a default value for `main' to return. */
-#define DEFAULT_MAIN_RETURN c_expand_return (integer_one_node)
-
-/* This makes use of a hook in varasm.c to mark all external variables
- for us. We use this to make sure that external variables are correctly
- addressed. Under VMS there is some brain damage in the linker that requires
- us to do this. */
-
-#define ENCODE_SECTION_INFO(decl) \
- if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#undef ASM_GLOBALIZE_LABEL
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { fputs (".globl ", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
- vms_check_external (NULL_TREE, NAME, 0); \
- } while (0)
-
-/* Under VMS we write the actual size of the storage to be allocated even
- though the symbol is external. Although it is possible to give external
- symbols a size of 0 (as unix does), the VMS linker does not make the
- distinction between a variable definition and an external reference of a
- variable, and thus the linker will not complain about a missing definition.
- If we followed the unix example of giving external symbols a size of
- zero, you tried to link a program where a given variable was externally
- defined but none of the object modules contained a non-extern definition,
- the linker would allocate 0 bytes for the variable, and any attempt to
- use that variable would use the storage allocated to some other variable.
-
- We must also select either const_section or data_section: this will indicate
- whether or not the variable will get the readonly bit set. Since the
- VMS linker does not distinguish between a variable's definition and an
- external reference, all usages of a given variable must have the readonly
- bit set the same way, or the linker will get confused and give warning
- messages. */
-
-/* We used to round the size up to a multiple of 4,
- but that causes linker errors sometimes when the variable was initialized
- since the size of its definition was not likewise rounded up. */
-
-/* Note: the original ASM_OUTPUT_EXTERNAL code has been moved into
- vms_check_external and vms_flush_pending_externals. */
-
-#define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME) \
-{ if (DECL_INITIAL (DECL) == 0 && TREE_CODE (DECL) != FUNCTION_DECL) \
- vms_check_external ((DECL), (NAME), 1); \
-}
-
-/* ASM_OUTPUT_EXTERNAL will have wait until after an initializer is
- completed in order to switch sections for an external object, so
- use the DECLARE_OBJECT hooks to manage deferred declarations. */
-
-/* This is the default action for ASM_DECLARE_OBJECT_NAME, but if it
- is explicitly defined, then ASM_FINISH_DECLARE_OBJECT will be used. */
-
-#define ASM_DECLARE_OBJECT_NAME(ASM_OUT_FILE,NAME,DECL) \
- ASM_OUTPUT_LABEL ((ASM_OUT_FILE), (NAME))
-
-/* We don't need to do anything special to finish the current object, but it
- should now be safe to output any deferred external global declarations. */
-
-#define ASM_FINISH_DECLARE_OBJECT(FILE,DECL,TOPLVL,ATEND) \
- vms_flush_pending_externals(FILE)
-
-/* Anything still pending must be flushed at the very end. */
-
-#define ASM_FILE_END(STREAM) \
- vms_flush_pending_externals(STREAM)
-
-/* Here we redefine ASM_OUTPUT_COMMON to select the data_section or the
- const_section before writing the ".const" assembler directive.
- If we were specifying a size of zero for external variables, we would
- not have to select a section, since the assembler can assume that
- when the size > 0, the storage is for a non-external, uninitialized
- variable (for which a "const" declaration would be senseless),
- and the assembler can make the storage read/write.
-
- Since the ".const" directive specifies the actual size of the storage used
- for both external and non-external variables, the assembler cannot
- make this assumption, and thus it has no way of deciding if storage should
- be read/write or read-only. To resolve this, we give the assembler some
- assistance, in the form of a ".const" or a ".data" directive.
-
- Under GCC 1.40, external variables were declared with a size of zero.
- The GNU assembler, GAS, will recognize the "-2" switch when built for VMS;
- when compiling programs with GCC 2.n this switch should be used or the
- assembler will not give the read-only attribute to external constants.
- Failure to use this switch will result in linker warning messages about
- mismatched psect attributes. */
-
-#undef ASM_OUTPUT_COMMON
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( ((TREE_READONLY (decl) && ! TREE_THIS_VOLATILE (decl)) \
- ? (const_section (), 0) : (data_section (), 0)), \
- fputs (".comm ", (FILE)), \
- assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ",%u\n", (SIZE)))
-
-/* We define this to prevent the name mangler from putting dollar signs into
- function names. This isn't really needed, but it has been here for
- some time and removing it would cause the object files generated by the
- compiler to be incompatible with the object files from a compiler that
- had this defined. Since it does no harm, we leave it in. */
-
-#define NO_DOLLAR_IN_LABEL
-
-/* Add a "const" section. This is viewed by the assembler as being nearly
- the same as the "data" section, with the only difference being that a
- flag is set for variables declared while in the const section. This
- flag is used to determine whether or not the read/write bit should be
- set in the Psect definition. */
-
-#define EXTRA_SECTIONS in_const
-
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-const_section () \
-{ \
- if (in_section != in_const) { \
- fprintf(asm_out_file,".const\n"); \
- in_section = in_const; \
- } \
-}
-
-/* This macro contains the logic to decide which section a variable
- should be stored in. Static constant variables go in the text_section,
- non-const variables go in the data_section, and non-static const
- variables go in the const_section.
-
- Since this macro is used in a number of places, we must also be able
- to decide where to place string constants. */
-
-#define SELECT_SECTION(T,RELOC) \
-{ \
- if (TREE_CODE (T) == VAR_DECL) \
- { \
- if (TREE_READONLY (T) && ! TREE_THIS_VOLATILE (T) \
- && DECL_INITIAL (T) \
- && (DECL_INITIAL (T) == error_mark_node \
- || TREE_CONSTANT (DECL_INITIAL (T)))) \
- { \
- if (TREE_PUBLIC (T)) \
- const_section (); \
- else \
- text_section (); \
- } \
- else \
- data_section (); \
- } \
- if (*tree_code_type[(int) TREE_CODE (T)] == 'c') \
- { \
- if ((TREE_CODE (T) == STRING_CST && flag_writable_strings)) \
- data_section (); \
- else \
- text_section (); \
- } \
-}
-
-/* This is used by a hook in varasm.c to write the assembler directives
- that are needed to tell the startup code which constructors need to
- be run. */
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
-{ \
- fprintf ((FILE),".globl $$PsectAttributes_NOOVR$$__gxx_init_1\n"); \
- data_section(); \
- fprintf ((FILE),"$$PsectAttributes_NOOVR$$__gxx_init_1:\n\t.long\t"); \
- assemble_name ((FILE), (NAME)); \
- fputc ('\n', (FILE)); \
-}
-
-/* This is used by a hook in varasm.c to write the assembler directives
- that are needed to tell the startup code which destructors need to
- be run. */
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
-{ \
- fprintf ((FILE),".globl $$PsectAttributes_NOOVR$$__gxx_clean_1\n"); \
- data_section(); \
- fprintf ((FILE),"$$PsectAttributes_NOOVR$$__gxx_clean_1:\n\t.long\t");\
- assemble_name ((FILE), (NAME)); \
- fputc ('\n', (FILE)); \
-}
-
-/* True for VMS V4.6 and later. */
-#define HAVE_ATEXIT
-
-/* The following definitions are used in libgcc2.c with the __main
- function. The _SHR symbol is used when the sharable image library
- for libg++ is used - this is picked up automatically by the linker
- and this symbol points to the start of the __CTOR_LIST__ from libg++.
- If libg++ is not being used, then __CTOR_LIST_SHR__ occurs just after
- __CTOR_LIST__, and essentially points to the same list as __CTOR_LIST. */
-
-#ifdef L__main
-
-#define __CTOR_LIST__ __gxx_init_0
-#define __CTOR_LIST_END__ __gxx_init_2
-
-#define __CTOR_LIST_SHR__ $$PsectAttributes_NOSHR$$__gxx_init_0_shr
-#define __CTOR_LIST_SHR_END__ $$PsectAttributes_NOSHR$$__gxx_init_2_shr
-
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *p; \
- extern func_ptr __CTOR_LIST__[1], __CTOR_LIST_END__[1]; \
- extern func_ptr __CTOR_LIST_SHR__[1], __CTOR_LIST_SHR_END__[1]; \
- if (&__CTOR_LIST_SHR__[0] != &__CTOR_LIST__[1]) \
- for (p = __CTOR_LIST_SHR__ + 1; p < __CTOR_LIST_SHR_END__ ; p++ ) \
- if (*p) (*p) (); \
- for (p = __CTOR_LIST__ + 1; p < __CTOR_LIST_END__ ; p++ ) \
- if (*p) (*p) (); \
- do { /* arrange for `return' from main() to pass through exit() */ \
- __label__ foo; \
- int *callers_caller_fp = (int *) __builtin_frame_address (3); \
- register int retval asm ("r0"); \
- callers_caller_fp[4] = (int) && foo; \
- break; /* out of do-while block */ \
- foo: \
- exit (retval); \
- } while (0); \
-} while (0)
-
-#define __DTOR_LIST__ __gxx_clean_0
-#define __DTOR_LIST_END__ __gxx_clean_2
-
-#define __DTOR_LIST_SHR__ $$PsectAttributes_NOSHR$$__gxx_clean_0_shr
-#define __DTOR_LIST_SHR_END__ $$PsectAttributes_NOSHR$$__gxx_clean_2_shr
-
-#define DO_GLOBAL_DTORS_BODY \
-do { \
- func_ptr *p; \
- extern func_ptr __DTOR_LIST__[1], __DTOR_LIST_END__[1]; \
- extern func_ptr __DTOR_LIST_SHR__[1], __DTOR_LIST_SHR_END__[1]; \
- for (p = __DTOR_LIST__ + 1; p < __DTOR_LIST_END__ ; p++ ) \
- if (*p) (*p) (); \
- if (&__DTOR_LIST_SHR__[0] != &__DTOR_LIST__[1]) \
- for (p = __DTOR_LIST_SHR__ + 1; p < __DTOR_LIST_SHR_END__ ; p++ ) \
- if (*p) (*p) (); \
-} while (0)
-
-#endif /* L__main */
diff --git a/gcc/config/vax/xm-vax.h b/gcc/config/vax/xm-vax.h
deleted file mode 100644
index 219ef2310fa..00000000000
--- a/gcc/config/vax/xm-vax.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Configuration for GNU C-compiler for Vax.
- Copyright (C) 1987, 1993 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-/* This machine doesn't use IEEE floats. */
-#define HOST_FLOAT_FORMAT VAX_FLOAT_FORMAT
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* isinf isn't there, but finite is. */
-#define isinf(x) (!finite(x))
-
diff --git a/gcc/config/vax/xm-vms.h b/gcc/config/vax/xm-vms.h
deleted file mode 100644
index a880491d449..00000000000
--- a/gcc/config/vax/xm-vms.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Configuration for GNU C-compiler for Vax.
- Copyright (C) 1987, 1994, 1995, 1996, 1997 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. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-#if defined(VAXC) || defined(__DECC)
-/* if compiling with VAXC, need to fix problem with <stdio.h>
- which defines a macro called FILE_TYPE that breaks "tree.h".
- Fortunately it uses #ifndef to suppress multiple inclusions.
- Three possible cases:
- 1) <stdio.h> has already been included -- ours will be no-op;
- 2) <stdio.h> will be included after us -- "theirs" will be no-op;
- 3) <stdio.h> isn't needed -- including it here shouldn't hurt.
- In all three cases, the problem macro will be removed here. */
-#include <stdio.h>
-#undef FILE_TYPE
-#endif
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_FLOAT_FORMAT VAX_FLOAT_FORMAT
-
-#define SUCCESS_EXIT_CODE 1
-#define FATAL_EXIT_CODE (44 | 0x10000000) /* Abort, and no DCL message. */
-
-/* A couple of conditionals for execution machine are controlled here. */
-#ifndef VMS
-#define VMS
-#endif
-
-#ifndef __GNUC__
-/* not present, at least in VAX-11 C (VMS) v2.2 */
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#define F_OK 0
-#endif
-
-#define GCC_INCLUDE_DIR "///not used with VMS///" /* nonsense string for now */
-
-/* and define a local equivalent (sort of) for unlink */
-#define unlink remove
-
-/* Specify the list of include file directories. */
-#define INCLUDE_DEFAULTS \
-{ \
- { "GNU_GXX_INCLUDE:", 1, 1 }, \
- { "GNU_CC_INCLUDE:", 0, 0 }, /* GNU includes */ \
- { "SYS$SYSROOT:[SYSLIB.]", 0, 0 }, /* VAX-11 "C" includes */ \
- { ".", 0, 1 }, /* Make normal VMS filespecs work. */ \
- { 0, 0, 0 } \
-}
-
-/* Under VMS a directory specification can be enclosed either in square
- brackets or in angle brackets. Thus we need to check both. This
- macro is used to help compare filenames in cp-lex.c.
-
- We also need to make sure that the names are all lower case, because
- we must be able to compare filenames to determine if a file implements
- a class. */
-
-#define FILE_NAME_NONDIRECTORY(C) \
-({ \
- char * pnt_ = (C), * pnt1_; \
- pnt1_ = pnt_ - 1; \
- while (*++pnt1_) \
- if ((*pnt1_ >= 'A' && *pnt1_ <= 'Z')) *pnt1_ |= 0x20; \
- pnt1_ = rindex (pnt_, ']'); \
- pnt1_ = (pnt1_ == 0 ? rindex (pnt_, '>') : pnt1_); \
- pnt1_ = (pnt1_ == 0 ? rindex (pnt_, ':') : pnt1_); \
- (pnt1_ == 0 ? pnt_ : pnt1_ + 1); \
- })
-
-/* Macro to generate the name of the cross reference file. The standard
- one does not work, since it was written assuming that the conventions
- of a unix style filesystem will work on the host system. */
-
-#define XREF_FILE_NAME(BUFF, NAME) \
- s = FILE_NAME_NONDIRECTORY (NAME); \
- if (s == NAME) sprintf(BUFF, "%s_gxref", NAME); \
- else { \
- strcpy(BUFF, NAME); \
- strcat(BUFF, "_gxref"); \
- }
-
-/* Macro that is used in cp-xref.c to determine whether a file name is
- absolute or not. */
-
-#define FILE_NAME_ABSOLUTE_P(NAME) \
- (FILE_NAME_NONDIRECTORY (NAME) != (&NAME[1]))
-
-/* FILE_NAME_JOINER is defined to be the characters that are inserted between
- a directory name and a filename in order to make an absolute file
- specification. Under VMS the directory specification contains all of the
- required characters, so we define this to be a null string. */
-
-#define FILE_NAME_JOINER ""
-
-/* vprintf() has been available since VMS V4.6. */
-
-#define HAVE_VPRINTF
-
-#if defined(VAXC) || defined(__DECC)
-/* Customizations/kludges for building with DEC's VAX C compiler
- rather than GCC. */
-#define NO_SYS_PARAMS_H /* don't have <sys/params.h> */
-#define NO_STAB_H /* don't have <stab.h> */
-#define USE_C_ALLOCA /* using alloca.c */
-#define QSORT_WORKAROUND /* do not use VAXCRTL's qsort */
-
-/* use ANSI/SYSV style byte manipulation routines instead of BSD ones */
-#define bcopy(s,d,n) memcpy((d),(s),(n))
-#define bzero(d,n) memset((d),0,(n))
-#define bcmp(l,r,n) memcmp((l),(r),(n))
-#define index strchr
-#define rindex strrchr
-
-/* rename all too-long external symbol names to avoid warnings */
-#define bc_check_for_full_enumeration_handling bc_check_for_full_enum_handling
-#define check_for_full_enumeration_handling check_for_full_enum_handling
-#define current_function_contains_functions curfunc_contains_functions
-#define current_function_epilogue_delay_list curfunc_epilogue_delay_list
-#define current_function_has_nonlocal_goto curfunc_has_nonlocal_goto
-#define current_function_has_nonlocal_label curfunc_has_nonlocal_label
-#define current_function_internal_arg_pointer curfunc_internal_arg_pointer
-#define current_function_outgoing_args_size curfunc_outgoing_args_size
-#define current_function_pretend_args_size curfunc_pretend_args_size
-#define current_function_returns_pcc_struct curfunc_returns_pcc_struct
-#define current_function_returns_pointer curfunc_returns_pointer
-#define current_function_uses_const_pool curfunc_uses_const_pool
-#define current_function_uses_pic_offset_table curfunc_uses_pic_offset_table
-#define dbxout_resume_previous_source_file dbxout_resume_previous_src_file
-#define expand_start_loop_continue_elsewhere expnd_start_loop_cont_elsewhere
-#define flag_schedule_insns_after_reload flag_sched_insns_after_reload
-#define lookup_name_current_level_global lookup_name_current_level_gbl
-#define maybe_building_objc_message_expr maybe_building_objc_msg_expr
-#define output_deferred_addressed_constants output_deferred_addr_constants
-#define reg_overlap_mentioned_for_reload_p reg_overlap_mtnd_for_reload_p
-#define reposition_prologue_and_epilogue_notes repos_prolog_and_epilog_notes
-#define rtx_equal_function_value_matters rtx_equal_func_value_matters
-#define set_new_first_and_last_label_num set_new_first_and_last_lbl_num
-#define thread_prologue_and_epilogue_insns thread_prolog_and_epilog_insns
-#endif
-
-/* We need to avoid the library qsort routine, due to a serious bug
- in VAXCRTL. (Sorting anything with size that's not a multiple of 4
- after having previously sorted something that was a multiple of 4
- can produce wrong results and result in data corruption.) We'll
- use our own substitute (in vax.c) instead. */
-/* #define QSORT_WORKAROUND */
-#ifdef QSORT_WORKAROUND
-#define qsort not_qsort
-#endif
-
-#ifdef __DECC
-/* DECC$SHR doesn't have VAXCRTL's bugs. */
-#undef QSORT_WORKAROUND
-#undef qsort
-/* Avoid a lot of informational level diagnostics about implicitly
- declared functions. */
-#include <stdlib.h>
-#include <string.h>
-/* this is for genopinit.c */
- #pragma message disable (undefescap)
-#endif
-
-#if defined(USE_C_ALLOCA) && !defined(alloca)
-/* Declare alloca() using similar logic to that in alloca.c. */
-#ifdef __STDC__
-extern void *alloca(unsigned);
-#else
-extern char *alloca();
-#endif
-#endif
diff --git a/gcc/config/we32k/we32k.c b/gcc/config/we32k/we32k.c
deleted file mode 100644
index 3dceb07e8c9..00000000000
--- a/gcc/config/we32k/we32k.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Subroutines for insn-output.c for AT&T we32000 Family.
- Contributed by John Wehle (john@feith1.uucp)
- Copyright (C) 1991-1992 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 1, 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 <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "real.h"
-
-
-void
-output_move_double (operands)
- rtx *operands;
-{
- rtx lsw_operands[2];
- rtx lsw_sreg = NULL;
- rtx msw_dreg = NULL;
-
- if (GET_CODE (operands[0]) == REG)
- {
- lsw_operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- msw_dreg = operands[0];
- }
- else if (GET_CODE (operands[0]) == MEM && offsettable_memref_p (operands[0]))
- lsw_operands[0] = adj_offsettable_operand (operands[0], 4);
- else
- abort ();
-
- if (GET_CODE (operands[1]) == REG)
- {
- lsw_operands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
- lsw_sreg = lsw_operands[1];
- }
- else if (GET_CODE (operands[1]) == MEM && offsettable_memref_p (operands[1]))
- {
- lsw_operands[1] = adj_offsettable_operand (operands[1], 4);
- lsw_sreg = operands[1];
- for ( ; ; )
- {
- if (REG_P (lsw_sreg))
- break;
- if (CONSTANT_ADDRESS_P (lsw_sreg))
- {
- lsw_sreg = NULL;
- break;
- }
- if (GET_CODE (lsw_sreg) == MEM)
- {
- lsw_sreg = XEXP (lsw_sreg, 0);
- continue;
- }
- if (GET_CODE (lsw_sreg) == PLUS)
- {
- if (CONSTANT_ADDRESS_P (XEXP (lsw_sreg, 1)))
- {
- lsw_sreg = XEXP (lsw_sreg, 0);
- continue;
- }
- else if (CONSTANT_ADDRESS_P (XEXP (lsw_sreg, 0)))
- {
- lsw_sreg = XEXP (lsw_sreg, 1);
- continue;
- }
- }
- abort ();
- }
- }
- else if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- lsw_operands[1] = gen_rtx (CONST_INT, SImode,
- CONST_DOUBLE_HIGH (operands[1]));
- operands[1] = gen_rtx (CONST_INT, SImode,
- CONST_DOUBLE_LOW (operands[1]));
- }
- else if (GET_CODE (operands[1]) == CONST_INT)
- {
- lsw_operands[1] = operands[1];
- operands[1] = const0_rtx;
- }
- else
- abort ();
-
- if (!msw_dreg || !lsw_sreg || REGNO (msw_dreg) != REGNO (lsw_sreg))
- {
- output_asm_insn ("movw %1, %0", operands);
- output_asm_insn ("movw %1, %0", lsw_operands);
- }
- else
- {
- output_asm_insn ("movw %1, %0", lsw_operands);
- output_asm_insn ("movw %1, %0", operands);
- }
-}
-
-void
-output_push_double (operands)
- rtx *operands;
-{
- rtx lsw_operands[1];
-
- if (GET_CODE (operands[0]) == REG)
- lsw_operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
- else if (GET_CODE (operands[0]) == MEM && offsettable_memref_p (operands[0]))
- lsw_operands[0] = adj_offsettable_operand (operands[0], 4);
- else if (GET_CODE (operands[0]) == CONST_DOUBLE)
- {
- lsw_operands[0] = gen_rtx (CONST_INT, SImode,
- CONST_DOUBLE_HIGH (operands[0]));
- operands[0] = gen_rtx (CONST_INT, SImode,
- CONST_DOUBLE_LOW (operands[0]));
- }
- else if (GET_CODE (operands[0]) == CONST_INT)
- {
- lsw_operands[0] = operands[0];
- operands[0] = const0_rtx;
- }
- else
- abort ();
-
- output_asm_insn ("pushw %0", operands);
- output_asm_insn ("pushw %0", lsw_operands);
-}
diff --git a/gcc/config/we32k/we32k.h b/gcc/config/we32k/we32k.h
deleted file mode 100644
index 460fc3d2820..00000000000
--- a/gcc/config/we32k/we32k.h
+++ /dev/null
@@ -1,1047 +0,0 @@
-/* Definitions of target machine for GNU compiler. AT&T we32000 version.
- Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by John Wehle (john@feith1.uucp)
-
-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 1, 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. */
-
-
-/* Names to predefine in the preprocessor for this target machine. */
-
-#define CPP_PREDEFINES "-Dwe32000 -Du3b2 -Dunix -Asystem(unix) -Acpu(we32000) -Amachine(we32000)"
-
-/* Print subsidiary information on the compiler version in use. */
-
-#define TARGET_VERSION fprintf (stderr, " (we32000)");
-
-/* Run-time compilation parameters selecting different hardware subsets. */
-
-extern int target_flags;
-
-/* Macros used in the machine description to test the flags. */
-
-/* Macro to define tables used to set the flags.
- This is a list in braces of pairs in braces,
- each pair being { "NAME", VALUE }
- where VALUE is the bits to set or minus the bits to clear.
- An empty string NAME is used to identify the default VALUE. */
-
-#define TARGET_SWITCHES \
- { { "", TARGET_DEFAULT}}
-
-#define TARGET_DEFAULT 0
-
-
-/* target machine storage layout */
-
-/* Define this if most significant bit is lowest numbered
- in instructions that operate on numbered bit-fields. */
-#define BITS_BIG_ENDIAN 0
-
-/* Define this if most significant byte of a word is the lowest numbered. */
-/* That is true on the we32000. */
-#define BYTES_BIG_ENDIAN 1
-
-/* Define this if most significant word of a multiword is lowest numbered. */
-/* For we32000 we can decide arbitrarily
- since there are no machine instructions for them. */
-#define WORDS_BIG_ENDIAN 1
-
-/* number of bits in an addressable storage unit */
-#define BITS_PER_UNIT 8
-
-/* Width in bits of a "word", which is the contents of a machine register.
- Note that this is not necessarily the width of data type `int';
- if using 16-bit ints on a we32000, this would still be 32.
- But on a machine with 16-bit registers, this would be 16. */
-#define BITS_PER_WORD 32
-
-/* Width of a word, in units (bytes). */
-#define UNITS_PER_WORD 4
-
-/* Width in bits of a pointer.
- See also the macro `Pmode' defined below. */
-#define POINTER_SIZE 32
-
-/* Allocation boundary (in *bits*) for storing arguments in argument list. */
-#define PARM_BOUNDARY 32
-
-/* Boundary (in *bits*) on which stack pointer should be aligned. */
-#define STACK_BOUNDARY 32
-
-/* Allocation boundary (in *bits*) for the code of a function. */
-#define FUNCTION_BOUNDARY 32
-
-/* Alignment of field after `int : 0' in a structure. */
-#define EMPTY_FIELD_BOUNDARY 32
-
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT 32
-
-/* Every structure's size must be a multiple of this. */
-#define STRUCTURE_SIZE_BOUNDARY 32
-
-/* Define this if move instructions will actually fail to work
- when given unaligned data. */
-#define STRICT_ALIGNMENT 1
-
-/* Define number of bits in most basic integer type.
- (If undefined, default is BITS_PER_WORD). */
-#define INT_TYPE_SIZE 32
-
-/* Integer bit fields should have the same size and alignment
- as actual integers */
-#define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Specify the size_t type. */
-#define SIZE_TYPE "unsigned int"
-
-/* Standard register usage. */
-
-/* Number of actual hardware registers.
- The hardware registers are assigned numbers for the compiler
- from 0 to just below FIRST_PSEUDO_REGISTER.
- All registers that the compiler knows about must be given numbers,
- even those that are not normally considered general registers. */
-#define FIRST_PSEUDO_REGISTER 16
-
-/* 1 for registers that have pervasive standard uses
- and are not available for the register allocator. */
-#define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 1, 1, 1, 1, 1, 1, 1, }
-
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
- {1, 1, 1, 0, 0, 0, 0, 0, \
- 0, 1, 1, 1, 1, 1, 1, 1, }
-
-/* Make sure everything's fine if we *don't* have a given processor.
- This assumes that putting a register in fixed_regs will keep the
- compilers mitt's completely off it. We don't bother to zero it out
- of register classes. */
-/* #define CONDITIONAL_REGISTER_USAGE */
-
-/* Return number of consecutive hard regs needed starting at reg REGNO
- to hold something of mode MODE.
- This is ordinarily the length in words of a value of mode MODE
- but can be less for certain modes in special long registers. */
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output. */
-#define MODES_TIEABLE_P(MODE1, MODE2) 0
-
-/* Specify the registers used for certain standard purposes.
- The values of these macros are register numbers. */
-
-/* Register used for the program counter */
-#define PC_REGNUM 15
-
-/* Register to use for pushing function arguments. */
-#define STACK_POINTER_REGNUM 12
-
-/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 9
-
-/* Value should be nonzero if functions must have frame pointers.
- Zero means the frame pointer need not be set up (and parms
- may be accessed via the stack pointer) in functions that seem suitable.
- This is computed in `reload', in reload1.c. */
-#define FRAME_POINTER_REQUIRED 1
-
-/* Base register for access to arguments of the function. */
-#define ARG_POINTER_REGNUM 10
-
-/* Register in which static-chain is passed to a function. */
-#define STATIC_CHAIN_REGNUM 8
-
-/* Register in which address to store a structure value
- is passed to a function. */
-#define STRUCT_VALUE_REGNUM 2
-
-/* Order in which to allocate registers. */
-#define REG_ALLOC_ORDER \
- {0, 1, 8, 7, 6, 5, 4, 3}
-
-/* Define the classes of registers for register constraints in the
- machine description. Also define ranges of constants.
-
- One of the classes must always be named ALL_REGS and include all hard regs.
- If there is more than one class, another class must be named NO_REGS
- and contain no registers.
-
- The name GENERAL_REGS must be the name of a class (or an alias for
- another name such as ALL_REGS). This is the class of registers
- that is allowed by "g" or "r" in a register constraint.
- Also, registers outside this class are allocated only when
- instructions express preferences for them.
-
- The classes must be numbered in nondecreasing order; that is,
- a larger-numbered class must never be contained completely
- in a smaller-numbered class.
-
- For any two classes, it is very desirable that there be another
- class that represents their union. */
-
-enum reg_class { NO_REGS, GENERAL_REGS,
- ALL_REGS, LIM_REG_CLASSES };
-
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-
-/* Give names of register classes as strings for dump file. */
-
-#define REG_CLASS_NAMES \
- { "NO_REGS", "GENERAL_REGS", "ALL_REGS" }
-
-/* Define which registers fit in which classes.
- This is an initializer for a vector of HARD_REG_SET
- of length N_REG_CLASSES. */
-
-#define REG_CLASS_CONTENTS \
-{ \
- 0, /* NO_REGS */ \
- 0x000017ff, /* GENERAL_REGS */ \
- 0x0000ffff, /* ALL_REGS */ \
-}
-
-/* The same information, inverted:
- Return the class number of the smallest class containing
- reg number REGNO. This could be a conditional expression
- or could index an array. */
-
-#define REGNO_REG_CLASS(REGNO) \
- (((REGNO) < 11 || (REGNO) == 12) ? GENERAL_REGS : ALL_REGS)
-
-/* The class value for index registers, and the one for base regs. */
-
-#define INDEX_REG_CLASS NO_REGS
-#define BASE_REG_CLASS GENERAL_REGS
-
-/* Get reg_class from a letter such as appears in the machine description.
- We do a trick here to modify the effective constraints on the
- machine description; we zorch the constraint letters that aren't
- appropriate for a specific target. This allows us to guarantee
- that a specific kind of register will not be used for a given target
- without fiddling with the register classes above. */
-
-#define REG_CLASS_FROM_LETTER(C) \
- ((C) == 'r' ? GENERAL_REGS : NO_REGS)
-
-/* The letters I, J, K, L and M in a register constraint string
- can be used to stand for particular ranges of immediate operands.
- This macro defines what the ranges are.
- C is the letter, and VALUE is a constant value.
- Return 1 if VALUE is in the range specified by C. */
-
-#define CONST_OK_FOR_LETTER_P(VALUE, C) 0
-
-/*
- */
-
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0
-
-/* Given an rtx X being reloaded into a reg required to be
- in class CLASS, return the class of reg to actually use.
- In general this is just CLASS; but on some machines
- in some cases it is preferable to use a more restrictive class. */
-
-#define PREFERRED_RELOAD_CLASS(X,CLASS) (CLASS)
-
-/* Return the maximum number of consecutive registers
- needed to represent mode MODE in a register of class CLASS. */
-#define CLASS_MAX_NREGS(CLASS, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Stack layout; function entry, exit and calling. */
-
-/* Define this if pushing a word on the stack
- makes the stack pointer a smaller address. */
-/* #define STACK_GROWS_DOWNWARD */
-
-/* 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
- goes at a more negative offset in the frame. */
-/* #define FRAME_GROWS_DOWNWARD */
-
-/* Offset within stack frame to start allocating local variables at.
- If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
- first local allocated. Otherwise, it is the offset to the BEGINNING
- of the first local allocated. */
-#define STARTING_FRAME_OFFSET 0
-
-/* If we generate an insn to push BYTES bytes,
- this says how many the stack pointer really advances by. */
-#define PUSH_ROUNDING(BYTES) (((BYTES) + 3) & ~3)
-
-/* Offset of first parameter from the argument pointer register value. */
-#define FIRST_PARM_OFFSET(FNDECL) 0
-
-/* Value is 1 if returning from a function call automatically
- pops the arguments described by the number-of-args field in the call.
- FUNDECL is the declaration node of the function (as a tree),
- FUNTYPE is the data type of the function (as a tree),
- or for a library call it is an identifier node for the subroutine name. */
-
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (SIZE)
-
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-
-/* On the we32000 the return value is in r0 regardless. */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx (REG, TYPE_MODE (VALTYPE), 0)
-
-/* Define how to find the value returned by a library function
- assuming the value has mode MODE. */
-
-/* On the we32000 the return value is in r0 regardless. */
-
-#define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, 0)
-
-/* 1 if N is a possible register number for a function value.
- On the we32000, r0 is the only register thus used. */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
-/* Define this if PCC uses the nonreentrant convention for returning
- structure and union values. */
-
-/* #define PCC_STATIC_STRUCT_RETURN */
-
-/* 1 if N is a possible register number for function argument passing.
- On the we32000, no registers are used in this way. */
-
-#define FUNCTION_ARG_REGNO_P(N) 0
-
-/* Define a data type for recording info about an argument list
- during the scan of that argument list. This data type should
- hold all necessary information about the function itself
- and about the args processed so far, enough to enable macros
- such as FUNCTION_ARG to determine where the next arg should go.
-
- On the we32k, this is a single integer, which is a number of bytes
- of arguments scanned so far. */
-
-#define CUMULATIVE_ARGS int
-
-/* Initialize a variable CUM of type CUMULATIVE_ARGS
- for a call to a function whose data type is FNTYPE.
- For a library call, FNTYPE is 0.
-
- On the we32k, the offset starts at 0. */
-
-#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
- ((CUM) = 0)
-
-/* Update the data in CUM to advance over an argument
- of mode MODE and data type TYPE.
- (TYPE is null for libcalls where that information may not be available.) */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- ((CUM) += ((MODE) != BLKmode \
- ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
- : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the we32000 all args are pushed */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
-
-/* For an arg passed partly in registers and partly in memory,
- this is the number of registers used.
- For args passed entirely in registers or entirely in memory, zero. */
-
-#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
-
-/* This macro generates the assembly code for function entry.
- FILE is a stdio stream to output the code to.
- SIZE is an int: how many units of temporary storage to allocate.
- Refer to the array `regs_ever_live' to determine which registers
- to save; `regs_ever_live[I]' is nonzero if register number I
- is ever used in the function. This macro is responsible for
- knowing which registers should not be saved even if used. */
-
-#define FUNCTION_PROLOGUE(FILE, SIZE) \
-{ register int nregs_to_save; \
- register int regno; \
- extern char call_used_regs[]; \
- nregs_to_save = 0; \
- for (regno = 8; regno > 2; regno--) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- nregs_to_save = (9 - regno); \
- fprintf (FILE, "\tsave &%d\n", nregs_to_save); \
- if (SIZE) \
- fprintf (FILE, "\taddw2 &%d,%%sp\n", ((SIZE) + 3) & ~3); }
-
-/* Output assembler code to FILE to increment profiler label # LABELNO
- for profiling a function entry. */
-
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tmovw &.LP%d,%%r0\n\tjsb _mcount\n", (LABELNO))
-
-/* Output assembler code to FILE to initialize this source file's
- basic block profiling info, if that has not already been done. */
-
-#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \
- fprintf (FILE, "\tcmpw .LPBX0,&0\n\tjne .LPI%d\n\tpushw &.LPBX0\n\tcall &1,__bb_init_func\n.LPI%d:\n", \
- LABELNO, LABELNO);
-
-/* Output assembler code to FILE to increment the entry-count for
- the BLOCKNO'th basic block in this source file. */
-
-#define BLOCK_PROFILER(FILE, BLOCKNO) \
- fprintf (FILE, "\taddw2 &1,.LPBX2+%d\n", 4 * BLOCKNO)
-
-/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
- the stack pointer does not matter. The value is tested only in
- functions that have frame pointers.
- No definition is equivalent to always zero. */
-
-#define EXIT_IGNORE_STACK 0
-
-/* This macro generates the assembly code for function exit,
- on machines that need it. If FUNCTION_EPILOGUE is not defined
- then individual return instructions are generated for each
- return statement. Args are same as for FUNCTION_PROLOGUE.
-
- The function epilogue should not depend on the current stack pointer!
- It should use the frame pointer only. This is mandatory because
- of alloca; we also take advantage of it to omit stack adjustments
- before returning. */
-
-#define FUNCTION_EPILOGUE(FILE, SIZE) \
-{ register int nregs_to_restore; \
- register int regno; \
- extern char call_used_regs[]; \
- nregs_to_restore = 0; \
- for (regno = 8; regno > 2; regno--) \
- if (regs_ever_live[regno] && ! call_used_regs[regno]) \
- nregs_to_restore = (9 - regno); \
- fprintf (FILE, "\tret &%d\n", nregs_to_restore); }
-
-/* Store in the variable DEPTH the initial difference between the
- frame pointer reg contents and the stack pointer reg contents,
- as of the start of the function body. This depends on the layout
- of the fixed parts of the stack frame and on how registers are saved.
-
- On the we32k, FRAME_POINTER_REQUIRED is always 1, so the definition of this
- macro doesn't matter. But it must be defined. */
-
-#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0;
-
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts. */
-
-/* On the we32k, the trampoline contains two instructions:
- mov #STATIC,%r8
- jmp #FUNCTION */
-
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x844f)); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_CHAR (FILE, gen_rtx (CONST_INT, VOIDmode, 0x48)); \
- ASM_OUTPUT_SHORT (FILE, gen_rtx (CONST_INT, VOIDmode, 0x247f)); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
- ASM_OUTPUT_SHORT (FILE, const0_rtx); \
-}
-
-/* Length in units of the trampoline for entering a nested function. */
-
-#define TRAMPOLINE_SIZE 13
-
-/* Emit RTL insns to initialize the variable parts of a trampoline.
- FNADDR is an RTX for the address of the function's pure code.
- CXT is an RTX for the static chain value for the function. */
-
-#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
-{ \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 2)), CXT); \
- emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 9)), FNADDR); \
-}
-
-/* Generate calls to memcpy() and memset() rather
- than bcopy() and bzero() */
-#define TARGET_MEM_FUNCTIONS
-
-/* Addressing modes, and classification of registers for them. */
-
-/* #define HAVE_POST_INCREMENT */
-/* #define HAVE_POST_DECREMENT */
-
-/* #define HAVE_PRE_DECREMENT */
-/* #define HAVE_PRE_INCREMENT */
-
-/* Macros to check register numbers against specific register classes. */
-
-/* These assume that REGNO is a hard or pseudo reg number.
- They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in local-alloc.c. */
-
-#define REGNO_OK_FOR_INDEX_P(REGNO) 0
-
-#define REGNO_OK_FOR_BASE_P(REGNO) \
- ((REGNO) < 11 || (REGNO) == 12 || \
- (unsigned)reg_renumber[REGNO] < 11 || (unsigned)reg_renumber[REGNO] == 12)
-
-/* Maximum number of registers that can appear in a valid memory address. */
-
-#define MAX_REGS_PER_ADDRESS 1
-
-/* Recognize any constant value that is a valid address. */
-
-#define CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
- || GET_CODE (X) == HIGH)
-
-/* Nonzero if the constant value X is a legitimate general operand.
- It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
-
-#define LEGITIMATE_CONSTANT_P(X) 1
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
- and check its validity for a certain class.
- We have two alternate definitions for each of them.
- The usual definition accepts all pseudo regs; the other rejects
- them unless they have been allocated suitable hard regs.
- The symbol REG_OK_STRICT causes the latter definition to be used.
-
- Most source files want to accept pseudo regs in the hope that
- they will get allocated to the class that the insn wants them to be in.
- Source files for reload pass need to be strict.
- After reload, it makes no difference, since pseudo regs have
- been eliminated by then. */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
- or if it is a pseudo reg. */
-#define REG_OK_FOR_INDEX_P(X) 0
-
-/* Nonzero if X is a hard reg that can be used as a base reg
- or if it is a pseudo reg. */
-#define REG_OK_FOR_BASE_P(X) \
- (REGNO(X) < 11 || REGNO(X) == 12 || REGNO(X) >= FIRST_PSEUDO_REGISTER)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index. */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg. */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
-
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address. */
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
-{ register rtx Addr = X; \
- if ((MODE) == QImode || (MODE) == HImode || \
- (MODE) == PSImode || (MODE) == SImode || (MODE) == SFmode) \
- if (GET_CODE(Addr) == MEM) \
- Addr = XEXP(Addr, 0); \
- if (CONSTANT_ADDRESS_P(Addr)) \
- goto LABEL; \
- if (REG_P(Addr) && REG_OK_FOR_BASE_P(Addr)) \
- goto LABEL; \
- if (GET_CODE(Addr) == PLUS && \
- ((REG_P(XEXP(Addr, 0)) && REG_OK_FOR_BASE_P(XEXP(Addr, 0)) && \
- CONSTANT_ADDRESS_P(XEXP(Addr, 1))) || \
- (REG_P(XEXP(Addr, 1)) && REG_OK_FOR_BASE_P(XEXP(Addr, 1)) && \
- CONSTANT_ADDRESS_P(XEXP(Addr, 0))))) \
- goto LABEL; \
-}
-
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address.
- This macro is used in only one place: `memory_address' in explow.c.
-
- OLDX is the address as it was before break_out_memory_refs was called.
- In some cases it is useful to look at this to decide what needs to be done.
-
- MODE and WIN are passed so that this macro can use
- GO_IF_LEGITIMATE_ADDRESS.
-
- It is always safe for this macro to do nothing. It exists to recognize
- opportunities to optimize the output. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) { }
-
-/* Go to LABEL if ADDR (a legitimate address expression)
- has an effect that depends on the machine mode it is used for. */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) { }
-
-/* Specify the machine mode that this machine uses
- for the index in the tablejump instruction. */
-#define CASE_VECTOR_MODE SImode
-
-/* Define this if the tablejump instruction expects the table
- to contain offsets from the address of the table.
- Do not define this if the table should contain absolute addresses. */
-/* #define CASE_VECTOR_PC_RELATIVE */
-
-/* Specify the tree operation to be used to convert reals to integers. */
-#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
-
-/* This is the kind of divide that is easiest to do in the general case. */
-#define EASY_DIV_EXPR TRUNC_DIV_EXPR
-
-/* Define this as 1 if `char' should by default be signed; else as 0. */
-#define DEFAULT_SIGNED_CHAR 0
-
-/* Max number of bytes we can move from memory to memory
- in one reasonably fast instruction. */
-#define MOVE_MAX 4
-
-/* Define this if zero-extension is slow (more than one real instruction). */
-/* #define SLOW_ZERO_EXTEND */
-
-/* Nonzero if access to memory by bytes is slow and undesirable. */
-#define SLOW_BYTE_ACCESS 0
-
-/* Define this to be nonzero if shift instructions ignore all but the low-order
- few bits. */
-#define SHIFT_COUNT_TRUNCATED 1
-
-/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
- is done just by pretending it is already truncated. */
-#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
-
-/* We assume that the store-condition-codes instructions store 0 for false
- and some other value for true. This is the value stored for true. */
-
-#define STORE_FLAG_VALUE -1
-
-/* When a prototype says `char' or `short', really pass an `int'. */
-#define PROMOTE_PROTOTYPES
-
-/* Specify the machine mode that pointers have.
- After generation of rtl, the compiler makes no further distinction
- between pointers and any other objects of this machine mode. */
-#define Pmode SImode
-
-/* A function address in a call instruction
- is a byte address (for indexing purposes)
- so give the MEM rtx a byte's mode. */
-#define FUNCTION_MODE QImode
-
-/* Compute the cost of computing a constant rtl expression RTX
- whose rtx-code is CODE. The body of this macro is a portion
- of a switch statement. If the code is computed here,
- return it with a return statement. Otherwise, break from the switch. */
-
-#define CONST_COSTS(RTX,CODE, OUTER_CODE) \
- case CONST_INT: \
- if (INTVAL (RTX) >= -16 && INTVAL (RTX) <= 63) return 0; \
- if (INTVAL (RTX) >= -128 && INTVAL (RTX) <= 127) return 1; \
- if (INTVAL (RTX) >= -32768 && INTVAL (RTX) <= 32767) return 2; \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 3; \
- case CONST_DOUBLE: \
- return 5;
-
-/* Tell final.c how to eliminate redundant test instructions. */
-
-/* Here we define machine-dependent flags and fields in cc_status
- (see `conditions.h'). */
-
-#define NOTICE_UPDATE_CC(EXP, INSN) \
-{ \
- { CC_STATUS_INIT; } \
-}
-
-/* Control the assembler format that we output. */
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#define STARTFILE_SPEC "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
-
-#define ENDFILE_SPEC "crtn.o%s"
-
-/* The .file command should always begin the output. */
-
-#define ASM_FILE_START(FILE) output_file_directive ((FILE), main_input_filename)
-
-/* Output to assembler file text saying following lines
- may contain character constants, extra white space, comments, etc. */
-
-#define ASM_APP_ON "#APP\n"
-
-/* Output to assembler file text saying following lines
- no longer contain unusual constructs. */
-
-#define ASM_APP_OFF "#NO_APP\n"
-
-/* Output before code. */
-
-#define TEXT_SECTION_ASM_OP ".text"
-
-/* Output before writable data. */
-
-#define DATA_SECTION_ASM_OP ".data"
-
-/* Read-only data goes in the data section because
- AT&T's assembler doesn't guarantee the proper alignment
- of data in the text section even if an align statement
- is used. */
-
-#define READONLY_DATA_SECTION() data_section()
-
-/* How to refer to registers in assembler output.
- This sequence is indexed by compiler's hard-register-number (see above). */
-
-#define REGISTER_NAMES \
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
- "r8", "fp", "ap", "psw", "sp", "pcbp", "isp", "pc" }
-
-/* How to renumber registers for dbx and gdb. */
-
-#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
-
-/* Output SDB debugging info in response to the -g option. */
-
-#define SDB_DEBUGGING_INFO
-
-/* This is how to output the definition of a user-level label named NAME,
- such as the label on a static function or variable NAME. */
-
-#define ASM_OUTPUT_LABEL(FILE,NAME) \
- do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
-
-/* This is how to output a command to make the user-level label named NAME
- defined for reference from other files. */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
- do { \
- fputs (".globl ", FILE); \
- assemble_name (FILE, NAME); \
- fputs ("\n", FILE); \
- } while (0)
-
-/* The prefix to add to user-visible assembler symbols. */
-
-#define USER_LABEL_PREFIX ""
-
-/* This is how to output an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class. */
-
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
- fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
-
-/* This is how to store into the string LABEL
- the symbol_ref name of an internal numbered label where
- PREFIX is the class of label and NUM is the number within the class.
- This is suitable for output with `assemble_name'. */
-
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, ".%s%d", PREFIX, NUM)
-
-/* This is how to output an internal numbered label which
- labels a jump table. */
-
-#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
- do { \
- ASM_OUTPUT_ALIGN (FILE, 2); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \
- } while (0)
-
-/* Assembler pseudo to introduce byte constants. */
-
-#define ASM_BYTE_OP "\t.byte"
-
-/* This is how to output an assembler line defining a `double' constant. */
-
-/* This is how to output an assembler line defining a `float' constant. */
-
-/* AT&T's assembler can't handle floating constants written as floating.
- However, when cross-compiling, always use that in case format differs. */
-
-#ifdef CROSS_COMPILER
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
- fprintf (FILE, "\t.double 0r%.20g\n", (VALUE))
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
- fprintf (FILE, "\t.float 0r%.10g\n", (VALUE))
-
-#else
-
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
-do { union { double d; long l[2];} tem; \
- tem.d = (VALUE); \
- fprintf (FILE, "\t.word 0x%x, 0x%x\n", tem.l[0], tem.l[1]);\
- } while (0)
-
-#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
-do { union { float f; long l;} tem; \
- tem.f = (VALUE); \
- fprintf (FILE, "\t.word 0x%x\n", tem.l); \
- } while (0)
-
-#endif /* not CROSS_COMPILER */
-
-/* This is how to output an assembler line defining an `int' constant. */
-
-#define ASM_OUTPUT_INT(FILE,VALUE) \
-( fprintf (FILE, "\t.word "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* Likewise for `char' and `short' constants. */
-
-#define ASM_OUTPUT_SHORT(FILE,VALUE) \
-( fprintf (FILE, "\t.half "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-#define ASM_OUTPUT_CHAR(FILE,VALUE) \
-( fprintf (FILE, "\t.byte "), \
- output_addr_const (FILE, (VALUE)), \
- fprintf (FILE, "\n"))
-
-/* This is how to output an assembler line for a numeric constant byte. */
-
-#define ASM_OUTPUT_BYTE(FILE,VALUE) \
- fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
-
-#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
-do { \
- unsigned char *s; \
- int i; \
- for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++) \
- { \
- if ((i % 8) == 0) \
- fprintf ((FILE),"%s\t.byte\t",(i?"\n":"")); \
- fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
- } \
- fputs ("\n", (FILE)); \
-} while (0)
-
-/* This is how to output an insn to push a register on the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
- fprintf (FILE, "\tpushw %s\n", reg_names[REGNO])
-
-/* This is how to output an insn to pop a register from the stack.
- It need not be very fast code. */
-
-#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
- fprintf (FILE, "\tPOPW %s\n", reg_names[REGNO])
-
-/* This is how to output an element of a case-vector that is absolute. */
-
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.word .L%d\n", VALUE)
-
-/* This is how to output an element of a case-vector that is relative. */
-
-#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
- fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
-
-/* This is how to output an assembler line
- that says to advance the location counter
- to a multiple of 2**LOG bytes. */
-
-#define ASM_OUTPUT_ALIGN(FILE,LOG) \
- if ((LOG) != 0) \
- fprintf (FILE, "\t.align %d\n", 1 << (LOG))
-
-/* This is how to output an assembler line
- that says to advance the location counter by SIZE bytes. */
-
-/* The `space' pseudo in the text segment outputs nop insns rather than 0s,
- so we must output 0s explicitly in the text segment. */
-
-#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- if (in_text_section ()) \
- { \
- int i; \
- for (i = 0; i < (SIZE) - 20; i += 20) \
- fprintf (FILE, "\t.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n"); \
- if (i < (SIZE)) \
- { \
- fprintf (FILE, "\t.byte 0"); \
- i++; \
- for (; i < (SIZE); i++) \
- fprintf (FILE, ",0"); \
- fprintf (FILE, "\n"); \
- } \
- } \
- else \
- fprintf ((FILE), "\t.set .,.+%u\n", (SIZE))
-
-/* This says how to output an assembler line
- to define a global common symbol. */
-
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
- do { \
- data_section(); \
- fputs ("\t.comm ", (FILE)); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ",%u\n", (SIZE)); \
- } while (0)
-
-/* This says how to output an assembler line
- to define a local common symbol. */
-
-#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
- do { \
- data_section(); \
- ASM_OUTPUT_ALIGN ((FILE), 2); \
- ASM_OUTPUT_LABEL ((FILE), (NAME)); \
- fprintf ((FILE), "\t.zero %u\n", (SIZE)); \
- } while (0)
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable named NAME.
- LABELNO is an integer which is different for each call. */
-
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
-( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
- sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-
-/* Output #ident as a .ident. */
-
-#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME)
-
-/* Define the parentheses used to group arithmetic operations
- in assembler code. */
-
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-
-/* Define results of standard character escape sequences. */
-#define TARGET_BELL 007
-#define TARGET_BS 010
-#define TARGET_TAB 011
-#define TARGET_NEWLINE 012
-#define TARGET_VT 013
-#define TARGET_FF 014
-#define TARGET_CR 015
-
-/* Print operand X (an rtx) in assembler syntax to file FILE.
- CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
- For `%' followed by punctuation, CODE is the punctuation and X is null. */
-
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) 0
-
-#define PRINT_OPERAND(FILE, X, CODE) \
-{ int i; \
- if (GET_CODE (X) == REG) \
- fprintf (FILE, "%%%s", reg_names[REGNO (X)]); \
- else if (GET_CODE (X) == MEM) \
- output_address (XEXP (X, 0)); \
- else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
- { \
- union { double d; long l[2]; } dtem; \
- union { float f; long l; } ftem; \
- \
- dtem.l[0] = CONST_DOUBLE_LOW (X); \
- dtem.l[1] = CONST_DOUBLE_HIGH (X); \
- ftem.f = dtem.d; \
- fprintf(FILE, "&0x%lx", ftem.l); \
- } \
- else { putc ('&', FILE); output_addr_const (FILE, X); }}
-
-#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
-{ register rtx Addr = ADDR; \
- rtx offset; \
- rtx reg; \
- if (GET_CODE (Addr) == MEM) { \
- putc ('*', FILE); \
- Addr = XEXP (Addr, 0); \
- if (GET_CODE (Addr) == REG) \
- putc ('0', FILE); \
- } \
- switch (GET_CODE (Addr)) \
- { \
- case REG: \
- fprintf (FILE, "(%%%s)", reg_names[REGNO (Addr)]); \
- break; \
- \
- case PLUS: \
- offset = NULL; \
- if (CONSTANT_ADDRESS_P (XEXP (Addr, 0))) \
- { \
- offset = XEXP (Addr, 0); \
- Addr = XEXP (Addr, 1); \
- } \
- else if (CONSTANT_ADDRESS_P (XEXP (Addr, 1))) \
- { \
- offset = XEXP (Addr, 1); \
- Addr = XEXP (Addr, 0); \
- } \
- else \
- abort(); \
- if (REG_P (Addr)) \
- reg = Addr; \
- else \
- abort(); \
- output_addr_const(FILE, offset); \
- fprintf(FILE, "(%%%s)", reg_names[REGNO(reg)]); \
- break; \
- \
- default: \
- if ( !CONSTANT_ADDRESS_P(Addr)) \
- abort(); \
- output_addr_const (FILE, Addr); \
- }}
-
-/*
-Local variables:
-version-control: t
-End:
-*/
diff --git a/gcc/config/we32k/we32k.md b/gcc/config/we32k/we32k.md
deleted file mode 100644
index 216b1ff04e2..00000000000
--- a/gcc/config/we32k/we32k.md
+++ /dev/null
@@ -1,1197 +0,0 @@
-;; Machine description for GNU compiler, AT&T we32000 Version
-;; Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
-;; Contributed by John Wehle (john@feith1.uucp)
-
-;; 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 1, 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.
-
-
-;;- instruction definitions
-
-;;- @@The original PO technology requires these to be ordered by speed,
-;;- @@ so that assigner will pick the fastest.
-
-;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
-
-;;- When naming insn's (operand 0 of define_insn) be careful about using
-;;- names from other targets machine descriptions.
-
-;; move instructions
-
-(define_insn ""
- [(set (match_operand:DF 0 "push_operand" "=m")
- (match_operand:DF 1 "general_operand" "mrF"))]
- ""
- "*
- {
- output_push_double(&operands[1]);
-
- return \"\";
- }")
-
-(define_insn "movdf"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=mr")
- (match_operand:DF 1 "general_operand" "mrF"))]
- ""
- "*
- {
- output_move_double(operands);
-
- return \"\";
- }")
-
-(define_insn ""
- [(set (match_operand:SF 0 "push_operand" "=m")
- (match_operand:SF 1 "general_operand" "mrF"))]
- ""
- "pushw %1")
-
-(define_insn "movsf"
- [(set (match_operand:SF 0 "nonimmediate_operand" "=mr")
- (match_operand:SF 1 "general_operand" "mrF"))]
- ""
- "movw %1, %0")
-
-(define_insn ""
- [(set (match_operand:DI 0 "push_operand" "=m")
- (match_operand:DI 1 "general_operand" "mriF"))]
- ""
- "*
- {
- output_push_double(&operands[1]);
-
- return \"\";
- }")
-
-(define_insn "movdi"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=mr")
- (match_operand:DI 1 "general_operand" "mriF"))]
- ""
- "*
- {
- output_move_double(operands);
-
- return \"\";
- }")
-
-(define_insn ""
- [(set (match_operand:SI 0 "push_operand" "=m")
- (match_operand:SI 1 "general_operand" "mri"))]
- ""
- "pushw %1")
-
-(define_insn "movsi"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (match_operand:SI 1 "general_operand" "mri"))]
- ""
- "movw %1, %0")
-
-(define_insn "movhi"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (match_operand:HI 1 "general_operand" "mri"))]
- ""
- "movh %1, %0")
-
-(define_insn "movqi"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (match_operand:QI 1 "general_operand" "mri"))]
- ""
- "movb %1, %0")
-
-;; add instructions
-
-(define_insn ""
- [(set (match_operand:DI 0 "nonimmediate_operand" "=&or")
- (plus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
- (match_operand:DI 2 "general_operand" "oriF")))]
- ""
- "*
- {
- rtx label[1];
- rtx lsw_operands[3];
-
- if (GET_CODE (operands[0]) == REG)
- lsw_operands[0] = gen_rtx(REG, SImode, REGNO (operands[0]) + 1);
- else
- if (GET_CODE (operands[0]) == MEM && offsettable_memref_p (operands[0]))
- lsw_operands[0] = adj_offsettable_operand(operands[0], 4);
- else
- abort();
-
- if (GET_CODE (operands[2]) == REG)
- lsw_operands[2] = gen_rtx(REG, SImode, REGNO (operands[2]) + 1);
- else
- if (GET_CODE (operands[2]) == MEM && offsettable_memref_p (operands[2]))
- lsw_operands[2] = adj_offsettable_operand(operands[2], 4);
- else
- if (GET_CODE (operands[2]) == CONST_DOUBLE)
- {
- lsw_operands[2] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_HIGH(operands[2]));
- operands[2] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_LOW(operands[2]));
- }
- else
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- lsw_operands[2] = operands[2];
- operands[2] = const0_rtx;
- }
- else
- abort();
-
- label[0] = gen_label_rtx();
- LABEL_NUSES(label[0]) = 1;
-
- output_asm_insn(\"addw2 %2, %0\", operands);
- output_asm_insn(\"addw2 %2, %0\", lsw_operands);
- output_asm_insn(\"BCCB %l0\", label);
- output_asm_insn(\"INCW %0\", operands);
- output_asm_insn(\"%l0:\", label);
-
- return \"\";
- }")
-
-(define_insn "adddi3"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=&or")
- (plus:DI (match_operand:DI 1 "general_operand" "oriF")
- (match_operand:DI 2 "general_operand" "oriF")))]
- ""
- "*
- {
- rtx label[1];
- rtx lsw_operands[3];
-
- if (GET_CODE (operands[0]) == REG)
- lsw_operands[0] = gen_rtx(REG, SImode, REGNO (operands[0]) + 1);
- else
- if (GET_CODE (operands[0]) == MEM && offsettable_memref_p (operands[0]))
- lsw_operands[0] = adj_offsettable_operand(operands[0], 4);
- else
- abort();
-
- if (GET_CODE (operands[1]) == REG)
- lsw_operands[1] = gen_rtx(REG, SImode, REGNO (operands[1]) + 1);
- else
- if (GET_CODE (operands[1]) == MEM && offsettable_memref_p (operands[1]))
- lsw_operands[1] = adj_offsettable_operand(operands[1], 4);
- else
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- lsw_operands[1] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_HIGH(operands[1]));
- operands[1] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_LOW(operands[1]));
- }
- else
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- lsw_operands[1] = operands[1];
- operands[1] = const0_rtx;
- }
- else
- abort();
-
- if (GET_CODE (operands[2]) == REG)
- lsw_operands[2] = gen_rtx(REG, SImode, REGNO (operands[2]) + 1);
- else
- if (GET_CODE (operands[2]) == MEM && offsettable_memref_p (operands[2]))
- lsw_operands[2] = adj_offsettable_operand(operands[2], 4);
- else
- if (GET_CODE (operands[2]) == CONST_DOUBLE)
- {
- lsw_operands[2] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_HIGH(operands[2]));
- operands[2] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_LOW(operands[2]));
- }
- else
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- lsw_operands[2] = operands[2];
- operands[2] = const0_rtx;
- }
- else
- abort();
-
- label[0] = gen_label_rtx();
- LABEL_NUSES(label[0]) = 1;
-
- output_asm_insn(\"addw3 %2, %1, %0\", operands);
- output_asm_insn(\"addw3 %2, %1, %0\", lsw_operands);
- output_asm_insn(\"BCCB %l0\", label);
- output_asm_insn(\"INCW %0\", operands);
- output_asm_insn(\"%l0:\", label);
-
- return \"\";
- }")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "addw2 %2, %0")
-
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (plus:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "addw3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (plus:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "addh2 %2, %0")
-
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (plus:HI (match_operand:HI 1 "general_operand" "mri")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "addh3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (plus:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "addb2 %2, %0")
-
-(define_insn "addqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (plus:QI (match_operand:QI 1 "general_operand" "mri")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "addb3 %2, %1, %0")
-
-;; subtract instructions
-
-(define_insn ""
- [(set (match_operand:DI 0 "nonimmediate_operand" "=&or")
- (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0")
- (match_operand:DI 2 "general_operand" "oriF")))]
- ""
- "*
- {
- rtx label[1];
- rtx lsw_operands[3];
-
- if (GET_CODE (operands[0]) == REG)
- lsw_operands[0] = gen_rtx(REG, SImode, REGNO (operands[0]) + 1);
- else
- if (GET_CODE (operands[0]) == MEM && offsettable_memref_p (operands[0]))
- lsw_operands[0] = adj_offsettable_operand(operands[0], 4);
- else
- abort();
-
- if (GET_CODE (operands[2]) == REG)
- lsw_operands[2] = gen_rtx(REG, SImode, REGNO (operands[2]) + 1);
- else
- if (GET_CODE (operands[2]) == MEM && offsettable_memref_p (operands[2]))
- lsw_operands[2] = adj_offsettable_operand(operands[2], 4);
- else
- if (GET_CODE (operands[2]) == CONST_DOUBLE)
- {
- lsw_operands[2] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_HIGH(operands[2]));
- operands[2] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_LOW(operands[2]));
- }
- else
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- lsw_operands[2] = operands[2];
- operands[2] = const0_rtx;
- }
- else
- abort();
-
- label[0] = gen_label_rtx();
- LABEL_NUSES(label[0]) = 1;
-
- output_asm_insn(\"subw2 %2, %0\", operands);
- output_asm_insn(\"subw2 %2, %0\", lsw_operands);
- output_asm_insn(\"BCCB %l0\", label);
- output_asm_insn(\"DECW %0\", operands);
- output_asm_insn(\"%l0:\", label);
-
- return \"\";
- }")
-
-(define_insn "subdi3"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=&or")
- (minus:DI (match_operand:DI 1 "general_operand" "oriF")
- (match_operand:DI 2 "general_operand" "oriF")))]
- ""
- "*
- {
- rtx label[1];
- rtx lsw_operands[3];
-
- if (GET_CODE (operands[0]) == REG)
- lsw_operands[0] = gen_rtx(REG, SImode, REGNO (operands[0]) + 1);
- else
- if (GET_CODE (operands[0]) == MEM && offsettable_memref_p (operands[0]))
- lsw_operands[0] = adj_offsettable_operand(operands[0], 4);
- else
- abort();
-
- if (GET_CODE (operands[1]) == REG)
- lsw_operands[1] = gen_rtx(REG, SImode, REGNO (operands[1]) + 1);
- else
- if (GET_CODE (operands[1]) == MEM && offsettable_memref_p (operands[1]))
- lsw_operands[1] = adj_offsettable_operand(operands[1], 4);
- else
- if (GET_CODE (operands[1]) == CONST_DOUBLE)
- {
- lsw_operands[1] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_HIGH(operands[1]));
- operands[1] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_LOW(operands[1]));
- }
- else
- if (GET_CODE (operands[1]) == CONST_INT)
- {
- lsw_operands[1] = operands[1];
- operands[1] = const0_rtx;
- }
- else
- abort();
-
- if (GET_CODE (operands[2]) == REG)
- lsw_operands[2] = gen_rtx(REG, SImode, REGNO (operands[2]) + 1);
- else
- if (GET_CODE (operands[2]) == MEM && offsettable_memref_p (operands[2]))
- lsw_operands[2] = adj_offsettable_operand(operands[2], 4);
- else
- if (GET_CODE (operands[2]) == CONST_DOUBLE)
- {
- lsw_operands[2] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_HIGH(operands[2]));
- operands[2] = gen_rtx(CONST_INT, SImode,
- CONST_DOUBLE_LOW(operands[2]));
- }
- else
- if (GET_CODE (operands[2]) == CONST_INT)
- {
- lsw_operands[2] = operands[2];
- operands[2] = const0_rtx;
- }
- else
- abort();
-
- label[0] = gen_label_rtx();
- LABEL_NUSES(label[0]) = 1;
-
- output_asm_insn(\"subw3 %2, %1, %0\", operands);
- output_asm_insn(\"subw3 %2, %1, %0\", lsw_operands);
- output_asm_insn(\"BCCB %l0\", label);
- output_asm_insn(\"DECW %0\", operands);
- output_asm_insn(\"%l0:\", label);
-
- return \"\";
- }")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "subw2 %2, %0")
-
-(define_insn "subsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (minus:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "subw3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "subh2 %2, %0")
-
-(define_insn "subhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (minus:HI (match_operand:HI 1 "general_operand" "mri")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "subh3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "subb2 %2, %0")
-
-(define_insn "subqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (minus:QI (match_operand:QI 1 "general_operand" "mri")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "subb3 %2, %1, %0")
-
-;; signed multiply instructions
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (mult:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "mulw2 %2, %0")
-
-(define_insn "mulsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (mult:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "mulw3 %2, %1, %0")
-
-;; signed divide instructions
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (div:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "divw2 %2, %0")
-
-(define_insn "divsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (div:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "divw3 %2, %1, %0")
-
-;; signed modulus instruction
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (mod:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "modw2 %2, %0")
-
-(define_insn "modsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (mod:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "modw3 %2, %1, %0")
-
-;; unsigned divide instruction
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (udiv:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "udivw2 %2, %0")
-
-(define_insn "udivsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (udiv:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "udivw3 %2, %1, %0")
-
-;; unsigned modulus instruction
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (umod:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "umodw2 %2, %0")
-
-(define_insn "umodsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (umod:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "umodw3 %2, %1, %0")
-
-;; logical-and instructions
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (and:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "andw2 %2, %0")
-
-(define_insn "andsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (and:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "andw3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (and:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "andh2 %2, %0")
-
-(define_insn "andhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (and:HI (match_operand:HI 1 "general_operand" "mri")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "andh3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (and:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "andb2 %2, %0")
-
-(define_insn "andqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (and:QI (match_operand:QI 1 "general_operand" "mri")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "andb3 %2, %1, %0")
-
-;; inclusive-or instructions
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (ior:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "orw2 %2, %0")
-
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (ior:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "orw3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (ior:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "orh2 %2, %0")
-
-(define_insn "iorhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (ior:HI (match_operand:HI 1 "general_operand" "mri")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "orh3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (ior:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "orb2 %2, %0")
-
-(define_insn "iorqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (ior:QI (match_operand:QI 1 "general_operand" "mri")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "orb3 %2, %1, %0")
-
-;; exclusive-or instructions
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (xor:SI (match_operand:SI 1 "nonimmediate_operand" "0")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "xorw2 %2, %0")
-
-(define_insn "xorsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (xor:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "xorw3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (xor:HI (match_operand:HI 1 "nonimmediate_operand" "0")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "xorh2 %2, %0")
-
-(define_insn "xorhi3"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (xor:HI (match_operand:HI 1 "general_operand" "mri")
- (match_operand:HI 2 "general_operand" "mri")))]
- ""
- "xorh3 %2, %1, %0")
-
-(define_insn ""
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (xor:QI (match_operand:QI 1 "nonimmediate_operand" "0")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "xorb2 %2, %0")
-
-(define_insn "xorqi3"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (xor:QI (match_operand:QI 1 "general_operand" "mri")
- (match_operand:QI 2 "general_operand" "mri")))]
- ""
- "xorb3 %2, %1, %0")
-
-;; arithmetic shift instructions
-
-(define_insn "ashlsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (ashift:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "LLSW3 %2, %1, %0")
-
-(define_insn "ashrsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (ashiftrt:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "ARSW3 %2, %1, %0")
-
-;; logical shift instructions
-
-(define_insn "lshrsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (lshiftrt:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "LRSW3 %2, %1, %0")
-
-;; rotate instruction
-
-(define_insn "rotrsi3"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (rotatert: SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "general_operand" "mri")))]
- ""
- "ROTW %2, %1, %0")
-
-;; negate instructions
-
-(define_insn "negsi2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (neg:SI (match_operand:SI 1 "general_operand" "mri")))]
- ""
- "mnegw %1, %0")
-
-(define_insn "neghi2"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (neg:HI (match_operand:HI 1 "general_operand" "mri")))]
- ""
- "mnegh %1, %0")
-
-;; complement instructions
-
-(define_insn "one_cmplsi2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (not:SI (match_operand:SI 1 "general_operand" "mri")))]
- ""
- "mcomw %1, %0")
-
-(define_insn "one_cmplhi2"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (not:HI (match_operand:HI 1 "general_operand" "mri")))]
- ""
- "mcomh %1, %0")
-
-(define_insn "one_cmplqi2"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (not:QI (match_operand:QI 1 "general_operand" "mri")))]
- ""
- "mcomb %1, %0")
-
-;; test instruction
-
-;; We don't want to allow a constant operand for test insns because
-;; (set (cc0) (const_int foo)) has no mode information. Such insns will
-;; be folded while optimizing anyway.
-
-(define_insn "tstsi"
- [(set (cc0) (match_operand:SI 0 "nonimmediate_operand" "mr"))]
- ""
- "TSTW %0")
-
-(define_insn "tsthi"
- [(set (cc0) (match_operand:HI 0 "nonimmediate_operand" "mr"))]
- ""
- "TSTH %0")
-
-(define_insn "tstqi"
- [(set (cc0) (match_operand:QI 0 "nonimmediate_operand" "mr"))]
- ""
- "TSTB {sbyte}%0")
-
-;; compare instruction
-
-(define_insn "cmpsi"
- [(set (cc0) (compare (match_operand:SI 0 "nonimmediate_operand" "mr")
- (match_operand:SI 1 "general_operand" "mri")))]
- ""
- "CMPW %1, %0")
-
-(define_insn "cmphi"
- [(set (cc0) (compare (match_operand:HI 0 "nonimmediate_operand" "mr")
- (match_operand:HI 1 "general_operand" "mri")))]
- ""
- "*
- {
-
- if (GET_CODE (operands[1]) == CONST_INT &&
- ((unsigned long)INTVAL (operands[1]) & 0x8000L))
- operands[1] = gen_rtx(CONST_INT, SImode, INTVAL(operands[1]) | 0xffff0000L);
-
- output_asm_insn(\"CMPH %1, %0\",operands);
-
- return \"\";
- }")
-
-(define_insn "cmpqi"
- [(set (cc0) (compare (match_operand:QI 0 "nonimmediate_operand" "mr")
- (match_operand:QI 1 "general_operand" "mri")))]
- ""
- "*
- {
-
- if (GET_CODE (operands[1]) == CONST_INT &&
- ((unsigned long)INTVAL (operands[1]) & 0x80L))
- operands[1] = gen_rtx(CONST_INT, SImode, INTVAL(operands[1]) | 0xffffff00L);
-
- output_asm_insn(\"CMPB {sbyte}%1, {sbyte}%0\",operands);
-
- return \"\";
- }")
-
-;; truncate instructions
-
-(define_insn ""
- [(set (match_operand:SF 0 "register_operand" "=r")
- (float_truncate:SF (match_operand:DF 1 "general_operand" "orF")))
- (clobber (reg:SI 1))
- (clobber (reg:SI 2))]
- "REGNO (operands[0]) == 0"
- "*
- {
- output_push_double(&operands[1]);
- output_asm_insn(\"call &2, _fdtos\", operands);
-
- return \"\";
- }")
-
-(define_expand "truncdfsf2"
- [(parallel [(set (reg:SF 0)
- (float_truncate:SF (match_operand:DF 1 "general_operand" "orF")))
- (clobber (reg:SI 1))
- (clobber (reg:SI 2))])
- (set (match_operand:SF 0 "nonimmediate_operand" "=mr")
- (reg:SF 0))]
- ""
- "")
-
-(define_insn "truncsihi2"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (truncate:HI (match_operand:SI 1 "general_operand" "mri")))]
- ""
- "movtwh %1, %0")
-
-(define_insn "truncsiqi2"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (truncate:QI (match_operand:SI 1 "general_operand" "mri")))]
- ""
- "movtwb %1, %0")
-
-(define_insn "trunchiqi2"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=mr")
- (truncate:QI (match_operand:HI 1 "general_operand" "mri")))]
- ""
- "movthb %1, %0")
-
-;; sign-extend move instructions
-
-(define_insn ""
- [(set (match_operand:DF 0 "register_operand" "=r")
- (float_extend:DF (match_operand:SF 1 "general_operand" "mrF")))
- (clobber (reg:SI 2))]
- "REGNO (operands[0]) == 0"
- "*
- {
- output_asm_insn(\"pushw %1\", operands);
- output_asm_insn(\"call &1, _fstod\", operands);
-
- return \"\";
- }")
-
-(define_expand "extendsfdf2"
- [(parallel [(set (reg:DF 0)
- (float_extend:DF (match_operand:SF 1 "general_operand" "mrF")))
- (clobber (reg:SI 2))])
- (set (match_operand:DF 0 "nonimmediate_operand" "=or")
- (reg:DF 0))]
- ""
- "")
-
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (sign_extend:SI (match_operand:HI 1 "general_operand" "mri")))]
- ""
- "movbhw %1, %0")
-
-(define_insn "extendqisi2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (sign_extend:SI (match_operand:QI 1 "general_operand" "mri")))]
- ""
- "movbbw %1, %0")
-
-(define_insn "extendqihi2"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (sign_extend:HI (match_operand:QI 1 "general_operand" "mri")))]
- ""
- "movbbh %1, %0")
-
-;; zero-extend move instructions
-
-(define_insn "zero_extendhisi2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (zero_extend:SI (match_operand:HI 1 "general_operand" "mri")))]
- ""
- "movzhw %1, %0")
-
-(define_insn "zero_extendqisi2"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (zero_extend:SI (match_operand:QI 1 "general_operand" "mri")))]
- ""
- "movzbw %1, %0")
-
-(define_insn "zero_extendqihi2"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=mr")
- (zero_extend:HI (match_operand:QI 1 "general_operand" "mri")))]
- ""
- "movzbh %1, %0")
-
-;; bit field instructions
-
-(define_insn "extzv"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (zero_extract:SI (match_operand:SI 1 "general_operand" "mri")
- (match_operand:SI 2 "immediate_operand" "i")
- (match_operand:SI 3 "general_operand" "mri")))]
- ""
- "*
- {
-
- operands[2] = gen_rtx(CONST_INT, SImode, INTVAL(operands[2]) - 1);
- output_asm_insn(\"EXTFW %2, %3, %1, %0\",operands);
-
- return \"\";
- }")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (zero_extract:SI (match_operand:HI 1 "general_operand" "mri")
- (match_operand:SI 2 "immediate_operand" "i")
- (match_operand:SI 3 "general_operand" "mri")))]
- ""
- "*
- {
-
- operands[2] = gen_rtx(CONST_INT, SImode, INTVAL(operands[2]) - 1);
- output_asm_insn(\"EXTFH %2, %3, {uhalf}%1, {uword}%0\",operands);
-
- return \"\";
- }")
-
-(define_insn ""
- [(set (match_operand:SI 0 "nonimmediate_operand" "=mr")
- (zero_extract:SI (match_operand:QI 1 "general_operand" "mri")
- (match_operand:SI 2 "immediate_operand" "i")
- (match_operand:SI 3 "general_operand" "mri")))]
- ""
- "*
- {
-
- operands[2] = gen_rtx(CONST_INT, SImode, INTVAL(operands[2]) - 1);
- output_asm_insn(\"EXTFB %2, %3, {ubyte}%1, {uword}%0\",operands);
-
- return \"\";
- }")
-
-(define_insn "insv"
- [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+mr")
- (match_operand:SI 1 "immediate_operand" "i")
- (match_operand:SI 2 "general_operand" "mri"))
- (match_operand:SI 3 "general_operand" "mri"))]
- ""
- "*
- {
-
- operands[1] = gen_rtx(CONST_INT, SImode, INTVAL(operands[1]) - 1);
- output_asm_insn(\"INSFW %1, %2, %3, %0\",operands);
-
- return \"\";
- }")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:HI 0 "nonimmediate_operand" "+mr")
- (match_operand:SI 1 "immediate_operand" "i")
- (match_operand:SI 2 "general_operand" "mri"))
- (match_operand:SI 3 "general_operand" "mri"))]
- ""
- "*
- {
-
- operands[1] = gen_rtx(CONST_INT, SImode, INTVAL(operands[1]) - 1);
- output_asm_insn(\"INSFH %1, %2, {uword}%3, {uhalf}%0\",operands);
-
- return \"\";
- }")
-
-(define_insn ""
- [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+mr")
- (match_operand:SI 1 "immediate_operand" "i")
- (match_operand:SI 2 "general_operand" "mri"))
- (match_operand:SI 3 "general_operand" "mri"))]
- ""
- "*
- {
-
- operands[1] = gen_rtx(CONST_INT, SImode, INTVAL(operands[1]) - 1);
- output_asm_insn(\"INSFB %1, %2, {uword}%3, {ubyte}%0\",operands);
-
- return \"\";
- }")
-
-;; conditional branch instructions
-
-(define_insn "beq"
- [(set (pc) (if_then_else (eq (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "je %l0")
-
-(define_insn "bne"
- [(set (pc) (if_then_else (ne (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jne %l0")
-
-(define_insn "bgt"
- [(set (pc) (if_then_else (gt (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jg %l0")
-
-(define_insn "bgtu"
- [(set (pc) (if_then_else (gtu (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgu %l0")
-
-(define_insn "blt"
- [(set (pc) (if_then_else (lt (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jl %l0")
-
-(define_insn "bltu"
- [(set (pc) (if_then_else (ltu (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jlu %l0")
-
-(define_insn "bge"
- [(set (pc) (if_then_else (ge (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jge %l0")
-
-(define_insn "bgeu"
- [(set (pc) (if_then_else (geu (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jgeu %l0")
-
-(define_insn "ble"
- [(set (pc) (if_then_else (le (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jle %l0")
-
-(define_insn "bleu"
- [(set (pc) (if_then_else (leu (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "jleu %l0")
-
-;; reverse-conditional branch instructions
-
-(define_insn ""
- [(set (pc) (if_then_else (eq (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jne %l0")
-
-(define_insn ""
- [(set (pc) (if_then_else (ne (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "je %l0")
-
-(define_insn ""
- [(set (pc) (if_then_else (gt (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jle %l0")
-
-(define_insn ""
- [(set (pc) (if_then_else (gtu (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jleu %l0")
-
-(define_insn ""
- [(set (pc) (if_then_else (lt (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jge %l0")
-
-(define_insn ""
- [(set (pc) (if_then_else (ltu (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jgeu %l0")
-
-(define_insn ""
- [(set (pc) (if_then_else (ge (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jl %l0")
-
-(define_insn ""
- [(set (pc) (if_then_else (geu (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jlu %l0")
-
-(define_insn ""
- [(set (pc) (if_then_else (le (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jg %l0")
-
-(define_insn ""
- [(set (pc) (if_then_else (leu (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))]
- ""
- "jgu %l0")
-
-;; call instructions
-
-(define_insn "call"
- [(call (match_operand:QI 0 "memory_operand" "m")
- (match_operand:SI 1 "immediate_operand" "i"))]
- ""
- "call %1/4, %0")
-
-(define_insn "call_value"
- [(set (match_operand 0 "register_operand" "=r")
- (call (match_operand:QI 1 "memory_operand" "m")
- (match_operand:SI 2 "immediate_operand" "i")))]
- ""
- "call %2/4, %1")
-
-;; No-op instruction
-
-(define_insn "nop"
- [(const_int 0)]
- ""
- "NOP")
-
-;; jump through a dispatch table instruction
-
-(define_expand "casesi"
- [(use (match_operand:SI 0 "general_operand" "mri"))
- (set (cc0) (compare (match_dup 5)
- (match_operand:SI 1 "general_operand" "mri")))
- (set (pc) (if_then_else (lt (cc0) (const_int 0))
- (label_ref (match_operand 4 "" ""))
- (pc)))
- (set (match_dup 5) (minus:SI (match_dup 5)
- (match_dup 1)))
- (set (cc0) (compare (match_dup 5)
- (match_operand:SI 2 "general_operand" "mri")))
- (set (pc) (if_then_else (gtu (cc0) (const_int 0))
- (label_ref (match_dup 4))
- (pc)))
- (set (match_dup 5) (ashift:SI (match_dup 5)
- (const_int 2)))
- (set (pc) (mem:SI (plus:SI (label_ref (match_operand 3 "" ""))
- (match_dup 5))))]
- ""
- "
- {
- operands[5] = gen_reg_rtx(GET_MODE (operands[0]));
- emit_move_insn(operands[5], operands[0]);
- }")
-
-;; jump instructions
-
-(define_insn "indirect_jump"
- [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
- ""
- "jmp %a0")
-
-(define_insn "jump"
- [(set (pc) (label_ref (match_operand 0 "" "")))]
- ""
- "jmp %l0")
diff --git a/gcc/config/we32k/x-we32k b/gcc/config/we32k/x-we32k
deleted file mode 100644
index 3375d421849..00000000000
--- a/gcc/config/we32k/x-we32k
+++ /dev/null
@@ -1 +0,0 @@
-ALLOCA=alloca.o
diff --git a/gcc/config/we32k/xm-we32k.h b/gcc/config/we32k/xm-we32k.h
deleted file mode 100644
index 70aa35b6bb1..00000000000
--- a/gcc/config/we32k/xm-we32k.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Configuration for GNU C-compiler for AT&T we32000 Family.
- Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
- Contributed by John Wehle (john@feith1.uucp)
-
-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. */
-
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* This describes the machine the compiler is hosted on. */
-#define HOST_BITS_PER_CHAR 8
-#define HOST_BITS_PER_SHORT 16
-#define HOST_BITS_PER_INT 32
-#define HOST_BITS_PER_LONG 32
-#define HOST_BITS_PER_LONGLONG 64
-
-#define HOST_WORDS_BIG_ENDIAN
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* target machine dependencies.
- tm.h is a symbolic link to the actual target specific file. */
-#include "tm.h"
-
-/* Don't try to use sys_siglist. */
-#define NO_SYS_SIGLIST
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 512
-#endif
diff --git a/gcc/config/winnt/config-nt.bat b/gcc/config/winnt/config-nt.bat
deleted file mode 100644
index 688d1264e89..00000000000
--- a/gcc/config/winnt/config-nt.bat
+++ /dev/null
@@ -1,58 +0,0 @@
-echo Configuring GCC for Windows NT on %2
-rem This batch file assumes a unix-type "sed" program
-
-if %2.==alpha. echo #include "alpha/xm-alpha.h" >config.h
-if %2.==alpha. echo #include "winnt/xm-winnt.h" >>config.h
-if %2.==alpha. echo #include "alpha/xm-winnt.h" >>config.h
-if not %2.==alpha. echo #include "%2/xm-winnt.h" >config.h
-copy config.h hconfig.h
-copy config.h tconfig.h
-
-if %2.==alpha. echo #define TARGET_CPU_DEFAULT 64 >tm.h
-if %2.==alpha. echo #include "alpha/alpha.h" >>tm.h
-if %2.==alpha. echo #include "alpha/win-nt.h" >>tm.h
-if not %2.==alpha. echo #include "%2/win-nt.h" >tm.h
-
-rem This batch file assumes a unix-type "sed" program
-
-echo # Makefile generated by "config-nt.bat"> Makefile
-echo all.nt: cpp.exe cc1.exe cc1obj.exe xgcc.exe ld.exe stmp-headers libgcc.lib stmp-float_h specs stamp-objlist>> Makefile
-sed -f config/%2/config-nt.sed -f config/winnt/config-nt.sed Makefile.in >> Makefile
-
-set LANG=
-
-echo # >specs.h
-echo # >options.h
-
-if not exist cp\make-lang.in goto no_cp
-if exist cp\lang-specs.h echo #include "cp/lang-specs.h">>specs.h
-if exist cp\lang-options.h echo #include "cp/lang-options.h">>options.h
-sed -f config/%2/config-nt.sed -f config/winnt/config-nt.sed cp\make-lang.in >> Makefile
-sed -f config/%2/config-nt.sed -f config/winnt/config-nt.sed cp\makefile.in > cp\Makefile
-set LANG=%LANG% c++.#
-:no_cp
-
-if not exist ada\make-lang.in goto no_ada
-if exist ada\lang-specs.h echo #include "ada/lang-specs.h">>specs.h
-if exist ada\lang-options.h echo #include "ada/lang-options.h">>options.h
-sed -f config/%2/config-nt.sed -f config/winnt/config-nt.sed ada\make-lang.in >> Makefile
-sed -f config/%2/config-nt.sed -f config/winnt/config-nt.sed ada\makefile.in > ada\Makefile
-set LANG=%LANG% ada.#
-:no_ada
-
-if not exist f\make-lang.in goto no_f
-if exist f\lang-specs.h echo #include "f/lang-specs.h">>specs.h
-if exist f\lang-options.h echo #include "f/lang-options.h">>options.h
-sed -f config/%2/config-nt.sed -f config/winnt/config-nt.sed f\make-lang.in >> Makefile
-sed -f config/%2/config-nt.sed -f config/winnt/config-nt.sed f\makefile.in > f\Makefile
-set LANG=%LANG% f.#
-:no_f
-
-echo lang.mostlyclean: %LANG% | sed "s/#/mostlyclean/g" >> Makefile
-echo lang.clean: %LANG% | sed "s/#/clean/g" >> Makefile
-echo lang.distclean: %LANG% | sed "s/#/distclean/g" >> Makefile
-echo lang.realclean: %LANG% | sed "s/#/realclean/g" >> Makefile
-
-echo #define MULTILIB_SELECT ". ;" > multilib.h1
-copy multilib.h1 multilib.h
-del multilib.h1
diff --git a/gcc/config/winnt/config-nt.sed b/gcc/config/winnt/config-nt.sed
deleted file mode 100644
index ee0088ad818..00000000000
--- a/gcc/config/winnt/config-nt.sed
+++ /dev/null
@@ -1,130 +0,0 @@
-/^Makefile/,/^ rm -f config.run/d
-s/rm -f/del/
-s/|| cp/|| copy/
-/^config.status/,/ fi/d
-s/config.status//g
-s/\/dev\/null/NUL/g
-s/$(srcdir)\/c-parse/c-parse/g
-s/$(srcdir)\/objc-parse.y/objc-parse.y/g
-s/$(srcdir)\/c-gperf/c-gperf/g
-/^multilib.h/ s/multilib/not-multilib/
-/^xmake_file=/ d
-/^tmake_file=/ d
-/^lang_specs_files=/ d
-/^lang_options_files=/ d
-/^version=/ c\
-version=2.7.2
-s/CC = cc/CC = cl/
-s/^SHELL =.*/SHELL =/
-s/CFLAGS = -g/CFLAGS =/
-s/:\$/: \$/g
-s/<\ *\$(srcdir)\//< $(srcdir)\\/g
-s/^ \$(srcdir)\/move-if-change/ copy/
-s/^USE_/# USE_/
-s/`echo \$(srcdir)\///g
-s/ | sed 's,\^\\\.\/,,'`//g
-s/^ cd \$(srcdir)[ ]*;/ /
-/^stamp-attrtab/,/copy/ {
- /\\$/d
- / fi/d
- /copy/ i\
-\ genattrtab $(md_file) > tmp-attrtab.c
-}
-/^enquire[ ]*:/ s/\$(GCC_PARTS)//g
-/^enquire.o[ ]*:/ s/\$(GCC_PASSES)//g
-/^GCC_FOR_TARGET =/ c\
-GCC_FOR_TARGET = xgcc
-/^ENQUIRE_LDFLAGS =/ c\
-ENQUIRE_LDFLAGS =
-s/; *@true//
-/> *stamp-objlist/ c\
- echo.exe $(OBJS) $(BC_OBJS) | sed -e "s, \([a-z]\), ../\1,g" >stamp-objlist
-/^OBJS.*stamp-objlist/ s?`cat ../stamp-objlist`?@../stamp-objlist?
-s/^\(SUBDIR_OBSTACK *=\).*$/\1 ..\/obstack.o/
-s/^\(SUBDIR_USE_ALLOCA *=\).*$/\1/
-s/^\(SUBDIR_MALLOC *=\).*$/\1/
-/####target/ i\
-STMP_FIXPROTO = \
-OTHER_FIXINCLUDES_DIRS=. \
-RANLIB = : \
-RANLIB_TEST = false \
-OLDCC = cl \
-MAKE = nmake \
-SYMLINK = copy \
-INSTALL = $(srcdir)/install.sh -c \
-exeext = .exe \
-objext = .obj \
-oldobjext = .obj \
-\
-EXTRA_PROGRAMS=ld.exe \
-\
-ld.obj: $(srcdir)/config/winnt/ld.c \
-\ $(CC) $(CFLAGS) \\\
-\ -I. -I$(srcdir) -I$(srcdir)/config -c $(srcdir)/config/winnt/ld.c \
-\
-ld.exe: ld.obj \
- link -out:ld.exe ld.obj $(LDFLAGS) $(CLIB) \
-\
-EXTRA_GCC_OBJS=spawnv.obj oldnames.obj \
-spawnv.obj: $(srcdir)/config/winnt/spawnv.c \
-\ $(CC) $(CFLAGS) \\\
-\ -I. -I$(srcdir) -I$(srcdir)/config -c $(srcdir)/config/winnt/spawnv.c \
-\
-oldnames.obj: $(srcdir)/config/winnt/oldnames.c \
-\ $(CC) $(CFLAGS) \\\
-\ -I. -I$(srcdir) -I$(srcdir)/config -c $(srcdir)/config/winnt/oldnames.c
-s/^C c:/Cc:/
-s/\${OBJS}/\$(OBJS)/g
-s/\${SYSTEM_HEADER_DIR}/\$(SYSTEM_HEADER_DIR)/g
-s/\${HOST_CC}/\$(HOST_CC)/g
-s/ \${srcdir}\// /g
-s/\${mainversion}/\$(mainversion)/g
-s/\ $(srcdir)\/move-if-change$//
-s/\$(srcdir)\/move-if-change/copy/g
-/^# USE_HOST_OBSTACK/ i\
-USE_HOST_OBSTACK=obstack.obj
-/^# USE_ALLOCA/ i\
-USE_ALLOCA=alloca.obj
-/^# USE_HOST_ALLOCA/ i\
-USE_HOST_ALLOCA=alloca.obj
-s/^ALLOCA =/ALLOCA = alloca.obj/
-s/^ALLOCA_FINISH = true/ALLOCA_FINISH =/
-s/ \.\// /
-s/^bi-\([a-z]*\) *:/bi-\1.exe :/
-s/ bi-\([a-z]*\)$/ bi-\1.exe/
-s/ bi-\([a-z]*\) / bi-\1.exe /g
-s/^gen\([a-z]*\) *:/gen\1.exe :/
-s/ gen\([a-z]*\)$/ gen\1.exe/
-s/ gen\([a-z]*\) / gen\1.exe /g
-s/genmultilib.exe/genmultilib/g
-s/^cccp *:/cccp.exe :/
-s/cccp$/cccp.exe/
-s/cccp /cccp.exe /
-s/CCCP=cccp.exe/CCCP=cccp/
-s/(CCCP)$/(CCCP)$(exeext)/
-s/^cpp *:/cpp.exe :/
-s/cpp$/cpp.exe/
-s/cpp /cpp.exe /
-s/^cc1 *:/cc1.exe :/
-s/cc1$/cc1.exe/
-s/cc1 /cc1.exe /
-s/^cc1obj *:/cc1obj.exe :/
-s/cc1obj$/cc1obj.exe/
-s/cc1obj /cc1obj.exe /
-s/^xgcc *:/xgcc.exe :/
-s/xgcc$/xgcc.exe/
-s/xgcc /xgcc.exe /
-s/^enquire *:/enquire.exe :/
-s/enquire$/enquire.exe/
-s/enquire /enquire.exe /
-s/\.o *:/.obj :/
-s/\.o$/.obj/
-s/\.o /.obj /g
-s/-rm -f cpp.exe/del cpp.exe/
-s/\$(CC) \$(ALL_CFLAGS) \$(LDFLAGS) -o /link $(LDFLAGS) -out:/
-s/\$(HOST_CC) \$(HOST_CFLAGS) \$(HOST_LDFLAGS) -o /link $(HOST_LDFLAGS) -out:/
-/^# Build libgcc.a/ r config/winnt/libgcc.mak
-/^# Build libgcc.a/,/ / d
-/^# Build the include directory\./ r config/winnt/headers.mak
-/^# Build the include directory\./,/touch objc-headers/ d
-s/^\ //
diff --git a/gcc/config/winnt/dirent.c b/gcc/config/winnt/dirent.c
deleted file mode 100644
index 59f7dc1c6ef..00000000000
--- a/gcc/config/winnt/dirent.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * @(#)msd_dir.c 1.4 87/11/06 Public Domain.
- *
- * A public domain implementation of BSD directory routines for
- * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
- * August 1897
- *
- * Modified by Ian Stewartson, Data Logic (istewart@datlog.co.uk).
- *
- * Updates: 1. To support OS/2 1.x
- * 2. To support HPFS long filenames
- * 3. To support OS/2 2.x
- * 4. To support TurboC
- * 5. To support Windows NT
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <malloc.h>
-
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include <errno.h>
-#include <dirent.h>
-
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#define FILE_NAME_E cFileName
-#define OS_CloseFH(a) FindClose (a)
-#define FIND_BUFFER WIN32_FIND_DATA
-#define DISABLE_HARD_ERRORS SetErrorMode (0)
-#define ENABLE_HARD_ERRORS SetErrorMode (SEM_FAILCRITICALERRORS | \
- SEM_NOOPENFILEERRORBOX);
-
-# define ERROR_EMPTY_DIR ERROR_FILE_NOT_FOUND
-
-# define ATTRIBUTES (_A_SUBDIR | _A_HIDDEN | _A_SYSTEM | \
- _A_NORMAL | _A_RDONLY | _A_ARCH)
-
-/*
- * missing ??
- */
-
-#ifndef ENOTDIR
-# define ENOTDIR 120 /* Not a directory */
-#endif
-
-#ifndef S_IFMT
-# define S_IFMT 0xf000 /* type of file */
-#endif
-
-#ifndef S_ISDIR
-# define S_ISDIR(m) ((((m) & S_IFMT) == S_IFDIR))
-#endif
-
-/*
- * Internals
- */
-
-typedef struct _dircontents DIRCONT;
-static void free_dircontents (DIRCONT *);
-
-/*
- * Open the directory stream
- */
-
-DIR *
-opendir (name)
- const char *name;
-{
- struct stat statb;
- DIR *dirp;
- char *last;
- DIRCONT *dp;
- char *nbuf;
- int len = strlen (name);
- unsigned long rc;
- FIND_BUFFER dtabuf;
- HANDLE d_handle;
- bool HPFS = FALSE;
-
- if (!len)
- {
- errno = ENOTDIR;
- return (DIR *)NULL;
- }
-
- if ((nbuf = malloc (len + 5)) == (char *)NULL)
- return (DIR *) NULL;
-
- strcpy (nbuf, name);
- last = &nbuf[len - 1];
-
-/* Ok, DOS is very picky about its directory names. The following are
- * valid.
- *
- * c:/
- * c:.
- * c:name/name1
- *
- * c:name/ is not valid
- */
-
- if (((*last == '\\') || (*last == '/')) && (len > 1) &&
- (!((len == 3) && (name[1] == ':'))))
- *(last--) = 0;
-
-/* Check its a directory */
-
- DISABLE_HARD_ERRORS;
- rc = stat (nbuf, &statb);
- ENABLE_HARD_ERRORS;
-
- if (rc)
- {
- free (nbuf);
- return (DIR *) NULL;
- }
-
- if (!S_ISDIR (statb.st_mode))
- {
- free (nbuf);
- errno = ENOTDIR;
- return (DIR *)NULL;
- }
-
- if ((dirp = (DIR *) malloc (sizeof (DIR))) == (DIR *) NULL)
- {
- free (nbuf);
- return (DIR *) NULL;
- }
-
-/* Set up to find everything */
-
- if ((*last != '\\') && (*last != '/'))
- strcat (last, "/");
-
- strcat (last, "*.*");
-
-/* Find the file system type */
-
- HPFS = IsHPFSFileSystem (nbuf);
-
- dirp->dd_loc = 0;
- dirp->dd_cp = (DIRCONT *) NULL;
- dirp->dd_contents = (DIRCONT *) NULL;
-
- DISABLE_HARD_ERRORS;
-
- d_handle = FindFirstFile (nbuf, &dtabuf);
- rc = (d_handle == INVALID_HANDLE_VALUE) ? GetLastError () : 0;
-
- ENABLE_HARD_ERRORS;
-
-/* Check for errors */
-
- if (rc)
- {
- free (nbuf);
-
-/* Empty directory */
-
-#if defined (ERROR_EMPTY_DIR)
- if (rc == ERROR_EMPTY_DIR)
- return dirp;
-#endif
-
- free (dirp);
- return (DIR *) NULL;
- }
-
-/* Process the directory */
-
- do
- {
- if (((dp = (DIRCONT *) malloc (sizeof (DIRCONT))) == (DIRCONT *)NULL) ||
- ((dp->_d_entry = strdup (dtabuf.FILE_NAME_E)) == (char *) NULL))
- {
- if (dp->_d_entry != (char *)NULL)
- free ((char *)dp);
-
- free (nbuf);
- free_dircontents (dirp->dd_contents);
-
- OS_CloseFH (d_handle);
- return (DIR *) NULL;
- }
-
- if (!HPFS)
- strlwr (dp->_d_entry);
-
- if (dirp->dd_contents != (DIRCONT *) NULL)
- dirp->dd_cp = dirp->dd_cp->_d_next = dp;
-
- else
- dirp->dd_contents = dirp->dd_cp = dp;
-
- dp->_d_next = (DIRCONT *) NULL;
-
- } while (FindNextFile (d_handle, &dtabuf));
-
- dirp->dd_cp = dirp->dd_contents;
- free (nbuf);
-
- OS_CloseFH (d_handle);
- return dirp;
-}
-
-
-/*
- * Close the directory stream
- */
-
-int
-closedir (dirp)
- DIR *dirp;
-{
- if (dirp != (DIR *)NULL)
- {
- free_dircontents (dirp->dd_contents);
- free ((char *)dirp);
- }
-
- return 0;
-}
-
-/*
- * Read the next record from the stream
- */
-
-struct dirent *
-readdir (dirp)
- DIR *dirp;
-{
- static struct dirent dp;
-
- if ((dirp == (DIR *)NULL) || (dirp->dd_cp == (DIRCONT *) NULL))
- return (struct dirent *) NULL;
-
- dp.d_reclen = strlen (strcpy (dp.d_name, dirp->dd_cp->_d_entry));
- dp.d_off = dirp->dd_loc * 32;
- dp.d_ino = (ino_t)++dirp->dd_loc;
- dirp->dd_cp = dirp->dd_cp->_d_next;
-
- return &dp;
-}
-
-/*
- * Restart the directory stream
- */
-
-void
-rewinddir (dirp)
- DIR *dirp;
-{
- seekdir (dirp, (off_t)0);
-}
-
-/*
- * Move to a know position in the stream
- */
-
-void
-seekdir (dirp, off)
- DIR *dirp;
- off_t off;
-{
- long i = off;
- DIRCONT *dp;
-
- if ((dirp == (DIR *)NULL) || (off < 0L))
- return;
-
- for (dp = dirp->dd_contents; (--i >= 0) && (dp != (DIRCONT *)NULL);
- dp = dp->_d_next)
- ;
-
- dirp->dd_loc = off - (i + 1);
- dirp->dd_cp = dp;
-}
-
-/*
- * Get the current position
- */
-
-off_t
-telldir(dirp)
- DIR *dirp;
-{
- return (dirp == (DIR *)NULL) ? (off_t) -1 : dirp->dd_loc;
-}
-
-/*
- * Release the internal structure
- */
-
-static void
-free_dircontents (dp)
- DIRCONT *dp;
-{
- DIRCONT *odp;
-
- while ((odp = dp) != (DIRCONT *)NULL)
- {
- if (dp->_d_entry != (char *)NULL)
- free (dp->_d_entry);
-
- dp = dp->_d_next;
- free ((char *)odp);
- }
-}
-
-
-/*
- * Windows NT version
- */
-
-bool
-IsHPFSFileSystem (directory)
- char *directory;
-{
- char bName[4];
- DWORD flags;
- DWORD maxname;
- BOOL rc;
- unsigned int nDrive;
- char szCurDir [MAX_PATH];
-
- if (isalpha (directory[0]) && (directory[1] == ':'))
- nDrive = toupper (directory[0]) - '@';
-
- else
- {
- GetCurrentDirectory (MAX_PATH, szCurDir);
- nDrive = szCurDir[0] - 'A' + 1;
- }
-
-/* Set up the drive name */
-
- strcpy (bName, "x:\\");
- bName[0] = (char) (nDrive + '@');
-
-/* Read the volume info, if we fail - assume non-HPFS */
-
- DISABLE_HARD_ERRORS;
-
- rc = GetVolumeInformation (bName, (LPTSTR)NULL, 0, (LPDWORD)NULL,
- &maxname, &flags, (LPTSTR)NULL, 0);
- ENABLE_HARD_ERRORS;
-
- return ((rc) && (flags & (FS_CASE_SENSITIVE | FS_CASE_IS_PRESERVED)))
- ? TRUE : FALSE;
-}
-
diff --git a/gcc/config/winnt/dirent.h b/gcc/config/winnt/dirent.h
deleted file mode 100644
index 822bd2cab06..00000000000
--- a/gcc/config/winnt/dirent.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * dirent.h
- */
-
-#ifndef _DIRENT_H
-# define _DIRENT_H
-
-# include <sys/types.h>
-# include <limits.h>
-
-#define MAXNAMLEN 255 /* maximum filename length */
-
-#ifndef NAME_MAX
-#define NAME_MAX (MAXNAMLEN - 1)
-#endif
-
-struct dirent /* data from getdents()/readdir() */
-{
- ino_t d_ino; /* inode number of entry */
- off_t d_off; /* offset of disk directory entry */
- wchar_t d_reclen; /* length of this record */
- char d_name[MAXNAMLEN + 1];
-};
-
-
-/* The following nonportable ugliness could have been avoided by defining
- * DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments.
- * There shouldn't be any problem if you avoid using the DIRENTSIZ() macro.
- */
-
-#define DIRENTBASESIZ (((struct dirent *)0)->d_name \
- - (char *)&((struct dirent *)0)->d_ino)
-
-#define DIRENTSIZ(namlen) ((DIRENTBASESIZ + sizeof(long) + (namlen)) \
- / sizeof(long) * sizeof(long))
-
-
-
-# ifndef _BOOL_T_DEFINED
-typedef unsigned char bool;
-# define _BOOL_T_DEFINED
-# endif
-
-# define DIRBUF 8192 /* buffer size for fs-indep. dirs */
- /* must in general be larger than the */
- /* filesystem buffer size */
-
-struct _dircontents {
- char *_d_entry;
- struct _dircontents *_d_next;
-};
-
-typedef struct _dirdesc {
- int dd_id; /* uniquely identify each open directory */
- long dd_loc; /* where we are in directory entry is this */
- struct _dircontents *dd_contents; /* pointer to contents of dir */
- struct _dircontents *dd_cp; /* pointer to current position */
-} DIR;
-
-
-#if defined (__STDC__)
-# define _PROTO(p) p
-#else
-# define _PROTO(p) ()
-# undef const
-# undef volatile
-#endif
-
-/* Functions */
-
-extern DIR * opendir _PROTO ((const char *));
-extern struct dirent * readdir _PROTO ((DIR *));
-extern void rewinddir _PROTO ((DIR *));
-
-extern int closedir _PROTO ((DIR *));
-extern void seekdir _PROTO ((DIR *, off_t));
-extern off_t telldir _PROTO ((DIR *));
-
-extern int chdir _PROTO ((const char *));
-extern char * getcwd _PROTO ((char *, size_t));
-
-extern int mkdir _PROTO ((const char *));
-
-extern int rmdir _PROTO ((const char *));
-extern int scandir _PROTO ((char *,
- struct dirent ***,
- int (*)(const void *, const void *),
- int (*)(const void *, const void *)));
-
-extern int _chdrive _PROTO ((int));
-extern int _getdrive _PROTO ((void));
-extern char * _getdcwd _PROTO ((int, char *, int));
-
-extern bool IsHPFSFileSystem _PROTO ((char *));
-
-#endif
diff --git a/gcc/config/winnt/fixinc-nt.c b/gcc/config/winnt/fixinc-nt.c
deleted file mode 100644
index f49d6dda1bd..00000000000
--- a/gcc/config/winnt/fixinc-nt.c
+++ /dev/null
@@ -1,260 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <io.h>
-#include <fcntl.h>
-#include <process.h>
-
-static char *concat();
-static char *concat3();
-static char *concat4();
-static int onlyonedir;
-static int atleastone;
-static char *fixeddirs, *origdirs;
-
-/* Convert all /'s to \'s */
-
-char *
-slash2slash (dirname)
- char *dirname;
-{
- int i;
- for (i=0; dirname[i]; i++)
- if (dirname [i] == '/')
- dirname [i] = '\\';
-
- return dirname;
-}
-
-/* Examine each directory component of a path and create the directory */
-
-int
-mkdirpath (dirpath)
- char *dirpath;
-{
- char *ndirpath = strdup (dirpath);
- char *bp, *fp;
-
- fp = bp = ndirpath;
-
- while (bp)
- {
- bp = strchr (fp, '\\');
- if (bp)
- {
- *bp = 0;
- _mkdir (ndirpath);
- *bp = '\\';
- fp = ++bp;
- }
- else
- _mkdir (ndirpath);
- }
-}
-
-/* Construct a relative directory path from a given path by removing the
- leading slash, if it exists and changing a drive letter from X: to X-. */
-
-char *
-newname (olddirname)
- char *olddirname;
-{
- char *newname = strdup (olddirname);
-
- if ((strlen (newname) >= 2)
- && (isalpha (newname[0]) && newname[1] == ':'))
- newname [1] = '-';
- else if ((strlen (newname) >= 1)
- && (newname [0] == '/' || newname [0] == '\\'))
- newname = &newname[1];
-
- return newname;
-
-}
-
-/* Run the sed script on one header file. If no modifications were made, then
- delete the newly created file. */
-
-int
-doheader (oneheader, outheader, oldsize)
- char *oneheader, *outheader;
- int oldsize;
-{
- char *newbuff, *oldbuff;
- char *newheader = concat3 ("include", "\\", newname (outheader));
- struct _stat newstatbuf;
- int newdesc, olddesc;
- int i;
-
- system (concat4 ("sed -f fixinc-nt.sed ", oneheader, " > ", newheader));
- _stat (newheader, &newstatbuf);
- if (oldsize != newstatbuf.st_size)
- {
- atleastone = 1;
- printf ("Fixing: %s\n", oneheader);
- return 0;
- }
- oldbuff = malloc (oldsize);
- newbuff = malloc (newstatbuf.st_size);
- olddesc = open (oneheader, _O_RDONLY | _O_BINARY);
- newdesc = open (newheader, _O_RDONLY | _O_BINARY);
- read (olddesc, oldbuff, oldsize);
- read (newdesc, newbuff, newstatbuf.st_size);
- close (olddesc);
- close (newdesc);
- for (i=0; i<oldsize; i++)
- {
- if (oldbuff [i] != newbuff [i])
- {
- free (oldbuff);
- free (newbuff);
- atleastone = 1;
- printf ("Fixing: %s\n", oneheader);
- return 0;
- }
- }
- free (oldbuff);
- free (newbuff);
- unlink (newheader);
- return 0;
-
-}
-
-/* Examine the contents of a directory and call doheader () for a regular file
- and recursively call dodir () for an enclosed directory. */
-
-int
-dodir (indir, outdir)
- char *indir, *outdir;
-{
- DIR *dir;
- struct dirent *dire;
- struct _stat statbuf;
- char *intempbuf, *outtempbuf;
-
- dir = opendir (indir);
- if (!dir) return 0;
-
- mkdirpath (concat3 ("include", "\\", newname (outdir)));
- while ((dire = readdir (dir)))
- {
- if (dire->d_name[0] == '.')
- continue;
-
- intempbuf = slash2slash (concat3 (indir, "\\", dire->d_name));
- outtempbuf = slash2slash (concat3 (outdir, "\\", dire->d_name));
- _stat (intempbuf, &statbuf);
-
- /* If directory ... */
- if (statbuf.st_mode & _S_IFDIR)
- dodir (intempbuf, outtempbuf);
-
- /* If regular file ... */
- if (statbuf.st_mode & _S_IFREG)
- doheader (intempbuf, outtempbuf, statbuf.st_size);
- }
- closedir (dir);
- return 0;
-}
-
-/* Retrieve the value of the Include environment variable, copy it into a
- temporary and append a semi-colon for book-keeping purposes. Then call
- dodir () for each complete directory that is named therein. If there is
- only one directory, then direct the output to use include\. as the
- root instead of include/<directory path>, where <directory path> is a path
- constructed from the path named in the Include environment variable.
- I.e. if Include=C:\MSTOOLS\Include;D:\MSVC20\Include then the modified
- header files will be in include\C-\MSTOOLS\Include and
- include\D-\MSVC20\Include. However if Include=C:\MSTOOLS\Include then the
- modified files will be in include\. */
-
-int
-main ()
-{
- char *fp, *bp, *foobar;
- char *incvar = getenv ("Include");
- int varlen = 0;
- struct _stat statbuf;
-
- if (incvar == NULL) return 0;
-
- varlen = strlen (incvar);
- foobar = (char *) malloc (varlen + 2);
-
- strcpy (foobar, incvar);
- foobar = slash2slash (foobar);
- if (foobar [varlen-1] != ';') strcat (foobar, ";");
- fp = bp = foobar;
-
- if (strchr (fp, ';') == strrchr (fp, ';'))
- onlyonedir = 1;
- else
- onlyonedir = 0;
-
- fixeddirs = strdup(".\\include");
- origdirs = strdup("");
-
- while (bp)
- {
- bp = strchr (fp, ';');
- if (bp)
- {
- *bp = 0;
- _stat (fp, &statbuf);
- if (statbuf.st_mode & _S_IFDIR)
- {
- atleastone = 0;
- if (onlyonedir)
- dodir (fp, ".");
- else
- dodir (fp, fp);
- if (atleastone && !onlyonedir)
- {
- origdirs = concat3 (origdirs, ";", fp);
- fixeddirs = concat3 (fixeddirs, ";",
- concat3 (".\\include", "\\", newname(fp)));
- }
- }
- fp = ++bp;
- }
- }
- printf ("set C_Include_Path=%s%s\n", fixeddirs, origdirs);
- return 0;
-}
-
-/* Utility function that mallocs space and concatenates two strings. */
-
-static char *
-concat (s1, s2)
- char *s1, *s2;
-{
- int len1 = strlen (s1);
- int len2 = strlen (s2);
- char *result = malloc (len1 + len2 + 1);
-
- strcpy (result, s1);
- strcpy (result + len1, s2);
- *(result + len1 + len2) = 0;
-
- return result;
-}
-
-/* Utility function that concatenates three strings. */
-
-static char *
-concat3 (s1, s2, s3)
- char *s1, *s2, *s3;
-{
- return concat (concat (s1, s2), s3);
-}
-
-/* Utility function that concatenates four strings. */
-
-static char *
-concat4 (s1, s2, s3, s4)
- char *s1, *s2, *s3, *s4;
-{
- return concat (concat (s1, s2), concat (s3, s4));
-}
diff --git a/gcc/config/winnt/headers.mak b/gcc/config/winnt/headers.mak
deleted file mode 100644
index 8dec34132fc..00000000000
--- a/gcc/config/winnt/headers.mak
+++ /dev/null
@@ -1,51 +0,0 @@
-# Build the include directory. The stamp files are stmp-* rather than
-# stamp-* so that mostlyclean does not force the include directory to
-# be rebuilt.
-
-
-# Copy in the headers provided with gcc.
-USER_H = $(srcdir)\ginclude\stdarg.h $(srcdir)\ginclude\stddef.h \
- $(srcdir)\ginclude\varargs.h $(srcdir)\ginclude\va-alpha.h \
- $(srcdir)\ginclude\va-h8300.h $(srcdir)\ginclude\va-i860.h \
- $(srcdir)\ginclude\va-i960.h $(srcdir)\ginclude\va-mips.h \
- $(srcdir)\ginclude\va-m88k.h $(srcdir)\ginclude\va-pa.h \
- $(srcdir)\ginclude\va-pyr.h $(srcdir)\ginclude\va-sparc.h \
- $(srcdir)\ginclude\va-clipper.h $(srcdir)\ginclude\va-spur.h \
- $(srcdir)\ginclude\iso646.h \
- $(srcdir)\ginclude\proto.h
-
-# Build the include directory except for float.h (which depends upon
-# enquire).
-
-stmp-int-hdrs: $(USER_H)
- type $(srcdir)\limitx.h >xlimits.h
- type $(srcdir)\glimits.h >>xlimits.h
- type $(srcdir)\limity.h >>xlimits.h
-
- -mkdir include
- for %%f in ($(USER_H)) do copy %%f include
- del include\limits.h
- copy xlimits.h include\limits.h
- del include\syslimits.h
- copy $(srcdir)\gsyslimits.h include\syslimits.h
- copy include\limits.h include\syslimits.h
- del include\README
- copy $(srcdir)\README-fixinc include\README
- touch stmp-int-hdrs
-
-stmp-headers: stmp-int-hdrs fixinc-nt.exe
- fixinc-nt
- touch stmp-headers
-
-# Build float.h.
-stmp-float_h: libgcc.lib enquire.exe
- -.\enquire -f > tmp-float.h
- del include\float.h
- copy tmp-float.h include\float.h
- touch stmp-float_h
-
-fixinc-nt.obj: $(srcdir)/config/winnt/fixinc-nt.c
- cl -c -I. -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/config/winnt $(srcdir)/config/winnt/fixinc-nt.c
-
-fixinc-nt.exe: fixinc-nt.obj dirent.obj
- cl fixinc-nt.obj dirent.obj libc.lib kernel32.lib
diff --git a/gcc/config/winnt/ld.c b/gcc/config/winnt/ld.c
deleted file mode 100644
index 67d53e78321..00000000000
--- a/gcc/config/winnt/ld.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/* Call Windows NT 3.x linker.
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (drupp@cs.washington.edu).
-
-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 <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <string.h>
-#include <process.h>
-
-static char *concat ();
-static char *concat3 ();
-
-/* These can be set by command line arguments */
-char *linker_path = 0;
-int verbose = 0;
-int subsystem = 0;
-int entry = 0;
-
-int link_arg_max = -1;
-char **link_args = (char **) 0;
-int link_arg_index = -1;
-
-char *search_dirs = ".";
-
-static int is_regular_file (char *name);
-
-/* Add the argument contained in STR to the list of arguments to pass to the
- linker */
-
-static void
-addarg (str)
- char *str;
-{
- int i;
-
- if (++link_arg_index >= link_arg_max)
- {
- char **new_link_args
- = (char **) calloc (link_arg_max + 1000, sizeof (char *));
-
- for (i = 0; i <= link_arg_max; i++)
- new_link_args [i] = link_args [i];
-
- if (link_args)
- free (link_args);
-
- link_arg_max += 1000;
- link_args = new_link_args;
- }
-
- link_args [link_arg_index] = str;
-}
-
-/* Locate the file named in FILE_NAME in the set of paths contained in
- PATH_VAL */
-
-static char *
-locate_file (file_name, path_val)
- char *file_name;
- char *path_val;
-{
- char buf [1000];
- int file_len = strlen (file_name);
- char *end_path = path_val + strlen (path_val);
- char *ptr;
-
- /* Handle absolute pathnames */
- if (file_name [0] == '/' || file_name [0] == DIR_SEPARATOR
- || isalpha (file_name [0]) && file_name [1] == ':')
- {
- strncpy (buf, file_name, sizeof buf);
- buf[sizeof buf - 1] = '\0';
- if (is_regular_file (buf))
- return strdup (buf);
- else
- return 0;
- }
-
- if (! path_val)
- return 0;
-
- for (;;)
- {
- for (; *path_val == PATH_SEPARATOR ; path_val++)
- ;
- if (! *path_val)
- return 0;
-
- for (ptr = buf; *path_val && *path_val != PATH_SEPARATOR; )
- *ptr++ = *path_val++;
-
- ptr--;
- if (*ptr != '/' && *ptr != DIR_SEPARATOR)
- *++ptr = DIR_SEPARATOR;
-
- strcpy (++ptr, file_name);
-
- if (is_regular_file (buf))
- return strdup (buf);
- }
-
- return 0;
-}
-
-/* Given a library name in NAME, i.e. foo. Look first for libfoo.lib and then
- libfoo.a in the set of directories we are allowed to search in */
-
-static char *
-expand_lib (name)
- char *name;
-{
- char *lib, *lib_path;
-
- lib = malloc (strlen (name) + 8);
- strcpy (lib, "lib");
- strcat (lib, name);
- strcat (lib, ".lib");
- lib_path = locate_file (lib, search_dirs);
- if (!lib_path)
- {
- strcpy (lib, "lib");
- strcat (lib, name);
- strcat (lib, ".a");
- lib_path = locate_file (lib, search_dirs);
- if (!lib_path)
- {
- fprintf
- (stderr,
- "Couldn't locate library: lib%s.a or lib%s.lib\n", name, name);
- exit (1);
- }
- }
-
- return lib_path;
-}
-
-/* Check to see if the file named in NAME is a regular file, i.e. not a
- directory */
-
-static int
-is_regular_file (name)
- char *name;
-{
- int ret;
- struct stat statbuf;
-
- ret = stat(name, &statbuf);
- return !ret && S_ISREG (statbuf.st_mode);
-}
-
-/* Process the number of args in P_ARGC and contained in ARGV. Look for
- special flags, etc. that must be handled for the Microsoft linker */
-
-static void
-process_args (p_argc, argv)
- int *p_argc;
- char *argv[];
-{
- int i, j;
-
- for (i = 1; i < *p_argc; i++)
- {
- /* -v turns on verbose option here and is passed on to gcc */
- if (! strcmp (argv [i], "-v"))
- verbose = 1;
- else if (! strncmp (argv [i], "-g", 2))
- {
- addarg ("-debugtype:coff -debug:full");
- }
- else if (! strncmp (argv [i], "-stack", 6))
- {
- i++;
- addarg (concat ("-stack:",argv[i]));
- }
- else if (! strncmp (argv [i], "-subsystem", 10))
- {
- subsystem = 1;
- i++;
- addarg (concat ("-subsystem:",argv[i]));
- }
- else if (! strncmp (argv [i], "-e", 2))
- {
- entry = 1;
- i++;
- addarg (concat ("-entry:",&argv[i][1]));
- }
- }
-}
-
-/* The main program. Spawn the Microsoft linker after fixing up the
- Unix-like flags and args to be what the Microsoft linker wants */
-
-main (argc, argv)
- int argc;
- char *argv[];
-{
- int i;
- int done_an_ali = 0;
- int file_name_index;
- char *pathval = getenv ("PATH");
- char *spawn_args [5];
- char *tmppathval = malloc (strlen (pathval) + 3);
-
- strcpy (tmppathval, ".;");
- pathval = strcat (tmppathval, pathval);
-
- linker_path = locate_file ("link32.exe", pathval);
- if (!linker_path)
- {
- linker_path = locate_file ("link.exe", pathval);
- if (!linker_path)
- {
- fprintf (stderr, "Couldn't locate link32 or link\n");
- exit (1);
- }
- }
-
- addarg (linker_path);
-
- process_args (&argc , argv);
- if (! subsystem) addarg ("-subsystem:console");
- if (! entry) addarg ("-entry:mainCRTStartup");
-
- for (i = 1; i < argc; i++)
- {
- int arg_len = strlen (argv [i]);
-
- if (!strcmp (argv [i], "-o"))
- {
- char *buff, *ptr;
- int out_len;
-
- i++;
- out_len = strlen (argv[i]) + 10;
- buff = malloc (out_len);
- strcpy (buff, "-out:");
- strcat (buff, argv[i]);
- ptr = strstr (buff, ".exe");
- if (ptr == NULL || strlen (ptr) != 4)
- strcat (buff, ".exe");
- addarg (buff);
- }
- else if (arg_len > 2 && !strncmp (argv [i], "-L", 2))
- {
- char *nbuff, *sdbuff;
- int j, new_len, search_dirs_len;
-
- new_len = strlen (&argv[i][2]);
- search_dirs_len = strlen (search_dirs);
-
- nbuff = malloc (new_len + 1);
- strcpy (nbuff, &argv[i][2]);
-
- for (j = 0; j < new_len; j++)
- if (nbuff[j] == '/') nbuff[j] = DIR_SEPARATOR;
-
- sdbuff = malloc (search_dirs_len + new_len + 2);
- strcpy (sdbuff, search_dirs);
- sdbuff[search_dirs_len] = PATH_SEPARATOR;
- sdbuff[search_dirs_len+1] = 0;
- strcat (sdbuff, nbuff);
-
- search_dirs = sdbuff;
- }
-
- else if (arg_len > 2 && !strncmp (argv [i], "-l", 2))
- {
- addarg (expand_lib (&argv[i][2]));
- }
- else if (!strcmp (argv [i], "-v")
- || !strcmp (argv [i], "-g")
- || !strcmp (argv [i], "-noinhibit-exec"))
- {
- ;
- }
- else if (!strcmp (argv [i], "-stack")
- || !strcmp (argv [i], "-subsystem")
- || !strcmp (argv [i], "-e"))
- {
- i++;
- }
- else
- {
- addarg (argv [i]);
- }
- }
-
- addarg (NULL);
-
- if (verbose)
- {
- int i;
-
- for (i = 0; i < link_arg_index; i++)
- printf ("%s ", link_args [i]);
- putchar ('\n');
- }
-
- if (spawnvp (P_WAIT, linker_path, (const char * const *)link_args) != 0)
- {
- fprintf (stderr, "Error executing %s\n", link_args[0]);
- exit (1);
- }
-
- exit (0);
-}
-
-static char *
-concat (s1, s2)
- char *s1, *s2;
-{
- int len1 = strlen (s1);
- int len2 = strlen (s2);
- char *result = malloc (len1 + len2 + 1);
-
- strcpy (result, s1);
- strcpy (result + len1, s2);
- *(result + len1 + len2) = 0;
-
- return result;
-}
-
-static char *
-concat3 (s1, s2, s3)
- char *s1, *s2, *s3;
-{
- return concat (concat (s1, s2), s3);
-}
diff --git a/gcc/config/winnt/libgcc.mak b/gcc/config/winnt/libgcc.mak
deleted file mode 100644
index adfb57e63cc..00000000000
--- a/gcc/config/winnt/libgcc.mak
+++ /dev/null
@@ -1,19 +0,0 @@
-# Build libgcc.a
-
-libgcc.lib : libgcc1.c libgcc2.c mklibgcc.exe
- mklibgcc -c
- mklibgcc "cl -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES)" libgcc1.c $(LIB1FUNCS)
- mklibgcc "xgcc -B./ -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES)" libgcc2.c $(LIB2FUNCS)
- mklibnow.bat
- -del libgcc.lib
- lib -verbose -out:libgcc.lib lgcctmp/*.obj
-
-mklibgcc.obj : $(srcdir)/config/winnt/mklibgcc.c
- cl -I. -I$(srcdir) -I$(srcdir)/config/winnt -c $(srcdir)/config/winnt/mklibgcc.c
-
-dirent.obj : $(srcdir)/config/winnt/dirent.c stmp-int-hdrs
- cl -I. -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/config/winnt -c $(srcdir)/config/winnt/dirent.c
-
-mklibgcc.exe : mklibgcc.obj dirent.obj
- cl mklibgcc.obj dirent.obj libc.lib kernel32.lib
-
diff --git a/gcc/config/winnt/mklibgcc.c b/gcc/config/winnt/mklibgcc.c
deleted file mode 100644
index 081e4ec22c4..00000000000
--- a/gcc/config/winnt/mklibgcc.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <dirent.h>
-
-char *skips[] = {
- 0
-};
-
-int
-do_clean()
-{
- DIR *dir;
- struct dirent *de;
- remove("mklibnow.bat");
-
- dir = opendir("lgcctmp");
- if (!dir)
- return 0;
- while ((de=readdir(dir)))
- {
- char buf[30];
- if (de->d_name[0] == '.')
- continue;
- sprintf(buf, "lgcctmp/%s", de->d_name);
- unlink(buf);
- }
- closedir(dir);
- return 0;
-}
-
-int
-main(int argc, char **argv)
-{
- char *cc = argv[1];
- char *csrc=argv[2];
- int i;
- FILE *batfile;
- FILE *cfile;
-
- if (argc > 1 && strcmp(argv[1], "-c")==0)
- return do_clean();
-
- _mkdir("lgcctmp", 0755);
-
- batfile = fopen("mklibnow.bat", "a");
- if (!batfile)
- {
- perror("mklibnow.bat");
- return 1;
- }
-/* fprintf(batfile, "@echo off\n"); */
-
- for (i=3; i<argc; i++)
- {
- char dirname[30], basename[30], fullname[30], *bp;
- int s;
- for (s=0; skips[s]; s++)
- if (strcmp(skips[s], argv[i]) == 0)
- break;
- if (skips[s])
- continue;
- strcpy(dirname, "lgcctmp/");
- strcpy(basename, "\0");
- if (strncmp(argv[i], "_fix", 4)==0)
- {
- strcat(basename, "fx");
- strcat(basename, argv[i]+4);
- }
- else if (strncmp(argv[i], "_float", 4)==0)
- {
- strcat(basename, "flt");
- strcat(basename, argv[i]+6);
- }
- else
- {
- strcat(basename, argv[i]);
- }
- strcpy (fullname, dirname);
- strcat (fullname, basename);
- fprintf(batfile, "%s -c lgcctmp/%s.c\n", cc, basename);
- fprintf(batfile, "copy %s.obj lgcctmp\n", basename);
- bp = fullname + strlen(fullname);
- strcpy(bp, ".c");
- cfile = fopen(fullname, "w");
- if (cfile)
- {
- *bp = 0;
- fprintf(cfile, "#define L%s\n#include \"%s\"\n", argv[i], csrc);
- fclose(cfile);
- }
- else
- perror(fullname);
- }
-
- fclose(batfile);
- return 0;
-}
diff --git a/gcc/config/winnt/oldnames.c b/gcc/config/winnt/oldnames.c
deleted file mode 100644
index b7a1779b507..00000000000
--- a/gcc/config/winnt/oldnames.c
+++ /dev/null
@@ -1,47 +0,0 @@
-int
-access (const char *path, int mode)
-{
- return _access (path, mode);
-}
-
-int
-chmod (const char *filename, int pmode)
-{
- return _chmod (filename, pmode);
-}
-
-int
-close (int handle)
-{
- return _close (handle);
-}
-
-char *
-mktemp (char *template)
-{
- return (char *) _mktemp (template);
-}
-
-int
-open (const char *filename, int oflag, int pmode)
-{
- return _open (filename, oflag, pmode);
-}
-
-int
-read (int handle, void *buffer, unsigned int count)
-{
- return _read (handle, buffer, count);
-}
-
-int
-unlink (const char *path)
-{
- return _unlink (path);
-}
-
-int
-write (int handle, void *buffer, unsigned int count)
-{
- return _write (handle, buffer, count);
-}
diff --git a/gcc/config/winnt/spawnv.c b/gcc/config/winnt/spawnv.c
deleted file mode 100644
index 49096af998f..00000000000
--- a/gcc/config/winnt/spawnv.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* This is a kludge to get around the Microsoft C spawn functions' propensity
- to remove the outermost set of double quotes from all arguments. */
-
-#define index(s,c) strchr((s),(c))
-
-extern char *malloc ();
-
-const char * const *
-fix_argv (argv)
- char **argv;
-{
- static char sh_chars[] = "\"";
-
- int i, len;
- char *new_argv;
- char *p, *ap;
-
- for (i=1; argv[i]; i++)
- {
-
- len = strlen (argv[i]);
- new_argv = malloc (2*len+3);
- ap = new_argv;
-
- for (p = argv[i]; *p != '\0'; ++p)
- {
- if (index (sh_chars, *p) != 0)
- *ap++ = '\\';
- *ap++ = *p;
- }
- *ap = '\0';
- argv[i] = new_argv;
- }
-
- return (const char * const *) argv;
-}
-
-int __spawnv (mode, cmdname, argv)
- int mode;
- const char *cmdname;
- char **argv;
-{
- _spawnv (mode, cmdname, fix_argv (argv));
-}
-
-int __spawnvp (mode, cmdname, argv)
- int mode;
- const char *cmdname;
- char **argv;
-{
- _spawnvp (mode, cmdname, fix_argv (argv));
-}
-
-int spawnve (mode, cmdname, argv, envp)
- int mode;
- const char *cmdname;
- char **argv;
- const char *const *envp;
-{
- _spawnve (mode, cmdname, fix_argv (argv), envp);
-}
-
-int __spawnvpe (mode, cmdname, argv, envp)
- int mode;
- const char *cmdname;
- char **argv;
- const char *const *envp;
-{
- _spawnvpe (mode, cmdname, fix_argv (argv), envp);
-}
-
diff --git a/gcc/config/winnt/win-nt.h b/gcc/config/winnt/win-nt.h
deleted file mode 100644
index 4b93f8c118d..00000000000
--- a/gcc/config/winnt/win-nt.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for
- Windows NT 3.x.
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (drupp@cs.washington.edu).
-
-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. */
-
-#define TARGET_MEM_FUNCTIONS
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC ""
-
-#undef LINK_SPEC
-#define LINK_SPEC "-stack 5000000,5000000 -noinhibit-exec %{g}"
-
-#undef CPP_SPEC
-#define CPP_SPEC "-lang-c-c++-comments"
-
-#undef STANDARD_EXEC_PREFIX
-#define STANDARD_EXEC_PREFIX ""
-
-#undef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX ""
-
-#undef TOOLDIR_BASE_PREFIX
-#define TOOLDIR_BASE_PREFIX ""
-
-#ifdef STANDARD_INCLUDE_DIR
-#undef STANDARD_INCLUDE_DIR
-#endif
-#define STANDARD_INCLUDE_DIR ""
-
-#undef LOCAL_INCLUDE_DIR
-#define LOCAL_INCLUDE_DIR ""
-
-#undef INCLUDE_DEFAULTS
-#define INCLUDE_DEFAULTS \
- { \
- { 0, 0, 0 } \
- }
-
-#undef STDC_VALUE
-#define STDC_VALUE 0
diff --git a/gcc/config/winnt/x-winnt b/gcc/config/winnt/x-winnt
deleted file mode 100644
index 36e36b9c1a2..00000000000
--- a/gcc/config/winnt/x-winnt
+++ /dev/null
@@ -1,34 +0,0 @@
-STMP_FIXPROTO =
-OTHER_FIXINCLUDES_DIRS=${srcdir}
-RANLIB = :
-RANLIB_TEST = false
-OLDCC = cl
-MAKE = make
-SHELL = sh
-SYMLINK = cp
-INSTALL = $(srcdir)/install.sh -c
-.SUFFIXES: .obj
-.c.obj:
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
-.adb.obj:
- $(CC) -c $(ALL_ADAFLAGS) $<
-.ads.obj:
- $(CC) -c $(ALL_ADAFLAGS) $<
-exeext = .exe
-objext = .obj
-
-CC = gcc
-CLIB =
-LDFLAGS =
-
-ld.o: $(srcdir)/config/winnt/ld.c
- $(CC) -I. -I$(srcdir) -I$(srcdir)/config -c $(srcdir)/config/winnt/ld.c
-
-ld.exe: ld.o
- $(CC) -o ld.exe ld.o
-
-oldnames.o: $(srcdir)/config/winnt/oldnames.c
- $(CC) -I. -I$(srcdir) -I$(srcdir)/config -c $(srcdir)/config/winnt/oldnames.c
-
-spawnv.o: $(srcdir)/config/winnt/spawnv.c
- $(CC) -I. -I$(srcdir) -I$(srcdir)/config -c $(srcdir)/config/winnt/spawnv.c
diff --git a/gcc/config/winnt/xm-winnt.h b/gcc/config/winnt/xm-winnt.h
deleted file mode 100644
index be62d020138..00000000000
--- a/gcc/config/winnt/xm-winnt.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Configuration for GNU compiler for processor running Windows NT 3.x.
- Copyright (C) 1993, 1995 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (drupp@cs.washington.edu)
-
-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 <stdlib.h>
-
-#ifndef USG
-#define USG 1
-#endif
-
-#ifndef ONLY_INT_FIELD
-#define ONLY_INT_FIELDS 1
-#endif
-
-#ifndef USE_PROTOTYPES
-#define USE_PROTOTYPES 1
-#endif
-
-#ifndef HAVE_PUTENV
-#define HAVE_PUTENV 1
-#endif
-
-#ifndef HAVE_VPRINTF
-#define HAVE_VPRINTF 1
-#endif
-
-#define NO_SYS_SIGLIST 1
-#define bcmp(a,b,c) memcmp (a,b,c)
-#define bcopy(a,b,c) memcpy (b,a,c)
-#define bzero(a,b) memset (a,0,b)
-#define index strchr
-#define rindex strrchr
-#define kill(a,b) raise(b)
-
-#define OBJECT_SUFFIX ".obj"
-#define EXECUTABLE_SUFFIX ".exe"
-#define PATH_SEPARATOR ';'
-#define DIR_SEPARATOR '\\'
-
-#define S_IRUSR 0000400
-#define S_IWUSR 0000200
-#define S_IXUSR 0000100
-#define S_IRGRP 0000040
-#define S_IWGRP 0000020
-#define S_IXGRP 0000010
-#define S_IROTH 0000004
-#define S_IWOTH 0000002
-#define S_IXOTH 0000001
-#define S_IRWXU S_IRUSR | S_IWUSR | S_IXUSR
-#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
-#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
-
diff --git a/gcc/config/x-linux b/gcc/config/x-linux
deleted file mode 100644
index a7c091799e8..00000000000
--- a/gcc/config/x-linux
+++ /dev/null
@@ -1,5 +0,0 @@
-# Don't run fixproto
-STMP_FIXPROTO =
-
-# Don't install "assert.h" in gcc. We use the one in glibc.
-INSTALL_ASSERT_H =
diff --git a/gcc/config/x-linux-aout b/gcc/config/x-linux-aout
deleted file mode 100644
index 36ae68acec5..00000000000
--- a/gcc/config/x-linux-aout
+++ /dev/null
@@ -1,14 +0,0 @@
-# It is defined in config/xm-linux.h.
-# X_CFLAGS = -DPOSIX
-
-# The following is needed when compiling stages 2 and 3 because gcc's
-# limits.h must be picked up before /usr/include/limits.h. This is because
-# each does an #include_next of the other if the other hasn't been included.
-# /usr/include/limits.h loses if it gets found first because /usr/include is
-# at the end of the search order. When a new version of gcc is released,
-# gcc's limits.h hasn't been installed yet and hence isn't found.
-
-# BOOT_CFLAGS = -O $(CFLAGS) -Iinclude
-
-# Don't run fixproto
-# STMP_FIXPROTO =
diff --git a/gcc/config/x-lynx b/gcc/config/x-lynx
deleted file mode 100644
index 0be03e453e1..00000000000
--- a/gcc/config/x-lynx
+++ /dev/null
@@ -1,6 +0,0 @@
-# /bin/cc is hopelessly broken, so we must use /bin/gcc instead.
-CC = $(OLDCC)
-OLDCC = /bin/gcc
-
-# /bin/sh is too buggy, so use /bin/bash instead.
-SHELL = /bin/bash
diff --git a/gcc/config/x-svr4 b/gcc/config/x-svr4
deleted file mode 100644
index 9c705434cc9..00000000000
--- a/gcc/config/x-svr4
+++ /dev/null
@@ -1,9 +0,0 @@
-# Some versions of SVR4 have an alloca in /usr/ucblib/libucb.a, and if we are
-# careful to link that in after libc we can use it, but since newer versions of
-# SVR4 are dropping libucb, it is better to just use the portable C version for
-# bootstrapping. Do this by defining ALLOCA.
-
-ALLOCA = alloca.o
-
-# See all the declarations.
-FIXPROTO_DEFINES = -D_XOPEN_SOURCE
diff --git a/gcc/config/xm-gnu.h b/gcc/config/xm-gnu.h
deleted file mode 100644
index 57e74f23018..00000000000
--- a/gcc/config/xm-gnu.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Configuration for GNU C-compiler for hosts running GNU.
- Copyright (C) 1994, 1995 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 defines machine-independent things specific to a host
- running GNU. This file should not be specified as $xm_file itself;
- instead $xm_file should be CPU/xm-gnu.h, which should include both
- CPU/xm-CPU.h and this file xm-gnu.h. */
-
-#define HAVE_STRERROR /* GNU has strerror. */
-#define POSIX /* GNU complies to POSIX.1. */
-
-/* Get a definition of O_RDONLY; some of the GCC files don't include this
- properly and will define it themselves to be zero. */
-#include <fcntl.h>
diff --git a/gcc/config/xm-lynx.h b/gcc/config/xm-lynx.h
deleted file mode 100644
index 009f8445eab..00000000000
--- a/gcc/config/xm-lynx.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Configuration for GNU C-compiler for Lynx.
- Copyright (C) 1993, 1995 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 defines machine-independent things specific to a host
- running Lynx. This file should not be specified as $xm_file itself;
- instead $xm_file should be CPU/xm-lynx.h, which should include this one. */
-
-/* #defines that need visibility everywhere. */
-#define FALSE 0
-#define TRUE 1
-
-/* Arguments to use with `exit'. */
-#define SUCCESS_EXIT_CODE 0
-#define FATAL_EXIT_CODE 33
-
-/* Lynx has no vfork system call. */
-#define vfork fork
-
-/* Lynx has a non-standard mktemp function. */
-/* ??? This is simpler than creating YATM: Yet Another Target Macro. */
-#define mktemp lynx_mktemp
-
-#define lynx_mktemp(template) \
-do { \
- int pid = getpid (); \
- char *t = template; \
- char *p; \
- p = t + strlen (t); \
- while (*--p == 'X') \
- { \
- *p = (pid % 10) + '0'; \
- pid /= 10; \
- } \
-} while (0)
diff --git a/gcc/configure.bat b/gcc/configure.bat
deleted file mode 100644
index 33cbe65df6e..00000000000
--- a/gcc/configure.bat
+++ /dev/null
@@ -1,21 +0,0 @@
-@echo off
-if %1.==go32. goto call_go32
-if %1.==winnt. goto call_winnt
-echo Usage: configure go32 or configure winnt cpu
-goto END
-
-:call_go32
-call config\msdos\configure %1 %2 %3 %4
-goto END
-
-:call_winnt
-if %2.==i386. goto really_call_winnt
-if %2.==alpha. goto really_call_winnt
-echo Usage: configure winnt i386 or configure winnt alpha
-goto END
-:really_call_winnt
-call config\winnt\config-nt %1 %2 %3 %4
-goto END
-
-:END
-
diff --git a/gcc/convert.c b/gcc/convert.c
deleted file mode 100644
index 472f47e9543..00000000000
--- a/gcc/convert.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/* Utility routines for data type conversion for GNU C.
- Copyright (C) 1987, 88, 91, 92, 94, 1995 Free Software Foundation, Inc.
-
-This file is part of GNU C.
-
-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. */
-
-
-/* These routines are somewhat language-independent utility function
- intended to be called by the language-specific convert () functions. */
-
-#include "config.h"
-#include "tree.h"
-#include "flags.h"
-#include "convert.h"
-
-/* Convert EXPR to some pointer or reference type TYPE.
-
- EXPR must be pointer, reference, integer, enumeral, or literal zero;
- in other cases error is called. */
-
-tree
-convert_to_pointer (type, expr)
- tree type, expr;
-{
- register tree intype = TREE_TYPE (expr);
- register enum tree_code form = TREE_CODE (intype);
-
- if (integer_zerop (expr))
- {
- expr = build_int_2 (0, 0);
- TREE_TYPE (expr) = type;
- return expr;
- }
-
- if (form == POINTER_TYPE || form == REFERENCE_TYPE)
- return build1 (NOP_EXPR, type, expr);
-
-
- if (form == INTEGER_TYPE || form == ENUMERAL_TYPE)
- {
- if (type_precision (intype) == POINTER_SIZE)
- return build1 (CONVERT_EXPR, type, expr);
- expr = convert (type_for_size (POINTER_SIZE, 0), expr);
- /* Modes may be different but sizes should be the same. */
- if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (expr)))
- != GET_MODE_SIZE (TYPE_MODE (type)))
- /* There is supposed to be some integral type
- that is the same width as a pointer. */
- abort ();
- return convert_to_pointer (type, expr);
- }
-
- error ("cannot convert to a pointer type");
-
- expr = build_int_2 (0, 0);
- TREE_TYPE (expr) = type;
- return expr;
-}
-
-/* Convert EXPR to some floating-point type TYPE.
-
- EXPR must be float, integer, or enumeral;
- in other cases error is called. */
-
-tree
-convert_to_real (type, expr)
- tree type, expr;
-{
- register enum tree_code form = TREE_CODE (TREE_TYPE (expr));
-
- if (form == REAL_TYPE)
- return build1 (flag_float_store ? CONVERT_EXPR : NOP_EXPR,
- type, expr);
-
- if (INTEGRAL_TYPE_P (TREE_TYPE (expr)))
- return build1 (FLOAT_EXPR, type, expr);
-
- if (form == COMPLEX_TYPE)
- return convert (type, fold (build1 (REALPART_EXPR,
- TREE_TYPE (TREE_TYPE (expr)), expr)));
-
- if (form == POINTER_TYPE || form == REFERENCE_TYPE)
- error ("pointer value used where a floating point value was expected");
- else
- error ("aggregate value used where a float was expected");
-
- {
- register tree tem = make_node (REAL_CST);
- TREE_TYPE (tem) = type;
- TREE_REAL_CST (tem) = REAL_VALUE_ATOF ("0.0", TYPE_MODE (type));
- return tem;
- }
-}
-
-/* Convert EXPR to some integer (or enum) type TYPE.
-
- EXPR must be pointer, integer, discrete (enum, char, or bool), or float;
- in other cases error is called.
-
- The result of this is always supposed to be a newly created tree node
- not in use in any existing structure. */
-
-tree
-convert_to_integer (type, expr)
- tree type, expr;
-{
- register tree intype = TREE_TYPE (expr);
- register enum tree_code form = TREE_CODE (intype);
-
- if (form == POINTER_TYPE || form == REFERENCE_TYPE)
- {
- if (integer_zerop (expr))
- expr = integer_zero_node;
- else
- expr = fold (build1 (CONVERT_EXPR,
- type_for_size (POINTER_SIZE, 0), expr));
- intype = TREE_TYPE (expr);
- form = TREE_CODE (intype);
- if (intype == type)
- return expr;
- }
-
- if (form == INTEGER_TYPE || form == ENUMERAL_TYPE
- || form == BOOLEAN_TYPE || form == CHAR_TYPE)
- {
- register unsigned outprec = TYPE_PRECISION (type);
- register unsigned inprec = TYPE_PRECISION (intype);
- register enum tree_code ex_form = TREE_CODE (expr);
-
- /* If we are widening the type, put in an explicit conversion.
- Similarly if we are not changing the width. However, if this is
- a logical operation that just returns 0 or 1, we can change the
- type of the expression. For logical operations, we must
- also change the types of the operands to maintain type
- correctness. */
-
- if (TREE_CODE_CLASS (ex_form) == '<')
- {
- TREE_TYPE (expr) = type;
- return expr;
- }
- else if (ex_form == TRUTH_AND_EXPR || ex_form == TRUTH_ANDIF_EXPR
- || ex_form == TRUTH_OR_EXPR || ex_form == TRUTH_ORIF_EXPR
- || ex_form == TRUTH_XOR_EXPR)
- {
- TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0));
- TREE_OPERAND (expr, 1) = convert (type, TREE_OPERAND (expr, 1));
- TREE_TYPE (expr) = type;
- return expr;
- }
- else if (ex_form == TRUTH_NOT_EXPR)
- {
- TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0));
- TREE_TYPE (expr) = type;
- return expr;
- }
- else if (outprec >= inprec)
- return build1 (NOP_EXPR, type, expr);
-
- /* If TYPE is an enumeral type or a type with a precision less
- than the number of bits in its mode, do the conversion to the
- type corresponding to its mode, then do a nop conversion
- to TYPE. */
- else if (TREE_CODE (type) == ENUMERAL_TYPE
- || outprec != GET_MODE_BITSIZE (TYPE_MODE (type)))
- return build1 (NOP_EXPR, type,
- convert (type_for_mode (TYPE_MODE (type),
- TREE_UNSIGNED (type)),
- expr));
-
- /* Here detect when we can distribute the truncation down past some
- arithmetic. For example, if adding two longs and converting to an
- int, we can equally well convert both to ints and then add.
- For the operations handled here, such truncation distribution
- is always safe.
- It is desirable in these cases:
- 1) when truncating down to full-word from a larger size
- 2) when truncating takes no work.
- 3) when at least one operand of the arithmetic has been extended
- (as by C's default conversions). In this case we need two conversions
- if we do the arithmetic as already requested, so we might as well
- truncate both and then combine. Perhaps that way we need only one.
-
- Note that in general we cannot do the arithmetic in a type
- shorter than the desired result of conversion, even if the operands
- are both extended from a shorter type, because they might overflow
- if combined in that type. The exceptions to this--the times when
- two narrow values can be combined in their narrow type even to
- make a wider result--are handled by "shorten" in build_binary_op. */
-
- switch (ex_form)
- {
- case RSHIFT_EXPR:
- /* We can pass truncation down through right shifting
- when the shift count is a nonpositive constant. */
- if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
- && tree_int_cst_lt (TREE_OPERAND (expr, 1),
- convert (TREE_TYPE (TREE_OPERAND (expr, 1)),
- integer_one_node)))
- goto trunc1;
- break;
-
- case LSHIFT_EXPR:
- /* We can pass truncation down through left shifting
- when the shift count is a nonnegative constant. */
- if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
- && tree_int_cst_sgn (TREE_OPERAND (expr, 1)) >= 0
- && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
- {
- /* If shift count is less than the width of the truncated type,
- really shift. */
- if (tree_int_cst_lt (TREE_OPERAND (expr, 1), TYPE_SIZE (type)))
- /* In this case, shifting is like multiplication. */
- goto trunc1;
- else
- {
- /* If it is >= that width, result is zero.
- Handling this with trunc1 would give the wrong result:
- (int) ((long long) a << 32) is well defined (as 0)
- but (int) a << 32 is undefined and would get a
- warning. */
-
- tree t = convert_to_integer (type, integer_zero_node);
-
- /* If the original expression had side-effects, we must
- preserve it. */
- if (TREE_SIDE_EFFECTS (expr))
- return build (COMPOUND_EXPR, type, expr, t);
- else
- return t;
- }
- }
- break;
-
- case MAX_EXPR:
- case MIN_EXPR:
- case MULT_EXPR:
- {
- tree arg0 = get_unwidened (TREE_OPERAND (expr, 0), type);
- tree arg1 = get_unwidened (TREE_OPERAND (expr, 1), type);
-
- /* Don't distribute unless the output precision is at least as big
- as the actual inputs. Otherwise, the comparison of the
- truncated values will be wrong. */
- if (outprec >= TYPE_PRECISION (TREE_TYPE (arg0))
- && outprec >= TYPE_PRECISION (TREE_TYPE (arg1))
- /* If signedness of arg0 and arg1 don't match,
- we can't necessarily find a type to compare them in. */
- && (TREE_UNSIGNED (TREE_TYPE (arg0))
- == TREE_UNSIGNED (TREE_TYPE (arg1))))
- goto trunc1;
- break;
- }
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- case BIT_AND_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case BIT_ANDTC_EXPR:
- trunc1:
- {
- tree arg0 = get_unwidened (TREE_OPERAND (expr, 0), type);
- tree arg1 = get_unwidened (TREE_OPERAND (expr, 1), type);
-
- if (outprec >= BITS_PER_WORD
- || TRULY_NOOP_TRUNCATION (outprec, inprec)
- || inprec > TYPE_PRECISION (TREE_TYPE (arg0))
- || inprec > TYPE_PRECISION (TREE_TYPE (arg1)))
- {
- /* Do the arithmetic in type TYPEX,
- then convert result to TYPE. */
- register tree typex = type;
-
- /* Can't do arithmetic in enumeral types
- so use an integer type that will hold the values. */
- if (TREE_CODE (typex) == ENUMERAL_TYPE)
- typex = type_for_size (TYPE_PRECISION (typex),
- TREE_UNSIGNED (typex));
-
- /* But now perhaps TYPEX is as wide as INPREC.
- In that case, do nothing special here.
- (Otherwise would recurse infinitely in convert. */
- if (TYPE_PRECISION (typex) != inprec)
- {
- /* Don't do unsigned arithmetic where signed was wanted,
- or vice versa.
- Exception: if either of the original operands were
- unsigned then can safely do the work as unsigned.
- And we may need to do it as unsigned
- if we truncate to the original size. */
- typex = ((TREE_UNSIGNED (TREE_TYPE (expr))
- || TREE_UNSIGNED (TREE_TYPE (arg0))
- || TREE_UNSIGNED (TREE_TYPE (arg1)))
- ? unsigned_type (typex) : signed_type (typex));
- return convert (type,
- fold (build (ex_form, typex,
- convert (typex, arg0),
- convert (typex, arg1),
- 0)));
- }
- }
- }
- break;
-
- case NEGATE_EXPR:
- case BIT_NOT_EXPR:
- /* This is not correct for ABS_EXPR,
- since we must test the sign before truncation. */
- {
- register tree typex = type;
-
- /* Can't do arithmetic in enumeral types
- so use an integer type that will hold the values. */
- if (TREE_CODE (typex) == ENUMERAL_TYPE)
- typex = type_for_size (TYPE_PRECISION (typex),
- TREE_UNSIGNED (typex));
-
- /* But now perhaps TYPEX is as wide as INPREC.
- In that case, do nothing special here.
- (Otherwise would recurse infinitely in convert. */
- if (TYPE_PRECISION (typex) != inprec)
- {
- /* Don't do unsigned arithmetic where signed was wanted,
- or vice versa. */
- typex = (TREE_UNSIGNED (TREE_TYPE (expr))
- ? unsigned_type (typex) : signed_type (typex));
- return convert (type,
- fold (build1 (ex_form, typex,
- convert (typex,
- TREE_OPERAND (expr, 0)))));
- }
- }
-
- case NOP_EXPR:
- /* If truncating after truncating, might as well do all at once.
- If truncating after extending, we may get rid of wasted work. */
- return convert (type, get_unwidened (TREE_OPERAND (expr, 0), type));
-
- case COND_EXPR:
- /* Can treat the two alternative values like the operands
- of an arithmetic expression. */
- {
- tree arg1 = get_unwidened (TREE_OPERAND (expr, 1), type);
- tree arg2 = get_unwidened (TREE_OPERAND (expr, 2), type);
-
- if (outprec >= BITS_PER_WORD
- || TRULY_NOOP_TRUNCATION (outprec, inprec)
- || inprec > TYPE_PRECISION (TREE_TYPE (arg1))
- || inprec > TYPE_PRECISION (TREE_TYPE (arg2)))
- {
- /* Do the arithmetic in type TYPEX,
- then convert result to TYPE. */
- register tree typex = type;
-
- /* Can't do arithmetic in enumeral types
- so use an integer type that will hold the values. */
- if (TREE_CODE (typex) == ENUMERAL_TYPE)
- typex = type_for_size (TYPE_PRECISION (typex),
- TREE_UNSIGNED (typex));
-
- /* But now perhaps TYPEX is as wide as INPREC.
- In that case, do nothing special here.
- (Otherwise would recurse infinitely in convert. */
- if (TYPE_PRECISION (typex) != inprec)
- {
- /* Don't do unsigned arithmetic where signed was wanted,
- or vice versa. */
- typex = (TREE_UNSIGNED (TREE_TYPE (expr))
- ? unsigned_type (typex) : signed_type (typex));
- return convert (type,
- fold (build (COND_EXPR, typex,
- TREE_OPERAND (expr, 0),
- convert (typex, arg1),
- convert (typex, arg2))));
- }
- else
- /* It is sometimes worthwhile
- to push the narrowing down through the conditional. */
- return fold (build (COND_EXPR, type,
- TREE_OPERAND (expr, 0),
- convert (type, TREE_OPERAND (expr, 1)),
- convert (type, TREE_OPERAND (expr, 2))));
- }
- }
-
- }
-
- return build1 (NOP_EXPR, type, expr);
- }
-
- if (form == REAL_TYPE)
- return build1 (FIX_TRUNC_EXPR, type, expr);
-
- if (form == COMPLEX_TYPE)
- return convert (type, fold (build1 (REALPART_EXPR,
- TREE_TYPE (TREE_TYPE (expr)), expr)));
-
- error ("aggregate value used where an integer was expected");
-
- {
- register tree tem = build_int_2 (0, 0);
- TREE_TYPE (tem) = type;
- return tem;
- }
-}
-
-/* Convert EXPR to the complex type TYPE in the usual ways. */
-
-tree
-convert_to_complex (type, expr)
- tree type, expr;
-{
- register enum tree_code form = TREE_CODE (TREE_TYPE (expr));
- tree subtype = TREE_TYPE (type);
-
- if (form == REAL_TYPE || form == INTEGER_TYPE || form == ENUMERAL_TYPE)
- {
- expr = convert (subtype, expr);
- return build (COMPLEX_EXPR, type, expr,
- convert (subtype, integer_zero_node));
- }
-
- if (form == COMPLEX_TYPE)
- {
- tree elt_type = TREE_TYPE (TREE_TYPE (expr));
- if (TYPE_MAIN_VARIANT (elt_type) == TYPE_MAIN_VARIANT (subtype))
- return expr;
- else if (TREE_CODE (expr) == COMPLEX_EXPR)
- return fold (build (COMPLEX_EXPR,
- type,
- convert (subtype, TREE_OPERAND (expr, 0)),
- convert (subtype, TREE_OPERAND (expr, 1))));
- else
- {
- expr = save_expr (expr);
- return fold (build (COMPLEX_EXPR,
- type,
- convert (subtype,
- fold (build1 (REALPART_EXPR,
- TREE_TYPE (TREE_TYPE (expr)),
- expr))),
- convert (subtype,
- fold (build1 (IMAGPART_EXPR,
- TREE_TYPE (TREE_TYPE (expr)),
- expr)))));
- }
- }
-
- if (form == POINTER_TYPE || form == REFERENCE_TYPE)
- error ("pointer value used where a complex was expected");
- else
- error ("aggregate value used where a complex was expected");
-
- return build (COMPLEX_EXPR, type,
- convert (subtype, integer_zero_node),
- convert (subtype, integer_zero_node));
-}
diff --git a/gcc/convert.h b/gcc/convert.h
deleted file mode 100644
index 4123874fbb3..00000000000
--- a/gcc/convert.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Definition of functions in convert.c.
- Copyright (C) 1993 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. */
-
-extern tree convert_to_integer PROTO ((tree, tree));
-extern tree convert_to_pointer PROTO ((tree, tree));
-extern tree convert_to_real PROTO ((tree, tree));
-extern tree convert_to_complex PROTO ((tree, tree));
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
deleted file mode 100644
index d945770bc4f..00000000000
--- a/gcc/cp/ChangeLog
+++ /dev/null
@@ -1,14352 +0,0 @@
-Wed Mar 19 14:14:45 1997 Mike Stump <mrs@cygnus.com>
-
- * parse.y (left_curly): Avoid trying to use any fields of
- error_mark_node, as there aren't any.
-
-Thu Mar 13 16:33:22 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (do_identifier): Avoid breaking on overloaded methods
- as default arguments.
-
-Wed Mar 12 13:55:10 1997 Hans-Peter Nilsson <Hans-Peter.Nilsson@axis.se>
-
- * call.c (add_template_candidate): Initialize the variable "dummy".
-
-Mon Mar 10 15:13:14 1997 Brendan Kehoe <brendan@canuck.cygnus.com>
-
- * decl.c (start_decl): Make sure TYPE isn't an error_mark_node
- before we try to use TYPE_SIZE and TREE_CONSTANT on it.
-
-Fri Mar 7 13:19:36 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (comp_ptr_ttypes, more_specialized): Add decl.
- (debug_binfo): Delete decl, not needed.
-
- * tree.c (fnaddr_from_vtable_entry, function_arg_chain,
- promotes_to_aggr_type): Delete fns.
- * cp-tree.h (FNADDR_FROM_VTABLE_ENTRY,
- SET_FNADDR_FROM_VTABLE_ENTRY, FUNCTION_ARG_CHAIN,
- PROMOTES_TO_AGGR_TYPE): Delete alternates to #if 1.
-
- * decl.c (pending_invalid_xref{,_file,_line}): Delete unused vars.
-
- * friend.c (is_friend_type): Delete fn.
- * cp-tree.h (is_friend_type): Delete decl.
-
- * decl.c (original_result_rtx, double_ftype_double,
- double_ftype_double_double, int_ftype_int, long_ftype_long,
- float_ftype_float, ldouble_ftype_ldouble, last_dtor_insn): Make static.
- * typeck.c (original_result_rtx, warn_synth): Delete extern decls.
-
- * decl.c (push_overloaded_decl{,_top_level}): Make static, adding
- fwd decls.
- * cp-tree.h (push_overloaded_decl{,_top_level}): Delete decls.
-
- * decl.c (pushdecl_nonclass_level): #if 0, unused.
- * cp-tree.h (pushdecl_nonclass_level): #if 0 decl.
-
- * lex.c (reinit_lang_specific): #if 0, unused.
- * cp-tree.h (reinit_lang_specific): #if 0 decl.
-
- * decl.c (revert_static_member_fn): Make static, adding fwd decl.
- * cp-tree.h (revert_static_member_fn): Delete decl.
-
- * class.c (root_lang_context_p): Delete fn.
- * cp-tree.h (root_lang_context_p): Delete decl.
-
- * decl.c (set_current_level_tags_transparency): #if 0, unused.
- * cp-tree.h (set_current_level_tags_transparency): #if 0 decl.
-
- * lex.c (set_vardecl_interface_info): Make static.
- * cp-tree.h (set_vardecl_interface_info): Delete decl.
-
- * call.c (find_scoped_type): Make static.
- * cp-tree.h (find_scoped_type): Delete decl.
-
- * search.c (convert_pointer_to_vbase): Make static.
- * cp-tree.h (convert_pointer_to_vbase): Delete decl.
-
- * decl.c (const_ptr_type_node): Likewise.
- * cp-tree.h (const_ptr_type_node): Delete decl.
-
- * typeck.c (common_base_type): Make static.
- * cp-tree.h (common_base_types): Delete erroneous decl.
-
- * pt.c (classtype_mangled_name): Make static.
- * cp-tree.h (classtype_mangled_name): Delete decl.
-
- * lex.c (check_newline): Make static.
- * cp-tree.h (check_newline): Delete decl.
-
- * typeck.c (build_x_array_ref): Delete fn, same idea as
- grok_array_decl.
- * cp-tree.h (build_x_array_ref): Delete decl.
-
- * lex.c (copy_decl_lang_specific): Delete fn, same idea as
- copy_lang_decl.
- * cp-tree.h (copy_decl_lang_specific): #if 0 decl.
-
- * class.c (build_vtable_entry): Make static.
- * cp-tree.h (build_vtable_entry): Delete decl.
-
- * class.c (build_vbase_pointer): Make static.
- * cp-tree.h (build_vbase_pointer): Delete decl.
-
- * sig.c (build_sptr_ref): Add forward decl and make static.
- * cp-tree.h (build_sptr_ref): Delete decl.
-
- * call.c (build_new_method_call): Add forward decl and make static.
- * cp-tree.h (build_new_method_call): Delete decl.
-
- * call.c (build_object_call): Make static.
- * class.c (check_for_override, complete_type_p, mark_overriders):
- Likewise.
- * decl.c (cp_function_chain): Likewise.
- * lex.c (set_typedecl_interface_info, reinit_parse_for_block):
- Likewise.
- * pt.c (comp_template_args, get_class_bindings, push_tinst_level):
- Likewise.
- * tree.c (build_cplus_array_type_1): Likewise.
- * typeck.c (comp_ptr_ttypes_{const,real,reinterpret}): Likewise.
- (comp_target_parms): Likewise.
-
- * init.c (build_builtin_call): Make static.
- * cp-tree.h (build_builtin_call): Delete decl.
-
- * typeck.c (binary_op_error): Delete decl.
- * cp-tree.h (binary_op_error): Likewise.
-
-Thu Mar 6 16:13:52 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (build_method_call): Compare against error_mark_node
- directly, rather than the ERROR_MARK tree code.
- * cvt.c (cp_convert): Likewise.
- * decl.c (print_binding_level): Likewise.
- (duplicate_decls): Likewise.
- (grokdeclarator): Likewise.
- (grokdeclarator): Likewise.
- * init.c (expand_aggr_init_1): Likewise.
- (decl_constant_value): Likewise.
- * method.c (build_opfncall): Likewise.
- (hack_identifier): Likewise.
- * typeck.c (build_modify_expr): Likewise.
-
- * typeck.c (build_c_cast): Don't decl TYPE as register tree.
-
-Sun Mar 2 02:54:36 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
-
- * pt.c (unify): Strip NOP_EXPR wrappers before unifying integer values.
-
- * pt.c (coerce_template_parms): Add new error message.
-
- * method.c (build_overload_value): Implement name mangling for
- floating-point template arguments.
-
- * method.c (build_overload_int, icat, dicat): Fix mangling of template
- arguments whose absolute value doesn't fit in a signed word.
-
-Mon Mar 3 12:14:54 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * friend.c: New file; put all of the friend stuff in here.
- * init.c: Instead of here.
- * Makefile.in (CXX_OBJS): Add friend.o.
- (friend.o): Add dependencies.
- * Make-lang.in (CXX_SRCS): Add $(srcdir)/cp/friend.c.
-
-Sun Mar 2 11:04:43 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_scoped_method_call): Complain if the scope isn't a
- base.
-
-Wed Feb 26 11:31:06 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (left_curly): Don't crash on erroneous type.
-
- * init.c (build_delete): Fix type of ref.
-
-Tue Feb 25 12:41:48 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (get_vbase_1): Renamed from get_vbase.
- (get_vbase): Wrapper, now non-static.
- (convert_pointer_to_vbase): Now static.
-
- * call.c (build_scoped_method_call): Accept a binfo for BASETYPE.
- * init.c (build_delete): Pass one.
- (build_partial_cleanup_for): Use build_scoped_method_call.
- * decl.c (finish_function): Pass a binfo.
-
-Mon Feb 24 15:00:12 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): Only synthesize non-trivial copy ctors.
-
- * typeck.c (build_c_cast): Lose other reference to flag.
-
- * call.c (build_field_call): Don't look for [cd]tor_identifier.
- * decl2.c (delete_sanity): Remove meaningless use of
- LOOKUP_HAS_IN_CHARGE.
- * decl.c (finish_function): Use build_scoped_method_call instead
- of build_delete for running vbase dtors.
- * init.c (build_delete): Call overload resolution code instead of
- duplicating it badly.
-
-Thu Feb 20 15:12:15 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): Call mark_used before trying to elide
- the call.
-
- * decl.c (implicitly_declare): Don't set DECL_ARTIFICIAL.
-
-Wed Feb 19 11:18:53 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (build_modify_expr): Always pedwarn for a cast to
- non-reference used as an lvalue.
-
-Wed Feb 19 10:35:37 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Convert from 0 to a pmf properly.
-
-Tue Feb 18 15:40:57 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (handler): Fix template typo.
-
-Sun Feb 16 02:12:28 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * error.c (lang_decl_name): New fn.
- * tree.c (lang_printable_name): Use it.
-
-Fri Feb 14 16:57:05 1997 Mike Stump <mrs@cygnus.com>
-
- * g++spec.c: Include config.h so that we can catch bzero #defines
- from the config file.
-
-Tue Feb 11 13:50:48 1997 Mike Stump <mrs@cygnus.com>
-
- * new1.cc: Include a declaration for malloc, to avoid warning, and
- avoid lossing on systems that require one (ones that define malloc
- in xm.h).
-
-Mon Feb 10 22:51:13 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
-
- * decl2.c (max_tinst_depth): New variable.
- (lang_decode_option): Parse "-ftemplate-depth-NN" command line
- option.
- * pt.c (max_tinst_depth): Variable moved.
- * lang-options.h: Declare "-ftemplate-depth-NN" command line option
- as legal.
-
-Fri Feb 7 15:43:34 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (xref_basetypes): Allow a base class that depends on
- template parms to be incomplete.
-
- * decl2.c (build_expr_from_tree): Support typeid(type).
- * rtti.c (get_typeid): Support templates.
- (expand_si_desc, expand_class_desc): Fix string length.
- (expand_ptr_desc, expand_attr_desc, expand_generic_desc): Likewise.
-
-Tue Feb 4 11:28:24 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (unify, case TEMPLATE_CONST_PARM): Use cp_tree_equal.
-
- * pt.c (tsubst): Put it back for -fno-ansi-overloading.
-
-Mon Feb 3 18:41:12 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst, case FUNCTION_DECL): Lose obsolete code that
- smashes together template and non-template decls of the same
- signature.
-
-Thu Jan 30 19:18:00 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst): Don't recurse for the type of a TYPENAME_TYPE.
-
-Wed Jan 29 11:40:35 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (duplicate_decls): Next route, pedwarn about different
- exceptions if -pedantic *or* olddecl !DECL_IN_SYSTEM_HEADER.
-
-Tue Jan 28 20:43:29 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (HAS_DEFAULT_IMPLEMENTATION): Delete macro.
- (struct lang_type): Delete has_default_implementation member.
- Increase dummy to 21.
- * decl.c (start_method): Delete usage.
-
- * cp-tree.h (build_call, null_ptr_cst_p, in_function_p,
- store_after_parms, start_decl_1, auto_function): Add decls.
- (get_arglist_len_in_bytes, declare_implicit_exception,
- have_exceptions_p, make_type_decl, typedecl_for_tag,
- store_in_parms, pop_implicit_try_blocks, push_exception_cleanup,
- build_component_type_expr, cplus_exception_name,
- {make,clear}_anon_parm_name, dont_see_typename): Removed decls.
- * call.c (build_this): Make static.
- (is_complete): Likewise.
- (implicit_conversion): Likewise.
- (reference_binding): Likewise.
- (standard_conversion): Likewise.
- (strip_top_quals): Likewise.
- (non_reference): Likewise.
- (build_conv): Likewise.
- (user_harshness): Likewise.
- (rank_for_ideal): Likewise.
- * decl.c (start_decl_1): Delete forward decl.
- (push_decl_level): Make static.
- (resume_binding_level): Make static.
- (namespace_bindings_p): Make static.
- (declare_namespace_level): Make static.
- (lookup_name_real): Make static.
- (duplicate_decls): Make static. Take register off NEWDECL and
- OLDDECL parm decls.
- * decl2.c (get_sentry): Make static.
- (temp_name_p): Delete fn.
- * except.c (auto_function): Delete decl.
- * lex.c (handle_{cp,sysv}_pragma): Make static.
- (handle_sysv_pragma) [HANDLE_SYSV_PRAGMA]: Add forward decl.
- * method.c (do_build_{copy_constructor,assign_ref}): Make static.
- * pt.c (tsubst_expr_values): Make static.
- * rtti.c (combine_strings): Delete decl.
-
-Tue Jan 28 16:40:40 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (push_template_decl): Handle getting a typedef.
-
- * call.c (build_new_function_call): Complain about void arg.
-
-Tue Jan 28 15:25:09 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (duplicate_decls): Give pedwarn of different exceptions
- if -pedantic, instead of olddecl !DECL_IN_SYSTEM_HEADER.
-
-Mon Jan 27 19:21:29 1997 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Don't expand the cleanup tree here,
- since we are not going to write the rtl out. Fixes problem with
- -g -O on SPARC.
-
-Mon Jan 27 16:24:35 1997 Sean McNeil <sean@mcneil.com>
-
- * Make-lang.in: Add $(exeext) as necessary.
-
-Mon Jan 27 13:20:39 1997 Mike Stump <mrs@cygnus.com>
-
- * parse.y (handler_seq): Must have at least one catch clause.
-
-Sat Jan 25 12:00:05 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (add_builtin_candidate): Restore ?: hack.
-
- * decl.c (grok_op_properties): More warnings.
-
-Sat Jan 25 08:50:03 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (duplicate_decls): On second thought, do it as a pedwarn
- still but only if !DECL_IN_SYSTEM_HEADER (olddecl).
-
- * decl.c (duplicate_decls): Scale back to a warning, and only do
- 'em if -pedantic.
-
-Fri Jan 24 17:52:54 1997 Mike Stump <mrs@cygnus.com>
-
- * decl.c (duplicate_decls): pedwarn mismatched exception
- specifications.
-
-Thu Jan 23 18:18:54 1997 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_new_method_call): Don't display the invisible
- argument for controlling virtual bases.
-
-Thu Jan 23 16:48:10 1997 Mike Stump <mrs@cygnus.com>
-
- * new: Add nothrow new and delete, bad_alloc and throw specifications
- for delete.
- * decl.c (init_decl_processing): Add throw specification for delete.
- * new.cc (nothrow): Define.
- * lex.c (real_yylex): Removing warning that throw and friends are
- keywords.
- * new1.cc (operator new (size_t sz, const nothrow_t&)): Define.
- * new2.cc (operator new[] (size_t sz, const nothrow_t&): Define.
- * Make-lang.in: Add new{1,2}.{cc,o}.
-
-Thu Jan 23 16:39:06 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (cons_up_default_function): Fix return type of synth op=.
-
- * init.c (emit_base_init): Add warnings for uninitialized members
- and bases.
-
- * decl.c (xref_basetypes): Add warning for non-polymorphic type
- with destructor used as base type.
-
- * decl.c (grok_op_properties): Add warning for op= returning void.
- * typeck.c (c_expand_return): Add warning for op= returning anything
- other than *this.
-
- * class.c (finish_struct_1): Add warning for class with pointers
- but not copy ctor or copy op=.
-
- * cp-tree.h (TI_PENDING_TEMPLATE_FLAG): New macro.
- * pt.c (add_pending_template): Use it instead of LANG_FLAG_0.
- (instantiate_template): If -fexternal-templates, add this
- instantiation to pending_templates.
-
- * decl2.c (copy_assignment_arg_p): Disable old hack to support
- Booch components.
-
-Tue Jan 21 18:32:04 1997 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (cp_convert): Pedwarn enum to pointer conversions.
-
-Mon Jan 20 17:59:51 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (standard_conversion): Handle getting references. Tack
- on RVALUE_CONV here. Do it for non-class types, too.
- (reference_binding): Pass references to standard_conversion.
- (implicit_conversion): Likewise.
- (add_builtin_candidate): Disable one ?: kludge.
- (convert_like): Handle RVALUE_CONVs for non-class types.
- (joust): Disable the other ?: kludge.
-
-Mon Jan 20 14:53:13 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (init_decl_processing): Add code to build up common
- function types beforehand, to avoid creation then removal of
- things already in the hash table.
-
-Mon Jan 20 14:43:49 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (finish_function): Also zero out DECL_INCOMING_RTL for
- the arguments.
-
- * error.c (dump_expr, TEMPLATE_CONST_PARM): Don't require
- current_template_parms.
-
-Fri Jan 17 10:25:42 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (lookup_field): Don't return a function, check want_type.
-
-Thu Jan 16 18:14:35 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (build_new): Make sure PLACEMENT has a type.
-
-Thu Jan 16 17:40:28 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_new): Support new (nothrow).
-
-Wed Jan 15 12:38:14 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_decl): Also do push_to_top_level before setting
- up DECL_INITIAL.
-
- * cp-tree.h (PARM_DEFAULT_FROM_TEMPLATE): New macro.
- * pt.c (tsubst): Defer instantiation of default args.
- * call.c (build_over_call): Until here.
-
-Wed Jan 15 10:08:10 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * search.c (lookup_field): Make sure we have an
- IDENTIFIER_CLASS_VALUE before we try to return it.
-
-Thu Jan 9 07:19:01 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (build_method_call): Delete unused var PARM.
- (build_overload_call_real): Likewise.
- (build_object_call): Delete unused var P.
- (build_new_op): Likewise.
- * decl.c (builtin_type_tdescs_{arr, len, max}): #if 0 out static
- var definitions, which are never used.
- (shadow_tag): Delete unused var FN.
- * expr.c (cplus_expand_expr): Delete unused var ORIGINAL_TARGET.
- * init.c (build_new): Delete unused var ALLOC_TEMP.
- * method.c (hack_identifier): Delete unused var CONTEXT.
- (do_build_copy_constructor): Delete unused var NAME.
- (synthesize_method): Delete unused var BASE.
- * pt.c (lookup_template_class): Delete unused var CODE_TYPE_NODE.
- * rtti.c (build_headof): Delete unused var VPTR.
- (get_typeid): Delete unused var T.
- * typeck.c (build_conditional_expr): Delete unused vars ORIG_OP1
- and ORIG_OP2.
- (build_ptrmemfunc): Delete unused vars U and NINDEX.
- * typeck2.c (build_functional_cast): Delete unused var BINFO.
-
-Wed Jan 8 13:09:54 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (lookup_field): Use IDENTIFIER_CLASS_VALUE to look up
- things in a type being defined.
- * decl.c (finish_enum): Reverse the values so that they are in
- the correct order.
-
- * pt.c (instantiate_class_template): Don't initialize
- BINFO_BASETYPES until the vector is filled out.
- (unify): Don't abort on conflicting bindings, just fail.
- (instantiate_decl): Do push_tinst_level before any tsubsting.
-
- * method.c (build_overload_value): Handle getting a
- TEMPLATE_CONST_PARM for a pointer.
-
-Tue Jan 7 14:00:58 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (expand_member_init): Don't give 'not a base' error for
- templates.
-
- * pt.c (instantiate_decl): Call import_export_decl later.
-
- * pt.c (instantiate_class_template): Return a value.
-
- * parse.y (extension): New rule for __extension__.
- (extdef, unary_expr, decl, component_decl): Use it.
-
-Tue Jan 7 09:20:28 1997 Mike Stump <mrs@cygnus.com>
-
- * class.c (base_binfo): Remove unused base_has_virtual member.
- (finish_base_struct): Likewise.
- (finish_struct_1): Likewise.
-
-Tue Dec 31 20:25:50 1996 Mike Stump <mrs@cygnus.com>
-
- * search.c (expand_upcast_fixups): Fix bogus code generation
- problem where the generated code uses the wrong index into the
- runtime built vtable on the stack. Old code could clobber random
- stack values.
-
-Tue Dec 31 15:16:56 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (perform_member_init): Make sure the partial EH cleanups
- live on the function_obstack.
-
-Fri Dec 27 10:31:40 1996 Paul Eggert <eggert@twinsun.com>
-
- * Make-lang.in (g++spec.o): Don't use $< with an explicit target;
- this isn't portable to some versions of `make' (e.g. Solaris 2.5.1).
-
-Tue Dec 24 10:24:03 1996 Jeffrey A Law (law@cygnus.com)
-
- * decl.c (grokvardecl): Avoid ANSI style initialization.
-
-Sun Dec 22 04:22:06 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst): Tweak arg types for a FUNCTION_TYPE.
-
-Fri Dec 20 17:09:25 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Call grok_{ctor,op}_properties.
-
-Fri Dec 20 12:17:12 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * g++spec.c (lang_specific_driver): Put missing hyphen in front of
- arguments we compare against. Start the count of I at 1, not 0,
- since argv[0] is still the command.
-
-Thu Dec 19 11:53:57 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * lang-specs.h: Accept .cp as an C++ extension.
-
-Mon Dec 16 22:43:31 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (ptr_reasonably_similar): Add decl.
-
-Thu Dec 12 15:00:35 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokvardecl): Change SPECBITS parm to be the SPECBITS_IN
- pointer. New local SPECBITS with the parm's value.
- (grokdeclarator): Pass &specbits down.
-
- * parse.y (expr_no_commas): Make sure $$ is not an error_mark_node
- before we try to do C_SET_EXP_ORIGINAL_CODE on it.
-
- * search.c (envelope_add_decl): Check that the CLASSTYPE_CID of
- CONTEXT is not 0 before we try to use TYPE_DERIVES_FROM.
-
- * decl.c (cplus_expand_expr_stmt): Only expand the expr if EXP is
- not an error_mark_node.
-
-Sat Dec 7 17:20:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (TYPE_MAIN_DECL): Use TYPE_STUB_DECL.
- * *.c: Use TYPE_MAIN_DECL instead of TYPE_NAME where appropriate.
-
-Fri Dec 6 14:40:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokdeclarator): When giving an anonymous struct a name,
- replace TYPE_NAME instead of TYPE_IDENTIFIER (so TYPE_STUB_DECL is
- not affected).
-
- * typeck2.c (build_m_component_ref): If component is a pointer
- to data member, resolve the OFFSET_REF now.
-
- * call.c (convert_like): Don't go into infinite recursion.
-
- * pt.c (coerce_template_parms): Use tsubst_expr for non-type args.
-
- * class.c (finish_struct_1): Set DECL_ARTIFICIAL on the vptr.
- * tree.c (layout_basetypes): And on the vbase ptr.
-
-Thu Dec 5 02:11:28 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (BOOL_TYPE_SIZE): Define in terms of POINTER_SIZE or
- CHAR_TYPE_SIZE so bool is always the same size as another type.
-
- * decl.c (pushtag): Set DECL_IGNORED_P for DWARF, too.
-
-Tue Dec 3 23:18:37 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (grok_x_components): Remove synthesized methods from
- TYPE_METHODS of an anonymous union, complain about member
- functions.
- * decl.c (shadow_tag): Wipe out memory of synthesized methods in
- anonymous unions.
- (finish_function): Just clear the DECL_RTL of our arguments.
-
-Fri Nov 29 21:54:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Emit DWARF debugging info for static data
- members.
-
- * pt.c (tsubst): If t is a stub decl, return the stub decl for type.
-
-Wed Nov 27 14:47:15 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (build_component_ref): Don't die if COMPONENT isn't a
- IDENTIFIER_NODE.
-
-Wed Nov 27 16:05:19 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * Make-lang.in (g++-cross$(exeext)): Fix typo.
-
-Wed Nov 27 08:14:00 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Make the g++ driver now be a standalone program, rather than one
- that tries to run the gcc driver after munging up the options.
- * Make-lang.in (g++.c, g++spec.o): New rules.
- (g++.o): New rule, based on gcc.o with -DLANG_SPECIFIC_DRIVER
- added.
- (g++$(exeext)): New rule, based on xgcc rule.
- (g++-cross$(exeext)): Now just copies g++$(exeext) over.
- * g++spec.c: New file.
- * g++.c: Removed file.
-
-Tue Nov 26 19:01:09 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): Arrange for any temporary values
- that have been keep in registers until now to be put into memory.
-
-Mon Nov 25 15:16:41 1996 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-
- * Make-lang.in (c++.stage[1234]): Depend upon stage[1-4]-start, so
- that make -j3 bootstrap works better.
-
-Sun Nov 24 02:09:39 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (pushtag): Do pushdecl for anon tags.
-
-Thu Nov 21 16:30:24 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (c_expand_return): Fix logic.
- (unary_complex_lvalue): Avoid unused warning on address of INIT_EXPR.
-
-Wed Nov 20 18:47:31 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * g++.c (main): Make sure arglist has a final NULL entry. Add
- PEXECUTE_LAST to the flags passed to pexecute, as otherwise
- stdin/stdout of the invoked program are redirected to
- nowheresville.
-
-Tue Nov 19 16:12:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (implicitly_declare): Set DECL_ARTIFICIAL.
-
-Tue Nov 19 15:48:19 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (resolve_offset_ref): Handle obj.vfn better.
- * typeck.c (build_component_ref): Set TREE_TYPE on result from
- build_vfn_ref.
-
-Tue Nov 19 13:14:33 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (convert_for_assignment): Also handle anachronistic
- implicit conversions from (::*)() to cv void*.
- * cvt.c (cp_convert_to_pointer): Likewise.
-
-Mon Nov 18 17:05:26 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (handle_cp_pragma): Fix bogus warning.
-
-Mon Nov 18 16:10:43 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Avoid thinking a POINTER_TYPE
- (METHOD_TYPE) is a TYPE_PTRMEMFUNC_P.
-
-Thu Nov 14 23:18:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_1): Support DWARF2_DEBUG.
- * search.c (dfs_debug_mark): Likewise.
- * decl2.c (finish_vtable_vardecl): Likewise.
- * decl.c (pushtag, finish_enum): Likewise.
- * lex.c (check_newline): Use debug_* instead of calling *out
- functions directly.
-
-Thu Nov 14 15:21:46 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Make-lang.in (cplib2.ready): Add else clause to avoid problems
- on some picky hosts.
-
-Wed Nov 13 12:32:07 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_1): A class has a non-trivial copy
- constructor if it has virtual functions.
-
- * cvt.c (cp_convert): Always call a constructor.
-
- * call.c (reference_binding): Still tack on a REF_BIND
- for bad conversions.
- (build_user_type_conversion_1): Propagate ICS_BAD_FLAG.
-
- * typeck.c (convert_arguments): Pass LOOKUP_ONLYCONVERTING.
- (c_expand_return): Likewise.
- * typeck2.c (digest_init): Likewise for { }.
- * init.c (expand_aggr_init_1): Keep the CONSTRUCTOR handling.
- * cvt.c (cp_convert): Handle failure better.
-
-Wed Nov 13 11:51:20 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * g++.c (main): Also set PEXECUTE_SEARCH, to make the invocation
- of GCC be path-relative.
-
-Wed Nov 13 11:27:16 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * Make-lang.in (g++-cross): G++-cross doesn't need version.o, but
- it does need choose-temp.o and pexecute.o.
-
-Wed Nov 13 07:53:38 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * g++.c (error) [!HAVE_VPRINTF]: Put error back for the only time
- that we still use it.
- (P_tmpdir, R_OK, W_OK, X_OK) [__MSDOS__]: Delete unnecessary macros.
-
-Wed Nov 13 02:00:26 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (expand_default_init): Avoid calling constructors to
- initialize reference temps.
-
- * cvt.c (convert_to_reference): Fix.
-
-Tue Nov 12 19:10:07 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (cp_convert): Simplify for flag_ansi_overloading.
- (convert_to_reference): Likewise.
- * typeck.c (convert_for_initialization): Likewise.
- * init.c (expand_default_init): Likewise.
- (expand_aggr_init_1): Likewise.
- * cp-tree.h (CONV_NONCONVERTING): Lose.
- * typeck.c (build_c_cast): Lose allow_nonconverting parm.
- * *.c: Adjust.
- * call.c (build_user_type_conversion_1): Assume LOOKUP_ONLYCONVERTING.
-
-Tue Nov 12 16:29:04 1996 Brendan Kehoe <brendan@canuck.cygnus.com>
-
- * pt.c (tsubst_expr): Reverse args to expand_start_catch_block.
-
-Tue Nov 12 15:26:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (expand_aggr_init_1): Don't crash on non-constructor
- TARGET_EXPR.
-
-Tue Nov 12 14:00:50 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * g++.c: Include gansidecl.h.
- (VPROTO, PVPROTO, VA_START): Delete.
- (choose_temp_base_try, choose_temp_base, perror_exec,
- run_dos) [__MSDOS__]: Delete fns.
- (pfatal_with_name): Delete fn.
- (temp_filename): Declare like in gcc.c.
- (pexecute, pwait, choose_temp_base): Declare from gcc.c.
- (error_count, signal_count): Define.
- (error): Delete both definitions.
- (PEXECUTE_{FIRST,LAST,SEARCH,VERBOSE}): Define from gcc.c.
- (pfatal_pexecute): Add fn from gcc.c.
- (main): Rename local VERBOSE var to VERBOSE_FLAG. Rewrite the
- code to use the pexecute stuff also used by gcc.c.
- (MIN_FATAL_STATUS): Define.
- * Make-lang.in (g++): Add dependency on and linking with
- choose-temp.o and pexecute.o.
-
- * cp-tree.h: Include gansidecl.h.
- (STDIO_PROTO): Delete #undef/#define.
- * cvt.c (NULL): Delete #undef/#define.
- * expr.c (NULL): Likewise.
- * init.c (NULL): Likewise.
- * rtti.c (NULL): Likewise.
- * xref.c (NULL): Likewise.
-
- * cp-tree.h (build_user_type_conversion): Add prototype.
- * call.c (build_user_type_conversion): Delete prototype. Correct
- decl of FLAGS arg to be an int.
- * cvt.c (build_user_type_conversion): Likewise.
-
-Tue Nov 12 12:16:20 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.def: Add TRY_BLOCK and HANDLER.
- * except.c (expand_start_catch_block): Support templates.
- * parse.y (try_block, handler_seq): Likewise.
- * pt.c (tsubst_expr): Support TRY_BLOCK and HANDLER.
-
-Mon Nov 11 13:57:31 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (current_template_args): New fn.
- (push_template_decl): Use it.
- * decl.c (grokdeclarator): Use it.
-
- * decl2.c (build_expr_from_tree): Dereference ref vars.
-
- * decl.c (grokdeclarator): Generalize handling of TYPENAME_TYPEs in
- the decl-specifier-seq.
-
- * decl.c (grok_op_properties): Don't force the type of a conversion
- op to be complete. Don't warn about converting to the same type
- for template instantiations.
-
- * decl2.c (finish_file): Don't call instantiate_decl on synthesized
- methods.
-
-Mon Nov 11 13:20:34 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (get_delta_difference): Remove previous bogusness.
- Don't give errors if force is set.
-
-Fri Nov 8 17:38:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Don't emit debug info.
- * decl.c (pushdecl): Lose obsolete code.
- (grokdeclarator): Still do the long long thing after complaining.
- * search.c (note_debug_info_needed): Don't do anything if we're in a
- template.
- * method.c (synthesize_method): For non-local classes,
- push_to_top_level first.
-
-Fri Nov 8 11:52:28 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (get_delta_difference): Add no_error parameter.
- (build_ptrmemfunc): Call get_delta_difference with no_error set;
- we don't want error messages when converting unrelated
- pointer-to-member functions.
-
-Thu Nov 7 11:16:24 1996 Mike Stump <mrs@cygnus.com>
-
- * error.c (dump_expr): Improve the wording on error messages that
- involve pointer to member functions.
-
-Tue Nov 5 17:12:05 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Move code for conversions from
- (::*)() to void* or (*)() up a bit, so that we can convert from
- METHOD_TYPEs as well.
-
-Tue Nov 5 14:54:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (get_tinfo_fn): Make sure 'type' is permanent.
- There are no 'member' types.
- (get_tinfo_fn_dynamic): Diagnose typeid of overloaded fn.
- (build_x_typeid): Handle errors.
-
-Mon Nov 4 17:43:12 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (convert_for_assignment): Handle anachronistic implicit
- conversions from (::*)() to void* or (*)().
- * cvt.c (cp_convert_to_pointer): Likewise.
- (cp_convert_to_pointer_force): Remove cp_convert_to_pointer
- conversions from here.
- * decl2.c (lang_decode_option): Add -W{no-,}pmf-conversions.
- * lang-options.h: Likewise.
- * decl2.c (warn_pmf2ptr): Define.
- * cp-tree.h: Declare it.
- * typeck2.c (digest_init): Allow pmfs down into
- convert_for_initialization.
-
-Sun Nov 3 09:43:00 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (c_expand_return): Fix for returning overloaded fn.
-
-Fri Nov 1 08:53:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (DIRECT_BIND): Change from INDIRECT_BIND.
- * decl.c (grok_reference_init): Pass DIRECT_BIND.
- * cvt.c (build_up_reference): Don't mark 'this' addressable. Use
- DIRECT_BIND.
- * call.c (convert_like): Don't pass INDIRECT_BIND.
- * typeck.c (convert_arguments): Likewise.
- * typeck.c (mark_addressable): Allow &this if flag_this_is_variable.
-
-Thu Oct 31 17:08:49 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (mark_addressable): Support TARGET_EXPR, unify with
- similar code in build_up_ref.
- * cvt.c (build_up_reference): Drastically simplify.
-
-Mon Oct 28 12:45:05 1996 Jeffrey A Law (law@cygnus.com)
-
- * typeck.c (signed_or_unsigned_type): If the given type already
- as the correct signedness, then just return it.
-
- * typeck.c ({un,}signed_type): If can't do anything, call
- signed_or_unsigned_type.
-
-Thu Oct 24 14:21:59 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl2.c (copy_assignment_arg_p): Don't buy the farm if
- current_class_type is NULL.
-
-Wed Oct 23 00:43:10 1996 Jason Merrill <jason@gerbil.cygnus.com>
-
- * class.c (finish_struct_1): Avoid empty structs by adding a field
- so layout_type gets the mode right.
-
- * typeck.c (c_expand_return): Drastically simplify.
-
-Mon Oct 21 22:34:02 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (decay_conversion): Handle overloaded methods.
-
-Fri Oct 18 16:03:48 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): A TARGET_EXPR has side-effects.
-
-Thu Oct 17 11:31:59 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (convert_to_pointer_force): Add code to support pointer to
- member function to pointer to function conversions.
- * init.c (resolve_offset_ref): Add code to allow faked up objects,
- ignoring them if they are not used, and giving an error, if they
- are needed.
- * typeck.c (get_member_function_from_ptrfunc): Fold e1 to improve
- code, and so that we can give an error, if we needed an object,
- and one was not provided.
- (build_c_cast): Don't call default_conversion when we want to
- convert to pointer to function from a METHOD_TYPE.
-
-Mon Oct 14 00:28:51 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Make-lang.in (cplib2.ready): Fix logic.
-
- * decl.c (shadow_tag): Only complain about non-artificial function
- members.
-
- * class.c (finish_struct_1): Add synthesized methods to TYPE_METHODS.
-
-Fri Oct 11 16:12:40 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * expr.c (cplus_expand_expr): Pre-tweak call_target like
- expand_inline_function would.
-
- * pt.c (mark_decl_instantiated): If extern_p, call
- mark_inline_for_output.
-
-Thu Oct 10 15:58:08 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (unary_complex_lvalue): Add code to handle intermediate
- pmd conversions.
-
- * typeck.c (get_delta_difference): Fix wording, as we can be used
- for pointer to data members.
-
-Tue Oct 8 12:43:51 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * pt.c (tsubst): If the function decl isn't a member of this
- template, return a copy of the decl (including copying the
- lang-specific part) so we don't hose ourselves later.
-
-Thu Oct 3 16:24:28 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct): Remove DWARF-specific tag handling.
- * decl.c (pushtag): Likewise.
- (finish_function): Always clear DECL_ARGUMENTS on function decls with
- no saved RTX.
- * decl2.c (finish_file): Emit DWARF debugging info for static data
- members.
-
-Wed Oct 2 21:58:01 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl.c (duplicate_decls): Make sure the old DECL_LANG_SPECIFIC
- isn't the same as the new one before we whack it.
-
-Mon Sep 30 13:38:24 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c, cp-tree.h, cvt.c, decl.c, decl2.c, gxx.gperf, hash.h,
- lex.c, method.c, parse.y, typeck.c, typeck2.c: Remove
- warn_traditional and warn_strict_prototypes; remove ancient
- 'overload' code; remove references to flag_traditional.
-
-Mon Sep 30 12:58:40 1996 Mike Stump <mrs@cygnus.com>
-
- * input.c (sub_getch): Handle 8-bit characters in string literals.
-
-Sun Sep 29 03:12:01 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (mapcar): Handle CONSTRUCTORs.
- (copy_to_permanent): Handle expression_obstack properly.
-
- * Make-lang.in (cplib2.txt): Also depend on the headers.
-
- * rtti.c (get_tinfo_var): Don't assume that POINTER_SIZE ==
- INT_TYPE_SIZE.
- (expand_class_desc): Use USItype for offset field.
- * tinfo.h (struct __class_type_info): Likewise.
-
- * method.c (build_overload_int): TYPE_PRECISION should be applied
- to types.
-
-Sat Sep 28 14:44:50 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_new_op): A COND_EXPR involving void must be a
- builtin.
-
-Fri Sep 27 16:40:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_x_component_ref): New fn.
- (build_object_ref): Use it.
- * parse.y (primary): Use it.
- * decl2.c (build_expr_from_tree): Use it.
- * cp-tree.h: Declare it.
-
- * decl.c (start_decl): variable-sized arrays cannot be initialized.
- * error.c (dump_type_suffix): Handle variable arrays.
-
-Fri Sep 27 13:14:05 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Make-lang.in (exception.o): Put back compiling it with -fPIC.
-
-Fri Sep 27 03:00:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lookup_name_real): Don't try to look up anything in a
- TYPENAME_TYPE.
-
- * tinfo2.cc (__throw_type_match_rtti): Oops.
-
-Thu Sep 26 22:11:05 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Make-lang.in (exception.o): Use -fno-PIC for now.
-
-Thu Sep 26 10:59:00 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (build_dynamic_cast): Pass tinfo fns rather than
- calling them.
- (get_tinfo_fn_dynamic): Extracted from build_typeid.
- * tinfo2.cc (__dynamic_cast): Adjust.
-
- * rtti.c (build_typeid): Use resolves_to_fixed_type_p.
- (build_x_typeid): Likewise.
-
- * parse.y: Call build_x_typeid instead of build_typeid.
- * cp-tree.def: Add TYPEID_EXPR.
- * pt.c (tsubst_copy): Handle typeid.
- * decl2.c (build_expr_from_tree): Likewise.
- * rtti.c (build_x_typeid): Throw bad_typeid from here.
- (build_typeid): Not here.
- * cp-tree.h: Declare build_x_typeid.
-
-Wed Sep 25 17:26:16 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (convert_like): Pull out constant values.
-
- * tree.c (mapcar): Use build_cplus_array_type, not build_array_type.
-
-Wed Sep 25 17:28:53 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * decl.c (init_decl_processing): Create short int types before
- creating size_t in case a machine description needs to use
- unsigned short for size_t.
-
-Tue Sep 24 18:18:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Make-lang.in (exception.o): Turn off pic.
-
- * tinfo2.cc (__throw_type_match_rtti): Fix cv-variants of the same
- type, multi-level ptr conversions.
-
- * rtti.c (call_void_fn): Renamed and genericized from throw_bad_cast.
- (throw_bad_cast): Use it.
- (throw_bad_typeid): New fn.
- (build_typeid): Throw bad_typeid as needed.
- Use build_call.
- (synthesize_tinfo_fn): Handle functions and arrays before checking
- for cv-quals.
-
- * Remove .h from standard C++ headers, add new.h, move into inc
- subdirectory.
-
- * exception*: Remove pointer from object, constructors. Add
- default exception::what that uses type_info::name. Add
- __throw_bad_typeid.
-
- * init.c (build_new): Don't add a cookie to new (void *) T[2].
-
-Mon Sep 23 15:21:53 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Make-lang.in: Building C++ code depends on cc1plus.
-
-Mon Sep 23 12:38:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (struct saved_scope): Declare PROCESSING_TEMPLATE_DECL as
- a HOST_WIDE_INT, not a tree.
-
-Mon Sep 23 12:36:02 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * exception.cc: Don't include <stdlib.h>.
-
- * Make-lang.in (c++.clean): Remove cplib2.*.
-
-Mon Sep 23 09:42:19 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * parse.y (component_decl_1, component_costructor_declarator case):
- Pass attributes/prefix_attributes in tree list.
-
-Mon Sep 23 01:18:50 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tinfo{,2}.cc: #include <stddef.h> instead of <stdlib.h>.
-
-Sun Sep 22 05:31:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (do_identifier): Don't do deferred lookup in a template
- header.
-
- * typeck2.c (store_init_value): Oops.
-
- * new.{h,cc}, exception.{h,cc}, typeinfo.h, tinfo{2.cc,.cc,.h}:
- New files for C++ lang-support library.
- * Make-lang.in (CXX_EXTRA_HEADERS): Define.
- (CXX_LIB2FUNCS): Define.
- And rules for building the C++ lang-support code.
- * config-lang.in (headers): Define.
- (lib2funcs): Define.
-
-Sat Sep 21 19:17:28 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (build_expr_from_tree): If CONSTRUCTOR has a type, call
- digest_init.
- * pt.c (tsubst_copy): Compute type for CONSTRUCTOR.
- * typeck2.c (store_init_value): Check for initializing pmf with { }
- here.
- (process_init_constructor): Not here.
-
-Thu Sep 19 16:41:07 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (begin_template_parm_list): Increment
- processing_template_decl here.
- (end_template_parm_list): Not here.
- (process_template_parm): No need to add 1 to it now.
- * *.c: Use processing_template_decl instead of current_template_parms
- to check for being in a template.
-
- * pt.c (uses_template_parms): Handle SCOPE_REF. Fix CONSTRUCTOR.
- (tsubst_copy): Handle CONSTRUCTOR.
- (instantiate_decl): Set up context properly for variables.
- * decl2.c (build_expr_from_tree): Handle CONSTRUCTOR.
- * class.c (finish_struct): Reverse CLASSTYPE_TAGS.
-
-Wed Sep 18 13:30:20 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * lex.c (enum tree_node_kind) [GATHER_STATISTICS]: Put the enum back.
-
-Wed Sep 18 04:24:07 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (make_thunk): Call comdat_linkage before setting the
- TREE_CODE.
-
- * decl2.c (comdat_linkage): Use make_decl_one_only.
- (import_export_decl): Likewise.
- * decl.c (init_decl_processing): Check supports_one_only instead of
- SUPPORTS_WEAK.
-
-Sat Sep 14 08:34:41 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (grokfield): Tighten checking for access decls.
-
- * decl.c (make_typename_type): Resolve references to
- current_class_type. Set CLASSTYPE_GOT_SEMICOLON.
- (lookup_name_real): Types that depend on a template parameter get
- an implicit 'typename' unless they're in the current scope.
- (start_decl_1): We don't care about incomplete types that depend
- on a template parm.
- (grokdeclarator): Resolve 'typename's in the type specifier that
- refer to members of the current scope.
-
- * call.c (build_over_call): Remove 'inline called before
- definition' diagnostic.
- (build_method_call): Likewise.
- * decl.c (duplicate_decls): Downgrade 'used before declared
- inline' to a warning, only with -Winline.
-
-Fri Sep 13 17:31:40 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-make.sed: Fix include paths, add @DASH_C_FLAG@ to compile.
-
-Wed Sep 11 22:38:13 1996 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * call.c (build_method_call): When calling a signature
- default implementation, as in other cases, let instance_ptr simply
- be instance.
-
-Wed Sep 11 22:14:44 1996 Mike Stump <mrs@cygnus.com>
-
- * parse.y (simple_stmt): Cleanup and use do_poplevel ().
-
-Wed Sep 11 22:10:48 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_start_catch_block): Add a pushlevel so that -g
- works on hppa and SPARC.
-
-Wed Sep 11 10:18:06 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (build_indirect_ref): Catch PTR being an error_mark_node.
-
-Mon Sep 9 19:51:14 1996 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * call.c (build_over_call): Check first whether DECL_CONTEXT exists
- before testing whether it's a signature.
-
-Sun Sep 8 16:06:57 1996 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * call.c (build_new_method_call): Don't complain about signature
- pointers and references not being an aggr type.
- (build_this): If a signature pointer or reference was passed in,
- just return it.
- (build_new_method_call): If instance is a signature pointer, set
- basetype to the signature type of instance.
- * sig.c (build_signature_method_call): Deleted basetype and
- instance parameters, they can be found as the DECL_CONTEXT of
- function and as the first argument passed in.
- * cp-tree.h: Changed declaration of build_signature_method_call.
- * call.c (build_method_call): Deleted first two arguments in call
- of build_signature_method_call.
- (build_over_call): Added call to build_signature_method_call.
-
-Thu Sep 5 16:51:28 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_c_cast): Don't tack a non_lvalue_expr onto a
- target_expr.
-
-Thu Sep 5 10:05:38 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cvt.c (convert_to_reference): Use %#T, not %#D, for error.
-
-Wed Sep 4 17:16:09 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * except.c (expand_start_try_stmts): Move to except.c in the backend.
- (expand_end_try_stmts): Remove.
-
- * init.c (perform_member_init): Use add_partial_entry () instead
- of directly manipulating lists.
- (emit_base_init): Ditto.
-
-Wed Sep 4 12:14:36 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_exception_blocks): Always make sure USE and
- CLOBBER insns that came at the end still do, the backend relies
- upon this.
-
-Wed Sep 4 07:44:48 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): We can only use a TARGET_EXPR of the
- right type.
-
-Tue Sep 3 19:26:05 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (convert_to_reference): Revert last change, don't complain
- about temp without target decl.
-
-Tue Sep 3 10:22:56 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (grokdeclarator): Don't core dump when void() is given.
-
-Tue Sep 3 02:38:56 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (copy_args_p): Don't crash.
-
-Fri Aug 30 14:26:57 1996 Mike Stump <mrs@cygnus.com>
-
- * pt.c (tsubst): And support template args inside the exception
- specification.
-
- * pt.c (tsubst): Add support for exception specifications in
- template functions.
-
-Fri Aug 30 10:01:55 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.def (DECL_STMT): Eliminate the throw spec field, only 3
- fields now.
- * cp-tree.h (start_decl): Eliminate the throw spec parameter.
- (start_function): Likewise.
- (start_method): Likewise.
- (grokfield): Likewise.
- (make_call_declarator): Add throw spec parameter.
- (set_quals_and_spec): Add routine.
- * lex.c (set_quals_and_spec): Likewise.
- * decl.h (grokdeclarator): Eliminate the throw spec parameter.
- * decl.c (shadow_tag): Eliminate the throw spec parameter to
- grokdeclarator.
- (groktypename): Likewise.
- (start_decl): Eliminate the throw spec parameter. Eliminate the
- throw spec parameter to grokdeclarator. Eliminate the throw spec
- field in DECL_STMT.
- (cp_finish_decl): Eliminate the throw spec field in DECL_STMT.
- (grokfndecl): Remove useless set of raises.
- (grokdeclarator): Eliminate the throw spec parameter. Eliminate
- the throw spec parameter to start_decl. Pull the throw spec out
- of the call declarator.
- (grokparms): Eliminate the throw spec parameter to grokdeclarator.
- (start_function): Eliminate the throw spec parameter. Eliminate
- the throw spec parameter to grokdeclarator.
- (start_method): Likewise.
- * decl2.c (grokfield): Likewise.
- (grokbitfield): Eliminate the throw spec parameter to grokdeclarator.
- (grokoptypename): Likewise.
- (finish_file): Eliminate the throw spec parameter to
- start_function. Add throw spec to make_call_declarator.
- * except.c (init_exception_processing): Add throw spec to
- make_call_declarator. Eliminate the throw spec parameter to
- start_decl.
- (expand_start_catch_block): Eliminate the throw spec parameter to
- grokdeclarator.
- (expand_builtin_throw): Add throw spec to make_call_declarator.
- Eliminate the throw spec parameter to start_function.
- (start_anon_func): Likewise.
- * lex.c (make_call_declarator): Add throw spec parameter.
- (set_quals_and_spec): New routine.
- (cons_up_default_function): Add throw spec to make_call_declarator.
- Eliminate the throw spec parameter to grokfield.
- * method.c (synthesize_method): Eliminate the throw spec parameter
- to start_function.
- * pt.c (process_template_parm): Eliminate the throw spec parameter
- to grokdeclarator.
- (tsubst): Add throw spec to make_call_declarator.
- (tsubst_expr): Eliminate the throw spec parameter to start_decl.
- (do_function_instantiation): Eliminate the throw spec parameter to
- grokdeclarator. Eliminate the throw spec parameter to
- start_function.
- * rtti.c (synthesize_tinfo_fn): Eliminate the throw spec parameter
- to start_function.
- * parse.y (datadef): Remove non-winning optimization.
- (decl): Likewise.
- (fndef): Remove ambiguous error productions uncovered by grammer
- fixing.
- (constructor_declarator): Add exception_specification_opt here.
- (component_constructor_declarator): Likewise.
- (direct_after_type_declarator): Likewise.
- (complex_direct_notype_declarator): Likewise.
- (direct_abstract_declarator): Likewise.
- (fn.def1): Remove exception_specification_opt.
- (fn.def2): Likewise.
- (condition): Likewise.
- (initdcl0): Likewise.
- (initdcl): Likewise.
- (notype_initdcl0): Likewise.
- (nomods_initdcl0): Likewise.
- (component_decl_1): Likewise.
- (component_declarator): Likewise.
- (after_type_component_declarator0): Likewise.
- (after_type_component_declarator): Likewise.
- (notype_component_declarator): Likewise.
-
-Wed Aug 28 01:40:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): Also use an INIT_EXPR when
- initializing anything from an rvalue.
-
- * call.c (build_over_call): Call stabilize_reference when building
- an INIT_EXPR instead of calling the copy ctor.
-
- * call.c (joust): Extend the previous change to all comparisons.
-
- * decl2.c, method.c, lex.c: Use MAKE_DECL_ONE_ONLY and
- NO_LINKAGE_HEURISTICS.
-
- * decl2.c (finish_file): Emit any statics that weren't already.
-
- * typeck.c (build_static_cast): Implement.
- * tree.c (build_cplus_new): Handle getting a TARGET_EXPR.
- * decl.c (grokparms): Use can_convert_arg instead of
- implicit_conversion directly.
- (copy_args_p): New fn.
- * cvt.c (convert_to_reference): Don't complain about temp with
- static_cast.
- (build_up_reference): Handle TARGET_EXPRs.
- * call.c (build_over_call): Elide unnecessary temps.
- (can_convert*): Use new overloading code.
-
-Tue Aug 27 13:12:21 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c: Move TYPE_PTR*_MACROS ...
- * cp-tree.h: To here.
- * typeck.c (build_reinterpret_cast): Implement.
-
- * call.c (add_builtin_candidate): Use TYPE_PTROB_P instead of
- ptr_complete_ob.
- (joust): If we're comparing a function to a builtin and the worst
- conversion for the builtin is worse than the worst conversion for the
- function, take the function.
-
- * typeck.c (build_const_cast): Implement.
- (comp_ptr_ttypes_const): Like comp_ptr_ttypes, for const_cast.
- (comp_ptr_ttypes_reinterpret): Like cpt, for reinterpret_cast.
-
-Tue Aug 27 13:14:58 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * rtti.c (build_dynamic_cast): Don't try to dereference exprtype
- too early. Make sure we explode if exprtype turns out to be a
- NULL_TREE when it shouldn't be.
-
-Tue Aug 27 10:56:21 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h: New routine make_call_declarator.
- * lex.c (make_call_declarator): Define it.
- * except.c (init_exception_processing): Use it.
- (expand_builtin_throw): Likewise.
- (start_anon_func): Likewise.
- * decl2.c (finish_file): Likewise.
- * lex.c (cons_up_default_function): Likewise.
- * parse.y: Likewise.
- * pt.c (tsubst): Likewise.
-
-Mon Aug 26 17:40:03 1996 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (groktypefield): Remove unused code.
-
-Mon Aug 26 17:00:33 1996 Mike Stump <mrs@cygnus.com>
-
- * gxx.gperf: Change TYPE_QUAL into CV_QUALIFIER.
- * parse.y: Likewise. Change maybe_type_qual into maybe_cv_qualifier.
- Change type_quals into cv_qualifiers. Change nonempty_type_quals into
- nonempty_cv_qualifiers.
- * hash.h: Rebuild.
-
- * lex.c (make_pointer_declarator): Change type_quals into
- cv_qualifiers.
- (make_reference_declarator): Likewise.
-
-Thu Aug 22 01:09:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (start_function): Only check interface_* for templates
- with flag_alt_external_templates.
-
- * call.c (build_new_op): Check for comparison of different enum types.
- (build_over_call): Fix arg # output.
-
- * typeck.c (build_component_ref): Handle pre-found TYPE_DECL.
-
-Wed Aug 21 00:13:15 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_new_op): Check for erroneous args.
-
- * call.c (build_new_method_call): Add missing args to cp_error.
-
- * tree.c (error_type): Dont print reference-to-array.
-
- * typeck.c (convert_for_assignment): Don't say contravariance for
- removing const.
-
-Tue Aug 20 13:23:00 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_over_call): Diagnose bad convs for `this'.
-
- * lex.c (cons_up_default_function): Set DECL_ARTIFICIAL
- on _ctor_arg.
-
- * call.c (convert_like): Handle bad convs.
- (build_over_call): Handle bad convs better.
-
- * decl2.c: -fansi-overloading is now the default.
-
- * call.c (build_new_method_call): Check for erroneous args.
-
- * pt.c (instantiate_class_template): Propagate
- TYPE_USES_MULTIPLE_INHERITANCE.
-
-Tue Aug 20 13:09:57 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (enforce_access): Add static to routine.
-
-Sun Aug 18 14:35:54 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_user_type_conversion_1): Fix bad handling.
- (compare_ics): Likewise.
-
-Sat Aug 17 21:54:11 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (standard_conversion): Oops.
-
-Sat Aug 17 16:28:11 1996 Geoffrey Noer <noer@cygnus.com>
-
- * g++.c: Update test for win32 (&& ! cygwin32).
-
-Sat Aug 17 03:45:31 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (comp_ptr_ttypes_real): Handle OFFSET_TYPEs properly.
- (ptr_reasonably_similar): New fn.
- * call.c (BAD_RANK): New rank.
- (ICS_BAD_FLAG): New macro.
- (standard_conversion): Handle almost-right pointer conversions.
- (reference_binding): Handle bad rvalue bindings.
- (add_*_candidate): Stuff.
- (build_over_call): Pass bad conversions to convert_for_initialization.
- (compare_ics): Handle bad convs.
- (joust): Likewise.
-
-Fri Aug 16 15:02:19 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * init.c (expand_vec_init): Use ptrdiff_type_node instead of
- integer_type_node when computing pointer offsets.
-
-Fri Aug 16 01:28:32 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (lvalue_type): New fn.
- (error_type): New fn.
- * call.c (op_error): Use error_type.
- (add_conv_candidate): Use lvalue_type.
- (add_builtin_candidates): Likewise.
- * error.c (args_as_string): Use error_type.
-
-Thu Aug 15 17:27:13 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_decl): Evaluate DECL_INITIAL of a VAR_DECL here.
- (tsubst): Not here.
-
- * decl.c (init_decl_processing): With -ansi, __null's type is the
- signed integral type with the same number of bits as a pointer.
- Introduce a new variable null_node for it.
- * cp-tree.h: Adjust.
- * call.c (null_ptr_cst_p): Adjust.
-
-Thu Aug 15 17:09:54 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (do_unwind): Mark %i7 as used on the SPARC so we can
- optimize.
-
-Thu Aug 15 01:36:49 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (import_export_decl): Ignore #pragma interface for tinfo
- fns of classes without virtual functions.
-
- * call.c (add_function_candidate): Handle `this' specially.
- (compare_ics): Likewise.
-
-Tue Aug 13 12:16:10 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_conditional_expr): Fix handling of __null.
-
- * decl2.c (comdat_linkage): New fn.
- (import_export_vtable): Use it.
- (import_export_decl): Use it.
- * method.c (make_thunk): Use it.
-
-Mon Aug 12 00:09:18 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (end_template_decl): If we don't actually have parms, return.
- * parse.y (template_header): Accept 'template <>'.
-
- * errfn.c: Allow 5 args.
-
-Sun Aug 11 15:20:58 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (make_temp_vec): New fn.
- * pt.c (push_template_decl): Handle partial specs.
- (instantiate_class_template): Likewise.
- (more_specialized): Use get_bindings.
- (more_specialized_class): New fn.
- (get_class_bindings): New fn.
- (most_specialized_class): New fn.
- (do_function_instantiation): List candidates for ambiguous case.
- * decl.c (duplicate_decls): Lose reference to DECL_TEMPLATE_MEMBERS.
- (shadow_tag): Call push_template_decl for partial specializations.
- * parse.y: Likewise.
- * cp-tree.h (DECL_TEMPLATE_SPECIALIZATIONS): Replaces
- DECL_TEMPLATE_MEMBERS.
- * call.c (print_z_candidates): Reduce duplication.
-
-Fri Aug 9 14:36:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (lang_decode_option): Allow -fansi-overloading.
-
-Thu Aug 8 17:04:18 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (get_bindings): New fn.
- (most_specialized): Likewise.
- (do_function_instantiation): Use them.
- (add_maybe_template): New fn.
- * cp-tree.h (DECL_MAYBE_TEMPLATE): New macro.
- * call.c (build_new_op): Handle guiding decls.
- (build_new_function_call): Likewise.
- * decl2.c (finish_file): Likewise.
-
- * decl2.c (mark_used): Do synthesis here.
- * call.c (build_method_call): Not here.
- (build_over_call): Or here.
- * typeck.c (build_function_call_real): Or here.
- * tree.c (bot_manip): Call mark_used on functions used in default
- args.
-
-Thu Aug 8 17:48:16 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * decl2.c (import_export_vtable): Delete code that disabled vtable
- heuristic on systems with ASM_OUTPUT_EXTERNAL.
-
-Wed Aug 7 12:44:11 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_x_function_call): Handle static call context
- better.
-
- * decl.c (finish_function): Set the DECL_CONTEXT of the result to
- the function, not its outer block.
-
- * call.c (build_field_call): Pass fields on to build_opfncall
- regardless of TYPE_OVERLOADS_CALL_EXPR.
- (build_method_call): Pass on to build_new_method_call sooner.
-
- * typeck.c (build_ptrmemfunc): Just return what instantiate_type
- gives us.
- * class.c (instantiate_type): Don't put a POINTER_TYPE to
- METHOD_TYPE on an expression. Also make a copy of rhs instead of
- modifying it.
-
-Tue Aug 6 12:58:46 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (compare_ics): Handle qual_conv after lvalue_conv.
- (add_builtin_candidate): Don't take enums for ++.
- (build_new_method_call): Handle non-aggregates and field calls.
- Move new overloading code from...
- * cvt.c: Here.
-
- * decl.c (grokparms): Don't check default args in templates.
-
-Mon Aug 5 17:17:06 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_new_op): Fix args to build_unary_op.
- (add_builtin_candidates): Don't call type_promotes_to on float.
-
- * decl.c (grokparms): Check the type of the default arg.
-
- * cvt.c (build_new_op): Pass non-overloaded cases on rather than
- returning NULL_TREE.
-
- * typeck.c (build_x_binary_op): Avoid doing extra work.
- (build_x_unary_op): Likewise.
- (build_x_conditional_expr): Likewise.
- * cvt.c (build_over_call): Return.
- (add_builtin_candidate): Fix MEMBER_REF.
- (build_new_op): Likewise.
-
-Mon Aug 5 17:07:47 1996 Mike Stump <mrs@cygnus.com>
-
- * method.c (build_overload_name): Put bug fix into code but leave
- disabled for now so we can be bug compatible with older releases
- that do repeats incorrectly. In the future, we can enable it.
-
-Mon Aug 5 13:46:28 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (convert_like): Don't call build_cplus_new twice.
-
- * call.c, cp-tree.h, cvt.c, decl2.c, init.c, method.c, pt.c, typeck.c:
- Control new overloading code with -fansi-overloading.
-
-Sun Aug 4 15:29:11 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_over_call): Call build_cplus_new.
- * call.c (build_method_call): Likewise.
- * typeck.c (build_function_call_real): Likewise.
- (build_conditional_expr): If both operands are TARGET_EXPRs, wrap
- the COND_EXPR in a TARGET_EXPR so they use the same slot.
-
- * cvt.c (build_up_reference): Propagate INDIRECT_BIND to
- recursive calls.
- * typeck.c (complete_type): Propagate
- TYPE_NEEDS_{CONSTRUCTING,DESTRUCTOR}.
-
-Sat Aug 3 14:05:07 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (joust): More ?: kludging. Sigh.
- (build_over_call): Don't try to synthesize global fns.
-
- * search.c (lookup_conversions): Use binfo marking.
-
-Sat Aug 3 12:33:42 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * search.c (build_mi_matrix): Use the correct value of cid
- when determining the new mi_size.
-
-Sat Aug 3 01:27:41 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (add_builtin_candidates): Do consider type conversion ops
- for the first parms of += et al.
- (strip_top_quals): New fn.
- (reference_binding): Use it instead of TYPE_MAIN_VARIANT.
- (implicit_conversion): Likewise.
- (add_builtin_candidates): Be careful about arrays.
- (build_new_method_call): Handle vtable optimization.
-
-Fri Aug 2 01:26:59 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h (LOOKUP_NO_TEMP_BIND): New flag.
- * cvt.c (reference_binding): Use it.
- (implicit_conversion): Use it.
- (add_builtin_candidate, COND_EXPR): Use it.
-
- * cvt.c (build_new_function_call): Check for error args.
-
- * typeck.c (comptypes): Just check DERIVED_FROM_P, not UNIQUELY.
-
- * gxx.gperf: Add __null.
- * hash.h: Regenerate.
- * lex.h: Add RID_NULL.
- * lex.c (init_lex): Create null_pointer_node here, stick it in
- RID_NULL.
- * decl.c (init_decl_processing): Still set its type here.
- * cvt.c (cp_convert_to_pointer): Don't produce null_pointer_node.
- (convert_to_pointer_force): Likewise.
- (null_ptr_cst_p): Check for null_pointer_node; only accept (void*)0
- if (! pedantic).
- * call.c (convert_harshness): Use null_ptr_cst_p.
- * typeck.c (convert_for_assignment): Likewise. Don't produce
- null_pointer_node.
-
- * error.c (args_as_string): Handle lists of actual args, too.
- * cvt.c (null_ptr_cst): Support (void*)0 for now.
- (build_user_type_conversion_1): Improve diagnostics.
- (build_new_function_call): Likewise.
- (build_object_call): Likewise.
- (build_new_method_call): Likewise. Move call before def diagnostic...
- (build_over_call): Here.
-
- * cvt.c (build_new_method_call): Don't complain about no match if
- LOOKUP_SPECULATIVELY.
- (build_over_call): Fix 'this' for virtual fn.
- (build_new_method_call): Add diagnostic.
-
-Thu Aug 1 16:45:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (add_function_candidate): Expect 'this' and 'in_chrg' for
- constructors to be passed in.
- (build_over_call): Likewise.
- (build_user_type_conversion_1): Pass them in.
- (convert_like): Likewise.
- (build_object_call): Handle overloaded conversions.
- (build_over_call): Pass the right args to build_vfn_ref.
- (standard_conversion): Fix pmf convs.
- (joust): Handle comparing statics and non-statics.
- (build_new_method_call): New fn.
- * call.c (build_method_call): Call it if NEW_OVER.
-
-Thu Aug 1 16:06:14 1996 Mike Stump <mrs@cygnus.com>
-
- * lex.c (do_identifier): Don't use %O on IDENTIFIER_OPNAME_Ps, use
- %D instead.
-
-Thu Aug 1 15:24:02 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Use maybe_build_cleanup_and_delete
- instead of just maybe_build_cleanup so that we deallocate the
- thrown object.
-
-Thu Aug 1 15:18:00 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (finish_prevtable_vardecl): Make non-static for pt.c's use.
- * cp-tree.h (finish_prevtable_vardecl): Add decl.
-
-Thu Aug 1 11:53:51 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * pt.c (instantiate_class_template): Call complete_type. Also, if
- we're at the end of the file and we just instantiated a template
- class with a vtable, call finish_prevtable_vardecl.
-
- * error.c (dump_decl): Don't explode (or explode more gracefully
- as appropriate) if the object being dumped has a null type.
- (dump_expr): Likewise.
-
- * search.c (build_mi_matrix): Ensure that mi_size is large enough,
- by counting the number of nodes that we'll need before allocating
- the array.
- (lookup_fnfields): Fix comment.
- (breadth_first_search): Fix comment.
-
-Wed Jul 31 09:57:05 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Propagate TYPE_PACKED and
- TYPE_ALIGN.
- * class.c (finish_struct): Call cplus_decl_attributes here.
- (finish_struct_1): Not here.
- * cp-tree.h: Adjust.
-
- * pt.c (type_unification): New parameter STRICT.
- (unify): If STRICT, don't allow cv addition or base deduction.
- * call.c, class.c, cvt.c, cp-tree.h: Adjust.
-
-Tue Jul 30 13:06:13 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * search.c (get_template_base{_recursive}): New fns.
- * pt.c (more_specialized): New fn.
- (do_function_instantiation): Use it.
- (unify): Handle base deduction.
- * cvt.c (joust): Use more_specialized.
- Don't arbitrarily choose between non-builtin candidates.
- (build_over_call): Call require_complete_type.
-
- * decl.c (start_function): Statics are static even in a #pragma
- interface file.
-
- * decl2.c (import_export_vtable): Disable vtable heuristic on
- systems with ASM_OUTPUT_EXTERNAL.
-
- * cvt.c (compare_ics): Fix comparison of PMEM_CONV and BASE_CONV.
- (standard_conversion): No std conv to enum type.
-
- * cvt.c (standard_conversion): Fix order of args to DERIVED_FROM_P
- for ptm's.
-
- * cvt.c (reference_binding): Bind directly to a base subobject of
- a class rvalue.
-
- * cvt.c (build_new_op): Enforce access control.
-
-Tue Jul 30 09:22:53 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck2.c (process_init_constructor): When scanning the
- union for a named field, skip things that aren't FIELD_DECLs.
-
- * method.c (synthesize_method): Don't scan fndecl's rtl if
- we're at the end of the file; just assume the function can't
- be inlined.
-
-Mon Jul 29 15:48:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_builtin_candidate): Stick a dummy conversion in if
- it failed.
-
- * cvt.c (build_user_type_conversion_1): Handle overloaded
- conversion ops.
-
- * cvt.c (add_builtin_candidates): Don't consider type conversion
- operators for the first parameter of operator=.
-
-Mon Jul 29 15:33:55 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (complete_type): Only call layout_type if we're not
- expanding a template.
-
-Mon Jul 29 14:40:38 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (compare_ics): Oops.
-
- * cvt.c (op_error): Oops.
-
- * cp-tree.def: Add RVALUE_CONV, rename EXACT_CONV to IDENTITY_CONV.
- * cvt.c: Add IDENTITY_RANK before others. Use real_lvalue_p.
- (build_conv): Use them.
- (implicit_conversion): Use them.
- (convert_like): Handle them.
- (build_new_op): Handle builtin COND_EXPR again.
- (add_builtin_candidates): Strip cv-quals. Fix oops. Include enums
- in lists of types for COND_EXPR.
- (add_builtin_candidate): Add enum candidates for COND_EXPR.
-
-Mon Jul 29 12:05:40 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (build_modify_expr): Always attempt to build a call to
- the assignment operator, even if we're using a default one.
- (convert_for_initialization): Call complete_type.
-
-Mon Jul 29 11:25:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (reference_binding): A REF_BIND gets the reference type.
- (implicit_conversion): Likewise.
- (convert_like): Likewise.
- (compare_ics): Likewise.
- (compare_qual): Likewise.
- (print_z_candidates): Handle no candidates.
- (build_new_op): Don't handle builtin COND_EXPR for now.
-
-Sat Jul 27 11:27:47 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * cvt.c (build_builtin_candidate): Init local var in an ANSI way.
-
-Fri Jul 26 01:07:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (joust): If the candidates are the same, arbitrarily pick one.
-
- * cvt.c (build_builtin_candidate): Oops.
- (build_new_op): Oops.
-
- * method.c (build_opfncall): Pass COND_EXPR on.
- * cvt.c (build_builtin_candidate): Reorganize, support COND_EXPR.
- (add_builtin_candidate{,s}): Likewise.
- (add_builtin_candidates): Likewise.
- (print_z_candidates, op_error, build_new_op): Likewise.
- (type_decays_to): New fn.
- * lex.c (init_lex): Just say ?: for COND_EXPR.
-
-Thu Jul 25 09:33:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (complete_type): Call layout_type rather than building
- a new array type.
-
- * cvt.c (add_builtin_candidate): Pointer arithmetic candidates
- only use ptrdiff_t.
-
-Wed Jul 24 12:45:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c: Always compile the new overloading code (but don't use it).
- (implicit_conversion): Add a BASE_CONV when converting to
- the same class type.
- (convert_like): Handle BASE_CONV.
-
-Tue Jul 23 12:46:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_new_op): Support {MAX,MIN}_EXPR.
- (add_builtin_candidate): Likewise.
-
- NEW_OVER changes:
- * typeck.c (build_x_function_call): Try an operator function
- whenever we call an object of class type.
- * method.c (build_opfncall): Pass CALL_EXPRs through.
- * cvt.c (implicit_conversion): Do const-ref case first.
- (add_conv_candidate, build_object_call, op_error): New fns.
- (ptr_complete_ob, TYPE_PTROB_P): void is not an object type.
- ({add,build}_builtin_candidate{,s}, print_z_candidates): Display
- builtin candidates.
- (build_new_op): Handle CALL_EXPR. Don't try to decay void.
- Fall back on preincrement handling. Use op_error.
- Handle warn_synth.
- (convert_like): Pass INDIRECT_BIND. Don't try to do anything with
- an error_mark_node.
- (build_over_call): Handle PROMOTE_PROTOTYPES and ellipsis promotions
- properly.
-
-Mon Jul 22 16:21:55 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * pt.c (tsubst_expr): Handle CONTINUE_STMT.
-
-Mon Jul 22 15:38:58 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref_1): Use build_component_ref
- instead of open coding it here.
-
-Mon Jul 22 12:18:54 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * g++.c (main): Don't link with -lg++.
-
- NEW_OVER changes:
- * cvt.c (convert_to_reference): Don't use convert_from_refeence on
- result of build_type_conversion.
- (cp_convert): Only call build_method_call for ctors if
- build_type_conversion failed.
- (ptr_complete_ob): New function.
- (TYPE_PTR{,OB,MEM}_P): New macros.
- ({add,build}_builtin_candidate{,s}): New functions.
- (print_z_candidates): Handle builtins.
- (build_user_type_conversion_1): Don't use conversion fns for
- converting to a base type.
- (build_user_type_conversion_1): Set ICS_USER_FLAG on AMBIG_CONVs.
- (build_user_type_conversion): Use convert_from_reference.
- (build_new_op): New function.
- (build_over_call): Fix handling of methods.
- (compare_ics): Handle AMBIG_CONV properly.
- * typeck2.c: Increment abort count.
- * method.c (build_opfncall): Forward most requests to build_new_op.
- * cp-tree.h (IS_OVERLOAD_TYPE): Tweak.
-
-Fri Jul 19 17:59:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * error.c (dump_expr, case CONSTRUCTOR, case CAST_EXPR): Take out
- invalid second argument to dump_expr_list.
-
-Fri Jul 19 14:04:05 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (lookup_name_real): Make sure we do obj->X::i correctly.
-
-Thu Jul 18 14:48:23 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl2.c (import_export_vtable): ASM_OUTPUT_EXTERNAL, not
- ASSEMBLE_EXTERNAL.
-
-Mon Jul 15 17:48:43 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck2.c (process_init_constructor): New pedwarn for using { }
- to initialize a pointer to member function.
- * typeck.c (build_ptrmemfunc1): Avoid use of digest_init so that
- we can avoid the new error.
-
-Mon Jul 15 15:42:03 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_ptrmemfunc1): New function to hide details of
- pointer to member functions better.
-
-Mon Jul 15 14:23:02 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (resolve_offset_ref): Resolve OFFSET_REFs that are
- methods into the actual method, as we know the implied object is
- not used.
-
-Mon Jul 15 13:08:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (maybecomma_warn): Only emit the pedwarn if we're not
- inside a system header.
-
-Fri Jul 12 16:30:05 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * call.c (build_method_call): Call complete_type on the
- instance type.
-
-Thu Jul 11 17:16:40 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref): Always build up an OFFSET_REF
- for obj_ptr->func so that we can know which object to use in a
- method call.
-
-Wed Jul 10 19:36:37 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_ptrmemfunc): Remove sorry, now we can cast
- around things. Also improve maintainability.
-
-Wed Jul 10 18:20:11 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl.c (grokdeclarator): Check for overflow when evaluating an
- array dimension.
-
-Wed Jul 10 17:26:19 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (cp_convert): Don't check for ambiguity with constructor
- if NEW_OVER.
-
- * typeck.c (build_x_function_call): Pass function overload
- questions to new overloading code if NEW_OVER.
- * init.c (expand_aggr_init_1): Only check for type conversion ops
- if we're doing copy-initialization (i.e. LOOKUP_ONLYCONVERTING).
- Don't check for ambiguity with constructor if NEW_OVER.
- * cvt.c (convert_to_reference): Dereference the result of a type
- conversion operator.
- (build_conv): Propagate ICS_USER_FLAG.
- (implicit_conversion): Call instantiate_type.
- Pass LOOKUP_ONLYCONVERTING instead of LOOKUP_NORMAL.
- (add_function_candidate): Fix cv-quals on argtype.
- (print_z_candidates): New function.
- (build_new_function_call): Call it.
- (build_user_type_conversion_1): If LOOKUP_ONLYCONVERTING, don't
- consider non-converting constructors.
- Call print_z_candidates.
- Return an AMBIG_CONV for an ambiguous conversion.
- (build_user_type_conversion): Handle AMBIG_CONV.
- (convert_like): Fix test for building TARGET_EXPR.
- Call instantiate_type.
- Handle AMBIG_CONV and LVALUE_CONV.
- (build_over_call): Handle 0 args and ellipsis.
- * cp-tree.def: Add AMBIG_CONV.
-
-Tue Jul 9 17:48:48 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (lookup_name_real): If we find mem in obj when parsing
- `obj->mem', make sure we return the right value.
-
-Tue Jul 9 16:11:28 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * search.c (get_base_distance): Call complete_type.
-
-Tue Jul 9 12:46:34 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (store_bindings): Make static.
-
-Mon Jul 8 16:42:31 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (expand_aggr_init_1): Don't check type conversions if
- NEW_OVER.
-
- * cvt.c (z_candidate): Put back template field.
- (add_function_candidate): Set it.
- (add_template_candidate): Likewise.
- (joust): Use it.
- (compare_qual): Handle references and pointers to members.
- (compare_ics): Handle reference bindings.
-
- * decl.c (duplicate_decls): Propagate DECL_ONE_ONLY.
-
-Mon Jul 8 16:18:56 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * call.c (compute_conversion_costs): Call complete_type.
-
- * tree.c (vec_binfo_member): Use comptypes instead of comparing
- pointers, so we can handle template parameters.
-
-Fri Jul 5 16:51:53 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): We have to call complete_type
- here; let's make it explicit instead of a side effect of an
- error check.
-
-Wed Jul 3 16:29:51 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (z_candidate): Remove template field.
- (reference_binding): Handle binding to temporary.
- (implicit_conversion): Likewise.
- (add_function_candidate): Handle artificial constructor parms.
- Handle functions with too few parms.
- (add_template_candidate): New function.
- (build_user_type_conversion_1): Handle constructors.
- (convert_like): Likewise.
- (build_over_call): Likewise.
- (build_new_function_call): Support templates.
- (compare_ics): Fix reference, inheritance handling.
-
-Mon Jul 1 22:58:18 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl.c: Add signed_size_zero_node.
- (init_decl_processing): Build it.
- * class.c (prepare_fresh_vtable): Use it instead of size_zero_node
- when we're trying to make a negative delta.
-
-Mon Jul 1 17:56:19 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Stop doing this damn index==strchr variable name confusion.
- * class.c (add_virtual_function): Change local var INDEX to be
- named IDX.
- (add_method): Likewise.
- * lex.c (print_parse_statistics): Likewise.
- * search.c (make_memoized_table_entry): Likewise.
- (lookup_fnfields_here): Likewise.
- (lookup_field): Likewise.
- (lookup_fnfields): Likewise.
- (get_baselinks): Likewise.
- * sig.c (build_signature_table_constructor): Likewise.
- (build_signature_method_call): Likewise.
- * typeck.c (build_x_array_ref): Change INDEX parm to be named IDX.
- (get_member_function_from_ptrfunc): Likewise.
- (build_ptrmemfunc): Change local var INDEX to be IDX.
- (c_expand_start_case): Likewise.
-
-Sat Jun 29 14:05:46 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Move user-defined type conversion
- handling to before extraction of TYPE_PTRMEMFUNC_FN_TYPE.
- (convert_to_reference): Use build_type_conversion to convert to
- the reference type directly.
- (standard_conversion): Fix void* case, non-conversions.
- (reference_binding): Fix expr == 0 case, non-conversions.
- (convert_like): Support REF_BIND.
- (compare_qual): Split out from compare_ics.
- (compare_ics): Use it, handle icses with only a qual_conv.
-
- * init.c (expand_vec_init): Don't crash if decl is NULL.
-
-Fri Jun 28 11:52:51 1996 Stan Shebs <shebs@andros.cygnus.com>
-
- * mpw-config.in: New file, configury for Mac MPW.
- * mpw-make.sed: New file, makefile editing for MPW.
-
-Thu Jun 27 15:18:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Call repo_template_used.
-
- * search.c (lookup_conversions): Only lookup conversions in
- complete types.
-
-Thu Jun 27 12:59:53 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.def: Renamed from tree.def, to avoid confusion with
- gcc's tree.def.
- * cp-tree.h, lex.c: Include cp-tree.def.
- * Makefile.in (CXX_TREE_H): Reference cp-tree.def.
-
-Wed Jun 26 18:29:47 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * init.c (build_vec_delete_1): Call complete_type.
-
-Mon Jun 24 17:17:32 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (start_anon_func): Make sure anonymous functions are
- never external.
-
-Fri Jun 21 15:10:58 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (finish_function): If function_depth > 1, set nested.
-
- * decl2.c (grokbitfield): Revert Bob's change.
- * class.c (finish_struct_1): Fix handling of named bitfield widths.
-
-Thu Jun 20 23:35:38 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (add_pending_template): Handle types.
- (lookup_template_class): With -fexternal-templates, just add the class
- to pending_templates instead of instantiating it now.
- * decl2.c (finish_file): Handle types in pending_templates.
-
-Thu Jun 20 14:08:40 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl2.c (grokbitfield): Handle constant decls appropriately.
- Give an appropriate error message now instead of spewing core
- later.
-
-Thu Jun 20 13:01:51 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c: Don't turn on thunks by default for now.
-
-Wed Jun 19 11:37:04 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (complete_type): Handle error_mark_node.
- (common_type, OFFSET_TYPE): Handle template_type_parms.
-
-Tue Jun 18 10:02:15 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_decl): If at_eof, call import_export_decl
- regardless of DECL_INLINE.
-
- * typeck.c (mark_addressable): Set TREE_ADDRESSABLE on CONSTRUCTORs.
-
- * class.c (finish_struct_bits): Copy TYPE_SIZE.
-
- * rtti.c (build_dynamic_cast): Support templates.
- * tree.def: Support DYNAMIC_CAST_EXPR.
- * pt.c (tsubst_copy): Likewise.
- * decl2.c (build_expr_from_tree): Likewise.
-
-Mon Jun 17 15:23:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_static_cast): Support templates.
- (build_const_cast): Likewise.
- * tree.def: Support CONST/STATIC_CAST_EXPR.
- * pt.c (tsubst_copy): Likewise.
- * decl2.c (build_expr_from_tree): Likewise.
-
-Sun Jun 16 12:33:57 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Don't trust
- TREE_SYMBOL_REFERENCED for vtables of local classes.
-
-Fri Jun 14 18:13:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst_copy): Handle operator T.
-
-Wed Jun 12 17:52:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (build_delete): Move creation of PARMS inside test of
- TYPE_HAS_DESTRUCTOR, since it's never used outside of that block.
-
-Tue Jun 11 15:09:18 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (build_conditional_expr): Don't assume that
- the arguments to ?: are always pointers or records.
-
-Tue Jun 11 13:56:23 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (import_export_decl): Still emit static/weak/comdat
- copies of inline template functions with -fno-implicit-templates.
-
-Tue Jun 11 11:42:13 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * init.c (build_delete): Determine the complete basetype
- path to the destructor we're calling.
-
-Fri Jun 7 15:30:10 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl.c (build_enumerator): Always copy the INTEGER_CST used to
- initialize the enum, because we really and truly don't know where
- it came from.
- (start_enum): Don't copy integer_zero_node because
- build_enumerator will do it.
-
-Fri Jun 7 11:11:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (finish_function): Do access control on base destructors.
-
- * pt.c (tsubst, case FUNCTION_DECL): Set up
- IDENTIFIER_GLOBAL_VALUE for member functions so pushdecl doesn't
- hose us.
-
-Fri Jun 7 10:37:33 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): If we have already extended the
- lifetime of the temporary, don't try it again.
- * typeck.c (c_expand_return): Don't try and convert the return
- value twice when we want a reference, once is enough.
-
-Tue Jun 4 15:41:45 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst_expr, case DECL_STMT): Don't pass
- LOOKUP_ONLYCONVERTING at all for now.
-
- * search.c (add_conversions): Put the conversion function in
- TREE_VALUE, the basetype in TREE_PURPOSE.
- * cvt.c (build_type_conversion): Adjust.
- * cvt.c (build_expr_type_conversion): Adjust.
- * call.c (user_harshness): Adjust.
-
-Mon Jun 3 15:30:52 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (emit_thunk): Pretend this is a FUNCTION_DECL for the
- backend's benefit.
-
-Mon Jun 10 18:58:19 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_start_catch_block): Add a dummy region, if we
- get an error, so that we can avoid core dumping later.
-
-Fri May 31 14:56:13 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (OFFSET_REF): Remove.
- * tree.def (CP_OFFSET_REF): Rename to OFFSET_REF.
- * expr.c (cplus_expand_expr): Cleanup callers of expand_expr.
- * init.c (expand_aggr_init_1): Likewise.
- (build_new): Likewise.
- * typeck.c (expand_target_expr): Likewise.
-
-Fri May 31 14:22:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_modify_expr): Don't use TREE_VALUE on a
- TARGET_EXPR.
-
-Wed May 29 17:04:33 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): Redo how and when temporaries are
- created.
- * decl.c (grok_reference_init): Don't try and be smart about
- running cleanups.
-
-Wed May 29 16:02:08 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): Add NULL_TREE to all calls to build
- (TARGET_EXPR...), now that it has 4 arguments.
- * tree.c (build_cplus_new): Likewise.
-
-Thu May 23 16:40:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * error.c (dump_expr, case CAST_EXPR): Handle T() properly.
-
- * pt.c (instantiate_decl): Don't call push/pop_cp_function_context.
- * decl.c (struct saved_scope): Remove named_labels,
- {base,member}_init_list.
- (maybe_push_to_top_level): Don't set them. Call
- push_cp_function_context if appropriate.
- (pop_from_top_level): Likewise.
-
- * method.c (do_build_assign_ref): Remove obsolete check of
- TYPE_HAS_ASSIGN_REF (basetype).
-
- * decl.c (grokfndecl): Diagnose user definition of
- implicitly-declared methods.
-
-Thu May 23 12:13:08 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * method.c (do_build_copy_constructor): Add code to give
- meaningful error messages instead of crashing.
- (do_build_assign_ref): Don't synthesize assignment operators for
- classes containing reference or const members.
-
- * class.c (struct base_info): Remove cant_synth_copy_ctor
- and cant_synth_asn_ref.
- (finish_base_struct): Remove the code that tries to conditionalize
- synthesis of copy constructors & assignment operators based on
- access permissions. Instead, let it fail when it tries to
- synthesize the copy constructor. This will give meaningful error
- messages instead of silently generating code to perform a bitcopy.
-
-Wed May 22 11:45:19 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * lex.c (real_yylex): Remove old-n-crufty #if 0 code for
- determining types for constant values.
-
- * decl.c (struct named_label_list): Use instead of stuffing
- random items into a TREE_LIST node.
- (named_label_uses): Use the new struct.
- (poplevel): Likewise.
- (lookup_label): Likewise.
- (define_label): Add an error message to tell the user the line
- where the goto is located in addition to the destination of the
- goto.
- (init_decl_processing): Use NULL instead of NULL_TREE to initialize
- named_label_uses.
- (finish_function): Likewise.
-
- (start_decl): Complain about defining a static data member
- in a different type from which it was declared.
-
-Wed May 22 09:33:23 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_expr_type_conversion): Adjust.
-
-Tue May 21 11:21:56 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (build_method_call): Always convert 'this' to the
- appropriate type.
-
- * search.c (add_conversions): Put the conversion function in
- TREE_VALUE, the type in TREE_PURPOSE.
- * cvt.c (build_type_conversion): Adjust.
- * call.c (user_harshness): Adjust.
-
- * method.c (emit_thunk): Call temporary_allocation and
- permanent_allocation around the ASM_OUTPUT_MI_THUNK case, too.
-
- * tree.c (build_cplus_array_type): Handle tweaking of
- TYPE_MAIN_VARIANT here.
- * typeck.c (common_type): Not here.
-
- * typeck.c (complete_type): Only try to complete an array type if
- it has a domain.
-
-Mon May 20 14:55:59 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokvardecl): Call complete_type.
- (grokdeclarator): Call complete_type for PARM_DECLs.
-
-Fri May 17 16:41:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Re-set
- CLASSTYPE_GOT_SEMICOLON after calling finish_struct_1.
-
-Fri May 17 14:56:55 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (cp_expand_decl_cleanup): Remove, the backend is now
- smart enough to do it right.
- * tree.c (cp_expand_decl_cleanup): Likewise.
- * decl.c (cp_finish_decl): Use expand_decl_cleanup instead of
- cp_expand_decl_cleanup.
- (store_parm_decls): Likewise.
- (hack_incomplete_structures): Likewise.
- * except.c (push_eh_cleanup): Likewise.
-
-Fri May 17 13:13:51 1996 Mike Stump <mrs@cygnus.com>
-
- * expr.c (expand_expr, cond UNSAVE_EXPR): Move from the C++
- frontend to the backend where it belongs.
- * tree.c (unsave_expr): Likewise.
- (unsave_expr_now): Likewise.
- * tree.def (UNSAVE_EXPR): Likewise.
- * cp-tree.h (unsave_expr): Likewise.
- (unsave_expr_now): Likewise.
-
-Fri May 17 11:02:41 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (emit_base_init): Make sure the partial EH cleanups live
- on the function_obstack.
-
-Thu May 16 15:29:33 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * expr.c (do_case): Don't try to dereference null TREE_TYPEs
- when checking for pointer types.
-
-Thu May 16 13:38:58 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Remove obsolete check for
- access declarations.
-
-Thu May 16 13:34:15 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_overload_call): Simplify calls to
- build_overload_call by removing last parameter.
- (build_method_call): Likewise.
- * cp-tree.h: Likewise.
- * method.c (build_opfncall): Likewise.
- * typeck.c (build_x_function_call): Likewise.
-
-Thu May 16 13:15:43 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (default_parm_conversions): Factor out common code.
- (build_method_call): Use it.
- (build_overload_call_real): Use it.
-
-Wed May 15 14:46:14 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_method_call): Allow implicit & on METHOD_TYPEs,
- but pedwarn as the code is bogus.
- * typeck.c (decay_conversion): Likewise.
- (build_function_call_real): Use build_addr_func instead of
- default_conversion. Don't allow pointer-to-method functions down
- here.
- (build_unary_op): Use real pointer-to-member functions instead of
- fake ones.
- (build_ptrmemfunc): Use build_addr_func instead of build_unary_op.
- (convert_for_assignment): Removed some obsolete code.
- * decl2.c (reparse_absdcl_as_expr): Pass current_class_ref to
- build_x_function_call instead of current_class_ptr. Only call
- digest_init once on an initializer, we do this just checking
- TREE_TYPE.
- (build_expr_from_tree): Pass current_class_ref to
- build_x_function_call instead of current_class_ptr.
- * init.c (build_member_call): Likewise.
- * pase.y: Likewise.
- * error.c (dump_expr): Handle OFFSET_REFs better.
- * pt.c (unify): Handle pointer-to-member functions better.
- * decl.c (finish_function): Clear out current_class_ref just like
- we do for current_class_ptr.
-
- * typeck.c (get_delta_difference): Handle virtual bases better.
-
-Tue May 14 16:37:37 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * sig.c (build_signature_table_constructor): Use the delta for
- the original basetype for this virtual function with thunks.
- (build_signature_method_call): We still need to adjust 'this'
- with thunks.
-
-Tue May 14 16:27:25 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_addr_func): New routine. Used to get the `real'
- address of a function or a method. Needed to avoid getting a
- pointer-to-member function.
- (build_call): New routine to build CALL_EXPRs.
- (build_method_call): Use it.
- * cvt.c (convert_to_aggr): Likewise.
- * typeck.c (build_function_call_real): Likewise.
- * sig.c (build_signature_table_constructor): Use build_addr_func.
- * cp-tree.h (build_call, build_addr_func): Declare them.
-
-Tue May 14 12:47:47 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (LOOKUP_AGGR): Remove, unused.
- * parse.y: Remove uses of LOOKUP_AGGR.
-
-Tue May 14 12:07:51 1996 Mike Stump <mrs@cygnus.com>
-
- * *.[chy]: Rename current_class_decl to current_class_ptr, and
- C_C_D to current_class_ref.
-
-Mon May 13 16:55:23 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (convert_harshness): Tighten up pointer conversions.
-
-Sat May 11 04:33:50 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Surround DECL_ONE_ONLY with ifdef.
- (finish_file): Likewise.
-
-Fri May 10 11:09:57 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (convert_fn_ptr): We don't use thunks for pmfs.
-
- * method.c (emit_thunk): Set flag_omit_frame_pointer in default
- code.
-
-Thu May 9 18:18:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c: Turn on thunks by default where supported.
-
-Tue May 7 20:39:57 1996 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (build_overload_call_maybe): Removed.
- * call.c (build_overload_call_real): Invert meaning of last arg to
- be require_complete.
- (build_overload_call): Likewise.
- * typeck.c (build_x_function_call): Use build_overload_call_real
- instead of build_overload_call_maybe.
-
-Mon May 6 01:23:32 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Don't try to emit functions that haven't
- been compiled.
-
-Fri May 3 09:30:13 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Oops.
-
- * decl.c (maybe_push_to_top_level): Do save previous_class_*.
- Also store the bindings from previous_class_values.
- (pop_from_top_level): Restore them.
-
-Thu May 2 21:56:49 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Only write out vtable if its
- symbol has been referenced.
- (finish_file): Re-join synthesis/vtable loop with inline emission
- loop, disable inlining when an inline is output.
-
-Thu May 2 17:20:02 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (init_exception_processing): Setup saved_in_catch.
- (push_eh_cleanup): Reset __eh_in_catch.
- (expand_start_catch_block): Set __eh_in_catch.
-
-Thu May 2 16:21:17 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (push_eh_cleanup): Add tracking for whether or not we
- have an active exception object.
- (expand_builtin_throw): Use it to make sure a rethrow without an
- exception object is caught.
-
-Thu May 2 11:26:41 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (maybe_push_to_top_level): Clear out class-level bindings
- cache.
-
-Wed May 1 11:26:52 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Also use sentries for vars with
- DECL_ONE_ONLY or DECL_WEAK set (should any such happen to be
- created).
-
- * lex.c (handle_cp_pragma): Disable #pragma
- interface/implementation if SUPPORTS_ONE_ONLY > 1.
-
-Tue Apr 30 11:25:46 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (emit_thunk): Wrap default case in
- temporary/permanent_allocation.
-
- * method.c (make_thunk): Use DECL_ONE_ONLY.
- (emit_thunk): Call assemble_end_function.
-
-Mon Apr 29 15:38:29 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (import_export_vtable): Use DECL_ONE_ONLY.
- (import_export_decl): Likewise.
- (finish_prevtable_vardecl): Disable vtable hack if
- SUPPORTS_ONE_ONLY > 1.
-
-Mon Apr 29 14:32:47 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_modify_expr): PREINCREMENT_EXPR and
- PREDECREMENT_EXPRs take two arguments, not one.
-
-Mon Apr 29 00:27:53 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (build_vtable_entry): Don't build thunks for abstract
- virtuals.
-
- * lex.c (real_yylex): Fix handling of __PRETTY_FUNCTION__ like C
- frontend.
-
-Sat Apr 27 16:45:35 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (set_rtti_entry): Use size_zero_node.
- (build_vtable): Likewise.
-
-Sat Apr 27 14:48:57 1996 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (finish_struct_1): Pass size_zero_node to set_rtti_entry.
- (prepare_fresh_vtable): Likewise.
-
-Fri Apr 26 13:14:14 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (emit_thunk): Call mark_used on the target function.
-
- * call.c (build_method_call): Don't warn about pending templates.
-
-Thu Apr 25 14:55:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Fix list walking logic.
-
- * typeck2.c (check_for_new_type): Only warn if -pedantic.
-
-Wed Apr 24 15:41:15 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * class.c (finish_struct_1): Remove old code for
- dont_allow_type_definitions.
- * cp-tree.h: Likewise.
- * spew.c: Make sure cp-tree.h is included before parse.h, so the
- definition of flagged_type_tree is found before it is used.
- * lex.c: Likewise.
- * parse.y: Added the ftype member to the type union, and changed a
- number of rules to use it instead of ttype. Added calls to
- check_for_new_type() as appropriate.
- * typeck2.c (check_for_new_type): New function for checking
- if a newly defined type appears in the specified tree.
- * cp-tree.h: Add new type flagged_type_tree. Add a prototype
- for check_for_new_type().
-
-Wed Apr 24 00:36:21 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Only use a sentry if the decl is public.
-
- * pt.c (tsubst_expr, DECL_STMT): If we don't have an initializer,
- don't pass LOOKUP_ONLYCONVERTING.
-
-Tue Apr 23 17:18:47 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (common_type): Fix the ARRAY_TYPE case so it
- properly keeps track of const and volatile type modifiers.
-
-Tue Apr 23 10:52:56 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (cp_tree_equal): C++ version of simple_cst_equal.
- * pt.c (comp_template_args): Use it.
-
- * rtti.c (get_tinfo_fn, build_dynamic_cast, expand_*_desc): Call
- assemble_external for artificial function decls.
-
- * decl.c (cp_finish_decl): Oops.
-
-Mon Apr 22 17:28:27 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (import_export_decl): Put static data member templates
- into common storage, or make them weak, depending on whether they
- are dynamically or statically initialized.
- (get_sentry): New function.
- (finish_file): Do import_export_decl for static data members before
- building the init/fini functions. Don't init/fini a variable that's
- EXTERNAL. Use a sentry for variables in common. Fix mismatching
- push/pop_temp_slots.
- * decl.c (cp_finish_decl): If DECL_NOT_REALLY_EXTERN, do the
- expand_static_init thang.
- * method.c (get_id_2): New function.
-
-Mon Apr 22 15:32:45 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * parse.y (empty_parms): Make sure we use C++-style prototypes
- when we're declaring member functions.
-
-Sun Apr 21 10:08:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (CONFLICTS): 16 s/r conflicts.
- * parse.y (self_template_type): New nonterminal.
-
-Thu Apr 18 08:56:54 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (make_typename_type): Handle getting a TYPE_DECL for a
- name.
- * parse.y (base_class.1): Allow 'typename foo::bar'.
-
- * lex.c (check_newline): Remove #pragma code that plays with the
- input stream, since we now deal with tokens. Clear nextchar when
- we're done.
- (handle_cp_pragma): Use real_yylex.
- (handle_sysv_pragma): Don't do skipline here. Only call real_yylex
- in one place.
-
- * lex.c (check_for_missing_semicolon): Handle SELFNAME.
-
- * lex.c (handle_cp_pragma): Fix "#pragma implementation".
-
-Wed Apr 17 16:51:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y: New token SELFNAME for potential constructor.
- * spew.c (yylex): Handle it.
- * lex.c (identifier_type): Produce it.
-
- * parse.y (complete_type_name): In :: case, don't push class binding.
- (complex_type_name): Likewise.
-
-Wed Apr 17 15:02:40 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_reinterpret_cast): Handle pointer to member
- functions.
-
-Wed Apr 17 12:28:26 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * lex.c (handle_cp_pragma): New function, with decl, doing the cc1plus
- pragmas.
- (check_newline): Put the vtable/unit/implementation/interface pragma
- code into handle_cp_pragma, replacing it with a call.
- (handle_sysv_pragma): Give int return type, and take FINPUT and TOKEN
- args. Get the next token after handling the pragma token.
-
-Wed Apr 17 10:28:34 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Avoid doing base analysis on pmfs.
- (convert_to_pointer_force): Likewise.
-
- * init.c (build_new): Fix array new without -fcheck-new.
-
-Tue Apr 16 13:44:58 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h, call.c, class.c, decl.c, parse.y, pt.c, rtti.c,
- tree.c: Lose TYPE_NESTED_NAME.
-
- * parse.y (nested_name_specifier_1): Don't treat non-identifiers
- as identifiers.
-
- * tree.def: Add VEC_INIT_EXPR.
- * expr.c (cplus_expand_expr): Handle it.
- * init.c (build_new): Use it instead of the RTL_EXPR nastiness and
- the extra file-scope symbol nastiness.
-
-Mon Apr 15 16:21:29 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (make_thunk): Thunks are static.
- (emit_thunk): Use ASM_OUTPUT_MI_THUNK if it's defined.
-
- * decl2.c (mark_vtable_entries): Emit thunks as needed.
- (finish_file): Don't emit them here.
-
-Sun Apr 14 11:34:39 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (build_dynamic_cast): Handle null pointers.
- (ifnonnull): New function.
-
-Fri Apr 12 09:08:27 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * call.c (build_method_call): Remember the original basetype we
- were called with. Give an error message instead of trying
- (incorrectly) to call a non-static member function through a
- non-inherited class.
-
- * search.c (expand_upcast_fixups): Mark the new fixup as
- DECL_ARTIFICIAL.
-
-Thu Apr 11 03:57:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_new): Use a TARGET_EXPR for alloc_expr.
-
- * class.c (set_rtti_entry): Fix for thunks.
-
- * decl2.c (import_export_decl): Still emit typeinfo fns for
- cv-variants of builtin types.
-
- * rtti.c (expand_class_desc): Set up base_info_type_node here.
- (init_rtti_processing): Instead of here.
-
-Wed Apr 10 14:17:13 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (init_rtti_processing): Do init regardless of -frtti.
- (build_typeid): Only complain about taking dynamic typeid without
- -frtti.
-
- * decl2.c: flag_rtti defaults to 1.
-
- * rtti.c (get_tinfo_var): The general class case is now smaller.
- (init_rtti_processing): Pack the latter three fields of base_info
- into 32 bits.
-
-Wed Apr 10 13:50:14 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (expand_member_init): Don't dump if name is NULL_TREE.
-
-Wed Apr 10 12:56:02 1996 Mike Stump <mrs@cygnus.com>
-
- * search.c (make_memoized_table_entry): Undefer the pop, if necessary.
- (push_memoized_context): Split out code to undefer pop_type_level to
- (clear_memoized_cache): here.
- (pop_memoized_context): We can only handle one layer of deferral of
- pop_type_level so clear the cache, if there was a previous level.
-
-Tue Apr 9 23:06:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (init_rtti_processing): Build up base_info_type_node.
- (expand_class_desc): Use one pointer to an array of base_info
- structs, passed using a CONSTRUCTOR.
-
-Tue Apr 9 14:20:57 1996 Mike Stump <mrs@cygnus.com>
-
- * class.c (build_vbase_path): Remove block extern for
- flag_assume_nonnull_objects here.
- (build_vfn_ref): Split out functionality into build_vtbl_ref.
- (build_vtbl_ref): New routine.
- (build_vtable): Set up rtti info here.
- (add_virtual_function): Note in CLASSTYPE_RTTI the best
- place where we can get the rtti pointers from to avoid having to
- search around for a place.
- (finish_base_struct): Likewise.
- (finish_struct_1): Likewise. Never create totally new vtables
- with totally new vtable pointers for rtti. Disable code to layout
- vtable pointers better until we want to break binary
- compatibility.
- * rtti.c (build_headof_sub): New routine to convert down to a
- sub-object that has an rtti pointer in the vtable.
- (build_headof): Use it. Also, use build_vtbl_ref now to be more
- maintainable.
- (build_dynamic_cast): Make sure we have saved it, if we need to.
- * search.c (dfs_init_vbase_pointers): Disable code that deals with
- a more efficient vtable layout, enable later.
- * call.c (flag_assume_nonnull_objects): Moved declaration to
- * cp-tree.h: here. Declare build_vtbl_ref.
- * pt.c (instantiate_class_template): Use NULL_TREE instead of 0 in
- function calls that want a tree.
-
-Tue Apr 9 12:10:26 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (build_dynamic_cast): Handle downcasting to X* given
- other X subobjects in the most derived type. Ack.
-
- * rtti.c (build_dynamic_cast): No need to strip cv-quals here,
- get_typeid will do it for us.
- (get_typeid_1): Break out call-building for expand_*_desc to use.
- (get_typeid): Call it.
- (expand_*_desc): Likewise.
- * decl.c (init_decl_processing): Don't set TYPE_BUILT_IN on char *
- and void *.
- (init_decl_processing): Lose builtin_type_tdescs lossage.
- * decl2.c (finish_vtable_vardecl): Remove obsolete code.
-
-Mon Apr 8 17:23:23 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * pt.c (tsubst): When calling set_nested_typename, use
- TYPE_NESTED_NAME (current_class_type) instead of
- current_class_name.
-
- * decl.c (pushdecl): Likewise.
- (pushdecl_class_level): Likewise.
- (grokdeclarator): Use NULL_TREE instead of 0 in the call to
- set_nested_typename.
-
-Sun Apr 7 10:44:31 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (synthesize_tinfo_fn): Handle arrays.
-
- * cp-tree.h (DECL_REALLY_EXTERN): New macro.
-
-Sat Apr 6 13:56:27 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * rtti.c (throw_bad_cast): Use entry point __throw_bad_cast.
- (init_rtti_processing): Lose bad_cast_type.
- (build_dynamic_cast): Use throw_bad_cast.
-
- * rtti.c (synthesize_tinfo_fn): Handle enums and pmfs.
-
- * decl2.c (finish_file): Don't synthesize artificial functions
- that are external and not inline.
-
- * rtti.c (get_tinfo_fn): If at_eof, call import_export_decl.
-
- * decl2.c (finish_file): Handle having new inlines added to
- saved_inlines by synthesis.
-
- * rtti.c (get_bad_cast_node): Don't require <typeinfo>.
-
-Fri Apr 5 17:02:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- RTTI rewrite to initialize nodes as needed, not require that
- users #include <typeinfo>, complete functionality and reduce wasted
- space.
- * rtti.c (init_rtti_processing): New fn.
- (build_typeid): The vtable entry is now a function.
- (get_tinfo_var): New fn.
- (get_tinfo_fn): Likewise.
- (get_typeid): Use it.
- (build_dynamic_cast): Declare and use entry point __dynamic_cast.
- (build_*_desc): Rename to expand_*_desc and rewrite to use entry
- points __rtti_*.
- (add_uninstantiated_desc, get_def_to_follow, build_t_desc): Lose.
- (synthesize_tinfo_fn): New fn.
- * method.c (build_t_desc_overload): Lose.
- (build_overload_with_type): More generic.
- * decl.c (init_decl_processing): Call init_rtti_processing.
- * class.c (set_rtti_entry): Use get_tinfo_fn.
- * decl2.c (mark_vtable_entries): Mark the rtti function.
- (finish_prevtable_vardecl): Don't build_t_desc.
- (import_export_decl): Handle tinfo functions.
- (finish_file): Likewise.
- * typeck.c (inline_conversion): New fn.
- (build_function_call_real): Use it.
- * cp-tree.h: Add decls.
-
- * method.c (hack_identifier): Also convert component_refs from
- references.
-
- * lex.c (cons_up_default_function): Use the type, not the name, in
- declspecs.
-
- * decl2.c (import_export_vtable): Fix weak vtables.
-
-Fri Apr 5 13:30:17 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * search.c (get_base_distance_recursive): Fix access checks for
- protected bases.
-
-Fri Apr 5 11:02:06 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (unary_complex_lvalue): Delete unneeded decl, it's in
- cp-tree.h.
- (convert_harshness): Add prototypes wrapped by PROTO.
- * decl2.c (grok_function_init): Likewise.
- (do_toplevel_using_decl): Change to void return type.
- * class.c (build_vtable_entry): Remove decl of make_thunk.
- (merge_overrides): Fix order of arg definitions.
- (finish_vtbls): Likewise.
- (fixup_vtable_deltas): Likewise.
- (modify_all_direct_vtables): Likewise.
- (modify_all_indirect_vtables): Likewise.
- * search.c (get_base_distance_recursive): Likewise.
- (get_abstract_virtuals_1): Likewise.
- (fixup_virtual_upcast_offsets): Likewise.
- (lookup_fnfields_1): Add prototypes wrapped by PROTO.
- * init.c (perform_member_init): Fix order of arg definitions.
- (expand_aggr_init_1): Add prototypes wrapped by PROTO.
- * cp-tree.h (make_thunk): Add decl.
- (overload_template_name, push_template_decl): Add decls.
- (do_toplevel_using_decl): Change to void return type.
- (vec_binfo_member): Add decl.
-
-Thu Apr 4 13:33:10 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (mark_addressable, convert_for_assignment,
- convert_for_initialization, pointer_int_sum, pointer_diff,
- unary_complex_lvalue): Add prototypes wrapped by PROTO.
- (convert_sequence): #if 0 fn decl, since definition also is.
-
-Thu Apr 4 11:00:53 1996 Mike Stump <mrs@cygnus.com>
-
- * rtti.c (build_dynamic_cast): Make sure we strip qualifiers on
- cast to pointer types for type searching.
-
-Wed Apr 3 17:10:57 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (get_delta_difference): Use cp_error, not error, in the
- case where BINFO == 0.
-
-Wed Apr 3 12:01:02 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_method_call): Fix wording of error messages so
- constructors come out right.
-
-Tue Apr 2 16:06:59 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * decl.c (push_overloaded_decl): Don't warn about hidden
- constructors when both the type and the function are declared
- in a system header file.
-
-Mon Apr 1 09:03:13 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * class.c (finish_struct_1): Propagate the TYPE_PACKED
- flag for the type to the type's fields.
-
-Sat Mar 30 12:14:33 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (complex_parmlist, ELLIPSES): Take out ARM-based warning.
-
-Fri Mar 29 15:51:36 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * class.c (base_info, finish_base_struct): Replace
- needs_virtual_dtor with base_has_virtual.
-
- (finish_struct_1): Remove the old code that tried to make default
- destructors virtual. Use base_has_virtual when checking if we need
- to add a vtable entry for the rtti code.
-
-Fri Mar 29 14:02:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (push_template_decl): Complain about template decl with
- inappropriate declaration.
-
-Fri Mar 29 12:15:35 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (build_x_unary_op): Remove bogus check for taking
- the address of a member function.
-
-Fri Mar 29 11:56:02 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (constructor_declarator): Only push the class if
- we are not already in the class.
-
-Fri Mar 29 09:41:02 1996 Jeffrey A. Law <law@cygnus.com>
-
- * method.c (emit_thunk): Remove current_call_is_indirect nonsense.
- Add additional argument to INIT_CUMULATIVE_ARGS.
-
-Thu Mar 28 16:41:39 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (shadow_tag): Fix error about anon union with methods.
-
- * parse.y (self_reference): Only generate a self-reference if this
- is a non-template class.
- (opt.component_decl_list): Only use it if it was generated.
-
- * parse.y (component_decl_1): Use constructor_declarator.
- (fn.def2): Likewise.
- (notype_component_declarator0): Likewise.
-
-Thu Mar 28 15:11:35 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (build_x_unary_op): Add checks for taking the address
- of a TARGET_EXPR or of a member function, and give appropriate
- warnings.
-
-Thu Mar 28 14:49:26 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (process_template_parm): Allow template type parms to be
- used as types for template const parms.
-
-Wed Mar 27 15:51:19 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (expand_vec_init): Ensure the eh cleanups are on the
- function_obstack.
-
-Wed Mar 27 10:14:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (lookup_name_real): Be even more picky about the
- ambiguous lookup warning.
- (grokdeclarator): Tweak SCOPE_REF constructor declarators here.
- * parse.y (constructor_declarator): Rather than here.
-
- * parse.y (constructor_declarator): New nonterminal.
- (fn.def1): Use it.
- (explicit_instantiation): Likewise.
-
-Tue Mar 26 13:41:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- Add implicit declaration of class name at class scope.
- * decl.c (lookup_name_real): Restrict pedwarn about ambiguous lookup.
- * parse.y (self_reference): New nonterminal.
- (opt.component_decl_list): Use it.
- (fn.def1): Add nested_name_specifier type_name cases.
- * class.c (build_self_reference): New function.
- (finish_struct): Handle access_default later, move self-reference
- decl to the end.
- * pt.c (lookup_template_class): Handle getting a TYPE_DECL.
- * cp-tree.h: Adjust.
-
- * pt.c (do_function_instantiation): Separate handling of member
- functions and non-member functions properly.
-
-Mon Mar 25 14:23:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (process_template_parm): Improve error for 'volatile class K'.
-
- * class.c (finish_struct_1): Check the right slot for destructors.
-
- * decl.c (start_enum): Complain about enum templates.
-
-Mon Mar 25 13:25:31 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (resolve_offset_ref): Offset pointers to member data by one.
- * typeck.c (unary_complex_lvalue): Likewise.
-
-Mon Mar 25 13:30:42 1996 Bob Manson <manson@charmed.cygnus.com>
-
- * typeck.c (c_expand_return): Check for a returned local
- array name, similar to the check for an ADDR_EXPR.
-
-Mon Mar 25 13:07:19 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (cp_finish_decl): Don't build cleanups for static
- variables here.
-
-Fri Mar 22 17:57:55 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_modify_expr): Fix error messages to be more
- accurate.
- * cp-tree.h (assop_as_string): Parallel to op_as_string, but for
- assignment operators.
- * error.c (assop_as_string): Likewise. Add support for `%Q' for
- assignment operators.
-
-Fri Mar 22 13:48:29 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokdeclarator): Call bad_specifiers for typedefs. Also
- give an error if initialized. Pedwarn about nested type with the
- same name as its enclosing class.
-
- * pt.c (tsubst, case TYPE_DECL): Set DECL_CONTEXT.
-
- * typeck.c (require_complete_type): Be sure to instantiate the
- MAIN_VARIANT of the type.
-
- * decl2.c (finish_file): Instantiate pending templates before
- processing static constructors and destructors.
-
- * pt.c (instantiate_decl): Don't instantiate functions at toplevel
- unless at_eof.
-
-Fri Mar 22 09:30:17 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * decl2.c (delete_sanity): If error_mark_node is passed
- in as an expression, quit while we're ahead.
-
- * decl.c (grokdeclarator): Give an error message if `friend'
- is combined with any storage class specifiers.
-
-Wed Mar 20 14:51:55 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (named_complex_class_head_sans_basetype): Don't crash on
- definition of nonexistent nested type.
-
- * error.c (dump_decl, case TYPE_DECL): Fix decision for whether or
- not to say 'typedef'.
-
-Wed Mar 20 00:11:47 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (struct lang_type): Make search_slot a tree, not a char*.
- * search.c (dfs_walk, dfs_init_vbase_pointers,
- expand_upcast_fixups): Remove cast of CLASSTYPE_SEARCH_SLOT.
- (dfs_find_vbases): Remove cast for CLASSTYPE_SEARCH_SLOT init.
-
-Tue Mar 19 17:56:03 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * except.c (build_throw): Support minimal parse.
- * pt.c (tsubst_copy): Support THROW_EXPR.
- * decl2.c (build_expr_from_tree): Likewise.
-
- * pt.c (mangle_class_name_for_template): Always allocate
- scratch_firstobj.
-
-Tue Mar 19 16:34:31 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Give an appropriate error
- when trying to cast from an incomplete type.
-
-Tue Mar 19 16:00:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): Don't bother setting up
- CLASSTYPE_TAGS explicitly, as the nested types will add
- themselves.
-
-Tue Mar 19 15:48:43 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * decl.c (shadow_tag): Remove old error check for usage of
- an enum without a previous declaration.
- (xref_tag): Add error message about usage of enums without a
- previous declaration.
-
-Tue Mar 19 09:21:35 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (do_identifier): Only do name consistency check if we're
- parsing.
-
- * pt.c (push_template_decl): Don't crash if we get a member defn
- that doesn't match.
-
- * decl.c (xref_tag_from_type): New function to do an xref without
- always having to figure out code_type_node.
- * cp-tree.h: Declare it.
- * pt.c (instantiate_class_template): Use it for friend classes.
- (lookup_template_class): Use it.
-
- * typeck2.c (build_functional_cast): Pull out a single parm before
- passing it to build_c_cast.
-
-Tue Mar 19 09:07:15 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * expr.c (do_case): Give an error message if a pointer is
- given as a case value.
-
-Mon Mar 18 21:57:54 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_c_cast): Don't pull single TEMPLATE_DECL out of
- an overload list.
-
- * lex.c (cons_up_default_function): Really, now, interface hackery
- does not apply to synthesized methods.
-
-Mon Mar 18 18:20:57 1996 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_method_call): Ctors and dtors now have special names
- with respect to lookups.
- * class.c (add_method): Likewise.
- (grow_method): Likewise.
- (finish_struct_methods): Likewise.
- (warn_hidden): Likewise.
- (finish_struct_1): Likewise.
- * cvt.c (convert_to_reference): Likewise.
- (convert_to_aggr): Likewise.
- (cp_convert): Likewise.
- * decl2.c (check_classfn): Likewise.
- * init.c (expand_member_init): Likewise.
- (expand_default_init): Likewise.
- (expand_aggr_init_1): Likewise.
- (build_offset_ref): Likewise.
- (build_new): Likewise.
- (build_delete): Likewise.
- * lex.c (do_inline_function_hair): Likewise.
- * search.c (lookup_field_1): Likewise.
- (lookup_fnfields_here): Likewise.
- (lookup_field): Likewise.
- (lookup_fnfields): Likewise.
- (get_virtual_destructor): Likewise.
- (dfs_debug_mark): Likewise.
- (dfs_pushdecls): Likewise.
- (dfs_compress_decls): Likewise.
- * tree.c (layout_basetypes): Likewise.
- * typeck.c (build_component_ref): Likewise.
- (build_x_function_call): Likewise.
- (build_modify_expr): Likewise.
- (convert_for_initialization): Likewise.
- (build_functional_cast): Likewise.
- * cp-tree.h (CLASSTYPE_FIRST_CONVERSION): Likewise.
- (CTOR_NAME): New.
- (DTOR_NAME): New.
- * decl.c (ctor_identifier): New.
- (dtor_identifier): New.
- (init_decl_processing): Set them.
-
-Mon Mar 18 18:00:51 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref): Don't get confused by fields whose
- context has no type name, like pointer to member functions.
-
-Mon Mar 18 13:19:03 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokdeclarator): Handle typedef without declarator.
-
- * pt.c (tsubst): Handle SCOPE_REF in declarator.
-
- * parse.y (bad_parm): Catch another case of missing `typename'.
-
- * lex.c (yyprint): Handle TYPE_DECLs.
-
- * decl.c (start_function): Don't try to be clever.
-
- * lex.c: Lose compiler_error_with_decl.
- * typeck2.c: Lose error_with_aggr_type.
- (incomplete_type_error): Use cp_* instead of old functions.
- (readonly_error): Likewise.
- * typeck.c (convert_arguments): Likewise.
- * search.c (lookup_nested_field): Likewise.
- * method.c (make_thunk): Likewise.
- * decl.c (grokparms): Likewise.
- * cp-tree.h: Update.
-
- * tree.c (min_tree_cons): Call copy_to_permanent for the purpose
- and value.
-
-Mon Mar 18 11:25:52 1996 Bob Manson <manson@beauty.cygnus.com>
-
- * method.c (build_opfncall): When deleting a pointer to an
- array, build a new pointer to the tree past any ARRAY_TYPE
- nodes.
-
-Mon Mar 18 10:11:46 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (lookup_name_real): Initialize local var TYPE to NULL_TREE.
-
-Fri Mar 15 11:03:57 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_decl): Only call import_export_decl if at_eof
- and ! DECL_INLINE.
-
- * decl.c (finish_function): Don't set nested based on
- hack_decl_function_context.
- * parse.y (function_try_block): Check for nested function.
- (pending_inlines): Likewise.
-
- * decl2.c (build_expr_from_tree): If a unary op already has a
- type, just return it.
-
- * decl2.c (finish_prevtable_vardecl): Use ADJUST_VTABLE_LINKAGE.
-
- * decl2.c (walk_vtables): vardecl_fn returns int; return 1 if it does.
- (finish_file): Check the return value of walk_vtables.
- (finish_prevtable_vardecl): Return int.
- (finish_vtable_vardecl): Likewise.
- (prune_vtable_vardecl): Likewise.
- * lex.c (set_vardecl_interface_info): Likewise.
- * cp-tree.h: Adjust return types.
-
- * class.c (delete_duplicate_fields_1): Don't complain about
- duplicate nested types if they're the same type.
- (finish_struct): Remove check for duplicate.
- * decl2.c (grokfield): Don't check for typedef of anonymous type.
-
-Thu Mar 14 10:00:19 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h: Lose SIGNATURE_GROKKING_TYPEDEF.
-
- * decl.c (grokdeclarator): Lose special handling of class-level
- typedef. Lose SIGNATURE_GROKKING_TYPEDEF. Set
- SIGNATURE_HAS_OPAQUE_TYPEDECLS later.
-
- * cvt.c (convert_pointer_to_real): Retain cv-quals in conversion.
-
- * pt.c (tsubst_copy): Strip cv-quals from destructor name types.
-
- * search.c (compute_access): Fix handling of anonymous union
- members.
- * class.c (finish_struct_anon): Propagate TREE_{PRIVATE,PROTECTED}
- from anonymous unions to their members.
-
- * typeck.c (build_x_function_call): For static member functions,
- hand off to build_member_call.
-
-Wed Mar 13 14:03:34 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_component_ref): Handle OFFSET_REFs.
-
- * init.c (expand_vec_init): Fix init == 0 case.
-
-Tue Mar 12 14:36:02 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_new): Pedwarn about init and array new.
- (expand_vec_init): Handle lists, use convert_for_initialization
-
- * typeck.c (convert_for_initialization): Pass LOOKUP_NO_CONVERSION
- when converting to an aggregate type.
- * cvt.c (cp_convert): Pass it through.
-
- * typeck.c (build_conditional_expr): Handle user-defined
- conversions to slightly different types.
-
- * decl.c (grokdeclarator): Force an array type in a parm to be
- permanent.
-
- * decl2.c (do_using_directive): Sorry.
- (do_namespace_alias): Likewise.
- * lex.c (real_yylex): Warn about using the `namespace' keyword.
-
-Sun Mar 10 22:26:09 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (datadef): Move call to note_list_got_semicolon up.
-
-Fri Mar 8 11:47:26 1996 Mike Stump <mrs@cygnus.com>
-
- * tree.c (unsave_expr): Don't unsave, UNSAVE_EXPRs.
-
-Fri Mar 8 11:29:06 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (cp_finish_decl): The exception regions have to be
- nested, not overlapping. We start the exception region for a
- decl, after it has been fully built, and all temporaries for it
- have been cleaned up.
-
-Thu Mar 7 17:46:06 1996 Mike Stump <mrs@cygnus.com>
-
- * tree.c (vec_binfo_member): Don't core dump if we have no bases.
-
-Thu Mar 7 14:11:49 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.def: Add RETURN_INIT.
- * pt.c (instantiate_decl): Handle RETURN_INIT.
- * decl.c (store_return_init): Handle minimal_parse_mode.
-
- * tree.c (cp_build_type_variant): Just return an error_mark_node.
- * decl.c (make_typename_type): Don't try to get the file and line
- of an identifier.
- * typeck.c (comptypes): Handle TYPENAME_TYPE.
-
-Wed Mar 6 18:47:50 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (poplevel): Make sure we clear out and restore old local
- non-VAR_DECL values by default when they go out of scope.
-
-Wed Mar 6 09:57:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (build_overload_value): Use DECL_ASSEMBLER_NAME in
- referring to addresses of variables and functions.
-
- * error.c (dump_expr): Support SIZEOF_EXPR.
-
- * init.c (do_friend): Use the return value of check_classfn.
-
- * typeck.c (convert_arguments): Call complete_type.
-
- * method.c (hack_identifier): After giving an error, set value to
- error_mark_node.
-
-Tue Mar 5 16:00:15 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (hack_decl_function_context): Kludge around DECL_CONTEXT
- lossage for local classes.
- * cp-tree.h: Declare it.
- * decl.c (lookup_name_real): Evil, painful hack for local classes.
- (grokfndecl): Set DECL_CLASS_CONTEXT and DECL_NO_STATIC_CHAIN here.
- Use hack_decl_function_context.
- (grokdeclarator): Don't set DECL_NO_STATIC_CHAIN here.
- (start_function): Use hack_decl_function_context.
- (finish_function): Likewise.
- * method.c (synthesize_method): Likewise.
- * lex.c (process_next_inline): Likewise.
- (do_pending_inlines): Likewise.
- * decl2.c (finish_file): Unset DECL_STATIC_FUNCTION_P when we're
- done with it.
-
-Mon Mar 4 22:38:39 1996 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
-
- * sig.c (build_signature_pointer_or_reference_type): Align
- signature pointers/references on 8-byte boundaries so they can be
- grabbed 2 words at a time on a Sparc.
-
-Tue Mar 5 10:21:01 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (hack_identifier): Requiring a static chain is now a
- hard error.
- * decl.c (grokdeclarator): Set DECL_NO_STATIC_CHAIN on nested
- functions.
-
-Mon Mar 4 20:03:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * init.c (build_offset_ref): Call complete_type.
-
- * decl.c (pop_from_top_level): Always pop previous_class_type.
-
- * parse.y: Handle multiple decls in a for-init-statement.
- * pt.c (tsubst_expr): Likewise.
-
- * pt.c (tsubst): Use tsubst_expr for the second operand of an
- ARRAY_REF.
-
- * decl.c (maybe_push_to_top_level): Don't save previous_class_type.
- (poplevel_class): Set it here.
- (pop_from_top_level): Pop it here if we're returning to class scope.
- * class.c (pushclass): Don't set it here.
-
- * decl.c (maybe_push_to_top_level): Save current_template_parms,
- and clear it if !pseudo.
- (pop_from_top_level): Restore it.
-
- * decl2.c (finish_file): Push the dummy each time we walk the list
- of vtables.
-
- * error.c (dump_expr): Support LOOKUP_EXPR and actually do
- something for CAST_EXPR.
-
-Mon Feb 19 14:49:18 1996 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * cvt.c (cp_convert): Warn about implicit conversion of the
- address of a function to bool, as it is always true.
-
-Fri Feb 23 23:06:01 1996 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * typeck.c (c_expand_return): Fix warning for local externs returned.
-
-Mon Mar 4 15:03:11 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (mapcar): Propagate const and volatile properly.
-
- * typeck.c (complete_type): Be sure to instantiate the
- MAIN_VARIANT of the type.
-
- * method.c (synthesize_method): Class interface hackery does not
- apply to synthesized methods.
-
-Mon Mar 4 14:05:23 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (comp_template_args): Use comptypes rather than just
- checking for TEMPLATE_TYPE_PARM equivalence.
-
- * typeck.c (build_x_function_call): Call complete_type before
- checking TYPE_OVERLOADS_CALL_EXPR.
-
-Mon Mar 4 18:48:30 1996 Manfred Hollstein <manfred@lts.sel.alcatel.de>
-
- * g++.c (main): Check also for new define ALT_LIBM.
-
-Fri Mar 1 13:09:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_class_template): If we don't have a pattern
- yet, that's OK.
- (coerce_template_parms): If we see a local class, bail.
-
- * decl.c (grok_reference_init): Make sure there's a type before
- checking its code.
-
- * pt.c (do_function_instantiation): Avoid crashing on invalid decls.
- (push_template_decl): Likewise.
-
- * parse.y (named_class_head): Set
- CLASSTYPE_TEMPLATE_SPECIALIZATION here if we have basetypes.
-
- * decl.c (xref_tag): Diagnose redeclaration of template
- type-parameter name.
-
- * error.c (dump_type): Handle anonymous template type parms.
-
- * pt.c (instantiate_template): Use TYPE_MAIN_DECL instead of
- TYPE_STUB_DECL.
- (coerce_template_parms): Likewise.
-
-Thu Feb 29 16:26:01 1996 Mike Stump <mrs@cygnus.com>
-
- * class.c (instantiate_type, case {ARRAY,INDIRECT}_REF,
- case ADDR_EXPR): Don't modify rhs if a subinstantiation fails.
-
-Thu Feb 29 08:20:25 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (instantiate_template): Take the MAIN_VARIANT of the type
- before trying to get its STUB_DECL.
- (coerce_template_parms): Likewise.
-
- * parse.y (template_type_parm): If they didn't use 'class',
- pretend they did after giving an error.
-
- * pt.c (coerce_template_parms): Diagnose use of local class.
-
- * decl.c (grok_reference_init): Use instantiate_type.
-
- * error.c (dump_expr): Handle TEMPLATE_DECLs.
-
- * parse.y (named_class_head): Diagnose mismatching types and tags.
-
- * decl.c (pushdecl): Type decls and class templates clash with
- artificial type decls, not hide them.
-
- * decl.c (redeclaration_error_message): Diagnose redefinition of
- templates properly.
- (duplicate_decls): Diagnose disallowed overloads for template
- functions, too.
-
- * decl.c (start_decl): Call complete_type before checking for a
- destructor.
-
- * pt.c (tsubst): Use tsubst_expr on the elts of a VEC.
-
- * decl.c (xref_tag): A TEMPLATE_TYPE_PARM is a match.
-
-Wed Feb 28 09:28:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grok_op_properties): Don't check for operator++(int) in
- a template.
-
- * tree.c (perm_manip): Return a copy of variable and function
- decls with external linkage.
-
- * tree.def: Change some of the min tree codes to type "1".
- * pt.c (uses_template_parms): Handle 'e's, return 1 for LOOKUP_EXPRs.
- * method.c (build_overload_int): Emit something arbitrary for
- anything but an INTEGER_CST if we're in a template.
-
- * decl.c (cp_finish_decl): Call complete_type before deciding
- whether or not to lay out the decl.
-
- * lex.c (do_identifier): Check for DECL_INITIAL before using it.
-
-Tue Feb 27 16:35:32 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck2.c (build_x_arrow): Call complete_type.
-
- * pt.c (add_pending_template): Broken out.
- (lookup_template_class): If -fexternal-templates, call it for all
- the methods of implemented types.
- (instantiate_class_template): Instead of instantiating them here.
- (instantiate_decl): Handle -fexternal-templates earlier.
-
-Tue Feb 27 15:51:32 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * search.c, lex.c, decl.c, class.c, cp-tree.h: Don't wrap the
- memoized lookup stuff inside GATHER_STATISTICS.
-
-Tue Feb 27 10:38:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (start_decl): Complain about array of incomplete type
- here.
- (grokdeclarator): Not here.
-
- * parse.y (template_parm): Expand full_parm inline so we can set
- the rule's precedence.
-
- * pt.c (tsubst_expr): If we're in a template, just do tsubst_copy.
- (tsubst): tsubst_expr the DECL_INITIAL of FIELD_DECLs.
- * decl2.c (grokbitfield): Don't check for integer constant here.
- * class.c (finish_struct_1): Check here.
-
- * decl.c (define_label): Make the min decl go on permanent_obstack.
-
- * pt.c (unify): Don't handle CONST_DECLs.
- (uses_template_parms): Don't check DECL_INITIAL on a CONST_DECL.
- (tsubst_copy): Likewise.
-
- * lex.c (do_identifier): Do pull the DECL_INITIAL out of a
- CONST_DECL for a template parm.
-
-Mon Feb 26 12:48:18 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokdeclarator): Complain about array of incomplete type
- here.
- (start_decl_1): Not here.
-
- * pt.c (tsubst): Handle pointer-to-function declarators.
-
- * method.c (hack_identifier): If pedantic, diagnose local class
- methods that require a static chain.
-
- * decl.c (grok_op_properties): No longer static.
- * cp-tree.h: Declare it.
- * pt.c (tsubst): Call it for operators.
- Use tsubst_copy for TREE_VECs.
-
- * parse.y (template_arg): The expr has precedence like '>'.
-
-Fri Feb 23 14:51:52 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (coerce_template_parms): Don't coerce an expression using
- template parms.
- (uses_template_parms): Also check DECL_INITIAL in CONST_DECLs.
- (tsubst): Don't use build_index_2_type if the max_value uses template
- parms.
- * method.c (build_overload_int): Emit something arbitrary for an
- expression using template parms.
-
- * parse.y (template_close_bracket): New non-terminal to catch use
- of '>>' instead of '> >' in template class names.
- (template_type): Use it.
- * Makefile.in (CONFLICTS): Causes one more r/r conflict.
-
- * tree.def: Add CAST_EXPR.
- * typeck2.c (build_functional_cast): Use CAST_EXPR instead of
- CONVERT_EXPR for minimal_parse_mode.
- * typeck.c (build_c_cast): Likewise.
- * pt.c (tsubst_copy): Likewise.
- * decl2.c (build_expr_from_tree): Likewise.
- * error.c (dump_expr): Likewise.
-
-Fri Feb 23 10:36:46 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * except.c (SetTerminate, SetUnexpected): Put back global vars.
- (init_exception_processing): Put back decl/init of
- set_unexpected_fndecl and set_terminate_fndecl, needed to get the
- fns from libstdc++.
-
- * decl.c (struct binding_level): Delete ACCEPT_ANY bitfield.
- (declare_uninstantiated_type_level, uninstantiated_type_level_p):
- Delete unused fns.
- * cp-tree.h (declare_uninstantiated_type_level,
- uninstantiated_type_level_p): Delete prototypes.
-
-Thu Feb 22 19:36:15 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst_expr): Add default return.
-
-Thu Feb 22 16:47:24 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * error.c (fndecl_as_string): Delete unused arg CNAME.
- * sig.c (build_signature_table_constructor,
- build_signature_method_call): Fix calls.
-
- * class.c (the_null_vtable_entry): Delete var definition.
- (init_class_processing): Delete tree the_null_vtable_entry init.
- * decl.c (no_print_{functions, builtins}): Declare as static.
- (__tp_desc_type_node): #if 0 var definition.
- (init_type_desc): #if 0 init of __tp_desc_type_node.
- (vb_off_identifier): Move var decl into init_decl_processing.
- (current_function_assigns_this): Declare as static.
- (int_ftype_ptr_ptr_int, void_ftype_ptr_int_int): Delete var decls.
- (init_decl_processing): Delete init of void_ftype_ptr_ptr_int.
- Move decls of string_ftype_ptr_ptr and int_ftype_string_string here.
- * decl2.c (delete_sanity): Delete definition/mod of local var ELT_SIZE.
- * init.c (BI_header_type, BI_header_size): Declare as static.
- * pt.c (template_classes): Delete unused var.
- (add_pending_template): Delete decl for non-existent fn.
- (lookup_template_class): Delete vars CODE and TAG_CODE.
- (instantiate_template): Delete unused var TARGS.
- * cp-tree.h (vb_off_identifier, current_function_assigns_this):
- Delete decls.
- (__tp_desc_type_node): #if 0 var decl.
- (fndecl_as_string): Fix prototype.
-
-Thu Feb 22 15:56:19 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.def: Add GOTO_STMT.
- * pt.c (tsubst_expr): Support goto and labels.
- * decl.c (define_label): Support minimal parsing.
- * parse.y (simple_stmt): Likewise.
-
-Thu Feb 22 15:30:12 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * xref.c (GNU_xref_member): Only define/set var I if
- XREF_SHORT_MEMBER_NAMES is defined, to match when it's actually
- used.
- (GNU_xref_end_scope): Delete unused fifth arg TRNS.
- (GNU_xref_end): Fix call.
- * decl.c (poplevel, poplevel_class, finish_method): Fix calls.
- * cp-tree.h (GNU_xref_end_scope): Fix prototype.
-
- * tree.c (build_exception_variant): Delete unused vars I, A, T,
- T2, and CNAME.
- (layout_vbasetypes): Delete unused var NONVIRTUAL_VAR_SIZE.
- (mapcar): Delete unused var CODE.
- (build_cplus_new): Delete unused arg WITH_CLEANUP_P.
- (break_out_cleanups): Fix call.
- (bot_manip): Likewise.
- * call.c (build_method_call): Likewise.
- * cvt.c (build_up_reference, convert_to_reference, cp_convert):
- Likewise.
- * typeck.c (unary_complex_lvalue, build_modify_expr,
- convert_for_initialization): Likewise.
- * typeck2.c (build_functional_cast): Likewise.
- * cp-tree.h (build_cplus_new): Fix prototype.
-
- * repo.c (open_repo_file): Delete unused var Q.
- (repo_compile_flags, repo_template_declared,
- repo_template_defined, repo_class_defined, repo_inline_used,
- repo_vtable_used, repo_tinfo_used): #if 0 unused fns.
- (repo_get_id, repo_vtable_used): Declare as static.
- * cp-tree.h (mark_{decl,class}_instantiated, finish_repo): Add
- prototypes.
-
-Thu Feb 22 14:53:35 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (pending_inlines): Add function_try_block case.
-
- * pt.c (unify): Fix for template const parms.
-
-Thu Feb 22 13:24:15 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * lex.c (extract_interface_info): Delete forward decl.
- (default_copy_constructor_body, default_assign_ref_body): Delete
- decls for non-existent functions.
- (synth_firstobj, inline_text_firstobjs): Delete unused vars.
- (init_lex): Delete setting them.
- (cons_up_default_function): Delete unused vars FUNC_BUF,
- FUNC_LEN, and COMPLEX. Delete code setting COMPLEX. Delete old
- #if 0'd synth code.
- (toplevel, expression_obstack): Delete unused extern decls.
- (tree_node_kind): Delete unused enum.
- (tree_node_counts, tree_node_sizes): Wrap with #ifdef
- GATHER_STATISTICS.
- (tree_node_kind_names): Delete unused extern decl.
- (synth_obstack): Delete unused var.
- (init_lex): Don't set it.
- (init_parse): Add decl before use.
- (reduce_count): Only define #ifdef GATHER_STATISTICS && REDUCE_LENGTH.
- (current_unit_{name, language}): Delete unused vars.
- (check_newline): Don't bother setting them, just accept the #pragma.
- * cp-tree.h (init_repo, peek_yylex): Add prototypes.
- (current_unit_{name, language}): Delete decls.
-
- * search.c: Wrap all of the memoized functions, macros, and
- variables inside #ifdef GATHER_STATISTICS.
- (lookup_field, lookup_fnfields): Likewise.
- (init_search_processing): Likewise.
- (reinit_search_statistics): Wrap whole function.
- * lex.c (reinit_lang_specific): Wrap call to reinit_search_statistics.
-
- * decl.c (finish_function): Only call pop_memoized_context if
- GATHER_STATISTICS is defined.
- (start_function): Likewise for push_memoized_context.
- * class.c (pushclass, popclass): Likewise.
-
- * cp-tree.h (CLASSTYPE_MTABLE_ENTRY): Move definition from here...
- * search.c (CLASSTYPE_MTABLE_ENTRY): ... to here.
-
- * cvt.c (cp_convert): Delete unused local var FORM.
- * cp-tree.h (can_convert, can_convert_arg, real_lvalue_p): Add
- prototypes.
-
-Thu Feb 22 13:19:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (do_poplevel): Oops; really return what we get from
- poplevel this time.
-
-Thu Feb 22 11:41:44 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (is_aggr_type): Add prototype.
-
- * cp-tree.h ({push,pop}_cp_function_context): Add decls.
- * method.c ({push,pop}_cp_function_context): Delete decls.
- * except.c (start_eh_unwinder, end_eh_unwinder): Declare as void.
- (SetUnexpected, SetTerminate): Delete unused vars.
- (init_exception_processing): Don't set SetUnexpected or
- SetTerminate. Don't set SET_UNEXPECTED_FNDECL or SET_TERMINATE_FNDECL.
- (output_exception_table_entry): Delete unused array LABEL.
- (expand_internal_throw): Delete unused var PARAMS.
- (expand_start_catch_block): Delete unused var CLEANUP.
- (emit_exception_table): Delete unused var EH_NODE_DECL.
- (expand_builtin_throw): Delete unused vars UNWIND_AND_THROW and
- GOTO_UNWIND_AND_THROW. Don't set them.
- (end_eh_unwinder): Add top decl.
- (pop_rtl_from_perm): Delete unused decl of PERMANENT_OBSTACK.
- (exception_section, push_rtl_perm, do_function_call,
- lang_interim_eh, push_eh_cleanup, eh_outer_context,
- expand_end_eh_spec, end_eh_unwinder): Declare as static.
- (saved_pc, saved_throw_type, saved_throw_value, saved_cleanup,
- throw_used): Likewise.
- * cp-tree.h (expand_end_eh_spec): Delete prototype.
-
- * search.c (dfs_mark, dfs_mark_vtable_path,
- dfs_unmark_vtable_path, dfs_mark_new_vtable,
- dfs_unmark_new_vtable, dfs_clear_search_slot,
- dfs_search_slot_nonempty_p, bfs_markedp, bfs_unmarkedp,
- bfs_marked_vtable_pathp, bfs_unmarked_vtable_pathp,
- bfs_marked_new_vtablep, bfs_unmarked_new_vtablep): #if 0 unused
- functions.
- (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1,
- n_calls_lookup_fnfields, n_calls_lookup_fnfields_1,
- n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved):
- Only define #ifdef GATHER_STATISTICS.
- (reinit_search_statistics): Only init some vars if GATHER_STATISTICS
- is defined.
- (vbase_decl): Delete var definition.
- (init_search): Delete old decl.
- (init_vbase_pointers): Delete building of VBASE_DECL, since it's
- never actually used.
- (expand_indirect_vtbls_init): Delete init of VBASE_DECL.
- (get_base_distance_recursive): Delete unused fourth arg
- BASETYPE_PATH. Fix call .
- (get_base_distance): Fix call.
- (push_class_decls): Delete unused var ID.
- (make_memoized_table_entry): Declare as static.
- (breadth_first_search): Declare as static.
- (tree_has_any_destructor_p): Declare as static.
- (pop_class_decls): Delete unused arg pop_class_decls.
- * class.c (popclass): Fix call to pop_class_decls.
- * cp-tree.h (make_memoized_table_entry, breadth_first_search,
- tree_has_any_destructor_p): Delete prototypes.
-
- * rtti.c (build_ptmf_desc): Delete unused arg TYPE.
- (build_t_desc): Fix call. Delete unused vars ELEMS and TT.
- (build_dynamic_cast): Delete unused local vars TMP1 and RETVAL.
- (build_user_desc): Delete unused var T.
- (build_class_desc): Delete unused vars T and OFF.
- (build_t_desc): Delete unused var NAME_STRING.
- (build_headof): Make static.
- (get_bad_cast_node): Likewise.
- (get_def_to_follow): Likewise.
- * cp-tree.h (init_type_desc): Add prototype.
- (build_headof): Remove prototype.
-
-Thu Feb 22 00:54:22 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (tsubst): Only look for matching decls at file scope for
- non-member functions.
-
- * call.c (build_scoped_method_call): Handle scoped destructor
- calls in templates.
-
- * decl.c (*_top_level): Also save previous_class_values.
-
- * pt.c (tsubst_expr): Support do {} while loops.
- * parse.y (simple_stmt): Likewise.
- * tree.def: Likewise.
-
- * method.c (build_overload_identifier): For a class nested in a
- template class, don't mangle in the template parms from our
- context.
-
- * lex.c, cp-tree.h: Remove support for template instantiations in
- the pending_inlines code.
- * pt.c: Remove dead functions and unused arguments.
- (uses_template_parms): TYPENAME_TYPEs always use template parms.
- * parse.y: Stop passing anything to end_template_decl.
- * tree.c (print_lang_statistics): Only print tinst info #ifdef
- GATHER_STATISTICS.
-
-Wed Feb 21 16:57:33 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (expand_recursive_init{,_1}): Delete decls.
- (sort_member_init): Delete unused var INIT.
- (emit_base_init): Delete unused var X.
- (build_offset_ref): Delete unused var CNAME.
- (sort_member_init): Delete unused var FIELDS_TO_UNMARK.
- (emit_base_init): Delete unused local var BASE. Delete extern
- decl of IN_CHARGE_IDENTIFIER.
- (build_delete): Delete unused local var VIRTUAL_SIZE.
-
- * init.c (build_vec_delete): Delete unused third arg ELT_SIZE.
- (build_delete): Fix call.
- * decl2.c (delete_sanity): Likewise.
- * cp-tree.h (build_vec_delete): Update prototype.
-
- * typeck.c (common_base_type): Delete unused var TMP.
- (build_binary_op): Delete local var ARGS_SAVE.
- (build_array_ref): Delete unused var ITYPE.
- (c_expand_return): Delete unused var USE_TEMP.
-
- * typeck.c (compexcepttypes): Delete unused arg STRICT.
- (comptypes): Fix calls.
- * decl.c (duplicate_decls): Likewise.
- * cp-tree.h (compexcepttypes): Delete extra arg.
-
- * decl2.c (check_classfn): Delete unused second arg CNAME.
- * decl.c (start_decl, grokfndecl): Fix calls.
- * init.c (do_friend): Likewise.
- * cp-tree.h (check_classfn): Update prototype.
-
- * cp-tree.h (signature_error, import_export_vtable,
- append_signature_fields, id_in_current_class, mark_used,
- copy_assignment_arg_p): Add decls.
- * decl2.c (mark_used): Delete decl.
-
- * class.c (n_*): Wrap with #ifdef GATHER_STATISTICS.
-
- * class.c (get_vtable_entry): Diable unused function.
- (doing_hard_virtuals): Delete unused static global var.
- (finish_struct_1): Don't init DOING_HARD_VIRTUALS.
- (prepare_fresh_vtable): Delete unused vars PATH and RESULT.
- (overrides): Delete unused vars RETTYPE and BASE_RETTYPE.
- (modify_one_vtable): Delete unused var OLD_RTTI.
- (finish_struct_anon): Delete unused vars OFFSET and X.
- (finish_struct_bits): Delete unused var METHOD_VEC.
- (get_basefndecls): Delete unused var PURPOSE. Delete unused
- for-scope local variable METHODS.
-
- * call.c (user_harshness): Delete unused/unneeded arg PARM.
- (ideal_candidate): Delete unused args BASETYPE and PARMS.
- (build_method_call): Delete unused args passed into ideal_candidate.
- (build_overload_call_real): Likewise. Delete unused var OVERLOAD_NAME.
- * cp-tree.h (synthesize_method): Add decl.
-
- * decl.c (note_level_for_for): Give void return type.
- (pushdecl_nonclass_level): Likewise.
- (finish_function): Delete unused vars VFIELDS and ALLOCATED_THIS.
- (poplevel): Delete unused var IMPLICIT_TRY_BLOCK.
- (suspend_binding_level): Delete unused var LEVEL.
- (duplicate_decls): Delete unused var CTYPE.
- (duplicate_decls): Delete unused var PREVIOUS_C_DECL.
- (init_decl_processing): Delete unused vars FLOAT_ENDLINK and
- PTR_ENDLINK.
- (grokdeclarator): Delete unused var C.
- (grokdeclarator): Delete unused var SIZE_VARIES.
- (grokparms): Delete unused var SAW_VOID.
- (start_function): Delete unused var OLDDECL.
- (cplus_expand_expr_stmt): Delete unused var
- REMOVE_IMPLICIT_IMMEDIATELY.
-
- * cp-tree.h (pushdecl_nonclass_level): Fix prototype.
-
- * Makefile.in (CONFLICTS): Update to 12 shift/reduce.
-
-Wed Feb 21 00:06:17 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (build_min): Set TREE_COMPLEXITY to lineno.
- (build_min_nt): Likewise.
- * pt.c (do_pushlevel): Emit line note.
- (do_poplevel): Return what we get from poplevel.
- (tsubst_expr): Set lineno from TREE_COMPLEXITY in stmt nodes.
- * parse.y: Use do_pushlevel and do_poplevel.
- * cp-tree.h: Declare do_poplevel.
-
- * cp-tree.h: Declare at_eof.
- * decl.c (cp_finish_decl): Pass it to rest_of_decl_compilation.
- * decl2.c (import_export_decl): Renamed from import_export_inline.
- (finish_file): Call it to do interface handling for statics.
- * pt.c (tsubst_copy): Call mark_used on variables and functions
- used here.
-
- * decl2.c (finish_file): Don't emit statics we can't generate.
- * pt.c (instantiate_decl): Don't set interface on instantiations
- we can't generate.
-
- * cp-tree.h (struct tinst_level): Change 'classname' to 'decl'.
- * tree.c (print_lang_statistics): Print max template depth.
- * pt.c (push_tinst_level): Dump entire instantiation context.
- (instantiate_class_template): Use it and pop_tinst_level.
- (instantiate_decl): Likewise.
-
- * call.c class.c cp-tree.h decl.c decl2.c error.c lex.c method.c
- pt.c ptree.c tree.def: Remove all traces of UNINSTANTIATED_P_TYPE.
-
-Tue Feb 20 18:21:51 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c class.c cp-tree.h cvt.c decl.c decl2.c error.c expr.c
- init.c lex.c method.c parse.y pt.c repo.c search.c spew.c tree.c
- tree.def typeck.c typeck2.c xref.c: Massive, systemic changes for
- the new template implementation.
-
-Tue Feb 20 17:14:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (check_cp_case_value): Use STRIP_TYPE_NOPS.
-
-Thu Feb 15 18:44:42 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (cp_finish_decl): Delay emitting the debug information for
- a typedef that has been installed as the canonical typedef, if the
- type has not yet been defined.
-
-Thu Feb 15 09:39:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (grokfield): Still call pop_nested_class for access decls.
-
-Wed Feb 14 17:30:04 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (lookup_label): Call label_rtx.
-
- * decl.c (make_binding_level): New function.
- (pushlevel, pushlevel_class): Call it instead of explicit
- duplicate calls to xmalloc.
-
- * decl.c (init_decl_processing): Delete useless build_pointer_type
- call.
-
- * decl.c (float_ftype_float, ldouble_ftype_ldouble): Add definitions.
- (sizet_ftype_string): Delete variable.
- (init_decl_processing): Add built-in functions fabsf, fabsl,
- sqrtf, sqrtl, sinf, sin, sinl, cosf, cos, cosl. New local
- variable strlen_ftype, used for strlen.
-
-Wed Feb 14 16:21:25 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (push_to_top_level): Start from current_binding_level
- again for now; the stl hacks depend on g++ being broken in this
- way, and it'll be fixed in the template rewrite.
-
- * tree.def: Add USING_DECL.
- * decl2.c (do_class_using_decl): Implement.
- (grokfield): Pass access decls off to do_class_using_decl instead of
- grokdeclarator.
- * error.c (dump_decl): Handle USING_DECLs.
- * decl.c (grokdeclarator): Remove code for handling access decls.
- * class.c (finish_struct_1): Adjust accordingly, treat using-decls
- as access decls for now.
- (finish_struct): Don't check USING_DECLs for other uses of the name.
-
- * search.c (get_matching_virtual): Use cp_error_at.
-
-Wed Feb 14 10:36:58 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (comptypes): Default COMP_TYPE_ATTRIBUTES to 1, to
- match c-typeck.c.
- (self_promoting_args_p): Move the check that TYPE is non-nil
- before trying to look at its main variant.
- (unsigned_type, signed_type): Add checking of DI/SI/HI/QI nodes.
-
- * cp-tree.h (DECL_WAITING_FRIENDS, SET_DECL_WAITING_FRIENDS):
- Delete macros.
- * init.c (xref_friend, embrace_waiting_friends): Delete functions.
- (do_friend): Delete call to xref_friend.
- * class.c (finish_struct_1): Delete call to embrace_waiting_friends.
-
- * typeck.c (convert_sequence): #if 0 unused function.
-
- * cp-tree.h (DECL_IN_MEMORY_P): New macro w/ the check that used to
- be in decl_in_memory_p.
- (decl_in_memory_p): Delete decl.
- * expr.c (decl_in_memory_p): Delete fn.
- * typeck.c (mark_addressable): Use DECL_IN_MEMORY_P.
-
- * decl.c (cp_finish_decl): Use DECL_IN_MEMORY_P.
-
-Tue Feb 13 12:51:21 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_1): Check for a pure-specifier on a
- non-virtual function here.
-
- * decl2.c (grok_function_init): Don't check whether the function
- is virtual here.
- (grokfield): Don't call check_for_override here.
-
- * decl.c (push_to_top_level): Start from inner_binding_level,
- check class_shadowed in class levels.
-
-Mon Feb 12 17:46:59 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (resume_level): Ignore things that don't have names, instead
- of core dumping.
-
-Mon Feb 12 15:47:44 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (grokfield): Set DECL_VINDEX properly for FUNCTION_DECLs.
-
-Sat Feb 10 17:59:45 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_1): Set DECL_VINDEX properly on a
- synthesized dtor.
-
- * parse.y (complete_type_name): Bind global_scope earlier.
- (complex_type_name): Likewise.
- (qualified_type_name): Remove.
-
-Thu Feb 8 15:15:14 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (grokfndecl): Move code that looks for virtuals in base
- classes...
- * class.c (check_for_override): ... to a new function.
- (finish_struct_1): Call it.
-
- * cp-tree.h: Declare warn_sign_compare.
-
- * typeck.c (build_binary_op_nodefault): Check warn_sign_compare
- rather than extra_warnings to decide whether to warn about
- comparison of signed and unsigned.
-
- * decl2.c (lang_decode_option): Handle warn_sign_compare. -Wall
- implies -Wsign-compare. -Wall doesn't imply -W.
-
-Wed Feb 7 15:27:57 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref): Fix to handle anon unions in base
- classes as well.
-
-Wed Feb 7 14:29:12 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * class.c (resolves_to_fixed_type_p): Delete code dealing with
- a WITH_CLEANUP_EXPR, since we don't generate them any more.
- * cvt.c (build_up_reference): Likewise.
- * decl.c (grok_reference_init): Likewise.
- (cp_finish_decl): Likewise.
- * error.c (dump_expr): Likewise.
- * tree.c (real_lvalue_p): Likewise.
- (lvalue_p): Likewise.
- (build_cplus_new): Likewise.
- (unsave_expr_now): Likewise.
- * typeck.c (unary_complex_lvalue, build_modify_expr,
- c_expand_return): Likewise.
-
-Tue Feb 6 13:39:22 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Make the C++ front-end pay attention to attributes for structures.
- * class.c (finish_struct): New argument ATTRIBUTES, passed down into
- finish_struct_1.
- (finish_struct_1): New argument ATTRIBUTES; call cplus_decl_attributes.
- Take out old round_up_size use and setting the DECL_ALIGN possibly
- using it. Take out setting of TYPE_ALIGN to round_up_size, which
- can override what the attribute set.
- * cp-tree.h (finish_struct): Update prototype.
- * parse.y (template_instantiate_once): Pass a NULL_TREE for the
- attributes to finish_struct.
- (structsp): For a CLASS decl, add maybe_attribute to rule and pass that
- value down into finish_struct.
- * Makefile.in (CONFLICTS): Switch to 7 shift/reduce conflicts.
-
-Tue Feb 6 13:12:15 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (poplevel): Re-word dead for local handling.
- (pushdecl): Remove useless DECL_DEAD_FOR_LOCAL test.
- (cp_finish_decl): If is_for_scope, check for duplicates so
- we can disable is_for_scope. Otherwise, preserve_temp_slots.
-
- * lex.c (do_identifier): Use global binding in preference of
- dead for local variable.
-
-Mon Feb 5 17:46:46 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (initializing_context): Handle anon union changes, the
- context where fields of anon unions can be initialized now has to be
- found by walking up the TYPE_CONTEXT chain.
-
-Fri Feb 2 14:54:04 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * decl.c (start_decl): #ifdef out code to set DECL_COMMON
- if ASM_OUTPUT{,_ALIGNED}_BSS is defined.
- (obscure_complex_init): If bss is supported, always set
- DECL_INITIAL to error_mark_node.
-
-Thu Feb 1 16:19:56 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (is_friend): Make sure there's a context before we see if
- it's an aggr type.
-
-Thu Feb 1 15:44:53 1996 Mike Stump <mrs@cygnus.com>
-
- * init.c (is_friend): Classes are not friendly with nested classes.
-
-Thu Feb 1 15:27:37 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * lex.c (check_newline): Pass last character read to HANDLE_PRAGMA,
- and record its result.
-
-Thu Feb 1 09:27:01 1996 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_anon): Switch around code to not move anon
- union elements around, nor mess up their contexts, nor offsets,
- instead we now build up the right number of COMPONENT_REFs for all
- the anon unions that may be present at build_component_ref time.
- * typeck.c (lookup_anon_field): New routine to handle field lookup
- on fields without names. We find them, based upon their unique type
- instead.
- * typeck.c (build_component_ref): Allow FIELD_DECL components.
- Handle finding components in anonymous unions, and ensure that a
- COMPONENT_REF is built for each level as necessary.
-
-Tue Jan 30 18:18:23 1996 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): Make the INDIRECT_BIND case come after
- code that ensures that copy ctors are used if appropriate.
-
-Tue Jan 30 17:35:14 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (build_vec_delete): Only give an error if base isn't an
- error_mark_node.
-
-Mon Jan 29 17:09:06 1996 Mike Stump <mrs@cygnus.com>
-
- * spew.c (do_aggr): `new struct S;' isn't a forward declaration.
- (yylex): If we see `new', keep slurping.
-
-Thu Jan 25 18:31:36 1996 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_1): Move code for handling anon unions...
- (finish_struct_anon): to here. Fixup so that we do the offset
- calculations right, and so that the fields are physically moved to
- the containers's chain.
-
-Thu Jan 25 18:27:37 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Avoid trying to get an operand off an
- identifier node.
-
-Wed Jan 24 11:25:30 1996 Jim Wilson <wilson@chestnut.cygnus.com>
-
- * typeck.c (pointer_int_sum): Use TYPE_PRECISION (sizetype) not
- POINTER_SIZE to agree with expr.c.
-
-Thu Jan 25 13:01:23 1996 Mike Stump <mrs@cygnus.com>
-
- * search.c (lookup_field): Don't report ambiguities if protect is 0,
- instead return NULL_TREE.
-
-Wed Jan 24 13:01:26 1996 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_1): Call warn_hidden if we want warnings
- about overloaded virtual functions.
- (warn_hidden): New routine to warn of virtual functions that are
- hidden by other virtual functions, that are not overridden.
- (get_basefndecls): New routine, used by warn_hidden.
- (mark_overriders): New routine, used by warn_hidden.
- * search.c (get_matching_virtual): Remove old warning that just
- isn't very useful.
-
-Tue Jan 23 12:26:10 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (output_builtin_tdesc_entries): #if 0 the function definition.
-
- * typeck.c (null_ptr_cst_p): Delete unused fn.
- (build_function_call_maybe): Delete unused fn.
-
- * expr.c (extract_init): #if 0 the code after unconditional return 0
- for now.
-
- Delete old cadillac code.
- * edsel.c: Remove file.
- * Make-lang.in (CXX_SRCS): Take edsel.c off the list.
- * Makefile.in (CXX_OBJS): Delete edsel.o.
- (edsel.o): Delete rule.
- * cp-tree.h (flag_cadillac): Delete var decl.
- * lang-options.h: Delete "-fcadillac" and "-fno-cadillac".
- * decl2.c (flag_cadillac): Delete var definition.
- (lang_decode_option): Delete handling of -fcadillac and -fno-cadillac.
- (grokfield): Delete code depending on flag_cadillac.
- (finish_anon_union): Likewise.
- * class.c (finish_struct_1): Likewise.
- (pushclass): Likewise.
- (popclass): Likewise.
- (push_lang_context): Likewise.
- (pop_lang_context): Likewise.
- * decl.c (init_decl_processing): Likewise.
- (start_decl): Likewise.
- (cp_finish_decl): Likewise.
- (xref_tag): Likewise.
- (finish_enum): Likewise.
- (start_function): Likewise.
- (finish_function): Likewise.
- (finish_stmt): Likewise.
- * lex.c (lang_init): Likewise.
- (check_newline): Likewise.
-
- * lex.c (do_pending_inlines): Delete synthesized method kludge.
-
- Delete defunct, ancient garbage collection implementation.
- * rtti.c: New file with the RTTI stuff from gc.c.
- * gc.c: Removed file (moved the remaining stuff into rtti.c).
- * Makefile.in (CXX_OBJS): Replace gc.o with rtti.o.
- (rtti.o): New rule, replacing gc.o.
- * Make-lang.in (CXX_SRCS): Replace gc.c with rtti.c.
- * cp-tree.h: Delete gc-related fn decls.
- (DECL_GC_OFFSET): Delete macro.
- (flag_gc): Delete extern decl.
- * decl.c (current_function_obstack_index): Delete var decl.
- (current_function_obstack_usage): Delete var decl.
- (start_function): Delete clearing of current_function_obstack_index
- and current_function_obstack_usage.
- (init_decl_processing): Delete code relying on -fgc.
- Delete call to init_gc_processing.
- (cp_finish_decl): Delete calls to build_static_gc_entry and
- type_needs_gc_entry. Delete gc code setting DECL_GC_OFFSET.
- (store_parm_decls): Delete -fgc calls to cp_expand_decl_cleanup
- and to expand_expr of a __gc_main call.
- (maybe_gc_cleanup): Delete var decl.
- (finish_function): Delete call to expand_gc_prologue_and_epilogue.
- * decl2.c (flag_gc): Delete var decl.
- (lang_f_options): Delete offering of -fgc.
- (lang_decode_option): Delete -fgc and -fno-gc handling.
- (get_temp_regvar): Delete gc code.
- * init.c (build_new): Delete gc code.
- * lex.c (init_lex): Delete checking of flag_gc.
-
- * typeck.c (convert_arguments): Delete gc code.
- (build_component_addr): Delete -fgc warning.
- (build_modify_expr): Delete gc code.
-
- * decl2.c (build_push_scope): Delete fn.
- * cp-tree.h (build_push_scope): Delete decl.
-
- * search.c (clear_search_slots): Delete fn.
- * cp-tree.h (clear_search_slots): Delete decl.
-
- * search.c (tree_needs_constructor_p): Delete fn.
- * cp-tree.h (tree_needs_constructor_p): Delete decl.
-
- * tree.c (id_cmp): Delete fn.
-
- * tree.c (set_fnaddr_from_vtable_entry): Delete fn.
- * cp-tree.h (set_fnaddr_from_vtable_entry): Delete decl.
-
- * tree.c (decl_value_member): Delete fn.
- * cp-tree.h (decl_value_member): Delete decl.
-
- * tree.c (list_hash_lookup_or_cons): Delete fn.
- * cp-tree.h (list_hash_lookup_or_cons): Delete decl.
-
- * method.c (cplus_exception_name): Delete fn.
- (EXCEPTION_NAME_{PREFIX, LENGTH}): Delete macros.
-
- * spew.c (shift_tokens): Delete fn.
-
-Mon Jan 22 17:49:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * except.c (init_exception_processing): Pass 1 to needs_pop in calls
- to cp_finish_decl.
- * parse.y: Likewise.
-
-Mon Jan 22 17:34:29 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * tree.c (build_cplus_staticfn_type): Delete function definition;
- never used.
- * cp-tree.h (build_cplus_staticfn_type): Delete decl.
-
- * tree.c (virtual_member): Delete function definition; never used.
- * cp-tree.h (virtual_member): Delete decl.
-
-Fri Jan 19 18:03:14 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_component_ref): Handle getting vbase pointers
- out of complex multiple inheritance better.
-
-Fri Jan 19 16:27:40 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_object_ref): Make sure we use the real type, not
- any reference type.
-
-Fri Jan 19 16:01:47 1996 Mike Stump <mrs@cygnus.com>
-
- * tree.c (build_exception_variant): Don't create new types if we
- don't have to, also build new types on the right obstack.
-
-Fri Jan 19 14:09:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (store_bindings): Split out from push_to_top_level.
- (push_to_top_level): Call it for b->type_shadowed on class binding
- levels.
-
-Fri Jan 19 13:53:14 1996 Mike Stump <mrs@cygnus.com>
-
- * search.c (expand_upcast_fixups): Fix so that offsets stored in
- vbase_offsets are always right. Fixes a problem where virtual base
- upcasting and downcasting could be wrong during conversions on this
- during virtual function dispatch at ctor/dtor time when dynamic
- vtable fixups for deltas are needed. This only sounds easier than
- it is. :-)
- (fixup_virtual_upcast_offsets): Change to reflect new calling
- convention for expand_upcast_fixups.
-
-Fri Jan 19 12:23:08 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (grokbitfield): Strip the NOPs from WIDTH before we
- check that it's usable as the bitfield width.
-
-Wed Jan 17 21:22:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (grokfield): Call cplus_decl_attributes with the attrlist.
- Pass a null tree to grokdeclarator for its ATTRLIST arg, since it's
- only ever used for functions in it.
-
-Wed Jan 17 12:10:38 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (qualified_type_name): Use the TYPE_DECL, not the type.
- (nested_type): Likewise.
- (nested_name_specifier): Use lastiddecl.
-
- * decl.c (grokdeclarator): Adjust accordingly.
- * init.c (expand_member_init): Likewise.
- * parse.y (base_class): Likewise.
- * typeck2.c (build_functional_cast): Likewise.
-
- * typeck2.c (build_functional_cast): Fill in name after we've
- checked for non-aggr type.
-
-Wed Jan 17 10:18:01 1996 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (warn_pointer_arith): Default to on.
-
-Tue Jan 16 12:45:38 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (is_rid): New function.
- * decl.c (grokdeclarator): Diagnose reserved words used as
- declarator-ids.
-
-Tue Jan 16 11:39:40 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.c (get_decl_list): Don't lose cv-quals.
-
- * decl.c (grokdeclarator): Fix SCOPE_REF handling and diagnose
- typespecs used as declarator-ids.
-
-Tue Jan 16 11:09:42 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (poplevel): When poping a level, don't give a warning for
- any subblocks that already exist.
-
-Tue Jan 16 00:25:33 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_object_ref): Finish what I started.
-
- * parse.y (qualified_type_name): Don't check TYPE_BUILT_IN.
-
- * decl2.c (constructor_name_full): Handle TEMPLATE_TYPE_PARMs.
-
- * decl.c (grokdeclarator): Also accept TEMPLATE_TYPE_PARM as a
- scope.
-
-Mon Jan 15 16:19:32 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (xref_tag): Handle passing a type in directly.
-
- * parse.y (qualified_type_name): Pull out the type.
- (nested_type): Likewise.
- Take types directly instead of as identifiers.
- * call.c (build_scoped_method_call): Take types directly instead of
- as identifiers.
- * decl.c (xref_basetypes): Likewise.
- * init.c (expand_member_init): Likewise.
- (build_member_call): Likewise.
- (build_offset_ref): Likewise.
- * typeck2.c (build_scoped_ref): Likewise, remove bogus code.
- * method.c (do_build_assign_ref): Likewise.
- * decl.c (grokdeclarator): Handle a type appearing as the
- declarator-id for constructors.
- * method.c (do_build_copy_constructor): current_base_init_list now
- uses the types directly, not their names.
- * init.c (sort_base_init): Likewise.
- (expand_member_init): Likewise.
- * init.c (is_aggr_type): New function, like is_aggr_typedef.
-
-Mon Jan 15 08:45:01 1996 Jeffrey A Law <law@cygnus.com>
-
- * tree.c (layout_basetypes): Call build_lang_field_decl instead
- of build_lang_decl if first arg is a FIELD_DECL.
-
-Thu Jan 11 14:55:07 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (cp_finish_decl): Only clear TREE_USED if DECL_NAME is
- non-empty.
- * except.c (expand_start_catch_block): Set TREE_USED to avoid
- warnings about the catch handler.
-
-Mon Jan 8 17:35:12 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (build_modify_expr): Use a COMPOUND_EXPR instead of
- expand_target_expr.
-
-Thu Jan 4 12:30:32 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Fix access control to use trees rather than integers.
- * class.c (access_{default, public, protected, private,
- default_virtual, public_virtual, private_virtual}_node): Add
- definitions.
- (init_class_processing): Do creation of those nodes.
- * cp-tree.h (access_type): Delete enum decl.
- (access_{default, public, protected, private, default_virtual,
- public_virtual, private_virtual}_node): Add decls.
- (compute_access): Change return type.
- * search.c (compute_access): Have tree return type, instead of enum.
- (lookup_field): Declare THIS_V and NEW_V to be tree nodes.
- * lex.c (real_yylex): Use yylval.ttype for giving the value of the
- access_* node for each of RID_{PUBLIC, PRIVATE, PROTECTED}.
- * parse.y (VISSPEC): Make ttype rather than itype.
- (base_class_access_list): Likewise.
- * *.[cy]: Change all refs of `access_public' to `access_public_node',
- etc.
- * call.c (build_method_call): Make ACCESS be a tree.
- * class.c (alter_access, finish_struct_1, filter_struct): Likewise.
- * cvt.c (convert_to_aggr): Likewise.
- * init.c (build_offset_ref, resolve_offset_ref, build_delete):
- Likewise.
- * method.c (hack_identifier): Likewise.
- * typeck.c (build_component_ref_1, build_component_ref): ): Likewise.
-
-Thu Jan 4 11:02:20 1996 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (pointer_int_sum, pointer_diff): Make code agree with C
- frontend, and make it more consistent with respect to
- warn_pointer_arith.
-
-Tue Jan 2 00:13:38 1996 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * decl.c (pushdecl): Check for duplicate parameter names.
-
-Wed Jan 3 09:25:48 1996 Mike Stump <mrs@cygnus.com>
-
- * decl.c (expand_static_init): Call assemble_external for atexit.
-
-Wed Jan 3 07:55:19 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (do_unwind): Remove some generated dead code.
- (eh_outer_context): New routine, factor out some common code from
- expand_builtin_throw and end_eh_unwinder. Add code to do return
- address masking for the PA.
- (expand_builtin_throw): Use eh_outer_context instead of open coding
- it here.
- (end_eh_unwinder): Likewise.
-
-Tue Jan 2 17:00:56 1996 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Call assemble_external for __empty, if we
- use it.
-
-Thu Dec 28 11:13:15 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_builtin_throw): Use RETURN_ADDR_OFFSET instead of
- NORMAL_RETURN_ADDR_OFFSET.
- (end_eh_unwinder): Likewise.
-
-Wed Dec 27 22:18:16 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_dynamic_cast): Make sure we don't cast away const
- when dealing with references, and make sure we handle dynamic
- casting to a cv qualified reference.
-
-Thu Dec 21 23:50:35 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (struct eh_context): New structure top hold eh context
- information.
- (push_eh_context): New routine.
- (pop_eh_context): Likewise.
- * decl.c (push_cp_function_context): Use them.
- (pop_cp_function_context): Likewise.
-
-Wed Dec 20 12:42:51 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Also prune uninteresting functions in the
- inline emission loop.
-
-Wed Dec 20 02:32:07 1995 Jeffrey A Law <law@cygnus.com>
-
- * sig.c (build_signature_table_constructor): Mark functions
- in the signature as referenced.
-
-Tue Dec 19 22:36:56 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (finish_file): Do all the vtable/synthesis stuff before
- the inline emission stuff.
-
-Mon Dec 18 15:51:33 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * cp-tree.h, decl2.c (flag_weak): New flag to control the use of
- weak symbols.
- * lang-options.h: Add -f{no-,}weak.
- * decl.c (init_decl_processing): If the target does not support weak
- symbols, don't use them.
- * decl2.c, pt.c: s/SUPPORTS_WEAK/flag_weak/.
-
-Sun Dec 17 21:13:23 1995 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * init.c (expand_member_init): warning for base init after members.
-
-Fri Dec 15 15:32:18 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * cvt.c (build_expr_type_conversion): Don't convert to a reference
- type.
-
-Thu Dec 14 16:05:58 1995 Mike Stump <mrs@cygnus.com>
-
- * method.c (report_type_mismatch): Improve wording for volatile
- mismatches.
-
-Thu Dec 14 14:16:26 1995 Mike Stump <mrs@cygnus.com>
-
- * init.c (expand_aggr_init_1): Use expand_aggr_init_1 instead of
- expand_assignment, as the later doesn't handle things that have
- copy constructors well. The compiler would do bitwise copying,
- instead of ctor calling in some cases.
-
-Wed Dec 13 17:05:54 PST 1995 Paul Eggert <eggert@twinsun.com>
-
- * g++.c (my_strerror): Return "cannot access" if errno is 0.
- (pfatal_with_name, perror_exec): Don't assume that
- the returned value from my_strerror contains no '%'s.
- (concat): Remove.
- (sys_nerror): Declare only if HAVE_STRERROR is not defined.
-
-Wed Dec 13 16:22:38 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- Lose CLASSTYPE_METHODS/DECL_NEXT_METHOD chain; make
- TYPE_METHODS/TREE_CHAIN mean what they used to.
- * decl2.c (constructor_name_full): Refer to CLASSTYPE_METHOD_VEC
- instead of TYPE_METHODS.
- * decl.c (duplicate_decls): Lose references to DECL_NEXT_METHOD.
- * tree.c (tree_copy_lang_decl_for_deferred_output): Likewise.
- * cp-tree.h (CLASSTYPE_METHODS): Lose.
- (CLASSTYPE_METHOD_VEC): Point to lang_spec->methods instead of
- TYPE_METHODS.
- (struct lang_decl): Lose next_method field.
- (DECL_NEXT_METHOD): Lose.
- * class.c (finish_struct_methods): Don't mess with TYPE_METHODS.
- (finish_struct): Just use TYPE_METHODS; we don't need fn_fields
- anymore.
- (finish_struct_methods): Don't mess with the TREE_CHAINs in
- fn_fields.
-
- * search.c (add_conversions): Don't use TREE_CHAIN to traverse method
- vector.
-
- * call.c (build_method_call): Synthesize here even when not inlining.
- * typeck.c (build_function_call_real): Likewise.
-
-Wed Dec 13 15:02:39 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * cp/lex.c (check_newline): If DBX_DEBUGGING_INFO and write_symbols
- == DBX_DEBUG, call dbxout_start_new_source_file and
- dbxout_resume_previous_source_file when appropriate.
-
-Tue Dec 12 20:38:55 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (start_anon_func): Push to the top level.
- (end_anon_func): Pop from the top level.
-
-Mon Dec 11 18:56:14 1995 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (build_cleanup): New routine to build cleanups.
- * decl.c (expand_static_init): Use build_cleanup to build a cleanup
- call at ctor time and use atexit to run it later.
- * decl2.c (build_cleanup): New routine, taken from finish_file.
- (finish_file): Use build_cleanup instead, and don't put function
- local statics in global dtor list.
-
-Wed Dec 6 14:34:29 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Ensure that we have cleanups, if we try
- and expand cleanups.
-
-Wed Dec 6 11:48:21 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Add logic to manage dynamic cleanups for
- the EH object.
- (expand_end_catch_block): Use the magic of expand_goto, instead of
- emit_jump so that we get the cleanup for any catch clause parameter
- and the cleanup for the exception object. Update to reflect label
- changes.
- (push_eh_cleanup): New routine to register a cleanup for an
- exception object.
- (empty_fndecl): Used to default cleanup actions to
- nothing.
- (init_exception_processing): Setup empty_fndecl. Setup
- saved_cleanup.
- (expand_start_catch_block): Update to reflect label changes. Call
- push_eh_object to register the cleanup for the EH object.
- (start_anon_func): New routine to start building lambda expressions
- from trees.
- (end_anon_func): New routine to end them.
- (struct labelNode): Change so that we can use tree labels, or rtx
- labels.
- (saved_cleanup): Object to check for dynamic cleanups for the
- exception handling object.
- (push_label_entry): Change so that we can use tree labels, or rtx
- labels.
- (pop_label_entry): Likewise.
- (top_label_entry): Likewise.
- (expand_start_all_catch): Use tree label instead of rtx label, so
- that we can get the magic of expand_goto.
- (expand_end_all_catch): Update to reflect label changes.
-
- * class.c (build_vfn_ref): Remove building_cleanup logic, as we now
- use UNSAVE_EXPRs.
- typeck.c (get_member_function_from_ptrfunc): Remove remnants of
- building_cleanup logic, as we now use UNSAVE_EXPRs.
- * cp-tree.h (unsave_expr): Declare it.
- * decl.c (building_cleanup): Remove.
- (maybe_build_cleanup): Remove building_cleanup logic, and use
- UNSAVE_EXPR instead.
-
-Sun Dec 3 01:34:58 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_t_desc): Update error message to say <typeinfo>.
-
-Thu Nov 30 12:30:05 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (pushdecl): Only warn about shadowing a local variable if
- warn_shadow is true.
-
-Sun Nov 26 16:06:55 1995 Rusty Russell <rusty@adelaide.maptek.com.au>
-
- * typeck.c (build_binary_op_nodefault): Added warning about
- comparisons between different enum types with -Wall, unless
- -fenum-int-equiv set.
-
-Wed Nov 22 15:44:02 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_1): Skip down to the inner type in
- multidimensional arrays. Ensures ctors will be made for types that
- need constructing.
-
-Wed Nov 22 14:19:22 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (last_dtor_insn): New to track the last compiler generated
- insn in a dtor.
- (store_parm_decls): Set it.
- (finish_function): Use it to see if the dtor is empty. Avoid doing
- vtable setup all the time, if we can.
- (struct cp_function): Add last_dtor_insn.
- (push_cp_function_context): Save it.
- (pop_cp_function_context): Restore it.
-
-Wed Nov 22 11:52:19 1995 Paul Russell <Rusty.Russell@adelaide.maptek.com.au>
-
- * typeck.c (build_unary_op): Set TREE_NO_UNUSED_WARNING to avoid
- warnings.
-
-Tue Nov 21 17:15:23 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (expand_target_expr): Make sure targets get put into the
- current temp_slot_level, so that the free_temp_slots call will reuse
- them.
-
-Tue Nov 21 13:32:03 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct_1): Delay delta fixups for virtual bases
- until after we have done the hard virtuals, to avoid a bogus `every
- virtual function must have a unique final overrider' for virtual
- functions that are only overridden by hard virtuals.
-
-Thu Nov 9 13:35:30 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * pt.c (do_function_instantiation): Don't try to find a file-scope
- template for a member function.
-
-Tue Nov 14 06:20:35 1995 Mike Stump <mrs@cygnus.com>
-
- * g++.c (main): Add handling of -nodefaultlibs.
-
-Mon Nov 13 15:45:34 1995 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (INDIRECT_BIND): Add a way for the frontend to
- distinguish between direct bindings of reference variables, and
- indirect bindings of reference variables.
- * cvt.c (build_up_reference): Use it.
- * typeck.c (convert_arguments): Use it to indicate this is an
- indirect binding.
- * decl.c (cp_finish_decl): Ensure that we reuse stack slots as fast
- as they are unused.
- (expand_static_init): Likewise.
- (cplus_expand_expr_stmt): Likewise.
- * decl2.c (finish_file): Likewise.
- * init.c (perform_member_init): Likewise.
- (emit_base_init): Likewise.
- (expand_aggr_vbase_init_1): Likewise.
-
-Fri Nov 10 09:18:09 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (push_namespace): Rewrite to use build_lang_decl, so we
- get a DECL_LANG_SPECIFIC node.
- * cp-tree.h (lang_decl_flags): Add new member `level'.
- (NAMESPACE_LEVEL): Don't use decl.arguments, instead use the
- decl_flags level member.
-
-Mon Nov 6 18:36:13 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (build_method_call): Make sure instance has a
- TYPE_LANG_SPECIFIC node before we dive into it.
-
-Sat Nov 4 20:01:52 1995 Jason Molenda <crash@phydeaux.cygnus.com>
-
- * method.c (make_thunk): use TREE_SET_CODE to set thunk's tree code.
-
-Thu Nov 2 17:56:57 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (duplicate_decls): When smashing decls, smash staticness in
- the usual way.
-
-Thu Nov 2 16:44:02 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (poplevel): Handle the merging of subblocks of cleanups
- when finishing blocks that have already been created (usually due to
- the fixup goto code). Fixes bad debugging information.
-
-Wed Nov 1 12:33:53 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * method.c (hack_identifier): Don't abort when we get a TREE_LIST
- that's not a list of overloaded functions.
-
-Wed Nov 1 11:38:58 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (mark_vtable_entries): Check DECL_LANG_SPECIFIC on fn
- before trying to use DECL_ABSTRACT_VIRTUAL_P.
-
-Tue Oct 31 11:56:55 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl2.c (mark_used): New function for hooking into setting of
- TREE_USED on decls.
- * call.c (build_method_call): Use it.
- * class.c (instantiate_type): Likewise.
- * init.c (build_offset_ref): Likewise. Don't call assemble_external
- for all like-named functions.
- * method.c (hack_identifier): Likewise.
- (emit_thunk): Don't call assemble_external.
- (make_thunk): Create thunk as a FUNCTION_DECL so that it
- gets the right mode and ENCODE_SECTION_INFO works.
-
- * parse.y: Use mark_used. Pass operator names to do_identifier.
- * lex.c (do_identifier): Handle operator names.
-
- * decl2.c (grokclassfn): Tweak __in_chrg attributes.
-
-Thu Oct 26 16:45:58 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * errfn.c: Include stdio.h.
- (cp_sprintf): Take out decl of sprintf, and cast sprintf to errorfn*.
-
-Wed Oct 25 18:58:41 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck2.c (digest_init): Always convert initializers to the
- right type.
-
-Wed Oct 25 13:25:24 1995 Mike Stump <mrs@cygnus.com>
-
- * init.c (member_init_ok_or_else): Don't allow member initializers
- for indirect members, as it is invalid.
-
-Wed Oct 25 11:35:28 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Don't allow `friend signed ()'.
-
-Fri Oct 20 10:30:59 1995 Mike Stump <mrs@cygnus.com>
-
- * parse.y (for.init.statement): Catch compound statements inside for
- initializations, if we're being pedantic.
-
-Fri Oct 20 10:03:42 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (lookup_tag): Return NULL_TREE if we don't find what we are
- looking for.
-
-Thu Oct 19 14:26:10 1995 Mike Stump <mrs@cygnus.com>
-
- * error.c (dump_expr): Don't core dump when a boolean expression is
- used as a default argument.
-
-Thu Oct 19 10:36:30 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_bits): Check aggregate_value_p instead of
- RETURN_IN_MEMORY.
-
-Wed Oct 18 18:12:32 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * class.c (finish_struct_bits): Also set TREE_ADDRESSABLE on a
- BLKmode type that would otherwise be returned in registers.
-
-Mon Oct 16 12:32:19 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * g++.c (WITHLIBC): New macro.
- (main): Declare saw_libc. Use WITHLIBC if `-lc' was used; set
- saw_libc and pass it at the end if it was set.
-
-Wed Oct 11 16:30:34 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (fn.def1): Call split_specs_attrs in
- declmods notype_declarator case.
-
-Sun Nov 26 14:47:42 1995 Richard Kenner <kenner@mole.gnu.ai.mit.edu>
-
- * Version 2.7.2 released.
-
-Mon Nov 20 14:05:00 1995 Mike Stump <mrs@cygnus.com>
-
- * g++.c (pfatal_with_name): Add missing third argument to concat.
-
-Thu Oct 26 13:59:54 1995 Mike Stump <mrs@cygnus.com>
-
- * init.c (expand_aggr_init): Handle cv qualifiers on the object's
- type.
-
-Sat Nov 11 08:25:55 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * Version 2.7.1 released.
-
-Thu Nov 2 17:02:47 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * call.c (convert_harshness): Handle references to arrays.
-
-Fri Oct 27 14:20:21 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * typeck.c (comp_target_types): Check multi-level pointer
- conversions in both directions.
-
-Tue Oct 17 21:39:05 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (explicit_instantiation): Fix 'extern template' with no
- return type.
-
-Mon Oct 16 14:35:20 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * parse.y (explicit_instantiation): Support automatic instantiation
- of constructors.
- (named_class_head_*): Support out-of-class definition of nested
- types.
-
-Wed Oct 11 12:20:56 1995 Mike Stump <mrs@cygnus.com>
-
- * search.c (envelope_add_decl): New routine. Fix so that
- methods are hidden in the same way that other members are.
- (dfs_pushdecls): Cleanup and move functionality out of line,
- into envelope_add_decl.
-
-Tue Oct 10 15:46:01 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (mark_addressable): Only call assemble_external if we
- have started the output file.
-
-Tue Oct 10 11:27:18 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * decl.c (start_function): Fix earlier cv-quals change.
-
-Mon Oct 9 23:53:05 1995 Mike Stump <mrs@cygnus.com>
-
- * parse.y (complex_direct_notype_declarator): Only push the class if
- we are not already in the class.
-
-Mon Oct 9 11:22:03 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * decl.c (duplicate_decls): Call merge_machine_decl_attributes.
- Update olddecl's attributes too.
- (grokdeclarator): #if 0 out call to build_decl_attribute_variant.
- * typeck.c (common_type): Call merge_machine_type_attributes.
-
-Fri Oct 6 14:44:27 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (mark_addressable): Add missing call to
- assemble_external.
-
-Wed Oct 4 15:06:39 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (store_parm_decls): Make sure the unwinder start comes
- before the exception specification start.
- * except.c (expand_exception_blocks): Make sure the unwinder end
- comes after the terminate protected catch clause region and after
- the end of the exception specification region.
-
-Wed Oct 4 12:47:02 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * lex.c (real_yylex): Fix identifier case for linemode.
- (handle_sysv_pragma): Don't abort when we see a pragma we don't
- recognize.
-
-Tue Oct 3 14:09:46 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (store_parm_decls): Add a call to start_eh_unwinder.
- * except.c (init_exception_processing): __throw doesn't take any
- arguments.
- (expand_builtin_throw): Likewise. Always use Pmode, instead of SImode
- for all pointers. Use expand_builtin_return_addr to unwind the
- first level off the stack.
- (do_unwind): Always use Pmode, instead of SImode for all pointers.
- (expand_exception_blocks): Add a call to end_eh_unwinder.
- (start_eh_unwinder, end_eh_unwinder): New routines to build machine
- independent stack unwinders for function/method calls.
-
-Mon Oct 2 17:20:42 1995 Mike Stump <mrs@cygnus.com>
-
- * tree.c (unsave_expr_now): Make sure we process the argument list
- of any called functions. Fixes incorrect code generation for
- cleanups.
-
-Mon Oct 2 13:04:16 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (get_member_function_from_ptrfunc): Save function if it
- needs it. Cures core dump on things like (this->*(f()))().
-
-Sat Sep 23 22:51:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (start_function): Conform to gcc cv-quals convention (no
- expression has a cv-qualified type) in RESULT_DECLs.
- * method.c (make_thunk): Likewise.
-
-Fri Sep 22 10:21:13 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (pushtag): Add in the namespace name for the tag.
-
-Thu Sep 21 13:11:13 1995 Mike Stump <mrs@cygnus.com>
-
- * parse.y (maybe_base_class_list, base_class_list, base_class,
- base_class_access_list): Make sure we see the typenames for base
- classes.
- * lex.c (see_typename): Instead of failing to see a typename when
- there is no next token, perfer a typename, and get the next token.
-
-Wed Sep 20 12:35:27 1995 Michael Meissner <meissner@cygnus.com>
-
- * decl.c (init_decl_processing): Add __builtin_expect.
-
-Tue Sep 19 16:48:11 1995 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (cp_convert_to_pointer): Don't allow leftover conversions to
- or from pointer to member functions, they must all be handled before
- this point.
-
-Fri Sep 15 17:14:47 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (resolve_offset_ref): Fix wording of non-static member
- being referenced as a static.
-
-Fri Sep 15 12:39:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_indirect_ref): Only bash pointer if we actually
- call build_expr_type_conversion.
-
-Thu Sep 14 18:24:56 1995 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (build_expr_type_conversion): Handle conversion from
- reference.
- * typeck.c (build_indirect_ref): Avoid infinite recursion.
-
-Thu Sep 14 17:23:28 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (expand_start_early_try_stmts): New routine to start a try
- block at the start of the function, for function-try-blocks.
- * cp-tree.h (expand_start_early_try_stmts): Declare it.
- * parse.y (function_try_block): Use it, instead of doing it here, as
- we don't want to include rtl.h here, as that conflicts with RETURN
- in the parser.
-
-Wed Sep 13 18:32:24 1995 Mike Stump <mrs@cygnus.com>
-
- * lex.c (reinit_parse_for_block): Support saving inline
- function-try-blocks, uses peekyylex.
- * parse.y (eat_saved_input): New rule, permit the parser to see that
- END_OF_SAVED_INPUT is ok, as it can see this when parsing the
- handlers of a function-try-block.
- (fndef): Use it.
- (component_decl): Make sure TRY and RETURN can come after fn.def2.
- * spew.c (peekyylex): New routine to peek at what will come next.
-
-Wed Sep 13 16:52:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (comptypes): Tighten up comparisons of template type
- parms.
-
- * decl.c (duplicate_decls): Turn off whining about virtual functions
- redeclared inline for now.
-
-Wed Sep 13 11:13:40 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (store_in_parms): New routine to put things before we
- put base inits.
- * cp-tree.h (store_in_parms): Declare it.
- * decl.c (store_parm_decls): Use it to makr sure the starting of the
- eh spec comes before base inits.
- (finish_function): Use sequences instead of the obsolete
- reorder_insns.
- * parse.y (fndef): Enhance readability and maintainability. Update
- to include function_try_block syntax.
- (function_try_block): Add.
-
-Tue Sep 12 17:43:07 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (convert_harshness): Use comptypes, not ==, to check if
- TYPE and PARMTYPE are equivalent on a function type.
-
-Tue Sep 12 17:31:33 1995 Douglas Rupp <drupp@cs.washington.edu>
-
- * Make-lang.in (cc1plus) : Removed unnecessary $(exeext).
-
-Mon Sep 11 23:24:07 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Never allocate storage for thrown pointer
- to objects.
-
-Mon Sep 11 19:36:45 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_start_catch_block): Pointers to objects come
- back from catch matching already dereferenced, don't dereference
- again.
-
-Mon Sep 11 15:46:28 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Only decay the throw expression, don't do
- any default conversions. This is so that one can throw and catch
- characters, and not have them match integers.
-
-Mon Sep 11 13:46:45 1995 Mike Stump <mrs@cygnus.com>
-
- * error.c (dump_aggr_type): Deal with anonymous unions that don't
- have a TYPE_NAME.
-
-Fri Sep 8 20:40:27 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * lex.c (handle_sysv_pragma): Deal with getting a comma from yylex.
-
-Fri Sep 8 15:51:41 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_end_eh_spec): Handle empty EH specifications.
-
-Fri Sep 8 15:27:22 1995 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (expand_start_eh_spec): Declare new routine.
- (expand_end_eh_spec): Likewise.
- * decl.c (store_parm_decls): Call expand_start_eh_spec to process
- exception specifications.
- * except.c (expand_leftover_cleanups): Remove unused parameter.
- (expand_end_catch_block): Likewise.
- (expand_exception_blocks): Likewise.
- (expand_start_eh_spec): New routine to mark the start of an
- exception specification region.
- (expand_end_eh_spec): New routine to mark the end of an exception
- specification region.
- (expand_exception_blocks): Call expand_end_eh_spec to process
- exception specifications.
-
-Fri Sep 8 14:40:48 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * lex.c (do_identifier): Use global binding in preference of
- dead for local variable.
-
-Wed Sep 6 19:32:59 1995 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (build_exception_variant): Remove used first argument.
- * decl.c (duplicate_decls): Likewise.
- (grokfndecl): Likewise.
- (revert_static_member_fn): Likewise.
- * decl2.c (grok_method_quals): Likewise.
- * tree.c (build_exception_variant): Likewise.
- * typeck.c (common_type): Likewise.
- * decl2.c (grokclassfn): After changing the type, call
- build_exception_variant, if necessary.
-
-Tue Sep 5 15:56:27 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Run cleanups for the throw expression.
-
-Wed Aug 30 15:24:38 1995 Stephen L. Favor <sfavor@tigger.intecom.com>
-
- * except.c (expand_builtin_throw): Moved gen_label_rtx calls beyond
- the store_parm_decls call which does initialization in the emit_*
- code concerning label numbering.
-
-Thu Aug 31 09:01:07 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_internal_throw): Let the frontend be responsible
- for managing all frontend EH parameters, the backend routine only
- needs to deal with backend values. type and value are no longer
- passed to __throw.
- (init_exception_processing): Likewise.
- (expand_start_all_catch): Likewise.
- (expand_end_all_catch): Likewise.
- (expand_leftover_cleanups): Likewise.
- (expand_end_catch_block): Likewise.
- (expand_builtin_throw): Likewise.
- (expand_throw): Likewise.
-
-Tue Aug 29 15:04:36 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cp-tree.h (DECL_REAL_CONTEXT): Give the real declaration context
- for a decl.
- * decl.c (cp_finish_decl): Use it.
-
-Tue Aug 29 10:30:27 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_internal_throw): Oops, almost forgot type and
- value are now trees.
-
-Mon Aug 28 17:57:45 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Fix the attribute handling to make sure they get noted before we
- create the function's RTL, in case they can affect that.
- * decl.c (grokfndecl): New arg ATTRLIST. Run
- cplus_decl_attributes before creating the decl's rtl.
- (grokdeclarator): New arg ATTRLIST, passed down into grokfndecl.
- (shadow_tag, groktypename, start_decl, start_method): Pass a
- NULL_TREE to grokdeclarator's new last arg.
- * decl2.c (grokfield): New arg ATTRLIST, passed into grokdeclarator.
- (grokbitfield, grokoptypename): Pass a NULL_TREE to
- grokdeclarator's new last arg.
- * except.c (expand_start_catch_block): Likewise.
- * pt.c (process_template_parm, end_template_decl,
- do_function_instantiation): Likewise.
- * cp-tree.h (grokfield): Add arg.
- (grokdeclarator): Move the prototype from here...
- * decl.h: ...to here.
- * lex.c (cons_up_default_function): Pass NULL_TREE to grokfield
- ATTRLIST argument.
- * parse.y: Create a list for the grokfield arg where appropriate,
- and pass it down instead of calling cplus_decl_attributes.
-
-Mon Aug 28 15:07:24 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c: Always allow turning on exception handling. Allow cross
- compilations to use EH.
-
-Thu Aug 24 17:39:24 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (saved_pc, saved_throw_type, saved_throw_value): Use
- trees, instead of rtxs, and don't depend on using special machine
- dependent registers.
- (expand_internal_throw): Likewise.
- (init_exception_processing): Likewise.
- (expand_start_all_catch): Likewise.
- (expand_end_all_catch): Likewise.
- (expand_start_catch_block): Likewise.
- (expand_leftover_cleanups): Likewise.
- (expand_end_catch_block): Likewise.
- (expand_builtin_throw): Likewise.
- (expand_throw): Likewise.
-
-Wed Aug 23 17:25:51 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cvt.c (build_expr_type_conversion): Handle conversions to
- reference types.
-
-Wed Aug 23 15:33:59 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (do_unwind): Work around backend bug with -fpic.
-
-Tue Aug 22 17:20:07 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl2.c (flag_new_for_scope): Add a new mode that follows ANSI
- for-scoping, but supports (and warns about) old programs.
- Make the new mode (with value 1) the default.
- (lang_f_options): The on-value for flag_new_for_scope is now 2.
- * cp-tree.h (DECL_DEAD_FOR_LOCAL, DECL_ERROR_REPORTED): New macros
- (DECL_SHADOWED_FOR_VAR): Likewise.
- * decl.c (struct binding_level): New fields dead_vars_from_for
- and is_for_scope.
- (note_level_for_for): New function.
- (poplevel): Special processing if is_for_scope.
- (pushdecl): Warn if for-scope variable shadows local.
- * lex.c (do_identifier): Handle old (non-ANSI) for scoping,
- and warn if conflicts.
- * parse.y (FOR): Call note_level_for_for.
-
-Mon Aug 21 10:28:31 1995 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (import_export_inline): Class interface hackery does not
- apply to synthesized methods.
-
-Sun Aug 20 16:29:00 1995 Mike Stump <mrs@cygnus.com>
-
- * search.c (virtual_context): Find the right context more often.
- Solves a `recoverable compiler error, fixups for virtual function'
- problem.
-
-Sun Aug 20 13:53:24 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_start_all_catch): Ensure that we always transfer
- control to the right EH handler, by rethrowing the end label on the
- region, instead of hoping we are nested and falling through.
- (expand_leftover_cleanups): Likewise.
- (end_protect): Since we now rethrow the end label, put a
- nop after it, so that outer regions are recognized.
- * init.c (build_vec_delete_1): New routine to handle most of vector
- deleting, all code moved here from build_vec_delete.
- (build_array_eh_cleanup): Use build_vec_delete_1 to do all the real
- work.
- (expand_vec_init): If the array needs partial destructing, setup an
- EH region to handle it.
- (build_vec_delete): Move lots of code to build_vec_delete_1, use
- build_vec_delete_1 to do the grunt work.
-
-Sat Aug 19 14:25:33 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Handle decl attributes properly for function definitions without
- previous attribute-loaded declarations.
- * decl.c (start_function): New arg ATTRS. Add a call to
- cplus_decl_attributes with it before we create the RTL.
- * cp-tree.h (start_function): Update prototype.
- * parse.y (fn.def1): Pass ATTRS into start_function instead of
- trying to call cplus_decl_attributes too late. Pass a NULL_TREE
- for other use.
- * decl2.c (finish_file): Pass NULL_TREE as fourth arg to
- start_function.
- * method.c (synthesize_method): Likewise.
- * except.c (expand_builtin_throw): Likewise for start on __throw.
-
-Sat Aug 19 13:36:08 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (set_rtti_entry): Turn on -fvtable-thunk -frtti support.
- This changes -fvtable-thunks vtable layout, so a recompile will be
- necessary, if you use -fvtable-thunks.
- (get_vtable_entry): Use n, instead of i to be consistent with the
- rest of the compiler.
- (get_vtable_entry_n): Likewise.
- (add_virtual_function): Add a slot for the tdesc, if -fvtable-thunks
- are being used.
- (finish_struct_1): Likewise.
- (skip_rtti_stuff): New routine to collapse similar code from many
- different parts of the compiler. I think I got them all.
- (modify_one_vtable): Use it.
- (fixup_vtable_deltas1): Likewise.
- (override_one_vtable): Likewise.
- * decl2.c (mark_vtable_entries): Likewise.
- * tree.c (debug_binfo): Likewise.
- * search.c (expand_upcast_fixups): Likewise.
- (get_abstract_virtuals_1): Likewise. Use virtuals, instead of tmp to
- consistent with the rest of the compiler.
- (get_abstract_virtuals): Likewise.
- * cp-tree.h (skip_rtti_stuff): New routine, declare it.
- * gc.c (build_headof): Support -fvtable-thunk and -frtti together.
- (build_typeid): Likewise.
- (build_classof): Remove old style way of doing rtti. Remove support
- for `classof' and `headof'.
- * gxx.gperf: Likewise.
- * hash.h: Likewise.
- * parse.y: Likewise.
-
-Fri Aug 18 17:31:58 1995 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (start_function): Clear ctor_label and dtor_label.
-
- * class.c (finish_struct_1): Fix handling of access decls.
-
-Tue Aug 15 19:21:54 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (finish_struct): Only do minimal processing here, so it
- can be used for class template definitions, as well.
- (finish_struct_1): New function with the rest of the code.
-
-Tue Aug 15 09:46:16 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (prepare_fresh_vtable): On second though, always build the
- offset (see Aug 10 change), unless -fvtable-thunks is given. It
- does this by calling the new routine set_rtti_entry.
- (finish_struct): Likewise.
- (set_rtti_entry): New routine to update the rtti information at the
- start of the vtable.
-
-Mon Aug 14 12:21:22 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * error.c (dump_decl, case IDENTIFIER_NODE): Only work on a dtor
- if it's declared in the C++ language spec.
- (dump_function_decl): Likewise.
- (dump_function_name): Likewise.
- (ident_fndecl): Make sure we got something back from lookup_name.
- * decl.c (start_function): Likewise.
-
-Fri Aug 11 16:52:15 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_method_call): Don't call build_new when calling a
- constructor without an instance.
-
-Thu Aug 10 20:00:17 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (prepare_fresh_vtable): Always build the offset to the
- complete object, as it doesn't cost much. This allows dynamic_cast
- to void * to work when -frtti isn't given.
- (finish_struct): Likewise.
-
-Thu Aug 10 16:31:28 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (build_eh_type): Split out some functionality to new
- routine named build_eh_type_type.
- (build_eh_type_type): New routine.
- (expand_start_catch_block): Use build_eh_type_type, as we never want
- the dynamic type of the catch parameter, just the static type.
- Fixes core dumps when -frtti is used and one catchs pointers to
- classes.
-
-Thu Aug 10 14:55:29 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_builtin_throw): Since we now use normal calling
- conventions for __throw, we have to remove the first layer off the
- stack, so that the next context we search for handlers is the outer
- context instead of the context that had the call to __throw, if we
- don't immediately find the desired context.
-
-Tue Aug 8 17:44:23 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * tree.c (cp_expand_decl_cleanup): Returns int, not tree.
- * cp-tree.h: Update.
-
- * parse.y (template_type_parm): Add support for `typename'.
-
-Tue Aug 8 12:06:31 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_internal_throw): New internal routine to throw a
- value.
- (expand_end_all_catch, expand_leftover_cleanups): All throwers
- changed to use `expand_internal_throw' instead of jumping to throw
- label.
- (expand_end_catch_block, expand_throw): Likewise.
- (throw_label): Removed.
- (expand_builtin_throw): Changed so that EH parameters are passed by
- normal function call conventions. Completes Aug 4th work.
-
-Fri Aug 4 17:17:08 1995 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (expand_builtin_throw): Declare it.
- * decl2.c (finish_file): Call expand_builtin_throw.
- * except.c (make_first_label): Remove.
- (init_exception_processing): Don't use a LABEL_REF for throw_label,
- instead use a SYMBOL_REF, this is so that we don't use LABEL_REFs in
- other functions that don't really appear in those functions. This
- solves a problem where cc1plus consumed exponential amounts of
- memory when -Wall was used.
- (expand_end_all_catch, expand_leftover_cleanups,
- expand_end_catch_block, expand_throw): Change all uses of
- throw_label to match new style.
- (do_unwind): Rename parameter to inner_throw_label, as it is now
- different from throw_label. Also, assume that our caller will wrap
- the passed label with a LABEL_REF, if needed.
- (expand_builtin_throw): Make external, change so that the generated
- throw is now a real function.
- (expand_exception_blocks): Never generate throw code inside another
- function.
-
-Fri Aug 4 12:20:02 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (grokdeclarator): Move checking of mutable const objects
- and mutable static objects down, as we might decide during parsing
- to unset staticp or constp (for example, when const is part of the
- object being pointed to).
-
-Thu Aug 3 17:13:43 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (output_exception_table_entry): Enhance portability to
- weird machines.
- (emit_exception_table): Likewise.
-
-Thu Aug 3 16:41:38 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_ptrmemfunc): Handle casting of pointer to
- non-virtual member functions.
-
-Wed Aug 2 11:58:25 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_typeid): Strip cv qualifiers so that const T&, T&, T
- and const T all match.
-
-Wed Aug 2 11:25:33 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (build_eh_type): Strip cv qualifiers so that const T&,
- T&, T and const T all match.
-
-Tue Aug 1 14:20:16 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c: Fix up comments, cleanup code and eliminate exceptNode,
- exceptStack, exceptstack, push_except_stmts, pop_except_stmts,
- new_except_stack, push_last_insn, pop_last_insn, insn_save_node and
- InsnSave. Also, numerous speed improvements, and correctness
- improvements. Double faulting in all situations should now be
- handled correctly.
- (expand_start_all_catch): Instead of having many terminate protected
- regions, just have one.
- (expand_start_catch_block): No longer have to protect
- false_label_rtx, as it isn't used for EH region marking.
- (expand_end_catch_block): Expand out EH cleanups here by using
- expand_leftover_cleanups.
- (expand_end_all_catch): Use sequences instead of playing with insn
- links directly.
- (expand_exception_blocks): Likewise. Also protect all catch clauses
- with one terminate region.
-
-Mon Jul 31 13:24:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * method.c (report_type_mismatch): Don't talk about an object
- parameter for non-methods.
-
-Sun Jul 30 13:13:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (finish_struct): Catch private and protected members of
- anonymous unions here.
- * decl2.c (finish_anon_union): And here.
- * parse.y: Instead of here.
-
- * errfn.c (ARGSLIST): Support passing four args.
- * error.c (cv_as_string): New function.
- (cp_printers): Add it.
- * call.c (build_method_call): Report 'const' at end of pseudo-decl.
-
- * method.c (report_type_mismatch): Deal with a bad_arg of 0.
-
- * init.c (expand_aggr_init): Handle volatile objects, too.
-
-Sat Jul 29 13:42:03 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (struct binding_level): Keep list of incomplete decls.
- (print_binding_level): Use list_length to count them.
- (pushdecl): Build up the list.
- (hack_incomplete_structures): Walk it and prune completed decls.
-
-Fri Jul 28 15:26:44 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (comp_target_types): Don't check const and volatile for
- function types.
- (comp_ptr_ttypes_real): Likewise.
-
-Thu Jul 27 15:40:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (comp_target_types): Fix.
-
-Thu Jul 27 15:10:48 1995 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h (unsave_expr_now, build_unsave_expr,
- cp_expand_decl_cleanup): Declare new routines.
- * decl.c (cp_finish_decl, store_parm_decls,
- hack_incomplete_structures): Change all cals from
- expand_decl_cleanup to cp_expand_decl_cleanup.
- * gc.c (protect_value_from_gc): Likewise.
- * expr.c (cplus_expand_expr): Handle UNSAVE_EXPRs.
- * tree.c (unsave_expr): New routine to build an UNSAVE_EXPR.
- (unsave_expr_now): Backend routine used by tree expander.
- (cp_expand_decl_cleanup): Wrap second argument in an UNSAVE_EXPR to
- work around a limitation in the backend. The backend uses the
- cleanups multiple times, on disjoint control flows, so we cannot
- pass unsaved SAVE_EXPRs to the backend.
- * tree.def (UNSAVE_EXPR): New tree code.
- * typeck.c (c_expand_return): Move goto/return code up inside
- conditional, as we don't always want to do this, we only want to do
- this when we don't otherwise finish with this control flow.
-
-Thu Jul 27 10:38:43 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (typespec): Only complain about typeof if we're not
- getting it from a system header.
-
-Thu Jul 27 10:26:23 1995 Doug Evans <dje@canuck.cygnus.com>
-
- Clean up prefix attribute handling.
- * parse.y (reserved_declspecs): Link prefix attributes with declspecs.
- (declmods): Likewise.
- (all rules that reference typed_declspecs and declmods): Call
- split_specs_attrs or strip_attrs to separate declspecs and attrs.
- (lang_extdef): Delete resetting of prefix_attributes.
- (template_def, notype_declarator rule): Use NULL_TREE for
- prefix_attributes.
- (condition): Use NULL_TREE for prefix_attributes.
- (setattrs): Deleted.
- (nomods_initdcl0): Set prefix_attributes to NULL_TREE.
- (component_decl): Delete resetting of prefix_attributes.
- (component_decl_1, notype_components rule): Use NULL_TREE for
- prefix_attributes.
- (simple_stmt): Delete resetting of prefix_attributes.
-
-Mon Jul 24 13:37:53 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (convert_harshness): Deal with reference conversions before
- others. Actually do array->pointer decay. Call comp_target_types
- with pointer types rather than their targets.
-
- * typeck.c (comp_target_types): Avoid assigning D const * to B *.
-
-Mon Jul 24 08:54:46 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * pt.c (to_be_restored): Move decl to global scope.
-
-Sat Jul 22 12:22:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (start_decl): Put back clearing of DECL_IN_AGGR_P.
-
-Fri Jul 21 17:09:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (grokdeclarator): Downgrade error about 'extern int A::i'
- to pedwarn.
-
- * pt.c (instantiate_template): Also avoid instantiation if the
- function has already been declared to be a specialization.
-
- * decl2.c (check_classfn): Ignore cname argument, and return the
- matching function.
-
- * decl.c (start_decl): Handle declarations of member functions
- outside of the class (i.e. specialization declarations).
-
-Thu Jul 20 10:34:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (finish_struct): Don't mess with the type of bitfields.
-
- * various.c: s/TYPE_POINTER_TO/build_pointer_type/.
-
-Thu Jul 20 01:43:10 1995 Mike Stump <mrs@cygnus.com>
-
- * init.c (expand_aggr_init): Assume LOOKUP_ONLYCONVERTING if init
- is not a parameter list (TREE_LIST).
- (expand_default_init): If LOOKUP_ONLYCONVERTING is set, then set
- LOOKUP_NO_CONVERSION so that we don't allow two-level conversions,
- but don't set it otherwise.
-
-Wed Jul 19 20:32:01 1995 Mike Stump <mrs@cygnus.com>
-
- * init.c (expand_default_init): Don't allow two-level conversions
- during construction.
-
-Wed Jul 19 18:06:37 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_headof): The type of dyncasting to a pointer to cv
- void, should be pointer to cv void.
-
-Wed Jul 19 17:25:43 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_dynamic_cast): Allow casting in const.
-
-Wed Jul 19 16:34:27 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_const_cast): If we are passed error_mark_node,
- return it.
-
-Wed Jul 19 15:24:48 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * class.c (push_nested_class): Make sure TYPE is non-nil.
-
- * cvt.c (type_promotes_to): Watch for error_mark_node on the
- incoming TYPE.
-
-Wed Jul 19 13:23:12 1995 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
-
- * cp-tree.h (SIGTABLE_VT_OFF_NAME): Renamed from SIGTABLE_OFFSET_NAME.
- (SIGTABLE_VB_OFF_NAME): New macro.
- (vt_off_identifier): Renamed from offset_identifier.
- (vb_off_identifier): Added extern declaration.
-
- * decl.c (vt_off_identifier): Renamed from offset identifier.
- (vb_off_identifier): New variable to hold the identifier for the
- sigtable field vb_off.
- (init_decl_processing): Initialize vb_off_identifier.
- Renamed vt_off_identifier from offset_identifier.
- * sig.c (build_signature_method_call): Renamed offset_identifier and
- local variable offset to vt_off_identifer and vt_off, respecitively.
- * sig.c (build_signature_table_constructor): Renamed offset to vt_off.
-
- * decl.c (init_decl_processing): Add vb_off field to
- sigtable_entry_type. Reorder fields so that pfn gets properly
- aligned at a 64 bit boundary on the Alpha.
- * sig.c (build_signature_table_constructor): Build the constructor
- according to the new layout. Set the vb_off field to -1 for now.
-
- * decl.c (init_decl_processing): Align sigtable_entry_type on word
- boundaries instead of double word boundaries to save space.
-
-Tue Jul 18 16:58:37 1995 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (cp_convert): Always call build_cplus_new for a ctor.
-
-Tue Jul 18 14:24:53 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (opt.component_decl_list): Only forbid private/protected
- in anonymous unions. We need to make this know when the type is
- defined for an object, to not give the error.
-
-Mon Jul 17 14:22:44 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (opt.component_decl_list): Don't allow access control
- as private or protected for union members.
-
-Sun Jul 16 14:01:00 1995 Jim Wilson <wilson@chestnut.cygnus.com>
-
- * lex.c (check_newline): For 'p' case, move goto skipline line to
- before end brace for 'pragma'.
-
-Fri Jul 7 13:55:58 1995 Mike Stump <mrs@cygnus.com>
-
- * g++.1: Tiny updates.
-
-Fri Jul 7 13:05:20 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (cp_finish_decl): Only destruct local static variables if
- they are constructed, and only construct the first time control
- passes completely through its declaration (if not initialized with a
- constant-expression).
- (expand_static_init): Likewise.
-
-Wed Jul 5 14:05:04 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (comptypes, case OFFSET_REF): If either offset basetype
- is a TEMPLATE_TYPE_PARM, give a match.
-
-Fri Jun 30 15:42:57 1995 Mike Stump <mrs@cygnus.com>
-
- * method.c (build_overload_value): Handle encoding of null pointer
- constants (or any pointer with a constant numeric value) for
- templates.
-
-Fri Jun 30 13:45:51 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (convert_harshness): Add QUAL_CODE when we're faced with
- const vs non-const for void conversions.
-
-Fri Jun 30 10:19:52 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_start_all_catch): Fix problem with finding an
- outer nested try block when there is no code to separate it from an
- inner try block.
-
-Fri Jun 30 02:22:26 1995 Mike Stump <mrs@cygnus.com>
-
- * search.c (dfs_pushdecls): Consume 2 or 3 orders of magnitude less
- memory please when virtual bases are used.
-
-Thu Jun 29 19:03:47 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (build_vbase_path): Avoid testing things that cannot be
- null to see if they are null.
- * cvt.c (convert_pointer_to_vbase): Remove code that doesn't work.
- * decl.c (finish_function): Pass a type into the new
- convert_pointer_to_vbase instead of a binfo.
- * search.c (convert_pointer_to_vbase): Rewritten to use get_vbase
- and convert_pointer_to_real.
- (expand_indirect_vtbls_init): Use convert_pointer_to_vbase instead
- of the more cryptic call to get_vbase.
-
-Thu Jun 29 09:35:05 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (BOOL_TYPE_SIZE): Fix broken SLOW_BYTE_ACCESS check.
-
-Thu Jun 29 03:43:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (instantiate_template): Don't strip 'this' twice.
-
- * pt.c (coerce_template_parms): Allow null pointer constants.
-
- * decl.c (revert_static_member_fn): But only if DECL_ARGUMENTS is
- set.
-
-Wed Jun 28 18:39:03 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (revert_static_member_fn): Also remove 'this' from
- DECL_ARGUMENTS.
- * decl2.c (check_classfn): Don't revert this function until we get a
- match.
-
-Wed Jun 28 14:07:27 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (component_decl): Clear PREFIX_ATTRIBUTES here.
-
-Wed Jun 28 11:05:13 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (finish_file): Handle global vector news.
- * init.c (build_new): Encode vector news so that later we will know
- how many elements there are.
-
-Mon Jun 26 13:38:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * expr.c (cplus_expand_expr): Don't mess with temp slots.
-
- * decl2.c (warn_if_unknown_interface): Don't crash if tinst_for_decl
- returns null.
-
- * decl2.c (check_classfn): Use revert_static_member_fn.
- * decl.c (revert_static_member_fn): Diagnose static member functions
- declared const or volatile.
-
- * decl2.c (grokfield): Check for missing default args here, too.
- (check_default_args): Function to do the checking.
- * decl.c (pushdecl): Use it.
-
- * decl.c (pushdecl): Don't warn about shadowing a member of `this'
- if there is no `this'.
-
-Sun Jun 25 11:34:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_method_call): Downgrade 'called before definition'
- to a warning, as it ought to go away after Monterey.
-
-Sat Jun 24 14:18:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (coerce_template_parms): Don't do extra checking on pointer
- to member arguments.
-
- * class.c (finish_struct): const and reference members don't prevent
- a class from being an aggregate.
-
- * class.c (finish_struct): Signatures are always aggregates.
-
-Fri Jun 23 17:20:29 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (check_classfn): Improve error message.
-
- * pt.c (tsubst): Handle PROMOTE_PROTOTYPES.
-
-Thu Jun 22 01:50:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (comptypes): Don't ignore method quals.
-
- * class.c (finish_struct): Non-abstract virtuals are always USED.
-
- * decl.c (build_ptrmemfunc_type): The underlying union type isn't
- IS_AGGR_TYPE, either.
- * class.c (finish_struct): Use CLASSTYPE_NON_AGGREGATE instead.
- * cp-tree.h: Likewise.
-
- * cp-tree.h (lang_type): Add aggregate.
- (CLASSTYPE_AGGREGATE): New macro.
- (TYPE_NON_AGGREGATE_CLASS): Likewise.
- * class.c (finish_struct): Determine whether a class is an
- aggregate.
- * decl.c (cp_finish_decl): Check TYPE_NON_AGGREGATE_CLASS instead of
- TYPE_NEEDS_CONSTRUCTING.
- * typeck2.c (digest_init): Check TYPE_NON_AGGREGATE_CLASS for
- subobjects, too.
-
- * pt.c (tsubst, PARM_TYPE): Propagate DECL_ARTIFICIAL.
-
- * decl.c (start_function): For pre-parsed functions, layout all of
- the parm decls again.
- (grokvardecl): TREE_PUBLIC depends on DECL_THIS_EXTERN, not
- DECL_EXTERNAL.
-
- * pt.c (coerce_template_parms): Improve checking for invalid
- template parms.
-
-Wed Jun 21 12:01:16 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Forbid declaration of a static member
- with the same name as its enclosing class.
-
-Mon Jun 19 10:28:14 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (finish_function): Clear current_class_decl.
-
- * typeck.c (build_conditional_expr): Use convert (boolean_type_node
- instead of truthvalue_conversion.
-
- * class.c (finish_struct): A data member with the same name as the
- class doesn't suppress constructors.
-
-Fri Jun 16 18:11:39 1995 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
-
- * decl.c (start_function): If current_class_decl is a signature
- pointer, don't dereference it but set C_C_D to current_class_decl.
-
-Fri Jun 16 17:06:28 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (duplicate_decls): Complain about virtual functions
- redeclared to be inline.
-
-Fri Jun 16 13:20:38 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (get_unique_name): New routine to name unnamed namespaces.
- (push_namespace): Use get_unique_name for naming unnamed namespaces.
-
-Thu Jun 15 15:00:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * parse.y: Call cplus_decl_attributes with prefix_attributes where
- appropriate.
-
-Wed Jun 14 19:24:49 1995 Mike Stump <mrs@cygnus.com>
-
- * search.c (get_vbase): New routine to switch hierarchies from the
- CLASSTYPE_VBASECLASSES to the normal one.
- (expand_indirect_vtbls_init): Use get_vbase to figure out how we
- want to convert to a vbase pointer.
-
-Mon Jun 12 17:50:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (instantiate_class_template): Add the new instantiation to
- template_classes.
- (do_pending_expansions): Call instantiate_member_templates on all of
- the classes in template_classes.
-
-Mon Jun 12 12:36:59 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (complete_array_type): Fill in the TYPE_DOMAIN of our
- TYPE_MAIN_VARIANT if it is not filled in.
- * init.c (build_delete): If the TYPE_DOMAIN is not set, give an
- error instead of core dumping.
-
-Mon Jun 12 10:41:40 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (can_convert): Also check for distance > 0.
- (can_convert_arg): Likewise.
- (user_harshness): Likewise.
-
-Fri Jun 9 19:17:21 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * g++.c (MATH_LIBRARY): Provide default.
- (main): Always link with the math library if we link with libstdc++.
-
- * decl.c (start_function): Complain about redefinition of a function
- even when the pending_inline version is compiled after the other
- version.
-
-Thu Jun 8 15:44:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * gc.c (build_dynamic_cast): Build up a reference to a parameter of
- aggregate type.
-
-Wed Jun 7 15:31:57 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (build_vec_delete): Resolve an offset ref before we try to
- use it.
-
-Wed Jun 7 14:19:32 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_modify_expr): If the class lacks a constructor or
- assignment operator, return error_mark_node.
- (common_type): Use build_cplus_array_type.
-
-Tue Jun 6 09:41:27 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (dont_allow_type_definitions): New variable set when types
- cannot be defined.
- (finish_struct): Use it.
- * cp-tree.h (dont_allow_type_definitions): Define it.
- * parse.y (primary, handler_seq): Set it.
-
-Mon Jun 5 18:49:38 1995 Mike Stump <mrs@cygnus.com>
-
- * method.c (build_opfncall): Use DECL_CHAIN, not TREE_CHAIN for
- results from lookup_fnfields. Always give warning/error on bad
- code.
-
-Mon Jun 5 11:39:37 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (member_init_ok_or_else): Don't allow initialization of
- an ancestor's member from within a constructor.
-
-Mon Jun 5 11:20:34 1995 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
-
- * sig.c (build_signature_table_constructor): Use DECL_CONTEXT
- instead of DECL_CLASS_CONTEXT for calculating the vfield offset so
- abstract virtual functions are handled correctly.
-
- * sig.c (build_signature_table_constructor): Store the correct
- delta in signature table entries. It does not yet work for
- classes with virtual base classes as implementations of signatures.
- (build_signature_method_call): Add the delta to the object_ptr
- before generating the function call.
-
- * call.c (build_method_call): Make instance_ptr the signature
- pointer itself instead of dereferencing the optr.
- * sig.c (build_signature_method_call): Dereference the optr for the
- direct and virtual calls.
-
- * sig.c (build_signature_table_constructor): Make the tag for
- default implementations -1 instead of 2.
- (build_signature_method_call): Change the generated conditional
- expression correspondingly.
-
- * sig.c (build_signature_pointer_constructor): Deleted the sorry
- message that said we can't handle multiple inheritance for
- implementations of signatures
- (build_signature_method_call): Use the offset from the sigtable
- entry instead of the vptr field from the signature pointer for
- building a virtual function call.
-
- * class.c (build_vfn_ref): Deleted signature specific code, we don't
- call this function anymore from build_signature_method_call.
-
- * cp-tree.h (SIGNATURE_VPTR_NAME): Deleted. We use the right vptr
- field in the object now instead of in the signature pointer/ref.
- (build_vptr_ref): Deleted extern declaration.
- * sig.c (build_vptr_ref): Deleted.
- (build_signature_pointer_or_reference_type): Deleted construction of
- the vptr field.
- (build_signature_pointer_constructor): Deleted initialization of/
- assignment to the vptr field.
-
- * sig.c (build_signature_table_constructor): Convert the signature
- table entry fields to their correct types.
-
- * sig.c (build_signature_table_constructor): Don't call digest_init
- for the fields of a sigtable entry, it's wasted time.
-
- * sig.c (build_signature_table_constructor): Correctly set the
- offset and index fields of a sigtable entry. Build the constructor
- the way digest_init does, digest_init can't handle initializing an
- anonymous union inside a struct.
- (build_signature_method_call): Use the index field instead of the
- delta field to get the vtable index.
-
- * decl.c (init_decl_processing): Fix number of fields for building
- sigtable_entry_type.
-
- * cp-tree.h (tag_identifier, offset_identifier): Added extern decls.
- (SIGTABLE_CODE_NAME): Renamed to SIGTABLE_TAG_NAME.
- (SIGTABLE_PFN_NAME): Deleted, we'll use VTABLE_PFN_NAME instead.
- * decl.c (tag_identifier, offset_identifier): New variables to
- hold the identifiers for the sigtable fields tag and offset.
- (init_decl_processing): Initialize these variables.
- (init_decl_processing): Use these variables to build the
- sigtable_entry_type structure. Rename the code and offset fields
- to tag and delta, respectively; add offset and index fields. Changed
- types of fields from short_integer_type_node to delta_type_node.
- * sig.c (build_signature_table_constructor): Rename code and offset
- to tag and delta, respectively.
- (build_signature_method_call): Likewise. Use above variables.
-
-Thu Jun 1 17:03:51 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (lookup_name_real): Don't try to look anything up in an
- erroneous object.
-
-Fri Jun 2 10:30:14 1995 Mike Stump <mrs@cygnus.com>
-
- * method.c (build_overload_int): New routine. Break out
- functionality from build_overload_value so we can reuse it.
- (build_overload_value): Handle pointer to member functions as value
- parameters for templates.
- (build_overload_identifier): Since template parameters are shared
- among all instantiations, we have to substitute in the real types
- in TREE_TYPE (parm).
- pt.c (coerce_template_parms): Likewise.
- (push_template_decls): Likewise.
- (grok_template_type): Deleted as template parameters are shared
- among all instantiations.
-
-Wed May 31 19:10:32 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (grokdeclarator): Always give errors on constant overflow
- for array indices.
-
-Wed May 31 11:39:43 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (commonparms): Don't abort if simple_cst_equal returns < 0.
- (build_c_cast): Don't tack on a NON_LVALUE_EXPR when casting to
- reference type.
- (build_indirect_ref): Fix check for *&.
-
-Fri Jun 16 06:54:03 1995 Mike Stump <mrs@cygnus.com>
-
- * Version 2.7.0 released.
-
-Fri Jun 16 15:07:29 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * Make-lang.in (DEMANGLER_PROG): Add LIBS.
-
-Thu Jun 15 15:00:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (define_function): Don't set DECL_INTERFACE_KNOWN.
-
-Wed Jun 7 20:00:31 1995 Mike Stump <mrs@cygnus.com>
-
- * *.[chy]: Change all callers of finish_decl to cp_finish_decl.
- * decl.c (finish_decl): New routine to handle call backs from the
- mid end (declare_hidden_char_array).
-
-Wed Jun 7 19:02:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (start_function): Handle setting C_C_D here.
- (set_C_C_D): Removed.
- (struct saved_scope): Remove class_decl.
- (push_to_top_level): Don't save current_class_decl.
- (pop_from_top_level): Don't restore current_class_decl or C_C_D.
- (struct cp_function): Add C_C_D.
- (push_cp_function_context): Save C_C_D.
- (pop_cp_function_context): Restore C_C_D.
-
-Fri Jun 2 11:05:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (set_C_C_D): New function. suspend_momentary before
- building C_C_D.
- (pop_from_top_level): Call it.
- (start_function): Likewise.
- (pop_cp_function_context): Likewise.
-
- * class.c, cp-tree.h, decl.c, decl2.c, parse.y: Lose all references
- to current_vtable_decl, CLASSTYPE_INST_VAR and CLASSTYPE_VTBL_PTR.
-
- * decl.c (push_cp_function_context): Save current_class_decl.
- (pop_cp_function_context): Restore current_class_decl and set C_C_D.
- (pop_from_top_level): Don't use CLASSTYPE_INST_VAR to set C_C_D.
- (start_function): Likewise.
-
- * class.c (popclass): Don't mess with current_class_decl,
- current_vtable_decl, or C_C_D.
-
-Mon May 29 12:45:10 1995 Paul Eggert <eggert@twinsun.com>
-
- * Make-lang.in (c++.mostlyclean): Remove $(DEMANGLER_PROG).
-
-Wed May 24 15:55:18 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * decl.c (duplicate_decls): Check simple_cst_equal result against 0.
- * decl2.c (finish_anon_union): Likewise.
- * method.c (largest_union_member): Likewise.
-
-Wed May 24 14:41:11 1995 H.J. Lu <hjl@nynexst.com>
-
- * Make-lang.in (cxxmain.o): Replace single quotes with backslashes.
-
-Mon May 22 17:38:48 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * Make-lang.in (g++, g++-cross, cc1plus, DEMANGLER_PROG):
- Use $@ instead of output name so works even if have .exe.
- (cxxmain.o): Use cp if ln -s fails.
- (c++.install-man): Use $(exeext) in executable names.
- (c++.mostlyclean, stage[1-4]): Use $(objext) in object file names.
- * Makefile.in (../cc1plus): Use $(exeext) in name of executable.
-
-Wed May 24 01:39:03 1995 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): parms can be null, duh.
-
-Tue May 23 01:32:09 1995 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): If convert_arguments failed, just bail.
-
-Fri May 19 10:31:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cvt.c (convert_force): Pass LOOKUP_NORMAL to cp_convert.
-
- * tree.c (copy_to_permanent): Oops.
-
-Fri May 19 10:01:07 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (break_out_target_exprs): Add decl.
-
-Thu May 18 13:02:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (start_function): Move *all* interface handling stuff after
- the pushdecl.
-
- * tree.c (mapcar): Renamed from make_deep_copy and generalized.
- (perm_manip): Return t if permanent, otherwise 0.
- (copy_to_permanent): Use them.
- (bot_manip): Helper for break_out_target_exprs.
- (break_out_target_exprs): New function. Uses mapcar.
-
- * typeck.c (convert_arguments): Use it.
-
- * method.c (hack_identifier): Use convert_from_reference to
- dereference a reference.
-
-Wed May 17 17:54:54 1995 Mike Stump <mrs@cygnus.com>
-
- * call.c (convert_harshness): Move reference bashing before pointer
- to member bashing.
-
-Wed May 17 16:57:53 1995 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (convert_to_reference): Only complain, if complaints are
- wanted.
- * typeck.c (build_function_call_real): Likewise. If
- LOOKUP_SPECULATIVELY is set and something won't work, return
- NULL_TREE.
- * cvt.c (cp_convert): Likewise. Pass flags down to build_method_call.
- (convert): Pass LOOKUP_NORMAL to cp_convert.
- * typeck.c (convert_for_assignment): Likewise.
- (convert_force): Pass LOOKUP_COMPLAIN to cp_convert.
- (convert_arguments): Get out early if we get an error_mark_node.
- (convert_for_initialization): Use cp_convert instead of convert so
- that we can pass flags down.
- * cp-tree.h (LOOKUP_SPECULATIVELY): Added documentation.
-
-Wed May 17 01:43:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck2.c (store_init_value): Don't take the MAIN_VARIANT of the
- decl type.
-
- * class.c (finish_struct): Don't complain about a class with no
- user-defined constructors but with a member that has no default
- constructor, as this is OK for aggregates.
-
- * expr.c (cplus_expand_expr, NEW_EXPR): If this is an explicit
- constructor call, mark slot addressable.
-
-Tue May 16 18:37:51 1995 Douglas Rupp <drupp@cs.washington.edu>
-
- * g++.c: Changed WINNT to _WIN32.
-
-Tue May 16 12:40:16 1995 Jason Merrill <jason@lisa.cygnus.com>
-
- * lex.c (handle_sysv_pragma): Don't use token_buffer.
-
-Tue May 16 12:05:26 1995 Mike Stump <mrs@cygnus.com>
-
- * call.c (resolve_scope_to_name): Add initial semantic support for
- namespaces.
- * class.c (finish_struct): Likewise.
- * cp-tree.h (NAMESPACE_LEVEL): Likewise.
- * cvt.c (build_up_reference, convert_to_reference): Likewise.
- * decl.c (binding_level::namespace_p, suspend_binding_level): Likewise.
- (resume_binding_level, toplevel_bindings_p): Likewise
- (namespace_bindings_p, declare_namespace_level): Likewise.
- (resume_level, push_namespace, pop_namespace): Likewise.
- (pop_everything, pushtag, duplicate_decls, pushdecl): Likewise.
- (implicitly_declare, lookup_namespace_name): Likewise.
- (lookup_name_real, start_decl, make_temporary_for_reference): Likewise.
- (obscure_complex_init, finish_decl, expand_static_init): Likewise.
- (grokvardecl, grokdeclarator, parmlist_is_exprlist): Likewise.
- (store_parm_decls, hack_incomplete_structures): Likewise.
- * decl2.c (get_temp_name, finish_anon_union): Likewise.
- (current_namespace, push_namespace, pop_namespace): Likewise.
- (do_namespace_alias, do_toplevel_using_decl): Likewise.
- (do_class_using_decl): Likewise.
- * error.c (dump_decl): Likewise.
- * init.c (build_member_call, build_offset_ref): Likewise.
- * lex.c (identifier_type): Likewise.
- * parse.y (lang_extdef, using_decl, extdef): Likewise.
- (component_decl_1, nested_name_specifier_1): Likewise.
- * spew.c (yylex): Likewise.
- * tree.def (NAMESPACE_DECL): Likewise.
-
-Tue May 16 11:55:35 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (push_overloaded_decl): Return the new decl even if it
- can't be pushed.
-
-Tue May 16 11:00:37 1995 Jason Merrill <jason@lisa.cygnus.com>
-
- * typeck.c (decay_conversion): Split out from default_conversion.
- (default_conversion): Call it.
- (build_binary_op): Likewise.
- (build_binary_op_nodefault): Use decay_conversion for truth ops.
-
-Mon May 15 12:47:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (warn_extern_redeclared_static): This is a pedwarn.
- (duplicate_decls): Always use the old decl's linkage info. Don't
- play with linkage of consts.
- (pushdecl): Don't play with linkage of consts.
- (redeclaration_error_message): Don't complain about an old public
- decl and a new non-public decl here.
- (grokvardecl): Handle linkage of consts here.
- (grokdeclarator): An 'extern inline' is public. Pass constp to
- grokvardecl.
- (start_function): Wait until after the pushdecl to do some linkage
- stuff.
-
- * decl2.c (import_export_vtable): Make duplicates weak rather than
- static if supported.
- (import_export_inline): Likewise.
- * pt.c (do_pending_expansions): Likewise.
-
- * class.c (build_vbase_path): flag_assume_nonnull_objects only
- affects reference conversion.
-
- * init.c (emit_base_init): Build up an RTL_EXPR and add it to
- rtl_expr_chain.
- * decl.c, decl2.c: s/base_init_insns/base_init_expr/.
-
-Tue May 16 07:06:28 1995 Paul Eggert <eggert@twinsun.com>
-
- * method.c (numeric_output_need_bar): Renamed from misspelling.
-
- * typeck.c (build_ptrmemfunc): Fix misspellings in messages.
-
-Sun May 14 10:26:22 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * lang-options.h, lang-specs.h: New files.
-
-Thu May 11 00:31:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (default_conversion): Don't check for BLKmode before
- pulling out the decl_constant_value.
-
- * decl.c (start_function): Clear named_labels and shadowed_labels.
-
- * typeck.c (build_function_call_real): Also synthesize methods here.
-
-Wed May 10 00:55:59 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (finish_file): Synthesize exported methods before the
- reconsider loop.
-
- * parse.y: Move declaration of flag_new_for_scope to file scope.
-
-Tue May 9 19:10:33 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c: Add flag_new_for_scope for new -ffor-scope flag.
- * parse.y (FOR): Conditionalize the pushing and poping of scope for
- the for-init-statement upon the new flag_new_for_scope.
- * parse.y (try_block): Simplify and use compstmt.
-
-Mon May 8 12:41:52 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (define_function): Mark function decl artificial.
-
-Sun May 7 00:51:28 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * parse.y (simple_stmt, FOR): Put back push/pop for condition scope.
-
- * decl2.c (grokclassfn): DECLs don't have cv-qualified types.
- * tree.c (build_cplus_method_type): Likewise.
-
- * cp-tree.h (SET_DECL_ARTIFICIAL): Just set DECL_ARTIFICIAL to 1.
-
- * typeck.c (build_function_call_real): If convert_arguments failed,
- just bail.
- (convert_arguments): If one of the arguments is error_mark_node,
- just bail.
-
-Sat May 6 02:39:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (duplicate_decls): Don't check DECL_NOT_REALLY_EXTERN for
- decls that don't include it.
-
-Fri May 5 14:23:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (duplicate_decls): Decls that have DECL_INTERFACE_KNOWN or
- DECL_NOT_REALLY_EXTERN set aren't extern decls.
-
- * typeck.c (build_indirect_ref): Don't call default_conversion for a
- parameter of reference_type.
- * cvt.c (convert_from_reference): Just use build_indirect_ref.
-
- * pt.c (do_type_instantiation): Only instantiate member functions
- that actually come from templates.
-
-Fri May 5 09:46:05 1995 Mike Stump <mrs@cygnus.com>
-
- * parse.y: Generalized cleanup of poplevels, and compound statements
- and compound statements in try blocks. Rewritten `for' rule so that
- the scope of variables declared in the for clause is shortened to
- span just to the end of the statement, instead of the whole
- containing block.
-
-Fri May 5 00:37:14 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (convert_harshness): Handle pointers to members better.
-
-Thu May 4 16:00:26 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (delete_sanity): Do access control here.
- * init.c (build_delete): Instead of here.
-
- * Make-lang.in: Build c++filt.
-
-Wed May 3 02:59:53 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (cplus_decl_attributes): If we just modified a TYPE_DECL,
- update our IDENTIFIER_TYPE_VALUE.
-
-Fri Apr 28 07:58:41 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * lex.c (cons_up_default_function): Fix linkage of #pragma
- implemented functions.
-
-Thu Apr 27 16:56:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * method.c (build_overload_name): Simplify and fix repeated type
- folding.
-
- * decl.c (grokdeclarator): Prohibit pointers to void or reference
- members.
-
-Thu Apr 27 09:49:07 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck2.c (process_init_constructor): Make sure initializers are
- fully digested.
-
-Thu Apr 27 01:11:55 1995 Jason Merrill <jason@python.cygnus.com>
-
- * lex.c (cons_up_default_function): Always defer synthesis.
-
-Thu Apr 27 00:20:37 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (mark_inline_for_output): Don't play with pending_inline
- stuff.
-
-Wed Apr 26 17:48:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (user_harshness): New function; like build_type_conversion,
- but doesn't actually build anything.
- (compute_conversion_costs): Use it instead of build_type_conversion.
-
-Wed Apr 26 17:11:25 1995 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_function_call_real): Improve error message for
- calling a non-function.
-
- * method.c (hack_identifier): Lose check for calling a data member.
-
-Wed Apr 26 16:59:13 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck2.c (build_functional_cast): Remove very old cruft.
- Seems like good code is generated without it.
-
-Wed Apr 26 00:47:16 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * method.c (do_build_assign_ref): Fix handling of anonymous unions.
- (do_build_copy_constructor): Likewise.
-
- * parse.y (simple_stmt, SWITCH): Call {push,pop}_switch.
-
- * decl.c (push_switch): New function.
- (pop_switch): Likewise.
- (define_case_label): Check for jumping over initialization.
-
- * call.c (build_method_call): Check for an inline function being
- called before its definition has been seen.
- * typeck.c (build_function_call_real): Likewise.
-
- * decl.c (duplicate_decls): Check for a function being redeclared
- inline after its address has been taken.
-
- * typeck.c (build_conditional_expr): Handle related class lvalues.
-
-Tue Apr 25 13:20:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (do_pending_expansions): Don't expand unused templates.
-
- * parse.y (component_decl): Accept a lone semicolon.
-
-Tue Apr 25 00:25:56 1995 Jason Merrill <jason@rtl.cygnus.com>
-
- * call.c (build_method_call): Don't allow an RTL_EXPR to serve as the
- object parameter anymore.
-
- * expr.c (cplus_expand_expr): Don't create RTL_EXPRs with no insns.
-
-Mon Apr 24 12:35:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * parse.y (simple_stmt, decl case): Clear prefix_attributes.
- (lang_extdef): Likewise.
-
- * parse.y (maybe_parmlist): New rule for use in declarators where
- this could either be a list of expressions or parameters. Calls
- suspend_momentary before deciding which.
- (direct_after_type_declarator): Use it.
- (complex_direct_notype_declarator): Use it.
-
- * pt.c (tsubst): Propagate attributes const and noreturn.
-
- * typeck.c (build_modify_expr): If warn_synth, call build_opfncall
- before doing the default thing.
-
-Thu Apr 27 21:49:36 1995 Doug Evans <dje@cygnus.com>
-
- * typeck.c (common_type): Call lookup_attribute instead of
- value_member.
-
-Tue Apr 25 18:07:43 1995 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
- * Make-lang.in: Change "realclean" to "maintainer-clean".
-
-Sun Apr 23 12:32:38 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (finish_file): Fix broken linked list handling.
-
-Fri Apr 21 18:08:43 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (finish_base_struct): Don't set TYPE_HAS_COMPLEX_*_REF
- as often.
- (finish_struct): Likewise.
-
- * various: Use TYPE_HAS_TRIVIAL_* instead of TYPE_HAS_COMPLEX_*.
-
- * cp-tree.h (TYPE_HAS_TRIVIAL_INIT_REF): New macro.
- (TYPE_HAS_TRIVIAL_ASSIGN_REF): New macro.
-
-Fri Apr 21 15:52:22 1995 Jason Merrill <jason@python.cygnus.com>
-
- * typeck.c (c_expand_return): Only expand a returned TARGET_EXPR if
- it is of the same type as the return value.
-
-Fri Apr 21 03:01:46 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (finish_file): Reconsider if synthesizing a method wrote
- out its assembly.
-
- * typeck.c (convert_for_initialization): Don't call a trivial copy
- constructor.
-
- * typeck2.c (store_init_value): Only abort if the type has a
- non-trivial copy constructor.
-
- * typeck.c (c_expand_return): If we're returning in a register and
- the return value is a TARGET_EXPR, expand it. Only do
- expand_aggr_init if we're returning in memory.
- (expand_target_expr): Function to expand a TARGET_EXPR.
- (build_modify_expr): Use it.
-
- * tree.c (build_cplus_new): Layout the slot.
-
- * expr.c (cplus_expand_expr): Use expand_call to expand the call
- under a NEW_EXPR, so the target is not discarded.
-
-Thu Apr 20 14:59:31 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_dynamic_cast): Tighten error checking.
-
-Thu Apr 20 11:23:54 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * expr.c (cplus_expand_expr): Only abort if the returned target is
- different from what we expected if the type has a non-trivial copy
- constructor.
-
- * decl2.c (cplus_decl_attributes): Attributes applied to a template
- really apply to the template's result.
-
- * tree.c (lvalue_p): Check IS_AGGR_TYPE instead of TREE_ADDRESSABLE
- to decide whether to consider a CALL_EXPR an lvalue.
-
- * class.c (finish_struct_bits): Only set TREE_ADDRESSABLE if the
- type has a non-trivial copy constructor.
-
- * decl.c (start_function): If interface_known, unset
- DECL_NOT_REALLY_EXTERN on the function.
-
-Wed Apr 19 16:53:13 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (do_function_instantiation): Handle explicit instantiation of
- member functions.
- (do_type_instantiation): Handle 'inline template class foo<int>',
- meaning just spit out the vtable.
-
- * lex.c (cons_up_default_function): Set DECL_NOT_REALLY_EXTERN on
- the consed functions.
-
- * decl2.c (import_export_inline): Set DECL_INTERFACE_KNOWN.
-
-Wed Apr 19 16:28:17 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c, class.c, decl2.c, gc.c, init.c, parse.y, pt.c, search.c,
- typeck.c: Include output.h.
-
-Wed Apr 19 14:57:21 1995 Gerald Baumgartner <gb@alexander.cs.purdue.edu>
-
- * call.c (build_method_call): Allow a signature member functions to
- be called from a default implementation.
-
-Wed Apr 19 10:21:17 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * repo.c (finish_repo): Remember what directory we are in.
-
- * search.c (expand_upcast_fixups): Don't mess with abort_fndecl.
-
- * repo.c: Use obstacks instead of fixed-size buffers. Don't spit
- out the second copy of the symbol name. Don't remember COLLECT_GCC.
-
-Wed Apr 19 02:32:40 1995 Mike Stump <mrs@cygnus.com>
-
- * search.c (virtual_context): New function to get the virtual
- context of a function.
- (expand_upcast_fixups): New function to generate runtime vtables.
- (fixup_virtual_upcast_offsets): Likewise.
- (expand_indirect_vtbls_init): Use fixup_virtual_upcast_offsets to
- ensure that the this offsets for upcasts from virtual bases into
- other virtual bases or non-virtual bases are correct at construction
- time and destruction time.
- * class.c (fixup_vtable_deltas): Modify to fixup all offsets in all
- vtables in all virtual bases, instead of just one vtable in each
- virtual base.
- (fixup_vtable_deltas1): Likewise.
-
-Tue Apr 18 03:57:35 1995 Michael Meissner <meissner@cygnus.com>
-
- * Makefile.in (lex.o): Add dependency on c-pragma.h.
-
- * lex.c (handle_sysv_pragma): Use NULL_PTR and NULL_TREE as
- appropriate, instead of 0.
-
-Mon Apr 17 12:28:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (pushdecl): Use decls_match, not duplicate_decls, for
- comparing local and global decls.
-
-Fri Apr 14 01:46:52 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (convert_arguments): Only prohibit passing to ... of
- types with non-trivial copy constructors.
-
- * repo.c (repo_template_used): Don't try to mess with no id.
-
-Fri Apr 14 23:32:50 1995 Per Bothner <bothner@rtl.cygnus.com>
-
- * decl.c (duplicate_decls): Use cp_warning_at for redundant-decls.
-
-Thu Apr 13 15:37:42 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (current_tinst_level): Delete declaration, since it's
- static inside pt.c.
-
- * typeck.c (build_modify_expr): Catch incompatible array assignment.
-
- * parse.y (attribute_list, attrib): Rewrite actions to feed the
- right stuff to decl_attributes.
-
-Thu Apr 13 11:24:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * search.c (dfs_debug_mark): Check for magic virtual like
- import_export_vtable.
-
- * typeck.c (build_binary_op_nodefault): Don't call cp_pedwarn with
- four args.
-
-Wed Apr 12 12:02:57 1995 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (finish_file): Move prevtable pass before needs_messing_up
- decision.
-
-Tue Apr 11 11:20:27 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (finish_decl): If we're writing out a static data member of
- a class, we want the debug info for that class.
-
- * gc.c (build_t_desc): Check linkage of a class properly.
-
- * class.c (finish_struct): Set the 'headof' offset for the main
- vtable properly.
- (prepare_fresh_vtable): Fix typeinfo pointer here.
- (modify_one_vtable): Instead of here.
-
-Mon Apr 10 12:15:59 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * repo.c (repo_get_id): New function to return the interesting
- identifier for a repo entity.
- (repo_template_used): Use it.
- (repo_template_instantiated): Mark the id as chosen.
- (init_repo): Record whether or not the id was chosen.
- (finish_repo): Note if an id was newly chosen.
-
- * pt.c (do_function_instantiation): Call repo_template_instantiated.
- (do_type_instantiation): Likewise. Don't diagnose multiple
- instantiation.
-
- * decl2.c (finish_file): Use DECL_NOT_REALLY_EXTERN when deciding
- whether or not to synthesize a method.
-
- Undo these changes:
- * class.c (finish_vtbls): build more vtables if flag_rtti is on.
- * class.c (modify_all_direct_vtables): ditto.
- * init.c (expand_direct_vtbls_init): expand more vtables if
- flag_rtti is on.
-
-Sat Apr 8 17:45:41 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_headof): Use ptrdiff_type_node instead of
- integer_type_node on pointer arithmetic.
-
-Sat Apr 8 11:57:04 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_modify_expr): Undo previous change.
-
-Thu Apr 6 01:23:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * Makefile.in (compiler): Remove ../cc1plus before rebuilding it.
-
- * repo.c (get_base_filename): Put the .rpo file in the directory
- with the object file, not the source.
-
- * typeck.c (build_conditional_expr): Handle pmf's better.
-
- * repo.c (finish_repo): Also use ASM_OUTPUT_LABELREF to print out
- the name of the symbol.
-
-Wed Apr 5 15:24:12 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * repo.c (open_repo_file): Make repo filename DOS-compliant.
- (*): Also write a new repo file if some previously-used
- templates are no longer used. Only remember the identifier.
-
- * lex.c (cons_up_default_function): If this function belongs to a
- template class, call repo_template_used for it.
-
- * repo.c (repo_template_used): Using a class means using its vtable,
- if any.
- (finish_repo): Likewise.
-
- * typeck.c (build_modify_expr): Only wrap TARGET_EXPRs in RTL_EXPRs
- if the type has a complex copy constructor.
-
- * decl2.c (lang_decode_option): -frepo implies
- -fno-implicit-templates.
-
- * decl.c (start_function): Clear current_{base,member}_init_list.
-
- * lex.c (init_lex): Also unset *_eq if ! flag_operator_names.
-
-Tue Apr 4 16:11:08 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (struct cp_function): Add {base,member}_init_list.
- (push_cp_function_context): Save current_{base,member}_init_list.
- (pop_cp_function_context): Restore them.
-
-Mon Apr 3 16:55:08 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * repo.c (get_base_filename): Take filename parm, fix logic bug.
-
- * typeck.c (build_compound_expr): Do not warn about a compound expr
- in which the first expression has no side effects.
- (build_x_compound_expr): Warn here instead.
- (build_conditional_expr): Don't warn about a conditional expression
- between an enum and the type it promotes to.
-
- * init.c (build_new): Handle initialization of arrays of builtins
- properly.
-
-Mon Apr 3 15:08:04 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * repo.c: Include config.h to get definitions of bcopy and rindex
- on systems that don't have them (e.g., SVR4).
-
-Mon Apr 3 14:41:55 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (finish_table): Pass NULL_TREE instead of init to
- finish_decl so that it won't try and do error checking on the
- initializer.
-
-Mon Apr 3 10:45:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * repo.c (get_base_filename): Analyze COLLECT_GCC_OPTIONS to
- determine whether this compile used -c -o.
- (open_repo_file): Use get_base_filename. Remove the extension.
- (finish_repo): Spit out the values of main_input_filename,
- COLLECT_GCC and COLLECT_GCC_OPTIONS.
-
- * parse.y (structsp): Add TYPENAME_KEYWORD complex_type_name.
-
-Sun Apr 2 23:43:51 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * search.c (compute_access): Don't try to do access control on
- nested types.
-
-Fri Mar 31 10:14:23 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * repo.c: New file to handle things repo.
-
- * pt.c (instantiate_template): Call repo_template_used if the
- definition is accessible.
- (mark_function_instantiated): Split out from
- do_function_instantiation.
- (mark_class_instantiated): Split out from do_type_instantiation.
-
- * parse.y (template_instantiate_once): Call repo_template_used.
-
- * lex.c (lang_init): Call init_repo.
-
- * decl2.c: Handle flag_use_repository.
- (finish_file): Call finish_repo.
-
- * decl.c (start_method): Call repo_template_used if this is a
- template method.
-
- * Makefile.in (CXX_OBJS): Add repo.o.
- (repo.o): Add dependencies.
-
- * Make-lang.in (CXX_SRCS): Add repo.c.
-
- * decl.c (start_function): If DECL_INTERFACE_KNOWN and
- DECL_NOT_REALLY_EXTERN are both set, unset DECL_EXTERNAL.
-
- * typeck.c (build_binary_op_nodefault): Identify the invalid operand
- types used.
-
- * decl.c (duplicate_decls): Propagate DECL_NOT_REALLY_EXTERN.
-
-Thu Mar 30 17:54:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_binary_op_nodefault): Tidy up use of build_type
- and result_type. When checking for comparison between signed
- and unsigned, use result_type rather than the (possibly shortened)
- type of op0. Also, don't warn about equality comparison of a
- signed operand to an unsigned constant that fits in the signed
- type.
-
- * method.c (do_build_copy_constructor): Reverse
- current_base_init_list after we've built it up.
-
-Thu Mar 30 14:35:18 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (build_throw): Never warn about the value of throw not
- being used.
-
-Thu Mar 30 13:16:54 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_start_catch_block): Check for bad catch parameter
- declarations.
-
-Thu Mar 30 13:06:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (finish_function): Only set DECL_NOT_REALLY_EXTERN if
- DECL_EXTERNAL is not already set.
-
-Thu Mar 30 11:26:24 1995 Mike Stump <mrs@cygnus.com>
-
- * method.c (emit_thunk): Let poplevel know that the last level is
- for a function so it can create a BLOCK_NODE and set DECL_INITIAL.
-
-Thu Mar 30 11:15:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (import_export_inline): Don't set DECL_NOT_REALLY_EXTERN
- here.
-
- * decl.c (grokdeclarator): OK, don't abort if we see a decl with
- METHOD_TYPE.
- (finish_function): Set DECL_EXTERNAL and DECL_NOT_REALLY_EXTERN on
- all deferred inlines.
-
-Wed Mar 29 19:35:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cp-tree.h (DECL_THIS_INLINE): New macro.
- (DECL_NOT_REALLY_EXTERN): New macro.
- (DECL_THIS_STATIC): New macro.
-
- * decl.c: Lose all references to current_extern_inline. Break
- inline semantics into DECL_INLINE for actual inlining and
- DECL_THIS_INLINE for the linkage wierdness. Use DECL_THIS_STATIC.
- * decl2.c: Use DECL_NOT_REALLY_EXTERN to indicate that we want to
- emit an inline here. Associated changes.
- * lex.c: Likewise.
- * pt.c: Likewise.
- * typeck.c: Likewise.
-
- * call.c (build_method_call): Don't bother trying to handle inlines
- specially.
- * cvt.c (convert_to_aggr): Likewise.
-
- * pt.c (do_function_instantiation): Handle instantiation of
- public inlines, too.
-
-Wed Mar 29 16:04:25 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (init_exception_processing): Change the interface for
- __throw_type_match and add decl for new rtti matching routine
- __throw_type_match_rtti.
- (build_eh_type): New routine to build a run time descriptor for the
- expression given.
- (expand_start_catch_block): Update to use new calling convention for
- the matcher.
- (expand_throw): Update to use build_eh_type.
-
-Mon Mar 27 07:14:33 1995 Warner Losh <imp@village.org>
-
- * g++.c: Removed __NetBSD__ from conditional.
- Declare strerror if HAVE_STRERROR is defined; otherwise
- declare sys_errlist and sys_nerr.
- (my_strerror): New function.
-
-Tue Mar 28 14:16:35 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * search.c (get_binfo): Don't try to be so clever.
-
- * tree.c (copy_to_permanent): Also suspend_momentary().
-
- * cvt.c (cp_convert_to_pointer): Hand off to convert_fn_pointer even
- if the types are the same.
-
- * decl.c (start_function): Handle extern inlines more like C++ says
- we should.
-
- * init.c (build_member_call): Hand constructor calls off to
- build_functional_cast.
-
- * typeck2.c (build_functional_cast): Use DECL_NESTED_TYPENAME to get
- the name of the type.
-
-Tue Mar 28 13:13:56 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Check for the decl returned by
- grokfndecl to be null before using build_decl_attribute_variant.
-
-Mon Mar 27 18:04:41 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (build_new): Use build_pointer_type instead of
- TYPE_POINTER_TO.
-
-Fri Mar 24 12:11:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_conditional_expr): Handle pmfs.
- (convert_for_assignment): Fix pmf support.
-
- * cvt.c (convert_fn_ptr): Support !flag_vtable_thunks.
- (cp_convert_to_pointer): Handle pmfs.
- (cp_convert): Pass pmfs to cp_convert_to_pointer.
-
- * typeck.c (common_type): Handle inheritance for pmfs.
-
- * typeck2.c (build_m_component_ref): Do access control.
-
- * typeck.c (comp_target_types): Check for conversion to void *
- before checking trickier conversions.
-
- * decl.c (duplicate_decls): Propagate DECL_ABSTRACT_VIRTUAL_P.
-
- * pt.c (push_tinst_level): Complain if template instantiation depth
- is greater than max_tinst_depth.
-
- * typeck.c (common_type): Assume that we can call common_type to
- unify the target type of a pointer.
-
-Thu Mar 23 00:48:44 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (finish_file): Don't synthesize methods at
- finish_vtable_prevardecl time. Do synthesize methods that are not
- used, but are public and not external.
-
- * cvt.c (build_type_conversion): Only give an error if for_sure.
-
- * typeck.c (comp_target_types): Only support pointer conversions if
- nptrs > 0.
-
-Wed Mar 22 19:30:15 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (build_new): Catch use of an initializer list where it
- shouldn't be.
-
-Wed Mar 22 16:21:07 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (build_new): Wrap alloc_expr in an RTL_EXPR if nelts is
- non-constant.
-
- * decl2.c: temp_name_counter is now public.
-
- * decl.c (struct cp_function): Add temp_name_counter field.
- (push_cp_function_context): Save it.
- (pop_cp_function_context): Restore it.
-
- * typeck.c (common_type): Handle unifying function types, and unify
- unmatched things to void* with a compiler_error, rather than
- silently like before.
-
-Wed Mar 22 15:10:34 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (finish_prevtable_vardecl, finish_vtable_vardecl): Revert
- Brendan's last change and fix latent problem that causes TD entries
- to not come out when the things that need them has yet to be
- expanded.
-
-Wed Mar 22 15:12:00 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_binary_op_nodefault, comparison ops): Update type0
- and type1, since we might have changed op0 or op1.
-
-Wed Mar 22 13:33:45 1995 Jason Merrill <jason@python.cygnus.com>
-
- * typeck.c (common_type): Don't mess up templates.
-
-Wed Mar 22 04:56:00 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (common_type): Handle ptms properly. Also handle
- T* -> void*.
- (build_binary_op_nodefault): New variable build_type controls what
- type is given to the expression when it is created. Set this to
- boolean_type_node for comparison ops instead of using result_type.
- (comp_target_types): Allow T * -> void *.
-
- * cvt.c (cp_convert_to_pointer): Do access control when converting
- ptms, too.
-
-Tue Mar 21 17:25:06 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (extern_lang_string): Catch use of linkage specs that
- aren't all naming the same language.
-
- * class.c (finish_struct): Delete accidental duplicate code.
-
-Tue Mar 21 14:00:57 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_binary_op_nodefault): Disable pedwarns about
- comparing functions and incomplete types.
-
- * decl.c (finish_function): Only unset current_function_decl if
- !nested.
- (duplicate_decls): Last change went too far; we only want to stop
- checking for value/reference ambiguity.
-
-Tue Mar 21 01:26:39 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_generic_desc): Zap the DECL_SIZE so that we can lay it
- out fresh, as the new type may be larger.
-
-Mon Mar 20 19:01:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * expr.c (extract_init): Try to expand the RTL for the
- initialization and figure out what it will look like so we can avoid
- run-time initialization. Disabled for now.
- (extract_scalar_init): Helper for scalar initialization.
- (extract_aggr_init): Helper for aggregate initialization.
-
- * decl.c (duplicate_decls): Don't complain about ambiguous
- declarations.
- (obscure_complex_init): Now returns a tree. Call extract_init if
- we're optimizing and this is a toplevel decl.
- (finish_decl): Update accordingly.
-
- * lex.c (check_newline): If we're just changing files (not pushing
- or popping), update input_file_stack->name.
-
-Mon Mar 20 17:55:04 1995 Mike Stump <mrs@cygnus.com>
-
- * pt.c (type_unification): Only TEMPLATE_DECLs are handled right now
- in the transitive unification code.
-
-Mon Mar 20 16:07:50 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (shadow_tag): Don't allow inline, virtual, or explicit on
- non-functions.
- (grokdeclarator): Don't allow friends to be defined in local classes.
-
-Sat Mar 18 04:03:33 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (finish_prevtable_vardecl): Use DECL_DECLARED_STATIC
- rather than DECL_SAVED_INSNS to decide whether or not this method
- was declared inline.
-
- * method.c (synthesize_method): Turn off DECL_INLINE if
- function_cannot_inline_p thinks we're too large.
-
- * typeck.c (build_indirect_ref): Use build_expr_type_conversion.
-
-Fri Mar 17 17:47:36 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (instantiate_type): Handle pmfs.
-
- * typeck.c (convert_for_assignment): Check types when assigning one
- pmf to another.
-
- * decl.c (define_label): Fix logic for printing out the name of the
- label in an error message.
-
- * error.c (dump_expr): Support ARRAY_REF.
-
-Fri Mar 17 17:43:02 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Call build_t_desc here.
- (finish_prevtable_vardecl): Instead of here.
-
-Fri Mar 17 14:40:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (expand_static_init): Also use expand_aggr_init if the
- initializer is a TREE_LIST.
- (grokdeclarator): Only pedwarn about extra qualification if -pedantic.
-
- * pt.c (unify): Fix unification of return type.
-
- * expr.c (fixup_result_decl): Use store_expr, rather than
- emit_move_insn, to move the return value into the place where
- callers will expect it.
-
-Thu Mar 16 22:05:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (build_offset_ref): Call assmble_external on functions.
- * typeck.c (build_component_ref): Likewise.
-
-Thu Mar 16 20:28:16 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (struct saved_scope): Add members base_init_list and
- member_init_list.
- (push_to_top_level): Save current_base_init_list and
- current_member_init_list to them.
- (pop_from_top_level): Put it back.
-
-Thu Mar 16 19:21:14 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (instantiate_template): Call assemble_external.
-
-Thu Mar 16 18:07:54 1995 Brendan Kehoe <brendan@phydeaux.cygnus.com>
-
- * class.c: Include rtl.h, to get NULL_RTX.
- (finish_struct): Also zero out DECL_SAVED_INSNS, to avoid problems
- on hosts with different sizes for each part of the union.
- * tree.c: Also include rtl.h.
- (layout_basetypes): Same change for DECL_SAVED_INSNS.
-
-Thu Mar 16 13:57:36 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (unify): Fix array domain unification for 64-bit targets.
-
- * decl2.c (finish_file): Push bizarre type decl before walking the
- vtables the first time.
- (walk_vtables): OK, don't set prev to vars if the vardecl_fn messed
- with TREE_CHAIN (prev).
-
- * init.c (emit_base_init): Use convert_pointer_to_real instead of
- convert_pointer_to when converting to a direct base.
-
-Wed Mar 15 20:26:29 1995 Mike Stump <mrs@cygnus.com>
-
- * pt.c (type_unification): Handle transitive unification better.
-
-Wed Mar 15 13:56:16 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (walk_vtables): Always set prev to vars.
- (mark_vtable_entries): Call assemble_external on the vtable entries.
-
- * class.c (finish_struct): Set the vtable's size to NULL_TREE before
- calling layout_decl, so that it gets updated properly.
-
- Finally re-enable dynamic synthesis. This time it works.
- * method.c (synthesize_method): Pass decl_function_context (fndecl)
- to {push,pop}_cp_function_context.
- * decl.c (push_cp_function_context): Now takes a tree argument.
- (pop_cp_function_context): Likewise.
- * call.c (build_method_call): Enable synthesis.
- * lex.c (cons_up_default_function): Likewise.
-
-Tue Mar 14 19:14:19 1995 Doug Evans <dje@chestnut.cygnus.com>
-
- * parse.y (setattrs): Chain onto prefix_attributes rather than
- setting it.
-
-Wed Mar 15 13:00:00 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (pushdecl): Check if the type of the VAR_DECL is an
- error_mark_node before trying to read TYPE_LANG_SPECIFIC.
-
-Mon Mar 13 21:00:28 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator, case ARRAY_REF): Wrap the exp with fold,
- and convert the size and integer_one_node to the index type.
-
-Mon Mar 13 08:01:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (get_member_function_from_ptrfunc): Save the instance
- argument, and tack it onto the front of the COND_EXPR to make the
- semantics come out right. Grab the instance argument from
- '*instance_ptrptr', rather than having it passed in separately.
-
- * various: Change various consed-up comparison operations to have
- boolean type. Remove the instance argument in calls to
- get_member_function_from_ptrfunc.
-
- * error.c (dump_expr): Dump true and false as "true" and "false".
-
- * decl2.c (finish_file): Also set DECL_STATIC_FUNCTION_P on the
- global init function.
-
- * decl.c (finish_function): Only set DECL_EXTERNAL here if the
- inline function is public.
-
-Sat Mar 11 00:58:03 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (is_friend): Be more careful about checking
- DECL_CLASS_CONTEXT on non-member functions.
-
- * decl2.c (finish_vtable_vardecl): Don't bother calling
- assemble_external here.
- (prune_vtable_vardecl): New function that just splices out the
- vtable decl from the top-level decls.
- (import_export_inline): Unset DECL_EXTERNAL at first.
- (finish_file): Don't bother calling assemble_external here. Do
- splice out all of the vtables.
-
-Fri Mar 10 14:42:29 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (finish_function): If we're not emitting the function yet,
- call assemble_external for it.
-
- * decl2.c (finish_prevtable_vardecl): Don't call mark_vtable_entries
- here.
- (finish_vtable_vardecl): Don't do the linkage deduction thing here.
- Also don't splice out the current vtable if it is unused.
- (finish_file): Move the second walk_vtables and the synthesis check
- inside the 'reconsider' loop. Move thunk emission after the
- 'reconsider' loop.
-
-Thu Mar 9 16:28:16 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * pt.c (tsubst): Don't bother calling cp_build_type_variant, since it
- was passing bogus values for readonly and volatile from the original
- template decl, not the resultant type of the tsubst call.
-
- * class.c (duplicate_tag_error): Use cp_error_at to point out the
- previous definition of the tag.
-
-Thu Mar 9 10:46:17 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (start_function): Clear base_init_insns and protect_list.
- (struct cp_function): Add base_init_insns field.
- (push_cp_function_context): Also save base_init_insns.
- (pop_cp_function_context): Also restore base_init_insns.
-
-Wed Mar 8 13:31:44 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (member_init_ok_or_else): Check for initializing a static
- member here.
- (emit_base_init): Instead of here.
-
-Tue Mar 7 16:03:26 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_method_call): Disable synthesis as needed.
- * lex.c (cons_up_default_function): Likewise.
-
-Tue Mar 7 10:14:29 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y: New rules to allow attributes in a prefix position.
- (prefix_attributes): New variable. Pass it into cplus_decl_attributes.
- (setattr): New rule.
- (reserved_declspecs, declmods): Catch attributes here.
- * decl2.c (cplus_decl_attributes): Add PREFIX_ATTRIBUTES argument.
- * decl.c (duplicate_decls): Pass DECL_MACHINE_ATTRIBUTES to
- descendent typedef.
- (grokdeclarator): Added code to support machine attributes.
- * Makefile.in (stamp-parse): Expect 5 shift/reduce failures.
-
-Mon Mar 6 15:07:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_method_call): Don't synthesize methods outside of a
- function.
-
- Make base initialization more re-entrant so that synthesis on the
- fly will work (and, eventually, template instantation on the fly).
- * init.c (sort_member_init): Don't bother with members that can't be
- initialized. Reorganize a bit. Don't initialize base members here.
- (sort_base_init): New function, like sort_member_init, but for base
- classes. Steals some code from emit_base_init.
- (emit_base_init): Simplify. Call sort_{member,base}_init before
- doing any initialization, so we don't have to save
- current_{member,base}_init_list in push_cp_function_context.
- (expand_aggr_vbase_init_1): Adjust for sort_base_init.
- (expand_aggr_vbase_init): Simplify.
- * decl.c (struct cp_function): Add protect_list field.
- (push_cp_function_context): Also save protect_list.
- (pop_cp_function_context): Also restore protect_list.
- * call.c (build_method_call): Enable synthesis at point of call.
- * lex.c (cons_up_default_function): Likewise.
-
- * parse.y: Turn -ansi checks back into -pedantic checks.
-
- * init.c (build_new): Fix -fcheck-new for array new.
-
-Sat Mar 4 15:55:42 1995 Fergus Henderson <fjh@cs.mu.oz.au>
-
- * typeck.c (build_compound_expr): warn if left-hand operand of
- comma expression has no side-effects.
-
-Fri Mar 3 15:16:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * parse.y (primary): Change 'object qualified_id *' rules to 'object
- overqualified_id *'.
-
-Fri Mar 3 12:48:17 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (unary_expr): Catch doing sizeof an overloaded function.
- Make the error look the same as the one we issue in c_sizeof.
-
- * typeck.c (build_binary_op_nodefault): Give an error for trying
- to compare a pointer-to-member to `void *'.
-
-Fri Mar 3 11:28:50 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_unary_op): Handle bool increment with smoke and
- mirrors here, rather than in expand_increment where it belongs,
- because Kenner doesn't agree with me.
-
-Fri Mar 3 00:08:10 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokparms): Catch a PARM_DECL being used for a default
- argument as well.
-
-Thu Mar 2 20:05:54 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * init.c (build_new): Don't allow new on a function type.
-
- * parse.y (primary): Avoid a crash when seeing if the arg is of
- the same type as that given for the typespec in an explicit dtor call.
-
-Thu Mar 2 00:49:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (finish_function): Change test for calling
- mark_inline_for_output.
-
-Wed Mar 1 11:23:46 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_modify_expr): Complain if
- build_default_binary_type_conversion fails.
-
- * init.c (expand_default_init): Handle arguments of unknown type
- properly.
-
- * cvt.c (build_expr_type_conversion): Only complain about ambiguity
- if 'complain'.
- * various: Pass 'complain'.
-
- * typeck.c (comptypes): Be more picky about comparing UPTs.
-
-Wed Mar 1 11:03:41 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): If declarator is null, say that the
- type used has an incomplete type.
-
-Wed Mar 1 10:06:20 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (instantiate_template): Copy the template arguments to the
- permanent_obstack. Also use simple_cst_equal to compare them when
- looking for a previous instantiation.
-
- * tree.c (make_deep_copy): Support copying INTEGER_TYPEs (assuming
- they are array domain types).
-
-Tue Feb 28 23:24:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cp-tree.h: Define WANT_* constants for passing to
- build_expr_type_conversion.
- * cvt.c (build_expr_type_conversion): New function to build
- conversion to one of a group of suitable types.
- (build_default_binary_type_conversion): Use it.
- * decl2.c (grok_array_decl): Likewise.
- * typeck.c (build_unary_op): Likewise.
- (build_array_ref): Tidy up a bit.
- (build_binary_op): Likewise.
-
-Tue Feb 28 19:57:31 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Don't allow decl of an argument as `void'.
-
-Tue Feb 28 17:23:36 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * parse.y (typed_declspecs1): Add 'typespec reserved_typespecquals
- reserved_declspecs' rule.
-
- * parse.y (expr_or_declarator): Remove notype_qualified_id rule.
- (direct_notype_declarator): Likewise.
- (complex_direct_notype_declarator): Add notype_qualified_id rule.
-
- * lex.c (real_yylex): Handle :> digraph properly.
-
-Tue Feb 28 12:26:29 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Check if it's a friend, not if it's
- non-virtual, that's being initialized. Move the check up to
- before FRIENDP would get cleared. Catch an unnamed var/field
- being declared void. Say just `field' instead of `structure field'
- in the error message. Only go for the operator name if DECLARATOR
- is non-null.
-
-Tue Feb 28 00:08:01 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (start_function): Complain about abstract return type.
- (grokdeclarator): Complain about declaring constructors and
- destructors to be const or volatile. Complain about declaring
- destructors to be static.
-
- * pt.c (uses_template_parms): Handle pmfs.
-
- * decl.c (grokdeclarator): Don't call variable_size for array bounds
- that only depend on template constant parameters.
-
-Mon Feb 27 15:38:16 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * error.c (dump_decl): Only look to see if it's a vtable if we
- actually have a name to check out.
-
-Mon Feb 27 13:37:53 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cvt.c (convert_to_aggr): Lose misleading shortcut.
-
-Sun Feb 26 17:27:32 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * decl.c (set_nested_typename): Always set DECL_IGNORED_P,
- not just for dwarf.
-
-Sun Feb 26 00:10:18 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Don't allow a static member to be
- declared `register'.
-
- * init.c (make_friend_class): Move up to a pedwarn for the warning
- about a class declaring friends with itself.
-
- * decl.c (grokdeclarator): You can't do `volatile friend class foo'
- or `inline friend class foo'. Only try to make a friend out of
- TYPE if we didn't already reset it to integer_type_node.
-
-Sat Feb 25 22:32:03 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Don't allow initialization of a
- non-virtual function.
-
- * decl.c (start_function): Do a pedwarn if we're changing `main'
- to have an int return type.
-
-Sat Feb 25 00:02:05 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_modify_expr): Handle simple assignment from
- TARGET_EXPRs by building up an RTL_EXPR to force expansion. Whew.
-
-Fri Feb 24 18:27:14 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Also don't allow virtual outside of a
- class decl for a scope method definition performed at global binding.
-
- * init.c (build_offset_ref): Don't allow creation of an OFFSET_REF
- of a bitfield.
-
- * decl.c (grokdeclarator): Don't allow a const to be declared mutable.
-
- * typeck.c (build_binary_op): Return an error_mark_node if either
- one of the args turned into an error_mark_node when we tried to
- use default_conversion.
-
- * typeck.c (build_unary_op): Forbid using postfix -- on a bool.
-
- * decl.c (grokdeclarator): Allow `signed' and `unsigned' to be
- used on `__wchar_t'.
-
-Fri Feb 24 13:59:53 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (end_protect_partials): Do it the right way.
-
-Wed Feb 22 15:42:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_binary_op_nodefault): Upgrade warning about
- comparing distinct pointer types to pedwarn.
-
- * typeck2.c (digest_init): Cope with extra braces.
-
- * typeck.c (build_binary_op_nodefault): Use tree_int_cst_sgn instead
- of INT_CST_LT (..., interger_zero_node).
-
-Wed Feb 22 14:45:52 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * except.c [!TRY_NEW_EH] (end_protect_partials): Define dummy
- function for systems that don't have EH.
-
-Tue Feb 21 19:18:31 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (can_convert_arg): Like can_convert, but takes an arg as
- well.
-
- * pt.c (type_unification): Allow implicit conversions for parameters
- that do not depend on template parameters.
-
-Tue Feb 21 18:43:48 1995 Douglas Rupp <drupp@cs.washington.edu>
-
- * Make-lang.in, config-lang.in: ($exeext): New macro.
- * Make-lang.in: Try a "cp" if "ln" fails.
- * cp-tree.h (decl_attributes): Added argument.
- * decl2.c (cplus_decl_attribute): Add arg to decl_attributes.
- * cp/g++.c: Added #ifdefs for sys/file.h and process.h for NT.
- Modified spawnvp to have to correct number of arguments for OS/2, NT.
-
-Tue Feb 21 18:36:55 1995 Mike Stump <mrs@cygnus.com>
-
- * decl.c (finish_function): Add calls to end_protect_partials to end
- the exception region that protects constructors so that partially
- constructed objects can be partially destructed when the constructor
- throws an exception.
- * init.c (perform_member_init, sort_member_init, emit_base_init):
- Added support for partially constructed objects.
- * init.c (build_partial_cleanup_for): New routine to do partial
- cleanups of a base class.
- * decl2.c (finish_file): Move the emitting of the exception table
- down, after we emit all code that might have exception regions in
- them.
- * except.c (end_protect_partials, might_have_exceptions_p): New
- routines.
- (emit_exception_table): Always output table if called.
- * cp-tree.h (protect_list, end_protect_partials,
- might_have_exceptions_p, emit_exception_table): Added.
-
-Tue Feb 21 16:05:59 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * gc.c (build_typeid): Pass a NULL_TREE, not the bogus, unused
- address of a local variable.
- * class.c (build_vfn_ref): Only try to build the PLUS_EXPR if we
- were given a non-null PTR_TO_INSTPTR.
-
-Tue Feb 21 01:53:18 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (duplicate_decls): Always lay out the merged decl.
-
- * decl2.c (finish_vtable_vardecl): Don't do vtable hack on templates.
- (finish_prevtable_vardecl): Likewise.
-
- * method.c (synthesize_method): Set interface_{unknown,only}
- according to the settings for our class, not the file where it comes
- from.
-
-Sat Feb 18 12:26:48 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c: Handle systems that define __i386__ but not __i386.
-
-Fri Feb 17 15:31:31 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (reparse_decl_as_expr): Support being called without a
- type argument.
-
- * parse.y (primary): Add '(' expr_or_declarator ')'. Adds 4 r/r
- conflicts. Sigh.
-
-Fri Feb 17 12:02:06 1995 Mike Stump <mrs@cygnus.com>
-
- * parse.y (template_def, fndef, fn.def1, return_init, condition,
- initdcl0, initdcl, notype_initdcl0, nomods_initdcl0,
- component_decl_1, after_type_component_declarator0,
- notype_component_declarator0, after_type_component_declarator,
- notype_component_declarator, after_type_component_declarator,
- full_parm, maybe_raises, exception_specification_opt): Fix up,
- include exception_specification_opt maybeasm maybe_attribute and
- maybe_init if missing. Rename maybe_raises to
- exception_specification_opt to match draft wording. Use maybe_init
- to simplify rules.
-
-Fri Feb 17 01:54:46 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (build_new): Set TREE_NO_UNUSED_WARNING on COMPOUND_EXPRs
- built for news of scalar types.
-
-Thu Feb 16 17:48:28 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_binary_op_nodefault): Update code for warning
- about signed/unsigned comparisons from C frontend. Realize that the
- code in the C frontend is, if anything, even more bogus. Fix it.
- (build_binary_op): Undo default_conversion if it wasn't useful.
-
- * typeck.c (build_unary_op, ADDR_EXPR): Lose bogus special case for
- PRE*CREMENT_EXPR.
-
- * decl2.c (import_export_vtable): Don't try the vtable hack
- if the class doesn't have any real non-inline virtual functions.
- (finish_vtable_vardecl): Don't bother trying to find a non-inline
- virtual function in a non-polymorphic class.
- (finish_prevtable_vardecl): Likewise.
-
- * decl2.c (import_export_vtable): Use and set DECL_INTERFACE_KNOWN.
-
- * cp-tree.h (DECL_INTERFACE_KNOWN): Use DECL_LANG_FLAG_5.
-
- * init.c (expand_virtual_init): Always call assemble_external.
-
- * class.c (build_vfn_ref): Always call assemble_external.
- (build_vtable): Always call import_export_vtable.
- (prepare_fresh_vtable): Likewise.
- (add_virtual_function): Don't bother setting TREE_ADDRESSABLE.
-
-Thu Feb 16 03:28:49 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (finish_struct): Use TYPE_{MIN,MAX}_VALUE to determine
- whether an enumerated type fits in a bitfield.
-
-Wed Feb 15 15:38:12 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (grow_method): Update method_vec after growing the class
- obstack.
-
-Wed Feb 15 13:42:59 1995 Mike Stump <mrs@cygnus.com>
-
- * parse.y (handler_seq): Push a level for the catch parameters.
-
-Wed Feb 15 12:42:57 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (emit_base_init): Update BINFO_INHERITANCE_CHAIN on my
- bases, in case they've been clobbered.
-
-Wed Feb 15 12:07:29 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_base_struct): Set up BINFO_INHERITANCE_CHAIN here,
- so that one day it will always be valid.
- * tree.c (propagate_binfo_offsets, layout_vbasetypes): Likewise.
-
- * cp-tree.h (copy_binfo): Removed, unused.
- * tree.c (copy_binfo): Likewise.
-
-Wed Feb 15 00:05:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (build_new): Save the allocation before calling
- expand_vec_init on it.
-
- * decl.c (finish_enum): The TYPE_PRECISION of the enum type mush
- match the TYPE_PRECISION of the underlying type for constant folding
- to work.
-
-Tue Feb 14 15:31:25 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (push_eh_entry, expand_start_all_catch,
- expand_leftover_cleanups, expand_end_catch_block): Keep track of
- the context in which the exception region occurs.
- (build_exception_table): If the region was not output, don't output
- the entry in the eh table for it.
-
-Tue Feb 14 02:15:43 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (expand_default_init): Only use a previous constructor call
- if it's a call to our constructor. Does the word "Duh" mean
- anything to you?
-
- * decl.c (grokparms): Fine, just don't call
- convert_for_initialization at all. OK? Happy now?
-
-Mon Feb 13 02:23:44 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cp-tree.h (CLASSTYPE_FIRST_CONVERSION): Make sure that the class
- method vector has a second element before returning it.
-
- * decl.c (grokparms): Don't strip REFERENCE_TYPE before calling
- convert_for_initialization.
-
-Sun Feb 12 03:57:06 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_modify_expr): Compare function name to
- constructor_name (current_class_type) instead of current_class_name.
-
- * decl.c (grokparms): Don't do anything with the return value of
- convert_for_initialization.
-
- * error.c (dump_decl): Also dump_readonly_or_volatile on the decl.
-
- * decl.c (duplicate_decls): Tweak error message.
-
- * typeck.c (build_const_cast): Implement checking.
- (build_reinterpret_cast): Implement some checking.
-
- * cp-tree.h (CONV_FORCE_TEMP): Require a new temporary when
- converting to the same aggregate type.
- (CONV_STATIC_CAST): Include it.
- (CONV_C_CAST): Likewise.
- * cvt.c (convert_force): Use CONV_C_CAST instead of CONV_OLD_CONVERT.
- (cp_convert): Only force a new temporary if CONV_FORCE_TEMP.
-
-Fri Feb 10 16:18:52 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_c_cast): Use non_lvalue to tack something on
- where necessary.
-
- * decl.c (auto_function): Now a function.
- * except.c (init_exception_processing): terminate, unexpected,
- set_terminate, and set_unexpected have C++ linkage.
-
- * typeck.c (build_unary_op, TRUTH_NOT_EXPR): Use convert instead of
- truthvalue_conversion for converting to bool, as it handles
- user-defined conversions properly.
- (condition_conversion): Likewise.
-
- * except.c (expand_throw): Don't call convert_to_reference.
- Pass the correct parameters to build_new.
-
- * method.c (do_build_assign_ref): Don't use access control when
- converting to a base reference here.
- (do_build_copy_constructor): Or here.
-
- * init.c (build_new): Unset TREE_READONLY on the dereferenced
- pointer before assigning to it.
-
- * decl.c (maybe_build_cleanup): Don't bother stripping const here.
-
- * decl2.c (delete_sanity): You can now delete pointer to const.
-
-Fri Feb 10 13:28:38 1995 Jason Merrill <jason@python.cygnus.com>
-
- * decl.c (finish_function): Don't rely on actual parameters being
- evaluated left-to-right.
- * except.c (expand_end_catch_block): Likewise.
-
-Fri Feb 10 00:52:04 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * tree.c (real_lvalue_p): Like lvalue_p, but class temps aren't
- considered lvalues.
- * cvt.c (convert_to_reference): Use real_lvalue_p instead of
- lvalue_p.
-
- * cvt.c (build_type_conversion_1): Don't call convert on aggregate
- types.
- (convert_to_reference): Fix erroneous text substitution.
-
- * typeck2.c (initializer_constant_valid_p): Update from C frontend.
- Add new argument to all callers.
-
- * typeck.c (convert_arguments): Check for error_mark_node before
- trying to do anything with the actual parameter.
-
- * typeck.c (condition_conversion): Build up a CLEANUP_POINT_EXPR and
- fold it.
- (bool_truthvalue_conversion): Remove. Fix all callers to call
- truthvalue_conversion instead.
- (various): Fold CLEANUP_POINT_EXPRs.
-
- * parse.y (conditions): Call condition_conversion rather than
- building up a CLEANUP_POINT_EXPR.
-
- * pt.c (end_template_decl): Don't warn_if_unknown_interface here
- under -falt-external-templates.
-
-Thu Feb 9 05:24:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (build_new): Complain about new of const type without
- initializer. Other cleanup.
-
- * call.c (compute_conversion_costs): Don't call
- build_type_conversion with a reference type; convert to the target
- type and check its lvaluetude.
- * cvt.c (convert_to_reference): Likewise.
-
- * cvt.c (build_type_conversion_1): There will never be any need to
- dereference references here now.
-
-Thu Feb 9 00:37:47 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_builtin_throw): Make sure we only `use' the
- value of return_val_rtx.
-
-Wed Feb 8 15:45:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * parse.y (structsp): Don't complain about declaring a type being
- defined to be a friend.
-
- * decl2.c (warn_if_unknown_interface): Note the template in question
- and the point of instantiation, for -falt-external-templates.
- * lex.c (reinit_parse_for_method): Pass the decl to
- warn_if_unknown_interface.
- * pt.c (instantiate_template): Likewise.
- (end_template_decl): Likewise.
-
- * decl.c (set_nested_typename): Set IDENTIFIER_TYPE_VALUE on the
- nested name again, to make local classes work a bit better.
-
- * typeck.c (build_function_call_real): Dereference reference after
- checking for incomplete type.
-
- * init.c (build_new): Accept new of const and volatile types.
-
-Wed Feb 8 14:04:16 1995 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): Fix error message.
-
-Wed Feb 8 03:16:15 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (convert_for_initialization): Do bash arrays when
- converting to a reference to non-array.
-
-Tue Feb 7 15:50:33 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cvt.c (cp_convert): Don't call convert_to_reference, or
- automatically dereference references. Do pass reference conversions
- to cp_convert_to_pointer.
- (cp_convert_to_pointer): Support references.
-
- * call.c (build_method_call): Don't build up a reference to the
- parameter here; let build_overload_call handle that.
-
- * typeck.c (build_c_cast): Call convert_to_reference directly if
- converting to a reference type.
- * method.c (do_build_copy_constructor): Likewise.
- * method.c (do_build_copy_constructor): Likewise.
- (do_build_assign_ref): Likewise.
-
- * call.c (build_method_call): Dereference a returned reference.
- * typeck.c (build_function_call_real): Likewise.
-
- * decl.c (xref_basetypes): Check for unions with basetypes here.
- (xref_tag): Instead of here.
-
- * pt.c (process_template_parm): Template type parm decls are
- artificial.
-
-Mon Feb 6 04:32:09 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * parse.y (typed_declspecs): Add missing semicolon.
- (do_xref_defn): Resurrect.
- (named_class_head_sans_basetype): Move template specialization
- definition cases to named_class_head_sans_basetype_defn.
-
- * decl2.c (grokfield): Call pushdecl_class_level after setting the
- TYPE_NAME, not before.
-
-Sun Feb 5 02:50:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (convert_harshness): Don't call sorry here. Don't allow
- conversions between function pointer types if pedantic.
-
- * pt.c (overload_template_name): Pass globalize=1 to xref_tag.
-
- * lex.c (cons_up_default_function): Use the full name for the return
- type of op=.
-
- * decl.c (set_nested_typename): Don't worry about anonymous types,
- as they already have a unique name.
- (pushdecl): Remove redundant set_nested_typename
- (xref_tag): Split out base handling into xref_basetypes.
-
- * cp-tree.h (TYPE_INCOMPLETE): New macro; TEMPLATE_TYPE_PARMs are
- not considered incomplete even though their definition is unknown.
-
- * decl.c (xref_defn_tag): Lose.
- (xref_tag): xref_next_defn = ! globalize.
- (pushdecl): Don't set DECL_NESTED_TYPENAME on artificial decls. The
- ones that should have it set will have it set by pushtag.
- (pushdecl_class_level): Likewise.
- (pushtag): Tidy up a bit.
- (set_nested_typename): Push a decl for the nested typename from
- here, rather than from xref_defn_tag.
-
- * parse.y (do_xref): Lose.
- (named_class_head): If we see 'class foo:' we know it's a
- definition, so don't worry about base lists for non-definitions.
-
- * pt.c (push_template_decls): Template parm decls are artificial.
-
- * decl.c (duplicate_decls): Restore check for qualifier
- disagreement for non-functions.
- (decls_match): Remove check for qualifier disagreement.
-
-Fri Feb 3 14:58:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (grok_reference_init): Convert initializer from
- reference.
- * typeck.c (convert_for_initialization): Likewise.
-
- * decl.c (duplicate_decls): Propagate DECL_NESTED_TYPENAME.
-
- * cvt.c (cp_convert): Don't convert to the same class type by just
- tacking on a NOP_EXPR.
- (convert_to_reference): Use comp_target_types instead of comptypes
- so that we don't allow conversions two levels down.
-
-Thu Feb 2 15:07:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (build_vbase_path): Bash types to make the backend happy.
- * cvt.c (build_up_reference): Bash the types bashed by
- build_vbase_path to be reference types instead of pointer types.
- (convert_to_reference): Likewise.
-
- * typeck.c (build_c_cast): Don't strip NOPs if we're converting to a
- reference type.
-
- * parse.y (structsp): Put back error for 'struct B: public A;'.
-
-Wed Feb 1 23:02:06 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c: Add support for mips systems that don't define __mips
- but do define mips, like Ultrix.
-
-Wed Feb 1 22:39:07 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c: Add support for exception handling on the Alpha.
-
-Wed Feb 1 10:12:14 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (finish_file): Fix bug in Jan 31st change.
-
-Tue Jan 31 16:59:15 1995 Gerald Baumgartner <gb@lorenzo.cs.purdue.edu>
-
- * sig.c (build_signature_pointer_or_reference_type): Don't set
- IS_AGGR_TYPE for signature pointers/reference so expand_default_init
- doesn't expect to find a copy constructor.
- * call.c (build_method_call): Treat signature pointers/reference
- as if IS_AGGR_TYPE were set.
-
-Tue Jan 31 13:28:56 1995 Mike Stump <mrs@cygnus.com>
-
- * gc.c (get_typeid): Pawn off error messages to build_t_desc.
- (build_t_desc): Inform the user here if they try and build
- with -frtti and don't include <typeinfo.h>.
-
- * decl2.c (finish_prevtable_vardecl): Support rescanning.
- (finish_file): Move finish_prevtable_vardecl up to before the global
- initializers are done as tdecls are initialized in the global
- initializer. Also Pick up any new tdecls or vtables needed by
- synthesized methods.
-
- * class.c (finish_struct): Simplify. We have to do rtti scanning at
- end, so we might as well do all of it there.
-
-Tue Jan 31 05:35:02 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_method_call): Fix -fthis-is-variable for 32-bit
- targets, too.
-
-Tue Jan 31 00:11:04 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (finish_prevtable_vardecl): New routine, mostly split from
- finish_vtable_vardecl. It has the first half functionality from
- that routine.
- * decl2.c (finish_vtable_vardecl): Update to not include stuff not
- in finish_prevtable_vardecl.
- * decl2.c (finish_file): Call finish_prevtable_vardecl.
- * gc.c (build_generic_desc): Allow it to be called when not at the
- global binding layer, but behave as if we were.
- (build_t_desc): Rearrange a bit so that it really works and is
- easier to follow.
- * class.c (finish_struct): Don't decide on tdecls here, as we have
- to wait until the end of the file in general to decide whether or
- not they come out.
-
-Mon Jan 30 01:00:40 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (build_delete): Check access to operator delete before
- calling the destructor.
- * method.c (build_opfncall, DELETE_EXPR): build_method is allowed to
- return error_mark_node.
- * call.c (build_method_call): Use the one-argument op delete even if
- it's an error.
-
- * init.c (build_new): Fix -fthis-is-variable support.
- * call.c (build_method_call): Likewise.
-
- * call.c (convert_harshness): Make conversion from a pointer to bool
- worse than conversion to another pointer.
-
-Sat Jan 28 16:46:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (build_new): Check new return value if -fcheck-new.
-
- * lex.c (check_newline): Clear end_of_file when we're done, too.
-
-Sat Jan 28 10:38:39 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Make rtti TD tables follow
- vtables whereever they go.
-
- * gc.c (build_t_desc): Remove old way of setting it up, as it wasn't
- right.
-
-Sat Jan 28 09:10:44 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (finish_vtable_vardecl): Now set the
- interface/implementation of vtables on the first virtual function,
- if one exists, otherwise we use the old method. This is a major win
- in terms of cutting down the size of objects and executables in
- terms of text space and data space. Now most of the savings that
- #pragma interface/implementation gives is automatic in a fair number
- of cases.
-
-Sat Jan 28 04:57:33 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (grokdeclarator): Discard the template parameters in a
- template constructor declaration so that the function is always
- named constructor_name (ctype).
-
- * lex.c (check_newline): Use ungetc to put back the character before
- calling HANDLE_PRAGMA.
-
-Fri Jan 27 17:23:47 1995 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (check_classfn): If the cname is T<int> and fn_name is T,
- make sure we still match them.
-
-Fri Jan 27 16:32:10 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * parse.y: Add END_OF_LINE token.
-
- * lex.c (check_newline): Set linemode when we see a # directive, and
- unset it when we're done. Turn all 'return's into 'goto skipline'.
- Fix all uses of '\n', since we won't see it anymore. Put back the
- character we read before checking for a sysv or target pragma.
- (real_yylex): If we see an EOF in linemode, return END_OF_LINE.
- (handle_sysv_pragma): Don't look at the input stream; quit when we
- see an END_OF_LINE token.
-
- * input.c (getch): Return EOF if we're in line mode and at the end
- of a line.
- (put_back): Don't put back an EOF.
-
-Thu Jan 26 19:26:34 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Do the newing of the exception object
- before we load the type descriptor or the address so that we don't
- wipe any of the values out.
-
-Thu Jan 26 19:20:00 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (init_exception_processing): Don't use r12 on the rs6000.
-
-Tue Jan 24 16:36:31 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (grokparms): Don't try to build up a reference at this point.
-
- * typeck2.c (build_functional_cast): Don't assume that a NOP_EXPR
- will suffice to convert from integer_zero_node.
-
-Wed Jan 25 15:02:09 1995 David S. Miller <davem@nadzieja.rutgers.edu>
-
- * class.c (instantiate_type): Change error message text.
- * typeck2.c (store_init_value): Likewise.
-
-Mon Jan 23 21:57:14 1995 Mike Stump <mrs@cygnus.com>
-
- * pt.c (tsubst): When we copy a node, don't forget to copy
- TREE_CHAIN, we use it later.
-
-Mon Jan 23 03:33:47 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (convert_for_assignment): Initialize variable before use.
-
-Fri Jan 20 01:17:59 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * g++.c (main): Link with both libstdc++ and libg++ if called as
- something ending with "g++", otherwise only libstdc++. Move -lm to
- the end of the line.
-
-Thu Jan 19 15:43:11 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_method_call): Don't mess with 'this' before calling
- compute_conversion_costs.
-
-Wed Jan 18 15:40:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * search.c (get_matching_virtual): Give line number for previous
- declaration.
-
- * call.c (convert_harshness): Handle conversions to references
- better.
-
- * cvt.c (build_up_reference): OK, handle {MIN,MAX}_EXPR *properly*.
-
-Wed Jan 18 15:21:38 1995 Mike Stump <mrs@cygnus.com>
-
- * class.c (instantiate_type): Use DECL_CHAIN to walk lists instead,
- as the TREE_CHAIN for methods will take us to the next differently
- named function, DECL_CHAIN won't.
-
-Wed Jan 18 14:26:59 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * tree.c (lvalue_p): Handle {MIN,MAX}_EXPR.
-
- * decl2.c (lang_decode_option): -Wall implies -Wparentheses.
- warn_parentheses defaults to 0.
-
- * decl.c (grokparms): Put back call to require_instantiated_type.
-
-Tue Jan 17 19:56:15 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c (exception_section): Use the data section on the rs6000.
- Change calling convention for named_section.
-
-Wed Jan 17 18:20:57 1994 Fergus Henderson <fjh@munta.cs.mu.oz.au>
-
- * cp-tree.h : Make if (x=0) warn with wall
- * parse.y : Make if (x=0) warn with wall
-
-Tue Jan 17 14:12:00 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (BOOL_TYPE_SIZE): BITS_PER_WORD if SLOW_BYTE_ACCESS,
- BITS_PER_UNIT otherwise.
-
- * search.c (get_matching_virtual): Don't check the binfo if the
- types are the same.
-
- * cvt.c (cp_convert): Just call truthvalue_conversion to convert to
- bool.
-
-Mon Jan 16 13:28:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * various: Use boolean_type_node, boolean_true_node,
- boolean_false_node.
-
- * search.c (get_matching_virtual): Allow covariant returns that
- don't require pointer adjustment.
-
- * typeck.c (build_conditional_expr): Don't call default_conversion
- on ifexp.
-
- * cvt.c (build_up_reference): Handle MIN_EXPR and MAX_EXPR.
-
- * decl.c (grokdeclarator): Upgrade warning about &const to pedwarn.
-
-Sun Jan 15 22:17:32 1995 David Binderman <dcb@lovat.fmrco.COM>
-
- * pt.c (do_function_instantiation): Free targs once we're done.
-
-Sun Jan 15 22:17:32 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (BOOL_TYPE_SIZE): Defaults to BITS_PER_WORD.
- (init_decl_processing): Use BOOL_TYPE_SIZE instead of CHAR_TYPE_SIZE
- for bool.
-
-Sat Jan 14 05:33:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (finish_file): We need to mess up if there are any
- variables in the list, not just if there is one with a constructor.
-
-Fri Jan 13 14:42:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (duplicate_decls): Propagate DECL_STATIC_{CON,DE}STRUCTOR.
- (finish_function): Handle DECL_STATIC_{CON,DE}STRUCTOR.
- (finish_function): Trust rest_of_compilation.
-
- * decl2.c (finish_file): Also call functions designated as static
- constructors/destructors.
-
- * decl.c (grokdeclarator): Allow access decls of operator functions.
- (grokparms): Only do convert_for_initialization if the initializer
- has a type.
- (duplicate_decls): Put back push_obstacks_nochange call.
-
- * lex.c (real_yylex): Downgrade complaint about the escape sequence
- being too large from pedwarn to warning.
-
- * decl.c (grokdeclarator): Don't complain about long long in system
- headers.
-
- * lex.c (real_yylex): Handle digraphs.
-
-Thu Jan 12 12:17:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (init_decl_processing): -f{no-,}strict-prototype only
- affects C linkage declarations now.
-
- * typeck.c (comp_target_types): Grok simple contravariant conversions.
- (common_type): t1 and t2 are interchangeable.
-
- * various: Test return value of comp_target_types differently in
- different places; it now returns -1 for a contravariant conversion
- (which is fine in symmetric cases).
-
- (common_type): Prefer long double to double even when
- they have the same precision.
-
- * decl.c (grokparms): Call convert_for_initialization to check
- default arguments.
-
- * init.c (build_new): void_type_node has a size (of 0).
-
- * decl.c (decls_match): Also check for agreement of TREE_READONLY
- and TREE_THIS_VOLATILE.
- (push_class_level_binding): Properly handle shadowing of
- nested tags by fields.
-
- * search.c (dfs_pushdecls): Likewise.
-
- * decl2.c (finish_file): Don't second-guess self-initialization.
-
- * cvt.c (convert_to_reference): Work with expr directly, rather than
- a copy.
-
- * decl.c (push_overloaded_decl): Only shadow artificial TYPE_DECLs.
-
- * init.c (add_friend): Downgrade duplicate friend message from
- pedwarn to warning.
-
- * decl.c (duplicate_decls): Push obstacks before calling common_type.
-
-Thu Jan 12 17:15:21 1995 Michael Ben-Gershon <mybg@cs.huji.ac.il>
-
- * except.c (push_eh_entry): set LABEL_PRESERVE_P flag for
- exception table labels.
- (expand_start_all_catch): Likewise.
- (expand_leftover_cleanups): Likewise.
- (expand_end_catch_block): Likewise.
- * except.c (make_first_label): new function.
- (expand_start_all_catch): add a call to make_first_label() before
- using a label as a jump destination.
- (expand_end_all_catch): Likewise.
- (expand_leftover_cleanups): Likewise.
- (expand_end_catch_block): Likewise.
- (expand_builtin_throw): Likewise.
- (expand_throw): Likewise.
- * except.c: Add ARM processor support for exception handling.
-
-Thu Jan 12 12:17:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- (complete_array_type): Copy code from C frontend.
-
- * lex.c (real_yylex): Don't multiply the length of a wide string
- literal by WCHAR_BYTES.
-
- * decl.c (pushdecl): Check for redeclaration of wchar_t here.
- (duplicate_decls): Instead of here.
- (define_label): Complain about a label named wchar_t.
- (grokdeclarator): Complain about declarations of
- operator-function-ids as non-functions.
-
- * typeck.c (unary_complex_lvalue): Also wrap prefix -- and ++ in
- COMPOUND_EXPRs.
- (build_unary_op): Wrap unary plus in a NON_LVALUE_EXPR.
-
- * lex.c (real_yylex): Don't skip whitespace when reading the next
- character after ->.
-
-Wed Jan 11 16:32:49 1995 Mike Stump <mrs@cygnus.com>
-
- * except.c: Allow cc1plus to be built with native compiler on rs6000.
- (expand_start_all_catch): Add assemble_external calls for various
- routines we call.
- (expand_leftover_cleanups): Likewise.
- (expand_start_catch_block): Likewise.
- (do_unwind): Likewise.
- (expand_builtin_throw): Likewise.
-
-Wed Jan 11 01:05:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (pushtag): Only look for a previous decl in the current
- binding level. Use explicit global scope in DECL_NESTED_TYPENAME.
-
- * gxx.gperf: Add __signature__ and __sigof__ keywords.
-
- * decl2.c (lang_decode_option): -ansi does not set flag_no_asm. It
- does set flag_no_gnu_keywords and flag_operator_names.
-
- * lex.c (init_lex): 'overload' is not a keyword unless -traditional.
- Unset extension keywords if -fno-gnu-keywords.
- Allow operator names ('bitand') if -foperator-names.
- Never unset 'asm'; -fno-asm only affects 'typeof'.
-
- * decl.c (lookup_name_real): The got_object special lookup only
- applies to types.
-
-Tue Jan 10 18:07:51 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * spew.c (yylex): Also use DECL_NESTED_TYPENAME if got_object is set.
-
- * parse.y (primary): Unset got_object after all rules that use the
- 'object' nonterminal.
- (object): Set got_object.
-
- * lex.h: Declare got_object.
-
- * decl.c (lookup_name_real): Also lookup names in the context of an
- object specified.
-
-Tue Jan 10 14:30:30 1995 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (get_member_function_from_ptrfunc): Use ptrdiff_type_node
- for things that have to be added to pointers, not size_type. Cures
- problems with pointer to members on Alphas.
- (build_binary_op_nodefault): Likewise.
- (get_delta_difference_: Likewise.
- (build_ptrmemfunc): Likewise.
-
-Tue Jan 10 01:49:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (pushtag): Stick the new decl in TYPE_NAME before pushing
- it.
-
- * typeck.c (build_component_ref): Don't build up a COMPONENT_REF
- when dealing with overloaded member functions; just act like
- build_offset_ref.
- (commonparms): Remove misleading comment.
-
- * decl.c (duplicate_decls): Complain about repeated default
- arguments here.
- (redeclaration_error_message): Instead of here.
- (pushdecl): Complain about missing default arguments here.
- (grokparms): Instead of here.
- (lookup_name_current_level): Also match on DECL_ASSEMBLER_NAME.
- (grok_reference_init): Do not complain about missing initializer if
- declared 'extern'.
-
- * search.c (lookup_field): Don't return a TYPE_DECL if there is a
- function alternative and want_type is not set.
-
-Mon Jan 9 18:16:23 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (pushtag): Don't set TYPE_NAME to an identifier. Do push
- the decl when the type has no TYPE_NAME.
- (lookup_nested_type): Don't assume that type has TYPE_NAME set.
- (lookup_name_real): Call lookup_field with want_type =
- prefer_type.
-
- * search.c (lookup_field): Handle want_type properly in the presence
- of fields with the same name.
-
- * decl.c (set_nested_typename): Set nested name for file-scope types
- to include leading ::.
- (pushdecl): Set the nested typename if the decl doesn't have one,
- rather than if the type's canonical decl doesn't have one.
-
-Mon Jan 9 03:44:33 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (convert_for_assignment): Complain about contravariance
- violation here.
- (comp_target_types): Instead of here.
- (build_unary_op): resolve_offset_ref before checking for a valid
- type.
-
- * spew.c (yylex): Decrement looking_for_typename after we see a
- _DEFN.
-
- * decl.c (pushdecl): Don't install an artificial TYPE_DECL in
- IDENTIFIER_LOCAL_VALUE if we already have a decl with that name.
-
- * typeck.c (convert_for_assignment): Converting pointers to bool
- does not need a cast.
-
-Sun Jan 8 18:16:45 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (instantiate_type): Initialize nsubsts parm.
-
- * pt.c (do_function_instantiation): Likewise.
-
-Sat Jan 7 14:37:05 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (tsubst): Use TREE_STATIC instead of DECL_INLINE &&
- DECL_SAVED_INSNS to determine whether or not we've seen a definition
- of this function.
- (instantiate_template): Likewise.
-
- * call.c (convert_harshness): Allow const reference binding when
- called from the overloading code, but not when called from
- can_convert (since it isn't a conversion).
- (convert_harshness): Put back some disabled code.
-
-Fri Jan 6 14:10:57 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (convert_harshness): There is no implicit conversion from
- void* to other pointer types (unless the parameter is (void*)0).
- (convert_harshness): Non-lvalues do not convert to reference types.
-
- * class.c (finish_struct_methods): Still set
- TYPE_HAS_{INT,REAL}_CONVERSION.
-
- * call.c (can_convert): Don't use aggregate initialization.
-
- * cp-tree.h: Declare lookup_conversions.
-
-Thu Jan 5 21:08:00 1995 Mike Stump <mrs@cygnus.com>
-
- * parse.y (simple_stmt): Fix duplicate case value error messages to
- be more readable.
-
-Wed Jan 4 16:44:19 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cvt.c (build_type_conversion): Total rewrite to use
- convert_harshness instead of reproducing conversion logic here. Now
- much shorter.
-
- * call.c (convert_harshness): Support conversions to bool.
- (can_convert): Checks whether a conversion is less harsh
- than USER_CODE, for build_type_conversion.
-
- * search.c (add_conversions): Function for passing to dfs_walk which
- adds all the type conversion operators in the current type to a list.
- (lookup_conversions): Calls dfs_walk with add_conversions and return
- the list.
- (dfs_walk): Don't require a qfn.
-
- * cp-tree.h: Lose CLASSTYPE_CONVERSIONS hackery.
- (CLASSTYPE_FIRST_CONVERSION): Points to elt 1 of CLASSTYPE_METHOD_VEC.
-
- * class.c (finish_struct_bits): Lose CLASSTYPE_CONVERSIONS hackery.
- (grow_method): A separate function for building onto the growing
- method vector.
- (finish_struct_methods): Use it. Put all type conversion operators
- right after the constructors. Perhaps we should sort the methods
- alphabetically?
-
-Mon Jan 2 14:42:58 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_method_call): Lose another misleading shortcut.
-
-Fri Dec 30 17:57:30 1994 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_bltn_desc): Handle bool as a built-in type.
-
-Fri Dec 30 14:20:21 1994 Mike Stump <mrs@cygnus.com>
-
- * tree.c (layout_vbasetypes): Ensure that we don't loose alignment
- on the complete type because of small virtual bases.
-
-Fri Dec 30 12:22:29 1994 Mike Stump <mrs@cygnus.com>
-
- * decl.c (n_incomplete): Bump n_incomplete up to int to match C
- front end.
- (pushdecl): Also count decls pushed that are of a type being defined
- as incomplete things.
- * class.c (finish_struct): Move hack_incomplete_structures up to
- just after we set it as not being defined, so that the decls we
- build for RTTI don't count as incomplete.
-
-Thu Dec 29 18:20:57 1994 Mike Stump <mrs@cygnus.com>
-
- * pt.c (tsubst): Fix problem with defining constructors in templated
- classes with virtual bases.
-
-Wed Dec 28 08:31:00 1994 Mike Stump <mrs@cygnus.com>
-
- * parse.y (TYPEID): Strip top-level cv-qualifiers on typeid
- expressions.
- * gc.c (build_typeid): Likewise.
-
-Thu Dec 22 17:26:33 1994 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_up_reference): Fix breakage introduced on Nov 29,
- don't assert on complex AGGR inits.
-
-Thu Dec 22 14:32:31 1994 Mike Stump <mrs@cygnus.com>
-
- * method.c (build_overload_value): Handle pointer to members as
- template arguments.
-
-Thu Dec 22 13:09:07 1994 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (unary_complex_lvalue): Don't call sorry if we know how
- to do take the address of a data member for a pointer to data
- member.
-
-Thu Dec 22 10:04:19 1994 Mike Stump <mrs@cygnus.com>
-
- * decl.c (grokdeclarator): Use the typedef name for linkage if the
- type doesn't otherwise have a name.
-
- * decl2.c (grokfield): Likewise.
-
- * class.c (finish_struct): Since we reuse the TYPE_DECL for the
- DECL_NAME of enums, structs and classes, we have to avoid trying to
- put it in the TYPE_FIELDS again.
-
-Wed Dec 21 11:07:05 1994 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (check_classfn): Ignore this parameter on static functions
- when checking to see if we match.
-
-Tue Dec 20 17:47:02 1994 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (unary_complex_lvalue): Handle address of non-left most
- pointers to members by calling get_delta_difference.
-
-Mon Dec 19 22:40:53 1994 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (check_classfn): Don't use decls_match yet, as it modifies
- static functions to early.
-
-Thu Dec 19 22:37:48 1994 Mike Stump <mrs@cygnus.com>
-
- * method.c (make_thunk): Handle encoding of positive thunk offsets.
-
-Sat Dec 17 13:29:50 1994 Doug Evans <dje@canuck.cygnus.com>
-
- * Make-lang.in (.PHONY): Tell GNU make C++ and c++ are phony targets.
-
-Thu Dec 15 16:32:12 1994 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (check_classfn): Use decls_match to check if this has
- already been declared, as the DECL_ASSEMBLER_NAME may have been
- changed via asm("new_name").
- * decl.c (decls_match): Make public.
-
-Thu Dec 15 15:17:55 1994 Mike Stump <mrs@cygnus.com>
-
- * *.[chy] (expand_aggr_init) Add fourth argument to handle
- distinction between = init and (init) style of initializations.
- * *.[chy] (finish_decl): Add fifth argument to to handle
- distinction between = init and (init) style of initializations.
-
-Tue Dec 13 19:16:05 1994 Mike Stump <mrs@cygnus.com>
-
- Fix some random `explicit' bugs.
-
- * cvt.c (convert_to_reference): Add third parameter to
- convert_force.
- (convert_force): Likewise.
- * call.c (build_method_call): Likewise.
- * decl2.c (setup_vtbl_ptr): Likewise.
- * init.c (expand_virtual_init): Likewise.
- (build_member_call): Likewise.
- (build_delete): Likewise.
- (build_vbase_delete): Likewise.
- * typeck.c (build_component_addr): Likewise.
- (build_c_cast): Likewise.
- (build_modify_expr): Likewise.
- * cp-tree.h (CONV_NONCONVERTING): Likewise. Add so that we can
- distinguish the context in which the conversion appears. Add thrid
- argument to build_c_cast.
- * cvt.c (cp_convert): Pass whether or not we want to consider
- non-converting constructors down to build_method_call.
- * decl2.c (reparse_absdcl_as_casts): Add third argument to
- build_c_cast.
- * gc.c (build_m_desc): Likewise.
- * init.c (build_new): Likewise.
- * parse.y (expr_no_commas): Likewise.
- (primary): Likewise.
- * typeck.c (build_x_function_call): Likewise.
- (build_static_cast): Likewise.
- (build_reinterpret_cast): Likewise.
- (build_const_cast): Likewise.
- (build_c_cast): Likewise.
- (build_ptrmemfunc): Likewise.
- * typeck2.c (build_functional_cast): Likewise.
- * init.c (expand_aggr_init): Added LOOKUP_ONLYCONVERTING to
- expand_aggr_init_1 as inits are converted to the destination type.
-
-Tue Dec 13 16:18:57 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * Make-lang.in (cc1plus): Depends on c-pragma.o.
-
- * Makefile.in (OBJ{DEP,}S): Add ../c-pragma.o.
-
- * lex.c (check_newline): If the #pragma is not recognized by g++,
- try machine-specific ones too.
- (handle_sysv_pragma): Copied from c-lex.c.
-
-Mon Dec 12 23:53:06 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Fix Dec 6th change, build_new likes a
- reference better.
-
-Mon Dec 12 18:01:00 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_binary_op): Lose checks on TYPE_PTRMEMFUNC_P with
- IS_AGGR_TYPE, since now they will not both be set on the same type.
-
- * pt.c (do_pending_expansions): Don't clear TREE_PUBLIC on
- instantiations controlled by -fexternal-templates.
-
- * decl.c (duplicate_decls): Don't complain about different values of
- __attribute__ ((const)) and ((noreturn)).
-
-Fri Dec 9 18:17:37 1994 Doug Evans <dje@cygnus.com>
-
- * Makefile.in (BISONFLAGS): Delete --yacc.
- (PARSE_H): Depend on $(PARSE_C), for parallel makes.
- (PARSE_C): Undo last patch.
-
-Fri Dec 2 10:44:36 1994 Mike Stump <mrs@cygnus.com>
-
- * Makefile.in (BISONFLAGS): Add --yacc so that output winds up in
- y.tab.c.
-
-Thu Dec 8 17:39:46 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (finish_decl): Don't call obscure_complex_init for decls
- of indeterminate size.
-
-Wed Dec 7 16:49:22 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (obscure_complex_init): Function to tweak the decl to
- prevent expand_decl from tring to initialize it.
- (finish_decl): Use it rather than writing the same code in three
- different places.
-
- * parse.y (bad_parm): Stop trying to support parms without types.
-
-Wed Dec 7 12:06:56 1994 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (grokfield): Make asm specs on static member functions
- work.
-
-Tue Dec 6 15:43:20 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_throw): Make a copy of the thrown object.
-
-Tue Dec 6 14:16:34 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * parse.y: : has lower precedence than =.
-
-Tue Dec 6 12:46:17 1994 Mike Stump <mrs@cygnus.com>
-
- * decl.c (pushdecl): Use DECL_NAME of VAR_DECLs to avoid namespace
- manglings.
- (grokvardecl): Add namespace into variable name.
-
-Tue Dec 6 11:26:55 1994 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (current_namespace_id): New routine to transform a simple
- name into a name in a namespace.
- * decl.c (grokdeclarator): Use it.
- * decl2.c (get_namespace_id): Find the name of the current
- namespace.
- (push_namespace, pop_namespace): Complete out missing
- functionality.
-
-Mon Dec 5 17:11:51 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * class.c (finish_struct): Don't use LONG_LONG_TYPE_SIZE, as it may
- not be defined. Fix warning message for enums and restore warning
- for non-enums.
-
- * decl2.c (push_namespace): Dummy function.
- (pop_namespace): Likewise.
- (do_namespace_alias): Likewise.
- (do_using_decl): Likewise.
- (do_using_directive): Likewise.
-
- * parse.y: New token NSNAME for namespace names.
- (extdef): Add namespace, using definitions.
- (using_decl): New rule for using declarations.
- (any_id): New rule for identifiers with any degree of scoping.
- (identifier): Add NSNAME.
- (notype_identifier): Likewise.
- (component_decl): Add using_decl.
- (nested_name_specifier): Add NSNAME SCOPE.
-
- * typeck.c (convert_for_assignment): Handle conversions between
- enums and bool.
-
- * decl.c (duplicate_decls): Only propagate DECL_MAIN_VARIANT on
- FUNCTION_DECLs.
-
-Mon Dec 5 13:03:16 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct): Give an error if one tries to declare a
- bit-field's size greater than a long long, as the backend will dump.
- It is not an error to declare an enum bit-field greater than its
- precision. Warn if an enum bit-field is too small to hold all
- its values.
-
-Mon Dec 5 11:41:50 1994 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (convert_for_assignment): Use cp_convert instead of
- convert so that we don't get static casts.
-
-Sun Dec 4 11:59:01 1994 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (cp_convert): Don't complain about int->enum conversion if
- we are doing static casts.
-
-Fri Dec 2 18:32:41 1994 Mike Stump <mrs@cygnus.com>
-
- * error.c (dump_expr): Do something more intelligent with SAVE_EXPRs
- when dumping expressions in error messages.
-
-Fri Dec 2 17:04:27 1994 Mike Stump <mrs@cygnus.com>
-
- * gc.c (build_dynamic_cast): Change interface to libg++, ensure that
- the return type is the right type, and make references work.
-
-Fri Dec 2 16:36:43 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (poplevel): Don't be confused by function-scope
- declarations of non-nested functions.
- (duplicate_decls): Propagate DECL_MAIN_VARIANT.
- (pushdecl): Use duplicate_decls to copy info from old decl into new
- function-scope one rather than doing it here.
-
- * decl2.c (mark_inline_for_output): Deal with the DECL_MAIN_VARIANT
- of this decl, in case this is a function-scope declaration.
-
- * decl.c (finish_enum): Make sure that the type has the right
- precision when we call fixup_*_type.
-
-Tue Nov 29 19:12:07 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cvt.c (build_up_reference): Strip superfluous NOP_EXPRs; we do
- want to build up references to rvalues if possible.
- (cp_convert): Stick on a NOP_EXPR when converting to the same type.
-
-Tue Nov 29 11:28:59 1994 Mike Stump <mrs@cygnus.com>
-
- * parse.y (maybe_raises): Handle throw ().
- * parse.y (ansi_raise_identifier): grok type-ids in exception
- specifications.
- * tree.c (build_exception_variant): Use list compare to check if
- two exception specifications match.
- * decl.c (duplicate_decls, bad_specifiers): Enhance wording on error
- messages.
- * call.c (build_method_call): Remove TREE_RAISES.
- * cvt.c (convert_to_aggr): Likewise.
- * typeck.c (build_function_call_real, convert_arguments): Likewise.
- * init.c (expand_aggr_init_1): Likewise.
-
-Tue Nov 29 09:50:39 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c: Add support for m68k and mips exception handling
- support.
-
-Tue Nov 29 08:48:33 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_end_all_catch): Throw into outer context, if we
- fall off end of catch handlers.
-
-Mon Nov 28 16:44:41 1994 Mike Stump <mrs@cygnus.com>
-
- * Makefile.in: Make is easier to decide where parse.[ch] will be
- built.
-
-Thu Nov 17 20:11:24 1994 Doug Evans <dje@cygnus.com>
-
- * cp/Make-lang.in (CXX_INSTALL_NAME) Use program_transform_name.
- (GXX_INSTALL_NAME) Likewise.
- (CXX_CROSS_NAME) Use program_transform_cross_name.
- (GXX_CROSS_NAME) Likewise.
- (c++.install-man): Use program_transform_name on g++.1.
- (c++.uninstall): Likewise.
-
-Mon Nov 28 13:53:03 1994 Mike Stump <mrs@cygnus.com>
-
- * parse.y (THROW): Fix precedence of throw expressions.
-
-Mon Nov 28 13:15:16 1994 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_unary_op): Allow promotions from bool to int on
- unary ~.
-
-Sun Nov 27 00:16:21 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * method.c (build_overload_name): Use DECL_ASSEMBLER_NAME for
- classes when appropriate.
- (build_overload_nested_name): When dealing with a function context,
- use ASM_FORMAT_PRIVATE_NAME to tweak the name of the function to
- avoid conflicts between local classes of the same name.
-
-Wed Nov 23 17:59:42 1994 Mike Stump <mrs@cygnus.com>
-
- * gxx.gperf, parse.y, lex.h, hash.h, lex.c (init_lex), delc.c
- (duplicate_decls, grokdeclarator), cp-tree.h: Add support for
- `explicit'.
- * cvt.c (convert_to_reference, cp_convert, build_type_conversion_1,
- build_type_conversion): Use LOOKUP_ONLYCONVERTING in
- build_method_calls so that non-converting constructors are not used.
- * call.c (build_method_call): If we shouldn't use a non-converting
- constructor, then don't.
-
-Wed Nov 23 14:46:56 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_method_call): Don't try to synthesize methods yet.
-
-Tue Nov 22 12:45:21 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (push_template_decls): Create CONST_DECLs for template
- constant parameters, not VAR_DECLs.
-
-Sat Nov 19 15:28:31 1994 Jim Wilson <wilson@chestnut.cygnus.com>
-
- * typeck.c (build_binary_op_nodefault): Can shorten shift only if
- shift count is less than size in bits of arg0.
-
-Thu Nov 17 15:30:50 1994 Mike Stump <mrs@cygnus.com>
-
- * gxx.gperf, hash.h, lex.c (init_lex, real_yylex), parse.y: Add new
- ANSI keywords and, and_eq, bitand, bitor, explicit, namespace, not,
- not_eq, or, or_eq, typename, using, xor, xor_eq to g++. Still need
- to add support for explicit, namespace, typename, and using, support
- for the rest is already in.
-
-Fri Nov 4 19:04:18 1994 Mike Stump <mrs@cygnus.com>
-
- * gc.c (get_bad_cast_node): New routine to support compile time
- throws of bad_cast.
- * gc.c (build_dynamic_cast): Support throwing of bad_cast at compile
- time.
-
-Fri Nov 4 11:12:00 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c: Add hppa support.
-
-Fri Nov 4 10:50:50 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c: Add rs6000 support.
-
-Thu Nov 3 14:24:23 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c (do_unwind): Add i[34]86 support.
-
-Thu Nov 3 00:10:46 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (do_pending_expansions): Unset TREE_PUBLIC on implicit
- instantiations.
-
-Wed Nov 2 15:08:24 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * decl.c (finish_function): Emit types used in method parameters
- into symbol table.
-
-Wed Nov 2 15:05:47 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (process_template_parm): Allow pointer to member function
- template parameter types.
- (uses_template_parms): Handle pointer to member function
- CONSTRUCTORs.
-
- * g++.c (main): Cast first argument of bzero to (char *).
- Pass -lstdc++ instead of -lg++ unless we are invoked as 'g++'.
-
-Mon Oct 31 14:50:48 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * gc.c (build_dynamic_cast): rewrite to make it work.
- * class.c (finish_vtbls): build more vtables if flag_rtti is on.
- * class.c (modify_all_direct_vtables): ditto.
- * init.c (expand_direct_vtbls_init): expand more vtables if
- flag_rtti is on.
- * decl.c (init_type_desc): add default return.
-
-Tue Oct 25 17:13:09 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * tree.c (debug_binfo): get rid of the initial size entry of
- vtable.
- * cp-tree.h: change flag_dossier to flag rtti, define type
- descriptor type nodes.
- * decl.c (init_type_desc): new function to initialize type
- descriptor type nodes.
- * decl.c (record_builtin_type): change flag_dossier to flag_rtti.
- * lex.c (init_lex): ditto.
- * decl.c : change variable flag_dossier to flag_rtti.
- * decl.c (duplicate_decls): get rid initial size entry of vtable.
- * decl.c (hack_incomplete_structures): take out assert 164.
- * search.c (get_abstract_virtuals_1): ditto.
- * search.c (dfs_init_vbase_pointers): change CLASSTYPE_DOSSIER to
- CLASSTYPE_RTTI.
- * parse.y: ditto.
- * class.c (prepare_fresh_vtable): for virtual bases, get right
- offset.
- * class.c (add_virtual_function): change flag_dossier to
- flag_rtti.
- * class.c (modify_one_vtable): modify the right rtti entry.
- * class.c (override_one_vtable): get rid of size entry.
- * class.c (finish_struct): change flag_dossier to flag_rtti, and
- build extra vtables, build type descriptors for polymorphic
- classes.
- * gc.c (build_headof): make headof() works correctly with new
- rtti.
- * gc.c (build_typeid): make this function work with new rtti.
- * gc.c (get_typeid): make this function work with new rtti.
- * gc.c (build_bltn_desc): new function for new rtti.
- * gc.c (build_user_desc): ditto.
- * gc.c (build_class_desc): ditto.
- * gc.c (build_ptr_desc): ditto.
- * gc.c (build_attr_desc): ditto.
- * gc.c (build_func_desc): ditto.
- * gc.c (build_ptmf_desc): ditto.
- * gc.c (build_ptmd_desc): ditto.
- * gc.c (build_t_desc): ditto.
- * gc.c : comment out old build_t_desc, build_i_desc, build_m_desc.
-
-Tue Oct 25 13:37:41 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (convert_harshness): Check for TREE_UNSIGNED differences
- after checking for integral conversions.
-
-Wed Nov 30 19:13:50 1994 Mike Stump <mrs@cygnus.com>
-
- * Version 2.6.3 released.
-
-Thu Nov 17 10:56:50 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck2.c (build_m_component_ref): Check the basetype of the
- member pointer against the main variant of the object type.
-
-Mon Nov 14 14:21:52 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cvt.c (convert_to_reference): Make sure that the original expr
- gets its type back when converting a reference.
-
- * method.c (build_overload_name): Clear numeric_outputed_need_bar here.
- (build_decl_overload): Instead of here.
-
-Tue Nov 8 17:11:24 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cvt.c (cp_convert): Don't build a TARGET_EXPR if we're not in a
- function.
-
- * typeck.c (convert_for_initialization): Handle initialization from
- a TARGET_EXPR.
-
-Sun Nov 6 01:34:24 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (lookup_nested_type_by_name): Fix list-walking logic.
- (tsubst): When replacing a TEMPLATE_TYPE_PARM, propagate
- TYPE_READONLY and TYPE_VOLATILE from the argument.
- (unify): When unifying with a TEMPLATE_TYPE_PARM, remove cv-quals
- present in parm from arg.
- (type_unification): Strip REFERENCE_TYPE from the argument type.
- (unify): Don't strip REFERENCE_TYPE from the argument type.
-
-Sat Nov 5 22:42:15 1994 Greg McGary <gkm@magilla.cichlid.com>
-
- * pt.c (do_type_instantiation): Check to see if there's a
- IDENTIFIER_TEMPLATE on a class before calling
- instantiate_member_templates().
-
-Sat Nov 12 06:35:42 1994 Mike Stump <mrs@cygnus.com>
-
- * Version 2.6.2 released.
-
-Thu Nov 3 18:48:19 1994 Paul Eggert <eggert@twinsun.com>
-
- * Makefile.in (spew.o, lex.o, pt.o):
- Depend on $(srcdir)/parse.h, not parse.h.
-
-Tue Nov 1 19:19:41 1994 Mike Stump <mrs@cygnus.com>
-
- * Version 2.6.1 released.
-
-Sun Oct 23 13:19:55 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c: Declare flag_access_control.
- (struct lang_f_options): Add access-control.
- * expr.c (cplus_expand_expr, NEW_EXPR): Unset flag_access_control
- for the call to expand_aggr_init to copy the object out of the
- pcc_struct_return slot.
- * search.c (compute_access): if (!flag_access_control) return
- access_public.
-
-Fri Oct 21 00:32:54 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * lex.c (cons_up_default_function): Don't try to defer method
- synthesis now.
-
- * decl.c (init_decl_processing): Use __pure_virtual for abort_fndecl
- instead of abort, since the OSF/1 dynamic linker doesn't like to see
- relocation entries for abort.
-
- * tree.c (array_type_nelts_total): Use sizetype, not
- integer_type_node.
- (array_type_nelts_top): Likewise.
-
-Thu Oct 20 15:48:27 1994 Mike Stump <mrs@cygnus.com>
-
- * decl.c (grokdeclarator): Added handling for catch parameters
- (CATCHPARM).
- * except.c (expand_start_catch_block): Use the new CATCHPARM context
- instead of NORMAL.
- * except.c (expand_throw): Don't let convert_to_reference complain
- about what we are doing.
-
-Thu Oct 20 12:55:24 1994 Jim Wilson <wilson@cygnus.com>
-
- * method.c (emit_thunk): Call instantiate_virtual_regs.
-
-Wed Oct 19 14:15:33 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_exception_blocks): Make sure throw code doesn't
- get put in function that won't be output.
-
-Mon Oct 17 18:03:15 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (init_decl_processing): Make alloca a builtin.
-
-Thu Oct 27 21:10:25 1994 Craig Burley <craig@burley>
-
- * g++.c (main): Only decrement "added" and set "library" to
- NULL when "library" != NULL (just like 940829 fix).
-
-Mon Oct 17 15:56:11 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c (expand_start_catch_block): Make sure the false label
- gets onto the permanent obstack, as it is used for the exception
- table.
-
-Fri Oct 14 18:54:48 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (modify_one_vtable): Since the DECL_CONTEXT of fndecl can
- be set just below, use current_fndecl instead.
-
-Fri Oct 14 15:12:22 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * init.c (expand_aggr_vbase_init_1): Don't call expand_aggr_init_1
- with LOOKUP_SPECULATIVELY.
- (expand_default_init): Abort if build_method_call returns NULL_TREE.
-
- * typeck.c (build_modify_expr): Don't just build a MODIFY_EXPR if
- the rhs is a TARGET_EXPR.
-
- * parse.y (left_curly): Anonymous types are not affected by #pragma
- interface/implementation.
-
- * method.c (synthesize_method): Don't call setup_vtbl_ptr for the
- default constructor if it isn't needed.
-
- * lex.c (cons_up_default_function): Do synthesize methods for
- anonymous types if necessary.
-
-Thu Oct 13 17:44:55 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * method.c (build_decl_overload): Set numeric_outputed_need_bar to 0.
-
-Wed Oct 12 13:27:57 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * typeck.c (build_modify_expr): Understand how to copy an aggregate.
-
- * init.c (expand_default_init): Likewise. Also remove some of the
- crufty code that assumes methods will not be synthesized properly.
-
- * lex.c (cons_up_default_function): If the containing type has no
- name, these functions should never need to be called, so just
- declare them.
-
- * lex.c (real_yylex): Use HOST_BITS_PER_WIDE_INT to determine the
- bitmask for lexing character constants.
-
- * call.c (build_method_call): Disable code that tries to do tricky
- stuff with a default parameter that is a constructor call, but
- actually does other tricky stuff that breaks things.
-
-Wed Oct 12 16:14:01 1994 Benoit Belley <belley@cae.ca>
-
- * decl.c (finish_enum): Disable code which forces enums to be signed,
- since this conflicts with their use as bitfields. type_promotes_to
- handles promotion of enums of underlying unsigned types to signed
- integer types.
-
-Wed Oct 12 13:24:03 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * cvt.c (type_promotes_to): Also promote enums to long if
- appropriate.
-
- * typeck.c (default_conversion): Don't expect type_promotes_to to
- return a main variant.
-
-Wed Oct 12 12:19:45 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_scoped_method_call): Don't lose side effects in the
- object expression when calling a non-existent destructor.
-
-Fri Sep 2 19:05:21 1994 Rohan Lenard <rjl@iassf.easams.com.au>
-
- * call.c (build_scoped_method_call): Remove erroneous error message
- when destructor call is written as a scoped call.
-
-Tue Oct 11 23:48:31 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * various: Cast pointer arguments to bzero and bcopy to char *.
-
-Tue Oct 11 19:34:32 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (get_derived_offset): Added a type parameter to limit how
- far up the CLASSTYPE_VFIELD_PARENT chain we search.
- * class.c (modify_one_vtable, fixup_vtable_deltas): When forming the
- offset to put into the vtable for the this parameter, make sure we
- don't offset from a parent of the DECL_CONTEXT of the function.
-
-Tue Oct 11 16:10:52 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * pt.c (do_function_instantiation): Set DECL_EXTERNAL and
- TREE_STATIC when setting DECL_INTERFACE_KNOWN.
- (do_type_instantiation): Likewise.
-
- * lex.c (cons_up_default_function): Set DECL_INTERFACE_KNOWN,
- DECL_EXTERNAL and TREE_STATIC as appropriate.
-
- * decl2.c (finish_file): Also synthesize methods that don't have
- DECL_EXTERNAL set. Set interface_unknown before doing so.
-
- * decl.c (start_function): If DECL_INTERFACE_KNOWN is set on the
- function decl, don't muck with TREE_PUBLIC and DECL_EXTERNAL.
-
-Mon Oct 10 00:56:53 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * lex.c (cons_up_default_function): Mark methods in a template class
- as template instances. Store the values of interface_unknown and
- interface_only for do_pending_inlines.
- (do_pending_inlines): Use them.
-
- * decl2.c (finish_file): If we haven't seen a definition of a
- function declared static, make the decl non-PUBLIC so compile_file
- can give an error.
-
-Sun Oct 9 02:42:29 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * method.c (do_build_copy_constructor): Handle anonymous unions.
- (do_build_assign_ref): Likewise.
- (largest_union_member): Move from lex.c.
-
-Sat Oct 8 14:59:43 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- Re-implement g++'s vague linkage independent of TREE_PUBLIC.
- * pt.c (instantiate_member_templates): Lose redundant
- -fexternal-templates handling.
- (tsubst): Set TREE_PUBLIC and DECL_EXTERNAL on new decls. Don't set
- TREE_STATIC or DECL_INTERFACE_KNOWN.
- (do_pending_expansions): Predicate on DECL_INTERFACE_KNOWN instead
- of DECL_EXTERNAL for explicit instantiations.
- (do_function_instantiation): Do the new thing.
- (do_type_instantiation): Likewise.
- (instantiate_template): Deal with member templates defined in a .cc
- file with -fexternal-templates.
- * except.c (expand_exception_blocks): Use DECL_LINKAGE_KNOWN to
- decide whether to stick builtin_throw here.
- * decl2.c (import_export_inline): Predicate on DECL_INTERFACE_KNOWN
- rather than TREE_PUBLIC. Generally fix rules.
- (finish_file): Use DECL_INITIAL to determine whether or not a method
- has been synthesized, rather than TREE_ASM_WRITTEN.
- * decl.c (warn_extern_redeclared_static): Use DECL_PUBLIC instead of
- TREE_PUBLIC.
- (pushdecl): Likewise.
- (duplicate_decls): Likewise. Deal with DECL_DECLARED_STATIC and
- DECL_INTERFACE_KNOWN.
- (redeclaration_error_message): Fix checking for conflicting linkage.
- (define_function): Set DECL_INTERFACE_KNOWN.
- (grokfndecl): Function decls are PUBLIC until we are sure about
- their linkage. Set DECL_DECLARED_STATIC as needed.
- (start_function): Deal with linkage. Move pushdecl after linkage
- magic.
- (finish_function): Don't set TREE_ASM_WRITTEN on discarded inlines.
- * cp-tree.h (lang_decl_flags): Add interface_known and
- declared_static.
- (DECL_INTERFACE_KNOWN): New macro.
- (DECL_DECLARED_STATIC): New macro.
- (DECL_PUBLIC): New macro.
-
- Clean up bogus use of TREE_PUBLIC.
- * class.c (alter_access): Fix mistaken use of TREE_PUBLIC (it
- doesn't correspond to TREE_PROTECTED and TREE_PRIVATE).
- * init.c (do_friend): Don't arbitrarily set TREE_PUBLIC.
-
-Wed Oct 5 13:44:41 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * call.c (build_overload_call_real): Don't immediately do
- array->pointer conversion.
-
- * pt.c (type_unification): If not passing to a reference, strip
- cv-quals. Also handle array->pointer conversion.
-
-Tue Oct 4 17:45:37 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (grokdeclarator): Don't warn about applying const to a
- const typedef or template type parameter.
-
- * decl2.c (finish_file): Also synthesize methods after walking the
- vtables. Ugly ugly ugly.
-
-Mon Oct 3 15:02:41 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * various: Remove lingering remnants of old exception handling code.
-
- * decl2.c (finish_file): Synthesize methods before walking the
- vtables, so that the vtables get emitted as needed.
-
- * decl.c (shadow_tag): Remove obsolete code for pushing tags and
- dealing with exceptions.
-
-Mon Oct 3 13:05:27 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
-
- * Make-lang.in (g++-cross): Depend upon version.o and $(LIBDEPS).
-
-Mon Oct 3 02:59:28 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl2.c (finish_file): Fix inline handling.
-
-Sun Oct 2 00:21:56 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * decl.c (grokdeclarator): Handle redundant scope even better.
- ({push,pop}_cp_function_context): Take toplev parameter.
-
- * method.c (synthesize_method): Pass toplev parameter to
- {push,pop}_cp_function_context depending on decl_function_context
- (fndecl).
-
- * typeck.c (build_x_unary_op): Unary & on OFFSET_REFs is always the
- built-in version.
-
- * method.c (synthesize_method): Don't be confused by __in_chrg
- parameter.
-
- * class.c (popclass): Set C_C_D like start_function does.
-
- * decl.c (grokdeclarator): Handle redundant scope better.
-
- * parse.y (expr_or_declarator): Add '(' expr_or_declarator ')' rule.
- (direct_notype_declarator): Likewise.
- (complex_direct_notype_declarator): Remove it here.
-
-Sat Oct 1 21:42:18 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (resolve_offset_ref): Fix types used in resolving .*
- expressions.
-
-Sat Oct 1 15:18:49 1994 Jason Merrill <jason@phydeaux.cygnus.com>
-
- Beginnings of work to synthesize methods only when needed.
- * call.c (build_method_call): Synthesize methods as necessary
- (currently never necessary).
- * class.c (popclass): Don't try to set C_C_D here, as it'll end up
- on the wrong obstack.
- * decl.c (push_cp_function_context): Mostly copied from
- push_c_function_context.
- (pop_cp_function_context): Similarly.
- (finish_function): Reverse order of poplevel and pop_nested_class so
- that current_class_decl is restored properly.
- (start_function): Likewise.
- (finish_function): Add parameter 'nested'. Don't call
- permanent_allocation if (nested).
- * various: Pass extra parameter to finish_function.
- * decl2.c (finish_file): Reorganize end-of-file inline handling,
- synthesizing methods as necessary.
- * lex.c (cons_up_default_function): Call mark_inline_for_output.
- Only synthesize methods immediately if #pragma implementation
- (currently disabled).
- (do_pending_inlines): Call synthesize_method.
- * method.c (synthesize_method): New function; all method synthesis
- goes through here. Calls do_build_assign_ref and
- do_build_copy_constructor.
- (build_default_constructor): Remove.
- (build_dtor): Likewise.
- (build_assign_ref): Rename to do_build_assign_ref and remove stuff
- done by synthesize_method.
- (build_copy_constructor): Similarly.
-
-Thu Sep 29 16:58:52 1994 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (c_expand_return): Use magic so the backend can fixup the
- assignment into the return register, so cleanups won't clobber it.
-
-Thu Sep 29 13:08:50 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * method.c (hack_identifier): Don't call assemble_external for
- template decls.
-
- * decl.c (finish_decl): Also end temporary allocation if the decl in
- question has a type of error_mark_node.
-
-Wed Sep 28 21:45:00 1994 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (build_modify_expr): When optimizing ?: on lhs, make sure
- that if the ?: was a reference type, that the subparts will be also.
-
-Wed Sep 28 16:14:04 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * except.c (register_exception_table): Use Pmode, not PTRmode.
-
-Fri Sep 23 13:54:27 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * lex.c (do_pending_inlines): Do method synthesis after the
- pending_inlines have been reversed.
-
-Thu Sep 22 12:53:03 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl2.c (finish_file): Fix Brendan's fix: Only call
- register_exception_table if there is a non-empty exception table.
-
-Thu Sep 22 12:03:46 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl2.c (finish_file): Only do register_exception_table if
- -fhandle-exceptions is being used.
-
-Wed Sep 21 19:01:51 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * except.c (output_exception_table_entry): Simplify
- by using assemble_integer.
- (build_exception_table): Change to return a count.
- Cleanup to use standard macros, instead of hard-wired
- sparc asm format. Don't make __EXCEPTION_TABLE__ global.
- (register_exception_table): New function. Generate call to builtin.
- * decl2.c (finish_file): Call register_exception_table.
- * cp-tree.h (build_exception_table): Fix prototype.
-
-Wed Sep 21 13:20:42 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * tree.c (break_out_calls): Don't try to duplicate the DECL_INITIAL.
-
- * decl2.c (delete_sanity): Give an error at trying to delete a
- function.
-
-Wed Sep 21 11:47:10 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * lex.c (cons_up_default_function): Mark synthesized destructors
- inline.
-
- * decl.c (duplicate_decls): Ignore redeclarations of wchar_t as
- something other than __wchar_t, complaining if -pedantic and not in
- a system header.
-
-Tue Sep 20 09:43:28 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (xref_tag): Set up BINFO_INHERITANCE_CHAIN on base binfos
- here.
-
- * typeck.c (build_modify_expr): Require complete type after checking
- for error_mark_node.
-
- * call.c (build_method_call): Print parmtypes when complaining of
- ambiguous call.
-
- * typeck.c (build_modify_expr): Handle assignment to array from
- non-array.
-
- * decl.c (lookup_name_real): Deal with got_scope == error_mark_node.
-
- * call.c (build_method_call): Don't bother with the exact match.
-
-Mon Sep 19 00:51:39 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (expand_aggr_init): If we munge the type of the variable,
- also munge the type of the initializer.
-
- * decl.c (grokdeclarator): Use <= when comparing to RID_LAST_MODIFIER.
- (init_decl_processing): Push artificial declaration of wchar_t so
- people don't have to declare it before they can use it.
-
- * error.c (cp_line_of): return lineno in lieu of 0.
-
- * typeck.c (convert_for_assignment): Handle conversion of pmfs to
- int and bool.
- (build_component_ref): Fold the COMPONENT_REF in case it can be
- reduced.
-
- * typeck2.c (store_init_value): Don't pedwarn about non-constant
- bracketed initializers for automatic variables.
-
-Sun Sep 18 10:12:12 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * error.c (dump_decl): Don't say `typedef enum foo foo'.
-
- * decl.c (start_decl): Don't set TREE_PUBLIC on template decls just
- because they're affected by #pragma i/i. We'll deal with that when
- they get instantiated.
-
- * typeck.c (build_unary_op): Clean up cruft in ADDR_EXPR case.
-
- * class.c (instantiate_type): Set TREE_CONSTANT on instantiated
- ADDR_EXPRs if appropriate.
-
- * decl.c (build_ptrmemfunc_type): Unset IS_AGGR_TYPE on pmf types.
-
- * typeck.c (build_ptrmemfunc): Handle &overloaded_method as an
- initializer properly.
- * typeck2.c (digest_init): Likewise.
-
- * tree.c (cp_build_type_variant): Like c_build_type_variant, except
- it uses build_cplus_array_type.
- * *.c: Use cp_build_type_variant instead of c_build_type_variant.
-
- * pt.c (do_type_instantiation): Don't try to instantiate nested
- enums.
-
-Tue Sep 13 10:56:58 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (build_up_reference): Handle preincrement and predecrement
- properly.
-
-Tue Sep 13 09:51:59 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (finish_decl): Only lay out the rtl for DECL if it is, in
- fact, static.
-
-Mon Sep 12 14:40:30 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (finish_decl): Lay out the rtl for DECL before doing
- grok_reference_init, in case it's static.
-
-Mon Sep 12 12:45:38 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Don't synthesize constructors if the
- class has a field with the same name as the class. Don't die on
- classes with no constructors or destructors. Don't die if the head
- and tail of the class are in different files.
-
- * decl.c (grokdeclarator): Don't treat a function pointer field
- with the same name as the class as a constructor.
-
-Fri Sep 9 13:17:00 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_c_cast): Pull constant values out of their
- variables here.
-
- * decl.c (duplicate_decls): Only propagate DECL_CHAIN in
- FUNCTION_DECLs and TEMPLATE_DECLs.
-
-Thu Sep 8 10:07:48 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (duplicate_decls): Propagate DECL_CHAIN in all DECLs that
- have it.
-
- * pt.c (unify): REALs and INTEGERs only unify with their own genus.
- (instantiate_member_templates): Don't muck with DECL_EXTERNAL and
- TREE_PUBLIC unless -fexternal-templates.
-
-Wed Sep 7 13:17:10 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (do_type_instantiation): Call instantiate_member_templates.
- Deal with specializations.
- (tsubst): Don't stick the mangled name in DECL_NAME for function
- instantiations. Don't push them, either.
-
- * decl2.c (grokfield): Move code for generating the
- DECL_ASSEMBLER_NAME for static members from here.
- * method.c (build_static_name): To here.
- * decl.c (grokvardecl): Call build_static_name.
- (duplicate_decls): Keep old DECL_ASSEMBLER_NAME.
-
-Mon Sep 5 12:49:18 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): if -Wsynth, warn when selecting
- synthesized op= over user-supplied one cfront would select.
- * decl2.c (lang_decode_option): Handle -Wsynth.
-
-Fri Sep 2 15:11:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (finish_enum): Overhaul to fix several bugs.
- (start_enum): Disable useless code.
-
-Thu Sep 1 16:04:54 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (c_expand_return): Warn about returning a reference to a
- temporary.
- (convert_arguments): Increment argument counter when using default
- arguments, too.
-
-Wed Aug 31 14:29:22 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (finish_decl): If the type of decl is error_mark_node,
- don't bother trying to do anything.
-
- * typeck.c (convert_for_initialization): If the rhs contains a
- constructor call, pretend the lhs type needs to be constructed.
-
- * init.c (expand_default_init): If we stick the object inside the
- initializer, mark the initializer used.
-
-Tue Aug 30 13:50:18 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * method.c (build_assign_ref): return *this;
- (build_assign_ref): Fix base assignment order.
- (build_copy_constructor): Fix member init order.
-
-Mon Aug 29 13:54:39 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * g++.c (main): Remember to clear out SAW_SPECLANG after we see
- its argument.
-
-Sat Aug 27 09:36:03 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * method.c (build_copy_constructor): Also copy virtual bases.
-
-Fri Aug 26 17:05:15 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * lex.c (do_pending_inlines): Clear out pending_inlines before doing
- any synthesis. Also first set deja_vu on all pending_inlines.
-
- * method.c (build_assign_ref): Use build_member_call to invoke base
- operator=, rather than build_modify_expr. And use
- build_reference_type instead of TYPE_REFERENCE_TO.
- (build_copy_constructor): Use TYPE_NESTED_NAME to identify the
- basetype.
-
- * decl2.c (grokfield): Don't complain about undefined local class
- methods.
-
- * class.c (finish_struct): Don't try to synthesize methods here.
- * lex.c (do_pending_inlines): Instead, synthesize them here.
- (init_lex): Initialize synth_obstack.
- (cons_up_default_function): Stick synthesis request on
- pending_inlines.
-
-Fri Aug 26 12:24:14 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * call.c (build_method_call) [PCC_STATIC_STRUCT_RETURN]: Also
- accept an RTL_EXPR in what we're about to use for the instance,
- since anything which would end up with pcc_struct_return set
- inside cplus_expand_expr.
-
- * cp-tree.h (cons_up_default_function): Note change of prototype.
-
-Thu Aug 25 23:05:30 1994 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * class.c (finish_struct): Undid change from Aug 21 testing
- CLASSTYPE_INTERFACE and CLASSTYPE_VTABLE_NEEDS_WRITING.
- * parse.y (left_curly): Likewise, undid change from Aug 21.
- * decl.c (xref_tag): Undid change from Aug 21, set
- CLASSTYPE_INTERFACE correctly, and added comments.
-
-Thu Aug 25 00:36:31 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- Rework approach to synthesized methods; don't go through the parser
- anymore.
- * class.c (finish_struct): Use new synthesis approach.
- * lex.c (cons_up_default_function): Now just creates declaration,
- not code.
- (largest_union_member): #if 0 out.
- (default_assign_ref_body): Likewise.
- (default_copy_constructor_body): Likewise.
- * method.c (build_default_constructor): New function to synthesize X().
- (build_copy_constructor): Synthesize X(X&).
- (build_assign_ref): Synthesize X::operator=(X&).
- (build_dtor): Synthesize ~X().
-
- * error.c (cp_line_of): If we're dealing with an artificial
- TYPE_DECL, look at the type instead.
-
-Wed Aug 24 11:11:50 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (sort_member_init): Check warn_reorder.
- * decl2.c (lang_decode_option): Handle -W{no-,}reorder.
-
- * cp-tree.h (CLASSTYPE_SOURCE_LINE): New macro.
- * error.c (cp_line_of): Use CLASSTYPE_SOURCE_LINE for aggregates.
- * class.c (finish_struct): Set CLASSTYPE_SOURCE_LINE.
-
-Tue Aug 23 09:28:35 1994 Mike Stump <mrs@cygnus.com>
-
- * error.c (dump_decl): Improve wording, so that error messages
- dont't read template<, class foo>...
-
-Mon Aug 22 15:30:51 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (label_colon): Also match a TYPENAME as a label name,
- since they may have declared a class by that name but have also
- tried to have a local label under the same name.
-
- * pt.c (coerce_template_parms): Call cp_error, not cp_error_at,
- for the message so they know at what point it was instantiated.
-
-Sun Aug 21 23:07:35 1994 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * class.c (finish_struct): Move setting of CLASSTYPE_INTERFACE and
- CLASSTYPE_VTABLE_NEEDS_WRITING for signatures up to left_curly time.
- * decl.c (xref_tag): Move setting of CLASSTYPE_INTERFACE and
- CLASSTYPE_VTABLE_NEEDS_WRITING for signatures down to left_curly time.
- * parse.y (left_curly): New final resting place for setting
- CLASSTYPE_INTERFACE and CLASSTYPE_VTABLE_NEEDS_WRITING for signatures.
-
- * class.c (finish_struct): Don't test for function/field name
- conflicts in signatures, since all the fields are compiler-constructed.
-
-Fri Aug 19 14:04:47 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * method.c (build_overload_nested_name): in qualified name
- mangling, the template with value instantiation will have numeric
- at end and may mixed with the name length of next nested level.
- Add a '_' in between.
- * method.c (build_overload_name): ditto.
- * method.c (build_overload_identifier): ditto.
-
-Thu Aug 18 16:24:43 1994 Mike Stump <mrs@cygnus.com>
-
- * error.c (dump_decl): Handle NULL args.
-
-Thu Sep 29 16:15:36 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu>
-
- * g++.c: Rework last change so it's done like collect.c (and
- gcc.c).
-
-Wed Sep 14 10:17:27 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu>
-
- * g++.c: Include <sys/errno.h> in case `errno' is a macro
- as permitted by ANSI C.
-
-Thu Aug 18 12:48:09 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (finish_struct): Move setting of CLASSTYPE_INTERFACE and
- CLASSTYPE_VTABLE_NEEDS_WRITING up to left_curly time.
- * decl.c (xref_tag): Move setting of CLASSTYPE_INTERFACE and
- CLASSTYPE_VTABLE_NEEDS_WRITING down to left_curly time.
- * parse.y (left_curly): New final resting place for setting
- CLASSTYPE_INTERFACE and CLASSTYPE_VTABLE_NEEDS_WRITING.
-
-Thu Aug 11 11:32:42 1994 H.J. Lu <hjl@nynexst.com>
-
- * g++.c (main): Only decrement "added" and set "library" to
- NULL when "library" != NULL.
-
-Sat Aug 13 00:14:52 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): Don't set TREE_PUBLIC on a function decl
- just because its class has a known interface.
- (decls_match): Deal with new format of template parms.
-
- * lex.c (cons_up_default_function): Don't play with TREE_PUBLIC and
- DECL_EXTERNAL here.
-
-Fri Aug 12 01:55:15 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (pushtag): SET_DECL_ARTIFICIAL on gratuitous typedefs.
- (xref_defn_tag): Likewise.
- (pushdecl): Only allow artificial typedefs to be shadowed.
-
- * init.c (emit_base_init): Pass the right binfos to
- expand_aggr_init_1.
-
- * class.c (delete_duplicate_fields_1): Make it work right.
- (finish_struct): Catch function/field name conflict.
-
- * decl2.c (check_classfn): Pass the function to cp_error, not just
- the name.
-
- * init.c (sort_member_init): Warn when order of member initializers
- does not match order of member declarations.
- (emit_base_init): Call expand_aggr_init_1 with LOOKUP_PROTECT.
-
- * error.c (dump_expr): Handle lists of functions.
-
- * decl.c (start_function): #pragma interface only affects functions
- that would otherwise be static.
- (finish_decl): Don't warn about an unused variable if it has both
- constructor and destructor, since the 'resource allocation is
- initialization' idiom is relatively common.
-
- * typeck.c (comp_target_types): Don't handle TEMPLATE_TYPE_PARMs.
- (comp_target_parms): Likewise.
- (compparms): Never consider default parms.
- (common_base_type): Don't choose a virtual baseclass if there is a
- more derived class in common.
- (build_conditional_expr): If pedantic, pedwarn about conversion to
- common base in conditional expr.
-
- * class.c (instantiate_type): Handle template instantiation better.
-
- * typeck.c (convert_arguments): Don't try to get tricky and convert
- to int directly when PROMOTE_PROTOTYPES is set, as it breaks
- user-defined conversions.
-
- * lex.c (check_for_missing_semicolon): Also give error at end of
- file.
-
- * call.c (build_method_call): Don't promote arrays to pointers here.
-
- * typeck.c (convert_arguments): Don't require the actual parameter
- to be of a complete type if the formal parameter is a reference.
-
-Thu Aug 11 15:21:40 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): Soften 'static' on member function error
- to pedwarn.
-
- * init.c (build_new): Don't automatically save rval.
- (build_offset_ref): Do field lookup with proper basetype_path.
-
-Thu Aug 11 12:46:54 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * errfn.c (cp_silent): Declare to mark when we should avoid
- emitting warnings and errors.
- (cp_error): Check it.
- (cp_warning): Likewise.
- (cp_pedwarn): Likewise.
- (cp_compiler_error): Likewise.
- (cp_error_at): Likewise.
- (cp_warning_at): Likewise.
- (cp_pedwarn_at): Likewise.
- * call.c (compute_conversion_costs): Set CP_SILENT when we start
- out, and make sure we turn it off before we leave.
-
-Thu Aug 11 00:02:54 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (grok_array_decl): Try computing *(A+B) if neither
- argument is obviously an array.
-
-Wed Aug 10 15:32:04 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (c_expand_start_case): Do cleanups here.
-
- * parse.y (xcond): Do bool conversion here, too.
- (simple_stmt, SWITCH case): Don't do cleanups here.
-
- * decl.c (duplicate_decls): Don't treat builtins that have been
- explicitly declared specially.
-
-Tue Aug 9 01:16:09 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * tree.c (make_deep_copy): Support copying pointer, reference,
- function, array, offset and method types.
-
- * decl.c (init_decl_processing): Mark exit and abort as
- BUILT_IN_NONANSI so that duplicate_decls is kinder about
- redeclaration.
- (duplicate_decls): Don't give two errors for redeclaring a C
- function with the same parms but a different return type.
-
- * parse.y (paren_cond_or_null): Do cleanup and bool conversion here.
- (condition): Instead of here.
- (simple_stmt, SWITCH case): Also do cleanup here.
-
- * decl2.c (finish_anon_union): Only break out FIELD_DECLs.
-
- * call.c (build_method_call): Don't throw away the side effects of
- the object in a call to a non-existent constructor.
- * parse.y (primary): Likewise.
-
- * method.c (build_decl_overload): Oop.
-
- * decl2.c (lang_decode_option): Deal with flag_no_nonansi_builtin,
- warn about uselessness of specifying -fansi-overloading.
-
- * method.c (build_decl_overload): Treat any non-member new with one
- parameter as __builtin_new.
-
- * decl.c (init_decl_processing): Setup built-in meanings of exit,
- _exit and abort.
-
-Mon Aug 8 15:03:30 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * error.c (dump_readonly_or_volatile): Put a space between const and
- volatile if both apply.
-
- * init.c (perform_member_init): Clean up after this initialization.
- (emit_base_init): Clean up after each base init, not after all have
- been done.
- (expand_aggr_vbase_init_1): Clean up after this init.
-
-Sun Aug 7 14:55:05 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): Deal with destroying references.
-
- * parse.y (condition): Do bool_truthvalue_conversion here.
- (paren_expr_or_null): And here.
- (simple_if): Not here.
- (simple_stmt): Or here.
-
-Sat Aug 6 22:29:45 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (paren_expr_or_null): Wrap the expression in a
- CLEANUP_POINT_EXPR.
- (condition): Likewise.
-
-Sat Aug 6 19:46:37 1994 Rohan Lenard <rjl@easams.com.au>
-
- * call.c (build_scoped_method_call): Fix error message when
- destructor call refers to a nonexistent type.
-
-Sat Apr 16 22:43:30 1993 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * lex.h (rid): Deleted RID_RAISES, it's never used.
- Moved RID_PUBLIC, RID_PRIVATE, RID_PROTECTED, RID_EXCEPTION,
- RID_TEMPLATE and RID_SIGNATURE to the end of the enumeration,
- they don't need to be touched in `grokdeclarator.'
- (RID_LAST_MODIFIER): Defined macro to be RID_MUTABLE.
-
- * decl.c (grokdeclarator): Use RID_LAST_MODIFIER instead of
- RID_MAX as loop limit for finding declaration specifiers.
-
-Sat Apr 3 21:59:07 1993 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * lex.c (debug_yytranslate): Moved to parse.y since it needs to
- access `yytname,' which is static in parse.c.
-
-Fri Apr 2 23:36:57 1993 Gerald Baumgarnter <gb@cs.purdue.edu>
-
- * cp-tree.h (GNU_xref_ref): Fixed typo in extern declaration, it
- was `GNU_xref_def' instead of `GNU_xref_ref.'
-
-Fri Aug 5 14:20:16 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (do_function_instantiation): Don't set TREE_PUBLIC and
- DECL_EXTERNAL on 'extern' instantiations; wait until EOF to do that.
- (do_type_instantiation): Likewise.
-
- * decl2.c (import_export_inline): Decides at EOF what an inline's
- linkage should be.
- (finish_file): Call it.
-
- * decl.c (start_function): Don't rely on the settings of TREE_PUBLIC
- and DECL_EXTERNAL from do_*_instantiation. Only set
- DECL_DEFER_OUTPUT on inlines whose linkage might actually change.
- (finish_function): Use DECL_DEFER_OUTPUT to decide which inlines to
- mark for later consideration, rather than DECL_FUNCTION_MEMBER_P.
-
-Fri Aug 5 01:12:20 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (get_class_offset_1, get_class_offset): New routine to
- find the offset of the class where a virtual function is defined,
- from the complete type.
- * class.c (modify_one_vtable, fixup_vtable_deltas): Use
- get_class_offset instead of virtual_offset as get_class_offset will
- always provide the right answer.
- * tree.c (virtual_offset): Remove. It only ever worked some of the
- time.
-
-Tue Aug 2 12:44:21 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): Put back unary_complex_lvalue call
- that I thought was redundant.
-
- * typeck.c (c_expand_return): Fix a case I missed before.
-
-Sun Jul 31 17:54:02 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (unify): Strip cv-quals from template type arguments (when
- 'const T*' is matched to 'const char*', that does not mean that T is
- 'const char').
-
-Fri Jul 29 01:03:06 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (do_type_instantiation): Instantiate nested TAGS, not
- typedefs. Third time's the charm?
-
- * parse.y (template_parm): Support default template parms.
- * pt.c (process_template_parm): Likewise.
- (end_template_parm_list): Likewise.
- (coerce_template_parms): Likewise.
- (mangle_class_name_for_template): Likewise.
- (push_template_decls): Likewise.
- (unify): Likewise.
- * method.c (build_overload_identifier): Likewise.
- * error.c (dump_decl): Likewise.
-
-Wed Jul 27 17:47:00 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (do_type_instantiation): Only instantiate nested *classes*.
-
-Tue Jul 26 13:22:40 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * search.c (note_debug_info_needed): Also emit debugging information
- for the types of fields.
-
-Mon Jul 25 00:34:44 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (lookup_template_class): Pass 'template' to
- coerce_template_parms instead of 'in_decl', since it's a more
- meaningful context.
-
- * typeck.c (c_expand_return): Make sure any cleanups for the return
- expression get run.
- (build_c_cast): Use CONVERT_EXPR for conversion to void.
-
- * pt.c (do_type_instantiation): Also instantiate nested types.
-
- * typeck.c (convert_for_assignment): Don't die when comparing
- pointers with different levels of indirection.
-
- * decl.c (grokdeclarator): The sub-call to grokdeclarator for
- class-local typedefs sets DECL_ARGUMENTS, so we need to clear it
- out.
-
- * decl2.c (finish_anon_union): Don't die if the union has no
- members.
-
- * decl.c (grokdeclarator): Undo changes to declspecs when we're done
- so that 'typedef int foo, bar;' will work.
-
- * decl2.c (finish_file): Don't call expand_aggr_init for
- non-aggregates.
-
-Mon Jul 25 00:03:10 1994 Teemu Torma <tot@trema.fi>
-
- * decl.c (finish_function): We can't inline constructors and
- destructors under some conditions with -fpic, but don't unset
- DECL_INLINE.
-
-Mon Jul 25 00:03:10 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_object_ref): Make sure 'datum' is a valid object.
-
-Sun Jul 24 14:19:31 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Don't set DECL_FIELD_BITPOS on
- non-fields.
- (finish_struct_methods): Use copy_assignment_arg_p.
-
- * cvt.c (cp_convert): If expr is an OFFSET_REF, resolve it instead
- of giving an error.
-
- * typeck.c (build_binary_op_nodefault): Don't set result_type if we
- don't know how to compare the operands.
-
- * decl.c (grokdeclarator): Avoid seg fault when someone uses '__op'
- as a declarator-id in their program. Like the Linux headers do.
- Arrgh.
-
- * tree.c (lvalue_p): Treat calls to functions returning objects by
- value as lvalues again.
-
- * typeck.c (build_component_addr): Use convert_force to convert the
- pointer in case the component type is also a private base class.
-
- * search.c (get_matching_virtual): Fix bogus warning of overloaded
- virtual.
-
- * pt.c (overload_template_name): Set DECL_ARTIFICIAL on the created
- TYPE_DECL to fix bogus shadowing warnings.
-
-Fri Jul 22 01:15:32 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (expand_aggr_init_1): const and volatile mismatches do not
- prevent a TARGET_EXPR from initializing an object directly.
-
-Tue Jul 19 17:55:37 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (build_up_reference): Allow building up references to
- `this', don't warn about making references to artificial variables
- (like `this').
-
- * tree.c (lvalue_p): `this' is not an lvalue.
-
- * call.c (build_method_call): Accept using a typedef name (or
- template type parameter) for explicit destructor calls.
-
-Thu Jul 14 09:42:23 1994 Mike Stump <mrs@cygnus.com>
-
- * Version 2.6.0 released.
-
-Wed Jul 13 03:57:54 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * method.c (hack_identifier): Put back old code so lists of
- non-functions will be handled properly.
-
- * cp-tree.h (TYPE_NEEDS_CONSTRUCTING): #if 0 out; this macro is now
- defined in the language-independent tree.h.
-
- * tree.c (count_functions): Avoid bogus warning when compiling this
- function.
-
-Mon Jul 11 18:37:20 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grok_reference_init): Always save the initializer of a
- reference.
-
-Fri Jul 8 17:41:46 1994 Mike Stump <mrs@cygnus.com>
-
- * decl.c (cplus_expand_expr_stmt): Wrap statement expressions inside
- CLEANUP_POINT_EXPRs so that the stack slots can be reused.
- (disabled for now)
-
-Fri Jul 8 12:59:38 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * method.c (hack_identifier): Fix for new overloading.
-
- * typeck.c (build_binary_op_nodefault): Don't mess with division by
- zero.
-
-Fri Jul 8 13:20:28 1994 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * decl2.c (finish_file): Only call walk_sigtables, if
- flag_handle_signatures is turned on, don't waste time otherwise.
-
-Fri Jul 8 02:27:41 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (push_overloaded_decl): Don't create overloads of one when
- shadowing a class type.
- * typeck.c (build_x_function_call): Complain about overloads of one.
-
- * decl.c (grokdeclarator): Don't try to treat a char* as a tree.
- (grokdeclarator): Fix setting of TREE_STATIC.
- (start_decl): Clear DECL_IN_AGGR_P after calling duplicate_decls.
-
-Thu Jul 7 22:20:46 1994 Gerald Baumgartner <gb@andros.cygnus.com>
-
- * cp-tree.h (walk_sigtables): Created extern declaration.
- * decl2.c (walk_sigtables): Created function, patterned after
- walk_vtables, even though we only need it to write out sigtables.
- (finish_sigtable_vardecl): Created function.
- (finish_vtable_vardecl): Changed 0 to NULL_PTR.
- (finish_file): Call walk_sigtables.
-
- * sig.c (build_signature_table_constructor): Mark class member
- function pointed to from signature table entry as addressable.
-
-Thu Jul 7 13:39:37 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (start_decl): Check new decl of static member variable
- against the declaration in the class here.
- (grokvardecl): Instead of here.
-
- * class.c (prepare_fresh_vtable): Call import_export_vtable if not
- -fvtable-thunks.
- (build_vtable): Likewise.
-
- * decl2.c (import_export_vtable): Move logic for deciding the
- interface of a template class from here.
- (import_export_template): To here.
- (finish_vtable_vardecl): Call import_export_template before
- import_export_vtable.
-
-Wed Jul 6 20:25:48 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c (init_exception_processing): Setup interim_eh_hook to
- call lang_interim_eh.
- * except.c (do_unwind): Propagate throw object value across
- stack unwinding.
- * except.c (saved_throw_value): Used to hold the value of the object
- being thrown. It is always a reference to the real value.
- * except.c (expand_start_catch_block): Add handling for the
- value of the exception object.
- * except.c (expand_start_catch_block): Add handler for the handler,
- so that throws inside the handler go to the outer block.
- * except.c (expand_end_catch_block): Likewise.
- * parse.y (handler_args): Use parm instead, as the other doesn't yet
- handle references correctly.
-
-Wed Jul 6 17:55:32 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl2.c (mark_vtable_entries): If -ftable-thunks, set the
- vtable entry properly to abort.
-
-Tue Jul 5 14:07:54 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_binary_op_nodefault): Downgrade division by zero
- errors to warnings.
-
- * call.c (build_overload_call_real): Handle fnname being a list of
- functions.
- * typeck.c (build_x_function_call): Pass list of functions to
- build_overload_call, not just the name.
- * tree.c (count_functions): Complain when called for invalid
- argument.
-
- * decl.c (grokdeclarator): Fix settings of TREE_STATIC, TREE_PUBLIC
- and DECL_EXTERNAL on static members and initialized const members.
- * decl2.c (grokfield): Reflect this change.
-
-Fri Jul 1 09:35:51 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (init): ANSI C++ does not forbid { }.
-
-Thu Jun 30 00:35:22 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (lang_decode_option): Set warn_nonvdtor along with -Wall.
- warn_nonvdtor defaults to off.
-
- * class.c (instantiate_type): Use comptypes rather than relying on
- types to satisfy ==.
-
- * decl.c (start_function): Set DECL_DEFER_OUTPUT on all inlines that
- might be static.
-
- * tree.c (build_cplus_new): Never build WITH_CLEANUP_EXPRs.
-
- * decl.c (grok_reference_init): Deal with ADDR_EXPRs of TARGET_EXPRs.
-
- * cvt.c (cp_convert): Pass 0 to with_cleanup_p arg of
- build_cplus_new.
-
-Wed Jun 29 22:31:09 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (finish_file): Maybe consider static inlines multiple
- times, in case they reference each other.
-
-Tue Jun 28 11:58:38 1994 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * class.c (finish_struct): Don't `cons_up_default_function's
- for signatures.
- (finish_struct): Handle an empty method_vec correctly.
-
- * decl.c (grokdeclarator): Don't warn about a signature being
- empty in a signature pointer declaration if we only saw a
- forward declaration of the signature. Changed `warning's into
- `cp_warning's.
-
- * sig.c (build_sigtable): Don't die if a null signature table
- constructor is returned.
- (build_signature_pointer_constructor): If the signature table
- constructor is null, the _sptr field is set to a null pointer
- and cast to the appropriate type. Make copies of all null
- pointers so that the type null_pointer_node doesn't get changed.
- (build_signature_table_constructor): Added comments.
-
- * sig.c (build_signature_pointer_constructor): Complain if we
- try to assign to/initialize a signature pointer/reference of
- an undefined signature.
-
-Mon Jun 27 14:05:16 1994 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * typeck2.c (store_init_value): Don't be pedantic about
- non-constant initializers of signature tables/pointers/references.
-
-Fri Jun 24 16:49:41 1994 Gerald Baumgartner <gb@cs.purdue.edu>
-
- * decl.c (grokdeclarator): If we are grokking an opaque typedef
- in a signature, don't complain about it begin static.
-
-Wed Jun 29 16:44:45 1994 Mike Stump <mrs@cygnus.com>
-
- Fixes a problem of the this pointer being wrong in virtual calls to
- methods that are not overridden in more derived classes.
-
- * class.c (fixup_vtable_delta): New routine. It will fixup the
- delta entries in vtables, wheever they need updating.
- * class.c (finish_struct): Call the new routine for all virtual
- bases, as they can have different offsets, than those used in base
- classes that we derive our vtable from.
-
-Tue Jun 28 23:49:28 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_binary_op): Use the types before default
- conversions in the error message.
-
- * *.c: Use c_build_type_variant instead of build_type_variant where
- the type might be an array.
-
- * call.c (build_method_call): Call build_type_variant and
- build_reference_type in the right order.
- * decl.c (record_builtin_type): Likewise.
-
-Wed Jun 29 16:58:53 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): Call build_type_variant and
- build_reference_type in the right order.
- * decl.c (record_builtin_type): Likewise.
-
-Tue Jun 28 23:49:28 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_binary_op): Use the types before default
- conversions in the error message.
-
- * *.c: Use c_build_type_variant instead of build_type_variant where
- the type might be an array.
-
-Sat Jun 25 11:50:54 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (convert_to_reference): Try UDC's before doing the
- reinterpret_cast thang, though.
-
-Fri Jun 24 01:24:01 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (c_expand_return): Don't USE the return value location
- after we've expanded the jump.
-
- * decl2.c (finish_file): Make sure DECL_SAVED_INSNS is not 0 before
- trying to write out an inline.
-
- * cvt.c (build_up_reference): Also do address adjustment when the
- target type uses MI.
- (convert_to_reference): Try UDCs only after built-in conversions.
- (build_type_conversion_1): Don't play games with the argument to the
- method.
- (build_type_conversion): #if 0 out code for binding to reference.
-
-Thu Jun 23 00:22:28 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (finish_file): Use TREE_SYMBOL_REFERENCED to decide
- whether to emit inlines.
-
- * decl.c (grokdeclarator): Set explicit_int for decls that just
- specify, say, 'long'.
-
- * init.c (do_friend): Do overload C functions (or call pushdecl,
- anyaway).
-
-Wed Jun 22 13:40:49 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (build_up_reference): Don't call readonly_error.
- (convert_to_reference): Propagate const and volatile from expr to
- its type.
-
- * tree.c (lvalue_p): Random CALL_EXPRs are not lvalues.
-
- * cvt.c (build_up_reference): Break out WITH_CLEANUP_EXPR when
- creating a temporary.
- (convert_to_reference): Lose excessive and incorrect trickiness.
- (cp_convert): Call build_cplus_new with with_cleanup_p set.
-
- * typeck2.c (build_functional_cast): Likewise.
-
-Tue Jun 21 17:38:38 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): signed, unsigned, long and short all
- imply 'int'.
-
- * decl.c (grokdeclarator): Allow "this is a type" syntax.
- (grok_reference_init): Simplify and fix.
-
-Sun Jun 19 17:08:48 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): pedwarn about a typedef that specifies no
- type.
-
-Sat Jun 18 04:16:50 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (start_function): Move TREE_PUBLIC and DECL_EXTERNAL
- tinkering to after call to pushdecl.
-
-Fri Jun 17 14:48:28 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): Handle destructors for non-aggregate
- types properly.
-
-Thu Jun 16 16:48:05 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): Make sure that the name given for the
- destructor matches the constructor_name of the instance.
-
- * pt.c (do_function_instantiation): A non-extern instantiation
- overrides a later extern one.
- (do_type_instantiation): Likewise.
-
-Wed Jun 15 19:34:54 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (expand_aggr_init): Use TYPE_MAIN_VARIANT to get the
- unqualified array type.
-
- * cp-tree.h (EMPTY_CONSTRUCTOR_P): Tests whether NODE is a
- CONSTRUCTOR with no elements.
-
- * decl.c (various): Lose empty_init_node.
- (finish_decl): Use EMPTY_CONSTRUCTOR_P, do the empty CONSTRUCTOR
- thing depending on the value of DECL_COMMON instead of
- flag_conserve_space, do the empty CONSTRUCTOR thing for types that
- don't have constructors, don't treat a real empty CONSTRUCTOR
- specially.
-
- * typeck2.c (process_init_constructor): Don't treat empty_init_node
- specially.
-
-Wed Jun 15 19:05:25 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (override_one_vtable): Don't forget to merge in an old
- overrider when we wanted to reuse a vtable, but couldn't.
-
-Wed Jun 15 15:03:16 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (start_decl): Put statics in common again.
-
- * decl.c (grokdeclarator): Return NULL_TREE for an error rather than
- setting the type to error_mark_node.
-
- * typeck.c (build_modify_expr): Build up a COMPOUND_EXPR for enum
- bitfield assignments.
-
-Tue Jun 14 12:23:38 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grok_op_properties): Const objects can be passed by value.
-
-Mon Jun 13 03:10:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (import_export_vtable): Force implicit instantiations to
- be interface_only when -fno-implicit-templates.
-
- * decl.c (duplicate_decls): Redeclaring a class template name is an
- error.
-
- * pt.c (end_template_decl): Call GNU_xref_decl for class templates.
- * xref.c (GNU_xref_decl): Support templates.
-
-Sat Jun 11 17:09:05 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grok_op_properties): Split out checking for whether this
- function should suppress the default assignment operator.
- * decl2.c (grok_function_init): Likewise.
- (copy_assignment_arg_p): New function do do just that.
- Now considers virtual assignment operators that take a base as an
- argument to count as copy assignment operators.
-
- * search.c (dfs_debug_mark): Lose checks for DWARF_DEBUG and
- TREE_ASM_WRITTEN, as they are redundant.
-
- * pt.c (end_template_decl): Don't try to set DECL_CLASS_CONTEXT on a
- decl that has no LANG_SPECIFIC part.
- (do_type_instantiation): Force the debugging information for this
- type to be emitted.
-
- * decl.c (start_decl): Clear up uses of various types of templates
- (say sorry for static data members, rather than "invalid template").
- (expand_static_init): Fix initialization of static data members of
- template classes.
-
-Fri Jun 10 00:41:19 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): Set DECL_CONTEXT on static data members.
-
- * g++.c (main): Use -xc++-cpp-output for .i files.
-
- * pt.c (tsubst): Give meaningful error about declaring template for
- a copy constructor which was not declared in the class template.
- (do_type_instantiation): Explicit instantiation before the class
- template is an error.
- (instantiate_template): Don't die if tsubst returns error_mark_node.
-
-Thu Jun 9 19:04:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- Don't synthesize the copy assignment operator if the one in a base
- class is pure virtual.
- * cp-tree.h (TYPE_HAS_ABSTRACT_ASSIGN_REF): New macro to indicate
- whether the type has a pure virtual copy assignment operator.
- * class.c (finish_base_struct): Don't generate the copy assignment
- operator if a base class has a pure virtual one.
- * decl.c (grok_op_properties): Add disabled code to set
- TYPE_HAS_ABSTRACT_ASSIGN_REF with comment pointing to where it is
- actually set.
- * decl2.c (grok_function_init): Set TYPE_HAS_ABSTRACT_ASSIGN_REF.
-
- * decl2.c (import_export_vtable): Always treat template
- instantiations as if write_virtuals >= 2, and treat implicit
- instantiations as external if -fno-implicit-templates.
- (finish_file): Output all pending inlines if
- flag_keep_inline_functions.
-
-Wed Jun 8 20:48:02 1994 Mike Stump <mrs@cygnus.com>
-
- * tree.c (layout_vbasetypes): Align virtual base classes inside
- complete objects, so that we don't core dump on machines such as
- SPARCs when we access members that require larger than normal
- alignments, such as a double. Also, we bump up the total alignment
- on the complete type, as necessary.
-
-Wed Jun 8 16:18:14 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * gxxint.texi (Free Store): New section with code for examining
- cookie.
- (Limitations of g++): Remove operator delete entry, since it is no
- longer accurate. Fix access control entry.
-
- * typeck.c (build_unary_op): Pedwarn about taking the address of or
- incrementing a cast to non-reference type.
- (build_modify_expr): Use convert instead of convert_force again.
-
- * search.c (get_base_distance): Use IS_AGGR_TYPE_CODE to check for
- class type, not == RECORD_TYPE.
-
- * decl.c (grokdeclarator): Cope with grokfndecl returning NULL_TREE.
-
- * typeck2.c (report_case_error): #if 0 out.
- * lex.c (real_yylex): Lose RANGE.
- * parse.y: Likewise.
-
-Tue Jun 7 18:17:35 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (simple_stmt, case ranges): Use ELLIPSIS instead of RANGE.
-
-Mon Jun 6 19:39:57 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_c_cast): Don't shortcut conversions to the same
- type. Don't replace consts with their values here, since that's now
- done in cp_convert.
-
- * cvt.c (cp_convert): When converting to bool, take
- integer_zero_node to false_node and all other INTEGER_CSTs to
- true_node.
- (build_type_conversion): Don't complain about multiple conversions
- to float if we're not really converting.
-
-Fri Jun 3 02:10:56 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- Implement 'extern template class A<int>;' syntax for suppressing
- specific implicit instantiations.
- * cp-tree.h: Update prototypes for do_*_instantiation.
- * pt.c (do_pending_expansions): Don't compile 'extern' explicit
- instantiations.
- (do_function_instantiation): Set DECL_EXTERNAL on 'extern' explicit
- instantiations.
- (do_type_instantiation): Likewise.
- * parse.y (explicit_instantiation): Support 'extern template class
- A<int>;' syntax.
- * decl.c (start_function): Don't modify the settings of TREE_PUBLIC
- and DECL_EXTERNAL on explicit instantiations.
-
- * cvt.c (cp_convert): Replace constants with their values before
- converting.
- (cp_convert): Consistently use 'e' instead of 'expr'.
-
-Thu Jun 2 03:53:30 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck2.c (build_x_arrow): Resolve OFFSET_REFs first.
-
-Wed Jun 1 18:57:35 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck2.c (digest_init): Handle initializing a pmf with an
- overloaded method.
- * typeck.c (build_ptrmemfunc): Handle overloaded methods.
-
- * decl.c (pushtag): Use build_decl to make TYPE_DECLs.
- (xref_defn_tag): Likewise.
- * pt.c (process_template_parm): Likewise.
- (lookup_template_class): Likewise.
- (push_template_decls): Likewise.
- (instantiate_class_template): Likewise.
- (create_nested_upt): Likewise.
- * class.c (finish_struct): Don't try to set DECL_CLASS_CONTEXT on
- TYPE_DECLs.
-
- * typeck.c (convert_arguments): Make sure type is not NULL before
- checking its TREE_CODE.
-
-Wed Jun 1 17:40:39 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (get_derived_offset): New routine.
- * class.c (finish_base_struct): Make sure we set BINFO_VTABLE and
- BINFO_VIRTUALS when we choose a new base class to inherit from.
- * class.c (modify_one_vtable): Use get_derived_offset to get the
- offset to the most base class subobject that we derived this binfo
- from.
- * class.c (finish_struct): Move code to calculate the
- DECL_FIELD_BITPOS of the vfield up, as we need might need it for
- new calls to get_derived_offset in modify_one_vtable.
-
-Wed Jun 1 16:50:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (build_member_call): Use build_pointer_type instead of
- TYPE_POINTER_TO.
-
-Wed Jun 1 11:11:15 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (grokdeclarator): Make sure we have a DNAME set before we
- try to use it in an error.
-
-Wed Jun 1 09:48:49 1994 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (convert_arguments, convert_for_initialization): Don't
- strip NOP_EXPRs, when we are converting to a reference.
-
-Wed Jun 1 01:11:38 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_modify_expr): Don't dereference references when
- initializing them.
-
- * decl2.c (grokfield): Don't check for grokdeclarator returning
- error_mark_node any more.
-
- * decl.c (grokfndecl): Return NULL_TREE instead of error_mark_node.
- (start_method): Return void_type_node instead of error_mark_node.
-
- * typeck.c (build_modify_expr): Resolve offset refs earlier.
-
-Tue May 31 16:06:58 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): Resolve OFFSET_REFs in the object.
-
- * typeck.c (build_modify_expr): Dereference references before trying
- to assign to them.
-
- * call.c (build_method_call): Don't confuse type conversion
- operators with constructors.
- * typeck2.c (build_functional_cast): Just call build_c_cast if there
- was only one parameter.
- * method.c (build_typename_overload): Don't set
- IDENTIFIER_GLOBAL_VALUE on these identifiers.
- * decl.c (grok_op_properties): Warn about defining a type conversion
- operator that converts to a base class (or reference to it).
- * cvt.c (cp_convert): Don't try to use a type conversion operator
- when converting to a base class.
- (build_type_conversion_1): Don't call constructor_name_full on an
- identifier.
- * cp-tree.h (DERIVED_FROM_P): Should be self-explanatory.
-
- * decl.c (start_decl): Don't complain that error_mark_node is an
- incomplete type.
- (finish_decl): Check for type == error_mark_node.
-
-Mon May 30 23:38:55 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (start_function): Set DECL_DEFER_OUTPUT on implicit
- instantiations and inline members.
-
- * spew.c (yylex): Set looking_for_template if the next token is a '<'.
-
- * lex.h: Declare looking_for_template.
-
- * decl.c (lookup_name_real): Use looking_for_template to arbitrate
- between type and template interpretations of an identifier.
-
-Sat May 28 04:07:40 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (instantiate_template): Zero out p if we found a
- specialization.
-
- * decl.c (grokdeclarator): Elucidate warning.
- (grokdeclarator): If pedantic AND -ansi, complain about long long.
-
- Make explicit instantiation work reasonably. It is now appropriate
- to deprecate the use of -fexternal-templates.
- * pt.c (instantiate_template): Set DECL_TEMPLATE_SPECIALIZATION or
- DECL_IMPLICIT_INSTANTIATION on fndecl as appropriate.
- (end_template_instantiation): Reflect changes in USE_TEMPLATE
- semantics.
- (do_pending_expansions): if (!flag_implicit_templates) DECIDE(0);
- (do_function_instantiation): Don't set EXPLICIT_INST if
- flag_external_templates is set. Do set TREE_PUBLIC and DECL_EXTERN
- appropriately otherwise.
- (do_type_instantiation): Set interface info for class. Set
- TREE_PUBLIC and DECL_EXTERN for methods. Do none of this if
- flag_external_templates is set.
- * parse.y: Reflect changes in USE_TEMPLATE semantics.
- * decl2.c: New flag flag_implicit_templates determines whether or
- not implicit instantiations get emitted. This flag currently
- defaults to true, and must be true for -fexternal-templates to work.
- (finish_file): Consider flag_implement_inlines when
- setting DECL_EXTERNAL. Consider flag_implicit_templates when
- deciding whether or not to emit a static copy.
- * decl.c (start_function): Set TREE_PUBLIC and DECL_EXTERNAL
- properly for template instantiations.
- (start_method): Set DECL_IMPLICIT_INSTANTIATION on methods of a
- template class.
- * cp-tree.h (CLASSTYPE_USE_TEMPLATE): Change semantics.
- (DECL_USE_TEMPLATE): Parallel macro for FUNCTION and VAR_DECLs.
- (various others): Accessor macros for the above.
-
-Fri May 27 13:57:40 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_binary_op_nodefault): Division by constant zero is
- an error.
-
-Fri May 27 13:50:15 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (override_one_vtable): Don't modify things we don't own.
-
-Fri May 27 01:42:58 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (finish_decl): Don't postpone processing the initializer of
- a decl with DECL_EXTERNAL set, and do call rest_of_compilation for a
- PUBLIC const at toplevel.
- (grokdeclarator): pedwarn about initializing non-const or
- non-integral statics in the class body.
-
- * decl.c (pushtag): Don't try to set DECL_CLASS_CONTEXT on a
- TYPE_DECL.
-
- * call.c (convert_harshness): Dereference reference on rhs before
- proceeding, properly grok passing const things to non-const
- references.
-
- * typeck.c (build_unary_op): Soften error about taking the address
- of main() to a pedwarn.
-
- * lex.c (default_copy_constructor_body): Unambiguously specify base
- classes (i.e. A((const class ::A&)_ctor_arg) ).
- (default_assign_ref_body): Likewise.
-
-Thu May 26 13:13:55 1994 Gerald Baumgartner <gb@mexican.cygnus.com>
-
- * decl2.c (grokfield): Don't complain about local signature
- method declaration without definition.
-
- * call.c (convert_harshness): If `type' is a signature pointer
- and `parmtype' is a pointer to a signature, just return 0. We
- don't really convert in this case; it's a result of making the
- `this' parameter of a signature method a signature pointer.
-
- * call.c (build_method_call): Distinguish calling the default copy
- constructor of a signature pointer/reference from a signature
- member function call.
-
-Thu May 26 12:56:25 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (grokfield): Don't set TREE_PUBLIC on member function
- declarations.
-
- * decl.c (duplicate_decls): A previous function declaration as
- static overrides a subsequent non-static definition.
- (grokdeclarator): Don't set TREE_PUBLIC on inline method
- declarations.
-
-Wed May 25 14:36:38 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): Handle initialization of static const
- members.
- (finish_decl): Likewise.
-
- * decl2.c (grokfield): Allow initialization of static const members
- even when pedantic.
-
- * decl2.c (grokfield): Deal with grokdeclarator returning
- error_mark_node.
-
- * decl.c (grok_ctor_properties): Return 0 for A(A) constructor.
- (grokfndecl): Check the return value of grok_ctor_properties.
- (start_method): Likewise.
-
- * parse.y (absdcl): Expand type_quals inline.
-
-Tue May 24 19:10:32 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (pushtag): Use IS_AGGR_TYPE rather than checking for a
- RECORD_TYPE.
-
-Tue May 24 18:09:16 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * cp-tree.h (VTABLE_NAME_FORMAT): If flag_vtable_thunks,
- always use "__vt_%s".
- * decl2.c (finish_vtable_vardecl): Don't consider abstract virtuals
- when looking for a "sentinal" method (to decide on emitting vtables).
- * decl2.c (finish_file): Scan all decls for thunks that need
- to be emitted.
- * decl2.c (finish_vtable_vardecl): Don't bother calling emit_thunk.
- * method.c (make_thunk): Use a more meaningful label. If there
- exists a matching top-level THUNK_DECL re-use it; otherwise
- create a new THUNK_DECL (and declare it).
- * method.c (emit_thunk): Make thunk external/public depending
- on the underlying method.
-
-Tue May 24 00:22:04 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (tsubst): Use lookup_name_nonclass to find guiding decls, not
- lookup_name.
-
- * call.c (build_overload_call_real): Don't immediately pick a
- function which matches perfectly.
-
- * decl.c (grokdeclarator): Use c_build_type_variant for arrays.
- (grokdeclarator): Warn about, and throw away, cv-quals attached to a
- reference (like 'int &const j').
-
- * typeck.c (convert_arguments): Don't mess with i for methods.
- * call.c (build_method_call): Pass the function decl to
- convert_arguments.
-
- * typeck.c (comp_ptr_ttypes_real): New function. Implements the
- checking for which multi-level pointer conversions are allowed.
- (comp_target_types): Call it.
- (convert_for_assignment): Check const parity on the ultimate target
- type, too. And make those warnings pedwarns.
-
-Mon May 23 14:11:24 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * error.c (dump_char): Use TARGET_* for character constants.
-
-Mon May 23 13:03:03 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * tree.c (debug_no_list_hash): Make static.
-
- * decl.c (decls_match): Say the types don't match if newdecl ends up
- with a null type, after we've checked if olddecl does.
- (pushdecl): Check if the decls themselves match before looking for
- an extern redeclared as static, to avoid inappropriate and incorrect
- warnings.
-
-Fri May 20 14:04:34 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): Make warning about duplicate short, etc.
- a pedwarn.
-
- * typeck.c (build_c_cast): Casting to function or method type is an
- error.
-
- * class.c (finish_struct): Make warning for anonymous class with no
- instances a pedwarn.
-
- * Makefile.in (stamp-parse): Expect a s/r conflict.
-
- * typeck.c (build_modify_expr): pedwarn about using a non-lvalue
- cast as an lvalue.
-
-Thu May 19 12:08:48 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (type_promotes_to): Make sure bool promotes to int rather
- than unsigned on platforms where sizeof(char)==sizeof(int).
-
-Wed May 18 14:27:06 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_c_cast): Tack on a NOP_EXPR when casting to
- another variant.
- (build_modify_expr): Don't strip NOP_EXPRs, and don't get tricky
- and treat them as lvalues.
-
- * decl.c (shadow_tag): Do complain about forward declarations of
- enums and empty declarations.
- * parse.y: Don't complain about forward declarations of enums and
- empty declarations.
-
- * typeck.c (convert_for_assignment): Complain about changing
- the signedness of a pointer's target type.
-
- * parse.y (stmt): Move duplicated code for checking case values from
- here.
- * decl2.c (check_cp_case_value): To here. And add a call to
- constant_expression_warning.
-
- * typeck.c (convert_for_assignment): Don't complain about assigning
- a negative value to bool.
-
- * decl.c (init_decl_processing): Make bool unsigned.
-
- * class.c (finish_struct): Allow bool bitfields.
-
-Wed May 18 12:35:27 1994 Ian Lance Taylor <ian@tweedledumb.cygnus.com>
-
- * Make-lang.in (c++.install-man): Get g++.1 from $(srcdir)/cp.
-
-Wed May 18 03:28:35 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (build_type_conversion): Lose special handling of
- truthvalues.
-
- * search.c (dfs_pushdecls): Improve shadowing warning.
-
-Tue May 17 13:34:46 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (build_delete): Throw away const and volatile on `this'.
-
- * decl.c (finish_enum): Put the constants in TYPE_VALUES again,
- rather than the enumerators.
- (pushtag): s/cdecl/c_decl/g
-
-Mon May 16 23:04:01 1994 Stephen R. van den Berg <berg@pool.informatik.rwth-aachen.de>
-
- * cp/typeck.c (common_type): Attribute merging.
- (comp_types): Utilise COMP_TYPE_ATTRIBUTES macro.
-
- * cp/parse.y: Revamp attribute parsing.
-
-Mon May 16 01:40:34 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (shadow_tag): Also check for inappropriate use of auto and
- register.
-
- * method.c (build_overload_name): Clarify that the illegal case is a
- pointer or reference to array of unknown bound.
-
- * error.c (dump_type_prefix): Print references to arrays properly.
-
- * typeck.c (various): Be more helpful in pointer
- comparison diagnostics.
-
- * tree.c (lvalue_p): MODIFY_EXPRs are lvalues again. Isn't this
- fun?
-
- * parse.y: Also catch an error after valid stmts.
-
- * search.c (dfs_init_vbase_pointers): Don't abort because `this' is
- const.
-
- * typeck.c (convert_for_initialization): If call to
- convert_to_reference generated a diagnostic, print out the parm
- number and function decl if any.
-
- * errfn.c (cp_thing): Check atarg1 to determine whether or not we're
- specifying a line, not atarg.
-
- * tree.c (build_cplus_method_type): Always make `this' const.
-
- * decl2.c (grokclassfn): If -fthis-is-variable and this function is
- a constructor or destructor, make `this' non-const.
-
- * typeck.c (build_modify_expr): Don't warn specially about
- assignment to `this' here anymore, since it will be caught by the
- usual machinery.
-
- * various: Disallow specific GNU extensions (variable-size arrays,
- etc.) when flag_ansi is set, not necessarily when pedantic is set,
- so that people can compile with -pedantic-errors for tighter const
- checking and such without losing desirable extensions.
-
- * typeck2.c (build_functional_cast): Call build_method_call with
- LOOKUP_PROTECT.
- (process_init_constructor): Only process FIELD_DECLs.
-
- * decl.c (finish_decl): Also force static consts with no explicit
- initializer that need constructing into the data segment.
-
- * init.c (build_delete): Undo last patch, as it interferes with
- automatic cleanups.
-
-Sat May 14 01:59:31 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c, class.h, cp-tree.h, cvt.c, decl2.c: Lose old overloading
- code.
-
- * init.c (build_delete): pedwarn about using plain delete to delete
- an array.
-
-Fri May 13 16:45:07 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (comp_target_types): Be more helpful in contravariance
- warnings, and make them pedwarns.
-
- * decl.c (grokdeclarator): Use decl_context to decide whether or not
- this is an access declaration.
-
- * class.c (finish_struct_bits): Set TYPE_HAS_INT_CONVERSION if it
- has a conversion to enum or bool, too.
-
-Fri May 13 16:31:27 1994 Mike Stump <mrs@cygnus.com>
-
- * method.c (emit_thunk): Make declaration for
- current_call_is_indirect local (needed for hppa).
-
-Fri May 13 16:16:37 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (uses_template_parms): Grok BOOLEAN_TYPE.
- (tsubst): Likewise.
-
-Fri May 13 16:23:32 1994 Mike Stump <mrs@cygnus.com>
-
- * pt.c (tsubst): If there is already a function for this expansion,
- use it.
- * pt.c (instantiate_template): Likewise.
-
-Fri May 13 10:30:42 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parse.y (implicitly_scoped_stmt, simple_stmt case): Use
- kept_level_p for MARK_ENDS argument to expand_end_bindings, to avoid
- generating debug info for unemitted symbols on some systems.
-
- * cp-tree.h (build_static_cast, build_reinterpret_cast,
- build_const_cast): Add declarations.
-
-Fri May 13 09:50:31 1994 Mike Stump <mrs@cygnus.com>
-
- * search.c (expand_indirect_vtbls_init): Fix breakage from Apr 27
- fix. We now try get_binfo, and if that doesn't find what we want,
- we go back to the old method, which still sometimes fails.
-
-Fri May 13 01:43:18 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (initdcl): Call cplus_decl_attributes on the right
- variable.
- * decl2.c (cplus_decl_attributes): Don't call decl_attributes for
- void_type_node.
-
- * typeck.c (build_binary_op_nodefault): Change result_type for
- comparison ops to bool.
- (build_binary_op): Convert args of && and || to bool.
- * cvt.c (build_default_binary_type_conversion): Convert args of &&
- and || to bool.
- (build_default_unary_type_conversion): Convert arg of ! to bool.
- (type_promotes_to): bool promotes to int.
-
-Fri May 13 01:43:18 1994 Mike Stump <mrs@cygnus.com>
-
- Implement the new builtin `bool' type.
- * typeck.c (build_binary_op_nodefault): Convert args of && and || to
- bool.
- (build_unary_op): Convert arg of ! to bool.
- * parse.y: Know true and false. Use bool_truthvalue_conversion.
- * method.c (build_overload_value): Know bool.
- (build_overload_name): Likewise.
- * lex.c (init_lex): Set up RID_BOOL.
- * gxx.gperf: Add bool, true, false.
- * error.c (*): Know bool.
- * decl.c (init_decl_processing): Set up bool, true, false.
- * cvt.c (cp_convert): Handle conversion to bool.
- (build_type_conversion): Likewise.
- * *.c: Accept bool where integers and enums are accepted (use
- INTEGRAL_CODE_P macro).
-
-Thu May 12 19:13:54 1994 Richard Earnshaw <rwe11@cl.cam.ac.uk>
-
- * g++.c: Use #ifdef for __MSDOS__, not #if.
-
-Thu May 12 18:05:18 1994 Mike Stump <mrs@cygnus.com>
-
- * decl2.c (lang_f_options): Handle -fshort-temps. -fshort-temps
- gives old behavior , and destroys temporaries earlier. Default
- behavior now conforms to the ANSI working paper.
-
-Thu May 12 14:45:35 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_modify_expr): Understand MODIFY_EXPR as an lvalue.
- Use convert_force to convert the result of a recursive call when we
- are dealing with a NOP_EXPR. Don't automatically wrap MODIFY_EXPRs
- in COMPOUND_EXPRs any more.
- (various): Lose pedantic_lvalue_warning.
- (unary_complex_lvalue): Understand MODIFY_EXPR.
-
- * cvt.c (convert_to_reference): Allow DECL to be error_mark_node if
- we don't know what we're initializing.
-
-Wed May 11 01:59:36 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (convert_to_reference): Modify to use convtype parameter.
- Only create temporaries when initializing a reference, not when
- casting.
- (cp_convert): New main function.
- (convert): Call cp_convert.
- * cvt.c, decl.c, typeck.c: Fix calls to convert_to_reference.
- * cp-tree.h (CONV_*): New constants used by conversion code for
- selecting conversions to perform.
-
- * tree.c (lvalue_p): MODIFY_EXPRs are no longer lvalues.
-
- * typeck.c (build_{static,reinterpret,const_cast): Stubs that just
- call build_c_cast.
- * parse.y: Add {static,reinterpret,const}_cast.
- * gxx.gperf: Likewise.
-
- * typeck.c (common_type): Allow methods with basetypes of different
- UPTs.
- (comptypes): Deal with UPTs.
- (build_modify_expr): Wrap all MODIFY_EXPRs in a COMPOUND_EXPR.
-
- * pt.c (end_template_decl): Check for multiple definitions of member
- templates.
-
- * call.c (build_method_call): Complain about calling an abstract
- virtual from a constructor.
-
- * typeck.c (pointer_int_sum): Check for the integer operand being 0
- after checking the validity of the pointer operand.
-
- * typeck2.c (digest_init): Pedwarn about string initializer being
- too long.
-
-Tue May 10 12:10:28 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (push_overloaded_decl): Only throw away a builtin if the
- decl in question is the artificial one.
-
- * parse.y (simple_stmt, switch): Use implicitly_scoped_stmt because
- expand_{start,end}_case cannot happen in the middle of a block.
-
- * cvt.c (build_type_conversion_1): Use convert again.
-
-Tue May 10 11:52:04 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck2.c (digest_init): Make sure we check for signed and
- unsigned chars as well when warning about string initializers.
-
- * init.c (emit_base_init): Check if there's a DECL_NAME on the
- member before trying to do an initialization for it.
-
-Tue May 10 11:34:37 1994 Mike Stump <mrs@cygnus.com>
-
- * except.c: Don't do anything useful when cross compiling.
-
-Tue May 10 03:04:13 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (duplicate_decls): Fix up handling of builtins yet again.
- (push_overloaded_decl): Likewise.
-
- * cvt.c (convert): Don't look for void type conversion.
-
-Mon May 9 18:05:41 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (do_friend): Only do a pushdecl for friends, not
- pushdecl_top_level.
-
-Mon May 9 13:36:34 1994 Jim Wilson <wilson@sphagnum.cygnus.com>
-
- * decl.c (lookup_name_current_level): Put empty statement after
- the label OUT to make the code valid C.
-
-Mon May 9 12:20:57 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_binary_op_nodefault): Only complain about
- comparing void * and a function pointer if void * is smaller.
-
-Sun May 8 01:29:13 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (lookup_name_current_level): Move through temporary binding
- levels.
-
- * parse.y (already_scoped_stmt): Revive.
- (simple_stmt): Use it again.
-
- * decl.c (poplevel): Always call poplevel recursively if we're
- dealing with a temporary binding level.
-
-Sat May 7 10:52:28 1994 Mike Stump <mrs@cygnus.com>
-
- * decl.c (finish_decl): Make sure we run cleanups for initial values
- of decls. Cures memory leak.
- * decl.c (expand_static_init): Likewise for static variables.
- * decl2.c (finish_file): Likewise for globals.
-
-Sat May 7 03:57:44 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (commonparms): Don't complain about redefining default
- args.
-
- * decl.c (duplicate_decls): Don't complain twice about conflicting
- function decls.
- (decls_match): Don't look at default args.
- (redeclaration_error_message): Complain about redefining default
- args.
-
- * call.c (build_overload_call_real): Also deal with guiding
- declarations coming BEFORE the template decl.
-
- * pt.c (unify): Allow different parms to have different
- cv-qualifiers.
- (unify): Allow trivial conversions on non-template parms.
-
-Fri May 6 03:53:23 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (tsubst): Support OFFSET_TYPEs.
- (unify): Likewise.
-
- * decl2.c (finish_decl_parsing): Call push_nested_class with a type.
-
- * init.c (build_offset_ref): Fix error message.
- * search.c (lookup_field): Likewise.
-
- * call.c (build_scoped_method_call): Pass binfo to
- build_method_call.
- * typeck.c (build_object_ref): Likewise.
-
- * typeck2.c (binfo_or_else): Don't return a _TYPE.
-
- * class.c (finish_struct): Don't complain about re-use of inherited
- names or shadowing of type decls.
- * decl.c (pushdecl_class_level): Likewise.
-
- * decl.c (finish_enum): Set the type of all the enums.
-
- * class.c (finish_struct): Don't get confused by access decls.
-
- * cp-tree.h (TYPE_MAIN_DECL): New macro to get the _DECL for a
- _TYPE. You can stop using TYPE_NAME for that now.
-
- * parse.y: Lose doing_explicit (check $0 instead).
- * gxx.gperf: 'template' now has a RID.
- * lex.h (rid): Likewise.
- * lex.c (init_lex): Set up the RID for 'template'.
-
- * parse.y (type_specifier_seq): typed_typespecs or
- nonempty_type_quals. Use it.
- (handler_args): Fix bogus syntax.
- (raise_identifier{,s}, optional_identifier): Lose.
- * except.c (expand_start_catch_block): Use grokdeclarator to parse
- the catch variable.
- (init_exception_processing): The second argument to
- __throw_type_match is ptr_type_node.
-
- Fri May 6 07:18:54 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ change propagated from c-decl.c of snapshot 940429 ]
- * cp/decl.c (finish_decl): Setting asmspec_tree should not
- zero out the old RTL.
-
-Fri May 6 01:25:38 1994 Mike Stump <mrs@cygnus.com>
-
- Add alpha exception handling support to the compiler.
- Quick and dirty backend in except.c.
-
- * cp/*: Remove most remnants of old exception handling support.
- * decl.c (finish_function): Call expand_exception_blocks to put
- the exception hanlding blocks at the end of the function.
- * dec.c (hack_incomplete_structures): Make sure expand_decl_cleanup
- comes after expand_decl_init.
- * except.c: Reimplementation.
- * expr.c (cplus_expand_expr): Handle THROW_EXPRs.
- * lex.c (init_lex): Always have catch, try and throw be reserved
- words, so that we may always parse exception handling.
- * parse.y: Cleanup to support new interface into exception handling.
- * tree.def (THROW_EXPR): Add.
-
-Thu May 5 17:35:37 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (simple_stmt, for loops): Use implicitly_scoped_stmt.
- (various): Lose .kindof_pushlevel and partially_scoped_stmt.
-
-Thu May 5 16:17:27 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * parse.y (already_scoped_stmt): move expand_end_binding() to
- fix the unmatched LBB/LBE in stabs.
-
-Thu May 5 14:36:17 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (set_nested_typename): Set TREE_MANGLED on the new
- identifiers.
- (pushdecl): Check TREE_MANGLED.
- (xref_tag): Likewise.
- * cp-tree.h (TREE_MANGLED): This identifier is a
- DECL_NESTED_TYPENAME (named to allow for future use to denote
- mangled function names as well).
-
- Implement inconsistency checking specified in [class.scope0].
- * decl.c (lookup_name_real): Don't set ICV here after all.
- (finish_enum): Also set the type of the enumerators themselves.
- (build_enumerator): Put the CONST_DECL in the list instead of its
- initial value.
- (pushdecl_class_level): Check inconsistent use of a name in the
- class body.
- * class.c (finish_struct): Check inconsistent use of a name in the
- class body. Don't set DECL_CONTEXT on types here anymore.
- * parse.y (qualified_type_name): Note that the identifier has now
- been used (as a type) in the class body.
- * lex.c (do_identifier): Note that the identifier has now been used
- (as a constant) in the class body.
- * error.c (dump_decl): Print type and enum decls better.
-
-Thu May 5 09:35:35 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * typeck.c (build_modify_expr): Warn about assignment to `this'.
-
-Wed May 4 15:55:49 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (build_delete): Use the global operator delete when
- requested.
-
- * decl.c (lookup_name_real): If we find the type we're looking in a
- base class while defining a class, set IDENTIFIER_CLASS_VALUE for
- the type.
-
- * class.c (finish_struct): Remove a couple of dependencies on
- language linkage.
-
- * decl.c (pushtag): Classes do nest in extern "C" blocks.
- (pushdecl): Only set DECL_NESTED_TYPENAME on the canonical one for
- the type.
- (pushtag): Remove another dependency on the language linkage.
-
- * lex.c (cons_up_default_function): Don't set DECL_CLASS_CONTEXT to
- a const-qualified type.
-
- * decl.c (push_overloaded_decl): Throw away built-in decls here.
- (duplicate_decls): Instead of here.
-
-Wed May 4 15:27:40 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * typeck.c (get_member_function_from_ptrfunc): Do The Right
- Thing (I hope) if we're using thunks.
-
-Wed May 4 13:52:38 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (specialization): aggr template_type_name ';'.
- (named_class_head_sans_basetype): Use it.
- (explicit_instantiation): Likewise.
- (tmpl.2): Revert.
-
- * cvt.c (build_type_conversion_1): Use convert_for_initialization,
- rather than convert, to do conversions after the UDC.
-
- * cp-tree.h (SHARED_MEMBER_P): This member is shared between all
- instances of the class.
-
- * search.c (lookup_field): If the entity found by two routes is the
- same, it's not ambiguous.
-
-Wed May 4 12:10:00 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (lookup_name_real): Check for a NULL TREE_VALUE,
- to prevent the compiler from crashing ...
-
-Wed May 4 11:19:45 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): If we don't have an object, check
- basetype_path to figure out where to look up the function.
-
- * typeck.c (convert_for_initialization): Pass TYPE_BINFO (type) to
- build_method_call in case exp is NULL_TREE.
-
-Tue May 3 16:02:53 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- Give a vtable entries a unique named type, for the sake of gdb.
- * class.c (build_vtable_entry): The addres of a thunk now has
- type vtable_entry_type, not ptr_type_node.
- * method.c (make_thunk): Fix type of THUNK_DECL.
- * class.c (add_virtual_function, override_one_vtable): Use
- vfunc_ptr_type_node, instead of ptr_type_node.
- * cp-tree.h (vfunc_ptr_type_node): New macro.
- * decl.c (init_decl_processing): Make vtable_entry_type
- be a unique type of pointer to a unique function type.
-
-Tue May 3 09:20:44 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (do_explicit): Sets doing_explicit to 1.
- (explicit_instantiation): Use do_explicit rather than TEMPLATE
- directly, add "do_explicit error" rule.
- (datadef): Set doing_explicit to 0 after an explicit instantiation.
- (tmpl.2): Don't instantiate if we see a ';' unless we're doing an
- explicit instantiation.
- (named_class_head_sans_basetype): Remove aggr template_type_name
- ';' again.
-
-Mon May 2 23:17:21 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * search.c (lookup_nested_tag): Lose.
-
- * decl2.c (grokfield): Set DECL_CONTEXT on TYPE_DECLs.
- (lookup_name_nonclass): Lose.
-
- * decl.c (poplevel_class): Add force parameter.
- (lookup_name_real): Fix handling of explicit scoping which specifies
- a class currently being defined. Add 'nonclass' argument.
- (lookup_name, lookup_name_nonclass): Shells for lookup_name_real.
-
- * class.c (finish_struct): Don't unset IDENTIFIER_CLASS_VALUEs here.
- (popclass): Force clearing of IDENTIFIER_CLASS_VALUEs if we're being
- called from finish_struct.
-
-Mon May 2 19:06:21 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (init_decl_processing), cp-tree.h: Removed memptr_type.
- (It seeems redundant, given build_ptrmemfunc_type.)
- * typeck.c (get_member_function_from_ptrfunc), gc.c (build_headof,
- build_classof): Use vtable_entry_type instead of memptr_type.
- * method.c (emit_thunk): Call poplevel with functionbody==0
- to prevent DECL_INITIAL being set to a BLOCK.
-
-Mon May 2 15:02:11 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (named_class_head_sans_basetype): Add "aggr
- template_type_name ';'" rule for forward declaration of
- specializations.
-
-Mon May 2 15:02:11 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (instantiate_type): Deal with pmf's.
-
- * Make-lang.in (cc1plus): Don't depend on OBJS or BC_OBJS, since
- stamp-objlist does.
-
- * Makefile.in (../cc1plus): Depend on OBJDEPS.
- (OBJDEPS): Dependency version of OBJS.
-
-Mon May 2 12:51:31 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * search.c (dfs_debug_mark): unmark TYPE_DECL_SUPPRESS_DEBUG, not
- DECL_IGNORED_P.
-
-Fri Apr 29 12:29:56 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Clear out memory of local tags. And
- typedefs.
-
- * decl2.c (grokclassfn): Don't set DECL_CONTEXT to a cv-qualified
- type.
- * search.c (get_matching_virtual): Be more helpful in error message.
-
- * *: Use DECL_ARTIFICIAL (renamed from DECL_SYNTHESIZED).
-
- * lex.c (default_assign_ref_body): Expect TYPE_NESTED_NAME to work.
- (default_copy_constructor_body): Likewise.
-
- * class.c (finish_struct): Don't gratuitously create multiple decls
- for nested classes.
-
-Thu Apr 28 23:39:38 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- Avoid clobbering the arg types of other functions when reverting
- static member functions.
- * decl.c (revert_static_member_fn): Rearrange arguments, don't
- require values for 'fn' and 'argtypes', add warning to comment
- above.
- (decls_match): Rearrange arguments in call to rsmf.
- (grok_op_properties): Don't pass values for fn and argtypes.
- * pt.c (instantiate_template): Don't pass values for fn and argtypes.
-
-Thu Apr 28 16:29:11 1994 Doug Evans <dje@canuck.cygnus.com>
-
- * Make-lang.in (cc1plus): Depend on stamp-objlist.
- * Makefile.in (BC_OBJS): Delete.
- (OBJS): Cat ../stamp-objlist to get language independent files.
- Include ../c-common.o.
- (../cc1plus): Delete reference to BC_OBJS.
-
-Thu Apr 28 02:12:08 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * search.c (compute_access): No really, deal with static members
- properly. Would I lie to you?
-
- Implement lexical hiding of function declarations.
- * pt.c (tsubst): Use lookup_name to look for function decls to guide
- instantiation.
- * method.c (build_opfncall): Use lookup_name_nonclass to look for
- non-member functions.
- * init.c (do_friend): Use lookup_name_nonclass to look for
- functions.
- * error.c (ident_fndecl): Use lookup_name to look for functions.
- * decl2.c (lookup_name_nonclass): New function, skips over
- CLASS_VALUE.
- * decl.c (struct binding_level): Lose overloads_shadowed field.
- (poplevel): Don't deal with overloads_shadowed.
- (push_overloaded_decl): Do lexical hiding for functions.
- * class.c (instantiate_type): Don't check non-members if we have
- members with the same name.
- * call.c (build_method_call): Use lookup_name_nonclass instead of
- IDENTIFIER_GLOBAL_VALUE to check for non-member functions.
- (build_overload_call_real): Likewise.
-
- * decl.c (duplicate_decls): Check for ambiguous overloads here.
- (push_overloaded_decl): Instead of here.
-
- * decl.c (pushdecl): Back out Chip's last change.
-
- * decl.c (grok_op_properties): operators cannot be static members.
-
- * cp-tree.h (DECL_SYNTHESIZED): DECL_SOURCE_LINE == 0
- (SET_DECL_SYNTHESIZED): DECL_SOURCE_LINE = 0
- * lex.c (cons_up_default_function): Use SET_DECL_SYNTHESIZED.
-
- * method.c (do_inline_function_hair): Don't put friends of local
- classes into global scope, either.
-
- * typeck2.c (build_functional_cast): Don't look for a function call
- interpretation.
-
-Thu Apr 28 15:19:46 1994 Mike Stump <mrs@cygnus.com>
-
- * cp-tree.h: disable use of backend EH.
-
-Wed Apr 27 21:01:24 1994 Doug Evans <dje@canuck.cygnus.com>
-
- * Make-lang.in (c++.distdir): mkdir tmp/cp first.
- * Makefile.in (INCLUDES): Move definition to same place as
- parent makefile.
- (ALLOCA): Define.
- (OLDAR_FLAGS): Delete.
- (OLDCC): Define.
- (DIR): Delete.
- (CLIB): Define.
- (####site): Delete.
- (SUBDIR_USE_ALLOCA): Don't use ALLOCA if compiling with gcc.
-
-Wed Apr 27 19:10:04 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * decl.c (xref_tag): not to use strstr(), it's not available on
- all platforms.
-
-Wed Apr 27 18:10:12 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Resolve yet another class/pmf confusion.
-
- * call.c (build_overload_call_real): Don't take the single-function
- shortcut if we're dealing with an overloaded operator.
-
-Wed Apr 27 17:35:37 1994 Mike Stump <mrs@cygnus.com>
-
- * search.c (get_base_distance): Search the virtual base class
- binfos, incase someone wants to convert to a real virtual base
- class.
- * search.c (expand_indirect_vtbls_init): Use convert_pointer_to_real
- instead of convert_pointer_to, as it now will work.
-
-Wed Apr 27 15:36:49 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (convert_to_reference): Don't complain about casting away
- const and volatile.
-
- * typeck.c (build_unary_op): References are too lvalues.
-
-Wed Apr 27 13:58:05 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (override_one_vtable): We have to prepare_fresh_vtable
- before we modify it, not after, also, we cannot reuse an old vtable,
- once we commit to a new vtable. Implement ambiguous overrides in
- virtual bases as abstract. Hack until we make the class
- ill-formed.
-
-Wed Apr 27 01:17:08 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (unary_expr): Expand new_placement[opt] and
- new_initializer[opt] inline.
-
- * search.c (lookup_fnfields): Don't throw away the inheritance
- information here, either.
- (compute_access): Handle static members properly.
-
- * init.c (build_member_call): Always set basetype_path, and pass it
- to lookup_fnfields.
-
- * search.c (lookup_field): Deal properly with the case where
- xbasetype is a chain of binfos; don't throw away the inheritance
- information.
- (compute_access): protected_ok always starts out at 0.
-
- * init.c (resolve_offset_ref): Don't cast `this' to the base type
- until we've got our basetype_path.
-
- * cp-tree.h (IS_OVERLOAD_TYPE): aggregate or enum.
-
- * cvt.c (build_up_reference): Use build_pointer_type rather than
- TYPE_POINTER_TO.
-
- * call.c (convert_harshness_ansi): Call type_promotes_to for reals
- as well.
-
- * cvt.c (type_promotes_to): Retain const and volatile, add
- float->double promotion.
-
- * decl.c (grokdeclarator): Don't bash references to arrays into
- references to pointers in function parms. Use type_promotes_to.
-
-Tue Apr 26 23:44:36 1994 Mike Stump <mrs@cygnus.com>
-
- Finish off Apr 19th work.
-
- * class.c (finish_struct_bits): Rename has_abstract_virtuals to
- might_have_abstract_virtuals.
- * class.c (strictly_overrides, override_one_vtable,
- merge_overrides): New routines to handle virtual base overrides.
- * class.c (finish_struct): Call merge_overrides to handle overrides
- in virtual bases.
-
-Tue Apr 26 12:45:53 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_function_call): Call build_function_call_real with
- LOOKUP_NORMAL.
-
- * *: Don't deal with TYPE_EXPRs.
-
- * tree.c (lvalue_p): If the type of the expression is a reference,
- it's an lvalue.
-
- * cvt.c (convert_to_reference): Complain about passing const
- lvalues to non-const references.
- (convert_from_reference): Don't arbitrarily throw away const and
- volatile on the target type.
-
- * parse.y: Simplify and fix rules for `new'.
-
- * decl.c (grok_op_properties): operator void is illegal.
-
-Mon Apr 25 02:36:28 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (components): Anonymous bitfields can still have declspecs.
-
- * decl.c (pushdecl): Postpone handling of function templates like we
- do C functions.
-
- * search.c (expand_indirect_vtbls_init): Fix infinite loop when
- convert_pointer_to fails.
-
- * call.c (compute_conversion_costs_ansi): A user-defined conversion
- by itself is better than that UDC followed by standard conversions.
- Don't treat integers and reals specially.
-
- * cp-tree.h: Declare flag_ansi.
-
- * typeck.c (c_expand_return): pedwarn on return in void function
- even if the expression is of type void.
- (build_c_cast): Don't do as much checking for casts to void.
- (build_modify_expr): pedwarn about array assignment if this code
- wasn't generated by the compiler.
-
- * tree.c (lvalue_p): A comma expression is an lvalue if its second
- operand is.
-
- * typeck.c (default_conversion): Move code for promoting enums and
- ints from here.
- * cvt.c (type_promotes_to): To here.
- * call.c (convert_harshness_ansi): Use type_promotes_to. Also fix
- promotion semantics for reals.
-
-Sun Apr 24 16:52:51 1994 Doug Evans <dje@canuck.cygnus.com>
-
- * Make-lang.in (c++.install-common): Check for g++-cross.
- * Makefile.in: Remove Cygnus cruft.
- (config.status): Delete.
- (RTL_H): Define.
- (TREE_H): Use complete pathname, some native makes have minimal
- VPATH support.
- (*.o): Use complete pathname to headers in parent dir.
- (doc, info, dvi): Delete.
-
-Sun Apr 24 16:52:51 1994 Doug Evans <dje@canuck.cygnus.com>
-
- * Make-lang.in (c++.install-common): Check for g++-cross.
- * Makefile.in: Remove Cygnus cruft.
- (config.status): Delete.
- (RTL_H): Define.
- (TREE_H): Use complete pathname, some native makes have minimal
- VPATH support.
- (*.o): Use complete pathname to headers in parent dir.
- (doc, info, dvi): Delete.
-
-Sun Apr 24 00:47:49 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (pushdecl): Avoid redundant warning on redeclaring function
- with different return type.
- (decls_match): Compare return types strictly.
-
-Fri Apr 22 12:55:42 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (build_type_conversion): Do try to convert through other
- pointers. This will fail if the class defines multiple pointer
- conversions.
-
- * error.c (dump_type_prefix): Print out pointers to arrays properly.
- (dump_type_suffix): Likewise. (was 'int *[]', now 'int (*)[]')
-
- * typeck.c (build_unary_op): Disallow ++/-- on pointers to
- incomplete type.
-
- * decl.c (duplicate_decls): Check mismatched TREE_CODES after
- checking for shadowing a builtin. If we're redeclaring a builtin
- function, bash the old decl to avoid an ambiguous overload.
-
- * cvt.c (convert_to_reference): Don't force arrays to decay here.
-
- * tree.c (lvalue_p): A MODIFY_EXPR is an lvalue.
-
- * decl.c (duplicate_decls): Don't assume that the decls will have
- types.
-
- Mon Apr 18 11:35:32 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ cp/* changes propagated from c-* changes in 940318 snapshot ]
- * c-decl.c (pushdecl): Warn if type mismatch with another external decl
- in a global scope.
-
- Fri Apr 22 06:38:56 1994 Chip Salzenberg <chip@fin.uucp>
-
- * cp/typeck2.c (signature_error): Use cp_error for "%T".
-
- Mon Apr 18 11:59:59 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ cp/* changes propagated from c-* changes in 940415 snapshot ]
- * cp/decl.c (duplicate_decls, pushdecl, builtin_function):
- Use DECL_FUNCTION_CODE instead of DECL_SET_FUNCTION_CODE.
-
- Mon Apr 18 11:55:18 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ cp/* changes propagated from c-* changes in 940409 snapshot ]
- * cp/decl.c (duplicate_decls): Put new type in same obstack as
- old ones, or permanent if old ones in different obstacks.
-
- Mon Apr 18 11:48:49 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ cp/* changes propagated from c-* changes in 940401 snapshot ]
- * cp/parse.y (attrib): Handle string args as expressions,
- merging the two rules. `mode' attribute now takes a string arg.
- Delete the rule for an identifier as arg.
-
- Mon Apr 18 11:24:00 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ cp/* changes propagated from c-* changes in 940312 snapshot ]
- * cp/typeck.c (pointer_int_sum): Multiplication should be done signed.
- (pointer_diff): Likewise the division.
-
- Sun Mar 6 19:43:39 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ cp/* changes propagated from c-* changes in 940304 snapshot ]
- * cp/decl.c (finish_decl): Issue warning for large objects,
- if requested.
-
- Sat Feb 19 22:20:32 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ cp/* changes propagated from c-* changes in 940218 snapshot ]
- * cp/parse.y (attrib): Handle attribute ((section ("string"))).
- * cp/decl.c (duplicate_decls): Merge section name into new decl.
-
- Tue Feb 8 09:49:17 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ cp/* changes propagated from c-* changes in 940206 snapshot ]
- * cp/typeck.c (signed_or_unsigned_type): Check for any
- INTEGRAL_TYPE_P not just INTEGER_TYPE.
-
- Mon Dec 6 13:35:31 1993 Norbert Kiesel (norbert@i3.INformatik.rwth-aachen.DE)
-
- * cp/decl.c (finish_enum): Start from 0 when determining precision
- for short enums.
-
- Fri Dec 3 17:07:58 1993 Ralph Campbell (ralphc@pyramid.COM)
-
- * cp/parse.y (unary_expr): Look at $1 for tree_code rather than
- casting $$.
-
- Wed Nov 17 19:22:09 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp/typeck.c (build_binary_op_nodefault): Propagate code
- from C front-end to optimize unsigned short division.
- (build_conditional_expr): Fix bug in "1 ? 42 : (void *) 8".
-
- Wed Nov 17 19:17:18 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp/call.c (convert_harshness_ansi): Given an (e.g.) char
- constant, prefer 'const char &' to 'int'.
-
- Wed Feb 3 13:11:48 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp/class.c (finish_struct_methods): Handle multiple
- constructors in fn_fields list.
-
-Fri Apr 22 12:48:10 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * class.c (finish_struct): use TYPE_DECL_SUPPRESS_DEBUG to flag
- types not to be dumped in stabs, like types in #pragma interface.
- * decl.c (init_decl_processing): use TYPE_DECL_SUPPRESS_DEBUG to
- mark unknown type.
-
-Fri Apr 22 03:27:26 1994 Doug Evans <dje@cygnus.com>
-
- * Language directory reorganization.
- See parent makefile.
-
-Thu Apr 21 18:27:57 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * cp-tree.h (THUNK_DELTA): It is normally negative, so
- use signed .i variant of frame_size rather than unsigned .u.
- * cp-tree.h (VTABLE_NAME_FORMAT): If flag_vtable_thunks,
- use "VT" rather than "vt" due to binary incompatibility.
- * class.c (get_vtable_name): Use strlen of VTABLE_NAME_FORMAT,
- rather than sizeof, since it is now an expression.
- * class.c (modify_one_vtable): Modify to skip initial element
- containing a count of the vtable.
-
-Thu Apr 21 00:09:02 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * lex.c (check_newline): Force interface_unknown on main input file.
-
- * pt.c (do_pending_expansions): Always emit functions that have been
- explicitly instantiated.
- (do_function_instantiation): Set DECL_EXPLICITLY_INSTANTIATED.
- (do_type_instantiation): Set CLASSTYPE_VTABLE_NEEDS_WRITING and
- DECL_EXPLICITLY_INSTANTIATED on all my methods.
- * parse.y (explicit_instantiation): Call do_type_instantiation for
- types.
- * decl2.c (finish_vtable_vardecl): Call import_export_vtable.
- * decl.c (start_function): Don't set DECL_EXTERNAL on a function
- that has been explicitly instantiated.
- * cp-tree.h (DECL_EXPLICITLY_INSTANTIATED): Alias for
- DECL_LANG_FLAG_4.
- * class.c: Move import_export_vtable to decl2.c, and comment out all
- uses.
-
-Wed Apr 20 16:51:06 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * lex.c (process_next_inline): Don't muck with DECL_INLINE.
- (do_pending_inlines): Likewise.
-
-Tue Apr 19 22:25:41 1994 Mike Stump <mrs@cygnus.com>
-
- Reimplement vtable building, and most vtable pointer setting.
- Allows for earier maintenance, easier understandability, and most
- importantly, correct semantics.
-
- * class.c (build_vtable): Removed unneeded
- SET_BINFO_VTABLE_PATH_MARKED.
- * class.c (prepare_fresh_vtable): Likewise. Added argument.
- * class.c (modify_vtable_entry): General cleanup.
- * class.c (related_vslot, is_normal, modify_other_vtable_entries,
- modify_vtable_entries): Removed.
- * class.c (add_virtual_function): General cleanup.
- * class.c (finish_base_struct): Setup BINFO_VTABLE and
- BINFO_VIRTUALS as early as we can, so that modify_all_vtables can
- work.
- * class.c (finish_vtbls): New routine, mostly from
- unmark_finished_struct.
- * class.c (overrides): New routine.
- * class.c (modify_one_vtable): New routine, mostly from
- modify_other_vtable_entries and modify_vtable_entries.
- * class.c (modify_all_direct_vtables, modify_all_indirect_vtables,
- modify_all_vtables): New routines.
- * class.c (finish_struct): Added arguemnt to prepare_fresh_vtable
- call. General cleanup on how pending_hard_virtuals are handled.
- General cleanup on modifying vtables. Use finish_vtbls, instead of
- unmark_finished_struct.
- * cp-tree.h (init_vtbl_ptrs, expand_direct_vtbls_init,
- get_first_matching_virtual, get_matching_virtual,
- expand_vbase_vtables_init, expand_indirect_vtbls_init): Update.
- * cvt.c (convert_pointer_to_real): cleanup error message.
- * decl.c (grokfndecl): General cleanup.
- * decl.c (finish_function): Change init_vtbl_ptrs call to
- expand_direct_vtbls_init. Change expand_vbase_vtables_init call to
- expand_indirect_vtbls_init.
- * init.c (expand_virtual_init): Remove unneeded argument.
- * init.c (init_vtbl_ptrs): Rename to expand_direct_vtbls_init, added
- two arguments to make more general. Made more general. Now can be
- used for vtable pointer initialization from virtual bases.
- * init.c (emit_base_init): Change expand_vbase_vtables_init call to
- expand_indirect_vtbls_init. Change init_vtbl_ptrs call to
- expand_direct_vtbls_init.
- * init.c (expand_virtual_init): General cleanup.
- * init.c (expand_default_init): Change expand_vbase_vtables_init
- call to expand_indirect_vtbls_init.
- * init.c (expand_recursive_init_1): Change expand_vbase_vtables_init
- call to expand_indirect_vtbls_init.
- * init.c (expand_recursive_init): Change expand_vbase_vtables_init
- call to expand_indirect_vtbls_init.
- * search.c (get_first_matching_virtual): Rename to
- get_matching_virtual. General cleanup and remove setting of
- DECL_CONTEXT. That is now done in a cleaner way in
- modify_vtable_entry and add_virtual_function.
- * search.c (expand_vbase_vtables_init): Rename to
- expand_indirect_vtbls_init. General cleanup. Use
- expand_direct_vtbls_init to do hard work. Ensures that _all_ vtable
- pointers from virtual bases are set up.
- * search.c (bfs_unmark_finished_struct, unmark_finished_struct):
- Removed.
-
- * *.[chy]: Remove support for VTABLE_USES_MASK.
-
-Tue Apr 19 12:51:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (convert_to_reference): Use NOP_EXPRs to switch between
- reference and pointer types instead of bashing the types directly.
-
- * call.c (build_overload_call_real): Use the TREE_CODE to determine
- whether the function is overloaded or not, rather than
- TREE_OVERLOADED.
- * *: Remove all uses of TREE_OVERLOADED.
-
- * decl.c (grokdeclarator): Only complain about initializing const
- fields when -ansi or -pedantic.
-
-Tue Apr 19 12:42:42 1994 Doug Evans <dje@canuck.cygnus.com>
-
- * cp-tree.h (THUNK_DELTA): frame_size is now a union.
-
-Mon Apr 18 00:17:13 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- Do overloading on a block-by-block basis, not function-by-function.
- * decl.c: Lose overloads_to_forget.
- (struct binding_level): Add overloads_shadowed field.
- (poplevel): Restore overloads_shadowed.
- (push_overloaded_decl): Use overloads_shadowed instead of
- overloads_to_forget.
- (finish_function): Don't look at overloads_to_forget.
-
- Copy enum_overflow logic from c-decl.c.
- * decl.c (start_enum): Initialize enum_overflow.
- (build_enumerator): Use enum_overflow. Also use current_scope().
-
- * search.c (current_scope): Move Brendan's comment from
- build_enumerator here.
-
- * typeck.c (convert_for_assignment): Change warnings to pedwarns for
- discarding const/volatile.
-
-Sat Apr 16 01:18:21 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (comp_target_parms): Accept TEMPLATE_TYPE_PARMs on the rhs.
- (comp_target_types): Likewise.
-
- * decl.c (lookup_name): Don't unset got_scope here.
-
- * spew.c (yylex): Only replace yylval with the TYPE_NESTED_NAME if
- got_scope != NULL_TREE.
-
-Fri Apr 15 16:36:33 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- Horrible kludge to prevent templates from being instantiated by
- their base classes.
- * parse.y (template_instantiate_once): Unset TYPE_BEING_DEFINED
- before we get to left_curly.
- * pt.c (instantiate_class_template): Set TYPE_BEING_DEFINED.
-
- * error.c (dump_decl): If it's a typedef, print out the name of the
- decl, not just the underlying type.
-
- * decl.c (pushdecl): If the old duplicate decl was a TYPE_DECL,
- update the IDENTIFIER_TYPE_VALUE of its name.
-
- * decl2.c (finish_file): When processing the initializer for a
- static member, pretend that the dummy function is a member of the
- same class.
-
-Fri Apr 15 15:56:35 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * class.c (build_vtable_entry): revert Apr 4 change.
- * decl2.c (mark_vtable_entries): replace pure virtual function
- decl with abort's.
-
-Fri Apr 15 13:49:33 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_conditional_expr): Pedwarn on pointer/integer
- mismatch, and don't pedwarn on 0/function pointer mismatch.
-
- * typeck2.c (digest_init): Lose code for special handling of unions.
- (process_init_constructor): Since they're handled just fine here.
- Pedwarn on excess elements.
-
- * decl2.c (grokfield): Complain about local class method declaration
- without definition.
-
-Fri Apr 15 13:19:40 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * method.c (emit_thunk): Add extern declaration for
- current_call_is_indirect (needed for hppa).
-
-Thu Apr 14 16:12:31 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- Improve local class support; allow classes in different blocks to
- have the same name.
- * decl.c (pushtag): Support local classes better.
- (pushdecl_nonclass_level): New function for pushing mangled decls of
- nested types into the appropriate scope.
- (xref_defn_tag): Use pushdecl_nonclass_level instead of
- pushdecl_top_level.
- (grokfndecl): Don't mess with IDENTIFIER_GLOBAL_VALUE for local
- class methods.
- * method.c (do_inline_function_hair): Likewise.
-
- * class.c (finish_struct): It is legal for a class with no
- constructors to have nonstatic const and reference members.
-
-Thu Apr 14 07:15:11 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * decl.c (push_overloaded_decl): Avoid giving errors about
- built-ins, since duplicate_decls will have given warnings/errors
- for them.
-
-Thu Apr 14 03:45:12 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (convert_to_reference): Warn about casting pointer type to
- reference type when this is probably not what they wanted.
-
-Wed Apr 13 13:12:35 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (finish_decl): Don't mindlessly set TREE_USED for
- static consts any more (toplev.c has now been modified to
- not emit warnings if they are unused).
-
-Wed Apr 13 00:22:35 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grok_op_properties): If op new/delete get here with
- METHOD_TYPEs, do a revert_static_member_fn.
-
- * cp-tree.h (IDENTIFIER_CLASS_TYPE_VALUE): Lose.
- * init.c (is_aggr_typedef): Don't look at
- IDENTIFIER_CLASS_TYPE_VALUE.
- (get_aggr_from_typedef): Likewise.
- (get_type_value): Likewise.
- * call.c (build_scoped_method_call): Don't rely on overloaded
- template names having IDENTIFIER_CLASS_VALUE set.
-
- * parse.y (component_decl_1, fn.def2): Revert rules for
- constructors.
- (component_decl_1, fn.def2): Use $1 instead of $$, since $$ is being
- clobbered.
-
- * decl.c (start_function): Only warn about `void main()' if pedantic
- || warn_return_type.
-
-Tue Apr 12 02:14:17 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- Clean up overloading of the template name.
- * class.c (pushclass): overload the template name whenever pushing
- into the scope of a template class, not just if it is
- uninstantiated.
- (popclass): Correspondingly.
- * search.c (push_class_decls): Don't overload_template_name.
- * pt.c (overload_template_name): Don't set IDENTIFIER_LOCAL_VALUE or
- DECL_CONTEXT on things.
- * parse.y (left_curly): Don't overload_template_name.
- * class.c (finish_struct): Don't undo_template_name_overload.
-
- * method.c (build_opfncall): Only pass one argument to global op
- delete.
-
- * call.c (build_method_call): Use TYPE_VEC_DELETE_TAKES_SIZE to
- decide how many arguments to use for vec delete.
-
- * decl.c (grok_op_properties): Be consistent in modifying
- current_class_type.
- (grokdeclarator): Only complain about function decls with no return
- type if we're being pedantic.
-
-Mon Apr 11 00:10:53 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- Add support for operator new [] and operator delete [].
-
- * tree.def: Add VEC_NEW_EXPR and VEC_DELETE_EXPR.
- * ptree.c (print_lang_type): Indicate vec new/delete.
- * parse.y: Support vec new/delete.
- * method.c (build_decl_overload): Deal with vec new/delete.
- (build_opfncall): Likewise.
- * lex.c (init_lex): Set up values of ansi_opname and opname_tab for
- vec new/delete. vec new uses "__vn", and vec delete uses "__vd".
- * init.c (init_init_processing): Set up BIVN and BIVD.
- (do_friend): Don't clean up after mistaken setting of TREE_GETS_NEW,
- since it doesn't happen any more.
- (build_new): Support vec new. Always call something.
- (build_x_delete): Support vec delete.
- (build_vec_delete): Lose dtor_dummy argument, add use_global_delete,
- and pass it to build_x_delete.
- * decl2.c (delete_sanity): Don't change behavior by whether or not
- the type has a destructor. Pass use_global_delete to
- build_vec_delete.
- (coerce_delete_type): Make sure that the type returned has a first
- argument of ptr_type_node.
- * decl.c (init_decl_processing): Also declare the global vec
- new/delete.
- (grokdeclarator): Also force vec new/delete to be static.
- (grok_op_properties): Note presence of vec new/delete, and play with
- their args. If vec delete takes the optional size_t argument, set
- TYPE_VEC_DELETE_TAKES_SIZE.
- * cp-tree.h (TYPE_GETS_{REG,VEC}_DELETE): New macros to simplify
- checking for one delete or the other.
- (lang_type): gets_new and gets_delete are now two bits long. The
- low bit is for the non-array version. Lose gets_placed_new.
- (TYPE_VEC_DELETE_TAKES_SIZE): New macro indicating that the vec
- delete defined by this class wants to know how much space it is
- deleting.
- (TYPE_VEC_NEW_USES_COOKIE): New macro to indicate when vec new must
- add a header containing the number of elements in the vector; i.e.
- when the elements need to be destroyed or vec delete wants to know
- the size.
- * class.c (finish_struct_methods): Also check for overloading vec
- delete.
- * call.c (build_method_call): Also delete second argument for vec
- delete.
-
- * decl.c (grokdeclarator): Correct complaints again.
- (grokdeclarator): Fix segfault on null declarator.
- (decls_match): Also accept redeclaration with no arguments if both
- declarations were in C context. Bash TREE_TYPE (newdecl) here.
- (duplicate_decls): Instead of here.
-
- * parse.y (nested_name_specifier_1): Lose rules for dealing with
- syntax errors nicely, since they break parsing of 'const i;'.
-
- * decl.c (lookup_name): if (got_scope == current_class_type)
- val = IDENTIFIER_CLASS_VALUE (name).
-
- * search.c (lookup_nested_tag): Look in enclosing classes, too.
-
- * spew.c (yylex): Only look one character ahead when checking for a
- SCOPE.
-
- * lex.c (check_newline): Read first nonwhite char before
- incrementing lineno.
-
- * decl.c (grokdeclarator): Don't claim that typedefs are variables
- in warning.
-
- * parse.y: Divide up uses of unqualified_id into
- notype_unqualified_id and unqualified_id, so that TYPENAME can be
- used as an identifier after an object.
-
- * class.c (push_nested_class): Don't push into non-class scope.
-
- * decl.c (grokdeclarator): If an identifier could be a type
- conversion operator, but has no associated type, it's not a type
- conversion operator.
-
- * pt.c (unify): Check for equality of constants better.
-
- * decl.c (grokdeclarator): Don't complain about access decls.
-
-Sun Apr 10 02:39:55 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): pedwarn about data definitions without
- types here.
-
- * parse.y (datadef): Don't pedwarn about decls without types here,
- since that is valid for functions.
- (fn.def2, component_decl): Support constructors with declmods again.
- (nomods_initdecls): For decls without any mods, so that we don't try
- to get declspecs from some arbitrary $0.
-
- * search.c (lookup_field): Use cp_error.
-
- * parse.y (nested_name_specifier_1): Don't check aggr/non-aggr type
- here; it breaks destructors for non-aggr types.
-
- * decl.c (lookup_name): Only look for TYPE_DECLs in base classes of
- a type being defined, like the comment says.
- If got_scope is not an aggregate, just return NULL_TREE.
-
- * pt.c (create_nested_upt): Kung's code for creating types nested
- within uninstantiated templates now lives here (it used to live in
- hack_more_ids). It needs to be expanded.
-
- * parse.y: Stop calling see_typename so much.
-
- * decl.c (lookup_name): Deal with TTPs and UPTs.
-
- * lex.c (real_yylex): Don't set looking_for_typename just because we
- saw a 'new'.
- (dont_see_typename): #if 0 out.
-
- * spew.c (yylex): Increment looking_for_typename if the next
- character is SCOPE, rather than setting it to 1; this way, the value
- from seeing an aggr specifier will not be lost. This kinda relies
- on looking_for_typename never being < 0, which is now true.
-
- * parse.y (nested_name_specifier_1): Accept TEMPLATE_TYPE_PARMs,
- too.
- (named_class_head_sans_basetype): Accept template types, too. Oops.
-
-Fri Apr 8 16:39:35 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (reparse_decl_as_expr1): Handle SCOPE_REFs.
-
- * parse.y: Lose START_DECLARATOR.
-
- * search.c (lookup_nested_tag): New function to scan CLASSTYPE_TAGS
- for a class.
-
- * parse.y: Simplify fn.def2 and component_decl. Support 'enum
- A::foo' syntax. Catch invalid scopes better.
-
- * parse.y, lex.c: lose TYPENAME_COLON.
-
- * decl2.c (groktypefield): #if 0 out.
-
- * decl.c (lookup_name): If the type denoted by got_scope is
- currently being defined, look in CLASSTYPE_TAGS rather than FIELDS.
-
- * class.c (push_nested_class): Don't try to push into
- error_mark_node.
-
-Fri Apr 8 07:26:36 1994 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Makefile.in (stamp-parse): Update count of conflicts to 33.
-
-Thu Apr 7 17:47:53 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- A saner implementation of nested types that treats template types
- no differently from non-template types. There are still some
- shortcomings of our system; most notably, it is difficult to look
- for a nested type that is hidden by another name, because of the way
- we keep track of hidden types. But this shouldn't be a problem for
- just about anyone. Perhaps lookup_field should be fixed up a bit.
-
- * spew.c: Moved handling of nested types/scoping from the lexer
- into the parser. Removed variable template_type_seen_before_scope.
- Removed functions frob_identifier, hack_more_ids, and various cruft
- that was #if 0'd out in the past, reducing the size of the file from
- 1146 lines to 450 lines. We can't quite do away with spew.c yet,
- though; we still need it for do_aggr () and checking for SCOPE after
- the current identifier. And setting lastiddecl.
-
- * parse.y: Moved handling of nested types/scoping from the lexer
- into the parser, using a new global variable `got_scope'. Reduced
- the number of states by 53. Implemented all uses of explicit global
- scope. Removed terminals SCOPED_TYPENAME and SCOPED_NAME. Removed
- nonterminals tmpl.1, scoped_base_class, id_scope, typename_scope,
- scoped_typename. Added nonterminals nested_type,
- qualified_type_name, complete_type_name, qualified_id, ptr_to_mem,
- nested_name_specifier, global_scope, overqualified_id, type_name.
- Changed many others. Added 9 new reduce/reduce conflicts, which are
- nested type parallels of 9 that were already in the grammar for
- non-nested types. Eight of the now 33 conflicts should be removed
- in the process of resolving the late binding between variable and
- function decls.
-
- * gxxint.texi (Parser): Update.
-
- * cp-tree.h (IS_AGGR_TYPE_CODE): Add UNINSTANTIATED_P_TYPE.
-
- * lex.h: Add decl for got_scope.
-
- * lex.c (see_typename): Claim to be the lexer when calling
- lookup_name.
-
- * decl.c (lookup_name): When called from the lexer, look at
- got_scope and looking_at_typename; otherwise don't.
-
-Thu Apr 7 22:05:47 1994 Mike Stump <mrs@cygnus.com>
-
- 31th Cygnus<->FSF merge.
-
-Thu Apr 7 17:47:53 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (mark_vtable_entries): Call this to mark all the
- entries in the vtable addressable.
- (finish_decl_parsing): Handle SCOPE_REFs.
-
- * decl.c (decls_match): Always call compparms with strict == 1.
- Handle the special case of C function redecl here.
- (duplicate_decls): Only keep the old type if the new decl takes no
- arguments.
-
- * typeck.c (compparms): Also allow t1 to be ... if strict == 0.
-
-Thu Apr 7 16:17:50 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (build_vtable_entry): Fix breakage introduced Apr 5
- 17:48:41.
-
-Wed Apr 6 16:05:10 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * init.c (build_virtual_init), search.c (build_vbase_vtables_init),
- ch-tree.h: Every place these functions were called, the result was
- immediately passed to expand_expr_stmt. Reduce redundancy by
- calling expand_expr_init *inside* these functions. These
- makes for a simpler interface, and we don't have to build
- compound expressions. Hence, rename these function to:
- expand_virtual_init and expand_vbase_vtables_init respectively.
- * init.c, decl.c: Change callers of these functions.
- * init.c, cp-tree.h (expand_virtual_init): Make static.
-
- * decl2.c (finish_file): Check TREE_PUBLIC||TREE_ADDRESSABLE
- rather than DECL_SAVED_INSNS before emitting inlines.
-
-Wed Apr 6 13:06:39 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * spew.c (init_spew): #if 0 out stuff used by arbitrate_lookup.
-
- * decl.c (duplicate_decls): If this is a new declaration of an
- extern "C" function, keep the type (for the argtypes).
- (redeclaration_error_message): Don't check DECL_LANGUAGE here.
- (decls_match): Call compparms with a value of strict dependent on
- the value of strict_prototypes for DECL_LANGUAGE (oldecl).
-
- * typeck.c (compparms): ... is only equivalent to non-promoting
- parms if we're not being strict.
-
- * parse.y (empty_parms): Don't check flag_ansi || pedantic here.
-
- * decl.c (init_decl_processing): if (flag_ansi || pedantic)
- strict_prototypes_lang_c = strict_prototypes_lang_cplusplus;
-
- * decl2.c (grok_function_init): Don't set DECL_INITIAL on pure
- virtuals.
-
-Tue Apr 5 17:48:41 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- Support for implementing vtables with thunks.
- * tree.def (THUNK_DECL): New TREE_CODE.
- * cp-tree.h (FNADDR_FROM_VTABLE_ENTRY), tree.c
- (fnaddr_from_vtable_entry): Handle flag_vtable_thunks case.
- * cp-tree.h (memptr_type): New variable.
- * class.c (build_vtable_entry): Build thunk if necessary.
- * class.c (build_vfn_ref): If using thunks, don't need
- to add delta field from vtable (there is none!).
- * decl.c: Add memptr_type as well as vtable_entry_type.
- If using thunks, the latter is just ptr_type_node.
- * gc.c, typeck.c: Use memptr_typeChange, not vtable_entry_type.
- * decl2.c (finish_vtable_vardecl): Handle thunks.
- * expr.c (cplus_expand_expr): Support THUNK_DECL.
-
- * decl.c (grokdeclarator): Set DECL_THIS_EXTERN if "extern".
- * decl.c (start_function): Set current_extern_inline based on
- DECL_THIS_EXTERN, not TREE_PUBLIC.
- * decl.c (finish_function): Call mark_inline_for_output if needed,
-
- Improve intelligence about when to emit inlines.
- * cp-tree.h (lang_decl_flags): New field saved_inline.
- * cp-tree.h (DECL_SAVED_INLINE): New macro.
- * class.c (add_virtual_function): Don't set TREE_ADDRESSABLE.
- * decl.h, decl.c (pending_addressable_inlines): Removed.
- * decl2.c (pending_addressable_inlines): Renamed to saved_inlines.
- * decl2.c (mark_inline_for_output): Do nothing if
- DECL_SAVED_INLINE; otherwise set it (and add to saved_inlines list).
- * decl2.c (finish_vtable_vardecl): SET_CLASSTYPE_INTERFACE_KNOWN
- and set CLASSTYPE_INTERFACE_ONLY if there is a non-inline virtual.
- * decl2.c (finish_file): Writing out inlines later, so we can
- also handle the ones needed for vtbales.
- * decl2.c (write_vtable_entries, finish_vtable_typedecl): Removed.
-
- * cp-tree.h, class.c, decl2.c, search.c: Remove -fvtable-hack
- and flag_vtable_hack. Use -fvtable-thunks and flag_vtable_thunks
- instead. (The rationale is that these optimizations both break binary
- compatibility, but should become the default in a future release.)
-
-Wed Apr 6 10:53:56 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (modify_vtable_entries): Never reset the DECL_CONTEXT
- of a fndecl, as we might not be from that vfield.
-
-Tue Apr 5 17:43:35 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * class.c (add_virtual_function): fix bug for pure virtual, so
- that DECL_VINDEX of the dummy decl copied won't be error.
- (see also Apr 4 change)
-
-Tue Apr 5 17:23:45 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * typeck.c (c_expand_return): Before checking that we're not
- returning the address of a local, make sure it's a VAR_DECL.
- (And don't worry about it being a TREE_LIST.)
-
-Tue Apr 5 13:26:42 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (YYDEBUG): Always define.
- * lex.c (YYDEBUG): Likewise.
-
-Mon Apr 4 11:28:17 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * class.c (finish_struct): backup out the change below, put the
- new change for the same purpose. The change below breaks code.
-
- * class.c (finish_struct): if pure virtual, copy node and make
- RTL point to abort, then put in virtual table.
- * decl2.c (grok_function_iit): reinstate Mar 31 change.
-
-Sat Apr 2 03:12:58 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (build_new): pedwarn about newing const and volatile
- types.
-
- * tree.c (get_identifier_list): Only do the special handling
- thing if we're dealing with the main variant of the record type.
-
- * cvt.c (convert_to_reference): When converting between
- compatible reference types, use the pointer conversion machinery.
- Don't just blindly overwrite the old type.
-
-Fri Apr 1 17:14:42 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): When looking at global functions,
- be sure to use instance_ptr for the first argument, not some version
- of it that has been cast to a base class. Also do this before
- comparing candidates.
-
-Thu Mar 31 19:50:35 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): Constructors can be called for
- const objects.
-
-Thu Mar 31 16:20:16 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * decl2.c (grok_func_init): do not abort as rtl for pur virtual
- fucntions. They can be defined somewhere else.
-
-Sat Jan 23 23:23:26 1994 Stephen R. van den Berg (berg@pool.informatik.rwth-aachen.de)
-
- * decl.c (init_decl_processing): Declare __builtin_return_address
- and __builtin_frame_address for C++ as well.
-
-Thu Mar 31 12:35:49 1994 Mike Stump <mrs@cygnus.com>
-
- * typeck2.c (store_init_value): Integral constant variables are
- always constant, even when doing -fpic.
-
-Sat Jan 23 23:23:26 1994 Stephen R. van den Berg (berg@pool.informatik.rwth-aachen.de)
-
- * decl.c (redeclaration_error_message): Pass the types to
- comptypes.
-
-Wed Mar 30 21:29:25 1994 Mike Stump <mrs@cygnus.com>
-
- Cures incorrect errors about pure virtuals in a class, when they
- have been overridden in a derived class.
-
- * search.c (get_abstract_virtuals): Reimplement.
- * search.c (get_abstract_virtuals_1): New routine.
-
-Wed Mar 30 14:10:04 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (push_template_decls): Make the pushed level pseudo
- global.
-
- * parse.y (extdefs): Don't pop everything if the current binding
- level is pseudo_global.
-
- * decl.c (pop_everything): Stop on reaching a pseudo-global
- binding level.
-
- * cp-tree.h (DECL_FUNCTION_MEMBER_P): Change to more reliable test.
-
- * decl.c (duplicate_decls): Only copy DECL_SOURCE_{FILE_LINE} if
- the old decl actually had an initializer.
-
- * {various}: Clean up gcc -W complaints.
-
- * cp-tree.h (DECL_FUNCTION_MEMBER_P): Currently defined to be
- (DECL_CONTEXT (NODE) != NULL_TREE).
-
- * parse.y (lang_extdef): Call pop_everything if necessary.
-
- * decl.c (pop_everything): New function for popping binding
- levels left over after a syntax error.
- (pushdecl): Use DECL_FUNCTION_MEMBER_P to decide whether or not
- a function is a member.
-
-Wed Mar 30 14:20:50 1994 Mike Stump <mrs@cygnus.com>
-
- Cures calling a more base base class function, when a more derived
- base class member should be called in some MI situations.
-
- * search.c (make_binfo): Use more the more specialized base
- binfos from the binfo given as the second argument to make_binfo,
- instead of the unspecialized ones from the TYPE_BINFO.
- * class.c (finish_base_struct): Likewise, update callers.
- * search.c (dfs_get_vbase_types): Likewise.
- * tree.c (propagate_binfo_offsets, layout_vbasetypes): Likewise.
- * decl.c (xref_tag): Use NULL_TREE instead of 0.
- * lex.c (make_lang_type): Likewise.
-
-Wed Mar 30 14:10:04 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (pushdecl): If pushing a C-linkage function, only do a
- push_overloaded_decl.
- (duplicate_decls): Standard overloading does not shadow built-ins.
-
-Tue Mar 29 00:54:18 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (end_template_decl): Don't call push_overloaded_decl.
-
- * init.c (do_friend): Don't call push_overloaded_decl.
-
- * decl.c (pushdecl): Call push_overloaded_decl for functions and
- function templates.
- (duplicate_decls): functions and function templates are not
- duplicates, but don't complain about calling this function to
- compare them.
- (push_overloaded_decl): Don't deal with linkage. Call
- duplicate_decls.
- (redeclaration_error_message): Deal with linkage.
-
- * decl.c (start_function): If push_overloaded_decl returns an
- older version of the function, deal with it.
-
- * decl.c (start_function): Be sure only to push_overloaded_decl
- for non-members.
-
- * decl.c (grokfndecl): Put back clearing of DECL_CHAIN for
- methods.
- (start_function): Lose broken and redundant code for checking old
- decl.
-
- * init.c (add_friend): Give line numbers of both friend decls
- when warning about re-friending.
-
- * pt.c (tsubst): Use comptypes rather than == to compare the
- types of the method as declared and as defined, since default
- parameters may be different.
-
- * call.c (build_method_call): Use brendan's candidate printing
- routine.
-
- * decl.c (start_method): Methods defined in the class body are
- inline whether or not it's a template class.
-
-Mon Mar 28 16:39:26 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (initdcl0): Add "extern" to current_declspecs if
- have_extern_spec && ! used_extern_spcec.
-
- * tree.c (really_overloaded_fn): A fn with more than one
- overload.
-
- * pt.c (end_template_decl): Use really_overloaded_fn.
-
- * decl.c (duplicate_decls): When smashing a decl into a previous
- definition, keep the old file and line.
- Don't deal with overloaded functions.
- Lose old code for checking arg types of functions.
- Check for overloaded C functions.
- (pushdecl): Deal with overloaded functions.
- (start_decl): Expect pushdecl to return an appropriate function decl.
- (start_function): Likewise.
- (push_overloaded_decl): Don't check for overloaded C functions.
-
- * *.c: Stop using DECL_OVERLOADED, it being archaic.
- TREE_OVERLOADED should probably go, too.
-
-Mon Mar 28 14:00:45 1994 Ron Guilmette <rfg@netcom.com>
-
- * typeck.c (comp_target_types): Call comp_target_parms with
- strict == 1.
-
-Sun Mar 27 00:07:45 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (empty_parms): Don't parse () as (...) in extern "C"
- sections if we're compiling with -ansi or -pedantic.
-
- * decl.c (decls_match): Don't treat (int) and (int&) as matching.
-
- * decl2.c (grokfield): Don't pedwarn twice about initializing
- field.
-
- * decl.c (push_overloaded_decl): Warn about shadowing
- constructor.
- (redeclaration_error_message): Don't allow 'int a; int a;'
-
- * cvt.c (build_up_reference): Only check for valid upcast if
- LOOKUP_PROTECT is set, not just any flag.
-
-Fri Mar 25 01:22:31 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * lex.c (check_newline): When we see a #pragma implementation,
- also set it for the main input file.
-
- * init.c (build_new): Convert array size argument to size_t.
-
- * parse.y (primary): If we're doing a parenthesized type-id, call
- groktypename before passing it to build_new.
-
- * call.c (build_method_call): Deal properly with const and
- volatile for instances of reference type.
-
- * decl.c (store_return_init): Change 'if (pedantic) error' to 'if
- (pedantic) pedwarn'.
-
- * decl.c (grokdeclarator): Don't complain about putting `static'
- and `inline' on template function decls.
-
-Thu Mar 24 23:18:19 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): Preserve const & volatile on
- `this'.
-
-Thu Mar 24 16:21:52 1994 Mike Stump <mrs@cygnus.com>
-
- * init.c (build_new, build_vec_delete): Use global new and delete
- for arrays.
- * decl2.c (delete_sanity): Likewise.
-
-Thu Mar 24 02:10:46 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (convert_to_reference): If i is an lvalue,
- (int &)i -> *(int*)&i, as per 5.2.8p9 of the latest WP.
- (convert_force): Call convert_to_reference with LOOKUP_COMPLAIN.
-
-Wed Mar 23 17:45:37 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (duplicate_decls): Also propagate DECL_TEMPLATE_MEMBERS
- and DECL_TEMPLATE_INSTANTIATIONS.
-
- * init.c (build_new): Handle array typedefs properly.
-
-Wed Mar 23 18:23:33 1994 Mike Stump <mrs@cygnus.com>
-
- 30th Cygnus<->FSF merge.
-
-Wed Mar 23 00:46:24 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (modify_vtable_entries): Avoid running off the end of the
- virtuals list when processing a virtual destructor.
- * class.c (get_vtable_entry): Likewise.
-
-Wed Mar 23 00:23:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (duplicate_decls): If two template decls don't match,
- just return 0.
-
-Tue Mar 22 23:49:41 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (convert_for_assignment): Don't pedwarn about
- converting function pointer to void *.
-
-Tue Mar 22 22:23:19 1994 Mike Stump <mrs@cygnus.com>
-
- Major revamp of pointer to member functions. Cures major
- nonfunctionality when used in casts, and MI situations.
-
- * cvt.c (convert_force): Update call site of build_ptrmemfunc.
- * typeck.c (convert_for_assignment): Likewise.
- * typeck2.c (digest_init): Likewise.
- * typeck2.c (process_init_constructor): Simplify by moving code into
- digest_init.
- * typeck2.c (digest_init): Do default_conversions on init value, if
- we are processing pointer to member functions.
- * class.c (get_vfield_offset): Now non-static. Convert bit offset
- into byte offset.
- * cp-tree.h (get_vfield_offset): Likewise.
- * typeck.c (get_member_function_from_ptrfunc): Convert down to right
- instance, before fetching vtable pointer.
- * typeck.c (get_delta_difference): New routine.
- * typeck.c (build_ptrmemfunc): Revamp to handle casting better, also
- get vtable pointer out of right subobject.
-
-Tue Mar 22 17:56:48 1994 Mike Stump <mrs@cygnus.com>
-
- * search.c (get_binfo): Return NULL instead of aborting, when
- passed a UNION_TYPE.
-
-Tue Mar 22 12:44:54 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- These patches implement handling of redefinition/redeclaration of
- templates.
-
- * typeck.c (comptypes): Simplify. All TEMPLATE_TYPE_PARMs are
- considered compatible.
-
- * parse.y (template_def): Pass defn argument to end_template_decl.
-
- * pt.c (end_template_decl): Add defn argument. Check for
- redefinition. Simplify.
-
- * error.c (OB_UNPUT): New macro, to remove mistakes.
- (aggr_variety): Subroutine of dump_aggr_type.
-
- * decl.c (decls_match): Support templates.
- (duplicate_decls): No longer static. Don't try to lay out template
- decls.
- (pushdecl): Simplify.
-
- * cp-tree.h (DECL_TEMPLATE_MEMBERS): Use DECL_SIZE instead of
- DECL_INITIAL.
-
-Mon Mar 21 11:46:55 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * error.c (dump_decl): Support class template decls.
- (dump_type): Don't adorn template type parms.
-
- * decl.c (duplicate_decls): Save DECL_TEMPLATE_INFO from old decl
- if it was a definition.
- (redeclaration_error_message): Do the cp_error thang, and reject
- redefinition of templates.
-
-Mon Mar 21 19:36:06 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (grokdeclarator): Set TREE_PUBLIC for METHOD_TYPE
- in FIELD context, when appropriate. Also,
- CLASSTYPE_INTERFACE_ONLY is irrelevant to setting TREE_PUBLIC.
- Also, simplify check for bogus return specifiers.
-
-Mon Mar 21 11:46:55 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (after_type_declarator1): Expand type_quals.
- (notype_declarator1): Likewise.
- (absdcl1): Likewise.
-
-Sat Mar 19 01:05:17 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): Treat class-local typedefs like static
- members; i.e. 'typedef int f();' means that f is a function type,
- not a method type.
-
- * parse.y (decl): Change direct_* back to *.
- (type_id): Change direct_abstract_declarator to absdcl.
- (direct_declarator, direct_initdecls, direct_initdcl0): Remove again.
-
-Fri Mar 18 12:47:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- These two patches fix crashes on instantiating a template inside a
- function with C linkage or containing labels.
-
- * class.c (current_lang_stacksize): No longer static.
-
- * decl.c (struct saved_scope): Add lang_base, lang_stack,
- lang_name, lang_stacksize, and named_labels.
- (push_to_top_level): Save them.
- (pop_from_top_level): Restore them.
-
- * gxxint.texi (Parser): Update.
-
- These two patches finish moving the task of expr/declarator
- ambiguity resolution from the lexer to the parser, and add one more
- r/r conflict. START_DECLARATOR can now be nuked.
-
- * parse.y (decl): Add "direct_" in typespec X rules.
- (direct_declarator): New nonterminal for
- direct_after_type_declarator and direct_notype_declarator.
- (direct_initdecls): Like initdecls, but uses direct_initdcl0.
- (direct_initdcl0): Like initdcl0, but uses direct_declarator.
- (named_parm): Add typespec direct_declarator rule.
-
- * spew.c (yylex): #if 0 out START_DECLARATOR insertion.
-
- These two patches disable some excessive cleverness on the part of
- g++; a non-class declaration always hides a class declaration in the
- same scope, and g++ was trying to unhide it depending on the
- enclosing expression.
-
- * spew.c (arbitrate_lookup): #if 0 out.
-
- * decl.c (lookup_name): Never call arbitrate_lookup.
-
- * parse.y (complex_notype_declarator1): Add '*'
- complex_notype_declarator1 and '&' complex_notype_declarator1 rules.
-
- * parse.y (complex_direct_notype_declarator): Restore id_scope
- see_typename TYPENAME rule, remove all other rules beginning with
- those tokens.
- (notype_unqualified_id): Add '~' see_typename IDENTIFIER rule.
-
-Thu Mar 17 17:30:01 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- These changes fix the compiler's handling of the functional cast/
- object declaration ambiguities in section 6.8 of the ARM. They also
- add 11 reduce/reduce conflicts. Sigh.
-
- * parse.y: Add precedence decls for OPERATOR and '~'.
- (notype_unqualified_id): New nonterminal, encompasses all of the
- ANSI unqualified-id nonterminal except TYPENAMEs.
- (expr_or_declarator): New nonterminal to delay parsing of code like
- `int (*a)'.
- (primary): Use notype_unqualified_id.
- (decl): Add typespec initdecls ';' and typespec declarator ';'
- rules.
- (initdcl0): Deal with the above.
- (complex_notype_declarator1): A notype_declarator that is not also
- an expr_or_declarator.
- (complex_direct_notype_declarator): A direct_notype_declarator that
- doesn't conflict with expr_or_declarator. Use
- notype_unqualified_id. Remove id_scope see_typename TYPENAME rule.
- (functional_cast): New nonterminal, for the three functional cast
- rules. So that they can be moved after
- complex_direct_notype_declarator.
- (see_typename): Don't accept type_quals any more.
-
- * decl2.c (reparse_decl_as_expr): New function to deal with parse
- nodes for code like `int (*a)++;'.
- (reparse_decl_as_expr1): Recursive subroutine of the above.
- (finish_decl_parsing): New function to deal with parse nodes for
- code like `int (*a);'. See the difference?
-
-Thu Mar 17 12:16:10 1994 Mike Stump <mrs@cygnus.com>
-
- These changes break binary compatibility in code with classes
- that use virtual bases.
-
- * search.c (dfs_get_vbase_types): Simplify and correct to make
- sure virtual bases are initialized in dfs ordering.
- * search.c (get_vbase_types): Simplify and make readable.
-
-Thu Mar 17 12:01:10 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y: s/ typename / type_id /g
-
-Wed Mar 16 17:42:52 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * parse.y (typespec): add SCOPE TYPENAME for global scoped
- type. e.g. ::B x.
-
- * decl.c (complete_array_type): fix a bug that in -pendantic
- mode even there's no initializer, it will continue to build
- default index.
-
-Wed Mar 16 17:43:07 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (direct_notype_declarator): Add PTYPENAME rule, remove
- all of the scoped PTYPENAME rules.
-
-Wed Mar 16 16:39:02 1994 Mike Stump <mrs@cygnus.com>
-
- * init.c (build_offset_ref): The value of A::typedef_name is
- always the TYPE_DECL, and never an error.
-
-Tue Mar 15 20:02:35 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * search.c (get_base_distance_recursive): Two binfos can only
- represent the same object if they are both via_virtual.
-
- * class.c (finish_base_struct): Check vbases for ambiguity, too.
-
- * search.c (get_vbase_types): Accept binfo argument, too.
-
-Tue Mar 15 19:22:05 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * decl.c (complete_array_type): complete TYPE_DOMAIN of the
- initializer also, because back-end requires it.
-
-Tue Mar 15 15:33:31 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * error.c (dump_expr): Support member functions (which show up as
- OFFSET_REFs).
-
-Mon Mar 14 16:24:36 1994 Mike Stump <mrs@cygnus.com>
-
- * init.c (build_new): Set the return type of multidimensional
- news correctly.
-
-Fri Mar 11 15:35:39 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * call.c (build_method_call): if basetype not equal to type
- of the instance, use the type of the instance in building
- destructor.
-
-Thu Mar 10 17:07:10 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * parse.y (direct_notype_declarator): add push_nested_type for
- 'template_type SCOPED_NAME' rule.
-
-Tue Mar 8 00:19:58 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (parm): Add typed_declspec1 {absdcl, epsilon} rules.
-
-Sat Mar 5 04:47:48 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (regcast_or_absdcl): New nonterminal to implement late
- reduction of constructs like `int ((int)(int)(int))'.
- (cast_expr): Use it.
- (sub_cast_expr): Everything that can come after a cast.
- (typed_declspecs1): typed_declspecs that are not typed_typespecs.
- (direct_after_type_declarator): Lose PAREN_STAR_PAREN rule.
- (direct_abstract_declarator): Replace '(' parmlist ')' rule with
- '(' complex_parmlist ')' and regcast_or_absdcl.
- (parmlist): Split
- (complex_parmlist): Parmlists that are not also typenames.
- (parms_comma): Enabler.
- (named_parm): A parm that is not also a typename. Use declarator
- rather than dont_see_typename abs_or_notype_decl. Expand
- typed_declspecs inline.
- (abs_or_notype_decl): Lose.
- (dont_see_typename): Comment out.
- (bad_parm): Break out abs_or_notype_decl into two rules.
-
-Fri Mar 4 18:22:39 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl2.c (reparse_decl_as_casts): New function to change parse
- nodes for `(int)(int)(int)' from "function taking int and returning
- function taking int and returning function taking int" to "... cast
- to int, cast to int, cast to int".
-
- * decl2.c (reparse_decl_as_expr): Recursive function to change
- parse nodes for `A()()' from "function returning function returning
- A" to "A().operator()".
-
- * parse.y (primary): Replace `typespec LEFT_RIGHT' rule with
- `typespec fcast_or_absdcl' rule.
- (fcast_or_absdcl): New nonterminal to implement late reduction of
- constructs like `A()()()()'.
- (typename): Replace `typespec absdcl1' rule with
- `typespec direct_abstract_declarator' rule.
- (direct_abstract_declarator): Replace `LEFT_RIGHT type_quals' rule
- with `fcast_or_absdcl type_quals' rule.
-
-Fri Mar 4 16:18:03 1994 Mike Stump <mrs@cygnus.com>
-
- * tree.c (lvalue_p): Improve OFFSET_REF handling, so that it
- matches Section 5.5.
-
-Fri Mar 4 14:01:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * error.c (dump_type_prefix): Don't print basetype twice for
- pmfs.
-
-Fri Mar 4 13:24:33 1994 Mike Stump <mrs@cygnus.com>
-
- * typeck.c (convert_arguments): Handle setHandler(A::handlerFn)
- so that it is like setHandler(&A::handlerFn). Cures an `invalid
- lvalue in unary `&''.
-
-Fri Mar 4 11:15:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * gxxint.texi (Copying Objects): New section discussing default
- op= problems with virtual inheritance.
-
- * decl2.c (grokoptypename): Just does grokdeclarator and
- build_typename_overload, since the parser can't call grokdeclarator
- directly.
-
- * method.c (build_typename_overload): Set IDENTIFIER_GLOBAL_VALUE
- and TREE_TYPE on generated identifiers.
-
- * decl.c (grokdeclarator): Don't deal with TYPE_EXPRs anymore.
-
- * parse.y (parm): Convert `const char *' to `__opPCc' here.
-
- * error.c (dump_decl): Say sorry rather than my_friendly_aborting
- if we can't figure out what to do.
- (dump_type*): Likewise.
-
- * typeck2.c (build_m_component_ref): 'component' is an expr, not
- a decl. Also move the IS_AGGR_TYPE check after the stripping of
- REFERENCE_TYPE.
-
-Fri Mar 4 04:46:05 1994 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_method_call): Handle b->setHandler(A::handlerFn)
- so that it is like b->setHandler(&A::handlerFn). Cures an `invalid
- lvalue in unary `&''.
-
-Thu Mar 3 12:38:15 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y: Add precedence specification for START_DECLARATOR.
- (type_quals): Move before primary.
- (typename): Move before typed_declspecs, add 'typespec absdcl1' rule.
-
- * decl2.c (grokoptypename): Lose.
-
- * decl.c (grokdeclarator): Parse TYPE_EXPRs in the initial scan,
- rather than waiting until later.
-
-Wed Mar 2 14:12:23 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (unary_expr): Use 'typename' in 'new' rules, rather
- than expanding it inline.
- (typename): Expand empty option of (former) absdcl inline.
- (abs_or_notype_decl): Likewise.
- (absdcl): Lose empty rule.
- (conversion_declarator): New nonterminal for 'typename' of 'operator
- typename'.
- (operator_name): Use it instead of absdcl.
-
- * parse.y: Add precedence declarations for SCOPED_TYPENAME,
- TYPEOF, and SIGOF.
- (typed_declspecs): Accept typed_typespecs, rather than typespec
- directly. Add rules with reserved_typespecquals.
- (reserved_declspecs): Don't accept typespecqual_reserved at the
- beginning of the list. The typed_declspecs rule will deal with this
- omission.
- (declmods): Accept nonempty_type_quals, rather than TYPE_QUAL
- directly.
-
- * parse.y (direct_notype_declarator,
- direct_after_type_declarator, direct_abstract_declarator): Split up
- the declarator1 nonterminals to match the draft standard and avoid
- ambiguities.
- (new_type_id, new_declarator, direct_new_declarator,
- new_member_declarator): New nonterminals to implement the subset of
- 'typename' allowed in new expressions.
- (unary_expr): Use new_type_id instead of typename.
- (after_type_declarator1, absdcl1): Fix semantics of member pointers.
- (abs_member_declarator, after_type_member_declarator): Lose.
-
- * parse.y (absdcl1): Don't require parens around
- abs_member_declarator.
- (abs_member_declarator): Lose see_typename from rules.
- (after_type_member_declarator): Likewise.
-
- * tree.c (get_identifier_list): New function, containing code
- previously duplicated in get_decl_list and list_hash_lookup_or_cons.
- (get_decl_list): Use it.
- (list_hash_lookup_or_cons): Likewise.
-
- * parse.y (typed_declspecs, declmods): It's not necessary to hash
- the declspecs on class_obstack, so don't. This way typed_typespecs
- can reduce to typed_declspecs.
-
-Wed Mar 2 14:29:18 1994 Jason Merrill <jason@cygnus.com>
-
- * cvt.c (build_up_reference): If we aren't checking visibility,
- also allow base->derived conversions.
-
-Mon Feb 28 15:14:29 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * typeck.c (build_c_cast): Remove bogus hack when converting
- to a reference type.
-
- * cp-tree.h (lang_decl::vbase_init_list, DECL_VBASE_INIT_LIST):
- Removed, not used.
- (lang_stype::methods, lang_decl::next_method): New fields.
- (CLASSTYPE_METHODS, DECL_NEXT_METHOD): New macros.
- * decl.c (duplicate_decls): Preserve DECL_NEXT_METHOD.
-
- * cp-tree.h, decl2.c (flag_vtable_hack): New flag.
- * decl2.c (finish_vtable_vardecl): If flag_vtable_hack,
- and !CLASSTYPE_INTERFACE_KNOWN, try to use the presence of
- a non-inline virtual function to control emitting of vtables.
- * class.c (finish_struct): Build CLASSTYPE_METHODS list.
- * search.c (build_vbase_vtables_init): Don't assemble_external
- (yet) if flag_vtable_hack.
- * class.c (build_vfn_ref): Likewise.
-
-Mon Feb 28 14:54:13 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (component_decl): Don't include "typed_declspecs
- declarator ';'" speedup, since it breaks enums.
-
-Fri Feb 25 15:43:44 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * class.c (finish_struct): Minor optimization for building
- fn_fields list.
-
-Fri Feb 25 15:23:42 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (start_function): Fix detection of function overloading.
-
-Thu Feb 24 22:26:19 1994 Mike Stump <mrs@cygnus.com>
-
- * lex.c (check_newline): #pragma interface can take a string
- argument, just like #pragma implementation. #pragma implementation
- checks for garbage on the line, line #pragma interface does. Main
- input files do not auto implement like named files, #pragma
- implementation must be used explicitly.
-
-Thu Feb 24 17:09:01 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y (components): Handle list of one again.
- (notype_components): Likewise.
- (after_type_declarator1): Take maybe_raises out again.
-
- * gxxint.texi (Parser): Document additional r/r conflict.
-
-Wed Feb 23 14:42:55 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * gxxint.texi (Parser): Add node.
-
- * Makefile.in (stamp-parse): Update expected conflict count.
-
- * parse.y (various): Replace "declmods declarator" with "declmods
- notype_declarator". The comment saying that "declmods declarator ';'"
- corresponds to "int i;" was wrong; it corresponds to "const i;".
- (component_decl): Add "typed_declspecs declarator ';'" rule; this
- *does* correspond to "int i;". Change "declmods components" to
- "declmods notype_components".
- (components): Don't deal with a list of one anymore.
- (notype_components): New nonterminal, corresponds to notype_declarator.
- ({after_,no}type_component_decl{,0}): More new nonterminals.
- ({after_,no}type_declarator): Fold in START_DECLARATOR token.
- Eliminates four reduce/reduce conflicts.
-
- (expr): Depend on nontrivial_exprlist instead of nonnull_exprlist.
- (nontrivial_exprlist): New nonterminal: A list of at least two
- expr_no_commas's.
- (nonnull_exprlist): Depend on nontrival_exprlist.
- Eliminates four reduce/reduce conflicts.
-
- (named_class_head): Move intermediate code block into separate
- nonterminal so that we can stick %prec EMPTY on it.
-
- Add more %prec EMPTY's to eliminate remaining shift/reduce
- conflicts.
-
- (after_type_declarator): Add maybe_raises to fndecl rules.
- (after_type_declarator_no_typename): Remove.
- For correctness.
-
- Document remaining reduce/reduce conflicts.
-
-Tue Feb 22 12:10:32 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * search.c (get_base_distance): Only bash BINFO_INHERITANCE_CHAIN
- (TYPE_BINFO (type)) if we care about the path.
-
- * tree.c (lvalue_p): A COND_EXPR is an lvalue if both of the
- options are.
-
-Mon Feb 21 19:59:40 1994 Mike Stump <mrs@cygnus.com>
-
- * Makefile.in (mostlyclean): lex.c is a source file, don't
- remove.
-
-Sat Feb 19 01:27:14 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * parse.y: Eliminate 20 shift/reduce conflicts.
-
-Fri Feb 18 11:49:42 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (type_unification): Add subr argument; if set, it means
- that we are calling ourselves recursively, so a partial match is OK.
- (unify): Support pointers to methods and functions.
- (tsubst): Support method pointers.
- * decl.c (build_ptrmemfunc_type): No longer static, so that
- tsubst can get at it.
-
- * init.c (is_aggr_typedef): Pretend template type parms are
- aggregates.
- * decl2.c (build_push_scope): If cname refers to a template type
- parm, just grin and nod.
-
- * call.c (build_overload_call_real): Pass subr argument to
- type_unification.
- * pt.c (do_function_instantiation): Likewise.
- * class.c (instantiate_type): Likewise.
-
- * search.c (get_base_distance): If BINFO is a binfo, use it and
- don't mess with its BINFO_INHERITANCE_CHAIN.
-
- * cvt.c (convert_to_reference): Fix temporary generation.
- If ambiguous, return error_mark_node.
-
- * init.c (build_new): Put back some necessary code.
-
-Thu Feb 17 15:39:47 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (build_new): Deal with array types properly.
-
- * search.c (get_binfo): Become a shell for get_base_distance.
- (get_binfo_recursive): Lose.
- (get_base_distance_recursive): Find the path to the via_virtual base
- that provides the most access.
- (get_base_distance): Likewise.
-
- * parse.y (explicit_instantiation): Syntax is 'template class
- A<int>', not 'template A<int>'.
-
- * typeck.c (convert_for_initialization): Remove bogus warning.
-
- * parse.y (datadef): Revert patch of Oct 27.
-
-Thu Feb 17 15:12:29 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * class.c (build_vfn_ref): Cast delta field to ptrdiff_type_node,
- rather than integer_type_node. Does wonders for the Alpha.
-
-Thu Feb 17 13:36:21 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (build_ptrmemfunc_type): Make sure that the pmf type
- goes onto the same obstack as its target type.
-
-Wed Feb 16 00:34:46 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cvt.c (convert_to_reference): If converting via constructor
- on local level, go back to build_cplus_new approach.
-
- * tree.c (build_cplus_new): If with_cleanup_p, set cleanup slot
- to error_mark_node to prevent expand_expr from building a cleanup
- for this variable.
-
- * lex.c (default_assign_ref_body): Return *this from the memcpy
- version, too.
-
- * decl.c (grok_reference_init): Just return if called with
- error_mark_node, don't worry about initializing non-const reference
- with temporary.
-
- * cvt.c (convert_to_reference): Do the right thing for
- non-aggregate reference conversions, pedwarn when generating a
- non-const reference to a temporary.
-
- * class.c (finish_struct): TYPE_HAS_COMPLEX_{INIT,ASSIGN}_REF and
- TYPE_NEEDS_CONSTRUCTING all depend on TYPE_USES_VIRTUAL_BASECLASSES
- again.
-
-Tue Feb 15 19:47:19 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grok_reference_init): Pawn off a lot of the work on
- convert_to_reference. Generally do the right thing.
-
- * cvt.c (convert_to_reference): Conform to the initial comment;
- i.e. don't create temps if decl != error_mark_node. Handle
- cleanups better for temps that do get created. Don't pretend
- that we can use an 'A' to initialize a 'const double &' just by
- tacking on a NOP_EXPR. Support LOOKUP_SPECULATIVELY.
-
- * call.c (build_method_call): Set TREE_HAS_CONSTRUCTOR on
- constructor calls.
-
-Mon Feb 14 14:50:17 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grok_reference_init): Make a temporary for initializing
- const reference from constant expression.
-
-Mon Feb 14 11:31:31 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * cp-tree.h, decl.c (set_identifier_local_value): Deleted function.
- * decl.c (pushdecl): Define decl in correct binding_level
- (which isn't always the inner_binding_level).
-
- * cvt.c (build_up_reference): Don't ever call expand_aggr_init.
- It's ugly, and I don't think it's the right thing to do.
-
- * cp-tree.h, class.c, decl.c, decl2.c, sp/search.c:
- Remove NEW_CLASS_SCOPING, assuming it is always 1.
- * decl.c (pop_decl_level): Removed; manually inlined.
-
-Sun Feb 13 19:04:56 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.h (candidate): Add basetypes field.
-
- * call.c (build_method_call): Do access checking after choosing a
- function, not before.
-
- * Makefile.in (cvt.o, call.o, method.o): Depend on class.h.
- (mostlyclean): Remove ../cc1plus.
-
-Fri Feb 11 11:52:26 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Don't allow adjusting access to a field
- of a base class if a local field has the same name.
-
- * error.c (dump_type_prefix): Output basetype for METHOD_TYPEs.
-
-hu Jan 13 17:55:51 EST 1994 Gnanasekaran Swaminathan <gs4t@virginia.edu>
-
- * cp-tree.h (DESTRUCTOR_NAME_P): do not confuse AUTO_TEMP names
- with destructor names when either NO_DOLLAR_IN_LABEL or
- NO_DOT_IN_LABEL are not defined.
-
- Now `template <class T, T f(T&), const T*> class A {...}' works.
-
- * pt.c (grok_template_type): substitute template parm types
- with actual types in complex type as well.
- (coerce_template_parms): update the grok_template_type ()
- function call.
-
- * pt.c (tsubst): Traverse method list using DECL_CHAIN.
-
- * decl.c (grok_op_properties): Allow operator++/-- to have
- default arguments.
-
- * typeck2.c (store_init_value): Don't abort when called to
- initialize a type that needs constructing with a CONSTRUCTOR.
-
- * init.c (expand_aggr_init_1, CONSTRUCTOR case): If
- store_init_value fails, build and expand an INIT_EXPR. If
- store_init_value succeeds, call expand_decl_init.
-
-Fri Feb 11 02:49:23 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (build_vbase_path): Use complete_type_p instead of
- resolves_to_fixed_type_p to determine if the virtual bases are in
- their right place for the type of expr. Cures problem of thinking a
- virtual base class is one place, when it is in fact someplace else.
-
-Fri Feb 11 00:26:46 1994 Mike Stump <mrs@cygnus.com>
-
- * init.c (resolve_offset_ref): Make sure we first convert to
- intermediate type, if given, when dealing with members off `this'.
- Solves an incorrrect `type `foo' is not a base type for type
- `multiple'' when it is infact, a base type.
-
-Thu Feb 10 21:49:35 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (modify_other_vtable_entries): Use get_binfo, instead
- of binfo_value. Solves problem with compiler giving a `base class
- `B' ambiguous in binfo_value (compiler error)' on complex MI
- herarchies, when a virtual function is first defied in a virtual
- base class.
-
-Thu Feb 10 17:19:32 1994 Mike Stump <mrs@cygnus.com>
-
- * class.c (build_vbase_path): Don't complain about ambiguous
- intermediate conversion when converting down to a virtual base
- class, even if they might seem to be ambiguous.
-
-Thu Feb 10 12:18:26 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck2.c (build_functional_cast): #if 0 out constructor
- inheritance code, improve error messages.
-
- * class.c (finish_base_struct): Complain about base with only
- non-default constructors in derived class with no constructors.
-
- * decl.c (grokdeclarator): Fix detection of virtual new/delete.
-
-Wed Feb 9 22:02:32 1994 Mike Stump <mrs@cygnus.com>
-
- * search.c (build_mi_virtuals, add_mi_virtuals,
- report_ambiguous_mi_virtuals): Removed unneeded code.
- * class.c (finish_struct_bits): Likewise.
-
-Wed Feb 9 11:27:17 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * pt.c (end_template_instantiation): Push decl before
- pop_from_top_level.
-
- * typeck2.c (build_m_component_ref): Make sure datum is of
- aggregate type.
-
- * init.c (get_type_value): New function, returns
- IDENTIFIER_TYPE_VALUE or IDENTIFIER_CLASS_TYPE_VALUE or NULL_TREE.
-
- * call.c (build_method_call): Don't die on call to destructor for
- non-type.
-
- * decl.c (grokdeclarator): Complain about virtual op new and op
- delete, make static virtuals unvirtual instead of unstatic.
-
- * typeck.c (build_c_cast): Also call default_conversion on
- methods.
-
- * decl.c (grokdeclarator): Don't complain about anonymous
- bitfields.
-
- * parse.y (simple_stmt, for loops): Move the continue point after
- the cleanups.
-
- * class.c (finish_struct): Fix setting of
- TYPE_HAS_COMPLEX_INIT_REF.
-
-Tue Feb 8 13:21:40 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * init.c (build_new): Deal with `new double (1)'.
-
- * class.c (finish_struct): TYPE_HAS_COMPLEX_*_REF are supersets of
- TYPE_HAS_REAL_*_REF, but TYPE_HAS_COMPLEX_INIT_REF is independent of
- TYPE_NEEDS_CONSTRUCTING.
-
- * decl.c (duplicate_decls): Propagate access decls.
-
- * typeck2.c (process_init_constructor): Accept empty_init_node
- for initializing unions.
-
- * class.c, lex.c, cp-tree.h: Use
- TYPE_HAS_COMPLEX_ASSIGN_REF where TYPE_HAS_REAL_ASSIGN_REF was used
- before, use TYPE_HAS_COMPLEX_INIT_REF for TYPE_NEEDS_CONSTRUCTING in
- some places.
-
- * decl.c (finish_decl): Don't complain about uninitialized const
- if it was initialized before.
-
-Mon Feb 7 18:12:34 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * lex.c (default_assign_ref_body): Don't deal with vbases for
- now.
-
- * decl.c (finish_decl): Fix reversed logic for objects and other
- things that need to be constructed but have no initializer.
-
- * class.c (finish_struct): Don't set TYPE_HAS_* flags that are
- set by grok_op_properties or finish_decl.
-
- * decl.c: Don't warn about extern redeclared inline unless
- -Wextern-inline is given.
- * decl2.c (lang_decode_option): Likewise.
- * cp-tree.h: Likewise.
-
-Mon Feb 7 17:29:24 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (pushdecl_with_scope): Fix thinko. Add forward
- declaration.
-
- * decl.c (pushdecl_with_scope): New function.
- * decl.c (pushdecl_top_level): Use new function.
- * decl.c (pushtag): Initialize newdecl.
- * decl.c (pushtag): Push new type decl into correct scope.
-
-Mon Feb 7 14:42:03 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c, cvt.c, init.c, search.c, cp-tree.h:
- Eradicate LOOKUP_PROTECTED_OK.
-
-Mon Feb 7 13:57:19 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * decl.c (pushtag, xref_tag), cp-tree.h: Add extra parameter
- 'globalize' to signify implicit declarations.
- * decl.c (globalize_nested_type, maybe_globalize_type): Removed.
- * decl.c (set_identifier_type_value_with_scope): New function.
- * decl.c (set_identifier_local_value): Simplify.
- * spew.c (yylex, do_addr): Modify to return a _DEFN if a
- forward declaration (followed by ';' and not preceded by 'friend').
- * class.c, decl.c, except.c, init.c, parse.y,
- pt.c, search.c: Add new argument to calls to xref_tag and
- pushtag.
-
-Mon Feb 7 00:22:59 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-tree.h (ACCESSIBLY_UNIQUELY_DERIVED_P): New macro, means what
- ACCESSIBLY_DERIVED_FROM_P meant before.
- (ACCESSIBLY_DERIVED_FROM_P): Now disregards ambiguity.
-
- * cvt.c (build_up_reference): Call get_binfo with PROTECT == 1.
-
- * search.c (get_base_distance_recursive): Members and friends of
- a class X can implicitly convert an X* to a pointer to a private or
- protected immediate base class of X.
- (get_binfo_recursive): Likewise.
- (get_base_distance): Ignore ambiguity if PROTECT < 0.
- (get_binfo): Lose multiple values of PROTECT.
- (compute_access): Protected is OK if the start of the
- search is an accessible base class of current_class_type.
-
- * method.c (build_opfncall): Do check access on operator new here.
-
- * decl.c (finish_function): Don't check access on operator new
- here.
-
-Sun Feb 6 14:06:58 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (xref_tag): The base of a derived struct is NOT always
- public. Duh.
-
- * pt.c (do_explicit_instantiation): New function, called from
- parser to do explicit function instantiation.
- (type_unification): Allow the args list to be terminated with
- void_list_node.
- (do_pending_expansions): Look at i->interface for non-member
- templates.
-
- * parse.y (datadef): Move explicit_instantiation here.
- (structsp): From here.
- (datadef): Complain about `int;'.
-
-Sun Feb 6 12:33:18 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * pt.c (end_template_instantiation), cp-tree.h: Remove unused
- second parameter, and simplify first from a TREE_LIST where
- we only care about its TREE_VALUE to just the value (an IDENTIFIER).
- * pt.c (instantiate_member_templates): Simplify argument list
- from a TREE_LIST to just an IDENTIFIER.
- * lex.c (yyprint): PRE_PARSED_CLASS_DECL is now just an IDENTIFIER.
- * parse.y (template_instantiate_once): Simplify accordingly.
- * decl.c (inner_binding_level): New. Use various places to
- simplify.
-
-Sun Feb 6 02:49:37 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck2.c (build_functional_cast): int() -> int(0).
-
-Sat Feb 5 00:53:21 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Don't do a bitwise copy for op= if the
- class has a virtual function table.
-
- * typeck.c (convert_for_initialization): Restore warnings about
- not using defined op=. Should really be my_friendly_aborts, I
- s'pose.
-
-Fri Feb 4 14:21:00 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Tidy up conditions for doing bitwise
- copies of objects.
-
- * decl.c (build_default_constructor): #if 0 out.
-
- * *: Eradicate TYPE_GETS_{ASSIGNMENT,ASSIGN_REF,CONST_ASSIGN_REF,
- CONST_INIT_REF}, TYPE_HAS_REAL_CONSTRUCTOR.
-
- * decl.c (grokdeclarator): Don't return void_type_node for
- friends being defined here.
-
- * init.c (perform_member_init): Only do the init if it's useful.
-
- * lex.c (default_copy_constructor_body): If we don't need to do
- memberwise init, just call __builtin_memcpy.
- (default_assign_ref_body): Likewise.
-
- * decl.c (grokdeclarator): If friendp && virtualp, friendp = 0.
-
-Fri Feb 4 13:02:56 1994 Mike Stump <mrs@cygnus.com>
-
- * lex.c (reinit_parse_for_method, cons_up_default_function):
- Don't give warn_if_unknown_interface warning when it came from a
- system header file.
- * pt.c (end_template_decl, instantiate_template): Likewise.
- * decl.c (start_decl): Likewise.
-
-Fri Feb 4 00:41:21 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): Don't try to set TYPE_WAS_ANONYMOUS on
- enums.
-
- * decl2.c (constructor_name_full): Use IS_AGGR_TYPE_CODE instead of
- IS_AGGR_TYPE, since we don't know it's a type.
-
-Thu Feb 3 11:36:46 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokdeclarator): Don't complain about anonymous unions.
-
- * cp-tree.h (TYPE_WAS_ANONYMOUS): This struct was originally
- anonymous, but had a name given to it by a typedef.
-
- * decl.c (grokdeclarator): When renaming an anonymous struct, set
- TYPE_WAS_ANONYMOUS.
-
- * decl2.c (constructor_name_full): Use TYPE_WAS_ANONYMOUS.
-
- * cp-tree.h (DECL_UNDEFINED_FRIENDS): #if 0 out.
-
- * init.c (xref_friend): Don't set up DECL_UNDEFINED_FRIENDS.
- (embrace_waiting_friends): Don't use DECL_UNDEFINED_FRIENDS.
-
- * decl.c (grokdeclarator): Set TYPE_NESTED_NAME properly on nested
- anonymous structs that get typedef'd.
-
- * decl.c (grokdeclarator): Always return void_type_node for
- friends.
-
- * error.c (dump_function_decl): Don't use DECL_CLASS_CONTEXT for
- friends.
- (dump_function_decl): Don't print out default args for
- a function used in an expression.
-
- * decl.c (grokdeclarator): Give error on abstract declarator used
- in an invalid context (i.e. `void (*)();').
-
- * error.c (cp_line_of): Support _TYPE nodes.
- (cp_file_of): Likewise.
-
- * cvt.c (build_up_reference): Don't abort if passed a SAVE_EXPR;
- it can happen for the RHS of an assignment stmt where the LHS is
- a COND_EXPR.
-
- * init.c (expand_aggr_init_1): Deal with bracketed initializer
- lists properly.
-
- * class.c (finish_struct): Deal with enumerators and typedefs
- again.
-
-Wed Feb 2 11:30:22 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Tidy up loop over fields.
-
- * errfn.c (cp_thing): Don't advance twice after a format.
-
- * class.c (finish_struct): Complain about needing a constructor
- if a member has only non-default constructors, and don't try to
- generate a default constructor.
-
- * decl.c (finish_decl): Also do the constructor thing if
- TYPE_NEEDS_CONSTRUCTING is set (for arrays).
-
- * search.c (unuse_fields): New function: mark all fields in this
- type unused.
- (dfs_unuse_fields): Helper function.
-
- * class.c (pushclass): If the new class is the same as the old
- class, still unuse the fields.
- (unuse_fields): Move to search.c.
-
- * decl.c (grok_op_properties): Add friendp argument.
- (grokfndecl): Pass it.
- (start_method): Likewise.
-
- * decl2.c (delete_sanity): Add use_global_delete parameter to catch
- ::delete calls.
-
- * parse.y (unary_expr): Pass new parameter to delete_sanity.
-
- * lex.c (default_copy_constructor_body): Don't choke if the union
- has no fields.
- (default_assign_ref_body): Likewise.
-
- * call.c (compute_conversion_costs_ansi): Do the right thing for
- ellipsis matches.
-
- * decl.c (push_to_top_level): Optimize.
-
- * decl.c (start_function): Look for the lexical scope of a friend
- in DECL_CLASS_CONTEXT.
-
- * init.c (do_friend): Set DECL_CLASS_CONTEXT on global friends.
-
-Tue Feb 1 15:59:24 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-tree.h (TREE_GETS_PLACED_NEW): New macro.
-
- * init.c (init_init_processing): Don't assign BIN/BID to the
- IDENTIFIER_GLOBAL_VALUEs of their respective operators.
- (build_new): Check TREE_GETS_PLACED_NEW.
-
- * decl.c (grok_op_properties): Don't set TREE_GETS_NEW for a decl of
- op new with placement, set TREE_GETS_PLACED_NEW.
-
- * cp-tree.h (ANON_UNION_P): New macro. Applies to decls.
-
- * class.c (finish_struct): Don't treat anonymous unions like
- other aggregate members. Do synthesize methods for unions without
- a name, since they may or may not be "anonymous unions".
-
- * decl2.c (grok_x_components): Wipe out memory of synthesized methods
- in anonymous unions.
-
- * lex.c (default_copy_constructor_body): Support unions.
- (default_assign_ref_body): Likewise.
-
-Mon Jan 31 12:07:30 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-tree.h: Fix documentation of LOOKUP_GLOBAL, add prototypes.
-
- * error.c (args_as_string): New function (%A), like type_as_string
- except NULL_TREE -> "..."
-
- * call.c (build_overload_call_real): Fix for new overloading.
-
- * decl.c (grok_op_properties): Set all of the TYPE_OVERLOADS_* flags
- here.
-
- * parse.y (operator_name): Instead of here.
-
- * typeck2.c (build_functional_cast): Treat a TREE_LIST as a list
- of functions.
-
- * call.c (build_overload_call_real): Support LOOKUP_SPECULATIVELY.
-
- * method.c (build_opfncall): Don't need to massage return value
- any more, call build_overload_call with all flags.
-
- * typeck.c (build_x_binary_op): Put back speculative call to
- build_opfncall.
- (build_x_unary_op): Likewise.
- (build_x_conditional_expr): Likewise.
-
-Mon Jan 31 10:00:30 1994 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_type_conversion_1): Change call to pedwarn into
- warning, and conditionalize upon warn_cast_qual.
-
-Fri Jan 28 11:48:15 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * search.c (lookup_field): If xbasetype is a binfo, copy it to
- avoid clobbering its inheritance info.
-
- * call.c (build_method_call): Don't overwrite basetype_path with
- TYPE_BINFO (inst_ptr_basetype) if they have the same type.
-
- * search.c (compute_access): Fix handling of protected inheritance
- and friendship with the enclosing class.
-
- * typeck2.c (store_init_value): Allow passing of TREE_CHAIN for
- initialization of arbitrary variable.
-
- * typeck2.c (build_functional_cast): Only try calling a method if
- one exists.
-
- * decl.c (grokdeclarator): Move handling of constructor syntax
- initialization into first loop for generality.
- (parmlist_is_random): Lose.
-
- * lex.c (cons_up_default_function): Set TREE_PARMLIST on arguments
- to default function.
-
-Thu Jan 27 19:26:51 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (grokparms): Abort if we get called with something we don't
- expect.
-
-Thu Jan 27 17:37:25 1994 Mike Stump <mrs@cygnus.com>
-
- * call.c (build_overload_call_real): Change argument complain to
- flags to match style of rest of code. Pass it down to
- build_function_call_real as necessary.
- * call.c (build_overload_call, build_overload_call_maybe): Change
- argument complain to flags to match style of rest of code.
- * cp-tree.h (build_function_call_real): Added fourth flags
- argument.
- * cvt.c (convert_to_reference): Only give warning messages, if
- LOOKUP_COMPLAIN is set.
- * typeck.c (build_x_function_call): Change simple complain
- argument to build_overload_call_maybe and build_overload_call, to
- LOOKUP_COMPLAIN to match style of rest of code.
- * typeck2.c (build_functional_cast): Likewise.
- * typeck.c (build_function_call_real): Add flags, so that we can
- not complain, if we don't want to complain. Complain about
- arguments, if we are complaining, otherwise don't.
- * typeck.c (build_function_call, build_function_call_maybe):
- Stick in flags argument.
- * typeck.c (build_x_binary_op, build_x_unary_op,
- build_x_conditional_expr, build_x_compound_expr): Follow style of
- build_x_indirect_ref, as it is more correct and more common.
-
-Thu Jan 27 14:36:20 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (build_method_call): Don't check for being called with
- a pointer.
-
- * decl2.c (finish_file): Don't play with DECL_CLASS_CONTEXT for the
- static initializer function.
-
- * init.c (build_member_call): Use convert_force here, too.
-
- * search.c (compute_access): Only treat static members specially
- if they are referenced directly.
-
-Wed Jan 26 18:28:14 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * gxxint.texi (Access Control): New node.
-
- * search.c (current_scope): New function; returns whichever of
- current_class_type and current_function_decl is the most nested.
- (compute_access): Total overhaul to make it clearer and more
- correct. Don't use the cache for now; in the only situation where
- it was used before, it gained nothing. This frees up three of the
- DECL_LANG_FLAGs for possible other use!
-
- * cp-tree.h: #if 0 out DECL_PUBLIC & friends.
-
- * typeck.c (build_component_ref_1): Don't check DECL_PUBLIC.
-
- * call.c (build_method_call): Use convert_force to cast `this' --
- rely on the access checking for the method itself.
-
- * init.c (is_friend): Do the nesting thing, handle types. I am
- my own friend.
- (is_friend_type): Become a shell for is_friend.
- (add_friend): Never stick in ctype.
- Why are the friendship functions in init.c, anyway?
-
-Wed Jan 26 17:50:00 1994 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (build_type_conversion_1): Don't conditionalize call to
- pedwarn upon pedantic.
-
-Wed Jan 26 17:20:46 1994 Mike Stump <mrs@cygnus.com>
-
- * cvt.c (convert_to_reference): Add 8.4.3 checking so that one
- gets a warning if one tries to initialize a non-const & from a
- non-lvalue.
- * cvt.c (convert_to_reference): Use %P format for argument
- numbers in warnings.
-
-Wed Jan 26 14:35:06 1994 Mike Stump <mrs@cygnus.com>
-
- * init.c (build_delete): Follow style in call.c to construct the
- virtual call to the desctructor, as that code is right. Fixes a
- problem of the compiler saying a pointer conversion is ambiguous.
-
-Wed Jan 26 11:28:14 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-tree.h (VTABLE_NAME_P): Change other occurrence of
- VTABLE_NAME_FORMAT to VTABLE_NAME.
-
- * *: s/visibility/access/g
-
-Tue Jan 25 18:39:12 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_modify_expr): Don't smash references if INIT_EXPR.
-
-Tue Jan 25 13:54:29 1994 Mike Stump <mrs@cygnus.com>
-
- * init.c (build_delete): Back out Jan 17th & 18th pacthes, as
- they break libg++.
-
-Tue Jan 25 13:11:45 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * decl.c (duplicate_decls): Fix pointer arithmetic.
-
-Mon Jan 24 15:50:06 1994 Chip Salzenberg <chip@fin.uucp>
-
- [ cp-* changes propagated from c-* changes in 940114 snapshot ]
- * cp-parse.y (maybe_attribute): Allow multiple __attribute__
- clauses on a declaration.
-
-Mon Jan 24 17:06:23 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Do synthesize methods for anon
- structs, just not unions.
-
-Mon Jan 24 13:50:13 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * decl.c (xref_tag): handle anonymous nested type.
- * decl.c (globalize_nested_type): add no globalize bit check.
- * spew.c (hack_more_ids) : templated nested decl not push top
- level.
-
- * parse.y : get rid of 'goto do_components'. It is much better
- for debugging.
-
- * decl.c (is_anon_name): get rid of the function and use the
- macro ANON_AGGRNAME_P.
- * pt.c : ditto.
-
-Fri Jan 21 14:06:02 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct): Don't synthesize any methods for
- anonymous structs/unions.
-
- * typeck.c (build_modify_expr): Don't treat pmf's as class objects.
-
-Thu Jan 20 18:56:46 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * method.c (build_opfncall): Call build_indirect_ref on
- synthesized instance for operator delete.
-
- * pt.c (type_unification): Don't abort if called with a list of
- types in ARGS.
-
- * class.c (instantiate_type): Deal with function templates.
-
-Thu Jan 20 16:55:35 1994 Jim Wilson <wilson@sphagnum.cygnus.com>
-
- * Makefile.in (CC): Default to cc not gcc.
-
-Thu Jan 20 13:47:54 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_modify_expr): Call constructor if appropriate.
-
- * decl.c (push_to_top_level): Clear out class-level bindings cache.
-
-Wed Jan 19 13:51:22 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * call.c (resolve_scope_to_name): Work recursively (previously only
- looked down one level).
-
- * lex.c (do_pending_inlines): If we're still dealing with the last
- batch of inlines, don't start working on a new one.
-
- * Makefile.in (stamp-parse): Update conflict count.
- (TAGS): Fix.
-
- * parse.y (explicit_instantiation): New rule; implements
- 'template A<int>' syntax (though not 'template foo(int)' yet).
- (structsp): Add explicit_instantiation.
-
-Tue Jan 18 13:53:05 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * class.c (finish_struct, etc.): Simplify decision to synthesize
- a destructor.
-
- * call.c, class.c, cp-tree.h, decl.c, init.c,
- ptree.c, search.c, typeck.c, typeck2.c: Nuke
- TYPE_NEEDS_CONSTRUCTOR (change all calls to TYPE_NEEDS_CONSTRUCTING).
- * init.c (expand_aggr_init_1): Don't try non-constructor methods
- of initializing objects.
- (build_new): Don't try other methods if the constructor lookup fails.
-
- * class.c (finish_base_struct): Set cant_have_default_ctor and
- cant_synth_copy_ctor properly.
- (finish_struct): Likewise.
-
-Mon Jan 17 13:58:18 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * typeck.c (build_modify_expr_1): #if 0 out again.
- (build_modify_expr): #if 0 out memberwise init code again.
-
- * lex.c (default_copy_constructor_body): Be const-correct.
- (default_assign_ref_body): Likewise.
-
- * init.c (perform_member_init): Use TYPE_HAS_CONSTRUCTOR to decide
- whether or not to use it, rather than TYPE_NEEDS_CONSTRUCTING.
- (expand_aggr_init): Disable silent conversion from initializer list
- to list of args for a constructor.
-
- * class.c (base_info): Lose needs_default_ctor.
- (finish_base_struct): Likewise.
- (finish_struct): Likewise.
-
- * decl.c (init_decl_processing): Don't turn off flag_default_inline
- just because flag_no_inline is on.
- (finish_decl): Use TYPE_HAS_CONSTRUCTOR to decide to use
- constructor.
-
- * class.c (finish_struct): Synthesize default ctor whenever
- allowed.
-
- * Makefile.in (TAGS): Don't try to run etags on cp-parse.y.
-
-Sat Jan 15 18:34:33 1994 Mike Stump <mrs@cygnus.com>
-
- * Makefile.in, configure: Handle the C++ front-end in a
- subdirectory.
- * cp-*: Move C++ front-end to cp/*.
-
-Fri Jan 14 14:09:37 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-typeck.c (build_function_call_real): Modify to match other
- instances of taking the address of the function.
-
- * cp-class.c (finish_struct): Set TYPE_HAS_REAL_CONSTRUCTOR to 1 if
- there are non-synthesized constructors.
- Only set TYPE_NEEDS_CONSTRUCTOR if TYPE_HAS_REAL_CONSTRUCTOR.
- Always generate copy constructor if possible.
-
- * cp-tree.h (lang_type): Add has_real_constructor bitfield.
- (TYPE_HAS_REAL_CONSTRUCTOR): Define.
-
- * cp-lex.c (default_copy_constructor_body): Use init syntax
- for all bases.
-
- * cp-type2.c (store_init_value): Only give error for initializer list
- if TYPE_HAS_REAL_CONSTRUCTOR.
-
-Thu Jan 13 15:38:29 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-tree.h (DECL_SYNTHESIZED): Add defn.
- (lang_decl): Add synthesized bitfield to decl_flags.
-
- * cp-lex.c (cons_up_default_function): Use DECL_SYNTHESIZED to mark
- artificial methods, rather than a line # of 0.
-
-Fri Jan 14 18:25:29 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * cp-decl (xref_tag): fix a bug in conflict type.
- * cp-parse.y : add SCOPED_NAME for uninstantiated template nested
- type reference.
- * cp-spew.c (yylex) : generated SCOPED_NAME token.
- * cp-lex.c (yyprint): handle SCOPED_NAME.
-
-Fri Jan 14 17:00:29 1994 Mike Stump <mrs@cygnus.com>
-
- * cp-decl.c (pushdecl): Revert patch from Jan 11 19:33:03, as it is
- not right.
-
-Thu Jan 13 14:00:35 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * cp-decl2.c (grok_x_components): fix a bug that enum type does not
- have type_flags.
-
-Thu Jan 13 11:39:34 1994 Mike Stump <mrs@cygnus.com>
-
- Ensure that all vtable pointers are initialized with all the right
- values.
-
- * cp-class.c (is_normal): Changed to reflect new meaning of
- CLASSTYPE_VFIELD_PARENT.
- * cp-class.c (maybe_fixup_vptrs): Use of
- CLASSTYPE_NEEDS_VIRTUAL_REINIT here is misguided. Use
- BINFO_MODIFIED instead.
- * cp-class.c (finish_struct): Changed to reflect new meaning of
- CLASSTYPE_VFIELD_PARENT.
- * cp-decl.c (get_binfo_from_vfield): Removed, unneeded now.
- * cp-decl.c (finish_function): Use init_vtbl_ptrs, instead of open
- coding it here.
- * cp-init.c (init_vfields): Changed name to init_vtbl_ptrs, and
- re-implement.
- * cp-init.c (emit_base_init): Use new name init_vtbl_ptrs.
- * cp-tree.h (vfield_parent): Changed to integer.
- * cp-tree.h (CLASSTYPE_VFIELD_PARENT): Changed docs to reflect new
- meaning.
- * cp-tree.h (init_vtbl_ptrs): Added init_vtbl_ptrs.
-
-Wed Jan 12 18:24:16 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * cp-decl.c (xref_tag): re-implement globalize nested type.
- * cp-decl2.c (grok_x_components): ditto.
- * cp-parse.y: ditto.
- * cp-tree.h (lang_type): add no_globalize bit in type_flags.
-
-Wed Jan 12 14:08:09 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-decl.c (grokdeclarator): Don't set TREE_PUBLIC on friend
- decls with a definition attached.
-
- * cp-typeck.c (build_modify_expr): Undo previous change in the case
- of INIT_EXPRs.
-
-Tue Jan 11 19:33:03 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-typeck.c (build_modify_expr): Replace code for generating
- assignment semantics for classes with an error.
- (build_modify_expr_1): #if 0 out.
-
- * cp-decl.c (pushdecl): Patch bogus design of pushdecl
- behavior for overloaded functions (it doesn't push anything).
-
- * cp-class.c (finish_struct): When generating default op=,
- set TYPE_HAS_ASSIGNMENT.
-
-Mon Jan 10 18:48:06 1994 Mike Stump <mrs@cygnus.com>
-
- * cp-cvt.c (convert): Make {double, clashing enum} -> enum
- invalid.
- * cp-typeck.c (convert_for_assignment): Simplify.
- * cp-decl2.c (warn_enum_clash): Removed.
- * invoke.texi (-Wenum-clash): Removed.
- * toplev.c (-Wenum-clash): Removed.
-
-Mon Jan 10 17:48:37 1994 Kung Hsu <kung@mexican.cygnus.com>
-
- * cp-decl.c (finish_decl): fix incorrect popclass call.
-
- * cp-decl.c (is_anon_name): new function, check whether the name
- is anonymous name generated by compiler.
- * cp-decl.c (grokdeclarator): allow nested SCOPE_REF
- * cp-spew.c (hack_more_ids): handle nested type in template.
- * cp-parse.y : handle nested type reference in uninstantiated
- template.
- * cp-call.c (build_method_call): handle uninstantiated template
- case.
- * cp-pt.c (search_nested_type_in_tmpl): new function, search nested
- type in template.
- * cp-pt.c (lookup_nested_type_by_name): new function, lookup nested
- type by name.
- * cp-pt.c (tsubst): handle nested type search by name.
-
-Mon Jan 10 14:32:18 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-init.c (build_member_call): Propagate qualifiers to new type.
-
- * cp-call.c (build_method_call): Count functions the new way.
-
-Fri Jan 7 19:03:26 1994 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-decl.c (pushtag): Set DECL_ASSEMBLER_NAME for nested classes,
- too.
-
-Tue Jan 4 16:45:51 1994 Kung Hsu <kung@cirdan.cygnus.com>
-
- * cp-parse.y: change to handle whether to globalize nested class.
- * cp-decl.c(xref_tag, maybe_globalize_type): Likewise.
-
-Mon Jan 3 22:22:32 1994 Gerald Baumgartner <gb@cygnus.com>
-
- * Makefile.in cp-call.c cp-class.c cp-cvt.c cp-decl.c cp-decl2.c
- cp-error.c cp-init.c cp-lex.c cp-lex.h cp-method.c cp-parse.y
- cp-spew.c cp-tree.c cp-tree.h cp-type2.c cp-typeck.c cp-xref.c
- gplus.gperf toplev.c: Incorporated C++ signature extension.
- * cp-sig.c: New file, contains most of signature processing.
- * cp-hash.h: Regenerated from gplus.gperf.
-
- * gcc.1 g++.1: Added explanation for the `-fhandle-signatures'
- and `-fno-handle-signatures' command line flags.
-
- * gcc.texi: Changed the last-modification date.
- * invoke.texi: Added `-fhandle-signatures' in the list of
- C++ language options. Added explanation for this option.
-
-Tue Dec 28 21:10:03 1993 Mike Stump <mrs@cygnus.com>
-
- * cp-init.c (expand_vec_init): Remove comptypes test, as it is too
- harsh here.
-
-Tue Dec 28 13:42:22 1993 Mike Stump <mrs@cygnus.com>
-
- * cp-pt.c (do_pending_expansions): Decide to expand a template
- member function, based upon it's class type, not the class type of
- the first place it was declared.
-
-Tue Dec 28 05:42:31 1993 Mike Stump <mrs@cygnus.com>
-
- * cp-class.c (is_normal): New routine, use to determine when the
- given binfo is the normal one. (The one that should have the simple
- vtable name.)
- * cp-class.c (modify_other_vtable_entries): Use DECL_ASSEMBLER_NAME
- to check if two fndecls are `the same'. Sometimes this routine can
- modify the main vtable, and normal should be 1, in that case, so use
- is_normal() to determine if this is the main vtable for the class.
- Don't recurse down virtual bases, as they are shared, and we take
- care of them elsewhere.
- * cp-class.c (modify_vtable_entries): If we have already updated the
- vtable with the new virtual, don't do it again.
- * cp-class.c (finish_struct): Set CLASSTYPE_VFIELD_PARENT as
- appropriate. Do virtual function overriding in virtual bases, after
- normal overriding, so that the base function list in DECL_VINDEX is
- not overridden, before we have a chance to run through the list.
- Use DECL_ASSEMBLER_NAME to check if two fndecls are `the same'.
- Make sure we pass the right address into modify_vtable_entries.
- * cp-tree.h (CLASSTYPE_VFIELD_PARENT): New field to indicate which
- binfo is the one that has the vtable that we based our vtable on.
-
-Fri Dec 24 09:40:52 1993 Michael Tiemann <tiemann@blues.cygnus.com>
-
- * cp-typeck.c (c_expand_start_case): Use default_conversion to
- convert expression from reference type if necessary.
-
-Wed Dec 22 17:58:43 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-typeck.c (build_unary_op): Make sure that it's a TREE_LIST before
- trying to read its TREE_VALUE.
-
- * cp-class.c (finish_struct_methods): Clear DECL_IN_AGGR_P here.
- (finish_struct): Instead of here.
-
-Tue Dec 21 14:34:25 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.c (list_hash_lookup_or_cons): Make sure the type doesn't
- have TYPE_PTRMEMFUNC_P set before we try to build its
- CLASSTYPE_ID_AS_LIST.
- (get_decl_list): Likewise, when trying to read it.
-
- * cp-tree.h (VTABLE_NAME): No def with NO_{DOLLAR,DOT} defined.
- (VTABLE_NAME_P): Use it instead of VTABLE_NAME_FORMAT.
-
-Mon Dec 20 13:35:03 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-typeck.c (rationalize_conditional_expr): New function.
- (unary_complex_lvalue): Use it.
- (build_modify_expr): Use it, since trying to do an ADDR_EXPR of it
- with build_unary_op won't cut it. Don't wrap the COND_EXPR with a
- SAVE_EXPR either.
-
- * cp-decl2.c (explicit_warn_return_type): Deleted variable.
- (lang_decode_option): Set warn_return_type, not explicit_*, for
- -Wreturn-type and -Wall. This is what rest_of_compilation uses to
- decide if it should go into jump_optimize or not.
- * cp-tree.h (explicit_warn_return_type): Deleted.
- * cp-decl.c (grokdeclarator): Use warn_return_type, not explicit_*.
- (finish_function): Also complain about no return in a non-void fn if
- we're being pedantic (don't rely on use of -Wreturn-type).
-
-Fri Dec 17 15:45:46 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-decl.c (grokdeclarator): Forbid declaration of a function as
- static if it's being done inside another function.
-
- * cp-search.c (compute_visibility): Check for friendship both ways.
-
-Fri Dec 17 14:28:25 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-cvt.c (build_default_binary_type_conversion): Make error
- messages more helpful.
-
- * cp-error.c (op_as_string): New function, returns "operator =="
- given EQ_EXPR or suchlike.
-
-Fri Dec 17 13:28:11 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-call.c (print_n_candidates): New function.
- (build_overload_call_real): Use it when we complain about a call
- being ambiguous.
-
-Fri Dec 17 12:41:17 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-call.c (build_method_call): Fix checking for static call
- context.
-
- * cp-method.c (build_opfncall): Call build_indirect_ref on argument
- to operator new.
-
- * cp-init.c (build_new): Don't mess with rval when building
- indirect ref.
-
-Thu Dec 16 16:48:05 1993 Kung Hsu <kung@cirdan.cygnus.com>
-
- * cp-lex.c (default_assign_ref_body): add check when TYPE_NESTED_
- NAME(type) may not be exist. It's not a problem for old compiler.
-
-Thu Dec 16 14:46:06 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (CLASSTYPE_ALTERS_VISIBILITIES_P): Delete macro, it's
- never used for anything.
- (struct lang_type, member type_flags): Delete field
- `alters_visibility', and up `dummy' by 1.
- * cp-class.c (finish_base_struct): Delete code that copies the
- setting of CLASSTYPE_ALTERS_VISIBILITIES_P.
- (finish_struct): Delete code that sets it.
-
-Thu Dec 16 14:44:39 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-decl.c, cp-init.c, cp-typeck.c: Fix arguments to
- build_method_call that I messed up before.
-
- * cp-search.c (get_base_distance): If protect > 1, allow immediate
- private base.
-
- * cp-class.c (finish_base_struct): Set cant_synth_* correctly.
- (finish_struct): Likewise. Well, nigh-correctly; it won't deal
- properly with the case where a class contains an object of an
- ambiguous base class which has a protected op=. Should be fixed
- when the access control code gets overhauled.
- (finish_struct_methods): Set TYPE_HAS_NONPUBLIC_* correctly.
-
-Thu Dec 16 12:17:06 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-lex.c (real_yylex): Turn the code back on that deals with
- __FUNCTION__ and __PRETTY_FUNCTION__. Don't use lookup_name, to
- avoid the ambiguity problems that led to it being turned off in the
- first place.
-
- * cp-method.c (hack_identifier): Also check for a TYPE_PTRMEMFUNC_P
- to see if something is a method.
-
-Wed Dec 15 18:35:58 1993 Mike Stump <mrs@cygnus.com>
-
- * cp-typeck.c (build_modify_expr): Avoid error messages on small
- enum bit fields.
- * cp-typeck.c (convert_for_assignment): Add missing argument to
- cp_warning and cp_pedwarn calls.
-
-Wed Dec 15 18:25:32 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-parse.y (member_init): ANSI C++ doesn't forbid old-style base
- initializers; it's just anachronistic.
-
- * cp-decl.c (finish_decl): Don't require external-linkage arrays
- to have a complete type at declaration time when pedantic.
-
-Tue Dec 14 11:37:23 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-decl.c (pushdecl): Don't set DECL_CONTEXT if it's already set.
-
- * cp-call.c (build_method_call): Don't dereference pointer given
- as instance.
-
- * cp-decl.c (finish_function): Don't pass pointer to
- build_method_call.
- (finish_function): Likewise.
-
- * cp-typeck.c (build_x_function_call): Likewise.
-
- * cp-method.c (build_component_type_expr): Likewise.
-
- * cp-init.c (build_member_call): Likewise.
- (build_new): Likewise.
-
-Mon Dec 13 18:04:33 1993 Kung Hsu <kung@cirdan.cygnus.com>
-
- * cp-decl.c (xref_tag): fix regression created by changes made
- in Dec. 7 1993.
- * cp-decl.c (xref_defn_tag): fix parallel nested class problem.
-
-Fri Dec 10 12:40:25 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-call.c (compute_conversion_costs_ansi) [DEBUG_MATCHING]: Print
- out the final evaluation of the function, so we can see if ELLIPSIS,
- USER, and EVIL were set at the end.
-
- * cp-call.c (convert_harshness_ansi): When the parm isn't an lvalue,
- only go for setting TRIVIAL_CODE if we are dealing with types that
- are compatible.
-
-Thu Dec 9 18:27:22 1993 Mike Stump <mrs@cygnus.com>
-
- * cp-decl.c (flag_huge_objects): New flag to allow large objects.
- * toplev.c (lang_options): Likewise.
- * cp-decl2.c (flag_huge_objects, lang_f_options): Likewise.
- * cp-decl.c (delta_type_node): New type for delta entries.
- * cp-tree.h (delta_type_node): Likewise.
- * cp-decl.c (init_decl_processing): Setup delta_type_node.
- * cp-decl.c (init_decl_processing, build_ptrmemfunc_type): Use
- delta_type_node instead of short_integer_type_node.
- * cp-class.c (build_vtable_entry): Likewise.
-
-Thu Dec 9 16:19:05 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-tree.h (OPERATOR_TYPENAME_P): Define outside of
- NO_{DOLLAR,DOT} macro checks, so it always gets defined.
- (VTABLE_NAME_P): Define for NO_DOT && NO_DOLLAR_IN_LABEL.
-
-Wed Dec 8 17:38:06 1993 Mike Stump <mrs@cygnus.com>
-
- * cp-decl.c (finish_decl): Make sure things that can go into
- "common", do go into common, if -fcommon is given.
-
-Wed Dec 8 13:01:54 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-call.c (print_harshness) [DEBUG_MATCHING]: New function.
- (compute_conversion_costs_ansi) [DEBUG_MATCHING]: Print out
- argument matching diagnostics to make instantly clear what the
- compiler is doing.
-
- * cp-call.c (convert_harshness_ansi): If the parm isn't an lvalue,
- then check to see if the penalty was increased due to
- signed/unsigned mismatch, and use a TRIVIAL_CODE if it wasn't.
-
-Tue Dec 7 18:29:14 1993 Kung Hsu <kung@cirdan.cygnus.com>
-
- * cp-decl.c (xref_tag, pushtag): Fix nested class search/resolution
- problem.
-
-Tue Dec 7 16:09:34 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-class.c (finish_struct): Before synthesizing methods, if no
- methods have yet been declared then set nonprivate_method. Don't
- set non_private method after synthesizing a method.
-
- * cp-lex.c (extract_interface_info): If flag_alt_external_templates
- is set, tie emitted code to the location of template instantiation,
- rather than definition.
-
- * cp-tree.h: Declare flag_alt_external_templates.
-
- * cp-decl2.c (lang_decode_option): Support -falt-external-templates.
-
- * toplev.c (lang_options): Likewise.
-
-Mon Oct 4 12:50:02 1993 Chip Salzenberg <chip@fin.uucp>
-
- [changes propagated from 930810 snapshot]
- * cp-decl.c (init_decl_processing): Make long long available for use
- as SIZE_TYPE and PTRDIFF_TYPE.
- (finish_decl): Allow file-scope static incomplete array.
- (grokdeclarator): Don't pass on const and volatile fron function
- value type to function type.
- Warn here for volatile fn returning non-void type.
- * cp-parse.y (attrib): Accept attributes `volatile' with alias
- `noreturn', and `const'.
- * cp-typeck.c (default_conversion): Don't lose const and volatile.
- (build_binary_op_nodefault): Generate pedantic warning for comparison
- of complete pointer type with incomplete pointer type.
- (build_c_cast): Be careful that null pointer constant be INTEGER_CST.
-
-Tue Dec 7 10:46:48 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-init.c (expand_vec_init): When creating a temporary for copying
- arrays, use the type of the source, not the target.
-
- * cp-cvt.c (convert): Pass an argument for errtype to
- convert_to_reference.
-
- * cp-error.c (dump_expr, COMPONENT_REF & CALL_EXPR): Deal with
- methods, -> and `this'.
-
-Mon Dec 6 17:12:33 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-error.c (parm_as_string): New function; returns `this' or arg
- number. Corresponds to %P.
- (dump_expr): Deal with method calls.
-
- * cp-cvt.c (convert_to_reference): Stop using warn_for_assignment.
- * cp-typeck.c (convert_for_assignment): Likewise.
- (warn_for_assignment): Lose.
-
-Mon Dec 6 11:33:35 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-call.c (ideal_candidate_ansi): Delete code that was never
- doing anything useful. Instead, sort once, and DO NOT wipe
- out any codes with EVIL_CODE, since that's what we use as a
- marker for the end of the list of candidates.
-
- * cp-cvt.c (convert_to_aggr): Make sure to always set H_LEN.
-
-Mon Dec 6 12:49:17 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-init.c (get_aggr_from_typedef): New function, like
- is_aggr_typedef but returns the _TYPE.
-
- * cp-call.c, cp-init.c, cp-method.c: Eradicate err_name.
-
-Sun Dec 5 18:12:48 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-lex.c (readescape): Pedwarn when a hex escape is out of range.
-
-Thu Nov 25 23:50:19 1993 Chip Salzenberg <chip@fin.uucp>
-
- Delay language context change until beginning of next decl.
-
- * cp-lex.h (c_header_level): Removed.
- (pending_lang_change): Declared.
- * cp-lex.c (c_header_level): Renamed from in_c_header, made static.
- (pending_lang_change): Defined.
- (check_newline): Rework code that recognizes line number and
- filename changes. Instead of pushing and popping lang context,
- increment and decrement pending_lang_change.
- (do_pending_lang_change): Push and pop lang context according
- to value of pending_lang_change.
- * cp-parse.y (extdefs): Use lang_extdef instead of extdef.
- (extdef): Same as extdef, but call do_pending_lang_change() first.
-
-Mon Nov 15 15:39:15 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp-typeck.c (build_binary_op_nodefault): Warn for ordered
- compare of ptr with 0 only if pedantic in both cases.
-
-Thu Nov 25 13:31:37 1993 Chip Salzenberg <chip@fin.uucp>
-
- Reinstate the below patch, which got lost in the Cygnus merge:
- Tue Nov 23 13:59:24 1993 Hallvard B Furuseth (hbf@durin.uio.no)
- * cp-parse.y (maybe_type_qual): Don't fail to set $$.
-
-Wed Nov 17 19:03:30 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp-parse.y (attrib): Allow "ident(ident)" like the C front end.
-
-Fri Oct 22 20:43:37 1993 Paul Eggert <eggert@twinsun.com>
-
- * cp-lex.c (real_yylex): Diagnose floating point constants
- that are too large.
-
-Wed Nov 17 19:10:37 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp-type2.c (build_functional_cast): ARM page 16: When a class
- and an object, function or enumerator are declared in the same
- scope with the same name, the class name is hidden.
-
-Wed Nov 17 19:07:18 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp-call.c (convert_harshness_ansi): Distinguish float, double,
- and long double from each other when overloading.
- (compute_conversion_costs_{ansi,old}, build_method_call,
- build_overlay_call_real, convert_to_aggr): Always set and
- always use H_LEN member of candidate structure.
-
-Mon Oct 11 23:10:53 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp-decl.c (duplicate_decls): Note redeclarations of library
- functions, and generate distinct warnings for them.
-
-Mon Oct 4 12:26:49 1993 Chip Salzenberg <chip@fin.uucp>
-
- Support format warnings in G++.
-
- * cp-tree.h: Protect against multiple inclusion.
- Declare all public functions in c-common.c (copy from c-tree.h).
- (STDIO_PROTO): Define.
- (warn_format): Declare.
- (record_format_info): Remove declaration.
- * cp-decl.c (init_decl_processing): Call init_function_format_info.
- * cp-decl2.c (lang_decode_option): Make "-Wall" include warn_format.
- * cp-typeck.c (build_function_call_real): Call check_function_format.
- (record_format_info): Remove -- obsolete stub.
-
-Sat Jul 24 12:04:29 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp-decl.c (duplicate_decls): Don't warn for non-extern var decl
- following an extern one (for -Wredundant-decls).
- * cp-parse.y (primary): In statement expression case, if compstmt
- returns something other than a BLOCK, return it unchanged.
-
-Thu Dec 2 20:44:58 1993 Chip Salzenberg <chip@fin.uucp>
-
- * cp-decl.c (warn_extern_redeclared_static): New function made
- from code extracted from pushdecl.
- (duplicate_decls, pushdecl): Call new function.
- (lookup_name_current_level): Allow for IDENTIFIER_GLOBAL_VALUE
- to be a TREE_LIST when function is declared in 'extern "C" {}'.
-
-Fri Dec 3 16:01:10 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-class.c (duplicate_tag_error): Use cp_error.
- (finish_base_struct): Check for ambiguity with direct base, and don't
- generate op= or copy ctor if it exists.
-
-Fri Dec 3 15:32:34 1993 Kung Hsu <kung@cirdan.cygnus.com>
-
- * cp-init.c (expand_member_init): when initializer name is null,
- don't try to build it now because emit_base_init will handle it.
-
-Fri Dec 3 12:28:59 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-lex.c (init_lex): Initialize input_filename to "<internal>" for
- code such as ExceptionHandler::operator=.
-
-Fri Dec 3 10:32:08 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-decl.c (grokdeclarator): Don't try to print out dname when
- complaining about arrays of references if decl_context==TYPENAME,
- since it will be null.
-
- * cp-decl2.c: Default to flag_ansi_overloading.
-
-Thu Dec 2 18:05:56 1993 Kung Hsu <kung@cirdan.cygnus.com>
-
- * cp-call.c (build_method_call): use binfo from instance if it's
- different from binfo (basetype_path) passed from above.
-
-Wed Nov 17 19:14:29 1993 Chip Salzenberg <chip@fin.uucp>
-
- cp-error.c (dump_expr): Use unsigned chars to output a
- TREE_REAL_CST in hex.
-
-Thu Dec 2 11:05:48 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-class.c (finish_struct): Fix typo in setting
- cant_synth_asn_ref.
-
- * cp-tree.h (TYPE_NESTED_NAME): New macro, does
- DECL_NESTED_TYPENAME (TYPE_NAME (NODE)).
-
- * cp-lex.c (default_copy_constructor_body): Change
- DECL_NAME (TYPE_NAME (btype)) to TYPE_NESTED_NAME (btype).
- (default_assign_ref_body): Likewise.
- (default_copy_constructor_body): Call operator= explicitly for
- base classes that have no constructor.
-
-Thu Dec 2 10:47:15 1993 Michael Tiemann <tiemann@blues.cygnus.com>
-
- * cp-call.c (build_method_call): If the instance variable is
- converted to error_mark_node when we're trying to convert it to the
- base type of a method we're looking up, return error_mark_node.
-
-Thu Dec 2 10:41:16 1993 Torbjorn Granlund <tege@cygnus.com>
-
- * cp-typeck.c (build_binary_op_nodefault): In *_DIV_EXPR *_MOD_EXPR
- cases, tests for unsigned operands by peeking inside a NOP_EXPR.
-
-Wed Dec 1 13:33:34 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-call.c (compute_conversion_costs_ansi): Use the size of struct
- harshness_code, not the size of short, for clearing out the
- ansi_harshness.
-
- * cp-call.c (print_candidates): New function.
- (build_method_call): When we had some candidates, but didn't get a
- usable match, don't report that we got an error with the first
- candidate. Instead, say there were no matches, and list the
- candidates with print_candidates. In the second pass, make sure we
- clear out ever_seen, so we can accurately count the number of
- functions that qualified.
-
-Wed Dec 1 09:53:59 1993 Torbjorn Granlund <tege@cygnus.com>
-
- * cp-typeck.c (build_binary_op_nodefault): Shorten for *_MOD_EXPR
- only if op1 is known to be != -1.
- (build_binary_op_nodefault): Handle *_DIV_EXPR likewise.
-
-Tue Nov 30 14:07:26 1993 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cp-method.c (hack_identifier): If the field itself is private, and
- not from a private base class, say so.
-
-Mon Nov 29 03:00:56 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-decl.c (grokdeclarator): Always warn on initialization of
- const member.
-
-Wed Nov 24 00:49:35 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-class.c (finish_struct): Set TYPE_GETS_CONST_* properly.
- (finish_base_struct): Set cant_synth_asn_ref properly.
-
- * cp-lex.c (cons_up_default_function): Add section for operator=.
- (default_assign_ref_body): New function, mostly cribbed from
- default_copy_constructor_body.
-
- * cp-class.c (base_info): Add members cant_synth_copy_ctor,
- cant_synth_asn_ref, no_const_asn_ref.
- (finish_base_struct): Update no_const_asn_ref, note that you should
- update cant_synth_*, propagate TYPE_GETS_ASSIGN_REF.
- (finish_struct): Add decls for cant_synth_*, no_const_asn_ref, and
- initialize them properly. Set no_const_asn_ref properly. Set
- cant_synth_* in some of the situations where they should be set.
- Propagate TYPE_GETS_ASSIGN_REF. Use cant_synth_copy_ctor. Add call
- to cons_up_default_function for operator=.
-
-Tue Nov 23 20:24:58 1993 Mike Stump <mrs@cygnus.com>
-
- * cp-cvt.c (convert_force): Add code to perform casting of pointer
- to member function types.
- * cp-typeck.c (build_ptrmemfunc): Add FORCE parameter to indicate
- when the conversion should be done, regardless.
- * cp-tree.h (build_ptrmemfunc): Likewise.
- * cp-type2.c (digest_init): Likewise.
- * cp-typeck.c (convert_for_assignment): Likewise.
-
-Tue Nov 23 18:06:58 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-error.c (dump_expr): Do the right thing for variables of
- reference type.
-
- * cp-decl.c (grok_op_properties): Set TYPE_HAS_ASSIGN_REF
- and its kin properly.
- (xref_tag): Propagate TYPE_GETS_ASSIGN_REF.
-
-Tue Nov 23 12:26:13 1993 Mike Stump <mrs@cygnus.com>
-
- * cp-method.c (build_opfncall): Don't count pointer to member
- functions as aggregates here, as we don't want to look up methods in
- them. The compiler would core dump if we did, as they don't have
- normal names.
- * cp-typeck.c (build_indirect_ref): Improve wording on error
- message.
-
-Mon Nov 22 14:22:23 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-decl.c (grok_op_properties): Allow operator?: with pedwarn
- (since it's supported in other compiler bits).
-
- * cp-method.c (report_type_mismatch): Use cp_error; ignore err_name
- argument.
-
- * cp-error.c (dump_function_decl): Don't print return type for
- constructors and destructors.
-
- * cp-cvt.c (cp_convert_to_pointer): Import code from
- convert_to_pointer so we can return error_mark_node in the case of an
- error, and to allow more meaningful error messages.
- (build_type_conversion): Don't go through void* when trying
- to convert to a pointer type.
-
- * cp-decl.c (grokfndecl): Move call to grok_op_properties back
- after grokclassfn so that it's dealing with the right decl.
- (grok_op_properties): Don't assert !methodp for op new and op delete.
-
- * cp-init.c (build_delete): Don't use TYPE_BUILT_IN (there are now
- no uses of it in the compiler).
-
- * cp-call.c (build_scoped_method_call): Fix for destructors of simple
- types.
- (build_method_call): Likewise.
-
-Fri Nov 19 12:59:38 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-tree.c (count_functions): Abstraction function.
-
- * cp-call.c (build_overload_call_real): Deal with new overloading
- properly, remove dead code.
-
- * gcc.c (default_compilers): Generate and use .ii files in the
- intermediate stage of compiling C++ source.
-
-Fri Nov 19 11:26:09 1993 Jim Wilson <wilson@sphagnum.cygnus.com>
-
- * cp-expr.c (cplus_expand_expr): Make call_target a valid memory
- address before using it, so it can be later safely compared.
-
-Fri Nov 12 15:30:27 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-pt.c (tsubst): Deal with new overloading.
-
- * cp-typeck.c (fntype_p): is the arg function type?
- (comp_target_parms): pedwarn on conversion from (anything) to (...).
- (build_x_function_call): Deal with new overloading.
-
- * cp-tree.c (decl_list_length): Deal with new overloading.
- (decl_value_member): Like value_member, but for DECL_CHAINs.
-
- * cp-decl.c (duplicate_decls): Deal with new overloading.
- (start_decl): Likewise.
-
- * cp-class.c (instantiate_type): Deal with new overloading.
-
- * cp-call.c (convert_harshness_ansi): Deal with new overloading.
- (convert_harshness_old): Deal with new overloading.
- (build_overload_call_real): Likewise.
-
-Mon Nov 8 13:50:49 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-tree.c (get_unique_fn): New function; returns FUNCTION_DECL
- if unambiguous, NULL_TREE otherwise.
- (get_first_fn): Returns the first appropriate FUNCTION_DECL.
- (is_overloaded_fn): Returns whether or not the passed tree is
- a function or list of functions.
-
- * cp-init.c (init_init_processing): use `get_first_fn' to find
- the FUNCTION_DEFN for new and delete.
-
- * cp-decl.c (push_overloaded_decl): Use new overloading strategy, cut
- code size in half (I spit on special cases).
-
-Tue Sep 7 20:03:33 1993 Jason Merrill <jason@deneb.cygnus.com>
-
- * cp-decl.c: Allow references and template type parameters as well
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
deleted file mode 100644
index 2dcfe43425c..00000000000
--- a/gcc/cp/Make-lang.in
+++ /dev/null
@@ -1,274 +0,0 @@
-# Top level makefile fragment for GNU C++.
-# Copyright (C) 1994, 1995 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.distdir,
-# 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.
-
-# Extra flags to pass to recursive makes.
-CXX_FLAGS_TO_PASS = \
- "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
- "CXXFLAGS=$(CXXFLAGS)" \
- "CXX_FOR_TARGET=$(CXX_FOR_TARGET)"
-
-# Actual names to use when installing a native compiler.
-CXX_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t`
-GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t`
-
-# Actual names to use when installing a cross-compiler.
-CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
-GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t`
-
-# The name to use for the demangler program.
-DEMANGLER_PROG = c++filt
-
-# Extra headers to install.
-CXX_EXTRA_HEADERS = $(srcdir)/cp/inc/typeinfo $(srcdir)/cp/inc/exception \
- $(srcdir)/cp/inc/new $(srcdir)/cp/inc/new.h
-
-# Extra code to include in libgcc2.
-CXX_LIB2FUNCS = tinfo.o tinfo2.o new.o new1.o new2.o exception.o
-CXX_LIB2SRCS = $(srcdir)/cp/new.cc $(srcdir)/cp/new1.cc $(srcdir)/cp/new2.cc \
- $(srcdir)/cp/exception.cc $(srcdir)/cp/tinfo.cc \
- $(srcdir)/cp/tinfo2.cc $(srcdir)/cp/tinfo.h
-
-# Define the names for selecting c++ in LANGUAGES.
-# Note that it would be nice to move the dependency on g++
-# into the C++ rule, but that needs a little bit of work
-# to do the right thing within all.cross.
-C++ c++: cc1plus
-
-# Tell GNU make to ignore these if they exist.
-.PHONY: C++ c++
-
-g++.c: $(srcdir)/gcc.c
- -rm -f $@
- ln -s $(srcdir)/gcc.c $@ || cp $(srcdir)/gcc.c $@
-
-g++spec.o: $(srcdir)/cp/g++spec.c
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/cp/g++spec.c
-
-# N.B.: This is a copy of the gcc.o rule, with -DLANG_SPECIFIC_DRIVER added.
-# It'd be nice if we could find an easier way to do this---rather than have
-# to track changes to the toplevel gcc Makefile as well.
-# We depend on g++.c last, to make it obvious where it came from.
-g++.o: $(CONFIG_H) multilib.h config.status $(lang_specs_files) g++.c
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(DRIVER_DEFINES) \
- -DLANG_SPECIFIC_DRIVER \
- -c g++.c
-
-# Create the compiler driver for g++.
-g++$(exeext): g++.o g++spec.o version.o choose-temp.o pexecute.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ g++.o g++spec.o version.o \
- choose-temp.o pexecute.o $(EXTRA_GCC_OBJS) $(LIBS)
-
-# Create a version of the g++ driver which calls the cross-compiler.
-g++-cross$(exeext): g++$(exeext)
- -rm -f g++-cross$(exeext)
- cp g++$(exeext) g++-cross$(exeext)
-
-cxxmain.o: cplus-dem.c demangle.h
- rm -f cxxmain.c
- ln -s $(srcdir)/cplus-dem.c cxxmain.c > /dev/null 2>&1 \
- || cp $(srcdir)/cplus-dem.c cxxmain.c
- $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DVERSION=\"$(version)\" cxxmain.c
- rm -f cxxmain.c
-
-$(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(LIBS) -o $@ \
- cxxmain.o underscore.o getopt.o getopt1.o
-
-CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
- $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \
- $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \
- $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \
- $(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \
- $(srcdir)/cp/errfn.c $(srcdir)/cp/rtti.c $(srcdir)/cp/method.c \
- $(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \
- $(srcdir)/cp/error.c $(srcdir)/cp/friend.c $(srcdir)/cp/init.c \
- $(srcdir)/cp/parse.y $(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c \
- $(srcdir)/cp/repo.c
-
-cc1plus: $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o
- cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus
-
-# Build hooks:
-
-c++.all.build: g++$(exeext) $(DEMANGLER_PROG)
-c++.all.cross: g++-cross$(exeext) $(DEMANGLER_PROG)
-c++.start.encap: g++$(exeext)
-c++.rest.encap: $(DEMANGLER_PROG)
-
-c++.info:
-c++.dvi:
-
-# C++ language-support library pieces for libgcc.
-tinfo.o: cc1plus $(srcdir)/cp/tinfo.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/tinfo.cc
-tinfo2.o: cc1plus $(srcdir)/cp/tinfo2.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/tinfo2.cc
-exception.o: cc1plus $(srcdir)/cp/exception.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
- -c -O0 -fexceptions $(srcdir)/cp/exception.cc
-new.o: cc1plus $(srcdir)/cp/new.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new.cc
-new1.o: cc1plus $(srcdir)/cp/new1.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new1.cc
-new2.o: cc1plus $(srcdir)/cp/new2.cc
- $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) \
- -c $(srcdir)/cp/new2.cc
-
-# We want to update cplib2.txt if any of the source files change...
-cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS) cplib2.ready
- if [ -f cc1plus ]; then \
- echo $(CXX_LIB2FUNCS) > cplib2.new; \
- else \
- echo "" > cplib2.new; \
- fi
- mv -f cplib2.new cplib2.txt
-
-# Or if it would be different.
-cplib2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs
- @if [ -r cplib2.txt ]; then \
- if [ -f cc1plus ]; then \
- echo $(CXX_LIB2FUNCS) > cplib2.new; \
- else \
- echo "" > cplib2.new; \
- fi; \
- if cmp -s cplib2.new cplib2.txt; then true; else \
- touch cplib2.ready; \
- fi; \
- rm -f cplib2.new; \
- else true ; \
- fi
- @if [ -f cplib2.ready ]; then true; else \
- touch cplib2.ready; \
- fi
-
-# Install hooks:
-# cc1plus is installed elsewhere as part of $(COMPILERS).
-
-# Nothing to do here.
-c++.install-normal:
-
-# Install the driver program as $(target)-g++
-# and also as either g++ (if native) or $(tooldir)/bin/g++.
-c++.install-common:
- -if [ -f cc1plus$(exeext) ] ; then \
- if [ -f g++-cross$(exeext) ] ; then \
- rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
- $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
- chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \
- rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \
- ln $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) \
- > /dev/null 2>&1 \
- || cp $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext) ; \
- else \
- rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
- $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
- chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
- rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
- ln $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) \
- > /dev/null 2>&1 \
- || cp $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext) ; \
- fi ; \
- fi
-
-c++.install-info:
-
-c++.install-man: $(srcdir)/cp/g++.1
- -if [ -f cc1plus$(exeext) ] ; then \
- if [ -f g++-cross$(exeext) ] ; then \
- rm -f $(mandir)/$(GXX_CROSS_NAME)$(manext); \
- $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_CROSS_NAME)$(manext); \
- chmod a-x $(mandir)/$(GXX_CROSS_NAME)$(manext); \
- else \
- rm -f $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
- $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
- chmod a-x $(mandir)/$(GXX_INSTALL_NAME)$(manext); \
- fi; \
- else true; fi
-
-c++.uninstall:
- -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext)
- -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext)
- -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext)
- -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext)
- -rm -rf $(mandir)/$(GXX_INSTALL_NAME)$(manext)
- -rm -rf $(mandir)/$(GXX_CROSS_NAME)$(manext)
-
-# Clean hooks:
-# A lot of the ancillary files are deleted by the main makefile.
-# We just have to delete files specific to us.
-
-c++.mostlyclean:
- -rm -f cp/*$(objext) $(DEMANGLER_PROG)
-c++.clean:
- -rm -f cplib2.txt cplib2.ready
-c++.distclean:
- -rm -f cp/config.status cp/Makefile
- -rm -f cp/parse.output
-c++.extraclean:
-c++.maintainer-clean:
- -rm -f cp/parse.c cp/parse.h
-
-# Stage hooks:
-# The main makefile has already created stage?/cp.
-
-c++.stage1: stage1-start
- -mv cp/*$(objext) stage1/cp
-c++.stage2: stage2-start
- -mv cp/*$(objext) stage2/cp
-c++.stage3: stage3-start
- -mv cp/*$(objext) stage3/cp
-c++.stage4: stage4-start
- -mv cp/*$(objext) stage4/cp
-
-# Maintenance hooks:
-
-# This target creates the files that can be rebuilt, but go in the
-# distribution anyway. It then copies the files to the distdir directory.
-c++.distdir:
- mkdir tmp/cp
- cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h
- cd cp; \
- for file in *[0-9a-zA-Z+]; do \
- ln $$file ../tmp/cp >/dev/null 2>&1 || cp $$file ../tmp/cp; \
- done
diff --git a/gcc/cp/Makefile.in b/gcc/cp/Makefile.in
deleted file mode 100644
index 03ba91a500f..00000000000
--- a/gcc/cp/Makefile.in
+++ /dev/null
@@ -1,264 +0,0 @@
-# Makefile for GNU C++ compiler.
-# Copyright (C) 1987, 88, 90-4, 1995 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.
-
-# The makefile built from this file lives in the language subdirectory.
-# Its purpose is to provide support for:
-#
-# 1) recursion where necessary, and only then (building .o's), and
-# 2) building and debugging cc1 from the language subdirectory, and
-# 3) nothing else.
-#
-# The parent makefile handles all other chores, with help from the
-# language makefile fragment, of course.
-#
-# The targets for external use are:
-# all, TAGS, ???mostlyclean, ???clean.
-
-# Suppress smart makes who think they know how to automake Yacc files
-.y.c:
-
-# Variables that exist for you to override.
-# See below for how to change them for certain systems.
-
-ALLOCA =
-
-# Various ways of specifying flags for compilations:
-# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
-# BOOT_CFLAGS is the value of CFLAGS to pass
-# to the stage2 and stage3 compilations
-# XCFLAGS is used for most compilations but not when using the GCC just built.
-XCFLAGS =
-CFLAGS = -g
-BOOT_CFLAGS = -O $(CFLAGS)
-# These exists to be overridden by the x-* and t-* files, respectively.
-X_CFLAGS =
-T_CFLAGS =
-
-X_CPPFLAGS =
-T_CPPFLAGS =
-
-CC = cc
-BISON = bison
-BISONFLAGS =
-LEX = flex
-LEXFLAGS =
-AR = ar
-AR_FLAGS = rc
-SHELL = /bin/sh
-MAKEINFO = makeinfo
-TEXI2DVI = texi2dvi
-
-# Define this as & to perform parallel make on a Sequent.
-# Note that this has some bugs, and it seems currently necessary
-# to compile all the gen* files first by hand to avoid erroneous results.
-P =
-
-# This is used in the definition of SUBDIR_USE_ALLOCA.
-# ??? Perhaps it would be better if it just looked for *gcc*.
-OLDCC = cc
-
-# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
-# It omits XCFLAGS, and specifies -B./.
-# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
-GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS)
-
-# Tools to use when building a cross-compiler.
-# These are used because `configure' appends `cross-make'
-# to the makefile when making a cross-compiler.
-
-target= ... `configure' substitutes actual target name here.
-xmake_file= ... `configure' substitutes actual x- file name here.
-tmake_file= ... `configure' substitutes actual t- file name here.
-#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
-#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
-
-# Directory where sources are, from where we are.
-srcdir = .
-
-# Additional system libraries to link with.
-CLIB=
-
-# Change this to a null string if obstacks are installed in the
-# system library.
-OBSTACK=obstack.o
-
-# Choose the real default target.
-ALL=all
-
-# End of variables for you to override.
-
-# Definition of `all' is here so that new rules inserted by sed
-# do not specify the default target.
-all: all.indirect
-
-# This tells GNU Make version 3 not to put all variables in the environment.
-.NOEXPORT:
-
-# sed inserts variable overrides after the following line.
-####target overrides
-####host overrides
-####cross overrides
-####build overrides
-
-# Now figure out from those variables how to compile and link.
-
-all.indirect: Makefile ../cc1plus
-
-# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
-INTERNAL_CFLAGS = $(CROSS) -DIN_GCC
-
-# This is the variable actually used when we compile.
-ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
-
-# Likewise.
-ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
-
-# Even if ALLOCA is set, don't use it if compiling with GCC.
-
-SUBDIR_OBSTACK = `if [ x$(OBSTACK) != x ]; then echo ../$(OBSTACK); else true; fi`
-SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac`
-SUBDIR_MALLOC = `if [ x$(MALLOC) != x ]; then echo ../$(MALLOC); else true; fi`
-
-# How to link with both our special library facilities
-# and the system's installed libraries.
-LIBS = $(SUBDIR_OBSTACK) $(SUBDIR_USE_ALLOCA) $(SUBDIR_MALLOC) $(CLIB)
-
-# Specify the directories to be searched for header files.
-# Both . and srcdir are used, in that order,
-# so that tm.h and config.h will be found in the compilation
-# subdirectory rather than in the source directory.
-INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config
-
-# Always use -I$(srcdir)/config when compiling.
-.c.o:
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
-
-# This tells GNU make version 3 not to export all the variables
-# defined in this file into the environment.
-.NOEXPORT:
-
-# Lists of files for various purposes.
-
-# Language-specific object files for g++
-
-CXX_OBJS = call.o decl.o errfn.o expr.o pt.o sig.o typeck2.o \
- class.o decl2.o error.o lex.o parse.o ptree.o rtti.o spew.o typeck.o cvt.o \
- except.o friend.o init.o method.o search.o tree.o xref.o repo.o
-
-# Language-independent object files.
-OBJS = `cat ../stamp-objlist` ../c-common.o ../c-pragma.o
-OBJDEPS = ../stamp-objlist ../c-common.o ../c-pragma.o
-
-compiler: ../cc1plus
-../cc1plus: $(P) $(CXX_OBJS) $(OBJDEPS) $(LIBDEPS)
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
- $(CXX_OBJS) $(OBJS) $(LIBS)
-
-Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure
- cd ..; $(SHELL) config.status
-
-native: config.status ../cc1plus
-
-# Compiling object files from source files.
-
-# Note that dependencies on obstack.h are not written
-# because that file is not part of GCC.
-
-# C++ language specific files.
-
-RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
- $(srcdir)/../machmode.h $(srcdir)/../machmode.def
-TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
- $(srcdir)/../machmode.h $(srcdir)/../machmode.def
-CXX_TREE_H = $(TREE_H) cp-tree.h cp-tree.def
-PARSE_H = $(srcdir)/parse.h
-PARSE_C = $(srcdir)/parse.c
-
-parse.o : $(PARSE_C) $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h
- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
- `echo $(PARSE_C) | sed 's,^\./,,'`
-
-CONFLICTS = expect 16 shift/reduce conflicts and 39 reduce/reduce conflicts.
-$(PARSE_H) : $(PARSE_C)
-$(PARSE_C) : $(srcdir)/parse.y
- @echo $(CONFLICTS)
- cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o parse.c parse.y
- cd $(srcdir); grep '^#define[ ]*YYEMPTY' parse.c >>parse.h
-#$(PARSE_C) $(PARSE_H) : stamp-parse ; @true
-#stamp-parse: $(srcdir)/parse.y
-# @echo $(CONFLICTS)
-# $(BISON) $(BISONFLAGS) -d $(srcdir)/parse.y
-# grep '^#define[ ]*YYEMPTY' y.tab.c >>y.tab.h
-# $(srcdir)/../move-if-change y.tab.c $(PARSE_C)
-# $(srcdir)/../move-if-change y.tab.h $(PARSE_H)
-# cp $(PARSE_C) y.tab.c
-# touch stamp-parse
-
-# hash.h really depends on $(srcdir)/gxx.gperf.
-# But this would screw things for people that don't have gperf,
-# if gxx.gpref got touched, say.
-# Thus you have to remove hash.h to force it to be re-made.
-$(srcdir)/hash.h:
- gperf -p -j1 -g -o -t -N is_reserved_word '-k1,4,7,$$' \
- $(srcdir)/gxx.gperf >$(srcdir)/hash.h
-
-spew.o : spew.c $(CONFIG_H) $(CXX_TREE_H) \
- $(PARSE_H) $(srcdir)/../flags.h lex.h
-lex.o : lex.c $(CONFIG_H) $(CXX_TREE_H) \
- $(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h $(srcdir)/../c-pragma.h
-decl.o : decl.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
- lex.h decl.h $(srcdir)/../stack.h
-decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
- lex.h decl.h
-typeck2.o : typeck2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h
-typeck.o : typeck.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H)
-class.o : class.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h
-call.o : call.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h class.h
-friend.o : friend.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H)
-init.o : init.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H)
-method.o : method.c $(CONFIG_H) $(CXX_TREE_H) class.h
-cvt.o : cvt.c $(CONFIG_H) $(CXX_TREE_H) class.h
-search.o : search.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../stack.h $(srcdir)/../flags.h
-tree.o : tree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h
-ptree.o : ptree.c $(CONFIG_H) $(CXX_TREE_H)
-rtti.o : rtti.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h
-except.o : except.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) $(srcdir)/../except.h
-expr.o : expr.c $(CONFIG_H) $(CXX_TREE_H) $(RTL_H) $(srcdir)/../flags.h \
- $(srcdir)/../expr.h ../insn-codes.h
-xref.o : xref.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../input.h
-pt.o : pt.c $(CONFIG_H) $(CXX_TREE_H) decl.h $(PARSE_H) lex.h
-error.o : error.c $(CONFIG_H) $(CXX_TREE_H)
-errfn.o : errfn.c $(CONFIG_H) $(CXX_TREE_H)
-sig.o : sig.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h
-repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H)
-
-# These exist for maintenance purposes.
-
-# Update the tags table.
-TAGS: force
- cd $(srcdir) ; \
- etags *.c *.h ; \
- echo 'l' | tr 'l' '\f' >> TAGS ; \
- echo 'parse.y,0' >> TAGS ; \
- etags -a ../*.h ../*.c;
-
-.PHONY: TAGS
-
-force:
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
deleted file mode 100644
index df4ced9af19..00000000000
--- a/gcc/cp/call.c
+++ /dev/null
@@ -1,5860 +0,0 @@
-/* Functions related to invoking methods and overloaded functions.
- Copyright (C) 1987, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.com) and
- hacked by Brendan Kehoe (brendan@cygnus.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. */
-
-
-/* High-level class interface. */
-
-#include "config.h"
-#include "tree.h"
-#include <stdio.h>
-#include "cp-tree.h"
-#include "class.h"
-#include "output.h"
-#include "flags.h"
-
-#include "obstack.h"
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void sorry ();
-
-extern int inhibit_warnings;
-extern tree ctor_label, dtor_label;
-
-/* Compute the ease with which a conversion can be performed
- between an expected and the given type. */
-
-static struct harshness_code convert_harshness PROTO((register tree, register tree, tree));
-static tree build_new_method_call PROTO((tree, tree, tree, tree, int));
-
-#define EVIL_RETURN(ARG) ((ARG).code = EVIL_CODE, (ARG))
-#define STD_RETURN(ARG) ((ARG).code = STD_CODE, (ARG))
-#define QUAL_RETURN(ARG) ((ARG).code = QUAL_CODE, (ARG))
-#define TRIVIAL_RETURN(ARG) ((ARG).code = TRIVIAL_CODE, (ARG))
-#define ZERO_RETURN(ARG) ((ARG).code = 0, (ARG))
-
-/* Ordering function for overload resolution. Compare two candidates
- by gross quality. */
-
-int
-rank_for_overload (x, y)
- struct candidate *x, *y;
-{
- if (y->h.code & (EVIL_CODE|ELLIPSIS_CODE|USER_CODE))
- return y->h.code - x->h.code;
- if (x->h.code & (EVIL_CODE|ELLIPSIS_CODE|USER_CODE))
- return -1;
-
- /* This is set by compute_conversion_costs, for calling a non-const
- member function from a const member function. */
- if ((y->harshness[0].code & CONST_CODE) ^ (x->harshness[0].code & CONST_CODE))
- return y->harshness[0].code - x->harshness[0].code;
-
- if (y->h.code & STD_CODE)
- {
- if (x->h.code & STD_CODE)
- return y->h.distance - x->h.distance;
- return 1;
- }
- if (x->h.code & STD_CODE)
- return -1;
-
- return y->h.code - x->h.code;
-}
-
-/* Compare two candidates, argument by argument. */
-
-static int
-rank_for_ideal (x, y)
- struct candidate *x, *y;
-{
- int i;
-
- if (x->h_len != y->h_len)
- abort ();
-
- for (i = 0; i < x->h_len; i++)
- {
- if (y->harshness[i].code - x->harshness[i].code)
- return y->harshness[i].code - x->harshness[i].code;
- if ((y->harshness[i].code & STD_CODE)
- && (y->harshness[i].distance - x->harshness[i].distance))
- return y->harshness[i].distance - x->harshness[i].distance;
-
- /* They're both the same code. Now see if we're dealing with an
- integral promotion that needs a finer grain of accuracy. */
- if (y->harshness[0].code & PROMO_CODE
- && (y->harshness[i].int_penalty ^ x->harshness[i].int_penalty))
- return y->harshness[i].int_penalty - x->harshness[i].int_penalty;
- }
- return 0;
-}
-
-/* TYPE is the type we wish to convert to. PARM is the parameter
- we have to work with. We use a somewhat arbitrary cost function
- to measure this conversion. */
-
-static struct harshness_code
-convert_harshness (type, parmtype, parm)
- register tree type, parmtype;
- tree parm;
-{
- struct harshness_code h;
- register enum tree_code codel;
- register enum tree_code coder;
- int lvalue;
-
- h.code = 0;
- h.distance = 0;
- h.int_penalty = 0;
-
-#ifdef GATHER_STATISTICS
- n_convert_harshness++;
-#endif
-
- if (TREE_CODE (parmtype) == REFERENCE_TYPE)
- {
- if (parm)
- parm = convert_from_reference (parm);
- parmtype = TREE_TYPE (parmtype);
- lvalue = 1;
- }
- else if (parm)
- lvalue = lvalue_p (parm);
- else
- lvalue = 0;
-
- if (TYPE_PTRMEMFUNC_P (type))
- type = TYPE_PTRMEMFUNC_FN_TYPE (type);
- if (TYPE_PTRMEMFUNC_P (parmtype))
- parmtype = TYPE_PTRMEMFUNC_FN_TYPE (parmtype);
-
- codel = TREE_CODE (type);
- coder = TREE_CODE (parmtype);
-
- if (TYPE_MAIN_VARIANT (parmtype) == TYPE_MAIN_VARIANT (type))
- return ZERO_RETURN (h);
-
- if (coder == ERROR_MARK)
- return EVIL_RETURN (h);
-
- if (codel == REFERENCE_TYPE)
- {
- tree ttl, ttr;
- int constp = parm ? TREE_READONLY (parm) : TYPE_READONLY (parmtype);
- int volatilep = (parm ? TREE_THIS_VOLATILE (parm)
- : TYPE_VOLATILE (parmtype));
- register tree intype = TYPE_MAIN_VARIANT (parmtype);
- register enum tree_code form = TREE_CODE (intype);
- int penalty = 0;
-
- ttl = TREE_TYPE (type);
-
- /* Only allow const reference binding if we were given a parm to deal
- with, since it isn't really a conversion. This is a hack to
- prevent build_type_conversion from finding this conversion, but
- still allow overloading to find it. */
- if (! lvalue && ! (parm && TYPE_READONLY (ttl)))
- return EVIL_RETURN (h);
-
- if ((TYPE_READONLY (ttl) < constp)
- || (TYPE_VOLATILE (ttl) < volatilep))
- return EVIL_RETURN (h);
-
- /* When passing a non-const argument into a const reference, dig it a
- little, so a non-const reference is preferred over this one. */
- penalty = ((TYPE_READONLY (ttl) > constp)
- + (TYPE_VOLATILE (ttl) > volatilep));
-
- ttl = TYPE_MAIN_VARIANT (ttl);
-
- if (form == OFFSET_TYPE)
- {
- intype = TREE_TYPE (intype);
- form = TREE_CODE (intype);
- }
-
- ttr = intype;
-
- if (TREE_CODE (ttl) == ARRAY_TYPE && TREE_CODE (ttr) == ARRAY_TYPE)
- {
- if (comptypes (ttl, ttr, 1))
- return ZERO_RETURN (h);
- return EVIL_RETURN (h);
- }
-
- h = convert_harshness (ttl, ttr, NULL_TREE);
- if (penalty && h.code == 0)
- {
- h.code = QUAL_CODE;
- h.int_penalty = penalty;
- }
- return h;
- }
-
- if (codel == POINTER_TYPE && fntype_p (parmtype))
- {
- tree p1, p2;
- struct harshness_code h1, h2;
-
- /* Get to the METHOD_TYPE or FUNCTION_TYPE that this might be. */
- type = TREE_TYPE (type);
-
- if (coder == POINTER_TYPE)
- {
- parmtype = TREE_TYPE (parmtype);
- coder = TREE_CODE (parmtype);
- }
-
- if (coder != TREE_CODE (type))
- return EVIL_RETURN (h);
-
- if (type != parmtype && coder == METHOD_TYPE)
- {
- tree ttl = TYPE_METHOD_BASETYPE (type);
- tree ttr = TYPE_METHOD_BASETYPE (parmtype);
-
- int b_or_d = get_base_distance (ttr, ttl, 0, (tree*)0);
- if (b_or_d < 0)
- {
- b_or_d = get_base_distance (ttl, ttr, 0, (tree*)0);
- if (b_or_d < 0)
- return EVIL_RETURN (h);
- h.distance = -b_or_d;
- }
- else
- h.distance = b_or_d;
- h.code = STD_CODE;
-
- type = build_function_type
- (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type)));
- parmtype = build_function_type
- (TREE_TYPE (parmtype), TREE_CHAIN (TYPE_ARG_TYPES (parmtype)));
- }
-
- /* We allow the default conversion between function type
- and pointer-to-function type for free. */
- if (comptypes (type, parmtype, 1))
- return h;
-
- if (pedantic)
- return EVIL_RETURN (h);
-
- /* Compare return types. */
- p1 = TREE_TYPE (type);
- p2 = TREE_TYPE (parmtype);
- h2 = convert_harshness (p1, p2, NULL_TREE);
- if (h2.code & EVIL_CODE)
- return h2;
-
- h1.code = TRIVIAL_CODE;
- h1.distance = 0;
-
- if (h2.distance != 0)
- {
- tree binfo;
-
- /* This only works for pointers. */
- if (TREE_CODE (p1) != POINTER_TYPE
- && TREE_CODE (p1) != REFERENCE_TYPE)
- return EVIL_RETURN (h);
-
- p1 = TREE_TYPE (p1);
- p2 = TREE_TYPE (p2);
- /* Don't die if we happen to be dealing with void*. */
- if (!IS_AGGR_TYPE (p1) || !IS_AGGR_TYPE (p2))
- return EVIL_RETURN (h);
- if (h2.distance < 0)
- binfo = get_binfo (p2, p1, 0);
- else
- binfo = get_binfo (p1, p2, 0);
-
- if (! BINFO_OFFSET_ZEROP (binfo))
- {
-#if 0
- static int explained = 0;
- if (h2.distance < 0)
- message_2_types (sorry, "cannot cast `%s' to `%s' at function call site", p2, p1);
- else
- message_2_types (sorry, "cannot cast `%s' to `%s' at function call site", p1, p2);
-
- if (! explained++)
- sorry ("(because pointer values change during conversion)");
-#endif
- return EVIL_RETURN (h);
- }
- }
-
- h1.code |= h2.code;
- if (h2.distance > h1.distance)
- h1.distance = h2.distance;
-
- p1 = TYPE_ARG_TYPES (type);
- p2 = TYPE_ARG_TYPES (parmtype);
- while (p1 && TREE_VALUE (p1) != void_type_node
- && p2 && TREE_VALUE (p2) != void_type_node)
- {
- h2 = convert_harshness (TREE_VALUE (p1), TREE_VALUE (p2),
- NULL_TREE);
- if (h2.code & EVIL_CODE)
- return h2;
-
- if (h2.distance)
- {
- /* This only works for pointers and references. */
- if (TREE_CODE (TREE_VALUE (p1)) != POINTER_TYPE
- && TREE_CODE (TREE_VALUE (p1)) != REFERENCE_TYPE)
- return EVIL_RETURN (h);
- h2.distance = - h2.distance;
- }
-
- h1.code |= h2.code;
- if (h2.distance > h1.distance)
- h1.distance = h2.distance;
- p1 = TREE_CHAIN (p1);
- p2 = TREE_CHAIN (p2);
- }
- if (p1 == p2)
- return h1;
- if (p2)
- {
- if (p1)
- return EVIL_RETURN (h);
- h1.code |= ELLIPSIS_CODE;
- return h1;
- }
- if (p1)
- {
- if (TREE_PURPOSE (p1) == NULL_TREE)
- h1.code |= EVIL_CODE;
- return h1;
- }
- }
- else if (codel == POINTER_TYPE && coder == OFFSET_TYPE)
- {
- tree ttl, ttr;
-
- /* Get to the OFFSET_TYPE that this might be. */
- type = TREE_TYPE (type);
-
- if (coder != TREE_CODE (type))
- return EVIL_RETURN (h);
-
- ttl = TYPE_OFFSET_BASETYPE (type);
- ttr = TYPE_OFFSET_BASETYPE (parmtype);
-
- if (ttl == ttr)
- h.code = 0;
- else
- {
- int b_or_d = get_base_distance (ttr, ttl, 0, (tree*)0);
- if (b_or_d < 0)
- {
- b_or_d = get_base_distance (ttl, ttr, 0, (tree*)0);
- if (b_or_d < 0)
- return EVIL_RETURN (h);
- h.distance = -b_or_d;
- }
- else
- h.distance = b_or_d;
- h.code = STD_CODE;
- }
-
- /* Now test the OFFSET_TYPE's target compatibility. */
- type = TREE_TYPE (type);
- parmtype = TREE_TYPE (parmtype);
- }
-
- if (coder == UNKNOWN_TYPE)
- {
- if (codel == FUNCTION_TYPE
- || codel == METHOD_TYPE
- || (codel == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)))
- return TRIVIAL_RETURN (h);
- return EVIL_RETURN (h);
- }
-
- if (coder == VOID_TYPE)
- return EVIL_RETURN (h);
-
- if (codel == BOOLEAN_TYPE)
- {
- if (INTEGRAL_CODE_P (coder) || coder == REAL_TYPE)
- return STD_RETURN (h);
- else if (coder == POINTER_TYPE || coder == OFFSET_TYPE)
- {
- /* Make this worse than any conversion to another pointer.
- FIXME this is how I think the language should work, but it may not
- end up being how the language is standardized (jason 1/30/95). */
- h.distance = 32767;
- return STD_RETURN (h);
- }
- return EVIL_RETURN (h);
- }
-
- if (INTEGRAL_CODE_P (codel))
- {
- /* Control equivalence of ints an enums. */
-
- if (codel == ENUMERAL_TYPE
- && flag_int_enum_equivalence == 0)
- {
- /* Enums can be converted to ints, but not vice-versa. */
- if (coder != ENUMERAL_TYPE
- || TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (parmtype))
- return EVIL_RETURN (h);
- }
-
- /* else enums and ints (almost) freely interconvert. */
-
- if (INTEGRAL_CODE_P (coder))
- {
- if (TYPE_MAIN_VARIANT (type)
- == TYPE_MAIN_VARIANT (type_promotes_to (parmtype)))
- {
- h.code = PROMO_CODE;
- }
- else
- h.code = STD_CODE;
-
- return h;
- }
- else if (coder == REAL_TYPE)
- {
- h.code = STD_CODE;
- h.distance = 0;
- return h;
- }
- }
-
- if (codel == REAL_TYPE)
- {
- if (coder == REAL_TYPE)
- {
- if (TYPE_MAIN_VARIANT (type)
- == TYPE_MAIN_VARIANT (type_promotes_to (parmtype)))
- h.code = PROMO_CODE;
- else
- h.code = STD_CODE;
-
- return h;
- }
- else if (INTEGRAL_CODE_P (coder))
- {
- h.code = STD_CODE;
- h.distance = 0;
- return h;
- }
- }
-
- /* Convert arrays which have not previously been converted. */
- if (coder == ARRAY_TYPE)
- {
- coder = POINTER_TYPE;
- if (parm)
- {
- parm = decay_conversion (parm);
- parmtype = TREE_TYPE (parm);
- }
- else
- parmtype = build_pointer_type (TREE_TYPE (parmtype));
- }
-
- /* Conversions among pointers */
- if (codel == POINTER_TYPE && coder == POINTER_TYPE)
- {
- register tree ttl = TYPE_MAIN_VARIANT (TREE_TYPE (type));
- register tree ttr = TYPE_MAIN_VARIANT (TREE_TYPE (parmtype));
- int penalty = 4 * (ttl != ttr);
-
- /* Anything converts to void *. Since this may be `const void *'
- (etc.) use VOID_TYPE instead of void_type_node. Otherwise, the
- targets must be the same, except that we do allow (at some cost)
- conversion between signed and unsigned pointer types. */
-
- if ((TREE_CODE (ttl) == METHOD_TYPE
- || TREE_CODE (ttl) == FUNCTION_TYPE)
- && TREE_CODE (ttl) == TREE_CODE (ttr))
- {
- if (comptypes (ttl, ttr, -1))
- {
- h.code = penalty ? STD_CODE : 0;
- h.distance = 0;
- }
- else
- h.code = EVIL_CODE;
- return h;
- }
-
-#if 1
- if (TREE_CODE (ttl) != VOID_TYPE
- && (TREE_CODE (ttr) != VOID_TYPE || !parm || !null_ptr_cst_p (parm)))
- {
- if (comp_target_types (type, parmtype, 1) <= 0)
- return EVIL_RETURN (h);
- }
-#else
- if (!(TREE_CODE (ttl) == VOID_TYPE
- || TREE_CODE (ttr) == VOID_TYPE
- || (TREE_UNSIGNED (ttl) ^ TREE_UNSIGNED (ttr)
- && (ttl = unsigned_type (ttl),
- ttr = unsigned_type (ttr),
- penalty = 10, 0))
- || (comp_target_types (ttl, ttr, 0) > 0)))
- return EVIL_RETURN (h);
-#endif
-
- if (ttr == ttl)
- {
- tree tmp1 = TREE_TYPE (type), tmp2 = TREE_TYPE (parmtype);
-
- h.code = 0;
- /* Note conversion from `T*' to `const T*',
- or `T*' to `volatile T*'. */
- if ((TYPE_READONLY (tmp1) < TREE_READONLY (tmp2))
- || (TYPE_VOLATILE (tmp1) < TYPE_VOLATILE (tmp2)))
- h.code = EVIL_CODE;
- else if ((TYPE_READONLY (tmp1) != TREE_READONLY (tmp2))
- || (TYPE_VOLATILE (tmp1) != TYPE_VOLATILE (tmp2)))
- h.code |= QUAL_CODE;
-
- h.distance = 0;
- return h;
- }
-
-
- if (TREE_CODE (ttl) == RECORD_TYPE && TREE_CODE (ttr) == RECORD_TYPE)
- {
- int b_or_d = get_base_distance (ttl, ttr, 0, (tree*)0);
- if (b_or_d < 0)
- {
- b_or_d = get_base_distance (ttr, ttl, 0, (tree*)0);
- if (b_or_d < 0)
- return EVIL_RETURN (h);
- h.distance = -b_or_d;
- }
- else
- h.distance = b_or_d;
- h.code = STD_CODE;
- return h;
- }
-
- /* If converting from a `class*' to a `void*', make it
- less favorable than any inheritance relationship. */
- if (TREE_CODE (ttl) == VOID_TYPE && IS_AGGR_TYPE (ttr))
- {
- h.code = STD_CODE;
- h.distance = CLASSTYPE_MAX_DEPTH (ttr)+1;
- return h;
- }
-
- h.code = penalty ? STD_CODE : PROMO_CODE;
- /* Catch things like `const char *' -> `const void *'
- vs `const char *' -> `void *'. */
- if (ttl != ttr)
- {
- tree tmp1 = TREE_TYPE (type), tmp2 = TREE_TYPE (parmtype);
- if ((TYPE_READONLY (tmp1) < TREE_READONLY (tmp2))
- || (TYPE_VOLATILE (tmp1) < TYPE_VOLATILE (tmp2)))
- h.code = EVIL_CODE;
- else if ((TYPE_READONLY (tmp1) > TREE_READONLY (tmp2))
- || (TYPE_VOLATILE (tmp1) > TYPE_VOLATILE (tmp2)))
- h.code |= QUAL_CODE;
- }
- return h;
- }
-
- if (codel == POINTER_TYPE && coder == INTEGER_TYPE)
- {
- /* This is not a bad match, but don't let it beat
- integer-enum combinations. */
- if (parm && integer_zerop (parm))
- {
- h.code = STD_CODE;
- h.distance = 0;
- return h;
- }
- }
-
- /* C++: Since the `this' parameter of a signature member function
- is represented as a signature pointer to handle default implementations
- correctly, we can have the case that `type' is a signature pointer
- while `parmtype' is a pointer to a signature table. We don't really
- do any conversions in this case, so just return 0. */
-
- if (codel == RECORD_TYPE && coder == POINTER_TYPE
- && IS_SIGNATURE_POINTER (type) && IS_SIGNATURE (TREE_TYPE (parmtype)))
- return ZERO_RETURN (h);
-
- if (codel == RECORD_TYPE && coder == RECORD_TYPE)
- {
- int b_or_d = get_base_distance (type, parmtype, 0, (tree*)0);
- if (b_or_d < 0)
- {
- b_or_d = get_base_distance (parmtype, type, 0, (tree*)0);
- if (b_or_d < 0)
- return EVIL_RETURN (h);
- h.distance = -b_or_d;
- }
- else
- h.distance = b_or_d;
- h.code = STD_CODE;
- return h;
- }
- return EVIL_RETURN (h);
-}
-
-/* A clone of build_type_conversion for checking user-defined conversions in
- overload resolution. */
-
-static int
-user_harshness (type, parmtype)
- register tree type, parmtype;
-{
- tree conv;
- tree winner = NULL_TREE;
- int code;
-
- {
- tree typename = build_typename_overload (type);
- if (lookup_fnfields (TYPE_BINFO (parmtype), typename, 0))
- return 0;
- }
-
- for (conv = lookup_conversions (parmtype); conv; conv = TREE_CHAIN (conv))
- {
- struct harshness_code tmp;
- tree cand = TREE_VALUE (conv);
-
- if (winner && winner == cand)
- continue;
-
- tmp = convert_harshness (type, TREE_TYPE (TREE_TYPE (cand)), NULL_TREE);
- if ((tmp.code < USER_CODE) && (tmp.distance >= 0))
- {
- if (winner)
- return EVIL_CODE;
- else
- {
- winner = cand;
- code = tmp.code;
- }
- }
- }
-
- if (winner)
- return code;
-
- return -1;
-}
-
-#ifdef DEBUG_MATCHING
-static char *
-print_harshness (h)
- struct harshness_code *h;
-{
- static char buf[1024];
- char tmp[1024];
-
- bzero (buf, 1024 * sizeof (char));
- strcat (buf, "codes=[");
- if (h->code & EVIL_CODE)
- strcat (buf, "EVIL");
- if (h->code & CONST_CODE)
- strcat (buf, " CONST");
- if (h->code & ELLIPSIS_CODE)
- strcat (buf, " ELLIPSIS");
- if (h->code & USER_CODE)
- strcat (buf, " USER");
- if (h->code & STD_CODE)
- strcat (buf, " STD");
- if (h->code & PROMO_CODE)
- strcat (buf, " PROMO");
- if (h->code & QUAL_CODE)
- strcat (buf, " QUAL");
- if (h->code & TRIVIAL_CODE)
- strcat (buf, " TRIVIAL");
- if (buf[0] == '\0')
- strcat (buf, "0");
-
- sprintf (tmp, "] distance=%d int_penalty=%d", h->distance, h->int_penalty);
-
- strcat (buf, tmp);
-
- return buf;
-}
-#endif
-
-/* Algorithm: For each argument, calculate how difficult it is to
- make FUNCTION accept that argument. If we can easily tell that
- FUNCTION won't be acceptable to one of the arguments, then we
- don't need to compute the ease of converting the other arguments,
- since it will never show up in the intersection of all arguments'
- favorite functions.
-
- Conversions between builtin and user-defined types are allowed, but
- no function involving such a conversion is preferred to one which
- does not require such a conversion. Furthermore, such conversions
- must be unique. */
-
-void
-compute_conversion_costs (function, tta_in, cp, arglen)
- tree function;
- tree tta_in;
- struct candidate *cp;
- int arglen;
-{
- tree ttf_in = TYPE_ARG_TYPES (TREE_TYPE (function));
- tree ttf = ttf_in;
- tree tta = tta_in;
-
- /* Start out with no strikes against. */
- int evil_strikes = 0;
- int ellipsis_strikes = 0;
- int user_strikes = 0;
- int b_or_d_strikes = 0;
- int easy_strikes = 0;
-
- int strike_index = 0, win;
- struct harshness_code lose;
- extern int cp_silent;
-
-#ifdef GATHER_STATISTICS
- n_compute_conversion_costs++;
-#endif
-
-#ifndef DEBUG_MATCHING
- /* We don't emit any warnings or errors while trying out each candidate. */
- cp_silent = 1;
-#endif
-
- cp->function = function;
- cp->arg = tta ? TREE_VALUE (tta) : NULL_TREE;
- cp->u.bad_arg = 0; /* optimistic! */
-
- cp->h.code = 0;
- cp->h.distance = 0;
- cp->h.int_penalty = 0;
- bzero ((char *) cp->harshness,
- (cp->h_len + 1) * sizeof (struct harshness_code));
-
- while (ttf && tta)
- {
- struct harshness_code h;
-
- if (ttf == void_list_node)
- break;
-
- if (type_unknown_p (TREE_VALUE (tta)))
- {
- /* Must perform some instantiation here. */
- tree rhs = TREE_VALUE (tta);
- tree lhstype = TREE_VALUE (ttf);
-
- /* Keep quiet about possible contravariance violations. */
- int old_inhibit_warnings = inhibit_warnings;
- inhibit_warnings = 1;
-
- /* @@ This is to undo what `grokdeclarator' does to
- parameter types. It really should go through
- something more general. */
-
- TREE_TYPE (tta) = unknown_type_node;
- rhs = instantiate_type (lhstype, rhs, 0);
- inhibit_warnings = old_inhibit_warnings;
-
- if (TREE_CODE (rhs) == ERROR_MARK)
- h.code = EVIL_CODE;
- else
- h = convert_harshness (lhstype, TREE_TYPE (rhs), rhs);
- }
- else
- {
-#ifdef DEBUG_MATCHING
- static tree old_function = NULL_TREE;
-
- if (!old_function || function != old_function)
- {
- cp_error ("trying %D", function);
- old_function = function;
- }
-
- cp_error (" doing (%T) %E against arg %T",
- TREE_TYPE (TREE_VALUE (tta)), TREE_VALUE (tta),
- TREE_VALUE (ttf));
-#endif
-
- h = convert_harshness (TREE_VALUE (ttf),
- TREE_TYPE (TREE_VALUE (tta)),
- TREE_VALUE (tta));
-
-#ifdef DEBUG_MATCHING
- cp_error (" evaluated %s", print_harshness (&h));
-#endif
- }
-
- cp->harshness[strike_index] = h;
- if ((h.code & EVIL_CODE)
- || ((h.code & STD_CODE) && h.distance < 0))
- {
- cp->u.bad_arg = strike_index;
- evil_strikes = 1;
- }
- else if (h.code & ELLIPSIS_CODE)
- ellipsis_strikes += 1;
-#if 0
- /* This is never set by `convert_harshness'. */
- else if (h.code & USER_CODE)
- {
- user_strikes += 1;
- }
-#endif
- else
- {
- if ((h.code & STD_CODE) && h.distance)
- {
- if (h.distance > b_or_d_strikes)
- b_or_d_strikes = h.distance;
- }
- else
- easy_strikes += (h.code & (STD_CODE|PROMO_CODE|TRIVIAL_CODE));
- cp->h.code |= h.code;
- /* Make sure we communicate this. */
- cp->h.int_penalty += h.int_penalty;
- }
-
- ttf = TREE_CHAIN (ttf);
- tta = TREE_CHAIN (tta);
- strike_index += 1;
- }
-
- if (tta)
- {
- /* ran out of formals, and parmlist is fixed size. */
- if (ttf /* == void_type_node */)
- {
- cp->h.code = EVIL_CODE;
- cp->u.bad_arg = -1;
- cp_silent = 0;
- return;
- }
- else
- {
- struct harshness_code h;
- int l = list_length (tta);
- ellipsis_strikes += l;
- h.code = ELLIPSIS_CODE;
- h.distance = 0;
- h.int_penalty = 0;
- for (; l; --l)
- cp->harshness[strike_index++] = h;
- }
- }
- else if (ttf && ttf != void_list_node)
- {
- /* ran out of actuals, and no defaults. */
- if (TREE_PURPOSE (ttf) == NULL_TREE)
- {
- cp->h.code = EVIL_CODE;
- cp->u.bad_arg = -2;
- cp_silent = 0;
- return;
- }
- /* Store index of first default. */
- cp->harshness[arglen].distance = strike_index+1;
- }
- else
- cp->harshness[arglen].distance = 0;
-
- /* Argument list lengths work out, so don't need to check them again. */
- if (evil_strikes)
- {
- /* We do not check for derived->base conversions here, since in
- no case would they give evil strike counts, unless such conversions
- are somehow ambiguous. */
-
- /* See if any user-defined conversions apply.
- But make sure that we do not loop. */
- static int dont_convert_types = 0;
-
- if (dont_convert_types)
- {
- cp->h.code = EVIL_CODE;
- cp_silent = 0;
- return;
- }
-
- win = 0; /* Only get one chance to win. */
- ttf = TYPE_ARG_TYPES (TREE_TYPE (function));
- tta = tta_in;
- strike_index = 0;
- evil_strikes = 0;
-
- while (ttf && tta)
- {
- if (ttf == void_list_node)
- break;
-
- lose = cp->harshness[strike_index];
- if ((lose.code & EVIL_CODE)
- || ((lose.code & STD_CODE) && lose.distance < 0))
- {
- tree actual_type = TREE_TYPE (TREE_VALUE (tta));
- tree formal_type = TREE_VALUE (ttf);
- int extra_conversions = 0;
-
- dont_convert_types = 1;
-
- if (TREE_CODE (formal_type) == REFERENCE_TYPE)
- formal_type = TREE_TYPE (formal_type);
- if (TREE_CODE (actual_type) == REFERENCE_TYPE)
- actual_type = TREE_TYPE (actual_type);
-
- if (formal_type != error_mark_node
- && actual_type != error_mark_node)
- {
- formal_type = complete_type (TYPE_MAIN_VARIANT (formal_type));
- actual_type = complete_type (TYPE_MAIN_VARIANT (actual_type));
-
- if (TYPE_HAS_CONSTRUCTOR (formal_type))
- {
- /* If it has a constructor for this type,
- try to use it. */
- /* @@ There is no way to save this result yet, so
- success is a NULL_TREE for now. */
- if (convert_to_aggr (formal_type, TREE_VALUE (tta), 0, 1)
- != error_mark_node)
- win++;
- }
- if (TYPE_LANG_SPECIFIC (actual_type)
- && TYPE_HAS_CONVERSION (actual_type))
- {
- int extra = user_harshness (formal_type, actual_type);
-
- if (extra == EVIL_CODE)
- win += 2;
- else if (extra >= 0)
- {
- win++;
- extra_conversions = extra;
- }
- }
- }
- dont_convert_types = 0;
-
- if (win == 1)
- {
- user_strikes += 1;
- cp->harshness[strike_index].code
- = USER_CODE | (extra_conversions ? STD_CODE : 0);
- win = 0;
- }
- else
- {
- if (cp->u.bad_arg > strike_index)
- cp->u.bad_arg = strike_index;
-
- evil_strikes = win ? 2 : 1;
- break;
- }
- }
-
- ttf = TREE_CHAIN (ttf);
- tta = TREE_CHAIN (tta);
- strike_index += 1;
- }
- }
-
- /* Const member functions get a small penalty because defaulting
- to const is less useful than defaulting to non-const. */
- /* This is bogus, it does not correspond to anything in the ARM.
- This code will be fixed when this entire section is rewritten
- to conform to the ARM. (mrs) */
- if (TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
- {
- tree this_parm = TREE_VALUE (ttf_in);
-
- if (TREE_CODE (this_parm) == RECORD_TYPE /* Is `this' a sig ptr? */
- ? TYPE_READONLY (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (this_parm))))
- : TYPE_READONLY (TREE_TYPE (this_parm)))
- {
- cp->harshness[0].code |= TRIVIAL_CODE;
- ++easy_strikes;
- }
- else
- {
- /* Calling a non-const member function from a const member function
- is probably invalid, but for now we let it only draw a warning.
- We indicate that such a mismatch has occurred by setting the
- harshness to a maximum value. */
- if (TREE_CODE (TREE_TYPE (TREE_VALUE (tta_in))) == POINTER_TYPE
- && (TYPE_READONLY (TREE_TYPE (TREE_TYPE (TREE_VALUE (tta_in))))))
- cp->harshness[0].code |= CONST_CODE;
- }
- }
-
- if (evil_strikes)
- cp->h.code = EVIL_CODE;
- if (ellipsis_strikes)
- cp->h.code |= ELLIPSIS_CODE;
- if (user_strikes)
- cp->h.code |= USER_CODE;
- cp_silent = 0;
-#ifdef DEBUG_MATCHING
- cp_error ("final eval %s", print_harshness (&cp->h));
-#endif
-}
-
-/* Subroutine of ideal_candidate. See if X or Y is a better match
- than the other. */
-
-static int
-strictly_better (x, y)
- unsigned short x, y;
-{
- unsigned short xor;
-
- if (x == y)
- return 0;
-
- xor = x ^ y;
- if (xor >= x || xor >= y)
- return 1;
- return 0;
-}
-
-/* When one of several possible overloaded functions and/or methods
- can be called, choose the best candidate for overloading.
-
- BASETYPE is the context from which we start method resolution
- or NULL if we are comparing overloaded functions.
- CANDIDATES is the array of candidates we have to choose from.
- N_CANDIDATES is the length of CANDIDATES.
- PARMS is a TREE_LIST of parameters to the function we'll ultimately
- choose. It is modified in place when resolving methods. It is not
- modified in place when resolving overloaded functions.
- LEN is the length of the parameter list. */
-
-static struct candidate *
-ideal_candidate (candidates, n_candidates, len)
- struct candidate *candidates;
- int n_candidates;
- int len;
-{
- struct candidate *cp = candidates+n_candidates;
- int i, j = -1, best_code;
-
- /* For each argument, sort the functions from best to worst for the arg.
- For each function that's not best for this arg, set its overall
- harshness to EVIL so that other args won't like it. The candidate
- list for the last argument is the intersection of all the best-liked
- functions. */
-
- qsort (candidates, n_candidates, sizeof (struct candidate),
- rank_for_overload);
- best_code = cp[-1].h.code;
-
- /* If they're at least as good as each other, do an arg-by-arg check. */
- if (! strictly_better (cp[-1].h.code, cp[-2].h.code))
- {
- int better = 0;
- int worse = 0;
-
- for (j = 0; j < n_candidates; j++)
- if (! strictly_better (candidates[j].h.code, best_code))
- break;
-
- qsort (candidates+j, n_candidates-j, sizeof (struct candidate),
- rank_for_ideal);
- for (i = 0; i < len; i++)
- {
- if (cp[-1].harshness[i].code < cp[-2].harshness[i].code)
- better = 1;
- else if (cp[-1].harshness[i].code > cp[-2].harshness[i].code)
- worse = 1;
- else if (cp[-1].harshness[i].code & STD_CODE)
- {
- /* If it involves a standard conversion, let the
- inheritance lattice be the final arbiter. */
- if (cp[-1].harshness[i].distance > cp[-2].harshness[i].distance)
- worse = 1;
- else if (cp[-1].harshness[i].distance < cp[-2].harshness[i].distance)
- better = 1;
- }
- else if (cp[-1].harshness[i].code & PROMO_CODE)
- {
- /* For integral promotions, take into account a finer
- granularity for determining which types should be favored
- over others in such promotions. */
- if (cp[-1].harshness[i].int_penalty > cp[-2].harshness[i].int_penalty)
- worse = 1;
- else if (cp[-1].harshness[i].int_penalty < cp[-2].harshness[i].int_penalty)
- better = 1;
- }
- }
-
- if (! better || worse)
- return NULL;
- }
- return cp-1;
-}
-
-/* Assume that if the class referred to is not in the
- current class hierarchy, that it may be remote.
- PARENT is assumed to be of aggregate type here. */
-
-static int
-may_be_remote (parent)
- tree parent;
-{
- if (TYPE_OVERLOADS_METHOD_CALL_EXPR (parent) == 0)
- return 0;
-
- if (current_class_type == NULL_TREE)
- return 0;
-
- if (parent == current_class_type)
- return 0;
-
- if (UNIQUELY_DERIVED_FROM_P (parent, current_class_type))
- return 0;
- return 1;
-}
-
-tree
-build_vfield_ref (datum, type)
- tree datum, type;
-{
- tree rval;
- int old_assume_nonnull_objects = flag_assume_nonnull_objects;
-
- if (datum == error_mark_node)
- return error_mark_node;
-
- /* Vtable references are always made from non-null objects. */
- flag_assume_nonnull_objects = 1;
- if (TREE_CODE (TREE_TYPE (datum)) == REFERENCE_TYPE)
- datum = convert_from_reference (datum);
-
- if (! TYPE_USES_COMPLEX_INHERITANCE (type))
- rval = build (COMPONENT_REF, TREE_TYPE (CLASSTYPE_VFIELD (type)),
- datum, CLASSTYPE_VFIELD (type));
- else
- rval = build_component_ref (datum, DECL_NAME (CLASSTYPE_VFIELD (type)), NULL_TREE, 0);
- flag_assume_nonnull_objects = old_assume_nonnull_objects;
-
- return rval;
-}
-
-/* Build a call to a member of an object. I.e., one that overloads
- operator ()(), or is a pointer-to-function or pointer-to-method. */
-
-static tree
-build_field_call (basetype_path, instance_ptr, name, parms)
- tree basetype_path, instance_ptr, name, parms;
-{
- tree field, instance;
-
- if (name == ctor_identifier || name == dtor_identifier)
- return NULL_TREE;
-
- if (instance_ptr == current_class_ptr)
- {
- /* Check to see if we really have a reference to an instance variable
- with `operator()()' overloaded. */
- field = IDENTIFIER_CLASS_VALUE (name);
-
- if (field == NULL_TREE)
- {
- cp_error ("`this' has no member named `%D'", name);
- return error_mark_node;
- }
-
- if (TREE_CODE (field) == FIELD_DECL)
- {
- /* If it's a field, try overloading operator (),
- or calling if the field is a pointer-to-function. */
- instance = build_component_ref_1 (current_class_ref, field, 0);
- if (instance == error_mark_node)
- return error_mark_node;
-
- if (TYPE_LANG_SPECIFIC (TREE_TYPE (instance))
- && (TYPE_OVERLOADS_CALL_EXPR (TREE_TYPE (instance))
- || flag_ansi_overloading))
- return build_opfncall (CALL_EXPR, LOOKUP_NORMAL, instance, parms, NULL_TREE);
-
- if (TREE_CODE (TREE_TYPE (instance)) == POINTER_TYPE)
- {
- if (TREE_CODE (TREE_TYPE (TREE_TYPE (instance))) == FUNCTION_TYPE)
- return build_function_call (instance, parms);
- else if (TREE_CODE (TREE_TYPE (TREE_TYPE (instance))) == METHOD_TYPE)
- return build_function_call (instance, tree_cons (NULL_TREE, current_class_ptr, parms));
- }
- }
- return NULL_TREE;
- }
-
- /* Check to see if this is not really a reference to an instance variable
- with `operator()()' overloaded. */
- field = lookup_field (basetype_path, name, 1, 0);
-
- /* This can happen if the reference was ambiguous or for access
- violations. */
- if (field == error_mark_node)
- return error_mark_node;
-
- if (field)
- {
- tree basetype;
- tree ftype = TREE_TYPE (field);
-
- if (TREE_CODE (ftype) == REFERENCE_TYPE)
- ftype = TREE_TYPE (ftype);
-
- if (TYPE_LANG_SPECIFIC (ftype)
- && (TYPE_OVERLOADS_CALL_EXPR (ftype) || flag_ansi_overloading))
- {
- /* Make the next search for this field very short. */
- basetype = DECL_FIELD_CONTEXT (field);
- instance_ptr = convert_pointer_to (basetype, instance_ptr);
-
- instance = build_indirect_ref (instance_ptr, NULL_PTR);
- return build_opfncall (CALL_EXPR, LOOKUP_NORMAL,
- build_component_ref_1 (instance, field, 0),
- parms, NULL_TREE);
- }
- if (TREE_CODE (ftype) == POINTER_TYPE)
- {
- if (TREE_CODE (TREE_TYPE (ftype)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (ftype)) == METHOD_TYPE)
- {
- /* This is a member which is a pointer to function. */
- tree ref
- = build_component_ref_1 (build_indirect_ref (instance_ptr,
- NULL_PTR),
- field, LOOKUP_COMPLAIN);
- if (ref == error_mark_node)
- return error_mark_node;
- return build_function_call (ref, parms);
- }
- }
- else if (TREE_CODE (ftype) == METHOD_TYPE)
- {
- error ("invalid call via pointer-to-member function");
- return error_mark_node;
- }
- else
- return NULL_TREE;
- }
- return NULL_TREE;
-}
-
-static tree
-find_scoped_type (type, inner_name, inner_types)
- tree type, inner_name, inner_types;
-{
- tree tags = CLASSTYPE_TAGS (type);
-
- while (tags)
- {
- /* The TREE_PURPOSE of an enum tag (which becomes a member of the
- enclosing class) is set to the name for the enum type. So, if
- inner_name is `bar', and we strike `baz' for `enum bar { baz }',
- then this test will be true. */
- if (TREE_PURPOSE (tags) == inner_name)
- {
- if (inner_types == NULL_TREE)
- return TYPE_MAIN_DECL (TREE_VALUE (tags));
- return resolve_scope_to_name (TREE_VALUE (tags), inner_types);
- }
- tags = TREE_CHAIN (tags);
- }
-
- /* Look for a TYPE_DECL. */
- for (tags = TYPE_FIELDS (type); tags; tags = TREE_CHAIN (tags))
- if (TREE_CODE (tags) == TYPE_DECL && DECL_NAME (tags) == inner_name)
- {
- /* Code by raeburn. */
- if (inner_types == NULL_TREE)
- return tags;
- return resolve_scope_to_name (TREE_TYPE (tags), inner_types);
- }
-
- return NULL_TREE;
-}
-
-/* Resolve an expression NAME1::NAME2::...::NAMEn to
- the name that names the above nested type. INNER_TYPES
- is a chain of nested type names (held together by SCOPE_REFs);
- OUTER_TYPE is the type we know to enclose INNER_TYPES.
- Returns NULL_TREE if there is an error. */
-
-tree
-resolve_scope_to_name (outer_type, inner_stuff)
- tree outer_type, inner_stuff;
-{
- register tree tmp;
- tree inner_name, inner_type;
-
- if (outer_type == NULL_TREE && current_class_type != NULL_TREE)
- {
- /* We first try to look for a nesting in our current class context,
- then try any enclosing classes. */
- tree type = current_class_type;
-
- while (type && (TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE))
- {
- tree rval = resolve_scope_to_name (type, inner_stuff);
-
- if (rval != NULL_TREE)
- return rval;
- type = DECL_CONTEXT (TYPE_MAIN_DECL (type));
- }
- }
-
- if (TREE_CODE (inner_stuff) == SCOPE_REF)
- {
- inner_name = TREE_OPERAND (inner_stuff, 0);
- inner_type = TREE_OPERAND (inner_stuff, 1);
- }
- else
- {
- inner_name = inner_stuff;
- inner_type = NULL_TREE;
- }
-
- if (outer_type == NULL_TREE)
- {
- tree x;
- /* If we have something that's already a type by itself,
- use that. */
- if (IDENTIFIER_HAS_TYPE_VALUE (inner_name))
- {
- if (inner_type)
- return resolve_scope_to_name (IDENTIFIER_TYPE_VALUE (inner_name),
- inner_type);
- return inner_name;
- }
-
- x = lookup_name (inner_name, 0);
-
- if (x && TREE_CODE (x) == NAMESPACE_DECL)
- {
- x = lookup_namespace_name (x, inner_type);
- return x;
- }
- return NULL_TREE;
- }
-
- if (! IS_AGGR_TYPE (outer_type))
- return NULL_TREE;
-
- /* Look for member classes or enums. */
- tmp = find_scoped_type (outer_type, inner_name, inner_type);
-
- /* If it's not a type in this class, then go down into the
- base classes and search there. */
- if (! tmp && TYPE_BINFO (outer_type))
- {
- tree binfos = TYPE_BINFO_BASETYPES (outer_type);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tmp = resolve_scope_to_name (BINFO_TYPE (base_binfo), inner_stuff);
- if (tmp)
- return tmp;
- }
- tmp = NULL_TREE;
- }
-
- return tmp;
-}
-
-/* Build a method call of the form `EXP->SCOPES::NAME (PARMS)'.
- This is how virtual function calls are avoided. */
-
-tree
-build_scoped_method_call (exp, basetype, name, parms)
- tree exp, basetype, name, parms;
-{
- /* Because this syntactic form does not allow
- a pointer to a base class to be `stolen',
- we need not protect the derived->base conversion
- that happens here.
-
- @@ But we do have to check access privileges later. */
- tree binfo, decl;
- tree type = TREE_TYPE (exp);
-
- if (type == error_mark_node
- || basetype == error_mark_node)
- return error_mark_node;
-
- if (processing_template_decl)
- {
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 1);
- name = build_min_nt (BIT_NOT_EXPR, type);
- }
- name = build_min_nt (SCOPE_REF, basetype, name);
- return build_min_nt (METHOD_CALL_EXPR, name, exp, parms, NULL_TREE);
- }
-
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- if (TREE_CODE (basetype) == TREE_VEC)
- {
- binfo = basetype;
- basetype = BINFO_TYPE (binfo);
- }
- else
- binfo = NULL_TREE;
-
- /* Destructors can be "called" for simple types; see 5.2.4 and 12.4 Note
- that explicit ~int is caught in the parser; this deals with typedefs
- and template parms. */
- if (TREE_CODE (name) == BIT_NOT_EXPR && ! IS_AGGR_TYPE (basetype))
- {
- if (type != basetype)
- cp_error ("type of `%E' does not match destructor type `%T' (type was `%T')",
- exp, basetype, type);
- name = TREE_OPERAND (name, 0);
- if (basetype != name && basetype != get_type_value (name))
- cp_error ("qualified type `%T' does not match destructor name `~%T'",
- basetype, name);
- return convert (void_type_node, exp);
- }
-
- if (! is_aggr_type (basetype, 1))
- return error_mark_node;
-
- if (! IS_AGGR_TYPE (type))
- {
- cp_error ("base object `%E' of scoped method call is of non-aggregate type `%T'",
- exp, type);
- return error_mark_node;
- }
-
- if (! binfo)
- {
- binfo = get_binfo (basetype, type, 1);
- if (binfo == error_mark_node)
- return error_mark_node;
- if (! binfo)
- error_not_base_type (basetype, type);
- }
-
- if (binfo)
- {
- if (TREE_CODE (exp) == INDIRECT_REF)
- decl = build_indirect_ref
- (convert_pointer_to_real
- (binfo, build_unary_op (ADDR_EXPR, exp, 0)), NULL_PTR);
- else
- decl = build_scoped_ref (exp, basetype);
-
- /* Call to a destructor. */
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- /* Explicit call to destructor. */
- name = TREE_OPERAND (name, 0);
- if (! (name == TYPE_MAIN_VARIANT (TREE_TYPE (decl))
- || name == constructor_name (TREE_TYPE (decl))
- || TREE_TYPE (decl) == get_type_value (name)))
- {
- cp_error
- ("qualified type `%T' does not match destructor name `~%T'",
- TREE_TYPE (decl), name);
- return error_mark_node;
- }
- if (! TYPE_HAS_DESTRUCTOR (TREE_TYPE (decl)))
- return convert (void_type_node, exp);
-
- return build_delete (TREE_TYPE (decl), decl, integer_two_node,
- LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR,
- 0);
- }
-
- /* Call to a method. */
- return build_method_call (decl, name, parms, binfo,
- LOOKUP_NORMAL|LOOKUP_NONVIRTUAL);
- }
- return error_mark_node;
-}
-
-static void
-print_candidates (candidates)
- tree candidates;
-{
- cp_error_at ("candidates are: %D", TREE_VALUE (candidates));
- candidates = TREE_CHAIN (candidates);
-
- while (candidates)
- {
- cp_error_at (" %D", TREE_VALUE (candidates));
- candidates = TREE_CHAIN (candidates);
- }
-}
-
-static void
-print_n_candidates (candidates, n)
- struct candidate *candidates;
- int n;
-{
- int i;
-
- cp_error_at ("candidates are: %D", candidates[0].function);
- for (i = 1; i < n; i++)
- cp_error_at (" %D", candidates[i].function);
-}
-
-/* We want the address of a function or method. We avoid creating a
- pointer-to-member function. */
-
-tree
-build_addr_func (function)
- tree function;
-{
- tree type = TREE_TYPE (function);
-
- /* We have to do these by hand to avoid real pointer to member
- functions. */
- if (TREE_CODE (type) == METHOD_TYPE)
- {
- tree addr;
-
- type = build_pointer_type (type);
-
- if (mark_addressable (function) == 0)
- return error_mark_node;
-
- addr = build1 (ADDR_EXPR, type, function);
-
- /* Address of a static or external variable or function counts
- as a constant */
- if (staticp (function))
- TREE_CONSTANT (addr) = 1;
-
- function = addr;
- }
- else
- function = default_conversion (function);
-
- return function;
-}
-
-/* Build a CALL_EXPR, we can handle FUNCTION_TYPEs, METHOD_TYPEs, or
- POINTER_TYPE to those. Note, pointer to member function types
- (TYPE_PTRMEMFUNC_P) must be handled by our callers. */
-
-tree
-build_call (function, result_type, parms)
- tree function, result_type, parms;
-{
- int is_constructor = 0;
-
- function = build_addr_func (function);
-
- if (TYPE_PTRMEMFUNC_P (TREE_TYPE (function)))
- {
- sorry ("unable to call pointer to member function here");
- return error_mark_node;
- }
-
- if (TREE_CODE (function) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL
- && DECL_CONSTRUCTOR_P (TREE_OPERAND (function, 0)))
- is_constructor = 1;
-
- function = build_nt (CALL_EXPR, function, parms, NULL_TREE);
- TREE_HAS_CONSTRUCTOR (function) = is_constructor;
- TREE_TYPE (function) = result_type;
- TREE_SIDE_EFFECTS (function) = 1;
-
- return function;
-}
-
-static tree
-default_parm_conversions (parms, last)
- tree parms, *last;
-{
- tree parm, parmtypes = NULL_TREE;
-
- *last = NULL_TREE;
-
- for (parm = parms; parm; parm = TREE_CHAIN (parm))
- {
- tree t = TREE_TYPE (TREE_VALUE (parm));
-
- if (TREE_CODE (t) == OFFSET_TYPE
- || TREE_CODE (t) == METHOD_TYPE
- || TREE_CODE (t) == FUNCTION_TYPE)
- {
- TREE_VALUE (parm) = default_conversion (TREE_VALUE (parm));
- t = TREE_TYPE (TREE_VALUE (parm));
- }
-
- if (t == error_mark_node)
- return error_mark_node;
-
- *last = build_tree_list (NULL_TREE, t);
- parmtypes = chainon (parmtypes, *last);
- }
-
- return parmtypes;
-}
-
-
-/* Build something of the form ptr->method (args)
- or object.method (args). This can also build
- calls to constructors, and find friends.
-
- Member functions always take their class variable
- as a pointer.
-
- INSTANCE is a class instance.
-
- NAME is the name of the method desired, usually an IDENTIFIER_NODE.
-
- PARMS help to figure out what that NAME really refers to.
-
- BASETYPE_PATH, if non-NULL, contains a chain from the type of INSTANCE
- down to the real instance type to use for access checking. We need this
- information to get protected accesses correct. This parameter is used
- by build_member_call.
-
- FLAGS is the logical disjunction of zero or more LOOKUP_
- flags. See cp-tree.h for more info.
-
- If this is all OK, calls build_function_call with the resolved
- member function.
-
- This function must also handle being called to perform
- initialization, promotion/coercion of arguments, and
- instantiation of default parameters.
-
- Note that NAME may refer to an instance variable name. If
- `operator()()' is defined for the type of that field, then we return
- that result. */
-
-tree
-build_method_call (instance, name, parms, basetype_path, flags)
- tree instance, name, parms, basetype_path;
- int flags;
-{
- register tree function, fntype, value_type;
- register tree basetype, save_basetype;
- register tree baselink, result, parmtypes;
- tree last;
- int pass;
- tree access = access_public_node;
- tree orig_basetype = basetype_path ? BINFO_TYPE (basetype_path) : NULL_TREE;
-
- /* Range of cases for vtable optimization. */
- enum vtable_needs { not_needed, maybe_needed, unneeded, needed };
- enum vtable_needs need_vtbl = not_needed;
-
- char *name_kind;
- tree save_name = name;
- int ever_seen = 0;
- tree instance_ptr = NULL_TREE;
- int all_virtual = flag_all_virtual;
- int static_call_context = 0;
- tree found_fns = NULL_TREE;
-
- /* Keep track of `const' and `volatile' objects. */
- int constp, volatilep;
-
-#ifdef GATHER_STATISTICS
- n_build_method_call++;
-#endif
-
- if (instance == error_mark_node
- || name == error_mark_node
- || parms == error_mark_node
- || (instance != NULL_TREE && TREE_TYPE (instance) == error_mark_node))
- return error_mark_node;
-
- if (processing_template_decl)
- {
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 1);
- name = build_min_nt (BIT_NOT_EXPR, type);
- }
-
- return build_min_nt (METHOD_CALL_EXPR, name, instance, parms, NULL_TREE);
- }
-
- /* This is the logic that magically deletes the second argument to
- operator delete, if it is not needed. */
- if (name == ansi_opname[(int) DELETE_EXPR] && list_length (parms)==2)
- {
- tree save_last = TREE_CHAIN (parms);
- tree result;
- /* get rid of unneeded argument */
- TREE_CHAIN (parms) = NULL_TREE;
- result = build_method_call (instance, name, parms, basetype_path,
- (LOOKUP_SPECULATIVELY|flags)
- &~LOOKUP_COMPLAIN);
- /* If it finds a match, return it. */
- if (result)
- return build_method_call (instance, name, parms, basetype_path, flags);
- /* If it doesn't work, two argument delete must work */
- TREE_CHAIN (parms) = save_last;
- }
- /* We already know whether it's needed or not for vec delete. */
- else if (name == ansi_opname[(int) VEC_DELETE_EXPR]
- && TYPE_LANG_SPECIFIC (TREE_TYPE (instance))
- && ! TYPE_VEC_DELETE_TAKES_SIZE (TREE_TYPE (instance)))
- TREE_CHAIN (parms) = NULL_TREE;
-
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- flags |= LOOKUP_DESTRUCTOR;
- name = TREE_OPERAND (name, 0);
- if (parms)
- error ("destructors take no parameters");
- basetype = TREE_TYPE (instance);
- if (TREE_CODE (basetype) == REFERENCE_TYPE)
- basetype = TREE_TYPE (basetype);
- if (! (name == basetype
- || (IS_AGGR_TYPE (basetype)
- && name == constructor_name (basetype))
- || basetype == get_type_value (name)))
- {
- cp_error ("destructor name `~%D' does not match type `%T' of expression",
- name, basetype);
- return convert (void_type_node, instance);
- }
-
- if (! TYPE_HAS_DESTRUCTOR (basetype))
- return convert (void_type_node, instance);
- instance = default_conversion (instance);
- instance_ptr = build_unary_op (ADDR_EXPR, instance, 0);
- return build_delete (build_pointer_type (basetype),
- instance_ptr, integer_two_node,
- LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0);
- }
-
- if (flag_ansi_overloading)
- return build_new_method_call (instance, name, parms, basetype_path, flags);
-
- {
- char *xref_name;
-
- /* Initialize name for error reporting. */
- if (IDENTIFIER_OPNAME_P (name) && ! IDENTIFIER_TYPENAME_P (name))
- {
- char *p = operator_name_string (name);
- xref_name = (char *)alloca (strlen (p) + 10);
- sprintf (xref_name, "operator %s", p);
- }
- else if (TREE_CODE (name) == SCOPE_REF)
- xref_name = IDENTIFIER_POINTER (TREE_OPERAND (name, 1));
- else
- xref_name = IDENTIFIER_POINTER (name);
-
- GNU_xref_call (current_function_decl, xref_name);
- }
-
- if (instance == NULL_TREE)
- {
- basetype = NULL_TREE;
- /* Check cases where this is really a call to raise
- an exception. */
- if (current_class_type && TREE_CODE (name) == IDENTIFIER_NODE)
- {
- basetype = purpose_member (name, CLASSTYPE_TAGS (current_class_type));
- if (basetype)
- basetype = TREE_VALUE (basetype);
- }
- else if (TREE_CODE (name) == SCOPE_REF
- && TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE)
- {
- if (! is_aggr_typedef (TREE_OPERAND (name, 0), 1))
- return error_mark_node;
- basetype = purpose_member (TREE_OPERAND (name, 1),
- CLASSTYPE_TAGS (IDENTIFIER_TYPE_VALUE (TREE_OPERAND (name, 0))));
- if (basetype)
- basetype = TREE_VALUE (basetype);
- }
-
- if (basetype != NULL_TREE)
- ;
- /* call to a constructor... */
- else if (basetype_path)
- {
- basetype = BINFO_TYPE (basetype_path);
- if (name == TYPE_IDENTIFIER (basetype))
- name = ctor_identifier;
- }
- else if (IDENTIFIER_HAS_TYPE_VALUE (name))
- {
- basetype = IDENTIFIER_TYPE_VALUE (name);
- name = ctor_identifier;
- }
- else
- {
- tree typedef_name = lookup_name (name, 1);
- if (typedef_name && TREE_CODE (typedef_name) == TYPE_DECL)
- {
- /* Canonicalize the typedef name. */
- basetype = TREE_TYPE (typedef_name);
- name = ctor_identifier;
- }
- else
- {
- cp_error ("no constructor named `%T' in scope",
- name);
- return error_mark_node;
- }
- }
-
- if (! IS_AGGR_TYPE (basetype))
- {
- non_aggr_error:
- if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node)
- cp_error ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
- name, instance, basetype);
-
- return error_mark_node;
- }
- }
- else if (instance == current_class_ref || instance == current_class_ptr)
- {
- /* When doing initialization, we side-effect the TREE_TYPE of
- current_class_ref, hence we cannot set up BASETYPE from CURRENT_CLASS_TYPE. */
- basetype = TREE_TYPE (current_class_ref);
-
- /* Anything manifestly `this' in constructors and destructors
- has a known type, so virtual function tables are not needed. */
- if (TYPE_VIRTUAL_P (basetype)
- && !(flags & LOOKUP_NONVIRTUAL))
- need_vtbl = (dtor_label || ctor_label)
- ? unneeded : maybe_needed;
-
- /* If `this' is a signature pointer and `name' is not a constructor,
- we are calling a signature member function. In that case, set the
- `basetype' to the signature type and dereference the `optr' field. */
- if (IS_SIGNATURE_POINTER (basetype)
- && TYPE_IDENTIFIER (basetype) != name)
- {
- basetype = SIGNATURE_TYPE (basetype);
- instance_ptr = instance;
- basetype_path = TYPE_BINFO (basetype);
- }
- else
- {
- instance = current_class_ref;
- instance_ptr = current_class_ptr;
- basetype_path = TYPE_BINFO (current_class_type);
- }
- result = build_field_call (basetype_path, instance_ptr, name, parms);
-
- if (result)
- return result;
- }
- else if (TREE_CODE (instance) == RESULT_DECL)
- {
- basetype = TREE_TYPE (instance);
- /* Should we ever have to make a virtual function reference
- from a RESULT_DECL, know that it must be of fixed type
- within the scope of this function. */
- if (!(flags & LOOKUP_NONVIRTUAL) && TYPE_VIRTUAL_P (basetype))
- need_vtbl = maybe_needed;
- instance_ptr = build1 (ADDR_EXPR, build_pointer_type (basetype), instance);
- }
- else
- {
- /* The MAIN_VARIANT of the type that `instance_ptr' winds up being. */
- tree inst_ptr_basetype;
-
- static_call_context =
- (TREE_CODE (instance) == INDIRECT_REF
- && TREE_CODE (TREE_OPERAND (instance, 0)) == NOP_EXPR
- && TREE_OPERAND (TREE_OPERAND (instance, 0), 0) == error_mark_node);
-
- if (TREE_CODE (instance) == OFFSET_REF)
- instance = resolve_offset_ref (instance);
-
- /* the base type of an instance variable is pointer to class */
- basetype = TREE_TYPE (instance);
-
- if (TREE_CODE (basetype) == REFERENCE_TYPE)
- {
- basetype = TREE_TYPE (basetype);
- if (! IS_AGGR_TYPE (basetype))
- goto non_aggr_error;
- /* Call to convert not needed because we are remaining
- within the same type. */
- instance_ptr = build1 (NOP_EXPR, build_pointer_type (basetype),
- instance);
- inst_ptr_basetype = TYPE_MAIN_VARIANT (basetype);
- }
- else
- {
- if (! IS_AGGR_TYPE (basetype)
- && ! (TYPE_LANG_SPECIFIC (basetype)
- && (IS_SIGNATURE_POINTER (basetype)
- || IS_SIGNATURE_REFERENCE (basetype))))
- goto non_aggr_error;
-
- /* If `instance' is a signature pointer/reference and `name' is
- not a constructor, we are calling a signature member function.
- In that case set the `basetype' to the signature type. */
- if ((IS_SIGNATURE_POINTER (basetype)
- || IS_SIGNATURE_REFERENCE (basetype))
- && TYPE_IDENTIFIER (basetype) != name)
- basetype = SIGNATURE_TYPE (basetype);
-
- basetype = complete_type (basetype);
-
- if ((IS_SIGNATURE (basetype)
- && (instance_ptr = instance))
- || (lvalue_p (instance)
- && (instance_ptr = build_unary_op (ADDR_EXPR, instance, 0)))
- || (instance_ptr = unary_complex_lvalue (ADDR_EXPR, instance)))
- {
- if (instance_ptr == error_mark_node)
- return error_mark_node;
- }
- else if (TREE_CODE (instance) == NOP_EXPR
- || TREE_CODE (instance) == CONSTRUCTOR)
- {
- /* A cast is not an lvalue. Initialize a fresh temp
- with the value we are casting from, and proceed with
- that temporary. We can't cast to a reference type,
- so that simplifies the initialization to something
- we can manage. */
- tree temp = get_temp_name (TREE_TYPE (instance), 0);
- if (IS_AGGR_TYPE (TREE_TYPE (instance)))
- expand_aggr_init (temp, instance, 0, flags);
- else
- {
- store_init_value (temp, instance);
- expand_decl_init (temp);
- }
- instance = temp;
- instance_ptr = build_unary_op (ADDR_EXPR, instance, 0);
- }
- else
- {
- if (TREE_CODE (instance) != CALL_EXPR)
- my_friendly_abort (125);
- if (TYPE_NEEDS_CONSTRUCTING (basetype))
- instance = build_cplus_new (basetype, instance);
- else
- {
- instance = get_temp_name (basetype, 0);
- TREE_ADDRESSABLE (instance) = 1;
- }
- instance_ptr = build_unary_op (ADDR_EXPR, instance, 0);
- }
- /* @@ Should we call comp_target_types here? */
- if (IS_SIGNATURE (basetype))
- inst_ptr_basetype = basetype;
- else
- inst_ptr_basetype = TREE_TYPE (TREE_TYPE (instance_ptr));
- if (TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (inst_ptr_basetype))
- basetype = inst_ptr_basetype;
- else
- {
- instance_ptr = convert (build_pointer_type (basetype), instance_ptr);
- if (instance_ptr == error_mark_node)
- return error_mark_node;
- }
- }
-
- /* After converting `instance_ptr' above, `inst_ptr_basetype' was
- not updated, so we use `basetype' instead. */
- if (basetype_path == NULL_TREE
- && IS_SIGNATURE (basetype))
- basetype_path = TYPE_BINFO (basetype);
- else if (basetype_path == NULL_TREE ||
- BINFO_TYPE (basetype_path) != TYPE_MAIN_VARIANT (inst_ptr_basetype))
- basetype_path = TYPE_BINFO (inst_ptr_basetype);
-
- result = build_field_call (basetype_path, instance_ptr, name, parms);
- if (result)
- return result;
-
- if (!(flags & LOOKUP_NONVIRTUAL) && TYPE_VIRTUAL_P (basetype))
- {
- if (TREE_SIDE_EFFECTS (instance_ptr))
- {
- /* This action is needed because the instance is needed
- for providing the base of the virtual function table.
- Without using a SAVE_EXPR, the function we are building
- may be called twice, or side effects on the instance
- variable (such as a post-increment), may happen twice. */
- instance_ptr = save_expr (instance_ptr);
- instance = build_indirect_ref (instance_ptr, NULL_PTR);
- }
- else if (TREE_CODE (TREE_TYPE (instance)) == POINTER_TYPE)
- {
- /* This happens when called for operator new (). */
- instance = build_indirect_ref (instance, NULL_PTR);
- }
-
- need_vtbl = maybe_needed;
- }
- }
-
- if (save_name == ctor_identifier)
- save_name = TYPE_IDENTIFIER (basetype);
-
- if (TYPE_SIZE (complete_type (basetype)) == 0)
- {
- /* This is worth complaining about, I think. */
- cp_error ("cannot lookup method in incomplete type `%T'", basetype);
- return error_mark_node;
- }
-
- save_basetype = TYPE_MAIN_VARIANT (basetype);
-
- parmtypes = default_parm_conversions (parms, &last);
- if (parmtypes == error_mark_node)
- {
- return error_mark_node;
- }
-
- if (instance && IS_SIGNATURE (basetype))
- {
- /* @@ Should this be the constp/volatilep flags for the optr field
- of the signature pointer? */
- constp = TYPE_READONLY (basetype);
- volatilep = TYPE_VOLATILE (basetype);
- parms = tree_cons (NULL_TREE, instance_ptr, parms);
- }
- else if (instance)
- {
- /* TREE_READONLY (instance) fails for references. */
- constp = TYPE_READONLY (TREE_TYPE (TREE_TYPE (instance_ptr)));
- volatilep = TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (instance_ptr)));
- parms = tree_cons (NULL_TREE, instance_ptr, parms);
- }
- else
- {
- /* Raw constructors are always in charge. */
- if (TYPE_USES_VIRTUAL_BASECLASSES (basetype)
- && ! (flags & LOOKUP_HAS_IN_CHARGE))
- {
- flags |= LOOKUP_HAS_IN_CHARGE;
- parms = tree_cons (NULL_TREE, integer_one_node, parms);
- parmtypes = tree_cons (NULL_TREE, integer_type_node, parmtypes);
- }
-
- constp = 0;
- volatilep = 0;
- instance_ptr = build_int_2 (0, 0);
- TREE_TYPE (instance_ptr) = build_pointer_type (basetype);
- parms = tree_cons (NULL_TREE, instance_ptr, parms);
- }
-
- parmtypes = tree_cons (NULL_TREE, TREE_TYPE (instance_ptr), parmtypes);
-
- if (last == NULL_TREE)
- last = parmtypes;
-
- /* Look up function name in the structure type definition. */
-
- /* FIXME Axe most of this now? */
- if ((IDENTIFIER_HAS_TYPE_VALUE (name)
- && ! IDENTIFIER_OPNAME_P (name)
- && IS_AGGR_TYPE (IDENTIFIER_TYPE_VALUE (name)))
- || name == constructor_name (basetype)
- || name == ctor_identifier)
- {
- tree tmp = NULL_TREE;
- if (IDENTIFIER_TYPE_VALUE (name) == basetype
- || name == constructor_name (basetype)
- || name == ctor_identifier)
- tmp = TYPE_BINFO (basetype);
- else
- tmp = get_binfo (IDENTIFIER_TYPE_VALUE (name), basetype, 0);
-
- if (tmp != NULL_TREE)
- {
- name_kind = "constructor";
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (basetype)
- && ! (flags & LOOKUP_HAS_IN_CHARGE))
- {
- /* Constructors called for initialization
- only are never in charge. */
- tree tmplist;
-
- flags |= LOOKUP_HAS_IN_CHARGE;
- tmplist = tree_cons (NULL_TREE, integer_zero_node,
- TREE_CHAIN (parms));
- TREE_CHAIN (parms) = tmplist;
- tmplist = tree_cons (NULL_TREE, integer_type_node, TREE_CHAIN (parmtypes));
- TREE_CHAIN (parmtypes) = tmplist;
- }
- basetype = BINFO_TYPE (tmp);
- }
- else
- name_kind = "method";
- }
- else
- name_kind = "method";
-
- if (basetype_path == NULL_TREE
- || BINFO_TYPE (basetype_path) != TYPE_MAIN_VARIANT (basetype))
- basetype_path = TYPE_BINFO (basetype);
- result = lookup_fnfields (basetype_path, name,
- (flags & LOOKUP_COMPLAIN));
- if (result == error_mark_node)
- return error_mark_node;
-
- for (pass = 0; pass < 2; pass++)
- {
- struct candidate *candidates;
- struct candidate *cp;
- int len;
- unsigned best = 1;
-
- baselink = result;
-
- if (pass > 0)
- {
- candidates
- = (struct candidate *) alloca ((ever_seen+1)
- * sizeof (struct candidate));
- bzero ((char *) candidates, (ever_seen + 1) * sizeof (struct candidate));
- cp = candidates;
- len = list_length (parms);
- ever_seen = 0;
-
- /* First see if a global function has a shot at it. */
- if (flags & LOOKUP_GLOBAL)
- {
- tree friend_parms;
- tree parm = instance_ptr;
-
- if (TREE_CODE (TREE_TYPE (parm)) == REFERENCE_TYPE)
- parm = convert_from_reference (parm);
- else if (TREE_CODE (TREE_TYPE (parm)) == POINTER_TYPE)
- parm = build_indirect_ref (parm, "friendifying parms (compiler error)");
- else
- my_friendly_abort (167);
-
- friend_parms = tree_cons (NULL_TREE, parm, TREE_CHAIN (parms));
-
- cp->h_len = len;
- cp->harshness = (struct harshness_code *)
- alloca ((len + 1) * sizeof (struct harshness_code));
-
- result = build_overload_call_real (name, friend_parms, 0, cp, 1);
-
- /* If it turns out to be the one we were actually looking for
- (it was probably a friend function), the return the
- good result. */
- if (TREE_CODE (result) == CALL_EXPR)
- return result;
-
- while ((cp->h.code & EVIL_CODE) == 0)
- {
- /* non-standard uses: set the field to 0 to indicate
- we are using a non-member function. */
- cp->u.field = 0;
- if (cp->harshness[len].distance == 0
- && cp->h.code < best)
- best = cp->h.code;
- cp += 1;
- }
- }
- }
-
- if (baselink)
- {
- /* We have a hit (of sorts). If the parameter list is
- "error_mark_node", or some variant thereof, it won't
- match any methods. Since we have verified that the is
- some method vaguely matching this one (in name at least),
- silently return.
-
- Don't stop for friends, however. */
- basetype_path = TREE_PURPOSE (baselink);
-
- function = TREE_VALUE (baselink);
- if (TREE_CODE (basetype_path) == TREE_LIST)
- basetype_path = TREE_VALUE (basetype_path);
- basetype = BINFO_TYPE (basetype_path);
-
- for (; function; function = DECL_CHAIN (function))
- {
-#ifdef GATHER_STATISTICS
- n_inner_fields_searched++;
-#endif
- ever_seen++;
- if (pass > 0)
- found_fns = tree_cons (NULL_TREE, function, found_fns);
-
- /* Not looking for friends here. */
- if (TREE_CODE (TREE_TYPE (function)) == FUNCTION_TYPE
- && ! DECL_STATIC_FUNCTION_P (function))
- continue;
-
- if (pass > 0)
- {
- tree these_parms = parms;
-
-#ifdef GATHER_STATISTICS
- n_inner_fields_searched++;
-#endif
- cp->h_len = len;
- cp->harshness = (struct harshness_code *)
- alloca ((len + 1) * sizeof (struct harshness_code));
-
- if (DECL_STATIC_FUNCTION_P (function))
- these_parms = TREE_CHAIN (these_parms);
- compute_conversion_costs (function, these_parms, cp, len);
-
- if ((cp->h.code & EVIL_CODE) == 0)
- {
- cp->u.field = function;
- cp->function = function;
- cp->basetypes = basetype_path;
-
- /* Don't allow non-converting constructors to convert. */
- if (flags & LOOKUP_ONLYCONVERTING
- && DECL_LANG_SPECIFIC (function)
- && DECL_NONCONVERTING_P (function))
- continue;
-
- /* No "two-level" conversions. */
- if (flags & LOOKUP_NO_CONVERSION
- && (cp->h.code & USER_CODE))
- continue;
-
- cp++;
- }
- }
- }
- }
-
- if (pass == 0)
- {
- tree igv = lookup_name_nonclass (name);
-
- /* No exact match could be found. Now try to find match
- using default conversions. */
- if ((flags & LOOKUP_GLOBAL) && igv)
- {
- if (TREE_CODE (igv) == FUNCTION_DECL)
- ever_seen += 1;
- else if (TREE_CODE (igv) == TREE_LIST)
- ever_seen += count_functions (igv);
- }
-
- if (ever_seen == 0)
- {
- if ((flags & (LOOKUP_SPECULATIVELY|LOOKUP_COMPLAIN))
- == LOOKUP_SPECULATIVELY)
- return NULL_TREE;
-
- TREE_CHAIN (last) = void_list_node;
- if (flags & LOOKUP_GLOBAL)
- cp_error ("no global or member function `%D(%A)' defined",
- save_name, parmtypes);
- else
- cp_error ("no member function `%T::%D(%A)' defined",
- save_basetype, save_name, TREE_CHAIN (parmtypes));
- return error_mark_node;
- }
- continue;
- }
-
- if (cp - candidates != 0)
- {
- /* Rank from worst to best. Then cp will point to best one.
- Private fields have their bits flipped. For unsigned
- numbers, this should make them look very large.
- If the best alternate has a (signed) negative value,
- then all we ever saw were private members. */
- if (cp - candidates > 1)
- {
- int n_candidates = cp - candidates;
- extern int warn_synth;
- TREE_VALUE (parms) = instance_ptr;
- cp = ideal_candidate (candidates, n_candidates, len);
- if (cp == (struct candidate *)0)
- {
- if (flags & LOOKUP_COMPLAIN)
- {
- TREE_CHAIN (last) = void_list_node;
- cp_error ("call of overloaded %s `%D(%A)' is ambiguous",
- name_kind, save_name, TREE_CHAIN (parmtypes));
- print_n_candidates (candidates, n_candidates);
- }
- return error_mark_node;
- }
- if (cp->h.code & EVIL_CODE)
- return error_mark_node;
- if (warn_synth
- && DECL_NAME (cp->function) == ansi_opname[MODIFY_EXPR]
- && DECL_ARTIFICIAL (cp->function)
- && n_candidates == 2)
- {
- cp_warning ("using synthesized `%#D' for copy assignment",
- cp->function);
- cp_warning_at (" where cfront would use `%#D'",
- candidates->function);
- }
- }
- else if (cp[-1].h.code & EVIL_CODE)
- {
- if (flags & LOOKUP_COMPLAIN)
- cp_error ("ambiguous type conversion requested for %s `%D'",
- name_kind, save_name);
- return error_mark_node;
- }
- else
- cp--;
-
- /* The global function was the best, so use it. */
- if (cp->u.field == 0)
- {
- /* We must convert the instance pointer into a reference type.
- Global overloaded functions can only either take
- aggregate objects (which come for free from references)
- or reference data types anyway. */
- TREE_VALUE (parms) = copy_node (instance_ptr);
- TREE_TYPE (TREE_VALUE (parms)) = build_reference_type (TREE_TYPE (TREE_TYPE (instance_ptr)));
- return build_function_call (cp->function, parms);
- }
-
- function = cp->function;
- basetype_path = cp->basetypes;
- if (! DECL_STATIC_FUNCTION_P (function))
- TREE_VALUE (parms) = cp->arg;
- goto found_and_maybe_warn;
- }
-
- if (flags & (LOOKUP_COMPLAIN|LOOKUP_SPECULATIVELY))
- {
- if ((flags & (LOOKUP_SPECULATIVELY|LOOKUP_COMPLAIN))
- == LOOKUP_SPECULATIVELY)
- return NULL_TREE;
-
- if (DECL_STATIC_FUNCTION_P (cp->function))
- parms = TREE_CHAIN (parms);
- if (ever_seen)
- {
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
- if (static_call_context
- && TREE_CODE (TREE_TYPE (cp->function)) == METHOD_TYPE)
- cp_error ("object missing in call to `%D'", cp->function);
- else if (ever_seen > 1)
- {
- TREE_CHAIN (last) = void_list_node;
- cp_error ("no matching function for call to `%T::%D (%A)%V'",
- TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (instance_ptr))),
- save_name, TREE_CHAIN (parmtypes),
- TREE_TYPE (TREE_TYPE (instance_ptr)));
- TREE_CHAIN (last) = NULL_TREE;
- print_candidates (found_fns);
- }
- else
- report_type_mismatch (cp, parms, name_kind);
- return error_mark_node;
- }
-
- if ((flags & (LOOKUP_SPECULATIVELY|LOOKUP_COMPLAIN))
- == LOOKUP_COMPLAIN)
- {
- cp_error ("%T has no method named %D", save_basetype, save_name);
- return error_mark_node;
- }
- return NULL_TREE;
- }
- continue;
-
- found_and_maybe_warn:
- if ((cp->harshness[0].code & CONST_CODE)
- /* 12.1p2: Constructors can be called for const objects. */
- && ! DECL_CONSTRUCTOR_P (cp->function))
- {
- if (flags & LOOKUP_COMPLAIN)
- {
- cp_error_at ("non-const member function `%D'", cp->function);
- error ("called for const object at this point in file");
- }
- /* Not good enough for a match. */
- else
- return error_mark_node;
- }
- goto found;
- }
- /* Silently return error_mark_node. */
- return error_mark_node;
-
- found:
- if (flags & LOOKUP_PROTECT)
- access = compute_access (basetype_path, function);
-
- if (access == access_private_node)
- {
- if (flags & LOOKUP_COMPLAIN)
- {
- cp_error_at ("%s `%+#D' is %s", name_kind, function,
- TREE_PRIVATE (function) ? "private"
- : "from private base class");
- error ("within this context");
- }
- return error_mark_node;
- }
- else if (access == access_protected_node)
- {
- if (flags & LOOKUP_COMPLAIN)
- {
- cp_error_at ("%s `%+#D' %s", name_kind, function,
- TREE_PROTECTED (function) ? "is protected"
- : "has protected accessibility");
- error ("within this context");
- }
- return error_mark_node;
- }
-
- /* From here on down, BASETYPE is the type that INSTANCE_PTR's
- type (if it exists) is a pointer to. */
-
- if (DECL_ABSTRACT_VIRTUAL_P (function)
- && instance == current_class_ref
- && DECL_CONSTRUCTOR_P (current_function_decl)
- && ! (flags & LOOKUP_NONVIRTUAL)
- && value_member (function, get_abstract_virtuals (basetype)))
- cp_error ("abstract virtual `%#D' called from constructor", function);
-
- if (IS_SIGNATURE (basetype))
- {
- if (static_call_context)
- {
- cp_error ("cannot call signature member function `%T::%D' without signature pointer/reference",
- basetype, save_name);
- return error_mark_node;
- }
- return build_signature_method_call (function, parms);
- }
-
- function = DECL_MAIN_VARIANT (function);
- mark_used (function);
-
- fntype = TREE_TYPE (function);
- if (TREE_CODE (fntype) == POINTER_TYPE)
- fntype = TREE_TYPE (fntype);
- basetype = DECL_CLASS_CONTEXT (function);
-
- /* If we are referencing a virtual function from an object
- of effectively static type, then there is no need
- to go through the virtual function table. */
- if (need_vtbl == maybe_needed)
- {
- int fixed_type = resolves_to_fixed_type_p (instance, 0);
-
- if (all_virtual == 1
- && DECL_VINDEX (function)
- && may_be_remote (basetype))
- need_vtbl = needed;
- else if (DECL_VINDEX (function))
- need_vtbl = fixed_type ? unneeded : needed;
- else
- need_vtbl = not_needed;
- }
-
- if (TREE_CODE (fntype) == METHOD_TYPE && static_call_context
- && !DECL_CONSTRUCTOR_P (function))
- {
- /* Let's be nasty to the user now, and give reasonable
- error messages. */
- instance_ptr = current_class_ptr;
- if (instance_ptr)
- {
- if (basetype != current_class_type)
- {
- if (basetype == error_mark_node)
- return error_mark_node;
- else
- {
- if (orig_basetype != NULL_TREE)
- error_not_base_type (orig_basetype, current_class_type);
- else
- error_not_base_type (function, current_class_type);
- return error_mark_node;
- }
- }
- }
- /* Only allow a static member function to call another static member
- function. */
- else if (DECL_LANG_SPECIFIC (function)
- && !DECL_STATIC_FUNCTION_P (function))
- {
- cp_error ("cannot call member function `%D' without object",
- function);
- return error_mark_node;
- }
- }
-
- value_type = TREE_TYPE (fntype) ? TREE_TYPE (fntype) : void_type_node;
-
- if (TYPE_SIZE (complete_type (value_type)) == 0)
- {
- if (flags & LOOKUP_COMPLAIN)
- incomplete_type_error (0, value_type);
- return error_mark_node;
- }
-
- if (DECL_STATIC_FUNCTION_P (function))
- parms = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype),
- TREE_CHAIN (parms), function, LOOKUP_NORMAL);
- else if (need_vtbl == unneeded)
- {
- int sub_flags = DECL_CONSTRUCTOR_P (function) ? flags : LOOKUP_NORMAL;
- basetype = TREE_TYPE (instance);
- if (TYPE_METHOD_BASETYPE (TREE_TYPE (function))
- != TYPE_MAIN_VARIANT (basetype))
- {
- basetype = DECL_CLASS_CONTEXT (function);
- instance_ptr = convert_pointer_to (basetype, instance_ptr);
- instance = build_indirect_ref (instance_ptr, NULL_PTR);
- }
- parms = tree_cons (NULL_TREE, instance_ptr,
- convert_arguments (NULL_TREE, TREE_CHAIN (TYPE_ARG_TYPES (fntype)), TREE_CHAIN (parms), function, sub_flags));
- }
- else
- {
- if ((flags & LOOKUP_NONVIRTUAL) == 0)
- basetype = DECL_CONTEXT (function);
-
- /* First parm could be integer_zerop with casts like
- ((Object*)0)->Object::IsA() */
- if (!integer_zerop (TREE_VALUE (parms)))
- {
- /* Since we can't have inheritance with a union, doing get_binfo
- on it won't work. We do all the convert_pointer_to_real
- stuff to handle MI correctly...for unions, that's not
- an issue, so we must short-circuit that extra work here. */
- tree tmp = TREE_TYPE (TREE_TYPE (TREE_VALUE (parms)));
- if (tmp != NULL_TREE && TREE_CODE (tmp) == UNION_TYPE)
- instance_ptr = TREE_VALUE (parms);
- else
- {
- tree binfo = get_binfo (basetype,
- TREE_TYPE (TREE_TYPE (TREE_VALUE (parms))),
- 0);
- instance_ptr = convert_pointer_to_real (binfo, TREE_VALUE (parms));
- }
- instance_ptr
- = convert_pointer_to (build_type_variant (basetype,
- constp, volatilep),
- instance_ptr);
-
- if (TREE_CODE (instance_ptr) == COND_EXPR)
- {
- instance_ptr = save_expr (instance_ptr);
- instance = build_indirect_ref (instance_ptr, NULL_PTR);
- }
- else if (TREE_CODE (instance_ptr) == NOP_EXPR
- && TREE_CODE (TREE_OPERAND (instance_ptr, 0)) == ADDR_EXPR
- && TREE_OPERAND (TREE_OPERAND (instance_ptr, 0), 0) == instance)
- ;
- /* The call to `convert_pointer_to' may return error_mark_node. */
- else if (instance_ptr == error_mark_node)
- return instance_ptr;
- else if (instance == NULL_TREE
- || TREE_CODE (instance) != INDIRECT_REF
- || TREE_OPERAND (instance, 0) != instance_ptr)
- instance = build_indirect_ref (instance_ptr, NULL_PTR);
- }
- parms = tree_cons (NULL_TREE, instance_ptr,
- convert_arguments (NULL_TREE, TREE_CHAIN (TYPE_ARG_TYPES (fntype)), TREE_CHAIN (parms), function, LOOKUP_NORMAL));
- }
-
- if (parms == error_mark_node
- || (parms && TREE_CHAIN (parms) == error_mark_node))
- return error_mark_node;
-
- if (need_vtbl == needed)
- {
- function = build_vfn_ref (&TREE_VALUE (parms), instance,
- DECL_VINDEX (function));
- TREE_TYPE (function) = build_pointer_type (fntype);
- }
-
- if (TREE_CODE (function) == FUNCTION_DECL)
- GNU_xref_call (current_function_decl,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (function)));
-
- result = build_call (function, value_type, parms);
- if (IS_AGGR_TYPE (value_type))
- result = build_cplus_new (value_type, result);
- result = convert_from_reference (result);
- return result;
-}
-
-/* Similar to `build_method_call', but for overloaded non-member functions.
- The name of this function comes through NAME. The name depends
- on PARMS.
-
- Note that this function must handle simple `C' promotions,
- as well as variable numbers of arguments (...), and
- default arguments to boot.
-
- If the overloading is successful, we return a tree node which
- contains the call to the function.
-
- If overloading produces candidates which are probable, but not definite,
- we hold these candidates. If FINAL_CP is non-zero, then we are free
- to assume that final_cp points to enough storage for all candidates that
- this function might generate. The `harshness' array is preallocated for
- the first candidate, but not for subsequent ones.
-
- Note that the DECL_RTL of FUNCTION must be made to agree with this
- function's new name. */
-
-tree
-build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
- tree fnname, parms;
- int flags;
- struct candidate *final_cp;
- int require_complete;
-{
- /* must check for overloading here */
- tree functions, function;
- tree parmtypes, last;
- register tree outer;
- int length;
- int parmlength = list_length (parms);
-
- struct candidate *candidates, *cp;
-
- if (final_cp)
- {
- final_cp[0].h.code = 0;
- final_cp[0].h.distance = 0;
- final_cp[0].function = 0;
- /* end marker. */
- final_cp[1].h.code = EVIL_CODE;
- }
-
- parmtypes = default_parm_conversions (parms, &last);
- if (parmtypes == error_mark_node)
- {
- if (final_cp)
- final_cp->h.code = EVIL_CODE;
- return error_mark_node;
- }
-
- if (last)
- TREE_CHAIN (last) = void_list_node;
- else
- parmtypes = void_list_node;
-
- if (is_overloaded_fn (fnname))
- {
- functions = fnname;
- if (TREE_CODE (fnname) == TREE_LIST)
- fnname = TREE_PURPOSE (functions);
- else if (TREE_CODE (fnname) == FUNCTION_DECL)
- fnname = DECL_NAME (functions);
- }
- else
- functions = lookup_name_nonclass (fnname);
-
- if (functions == NULL_TREE)
- {
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
- if (flags & LOOKUP_COMPLAIN)
- error ("only member functions apply");
- if (final_cp)
- final_cp->h.code = EVIL_CODE;
- return error_mark_node;
- }
-
- if (TREE_CODE (functions) == FUNCTION_DECL && ! IDENTIFIER_OPNAME_P (fnname))
- {
- functions = DECL_MAIN_VARIANT (functions);
- if (final_cp)
- {
- /* We are just curious whether this is a viable alternative or
- not. */
- compute_conversion_costs (functions, parms, final_cp, parmlength);
- return functions;
- }
- else
- return build_function_call_real (functions, parms, 1, flags);
- }
-
- if (TREE_CODE (functions) == TREE_LIST
- && TREE_VALUE (functions) == NULL_TREE)
- {
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
-
- if (flags & LOOKUP_COMPLAIN)
- cp_error ("function `%D' declared overloaded, but no instances of that function declared",
- TREE_PURPOSE (functions));
- if (final_cp)
- final_cp->h.code = EVIL_CODE;
- return error_mark_node;
- }
-
- length = count_functions (functions);
-
- if (final_cp)
- candidates = final_cp;
- else
- {
- candidates
- = (struct candidate *)alloca ((length+1) * sizeof (struct candidate));
- bzero ((char *) candidates, (length + 1) * sizeof (struct candidate));
- }
-
- cp = candidates;
-
- my_friendly_assert (is_overloaded_fn (functions), 169);
-
- functions = get_first_fn (functions);
-
- /* OUTER is the list of FUNCTION_DECLS, in a TREE_LIST. */
- for (outer = functions; outer; outer = DECL_CHAIN (outer))
- {
- int template_cost = 0;
- function = outer;
- if (TREE_CODE (function) != FUNCTION_DECL
- && ! (TREE_CODE (function) == TEMPLATE_DECL
- && TREE_CODE (DECL_TEMPLATE_RESULT (function)) == FUNCTION_DECL))
- {
- enum tree_code code = TREE_CODE (function);
- if (code == TEMPLATE_DECL)
- code = TREE_CODE (DECL_TEMPLATE_RESULT (function));
- if (code == CONST_DECL)
- cp_error_at
- ("enumeral value `%D' conflicts with function of same name",
- function);
- else if (code == VAR_DECL)
- {
- if (TREE_STATIC (function))
- cp_error_at
- ("variable `%D' conflicts with function of same name",
- function);
- else
- cp_error_at
- ("constant field `%D' conflicts with function of same name",
- function);
- }
- else if (code == TYPE_DECL)
- continue;
- else
- my_friendly_abort (2);
- error ("at this point in file");
- continue;
- }
- if (TREE_CODE (function) == TEMPLATE_DECL)
- {
- int ntparms = TREE_VEC_LENGTH (DECL_TEMPLATE_PARMS (function));
- tree *targs = (tree *) alloca (sizeof (tree) * ntparms);
- int i;
-
- i = type_unification (DECL_TEMPLATE_PARMS (function), targs,
- TYPE_ARG_TYPES (TREE_TYPE (function)),
- parms, &template_cost, 0, 0);
- if (i == 0)
- {
- function = instantiate_template (function, targs);
- if (function == error_mark_node)
- return function;
- }
- }
-
- if (TREE_CODE (function) == TEMPLATE_DECL)
- {
- /* Unconverted template -- failed match. */
- cp->function = function;
- cp->u.bad_arg = -4;
- cp->h.code = EVIL_CODE;
- }
- else
- {
- struct candidate *cp2;
-
- /* Check that this decl is not the same as a function that's in
- the list due to some template instantiation. */
- cp2 = candidates;
- while (cp2 != cp)
- if (cp2->function == function)
- break;
- else
- cp2 += 1;
- if (cp2->function == function)
- continue;
-
- function = DECL_MAIN_VARIANT (function);
-
- /* Can't use alloca here, since result might be
- passed to calling function. */
- cp->h_len = parmlength;
- cp->harshness = (struct harshness_code *)
- oballoc ((parmlength + 1) * sizeof (struct harshness_code));
-
- compute_conversion_costs (function, parms, cp, parmlength);
-
- /* Make sure this is clear as well. */
- cp->h.int_penalty += template_cost;
-
- if ((cp[0].h.code & EVIL_CODE) == 0)
- {
- cp[1].h.code = EVIL_CODE;
- cp++;
- }
- }
- }
-
- if (cp - candidates)
- {
- tree rval = error_mark_node;
-
- /* Leave marker. */
- cp[0].h.code = EVIL_CODE;
- if (cp - candidates > 1)
- {
- struct candidate *best_cp
- = ideal_candidate (candidates, cp - candidates, parmlength);
- if (best_cp == (struct candidate *)0)
- {
- if (flags & LOOKUP_COMPLAIN)
- {
- cp_error ("call of overloaded `%D' is ambiguous", fnname);
- print_n_candidates (candidates, cp - candidates);
- }
- return error_mark_node;
- }
- else
- rval = best_cp->function;
- }
- else
- {
- cp -= 1;
- if (cp->h.code & EVIL_CODE)
- {
- if (flags & LOOKUP_COMPLAIN)
- error ("type conversion ambiguous");
- }
- else
- rval = cp->function;
- }
-
- if (final_cp)
- return rval;
-
- return build_function_call_real (rval, parms, require_complete, flags);
- }
-
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
-
- if (flags & LOOKUP_COMPLAIN)
- report_type_mismatch (cp, parms, "function",
- decl_as_string (cp->function, 1));
-
- return error_mark_node;
-}
-
-/* This requires a complete type on the result of the call. */
-
-tree
-build_overload_call (fnname, parms, flags)
- tree fnname, parms;
- int flags;
-{
- return build_overload_call_real (fnname, parms, flags, (struct candidate *)0, 1);
-}
-
-/* New overloading code. */
-
-struct z_candidate {
- tree fn;
- tree convs;
- tree second_conv;
- int viable;
- tree basetype_path;
- tree template;
- struct z_candidate *next;
-};
-
-#define IDENTITY_RANK 0
-#define EXACT_RANK 1
-#define PROMO_RANK 2
-#define STD_RANK 3
-#define PBOOL_RANK 4
-#define USER_RANK 5
-#define ELLIPSIS_RANK 6
-#define BAD_RANK 7
-
-#define ICS_RANK(NODE) \
- (ICS_BAD_FLAG (NODE) ? BAD_RANK \
- : ICS_ELLIPSIS_FLAG (NODE) ? ELLIPSIS_RANK \
- : ICS_USER_FLAG (NODE) ? USER_RANK \
- : ICS_STD_RANK (NODE))
-
-#define ICS_STD_RANK(NODE) TREE_COMPLEXITY (NODE)
-
-#define ICS_USER_FLAG(NODE) TREE_LANG_FLAG_0 (NODE)
-#define ICS_ELLIPSIS_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
-#define ICS_THIS_FLAG(NODE) TREE_LANG_FLAG_2 (NODE)
-#define ICS_BAD_FLAG(NODE) TREE_LANG_FLAG_3 (NODE)
-
-#define USER_CONV_FN(NODE) TREE_OPERAND (NODE, 1)
-
-static struct z_candidate * build_user_type_conversion_1 ();
-static tree convert_like ();
-static tree build_over_call ();
-static struct z_candidate * tourney ();
-static void enforce_access ();
-
-int
-null_ptr_cst_p (t)
- tree t;
-{
- if (t == null_node
- || integer_zerop (t) && INTEGRAL_TYPE_P (TREE_TYPE (t)))
- return 1;
- /* Remove this eventually. */
- if (! pedantic && TREE_TYPE (t) == ptr_type_node && integer_zerop (t))
- return 1;
- return 0;
-}
-
-static tree
-build_conv (code, type, from)
- enum tree_code code;
- tree type, from;
-{
- tree t = build1 (code, type, from);
- int rank = ICS_STD_RANK (from);
- switch (code)
- {
- case PTR_CONV:
- case PMEM_CONV:
- case BASE_CONV:
- case STD_CONV:
- if (rank < STD_RANK)
- rank = STD_RANK;
- break;
-
- case LVALUE_CONV:
- case QUAL_CONV:
- case RVALUE_CONV:
- if (rank < EXACT_RANK)
- rank = EXACT_RANK;
-
- default:
- break;
- }
- ICS_STD_RANK (t) = rank;
- ICS_USER_FLAG (t) = ICS_USER_FLAG (from);
- ICS_BAD_FLAG (t) = ICS_BAD_FLAG (from);
- return t;
-}
-
-static tree
-non_reference (t)
- tree t;
-{
- if (TREE_CODE (t) == REFERENCE_TYPE)
- t = TREE_TYPE (t);
- return t;
-}
-
-static tree
-strip_top_quals (t)
- tree t;
-{
- if (TREE_CODE (t) == ARRAY_TYPE)
- return t;
- return TYPE_MAIN_VARIANT (t);
-}
-
-/* Returns the standard conversion path (see [conv]) from type FROM to type
- TO, if any. For proper handling of null pointer constants, you must
- also pass the expression EXPR to convert from. */
-
-static tree
-standard_conversion (to, from, expr)
- tree to, from, expr;
-{
- enum tree_code fcode, tcode;
- tree conv;
- int fromref = 0;
-
- if (TREE_CODE (to) == REFERENCE_TYPE)
- to = TREE_TYPE (to);
- if (TREE_CODE (from) == REFERENCE_TYPE)
- {
- fromref = 1;
- from = TREE_TYPE (from);
- }
- to = strip_top_quals (to);
- from = strip_top_quals (from);
-
- fcode = TREE_CODE (from);
- tcode = TREE_CODE (to);
-
- conv = build1 (IDENTITY_CONV, from, expr);
-
- if (fcode == FUNCTION_TYPE)
- {
- from = build_pointer_type (from);
- fcode = TREE_CODE (from);
- conv = build_conv (LVALUE_CONV, from, conv);
- }
- else if (fcode == ARRAY_TYPE)
- {
- from = build_pointer_type (TREE_TYPE (from));
- fcode = TREE_CODE (from);
- conv = build_conv (LVALUE_CONV, from, conv);
- }
- else if (fromref || (expr && real_lvalue_p (expr)))
- conv = build_conv (RVALUE_CONV, from, conv);
-
- if (from == to)
- return conv;
-
- if ((tcode == POINTER_TYPE || TYPE_PTRMEMFUNC_P (to))
- && expr && null_ptr_cst_p (expr))
- {
- conv = build_conv (STD_CONV, to, conv);
- }
- else if (tcode == POINTER_TYPE && fcode == POINTER_TYPE)
- {
- enum tree_code ufcode = TREE_CODE (TREE_TYPE (from));
- enum tree_code utcode = TREE_CODE (TREE_TYPE (to));
- tree nconv = NULL_TREE;
-
- if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (from)),
- TYPE_MAIN_VARIANT (TREE_TYPE (to)), 1))
- nconv = conv;
- else if (utcode == VOID_TYPE && ufcode != OFFSET_TYPE
- && ufcode != FUNCTION_TYPE)
- {
- from = build_pointer_type
- (cp_build_type_variant (void_type_node,
- TYPE_READONLY (TREE_TYPE (from)),
- TYPE_VOLATILE (TREE_TYPE (from))));
- nconv = build_conv (PTR_CONV, from, conv);
- }
- else if (ufcode == OFFSET_TYPE && utcode == OFFSET_TYPE)
- {
- tree fbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (from));
- tree tbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (to));
-
- if (DERIVED_FROM_P (fbase, tbase)
- && (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (from))),
- TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (to))),
- 1)))
- {
- from = build_offset_type (tbase, TREE_TYPE (TREE_TYPE (from)));
- from = build_pointer_type (from);
- nconv = build_conv (PMEM_CONV, from, conv);
- }
- }
- else if (IS_AGGR_TYPE (TREE_TYPE (from))
- && IS_AGGR_TYPE (TREE_TYPE (to)))
- {
- if (DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from)))
- {
- from = cp_build_type_variant (TREE_TYPE (to),
- TYPE_READONLY (TREE_TYPE (from)),
- TYPE_VOLATILE (TREE_TYPE (from)));
- from = build_pointer_type (from);
- nconv = build_conv (PTR_CONV, from, conv);
- }
- }
-
- if (nconv && comptypes (from, to, 1))
- conv = nconv;
- else if (nconv && comp_ptr_ttypes (TREE_TYPE (to), TREE_TYPE (from)))
- conv = build_conv (QUAL_CONV, to, nconv);
- else if (ptr_reasonably_similar (TREE_TYPE (to), TREE_TYPE (from)))
- {
- conv = build_conv (PTR_CONV, to, conv);
- ICS_BAD_FLAG (conv) = 1;
- }
- else
- return 0;
-
- from = to;
- }
- else if (TYPE_PTRMEMFUNC_P (to) && TYPE_PTRMEMFUNC_P (from))
- {
- tree fromfn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (from));
- tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to));
- tree fbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fromfn)));
- tree tbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (tofn)));
-
- if (! DERIVED_FROM_P (fbase, tbase)
- || ! comptypes (TREE_TYPE (fromfn), TREE_TYPE (tofn), 1)
- || ! compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)),
- TREE_CHAIN (TYPE_ARG_TYPES (tofn)), 1)
- || TYPE_READONLY (fbase) != TYPE_READONLY (tbase)
- || TYPE_VOLATILE (fbase) != TYPE_VOLATILE (tbase))
- return 0;
-
- from = cp_build_type_variant (tbase, TYPE_READONLY (fbase),
- TYPE_VOLATILE (fbase));
- from = build_cplus_method_type (from, TREE_TYPE (fromfn),
- TREE_CHAIN (TYPE_ARG_TYPES (fromfn)));
- from = build_ptrmemfunc_type (build_pointer_type (from));
- conv = build_conv (PMEM_CONV, from, conv);
- }
- else if (tcode == BOOLEAN_TYPE)
- {
- if (! (INTEGRAL_CODE_P (fcode) || fcode == REAL_TYPE
- || fcode == POINTER_TYPE || TYPE_PTRMEMFUNC_P (from)))
- return 0;
-
- conv = build_conv (STD_CONV, to, conv);
- if (fcode == POINTER_TYPE || TYPE_PTRMEMFUNC_P (from)
- && ICS_STD_RANK (conv) < PBOOL_RANK)
- ICS_STD_RANK (conv) = PBOOL_RANK;
- }
- /* We don't check for ENUMERAL_TYPE here because there are no standard
- conversions to enum type. */
- else if (tcode == INTEGER_TYPE || tcode == BOOLEAN_TYPE
- || tcode == REAL_TYPE)
- {
- if (! (INTEGRAL_CODE_P (fcode) || fcode == REAL_TYPE))
- return 0;
- conv = build_conv (STD_CONV, to, conv);
-
- /* Give this a better rank if it's a promotion. */
- if (to == type_promotes_to (from)
- && ICS_STD_RANK (TREE_OPERAND (conv, 0)) <= PROMO_RANK)
- ICS_STD_RANK (conv) = PROMO_RANK;
- }
- else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
- && DERIVED_FROM_P (to, from))
- conv = build_conv (BASE_CONV, to, conv);
- else
- return 0;
-
- return conv;
-}
-
-/* Returns the conversion path from type FROM to reference type TO for
- purposes of reference binding. For lvalue binding, either pass a
- reference type to FROM or an lvalue expression to EXPR.
-
- Currently does not distinguish in the generated trees between binding to
- an lvalue and a temporary. Should it? */
-
-static tree
-reference_binding (rto, rfrom, expr, flags)
- tree rto, rfrom, expr;
- int flags;
-{
- tree conv;
- int lvalue = 1;
- tree to = TREE_TYPE (rto);
- tree from = rfrom;
-
- if (TREE_CODE (from) == REFERENCE_TYPE)
- from = TREE_TYPE (from);
- else if (! expr || ! real_lvalue_p (expr))
- lvalue = 0;
-
- if (lvalue
- && TYPE_READONLY (to) >= TYPE_READONLY (from)
- && TYPE_VOLATILE (to) >= TYPE_VOLATILE (from))
- {
- conv = build1 (IDENTITY_CONV, from, expr);
-
- if (TYPE_MAIN_VARIANT (to) == TYPE_MAIN_VARIANT (from))
- conv = build_conv (REF_BIND, rto, conv);
- else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
- && DERIVED_FROM_P (to, from))
- {
- conv = build_conv (REF_BIND, rto, conv);
- ICS_STD_RANK (conv) = STD_RANK;
- }
- else
- conv = NULL_TREE;
- }
- else
- conv = NULL_TREE;
-
- if (! conv)
- {
- conv = standard_conversion (to, rfrom, expr);
- if (conv)
- {
- conv = build_conv (REF_BIND, rto, conv);
-
- /* Bind directly to a base subobject of a class rvalue. Do it
- after building the conversion for proper handling of ICS_RANK. */
- if (TREE_CODE (TREE_OPERAND (conv, 0)) == BASE_CONV)
- TREE_OPERAND (conv, 0) = TREE_OPERAND (TREE_OPERAND (conv, 0), 0);
- }
- if (conv && ! (TYPE_READONLY (to) && ! TYPE_VOLATILE (to)
- && (flags & LOOKUP_NO_TEMP_BIND) == 0))
- ICS_BAD_FLAG (conv) = 1;
- }
-
- return conv;
-}
-
-/* Returns the implicit conversion sequence (see [over.ics]) from type FROM
- to type TO. The optional expression EXPR may affect the conversion.
- FLAGS are the usual overloading flags. Only LOOKUP_NO_CONVERSION is
- significant. */
-
-static tree
-implicit_conversion (to, from, expr, flags)
- tree to, from, expr;
- int flags;
-{
- tree conv;
- struct z_candidate *cand;
-
- if (expr && type_unknown_p (expr))
- {
- expr = instantiate_type (to, expr, 0);
- if (expr == error_mark_node)
- return 0;
- from = TREE_TYPE (expr);
- }
-
- if (TREE_CODE (to) == REFERENCE_TYPE)
- conv = reference_binding (to, from, expr, flags);
- else
- conv = standard_conversion (to, from, expr);
-
- if (conv)
- ;
- else if ((IS_AGGR_TYPE (non_reference (from))
- || IS_AGGR_TYPE (non_reference (to)))
- && (flags & LOOKUP_NO_CONVERSION) == 0)
- {
- if (TREE_CODE (to) == REFERENCE_TYPE
- && TYPE_READONLY (TREE_TYPE (to))
- && ! TYPE_VOLATILE (TREE_TYPE (to))
- && (flags & LOOKUP_NO_TEMP_BIND) == 0)
- {
- cand = build_user_type_conversion_1
- (TYPE_MAIN_VARIANT (TREE_TYPE (to)), expr, LOOKUP_ONLYCONVERTING);
- if (cand)
- conv = build_conv (REF_BIND, to, cand->second_conv);
- }
- else
- {
- cand = build_user_type_conversion_1
- (to, expr, LOOKUP_ONLYCONVERTING);
- if (cand)
- conv = cand->second_conv;
- }
- }
-
- return conv;
-}
-
-/* Create an overload candidate for the function or method FN called with
- the argument list ARGLIST and add it to CANDIDATES. FLAGS is passed on
- to implicit_conversion. */
-
-static struct z_candidate *
-add_function_candidate (candidates, fn, arglist, flags)
- struct z_candidate *candidates;
- tree fn, arglist;
- int flags;
-{
- tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (fn));
- int i, len;
- tree convs;
- tree parmnode = parmlist;
- tree argnode = arglist;
- int viable = 1;
- struct z_candidate *cand;
-
- /* The `this' and `in_chrg' arguments to constructors are not considered
- in overload resolution. */
- if (DECL_CONSTRUCTOR_P (fn))
- {
- parmnode = TREE_CHAIN (parmnode);
- argnode = TREE_CHAIN (argnode);
- if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
- {
- parmnode = TREE_CHAIN (parmnode);
- argnode = TREE_CHAIN (argnode);
- }
- }
-
- len = list_length (argnode);
- convs = make_tree_vec (len);
-
- for (i = 0; i < len; ++i)
- {
- tree arg = TREE_VALUE (argnode);
- tree argtype = TREE_TYPE (arg);
- tree t;
-
- argtype = cp_build_type_variant
- (argtype, TREE_READONLY (arg), TREE_THIS_VOLATILE (arg));
-
- if (parmnode == void_list_node)
- break;
- else if (parmnode)
- t = implicit_conversion (TREE_VALUE (parmnode), argtype, arg, flags);
- else
- {
- t = build1 (IDENTITY_CONV, argtype, arg);
- ICS_ELLIPSIS_FLAG (t) = 1;
- }
-
- if (i == 0 && t && TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE
- && ! DECL_CONSTRUCTOR_P (fn))
- ICS_THIS_FLAG (t) = 1;
-
- TREE_VEC_ELT (convs, i) = t;
- if (! t)
- break;
-
- if (ICS_BAD_FLAG (t))
- viable = -1;
-
- if (parmnode)
- parmnode = TREE_CHAIN (parmnode);
- argnode = TREE_CHAIN (argnode);
- }
-
- if (i < len)
- viable = 0;
-
- /* Make sure there are default args for the rest of the parms. */
- for (; parmnode && parmnode != void_list_node;
- parmnode = TREE_CHAIN (parmnode))
- if (! TREE_PURPOSE (parmnode))
- {
- viable = 0;
- break;
- }
-
- cand = (struct z_candidate *) oballoc (sizeof (struct z_candidate));
-
- cand->fn = fn;
- cand->convs = convs;
- cand->second_conv = NULL_TREE;
- cand->viable = viable;
- cand->basetype_path = NULL_TREE;
- cand->template = NULL_TREE;
- cand->next = candidates;
-
- return cand;
-}
-
-/* Create an overload candidate for the conversion function FN which will
- be invoked for expression OBJ, producing a pointer-to-function which
- will in turn be called with the argument list ARGLIST, and add it to
- CANDIDATES. FLAGS is passed on to implicit_conversion. */
-
-static struct z_candidate *
-add_conv_candidate (candidates, fn, obj, arglist)
- struct z_candidate *candidates;
- tree fn, obj, arglist;
-{
- tree totype = TREE_TYPE (TREE_TYPE (fn));
- tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (totype));
- int i, len = list_length (arglist) + 1;
- tree convs = make_tree_vec (len);
- tree parmnode = parmlist;
- tree argnode = arglist;
- int viable = 1;
- struct z_candidate *cand;
- int flags = LOOKUP_NORMAL;
-
- for (i = 0; i < len; ++i)
- {
- tree arg = i == 0 ? obj : TREE_VALUE (argnode);
- tree argtype = lvalue_type (arg);
- tree t;
-
- if (i == 0)
- t = implicit_conversion (totype, argtype, arg, flags);
- else if (parmnode == void_list_node)
- break;
- else if (parmnode)
- t = implicit_conversion (TREE_VALUE (parmnode), argtype, arg, flags);
- else
- {
- t = build1 (IDENTITY_CONV, argtype, arg);
- ICS_ELLIPSIS_FLAG (t) = 1;
- }
-
- TREE_VEC_ELT (convs, i) = t;
- if (! t)
- break;
-
- if (ICS_BAD_FLAG (t))
- viable = -1;
-
- if (i == 0)
- continue;
-
- if (parmnode)
- parmnode = TREE_CHAIN (parmnode);
- argnode = TREE_CHAIN (argnode);
- }
-
- if (i < len)
- viable = 0;
-
- for (; parmnode && parmnode != void_list_node;
- parmnode = TREE_CHAIN (parmnode))
- if (! TREE_PURPOSE (parmnode))
- {
- viable = 0;
- break;
- }
-
- cand = (struct z_candidate *) oballoc (sizeof (struct z_candidate));
-
- cand->fn = fn;
- cand->convs = convs;
- cand->second_conv = NULL_TREE;
- cand->viable = viable;
- cand->basetype_path = NULL_TREE;
- cand->template = NULL_TREE;
- cand->next = candidates;
-
- return cand;
-}
-
-static struct z_candidate *
-build_builtin_candidate (candidates, fnname, type1, type2,
- args, argtypes, flags)
- struct z_candidate *candidates;
- tree fnname, type1, type2, *args, *argtypes;
- int flags;
-
-{
- tree t, convs;
- int viable = 1, i;
- struct z_candidate *cand;
- tree types[2];
-
- types[0] = type1;
- types[1] = type2;
-
- convs = make_tree_vec (args[2] ? 3 : (args[1] ? 2 : 1));
-
- for (i = 0; i < 2; ++i)
- {
- if (! args[i])
- break;
-
- t = implicit_conversion (types[i], argtypes[i], args[i], flags);
- if (! t)
- {
- viable = 0;
- /* We need something for printing the candidate. */
- t = build1 (IDENTITY_CONV, types[i], NULL_TREE);
- }
- else if (ICS_BAD_FLAG (t))
- viable = 0;
- TREE_VEC_ELT (convs, i) = t;
- }
-
- /* For COND_EXPR we rearranged the arguments; undo that now. */
- if (args[2])
- {
- TREE_VEC_ELT (convs, 2) = TREE_VEC_ELT (convs, 1);
- TREE_VEC_ELT (convs, 1) = TREE_VEC_ELT (convs, 0);
- t = implicit_conversion (boolean_type_node, argtypes[2], args[2], flags);
- if (t)
- TREE_VEC_ELT (convs, 0) = t;
- else
- viable = 0;
- }
-
- cand = (struct z_candidate *) oballoc (sizeof (struct z_candidate));
-
- cand->fn = fnname;
- cand->convs = convs;
- cand->second_conv = NULL_TREE;
- cand->viable = viable;
- cand->basetype_path = NULL_TREE;
- cand->template = NULL_TREE;
- cand->next = candidates;
-
- return cand;
-}
-
-static int
-is_complete (t)
- tree t;
-{
- return TYPE_SIZE (complete_type (t)) != NULL_TREE;
-}
-
-/* Create any builtin operator overload candidates for the operator in
- question given the converted operand types TYPE1 and TYPE2. The other
- args are passed through from add_builtin_candidates to
- build_builtin_candidate. */
-
-static struct z_candidate *
-add_builtin_candidate (candidates, code, code2, fnname, type1, type2,
- args, argtypes, flags)
- struct z_candidate *candidates;
- enum tree_code code, code2;
- tree fnname, type1, type2, *args, *argtypes;
- int flags;
-{
- switch (code)
- {
- case POSTINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- args[1] = integer_zero_node;
- type2 = integer_type_node;
- }
-
- switch (code)
- {
-
-/* 4 For every pair T, VQ), where T is an arithmetic or enumeration type,
- and VQ is either volatile or empty, there exist candidate operator
- functions of the form
- VQ T& operator++(VQ T&);
- T operator++(VQ T&, int);
- 5 For every pair T, VQ), where T is an enumeration type or an arithmetic
- type other than bool, and VQ is either volatile or empty, there exist
- candidate operator functions of the form
- VQ T& operator--(VQ T&);
- T operator--(VQ T&, int);
- 6 For every pair T, VQ), where T is a cv-qualified or cv-unqualified
- complete object type, and VQ is either volatile or empty, there exist
- candidate operator functions of the form
- T*VQ& operator++(T*VQ&);
- T*VQ& operator--(T*VQ&);
- T* operator++(T*VQ&, int);
- T* operator--(T*VQ&, int); */
-
- case POSTDECREMENT_EXPR:
- case PREDECREMENT_EXPR:
- if (TREE_CODE (type1) == BOOLEAN_TYPE)
- return candidates;
- case POSTINCREMENT_EXPR:
- case PREINCREMENT_EXPR:
- if ((ARITHMETIC_TYPE_P (type1) && TREE_CODE (type1) != ENUMERAL_TYPE)
- || TYPE_PTROB_P (type1))
- {
- type1 = build_reference_type (type1);
- break;
- }
- return candidates;
-
-/* 7 For every cv-qualified or cv-unqualified complete object type T, there
- exist candidate operator functions of the form
-
- T& operator*(T*);
-
- 8 For every function type T, there exist candidate operator functions of
- the form
- T& operator*(T*); */
-
- case INDIRECT_REF:
- if (TREE_CODE (type1) == POINTER_TYPE
- && (TYPE_PTROB_P (type1)
- || TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE))
- break;
- return candidates;
-
-/* 9 For every type T, there exist candidate operator functions of the form
- T* operator+(T*);
-
- 10For every promoted arithmetic type T, there exist candidate operator
- functions of the form
- T operator+(T);
- T operator-(T); */
-
- case CONVERT_EXPR: /* unary + */
- if (TREE_CODE (type1) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type1)) != OFFSET_TYPE)
- break;
- case NEGATE_EXPR:
- if (ARITHMETIC_TYPE_P (type1))
- break;
- return candidates;
-
-/* 11For every promoted integral type T, there exist candidate operator
- functions of the form
- T operator~(T); */
-
- case BIT_NOT_EXPR:
- if (INTEGRAL_TYPE_P (type1))
- break;
- return candidates;
-
-/* 12For every quintuple C1, C2, T, CV1, CV2), where C2 is a class type, C1
- is the same type as C2 or is a derived class of C2, T is a complete
- object type or a function type, and CV1 and CV2 are cv-qualifier-seqs,
- there exist candidate operator functions of the form
- CV12 T& operator->*(CV1 C1*, CV2 T C2::*);
- where CV12 is the union of CV1 and CV2. */
-
- case MEMBER_REF:
- if (TREE_CODE (type1) == POINTER_TYPE
- && (TYPE_PTRMEMFUNC_P (type2) || TYPE_PTRMEM_P (type2)))
- {
- tree c1 = TREE_TYPE (type1);
- tree c2 = (TYPE_PTRMEMFUNC_P (type2)
- ? TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (type2))
- : TYPE_OFFSET_BASETYPE (TREE_TYPE (type2)));
-
- if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1)
- && (TYPE_PTRMEMFUNC_P (type2)
- || is_complete (TREE_TYPE (TREE_TYPE (type2)))))
- break;
- }
- return candidates;
-
-/* 13For every pair of promoted arithmetic types L and R, there exist can-
- didate operator functions of the form
- LR operator*(L, R);
- LR operator/(L, R);
- LR operator+(L, R);
- LR operator-(L, R);
- bool operator<(L, R);
- bool operator>(L, R);
- bool operator<=(L, R);
- bool operator>=(L, R);
- bool operator==(L, R);
- bool operator!=(L, R);
- where LR is the result of the usual arithmetic conversions between
- types L and R.
-
- 14For every pair of types T and I, where T is a cv-qualified or cv-
- unqualified complete object type and I is a promoted integral type,
- there exist candidate operator functions of the form
- T* operator+(T*, I);
- T& operator[](T*, I);
- T* operator-(T*, I);
- T* operator+(I, T*);
- T& operator[](I, T*);
-
- 15For every T, where T is a pointer to complete object type, there exist
- candidate operator functions of the form112)
- ptrdiff_t operator-(T, T);
-
- 16For every pointer type T, there exist candidate operator functions of
- the form
- bool operator<(T, T);
- bool operator>(T, T);
- bool operator<=(T, T);
- bool operator>=(T, T);
- bool operator==(T, T);
- bool operator!=(T, T);
-
- 17For every pointer to member type T, there exist candidate operator
- functions of the form
- bool operator==(T, T);
- bool operator!=(T, T); */
-
- case MINUS_EXPR:
- if (TYPE_PTROB_P (type1) && TYPE_PTROB_P (type2))
- break;
- if (TYPE_PTROB_P (type1) && INTEGRAL_TYPE_P (type2))
- {
- type2 = ptrdiff_type_node;
- break;
- }
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
- break;
- return candidates;
-
- case EQ_EXPR:
- case NE_EXPR:
- if (TYPE_PTRMEMFUNC_P (type1) && TYPE_PTRMEMFUNC_P (type2)
- || TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))
- break;
- if ((TYPE_PTRMEMFUNC_P (type1) || TYPE_PTRMEM_P (type1))
- && null_ptr_cst_p (args[1]))
- {
- type2 = type1;
- break;
- }
- if ((TYPE_PTRMEMFUNC_P (type2) || TYPE_PTRMEM_P (type2))
- && null_ptr_cst_p (args[0]))
- {
- type1 = type2;
- break;
- }
- case LT_EXPR:
- case GT_EXPR:
- case LE_EXPR:
- case GE_EXPR:
- case MAX_EXPR:
- case MIN_EXPR:
- if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2)
- || TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
- break;
- if (TYPE_PTR_P (type1) && null_ptr_cst_p (args[1]))
- {
- type2 = type1;
- break;
- }
- if (null_ptr_cst_p (args[0]) && TYPE_PTR_P (type2))
- {
- type1 = type2;
- break;
- }
- return candidates;
-
- case PLUS_EXPR:
- if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
- break;
- case ARRAY_REF:
- if (INTEGRAL_TYPE_P (type1) && TYPE_PTROB_P (type2))
- {
- type1 = ptrdiff_type_node;
- break;
- }
- if (TYPE_PTROB_P (type1) && INTEGRAL_TYPE_P (type2))
- {
- type2 = ptrdiff_type_node;
- break;
- }
- return candidates;
-
-/* 18For every pair of promoted integral types L and R, there exist candi-
- date operator functions of the form
- LR operator%(L, R);
- LR operator&(L, R);
- LR operator^(L, R);
- LR operator|(L, R);
- L operator<<(L, R);
- L operator>>(L, R);
- where LR is the result of the usual arithmetic conversions between
- types L and R. */
-
- case TRUNC_MOD_EXPR:
- case BIT_AND_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- if (INTEGRAL_TYPE_P (type1) && INTEGRAL_TYPE_P (type2))
- break;
- return candidates;
-
-/* 19For every triple L, VQ, R), where L is an arithmetic or enumeration
- type, VQ is either volatile or empty, and R is a promoted arithmetic
- type, there exist candidate operator functions of the form
- VQ L& operator=(VQ L&, R);
- VQ L& operator*=(VQ L&, R);
- VQ L& operator/=(VQ L&, R);
- VQ L& operator+=(VQ L&, R);
- VQ L& operator-=(VQ L&, R);
-
- 20For every pair T, VQ), where T is any type and VQ is either volatile
- or empty, there exist candidate operator functions of the form
- T*VQ& operator=(T*VQ&, T*);
-
- 21For every pair T, VQ), where T is a pointer to member type and VQ is
- either volatile or empty, there exist candidate operator functions of
- the form
- VQ T& operator=(VQ T&, T);
-
- 22For every triple T, VQ, I), where T is a cv-qualified or cv-
- unqualified complete object type, VQ is either volatile or empty, and
- I is a promoted integral type, there exist candidate operator func-
- tions of the form
- T*VQ& operator+=(T*VQ&, I);
- T*VQ& operator-=(T*VQ&, I);
-
- 23For every triple L, VQ, R), where L is an integral or enumeration
- type, VQ is either volatile or empty, and R is a promoted integral
- type, there exist candidate operator functions of the form
-
- VQ L& operator%=(VQ L&, R);
- VQ L& operator<<=(VQ L&, R);
- VQ L& operator>>=(VQ L&, R);
- VQ L& operator&=(VQ L&, R);
- VQ L& operator^=(VQ L&, R);
- VQ L& operator|=(VQ L&, R); */
-
- case MODIFY_EXPR:
- switch (code2)
- {
- case PLUS_EXPR:
- case MINUS_EXPR:
- if (TYPE_PTROB_P (type1) && INTEGRAL_TYPE_P (type2))
- {
- type2 = ptrdiff_type_node;
- break;
- }
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
- break;
- return candidates;
-
- case TRUNC_MOD_EXPR:
- case BIT_AND_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- if (INTEGRAL_TYPE_P (type1) && INTEGRAL_TYPE_P (type2))
- break;
- return candidates;
-
- case NOP_EXPR:
- if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
- break;
- if ((TYPE_PTRMEMFUNC_P (type1) && TYPE_PTRMEMFUNC_P (type2))
- || (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
- || (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))
- || ((TYPE_PTRMEMFUNC_P (type1)
- || TREE_CODE (type1) == POINTER_TYPE)
- && null_ptr_cst_p (args[1])))
- {
- type2 = type1;
- break;
- }
- return candidates;
-
- default:
- my_friendly_abort (367);
- }
- type1 = build_reference_type (type1);
- break;
-
- case COND_EXPR:
- /* Kludge around broken overloading rules whereby
- bool ? const char& : enum is ambiguous
- (between int and const char&). */
- flags |= LOOKUP_NO_TEMP_BIND;
-
- /* Extension: Support ?: of enumeral type. Hopefully this will not
- be an extension for long. */
- if (TREE_CODE (type1) == ENUMERAL_TYPE && type1 == type2)
- break;
- else if (TREE_CODE (type1) == ENUMERAL_TYPE
- || TREE_CODE (type2) == ENUMERAL_TYPE)
- return candidates;
- if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
- break;
- if (TREE_CODE (type1) == TREE_CODE (type2)
- && (TREE_CODE (type1) == REFERENCE_TYPE
- || TREE_CODE (type1) == POINTER_TYPE
- || TYPE_PTRMEMFUNC_P (type1)
- || IS_AGGR_TYPE (type1)))
- break;
- if (TREE_CODE (type1) == REFERENCE_TYPE
- || TREE_CODE (type2) == REFERENCE_TYPE)
- return candidates;
- if (((TYPE_PTRMEMFUNC_P (type1) || TREE_CODE (type1) == POINTER_TYPE)
- && null_ptr_cst_p (args[1]))
- || IS_AGGR_TYPE (type1))
- {
- type2 = type1;
- break;
- }
- if (((TYPE_PTRMEMFUNC_P (type2) || TREE_CODE (type2) == POINTER_TYPE)
- && null_ptr_cst_p (args[0]))
- || IS_AGGR_TYPE (type2))
- {
- type1 = type2;
- break;
- }
- return candidates;
-
- default:
- my_friendly_abort (367);
- }
-
- /* If we're dealing with two pointer types, we need candidates
- for both of them. */
- if (type2 && type1 != type2
- && TREE_CODE (type1) == TREE_CODE (type2)
- && (TREE_CODE (type1) == REFERENCE_TYPE
- || (TREE_CODE (type1) == POINTER_TYPE
- && TYPE_PTRMEM_P (type1) == TYPE_PTRMEM_P (type2))
- || TYPE_PTRMEMFUNC_P (type1)
- || IS_AGGR_TYPE (type1)))
- {
- candidates = build_builtin_candidate
- (candidates, fnname, type1, type1, args, argtypes, flags);
- return build_builtin_candidate
- (candidates, fnname, type2, type2, args, argtypes, flags);
- }
-
- return build_builtin_candidate
- (candidates, fnname, type1, type2, args, argtypes, flags);
-}
-
-tree
-type_decays_to (type)
- tree type;
-{
- if (TREE_CODE (type) == ARRAY_TYPE)
- return build_pointer_type (TREE_TYPE (type));
- if (TREE_CODE (type) == FUNCTION_TYPE)
- return build_pointer_type (type);
- return type;
-}
-
-/* There are three conditions of builtin candidates:
-
- 1) bool-taking candidates. These are the same regardless of the input.
- 2) pointer-pair taking candidates. These are generated for each type
- one of the input types converts to.
- 3) arithmetic candidates. According to the WP, we should generate
- all of these, but I'm trying not to... */
-
-static struct z_candidate *
-add_builtin_candidates (candidates, code, code2, fnname, args, flags)
- struct z_candidate *candidates;
- enum tree_code code, code2;
- tree fnname, *args;
- int flags;
-{
- int ref1, i;
- tree type, argtypes[3], types[2];
-
- for (i = 0; i < 3; ++i)
- {
- if (args[i])
- argtypes[i] = lvalue_type (args[i]);
- else
- argtypes[i] = NULL_TREE;
- }
-
- switch (code)
- {
-/* 4 For every pair T, VQ), where T is an arithmetic or enumeration type,
- and VQ is either volatile or empty, there exist candidate operator
- functions of the form
- VQ T& operator++(VQ T&); */
-
- case POSTINCREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case MODIFY_EXPR:
- ref1 = 1;
- break;
-
-/* 24There also exist candidate operator functions of the form
- bool operator!(bool);
- bool operator&&(bool, bool);
- bool operator||(bool, bool); */
-
- case TRUTH_NOT_EXPR:
- return build_builtin_candidate
- (candidates, fnname, boolean_type_node,
- NULL_TREE, args, argtypes, flags);
-
- case TRUTH_ORIF_EXPR:
- case TRUTH_ANDIF_EXPR:
- return build_builtin_candidate
- (candidates, fnname, boolean_type_node,
- boolean_type_node, args, argtypes, flags);
-
- case ADDR_EXPR:
- case COMPOUND_EXPR:
- case COMPONENT_REF:
- return candidates;
-
- default:
- ref1 = 0;
- }
-
- types[0] = types[1] = NULL_TREE;
-
- for (i = 0; i < 2; ++i)
- {
- if (! args[i])
- ;
- else if (IS_AGGR_TYPE (argtypes[i]))
- {
- tree convs = lookup_conversions (argtypes[i]);
-
- if (code == COND_EXPR)
- {
- if (real_lvalue_p (args[i]))
- types[i] = tree_cons
- (NULL_TREE, build_reference_type (argtypes[i]), types[i]);
-
- types[i] = tree_cons
- (NULL_TREE, TYPE_MAIN_VARIANT (argtypes[i]), types[i]);
- }
-
- else if (! convs || (i == 0 && code == MODIFY_EXPR
- && code2 == NOP_EXPR))
- return candidates;
-
- for (; convs; convs = TREE_CHAIN (convs))
- {
- type = TREE_TYPE (TREE_TYPE (TREE_VALUE (convs)));
-
- if (i == 0 && ref1
- && (TREE_CODE (type) != REFERENCE_TYPE
- || TYPE_READONLY (TREE_TYPE (type))))
- continue;
-
- if (code == COND_EXPR && TREE_CODE (type) == REFERENCE_TYPE)
- types[i] = tree_cons (NULL_TREE, type, types[i]);
-
- type = non_reference (type);
- if (i != 0 || ! ref1)
- {
- type = TYPE_MAIN_VARIANT (type_decays_to (type));
- if (code == COND_EXPR && TREE_CODE (type) == ENUMERAL_TYPE)
- types[i] = tree_cons (NULL_TREE, type, types[i]);
- if (INTEGRAL_TYPE_P (type))
- type = type_promotes_to (type);
- }
-
- if (! value_member (type, types[i]))
- types[i] = tree_cons (NULL_TREE, type, types[i]);
- }
- }
- else
- {
- if (code == COND_EXPR && real_lvalue_p (args[i]))
- types[i] = tree_cons
- (NULL_TREE, build_reference_type (argtypes[i]), types[i]);
- type = non_reference (argtypes[i]);
- if (i != 0 || ! ref1)
- {
- type = TYPE_MAIN_VARIANT (type_decays_to (type));
- if (code == COND_EXPR && TREE_CODE (type) == ENUMERAL_TYPE)
- types[i] = tree_cons (NULL_TREE, type, types[i]);
- if (INTEGRAL_TYPE_P (type))
- type = type_promotes_to (type);
- }
- types[i] = tree_cons (NULL_TREE, type, types[i]);
- }
- }
-
- for (; types[0]; types[0] = TREE_CHAIN (types[0]))
- {
- if (types[1])
- for (type = types[1]; type; type = TREE_CHAIN (type))
- candidates = add_builtin_candidate
- (candidates, code, code2, fnname, TREE_VALUE (types[0]),
- TREE_VALUE (type), args, argtypes, flags);
- else
- candidates = add_builtin_candidate
- (candidates, code, code2, fnname, TREE_VALUE (types[0]),
- NULL_TREE, args, argtypes, flags);
- }
-
- return candidates;
-}
-
-static struct z_candidate *
-add_template_candidate (candidates, tmpl, arglist, flags)
- struct z_candidate *candidates;
- tree tmpl, arglist;
- int flags;
-{
- int ntparms = TREE_VEC_LENGTH (DECL_TEMPLATE_PARMS (tmpl));
- tree *targs = (tree *) alloca (sizeof (tree) * ntparms);
- struct z_candidate *cand;
- int i, dummy = 0;
- tree fn;
-
- i = type_unification (DECL_TEMPLATE_PARMS (tmpl), targs,
- TYPE_ARG_TYPES (TREE_TYPE (tmpl)),
- arglist, &dummy, 0, 0);
- if (i != 0)
- return candidates;
-
- fn = instantiate_template (tmpl, targs);
- if (fn == error_mark_node)
- return candidates;
-
- cand = add_function_candidate (candidates, fn, arglist, flags);
- cand->template = DECL_TEMPLATE_INFO (fn);
- return cand;
-}
-
-static int
-any_viable (cands)
- struct z_candidate *cands;
-{
- for (; cands; cands = cands->next)
- if (pedantic ? cands->viable == 1 : cands->viable)
- return 1;
- return 0;
-}
-
-static struct z_candidate *
-splice_viable (cands)
- struct z_candidate *cands;
-{
- struct z_candidate **p = &cands;
-
- for (; *p; )
- {
- if (pedantic ? (*p)->viable == 1 : (*p)->viable)
- p = &((*p)->next);
- else
- *p = (*p)->next;
- }
-
- return cands;
-}
-
-static tree
-build_this (obj)
- tree obj;
-{
- /* Fix this to work on non-lvalues. */
- if (IS_SIGNATURE_POINTER (TREE_TYPE (obj))
- || IS_SIGNATURE_REFERENCE (TREE_TYPE (obj)))
- return obj;
- else
- return build_unary_op (ADDR_EXPR, obj, 0);
-}
-
-static void
-print_z_candidates (candidates)
- struct z_candidate *candidates;
-{
- char *str = "candidates are:";
- for (; candidates; candidates = candidates->next)
- {
- if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE)
- {
- if (candidates->fn == ansi_opname [COND_EXPR])
- cp_error ("%s %D(%T, %T, %T) <builtin>", str, candidates->fn,
- TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)),
- TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)),
- TREE_TYPE (TREE_VEC_ELT (candidates->convs, 2)));
- else if (TREE_VEC_LENGTH (candidates->convs) == 2)
- cp_error ("%s %D(%T, %T) <builtin>", str, candidates->fn,
- TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)),
- TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)));
- else
- cp_error ("%s %D(%T) <builtin>", str, candidates->fn,
- TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)));
- }
- else
- cp_error_at ("%s %+D%s", str, candidates->fn,
- candidates->viable == -1 ? " <near match>" : "");
- str = " ";
- }
-}
-
-/* Returns the best overload candidate to perform the requested
- conversion. */
-
-static struct z_candidate *
-build_user_type_conversion_1 (totype, expr, flags)
- tree totype, expr;
- int flags;
-{
- struct z_candidate *candidates, *cand;
- tree fromtype = TREE_TYPE (expr);
- tree ctors = NULL_TREE, convs = NULL_TREE, *p;
- tree args;
-
- if (IS_AGGR_TYPE (totype))
- ctors = lookup_fnfields (TYPE_BINFO (totype), ctor_identifier, 0);
- if (IS_AGGR_TYPE (fromtype)
- && (! IS_AGGR_TYPE (totype) || ! DERIVED_FROM_P (totype, fromtype)))
- convs = lookup_conversions (fromtype);
-
- candidates = 0;
- flags |= LOOKUP_NO_CONVERSION;
-
- if (ctors)
- {
- tree t = build_int_2 (0, 0);
- TREE_TYPE (t) = build_pointer_type (totype);
- args = build_tree_list (NULL_TREE, expr);
- if (TYPE_USES_VIRTUAL_BASECLASSES (totype))
- args = tree_cons (NULL_TREE, integer_one_node, args);
- args = tree_cons (NULL_TREE, t, args);
-
- ctors = TREE_VALUE (ctors);
- }
- for (; ctors; ctors = DECL_CHAIN (ctors))
- {
- if (DECL_NONCONVERTING_P (ctors))
- continue;
-
- candidates = add_function_candidate (candidates, ctors, args, flags);
- candidates->second_conv = build1 (IDENTITY_CONV, totype, NULL_TREE);
- candidates->basetype_path = TYPE_BINFO (totype);
- }
-
- if (convs)
- args = build_tree_list (NULL_TREE, build_this (expr));
-
- for (; convs; convs = TREE_CHAIN (convs))
- {
- tree fn = TREE_VALUE (convs);
- tree ics = implicit_conversion
- (totype, TREE_TYPE (TREE_TYPE (fn)), 0, LOOKUP_NO_CONVERSION);
- if (ics)
- for (; fn; fn = DECL_CHAIN (fn))
- {
- candidates = add_function_candidate (candidates, fn, args, flags);
- candidates->second_conv = ics;
- candidates->basetype_path = TREE_PURPOSE (convs);
- if (candidates->viable == 1 && ICS_BAD_FLAG (ics))
- candidates->viable = -1;
- }
- }
-
- if (! any_viable (candidates))
- {
-#if 0
- if (flags & LOOKUP_COMPLAIN)
- {
- if (candidates && ! candidates->next)
- /* say why this one won't work or try to be loose */;
- else
- cp_error ("no viable candidates");
- }
-#endif
-
- return 0;
- }
-
- candidates = splice_viable (candidates);
- cand = tourney (candidates, totype);
-
- if (cand == 0)
- {
- if (flags & LOOKUP_COMPLAIN)
- {
- cp_error ("conversion from `%T' to `%T' is ambiguous",
- fromtype, totype);
- print_z_candidates (candidates);
- }
-
- cand = candidates; /* any one will do */
- cand->second_conv = build1 (AMBIG_CONV, totype, expr);
- ICS_USER_FLAG (cand->second_conv) = 1;
- ICS_BAD_FLAG (cand->second_conv) = 1;
-
- return cand;
- }
-
- for (p = &(cand->second_conv); TREE_CODE (*p) != IDENTITY_CONV; )
- p = &(TREE_OPERAND (*p, 0));
-
- *p = build
- (USER_CONV,
- (DECL_CONSTRUCTOR_P (cand->fn)
- ? totype : non_reference (TREE_TYPE (TREE_TYPE (cand->fn)))),
- NULL_TREE, cand->fn, cand->convs, cand->basetype_path);
- ICS_USER_FLAG (cand->second_conv) = 1;
- if (cand->viable == -1)
- ICS_BAD_FLAG (cand->second_conv) = 1;
-
- return cand;
-}
-
-tree
-build_user_type_conversion (totype, expr, flags)
- tree totype, expr;
- int flags;
-{
- struct z_candidate *cand
- = build_user_type_conversion_1 (totype, expr, flags);
-
- if (cand)
- {
- if (TREE_CODE (cand->second_conv) == AMBIG_CONV)
- return error_mark_node;
- return convert_from_reference (convert_like (cand->second_conv, expr));
- }
- return NULL_TREE;
-}
-
-tree
-build_new_function_call (fn, args, obj)
- tree fn, args, obj;
-{
- struct z_candidate *candidates = 0, *cand;
-
- if (obj == NULL_TREE && TREE_CODE (fn) == TREE_LIST)
- {
- tree t;
- tree templates = NULL_TREE;
-
- for (t = args; t; t = TREE_CHAIN (t))
- {
- if (TREE_VALUE (t) == error_mark_node)
- return error_mark_node;
- else if (TREE_CODE (TREE_TYPE (TREE_VALUE (t))) == VOID_TYPE)
- {
- error ("invalid use of void expression");
- return error_mark_node;
- }
- }
-
- for (t = TREE_VALUE (fn); t; t = DECL_CHAIN (t))
- {
- if (TREE_CODE (t) == TEMPLATE_DECL)
- {
- templates = decl_tree_cons (NULL_TREE, t, templates);
- candidates = add_template_candidate
- (candidates, t, args, LOOKUP_NORMAL);
- }
- else
- candidates = add_function_candidate
- (candidates, t, args, LOOKUP_NORMAL);
- }
-
- if (! any_viable (candidates))
- {
- if (candidates && ! candidates->next)
- return build_function_call (candidates->fn, args);
- else
- cp_error ("no matching function for call to `%D (%A)'",
- TREE_PURPOSE (fn), args);
- return error_mark_node;
- }
- candidates = splice_viable (candidates);
- cand = tourney (candidates, NULL_TREE);
-
- if (cand == 0)
- {
- cp_error ("call of overloaded `%D (%A)' is ambiguous",
- TREE_PURPOSE (fn), args);
- print_z_candidates (candidates);
- return error_mark_node;
- }
-
- /* Pedantically, it is ill-formed to define a function that could
- also be a template instantiation, but we won't implement that
- until things settle down. */
- if (templates && ! cand->template && ! DECL_INITIAL (cand->fn))
- add_maybe_template (cand->fn, templates);
-
- return build_over_call (cand->fn, cand->convs, args, LOOKUP_NORMAL);
- }
-
- return build_function_call (fn, args);
-}
-
-static tree
-build_object_call (obj, args)
- tree obj, args;
-{
- struct z_candidate *candidates = 0, *cand;
- tree fns, convs, mem_args;
- tree type = TREE_TYPE (obj);
-
- fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname [CALL_EXPR], 0);
-
- if (fns)
- {
- tree fn = TREE_VALUE (fns);
- mem_args = tree_cons (NULL_TREE, build_this (obj), args);
-
- for (; fn; fn = DECL_CHAIN (fn))
- {
- candidates = add_function_candidate
- (candidates, fn, mem_args, LOOKUP_NORMAL);
- candidates->basetype_path = TREE_PURPOSE (fns);
- }
- }
-
- convs = lookup_conversions (type);
-
- for (; convs; convs = TREE_CHAIN (convs))
- {
- tree fn = TREE_VALUE (convs);
- tree totype = TREE_TYPE (TREE_TYPE (fn));
-
- if (TREE_CODE (totype) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (totype)) == FUNCTION_TYPE)
- for (; fn; fn = DECL_CHAIN (fn))
- {
- candidates = add_conv_candidate (candidates, fn, obj, args);
- candidates->basetype_path = TREE_PURPOSE (convs);
- }
- }
-
- if (! any_viable (candidates))
- {
- cp_error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args);
- print_z_candidates (candidates);
- return error_mark_node;
- }
-
- candidates = splice_viable (candidates);
- cand = tourney (candidates, NULL_TREE);
-
- if (cand == 0)
- {
- cp_error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args);
- print_z_candidates (candidates);
- return error_mark_node;
- }
-
- if (DECL_NAME (cand->fn) == ansi_opname [CALL_EXPR])
- return build_over_call (cand->fn, cand->convs, mem_args, LOOKUP_NORMAL);
-
- obj = convert_like (TREE_VEC_ELT (cand->convs, 0), obj);
-
- /* FIXME */
- return build_function_call (obj, args);
-}
-
-static void
-op_error (code, code2, arg1, arg2, arg3, problem)
- enum tree_code code, code2;
- tree arg1, arg2, arg3;
- char *problem;
-{
- char * opname
- = (code == MODIFY_EXPR ? assignop_tab [code2] : opname_tab [code]);
-
- switch (code)
- {
- case COND_EXPR:
- cp_error ("%s for `%T ? %T : %T'", problem,
- error_type (arg1), error_type (arg2), error_type (arg3));
- break;
- case POSTINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- cp_error ("%s for `%T%s'", problem, error_type (arg1), opname);
- break;
- case ARRAY_REF:
- cp_error ("%s for `%T[%T]'", problem,
- error_type (arg1), error_type (arg2));
- break;
- default:
- if (arg2)
- cp_error ("%s for `%T %s %T'", problem,
- error_type (arg1), opname, error_type (arg2));
- else
- cp_error ("%s for `%s%T'", problem, opname, error_type (arg1));
- }
-}
-
-tree
-build_new_op (code, flags, arg1, arg2, arg3)
- enum tree_code code;
- int flags;
- tree arg1, arg2, arg3;
-{
- struct z_candidate *candidates = 0, *cand;
- tree fns, mem_arglist, arglist, fnname;
- enum tree_code code2 = NOP_EXPR;
- tree templates = NULL_TREE;
-
- if (arg1 == error_mark_node
- || arg2 == error_mark_node
- || arg3 == error_mark_node)
- return error_mark_node;
-
- if (code == MODIFY_EXPR)
- {
- code2 = TREE_CODE (arg3);
- arg3 = NULL_TREE;
- fnname = ansi_assopname[code2];
- }
- else
- fnname = ansi_opname[code];
-
- switch (code)
- {
- case NEW_EXPR:
- case VEC_NEW_EXPR:
- {
- tree rval;
-
- arglist = tree_cons (NULL_TREE, arg2, arg3);
- if (flags & LOOKUP_GLOBAL)
- return build_new_function_call
- (lookup_name_nonclass (fnname), arglist, NULL_TREE);
-
- /* FIXME */
- rval = build_method_call
- (build_indirect_ref (build1 (NOP_EXPR, arg1, error_mark_node),
- "new"),
- fnname, arglist, NULL_TREE, flags);
- if (rval == error_mark_node)
- /* User might declare fancy operator new, but invoke it
- like standard one. */
- return rval;
-
- TREE_TYPE (rval) = arg1;
- TREE_CALLS_NEW (rval) = 1;
- return rval;
- }
-
- case VEC_DELETE_EXPR:
- case DELETE_EXPR:
- {
- tree rval;
-
- if (flags & LOOKUP_GLOBAL)
- return build_new_function_call
- (lookup_name_nonclass (fnname),
- build_tree_list (NULL_TREE, arg1), NULL_TREE);
-
- arglist = tree_cons (NULL_TREE, arg1, build_tree_list (NULL_TREE, arg2));
-
- arg1 = TREE_TYPE (arg1);
-
- /* This handles the case where we're trying to delete
- X (*a)[10];
- a=new X[5][10];
- delete[] a; */
-
- if (TREE_CODE (TREE_TYPE (arg1)) == ARRAY_TYPE)
- {
- /* Strip off the pointer and the array. */
- arg1 = TREE_TYPE (TREE_TYPE (arg1));
-
- while (TREE_CODE (arg1) == ARRAY_TYPE)
- arg1 = (TREE_TYPE (arg1));
-
- arg1 = build_pointer_type (arg1);
- }
-
- /* FIXME */
- rval = build_method_call
- (build_indirect_ref (build1 (NOP_EXPR, arg1,
- error_mark_node),
- NULL_PTR),
- fnname, arglist, NULL_TREE, flags);
-#if 0
- /* This can happen when operator delete is protected. */
- my_friendly_assert (rval != error_mark_node, 250);
- TREE_TYPE (rval) = void_type_node;
-#endif
- return rval;
- }
-
- case CALL_EXPR:
- return build_object_call (arg1, arg2);
- }
-
- /* The comma operator can have void args. */
- if (TREE_CODE (arg1) == OFFSET_REF)
- arg1 = resolve_offset_ref (arg1);
- if (arg2 && TREE_CODE (arg2) == OFFSET_REF)
- arg2 = resolve_offset_ref (arg2);
- if (arg3 && TREE_CODE (arg3) == OFFSET_REF)
- arg3 = resolve_offset_ref (arg3);
-
- if (code == COND_EXPR)
- {
- if (TREE_CODE (TREE_TYPE (arg2)) == VOID_TYPE
- || TREE_CODE (TREE_TYPE (arg3)) == VOID_TYPE
- || (! IS_OVERLOAD_TYPE (TREE_TYPE (arg2))
- && ! IS_OVERLOAD_TYPE (TREE_TYPE (arg3))))
- goto builtin;
- }
- else if (! IS_OVERLOAD_TYPE (TREE_TYPE (arg1))
- && (! arg2 || ! IS_OVERLOAD_TYPE (TREE_TYPE (arg2))))
- goto builtin;
-
- if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR)
- arg2 = integer_zero_node;
-
- fns = lookup_name_nonclass (fnname);
- /* + Koenig lookup */
-
- if (arg2 && arg3)
- arglist = tree_cons (NULL_TREE, arg1, tree_cons
- (NULL_TREE, arg2, build_tree_list (NULL_TREE, arg3)));
- else if (arg2)
- arglist = tree_cons (NULL_TREE, arg1, build_tree_list (NULL_TREE, arg2));
- else
- arglist = build_tree_list (NULL_TREE, arg1);
-
- if (fns && TREE_CODE (fns) == TREE_LIST)
- fns = TREE_VALUE (fns);
- for (; fns; fns = DECL_CHAIN (fns))
- {
- if (TREE_CODE (fns) == TEMPLATE_DECL)
- {
- templates = decl_tree_cons (NULL_TREE, fns, templates);
- candidates = add_template_candidate
- (candidates, fns, arglist, flags);
- }
- else
- candidates = add_function_candidate (candidates, fns, arglist, flags);
- }
-
- if (IS_AGGR_TYPE (TREE_TYPE (arg1)))
- fns = lookup_fnfields (TYPE_BINFO (TREE_TYPE (arg1)), fnname, 0);
- else
- fns = NULL_TREE;
-
- if (fns)
- {
- tree fn = TREE_VALUE (fns);
- mem_arglist = tree_cons (NULL_TREE, build_this (arg1), TREE_CHAIN (arglist));
- for (; fn; fn = DECL_CHAIN (fn))
- {
- if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
- candidates = add_function_candidate
- (candidates, fn, mem_arglist, flags);
- else
- candidates = add_function_candidate (candidates, fn, arglist, flags);
-
- candidates->basetype_path = TREE_PURPOSE (fns);
- }
- }
-
- {
- tree args[3];
-
- /* Rearrange the arguments for ?: so that add_builtin_candidate only has
- to know about two args; a builtin candidate will always have a first
- parameter of type bool. We'll handle that in
- build_builtin_candidate. */
- if (code == COND_EXPR)
- {
- args[0] = arg2;
- args[1] = arg3;
- args[2] = arg1;
- }
- else
- {
- args[0] = arg1;
- args[1] = arg2;
- args[2] = NULL_TREE;
- }
-
- candidates = add_builtin_candidates
- (candidates, code, code2, fnname, args, flags);
- }
-
- if (! any_viable (candidates))
- {
- switch (code)
- {
- case POSTINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- /* Look for an `operator++ (int)'. If they didn't have
- one, then we fall back to the old way of doing things. */
- if (flags & LOOKUP_COMPLAIN)
- cp_pedwarn ("no `%D (int)' declared for postfix `%s', trying prefix operator instead",
- fnname, opname_tab [code]);
- if (code == POSTINCREMENT_EXPR)
- code = PREINCREMENT_EXPR;
- else
- code = PREDECREMENT_EXPR;
- return build_new_op (code, flags, arg1, NULL_TREE, NULL_TREE);
-
- /* The caller will deal with these. */
- case ADDR_EXPR:
- case COMPOUND_EXPR:
- case COMPONENT_REF:
- return NULL_TREE;
- }
- if (flags & LOOKUP_COMPLAIN)
- {
- op_error (code, code2, arg1, arg2, arg3, "no match");
- print_z_candidates (candidates);
- }
- return error_mark_node;
- }
- candidates = splice_viable (candidates);
- cand = tourney (candidates, NULL_TREE);
-
- if (cand == 0)
- {
- if (flags & LOOKUP_COMPLAIN)
- {
- op_error (code, code2, arg1, arg2, arg3, "ambiguous overload");
- print_z_candidates (candidates);
- }
- return error_mark_node;
- }
-
- if (TREE_CODE (cand->fn) == FUNCTION_DECL)
- {
- extern int warn_synth;
- if (warn_synth
- && fnname == ansi_opname[MODIFY_EXPR]
- && DECL_ARTIFICIAL (cand->fn)
- && candidates->next
- && ! candidates->next->next)
- {
- cp_warning ("using synthesized `%#D' for copy assignment",
- cand->fn);
- cp_warning_at (" where cfront would use `%#D'",
- cand == candidates
- ? candidates->next->fn
- : candidates->fn);
- }
-
- if (DECL_FUNCTION_MEMBER_P (cand->fn))
- enforce_access (cand->basetype_path, cand->fn);
-
- /* Pedantically, it is ill-formed to define a function that could
- also be a template instantiation, but we won't implement that
- until things settle down. */
- if (templates && ! cand->template && ! DECL_INITIAL (cand->fn)
- && TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE)
- add_maybe_template (cand->fn, templates);
-
- return build_over_call
- (cand->fn, cand->convs,
- TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
- ? mem_arglist : arglist,
- LOOKUP_NORMAL);
- }
-
- /* Check for comparison of different enum types. */
- switch (code)
- {
- case GT_EXPR:
- case LT_EXPR:
- case GE_EXPR:
- case LE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- if (flag_int_enum_equivalence == 0
- && TREE_CODE (TREE_TYPE (arg1)) == ENUMERAL_TYPE
- && TREE_CODE (TREE_TYPE (arg2)) == ENUMERAL_TYPE
- && (TYPE_MAIN_VARIANT (TREE_TYPE (arg1))
- != TYPE_MAIN_VARIANT (TREE_TYPE (arg2))))
- {
- cp_warning ("comparison between `%#T' and `%#T'",
- TREE_TYPE (arg1), TREE_TYPE (arg2));
- }
- }
-
- arg1 = convert_from_reference
- (convert_like (TREE_VEC_ELT (cand->convs, 0), arg1));
- if (arg2)
- arg2 = convert_like (TREE_VEC_ELT (cand->convs, 1), arg2);
- if (arg3)
- arg3 = convert_like (TREE_VEC_ELT (cand->convs, 2), arg3);
-
-builtin:
- switch (code)
- {
- case MODIFY_EXPR:
- return build_modify_expr (arg1, code2, arg2);
-
- case INDIRECT_REF:
- return build_indirect_ref (arg1, "unary *");
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case GT_EXPR:
- case LT_EXPR:
- case GE_EXPR:
- case LE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case MAX_EXPR:
- case MIN_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case TRUNC_MOD_EXPR:
- case BIT_AND_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- return build_binary_op_nodefault (code, arg1, arg2, code);
-
- case CONVERT_EXPR:
- case NEGATE_EXPR:
- case BIT_NOT_EXPR:
- case TRUTH_NOT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- return build_unary_op (code, arg1, candidates != 0);
-
- case ARRAY_REF:
- return build_array_ref (arg1, arg2);
-
- case COND_EXPR:
- return build_conditional_expr (arg1, arg2, arg3);
-
- case MEMBER_REF:
- return build_m_component_ref
- (build_indirect_ref (arg1, NULL_PTR), arg2);
-
- /* The caller will deal with these. */
- case ADDR_EXPR:
- case COMPONENT_REF:
- case COMPOUND_EXPR:
- return NULL_TREE;
-
- default:
- my_friendly_abort (367);
- }
-}
-
-static void
-enforce_access (basetype_path, function)
- tree basetype_path, function;
-{
- tree access = compute_access (basetype_path, function);
-
- if (access == access_private_node)
- {
- cp_error_at ("`%+#D' is %s", function,
- TREE_PRIVATE (function) ? "private"
- : "from private base class");
- error ("within this context");
- }
- else if (access == access_protected_node)
- {
- cp_error_at ("`%+#D' %s", function,
- TREE_PROTECTED (function) ? "is protected"
- : "has protected accessibility");
- error ("within this context");
- }
-}
-
-/* Perform the conversions in CONVS on the expression EXPR. */
-
-static tree
-convert_like (convs, expr)
- tree convs, expr;
-{
- if (ICS_BAD_FLAG (convs)
- && TREE_CODE (convs) != USER_CONV
- && TREE_CODE (convs) != AMBIG_CONV)
- {
- tree t = convs;
- for (; t; t = TREE_OPERAND (t, 0))
- {
- if (TREE_CODE (t) == USER_CONV)
- {
- expr = convert_like (t, expr);
- break;
- }
- else if (TREE_CODE (t) == AMBIG_CONV)
- return convert_like (t, expr);
- else if (TREE_CODE (t) == IDENTITY_CONV)
- break;
- }
- return convert_for_initialization
- (NULL_TREE, TREE_TYPE (convs), expr, LOOKUP_NORMAL,
- "conversion", NULL_TREE, 0);
- }
-
- switch (TREE_CODE (convs))
- {
- case USER_CONV:
- {
- tree fn = TREE_OPERAND (convs, 1);
- tree args;
- enforce_access (TREE_OPERAND (convs, 3), fn);
-
- if (DECL_CONSTRUCTOR_P (fn))
- {
- tree t = build_int_2 (0, 0);
- TREE_TYPE (t) = build_pointer_type (DECL_CONTEXT (fn));
-
- args = build_tree_list (NULL_TREE, expr);
- if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
- args = tree_cons (NULL_TREE, integer_one_node, args);
- args = tree_cons (NULL_TREE, t, args);
- }
- else
- args = build_this (expr);
- expr = build_over_call
- (TREE_OPERAND (convs, 1), TREE_OPERAND (convs, 2),
- args, LOOKUP_NORMAL);
-
- /* If this is a constructor or a function returning an aggr type,
- we need to build up a TARGET_EXPR. */
- if (DECL_CONSTRUCTOR_P (fn))
- expr = build_cplus_new (TREE_TYPE (convs), expr);
-
- return expr;
- }
- case IDENTITY_CONV:
- if (type_unknown_p (expr))
- expr = instantiate_type (TREE_TYPE (convs), expr, 1);
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
- return expr;
- case AMBIG_CONV:
- /* Call build_user_type_conversion again for the error. */
- return build_user_type_conversion
- (TREE_TYPE (convs), TREE_OPERAND (convs, 0), LOOKUP_NORMAL);
- };
-
- expr = convert_like (TREE_OPERAND (convs, 0), expr);
- if (expr == error_mark_node)
- return error_mark_node;
-
- switch (TREE_CODE (convs))
- {
- case RVALUE_CONV:
- if (! IS_AGGR_TYPE (TREE_TYPE (convs)))
- return expr;
- /* else fall through */
- case BASE_CONV:
- return build_user_type_conversion
- (TREE_TYPE (convs), expr, LOOKUP_NORMAL);
- case REF_BIND:
- return convert_to_reference
- (TREE_TYPE (convs), expr,
- CONV_IMPLICIT, LOOKUP_NORMAL|LOOKUP_NO_CONVERSION,
- error_mark_node);
- case LVALUE_CONV:
- return decay_conversion (expr);
- }
- return cp_convert (TREE_TYPE (convs), expr, CONV_IMPLICIT,
- LOOKUP_NORMAL|LOOKUP_NO_CONVERSION);
-}
-
-static tree
-convert_default_arg (type, arg)
- tree type, arg;
-{
- arg = break_out_target_exprs (arg);
-
- if (TREE_CODE (arg) == CONSTRUCTOR)
- {
- arg = digest_init (type, arg, 0);
- arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
- "default argument", 0, 0);
- }
- else
- {
- /* This could get clobbered by the following call. */
- if (TREE_HAS_CONSTRUCTOR (arg))
- arg = copy_node (arg);
-
- arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
- "default argument", 0, 0);
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
- arg = default_conversion (arg);
-#endif
- }
-
- return arg;
-}
-
-static tree
-build_over_call (fn, convs, args, flags)
- tree fn, convs, args;
- int flags;
-{
- tree converted_args = NULL_TREE;
- tree parm = TYPE_ARG_TYPES (TREE_TYPE (fn));
- tree conv, arg, val;
- int i = 0;
- int is_method = 0;
-
- if (args && TREE_CODE (args) != TREE_LIST)
- args = build_tree_list (NULL_TREE, args);
- arg = args;
-
- /* The implicit parameters to a constructor are not considered by overload
- resolution, and must be of the proper type. */
- if (DECL_CONSTRUCTOR_P (fn))
- {
- converted_args = tree_cons (NULL_TREE, TREE_VALUE (arg), converted_args);
- arg = TREE_CHAIN (arg);
- parm = TREE_CHAIN (parm);
- if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
- {
- converted_args = tree_cons
- (NULL_TREE, TREE_VALUE (arg), converted_args);
- arg = TREE_CHAIN (arg);
- parm = TREE_CHAIN (parm);
- }
- }
- /* Bypass access control for 'this' parameter. */
- else if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
- {
- tree parmtype = TREE_VALUE (parm);
- tree argtype = TREE_TYPE (TREE_VALUE (arg));
- if (ICS_BAD_FLAG (TREE_VEC_ELT (convs, i)))
- {
- int dv = (TYPE_VOLATILE (TREE_TYPE (parmtype))
- < TYPE_VOLATILE (TREE_TYPE (argtype)));
- int dc = (TYPE_READONLY (TREE_TYPE (parmtype))
- < TYPE_READONLY (TREE_TYPE (argtype)));
- char *p = (dv && dc ? "const and volatile" :
- dc ? "const" : dv ? "volatile" : "");
-
- cp_pedwarn ("passing `%T' as `this' argument of `%#D' discards %s",
- TREE_TYPE (argtype), fn, p);
- }
- converted_args = tree_cons
- (NULL_TREE, convert_force (TREE_VALUE (parm), TREE_VALUE (arg), CONV_C_CAST),
- converted_args);
- parm = TREE_CHAIN (parm);
- arg = TREE_CHAIN (arg);
- ++i;
- is_method = 1;
- }
-
- for (; conv = TREE_VEC_ELT (convs, i), arg && parm;
- parm = TREE_CHAIN (parm), arg = TREE_CHAIN (arg), ++i)
- {
- tree type = TREE_VALUE (parm);
-
- if (ICS_BAD_FLAG (conv))
- {
- tree t = conv;
- val = TREE_VALUE (arg);
-
- for (; t; t = TREE_OPERAND (t, 0))
- {
- if (TREE_CODE (t) == USER_CONV
- || TREE_CODE (t) == AMBIG_CONV)
- {
- val = convert_like (t, val);
- break;
- }
- else if (TREE_CODE (t) == IDENTITY_CONV)
- break;
- }
- val = convert_for_initialization
- (NULL_TREE, type, val, LOOKUP_NORMAL,
- "argument passing", fn, i - is_method);
- }
- else
- val = convert_like (conv, TREE_VALUE (arg));
-
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
- val = default_conversion (val);
-#endif
- converted_args = tree_cons (NULL_TREE, val, converted_args);
- }
-
- /* Default arguments */
- for (; parm && parm != void_list_node; parm = TREE_CHAIN (parm))
- {
- tree arg = TREE_PURPOSE (parm);
-
- if (PARM_DEFAULT_FROM_TEMPLATE (parm))
- /* This came from a template. Instantiate the default arg here,
- not in tsubst. */
- arg = tsubst_expr (arg, &TREE_VEC_ELT (DECL_TI_ARGS (fn), 0),
- TREE_VEC_LENGTH (DECL_TI_ARGS (fn)), NULL_TREE);
- converted_args = tree_cons
- (NULL_TREE, convert_default_arg (TREE_VALUE (parm), arg),
- converted_args);
- }
-
- /* Ellipsis */
- for (; arg; arg = TREE_CHAIN (arg))
- {
- val = TREE_VALUE (arg);
-
- if (TREE_CODE (TREE_TYPE (val)) == REAL_TYPE
- && (TYPE_PRECISION (TREE_TYPE (val))
- < TYPE_PRECISION (double_type_node)))
- /* Convert `float' to `double'. */
- val = convert (double_type_node, val);
- else if (TYPE_LANG_SPECIFIC (TREE_TYPE (val))
- && ! TYPE_HAS_TRIVIAL_INIT_REF (TREE_TYPE (val)))
- cp_warning ("cannot pass objects of type `%T' through `...'",
- TREE_TYPE (val));
- else
- /* Convert `short' and `char' to full-size `int'. */
- val = default_conversion (val);
-
- converted_args = tree_cons (NULL_TREE, val, converted_args);
- }
-
- converted_args = nreverse (converted_args);
-
- /* Avoid actually calling copy constructors and copy assignment operators,
- if possible. */
- if (DECL_CONSTRUCTOR_P (fn)
- && TREE_VEC_LENGTH (convs) == 1
- && copy_args_p (fn))
- {
- tree targ = NULL_TREE;
- arg = TREE_VALUE (TREE_CHAIN (converted_args));
-
- /* Pull out the real argument, disregarding const-correctness. */
- if (TREE_CODE (arg) == ADDR_EXPR)
- {
- targ = TREE_OPERAND (arg, 0);
- if (! comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (arg))),
- TYPE_MAIN_VARIANT (TREE_TYPE (targ)), 1))
- targ = NULL_TREE;
- }
-
- if (targ)
- arg = targ;
- else
- arg = build_indirect_ref (arg, 0);
-
- /* [class.copy]: the copy constructor is implicitly defined even if
- the implementation elided its use. */
- if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn)))
- mark_used (fn);
-
- /* If we're creating a temp and we already have one, don't create a
- new one. If we're not creating a temp but we get one, use
- INIT_EXPR to collapse the temp into our target. Otherwise, if the
- ctor is trivial, do a bitwise copy with a simple TARGET_EXPR for a
- temp or an INIT_EXPR otherwise. */
- if (integer_zerop (TREE_VALUE (args)))
- {
- if (! real_lvalue_p (arg))
- return arg;
- else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
- {
- val = build (VAR_DECL, DECL_CONTEXT (fn));
- layout_decl (val, 0);
- val = build (TARGET_EXPR, DECL_CONTEXT (fn), val, arg, 0, 0);
- TREE_SIDE_EFFECTS (val) = 1;
- return val;
- }
- }
- else if (! real_lvalue_p (arg)
- || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
- {
- tree to = stabilize_reference
- (build_indirect_ref (TREE_VALUE (args), 0));
- val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
- TREE_SIDE_EFFECTS (val) = 1;
- return build_unary_op (ADDR_EXPR, val, 0);
- }
- }
- else if (DECL_NAME (fn) == ansi_opname[MODIFY_EXPR]
- && copy_args_p (fn)
- && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn)))
- {
- tree to = stabilize_reference
- (build_indirect_ref (TREE_VALUE (converted_args), 0));
- arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
- val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
- TREE_SIDE_EFFECTS (val) = 1;
- return val;
- }
-
- mark_used (fn);
-
- if (DECL_CONTEXT (fn) && IS_SIGNATURE (DECL_CONTEXT (fn)))
- return build_signature_method_call (fn, converted_args);
- else if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0)
- {
- tree t, *p = &TREE_VALUE (converted_args);
- tree binfo = get_binfo
- (DECL_CONTEXT (fn), TREE_TYPE (TREE_TYPE (*p)), 0);
- *p = convert_pointer_to_real (binfo, *p);
- if (TREE_SIDE_EFFECTS (*p))
- *p = save_expr (*p);
- t = build_pointer_type (TREE_TYPE (fn));
- fn = build_vfn_ref (p, build_indirect_ref (*p, 0), DECL_VINDEX (fn));
- TREE_TYPE (fn) = t;
- }
- else if (DECL_INLINE (fn))
- fn = inline_conversion (fn);
- else
- fn = build_addr_func (fn);
-
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), converted_args);
- if (TREE_TYPE (fn) == void_type_node)
- return fn;
- if (IS_AGGR_TYPE (TREE_TYPE (fn)))
- fn = build_cplus_new (TREE_TYPE (fn), fn);
- return convert_from_reference (require_complete_type (fn));
-}
-
-static tree
-build_new_method_call (instance, name, args, basetype_path, flags)
- tree instance, name, args, basetype_path;
- int flags;
-{
- struct z_candidate *candidates = 0, *cand;
- tree basetype, mem_args, fns, instance_ptr;
- tree pretty_name;
- tree user_args = args;
-
- /* If there is an extra argument for controlling virtual bases,
- remove it for error reporting. */
- if (flags & LOOKUP_HAS_IN_CHARGE)
- user_args = TREE_CHAIN (args);
-
- for (fns = args; fns; fns = TREE_CHAIN (fns))
- if (TREE_VALUE (fns) == error_mark_node)
- return error_mark_node;
-
- if (instance == NULL_TREE)
- basetype = BINFO_TYPE (basetype_path);
- else
- {
- if (TREE_CODE (instance) == OFFSET_REF)
- instance = resolve_offset_ref (instance);
- if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
- instance = convert_from_reference (instance);
- basetype = TREE_TYPE (instance);
-
- /* XXX this should be handled before we get here. */
- if (! IS_AGGR_TYPE (basetype)
- && ! (TYPE_LANG_SPECIFIC (basetype)
- && (IS_SIGNATURE_POINTER (basetype)
- || IS_SIGNATURE_REFERENCE (basetype))))
- {
- if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node)
- cp_error ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
- name, instance, basetype);
-
- return error_mark_node;
- }
-
- /* If `instance' is a signature pointer/reference and `name' is
- not a constructor, we are calling a signature member function.
- In that case set the `basetype' to the signature type. */
- if ((IS_SIGNATURE_POINTER (basetype)
- || IS_SIGNATURE_REFERENCE (basetype))
- && TYPE_IDENTIFIER (basetype) != name)
- basetype = SIGNATURE_TYPE (basetype);
- }
-
- if (basetype_path == NULL_TREE)
- basetype_path = TYPE_BINFO (basetype);
-
- if (instance)
- {
- instance_ptr = build_this (instance);
-
- /* XXX this should be handled before we get here. */
- fns = build_field_call (basetype_path, instance_ptr, name, args);
- if (fns)
- return fns;
- }
- else
- {
- instance_ptr = build_int_2 (0, 0);
- TREE_TYPE (instance_ptr) = build_pointer_type (basetype);
- }
-
- pretty_name =
- (name == ctor_identifier ? constructor_name_full (basetype) : name);
-
- fns = lookup_fnfields (basetype_path, name, 1);
-
- if (fns == error_mark_node)
- return error_mark_node;
- if (fns)
- {
- tree t = TREE_VALUE (fns);
- if (name == ctor_identifier && TYPE_USES_VIRTUAL_BASECLASSES (basetype)
- && ! (flags & LOOKUP_HAS_IN_CHARGE))
- {
- flags |= LOOKUP_HAS_IN_CHARGE;
- args = tree_cons (NULL_TREE, integer_one_node, args);
- }
- mem_args = tree_cons (NULL_TREE, instance_ptr, args);
- for (; t; t = DECL_CHAIN (t))
- {
- /* We can end up here for copy-init of same or base class. */
- if (name == ctor_identifier
- && (flags & LOOKUP_ONLYCONVERTING)
- && DECL_NONCONVERTING_P (t))
- continue;
- if (TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE)
- candidates = add_function_candidate
- (candidates, t, mem_args, flags);
- else
- candidates = add_function_candidate (candidates, t, args, flags);
- candidates->basetype_path = TREE_PURPOSE (fns);
- }
- }
-
- if (! any_viable (candidates))
- {
- /* XXX will LOOKUP_SPECULATIVELY be needed when this is done? */
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
- cp_error ("no matching function for call to `%T::%D (%A)%V'", basetype,
- pretty_name, user_args, TREE_TYPE (TREE_TYPE (instance_ptr)));
- print_z_candidates (candidates);
- return error_mark_node;
- }
- candidates = splice_viable (candidates);
- cand = tourney (candidates, NULL_TREE);
-
- if (cand == 0)
- {
- cp_error ("call of overloaded `%D(%A)' is ambiguous", pretty_name,
- user_args);
- print_z_candidates (candidates);
- return error_mark_node;
- }
-
- enforce_access (cand->basetype_path, cand->fn);
- if (DECL_ABSTRACT_VIRTUAL_P (cand->fn)
- && instance == current_class_ref
- && DECL_CONSTRUCTOR_P (current_function_decl)
- && ! (flags & LOOKUP_NONVIRTUAL)
- && value_member (cand->fn, get_abstract_virtuals (basetype)))
- cp_error ("abstract virtual `%#D' called from constructor", cand->fn);
- if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
- && TREE_CODE (instance_ptr) == NOP_EXPR
- && TREE_OPERAND (instance_ptr, 0) == error_mark_node)
- cp_error ("cannot call member function `%D' without object", cand->fn);
-
- if (DECL_VINDEX (cand->fn) && ! (flags & LOOKUP_NONVIRTUAL)
- && ((instance == current_class_ref && (dtor_label || ctor_label))
- || resolves_to_fixed_type_p (instance, 0)))
- flags |= LOOKUP_NONVIRTUAL;
-
- return build_over_call
- (cand->fn, cand->convs,
- TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE ? mem_args : args,
- flags);
-}
-
-/* Compare two implicit conversion sequences that differ only in their
- qualification conversion. Subroutine of compare_ics. */
-
-static int
-compare_qual (ics1, ics2)
- tree ics1, ics2;
-{
- tree to1 = TREE_TYPE (ics1);
- tree to2 = TREE_TYPE (ics2);
-
- to1 = TREE_TYPE (to1);
- to2 = TREE_TYPE (to2);
-
- if (TREE_CODE (to1) == OFFSET_TYPE)
- {
- to1 = TREE_TYPE (to1);
- to2 = TREE_TYPE (to2);
- }
-
- if (TYPE_READONLY (to1) >= TYPE_READONLY (to2)
- && TYPE_VOLATILE (to1) > TYPE_VOLATILE (to2))
- return -1;
- else if (TYPE_READONLY (to1) > TYPE_READONLY (to2)
- && TYPE_VOLATILE (to1) == TYPE_VOLATILE (to2))
- return -1;
- else if (TYPE_READONLY (to1) <= TYPE_READONLY (to2)
- && TYPE_VOLATILE (to1) < TYPE_VOLATILE (to2))
- return 1;
- else if (TYPE_READONLY (to1) < TYPE_READONLY (to2)
- && TYPE_VOLATILE (to1) == TYPE_VOLATILE (to2))
- return 1;
- return 0;
-}
-
-/* Compare two implicit conversion sequences according to the rules set out in
- [over.ics.rank]. Return values:
-
- 1: ics1 is better than ics2
- -1: ics2 is better than ics1
- 0: ics1 and ics2 are indistinguishable */
-
-static int
-compare_ics (ics1, ics2)
- tree ics1, ics2;
-{
- tree main1, main2;
-
- if (TREE_CODE (ics1) == QUAL_CONV)
- main1 = TREE_OPERAND (ics1, 0);
- else
- main1 = ics1;
-
- if (TREE_CODE (ics2) == QUAL_CONV)
- main2 = TREE_OPERAND (ics2, 0);
- else
- main2 = ics2;
-
- /* Conversions for `this' are PTR_CONVs, but we compare them as though
- they were REF_BINDs. */
- if (ICS_THIS_FLAG (ics1))
- {
- ics1 = build_conv (REF_BIND, TREE_TYPE (ics1), main1);
- TREE_OPERAND (ics1, 0) = TREE_OPERAND (main1, 0);
- main1 = ics1;
- }
- if (ICS_THIS_FLAG (ics2))
- {
- ics2 = build_conv (REF_BIND, TREE_TYPE (ics2), main2);
- TREE_OPERAND (ics2, 0) = TREE_OPERAND (main2, 0);
- main2 = ics2;
- }
-
- if (ICS_RANK (ics1) > ICS_RANK (ics2))
- return -1;
- else if (ICS_RANK (ics1) < ICS_RANK (ics2))
- return 1;
-
- if (ICS_RANK (ics1) == BAD_RANK)
- {
- if (ICS_USER_FLAG (ics1) > ICS_USER_FLAG (ics2)
- || ICS_STD_RANK (ics1) > ICS_STD_RANK (ics2))
- return -1;
- else if (ICS_USER_FLAG (ics1) < ICS_USER_FLAG (ics2)
- || ICS_STD_RANK (ics1) < ICS_STD_RANK (ics2))
- return 1;
-
- /* else fall through */
- }
-
- /* User-defined conversion sequence U1 is a better conversion sequence
- than another user-defined conversion sequence U2 if they contain the
- same user-defined conversion operator or constructor and if the sec-
- ond standard conversion sequence of U1 is better than the second
- standard conversion sequence of U2. */
-
- if (ICS_USER_FLAG (ics1))
- {
- tree t1, t2;
-
- for (t1 = ics1; TREE_CODE (t1) != USER_CONV; t1 = TREE_OPERAND (t1, 0))
- if (TREE_CODE (t1) == AMBIG_CONV)
- return 0;
- for (t2 = ics2; TREE_CODE (t2) != USER_CONV; t2 = TREE_OPERAND (t2, 0))
- if (TREE_CODE (t2) == AMBIG_CONV)
- return 0;
-
- if (USER_CONV_FN (t1) != USER_CONV_FN (t2))
- return 0;
- else if (ICS_STD_RANK (ics1) > ICS_STD_RANK (ics2))
- return -1;
- else if (ICS_STD_RANK (ics1) < ICS_STD_RANK (ics2))
- return 1;
-
- /* else fall through */
- }
-
-#if 0 /* Handled by ranking */
- /* A conversion that is not a conversion of a pointer, or pointer to
- member, to bool is better than another conversion that is such a
- conversion. */
-#endif
-
- if (TREE_CODE (main1) != TREE_CODE (main2))
- return 0;
-
- if (TREE_CODE (main1) == PTR_CONV || TREE_CODE (main1) == PMEM_CONV
- || TREE_CODE (main1) == REF_BIND || TREE_CODE (main1) == BASE_CONV)
- {
- tree to1 = TREE_TYPE (main1);
- tree from1 = TREE_TYPE (TREE_OPERAND (main1, 0));
- tree to2 = TREE_TYPE (main2);
- tree from2 = TREE_TYPE (TREE_OPERAND (main2, 0));
- int distf, distt;
-
- /* Standard conversion sequence S1 is a better conversion sequence than
- standard conversion sequence S2 if...
-
- S1 and S2 differ only in their qualification conversion and they
- yield types identical except for cv-qualifiers and S2 adds all the
- qualifiers that S1 adds (and in the same places) and S2 adds yet
- more cv-qualifiers than S1, or the similar case with reference
- binding15). */
- if (TREE_CODE (main1) == REF_BIND)
- {
- if (TYPE_MAIN_VARIANT (TREE_TYPE (to1))
- == TYPE_MAIN_VARIANT (TREE_TYPE (to2)))
- return compare_qual (ics1, ics2);
- }
- else if (TREE_CODE (main1) != BASE_CONV && from1 == from2 && to1 == to2)
- return compare_qual (ics1, ics2);
-
- if (TYPE_PTRMEMFUNC_P (to1))
- {
- to1 = TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (to1));
- from1 = TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (from1));
- }
- else if (TREE_CODE (main1) != BASE_CONV)
- {
- to1 = TREE_TYPE (to1);
- if (TREE_CODE (main1) != REF_BIND)
- from1 = TREE_TYPE (from1);
-
- if (TREE_CODE (to1) == OFFSET_TYPE)
- {
- to1 = TYPE_OFFSET_BASETYPE (to1);
- from1 = TYPE_OFFSET_BASETYPE (from1);
- }
- }
-
- if (TYPE_PTRMEMFUNC_P (to2))
- {
- to2 = TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (to2));
- from2 = TYPE_METHOD_BASETYPE (TYPE_PTRMEMFUNC_FN_TYPE (from2));
- }
- else if (TREE_CODE (main1) != BASE_CONV)
- {
- to2 = TREE_TYPE (to2);
- if (TREE_CODE (main1) != REF_BIND)
- from2 = TREE_TYPE (from2);
-
- if (TREE_CODE (to2) == OFFSET_TYPE)
- {
- to2 = TYPE_OFFSET_BASETYPE (to2);
- from2 = TYPE_OFFSET_BASETYPE (from2);
- }
- }
-
- if (! (IS_AGGR_TYPE (from1) && IS_AGGR_TYPE (from2)))
- return 0;
-
- /* The sense of pmem conversions is reversed from that of the other
- conversions. */
- if (TREE_CODE (main1) == PMEM_CONV)
- {
- tree t = from1; from1 = from2; from2 = t;
- t = to1; to1 = to2; to2 = t;
- }
-
- distf = get_base_distance (from1, from2, 0, 0);
- if (distf == -1)
- {
- distf = -get_base_distance (from2, from1, 0, 0);
- if (distf == 1)
- return 0;
- }
-
- /* If class B is derived directly or indirectly from class A,
- conver- sion of B* to A* is better than conversion of B* to
- void*, and conversion of A* to void* is better than
- conversion of B* to void*. */
-
- if (TREE_CODE (to1) == VOID_TYPE && TREE_CODE (to2) == VOID_TYPE)
- {
- if (distf > 0)
- return 1;
- else if (distf < 0)
- return -1;
- }
- else if (TREE_CODE (to2) == VOID_TYPE && IS_AGGR_TYPE (to1)
- && get_base_distance (to1, from1, 0, 0) != -1)
- return 1;
- else if (TREE_CODE (to1) == VOID_TYPE && IS_AGGR_TYPE (to2)
- && get_base_distance (to2, from2, 0, 0) != -1)
- return -1;
-
- if (! (IS_AGGR_TYPE (to1) && IS_AGGR_TYPE (to2)))
- return 0;
-
- /* If class B is derived directly or indirectly from class A and class
- C is derived directly or indirectly from B */
-
- distt = get_base_distance (to1, to2, 0, 0);
- if (distt == -1)
- {
- distt = -get_base_distance (to2, to1, 0, 0);
- if (distt == 1)
- return 0;
- }
-
- /* --conversion of C* to B* is better than conversion of C* to A*, */
- if (distf == 0)
- {
- if (distt > 0)
- return -1;
- else if (distt < 0)
- return 1;
- }
- /* --conversion of B* to A* is better than conversion of C* to A*, */
- else if (distt == 0)
- {
- if (distf > 0)
- return 1;
- else if (distf < 0)
- return -1;
- }
- }
- else if (TREE_CODE (TREE_TYPE (main1)) == POINTER_TYPE
- || TYPE_PTRMEMFUNC_P (TREE_TYPE (main1)))
- {
- if (TREE_TYPE (main1) == TREE_TYPE (main2))
- return compare_qual (ics1, ics2);
-
-#if 0 /* This is now handled by making identity better than anything else. */
- /* existing practice, not WP-endorsed: const char * -> const char *
- is better than char * -> const char *. (jason 6/29/96) */
- if (TREE_TYPE (ics1) == TREE_TYPE (ics2))
- return -compare_qual (main1, main2);
-#endif
- }
-
- return 0;
-}
-
-/* Compare two candidates for overloading as described in
- [over.match.best]. Return values:
-
- 1: cand1 is better than cand2
- -1: cand2 is better than cand1
- 0: cand1 and cand2 are indistinguishable */
-
-static int
-joust (cand1, cand2)
- struct z_candidate *cand1, *cand2;
-{
- int winner = 0;
- int i, off1 = 0, off2 = 0, len;
-
- /* Candidates that involve bad conversions are always worse than those
- that don't. */
- if (cand1->viable > cand2->viable)
- return 1;
- if (cand1->viable < cand2->viable)
- return -1;
-
- /* a viable function F1
- is defined to be a better function than another viable function F2 if
- for all arguments i, ICSi(F1) is not a worse conversion sequence than
- ICSi(F2), and then */
-
- /* for some argument j, ICSj(F1) is a better conversion sequence than
- ICSj(F2) */
-
- /* For comparing static and non-static member functions, we ignore the
- implicit object parameter of the non-static function. The WP says to
- pretend that the static function has an object parm, but that won't
- work with operator overloading. */
- len = TREE_VEC_LENGTH (cand1->convs);
- if (len != TREE_VEC_LENGTH (cand2->convs))
- {
- if (DECL_STATIC_FUNCTION_P (cand1->fn)
- && ! DECL_STATIC_FUNCTION_P (cand2->fn))
- off2 = 1;
- else if (! DECL_STATIC_FUNCTION_P (cand1->fn)
- && DECL_STATIC_FUNCTION_P (cand2->fn))
- {
- off1 = 1;
- --len;
- }
- else
- my_friendly_abort (42);
- }
-
- for (i = 0; i < len; ++i)
- {
- int comp = compare_ics (TREE_VEC_ELT (cand1->convs, i+off1),
- TREE_VEC_ELT (cand2->convs, i+off2));
-
- if (comp != 0)
- {
- if (winner && comp != winner)
- {
- winner = 0;
- goto tweak;
- }
- winner = comp;
- }
- }
-
- if (winner)
- return winner;
-
- /* or, if not that,
- F1 is a non-template function and F2 is a template function */
-
- if (! cand1->template && cand2->template)
- return 1;
- else if (cand1->template && ! cand2->template)
- return -1;
- else if (cand1->template && cand2->template)
- winner = more_specialized
- (TI_TEMPLATE (cand1->template), TI_TEMPLATE (cand2->template));
-
- /* or, if not that,
- the context is an initialization by user-defined conversion (see
- _dcl.init_ and _over.match.user_) and the standard conversion
- sequence from the return type of F1 to the destination type (i.e.,
- the type of the entity being initialized) is a better conversion
- sequence than the standard conversion sequence from the return type
- of F2 to the destination type. */
-
- if (! winner && cand1->second_conv)
- winner = compare_ics (cand1->second_conv, cand2->second_conv);
-
- /* If the built-in candidates are the same, arbitrarily pick one. */
- if (! winner && cand1->fn == cand2->fn
- && TREE_CODE (cand1->fn) == IDENTIFIER_NODE)
- {
- for (i = 0; i < len; ++i)
- if (! comptypes (TREE_TYPE (TREE_VEC_ELT (cand1->convs, i)),
- TREE_TYPE (TREE_VEC_ELT (cand2->convs, i)), 1))
- break;
- if (i == TREE_VEC_LENGTH (cand1->convs))
- return 1;
-#if 0
- /* Kludge around broken overloading rules whereby
- bool ? void *const & : void *const & is ambiguous. */
- /* Huh? Explain the problem better. */
- if (cand1->fn == ansi_opname[COND_EXPR])
- {
- tree c1 = TREE_VEC_ELT (cand1->convs, 1);
- tree c2 = TREE_VEC_ELT (cand2->convs, 1);
- tree t1 = strip_top_quals (non_reference (TREE_TYPE (c1)));
- tree t2 = strip_top_quals (non_reference (TREE_TYPE (c2)));
-
- if (comptypes (t1, t2, 1))
- {
- if (TREE_CODE (c1) == REF_BIND && TREE_CODE (c2) != REF_BIND)
- return 1;
- if (TREE_CODE (c1) != REF_BIND && TREE_CODE (c2) == REF_BIND)
- return -1;
- }
- }
-#endif
- }
-
-tweak:
-
- /* Extension: If the worst conversion for one candidate is worse than the
- worst conversion for the other, take the first. */
- if (! winner && ! pedantic)
- {
- int rank1 = IDENTITY_RANK, rank2 = IDENTITY_RANK;
-
- for (i = 0; i < len; ++i)
- {
- if (ICS_RANK (TREE_VEC_ELT (cand1->convs, i+off1)) > rank1)
- rank1 = ICS_RANK (TREE_VEC_ELT (cand1->convs, i+off1));
- if (ICS_RANK (TREE_VEC_ELT (cand2->convs, i+off2)) > rank2)
- rank2 = ICS_RANK (TREE_VEC_ELT (cand2->convs, i+off2));
- }
-
- if (rank1 < rank2)
- return 1;
- if (rank1 > rank2)
- return -1;
- }
-
- return winner;
-}
-
-/* Given a list of candidates for overloading, find the best one, if any.
- This algorithm has a worst case of O(2n) (winner is last), and a best
- case of O(n/2) (totally ambiguous); much better than a sorting
- algorithm. */
-
-static struct z_candidate *
-tourney (candidates)
- struct z_candidate *candidates;
-{
- struct z_candidate *champ = candidates, *challenger;
- int fate;
-
- /* Walk through the list once, comparing each current champ to the next
- candidate, knocking out a candidate or two with each comparison. */
-
- for (challenger = champ->next; challenger; )
- {
- fate = joust (champ, challenger);
- if (fate == 1)
- challenger = challenger->next;
- else
- {
- if (fate == 0)
- {
- champ = challenger->next;
- if (champ == 0)
- return 0;
- }
- else
- champ = challenger;
-
- challenger = champ->next;
- }
- }
-
- /* Make sure the champ is better than all the candidates it hasn't yet
- been compared to. This may do one more comparison than necessary. Oh
- well. */
-
- for (challenger = candidates; challenger != champ;
- challenger = challenger->next)
- {
- fate = joust (champ, challenger);
- if (fate != 1)
- return 0;
- }
-
- return champ;
-}
-
-int
-can_convert (to, from)
- tree to, from;
-{
- if (flag_ansi_overloading)
- {
- tree t = implicit_conversion (to, from, NULL_TREE, LOOKUP_NORMAL);
- return (t && ! ICS_BAD_FLAG (t));
- }
- else
- {
- struct harshness_code h;
- h = convert_harshness (to, from, NULL_TREE);
- return (h.code < USER_CODE) && (h.distance >= 0);
- }
-}
-
-int
-can_convert_arg (to, from, arg)
- tree to, from, arg;
-{
- if (flag_ansi_overloading)
- {
- tree t = implicit_conversion (to, from, arg, LOOKUP_NORMAL);
- return (t && ! ICS_BAD_FLAG (t));
- }
- else
- {
- struct harshness_code h;
- h = convert_harshness (to, from, arg);
- return (h.code < USER_CODE) && (h.distance >= 0);
- }
-}
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
deleted file mode 100644
index 5ada32baf9e..00000000000
--- a/gcc/cp/class.c
+++ /dev/null
@@ -1,5355 +0,0 @@
-/* Functions related to building classes and their related objects.
- Copyright (C) 1987, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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. */
-
-
-/* High-level class interface. */
-
-#include "config.h"
-#include "tree.h"
-#include <stdio.h>
-#include "cp-tree.h"
-#include "flags.h"
-#include "rtl.h"
-#include "output.h"
-
-#include "obstack.h"
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern struct obstack permanent_obstack;
-
-/* This is how we tell when two virtual member functions are really the
- same. */
-#define SAME_FN(FN1DECL, FN2DECL) (DECL_ASSEMBLER_NAME (FN1DECL) == DECL_ASSEMBLER_NAME (FN2DECL))
-
-extern void set_class_shadows PROTO ((tree));
-
-/* Way of stacking class types. */
-static tree *current_class_base, *current_class_stack;
-static int current_class_stacksize;
-int current_class_depth;
-
-struct class_level
-{
- /* The previous class level. */
- struct class_level *level_chain;
-
- /* The class instance variable, as a PARM_DECL. */
- tree decl;
- /* The class instance variable, as an object. */
- tree object;
- /* The virtual function table pointer
- for the class instance variable. */
- tree vtable_decl;
-
- /* Name of the current class. */
- tree name;
- /* Type of the current class. */
- tree type;
-
- /* Flags for this class level. */
- int this_is_variable;
- int memoized_lookups;
- int save_memoized;
- int unused;
-};
-
-/* The currect_class_ptr is the pointer to the current class.
- current_class_ref is the actual current class. */
-tree current_class_ptr, current_class_ref;
-
-/* The following two can be derived from the previous one */
-tree current_class_name; /* IDENTIFIER_NODE: name of current class */
-tree current_class_type; /* _TYPE: the type of the current class */
-tree previous_class_type; /* _TYPE: the previous type that was a class */
-tree previous_class_values; /* TREE_LIST: copy of the class_shadowed list
- when leaving an outermost class scope. */
-static tree get_vfield_name PROTO((tree));
-
-/* Way of stacking language names. */
-tree *current_lang_base, *current_lang_stack;
-int current_lang_stacksize;
-
-/* Names of languages we recognize. */
-tree lang_name_c, lang_name_cplusplus;
-tree current_lang_name;
-
-/* When layout out an aggregate type, the size of the
- basetypes (virtual and non-virtual) is passed to layout_record
- via this node. */
-static tree base_layout_decl;
-
-/* Constants used for access control. */
-tree access_default_node; /* 0 */
-tree access_public_node; /* 1 */
-tree access_protected_node; /* 2 */
-tree access_private_node; /* 3 */
-tree access_default_virtual_node; /* 4 */
-tree access_public_virtual_node; /* 5 */
-tree access_private_virtual_node; /* 6 */
-
-/* Variables shared between class.c and call.c. */
-
-#ifdef GATHER_STATISTICS
-int n_vtables = 0;
-int n_vtable_entries = 0;
-int n_vtable_searches = 0;
-int n_vtable_elems = 0;
-int n_convert_harshness = 0;
-int n_compute_conversion_costs = 0;
-int n_build_method_call = 0;
-int n_inner_fields_searched = 0;
-#endif
-
-/* Virtual baseclass things. */
-
-static tree
-build_vbase_pointer (exp, type)
- tree exp, type;
-{
- char *name;
-
- name = (char *) alloca (TYPE_NAME_LENGTH (type) + sizeof (VBASE_NAME) + 1);
- sprintf (name, VBASE_NAME_FORMAT, TYPE_NAME_STRING (type));
- return build_component_ref (exp, get_identifier (name), NULL_TREE, 0);
-}
-
-/* Is the type of the EXPR, the complete type of the object?
- If we are going to be wrong, we must be conservative, and return 0. */
-
-static int
-complete_type_p (expr)
- tree expr;
-{
- tree type = TYPE_MAIN_VARIANT (TREE_TYPE (expr));
- while (1)
- {
- switch (TREE_CODE (expr))
- {
- case SAVE_EXPR:
- case INDIRECT_REF:
- case ADDR_EXPR:
- case NOP_EXPR:
- case CONVERT_EXPR:
- expr = TREE_OPERAND (expr, 0);
- continue;
-
- case CALL_EXPR:
- if (! TREE_HAS_CONSTRUCTOR (expr))
- break;
- /* fall through... */
- case VAR_DECL:
- case FIELD_DECL:
- if (TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
- && IS_AGGR_TYPE (TREE_TYPE (TREE_TYPE (expr)))
- && TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type)
- return 1;
- /* fall through... */
- case TARGET_EXPR:
- case PARM_DECL:
- if (IS_AGGR_TYPE (TREE_TYPE (expr))
- && TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type)
- return 1;
- /* fall through... */
- case PLUS_EXPR:
- default:
- break;
- }
- break;
- }
- return 0;
-}
-
-/* Build multi-level access to EXPR using hierarchy path PATH.
- CODE is PLUS_EXPR if we are going with the grain,
- and MINUS_EXPR if we are not (in which case, we cannot traverse
- virtual baseclass links).
-
- TYPE is the type we want this path to have on exit.
-
- ALIAS_THIS is non-zero if EXPR in an expression involving `this'. */
-
-tree
-build_vbase_path (code, type, expr, path, alias_this)
- enum tree_code code;
- tree type, expr, path;
- int alias_this;
-{
- register int changed = 0;
- tree last = NULL_TREE, last_virtual = NULL_TREE;
- int nonnull = 0;
- int fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull);
- tree null_expr = 0, nonnull_expr;
- tree basetype;
- tree offset = integer_zero_node;
-
- if (nonnull == 0 && (alias_this && flag_this_is_variable <= 0))
- nonnull = 1;
-
- /* We need additional logic to convert back to the unconverted type
- (the static type of the complete object), and then convert back
- to the type we want. Until that is done, or until we can
- recognize when that is, we cannot do the short cut logic. (mrs) */
- /* Do this, until we can undo any previous conversions. See net35.C
- for a testcase. */
- fixed_type_p = complete_type_p (expr);
-
- if (!fixed_type_p && TREE_SIDE_EFFECTS (expr))
- expr = save_expr (expr);
- nonnull_expr = expr;
-
- if (BINFO_INHERITANCE_CHAIN (path))
- {
- tree reverse_path = NULL_TREE;
-
- while (path)
- {
- tree r = copy_node (path);
- BINFO_INHERITANCE_CHAIN (r) = reverse_path;
- reverse_path = r;
- path = BINFO_INHERITANCE_CHAIN (path);
- }
- path = reverse_path;
- }
-
- basetype = BINFO_TYPE (path);
-
- while (path)
- {
- if (TREE_VIA_VIRTUAL (path))
- {
- last_virtual = BINFO_TYPE (path);
- if (code == PLUS_EXPR)
- {
- changed = ! fixed_type_p;
-
- if (changed)
- {
- tree ind;
-
- /* We already check for ambiguous things in the caller, just
- find a path. */
- if (last)
- {
- tree binfo = get_binfo (last, TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (nonnull_expr))), 0);
- nonnull_expr = convert_pointer_to_real (binfo, nonnull_expr);
- }
- ind = build_indirect_ref (nonnull_expr, NULL_PTR);
- nonnull_expr = build_vbase_pointer (ind, last_virtual);
- if (nonnull == 0
- && (TREE_CODE (type) == POINTER_TYPE
- || !flag_assume_nonnull_objects)
- && null_expr == NULL_TREE)
- {
- null_expr = build1 (NOP_EXPR, build_pointer_type (last_virtual), integer_zero_node);
- expr = build (COND_EXPR, build_pointer_type (last_virtual),
- build (EQ_EXPR, boolean_type_node, expr,
- integer_zero_node),
- null_expr, nonnull_expr);
- }
- }
- /* else we'll figure out the offset below. */
-
- /* Happens in the case of parse errors. */
- if (nonnull_expr == error_mark_node)
- return error_mark_node;
- }
- else
- {
- cp_error ("cannot cast up from virtual baseclass `%T'",
- last_virtual);
- return error_mark_node;
- }
- }
- last = path;
- path = BINFO_INHERITANCE_CHAIN (path);
- }
- /* LAST is now the last basetype assoc on the path. */
-
- /* A pointer to a virtual base member of a non-null object
- is non-null. Therefore, we only need to test for zeroness once.
- Make EXPR the canonical expression to deal with here. */
- if (null_expr)
- {
- TREE_OPERAND (expr, 2) = nonnull_expr;
- TREE_TYPE (TREE_OPERAND (expr, 1)) = TREE_TYPE (nonnull_expr);
- }
- else
- expr = nonnull_expr;
-
- /* If we go through any virtual base pointers, make sure that
- casts to BASETYPE from the last virtual base class use
- the right value for BASETYPE. */
- if (changed)
- {
- tree intype = TREE_TYPE (TREE_TYPE (expr));
- if (TYPE_MAIN_VARIANT (intype) != BINFO_TYPE (last))
- {
- tree binfo = get_binfo (last, TYPE_MAIN_VARIANT (intype), 0);
- offset = BINFO_OFFSET (binfo);
- }
- }
- else
- {
- if (last_virtual)
- {
- offset = BINFO_OFFSET (binfo_member (last_virtual,
- CLASSTYPE_VBASECLASSES (basetype)));
- offset = size_binop (PLUS_EXPR, offset, BINFO_OFFSET (last));
- }
- else
- offset = BINFO_OFFSET (last);
- }
-
- if (TREE_INT_CST_LOW (offset))
- {
- /* Bash types to make the backend happy. */
- offset = convert (type, offset);
- expr = build1 (NOP_EXPR, type, expr);
-
- /* For multiple inheritance: if `this' can be set by any
- function, then it could be 0 on entry to any function.
- Preserve such zeroness here. Otherwise, only in the
- case of constructors need we worry, and in those cases,
- it will be zero, or initialized to some valid value to
- which we may add. */
- if (nonnull == 0)
- {
- if (null_expr)
- TREE_TYPE (null_expr) = type;
- else
- null_expr = build1 (NOP_EXPR, type, integer_zero_node);
- if (TREE_SIDE_EFFECTS (expr))
- expr = save_expr (expr);
-
- return build (COND_EXPR, type,
- build (EQ_EXPR, boolean_type_node, expr, integer_zero_node),
- null_expr,
- build (code, type, expr, offset));
- }
- else return build (code, type, expr, offset);
- }
-
- /* Cannot change the TREE_TYPE of a NOP_EXPR here, since it may
- be used multiple times in initialization of multiple inheritance. */
- if (null_expr)
- {
- TREE_TYPE (expr) = type;
- return expr;
- }
- else
- return build1 (NOP_EXPR, type, expr);
-}
-
-/* Virtual function things. */
-
-/* Virtual functions to be dealt with after laying out our base
- classes. We do all overrides after we layout virtual base classes. */
-
-static tree pending_hard_virtuals;
-
-/* Build an entry in the virtual function table.
- DELTA is the offset for the `this' pointer.
- PFN is an ADDR_EXPR containing a pointer to the virtual function.
- Note that the index (DELTA2) in the virtual function table
- is always 0. */
-
-static tree
-build_vtable_entry (delta, pfn)
- tree delta, pfn;
-{
- if (flag_vtable_thunks)
- {
- HOST_WIDE_INT idelta = TREE_INT_CST_LOW (delta);
- if (idelta && ! DECL_ABSTRACT_VIRTUAL_P (TREE_OPERAND (pfn, 0)))
- {
- pfn = build1 (ADDR_EXPR, vtable_entry_type,
- make_thunk (pfn, idelta));
- TREE_READONLY (pfn) = 1;
- TREE_CONSTANT (pfn) = 1;
- }
-#ifdef GATHER_STATISTICS
- n_vtable_entries += 1;
-#endif
- return pfn;
- }
- else
- {
- extern int flag_huge_objects;
- tree elems = tree_cons (NULL_TREE, delta,
- tree_cons (NULL_TREE, integer_zero_node,
- build_tree_list (NULL_TREE, pfn)));
- tree entry = build (CONSTRUCTOR, vtable_entry_type, NULL_TREE, elems);
-
- /* DELTA is constructed by `size_int', which means it may be an
- unsigned quantity on some platforms. Therefore, we cannot use
- `int_fits_type_p', because when DELTA is really negative,
- `force_fit_type' will make it look like a very large number. */
-
- if ((TREE_INT_CST_LOW (TYPE_MAX_VALUE (delta_type_node))
- < TREE_INT_CST_LOW (delta))
- || (TREE_INT_CST_LOW (delta)
- < TREE_INT_CST_LOW (TYPE_MIN_VALUE (delta_type_node))))
- if (flag_huge_objects)
- sorry ("object size exceeds built-in limit for virtual function table implementation");
- else
- sorry ("object size exceeds normal limit for virtual function table implementation, recompile all source and use -fhuge-objects");
-
- TREE_CONSTANT (entry) = 1;
- TREE_STATIC (entry) = 1;
- TREE_READONLY (entry) = 1;
-
-#ifdef GATHER_STATISTICS
- n_vtable_entries += 1;
-#endif
-
- return entry;
- }
-}
-
-/* Given an object INSTANCE, return an expression which yields the
- virtual function vtable element corresponding to INDEX. There are
- many special cases for INSTANCE which we take care of here, mainly
- to avoid creating extra tree nodes when we don't have to. */
-
-tree
-build_vtbl_ref (instance, idx)
- tree instance, idx;
-{
- tree vtbl, aref;
- tree basetype = TREE_TYPE (instance);
-
- if (TREE_CODE (basetype) == REFERENCE_TYPE)
- basetype = TREE_TYPE (basetype);
-
- if (instance == current_class_ref)
- vtbl = build_indirect_ref (build_vfield_ref (instance, basetype),
- NULL_PTR);
- else
- {
- if (optimize)
- {
- /* Try to figure out what a reference refers to, and
- access its virtual function table directly. */
- tree ref = NULL_TREE;
-
- if (TREE_CODE (instance) == INDIRECT_REF
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (instance, 0))) == REFERENCE_TYPE)
- ref = TREE_OPERAND (instance, 0);
- else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
- ref = instance;
-
- if (ref && TREE_CODE (ref) == VAR_DECL
- && DECL_INITIAL (ref))
- {
- tree init = DECL_INITIAL (ref);
-
- while (TREE_CODE (init) == NOP_EXPR
- || TREE_CODE (init) == NON_LVALUE_EXPR)
- init = TREE_OPERAND (init, 0);
- if (TREE_CODE (init) == ADDR_EXPR)
- {
- init = TREE_OPERAND (init, 0);
- if (IS_AGGR_TYPE (TREE_TYPE (init))
- && (TREE_CODE (init) == PARM_DECL
- || TREE_CODE (init) == VAR_DECL))
- instance = init;
- }
- }
- }
-
- if (IS_AGGR_TYPE (TREE_TYPE (instance))
- && (TREE_CODE (instance) == RESULT_DECL
- || TREE_CODE (instance) == PARM_DECL
- || TREE_CODE (instance) == VAR_DECL))
- vtbl = TYPE_BINFO_VTABLE (basetype);
- else
- vtbl = build_indirect_ref (build_vfield_ref (instance, basetype),
- NULL_PTR);
- }
- assemble_external (vtbl);
- aref = build_array_ref (vtbl, idx);
-
- return aref;
-}
-
-/* Given an object INSTANCE, return an expression which yields the
- virtual function corresponding to INDEX. There are many special
- cases for INSTANCE which we take care of here, mainly to avoid
- creating extra tree nodes when we don't have to. */
-
-tree
-build_vfn_ref (ptr_to_instptr, instance, idx)
- tree *ptr_to_instptr, instance;
- tree idx;
-{
- tree aref = build_vtbl_ref (instance, idx);
-
- /* When using thunks, there is no extra delta, and we get the pfn
- directly. */
- if (flag_vtable_thunks)
- return aref;
-
- if (ptr_to_instptr)
- {
- /* Save the intermediate result in a SAVE_EXPR so we don't have to
- compute each component of the virtual function pointer twice. */
- if (TREE_CODE (aref) == INDIRECT_REF)
- TREE_OPERAND (aref, 0) = save_expr (TREE_OPERAND (aref, 0));
-
- *ptr_to_instptr
- = build (PLUS_EXPR, TREE_TYPE (*ptr_to_instptr),
- *ptr_to_instptr,
- convert (ptrdiff_type_node,
- build_component_ref (aref, delta_identifier, NULL_TREE, 0)));
- }
-
- return build_component_ref (aref, pfn_identifier, NULL_TREE, 0);
-}
-
-/* Return the name of the virtual function table (as an IDENTIFIER_NODE)
- for the given TYPE. */
-
-static tree
-get_vtable_name (type)
- tree type;
-{
- tree type_id = build_typename_overload (type);
- char *buf = (char *)alloca (strlen (VTABLE_NAME_FORMAT)
- + IDENTIFIER_LENGTH (type_id) + 2);
- char *ptr = IDENTIFIER_POINTER (type_id);
- int i;
- for (i = 0; ptr[i] == OPERATOR_TYPENAME_FORMAT[i]; i++) ;
-#if 0
- /* We don't take off the numbers; prepare_fresh_vtable uses the
- DECL_ASSEMBLER_NAME for the type, which includes the number
- in `3foo'. If we were to pull them off here, we'd end up with
- something like `_vt.foo.3bar', instead of a uniform definition. */
- while (ptr[i] >= '0' && ptr[i] <= '9')
- i += 1;
-#endif
- sprintf (buf, VTABLE_NAME_FORMAT, ptr+i);
- return get_identifier (buf);
-}
-
-/* Return the offset to the main vtable for a given base BINFO. */
-
-tree
-get_vfield_offset (binfo)
- tree binfo;
-{
- return size_binop (PLUS_EXPR,
- size_binop (FLOOR_DIV_EXPR,
- DECL_FIELD_BITPOS (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))),
- size_int (BITS_PER_UNIT)),
- BINFO_OFFSET (binfo));
-}
-
-/* Get the offset to the start of the original binfo that we derived
- this binfo from. If we find TYPE first, return the offset only
- that far. The shortened search is useful because the this pointer
- on method calling is expected to point to a DECL_CONTEXT (fndecl)
- object, and not a baseclass of it. */
-
-static tree
-get_derived_offset (binfo, type)
- tree binfo, type;
-{
- tree offset1 = get_vfield_offset (TYPE_BINFO (BINFO_TYPE (binfo)));
- tree offset2;
- int i;
- while (BINFO_BASETYPES (binfo)
- && (i=CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo))) != -1)
- {
- tree binfos = BINFO_BASETYPES (binfo);
- if (BINFO_TYPE (binfo) == type)
- break;
- binfo = TREE_VEC_ELT (binfos, i);
- }
- offset2 = get_vfield_offset (TYPE_BINFO (BINFO_TYPE (binfo)));
- return size_binop (MINUS_EXPR, offset1, offset2);
-}
-
-/* Update the rtti info for this class. */
-
-static void
-set_rtti_entry (virtuals, offset, type)
- tree virtuals, offset, type;
-{
- tree vfn;
-
- if (flag_rtti)
- vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, get_tinfo_fn (type));
- else
- vfn = build1 (NOP_EXPR, vfunc_ptr_type_node, size_zero_node);
- TREE_CONSTANT (vfn) = 1;
-
- if (! flag_vtable_thunks)
- TREE_VALUE (virtuals) = build_vtable_entry (offset, vfn);
- else
- {
- tree voff = build1 (NOP_EXPR, vfunc_ptr_type_node, offset);
- TREE_CONSTANT (voff) = 1;
-
- TREE_VALUE (virtuals) = build_vtable_entry (size_zero_node, voff);
-
- /* The second slot is for the tdesc pointer when thunks are used. */
- TREE_VALUE (TREE_CHAIN (virtuals))
- = build_vtable_entry (size_zero_node, vfn);
- }
-}
-
-/* Build a virtual function for type TYPE.
- If BINFO is non-NULL, build the vtable starting with the initial
- approximation that it is the same as the one which is the head of
- the association list. */
-
-static tree
-build_vtable (binfo, type)
- tree binfo, type;
-{
- tree name = get_vtable_name (type);
- tree virtuals, decl;
-
- if (binfo)
- {
- tree offset;
-
- virtuals = copy_list (BINFO_VIRTUALS (binfo));
- decl = build_decl (VAR_DECL, name, TREE_TYPE (BINFO_VTABLE (binfo)));
-
- /* Now do rtti stuff. */
- offset = get_derived_offset (TYPE_BINFO (type), NULL_TREE);
- offset = size_binop (MINUS_EXPR, size_zero_node, offset);
- set_rtti_entry (virtuals, offset, type);
- }
- else
- {
- virtuals = NULL_TREE;
- decl = build_decl (VAR_DECL, name, void_type_node);
- }
-
-#ifdef GATHER_STATISTICS
- n_vtables += 1;
- n_vtable_elems += list_length (virtuals);
-#endif
-
- /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
- import_export_vtable (decl, type, 0);
-
- IDENTIFIER_GLOBAL_VALUE (name) = decl = pushdecl_top_level (decl);
- /* Initialize the association list for this type, based
- on our first approximation. */
- TYPE_BINFO_VTABLE (type) = decl;
- TYPE_BINFO_VIRTUALS (type) = virtuals;
-
- TREE_STATIC (decl) = 1;
-#ifndef WRITABLE_VTABLES
- /* Make them READONLY by default. (mrs) */
- TREE_READONLY (decl) = 1;
-#endif
- /* At one time the vtable info was grabbed 2 words at a time. This
- fails on sparc unless you have 8-byte alignment. (tiemann) */
- DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
- DECL_ALIGN (decl));
-
- /* Why is this conditional? (mrs) */
- if (binfo && write_virtuals >= 0)
- DECL_VIRTUAL_P (decl) = 1;
- DECL_CONTEXT (decl) = type;
-
- binfo = TYPE_BINFO (type);
- SET_BINFO_NEW_VTABLE_MARKED (binfo);
- return decl;
-}
-
-/* Given a base type PARENT, and a derived type TYPE, build
- a name which distinguishes exactly the PARENT member of TYPE's type.
-
- FORMAT is a string which controls how sprintf formats the name
- we have generated.
-
- For example, given
-
- class A; class B; class C : A, B;
-
- it is possible to distinguish "A" from "C's A". And given
-
- class L;
- class A : L; class B : L; class C : A, B;
-
- it is possible to distinguish "L" from "A's L", and also from
- "C's L from A".
-
- Make sure to use the DECL_ASSEMBLER_NAME of the TYPE_NAME of the
- type, as template have DECL_NAMEs like: X<int>, whereas the
- DECL_ASSEMBLER_NAME is set to be something the assembler can handle. */
-
-static tree
-build_type_pathname (format, parent, type)
- char *format;
- tree parent, type;
-{
- extern struct obstack temporary_obstack;
- char *first, *base, *name;
- int i;
- tree id;
-
- parent = TYPE_MAIN_VARIANT (parent);
-
- /* Remember where to cut the obstack to. */
- first = obstack_base (&temporary_obstack);
-
- /* Put on TYPE+PARENT. */
- obstack_grow (&temporary_obstack,
- TYPE_ASSEMBLER_NAME_STRING (type),
- TYPE_ASSEMBLER_NAME_LENGTH (type));
-#ifdef JOINER
- obstack_1grow (&temporary_obstack, JOINER);
-#else
- obstack_1grow (&temporary_obstack, '_');
-#endif
- obstack_grow0 (&temporary_obstack,
- TYPE_ASSEMBLER_NAME_STRING (parent),
- TYPE_ASSEMBLER_NAME_LENGTH (parent));
- i = obstack_object_size (&temporary_obstack);
- base = obstack_base (&temporary_obstack);
- obstack_finish (&temporary_obstack);
-
- /* Put on FORMAT+TYPE+PARENT. */
- obstack_blank (&temporary_obstack, strlen (format) + i + 1);
- name = obstack_base (&temporary_obstack);
- sprintf (name, format, base);
- id = get_identifier (name);
- obstack_free (&temporary_obstack, first);
-
- return id;
-}
-
-extern tree signed_size_zero_node;
-
-/* Give TYPE a new virtual function table which is initialized
- with a skeleton-copy of its original initialization. The only
- entry that changes is the `delta' entry, so we can really
- share a lot of structure.
-
- FOR_TYPE is the derived type which caused this table to
- be needed.
-
- BINFO is the type association which provided TYPE for FOR_TYPE. */
-
-static void
-prepare_fresh_vtable (binfo, for_type)
- tree binfo, for_type;
-{
- tree basetype = BINFO_TYPE (binfo);
- tree orig_decl = BINFO_VTABLE (binfo);
- /* This name is too simplistic. We can have multiple basetypes for
- for_type, and we really want different names. (mrs) */
- tree name = build_type_pathname (VTABLE_NAME_FORMAT, basetype, for_type);
- tree new_decl = build_decl (VAR_DECL, name, TREE_TYPE (orig_decl));
- tree offset;
-
- /* Remember which class this vtable is really for. */
- DECL_CONTEXT (new_decl) = for_type;
-
- TREE_STATIC (new_decl) = 1;
- BINFO_VTABLE (binfo) = pushdecl_top_level (new_decl);
- DECL_VIRTUAL_P (new_decl) = 1;
-#ifndef WRITABLE_VTABLES
- /* Make them READONLY by default. (mrs) */
- TREE_READONLY (new_decl) = 1;
-#endif
- DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl);
-
- /* Make fresh virtual list, so we can smash it later. */
- BINFO_VIRTUALS (binfo) = copy_list (BINFO_VIRTUALS (binfo));
-
- if (TREE_VIA_VIRTUAL (binfo))
- {
- tree binfo1 = binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (for_type));
-
- /* XXX - This should never happen, if it does, the caller should
- ensure that the binfo is from for_type's binfos, not from any
- base type's. We can remove all this code after a while. */
- if (binfo1 != binfo)
- warning ("internal inconsistency: binfo offset error for rtti");
-
- offset = BINFO_OFFSET (binfo1);
- }
- else
- offset = BINFO_OFFSET (binfo);
-
- set_rtti_entry (BINFO_VIRTUALS (binfo),
- size_binop (MINUS_EXPR, signed_size_zero_node, offset),
- for_type);
-
-#ifdef GATHER_STATISTICS
- n_vtables += 1;
- n_vtable_elems += list_length (BINFO_VIRTUALS (binfo));
-#endif
-
- /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
- import_export_vtable (new_decl, for_type, 0);
-
- if (TREE_VIA_VIRTUAL (binfo))
- my_friendly_assert (binfo == binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (current_class_type)),
- 170);
- SET_BINFO_NEW_VTABLE_MARKED (binfo);
-}
-
-#if 0
-/* Access the virtual function table entry that logically
- contains BASE_FNDECL. VIRTUALS is the virtual function table's
- initializer. We can run off the end, when dealing with virtual
- destructors in MI situations, return NULL_TREE in that case. */
-
-static tree
-get_vtable_entry (virtuals, base_fndecl)
- tree virtuals, base_fndecl;
-{
- unsigned HOST_WIDE_INT n = (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD
- ? (TREE_INT_CST_LOW (DECL_VINDEX (base_fndecl))
- & (((unsigned HOST_WIDE_INT)1<<(BITS_PER_WORD-1))-1))
- : TREE_INT_CST_LOW (DECL_VINDEX (base_fndecl)));
-
-#ifdef GATHER_STATISTICS
- n_vtable_searches += n;
-#endif
-
- while (n > 0 && virtuals)
- {
- --n;
- virtuals = TREE_CHAIN (virtuals);
- }
- return virtuals;
-}
-#endif
-
-/* Put new entry ENTRY into virtual function table initializer
- VIRTUALS.
-
- Also update DECL_VINDEX (FNDECL). */
-
-static void
-modify_vtable_entry (old_entry_in_list, new_entry, fndecl)
- tree old_entry_in_list, new_entry, fndecl;
-{
- tree base_fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (old_entry_in_list)), 0);
-
-#ifdef NOTQUITE
- cp_warning ("replaced %D with %D", DECL_ASSEMBLER_NAME (base_fndecl),
- DECL_ASSEMBLER_NAME (fndecl));
-#endif
- TREE_VALUE (old_entry_in_list) = new_entry;
-
- /* Now assign virtual dispatch information, if unset. */
- /* We can dispatch this, through any overridden base function. */
- if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
- {
- DECL_VINDEX (fndecl) = DECL_VINDEX (base_fndecl);
- DECL_CONTEXT (fndecl) = DECL_CONTEXT (base_fndecl);
- }
-}
-
-/* Access the virtual function table entry N. VIRTUALS is the virtual
- function table's initializer. */
-
-static tree
-get_vtable_entry_n (virtuals, n)
- tree virtuals;
- unsigned HOST_WIDE_INT n;
-{
- while (n > 0)
- {
- --n;
- virtuals = TREE_CHAIN (virtuals);
- }
- return virtuals;
-}
-
-/* Add a virtual function to all the appropriate vtables for the class
- T. DECL_VINDEX(X) should be error_mark_node, if we want to
- allocate a new slot in our table. If it is error_mark_node, we
- know that no other function from another vtable is overridden by X.
- HAS_VIRTUAL keeps track of how many virtuals there are in our main
- vtable for the type, and we build upon the PENDING_VIRTUALS list
- and return it. */
-
-static tree
-add_virtual_function (pending_virtuals, has_virtual, fndecl, t)
- tree pending_virtuals;
- int *has_virtual;
- tree fndecl;
- tree t; /* Structure type. */
-{
- /* FUNCTION_TYPEs and OFFSET_TYPEs no longer freely
- convert to void *. Make such a conversion here. */
- tree vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fndecl);
- TREE_CONSTANT (vfn) = 1;
-
-#ifndef DUMB_USER
- if (current_class_type == 0)
- cp_warning ("internal problem, current_class_type is zero when adding `%D', please report",
- fndecl);
- if (current_class_type && t != current_class_type)
- cp_warning ("internal problem, current_class_type differs when adding `%D', please report",
- fndecl);
-#endif
-
- /* If the virtual function is a redefinition of a prior one,
- figure out in which base class the new definition goes,
- and if necessary, make a fresh virtual function table
- to hold that entry. */
- if (DECL_VINDEX (fndecl) == error_mark_node)
- {
- tree entry;
-
- /* We remember that this was the base sub-object for rtti. */
- CLASSTYPE_RTTI (t) = t;
-
- /* If we are using thunks, use two slots at the front, one
- for the offset pointer, one for the tdesc pointer. */
- if (*has_virtual == 0 && flag_vtable_thunks)
- {
- *has_virtual = 1;
- }
-
- /* Build a new INT_CST for this DECL_VINDEX. */
- {
- static tree index_table[256];
- tree idx;
- /* We skip a slot for the offset/tdesc entry. */
- int i = ++(*has_virtual);
-
- if (i >= 256 || index_table[i] == 0)
- {
- idx = build_int_2 (i, 0);
- if (i < 256)
- index_table[i] = idx;
- }
- else
- idx = index_table[i];
-
- /* Now assign virtual dispatch information. */
- DECL_VINDEX (fndecl) = idx;
- DECL_CONTEXT (fndecl) = t;
- }
- entry = build_vtable_entry (integer_zero_node, vfn);
- pending_virtuals = tree_cons (DECL_VINDEX (fndecl), entry, pending_virtuals);
- }
- /* Might already be INTEGER_CST if declared twice in class. We will
- give error later or we've already given it. */
- else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
- {
- /* Need an entry in some other virtual function table.
- Deal with this after we have laid out our virtual base classes. */
- pending_hard_virtuals = temp_tree_cons (fndecl, vfn, pending_hard_virtuals);
- }
- return pending_virtuals;
-}
-
-/* Obstack on which to build the vector of class methods. */
-struct obstack class_obstack;
-extern struct obstack *current_obstack;
-
-/* Add method METHOD to class TYPE. This is used when a method
- has been defined which did not initially appear in the class definition,
- and helps cut down on spurious error messages.
-
- FIELDS is the entry in the METHOD_VEC vector entry of the class type where
- the method should be added. */
-
-void
-add_method (type, fields, method)
- tree type, *fields, method;
-{
- /* We must make a copy of METHOD here, since we must be sure that
- we have exclusive title to this method's DECL_CHAIN. */
- tree decl;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- {
- decl = copy_node (method);
- if (DECL_RTL (decl) == 0
- && (!processing_template_decl
- || !uses_template_parms (decl)))
- {
- make_function_rtl (decl);
- DECL_RTL (method) = DECL_RTL (decl);
- }
- }
-
- if (fields && *fields)
- {
- /* Take care not to hide destructor. */
- DECL_CHAIN (decl) = DECL_CHAIN (*fields);
- DECL_CHAIN (*fields) = decl;
- }
- else if (CLASSTYPE_METHOD_VEC (type) == 0)
- {
- tree method_vec = make_node (TREE_VEC);
- if (TYPE_IDENTIFIER (type) == DECL_NAME (decl))
- {
- /* ??? Is it possible for there to have been enough room in the
- current chunk for the tree_vec structure but not a tree_vec
- plus a tree*? Will this work in that case? */
- obstack_free (current_obstack, method_vec);
- obstack_blank (current_obstack, sizeof (struct tree_vec) + sizeof (tree *));
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl)))
- TREE_VEC_ELT (method_vec, 1) = decl;
- else
- TREE_VEC_ELT (method_vec, 0) = decl;
- TREE_VEC_LENGTH (method_vec) = 2;
- }
- else
- {
- /* ??? Is it possible for there to have been enough room in the
- current chunk for the tree_vec structure but not a tree_vec
- plus a tree*? Will this work in that case? */
- obstack_free (current_obstack, method_vec);
- obstack_blank (current_obstack, sizeof (struct tree_vec) + 2*sizeof (tree *));
- TREE_VEC_ELT (method_vec, 2) = decl;
- TREE_VEC_LENGTH (method_vec) = 3;
- obstack_finish (current_obstack);
- }
- CLASSTYPE_METHOD_VEC (type) = method_vec;
- }
- else
- {
- tree method_vec = CLASSTYPE_METHOD_VEC (type);
- int len = TREE_VEC_LENGTH (method_vec);
-
- /* Adding a new ctor or dtor. This is easy because our
- METHOD_VEC always has a slot for such entries. */
- if (TYPE_IDENTIFIER (type) == DECL_NAME (decl))
- {
- int idx = !!DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl));
- /* TREE_VEC_ELT (method_vec, idx) = decl; */
- if (decl != TREE_VEC_ELT (method_vec, idx))
- {
- DECL_CHAIN (decl) = TREE_VEC_ELT (method_vec, idx);
- TREE_VEC_ELT (method_vec, idx) = decl;
- }
- }
- else
- {
- /* This is trickier. We try to extend the TREE_VEC in-place,
- but if that does not work, we copy all its data to a new
- TREE_VEC that's large enough. */
- struct obstack *ob = &class_obstack;
- tree *end = (tree *)obstack_next_free (ob);
-
- if (end != TREE_VEC_END (method_vec))
- {
- ob = current_obstack;
- TREE_VEC_LENGTH (method_vec) += 1;
- TREE_VEC_ELT (method_vec, len) = NULL_TREE;
- method_vec = copy_node (method_vec);
- TREE_VEC_LENGTH (method_vec) -= 1;
- }
- else
- {
- tree tmp_vec = (tree) obstack_base (ob);
- if (obstack_room (ob) < sizeof (tree))
- {
- obstack_blank (ob, sizeof (struct tree_common)
- + tree_code_length[(int) TREE_VEC]
- * sizeof (char *)
- + len * sizeof (tree));
- tmp_vec = (tree) obstack_base (ob);
- bcopy ((char *) method_vec, (char *) tmp_vec,
- (sizeof (struct tree_common)
- + tree_code_length[(int) TREE_VEC] * sizeof (char *)
- + (len-1) * sizeof (tree)));
- method_vec = tmp_vec;
- }
- else
- obstack_blank (ob, sizeof (tree));
- }
-
- obstack_finish (ob);
- TREE_VEC_ELT (method_vec, len) = decl;
- TREE_VEC_LENGTH (method_vec) = len + 1;
- CLASSTYPE_METHOD_VEC (type) = method_vec;
-
- if (TYPE_BINFO_BASETYPES (type) && CLASSTYPE_BASELINK_VEC (type))
- {
- /* ??? May be better to know whether these can be extended? */
- tree baselink_vec = CLASSTYPE_BASELINK_VEC (type);
-
- TREE_VEC_LENGTH (baselink_vec) += 1;
- CLASSTYPE_BASELINK_VEC (type) = copy_node (baselink_vec);
- TREE_VEC_LENGTH (baselink_vec) -= 1;
-
- TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), len) = 0;
- }
- }
- }
- DECL_CONTEXT (decl) = type;
- DECL_CLASS_CONTEXT (decl) = type;
-
- pop_obstacks ();
-}
-
-/* Subroutines of finish_struct. */
-
-/* Look through the list of fields for this struct, deleting
- duplicates as we go. This must be recursive to handle
- anonymous unions.
-
- FIELD is the field which may not appear anywhere in FIELDS.
- FIELD_PTR, if non-null, is the starting point at which
- chained deletions may take place.
- The value returned is the first acceptable entry found
- in FIELDS.
-
- Note that anonymous fields which are not of UNION_TYPE are
- not duplicates, they are just anonymous fields. This happens
- when we have unnamed bitfields, for example. */
-
-static tree
-delete_duplicate_fields_1 (field, fields)
- tree field, fields;
-{
- tree x;
- tree prev = 0;
- if (DECL_NAME (field) == 0)
- {
- if (TREE_CODE (TREE_TYPE (field)) != UNION_TYPE)
- return fields;
-
- for (x = TYPE_FIELDS (TREE_TYPE (field)); x; x = TREE_CHAIN (x))
- fields = delete_duplicate_fields_1 (x, fields);
- return fields;
- }
- else
- {
- for (x = fields; x; prev = x, x = TREE_CHAIN (x))
- {
- if (DECL_NAME (x) == 0)
- {
- if (TREE_CODE (TREE_TYPE (x)) != UNION_TYPE)
- continue;
- TYPE_FIELDS (TREE_TYPE (x))
- = delete_duplicate_fields_1 (field, TYPE_FIELDS (TREE_TYPE (x)));
- if (TYPE_FIELDS (TREE_TYPE (x)) == 0)
- {
- if (prev == 0)
- fields = TREE_CHAIN (fields);
- else
- TREE_CHAIN (prev) = TREE_CHAIN (x);
- }
- }
- else
- {
- if (DECL_NAME (field) == DECL_NAME (x))
- {
- if (TREE_CODE (field) == CONST_DECL
- && TREE_CODE (x) == CONST_DECL)
- cp_error_at ("duplicate enum value `%D'", x);
- else if (TREE_CODE (field) == CONST_DECL
- || TREE_CODE (x) == CONST_DECL)
- cp_error_at ("duplicate field `%D' (as enum and non-enum)",
- x);
- else if (TREE_CODE (field) == TYPE_DECL
- && TREE_CODE (x) == TYPE_DECL)
- {
- if (TREE_TYPE (field) == TREE_TYPE (x))
- continue;
- cp_error_at ("duplicate nested type `%D'", x);
- }
- else if (TREE_CODE (field) == TYPE_DECL
- || TREE_CODE (x) == TYPE_DECL)
- {
- /* Hide tag decls. */
- if ((TREE_CODE (field) == TYPE_DECL
- && DECL_ARTIFICIAL (field))
- || (TREE_CODE (x) == TYPE_DECL
- && DECL_ARTIFICIAL (x)))
- continue;
- cp_error_at ("duplicate field `%D' (as type and non-type)",
- x);
- }
- else
- cp_error_at ("duplicate member `%D'", x);
- if (prev == 0)
- fields = TREE_CHAIN (fields);
- else
- TREE_CHAIN (prev) = TREE_CHAIN (x);
- }
- }
- }
- }
- return fields;
-}
-
-static void
-delete_duplicate_fields (fields)
- tree fields;
-{
- tree x;
- for (x = fields; x && TREE_CHAIN (x); x = TREE_CHAIN (x))
- TREE_CHAIN (x) = delete_duplicate_fields_1 (x, TREE_CHAIN (x));
-}
-
-/* Change the access of FDECL to ACCESS in T.
- Return 1 if change was legit, otherwise return 0. */
-
-static int
-alter_access (t, fdecl, access)
- tree t;
- tree fdecl;
- tree access;
-{
- tree elem = purpose_member (t, DECL_ACCESS (fdecl));
- if (elem && TREE_VALUE (elem) != access)
- {
- if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL)
- {
- cp_error_at ("conflicting access specifications for method `%D', ignored", TREE_TYPE (fdecl));
- }
- else
- error ("conflicting access specifications for field `%s', ignored",
- IDENTIFIER_POINTER (DECL_NAME (fdecl)));
- }
- else if (TREE_PRIVATE (fdecl))
- {
- if (access != access_private_node)
- cp_error_at ("cannot make private `%D' non-private", fdecl);
- goto alter;
- }
- else if (TREE_PROTECTED (fdecl))
- {
- if (access != access_protected_node)
- cp_error_at ("cannot make protected `%D' non-protected", fdecl);
- goto alter;
- }
- /* ARM 11.3: an access declaration may not be used to restrict access
- to a member that is accessible in the base class. */
- else if (access != access_public_node)
- cp_error_at ("cannot reduce access of public member `%D'", fdecl);
- else if (elem == NULL_TREE)
- {
- alter:
- DECL_ACCESS (fdecl) = tree_cons (t, access, DECL_ACCESS (fdecl));
- return 1;
- }
- return 0;
-}
-
-/* If FOR_TYPE needs to reinitialize virtual function table pointers
- for TYPE's sub-objects, add such reinitializations to BASE_INIT_LIST.
- Returns BASE_INIT_LIST appropriately modified. */
-
-static tree
-maybe_fixup_vptrs (for_type, binfo, base_init_list)
- tree for_type, binfo, base_init_list;
-{
- /* Now reinitialize any slots that don't fall under our virtual
- function table pointer. */
- tree vfields = CLASSTYPE_VFIELDS (BINFO_TYPE (binfo));
- while (vfields)
- {
- tree basetype = VF_NORMAL_VALUE (vfields)
- ? TYPE_MAIN_VARIANT (VF_NORMAL_VALUE (vfields))
- : VF_BASETYPE_VALUE (vfields);
-
- tree base_binfo = get_binfo (basetype, for_type, 0);
- /* Punt until this is implemented. */
- if (1 /* BINFO_MODIFIED (base_binfo) */)
- {
- tree base_offset = get_vfield_offset (base_binfo);
- if (! tree_int_cst_equal (base_offset, get_vfield_offset (TYPE_BINFO (for_type)))
- && ! tree_int_cst_equal (base_offset, get_vfield_offset (binfo)))
- base_init_list = tree_cons (error_mark_node, base_binfo,
- base_init_list);
- }
- vfields = TREE_CHAIN (vfields);
- }
- return base_init_list;
-}
-
-/* If TYPE does not have a constructor, then the compiler must
- manually deal with all of the initialization this type requires.
-
- If a base initializer exists only to fill in the virtual function
- table pointer, then we mark that fact with the TREE_VIRTUAL bit.
- This way, we avoid multiple initializations of the same field by
- each virtual function table up the class hierarchy.
-
- Virtual base class pointers are not initialized here. They are
- initialized only at the "top level" of object creation. If we
- initialized them here, we would have to skip a lot of work. */
-
-static void
-build_class_init_list (type)
- tree type;
-{
- tree base_init_list = NULL_TREE;
- tree member_init_list = NULL_TREE;
-
- /* Since we build member_init_list and base_init_list using
- tree_cons, backwards fields the all through work. */
- tree x;
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (type));
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (x = TYPE_FIELDS (type); x; x = TREE_CHAIN (x))
- {
- if (TREE_CODE (x) != FIELD_DECL)
- continue;
-
- if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (x))
- || DECL_INITIAL (x) != NULL_TREE)
- member_init_list = tree_cons (x, type, member_init_list);
- }
- member_init_list = nreverse (member_init_list);
-
- /* We will end up doing this last. Need special marker
- to avoid infinite regress. */
- if (TYPE_VIRTUAL_P (type))
- {
- base_init_list = build_tree_list (error_mark_node, TYPE_BINFO (type));
- if (CLASSTYPE_NEEDS_VIRTUAL_REINIT (type) == 0)
- TREE_VALUE (base_init_list) = NULL_TREE;
- TREE_ADDRESSABLE (base_init_list) = 1;
- }
-
- /* Each base class which needs to have initialization
- of some kind gets to make such requests known here. */
- for (i = n_baseclasses-1; i >= 0; i--)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree blist;
-
- /* Don't initialize virtual baseclasses this way. */
- if (TREE_VIA_VIRTUAL (base_binfo))
- continue;
-
- if (TYPE_HAS_CONSTRUCTOR (BINFO_TYPE (base_binfo)))
- {
- /* ...and the last shall come first... */
- base_init_list = maybe_fixup_vptrs (type, base_binfo, base_init_list);
- base_init_list = tree_cons (NULL_TREE, base_binfo, base_init_list);
- continue;
- }
-
- if ((blist = CLASSTYPE_BASE_INIT_LIST (BINFO_TYPE (base_binfo))) == NULL_TREE)
- /* Nothing to initialize. */
- continue;
-
- /* ...ditto... */
- base_init_list = maybe_fixup_vptrs (type, base_binfo, base_init_list);
-
- /* This is normally true for single inheritance.
- The win is we can shrink the chain of initializations
- to be done by only converting to the actual type
- we are interested in. */
- if (TREE_VALUE (blist)
- && TREE_CODE (TREE_VALUE (blist)) == TREE_VEC
- && tree_int_cst_equal (BINFO_OFFSET (base_binfo),
- BINFO_OFFSET (TREE_VALUE (blist))))
- {
- if (base_init_list)
- {
- /* Does it do more than just fill in a
- virtual function table pointer? */
- if (! TREE_ADDRESSABLE (blist))
- base_init_list = build_tree_list (blist, base_init_list);
- /* Can we get by just with the virtual function table
- pointer that it fills in? */
- else if (TREE_ADDRESSABLE (base_init_list)
- && TREE_VALUE (base_init_list) == 0)
- base_init_list = blist;
- /* Maybe, but it is not obvious as the previous case. */
- else if (! CLASSTYPE_NEEDS_VIRTUAL_REINIT (type))
- {
- tree last = tree_last (base_init_list);
- while (TREE_VALUE (last)
- && TREE_CODE (TREE_VALUE (last)) == TREE_LIST)
- last = tree_last (TREE_VALUE (last));
- if (TREE_VALUE (last) == 0)
- base_init_list = build_tree_list (blist, base_init_list);
- }
- }
- else
- base_init_list = blist;
- }
- else
- {
- /* The function expand_aggr_init knows how to do the
- initialization of `basetype' without getting
- an explicit `blist'. */
- if (base_init_list)
- base_init_list = tree_cons (NULL_TREE, base_binfo, base_init_list);
- else
- base_init_list = CLASSTYPE_BINFO_AS_LIST (BINFO_TYPE (base_binfo));
- }
- }
-
- if (base_init_list)
- if (member_init_list)
- CLASSTYPE_BASE_INIT_LIST (type) = build_tree_list (base_init_list, member_init_list);
- else
- CLASSTYPE_BASE_INIT_LIST (type) = base_init_list;
- else if (member_init_list)
- CLASSTYPE_BASE_INIT_LIST (type) = member_init_list;
-}
-
-struct base_info
-{
- int has_virtual;
- int max_has_virtual;
- int n_ancestors;
- tree vfield;
- tree vfields;
- tree rtti;
- char cant_have_default_ctor;
- char cant_have_const_ctor;
- char no_const_asn_ref;
-};
-
-/* Record information about type T derived from its base classes.
- Store most of that information in T itself, and place the
- remaining information in the struct BASE_INFO.
-
- Propagate basetype offsets throughout the lattice. Note that the
- lattice topped by T is really a pair: it's a DAG that gives the
- structure of the derivation hierarchy, and it's a list of the
- virtual baseclasses that appear anywhere in the DAG. When a vbase
- type appears in the DAG, it's offset is 0, and it's children start
- their offsets from that point. When a vbase type appears in the list,
- its offset is the offset it has in the hierarchy, and its children's
- offsets include that offset in theirs.
-
- Returns the index of the first base class to have virtual functions,
- or -1 if no such base class.
-
- Note that at this point TYPE_BINFO (t) != t_binfo. */
-
-static int
-finish_base_struct (t, b, t_binfo)
- tree t;
- struct base_info *b;
- tree t_binfo;
-{
- tree binfos = BINFO_BASETYPES (t_binfo);
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- int first_vfn_base_index = -1;
- bzero ((char *) b, sizeof (struct base_info));
-
- for (i = 0; i < n_baseclasses; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree basetype = BINFO_TYPE (base_binfo);
-
- /* If the type of basetype is incomplete, then
- we already complained about that fact
- (and we should have fixed it up as well). */
- if (TYPE_SIZE (basetype) == 0)
- {
- int j;
- /* The base type is of incomplete type. It is
- probably best to pretend that it does not
- exist. */
- if (i == n_baseclasses-1)
- TREE_VEC_ELT (binfos, i) = NULL_TREE;
- TREE_VEC_LENGTH (binfos) -= 1;
- n_baseclasses -= 1;
- for (j = i; j+1 < n_baseclasses; j++)
- TREE_VEC_ELT (binfos, j) = TREE_VEC_ELT (binfos, j+1);
- }
-
- if (! TYPE_HAS_CONST_INIT_REF (basetype))
- b->cant_have_const_ctor = 1;
-
- if (TYPE_HAS_CONSTRUCTOR (basetype)
- && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype))
- {
- b->cant_have_default_ctor = 1;
- if (! TYPE_HAS_CONSTRUCTOR (t))
- {
- cp_pedwarn ("base `%T' with only non-default constructor",
- basetype);
- cp_pedwarn ("in class without a constructor");
- }
- }
-
- if (TYPE_HAS_ASSIGN_REF (basetype)
- && !TYPE_HAS_CONST_ASSIGN_REF (basetype))
- b->no_const_asn_ref = 1;
-
- b->n_ancestors += CLASSTYPE_N_SUPERCLASSES (basetype);
- TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (basetype);
- TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_NEEDS_DESTRUCTOR (basetype);
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (basetype);
- TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (basetype);
-
- TYPE_OVERLOADS_CALL_EXPR (t) |= TYPE_OVERLOADS_CALL_EXPR (basetype);
- TYPE_OVERLOADS_ARRAY_REF (t) |= TYPE_OVERLOADS_ARRAY_REF (basetype);
- TYPE_OVERLOADS_ARROW (t) |= TYPE_OVERLOADS_ARROW (basetype);
-
- if (! TREE_VIA_VIRTUAL (base_binfo)
- && BINFO_BASETYPES (base_binfo))
- {
- tree base_binfos = BINFO_BASETYPES (base_binfo);
- tree chain = NULL_TREE;
- int j;
-
- /* Now unshare the structure beneath BASE_BINFO. */
- for (j = TREE_VEC_LENGTH (base_binfos)-1;
- j >= 0; j--)
- {
- tree base_base_binfo = TREE_VEC_ELT (base_binfos, j);
- if (! TREE_VIA_VIRTUAL (base_base_binfo))
- TREE_VEC_ELT (base_binfos, j)
- = make_binfo (BINFO_OFFSET (base_base_binfo),
- base_base_binfo,
- BINFO_VTABLE (base_base_binfo),
- BINFO_VIRTUALS (base_base_binfo),
- chain);
- chain = TREE_VEC_ELT (base_binfos, j);
- TREE_VIA_PUBLIC (chain) = TREE_VIA_PUBLIC (base_base_binfo);
- TREE_VIA_PROTECTED (chain) = TREE_VIA_PROTECTED (base_base_binfo);
- BINFO_INHERITANCE_CHAIN (chain) = base_binfo;
- }
-
- /* Completely unshare potentially shared data, and
- update what is ours. */
- propagate_binfo_offsets (base_binfo, BINFO_OFFSET (base_binfo));
- }
-
- if (! TREE_VIA_VIRTUAL (base_binfo))
- CLASSTYPE_N_SUPERCLASSES (t) += 1;
-
- if (TYPE_VIRTUAL_P (basetype))
- {
- /* Ensure that this is set from at least a virtual base
- class. */
- if (b->rtti == NULL_TREE)
- b->rtti = CLASSTYPE_RTTI (basetype);
-
- /* Don't borrow virtuals from virtual baseclasses. */
- if (TREE_VIA_VIRTUAL (base_binfo))
- continue;
-
- if (first_vfn_base_index < 0)
- {
- tree vfields;
- first_vfn_base_index = i;
-
- /* Update these two, now that we know what vtable we are
- going to extend. This is so that we can add virtual
- functions, and override them properly. */
- BINFO_VTABLE (t_binfo) = TYPE_BINFO_VTABLE (basetype);
- BINFO_VIRTUALS (t_binfo) = TYPE_BINFO_VIRTUALS (basetype);
- b->has_virtual = CLASSTYPE_VSIZE (basetype);
- b->vfield = CLASSTYPE_VFIELD (basetype);
- b->vfields = copy_list (CLASSTYPE_VFIELDS (basetype));
- vfields = b->vfields;
- while (vfields)
- {
- if (VF_BINFO_VALUE (vfields) == NULL_TREE
- || ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields)))
- {
- tree value = VF_BASETYPE_VALUE (vfields);
- if (DECL_NAME (CLASSTYPE_VFIELD (value))
- == DECL_NAME (CLASSTYPE_VFIELD (basetype)))
- VF_NORMAL_VALUE (b->vfields) = basetype;
- else
- VF_NORMAL_VALUE (b->vfields) = VF_NORMAL_VALUE (vfields);
- }
- vfields = TREE_CHAIN (vfields);
- }
- CLASSTYPE_VFIELD (t) = b->vfield;
- }
- else
- {
- /* Only add unique vfields, and flatten them out as we go. */
- tree vfields = CLASSTYPE_VFIELDS (basetype);
- while (vfields)
- {
- if (VF_BINFO_VALUE (vfields) == NULL_TREE
- || ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields)))
- {
- tree value = VF_BASETYPE_VALUE (vfields);
- b->vfields = tree_cons (base_binfo, value, b->vfields);
- if (DECL_NAME (CLASSTYPE_VFIELD (value))
- == DECL_NAME (CLASSTYPE_VFIELD (basetype)))
- VF_NORMAL_VALUE (b->vfields) = basetype;
- else
- VF_NORMAL_VALUE (b->vfields) = VF_NORMAL_VALUE (vfields);
- }
- vfields = TREE_CHAIN (vfields);
- }
-
- if (b->has_virtual == 0)
- {
- first_vfn_base_index = i;
-
- /* Update these two, now that we know what vtable we are
- going to extend. This is so that we can add virtual
- functions, and override them properly. */
- BINFO_VTABLE (t_binfo) = TYPE_BINFO_VTABLE (basetype);
- BINFO_VIRTUALS (t_binfo) = TYPE_BINFO_VIRTUALS (basetype);
- b->has_virtual = CLASSTYPE_VSIZE (basetype);
- b->vfield = CLASSTYPE_VFIELD (basetype);
- CLASSTYPE_VFIELD (t) = b->vfield;
- /* When we install the first one, set the VF_NORMAL_VALUE
- to be the current class, as this it is the most derived
- class. Hopefully, this is not set to something else
- later. (mrs) */
- vfields = b->vfields;
- while (vfields)
- {
- if (DECL_NAME (CLASSTYPE_VFIELD (t))
- == DECL_NAME (CLASSTYPE_VFIELD (basetype)))
- {
- VF_NORMAL_VALUE (vfields) = t;
- /* There should only be one of them! And it should
- always be found, if we get into here. (mrs) */
- break;
- }
- vfields = TREE_CHAIN (vfields);
- }
- }
- }
- }
- }
-
- /* Must come after offsets are fixed for all bases. */
- for (i = 0; i < n_baseclasses; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree basetype = BINFO_TYPE (base_binfo);
-
- if (get_base_distance (basetype, t_binfo, 0, (tree*)0) == -2)
- {
- cp_warning ("direct base `%T' inaccessible in `%T' due to ambiguity",
- basetype, t);
- }
- }
- {
- tree v = get_vbase_types (t_binfo);
-
- for (; v; v = TREE_CHAIN (v))
- {
- tree basetype = BINFO_TYPE (v);
- if (get_base_distance (basetype, t_binfo, 0, (tree*)0) == -2)
- {
- if (extra_warnings)
- cp_warning ("virtual base `%T' inaccessible in `%T' due to ambiguity",
- basetype, t);
- }
- }
- }
-
- {
- tree vfields;
- /* Find the base class with the largest number of virtual functions. */
- for (vfields = b->vfields; vfields; vfields = TREE_CHAIN (vfields))
- {
- if (CLASSTYPE_VSIZE (VF_BASETYPE_VALUE (vfields)) > b->max_has_virtual)
- b->max_has_virtual = CLASSTYPE_VSIZE (VF_BASETYPE_VALUE (vfields));
- if (VF_DERIVED_VALUE (vfields)
- && CLASSTYPE_VSIZE (VF_DERIVED_VALUE (vfields)) > b->max_has_virtual)
- b->max_has_virtual = CLASSTYPE_VSIZE (VF_DERIVED_VALUE (vfields));
- }
- }
-
- if (b->vfield == 0)
- /* If all virtual functions come only from virtual baseclasses. */
- return -1;
-
- /* Update the rtti base if we have a non-virtual base class version
- of it. */
- b->rtti = CLASSTYPE_RTTI (BINFO_TYPE (TREE_VEC_ELT (binfos, first_vfn_base_index)));
-
- return first_vfn_base_index;
-}
-
-static int
-typecode_p (type, code)
- tree type;
- enum tree_code code;
-{
- return (TREE_CODE (type) == code
- || (TREE_CODE (type) == REFERENCE_TYPE
- && TREE_CODE (TREE_TYPE (type)) == code));
-}
-
-/* Set memoizing fields and bits of T (and its variants) for later use.
- MAX_HAS_VIRTUAL is the largest size of any T's virtual function tables. */
-
-static void
-finish_struct_bits (t, max_has_virtual)
- tree t;
- int max_has_virtual;
-{
- int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
-
- /* Fix up variants (if any). */
- tree variants = TYPE_NEXT_VARIANT (t);
- while (variants)
- {
- /* These fields are in the _TYPE part of the node, not in
- the TYPE_LANG_SPECIFIC component, so they are not shared. */
- TYPE_HAS_CONSTRUCTOR (variants) = TYPE_HAS_CONSTRUCTOR (t);
- TYPE_HAS_DESTRUCTOR (variants) = TYPE_HAS_DESTRUCTOR (t);
- TYPE_NEEDS_CONSTRUCTING (variants) = TYPE_NEEDS_CONSTRUCTING (t);
- TYPE_NEEDS_DESTRUCTOR (variants) = TYPE_NEEDS_DESTRUCTOR (t);
-
- TYPE_USES_COMPLEX_INHERITANCE (variants) = TYPE_USES_COMPLEX_INHERITANCE (t);
- TYPE_VIRTUAL_P (variants) = TYPE_VIRTUAL_P (t);
- TYPE_USES_VIRTUAL_BASECLASSES (variants) = TYPE_USES_VIRTUAL_BASECLASSES (t);
- /* Copy whatever these are holding today. */
- TYPE_MIN_VALUE (variants) = TYPE_MIN_VALUE (t);
- TYPE_MAX_VALUE (variants) = TYPE_MAX_VALUE (t);
- TYPE_FIELDS (variants) = TYPE_FIELDS (t);
- TYPE_SIZE (variants) = TYPE_SIZE (t);
- variants = TYPE_NEXT_VARIANT (variants);
- }
-
- if (n_baseclasses && max_has_virtual)
- {
- /* Done by `finish_struct' for classes without baseclasses. */
- int might_have_abstract_virtuals = CLASSTYPE_ABSTRACT_VIRTUALS (t) != 0;
- tree binfos = TYPE_BINFO_BASETYPES (t);
- for (i = n_baseclasses-1; i >= 0; i--)
- {
- might_have_abstract_virtuals
- |= (CLASSTYPE_ABSTRACT_VIRTUALS (BINFO_TYPE (TREE_VEC_ELT (binfos, i))) != 0);
- if (might_have_abstract_virtuals)
- break;
- }
- if (might_have_abstract_virtuals)
- {
- /* We use error_mark_node from override_one_vtable to signal
- an artificial abstract. */
- if (CLASSTYPE_ABSTRACT_VIRTUALS (t) == error_mark_node)
- CLASSTYPE_ABSTRACT_VIRTUALS (t) = NULL_TREE;
- CLASSTYPE_ABSTRACT_VIRTUALS (t) = get_abstract_virtuals (t);
- }
- }
-
- if (n_baseclasses)
- {
- /* Notice whether this class has type conversion functions defined. */
- tree binfo = TYPE_BINFO (t);
- tree binfos = BINFO_BASETYPES (binfo);
- tree basetype;
-
- for (i = n_baseclasses-1; i >= 0; i--)
- {
- basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, i));
-
- if (TYPE_HAS_CONVERSION (basetype))
- {
- TYPE_HAS_CONVERSION (t) = 1;
- TYPE_HAS_INT_CONVERSION (t) |= TYPE_HAS_INT_CONVERSION (basetype);
- TYPE_HAS_REAL_CONVERSION (t) |= TYPE_HAS_REAL_CONVERSION (basetype);
- }
- if (CLASSTYPE_MAX_DEPTH (basetype) >= CLASSTYPE_MAX_DEPTH (t))
- CLASSTYPE_MAX_DEPTH (t) = CLASSTYPE_MAX_DEPTH (basetype) + 1;
- }
- }
-
- /* If this type has a copy constructor, force its mode to be BLKmode, and
- force its TREE_ADDRESSABLE bit to be nonzero. This will cause it to
- be passed by invisible reference and prevent it from being returned in
- a register.
-
- Also do this if the class has BLKmode but can still be returned in
- registers, since function_cannot_inline_p won't let us inline
- functions returning such a type. This affects the HP-PA. */
- if (! TYPE_HAS_TRIVIAL_INIT_REF (t)
- || (TYPE_MODE (t) == BLKmode && ! aggregate_value_p (t)
- && CLASSTYPE_NON_AGGREGATE (t)))
- {
- tree variants;
- DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode;
- for (variants = t; variants; variants = TYPE_NEXT_VARIANT (variants))
- {
- TYPE_MODE (variants) = BLKmode;
- TREE_ADDRESSABLE (variants) = 1;
- }
- }
-}
-
-/* Add FNDECL to the method_vec growing on the class_obstack. Used by
- finish_struct_methods. Note, FNDECL cannot be a constructor or
- destructor, those cases are handled by the caller. */
-
-static void
-grow_method (fndecl, method_vec_ptr)
- tree fndecl;
- tree *method_vec_ptr;
-{
- tree method_vec = (tree)obstack_base (&class_obstack);
-
- /* Start off past the constructors and destructor. */
- tree *testp = &TREE_VEC_ELT (method_vec, 2);
-
- while (testp < (tree *) obstack_next_free (&class_obstack)
- && (*testp == NULL_TREE || DECL_NAME (*testp) != DECL_NAME (fndecl)))
- testp++;
-
- if (testp < (tree *) obstack_next_free (&class_obstack))
- {
- tree x, prev_x;
-
- for (x = *testp; x; x = DECL_CHAIN (x))
- {
- if (DECL_NAME (fndecl) == ansi_opname[(int) DELETE_EXPR]
- || DECL_NAME (fndecl) == ansi_opname[(int) VEC_DELETE_EXPR])
- {
- /* ANSI C++ June 5 1992 WP 12.5.5.1 */
- cp_error_at ("`%D' overloaded", fndecl);
- cp_error_at ("previous declaration as `%D' here", x);
- }
- if (DECL_ASSEMBLER_NAME (fndecl) == DECL_ASSEMBLER_NAME (x))
- {
- /* Friend-friend ambiguities are warned about outside
- this loop. */
- cp_error_at ("ambiguous method `%#D' in structure", fndecl);
- break;
- }
- prev_x = x;
- }
- if (x == 0)
- {
- if (*testp)
- DECL_CHAIN (prev_x) = fndecl;
- else
- *testp = fndecl;
- }
- }
- else
- {
- obstack_ptr_grow (&class_obstack, fndecl);
- *method_vec_ptr = (tree)obstack_base (&class_obstack);
- }
-}
-
-/* Warn about duplicate methods in fn_fields. Also compact method
- lists so that lookup can be made faster.
-
- Algorithm: Outer loop builds lists by method name. Inner loop
- checks for redundant method names within a list.
-
- Data Structure: List of method lists. The outer list is a
- TREE_LIST, whose TREE_PURPOSE field is the field name and the
- TREE_VALUE is the DECL_CHAIN of the FUNCTION_DECLs. TREE_CHAIN
- links the entire list of methods for TYPE_METHODS. Friends are
- chained in the same way as member functions (? TREE_CHAIN or
- DECL_CHAIN), but they live in the TREE_TYPE field of the outer
- list. That allows them to be quickly deleted, and requires no
- extra storage.
-
- If there are any constructors/destructors, they are moved to the
- front of the list. This makes pushclass more efficient.
-
- We also link each field which has shares a name with its baseclass
- to the head of the list of fields for that base class. This allows
- us to reduce search time in places like `build_method_call' to
- consider only reasonably likely functions. */
-
-tree
-finish_struct_methods (t, fn_fields, nonprivate_method)
- tree t;
- tree fn_fields;
- int nonprivate_method;
-{
- tree method_vec;
- tree save_fn_fields = fn_fields;
- tree ctor_name = constructor_name (t);
- int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
-
- /* Now prepare to gather fn_fields into vector. */
- struct obstack *ambient_obstack = current_obstack;
- current_obstack = &class_obstack;
- method_vec = make_tree_vec (2);
- current_obstack = ambient_obstack;
-
- /* Now make this a live vector. */
- obstack_free (&class_obstack, method_vec);
-
- /* Save room for constructors and destructors. */
- obstack_blank (&class_obstack, sizeof (struct tree_vec) + sizeof (struct tree *));
-
- /* First fill in entry 0 with the constructors, entry 1 with destructors,
- and the next few with type conversion operators (if any). */
-
- for (; fn_fields; fn_fields = TREE_CHAIN (fn_fields))
- {
- tree fn_name = DECL_NAME (fn_fields);
-
- /* Clear out this flag.
-
- @@ Doug may figure out how to break
- @@ this with nested classes and friends. */
- DECL_IN_AGGR_P (fn_fields) = 0;
-
- /* Note here that a copy ctor is private, so we don't dare generate
- a default copy constructor for a class that has a member
- of this type without making sure they have access to it. */
- if (fn_name == ctor_name)
- {
- tree parmtypes = FUNCTION_ARG_CHAIN (fn_fields);
- tree parmtype = parmtypes ? TREE_VALUE (parmtypes) : void_type_node;
-
- if (TREE_CODE (parmtype) == REFERENCE_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == t)
- {
- if (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
- {
- if (TREE_PROTECTED (fn_fields))
- TYPE_HAS_NONPUBLIC_CTOR (t) = 1;
- else if (TREE_PRIVATE (fn_fields))
- TYPE_HAS_NONPUBLIC_CTOR (t) = 2;
- }
- }
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fn_fields)))
- {
- /* Destructors go in slot 1. */
- DECL_CHAIN (fn_fields) = TREE_VEC_ELT (method_vec, 1);
- TREE_VEC_ELT (method_vec, 1) = fn_fields;
- }
- else
- {
- /* Constructors go in slot 0. */
- DECL_CHAIN (fn_fields) = TREE_VEC_ELT (method_vec, 0);
- TREE_VEC_ELT (method_vec, 0) = fn_fields;
- }
- }
- else if (IDENTIFIER_TYPENAME_P (fn_name))
- {
- tree return_type = TREE_TYPE (TREE_TYPE (fn_fields));
-
- if (typecode_p (return_type, INTEGER_TYPE)
- || typecode_p (return_type, BOOLEAN_TYPE)
- || typecode_p (return_type, ENUMERAL_TYPE))
- TYPE_HAS_INT_CONVERSION (t) = 1;
- else if (typecode_p (return_type, REAL_TYPE))
- TYPE_HAS_REAL_CONVERSION (t) = 1;
-
- grow_method (fn_fields, &method_vec);
- }
- }
-
- fn_fields = save_fn_fields;
- for (; fn_fields; fn_fields = TREE_CHAIN (fn_fields))
- {
- tree fn_name = DECL_NAME (fn_fields);
-
- if (fn_name == ctor_name || IDENTIFIER_TYPENAME_P (fn_name))
- continue;
-
- if (fn_name == ansi_opname[(int) MODIFY_EXPR])
- {
- tree parmtype = TREE_VALUE (FUNCTION_ARG_CHAIN (fn_fields));
-
- if (copy_assignment_arg_p (parmtype, DECL_VIRTUAL_P (fn_fields)))
- {
- if (TREE_PROTECTED (fn_fields))
- TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 1;
- else if (TREE_PRIVATE (fn_fields))
- TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 2;
- }
- }
-
- grow_method (fn_fields, &method_vec);
- }
-
- TREE_VEC_LENGTH (method_vec) = (tree *)obstack_next_free (&class_obstack)
- - (&TREE_VEC_ELT (method_vec, 0));
- obstack_finish (&class_obstack);
- CLASSTYPE_METHOD_VEC (t) = method_vec;
-
- if (nonprivate_method == 0
- && CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
- && DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE)
- {
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
- for (i = 0; i < n_baseclasses; i++)
- if (TREE_VIA_PUBLIC (TREE_VEC_ELT (binfos, i))
- || TREE_VIA_PROTECTED (TREE_VEC_ELT (binfos, i)))
- {
- nonprivate_method = 1;
- break;
- }
- if (nonprivate_method == 0)
- cp_warning ("all member functions in class `%T' are private", t);
- }
-
- /* Warn if all destructors are private (in which case this class is
- effectively unusable. */
- if (TYPE_HAS_DESTRUCTOR (t))
- {
- tree dtor = TREE_VEC_ELT (method_vec, 1);
-
- /* Wild parse errors can cause this to happen. */
- if (dtor == NULL_TREE)
- TYPE_HAS_DESTRUCTOR (t) = 0;
- else if (TREE_PRIVATE (dtor)
- && CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
- && DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE
- && warn_ctor_dtor_privacy)
- cp_warning ("`%#T' only defines a private destructor and has no friends",
- t);
- }
-
- /* Now for each member function (except for constructors and
- destructors), compute where member functions of the same
- name reside in base classes. */
- if (n_baseclasses != 0
- && TREE_VEC_LENGTH (method_vec) > 2)
- {
- int len = TREE_VEC_LENGTH (method_vec);
- tree baselink_vec = make_tree_vec (len);
- int any_links = 0;
- tree baselink_binfo = build_tree_list (NULL_TREE, TYPE_BINFO (t));
-
- for (i = 2; i < len; i++)
- {
- TREE_VEC_ELT (baselink_vec, i)
- = get_baselinks (baselink_binfo, t, DECL_NAME (TREE_VEC_ELT (method_vec, i)));
- if (TREE_VEC_ELT (baselink_vec, i) != 0)
- any_links = 1;
- }
- if (any_links != 0)
- CLASSTYPE_BASELINK_VEC (t) = baselink_vec;
- else
- obstack_free (current_obstack, baselink_vec);
- }
-
- return method_vec;
-}
-
-/* Emit error when a duplicate definition of a type is seen. Patch up. */
-
-void
-duplicate_tag_error (t)
- tree t;
-{
- cp_error ("redefinition of `%#T'", t);
- cp_error_at ("previous definition here", t);
-
- /* Pretend we haven't defined this type. */
-
- /* All of the component_decl's were TREE_CHAINed together in the parser.
- finish_struct_methods walks these chains and assembles all methods with
- the same base name into DECL_CHAINs. Now we don't need the parser chains
- anymore, so we unravel them. */
-
- /* This used to be in finish_struct, but it turns out that the
- TREE_CHAIN is used by dbxout_type_methods and perhaps some other
- things... */
- if (CLASSTYPE_METHOD_VEC (t))
- {
- tree method_vec = CLASSTYPE_METHOD_VEC (t);
- int i, len = TREE_VEC_LENGTH (method_vec);
- for (i = 0; i < len; i++)
- {
- tree unchain = TREE_VEC_ELT (method_vec, i);
- while (unchain != NULL_TREE)
- {
- TREE_CHAIN (unchain) = NULL_TREE;
- unchain = DECL_CHAIN (unchain);
- }
- }
- }
-
- if (TYPE_LANG_SPECIFIC (t))
- {
- tree as_list = CLASSTYPE_AS_LIST (t);
- tree binfo = TYPE_BINFO (t);
- tree binfo_as_list = CLASSTYPE_BINFO_AS_LIST (t);
- int interface_only = CLASSTYPE_INTERFACE_ONLY (t);
- int interface_unknown = CLASSTYPE_INTERFACE_UNKNOWN (t);
-
- bzero ((char *) TYPE_LANG_SPECIFIC (t), sizeof (struct lang_type));
- BINFO_BASETYPES(binfo) = NULL_TREE;
-
- CLASSTYPE_AS_LIST (t) = as_list;
- TYPE_BINFO (t) = binfo;
- CLASSTYPE_BINFO_AS_LIST (t) = binfo_as_list;
- CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
- CLASSTYPE_VBASE_SIZE (t) = integer_zero_node;
- TYPE_REDEFINED (t) = 1;
- }
- TYPE_SIZE (t) = NULL_TREE;
- TYPE_MODE (t) = VOIDmode;
- TYPE_FIELDS (t) = NULL_TREE;
- TYPE_METHODS (t) = NULL_TREE;
- TYPE_VFIELD (t) = NULL_TREE;
- TYPE_CONTEXT (t) = NULL_TREE;
-}
-
-/* finish up all new vtables. */
-
-static void
-finish_vtbls (binfo, do_self, t)
- tree binfo;
- int do_self;
- tree t;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- if (BINFO_NEW_VTABLE_MARKED (binfo))
- {
- tree decl, context;
-
- decl = BINFO_VTABLE (binfo);
- context = DECL_CONTEXT (decl);
- DECL_CONTEXT (decl) = 0;
- if (write_virtuals >= 0
- && DECL_INITIAL (decl) != BINFO_VIRTUALS (binfo))
- DECL_INITIAL (decl) = build_nt (CONSTRUCTOR, NULL_TREE,
- BINFO_VIRTUALS (binfo));
- cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0, 0);
- DECL_CONTEXT (decl) = context;
- }
- CLEAR_BINFO_NEW_VTABLE_MARKED (binfo);
- }
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable =
- i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (TREE_VIA_VIRTUAL (base_binfo))
- {
- base_binfo = binfo_member (BINFO_TYPE (base_binfo), CLASSTYPE_VBASECLASSES (t));
- }
- finish_vtbls (base_binfo, is_not_base_vtable, t);
- }
-}
-
-/* True if we should override the given BASE_FNDECL with the given
- FNDECL. */
-
-static int
-overrides (fndecl, base_fndecl)
- tree fndecl, base_fndecl;
-{
- /* Destructors have special names. */
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (base_fndecl)) &&
- DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl)))
- return 1;
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (base_fndecl)) ||
- DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl)))
- return 0;
- if (DECL_NAME (fndecl) == DECL_NAME (base_fndecl))
- {
- tree types, base_types;
-#if 0
- retypes = TREE_TYPE (TREE_TYPE (fndecl));
- base_retypes = TREE_TYPE (TREE_TYPE (base_fndecl));
-#endif
- types = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
- base_types = TYPE_ARG_TYPES (TREE_TYPE (base_fndecl));
- if ((TYPE_READONLY (TREE_TYPE (TREE_VALUE (base_types)))
- == TYPE_READONLY (TREE_TYPE (TREE_VALUE (types))))
- && compparms (TREE_CHAIN (base_types), TREE_CHAIN (types), 3))
- return 1;
- }
- return 0;
-}
-
-static tree
-get_class_offset_1 (parent, binfo, context, t, fndecl)
- tree parent, binfo, context, t, fndecl;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree rval = NULL_TREE;
-
- if (binfo == parent)
- return error_mark_node;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree nrval;
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- base_binfo = binfo_member (BINFO_TYPE (base_binfo),
- CLASSTYPE_VBASECLASSES (t));
- nrval = get_class_offset_1 (parent, base_binfo, context, t, fndecl);
- /* See if we have a new value */
- if (nrval && (nrval != error_mark_node || rval==0))
- {
- /* Only compare if we have two offsets */
- if (rval && rval != error_mark_node
- && ! tree_int_cst_equal (nrval, rval))
- {
- /* Only give error if the two offsets are different */
- error ("every virtual function must have a unique final overrider");
- cp_error (" found two (or more) `%T' class subobjects in `%T'", context, t);
- cp_error (" with virtual `%D' from virtual base class", fndecl);
- return rval;
- }
- rval = nrval;
- }
-
- if (rval && BINFO_TYPE (binfo) == context)
- {
- my_friendly_assert (rval == error_mark_node
- || tree_int_cst_equal (rval, BINFO_OFFSET (binfo)), 999);
- rval = BINFO_OFFSET (binfo);
- }
- }
- return rval;
-}
-
-/* Get the offset to the CONTEXT subobject that is related to the
- given BINFO. */
-
-static tree
-get_class_offset (context, t, binfo, fndecl)
- tree context, t, binfo, fndecl;
-{
- tree first_binfo = binfo;
- tree offset;
- int i;
-
- if (context == t)
- return integer_zero_node;
-
- if (BINFO_TYPE (binfo) == context)
- return BINFO_OFFSET (binfo);
-
- /* Check less derived binfos first. */
- while (BINFO_BASETYPES (binfo)
- && (i=CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo))) != -1)
- {
- tree binfos = BINFO_BASETYPES (binfo);
- binfo = TREE_VEC_ELT (binfos, i);
- if (BINFO_TYPE (binfo) == context)
- return BINFO_OFFSET (binfo);
- }
-
- /* Ok, not found in the less derived binfos, now check the more
- derived binfos. */
- offset = get_class_offset_1 (first_binfo, TYPE_BINFO (t), context, t, fndecl);
- if (offset==0 || TREE_CODE (offset) != INTEGER_CST)
- my_friendly_abort (999); /* we have to find it. */
- return offset;
-}
-
-/* Skip RTTI information at the front of the virtual list. */
-
-unsigned HOST_WIDE_INT
-skip_rtti_stuff (virtuals)
- tree *virtuals;
-{
- int n;
-
- n = 0;
- if (*virtuals)
- {
- /* We always reserve a slot for the offset/tdesc entry. */
- ++n;
- *virtuals = TREE_CHAIN (*virtuals);
- }
- if (flag_vtable_thunks && *virtuals)
- {
- /* The second slot is reserved for the tdesc pointer when thunks
- are used. */
- ++n;
- *virtuals = TREE_CHAIN (*virtuals);
- }
- return n;
-}
-
-static void
-modify_one_vtable (binfo, t, fndecl, pfn)
- tree binfo, t, fndecl, pfn;
-{
- tree virtuals = BINFO_VIRTUALS (binfo);
- unsigned HOST_WIDE_INT n;
-
- /* update rtti entry */
- if (flag_rtti)
- {
- if (binfo == TYPE_BINFO (t))
- {
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- build_vtable (TYPE_BINFO (DECL_CONTEXT (CLASSTYPE_VFIELD (t))), t);
- }
- else
- {
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- prepare_fresh_vtable (binfo, t);
- }
- }
- if (fndecl == NULL_TREE)
- return;
-
- n = skip_rtti_stuff (&virtuals);
-
- while (virtuals)
- {
- tree current_fndecl = TREE_VALUE (virtuals);
- current_fndecl = FNADDR_FROM_VTABLE_ENTRY (current_fndecl);
- current_fndecl = TREE_OPERAND (current_fndecl, 0);
- if (current_fndecl && overrides (fndecl, current_fndecl))
- {
- tree base_offset, offset;
- tree context = DECL_CLASS_CONTEXT (fndecl);
- tree vfield = CLASSTYPE_VFIELD (t);
- tree this_offset;
-
- offset = get_class_offset (context, t, binfo, fndecl);
-
- /* Find the right offset for the this pointer based on the
- base class we just found. We have to take into
- consideration the virtual base class pointers that we
- stick in before the virtual function table pointer.
-
- Also, we want just the delta between the most base class
- that we derived this vfield from and us. */
- base_offset = size_binop (PLUS_EXPR,
- get_derived_offset (binfo, DECL_CONTEXT (current_fndecl)),
- BINFO_OFFSET (binfo));
- this_offset = size_binop (MINUS_EXPR, offset, base_offset);
-
- /* Make sure we can modify the derived association with immunity. */
- if (TREE_USED (binfo))
- my_friendly_assert (0, 999);
-
- if (binfo == TYPE_BINFO (t))
- {
- /* In this case, it is *type*'s vtable we are modifying.
- We start with the approximation that it's vtable is that
- of the immediate base class. */
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t);
- }
- else
- {
- /* This is our very own copy of `basetype' to play with.
- Later, we will fill in all the virtual functions
- that override the virtual functions in these base classes
- which are not defined by the current type. */
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- prepare_fresh_vtable (binfo, t);
- }
-
-#ifdef NOTQUITE
- cp_warning ("in %D", DECL_NAME (BINFO_VTABLE (binfo)));
-#endif
- modify_vtable_entry (get_vtable_entry_n (BINFO_VIRTUALS (binfo), n),
- build_vtable_entry (this_offset, pfn),
- fndecl);
- }
- ++n;
- virtuals = TREE_CHAIN (virtuals);
- }
-}
-
-/* These are the ones that are not through virtual base classes. */
-
-static void
-modify_all_direct_vtables (binfo, do_self, t, fndecl, pfn)
- tree binfo;
- int do_self;
- tree t, fndecl, pfn;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- modify_one_vtable (binfo, t, fndecl, pfn);
- }
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable =
- i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (! TREE_VIA_VIRTUAL (base_binfo))
- modify_all_direct_vtables (base_binfo, is_not_base_vtable, t, fndecl, pfn);
- }
-}
-
-/* Fixup all the delta entries in this one vtable that need updating. */
-
-static void
-fixup_vtable_deltas1 (binfo, t)
- tree binfo, t;
-{
- tree virtuals = BINFO_VIRTUALS (binfo);
- unsigned HOST_WIDE_INT n;
-
- n = skip_rtti_stuff (&virtuals);
-
- while (virtuals)
- {
- tree fndecl = TREE_VALUE (virtuals);
- tree pfn = FNADDR_FROM_VTABLE_ENTRY (fndecl);
- tree delta = DELTA_FROM_VTABLE_ENTRY (fndecl);
- fndecl = TREE_OPERAND (pfn, 0);
- if (fndecl)
- {
- tree base_offset, offset;
- tree context = DECL_CLASS_CONTEXT (fndecl);
- tree vfield = CLASSTYPE_VFIELD (t);
- tree this_offset;
-
- offset = get_class_offset (context, t, binfo, fndecl);
-
- /* Find the right offset for the this pointer based on the
- base class we just found. We have to take into
- consideration the virtual base class pointers that we
- stick in before the virtual function table pointer.
-
- Also, we want just the delta between the most base class
- that we derived this vfield from and us. */
- base_offset = size_binop (PLUS_EXPR,
- get_derived_offset (binfo, DECL_CONTEXT (fndecl)),
- BINFO_OFFSET (binfo));
- this_offset = size_binop (MINUS_EXPR, offset, base_offset);
-
- if (! tree_int_cst_equal (this_offset, delta))
- {
- /* Make sure we can modify the derived association with immunity. */
- if (TREE_USED (binfo))
- my_friendly_assert (0, 999);
-
- if (binfo == TYPE_BINFO (t))
- {
- /* In this case, it is *type*'s vtable we are modifying.
- We start with the approximation that it's vtable is that
- of the immediate base class. */
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t);
- }
- else
- {
- /* This is our very own copy of `basetype' to play with.
- Later, we will fill in all the virtual functions
- that override the virtual functions in these base classes
- which are not defined by the current type. */
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- prepare_fresh_vtable (binfo, t);
- }
-
- modify_vtable_entry (get_vtable_entry_n (BINFO_VIRTUALS (binfo), n),
- build_vtable_entry (this_offset, pfn),
- fndecl);
- }
- }
- ++n;
- virtuals = TREE_CHAIN (virtuals);
- }
-}
-
-/* Fixup all the delta entries in all the direct vtables that need updating.
- This happens when we have non-overridden virtual functions from a
- virtual base class, that are at a different offset, in the new
- hierarchy, because the layout of the virtual bases has changed. */
-
-static void
-fixup_vtable_deltas (binfo, init_self, t)
- tree binfo;
- int init_self;
- tree t;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable =
- i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (! TREE_VIA_VIRTUAL (base_binfo))
- fixup_vtable_deltas (base_binfo, is_not_base_vtable, t);
- }
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (init_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- fixup_vtable_deltas1 (binfo, t);
- }
-}
-
-/* These are the ones that are through virtual base classes. */
-
-static void
-modify_all_indirect_vtables (binfo, do_self, via_virtual, t, fndecl, pfn)
- tree binfo;
- int do_self, via_virtual;
- tree t, fndecl, pfn;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && via_virtual && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- modify_one_vtable (binfo, t, fndecl, pfn);
- }
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable =
- i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (TREE_VIA_VIRTUAL (base_binfo))
- {
- via_virtual = 1;
- base_binfo = binfo_member (BINFO_TYPE (base_binfo), CLASSTYPE_VBASECLASSES (t));
- }
- modify_all_indirect_vtables (base_binfo, is_not_base_vtable, via_virtual, t, fndecl, pfn);
- }
-}
-
-static void
-modify_all_vtables (t, fndecl, vfn)
- tree t, fndecl, vfn;
-{
- /* Do these first, so that we will make use of any non-virtual class's
- vtable, over a virtual classes vtable. */
- modify_all_direct_vtables (TYPE_BINFO (t), 1, t, fndecl, vfn);
- if (TYPE_USES_VIRTUAL_BASECLASSES (t))
- modify_all_indirect_vtables (TYPE_BINFO (t), 1, 0, t, fndecl, vfn);
-}
-
-/* Here, we already know that they match in every respect.
- All we have to check is where they had their declarations. */
-
-static int
-strictly_overrides (fndecl1, fndecl2)
- tree fndecl1, fndecl2;
-{
- int distance = get_base_distance (DECL_CLASS_CONTEXT (fndecl2),
- DECL_CLASS_CONTEXT (fndecl1),
- 0, (tree *)0);
- if (distance == -2 || distance > 0)
- return 1;
- return 0;
-}
-
-/* Merge overrides for one vtable.
- If we want to merge in same function, we are fine.
- else
- if one has a DECL_CLASS_CONTEXT that is a parent of the
- other, than choose the more derived one
- else
- potentially ill-formed (see 10.3 [class.virtual])
- we have to check later to see if there was an
- override in this class. If there was ok, if not
- then it is ill-formed. (mrs)
-
- We take special care to reuse a vtable, if we can. */
-
-static void
-override_one_vtable (binfo, old, t)
- tree binfo, old, t;
-{
- tree virtuals = BINFO_VIRTUALS (binfo);
- tree old_virtuals = BINFO_VIRTUALS (old);
- enum { REUSE_NEW, REUSE_OLD, UNDECIDED, NEITHER } choose = UNDECIDED;
-
- /* If we have already committed to modifying it, then don't try and
- reuse another vtable. */
- if (BINFO_NEW_VTABLE_MARKED (binfo))
- choose = NEITHER;
-
- skip_rtti_stuff (&virtuals);
- skip_rtti_stuff (&old_virtuals);
-
- while (virtuals)
- {
- tree fndecl = TREE_VALUE (virtuals);
- tree old_fndecl = TREE_VALUE (old_virtuals);
- fndecl = FNADDR_FROM_VTABLE_ENTRY (fndecl);
- old_fndecl = FNADDR_FROM_VTABLE_ENTRY (old_fndecl);
- fndecl = TREE_OPERAND (fndecl, 0);
- old_fndecl = TREE_OPERAND (old_fndecl, 0);
- /* First check to see if they are the same. */
- if (DECL_ASSEMBLER_NAME (fndecl) == DECL_ASSEMBLER_NAME (old_fndecl))
- {
- /* No need to do anything. */
- }
- else if (strictly_overrides (fndecl, old_fndecl))
- {
- if (choose == UNDECIDED)
- choose = REUSE_NEW;
- else if (choose == REUSE_OLD)
- {
- choose = NEITHER;
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- {
- prepare_fresh_vtable (binfo, t);
- override_one_vtable (binfo, old, t);
- return;
- }
- }
- }
- else if (strictly_overrides (old_fndecl, fndecl))
- {
- if (choose == UNDECIDED)
- choose = REUSE_OLD;
- else if (choose == REUSE_NEW)
- {
- choose = NEITHER;
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- {
- prepare_fresh_vtable (binfo, t);
- override_one_vtable (binfo, old, t);
- return;
- }
- TREE_VALUE (virtuals) = TREE_VALUE (old_virtuals);
- }
- else if (choose == NEITHER)
- {
- TREE_VALUE (virtuals) = TREE_VALUE (old_virtuals);
- }
- }
- else
- {
- choose = NEITHER;
- if (! BINFO_NEW_VTABLE_MARKED (binfo))
- {
- prepare_fresh_vtable (binfo, t);
- override_one_vtable (binfo, old, t);
- return;
- }
- {
- /* This MUST be overridden, or the class is ill-formed. */
- /* For now, we just make it abstract. */
- tree fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0);
- tree vfn;
-
- fndecl = copy_node (fndecl);
- copy_lang_decl (fndecl);
- DECL_ABSTRACT_VIRTUAL_P (fndecl) = 1;
- /* Make sure we search for it later. */
- if (! CLASSTYPE_ABSTRACT_VIRTUALS (t))
- CLASSTYPE_ABSTRACT_VIRTUALS (t) = error_mark_node;
-
- vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fndecl);
- TREE_CONSTANT (vfn) = 1;
-
- /* We can use integer_zero_node, as we will will core dump
- if this is used anyway. */
- TREE_VALUE (virtuals) = build_vtable_entry (integer_zero_node, vfn);
- }
- }
- virtuals = TREE_CHAIN (virtuals);
- old_virtuals = TREE_CHAIN (old_virtuals);
- }
-
- /* Let's reuse the old vtable. */
- if (choose == REUSE_OLD)
- {
- BINFO_VTABLE (binfo) = BINFO_VTABLE (old);
- BINFO_VIRTUALS (binfo) = BINFO_VIRTUALS (old);
- }
-}
-
-/* Merge in overrides for virtual bases.
- BINFO is the hierarchy we want to modify, and OLD has the potential
- overrides. */
-
-static void
-merge_overrides (binfo, old, do_self, t)
- tree binfo, old;
- int do_self;
- tree t;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- tree old_binfos = BINFO_BASETYPES (old);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- override_one_vtable (binfo, old, t);
- }
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree old_base_binfo = TREE_VEC_ELT (old_binfos, i);
- int is_not_base_vtable =
- i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (! TREE_VIA_VIRTUAL (base_binfo))
- merge_overrides (base_binfo, old_base_binfo, is_not_base_vtable, t);
- }
-}
-
-/* Get the base virtual function declarations in T that are either
- overridden or hidden by FNDECL as a list. We set TREE_PURPOSE with
- the overrider/hider. */
-
-tree
-get_basefndecls (fndecl, t)
- tree fndecl, t;
-{
- tree methods = TYPE_METHODS (t);
- tree base_fndecls = NULL_TREE;
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- while (methods)
- {
- if (TREE_CODE (methods) == FUNCTION_DECL
- && DECL_VINDEX (methods) != NULL_TREE
- && DECL_NAME (fndecl) == DECL_NAME (methods))
- base_fndecls = temp_tree_cons (fndecl, methods, base_fndecls);
-
- methods = TREE_CHAIN (methods);
- }
-
- if (base_fndecls)
- return base_fndecls;
-
- for (i = 0; i < n_baseclasses; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree basetype = BINFO_TYPE (base_binfo);
-
- base_fndecls = chainon (get_basefndecls (fndecl, basetype),
- base_fndecls);
- }
-
- return base_fndecls;
-}
-
-/* Mark the functions that have been hidden with their overriders.
- Since we start out with all functions already marked with a hider,
- no need to mark functions that are just hidden. */
-
-static void
-mark_overriders (fndecl, base_fndecls)
- tree fndecl, base_fndecls;
-{
- while (base_fndecls)
- {
- if (overrides (TREE_VALUE (base_fndecls), fndecl))
- TREE_PURPOSE (base_fndecls) = fndecl;
-
- base_fndecls = TREE_CHAIN (base_fndecls);
- }
-}
-
-/* If this declaration supersedes the declaration of
- a method declared virtual in the base class, then
- mark this field as being virtual as well. */
-
-static void
-check_for_override (decl, ctype)
- tree decl, ctype;
-{
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (ctype));
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- int virtualp = DECL_VIRTUAL_P (decl);
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- if (TYPE_VIRTUAL_P (BINFO_TYPE (base_binfo))
- || flag_all_virtual == 1)
- {
- tree tmp = get_matching_virtual
- (base_binfo, decl,
- DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl)));
- if (tmp)
- {
- /* If this function overrides some virtual in some base
- class, then the function itself is also necessarily
- virtual, even if the user didn't explicitly say so. */
- DECL_VIRTUAL_P (decl) = 1;
-
- /* The TMP we really want is the one from the deepest
- baseclass on this path, taking care not to
- duplicate if we have already found it (via another
- path to its virtual baseclass. */
- if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE)
- {
- cp_error_at ("method `%D' may not be declared static",
- decl);
- cp_error_at ("(since `%D' declared virtual in base class.)",
- tmp);
- break;
- }
- virtualp = 1;
-
- {
- /* The argument types may have changed... */
- tree type = TREE_TYPE (decl);
- tree argtypes = TYPE_ARG_TYPES (type);
- tree base_variant = TREE_TYPE (TREE_VALUE (argtypes));
- tree raises = TYPE_RAISES_EXCEPTIONS (type);
-
- argtypes = commonparms (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (tmp))),
- TREE_CHAIN (argtypes));
- /* But the return type has not. */
- type = build_cplus_method_type (base_variant, TREE_TYPE (type), argtypes);
- if (raises)
- type = build_exception_variant (type, raises);
- TREE_TYPE (decl) = type;
- DECL_VINDEX (decl)
- = tree_cons (NULL_TREE, tmp, DECL_VINDEX (decl));
- }
- break;
- }
- }
- }
- if (virtualp)
- {
- if (DECL_VINDEX (decl) == NULL_TREE)
- DECL_VINDEX (decl) = error_mark_node;
- IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)) = 1;
- }
-}
-
-/* Warn about hidden virtual functions that are not overridden in t.
- We know that constructors and destructors don't apply. */
-
-void
-warn_hidden (t)
- tree t;
-{
- tree method_vec = CLASSTYPE_METHOD_VEC (t);
- int n_methods = method_vec ? TREE_VEC_LENGTH (method_vec) : 0;
- int i;
-
- /* We go through each separately named virtual function. */
- for (i = 2; i < n_methods; ++i)
- {
- tree fndecl = TREE_VEC_ELT (method_vec, i);
-
- tree base_fndecls = NULL_TREE;
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- if (DECL_VINDEX (fndecl) == NULL_TREE)
- continue;
-
- /* First we get a list of all possible functions that might be
- hidden from each base class. */
- for (i = 0; i < n_baseclasses; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree basetype = BINFO_TYPE (base_binfo);
-
- base_fndecls = chainon (get_basefndecls (fndecl, basetype),
- base_fndecls);
- }
-
- if (TREE_CHAIN (fndecl)
- && DECL_NAME (TREE_CHAIN (fndecl)) == DECL_NAME (fndecl))
- fndecl = TREE_CHAIN (fndecl);
- else
- fndecl = NULL_TREE;
-
- /* ...then mark up all the base functions with overriders, preferring
- overriders to hiders. */
- if (base_fndecls)
- while (fndecl)
- {
- mark_overriders (fndecl, base_fndecls);
-
- if (TREE_CHAIN (fndecl)
- && DECL_NAME (TREE_CHAIN (fndecl)) == DECL_NAME (fndecl))
- fndecl = TREE_CHAIN (fndecl);
- else
- fndecl = NULL_TREE;
- }
-
- /* Now give a warning for all base functions without overriders,
- as they are hidden. */
- while (base_fndecls)
- {
- if (! overrides (TREE_VALUE (base_fndecls),
- TREE_PURPOSE (base_fndecls)))
- {
- /* Here we know it is a hider, and no overrider exists. */
- cp_warning_at ("`%D' was hidden", TREE_VALUE (base_fndecls));
- cp_warning_at (" by `%D'", TREE_PURPOSE (base_fndecls));
- }
-
- base_fndecls = TREE_CHAIN (base_fndecls);
- }
- }
-}
-
-/* Check for things that are invalid. There are probably plenty of other
- things we should check for also. */
-
-static void
-finish_struct_anon (t)
- tree t;
-{
- tree field;
- for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
- {
- if (TREE_STATIC (field))
- continue;
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- if (DECL_NAME (field) == NULL_TREE
- && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
- {
- tree* uelt = &TYPE_FIELDS (TREE_TYPE (field));
- for (; *uelt; uelt = &TREE_CHAIN (*uelt))
- {
- if (TREE_CODE (*uelt) != FIELD_DECL)
- continue;
-
- if (TREE_PRIVATE (*uelt))
- cp_pedwarn_at ("private member `%#D' in anonymous union",
- *uelt);
- else if (TREE_PROTECTED (*uelt))
- cp_pedwarn_at ("protected member `%#D' in anonymous union",
- *uelt);
-
- TREE_PRIVATE (*uelt) = TREE_PRIVATE (field);
- TREE_PROTECTED (*uelt) = TREE_PROTECTED (field);
- }
- }
- }
-}
-
-extern int interface_only, interface_unknown;
-
-/* Create a RECORD_TYPE or UNION_TYPE node for a C struct or union declaration
- (or C++ class declaration).
-
- For C++, we must handle the building of derived classes.
- Also, C++ allows static class members. The way that this is
- handled is to keep the field name where it is (as the DECL_NAME
- of the field), and place the overloaded decl in the DECL_FIELD_BITPOS
- of the field. layout_record and layout_union will know about this.
-
- More C++ hair: inline functions have text in their
- DECL_PENDING_INLINE_INFO nodes which must somehow be parsed into
- meaningful tree structure. After the struct has been laid out, set
- things up so that this can happen.
-
- And still more: virtual functions. In the case of single inheritance,
- when a new virtual function is seen which redefines a virtual function
- from the base class, the new virtual function is placed into
- the virtual function table at exactly the same address that
- it had in the base class. When this is extended to multiple
- inheritance, the same thing happens, except that multiple virtual
- function tables must be maintained. The first virtual function
- table is treated in exactly the same way as in the case of single
- inheritance. Additional virtual function tables have different
- DELTAs, which tell how to adjust `this' to point to the right thing.
-
- LIST_OF_FIELDLISTS is just that. The elements of the list are
- TREE_LIST elements, whose TREE_PURPOSE field tells what access
- the list has, and the TREE_VALUE slot gives the actual fields.
-
- ATTRIBUTES is the set of decl attributes to be applied, if any.
-
- If flag_all_virtual == 1, then we lay all functions into
- the virtual function table, as though they were declared
- virtual. Constructors do not lay down in the virtual function table.
-
- If flag_all_virtual == 2, then we lay all functions into
- the virtual function table, such that virtual functions
- occupy a space by themselves, and then all functions
- of the class occupy a space by themselves. This is illustrated
- in the following diagram:
-
- class A; class B : A;
-
- Class A's vtbl: Class B's vtbl:
- --------------------------------------------------------------------
- | A's virtual functions| | B's virtual functions |
- | | | (may inherit some from A). |
- --------------------------------------------------------------------
- | All of A's functions | | All of A's functions |
- | (such as a->A::f). | | (such as b->A::f) |
- --------------------------------------------------------------------
- | B's new virtual functions |
- | (not defined in A.) |
- -------------------------------
- | All of B's functions |
- | (such as b->B::f) |
- -------------------------------
-
- this allows the program to make references to any function, virtual
- or otherwise in a type-consistent manner. */
-
-tree
-finish_struct_1 (t, warn_anon)
- tree t;
- int warn_anon;
-{
- int old;
- tree name = TYPE_IDENTIFIER (t);
- enum tree_code code = TREE_CODE (t);
- tree fields = TYPE_FIELDS (t);
- tree fn_fields = TYPE_METHODS (t);
- tree x, last_x, method_vec;
- int all_virtual;
- int has_virtual;
- int max_has_virtual;
- tree pending_virtuals = NULL_TREE;
- tree abstract_virtuals = NULL_TREE;
- tree vfield;
- tree vfields;
- int cant_have_default_ctor;
- int cant_have_const_ctor;
- int no_const_asn_ref;
-
- /* The index of the first base class which has virtual
- functions. Only applied to non-virtual baseclasses. */
- int first_vfn_base_index;
-
- int n_baseclasses;
- int any_default_members = 0;
- int const_sans_init = 0;
- int ref_sans_init = 0;
- int nonprivate_method = 0;
- tree t_binfo = TYPE_BINFO (t);
- tree access_decls = NULL_TREE;
- int aggregate = 1;
- int empty = 1;
- int has_pointers = 0;
-
- if (warn_anon && code != UNION_TYPE && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- pedwarn ("anonymous class type not used to declare any objects");
-
- if (TYPE_SIZE (t))
- {
- if (IS_AGGR_TYPE (t))
- cp_error ("redefinition of `%#T'", t);
- else
- my_friendly_abort (172);
- popclass (0);
- return t;
- }
-
- GNU_xref_decl (current_function_decl, t);
-
- /* If this type was previously laid out as a forward reference,
- make sure we lay it out again. */
-
- TYPE_SIZE (t) = NULL_TREE;
- CLASSTYPE_GOT_SEMICOLON (t) = 0;
-
-#if 0
- /* This is in general too late to do this. I moved the main case up to
- left_curly, what else needs to move? */
- if (! IS_SIGNATURE (t))
- {
- my_friendly_assert (CLASSTYPE_INTERFACE_ONLY (t) == interface_only, 999);
- my_friendly_assert (CLASSTYPE_INTERFACE_KNOWN (t) == ! interface_unknown, 999);
- }
-#endif
-
-#if 0
- if (flag_rtti)
- build_t_desc (t, 0);
-#endif
-
- TYPE_BINFO (t) = NULL_TREE;
-
- old = suspend_momentary ();
-
- /* Install struct as DECL_FIELD_CONTEXT of each field decl.
- Also process specified field sizes.
- Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
- The specified size is found in the DECL_INITIAL.
- Store 0 there, except for ": 0" fields (so we can find them
- and delete them, below). */
-
- if (t_binfo && BINFO_BASETYPES (t_binfo))
- n_baseclasses = TREE_VEC_LENGTH (BINFO_BASETYPES (t_binfo));
- else
- n_baseclasses = 0;
-
- if (n_baseclasses > 0)
- {
- struct base_info base_info;
-
- /* If using multiple inheritance, this may cause variants of our
- basetypes to be used (instead of their canonical forms). */
- tree vf = layout_basetypes (t, BINFO_BASETYPES (t_binfo));
- last_x = tree_last (vf);
- fields = chainon (vf, fields);
-
- first_vfn_base_index = finish_base_struct (t, &base_info, t_binfo);
- /* Remember where we got our vfield from. */
- CLASSTYPE_VFIELD_PARENT (t) = first_vfn_base_index;
- has_virtual = base_info.has_virtual;
- max_has_virtual = base_info.max_has_virtual;
- CLASSTYPE_N_SUPERCLASSES (t) += base_info.n_ancestors;
- vfield = base_info.vfield;
- vfields = base_info.vfields;
- CLASSTYPE_RTTI (t) = base_info.rtti;
- cant_have_default_ctor = base_info.cant_have_default_ctor;
- cant_have_const_ctor = base_info.cant_have_const_ctor;
- no_const_asn_ref = base_info.no_const_asn_ref;
- n_baseclasses = TREE_VEC_LENGTH (BINFO_BASETYPES (t_binfo));
- aggregate = 0;
- }
- else
- {
- first_vfn_base_index = -1;
- has_virtual = 0;
- max_has_virtual = has_virtual;
- vfield = NULL_TREE;
- vfields = NULL_TREE;
- CLASSTYPE_RTTI (t) = NULL_TREE;
- last_x = NULL_TREE;
- cant_have_default_ctor = 0;
- cant_have_const_ctor = 0;
- no_const_asn_ref = 0;
- }
-
-#if 0
- /* Both of these should be done before now. */
- if (write_virtuals == 3 && CLASSTYPE_INTERFACE_KNOWN (t)
- && ! IS_SIGNATURE (t))
- {
- my_friendly_assert (CLASSTYPE_INTERFACE_ONLY (t) == interface_only, 999);
- my_friendly_assert (CLASSTYPE_VTABLE_NEEDS_WRITING (t) == ! interface_only, 999);
- }
-#endif
-
- /* The three of these are approximations which may later be
- modified. Needed at this point to make add_virtual_function
- and modify_vtable_entries work. */
- TREE_CHAIN (t_binfo) = TYPE_BINFO (t);
- TYPE_BINFO (t) = t_binfo;
- CLASSTYPE_VFIELDS (t) = vfields;
- CLASSTYPE_VFIELD (t) = vfield;
-
- if (IS_SIGNATURE (t))
- all_virtual = 0;
- else if (flag_all_virtual == 1 && TYPE_OVERLOADS_METHOD_CALL_EXPR (t))
- all_virtual = 1;
- else
- all_virtual = 0;
-
- for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x))
- {
- GNU_xref_member (current_class_name, x);
-
- nonprivate_method |= ! TREE_PRIVATE (x);
-
- /* If this was an evil function, don't keep it in class. */
- if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (x)))
- continue;
-
- DECL_CLASS_CONTEXT (x) = t;
-
- /* Do both of these, even though they're in the same union;
- if the insn `r' member and the size `i' member are
- different sizes, as on the alpha, the larger of the two
- will end up with garbage in it. */
- DECL_SAVED_INSNS (x) = NULL_RTX;
- DECL_FIELD_SIZE (x) = 0;
-
- check_for_override (x, t);
- if (DECL_ABSTRACT_VIRTUAL_P (x) && ! DECL_VINDEX (x))
- cp_error_at ("initializer specified for non-virtual method `%D'", x);
-
- /* The name of the field is the original field name
- Save this in auxiliary field for later overloading. */
- if (DECL_VINDEX (x)
- || (all_virtual == 1 && ! DECL_CONSTRUCTOR_P (x)))
- {
- pending_virtuals = add_virtual_function (pending_virtuals,
- &has_virtual, x, t);
- if (DECL_ABSTRACT_VIRTUAL_P (x))
- abstract_virtuals = tree_cons (NULL_TREE, x, abstract_virtuals);
-#if 0
- /* XXX Why did I comment this out? (jason) */
- else
- TREE_USED (x) = 1;
-#endif
- }
- }
-
- for (x = TYPE_FIELDS (t); x; x = TREE_CHAIN (x))
- {
- GNU_xref_member (current_class_name, x);
-
- if (TREE_CODE (x) == FIELD_DECL)
- {
- DECL_PACKED (x) |= TYPE_PACKED (t);
- empty = 0;
- }
-
- /* Handle access declarations. */
- if (TREE_CODE (x) == USING_DECL)
- {
- tree ctype = DECL_INITIAL (x);
- tree sname = DECL_NAME (x);
- tree access
- = TREE_PRIVATE (x) ? access_private_node :
- TREE_PROTECTED (x) ? access_protected_node : access_public_node;
- tree fdecl, binfo;
-
- if (last_x)
- TREE_CHAIN (last_x) = TREE_CHAIN (x);
- else
- fields = TREE_CHAIN (x);
-
- binfo = binfo_or_else (ctype, t);
- if (! binfo)
- continue;
-
- if (sname == constructor_name (ctype)
- || sname == constructor_name_full (ctype))
- cp_error_at ("using-declaration for constructor", x);
-
- fdecl = lookup_field (binfo, sname, 0, 0);
- if (! fdecl)
- fdecl = lookup_fnfields (binfo, sname, 0);
-
- if (fdecl)
- access_decls = tree_cons (access, fdecl, access_decls);
- else
- cp_error_at ("no members matching `%D' in `%#T'", x, ctype);
- continue;
- }
-
- last_x = x;
-
- if (TREE_CODE (x) == TYPE_DECL)
- continue;
-
- /* If we've gotten this far, it's a data member, possibly static,
- or an enumerator. */
-
- DECL_FIELD_CONTEXT (x) = t;
-
- /* ``A local class cannot have static data members.'' ARM 9.4 */
- if (current_function_decl && TREE_STATIC (x))
- cp_error_at ("field `%D' in local class cannot be static", x);
-
- /* Perform error checking that did not get done in
- grokdeclarator. */
- if (TREE_CODE (TREE_TYPE (x)) == FUNCTION_TYPE)
- {
- cp_error_at ("field `%D' invalidly declared function type",
- x);
- TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));
- }
- else if (TREE_CODE (TREE_TYPE (x)) == METHOD_TYPE)
- {
- cp_error_at ("field `%D' invalidly declared method type", x);
- TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));
- }
- else if (TREE_CODE (TREE_TYPE (x)) == OFFSET_TYPE)
- {
- cp_error_at ("field `%D' invalidly declared offset type", x);
- TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x));
- }
-
-#if 0
- if (DECL_NAME (x) == constructor_name (t))
- cant_have_default_ctor = 1;
-#endif
-
- if (TREE_TYPE (x) == error_mark_node)
- continue;
-
- DECL_SAVED_INSNS (x) = NULL_RTX;
- DECL_FIELD_SIZE (x) = 0;
-
- /* When this goes into scope, it will be a non-local reference. */
- DECL_NONLOCAL (x) = 1;
-
- if (TREE_CODE (x) == CONST_DECL)
- continue;
-
- if (TREE_CODE (x) == VAR_DECL)
- {
- if (TREE_CODE (t) == UNION_TYPE)
- /* Unions cannot have static members. */
- cp_error_at ("field `%D' declared static in union", x);
-
- continue;
- }
-
- /* Now it can only be a FIELD_DECL. */
-
- if (TREE_PRIVATE (x) || TREE_PROTECTED (x))
- aggregate = 0;
-
- /* If this is of reference type, check if it needs an init.
- Also do a little ANSI jig if necessary. */
- if (TREE_CODE (TREE_TYPE (x)) == REFERENCE_TYPE)
- {
- if (DECL_INITIAL (x) == NULL_TREE)
- ref_sans_init = 1;
-
- /* ARM $12.6.2: [A member initializer list] (or, for an
- aggregate, initialization by a brace-enclosed list) is the
- only way to initialize nonstatic const and reference
- members. */
- cant_have_default_ctor = 1;
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
-
- if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings)
- {
- if (DECL_NAME (x))
- cp_warning_at ("non-static reference `%#D' in class without a constructor", x);
- else
- cp_warning_at ("non-static reference in class without a constructor", x);
- }
- }
-
- if (TREE_CODE (TREE_TYPE (x)) == POINTER_TYPE)
- has_pointers = 1;
-
- /* If any field is const, the structure type is pseudo-const. */
- if (TREE_READONLY (x))
- {
- C_TYPE_FIELDS_READONLY (t) = 1;
- if (DECL_INITIAL (x) == NULL_TREE)
- const_sans_init = 1;
-
- /* ARM $12.6.2: [A member initializer list] (or, for an
- aggregate, initialization by a brace-enclosed list) is the
- only way to initialize nonstatic const and reference
- members. */
- cant_have_default_ctor = 1;
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
-
- if (! TYPE_HAS_CONSTRUCTOR (t) && !IS_SIGNATURE (t)
- && extra_warnings)
- {
- if (DECL_NAME (x))
- cp_warning_at ("non-static const member `%#D' in class without a constructor", x);
- else
- cp_warning_at ("non-static const member in class without a constructor", x);
- }
- }
- else
- {
- /* A field that is pseudo-const makes the structure
- likewise. */
- tree t1 = TREE_TYPE (x);
- while (TREE_CODE (t1) == ARRAY_TYPE)
- t1 = TREE_TYPE (t1);
- if (IS_AGGR_TYPE (t1))
- {
- if (C_TYPE_FIELDS_READONLY (t1))
- C_TYPE_FIELDS_READONLY (t) = 1;
- if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (t1))
- const_sans_init = 1;
- }
- }
-
- /* We set DECL_BIT_FIELD tentatively in grokbitfield.
- If the type and width are valid, we'll keep it set.
- Otherwise, the flag is cleared. */
- if (DECL_BIT_FIELD (x))
- {
- DECL_BIT_FIELD (x) = 0;
- /* Invalid bit-field size done by grokfield. */
- /* Detect invalid bit-field type. */
- if (DECL_INITIAL (x)
- && ! INTEGRAL_TYPE_P (TREE_TYPE (x)))
- {
- cp_error_at ("bit-field `%#D' with non-integral type", x);
- DECL_INITIAL (x) = NULL;
- }
-
- /* Detect and ignore out of range field width. */
- if (DECL_INITIAL (x))
- {
- tree w = DECL_INITIAL (x);
- register int width;
-
- /* Avoid the non_lvalue wrapper added by fold for PLUS_EXPRs. */
- STRIP_NOPS (w);
-
- /* detect invalid field size. */
- if (TREE_CODE (w) == CONST_DECL)
- w = DECL_INITIAL (w);
- else if (TREE_READONLY_DECL_P (w))
- w = decl_constant_value (w);
-
- if (TREE_CODE (w) != INTEGER_CST)
- {
- cp_error_at ("bit-field `%D' width not an integer constant",
- x);
- DECL_INITIAL (x) = NULL_TREE;
- }
- else if (width = TREE_INT_CST_LOW (w),
- width < 0)
- {
- DECL_INITIAL (x) = NULL;
- cp_error_at ("negative width in bit-field `%D'", x);
- }
- else if (width == 0 && DECL_NAME (x) != 0)
- {
- DECL_INITIAL (x) = NULL;
- cp_error_at ("zero width for bit-field `%D'", x);
- }
- else if (width
- > TYPE_PRECISION (long_long_unsigned_type_node))
- {
- /* The backend will dump if you try to use something
- too big; avoid that. */
- DECL_INITIAL (x) = NULL;
- sorry ("bit-fields larger than %d bits",
- TYPE_PRECISION (long_long_unsigned_type_node));
- cp_error_at (" in declaration of `%D'", x);
- }
- else if (width > TYPE_PRECISION (TREE_TYPE (x))
- && TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE)
- {
- cp_warning_at ("width of `%D' exceeds its type", x);
- }
- else if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE
- && ((min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)),
- TREE_UNSIGNED (TREE_TYPE (x))) > width)
- || (min_precision (TYPE_MAX_VALUE (TREE_TYPE (x)),
- TREE_UNSIGNED (TREE_TYPE (x))) > width)))
- {
- cp_warning_at ("`%D' is too small to hold all values of `%#T'",
- x, TREE_TYPE (x));
- }
-
- if (DECL_INITIAL (x) == NULL_TREE)
- ;
- else if (width == 0)
- {
-#ifdef EMPTY_FIELD_BOUNDARY
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x), EMPTY_FIELD_BOUNDARY);
-#endif
-#ifdef PCC_BITFIELD_TYPE_MATTERS
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x),
- TYPE_ALIGN (TREE_TYPE (x)));
-#endif
- }
- else
- {
- DECL_INITIAL (x) = NULL_TREE;
- DECL_FIELD_SIZE (x) = width;
- DECL_BIT_FIELD (x) = 1;
- }
- }
- else
- /* Non-bit-fields are aligned for their type. */
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x), TYPE_ALIGN (TREE_TYPE (x)));
- }
- else
- {
- tree type = TREE_TYPE (x);
-
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
-
- if (TYPE_LANG_SPECIFIC (type) && ! ANON_UNION_P (x)
- && ! TYPE_PTRMEMFUNC_P (type))
- {
- /* Never let anything with uninheritable virtuals
- make it through without complaint. */
- if (CLASSTYPE_ABSTRACT_VIRTUALS (type))
- abstract_virtuals_error (x, type);
-
- /* Don't let signatures make it through either. */
- if (IS_SIGNATURE (type))
- signature_error (x, type);
-
- if (code == UNION_TYPE)
- {
- char *fie = NULL;
- if (TYPE_NEEDS_CONSTRUCTING (type))
- fie = "constructor";
- else if (TYPE_NEEDS_DESTRUCTOR (type))
- fie = "destructor";
- else if (TYPE_HAS_REAL_ASSIGNMENT (type))
- fie = "assignment operator";
- if (fie)
- cp_error_at ("member `%#D' with %s not allowed in union", x,
- fie);
- }
- else
- {
- TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (type);
- TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_NEEDS_DESTRUCTOR (type);
- TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (type);
- TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (type);
- }
-
- if (!TYPE_HAS_CONST_INIT_REF (type))
- cant_have_const_ctor = 1;
-
- if (!TYPE_HAS_CONST_ASSIGN_REF (type))
- no_const_asn_ref = 1;
-
- if (TYPE_HAS_CONSTRUCTOR (type)
- && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
- {
- cant_have_default_ctor = 1;
-#if 0
- /* This is wrong for aggregates. */
- if (! TYPE_HAS_CONSTRUCTOR (t))
- {
- if (DECL_NAME (x))
- cp_pedwarn_at ("member `%#D' with only non-default constructor", x);
- else
- cp_pedwarn_at ("member with only non-default constructor", x);
- cp_pedwarn_at ("in class without a constructor",
- x);
- }
-#endif
- }
- }
- if (DECL_INITIAL (x) != NULL_TREE)
- {
- /* `build_class_init_list' does not recognize
- non-FIELD_DECLs. */
- if (code == UNION_TYPE && any_default_members != 0)
- cp_error_at ("multiple fields in union `%T' initialized");
- any_default_members = 1;
- }
- }
- }
-
- /* If this type has any constant members which did not come
- with their own initialization, mark that fact here. It is
- not an error here, since such types can be saved either by their
- constructors, or by fortuitous initialization. */
- CLASSTYPE_READONLY_FIELDS_NEED_INIT (t) = const_sans_init;
- CLASSTYPE_REF_FIELDS_NEED_INIT (t) = ref_sans_init;
- CLASSTYPE_ABSTRACT_VIRTUALS (t) = abstract_virtuals;
-
- /* Synthesize any needed methods. Note that methods will be synthesized
- for anonymous unions; grok_x_components undoes that. */
-
- if (! fn_fields)
- nonprivate_method = 1;
-
- if (TYPE_NEEDS_DESTRUCTOR (t) && !TYPE_HAS_DESTRUCTOR (t)
- && !IS_SIGNATURE (t))
- {
- /* Here we must cons up a destructor on the fly. */
- tree dtor = cons_up_default_function (t, name, 0);
- check_for_override (dtor, t);
-
- /* If we couldn't make it work, then pretend we didn't need it. */
- if (dtor == void_type_node)
- TYPE_NEEDS_DESTRUCTOR (t) = 0;
- else
- {
- /* Link dtor onto end of fn_fields. */
-
- TREE_CHAIN (dtor) = fn_fields;
- fn_fields = dtor;
-
- if (DECL_VINDEX (dtor))
- pending_virtuals = add_virtual_function (pending_virtuals,
- &has_virtual, dtor, t);
- nonprivate_method = 1;
- }
- }
-
- /* Effective C++ rule 11. */
- if (has_pointers && extra_warnings
- && ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
- {
- cp_warning ("`%#T' has pointer data members", t);
-
- if (! TYPE_HAS_INIT_REF (t))
- {
- cp_warning (" but does not override `%T(const %T&)'", t, t);
- if (! TYPE_HAS_ASSIGN_REF (t))
- cp_warning (" or `operator=(const %T&)'", t);
- }
- else if (! TYPE_HAS_ASSIGN_REF (t))
- cp_warning (" but does not override `operator=(const %T&)'", t);
- }
-
- TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_HAS_DESTRUCTOR (t);
-
- TYPE_HAS_COMPLEX_INIT_REF (t)
- |= (TYPE_HAS_INIT_REF (t) || TYPE_USES_VIRTUAL_BASECLASSES (t)
- || has_virtual || any_default_members);
- TYPE_NEEDS_CONSTRUCTING (t)
- |= (TYPE_HAS_CONSTRUCTOR (t) || TYPE_USES_VIRTUAL_BASECLASSES (t)
- || has_virtual || any_default_members);
- if (! IS_SIGNATURE (t))
- CLASSTYPE_NON_AGGREGATE (t)
- = ! aggregate || has_virtual || TYPE_HAS_CONSTRUCTOR (t);
-
- /* ARM $12.1: A default constructor will be generated for a class X
- only if no constructor has been declared for class X. So we
- check TYPE_HAS_CONSTRUCTOR also, to make sure we don't generate
- one if they declared a constructor in this class. */
- if (! TYPE_HAS_CONSTRUCTOR (t) && ! cant_have_default_ctor
- && ! IS_SIGNATURE (t))
- {
- tree default_fn = cons_up_default_function (t, name, 2);
- TREE_CHAIN (default_fn) = fn_fields;
- fn_fields = default_fn;
- }
-
- /* Create default copy constructor, if needed. */
- if (! TYPE_HAS_INIT_REF (t) && ! IS_SIGNATURE (t))
- {
- /* ARM 12.18: You get either X(X&) or X(const X&), but
- not both. --Chip */
- tree default_fn = cons_up_default_function (t, name,
- 3 + cant_have_const_ctor);
- TREE_CHAIN (default_fn) = fn_fields;
- fn_fields = default_fn;
- }
-
- TYPE_HAS_REAL_ASSIGNMENT (t) |= TYPE_HAS_ASSIGNMENT (t);
- TYPE_HAS_REAL_ASSIGN_REF (t) |= TYPE_HAS_ASSIGN_REF (t);
- TYPE_HAS_COMPLEX_ASSIGN_REF (t)
- |= TYPE_HAS_ASSIGN_REF (t) || TYPE_USES_VIRTUAL_BASECLASSES (t);
-
- if (! TYPE_HAS_ASSIGN_REF (t) && ! IS_SIGNATURE (t))
- {
- tree default_fn = cons_up_default_function (t, name,
- 5 + no_const_asn_ref);
- TREE_CHAIN (default_fn) = fn_fields;
- fn_fields = default_fn;
- }
-
- if (fn_fields)
- {
- TYPE_METHODS (t) = fn_fields;
- method_vec = finish_struct_methods (t, fn_fields, nonprivate_method);
-
- if (TYPE_HAS_CONSTRUCTOR (t)
- && CLASSTYPE_FRIEND_CLASSES (t) == NULL_TREE
- && DECL_FRIENDLIST (TYPE_MAIN_DECL (t)) == NULL_TREE)
- {
- int nonprivate_ctor = 0;
- tree ctor;
-
- for (ctor = TREE_VEC_ELT (method_vec, 0);
- ctor;
- ctor = DECL_CHAIN (ctor))
- if (! TREE_PRIVATE (ctor))
- {
- nonprivate_ctor = 1;
- break;
- }
-
- if (nonprivate_ctor == 0 && warn_ctor_dtor_privacy)
- cp_warning ("`%#T' only defines private constructors and has no friends",
- t);
- }
- }
- else
- {
- method_vec = 0;
-
- /* Just in case these got accidentally
- filled in by syntax errors. */
- TYPE_HAS_CONSTRUCTOR (t) = 0;
- TYPE_HAS_DESTRUCTOR (t) = 0;
- }
-
- {
- int n_methods = method_vec ? TREE_VEC_LENGTH (method_vec) : 0;
-
- for (access_decls = nreverse (access_decls); access_decls;
- access_decls = TREE_CHAIN (access_decls))
- {
- tree fdecl = TREE_VALUE (access_decls);
- tree flist = NULL_TREE;
- tree name;
- tree access = TREE_PURPOSE (access_decls);
- int i = 2;
- tree tmp;
-
- if (TREE_CODE (fdecl) == TREE_LIST)
- {
- flist = fdecl;
- fdecl = TREE_VALUE (flist);
- }
-
- name = DECL_NAME (fdecl);
-
- for (; i < n_methods; i++)
- if (DECL_NAME (TREE_VEC_ELT (method_vec, i)) == name)
- {
- cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
- cp_error_at (" because of local method `%#D' with same name",
- TREE_VEC_ELT (method_vec, i));
- fdecl = NULL_TREE;
- break;
- }
-
- if (! fdecl)
- continue;
-
- for (tmp = fields; tmp; tmp = TREE_CHAIN (tmp))
- if (DECL_NAME (tmp) == name)
- {
- cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t);
- cp_error_at (" because of local field `%#D' with same name", tmp);
- fdecl = NULL_TREE;
- break;
- }
-
- if (!fdecl)
- continue;
-
- /* Make type T see field decl FDECL with access ACCESS.*/
- if (flist)
- {
- fdecl = TREE_VALUE (flist);
- while (fdecl)
- {
- if (alter_access (t, fdecl, access) == 0)
- break;
- fdecl = DECL_CHAIN (fdecl);
- }
- }
- else
- alter_access (t, fdecl, access);
- }
-
- }
-
- if (vfield == NULL_TREE && has_virtual)
- {
- /* We build this decl with ptr_type_node, and
- change the type when we know what it should be. */
- vfield = build_lang_field_decl (FIELD_DECL, get_vfield_name (t),
- ptr_type_node);
- /* If you change any of the below, take a look at all the
- other VFIELD_BASEs and VTABLE_BASEs in the code, and change
- them too. */
- DECL_ASSEMBLER_NAME (vfield) = get_identifier (VFIELD_BASE);
- CLASSTYPE_VFIELD (t) = vfield;
- DECL_VIRTUAL_P (vfield) = 1;
- DECL_ARTIFICIAL (vfield) = 1;
- DECL_FIELD_CONTEXT (vfield) = t;
- DECL_CLASS_CONTEXT (vfield) = t;
- DECL_FCONTEXT (vfield) = t;
- DECL_SAVED_INSNS (vfield) = NULL_RTX;
- DECL_FIELD_SIZE (vfield) = 0;
- DECL_ALIGN (vfield) = TYPE_ALIGN (ptr_type_node);
-#if 0
- /* This is more efficient, but breaks binary compatibility, turn
- it on sometime when we don't care. If we turn it on, we also
- have to enable the code in dfs_init_vbase_pointers. */
- /* vfield is always first entry in structure. */
- TREE_CHAIN (vfield) = fields;
- fields = vfield;
-#else
- if (last_x)
- {
- my_friendly_assert (TREE_CHAIN (last_x) == NULL_TREE, 175);
- TREE_CHAIN (last_x) = vfield;
- last_x = vfield;
- }
- else
- fields = vfield;
-#endif
- empty = 0;
- vfields = chainon (vfields, CLASSTYPE_AS_LIST (t));
- }
-
- /* Now DECL_INITIAL is null on all members except for zero-width bit-fields.
- And they have already done their work.
-
- C++: maybe we will support default field initialization some day... */
-
- /* Delete all zero-width bit-fields from the front of the fieldlist */
- while (fields && DECL_BIT_FIELD (fields)
- && DECL_INITIAL (fields))
- fields = TREE_CHAIN (fields);
- /* Delete all such fields from the rest of the fields. */
- for (x = fields; x;)
- {
- if (TREE_CHAIN (x) && DECL_BIT_FIELD (TREE_CHAIN (x))
- && DECL_INITIAL (TREE_CHAIN (x)))
- TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x));
- else
- x = TREE_CHAIN (x);
- }
- /* Delete all duplicate fields from the fields */
- delete_duplicate_fields (fields);
-
- /* Catch function/field name conflict. We don't need to do this for a
- signature, since it can only contain the fields constructed in
- append_signature_fields. */
- if (! IS_SIGNATURE (t))
- {
- int n_methods = method_vec ? TREE_VEC_LENGTH (method_vec) : 0;
- for (x = fields; x; x = TREE_CHAIN (x))
- {
- tree name = DECL_NAME (x);
- int i = 2;
-
- if (TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x))
- continue;
-
- for (; i < n_methods; ++i)
- if (DECL_NAME (TREE_VEC_ELT (method_vec, i)) == name)
- {
- cp_error_at ("data member `%#D' conflicts with", x);
- cp_error_at ("function member `%#D'",
- TREE_VEC_ELT (method_vec, i));
- break;
- }
- }
- }
-
- /* Now we have the final fieldlist for the data fields. Record it,
- then lay out the structure or union (including the fields). */
-
- TYPE_FIELDS (t) = fields;
-
- /* Pass layout information about base classes to layout_type, if any. */
- if (n_baseclasses)
- {
- tree pseudo_basetype = TREE_TYPE (base_layout_decl);
-
- TREE_CHAIN (base_layout_decl) = TYPE_FIELDS (t);
- TYPE_FIELDS (t) = base_layout_decl;
-
- TYPE_SIZE (pseudo_basetype) = CLASSTYPE_SIZE (t);
- TYPE_MODE (pseudo_basetype) = TYPE_MODE (t);
- TYPE_ALIGN (pseudo_basetype) = CLASSTYPE_ALIGN (t);
- DECL_ALIGN (base_layout_decl) = TYPE_ALIGN (pseudo_basetype);
- /* Don't re-use old size. */
- DECL_SIZE (base_layout_decl) = NULL_TREE;
- }
- else if (empty)
- {
- /* C++: do not let empty structures exist. */
- tree decl = build_lang_field_decl
- (FIELD_DECL, NULL_TREE, char_type_node);
- TREE_CHAIN (decl) = TYPE_FIELDS (t);
- TYPE_FIELDS (t) = decl;
- }
-
- layout_type (t);
-
- finish_struct_anon (t);
-
- if (n_baseclasses || empty)
- TYPE_FIELDS (t) = TREE_CHAIN (TYPE_FIELDS (t));
-
- /* Set the TYPE_DECL for this type to contain the right
- value for DECL_OFFSET, so that we can use it as part
- of a COMPONENT_REF for multiple inheritance. */
-
- layout_decl (TYPE_MAIN_DECL (t), 0);
-
- /* Now fix up any virtual base class types that we left lying
- around. We must get these done before we try to lay out the
- virtual function table. */
- pending_hard_virtuals = nreverse (pending_hard_virtuals);
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (t))
- {
- tree vbases;
-
- max_has_virtual = layout_vbasetypes (t, max_has_virtual);
- vbases = CLASSTYPE_VBASECLASSES (t);
- CLASSTYPE_N_VBASECLASSES (t) = list_length (vbases);
-
- {
- /* Now fixup overrides of all functions in vtables from all
- direct or indirect virtual base classes. */
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baseclasses; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree basetype = BINFO_TYPE (base_binfo);
- tree vbases;
-
- vbases = CLASSTYPE_VBASECLASSES (basetype);
- while (vbases)
- {
- merge_overrides (binfo_member (BINFO_TYPE (vbases),
- CLASSTYPE_VBASECLASSES (t)),
- vbases, 1, t);
- vbases = TREE_CHAIN (vbases);
- }
- }
- }
- }
-
- /* Set up the DECL_FIELD_BITPOS of the vfield if we need to, as we
- might need to know it for setting up the offsets in the vtable
- (or in thunks) below. */
- if (vfield != NULL_TREE
- && DECL_FIELD_CONTEXT (vfield) != t)
- {
- tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
- tree offset = BINFO_OFFSET (binfo);
-
- vfield = copy_node (vfield);
- copy_lang_decl (vfield);
-
- if (! integer_zerop (offset))
- offset = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT));
- DECL_FIELD_CONTEXT (vfield) = t;
- DECL_CLASS_CONTEXT (vfield) = t;
- DECL_FIELD_BITPOS (vfield)
- = size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield));
- CLASSTYPE_VFIELD (t) = vfield;
- }
-
-#ifdef NOTQUITE
- cp_warning ("Doing hard virtuals for %T...", t);
-#endif
-
- if (has_virtual > max_has_virtual)
- max_has_virtual = has_virtual;
- if (max_has_virtual > 0)
- TYPE_VIRTUAL_P (t) = 1;
-
- if (flag_rtti && TYPE_VIRTUAL_P (t) && !pending_hard_virtuals)
- modify_all_vtables (t, NULL_TREE, NULL_TREE);
-
- while (pending_hard_virtuals)
- {
- modify_all_vtables (t,
- TREE_PURPOSE (pending_hard_virtuals),
- TREE_VALUE (pending_hard_virtuals));
- pending_hard_virtuals = TREE_CHAIN (pending_hard_virtuals);
- }
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (t))
- {
- tree vbases;
- /* Now fixup any virtual function entries from virtual bases
- that have different deltas. This has to come after we do the
- pending hard virtuals, as we might have a function that comes
- from multiple virtual base instances that is only overridden
- by a hard virtual above. */
- vbases = CLASSTYPE_VBASECLASSES (t);
- while (vbases)
- {
- /* We might be able to shorten the amount of work we do by
- only doing this for vtables that come from virtual bases
- that have differing offsets, but don't want to miss any
- entries. */
- fixup_vtable_deltas (vbases, 1, t);
- vbases = TREE_CHAIN (vbases);
- }
- }
-
- /* Under our model of GC, every C++ class gets its own virtual
- function table, at least virtually. */
- if (pending_virtuals)
- {
- pending_virtuals = nreverse (pending_virtuals);
- /* We must enter these virtuals into the table. */
- if (first_vfn_base_index < 0)
- {
- /* The second slot is for the tdesc pointer when thunks are used. */
- if (flag_vtable_thunks)
- pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals);
-
- /* The first slot is for the rtti offset. */
- pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals);
-
- set_rtti_entry (pending_virtuals, size_zero_node, t);
- build_vtable (NULL_TREE, t);
- }
- else
- {
- /* Here we know enough to change the type of our virtual
- function table, but we will wait until later this function. */
-
- if (! BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (t)))
- build_vtable (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (t), first_vfn_base_index), t);
- }
-
- /* If this type has basetypes with constructors, then those
- constructors might clobber the virtual function table. But
- they don't if the derived class shares the exact vtable of the base
- class. */
-
- CLASSTYPE_NEEDS_VIRTUAL_REINIT (t) = 1;
- }
- else if (first_vfn_base_index >= 0)
- {
- tree binfo = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (t), first_vfn_base_index);
- /* This class contributes nothing new to the virtual function
- table. However, it may have declared functions which
- went into the virtual function table "inherited" from the
- base class. If so, we grab a copy of those updated functions,
- and pretend they are ours. */
-
- /* See if we should steal the virtual info from base class. */
- if (TYPE_BINFO_VTABLE (t) == NULL_TREE)
- TYPE_BINFO_VTABLE (t) = BINFO_VTABLE (binfo);
- if (TYPE_BINFO_VIRTUALS (t) == NULL_TREE)
- TYPE_BINFO_VIRTUALS (t) = BINFO_VIRTUALS (binfo);
- if (TYPE_BINFO_VTABLE (t) != BINFO_VTABLE (binfo))
- CLASSTYPE_NEEDS_VIRTUAL_REINIT (t) = 1;
- }
-
- if (max_has_virtual || first_vfn_base_index >= 0)
- {
- CLASSTYPE_VSIZE (t) = has_virtual;
- if (first_vfn_base_index >= 0)
- {
- if (pending_virtuals)
- TYPE_BINFO_VIRTUALS (t) = chainon (TYPE_BINFO_VIRTUALS (t),
- pending_virtuals);
- }
- else if (has_virtual)
- {
- TYPE_BINFO_VIRTUALS (t) = pending_virtuals;
- if (write_virtuals >= 0)
- DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)) = 1;
- }
- }
-
- /* Now lay out the virtual function table. */
- if (has_virtual)
- {
- tree atype, itype;
-
- if (TREE_TYPE (vfield) == ptr_type_node)
- {
- /* We must create a pointer to this table because
- the one inherited from base class does not exist.
- We will fill in the type when we know what it
- should really be. Use `size_int' so values are memoized
- in common cases. */
- itype = build_index_type (size_int (has_virtual));
- atype = build_array_type (vtable_entry_type, itype);
- layout_type (atype);
- TREE_TYPE (vfield) = build_pointer_type (atype);
- }
- else
- {
- atype = TREE_TYPE (TREE_TYPE (vfield));
-
- if (has_virtual != TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (atype))))
- {
- /* We must extend (or create) the boundaries on this array,
- because we picked up virtual functions from multiple
- base classes. */
- itype = build_index_type (size_int (has_virtual));
- atype = build_array_type (vtable_entry_type, itype);
- layout_type (atype);
- vfield = copy_node (vfield);
- TREE_TYPE (vfield) = build_pointer_type (atype);
- }
- }
-
- CLASSTYPE_VFIELD (t) = vfield;
- if (TREE_TYPE (TYPE_BINFO_VTABLE (t)) != atype)
- {
- TREE_TYPE (TYPE_BINFO_VTABLE (t)) = atype;
- DECL_SIZE (TYPE_BINFO_VTABLE (t)) = 0;
- layout_decl (TYPE_BINFO_VTABLE (t), 0);
- /* At one time the vtable info was grabbed 2 words at a time. This
- fails on sparc unless you have 8-byte alignment. (tiemann) */
- DECL_ALIGN (TYPE_BINFO_VTABLE (t))
- = MAX (TYPE_ALIGN (double_type_node),
- DECL_ALIGN (TYPE_BINFO_VTABLE (t)));
- }
- }
- else if (first_vfn_base_index >= 0)
- CLASSTYPE_VFIELD (t) = vfield;
- CLASSTYPE_VFIELDS (t) = vfields;
-
- finish_struct_bits (t, max_has_virtual);
-
- /* Complete the rtl for any static member objects of the type we're
- working on. */
- for (x = fields; x; x = TREE_CHAIN (x))
- {
- if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x)
- && TREE_TYPE (x) == t)
- {
- DECL_MODE (x) = TYPE_MODE (t);
- make_decl_rtl (x, NULL, 0);
- }
- }
-
- if (TYPE_HAS_CONSTRUCTOR (t))
- {
- tree vfields = CLASSTYPE_VFIELDS (t);
-
- while (vfields)
- {
- /* Mark the fact that constructor for T
- could affect anybody inheriting from T
- who wants to initialize vtables for VFIELDS's type. */
- if (VF_DERIVED_VALUE (vfields))
- TREE_ADDRESSABLE (vfields) = 1;
- vfields = TREE_CHAIN (vfields);
- }
- if (any_default_members != 0)
- build_class_init_list (t);
- }
- else if (TYPE_NEEDS_CONSTRUCTING (t))
- build_class_init_list (t);
-
- /* Write out inline function definitions. */
- do_inline_function_hair (t, CLASSTYPE_INLINE_FRIENDS (t));
- CLASSTYPE_INLINE_FRIENDS (t) = 0;
-
- if (CLASSTYPE_VSIZE (t) != 0)
- {
-#if 0
- /* This is now done above. */
- if (DECL_FIELD_CONTEXT (vfield) != t)
- {
- tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
- tree offset = BINFO_OFFSET (binfo);
-
- vfield = copy_node (vfield);
- copy_lang_decl (vfield);
-
- if (! integer_zerop (offset))
- offset = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT));
- DECL_FIELD_CONTEXT (vfield) = t;
- DECL_CLASS_CONTEXT (vfield) = t;
- DECL_FIELD_BITPOS (vfield)
- = size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield));
- CLASSTYPE_VFIELD (t) = vfield;
- }
-#endif
-
- /* In addition to this one, all the other vfields should be listed. */
- /* Before that can be done, we have to have FIELD_DECLs for them, and
- a place to find them. */
- TYPE_NONCOPIED_PARTS (t) = build_tree_list (default_conversion (TYPE_BINFO_VTABLE (t)), vfield);
-
- if (warn_nonvdtor && TYPE_HAS_DESTRUCTOR (t)
- && DECL_VINDEX (TREE_VEC_ELT (method_vec, 1)) == NULL_TREE)
- cp_warning ("`%#T' has virtual functions but non-virtual destructor",
- t);
- }
-
- /* Make the rtl for any new vtables we have created, and unmark
- the base types we marked. */
- finish_vtbls (TYPE_BINFO (t), 1, t);
- hack_incomplete_structures (t);
-
-#if 0
- if (TYPE_NAME (t) && TYPE_IDENTIFIER (t))
- undo_template_name_overload (TYPE_IDENTIFIER (t), 1);
-#endif
-
- resume_momentary (old);
-
- if (warn_overloaded_virtual)
- warn_hidden (t);
-
-#if 0
- /* This has to be done after we have sorted out what to do with
- the enclosing type. */
- if (write_symbols != DWARF_DEBUG)
- {
- /* Be smarter about nested classes here. If a type is nested,
- only output it if we would output the enclosing type. */
- if (DECL_CONTEXT (TYPE_MAIN_DECL (t))
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (TYPE_MAIN_DECL (t)))) == 't')
- DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t));
- }
-#endif
-
- if (write_symbols != DWARF_DEBUG && write_symbols != DWARF2_DEBUG)
- {
- /* If the type has methods, we want to think about cutting down
- the amount of symbol table stuff we output. The value stored in
- the TYPE_DECL's DECL_IGNORED_P slot is a first approximation.
- For example, if a member function is seen and we decide to
- write out that member function, then we can change the value
- of the DECL_IGNORED_P slot, and the type will be output when
- that member function's debug info is written out.
-
- We can't do this with DWARF, which does not support name
- references between translation units. */
- if (CLASSTYPE_METHOD_VEC (t))
- {
- extern tree pending_vtables;
-
- /* Don't output full info about any type
- which does not have its implementation defined here. */
- if (TYPE_VIRTUAL_P (t) && write_virtuals == 2)
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t))
- = (value_member (TYPE_IDENTIFIER (t), pending_vtables) == 0);
- else if (CLASSTYPE_INTERFACE_ONLY (t))
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
-#if 0
- /* XXX do something about this. */
- else if (CLASSTYPE_INTERFACE_UNKNOWN (t))
- /* Only a first approximation! */
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
-#endif
- }
- else if (CLASSTYPE_INTERFACE_ONLY (t))
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
- }
-
- /* Finish debugging output for this type. */
- rest_of_type_compilation (t, toplevel_bindings_p ());
-
- return t;
-}
-
-tree
-finish_struct (t, list_of_fieldlists, attributes, warn_anon)
- tree t, list_of_fieldlists, attributes;
- int warn_anon;
-{
- tree fields = NULL_TREE;
- tree *tail = &TYPE_METHODS (t);
- tree name = TYPE_NAME (t);
- tree x, last_x = NULL_TREE;
- tree access;
- tree dummy = NULL_TREE;
-
- if (TREE_CODE (name) == TYPE_DECL)
- {
- extern int lineno;
-
- DECL_SOURCE_FILE (name) = input_filename;
- /* For TYPE_DECL that are not typedefs (those marked with a line
- number of zero, we don't want to mark them as real typedefs.
- If this fails one needs to make sure real typedefs have a
- previous line number, even if it is wrong, that way the below
- will fill in the right line number. (mrs) */
- if (DECL_SOURCE_LINE (name))
- DECL_SOURCE_LINE (name) = lineno;
- CLASSTYPE_SOURCE_LINE (t) = lineno;
- name = DECL_NAME (name);
- }
-
- /* Append the fields we need for constructing signature tables. */
- if (IS_SIGNATURE (t))
- append_signature_fields (list_of_fieldlists);
-
- /* Move our self-reference declaration to the end of the field list so
- any real field with the same name takes precedence. */
- if (list_of_fieldlists
- && TREE_VALUE (list_of_fieldlists)
- && DECL_ARTIFICIAL (TREE_VALUE (list_of_fieldlists)))
- {
- dummy = TREE_VALUE (list_of_fieldlists);
- list_of_fieldlists = TREE_CHAIN (list_of_fieldlists);
- }
-
- if (last_x && list_of_fieldlists)
- TREE_CHAIN (last_x) = TREE_VALUE (list_of_fieldlists);
-
- while (list_of_fieldlists)
- {
- access = TREE_PURPOSE (list_of_fieldlists);
-
- /* For signatures, we made all methods `public' in the parser and
- reported an error if a access specifier was used. */
- if (access == access_default_node)
- {
- if (CLASSTYPE_DECLARED_CLASS (t) == 0)
- access = access_public_node;
- else
- access = access_private_node;
- }
-
- for (x = TREE_VALUE (list_of_fieldlists); x; x = TREE_CHAIN (x))
- {
- TREE_PRIVATE (x) = access == access_private_node;
- TREE_PROTECTED (x) = access == access_protected_node;
-
- /* Check for inconsistent use of this name in the class body.
- Enums, types and static vars have already been checked. */
- if (TREE_CODE (x) != TYPE_DECL && TREE_CODE (x) != USING_DECL
- && TREE_CODE (x) != CONST_DECL && TREE_CODE (x) != VAR_DECL)
- {
- tree name = DECL_NAME (x);
- tree icv;
-
- /* Don't get confused by access decls. */
- if (name && TREE_CODE (name) == IDENTIFIER_NODE)
- icv = IDENTIFIER_CLASS_VALUE (name);
- else
- icv = NULL_TREE;
-
- if (icv
- /* Don't complain about constructors. */
- && name != constructor_name (current_class_type)
- /* Or inherited names. */
- && id_in_current_class (name)
- /* Or shadowed tags. */
- && !(TREE_CODE (icv) == TYPE_DECL
- && DECL_CONTEXT (icv) == t))
- {
- cp_error_at ("declaration of identifier `%D' as `%+#D'",
- name, x);
- cp_error_at ("conflicts with other use in class as `%#D'",
- icv);
- }
- }
-
- if (TREE_CODE (x) == FUNCTION_DECL)
- {
- DECL_CLASS_CONTEXT (x) = t;
- if (last_x)
- TREE_CHAIN (last_x) = TREE_CHAIN (x);
- /* Link x onto end of TYPE_METHODS. */
- *tail = x;
- tail = &TREE_CHAIN (x);
- continue;
- }
-
- if (TREE_CODE (x) != TYPE_DECL)
- DECL_FIELD_CONTEXT (x) = t;
-
- if (! fields)
- fields = x;
- last_x = x;
- }
- list_of_fieldlists = TREE_CHAIN (list_of_fieldlists);
- /* link the tail while we have it! */
- if (last_x)
- {
- TREE_CHAIN (last_x) = NULL_TREE;
-
- if (list_of_fieldlists
- && TREE_VALUE (list_of_fieldlists)
- && TREE_CODE (TREE_VALUE (list_of_fieldlists)) != FUNCTION_DECL)
- TREE_CHAIN (last_x) = TREE_VALUE (list_of_fieldlists);
- }
- }
-
- /* Now add the tags, if any, to the list of TYPE_DECLs
- defined for this type. */
- if (CLASSTYPE_TAGS (t) || dummy)
- {
- /* The list of tags was built up in pushtag in reverse order; we need
- to fix that so that enumerators will be processed in forward order
- in template instantiation. */
- CLASSTYPE_TAGS (t) = x = nreverse (CLASSTYPE_TAGS (t));
- while (x)
- {
- tree tag = TYPE_MAIN_DECL (TREE_VALUE (x));
-
- TREE_NONLOCAL_FLAG (TREE_VALUE (x)) = 0;
- x = TREE_CHAIN (x);
- last_x = chainon (last_x, tag);
- }
- if (dummy)
- last_x = chainon (last_x, dummy);
- if (fields == NULL_TREE)
- fields = last_x;
- CLASSTYPE_LOCAL_TYPEDECLS (t) = 1;
- }
-
- *tail = NULL_TREE;
- TYPE_FIELDS (t) = fields;
-
- cplus_decl_attributes (t, attributes, NULL_TREE);
-
- if (processing_template_decl)
- {
- tree d = getdecls ();
- for (; d; d = TREE_CHAIN (d))
- {
- /* If this is the decl for the class or one of the template
- parms, we've seen all the injected decls. */
- if ((TREE_CODE (d) == TYPE_DECL
- && (TREE_TYPE (d) == t
- || TREE_CODE (TREE_TYPE (d)) == TEMPLATE_TYPE_PARM))
- || TREE_CODE (d) == CONST_DECL)
- break;
- /* Don't inject cache decls. */
- else if (IDENTIFIER_TEMPLATE (DECL_NAME (d)))
- continue;
- DECL_TEMPLATE_INJECT (CLASSTYPE_TI_TEMPLATE (t))
- = tree_cons (NULL_TREE, d,
- DECL_TEMPLATE_INJECT (CLASSTYPE_TI_TEMPLATE (t)));
- }
- CLASSTYPE_METHOD_VEC (t)
- = finish_struct_methods (t, TYPE_METHODS (t), 1);
- TYPE_SIZE (t) = integer_zero_node;
- }
- else
- t = finish_struct_1 (t, warn_anon);
-
- TYPE_BEING_DEFINED (t) = 0;
-
- if (current_class_type)
- popclass (0);
- else
- error ("trying to finish struct, but kicked out due to previous parse errors.");
-
- return t;
-}
-
-/* Return non-zero if the effective type of INSTANCE is static.
- Used to determine whether the virtual function table is needed
- or not.
-
- *NONNULL is set iff INSTANCE can be known to be nonnull, regardless
- of our knowledge of its type. */
-
-int
-resolves_to_fixed_type_p (instance, nonnull)
- tree instance;
- int *nonnull;
-{
- switch (TREE_CODE (instance))
- {
- case INDIRECT_REF:
- /* Check that we are not going through a cast of some sort. */
- if (TREE_TYPE (instance)
- == TREE_TYPE (TREE_TYPE (TREE_OPERAND (instance, 0))))
- instance = TREE_OPERAND (instance, 0);
- /* fall through... */
- case CALL_EXPR:
- /* This is a call to a constructor, hence it's never zero. */
- if (TREE_HAS_CONSTRUCTOR (instance))
- {
- if (nonnull)
- *nonnull = 1;
- return 1;
- }
- return 0;
-
- case SAVE_EXPR:
- /* This is a call to a constructor, hence it's never zero. */
- if (TREE_HAS_CONSTRUCTOR (instance))
- {
- if (nonnull)
- *nonnull = 1;
- return 1;
- }
- return resolves_to_fixed_type_p (TREE_OPERAND (instance, 0), nonnull);
-
- case RTL_EXPR:
- /* This is a call to `new', hence it's never zero. */
- if (TREE_CALLS_NEW (instance))
- {
- if (nonnull)
- *nonnull = 1;
- return 1;
- }
- return 0;
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- if (TREE_CODE (TREE_OPERAND (instance, 1)) == INTEGER_CST)
- /* Propagate nonnull. */
- resolves_to_fixed_type_p (TREE_OPERAND (instance, 0), nonnull);
- if (TREE_CODE (TREE_OPERAND (instance, 0)) == ADDR_EXPR)
- return resolves_to_fixed_type_p (TREE_OPERAND (instance, 0), nonnull);
- return 0;
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- return resolves_to_fixed_type_p (TREE_OPERAND (instance, 0), nonnull);
-
- case ADDR_EXPR:
- if (nonnull)
- *nonnull = 1;
- return resolves_to_fixed_type_p (TREE_OPERAND (instance, 0), nonnull);
-
- case COMPONENT_REF:
- return resolves_to_fixed_type_p (TREE_OPERAND (instance, 1), nonnull);
-
- case VAR_DECL:
- case FIELD_DECL:
- if (TREE_CODE (TREE_TYPE (instance)) == ARRAY_TYPE
- && IS_AGGR_TYPE (TREE_TYPE (TREE_TYPE (instance))))
- {
- if (nonnull)
- *nonnull = 1;
- return 1;
- }
- /* fall through... */
- case TARGET_EXPR:
- case PARM_DECL:
- if (IS_AGGR_TYPE (TREE_TYPE (instance)))
- {
- if (nonnull)
- *nonnull = 1;
- return 1;
- }
- else if (nonnull)
- {
- if (instance == current_class_ptr
- && flag_this_is_variable <= 0)
- {
- /* Some people still use `this = 0' inside destructors. */
- *nonnull = ! DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (current_function_decl));
- /* In a constructor, we know our type. */
- if (flag_this_is_variable < 0)
- return 1;
- }
- else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
- /* Reference variables should be references to objects. */
- *nonnull = 1;
- }
- return 0;
-
- default:
- return 0;
- }
-}
-
-void
-init_class_processing ()
-{
- current_class_depth = 0;
- current_class_stacksize = 10;
- current_class_base = (tree *)xmalloc(current_class_stacksize * sizeof (tree));
- current_class_stack = current_class_base;
-
- current_lang_stacksize = 10;
- current_lang_base = (tree *)xmalloc(current_lang_stacksize * sizeof (tree));
- current_lang_stack = current_lang_base;
-
- access_default_node = build_int_2 (0, 0);
- access_public_node = build_int_2 (1, 0);
- access_protected_node = build_int_2 (2, 0);
- access_private_node = build_int_2 (3, 0);
- access_default_virtual_node = build_int_2 (4, 0);
- access_public_virtual_node = build_int_2 (5, 0);
- access_private_virtual_node = build_int_2 (6, 0);
-
- /* Keep these values lying around. */
- base_layout_decl = build_lang_field_decl (FIELD_DECL, NULL_TREE, error_mark_node);
- TREE_TYPE (base_layout_decl) = make_node (RECORD_TYPE);
-
- gcc_obstack_init (&class_obstack);
-}
-
-/* Set current scope to NAME. CODE tells us if this is a
- STRUCT, UNION, or ENUM environment.
-
- NAME may end up being NULL_TREE if this is an anonymous or
- late-bound struct (as in "struct { ... } foo;") */
-
-/* Set global variables CURRENT_CLASS_NAME and CURRENT_CLASS_TYPE to
- appropriate values, found by looking up the type definition of
- NAME (as a CODE).
-
- If MODIFY is 1, we set IDENTIFIER_CLASS_VALUE's of names
- which can be seen locally to the class. They are shadowed by
- any subsequent local declaration (including parameter names).
-
- If MODIFY is 2, we set IDENTIFIER_CLASS_VALUE's of names
- which have static meaning (i.e., static members, static
- member functions, enum declarations, etc).
-
- If MODIFY is 3, we set IDENTIFIER_CLASS_VALUE of names
- which can be seen locally to the class (as in 1), but
- know that we are doing this for declaration purposes
- (i.e. friend foo::bar (int)).
-
- So that we may avoid calls to lookup_name, we cache the _TYPE
- nodes of local TYPE_DECLs in the TREE_TYPE field of the name.
-
- For multiple inheritance, we perform a two-pass depth-first search
- of the type lattice. The first pass performs a pre-order search,
- marking types after the type has had its fields installed in
- the appropriate IDENTIFIER_CLASS_VALUE slot. The second pass merely
- unmarks the marked types. If a field or member function name
- appears in an ambiguous way, the IDENTIFIER_CLASS_VALUE of
- that name becomes `error_mark_node'. */
-
-void
-pushclass (type, modify)
- tree type;
- int modify;
-{
- push_memoized_context (type, modify);
-
- current_class_depth++;
- *current_class_stack++ = current_class_name;
- *current_class_stack++ = current_class_type;
- if (current_class_stack >= current_class_base + current_class_stacksize)
- {
- current_class_base =
- (tree *)xrealloc (current_class_base,
- sizeof (tree) * (current_class_stacksize + 10));
- current_class_stack = current_class_base + current_class_stacksize;
- current_class_stacksize += 10;
- }
-
- current_class_name = TYPE_NAME (type);
- if (TREE_CODE (current_class_name) == TYPE_DECL)
- current_class_name = DECL_NAME (current_class_name);
- current_class_type = type;
-
- if (previous_class_type != NULL_TREE
- && (type != previous_class_type || TYPE_SIZE (previous_class_type) == NULL_TREE)
- && current_class_depth == 1)
- {
- /* Forcibly remove any old class remnants. */
- popclass (-1);
- previous_class_type = NULL_TREE;
- }
-
- pushlevel_class ();
-
- if (CLASSTYPE_TEMPLATE_INFO (type))
- overload_template_name (type);
-
- if (modify)
- {
- tree tags;
- tree this_fndecl = current_function_decl;
-
- if (current_function_decl
- && DECL_CONTEXT (current_function_decl)
- && TREE_CODE (DECL_CONTEXT (current_function_decl)) == FUNCTION_DECL)
- current_function_decl = DECL_CONTEXT (current_function_decl);
- else
- current_function_decl = NULL_TREE;
-
- if (type != previous_class_type || current_class_depth > 1)
- {
- build_mi_matrix (type);
- push_class_decls (type);
- free_mi_matrix ();
- }
- else
- {
- tree item;
-
- /* Hooray, we successfully cached; let's just install the
- cached class_shadowed list, and walk through it to get the
- IDENTIFIER_TYPE_VALUEs correct. */
- set_class_shadows (previous_class_values);
- for (item = previous_class_values; item; item = TREE_CHAIN (item))
- {
- tree id = TREE_PURPOSE (item);
- tree decl = IDENTIFIER_CLASS_VALUE (id);
-
- if (TREE_CODE (decl) == TYPE_DECL)
- set_identifier_type_value (id, TREE_TYPE (decl));
- }
- unuse_fields (type);
- }
-
- for (tags = CLASSTYPE_TAGS (type); tags; tags = TREE_CHAIN (tags))
- {
- TREE_NONLOCAL_FLAG (TREE_VALUE (tags)) = 1;
- if (! TREE_PURPOSE (tags))
- continue;
- pushtag (TREE_PURPOSE (tags), TREE_VALUE (tags), 0);
- }
-
- current_function_decl = this_fndecl;
- }
-}
-
-/* Get out of the current class scope. If we were in a class scope
- previously, that is the one popped to. The flag MODIFY tells whether
- the current scope declarations needs to be modified as a result of
- popping to the previous scope. 0 is used for class definitions. */
-
-void
-popclass (modify)
- int modify;
-{
- if (modify < 0)
- {
- /* Back this old class out completely. */
- tree tags = CLASSTYPE_TAGS (previous_class_type);
- tree t;
-
- /* This code can be seen as a cache miss. When we've cached a
- class' scope's bindings and we can't use them, we need to reset
- them. This is it! */
- for (t = previous_class_values; t; t = TREE_CHAIN (t))
- IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE;
- while (tags)
- {
- TREE_NONLOCAL_FLAG (TREE_VALUE (tags)) = 0;
- tags = TREE_CHAIN (tags);
- }
- goto ret;
- }
-
- if (modify)
- {
- /* Just remove from this class what didn't make
- it into IDENTIFIER_CLASS_VALUE. */
- tree tags = CLASSTYPE_TAGS (current_class_type);
-
- while (tags)
- {
- TREE_NONLOCAL_FLAG (TREE_VALUE (tags)) = 0;
- tags = TREE_CHAIN (tags);
- }
- }
-
- /* Force clearing of IDENTIFIER_CLASS_VALUEs after a class definition,
- since not all class decls make it there currently. */
- poplevel_class (! modify);
-
- /* Since poplevel_class does the popping of class decls nowadays,
- this really only frees the obstack used for these decls.
- That's why it had to be moved down here. */
- if (modify)
- pop_class_decls ();
-
- current_class_depth--;
- current_class_type = *--current_class_stack;
- current_class_name = *--current_class_stack;
-
- pop_memoized_context (modify);
-
- ret:
- ;
-}
-
-/* When entering a class scope, all enclosing class scopes' names with
- static meaning (static variables, static functions, types and enumerators)
- have to be visible. This recursive function calls pushclass for all
- enclosing class contexts until global or a local scope is reached.
- TYPE is the enclosed class and MODIFY is equivalent with the pushclass
- formal of the same name. */
-
-void
-push_nested_class (type, modify)
- tree type;
- int modify;
-{
- tree context;
-
- if (type == NULL_TREE || type == error_mark_node || ! IS_AGGR_TYPE (type)
- || TREE_CODE (type) == TEMPLATE_TYPE_PARM)
- return;
-
- context = DECL_CONTEXT (TYPE_MAIN_DECL (type));
-
- if (context && TREE_CODE (context) == RECORD_TYPE)
- push_nested_class (context, 2);
- pushclass (type, modify);
-}
-
-/* Undoes a push_nested_class call. MODIFY is passed on to popclass. */
-
-void
-pop_nested_class (modify)
- int modify;
-{
- tree context = DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type));
-
- popclass (modify);
- if (context && TREE_CODE (context) == RECORD_TYPE)
- pop_nested_class (modify);
-}
-
-/* Set global variables CURRENT_LANG_NAME to appropriate value
- so that behavior of name-mangling machinery is correct. */
-
-void
-push_lang_context (name)
- tree name;
-{
- *current_lang_stack++ = current_lang_name;
- if (current_lang_stack >= current_lang_base + current_lang_stacksize)
- {
- current_lang_base =
- (tree *)xrealloc (current_lang_base,
- sizeof (tree) * (current_lang_stacksize + 10));
- current_lang_stack = current_lang_base + current_lang_stacksize;
- current_lang_stacksize += 10;
- }
-
- if (name == lang_name_cplusplus)
- {
- strict_prototype = strict_prototypes_lang_cplusplus;
- current_lang_name = name;
- }
- else if (name == lang_name_c)
- {
- strict_prototype = strict_prototypes_lang_c;
- current_lang_name = name;
- }
- else
- error ("language string `\"%s\"' not recognized", IDENTIFIER_POINTER (name));
-}
-
-/* Get out of the current language scope. */
-
-void
-pop_lang_context ()
-{
- current_lang_name = *--current_lang_stack;
- if (current_lang_name == lang_name_cplusplus)
- strict_prototype = strict_prototypes_lang_cplusplus;
- else if (current_lang_name == lang_name_c)
- strict_prototype = strict_prototypes_lang_c;
-}
-
-/* Type instantiation routines. */
-
-/* This function will instantiate the type of the expression given in
- RHS to match the type of LHSTYPE. If errors exist, then return
- error_mark_node. If only complain is COMPLAIN is set. If we are
- not complaining, never modify rhs, as overload resolution wants to
- try many possible instantiations, in hopes that at least one will
- work.
-
- This function is used in build_modify_expr, convert_arguments,
- build_c_cast, and compute_conversion_costs. */
-
-tree
-instantiate_type (lhstype, rhs, complain)
- tree lhstype, rhs;
- int complain;
-{
- if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
- {
- if (complain)
- error ("not enough type information");
- return error_mark_node;
- }
-
- if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs)))
- return rhs;
-
- rhs = copy_node (rhs);
-
- /* This should really only be used when attempting to distinguish
- what sort of a pointer to function we have. For now, any
- arithmetic operation which is not supported on pointers
- is rejected as an error. */
-
- switch (TREE_CODE (rhs))
- {
- case TYPE_EXPR:
- case CONVERT_EXPR:
- case SAVE_EXPR:
- case CONSTRUCTOR:
- case BUFFER_REF:
- my_friendly_abort (177);
- return error_mark_node;
-
- case INDIRECT_REF:
- case ARRAY_REF:
- {
- tree new_rhs;
-
- new_rhs = instantiate_type (build_pointer_type (lhstype),
- TREE_OPERAND (rhs, 0), complain);
- if (new_rhs == error_mark_node)
- return error_mark_node;
-
- TREE_TYPE (rhs) = lhstype;
- TREE_OPERAND (rhs, 0) = new_rhs;
- return rhs;
- }
-
- case NOP_EXPR:
- rhs = copy_node (TREE_OPERAND (rhs, 0));
- TREE_TYPE (rhs) = unknown_type_node;
- return instantiate_type (lhstype, rhs, complain);
-
- case COMPONENT_REF:
- {
- tree field = TREE_OPERAND (rhs, 1);
- if (TREE_CODE (field) == TREE_LIST)
- {
- tree function = instantiate_type (lhstype, field, complain);
- if (function == error_mark_node)
- return error_mark_node;
- my_friendly_assert (TREE_CODE (function) == FUNCTION_DECL, 185);
- if (DECL_VINDEX (function))
- {
- tree base = TREE_OPERAND (rhs, 0);
- tree base_ptr = build_unary_op (ADDR_EXPR, base, 0);
- if (base_ptr == error_mark_node)
- return error_mark_node;
- base_ptr = convert_pointer_to (DECL_CONTEXT (function), base_ptr);
- if (base_ptr == error_mark_node)
- return error_mark_node;
- return build_vfn_ref (&base_ptr, base, DECL_VINDEX (function));
- }
- mark_used (function);
- return function;
- }
-
- my_friendly_assert (TREE_CODE (field) == FIELD_DECL, 178);
- my_friendly_assert (!(TREE_CODE (TREE_TYPE (field)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (field)) == METHOD_TYPE),
- 179);
-
- TREE_TYPE (rhs) = lhstype;
- /* First look for an exact match */
-
- while (field && TREE_TYPE (field) != lhstype)
- field = DECL_CHAIN (field);
- if (field)
- {
- TREE_OPERAND (rhs, 1) = field;
- mark_used (field);
- return rhs;
- }
-
- /* No exact match found, look for a compatible function. */
- field = TREE_OPERAND (rhs, 1);
- while (field && ! comptypes (lhstype, TREE_TYPE (field), 0))
- field = DECL_CHAIN (field);
- if (field)
- {
- TREE_OPERAND (rhs, 1) = field;
- field = DECL_CHAIN (field);
- while (field && ! comptypes (lhstype, TREE_TYPE (field), 0))
- field = DECL_CHAIN (field);
- if (field)
- {
- if (complain)
- error ("ambiguous overload for COMPONENT_REF requested");
- return error_mark_node;
- }
- }
- else
- {
- if (complain)
- error ("no appropriate overload exists for COMPONENT_REF");
- return error_mark_node;
- }
- return rhs;
- }
-
- case TREE_LIST:
- {
- tree elem, baselink, name;
- int globals = overloaded_globals_p (rhs);
-
- /* First look for an exact match. Search either overloaded
- functions or member functions. May have to undo what
- `default_conversion' might do to lhstype. */
-
- if (TYPE_PTRMEMFUNC_P (lhstype))
- lhstype = TYPE_PTRMEMFUNC_FN_TYPE (lhstype);
-
- if (TREE_CODE (lhstype) == POINTER_TYPE)
- if (TREE_CODE (TREE_TYPE (lhstype)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (lhstype)) == METHOD_TYPE)
- lhstype = TREE_TYPE (lhstype);
- else
- {
- if (complain)
- error ("invalid type combination for overload");
- return error_mark_node;
- }
-
- if (TREE_CODE (lhstype) != FUNCTION_TYPE && globals > 0)
- {
- if (complain)
- cp_error ("cannot resolve overloaded function `%D' based on non-function type",
- TREE_PURPOSE (rhs));
- return error_mark_node;
- }
-
- if (globals > 0)
- {
- elem = get_first_fn (rhs);
- while (elem)
- if (! comptypes (lhstype, TREE_TYPE (elem), 1))
- elem = DECL_CHAIN (elem);
- else
- {
- mark_used (elem);
- return elem;
- }
-
- /* No exact match found, look for a compatible template. */
- {
- tree save_elem = 0;
- for (elem = get_first_fn (rhs); elem; elem = DECL_CHAIN (elem))
- if (TREE_CODE (elem) == TEMPLATE_DECL)
- {
- int n = TREE_VEC_LENGTH (DECL_TEMPLATE_PARMS (elem));
- tree *t = (tree *) alloca (sizeof (tree) * n);
- int i, d = 0;
- i = type_unification (DECL_TEMPLATE_PARMS (elem), t,
- TYPE_ARG_TYPES (TREE_TYPE (elem)),
- TYPE_ARG_TYPES (lhstype), &d, 0, 1);
- if (i == 0)
- {
- if (save_elem)
- {
- cp_error ("ambiguous template instantiation converting to `%#T'", lhstype);
- return error_mark_node;
- }
- save_elem = instantiate_template (elem, t);
- /* Check the return type. */
- if (! comptypes (TREE_TYPE (lhstype),
- TREE_TYPE (TREE_TYPE (save_elem)), 1))
- save_elem = 0;
- }
- }
- if (save_elem)
- {
- mark_used (save_elem);
- return save_elem;
- }
- }
-
- /* No match found, look for a compatible function. */
- elem = get_first_fn (rhs);
- while (elem && comp_target_types (lhstype,
- TREE_TYPE (elem), 1) <= 0)
- elem = DECL_CHAIN (elem);
- if (elem)
- {
- tree save_elem = elem;
- elem = DECL_CHAIN (elem);
- while (elem && comp_target_types (lhstype,
- TREE_TYPE (elem), 0) <= 0)
- elem = DECL_CHAIN (elem);
- if (elem)
- {
- if (complain)
- {
- cp_error ("cannot resolve overload to target type `%#T'",
- lhstype);
- cp_error_at (" ambiguity between `%#D'", save_elem);
- cp_error_at (" and `%#D', at least", elem);
- }
- return error_mark_node;
- }
- mark_used (save_elem);
- return save_elem;
- }
- if (complain)
- {
- cp_error ("cannot resolve overload to target type `%#T'",
- lhstype);
- cp_error (" because no suitable overload of function `%D' exists",
- TREE_PURPOSE (rhs));
- }
- return error_mark_node;
- }
-
- if (TREE_NONLOCAL_FLAG (rhs))
- {
- /* Got to get it as a baselink. */
- rhs = lookup_fnfields (TYPE_BINFO (current_class_type),
- TREE_PURPOSE (rhs), 0);
- }
- else
- {
- my_friendly_assert (TREE_CHAIN (rhs) == NULL_TREE, 181);
- if (TREE_CODE (TREE_VALUE (rhs)) == TREE_LIST)
- rhs = TREE_VALUE (rhs);
- my_friendly_assert (TREE_CODE (TREE_VALUE (rhs)) == FUNCTION_DECL,
- 182);
- }
-
- for (baselink = rhs; baselink;
- baselink = next_baselink (baselink))
- {
- elem = TREE_VALUE (baselink);
- while (elem)
- if (comptypes (lhstype, TREE_TYPE (elem), 1))
- {
- mark_used (elem);
- return elem;
- }
- else
- elem = DECL_CHAIN (elem);
- }
-
- /* No exact match found, look for a compatible method. */
- for (baselink = rhs; baselink;
- baselink = next_baselink (baselink))
- {
- elem = TREE_VALUE (baselink);
- while (elem && comp_target_types (lhstype,
- TREE_TYPE (elem), 1) <= 0)
- elem = DECL_CHAIN (elem);
- if (elem)
- {
- tree save_elem = elem;
- elem = DECL_CHAIN (elem);
- while (elem && comp_target_types (lhstype,
- TREE_TYPE (elem), 0) <= 0)
- elem = DECL_CHAIN (elem);
- if (elem)
- {
- if (complain)
- error ("ambiguous overload for overloaded method requested");
- return error_mark_node;
- }
- mark_used (save_elem);
- return save_elem;
- }
- name = DECL_NAME (TREE_VALUE (rhs));
-#if 0
- if (TREE_CODE (lhstype) == FUNCTION_TYPE && globals < 0)
- {
- /* Try to instantiate from non-member functions. */
- rhs = lookup_name_nonclass (name);
- if (rhs && TREE_CODE (rhs) == TREE_LIST)
- {
- /* This code seems to be missing a `return'. */
- my_friendly_abort (4);
- instantiate_type (lhstype, rhs, complain);
- }
- }
-#endif
- }
- if (complain)
- cp_error ("no compatible member functions named `%D'", name);
- return error_mark_node;
- }
-
- case CALL_EXPR:
- /* This is too hard for now. */
- my_friendly_abort (183);
- return error_mark_node;
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- case COMPOUND_EXPR:
- TREE_OPERAND (rhs, 0)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 0), complain);
- if (TREE_OPERAND (rhs, 0) == error_mark_node)
- return error_mark_node;
- TREE_OPERAND (rhs, 1)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), complain);
- if (TREE_OPERAND (rhs, 1) == error_mark_node)
- return error_mark_node;
-
- TREE_TYPE (rhs) = lhstype;
- return rhs;
-
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case RDIV_EXPR:
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case CEIL_MOD_EXPR:
- case ROUND_MOD_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_CEIL_EXPR:
- case FIX_TRUNC_EXPR:
- case FLOAT_EXPR:
- case NEGATE_EXPR:
- case ABS_EXPR:
- case MAX_EXPR:
- case MIN_EXPR:
- case FFS_EXPR:
-
- case BIT_AND_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case LROTATE_EXPR:
- case RROTATE_EXPR:
-
- case PREINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- if (complain)
- error ("invalid operation on uninstantiated type");
- return error_mark_node;
-
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case TRUTH_XOR_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_NOT_EXPR:
- if (complain)
- error ("not enough type information");
- return error_mark_node;
-
- case COND_EXPR:
- if (type_unknown_p (TREE_OPERAND (rhs, 0)))
- {
- if (complain)
- error ("not enough type information");
- return error_mark_node;
- }
- TREE_OPERAND (rhs, 1)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), complain);
- if (TREE_OPERAND (rhs, 1) == error_mark_node)
- return error_mark_node;
- TREE_OPERAND (rhs, 2)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 2), complain);
- if (TREE_OPERAND (rhs, 2) == error_mark_node)
- return error_mark_node;
-
- TREE_TYPE (rhs) = lhstype;
- return rhs;
-
- case MODIFY_EXPR:
- TREE_OPERAND (rhs, 1)
- = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), complain);
- if (TREE_OPERAND (rhs, 1) == error_mark_node)
- return error_mark_node;
-
- TREE_TYPE (rhs) = lhstype;
- return rhs;
-
- case ADDR_EXPR:
- if (TYPE_PTRMEMFUNC_P (lhstype))
- lhstype = TYPE_PTRMEMFUNC_FN_TYPE (lhstype);
- else if (TREE_CODE (lhstype) != POINTER_TYPE)
- {
- if (complain)
- error ("type for resolving address of overloaded function must be pointer type");
- return error_mark_node;
- }
- {
- tree fn = instantiate_type (TREE_TYPE (lhstype), TREE_OPERAND (rhs, 0), complain);
- if (fn == error_mark_node)
- return error_mark_node;
- mark_addressable (fn);
- TREE_TYPE (rhs) = lhstype;
- TREE_OPERAND (rhs, 0) = fn;
- TREE_CONSTANT (rhs) = staticp (fn);
- if (TREE_CODE (lhstype) == POINTER_TYPE &&
- TREE_CODE (TREE_TYPE (lhstype)) == METHOD_TYPE)
- {
- build_ptrmemfunc_type (lhstype);
- rhs = build_ptrmemfunc (lhstype, rhs, 0);
- }
- }
- return rhs;
-
- case ENTRY_VALUE_EXPR:
- my_friendly_abort (184);
- return error_mark_node;
-
- case ERROR_MARK:
- return error_mark_node;
-
- default:
- my_friendly_abort (185);
- return error_mark_node;
- }
-}
-
-/* Return the name of the virtual function pointer field
- (as an IDENTIFIER_NODE) for the given TYPE. Note that
- this may have to look back through base types to find the
- ultimate field name. (For single inheritance, these could
- all be the same name. Who knows for multiple inheritance). */
-
-static tree
-get_vfield_name (type)
- tree type;
-{
- tree binfo = TYPE_BINFO (type);
- char *buf;
-
- while (BINFO_BASETYPES (binfo)
- && TYPE_VIRTUAL_P (BINFO_TYPE (BINFO_BASETYPE (binfo, 0)))
- && ! TREE_VIA_VIRTUAL (BINFO_BASETYPE (binfo, 0)))
- binfo = BINFO_BASETYPE (binfo, 0);
-
- type = BINFO_TYPE (binfo);
- buf = (char *)alloca (sizeof (VFIELD_NAME_FORMAT)
- + TYPE_NAME_LENGTH (type) + 2);
- sprintf (buf, VFIELD_NAME_FORMAT, TYPE_NAME_STRING (type));
- return get_identifier (buf);
-}
-
-void
-print_class_statistics ()
-{
-#ifdef GATHER_STATISTICS
- fprintf (stderr, "convert_harshness = %d\n", n_convert_harshness);
- fprintf (stderr, "compute_conversion_costs = %d\n", n_compute_conversion_costs);
- fprintf (stderr, "build_method_call = %d (inner = %d)\n",
- n_build_method_call, n_inner_fields_searched);
- if (n_vtables)
- {
- fprintf (stderr, "vtables = %d; vtable searches = %d\n",
- n_vtables, n_vtable_searches);
- fprintf (stderr, "vtable entries = %d; vtable elems = %d\n",
- n_vtable_entries, n_vtable_elems);
- }
-#endif
-}
-
-/* Push an obstack which is sufficiently long-lived to hold such class
- decls that may be cached in the previous_class_values list. For now, let's
- use the permanent obstack, later we may create a dedicated obstack just
- for this purpose. The effect is undone by pop_obstacks. */
-
-void
-maybe_push_cache_obstack ()
-{
- push_obstacks_nochange ();
- if (current_class_depth == 1)
- current_obstack = &permanent_obstack;
-}
-
-/* Build a dummy reference to ourselves so Derived::Base (and A::A) works,
- according to [class]:
- The class-name is also inserted
- into the scope of the class itself. For purposes of access checking,
- the inserted class name is treated as if it were a public member name. */
-
-tree
-build_self_reference ()
-{
- tree name = constructor_name (current_class_type);
- tree value = build_lang_decl (TYPE_DECL, name, current_class_type);
- DECL_NONLOCAL (value) = 1;
- DECL_CONTEXT (value) = current_class_type;
- DECL_CLASS_CONTEXT (value) = current_class_type;
- CLASSTYPE_LOCAL_TYPEDECLS (current_class_type) = 1;
- DECL_ARTIFICIAL (value) = 1;
-
- pushdecl_class_level (value);
- return value;
-}
diff --git a/gcc/cp/class.h b/gcc/cp/class.h
deleted file mode 100644
index 1c83d5beb7a..00000000000
--- a/gcc/cp/class.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Variables and structures for overloading rules.
- Copyright (C) 1993 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. */
-
-/* The following structure is used when comparing various alternatives
- for overloading. The unsigned quantity `strikes.i' is used
- for fast comparison of two possibilities. This number is an
- aggregate of four constituents:
-
- EVIL: if this is non-zero, then the candidate should not be considered
- ELLIPSIS: if this is non-zero, then some actual argument has been matched
- against an ellipsis
- USER: if this is non-zero, then a user-defined type conversion is needed
- B_OR_D: if this is non-zero, then use a base pointer instead of the
- type of the pointer we started with.
- EASY: if this is non-zero, then we have a builtin conversion
- (such as int to long, int to float, etc) to do.
-
- If two candidates require user-defined type conversions, and the
- type conversions are not identical, then an ambiguity error
- is reported.
-
- If two candidates agree on user-defined type conversions,
- and one uses pointers of strictly higher type (derived where
- another uses base), then that alternative is silently chosen.
-
- Note that this technique really only works for 255 arguments. Perhaps
- this is not enough. */
-
-/* These macros and harshness_code are used by the NEW METHOD. */
-#define EVIL_CODE (1<<7)
-#define CONST_CODE (1<<6)
-#define ELLIPSIS_CODE (1<<5)
-#define USER_CODE (1<<4)
-#define STD_CODE (1<<3)
-#define PROMO_CODE (1<<2)
-#define QUAL_CODE (1<<1)
-#define TRIVIAL_CODE (1<<0)
-
-struct harshness_code
-{
- /* What kind of conversion is involved. */
- unsigned short code;
-
- /* The inheritance distance. */
- short distance;
-
- /* For a PROMO_CODE, Any special penalties involved in integral conversions.
- This exists because $4.1 of the ARM states that something like
- `short unsigned int' should promote to `int', not `unsigned int'.
- If, for example, it tries to match two fns, f(int) and f(unsigned),
- f(int) should be a better match than f(unsigned) by this rule. Without
- this extra metric, they both only appear as "integral promotions", which
- will lead to an ambiguity.
- For a TRIVIAL_CODE, This is also used by build_overload_call_real and
- convert_harshness to keep track of other information we need. */
- unsigned short int_penalty;
-};
-
-struct candidate
-{
- struct harshness_code h; /* Used for single-argument conversions. */
-
- int h_len; /* The length of the harshness vector. */
-
- tree function; /* A FUNCTION_DECL */
- tree basetypes; /* The path to function. */
- tree arg; /* first parm to function. */
-
- /* Indexed by argument number, encodes evil, user, d_to_b, and easy
- strikes for that argument. At end of array, we store the index+1
- of where we started using default parameters, or 0 if there are
- none. */
- struct harshness_code *harshness;
-
- union
- {
- tree field; /* If no evil strikes, the FUNCTION_DECL of
- the function (if a member function). */
- int bad_arg; /* the index of the first bad argument:
- 0 if no bad arguments
- > 0 is first bad argument
- -1 if extra actual arguments
- -2 if too few actual arguments.
- -3 if const/non const method mismatch.
- -4 if type unification failed.
- -5 if contravariance violation. */
- } u;
-};
-int rank_for_overload ();
-
-/* Variables shared between class.c and call.c. */
-
-extern int n_vtables;
-extern int n_vtable_entries;
-extern int n_vtable_searches;
-extern int n_vtable_elems;
-extern int n_convert_harshness;
-extern int n_compute_conversion_costs;
-extern int n_build_method_call;
-extern int n_inner_fields_searched;
diff --git a/gcc/cp/config-lang.in b/gcc/cp/config-lang.in
deleted file mode 100644
index 66fe112519e..00000000000
--- a/gcc/cp/config-lang.in
+++ /dev/null
@@ -1,39 +0,0 @@
-# Top level configure fragment for GNU C++.
-# Copyright (C) 1994, 1995 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="c++"
-
-compilers="cc1plus\$(exeext)"
-
-stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)"
-
-diff_excludes="-x cp/parse.c -x cp/parse.h"
-
-headers='$(CXX_EXTRA_HEADERS)'
-
-lib2funcs=cplib2.txt
diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
deleted file mode 100644
index be97b02ca95..00000000000
--- a/gcc/cp/cp-tree.def
+++ /dev/null
@@ -1,154 +0,0 @@
-/* This file contains the definitions and documentation for the
- additional tree codes used in the GNU C++ compiler (see tree.def
- for the standard codes).
- Copyright (C) 1987, 1988, 1990, 1993 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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. */
-
-
-/* Reference to the contents of an offset
- (a value whose type is an OFFSET_TYPE).
- Operand 0 is the object within which the offset is taken.
- Operand 1 is the offset. The language independent OFFSET_REF
- just won't work for us. */
-DEFTREECODE (OFFSET_REF, "offset_ref", "r", 2)
-
-/* For DELETE_EXPR, operand 0 is the store to be destroyed.
- Operand 1 is the value to pass to the destroying function
- saying whether the store should be deallocated as well. */
-DEFTREECODE (DELETE_EXPR, "dl_expr", "e", 2)
-DEFTREECODE (VEC_DELETE_EXPR, "vec_dl_expr", "e", 2)
-
-/* Value is reference to particular overloaded class method.
- Operand 0 is the class name (an IDENTIFIER_NODE);
- operand 1 is the field (also an IDENTIFIER_NODE).
- The COMPLEXITY field holds the class level (usually 0). */
-DEFTREECODE (SCOPE_REF, "scope_ref", "r", 2)
-
-/* When composing an object with a member, this is the result.
- Operand 0 is the object. Operand 1 is the member (usually
- a dereferenced pointer to member). */
-DEFTREECODE (MEMBER_REF, "member_ref", "r", 2)
-
-/* Type conversion operator in C++. TREE_TYPE is type that this
- operator converts to. Operand is expression to be converted. */
-DEFTREECODE (TYPE_EXPR, "type_expr", "e", 1)
-
-/* For NEW_EXPR, operand 0 is function which performs initialization,
- operand 1 is argument list to initialization function,
- and operand 2 is the slot which was allocated for this expression. */
-DEFTREECODE (NEW_EXPR, "nw_expr", "e", 3)
-DEFTREECODE (VEC_NEW_EXPR, "vec_nw_expr", "e", 3)
-
-/* A throw expression. operand 0 is the expression, if there was one,
- else it is NULL_TREE. */
-DEFTREECODE (THROW_EXPR, "throw_expr", "e", 1)
-
-/* Initialization of a vector, used in build_new. Operand 0 is the target
- of the initialization, operand 1 is the initializer, and operand 2 is
- the number of elements. */
-DEFTREECODE (VEC_INIT_EXPR, "vec_init_expr", "e", 3)
-
-/* Template definition. The following fields have the specified uses,
- although there are other macros in cp-tree.h that should be used for
- accessing this data.
- DECL_ARGUMENTS template parm vector
- DECL_TEMPLATE_INFO template text &c
- DECL_VINDEX list of instantiations already produced;
- only done for functions so far
- For class template:
- DECL_INITIAL associated templates (methods &c)
- DECL_RESULT null
- For non-class templates:
- TREE_TYPE type of object to be constructed
- DECL_RESULT decl for object to be created
- (e.g., FUNCTION_DECL with tmpl parms used)
- */
-DEFTREECODE (TEMPLATE_DECL, "template_decl", "d", 0)
-
-/* Index into a template parameter list. This parameter must be a type.
- Use TYPE_FIELDS to find parmlist and index. */
-DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", "t", 0)
-
-/* A type designated by 'typename T::t'. */
-DEFTREECODE (TYPENAME_TYPE, "typename_type", "t", 0)
-
-/* Index into a template parameter list. This parameter must not be a
- type. */
-DEFTREECODE (TEMPLATE_CONST_PARM, "template_const_parm", "c", 2)
-
-/* A thunk is a stub function.
-
- Thunks are used to implement multiple inheritance:
- At run-time, such a thunk subtracts THUNK_DELTA (an int, not a tree)
- from the this pointer, and then jumps to DECL_INITIAL
- (which is an ADDR_EXPR whose operand is a FUNCTION_DECL).
-
- Other kinds of thunks may be defined later. */
-DEFTREECODE (THUNK_DECL, "thunk_decl", "d", 0)
-
-/* A namespace declaration. */
-DEFTREECODE (NAMESPACE_DECL, "namespace_decl", "d", 0)
-
-/* A using declaration. DECL_INITIAL contains the specified scope.
- This is not an alias, but is later expanded into multiple aliases. */
-DEFTREECODE (USING_DECL, "using_decl", "d", 0)
-
-DEFTREECODE (LOOKUP_EXPR, "lookup_expr", "e", 2)
-DEFTREECODE (MODOP_EXPR, "modop_expr", "e", 3)
-DEFTREECODE (CAST_EXPR, "cast_expr", "1", 1)
-DEFTREECODE (REINTERPRET_CAST_EXPR, "reinterpret_cast_expr", "1", 1)
-DEFTREECODE (CONST_CAST_EXPR, "const_cast_expr", "1", 1)
-DEFTREECODE (STATIC_CAST_EXPR, "static_cast_expr", "1", 1)
-DEFTREECODE (DYNAMIC_CAST_EXPR, "dynamic_cast_expr", "1", 1)
-DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", "1", 1)
-DEFTREECODE (ARROW_EXPR, "arrow_expr", "e", 1)
-DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", "e", 2)
-DEFTREECODE (TYPEID_EXPR, "typeid_expr", "e", 1)
-
-DEFTREECODE (EXPR_STMT, "expr_stmt", "e", 1)
-DEFTREECODE (COMPOUND_STMT, "compound_stmt", "e", 1)
-DEFTREECODE (DECL_STMT, "decl_stmt", "e", 3)
-DEFTREECODE (IF_STMT, "if_stmt", "e", 3)
-DEFTREECODE (FOR_STMT, "for_stmt", "e", 4)
-DEFTREECODE (WHILE_STMT, "while_stmt", "e", 2)
-DEFTREECODE (DO_STMT, "do_stmt", "e", 2)
-DEFTREECODE (RETURN_STMT, "return_stmt", "e", 1)
-DEFTREECODE (BREAK_STMT, "break_stmt", "e", 0)
-DEFTREECODE (CONTINUE_STMT, "continue_stmt", "e", 0)
-DEFTREECODE (SWITCH_STMT, "switch_stmt", "e", 2)
-DEFTREECODE (GOTO_STMT, "goto_stmt", "e", 1)
-
-DEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", "e", 2)
-DEFTREECODE (CASE_LABEL, "case_label", "e", 2)
-DEFTREECODE (RETURN_INIT, "return_init", "e", 2)
-DEFTREECODE (TRY_BLOCK, "try_stmt", "e", 2)
-DEFTREECODE (HANDLER, "catch_stmt", "e", 2)
-
-DEFTREECODE (IDENTITY_CONV, "identity_conv", "e", 1)
-DEFTREECODE (LVALUE_CONV, "lvalue_conv", "e", 1)
-DEFTREECODE (QUAL_CONV, "qual_conv", "e", 1)
-DEFTREECODE (STD_CONV, "std_conv", "e", 1)
-DEFTREECODE (PTR_CONV, "ptr_conv", "e", 1)
-DEFTREECODE (PMEM_CONV, "pmem_conv", "e", 1)
-DEFTREECODE (BASE_CONV, "base_conv", "e", 1)
-DEFTREECODE (REF_BIND, "ref_bind", "e", 1)
-DEFTREECODE (USER_CONV, "user_conv", "e", 4)
-DEFTREECODE (AMBIG_CONV, "ambig_conv", "e", 1)
-DEFTREECODE (RVALUE_CONV, "rvalue_conv", "e", 1)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
deleted file mode 100644
index 31cc776a7c0..00000000000
--- a/gcc/cp/cp-tree.h
+++ /dev/null
@@ -1,2512 +0,0 @@
-/* Definitions for C++ parsing and type checking.
- Copyright (C) 1987, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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 _CP_TREE_H
-#define _CP_TREE_H
-
-#include "gansidecl.h"
-
-/* Language-dependent contents of an identifier. */
-
-struct lang_identifier
-{
- struct tree_identifier ignore;
- tree global_value, local_value;
- tree class_value;
- tree class_template_info;
- struct lang_id2 *x;
-};
-
-struct lang_id2
-{
- tree label_value, implicit_decl;
- tree type_desc, as_list, error_locus;
-};
-
-typedef struct
-{
- tree t;
- int new_type_flag;
-} flagged_type_tree;
-
-/* To identify to the debug emitters if it should pay attention to the
- flag `-Wtemplate-debugging'. */
-#define HAVE_TEMPLATES 1
-
-/* Macros for access to language-specific slots in an identifier. */
-
-#define IDENTIFIER_GLOBAL_VALUE(NODE) \
- (((struct lang_identifier *)(NODE))->global_value)
-#define IDENTIFIER_CLASS_VALUE(NODE) \
- (((struct lang_identifier *)(NODE))->class_value)
-#define IDENTIFIER_LOCAL_VALUE(NODE) \
- (((struct lang_identifier *)(NODE))->local_value)
-#define IDENTIFIER_TEMPLATE(NODE) \
- (((struct lang_identifier *)(NODE))->class_template_info)
-
-#define IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))
-#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)
-#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (TREE_TYPE (NODE) ? 1 : 0)
-
-#define LANG_ID_FIELD(NAME,NODE) \
- (((struct lang_identifier *)(NODE))->x \
- ? ((struct lang_identifier *)(NODE))->x->NAME : 0)
-#define SET_LANG_ID(NODE,VALUE,NAME) \
- (((struct lang_identifier *)(NODE))->x == 0 \
- ? ((struct lang_identifier *)(NODE))->x \
- = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
- ((struct lang_identifier *)(NODE))->x->NAME = (VALUE))
-
-#define IDENTIFIER_LABEL_VALUE(NODE) LANG_ID_FIELD(label_value, NODE)
-#define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \
- SET_LANG_ID(NODE, VALUE, label_value)
-
-#define IDENTIFIER_IMPLICIT_DECL(NODE) LANG_ID_FIELD(implicit_decl, NODE)
-#define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
- SET_LANG_ID(NODE, VALUE, implicit_decl)
-
-#define IDENTIFIER_AS_DESC(NODE) LANG_ID_FIELD(type_desc, NODE)
-#define SET_IDENTIFIER_AS_DESC(NODE,DESC) \
- SET_LANG_ID(NODE, DESC, type_desc)
-
-#define IDENTIFIER_AS_LIST(NODE) LANG_ID_FIELD(as_list, NODE)
-#define SET_IDENTIFIER_AS_LIST(NODE,LIST) \
- SET_LANG_ID(NODE, LIST, as_list)
-
-#define IDENTIFIER_ERROR_LOCUS(NODE) LANG_ID_FIELD(error_locus, NODE)
-#define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \
- SET_LANG_ID(NODE, VALUE, error_locus)
-
-
-#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE)
-
-/* Nonzero if this identifier is the prefix for a mangled C++ operator name. */
-#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)
-
-#define IDENTIFIER_TYPENAME_P(NODE) \
- (! strncmp (IDENTIFIER_POINTER (NODE), \
- IDENTIFIER_POINTER (ansi_opname[(int) TYPE_EXPR]), \
- IDENTIFIER_LENGTH (ansi_opname[(int) TYPE_EXPR])))
-
-/* Nonzero means reject anything that ANSI standard C forbids. */
-extern int pedantic;
-
-/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
-#define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
-
-/* Record in each node resulting from a binary operator
- what operator was specified for it. */
-#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
-
-/* Store a value in that field. */
-#define C_SET_EXP_ORIGINAL_CODE(exp, code) \
- (TREE_COMPLEXITY (exp) = (int)(code))
-
-/* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
- next exception handler. */
-extern tree exception_throw_decl;
-
-extern tree double_type_node, long_double_type_node, float_type_node;
-extern tree char_type_node, unsigned_char_type_node, signed_char_type_node;
-extern tree ptrdiff_type_node;
-
-extern tree short_integer_type_node, short_unsigned_type_node;
-extern tree long_integer_type_node, long_unsigned_type_node;
-extern tree long_long_integer_type_node, long_long_unsigned_type_node;
-extern tree unsigned_type_node;
-extern tree string_type_node, char_array_type_node, int_array_type_node;
-extern tree wchar_array_type_node;
-extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node;
-extern tree intQI_type_node, unsigned_intQI_type_node;
-extern tree intHI_type_node, unsigned_intHI_type_node;
-extern tree intSI_type_node, unsigned_intSI_type_node;
-extern tree intDI_type_node, unsigned_intDI_type_node;
-
-extern int current_function_returns_value;
-extern int current_function_returns_null;
-extern tree current_function_return_value;
-
-extern tree ridpointers[];
-extern tree ansi_opname[];
-extern tree ansi_assopname[];
-
-/* Nonzero means `$' can be in an identifier. */
-
-extern int dollars_in_ident;
-
-/* Nonzero means allow type mismatches in conditional expressions;
- just make their values `void'. */
-
-extern int flag_cond_mismatch;
-
-/* Nonzero means don't recognize the keyword `asm'. */
-
-extern int flag_no_asm;
-
-/* For cross referencing. */
-
-extern int flag_gnu_xref;
-
-/* For environments where you can use GNU binutils (as, ld in particular). */
-
-extern int flag_gnu_binutils;
-
-/* Nonzero means ignore `#ident' directives. */
-
-extern int flag_no_ident;
-
-/* Nonzero means warn about implicit declarations. */
-
-extern int warn_implicit;
-
-/* Nonzero means warn when all ctors or dtors are private, and the class
- has no friends. */
-
-extern int warn_ctor_dtor_privacy;
-
-/* Nonzero means warn about function definitions that default the return type
- or that use a null return and have a return-type other than void. */
-
-extern int warn_return_type;
-
-/* Nonzero means give string constants the type `const char *'
- to get extra warnings from them. These warnings will be too numerous
- to be useful, except in thoroughly ANSIfied programs. */
-
-extern int warn_write_strings;
-
-/* Nonzero means warn about sizeof(function) or addition/subtraction
- of function pointers. */
-
-extern int warn_pointer_arith;
-
-/* Nonzero means warn about suggesting putting in ()'s. */
-
-extern int warn_parentheses;
-
-/* Nonzero means warn about multiple (redundant) decls for the same single
- variable or function. */
-
-extern int warn_redundant_decls;
-
-/* Warn if initializer is not completely bracketed. */
-
-extern int warn_missing_braces;
-
-/* Warn about comparison of signed and unsigned values. */
-
-extern int warn_sign_compare;
-
-/* Warn about a subscript that has type char. */
-
-extern int warn_char_subscripts;
-
-/* Nonzero means warn about pointer casts that can drop a type qualifier
- from the pointer target type. */
-
-extern int warn_cast_qual;
-
-/* Warn about *printf or *scanf format/argument anomalies. */
-
-extern int warn_format;
-
-/* Nonzero means warn about non virtual destructors in classes that have
- virtual functions. */
-
-extern int warn_nonvdtor;
-
-/* Non-zero means warn when we convert a pointer to member function
- into a pointer to (void or function). */
-
-extern int warn_pmf2ptr;
-
-/* Non-zero means warn when a function is declared extern and later inline. */
-extern int warn_extern_inline;
-
-/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
-
-extern int flag_signed_bitfields;
-
-/* 3 means write out only virtuals function tables `defined'
- in this implementation file.
- 2 means write out only specific virtual function tables
- and give them (C) public access.
- 1 means write out virtual function tables and give them
- (C) public access.
- 0 means write out virtual function tables and give them
- (C) static access (default).
- -1 means declare virtual function tables extern. */
-
-extern int write_virtuals;
-
-/* True for more efficient but incompatible (not not fully tested)
- vtable implementation (using thunks).
- 0 is old behavior; 1 is new behavior. */
-extern int flag_vtable_thunks;
-
-/* INTERFACE_ONLY nonzero means that we are in an "interface"
- section of the compiler. INTERFACE_UNKNOWN nonzero means
- we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN
- is zero and INTERFACE_ONLY is zero, it means that we are responsible
- for exporting definitions that others might need. */
-extern int interface_only, interface_unknown;
-
-/* Nonzero means we should attempt to elide constructors when possible. */
-
-extern int flag_elide_constructors;
-
-/* Nonzero means enable obscure ANSI features and disable GNU extensions
- that might cause ANSI-compliant code to be miscompiled. */
-
-extern int flag_ansi;
-
-/* Nonzero means do argument matching for overloading according to the
- ANSI rules, rather than what g++ used to believe to be correct. */
-
-extern int flag_ansi_overloading;
-
-/* Nonzero means recognize and handle signature language constructs. */
-
-extern int flag_handle_signatures;
-
-/* Nonzero means that member functions defined in class scope are
- inline by default. */
-
-extern int flag_default_inline;
-
-/* C++ language-specific tree codes. */
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
-enum cplus_tree_code {
- __DUMMY = LAST_AND_UNUSED_TREE_CODE,
-#include "cp-tree.def"
- LAST_CPLUS_TREE_CODE
-};
-#undef DEFTREECODE
-
-enum languages { lang_c, lang_cplusplus };
-
-/* Macros to make error reporting functions' lives easier. */
-#define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
-#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
-#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
-
-#define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
-#define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
-
-/* The _DECL for this _TYPE. */
-#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
-
-#define IS_AGGR_TYPE(t) (TYPE_LANG_FLAG_5 (t))
-#define IS_AGGR_TYPE_CODE(t) (t == RECORD_TYPE || t == UNION_TYPE)
-#define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
- (TREE_CODE (TYPE1) == TREE_CODE (TYPE2) \
- && IS_AGGR_TYPE (TYPE1)&IS_AGGR_TYPE (TYPE2))
-#define IS_OVERLOAD_TYPE(t) \
- (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
-
-/* In a *_TYPE, nonzero means a built-in type. */
-#define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6(NODE)
-
-#define DELTA_FROM_VTABLE_ENTRY(ENTRY) \
- (!flag_vtable_thunks ? \
- TREE_VALUE (CONSTRUCTOR_ELTS (ENTRY)) \
- : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? integer_zero_node \
- : build_int_2 (THUNK_DELTA (TREE_OPERAND ((ENTRY), 0)), 0))
-
-/* Virtual function addresses can be gotten from a virtual function
- table entry using this macro. */
-#define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
- (!flag_vtable_thunks ? \
- TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \
- : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? (ENTRY) \
- : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0)))
-#define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \
- (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) = (VALUE))
-#define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))))
-#define PROMOTES_TO_AGGR_TYPE(NODE,CODE) \
- (((CODE) == TREE_CODE (NODE) \
- && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
- || IS_AGGR_TYPE (NODE))
-
-/* Nonzero iff TYPE is uniquely derived from PARENT. Under MI, PARENT can
- be an ambiguous base class of TYPE, and this macro will be false. */
-#define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0)
-#define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0)
-#define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0)
-#define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1)
-
-/* Statistics show that while the GNU C++ compiler may generate
- thousands of different types during a compilation run, it
- generates relatively few (tens) of classtypes. Because of this,
- it is not costly to store a generous amount of information
- in classtype nodes. This struct must fill out to a multiple of 4 bytes. */
-struct lang_type
-{
- struct
- {
- unsigned has_type_conversion : 1;
- unsigned has_int_conversion : 1;
- unsigned has_float_conversion : 1;
- unsigned has_init_ref : 1;
- unsigned gets_init_aggr : 1;
- unsigned has_assignment : 1;
- unsigned has_default_ctor : 1;
- unsigned uses_multiple_inheritance : 1;
-
- unsigned has_nonpublic_ctor : 2;
- unsigned has_nonpublic_assign_ref : 2;
- unsigned const_needs_init : 1;
- unsigned ref_needs_init : 1;
- unsigned has_const_assign_ref : 1;
- unsigned vtable_needs_writing : 1;
-
- unsigned has_assign_ref : 1;
- unsigned gets_new : 2;
- unsigned gets_delete : 2;
- unsigned has_call_overloaded : 1;
- unsigned has_array_ref_overloaded : 1;
- unsigned has_arrow_overloaded : 1;
-
- unsigned local_typedecls : 1;
- unsigned interface_only : 1;
- unsigned interface_unknown : 1;
- unsigned needs_virtual_reinit : 1;
- unsigned vec_delete_takes_size : 1;
- unsigned declared_class : 1;
- unsigned being_defined : 1;
- unsigned redefined : 1;
-
- unsigned no_globalize : 1;
- unsigned marked : 1;
- unsigned marked2 : 1;
- unsigned marked3 : 1;
- unsigned marked4 : 1;
- unsigned marked5 : 1;
- unsigned marked6 : 1;
- unsigned debug_requested : 1;
-
- unsigned use_template : 2;
- unsigned has_method_call_overloaded : 1;
- unsigned private_attr : 1;
- unsigned got_semicolon : 1;
- unsigned ptrmemfunc_flag : 1;
- unsigned is_signature : 1;
- unsigned is_signature_pointer : 1;
-
- unsigned is_signature_reference : 1;
- unsigned has_opaque_typedecls : 1;
- unsigned sigtable_has_been_generated : 1;
- unsigned was_anonymous : 1;
- unsigned has_real_assignment : 1;
- unsigned has_real_assign_ref : 1;
- unsigned has_const_init_ref : 1;
- unsigned has_complex_init_ref : 1;
-
- unsigned has_complex_assign_ref : 1;
- unsigned has_abstract_assign_ref : 1;
- unsigned non_aggregate : 1;
-
- /* The MIPS compiler gets it wrong if this struct also
- does not fill out to a multiple of 4 bytes. Add a
- member `dummy' with new bits if you go over the edge. */
- unsigned dummy : 21;
-
- unsigned n_vancestors : 16;
- } type_flags;
-
- int cid;
- int n_ancestors;
- int vsize;
- int max_depth;
- int vfield_parent;
-
- union tree_node *vbinfo[2];
- union tree_node *baselink_vec;
- union tree_node *vfields;
- union tree_node *vbases;
- union tree_node *vbase_size;
-
- union tree_node *tags;
- char *memoized_table_entry;
-
- union tree_node *search_slot;
-
-#ifdef ONLY_INT_FIELDS
- unsigned int mode : 8;
-#else
- enum machine_mode mode : 8;
-#endif
-
- unsigned char size_unit;
- unsigned char align;
- unsigned char sep_unit;
-
- union tree_node *sep;
- union tree_node *size;
-
- union tree_node *base_init_list;
- union tree_node *abstract_virtuals;
- union tree_node *as_list;
- union tree_node *id_as_list;
- union tree_node *binfo_as_list;
- union tree_node *friend_classes;
-
- char *mi_matrix;
-
- union tree_node *rtti;
-
- union tree_node *methods;
-
- union tree_node *signature;
- union tree_node *signature_pointer_to;
- union tree_node *signature_reference_to;
-
- union tree_node *template_info;
-
- int linenum;
-};
-
-#define CLASSTYPE_SOURCE_LINE(NODE) (TYPE_LANG_SPECIFIC(NODE)->linenum)
-
-/* Indicates whether or not (and how) a template was expanded for this class.
- 0=no information yet/non-template class
- 1=implicit template instantiation
- 2=explicit template specialization
- 3=explicit template instantiation */
-#define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.use_template)
-
-/* Fields used for storing information before the class is defined.
- After the class is defined, these fields hold other information. */
-
-/* List of friends which were defined inline in this class definition. */
-#define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
-
-/* Nonzero for _CLASSTYPE means that the _CLASSTYPE either has
- a special meaning for the assignment operator ("operator="),
- or one of its fields (or base members) has a special meaning
- defined. */
-#define TYPE_HAS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assignment)
-#define TYPE_HAS_REAL_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assignment)
-
-/* Nonzero for _CLASSTYPE means that operator new and delete are defined,
- respectively. */
-#define TYPE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
-#define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete)
-#define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
-
-/* Nonzero for _CLASSTYPE means that operator vec delete is defined and
- takes the optional size_t argument. */
-#define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \
- (TYPE_LANG_SPECIFIC(NODE)->type_flags.vec_delete_takes_size)
-#define TYPE_VEC_NEW_USES_COOKIE(NODE) \
- (TYPE_NEEDS_DESTRUCTOR (NODE) \
- || (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
-
-/* Nonzero for TREE_LIST or _TYPE node means that this node is class-local. */
-#define TREE_NONLOCAL_FLAG(NODE) (TREE_LANG_FLAG_0 (NODE))
-
-/* Nonzero for a _CLASSTYPE node which we know to be private. */
-#define TYPE_PRIVATE_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.private_attr)
-
-/* Nonzero means that this _CLASSTYPE node defines ways of converting
- itself to other types. */
-#define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
-
-/* Nonzero means that this _CLASSTYPE node can convert itself to an
- INTEGER_TYPE. */
-#define TYPE_HAS_INT_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_int_conversion)
-
-/* Nonzero means that this _CLASSTYPE node can convert itself to an
- REAL_TYPE. */
-#define TYPE_HAS_REAL_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_float_conversion)
-
-/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
-#define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
-#define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
-
-/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
-#define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
-#define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_init_ref)
-
-/* Nonzero means that this _CLASSTYPE node has an X(X ...) constructor.
- Note that there must be other arguments, or this constructor is flagged
- as being erroneous. */
-#define TYPE_GETS_INIT_AGGR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_aggr)
-
-/* Nonzero means that this type is being defined. I.e., the left brace
- starting the definition of this type has been seen. */
-#define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.being_defined)
-/* Nonzero means that this type has been redefined. In this case, if
- convenient, don't reprocess any methods that appear in its redefinition. */
-#define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.redefined)
-
-/* Nonzero means that this _CLASSTYPE node overloads the method call
- operator. In this case, all method calls go through `operator->()(...). */
-#define TYPE_OVERLOADS_METHOD_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_method_call_overloaded)
-
-/* Nonzero means that this type is a signature. */
-# define IS_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)?TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature:0)
-# define SET_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=1)
-# define CLEAR_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=0)
-
-/* Nonzero means that this type is a signature pointer type. */
-# define IS_SIGNATURE_POINTER(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_pointer)
-
-/* Nonzero means that this type is a signature reference type. */
-# define IS_SIGNATURE_REFERENCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_reference)
-
-/* Nonzero means that this signature contains opaque type declarations. */
-#define SIGNATURE_HAS_OPAQUE_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_opaque_typedecls)
-
-/* Nonzero means that a signature table has been generated
- for this signature. */
-#define SIGTABLE_HAS_BEEN_GENERATED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.sigtable_has_been_generated)
-
-/* If NODE is a class, this is the signature type that contains NODE's
- signature after it has been computed using sigof(). */
-#define CLASSTYPE_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
-
-/* If NODE is a signature pointer or signature reference, this is the
- signature type the pointer/reference points to. */
-#define SIGNATURE_TYPE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
-
-/* If NODE is a signature, this is a vector of all methods defined
- in the signature or in its base types together with their default
- implementations. */
-#define SIGNATURE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
-
-/* If NODE is a signature, this is the _TYPE node that contains NODE's
- signature pointer type. */
-#define SIGNATURE_POINTER_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_pointer_to)
-
-/* If NODE is a signature, this is the _TYPE node that contains NODE's
- signature reference type. */
-#define SIGNATURE_REFERENCE_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_reference_to)
-
-/* The is the VAR_DECL that contains NODE's rtti. */
-#define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti)
-
-/* Nonzero means that this _CLASSTYPE node overloads operator(). */
-#define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)
-
-/* Nonzero means that this _CLASSTYPE node overloads operator[]. */
-#define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)
-
-/* Nonzero means that this _CLASSTYPE node overloads operator->. */
-#define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_arrow_overloaded)
-
-/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
- multiple inheritance. If this is 0 for the root of a type
- hierarchy, then we can use more efficient search techniques. */
-#define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)
-
-/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
- virtual base classes. If this is 0 for the root of a type
- hierarchy, then we can use more efficient search techniques. */
-#define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE))
-
-/* List of lists of member functions defined in this class. */
-#define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods)
-
-/* The first type conversion operator in the class (the others can be
- searched with TREE_CHAIN), or the first non-constructor function if
- there are no type conversion operators. */
-#define CLASSTYPE_FIRST_CONVERSION(NODE) \
- TREE_VEC_LENGTH (CLASSTYPE_METHOD_VEC (NODE)) > 2 \
- ? TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), 2) \
- : NULL_TREE;
-
-/* Pointer from any member function to the head of the list of
- member functions of the type that member function belongs to. */
-#define CLASSTYPE_BASELINK_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->baselink_vec)
-
-/* Mark bits for depth-first and breath-first searches. */
-#define CLASSTYPE_MARKED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked)
-#define CLASSTYPE_MARKED2(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2)
-#define CLASSTYPE_MARKED3(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3)
-#define CLASSTYPE_MARKED4(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4)
-#define CLASSTYPE_MARKED5(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5)
-#define CLASSTYPE_MARKED6(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked6)
-/* Macros to modify the above flags */
-#define SET_CLASSTYPE_MARKED(NODE) (CLASSTYPE_MARKED(NODE) = 1)
-#define CLEAR_CLASSTYPE_MARKED(NODE) (CLASSTYPE_MARKED(NODE) = 0)
-#define SET_CLASSTYPE_MARKED2(NODE) (CLASSTYPE_MARKED2(NODE) = 1)
-#define CLEAR_CLASSTYPE_MARKED2(NODE) (CLASSTYPE_MARKED2(NODE) = 0)
-#define SET_CLASSTYPE_MARKED3(NODE) (CLASSTYPE_MARKED3(NODE) = 1)
-#define CLEAR_CLASSTYPE_MARKED3(NODE) (CLASSTYPE_MARKED3(NODE) = 0)
-#define SET_CLASSTYPE_MARKED4(NODE) (CLASSTYPE_MARKED4(NODE) = 1)
-#define CLEAR_CLASSTYPE_MARKED4(NODE) (CLASSTYPE_MARKED4(NODE) = 0)
-#define SET_CLASSTYPE_MARKED5(NODE) (CLASSTYPE_MARKED5(NODE) = 1)
-#define CLEAR_CLASSTYPE_MARKED5(NODE) (CLASSTYPE_MARKED5(NODE) = 0)
-#define SET_CLASSTYPE_MARKED6(NODE) (CLASSTYPE_MARKED6(NODE) = 1)
-#define CLEAR_CLASSTYPE_MARKED6(NODE) (CLASSTYPE_MARKED6(NODE) = 0)
-
-#define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
-
-/* If this class has any bases, this is the number of the base class from
- which our VFIELD is based, -1 otherwise. If this class has no base
- classes, this is not used.
- In D : B1, B2, PARENT would be 0, if D's vtable came from B1,
- 1, if D's vtable came from B2. */
-#define CLASSTYPE_VFIELD_PARENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
-
-/* Remove when done merging. */
-#define CLASSTYPE_VFIELD(NODE) TYPE_VFIELD(NODE)
-
-/* The number of virtual functions defined for this
- _CLASSTYPE node. */
-#define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
-/* The virtual base classes that this type uses. */
-#define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
-/* The virtual function pointer fields that this type contains. */
-#define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
-
-/* Number of baseclasses defined for this type.
- 0 means no base classes. */
-#define CLASSTYPE_N_BASECLASSES(NODE) \
- (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
-
-/* Memoize the number of super classes (base classes) tha this node
- has. That way we can know immediately (albeit conservatively how
- large a multiple-inheritance matrix we need to build to find
- derivation information. */
-#define CLASSTYPE_N_SUPERCLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_ancestors)
-#define CLASSTYPE_N_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.n_vancestors)
-
-/* Record how deep the inheritance is for this class so `void*' conversions
- are less favorable than a conversion to the most base type. */
-#define CLASSTYPE_MAX_DEPTH(NODE) (TYPE_LANG_SPECIFIC(NODE)->max_depth)
-
-/* Used for keeping search-specific information. Any search routine
- which uses this must define what exactly this slot is used for. */
-#define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
-
-/* Entry for keeping memoization tables for this type to
- hopefully speed up search routines. Since it is a pointer,
- it can mean almost anything. */
-#define CLASSTYPE_MTABLE_ENTRY(NODE) (TYPE_LANG_SPECIFIC(NODE)->memoized_table_entry)
-
-/* This is the total size of the baseclasses defined for this type.
- Needed because it is desirable to layout such information
- before beginning to process the class itself, and we
- don't want to compute it second time when actually laying
- out the type for real. */
-#define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
-#define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->size_unit)
-#define CLASSTYPE_MODE(NODE) (TYPE_LANG_SPECIFIC(NODE)->mode)
-#define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
-
-/* This is the space needed for virtual base classes. NULL if
- there are no virtual basetypes. */
-#define CLASSTYPE_VBASE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbase_size)
-
-/* A cons list of structure elements which either have constructors
- to be called, or virtual function table pointers which
- need initializing. Depending on what is being initialized,
- the TREE_PURPOSE and TREE_VALUE fields have different meanings:
-
- Member initialization: <FIELD_DECL, TYPE>
- Base class construction: <NULL_TREE, BASETYPE>
- Base class initialization: <BASE_INITIALIZATION, THESE_INITIALIZATIONS>
- Whole type: <MEMBER_INIT, BASE_INIT>. */
-#define CLASSTYPE_BASE_INIT_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->base_init_list)
-
-/* A cons list of virtual functions which cannot be inherited by
- derived classes. When deriving from this type, the derived
- class must provide its own definition for each of these functions. */
-#define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
-
-/* Nonzero means that this aggr type has been `closed' by a semicolon. */
-#define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon)
-
-/* Nonzero means that the main virtual function table pointer needs to be
- set because base constructors have placed the wrong value there.
- If this is zero, it means that they placed the right value there,
- and there is no need to change it. */
-#define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit)
-
-/* Nonzero means that if this type has virtual functions, that
- the virtual function table will be written out. */
-#define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing)
-
-/* Nonzero means that this type defines its own local type declarations. */
-#define CLASSTYPE_LOCAL_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.local_typedecls)
-
-/* Nonzero means that this type has an X() constructor. */
-#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor)
-
-/* Nonzero means the type declared a ctor as private or protected. We
- use this to make sure we don't try to generate a copy ctor for a
- class that has a member of type NODE. */
-#define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_ctor)
-
-/* Ditto, for operator=. */
-#define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_assign_ref)
-
-/* Many routines need to cons up a list of basetypes for access
- checking. This field contains a TREE_LIST node whose TREE_VALUE
- is the main variant of the type, and whose TREE_VIA_PUBLIC
- and TREE_VIA_VIRTUAL bits are correctly set. */
-#define CLASSTYPE_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_list)
-/* Same, but cache a list whose value is the name of this type. */
-#define CLASSTYPE_ID_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->id_as_list)
-/* Same, but cache a list whose value is the binfo of this type. */
-#define CLASSTYPE_BINFO_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->binfo_as_list)
-
-/* A list of class types with which this type is a friend. */
-#define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
-
-/* Keep an inheritance lattice around so we can quickly tell whether
- a type is derived from another or not. */
-#define CLASSTYPE_MI_MATRIX(NODE) (TYPE_LANG_SPECIFIC(NODE)->mi_matrix)
-
-/* Say whether this node was declared as a "class" or a "struct". */
-#define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
-/* whether this can be globalized. */
-#define CLASSTYPE_NO_GLOBALIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.no_globalize)
-
-/* Nonzero if this class has const members which have no specified initialization. */
-#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
-
-/* Nonzero if this class has ref members which have no specified initialization. */
-#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)
-
-/* Nonzero if this class is included from a header file which employs
- `#pragma interface', and it is not included in its implementation file. */
-#define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only)
-
-/* Same as above, but for classes whose purpose we do not know. */
-#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown)
-#define CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown == 0)
-#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = !!(X))
-#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 1)
-#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 0)
-
-/* Nonzero if a _DECL node requires us to output debug info for this class. */
-#define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.debug_requested)
-
-/* Additional macros for inheritance information. */
-
-#define CLASSTYPE_VBINFO(NODE,VIA_PUBLIC) \
- (TYPE_LANG_SPECIFIC (NODE)->vbinfo[VIA_PUBLIC])
-
-/* When following an binfo-specific chain, this is the cumulative
- via-public flag. */
-#define BINFO_VIA_PUBLIC(NODE) TREE_LANG_FLAG_5 (NODE)
-
-/* When building a matrix to determine by a single lookup
- whether one class is derived from another or not,
- this field is the index of the class in the table. */
-#define CLASSTYPE_CID(NODE) (TYPE_LANG_SPECIFIC(NODE)->cid)
-#define BINFO_CID(NODE) CLASSTYPE_CID(BINFO_TYPE(NODE))
-
-/* Nonzero means marked by DFS or BFS search, including searches
- by `get_binfo' and `get_base_distance'. */
-#define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE))
-/* Macros needed because of C compilers that don't allow conditional
- expressions to be lvalues. Grr! */
-#define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1))
-#define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0))
-
-/* Nonzero means marked in building initialization list. */
-#define BINFO_BASEINIT_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
-/* Modifier macros */
-#define SET_BINFO_BASEINIT_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
-#define CLEAR_BINFO_BASEINIT_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
-
-/* Nonzero means marked in search through virtual inheritance hierarchy. */
-#define BINFO_VBASE_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
-/* Modifier macros */
-#define SET_BINFO_VBASE_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
-#define CLEAR_BINFO_VBASE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
-
-/* Nonzero means marked in search for members or member functions. */
-#define BINFO_FIELDS_MARKED(NODE) \
- (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)):TREE_LANG_FLAG_2(NODE))
-#define SET_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=1))
-#define CLEAR_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=0))
-
-/* Nonzero means that this class is on a path leading to a new vtable. */
-#define BINFO_VTABLE_PATH_MARKED(NODE) \
- (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE))
-#define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
-#define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
-
-/* Nonzero means that this class has a new vtable. */
-#define BINFO_NEW_VTABLE_MARKED(NODE) \
- (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):TREE_LANG_FLAG_4(NODE))
-#define SET_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=1))
-#define CLEAR_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=0))
-
-/* Nonzero means this class has initialized its virtual baseclasses. */
-#define BINFO_VBASE_INIT_MARKED(NODE) \
- (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED5(BINFO_TYPE(NODE)):TREE_LANG_FLAG_5(NODE))
-#define SET_BINFO_VBASE_INIT_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED5(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_5(NODE)=1))
-#define CLEAR_BINFO_VBASE_INIT_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED5(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_5(NODE)=0))
-
-/* Accessor macros for the vfield slots in structures. */
-
-/* Get the assoc info that caused this vfield to exist. */
-#define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
-
-/* Get that same information as a _TYPE. */
-#define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
-
-/* Get the value of the top-most type dominating the non-`normal' vfields. */
-#define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
-
-/* Get the value of the top-most type that's `normal' for the vfield. */
-#define VF_NORMAL_VALUE(NODE) TREE_TYPE (NODE)
-
-/* Nonzero for TREE_LIST node means that this list of things
- is a list of parameters, as opposed to a list of expressions. */
-#define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
-
-/* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
- this type can raise. */
-#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
-
-/* The binding level associated with the namespace. */
-#define NAMESPACE_LEVEL(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.level)
-
-struct lang_decl_flags
-{
-#ifdef ONLY_INT_FIELDS
- int language : 8;
-#else
- enum languages language : 8;
-#endif
-
- unsigned operator_attr : 1;
- unsigned constructor_attr : 1;
- unsigned returns_first_arg : 1;
- unsigned preserves_first_arg : 1;
- unsigned friend_attr : 1;
- unsigned static_function : 1;
- unsigned const_memfunc : 1;
- unsigned volatile_memfunc : 1;
-
- unsigned abstract_virtual : 1;
- unsigned permanent_attr : 1 ;
- unsigned constructor_for_vbase_attr : 1;
- unsigned mutable_flag : 1;
- unsigned is_default_implementation : 1;
- unsigned saved_inline : 1;
- unsigned use_template : 2;
-
- unsigned c_static : 1;
- unsigned nonconverting : 1;
- unsigned declared_inline : 1;
- unsigned not_really_extern : 1;
- unsigned dummy : 4;
-
- tree access;
- tree context;
- tree memfunc_pointer_to;
- tree template_info;
- struct binding_level *level;
-};
-
-struct lang_decl
-{
- struct lang_decl_flags decl_flags;
-
- tree main_decl_variant;
- struct pending_inline *pending_inline_info;
- tree chain;
-};
-
-/* Non-zero if NODE is a _DECL with TREE_READONLY set. */
-#define TREE_READONLY_DECL_P(NODE) \
- (TREE_READONLY (NODE) && TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd')
-
-/* Non-zero iff DECL is memory-based. The DECL_RTL of
- certain const variables might be a CONST_INT, or a REG
- in some cases. We cannot use `memory_operand' as a test
- here because on most RISC machines, a variable's address
- is not, by itself, a legitimate address. */
-#define DECL_IN_MEMORY_P(NODE) \
- (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM)
-
-/* For FUNCTION_DECLs: return the language in which this decl
- was declared. */
-#define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
-
-/* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
-#define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
-/* For FUNCTION_DECLs: nonzero means that this function is a constructor
- for an object with virtual baseclasses. */
-#define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
-
-/* For FUNCTION_DECLs: nonzero means that this function is a default
- implementation of a signature method. */
-#define IS_DEFAULT_IMPLEMENTATION(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_default_implementation)
-
-/* For FUNCTION_DECLs: nonzero means that the constructor
- is known to return a non-zero `this' unchanged. */
-#define DECL_RETURNS_FIRST_ARG(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.returns_first_arg)
-
-/* Nonzero for FUNCTION_DECL means that this constructor is known to
- not make any assignment to `this', and therefore can be trusted
- to return it unchanged. Otherwise, we must re-assign `current_class_ptr'
- after performing base initializations. */
-#define DECL_PRESERVES_THIS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.preserves_first_arg)
-
-/* Nonzero for _DECL means that this decl appears in (or will appear
- in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
- detecting circularity in case members are multiply defined. In the
- case of a VAR_DECL, it is also used to determine how program storage
- should be allocated. */
-#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE))
-
-/* Nonzero for FUNCTION_DECL means that this decl is just a
- friend declaration, and should not be added to the list of
- member functions for this class. */
-#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
-
-/* Nonzero for FUNCTION_DECL means that this decl is a static
- member function. */
-#define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
-
-/* Nonzero for a class member means that it is shared between all objects
- of that class. */
-#define SHARED_MEMBER_P(NODE) \
- (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \
- || TREE_CODE (NODE) == CONST_DECL)
-
-/* Nonzero for FUNCTION_DECL means that this decl is a member function
- (static or non-static). */
-#define DECL_FUNCTION_MEMBER_P(NODE) \
- (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE || DECL_STATIC_FUNCTION_P (NODE))
-
-/* Nonzero for FUNCTION_DECL means that this member function
- has `this' as const X *const. */
-#define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
-
-/* Nonzero for FUNCTION_DECL means that this member function
- has `this' as volatile X *const. */
-#define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
-
-/* Nonzero for _DECL means that this member object type
- is mutable. */
-#define DECL_MUTABLE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
-
-/* Nonzero for _DECL means that this constructor is a non-converting
- constructor. */
-#define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting)
-
-/* Nonzero for FUNCTION_DECL means that this member function
- exists as part of an abstract class's interface. */
-#define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
-
-/* Nonzero if allocated on permanent_obstack. */
-#define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr)
-
-/* The _TYPE context in which this _DECL appears. This field holds the
- class where a virtual function instance is actually defined, and the
- lexical scope of a friend function defined in a class body. */
-#define DECL_CLASS_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.context)
-#define DECL_REAL_CONTEXT(NODE) \
- ((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \
- ? DECL_CLASS_CONTEXT (NODE) : DECL_CONTEXT (NODE))
-
-/* For a FUNCTION_DECL: the chain through which the next method
- with the same name is found. We now use TREE_CHAIN to
- walk through the methods in order of declaration. */
-#if 1
-#define DECL_CHAIN(NODE) (DECL_LANG_SPECIFIC(NODE)->chain)
-#else
-#define DECL_CHAIN(NODE) (TREE_CHAIN (NODE))
-#endif
-
-/* In a VAR_DECL for a variable declared in a for statement,
- this is the shadowed (local) variable. */
-#define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(NODE)
-
-/* Points back to the decl which caused this lang_decl to be allocated. */
-#define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
-
-/* For a FUNCTION_DECL: if this function was declared inline inside of
- a class declaration, this is where the text for the function is
- squirreled away. */
-#define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
-
-/* True if on the saved_inlines (see decl2.c) list. */
-#define DECL_SAVED_INLINE(DECL) \
- (DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline)
-
-/* For a FUNCTION_DECL: if this function was declared inside a signature
- declaration, this is the corresponding member function pointer that was
- created for it. */
-#define DECL_MEMFUNC_POINTER_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
-
-/* For a FIELD_DECL: this points to the signature member function from
- which this signature member function pointer was created. */
-#define DECL_MEMFUNC_POINTING_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
-
-/* For a VAR_DECL or FUNCTION_DECL: template-specific information. */
-#define DECL_TEMPLATE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.template_info)
-#define CLASSTYPE_TEMPLATE_INFO(NODE) (TYPE_LANG_SPECIFIC(NODE)->template_info)
-#define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
-#define TI_ARGS(NODE) (TREE_VALUE (NODE))
-#define TI_USES_TEMPLATE_PARMS(NODE) TREE_LANG_FLAG_0 (NODE)
-#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
-#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
-#define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
-#define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
-#define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
-
-#define DECL_SAVED_TREE(NODE) DECL_MEMFUNC_POINTER_TO (NODE)
-#define COMPOUND_STMT_NO_SCOPE(NODE) TREE_LANG_FLAG_0 (NODE)
-#define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
-#define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
-#define DELETE_EXPR_USE_VEC(NODE) TREE_LANG_FLAG_1 (NODE)
-#define LOOKUP_EXPR_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
-
-/* For a TREE_LIST node representing a function parm type and its default arg,
- did the default arg come from a template? */
-#define PARM_DEFAULT_FROM_TEMPLATE(NODE) TREE_LANG_FLAG_0 (NODE)
-
-/* Nonzero in INT_CST means that this int is negative by dint of
- using a twos-complement negated operand. */
-#define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE))
-
-/* Nonzero in any kind of _EXPR or _REF node means that it is a call
- to a storage allocation routine. If, later, alternate storage
- is found to hold the object, this call can be ignored. */
-#define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_1 (NODE))
-
-/* Nonzero in any kind of _TYPE that uses multiple inheritance
- or virtual baseclasses. */
-#define TYPE_USES_COMPLEX_INHERITANCE(NODE) (TREE_LANG_FLAG_1 (NODE))
-
-#if 0 /* UNUSED */
-/* Nonzero in IDENTIFIER_NODE means that this name is not the name the user
- gave; it's a DECL_NESTED_TYPENAME. Someone may want to set this on
- mangled function names, too, but it isn't currently. */
-#define TREE_MANGLED(NODE) (TREE_LANG_FLAG_0 (NODE))
-#endif
-
-#if 0 /* UNUSED */
-/* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
- should be looked up in a non-standard way. */
-#define DECL_OVERLOADED(NODE) (FOO)
-#endif
-
-/* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
- For a FUNCTION_DECL, this is when the function is a virtual function.
- For a VAR_DECL, this is when the variable is a virtual function table.
- For a FIELD_DECL, when the field is the field for the virtual function table.
- For an IDENTIFIER_NODE, nonzero if any function with this name
- has been declared virtual.
-
- For a _TYPE if it uses virtual functions (or is derived from
- one that does). */
-#define TYPE_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
-
-#if 0
-/* Same, but tells if this field is private in current context. */
-#define DECL_PRIVATE(NODE) (FOO)
-
-/* Same, but tells if this field is private in current context. */
-#define DECL_PROTECTED(NODE) (DECL_LANG_FLAG_6 (NODE))
-
-#define DECL_PUBLIC(NODE) (DECL_LANG_FLAG_7 (NODE))
-#endif
-
-extern int flag_new_for_scope;
-
-/* This flag is true of a local VAR_DECL if it was declared in a for
- statement, but we are no longer in the scope of the for. */
-#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (NODE)
-
-/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
- if we already emitted a warning about using it. */
-#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (NODE)
-
-/* This _DECL represents a compiler-generated entity. */
-#define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
-
-/* Record whether a typedef for type `int' was actually `signed int'. */
-#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
-
-/* Nonzero if the type T promotes to itself.
- ANSI C states explicitly the list of types that promote;
- in particular, short promotes to int even if they have the same width. */
-#define C_PROMOTING_INTEGER_TYPE_P(t) \
- (TREE_CODE ((t)) == INTEGER_TYPE \
- && (TYPE_MAIN_VARIANT (t) == char_type_node \
- || TYPE_MAIN_VARIANT (t) == signed_char_type_node \
- || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \
- || TYPE_MAIN_VARIANT (t) == short_integer_type_node \
- || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
-
-#define INTEGRAL_CODE_P(CODE) \
- (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE)
-#define ARITHMETIC_TYPE_P(TYPE) (INTEGRAL_TYPE_P (TYPE) || FLOAT_TYPE_P (TYPE))
-
-/* Mark which labels are explicitly declared.
- These may be shadowed, and may be referenced from nested functions. */
-#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
-
-/* Record whether a type or decl was written with nonconstant size.
- Note that TYPE_SIZE may have simplified to a constant. */
-#define C_TYPE_VARIABLE_SIZE(type) TREE_LANG_FLAG_4 (type)
-#define C_DECL_VARIABLE_SIZE(type) DECL_LANG_FLAG_8 (type)
-
-/* Nonzero for _TYPE means that the _TYPE defines
- at least one constructor. */
-#define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
-
-/* When appearing in an INDIRECT_REF, it means that the tree structure
- underneath is actually a call to a constructor. This is needed
- when the constructor must initialize local storage (which can
- be automatically destroyed), rather than allowing it to allocate
- space from the heap.
-
- When appearing in a SAVE_EXPR, it means that underneath
- is a call to a constructor.
-
- When appearing in a CONSTRUCTOR, it means that it was
- a GNU C constructor expression.
-
- When appearing in a FIELD_DECL, it means that this field
- has been duly initialized in its constructor. */
-#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
-
-#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
- && CONSTRUCTOR_ELTS (NODE) == NULL_TREE)
-
-/* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
- Used to generate more helpful error message in case somebody
- tries to take its address. */
-#define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
-
-/* Nonzero for _TYPE means that the _TYPE defines a destructor. */
-#define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
-
-#if 0
-/* Nonzero for _TYPE node means that creating an object of this type
- will involve a call to a constructor. This can apply to objects
- of ARRAY_TYPE if the type of the elements needs a constructor. */
-#define TYPE_NEEDS_CONSTRUCTING(NODE) (TYPE_LANG_FLAG_3(NODE))
-#endif
-
-/* Nonzero means that an object of this type can not be initialized using
- an initializer list. */
-#define CLASSTYPE_NON_AGGREGATE(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->type_flags.non_aggregate)
-#define TYPE_NON_AGGREGATE_CLASS(NODE) \
- (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
-
-/* Nonzero if there is a user-defined X::op=(x&) for this class. */
-#define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assign_ref)
-#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_assign_ref)
-#define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_abstract_assign_ref)
-#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_init_ref)
-
-/* Nonzero for _TYPE node means that destroying an object of this type
- will involve a call to a destructor. This can apply to objects
- of ARRAY_TYPE is the type of the elements needs a destructor. */
-#define TYPE_NEEDS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_4(NODE))
-
-/* Nonzero for class type means that initialization of this type can use
- a bitwise copy. */
-#define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
- (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
-
-/* Nonzero for class type means that assignment of this type can use
- a bitwise copy. */
-#define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
- (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
-
-#define TYPE_PTRMEM_P(NODE) \
- (TREE_CODE (NODE) == POINTER_TYPE \
- && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
-#define TYPE_PTR_P(NODE) \
- (TREE_CODE (NODE) == POINTER_TYPE \
- && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
-#define TYPE_PTROB_P(NODE) \
- (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
- && TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
-#define TYPE_PTROBV_P(NODE) \
- (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
-#define TYPE_PTRFN_P(NODE) \
- (TREE_CODE (NODE) == POINTER_TYPE \
- && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
-
-/* Nonzero for _TYPE node means that this type is a pointer to member
- function type. */
-#define TYPE_PTRMEMFUNC_P(NODE) (TREE_CODE(NODE) == RECORD_TYPE && TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
-#define TYPE_PTRMEMFUNC_FLAG(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
-/* 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 (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE)))))))
-/* These are use to manipulate the the canonical RECORD_TYPE from the
- hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
-#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE))
-#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE)))
-/* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */
-#define DELTA2_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), delta2_identifier, NULL_TREE, 0))
-#define PFN_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), pfn_identifier, NULL_TREE, 0))
-
-/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
- specified in its declaration. */
-#define DECL_THIS_EXTERN(NODE) (DECL_LANG_FLAG_2(NODE))
-
-/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
- specified in its declaration. */
-#define DECL_THIS_STATIC(NODE) (DECL_LANG_FLAG_6(NODE))
-
-/* Nonzero for SAVE_EXPR if used to initialize a PARM_DECL. */
-#define PARM_DECL_EXPR(NODE) (TREE_LANG_FLAG_2(NODE))
-
-/* Nonzero in FUNCTION_DECL means it is really an operator.
- Just used to communicate formatting information to dbxout.c. */
-#define DECL_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)
-
-#define ANON_UNION_P(NODE) (DECL_NAME (NODE) == 0)
-
-#define UNKNOWN_TYPE LANG_TYPE
-
-/* Define fields and accessors for nodes representing declared names. */
-
-#if 0
-/* C++: A derived class may be able to directly use the virtual
- function table of a base class. When it does so, it may
- still have a decl node used to access the virtual function
- table (so that variables of this type can initialize their
- virtual function table pointers by name). When such thievery
- is committed, know exactly which base class's virtual function
- table is the one being stolen. This effectively computes the
- transitive closure. */
-#define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
-#endif
-
-#define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.was_anonymous)
-
-/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
-#define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
-
-/* The DECL_ACCESS is used to record under which context
- special access rules apply. */
-#define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.access)
-
-/* C++: all of these are overloaded!
- These apply to PARM_DECLs and VAR_DECLs. */
-#define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
-#define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
-
-/* Accessor macros for C++ template decl nodes. */
-#define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE)
-/* For class templates. */
-#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE(NODE)
-/* For function, method, class-data templates. */
-#define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT(NODE)
-#define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE)
-#define DECL_TEMPLATE_INJECT(NODE) DECL_INITIAL(NODE)
-
-#define DECL_FUNCTION_TEMPLATE_P(NODE) \
- (TREE_CODE (NODE) == TEMPLATE_DECL \
- && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
-
-#define PRIMARY_TEMPLATE_P(NODE) \
- (TREE_TYPE (DECL_TEMPLATE_PARMS (NODE)) == (NODE))
-
-#define CLASSTYPE_TEMPLATE_LEVEL(NODE) \
- (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
-
-/* Indicates whether or not (and how) a template was expanded for this
- FUNCTION_DECL or VAR_DECL.
- 0=normal declaration, e.g. int min (int, int);
- 1=implicit template instantiation
- 2=explicit template specialization, e.g. int min<int> (int, int);
- 3=explicit template instantiation, e.g. template int min<int> (int, int); */
-#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template)
-
-#define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
-#define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
-
-#define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
-#define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
-#define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
-#define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
-
-#define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
-#define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
-#define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE(NODE) == 1)
-#define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE(NODE) = 1)
-
-#define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
-#define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
-#define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE(NODE) == 3)
-#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
- (CLASSTYPE_USE_TEMPLATE(NODE) = 3)
-
-/* This function may be a guiding decl for a template. */
-#define DECL_MAYBE_TEMPLATE(NODE) DECL_LANG_FLAG_4 (NODE)
-/* We know what we're doing with this decl now. */
-#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
-
-/* This decl was declared or deduced to have internal linkage. This is
- only meaningful if TREE_PUBLIC is set. */
-#define DECL_C_STATIC(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->decl_flags.c_static)
-
-/* This function was declared inline. This flag controls the linkage
- semantics of 'inline'; whether or not the function is inlined is
- controlled by DECL_INLINE. */
-#define DECL_THIS_INLINE(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->decl_flags.declared_inline)
-
-/* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
- so that assemble_external will work properly. So we have this flag to
- tell us whether the decl is really not external. */
-#define DECL_NOT_REALLY_EXTERN(NODE) \
- (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
-
-#define DECL_REALLY_EXTERN(NODE) \
- (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
-
-#define DECL_PUBLIC(NODE) \
- (TREE_CODE (NODE) == FUNCTION_DECL \
- ? ! DECL_C_STATIC (NODE) : TREE_PUBLIC (NODE))
-
-#define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
-
-/* ...and for unexpanded-parameterized-type nodes. */
-#define UPT_TEMPLATE(NODE) TREE_PURPOSE(TYPE_VALUES(NODE))
-#define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE))
-
-#define builtin_function(NAME, TYPE, CODE, LIBNAME) \
- define_function (NAME, TYPE, CODE, (void (*)())pushdecl, LIBNAME)
-
-/* An enumeration of the kind of tags that C++ accepts. */
-enum tag_types { record_type, class_type, union_type, enum_type,
- signature_type };
-
-/* Zero means prototype weakly, as in ANSI C (no args means nothing).
- Each language context defines how this variable should be set. */
-extern int strict_prototype;
-extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
-
-/* Non-zero means that if a label exists, and no other identifier
- applies, use the value of the label. */
-extern int flag_labels_ok;
-
-/* Non-zero means to collect statistics which might be expensive
- and to print them when we are done. */
-extern int flag_detailed_statistics;
-
-/* Non-zero means warn in function declared in derived class has the
- same name as a virtual in the base class, but fails to match the
- type signature of any virtual function in the base class. */
-extern int warn_overloaded_virtual;
-
-/* in c-common.c */
-extern void declare_function_name PROTO((void));
-extern void decl_attributes PROTO((tree, tree, tree));
-extern void init_function_format_info PROTO((void));
-extern void record_function_format PROTO((tree, tree, int, int, int));
-extern void check_function_format PROTO((tree, tree, tree));
-/* Print an error message for invalid operands to arith operation CODE.
- NOP_EXPR is used as a special case (see truthvalue_conversion). */
-extern void binary_op_error PROTO((enum tree_code));
-extern tree cp_build_type_variant PROTO((tree, int, int));
-extern void c_expand_expr_stmt PROTO((tree));
-/* Validate the expression after `case' and apply default promotions. */
-extern tree check_case_value PROTO((tree));
-/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
-extern tree combine_strings PROTO((tree));
-extern void constant_expression_warning PROTO((tree));
-extern tree convert_and_check PROTO((tree, tree));
-extern void overflow_warning PROTO((tree));
-extern void unsigned_conversion_warning PROTO((tree, tree));
-/* Read the rest of the current #-directive line. */
-extern char *get_directive_line STDIO_PROTO((FILE *));
-/* Subroutine of build_binary_op, used for comparison operations.
- See if the operands have both been converted from subword integer types
- and, if so, perhaps change them both back to their original type. */
-extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
-/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
- or validate its data type for an `if' or `while' statement or ?..: exp. */
-extern tree truthvalue_conversion PROTO((tree));
-extern tree type_for_mode PROTO((enum machine_mode, int));
-extern tree type_for_size PROTO((unsigned, int));
-
-/* in decl{2}.c */
-extern tree void_list_node;
-extern tree void_zero_node;
-extern tree default_function_type;
-extern tree vtable_entry_type;
-extern tree sigtable_entry_type;
-extern tree __t_desc_type_node;
-#if 0
-extern tree __tp_desc_type_node;
-#endif
-extern tree __access_mode_type_node;
-extern tree __bltn_desc_type_node, __user_desc_type_node;
-extern tree __class_desc_type_node, __attr_desc_type_node;
-extern tree __ptr_desc_type_node, __func_desc_type_node;
-extern tree __ptmf_desc_type_node, __ptmd_desc_type_node;
-extern tree type_info_type_node;
-extern tree class_star_type_node;
-extern tree this_identifier;
-extern tree ctor_identifier, dtor_identifier;
-extern tree pfn_identifier;
-extern tree index_identifier;
-extern tree delta_identifier;
-extern tree delta2_identifier;
-extern tree pfn_or_delta2_identifier;
-extern tree tag_identifier;
-extern tree vt_off_identifier;
-
-/* A node that is a list (length 1) of error_mark_nodes. */
-extern tree error_mark_list;
-
-extern tree ptr_type_node;
-extern tree class_type_node, record_type_node, union_type_node, enum_type_node;
-extern tree unknown_type_node;
-extern tree opaque_type_node, signature_type_node;
-
-/* Node for "pointer to (virtual) function".
- This may be distinct from ptr_type_node so gdb can distinguish them. */
-#define vfunc_ptr_type_node \
- (flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
-
-/* Array type `(void *)[]' */
-extern tree vtbl_type_node;
-extern tree delta_type_node;
-
-extern tree long_long_integer_type_node, long_long_unsigned_type_node;
-/* For building calls to `delete'. */
-extern tree integer_two_node, integer_three_node;
-extern tree boolean_type_node, boolean_true_node, boolean_false_node;
-
-extern tree null_node;
-
-/* in pt.c */
-
-extern tree current_template_parms;
-extern HOST_WIDE_INT processing_template_decl;
-
-/* The template currently being instantiated, and where the instantiation
- was triggered. */
-struct tinst_level
-{
- tree decl;
- int line;
- char *file;
- struct tinst_level *next;
-};
-
-extern int minimal_parse_mode;
-
-/* in class.c */
-extern tree current_class_name;
-extern tree current_class_type;
-extern tree current_class_ptr;
-extern tree previous_class_type;
-extern tree current_class_ref;
-
-extern tree current_lang_name, lang_name_cplusplus, lang_name_c;
-
-/* Points to the name of that function. May not be the DECL_NAME
- of CURRENT_FUNCTION_DECL due to overloading */
-extern tree original_function_name;
-
-/* in init.c */
-extern tree global_base_init_list;
-extern tree current_base_init_list, current_member_init_list;
-
-extern int current_function_just_assigned_this;
-extern int current_function_parms_stored;
-
-/* Here's where we control how name mangling takes place. */
-
-#define OPERATOR_ASSIGN_FORMAT "__a%s"
-#define OPERATOR_FORMAT "__%s"
-#define OPERATOR_TYPENAME_FORMAT "__op"
-#define OPERATOR_TYPENAME_P(ID_NODE) \
- (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
- && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
- && IDENTIFIER_POINTER (ID_NODE)[2] == 'o' \
- && IDENTIFIER_POINTER (ID_NODE)[3] == 'p')
-
-
-/* Cannot use '$' up front, because this confuses gdb
- (names beginning with '$' are gdb-local identifiers).
-
- Note that all forms in which the '$' is significant are long enough
- for direct indexing (meaning that if we know there is a '$'
- at a particular location, we can index into the string at
- any other location that provides distinguishing characters). */
-
-/* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
- doesn't allow '$' in symbol names. */
-#ifndef NO_DOLLAR_IN_LABEL
-
-#define JOINER '$'
-
-#define VPTR_NAME "$v"
-#define THROW_NAME "$eh_throw"
-#define DESTRUCTOR_DECL_PREFIX "_$_"
-#define AUTO_VTABLE_NAME "__vtbl$me__"
-#define AUTO_TEMP_NAME "_$tmp_"
-#define AUTO_TEMP_FORMAT "_$tmp_%d"
-#define VTABLE_BASE "$vb"
-#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt$%s")
-#define VFIELD_BASE "$vf"
-#define VFIELD_NAME "_vptr$"
-#define VFIELD_NAME_FORMAT "_vptr$%s"
-#define VBASE_NAME "_vb$"
-#define VBASE_NAME_FORMAT "_vb$%s"
-#define STATIC_NAME_FORMAT "_%s$%s"
-#define ANON_AGGRNAME_FORMAT "$_%d"
-
-#else /* NO_DOLLAR_IN_LABEL */
-
-#ifndef NO_DOT_IN_LABEL
-
-#define JOINER '.'
-
-#define VPTR_NAME ".v"
-#define THROW_NAME ".eh_throw"
-#define DESTRUCTOR_DECL_PREFIX "_._"
-#define AUTO_VTABLE_NAME "__vtbl.me__"
-#define AUTO_TEMP_NAME "_.tmp_"
-#define AUTO_TEMP_FORMAT "_.tmp_%d"
-#define VTABLE_BASE ".vb"
-#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt.%s")
-#define VFIELD_BASE ".vf"
-#define VFIELD_NAME "_vptr."
-#define VFIELD_NAME_FORMAT "_vptr.%s"
-#define VBASE_NAME "_vb."
-#define VBASE_NAME_FORMAT "_vb.%s"
-#define STATIC_NAME_FORMAT "_%s.%s"
-
-#define ANON_AGGRNAME_FORMAT "._%d"
-
-#else /* NO_DOT_IN_LABEL */
-
-#define VPTR_NAME "__vptr"
-#define VPTR_NAME_P(ID_NODE) \
- (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1))
-#define THROW_NAME "__eh_throw"
-#define DESTRUCTOR_DECL_PREFIX "__destr_"
-#define DESTRUCTOR_NAME_P(ID_NODE) \
- (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \
- sizeof (DESTRUCTOR_DECL_PREFIX) - 1))
-#define IN_CHARGE_NAME "__in_chrg"
-#define AUTO_VTABLE_NAME "__vtbl_me__"
-#define AUTO_TEMP_NAME "__tmp_"
-#define TEMP_NAME_P(ID_NODE) \
- (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
- sizeof (AUTO_TEMP_NAME) - 1))
-#define AUTO_TEMP_FORMAT "__tmp_%d"
-#define VTABLE_BASE "__vtb"
-#define VTABLE_NAME "__vt_"
-#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt_%s")
-#define VTABLE_NAME_P(ID_NODE) \
- (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
- sizeof (VTABLE_NAME) - 1))
-#define VFIELD_BASE "__vfb"
-#define VFIELD_NAME "__vptr_"
-#define VFIELD_NAME_P(ID_NODE) \
- (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
- sizeof (VFIELD_NAME) - 1))
-#define VFIELD_NAME_FORMAT "_vptr_%s"
-#define VBASE_NAME "__vb_"
-#define VBASE_NAME_P(ID_NODE) \
- (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \
- sizeof (VBASE_NAME) - 1))
-#define VBASE_NAME_FORMAT "__vb_%s"
-#define STATIC_NAME_FORMAT "__static_%s_%s"
-
-#define ANON_AGGRNAME_PREFIX "__anon_"
-#define ANON_AGGRNAME_P(ID_NODE) \
- (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
- sizeof (ANON_AGGRNAME_PREFIX) - 1))
-#define ANON_AGGRNAME_FORMAT "__anon_%d"
-#define ANON_PARMNAME_FORMAT "__%d"
-#define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
- && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
- && IDENTIFIER_POINTER (ID_NODE)[2] <= '9')
-
-#endif /* NO_DOT_IN_LABEL */
-#endif /* NO_DOLLAR_IN_LABEL */
-
-#define THIS_NAME "this"
-#define DESTRUCTOR_NAME_FORMAT "~%s"
-#define FILE_FUNCTION_PREFIX_LEN 9
-#define CTOR_NAME "__ct"
-#define DTOR_NAME "__dt"
-
-#define IN_CHARGE_NAME "__in_chrg"
-
-#define VTBL_PTR_TYPE "__vtbl_ptr_type"
-#define VTABLE_DELTA_NAME "__delta"
-#define VTABLE_INDEX_NAME "__index"
-#define VTABLE_PFN_NAME "__pfn"
-#define VTABLE_DELTA2_NAME "__delta2"
-
-#define SIGNATURE_FIELD_NAME "__s_"
-#define SIGNATURE_FIELD_NAME_FORMAT "__s_%s"
-#define SIGNATURE_OPTR_NAME "__optr"
-#define SIGNATURE_SPTR_NAME "__sptr"
-#define SIGNATURE_POINTER_NAME "__sp_"
-#define SIGNATURE_POINTER_NAME_FORMAT "__%s%ssp_%s"
-#define SIGNATURE_REFERENCE_NAME "__sr_"
-#define SIGNATURE_REFERENCE_NAME_FORMAT "__%s%ssr_%s"
-
-#define SIGTABLE_PTR_TYPE "__sigtbl_ptr_type"
-#define SIGTABLE_NAME_FORMAT "__st_%s_%s"
-#define SIGTABLE_NAME_FORMAT_LONG "__st_%s_%s_%d"
-#define SIGTABLE_TAG_NAME "__tag"
-#define SIGTABLE_VB_OFF_NAME "__vb_off"
-#define SIGTABLE_VT_OFF_NAME "__vt_off"
-#define EXCEPTION_CLEANUP_NAME "exception cleanup"
-
-#define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
-
-#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
-
-#define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
- && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
-#define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \
- && IDENTIFIER_POINTER (ID_NODE)[2] == '_')
-
-#define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
- && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
- && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
-
-#define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
- && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \
- && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
-
-#define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
-#define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
-
-/* For anonymous aggregate types, we need some sort of name to
- hold on to. In practice, this should not appear, but it should
- not be harmful if it does. */
-#define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
- && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
-#define ANON_PARMNAME_FORMAT "_%d"
-#define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
- && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
-#endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
-
-/* Define the sets of attributes that member functions and baseclasses
- can have. These are sensible combinations of {public,private,protected}
- cross {virtual,non-virtual}. */
-
-/* in class.c. */
-extern tree access_default_node; /* 0 */
-extern tree access_public_node; /* 1 */
-extern tree access_protected_node; /* 2 */
-extern tree access_private_node; /* 3 */
-extern tree access_default_virtual_node; /* 4 */
-extern tree access_public_virtual_node; /* 5 */
-extern tree access_private_virtual_node; /* 6 */
-
-/* Things for handling inline functions. */
-
-struct pending_inline
-{
- struct pending_inline *next; /* pointer to next in chain */
- int lineno; /* line number we got the text from */
- char *filename; /* name of file we were processing */
- tree fndecl; /* FUNCTION_DECL that brought us here */
- int token; /* token we were scanning */
- int token_value; /* value of token we were scanning (YYSTYPE) */
-
- char *buf; /* pointer to character stream */
- int len; /* length of stream */
- unsigned int can_free : 1; /* free this after we're done with it? */
- unsigned int deja_vu : 1; /* set iff we don't want to see it again. */
- unsigned int interface : 2; /* 0=interface 1=unknown 2=implementation */
-};
-
-/* in method.c */
-extern struct pending_inline *pending_inlines;
-
-/* 1 for -fall-virtual: make every member function (except
- constructors) lay down in the virtual function table.
- Calls can then either go through the virtual function table or not,
- depending on whether we know what function will actually be called. */
-
-extern int flag_all_virtual;
-
-/* Positive values means that we cannot make optimizing assumptions about
- `this'. Negative values means we know `this' to be of static type. */
-
-extern int flag_this_is_variable;
-
-/* Controls whether enums and ints freely convert.
- 1 means with complete freedom.
- 0 means enums can convert to ints, but not vice-versa. */
-
-extern int flag_int_enum_equivalence;
-
-/* Nonzero means generate 'rtti' that give run-time type information. */
-
-extern int flag_rtti;
-
-/* Nonzero means do emit exported implementations of functions even if
- they can be inlined. */
-
-extern int flag_implement_inlines;
-
-/* Nonzero means templates obey #pragma interface and implementation. */
-
-extern int flag_external_templates;
-
-/* Nonzero means templates are emitted where they are instantiated. */
-
-extern int flag_alt_external_templates;
-
-/* Nonzero means implicit template instantiations are emitted. */
-
-extern int flag_implicit_templates;
-
-/* Nonzero if we want to emit defined symbols with common-like linkage as
- weak symbols where possible, in order to conform to C++ semantics.
- Otherwise, emit them as local symbols. */
-
-extern int flag_weak;
-
-/* Nonzero if we're done parsing and into end-of-file activities. */
-
-extern int at_eof;
-
-enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
-
-/* The following two can be derived from the previous one */
-extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
-extern tree current_class_type; /* _TYPE: the type of the current class */
-
-/* Some macros for char-based bitfields. */
-#define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
-#define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
-#define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
-
-/* These are uses as bits in flags passed to build_method_call
- to control its error reporting behavior.
-
- LOOKUP_PROTECT means flag access violations.
- LOOKUP_COMPLAIN mean complain if no suitable member function
- matching the arguments is found.
- LOOKUP_NORMAL is just a combination of these two.
- LOOKUP_NONVIRTUAL means make a direct call to the member function found
- LOOKUP_GLOBAL means search through the space of overloaded functions,
- as well as the space of member functions.
- LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
- in the parameter list.
- LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried.
- DIRECT_BIND means that if a temporary is created, it should be created so
- that it lives as long as the current variable bindings; otherwise it
- only lives until the end of the complete-expression.
- LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are
- after. Note, LOOKUP_COMPLAIN is checked and error messages printed
- before LOOKUP_SPECULATIVELY is checked.
- LOOKUP_NO_CONVERSION means that user-defined conversions are not
- permitted. Built-in conversions are permitted.
- LOOKUP_DESTRUCTOR means explicit call to destructor.
- LOOKUP_NO_TEMP_BIND means temporaries will not be bound to references. */
-
-#define LOOKUP_PROTECT (1)
-#define LOOKUP_COMPLAIN (2)
-#define LOOKUP_NORMAL (3)
-/* #define LOOKUP_UNUSED (4) */
-#define LOOKUP_NONVIRTUAL (8)
-#define LOOKUP_GLOBAL (16)
-#define LOOKUP_HAS_IN_CHARGE (32)
-#define LOOKUP_SPECULATIVELY (64)
-#define LOOKUP_ONLYCONVERTING (128)
-#define DIRECT_BIND (256)
-#define LOOKUP_NO_CONVERSION (512)
-#define LOOKUP_DESTRUCTOR (512)
-#define LOOKUP_NO_TEMP_BIND (1024)
-
-/* These flags are used by the conversion code.
- CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
- CONV_STATIC : Perform the explicit conversions for static_cast.
- CONV_CONST : Perform the explicit conversions for const_cast.
- CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
- CONV_PRIVATE : Perform upcasts to private bases.
- CONV_FORCE_TEMP : Require a new temporary when converting to the same
- aggregate type. */
-
-#define CONV_IMPLICIT 1
-#define CONV_STATIC 2
-#define CONV_CONST 4
-#define CONV_REINTERPRET 8
-#define CONV_PRIVATE 16
-/* #define CONV_NONCONVERTING 32 */
-#define CONV_FORCE_TEMP 64
-#define CONV_STATIC_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_FORCE_TEMP)
-#define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
- | CONV_REINTERPRET)
-#define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
- | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
-
-/* Used by build_expr_type_conversion to indicate which types are
- acceptable as arguments to the expression under consideration. */
-
-#define WANT_INT 1 /* integer types, including bool */
-#define WANT_FLOAT 2 /* floating point types */
-#define WANT_ENUM 4 /* enumerated types */
-#define WANT_POINTER 8 /* pointer types */
-#define WANT_NULL 16 /* null pointer constant */
-
-#define WANT_ARITH (WANT_INT | WANT_FLOAT)
-
-/* Anatomy of a DECL_FRIENDLIST (which is a TREE_LIST):
- purpose = friend name (IDENTIFIER_NODE);
- value = TREE_LIST of FUNCTION_DECLS;
- chain, type = EMPTY; */
-#define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
-#define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
-
-/* These macros are for accessing the fields of TEMPLATE...PARM nodes. */
-#define TEMPLATE_TYPE_IDX(NODE) TREE_INT_CST_LOW (TYPE_FIELDS (NODE))
-#define TEMPLATE_TYPE_LEVEL(NODE) TREE_INT_CST_HIGH (TYPE_FIELDS (NODE))
-#define TEMPLATE_TYPE_SET_INFO(NODE,I,L) \
- (TYPE_FIELDS (NODE) = build_int_2 (I, L))
-#define TEMPLATE_CONST_IDX(NODE) (TREE_INT_CST_LOW(NODE))
-#define TEMPLATE_CONST_LEVEL(NODE) (TREE_INT_CST_HIGH(NODE))
-#define TEMPLATE_CONST_SET_INFO(NODE,I,L) \
- (TEMPLATE_CONST_IDX (NODE) = I, TEMPLATE_CONST_LEVEL (NODE) = L)
-
-/* in lex.c */
-/* Indexed by TREE_CODE, these tables give C-looking names to
- operators represented by TREE_CODES. For example,
- opname_tab[(int) MINUS_EXPR] == "-". */
-extern char **opname_tab, **assignop_tab;
-
-/* in call.c */
-extern struct candidate *ansi_c_filler;
-extern int get_arglist_len_in_bytes PROTO((tree));
-
-extern int rank_for_overload PROTO((struct candidate *, struct candidate *));
-extern void compute_conversion_costs PROTO((tree, tree, struct candidate *, int));
-extern tree build_vfield_ref PROTO((tree, tree));
-extern tree resolve_scope_to_name PROTO((tree, tree));
-extern tree build_scoped_method_call PROTO((tree, tree, tree, tree));
-extern tree build_addr_func PROTO((tree));
-extern tree build_call PROTO((tree, tree, tree));
-extern tree build_method_call PROTO((tree, tree, tree, tree, int));
-extern tree build_overload_call_real PROTO((tree, tree, int, struct candidate *, int));
-extern tree build_overload_call PROTO((tree, tree, int));
-extern int null_ptr_cst_p PROTO((tree));
-extern tree type_decays_to PROTO((tree));
-extern tree build_user_type_conversion PROTO((tree, tree, int));
-extern tree build_new_function_call PROTO((tree, tree, tree));
-extern tree build_new_op PROTO((enum tree_code, int, tree, tree, tree));
-extern int can_convert PROTO((tree, tree));
-extern int can_convert_arg PROTO((tree, tree, tree));
-
-/* in class.c */
-extern tree build_vbase_path PROTO((enum tree_code, tree, tree, tree, int));
-extern tree build_vtbl_ref PROTO((tree, tree));
-extern tree build_vfn_ref PROTO((tree *, tree, tree));
-extern void add_method PROTO((tree, tree *, tree));
-extern tree get_vfield_offset PROTO((tree));
-extern void duplicate_tag_error PROTO((tree));
-extern tree finish_struct PROTO((tree, tree, tree, int));
-extern tree finish_struct_1 PROTO((tree, int));
-extern tree finish_struct_methods PROTO((tree, tree, int));
-extern int resolves_to_fixed_type_p PROTO((tree, int *));
-extern void init_class_processing PROTO((void));
-extern void pushclass PROTO((tree, int));
-extern void popclass PROTO((int));
-extern void push_nested_class PROTO((tree, int));
-extern void pop_nested_class PROTO((int));
-extern void push_lang_context PROTO((tree));
-extern void pop_lang_context PROTO((void));
-extern tree instantiate_type PROTO((tree, tree, int));
-extern void print_class_statistics PROTO((void));
-extern void maybe_push_cache_obstack PROTO((void));
-extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *));
-extern tree build_self_reference PROTO((void));
-
-/* in cvt.c */
-extern tree convert_to_reference PROTO((tree, tree, int, int, tree));
-extern tree convert_from_reference PROTO((tree));
-extern tree convert_to_aggr PROTO((tree, tree, char **, int));
-extern tree convert_pointer_to_real PROTO((tree, tree));
-extern tree convert_pointer_to PROTO((tree, tree));
-extern tree cp_convert PROTO((tree, tree, int, int));
-extern tree convert PROTO((tree, tree));
-extern tree convert_force PROTO((tree, tree, int));
-extern tree build_type_conversion PROTO((enum tree_code, tree, tree, int));
-extern tree build_expr_type_conversion PROTO((int, tree, int));
-extern int build_default_binary_type_conversion PROTO((enum tree_code, tree *, tree *));
-extern tree type_promotes_to PROTO((tree));
-
-/* decl.c */
-/* resume_binding_level */
-extern int global_bindings_p PROTO((void));
-extern int toplevel_bindings_p PROTO((void));
-extern void keep_next_level PROTO((void));
-extern int kept_level_p PROTO((void));
-extern void declare_parm_level PROTO((void));
-extern void declare_pseudo_global_level PROTO((void));
-extern int pseudo_global_level_p PROTO((void));
-extern void set_class_shadows PROTO((tree));
-extern void pushlevel PROTO((int));
-extern void note_level_for_for PROTO((void));
-extern void pushlevel_temporary PROTO((int));
-extern tree poplevel PROTO((int, int, int));
-/* resume_level */
-extern void delete_block PROTO((tree));
-extern void insert_block PROTO((tree));
-extern void add_block_current_level PROTO((tree));
-extern void set_block PROTO((tree));
-extern void pushlevel_class PROTO((void));
-extern tree poplevel_class PROTO((int));
-/* skip print_other_binding_stack and print_binding_level */
-extern void print_binding_stack PROTO((void));
-extern void push_namespace PROTO((tree));
-extern void pop_namespace PROTO((void));
-extern void maybe_push_to_top_level PROTO((int));
-extern void push_to_top_level PROTO((void));
-extern void pop_from_top_level PROTO((void));
-extern void set_identifier_type_value PROTO((tree, tree));
-extern void pop_everything PROTO((void));
-extern void pushtag PROTO((tree, tree, int));
-extern tree make_anon_name PROTO((void));
-extern void clear_anon_tags PROTO((void));
-extern int decls_match PROTO((tree, tree));
-extern int duplicate_decls PROTO((tree, tree));
-extern tree pushdecl PROTO((tree));
-extern tree pushdecl_top_level PROTO((tree));
-extern tree pushdecl_class_level PROTO((tree));
-#if 0
-extern void pushdecl_nonclass_level PROTO((tree));
-#endif
-extern void push_class_level_binding PROTO((tree, tree));
-extern int overloaded_globals_p PROTO((tree));
-extern tree implicitly_declare PROTO((tree));
-extern tree lookup_label PROTO((tree));
-extern tree shadow_label PROTO((tree));
-extern tree define_label PROTO((char *, int, tree));
-extern void push_switch PROTO((void));
-extern void pop_switch PROTO((void));
-extern void define_case_label PROTO((tree));
-extern tree getdecls PROTO((void));
-extern tree gettags PROTO((void));
-#if 0
-extern void set_current_level_tags_transparency PROTO((int));
-#endif
-extern tree lookup_namespace_name PROTO((tree, tree));
-extern tree make_typename_type PROTO((tree, tree));
-extern tree lookup_name_nonclass PROTO((tree));
-extern tree lookup_name PROTO((tree, int));
-extern tree lookup_name_current_level PROTO((tree));
-extern tree auto_function PROTO((tree, tree, enum built_in_function));
-extern void init_decl_processing PROTO((void));
-extern int init_type_desc PROTO((void));
-/* skipped define_function */
-extern void shadow_tag PROTO((tree));
-extern tree groktypename PROTO((tree));
-extern tree start_decl PROTO((tree, tree, int));
-extern void start_decl_1 PROTO((tree));
-extern void cp_finish_decl PROTO((tree, tree, tree, int, int));
-extern void finish_decl PROTO((tree, tree, tree));
-extern void expand_static_init PROTO((tree, tree));
-extern int complete_array_type PROTO((tree, tree, int));
-extern tree build_ptrmemfunc_type PROTO((tree));
-/* the grokdeclarator prototype is in decl.h */
-extern int parmlist_is_exprlist PROTO((tree));
-extern int copy_args_p PROTO((tree));
-extern int grok_ctor_properties PROTO((tree, tree));
-extern void grok_op_properties PROTO((tree, int, int));
-extern tree xref_tag PROTO((tree, tree, tree, int));
-extern tree xref_tag_from_type PROTO((tree, tree, int));
-extern void xref_basetypes PROTO((tree, tree, tree, tree));
-extern tree start_enum PROTO((tree));
-extern tree finish_enum PROTO((tree, tree));
-extern tree build_enumerator PROTO((tree, tree));
-extern tree grok_enum_decls PROTO((tree, tree));
-extern int start_function PROTO((tree, tree, tree, int));
-extern void store_after_parms PROTO((struct rtx_def *));
-extern void expand_start_early_try_stmts PROTO((void));
-extern void store_parm_decls PROTO((void));
-extern void store_return_init PROTO((tree, tree));
-extern void finish_function PROTO((int, int, int));
-extern tree start_method PROTO((tree, tree));
-extern tree finish_method PROTO((tree));
-extern void hack_incomplete_structures PROTO((tree));
-extern tree maybe_build_cleanup_and_delete PROTO((tree));
-extern tree maybe_build_cleanup PROTO((tree));
-extern void cplus_expand_expr_stmt PROTO((tree));
-extern void finish_stmt PROTO((void));
-extern int id_in_current_class PROTO((tree));
-extern void push_cp_function_context PROTO((tree));
-extern void pop_cp_function_context PROTO((tree));
-extern int in_function_p PROTO((void));
-
-/* in decl2.c */
-extern int flag_assume_nonnull_objects;
-extern int lang_decode_option PROTO((char *));
-extern tree grok_method_quals PROTO((tree, tree, tree));
-extern void warn_if_unknown_interface PROTO((tree));
-extern tree grok_x_components PROTO((tree, tree));
-extern void grokclassfn PROTO((tree, tree, tree, enum overload_flags, tree));
-extern tree grok_alignof PROTO((tree));
-extern tree grok_array_decl PROTO((tree, tree));
-extern tree delete_sanity PROTO((tree, tree, int, int));
-extern tree check_classfn PROTO((tree, tree));
-extern tree grokfield PROTO((tree, tree, tree, tree, tree));
-extern tree grokbitfield PROTO((tree, tree, tree));
-extern tree groktypefield PROTO((tree, tree));
-extern tree grokoptypename PROTO((tree, tree));
-extern int copy_assignment_arg_p PROTO((tree, int));
-extern void cplus_decl_attributes PROTO((tree, tree, tree));
-extern tree constructor_name_full PROTO((tree));
-extern tree constructor_name PROTO((tree));
-extern void setup_vtbl_ptr PROTO((void));
-extern void mark_inline_for_output PROTO((tree));
-extern void clear_temp_name PROTO((void));
-extern tree get_temp_name PROTO((tree, int));
-extern tree get_temp_regvar PROTO((tree, tree));
-extern void finish_anon_union PROTO((tree));
-extern tree finish_table PROTO((tree, tree, tree, int));
-extern void finish_builtin_type PROTO((tree, char *, tree *, int, tree));
-extern tree coerce_new_type PROTO((tree));
-extern tree coerce_delete_type PROTO((tree));
-extern void comdat_linkage PROTO((tree));
-extern void import_export_vtable PROTO((tree, tree, int));
-extern int finish_prevtable_vardecl PROTO((tree, tree));
-extern int walk_vtables PROTO((void (*)(), int (*)()));
-extern void walk_sigtables PROTO((void (*)(), void (*)()));
-extern void import_export_decl PROTO((tree));
-extern tree build_cleanup PROTO((tree));
-extern void finish_file PROTO((void));
-extern tree reparse_absdcl_as_expr PROTO((tree, tree));
-extern tree reparse_absdcl_as_casts PROTO((tree, tree));
-extern tree build_expr_from_tree PROTO((tree));
-extern tree reparse_decl_as_expr PROTO((tree, tree));
-extern tree finish_decl_parsing PROTO((tree));
-extern tree check_cp_case_value PROTO((tree));
-extern tree get_namespace_id PROTO((void));
-extern tree current_namespace_id PROTO((tree));
-extern void do_namespace_alias PROTO((tree, tree));
-extern void do_toplevel_using_decl PROTO((tree));
-extern tree do_class_using_decl PROTO((tree));
-extern void do_using_directive PROTO((tree));
-extern void check_default_args PROTO((tree));
-extern void mark_used PROTO((tree));
-
-/* in errfn.c */
-extern void cp_error ();
-extern void cp_error_at ();
-extern void cp_warning ();
-extern void cp_warning_at ();
-extern void cp_pedwarn ();
-extern void cp_pedwarn_at ();
-extern void cp_compiler_error ();
-extern void cp_sprintf ();
-
-/* in error.c */
-extern void init_error PROTO((void));
-extern char *fndecl_as_string PROTO((tree, int));
-extern char *type_as_string PROTO((tree, int));
-extern char *args_as_string PROTO((tree, int));
-extern char *decl_as_string PROTO((tree, int));
-extern char *expr_as_string PROTO((tree, int));
-extern char *code_as_string PROTO((enum tree_code, int));
-extern char *language_as_string PROTO((enum languages, int));
-extern char *parm_as_string PROTO((int, int));
-extern char *op_as_string PROTO((enum tree_code, int));
-extern char *assop_as_string PROTO((enum tree_code, int));
-extern char *cv_as_string PROTO((tree, int));
-extern char *lang_decl_name PROTO((tree, int));
-
-/* in except.c */
-extern void init_exception_processing PROTO((void));
-extern void expand_start_catch_block PROTO((tree, tree));
-extern void expand_end_catch_block PROTO((void));
-extern void expand_builtin_throw PROTO((void));
-extern void expand_start_eh_spec PROTO((void));
-extern void expand_exception_blocks PROTO((void));
-extern tree start_anon_func PROTO((void));
-extern void end_anon_func PROTO((void));
-extern void expand_throw PROTO((tree));
-extern tree build_throw PROTO((tree));
-
-/* in expr.c */
-/* skip cplus_expand_expr */
-extern void init_cplus_expand PROTO((void));
-extern void fixup_result_decl PROTO((tree, struct rtx_def *));
-extern int extract_init PROTO((tree, tree));
-extern void do_case PROTO((tree, tree));
-
-/* friend.c */
-extern int is_friend PROTO((tree, tree));
-extern void make_friend_class PROTO((tree, tree));
-extern tree do_friend PROTO((tree, tree, tree, tree, enum overload_flags, tree, int));
-
-/* in init.c */
-extern void init_init_processing PROTO((void));
-extern void expand_direct_vtbls_init PROTO((tree, tree, int, int, tree));
-extern void emit_base_init PROTO((tree, int));
-extern void check_base_init PROTO((tree));
-extern void do_member_init PROTO((tree, tree, tree));
-extern void expand_member_init PROTO((tree, tree, tree));
-extern void expand_aggr_init PROTO((tree, tree, int, int));
-extern int is_aggr_typedef PROTO((tree, int));
-extern int is_aggr_type PROTO((tree, int));
-extern tree get_aggr_from_typedef PROTO((tree, int));
-extern tree get_type_value PROTO((tree));
-extern tree build_member_call PROTO((tree, tree, tree));
-extern tree build_offset_ref PROTO((tree, tree));
-extern tree resolve_offset_ref PROTO((tree));
-extern tree decl_constant_value PROTO((tree));
-extern tree build_new PROTO((tree, tree, tree, int));
-extern tree expand_vec_init PROTO((tree, tree, tree, tree, int));
-extern tree build_x_delete PROTO((tree, tree, int, tree));
-extern tree build_delete PROTO((tree, tree, tree, int, int));
-extern tree build_vbase_delete PROTO((tree, tree));
-extern tree build_vec_delete PROTO((tree, tree, tree, tree, int));
-
-/* in input.c */
-
-/* in lex.c */
-extern tree make_pointer_declarator PROTO((tree, tree));
-extern tree make_reference_declarator PROTO((tree, tree));
-extern tree make_call_declarator PROTO((tree, tree, tree, tree));
-extern void set_quals_and_spec PROTO((tree, tree, tree));
-extern char *operator_name_string PROTO((tree));
-extern void lang_init PROTO((void));
-extern void lang_finish PROTO((void));
-extern void init_filename_times PROTO((void));
-#if 0
-extern void reinit_lang_specific PROTO((void));
-#endif
-extern void init_lex PROTO((void));
-extern void reinit_parse_for_function PROTO((void));
-extern int *init_parse PROTO((void));
-extern void print_parse_statistics PROTO((void));
-extern void extract_interface_info PROTO((void));
-extern void do_pending_inlines PROTO((void));
-extern void process_next_inline PROTO((tree));
-/* skip save_pending_input */
-/* skip restore_pending_input */
-extern void yyungetc PROTO((int, int));
-extern void reinit_parse_for_method PROTO((int, tree));
-#if 0
-extern void reinit_parse_for_block PROTO((int, struct obstack *));
-#endif
-extern tree cons_up_default_function PROTO((tree, tree, int));
-extern void check_for_missing_semicolon PROTO((tree));
-extern void note_got_semicolon PROTO((tree));
-extern void note_list_got_semicolon PROTO((tree));
-extern void do_pending_lang_change PROTO((void));
-extern int identifier_type PROTO((tree));
-extern void see_typename PROTO((void));
-extern tree do_identifier PROTO((tree, int));
-extern tree do_scoped_id PROTO((tree, int));
-extern tree identifier_typedecl_value PROTO((tree));
-extern int real_yylex PROTO((void));
-extern int is_rid PROTO((tree));
-extern tree build_lang_decl PROTO((enum tree_code, tree, tree));
-extern tree build_lang_field_decl PROTO((enum tree_code, tree, tree));
-extern void copy_lang_decl PROTO((tree));
-extern tree make_lang_type PROTO((enum tree_code));
-extern void dump_time_statistics PROTO((void));
-/* extern void compiler_error PROTO((char *, HOST_WIDE_INT, HOST_WIDE_INT)); */
-extern void yyerror PROTO((char *));
-
-/* in method.c */
-extern void init_method PROTO((void));
-extern void do_inline_function_hair PROTO((tree, tree));
-/* skip report_type_mismatch */
-extern char *build_overload_name PROTO((tree, int, int));
-extern tree build_static_name PROTO((tree, tree));
-extern tree build_decl_overload PROTO((tree, tree, int));
-extern tree build_typename_overload PROTO((tree));
-extern tree build_overload_with_type PROTO((tree, tree));
-extern tree build_opfncall PROTO((enum tree_code, int, tree, tree, tree));
-extern tree hack_identifier PROTO((tree, tree));
-extern tree make_thunk PROTO((tree, int));
-extern void emit_thunk PROTO((tree));
-extern void synthesize_method PROTO((tree));
-
-/* in pt.c */
-extern tree tsubst PROTO ((tree, tree*, int, tree));
-extern tree tsubst_expr PROTO ((tree, tree*, int, tree));
-extern tree tsubst_copy PROTO ((tree, tree*, int, tree));
-extern tree tsubst_chain PROTO((tree, tree));
-extern void begin_template_parm_list PROTO((void));
-extern tree process_template_parm PROTO((tree, tree));
-extern tree end_template_parm_list PROTO((tree));
-extern void end_template_decl PROTO((void));
-extern tree current_template_args PROTO((void));
-extern void push_template_decl PROTO((tree));
-extern tree lookup_template_class PROTO((tree, tree, tree));
-extern int uses_template_parms PROTO((tree));
-extern tree instantiate_class_template PROTO((tree));
-extern tree instantiate_template PROTO((tree, tree *));
-extern void overload_template_name PROTO((tree));
-extern int type_unification PROTO((tree, tree *, tree, tree, int *, int, int));
-struct tinst_level *tinst_for_decl PROTO((void));
-extern void mark_decl_instantiated PROTO((tree, int));
-extern int more_specialized PROTO((tree, tree));
-extern void mark_class_instantiated PROTO((tree, int));
-extern void do_function_instantiation PROTO((tree, tree, tree));
-extern void do_type_instantiation PROTO((tree, tree));
-extern tree instantiate_decl PROTO((tree));
-extern tree lookup_nested_type_by_name PROTO((tree, tree));
-extern tree do_poplevel PROTO((void));
-extern tree *get_bindings PROTO((tree, tree));
-/* CONT ... */
-extern void add_tree PROTO((tree));
-extern void add_maybe_template PROTO((tree, tree));
-
-/* in repo.c */
-extern void repo_template_used PROTO((tree));
-extern void repo_template_instantiated PROTO((tree, int));
-extern void init_repo PROTO((char*));
-extern void finish_repo PROTO((void));
-
-/* in rtti.c */
-extern void init_rtti_processing PROTO((void));
-extern tree get_tinfo_fn_dynamic PROTO((tree));
-extern tree build_typeid PROTO((tree));
-extern tree build_x_typeid PROTO((tree));
-extern tree get_tinfo_fn PROTO((tree));
-extern tree get_typeid PROTO((tree));
-extern tree build_dynamic_cast PROTO((tree, tree));
-extern void synthesize_tinfo_fn PROTO((tree));
-
-/* in search.c */
-extern void push_memoized_context PROTO((tree, int));
-extern void pop_memoized_context PROTO((int));
-extern tree get_vbase PROTO((tree, tree));
-extern tree get_binfo PROTO((tree, tree, int));
-extern int get_base_distance PROTO((tree, tree, int, tree *));
-extern tree compute_access PROTO((tree, tree));
-extern tree lookup_field PROTO((tree, tree, int, int));
-extern tree lookup_nested_field PROTO((tree, int));
-extern tree lookup_fnfields PROTO((tree, tree, int));
-extern tree lookup_nested_tag PROTO((tree, tree));
-extern tree get_matching_virtual PROTO((tree, tree, int));
-extern tree get_abstract_virtuals PROTO((tree));
-extern tree get_baselinks PROTO((tree, tree, tree));
-extern tree next_baselink PROTO((tree));
-extern tree init_vbase_pointers PROTO((tree, tree));
-extern void expand_indirect_vtbls_init PROTO((tree, tree, tree));
-extern void clear_search_slots PROTO((tree));
-extern tree get_vbase_types PROTO((tree));
-extern void build_mi_matrix PROTO((tree));
-extern void free_mi_matrix PROTO((void));
-extern void build_mi_virtuals PROTO((int, int));
-extern void add_mi_virtuals PROTO((int, tree));
-extern void report_ambiguous_mi_virtuals PROTO((int, tree));
-extern void note_debug_info_needed PROTO((tree));
-extern void push_class_decls PROTO((tree));
-extern void pop_class_decls PROTO(());
-extern void unuse_fields PROTO((tree));
-extern void unmark_finished_struct PROTO((tree));
-extern void print_search_statistics PROTO((void));
-extern void init_search_processing PROTO((void));
-extern void reinit_search_statistics PROTO((void));
-extern tree current_scope PROTO((void));
-extern tree lookup_conversions PROTO((tree));
-extern tree get_template_base PROTO((tree, tree));
-
-/* in sig.c */
-extern tree build_signature_pointer_type PROTO((tree, int, int));
-extern tree build_signature_reference_type PROTO((tree, int, int));
-extern tree build_signature_pointer_constructor PROTO((tree, tree));
-extern tree build_signature_method_call PROTO((tree, tree));
-extern tree build_optr_ref PROTO((tree));
-extern void append_signature_fields PROTO((tree));
-
-/* in spew.c */
-extern void init_spew PROTO((void));
-extern int peek_yylex PROTO((void));
-extern int yylex PROTO((void));
-extern tree arbitrate_lookup PROTO((tree, tree, tree));
-
-/* in tree.c */
-extern int real_lvalue_p PROTO((tree));
-extern tree build_min PVPROTO((enum tree_code, tree, ...));
-extern tree build_min_nt PVPROTO((enum tree_code, ...));
-extern tree min_tree_cons PROTO((tree, tree, tree));
-extern int lvalue_p PROTO((tree));
-extern int lvalue_or_else PROTO((tree, char *));
-extern tree build_cplus_new PROTO((tree, tree));
-extern tree break_out_cleanups PROTO((tree));
-extern tree break_out_calls PROTO((tree));
-extern tree build_cplus_method_type PROTO((tree, tree, tree));
-extern tree build_cplus_staticfn_type PROTO((tree, tree, tree));
-extern tree build_cplus_array_type PROTO((tree, tree));
-extern void propagate_binfo_offsets PROTO((tree, tree));
-extern int layout_vbasetypes PROTO((tree, int));
-extern tree layout_basetypes PROTO((tree, tree));
-extern int list_hash PROTO((tree));
-extern tree list_hash_lookup PROTO((int, tree));
-extern void list_hash_add PROTO((int, tree));
-extern tree list_hash_canon PROTO((int, tree));
-extern tree hash_tree_cons PROTO((int, int, int, tree, tree, tree));
-extern tree hash_tree_chain PROTO((tree, tree));
-extern tree hash_chainon PROTO((tree, tree));
-extern tree get_decl_list PROTO((tree));
-extern tree make_binfo PROTO((tree, tree, tree, tree, tree));
-extern tree binfo_value PROTO((tree, tree));
-extern tree reverse_path PROTO((tree));
-extern int decl_list_length PROTO((tree));
-extern int count_functions PROTO((tree));
-extern int is_overloaded_fn PROTO((tree));
-extern tree get_first_fn PROTO((tree));
-extern tree fnaddr_from_vtable_entry PROTO((tree));
-extern tree function_arg_chain PROTO((tree));
-extern int promotes_to_aggr_type PROTO((tree, enum tree_code));
-extern int is_aggr_type_2 PROTO((tree, tree));
-extern void message_2_types PROTO((void (*)(), char *, tree, tree));
-extern char *lang_printable_name PROTO((tree, int));
-extern tree build_exception_variant PROTO((tree, tree));
-extern tree copy_to_permanent PROTO((tree));
-extern void print_lang_statistics PROTO((void));
-/* skip __eprintf */
-extern tree array_type_nelts_total PROTO((tree));
-extern tree array_type_nelts_top PROTO((tree));
-extern tree break_out_target_exprs PROTO((tree));
-extern tree get_type_decl PROTO((tree));
-extern tree vec_binfo_member PROTO((tree, tree));
-extern tree hack_decl_function_context PROTO((tree));
-extern tree lvalue_type PROTO((tree));
-extern tree error_type PROTO((tree));
-
-/* in typeck.c */
-extern tree condition_conversion PROTO((tree));
-extern tree target_type PROTO((tree));
-extern tree require_complete_type PROTO((tree));
-extern tree complete_type PROTO((tree));
-extern int type_unknown_p PROTO((tree));
-extern int fntype_p PROTO((tree));
-extern tree require_instantiated_type PROTO((tree, tree, tree));
-extern tree commonparms PROTO((tree, tree));
-extern tree common_type PROTO((tree, tree));
-extern int compexcepttypes PROTO((tree, tree));
-extern int comptypes PROTO((tree, tree, int));
-extern int comp_target_types PROTO((tree, tree, int));
-extern int compparms PROTO((tree, tree, int));
-extern int comp_target_types PROTO((tree, tree, int));
-extern int self_promoting_args_p PROTO((tree));
-extern tree unsigned_type PROTO((tree));
-extern tree signed_type PROTO((tree));
-extern tree signed_or_unsigned_type PROTO((int, tree));
-extern tree expr_sizeof PROTO((tree));
-extern tree c_sizeof PROTO((tree));
-extern tree c_sizeof_nowarn PROTO((tree));
-extern tree c_alignof PROTO((tree));
-extern tree inline_conversion PROTO((tree));
-extern tree decay_conversion PROTO((tree));
-extern tree default_conversion PROTO((tree));
-extern tree build_object_ref PROTO((tree, tree, tree));
-extern tree build_component_ref_1 PROTO((tree, tree, int));
-extern tree build_component_ref PROTO((tree, tree, tree, int));
-extern tree build_x_component_ref PROTO((tree, tree, tree, int));
-extern tree build_x_indirect_ref PROTO((tree, char *));
-extern tree build_indirect_ref PROTO((tree, char *));
-extern tree build_array_ref PROTO((tree, tree));
-extern tree build_x_function_call PROTO((tree, tree, tree));
-extern tree get_member_function_from_ptrfunc PROTO((tree *, tree));
-extern tree build_function_call_real PROTO((tree, tree, int, int));
-extern tree build_function_call PROTO((tree, tree));
-extern tree build_function_call_maybe PROTO((tree, tree));
-extern tree convert_arguments PROTO((tree, tree, tree, tree, int));
-extern tree build_x_binary_op PROTO((enum tree_code, tree, tree));
-extern tree build_binary_op PROTO((enum tree_code, tree, tree, int));
-extern tree build_binary_op_nodefault PROTO((enum tree_code, tree, tree, enum tree_code));
-extern tree build_component_addr PROTO((tree, tree, char *));
-extern tree build_x_unary_op PROTO((enum tree_code, tree));
-extern tree build_unary_op PROTO((enum tree_code, tree, int));
-extern tree unary_complex_lvalue PROTO((enum tree_code, tree));
-extern int mark_addressable PROTO((tree));
-extern tree build_x_conditional_expr PROTO((tree, tree, tree));
-extern tree build_conditional_expr PROTO((tree, tree, tree));
-extern tree build_x_compound_expr PROTO((tree));
-extern tree build_compound_expr PROTO((tree));
-extern tree build_static_cast PROTO((tree, tree));
-extern tree build_reinterpret_cast PROTO((tree, tree));
-extern tree build_const_cast PROTO((tree, tree));
-extern tree build_c_cast PROTO((tree, tree));
-extern tree build_x_modify_expr PROTO((tree, enum tree_code, tree));
-extern tree build_modify_expr PROTO((tree, enum tree_code, tree));
-extern int language_lvalue_valid PROTO((tree));
-extern void warn_for_assignment PROTO((char *, char *, char *, tree, int, int));
-extern tree convert_for_initialization PROTO((tree, tree, tree, int, char *, tree, int));
-extern void c_expand_asm_operands PROTO((tree, tree, tree, tree, int, char *, int));
-extern void c_expand_return PROTO((tree));
-extern tree c_expand_start_case PROTO((tree));
-extern int comp_ptr_ttypes PROTO((tree, tree));
-extern int ptr_reasonably_similar PROTO((tree, tree));
-extern tree build_ptrmemfunc PROTO((tree, tree, int));
-
-/* in typeck2.c */
-extern tree error_not_base_type PROTO((tree, tree));
-extern tree binfo_or_else PROTO((tree, tree));
-extern void readonly_error PROTO((tree, char *, int));
-extern void abstract_virtuals_error PROTO((tree, tree));
-extern void signature_error PROTO((tree, tree));
-extern void incomplete_type_error PROTO((tree, tree));
-extern void my_friendly_abort PROTO((int));
-extern void my_friendly_assert PROTO((int, int));
-extern tree store_init_value PROTO((tree, tree));
-extern tree digest_init PROTO((tree, tree, tree *));
-extern tree build_scoped_ref PROTO((tree, tree));
-extern tree build_x_arrow PROTO((tree));
-extern tree build_m_component_ref PROTO((tree, tree));
-extern tree build_functional_cast PROTO((tree, tree));
-extern char *enum_name_string PROTO((tree, tree));
-extern void report_case_error PROTO((int, tree, tree, tree));
-extern void check_for_new_typeid PROTO((char *,flagged_type_tree));
-
-/* in xref.c */
-extern void GNU_xref_begin PROTO((char *));
-extern void GNU_xref_end PROTO((int));
-extern void GNU_xref_file PROTO((char *));
-extern void GNU_xref_start_scope PROTO((HOST_WIDE_INT));
-extern void GNU_xref_end_scope PROTO((HOST_WIDE_INT, HOST_WIDE_INT, int, int));
-extern void GNU_xref_ref PROTO((tree, char *));
-extern void GNU_xref_decl PROTO((tree, tree));
-extern void GNU_xref_call PROTO((tree, char *));
-extern void GNU_xref_function PROTO((tree, tree));
-extern void GNU_xref_assign PROTO((tree));
-extern void GNU_xref_hier PROTO((char *, char *, int, int, int));
-extern void GNU_xref_member PROTO((tree, tree));
-
-/* -- end of C++ */
-
-#endif /* not _CP_TREE_H */
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
deleted file mode 100644
index cf961156411..00000000000
--- a/gcc/cp/cvt.c
+++ /dev/null
@@ -1,1826 +0,0 @@
-/* Language-level data type conversion for GNU C++.
- Copyright (C) 1987, 88, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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 file contains the functions for converting C expressions
- to different data types. The only entry point is `convert'.
- Every language front end must have a `convert' function
- but what kind of conversions it does will depend on the language. */
-
-#include "config.h"
-#include "tree.h"
-#include "flags.h"
-#include "cp-tree.h"
-#include "class.h"
-#include "convert.h"
-
-extern tree static_aggregates;
-
-/* Change of width--truncation and extension of integers or reals--
- is represented with NOP_EXPR. Proper functioning of many things
- assumes that no other conversions can be NOP_EXPRs.
-
- Conversion between integer and pointer is represented with CONVERT_EXPR.
- Converting integer to real uses FLOAT_EXPR
- and real to integer uses FIX_TRUNC_EXPR.
-
- Here is a list of all the functions that assume that widening and
- narrowing is always done with a NOP_EXPR:
- In convert.c, convert_to_integer.
- In c-typeck.c, build_binary_op_nodefault (boolean ops),
- and truthvalue_conversion.
- In expr.c: expand_expr, for operands of a MULT_EXPR.
- In fold-const.c: fold.
- In tree.c: get_narrower and get_unwidened.
-
- C++: in multiple-inheritance, converting between pointers may involve
- adjusting them by a delta stored within the class definition. */
-
-/* Subroutines of `convert'. */
-
-/* Build a thunk. What it is, is an entry point that when called will
- adjust the this pointer (the first argument) by offset, and then
- goto the real address of the function given by REAL_ADDR that we
- would like called. What we return is the address of the thunk. */
-
-static tree
-build_thunk (offset, real_addr)
- tree offset, real_addr;
-{
- if (TREE_CODE (real_addr) != ADDR_EXPR
- || TREE_CODE (TREE_OPERAND (real_addr, 0)) != FUNCTION_DECL)
- {
- sorry ("MI pointer to member conversion too complex");
- return error_mark_node;
- }
- sorry ("MI pointer to member conversion too complex");
- return error_mark_node;
-}
-
-/* Convert a `pointer to member' (POINTER_TYPE to METHOD_TYPE) into
- another `pointer to method'. This may involved the creation of
- a thunk to handle the this offset calculation. */
-
-static tree
-convert_fn_ptr (type, expr)
- tree type, expr;
-{
-#if 0 /* We don't use thunks for pmfs. */
- if (flag_vtable_thunks)
- {
- tree intype = TREE_TYPE (expr);
- tree binfo = get_binfo (TYPE_METHOD_BASETYPE (TREE_TYPE (intype)),
- TYPE_METHOD_BASETYPE (TREE_TYPE (type)), 1);
- if (binfo == error_mark_node)
- {
- error (" in pointer to member conversion");
- return error_mark_node;
- }
- if (binfo == NULL_TREE)
- {
- /* ARM 4.8 restriction. */
- error ("invalid pointer to member conversion");
- return error_mark_node;
- }
-
- if (BINFO_OFFSET_ZEROP (binfo))
- return build1 (NOP_EXPR, type, expr);
- return build1 (NOP_EXPR, type, build_thunk (BINFO_OFFSET (binfo), expr));
- }
- else
-#endif
- return build_ptrmemfunc (type, expr, 1);
-}
-
-/* if converting pointer to pointer
- if dealing with classes, check for derived->base or vice versa
- else if dealing with method pointers, delegate
- else convert blindly
- else if converting class, pass off to build_type_conversion
- else try C-style pointer conversion */
-
-static tree
-cp_convert_to_pointer (type, expr)
- tree type, expr;
-{
- register tree intype = TREE_TYPE (expr);
- register enum tree_code form;
-
- if (IS_AGGR_TYPE (intype))
- {
- tree rval;
-
- intype = complete_type (intype);
- if (TYPE_SIZE (intype) == NULL_TREE)
- {
- cp_error ("can't convert from incomplete type `%T' to `%T'",
- intype, type);
- return error_mark_node;
- }
-
- rval = build_type_conversion (CONVERT_EXPR, type, expr, 1);
- if (rval)
- {
- if (rval == error_mark_node)
- cp_error ("conversion of `%E' from `%T' to `%T' is ambiguous",
- expr, intype, type);
- return rval;
- }
- }
-
- if (TYPE_PTRMEMFUNC_P (type))
- type = TYPE_PTRMEMFUNC_FN_TYPE (type);
-
- /* Handle anachronistic conversions from (::*)() to cv void* or (*)(). */
- if (TREE_CODE (type) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
- || TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node))
- {
- /* Allow an implicit this pointer for pointer to member
- functions. */
- if (TYPE_PTRMEMFUNC_P (intype))
- {
- tree decl, basebinfo;
- tree fntype = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (intype));
- tree t = TYPE_METHOD_BASETYPE (fntype);
-
- if (current_class_type == 0
- || get_base_distance (t, current_class_type, 0, &basebinfo)
- == -1)
- {
- decl = build1 (NOP_EXPR, t, error_mark_node);
- }
- else if (current_class_ptr == 0)
- decl = build1 (NOP_EXPR, t, error_mark_node);
- else
- decl = current_class_ref;
-
- expr = build (OFFSET_REF, fntype, decl, expr);
- }
-
- if (TREE_CODE (expr) == OFFSET_REF
- && TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE)
- expr = resolve_offset_ref (expr);
- if (TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE)
- expr = build_addr_func (expr);
- if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
- {
- if (TREE_CODE (TREE_TYPE (TREE_TYPE (expr))) == METHOD_TYPE)
- if (pedantic || warn_pmf2ptr)
- cp_pedwarn ("converting from `%T' to `%T'", TREE_TYPE (expr),
- type);
- return build1 (NOP_EXPR, type, expr);
- }
- intype = TREE_TYPE (expr);
- }
-
- if (TYPE_PTRMEMFUNC_P (intype))
- intype = TYPE_PTRMEMFUNC_FN_TYPE (intype);
-
- form = TREE_CODE (intype);
-
- if (form == POINTER_TYPE || form == REFERENCE_TYPE)
- {
- intype = TYPE_MAIN_VARIANT (intype);
-
- if (TYPE_MAIN_VARIANT (type) != intype
- && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
- && IS_AGGR_TYPE (TREE_TYPE (type))
- && IS_AGGR_TYPE (TREE_TYPE (intype))
- && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
- {
- enum tree_code code = PLUS_EXPR;
- tree binfo = get_binfo (TREE_TYPE (type), TREE_TYPE (intype), 1);
- if (binfo == error_mark_node)
- return error_mark_node;
- if (binfo == NULL_TREE)
- {
- binfo = get_binfo (TREE_TYPE (intype), TREE_TYPE (type), 1);
- if (binfo == error_mark_node)
- return error_mark_node;
- code = MINUS_EXPR;
- }
- if (binfo)
- {
- if (TYPE_USES_VIRTUAL_BASECLASSES (TREE_TYPE (type))
- || TYPE_USES_VIRTUAL_BASECLASSES (TREE_TYPE (intype))
- || ! BINFO_OFFSET_ZEROP (binfo))
- {
- /* Need to get the path we took. */
- tree path;
-
- if (code == PLUS_EXPR)
- get_base_distance (TREE_TYPE (type), TREE_TYPE (intype), 0, &path);
- else
- get_base_distance (TREE_TYPE (intype), TREE_TYPE (type), 0, &path);
- return build_vbase_path (code, type, expr, path, 0);
- }
- }
- }
- if (TREE_CODE (TREE_TYPE (intype)) == METHOD_TYPE
- && TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
- return convert_fn_ptr (type, expr);
-
- if (TREE_CODE (TREE_TYPE (type)) == OFFSET_TYPE
- && TREE_CODE (TREE_TYPE (intype)) == OFFSET_TYPE)
- {
- tree b1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (type));
- tree b2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (intype));
- tree binfo = get_binfo (b1, b2, 1);
- if (binfo == NULL_TREE)
- binfo = get_binfo (b2, b1, 1);
- if (binfo == error_mark_node)
- return error_mark_node;
- }
-
- if (TREE_CODE (TREE_TYPE (intype)) == METHOD_TYPE
- || (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE))
- {
- cp_error ("cannot convert `%E' from type `%T' to type `%T'",
- expr, intype, type);
- return error_mark_node;
- }
-
- return build1 (NOP_EXPR, type, expr);
- }
-
- my_friendly_assert (form != OFFSET_TYPE, 186);
-
- if (TYPE_LANG_SPECIFIC (intype)
- && (IS_SIGNATURE_POINTER (intype) || IS_SIGNATURE_REFERENCE (intype)))
- return convert_to_pointer (type, build_optr_ref (expr));
-
- if (integer_zerop (expr))
- {
- if (TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
- return build_ptrmemfunc (type, expr, 0);
- expr = build_int_2 (0, 0);
- TREE_TYPE (expr) = type;
- return expr;
- }
-
- if (INTEGRAL_CODE_P (form))
- {
- if (type_precision (intype) == POINTER_SIZE)
- return build1 (CONVERT_EXPR, type, expr);
- expr = convert (type_for_size (POINTER_SIZE, 0), expr);
- /* Modes may be different but sizes should be the same. */
- if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (expr)))
- != GET_MODE_SIZE (TYPE_MODE (type)))
- /* There is supposed to be some integral type
- that is the same width as a pointer. */
- abort ();
- return convert_to_pointer (type, expr);
- }
-
- cp_error ("cannot convert `%E' from type `%T' to type `%T'",
- expr, intype, type);
- return error_mark_node;
-}
-
-/* Like convert, except permit conversions to take place which
- are not normally allowed due to access restrictions
- (such as conversion from sub-type to private super-type). */
-
-static tree
-convert_to_pointer_force (type, expr)
- tree type, expr;
-{
- register tree intype = TREE_TYPE (expr);
- register enum tree_code form = TREE_CODE (intype);
-
- if (integer_zerop (expr))
- {
- expr = build_int_2 (0, 0);
- TREE_TYPE (expr) = type;
- return expr;
- }
-
- /* Convert signature pointer/reference to `void *' first. */
- if (form == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (intype) || IS_SIGNATURE_REFERENCE (intype)))
- {
- expr = build_optr_ref (expr);
- intype = TREE_TYPE (expr);
- form = TREE_CODE (intype);
- }
-
- if (form == POINTER_TYPE)
- {
- intype = TYPE_MAIN_VARIANT (intype);
-
- if (TYPE_MAIN_VARIANT (type) != intype
- && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
- && IS_AGGR_TYPE (TREE_TYPE (type))
- && IS_AGGR_TYPE (TREE_TYPE (intype))
- && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE)
- {
- enum tree_code code = PLUS_EXPR;
- tree path;
- int distance = get_base_distance (TREE_TYPE (type),
- TREE_TYPE (intype), 0, &path);
- if (distance == -2)
- {
- ambig:
- cp_error ("type `%T' is ambiguous baseclass of `%s'",
- TREE_TYPE (type),
- TYPE_NAME_STRING (TREE_TYPE (intype)));
- return error_mark_node;
- }
- if (distance == -1)
- {
- distance = get_base_distance (TREE_TYPE (intype),
- TREE_TYPE (type), 0, &path);
- if (distance == -2)
- goto ambig;
- if (distance < 0)
- /* Doesn't need any special help from us. */
- return build1 (NOP_EXPR, type, expr);
-
- code = MINUS_EXPR;
- }
- return build_vbase_path (code, type, expr, path, 0);
- }
- }
-
- return cp_convert_to_pointer (type, expr);
-}
-
-/* We are passing something to a function which requires a reference.
- The type we are interested in is in TYPE. The initial
- value we have to begin with is in ARG.
-
- FLAGS controls how we manage access checking.
- DIRECT_BIND in FLAGS controls how any temporarys are generated.
- CHECKCONST controls if we report error messages on const subversion. */
-
-static tree
-build_up_reference (type, arg, flags, checkconst)
- tree type, arg;
- int flags, checkconst;
-{
- tree rval, targ;
- int literal_flag = 0;
- tree argtype = TREE_TYPE (arg);
- tree target_type = TREE_TYPE (type);
- tree binfo = NULL_TREE;
-
- my_friendly_assert (TREE_CODE (type) == REFERENCE_TYPE, 187);
- if ((flags & LOOKUP_PROTECT)
- && TYPE_MAIN_VARIANT (argtype) != TYPE_MAIN_VARIANT (target_type)
- && IS_AGGR_TYPE (argtype)
- && IS_AGGR_TYPE (target_type))
- {
- binfo = get_binfo (target_type, argtype, 1);
- if (binfo == error_mark_node)
- return error_mark_node;
- if (binfo == NULL_TREE)
- return error_not_base_type (target_type, argtype);
- }
-
- /* Pass along const and volatile down into the type. */
- if (TYPE_READONLY (type) || TYPE_VOLATILE (type))
- target_type = cp_build_type_variant (target_type, TYPE_READONLY (type),
- TYPE_VOLATILE (type));
- targ = arg;
- if (TREE_CODE (targ) == SAVE_EXPR)
- targ = TREE_OPERAND (targ, 0);
- while (TREE_CODE (targ) == NOP_EXPR
- && (TYPE_MAIN_VARIANT (argtype)
- == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (targ, 0)))))
- targ = TREE_OPERAND (targ, 0);
-
- switch (TREE_CODE (targ))
- {
- case INDIRECT_REF:
- /* This is a call to a constructor which did not know what it was
- initializing until now: it needs to initialize a temporary. */
- if (TREE_HAS_CONSTRUCTOR (targ))
- {
- tree temp = build_cplus_new (argtype, TREE_OPERAND (targ, 0));
- TREE_HAS_CONSTRUCTOR (targ) = 0;
- return build_up_reference (type, temp, flags, 1);
- }
- /* Let &* cancel out to simplify resulting code.
- Also, throw away intervening NOP_EXPRs. */
- arg = TREE_OPERAND (targ, 0);
- if (TREE_CODE (arg) == NOP_EXPR || TREE_CODE (arg) == NON_LVALUE_EXPR
- || (TREE_CODE (arg) == CONVERT_EXPR && TREE_REFERENCE_EXPR (arg)))
- arg = TREE_OPERAND (arg, 0);
-
- /* in doing a &*, we have to get rid of the const'ness on the pointer
- value. Haven't thought about volatile here. Pointers come to mind
- here. */
- if (TREE_READONLY (arg))
- {
- arg = copy_node (arg);
- TREE_READONLY (arg) = 0;
- }
-
- rval = build1 (CONVERT_EXPR, type, arg);
- TREE_REFERENCE_EXPR (rval) = 1;
-
- /* propagate the const flag on something like:
-
- class Base {
- public:
- int foo;
- };
-
- class Derived : public Base {
- public:
- int bar;
- };
-
- void func(Base&);
-
- void func2(const Derived& d) {
- func(d);
- }
-
- on the d parameter. The below could have been avoided, if the flags
- were down in the tree, not sure why they are not. (mrs) */
- /* The below code may have to be propagated to other parts of this
- switch. */
- if (TREE_READONLY (targ) && !TREE_READONLY (arg)
- && (TREE_CODE (arg) == PARM_DECL || TREE_CODE (arg) == VAR_DECL)
- && TREE_CODE (TREE_TYPE (arg)) == REFERENCE_TYPE
- && (TYPE_READONLY (target_type) && checkconst))
- {
- arg = copy_node (arg);
- TREE_READONLY (arg) = TREE_READONLY (targ);
- }
- literal_flag = TREE_CONSTANT (arg);
-
- goto done;
-
- /* Get this out of a register if we happened to be in one by accident.
- Also, build up references to non-lvalues it we must. */
- /* For &x[y], return (&) x+y */
- case ARRAY_REF:
- if (mark_addressable (TREE_OPERAND (targ, 0)) == 0)
- return error_mark_node;
- rval = build_binary_op (PLUS_EXPR, TREE_OPERAND (targ, 0),
- TREE_OPERAND (targ, 1), 1);
- TREE_TYPE (rval) = type;
- if (TREE_CONSTANT (TREE_OPERAND (targ, 1))
- && staticp (TREE_OPERAND (targ, 0)))
- TREE_CONSTANT (rval) = 1;
- goto done;
-
- case SCOPE_REF:
- /* Could be a reference to a static member. */
- {
- tree field = TREE_OPERAND (targ, 1);
- if (TREE_STATIC (field))
- {
- rval = build1 (ADDR_EXPR, type, field);
- literal_flag = 1;
- goto done;
- }
- }
-
- /* We should have farmed out member pointers above. */
- my_friendly_abort (188);
-
- case COMPONENT_REF:
- rval = build_component_addr (targ, build_pointer_type (argtype),
- "attempt to make a reference to bit-field structure member `%s'");
- TREE_TYPE (rval) = type;
- literal_flag = staticp (TREE_OPERAND (targ, 0));
-
- goto done;
-
- /* Anything not already handled and not a true memory reference
- needs to have a reference built up. Do so silently for
- things like integers and return values from function,
- but complain if we need a reference to something declared
- as `register'. */
-
- case PARM_DECL:
- /* 'this' is not an lvalue. */
- if (targ == current_class_ptr && ! flag_this_is_variable)
- break;
-
- case RESULT_DECL:
- case VAR_DECL:
- case CONST_DECL:
- if (staticp (targ))
- literal_flag = 1;
-
- /* Fall through. */
- case TARGET_EXPR:
- mark_addressable (targ);
- break;
-
- case COMPOUND_EXPR:
- {
- tree real_reference = build_up_reference (type, TREE_OPERAND (targ, 1),
- flags, checkconst);
- rval = build (COMPOUND_EXPR, type, TREE_OPERAND (targ, 0), real_reference);
- TREE_CONSTANT (rval) = staticp (TREE_OPERAND (targ, 1));
- return rval;
- }
-
- case PREINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case MODIFY_EXPR:
- case INIT_EXPR:
- {
- tree real_reference = build_up_reference (type, TREE_OPERAND (targ, 0),
- flags, checkconst);
- rval = build (COMPOUND_EXPR, type, arg, real_reference);
- TREE_CONSTANT (rval) = staticp (TREE_OPERAND (targ, 0));
- return rval;
- }
-
- case COND_EXPR:
- return build (COND_EXPR, type,
- TREE_OPERAND (targ, 0),
- build_up_reference (type, TREE_OPERAND (targ, 1),
- flags, checkconst),
- build_up_reference (type, TREE_OPERAND (targ, 2),
- flags, checkconst));
-
- /* Undo the folding... */
- case MIN_EXPR:
- case MAX_EXPR:
- return build (COND_EXPR, type,
- build (TREE_CODE (targ) == MIN_EXPR ? LT_EXPR : GT_EXPR,
- boolean_type_node, TREE_OPERAND (targ, 0),
- TREE_OPERAND (targ, 1)),
- build_up_reference (type, TREE_OPERAND (targ, 0),
- flags, checkconst),
- build_up_reference (type, TREE_OPERAND (targ, 1),
- flags, checkconst));
-
- case BIND_EXPR:
- arg = TREE_OPERAND (targ, 1);
- if (arg == NULL_TREE)
- {
- compiler_error ("({ ... }) expression not expanded when needed for reference");
- return error_mark_node;
- }
- rval = build1 (ADDR_EXPR, type, arg);
- TREE_REFERENCE_EXPR (rval) = 1;
- return rval;
-
- default:
- break;
- }
-
- if ((flags & DIRECT_BIND)
- && ! real_lvalue_p (targ))
- {
- if (toplevel_bindings_p ())
- {
- arg = get_temp_name (argtype, 1);
- literal_flag = 1;
- }
- else
- {
- arg = pushdecl (build_decl (VAR_DECL, NULL_TREE, argtype));
- DECL_ARTIFICIAL (arg) = 1;
- }
- DECL_INITIAL (arg) = targ;
- cp_finish_decl (arg, targ, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
- }
- else if (TREE_ADDRESSABLE (targ) == 0 && !(flags & DIRECT_BIND))
- {
- tree slot = build_decl (VAR_DECL, NULL_TREE, argtype);
- arg = build (TARGET_EXPR, argtype, slot, arg, NULL_TREE, NULL_TREE);
- }
-
- /* If we had a way to wrap this up, and say, if we ever needed it's
- address, transform all occurrences of the register, into a memory
- reference we could win better. */
- mark_addressable (arg);
- rval = build1 (ADDR_EXPR, type, arg);
-
- done:
- if (TYPE_USES_COMPLEX_INHERITANCE (argtype)
- || TYPE_USES_COMPLEX_INHERITANCE (target_type))
- {
- TREE_TYPE (rval) = build_pointer_type (argtype);
- if (flags & LOOKUP_PROTECT)
- rval = convert_pointer_to (target_type, rval);
- else
- rval
- = convert_to_pointer_force (build_pointer_type (target_type), rval);
- TREE_TYPE (rval) = type;
- if (TREE_CODE (rval) == PLUS_EXPR || TREE_CODE (rval) == MINUS_EXPR)
- TREE_TYPE (TREE_OPERAND (rval, 0))
- = TREE_TYPE (TREE_OPERAND (rval, 1)) = type;
- }
- TREE_CONSTANT (rval) = literal_flag;
- return rval;
-}
-
-/* For C++: Only need to do one-level references, but cannot
- get tripped up on signed/unsigned differences.
-
- DECL is either NULL_TREE or the _DECL node for a reference that is being
- initialized. It can be error_mark_node if we don't know the _DECL but
- we know it's an initialization. */
-
-tree
-convert_to_reference (reftype, expr, convtype, flags, decl)
- tree reftype, expr;
- int convtype, flags;
- tree decl;
-{
- register tree type = TYPE_MAIN_VARIANT (TREE_TYPE (reftype));
- register tree intype = TREE_TYPE (expr);
- tree rval = NULL_TREE;
- tree rval_as_conversion = NULL_TREE;
- int i;
-
- if (TREE_CODE (intype) == REFERENCE_TYPE)
- my_friendly_abort (364);
-
- intype = TYPE_MAIN_VARIANT (intype);
-
- i = comp_target_types (type, intype, 0);
-
- if (i <= 0 && (convtype & CONV_IMPLICIT) && IS_AGGR_TYPE (intype)
- && ! (flags & LOOKUP_NO_CONVERSION))
- {
- /* Look for a user-defined conversion to lvalue that we can use. */
-
- if (flag_ansi_overloading)
- rval_as_conversion
- = build_type_conversion (CONVERT_EXPR, reftype, expr, 1);
- else
- rval_as_conversion = build_type_conversion (CONVERT_EXPR, type, expr, 1);
-
- if (rval_as_conversion && rval_as_conversion != error_mark_node
- && real_lvalue_p (rval_as_conversion))
- {
- expr = rval_as_conversion;
- rval_as_conversion = NULL_TREE;
- intype = type;
- i = 1;
- }
- }
-
- if (((convtype & CONV_STATIC) && i == -1)
- || ((convtype & CONV_IMPLICIT) && i == 1))
- {
- if (flags & LOOKUP_COMPLAIN)
- {
- tree ttl = TREE_TYPE (reftype);
- tree ttr;
-
- {
- int r = TREE_READONLY (expr);
- int v = TREE_THIS_VOLATILE (expr);
- ttr = cp_build_type_variant (TREE_TYPE (expr), r, v);
- }
-
- if (! real_lvalue_p (expr) && ! TYPE_READONLY (ttl))
- {
- if (decl)
- /* Ensure semantics of [dcl.init.ref] */
- cp_pedwarn ("initialization of non-const reference `%#T' from rvalue `%T'",
- reftype, intype);
- else
- cp_pedwarn ("conversion to non-const `%T' from rvalue `%T'",
- reftype, intype);
- }
- else if (! (convtype & CONV_CONST))
- {
- if (! TYPE_READONLY (ttl) && TYPE_READONLY (ttr))
- cp_pedwarn ("conversion from `%T' to `%T' discards const",
- ttr, reftype);
- else if (! TYPE_VOLATILE (ttl) && TYPE_VOLATILE (ttr))
- cp_pedwarn ("conversion from `%T' to `%T' discards volatile",
- ttr, reftype);
- }
- }
-
- return build_up_reference (reftype, expr, flags,
- ! (convtype & CONV_CONST));
- }
- else if ((convtype & CONV_REINTERPRET) && lvalue_p (expr))
- {
- /* When casting an lvalue to a reference type, just convert into
- a pointer to the new type and deference it. This is allowed
- by San Diego WP section 5.2.9 paragraph 12, though perhaps it
- should be done directly (jason). (int &)ri ---> *(int*)&ri */
-
- /* B* bp; A& ar = (A&)bp; is valid, but it's probably not what they
- meant. */
- if (TREE_CODE (intype) == POINTER_TYPE
- && (comptypes (TREE_TYPE (intype), type, -1)))
- cp_warning ("casting `%T' to `%T' does not dereference pointer",
- intype, reftype);
-
- rval = build_unary_op (ADDR_EXPR, expr, 0);
- if (rval != error_mark_node)
- rval = convert_force (build_pointer_type (TREE_TYPE (reftype)), rval, 0);
- if (rval != error_mark_node)
- rval = build1 (NOP_EXPR, reftype, rval);
- }
- else if (flag_ansi_overloading)
- {
- rval = convert_for_initialization (NULL_TREE, type, expr, flags,
- "converting", 0, 0);
- if (rval == error_mark_node)
- return error_mark_node;
- rval = build_up_reference (reftype, rval, flags, 1);
-
- if (rval && ! TYPE_READONLY (TREE_TYPE (reftype)))
- cp_pedwarn ("initializing non-const `%T' with `%T' will use a temporary",
- reftype, intype);
- }
- else
- {
- tree rval_as_ctor = NULL_TREE;
-
- if (rval_as_conversion)
- {
- if (rval_as_conversion == error_mark_node)
- {
- cp_error ("conversion from `%T' to `%T' is ambiguous",
- intype, reftype);
- return error_mark_node;
- }
- rval_as_conversion = build_up_reference (reftype, rval_as_conversion,
- flags, 1);
- }
-
- /* Definitely need to go through a constructor here. */
- if (TYPE_HAS_CONSTRUCTOR (type)
- && ! CLASSTYPE_ABSTRACT_VIRTUALS (type)
- && (rval = build_method_call
- (NULL_TREE, ctor_identifier,
- build_tree_list (NULL_TREE, expr), TYPE_BINFO (type),
- LOOKUP_NO_CONVERSION|LOOKUP_SPECULATIVELY
- | LOOKUP_ONLYCONVERTING)))
- {
- tree init;
-
- if (toplevel_bindings_p ())
- {
- tree t = get_temp_name (type, toplevel_bindings_p ());
- init = build_method_call (t, ctor_identifier,
- build_tree_list (NULL_TREE, expr),
- TYPE_BINFO (type),
- LOOKUP_NORMAL|LOOKUP_NO_CONVERSION
- | LOOKUP_ONLYCONVERTING);
-
- if (init == error_mark_node)
- return error_mark_node;
-
- make_decl_rtl (t, NULL_PTR, 1);
- static_aggregates = perm_tree_cons (expr, t, static_aggregates);
- rval = build_unary_op (ADDR_EXPR, t, 0);
- }
- else
- {
- init = build_method_call (NULL_TREE, ctor_identifier,
- build_tree_list (NULL_TREE, expr),
- TYPE_BINFO (type),
- LOOKUP_NORMAL|LOOKUP_NO_CONVERSION
- |LOOKUP_ONLYCONVERTING);
-
- if (init == error_mark_node)
- return error_mark_node;
-
- rval = build_cplus_new (type, init);
- rval = build_up_reference (reftype, rval, flags, 1);
- }
- rval_as_ctor = rval;
- }
-
- if (rval_as_ctor && rval_as_conversion)
- {
- cp_error ("ambiguous conversion from `%T' to `%T'; both user-defined conversion and constructor apply",
- intype, reftype);
- return error_mark_node;
- }
- else if (rval_as_ctor)
- rval = rval_as_ctor;
- else if (rval_as_conversion)
- rval = rval_as_conversion;
- else if (! IS_AGGR_TYPE (type) && ! IS_AGGR_TYPE (intype))
- {
- rval = convert (type, expr);
- if (rval == error_mark_node)
- return error_mark_node;
-
- rval = build_up_reference (reftype, rval, flags, 1);
- }
-
- if (rval && ! TYPE_READONLY (TREE_TYPE (reftype)))
- cp_pedwarn ("initializing non-const `%T' with `%T' will use a temporary",
- reftype, intype);
- }
-
- if (rval)
- {
- /* If we found a way to convert earlier, then use it. */
- return rval;
- }
-
- my_friendly_assert (TREE_CODE (intype) != OFFSET_TYPE, 189);
-
- if (flags & LOOKUP_COMPLAIN)
- cp_error ("cannot convert type `%T' to type `%T'", intype, reftype);
-
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
-
- return error_mark_node;
-}
-
-/* We are using a reference VAL for its value. Bash that reference all the
- way down to its lowest form. */
-
-tree
-convert_from_reference (val)
- tree val;
-{
- tree type = TREE_TYPE (val);
-
- if (TREE_CODE (type) == OFFSET_TYPE)
- type = TREE_TYPE (type);
- if (TREE_CODE (type) == REFERENCE_TYPE)
- return build_indirect_ref (val, NULL_PTR);
- return val;
-}
-
-/* See if there is a constructor of type TYPE which will convert
- EXPR. The reference manual seems to suggest (8.5.6) that we need
- not worry about finding constructors for base classes, then converting
- to the derived class.
-
- MSGP is a pointer to a message that would be an appropriate error
- string. If MSGP is NULL, then we are not interested in reporting
- errors. */
-
-tree
-convert_to_aggr (type, expr, msgp, protect)
- tree type, expr;
- char **msgp;
- int protect;
-{
- tree basetype = type;
- tree name = TYPE_IDENTIFIER (basetype);
- tree function, fndecl, fntype, parmtypes, parmlist, result;
-#if 0
- /* See code below that used this. */
- tree method_name;
-#endif
- tree access;
- int can_be_private, can_be_protected;
-
- if (! TYPE_HAS_CONSTRUCTOR (basetype))
- {
- if (msgp)
- *msgp = "type `%s' does not have a constructor";
- return error_mark_node;
- }
-
- access = access_public_node;
- can_be_private = 0;
- can_be_protected = IDENTIFIER_CLASS_VALUE (name) || name == current_class_name;
-
- parmlist = build_tree_list (NULL_TREE, expr);
- parmtypes = tree_cons (NULL_TREE, TREE_TYPE (expr), void_list_node);
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (basetype))
- {
- parmtypes = tree_cons (NULL_TREE, integer_type_node, parmtypes);
- parmlist = tree_cons (NULL_TREE, integer_one_node, parmlist);
- }
-
- /* The type of the first argument will be filled in inside the loop. */
- parmlist = tree_cons (NULL_TREE, integer_zero_node, parmlist);
- parmtypes = tree_cons (NULL_TREE, build_pointer_type (basetype), parmtypes);
-
- /* No exact conversion was found. See if an approximate
- one will do. */
- fndecl = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (basetype), 0);
-
- {
- int saw_private = 0;
- int saw_protected = 0;
- struct candidate *candidates =
- (struct candidate *) alloca ((decl_list_length (fndecl)+1) * sizeof (struct candidate));
- struct candidate *cp = candidates;
-
- while (fndecl)
- {
- function = fndecl;
- cp->h_len = 2;
- cp->harshness = (struct harshness_code *)
- alloca (3 * sizeof (struct harshness_code));
-
- compute_conversion_costs (fndecl, parmlist, cp, 2);
- if ((cp->h.code & EVIL_CODE) == 0)
- {
- cp->u.field = fndecl;
- if (protect)
- {
- if (TREE_PRIVATE (fndecl))
- access = access_private_node;
- else if (TREE_PROTECTED (fndecl))
- access = access_protected_node;
- else
- access = access_public_node;
- }
- else
- access = access_public_node;
-
- if (access == access_private_node
- ? (basetype == current_class_type
- || is_friend (basetype, cp->function)
- || purpose_member (basetype, DECL_ACCESS (fndecl)))
- : access == access_protected_node
- ? (can_be_protected
- || purpose_member (basetype, DECL_ACCESS (fndecl)))
- : 1)
- {
- if (cp->h.code <= TRIVIAL_CODE)
- goto found_and_ok;
- cp++;
- }
- else
- {
- if (access == access_private_node)
- saw_private = 1;
- else
- saw_protected = 1;
- }
- }
- fndecl = DECL_CHAIN (fndecl);
- }
- if (cp - candidates)
- {
- /* Rank from worst to best. Then cp will point to best one.
- Private fields have their bits flipped. For unsigned
- numbers, this should make them look very large.
- If the best alternate has a (signed) negative value,
- then all we ever saw were private members. */
- if (cp - candidates > 1)
- qsort (candidates, /* char *base */
- cp - candidates, /* int nel */
- sizeof (struct candidate), /* int width */
- rank_for_overload); /* int (*compar)() */
-
- --cp;
- if (cp->h.code & EVIL_CODE)
- {
- if (msgp)
- *msgp = "ambiguous type conversion possible for `%s'";
- return error_mark_node;
- }
-
- function = cp->function;
- fndecl = cp->u.field;
- goto found_and_ok;
- }
- else if (msgp)
- {
- if (saw_private)
- if (saw_protected)
- *msgp = "only private and protected conversions apply";
- else
- *msgp = "only private conversions apply";
- else if (saw_protected)
- *msgp = "only protected conversions apply";
- else
- *msgp = "no appropriate conversion to type `%s'";
- }
- return error_mark_node;
- }
- /* NOTREACHED */
-
- found:
- if (access == access_private_node)
- if (! can_be_private)
- {
- if (msgp)
- *msgp = TREE_PRIVATE (fndecl)
- ? "conversion to type `%s' is private"
- : "conversion to type `%s' is from private base class";
- return error_mark_node;
- }
- if (access == access_protected_node)
- if (! can_be_protected)
- {
- if (msgp)
- *msgp = TREE_PRIVATE (fndecl)
- ? "conversion to type `%s' is protected"
- : "conversion to type `%s' is from protected base class";
- return error_mark_node;
- }
- function = fndecl;
- found_and_ok:
-
- /* It will convert, but we don't do anything about it yet. */
- if (msgp == 0)
- return NULL_TREE;
-
- fntype = TREE_TYPE (function);
-
- parmlist = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype),
- parmlist, NULL_TREE, LOOKUP_NORMAL);
-
- result = build_call (function, TREE_TYPE (fntype), parmlist);
- return result;
-}
-
-/* Call this when we know (for any reason) that expr is not, in fact,
- zero. This routine is like convert_pointer_to, but it pays
- attention to which specific instance of what type we want to
- convert to. This routine should eventually become
- convert_to_pointer after all references to convert_to_pointer
- are removed. */
-
-tree
-convert_pointer_to_real (binfo, expr)
- tree binfo, expr;
-{
- register tree intype = TREE_TYPE (expr);
- tree ptr_type;
- tree type, rval;
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else if (IS_AGGR_TYPE (binfo))
- {
- type = binfo;
- }
- else
- {
- type = binfo;
- binfo = NULL_TREE;
- }
-
- ptr_type = cp_build_type_variant (type, TYPE_READONLY (TREE_TYPE (intype)),
- TYPE_VOLATILE (TREE_TYPE (intype)));
- ptr_type = build_pointer_type (ptr_type);
- if (ptr_type == TYPE_MAIN_VARIANT (intype))
- return expr;
-
- if (intype == error_mark_node)
- return error_mark_node;
-
- my_friendly_assert (!integer_zerop (expr), 191);
-
- if (TREE_CODE (type) == RECORD_TYPE
- && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE
- && type != TYPE_MAIN_VARIANT (TREE_TYPE (intype)))
- {
- tree path;
- int distance
- = get_base_distance (binfo, TYPE_MAIN_VARIANT (TREE_TYPE (intype)),
- 0, &path);
-
- /* This function shouldn't be called with unqualified arguments
- but if it is, give them an error message that they can read. */
- if (distance < 0)
- {
- cp_error ("cannot convert a pointer of type `%T' to a pointer of type `%T'",
- TREE_TYPE (intype), type);
-
- if (distance == -2)
- cp_error ("because `%T' is an ambiguous base class", type);
- return error_mark_node;
- }
-
- return build_vbase_path (PLUS_EXPR, ptr_type, expr, path, 1);
- }
- rval = build1 (NOP_EXPR, ptr_type,
- TREE_CODE (expr) == NOP_EXPR ? TREE_OPERAND (expr, 0) : expr);
- TREE_CONSTANT (rval) = TREE_CONSTANT (expr);
- return rval;
-}
-
-/* Call this when we know (for any reason) that expr is
- not, in fact, zero. This routine gets a type out of the first
- argument and uses it to search for the type to convert to. If there
- is more than one instance of that type in the expr, the conversion is
- ambiguous. This routine should eventually go away, and all
- callers should use convert_to_pointer_real. */
-
-tree
-convert_pointer_to (binfo, expr)
- tree binfo, expr;
-{
- tree type;
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else if (IS_AGGR_TYPE (binfo))
- type = binfo;
- else
- type = binfo;
- return convert_pointer_to_real (type, expr);
-}
-
-/* Conversion...
-
- FLAGS indicates how we should behave. */
-
-tree
-cp_convert (type, expr, convtype, flags)
- tree type, expr;
- int convtype, flags;
-{
- register tree e = expr;
- register enum tree_code code = TREE_CODE (type);
-
- if (e == error_mark_node
- || TREE_TYPE (e) == error_mark_node)
- return error_mark_node;
-
- if (IS_AGGR_TYPE (type) && (convtype & CONV_FORCE_TEMP))
- /* We need a new temporary; don't take this shortcut. */;
- else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (e)))
- /* Trivial conversion: cv-qualifiers do not matter on rvalues. */
- return fold (build1 (NOP_EXPR, type, e));
-
- if (code == VOID_TYPE && (convtype & CONV_STATIC))
- return build1 (CONVERT_EXPR, type, e);
-
-#if 0
- /* This is incorrect. A truncation can't be stripped this way.
- Extensions will be stripped by the use of get_unwidened. */
- if (TREE_CODE (e) == NOP_EXPR)
- return convert (type, TREE_OPERAND (e, 0));
-#endif
-
- /* Just convert to the type of the member. */
- if (code == OFFSET_TYPE)
- {
- type = TREE_TYPE (type);
- code = TREE_CODE (type);
- }
-
-#if 0
- if (code == REFERENCE_TYPE)
- return fold (convert_to_reference (type, e, convtype, flags, NULL_TREE));
- else if (TREE_CODE (TREE_TYPE (e)) == REFERENCE_TYPE)
- e = convert_from_reference (e);
-#endif
-
- if (TREE_CODE (e) == OFFSET_REF)
- e = resolve_offset_ref (e);
-
- if (TREE_READONLY_DECL_P (e))
- e = decl_constant_value (e);
-
- if (INTEGRAL_CODE_P (code))
- {
- tree intype = TREE_TYPE (e);
- /* enum = enum, enum = int, enum = float, (enum)pointer are all
- errors. */
- if (flag_int_enum_equivalence == 0
- && TREE_CODE (type) == ENUMERAL_TYPE
- && ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC))
- || (TREE_CODE (intype) == POINTER_TYPE)))
- {
- cp_pedwarn ("conversion from `%#T' to `%#T'", intype, type);
-
- if (flag_pedantic_errors)
- return error_mark_node;
- }
- if (IS_AGGR_TYPE (intype))
- {
- tree rval;
- rval = build_type_conversion (CONVERT_EXPR, type, e, 1);
- if (rval)
- return rval;
- if (flags & LOOKUP_COMPLAIN)
- cp_error ("`%#T' used where a `%T' was expected", intype, type);
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
- return error_mark_node;
- }
- if (code == BOOLEAN_TYPE)
- {
- /* Common Ada/Pascal programmer's mistake. We always warn
- about this since it is so bad. */
- if (TREE_CODE (expr) == FUNCTION_DECL)
- cp_warning ("the address of `%D', will always be `true'", expr);
- return truthvalue_conversion (e);
- }
- return fold (convert_to_integer (type, e));
- }
- if (code == POINTER_TYPE || code == REFERENCE_TYPE
- || TYPE_PTRMEMFUNC_P (type))
- return fold (cp_convert_to_pointer (type, e));
- if (code == REAL_TYPE)
- {
- if (IS_AGGR_TYPE (TREE_TYPE (e)))
- {
- tree rval;
- rval = build_type_conversion (CONVERT_EXPR, type, e, 1);
- if (rval)
- return rval;
- else
- if (flags & LOOKUP_COMPLAIN)
- cp_error ("`%#T' used where a floating point value was expected",
- TREE_TYPE (e));
- }
- return fold (convert_to_real (type, e));
- }
-
- /* New C++ semantics: since assignment is now based on
- memberwise copying, if the rhs type is derived from the
- lhs type, then we may still do a conversion. */
- if (IS_AGGR_TYPE_CODE (code))
- {
- tree dtype = TREE_TYPE (e);
- tree ctor = NULL_TREE;
- tree conversion = NULL_TREE;
-
- dtype = TYPE_MAIN_VARIANT (dtype);
-
- /* Conversion of object pointers or signature pointers/references
- to signature pointers/references. */
-
- if (TYPE_LANG_SPECIFIC (type)
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type)))
- {
- tree constructor = build_signature_pointer_constructor (type, expr);
- tree sig_ty = SIGNATURE_TYPE (type);
- tree sig_ptr;
-
- if (constructor == error_mark_node)
- return error_mark_node;
-
- sig_ptr = get_temp_name (type, 1);
- DECL_INITIAL (sig_ptr) = constructor;
- CLEAR_SIGNATURE (sig_ty);
- cp_finish_decl (sig_ptr, constructor, NULL_TREE, 0, 0);
- SET_SIGNATURE (sig_ty);
- TREE_READONLY (sig_ptr) = 1;
-
- return sig_ptr;
- }
-
- /* Conversion between aggregate types. New C++ semantics allow
- objects of derived type to be cast to objects of base type.
- Old semantics only allowed this between pointers.
-
- There may be some ambiguity between using a constructor
- vs. using a type conversion operator when both apply. */
-
- if (flag_ansi_overloading)
- {
- ctor = e;
-
- if ((flags & LOOKUP_ONLYCONVERTING)
- && ! (IS_AGGR_TYPE (dtype) && DERIVED_FROM_P (type, dtype)))
- ctor = build_user_type_conversion (type, ctor, flags);
- if (ctor)
- ctor = build_method_call (NULL_TREE, ctor_identifier,
- build_tree_list (NULL_TREE, ctor),
- TYPE_BINFO (type), flags);
- if (ctor)
- return build_cplus_new (type, ctor);
- }
- else
- {
- if (IS_AGGR_TYPE (dtype) && ! DERIVED_FROM_P (type, dtype)
- && TYPE_HAS_CONVERSION (dtype))
- conversion = build_type_conversion (CONVERT_EXPR, type, e, 1);
-
- if (conversion == error_mark_node)
- {
- if (flags & LOOKUP_COMPLAIN)
- error ("ambiguous pointer conversion");
- return conversion;
- }
-
- if (TYPE_HAS_CONSTRUCTOR (complete_type (type)))
- ctor = build_method_call (NULL_TREE, ctor_identifier,
- build_tree_list (NULL_TREE, e),
- TYPE_BINFO (type),
- (flags & LOOKUP_NORMAL)
- | LOOKUP_SPECULATIVELY
- | (flags & LOOKUP_ONLYCONVERTING)
- | (flags & LOOKUP_NO_CONVERSION)
- | (conversion ? LOOKUP_NO_CONVERSION : 0));
-
- if (ctor == error_mark_node)
- {
- if (flags & LOOKUP_COMPLAIN)
- cp_error ("in conversion to type `%T'", type);
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
- return error_mark_node;
- }
-
- if (conversion && ctor)
- {
- if (flags & LOOKUP_COMPLAIN)
- error ("both constructor and type conversion operator apply");
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
- return error_mark_node;
- }
- else if (conversion)
- return conversion;
- else if (ctor)
- {
- ctor = build_cplus_new (type, ctor);
- return ctor;
- }
- }
- }
-
- /* If TYPE or TREE_TYPE (E) is not on the permanent_obstack,
- then the it won't be hashed and hence compare as not equal,
- even when it is. */
- if (code == ARRAY_TYPE
- && TREE_TYPE (TREE_TYPE (e)) == TREE_TYPE (type)
- && index_type_equal (TYPE_DOMAIN (TREE_TYPE (e)), TYPE_DOMAIN (type)))
- return e;
-
- if (flags & LOOKUP_COMPLAIN)
- cp_error ("conversion from `%T' to non-scalar type `%T' requested",
- TREE_TYPE (expr), type);
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
- return error_mark_node;
-}
-
-/* Create an expression whose value is that of EXPR,
- converted to type TYPE. The TREE_TYPE of the value
- is always TYPE. This function implements all reasonable
- conversions; callers should filter out those that are
- not permitted by the language being compiled. */
-
-tree
-convert (type, expr)
- tree type, expr;
-{
- return cp_convert (type, expr, CONV_OLD_CONVERT, LOOKUP_NORMAL);
-}
-
-/* Like convert, except permit conversions to take place which
- are not normally allowed due to access restrictions
- (such as conversion from sub-type to private super-type). */
-
-tree
-convert_force (type, expr, convtype)
- tree type;
- tree expr;
- int convtype;
-{
- register tree e = expr;
- register enum tree_code code = TREE_CODE (type);
-
- if (code == REFERENCE_TYPE)
- return fold (convert_to_reference (type, e, CONV_C_CAST, LOOKUP_COMPLAIN,
- NULL_TREE));
- else if (TREE_CODE (TREE_TYPE (e)) == REFERENCE_TYPE)
- e = convert_from_reference (e);
-
- if (code == POINTER_TYPE)
- return fold (convert_to_pointer_force (type, e));
-
- /* From typeck.c convert_for_assignment */
- if (((TREE_CODE (TREE_TYPE (e)) == POINTER_TYPE && TREE_CODE (e) == ADDR_EXPR
- && TREE_CODE (TREE_TYPE (e)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_TYPE (e))) == METHOD_TYPE)
- || integer_zerop (e)
- || TYPE_PTRMEMFUNC_P (TREE_TYPE (e)))
- && TYPE_PTRMEMFUNC_P (type))
- {
- /* compatible pointer to member functions. */
- return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), e, 1);
- }
-
- return cp_convert (type, e, CONV_C_CAST|convtype, LOOKUP_NORMAL);
-}
-
-/* Subroutine of build_type_conversion. */
-
-static tree
-build_type_conversion_1 (xtype, basetype, expr, typename, for_sure)
- tree xtype, basetype;
- tree expr;
- tree typename;
- int for_sure;
-{
- tree rval;
- int flags;
-
- if (for_sure == 0)
- flags = LOOKUP_PROTECT|LOOKUP_ONLYCONVERTING;
- else
- flags = LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING;
-
- rval = build_method_call (expr, typename, NULL_TREE, NULL_TREE, flags);
- if (rval == error_mark_node)
- {
- if (for_sure == 0)
- return NULL_TREE;
- return error_mark_node;
- }
-
- if (IS_AGGR_TYPE (TREE_TYPE (rval)))
- return rval;
-
- if (warn_cast_qual
- && TREE_TYPE (xtype)
- && (TREE_READONLY (TREE_TYPE (TREE_TYPE (rval)))
- > TREE_READONLY (TREE_TYPE (xtype))))
- warning ("user-defined conversion casting away `const'");
- return convert (xtype, rval);
-}
-
-/* Convert an aggregate EXPR to type XTYPE. If a conversion
- exists, return the attempted conversion. This may
- return ERROR_MARK_NODE if the conversion is not
- allowed (references private members, etc).
- If no conversion exists, NULL_TREE is returned.
-
- If (FOR_SURE & 1) is non-zero, then we allow this type conversion
- to take place immediately. Otherwise, we build a SAVE_EXPR
- which can be evaluated if the results are ever needed.
-
- Changes to this functions should be mirrored in user_harshness.
-
- FIXME: Ambiguity checking is wrong. Should choose one by the implicit
- object parameter, or by the second standard conversion sequence if
- that doesn't do it. This will probably wait for an overloading rewrite.
- (jason 8/9/95) */
-
-tree
-build_type_conversion (code, xtype, expr, for_sure)
- enum tree_code code;
- tree xtype, expr;
- int for_sure;
-{
- /* C++: check to see if we can convert this aggregate type
- into the required type. */
- tree basetype;
- tree conv;
- tree winner = NULL_TREE;
-
- if (flag_ansi_overloading)
- return build_user_type_conversion
- (xtype, expr, for_sure ? LOOKUP_NORMAL : 0);
-
- if (expr == error_mark_node)
- return error_mark_node;
-
- basetype = TREE_TYPE (expr);
- if (TREE_CODE (basetype) == REFERENCE_TYPE)
- basetype = TREE_TYPE (basetype);
-
- basetype = TYPE_MAIN_VARIANT (basetype);
- if (! TYPE_LANG_SPECIFIC (basetype) || ! TYPE_HAS_CONVERSION (basetype))
- return NULL_TREE;
-
- /* Do we have an exact match? */
- {
- tree typename = build_typename_overload (xtype);
- if (lookup_fnfields (TYPE_BINFO (basetype), typename, 0))
- return build_type_conversion_1 (xtype, basetype, expr, typename,
- for_sure);
- }
-
- /* Nope; try looking for others. */
- for (conv = lookup_conversions (basetype); conv; conv = TREE_CHAIN (conv))
- {
- tree cand = TREE_VALUE (conv);
-
- if (winner && winner == cand)
- continue;
-
- if (can_convert (xtype, TREE_TYPE (TREE_TYPE (cand))))
- {
- if (winner)
- {
- if (for_sure)
- {
- cp_error ("ambiguous conversion from `%T' to `%T'", basetype,
- xtype);
- cp_error (" candidate conversions include `%D' and `%D'",
- winner, cand);
- }
- return NULL_TREE;
- }
- else
- winner = cand;
- }
- }
-
- if (winner)
- return build_type_conversion_1 (xtype, basetype, expr,
- DECL_NAME (winner), for_sure);
-
- return NULL_TREE;
-}
-
-/* Convert the given EXPR to one of a group of types suitable for use in an
- expression. DESIRES is a combination of various WANT_* flags (q.v.)
- which indicates which types are suitable. If COMPLAIN is 1, complain
- about ambiguity; otherwise, the caller will deal with it. */
-
-tree
-build_expr_type_conversion (desires, expr, complain)
- int desires;
- tree expr;
- int complain;
-{
- tree basetype = TREE_TYPE (expr);
- tree conv;
- tree winner = NULL_TREE;
-
- if (TREE_CODE (basetype) == OFFSET_TYPE)
- expr = resolve_offset_ref (expr);
- expr = convert_from_reference (expr);
- basetype = TREE_TYPE (expr);
-
- if (! IS_AGGR_TYPE (basetype))
- switch (TREE_CODE (basetype))
- {
- case INTEGER_TYPE:
- if ((desires & WANT_NULL) && TREE_CODE (expr) == INTEGER_CST
- && integer_zerop (expr))
- return expr;
- /* else fall through... */
-
- case BOOLEAN_TYPE:
- return (desires & WANT_INT) ? expr : NULL_TREE;
- case ENUMERAL_TYPE:
- return (desires & WANT_ENUM) ? expr : NULL_TREE;
- case REAL_TYPE:
- return (desires & WANT_FLOAT) ? expr : NULL_TREE;
- case POINTER_TYPE:
- return (desires & WANT_POINTER) ? expr : NULL_TREE;
-
- case FUNCTION_TYPE:
- case ARRAY_TYPE:
- return (desires & WANT_POINTER) ? default_conversion (expr)
- : NULL_TREE;
- default:
- return NULL_TREE;
- }
-
- if (! TYPE_HAS_CONVERSION (basetype))
- return NULL_TREE;
-
- for (conv = lookup_conversions (basetype); conv; conv = TREE_CHAIN (conv))
- {
- int win = 0;
- tree candidate;
- tree cand = TREE_VALUE (conv);
-
- if (winner && winner == cand)
- continue;
-
- candidate = TREE_TYPE (TREE_TYPE (cand));
- if (TREE_CODE (candidate) == REFERENCE_TYPE)
- candidate = TREE_TYPE (candidate);
-
- switch (TREE_CODE (candidate))
- {
- case BOOLEAN_TYPE:
- case INTEGER_TYPE:
- win = (desires & WANT_INT); break;
- case ENUMERAL_TYPE:
- win = (desires & WANT_ENUM); break;
- case REAL_TYPE:
- win = (desires & WANT_FLOAT); break;
- case POINTER_TYPE:
- win = (desires & WANT_POINTER); break;
- }
-
- if (win)
- {
- if (winner)
- {
- if (complain)
- {
- cp_error ("ambiguous default type conversion from `%T'",
- basetype);
- cp_error (" candidate conversions include `%D' and `%D'",
- winner, cand);
- }
- return error_mark_node;
- }
- else
- winner = cand;
- }
- }
-
- if (winner)
- {
- tree type = TREE_TYPE (TREE_TYPE (winner));
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
- return build_type_conversion_1 (type, basetype, expr,
- DECL_NAME (winner), 1);
- }
-
- return NULL_TREE;
-}
-
-/* Must convert two aggregate types to non-aggregate type.
- Attempts to find a non-ambiguous, "best" type conversion.
-
- Return 1 on success, 0 on failure.
-
- @@ What are the real semantics of this supposed to be??? */
-
-int
-build_default_binary_type_conversion (code, arg1, arg2)
- enum tree_code code;
- tree *arg1, *arg2;
-{
- switch (code)
- {
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case EXACT_DIV_EXPR:
- *arg1 = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, *arg1, 0);
- *arg2 = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, *arg2, 0);
- break;
-
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case BIT_AND_EXPR:
- case BIT_XOR_EXPR:
- case BIT_IOR_EXPR:
- *arg1 = build_expr_type_conversion (WANT_INT | WANT_ENUM, *arg1, 0);
- *arg2 = build_expr_type_conversion (WANT_INT | WANT_ENUM, *arg2, 0);
- break;
-
- case PLUS_EXPR:
- {
- tree a1, a2, p1, p2;
- int wins;
-
- a1 = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, *arg1, 0);
- a2 = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, *arg2, 0);
- p1 = build_expr_type_conversion (WANT_POINTER, *arg1, 0);
- p2 = build_expr_type_conversion (WANT_POINTER, *arg2, 0);
-
- wins = (a1 && a2) + (a1 && p2) + (p1 && a2);
-
- if (wins > 1)
- error ("ambiguous default type conversion for `operator +'");
-
- if (a1 && a2)
- *arg1 = a1, *arg2 = a2;
- else if (a1 && p2)
- *arg1 = a1, *arg2 = p2;
- else
- *arg1 = p1, *arg2 = a2;
- break;
- }
-
- case MINUS_EXPR:
- {
- tree a1, a2, p1, p2;
- int wins;
-
- a1 = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, *arg1, 0);
- a2 = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, *arg2, 0);
- p1 = build_expr_type_conversion (WANT_POINTER, *arg1, 0);
- p2 = build_expr_type_conversion (WANT_POINTER, *arg2, 0);
-
- wins = (a1 && a2) + (p1 && p2) + (p1 && a2);
-
- if (wins > 1)
- error ("ambiguous default type conversion for `operator -'");
-
- if (a1 && a2)
- *arg1 = a1, *arg2 = a2;
- else if (p1 && p2)
- *arg1 = p1, *arg2 = p2;
- else
- *arg1 = p1, *arg2 = a2;
- break;
- }
-
- case GT_EXPR:
- case LT_EXPR:
- case GE_EXPR:
- case LE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- {
- tree a1, a2, p1, p2;
- int wins;
-
- a1 = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, *arg1, 0);
- a2 = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, *arg2, 0);
- p1 = build_expr_type_conversion (WANT_POINTER | WANT_NULL, *arg1, 0);
- p2 = build_expr_type_conversion (WANT_POINTER | WANT_NULL, *arg2, 0);
-
- wins = (a1 && a2) + (p1 && p2);
-
- if (wins > 1)
- cp_error ("ambiguous default type conversion for `%O'", code);
-
- if (a1 && a2)
- *arg1 = a1, *arg2 = a2;
- else
- *arg1 = p1, *arg2 = p2;
- break;
- }
-
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- *arg1 = convert (boolean_type_node, *arg1);
- *arg2 = convert (boolean_type_node, *arg2);
- break;
-
- default:
- *arg1 = NULL_TREE;
- *arg2 = NULL_TREE;
- }
-
- if (*arg1 == error_mark_node || *arg2 == error_mark_node)
- cp_error ("ambiguous default type conversion for `%O'", code);
-
- if (*arg1 && *arg2)
- return 1;
-
- return 0;
-}
-
-/* Implements integral promotion (4.1) and float->double promotion. */
-
-tree
-type_promotes_to (type)
- tree type;
-{
- int constp, volatilep;
-
- if (type == error_mark_node)
- return error_mark_node;
-
- constp = TYPE_READONLY (type);
- volatilep = TYPE_VOLATILE (type);
- type = TYPE_MAIN_VARIANT (type);
-
- /* bool always promotes to int (not unsigned), even if it's the same
- size. */
- if (type == boolean_type_node)
- type = integer_type_node;
-
- /* Normally convert enums to int, but convert wide enums to something
- wider. */
- else if (TREE_CODE (type) == ENUMERAL_TYPE
- || type == wchar_type_node)
- {
- int precision = MAX (TYPE_PRECISION (type),
- TYPE_PRECISION (integer_type_node));
- tree totype = type_for_size (precision, 0);
- if (TREE_UNSIGNED (type)
- && ! int_fits_type_p (TYPE_MAX_VALUE (type), totype))
- type = type_for_size (precision, 1);
- else
- type = totype;
- }
- else if (C_PROMOTING_INTEGER_TYPE_P (type))
- {
- /* Retain unsignedness if really not getting bigger. */
- if (TREE_UNSIGNED (type)
- && TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
- type = unsigned_type_node;
- else
- type = integer_type_node;
- }
- else if (type == float_type_node)
- type = double_type_node;
-
- return cp_build_type_variant (type, constp, volatilep);
-}
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
deleted file mode 100644
index 1fd2026f118..00000000000
--- a/gcc/cp/decl.c
+++ /dev/null
@@ -1,12637 +0,0 @@
-/* Process declarations and variables for C compiler.
- Copyright (C) 1988, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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. */
-
-
-/* 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 <stdio.h>
-#include "config.h"
-#include "tree.h"
-#include "rtl.h"
-#include "flags.h"
-#include "cp-tree.h"
-#include "decl.h"
-#include "lex.h"
-#include <sys/types.h>
-#include <signal.h>
-#include "obstack.h"
-#include "defaults.h"
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern tree builtin_return_address_fndecl;
-
-extern struct obstack permanent_obstack;
-
-extern int current_class_depth;
-
-extern tree cleanups_this_call;
-
-extern tree static_ctors, static_dtors;
-
-/* Stack of places to restore the search obstack back to. */
-
-/* Obstack used for remembering local class declarations (like
- enums and static (const) members. */
-#include "stack.h"
-struct obstack decl_obstack;
-static struct stack_level *decl_stack;
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef BOOL_TYPE_SIZE
-#ifdef SLOW_BYTE_ACCESS
-#define BOOL_TYPE_SIZE ((SLOW_BYTE_ACCESS) ? (POINTER_SIZE) : (CHAR_TYPE_SIZE))
-#else
-#define BOOL_TYPE_SIZE CHAR_TYPE_SIZE
-#endif
-#endif
-
-/* We let tm.h override the types used here, to handle trivial differences
- such as the choice of unsigned int or long unsigned int for size_t.
- When machines start needing nontrivial differences in the size type,
- it would be best to do something here to figure out automatically
- from other information what type to use. */
-
-#ifndef SIZE_TYPE
-#define SIZE_TYPE "long unsigned int"
-#endif
-
-#ifndef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-#endif
-
-#ifndef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-#endif
-
-static tree grokparms PROTO((tree, int));
-static tree lookup_nested_type PROTO((tree, tree));
-static char *redeclaration_error_message PROTO((tree, tree));
-static void revert_static_member_fn PROTO((tree *, tree *, tree *));
-static tree push_overloaded_decl PROTO((tree, int));
-static void push_overloaded_decl_top_level PROTO((tree, int));
-
-tree define_function
- PROTO((char *, tree, enum built_in_function, void (*)(), char *));
-
-/* a node which has tree code ERROR_MARK, and whose type is itself.
- All erroneous expressions are replaced with this node. All functions
- that accept nodes as arguments should avoid generating error messages
- if this node is one of the arguments, since it is undesirable to get
- multiple error messages from one error in the input. */
-
-tree error_mark_node;
-
-/* Erroneous argument lists can use this *IFF* they do not modify it. */
-tree error_mark_list;
-
-/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */
-
-tree short_integer_type_node;
-tree integer_type_node;
-tree long_integer_type_node;
-tree long_long_integer_type_node;
-
-tree short_unsigned_type_node;
-tree unsigned_type_node;
-tree long_unsigned_type_node;
-tree long_long_unsigned_type_node;
-
-tree ptrdiff_type_node;
-
-tree unsigned_char_type_node;
-tree signed_char_type_node;
-tree char_type_node;
-tree wchar_type_node;
-tree signed_wchar_type_node;
-tree unsigned_wchar_type_node;
-
-tree wchar_decl_node;
-
-tree float_type_node;
-tree double_type_node;
-tree long_double_type_node;
-
-tree intQI_type_node;
-tree intHI_type_node;
-tree intSI_type_node;
-tree intDI_type_node;
-
-tree unsigned_intQI_type_node;
-tree unsigned_intHI_type_node;
-tree unsigned_intSI_type_node;
-tree unsigned_intDI_type_node;
-
-/* a VOID_TYPE node, and the same, packaged in a TREE_LIST. */
-
-tree void_type_node, void_list_node;
-tree void_zero_node;
-
-/* Nodes for types `void *' and `const void *'. */
-
-tree ptr_type_node;
-static tree const_ptr_type_node;
-
-/* Nodes for types `char *' and `const char *'. */
-
-tree string_type_node, const_string_type_node;
-
-/* Type `char[256]' or something like it.
- Used when an array of char is needed and the size is irrelevant. */
-
-tree char_array_type_node;
-
-/* Type `int[256]' or something like it.
- Used when an array of int needed and the size is irrelevant. */
-
-tree int_array_type_node;
-
-/* Type `wchar_t[256]' or something like it.
- Used when a wide string literal is created. */
-
-tree wchar_array_type_node;
-
-/* The bool data type, and constants */
-tree boolean_type_node, boolean_true_node, boolean_false_node;
-
-/* type `int ()' -- used for implicit declaration of functions. */
-
-tree default_function_type;
-
-/* function types `double (double)' and `double (double, double)', etc. */
-
-static tree double_ftype_double, double_ftype_double_double;
-static tree int_ftype_int, long_ftype_long;
-static tree float_ftype_float;
-static tree ldouble_ftype_ldouble;
-
-/* Function type `int (const void *, const void *, size_t)' */
-static tree int_ftype_cptr_cptr_sizet;
-
-/* C++ extensions */
-tree vtable_entry_type;
-tree delta_type_node;
-#if 0
-/* Old rtti stuff. */
-tree __baselist_desc_type_node;
-tree __i_desc_type_node, __m_desc_type_node;
-tree __t_desc_array_type, __i_desc_array_type, __m_desc_array_type;
-#endif
-tree __t_desc_type_node;
-#if 0
-tree __tp_desc_type_node;
-#endif
-tree __access_mode_type_node;
-tree __bltn_desc_type_node, __user_desc_type_node, __class_desc_type_node;
-tree __ptr_desc_type_node, __attr_desc_type_node, __func_desc_type_node;
-tree __ptmf_desc_type_node, __ptmd_desc_type_node;
-#if 0
-/* Not needed yet? May be needed one day? */
-tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type;
-tree __ptr_desc_array_type, __attr_dec_array_type, __func_desc_array_type;
-tree __ptmf_desc_array_type, __ptmd_desc_array_type;
-#endif
-
-tree class_star_type_node;
-tree class_type_node, record_type_node, union_type_node, enum_type_node;
-tree unknown_type_node;
-tree opaque_type_node, signature_type_node;
-tree sigtable_entry_type;
-
-/* Array type `vtable_entry_type[]' */
-tree vtbl_type_node;
-
-/* In a destructor, the point at which all derived class destroying
- has been done, just before any base class destroying will be done. */
-
-tree dtor_label;
-
-/* In a destructor, the last insn emitted after the start of the
- function and the parms. */
-
-static rtx last_dtor_insn;
-
-/* In a constructor, the point at which we are ready to return
- the pointer to the initialized object. */
-
-tree ctor_label;
-
-/* A FUNCTION_DECL which can call `abort'. Not necessarily the
- one that the user will declare, but sufficient to be called
- by routines that want to abort the program. */
-
-tree abort_fndecl;
-
-extern rtx cleanup_label, return_label;
-
-/* If original DECL_RESULT of current function was a register,
- but due to being an addressable named return value, would up
- on the stack, this variable holds the named return value's
- original location. */
-static rtx original_result_rtx;
-
-/* Sequence of insns which represents base initialization. */
-tree base_init_expr;
-
-/* C++: Keep these around to reduce calls to `get_identifier'.
- Identifiers for `this' in member functions and the auto-delete
- parameter for destructors. */
-tree this_identifier, in_charge_identifier;
-tree ctor_identifier, dtor_identifier;
-/* Used in pointer to member functions, in vtables, and in sigtables. */
-tree pfn_identifier, index_identifier, delta_identifier, delta2_identifier;
-tree pfn_or_delta2_identifier, tag_identifier;
-tree vt_off_identifier;
-
-struct named_label_list
-{
- struct binding_level *binding_level;
- tree names_in_scope;
- tree label_decl;
- char *filename_o_goto;
- int lineno_o_goto;
- struct named_label_list *next;
-};
-
-/* A list (chain of TREE_LIST nodes) of named label uses.
- The TREE_PURPOSE field is the list of variables defined
- the the label's scope defined at the point of use.
- The TREE_VALUE field is the LABEL_DECL used.
- The TREE_TYPE field holds `current_binding_level' at the
- point of the label's use.
-
- BWAHAHAAHAHahhahahahaah. No, no, no, said the little chicken.
-
- Look at the pretty struct named_label_list. See the pretty struct
- with the pretty named fields that describe what they do. See the
- pretty lack of gratuitous casts. Notice the code got a lot cleaner.
-
- Used only for jumps to as-yet undefined labels, since
- jumps to defined labels can have their validity checked
- by stmt.c. */
-
-static struct named_label_list *named_label_uses = NULL;
-
-/* A list of objects which have constructors or destructors
- which reside in the global scope. The decl is stored in
- the TREE_VALUE slot and the initializer is stored
- in the TREE_PURPOSE slot. */
-tree static_aggregates;
-
-/* -- end of C++ */
-
-/* Two expressions that are constants with value zero.
- The first is of type `int', the second of type `void *'. */
-
-tree integer_zero_node;
-tree null_pointer_node;
-
-/* The value for __null (NULL), either of type `void *' or, with -ansi,
- an integer type of the same size. */
-
-tree null_node;
-
-/* A node for the integer constants 1, 2, and 3. */
-
-tree integer_one_node, integer_two_node, integer_three_node;
-
-/* While defining an enum type, this is 1 plus the last enumerator
- constant value. */
-
-static tree enum_next_value;
-
-/* Nonzero means that there was overflow computing enum_next_value. */
-
-static int enum_overflow;
-
-/* Parsing a function declarator leaves a list of parameter names
- or a chain or parameter decls here. */
-
-tree last_function_parms;
-
-/* Parsing a function declarator leaves here a chain of structure
- and enum types declared in the parmlist. */
-
-static tree last_function_parm_tags;
-
-/* After parsing the declarator that starts a function definition,
- `start_function' puts here the list of parameter names or chain of decls.
- `store_parm_decls' finds it here. */
-
-static tree current_function_parms;
-
-/* Similar, for last_function_parm_tags. */
-static tree current_function_parm_tags;
-
-/* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function
- that have names. Here so we can clear out their names' definitions
- at the end of the function. */
-
-static tree named_labels;
-
-/* A list of LABEL_DECLs from outer contexts that are currently shadowed. */
-
-static tree shadowed_labels;
-
-/* The FUNCTION_DECL for the function currently being compiled,
- or 0 if between functions. */
-tree current_function_decl;
-
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement that specifies a return value is seen. */
-
-int current_function_returns_value;
-
-/* Set to 0 at beginning of a function definition, set to 1 if
- a return statement with no argument is seen. */
-
-int current_function_returns_null;
-
-/* Set to 0 at beginning of a function definition, and whenever
- a label (case or named) is defined. Set to value of expression
- returned from function when that value can be transformed into
- a named return value. */
-
-tree current_function_return_value;
-
-/* Set to nonzero by `grokdeclarator' for a function
- whose return type is defaulted, if warnings for this are desired. */
-
-static int warn_about_return_type;
-
-/* Nonzero means give `double' the same size as `float'. */
-
-extern int flag_short_double;
-
-/* Nonzero means don't recognize any builtin functions. */
-
-extern int flag_no_builtin;
-
-/* Nonzero means don't recognize the non-ANSI builtin functions.
- -ansi sets this. */
-
-extern int flag_no_nonansi_builtin;
-
-/* Nonzero means enable obscure ANSI features and disable GNU extensions
- that might cause ANSI-compliant code to be miscompiled. */
-
-extern int flag_ansi;
-
-/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes)
- objects. */
-extern int flag_huge_objects;
-
-/* Nonzero if we want to conserve space in the .o files. We do this
- by putting uninitialized data and runtime initialized data into
- .common instead of .data at the expense of not flagging multiple
- definitions. */
-extern int flag_conserve_space;
-
-/* Pointers to the base and current top of the language name stack. */
-
-extern tree *current_lang_base, *current_lang_stack;
-
-/* C and C++ flags are in decl2.c. */
-
-/* Set to 0 at beginning of a constructor, set to 1
- if that function does an allocation before referencing its
- instance variable. */
-static int current_function_assigns_this;
-int current_function_just_assigned_this;
-
-/* Set to 0 at beginning of a function. Set non-zero when
- store_parm_decls is called. Don't call store_parm_decls
- if this flag is non-zero! */
-int current_function_parms_stored;
-
-/* Flag used when debugging spew.c */
-
-extern int spew_debug;
-
-/* This is a copy of the class_shadowed list of the previous class binding
- contour when at global scope. It's used to reset IDENTIFIER_CLASS_VALUEs
- when entering another class scope (i.e. a cache miss). */
-extern tree previous_class_values;
-
-/* A expression of value 0 with the same precision as a sizetype
- node, but signed. */
-tree signed_size_zero_node;
-
-
-/* Allocate a level of searching. */
-
-static
-struct stack_level *
-push_decl_level (stack, obstack)
- struct stack_level *stack;
- struct obstack *obstack;
-{
- struct stack_level tem;
- tem.prev = stack;
-
- return push_stack_level (obstack, (char *)&tem, sizeof (tem));
-}
-
-/* For each binding contour we allocate a binding_level structure
- which records the names defined in that contour.
- Contours include:
- 0) the global one
- 1) one for each function definition,
- where internal declarations of the parameters appear.
- 2) one for each compound statement,
- to record its declarations.
-
- The current meaning of a name can be found by searching the levels
- from the current one out to the global one.
-
- Off to the side, may be the class_binding_level. This exists only
- to catch class-local declarations. It is otherwise nonexistent.
-
- Also there may be binding levels that catch cleanups that must be
- run when exceptions occur. */
-
-/* Note that the information in the `names' component of the global contour
- is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */
-
-struct binding_level
- {
- /* A chain of _DECL nodes for all variables, constants, functions,
- and typedef types. These are in the reverse of the order
- supplied. */
- tree names;
-
- /* A list of structure, union and enum definitions, for looking up
- tag names.
- It is a chain of TREE_LIST nodes, each of whose TREE_PURPOSE is a name,
- or NULL_TREE; and whose TREE_VALUE is a RECORD_TYPE, UNION_TYPE,
- or ENUMERAL_TYPE node.
-
- C++: the TREE_VALUE nodes can be simple types for
- component_bindings. */
- tree tags;
-
- /* For each level, a list of shadowed outer-level local definitions
- to be restored when this level is popped.
- Each link is a TREE_LIST whose TREE_PURPOSE is an identifier and
- whose TREE_VALUE is its old definition (a kind of ..._DECL node). */
- tree shadowed;
-
- /* Same, for IDENTIFIER_CLASS_VALUE. */
- tree class_shadowed;
-
- /* Same, for IDENTIFIER_TYPE_VALUE. */
- tree type_shadowed;
-
- /* For each level (except not the global one),
- a chain of BLOCK nodes for all the levels
- that were entered and exited one level down. */
- tree blocks;
-
- /* The BLOCK node for this level, if one has been preallocated.
- If 0, the BLOCK is allocated (if needed) when the level is popped. */
- tree this_block;
-
- /* The binding level which this one is contained in (inherits from). */
- struct binding_level *level_chain;
-
- /* List of decls in `names' that have incomplete
- structure or union types. */
- tree incomplete;
-
- /* List of VAR_DECLS saved from a previous for statement.
- These would be dead in ANSI-conforming code, but might
- be referenced in ARM-era code. */
- tree dead_vars_from_for;
-
- /* 1 for the level that holds the parameters of a function.
- 2 for the level that holds a class declaration.
- 3 for levels that hold parameter declarations. */
- unsigned parm_flag : 4;
-
- /* 1 means make a BLOCK for this level regardless of all else.
- 2 for temporary binding contours created by the compiler. */
- unsigned keep : 3;
-
- /* Nonzero if this level "doesn't exist" for tags. */
- unsigned tag_transparent : 1;
-
- /* Nonzero if this level can safely have additional
- cleanup-needing variables added to it. */
- unsigned more_cleanups_ok : 1;
- unsigned have_cleanups : 1;
-
- /* Nonzero if this level is for storing the decls for template
- parameters and generic decls; these decls will be discarded and
- replaced with a TEMPLATE_DECL. */
- unsigned pseudo_global : 1;
-
- /* This is set for a namespace binding level. */
- unsigned namespace_p : 1;
-
- /* True if this level is that of a for-statement where we need to
- worry about ambiguous (ARM or ANSI) scope rules. */
- unsigned is_for_scope : 1;
-
- /* Two bits left for this word. */
-
-#if defined(DEBUG_CP_BINDING_LEVELS)
- /* Binding depth at which this level began. */
- unsigned binding_depth;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
- };
-
-#define NULL_BINDING_LEVEL ((struct binding_level *) NULL)
-
-/* The (non-class) binding level currently in effect. */
-
-static struct binding_level *current_binding_level;
-
-/* The binding level of the current class, if any. */
-
-static struct binding_level *class_binding_level;
-
-/* The current (class or non-class) binding level currently in effect. */
-
-#define inner_binding_level \
- (class_binding_level ? class_binding_level : current_binding_level)
-
-/* A chain of binding_level structures awaiting reuse. */
-
-static struct binding_level *free_binding_level;
-
-/* The outermost binding level, for names of file scope.
- This is created when the compiler is started and exists
- through the entire run. */
-
-static struct binding_level *global_binding_level;
-
-/* Binding level structures are initialized by copying this one. */
-
-static struct binding_level clear_binding_level;
-
-/* Nonzero means unconditionally make a BLOCK for the next level pushed. */
-
-static int keep_next_level_flag;
-
-#if defined(DEBUG_CP_BINDING_LEVELS)
-static int binding_depth = 0;
-static int is_class_level = 0;
-
-static void
-indent ()
-{
- register unsigned i;
-
- for (i = 0; i < binding_depth*2; i++)
- putc (' ', stderr);
-}
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
-
-static tree pushdecl_with_scope PROTO((tree, struct binding_level *));
-
-static void
-push_binding_level (newlevel, tag_transparent, keep)
- struct binding_level *newlevel;
- int tag_transparent, keep;
-{
- /* Add this level to the front of the chain (stack) of levels that
- are active. */
- *newlevel = clear_binding_level;
- if (class_binding_level)
- {
- newlevel->level_chain = class_binding_level;
- class_binding_level = (struct binding_level *)0;
- }
- else
- {
- newlevel->level_chain = current_binding_level;
- }
- current_binding_level = newlevel;
- newlevel->tag_transparent = tag_transparent;
- newlevel->more_cleanups_ok = 1;
- newlevel->keep = keep;
-#if defined(DEBUG_CP_BINDING_LEVELS)
- newlevel->binding_depth = binding_depth;
- indent ();
- fprintf (stderr, "push %s level 0x%08x line %d\n",
- (is_class_level) ? "class" : "block", newlevel, lineno);
- is_class_level = 0;
- binding_depth++;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
-}
-
-static void
-pop_binding_level ()
-{
- if (class_binding_level)
- current_binding_level = class_binding_level;
-
- if (global_binding_level)
- {
- /* cannot pop a level, if there are none left to pop. */
- if (current_binding_level == global_binding_level)
- my_friendly_abort (123);
- }
- /* Pop the current level, and free the structure for reuse. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
- binding_depth--;
- indent ();
- fprintf (stderr, "pop %s level 0x%08x line %d\n",
- (is_class_level) ? "class" : "block",
- current_binding_level, lineno);
- if (is_class_level != (current_binding_level == class_binding_level))
- {
- indent ();
- fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
- }
- is_class_level = 0;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
- {
- register struct binding_level *level = current_binding_level;
- current_binding_level = current_binding_level->level_chain;
- level->level_chain = free_binding_level;
-#if 0 /* defined(DEBUG_CP_BINDING_LEVELS) */
- if (level->binding_depth != binding_depth)
- abort ();
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
- free_binding_level = level;
-
- class_binding_level = current_binding_level;
- if (class_binding_level->parm_flag != 2)
- class_binding_level = 0;
- while (current_binding_level->parm_flag == 2)
- current_binding_level = current_binding_level->level_chain;
- }
-}
-
-static void
-suspend_binding_level ()
-{
- if (class_binding_level)
- current_binding_level = class_binding_level;
-
- if (global_binding_level)
- {
- /* cannot suspend a level, if there are none left to suspend. */
- if (current_binding_level == global_binding_level)
- my_friendly_abort (123);
- }
- /* Suspend the current level. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
- binding_depth--;
- indent ();
- fprintf (stderr, "suspend %s level 0x%08x line %d\n",
- (is_class_level) ? "class" : "block",
- current_binding_level, lineno);
- if (is_class_level != (current_binding_level == class_binding_level))
- {
- indent ();
- fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n");
- }
- is_class_level = 0;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
- {
- current_binding_level = current_binding_level->level_chain;
- class_binding_level = current_binding_level;
- if (class_binding_level->parm_flag != 2)
- class_binding_level = 0;
- while (current_binding_level->parm_flag == 2)
- current_binding_level = current_binding_level->level_chain;
- }
-}
-
-static void
-resume_binding_level (b)
- struct binding_level *b;
-{
- if (class_binding_level)
- {
-#if 1
- /* These are here because we cannot deal with shadows yet. */
- sorry ("cannot resume a namespace inside class");
- return;
-#else
- b->level_chain = class_binding_level;
- class_binding_level = (struct binding_level *)0;
-#endif
- }
- else
- {
-#if 1
- /* These are here because we cannot deal with shadows yet. */
- if (b->level_chain != current_binding_level)
- {
- sorry ("cannot resume a namespace inside a different namespace");
- return;
- }
-#endif
- b->level_chain = current_binding_level;
- }
- current_binding_level = b;
-#if defined(DEBUG_CP_BINDING_LEVELS)
- b->binding_depth = binding_depth;
- indent ();
- fprintf (stderr, "resume %s level 0x%08x line %d\n",
- (is_class_level) ? "class" : "block", b, lineno);
- is_class_level = 0;
- binding_depth++;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
-}
-
-/* Create a new `struct binding_level'. */
-
-static
-struct binding_level *
-make_binding_level ()
-{
- /* NOSTRICT */
- return (struct binding_level *) xmalloc (sizeof (struct binding_level));
-}
-
-/* Nonzero if we are currently in the global binding level. */
-
-int
-global_bindings_p ()
-{
- return current_binding_level == global_binding_level;
-}
-
-/* Nonzero if we are currently in a toplevel binding level. This
- means either the global binding level or a namespace in a toplevel
- binding level. */
-
-int
-toplevel_bindings_p ()
-{
- struct binding_level *b = current_binding_level;
-
- while (1)
- {
- if (b == global_binding_level)
- return 1;
- if (b->pseudo_global)
- return 1;
- if (! b->namespace_p)
- return 0;
- b=b->level_chain;
- }
-}
-
-/* Nonzero if this is a namespace scope. */
-
-static int
-namespace_bindings_p ()
-{
- return current_binding_level->namespace_p;
-}
-
-void
-keep_next_level ()
-{
- keep_next_level_flag = 1;
-}
-
-/* Nonzero if the current level needs to have a BLOCK made. */
-
-int
-kept_level_p ()
-{
- return (current_binding_level->blocks != NULL_TREE
- || current_binding_level->keep
- || current_binding_level->names != NULL_TREE
- || (current_binding_level->tags != NULL_TREE
- && !current_binding_level->tag_transparent));
-}
-
-/* Identify this binding level as a level of parameters. */
-
-void
-declare_parm_level ()
-{
- current_binding_level->parm_flag = 1;
-}
-
-void
-declare_pseudo_global_level ()
-{
- current_binding_level->pseudo_global = 1;
-}
-
-static void
-declare_namespace_level ()
-{
- current_binding_level->namespace_p = 1;
-}
-
-int
-pseudo_global_level_p ()
-{
- return current_binding_level->pseudo_global;
-}
-
-void
-set_class_shadows (shadows)
- tree shadows;
-{
- class_binding_level->class_shadowed = shadows;
-}
-
-/* Enter a new binding level.
- If TAG_TRANSPARENT is nonzero, do so only for the name space of variables,
- not for that of tags. */
-
-void
-pushlevel (tag_transparent)
- int tag_transparent;
-{
- register struct binding_level *newlevel = NULL_BINDING_LEVEL;
-
- /* If this is the top level of a function,
- just make sure that NAMED_LABELS is 0.
- They should have been set to 0 at the end of the previous function. */
-
- if (current_binding_level == global_binding_level)
- my_friendly_assert (named_labels == NULL_TREE, 134);
-
- /* Reuse or create a struct for this binding level. */
-
-#if defined(DEBUG_CP_BINDING_LEVELS)
- if (0)
-#else /* !defined(DEBUG_CP_BINDING_LEVELS) */
- if (free_binding_level)
-#endif /* !defined(DEBUG_CP_BINDING_LEVELS) */
- {
- newlevel = free_binding_level;
- free_binding_level = free_binding_level->level_chain;
- }
- else
- {
- newlevel = make_binding_level ();
- }
-
- push_binding_level (newlevel, tag_transparent, keep_next_level_flag);
- GNU_xref_start_scope ((HOST_WIDE_INT) newlevel);
- keep_next_level_flag = 0;
-}
-
-void
-note_level_for_for ()
-{
- current_binding_level->is_for_scope = 1;
-}
-
-void
-pushlevel_temporary (tag_transparent)
- int tag_transparent;
-{
- pushlevel (tag_transparent);
- current_binding_level->keep = 2;
- clear_last_expr ();
-
- /* Note we don't call push_momentary() here. Otherwise, it would cause
- cleanups to be allocated on the momentary obstack, and they will be
- overwritten by the next statement. */
-
- expand_start_bindings (0);
-}
-
-/* Exit a binding level.
- Pop the level off, and restore the state of the identifier-decl mappings
- that were in effect when this level was entered.
-
- If KEEP == 1, this level had explicit declarations, so
- and create a "block" (a BLOCK node) for the level
- to record its declarations and subblocks for symbol table output.
-
- If KEEP == 2, this level's subblocks go to the front,
- not the back of the current binding level. This happens,
- for instance, when code for constructors and destructors
- need to generate code at the end of a function which must
- be moved up to the front of the function.
-
- If FUNCTIONBODY is nonzero, this level is the body of a function,
- so create a block as if KEEP were set and also clear out all
- label names.
-
- If REVERSE is nonzero, reverse the order of decls before putting
- them into the BLOCK. */
-
-tree
-poplevel (keep, reverse, functionbody)
- int keep;
- int reverse;
- int functionbody;
-{
- register tree link;
- /* The chain of decls was accumulated in reverse order.
- Put it into forward order, just for cleanliness. */
- tree decls;
- int tmp = functionbody;
- int real_functionbody = current_binding_level->keep == 2
- ? ((functionbody = 0), tmp) : functionbody;
- tree tags = functionbody >= 0 ? current_binding_level->tags : 0;
- tree subblocks = functionbody >= 0 ? current_binding_level->blocks : 0;
- tree block = NULL_TREE;
- tree decl;
- int block_previously_created;
-
- GNU_xref_end_scope ((HOST_WIDE_INT) current_binding_level,
- (HOST_WIDE_INT) current_binding_level->level_chain,
- current_binding_level->parm_flag,
- current_binding_level->keep);
-
- if (current_binding_level->keep == 1)
- keep = 1;
-
- /* Get the decls in the order they were written.
- Usually current_binding_level->names is in reverse order.
- But parameter decls were previously put in forward order. */
-
- if (reverse)
- current_binding_level->names
- = decls = nreverse (current_binding_level->names);
- else
- decls = current_binding_level->names;
-
- /* Output any nested inline functions within this block
- if they weren't already output. */
-
- for (decl = decls; decl; decl = TREE_CHAIN (decl))
- if (TREE_CODE (decl) == FUNCTION_DECL
- && ! TREE_ASM_WRITTEN (decl)
- && DECL_INITIAL (decl) != NULL_TREE
- && TREE_ADDRESSABLE (decl)
- && decl_function_context (decl) == current_function_decl)
- {
- /* If this decl was copied from a file-scope decl
- on account of a block-scope extern decl,
- propagate TREE_ADDRESSABLE to the file-scope decl. */
- if (DECL_ABSTRACT_ORIGIN (decl) != NULL_TREE)
- TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (decl)) = 1;
- else
- {
- push_function_context ();
- output_inline_function (decl);
- pop_function_context ();
- }
- }
-
- /* If there were any declarations or structure tags in that level,
- or if this level is a function body,
- create a BLOCK to record them for the life of this function. */
-
- block = NULL_TREE;
- block_previously_created = (current_binding_level->this_block != NULL_TREE);
- if (block_previously_created)
- block = current_binding_level->this_block;
- else if (keep == 1 || functionbody)
- block = make_node (BLOCK);
- if (block != NULL_TREE)
- {
- if (block_previously_created)
- {
- if (decls || tags || subblocks)
- {
- if (BLOCK_VARS (block) || BLOCK_TYPE_TAGS (block))
- {
- warning ("internal compiler error: debugging info corrupted");
- }
- BLOCK_VARS (block) = decls;
- BLOCK_TYPE_TAGS (block) = tags;
-
- /* We can have previous subblocks and new subblocks when
- doing fixup_gotos with complex cleanups. We chain the new
- subblocks onto the end of any pre-existing subblocks. */
- BLOCK_SUBBLOCKS (block) = chainon (BLOCK_SUBBLOCKS (block),
- subblocks);
- }
- /* If we created the block earlier on, and we are just
- diddling it now, then it already should have a proper
- BLOCK_END_NOTE value associated with it. */
- }
- else
- {
- BLOCK_VARS (block) = decls;
- BLOCK_TYPE_TAGS (block) = tags;
- BLOCK_SUBBLOCKS (block) = subblocks;
- /* Otherwise, for a new block, install a new BLOCK_END_NOTE value. */
- remember_end_note (block);
- }
- }
-
- /* In each subblock, record that this is its superior. */
-
- if (keep >= 0)
- for (link = subblocks; link; link = TREE_CHAIN (link))
- BLOCK_SUPERCONTEXT (link) = block;
-
- /* Clear out the meanings of the local variables of this level. */
-
- if (current_binding_level->is_for_scope && flag_new_for_scope == 1)
- {
- struct binding_level *outer = current_binding_level->level_chain;
- for (link = decls; link; link = TREE_CHAIN (link))
- {
- if (TREE_CODE (link) == VAR_DECL)
- DECL_DEAD_FOR_LOCAL (link) = 1;
- else
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (link)) = NULL_TREE;
- }
-
- /* Save declarations made in a 'for' statement so we can support pre-ANSI
- 'for' scoping semantics. */
-
- for (link = current_binding_level->shadowed; link; link = TREE_CHAIN (link))
- {
- tree id = TREE_PURPOSE (link);
- tree decl = IDENTIFIER_LOCAL_VALUE (id);
-
- if (decl && DECL_DEAD_FOR_LOCAL (decl))
- {
- /* In this case keep the dead for-decl visible,
- but remember what (if anything) it shadowed. */
- DECL_SHADOWED_FOR_VAR (decl) = TREE_VALUE (link);
- TREE_CHAIN (decl) = outer->dead_vars_from_for;
- outer->dead_vars_from_for = decl;
- }
- else
- IDENTIFIER_LOCAL_VALUE (id) = TREE_VALUE (link);
- }
- }
- else /* Not special for scope. */
- {
- for (link = decls; link; link = TREE_CHAIN (link))
- {
- if (DECL_NAME (link) != NULL_TREE)
- {
- /* If the ident. was used or addressed via a local extern decl,
- don't forget that fact. */
- if (DECL_EXTERNAL (link))
- {
- if (TREE_USED (link))
- TREE_USED (DECL_ASSEMBLER_NAME (link)) = 1;
- if (TREE_ADDRESSABLE (link))
- TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (link)) = 1;
- }
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (link)) = NULL_TREE;
- }
- }
-
- /* Restore all name-meanings of the outer levels
- that were shadowed by this level. */
-
- for (link = current_binding_level->shadowed;
- link; link = TREE_CHAIN (link))
- IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
-
- /* We first restore the regular decls and *then* the dead_vars_from_for
- to handle this case:
-
- int i; // i#1
- {
- for (int i; ; ) { ...} // i#2
- int i; // i#3
- } // we are here
-
- In this case, we want remove the binding for i#3, restoring
- that of i#2. Then we want to remove the binding for i#2,
- and restore that of i#1. */
-
- link = current_binding_level->dead_vars_from_for;
- for (; link != NULL_TREE; link = TREE_CHAIN (link))
- {
- tree id = DECL_NAME (link);
- if (IDENTIFIER_LOCAL_VALUE (id) == link)
- IDENTIFIER_LOCAL_VALUE (id) = DECL_SHADOWED_FOR_VAR (link);
- }
-
- for (link = current_binding_level->class_shadowed;
- link; link = TREE_CHAIN (link))
- IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
- for (link = current_binding_level->type_shadowed;
- link; link = TREE_CHAIN (link))
- IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
- }
-
- /* If the level being exited is the top level of a function,
- check over all the labels. */
-
- if (functionbody)
- {
- /* If this is the top level block of a function,
- the vars are the function's parameters.
- Don't leave them in the BLOCK because they are
- found in the FUNCTION_DECL instead. */
-
- BLOCK_VARS (block) = 0;
-
- /* Clear out the definitions of all label names,
- since their scopes end here. */
-
- for (link = named_labels; link; link = TREE_CHAIN (link))
- {
- register tree label = TREE_VALUE (link);
-
- if (DECL_INITIAL (label) == NULL_TREE)
- {
- cp_error_at ("label `%D' used but not defined", label);
- /* Avoid crashing later. */
- define_label (input_filename, 1, DECL_NAME (label));
- }
- else if (warn_unused && !TREE_USED (label))
- cp_warning_at ("label `%D' defined but not used", label);
- SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), NULL_TREE);
-
- /* Put the labels into the "variables" of the
- top-level block, so debugger can see them. */
- TREE_CHAIN (label) = BLOCK_VARS (block);
- BLOCK_VARS (block) = label;
- }
-
- named_labels = NULL_TREE;
- }
-
- /* Any uses of undefined labels now operate under constraints
- of next binding contour. */
- {
- struct binding_level *level_chain;
- level_chain = current_binding_level->level_chain;
- if (level_chain)
- {
- struct named_label_list *labels;
- for (labels = named_label_uses; labels; labels = labels->next)
- if (labels->binding_level == current_binding_level)
- {
- labels->binding_level = level_chain;
- labels->names_in_scope = level_chain->names;
- }
- }
- }
-
- tmp = current_binding_level->keep;
-
- pop_binding_level ();
- if (functionbody)
- DECL_INITIAL (current_function_decl) = block;
- else if (block)
- {
- if (!block_previously_created)
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
- }
- /* If we did not make a block for the level just exited,
- any blocks made for inner levels
- (since they cannot be recorded as subblocks in that level)
- must be carried forward so they will later become subblocks
- of something else. */
- else if (subblocks)
- {
- if (keep == 2)
- current_binding_level->blocks
- = chainon (subblocks, current_binding_level->blocks);
- else
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, subblocks);
- }
-
- /* Take care of compiler's internal binding structures. */
- if (tmp == 2)
- {
- expand_end_bindings (getdecls (), keep, 1);
- /* Each and every BLOCK node created here in `poplevel' is important
- (e.g. for proper debugging information) so if we created one
- earlier, mark it as "used". */
- if (block)
- TREE_USED (block) = 1;
- block = poplevel (keep, reverse, real_functionbody);
- }
-
- /* Each and every BLOCK node created here in `poplevel' is important
- (e.g. for proper debugging information) so if we created one
- earlier, mark it as "used". */
- if (block)
- TREE_USED (block) = 1;
- return block;
-}
-
-/* Resume a binding level for a namespace. */
-
-void
-resume_level (b)
- struct binding_level *b;
-{
- tree decls, link;
-
- resume_binding_level (b);
-
- /* Resume the variable caches. */
- decls = current_binding_level->names;
-
- /* Restore the meanings of the local variables of this level. */
-
- for (link = decls; link; link = TREE_CHAIN (link))
- {
- /* If it doesn't have a name, there is nothing left to do with it. */
- if (DECL_NAME (link) == NULL_TREE)
- continue;
-
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (link)) = link;
-
- /* If this is a TYPE_DECL, push it into the type value slot. */
- if (TREE_CODE (link) == TYPE_DECL)
- SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (link), TREE_TYPE (link));
- }
-}
-
-/* Delete the node BLOCK from the current binding level.
- This is used for the block inside a stmt expr ({...})
- so that the block can be reinserted where appropriate. */
-
-void
-delete_block (block)
- tree block;
-{
- tree t;
- if (current_binding_level->blocks == block)
- current_binding_level->blocks = TREE_CHAIN (block);
- for (t = current_binding_level->blocks; t;)
- {
- if (TREE_CHAIN (t) == block)
- TREE_CHAIN (t) = TREE_CHAIN (block);
- else
- t = TREE_CHAIN (t);
- }
- TREE_CHAIN (block) = NULL_TREE;
- /* Clear TREE_USED which is always set by poplevel.
- The flag is set again if insert_block is called. */
- TREE_USED (block) = 0;
-}
-
-/* Insert BLOCK at the end of the list of subblocks of the
- current binding level. This is used when a BIND_EXPR is expanded,
- to handle the BLOCK node inside the BIND_EXPR. */
-
-void
-insert_block (block)
- tree block;
-{
- TREE_USED (block) = 1;
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
-}
-
-/* Add BLOCK to the current list of blocks for this binding contour. */
-
-void
-add_block_current_level (block)
- tree block;
-{
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
-}
-
-/* Set the BLOCK node for the innermost scope
- (the one we are currently in). */
-
-void
-set_block (block)
- register tree block;
-{
- current_binding_level->this_block = block;
-}
-
-/* Do a pushlevel for class declarations. */
-
-void
-pushlevel_class ()
-{
- register struct binding_level *newlevel;
-
- /* Reuse or create a struct for this binding level. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
- if (0)
-#else /* !defined(DEBUG_CP_BINDING_LEVELS) */
- if (free_binding_level)
-#endif /* !defined(DEBUG_CP_BINDING_LEVELS) */
- {
- newlevel = free_binding_level;
- free_binding_level = free_binding_level->level_chain;
- }
- else
- {
- newlevel = make_binding_level ();
- }
-
-#if defined(DEBUG_CP_BINDING_LEVELS)
- is_class_level = 1;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
-
- push_binding_level (newlevel, 0, 0);
-
- decl_stack = push_decl_level (decl_stack, &decl_obstack);
- class_binding_level = current_binding_level;
- class_binding_level->parm_flag = 2;
- /* We have just pushed into a new binding level. Now, fake out the rest
- of the compiler. Set the `current_binding_level' back to point to
- the most closely containing non-class binding level. */
- do
- {
- current_binding_level = current_binding_level->level_chain;
- }
- while (current_binding_level->parm_flag == 2);
-}
-
-/* ...and a poplevel for class declarations. FORCE is used to force
- clearing out of CLASS_VALUEs after a class definition. */
-
-tree
-poplevel_class (force)
- int force;
-{
- register struct binding_level *level = class_binding_level;
- tree block = NULL_TREE;
- tree shadowed;
-
- my_friendly_assert (level != 0, 354);
-
- decl_stack = pop_stack_level (decl_stack);
- for (shadowed = level->shadowed; shadowed; shadowed = TREE_CHAIN (shadowed))
- IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (shadowed)) = TREE_VALUE (shadowed);
- /* If we're leaving a toplevel class, don't bother to do the setting
- of IDENTIFIER_CLASS_VALUE to NULL_TREE, since first of all this slot
- shouldn't even be used when current_class_type isn't set, and second,
- if we don't touch it here, we're able to use the cache effect if the
- next time we're entering a class scope, it is the same class. */
- if (current_class_depth != 1 || force)
- for (shadowed = level->class_shadowed;
- shadowed;
- shadowed = TREE_CHAIN (shadowed))
- IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed)) = TREE_VALUE (shadowed);
- else
- /* Remember to save what IDENTIFIER's were bound in this scope so we
- can recover from cache misses. */
- {
- previous_class_type = current_class_type;
- previous_class_values = class_binding_level->class_shadowed;
- }
- for (shadowed = level->type_shadowed;
- shadowed;
- shadowed = TREE_CHAIN (shadowed))
- IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (shadowed)) = TREE_VALUE (shadowed);
-
- GNU_xref_end_scope ((HOST_WIDE_INT) class_binding_level,
- (HOST_WIDE_INT) class_binding_level->level_chain,
- class_binding_level->parm_flag,
- class_binding_level->keep);
-
- if (class_binding_level->parm_flag != 2)
- class_binding_level = (struct binding_level *)0;
-
- /* Now, pop out of the the binding level which we created up in the
- `pushlevel_class' routine. */
-#if defined(DEBUG_CP_BINDING_LEVELS)
- is_class_level = 1;
-#endif /* defined(DEBUG_CP_BINDING_LEVELS) */
-
- pop_binding_level ();
-
- return block;
-}
-
-/* For debugging. */
-static int no_print_functions = 0;
-static int no_print_builtins = 0;
-
-void
-print_binding_level (lvl)
- struct binding_level *lvl;
-{
- tree t;
- int i = 0, len;
- fprintf (stderr, " blocks=");
- fprintf (stderr, HOST_PTR_PRINTF, lvl->blocks);
- fprintf (stderr, " n_incomplete=%d parm_flag=%d keep=%d",
- list_length (lvl->incomplete), lvl->parm_flag, lvl->keep);
- if (lvl->tag_transparent)
- fprintf (stderr, " tag-transparent");
- if (lvl->more_cleanups_ok)
- fprintf (stderr, " more-cleanups-ok");
- if (lvl->have_cleanups)
- fprintf (stderr, " have-cleanups");
- fprintf (stderr, "\n");
- if (lvl->names)
- {
- fprintf (stderr, " names:\t");
- /* We can probably fit 3 names to a line? */
- for (t = lvl->names; t; t = TREE_CHAIN (t))
- {
- if (no_print_functions && (TREE_CODE (t) == FUNCTION_DECL))
- continue;
- if (no_print_builtins
- && (TREE_CODE (t) == TYPE_DECL)
- && (!strcmp (DECL_SOURCE_FILE (t),"<built-in>")))
- continue;
-
- /* Function decls tend to have longer names. */
- if (TREE_CODE (t) == FUNCTION_DECL)
- len = 3;
- else
- len = 2;
- i += len;
- if (i > 6)
- {
- fprintf (stderr, "\n\t");
- i = len;
- }
- print_node_brief (stderr, "", t, 0);
- if (t == error_mark_node)
- break;
- }
- if (i)
- fprintf (stderr, "\n");
- }
- if (lvl->tags)
- {
- fprintf (stderr, " tags:\t");
- i = 0;
- for (t = lvl->tags; t; t = TREE_CHAIN (t))
- {
- if (TREE_PURPOSE (t) == NULL_TREE)
- len = 3;
- else if (TREE_PURPOSE (t) == TYPE_IDENTIFIER (TREE_VALUE (t)))
- len = 2;
- else
- len = 4;
- i += len;
- if (i > 5)
- {
- fprintf (stderr, "\n\t");
- i = len;
- }
- if (TREE_PURPOSE (t) == NULL_TREE)
- {
- print_node_brief (stderr, "<unnamed-typedef", TREE_VALUE (t), 0);
- fprintf (stderr, ">");
- }
- else if (TREE_PURPOSE (t) == TYPE_IDENTIFIER (TREE_VALUE (t)))
- print_node_brief (stderr, "", TREE_VALUE (t), 0);
- else
- {
- print_node_brief (stderr, "<typedef", TREE_PURPOSE (t), 0);
- print_node_brief (stderr, "", TREE_VALUE (t), 0);
- fprintf (stderr, ">");
- }
- }
- if (i)
- fprintf (stderr, "\n");
- }
- if (lvl->shadowed)
- {
- fprintf (stderr, " shadowed:");
- for (t = lvl->shadowed; t; t = TREE_CHAIN (t))
- {
- fprintf (stderr, " %s ", IDENTIFIER_POINTER (TREE_PURPOSE (t)));
- }
- fprintf (stderr, "\n");
- }
- if (lvl->class_shadowed)
- {
- fprintf (stderr, " class-shadowed:");
- for (t = lvl->class_shadowed; t; t = TREE_CHAIN (t))
- {
- fprintf (stderr, " %s ", IDENTIFIER_POINTER (TREE_PURPOSE (t)));
- }
- fprintf (stderr, "\n");
- }
- if (lvl->type_shadowed)
- {
- fprintf (stderr, " type-shadowed:");
- for (t = lvl->type_shadowed; t; t = TREE_CHAIN (t))
- {
- fprintf (stderr, " %s ", IDENTIFIER_POINTER (TREE_PURPOSE (t)));
- }
- fprintf (stderr, "\n");
- }
-}
-
-void
-print_other_binding_stack (stack)
- struct binding_level *stack;
-{
- struct binding_level *level;
- for (level = stack; level != global_binding_level; level = level->level_chain)
- {
- fprintf (stderr, "binding level ");
- fprintf (stderr, HOST_PTR_PRINTF, level);
- fprintf (stderr, "\n");
- print_binding_level (level);
- }
-}
-
-void
-print_binding_stack ()
-{
- struct binding_level *b;
- fprintf (stderr, "current_binding_level=");
- fprintf (stderr, HOST_PTR_PRINTF, current_binding_level);
- fprintf (stderr, "\nclass_binding_level=");
- fprintf (stderr, HOST_PTR_PRINTF, class_binding_level);
- fprintf (stderr, "\nglobal_binding_level=");
- fprintf (stderr, HOST_PTR_PRINTF, global_binding_level);
- fprintf (stderr, "\n");
- if (class_binding_level)
- {
- for (b = class_binding_level; b; b = b->level_chain)
- if (b == current_binding_level)
- break;
- if (b)
- b = class_binding_level;
- else
- b = current_binding_level;
- }
- else
- b = current_binding_level;
- print_other_binding_stack (b);
- fprintf (stderr, "global:\n");
- print_binding_level (global_binding_level);
-}
-
-extern char * first_global_object_name;
-
-/* Get a unique name for each call to this routine for unnamed namespaces.
- Mostly copied from get_file_function_name. */
-
-static tree
-get_unique_name ()
-{
- static int temp_name_counter = 0;
- char *buf;
- register char *p;
-
- if (first_global_object_name)
- p = first_global_object_name;
- else if (main_input_filename)
- p = main_input_filename;
- else
- p = input_filename;
-
-#define UNNAMED_NAMESPACE_FORMAT "__%s_%d"
-
- buf = (char *) alloca (sizeof (UNNAMED_NAMESPACE_FORMAT) + strlen (p));
-
- sprintf (buf, UNNAMED_NAMESPACE_FORMAT, p, temp_name_counter++);
-
- /* Don't need to pull weird characters out of global names. */
- if (p != first_global_object_name)
- {
- for (p = buf+11; *p; p++)
- if (! ((*p >= '0' && *p <= '9')
-#ifndef NO_DOLLAR_IN_LABEL /* this for `$'; unlikely, but... -- kr */
- || *p == '$'
-#endif
-#ifndef NO_DOT_IN_LABEL /* this for `.'; unlikely, but... */
- || *p == '.'
-#endif
- || (*p >= 'A' && *p <= 'Z')
- || (*p >= 'a' && *p <= 'z')))
- *p = '_';
- }
-
- return get_identifier (buf);
-}
-
-/* Push into the scope of the NAME namespace. If NAME is NULL_TREE, then we
- select a name that is unique to this compilation unit. */
-
-void
-push_namespace (name)
- tree name;
-{
- extern tree current_namespace;
- tree old_id = get_namespace_id ();
- char *buf;
- tree d;
-
- if (! name)
- {
- /* Create a truly ugly name! */
- name = get_unique_name ();
- }
-
- d = build_lang_decl (NAMESPACE_DECL, name, void_type_node);
-
- /* Mark them as external, so redeclaration_error_message doesn't think
- they are duplicates. */
-
- DECL_EXTERNAL (d) = 1;
- d = pushdecl (d);
-
- if (NAMESPACE_LEVEL (d) == 0)
- {
- /* This is new for this compilation unit. */
- pushlevel (0);
- declare_namespace_level ();
- NAMESPACE_LEVEL (d) = current_binding_level;
- }
- else
- resume_level (NAMESPACE_LEVEL (d));
-
- /* This code is just is bit old now... */
- current_namespace = tree_cons (NULL_TREE, name, current_namespace);
- buf = (char *) alloca (4 + (old_id ? IDENTIFIER_LENGTH (old_id) : 0)
- + IDENTIFIER_LENGTH (name));
- sprintf (buf, "%s%s", old_id ? IDENTIFIER_POINTER (old_id) : "",
- IDENTIFIER_POINTER (name));
- TREE_PURPOSE (current_namespace) = get_identifier (buf);
-}
-
-/* Pop from the scope of the current namespace. */
-
-void
-pop_namespace ()
-{
- extern tree current_namespace;
- tree decls, link;
- current_namespace = TREE_CHAIN (current_namespace);
-
- /* Just in case we get out of sync. */
- if (! namespace_bindings_p ())
- poplevel (0, 0, 0);
-
- decls = current_binding_level->names;
-
- /* Clear out the meanings of the local variables of this level. */
-
- for (link = decls; link; link = TREE_CHAIN (link))
- {
- if (DECL_NAME (link) != NULL_TREE)
- {
- /* If the ident. was used or addressed via a local extern decl,
- don't forget that fact. */
- if (DECL_EXTERNAL (link))
- {
- if (TREE_USED (link))
- TREE_USED (DECL_ASSEMBLER_NAME (link)) = 1;
- if (TREE_ADDRESSABLE (link))
- TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (link)) = 1;
- }
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (link)) = NULL_TREE;
- }
- }
-
- /* Restore all name-meanings of the outer levels
- that were shadowed by this level. */
-
- for (link = current_binding_level->shadowed; link; link = TREE_CHAIN (link))
- IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
- for (link = current_binding_level->class_shadowed;
- link; link = TREE_CHAIN (link))
- IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
- for (link = current_binding_level->type_shadowed;
- link; link = TREE_CHAIN (link))
- IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
-
- /* suspend a level. */
- suspend_binding_level ();
-}
-
-/* Subroutines for reverting temporarily to top-level for instantiation
- of templates and such. We actually need to clear out the class- and
- local-value slots of all identifiers, so that only the global values
- are at all visible. Simply setting current_binding_level to the global
- scope isn't enough, because more binding levels may be pushed. */
-struct saved_scope {
- struct binding_level *old_binding_level;
- tree old_bindings;
- struct saved_scope *prev;
- tree class_name, class_type, function_decl;
- struct binding_level *class_bindings;
- tree *lang_base, *lang_stack, lang_name;
- int lang_stacksize;
- int minimal_parse_mode;
- tree last_function_parms;
- tree template_parms;
- HOST_WIDE_INT processing_template_decl;
- tree previous_class_type, previous_class_values;
-};
-static struct saved_scope *current_saved_scope;
-
-static tree
-store_bindings (names, old_bindings)
- tree names, old_bindings;
-{
- tree t;
- for (t = names; t; t = TREE_CHAIN (t))
- {
- tree binding, t1, id;
-
- if (TREE_CODE (t) == TREE_LIST)
- id = TREE_PURPOSE (t);
- else
- id = DECL_NAME (t);
-
- if (!id
- || (!IDENTIFIER_LOCAL_VALUE (id)
- && !IDENTIFIER_CLASS_VALUE (id)))
- continue;
-
- for (t1 = old_bindings; t1; t1 = TREE_CHAIN (t1))
- if (TREE_VEC_ELT (t1, 0) == id)
- goto skip_it;
-
- binding = make_tree_vec (4);
- if (id)
- {
- my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135);
- TREE_VEC_ELT (binding, 0) = id;
- TREE_VEC_ELT (binding, 1) = IDENTIFIER_TYPE_VALUE (id);
- TREE_VEC_ELT (binding, 2) = IDENTIFIER_LOCAL_VALUE (id);
- TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id);
- IDENTIFIER_LOCAL_VALUE (id) = NULL_TREE;
- IDENTIFIER_CLASS_VALUE (id) = NULL_TREE;
- }
- TREE_CHAIN (binding) = old_bindings;
- old_bindings = binding;
- skip_it:
- ;
- }
- return old_bindings;
-}
-
-void
-maybe_push_to_top_level (pseudo)
- int pseudo;
-{
- extern int current_lang_stacksize;
- struct saved_scope *s =
- (struct saved_scope *) xmalloc (sizeof (struct saved_scope));
- struct binding_level *b = inner_binding_level;
- tree old_bindings = NULL_TREE;
-
- if (current_function_decl)
- push_cp_function_context (NULL_TREE);
-
- if (previous_class_type)
- old_bindings = store_bindings (previous_class_values, old_bindings);
-
- /* Have to include global_binding_level, because class-level decls
- aren't listed anywhere useful. */
- for (; b; b = b->level_chain)
- {
- tree t;
-
- if (b == global_binding_level || (pseudo && b->pseudo_global))
- break;
-
- old_bindings = store_bindings (b->names, old_bindings);
- /* We also need to check class_shadowed to save class-level type
- bindings, since pushclass doesn't fill in b->names. */
- if (b->parm_flag == 2)
- old_bindings = store_bindings (b->class_shadowed, old_bindings);
-
- /* Unwind type-value slots back to top level. */
- for (t = b->type_shadowed; t; t = TREE_CHAIN (t))
- SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t));
- }
-
- s->old_binding_level = current_binding_level;
- current_binding_level = b;
-
- s->class_name = current_class_name;
- s->class_type = current_class_type;
- s->function_decl = current_function_decl;
- s->class_bindings = class_binding_level;
- s->lang_stack = current_lang_stack;
- s->lang_base = current_lang_base;
- s->lang_stacksize = current_lang_stacksize;
- s->lang_name = current_lang_name;
- s->minimal_parse_mode = minimal_parse_mode;
- s->last_function_parms = last_function_parms;
- s->template_parms = current_template_parms;
- s->processing_template_decl = processing_template_decl;
- s->previous_class_type = previous_class_type;
- s->previous_class_values = previous_class_values;
-
- current_class_name = current_class_type = NULL_TREE;
- current_function_decl = NULL_TREE;
- class_binding_level = (struct binding_level *)0;
- current_lang_stacksize = 10;
- current_lang_stack = current_lang_base
- = (tree *) xmalloc (current_lang_stacksize * sizeof (tree));
- current_lang_name = lang_name_cplusplus;
- strict_prototype = strict_prototypes_lang_cplusplus;
- named_labels = NULL_TREE;
- minimal_parse_mode = 0;
- previous_class_type = previous_class_values = NULL_TREE;
- if (!pseudo)
- {
- current_template_parms = NULL_TREE;
- processing_template_decl = 0;
- }
-
- s->prev = current_saved_scope;
- s->old_bindings = old_bindings;
- current_saved_scope = s;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-}
-
-void
-push_to_top_level ()
-{
- maybe_push_to_top_level (0);
-}
-
-void
-pop_from_top_level ()
-{
- extern int current_lang_stacksize;
- struct saved_scope *s = current_saved_scope;
- tree t;
-
- /* Clear out class-level bindings cache. */
- if (previous_class_type)
- {
- popclass (-1);
- previous_class_type = NULL_TREE;
- }
-
- pop_obstacks ();
-
- current_binding_level = s->old_binding_level;
- current_saved_scope = s->prev;
- for (t = s->old_bindings; t; t = TREE_CHAIN (t))
- {
- tree id = TREE_VEC_ELT (t, 0);
- if (id)
- {
- IDENTIFIER_TYPE_VALUE (id) = TREE_VEC_ELT (t, 1);
- IDENTIFIER_LOCAL_VALUE (id) = TREE_VEC_ELT (t, 2);
- IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3);
- }
- }
- current_class_name = s->class_name;
- current_class_type = s->class_type;
- current_function_decl = s->function_decl;
- class_binding_level = s->class_bindings;
- free (current_lang_base);
- current_lang_base = s->lang_base;
- current_lang_stack = s->lang_stack;
- current_lang_name = s->lang_name;
- current_lang_stacksize = s->lang_stacksize;
- if (current_lang_name == lang_name_cplusplus)
- strict_prototype = strict_prototypes_lang_cplusplus;
- else if (current_lang_name == lang_name_c)
- strict_prototype = strict_prototypes_lang_c;
- minimal_parse_mode = s->minimal_parse_mode;
- last_function_parms = s->last_function_parms;
- current_template_parms = s->template_parms;
- processing_template_decl = s->processing_template_decl;
- previous_class_type = s->previous_class_type;
- previous_class_values = s->previous_class_values;
-
- free (s);
-
- if (current_function_decl)
- pop_cp_function_context (NULL_TREE);
-}
-
-/* Push a definition of struct, union or enum tag "name".
- into binding_level "b". "type" should be the type node,
- We assume that the tag "name" is not already defined.
-
- Note that the definition may really be just a forward reference.
- In that case, the TYPE_SIZE will be a NULL_TREE.
-
- C++ gratuitously puts all these tags in the name space. */
-
-/* When setting the IDENTIFIER_TYPE_VALUE field of an identifier ID,
- record the shadowed value for this binding contour. TYPE is
- the type that ID maps to. */
-
-static void
-set_identifier_type_value_with_scope (id, type, b)
- tree id;
- tree type;
- struct binding_level *b;
-{
- if (b != global_binding_level)
- {
- tree old_type_value = IDENTIFIER_TYPE_VALUE (id);
- b->type_shadowed
- = tree_cons (id, old_type_value, b->type_shadowed);
- }
- SET_IDENTIFIER_TYPE_VALUE (id, type);
-}
-
-/* As set_identifier_type_value_with_scope, but using inner_binding_level. */
-
-void
-set_identifier_type_value (id, type)
- tree id;
- tree type;
-{
- set_identifier_type_value_with_scope (id, type, inner_binding_level);
-}
-
-/* Pop off extraneous binding levels left over due to syntax errors.
-
- We don't pop past namespaces, as they might be valid. */
-
-void
-pop_everything ()
-{
-#ifdef DEBUG_CP_BINDING_LEVELS
- fprintf (stderr, "XXX entering pop_everything ()\n");
-#endif
- while (! toplevel_bindings_p () && ! pseudo_global_level_p ())
- {
- if (class_binding_level)
- pop_nested_class (1);
- else
- poplevel (0, 0, 0);
- }
-#ifdef DEBUG_CP_BINDING_LEVELS
- fprintf (stderr, "XXX leaving pop_everything ()\n");
-#endif
-}
-
-/* Push a tag name NAME for struct/class/union/enum type TYPE.
- Normally put into into the inner-most non-tag-transparent scope,
- but if GLOBALIZE is true, put it in the inner-most non-class scope.
- The latter is needed for implicit declarations. */
-
-void
-pushtag (name, type, globalize)
- tree name, type;
- int globalize;
-{
- register struct binding_level *b;
- tree context = 0;
- tree c_decl = 0;
-
- b = inner_binding_level;
- while (b->tag_transparent
- || (globalize && b->parm_flag == 2))
- b = b->level_chain;
-
- if (toplevel_bindings_p ())
- b->tags = perm_tree_cons (name, type, b->tags);
- else
- b->tags = saveable_tree_cons (name, type, b->tags);
-
- if (name)
- {
- context = type ? TYPE_CONTEXT (type) : NULL_TREE;
- if (! context && ! globalize)
- context = current_scope ();
- if (context)
- c_decl = TREE_CODE (context) == FUNCTION_DECL
- ? context : TYPE_MAIN_DECL (context);
-
- /* Do C++ gratuitous typedefing. */
- if (IDENTIFIER_TYPE_VALUE (name) != type)
- {
- register tree d;
- int newdecl = 0;
-
- if (b->parm_flag != 2
- || TYPE_SIZE (current_class_type) != NULL_TREE)
- {
- d = lookup_nested_type (type, c_decl);
-
- if (d == NULL_TREE)
- {
- newdecl = 1;
- d = build_decl (TYPE_DECL, name, type);
- SET_DECL_ARTIFICIAL (d);
- set_identifier_type_value_with_scope (name, type, b);
- }
- else
- d = TYPE_MAIN_DECL (d);
-
- TYPE_NAME (type) = d;
- DECL_CONTEXT (d) = context;
- if (! globalize && processing_template_decl && IS_AGGR_TYPE (type))
- push_template_decl (d);
-
- if (b->parm_flag == 2)
- d = pushdecl_class_level (d);
- else
- d = pushdecl_with_scope (d, b);
- }
- else
- {
- /* Make nested declarations go into class-level scope. */
- newdecl = 1;
- d = build_decl (TYPE_DECL, name, type);
- SET_DECL_ARTIFICIAL (d);
- TYPE_NAME (type) = d;
- DECL_CONTEXT (d) = context;
- if (! globalize && processing_template_decl && IS_AGGR_TYPE (type))
- push_template_decl (d);
-
- d = pushdecl_class_level (d);
- }
- if (newdecl)
- {
- if (ANON_AGGRNAME_P (name))
- DECL_IGNORED_P (d) = 1;
-
- TYPE_CONTEXT (type) = DECL_CONTEXT (d);
- DECL_ASSEMBLER_NAME (d)
- = get_identifier (build_overload_name (type, 1, 1));
- }
- }
- if (b->parm_flag == 2)
- {
- TREE_NONLOCAL_FLAG (type) = 1;
- if (TYPE_SIZE (current_class_type) == NULL_TREE)
- CLASSTYPE_TAGS (current_class_type) = b->tags;
- }
- }
-
- if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
- /* Use the canonical TYPE_DECL for this node. */
- TYPE_STUB_DECL (type) = TYPE_NAME (type);
- else
- {
- /* Create a fake NULL-named TYPE_DECL node whose TREE_TYPE
- will be the tagged type we just added to the current
- binding level. This fake NULL-named TYPE_DECL node helps
- dwarfout.c to know when it needs to output a
- representation of a tagged type, and it also gives us a
- convenient place to record the "scope start" address for
- the tagged type. */
-
- tree d = build_decl (TYPE_DECL, NULL_TREE, type);
- TYPE_STUB_DECL (type) = pushdecl_with_scope (d, b);
- }
-}
-
-/* Counter used to create anonymous type names. */
-
-static int anon_cnt = 0;
-
-/* Return an IDENTIFIER which can be used as a name for
- anonymous structs and unions. */
-
-tree
-make_anon_name ()
-{
- char buf[32];
-
- sprintf (buf, ANON_AGGRNAME_FORMAT, anon_cnt++);
- return get_identifier (buf);
-}
-
-/* Clear the TREE_PURPOSE slot of tags which have anonymous typenames.
- This keeps dbxout from getting confused. */
-
-void
-clear_anon_tags ()
-{
- register struct binding_level *b;
- register tree tags;
- static int last_cnt = 0;
-
- /* Fast out if no new anon names were declared. */
- if (last_cnt == anon_cnt)
- return;
-
- b = current_binding_level;
- while (b->tag_transparent)
- b = b->level_chain;
- tags = b->tags;
- while (tags)
- {
- /* A NULL purpose means we have already processed all tags
- from here to the end of the list. */
- if (TREE_PURPOSE (tags) == NULL_TREE)
- break;
- if (ANON_AGGRNAME_P (TREE_PURPOSE (tags)))
- TREE_PURPOSE (tags) = NULL_TREE;
- tags = TREE_CHAIN (tags);
- }
- last_cnt = anon_cnt;
-}
-
-/* Subroutine of duplicate_decls: return truthvalue of whether
- or not types of these decls match.
-
- For C++, we must compare the parameter list so that `int' can match
- `int&' in a parameter position, but `int&' is not confused with
- `const int&'. */
-
-int
-decls_match (newdecl, olddecl)
- tree newdecl, olddecl;
-{
- int types_match;
-
- if (TREE_CODE (newdecl) == FUNCTION_DECL
- && TREE_CODE (olddecl) == FUNCTION_DECL)
- {
- tree f1 = TREE_TYPE (newdecl);
- tree f2 = TREE_TYPE (olddecl);
- tree p1 = TYPE_ARG_TYPES (f1);
- tree p2 = TYPE_ARG_TYPES (f2);
-
- /* When we parse a static member function definition,
- we put together a FUNCTION_DECL which thinks its type
- is METHOD_TYPE. Change that to FUNCTION_TYPE, and
- proceed. */
- if (TREE_CODE (f1) == METHOD_TYPE && DECL_STATIC_FUNCTION_P (olddecl))
- revert_static_member_fn (&newdecl, &f1, &p1);
- else if (TREE_CODE (f2) == METHOD_TYPE
- && DECL_STATIC_FUNCTION_P (newdecl))
- revert_static_member_fn (&olddecl, &f2, &p2);
-
- /* Here we must take care of the case where new default
- parameters are specified. Also, warn if an old
- declaration becomes ambiguous because default
- parameters may cause the two to be ambiguous. */
- if (TREE_CODE (f1) != TREE_CODE (f2))
- {
- if (TREE_CODE (f1) == OFFSET_TYPE)
- cp_compiler_error ("`%D' redeclared as member function", newdecl);
- else
- cp_compiler_error ("`%D' redeclared as non-member function", newdecl);
- return 0;
- }
-
- if (comptypes (TREE_TYPE (f1), TREE_TYPE (f2), 1))
- {
- if (! strict_prototypes_lang_c && DECL_LANGUAGE (olddecl) == lang_c
- && p2 == NULL_TREE)
- {
- types_match = self_promoting_args_p (p1);
- if (p1 == void_list_node)
- TREE_TYPE (newdecl) = TREE_TYPE (olddecl);
- }
- else if (!strict_prototypes_lang_c && DECL_LANGUAGE (olddecl)==lang_c
- && DECL_LANGUAGE (newdecl) == lang_c && p1 == NULL_TREE)
- {
- types_match = self_promoting_args_p (p2);
- TREE_TYPE (newdecl) = TREE_TYPE (olddecl);
- }
- else
- types_match = compparms (p1, p2, 3);
- }
- else
- types_match = 0;
- }
- else if (TREE_CODE (newdecl) == TEMPLATE_DECL
- && TREE_CODE (olddecl) == TEMPLATE_DECL)
- {
- tree newargs = DECL_TEMPLATE_PARMS (newdecl);
- tree oldargs = DECL_TEMPLATE_PARMS (olddecl);
- int i, len = TREE_VEC_LENGTH (newargs);
-
- if (TREE_VEC_LENGTH (oldargs) != len)
- return 0;
-
- for (i = 0; i < len; i++)
- {
- tree newarg = TREE_VALUE (TREE_VEC_ELT (newargs, i));
- tree oldarg = TREE_VALUE (TREE_VEC_ELT (oldargs, i));
- if (TREE_CODE (newarg) != TREE_CODE (oldarg))
- return 0;
- else if (TREE_CODE (newarg) == TYPE_DECL)
- /* continue */;
- else if (! comptypes (TREE_TYPE (newarg), TREE_TYPE (oldarg), 1))
- return 0;
- }
-
- if (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
- types_match = 1;
- else
- types_match = decls_match (DECL_TEMPLATE_RESULT (olddecl),
- DECL_TEMPLATE_RESULT (newdecl));
- }
- else
- {
- if (TREE_TYPE (newdecl) == error_mark_node)
- types_match = TREE_TYPE (olddecl) == error_mark_node;
- else if (TREE_TYPE (olddecl) == NULL_TREE)
- types_match = TREE_TYPE (newdecl) == NULL_TREE;
- else if (TREE_TYPE (newdecl) == NULL_TREE)
- types_match = 0;
- /* Qualifiers must match, and they may be present on either, the type
- or the decl. */
- else if ((TREE_READONLY (newdecl)
- || TYPE_READONLY (TREE_TYPE (newdecl)))
- == (TREE_READONLY (olddecl)
- || TYPE_READONLY (TREE_TYPE (olddecl)))
- && (TREE_THIS_VOLATILE (newdecl)
- || TYPE_VOLATILE (TREE_TYPE (newdecl)))
- == (TREE_THIS_VOLATILE (olddecl)
- || TYPE_VOLATILE (TREE_TYPE (olddecl))))
- types_match = comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (newdecl)),
- TYPE_MAIN_VARIANT (TREE_TYPE (olddecl)), 1);
- else
- types_match = 0;
- }
-
- return types_match;
-}
-
-/* If NEWDECL is `static' and an `extern' was seen previously,
- warn about it. (OLDDECL may be NULL_TREE; NAME contains
- information about previous usage as an `extern'.)
-
- Note that this does not apply to the C++ case of declaring
- a variable `extern const' and then later `const'.
-
- Don't complain about built-in functions, since they are beyond
- the user's control. */
-
-static void
-warn_extern_redeclared_static (newdecl, olddecl)
- tree newdecl, olddecl;
-{
- tree name;
-
- static char *explicit_extern_static_warning
- = "`%D' was declared `extern' and later `static'";
- static char *implicit_extern_static_warning
- = "`%D' was declared implicitly `extern' and later `static'";
-
- if (TREE_CODE (newdecl) == TYPE_DECL)
- return;
-
- name = DECL_ASSEMBLER_NAME (newdecl);
- if (TREE_PUBLIC (name) && DECL_THIS_STATIC (newdecl))
- {
- /* It's okay to redeclare an ANSI built-in function as static,
- or to declare a non-ANSI built-in function as anything. */
- if (! (TREE_CODE (newdecl) == FUNCTION_DECL
- && olddecl != NULL_TREE
- && TREE_CODE (olddecl) == FUNCTION_DECL
- && (DECL_BUILT_IN (olddecl)
- || DECL_BUILT_IN_NONANSI (olddecl))))
- {
- cp_pedwarn (IDENTIFIER_IMPLICIT_DECL (name)
- ? implicit_extern_static_warning
- : explicit_extern_static_warning, newdecl);
- if (olddecl != NULL_TREE)
- cp_pedwarn_at ("previous declaration of `%D'", olddecl);
- }
- }
-}
-
-/* Handle when a new declaration NEWDECL has the same name as an old
- one OLDDECL in the same binding contour. Prints an error message
- if appropriate.
-
- If safely possible, alter OLDDECL to look like NEWDECL, and return 1.
- Otherwise, return 0. */
-
-int
-duplicate_decls (newdecl, olddecl)
- tree newdecl, olddecl;
-{
- extern struct obstack permanent_obstack;
- unsigned olddecl_uid = DECL_UID (olddecl);
- int olddecl_friend = 0, types_match = 0;
- int new_defines_function;
-
- if (newdecl == olddecl)
- return 1;
-
- if (TREE_CODE_CLASS (TREE_CODE (olddecl)) == 'd')
- DECL_MACHINE_ATTRIBUTES (newdecl) = DECL_MACHINE_ATTRIBUTES (olddecl);
-
- types_match = decls_match (newdecl, olddecl);
-
- if (TREE_CODE (olddecl) != TREE_LIST)
- olddecl_friend = DECL_LANG_SPECIFIC (olddecl) && DECL_FRIEND_P (olddecl);
-
- /* If either the type of the new decl or the type of the old decl is an
- error_mark_node, then that implies that we have already issued an
- error (earlier) for some bogus type specification, and in that case,
- it is rather pointless to harass the user with yet more error message
- about the same declaration, so well just pretent the types match here. */
- if (TREE_TYPE (newdecl) == error_mark_node
- || TREE_TYPE (olddecl) == error_mark_node)
- types_match = 1;
-
- if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_ARTIFICIAL (olddecl)
- && (DECL_BUILT_IN (olddecl) || DECL_BUILT_IN_NONANSI (olddecl)))
- {
- /* If you declare a built-in or predefined function name as static,
- the old definition is overridden, but optionally warn this was a
- bad choice of name. Ditto for overloads. */
- if (! DECL_PUBLIC (newdecl)
- || (TREE_CODE (newdecl) == FUNCTION_DECL
- && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl)))
- {
- if (warn_shadow)
- cp_warning ("shadowing %s function `%#D'",
- DECL_BUILT_IN (olddecl) ? "built-in" : "library",
- olddecl);
- /* Discard the old built-in function. */
- return 0;
- }
- else if (! types_match)
- {
- if (TREE_CODE (newdecl) != FUNCTION_DECL)
- {
- /* If the built-in is not ansi, then programs can override
- it even globally without an error. */
- if (! DECL_BUILT_IN (olddecl))
- cp_warning ("library function `%#D' redeclared as non-function `%#D'",
- olddecl, newdecl);
- else
- {
- cp_error ("declaration of `%#D'", newdecl);
- cp_error ("conflicts with built-in declaration `%#D'",
- olddecl);
- }
- return 0;
- }
-
- cp_warning ("declaration of `%#D'", newdecl);
- cp_warning ("conflicts with built-in declaration `%#D'",
- olddecl);
- }
- }
- else if (TREE_CODE (olddecl) != TREE_CODE (newdecl))
- {
- if ((TREE_CODE (newdecl) == FUNCTION_DECL
- && DECL_FUNCTION_TEMPLATE_P (olddecl))
- || (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_FUNCTION_TEMPLATE_P (newdecl)))
- return 0;
-
- cp_error ("`%#D' redeclared as different kind of symbol", newdecl);
- if (TREE_CODE (olddecl) == TREE_LIST)
- olddecl = TREE_VALUE (olddecl);
- cp_error_at ("previous declaration of `%#D'", olddecl);
-
- /* New decl is completely inconsistent with the old one =>
- tell caller to replace the old one. */
-
- return 0;
- }
- else if (!types_match)
- {
- if (TREE_CODE (newdecl) == TEMPLATE_DECL)
- {
- /* The name of a class template may not be declared to refer to
- any other template, class, function, object, namespace, value,
- or type in the same scope. */
- if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL
- || TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
- {
- cp_error ("declaration of template `%#D'", newdecl);
- cp_error_at ("conflicts with previous declaration `%#D'",
- olddecl);
- }
- else if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL
- && TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == FUNCTION_DECL
- && compparms (TYPE_ARG_TYPES (TREE_TYPE (DECL_TEMPLATE_RESULT (olddecl))),
- TYPE_ARG_TYPES (TREE_TYPE (DECL_TEMPLATE_RESULT (newdecl))), 3))
- {
- cp_error ("new declaration `%#D'", newdecl);
- cp_error_at ("ambiguates old declaration `%#D'", olddecl);
- }
- return 0;
- }
- if (TREE_CODE (newdecl) == FUNCTION_DECL)
- {
- if (DECL_LANGUAGE (newdecl) == lang_c
- && DECL_LANGUAGE (olddecl) == lang_c)
- {
- cp_error ("declaration of C function `%#D' conflicts with",
- newdecl);
- cp_error_at ("previous declaration `%#D' here", olddecl);
- }
- else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
- TYPE_ARG_TYPES (TREE_TYPE (olddecl)), 3))
- {
- cp_error ("new declaration `%#D'", newdecl);
- cp_error_at ("ambiguates old declaration `%#D'", olddecl);
- }
- else
- return 0;
- }
-
- /* Already complained about this, so don't do so again. */
- else if (current_class_type == NULL_TREE
- || IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (newdecl)) != current_class_type)
- {
- cp_error ("conflicting types for `%#D'", newdecl);
- cp_error_at ("previous declaration as `%#D'", olddecl);
- }
- }
- else
- {
- char *errmsg = redeclaration_error_message (newdecl, olddecl);
- if (errmsg)
- {
- cp_error (errmsg, newdecl);
- if (DECL_NAME (olddecl) != NULL_TREE)
- cp_error_at ((DECL_INITIAL (olddecl)
- && current_binding_level == global_binding_level)
- ? "`%#D' previously defined here"
- : "`%#D' previously declared here", olddecl);
- }
- else if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_INITIAL (olddecl) != NULL_TREE
- && TYPE_ARG_TYPES (TREE_TYPE (olddecl)) == NULL_TREE
- && TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != NULL_TREE)
- {
- /* Prototype decl follows defn w/o prototype. */
- cp_warning_at ("prototype for `%#D'", newdecl);
- cp_warning_at ("follows non-prototype definition here", olddecl);
- }
- else if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl))
- {
- /* extern "C" int foo ();
- int foo () { bar (); }
- is OK. */
- if (current_lang_stack == current_lang_base)
- DECL_LANGUAGE (newdecl) = DECL_LANGUAGE (olddecl);
- else
- {
- cp_error_at ("previous declaration of `%#D' with %L linkage",
- olddecl, DECL_LANGUAGE (olddecl));
- cp_error ("conflicts with new declaration with %L linkage",
- DECL_LANGUAGE (newdecl));
- }
- }
-
- if (TREE_CODE (olddecl) == FUNCTION_DECL
- && ! DECL_USE_TEMPLATE (olddecl))
- {
- tree t1 = TYPE_ARG_TYPES (TREE_TYPE (olddecl));
- tree t2 = TYPE_ARG_TYPES (TREE_TYPE (newdecl));
- int i = 1;
-
- if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE)
- t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2);
-
- for (; t1 && t1 != void_list_node;
- t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2), i++)
- if (TREE_PURPOSE (t1) && TREE_PURPOSE (t2))
- {
- if (1 == simple_cst_equal (TREE_PURPOSE (t1),
- TREE_PURPOSE (t2)))
- {
- if (pedantic)
- {
- cp_pedwarn ("default argument given for parameter %d of `%#D'",
- i, newdecl);
- cp_pedwarn_at ("after previous specification in `%#D'",
- olddecl);
- }
- }
- else
- {
- cp_error ("default argument given for parameter %d of `%#D'",
- i, newdecl);
- cp_error_at ("conflicts with previous specification in `%#D'",
- olddecl);
- }
- }
-
- if (DECL_THIS_INLINE (newdecl) && ! DECL_THIS_INLINE (olddecl)
- && TREE_ADDRESSABLE (olddecl) && warn_inline)
- {
- cp_warning ("`%#D' was used before it was declared inline",
- newdecl);
- cp_warning_at ("previous non-inline declaration here",
- olddecl);
- }
- }
- /* These bits are logically part of the type for non-functions. */
- else if (TREE_READONLY (newdecl) != TREE_READONLY (olddecl)
- || TREE_THIS_VOLATILE (newdecl) != TREE_THIS_VOLATILE (olddecl))
- {
- cp_pedwarn ("type qualifiers for `%#D'", newdecl);
- cp_pedwarn_at ("conflict with previous decl `%#D'", olddecl);
- }
- }
-
- /* If new decl is `static' and an `extern' was seen previously,
- warn about it. */
- warn_extern_redeclared_static (newdecl, olddecl);
-
- /* We have committed to returning 1 at this point. */
- if (TREE_CODE (newdecl) == FUNCTION_DECL)
- {
- /* Now that functions must hold information normally held
- by field decls, there is extra work to do so that
- declaration information does not get destroyed during
- definition. */
- if (DECL_VINDEX (olddecl))
- DECL_VINDEX (newdecl) = DECL_VINDEX (olddecl);
- if (DECL_CONTEXT (olddecl))
- DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl);
- if (DECL_CLASS_CONTEXT (olddecl))
- DECL_CLASS_CONTEXT (newdecl) = DECL_CLASS_CONTEXT (olddecl);
- if (DECL_CHAIN (newdecl) == NULL_TREE)
- DECL_CHAIN (newdecl) = DECL_CHAIN (olddecl);
- if (DECL_PENDING_INLINE_INFO (newdecl) == (struct pending_inline *)0)
- DECL_PENDING_INLINE_INFO (newdecl) = DECL_PENDING_INLINE_INFO (olddecl);
- DECL_STATIC_CONSTRUCTOR (newdecl) |= DECL_STATIC_CONSTRUCTOR (olddecl);
- DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
- DECL_ABSTRACT_VIRTUAL_P (newdecl) |= DECL_ABSTRACT_VIRTUAL_P (olddecl);
- }
-
- /* Deal with C++: must preserve virtual function table size. */
- if (TREE_CODE (olddecl) == TYPE_DECL)
- {
- register tree newtype = TREE_TYPE (newdecl);
- register tree oldtype = TREE_TYPE (olddecl);
-
- if (newtype != error_mark_node && oldtype != error_mark_node
- && TYPE_LANG_SPECIFIC (newtype) && TYPE_LANG_SPECIFIC (oldtype))
- {
- CLASSTYPE_VSIZE (newtype) = CLASSTYPE_VSIZE (oldtype);
- CLASSTYPE_FRIEND_CLASSES (newtype)
- = CLASSTYPE_FRIEND_CLASSES (oldtype);
- }
- }
-
- /* Special handling ensues if new decl is a function definition. */
- new_defines_function = (TREE_CODE (newdecl) == FUNCTION_DECL
- && DECL_INITIAL (newdecl) != NULL_TREE);
-
- /* Optionally warn about more than one declaration for the same name,
- but don't warn about a function declaration followed by a definition. */
- if (warn_redundant_decls
- && ! DECL_ARTIFICIAL (olddecl)
- && !(new_defines_function && DECL_INITIAL (olddecl) == NULL_TREE)
- /* Don't warn about extern decl followed by (tentative) definition. */
- && !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl)))
- {
- cp_warning ("redundant redeclaration of `%D' in same scope", newdecl);
- cp_warning_at ("previous declaration of `%D'", olddecl);
- }
-
- /* Copy all the DECL_... slots specified in the new decl
- except for any that we copy here from the old type. */
-
- if (TREE_CODE (newdecl) == TEMPLATE_DECL)
- {
- TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
- DECL_TEMPLATE_RESULT (olddecl) = DECL_TEMPLATE_RESULT (newdecl);
- DECL_TEMPLATE_PARMS (olddecl) = DECL_TEMPLATE_PARMS (newdecl);
- return 1;
- }
-
- if (types_match)
- {
- /* Automatically handles default parameters. */
- tree oldtype = TREE_TYPE (olddecl);
- tree newtype;
-
- /* Make sure we put the new type in the same obstack as the old one. */
- if (oldtype)
- push_obstacks (TYPE_OBSTACK (oldtype), TYPE_OBSTACK (oldtype));
- else
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- }
-
- /* Merge the data types specified in the two decls. */
- newtype = common_type (TREE_TYPE (newdecl), TREE_TYPE (olddecl));
-
- if (TREE_CODE (newdecl) == VAR_DECL)
- DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl);
- /* Do this after calling `common_type' so that default
- parameters don't confuse us. */
- else if (TREE_CODE (newdecl) == FUNCTION_DECL
- && (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl))
- != TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl))))
- {
- TREE_TYPE (newdecl) = build_exception_variant (newtype,
- TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)));
- TREE_TYPE (olddecl) = build_exception_variant (newtype,
- TYPE_RAISES_EXCEPTIONS (oldtype));
-
- if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl))
- && ! compexcepttypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl)))
- {
- cp_pedwarn ("declaration of `%D' throws different exceptions",
- newdecl);
- cp_pedwarn_at ("previous declaration here", olddecl);
- }
- }
- TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype;
-
- /* Lay the type out, unless already done. */
- if (oldtype != TREE_TYPE (newdecl)
- && TREE_TYPE (newdecl) != error_mark_node
- && !(processing_template_decl && uses_template_parms (newdecl)))
- layout_type (TREE_TYPE (newdecl));
-
- if ((TREE_CODE (newdecl) == VAR_DECL
- || TREE_CODE (newdecl) == PARM_DECL
- || TREE_CODE (newdecl) == RESULT_DECL
- || TREE_CODE (newdecl) == FIELD_DECL
- || TREE_CODE (newdecl) == TYPE_DECL)
- && !(processing_template_decl && uses_template_parms (newdecl)))
- layout_decl (newdecl, 0);
-
- /* Merge the type qualifiers. */
- if (TREE_READONLY (newdecl))
- TREE_READONLY (olddecl) = 1;
- if (TREE_THIS_VOLATILE (newdecl))
- TREE_THIS_VOLATILE (olddecl) = 1;
-
- /* Merge the initialization information. */
- if (DECL_INITIAL (newdecl) == NULL_TREE
- && DECL_INITIAL (olddecl) != NULL_TREE)
- {
- DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
- DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl);
- DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl);
- }
-
- /* Merge the section attribute.
- We want to issue an error if the sections conflict but that must be
- done later in decl_attributes since we are called before attributes
- are assigned. */
- if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
- DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
-
- /* Keep the old rtl since we can safely use it, unless it's the
- call to abort() used for abstract virtuals. */
- if ((DECL_LANG_SPECIFIC (olddecl)
- && !DECL_ABSTRACT_VIRTUAL_P (olddecl))
- || DECL_RTL (olddecl) != DECL_RTL (abort_fndecl))
- DECL_RTL (newdecl) = DECL_RTL (olddecl);
-
- pop_obstacks ();
- }
- /* If cannot merge, then use the new type and qualifiers,
- and don't preserve the old rtl. */
- else
- {
- /* Clean out any memory we had of the old declaration. */
- tree oldstatic = value_member (olddecl, static_aggregates);
- if (oldstatic)
- TREE_VALUE (oldstatic) = error_mark_node;
-
- TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
- TREE_READONLY (olddecl) = TREE_READONLY (newdecl);
- TREE_THIS_VOLATILE (olddecl) = TREE_THIS_VOLATILE (newdecl);
- TREE_SIDE_EFFECTS (olddecl) = TREE_SIDE_EFFECTS (newdecl);
- }
-
- /* Merge the storage class information. */
- DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
- DECL_ONE_ONLY (newdecl) |= DECL_ONE_ONLY (olddecl);
- TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
- TREE_STATIC (olddecl) = TREE_STATIC (newdecl) |= TREE_STATIC (olddecl);
- if (! DECL_EXTERNAL (olddecl))
- DECL_EXTERNAL (newdecl) = 0;
-
- if (TREE_CODE (newdecl) == FUNCTION_DECL)
- DECL_C_STATIC (newdecl) |= DECL_C_STATIC (olddecl);
-
- if (DECL_LANG_SPECIFIC (newdecl))
- {
- DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
- DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl);
- }
-
- if (TREE_CODE (newdecl) == FUNCTION_DECL)
- {
- DECL_THIS_INLINE (newdecl) |= DECL_THIS_INLINE (olddecl);
-
- /* If either decl says `inline', this fn is inline, unless its
- definition was passed already. */
- if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == NULL_TREE)
- DECL_INLINE (olddecl) = 1;
- DECL_INLINE (newdecl) = DECL_INLINE (olddecl);
-
- if (! types_match)
- {
- DECL_LANGUAGE (olddecl) = DECL_LANGUAGE (newdecl);
- DECL_ASSEMBLER_NAME (olddecl) = DECL_ASSEMBLER_NAME (newdecl);
- DECL_RTL (olddecl) = DECL_RTL (newdecl);
- }
- if (! types_match || new_defines_function)
- {
- /* These need to be copied so that the names are available. */
- DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl);
- DECL_RESULT (olddecl) = DECL_RESULT (newdecl);
- }
- if (new_defines_function)
- /* If defining a function declared with other language
- linkage, use the previously declared language linkage. */
- DECL_LANGUAGE (newdecl) = DECL_LANGUAGE (olddecl);
- else
- {
- /* If redeclaring a builtin function, and not a definition,
- it stays built in. */
- if (DECL_BUILT_IN (olddecl))
- {
- DECL_BUILT_IN (newdecl) = 1;
- DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
- /* If we're keeping the built-in definition, keep the rtl,
- regardless of declaration matches. */
- DECL_RTL (newdecl) = DECL_RTL (olddecl);
- }
- else
- DECL_FRAME_SIZE (newdecl) = DECL_FRAME_SIZE (olddecl);
-
- DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
- if ((DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl)))
- /* Previously saved insns go together with
- the function's previous definition. */
- DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
- /* Don't clear out the arguments if we're redefining a function. */
- if (DECL_ARGUMENTS (olddecl))
- DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
- }
- if (DECL_LANG_SPECIFIC (olddecl))
- DECL_MAIN_VARIANT (newdecl) = DECL_MAIN_VARIANT (olddecl);
- }
-
- if (TREE_CODE (newdecl) == NAMESPACE_DECL)
- {
- NAMESPACE_LEVEL (newdecl) = NAMESPACE_LEVEL (olddecl);
- }
-
- if (TREE_CODE (newdecl) == TEMPLATE_DECL)
- {
- DECL_TEMPLATE_INSTANTIATIONS (newdecl)
- = DECL_TEMPLATE_INSTANTIATIONS (olddecl);
- if (DECL_CHAIN (newdecl) == NULL_TREE)
- DECL_CHAIN (newdecl) = DECL_CHAIN (olddecl);
- }
-
- /* Now preserve various other info from the definition. */
- TREE_ADDRESSABLE (newdecl) = TREE_ADDRESSABLE (olddecl);
- TREE_ASM_WRITTEN (newdecl) = TREE_ASM_WRITTEN (olddecl);
- DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
- DECL_ASSEMBLER_NAME (newdecl) = DECL_ASSEMBLER_NAME (olddecl);
-
- /* Don't really know how much of the language-specific
- values we should copy from old to new. */
- if (DECL_LANG_SPECIFIC (olddecl))
- {
- DECL_IN_AGGR_P (newdecl) = DECL_IN_AGGR_P (olddecl);
- DECL_ACCESS (newdecl) = DECL_ACCESS (olddecl);
- DECL_NONCONVERTING_P (newdecl) = DECL_NONCONVERTING_P (olddecl);
- if (DECL_TEMPLATE_INFO (newdecl) == NULL_TREE)
- {
- DECL_TEMPLATE_INFO (newdecl) = DECL_TEMPLATE_INFO (olddecl);
- DECL_USE_TEMPLATE (newdecl) = DECL_USE_TEMPLATE (olddecl);
- }
- }
-
- if (TREE_CODE (newdecl) == FUNCTION_DECL)
- {
- int function_size;
- struct lang_decl *ol = DECL_LANG_SPECIFIC (olddecl);
- struct lang_decl *nl = DECL_LANG_SPECIFIC (newdecl);
-
- function_size = sizeof (struct tree_decl);
-
- bcopy ((char *) newdecl + sizeof (struct tree_common),
- (char *) olddecl + sizeof (struct tree_common),
- function_size - sizeof (struct tree_common));
-
- /* Can we safely free the storage used by newdecl? */
-
-#define ROUND(x) ((x + obstack_alignment_mask (&permanent_obstack)) \
- & ~ obstack_alignment_mask (&permanent_obstack))
-
- if ((char *)newdecl + ROUND (function_size)
- + ROUND (sizeof (struct lang_decl))
- == obstack_next_free (&permanent_obstack))
- {
- DECL_MAIN_VARIANT (newdecl) = olddecl;
- DECL_LANG_SPECIFIC (olddecl) = ol;
- bcopy ((char *)nl, (char *)ol, sizeof (struct lang_decl));
-
- obstack_free (&permanent_obstack, newdecl);
- }
- else if (LANG_DECL_PERMANENT (ol) && ol != nl)
- {
- if (DECL_MAIN_VARIANT (olddecl) == olddecl)
- {
- /* Save these lang_decls that would otherwise be lost. */
- extern tree free_lang_decl_chain;
- tree free_lang_decl = (tree) ol;
-
- if (DECL_LANG_SPECIFIC (olddecl) == ol)
- abort ();
-
- TREE_CHAIN (free_lang_decl) = free_lang_decl_chain;
- free_lang_decl_chain = free_lang_decl;
- }
- else
- {
- /* Storage leak. */;
- }
- }
- }
- else
- {
- bcopy ((char *) newdecl + sizeof (struct tree_common),
- (char *) olddecl + sizeof (struct tree_common),
- sizeof (struct tree_decl) - sizeof (struct tree_common)
- + tree_code_length [(int)TREE_CODE (newdecl)] * sizeof (char *));
- }
-
- DECL_UID (olddecl) = olddecl_uid;
- if (olddecl_friend)
- DECL_FRIEND_P (olddecl) = 1;
-
- return 1;
-}
-
-/* Record a decl-node X as belonging to the current lexical scope.
- Check for errors (such as an incompatible declaration for the same
- name already seen in the same scope).
-
- Returns either X or an old decl for the same name.
- If an old decl is returned, it may have been smashed
- to agree with what X says. */
-
-tree
-pushdecl (x)
- tree x;
-{
- register tree t;
- register tree name = DECL_ASSEMBLER_NAME (x);
- register struct binding_level *b = current_binding_level;
-
- if (x != current_function_decl
- /* Don't change DECL_CONTEXT of virtual methods. */
- && (TREE_CODE (x) != FUNCTION_DECL || !DECL_VIRTUAL_P (x))
- && ! DECL_CONTEXT (x))
- DECL_CONTEXT (x) = current_function_decl;
- /* A local declaration for a function doesn't constitute nesting. */
- if (TREE_CODE (x) == FUNCTION_DECL && DECL_INITIAL (x) == 0)
- DECL_CONTEXT (x) = 0;
-
- /* Type are looked up using the DECL_NAME, as that is what the rest of the
- compiler wants to use. */
- if (TREE_CODE (x) == TYPE_DECL || TREE_CODE (x) == VAR_DECL
- || TREE_CODE (x) == NAMESPACE_DECL)
- name = DECL_NAME (x);
-
- if (name)
- {
-#if 0
- /* Not needed...see below. */
- char *file;
- int line;
-#endif
-
- t = lookup_name_current_level (name);
- if (t == error_mark_node)
- {
- /* error_mark_node is 0 for a while during initialization! */
- t = NULL_TREE;
- cp_error_at ("`%#D' used prior to declaration", x);
- }
-
- else if (t != NULL_TREE)
- {
-#if 0
- /* This is turned off until I have time to do it right (bpk). */
- /* With the code below that uses it... */
- file = DECL_SOURCE_FILE (t);
- line = DECL_SOURCE_LINE (t);
-#endif
- if (TREE_CODE (t) == PARM_DECL)
- {
- if (DECL_CONTEXT (t) == NULL_TREE)
- fatal ("parse errors have confused me too much");
-
- /* Check for duplicate params. */
- if (duplicate_decls (x, t))
- return t;
- }
- else if (((TREE_CODE (x) == FUNCTION_DECL && DECL_LANGUAGE (x) == lang_c)
- || DECL_FUNCTION_TEMPLATE_P (x))
- && is_overloaded_fn (t))
- /* don't do anything just yet */;
- else if (t == wchar_decl_node)
- {
- if (pedantic && ! DECL_IN_SYSTEM_HEADER (x))
- cp_pedwarn ("redeclaration of wchar_t as `%T'", TREE_TYPE (x));
-
- /* Throw away the redeclaration. */
- return t;
- }
- else if (TREE_CODE (t) != TREE_CODE (x))
- {
- if ((TREE_CODE (t) == TYPE_DECL && DECL_ARTIFICIAL (t)
- && TREE_CODE (x) != TYPE_DECL
- && ! (TREE_CODE (x) == TEMPLATE_DECL
- && TREE_CODE (DECL_TEMPLATE_RESULT (x)) == TYPE_DECL))
- || (TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)
- && TREE_CODE (t) != TYPE_DECL
- && ! (TREE_CODE (t) == TEMPLATE_DECL
- && (TREE_CODE (DECL_TEMPLATE_RESULT (t))
- == TYPE_DECL))))
- {
- /* We do nothing special here, because C++ does such nasty
- things with TYPE_DECLs. Instead, just let the TYPE_DECL
- get shadowed, and know that if we need to find a TYPE_DECL
- for a given name, we can look in the IDENTIFIER_TYPE_VALUE
- slot of the identifier. */
- ;
- }
- else if (duplicate_decls (x, t))
- return t;
- }
- else if (duplicate_decls (x, t))
- {
-#if 0
- /* This is turned off until I have time to do it right (bpk). */
-
- /* Also warn if they did a prototype with `static' on it, but
- then later left the `static' off. */
- if (! TREE_PUBLIC (name) && TREE_PUBLIC (x))
- {
- if (DECL_LANG_SPECIFIC (t) && DECL_FRIEND_P (t))
- return t;
-
- if (extra_warnings)
- {
- cp_warning ("`static' missing from declaration of `%D'",
- t);
- warning_with_file_and_line (file, line,
- "previous declaration of `%s'",
- decl_as_string (t, 0));
- }
-
- /* Now fix things so it'll do what they expect. */
- if (current_function_decl)
- TREE_PUBLIC (current_function_decl) = 0;
- }
- /* Due to interference in memory reclamation (X may be
- obstack-deallocated at this point), we must guard against
- one really special case. [jason: This should be handled
- by start_function] */
- if (current_function_decl == x)
- current_function_decl = t;
-#endif
- if (TREE_CODE (t) == TYPE_DECL)
- SET_IDENTIFIER_TYPE_VALUE (name, TREE_TYPE (t));
- else if (TREE_CODE (t) == FUNCTION_DECL)
- check_default_args (t);
-
- return t;
- }
- }
-
- if (TREE_CODE (x) == FUNCTION_DECL && ! DECL_FUNCTION_MEMBER_P (x))
- {
- t = push_overloaded_decl (x, 1);
- if (t != x || DECL_LANGUAGE (x) == lang_c)
- return t;
- }
- else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_CONTEXT (x) == NULL_TREE)
- return push_overloaded_decl (x, 0);
-
- /* If declaring a type as a typedef, and the type has no known
- typedef name, install this TYPE_DECL as its typedef name. */
- if (TREE_CODE (x) == TYPE_DECL)
- {
- tree type = TREE_TYPE (x);
- tree name = (type != error_mark_node) ? TYPE_NAME (type) : x;
-
- if (name == NULL_TREE || TREE_CODE (name) != TYPE_DECL)
- {
- /* If these are different names, and we're at the global
- binding level, make two equivalent definitions. */
- name = x;
- if (global_bindings_p ())
- TYPE_NAME (type) = x;
- }
- my_friendly_assert (TREE_CODE (name) == TYPE_DECL, 140);
-
- if (type != error_mark_node
- && TYPE_NAME (type)
- && TYPE_IDENTIFIER (type))
- set_identifier_type_value_with_scope (DECL_NAME (x), type, b);
- }
-
- /* Multiple external decls of the same identifier ought to match.
-
- We get warnings about inline functions where they are defined.
- We get warnings about other functions from push_overloaded_decl.
-
- Avoid duplicate warnings where they are used. */
- if (TREE_PUBLIC (x) && TREE_CODE (x) != FUNCTION_DECL)
- {
- tree decl;
-
- if (IDENTIFIER_GLOBAL_VALUE (name) != NULL_TREE
- && (DECL_EXTERNAL (IDENTIFIER_GLOBAL_VALUE (name))
- || TREE_PUBLIC (IDENTIFIER_GLOBAL_VALUE (name))))
- decl = IDENTIFIER_GLOBAL_VALUE (name);
- else
- decl = NULL_TREE;
-
- if (decl
- /* If different sort of thing, we already gave an error. */
- && TREE_CODE (decl) == TREE_CODE (x)
- && ! comptypes (TREE_TYPE (x), TREE_TYPE (decl), 1))
- {
- cp_pedwarn ("type mismatch with previous external decl", x);
- cp_pedwarn_at ("previous external decl of `%#D'", decl);
- }
- }
-
- /* This name is new in its binding level.
- Install the new declaration and return it. */
- if (b == global_binding_level)
- {
- /* Install a global value. */
-
- /* If the first global decl has external linkage,
- warn if we later see static one. */
- if (IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE && DECL_PUBLIC (x))
- TREE_PUBLIC (name) = 1;
-
- /* Don't install an artificial TYPE_DECL if we already have
- another _DECL with that name. */
- if (TREE_CODE (x) != TYPE_DECL
- || t == NULL_TREE
- || ! DECL_ARTIFICIAL (x))
- IDENTIFIER_GLOBAL_VALUE (name) = x;
-
- /* Don't forget if the function was used via an implicit decl. */
- if (IDENTIFIER_IMPLICIT_DECL (name)
- && TREE_USED (IDENTIFIER_IMPLICIT_DECL (name)))
- TREE_USED (x) = 1;
-
- /* Don't forget if its address was taken in that way. */
- if (IDENTIFIER_IMPLICIT_DECL (name)
- && TREE_ADDRESSABLE (IDENTIFIER_IMPLICIT_DECL (name)))
- TREE_ADDRESSABLE (x) = 1;
-
- /* Warn about mismatches against previous implicit decl. */
- if (IDENTIFIER_IMPLICIT_DECL (name) != NULL_TREE
- /* If this real decl matches the implicit, don't complain. */
- && ! (TREE_CODE (x) == FUNCTION_DECL
- && TREE_TYPE (TREE_TYPE (x)) == integer_type_node))
- cp_warning
- ("`%D' was previously implicitly declared to return `int'", x);
-
- /* If new decl is `static' and an `extern' was seen previously,
- warn about it. */
- if (x != NULL_TREE && t != NULL_TREE && decls_match (x, t))
- warn_extern_redeclared_static (x, t);
- }
- else
- {
- /* Here to install a non-global value. */
- tree oldlocal = IDENTIFIER_LOCAL_VALUE (name);
- tree oldglobal = IDENTIFIER_GLOBAL_VALUE (name);
-
- /* Don't install an artificial TYPE_DECL if we already have
- another _DECL with that name. */
- if (TREE_CODE (x) != TYPE_DECL
- || t == NULL_TREE
- || ! DECL_ARTIFICIAL (x))
- {
- b->shadowed = tree_cons (name, oldlocal, b->shadowed);
- IDENTIFIER_LOCAL_VALUE (name) = x;
- }
-
- /* If this is a TYPE_DECL, push it into the type value slot. */
- if (TREE_CODE (x) == TYPE_DECL)
- set_identifier_type_value_with_scope (name, TREE_TYPE (x), b);
-
- /* Clear out any TYPE_DECL shadowed by a namespace so that
- we won't think this is a type. The C struct hack doesn't
- go through namespaces. */
- if (TREE_CODE (x) == NAMESPACE_DECL)
- set_identifier_type_value_with_scope (name, NULL_TREE, b);
-
- /* If this is an extern function declaration, see if we
- have a global definition or declaration for the function. */
- if (oldlocal == NULL_TREE
- && DECL_EXTERNAL (x)
- && oldglobal != NULL_TREE
- && TREE_CODE (x) == FUNCTION_DECL
- && TREE_CODE (oldglobal) == FUNCTION_DECL)
- {
- /* We have one. Their types must agree. */
- if (decls_match (x, oldglobal))
- /* OK */;
- else
- {
- cp_warning ("extern declaration of `%#D' doesn't match", x);
- cp_warning_at ("global declaration `%#D'", oldglobal);
- }
- }
- /* If we have a local external declaration,
- and no file-scope declaration has yet been seen,
- then if we later have a file-scope decl it must not be static. */
- if (oldlocal == NULL_TREE
- && oldglobal == NULL_TREE
- && DECL_EXTERNAL (x)
- && TREE_PUBLIC (x))
- {
- TREE_PUBLIC (name) = 1;
- }
-
- if (DECL_FROM_INLINE (x))
- /* Inline decls shadow nothing. */;
-
- /* Warn if shadowing an argument at the top level of the body. */
- else if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x)
- && TREE_CODE (oldlocal) == PARM_DECL
- && TREE_CODE (x) != PARM_DECL)
- {
- /* Go to where the parms should be and see if we
- find them there. */
- struct binding_level *b = current_binding_level->level_chain;
-
- if (cleanup_label)
- b = b->level_chain;
-
- /* ARM $8.3 */
- if (b->parm_flag == 1)
- cp_error ("declaration of `%#D' shadows a parameter", name);
- }
- else if (warn_shadow && oldlocal != NULL_TREE && b->is_for_scope
- && !DECL_DEAD_FOR_LOCAL (oldlocal))
- {
- warning ("variable `%s' shadows local",
- IDENTIFIER_POINTER (name));
- cp_warning_at (" this is the shadowed declaration", oldlocal);
- }
- /* Maybe warn if shadowing something else. */
- else if (warn_shadow && !DECL_EXTERNAL (x)
- /* No shadow warnings for internally generated vars. */
- && ! DECL_ARTIFICIAL (x)
- /* No shadow warnings for vars made for inlining. */
- && ! DECL_FROM_INLINE (x))
- {
- char *warnstring = NULL;
-
- if (oldlocal != NULL_TREE && TREE_CODE (oldlocal) == PARM_DECL)
- warnstring = "declaration of `%s' shadows a parameter";
- else if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE
- && current_class_ptr
- && !TREE_STATIC (name))
- warnstring = "declaration of `%s' shadows a member of `this'";
- else if (oldlocal != NULL_TREE)
- warnstring = "declaration of `%s' shadows previous local";
- else if (oldglobal != NULL_TREE)
- warnstring = "declaration of `%s' shadows global declaration";
-
- if (warnstring)
- warning (warnstring, IDENTIFIER_POINTER (name));
- }
- }
-
- if (TREE_CODE (x) == FUNCTION_DECL)
- check_default_args (x);
-
- /* Keep count of variables in this level with incomplete type. */
- if (TREE_CODE (x) == VAR_DECL
- && TREE_TYPE (x) != error_mark_node
- && ((TYPE_SIZE (TREE_TYPE (x)) == NULL_TREE
- && PROMOTES_TO_AGGR_TYPE (TREE_TYPE (x), ARRAY_TYPE))
- /* RTTI TD entries are created while defining the type_info. */
- || (TYPE_LANG_SPECIFIC (TREE_TYPE (x))
- && TYPE_BEING_DEFINED (TREE_TYPE (x)))))
- b->incomplete = tree_cons (NULL_TREE, x, b->incomplete);
- }
-
- /* Put decls on list in reverse order.
- We will reverse them later if necessary. */
- TREE_CHAIN (x) = b->names;
- b->names = x;
- if (! (b != global_binding_level || TREE_PERMANENT (x)))
- my_friendly_abort (124);
-
- return x;
-}
-
-/* Same as pushdecl, but define X in binding-level LEVEL. We rely on the
- caller to set DECL_CONTEXT properly. */
-
-static tree
-pushdecl_with_scope (x, level)
- tree x;
- struct binding_level *level;
-{
- register struct binding_level *b = current_binding_level;
- tree function_decl = current_function_decl;
-
- current_function_decl = NULL_TREE;
- current_binding_level = level;
- x = pushdecl (x);
- current_binding_level = b;
- current_function_decl = function_decl;
- return x;
-}
-
-/* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL,
- if appropriate. */
-
-tree
-pushdecl_top_level (x)
- tree x;
-{
- register struct binding_level *b = inner_binding_level;
- register tree t = pushdecl_with_scope (x, global_binding_level);
-
- /* Now, the type_shadowed stack may screw us. Munge it so it does
- what we want. */
- if (TREE_CODE (x) == TYPE_DECL)
- {
- tree name = DECL_NAME (x);
- tree newval;
- tree *ptr = (tree *)0;
- for (; b != global_binding_level; b = b->level_chain)
- {
- tree shadowed = b->type_shadowed;
- for (; shadowed; shadowed = TREE_CHAIN (shadowed))
- if (TREE_PURPOSE (shadowed) == name)
- {
- ptr = &TREE_VALUE (shadowed);
- /* Can't break out of the loop here because sometimes
- a binding level will have duplicate bindings for
- PT names. It's gross, but I haven't time to fix it. */
- }
- }
- newval = TREE_TYPE (x);
- if (ptr == (tree *)0)
- {
- /* @@ This shouldn't be needed. My test case "zstring.cc" trips
- up here if this is changed to an assertion. --KR */
- SET_IDENTIFIER_TYPE_VALUE (name, newval);
- }
- else
- {
- *ptr = newval;
- }
- }
- return t;
-}
-
-/* Like push_overloaded_decl, only it places X in GLOBAL_BINDING_LEVEL,
- if appropriate. */
-
-static void
-push_overloaded_decl_top_level (x, forget)
- tree x;
- int forget;
-{
- struct binding_level *b = current_binding_level;
-
- current_binding_level = global_binding_level;
- push_overloaded_decl (x, forget);
- current_binding_level = b;
-}
-
-/* Make the declaration of X appear in CLASS scope. */
-
-tree
-pushdecl_class_level (x)
- tree x;
-{
- /* Don't use DECL_ASSEMBLER_NAME here! Everything that looks in class
- scope looks for the pre-mangled name. */
- register tree name = DECL_NAME (x);
-
- if (name)
- {
- if (TYPE_BEING_DEFINED (current_class_type))
- {
- /* Check for inconsistent use of this name in the class body.
- Types, enums, and static vars are checked here; other
- members are checked in finish_struct. */
- tree icv = IDENTIFIER_CLASS_VALUE (name);
-
- if (icv && icv != x
- /* Don't complain about inherited names. */
- && id_in_current_class (name)
- /* Or shadowed tags. */
- && !(TREE_CODE (icv) == TYPE_DECL
- && DECL_CONTEXT (icv) == current_class_type))
- {
- cp_error ("declaration of identifier `%D' as `%#D'", name, x);
- cp_error_at ("conflicts with previous use in class as `%#D'",
- icv);
- }
- }
-
- push_class_level_binding (name, x);
- if (TREE_CODE (x) == TYPE_DECL)
- {
- set_identifier_type_value (name, TREE_TYPE (x));
- }
- }
- return x;
-}
-
-#if 0
-/* This function is used to push the mangled decls for nested types into
- the appropriate scope. Previously pushdecl_top_level was used, but that
- is incorrect for members of local classes. */
-
-void
-pushdecl_nonclass_level (x)
- tree x;
-{
- struct binding_level *b = current_binding_level;
-
- my_friendly_assert (b->parm_flag != 2, 180);
-
-#if 0
- /* Get out of template binding levels */
- while (b->pseudo_global)
- b = b->level_chain;
-#endif
-
- pushdecl_with_scope (x, b);
-}
-#endif
-
-/* Make the declaration(s) of X appear in CLASS scope
- under the name NAME. */
-
-void
-push_class_level_binding (name, x)
- tree name;
- tree x;
-{
- if (TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)
- && purpose_member (name, class_binding_level->class_shadowed))
- return;
-
- maybe_push_cache_obstack ();
- class_binding_level->class_shadowed
- = tree_cons (name, IDENTIFIER_CLASS_VALUE (name),
- class_binding_level->class_shadowed);
- pop_obstacks ();
- IDENTIFIER_CLASS_VALUE (name) = x;
- obstack_ptr_grow (&decl_obstack, x);
-}
-
-/* Tell caller how to interpret a TREE_LIST which contains
- chains of FUNCTION_DECLS. */
-
-int
-overloaded_globals_p (list)
- tree list;
-{
- my_friendly_assert (TREE_CODE (list) == TREE_LIST, 142);
-
- /* Don't commit caller to seeing them as globals. */
- if (TREE_NONLOCAL_FLAG (list))
- return -1;
- /* Do commit caller to not seeing them as globals. */
- if (TREE_CODE (TREE_VALUE (list)) == TREE_LIST)
- return 0;
- /* Do commit caller to seeing them as globals. */
- return 1;
-}
-
-/* DECL is a FUNCTION_DECL which may have other definitions already in
- place. We get around this by making the value of the identifier point
- to a list of all the things that want to be referenced by that name. It
- is then up to the users of that name to decide what to do with that
- list.
-
- DECL may also be a TEMPLATE_DECL, with a FUNCTION_DECL in its DECL_RESULT
- slot. It is dealt with the same way.
-
- The value returned may be a previous declaration if we guessed wrong
- about what language DECL should belong to (C or C++). Otherwise,
- it's always DECL (and never something that's not a _DECL). */
-
-static tree
-push_overloaded_decl (decl, forgettable)
- tree decl;
- int forgettable;
-{
- tree orig_name = DECL_NAME (decl);
- tree old;
- int doing_global = (global_bindings_p () || ! forgettable);
-
- if (doing_global)
- {
- old = IDENTIFIER_GLOBAL_VALUE (orig_name);
- if (old && TREE_CODE (old) == FUNCTION_DECL
- && DECL_ARTIFICIAL (old)
- && (DECL_BUILT_IN (old) || DECL_BUILT_IN_NONANSI (old)))
- {
- if (duplicate_decls (decl, old))
- return old;
- old = NULL_TREE;
- }
- }
- else
- {
- old = IDENTIFIER_LOCAL_VALUE (orig_name);
-
- if (! purpose_member (orig_name, current_binding_level->shadowed))
- {
- current_binding_level->shadowed
- = tree_cons (orig_name, old, current_binding_level->shadowed);
- old = NULL_TREE;
- }
- }
-
- if (old)
- {
- if (TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old))
- {
- tree t = TREE_TYPE (old);
- if (IS_AGGR_TYPE (t) && warn_shadow
- && (! DECL_IN_SYSTEM_HEADER (decl)
- || ! DECL_IN_SYSTEM_HEADER (old)))
- cp_warning ("`%#D' hides constructor for `%#T'", decl, t);
- old = NULL_TREE;
- }
- else if (is_overloaded_fn (old))
- {
- tree tmp;
-
- for (tmp = get_first_fn (old); tmp; tmp = DECL_CHAIN (tmp))
- if (decl == tmp || duplicate_decls (decl, tmp))
- return tmp;
- }
- else
- {
- cp_error_at ("previous non-function declaration `%#D'", old);
- cp_error ("conflicts with function declaration `%#D'", decl);
- return decl;
- }
- }
-
- if (old || TREE_CODE (decl) == TEMPLATE_DECL)
- {
- if (old && is_overloaded_fn (old))
- DECL_CHAIN (decl) = get_first_fn (old);
- else
- DECL_CHAIN (decl) = NULL_TREE;
- old = tree_cons (orig_name, decl, NULL_TREE);
- TREE_TYPE (old) = unknown_type_node;
- }
- else
- /* orig_name is not ambiguous. */
- old = decl;
-
- if (doing_global)
- IDENTIFIER_GLOBAL_VALUE (orig_name) = old;
- else
- IDENTIFIER_LOCAL_VALUE (orig_name) = old;
-
- return decl;
-}
-
-/* Generate an implicit declaration for identifier FUNCTIONID
- as a function of type int (). Print a warning if appropriate. */
-
-tree
-implicitly_declare (functionid)
- tree functionid;
-{
- register tree decl;
- int temp = allocation_temporary_p ();
-
- push_obstacks_nochange ();
-
- /* Save the decl permanently so we can warn if definition follows.
- In ANSI C, warn_implicit is usually false, so the saves little space.
- But in C++, it's usually true, hence the extra code. */
- if (temp && (! warn_implicit || toplevel_bindings_p ()))
- end_temporary_allocation ();
-
- /* We used to reuse an old implicit decl here,
- but this loses with inline functions because it can clobber
- the saved decl chains. */
- decl = build_lang_decl (FUNCTION_DECL, functionid, default_function_type);
-
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
-
- /* ANSI standard says implicit declarations are in the innermost block.
- So we record the decl in the standard fashion. */
- pushdecl (decl);
- rest_of_decl_compilation (decl, NULL_PTR, 0, 0);
-
- if (warn_implicit
- /* Only one warning per identifier. */
- && IDENTIFIER_IMPLICIT_DECL (functionid) == NULL_TREE)
- {
- cp_pedwarn ("implicit declaration of function `%#D'", decl);
- }
-
- SET_IDENTIFIER_IMPLICIT_DECL (functionid, decl);
-
- pop_obstacks ();
-
- return decl;
-}
-
-/* Return zero if the declaration NEWDECL is valid
- when the declaration OLDDECL (assumed to be for the same name)
- has already been seen.
- Otherwise return an error message format string with a %s
- where the identifier should go. */
-
-static char *
-redeclaration_error_message (newdecl, olddecl)
- tree newdecl, olddecl;
-{
- if (TREE_CODE (newdecl) == TYPE_DECL)
- {
- /* Because C++ can put things into name space for free,
- constructs like "typedef struct foo { ... } foo"
- would look like an erroneous redeclaration. */
- if (comptypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl), 0))
- return 0;
- else
- return "redefinition of `%#D'";
- }
- else if (TREE_CODE (newdecl) == FUNCTION_DECL)
- {
- /* If this is a pure function, its olddecl will actually be
- the original initialization to `0' (which we force to call
- abort()). Don't complain about redefinition in this case. */
- if (DECL_LANG_SPECIFIC (olddecl) && DECL_ABSTRACT_VIRTUAL_P (olddecl))
- return 0;
-
- /* We'll complain about linkage mismatches in
- warn_extern_redeclared_static. */
-
- /* defining the same name twice is no good. */
- if (DECL_INITIAL (olddecl) != NULL_TREE
- && DECL_INITIAL (newdecl) != NULL_TREE)
- {
- if (DECL_NAME (olddecl) == NULL_TREE)
- return "`%#D' not declared in class";
- else
- return "redefinition of `%#D'";
- }
- return 0;
- }
- else if (TREE_CODE (newdecl) == TEMPLATE_DECL)
- {
- if ((TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == FUNCTION_DECL
- && DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl))
- && DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)))
- || (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL
- && TYPE_SIZE (TREE_TYPE (newdecl))
- && TYPE_SIZE (TREE_TYPE (olddecl))))
- return "redefinition of `%#D'";
- return 0;
- }
- else if (toplevel_bindings_p ())
- {
- /* Objects declared at top level: */
- /* If at least one is a reference, it's ok. */
- if (DECL_EXTERNAL (newdecl) || DECL_EXTERNAL (olddecl))
- return 0;
- /* Reject two definitions. */
- return "redefinition of `%#D'";
- }
- else
- {
- /* Objects declared with block scope: */
- /* Reject two definitions, and reject a definition
- together with an external reference. */
- if (!(DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl)))
- return "redeclaration of `%#D'";
- return 0;
- }
-}
-
-/* Get the LABEL_DECL corresponding to identifier ID as a label.
- Create one if none exists so far for the current function.
- This function is called for both label definitions and label references. */
-
-tree
-lookup_label (id)
- tree id;
-{
- register tree decl = IDENTIFIER_LABEL_VALUE (id);
-
- if (current_function_decl == NULL_TREE)
- {
- error ("label `%s' referenced outside of any function",
- IDENTIFIER_POINTER (id));
- return NULL_TREE;
- }
-
- if ((decl == NULL_TREE
- || DECL_SOURCE_LINE (decl) == 0)
- && (named_label_uses == NULL
- || named_label_uses->names_in_scope != current_binding_level->names
- || named_label_uses->label_decl != decl))
- {
- struct named_label_list *new_ent;
- new_ent
- = (struct named_label_list*)oballoc (sizeof (struct named_label_list));
- new_ent->label_decl = decl;
- new_ent->names_in_scope = current_binding_level->names;
- new_ent->binding_level = current_binding_level;
- new_ent->lineno_o_goto = lineno;
- new_ent->filename_o_goto = input_filename;
- new_ent->next = named_label_uses;
- named_label_uses = new_ent;
- }
-
- /* Use a label already defined or ref'd with this name. */
- if (decl != NULL_TREE)
- {
- /* But not if it is inherited and wasn't declared to be inheritable. */
- if (DECL_CONTEXT (decl) != current_function_decl
- && ! C_DECLARED_LABEL_FLAG (decl))
- return shadow_label (id);
- return decl;
- }
-
- decl = build_decl (LABEL_DECL, id, void_type_node);
-
- /* Make sure every label has an rtx. */
- label_rtx (decl);
-
- /* A label not explicitly declared must be local to where it's ref'd. */
- DECL_CONTEXT (decl) = current_function_decl;
-
- DECL_MODE (decl) = VOIDmode;
-
- /* Say where one reference is to the label,
- for the sake of the error if it is not defined. */
- DECL_SOURCE_LINE (decl) = lineno;
- DECL_SOURCE_FILE (decl) = input_filename;
-
- SET_IDENTIFIER_LABEL_VALUE (id, decl);
-
- named_labels = tree_cons (NULL_TREE, decl, named_labels);
- named_label_uses->label_decl = decl;
-
- return decl;
-}
-
-/* Make a label named NAME in the current function,
- shadowing silently any that may be inherited from containing functions
- or containing scopes.
-
- Note that valid use, if the label being shadowed
- comes from another scope in the same function,
- requires calling declare_nonlocal_label right away. */
-
-tree
-shadow_label (name)
- tree name;
-{
- register tree decl = IDENTIFIER_LABEL_VALUE (name);
-
- if (decl != NULL_TREE)
- {
- shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
- SET_IDENTIFIER_LABEL_VALUE (name, NULL_TREE);
- SET_IDENTIFIER_LABEL_VALUE (decl, NULL_TREE);
- }
-
- return lookup_label (name);
-}
-
-/* Define a label, specifying the location in the source file.
- Return the LABEL_DECL node for the label, if the definition is valid.
- Otherwise return 0. */
-
-tree
-define_label (filename, line, name)
- char *filename;
- int line;
- tree name;
-{
- tree decl;
-
- if (minimal_parse_mode)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- decl = build_decl (LABEL_DECL, name, void_type_node);
- pop_obstacks ();
- DECL_SOURCE_LINE (decl) = line;
- DECL_SOURCE_FILE (decl) = filename;
- add_tree (decl);
- return decl;
- }
-
- decl = lookup_label (name);
-
- /* After labels, make any new cleanups go into their
- own new (temporary) binding contour. */
- current_binding_level->more_cleanups_ok = 0;
-
- /* If label with this name is known from an outer context, shadow it. */
- if (decl != NULL_TREE && DECL_CONTEXT (decl) != current_function_decl)
- {
- shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels);
- SET_IDENTIFIER_LABEL_VALUE (name, NULL_TREE);
- decl = lookup_label (name);
- }
-
- if (name == get_identifier ("wchar_t"))
- cp_pedwarn ("label named wchar_t");
-
- if (DECL_INITIAL (decl) != NULL_TREE)
- {
- cp_error ("duplicate label `%D'", decl);
- return 0;
- }
- else
- {
- struct named_label_list *uses, *prev;
- int identified = 0;
-
- /* Mark label as having been defined. */
- DECL_INITIAL (decl) = error_mark_node;
- /* Say where in the source. */
- DECL_SOURCE_FILE (decl) = filename;
- DECL_SOURCE_LINE (decl) = line;
-
- prev = NULL;
- uses = named_label_uses;
- while (uses != NULL)
- if (uses->label_decl == decl)
- {
- struct binding_level *b = current_binding_level;
- while (b)
- {
- tree new_decls = b->names;
- tree old_decls = (b == uses->binding_level)
- ? uses->names_in_scope : NULL_TREE;
- while (new_decls != old_decls)
- {
- if (TREE_CODE (new_decls) == VAR_DECL
- /* Don't complain about crossing initialization
- of internal entities. They can't be accessed,
- and they should be cleaned up
- by the time we get to the label. */
- && ! DECL_ARTIFICIAL (new_decls)
- && ((DECL_INITIAL (new_decls) != NULL_TREE
- && DECL_INITIAL (new_decls) != error_mark_node)
- || TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (new_decls))))
- {
- if (! identified)
- {
- cp_error ("jump to label `%D'", decl);
- error_with_file_and_line (uses->filename_o_goto,
- uses->lineno_o_goto,
- " from here");
- identified = 1;
- }
- cp_error_at (" crosses initialization of `%#D'",
- new_decls);
- }
- new_decls = TREE_CHAIN (new_decls);
- }
- if (b == uses->binding_level)
- break;
- b = b->level_chain;
- }
-
- if (prev != NULL)
- prev->next = uses->next;
- else
- named_label_uses = uses->next;
-
- uses = uses->next;
- }
- else
- {
- prev = uses;
- uses = uses->next;
- }
- current_function_return_value = NULL_TREE;
- return decl;
- }
-}
-
-struct cp_switch
-{
- struct binding_level *level;
- struct cp_switch *next;
-};
-
-static struct cp_switch *switch_stack;
-
-void
-push_switch ()
-{
- struct cp_switch *p
- = (struct cp_switch *) oballoc (sizeof (struct cp_switch));
- p->level = current_binding_level;
- p->next = switch_stack;
- switch_stack = p;
-}
-
-void
-pop_switch ()
-{
- switch_stack = switch_stack->next;
-}
-
-/* Same, but for CASE labels. If DECL is NULL_TREE, it's the default. */
-/* XXX Note decl is never actually used. (bpk) */
-
-void
-define_case_label (decl)
- tree decl;
-{
- tree cleanup = last_cleanup_this_contour ();
- struct binding_level *b = current_binding_level;
- int identified = 0;
-
- if (cleanup)
- {
- static int explained = 0;
- cp_warning_at ("destructor needed for `%#D'", TREE_PURPOSE (cleanup));
- warning ("where case label appears here");
- if (!explained)
- {
- warning ("(enclose actions of previous case statements requiring");
- warning ("destructors in their own binding contours.)");
- explained = 1;
- }
- }
-
- for (; b && b != switch_stack->level; b = b->level_chain)
- {
- tree new_decls = b->names;
- for (; new_decls; new_decls = TREE_CHAIN (new_decls))
- {
- if (TREE_CODE (new_decls) == VAR_DECL
- /* Don't complain about crossing initialization
- of internal entities. They can't be accessed,
- and they should be cleaned up
- by the time we get to the label. */
- && ! DECL_ARTIFICIAL (new_decls)
- && ((DECL_INITIAL (new_decls) != NULL_TREE
- && DECL_INITIAL (new_decls) != error_mark_node)
- || TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (new_decls))))
- {
- if (! identified)
- error ("jump to case label");
- identified = 1;
- cp_error_at (" crosses initialization of `%#D'",
- new_decls);
- }
- }
- }
-
- /* After labels, make any new cleanups go into their
- own new (temporary) binding contour. */
-
- current_binding_level->more_cleanups_ok = 0;
- current_function_return_value = NULL_TREE;
-}
-
-/* Return the list of declarations of the current level.
- Note that this list is in reverse order unless/until
- you nreverse it; and when you do nreverse it, you must
- store the result back using `storedecls' or you will lose. */
-
-tree
-getdecls ()
-{
- return current_binding_level->names;
-}
-
-/* Return the list of type-tags (for structs, etc) of the current level. */
-
-tree
-gettags ()
-{
- return current_binding_level->tags;
-}
-
-/* Store the list of declarations of the current level.
- This is done for the parameter declarations of a function being defined,
- after they are modified in the light of any missing parameters. */
-
-static void
-storedecls (decls)
- tree decls;
-{
- current_binding_level->names = decls;
-}
-
-/* Similarly, store the list of tags of the current level. */
-
-static void
-storetags (tags)
- tree tags;
-{
- current_binding_level->tags = tags;
-}
-
-/* Given NAME, an IDENTIFIER_NODE,
- return the structure (or union or enum) definition for that name.
- Searches binding levels from BINDING_LEVEL up to the global level.
- If THISLEVEL_ONLY is nonzero, searches only the specified context
- (but skips any tag-transparent contexts to find one that is
- meaningful for tags).
- FORM says which kind of type the caller wants;
- it is RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE.
- If the wrong kind of type is found, and it's not a template, an error is
- reported. */
-
-static tree
-lookup_tag (form, name, binding_level, thislevel_only)
- enum tree_code form;
- tree name;
- struct binding_level *binding_level;
- int thislevel_only;
-{
- register struct binding_level *level;
-
- for (level = binding_level; level; level = level->level_chain)
- {
- register tree tail;
- if (ANON_AGGRNAME_P (name))
- for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
- {
- /* There's no need for error checking here, because
- anon names are unique throughout the compilation. */
- if (TYPE_IDENTIFIER (TREE_VALUE (tail)) == name)
- return TREE_VALUE (tail);
- }
- else
- for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
- {
- if (TREE_PURPOSE (tail) == name)
- {
- enum tree_code code = TREE_CODE (TREE_VALUE (tail));
- /* Should tighten this up; it'll probably permit
- UNION_TYPE and a struct template, for example. */
- if (code != form
- && !(form != ENUMERAL_TYPE && code == TEMPLATE_DECL))
- {
- /* Definition isn't the kind we were looking for. */
- cp_error ("`%#D' redeclared as %C", TREE_VALUE (tail),
- form);
- return NULL_TREE;
- }
- return TREE_VALUE (tail);
- }
- }
- if (thislevel_only && ! level->tag_transparent)
- {
- if (level->pseudo_global)
- {
- tree t = IDENTIFIER_GLOBAL_VALUE (name);
- if (t && TREE_CODE (t) == TEMPLATE_DECL
- && TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
- return TREE_TYPE (t);
- }
- return NULL_TREE;
- }
- if (current_class_type && level->level_chain == global_binding_level)
- {
- /* Try looking in this class's tags before heading into
- global binding level. */
- tree context = current_class_type;
- while (context)
- {
- switch (TREE_CODE_CLASS (TREE_CODE (context)))
- {
- tree these_tags;
- case 't':
- these_tags = CLASSTYPE_TAGS (context);
- if (ANON_AGGRNAME_P (name))
- while (these_tags)
- {
- if (TYPE_IDENTIFIER (TREE_VALUE (these_tags))
- == name)
- return TREE_VALUE (tail);
- these_tags = TREE_CHAIN (these_tags);
- }
- else
- while (these_tags)
- {
- if (TREE_PURPOSE (these_tags) == name)
- {
- if (TREE_CODE (TREE_VALUE (these_tags)) != form)
- {
- cp_error ("`%#D' redeclared as %C in class scope",
- TREE_VALUE (tail), form);
- return NULL_TREE;
- }
- return TREE_VALUE (tail);
- }
- these_tags = TREE_CHAIN (these_tags);
- }
- /* If this type is not yet complete, then don't
- look at its context. */
- if (TYPE_SIZE (context) == NULL_TREE)
- goto no_context;
- /* Go to next enclosing type, if any. */
- context = DECL_CONTEXT (TYPE_MAIN_DECL (context));
- break;
- case 'd':
- context = DECL_CONTEXT (context);
- break;
- default:
- my_friendly_abort (10);
- }
- continue;
- no_context:
- break;
- }
- }
- }
- return NULL_TREE;
-}
-
-#if 0
-void
-set_current_level_tags_transparency (tags_transparent)
- int tags_transparent;
-{
- current_binding_level->tag_transparent = tags_transparent;
-}
-#endif
-
-/* Given a type, find the tag that was defined for it and return the tag name.
- Otherwise return 0. However, the value can never be 0
- in the cases in which this is used.
-
- C++: If NAME is non-zero, this is the new name to install. This is
- done when replacing anonymous tags with real tag names. */
-
-static tree
-lookup_tag_reverse (type, name)
- tree type;
- tree name;
-{
- register struct binding_level *level;
-
- for (level = current_binding_level; level; level = level->level_chain)
- {
- register tree tail;
- for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
- {
- if (TREE_VALUE (tail) == type)
- {
- if (name)
- TREE_PURPOSE (tail) = name;
- return TREE_PURPOSE (tail);
- }
- }
- }
- return NULL_TREE;
-}
-
-/* Lookup TYPE in CONTEXT (a chain of nested types or a FUNCTION_DECL).
- Return the type value, or NULL_TREE if not found. */
-
-static tree
-lookup_nested_type (type, context)
- tree type;
- tree context;
-{
- if (context == NULL_TREE)
- return NULL_TREE;
- while (context)
- {
- switch (TREE_CODE (context))
- {
- case TYPE_DECL:
- {
- tree ctype = TREE_TYPE (context);
- tree match = value_member (type, CLASSTYPE_TAGS (ctype));
- if (match)
- return TREE_VALUE (match);
- context = DECL_CONTEXT (context);
-
- /* When we have a nested class whose member functions have
- local types (e.g., a set of enums), we'll arrive here
- with the DECL_CONTEXT as the actual RECORD_TYPE node for
- the enclosing class. Instead, we want to make sure we
- come back in here with the TYPE_DECL, not the RECORD_TYPE. */
- if (context && TREE_CODE (context) == RECORD_TYPE)
- context = TREE_CHAIN (context);
- }
- break;
- case FUNCTION_DECL:
- if (TYPE_NAME (type) && TYPE_IDENTIFIER (type))
- return lookup_name (TYPE_IDENTIFIER (type), 1);
- return NULL_TREE;
- default:
- my_friendly_abort (12);
- }
- }
- return NULL_TREE;
-}
-
-/* Look up NAME in the NAMESPACE. */
-
-tree
-lookup_namespace_name (namespace, name)
- tree namespace, name;
-{
- struct binding_level *b = (struct binding_level *)NAMESPACE_LEVEL (namespace);
- tree x = NULL_TREE;
-
-#if 1
- /* This searches just one level. */
- if (b)
- {
- for (x = b->names; x; x = TREE_CHAIN (x))
- if (DECL_NAME (x) == name || DECL_ASSEMBLER_NAME (x) == name)
- break;
- }
-#else
- /* This searches all levels. */
- for (; b && !x; b = b->level_chain)
- {
- for (x = b->names; x; x = TREE_CHAIN (x))
- if (DECL_NAME (x) == name || DECL_ASSEMBLER_NAME (x) == name)
- break;
- }
-#endif
- return x;
-}
-
-tree
-make_typename_type (context, name)
- tree context, name;
-{
- tree t, d;
-
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
- else if (TREE_CODE (name) != IDENTIFIER_NODE)
- my_friendly_abort (2000);
-
- if (! processing_template_decl
- || ! uses_template_parms (context)
- || context == current_class_type)
- {
- t = lookup_field (context, name, 0, 1);
- if (t == NULL_TREE)
- {
- cp_error ("no type named `%#T' in `%#T'", name, context);
- return error_mark_node;
- }
- return TREE_TYPE (t);
- }
-
- if (processing_template_decl)
- push_obstacks (&permanent_obstack, &permanent_obstack);
- t = make_lang_type (TYPENAME_TYPE);
- d = build_decl (TYPE_DECL, name, t);
- if (processing_template_decl)
- pop_obstacks ();
-
- TYPE_CONTEXT (t) = context;
- TYPE_NAME (TREE_TYPE (d)) = d;
- TYPE_STUB_DECL (TREE_TYPE (d)) = d;
- DECL_CONTEXT (d) = context;
- CLASSTYPE_GOT_SEMICOLON (t) = 1;
-
- return t;
-}
-
-/* Look up NAME in the current binding level and its superiors in the
- namespace of variables, functions and typedefs. Return a ..._DECL
- node of some kind representing its definition if there is only one
- such declaration, or return a TREE_LIST with all the overloaded
- definitions if there are many, or return 0 if it is undefined.
-
- If PREFER_TYPE is > 0, we prefer TYPE_DECLs.
- If PREFER_TYPE is -2, we're being called from yylex(). (UGLY)
- Otherwise we prefer non-TYPE_DECLs. */
-
-static tree
-lookup_name_real (name, prefer_type, nonclass)
- tree name;
- int prefer_type, nonclass;
-{
- register tree val;
- int yylex = 0;
- tree from_obj = NULL_TREE;
- tree locval, classval;
-
- if (prefer_type == -2)
- {
- extern int looking_for_typename;
- tree type = NULL_TREE;
-
- yylex = 1;
- prefer_type = looking_for_typename;
-
- if (got_scope)
- type = got_scope;
- else if (got_object != error_mark_node)
- type = got_object;
-
- if (type)
- {
- if (type == error_mark_node)
- return error_mark_node;
- if (TREE_CODE (type) == TYPENAME_TYPE && TREE_TYPE (type))
- type = TREE_TYPE (type);
-
- type = complete_type (type);
-
- if (type == void_type_node)
- val = IDENTIFIER_GLOBAL_VALUE (name);
- else if (TREE_CODE (type) == NAMESPACE_DECL)
- {
- val = lookup_namespace_name (type, name);
- }
- else if (! IS_AGGR_TYPE (type)
- || TREE_CODE (type) == TEMPLATE_TYPE_PARM
- || TREE_CODE (type) == TYPENAME_TYPE)
- /* Someone else will give an error about this if needed. */
- val = NULL_TREE;
- else if (TYPE_BEING_DEFINED (type))
- {
- val = IDENTIFIER_CLASS_VALUE (name);
- if (val && DECL_CONTEXT (val) != type)
- {
- struct binding_level *b = class_binding_level;
- for (val = NULL_TREE; b; b = b->level_chain)
- {
- tree t = purpose_member (name, b->class_shadowed);
- if (t && TREE_VALUE (t)
- && DECL_CONTEXT (TREE_VALUE (t)) == type)
- {
- val = TREE_VALUE (t);
- break;
- }
- }
- }
- if (val == NULL_TREE)
- val = lookup_field (type, name, 0, 1);
- }
- else if (type == current_class_type)
- val = IDENTIFIER_CLASS_VALUE (name);
- else
- val = lookup_field (type, name, 0, prefer_type);
- }
- else
- val = NULL_TREE;
-
-#if 1
- if (got_scope && processing_template_decl
- && got_scope != current_class_type
- && uses_template_parms (got_scope)
- && val && TREE_CODE (val) == TYPE_DECL
- && ! DECL_ARTIFICIAL (val))
- {
- tree t = make_typename_type (got_scope, DECL_NAME (val));
- TREE_TYPE (t) = TREE_TYPE (val);
- val = TYPE_MAIN_DECL (t);
- }
-#endif
-
- if (got_scope)
- goto done;
- else if (got_object && val)
- from_obj = val;
- }
-
- locval = classval = NULL_TREE;
-
- if (current_binding_level != global_binding_level
- && IDENTIFIER_LOCAL_VALUE (name))
- locval = IDENTIFIER_LOCAL_VALUE (name);
-
- /* In C++ class fields are between local and global scope,
- just before the global scope. */
- if (current_class_type && ! nonclass)
- {
- classval = IDENTIFIER_CLASS_VALUE (name);
- if (classval == NULL_TREE && TYPE_BEING_DEFINED (current_class_type))
- /* Try to find values from base classes if we are presently
- defining a type. We are presently only interested in
- TYPE_DECLs. */
- classval = lookup_field (current_class_type, name, 0, 1);
-
- /* yylex() calls this with -2, since we should never start digging for
- the nested name at the point where we haven't even, for example,
- created the COMPONENT_REF or anything like that. */
- if (classval == NULL_TREE)
- classval = lookup_nested_field (name, ! yylex);
- }
-
- if (locval && classval)
- {
- if (current_scope () == current_function_decl
- && ! hack_decl_function_context (current_function_decl))
- /* Not in a nested function. */
- val = locval;
- else
- {
- /* This is incredibly horrible. The whole concept of
- IDENTIFIER_LOCAL_VALUE / IDENTIFIER_CLASS_VALUE /
- IDENTIFIER_GLOBAL_VALUE needs to be scrapped for local
- classes. */
- tree lctx = hack_decl_function_context (locval);
- tree cctx = hack_decl_function_context (classval);
-
- if (lctx == current_scope ())
- val = locval;
- else if (lctx == cctx)
- val = classval;
- else
- /* I don't know which is right; let's just guess for now. */
- val = locval;
- }
- }
- else if (locval)
- val = locval;
- else if (classval)
- val = classval;
- else
- val = IDENTIFIER_GLOBAL_VALUE (name);
-
- done:
- if (val)
- {
- /* This should only warn about types used in qualified-ids. */
- if (from_obj && from_obj != val)
- {
- if (looking_for_typename && TREE_CODE (from_obj) == TYPE_DECL
- && TREE_CODE (val) == TYPE_DECL
- && TREE_TYPE (from_obj) != TREE_TYPE (val))
- {
- cp_pedwarn ("lookup of `%D' in the scope of `%#T' (`%#T')",
- name, got_object, TREE_TYPE (from_obj));
- cp_pedwarn (" does not match lookup in the current scope (`%#T')",
- TREE_TYPE (val));
- }
-
- val = from_obj;
- }
-
- if ((TREE_CODE (val) == TEMPLATE_DECL && looking_for_template)
- || TREE_CODE (val) == TYPE_DECL || prefer_type <= 0)
- ;
- else if (IDENTIFIER_HAS_TYPE_VALUE (name))
- val = TYPE_MAIN_DECL (IDENTIFIER_TYPE_VALUE (name));
- else if (TREE_TYPE (val) == error_mark_node)
- val = error_mark_node;
- }
- else if (from_obj)
- val = from_obj;
-
- return val;
-}
-
-tree
-lookup_name_nonclass (name)
- tree name;
-{
- return lookup_name_real (name, 0, 1);
-}
-
-tree
-lookup_name (name, prefer_type)
- tree name;
- int prefer_type;
-{
- return lookup_name_real (name, prefer_type, 0);
-}
-
-/* Similar to `lookup_name' but look only at current binding level. */
-
-tree
-lookup_name_current_level (name)
- tree name;
-{
- register tree t = NULL_TREE;
-
- if (current_binding_level == global_binding_level)
- {
- t = IDENTIFIER_GLOBAL_VALUE (name);
-
- /* extern "C" function() */
- if (t != NULL_TREE && TREE_CODE (t) == TREE_LIST)
- t = TREE_VALUE (t);
- }
- else if (IDENTIFIER_LOCAL_VALUE (name) != NULL_TREE)
- {
- struct binding_level *b = current_binding_level;
- while (1)
- {
- for (t = b->names; t; t = TREE_CHAIN (t))
- if (DECL_NAME (t) == name || DECL_ASSEMBLER_NAME (t) == name)
- goto out;
- if (b->keep == 2)
- b = b->level_chain;
- else
- break;
- }
- out:
- ;
- }
-
- return t;
-}
-
-/* Arrange for the user to get a source line number, even when the
- compiler is going down in flames, so that she at least has a
- chance of working around problems in the compiler. We used to
- call error(), but that let the segmentation fault continue
- through; now, it's much more passive by asking them to send the
- maintainers mail about the problem. */
-
-static void
-signal_catch (sig)
- int sig;
-{
- signal (SIGSEGV, SIG_DFL);
-#ifdef SIGIOT
- signal (SIGIOT, SIG_DFL);
-#endif
-#ifdef SIGILL
- signal (SIGILL, SIG_DFL);
-#endif
-#ifdef SIGABRT
- signal (SIGABRT, SIG_DFL);
-#endif
-#ifdef SIGBUS
- signal (SIGBUS, SIG_DFL);
-#endif
- my_friendly_abort (0);
-}
-
-#if 0
-/* Unused -- brendan 970107 */
-/* Array for holding types considered "built-in". These types
- are output in the module in which `main' is defined. */
-static tree *builtin_type_tdescs_arr;
-static int builtin_type_tdescs_len, builtin_type_tdescs_max;
-#endif
-
-/* Push the declarations of builtin types into the namespace.
- RID_INDEX, if < RID_MAX is the index of the builtin type
- in the array RID_POINTERS. NAME is the name used when looking
- up the builtin type. TYPE is the _TYPE node for the builtin type. */
-
-static void
-record_builtin_type (rid_index, name, type)
- enum rid rid_index;
- char *name;
- tree type;
-{
- tree rname = NULL_TREE, tname = NULL_TREE;
- tree tdecl;
-
- if ((int) rid_index < (int) RID_MAX)
- rname = ridpointers[(int) rid_index];
- if (name)
- tname = get_identifier (name);
-
- TYPE_BUILT_IN (type) = 1;
-
- if (tname)
- {
- tdecl = pushdecl (build_decl (TYPE_DECL, tname, type));
- set_identifier_type_value (tname, NULL_TREE);
- if ((int) rid_index < (int) RID_MAX)
- IDENTIFIER_GLOBAL_VALUE (tname) = tdecl;
- }
- if (rname != NULL_TREE)
- {
- if (tname != NULL_TREE)
- {
- set_identifier_type_value (rname, NULL_TREE);
- IDENTIFIER_GLOBAL_VALUE (rname) = tdecl;
- }
- else
- {
- tdecl = pushdecl (build_decl (TYPE_DECL, rname, type));
- set_identifier_type_value (rname, NULL_TREE);
- }
- }
-}
-
-/* Push overloaded decl, in global scope, with one argument so it
- can be used as a callback from define_function. */
-
-static void
-push_overloaded_decl_1 (x)
- tree x;
-{
- push_overloaded_decl (x, 0);
-}
-
-#ifdef __GNUC__
-__inline
-#endif
-tree
-auto_function (name, type, code)
- tree name, type;
- enum built_in_function code;
-{
- return define_function
- (IDENTIFIER_POINTER (name), type, code, (void (*)())push_overloaded_decl_1,
- IDENTIFIER_POINTER (build_decl_overload (name, TYPE_ARG_TYPES (type),
- 0)));
-}
-
-/* Create the predefined scalar types of C,
- and some nodes representing standard constants (0, 1, (void *)0).
- Initialize the global binding level.
- Make definitions for built-in primitive functions. */
-
-void
-init_decl_processing ()
-{
- tree decl;
- register tree endlink, int_endlink, double_endlink, unsigned_endlink;
- tree fields[20];
- /* Data type of memcpy. */
- tree memcpy_ftype, strlen_ftype;
- int wchar_type_size;
- tree temp;
- tree array_domain_type;
- extern int flag_strict_prototype;
- tree vb_off_identifier;
- /* Function type `char *(char *, char *)' and similar ones */
- tree string_ftype_ptr_ptr, int_ftype_string_string;
- tree sizetype_endlink;
- tree ptr_ftype, ptr_ftype_unsigned, ptr_ftype_sizetype;
- tree void_ftype, void_ftype_int, void_ftype_ptr;
-
- /* Have to make these distinct before we try using them. */
- lang_name_cplusplus = get_identifier ("C++");
- lang_name_c = get_identifier ("C");
-
- if (flag_strict_prototype == 2)
- {
- if (pedantic)
- strict_prototypes_lang_c = strict_prototypes_lang_cplusplus;
- }
- else
- strict_prototypes_lang_c = flag_strict_prototype;
-
- /* Initially, C. */
- current_lang_name = lang_name_c;
-
- current_function_decl = NULL_TREE;
- named_labels = NULL_TREE;
- named_label_uses = NULL;
- current_binding_level = NULL_BINDING_LEVEL;
- free_binding_level = NULL_BINDING_LEVEL;
-
- /* Because most segmentation signals can be traced back into user
- code, catch them and at least give the user a chance of working
- around compiler bugs. */
- signal (SIGSEGV, signal_catch);
-
- /* We will also catch aborts in the back-end through signal_catch and
- give the user a chance to see where the error might be, and to defeat
- aborts in the back-end when there have been errors previously in their
- code. */
-#ifdef SIGIOT
- signal (SIGIOT, signal_catch);
-#endif
-#ifdef SIGILL
- signal (SIGILL, signal_catch);
-#endif
-#ifdef SIGABRT
- signal (SIGABRT, signal_catch);
-#endif
-#ifdef SIGBUS
- signal (SIGBUS, signal_catch);
-#endif
-
- gcc_obstack_init (&decl_obstack);
-
- /* Must lay these out before anything else gets laid out. */
- error_mark_node = make_node (ERROR_MARK);
- TREE_PERMANENT (error_mark_node) = 1;
- TREE_TYPE (error_mark_node) = error_mark_node;
- error_mark_list = build_tree_list (error_mark_node, error_mark_node);
- TREE_TYPE (error_mark_list) = error_mark_node;
-
- /* Make the binding_level structure for global names. */
- pushlevel (0);
- global_binding_level = current_binding_level;
-
- this_identifier = get_identifier (THIS_NAME);
- in_charge_identifier = get_identifier (IN_CHARGE_NAME);
- ctor_identifier = get_identifier (CTOR_NAME);
- dtor_identifier = get_identifier (DTOR_NAME);
- pfn_identifier = get_identifier (VTABLE_PFN_NAME);
- index_identifier = get_identifier (VTABLE_INDEX_NAME);
- delta_identifier = get_identifier (VTABLE_DELTA_NAME);
- delta2_identifier = get_identifier (VTABLE_DELTA2_NAME);
- pfn_or_delta2_identifier = get_identifier ("__pfn_or_delta2");
- if (flag_handle_signatures)
- {
- tag_identifier = get_identifier (SIGTABLE_TAG_NAME);
- vb_off_identifier = get_identifier (SIGTABLE_VB_OFF_NAME);
- vt_off_identifier = get_identifier (SIGTABLE_VT_OFF_NAME);
- }
-
- /* Define `int' and `char' first so that dbx will output them first. */
-
- integer_type_node = make_signed_type (INT_TYPE_SIZE);
- record_builtin_type (RID_INT, NULL_PTR, integer_type_node);
-
- /* Define `char', which is like either `signed char' or `unsigned char'
- but not the same as either. */
-
- char_type_node =
- (flag_signed_char
- ? make_signed_type (CHAR_TYPE_SIZE)
- : make_unsigned_type (CHAR_TYPE_SIZE));
- record_builtin_type (RID_CHAR, "char", char_type_node);
-
- long_integer_type_node = make_signed_type (LONG_TYPE_SIZE);
- record_builtin_type (RID_LONG, "long int", long_integer_type_node);
-
- unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE);
- record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node);
-
- long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE);
- record_builtin_type (RID_MAX, "long unsigned int", long_unsigned_type_node);
- record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node);
-
- long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE);
- record_builtin_type (RID_MAX, "long long int", long_long_integer_type_node);
-
- long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE);
- record_builtin_type (RID_MAX, "long long unsigned int",
- long_long_unsigned_type_node);
- record_builtin_type (RID_MAX, "long long unsigned",
- long_long_unsigned_type_node);
-
- short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE);
- record_builtin_type (RID_SHORT, "short int", short_integer_type_node);
- short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE);
- record_builtin_type (RID_MAX, "short unsigned int", short_unsigned_type_node);
- record_builtin_type (RID_MAX, "unsigned short", short_unsigned_type_node);
-
- /* `unsigned long' is the standard type for sizeof.
- Note that stddef.h uses `unsigned long',
- and this must agree, even of long and int are the same size. */
- sizetype
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)));
-
- ptrdiff_type_node
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
-
- TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (char_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (unsigned_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_unsigned_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_long_integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_long_unsigned_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (short_integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (short_unsigned_type_node)) = sizetype;
-
- /* Define both `signed char' and `unsigned char'. */
- signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE);
- record_builtin_type (RID_MAX, "signed char", signed_char_type_node);
- unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
- record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node);
-
- /* These are types that type_for_size and type_for_mode use. */
- intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
- intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node));
- intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node));
- intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node));
- unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node));
- unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node));
- unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node));
- unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode));
- pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node));
-
- float_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE;
- record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node);
- layout_type (float_type_node);
-
- double_type_node = make_node (REAL_TYPE);
- if (flag_short_double)
- TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE;
- else
- TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE;
- record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node);
- layout_type (double_type_node);
-
- long_double_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE;
- record_builtin_type (RID_MAX, "long double", long_double_type_node);
- layout_type (long_double_type_node);
-
- integer_zero_node = build_int_2 (0, 0);
- TREE_TYPE (integer_zero_node) = integer_type_node;
- integer_one_node = build_int_2 (1, 0);
- TREE_TYPE (integer_one_node) = integer_type_node;
- integer_two_node = build_int_2 (2, 0);
- TREE_TYPE (integer_two_node) = integer_type_node;
- integer_three_node = build_int_2 (3, 0);
- TREE_TYPE (integer_three_node) = integer_type_node;
-
- boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE);
- TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
- record_builtin_type (RID_BOOL, "bool", boolean_type_node);
- boolean_false_node = build_int_2 (0, 0);
- TREE_TYPE (boolean_false_node) = boolean_type_node;
- boolean_true_node = build_int_2 (1, 0);
- TREE_TYPE (boolean_true_node) = boolean_type_node;
-
- /* These are needed by stor-layout.c. */
- size_zero_node = size_int (0);
- size_one_node = size_int (1);
-
- signed_size_zero_node = build_int_2 (0, 0);
- TREE_TYPE (signed_size_zero_node) = make_signed_type (TYPE_PRECISION (sizetype));
-
- void_type_node = make_node (VOID_TYPE);
- record_builtin_type (RID_VOID, NULL_PTR, void_type_node);
- layout_type (void_type_node); /* Uses integer_zero_node. */
- void_list_node = build_tree_list (NULL_TREE, void_type_node);
- TREE_PARMLIST (void_list_node) = 1;
-
- null_pointer_node = build_int_2 (0, 0);
- TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node);
- layout_type (TREE_TYPE (null_pointer_node));
-
- if (flag_ansi)
- TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0);
- else
- TREE_TYPE (null_node) = build_pointer_type (void_type_node);
-
- /* Used for expressions that do nothing, but are not errors. */
- void_zero_node = build_int_2 (0, 0);
- TREE_TYPE (void_zero_node) = void_type_node;
-
- string_type_node = build_pointer_type (char_type_node);
- const_string_type_node =
- build_pointer_type (build_type_variant (char_type_node, 1, 0));
-#if 0
- record_builtin_type (RID_MAX, NULL_PTR, string_type_node);
-#endif
-
- /* Make a type to be the domain of a few array types
- whose domains don't really matter.
- 200 is small enough that it always fits in size_t
- and large enough that it can hold most function names for the
- initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */
- array_domain_type = build_index_type (build_int_2 (200, 0));
-
- /* make a type for arrays of characters.
- With luck nothing will ever really depend on the length of this
- array type. */
- char_array_type_node
- = build_array_type (char_type_node, array_domain_type);
- /* Likewise for arrays of ints. */
- int_array_type_node
- = build_array_type (integer_type_node, array_domain_type);
-
- /* This is just some anonymous class type. Nobody should ever
- need to look inside this envelope. */
- class_star_type_node = build_pointer_type (make_lang_type (RECORD_TYPE));
-
- default_function_type
- = build_function_type (integer_type_node, NULL_TREE);
-
- ptr_type_node = build_pointer_type (void_type_node);
- const_ptr_type_node =
- build_pointer_type (build_type_variant (void_type_node, 1, 0));
-#if 0
- record_builtin_type (RID_MAX, NULL_PTR, ptr_type_node);
-#endif
- endlink = void_list_node;
- int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink);
- double_endlink = tree_cons (NULL_TREE, double_type_node, endlink);
- unsigned_endlink = tree_cons (NULL_TREE, unsigned_type_node, endlink);
-
- ptr_ftype = build_function_type (ptr_type_node, NULL_TREE);
- ptr_ftype_unsigned = build_function_type (ptr_type_node, unsigned_endlink);
- sizetype_endlink = tree_cons (NULL_TREE, sizetype, endlink);
- /* We realloc here because sizetype could be int or unsigned. S'ok. */
- ptr_ftype_sizetype = build_function_type (ptr_type_node, sizetype_endlink);
-
- void_ftype = build_function_type (void_type_node, endlink);
- void_ftype_int = build_function_type (void_type_node, int_endlink);
- void_ftype_ptr
- = build_function_type (void_type_node,
- tree_cons (NULL_TREE, ptr_type_node, endlink));
- void_ftype_ptr
- = build_exception_variant (void_ftype_ptr,
- tree_cons (NULL_TREE, NULL_TREE, NULL_TREE));
-
- float_ftype_float
- = build_function_type (float_type_node,
- tree_cons (NULL_TREE, float_type_node, endlink));
-
- double_ftype_double
- = build_function_type (double_type_node, double_endlink);
-
- ldouble_ftype_ldouble
- = build_function_type (long_double_type_node,
- tree_cons (NULL_TREE, long_double_type_node,
- endlink));
-
- double_ftype_double_double
- = build_function_type (double_type_node,
- tree_cons (NULL_TREE, double_type_node,
- double_endlink));
-
- int_ftype_int
- = build_function_type (integer_type_node, int_endlink);
-
- long_ftype_long
- = build_function_type (long_integer_type_node,
- tree_cons (NULL_TREE, long_integer_type_node,
- endlink));
-
- int_ftype_cptr_cptr_sizet
- = build_function_type (integer_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- tree_cons (NULL_TREE,
- sizetype,
- endlink))));
-
- string_ftype_ptr_ptr /* strcpy prototype */
- = build_function_type (string_type_node,
- tree_cons (NULL_TREE, string_type_node,
- tree_cons (NULL_TREE,
- const_string_type_node,
- endlink)));
-
- int_ftype_string_string /* strcmp prototype */
- = build_function_type (integer_type_node,
- tree_cons (NULL_TREE, const_string_type_node,
- tree_cons (NULL_TREE,
- const_string_type_node,
- endlink)));
-
- strlen_ftype /* strlen prototype */
- = build_function_type (sizetype,
- tree_cons (NULL_TREE, const_string_type_node,
- endlink));
-
- memcpy_ftype /* memcpy prototype */
- = build_function_type (ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, const_ptr_type_node,
- sizetype_endlink)));
-
- if (flag_huge_objects)
- delta_type_node = long_integer_type_node;
- else
- delta_type_node = short_integer_type_node;
-
- builtin_function ("__builtin_constant_p", int_ftype_int,
- BUILT_IN_CONSTANT_P, NULL_PTR);
-
- builtin_return_address_fndecl =
- builtin_function ("__builtin_return_address", ptr_ftype_unsigned,
- BUILT_IN_RETURN_ADDRESS, NULL_PTR);
-
- builtin_function ("__builtin_frame_address", ptr_ftype_unsigned,
- BUILT_IN_FRAME_ADDRESS, NULL_PTR);
-
- builtin_function ("__builtin_alloca", ptr_ftype_sizetype,
- BUILT_IN_ALLOCA, "alloca");
- builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
- /* Define alloca, ffs as builtins.
- Declare _exit just to mark it as volatile. */
- if (! flag_no_builtin && !flag_no_nonansi_builtin)
- {
- temp = builtin_function ("alloca", ptr_ftype_sizetype,
- BUILT_IN_ALLOCA, NULL_PTR);
- /* Suppress error if redefined as a non-function. */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- temp = builtin_function ("ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
- /* Suppress error if redefined as a non-function. */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- temp = builtin_function ("_exit", void_ftype_int,
- NOT_BUILT_IN, NULL_PTR);
- TREE_THIS_VOLATILE (temp) = 1;
- TREE_SIDE_EFFECTS (temp) = 1;
- /* Suppress error if redefined as a non-function. */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- }
-
- builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
- builtin_function ("__builtin_fabsf", float_ftype_float, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("__builtin_fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("__builtin_labs", long_ftype_long,
- BUILT_IN_LABS, NULL_PTR);
- builtin_function ("__builtin_saveregs", ptr_ftype,
- BUILT_IN_SAVEREGS, NULL_PTR);
- builtin_function ("__builtin_classify_type", default_function_type,
- BUILT_IN_CLASSIFY_TYPE, NULL_PTR);
- builtin_function ("__builtin_next_arg", ptr_ftype,
- BUILT_IN_NEXT_ARG, NULL_PTR);
- builtin_function ("__builtin_args_info", int_ftype_int,
- BUILT_IN_ARGS_INFO, NULL_PTR);
-
- /* Untyped call and return. */
- builtin_function ("__builtin_apply_args", ptr_ftype,
- BUILT_IN_APPLY_ARGS, NULL_PTR);
-
- temp = tree_cons (NULL_TREE,
- build_pointer_type (build_function_type (void_type_node,
- NULL_TREE)),
- ptr_ftype_sizetype);
- builtin_function ("__builtin_apply",
- build_function_type (ptr_type_node, temp),
- BUILT_IN_APPLY, NULL_PTR);
- builtin_function ("__builtin_return", void_ftype_ptr,
- BUILT_IN_RETURN, NULL_PTR);
-
- /* Currently under experimentation. */
- builtin_function ("__builtin_memcpy", memcpy_ftype,
- BUILT_IN_MEMCPY, "memcpy");
- builtin_function ("__builtin_memcmp", int_ftype_cptr_cptr_sizet,
- BUILT_IN_MEMCMP, "memcmp");
- builtin_function ("__builtin_strcmp", int_ftype_string_string,
- BUILT_IN_STRCMP, "strcmp");
- builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr,
- BUILT_IN_STRCPY, "strcpy");
- builtin_function ("__builtin_strlen", strlen_ftype,
- BUILT_IN_STRLEN, "strlen");
- builtin_function ("__builtin_sqrtf", float_ftype_float,
- BUILT_IN_FSQRT, "sqrtf");
- builtin_function ("__builtin_fsqrt", double_ftype_double,
- BUILT_IN_FSQRT, NULL_PTR);
- builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble,
- BUILT_IN_FSQRT, "sqrtl");
- builtin_function ("__builtin_sinf", float_ftype_float,
- BUILT_IN_SIN, "sinf");
- builtin_function ("__builtin_sin", double_ftype_double,
- BUILT_IN_SIN, "sin");
- builtin_function ("__builtin_sinl", ldouble_ftype_ldouble,
- BUILT_IN_SIN, "sinl");
- builtin_function ("__builtin_cosf", float_ftype_float,
- BUILT_IN_COS, "cosf");
- builtin_function ("__builtin_cos", double_ftype_double,
- BUILT_IN_COS, "cos");
- builtin_function ("__builtin_cosl", ldouble_ftype_ldouble,
- BUILT_IN_COS, "cosl");
-
- if (!flag_no_builtin)
- {
-#if 0 /* These do not work well with libg++. */
- builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
- builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR);
- builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR);
-#endif
- builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR);
- builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
- NULL_PTR);
- builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, NULL_PTR);
- builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP,
- NULL_PTR);
- builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP,
- NULL_PTR);
- builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY,
- NULL_PTR);
- builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, NULL_PTR);
- builtin_function ("sqrtf", float_ftype_float, BUILT_IN_FSQRT, NULL_PTR);
- builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, NULL_PTR);
- builtin_function ("sqrtl", ldouble_ftype_ldouble, BUILT_IN_FSQRT,
- NULL_PTR);
- builtin_function ("sinf", float_ftype_float, BUILT_IN_SIN, NULL_PTR);
- builtin_function ("sin", double_ftype_double, BUILT_IN_SIN, NULL_PTR);
- builtin_function ("sinl", ldouble_ftype_ldouble, BUILT_IN_SIN, NULL_PTR);
- builtin_function ("cosf", float_ftype_float, BUILT_IN_COS, NULL_PTR);
- builtin_function ("cos", double_ftype_double, BUILT_IN_COS, NULL_PTR);
- builtin_function ("cosl", ldouble_ftype_ldouble, BUILT_IN_COS, NULL_PTR);
-
- /* Declare these functions volatile
- to avoid spurious "control drops through" warnings. */
- temp = builtin_function ("abort", void_ftype,
- NOT_BUILT_IN, NULL_PTR);
- TREE_THIS_VOLATILE (temp) = 1;
- TREE_SIDE_EFFECTS (temp) = 1;
- /* Well, these are actually ANSI, but we can't set DECL_BUILT_IN on
- them... */
- DECL_BUILT_IN_NONANSI (temp) = 1;
- temp = builtin_function ("exit", void_ftype_int,
- NOT_BUILT_IN, NULL_PTR);
- TREE_THIS_VOLATILE (temp) = 1;
- TREE_SIDE_EFFECTS (temp) = 1;
- DECL_BUILT_IN_NONANSI (temp) = 1;
- }
-
-#if 0
- /* Support for these has not been written in either expand_builtin
- or build_function_call. */
- builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, NULL_PTR);
- builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, NULL_PTR);
- builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR,
- NULL_PTR);
- builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL,
- NULL_PTR);
- builtin_function ("__builtin_fmod", double_ftype_double_double,
- BUILT_IN_FMOD, NULL_PTR);
- builtin_function ("__builtin_frem", double_ftype_double_double,
- BUILT_IN_FREM, NULL_PTR);
- builtin_function ("__builtin_memset", ptr_ftype_ptr_int_int,
- BUILT_IN_MEMSET, NULL_PTR);
- builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP,
- NULL_PTR);
- builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN,
- NULL_PTR);
-#endif
-
- /* C++ extensions */
-
- unknown_type_node = make_node (UNKNOWN_TYPE);
- decl = pushdecl (build_decl (TYPE_DECL, get_identifier ("unknown type"),
- unknown_type_node));
- /* Make sure the "unknown type" typedecl gets ignored for debug info. */
- DECL_IGNORED_P (decl) = 1;
- TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
- TYPE_SIZE (unknown_type_node) = TYPE_SIZE (void_type_node);
- TYPE_ALIGN (unknown_type_node) = 1;
- TYPE_MODE (unknown_type_node) = TYPE_MODE (void_type_node);
- /* Indirecting an UNKNOWN_TYPE node yields an UNKNOWN_TYPE node. */
- TREE_TYPE (unknown_type_node) = unknown_type_node;
- /* Looking up TYPE_POINTER_TO and TYPE_REFERENCE_TO yield the same result. */
- TYPE_POINTER_TO (unknown_type_node) = unknown_type_node;
- TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node;
-
- /* This is for handling opaque types in signatures. */
- opaque_type_node = copy_node (ptr_type_node);
- TYPE_MAIN_VARIANT (opaque_type_node) = opaque_type_node;
- record_builtin_type (RID_MAX, 0, opaque_type_node);
-
- /* This is special for C++ so functions can be overloaded. */
- wchar_type_node
- = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WCHAR_TYPE)));
- wchar_type_size = TYPE_PRECISION (wchar_type_node);
- signed_wchar_type_node = make_signed_type (wchar_type_size);
- unsigned_wchar_type_node = make_unsigned_type (wchar_type_size);
- wchar_type_node
- = TREE_UNSIGNED (wchar_type_node)
- ? unsigned_wchar_type_node
- : signed_wchar_type_node;
- record_builtin_type (RID_WCHAR, "__wchar_t", wchar_type_node);
-
- /* Artificial declaration of wchar_t -- can be bashed */
- wchar_decl_node = build_decl (TYPE_DECL, get_identifier ("wchar_t"),
- wchar_type_node);
- pushdecl (wchar_decl_node);
-
- /* This is for wide string constants. */
- wchar_array_type_node
- = build_array_type (wchar_type_node, array_domain_type);
-
- if (flag_vtable_thunks)
- {
- /* Make sure we get a unique function type, so we can give
- its pointer type a name. (This wins for gdb.) */
- tree vfunc_type = make_node (FUNCTION_TYPE);
- TREE_TYPE (vfunc_type) = integer_type_node;
- TYPE_ARG_TYPES (vfunc_type) = NULL_TREE;
- layout_type (vfunc_type);
-
- vtable_entry_type = build_pointer_type (vfunc_type);
- }
- else
- {
- vtable_entry_type = make_lang_type (RECORD_TYPE);
- fields[0] = build_lang_field_decl (FIELD_DECL, delta_identifier,
- delta_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL, index_identifier,
- delta_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, pfn_identifier,
- ptr_type_node);
- finish_builtin_type (vtable_entry_type, VTBL_PTR_TYPE, fields, 2,
- double_type_node);
-
- /* Make this part of an invisible union. */
- fields[3] = copy_node (fields[2]);
- TREE_TYPE (fields[3]) = delta_type_node;
- DECL_NAME (fields[3]) = delta2_identifier;
- DECL_MODE (fields[3]) = TYPE_MODE (delta_type_node);
- DECL_SIZE (fields[3]) = TYPE_SIZE (delta_type_node);
- TREE_UNSIGNED (fields[3]) = 0;
- TREE_CHAIN (fields[2]) = fields[3];
- vtable_entry_type = build_type_variant (vtable_entry_type, 1, 0);
- }
- record_builtin_type (RID_MAX, VTBL_PTR_TYPE, vtable_entry_type);
-
- vtbl_type_node
- = build_array_type (vtable_entry_type, NULL_TREE);
- layout_type (vtbl_type_node);
- vtbl_type_node = cp_build_type_variant (vtbl_type_node, 1, 0);
- record_builtin_type (RID_MAX, NULL_PTR, vtbl_type_node);
-
- /* Simplify life by making a "sigtable_entry_type". Give its
- fields names so that the debugger can use them. */
-
- if (flag_handle_signatures)
- {
- sigtable_entry_type = make_lang_type (RECORD_TYPE);
- fields[0] = build_lang_field_decl (FIELD_DECL, tag_identifier,
- delta_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL, vb_off_identifier,
- delta_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, delta_identifier,
- delta_type_node);
- fields[3] = build_lang_field_decl (FIELD_DECL, index_identifier,
- delta_type_node);
- fields[4] = build_lang_field_decl (FIELD_DECL, pfn_identifier,
- ptr_type_node);
-
- /* Set the alignment to the max of the alignment of ptr_type_node and
- delta_type_node. Double alignment wastes a word on the Sparc. */
- finish_builtin_type (sigtable_entry_type, SIGTABLE_PTR_TYPE, fields, 4,
- (TYPE_ALIGN (ptr_type_node) > TYPE_ALIGN (delta_type_node))
- ? ptr_type_node
- : delta_type_node);
-
- /* Make this part of an invisible union. */
- fields[5] = copy_node (fields[4]);
- TREE_TYPE (fields[5]) = delta_type_node;
- DECL_NAME (fields[5]) = vt_off_identifier;
- DECL_MODE (fields[5]) = TYPE_MODE (delta_type_node);
- DECL_SIZE (fields[5]) = TYPE_SIZE (delta_type_node);
- TREE_UNSIGNED (fields[5]) = 0;
- TREE_CHAIN (fields[4]) = fields[5];
-
- sigtable_entry_type = build_type_variant (sigtable_entry_type, 1, 0);
- record_builtin_type (RID_MAX, SIGTABLE_PTR_TYPE, sigtable_entry_type);
- }
-
-#if 0
- if (flag_rtti)
- {
- /* Must build __t_desc type. Currently, type descriptors look like this:
-
- struct __t_desc
- {
- const char *name;
- int size;
- int bits;
- struct __t_desc *points_to;
- int ivars_count, meths_count;
- struct __i_desc *ivars[];
- struct __m_desc *meths[];
- struct __t_desc *parents[];
- struct __t_desc *vbases[];
- int offsets[];
- };
-
- ...as per Linton's paper. */
-
- __t_desc_type_node = make_lang_type (RECORD_TYPE);
- __i_desc_type_node = make_lang_type (RECORD_TYPE);
- __m_desc_type_node = make_lang_type (RECORD_TYPE);
- __t_desc_array_type =
- build_array_type (build_pointer_type (__t_desc_type_node), NULL_TREE);
- __i_desc_array_type =
- build_array_type (build_pointer_type (__i_desc_type_node), NULL_TREE);
- __m_desc_array_type =
- build_array_type (build_pointer_type (__m_desc_type_node), NULL_TREE);
-
- fields[0] = build_lang_field_decl (FIELD_DECL, get_identifier ("name"),
- string_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL, get_identifier ("size"),
- unsigned_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, get_identifier ("bits"),
- unsigned_type_node);
- fields[3] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("points_to"),
- build_pointer_type (__t_desc_type_node));
- fields[4] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("ivars_count"),
- integer_type_node);
- fields[5] = build_lang_field_decl (FIELD_DECL,
- get_identifier ("meths_count"),
- integer_type_node);
- fields[6] = build_lang_field_decl (FIELD_DECL, get_identifier ("ivars"),
- build_pointer_type (__i_desc_array_type));
- fields[7] = build_lang_field_decl (FIELD_DECL, get_identifier ("meths"),
- build_pointer_type (__m_desc_array_type));
- fields[8] = build_lang_field_decl (FIELD_DECL, get_identifier ("parents"),
- build_pointer_type (__t_desc_array_type));
- fields[9] = build_lang_field_decl (FIELD_DECL, get_identifier ("vbases"),
- build_pointer_type (__t_desc_array_type));
- fields[10] = build_lang_field_decl (FIELD_DECL, get_identifier ("offsets"),
- build_pointer_type (integer_type_node));
- finish_builtin_type (__t_desc_type_node, "__t_desc", fields, 10, integer_type_node);
-
- /* ivar descriptors look like this:
-
- struct __i_desc
- {
- const char *name;
- int offset;
- struct __t_desc *type;
- };
- */
-
- fields[0] = build_lang_field_decl (FIELD_DECL, get_identifier ("name"),
- string_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL, get_identifier ("offset"),
- integer_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, get_identifier ("type"),
- build_pointer_type (__t_desc_type_node));
- finish_builtin_type (__i_desc_type_node, "__i_desc", fields, 2,
- integer_type_node);
-
- /* method descriptors look like this:
-
- struct __m_desc
- {
- const char *name;
- int vindex;
- struct __t_desc *vcontext;
- struct __t_desc *return_type;
- void (*address)();
- short parm_count;
- short required_parms;
- struct __t_desc *parm_types[];
- };
- */
-
- fields[0] = build_lang_field_decl (FIELD_DECL, get_identifier ("name"),
- string_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL, get_identifier ("vindex"),
- integer_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, get_identifier ("vcontext"),
- build_pointer_type (__t_desc_type_node));
- fields[3] = build_lang_field_decl (FIELD_DECL, get_identifier ("return_type"),
- build_pointer_type (__t_desc_type_node));
- fields[4] = build_lang_field_decl (FIELD_DECL, get_identifier ("address"),
- build_pointer_type (default_function_type));
- fields[5] = build_lang_field_decl (FIELD_DECL, get_identifier ("parm_count"),
- short_integer_type_node);
- fields[6] = build_lang_field_decl (FIELD_DECL, get_identifier ("required_parms"),
- short_integer_type_node);
- fields[7] = build_lang_field_decl (FIELD_DECL, get_identifier ("parm_types"),
- build_pointer_type (build_array_type (build_pointer_type (__t_desc_type_node), NULL_TREE)));
- finish_builtin_type (__m_desc_type_node, "__m_desc", fields, 7,
- integer_type_node);
- }
-#endif /*flag_rtti*/
-
- /* Now, C++. */
- current_lang_name = lang_name_cplusplus;
-
- auto_function (ansi_opname[(int) NEW_EXPR], ptr_ftype_sizetype,
- NOT_BUILT_IN);
- auto_function (ansi_opname[(int) VEC_NEW_EXPR], ptr_ftype_sizetype,
- NOT_BUILT_IN);
- auto_function (ansi_opname[(int) DELETE_EXPR], void_ftype_ptr,
- NOT_BUILT_IN);
- auto_function (ansi_opname[(int) VEC_DELETE_EXPR], void_ftype_ptr,
- NOT_BUILT_IN);
-
- abort_fndecl
- = define_function ("__pure_virtual", void_ftype,
- NOT_BUILT_IN, 0, 0);
-
- /* Perform other language dependent initializations. */
- init_class_processing ();
- init_init_processing ();
- init_search_processing ();
- init_rtti_processing ();
-
- if (flag_exceptions)
- init_exception_processing ();
- if (flag_no_inline)
- {
- flag_inline_functions = 0;
- }
-
- if (! supports_one_only ())
- flag_weak = 0;
-
- /* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */
- declare_function_name ();
-
- /* Prepare to check format strings against argument lists. */
- init_function_format_info ();
-}
-
-/* initialize type descriptor type node of various rtti type. */
-
-int
-init_type_desc()
-{
- tree tdecl;
-
- tdecl = lookup_name (get_identifier ("type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __t_desc_type_node = TREE_TYPE (tdecl);
-#if 0
- __tp_desc_type_node = build_pointer_type (__t_desc_type_node);
-#endif
-
-#if 0
- tdecl = lookup_name (get_identifier ("__baselist_type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __baselist_desc_type_node = TREE_TYPE (tdecl);
-#endif
-
- tdecl = lookup_name (get_identifier ("__builtin_type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __bltn_desc_type_node = TREE_TYPE (tdecl);
-
- tdecl = lookup_name (get_identifier ("__user_type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __user_desc_type_node = TREE_TYPE (tdecl);
-
- tdecl = lookup_name (get_identifier ("__class_type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __class_desc_type_node = TREE_TYPE (tdecl);
-
- tdecl = lookup_field (__class_desc_type_node,
- get_identifier ("access_mode"), 0, 0);
- if (tdecl == NULL_TREE)
- return 0;
- __access_mode_type_node = TREE_TYPE (tdecl);
-
- tdecl = lookup_name (get_identifier ("__attr_type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __attr_desc_type_node = TREE_TYPE (tdecl);
-
- tdecl = lookup_name (get_identifier ("__pointer_type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __ptr_desc_type_node = TREE_TYPE (tdecl);
-
- tdecl = lookup_name (get_identifier ("__func_type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __func_desc_type_node = TREE_TYPE (tdecl);
-
- tdecl = lookup_name (get_identifier ("__ptmf_type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __ptmf_desc_type_node = TREE_TYPE (tdecl);
-
- tdecl = lookup_name (get_identifier ("__ptmd_type_info"), 0);
- if (tdecl == NULL_TREE)
- return 0;
- __ptmd_desc_type_node = TREE_TYPE (tdecl);
-
- return 1;
-}
-/* Make a definition for a builtin function named NAME and whose data type
- is TYPE. TYPE should be a function type with argument types.
- FUNCTION_CODE tells later passes how to compile calls to this function.
- See tree.h for its possible values.
-
- If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
- the name to be called if we can't opencode the function. */
-
-tree
-define_function (name, type, function_code, pfn, library_name)
- char *name;
- tree type;
- enum built_in_function function_code;
- void (*pfn)();
- char *library_name;
-{
- tree decl = build_lang_decl (FUNCTION_DECL, get_identifier (name), type);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
-
- /* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME,
- we cannot change DECL_ASSEMBLER_NAME until we have installed this
- function in the namespace. */
- if (pfn) (*pfn) (decl);
- if (library_name)
- DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
- make_function_rtl (decl);
- if (function_code != NOT_BUILT_IN)
- {
- DECL_BUILT_IN (decl) = 1;
- DECL_FUNCTION_CODE (decl) = 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
- from a containing scope, shadow that tag name for the current scope
- with a forward reference.
- If its type defines a new named structure or union
- or defines an enum, it is valid but we need not do anything here.
- Otherwise, it is an error.
-
- C++: may have to grok the declspecs to learn about static,
- complain for anonymous unions. */
-
-void
-shadow_tag (declspecs)
- tree declspecs;
-{
- int found_tag = 0;
- tree ob_modifier = NULL_TREE;
- register tree link;
- register enum tree_code code, ok_code = ERROR_MARK;
- register tree t = NULL_TREE;
-
- for (link = declspecs; link; link = TREE_CHAIN (link))
- {
- register tree value = TREE_VALUE (link);
-
- code = TREE_CODE (value);
- if (IS_AGGR_TYPE_CODE (code) || code == ENUMERAL_TYPE)
- {
- my_friendly_assert (TYPE_MAIN_DECL (value) != NULL_TREE, 261);
-
- if (IS_AGGR_TYPE (value) && CLASSTYPE_USE_TEMPLATE (value))
- {
- if (CLASSTYPE_IMPLICIT_INSTANTIATION (value)
- && TYPE_SIZE (value) == NULL_TREE)
- {
- SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (value);
- if (processing_template_decl)
- push_template_decl (TYPE_MAIN_DECL (value));
- }
- else if (CLASSTYPE_TEMPLATE_INSTANTIATION (value))
- cp_error ("specialization after instantiation of `%T'", value);
- }
-
- t = value;
- ok_code = code;
- found_tag++;
- }
- else if (value == ridpointers[(int) RID_STATIC]
- || value == ridpointers[(int) RID_EXTERN]
- || value == ridpointers[(int) RID_AUTO]
- || value == ridpointers[(int) RID_REGISTER]
- || value == ridpointers[(int) RID_INLINE]
- || value == ridpointers[(int) RID_VIRTUAL]
- || value == ridpointers[(int) RID_EXPLICIT])
- ob_modifier = value;
- }
-
- /* This is where the variables in an anonymous union are
- declared. An anonymous union declaration looks like:
- union { ... } ;
- because there is no declarator after the union, the parser
- sends that declaration here. */
- if (ok_code == UNION_TYPE
- && t != NULL_TREE
- && ((TREE_CODE (TYPE_NAME (t)) == IDENTIFIER_NODE
- && ANON_AGGRNAME_P (TYPE_NAME (t)))
- || (TREE_CODE (TYPE_NAME (t)) == TYPE_DECL
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))))
- {
- /* See also grok_x_components. */
- tree *q;
-
- /* Wipe out memory of synthesized methods */
- TYPE_HAS_CONSTRUCTOR (t) = 0;
- TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 0;
- TYPE_HAS_INIT_REF (t) = 0;
- TYPE_HAS_CONST_INIT_REF (t) = 0;
- TYPE_HAS_ASSIGN_REF (t) = 0;
- TYPE_HAS_ASSIGNMENT (t) = 0;
- TYPE_HAS_CONST_ASSIGN_REF (t) = 0;
-
- q = &TYPE_METHODS (t);
- while (*q)
- {
- if (DECL_ARTIFICIAL (*q))
- *q = TREE_CHAIN (*q);
- else
- q = &TREE_CHAIN (*q);
- }
-
- /* ANSI C++ June 5 1992 WP 9.5.3. Anonymous unions may not have
- function members. */
- if (TYPE_METHODS (t))
- error ("an anonymous union cannot have function members");
-
- if (TYPE_FIELDS (t))
- {
- tree decl = grokdeclarator (NULL_TREE, declspecs, NORMAL, 0,
- NULL_TREE);
- finish_anon_union (decl);
- }
- }
- else
- {
- /* Anonymous unions are objects, that's why we only check for
- inappropriate specifiers in this branch. */
-
- if (ob_modifier)
- {
- if (ob_modifier == ridpointers[(int) RID_INLINE]
- || ob_modifier == ridpointers[(int) RID_VIRTUAL])
- cp_error ("`%D' can only be specified for functions", ob_modifier);
- else if (ob_modifier == ridpointers[(int) RID_EXPLICIT])
- cp_error ("`%D' can only be specified for constructors",
- ob_modifier);
- else
- cp_error ("`%D' can only be specified for objects and functions",
- ob_modifier);
- }
-
- if (found_tag == 0)
- pedwarn ("abstract declarator used as declaration");
- else if (found_tag > 1)
- pedwarn ("multiple types in one declaration");
- }
-}
-
-/* Decode a "typename", such as "int **", returning a ..._TYPE node. */
-
-tree
-groktypename (typename)
- tree typename;
-{
- if (TREE_CODE (typename) != TREE_LIST)
- return typename;
- return grokdeclarator (TREE_VALUE (typename),
- TREE_PURPOSE (typename),
- TYPENAME, 0, NULL_TREE);
-}
-
-/* Decode a declarator in an ordinary declaration or data definition.
- This is called as soon as the type information and variable name
- have been parsed, before parsing the initializer if any.
- Here we create the ..._DECL node, fill in its type,
- and put it on the list of decls for the current context.
- The ..._DECL node is returned as the value.
-
- Exception: for arrays where the length is not specified,
- the type is left null, to be filled in by `cp_finish_decl'.
-
- Function definitions do not come here; they go to start_function
- instead. However, external and forward declarations of functions
- do go through here. Structure field declarations are done by
- grokfield and not through here. */
-
-/* Set this to zero to debug not using the temporary obstack
- to parse initializers. */
-int debug_temp_inits = 1;
-
-tree
-start_decl (declarator, declspecs, initialized)
- tree declarator, declspecs;
- int initialized;
-{
- register tree decl;
- register tree type, tem;
- tree context;
- extern int have_extern_spec;
- extern int used_extern_spec;
-
-#if 0
- /* See code below that used this. */
- int init_written = initialized;
-#endif
-
- /* This should only be done once on the top most decl. */
- if (have_extern_spec && !used_extern_spec)
- {
- declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"),
- declspecs);
- used_extern_spec = 1;
- }
-
- decl = grokdeclarator (declarator, declspecs, NORMAL, initialized,
- NULL_TREE);
- if (decl == NULL_TREE || decl == void_type_node)
- return NULL_TREE;
-
- type = TREE_TYPE (decl);
-
- /* Don't lose if destructors must be executed at file-level. */
- if (! processing_template_decl && TREE_STATIC (decl)
- && TYPE_NEEDS_DESTRUCTOR (complete_type (type))
- && !TREE_PERMANENT (decl))
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- decl = copy_node (decl);
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- tree itype = TYPE_DOMAIN (type);
- if (itype && ! TREE_PERMANENT (itype))
- {
- itype = build_index_type (copy_to_permanent (TYPE_MAX_VALUE (itype)));
- type = build_cplus_array_type (TREE_TYPE (type), itype);
- TREE_TYPE (decl) = type;
- }
- }
- pop_obstacks ();
- }
-
- context
- = (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
- ? DECL_CLASS_CONTEXT (decl)
- : DECL_CONTEXT (decl);
-
- if (initialized)
- /* Is it valid for this decl to have an initializer at all?
- If not, set INITIALIZED to zero, which will indirectly
- tell `cp_finish_decl' to ignore the initializer once it is parsed. */
- switch (TREE_CODE (decl))
- {
- case TYPE_DECL:
- /* typedef foo = bar means give foo the same type as bar.
- We haven't parsed bar yet, so `cp_finish_decl' will fix that up.
- Any other case of an initialization in a TYPE_DECL is an error. */
- if (pedantic || list_length (declspecs) > 1)
- {
- cp_error ("typedef `%D' is initialized", decl);
- initialized = 0;
- }
- break;
-
- case FUNCTION_DECL:
- cp_error ("function `%#D' is initialized like a variable", decl);
- initialized = 0;
- break;
-
- default:
- if (! processing_template_decl)
- {
- if (type != error_mark_node)
- {
- if (TYPE_SIZE (type) != NULL_TREE
- && ! TREE_CONSTANT (TYPE_SIZE (type)))
- {
- cp_error
- ("variable-sized object `%D' may not be initialized",
- decl);
- initialized = 0;
- }
-
- if (TREE_CODE (type) == ARRAY_TYPE
- && TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE)
- {
- cp_error
- ("elements of array `%#D' have incomplete type", decl);
- initialized = 0;
- }
- }
- }
- }
-
- if (initialized)
- {
- if (! toplevel_bindings_p ()
- && DECL_EXTERNAL (decl))
- cp_warning ("declaration of `%#D' has `extern' and is initialized",
- decl);
- DECL_EXTERNAL (decl) = 0;
- if (toplevel_bindings_p ())
- TREE_STATIC (decl) = 1;
-
- /* Tell `pushdecl' this is an initialized decl
- even though we don't yet have the initializer expression.
- Also tell `cp_finish_decl' it may store the real initializer. */
- DECL_INITIAL (decl) = error_mark_node;
- }
-
- if (context && TYPE_SIZE (complete_type (context)) != NULL_TREE)
- {
- if (TREE_CODE (decl) == VAR_DECL)
- {
- tree field = lookup_field (context, DECL_NAME (decl), 0, 0);
- if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL)
- cp_error ("`%#D' is not a static member of `%#T'", decl, context);
- else
- {
- if (DECL_CONTEXT (field) != context)
- cp_pedwarn ("ANSI C++ does not permit `%T::%D' to be defined as `%T::%D'", DECL_CONTEXT (field), DECL_NAME (decl), context, DECL_NAME (decl));
- if (duplicate_decls (decl, field))
- decl = field;
- }
- }
- else
- {
- tree field = check_classfn (context, decl);
- if (field && duplicate_decls (decl, field))
- decl = field;
- }
-
- /* cp_finish_decl sets DECL_EXTERNAL if DECL_IN_AGGR_P is set. */
- if (DECL_LANG_SPECIFIC (decl))
- DECL_IN_AGGR_P (decl) = 0;
- if (DECL_USE_TEMPLATE (decl) || CLASSTYPE_USE_TEMPLATE (context))
- SET_DECL_TEMPLATE_SPECIALIZATION (decl);
-
- /* Stupid stupid stupid stupid (jason 7/21/95) */
- if (pedantic && DECL_EXTERNAL (decl)
- && ! DECL_TEMPLATE_SPECIALIZATION (decl))
- cp_pedwarn ("declaration of `%#D' outside of class is not definition",
- decl);
-
- pushclass (context, 2);
- }
-
- /* Add this decl to the current binding level, but not if it
- comes from another scope, e.g. a static member variable.
- TEM may equal DECL or it may be a previous decl of the same name. */
-
- if ((TREE_CODE (decl) != PARM_DECL && DECL_CONTEXT (decl) != NULL_TREE)
- || (TREE_CODE (decl) == TEMPLATE_DECL && !global_bindings_p ())
- || TREE_CODE (type) == LANG_TYPE)
- tem = decl;
- else
- tem = pushdecl (decl);
-
- if (processing_template_decl)
- {
- if (! current_function_decl)
- push_template_decl (tem);
- else if (minimal_parse_mode)
- DECL_VINDEX (decl)
- = build_min_nt (DECL_STMT, copy_to_permanent (declarator),
- copy_to_permanent (declspecs),
- NULL_TREE);
- }
-
-
-#if ! defined (ASM_OUTPUT_BSS) && ! defined (ASM_OUTPUT_ALIGNED_BSS)
- /* Tell the back-end to use or not use .common as appropriate. If we say
- -fconserve-space, we want this to save .data space, at the expense of
- wrong semantics. If we say -fno-conserve-space, we want this to
- produce errors about redefs; to do this we force variables into the
- data segment. */
- DECL_COMMON (tem) = flag_conserve_space || ! TREE_PUBLIC (tem);
-#endif
-
- if (! processing_template_decl)
- start_decl_1 (tem);
-
- /* Corresponding pop_obstacks is done in `cp_finish_decl'. */
- push_obstacks_nochange ();
-
-#if 0
- /* We have no way of knowing whether the initializer will need to be
- evaluated at run-time or not until we've parsed it, so let's just put
- it in the permanent obstack. (jason) */
- if (init_written
- && ! (TREE_CODE (tem) == PARM_DECL
- || (TREE_READONLY (tem)
- && (TREE_CODE (tem) == VAR_DECL
- || TREE_CODE (tem) == FIELD_DECL))))
- {
- /* When parsing and digesting the initializer,
- use temporary storage. Do this even if we will ignore the value. */
- if (toplevel_bindings_p () && debug_temp_inits)
- {
- if (processing_template_decl
- || TYPE_NEEDS_CONSTRUCTING (type)
- || TREE_CODE (type) == REFERENCE_TYPE)
- /* In this case, the initializer must lay down in permanent
- storage, since it will be saved until `finish_file' is run. */
- ;
- else
- temporary_allocation ();
- }
- }
-#endif
-
- return tem;
-}
-
-void
-start_decl_1 (decl)
- tree decl;
-{
- tree type = TREE_TYPE (decl);
- int initialized = (DECL_INITIAL (decl) != NULL_TREE);
-
- /* If this type of object needs a cleanup, and control may
- jump past it, make a new binding level so that it is cleaned
- up only when it is initialized first. */
- if (TYPE_NEEDS_DESTRUCTOR (type)
- && current_binding_level->more_cleanups_ok == 0)
- pushlevel_temporary (1);
-
- if (initialized)
- /* Is it valid for this decl to have an initializer at all?
- If not, set INITIALIZED to zero, which will indirectly
- tell `cp_finish_decl' to ignore the initializer once it is parsed. */
- {
- /* Don't allow initializations for incomplete types except for
- arrays which might be completed by the initialization. */
- if (type == error_mark_node)
- ; /* Don't complain again. */
- else if (TYPE_SIZE (complete_type (type)) != NULL_TREE)
- ; /* A complete type is ok. */
- else if (TREE_CODE (type) != ARRAY_TYPE)
- {
- cp_error ("variable `%#D' has initializer but incomplete type",
- decl);
- initialized = 0;
- }
- else if (TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE)
- {
- if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl))
- cp_error ("elements of array `%#D' have incomplete type", decl);
- /* else we already gave an error in start_decl. */
- initialized = 0;
- }
- }
-
- if (!initialized
- && TREE_CODE (decl) != TYPE_DECL
- && TREE_CODE (decl) != TEMPLATE_DECL
- && IS_AGGR_TYPE (type) && ! DECL_EXTERNAL (decl))
- {
- if ((! processing_template_decl || ! uses_template_parms (type))
- && TYPE_SIZE (complete_type (type)) == NULL_TREE)
- {
- cp_error ("aggregate `%#D' has incomplete type and cannot be initialized",
- decl);
- /* Change the type so that assemble_variable will give
- DECL an rtl we can live with: (mem (const_int 0)). */
- TREE_TYPE (decl) = error_mark_node;
- type = error_mark_node;
- }
- else
- {
- /* If any base type in the hierarchy of TYPE needs a constructor,
- then we set initialized to 1. This way any nodes which are
- created for the purposes of initializing this aggregate
- will live as long as it does. This is necessary for global
- aggregates which do not have their initializers processed until
- the end of the file. */
- initialized = TYPE_NEEDS_CONSTRUCTING (type);
- }
- }
-
-#if 0
- /* We don't do this yet for GNU C++. */
- /* For a local variable, define the RTL now. */
- if (! toplevel_bindings_p ()
- /* But not if this is a duplicate decl
- and we preserved the rtl from the previous one
- (which may or may not happen). */
- && DECL_RTL (tem) == NULL_RTX)
- {
- if (TYPE_SIZE (TREE_TYPE (tem)) != NULL_TREE)
- expand_decl (tem);
- else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE
- && DECL_INITIAL (tem) != NULL_TREE)
- expand_decl (tem);
- }
-#endif
-
- if (! initialized)
- DECL_INITIAL (decl) = NULL_TREE;
-}
-
-/* Handle initialization of references.
- These three arguments from from `cp_finish_decl', and have the
- same meaning here that they do there.
-
- Quotes on semantics can be found in ARM 8.4.3. */
-
-static void
-grok_reference_init (decl, type, init, cleanupp)
- tree decl, type, init;
- tree *cleanupp;
-{
- tree tmp;
-
- if (init == NULL_TREE)
- {
- if ((DECL_LANG_SPECIFIC (decl) == 0
- || DECL_IN_AGGR_P (decl) == 0)
- && ! DECL_THIS_EXTERN (decl))
- {
- cp_error ("`%D' declared as reference but not initialized", decl);
- if (TREE_CODE (decl) == VAR_DECL)
- SET_DECL_REFERENCE_SLOT (decl, error_mark_node);
- }
- return;
- }
-
- if (init == error_mark_node)
- return;
-
- if (TREE_CODE (type) == REFERENCE_TYPE
- && TREE_CODE (init) == CONSTRUCTOR)
- {
- cp_error ("ANSI C++ forbids use of initializer list to initialize reference `%D'", decl);
- return;
- }
-
- if (TREE_TYPE (init) && TREE_CODE (TREE_TYPE (init)) == UNKNOWN_TYPE)
- /* decay_conversion is probably wrong for references to functions. */
- init = decay_conversion (instantiate_type (TREE_TYPE (type), init, 1));
-
- if (TREE_CODE (init) == TREE_LIST)
- init = build_compound_expr (init);
-
- if (TREE_CODE (TREE_TYPE (init)) == REFERENCE_TYPE)
- init = convert_from_reference (init);
-
- if (TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (init)) == ARRAY_TYPE)
- {
- /* Note: default conversion is only called in very special cases. */
- init = default_conversion (init);
- }
-
- tmp = convert_to_reference
- (type, init, CONV_IMPLICIT,
- LOOKUP_SPECULATIVELY|LOOKUP_NORMAL|DIRECT_BIND, decl);
-
- if (tmp == error_mark_node)
- goto fail;
- else if (tmp != NULL_TREE)
- {
- init = tmp;
- DECL_INITIAL (decl) = save_expr (init);
- }
- else
- {
- cp_error ("cannot initialize `%T' from `%T'", type, TREE_TYPE (init));
- goto fail;
- }
-
- /* ?? Can this be optimized in some cases to
- hand back the DECL_INITIAL slot?? */
- if (TYPE_SIZE (TREE_TYPE (type)))
- {
- init = convert_from_reference (decl);
- if (TREE_PERMANENT (decl))
- init = copy_to_permanent (init);
- SET_DECL_REFERENCE_SLOT (decl, init);
- }
-
- if (TREE_STATIC (decl) && ! TREE_CONSTANT (DECL_INITIAL (decl)))
- {
- expand_static_init (decl, DECL_INITIAL (decl));
- DECL_INITIAL (decl) = NULL_TREE;
- }
- return;
-
- fail:
- if (TREE_CODE (decl) == VAR_DECL)
- SET_DECL_REFERENCE_SLOT (decl, error_mark_node);
- return;
-}
-
-/* Fill in DECL_INITIAL with some magical value to prevent expand_decl from
- mucking with forces it does not comprehend (i.e. initialization with a
- constructor). If we are at global scope and won't go into COMMON, fill
- it in with a dummy CONSTRUCTOR to force the variable into .data;
- otherwise we can use error_mark_node. */
-
-static tree
-obscure_complex_init (decl, init)
- tree decl, init;
-{
- if (! flag_no_inline && TREE_STATIC (decl))
- {
- if (extract_init (decl, init))
- return NULL_TREE;
- }
-
-#if ! defined (ASM_OUTPUT_BSS) && ! defined (ASM_OUTPUT_ALIGNED_BSS)
- if (toplevel_bindings_p () && ! DECL_COMMON (decl))
- DECL_INITIAL (decl) = build (CONSTRUCTOR, TREE_TYPE (decl), NULL_TREE,
- NULL_TREE);
- else
-#endif
- DECL_INITIAL (decl) = error_mark_node;
-
- return init;
-}
-
-/* Finish processing of a declaration;
- install its line number and initial value.
- If the length of an array type is not known before,
- it must be determined now, from the initial value, or it is an error.
-
- Call `pop_obstacks' iff NEED_POP is nonzero.
-
- For C++, `cp_finish_decl' must be fairly evasive: it must keep initializers
- for aggregates that have constructors alive on the permanent obstack,
- so that the global initializing functions can be written at the end.
-
- INIT0 holds the value of an initializer that should be allowed to escape
- the normal rules.
-
- FLAGS is LOOKUP_ONLYCONVERTING is the = init syntax was used, else 0
- if the (init) syntax was used.
-
- For functions that take default parameters, DECL points to its
- "maximal" instantiation. `cp_finish_decl' must then also declared its
- subsequently lower and lower forms of instantiation, checking for
- ambiguity as it goes. This can be sped up later. */
-
-void
-cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
- tree decl, init;
- tree asmspec_tree;
- int need_pop;
- int flags;
-{
- register tree type;
- tree cleanup = NULL_TREE, ttype;
- int was_incomplete;
- int temporary = allocation_temporary_p ();
- char *asmspec = NULL;
- int was_readonly = 0;
-
- /* If this is 0, then we did not change obstacks. */
- if (! decl)
- {
- if (init)
- error ("assignment (not initialization) in declaration");
- return;
- }
-
- /* If a name was specified, get the string. */
- if (asmspec_tree)
- asmspec = TREE_STRING_POINTER (asmspec_tree);
-
- /* If the type of the thing we are declaring either has
- a constructor, or has a virtual function table pointer,
- AND its initialization was accepted by `start_decl',
- then we stayed on the permanent obstack through the
- declaration, otherwise, changed obstacks as GCC would. */
-
- type = TREE_TYPE (decl);
-
- if (type == error_mark_node)
- {
- if (toplevel_bindings_p () && temporary)
- end_temporary_allocation ();
-
- return;
- }
-
- if (processing_template_decl)
- {
- if (init && DECL_INITIAL (decl))
- DECL_INITIAL (decl) = init;
- if (minimal_parse_mode && ! DECL_ARTIFICIAL (decl))
- {
- tree stmt = DECL_VINDEX (decl);
- DECL_VINDEX (decl) = NULL_TREE;
- TREE_OPERAND (stmt, 2) = copy_to_permanent (init);
- add_tree (stmt);
- }
-
- goto finish_end0;
- }
- /* Take care of TYPE_DECLs up front. */
- if (TREE_CODE (decl) == TYPE_DECL)
- {
- if (init && DECL_INITIAL (decl))
- {
- /* typedef foo = bar; store the type of bar as the type of foo. */
- TREE_TYPE (decl) = type = TREE_TYPE (init);
- DECL_INITIAL (decl) = init = NULL_TREE;
- }
- if (type != error_mark_node
- && IS_AGGR_TYPE (type) && DECL_NAME (decl))
- {
- if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type)
- cp_warning ("shadowing previous type declaration of `%#D'", decl);
- set_identifier_type_value (DECL_NAME (decl), type);
- CLASSTYPE_GOT_SEMICOLON (type) = 1;
- }
- GNU_xref_decl (current_function_decl, decl);
-
- /* If we have installed this as the canonical typedef for this
- type, and that type has not been defined yet, delay emitting
- the debug informaion for it, as we will emit it later. */
- if (TYPE_MAIN_DECL (TREE_TYPE (decl)) == decl
- && TYPE_SIZE (TREE_TYPE (decl)) == NULL_TREE)
- TYPE_DECL_SUPPRESS_DEBUG (decl) = 1;
-
- rest_of_decl_compilation (decl, NULL_PTR,
- DECL_CONTEXT (decl) == NULL_TREE, at_eof);
- goto finish_end;
- }
- if (TREE_CODE (decl) != FUNCTION_DECL)
- {
- ttype = target_type (type);
- }
-
- if (! DECL_EXTERNAL (decl) && TREE_READONLY (decl)
- && TYPE_NEEDS_CONSTRUCTING (type))
- {
-
- /* Currently, GNU C++ puts constants in text space, making them
- impossible to initialize. In the future, one would hope for
- an operating system which understood the difference between
- initialization and the running of a program. */
- was_readonly = 1;
- TREE_READONLY (decl) = 0;
- }
-
- if (TREE_CODE (decl) == FIELD_DECL)
- {
- if (init && init != error_mark_node)
- my_friendly_assert (TREE_PERMANENT (init), 147);
-
- if (asmspec)
- {
- /* This must override the asm specifier which was placed
- by grokclassfn. Lay this out fresh. */
- DECL_RTL (TREE_TYPE (decl)) = NULL_RTX;
- DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec);
- make_decl_rtl (decl, asmspec, 0);
- }
- }
- /* If `start_decl' didn't like having an initialization, ignore it now. */
- else if (init != NULL_TREE && DECL_INITIAL (decl) == NULL_TREE)
- init = NULL_TREE;
- else if (DECL_EXTERNAL (decl))
- ;
- else if (TREE_CODE (type) == REFERENCE_TYPE
- || (TYPE_LANG_SPECIFIC (type) && IS_SIGNATURE_REFERENCE (type)))
- {
- if (TREE_STATIC (decl))
- make_decl_rtl (decl, NULL_PTR,
- toplevel_bindings_p ()
- || pseudo_global_level_p ());
- grok_reference_init (decl, type, init, &cleanup);
- init = NULL_TREE;
- }
-
- GNU_xref_decl (current_function_decl, decl);
-
- if (TREE_CODE (decl) == FIELD_DECL)
- ;
- else if (TREE_CODE (decl) == CONST_DECL)
- {
- my_friendly_assert (TREE_CODE (decl) != REFERENCE_TYPE, 148);
-
- DECL_INITIAL (decl) = init;
-
- /* This will keep us from needing to worry about our obstacks. */
- my_friendly_assert (init != NULL_TREE, 149);
- init = NULL_TREE;
- }
- else if (init)
- {
- if (TYPE_HAS_CONSTRUCTOR (type) || TYPE_NEEDS_CONSTRUCTING (type))
- {
- if (TREE_CODE (type) == ARRAY_TYPE)
- init = digest_init (type, init, (tree *) 0);
- else if (TREE_CODE (init) == CONSTRUCTOR)
- {
- if (TYPE_NON_AGGREGATE_CLASS (type))
- {
- cp_error ("`%D' must be initialized by constructor, not by `{...}'",
- decl);
- init = error_mark_node;
- }
- else
- goto dont_use_constructor;
- }
- }
- else
- {
- dont_use_constructor:
- if (TREE_CODE (init) != TREE_VEC)
- init = store_init_value (decl, init);
- }
-
- if (init)
- /* We must hide the initializer so that expand_decl
- won't try to do something it does not understand. */
- init = obscure_complex_init (decl, init);
- }
- else if (DECL_EXTERNAL (decl))
- ;
- else if (TREE_CODE_CLASS (TREE_CODE (type)) == 't'
- && (IS_AGGR_TYPE (type) || TYPE_NEEDS_CONSTRUCTING (type)))
- {
- tree ctype = type;
- while (TREE_CODE (ctype) == ARRAY_TYPE)
- ctype = TREE_TYPE (ctype);
- if (! TYPE_NEEDS_CONSTRUCTING (ctype))
- {
- if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (ctype))
- cp_error ("structure `%D' with uninitialized const members", decl);
- if (CLASSTYPE_REF_FIELDS_NEED_INIT (ctype))
- cp_error ("structure `%D' with uninitialized reference members",
- decl);
- }
-
- if (TREE_CODE (decl) == VAR_DECL
- && !DECL_INITIAL (decl)
- && !TYPE_NEEDS_CONSTRUCTING (type)
- && (TYPE_READONLY (type) || TREE_READONLY (decl)))
- cp_error ("uninitialized const `%D'", decl);
-
- if (TYPE_SIZE (type) != NULL_TREE
- && TYPE_NEEDS_CONSTRUCTING (type))
- init = obscure_complex_init (decl, NULL_TREE);
- }
- else if (TREE_CODE (decl) == VAR_DECL
- && TREE_CODE (type) != REFERENCE_TYPE
- && (TYPE_READONLY (type) || TREE_READONLY (decl)))
- {
- /* ``Unless explicitly declared extern, a const object does not have
- external linkage and must be initialized. ($8.4; $12.1)'' ARM 7.1.6
- However, if it's `const int foo = 1; const int foo;', don't complain
- about the second decl, since it does have an initializer before.
- We deliberately don't complain about arrays, because they're
- supposed to be initialized by a constructor. */
- if (! DECL_INITIAL (decl)
- && TREE_CODE (type) != ARRAY_TYPE
- && (!pedantic || !current_class_type))
- cp_error ("uninitialized const `%#D'", decl);
- }
-
- /* For top-level declaration, the initial value was read in
- the temporary obstack. MAXINDEX, rtl, etc. to be made below
- must go in the permanent obstack; but don't discard the
- temporary data yet. */
-
- if (toplevel_bindings_p () && temporary)
- end_temporary_allocation ();
-
- /* Deduce size of array from initialization, if not already known. */
-
- if (TREE_CODE (type) == ARRAY_TYPE
- && TYPE_DOMAIN (type) == NULL_TREE
- && TREE_CODE (decl) != TYPE_DECL)
- {
- int do_default
- = (TREE_STATIC (decl)
- /* Even if pedantic, an external linkage array
- may have incomplete type at first. */
- ? pedantic && ! DECL_EXTERNAL (decl)
- : !DECL_EXTERNAL (decl));
- tree initializer = init ? init : DECL_INITIAL (decl);
- int failure = complete_array_type (type, initializer, do_default);
-
- if (failure == 1)
- cp_error ("initializer fails to determine size of `%D'", decl);
-
- if (failure == 2)
- {
- if (do_default)
- cp_error ("array size missing in `%D'", decl);
- /* If a `static' var's size isn't known, make it extern as
- well as static, so it does not get allocated. If it's not
- `static', then don't mark it extern; finish_incomplete_decl
- will give it a default size and it will get allocated. */
- else if (!pedantic && TREE_STATIC (decl) && !TREE_PUBLIC (decl))
- DECL_EXTERNAL (decl) = 1;
- }
-
- if (pedantic && TYPE_DOMAIN (type) != NULL_TREE
- && tree_int_cst_lt (TYPE_MAX_VALUE (TYPE_DOMAIN (type)),
- integer_zero_node))
- cp_error ("zero-size array `%D'", decl);
-
- layout_decl (decl, 0);
- }
-
- if (TREE_CODE (decl) == VAR_DECL)
- {
- if (DECL_SIZE (decl) == NULL_TREE
- && TYPE_SIZE (complete_type (TREE_TYPE (decl))) != NULL_TREE)
- layout_decl (decl, 0);
-
- if (TREE_STATIC (decl) && DECL_SIZE (decl) == NULL_TREE)
- {
- /* A static variable with an incomplete type:
- that is an error if it is initialized.
- Otherwise, let it through, but if it is not `extern'
- then it may cause an error message later. */
- if (DECL_INITIAL (decl) != NULL_TREE)
- cp_error ("storage size of `%D' isn't known", decl);
- init = NULL_TREE;
- }
- else if (!DECL_EXTERNAL (decl) && DECL_SIZE (decl) == NULL_TREE)
- {
- /* An automatic variable with an incomplete type: that is an error.
- Don't talk about array types here, since we took care of that
- message in grokdeclarator. */
- cp_error ("storage size of `%D' isn't known", decl);
- TREE_TYPE (decl) = error_mark_node;
- }
- else if (!DECL_EXTERNAL (decl) && IS_AGGR_TYPE (ttype))
- /* Let debugger know it should output info for this type. */
- note_debug_info_needed (ttype);
-
- if (TREE_STATIC (decl) && DECL_CONTEXT (decl)
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
- note_debug_info_needed (DECL_CONTEXT (decl));
-
- if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
- && DECL_SIZE (decl) != NULL_TREE
- && ! TREE_CONSTANT (DECL_SIZE (decl)))
- {
- if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
- constant_expression_warning (DECL_SIZE (decl));
- else
- cp_error ("storage size of `%D' isn't constant", decl);
- }
-
- if (! DECL_EXTERNAL (decl) && TYPE_NEEDS_DESTRUCTOR (type)
- /* Cleanups for static variables are handled by `finish_file'. */
- && ! TREE_STATIC (decl))
- {
- int yes = suspend_momentary ();
- cleanup = maybe_build_cleanup (decl);
- resume_momentary (yes);
- }
- }
- /* PARM_DECLs get cleanups, too. */
- else if (TREE_CODE (decl) == PARM_DECL && TYPE_NEEDS_DESTRUCTOR (type))
- {
- if (temporary)
- end_temporary_allocation ();
- cleanup = maybe_build_cleanup (decl);
- if (temporary)
- resume_temporary_allocation ();
- }
-
- /* Output the assembler code and/or RTL code for variables and functions,
- unless the type is an undefined structure or union.
- If not, it will get done when the type is completed. */
-
- was_incomplete = (DECL_SIZE (decl) == NULL_TREE);
-
- if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL
- || TREE_CODE (decl) == RESULT_DECL)
- {
- /* ??? FIXME: What about nested classes? */
- int toplev = toplevel_bindings_p () || pseudo_global_level_p ();
- int was_temp
- = (TREE_STATIC (decl) && TYPE_NEEDS_DESTRUCTOR (type)
- && allocation_temporary_p ());
-
- if (was_temp)
- end_temporary_allocation ();
-
- if (TREE_CODE (decl) == VAR_DECL && DECL_VIRTUAL_P (decl))
- make_decl_rtl (decl, NULL_PTR, toplev);
- else if (TREE_CODE (decl) == VAR_DECL
- && TREE_READONLY (decl)
- && DECL_INITIAL (decl) != NULL_TREE
- && DECL_INITIAL (decl) != error_mark_node
- && ! EMPTY_CONSTRUCTOR_P (DECL_INITIAL (decl)))
- {
- DECL_INITIAL (decl) = save_expr (DECL_INITIAL (decl));
-
- if (asmspec)
- DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec);
-
- if (! toplev
- && TREE_STATIC (decl)
- && ! TREE_SIDE_EFFECTS (decl)
- && ! TREE_PUBLIC (decl)
- && ! DECL_EXTERNAL (decl)
- && ! TYPE_NEEDS_DESTRUCTOR (type)
- && DECL_MODE (decl) != BLKmode)
- {
- /* If this variable is really a constant, then fill its DECL_RTL
- slot with something which won't take up storage.
- If something later should take its address, we can always give
- it legitimate RTL at that time. */
- DECL_RTL (decl) = gen_reg_rtx (DECL_MODE (decl));
- store_expr (DECL_INITIAL (decl), DECL_RTL (decl), 0);
- TREE_ASM_WRITTEN (decl) = 1;
- }
- else if (toplev && ! TREE_PUBLIC (decl))
- {
- /* If this is a static const, change its apparent linkage
- if it belongs to a #pragma interface. */
- if (!interface_unknown)
- {
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = interface_only;
- }
- make_decl_rtl (decl, asmspec, toplev);
- }
- else
- rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
- }
- else if (TREE_CODE (decl) == VAR_DECL
- && DECL_LANG_SPECIFIC (decl)
- && DECL_IN_AGGR_P (decl))
- {
- if (TREE_STATIC (decl))
- {
- if (init == NULL_TREE
-#ifdef DEFAULT_STATIC_DEFS
- /* If this code is dead, then users must
- explicitly declare static member variables
- outside the class def'n as well. */
- && TYPE_NEEDS_CONSTRUCTING (type)
-#endif
- )
- {
- DECL_EXTERNAL (decl) = 1;
- make_decl_rtl (decl, asmspec, 1);
- }
- else
- rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
- }
- else
- /* Just a constant field. Should not need any rtl. */
- goto finish_end0;
- }
- else
- rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
-
- if (was_temp)
- resume_temporary_allocation ();
-
- if (type != error_mark_node
- && TYPE_LANG_SPECIFIC (type)
- && CLASSTYPE_ABSTRACT_VIRTUALS (type))
- abstract_virtuals_error (decl, type);
- else if ((TREE_CODE (type) == FUNCTION_TYPE
- || TREE_CODE (type) == METHOD_TYPE)
- && TYPE_LANG_SPECIFIC (TREE_TYPE (type))
- && CLASSTYPE_ABSTRACT_VIRTUALS (TREE_TYPE (type)))
- abstract_virtuals_error (decl, TREE_TYPE (type));
-
- if (TYPE_LANG_SPECIFIC (type) && IS_SIGNATURE (type))
- signature_error (decl, type);
- else if ((TREE_CODE (type) == FUNCTION_TYPE
- || TREE_CODE (type) == METHOD_TYPE)
- && TYPE_LANG_SPECIFIC (TREE_TYPE (type))
- && IS_SIGNATURE (TREE_TYPE (type)))
- signature_error (decl, TREE_TYPE (type));
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- ;
- else if (DECL_EXTERNAL (decl)
- && ! (DECL_LANG_SPECIFIC (decl)
- && DECL_NOT_REALLY_EXTERN (decl)))
- {
- if (init)
- DECL_INITIAL (decl) = init;
- }
- else if (TREE_STATIC (decl) && type != error_mark_node)
- {
- /* Cleanups for static variables are handled by `finish_file'. */
- if (TYPE_NEEDS_CONSTRUCTING (type) || init != NULL_TREE
- || TYPE_NEEDS_DESTRUCTOR (type))
- expand_static_init (decl, init);
- }
- else if (! toplev)
- {
- extern int temp_slot_level;
- extern int target_temp_slot_level;
- tree old_cleanups = cleanups_this_call;
- int old_temp_level = target_temp_slot_level;
-
- /* This is a declared decl which must live until the
- end of the binding contour. It may need a cleanup. */
-
- /* Recompute the RTL of a local array now
- if it used to be an incomplete type. */
- if (was_incomplete && ! TREE_STATIC (decl))
- {
- /* If we used it already as memory, it must stay in memory. */
- TREE_ADDRESSABLE (decl) = TREE_USED (decl);
- /* If it's still incomplete now, no init will save it. */
- if (DECL_SIZE (decl) == NULL_TREE)
- DECL_INITIAL (decl) = NULL_TREE;
- expand_decl (decl);
- }
- else if (! TREE_ASM_WRITTEN (decl)
- && (TYPE_SIZE (type) != NULL_TREE
- || TREE_CODE (type) == ARRAY_TYPE))
- {
- /* Do this here, because we did not expand this decl's
- rtl in start_decl. */
- if (DECL_RTL (decl) == NULL_RTX)
- expand_decl (decl);
- else if (cleanup)
- {
- /* XXX: Why don't we use decl here? */
- /* Ans: Because it was already expanded? */
- if (! expand_decl_cleanup (NULL_TREE, cleanup))
- cp_error ("parser lost in parsing declaration of `%D'",
- decl);
- /* Cleanup used up here. */
- cleanup = NULL_TREE;
- }
- }
-
- if (current_binding_level->is_for_scope)
- {
- struct binding_level *outer = current_binding_level->level_chain;
-
- /* Check to see if the same name is already bound at
- the outer level, either because it was directly declared,
- or because a dead for-decl got preserved. In either case,
- the code would not have been valid under the ARM
- scope rules, so clear is_for_scope for the
- current_binding_level.
-
- Otherwise, we need to preserve the temp slot for decl
- to last into the outer binding level. */
-
- int handling_dead_for_vars = 0;
- tree link = outer->names;
- for (; ; link = TREE_CHAIN (link))
- {
- if (link == NULL && handling_dead_for_vars == 0)
- {
- link = outer->dead_vars_from_for;
- handling_dead_for_vars = 1;
- }
- if (link == NULL)
- {
- if (DECL_IN_MEMORY_P (decl))
- preserve_temp_slots (DECL_RTL (decl));
- break;
- }
- if (DECL_NAME (link) == DECL_NAME (decl))
- {
- if (handling_dead_for_vars)
- {
- tree shadowing
- = purpose_member (DECL_NAME (decl),
- current_binding_level->shadowed);
- if (shadowing && TREE_VALUE (shadowing) == link)
- TREE_VALUE (shadowing)
- = DECL_SHADOWED_FOR_VAR (link);
- }
- current_binding_level->is_for_scope = 0;
- break;
- }
- }
- }
-
- push_temp_slots ();
- push_temp_slots ();
- target_temp_slot_level = temp_slot_level;
-
- if (DECL_SIZE (decl) && type != error_mark_node)
- {
- /* Compute and store the initial value. */
- expand_decl_init (decl);
-
- if (init || TYPE_NEEDS_CONSTRUCTING (type))
- {
- emit_line_note (DECL_SOURCE_FILE (decl),
- DECL_SOURCE_LINE (decl));
- expand_aggr_init (decl, init, 0, flags);
- }
-
- /* Set this to 0 so we can tell whether an aggregate which
- was initialized was ever used. Don't do this if it has a
- destructor, so we don't complain about the 'resource
- allocation is initialization' idiom. */
- if (TYPE_NEEDS_CONSTRUCTING (type)
- && cleanup == NULL_TREE
- && DECL_NAME (decl))
- TREE_USED (decl) = 0;
- }
- /* Cleanup any temporaries needed for the initial value. */
- expand_cleanups_to (old_cleanups);
- pop_temp_slots ();
- pop_temp_slots ();
- target_temp_slot_level = old_temp_level;
-
- if (DECL_SIZE (decl) && type != error_mark_node)
- {
- /* Store the cleanup, if there was one. */
- if (cleanup)
- {
- if (! expand_decl_cleanup (decl, cleanup))
- cp_error ("parser lost in parsing declaration of `%D'",
- decl);
- }
- }
- }
- finish_end0:
-
- /* Undo call to `pushclass' that was done in `start_decl'
- due to initialization of qualified member variable.
- I.e., Foo::x = 10; */
- {
- tree context = DECL_REAL_CONTEXT (decl);
- if (context
- && TREE_CODE_CLASS (TREE_CODE (context)) == 't'
- && (TREE_CODE (decl) == VAR_DECL
- /* We also have a pushclass done that we need to undo here
- if we're at top level and declare a method. */
- || TREE_CODE (decl) == FUNCTION_DECL)
- /* If size hasn't been set, we're still defining it,
- and therefore inside the class body; don't pop
- the binding level.. */
- && TYPE_SIZE (context) != NULL_TREE
- && context == current_class_type)
- popclass (1);
- }
- }
-
- finish_end:
-
- /* If requested, warn about definitions of large data objects. */
-
- if (warn_larger_than
- && ! processing_template_decl
- && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL)
- && !DECL_EXTERNAL (decl))
- {
- register tree decl_size = DECL_SIZE (decl);
-
- if (decl_size && TREE_CODE (decl_size) == INTEGER_CST)
- {
- unsigned units = TREE_INT_CST_LOW (decl_size) / BITS_PER_UNIT;
-
- if (units > larger_than_size)
- warning_with_decl (decl, "size of `%s' is %u bytes", units);
- }
- }
-
- if (need_pop)
- {
- /* Resume permanent allocation, if not within a function. */
- /* The corresponding push_obstacks_nochange is in start_decl,
- start_method, groktypename, and in grokfield. */
- pop_obstacks ();
- }
-
- if (was_readonly)
- TREE_READONLY (decl) = 1;
-}
-
-/* This is here for a midend callback from c-common.c */
-
-void
-finish_decl (decl, init, asmspec_tree)
- tree decl, init;
- tree asmspec_tree;
-{
- cp_finish_decl (decl, init, asmspec_tree, 1, 0);
-}
-
-void
-expand_static_init (decl, init)
- tree decl;
- tree init;
-{
- tree oldstatic = value_member (decl, static_aggregates);
-
- if (oldstatic)
- {
- if (TREE_PURPOSE (oldstatic) && init != NULL_TREE)
- cp_error ("multiple initializations given for `%D'", decl);
- }
- else if (! toplevel_bindings_p () && ! pseudo_global_level_p ())
- {
- /* Emit code to perform this initialization but once. */
- tree temp;
-
- extern int temp_slot_level;
- extern int target_temp_slot_level;
- tree old_cleanups;
- int old_temp_level;
-
- /* Remember this information until end of file. */
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- /* Emit code to perform this initialization but once. */
- temp = get_temp_name (integer_type_node, 1);
- rest_of_decl_compilation (temp, NULL_PTR, 0, 0);
- expand_start_cond (build_binary_op (EQ_EXPR, temp,
- integer_zero_node, 1), 0);
- old_cleanups = cleanups_this_call;
- old_temp_level = target_temp_slot_level;
- push_temp_slots ();
- push_temp_slots ();
- target_temp_slot_level = temp_slot_level;
-
- expand_assignment (temp, integer_one_node, 0, 0);
- if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))
- || (init && TREE_CODE (init) == TREE_LIST))
- {
- expand_aggr_init (decl, init, 0, 0);
- do_pending_stack_adjust ();
- }
- else if (init)
- expand_assignment (decl, init, 0, 0);
-
- /* Cleanup any temporaries needed for the initial value. */
- expand_cleanups_to (old_cleanups);
- pop_temp_slots ();
- pop_temp_slots ();
- target_temp_slot_level = old_temp_level;
-
- if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (decl)))
- {
- tree cleanup, fcall;
- static tree Atexit = 0;
- if (Atexit == 0)
- {
- tree atexit_fndecl, PFV, pfvlist;
- /* Remember this information until end of file. */
- push_obstacks (&permanent_obstack, &permanent_obstack);
- PFV = build_pointer_type (build_function_type
- (void_type_node, void_list_node));
-
- pfvlist = tree_cons (NULL_TREE, PFV, void_list_node);
-
- push_lang_context (lang_name_c);
- atexit_fndecl =
- builtin_function ("atexit",
- build_function_type (void_type_node,
- pfvlist),
- NOT_BUILT_IN, NULL_PTR);
- assemble_external (atexit_fndecl);
- Atexit = default_conversion (atexit_fndecl);
- pop_lang_context ();
- pop_obstacks ();
- }
-
- cleanup = start_anon_func ();
- expand_expr_stmt (build_cleanup (decl));
- end_anon_func ();
- mark_addressable (cleanup);
- cleanup = build_unary_op (ADDR_EXPR, cleanup, 0);
- fcall = build_function_call (Atexit, tree_cons (NULL_TREE, cleanup, NULL_TREE));
- expand_expr_stmt (fcall);
- }
-
- expand_end_cond ();
- if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (decl)))
- {
- static_aggregates = perm_tree_cons (temp, decl, static_aggregates);
- TREE_STATIC (static_aggregates) = 1;
- }
-
- /* Resume old (possibly temporary) allocation. */
- pop_obstacks ();
- }
- else
- {
- /* This code takes into account memory allocation
- policy of `start_decl'. Namely, if TYPE_NEEDS_CONSTRUCTING
- does not hold for this object, then we must make permanent
- the storage currently in the temporary obstack. */
- if (! TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
- preserve_initializer ();
- static_aggregates = perm_tree_cons (init, decl, static_aggregates);
- }
-}
-
-/* Make TYPE a complete type based on INITIAL_VALUE.
- Return 0 if successful, 1 if INITIAL_VALUE can't be deciphered,
- 2 if there was no information (in which case assume 1 if DO_DEFAULT). */
-
-int
-complete_array_type (type, initial_value, do_default)
- tree type, initial_value;
- int do_default;
-{
- register tree maxindex = NULL_TREE;
- int value = 0;
-
- if (initial_value)
- {
- /* Note MAXINDEX is really the maximum index,
- one less than the size. */
- if (TREE_CODE (initial_value) == STRING_CST)
- {
- int eltsize
- = int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value)));
- maxindex = build_int_2 ((TREE_STRING_LENGTH (initial_value)
- / eltsize) - 1, 0);
- }
- else if (TREE_CODE (initial_value) == CONSTRUCTOR)
- {
- tree elts = CONSTRUCTOR_ELTS (initial_value);
- maxindex = size_binop (MINUS_EXPR, integer_zero_node, size_one_node);
- for (; elts; elts = TREE_CHAIN (elts))
- {
- if (TREE_PURPOSE (elts))
- maxindex = TREE_PURPOSE (elts);
- else
- maxindex = size_binop (PLUS_EXPR, maxindex, size_one_node);
- }
- maxindex = copy_node (maxindex);
- }
- else
- {
- /* Make an error message unless that happened already. */
- if (initial_value != error_mark_node)
- value = 1;
-
- /* Prevent further error messages. */
- maxindex = build_int_2 (0, 0);
- }
- }
-
- if (!maxindex)
- {
- if (do_default)
- maxindex = build_int_2 (0, 0);
- value = 2;
- }
-
- if (maxindex)
- {
- tree itype;
-
- TYPE_DOMAIN (type) = build_index_type (maxindex);
- if (! TREE_TYPE (maxindex))
- TREE_TYPE (maxindex) = TYPE_DOMAIN (type);
- if (initial_value)
- itype = TREE_TYPE (initial_value);
- else
- itype = NULL;
- if (itype && !TYPE_DOMAIN (itype))
- TYPE_DOMAIN (itype) = TYPE_DOMAIN (type);
- /* The type of the main variant should never be used for arrays
- of different sizes. It should only ever be completed with the
- size of the array. */
- if (! TYPE_DOMAIN (TYPE_MAIN_VARIANT (type)))
- TYPE_DOMAIN (TYPE_MAIN_VARIANT (type)) = TYPE_DOMAIN (type);
- }
-
- /* Lay out the type now that we can get the real answer. */
-
- layout_type (type);
-
- return value;
-}
-
-/* Return zero if something is declared to be a member of type
- CTYPE when in the context of CUR_TYPE. STRING is the error
- message to print in that case. Otherwise, quietly return 1. */
-
-static int
-member_function_or_else (ctype, cur_type, string)
- tree ctype, cur_type;
- char *string;
-{
- if (ctype && ctype != cur_type)
- {
- error (string, TYPE_NAME_STRING (ctype));
- return 0;
- }
- return 1;
-}
-
-/* Subroutine of `grokdeclarator'. */
-
-/* Generate errors possibly applicable for a given set of specifiers.
- This is for ARM $7.1.2. */
-
-static void
-bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises)
- tree object;
- char *type;
- int virtualp, quals, friendp, raises, inlinep;
-{
- if (virtualp)
- cp_error ("`%D' declared as a `virtual' %s", object, type);
- if (inlinep)
- cp_error ("`%D' declared as an `inline' %s", object, type);
- if (quals)
- cp_error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration",
- object, type);
- if (friendp)
- cp_error_at ("invalid friend declaration", object);
- if (raises)
- cp_error_at ("invalid exception specifications", object);
-}
-
-/* CTYPE is class type, or null if non-class.
- TYPE is type this FUNCTION_DECL should have, either FUNCTION_TYPE
- or METHOD_TYPE.
- DECLARATOR is the function's name.
- VIRTUALP is truthvalue of whether the function is virtual or not.
- FLAGS are to be passed through to `grokclassfn'.
- QUALS are qualifiers indicating whether the function is `const'
- or `volatile'.
- RAISES is a list of exceptions that this function can raise.
- CHECK is 1 if we must find this method in CTYPE, 0 if we should
- not look, and -1 if we should not call `grokclassfn' at all. */
-
-static tree
-grokfndecl (ctype, type, declarator, virtualp, flags, quals,
- raises, attrlist, check, publicp, inlinep, funcdef_flag)
- tree ctype, type;
- tree declarator;
- int virtualp;
- enum overload_flags flags;
- tree quals, raises, attrlist;
- int check, publicp, inlinep, funcdef_flag;
-{
- tree cname, decl;
- int staticp = ctype && TREE_CODE (type) == FUNCTION_TYPE;
-
- if (ctype)
- cname = TREE_CODE (TYPE_NAME (ctype)) == TYPE_DECL
- ? TYPE_IDENTIFIER (ctype) : TYPE_NAME (ctype);
- else
- cname = NULL_TREE;
-
- if (raises)
- {
- type = build_exception_variant (type, raises);
- }
-
- decl = build_lang_decl (FUNCTION_DECL, declarator, type);
- /* propagate volatile out from type to decl */
- if (TYPE_VOLATILE (type))
- TREE_THIS_VOLATILE (decl) = 1;
-
- /* Should probably propagate const out from type to decl I bet (mrs). */
- if (staticp)
- {
- DECL_STATIC_FUNCTION_P (decl) = 1;
- DECL_CONTEXT (decl) = ctype;
- }
-
- if (ctype)
- DECL_CLASS_CONTEXT (decl) = ctype;
-
- /* All function decls start out public; we'll fix their linkage later (at
- definition or EOF) if appropriate. */
- TREE_PUBLIC (decl) = 1;
-
- if (ctype == NULL_TREE && ! strcmp (IDENTIFIER_POINTER (declarator), "main"))
- {
- if (inlinep)
- error ("cannot declare `main' to be inline");
- else if (! publicp)
- error ("cannot declare `main' to be static");
- inlinep = 0;
- publicp = 1;
- }
-
- if (! publicp)
- DECL_C_STATIC (decl) = 1;
-
- if (inlinep)
- DECL_THIS_INLINE (decl) = DECL_INLINE (decl) = 1;
-
- DECL_EXTERNAL (decl) = 1;
- if (quals != NULL_TREE && TREE_CODE (type) == FUNCTION_TYPE)
- {
- cp_error ("%smember function `%D' cannot have `%T' method qualifier",
- (ctype ? "static " : "non-"), decl, TREE_VALUE (quals));
- quals = NULL_TREE;
- }
-
- if (IDENTIFIER_OPNAME_P (DECL_NAME (decl)))
- grok_op_properties (decl, virtualp, check < 0);
-
- if (ctype && hack_decl_function_context (decl))
- DECL_NO_STATIC_CHAIN (decl) = 1;
-
- /* Caller will do the rest of this. */
- if (check < 0)
- return decl;
-
- if (check && funcdef_flag)
- DECL_INITIAL (decl) = error_mark_node;
-
- if (flags == NO_SPECIAL && ctype && constructor_name (cname) == declarator)
- {
- tree tmp;
- /* Just handle constructors here. We could do this
- inside the following if stmt, but I think
- that the code is more legible by breaking this
- case out. See comments below for what each of
- the following calls is supposed to do. */
- DECL_CONSTRUCTOR_P (decl) = 1;
-
- grokclassfn (ctype, declarator, decl, flags, quals);
- if (check)
- {
- tmp = check_classfn (ctype, decl);
- if (tmp && DECL_ARTIFICIAL (tmp))
- cp_error ("definition of implicitly-declared `%D'", tmp);
- if (tmp && duplicate_decls (decl, tmp))
- return tmp;
- }
- if (! grok_ctor_properties (ctype, decl))
- return NULL_TREE;
-
- if (check == 0 && ! current_function_decl)
- {
- /* FIXME: this should only need to look at
- IDENTIFIER_GLOBAL_VALUE. */
- tmp = lookup_name (DECL_ASSEMBLER_NAME (decl), 0);
- if (tmp == NULL_TREE)
- IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (decl)) = decl;
- else if (TREE_CODE (tmp) != TREE_CODE (decl))
- cp_error ("inconsistent declarations for `%D'", decl);
- else
- {
- duplicate_decls (decl, tmp);
- decl = tmp;
- /* avoid creating circularities. */
- DECL_CHAIN (decl) = NULL_TREE;
- }
- make_decl_rtl (decl, NULL_PTR, 1);
- }
- }
- else
- {
- tree tmp;
-
- /* Function gets the ugly name, field gets the nice one.
- This call may change the type of the function (because
- of default parameters)! */
- if (ctype != NULL_TREE)
- grokclassfn (ctype, cname, decl, flags, quals);
-
- if (ctype != NULL_TREE && check)
- {
- tmp = check_classfn (ctype, decl);
- if (tmp && DECL_STATIC_FUNCTION_P (tmp)
- && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
- {
- /* Remove the `this' parm added by grokclassfn.
- XXX Isn't this done in start_function, too? */
- revert_static_member_fn (&decl, NULL, NULL);
- last_function_parms = TREE_CHAIN (last_function_parms);
- }
- if (tmp && DECL_ARTIFICIAL (tmp))
- cp_error ("definition of implicitly-declared `%D'", tmp);
- if (tmp && duplicate_decls (decl, tmp))
- return tmp;
- }
-
- if (ctype == NULL_TREE || check)
- return decl;
-
- /* Now install the declaration of this function so that others may
- find it (esp. its DECL_FRIENDLIST). Don't do this for local class
- methods, though. */
- if (! current_function_decl)
- {
- /* FIXME: this should only need to look at
- IDENTIFIER_GLOBAL_VALUE. */
- tmp = lookup_name (DECL_ASSEMBLER_NAME (decl), 0);
- if (tmp == NULL_TREE)
- IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (decl)) = decl;
- else if (TREE_CODE (tmp) != TREE_CODE (decl))
- cp_error ("inconsistent declarations for `%D'", decl);
- else
- {
- duplicate_decls (decl, tmp);
- decl = tmp;
- /* avoid creating circularities. */
- DECL_CHAIN (decl) = NULL_TREE;
- }
-
- if (attrlist)
- cplus_decl_attributes (decl, TREE_PURPOSE (attrlist),
- TREE_VALUE (attrlist));
- make_decl_rtl (decl, NULL_PTR, 1);
- }
- if (virtualp)
- {
- DECL_VIRTUAL_P (decl) = 1;
- if (DECL_VINDEX (decl) == NULL_TREE)
- DECL_VINDEX (decl) = error_mark_node;
- IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)) = 1;
- }
- }
- return decl;
-}
-
-static tree
-grokvardecl (type, declarator, specbits_in, initialized, constp)
- tree type;
- tree declarator;
- RID_BIT_TYPE *specbits_in;
- int initialized;
- int constp;
-{
- tree decl;
- RID_BIT_TYPE specbits;
-
- specbits = *specbits_in;
-
- if (TREE_CODE (type) == OFFSET_TYPE)
- {
- /* If you declare a static member so that it
- can be initialized, the code will reach here. */
- tree basetype = TYPE_OFFSET_BASETYPE (type);
- type = TREE_TYPE (type);
- decl = build_lang_field_decl (VAR_DECL, declarator, type);
- DECL_CONTEXT (decl) = basetype;
- DECL_CLASS_CONTEXT (decl) = basetype;
- DECL_ASSEMBLER_NAME (decl) = build_static_name (basetype, declarator);
- }
- else
- decl = build_decl (VAR_DECL, declarator, complete_type (type));
-
- DECL_ASSEMBLER_NAME (decl) = current_namespace_id (DECL_ASSEMBLER_NAME (decl));
-
- if (RIDBIT_SETP (RID_EXTERN, specbits))
- {
- DECL_THIS_EXTERN (decl) = 1;
- DECL_EXTERNAL (decl) = !initialized;
- }
-
- /* In class context, static means one per class,
- public access, and static storage. */
- if (DECL_FIELD_CONTEXT (decl) != NULL_TREE
- && IS_AGGR_TYPE (DECL_FIELD_CONTEXT (decl)))
- {
- TREE_PUBLIC (decl) = 1;
- TREE_STATIC (decl) = 1;
- DECL_EXTERNAL (decl) = 0;
- }
- /* At top level, either `static' or no s.c. makes a definition
- (perhaps tentative), and absence of `static' makes it public. */
- else if (toplevel_bindings_p ())
- {
- TREE_PUBLIC (decl) = (RIDBIT_NOTSETP (RID_STATIC, specbits)
- && (DECL_THIS_EXTERN (decl) || ! constp));
- TREE_STATIC (decl) = ! DECL_EXTERNAL (decl);
- }
- /* Not at top level, only `static' makes a static definition. */
- else
- {
- TREE_STATIC (decl) = !! RIDBIT_SETP (RID_STATIC, specbits);
- TREE_PUBLIC (decl) = DECL_EXTERNAL (decl);
- }
- return decl;
-}
-
-/* Create a canonical pointer to member function type. */
-
-tree
-build_ptrmemfunc_type (type)
- tree type;
-{
- tree fields[4];
- tree t;
- tree u;
-
- /* If a canonical type already exists for this type, use it. We use
- this method instead of type_hash_canon, because it only does a
- simple equality check on the list of field members. */
-
- if ((t = TYPE_GET_PTRMEMFUNC_TYPE (type)))
- return t;
-
- push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
-
- u = make_lang_type (UNION_TYPE);
- IS_AGGR_TYPE (u) = 0;
- fields[0] = build_lang_field_decl (FIELD_DECL, pfn_identifier, type);
- fields[1] = build_lang_field_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_lang_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. */
- IS_AGGR_TYPE (t) = 0;
-
- fields[0] = build_lang_field_decl (FIELD_DECL, delta_identifier,
- delta_type_node);
- fields[1] = build_lang_field_decl (FIELD_DECL, index_identifier,
- delta_type_node);
- fields[2] = build_lang_field_decl (FIELD_DECL, pfn_or_delta2_identifier, u);
- finish_builtin_type (t, "__ptrmemfunc_type", fields, 2, ptr_type_node);
-
- pop_obstacks ();
-
- /* Zap out the name so that the back-end will give us the debugging
- information for this anonymous RECORD_TYPE. */
- TYPE_NAME (t) = NULL_TREE;
-
- TYPE_SET_PTRMEMFUNC_TYPE (type, t);
-
- /* Seems to be wanted. */
- CLASSTYPE_GOT_SEMICOLON (t) = 1;
- return t;
-}
-
-/* Given declspecs and a declarator,
- determine the name and type of the object declared
- and construct a ..._DECL node for it.
- (In one case we can return a ..._TYPE node instead.
- For invalid input we sometimes return 0.)
-
- DECLSPECS is a chain of tree_list nodes whose value fields
- are the storage classes and type specifiers.
-
- DECL_CONTEXT says which syntactic context this declaration is in:
- NORMAL for most contexts. Make a VAR_DECL or FUNCTION_DECL or TYPE_DECL.
- FUNCDEF for a function definition. Like NORMAL but a few different
- error messages in each case. Return value may be zero meaning
- this definition is too screwy to try to parse.
- MEMFUNCDEF for a function definition. Like FUNCDEF but prepares to
- handle member functions (which have FIELD context).
- Return value may be zero meaning this definition is too screwy to
- try to parse.
- PARM for a parameter declaration (either within a function prototype
- or before a function body). Make a PARM_DECL, or return void_type_node.
- CATCHPARM for a parameter declaration before a catch clause.
- TYPENAME if for a typename (in a cast or sizeof).
- Don't make a DECL node; just return the ..._TYPE node.
- FIELD for a struct or union field; make a FIELD_DECL.
- BITFIELD for a field with specified width.
- INITIALIZED is 1 if the decl has an initializer.
-
- In the TYPENAME case, DECLARATOR is really an absolute declarator.
- It may also be so in the PARM case, for a prototype where the
- argument type is specified but not the name.
-
- This function is where the complicated C meanings of `static'
- and `extern' are interpreted.
-
- For C++, if there is any monkey business to do, the function which
- calls this one must do it, i.e., prepending instance variables,
- renaming overloaded function names, etc.
-
- Note that for this C++, it is an error to define a method within a class
- which does not belong to that class.
-
- Except in the case where SCOPE_REFs are implicitly known (such as
- methods within a class being redundantly qualified),
- declarations which involve SCOPE_REFs are returned as SCOPE_REFs
- (class_name::decl_name). The caller must also deal with this.
-
- If a constructor or destructor is seen, and the context is FIELD,
- then the type gains the attribute TREE_HAS_x. If such a declaration
- is erroneous, NULL_TREE is returned.
-
- QUALS is used only for FUNCDEF and MEMFUNCDEF cases. For a member
- function, these are the qualifiers to give to the `this' pointer.
-
- May return void_type_node if the declarator turned out to be a friend.
- See grokfield for details. */
-
-enum return_types { return_normal, return_ctor, return_dtor, return_conversion };
-
-tree
-grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
- tree declspecs;
- tree declarator;
- enum decl_context decl_context;
- int initialized;
- tree attrlist;
-{
- RID_BIT_TYPE specbits;
- int nclasses = 0;
- tree spec;
- tree type = NULL_TREE;
- int longlong = 0;
- int constp;
- int volatilep;
- int virtualp, explicitp, friendp, inlinep, staticp;
- int explicit_int = 0;
- int explicit_char = 0;
- int opaque_typedef = 0;
- tree typedef_decl = NULL_TREE;
- char *name;
- tree typedef_type = NULL_TREE;
- int funcdef_flag = 0;
- enum tree_code innermost_code = ERROR_MARK;
- int bitfield = 0;
-#if 0
- /* See the code below that used this. */
- tree decl_machine_attr = NULL_TREE;
-#endif
- /* Set this to error_mark_node for FIELD_DECLs we could not handle properly.
- All FIELD_DECLs we build here have `init' put into their DECL_INITIAL. */
- tree init = NULL_TREE;
-
- /* Keep track of what sort of function is being processed
- so that we can warn about default return values, or explicit
- return values which do not match prescribed defaults. */
- enum return_types return_type = return_normal;
-
- tree dname = NULL_TREE;
- tree ctype = current_class_type;
- tree ctor_return_type = NULL_TREE;
- enum overload_flags flags = NO_SPECIAL;
- tree quals = NULL_TREE;
- tree raises = NULL_TREE;
-
- RIDBIT_RESET_ALL (specbits);
- if (decl_context == FUNCDEF)
- funcdef_flag = 1, decl_context = NORMAL;
- else if (decl_context == MEMFUNCDEF)
- funcdef_flag = -1, decl_context = FIELD;
- else if (decl_context == BITFIELD)
- bitfield = 1, decl_context = FIELD;
-
- /* Look inside a declarator for the name being declared
- and get it as a string, for an error message. */
- {
- tree *next = &declarator;
- register tree decl;
- name = NULL;
-
- while (next && *next)
- {
- decl = *next;
- switch (TREE_CODE (decl))
- {
- case COND_EXPR:
- ctype = NULL_TREE;
- next = &TREE_OPERAND (decl, 0);
- break;
-
- case BIT_NOT_EXPR: /* for C++ destructors! */
- {
- tree name = TREE_OPERAND (decl, 0);
- tree rename = NULL_TREE;
-
- my_friendly_assert (flags == NO_SPECIAL, 152);
- flags = DTOR_FLAG;
- return_type = return_dtor;
- if (TREE_CODE (name) == TYPE_DECL)
- TREE_OPERAND (decl, 0) = name = constructor_name (name);
- my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 153);
- if (ctype == NULL_TREE)
- {
- if (current_class_type == NULL_TREE)
- {
- error ("destructors must be member functions");
- flags = NO_SPECIAL;
- }
- else
- {
- tree t = constructor_name (current_class_name);
- if (t != name)
- rename = t;
- }
- }
- else
- {
- tree t = constructor_name (ctype);
- if (t != name)
- rename = t;
- }
-
- if (rename)
- {
- cp_error ("destructor `%T' must match class name `%T'",
- name, rename);
- TREE_OPERAND (decl, 0) = rename;
- }
- next = &name;
- }
- break;
-
- case ADDR_EXPR: /* C++ reference declaration */
- /* fall through */
- case ARRAY_REF:
- case INDIRECT_REF:
- ctype = NULL_TREE;
- innermost_code = TREE_CODE (decl);
- next = &TREE_OPERAND (decl, 0);
- break;
-
- case CALL_EXPR:
- if (parmlist_is_exprlist (TREE_OPERAND (decl, 1)))
- {
- /* This is actually a variable declaration using constructor
- syntax. We need to call start_decl and cp_finish_decl so we
- can get the variable initialized... */
-
- *next = TREE_OPERAND (decl, 0);
- init = TREE_OPERAND (decl, 1);
-
- decl = start_decl (declarator, declspecs, 1);
- finish_decl (decl, init, NULL_TREE);
- return 0;
- }
- innermost_code = TREE_CODE (decl);
- if (decl_context == FIELD && ctype == NULL_TREE)
- ctype = current_class_type;
- if (ctype
- && TREE_OPERAND (decl, 0)
- && (TREE_CODE (TREE_OPERAND (decl, 0)) == TYPE_DECL
- && ((DECL_NAME (TREE_OPERAND (decl, 0))
- == constructor_name_full (ctype))
- || (DECL_NAME (TREE_OPERAND (decl, 0))
- == constructor_name (ctype)))))
- TREE_OPERAND (decl, 0) = constructor_name (ctype);
- next = &TREE_OPERAND (decl, 0);
- decl = *next;
- if (ctype != NULL_TREE
- && decl != NULL_TREE && flags != DTOR_FLAG
- && decl == constructor_name (ctype))
- {
- return_type = return_ctor;
- ctor_return_type = ctype;
- }
- ctype = NULL_TREE;
- break;
-
- case IDENTIFIER_NODE:
- dname = decl;
- next = 0;
-
- if (is_rid (dname))
- {
- cp_error ("declarator-id missing; using reserved word `%D'",
- dname);
- name = IDENTIFIER_POINTER (dname);
- }
- if (! IDENTIFIER_OPNAME_P (dname)
- /* Linux headers use '__op'. Arrgh. */
- || IDENTIFIER_TYPENAME_P (dname) && ! TREE_TYPE (dname))
- name = IDENTIFIER_POINTER (dname);
- else
- {
- if (IDENTIFIER_TYPENAME_P (dname))
- {
- my_friendly_assert (flags == NO_SPECIAL, 154);
- flags = TYPENAME_FLAG;
- ctor_return_type = TREE_TYPE (dname);
- return_type = return_conversion;
- }
- name = operator_name_string (dname);
- }
- break;
-
- /* C++ extension */
- case SCOPE_REF:
- {
- /* Perform error checking, and decide on a ctype. */
- tree cname = TREE_OPERAND (decl, 0);
- if (cname == NULL_TREE)
- ctype = NULL_TREE;
- else if (! is_aggr_type (cname, 1))
- TREE_OPERAND (decl, 0) = NULL_TREE;
- /* Must test TREE_OPERAND (decl, 1), in case user gives
- us `typedef (class::memfunc)(int); memfunc *memfuncptr;' */
- else if (TREE_OPERAND (decl, 1)
- && TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF)
- ctype = cname;
- else if (TREE_CODE (cname) == TEMPLATE_TYPE_PARM)
- {
- cp_error ("`%T::%D' is not a valid declarator", cname,
- TREE_OPERAND (decl, 1));
- cp_error (" perhaps you want `typename %T::%D' to make it a type",
- cname, TREE_OPERAND (decl, 1));
- return void_type_node;
- }
- else if (ctype == NULL_TREE)
- ctype = cname;
- else if (TREE_COMPLEXITY (decl) == current_class_depth)
- TREE_OPERAND (decl, 0) = ctype;
- else
- {
- if (! UNIQUELY_DERIVED_FROM_P (cname, ctype))
- {
- cp_error ("type `%T' is not derived from type `%T'",
- cname, ctype);
- TREE_OPERAND (decl, 0) = NULL_TREE;
- }
- else
- ctype = cname;
- }
-
- if (ctype && TREE_CODE (TREE_OPERAND (decl, 1)) == TYPE_DECL
- && ((DECL_NAME (TREE_OPERAND (decl, 1))
- == constructor_name_full (ctype))
- || (DECL_NAME (TREE_OPERAND (decl, 1))
- == constructor_name (ctype))))
- TREE_OPERAND (decl, 1) = constructor_name (ctype);
- next = &TREE_OPERAND (decl, 1);
- decl = *next;
- if (ctype)
- {
- if (TREE_CODE (decl) == IDENTIFIER_NODE
- && constructor_name (ctype) == decl)
- {
- return_type = return_ctor;
- ctor_return_type = ctype;
- }
- else if (TREE_CODE (decl) == BIT_NOT_EXPR
- && TREE_CODE (TREE_OPERAND (decl, 0)) == IDENTIFIER_NODE
- && (constructor_name (ctype) == TREE_OPERAND (decl, 0)
- || constructor_name_full (ctype) == TREE_OPERAND (decl, 0)))
- {
- return_type = return_dtor;
- ctor_return_type = ctype;
- flags = DTOR_FLAG;
- TREE_OPERAND (decl, 0) = constructor_name (ctype);
- next = &TREE_OPERAND (decl, 0);
- }
- }
- }
- break;
-
- case ERROR_MARK:
- next = 0;
- break;
-
- case TYPE_DECL:
- /* Parse error puts this typespec where
- a declarator should go. */
- cp_error ("`%T' specified as declarator-id", DECL_NAME (decl));
- if (TREE_TYPE (decl) == current_class_type)
- cp_error (" perhaps you want `%T' for a constructor",
- current_class_name);
- dname = DECL_NAME (decl);
- name = IDENTIFIER_POINTER (dname);
-
- /* Avoid giving two errors for this. */
- IDENTIFIER_CLASS_VALUE (dname) = NULL_TREE;
-
- declspecs = temp_tree_cons (NULL_TREE, integer_type_node,
- declspecs);
- *next = dname;
- next = 0;
- break;
-
- default:
- cp_compiler_error ("`%D' as declarator", decl);
- return 0; /* We used to do a 155 abort here. */
- }
- }
- if (name == NULL)
- name = "type name";
- }
-
- /* A function definition's declarator must have the form of
- a function declarator. */
-
- if (funcdef_flag && innermost_code != CALL_EXPR)
- return 0;
-
- if (((dname && IDENTIFIER_OPNAME_P (dname)) || flags == TYPENAME_FLAG)
- && innermost_code != CALL_EXPR
- && ! (ctype && declspecs == NULL_TREE))
- {
- cp_error ("declaration of `%D' as non-function", dname);
- return void_type_node;
- }
-
- /* Anything declared one level down from the top level
- must be one of the parameters of a function
- (because the body is at least two levels down). */
-
- /* This heuristic cannot be applied to C++ nodes! Fixed, however,
- by not allowing C++ class definitions to specify their parameters
- with xdecls (must be spec.d in the parmlist).
-
- Since we now wait to push a class scope until we are sure that
- we are in a legitimate method context, we must set oldcname
- explicitly (since current_class_name is not yet alive).
-
- We also want to avoid calling this a PARM if it is in a namespace. */
-
- if (decl_context == NORMAL && ! namespace_bindings_p ()
- && ! pseudo_global_level_p ())
- {
- struct binding_level *b = current_binding_level;
- current_binding_level = b->level_chain;
- if (current_binding_level != 0 && toplevel_bindings_p ())
- decl_context = PARM;
- current_binding_level = b;
- }
-
- /* Look through the decl specs and record which ones appear.
- Some typespecs are defined as built-in typenames.
- Others, the ones that are modifiers of other types,
- are represented by bits in SPECBITS: set the bits for
- the modifiers that appear. Storage class keywords are also in SPECBITS.
-
- If there is a typedef name or a type, store the type in TYPE.
- This includes builtin typedefs such as `int'.
-
- Set EXPLICIT_INT if the type is `int' or `char' and did not
- come from a user typedef.
-
- Set LONGLONG if `long' is mentioned twice.
-
- For C++, constructors and destructors have their own fast treatment. */
-
- for (spec = declspecs; spec; spec = TREE_CHAIN (spec))
- {
- register int i;
- register tree id;
-
- /* Certain parse errors slip through. For example,
- `int class;' is not caught by the parser. Try
- weakly to recover here. */
- if (TREE_CODE (spec) != TREE_LIST)
- return 0;
-
- id = TREE_VALUE (spec);
-
- if (TREE_CODE (id) == IDENTIFIER_NODE)
- {
- if (id == ridpointers[(int) RID_INT]
- || id == ridpointers[(int) RID_CHAR]
- || id == ridpointers[(int) RID_BOOL]
- || id == ridpointers[(int) RID_WCHAR])
- {
- if (type)
- {
- if (id == ridpointers[(int) RID_BOOL])
- error ("`bool' is now a keyword");
- else
- cp_error ("extraneous `%T' ignored", id);
- }
- else
- {
- if (id == ridpointers[(int) RID_INT])
- explicit_int = 1;
- else if (id == ridpointers[(int) RID_CHAR])
- explicit_char = 1;
- type = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (id));
- }
- goto found;
- }
- /* C++ aggregate types. */
- if (IDENTIFIER_HAS_TYPE_VALUE (id))
- {
- if (type)
- cp_error ("multiple declarations `%T' and `%T'", type, id);
- else
- type = IDENTIFIER_TYPE_VALUE (id);
- goto found;
- }
-
- for (i = (int) RID_FIRST_MODIFIER; i <= (int) RID_LAST_MODIFIER; i++)
- {
- if (ridpointers[i] == id)
- {
- if (i == (int) RID_LONG && RIDBIT_SETP (i, specbits))
- {
- if (pedantic && ! in_system_header)
- pedwarn ("ANSI C++ does not support `long long'");
- if (longlong)
- error ("`long long long' is too long for GCC");
- else
- longlong = 1;
- }
- else if (RIDBIT_SETP (i, specbits))
- pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id));
- RIDBIT_SET (i, specbits);
- goto found;
- }
- }
- }
- /* C++ aggregate types. */
- else if (TREE_CODE (id) == TYPE_DECL)
- {
- if (type)
- cp_error ("multiple declarations `%T' and `%T'", type,
- TREE_TYPE (id));
- else
- {
- type = TREE_TYPE (id);
- TREE_VALUE (spec) = type;
- }
- goto found;
- }
- if (type)
- error ("two or more data types in declaration of `%s'", name);
- else if (TREE_CODE (id) == IDENTIFIER_NODE)
- {
- register tree t = lookup_name (id, 1);
- if (!t || TREE_CODE (t) != TYPE_DECL)
- error ("`%s' fails to be a typedef or built in type",
- IDENTIFIER_POINTER (id));
- else
- {
- type = TREE_TYPE (t);
-#if 0
- /* See the code below that used this. */
- decl_machine_attr = DECL_MACHINE_ATTRIBUTES (id);
-#endif
- typedef_decl = t;
- }
- }
- else if (id != error_mark_node)
- /* Can't change CLASS nodes into RECORD nodes here! */
- type = id;
-
- found: ;
- }
-
- typedef_type = type;
-
- /* No type at all: default to `int', and set EXPLICIT_INT
- because it was not a user-defined typedef.
- Except when we have a `typedef' inside a signature, in
- which case the type defaults to `unknown type' and is
- instantiated when assigning to a signature pointer or ref. */
-
- if (type == NULL_TREE
- && (RIDBIT_SETP (RID_SIGNED, specbits)
- || RIDBIT_SETP (RID_UNSIGNED, specbits)
- || RIDBIT_SETP (RID_LONG, specbits)
- || RIDBIT_SETP (RID_SHORT, specbits)))
- {
- /* These imply 'int'. */
- type = integer_type_node;
- explicit_int = 1;
- }
-
- if (type == NULL_TREE)
- {
- explicit_int = -1;
- if (return_type == return_dtor)
- type = void_type_node;
- else if (return_type == return_ctor)
- type = build_pointer_type (ctor_return_type);
- else if (return_type == return_conversion)
- type = ctor_return_type;
- else if (current_class_type
- && IS_SIGNATURE (current_class_type)
- && RIDBIT_SETP (RID_TYPEDEF, specbits)
- && (decl_context == FIELD || decl_context == NORMAL))
- {
- explicit_int = 0;
- opaque_typedef = 1;
- type = copy_node (opaque_type_node);
- }
- else
- {
- if (funcdef_flag)
- {
- if (warn_return_type
- && return_type == return_normal)
- /* Save warning until we know what is really going on. */
- warn_about_return_type = 1;
- }
- else if (RIDBIT_SETP (RID_TYPEDEF, specbits))
- pedwarn ("ANSI C++ forbids typedef which does not specify a type");
- else if (declspecs == NULL_TREE &&
- (innermost_code != CALL_EXPR || pedantic))
- cp_pedwarn ("ANSI C++ forbids declaration `%D' with no type or storage class",
- dname);
- type = integer_type_node;
- }
- }
- else if (return_type == return_dtor)
- {
- error ("return type specification for destructor invalid");
- type = void_type_node;
- }
- else if (return_type == return_ctor)
- {
- error ("return type specification for constructor invalid");
- type = build_pointer_type (ctor_return_type);
- }
- else if (return_type == return_conversion)
- {
- if (comptypes (type, ctor_return_type, 1) == 0)
- cp_error ("operator `%T' declared to return `%T'",
- ctor_return_type, type);
- else
- cp_pedwarn ("return type specified for `operator %T'",
- ctor_return_type);
-
- type = ctor_return_type;
- }
-
- ctype = NULL_TREE;
-
- /* Now process the modifiers that were specified
- and check for invalid combinations. */
-
- /* Long double is a special combination. */
-
- if (RIDBIT_SETP (RID_LONG, specbits)
- && TYPE_MAIN_VARIANT (type) == double_type_node)
- {
- RIDBIT_RESET (RID_LONG, specbits);
- type = build_type_variant (long_double_type_node, TYPE_READONLY (type),
- TYPE_VOLATILE (type));
- }
-
- /* Check all other uses of type modifiers. */
-
- if (RIDBIT_SETP (RID_UNSIGNED, specbits)
- || RIDBIT_SETP (RID_SIGNED, specbits)
- || RIDBIT_SETP (RID_LONG, specbits)
- || RIDBIT_SETP (RID_SHORT, specbits))
- {
- int ok = 0;
-
- if (TREE_CODE (type) == REAL_TYPE)
- error ("short, signed or unsigned invalid for `%s'", name);
- else if (TREE_CODE (type) != INTEGER_TYPE)
- error ("long, short, signed or unsigned invalid for `%s'", name);
- else if (RIDBIT_SETP (RID_LONG, specbits)
- && RIDBIT_SETP (RID_SHORT, specbits))
- error ("long and short specified together for `%s'", name);
- else if ((RIDBIT_SETP (RID_LONG, specbits)
- || RIDBIT_SETP (RID_SHORT, specbits))
- && explicit_char)
- error ("long or short specified with char for `%s'", name);
- else if ((RIDBIT_SETP (RID_LONG, specbits)
- || RIDBIT_SETP (RID_SHORT, specbits))
- && TREE_CODE (type) == REAL_TYPE)
- error ("long or short specified with floating type for `%s'", name);
- else if (RIDBIT_SETP (RID_SIGNED, specbits)
- && RIDBIT_SETP (RID_UNSIGNED, specbits))
- error ("signed and unsigned given together for `%s'", name);
- else
- {
- ok = 1;
- if (!explicit_int && !explicit_char && pedantic)
- {
- pedwarn ("long, short, signed or unsigned used invalidly for `%s'",
- name);
- if (flag_pedantic_errors)
- ok = 0;
- }
- }
-
- /* Discard the type modifiers if they are invalid. */
- if (! ok)
- {
- RIDBIT_RESET (RID_UNSIGNED, specbits);
- RIDBIT_RESET (RID_SIGNED, specbits);
- RIDBIT_RESET (RID_LONG, specbits);
- RIDBIT_RESET (RID_SHORT, specbits);
- longlong = 0;
- }
- }
-
- /* Decide whether an integer type is signed or not.
- Optionally treat bitfields as signed by default. */
- if (RIDBIT_SETP (RID_UNSIGNED, specbits)
- || (bitfield && ! flag_signed_bitfields
- && (explicit_int || explicit_char
- /* A typedef for plain `int' without `signed'
- can be controlled just like plain `int'. */
- || ! (typedef_decl != NULL_TREE
- && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
- && TREE_CODE (type) != ENUMERAL_TYPE
- && RIDBIT_NOTSETP (RID_SIGNED, specbits)))
- {
- if (longlong)
- type = long_long_unsigned_type_node;
- else if (RIDBIT_SETP (RID_LONG, specbits))
- type = long_unsigned_type_node;
- else if (RIDBIT_SETP (RID_SHORT, specbits))
- type = short_unsigned_type_node;
- else if (type == char_type_node)
- type = unsigned_char_type_node;
- else if (typedef_decl)
- type = unsigned_type (type);
- else
- type = unsigned_type_node;
- }
- else if (RIDBIT_SETP (RID_SIGNED, specbits)
- && type == char_type_node)
- type = signed_char_type_node;
- else if (longlong)
- type = long_long_integer_type_node;
- else if (RIDBIT_SETP (RID_LONG, specbits))
- type = long_integer_type_node;
- else if (RIDBIT_SETP (RID_SHORT, specbits))
- type = short_integer_type_node;
-
- /* Set CONSTP if this declaration is `const', whether by
- explicit specification or via a typedef.
- Likewise for VOLATILEP. */
-
- constp = !! RIDBIT_SETP (RID_CONST, specbits) + TYPE_READONLY (type);
- volatilep = !! RIDBIT_SETP (RID_VOLATILE, specbits) + TYPE_VOLATILE (type);
- staticp = 0;
- inlinep = !! RIDBIT_SETP (RID_INLINE, specbits);
- virtualp = RIDBIT_SETP (RID_VIRTUAL, specbits);
- RIDBIT_RESET (RID_VIRTUAL, specbits);
- explicitp = RIDBIT_SETP (RID_EXPLICIT, specbits) != 0;
- RIDBIT_RESET (RID_EXPLICIT, specbits);
-
- if (RIDBIT_SETP (RID_STATIC, specbits))
- staticp = 1 + (decl_context == FIELD);
-
- if (virtualp && staticp == 2)
- {
- cp_error ("member `%D' cannot be declared both virtual and static",
- dname);
- staticp = 0;
- }
- friendp = RIDBIT_SETP (RID_FRIEND, specbits);
- RIDBIT_RESET (RID_FRIEND, specbits);
-
- if (RIDBIT_SETP (RID_MUTABLE, specbits))
- {
- if (decl_context == PARM)
- {
- error ("non-member `%s' cannot be declared `mutable'", name);
- RIDBIT_RESET (RID_MUTABLE, specbits);
- }
- else if (friendp || decl_context == TYPENAME)
- {
- error ("non-object member `%s' cannot be declared `mutable'", name);
- RIDBIT_RESET (RID_MUTABLE, specbits);
- }
- }
-
- /* Warn if two storage classes are given. Default to `auto'. */
-
- if (RIDBIT_ANY_SET (specbits))
- {
- if (RIDBIT_SETP (RID_STATIC, specbits)) nclasses++;
- if (RIDBIT_SETP (RID_EXTERN, specbits)) nclasses++;
- if (decl_context == PARM && nclasses > 0)
- error ("storage class specifiers invalid in parameter declarations");
- if (RIDBIT_SETP (RID_TYPEDEF, specbits))
- {
- if (decl_context == PARM)
- error ("typedef declaration invalid in parameter declaration");
- nclasses++;
- }
- if (RIDBIT_SETP (RID_AUTO, specbits)) nclasses++;
- if (RIDBIT_SETP (RID_REGISTER, specbits)) nclasses++;
- }
-
- /* Give error if `virtual' is used outside of class declaration. */
- if (virtualp
- && (current_class_name == NULL_TREE || decl_context != FIELD))
- {
- error ("virtual outside class declaration");
- virtualp = 0;
- }
- if (current_class_name == NULL_TREE && RIDBIT_SETP (RID_MUTABLE, specbits))
- {
- error ("only members can be declared mutable");
- RIDBIT_RESET (RID_MUTABLE, specbits);
- }
-
- /* Static anonymous unions are dealt with here. */
- if (staticp && decl_context == TYPENAME
- && TREE_CODE (declspecs) == TREE_LIST
- && TREE_CODE (TREE_VALUE (declspecs)) == UNION_TYPE
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (TREE_VALUE (declspecs))))
- decl_context = FIELD;
-
- /* Give error if `const,' `volatile,' `inline,' `friend,' or `virtual'
- is used in a signature member function declaration. */
- if (decl_context == FIELD
- && IS_SIGNATURE (current_class_type)
- && RIDBIT_NOTSETP (RID_TYPEDEF, specbits))
- {
- if (constp)
- {
- error ("`const' specified for signature member function `%s'", name);
- constp = 0;
- }
- if (volatilep)
- {
- error ("`volatile' specified for signature member function `%s'",
- name);
- volatilep = 0;
- }
- if (inlinep)
- {
- error ("`inline' specified for signature member function `%s'", name);
- /* Later, we'll make signature member functions inline. */
- inlinep = 0;
- }
- if (friendp)
- {
- error ("`friend' declaration in signature definition");
- friendp = 0;
- }
- if (virtualp)
- {
- error ("`virtual' specified for signature member function `%s'",
- name);
- /* Later, we'll make signature member functions virtual. */
- virtualp = 0;
- }
- }
-
- /* Warn about storage classes that are invalid for certain
- kinds of declarations (parameters, typenames, etc.). */
-
- if (nclasses > 1)
- error ("multiple storage classes in declaration of `%s'", name);
- else if (decl_context != NORMAL && nclasses > 0)
- {
- if ((decl_context == PARM || decl_context == CATCHPARM)
- && (RIDBIT_SETP (RID_REGISTER, specbits)
- || RIDBIT_SETP (RID_AUTO, specbits)))
- ;
- else if (RIDBIT_SETP (RID_TYPEDEF, specbits))
- ;
- else if (decl_context == FIELD
- && ! IS_SIGNATURE (current_class_type)
- /* C++ allows static class elements */
- && RIDBIT_SETP (RID_STATIC, specbits))
- /* C++ also allows inlines and signed and unsigned elements,
- but in those cases we don't come in here. */
- ;
- else
- {
- if (decl_context == FIELD)
- {
- tree tmp = NULL_TREE;
- register int op = 0;
-
- if (declarator)
- {
- /* Avoid trying to get an operand off an identifier node. */
- if (TREE_CODE (declarator) == IDENTIFIER_NODE)
- tmp = declarator;
- else
- tmp = TREE_OPERAND (declarator, 0);
- op = IDENTIFIER_OPNAME_P (tmp);
- }
- error ("storage class specified for %s `%s'",
- IS_SIGNATURE (current_class_type)
- ? (op
- ? "signature member operator"
- : "signature member function")
- : (op ? "member operator" : "field"),
- op ? operator_name_string (tmp) : name);
- }
- else
- error (((decl_context == PARM || decl_context == CATCHPARM)
- ? "storage class specified for parameter `%s'"
- : "storage class specified for typename"), name);
- RIDBIT_RESET (RID_REGISTER, specbits);
- RIDBIT_RESET (RID_AUTO, specbits);
- RIDBIT_RESET (RID_EXTERN, specbits);
-
- if (decl_context == FIELD && IS_SIGNATURE (current_class_type))
- {
- RIDBIT_RESET (RID_STATIC, specbits);
- staticp = 0;
- }
- }
- }
- else if (RIDBIT_SETP (RID_EXTERN, specbits) && initialized && !funcdef_flag)
- {
- if (toplevel_bindings_p ())
- {
- /* It's common practice (and completely valid) to have a const
- be initialized and declared extern. */
- if (! constp)
- warning ("`%s' initialized and declared `extern'", name);
- }
- else
- error ("`%s' has both `extern' and initializer", name);
- }
- else if (RIDBIT_SETP (RID_EXTERN, specbits) && funcdef_flag
- && ! toplevel_bindings_p ())
- error ("nested function `%s' declared `extern'", name);
- else if (toplevel_bindings_p ())
- {
- if (RIDBIT_SETP (RID_AUTO, specbits))
- error ("top-level declaration of `%s' specifies `auto'", name);
- }
-
- if (nclasses > 0 && friendp)
- error ("storage class specifiers invalid in friend function declarations");
-
- /* Now figure out the structure of the declarator proper.
- Descend through it, creating more complex types, until we reach
- the declared identifier (or NULL_TREE, in an absolute declarator). */
-
- while (declarator && TREE_CODE (declarator) != IDENTIFIER_NODE)
- {
- /* Each level of DECLARATOR is either an ARRAY_REF (for ...[..]),
- an INDIRECT_REF (for *...),
- a CALL_EXPR (for ...(...)),
- an identifier (for the name being declared)
- or a null pointer (for the place in an absolute declarator
- where the name was omitted).
- For the last two cases, we have just exited the loop.
-
- For C++ it could also be
- a SCOPE_REF (for class :: ...). In this case, we have converted
- sensible names to types, and those are the values we use to
- qualify the member name.
- an ADDR_EXPR (for &...),
- a BIT_NOT_EXPR (for destructors)
-
- At this point, TYPE is the type of elements of an array,
- or for a function to return, or for a pointer to point to.
- After this sequence of ifs, TYPE is the type of the
- array or function or pointer, and DECLARATOR has had its
- outermost layer removed. */
-
- if (type == error_mark_node)
- {
- if (TREE_CODE (declarator) == SCOPE_REF)
- declarator = TREE_OPERAND (declarator, 1);
- else
- declarator = TREE_OPERAND (declarator, 0);
- continue;
- }
- if (quals != NULL_TREE
- && (declarator == NULL_TREE
- || TREE_CODE (declarator) != SCOPE_REF))
- {
- if (ctype == NULL_TREE && TREE_CODE (type) == METHOD_TYPE)
- ctype = TYPE_METHOD_BASETYPE (type);
- if (ctype != NULL_TREE)
- {
- tree dummy = build_decl (TYPE_DECL, NULL_TREE, type);
- ctype = grok_method_quals (ctype, dummy, quals);
- type = TREE_TYPE (dummy);
- quals = NULL_TREE;
- }
- }
- switch (TREE_CODE (declarator))
- {
- case ARRAY_REF:
- {
- register tree itype = NULL_TREE;
- register tree size = TREE_OPERAND (declarator, 1);
- /* The index is a signed object `sizetype' bits wide. */
- tree index_type = signed_type (sizetype);
-
- declarator = TREE_OPERAND (declarator, 0);
-
- /* Check for some types that there cannot be arrays of. */
-
- if (TYPE_MAIN_VARIANT (type) == void_type_node)
- {
- cp_error ("declaration of `%D' as array of voids", dname);
- type = error_mark_node;
- }
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- cp_error ("declaration of `%D' as array of functions", dname);
- type = error_mark_node;
- }
-
- /* ARM $8.4.3: Since you can't have a pointer to a reference,
- you can't have arrays of references. If we allowed them,
- then we'd be saying x[i] is valid for an array x, but
- then you'd have to ask: what does `*(x + i)' mean? */
- if (TREE_CODE (type) == REFERENCE_TYPE)
- {
- if (decl_context == TYPENAME)
- cp_error ("cannot make arrays of references");
- else
- cp_error ("declaration of `%D' as array of references",
- dname);
- type = error_mark_node;
- }
-
- if (TREE_CODE (type) == OFFSET_TYPE)
- {
- cp_error ("declaration of `%D' as array of data members",
- dname);
- type = error_mark_node;
- }
-
- if (TREE_CODE (type) == METHOD_TYPE)
- {
- cp_error ("declaration of `%D' as array of function members",
- dname);
- type = error_mark_node;
- }
-
- if (size == error_mark_node)
- type = error_mark_node;
-
- if (type == error_mark_node)
- continue;
-
- if (size)
- {
- /* Must suspend_momentary here because the index
- type may need to live until the end of the function.
- For example, it is used in the declaration of a
- variable which requires destructing at the end of
- the function; then build_vec_delete will need this
- value. */
- int yes = suspend_momentary ();
- /* might be a cast */
- if (TREE_CODE (size) == NOP_EXPR
- && TREE_TYPE (size) == TREE_TYPE (TREE_OPERAND (size, 0)))
- size = TREE_OPERAND (size, 0);
-
- /* If this involves a template parameter, it'll be
- constant, but we don't know what the value is yet. */
- if (processing_template_decl)
- {
- itype = make_node (INTEGER_TYPE);
- TYPE_MIN_VALUE (itype) = size_zero_node;
- TYPE_MAX_VALUE (itype) = build_min
- (MINUS_EXPR, sizetype, size, integer_one_node);
- goto dont_grok_size;
- }
-
- if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE)
- {
- cp_error ("size of array `%D' has non-integer type",
- dname);
- size = integer_one_node;
- }
- if (TREE_READONLY_DECL_P (size))
- size = decl_constant_value (size);
- if (pedantic && integer_zerop (size))
- cp_pedwarn ("ANSI C++ forbids zero-size array `%D'", dname);
- if (TREE_CONSTANT (size))
- {
- int old_flag_pedantic_errors = flag_pedantic_errors;
- int old_pedantic = pedantic;
- pedantic = flag_pedantic_errors = 1;
- /* Always give overflow errors on array subscripts. */
- constant_expression_warning (size);
- pedantic = old_pedantic;
- flag_pedantic_errors = old_flag_pedantic_errors;
- if (INT_CST_LT (size, integer_zero_node))
- {
- cp_error ("size of array `%D' is negative", dname);
- size = integer_one_node;
- }
- }
- else
- {
- if (pedantic)
- {
- if (dname)
- cp_pedwarn ("ANSI C++ forbids variable-size array `%D'",
- dname);
- else
- cp_pedwarn ("ANSI C++ forbids variable-size array");
- }
- }
-
- itype =
- fold (build_binary_op (MINUS_EXPR,
- convert (index_type, size),
- convert (index_type,
- integer_one_node), 1));
- if (! TREE_CONSTANT (itype))
- itype = variable_size (itype);
- else if (TREE_OVERFLOW (itype))
- {
- error ("overflow in array dimension");
- TREE_OVERFLOW (itype) = 0;
- }
-
- /* If we're a parm, we need to have a permanent type so
- mangling checks for re-use will work right. If both the
- element and index types are permanent, the array type
- will be, too. */
- if (decl_context == PARM
- && allocation_temporary_p () && TREE_PERMANENT (type))
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- itype = build_index_type (itype);
- pop_obstacks ();
- }
- else
- itype = build_index_type (itype);
-
- dont_grok_size:
- resume_momentary (yes);
- }
-
- /* Build the array type itself, then merge any constancy or
- volatility into the target type. We must do it in this order
- to ensure that the TYPE_MAIN_VARIANT field of the array type
- is set correctly. */
-
- type = build_cplus_array_type (type, itype);
- if (constp || volatilep)
- type = cp_build_type_variant (type, constp, volatilep);
-
- ctype = NULL_TREE;
- }
- break;
-
- case CALL_EXPR:
- {
- tree arg_types;
- int funcdecl_p;
- tree inner_parms = TREE_OPERAND (declarator, 1);
- tree inner_decl = TREE_OPERAND (declarator, 0);
-
- /* Declaring a function type.
- Make sure we have a valid type for the function to return. */
-#if 0
- /* Is this an error? Should they be merged into TYPE here? */
- if (pedantic && (constp || volatilep))
- pedwarn ("function declared to return const or volatile result");
-#else
- /* Merge any constancy or volatility into the function return
- type. */
-
- if (constp || volatilep)
- {
- type = cp_build_type_variant (type, constp, volatilep);
- if (IS_AGGR_TYPE (type))
- build_pointer_type (type);
- constp = 0;
- volatilep = 0;
- }
-#endif
-
- /* Warn about some types functions can't return. */
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- error ("`%s' declared as function returning a function", name);
- type = integer_type_node;
- }
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- error ("`%s' declared as function returning an array", name);
- type = integer_type_node;
- }
-
- if (inner_decl && TREE_CODE (inner_decl) == SCOPE_REF)
- inner_decl = TREE_OPERAND (inner_decl, 1);
-
- /* Pick up type qualifiers which should be applied to `this'. */
- quals = TREE_OPERAND (declarator, 2);
-
- /* Pick up the exception specifications. */
- raises = TREE_TYPE (declarator);
-
- /* Say it's a definition only for the CALL_EXPR
- closest to the identifier. */
- funcdecl_p =
- inner_decl && (TREE_CODE (inner_decl) == IDENTIFIER_NODE
- || TREE_CODE (inner_decl) == BIT_NOT_EXPR);
-
- if (ctype == NULL_TREE
- && decl_context == FIELD
- && funcdecl_p
- && (friendp == 0 || dname == current_class_name))
- ctype = current_class_type;
-
- if (ctype && return_type == return_conversion)
- TYPE_HAS_CONVERSION (ctype) = 1;
- if (ctype && constructor_name (ctype) == dname)
- {
- /* We are within a class's scope. If our declarator name
- is the same as the class name, and we are defining
- a function, then it is a constructor/destructor, and
- therefore returns a void type. */
-
- if (flags == DTOR_FLAG)
- {
- /* ANSI C++ June 5 1992 WP 12.4.1. A destructor may
- not be declared const or volatile. A destructor
- may not be static. */
- if (staticp == 2)
- error ("destructor cannot be static member function");
- if (quals)
- {
- error ("destructors cannot be declared `const' or `volatile'");
- return void_type_node;
- }
- if (decl_context == FIELD)
- {
- if (! member_function_or_else (ctype, current_class_type,
- "destructor for alien class `%s' cannot be a member"))
- return void_type_node;
- }
- }
- else /* it's a constructor. */
- {
- if (explicitp == 1)
- explicitp = 2;
- /* ANSI C++ June 5 1992 WP 12.1.2. A constructor may
- not be declared const or volatile. A constructor may
- not be virtual. A constructor may not be static. */
- if (staticp == 2)
- error ("constructor cannot be static member function");
- if (virtualp)
- {
- pedwarn ("constructors cannot be declared virtual");
- virtualp = 0;
- }
- if (quals)
- {
- error ("constructors cannot be declared `const' or `volatile'");
- return void_type_node;
- }
- {
- RID_BIT_TYPE tmp_bits;
- bcopy ((void*)&specbits, (void*)&tmp_bits, sizeof (RID_BIT_TYPE));
- RIDBIT_RESET (RID_INLINE, tmp_bits);
- RIDBIT_RESET (RID_STATIC, tmp_bits);
- if (RIDBIT_ANY_SET (tmp_bits))
- error ("return value type specifier for constructor ignored");
- }
- type = build_pointer_type (ctype);
- if (decl_context == FIELD &&
- IS_SIGNATURE (current_class_type))
- {
- error ("constructor not allowed in signature");
- return void_type_node;
- }
- else if (decl_context == FIELD)
- {
- if (! member_function_or_else (ctype, current_class_type,
- "constructor for alien class `%s' cannot be member"))
- return void_type_node;
- TYPE_HAS_CONSTRUCTOR (ctype) = 1;
- if (return_type != return_ctor)
- return NULL_TREE;
- }
- }
- if (decl_context == FIELD)
- staticp = 0;
- }
- else if (friendp)
- {
- if (initialized)
- error ("can't initialize friend function `%s'", name);
- if (virtualp)
- {
- /* Cannot be both friend and virtual. */
- error ("virtual functions cannot be friends");
- RIDBIT_RESET (RID_FRIEND, specbits);
- friendp = 0;
- }
- if (decl_context == NORMAL)
- error ("friend declaration not in class definition");
- if (current_function_decl && funcdef_flag)
- cp_error ("can't define friend function `%s' in a local class definition",
- name);
- }
-
- /* Construct the function type and go to the next
- inner layer of declarator. */
-
- declarator = TREE_OPERAND (declarator, 0);
-
- /* FIXME: This is where default args should be fully
- processed. */
-
- arg_types = grokparms (inner_parms, funcdecl_p ? funcdef_flag : 0);
-
- if (declarator)
- {
- /* Get past destructors, etc.
- We know we have one because FLAGS will be non-zero.
-
- Complain about improper parameter lists here. */
- if (TREE_CODE (declarator) == BIT_NOT_EXPR)
- {
- declarator = TREE_OPERAND (declarator, 0);
-
- if (strict_prototype == 0 && arg_types == NULL_TREE)
- arg_types = void_list_node;
- else if (arg_types == NULL_TREE
- || arg_types != void_list_node)
- {
- error ("destructors cannot be specified with parameters");
- arg_types = void_list_node;
- }
- }
- }
-
- /* ANSI says that `const int foo ();'
- does not make the function foo const. */
- type = build_function_type (type, arg_types);
- }
- break;
-
- case ADDR_EXPR:
- case INDIRECT_REF:
- /* Filter out pointers-to-references and references-to-references.
- We can get these if a TYPE_DECL is used. */
-
- if (TREE_CODE (type) == REFERENCE_TYPE)
- {
- error ("cannot declare %s to references",
- TREE_CODE (declarator) == ADDR_EXPR
- ? "references" : "pointers");
- declarator = TREE_OPERAND (declarator, 0);
- continue;
- }
-
- if (TREE_CODE (type) == OFFSET_TYPE
- && (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE
- || TREE_CODE (TREE_TYPE (type)) == REFERENCE_TYPE))
- {
- cp_error ("cannot declare pointer to `%#T' member",
- TREE_TYPE (type));
- type = TREE_TYPE (type);
- }
-
- /* Merge any constancy or volatility into the target type
- for the pointer. */
-
- if (constp || volatilep)
- {
- /* A const or volatile signature pointer/reference is
- pointing to a const or volatile object, i.e., the
- `optr' is const or volatile, respectively, not the
- signature pointer/reference itself. */
- if (! IS_SIGNATURE (type))
- {
- type = cp_build_type_variant (type, constp, volatilep);
- if (IS_AGGR_TYPE (type))
- build_pointer_type (type);
- constp = 0;
- volatilep = 0;
- }
- }
-
- if (IS_SIGNATURE (type))
- {
- if (TREE_CODE (declarator) == ADDR_EXPR)
- {
- if (CLASSTYPE_METHOD_VEC (type) == NULL_TREE
- && TYPE_SIZE (type))
- cp_warning ("empty signature `%T' used in signature reference declaration",
- type);
-#if 0
- type = build_signature_reference_type (type,
- constp, volatilep);
-#else
- sorry ("signature reference");
- return NULL_TREE;
-#endif
- }
- else
- {
- if (CLASSTYPE_METHOD_VEC (type) == NULL_TREE
- && TYPE_SIZE (type))
- cp_warning ("empty signature `%T' used in signature pointer declaration",
- type);
- type = build_signature_pointer_type (type,
- constp, volatilep);
- }
- constp = 0;
- volatilep = 0;
- }
- else if (TREE_CODE (declarator) == ADDR_EXPR)
- {
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- error ("cannot declare references to functions; use pointer to function instead");
- type = build_pointer_type (type);
- }
- else
- {
- if (TYPE_MAIN_VARIANT (type) == void_type_node)
- error ("invalid type: `void &'");
- else
- type = build_reference_type (type);
- }
- }
- else if (TREE_CODE (type) == METHOD_TYPE)
- {
- type = build_ptrmemfunc_type (build_pointer_type (type));
- }
- else
- type = build_pointer_type (type);
-
- /* Process a list of type modifier keywords (such as
- const or volatile) that were given inside the `*' or `&'. */
-
- if (TREE_TYPE (declarator))
- {
- register tree typemodlist;
- int erred = 0;
- for (typemodlist = TREE_TYPE (declarator); typemodlist;
- typemodlist = TREE_CHAIN (typemodlist))
- {
- if (TREE_VALUE (typemodlist) == ridpointers[(int) RID_CONST])
- constp++;
- else if (TREE_VALUE (typemodlist) == ridpointers[(int) RID_VOLATILE])
- volatilep++;
- else if (!erred)
- {
- erred = 1;
- error ("invalid type modifier within %s declarator",
- TREE_CODE (declarator) == ADDR_EXPR
- ? "reference" : "pointer");
- }
- }
- if (constp > 1)
- pedwarn ("duplicate `const'");
- if (volatilep > 1)
- pedwarn ("duplicate `volatile'");
- if (TREE_CODE (declarator) == ADDR_EXPR
- && (constp || volatilep))
- {
- if (constp)
- pedwarn ("discarding `const' applied to a reference");
- if (volatilep)
- pedwarn ("discarding `volatile' applied to a reference");
- constp = volatilep = 0;
- }
- }
- declarator = TREE_OPERAND (declarator, 0);
- ctype = NULL_TREE;
- break;
-
- case SCOPE_REF:
- {
- /* We have converted type names to NULL_TREE if the
- name was bogus, or to a _TYPE node, if not.
-
- The variable CTYPE holds the type we will ultimately
- resolve to. The code here just needs to build
- up appropriate member types. */
- tree sname = TREE_OPERAND (declarator, 1);
- /* Destructors can have their visibilities changed as well. */
- if (TREE_CODE (sname) == BIT_NOT_EXPR)
- sname = TREE_OPERAND (sname, 0);
-
- if (TREE_COMPLEXITY (declarator) == 0)
- /* This needs to be here, in case we are called
- multiple times. */ ;
- else if (friendp && (TREE_COMPLEXITY (declarator) < 2))
- /* don't fall out into global scope. Hides real bug? --eichin */ ;
- else if (! IS_AGGR_TYPE_CODE
- (TREE_CODE (TREE_OPERAND (declarator, 0))))
- ;
- else if (TREE_COMPLEXITY (declarator) == current_class_depth)
- {
- /* Resolve any TYPENAME_TYPEs from the decl-specifier-seq
- that refer to ctype. They couldn't be resolved earlier
- because we hadn't pushed into the class yet.
- Example: resolve 'B<T>::type' in
- 'B<typename B<T>::type> B<T>::f () { }'. */
- if (current_template_parms
- && uses_template_parms (type)
- && uses_template_parms (current_class_type))
- {
- tree args = current_template_args ();
- type = tsubst (type, &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), NULL_TREE);
- }
-
- /* This pop_nested_class corresponds to the
- push_nested_class used to push into class scope for
- parsing the argument list of a function decl, in
- qualified_id. */
- pop_nested_class (1);
- TREE_COMPLEXITY (declarator) = current_class_depth;
- }
- else
- my_friendly_abort (16);
-
- if (TREE_OPERAND (declarator, 0) == NULL_TREE)
- {
- /* We had a reference to a global decl, or
- perhaps we were given a non-aggregate typedef,
- in which case we cleared this out, and should just
- keep going as though it wasn't there. */
- declarator = sname;
- continue;
- }
- ctype = TREE_OPERAND (declarator, 0);
-
- if (sname == NULL_TREE)
- goto done_scoping;
-
- if (TREE_CODE (sname) == IDENTIFIER_NODE)
- {
- /* This is the `standard' use of the scoping operator:
- basetype :: member . */
-
- if (ctype == current_class_type)
- {
- /* class A {
- void A::f ();
- };
-
- Is this ill-formed? */
-
- if (pedantic)
- cp_pedwarn ("extra qualification `%T::' on member `%s' ignored",
- ctype, name);
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- if (current_class_type == NULL_TREE
- || friendp)
- type = build_cplus_method_type (build_type_variant (ctype, constp, volatilep),
- TREE_TYPE (type), TYPE_ARG_TYPES (type));
- else
- {
- cp_error ("cannot declare member function `%T::%s' within `%T'",
- ctype, name, current_class_type);
- return void_type_node;
- }
- }
- else if (RIDBIT_SETP (RID_TYPEDEF, specbits)
- || TYPE_SIZE (complete_type (ctype)) != NULL_TREE)
- {
- /* have to move this code elsewhere in this function.
- this code is used for i.e., typedef int A::M; M *pm;
-
- It is? How? jason 10/2/94 */
-
- if (current_class_type)
- {
- cp_error ("cannot declare member `%T::%s' within `%T'",
- ctype, name, current_class_type);
- return void_type_node;
- }
- type = build_offset_type (ctype, type);
- }
- else if (uses_template_parms (ctype))
- {
- if (TREE_CODE (type) == FUNCTION_TYPE)
- type =
- build_cplus_method_type (build_type_variant (ctype,
- constp,
- volatilep),
- TREE_TYPE (type),
- TYPE_ARG_TYPES (type));
- }
- else
- {
- cp_error ("structure `%T' not yet defined", ctype);
- return error_mark_node;
- }
-
- declarator = sname;
- }
- else if (TREE_CODE (sname) == SCOPE_REF)
- my_friendly_abort (17);
- else
- {
- done_scoping:
- declarator = TREE_OPERAND (declarator, 1);
- if (declarator && TREE_CODE (declarator) == CALL_EXPR)
- /* In this case, we will deal with it later. */
- ;
- else
- {
- if (TREE_CODE (type) == FUNCTION_TYPE)
- type = build_cplus_method_type (build_type_variant (ctype, constp, volatilep), TREE_TYPE (type), TYPE_ARG_TYPES (type));
- else
- type = build_offset_type (ctype, type);
- }
- }
- }
- break;
-
- case BIT_NOT_EXPR:
- declarator = TREE_OPERAND (declarator, 0);
- break;
-
- case RECORD_TYPE:
- case UNION_TYPE:
- case ENUMERAL_TYPE:
- declarator = NULL_TREE;
- break;
-
- case ERROR_MARK:
- declarator = NULL_TREE;
- break;
-
- default:
- my_friendly_abort (158);
- }
- }
-
- if (explicitp == 1)
- {
- error ("only constructors can be declared `explicit'");
- explicitp = 0;
- }
-
- /* Now TYPE has the actual type. */
-
- /* If this is declaring a typedef name, return a TYPE_DECL. */
-
- if (RIDBIT_SETP (RID_MUTABLE, specbits))
- {
- if (constp)
- {
- error ("const `%s' cannot be declared `mutable'", name);
- RIDBIT_RESET (RID_MUTABLE, specbits);
- }
- else if (staticp)
- {
- error ("static `%s' cannot be declared `mutable'", name);
- RIDBIT_RESET (RID_MUTABLE, specbits);
- }
- }
-
- if (RIDBIT_SETP (RID_TYPEDEF, specbits) && decl_context != TYPENAME)
- {
- tree decl;
-
- /* Note that the grammar rejects storage classes
- in typenames, fields or parameters. */
- if (constp || volatilep)
- type = cp_build_type_variant (type, constp, volatilep);
-
- if (decl_context == FIELD)
- {
- if (declarator == current_class_name)
- cp_pedwarn ("ANSI C++ forbids nested type `%D' with same name as enclosing class",
- declarator);
- decl = build_lang_decl (TYPE_DECL, declarator, type);
- if (IS_SIGNATURE (current_class_type) && opaque_typedef)
- SIGNATURE_HAS_OPAQUE_TYPEDECLS (current_class_type) = 1;
- }
- else
- decl = build_decl (TYPE_DECL, declarator, type);
-
- /* If the user declares "struct {...} foo" then `foo' will have
- an anonymous name. Fill that name in now. Nothing can
- refer to it, so nothing needs know about the name change.
- The TYPE_NAME field was filled in by build_struct_xref. */
- if (type != error_mark_node
- && TYPE_NAME (type)
- && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (type)))
- {
- /* replace the anonymous name with the real name everywhere. */
- lookup_tag_reverse (type, declarator);
- TYPE_NAME (type) = decl;
-
- if (TYPE_LANG_SPECIFIC (type))
- TYPE_WAS_ANONYMOUS (type) = 1;
-
- DECL_ASSEMBLER_NAME (decl) = DECL_NAME (decl);
- DECL_ASSEMBLER_NAME (decl)
- = get_identifier (build_overload_name (type, 1, 1));
- }
-
- if (TREE_CODE (type) == OFFSET_TYPE || TREE_CODE (type) == METHOD_TYPE)
- {
- cp_error_at ("typedef name may not be class-qualified", decl);
- return NULL_TREE;
- }
- else if (quals)
- {
- if (ctype == NULL_TREE)
- {
- if (TREE_CODE (type) != METHOD_TYPE)
- cp_error_at ("invalid type qualifier for non-method type", decl);
- else
- ctype = TYPE_METHOD_BASETYPE (type);
- }
- if (ctype != NULL_TREE)
- grok_method_quals (ctype, decl, quals);
- }
-
- if (RIDBIT_SETP (RID_SIGNED, specbits)
- || (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
- C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
-
- if (RIDBIT_SETP (RID_MUTABLE, specbits))
- {
- error ("non-object member `%s' cannot be declared mutable", name);
- }
-
- bad_specifiers (decl, "type", virtualp, quals != NULL_TREE,
- inlinep, friendp, raises != NULL_TREE);
-
- if (initialized)
- error ("typedef declaration includes an initializer");
-
- return decl;
- }
-
- /* Detect the case of an array type of unspecified size
- which came, as such, direct from a typedef name.
- We must copy the type, so that each identifier gets
- a distinct type, so that each identifier's size can be
- controlled separately by its own initializer. */
-
- if (type == typedef_type && TREE_CODE (type) == ARRAY_TYPE
- && TYPE_DOMAIN (type) == NULL_TREE)
- {
- type = build_cplus_array_type (TREE_TYPE (type), TYPE_DOMAIN (type));
- }
-
- /* If this is a type name (such as, in a cast or sizeof),
- compute the type and return it now. */
-
- if (decl_context == TYPENAME)
- {
- /* Note that the grammar rejects storage classes
- in typenames, fields or parameters. */
- if (constp || volatilep)
- if (IS_SIGNATURE (type))
- error ("`const' or `volatile' specified with signature type");
- else
- type = cp_build_type_variant (type, constp, volatilep);
-
- /* Special case: "friend class foo" looks like a TYPENAME context. */
- if (friendp)
- {
- if (volatilep)
- {
- cp_error ("`volatile' specified for friend class declaration");
- volatilep = 0;
- }
- if (inlinep)
- {
- cp_error ("`inline' specified for friend class declaration");
- inlinep = 0;
- }
-
- /* Only try to do this stuff if we didn't already give up. */
- if (type != integer_type_node)
- {
- /* A friendly class? */
- if (current_class_type)
- make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type));
- else
- error ("trying to make class `%s' a friend of global scope",
- TYPE_NAME_STRING (type));
- type = void_type_node;
- }
- }
- else if (quals)
- {
- tree dummy = build_decl (TYPE_DECL, declarator, type);
- if (ctype == NULL_TREE)
- {
- my_friendly_assert (TREE_CODE (type) == METHOD_TYPE, 159);
- ctype = TYPE_METHOD_BASETYPE (type);
- }
- grok_method_quals (ctype, dummy, quals);
- type = TREE_TYPE (dummy);
- }
-
- return type;
- }
- else if (declarator == NULL_TREE && decl_context != PARM
- && decl_context != CATCHPARM
- && TREE_CODE (type) != UNION_TYPE
- && ! bitfield)
- {
- cp_error ("abstract declarator `%T' used as declaration", type);
- declarator = make_anon_name ();
- }
-
- /* `void' at top level (not within pointer)
- is allowed only in typedefs or type names.
- We don't complain about parms either, but that is because
- a better error message can be made later. */
-
- if (TYPE_MAIN_VARIANT (type) == void_type_node && decl_context != PARM)
- {
- if (! declarator)
- error ("unnamed variable or field declared void");
- else if (TREE_CODE (declarator) == IDENTIFIER_NODE)
- {
- if (IDENTIFIER_OPNAME_P (declarator))
- my_friendly_abort (356);
- else
- error ("variable or field `%s' declared void", name);
- }
- else
- error ("variable or field declared void");
- type = integer_type_node;
- }
-
- /* Now create the decl, which may be a VAR_DECL, a PARM_DECL
- or a FUNCTION_DECL, depending on DECL_CONTEXT and TYPE. */
-
- {
- register tree decl;
-
- if (decl_context == PARM)
- {
- if (ctype)
- error ("cannot use `::' in parameter declaration");
-
- /* A parameter declared as an array of T is really a pointer to T.
- One declared as a function is really a pointer to a function.
- One declared as a member is really a pointer to member. */
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- /* Transfer const-ness of array into that of type pointed to. */
- type = build_pointer_type
- (cp_build_type_variant (TREE_TYPE (type), constp, volatilep));
- volatilep = constp = 0;
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE)
- type = build_pointer_type (type);
- else if (TREE_CODE (type) == OFFSET_TYPE)
- type = build_pointer_type (type);
- else if (type == void_type_node && declarator)
- {
- error ("declaration of `%s' as void", name);
- return NULL_TREE;
- }
-
- decl = build_decl (PARM_DECL, declarator, complete_type (type));
-
- bad_specifiers (decl, "parameter", virtualp, quals != NULL_TREE,
- inlinep, friendp, raises != NULL_TREE);
- if (current_class_type
- && IS_SIGNATURE (current_class_type))
- {
- if (inlinep)
- error ("parameter of signature member function declared `inline'");
- if (RIDBIT_SETP (RID_AUTO, specbits))
- error ("parameter of signature member function declared `auto'");
- if (RIDBIT_SETP (RID_REGISTER, specbits))
- error ("parameter of signature member function declared `register'");
- }
-
- /* Compute the type actually passed in the parmlist,
- for the case where there is no prototype.
- (For example, shorts and chars are passed as ints.)
- When there is a prototype, this is overridden later. */
-
- DECL_ARG_TYPE (decl) = type_promotes_to (type);
- }
- else if (decl_context == FIELD)
- {
- if (type == error_mark_node)
- {
- /* Happens when declaring arrays of sizes which
- are error_mark_node, for example. */
- decl = NULL_TREE;
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- int publicp = 0;
-
- /* We catch the others as conflicts with the builtin
- typedefs. */
- if (friendp && declarator == ridpointers[(int) RID_SIGNED])
- {
- cp_error ("function `%D' cannot be declared friend",
- declarator);
- friendp = 0;
- }
-
- if (friendp == 0)
- {
- if (ctype == NULL_TREE)
- ctype = current_class_type;
-
- if (ctype == NULL_TREE)
- {
- cp_error ("can't make `%D' into a method -- not in a class",
- declarator);
- return void_type_node;
- }
-
- /* ``A union may [ ... ] not [ have ] virtual functions.''
- ARM 9.5 */
- if (virtualp && TREE_CODE (ctype) == UNION_TYPE)
- {
- cp_error ("function `%D' declared virtual inside a union",
- declarator);
- return void_type_node;
- }
-
- if (declarator == ansi_opname[(int) NEW_EXPR]
- || declarator == ansi_opname[(int) VEC_NEW_EXPR]
- || declarator == ansi_opname[(int) DELETE_EXPR]
- || declarator == ansi_opname[(int) VEC_DELETE_EXPR])
- {
- if (virtualp)
- {
- cp_error ("`%D' cannot be declared virtual, since it is always static",
- declarator);
- virtualp = 0;
- }
- }
- else if (staticp < 2)
- type = build_cplus_method_type (build_type_variant (ctype, constp, volatilep),
- TREE_TYPE (type), TYPE_ARG_TYPES (type));
- }
-
- /* Tell grokfndecl if it needs to set TREE_PUBLIC on the node. */
- publicp = (! friendp
- || RIDBIT_SETP (RID_EXTERN, specbits)
- || ! (funcdef_flag < 0 || inlinep));
- decl = grokfndecl (ctype, type, declarator,
- virtualp, flags, quals, raises, attrlist,
- friendp ? -1 : 0, publicp, inlinep,
- funcdef_flag);
- if (decl == NULL_TREE)
- return NULL_TREE;
-#if 0
- /* This clobbers the attrs stored in `decl' from `attrlist'. */
- /* The decl and setting of decl_machine_attr is also turned off. */
- decl = build_decl_attribute_variant (decl, decl_machine_attr);
-#endif
-
- if (explicitp == 2)
- DECL_NONCONVERTING_P (decl) = 1;
- }
- else if (TREE_CODE (type) == METHOD_TYPE)
- {
- /* We only get here for friend declarations of
- members of other classes. */
- /* All method decls are public, so tell grokfndecl to set
- TREE_PUBLIC, also. */
- decl = grokfndecl (ctype, type, declarator,
- virtualp, flags, quals, raises, attrlist,
- friendp ? -1 : 0, 1, 0, funcdef_flag);
- if (decl == NULL_TREE)
- return NULL_TREE;
- }
- else if (!staticp && ! processing_template_decl
- && TYPE_SIZE (complete_type (type)) == NULL_TREE
- && (TREE_CODE (type) != ARRAY_TYPE || initialized == 0))
- {
- if (declarator)
- cp_error ("field `%D' has incomplete type", declarator);
- else
- cp_error ("name `%T' has incomplete type", type);
-
- /* If we're instantiating a template, tell them which
- instantiation made the field's type be incomplete. */
- if (current_class_type
- && TYPE_NAME (current_class_type)
- && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (current_class_type))
- && declspecs && TREE_VALUE (declspecs)
- && TREE_TYPE (TREE_VALUE (declspecs)) == type)
- cp_error (" in instantiation of template `%T'",
- current_class_type);
-
- type = error_mark_node;
- decl = NULL_TREE;
- }
- else
- {
- if (friendp)
- {
- error ("`%s' is neither function nor method; cannot be declared friend",
- IDENTIFIER_POINTER (declarator));
- friendp = 0;
- }
- decl = NULL_TREE;
- }
-
- if (friendp)
- {
- /* Friends are treated specially. */
- if (ctype == current_class_type)
- warning ("member functions are implicitly friends of their class");
- else
- {
- tree t = NULL_TREE;
- if (decl && DECL_NAME (decl))
- t = do_friend (ctype, declarator, decl,
- last_function_parms, flags, quals,
- funcdef_flag);
- if (t && funcdef_flag)
- return t;
-
- return void_type_node;
- }
- }
-
- /* Structure field. It may not be a function, except for C++ */
-
- if (decl == NULL_TREE)
- {
- if (initialized)
- {
- /* Motion 10 at San Diego: If a static const integral data
- member is initialized with an integral constant
- expression, the initializer may appear either in the
- declaration (within the class), or in the definition,
- but not both. If it appears in the class, the member is
- a member constant. The file-scope definition is always
- required. */
- if (staticp)
- {
- if (pedantic)
- {
- if (! constp)
- cp_pedwarn ("ANSI C++ forbids in-class initialization of non-const static member `%D'",
- declarator);
-
- else if (! INTEGRAL_TYPE_P (type))
- cp_pedwarn ("ANSI C++ forbids member constant `%D' of non-integral type `%T'", declarator, type);
- }
- }
-
- /* Note that initialization of const members is prohibited
- by the draft ANSI standard, though it appears to be in
- common practice. 12.6.2: The argument list is used to
- initialize the named nonstatic member.... This (or an
- initializer list) is the only way to initialize
- nonstatic const and reference members. */
- else if (pedantic || ! constp)
- cp_pedwarn ("ANSI C++ forbids initialization of %s `%D'",
- constp ? "const member" : "member", declarator);
- }
-
- if (staticp || (constp && initialized))
- {
- /* ANSI C++ Apr '95 wp 9.2 */
- if (staticp && declarator == current_class_name)
- cp_pedwarn ("ANSI C++ forbids static member `%D' with same name as enclosing class",
- declarator);
-
- /* C++ allows static class members.
- All other work for this is done by grokfield.
- This VAR_DECL is built by build_lang_field_decl.
- All other VAR_DECLs are built by build_decl. */
- decl = build_lang_field_decl (VAR_DECL, declarator, type);
- TREE_STATIC (decl) = 1;
- /* In class context, 'static' means public access. */
- TREE_PUBLIC (decl) = DECL_EXTERNAL (decl) = !!staticp;
- }
- else
- {
- decl = build_lang_field_decl (FIELD_DECL, declarator, type);
- if (RIDBIT_SETP (RID_MUTABLE, specbits))
- {
- DECL_MUTABLE_P (decl) = 1;
- RIDBIT_RESET (RID_MUTABLE, specbits);
- }
- }
-
- bad_specifiers (decl, "field", virtualp, quals != NULL_TREE,
- inlinep, friendp, raises != NULL_TREE);
- }
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE)
- {
- tree original_name = declarator;
- int publicp = 0;
-
- if (! declarator)
- return NULL_TREE;
-
- if (RIDBIT_SETP (RID_AUTO, specbits))
- error ("storage class `auto' invalid for function `%s'", name);
- else if (RIDBIT_SETP (RID_REGISTER, specbits))
- error ("storage class `register' invalid for function `%s'", name);
-
- /* Function declaration not at top level.
- Storage classes other than `extern' are not allowed
- and `extern' makes no difference. */
- if (! toplevel_bindings_p ()
- && (RIDBIT_SETP (RID_STATIC, specbits)
- || RIDBIT_SETP (RID_INLINE, specbits))
- && pedantic)
- {
- if (RIDBIT_SETP (RID_STATIC, specbits))
- pedwarn ("storage class `static' invalid for function `%s' declared out of global scope", name);
- else
- pedwarn ("storage class `inline' invalid for function `%s' declared out of global scope", name);
- }
-
- if (ctype == NULL_TREE)
- {
- if (virtualp)
- {
- error ("virtual non-class function `%s'", name);
- virtualp = 0;
- }
-
- if (current_lang_name == lang_name_cplusplus
- && ! processing_template_decl
- && ! (IDENTIFIER_LENGTH (original_name) == 4
- && IDENTIFIER_POINTER (original_name)[0] == 'm'
- && strcmp (IDENTIFIER_POINTER (original_name), "main") == 0)
- && ! (IDENTIFIER_LENGTH (original_name) > 10
- && IDENTIFIER_POINTER (original_name)[0] == '_'
- && IDENTIFIER_POINTER (original_name)[1] == '_'
- && strncmp (IDENTIFIER_POINTER (original_name)+2, "builtin_", 8) == 0))
- /* Plain overloading: will not be grok'd by grokclassfn. */
- declarator = build_decl_overload (dname, TYPE_ARG_TYPES (type), 0);
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE && staticp < 2)
- type = build_cplus_method_type (build_type_variant (ctype, constp, volatilep),
- TREE_TYPE (type), TYPE_ARG_TYPES (type));
-
- /* Record presence of `static'. In C++, `inline' implies `static'. */
- publicp = (ctype != NULL_TREE
- || RIDBIT_SETP (RID_EXTERN, specbits)
- || (!RIDBIT_SETP (RID_STATIC, specbits)
- && !RIDBIT_SETP (RID_INLINE, specbits)));
-
- decl = grokfndecl (ctype, type, original_name,
- virtualp, flags, quals, raises, attrlist,
- friendp ? 2 : 1,
- publicp, inlinep, funcdef_flag);
- if (decl == NULL_TREE)
- return NULL_TREE;
-
- if (ctype == NULL_TREE && DECL_LANGUAGE (decl) != lang_c)
- DECL_ASSEMBLER_NAME (decl) = current_namespace_id (declarator);
-
- if (staticp == 1)
- {
- int illegal_static = 0;
-
- /* Don't allow a static member function in a class, and forbid
- declaring main to be static. */
- if (TREE_CODE (type) == METHOD_TYPE)
- {
- cp_pedwarn ("cannot declare member function `%D' to have static linkage", decl);
- illegal_static = 1;
- }
- else if (current_function_decl)
- {
- /* FIXME need arm citation */
- error ("cannot declare static function inside another function");
- illegal_static = 1;
- }
-
- if (illegal_static)
- {
- staticp = 0;
- RIDBIT_RESET (RID_STATIC, specbits);
- }
- }
- }
- else
- {
- /* It's a variable. */
-
- if (decl_context == CATCHPARM)
- {
- if (ctype)
- {
- ctype = NULL_TREE;
- error ("cannot use `::' in parameter declaration");
- }
-
- /* A parameter declared as an array of T is really a pointer to T.
- One declared as a function is really a pointer to a function.
- One declared as a member is really a pointer to member. */
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- /* Transfer const-ness of array into that of type
- pointed to. */
- type = build_pointer_type
- (cp_build_type_variant (TREE_TYPE (type), constp, volatilep));
- volatilep = constp = 0;
- }
- else if (TREE_CODE (type) == FUNCTION_TYPE)
- type = build_pointer_type (type);
- else if (TREE_CODE (type) == OFFSET_TYPE)
- type = build_pointer_type (type);
- }
-
- /* An uninitialized decl with `extern' is a reference. */
- decl = grokvardecl (type, declarator, &specbits, initialized, constp);
- bad_specifiers (decl, "variable", virtualp, quals != NULL_TREE,
- inlinep, friendp, raises != NULL_TREE);
-
- if (ctype)
- {
- DECL_CONTEXT (decl) = ctype;
- if (staticp == 1)
- {
- cp_pedwarn ("static member `%D' re-declared as static", decl);
- staticp = 0;
- RIDBIT_RESET (RID_STATIC, specbits);
- }
- if (RIDBIT_SETP (RID_REGISTER, specbits) && TREE_STATIC (decl))
- {
- cp_error ("static member `%D' declared `register'", decl);
- RIDBIT_RESET (RID_REGISTER, specbits);
- }
- if (RIDBIT_SETP (RID_EXTERN, specbits) && pedantic)
- {
- cp_pedwarn ("cannot explicitly declare member `%#D' to have extern linkage",
- decl);
- RIDBIT_RESET (RID_EXTERN, specbits);
- }
- }
- }
-
- if (RIDBIT_SETP (RID_MUTABLE, specbits))
- {
- error ("`%s' cannot be declared mutable", name);
- }
-
- /* Record `register' declaration for warnings on &
- and in case doing stupid register allocation. */
-
- if (RIDBIT_SETP (RID_REGISTER, specbits))
- DECL_REGISTER (decl) = 1;
-
- if (RIDBIT_SETP (RID_EXTERN, specbits))
- DECL_THIS_EXTERN (decl) = 1;
-
- if (RIDBIT_SETP (RID_STATIC, specbits))
- DECL_THIS_STATIC (decl) = 1;
-
- /* Record constancy and volatility. */
-
- if (constp)
- TREE_READONLY (decl) = TREE_CODE (type) != REFERENCE_TYPE;
- if (volatilep)
- {
- TREE_SIDE_EFFECTS (decl) = 1;
- TREE_THIS_VOLATILE (decl) = 1;
- }
-
- return decl;
- }
-}
-
-/* Tell if a parmlist/exprlist looks like an exprlist or a parmlist.
- An empty exprlist is a parmlist. An exprlist which
- contains only identifiers at the global level
- is a parmlist. Otherwise, it is an exprlist. */
-
-int
-parmlist_is_exprlist (exprs)
- tree exprs;
-{
- if (exprs == NULL_TREE || TREE_PARMLIST (exprs))
- return 0;
-
- if (toplevel_bindings_p ())
- {
- /* At the global level, if these are all identifiers,
- then it is a parmlist. */
- while (exprs)
- {
- if (TREE_CODE (TREE_VALUE (exprs)) != IDENTIFIER_NODE)
- return 1;
- exprs = TREE_CHAIN (exprs);
- }
- return 0;
- }
- return 1;
-}
-
-/* Subroutine of `grokparms'. In a fcn definition, arg types must
- be complete.
-
- C++: also subroutine of `start_function'. */
-
-static void
-require_complete_types_for_parms (parms)
- tree parms;
-{
- if (processing_template_decl)
- return;
-
- while (parms)
- {
- tree type = TREE_TYPE (parms);
- if (TYPE_SIZE (complete_type (type)) == NULL_TREE)
- {
- if (DECL_NAME (parms))
- error ("parameter `%s' has incomplete type",
- IDENTIFIER_POINTER (DECL_NAME (parms)));
- else
- error ("parameter has incomplete type");
- TREE_TYPE (parms) = error_mark_node;
- }
-#if 0
- /* If the arg types are incomplete in a declaration,
- they must include undefined tags.
- These tags can never be defined in the scope of the declaration,
- so the types can never be completed,
- and no call can be compiled successfully. */
- /* This is not the right behavior for C++, but not having
- it is also probably wrong. */
- else
- {
- /* Now warn if is a pointer to an incomplete type. */
- while (TREE_CODE (type) == POINTER_TYPE
- || TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
- type = TYPE_MAIN_VARIANT (type);
- if (TYPE_SIZE (type) == NULL_TREE)
- {
- if (DECL_NAME (parm) != NULL_TREE)
- warning ("parameter `%s' points to incomplete type",
- IDENTIFIER_POINTER (DECL_NAME (parm)));
- else
- warning ("parameter points to incomplete type");
- }
- }
-#endif
- parms = TREE_CHAIN (parms);
- }
-}
-
-/* Decode the list of parameter types for a function type.
- Given the list of things declared inside the parens,
- return a list of types.
-
- The list we receive can have three kinds of elements:
- an IDENTIFIER_NODE for names given without types,
- a TREE_LIST node for arguments given as typespecs or names with typespecs,
- or void_type_node, to mark the end of an argument list
- when additional arguments are not permitted (... was not used).
-
- FUNCDEF_FLAG is nonzero for a function definition, 0 for
- a mere declaration. A nonempty identifier-list gets an error message
- when FUNCDEF_FLAG is zero.
- If FUNCDEF_FLAG is 1, then parameter types must be complete.
- If FUNCDEF_FLAG is -1, then parameter types may be incomplete.
-
- If all elements of the input list contain types,
- we return a list of the types.
- If all elements contain no type (except perhaps a void_type_node
- at the end), we return a null list.
- If some have types and some do not, it is an error, and we
- return a null list.
-
- Also set last_function_parms to either
- a list of names (IDENTIFIER_NODEs) or a chain of PARM_DECLs.
- A list of names is converted to a chain of PARM_DECLs
- by store_parm_decls so that ultimately it is always a chain of decls.
-
- Note that in C++, parameters can take default values. These default
- values are in the TREE_PURPOSE field of the TREE_LIST. It is
- an error to specify default values which are followed by parameters
- that have no default values, or an ELLIPSES. For simplicities sake,
- only parameters which are specified with their types can take on
- default values. */
-
-static tree
-grokparms (first_parm, funcdef_flag)
- tree first_parm;
- int funcdef_flag;
-{
- tree result = NULL_TREE;
- tree decls = NULL_TREE;
-
- if (first_parm != NULL_TREE
- && TREE_CODE (TREE_VALUE (first_parm)) == IDENTIFIER_NODE)
- {
- if (! funcdef_flag)
- pedwarn ("parameter names (without types) in function declaration");
- last_function_parms = first_parm;
- return NULL_TREE;
- }
- else if (first_parm != NULL_TREE
- && TREE_CODE (TREE_VALUE (first_parm)) != TREE_LIST
- && TREE_VALUE (first_parm) != void_type_node)
- my_friendly_abort (145);
- else
- {
- /* Types were specified. This is a list of declarators
- each represented as a TREE_LIST node. */
- register tree parm, chain;
- int any_init = 0, any_error = 0;
-
- if (first_parm != NULL_TREE)
- {
- tree last_result = NULL_TREE;
- tree last_decl = NULL_TREE;
-
- for (parm = first_parm; parm != NULL_TREE; parm = chain)
- {
- tree type, list_node = parm;
- register tree decl = TREE_VALUE (parm);
- tree init = TREE_PURPOSE (parm);
-
- chain = TREE_CHAIN (parm);
- /* @@ weak defense against parse errors. */
- if (decl != void_type_node && TREE_CODE (decl) != TREE_LIST)
- {
- /* Give various messages as the need arises. */
- if (TREE_CODE (decl) == STRING_CST)
- cp_error ("invalid string constant `%E'", decl);
- else if (TREE_CODE (decl) == INTEGER_CST)
- error ("invalid integer constant in parameter list, did you forget to give parameter name?");
- continue;
- }
-
- if (decl != void_type_node)
- {
- decl = grokdeclarator (TREE_VALUE (decl),
- TREE_PURPOSE (decl),
- PARM, init != NULL_TREE,
- NULL_TREE);
- if (! decl)
- continue;
- type = TREE_TYPE (decl);
- if (TYPE_MAIN_VARIANT (type) == void_type_node)
- decl = void_type_node;
- else if (TREE_CODE (type) == METHOD_TYPE)
- {
- if (DECL_NAME (decl))
- /* Cannot use the decl here because
- we don't have DECL_CONTEXT set up yet. */
- cp_error ("parameter `%D' invalidly declared method type",
- DECL_NAME (decl));
- else
- error ("parameter invalidly declared method type");
- type = build_pointer_type (type);
- TREE_TYPE (decl) = type;
- }
- else if (TREE_CODE (type) == OFFSET_TYPE)
- {
- if (DECL_NAME (decl))
- cp_error ("parameter `%D' invalidly declared offset type",
- DECL_NAME (decl));
- else
- error ("parameter invalidly declared offset type");
- type = build_pointer_type (type);
- TREE_TYPE (decl) = type;
- }
- else if (TREE_CODE (type) == RECORD_TYPE
- && TYPE_LANG_SPECIFIC (type)
- && CLASSTYPE_ABSTRACT_VIRTUALS (type))
- {
- abstract_virtuals_error (decl, type);
- any_error = 1; /* seems like a good idea */
- }
- else if (TREE_CODE (type) == RECORD_TYPE
- && TYPE_LANG_SPECIFIC (type)
- && IS_SIGNATURE (type))
- {
- signature_error (decl, type);
- any_error = 1; /* seems like a good idea */
- }
- }
-
- if (decl == void_type_node)
- {
- if (result == NULL_TREE)
- {
- result = void_list_node;
- last_result = result;
- }
- else
- {
- TREE_CHAIN (last_result) = void_list_node;
- last_result = void_list_node;
- }
- if (chain
- && (chain != void_list_node || TREE_CHAIN (chain)))
- error ("`void' in parameter list must be entire list");
- break;
- }
-
- /* Since there is a prototype, args are passed in their own types. */
- DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
- DECL_ARG_TYPE (decl) = integer_type_node;
-#endif
- if (!any_error)
- {
- if (init)
- {
- any_init++;
- if (TREE_CODE (init) == SAVE_EXPR)
- PARM_DECL_EXPR (init) = 1;
- else if (processing_template_decl)
- ;
- else if (TREE_CODE (init) == VAR_DECL
- || TREE_CODE (init) == PARM_DECL)
- {
- if (IDENTIFIER_LOCAL_VALUE (DECL_NAME (init)))
- {
- /* ``Local variables may not be used in default
- argument expressions.'' dpANSI C++ 8.2.6 */
- /* If extern int i; within a function is not
- considered a local variable, then this code is
- wrong. */
- cp_error ("local variable `%D' may not be used as a default argument", init);
- any_error = 1;
- }
- else if (TREE_READONLY_DECL_P (init))
- init = decl_constant_value (init);
- }
- else
- init = require_instantiated_type (type, init, integer_zero_node);
- if (! processing_template_decl
- && ! can_convert_arg (type, TREE_TYPE (init), init))
- cp_pedwarn ("invalid type `%T' for default argument to `%#D'",
- TREE_TYPE (init), decl);
- }
- }
- else
- init = NULL_TREE;
-
- if (decls == NULL_TREE)
- {
- decls = decl;
- last_decl = decls;
- }
- else
- {
- TREE_CHAIN (last_decl) = decl;
- last_decl = decl;
- }
- if (TREE_PERMANENT (list_node))
- {
- TREE_PURPOSE (list_node) = init;
- TREE_VALUE (list_node) = type;
- TREE_CHAIN (list_node) = NULL_TREE;
- }
- else
- list_node = saveable_tree_cons (init, type, NULL_TREE);
- if (result == NULL_TREE)
- {
- result = list_node;
- last_result = result;
- }
- else
- {
- TREE_CHAIN (last_result) = list_node;
- last_result = list_node;
- }
- }
- if (last_result)
- TREE_CHAIN (last_result) = NULL_TREE;
- /* If there are no parameters, and the function does not end
- with `...', then last_decl will be NULL_TREE. */
- if (last_decl != NULL_TREE)
- TREE_CHAIN (last_decl) = NULL_TREE;
- }
- }
-
- last_function_parms = decls;
-
- /* In a fcn definition, arg types must be complete. */
- if (funcdef_flag > 0)
- require_complete_types_for_parms (last_function_parms);
-
- return result;
-}
-
-int
-copy_args_p (d)
- tree d;
-{
- tree t = FUNCTION_ARG_CHAIN (d);
- if (t && TREE_CODE (TREE_VALUE (t)) == REFERENCE_TYPE
- && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (t)))
- == DECL_CLASS_CONTEXT (d))
- && (TREE_CHAIN (t) == NULL_TREE
- || TREE_CHAIN (t) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (t))))
- return 1;
- return 0;
-}
-
-/* These memoizing functions keep track of special properties which
- a class may have. `grok_ctor_properties' notices whether a class
- has a constructor of the form X(X&), and also complains
- if the class has a constructor of the form X(X).
- `grok_op_properties' takes notice of the various forms of
- operator= which are defined, as well as what sorts of type conversion
- may apply. Both functions take a FUNCTION_DECL as an argument. */
-
-int
-grok_ctor_properties (ctype, decl)
- tree ctype, decl;
-{
- tree parmtypes = FUNCTION_ARG_CHAIN (decl);
- tree parmtype = parmtypes ? TREE_VALUE (parmtypes) : void_type_node;
-
- /* When a type has virtual baseclasses, a magical first int argument is
- added to any ctor so we can tell if the class has been initialized
- yet. This could screw things up in this function, so we deliberately
- ignore the leading int if we're in that situation. */
- if (parmtypes
- && TREE_VALUE (parmtypes) == integer_type_node
- && TYPE_USES_VIRTUAL_BASECLASSES (ctype))
- {
- parmtypes = TREE_CHAIN (parmtypes);
- parmtype = TREE_VALUE (parmtypes);
- }
-
- if (TREE_CODE (parmtype) == REFERENCE_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == ctype)
- {
- if (TREE_CHAIN (parmtypes) == NULL_TREE
- || TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
- {
- TYPE_HAS_INIT_REF (ctype) = 1;
- if (TYPE_READONLY (TREE_TYPE (parmtype)))
- TYPE_HAS_CONST_INIT_REF (ctype) = 1;
- }
- else
- TYPE_GETS_INIT_AGGR (ctype) = 1;
- }
- else if (TYPE_MAIN_VARIANT (parmtype) == ctype)
- {
- if (TREE_CHAIN (parmtypes) != NULL_TREE
- && TREE_CHAIN (parmtypes) == void_list_node)
- {
- cp_error ("invalid constructor; you probably meant `%T (const %T&)'",
- ctype, ctype);
- SET_IDENTIFIER_ERROR_LOCUS (DECL_NAME (decl), ctype);
-
- return 0;
- }
- else
- TYPE_GETS_INIT_AGGR (ctype) = 1;
- }
- else if (TREE_CODE (parmtype) == VOID_TYPE
- || TREE_PURPOSE (parmtypes) != NULL_TREE)
- TYPE_HAS_DEFAULT_CONSTRUCTOR (ctype) = 1;
-
- return 1;
-}
-
-/* An operator with this name can be either unary or binary. */
-
-static int
-ambi_op_p (name)
- tree name;
-{
- return (name == ansi_opname [(int) INDIRECT_REF]
- || name == ansi_opname [(int) ADDR_EXPR]
- || name == ansi_opname [(int) NEGATE_EXPR]
- || name == ansi_opname[(int) POSTINCREMENT_EXPR]
- || name == ansi_opname[(int) POSTDECREMENT_EXPR]
- || name == ansi_opname [(int) CONVERT_EXPR]);
-}
-
-/* An operator with this name can only be unary. */
-
-static int
-unary_op_p (name)
- tree name;
-{
- return (name == ansi_opname [(int) TRUTH_NOT_EXPR]
- || name == ansi_opname [(int) BIT_NOT_EXPR]
- || name == ansi_opname [(int) COMPONENT_REF]
- || OPERATOR_TYPENAME_P (name));
-}
-
-/* Do a little sanity-checking on how they declared their operator. */
-
-void
-grok_op_properties (decl, virtualp, friendp)
- tree decl;
- int virtualp, friendp;
-{
- tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));
- int methodp = (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE);
- tree name = DECL_NAME (decl);
-
- if (current_class_type == NULL_TREE)
- friendp = 1;
-
- if (! friendp)
- {
- if (name == ansi_opname[(int) MODIFY_EXPR])
- TYPE_HAS_ASSIGNMENT (current_class_type) = 1;
- else if (name == ansi_opname[(int) CALL_EXPR])
- TYPE_OVERLOADS_CALL_EXPR (current_class_type) = 1;
- else if (name == ansi_opname[(int) ARRAY_REF])
- TYPE_OVERLOADS_ARRAY_REF (current_class_type) = 1;
- else if (name == ansi_opname[(int) COMPONENT_REF]
- || name == ansi_opname[(int) MEMBER_REF])
- TYPE_OVERLOADS_ARROW (current_class_type) = 1;
- else if (name == ansi_opname[(int) NEW_EXPR])
- TYPE_GETS_NEW (current_class_type) |= 1;
- else if (name == ansi_opname[(int) DELETE_EXPR])
- TYPE_GETS_DELETE (current_class_type) |= 1;
- else if (name == ansi_opname[(int) VEC_NEW_EXPR])
- TYPE_GETS_NEW (current_class_type) |= 2;
- else if (name == ansi_opname[(int) VEC_DELETE_EXPR])
- TYPE_GETS_DELETE (current_class_type) |= 2;
- }
-
- if (name == ansi_opname[(int) NEW_EXPR]
- || name == ansi_opname[(int) VEC_NEW_EXPR])
- {
- /* When the compiler encounters the definition of A::operator new, it
- doesn't look at the class declaration to find out if it's static. */
- if (methodp)
- revert_static_member_fn (&decl, NULL, NULL);
-
- /* Take care of function decl if we had syntax errors. */
- if (argtypes == NULL_TREE)
- TREE_TYPE (decl) =
- build_function_type (ptr_type_node,
- hash_tree_chain (integer_type_node,
- void_list_node));
- else
- TREE_TYPE (decl) = coerce_new_type (TREE_TYPE (decl));
- }
- else if (name == ansi_opname[(int) DELETE_EXPR]
- || name == ansi_opname[(int) VEC_DELETE_EXPR])
- {
- if (methodp)
- revert_static_member_fn (&decl, NULL, NULL);
-
- if (argtypes == NULL_TREE)
- TREE_TYPE (decl) =
- build_function_type (void_type_node,
- hash_tree_chain (ptr_type_node,
- void_list_node));
- else
- {
- TREE_TYPE (decl) = coerce_delete_type (TREE_TYPE (decl));
-
- if (! friendp && name == ansi_opname[(int) VEC_DELETE_EXPR]
- && (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl)))
- != void_list_node))
- TYPE_VEC_DELETE_TAKES_SIZE (current_class_type) = 1;
- }
- }
- else
- {
- /* An operator function must either be a non-static member function
- or have at least one parameter of a class, a reference to a class,
- an enumeration, or a reference to an enumeration. 13.4.0.6 */
- if (! methodp || DECL_STATIC_FUNCTION_P (decl))
- {
- if (OPERATOR_TYPENAME_P (name)
- || name == ansi_opname[(int) CALL_EXPR]
- || name == ansi_opname[(int) MODIFY_EXPR]
- || name == ansi_opname[(int) COMPONENT_REF]
- || name == ansi_opname[(int) ARRAY_REF])
- cp_error ("`%D' must be a nonstatic member function", decl);
- else
- {
- tree p = argtypes;
-
- if (DECL_STATIC_FUNCTION_P (decl))
- cp_error ("`%D' must be either a non-static member function or a non-member function", decl);
-
- if (p)
- for (; TREE_VALUE (p) != void_type_node ; p = TREE_CHAIN (p))
- {
- tree arg = TREE_VALUE (p);
- if (TREE_CODE (arg) == REFERENCE_TYPE)
- arg = TREE_TYPE (arg);
-
- /* This lets bad template code slip through. */
- if (IS_AGGR_TYPE (arg)
- || TREE_CODE (arg) == ENUMERAL_TYPE
- || TREE_CODE (arg) == TEMPLATE_TYPE_PARM)
- goto foundaggr;
- }
- cp_error
- ("`%D' must have an argument of class or enumerated type",
- decl);
- foundaggr:
- ;
- }
- }
-
- if (name == ansi_opname[(int) CALL_EXPR]
- || name == ansi_opname[(int) METHOD_CALL_EXPR])
- return; /* no restrictions on args */
-
- if (IDENTIFIER_TYPENAME_P (name) && ! DECL_TEMPLATE_INFO (decl))
- {
- tree t = TREE_TYPE (name);
- if (TREE_CODE (t) == VOID_TYPE)
- pedwarn ("void is not a valid type conversion operator");
- else if (! friendp)
- {
- int ref = (TREE_CODE (t) == REFERENCE_TYPE);
- char *what = 0;
- if (ref)
- t = TYPE_MAIN_VARIANT (TREE_TYPE (t));
-
- if (t == current_class_type)
- what = "the same type";
- /* Don't force t to be complete here. */
- else if (IS_AGGR_TYPE (t)
- && TYPE_SIZE (t)
- && DERIVED_FROM_P (t, current_class_type))
- what = "a base class";
-
- if (what)
- warning ("conversion to %s%s will never use a type conversion operator",
- ref ? "a reference to " : "", what);
- }
- }
-
- if (name == ansi_opname[(int) MODIFY_EXPR])
- {
- tree parmtype;
-
- if (list_length (argtypes) != 3 && methodp)
- {
- cp_error ("`%D' must take exactly one argument", decl);
- return;
- }
- parmtype = TREE_VALUE (TREE_CHAIN (argtypes));
-
- if (copy_assignment_arg_p (parmtype, virtualp)
- && ! friendp)
- {
- TYPE_HAS_ASSIGN_REF (current_class_type) = 1;
- if (TREE_CODE (parmtype) != REFERENCE_TYPE
- || TYPE_READONLY (TREE_TYPE (parmtype)))
- TYPE_HAS_CONST_ASSIGN_REF (current_class_type) = 1;
- }
- }
- else if (name == ansi_opname[(int) COND_EXPR])
- {
- /* 13.4.0.3 */
- pedwarn ("ANSI C++ prohibits overloading operator ?:");
- if (list_length (argtypes) != 4)
- cp_error ("`%D' must take exactly three arguments", decl);
- }
- else if (ambi_op_p (name))
- {
- if (list_length (argtypes) == 2)
- /* prefix */;
- else if (list_length (argtypes) == 3)
- {
- if ((name == ansi_opname[(int) POSTINCREMENT_EXPR]
- || name == ansi_opname[(int) POSTDECREMENT_EXPR])
- && ! processing_template_decl
- && TREE_VALUE (TREE_CHAIN (argtypes)) != integer_type_node)
- {
- if (methodp)
- cp_error ("postfix `%D' must take `int' as its argument",
- decl);
- else
- cp_error
- ("postfix `%D' must take `int' as its second argument",
- decl);
- }
- }
- else
- {
- if (methodp)
- cp_error ("`%D' must take either zero or one argument", decl);
- else
- cp_error ("`%D' must take either one or two arguments", decl);
- }
-
- /* More Effective C++ rule 6. */
- if (extra_warnings
- && (name == ansi_opname[(int) POSTINCREMENT_EXPR]
- || name == ansi_opname[(int) POSTDECREMENT_EXPR]))
- {
- tree arg = TREE_VALUE (argtypes);
- tree ret = TREE_TYPE (TREE_TYPE (decl));
- if (methodp || TREE_CODE (arg) == REFERENCE_TYPE)
- arg = TREE_TYPE (arg);
- arg = TYPE_MAIN_VARIANT (arg);
- if (list_length (argtypes) == 2)
- {
- if (TREE_CODE (ret) != REFERENCE_TYPE
- || !comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (ret)),
- arg, 1))
- cp_warning ("prefix `%D' should return `%T'", decl,
- build_reference_type (arg));
- }
- else
- {
- if (!comptypes (TYPE_MAIN_VARIANT (ret), arg, 1))
- cp_warning ("postfix `%D' should return `%T'", decl, arg);
- }
- }
- }
- else if (unary_op_p (name))
- {
- if (list_length (argtypes) != 2)
- {
- if (methodp)
- cp_error ("`%D' must take `void'", decl);
- else
- cp_error ("`%D' must take exactly one argument", decl);
- }
- }
- else /* if (binary_op_p (name)) */
- {
- if (list_length (argtypes) != 3)
- {
- if (methodp)
- cp_error ("`%D' must take exactly one argument", decl);
- else
- cp_error ("`%D' must take exactly two arguments", decl);
- }
-
- /* More Effective C++ rule 7. */
- if (extra_warnings
- && (name == ansi_opname [TRUTH_ANDIF_EXPR]
- || name == ansi_opname [TRUTH_ORIF_EXPR]
- || name == ansi_opname [COMPOUND_EXPR]))
- cp_warning ("user-defined `%D' always evaluates both arguments",
- decl);
- }
-
- /* Effective C++ rule 23. */
- if (extra_warnings
- && list_length (argtypes) == 3
- && (name == ansi_opname [PLUS_EXPR]
- || name == ansi_opname [MINUS_EXPR]
- || name == ansi_opname [TRUNC_DIV_EXPR]
- || name == ansi_opname [MULT_EXPR])
- && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == REFERENCE_TYPE)
- cp_warning ("`%D' should return by value", decl);
-
- /* 13.4.0.8 */
- if (argtypes)
- for (; argtypes != void_list_node ; argtypes = TREE_CHAIN (argtypes))
- if (TREE_PURPOSE (argtypes))
- {
- TREE_PURPOSE (argtypes) = NULL_TREE;
- if (name == ansi_opname[(int) POSTINCREMENT_EXPR]
- || name == ansi_opname[(int) POSTDECREMENT_EXPR])
- {
- if (pedantic)
- cp_pedwarn ("`%D' cannot have default arguments", decl);
- }
- else
- cp_error ("`%D' cannot have default arguments", decl);
- }
- }
-}
-
-/* Get the struct, enum or union (CODE says which) with tag NAME.
- Define the tag as a forward-reference if it is not defined.
-
- C++: If a class derivation is given, process it here, and report
- an error if multiple derivation declarations are not identical.
-
- If this is a definition, come in through xref_tag and only look in
- the current frame for the name (since C++ allows new names in any
- scope.) */
-
-tree
-xref_tag (code_type_node, name, binfo, globalize)
- tree code_type_node;
- tree name, binfo;
- int globalize;
-{
- enum tag_types tag_code;
- enum tree_code code;
- int temp = 0;
- register tree ref, t;
- struct binding_level *b = inner_binding_level;
- int got_type = 0;
-
- tag_code = (enum tag_types) TREE_INT_CST_LOW (code_type_node);
- switch (tag_code)
- {
- case record_type:
- case class_type:
- case signature_type:
- code = RECORD_TYPE;
- break;
- case union_type:
- code = UNION_TYPE;
- break;
- case enum_type:
- code = ENUMERAL_TYPE;
- break;
- default:
- my_friendly_abort (18);
- }
-
- /* If a cross reference is requested, look up the type
- already defined for this tag and return it. */
- if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
- {
- t = name;
- name = TYPE_IDENTIFIER (t);
- got_type = 1;
- }
- else
- t = IDENTIFIER_TYPE_VALUE (name);
- if (t && TREE_CODE (t) != code && TREE_CODE (t) != TEMPLATE_TYPE_PARM)
- t = NULL_TREE;
-
- if (! globalize)
- {
- if (pedantic && t && TREE_CODE (t) == TEMPLATE_TYPE_PARM)
- {
- cp_pedwarn ("redeclaration of template type-parameter `%T'", name);
- cp_pedwarn_at (" previously declared here", t);
- }
- if (t && TYPE_CONTEXT (t) && got_type)
- ref = t;
- else
- {
- /* If we know we are defining this tag, only look it up in
- this scope and don't try to find it as a type. */
- ref = lookup_tag (code, name, b, 1);
- }
- }
- else
- {
- if (t)
- ref = t;
- else
- ref = lookup_tag (code, name, b, 0);
-
- if (! ref)
- {
- /* Try finding it as a type declaration. If that wins, use it. */
- ref = lookup_name (name, 1);
- if (ref && TREE_CODE (ref) == TYPE_DECL
- && TREE_CODE (TREE_TYPE (ref)) == code)
- ref = TREE_TYPE (ref);
- else
- ref = NULL_TREE;
- }
- }
-
- push_obstacks_nochange ();
-
- if (! ref)
- {
- /* If no such tag is yet defined, create a forward-reference node
- and record it as the "definition".
- When a real declaration of this type is found,
- the forward-reference will be altered into a real type. */
-
- /* In C++, since these migrate into the global scope, we must
- build them on the permanent obstack. */
-
- temp = allocation_temporary_p ();
- if (temp)
- end_temporary_allocation ();
-
- if (code == ENUMERAL_TYPE)
- {
- cp_error ("use of enum `%#D' without previous declaration", name);
-
- ref = make_node (ENUMERAL_TYPE);
-
- /* Give the type a default layout like unsigned int
- to avoid crashing if it does not get defined. */
- TYPE_MODE (ref) = TYPE_MODE (unsigned_type_node);
- TYPE_ALIGN (ref) = TYPE_ALIGN (unsigned_type_node);
- TREE_UNSIGNED (ref) = 1;
- TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node);
- TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node);
- TYPE_MAX_VALUE (ref) = TYPE_MAX_VALUE (unsigned_type_node);
-
- /* Enable us to recognize when a type is created in class context.
- To do nested classes correctly, this should probably be cleared
- out when we leave this classes scope. Currently this in only
- done in `start_enum'. */
-
- pushtag (name, ref, globalize);
- }
- else
- {
- struct binding_level *old_b = class_binding_level;
-
- ref = make_lang_type (code);
-
- if (tag_code == signature_type)
- {
- SET_SIGNATURE (ref);
- /* Since a signature type will be turned into the type
- of signature tables, it's not only an interface. */
- CLASSTYPE_INTERFACE_ONLY (ref) = 0;
- SET_CLASSTYPE_INTERFACE_KNOWN (ref);
- /* A signature doesn't have a vtable. */
- CLASSTYPE_VTABLE_NEEDS_WRITING (ref) = 0;
- }
-
-#ifdef NONNESTED_CLASSES
- /* Class types don't nest the way enums do. */
- class_binding_level = (struct binding_level *)0;
-#endif
- pushtag (name, ref, globalize);
- class_binding_level = old_b;
- }
- }
- else
- {
- /* If it no longer looks like a nested type, make sure it's
- in global scope. */
- if (b == global_binding_level && !class_binding_level
- && IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE)
- IDENTIFIER_GLOBAL_VALUE (name) = TYPE_NAME (ref);
- }
-
- if (binfo)
- xref_basetypes (code_type_node, name, ref, binfo);
-
- just_return:
-
- /* Until the type is defined, tentatively accept whatever
- structure tag the user hands us. */
- if (TYPE_SIZE (ref) == NULL_TREE
- && ref != current_class_type
- /* Have to check this, in case we have contradictory tag info. */
- && IS_AGGR_TYPE_CODE (TREE_CODE (ref)))
- {
- if (tag_code == class_type)
- CLASSTYPE_DECLARED_CLASS (ref) = 1;
- else if (tag_code == record_type || tag_code == signature_type)
- CLASSTYPE_DECLARED_CLASS (ref) = 0;
- }
-
- pop_obstacks ();
-
- return ref;
-}
-
-tree
-xref_tag_from_type (old, id, globalize)
- tree old, id;
- int globalize;
-{
- tree code_type_node;
-
- if (TREE_CODE (old) == RECORD_TYPE)
- code_type_node = (CLASSTYPE_DECLARED_CLASS (old)
- ? class_type_node : record_type_node);
- else
- code_type_node = union_type_node;
-
- if (id == NULL_TREE)
- id = TYPE_IDENTIFIER (old);
-
- return xref_tag (code_type_node, id, NULL_TREE, globalize);
-}
-
-void
-xref_basetypes (code_type_node, name, ref, binfo)
- tree code_type_node;
- tree name, ref;
- tree binfo;
-{
- /* In the declaration `A : X, Y, ... Z' we mark all the types
- (A, X, Y, ..., Z) so we can check for duplicates. */
- tree binfos;
- int i, len;
- enum tag_types tag_code = (enum tag_types) TREE_INT_CST_LOW (code_type_node);
-
- if (tag_code == union_type)
- {
- cp_error ("derived union `%T' invalid", ref);
- return;
- }
-
- len = list_length (binfo);
- push_obstacks (TYPE_OBSTACK (ref), TYPE_OBSTACK (ref));
-
- SET_CLASSTYPE_MARKED (ref);
- BINFO_BASETYPES (TYPE_BINFO (ref)) = binfos = make_tree_vec (len);
-
- for (i = 0; binfo; binfo = TREE_CHAIN (binfo))
- {
- /* The base of a derived struct is public by default. */
- int via_public
- = (TREE_PURPOSE (binfo) == access_public_node
- || TREE_PURPOSE (binfo) == access_public_virtual_node
- || (tag_code != class_type
- && (TREE_PURPOSE (binfo) == access_default_node
- || TREE_PURPOSE (binfo) == access_default_virtual_node)));
- int via_protected = TREE_PURPOSE (binfo) == access_protected_node;
- int via_virtual
- = (TREE_PURPOSE (binfo) == access_private_virtual_node
- || TREE_PURPOSE (binfo) == access_public_virtual_node
- || TREE_PURPOSE (binfo) == access_default_virtual_node);
- tree basetype = TREE_VALUE (binfo);
- tree base_binfo;
-
- GNU_xref_hier (IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (TREE_VALUE (binfo)),
- via_public, via_virtual, 0);
-
- if (basetype && TREE_CODE (basetype) == TYPE_DECL)
- basetype = TREE_TYPE (basetype);
- if (!basetype
- || (TREE_CODE (basetype) != RECORD_TYPE
- && TREE_CODE (basetype) != TYPENAME_TYPE
- && TREE_CODE (basetype) != TEMPLATE_TYPE_PARM))
- {
- cp_error ("base type `%T' fails to be a struct or class type",
- TREE_VALUE (binfo));
- continue;
- }
-#if 1
- /* This code replaces similar code in layout_basetypes. */
- else if (TYPE_SIZE (complete_type (basetype)) == NULL_TREE
- && ! (current_template_parms && uses_template_parms (basetype)))
- {
- cp_error ("base class `%T' has incomplete type", basetype);
- continue;
- }
-#endif
- else
- {
- if (CLASSTYPE_MARKED (basetype))
- {
- if (basetype == ref)
- cp_error ("recursive type `%T' undefined", basetype);
- else
- cp_error ("duplicate base type `%T' invalid", basetype);
- continue;
- }
-
- /* Effective C++ rule 14. The case of virtual functions but
- non-virtual dtor is handled in finish_struct_1. */
- if (warn_nonvdtor && ! TYPE_VIRTUAL_P (basetype)
- && TYPE_HAS_DESTRUCTOR (basetype))
- cp_warning ("base class `%#T' has a non-virtual destructor",
- basetype);
-
- /* Note that the BINFO records which describe individual
- inheritances are *not* shared in the lattice! They
- cannot be shared because a given baseclass may be
- inherited with different `accessibility' by different
- derived classes. (Each BINFO record describing an
- individual inheritance contains flags which say what
- the `accessibility' of that particular inheritance is.) */
-
- base_binfo = make_binfo (integer_zero_node, basetype,
- TYPE_BINFO_VTABLE (basetype),
- TYPE_BINFO_VIRTUALS (basetype), NULL_TREE);
-
- TREE_VEC_ELT (binfos, i) = base_binfo;
- TREE_VIA_PUBLIC (base_binfo) = via_public;
- TREE_VIA_PROTECTED (base_binfo) = via_protected;
- TREE_VIA_VIRTUAL (base_binfo) = via_virtual;
- BINFO_INHERITANCE_CHAIN (base_binfo) = TYPE_BINFO (ref);
-
- SET_CLASSTYPE_MARKED (basetype);
-
- /* We are free to modify these bits because they are meaningless
- at top level, and BASETYPE is a top-level type. */
- if (via_virtual || TYPE_USES_VIRTUAL_BASECLASSES (basetype))
- {
- TYPE_USES_VIRTUAL_BASECLASSES (ref) = 1;
- TYPE_USES_COMPLEX_INHERITANCE (ref) = 1;
- }
-
- TYPE_OVERLOADS_METHOD_CALL_EXPR (ref) |= TYPE_OVERLOADS_METHOD_CALL_EXPR (basetype);
- TYPE_GETS_NEW (ref) |= TYPE_GETS_NEW (basetype);
- TYPE_GETS_DELETE (ref) |= TYPE_GETS_DELETE (basetype);
- CLASSTYPE_LOCAL_TYPEDECLS (ref) |= CLASSTYPE_LOCAL_TYPEDECLS (basetype);
- i += 1;
- }
- }
- if (i)
- TREE_VEC_LENGTH (binfos) = i;
- else
- BINFO_BASETYPES (TYPE_BINFO (ref)) = NULL_TREE;
-
- if (i > 1)
- TYPE_USES_MULTIPLE_INHERITANCE (ref) = 1;
- else if (i == 1)
- TYPE_USES_MULTIPLE_INHERITANCE (ref)
- = TYPE_USES_MULTIPLE_INHERITANCE (BINFO_TYPE (TREE_VEC_ELT (binfos, 0)));
- if (TYPE_USES_MULTIPLE_INHERITANCE (ref))
- TYPE_USES_COMPLEX_INHERITANCE (ref) = 1;
-
- /* Unmark all the types. */
- while (--i >= 0)
- CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (TREE_VEC_ELT (binfos, i)));
- CLEAR_CLASSTYPE_MARKED (ref);
-
- pop_obstacks ();
-}
-
-
-static tree current_local_enum = NULL_TREE;
-
-/* Begin compiling the definition of an enumeration type.
- NAME is its name (or null if anonymous).
- Returns the type object, as yet incomplete.
- Also records info about it so that build_enumerator
- may be used to declare the individual values as they are read. */
-
-tree
-start_enum (name)
- tree name;
-{
- register tree enumtype = NULL_TREE;
- struct binding_level *b = inner_binding_level;
-
- /* 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)
- enumtype = lookup_tag (ENUMERAL_TYPE, name, b, 1);
-
- if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE)
- cp_error ("multiple definition of `%#T'", enumtype);
- else
- {
- enumtype = make_node (ENUMERAL_TYPE);
- pushtag (name, enumtype, 0);
- }
-
- if (b->pseudo_global)
- cp_error ("template declaration of `%#T'", enumtype);
-
- if (current_class_type)
- TREE_ADDRESSABLE (b->tags) = 1;
-
- current_local_enum = NULL_TREE;
-
- /* We don't copy this value because build_enumerator needs to do it. */
- enum_next_value = integer_zero_node;
- enum_overflow = 0;
-
- GNU_xref_decl (current_function_decl, enumtype);
- return enumtype;
-}
-
-/* After processing and defining all the values of an enumeration type,
- install their decls in the enumeration type and finish it off.
- ENUMTYPE is the type object and VALUES a list of name-value pairs.
- Returns ENUMTYPE. */
-
-tree
-finish_enum (enumtype, values)
- register tree enumtype, values;
-{
- register tree minnode, maxnode;
- /* Calculate the maximum value of any enumerator in this type. */
-
- if (values)
- {
- register tree pair;
- register tree value = DECL_INITIAL (TREE_VALUE (values));
-
- if (! processing_template_decl)
- {
- /* Speed up the main loop by performing some precalculations */
- TREE_TYPE (TREE_VALUE (values)) = enumtype;
- TREE_TYPE (value) = enumtype;
- minnode = maxnode = value;
- }
- TREE_VALUE (values) = value;
-
- for (pair = TREE_CHAIN (values); pair; pair = TREE_CHAIN (pair))
- {
- value = DECL_INITIAL (TREE_VALUE (pair));
- if (! processing_template_decl)
- {
- TREE_TYPE (TREE_VALUE (pair)) = enumtype;
- TREE_TYPE (value) = enumtype;
- if (tree_int_cst_lt (maxnode, value))
- maxnode = value;
- else if (tree_int_cst_lt (value, minnode))
- minnode = value;
- }
- TREE_VALUE (pair) = value;
- }
- }
- else
- maxnode = minnode = integer_zero_node;
-
- TYPE_VALUES (enumtype) = nreverse (values);
-
- if (processing_template_decl)
- return enumtype;
-
- {
- int unsignedp = tree_int_cst_sgn (minnode) >= 0;
- int lowprec = min_precision (minnode, unsignedp);
- int highprec = min_precision (maxnode, unsignedp);
- int precision = MAX (lowprec, highprec);
-
- TYPE_SIZE (enumtype) = NULL_TREE;
-
- /* Set TYPE_MIN_VALUE and TYPE_MAX_VALUE according to `precision'. */
-
- TYPE_PRECISION (enumtype) = precision;
- if (unsignedp)
- fixup_unsigned_type (enumtype);
- else
- fixup_signed_type (enumtype);
-
- if (flag_short_enums || (precision > TYPE_PRECISION (integer_type_node)))
- /* Use the width of the narrowest normal C type which is wide enough. */
- TYPE_PRECISION (enumtype) = TYPE_PRECISION (type_for_size
- (precision, 1));
- else
- TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node);
-
- TYPE_SIZE (enumtype) = 0;
- layout_type (enumtype);
- }
-
- {
- register tree tem;
-
- /* Fix up all variant types of this enum type. */
- for (tem = TYPE_MAIN_VARIANT (enumtype); tem;
- tem = TYPE_NEXT_VARIANT (tem))
- {
- TYPE_VALUES (tem) = TYPE_VALUES (enumtype);
- TYPE_MIN_VALUE (tem) = TYPE_MIN_VALUE (enumtype);
- TYPE_MAX_VALUE (tem) = TYPE_MAX_VALUE (enumtype);
- TYPE_SIZE (tem) = TYPE_SIZE (enumtype);
- TYPE_MODE (tem) = TYPE_MODE (enumtype);
- TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype);
- TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype);
- TREE_UNSIGNED (tem) = TREE_UNSIGNED (enumtype);
- }
- }
-
- /* Finish debugging output for this type. */
- rest_of_type_compilation (enumtype, global_bindings_p ());
-
- return enumtype;
-}
-
-/* Build and install a CONST_DECL for one value of the
- current enumeration type (one that was begun with start_enum).
- Return a tree-list containing the name and its value.
- Assignment of sequential values by default is handled here. */
-
-tree
-build_enumerator (name, value)
- tree name, value;
-{
- tree decl, result;
-
- /* Remove no-op casts from the value. */
- if (value)
- STRIP_TYPE_NOPS (value);
-
- if (! processing_template_decl)
- {
- /* Validate and default VALUE. */
- if (value != NULL_TREE)
- {
- if (TREE_READONLY_DECL_P (value))
- value = decl_constant_value (value);
-
- if (TREE_CODE (value) == INTEGER_CST)
- {
- value = default_conversion (value);
- constant_expression_warning (value);
- }
- else
- {
- cp_error ("enumerator value for `%D' not integer constant", name);
- value = NULL_TREE;
- }
- }
-
- /* Default based on previous value. */
- if (value == NULL_TREE && ! processing_template_decl)
- {
- value = enum_next_value;
- if (enum_overflow)
- cp_error ("overflow in enumeration values at `%D'", name);
- }
-
- /* Remove no-op casts from the value. */
- if (value)
- STRIP_TYPE_NOPS (value);
-
- /* We have to always copy here; not all INTEGER_CSTs are unshared,
- and there's no wedding ring. Look at size_int()...*/
- value = copy_node (value);
- TREE_TYPE (value) = integer_type_node;
- }
-
- /* C++ associates enums with global, function, or class declarations. */
-
- decl = current_scope ();
- if (decl && decl == current_class_type)
- {
- /* This enum declaration is local to the class, so we must put
- it in that class's list of decls. */
- decl = build_lang_field_decl (CONST_DECL, name, integer_type_node);
- DECL_INITIAL (decl) = value;
- TREE_READONLY (decl) = 1;
- pushdecl_class_level (decl);
- TREE_CHAIN (decl) = current_local_enum;
- current_local_enum = decl;
- }
- else
- {
- /* It's a global enum, or it's local to a function. (Note local to
- a function could mean local to a class method. */
- decl = build_decl (CONST_DECL, name, integer_type_node);
- DECL_INITIAL (decl) = value;
-
- pushdecl (decl);
- GNU_xref_decl (current_function_decl, decl);
- }
-
- if (! processing_template_decl)
- {
- /* Set basis for default for next value. */
- enum_next_value = build_binary_op_nodefault (PLUS_EXPR, value,
- integer_one_node, PLUS_EXPR);
- enum_overflow = tree_int_cst_lt (enum_next_value, value);
- }
-
- result = saveable_tree_cons (name, decl, NULL_TREE);
- return result;
-}
-
-tree
-grok_enum_decls (type, decl)
- tree type, decl;
-{
- tree d = current_local_enum;
-
- if (d == NULL_TREE)
- return decl;
-
- while (1)
- {
- TREE_TYPE (d) = type;
- if (TREE_CHAIN (d) == NULL_TREE)
- {
- TREE_CHAIN (d) = decl;
- break;
- }
- d = TREE_CHAIN (d);
- }
-
- decl = current_local_enum;
- current_local_enum = NULL_TREE;
-
- return decl;
-}
-
-static int function_depth;
-
-/* Create the FUNCTION_DECL for a function definition.
- DECLSPECS and DECLARATOR are the parts of the declaration;
- they describe the function's name and the type it returns,
- but twisted together in a fashion that parallels the syntax of C.
-
- This function creates a binding context for the function body
- as well as setting up the FUNCTION_DECL in current_function_decl.
-
- Returns 1 on success. If the DECLARATOR is not suitable for a function
- (it defines a datum instead), we return 0, which tells
- yyparse to report a parse error.
-
- For C++, we must first check whether that datum makes any sense.
- For example, "class A local_a(1,2);" means that variable local_a
- is an aggregate of type A, which should have a constructor
- applied to it with the argument list [1, 2].
-
- @@ There is currently no way to retrieve the storage
- @@ allocated to FUNCTION (or all of its parms) if we return
- @@ something we had previously. */
-
-int
-start_function (declspecs, declarator, attrs, pre_parsed_p)
- tree declspecs, declarator, attrs;
- int pre_parsed_p;
-{
- tree decl1;
- tree ctype = NULL_TREE;
- tree fntype;
- tree restype;
- extern int have_extern_spec;
- extern int used_extern_spec;
- int doing_friend = 0;
-
- /* Sanity check. */
- my_friendly_assert (TREE_VALUE (void_list_node) == void_type_node, 160);
- my_friendly_assert (TREE_CHAIN (void_list_node) == NULL_TREE, 161);
-
- /* Assume, until we see it does. */
- current_function_returns_value = 0;
- current_function_returns_null = 0;
- warn_about_return_type = 0;
- named_labels = 0;
- shadowed_labels = 0;
- current_function_assigns_this = 0;
- current_function_just_assigned_this = 0;
- current_function_parms_stored = 0;
- original_result_rtx = NULL_RTX;
- base_init_expr = NULL_TREE;
- current_base_init_list = NULL_TREE;
- current_member_init_list = NULL_TREE;
- ctor_label = dtor_label = NULL_TREE;
-
- clear_temp_name ();
-
- /* This should only be done once on the top most decl. */
- if (have_extern_spec && !used_extern_spec)
- {
- declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"), declspecs);
- used_extern_spec = 1;
- }
-
- if (pre_parsed_p)
- {
- decl1 = declarator;
-
- if (! DECL_ARGUMENTS (decl1)
- && !DECL_STATIC_FUNCTION_P (decl1)
- && DECL_CONTEXT (decl1)
- && TYPE_IDENTIFIER (DECL_CONTEXT (decl1))
- && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1))))
- {
- cp_error ("redeclaration of `%#D'", decl1);
- if (IDENTIFIER_CLASS_VALUE (DECL_NAME (decl1)))
- cp_error_at ("previous declaration here", IDENTIFIER_CLASS_VALUE (DECL_NAME (decl1)));
- else if (IDENTIFIER_GLOBAL_VALUE (DECL_NAME (decl1)))
- cp_error_at ("previous declaration here", IDENTIFIER_GLOBAL_VALUE (DECL_NAME (decl1)));
- }
-
- fntype = TREE_TYPE (decl1);
- if (TREE_CODE (fntype) == METHOD_TYPE)
- ctype = TYPE_METHOD_BASETYPE (fntype);
-
- /* ANSI C++ June 5 1992 WP 11.4.5. A friend function defined in a
- class is in the (lexical) scope of the class in which it is
- defined. */
- if (!ctype && DECL_FRIEND_P (decl1))
- {
- ctype = DECL_CLASS_CONTEXT (decl1);
-
- /* CTYPE could be null here if we're dealing with a template;
- for example, `inline friend float foo()' inside a template
- will have no CTYPE set. */
- if (ctype && TREE_CODE (ctype) != RECORD_TYPE)
- ctype = NULL_TREE;
- else
- doing_friend = 1;
- }
-
- /* In a fcn definition, arg types must be complete. */
- require_complete_types_for_parms (DECL_ARGUMENTS (decl1));
-
- /* In case some arg types were completed since the declaration was
- parsed, fix up the decls. */
- {
- tree t = DECL_ARGUMENTS (decl1);
- for (; t; t = TREE_CHAIN (t))
- layout_decl (t, 0);
- }
-
- last_function_parms = DECL_ARGUMENTS (decl1);
- last_function_parm_tags = NULL_TREE;
- }
- else
- {
- decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL_TREE);
- /* If the declarator is not suitable for a function definition,
- cause a syntax error. */
- if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) return 0;
-
- fntype = TREE_TYPE (decl1);
-
- restype = TREE_TYPE (fntype);
- if (IS_AGGR_TYPE (restype) && ! TYPE_PTRMEMFUNC_P (restype)
- && ! CLASSTYPE_GOT_SEMICOLON (restype))
- {
- cp_error ("semicolon missing after declaration of `%#T'", restype);
- shadow_tag (build_tree_list (NULL_TREE, restype));
- CLASSTYPE_GOT_SEMICOLON (restype) = 1;
- if (TREE_CODE (fntype) == FUNCTION_TYPE)
- fntype = build_function_type (integer_type_node,
- TYPE_ARG_TYPES (fntype));
- else
- fntype = build_cplus_method_type (build_type_variant (TYPE_METHOD_BASETYPE (fntype), TREE_READONLY (decl1), TREE_SIDE_EFFECTS (decl1)),
- integer_type_node,
- TYPE_ARG_TYPES (fntype));
- TREE_TYPE (decl1) = fntype;
- }
-
- if (TREE_CODE (fntype) == METHOD_TYPE)
- ctype = TYPE_METHOD_BASETYPE (fntype);
- else if (IDENTIFIER_LENGTH (DECL_NAME (decl1)) == 4
- && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (decl1)), "main")
- && DECL_CONTEXT (decl1) == NULL_TREE)
- {
- /* If this doesn't return integer_type, complain. */
- if (TREE_TYPE (TREE_TYPE (decl1)) != integer_type_node)
- {
- if (pedantic || warn_return_type)
- pedwarn ("return type for `main' changed to `int'");
- TREE_TYPE (decl1) = fntype = default_function_type;
- }
- warn_about_return_type = 0;
- }
- }
-
- /* Warn if function was previously implicitly declared
- (but not if we warned then). */
- if (! warn_implicit
- && IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)) != NULL_TREE)
- cp_warning_at ("`%D' implicitly declared before its definition", IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)));
-
- current_function_decl = decl1;
- /* Save the parm names or decls from this function's declarator
- where store_parm_decls will find them. */
- current_function_parms = last_function_parms;
- current_function_parm_tags = last_function_parm_tags;
-
- announce_function (decl1);
-
- if (! processing_template_decl)
- {
- if (TYPE_SIZE (complete_type (TREE_TYPE (fntype))) == NULL_TREE)
- {
- cp_error ("return-type `%#T' is an incomplete type",
- TREE_TYPE (fntype));
-
- /* Make it return void instead, but don't change the
- type of the DECL_RESULT, in case we have a named return value. */
- if (ctype)
- TREE_TYPE (decl1)
- = build_cplus_method_type (build_type_variant (ctype,
- TREE_READONLY (decl1),
- TREE_SIDE_EFFECTS (decl1)),
- void_type_node,
- FUNCTION_ARG_CHAIN (decl1));
- else
- TREE_TYPE (decl1)
- = build_function_type (void_type_node,
- TYPE_ARG_TYPES (TREE_TYPE (decl1)));
- DECL_RESULT (decl1)
- = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (TREE_TYPE (fntype)));
- TREE_READONLY (DECL_RESULT (decl1)) = TYPE_READONLY (TREE_TYPE (fntype));
- TREE_THIS_VOLATILE (DECL_RESULT (decl1)) = TYPE_VOLATILE (TREE_TYPE (fntype));
- }
-
- if (TYPE_LANG_SPECIFIC (TREE_TYPE (fntype))
- && CLASSTYPE_ABSTRACT_VIRTUALS (TREE_TYPE (fntype)))
- abstract_virtuals_error (decl1, TREE_TYPE (fntype));
- }
-
- if (warn_about_return_type)
- warning ("return-type defaults to `int'");
-
- /* Effective C++ rule 15. See also c_expand_return. */
- if (extra_warnings
- && DECL_NAME (decl1) == ansi_opname[(int) MODIFY_EXPR]
- && TREE_TYPE (fntype) == void_type_node)
- cp_warning ("`operator=' should return a reference to `*this'");
-
- /* Make the init_value nonzero so pushdecl knows this is not tentative.
- error_mark_node is replaced below (in poplevel) with the BLOCK. */
- DECL_INITIAL (decl1) = error_mark_node;
-
- /* This function exists in static storage.
- (This does not mean `static' in the C sense!) */
- TREE_STATIC (decl1) = 1;
-
- /* Record the decl so that the function name is defined.
- If we already have a decl for this name, and it is a FUNCTION_DECL,
- use the old decl. */
-
- if (processing_template_decl)
- push_template_decl (decl1);
- else if (pre_parsed_p == 0)
- {
- decl1 = pushdecl (decl1);
- DECL_MAIN_VARIANT (decl1) = decl1;
- fntype = TREE_TYPE (decl1);
- }
-
- current_function_decl = decl1;
-
- if (DECL_INTERFACE_KNOWN (decl1))
- {
- if (DECL_NOT_REALLY_EXTERN (decl1))
- DECL_EXTERNAL (decl1) = 0;
- }
- /* If this function belongs to an interface, it is public.
- If it belongs to someone else's interface, it is also external.
- It doesn't matter whether it's inline or not. */
- else if (interface_unknown == 0
- && (! DECL_TEMPLATE_INSTANTIATION (decl1)
- || flag_alt_external_templates))
- {
- if (DECL_THIS_INLINE (decl1) || DECL_TEMPLATE_INSTANTIATION (decl1)
- || processing_template_decl)
- DECL_EXTERNAL (decl1)
- = (interface_only
- || (DECL_THIS_INLINE (decl1) && ! flag_implement_inlines));
- else
- {
- DECL_EXTERNAL (decl1) = 0;
- if (DECL_C_STATIC (decl1))
- TREE_PUBLIC (decl1) = 0;
- }
- DECL_NOT_REALLY_EXTERN (decl1) = 0;
- DECL_INTERFACE_KNOWN (decl1) = 1;
- }
- else
- {
- /* This is a definition, not a reference.
- So clear DECL_EXTERNAL. */
- DECL_EXTERNAL (decl1) = 0;
-
- if ((DECL_THIS_INLINE (decl1) || DECL_TEMPLATE_INSTANTIATION (decl1))
- && ! DECL_INTERFACE_KNOWN (decl1)
- /* Don't try to defer nested functions for now. */
- && ! hack_decl_function_context (decl1))
- DECL_DEFER_OUTPUT (decl1) = 1;
- else
- {
- DECL_INTERFACE_KNOWN (decl1) = 1;
- if (DECL_C_STATIC (decl1))
- TREE_PUBLIC (decl1) = 0;
- }
- }
-
- if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1))
- {
- if (TREE_CODE (fntype) == METHOD_TYPE)
- TREE_TYPE (decl1) = fntype
- = build_function_type (TREE_TYPE (fntype),
- TREE_CHAIN (TYPE_ARG_TYPES (fntype)));
- current_function_parms = TREE_CHAIN (current_function_parms);
- DECL_ARGUMENTS (decl1) = current_function_parms;
- ctype = NULL_TREE;
- }
- restype = TREE_TYPE (fntype);
-
- if (ctype)
- {
- push_nested_class (ctype, 1);
-
- /* If we're compiling a friend function, neither of the variables
- current_class_ptr nor current_class_type will have values. */
- if (! doing_friend)
- {
- /* We know that this was set up by `grokclassfn'.
- We do not wait until `store_parm_decls', since evil
- parse errors may never get us to that point. Here
- we keep the consistency between `current_class_type'
- and `current_class_ptr'. */
- tree t = current_function_parms;
-
- my_friendly_assert (t != NULL_TREE
- && TREE_CODE (t) == PARM_DECL, 162);
-
- if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE)
- {
- int i = suspend_momentary ();
-
- /* Fool build_indirect_ref. */
- current_class_ptr = NULL_TREE;
- current_class_ref = build_indirect_ref (t, NULL_PTR);
- current_class_ptr = t;
- resume_momentary (i);
- }
- else
- /* We're having a signature pointer here. */
- current_class_ref = current_class_ptr = t;
-
- }
- }
- else
- {
- if (DECL_STATIC_FUNCTION_P (decl1))
- push_nested_class (DECL_CONTEXT (decl1), 2);
- else
- push_memoized_context (0, 1);
- current_class_ptr = current_class_ref = NULL_TREE;
- }
-
- pushlevel (0);
- current_binding_level->parm_flag = 1;
-
- GNU_xref_function (decl1, current_function_parms);
-
- if (attrs)
- cplus_decl_attributes (decl1, NULL_TREE, attrs);
- make_function_rtl (decl1);
-
- /* Promote the value to int before returning it. */
- if (C_PROMOTING_INTEGER_TYPE_P (restype))
- restype = type_promotes_to (restype);
-
- /* If this fcn was already referenced via a block-scope `extern' decl
- (or an implicit decl), propagate certain information about the usage. */
- if (TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl1)))
- TREE_ADDRESSABLE (decl1) = 1;
-
- if (DECL_RESULT (decl1) == NULL_TREE)
- {
- DECL_RESULT (decl1)
- = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype));
- TREE_READONLY (DECL_RESULT (decl1)) = TYPE_READONLY (restype);
- TREE_THIS_VOLATILE (DECL_RESULT (decl1)) = TYPE_VOLATILE (restype);
- }
-
- /* Allocate further tree nodes temporarily during compilation
- of this function only. Tiemann moved up here from bottom of fn. */
- temporary_allocation ();
-
- if (processing_template_decl)
- {
- extern tree last_tree;
- ++minimal_parse_mode;
- last_tree = DECL_SAVED_TREE (decl1)
- = build_nt (EXPR_STMT, void_zero_node);
- }
-
- ++function_depth;
-
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl1))
- && DECL_LANGUAGE (decl1) == lang_cplusplus)
- {
- dtor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
- ctor_label = NULL_TREE;
- }
- else
- {
- dtor_label = NULL_TREE;
- if (DECL_CONSTRUCTOR_P (decl1))
- ctor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
- }
-
- return 1;
-}
-
-void
-store_after_parms (insns)
- rtx insns;
-{
- rtx x;
-
- for (x = get_insns (); x; x = next_insn (x))
- {
- if (GET_CODE (x) == NOTE && NOTE_LINE_NUMBER (x) == NOTE_INSN_FUNCTION_BEG)
- {
- emit_insns_after (insns, x);
- return;
- }
- }
-#if 0
- /* This doesn't work, because the inline output routine doesn't reset
- last_parm_insn correctly for get_first_nonparm_insn () to work. */
-
- last_parm_insn = get_first_nonparm_insn ();
- if (last_parm_insn == NULL_RTX)
- emit_insns (insns);
- else
- emit_insns_before (insns, last_parm_insn);
-#endif
-}
-
-void
-expand_start_early_try_stmts ()
-{
- rtx insns;
- start_sequence ();
- expand_start_try_stmts ();
- insns = get_insns ();
- end_sequence ();
-#if 1
- emit_insns_after (insns, get_insns ());
-#else
- store_after_parms (insns);
-#endif
-}
-
-/* Store the parameter declarations into the current function declaration.
- This is called after parsing the parameter declarations, before
- digesting the body of the function.
-
- Also install to binding contour return value identifier, if any. */
-
-void
-store_parm_decls ()
-{
- register tree fndecl = current_function_decl;
- register tree parm;
- int parms_have_cleanups = 0;
-
- /* This is either a chain of PARM_DECLs (when a prototype is used). */
- tree specparms = current_function_parms;
-
- /* This is a list of types declared among parms in a prototype. */
- tree parmtags = current_function_parm_tags;
-
- /* This is a chain of any other decls that came in among the parm
- declarations. If a parm is declared with enum {foo, bar} x;
- then CONST_DECLs for foo and bar are put here. */
- tree nonparms = NULL_TREE;
-
- if (toplevel_bindings_p ())
- fatal ("parse errors have confused me too much");
-
- /* Initialize RTL machinery. */
- init_function_start (fndecl, input_filename, lineno);
-
- /* Declare __FUNCTION__ and __PRETTY_FUNCTION__ for this function. */
- declare_function_name ();
-
- /* Create a binding level for the parms. */
- expand_start_bindings (0);
-
- if (specparms != NULL_TREE)
- {
- /* This case is when the function was defined with an ANSI prototype.
- The parms already have decls, so we need not do anything here
- except record them as in effect
- and complain if any redundant old-style parm decls were written. */
-
- register tree next;
-
- /* Must clear this because it might contain TYPE_DECLs declared
- at class level. */
- storedecls (NULL_TREE);
-
- for (parm = nreverse (specparms); parm; parm = next)
- {
- next = TREE_CHAIN (parm);
- if (TREE_CODE (parm) == PARM_DECL)
- {
- tree cleanup;
- if (DECL_NAME (parm) == NULL_TREE)
- {
- pushdecl (parm);
- }
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == void_type_node)
- cp_error ("parameter `%D' declared void", parm);
- else
- {
- /* Now fill in DECL_REFERENCE_SLOT for any of the parm decls.
- A parameter is assumed not to have any side effects.
- If this should change for any reason, then this
- will have to wrap the bashed reference type in a save_expr.
-
- Also, if the parameter type is declared to be an X
- and there is an X(X&) constructor, we cannot lay it
- into the stack (any more), so we make this parameter
- look like it is really of reference type. Functions
- which pass parameters to this function will know to
- create a temporary in their frame, and pass a reference
- to that. */
-
- if (TREE_CODE (TREE_TYPE (parm)) == REFERENCE_TYPE
- && TYPE_SIZE (TREE_TYPE (TREE_TYPE (parm))))
- SET_DECL_REFERENCE_SLOT (parm, convert_from_reference (parm));
-
- pushdecl (parm);
- }
- if (! processing_template_decl
- && (cleanup = maybe_build_cleanup (parm), cleanup))
- {
- expand_decl (parm);
- if (! expand_decl_cleanup (parm, cleanup))
- cp_error ("parser lost in parsing declaration of `%D'",
- parm);
- parms_have_cleanups = 1;
- }
- }
- else
- {
- /* If we find an enum constant or a type tag,
- put it aside for the moment. */
- TREE_CHAIN (parm) = NULL_TREE;
- nonparms = chainon (nonparms, parm);
- }
- }
-
- /* Get the decls in their original chain order
- and record in the function. This is all and only the
- PARM_DECLs that were pushed into scope by the loop above. */
- DECL_ARGUMENTS (fndecl) = getdecls ();
-
- storetags (chainon (parmtags, gettags ()));
- }
- else
- DECL_ARGUMENTS (fndecl) = NULL_TREE;
-
- /* Now store the final chain of decls for the arguments
- as the decl-chain of the current lexical scope.
- Put the enumerators in as well, at the front so that
- DECL_ARGUMENTS is not modified. */
-
- storedecls (chainon (nonparms, DECL_ARGUMENTS (fndecl)));
-
- /* Initialize the RTL code for the function. */
- DECL_SAVED_INSNS (fndecl) = NULL_RTX;
- if (! processing_template_decl)
- expand_function_start (fndecl, parms_have_cleanups);
-
- /* Create a binding contour which can be used to catch
- cleanup-generated temporaries. Also, if the return value needs or
- has initialization, deal with that now. */
- if (parms_have_cleanups)
- {
- pushlevel (0);
- expand_start_bindings (0);
- }
-
- current_function_parms_stored = 1;
-
- /* If this function is `main', emit a call to `__main'
- to run global initializers, etc. */
- if (DECL_NAME (fndecl)
- && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 4
- && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main") == 0
- && DECL_CONTEXT (fndecl) == NULL_TREE)
- {
- expand_main_function ();
- }
-
- /* Take care of exception handling things. */
- if (! processing_template_decl && flag_exceptions)
- {
- rtx insns;
- start_sequence ();
-
-#if 0
- /* Mark the start of a stack unwinder if we need one. */
- start_eh_unwinder ();
-#endif
-
-#if 0
- /* Do the starting of the exception specifications, if we have any. */
- if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
- expand_start_eh_spec ();
-#endif
-
- insns = get_insns ();
- end_sequence ();
-
- if (insns)
- store_after_parms (insns);
- }
- last_dtor_insn = get_last_insn ();
-}
-
-/* Bind a name and initialization to the return value of
- the current function. */
-
-void
-store_return_init (return_id, init)
- tree return_id, init;
-{
- tree decl = DECL_RESULT (current_function_decl);
-
- if (pedantic)
- /* Give this error as many times as there are occurrences,
- so that users can use Emacs compilation buffers to find
- and fix all such places. */
- pedwarn ("ANSI C++ does not permit named return values");
-
- if (return_id != NULL_TREE)
- {
- if (DECL_NAME (decl) == NULL_TREE)
- {
- DECL_NAME (decl) = return_id;
- DECL_ASSEMBLER_NAME (decl) = return_id;
- }
- else
- cp_error ("return identifier `%D' already in place", decl);
- }
-
- /* Can't let this happen for constructors. */
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- {
- error ("can't redefine default return value for constructors");
- return;
- }
-
- /* If we have a named return value, put that in our scope as well. */
- if (DECL_NAME (decl) != NULL_TREE)
- {
- /* If this named return value comes in a register,
- put it in a pseudo-register. */
- if (DECL_REGISTER (decl))
- {
- original_result_rtx = DECL_RTL (decl);
- DECL_RTL (decl) = gen_reg_rtx (DECL_MODE (decl));
- }
-
- /* Let `cp_finish_decl' know that this initializer is ok. */
- DECL_INITIAL (decl) = init;
- pushdecl (decl);
-
- if (minimal_parse_mode)
- add_tree (build_min_nt (RETURN_INIT, return_id,
- copy_to_permanent (init)));
- else
- cp_finish_decl (decl, init, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
- }
-}
-
-
-/* Finish up a function declaration and compile that function
- all the way to assembler language output. The free the storage
- for the function definition.
-
- This is called after parsing the body of the function definition.
- LINENO is the current line number.
-
- C++: CALL_POPLEVEL is non-zero if an extra call to poplevel
- (and expand_end_bindings) must be made to take care of the binding
- contour for the base initializers. This is only relevant for
- constructors.
-
- NESTED is nonzero if we were in the middle of compiling another function
- when we started on this one. */
-
-void
-finish_function (lineno, call_poplevel, nested)
- int lineno;
- int call_poplevel;
- int nested;
-{
- register tree fndecl = current_function_decl;
- tree fntype, ctype = NULL_TREE;
- rtx last_parm_insn, insns;
- /* Label to use if this function is supposed to return a value. */
- tree no_return_label = NULL_TREE;
- tree decls = NULL_TREE;
-
- /* When we get some parse errors, we can end up without a
- current_function_decl, so cope. */
- if (fndecl == NULL_TREE)
- return;
-
- if (! nested && function_depth > 1)
- nested = 1;
-
- fntype = TREE_TYPE (fndecl);
-
-/* TREE_READONLY (fndecl) = 1;
- This caused &foo to be of type ptr-to-const-function
- which then got a warning when stored in a ptr-to-function variable. */
-
- /* This happens on strange parse errors. */
- if (! current_function_parms_stored)
- {
- call_poplevel = 0;
- store_parm_decls ();
- }
-
- if (processing_template_decl)
- {
- if (DECL_CONSTRUCTOR_P (fndecl) && call_poplevel)
- {
- decls = getdecls ();
- expand_end_bindings (decls, decls != NULL_TREE, 0);
- poplevel (decls != NULL_TREE, 0, 0);
- }
- }
- else
- {
- if (write_symbols != NO_DEBUG /*&& TREE_CODE (fntype) != METHOD_TYPE*/)
- {
- tree ttype = target_type (fntype);
- tree parmdecl;
-
- if (IS_AGGR_TYPE (ttype))
- /* Let debugger know it should output info for this type. */
- note_debug_info_needed (ttype);
-
- for (parmdecl = DECL_ARGUMENTS (fndecl); parmdecl; parmdecl = TREE_CHAIN (parmdecl))
- {
- ttype = target_type (TREE_TYPE (parmdecl));
- if (IS_AGGR_TYPE (ttype))
- /* Let debugger know it should output info for this type. */
- note_debug_info_needed (ttype);
- }
- }
-
- /* Clean house because we will need to reorder insns here. */
- do_pending_stack_adjust ();
-
- if (dtor_label)
- {
- tree binfo = TYPE_BINFO (current_class_type);
- tree cond = integer_one_node;
- tree exprstmt;
- tree in_charge_node = lookup_name (in_charge_identifier, 0);
- tree virtual_size;
- int ok_to_optimize_dtor = 0;
- int empty_dtor = get_last_insn () == last_dtor_insn;
-
- if (current_function_assigns_this)
- cond = build (NE_EXPR, boolean_type_node,
- current_class_ptr, integer_zero_node);
- else
- {
- int n_baseclasses = CLASSTYPE_N_BASECLASSES (current_class_type);
-
- /* If this destructor is empty, then we don't need to check
- whether `this' is NULL in some cases. */
- if ((flag_this_is_variable & 1) == 0)
- ok_to_optimize_dtor = 1;
- else if (empty_dtor)
- ok_to_optimize_dtor
- = (n_baseclasses == 0
- || (n_baseclasses == 1
- && TYPE_HAS_DESTRUCTOR (TYPE_BINFO_BASETYPE (current_class_type, 0))));
- }
-
- /* These initializations might go inline. Protect
- the binding level of the parms. */
- pushlevel (0);
- expand_start_bindings (0);
-
- if (current_function_assigns_this)
- {
- current_function_assigns_this = 0;
- current_function_just_assigned_this = 0;
- }
-
- /* Generate the code to call destructor on base class.
- If this destructor belongs to a class with virtual
- functions, then set the virtual function table
- pointer to represent the type of our base class. */
-
- /* This side-effect makes call to `build_delete' generate the
- code we have to have at the end of this destructor. */
- TYPE_HAS_DESTRUCTOR (current_class_type) = 0;
-
- /* These are two cases where we cannot delegate deletion. */
- if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)
- || TYPE_GETS_REG_DELETE (current_class_type))
- exprstmt = build_delete (current_class_type, current_class_ref, integer_zero_node,
- LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0);
- else
- exprstmt = build_delete (current_class_type, current_class_ref, in_charge_node,
- LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0);
-
- /* If we did not assign to this, then `this' is non-zero at
- the end of a destructor. As a special optimization, don't
- emit test if this is an empty destructor. If it does nothing,
- it does nothing. If it calls a base destructor, the base
- destructor will perform the test. */
-
- if (exprstmt != error_mark_node
- && (TREE_CODE (exprstmt) != NOP_EXPR
- || TREE_OPERAND (exprstmt, 0) != integer_zero_node
- || TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)))
- {
- expand_label (dtor_label);
- if (cond != integer_one_node)
- expand_start_cond (cond, 0);
- if (exprstmt != void_zero_node)
- /* Don't call `expand_expr_stmt' if we're not going to do
- anything, since -Wall will give a diagnostic. */
- expand_expr_stmt (exprstmt);
-
- /* Run destructor on all virtual baseclasses. */
- if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
- {
- tree vbases = nreverse (copy_list (CLASSTYPE_VBASECLASSES (current_class_type)));
- expand_start_cond (build (BIT_AND_EXPR, integer_type_node,
- in_charge_node, integer_two_node), 0);
- while (vbases)
- {
- if (TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (vbases)))
- {
- tree vb = get_vbase
- (BINFO_TYPE (vbases),
- TYPE_BINFO (current_class_type));
- expand_expr_stmt
- (build_scoped_method_call
- (current_class_ref, vb, dtor_identifier,
- build_tree_list (NULL_TREE, integer_zero_node)));
- }
- vbases = TREE_CHAIN (vbases);
- }
- expand_end_cond ();
- }
-
- do_pending_stack_adjust ();
- if (cond != integer_one_node)
- expand_end_cond ();
- }
-
- TYPE_HAS_DESTRUCTOR (current_class_type) = 1;
-
- virtual_size = c_sizeof (current_class_type);
-
- /* At the end, call delete if that's what's requested. */
- if (TYPE_GETS_REG_DELETE (current_class_type))
- /* This NOP_EXPR means we are in a static call context. */
- exprstmt =
- build_method_call
- (build_indirect_ref
- (build1 (NOP_EXPR, build_pointer_type (current_class_type),
- error_mark_node),
- NULL_PTR),
- ansi_opname[(int) DELETE_EXPR],
- tree_cons (NULL_TREE, current_class_ptr,
- build_tree_list (NULL_TREE, virtual_size)),
- NULL_TREE, LOOKUP_NORMAL);
- else if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
- exprstmt = build_x_delete (ptr_type_node, current_class_ptr, 0,
- virtual_size);
- else
- exprstmt = NULL_TREE;
-
- if (exprstmt)
- {
- cond = build (BIT_AND_EXPR, integer_type_node,
- in_charge_node, integer_one_node);
- expand_start_cond (cond, 0);
- expand_expr_stmt (exprstmt);
- expand_end_cond ();
- }
-
- /* End of destructor. */
- expand_end_bindings (NULL_TREE, getdecls () != NULL_TREE, 0);
- poplevel (2, 0, 0); /* XXX change to 1 */
-
- /* Back to the top of destructor. */
- /* Dont execute destructor code if `this' is NULL. */
-
- start_sequence ();
-
- /* If the dtor is empty, and we know there is not possible way we
- could use any vtable entries, before they are possibly set by
- a base class dtor, we don't have to setup the vtables, as we
- know that any base class dtoring will set up any vtables it
- needs. We avoid MI, because one base class dtor can do a
- virtual dispatch to an overridden function that would need to
- have a non-related vtable set up, we cannot avoid setting up
- vtables in that case. We could change this to see if there is
- just one vtable. */
- if (! empty_dtor || TYPE_USES_COMPLEX_INHERITANCE (current_class_type))
- {
- /* Make all virtual function table pointers in non-virtual base
- classes point to CURRENT_CLASS_TYPE's virtual function
- tables. */
- expand_direct_vtbls_init (binfo, binfo, 1, 0, current_class_ptr);
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
- expand_indirect_vtbls_init (binfo, current_class_ref, current_class_ptr);
- }
-
- if (! ok_to_optimize_dtor)
- {
- cond = build_binary_op (NE_EXPR,
- current_class_ptr, integer_zero_node, 1);
- expand_start_cond (cond, 0);
- }
-
- insns = get_insns ();
- end_sequence ();
-
- last_parm_insn = get_first_nonparm_insn ();
- if (last_parm_insn == NULL_RTX)
- last_parm_insn = get_last_insn ();
- else
- last_parm_insn = previous_insn (last_parm_insn);
-
- emit_insns_after (insns, last_parm_insn);
-
- if (! ok_to_optimize_dtor)
- expand_end_cond ();
- }
- else if (current_function_assigns_this)
- {
- /* Does not need to call emit_base_init, because
- that is done (if needed) just after assignment to this
- is seen. */
-
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- {
- end_protect_partials ();
- expand_label (ctor_label);
- ctor_label = NULL_TREE;
-
- if (call_poplevel)
- {
- decls = getdecls ();
- expand_end_bindings (decls, decls != NULL_TREE, 0);
- poplevel (decls != NULL_TREE, 0, 0);
- }
- c_expand_return (current_class_ptr);
- }
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (
- DECL_RESULT (current_function_decl))) != void_type_node
- && return_label != NULL_RTX)
- no_return_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- current_function_assigns_this = 0;
- current_function_just_assigned_this = 0;
- base_init_expr = NULL_TREE;
- }
- else if (DECL_CONSTRUCTOR_P (fndecl))
- {
- tree cond, thenclause;
- /* Allow constructor for a type to get a new instance of the object
- using `build_new'. */
- tree abstract_virtuals = CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type);
- CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type) = NULL_TREE;
-
- DECL_RETURNS_FIRST_ARG (fndecl) = 1;
-
- if (flag_this_is_variable > 0)
- {
- cond = build_binary_op (EQ_EXPR,
- current_class_ptr, integer_zero_node, 1);
- thenclause = build_modify_expr (current_class_ptr, NOP_EXPR,
- build_new (NULL_TREE, current_class_type, void_type_node, 0));
- }
-
- CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type) = abstract_virtuals;
-
- start_sequence ();
-
- if (flag_this_is_variable > 0)
- {
- expand_start_cond (cond, 0);
- expand_expr_stmt (thenclause);
- expand_end_cond ();
- }
-
- /* Emit insns from `emit_base_init' which sets up virtual
- function table pointer(s). */
- if (base_init_expr)
- {
- expand_expr_stmt (base_init_expr);
- base_init_expr = NULL_TREE;
- }
-
- insns = get_insns ();
- end_sequence ();
-
- /* This is where the body of the constructor begins.
- If there were no insns in this function body, then the
- last_parm_insn is also the last insn.
-
- If optimization is enabled, last_parm_insn may move, so
- we don't hold on to it (across emit_base_init). */
- last_parm_insn = get_first_nonparm_insn ();
- if (last_parm_insn == NULL_RTX)
- last_parm_insn = get_last_insn ();
- else
- last_parm_insn = previous_insn (last_parm_insn);
-
- emit_insns_after (insns, last_parm_insn);
-
- end_protect_partials ();
-
- /* This is where the body of the constructor ends. */
- expand_label (ctor_label);
- ctor_label = NULL_TREE;
-
- if (call_poplevel)
- {
- decls = getdecls ();
- expand_end_bindings (decls, decls != NULL_TREE, 0);
- poplevel (decls != NULL_TREE, 1, 0);
- }
-
- c_expand_return (current_class_ptr);
-
- current_function_assigns_this = 0;
- current_function_just_assigned_this = 0;
- }
- else if (IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 4
- && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main")
- && DECL_CONTEXT (fndecl) == NULL_TREE)
- {
- /* Make it so that `main' always returns 0 by default. */
-#ifdef VMS
- c_expand_return (integer_one_node);
-#else
- c_expand_return (integer_zero_node);
-#endif
- }
- else if (return_label != NULL_RTX
- && current_function_return_value == NULL_TREE
- && ! DECL_NAME (DECL_RESULT (current_function_decl)))
- no_return_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- /* If this function is supposed to return a value, ensure that
- we do not fall into the cleanups by mistake. The end of our
- function will look like this:
-
- user code (may have return stmt somewhere)
- goto no_return_label
- cleanup_label:
- cleanups
- goto return_label
- no_return_label:
- NOTE_INSN_FUNCTION_END
- return_label:
- things for return
-
- If the user omits a return stmt in the USER CODE section, we
- will have a control path which reaches NOTE_INSN_FUNCTION_END.
- Otherwise, we won't. */
- if (no_return_label)
- {
- DECL_CONTEXT (no_return_label) = fndecl;
- DECL_INITIAL (no_return_label) = error_mark_node;
- DECL_SOURCE_FILE (no_return_label) = input_filename;
- DECL_SOURCE_LINE (no_return_label) = lineno;
- expand_goto (no_return_label);
- }
-
- if (cleanup_label)
- {
- /* remove the binding contour which is used
- to catch cleanup-generated temporaries. */
- expand_end_bindings (0, 0, 0);
- poplevel (0, 0, 0);
- }
-
- if (cleanup_label)
- /* Emit label at beginning of cleanup code for parameters. */
- emit_label (cleanup_label);
-
- /* Get return value into register if that's where it's supposed to be. */
- if (original_result_rtx)
- fixup_result_decl (DECL_RESULT (fndecl), original_result_rtx);
-
- /* Finish building code that will trigger warnings if users forget
- to make their functions return values. */
- if (no_return_label || cleanup_label)
- emit_jump (return_label);
- if (no_return_label)
- {
- /* We don't need to call `expand_*_return' here because we
- don't need any cleanups here--this path of code is only
- for error checking purposes. */
- expand_label (no_return_label);
- }
-
- /* Generate rtl for function exit. */
- expand_function_end (input_filename, lineno, 1);
-
- if (flag_exceptions)
- expand_exception_blocks ();
- }
-
- /* This must come after expand_function_end because cleanups might
- have declarations (from inline functions) that need to go into
- this function's blocks. */
- if (current_binding_level->parm_flag != 1)
- my_friendly_abort (122);
- poplevel (1, 0, 1);
-
- /* reset scope for C++: if we were in the scope of a class,
- then when we finish this function, we are not longer so.
- This cannot be done until we know for sure that no more
- class members will ever be referenced in this function
- (i.e., calls to destructors). */
- if (current_class_name)
- {
- ctype = current_class_type;
- pop_nested_class (1);
- }
- else
- pop_memoized_context (1);
-
- /* Must mark the RESULT_DECL as being in this function. */
- DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
-
- /* Set the BLOCK_SUPERCONTEXT of the outermost function scope to point
- to the FUNCTION_DECL node itself. */
- BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
-
- if (! processing_template_decl)
- {
- /* So we can tell if jump_optimize sets it to 1. */
- can_reach_end = 0;
-
- /* Run the optimizers and output the assembler code for this function. */
- rest_of_compilation (fndecl);
-
- if (DECL_SAVED_INSNS (fndecl) && ! TREE_ASM_WRITTEN (fndecl))
- {
- /* Set DECL_EXTERNAL so that assemble_external will be called as
- necessary. We'll clear it again in finish_file. */
- if (! DECL_EXTERNAL (fndecl))
- DECL_NOT_REALLY_EXTERN (fndecl) = 1;
- DECL_EXTERNAL (fndecl) = 1;
- mark_inline_for_output (fndecl);
- }
-
- if (ctype && TREE_ASM_WRITTEN (fndecl))
- note_debug_info_needed (ctype);
-
- current_function_returns_null |= can_reach_end;
-
- /* Since we don't normally go through c_expand_return for constructors,
- this normally gets the wrong value.
- Also, named return values have their return codes emitted after
- NOTE_INSN_FUNCTION_END, confusing jump.c. */
- if (DECL_CONSTRUCTOR_P (fndecl)
- || DECL_NAME (DECL_RESULT (fndecl)) != NULL_TREE)
- current_function_returns_null = 0;
-
- if (TREE_THIS_VOLATILE (fndecl) && current_function_returns_null)
- cp_warning ("`noreturn' function `%D' does return", fndecl);
- else if ((warn_return_type || pedantic)
- && current_function_returns_null
- && TYPE_MAIN_VARIANT (TREE_TYPE (fntype)) != void_type_node)
- {
- /* If this function returns non-void and control can drop through,
- complain. */
- cp_pedwarn ("control reaches end of non-void function `%D'", fndecl);
- }
- /* With just -W, complain only if function returns both with
- and without a value. */
- else if (extra_warnings
- && current_function_returns_value && current_function_returns_null)
- warning ("this function may return with or without a value");
- }
-
- --function_depth;
-
- /* Free all the tree nodes making up this function. */
- /* Switch back to allocating nodes permanently
- until we start another function. */
- if (processing_template_decl)
- {
- --minimal_parse_mode;
- DECL_SAVED_TREE (fndecl) = TREE_CHAIN (DECL_SAVED_TREE (fndecl));
- }
-
- if (! nested)
- permanent_allocation (1);
-
- if (DECL_SAVED_INSNS (fndecl) == NULL_RTX)
- {
- tree t;
-
- /* Stop pointing to the local nodes about to be freed. */
- /* But DECL_INITIAL must remain nonzero so we know this
- was an actual function definition. */
- DECL_INITIAL (fndecl) = error_mark_node;
- for (t = DECL_ARGUMENTS (fndecl); t; t = TREE_CHAIN (t))
- DECL_RTL (t) = DECL_INCOMING_RTL (t) = NULL_RTX;
- }
-
- if (DECL_STATIC_CONSTRUCTOR (fndecl))
- static_ctors = perm_tree_cons (NULL_TREE, fndecl, static_ctors);
- if (DECL_STATIC_DESTRUCTOR (fndecl))
- static_dtors = perm_tree_cons (NULL_TREE, fndecl, static_dtors);
-
- if (! nested)
- {
- /* Let the error reporting routines know that we're outside a
- function. For a nested function, this value is used in
- pop_cp_function_context and then reset via pop_function_context. */
- current_function_decl = NULL_TREE;
- }
-
- named_label_uses = NULL;
- current_class_ptr = NULL_TREE;
- current_class_ref = NULL_TREE;
-}
-
-/* Create the FUNCTION_DECL for a function definition.
- LINE1 is the line number that the definition absolutely begins on.
- LINE2 is the line number that the name of the function appears on.
- DECLSPECS and DECLARATOR are the parts of the declaration;
- they describe the return type and the name of the function,
- but twisted together in a fashion that parallels the syntax of C.
-
- This function creates a binding context for the function body
- as well as setting up the FUNCTION_DECL in current_function_decl.
-
- Returns a FUNCTION_DECL on success.
-
- If the DECLARATOR is not suitable for a function (it defines a datum
- instead), we return 0, which tells yyparse to report a parse error.
-
- May return void_type_node indicating that this method is actually
- a friend. See grokfield for more details.
-
- Came here with a `.pushlevel' .
-
- DO NOT MAKE ANY CHANGES TO THIS CODE WITHOUT MAKING CORRESPONDING
- CHANGES TO CODE IN `grokfield'. */
-
-tree
-start_method (declspecs, declarator)
- tree declarator, declspecs;
-{
- tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0,
- NULL_TREE);
-
- /* Something too ugly to handle. */
- if (fndecl == NULL_TREE)
- return NULL_TREE;
-
- /* Pass friends other than inline friend functions back. */
- if (TYPE_MAIN_VARIANT (fndecl) == void_type_node)
- return fndecl;
-
- if (TREE_CODE (fndecl) != FUNCTION_DECL)
- /* Not a function, tell parser to report parse error. */
- return NULL_TREE;
-
- if (IS_SIGNATURE (current_class_type))
- IS_DEFAULT_IMPLEMENTATION (fndecl) = 1;
-
- if (DECL_IN_AGGR_P (fndecl))
- {
- if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (fndecl)) != current_class_type)
- {
- if (DECL_CONTEXT (fndecl))
- cp_error ("`%D' is already defined in class %s", fndecl,
- TYPE_NAME_STRING (DECL_CONTEXT (fndecl)));
- }
- return void_type_node;
- }
-
- DECL_THIS_INLINE (fndecl) = 1;
-
- if (flag_default_inline)
- DECL_INLINE (fndecl) = 1;
-
- if (processing_template_decl && ! current_function_decl)
- push_template_decl (fndecl);
-
- /* We read in the parameters on the maybepermanent_obstack,
- but we won't be getting back to them until after we
- may have clobbered them. So the call to preserve_data
- will keep them safe. */
- preserve_data ();
-
- if (! DECL_FRIEND_P (fndecl))
- {
- if (DECL_CHAIN (fndecl) != NULL_TREE)
- {
- /* Need a fresh node here so that we don't get circularity
- when we link these together. If FNDECL was a friend, then
- `pushdecl' does the right thing, which is nothing wrt its
- current value of DECL_CHAIN. */
- fndecl = copy_node (fndecl);
- }
- if (TREE_CHAIN (fndecl))
- {
- fndecl = copy_node (fndecl);
- TREE_CHAIN (fndecl) = NULL_TREE;
- }
-
- if (DECL_CONSTRUCTOR_P (fndecl))
- {
- if (! grok_ctor_properties (current_class_type, fndecl))
- return void_type_node;
- }
- else if (IDENTIFIER_OPNAME_P (DECL_NAME (fndecl)))
- grok_op_properties (fndecl, DECL_VIRTUAL_P (fndecl), 0);
- }
-
- cp_finish_decl (fndecl, NULL_TREE, NULL_TREE, 0, 0);
-
- /* Make a place for the parms */
- pushlevel (0);
- current_binding_level->parm_flag = 1;
-
- DECL_IN_AGGR_P (fndecl) = 1;
- return fndecl;
-}
-
-/* Go through the motions of finishing a function definition.
- We don't compile this method until after the whole class has
- been processed.
-
- FINISH_METHOD must return something that looks as though it
- came from GROKFIELD (since we are defining a method, after all).
-
- This is called after parsing the body of the function definition.
- STMTS is the chain of statements that makes up the function body.
-
- DECL is the ..._DECL that `start_method' provided. */
-
-tree
-finish_method (decl)
- tree decl;
-{
- register tree fndecl = decl;
- tree old_initial;
-
- register tree link;
-
- if (TYPE_MAIN_VARIANT (decl) == void_type_node)
- return decl;
-
- old_initial = DECL_INITIAL (fndecl);
-
- /* Undo the level for the parms (from start_method).
- This is like poplevel, but it causes nothing to be
- saved. Saving information here confuses symbol-table
- output routines. Besides, this information will
- be correctly output when this method is actually
- compiled. */
-
- /* Clear out the meanings of the local variables of this level;
- also record in each decl which block it belongs to. */
-
- for (link = current_binding_level->names; link; link = TREE_CHAIN (link))
- {
- if (DECL_NAME (link) != NULL_TREE)
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (link)) = 0;
- my_friendly_assert (TREE_CODE (link) != FUNCTION_DECL, 163);
- DECL_CONTEXT (link) = NULL_TREE;
- }
-
- /* Restore all name-meanings of the outer levels
- that were shadowed by this level. */
-
- for (link = current_binding_level->shadowed; link; link = TREE_CHAIN (link))
- IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
- for (link = current_binding_level->class_shadowed;
- link; link = TREE_CHAIN (link))
- IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
- for (link = current_binding_level->type_shadowed;
- link; link = TREE_CHAIN (link))
- IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link);
-
- GNU_xref_end_scope ((HOST_WIDE_INT) current_binding_level,
- (HOST_WIDE_INT) current_binding_level->level_chain,
- current_binding_level->parm_flag,
- current_binding_level->keep);
-
- poplevel (0, 0, 0);
-
- DECL_INITIAL (fndecl) = old_initial;
-
- /* We used to check if the context of FNDECL was different from
- current_class_type as another way to get inside here. This didn't work
- for String.cc in libg++. */
- if (DECL_FRIEND_P (fndecl))
- {
- CLASSTYPE_INLINE_FRIENDS (current_class_type)
- = tree_cons (NULL_TREE, fndecl, CLASSTYPE_INLINE_FRIENDS (current_class_type));
- decl = void_type_node;
- }
-
- return decl;
-}
-
-/* Called when a new struct TYPE is defined.
- If this structure or union completes the type of any previous
- variable declaration, lay it out and output its rtl. */
-
-void
-hack_incomplete_structures (type)
- tree type;
-{
- tree *list;
-
- if (current_binding_level->incomplete == NULL_TREE)
- return;
-
- if (!type) /* Don't do this for class templates. */
- return;
-
- for (list = &current_binding_level->incomplete; *list; )
- {
- tree decl = TREE_VALUE (*list);
- if (decl && TREE_TYPE (decl) == type
- || (TREE_TYPE (decl)
- && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
- && TREE_TYPE (TREE_TYPE (decl)) == type))
- {
- int toplevel = toplevel_bindings_p ();
- if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
- && TREE_TYPE (TREE_TYPE (decl)) == type)
- layout_type (TREE_TYPE (decl));
- layout_decl (decl, 0);
- rest_of_decl_compilation (decl, NULL_PTR, toplevel, 0);
- if (! toplevel)
- {
- tree cleanup;
- expand_decl (decl);
- cleanup = maybe_build_cleanup (decl);
- expand_decl_init (decl);
- if (! expand_decl_cleanup (decl, cleanup))
- cp_error ("parser lost in parsing declaration of `%D'",
- decl);
- }
- *list = TREE_CHAIN (*list);
- }
- else
- list = &TREE_CHAIN (*list);
- }
-}
-
-/* If DECL is of a type which needs a cleanup, build that cleanup here.
- See build_delete for information about AUTO_DELETE.
-
- Don't build these on the momentary obstack; they must live
- the life of the binding contour. */
-
-static tree
-maybe_build_cleanup_1 (decl, auto_delete)
- tree decl, auto_delete;
-{
- tree type = TREE_TYPE (decl);
- if (TYPE_NEEDS_DESTRUCTOR (type))
- {
- int temp = 0, flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR;
- tree rval;
-
- if (TREE_CODE (decl) != PARM_DECL)
- temp = suspend_momentary ();
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- rval = decl;
- else
- {
- mark_addressable (decl);
- rval = build_unary_op (ADDR_EXPR, decl, 0);
- }
-
- /* Optimize for space over speed here. */
- if (! TYPE_USES_VIRTUAL_BASECLASSES (type)
- || flag_expensive_optimizations)
- flags |= LOOKUP_NONVIRTUAL;
-
- rval = build_delete (TREE_TYPE (rval), rval, auto_delete, flags, 0);
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (type)
- && ! TYPE_HAS_DESTRUCTOR (type))
- rval = build_compound_expr (tree_cons (NULL_TREE, rval,
- build_tree_list (NULL_TREE, build_vbase_delete (type, decl))));
-
- /* Since this is a cleanup, UNSAVE it now. */
- rval = unsave_expr (rval);
-
- if (TREE_CODE (decl) != PARM_DECL)
- resume_momentary (temp);
-
- return rval;
- }
- return 0;
-}
-
-/* If DECL is of a type which needs a cleanup, build that cleanup
- here. The cleanup does free the storage with a call to delete. */
-
-tree
-maybe_build_cleanup_and_delete (decl)
- tree decl;
-{
- return maybe_build_cleanup_1 (decl, integer_three_node);
-}
-
-/* If DECL is of a type which needs a cleanup, build that cleanup
- here. The cleanup does not free the storage with a call a delete. */
-
-tree
-maybe_build_cleanup (decl)
- tree decl;
-{
- return maybe_build_cleanup_1 (decl, integer_two_node);
-}
-
-/* Expand a C++ expression at the statement level.
- This is needed to ferret out nodes which have UNKNOWN_TYPE.
- The C++ type checker should get all of these out when
- expressions are combined with other, type-providing, expressions,
- leaving only orphan expressions, such as:
-
- &class::bar; / / takes its address, but does nothing with it. */
-
-void
-cplus_expand_expr_stmt (exp)
- tree exp;
-{
- extern int temp_slot_level;
- extern int target_temp_slot_level;
- tree old_cleanups = cleanups_this_call;
- int old_temp_level = target_temp_slot_level;
- push_temp_slots ();
- push_temp_slots ();
- target_temp_slot_level = temp_slot_level;
-
- if (processing_template_decl)
- {
- add_tree (build_min_nt (EXPR_STMT, exp));
- return;
- }
-
- if (TREE_TYPE (exp) == unknown_type_node)
- {
- if (TREE_CODE (exp) == ADDR_EXPR || TREE_CODE (exp) == TREE_LIST)
- error ("address of overloaded function with no contextual type information");
- else if (TREE_CODE (exp) == COMPONENT_REF)
- warning ("useless reference to a member function name, did you forget the ()?");
- }
- else
- {
- if (TREE_CODE (exp) == FUNCTION_DECL)
- {
- cp_warning ("reference, not call, to function `%D'", exp);
- warning ("at this point in file");
- }
-
-#if 0
- /* We should do this eventually, but right now this causes regex.o from
- libg++ to miscompile, and tString to core dump. */
- exp = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp);
-#endif
- /* If we don't do this, we end up down inside expand_expr
- trying to do TYPE_MODE on the ERROR_MARK, and really
- go outside the bounds of the type. */
- if (exp != error_mark_node)
- expand_expr_stmt (break_out_cleanups (exp));
- }
-
- /* Clean up any pending cleanups. This happens when a function call
- returns a cleanup-needing value that nobody uses. */
- expand_cleanups_to (old_cleanups);
- pop_temp_slots ();
- pop_temp_slots ();
- target_temp_slot_level = old_temp_level;
- /* There might something left from building the trees. */
- if (cleanups_this_call)
- {
- expand_cleanups_to (NULL_TREE);
- }
- free_temp_slots ();
-}
-
-/* When a stmt has been parsed, this function is called.
-
- Currently, this function only does something within a
- constructor's scope: if a stmt has just assigned to this,
- and we are in a derived class, we call `emit_base_init'. */
-
-void
-finish_stmt ()
-{
- extern struct nesting *cond_stack, *loop_stack, *case_stack;
-
-
- if (current_function_assigns_this
- || ! current_function_just_assigned_this)
- return;
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- {
- /* Constructors must wait until we are out of control
- zones before calling base constructors. */
- if (cond_stack || loop_stack || case_stack)
- return;
- expand_expr_stmt (base_init_expr);
- check_base_init (current_class_type);
- }
- current_function_assigns_this = 1;
-}
-
-/* Change a static member function definition into a FUNCTION_TYPE, instead
- of the METHOD_TYPE that we create when it's originally parsed.
-
- WARNING: DO NOT pass &TREE_TYPE (decl) to FN or &TYPE_ARG_TYPES
- (TREE_TYPE (decl)) to ARGTYPES, as doing so will corrupt the types of
- other decls. Either pass the addresses of local variables or NULL. */
-
-static void
-revert_static_member_fn (decl, fn, argtypes)
- tree *decl, *fn, *argtypes;
-{
- tree tmp;
- tree function = fn ? *fn : TREE_TYPE (*decl);
- tree args = argtypes ? *argtypes : TYPE_ARG_TYPES (function);
-
- if (TYPE_READONLY (TREE_TYPE (TREE_VALUE (args))))
- cp_error ("static member function `%#D' declared const", *decl);
- if (TYPE_VOLATILE (TREE_TYPE (TREE_VALUE (args))))
- cp_error ("static member function `%#D' declared volatile", *decl);
-
- args = TREE_CHAIN (args);
- tmp = build_function_type (TREE_TYPE (function), args);
- tmp = build_type_variant (tmp, TYPE_READONLY (function),
- TYPE_VOLATILE (function));
- tmp = build_exception_variant (tmp,
- TYPE_RAISES_EXCEPTIONS (function));
- TREE_TYPE (*decl) = tmp;
- if (DECL_ARGUMENTS (*decl))
- DECL_ARGUMENTS (*decl) = TREE_CHAIN (DECL_ARGUMENTS (*decl));
- DECL_STATIC_FUNCTION_P (*decl) = 1;
- if (fn)
- *fn = tmp;
- if (argtypes)
- *argtypes = args;
-}
-
-int
-id_in_current_class (id)
- tree id;
-{
- return !!purpose_member (id, class_binding_level->class_shadowed);
-}
-
-struct cp_function
-{
- int returns_value;
- int returns_null;
- int warn_about_return_type;
- int assigns_this;
- int just_assigned_this;
- int parms_stored;
- int temp_name_counter;
- tree named_labels;
- tree shadowed_labels;
- tree ctor_label;
- tree dtor_label;
- rtx last_dtor_insn;
- tree base_init_list;
- tree member_init_list;
- tree base_init_expr;
- tree current_class_ptr;
- tree current_class_ref;
- rtx result_rtx;
- struct cp_function *next;
- struct binding_level *binding_level;
-};
-
-static struct cp_function *cp_function_chain;
-
-extern int temp_name_counter;
-
-/* Save and reinitialize the variables
- used during compilation of a C++ function. */
-
-void
-push_cp_function_context (context)
- tree context;
-{
- struct cp_function *p
- = (struct cp_function *) xmalloc (sizeof (struct cp_function));
-
- push_function_context_to (context);
-
- p->next = cp_function_chain;
- cp_function_chain = p;
-
- p->named_labels = named_labels;
- p->shadowed_labels = shadowed_labels;
- p->returns_value = current_function_returns_value;
- p->returns_null = current_function_returns_null;
- p->warn_about_return_type = warn_about_return_type;
- p->binding_level = current_binding_level;
- p->ctor_label = ctor_label;
- p->dtor_label = dtor_label;
- p->last_dtor_insn = last_dtor_insn;
- p->assigns_this = current_function_assigns_this;
- p->just_assigned_this = current_function_just_assigned_this;
- p->parms_stored = current_function_parms_stored;
- p->result_rtx = original_result_rtx;
- p->base_init_expr = base_init_expr;
- p->temp_name_counter = temp_name_counter;
- p->base_init_list = current_base_init_list;
- p->member_init_list = current_member_init_list;
- p->current_class_ptr = current_class_ptr;
- p->current_class_ref = current_class_ref;
-}
-
-/* Restore the variables used during compilation of a C++ function. */
-
-void
-pop_cp_function_context (context)
- tree context;
-{
- struct cp_function *p = cp_function_chain;
- tree link;
-
- /* Bring back all the labels that were shadowed. */
- for (link = shadowed_labels; link; link = TREE_CHAIN (link))
- if (DECL_NAME (TREE_VALUE (link)) != 0)
- SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link)),
- TREE_VALUE (link));
-
- pop_function_context_from (context);
-
- cp_function_chain = p->next;
-
- named_labels = p->named_labels;
- shadowed_labels = p->shadowed_labels;
- current_function_returns_value = p->returns_value;
- current_function_returns_null = p->returns_null;
- warn_about_return_type = p->warn_about_return_type;
- current_binding_level = p->binding_level;
- ctor_label = p->ctor_label;
- dtor_label = p->dtor_label;
- last_dtor_insn = p->last_dtor_insn;
- current_function_assigns_this = p->assigns_this;
- current_function_just_assigned_this = p->just_assigned_this;
- current_function_parms_stored = p->parms_stored;
- original_result_rtx = p->result_rtx;
- base_init_expr = p->base_init_expr;
- temp_name_counter = p->temp_name_counter;
- current_base_init_list = p->base_init_list;
- current_member_init_list = p->member_init_list;
- current_class_ptr = p->current_class_ptr;
- current_class_ref = p->current_class_ref;
-
- free (p);
-}
-
-int
-in_function_p ()
-{
- return function_depth != 0;
-}
-
-/* FSF LOCAL dje prefix attributes */
-/* Strip attributes from SPECS_ATTRS, a list of declspecs and attributes.
- This function is used by the parser when a rule will accept attributes
- in a particular position, but we don't want to support that just yet.
-
- A warning is issued for every ignored attribute. */
-
-tree
-strip_attrs (specs_attrs)
- tree specs_attrs;
-{
- tree specs, attrs;
-
- split_specs_attrs (specs_attrs, &specs, &attrs);
-
- while (attrs)
- {
- warning ("`%s' attribute ignored",
- IDENTIFIER_POINTER (TREE_PURPOSE (attrs)));
- attrs = TREE_CHAIN (attrs);
- }
-
- return specs;
-}
-/* END FSF LOCAL */
-
diff --git a/gcc/cp/decl.h b/gcc/cp/decl.h
deleted file mode 100644
index f55dca55ea7..00000000000
--- a/gcc/cp/decl.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Variables and structures for declaration processing.
- Copyright (C) 1993 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. */
-
-/* In grokdeclarator, distinguish syntactic contexts of declarators. */
-enum decl_context
-{ NORMAL, /* Ordinary declaration */
- FUNCDEF, /* Function definition */
- PARM, /* Declaration of parm before function body */
- CATCHPARM, /* Declaration of catch parm */
- FIELD, /* Declaration inside struct or union */
- BITFIELD, /* Likewise but with specified width */
- TYPENAME, /* Typename (inside cast or sizeof) */
- MEMFUNCDEF /* Member function definition */
-};
-
-/* We need this in here to get the decl_context definition. */
-extern tree grokdeclarator PROTO((tree, tree, enum decl_context, int, tree));
-
-/* C++: Keep these around to reduce calls to `get_identifier'.
- Identifiers for `this' in member functions and the auto-delete
- parameter for destructors. */
-extern tree this_identifier, in_charge_identifier;
-
-/* Parsing a function declarator leaves a list of parameter names
- or a chain or parameter decls here. */
-extern tree last_function_parms;
-
-/* A list of static class variables. This is needed, because a
- static class variable can be declared inside the class without
- an initializer, and then initialized, staticly, outside the class. */
-extern tree pending_statics;
-
-/* A list of objects which have constructors or destructors
- which reside in the global scope. The decl is stored in
- the TREE_VALUE slot and the initializer is stored
- in the TREE_PURPOSE slot. */
-extern tree static_aggregates;
-
-#ifdef DEBUG_CP_BINDING_LEVELS
-/* Purely for debugging purposes. */
-extern int debug_bindings_indentation;
-#endif
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
deleted file mode 100644
index 60a27a41f9a..00000000000
--- a/gcc/cp/decl2.c
+++ /dev/null
@@ -1,3693 +0,0 @@
-/* Process declarations and variables for C compiler.
- Copyright (C) 1988, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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. */
-
-
-/* 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 <stdio.h>
-#include "tree.h"
-#include "rtl.h"
-#include "flags.h"
-#include "cp-tree.h"
-#include "decl.h"
-#include "lex.h"
-#include "output.h"
-
-extern tree get_file_function_name ();
-extern tree cleanups_this_call;
-static void grok_function_init PROTO((tree, tree));
-void import_export_decl ();
-extern int current_class_depth;
-
-/* A list of virtual function tables we must make sure to write out. */
-tree pending_vtables;
-
-/* A list of static class variables. This is needed, because a
- static class variable can be declared inside the class without
- an initializer, and then initialized, staticly, outside the class. */
-tree pending_statics;
-
-/* A list of functions which were declared inline, but which we
- may need to emit outline anyway. */
-static tree saved_inlines;
-
-/* Used to help generate temporary names which are unique within
- a function. Reset to 0 by start_function. */
-
-int temp_name_counter;
-
-/* Same, but not reset. Local temp variables and global temp variables
- can have the same name. */
-static int global_temp_name_counter;
-
-/* Flag used when debugging spew.c */
-
-extern int spew_debug;
-
-/* Nonzero if we're done parsing and into end-of-file activities. */
-
-int at_eof;
-
-/* Functions called along with real static constructors and destructors. */
-
-tree static_ctors, static_dtors;
-
-/* C (and C++) language-specific option variables. */
-
-/* Nonzero means allow type mismatches in conditional expressions;
- just make their values `void'. */
-
-int flag_cond_mismatch;
-
-/* Nonzero means give `double' the same size as `float'. */
-
-int flag_short_double;
-
-/* Nonzero means don't recognize the keyword `asm'. */
-
-int flag_no_asm;
-
-/* Nonzero means don't recognize any extension keywords. */
-
-int flag_no_gnu_keywords;
-
-/* Nonzero means don't recognize the non-ANSI builtin functions. */
-
-int flag_no_builtin;
-
-/* Nonzero means don't recognize the non-ANSI builtin functions.
- -ansi sets this. */
-
-int flag_no_nonansi_builtin;
-
-/* Nonzero means do some things the same way PCC does. Only provided so
- the compiler will link. */
-
-int flag_traditional;
-
-/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
-
-int flag_signed_bitfields = 1;
-
-/* Nonzero means handle `#ident' directives. 0 means ignore them. */
-
-int flag_no_ident;
-
-/* Nonzero means enable obscure ANSI features and disable GNU extensions
- that might cause ANSI-compliant code to be miscompiled. */
-
-int flag_ansi;
-
-/* Nonzero means do argument matching for overloading according to the
- ANSI rules, rather than what g++ used to believe to be correct. */
-
-int flag_ansi_overloading = 1;
-
-/* Nonzero means do emit exported implementations of functions even if
- they can be inlined. */
-
-int flag_implement_inlines = 1;
-
-/* Nonzero means do emit exported implementations of templates, instead of
- multiple static copies in each file that needs a definition. */
-
-int flag_external_templates;
-
-/* Nonzero means that the decision to emit or not emit the implementation of a
- template depends on where the template is instantiated, rather than where
- it is defined. */
-
-int flag_alt_external_templates;
-
-/* Nonzero means that implicit instantiations will be emitted if needed. */
-
-int flag_implicit_templates = 1;
-
-/* Nonzero means warn about implicit declarations. */
-
-int warn_implicit = 1;
-
-/* Nonzero means warn when all ctors or dtors are private, and the class
- has no friends. */
-
-int warn_ctor_dtor_privacy = 1;
-
-/* True if we want to implement vtables using "thunks".
- The default is off. */
-
-#if defined(NEW_OVER) && defined (__i386__)
-int flag_vtable_thunks = 1;
-#else
-int flag_vtable_thunks;
-#endif
-
-/* True if we want to deal with repository information. */
-
-int flag_use_repository;
-
-/* Nonzero means give string constants the type `const char *'
- to get extra warnings from them. These warnings will be too numerous
- to be useful, except in thoroughly ANSIfied programs. */
-
-int warn_write_strings;
-
-/* Nonzero means warn about pointer casts that can drop a type qualifier
- from the pointer target type. */
-
-int warn_cast_qual;
-
-/* Nonzero means warn that dbx info for template class methods isn't fully
- supported yet. */
-
-int warn_template_debugging;
-
-/* Nonzero means warn about sizeof(function) or addition/subtraction
- of function pointers. */
-
-int warn_pointer_arith = 1;
-
-/* Nonzero means warn for any function def without prototype decl. */
-
-int warn_missing_prototypes;
-
-/* Nonzero means warn about multiple (redundant) decls for the same single
- variable or function. */
-
-int warn_redundant_decls;
-
-/* Warn if initializer is not completely bracketed. */
-
-int warn_missing_braces;
-
-/* Warn about comparison of signed and unsigned values. */
-
-int warn_sign_compare;
-
-/* Warn about *printf or *scanf format/argument anomalies. */
-
-int warn_format;
-
-/* Warn about a subscript that has type char. */
-
-int warn_char_subscripts;
-
-/* Warn if a type conversion is done that might have confusing results. */
-
-int warn_conversion;
-
-/* Warn if adding () is suggested. */
-
-int warn_parentheses;
-
-/* Non-zero means warn in function declared in derived class has the
- same name as a virtual in the base class, but fails to match the
- type signature of any virtual function in the base class. */
-int warn_overloaded_virtual;
-
-/* Non-zero means warn when declaring a class that has a non virtual
- destructor, when it really ought to have a virtual one. */
-int warn_nonvdtor;
-
-/* Non-zero means warn when a function is declared extern and later inline. */
-int warn_extern_inline;
-
-/* Non-zero means warn when the compiler will reorder code. */
-int warn_reorder;
-
-/* Non-zero means warn when synthesis behavior differs from Cfront's. */
-int warn_synth;
-
-/* Non-zero means warn when we convert a pointer to member function
- into a pointer to (void or function). */
-int warn_pmf2ptr = 1;
-
-/* Nonzero means `$' can be in an identifier.
- See cccp.c for reasons why this breaks some obscure ANSI C programs. */
-
-#ifndef DOLLARS_IN_IDENTIFIERS
-#define DOLLARS_IN_IDENTIFIERS 1
-#endif
-int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
-
-/* Nonzero for -fno-strict-prototype switch: do not consider empty
- argument prototype to mean function takes no arguments. */
-
-int flag_strict_prototype = 2;
-int strict_prototype = 1;
-int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus = 1;
-
-/* Nonzero means that labels can be used as first-class objects */
-
-int flag_labels_ok;
-
-/* Non-zero means to collect statistics which might be expensive
- and to print them when we are done. */
-int flag_detailed_statistics;
-
-/* C++ specific flags. */
-/* Nonzero for -fall-virtual: make every member function (except
- constructors) lay down in the virtual function table. Calls
- can then either go through the virtual function table or not,
- depending. */
-
-int flag_all_virtual;
-
-/* Zero means that `this' is a *const. This gives nice behavior in the
- 2.0 world. 1 gives 1.2-compatible behavior. 2 gives Spring behavior.
- -2 means we're constructing an object and it has fixed type. */
-
-int flag_this_is_variable;
-
-/* Nonzero means memoize our member lookups. */
-
-int flag_memoize_lookups; int flag_save_memoized_contexts;
-
-/* 3 means write out only virtuals function tables `defined'
- in this implementation file.
- 2 means write out only specific virtual function tables
- and give them (C) public access.
- 1 means write out virtual function tables and give them
- (C) public access.
- 0 means write out virtual function tables and give them
- (C) static access (default).
- -1 means declare virtual function tables extern. */
-
-int write_virtuals;
-
-/* Nonzero means we should attempt to elide constructors when possible. */
-
-int flag_elide_constructors;
-
-/* Nonzero means recognize and handle signature language constructs. */
-
-int flag_handle_signatures;
-
-/* Nonzero means that member functions defined in class scope are
- inline by default. */
-
-int flag_default_inline = 1;
-
-/* Controls whether enums and ints freely convert.
- 1 means with complete freedom.
- 0 means enums can convert to ints, but not vice-versa. */
-int flag_int_enum_equivalence;
-
-/* Controls whether compiler generates 'type descriptor' that give
- run-time type information. */
-int flag_rtti = 1;
-
-/* Nonzero if we wish to output cross-referencing information
- for the GNU class browser. */
-extern int flag_gnu_xref;
-
-/* Nonzero if compiler can make `reasonable' assumptions about
- references and objects. For example, the compiler must be
- conservative about the following and not assume that `a' is nonnull:
-
- obj &a = g ();
- a.f (2);
-
- In general, it is `reasonable' to assume that for many programs,
- and better code can be generated in that case. */
-
-int flag_assume_nonnull_objects = 1;
-
-/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes)
- objects. */
-
-int flag_huge_objects;
-
-/* Nonzero if we want to conserve space in the .o files. We do this
- by putting uninitialized data and runtime initialized data into
- .common instead of .data at the expense of not flagging multiple
- definitions. */
-
-int flag_conserve_space;
-
-/* Nonzero if we want to obey access control semantics. */
-
-int flag_access_control = 1;
-
-/* Nonzero if we want to understand the operator names, i.e. 'bitand'. */
-
-int flag_operator_names;
-
-/* Nonzero if we want to check the return value of new and avoid calling
- constructors if it is a null pointer. */
-
-int flag_check_new;
-
-/* Nonzero if we want the new ANSI rules for pushing a new scope for `for'
- initialization variables.
- 0: Old rules, set by -fno-for-scope.
- 2: New ANSI rules, set by -ffor-scope.
- 1: Try to implement new ANSI rules, but with backup compatibility
- (and warnings). This is the default, for now. */
-
-int flag_new_for_scope = 1;
-
-/* Nonzero if we want to emit defined symbols with common-like linkage as
- weak symbols where possible, in order to conform to C++ semantics.
- Otherwise, emit them as local symbols. */
-
-int flag_weak = 1;
-
-/* Maximum template instantiation depth. Must be at least 17 for ANSI
- compliance. */
-
-int max_tinst_depth = 17;
-
-/* Table of language-dependent -f options.
- STRING is the option name. VARIABLE is the address of the variable.
- ON_VALUE is the value to store in VARIABLE
- if `-fSTRING' is seen as an option.
- (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
-
-static struct { char *string; int *variable; int on_value;} lang_f_options[] =
-{
- {"signed-char", &flag_signed_char, 1},
- {"unsigned-char", &flag_signed_char, 0},
- {"signed-bitfields", &flag_signed_bitfields, 1},
- {"unsigned-bitfields", &flag_signed_bitfields, 0},
- {"short-enums", &flag_short_enums, 1},
- {"short-double", &flag_short_double, 1},
- {"cond-mismatch", &flag_cond_mismatch, 1},
- {"asm", &flag_no_asm, 0},
- {"builtin", &flag_no_builtin, 0},
- {"ident", &flag_no_ident, 0},
- {"labels-ok", &flag_labels_ok, 1},
- {"stats", &flag_detailed_statistics, 1},
- {"this-is-variable", &flag_this_is_variable, 1},
- {"strict-prototype", &flag_strict_prototype, 1},
- {"all-virtual", &flag_all_virtual, 1},
- {"memoize-lookups", &flag_memoize_lookups, 1},
- {"elide-constructors", &flag_elide_constructors, 1},
- {"handle-signatures", &flag_handle_signatures, 1},
- {"default-inline", &flag_default_inline, 1},
- {"dollars-in-identifiers", &dollars_in_ident, 1},
- {"enum-int-equiv", &flag_int_enum_equivalence, 1},
- {"rtti", &flag_rtti, 1},
- {"xref", &flag_gnu_xref, 1},
- {"nonnull-objects", &flag_assume_nonnull_objects, 1},
- {"implement-inlines", &flag_implement_inlines, 1},
- {"external-templates", &flag_external_templates, 1},
- {"implicit-templates", &flag_implicit_templates, 1},
- {"ansi-overloading", &flag_ansi_overloading, 1},
- {"huge-objects", &flag_huge_objects, 1},
- {"conserve-space", &flag_conserve_space, 1},
- {"vtable-thunks", &flag_vtable_thunks, 1},
- {"short-temps", &flag_short_temps, 1},
- {"access-control", &flag_access_control, 1},
- {"nonansi-builtins", &flag_no_nonansi_builtin, 0},
- {"gnu-keywords", &flag_no_gnu_keywords, 0},
- {"operator-names", &flag_operator_names, 1},
- {"check-new", &flag_check_new, 1},
- {"repo", &flag_use_repository, 1},
- {"for-scope", &flag_new_for_scope, 2},
- {"weak", &flag_weak, 1}
-};
-
-/* Decode the string P as a language-specific option.
- Return 1 if it is recognized (and handle it);
- return 0 if not recognized. */
-
-int
-lang_decode_option (p)
- char *p;
-{
- if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
- dollars_in_ident = 1, flag_writable_strings = 1,
- flag_this_is_variable = 1, flag_new_for_scope = 0;
- /* The +e options are for cfront compatibility. They come in as
- `-+eN', to kludge around gcc.c's argument handling. */
- else if (p[0] == '-' && p[1] == '+' && p[2] == 'e')
- {
- int old_write_virtuals = write_virtuals;
- if (p[3] == '1')
- write_virtuals = 1;
- else if (p[3] == '0')
- write_virtuals = -1;
- else if (p[3] == '2')
- write_virtuals = 2;
- else error ("invalid +e option");
- if (old_write_virtuals != 0
- && write_virtuals != old_write_virtuals)
- error ("conflicting +e options given");
- }
- else if (p[0] == '-' && p[1] == 'f')
- {
- /* Some kind of -f option.
- P's value is the option sans `-f'.
- Search for it in the table of options. */
- int found = 0, j;
-
- p += 2;
- /* Try special -f options. */
-
- if (!strcmp (p, "save-memoized"))
- {
- flag_memoize_lookups = 1;
- flag_save_memoized_contexts = 1;
- found = 1;
- }
- if (!strcmp (p, "no-save-memoized"))
- {
- flag_memoize_lookups = 0;
- flag_save_memoized_contexts = 0;
- found = 1;
- }
- else if (! strcmp (p, "alt-external-templates"))
- {
- flag_external_templates = 1;
- flag_alt_external_templates = 1;
- found = 1;
- }
- else if (! strcmp (p, "no-alt-external-templates"))
- {
- flag_alt_external_templates = 0;
- found = 1;
- }
- else if (!strcmp (p, "repo"))
- {
- flag_use_repository = 1;
- flag_implicit_templates = 0;
- found = 1;
- }
- else if (!strncmp (p, "template-depth-", 15))
- {
- char *endp = p + 15;
- while (*endp)
- {
- if (*endp >= '0' && *endp <= '9')
- endp++;
- else
- {
- error ("Invalid option `%s'", p - 2);
- goto template_depth_lose;
- }
- }
- max_tinst_depth = atoi (p + 15);
- template_depth_lose: ;
- }
- else for (j = 0;
- !found && j < sizeof (lang_f_options) / sizeof (lang_f_options[0]);
- j++)
- {
- if (!strcmp (p, lang_f_options[j].string))
- {
- *lang_f_options[j].variable = lang_f_options[j].on_value;
- /* A goto here would be cleaner,
- but breaks the vax pcc. */
- found = 1;
- }
- if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
- && ! strcmp (p+3, lang_f_options[j].string))
- {
- *lang_f_options[j].variable = ! lang_f_options[j].on_value;
- found = 1;
- }
- }
- return found;
- }
- else if (p[0] == '-' && p[1] == 'W')
- {
- int setting = 1;
-
- /* The -W options control the warning behavior of the compiler. */
- p += 2;
-
- if (p[0] == 'n' && p[1] == 'o' && p[2] == '-')
- setting = 0, p += 3;
-
- if (!strcmp (p, "implicit"))
- warn_implicit = setting;
- else if (!strcmp (p, "return-type"))
- warn_return_type = setting;
- else if (!strcmp (p, "ctor-dtor-privacy"))
- warn_ctor_dtor_privacy = setting;
- else if (!strcmp (p, "write-strings"))
- warn_write_strings = setting;
- else if (!strcmp (p, "cast-qual"))
- warn_cast_qual = setting;
- else if (!strcmp (p, "char-subscripts"))
- warn_char_subscripts = setting;
- else if (!strcmp (p, "pointer-arith"))
- warn_pointer_arith = setting;
- else if (!strcmp (p, "missing-prototypes"))
- warn_missing_prototypes = setting;
- else if (!strcmp (p, "redundant-decls"))
- warn_redundant_decls = setting;
- else if (!strcmp (p, "missing-braces"))
- warn_missing_braces = setting;
- else if (!strcmp (p, "sign-compare"))
- warn_sign_compare = setting;
- else if (!strcmp (p, "format"))
- warn_format = setting;
- else if (!strcmp (p, "conversion"))
- warn_conversion = setting;
- else if (!strcmp (p, "parentheses"))
- warn_parentheses = setting;
- else if (!strcmp (p, "non-virtual-dtor"))
- warn_nonvdtor = setting;
- else if (!strcmp (p, "extern-inline"))
- warn_extern_inline = setting;
- else if (!strcmp (p, "reorder"))
- warn_reorder = setting;
- else if (!strcmp (p, "synth"))
- warn_synth = setting;
- else if (!strcmp (p, "pmf-conversions"))
- warn_pmf2ptr = setting;
- else if (!strcmp (p, "comment"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "comments"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "trigraphs"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "import"))
- ; /* cpp handles this one. */
- else if (!strcmp (p, "all"))
- {
- warn_return_type = setting;
- warn_unused = setting;
- warn_implicit = setting;
- warn_ctor_dtor_privacy = setting;
- warn_switch = setting;
- warn_format = setting;
- warn_parentheses = setting;
- warn_missing_braces = setting;
- warn_sign_compare = setting;
- warn_extern_inline = setting;
- warn_nonvdtor = setting;
- /* We save the value of warn_uninitialized, since if they put
- -Wuninitialized on the command line, we need to generate a
- warning about not using it without also specifying -O. */
- if (warn_uninitialized != 1)
- warn_uninitialized = (setting ? 2 : 0);
- warn_template_debugging = setting;
- warn_reorder = setting;
- }
-
- else if (!strcmp (p, "overloaded-virtual"))
- warn_overloaded_virtual = setting;
- else return 0;
- }
- else if (!strcmp (p, "-ansi"))
- dollars_in_ident = 0, flag_no_nonansi_builtin = 1, flag_ansi = 1,
- flag_no_gnu_keywords = 1, flag_operator_names = 1;
-#ifdef SPEW_DEBUG
- /* Undocumented, only ever used when you're invoking cc1plus by hand, since
- it's probably safe to assume no sane person would ever want to use this
- under normal circumstances. */
- else if (!strcmp (p, "-spew-debug"))
- spew_debug = 1;
-#endif
- else
- return 0;
-
- return 1;
-}
-
-/* Incorporate `const' and `volatile' qualifiers for member functions.
- FUNCTION is a TYPE_DECL or a FUNCTION_DECL.
- QUALS is a list of qualifiers. */
-
-tree
-grok_method_quals (ctype, function, quals)
- tree ctype, function, quals;
-{
- tree fntype = TREE_TYPE (function);
- tree raises = TYPE_RAISES_EXCEPTIONS (fntype);
-
- do
- {
- extern tree ridpointers[];
-
- if (TREE_VALUE (quals) == ridpointers[(int)RID_CONST])
- {
- if (TYPE_READONLY (ctype))
- error ("duplicate `%s' %s",
- IDENTIFIER_POINTER (TREE_VALUE (quals)),
- (TREE_CODE (function) == FUNCTION_DECL
- ? "for member function" : "in type declaration"));
- ctype = build_type_variant (ctype, 1, TYPE_VOLATILE (ctype));
- build_pointer_type (ctype);
- }
- else if (TREE_VALUE (quals) == ridpointers[(int)RID_VOLATILE])
- {
- if (TYPE_VOLATILE (ctype))
- error ("duplicate `%s' %s",
- IDENTIFIER_POINTER (TREE_VALUE (quals)),
- (TREE_CODE (function) == FUNCTION_DECL
- ? "for member function" : "in type declaration"));
- ctype = build_type_variant (ctype, TYPE_READONLY (ctype), 1);
- build_pointer_type (ctype);
- }
- else
- my_friendly_abort (20);
- quals = TREE_CHAIN (quals);
- }
- while (quals);
- fntype = build_cplus_method_type (ctype, TREE_TYPE (fntype),
- (TREE_CODE (fntype) == METHOD_TYPE
- ? TREE_CHAIN (TYPE_ARG_TYPES (fntype))
- : TYPE_ARG_TYPES (fntype)));
- if (raises)
- fntype = build_exception_variant (fntype, raises);
-
- TREE_TYPE (function) = fntype;
- return ctype;
-}
-
-#if 0 /* Not used. */
-/* This routine replaces cryptic DECL_NAMEs with readable DECL_NAMEs.
- It leaves DECL_ASSEMBLER_NAMEs with the correct value. */
-/* This does not yet work with user defined conversion operators
- It should. */
-
-static void
-substitute_nice_name (decl)
- tree decl;
-{
- if (DECL_NAME (decl) && TREE_CODE (DECL_NAME (decl)) == IDENTIFIER_NODE)
- {
- char *n = decl_as_string (DECL_NAME (decl), 1);
- if (n[strlen (n) - 1] == ' ')
- n[strlen (n) - 1] = 0;
- DECL_NAME (decl) = get_identifier (n);
- }
-}
-#endif
-
-/* Warn when -fexternal-templates is used and #pragma
- interface/implementation is not used all the times it should be,
- inform the user. */
-
-void
-warn_if_unknown_interface (decl)
- tree decl;
-{
- static int already_warned = 0;
- if (already_warned++)
- return;
-
- if (flag_alt_external_templates)
- {
- struct tinst_level *til = tinst_for_decl ();
- int sl = lineno;
- char *sf = input_filename;
-
- if (til)
- {
- lineno = til->line;
- input_filename = til->file;
- }
- cp_warning ("template `%#D' instantiated in file without #pragma interface",
- decl);
- lineno = sl;
- input_filename = sf;
- }
- else
- cp_warning_at ("template `%#D' defined in file without #pragma interface",
- decl);
-}
-
-/* A subroutine of the parser, to handle a component list. */
-
-tree
-grok_x_components (specs, components)
- tree specs, components;
-{
- register tree t, x, tcode;
-
- /* We just got some friends. They have been recorded elsewhere. */
- if (components == void_type_node)
- return NULL_TREE;
-
- if (components == NULL_TREE)
- {
- t = groktypename (build_decl_list (specs, NULL_TREE));
-
- if (t == NULL_TREE)
- {
- error ("error in component specification");
- return NULL_TREE;
- }
-
- switch (TREE_CODE (t))
- {
- case VAR_DECL:
- /* Static anonymous unions come out as VAR_DECLs. */
- if (TREE_CODE (TREE_TYPE (t)) == UNION_TYPE
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (TREE_TYPE (t))))
- return t;
-
- /* We return SPECS here, because in the parser it was ending
- up with not doing anything to $$, which is what SPECS
- represents. */
- return specs;
- break;
-
- case RECORD_TYPE:
- /* This code may be needed for UNION_TYPEs as
- well. */
- tcode = record_type_node;
- if (CLASSTYPE_DECLARED_CLASS (t))
- tcode = class_type_node;
- else if (IS_SIGNATURE (t))
- tcode = signature_type_node;
-
- t = xref_tag (tcode, TYPE_IDENTIFIER (t), NULL_TREE, 0);
- if (TYPE_CONTEXT (t))
- CLASSTYPE_NO_GLOBALIZE (t) = 1;
- return NULL_TREE;
- break;
-
- case UNION_TYPE:
- case ENUMERAL_TYPE:
- if (TREE_CODE (t) == UNION_TYPE)
- tcode = union_type_node;
- else
- tcode = enum_type_node;
-
- t = xref_tag (tcode, TYPE_IDENTIFIER (t), NULL_TREE, 0);
- if (TREE_CODE (t) == UNION_TYPE && TYPE_CONTEXT (t))
- CLASSTYPE_NO_GLOBALIZE (t) = 1;
- if (TREE_CODE (t) == UNION_TYPE
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- {
- /* See also shadow_tag. */
-
- struct pending_inline **p;
- tree *q;
- x = build_lang_field_decl (FIELD_DECL, NULL_TREE, t);
-
- /* Wipe out memory of synthesized methods */
- TYPE_HAS_CONSTRUCTOR (t) = 0;
- TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 0;
- TYPE_HAS_INIT_REF (t) = 0;
- TYPE_HAS_CONST_INIT_REF (t) = 0;
- TYPE_HAS_ASSIGN_REF (t) = 0;
- TYPE_HAS_ASSIGNMENT (t) = 0;
- TYPE_HAS_CONST_ASSIGN_REF (t) = 0;
-
- q = &TYPE_METHODS (t);
- while (*q)
- {
- if (DECL_ARTIFICIAL (*q))
- *q = TREE_CHAIN (*q);
- else
- q = &TREE_CHAIN (*q);
- }
- if (TYPE_METHODS (t))
- error ("an anonymous union cannot have function members");
-
- p = &pending_inlines;
- for (; *p; *p = (*p)->next)
- if (DECL_CONTEXT ((*p)->fndecl) != t)
- break;
- }
- else if (TREE_CODE (t) == ENUMERAL_TYPE)
- x = grok_enum_decls (t, NULL_TREE);
- else
- x = NULL_TREE;
- return x;
- break;
-
- default:
- if (t != void_type_node)
- error ("empty component declaration");
- return NULL_TREE;
- }
- }
- else
- {
- t = TREE_TYPE (components);
- if (TREE_CODE (t) == ENUMERAL_TYPE && TREE_NONLOCAL_FLAG (t))
- return grok_enum_decls (t, components);
- else
- return components;
- }
-}
-
-/* Classes overload their constituent function names automatically.
- When a function name is declared in a record structure,
- its name is changed to it overloaded name. Since names for
- constructors and destructors can conflict, we place a leading
- '$' for destructors.
-
- CNAME is the name of the class we are grokking for.
-
- FUNCTION is a FUNCTION_DECL. It was created by `grokdeclarator'.
-
- FLAGS contains bits saying what's special about today's
- arguments. 1 == DESTRUCTOR. 2 == OPERATOR.
-
- If FUNCTION is a destructor, then we must add the `auto-delete' field
- as a second parameter. There is some hair associated with the fact
- that we must "declare" this variable in the manner consistent with the
- way the rest of the arguments were declared.
-
- QUALS are the qualifiers for the this pointer. */
-
-void
-grokclassfn (ctype, cname, function, flags, quals)
- tree ctype, cname, function;
- enum overload_flags flags;
- tree quals;
-{
- tree fn_name = DECL_NAME (function);
- tree arg_types;
- tree parm;
- tree qualtype;
- tree fntype = TREE_TYPE (function);
- tree raises = TYPE_RAISES_EXCEPTIONS (fntype);
-
- if (fn_name == NULL_TREE)
- {
- error ("name missing for member function");
- fn_name = get_identifier ("<anonymous>");
- DECL_NAME (function) = fn_name;
- }
-
- if (quals)
- qualtype = grok_method_quals (ctype, function, quals);
- else
- qualtype = ctype;
-
- arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));
- if (TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
- {
- /* Must add the class instance variable up front. */
- /* Right now we just make this a pointer. But later
- we may wish to make it special. */
- tree type = TREE_VALUE (arg_types);
- int constp = 1;
-
- if ((flag_this_is_variable > 0)
- && (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function)))
- constp = 0;
-
- if (DECL_CONSTRUCTOR_P (function))
- {
- if (TYPE_USES_VIRTUAL_BASECLASSES (ctype))
- {
- DECL_CONSTRUCTOR_FOR_VBASE_P (function) = 1;
- /* In this case we need "in-charge" flag saying whether
- this constructor is responsible for initialization
- of virtual baseclasses or not. */
- parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node);
- /* Mark the artificial `__in_chrg' parameter as "artificial". */
- SET_DECL_ARTIFICIAL (parm);
- DECL_ARG_TYPE (parm) = integer_type_node;
- TREE_READONLY (parm) = 1;
- TREE_CHAIN (parm) = last_function_parms;
- last_function_parms = parm;
- }
- }
-
- parm = build_decl (PARM_DECL, this_identifier, type);
- /* Mark the artificial `this' parameter as "artificial". */
- SET_DECL_ARTIFICIAL (parm);
- DECL_ARG_TYPE (parm) = type;
- /* We can make this a register, so long as we don't
- accidentally complain if someone tries to take its address. */
- DECL_REGISTER (parm) = 1;
- if (constp)
- TREE_READONLY (parm) = 1;
- TREE_CHAIN (parm) = last_function_parms;
- last_function_parms = parm;
- }
-
- if (flags == DTOR_FLAG)
- {
- char *buf, *dbuf;
- tree const_integer_type = build_type_variant (integer_type_node, 1, 0);
- int len = sizeof (DESTRUCTOR_DECL_PREFIX)-1;
-
- arg_types = hash_tree_chain (const_integer_type, void_list_node);
- TREE_SIDE_EFFECTS (arg_types) = 1;
- /* Build the overload name. It will look like `7Example'. */
- if (IDENTIFIER_TYPE_VALUE (cname))
- dbuf = build_overload_name (IDENTIFIER_TYPE_VALUE (cname), 1, 1);
- else if (IDENTIFIER_LOCAL_VALUE (cname))
- dbuf = build_overload_name (TREE_TYPE (IDENTIFIER_LOCAL_VALUE (cname)), 1, 1);
- else
- /* Using ctype fixes the `X::Y::~Y()' crash. The cname has no type when
- it's defined out of the class definition, since poplevel_class wipes
- it out. This used to be internal error 346. */
- dbuf = build_overload_name (ctype, 1, 1);
- buf = (char *) alloca (strlen (dbuf) + sizeof (DESTRUCTOR_DECL_PREFIX));
- bcopy (DESTRUCTOR_DECL_PREFIX, buf, len);
- buf[len] = '\0';
- strcat (buf, dbuf);
- DECL_ASSEMBLER_NAME (function) = get_identifier (buf);
- parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node);
- /* Mark the artificial `__in_chrg' parameter as "artificial". */
- SET_DECL_ARTIFICIAL (parm);
- TREE_READONLY (parm) = 1;
- DECL_ARG_TYPE (parm) = integer_type_node;
- /* This is the same chain as DECL_ARGUMENTS (...). */
- TREE_CHAIN (last_function_parms) = parm;
-
- fntype = build_cplus_method_type (qualtype, void_type_node,
- arg_types);
- if (raises)
- {
- fntype = build_exception_variant (fntype, raises);
- }
- TREE_TYPE (function) = fntype;
- TYPE_HAS_DESTRUCTOR (ctype) = 1;
- }
- else
- {
- tree these_arg_types;
-
- if (DECL_CONSTRUCTOR_FOR_VBASE_P (function))
- {
- arg_types = hash_tree_chain (integer_type_node,
- TREE_CHAIN (arg_types));
- fntype = build_cplus_method_type (qualtype,
- TREE_TYPE (TREE_TYPE (function)),
- arg_types);
- if (raises)
- {
- fntype = build_exception_variant (fntype, raises);
- }
- TREE_TYPE (function) = fntype;
- arg_types = TYPE_ARG_TYPES (TREE_TYPE (function));
- }
-
- these_arg_types = arg_types;
-
- if (TREE_CODE (TREE_TYPE (function)) == FUNCTION_TYPE)
- /* Only true for static member functions. */
- these_arg_types = hash_tree_chain (build_pointer_type (qualtype),
- arg_types);
-
- DECL_ASSEMBLER_NAME (function)
- = build_decl_overload (fn_name, these_arg_types,
- 1 + DECL_CONSTRUCTOR_P (function));
-
-#if 0
- /* This code is going into the compiler, but currently, it makes
- libg++/src/Integer.cc not compile. The problem is that the nice name
- winds up going into the symbol table, and conversion operations look
- for the manged name. */
- substitute_nice_name (function);
-#endif
- }
-
- DECL_ARGUMENTS (function) = last_function_parms;
- /* First approximations. */
- DECL_CONTEXT (function) = ctype;
- DECL_CLASS_CONTEXT (function) = ctype;
-}
-
-/* Work on the expr used by alignof (this is only called by the parser). */
-
-tree
-grok_alignof (expr)
- tree expr;
-{
- tree best, t;
- int bestalign;
-
- if (TREE_CODE (expr) == COMPONENT_REF
- && DECL_BIT_FIELD (TREE_OPERAND (expr, 1)))
- error ("`__alignof__' applied to a bit-field");
-
- if (TREE_CODE (expr) == INDIRECT_REF)
- {
- best = t = TREE_OPERAND (expr, 0);
- bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
-
- while (TREE_CODE (t) == NOP_EXPR
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE)
- {
- int thisalign;
- t = TREE_OPERAND (t, 0);
- thisalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
- if (thisalign > bestalign)
- best = t, bestalign = thisalign;
- }
- return c_alignof (TREE_TYPE (TREE_TYPE (best)));
- }
- else
- {
- /* ANSI says arrays and fns are converted inside comma.
- But we can't convert them in build_compound_expr
- because that would break commas in lvalues.
- So do the conversion here if operand was a comma. */
- if (TREE_CODE (expr) == COMPOUND_EXPR
- && (TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE))
- expr = default_conversion (expr);
- return c_alignof (TREE_TYPE (expr));
- }
-}
-
-/* Create an ARRAY_REF, checking for the user doing things backwards
- along the way. */
-
-tree
-grok_array_decl (array_expr, index_exp)
- tree array_expr, index_exp;
-{
- tree type = TREE_TYPE (array_expr);
- tree p1, p2, i1, i2;
-
- if (type == error_mark_node || index_exp == error_mark_node)
- return error_mark_node;
- if (processing_template_decl)
- return build_min (ARRAY_REF, type ? TREE_TYPE (type) : NULL_TREE,
- array_expr, index_exp);
-
- if (type == NULL_TREE)
- {
- /* Something has gone very wrong. Assume we are mistakenly reducing
- an expression instead of a declaration. */
- error ("parser may be lost: is there a '{' missing somewhere?");
- return NULL_TREE;
- }
-
- if (TREE_CODE (type) == OFFSET_TYPE
- || TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- /* If they have an `operator[]', use that. */
- if (TYPE_LANG_SPECIFIC (type)
- && TYPE_OVERLOADS_ARRAY_REF (complete_type (type)))
- return build_opfncall (ARRAY_REF, LOOKUP_NORMAL,
- array_expr, index_exp, NULL_TREE);
-
- /* Otherwise, create an ARRAY_REF for a pointer or array type. */
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- p1 = array_expr;
- else
- p1 = build_expr_type_conversion (WANT_POINTER, array_expr, 0);
-
- if (TREE_CODE (TREE_TYPE (index_exp)) == ARRAY_TYPE)
- p2 = index_exp;
- else
- p2 = build_expr_type_conversion (WANT_POINTER, index_exp, 0);
-
- i1 = build_expr_type_conversion (WANT_INT | WANT_ENUM, array_expr, 0);
- i2 = build_expr_type_conversion (WANT_INT | WANT_ENUM, index_exp, 0);
-
- if ((p1 && i2) && (i1 && p2))
- error ("ambiguous conversion for array subscript");
-
- if (p1 && i2)
- array_expr = p1, index_exp = i2;
- else if (i1 && p2)
- array_expr = p2, index_exp = i1;
- else
- {
- cp_error ("invalid types `%T[%T]' for array subscript",
- type, TREE_TYPE (index_exp));
- return error_mark_node;
- }
-
- if (array_expr == error_mark_node || index_exp == error_mark_node)
- error ("ambiguous conversion for array subscript");
-
- return build_array_ref (array_expr, index_exp);
-}
-
-/* Given the cast expression EXP, checking out its validity. Either return
- an error_mark_node if there was an unavoidable error, return a cast to
- void for trying to delete a pointer w/ the value 0, or return the
- call to delete. If DOING_VEC is 1, we handle things differently
- for doing an array delete. If DOING_VEC is 2, they gave us the
- array size as an argument to delete.
- Implements ARM $5.3.4. This is called from the parser. */
-
-tree
-delete_sanity (exp, size, doing_vec, use_global_delete)
- tree exp, size;
- int doing_vec, use_global_delete;
-{
- tree t;
- tree type;
- enum tree_code code;
- /* For a regular vector delete (aka, no size argument) we will pass
- this down as a NULL_TREE into build_vec_delete. */
- tree maxindex = NULL_TREE;
-
- if (exp == error_mark_node)
- return exp;
-
- if (processing_template_decl)
- {
- t = build_min (DELETE_EXPR, void_type_node, exp, size);
- DELETE_EXPR_USE_GLOBAL (t) = use_global_delete;
- DELETE_EXPR_USE_VEC (t) = doing_vec;
- return t;
- }
-
- t = stabilize_reference (convert_from_reference (exp));
- type = TREE_TYPE (t);
- code = TREE_CODE (type);
-
- switch (doing_vec)
- {
- case 2:
- maxindex = build_binary_op (MINUS_EXPR, size, integer_one_node, 1);
- pedwarn ("anachronistic use of array size in vector delete");
- /* Fall through. */
- case 1:
- break;
- default:
- if (code != POINTER_TYPE)
- {
- cp_error ("type `%#T' argument given to `delete', expected pointer",
- type);
- return error_mark_node;
- }
-
- /* Deleting a pointer with the value zero is valid and has no effect. */
- if (integer_zerop (t))
- return build1 (NOP_EXPR, void_type_node, t);
- }
-
- if (code == POINTER_TYPE)
- {
-#if 0
- /* As of Valley Forge, you can delete a pointer to constant. */
- /* You can't delete a pointer to constant. */
- if (TREE_READONLY (TREE_TYPE (type)))
- {
- error ("`const *' cannot be deleted");
- return error_mark_node;
- }
-#endif
- /* You also can't delete functions. */
- if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
- {
- error ("cannot delete a function");
- return error_mark_node;
- }
- }
-
-#if 0
- /* If the type has no destructor, then we should build a regular
- delete, instead of a vector delete. Otherwise, we would end
- up passing a bogus offset into __builtin_delete, which is
- not expecting it. */
- if (doing_vec
- && TREE_CODE (type) == POINTER_TYPE
- && !TYPE_HAS_DESTRUCTOR (TREE_TYPE (type)))
- {
- doing_vec = 0;
- use_global_delete = 1;
- }
-#endif
-
- if (doing_vec)
- return build_vec_delete (t, maxindex, integer_one_node,
- integer_two_node, use_global_delete);
- else
- {
- if (IS_AGGR_TYPE (TREE_TYPE (type))
- && TYPE_GETS_REG_DELETE (TREE_TYPE (type)))
- {
- /* Only do access checking here; we'll be calling op delete
- from the destructor. */
- tree tmp = build_opfncall (DELETE_EXPR, LOOKUP_NORMAL, t,
- size_zero_node, NULL_TREE);
- if (tmp == error_mark_node)
- return error_mark_node;
- }
-
- return build_delete (type, t, integer_three_node,
- LOOKUP_NORMAL, use_global_delete);
- }
-}
-
-/* Sanity check: report error if this function FUNCTION is not
- really a member of the class (CTYPE) it is supposed to belong to.
- CNAME is the same here as it is for grokclassfn above. */
-
-tree
-check_classfn (ctype, function)
- tree ctype, function;
-{
- tree fn_name = DECL_NAME (function);
- tree fndecl;
- tree method_vec = CLASSTYPE_METHOD_VEC (complete_type (ctype));
- tree *methods = 0;
- tree *end = 0;
-
- if (method_vec != 0)
- {
- methods = &TREE_VEC_ELT (method_vec, 0);
- end = TREE_VEC_END (method_vec);
-
- /* First suss out ctors and dtors. */
- if (*methods && fn_name == DECL_NAME (*methods)
- && DECL_CONSTRUCTOR_P (function))
- goto got_it;
- if (*++methods && fn_name == DECL_NAME (*methods)
- && DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (function)))
- goto got_it;
-
- while (++methods != end)
- {
- if (fn_name == DECL_NAME (*methods))
- {
- got_it:
- fndecl = *methods;
- while (fndecl)
- {
- if (DECL_ASSEMBLER_NAME (function) == DECL_ASSEMBLER_NAME (fndecl))
- return fndecl;
-#if 0
- /* This doesn't work for static member functions that are
- pretending to be methods. */
- /* We have to do more extensive argument checking here, as
- the name may have been changed by asm("new_name"). */
- if (decls_match (function, fndecl))
- return fndecl;
-#else
- if (DECL_NAME (function) == DECL_NAME (fndecl))
- {
- tree p1 = TYPE_ARG_TYPES (TREE_TYPE (function));
- tree p2 = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
-
- /* Get rid of the this parameter on functions that become
- static. */
- if (DECL_STATIC_FUNCTION_P (fndecl)
- && TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
- p1 = TREE_CHAIN (p1);
-
- if (comptypes (TREE_TYPE (TREE_TYPE (function)),
- TREE_TYPE (TREE_TYPE (fndecl)), 1)
- && compparms (p1, p2, 3))
- return fndecl;
- }
-#endif
- fndecl = DECL_CHAIN (fndecl);
- }
- break; /* loser */
- }
- }
- }
-
- if (methods != end)
- {
- tree fndecl = *methods;
- cp_error ("prototype for `%#D' does not match any in class `%T'",
- function, ctype);
- cp_error_at ("candidate%s: %+#D", DECL_CHAIN (fndecl) ? "s are" : " is",
- fndecl);
- while (fndecl = DECL_CHAIN (fndecl), fndecl)
- cp_error_at (" %#D", fndecl);
- }
- else
- {
- methods = 0;
- cp_error ("no `%#D' member function declared in class `%T'",
- function, ctype);
- }
-
- /* If we did not find the method in the class, add it to avoid
- spurious errors. */
- add_method (ctype, methods, function);
- return NULL_TREE;
-}
-
-/* Process the specs, declarator (NULL if omitted) and width (NULL if omitted)
- of a structure component, returning a FIELD_DECL node.
- QUALS is a list of type qualifiers for this decl (such as for declaring
- const member functions).
-
- This is done during the parsing of the struct declaration.
- The FIELD_DECL nodes are chained together and the lot of them
- are ultimately passed to `build_struct' to make the RECORD_TYPE node.
-
- C++:
-
- If class A defines that certain functions in class B are friends, then
- the way I have set things up, it is B who is interested in permission
- granted by A. However, it is in A's context that these declarations
- are parsed. By returning a void_type_node, class A does not attempt
- to incorporate the declarations of the friends within its structure.
-
- DO NOT MAKE ANY CHANGES TO THIS CODE WITHOUT MAKING CORRESPONDING
- CHANGES TO CODE IN `start_method'. */
-
-tree
-grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
- tree declarator, declspecs, init, asmspec_tree, attrlist;
-{
- register tree value;
- char *asmspec = 0;
- int flags = LOOKUP_ONLYCONVERTING;
-
- /* Convert () initializers to = initializers. */
- if (init == NULL_TREE && declarator != NULL_TREE
- && TREE_CODE (declarator) == CALL_EXPR
- && TREE_OPERAND (declarator, 0)
- && (TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE
- || TREE_CODE (TREE_OPERAND (declarator, 0)) == SCOPE_REF)
- && parmlist_is_exprlist (TREE_OPERAND (declarator, 1)))
- {
- init = TREE_OPERAND (declarator, 1);
- declarator = TREE_OPERAND (declarator, 0);
- flags = 0;
- }
-
- if (declspecs == NULL_TREE
- && TREE_CODE (declarator) == SCOPE_REF
- && TREE_CODE (TREE_OPERAND (declarator, 1)) == IDENTIFIER_NODE)
- {
- /* Access declaration */
- if (! IS_AGGR_TYPE_CODE (TREE_CODE (TREE_OPERAND (declarator, 0))))
- ;
- else if (TREE_COMPLEXITY (declarator) == current_class_depth)
- pop_nested_class (1);
- return do_class_using_decl (declarator);
- }
-
- if (init
- && TREE_CODE (init) == TREE_LIST
- && TREE_VALUE (init) == error_mark_node
- && TREE_CHAIN (init) == NULL_TREE)
- init = NULL_TREE;
-
- value = grokdeclarator (declarator, declspecs, FIELD, init != 0, NULL_TREE);
- if (! value)
- return value; /* friend or constructor went bad. */
-
- /* Pass friendly classes back. */
- if (TREE_CODE (value) == VOID_TYPE)
- return void_type_node;
-
- if (DECL_NAME (value) != NULL_TREE
- && IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
- && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr"))
- cp_error ("member `%D' conflicts with virtual function table field name", value);
-
- /* Stash away type declarations. */
- if (TREE_CODE (value) == TYPE_DECL)
- {
- DECL_NONLOCAL (value) = 1;
- DECL_CONTEXT (value) = current_class_type;
- DECL_CLASS_CONTEXT (value) = current_class_type;
- CLASSTYPE_LOCAL_TYPEDECLS (current_class_type) = 1;
-
- pushdecl_class_level (value);
- return value;
- }
-
- if (IS_SIGNATURE (current_class_type)
- && TREE_CODE (value) != FUNCTION_DECL)
- {
- error ("field declaration not allowed in signature");
- return void_type_node;
- }
-
- if (DECL_IN_AGGR_P (value))
- {
- cp_error ("`%D' is already defined in the class %T", value,
- DECL_CONTEXT (value));
- return void_type_node;
- }
-
- if (asmspec_tree)
- asmspec = TREE_STRING_POINTER (asmspec_tree);
-
- if (init)
- {
- if (IS_SIGNATURE (current_class_type)
- && TREE_CODE (value) == FUNCTION_DECL)
- {
- error ("function declarations cannot have initializers in signature");
- init = NULL_TREE;
- }
- else if (TREE_CODE (value) == FUNCTION_DECL)
- {
- grok_function_init (value, init);
- init = NULL_TREE;
- }
- else if (pedantic && TREE_CODE (value) != VAR_DECL)
- /* Already complained in grokdeclarator. */
- init = NULL_TREE;
- else
- {
- /* We allow initializers to become parameters to base
- initializers. */
- if (TREE_CODE (init) == TREE_LIST)
- {
- if (TREE_CHAIN (init) == NULL_TREE)
- init = TREE_VALUE (init);
- else
- init = digest_init (TREE_TYPE (value), init, (tree *)0);
- }
-
- if (TREE_CODE (init) == CONST_DECL)
- init = DECL_INITIAL (init);
- else if (TREE_READONLY_DECL_P (init))
- init = decl_constant_value (init);
- else if (TREE_CODE (init) == CONSTRUCTOR)
- init = digest_init (TREE_TYPE (value), init, (tree *)0);
- my_friendly_assert (TREE_PERMANENT (init), 192);
- if (init == error_mark_node)
- /* We must make this look different than `error_mark_node'
- because `decl_const_value' would mis-interpret it
- as only meaning that this VAR_DECL is defined. */
- init = build1 (NOP_EXPR, TREE_TYPE (value), init);
- else if (processing_template_decl)
- ;
- else if (! TREE_CONSTANT (init))
- {
- /* We can allow references to things that are effectively
- static, since references are initialized with the address. */
- if (TREE_CODE (TREE_TYPE (value)) != REFERENCE_TYPE
- || (TREE_STATIC (init) == 0
- && (TREE_CODE_CLASS (TREE_CODE (init)) != 'd'
- || DECL_EXTERNAL (init) == 0)))
- {
- error ("field initializer is not constant");
- init = error_mark_node;
- }
- }
- }
- }
-
- /* The corresponding pop_obstacks is in cp_finish_decl. */
- push_obstacks_nochange ();
-
- if (processing_template_decl && ! current_function_decl
- && (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == FUNCTION_DECL))
- push_template_decl (value);
-
- if (attrlist)
- cplus_decl_attributes (value, TREE_PURPOSE (attrlist),
- TREE_VALUE (attrlist));
-
- if (TREE_CODE (value) == VAR_DECL)
- {
- /* We cannot call pushdecl here, because that would
- fill in the value of our TREE_CHAIN. Instead, we
- modify cp_finish_decl to do the right thing, namely, to
- put this decl out straight away. */
- if (TREE_PUBLIC (value))
- {
- /* current_class_type can be NULL_TREE in case of error. */
- if (asmspec == 0 && current_class_type)
- {
- TREE_PUBLIC (value) = 1;
- DECL_INITIAL (value) = error_mark_node;
- DECL_ASSEMBLER_NAME (value)
- = build_static_name (current_class_type, DECL_NAME (value));
- }
- if (! processing_template_decl)
- pending_statics = perm_tree_cons (NULL_TREE, value, pending_statics);
-
- /* Static consts need not be initialized in the class definition. */
- if (init != NULL_TREE && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (value)))
- {
- static int explanation = 0;
-
- error ("initializer invalid for static member with constructor");
- if (explanation++ == 0)
- error ("(you really want to initialize it separately)");
- init = 0;
- }
- /* Force the compiler to know when an uninitialized static
- const member is being used. */
- if (TYPE_READONLY (value) && init == 0)
- TREE_USED (value) = 1;
- }
- DECL_INITIAL (value) = init;
- DECL_IN_AGGR_P (value) = 1;
- DECL_CONTEXT (value) = current_class_type;
- DECL_CLASS_CONTEXT (value) = current_class_type;
-
- cp_finish_decl (value, init, asmspec_tree, 1, flags);
- pushdecl_class_level (value);
- return value;
- }
- if (TREE_CODE (value) == FIELD_DECL)
- {
- if (asmspec)
- {
- /* This must override the asm specifier which was placed
- by grokclassfn. Lay this out fresh. */
- DECL_RTL (value) = NULL_RTX;
- DECL_ASSEMBLER_NAME (value) = get_identifier (asmspec);
- }
- if (DECL_INITIAL (value) == error_mark_node)
- init = error_mark_node;
- cp_finish_decl (value, init, asmspec_tree, 1, flags);
- DECL_INITIAL (value) = init;
- DECL_IN_AGGR_P (value) = 1;
- return value;
- }
- if (TREE_CODE (value) == FUNCTION_DECL)
- {
- check_default_args (value);
- if (DECL_CHAIN (value) != NULL_TREE)
- {
- /* Need a fresh node here so that we don't get circularity
- when we link these together. */
- value = copy_node (value);
- /* When does this happen? */
- my_friendly_assert (init == NULL_TREE, 193);
- }
- if (asmspec)
- {
- /* This must override the asm specifier which was placed
- by grokclassfn. Lay this out fresh. */
- DECL_RTL (value) = NULL_RTX;
- DECL_ASSEMBLER_NAME (value) = get_identifier (asmspec);
- }
- cp_finish_decl (value, init, asmspec_tree, 1, flags);
-
- /* Pass friends back this way. */
- if (DECL_FRIEND_P (value))
- return void_type_node;
-
-#if 0 /* Just because a fn is declared doesn't mean we'll try to define it. */
- if (current_function_decl && ! IS_SIGNATURE (current_class_type))
- cp_error ("method `%#D' of local class must be defined in class body",
- value);
-#endif
-
- DECL_IN_AGGR_P (value) = 1;
- return value;
- }
- my_friendly_abort (21);
- /* NOTREACHED */
- return NULL_TREE;
-}
-
-/* Like `grokfield', but for bitfields.
- WIDTH is non-NULL for bit fields only, and is an INTEGER_CST node. */
-
-tree
-grokbitfield (declarator, declspecs, width)
- tree declarator, declspecs, width;
-{
- register tree value = grokdeclarator (declarator, declspecs, BITFIELD,
- 0, NULL_TREE);
-
- if (! value) return NULL_TREE; /* friends went bad. */
-
- /* Pass friendly classes back. */
- if (TREE_CODE (value) == VOID_TYPE)
- return void_type_node;
-
- if (TREE_CODE (value) == TYPE_DECL)
- {
- cp_error ("cannot declare `%D' to be a bitfield type", value);
- return NULL_TREE;
- }
-
- if (IS_SIGNATURE (current_class_type))
- {
- error ("field declaration not allowed in signature");
- return void_type_node;
- }
-
- if (DECL_IN_AGGR_P (value))
- {
- cp_error ("`%D' is already defined in the class %T", value,
- DECL_CONTEXT (value));
- return void_type_node;
- }
-
- GNU_xref_member (current_class_name, value);
-
- if (TREE_STATIC (value))
- {
- cp_error ("static member `%D' cannot be a bitfield", value);
- return NULL_TREE;
- }
- cp_finish_decl (value, NULL_TREE, NULL_TREE, 0, 0);
-
- if (width != error_mark_node)
- {
- constant_expression_warning (width);
- DECL_INITIAL (value) = width;
- DECL_BIT_FIELD (value) = 1;
- }
-
- DECL_IN_AGGR_P (value) = 1;
- return value;
-}
-
-tree
-grokoptypename (declspecs, declarator)
- tree declspecs, declarator;
-{
- tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, NULL_TREE);
- return build_typename_overload (t);
-}
-
-/* When a function is declared with an initializer,
- do the right thing. Currently, there are two possibilities:
-
- class B
- {
- public:
- // initialization possibility #1.
- virtual void f () = 0;
- int g ();
- };
-
- class D1 : B
- {
- public:
- int d1;
- // error, no f ();
- };
-
- class D2 : B
- {
- public:
- int d2;
- void f ();
- };
-
- class D3 : B
- {
- public:
- int d3;
- // initialization possibility #2
- void f () = B::f;
- };
-
-*/
-
-int
-copy_assignment_arg_p (parmtype, virtualp)
- tree parmtype;
- int virtualp;
-{
- if (current_class_type == NULL_TREE)
- return 0;
-
- if (TREE_CODE (parmtype) == REFERENCE_TYPE)
- parmtype = TREE_TYPE (parmtype);
-
- if ((TYPE_MAIN_VARIANT (parmtype) == current_class_type)
-#if 0
- /* Non-standard hack to support old Booch components. */
- || (! virtualp && DERIVED_FROM_P (parmtype, current_class_type))
-#endif
- )
- return 1;
-
- return 0;
-}
-
-static void
-grok_function_init (decl, init)
- tree decl;
- tree init;
-{
- /* An initializer for a function tells how this function should
- be inherited. */
- tree type = TREE_TYPE (decl);
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- cp_error ("initializer specified for non-member function `%D'", decl);
-#if 0
- /* We'll check for this in finish_struct_1. */
- else if (DECL_VINDEX (decl) == NULL_TREE)
- cp_error ("initializer specified for non-virtual method `%D'", decl);
-#endif
- else if (integer_zerop (init))
- {
-#if 0
- /* Mark this function as being "defined". */
- DECL_INITIAL (decl) = error_mark_node;
- /* pure virtual destructors must be defined. */
- /* pure virtual needs to be defined (as abort) only when put in
- vtbl. For wellformed call, it should be itself. pr4737 */
- if (!DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl)))
- {
- extern tree abort_fndecl;
- /* Give this node rtl from `abort'. */
- DECL_RTL (decl) = DECL_RTL (abort_fndecl);
- }
-#endif
- DECL_ABSTRACT_VIRTUAL_P (decl) = 1;
- if (DECL_NAME (decl) == ansi_opname [(int) MODIFY_EXPR])
- {
- tree parmtype
- = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl))));
-
- if (copy_assignment_arg_p (parmtype, 1))
- TYPE_HAS_ABSTRACT_ASSIGN_REF (current_class_type) = 1;
- }
- }
- else if (TREE_CODE (init) == OFFSET_REF
- && TREE_OPERAND (init, 0) == NULL_TREE
- && TREE_CODE (TREE_TYPE (init)) == METHOD_TYPE)
- {
- tree basetype = DECL_CLASS_CONTEXT (init);
- tree basefn = TREE_OPERAND (init, 1);
- if (TREE_CODE (basefn) != FUNCTION_DECL)
- cp_error ("non-method initializer invalid for method `%D'", decl);
- else if (! BINFO_OFFSET_ZEROP (TYPE_BINFO (DECL_CLASS_CONTEXT (basefn))))
- sorry ("base member function from other than first base class");
- else
- {
- tree binfo = get_binfo (basetype, TYPE_METHOD_BASETYPE (type), 1);
- if (binfo == error_mark_node)
- ;
- else if (binfo == 0)
- error_not_base_type (TYPE_METHOD_BASETYPE (TREE_TYPE (init)),
- TYPE_METHOD_BASETYPE (type));
- else
- {
- /* Mark this function as being defined,
- and give it new rtl. */
- DECL_INITIAL (decl) = error_mark_node;
- DECL_RTL (decl) = DECL_RTL (basefn);
- }
- }
- }
- else
- cp_error ("invalid initializer for virtual method `%D'", decl);
-}
-
-void
-cplus_decl_attributes (decl, attributes, prefix_attributes)
- tree decl, attributes, prefix_attributes;
-{
- if (decl == NULL_TREE || decl == void_type_node)
- return;
-
- if (TREE_CODE (decl) == TEMPLATE_DECL)
- decl = DECL_TEMPLATE_RESULT (decl);
-
- decl_attributes (decl, attributes, prefix_attributes);
-
- if (TREE_CODE (decl) == TYPE_DECL)
- SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (decl), TREE_TYPE (decl));
-}
-
-/* CONSTRUCTOR_NAME:
- Return the name for the constructor (or destructor) for the
- specified class. Argument can be RECORD_TYPE, TYPE_DECL, or
- IDENTIFIER_NODE. When given a template, this routine doesn't
- lose the specialization. */
-
-tree
-constructor_name_full (thing)
- tree thing;
-{
- if (TREE_CODE (thing) == TEMPLATE_TYPE_PARM)
- thing = TYPE_NAME (thing);
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (thing)))
- {
- if (TYPE_WAS_ANONYMOUS (thing) && TYPE_HAS_CONSTRUCTOR (thing))
- thing = DECL_NAME (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (thing), 0));
- else
- thing = TYPE_NAME (thing);
- }
- if (TREE_CODE (thing) == TYPE_DECL
- || (TREE_CODE (thing) == TEMPLATE_DECL
- && TREE_CODE (DECL_TEMPLATE_RESULT (thing)) == TYPE_DECL))
- thing = DECL_NAME (thing);
- my_friendly_assert (TREE_CODE (thing) == IDENTIFIER_NODE, 197);
- return thing;
-}
-
-/* CONSTRUCTOR_NAME:
- Return the name for the constructor (or destructor) for the
- specified class. Argument can be RECORD_TYPE, TYPE_DECL, or
- IDENTIFIER_NODE. When given a template, return the plain
- unspecialized name. */
-
-tree
-constructor_name (thing)
- tree thing;
-{
- tree t;
- thing = constructor_name_full (thing);
- t = IDENTIFIER_TEMPLATE (thing);
- if (!t)
- return thing;
- return t;
-}
-
-/* Cache the value of this class's main virtual function table pointer
- in a register variable. This will save one indirection if a
- more than one virtual function call is made this function. */
-
-void
-setup_vtbl_ptr ()
-{
- extern tree base_init_expr;
-
- if (base_init_expr == 0
- && DECL_CONSTRUCTOR_P (current_function_decl))
- {
- if (processing_template_decl)
- add_tree (build_min_nt
- (CTOR_INITIALIZER,
- current_member_init_list, current_base_init_list));
- else
- emit_base_init (current_class_type, 0);
- }
-}
-
-/* Record the existence of an addressable inline function. */
-
-void
-mark_inline_for_output (decl)
- tree decl;
-{
- decl = DECL_MAIN_VARIANT (decl);
- if (DECL_SAVED_INLINE (decl))
- return;
- my_friendly_assert (TREE_PERMANENT (decl), 363);
- DECL_SAVED_INLINE (decl) = 1;
-#if 0
- if (DECL_PENDING_INLINE_INFO (decl) != 0
- && ! DECL_PENDING_INLINE_INFO (decl)->deja_vu)
- {
- struct pending_inline *t = pending_inlines;
- my_friendly_assert (DECL_SAVED_INSNS (decl) == 0, 198);
- while (t)
- {
- if (t == DECL_PENDING_INLINE_INFO (decl))
- break;
- t = t->next;
- }
- if (t == 0)
- {
- t = DECL_PENDING_INLINE_INFO (decl);
- t->next = pending_inlines;
- pending_inlines = t;
- }
- DECL_PENDING_INLINE_INFO (decl) = 0;
- }
-#endif
- saved_inlines = perm_tree_cons (NULL_TREE, decl, saved_inlines);
-}
-
-void
-clear_temp_name ()
-{
- temp_name_counter = 0;
-}
-
-/* Hand off a unique name which can be used for variable we don't really
- want to know about anyway, for example, the anonymous variables which
- are needed to make references work. Declare this thing so we can use it.
- The variable created will be of type TYPE.
-
- STATICP is nonzero if this variable should be static. */
-
-tree
-get_temp_name (type, staticp)
- tree type;
- int staticp;
-{
- char buf[sizeof (AUTO_TEMP_FORMAT) + 20];
- tree decl;
- int toplev = toplevel_bindings_p ();
-
- push_obstacks_nochange ();
- if (toplev || staticp)
- {
- end_temporary_allocation ();
- sprintf (buf, AUTO_TEMP_FORMAT, global_temp_name_counter++);
- decl = pushdecl_top_level (build_decl (VAR_DECL, get_identifier (buf), type));
- }
- else
- {
- sprintf (buf, AUTO_TEMP_FORMAT, temp_name_counter++);
- decl = pushdecl (build_decl (VAR_DECL, get_identifier (buf), type));
- }
- TREE_USED (decl) = 1;
- TREE_STATIC (decl) = staticp;
- DECL_ARTIFICIAL (decl) = 1;
-
- /* If this is a local variable, then lay out its rtl now.
- Otherwise, callers of this function are responsible for dealing
- with this variable's rtl. */
- if (! toplev)
- {
- expand_decl (decl);
- expand_decl_init (decl);
- }
- pop_obstacks ();
-
- return decl;
-}
-
-/* Get a variable which we can use for multiple assignments.
- It is not entered into current_binding_level, because
- that breaks things when it comes time to do final cleanups
- (which take place "outside" the binding contour of the function). */
-
-tree
-get_temp_regvar (type, init)
- tree type, init;
-{
- static char buf[sizeof (AUTO_TEMP_FORMAT) + 20] = { '_' };
- tree decl;
-
- sprintf (buf+1, AUTO_TEMP_FORMAT, temp_name_counter++);
- decl = build_decl (VAR_DECL, get_identifier (buf), type);
- TREE_USED (decl) = 1;
- DECL_REGISTER (decl) = 1;
-
- if (init)
- store_init_value (decl, init);
-
- /* We can expand these without fear, since they cannot need
- constructors or destructors. */
- expand_decl (decl);
- expand_decl_init (decl);
-
- return decl;
-}
-
-/* Finish off the processing of a UNION_TYPE structure.
- If there are static members, then all members are
- static, and must be laid out together. If the
- union is an anonymous union, we arrange for that
- as well. PUBLIC_P is nonzero if this union is
- not declared static. */
-
-void
-finish_anon_union (anon_union_decl)
- tree anon_union_decl;
-{
- tree type = TREE_TYPE (anon_union_decl);
- tree field, main_decl = NULL_TREE;
- tree elems = NULL_TREE;
- int public_p = TREE_PUBLIC (anon_union_decl);
- int static_p = TREE_STATIC (anon_union_decl);
- int external_p = DECL_EXTERNAL (anon_union_decl);
-
- if ((field = TYPE_FIELDS (type)) == NULL_TREE)
- return;
-
- if (public_p)
- {
- error ("global anonymous unions must be declared static");
- return;
- }
-
- for (; field; field = TREE_CHAIN (field))
- {
- tree decl;
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- if (TREE_PRIVATE (field))
- cp_pedwarn_at ("private member `%#D' in anonymous union", field);
- else if (TREE_PROTECTED (field))
- cp_pedwarn_at ("protected member `%#D' in anonymous union", field);
-
- decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field));
- /* tell `pushdecl' that this is not tentative. */
- DECL_INITIAL (decl) = error_mark_node;
- TREE_PUBLIC (decl) = public_p;
- TREE_STATIC (decl) = static_p;
- DECL_EXTERNAL (decl) = external_p;
- decl = pushdecl (decl);
-
- /* Only write out one anon union element--choose the one that
- can hold them all. */
- if (main_decl == NULL_TREE
- && 1 == simple_cst_equal (DECL_SIZE (decl),
- DECL_SIZE (anon_union_decl)))
- {
- main_decl = decl;
- }
- else
- {
- /* ??? This causes there to be no debug info written out
- about this decl. */
- TREE_ASM_WRITTEN (decl) = 1;
- }
-
- DECL_INITIAL (decl) = NULL_TREE;
- /* If there's a cleanup to do, it belongs in the
- TREE_PURPOSE of the following TREE_LIST. */
- elems = tree_cons (NULL_TREE, decl, elems);
- TREE_TYPE (elems) = type;
- }
- if (static_p)
- {
- if (main_decl)
- {
- make_decl_rtl (main_decl, 0, toplevel_bindings_p ());
- DECL_RTL (anon_union_decl) = DECL_RTL (main_decl);
- }
- else
- {
- warning ("anonymous union with no members");
- return;
- }
- }
-
- /* The following call assumes that there are never any cleanups
- for anonymous unions--a reasonable assumption. */
- expand_anon_union_decl (anon_union_decl, NULL_TREE, elems);
-}
-
-/* Finish and output a table which is generated by the compiler.
- NAME is the name to give the table.
- TYPE is the type of the table entry.
- INIT is all the elements in the table.
- PUBLICP is non-zero if this table should be given external access. */
-
-tree
-finish_table (name, type, init, publicp)
- tree name, type, init;
- int publicp;
-{
- tree itype, atype, decl;
- static tree empty_table;
- int is_empty = 0;
- tree asmspec;
-
- itype = build_index_type (size_int (list_length (init) - 1));
- atype = build_cplus_array_type (type, itype);
- layout_type (atype);
-
- if (TREE_VALUE (init) == integer_zero_node
- && TREE_CHAIN (init) == NULL_TREE)
- {
-#if 0
- if (empty_table == NULL_TREE)
-#endif
- {
- empty_table = get_temp_name (atype, 1);
- init = build (CONSTRUCTOR, atype, NULL_TREE, init);
- TREE_CONSTANT (init) = 1;
- TREE_STATIC (init) = 1;
- DECL_INITIAL (empty_table) = init;
- asmspec = build_string (IDENTIFIER_LENGTH (DECL_NAME (empty_table)),
- IDENTIFIER_POINTER (DECL_NAME (empty_table)));
- cp_finish_decl (empty_table, NULL_TREE, asmspec, 0, 0);
- }
- is_empty = 1;
- }
-
- if (name == NULL_TREE)
- {
- if (is_empty)
- return empty_table;
- decl = get_temp_name (atype, 1);
- }
- else
- {
- decl = build_decl (VAR_DECL, name, atype);
- decl = pushdecl (decl);
- TREE_STATIC (decl) = 1;
- }
-
- if (is_empty == 0)
- {
- TREE_PUBLIC (decl) = publicp;
- init = build (CONSTRUCTOR, atype, NULL_TREE, init);
- TREE_CONSTANT (init) = 1;
- TREE_STATIC (init) = 1;
- DECL_INITIAL (decl) = init;
- asmspec = build_string (IDENTIFIER_LENGTH (DECL_NAME (decl)),
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- }
- else
- {
- /* This will cause DECL to point to EMPTY_TABLE in rtl-land. */
- DECL_EXTERNAL (decl) = 1;
- TREE_STATIC (decl) = 0;
- init = 0;
- asmspec = build_string (IDENTIFIER_LENGTH (DECL_NAME (empty_table)),
- IDENTIFIER_POINTER (DECL_NAME (empty_table)));
- }
-
- cp_finish_decl (decl, NULL_TREE, asmspec, 0, 0);
- return decl;
-}
-
-/* Finish processing a builtin type TYPE. It's name is NAME,
- its fields are in the array FIELDS. LEN is the number of elements
- in FIELDS minus one, or put another way, it is the maximum subscript
- used in FIELDS.
-
- It is given the same alignment as ALIGN_TYPE. */
-
-void
-finish_builtin_type (type, name, fields, len, align_type)
- tree type;
- char *name;
- tree fields[];
- int len;
- tree align_type;
-{
- register int i;
-
- TYPE_FIELDS (type) = fields[0];
- for (i = 0; i < len; i++)
- {
- layout_type (TREE_TYPE (fields[i]));
- DECL_FIELD_CONTEXT (fields[i]) = type;
- TREE_CHAIN (fields[i]) = fields[i+1];
- }
- DECL_FIELD_CONTEXT (fields[i]) = type;
- DECL_CLASS_CONTEXT (fields[i]) = type;
- TYPE_ALIGN (type) = TYPE_ALIGN (align_type);
- layout_type (type);
-#if 0 /* not yet, should get fixed properly later */
- TYPE_NAME (type) = make_type_decl (get_identifier (name), type);
-#else
- TYPE_NAME (type) = build_decl (TYPE_DECL, get_identifier (name), type);
-#endif
- TYPE_STUB_DECL (type) = TYPE_NAME (type);
- layout_decl (TYPE_NAME (type), 0);
-}
-
-/* Auxiliary functions to make type signatures for
- `operator new' and `operator delete' correspond to
- what compiler will be expecting. */
-
-extern tree sizetype;
-
-tree
-coerce_new_type (type)
- tree type;
-{
- int e1 = 0, e2 = 0;
-
- if (TREE_CODE (type) == METHOD_TYPE)
- type = build_function_type (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type)));
- if (TREE_TYPE (type) != ptr_type_node)
- e1 = 1, error ("`operator new' must return type `void *'");
-
- /* Technically the type must be `size_t', but we may not know
- what that is. */
- if (TYPE_ARG_TYPES (type) == NULL_TREE)
- e1 = 1, error ("`operator new' takes type `size_t' parameter");
- else if (TREE_CODE (TREE_VALUE (TYPE_ARG_TYPES (type))) != INTEGER_TYPE
- || TYPE_PRECISION (TREE_VALUE (TYPE_ARG_TYPES (type))) != TYPE_PRECISION (sizetype))
- e2 = 1, error ("`operator new' takes type `size_t' as first parameter");
- if (e2)
- type = build_function_type (ptr_type_node, tree_cons (NULL_TREE, sizetype, TREE_CHAIN (TYPE_ARG_TYPES (type))));
- else if (e1)
- type = build_function_type (ptr_type_node, TYPE_ARG_TYPES (type));
- return type;
-}
-
-tree
-coerce_delete_type (type)
- tree type;
-{
- int e1 = 0, e2 = 0, e3 = 0;
- tree arg_types = TYPE_ARG_TYPES (type);
-
- if (TREE_CODE (type) == METHOD_TYPE)
- {
- type = build_function_type (TREE_TYPE (type), TREE_CHAIN (arg_types));
- arg_types = TREE_CHAIN (arg_types);
- }
-
- if (TREE_TYPE (type) != void_type_node)
- e1 = 1, error ("`operator delete' must return type `void'");
-
- if (arg_types == NULL_TREE
- || TREE_VALUE (arg_types) != ptr_type_node)
- e2 = 1, error ("`operator delete' takes type `void *' as first parameter");
-
- if (arg_types
- && TREE_CHAIN (arg_types)
- && TREE_CHAIN (arg_types) != void_list_node)
- {
- /* Again, technically this argument must be `size_t', but again
- we may not know what that is. */
- tree t2 = TREE_VALUE (TREE_CHAIN (arg_types));
- if (TREE_CODE (t2) != INTEGER_TYPE
- || TYPE_PRECISION (t2) != TYPE_PRECISION (sizetype))
- e3 = 1, error ("second argument to `operator delete' must be of type `size_t'");
- else if (TREE_CHAIN (TREE_CHAIN (arg_types)) != void_list_node)
- {
- e3 = 1;
- if (TREE_CHAIN (TREE_CHAIN (arg_types)))
- error ("too many arguments in declaration of `operator delete'");
- else
- error ("`...' invalid in specification of `operator delete'");
- }
- }
-
- if (e3)
- arg_types = tree_cons (NULL_TREE, ptr_type_node,
- build_tree_list (NULL_TREE, sizetype));
- else if (e3 |= e2)
- {
- if (arg_types == NULL_TREE)
- arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- else
- arg_types = tree_cons (NULL_TREE, ptr_type_node, TREE_CHAIN (arg_types));
- }
- else e3 |= e1;
-
- if (e3)
- type = build_function_type (void_type_node, arg_types);
-
- return type;
-}
-
-extern tree abort_fndecl;
-
-static void
-mark_vtable_entries (decl)
- tree decl;
-{
- tree entries = CONSTRUCTOR_ELTS (DECL_INITIAL (decl));
-
- if (flag_rtti)
- {
- tree fnaddr = (flag_vtable_thunks ? TREE_VALUE (TREE_CHAIN (entries))
- : FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (entries)));
- tree fn = TREE_OPERAND (fnaddr, 0);
- TREE_ADDRESSABLE (fn) = 1;
- mark_used (fn);
- }
- skip_rtti_stuff (&entries);
-
- for (; entries; entries = TREE_CHAIN (entries))
- {
- tree fnaddr = (flag_vtable_thunks ? TREE_VALUE (entries)
- : FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (entries)));
- tree fn = TREE_OPERAND (fnaddr, 0);
- TREE_ADDRESSABLE (fn) = 1;
- if (DECL_LANG_SPECIFIC (fn) && DECL_ABSTRACT_VIRTUAL_P (fn))
- TREE_OPERAND (fnaddr, 0) = fn = abort_fndecl;
- if (TREE_CODE (fn) == THUNK_DECL && DECL_EXTERNAL (fn))
- {
- DECL_EXTERNAL (fn) = 0;
- emit_thunk (fn);
- }
- mark_used (fn);
- }
-}
-
-/* Set DECL up to have the closest approximation of "initialized common"
- linkage available. */
-
-void
-comdat_linkage (decl)
- tree decl;
-{
- if (flag_weak)
- make_decl_one_only (decl);
- else
- TREE_PUBLIC (decl) = 0;
-}
-
-/* Set TREE_PUBLIC and/or DECL_EXTERN on the vtable DECL,
- based on TYPE and other static flags.
-
- Note that anything public is tagged TREE_PUBLIC, whether
- it's public in this file or in another one. */
-
-void
-import_export_vtable (decl, type, final)
- tree decl, type;
- int final;
-{
- if (DECL_INTERFACE_KNOWN (decl))
- return;
-
- /* +e0 or +e1 */
- if (write_virtuals < 2 && write_virtuals != 0)
- {
- TREE_PUBLIC (decl) = 1;
- if (write_virtuals < 0)
- DECL_EXTERNAL (decl) = 1;
- DECL_INTERFACE_KNOWN (decl) = 1;
- }
- else if (CLASSTYPE_INTERFACE_KNOWN (type))
- {
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = ! CLASSTYPE_VTABLE_NEEDS_WRITING (type);
- DECL_INTERFACE_KNOWN (decl) = 1;
- }
- else
- {
- /* We can only wait to decide if we have real non-inline virtual
- functions in our class, or if we come from a template. */
-
- int found = CLASSTYPE_TEMPLATE_INSTANTIATION (type);
-
- if (! found && ! final)
- {
- tree method;
- for (method = TYPE_METHODS (type); method != NULL_TREE;
- method = TREE_CHAIN (method))
- if (DECL_VINDEX (method) != NULL_TREE
- && ! DECL_THIS_INLINE (method)
- && ! DECL_ABSTRACT_VIRTUAL_P (method))
- {
- found = 1;
- break;
- }
- }
-
- if (final || ! found)
- {
- comdat_linkage (decl);
- DECL_EXTERNAL (decl) = 0;
- }
- else
- {
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = 1;
- }
- }
-}
-
-static void
-import_export_template (type)
- tree type;
-{
- if (CLASSTYPE_IMPLICIT_INSTANTIATION (type)
- && ! flag_implicit_templates
- && CLASSTYPE_INTERFACE_UNKNOWN (type))
- {
- SET_CLASSTYPE_INTERFACE_KNOWN (type);
- CLASSTYPE_INTERFACE_ONLY (type) = 1;
- CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 0;
- }
-}
-
-int
-finish_prevtable_vardecl (prev, vars)
- tree prev, vars;
-{
- tree ctype = DECL_CONTEXT (vars);
- import_export_template (ctype);
-
-#ifndef NO_LINKAGE_HEURISTICS
- if (CLASSTYPE_INTERFACE_UNKNOWN (ctype) && TYPE_VIRTUAL_P (ctype)
- && ! CLASSTYPE_TEMPLATE_INSTANTIATION (ctype))
- {
- tree method;
- for (method = TYPE_METHODS (ctype); method != NULL_TREE;
- method = TREE_CHAIN (method))
- {
- if (DECL_VINDEX (method) != NULL_TREE
- && !DECL_THIS_INLINE (method)
- && !DECL_ABSTRACT_VIRTUAL_P (method))
- {
- SET_CLASSTYPE_INTERFACE_KNOWN (ctype);
- CLASSTYPE_VTABLE_NEEDS_WRITING (ctype) = ! DECL_EXTERNAL (method);
- CLASSTYPE_INTERFACE_ONLY (ctype) = DECL_EXTERNAL (method);
- break;
- }
- }
- }
-#endif
-
- import_export_vtable (vars, ctype, 1);
- return 1;
-}
-
-static int
-finish_vtable_vardecl (prev, vars)
- tree prev, vars;
-{
- if (write_virtuals >= 0
- && ! DECL_EXTERNAL (vars)
- && ((TREE_PUBLIC (vars) && ! DECL_WEAK (vars) && ! DECL_ONE_ONLY (vars))
- || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars))
- || (hack_decl_function_context (vars) && TREE_USED (vars)))
- && ! TREE_ASM_WRITTEN (vars))
- {
- /* Write it out. */
- mark_vtable_entries (vars);
- if (TREE_TYPE (DECL_INITIAL (vars)) == 0)
- store_init_value (vars, DECL_INITIAL (vars));
-
- if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
- {
- /* Mark the VAR_DECL node representing the vtable itself as a
- "gratuitous" one, thereby forcing dwarfout.c to ignore it.
- It is rather important that such things be ignored because
- any effort to actually generate DWARF for them will run
- into trouble when/if we encounter code like:
-
- #pragma interface
- struct S { virtual void member (); };
-
- because the artificial declaration of the vtable itself (as
- manufactured by the g++ front end) will say that the vtable
- is a static member of `S' but only *after* the debug output
- for the definition of `S' has already been output. This causes
- grief because the DWARF entry for the definition of the vtable
- will try to refer back to an earlier *declaration* of the
- vtable as a static member of `S' and there won't be one.
- We might be able to arrange to have the "vtable static member"
- attached to the member list for `S' before the debug info for
- `S' get written (which would solve the problem) but that would
- require more intrusive changes to the g++ front end. */
-
- DECL_IGNORED_P (vars) = 1;
- }
-
- rest_of_decl_compilation (vars, NULL_PTR, 1, 1);
- return 1;
- }
- else if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars)))
- /* We don't know what to do with this one yet. */
- return 0;
-
- /* We know that PREV must be non-zero here. */
- TREE_CHAIN (prev) = TREE_CHAIN (vars);
- return 0;
-}
-
-static int
-prune_vtable_vardecl (prev, vars)
- tree prev, vars;
-{
- /* We know that PREV must be non-zero here. */
- TREE_CHAIN (prev) = TREE_CHAIN (vars);
- return 1;
-}
-
-int
-walk_vtables (typedecl_fn, vardecl_fn)
- register void (*typedecl_fn)();
- register int (*vardecl_fn)();
-{
- tree prev, vars;
- int flag = 0;
-
- for (prev = 0, vars = getdecls (); vars; vars = TREE_CHAIN (vars))
- {
- register tree type = TREE_TYPE (vars);
-
- if (TREE_CODE (vars) == VAR_DECL && DECL_VIRTUAL_P (vars))
- {
- if (vardecl_fn)
- flag |= (*vardecl_fn) (prev, vars);
-
- if (prev && TREE_CHAIN (prev) != vars)
- continue;
- }
- else if (TREE_CODE (vars) == TYPE_DECL
- && type != error_mark_node
- && TYPE_LANG_SPECIFIC (type)
- && CLASSTYPE_VSIZE (type))
- {
- if (typedecl_fn) (*typedecl_fn) (prev, vars);
- }
-
- prev = vars;
- }
-
- return flag;
-}
-
-static void
-finish_sigtable_vardecl (prev, vars)
- tree prev, vars;
-{
- /* We don't need to mark sigtable entries as addressable here as is done
- for vtables. Since sigtables, unlike vtables, are always written out,
- that was already done in build_signature_table_constructor. */
-
- rest_of_decl_compilation (vars, NULL_PTR, 1, 1);
-
- /* We know that PREV must be non-zero here. */
- TREE_CHAIN (prev) = TREE_CHAIN (vars);
-}
-
-void
-walk_sigtables (typedecl_fn, vardecl_fn)
- register void (*typedecl_fn)();
- register void (*vardecl_fn)();
-{
- tree prev, vars;
-
- for (prev = 0, vars = getdecls (); vars; vars = TREE_CHAIN (vars))
- {
- register tree type = TREE_TYPE (vars);
-
- if (TREE_CODE (vars) == TYPE_DECL
- && type != error_mark_node
- && IS_SIGNATURE (type))
- {
- if (typedecl_fn) (*typedecl_fn) (prev, vars);
- }
- else if (TREE_CODE (vars) == VAR_DECL
- && TREE_TYPE (vars) != error_mark_node
- && IS_SIGNATURE (TREE_TYPE (vars)))
- {
- if (vardecl_fn) (*vardecl_fn) (prev, vars);
- }
- else
- prev = vars;
- }
-}
-
-/* Determines the proper settings of TREE_PUBLIC and DECL_EXTERNAL for an
- inline function or template instantiation at end-of-file. */
-
-void
-import_export_decl (decl)
- tree decl;
-{
- if (DECL_INTERFACE_KNOWN (decl))
- return;
-
- if (DECL_TEMPLATE_INSTANTIATION (decl))
- {
- DECL_NOT_REALLY_EXTERN (decl) = 1;
- if (DECL_IMPLICIT_INSTANTIATION (decl)
- && (flag_implicit_templates || DECL_THIS_INLINE (decl)))
- {
- if (TREE_CODE (decl) == FUNCTION_DECL)
- comdat_linkage (decl);
- /* Dynamically initialized vars go into common. */
- else if (DECL_INITIAL (decl) == NULL_TREE
- || DECL_INITIAL (decl) == error_mark_node)
- DECL_COMMON (decl) = 1;
- else if (EMPTY_CONSTRUCTOR_P (DECL_INITIAL (decl)))
- {
- DECL_COMMON (decl) = 1;
- DECL_INITIAL (decl) = error_mark_node;
- }
- else
- {
- /* Statically initialized vars are weak or comdat, if
- supported. */
- if (flag_weak)
- make_decl_one_only (decl);
- /* else leave vars public so multiple defs will break. */
- }
- }
- else
- DECL_NOT_REALLY_EXTERN (decl) = 0;
- }
- else if (DECL_FUNCTION_MEMBER_P (decl))
- {
- tree ctype = DECL_CLASS_CONTEXT (decl);
- if (CLASSTYPE_INTERFACE_KNOWN (ctype) && ! DECL_ARTIFICIAL (decl))
- {
- DECL_NOT_REALLY_EXTERN (decl)
- = ! (CLASSTYPE_INTERFACE_ONLY (ctype)
- || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines));
- }
- else
- comdat_linkage (decl);
- }
- /* tinfo function */
- else if (DECL_ARTIFICIAL (decl) && DECL_MUTABLE_P (decl))
- {
- tree ctype = TREE_TYPE (DECL_NAME (decl));
- if (IS_AGGR_TYPE (ctype) && CLASSTYPE_INTERFACE_KNOWN (ctype)
- && TYPE_VIRTUAL_P (ctype))
- {
- DECL_NOT_REALLY_EXTERN (decl)
- = ! (CLASSTYPE_INTERFACE_ONLY (ctype)
- || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines));
- }
- else if (TYPE_BUILT_IN (ctype) && ctype == TYPE_MAIN_VARIANT (ctype))
- DECL_NOT_REALLY_EXTERN (decl) = 0;
- else
- comdat_linkage (decl);
- }
- else if (DECL_C_STATIC (decl))
- TREE_PUBLIC (decl) = 0;
- else
- comdat_linkage (decl);
-
- DECL_INTERFACE_KNOWN (decl) = 1;
-}
-
-tree
-build_cleanup (decl)
- tree decl;
-{
- tree temp;
- tree type = TREE_TYPE (decl);
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- temp = decl;
- else
- {
- mark_addressable (decl);
- temp = build1 (ADDR_EXPR, build_pointer_type (type), decl);
- }
- temp = build_delete (TREE_TYPE (temp), temp,
- integer_two_node,
- LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0);
- return temp;
-}
-
-extern int parse_time, varconst_time;
-extern tree pending_templates;
-extern tree maybe_templates;
-
-extern struct obstack permanent_obstack;
-extern tree get_id_2 ();
-
-static tree
-get_sentry (base)
- tree base;
-{
- tree sname = get_id_2 ("__sn", base);
- tree sentry = IDENTIFIER_GLOBAL_VALUE (sname);
- if (! sentry)
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- sentry = build_decl (VAR_DECL, sname, integer_type_node);
- TREE_PUBLIC (sentry) = 1;
- DECL_ARTIFICIAL (sentry) = 1;
- TREE_STATIC (sentry) = 1;
- TREE_USED (sentry) = 1;
- DECL_COMMON (sentry) = 1;
- pushdecl_top_level (sentry);
- cp_finish_decl (sentry, NULL_TREE, NULL_TREE, 0, 0);
- pop_obstacks ();
- }
- return sentry;
-}
-
-/* This routine is called from the last rule in yyparse ().
- Its job is to create all the code needed to initialize and
- destroy the global aggregates. We do the destruction
- first, since that way we only need to reverse the decls once. */
-
-void
-finish_file ()
-{
- extern int lineno;
- int start_time, this_time;
-
- tree fnname;
- tree vars;
- int needs_cleaning = 0, needs_messing_up = 0;
-
- at_eof = 1;
-
- if (flag_detailed_statistics)
- dump_tree_statistics ();
-
- /* Bad parse errors. Just forget about it. */
- if (! global_bindings_p () || current_class_type)
- return;
-
- start_time = get_run_time ();
-
- /* Otherwise, GDB can get confused, because in only knows
- about source for LINENO-1 lines. */
- lineno -= 1;
-
- interface_unknown = 1;
- interface_only = 0;
-
- for (fnname = pending_templates; fnname; fnname = TREE_CHAIN (fnname))
- {
- tree decl = TREE_VALUE (fnname);
- if (TREE_CODE_CLASS (TREE_CODE (decl)) == 't')
- {
- instantiate_class_template (decl);
- if (CLASSTYPE_TEMPLATE_INSTANTIATION (decl))
- for (vars = TYPE_METHODS (decl); vars; vars = TREE_CHAIN (vars))
- if (! DECL_ARTIFICIAL (vars))
- instantiate_decl (vars);
- }
- else
- instantiate_decl (decl);
- }
-
- for (fnname = maybe_templates; fnname; fnname = TREE_CHAIN (fnname))
- {
- tree *args, fn, decl = TREE_VALUE (fnname);
-
- if (DECL_INITIAL (decl))
- continue;
-
- fn = TREE_PURPOSE (fnname);
- args = get_bindings (fn, decl);
- fn = instantiate_template (fn, args);
- free (args);
- instantiate_decl (fn);
- }
-
- /* Push into C language context, because that's all
- we'll need here. */
- push_lang_context (lang_name_c);
-
-#if 1
- /* The reason for pushing garbage onto the global_binding_level is to
- ensure that we can slice out _DECLs which pertain to virtual function
- tables. If the last thing pushed onto the global_binding_level was a
- virtual function table, then slicing it out would slice away all the
- decls (i.e., we lose the head of the chain).
-
- There are several ways of getting the same effect, from changing the
- way that iterators over the chain treat the elements that pertain to
- virtual function tables, moving the implementation of this code to
- decl.c (where we can manipulate global_binding_level directly),
- popping the garbage after pushing it and slicing away the vtable
- stuff, or just leaving it alone. */
-
- /* Make last thing in global scope not be a virtual function table. */
-#if 0 /* not yet, should get fixed properly later */
- vars = make_type_decl (get_identifier (" @%$#@!"), integer_type_node);
-#else
- vars = build_decl (TYPE_DECL, get_identifier (" @%$#@!"), integer_type_node);
-#endif
- DECL_IGNORED_P (vars) = 1;
- SET_DECL_ARTIFICIAL (vars);
- pushdecl (vars);
-#endif
-
- /* Walk to mark the inline functions we need, then output them so
- that we can pick up any other tdecls that those routines need. */
- walk_vtables ((void (*)())0, finish_prevtable_vardecl);
-
- for (vars = pending_statics; vars; vars = TREE_CHAIN (vars))
- {
- tree decl = TREE_VALUE (vars);
-
- if (DECL_TEMPLATE_INSTANTIATION (decl)
- && ! DECL_IN_AGGR_P (decl))
- {
- import_export_decl (decl);
- DECL_EXTERNAL (decl) = ! DECL_NOT_REALLY_EXTERN (decl);
- }
- }
-
- for (vars = static_aggregates; vars; vars = TREE_CHAIN (vars))
- if (! TREE_ASM_WRITTEN (TREE_VALUE (vars)))
- rest_of_decl_compilation (TREE_VALUE (vars), 0, 1, 1);
- vars = static_aggregates;
-
- if (static_ctors || vars || exception_table_p ())
- needs_messing_up = 1;
- if (static_dtors)
- needs_cleaning = 1;
-
- /* See if we really need the hassle. */
- while (vars && needs_cleaning == 0)
- {
- tree decl = TREE_VALUE (vars);
- tree type = TREE_TYPE (decl);
- if (TYPE_NEEDS_DESTRUCTOR (type) && ! TREE_STATIC (vars))
- {
- needs_cleaning = 1;
- break;
- }
-
- vars = TREE_CHAIN (vars);
- }
-
- if (needs_cleaning == 0)
- goto mess_up;
-
- fnname = get_file_function_name ('D');
- start_function (void_list_node,
- make_call_declarator (fnname, void_list_node, NULL_TREE,
- NULL_TREE),
- NULL_TREE, 0);
- fnname = DECL_ASSEMBLER_NAME (current_function_decl);
- store_parm_decls ();
-
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
-
- /* These must be done in backward order to destroy,
- in which they happen to be! */
- for (vars = static_aggregates; vars; vars = TREE_CHAIN (vars))
- {
- tree decl = TREE_VALUE (vars);
- tree type = TREE_TYPE (decl);
- tree temp = TREE_PURPOSE (vars);
-
- if (TYPE_NEEDS_DESTRUCTOR (type) && ! TREE_STATIC (vars)
- && ! DECL_EXTERNAL (decl))
- {
- int protect = (TREE_PUBLIC (decl) && (DECL_COMMON (decl)
- || DECL_ONE_ONLY (decl)
- || DECL_WEAK (decl)));
-
- temp = build_cleanup (decl);
-
- if (protect)
- {
- tree sentry = get_sentry (DECL_ASSEMBLER_NAME (decl));
- sentry = build_unary_op (PREDECREMENT_EXPR, sentry, 0);
- sentry = build_binary_op (EQ_EXPR, sentry, integer_zero_node, 1);
- expand_start_cond (sentry, 0);
- }
-
- expand_expr_stmt (temp);
-
- if (protect)
- expand_end_cond ();
- }
- }
-
- for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
- expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
- NULL_TREE));
-
- expand_end_bindings (getdecls (), 1, 0);
- poplevel (1, 0, 0);
- pop_momentary ();
-
- finish_function (lineno, 0, 0);
-
- assemble_destructor (IDENTIFIER_POINTER (fnname));
-
- /* if it needed cleaning, then it will need messing up: drop through */
-
- mess_up:
- /* Must do this while we think we are at the top level. */
- vars = nreverse (static_aggregates);
- if (needs_messing_up)
- {
- fnname = get_file_function_name ('I');
- start_function (void_list_node,
- make_call_declarator (fnname, void_list_node, NULL_TREE,
- NULL_TREE),
- NULL_TREE, 0);
- fnname = DECL_ASSEMBLER_NAME (current_function_decl);
- store_parm_decls ();
-
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
-
- if (exception_table_p ())
- register_exception_table ();
-
- while (vars)
- {
- extern int temp_slot_level;
- extern int target_temp_slot_level;
- tree decl = TREE_VALUE (vars);
- tree init = TREE_PURPOSE (vars);
- tree old_cleanups = cleanups_this_call;
- int old_temp_level = target_temp_slot_level;
- push_temp_slots ();
- push_temp_slots ();
- target_temp_slot_level = temp_slot_level;
-
- /* If this was a static attribute within some function's scope,
- then don't initialize it here. Also, don't bother
- with initializers that contain errors. */
- if (TREE_STATIC (vars)
- || DECL_EXTERNAL (decl)
- || (init && TREE_CODE (init) == TREE_LIST
- && value_member (error_mark_node, init)))
- goto next_mess;
-
- if (TREE_CODE (decl) == VAR_DECL)
- {
- int protect = (TREE_PUBLIC (decl) && (DECL_COMMON (decl)
- || DECL_ONE_ONLY (decl)
- || DECL_WEAK (decl)));
-
- /* Set these global variables so that GDB at least puts
- us near the declaration which required the initialization. */
- input_filename = DECL_SOURCE_FILE (decl);
- lineno = DECL_SOURCE_LINE (decl);
- emit_note (input_filename, lineno);
-
- /* 9.5p5: The initializer of a static member of a class has
- the same access rights as a member function. */
- DECL_CLASS_CONTEXT (current_function_decl) = DECL_CONTEXT (decl);
- DECL_STATIC_FUNCTION_P (current_function_decl) = 1;
-
- if (protect)
- {
- tree sentry = get_sentry (DECL_ASSEMBLER_NAME (decl));
- sentry = build_unary_op (PREINCREMENT_EXPR, sentry, 0);
- sentry = build_binary_op
- (EQ_EXPR, sentry, integer_one_node, 1);
- expand_start_cond (sentry, 0);
- }
-
- if (IS_AGGR_TYPE (TREE_TYPE (decl))
- || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
- expand_aggr_init (decl, init, 0, 0);
- else if (TREE_CODE (init) == TREE_VEC)
- {
- expand_expr (expand_vec_init (decl, TREE_VEC_ELT (init, 0),
- TREE_VEC_ELT (init, 1),
- TREE_VEC_ELT (init, 2), 0),
- const0_rtx, VOIDmode, 0);
- }
- else
- expand_assignment (decl, init, 0, 0);
-
- if (protect)
- expand_end_cond ();
-
- DECL_CLASS_CONTEXT (current_function_decl) = NULL_TREE;
- DECL_STATIC_FUNCTION_P (current_function_decl) = 0;
- }
- else if (decl == error_mark_node)
- ;
- else my_friendly_abort (22);
-
- /* Cleanup any temporaries needed for the initial value. */
- expand_cleanups_to (old_cleanups);
- next_mess:
- pop_temp_slots ();
- pop_temp_slots ();
- target_temp_slot_level = old_temp_level;
-
- vars = TREE_CHAIN (vars);
- }
-
- for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
- expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
- NULL_TREE));
-
- expand_end_bindings (getdecls (), 1, 0);
- poplevel (1, 0, 0);
- pop_momentary ();
-
- finish_function (lineno, 0, 0);
- assemble_constructor (IDENTIFIER_POINTER (fnname));
- }
-
- expand_builtin_throw ();
-
- permanent_allocation (1);
-
- /* Done with C language context needs. */
- pop_lang_context ();
-
- /* Now write out any static class variables (which may have since
- learned how to be initialized). */
- while (pending_statics)
- {
- tree decl = TREE_VALUE (pending_statics);
-
- /* Output DWARF debug information. */
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- dwarfout_file_scope_decl (decl, 1);
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- dwarf2out_decl (decl);
-#endif
-
- DECL_DEFER_OUTPUT (decl) = 0;
- rest_of_decl_compilation
- (decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), 1, 1);
-
- pending_statics = TREE_CHAIN (pending_statics);
- }
-
- this_time = get_run_time ();
- parse_time -= this_time - start_time;
- varconst_time += this_time - start_time;
-
- start_time = get_run_time ();
-
- if (flag_handle_signatures)
- walk_sigtables ((void (*)())0, finish_sigtable_vardecl);
-
- for (fnname = saved_inlines; fnname; fnname = TREE_CHAIN (fnname))
- {
- tree decl = TREE_VALUE (fnname);
- import_export_decl (decl);
- }
-
- /* Now write out inline functions which had their addresses taken and
- which were not declared virtual and which were not declared `extern
- inline'. */
- {
- int reconsider = 1; /* More may be referenced; check again */
-
- while (reconsider)
- {
- tree *p = &saved_inlines;
- reconsider = 0;
-
- /* We need to do this each time so that newly completed template
- types don't wind up at the front of the list. Sigh. */
- vars = build_decl (TYPE_DECL, make_anon_name (), integer_type_node);
- DECL_IGNORED_P (vars) = 1;
- SET_DECL_ARTIFICIAL (vars);
- pushdecl (vars);
-
- reconsider |= walk_vtables ((void (*)())0, finish_vtable_vardecl);
-
- while (*p)
- {
- tree decl = TREE_VALUE (*p);
-
- if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
- && TREE_USED (decl)
- && (! DECL_REALLY_EXTERN (decl) || DECL_INLINE (decl)))
- {
- if (DECL_MUTABLE_P (decl))
- synthesize_tinfo_fn (decl);
- else
- synthesize_method (decl);
- reconsider = 1;
- }
-
- /* Catch new template instantiations. */
- if (decl != TREE_VALUE (*p))
- continue;
-
- if (TREE_ASM_WRITTEN (decl)
- || (DECL_SAVED_INSNS (decl) == 0 && ! DECL_ARTIFICIAL (decl)))
- *p = TREE_CHAIN (*p);
- else if (DECL_INITIAL (decl) == 0)
- p = &TREE_CHAIN (*p);
- else if ((TREE_PUBLIC (decl) && ! DECL_WEAK (decl)
- && ! DECL_ONE_ONLY (decl))
- || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
- || flag_keep_inline_functions)
- {
- if (DECL_NOT_REALLY_EXTERN (decl))
- {
- DECL_EXTERNAL (decl) = 0;
- reconsider = 1;
- /* We can't inline this function after it's been
- emitted, so just disable inlining. We want a
- variant of output_inline_function that doesn't
- prevent subsequent integration... */
- flag_no_inline = 1;
- temporary_allocation ();
- output_inline_function (decl);
- permanent_allocation (1);
- }
-
- *p = TREE_CHAIN (*p);
- }
- else
- p = &TREE_CHAIN (*p);
- }
- }
- }
-
- /* Now delete from the chain of variables all virtual function tables.
- We output them all ourselves, because each will be treated specially. */
-
- walk_vtables ((void (*)())0, prune_vtable_vardecl);
-
- for (vars = getdecls (); vars; vars = TREE_CHAIN (vars))
- {
- if (TREE_CODE (vars) == FUNCTION_DECL
- && ! DECL_INTERFACE_KNOWN (vars)
- && DECL_C_STATIC (vars))
- TREE_PUBLIC (vars) = 0;
- }
-
- if (write_virtuals == 2)
- {
- /* Now complain about an virtual function tables promised
- but not delivered. */
- while (pending_vtables)
- {
- if (TREE_PURPOSE (pending_vtables) == NULL_TREE)
- error ("virtual function table for `%s' not defined",
- IDENTIFIER_POINTER (TREE_VALUE (pending_vtables)));
- pending_vtables = TREE_CHAIN (pending_vtables);
- }
- }
-
- finish_repo ();
-
- this_time = get_run_time ();
- parse_time -= this_time - start_time;
- varconst_time += this_time - start_time;
-
- if (flag_detailed_statistics)
- dump_time_statistics ();
-}
-
-/* This is something of the form 'A()()()()()+1' that has turned out to be an
- expr. Since it was parsed like a type, we need to wade through and fix
- that. Unfortunately, since operator() is left-associative, we can't use
- tail recursion. In the above example, TYPE is `A', and DECL is
- `()()()()()'.
-
- Maybe this shouldn't be recursive, but how often will it actually be
- used? (jason) */
-
-tree
-reparse_absdcl_as_expr (type, decl)
- tree type, decl;
-{
- /* do build_functional_cast (type, NULL_TREE) at bottom */
- if (TREE_OPERAND (decl, 0) == NULL_TREE)
- return build_functional_cast (type, NULL_TREE);
-
- /* recurse */
- decl = reparse_decl_as_expr (type, TREE_OPERAND (decl, 0));
-
- decl = build_x_function_call (decl, NULL_TREE, current_class_ref);
-
- if (TREE_CODE (decl) == CALL_EXPR && TREE_TYPE (decl) != void_type_node)
- decl = require_complete_type (decl);
-
- return decl;
-}
-
-/* This is something of the form `int ((int)(int)(int)1)' that has turned
- out to be an expr. Since it was parsed like a type, we need to wade
- through and fix that. Since casts are right-associative, we are
- reversing the order, so we don't have to recurse.
-
- In the above example, DECL is the `(int)(int)(int)', and EXPR is the
- `1'. */
-
-tree
-reparse_absdcl_as_casts (decl, expr)
- tree decl, expr;
-{
- tree type;
-
- if (TREE_CODE (expr) == CONSTRUCTOR
- && TREE_TYPE (expr) == 0)
- {
- type = groktypename (TREE_VALUE (TREE_OPERAND (decl, 1)));
- decl = TREE_OPERAND (decl, 0);
-
- if (IS_SIGNATURE (type))
- {
- error ("cast specifies signature type");
- return error_mark_node;
- }
-
- expr = digest_init (type, expr, (tree *) 0);
- if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0)
- {
- int failure = complete_array_type (type, expr, 1);
- if (failure)
- my_friendly_abort (78);
- }
- }
-
- while (decl)
- {
- type = groktypename (TREE_VALUE (TREE_OPERAND (decl, 1)));
- decl = TREE_OPERAND (decl, 0);
- expr = build_c_cast (type, expr);
- }
-
- return expr;
-}
-
-/* Given plain tree nodes for an expression, build up the full semantics. */
-
-tree
-build_expr_from_tree (t)
- tree t;
-{
- if (t == NULL_TREE || t == error_mark_node)
- return t;
-
- switch (TREE_CODE (t))
- {
- case IDENTIFIER_NODE:
- return do_identifier (t, 0);
-
- case LOOKUP_EXPR:
- if (LOOKUP_EXPR_GLOBAL (t))
- return do_scoped_id (TREE_OPERAND (t, 0), 0);
- else
- return do_identifier (TREE_OPERAND (t, 0), 0);
-
- case INDIRECT_REF:
- return build_x_indirect_ref
- (build_expr_from_tree (TREE_OPERAND (t, 0)), "unary *");
-
- case CAST_EXPR:
- return build_functional_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case REINTERPRET_CAST_EXPR:
- return build_reinterpret_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case CONST_CAST_EXPR:
- return build_const_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case DYNAMIC_CAST_EXPR:
- return build_dynamic_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case STATIC_CAST_EXPR:
- return build_static_cast
- (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case NEGATE_EXPR:
- case BIT_NOT_EXPR:
- case ABS_EXPR:
- case TRUTH_NOT_EXPR:
- case ADDR_EXPR:
- case CONVERT_EXPR: /* Unary + */
- if (TREE_TYPE (t))
- return t;
- return build_x_unary_op (TREE_CODE (t),
- build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case EXACT_DIV_EXPR:
- case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case RSHIFT_EXPR:
- case LSHIFT_EXPR:
- case RROTATE_EXPR:
- case LROTATE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case MAX_EXPR:
- case MIN_EXPR:
- case LE_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case GT_EXPR:
- case MEMBER_REF:
- return build_x_binary_op
- (TREE_CODE (t),
- build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)));
-
- case DOTSTAR_EXPR:
- return build_m_component_ref
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)));
-
- case SCOPE_REF:
- return build_offset_ref (TREE_OPERAND (t, 0), TREE_OPERAND (t, 1));
-
- case ARRAY_REF:
- if (TREE_OPERAND (t, 0) == NULL_TREE)
- /* new-type-id */
- return build_parse_node (ARRAY_REF, NULL_TREE,
- build_expr_from_tree (TREE_OPERAND (t, 1)));
- return grok_array_decl (build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)));
-
- case SIZEOF_EXPR:
- {
- tree r = build_expr_from_tree (TREE_OPERAND (t, 0));
- if (TREE_CODE_CLASS (TREE_CODE (r)) != 't')
- r = TREE_TYPE (r);
- return c_sizeof (r);
- }
-
- case MODOP_EXPR:
- return build_x_modify_expr
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- TREE_CODE (TREE_OPERAND (t, 1)),
- build_expr_from_tree (TREE_OPERAND (t, 2)));
-
- case ARROW_EXPR:
- return build_x_arrow
- (build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case NEW_EXPR:
- return build_new
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)),
- build_expr_from_tree (TREE_OPERAND (t, 2)),
- NEW_EXPR_USE_GLOBAL (t));
-
- case DELETE_EXPR:
- return delete_sanity
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)),
- DELETE_EXPR_USE_VEC (t), DELETE_EXPR_USE_GLOBAL (t));
-
- case COMPOUND_EXPR:
- if (TREE_OPERAND (t, 1) == NULL_TREE)
- return build_x_compound_expr
- (build_expr_from_tree (TREE_OPERAND (t, 0)));
- else
- my_friendly_abort (42);
-
- case METHOD_CALL_EXPR:
- if (TREE_CODE (TREE_OPERAND (t, 0)) == SCOPE_REF)
- {
- tree ref = TREE_OPERAND (t, 0);
- return build_scoped_method_call
- (build_expr_from_tree (TREE_OPERAND (t, 1)),
- build_expr_from_tree (TREE_OPERAND (ref, 0)),
- TREE_OPERAND (ref, 1),
- build_expr_from_tree (TREE_OPERAND (t, 2)));
- }
- return build_method_call
- (build_expr_from_tree (TREE_OPERAND (t, 1)),
- TREE_OPERAND (t, 0),
- build_expr_from_tree (TREE_OPERAND (t, 2)),
- NULL_TREE, LOOKUP_NORMAL);
-
- case CALL_EXPR:
- if (TREE_CODE (TREE_OPERAND (t, 0)) == SCOPE_REF)
- {
- tree ref = TREE_OPERAND (t, 0);
- return build_member_call
- (build_expr_from_tree (TREE_OPERAND (ref, 0)),
- TREE_OPERAND (ref, 1),
- build_expr_from_tree (TREE_OPERAND (t, 1)));
- }
- else
- {
- tree name = TREE_OPERAND (t, 0);
- if (! really_overloaded_fn (name))
- name = build_expr_from_tree (name);
- return build_x_function_call
- (name, build_expr_from_tree (TREE_OPERAND (t, 1)),
- current_class_ref);
- }
-
- case COND_EXPR:
- return build_x_conditional_expr
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- build_expr_from_tree (TREE_OPERAND (t, 1)),
- build_expr_from_tree (TREE_OPERAND (t, 2)));
-
- case TREE_LIST:
- {
- tree purpose, value, chain;
-
- if (t == void_list_node)
- return t;
-
- purpose = TREE_PURPOSE (t);
- if (purpose)
- purpose = build_expr_from_tree (purpose);
- value = TREE_VALUE (t);
- if (value)
- value = build_expr_from_tree (value);
- chain = TREE_CHAIN (t);
- if (chain && chain != void_type_node)
- chain = build_expr_from_tree (chain);
- return tree_cons (purpose, value, chain);
- }
-
- case COMPONENT_REF:
- return build_x_component_ref
- (build_expr_from_tree (TREE_OPERAND (t, 0)),
- TREE_OPERAND (t, 1), NULL_TREE, 1);
-
- case THROW_EXPR:
- return build_throw (build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case CONSTRUCTOR:
- {
- tree r = build_nt (CONSTRUCTOR, NULL_TREE,
- build_expr_from_tree (CONSTRUCTOR_ELTS (t)));
-
- if (TREE_TYPE (t))
- return digest_init (TREE_TYPE (t), r, 0);
- return r;
- }
-
- case TYPEID_EXPR:
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 0))) == 't')
- return get_typeid (TREE_OPERAND (t, 0));
- return build_x_typeid (build_expr_from_tree (TREE_OPERAND (t, 0)));
-
- case VAR_DECL:
- return convert_from_reference (t);
-
- default:
- return t;
- }
-}
-
-/* This is something of the form `int (*a)++' that has turned out to be an
- expr. It was only converted into parse nodes, so we need to go through
- and build up the semantics. Most of the work is done by
- build_expr_from_tree, above.
-
- In the above example, TYPE is `int' and DECL is `*a'. */
-
-tree
-reparse_decl_as_expr (type, decl)
- tree type, decl;
-{
- decl = build_expr_from_tree (decl);
- if (type)
- return build_functional_cast (type, build_tree_list (NULL_TREE, decl));
- else
- return decl;
-}
-
-/* This is something of the form `int (*a)' that has turned out to be a
- decl. It was only converted into parse nodes, so we need to do the
- checking that make_{pointer,reference}_declarator do. */
-
-tree
-finish_decl_parsing (decl)
- tree decl;
-{
- extern int current_class_depth;
-
- switch (TREE_CODE (decl))
- {
- case IDENTIFIER_NODE:
- return decl;
- case INDIRECT_REF:
- return make_pointer_declarator
- (NULL_TREE, finish_decl_parsing (TREE_OPERAND (decl, 0)));
- case ADDR_EXPR:
- return make_reference_declarator
- (NULL_TREE, finish_decl_parsing (TREE_OPERAND (decl, 0)));
- case BIT_NOT_EXPR:
- TREE_OPERAND (decl, 0) = finish_decl_parsing (TREE_OPERAND (decl, 0));
- return decl;
- case SCOPE_REF:
- push_nested_class (TREE_TYPE (TREE_OPERAND (decl, 0)), 3);
- TREE_COMPLEXITY (decl) = current_class_depth;
- return decl;
- case ARRAY_REF:
- TREE_OPERAND (decl, 0) = finish_decl_parsing (TREE_OPERAND (decl, 0));
- return decl;
- default:
- my_friendly_abort (5);
- return NULL_TREE;
- }
-}
-
-tree
-check_cp_case_value (value)
- tree value;
-{
- if (value == NULL_TREE)
- return value;
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- STRIP_TYPE_NOPS (value);
-
- if (TREE_READONLY_DECL_P (value))
- {
- value = decl_constant_value (value);
- STRIP_TYPE_NOPS (value);
- }
- value = fold (value);
-
- if (TREE_CODE (value) != INTEGER_CST
- && value != error_mark_node)
- {
- cp_error ("case label `%E' does not reduce to an integer constant",
- value);
- value = error_mark_node;
- }
- else
- /* Promote char or short to int. */
- value = default_conversion (value);
-
- constant_expression_warning (value);
-
- return value;
-}
-
-tree current_namespace;
-
-/* Get the inner part of a namespace id. It doesn't have any prefix, nor
- postfix. Returns 0 if in global namespace. */
-
-tree
-get_namespace_id ()
-{
- tree x = current_namespace;
- if (x)
- x = TREE_PURPOSE (x);
- return x;
-}
-
-/* Build up a DECL_ASSEMBLER_NAME for NAME in the current namespace. */
-
-tree
-current_namespace_id (name)
- tree name;
-{
- tree old_id = get_namespace_id ();
- char *buf;
-
- /* Global names retain old encoding. */
- if (! old_id)
- return name;
-
- buf = (char *) alloca (8 + IDENTIFIER_LENGTH (old_id)
- + IDENTIFIER_LENGTH (name));
- sprintf (buf, "__ns_%s_%s", IDENTIFIER_POINTER (old_id),
- IDENTIFIER_POINTER (name));
- return get_identifier (buf);
-}
-
-void
-do_namespace_alias (alias, namespace)
- tree alias, namespace;
-{
- sorry ("namespace alias");
-}
-
-void
-do_toplevel_using_decl (decl)
- tree decl;
-{
- if (decl == NULL_TREE || decl == error_mark_node)
- return;
-
- if (TREE_CODE (decl) == SCOPE_REF)
- decl = resolve_scope_to_name (NULL_TREE, decl);
-
- /* Is this the right way to do an id list? */
- if (TREE_CODE (decl) != TREE_LIST)
- {
- pushdecl (decl);
- }
- else
- while (decl)
- {
- pushdecl (TREE_VALUE (decl));
- decl = TREE_CHAIN (decl);
- }
-}
-
-tree
-do_class_using_decl (decl)
- tree decl;
-{
- tree name, value;
-
- if (TREE_CODE (decl) != SCOPE_REF)
- {
- cp_error ("using-declaration for non-member at class scope");
- return NULL_TREE;
- }
- name = TREE_OPERAND (decl, 1);
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- cp_error ("using-declaration for destructor");
- return NULL_TREE;
- }
-
- value = build_lang_field_decl (USING_DECL, name, void_type_node);
- DECL_INITIAL (value) = TREE_OPERAND (decl, 0);
- return value;
-}
-
-void
-do_using_directive (namespace)
- tree namespace;
-{
- sorry ("using directive");
-}
-
-void
-check_default_args (x)
- tree x;
-{
- tree arg = TYPE_ARG_TYPES (TREE_TYPE (x));
- int saw_def = 0, i = 0 - (TREE_CODE (TREE_TYPE (x)) == METHOD_TYPE);
- for (; arg && arg != void_list_node; arg = TREE_CHAIN (arg), ++i)
- {
- if (TREE_PURPOSE (arg))
- saw_def = 1;
- else if (saw_def)
- {
- cp_error ("default argument missing for parameter %P of `%#D'",
- i, x);
- break;
- }
- }
-}
-
-void
-mark_used (decl)
- tree decl;
-{
- TREE_USED (decl) = 1;
- if (processing_template_decl)
- return;
- assemble_external (decl);
- /* Is it a synthesized method that needs to be synthesized? */
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_CLASS_CONTEXT (decl)
- && DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
- /* Kludge: don't synthesize for default args. */
- && current_function_decl)
- synthesize_method (decl);
- if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl))
- instantiate_decl (decl);
-}
diff --git a/gcc/cp/errfn.c b/gcc/cp/errfn.c
deleted file mode 100644
index b5ab8f7b676..00000000000
--- a/gcc/cp/errfn.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Provide a call-back mechanism for handling error output.
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
- Contributed by Jason Merrill (jason@cygnus.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 "tree.h"
-#include <stdio.h>
-#include <ctype.h>
-
-/* cp_printer is the type of a function which converts an argument into
- a string for digestion by printf. The cp_printer function should deal
- with all memory management; the functions in this file will not free
- the char*s returned. See error.c for an example use of this code. */
-
-typedef char* cp_printer PROTO((HOST_WIDE_INT, int));
-extern cp_printer * cp_printers[256];
-
-/* Whether or not we should try to be quiet for errors and warnings; this is
- used to avoid being too talkative about problems with tentative choices
- when we're computing the conversion costs for a method call. */
-int cp_silent = 0;
-
-typedef void errorfn (); /* deliberately vague */
-
-extern char* cp_file_of PROTO((tree));
-extern int cp_line_of PROTO((tree));
-
-#define STRDUP(f) (ap = (char *) alloca (strlen (f) +1), strcpy (ap, (f)), ap)
-
-#define NARGS 5
-#define arglist a1, a2, a3, a4, a5
-#define arglist_dcl HOST_WIDE_INT a1, a2, a3, a4, a5;
-#define ARGSINIT \
- args[0] = a1; args[1] = a2; args[2] = a3; args[3] = a4; args[4] = a5;
-#define ARGSLIST args[0], args[1], args[2], args[3], args[4]
-
-static void
-cp_thing (errfn, atarg1, format, arglist)
- errorfn *errfn;
- int atarg1;
- char *format;
- arglist_dcl
-{
- char *fmt;
- char *f;
- char *ap;
- int arg;
- HOST_WIDE_INT atarg = atarg1 ? a1 : 0;
- HOST_WIDE_INT args[NARGS];
- ARGSINIT
-
- fmt = STRDUP(format);
-
- for (f = fmt, arg = 0; *f; ++f)
- {
- cp_printer * function;
- int alternate;
- int maybe_here;
-
- /* ignore text */
- if (*f != '%') continue;
-
- ++f;
-
- alternate = 0;
- maybe_here = 0;
-
- /* ignore most flags */
- while (*f == ' ' || *f == '-' || *f == '+' || *f == '#')
- {
- if (*f == '+')
- maybe_here = 1;
- else if (*f == '#')
- alternate = 1;
- ++f;
- }
-
- /* ignore field width */
- if (*f == '*')
- {
- ++f;
- ++arg;
- }
- else
- while (isdigit (*f))
- ++f;
-
- /* ignore precision */
- if (*f == '.')
- {
- ++f;
- if (*f == '*')
- {
- ++f;
- ++arg;
- }
- else
- while (isdigit (*f))
- ++f;
- }
-
- /* ignore "long" */
- if (*f == 'l')
- ++f;
-
- function = cp_printers[(int)*f];
-
- if (function)
- {
- char *p;
-
- if (arg >= NARGS) abort ();
-
- if (maybe_here && atarg1)
- atarg = args[arg];
-
- /* Must use a temporary to avoid calling *function twice */
- p = (*function) (args[arg], alternate);
- args[arg] = (HOST_WIDE_INT) STRDUP(p);
- *f = 's';
- }
-
- ++arg; /* Assume valid format string */
-
- }
-
- if (atarg)
- {
- char *file = cp_file_of ((tree) atarg);
- int line = cp_line_of ((tree) atarg);
- (*errfn) (file, line, fmt, ARGSLIST);
- }
- else
- (*errfn) (fmt, ARGSLIST);
-
-}
-
-void
-cp_error (format, arglist)
- char *format;
- arglist_dcl
-{
- extern errorfn error;
- if (! cp_silent)
- cp_thing (error, 0, format, arglist);
-}
-
-void
-cp_warning (format, arglist)
- char *format;
- arglist_dcl
-{
- extern errorfn warning;
- if (! cp_silent)
- cp_thing (warning, 0, format, arglist);
-}
-
-void
-cp_pedwarn (format, arglist)
- char *format;
- arglist_dcl
-{
- extern errorfn pedwarn;
- if (! cp_silent)
- cp_thing (pedwarn, 0, format, arglist);
-}
-
-void
-cp_compiler_error (format, arglist)
- char *format;
- arglist_dcl
-{
- extern errorfn compiler_error;
- if (! cp_silent)
- cp_thing (compiler_error, 0, format, arglist);
-}
-
-void
-cp_sprintf (format, arglist)
- char *format;
- arglist_dcl
-{
- cp_thing ((errorfn *) sprintf, 0, format, arglist);
-}
-
-void
-cp_error_at (format, arglist)
- char *format;
- arglist_dcl
-{
- extern errorfn error_with_file_and_line;
- if (! cp_silent)
- cp_thing (error_with_file_and_line, 1, format, arglist);
-}
-
-void
-cp_warning_at (format, arglist)
- char *format;
- arglist_dcl
-{
- extern errorfn warning_with_file_and_line;
- if (! cp_silent)
- cp_thing (warning_with_file_and_line, 1, format, arglist);
-}
-
-void
-cp_pedwarn_at (format, arglist)
- char *format;
- arglist_dcl
-{
- extern errorfn pedwarn_with_file_and_line;
- if (! cp_silent)
- cp_thing (pedwarn_with_file_and_line, 1, format, arglist);
-}
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
deleted file mode 100644
index 8d9ade45fcf..00000000000
--- a/gcc/cp/error.c
+++ /dev/null
@@ -1,1659 +0,0 @@
-/* Call-backs for C++ error reporting.
- This code is non-reentrant.
- Copyright (C) 1993, 1994, 1995, 1996 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. */
-
-#include "config.h"
-#include "tree.h"
-#include "cp-tree.h"
-#include "obstack.h"
-#include <ctype.h>
-
-typedef char* cp_printer ();
-
-#define A args_as_string
-#define C code_as_string
-#define D decl_as_string
-#define E expr_as_string
-#define L language_as_string
-#define O op_as_string
-#define P parm_as_string
-#define Q assop_as_string
-#define T type_as_string
-#define V cv_as_string
-
-#define _ (cp_printer *) 0
-cp_printer * cp_printers[256] =
-{
-/*0 1 2 3 4 5 6 7 8 9 A B C D E F */
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* 0x00 */
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* 0x10 */
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* 0x20 */
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* 0x30 */
- _, A, _, C, D, E, _, _, _, _, _, _, L, _, _, O, /* 0x40 */
- P, Q, _, _, T, _, V, _, _, _, _, _, _, _, _, _, /* 0x50 */
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* 0x60 */
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* 0x70 */
-};
-#undef C
-#undef D
-#undef E
-#undef L
-#undef O
-#undef P
-#undef Q
-#undef T
-#undef V
-#undef _
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-/* Obstack where we build text strings for overloading, etc. */
-static struct obstack scratch_obstack;
-static char *scratch_firstobj;
-
-# define OB_INIT() (scratch_firstobj ? (obstack_free (&scratch_obstack, scratch_firstobj), 0) : 0)
-# define OB_PUTC(C) (obstack_1grow (&scratch_obstack, (C)))
-# define OB_PUTC2(C1,C2) \
- (obstack_1grow (&scratch_obstack, (C1)), obstack_1grow (&scratch_obstack, (C2)))
-# define OB_PUTS(S) (obstack_grow (&scratch_obstack, (S), sizeof (S) - 1))
-# define OB_PUTID(ID) \
- (obstack_grow (&scratch_obstack, IDENTIFIER_POINTER (ID), \
- IDENTIFIER_LENGTH (ID)))
-# define OB_PUTCP(S) (obstack_grow (&scratch_obstack, (S), strlen (S)))
-# define OB_FINISH() (obstack_1grow (&scratch_obstack, '\0'))
-# define OB_PUTI(CST) do { sprintf (digit_buffer, "%d", (CST)); \
- OB_PUTCP (digit_buffer); } while (0)
-# define OB_UNPUT(N) obstack_blank (&scratch_obstack, - (N));
-
-# define NEXT_CODE(t) (TREE_CODE (TREE_TYPE (t)))
-
-static void dump_type (), dump_decl (), dump_function_decl ();
-static void dump_expr (), dump_unary_op (), dump_binary_op ();
-static void dump_aggr_type (), dump_type_prefix (), dump_type_suffix ();
-static void dump_function_name ();
-
-void
-init_error ()
-{
- gcc_obstack_init (&scratch_obstack);
- scratch_firstobj = (char *)obstack_alloc (&scratch_obstack, 0);
-}
-
-enum pad { none, before, after };
-
-static void
-dump_readonly_or_volatile (t, p)
- tree t;
- enum pad p;
-{
- if (TYPE_READONLY (t) || TYPE_VOLATILE (t))
- {
- if (p == before) OB_PUTC (' ');
- if (TYPE_READONLY (t))
- OB_PUTS ("const");
- if (TYPE_READONLY (t) && TYPE_VOLATILE (t))
- OB_PUTC (' ');
- if (TYPE_VOLATILE (t))
- OB_PUTS ("volatile");
- if (p == after) OB_PUTC (' ');
- }
-}
-
-/* This must be large enough to hold any printed integer or floating-point
- value. */
-static char digit_buffer[128];
-
-/* Dump into the obstack a human-readable equivalent of TYPE. */
-
-static void
-dump_type (t, v)
- tree t;
- int v; /* verbose? */
-{
- if (t == NULL_TREE)
- return;
-
- if (TYPE_PTRMEMFUNC_P (t))
- goto offset_type;
-
- switch (TREE_CODE (t))
- {
- case ERROR_MARK:
- OB_PUTS ("{error}");
- break;
-
- case UNKNOWN_TYPE:
- OB_PUTS ("{unknown type}");
- break;
-
- case TREE_LIST:
- /* i.e. function taking no arguments */
- if (t != void_list_node)
- {
- dump_type (TREE_VALUE (t), v);
- /* Can this happen other than for default arguments? */
- if (TREE_PURPOSE (t) && v)
- {
- OB_PUTS (" = ");
- dump_expr (TREE_PURPOSE (t));
- }
- if (TREE_CHAIN (t))
- {
- if (TREE_CHAIN (t) != void_list_node)
- {
- OB_PUTC2 (',', ' ');
- dump_type (TREE_CHAIN (t), v);
- }
- }
- else OB_PUTS (" ...");
- }
- break;
-
- case IDENTIFIER_NODE:
- OB_PUTID (t);
- break;
-
- case TREE_VEC:
- dump_type (BINFO_TYPE (t), v);
- break;
-
- case RECORD_TYPE:
- case UNION_TYPE:
- case ENUMERAL_TYPE:
- if (TYPE_LANG_SPECIFIC (t)
- && (IS_SIGNATURE_POINTER (t) || IS_SIGNATURE_REFERENCE (t)))
- {
- if (TYPE_READONLY (t) | TYPE_VOLATILE (t))
- dump_readonly_or_volatile (t);
- dump_type (SIGNATURE_TYPE (t), v);
- if (IS_SIGNATURE_POINTER (t))
- OB_PUTC ('*');
- else
- OB_PUTC ('&');
- }
- else
- dump_aggr_type (t, v);
- break;
-
- case TYPE_DECL:
- dump_decl (t, v);
- break;
-
- case INTEGER_TYPE:
- if (!TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)) && TREE_UNSIGNED (t))
- OB_PUTS ("unsigned ");
- else if (TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)) && !TREE_UNSIGNED (t))
- OB_PUTS ("signed ");
-
- /* fall through. */
- case REAL_TYPE:
- case VOID_TYPE:
- case BOOLEAN_TYPE:
- dump_readonly_or_volatile (t, after);
- OB_PUTID (TYPE_IDENTIFIER (t));
- break;
-
- case TEMPLATE_TYPE_PARM:
- if (TYPE_IDENTIFIER (t))
- OB_PUTID (TYPE_IDENTIFIER (t));
- else
- OB_PUTS ("{anonymous template type parm}");
- break;
-
- /* This is not always necessary for pointers and such, but doing this
- reduces code size. */
- case ARRAY_TYPE:
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- case OFFSET_TYPE:
- offset_type:
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- dump_type_prefix (t, v);
- dump_type_suffix (t, v);
- break;
-
- case TYPENAME_TYPE:
- OB_PUTS ("typename ");
- dump_type (TYPE_CONTEXT (t), 0);
- OB_PUTS ("::");
- OB_PUTID (TYPE_IDENTIFIER (t));
- break;
-
- default:
- sorry ("`%s' not supported by dump_type",
- tree_code_name[(int) TREE_CODE (t)]);
- }
-}
-
-static char *
-aggr_variety (t)
- tree t;
-{
- if (TREE_CODE (t) == ENUMERAL_TYPE)
- return "enum";
- else if (TREE_CODE (t) == UNION_TYPE)
- return "union";
- else if (TYPE_LANG_SPECIFIC (t) && CLASSTYPE_DECLARED_CLASS (t))
- return "class";
- else if (TYPE_LANG_SPECIFIC (t) && IS_SIGNATURE (t))
- return "signature";
- else
- return "struct";
-}
-
-/* Print out a class declaration, in the form `class foo'. */
-
-static void
-dump_aggr_type (t, v)
- tree t;
- int v; /* verbose? */
-{
- tree name;
- char *variety = aggr_variety (t);
-
- dump_readonly_or_volatile (t, after);
-
- if (v > 0)
- {
- OB_PUTCP (variety);
- OB_PUTC (' ');
- }
-
- name = TYPE_NAME (t);
-
- if (name && DECL_CONTEXT (name))
- {
- /* FUNCTION_DECL or RECORD_TYPE */
- dump_decl (DECL_CONTEXT (name), 0);
- OB_PUTC2 (':', ':');
- }
-
- /* kludge around weird behavior on g++.brendan/line1.C */
- if (name && TREE_CODE (name) != IDENTIFIER_NODE)
- name = DECL_NAME (name);
-
- if (name == 0 || ANON_AGGRNAME_P (name))
- {
- OB_PUTS ("{anonymous");
- if (!v)
- {
- OB_PUTC (' ');
- OB_PUTCP (variety);
- }
- OB_PUTC ('}');
- }
- else
- OB_PUTID (name);
-}
-
-/* Dump into the obstack the initial part of the output for a given type.
- This is necessary when dealing with things like functions returning
- functions. Examples:
-
- return type of `int (* fee ())()': pointer -> function -> int. Both
- pointer (and reference and offset) and function (and member) types must
- deal with prefix and suffix.
-
- Arrays must also do this for DECL nodes, like int a[], and for things like
- int *[]&. */
-
-static void
-dump_type_prefix (t, v)
- tree t;
- int v; /* verbosity */
-{
- if (TYPE_PTRMEMFUNC_P (t))
- {
- t = TYPE_PTRMEMFUNC_FN_TYPE (t);
- goto offset_type;
- }
-
- switch (TREE_CODE (t))
- {
- case POINTER_TYPE:
- {
- tree sub = TREE_TYPE (t);
-
- dump_type_prefix (sub, v);
- /* A tree for a member pointer looks like pointer to offset,
- so let the OFFSET_TYPE case handle it. */
- if (TREE_CODE (sub) != OFFSET_TYPE)
- {
- switch (TREE_CODE (sub))
- {
- /* We don't want int ( *)() */
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- break;
-
- case ARRAY_TYPE:
- OB_PUTC2 (' ', '(');
- break;
-
- case POINTER_TYPE:
- /* We don't want "char * *" */
- if (! (TYPE_READONLY (sub) || TYPE_VOLATILE (sub)))
- break;
- /* But we do want "char *const *" */
-
- default:
- OB_PUTC (' ');
- }
- OB_PUTC ('*');
- dump_readonly_or_volatile (t, none);
- }
- }
- break;
-
- case REFERENCE_TYPE:
- {
- tree sub = TREE_TYPE (t);
- dump_type_prefix (sub, v);
-
- switch (TREE_CODE (sub))
- {
- case ARRAY_TYPE:
- OB_PUTC2 (' ', '(');
- break;
-
- case POINTER_TYPE:
- /* We don't want "char * &" */
- if (! (TYPE_READONLY (sub) || TYPE_VOLATILE (sub)))
- break;
- /* But we do want "char *const &" */
-
- default:
- OB_PUTC (' ');
- }
- }
- OB_PUTC ('&');
- dump_readonly_or_volatile (t, none);
- break;
-
- case OFFSET_TYPE:
- offset_type:
- dump_type_prefix (TREE_TYPE (t), v);
- if (TREE_CODE (t) == OFFSET_TYPE) /* pmfs deal with this in d_t_p */
- {
- OB_PUTC (' ');
- dump_type (TYPE_OFFSET_BASETYPE (t), 0);
- OB_PUTC2 (':', ':');
- }
- OB_PUTC ('*');
- dump_readonly_or_volatile (t, none);
- break;
-
- /* Can only be reached through function pointer -- this would not be
- correct if FUNCTION_DECLs used it. */
- case FUNCTION_TYPE:
- dump_type_prefix (TREE_TYPE (t), v);
- OB_PUTC2 (' ', '(');
- break;
-
- case METHOD_TYPE:
- dump_type_prefix (TREE_TYPE (t), v);
- OB_PUTC2 (' ', '(');
- dump_aggr_type (TYPE_METHOD_BASETYPE (t), 0);
- OB_PUTC2 (':', ':');
- break;
-
- case ARRAY_TYPE:
- dump_type_prefix (TREE_TYPE (t), v);
- break;
-
- case ENUMERAL_TYPE:
- case ERROR_MARK:
- case IDENTIFIER_NODE:
- case INTEGER_TYPE:
- case BOOLEAN_TYPE:
- case REAL_TYPE:
- case RECORD_TYPE:
- case TEMPLATE_TYPE_PARM:
- case TREE_LIST:
- case TYPE_DECL:
- case TREE_VEC:
- case UNION_TYPE:
- case UNKNOWN_TYPE:
- case VOID_TYPE:
- case TYPENAME_TYPE:
- dump_type (t, v);
- break;
-
- default:
- sorry ("`%s' not supported by dump_type_prefix",
- tree_code_name[(int) TREE_CODE (t)]);
- }
-}
-
-static void
-dump_type_suffix (t, v)
- tree t;
- int v; /* verbose? */
-{
- if (TYPE_PTRMEMFUNC_P (t))
- t = TYPE_PTRMEMFUNC_FN_TYPE (t);
-
- switch (TREE_CODE (t))
- {
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- case OFFSET_TYPE:
- if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
- OB_PUTC (')');
- dump_type_suffix (TREE_TYPE (t), v);
- break;
-
- /* Can only be reached through function pointer */
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- {
- tree arg;
- OB_PUTC2 (')', '(');
- arg = TYPE_ARG_TYPES (t);
- if (TREE_CODE (t) == METHOD_TYPE)
- arg = TREE_CHAIN (arg);
-
- if (arg)
- dump_type (arg, v);
- else
- OB_PUTS ("...");
- OB_PUTC (')');
- if (TREE_CODE (t) == METHOD_TYPE)
- dump_readonly_or_volatile
- (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))), before);
- dump_type_suffix (TREE_TYPE (t), v);
- break;
- }
-
- case ARRAY_TYPE:
- OB_PUTC ('[');
- if (TYPE_DOMAIN (t))
- {
- if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == INTEGER_CST)
- OB_PUTI (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) + 1);
- else if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == MINUS_EXPR)
- dump_expr (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0), 0);
- else
- dump_expr (fold (build_binary_op
- (PLUS_EXPR, TYPE_MAX_VALUE (TYPE_DOMAIN (t)),
- integer_one_node, 1)), 0);
- }
- OB_PUTC (']');
- dump_type_suffix (TREE_TYPE (t), v);
- break;
-
- case ENUMERAL_TYPE:
- case ERROR_MARK:
- case IDENTIFIER_NODE:
- case INTEGER_TYPE:
- case BOOLEAN_TYPE:
- case REAL_TYPE:
- case RECORD_TYPE:
- case TEMPLATE_TYPE_PARM:
- case TREE_LIST:
- case TYPE_DECL:
- case TREE_VEC:
- case UNION_TYPE:
- case UNKNOWN_TYPE:
- case VOID_TYPE:
- case TYPENAME_TYPE:
- break;
-
- default:
- sorry ("`%s' not supported by dump_type_suffix",
- tree_code_name[(int) TREE_CODE (t)]);
- }
-}
-
-/* Return a function declaration which corresponds to the IDENTIFIER_NODE
- argument. */
-
-tree
-ident_fndecl (t)
- tree t;
-{
- tree n = lookup_name (t, 0);
-
- if (n == NULL_TREE)
- return NULL_TREE;
-
- if (TREE_CODE (n) == FUNCTION_DECL)
- return n;
- else if (TREE_CODE (n) == TREE_LIST
- && TREE_CODE (TREE_VALUE (n)) == FUNCTION_DECL)
- return TREE_VALUE (n);
-
- my_friendly_abort (66);
- return NULL_TREE;
-}
-
-#ifndef NO_DOLLAR_IN_LABEL
-# define GLOBAL_THING "_GLOBAL_$"
-#else
-# ifndef NO_DOT_IN_LABEL
-# define GLOBAL_THING "_GLOBAL_."
-# else
-# define GLOBAL_THING "_GLOBAL__"
-# endif
-#endif
-
-#define GLOBAL_IORD_P(NODE) \
- ! strncmp (IDENTIFIER_POINTER(NODE), GLOBAL_THING, sizeof (GLOBAL_THING) - 1)
-
-void
-dump_global_iord (t)
- tree t;
-{
- char *name = IDENTIFIER_POINTER (t);
-
- OB_PUTS ("(static ");
- if (name [sizeof (GLOBAL_THING) - 1] == 'I')
- OB_PUTS ("initializers");
- else if (name [sizeof (GLOBAL_THING) - 1] == 'D')
- OB_PUTS ("destructors");
- else
- my_friendly_abort (352);
-
- OB_PUTS (" for ");
- OB_PUTCP (input_filename);
- OB_PUTC (')');
-}
-
-static void
-dump_decl (t, v)
- tree t;
- int v; /* verbosity */
-{
- if (t == NULL_TREE)
- return;
-
- switch (TREE_CODE (t))
- {
- case ERROR_MARK:
- OB_PUTS (" /* decl error */ ");
- break;
-
- case TYPE_DECL:
- {
- /* Don't say 'typedef class A' */
- if (DECL_ARTIFICIAL (t))
- {
- dump_type (TREE_TYPE (t), v);
- break;
- }
- }
- if (v > 0)
- OB_PUTS ("typedef ");
- goto general;
- break;
-
- case VAR_DECL:
- if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t)))
- {
- OB_PUTS ("vtable for ");
- dump_type (DECL_CONTEXT (t), v);
- break;
- }
- /* else fall through */
- case FIELD_DECL:
- case PARM_DECL:
- general:
- if (v > 0)
- {
- dump_type_prefix (TREE_TYPE (t), v);
- OB_PUTC (' ');
- dump_readonly_or_volatile (t, after);
- }
- /* DECL_CLASS_CONTEXT isn't being set in some cases. Hmm... */
- if (DECL_CONTEXT (t)
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (t))) == 't')
- {
- dump_type (DECL_CONTEXT (t), 0);
- OB_PUTC2 (':', ':');
- }
- if (DECL_NAME (t))
- dump_decl (DECL_NAME (t), v);
- else
- OB_PUTS ("{anon}");
- if (v > 0)
- dump_type_suffix (TREE_TYPE (t), v);
- break;
-
- case NAMESPACE_DECL:
- OB_PUTID (DECL_NAME (t));
- break;
-
- case ARRAY_REF:
- dump_decl (TREE_OPERAND (t, 0), v);
- OB_PUTC ('[');
- dump_decl (TREE_OPERAND (t, 1), v);
- OB_PUTC (']');
- break;
-
- /* So that we can do dump_decl in dump_aggr_type and have it work for
- both class and function scope. */
- case RECORD_TYPE:
- case UNION_TYPE:
- case ENUMERAL_TYPE:
- dump_type (t, v);
- break;
-
- case TYPE_EXPR:
- my_friendly_abort (69);
- break;
-
- /* These special cases are duplicated here so that other functions
- can feed identifiers to cp_error and get them demangled properly. */
- case IDENTIFIER_NODE:
- { tree f;
- if (DESTRUCTOR_NAME_P (t)
- && (f = ident_fndecl (t))
- && DECL_LANGUAGE (f) == lang_cplusplus)
- {
- OB_PUTC ('~');
- dump_decl (DECL_NAME (f), 0);
- }
- else if (IDENTIFIER_TYPENAME_P (t))
- {
- OB_PUTS ("operator ");
- /* Not exactly IDENTIFIER_TYPE_VALUE. */
- dump_type (TREE_TYPE (t), 0);
- break;
- }
- else if (IDENTIFIER_OPNAME_P (t))
- {
- char *name_string = operator_name_string (t);
- OB_PUTS ("operator ");
- OB_PUTCP (name_string);
- }
- else
- OB_PUTID (t);
- }
- break;
-
- case FUNCTION_DECL:
- if (GLOBAL_IORD_P (DECL_ASSEMBLER_NAME (t)))
- dump_global_iord (DECL_ASSEMBLER_NAME (t));
- else
- dump_function_decl (t, v);
- break;
-
- case TEMPLATE_DECL:
- {
- tree args = DECL_TEMPLATE_PARMS (t);
- int i, len = args ? TREE_VEC_LENGTH (args) : 0;
- OB_PUTS ("template <");
- for (i = 0; i < len; i++)
- {
- tree arg = TREE_VEC_ELT (args, i);
- tree defval = TREE_PURPOSE (arg);
- arg = TREE_VALUE (arg);
- if (TREE_CODE (arg) == TYPE_DECL)
- {
- OB_PUTS ("class ");
- OB_PUTID (DECL_NAME (arg));
- }
- else
- dump_decl (arg, 1);
-
- if (defval)
- {
- OB_PUTS (" = ");
- dump_decl (defval, 1);
- }
-
- OB_PUTC2 (',', ' ');
- }
- if (len != 0)
- OB_UNPUT (2);
- OB_PUTC2 ('>', ' ');
-
- if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL)
- dump_type (TREE_TYPE (t), v);
- else if (TREE_TYPE (t) == NULL_TREE)
- my_friendly_abort (353);
- else switch (NEXT_CODE (t))
- {
- case METHOD_TYPE:
- case FUNCTION_TYPE:
- dump_function_decl (t, v);
- break;
-
- default:
- my_friendly_abort (353);
- }
- }
- break;
-
- case LABEL_DECL:
- OB_PUTID (DECL_NAME (t));
- break;
-
- case CONST_DECL:
- if ((TREE_TYPE (t) != NULL_TREE && NEXT_CODE (t) == ENUMERAL_TYPE)
- || TREE_CODE (DECL_INITIAL (t)) == TEMPLATE_CONST_PARM)
- goto general;
- else
- dump_expr (DECL_INITIAL (t), 0);
- break;
-
- case USING_DECL:
- OB_PUTS ("using ");
- dump_type (DECL_INITIAL (t), 0);
- OB_PUTS ("::");
- OB_PUTID (DECL_NAME (t));
- break;
-
- default:
- sorry ("`%s' not supported by dump_decl",
- tree_code_name[(int) TREE_CODE (t)]);
- }
-}
-
-/* Pretty printing for announce_function. T is the declaration of the
- function we are interested in seeing. V is non-zero if we should print
- the type that this function returns. */
-
-static void
-dump_function_decl (t, v)
- tree t;
- int v;
-{
- tree name = DECL_ASSEMBLER_NAME (t);
- tree fntype = TREE_TYPE (t);
- tree parmtypes = TYPE_ARG_TYPES (fntype);
- tree cname = NULL_TREE;
-
- /* Friends have DECL_CLASS_CONTEXT set, but not DECL_CONTEXT. */
- if (DECL_CONTEXT (t))
- cname = DECL_CLASS_CONTEXT (t);
- /* this is for partially instantiated template methods */
- else if (TREE_CODE (fntype) == METHOD_TYPE)
- cname = TREE_TYPE (TREE_VALUE (parmtypes));
-
- v = (v > 0);
-
- if (v)
- {
- if (DECL_STATIC_FUNCTION_P (t))
- OB_PUTS ("static ");
-
- if (! IDENTIFIER_TYPENAME_P (name)
- && ! DECL_CONSTRUCTOR_P (t)
- && ! DESTRUCTOR_NAME_P (name))
- {
- dump_type_prefix (TREE_TYPE (fntype), 1);
- OB_PUTC (' ');
- }
- }
-
- if (cname)
- {
- dump_type (cname, 0);
- OB_PUTC2 (':', ':');
- if (TREE_CODE (fntype) == METHOD_TYPE && parmtypes)
- parmtypes = TREE_CHAIN (parmtypes);
- if (DECL_CONSTRUCTOR_FOR_VBASE_P (t))
- /* Skip past "in_charge" identifier. */
- parmtypes = TREE_CHAIN (parmtypes);
- }
-
- if (DESTRUCTOR_NAME_P (name) && DECL_LANGUAGE (t) == lang_cplusplus)
- parmtypes = TREE_CHAIN (parmtypes);
-
- dump_function_name (t);
-
- OB_PUTC ('(');
-
- if (parmtypes)
- dump_type (parmtypes, v);
- else
- OB_PUTS ("...");
-
- OB_PUTC (')');
-
- if (v && ! IDENTIFIER_TYPENAME_P (name))
- dump_type_suffix (TREE_TYPE (fntype), 1);
-
- if (TREE_CODE (fntype) == METHOD_TYPE)
- {
- if (IS_SIGNATURE (cname))
- /* We look at the type pointed to by the `optr' field of `this.' */
- dump_readonly_or_volatile
- (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_VALUE (TYPE_ARG_TYPES (fntype))))), before);
- else
- dump_readonly_or_volatile
- (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))), before);
- }
-}
-
-/* Handle the function name for a FUNCTION_DECL node, grokking operators
- and destructors properly. */
-
-static void
-dump_function_name (t)
- tree t;
-{
- tree name = DECL_NAME (t);
-
- /* There ought to be a better way to find out whether or not something is
- a destructor. */
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (t))
- && DECL_LANGUAGE (t) == lang_cplusplus)
- {
- OB_PUTC ('~');
- dump_decl (name, 0);
- }
- else if (IDENTIFIER_TYPENAME_P (name))
- {
- /* This cannot use the hack that the operator's return
- type is stashed off of its name because it may be
- used for error reporting. In the case of conflicting
- declarations, both will have the same name, yet
- the types will be different, hence the TREE_TYPE field
- of the first name will be clobbered by the second. */
- OB_PUTS ("operator ");
- dump_type (TREE_TYPE (TREE_TYPE (t)), 0);
- }
- else if (IDENTIFIER_OPNAME_P (name))
- {
- char *name_string = operator_name_string (name);
- OB_PUTS ("operator ");
- OB_PUTCP (name_string);
- }
- else
- dump_decl (name, 0);
-}
-
-static void
-dump_char (c)
- char c;
-{
- switch (c)
- {
- case TARGET_NEWLINE:
- OB_PUTS ("\\n");
- break;
- case TARGET_TAB:
- OB_PUTS ("\\t");
- break;
- case TARGET_VT:
- OB_PUTS ("\\v");
- break;
- case TARGET_BS:
- OB_PUTS ("\\b");
- break;
- case TARGET_CR:
- OB_PUTS ("\\r");
- break;
- case TARGET_FF:
- OB_PUTS ("\\f");
- break;
- case TARGET_BELL:
- OB_PUTS ("\\a");
- break;
- case '\\':
- OB_PUTS ("\\\\");
- break;
- case '\'':
- OB_PUTS ("\\'");
- break;
- case '\"':
- OB_PUTS ("\\\"");
- break;
- default:
- if (isprint (c))
- OB_PUTC (c);
- else
- {
- sprintf (digit_buffer, "\\%03o", (int) c);
- OB_PUTCP (digit_buffer);
- }
- }
-}
-
-/* Print out a list of initializers (subr of dump_expr) */
-
-static void
-dump_expr_list (l)
- tree l;
-{
- while (l)
- {
- dump_expr (TREE_VALUE (l), 0);
- if (TREE_CHAIN (l))
- OB_PUTC2 (',', ' ');
- l = TREE_CHAIN (l);
- }
-}
-
-/* Print out an expression */
-
-static void
-dump_expr (t, nop)
- tree t;
- int nop; /* suppress parens */
-{
- switch (TREE_CODE (t))
- {
- case VAR_DECL:
- case PARM_DECL:
- case FIELD_DECL:
- case CONST_DECL:
- case FUNCTION_DECL:
- case TEMPLATE_DECL:
- dump_decl (t, -1);
- break;
-
- case INTEGER_CST:
- {
- tree type = TREE_TYPE (t);
- my_friendly_assert (type != 0, 81);
-
- /* If it's an enum, output its tag, rather than its value. */
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- {
- char *p = enum_name_string (t, type);
- OB_PUTCP (p);
- }
- else if (type == boolean_type_node)
- {
- if (t == boolean_false_node
- || (TREE_INT_CST_LOW (t) == 0
- && TREE_INT_CST_HIGH (t) == 0))
- OB_PUTS ("false");
- else if (t == boolean_true_node)
- OB_PUTS ("true");
- }
- else if (type == char_type_node)
- {
- OB_PUTC ('\'');
- dump_char (TREE_INT_CST_LOW (t));
- OB_PUTC ('\'');
- }
- else if (TREE_INT_CST_HIGH (t)
- != (TREE_INT_CST_LOW (t) >> (HOST_BITS_PER_WIDE_INT - 1)))
- {
- tree val = t;
- if (TREE_INT_CST_HIGH (val) < 0)
- {
- OB_PUTC ('-');
- val = build_int_2 (~TREE_INT_CST_LOW (val),
- -TREE_INT_CST_HIGH (val));
- }
- /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
- systems? */
- {
- static char format[10]; /* "%x%09999x\0" */
- if (!format[0])
- sprintf (format, "%%x%%0%dx", HOST_BITS_PER_INT / 4);
- sprintf (digit_buffer, format, TREE_INT_CST_HIGH (val),
- TREE_INT_CST_LOW (val));
- OB_PUTCP (digit_buffer);
- }
- }
- else
- OB_PUTI (TREE_INT_CST_LOW (t));
- }
- break;
-
- case REAL_CST:
-#ifndef REAL_IS_NOT_DOUBLE
- sprintf (digit_buffer, "%g", TREE_REAL_CST (t));
-#else
- {
- unsigned char *p = (unsigned char *) &TREE_REAL_CST (t);
- int i;
- strcpy (digit_buffer, "0x");
- for (i = 0; i < sizeof TREE_REAL_CST (t); i++)
- sprintf (digit_buffer + 2 + 2*i, "%02x", *p++);
- }
-#endif
- OB_PUTCP (digit_buffer);
- break;
-
- case STRING_CST:
- {
- char *p = TREE_STRING_POINTER (t);
- int len = TREE_STRING_LENGTH (t) - 1;
- int i;
-
- OB_PUTC ('\"');
- for (i = 0; i < len; i++)
- dump_char (p[i]);
- OB_PUTC ('\"');
- }
- break;
-
- case COMPOUND_EXPR:
- dump_binary_op (",", t);
- break;
-
- case COND_EXPR:
- OB_PUTC ('(');
- dump_expr (TREE_OPERAND (t, 0), 0);
- OB_PUTS (" ? ");
- dump_expr (TREE_OPERAND (t, 1), 0);
- OB_PUTS (" : ");
- dump_expr (TREE_OPERAND (t, 2), 0);
- OB_PUTC (')');
- break;
-
- case SAVE_EXPR:
- if (TREE_HAS_CONSTRUCTOR (t))
- {
- OB_PUTS ("new ");
- dump_type (TREE_TYPE (TREE_TYPE (t)), 0);
- PARM_DECL_EXPR (t) = 1;
- }
- else
- {
- dump_expr (TREE_OPERAND (t, 0), 0);
- }
- break;
-
- case NEW_EXPR:
- OB_PUTID (TYPE_IDENTIFIER (TREE_TYPE (t)));
- OB_PUTC ('(');
- dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)));
- OB_PUTC (')');
- break;
-
- case CALL_EXPR:
- {
- tree fn = TREE_OPERAND (t, 0);
- tree args = TREE_OPERAND (t, 1);
-
- if (TREE_CODE (fn) == ADDR_EXPR)
- fn = TREE_OPERAND (fn, 0);
-
- if (TREE_TYPE (fn) != NULL_TREE && NEXT_CODE (fn) == METHOD_TYPE)
- {
- tree ob = TREE_VALUE (args);
- if (TREE_CODE (ob) == ADDR_EXPR)
- {
- dump_expr (TREE_OPERAND (ob, 0), 0);
- OB_PUTC ('.');
- }
- else if (TREE_CODE (ob) != PARM_DECL
- || strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
- {
- dump_expr (ob, 0);
- OB_PUTC2 ('-', '>');
- }
- args = TREE_CHAIN (args);
- }
- dump_expr (fn, 0);
- OB_PUTC ('(');
- dump_expr_list (args);
- OB_PUTC (')');
- }
- break;
-
- case TARGET_EXPR:
- /* Note that this only works for G++ target exprs. If somebody
- builds a general TARGET_EXPR, there's no way to represent that
- it initializes anything other that the parameter slot for the
- default argument. Note we may have cleared out the first
- operand in expand_expr, so don't go killing ourselves. */
- if (TREE_OPERAND (t, 1))
- dump_expr (TREE_OPERAND (t, 1), 0);
- break;
-
- case MODIFY_EXPR:
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case TRUNC_MOD_EXPR:
- case MIN_EXPR:
- case MAX_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- dump_binary_op (opname_tab[(int) TREE_CODE (t)], t);
- break;
-
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- dump_binary_op ("/", t);
- break;
-
- case CEIL_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case ROUND_MOD_EXPR:
- dump_binary_op ("%", t);
- break;
-
- case COMPONENT_REF:
- {
- tree ob = TREE_OPERAND (t, 0);
- if (TREE_CODE (ob) == INDIRECT_REF)
- {
- ob = TREE_OPERAND (ob, 0);
- if (TREE_CODE (ob) != PARM_DECL
- || strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
- {
- dump_expr (ob, 0);
- OB_PUTC2 ('-', '>');
- }
- }
- else
- {
- dump_expr (ob, 0);
- OB_PUTC ('.');
- }
- dump_expr (TREE_OPERAND (t, 1), 1);
- }
- break;
-
- case ARRAY_REF:
- dump_expr (TREE_OPERAND (t, 0), 0);
- OB_PUTC ('[');
- dump_expr (TREE_OPERAND (t, 1), 0);
- OB_PUTC (']');
- break;
-
- case CONVERT_EXPR:
- dump_unary_op ("+", t, nop);
- break;
-
- case ADDR_EXPR:
- if (TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL
- || TREE_CODE (TREE_OPERAND (t, 0)) == STRING_CST)
- dump_expr (TREE_OPERAND (t, 0), 0);
- else
- dump_unary_op ("&", t, nop);
- break;
-
- case INDIRECT_REF:
- if (TREE_HAS_CONSTRUCTOR (t))
- {
- t = TREE_OPERAND (t, 0);
- my_friendly_assert (TREE_CODE (t) == CALL_EXPR, 237);
- dump_expr (TREE_OPERAND (t, 0), 0);
- OB_PUTC ('(');
- dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)));
- OB_PUTC (')');
- }
- else
- {
- if (TREE_OPERAND (t,0) != NULL_TREE
- && NEXT_CODE (TREE_OPERAND (t, 0)) == REFERENCE_TYPE)
- dump_expr (TREE_OPERAND (t, 0), nop);
- else
- dump_unary_op ("*", t, nop);
- }
- break;
-
- case NEGATE_EXPR:
- case BIT_NOT_EXPR:
- case TRUTH_NOT_EXPR:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- dump_unary_op (opname_tab [(int)TREE_CODE (t)], t, nop);
- break;
-
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- OB_PUTC ('(');
- dump_expr (TREE_OPERAND (t, 0), 0);
- OB_PUTCP (opname_tab[(int)TREE_CODE (t)]);
- OB_PUTC (')');
- break;
-
- case NON_LVALUE_EXPR:
- /* FIXME: This is a KLUDGE workaround for a parsing problem. There
- should be another level of INDIRECT_REF so that I don't have to do
- this. */
- if (TREE_TYPE (t) != NULL_TREE && NEXT_CODE (t) == POINTER_TYPE)
- {
- tree next = TREE_TYPE (TREE_TYPE (t));
-
- while (TREE_CODE (next) == POINTER_TYPE)
- next = TREE_TYPE (next);
-
- if (TREE_CODE (next) == FUNCTION_TYPE)
- {
- if (!nop) OB_PUTC ('(');
- OB_PUTC ('*');
- dump_expr (TREE_OPERAND (t, 0), 1);
- if (!nop) OB_PUTC (')');
- break;
- }
- /* else FALLTHRU */
- }
- dump_expr (TREE_OPERAND (t, 0), 0);
- break;
-
- case NOP_EXPR:
- dump_expr (TREE_OPERAND (t, 0), nop);
- break;
-
- case CONSTRUCTOR:
- if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
- {
- tree idx = build_component_ref (t, index_identifier, NULL_TREE, 0);
-
- if (integer_all_onesp (idx))
- {
- tree pfn = PFN_FROM_PTRMEMFUNC (t);
- dump_expr (pfn);
- break;
- }
- if (TREE_CODE (idx) == INTEGER_CST
- && TREE_INT_CST_HIGH (idx) == 0)
- {
- tree virtuals;
- unsigned HOST_WIDE_INT n;
-
- t = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t)));
- t = TYPE_METHOD_BASETYPE (t);
- virtuals = BINFO_VIRTUALS (TYPE_BINFO (TYPE_MAIN_VARIANT (t)));
-
- n = TREE_INT_CST_LOW (idx);
-
- /* Map vtable index back one, to allow for the null pointer to
- member. */
- --n;
-
- while (n > 0 && virtuals)
- {
- --n;
- virtuals = TREE_CHAIN (virtuals);
- }
- if (virtuals)
- {
- dump_expr (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)));
- break;
- }
- }
- }
- OB_PUTC ('{');
- dump_expr_list (CONSTRUCTOR_ELTS (t));
- OB_PUTC ('}');
- break;
-
- case OFFSET_REF:
- {
- tree ob = TREE_OPERAND (t, 0);
- if (TREE_CODE (ob) == NOP_EXPR
- && TREE_OPERAND (ob, 0) == error_mark_node
- && TREE_CODE (TREE_OPERAND (t, 1)) == FUNCTION_DECL)
- /* A::f */
- dump_expr (TREE_OPERAND (t, 1), 0);
- else
- {
- dump_expr (TREE_OPERAND (t, 0), 0);
- OB_PUTS (" .* ");
- dump_expr (TREE_OPERAND (t, 1), 0);
- }
- break;
- }
-
- case TEMPLATE_CONST_PARM:
- if (current_template_parms)
- {
- tree r = TREE_VEC_ELT (TREE_VALUE (current_template_parms),
- TEMPLATE_CONST_IDX (t));
- dump_decl (TREE_VALUE (r), -1);
- }
- else
- {
- OB_PUTS ("<tparm ");
- OB_PUTI (TEMPLATE_CONST_IDX (t));
- OB_PUTS (">");
- }
- break;
-
- case IDENTIFIER_NODE:
- OB_PUTID (t);
- break;
-
- case SCOPE_REF:
- dump_type (TREE_OPERAND (t, 0), 0);
- OB_PUTS ("::");
- dump_expr (TREE_OPERAND (t, 1), 0);
- break;
-
- case CAST_EXPR:
- if (TREE_OPERAND (t, 0) == NULL_TREE
- || TREE_CHAIN (TREE_OPERAND (t, 0)))
- {
- dump_type (TREE_TYPE (t), 0);
- OB_PUTC ('(');
- dump_expr_list (TREE_OPERAND (t, 0));
- OB_PUTC (')');
- }
- else
- {
- OB_PUTC ('(');
- dump_type (TREE_TYPE (t), 0);
- OB_PUTC (')');
- OB_PUTC ('(');
- dump_expr_list (TREE_OPERAND (t, 0));
- OB_PUTC (')');
- }
- break;
-
- case LOOKUP_EXPR:
- OB_PUTID (TREE_OPERAND (t, 0));
- break;
-
- case SIZEOF_EXPR:
- OB_PUTS ("sizeof (");
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 0))) == 't')
- dump_type (TREE_OPERAND (t, 0), 0);
- else
- dump_unary_op ("*", t, 0);
- OB_PUTC (')');
- break;
-
- case TREE_LIST:
- if (TREE_VALUE (t) && TREE_CODE (TREE_VALUE (t)) == FUNCTION_DECL)
- {
- OB_PUTID (DECL_NAME (TREE_VALUE (t)));
- break;
- }
- /* else fall through */
-
- /* This list is incomplete, but should suffice for now.
- It is very important that `sorry' does not call
- `report_error_function'. That could cause an infinite loop. */
- default:
- sorry ("`%s' not supported by dump_expr",
- tree_code_name[(int) TREE_CODE (t)]);
-
- /* fall through to ERROR_MARK... */
- case ERROR_MARK:
- error:
- OB_PUTCP ("{error}");
- break;
- }
-}
-
-static void
-dump_binary_op (opstring, t)
- char *opstring;
- tree t;
-{
- OB_PUTC ('(');
- dump_expr (TREE_OPERAND (t, 0), 1);
- OB_PUTC (' ');
- OB_PUTCP (opstring);
- OB_PUTC (' ');
- dump_expr (TREE_OPERAND (t, 1), 1);
- OB_PUTC (')');
-}
-
-static void
-dump_unary_op (opstring, t, nop)
- char *opstring;
- tree t;
- int nop;
-{
- if (!nop) OB_PUTC ('(');
- OB_PUTCP (opstring);
- dump_expr (TREE_OPERAND (t, 0), 1);
- if (!nop) OB_PUTC (')');
-}
-
-char *
-fndecl_as_string (fndecl, print_ret_type_p)
- tree fndecl;
- int print_ret_type_p;
-{
- return decl_as_string (fndecl, print_ret_type_p);
-}
-
-/* Same, but handtype a _TYPE.
- Called from convert_to_reference, mangle_class_name_for_template,
- build_unary_op, and GNU_xref_decl. */
-
-char *
-type_as_string (typ, v)
- tree typ;
- int v;
-{
- OB_INIT ();
-
- dump_type (typ, v);
-
- OB_FINISH ();
-
- return (char *)obstack_base (&scratch_obstack);
-}
-
-char *
-expr_as_string (decl, v)
- tree decl;
- int v;
-{
- OB_INIT ();
-
- dump_expr (decl, 1);
-
- OB_FINISH ();
-
- return (char *)obstack_base (&scratch_obstack);
-}
-
-/* A cross between type_as_string and fndecl_as_string.
- Only called from substitute_nice_name. */
-
-char *
-decl_as_string (decl, v)
- tree decl;
- int v;
-{
- OB_INIT ();
-
- dump_decl (decl, v);
-
- OB_FINISH ();
-
- return (char *)obstack_base (&scratch_obstack);
-}
-
-/* Generate the three forms of printable names for lang_printable_name. */
-
-char *
-lang_decl_name (decl, v)
- tree decl;
- int v;
-{
- if (v >= 2)
- return decl_as_string (decl, 1);
-
- OB_INIT ();
-
- if (v == 1 && DECL_CONTEXT (decl)
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
- {
- tree cname;
- if (TREE_CODE (decl) == FUNCTION_DECL)
- cname = DECL_CLASS_CONTEXT (decl);
- else
- cname = DECL_CONTEXT (decl);
- dump_type (cname, 0);
- OB_PUTC2 (':', ':');
- }
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- dump_function_name (decl);
- else
- dump_decl (DECL_NAME (decl), 0);
-
- OB_FINISH ();
-
- return (char *)obstack_base (&scratch_obstack);
-}
-
-
-char *
-cp_file_of (t)
- tree t;
-{
- if (TREE_CODE (t) == PARM_DECL)
- return DECL_SOURCE_FILE (DECL_CONTEXT (t));
- else if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
- return DECL_SOURCE_FILE (TYPE_MAIN_DECL (t));
- else
- return DECL_SOURCE_FILE (t);
-}
-
-int
-cp_line_of (t)
- tree t;
-{
- int line = 0;
- if (TREE_CODE (t) == PARM_DECL)
- line = DECL_SOURCE_LINE (DECL_CONTEXT (t));
- if (TREE_CODE (t) == TYPE_DECL && DECL_ARTIFICIAL (t))
- t = TREE_TYPE (t);
-
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
- line = DECL_SOURCE_LINE (TYPE_MAIN_DECL (t));
- else
- line = DECL_SOURCE_LINE (t);
-
- if (line == 0)
- return lineno;
-
- return line;
-}
-
-char *
-code_as_string (c, v)
- enum tree_code c;
- int v;
-{
- return tree_code_name [c];
-}
-
-char *
-language_as_string (c, v)
- enum languages c;
- int v;
-{
- switch (c)
- {
- case lang_c:
- return "C";
-
- case lang_cplusplus:
- return "C++";
-
- default:
- my_friendly_abort (355);
- return 0;
- }
-}
-
-/* Return the proper printed version of a parameter to a C++ function. */
-
-char *
-parm_as_string (p, v)
- int p, v;
-{
- if (p < 0)
- return "`this'";
-
- sprintf (digit_buffer, "%d", p+1);
- return digit_buffer;
-}
-
-char *
-op_as_string (p, v)
- enum tree_code p;
- int v;
-{
- static char buf[] = "operator ";
-
- if (p == 0)
- return "{unknown}";
-
- strcpy (buf + 9, opname_tab [p]);
- return buf;
-}
-
-char *
-assop_as_string (p, v)
- enum tree_code p;
- int v;
-{
- static char buf[] = "operator ";
-
- if (p == 0)
- return "{unknown}";
-
- strcpy (buf + 9, assignop_tab [p]);
- return buf;
-}
-
-char *
-args_as_string (p, v)
- tree p;
- int v;
-{
- if (p == NULL_TREE)
- return "";
-
- if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (p))) == 't')
- return type_as_string (p, v);
-
- OB_INIT ();
- for (; p; p = TREE_CHAIN (p))
- {
- dump_type (error_type (TREE_VALUE (p)), v);
- if (TREE_CHAIN (p))
- OB_PUTS (", ");
- }
- OB_FINISH ();
- return (char *)obstack_base (&scratch_obstack);
-}
-
-char *
-cv_as_string (p, v)
- tree p;
- int v;
-{
- OB_INIT ();
-
- dump_readonly_or_volatile (p, before);
-
- OB_FINISH ();
-
- return (char *)obstack_base (&scratch_obstack);
-}
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
deleted file mode 100644
index 37f6dfea6c7..00000000000
--- a/gcc/cp/except.c
+++ /dev/null
@@ -1,1152 +0,0 @@
-/* Handle exceptional things in C++.
- Copyright (C) 1989, 92-95, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann <tiemann@cygnus.com>
- Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
- initial re-implementation courtesy Tad Hunt.
-
-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 "tree.h"
-#include "rtl.h"
-#include "cp-tree.h"
-#include "flags.h"
-#include "obstack.h"
-#include "expr.h"
-#include "output.h"
-#include "except.h"
-#include "function.h"
-
-rtx expand_builtin_return_addr PROTO((enum built_in_function, int, rtx));
-
-/* holds the fndecl for __builtin_return_address () */
-tree builtin_return_address_fndecl;
-
-/* A couple of backend routines from m88k.c */
-
-/* used to cache a call to __builtin_return_address () */
-static tree BuiltinReturnAddress;
-
-
-#include <stdio.h>
-
-static void
-easy_expand_asm (str)
- char *str;
-{
- expand_asm (build_string (strlen (str)+1, str));
-}
-
-
-#if 0
-/* This is the startup, and finish stuff per exception table. */
-
-/* XXX - Tad: exception handling section */
-#ifndef EXCEPT_SECTION_ASM_OP
-#define EXCEPT_SECTION_ASM_OP "section\t.gcc_except_table,\"a\",@progbits"
-#endif
-
-#ifdef EXCEPT_SECTION_ASM_OP
-typedef struct {
- void *start_region;
- void *end_region;
- void *exception_handler;
- } exception_table;
-#endif /* EXCEPT_SECTION_ASM_OP */
-
-#ifdef EXCEPT_SECTION_ASM_OP
-
- /* on machines which support it, the exception table lives in another section,
- but it needs a label so we can reference it... This sets up that
- label! */
-asm (EXCEPT_SECTION_ASM_OP);
-exception_table __EXCEPTION_TABLE__[1] = { (void*)0, (void*)0, (void*)0 };
-asm (TEXT_SECTION_ASM_OP);
-
-#endif /* EXCEPT_SECTION_ASM_OP */
-
-#ifdef EXCEPT_SECTION_ASM_OP
-
- /* we need to know where the end of the exception table is... so this
- is how we do it! */
-
-asm (EXCEPT_SECTION_ASM_OP);
-exception_table __EXCEPTION_END__[1] = { (void*)-1, (void*)-1, (void*)-1 };
-asm (TEXT_SECTION_ASM_OP);
-
-#endif /* EXCEPT_SECTION_ASM_OP */
-
-#endif
-
-#include "decl.h"
-#include "insn-flags.h"
-#include "obstack.h"
-
-/* ======================================================================
- Briefly the algorithm works like this:
-
- When a constructor or start of a try block is encountered,
- push_eh_entry (&eh_stack) is called. Push_eh_entry () creates a
- new entry in the unwind protection stack and returns a label to
- output to start the protection for that block.
-
- When a destructor or end try block is encountered, pop_eh_entry
- (&eh_stack) is called. Pop_eh_entry () returns the eh_entry it
- created when push_eh_entry () was called. The eh_entry structure
- contains three things at this point. The start protect label,
- the end protect label, and the exception handler label. The end
- protect label should be output before the call to the destructor
- (if any). If it was a destructor, then its parse tree is stored
- in the finalization variable in the eh_entry structure. Otherwise
- the finalization variable is set to NULL to reflect the fact that
- is the the end of a try block. Next, this modified eh_entry node
- is enqueued in the finalizations queue by calling
- enqueue_eh_entry (&queue,entry).
-
- +---------------------------------------------------------------+
- |XXX: Will need modification to deal with partially |
- | constructed arrays of objects |
- | |
- | Basically, this consists of keeping track of how many |
- | of the objects have been constructed already (this |
- | should be in a register though, so that shouldn't be a |
- | problem. |
- +---------------------------------------------------------------+
-
- When a catch block is encountered, there is a lot of work to be
- done.
-
- Since we don't want to generate the catch block inline with the
- regular flow of the function, we need to have some way of doing
- so. Luckily, we can use sequences to defer the catch sections.
- When the start of a catch block is encountered, we start the
- sequence. After the catch block is generated, we end the
- sequence.
-
- Next we must insure that when the catch block is executed, all
- finalizations for the matching try block have been completed. If
- any of those finalizations throw an exception, we must call
- terminate according to the ARM (section r.15.6.1). What this
- means is that we need to dequeue and emit finalizations for each
- entry in the eh_queue until we get to an entry with a NULL
- finalization field. For any of the finalization entries, if it
- is not a call to terminate (), we must protect it by giving it
- another start label, end label, and exception handler label,
- setting its finalization tree to be a call to terminate (), and
- enqueue'ing this new eh_entry to be output at an outer level.
- Finally, after all that is done, we can get around to outputting
- the catch block which basically wraps all the "catch (...) {...}"
- statements in a big if/then/else construct that matches the
- correct block to call.
-
- ===================================================================== */
-
-extern rtx emit_insn PROTO((rtx));
-extern rtx gen_nop PROTO(());
-
-/* local globals for function calls
- ====================================================================== */
-
-/* used to cache "terminate ()", "unexpected ()", "set_terminate ()", and
- "set_unexpected ()" after default_conversion. (lib-except.c) */
-static tree Terminate, Unexpected, SetTerminate, SetUnexpected, CatchMatch;
-
-/* used to cache __find_first_exception_table_match ()
- for throw (lib-except.c) */
-static tree FirstExceptionMatch;
-
-/* used to cache a call to __unwind_function () (lib-except.c) */
-static tree Unwind;
-
-/* holds a ready to emit call to "terminate ()". */
-static tree TerminateFunctionCall;
-
-static tree empty_fndecl;
-
-/* ====================================================================== */
-
-
-/* ========================================================================= */
-
-
-
-/* local globals - these local globals are for storing data necessary for
- generating the exception table and code in the correct order.
-
- ========================================================================= */
-
-/* Holds the pc for doing "throw" */
-static tree saved_pc;
-/* Holds the type of the thing being thrown. */
-static tree saved_throw_type;
-/* Holds the value being thrown. */
-static tree saved_throw_value;
-/* Holds the cleanup for the value being thrown. */
-static tree saved_cleanup;
-/* Indicates if we are in a catch clause. */
-static tree saved_in_catch;
-
-extern int throw_used;
-extern rtx catch_clauses;
-
-/* ========================================================================= */
-
-/* Cheesyness to save some typing. Returns the return value rtx. */
-
-static rtx
-do_function_call (func, params, return_type)
- tree func, params, return_type;
-{
- tree func_call;
- func_call = build_function_call (func, params);
- expand_call (func_call, NULL_RTX, 0);
- if (return_type != NULL_TREE)
- return hard_function_value (return_type, func_call);
- return NULL_RTX;
-}
-
-/* ========================================================================= */
-
-/* sets up all the global eh stuff that needs to be initialized at the
- start of compilation.
-
- This includes:
- - Setting up all the function call trees. */
-
-void
-init_exception_processing ()
-{
- extern tree define_function ();
- tree unexpected_fndecl, terminate_fndecl;
- tree set_unexpected_fndecl, set_terminate_fndecl;
- tree catch_match_fndecl;
- tree find_first_exception_match_fndecl;
- tree unwind_fndecl;
- tree declspecs;
- tree d;
-
- /* void (*)() */
- tree PFV = build_pointer_type (build_function_type
- (void_type_node, void_list_node));
-
- /* arg list for the build_function_type call for set_terminate () and
- set_unexpected () */
- tree pfvlist = tree_cons (NULL_TREE, PFV, void_list_node);
-
- /* void (*pfvtype (void (*) ()))() */
- tree pfvtype = build_function_type (PFV, pfvlist);
-
- /* void vtype () */
- tree vtype = build_function_type (void_type_node, void_list_node);
-
- set_terminate_fndecl = auto_function (get_identifier ("set_terminate"),
- pfvtype, NOT_BUILT_IN);
- set_unexpected_fndecl = auto_function (get_identifier ("set_unexpected"),
- pfvtype, NOT_BUILT_IN);
- unexpected_fndecl = auto_function (get_identifier ("unexpected"),
- vtype, NOT_BUILT_IN);
- terminate_fndecl = auto_function (get_identifier ("terminate"),
- vtype, NOT_BUILT_IN);
-
- push_lang_context (lang_name_c);
-
- catch_match_fndecl =
- builtin_function (flag_rtti
- ? "__throw_type_match_rtti"
- : "__throw_type_match",
- build_function_type (ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- void_list_node)))),
- NOT_BUILT_IN, NULL_PTR);
- find_first_exception_match_fndecl =
- builtin_function ("__find_first_exception_table_match",
- build_function_type (ptr_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- void_list_node)),
- NOT_BUILT_IN, NULL_PTR);
- unwind_fndecl =
- builtin_function ("__unwind_function",
- build_function_type (void_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- void_list_node)),
- NOT_BUILT_IN, NULL_PTR);
- empty_fndecl =
- builtin_function ("__empty",
- build_function_type (void_type_node, void_list_node),
- NOT_BUILT_IN, NULL_PTR);
- DECL_EXTERNAL (empty_fndecl) = 1;
- TREE_PUBLIC (empty_fndecl) = 1;
-
- Unexpected = default_conversion (unexpected_fndecl);
- Terminate = default_conversion (terminate_fndecl);
- SetTerminate = default_conversion (set_terminate_fndecl);
- SetUnexpected = default_conversion (set_unexpected_fndecl);
- CatchMatch = default_conversion (catch_match_fndecl);
- FirstExceptionMatch = default_conversion (find_first_exception_match_fndecl);
- Unwind = default_conversion (unwind_fndecl);
- BuiltinReturnAddress = default_conversion (builtin_return_address_fndecl);
-
- TerminateFunctionCall = build_function_call (Terminate, NULL_TREE);
-
- pop_lang_context ();
-
- declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
- d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_pc"));
- d = start_decl (d, declspecs, 0);
- DECL_COMMON (d) = 1;
- cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
- saved_pc = lookup_name (get_identifier ("__eh_pc"), 0);
-
- declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
- d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_type"));
- d = start_decl (d, declspecs, 0);
- DECL_COMMON (d) = 1;
- cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
- saved_throw_type = lookup_name (get_identifier ("__eh_type"), 0);
-
- declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
- d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_value"));
- d = start_decl (d, declspecs, 0);
- DECL_COMMON (d) = 1;
- cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
- saved_throw_value = lookup_name (get_identifier ("__eh_value"), 0);
-
- declspecs = tree_cons (NULL_TREE, get_identifier ("void"), NULL_TREE);
- d = build_parse_node (INDIRECT_REF, get_identifier ("__eh_cleanup"));
- d = make_call_declarator (d, void_list_node, NULL_TREE, NULL_TREE);
- d = start_decl (d, declspecs, 0);
- DECL_COMMON (d) = 1;
- cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
- saved_cleanup = lookup_name (get_identifier ("__eh_cleanup"), 0);
-
- declspecs = tree_cons (NULL_TREE, get_identifier ("bool"), NULL_TREE);
- d = get_identifier ("__eh_in_catch");
- d = start_decl (d, declspecs, 0);
- DECL_COMMON (d) = 1;
- cp_finish_decl (d, NULL_TREE, NULL_TREE, 1, 0);
- saved_in_catch = lookup_name (get_identifier ("__eh_in_catch"), 0);
-}
-
-/* Build a type value for use at runtime for a type that is matched
- against by the exception handling system. */
-
-static tree
-build_eh_type_type (type)
- tree type;
-{
- char *typestring;
- tree exp;
-
- if (type == error_mark_node)
- return error_mark_node;
-
- /* peel back references, so they match. */
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- /* Peel off cv qualifiers. */
- type = TYPE_MAIN_VARIANT (type);
-
- if (flag_rtti)
- {
- return build1 (ADDR_EXPR, ptr_type_node, get_typeid (type));
- }
-
- typestring = build_overload_name (type, 1, 1);
- exp = combine_strings (build_string (strlen (typestring)+1, typestring));
- return build1 (ADDR_EXPR, ptr_type_node, exp);
-}
-
-/* Build a type value for use at runtime for a exp that is thrown or
- matched against by the exception handling system. */
-
-static tree
-build_eh_type (exp)
- tree exp;
-{
- if (flag_rtti)
- {
- exp = build_typeid (exp);
- return build1 (ADDR_EXPR, ptr_type_node, exp);
- }
- return build_eh_type_type (TREE_TYPE (exp));
-}
-
-/* This routine creates the cleanup for the exception handling object. */
-
-static void
-push_eh_cleanup ()
-{
- /* All cleanups must last longer than normal. */
- int yes = suspend_momentary ();
-
- /* Arrange to do a dynamically scoped cleanup upon exit from this region. */
- tree cleanup = build_function_call (saved_cleanup, NULL_TREE);
- cleanup = build (COMPOUND_EXPR, void_type_node, cleanup,
- build_modify_expr (saved_in_catch, NOP_EXPR,
- build_modify_expr (saved_throw_type, NOP_EXPR, integer_zero_node)));
- expand_decl_cleanup (NULL_TREE, cleanup);
-
- resume_momentary (yes);
-}
-
-
-/* call this to start a catch block. Typename is the typename, and identifier
- is the variable to place the object in or NULL if the variable doesn't
- matter. If typename is NULL, that means its a "catch (...)" or catch
- everything. In that case we don't need to do any type checking.
- (ie: it ends up as the "else" clause rather than an "else if" clause) */
-
-void
-expand_start_catch_block (declspecs, declarator)
- tree declspecs, declarator;
-{
- rtx false_label_rtx;
- tree decl = NULL_TREE;
- tree init;
-
- if (processing_template_decl)
- {
- if (declspecs)
- {
- decl = grokdeclarator (declarator, declspecs, CATCHPARM,
- 1, NULL_TREE);
- pushdecl (decl);
- decl = build_min_nt (DECL_STMT, copy_to_permanent (declarator),
- copy_to_permanent (declspecs),
- NULL_TREE);
- add_tree (decl);
- }
- return;
- }
-
- if (! doing_eh (1))
- return;
-
- /* Create a binding level for the parm. */
- pushlevel (0);
- expand_start_bindings (0);
-
- false_label_rtx = gen_label_rtx ();
- push_label_entry (&false_label_stack, false_label_rtx, NULL_TREE);
-
- if (declspecs)
- {
- tree exp;
- rtx call_rtx, return_value_rtx;
- tree init_type;
-
- decl = grokdeclarator (declarator, declspecs, CATCHPARM, 1, NULL_TREE);
-
- if (decl == NULL_TREE)
- {
- error ("invalid catch parameter");
-
- /* This is cheap, but we want to maintain the data structures. */
- expand_eh_region_start ();
- return;
- }
-
- /* Make sure we mark the catch param as used, otherwise we'll get
- a warning about an unused ((anonymous)). */
- TREE_USED (decl) = 1;
-
- /* Figure out the type that the initializer is. */
- init_type = TREE_TYPE (decl);
- if (TREE_CODE (init_type) != REFERENCE_TYPE
- && TREE_CODE (init_type) != POINTER_TYPE)
- init_type = build_reference_type (init_type);
-
- exp = saved_throw_value;
- exp = tree_cons (NULL_TREE,
- build_eh_type_type (TREE_TYPE (decl)),
- tree_cons (NULL_TREE,
- saved_throw_type,
- tree_cons (NULL_TREE, exp, NULL_TREE)));
- exp = build_function_call (CatchMatch, exp);
- call_rtx = expand_call (exp, NULL_RTX, 0);
- assemble_external (TREE_OPERAND (CatchMatch, 0));
-
- return_value_rtx = hard_function_value (ptr_type_node, exp);
-
- /* did the throw type match function return TRUE? */
- emit_cmp_insn (return_value_rtx, const0_rtx, EQ, NULL_RTX,
- GET_MODE (return_value_rtx), 0, 0);
-
- /* if it returned FALSE, jump over the catch block, else fall into it */
- emit_jump_insn (gen_beq (false_label_rtx));
-
- push_eh_cleanup ();
-
- init = convert_from_reference (save_expr (make_tree (init_type, call_rtx)));
-
- /* Do we need the below two lines? */
- /* Let `cp_finish_decl' know that this initializer is ok. */
- DECL_INITIAL (decl) = init;
- decl = pushdecl (decl);
- cp_finish_decl (decl, init, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
- }
- else
- {
- push_eh_cleanup ();
-
- /* Fall into the catch all section. */
- }
-
- emit_move_insn (DECL_RTL (saved_in_catch), const1_rtx);
-
- /* Because we are reordered out of line, we arrange
- to rethrow in the outer context, should we encounter
- an exception in the catch handler.
-
- Matches the end in expand_end_catch_block (). */
- expand_eh_region_start ();
-
- emit_line_note (input_filename, lineno);
-}
-
-
-
-/* Call this to end a catch block. Its responsible for emitting the
- code to handle jumping back to the correct place, and for emitting
- the label to jump to if this catch block didn't match. */
-
-void
-expand_end_catch_block ()
-{
- rtx start_region_label_rtx;
- rtx end_region_label_rtx;
- tree decls, t;
-
- if (! doing_eh (1))
- return;
-
- /* Fall to outside the try statement when done executing handler and
- we fall off end of handler. This is jump Lresume in the
- documentation. */
- expand_goto (top_label_entry (&caught_return_label_stack));
-
- t = make_node (RTL_EXPR);
- TREE_TYPE (t) = void_type_node;
- RTL_EXPR_RTL (t) = const0_rtx;
- TREE_SIDE_EFFECTS (t) = 1;
- start_sequence_for_rtl_expr (t);
- expand_internal_throw (DECL_RTL (top_label_entry (&caught_return_label_stack)));
- RTL_EXPR_SEQUENCE (t) = get_insns ();
- end_sequence ();
-
- /* Matches the start in expand_start_catch_block (). */
- expand_eh_region_end (t);
-
- expand_leftover_cleanups ();
-
- /* Cleanup the EH parameter. */
- expand_end_bindings (getdecls (), kept_level_p (), 0);
- poplevel (kept_level_p (), 1, 0);
-
- /* label we emit to jump to if this catch block didn't match. */
- /* This the closing } in the `if (eq) {' of the documentation. */
- emit_label (pop_label_entry (&false_label_stack));
-}
-
-/* unwind the stack. */
-
-static void
-do_unwind (inner_throw_label)
- rtx inner_throw_label;
-{
-#if defined (SPARC_STACK_ALIGN) /* was sparc */
- /* This doesn't work for the flat model sparc, I bet. */
- tree fcall;
- tree params;
- rtx return_val_rtx;
- rtx temp;
-
- /* call to __builtin_return_address () */
- params = tree_cons (NULL_TREE, integer_zero_node, NULL_TREE);
- fcall = build_function_call (BuiltinReturnAddress, params);
- return_val_rtx = expand_expr (fcall, NULL_RTX, Pmode, 0);
- /* In the return, the new pc is pc+8, as the value coming in is
- really the address of the call insn, not the next insn. */
- temp = gen_reg_rtx (Pmode);
- emit_move_insn (temp, inner_throw_label);
- emit_move_insn (return_val_rtx, plus_constant (temp, -8));
- emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, SImode, 31)));
- easy_expand_asm ("ret");
- easy_expand_asm ("restore");
- emit_barrier ();
-#endif
-#if defined (ARM_FRAME_RTX) /* was __arm */
- if (flag_omit_frame_pointer)
- sorry ("this implementation of exception handling requires a frame pointer");
-
- emit_move_insn (stack_pointer_rtx,
- gen_rtx (MEM, Pmode, plus_constant (hard_frame_pointer_rtx, -8)));
- emit_move_insn (hard_frame_pointer_rtx,
- gen_rtx (MEM, Pmode, plus_constant (hard_frame_pointer_rtx, -12)));
-#endif
-#if defined (TARGET_88000) /* was m88k */
- rtx temp_frame = frame_pointer_rtx;
-
- temp_frame = memory_address (Pmode, temp_frame);
- temp_frame = copy_to_reg (gen_rtx (MEM, Pmode, temp_frame));
-
- /* hopefully this will successfully pop the frame! */
- emit_move_insn (frame_pointer_rtx, temp_frame);
- emit_move_insn (stack_pointer_rtx, frame_pointer_rtx);
- emit_move_insn (arg_pointer_rtx, frame_pointer_rtx);
- emit_insn (gen_add2_insn (stack_pointer_rtx, gen_rtx (CONST_INT, VOIDmode,
- (HOST_WIDE_INT)m88k_debugger_offset (stack_pointer_rtx, 0))));
-
-#if 0
- emit_insn (gen_add2_insn (arg_pointer_rtx, gen_rtx (CONST_INT, VOIDmode,
- -(HOST_WIDE_INT)m88k_debugger_offset (arg_pointer_rtx, 0))));
-
- emit_move_insn (stack_pointer_rtx, arg_pointer_rtx);
-
- emit_insn (gen_add2_insn (stack_pointer_rtx, gen_rtx (CONST_INT, VOIDmode,
- (HOST_WIDE_INT)m88k_debugger_offset (arg_pointer_rtx, 0))));
-#endif
-#endif
-#if ! defined (TARGET_88000) && ! defined (ARM_FRAME_RTX) && ! defined (SPARC_STACK_ALIGN)
- tree fcall;
- tree params;
- rtx return_val_rtx;
-
-#if 0
- /* I would like to do this here, but the move below doesn't seem to work. */
- /* call to __builtin_return_address () */
- params = tree_cons (NULL_TREE, integer_zero_node, NULL_TREE);
- fcall = build_function_call (BuiltinReturnAddress, params);
- return_val_rtx = expand_expr (fcall, NULL_RTX, Pmode, 0);
-
- emit_move_insn (return_val_rtx, inner_throw_label);
- /* So, for now, just pass throw label to stack unwinder. */
-#endif
- params = tree_cons (NULL_TREE, make_tree (ptr_type_node,
- inner_throw_label), NULL_TREE);
-
- do_function_call (Unwind, params, NULL_TREE);
- assemble_external (TREE_OPERAND (Unwind, 0));
- emit_barrier ();
-#endif
-}
-
-
-/* is called from expand_exception_blocks () to generate the code in a function
- to "throw" if anything in the function needs to perform a throw.
-
- expands "throw" as the following pseudo code:
-
- throw:
- eh = find_first_exception_match (saved_pc);
- if (!eh) goto gotta_rethrow_it;
- goto eh;
-
- gotta_rethrow_it:
- saved_pc = __builtin_return_address (0);
- pop_to_previous_level ();
- goto throw; */
-
-void
-expand_builtin_throw ()
-{
- tree fcall;
- tree params;
- rtx return_val_rtx;
- rtx gotta_rethrow_it;
- rtx gotta_call_terminate;
- rtx top_of_loop;
- rtx unwind_first;
- tree t;
-
- if (! doing_eh (0))
- return;
-
- if (! throw_used)
- return;
-
- params = void_list_node;
- t = make_call_declarator (get_identifier ("__throw"), params, NULL_TREE,
- NULL_TREE);
- start_function (decl_tree_cons (NULL_TREE, get_identifier ("static"),
- void_list_node),
- t, NULL_TREE, 0);
- store_parm_decls ();
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
-
- gotta_rethrow_it = gen_label_rtx ();
- gotta_call_terminate = gen_label_rtx ();
- top_of_loop = gen_label_rtx ();
- unwind_first = gen_label_rtx ();
-
- /* These two can be frontend specific. If wanted, they can go in
- expand_throw. */
- /* Do we have a valid object we are throwing? */
- emit_cmp_insn (DECL_RTL (saved_throw_type), const0_rtx, EQ, NULL_RTX,
- GET_MODE (DECL_RTL (saved_throw_type)), 0, 0);
- emit_jump_insn (gen_beq (gotta_call_terminate));
-
- emit_jump (unwind_first);
-
- emit_label (top_of_loop);
-
- /* search for an exception handler for the saved_pc */
- return_val_rtx = do_function_call (FirstExceptionMatch,
- tree_cons (NULL_TREE, saved_pc, NULL_TREE),
- ptr_type_node);
- assemble_external (TREE_OPERAND (FirstExceptionMatch, 0));
-
- /* did we find one? */
- emit_cmp_insn (return_val_rtx, const0_rtx, EQ, NULL_RTX,
- GET_MODE (return_val_rtx), 0, 0);
-
- /* if not, jump to gotta_rethrow_it */
- emit_jump_insn (gen_beq (gotta_rethrow_it));
-
- /* we found it, so jump to it */
- emit_indirect_jump (return_val_rtx);
-
- /* code to deal with unwinding and looking for it again */
- emit_label (gotta_rethrow_it);
-
- /* call to __builtin_return_address () */
-#if defined (ARM_FRAME_RTX) /* was __arm */
- /* This should be moved into arm.h:RETURN_ADDR_RTX */
- /* This replaces a 'call' to __builtin_return_address */
- return_val_rtx = gen_reg_rtx (Pmode);
- emit_move_insn (return_val_rtx, gen_rtx (MEM, Pmode, plus_constant (hard_frame_pointer_rtx, -4)));
-#else
- params = tree_cons (NULL_TREE, integer_zero_node, NULL_TREE);
- fcall = build_function_call (BuiltinReturnAddress, params);
- return_val_rtx = expand_expr (fcall, NULL_RTX, Pmode, 0);
-#endif
-
- /* did __builtin_return_address () return a valid address? */
- emit_cmp_insn (return_val_rtx, const0_rtx, EQ, NULL_RTX,
- GET_MODE (return_val_rtx), 0, 0);
-
- emit_jump_insn (gen_beq (gotta_call_terminate));
-
- return_val_rtx = eh_outer_context (return_val_rtx);
-
- /* Yes it did. */
- emit_move_insn (eh_saved_pc_rtx, return_val_rtx);
-
- do_unwind (gen_rtx (LABEL_REF, Pmode, top_of_loop));
- emit_jump (top_of_loop);
-
- /* no it didn't --> therefore we need to call terminate */
- emit_label (gotta_call_terminate);
- do_function_call (Terminate, NULL_TREE, NULL_TREE);
- assemble_external (TREE_OPERAND (Terminate, 0));
-
- {
- rtx ret_val, return_val_rtx;
- emit_label (unwind_first);
- ret_val = expand_builtin_return_addr (BUILT_IN_RETURN_ADDRESS,
- 0, hard_frame_pointer_rtx);
-
- /* Set it up so that we continue inside, at the top of the loop. */
- emit_move_insn (ret_val, gen_rtx (LABEL_REF, Pmode, top_of_loop));
-#ifdef RETURN_ADDR_OFFSET
- return_val_rtx = plus_constant (ret_val, -RETURN_ADDR_OFFSET);
- if (return_val_rtx != ret_val)
- emit_move_insn (ret_val, return_val_rtx);
-#endif
-
- /* Fall into epilogue to unwind prologue. */
- }
-
- expand_end_bindings (getdecls (), 1, 0);
- poplevel (1, 0, 0);
- pop_momentary ();
-
- finish_function (lineno, 0, 0);
-}
-
-
-void
-expand_start_eh_spec ()
-{
- expand_eh_region_start ();
-}
-
-static void
-expand_end_eh_spec (raises)
- tree raises;
-{
- tree expr, second_try;
- rtx check = gen_label_rtx ();
- rtx cont;
- rtx ret = gen_reg_rtx (Pmode);
- rtx flag = gen_reg_rtx (TYPE_MODE (integer_type_node));
- rtx end = gen_label_rtx ();
-
- expr = make_node (RTL_EXPR);
- TREE_TYPE (expr) = void_type_node;
- RTL_EXPR_RTL (expr) = const0_rtx;
- TREE_SIDE_EFFECTS (expr) = 1;
- start_sequence_for_rtl_expr (expr);
- cont = gen_label_rtx ();
- emit_move_insn (ret, gen_rtx (LABEL_REF, Pmode, cont));
- emit_jump (check);
- emit_label (cont);
- jumpif (make_tree (integer_type_node, flag), end);
- do_function_call (Terminate, NULL_TREE, NULL_TREE);
- assemble_external (TREE_OPERAND (Terminate, 0));
- emit_barrier ();
- RTL_EXPR_SEQUENCE (expr) = get_insns ();
- end_sequence ();
-
- second_try = expr;
-
- expr = make_node (RTL_EXPR);
- TREE_TYPE (expr) = void_type_node;
- RTL_EXPR_RTL (expr) = const0_rtx;
- TREE_SIDE_EFFECTS (expr) = 1;
- start_sequence_for_rtl_expr (expr);
-
- cont = gen_label_rtx ();
- emit_move_insn (ret, gen_rtx (LABEL_REF, Pmode, cont));
- emit_jump (check);
- emit_label (cont);
- jumpif (make_tree (integer_type_node, flag), end);
- expand_eh_region_start ();
- do_function_call (Unexpected, NULL_TREE, NULL_TREE);
- assemble_external (TREE_OPERAND (Unexpected, 0));
- emit_barrier ();
- expand_eh_region_end (second_try);
-
- emit_label (check);
- emit_move_insn (flag, const1_rtx);
- cont = gen_label_rtx ();
- while (raises)
- {
- tree exp;
- tree match_type = TREE_VALUE (raises);
-
- if (match_type)
- {
- /* check TREE_VALUE (raises) here */
- exp = saved_throw_value;
- exp = tree_cons (NULL_TREE,
- build_eh_type_type (match_type),
- tree_cons (NULL_TREE,
- saved_throw_type,
- tree_cons (NULL_TREE, exp, NULL_TREE)));
- exp = build_function_call (CatchMatch, exp);
- assemble_external (TREE_OPERAND (CatchMatch, 0));
-
- jumpif (exp, cont);
- }
-
- raises = TREE_CHAIN (raises);
- }
- emit_move_insn (flag, const0_rtx);
- emit_label (cont);
- emit_indirect_jump (ret);
- emit_label (end);
-
- RTL_EXPR_SEQUENCE (expr) = get_insns ();
- end_sequence ();
-
- expand_eh_region_end (expr);
-}
-
-/* This is called to expand all the toplevel exception handling
- finalization for a function. It should only be called once per
- function. */
-
-void
-expand_exception_blocks ()
-{
- rtx funcend;
- rtx insn, insns;
- rtx eh_spec_insns = NULL_RTX;
-
- start_sequence ();
-
- funcend = gen_label_rtx ();
- emit_jump (funcend);
- /* expand_null_return (); */
-
- start_sequence ();
-
- /* Add all the catch clauses here. */
- emit_insns (catch_clauses);
- catch_clauses = NULL_RTX;
-
- expand_leftover_cleanups ();
-
- insns = get_insns ();
- end_sequence ();
-
- /* Do this after we expand leftover cleanups, so that the expand_eh_region_end
- that expand_end_eh_spec does will match the right expand_eh_region_start,
- and make sure it comes out before the terminate protected region. */
- if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
- {
-#if 1
- {
- rtx insns;
- /* New... */
- start_sequence ();
- expand_start_eh_spec ();
- eh_spec_insns = get_insns ();
- end_sequence ();
- }
-#endif
-
- expand_end_eh_spec (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)));
- push_to_sequence (insns);
-
- /* Now expand any new ones. */
- expand_leftover_cleanups ();
-
- insns = get_insns ();
- end_sequence ();
- }
-
- if (insns)
- {
- /* Is this necessary? */
- assemble_external (TREE_OPERAND (Terminate, 0));
-
- expand_eh_region_start ();
- emit_insns (insns);
- expand_eh_region_end (TerminateFunctionCall);
- expand_leftover_cleanups ();
- }
-
- {
- /* Mark the end of the stack unwinder. */
- rtx unwind_insns;
- start_sequence ();
-#if 0
- end_eh_unwinder ();
-#endif
- unwind_insns = get_insns ();
- end_sequence ();
- if (unwind_insns)
- {
- insns = unwind_insns;
- emit_insns (insns);
- }
- }
-
- emit_label (funcend);
-
- /* Only if we had previous insns do we want to emit the jump around
- them. If there weren't any, then insns will remain NULL_RTX. */
- if (insns)
- insns = get_insns ();
- end_sequence ();
-
-#if 1
- if (eh_spec_insns)
- emit_insns_after (eh_spec_insns, get_insns ());
-#else
- if (eh_spec_insns)
- store_after_parms (eh_spec_insns);
-#endif
-
- insn = get_last_insn ();
- while (GET_CODE (insn) == NOTE
- || (GET_CODE (insn) == INSN
- && (GET_CODE (PATTERN (insn)) == USE
- || GET_CODE (PATTERN (insn)) == CLOBBER)))
- insn = PREV_INSN (insn);
-
- emit_insns_after (insns, insn);
-}
-
-tree
-start_anon_func ()
-{
- static int counter = 0;
- int old_interface_unknown = interface_unknown;
- char name[32];
- tree params;
- tree t;
-
- push_cp_function_context (NULL_TREE);
- push_to_top_level ();
-
- /* No need to mangle this. */
- push_lang_context (lang_name_c);
-
- interface_unknown = 1;
-
- params = void_list_node;
- /* tcf stands for throw clean funciton. */
- sprintf (name, "__tcf_%d", counter++);
- t = make_call_declarator (get_identifier (name), params, NULL_TREE,
- NULL_TREE);
- start_function (decl_tree_cons (NULL_TREE, get_identifier ("static"),
- void_list_node),
- t, NULL_TREE, 0);
- store_parm_decls ();
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
- emit_line_note (input_filename, lineno);
-
- interface_unknown = old_interface_unknown;
-
- pop_lang_context ();
-
- return current_function_decl;
-}
-
-void
-end_anon_func ()
-{
- expand_end_bindings (getdecls (), 1, 0);
- poplevel (1, 0, 0);
- pop_momentary ();
-
- finish_function (lineno, 0, 0);
-
- pop_from_top_level ();
- pop_cp_function_context (NULL_TREE);
-}
-
-/* Expand a throw statement. This follows the following
- algorithm:
-
- 1. Allocate space to save the current PC onto the stack.
- 2. Generate and emit a label and save its address into the
- newly allocated stack space since we can't save the pc directly.
- 3. If this is the first call to throw in this function:
- generate a label for the throw block
- 4. jump to the throw block label. */
-
-void
-expand_throw (exp)
- tree exp;
-{
- rtx label;
-
- if (! doing_eh (1))
- return;
-
- if (exp)
- {
- tree throw_type;
- tree cleanup = empty_fndecl, e;
-
- /* throw expression */
- /* First, decay it. */
- exp = decay_conversion (exp);
-
- if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)
- {
- throw_type = build_eh_type (exp);
- exp = build_reinterpret_cast (ptr_type_node, exp);
- }
- else
- {
- tree object;
-
- /* Make a copy of the thrown object. WP 15.1.5 */
- exp = build_new (NULL_TREE, TREE_TYPE (exp),
- build_tree_list (NULL_TREE, exp),
- 0);
-
- if (exp == error_mark_node)
- error (" in thrown expression");
-
- object = build_indirect_ref (exp, NULL_PTR);
- throw_type = build_eh_type (object);
-
- start_sequence ();
- object = build_reinterpret_cast (TREE_TYPE (exp), saved_throw_value);
- object = build_indirect_ref (object, NULL_PTR);
- cleanup = maybe_build_cleanup_and_delete (object);
- end_sequence ();
-
- if (cleanup)
- {
- cleanup = start_anon_func ();
-
- expand_expr (maybe_build_cleanup_and_delete (object),
- const0_rtx, VOIDmode, 0);
-
- end_anon_func ();
-
- mark_addressable (cleanup);
- }
- else
- {
- cleanup = empty_fndecl;
- }
- }
-
- if (cleanup == empty_fndecl)
- assemble_external (empty_fndecl);
-
- e = build_modify_expr (saved_throw_type, NOP_EXPR, throw_type);
- expand_expr (e, const0_rtx, VOIDmode, 0);
-
- e = build_modify_expr (saved_throw_value, NOP_EXPR, exp);
- e = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (e), e);
- expand_expr (e, const0_rtx, VOIDmode, 0);
-
- cleanup = build_unary_op (ADDR_EXPR, cleanup, 0);
- cleanup = build_modify_expr (saved_cleanup, NOP_EXPR, cleanup);
- expand_expr (cleanup, const0_rtx, VOIDmode, 0);
- }
- else
- {
- /* rethrow current exception */
- /* This part is easy, as we don't have to do anything else. */
- }
-
- /* This is the label that represents where in the code we were, when
- we got an exception. This needs to be updated when we rethrow an
- exception, so that the matching routine knows to search out. */
- label = gen_label_rtx ();
- emit_label (label);
-
- expand_internal_throw (label);
-}
-
-/* Build a throw expression. */
-
-tree
-build_throw (e)
- tree e;
-{
- if (e != error_mark_node)
- {
- if (processing_template_decl)
- return build_min (THROW_EXPR, void_type_node, e);
- e = build1 (THROW_EXPR, void_type_node, e);
- TREE_SIDE_EFFECTS (e) = 1;
- TREE_USED (e) = 1;
- }
- return e;
-}
diff --git a/gcc/cp/exception.cc b/gcc/cp/exception.cc
deleted file mode 100644
index 8cf227a719a..00000000000
--- a/gcc/cp/exception.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Functions for Exception Support for -*- C++ -*-
-// Copyright (C) 1994, 1995, 1996 Free Software Foundation
-
-// 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.
-
-// As a special exception, if you link this library with other files,
-// some of which are compiled with GCC, to produce an executable,
-// this library 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.
-
-#pragma implementation "exception"
-
-#include "typeinfo"
-#include "exception"
-
-/* terminate (), unexpected (), set_terminate (), set_unexpected () as
- well as the default terminate func and default unexpected func */
-
-void
-__default_terminate ()
-{
- abort ();
-}
-
-void
-__default_unexpected ()
-{
- __default_terminate ();
-}
-
-static terminate_handler __terminate_func = __default_terminate;
-static unexpected_handler __unexpected_func = __default_unexpected;
-
-terminate_handler
-set_terminate (terminate_handler func)
-{
- terminate_handler old = __terminate_func;
-
- __terminate_func = func;
- return old;
-}
-
-unexpected_handler
-set_unexpected (unexpected_handler func)
-{
- unexpected_handler old = __unexpected_func;
-
- __unexpected_func = func;
- return old;
-}
-
-void
-terminate ()
-{
- __terminate_func ();
-}
-
-void
-unexpected ()
-{
- __unexpected_func ();
-}
-
-extern "C" void
-__throw_bad_cast (void)
-{
- throw bad_cast ();
-}
-
-extern "C" void
-__throw_bad_typeid (void)
-{
- throw bad_typeid ();
-}
-
-extern "C" void
-__throw_bad_exception (void)
-{
- throw bad_exception ();
-}
-
-bool
-uncaught_exception ()
-{
- extern void *__eh_type;
- extern bool __eh_in_catch;
- return __eh_type && ! __eh_in_catch;
-}
-
-const char * exception::
-what () const
-{
- return typeid (*this).name ();
-}
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
deleted file mode 100644
index 118db30930d..00000000000
--- a/gcc/cp/expr.c
+++ /dev/null
@@ -1,455 +0,0 @@
-/* Convert language-specific tree expression to rtl instructions,
- for GNU compiler.
- Copyright (C) 1988, 1992, 1993, 1994, 1995 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. */
-
-
-#include "config.h"
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "expr.h"
-#include "cp-tree.h"
-
-/* Hook used by expand_expr to expand language-specific tree codes. */
-
-rtx
-cplus_expand_expr (exp, target, tmode, modifier)
- tree exp;
- rtx target;
- enum machine_mode tmode;
- enum expand_modifier modifier;
-{
- tree type = TREE_TYPE (exp);
- register enum machine_mode mode = TYPE_MODE (type);
- register enum tree_code code = TREE_CODE (exp);
- int ignore = target == const0_rtx;
-
- if (ignore)
- target = 0;
-
- /* No sense saving up arithmetic to be done
- if it's all in the wrong mode to form part of an address.
- And force_operand won't know whether to sign-extend or zero-extend. */
-
- if (mode != Pmode && modifier == EXPAND_SUM)
- modifier = EXPAND_NORMAL;
-
- switch (code)
- {
- case NEW_EXPR:
- {
- /* Something needs to be initialized, but we didn't know
- where that thing was when building the tree. For example,
- it could be the return value of a function, or a parameter
- to a function which lays down in the stack, or a temporary
- variable which must be passed by reference.
-
- Cleanups are handled in a language-specific way: they
- might be run by the called function (true in GNU C++
- for parameters with cleanups), or they might be
- run by the caller, after the call (true in GNU C++
- for other cleanup needs). */
-
- tree func = TREE_OPERAND (exp, 0);
- tree args = TREE_OPERAND (exp, 1);
- tree type = TREE_TYPE (exp), slot;
- tree fn_type = TREE_TYPE (TREE_TYPE (func));
- tree return_type = TREE_TYPE (fn_type);
- tree call_exp;
- rtx call_target, return_target;
- int pcc_struct_return = 0;
-
- /* The expression `init' wants to initialize what
- `target' represents. SLOT holds the slot for TARGET. */
- slot = TREE_OPERAND (exp, 2);
-
- if (target == 0)
- {
- /* Should always be called with a target in BLKmode case. */
- my_friendly_assert (mode != BLKmode, 205);
- my_friendly_assert (DECL_RTL (slot) != 0, 206);
-
- target = gen_reg_rtx (mode);
- }
-
- /* The target the initializer will initialize (CALL_TARGET)
- must now be directed to initialize the target we are
- supposed to initialize (TARGET). The semantics for
- choosing what CALL_TARGET is is language-specific,
- as is building the call which will perform the
- initialization. It is left here to show the choices that
- exist for C++. */
-
- if (TREE_CODE (func) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (func, 0)) == FUNCTION_DECL
- && DECL_CONSTRUCTOR_P (TREE_OPERAND (func, 0)))
- {
- type = build_pointer_type (type);
- /* Don't clobber a value that might be part of a default
- parameter value. */
- mark_addressable (slot);
- if (TREE_PERMANENT (args))
- args = tree_cons (0, build1 (ADDR_EXPR, type, slot),
- TREE_CHAIN (args));
- else
- TREE_VALUE (args) = build1 (ADDR_EXPR, type, slot);
- call_target = 0;
- }
- else if (TREE_CODE (return_type) == REFERENCE_TYPE)
- {
- type = return_type;
- call_target = 0;
- }
- else
- {
-#ifdef PCC_STATIC_STRUCT_RETURN
- pcc_struct_return = 1;
- call_target = 0;
-#else
- call_target = target;
-#endif
- }
- if (call_target)
- {
- /* Make this a valid memory address now. The code below assumes
- that it can compare rtx and make assumptions based on the
- result. The assumptions are true only if the address was
- valid to begin with. */
- call_target = validize_mem (call_target);
-
- /* If this is a reference to a symbol, expand_inline_function
- will do this transformation and return a different target
- than the one we gave it, though functionally equivalent. Do
- the transformation here to avoid confusion. */
- if (! cse_not_expected && GET_CODE (call_target) == MEM
- && GET_CODE (XEXP (call_target, 0)) == SYMBOL_REF)
- {
- call_target = gen_rtx
- (MEM, mode, memory_address (mode, XEXP (call_target, 0)));
- MEM_IN_STRUCT_P (call_target) = 1;
- }
- }
-
- call_exp = build (CALL_EXPR, type, func, args, NULL_TREE);
- TREE_SIDE_EFFECTS (call_exp) = 1;
- return_target = expand_call (call_exp, call_target, ignore);
- if (call_target == 0)
- {
- if (pcc_struct_return)
- {
- extern int flag_access_control;
- int old_ac = flag_access_control;
-
- tree init = build_decl (VAR_DECL, 0, type);
- TREE_ADDRESSABLE (init) = 1;
- DECL_RTL (init) = return_target;
-
- flag_access_control = 0;
- expand_aggr_init (slot, init, 0, LOOKUP_ONLYCONVERTING);
- flag_access_control = old_ac;
-
- if (TYPE_NEEDS_DESTRUCTOR (type))
- {
- init = build_decl (VAR_DECL, 0,
- build_reference_type (type));
- DECL_RTL (init) = XEXP (return_target, 0);
-
- init = maybe_build_cleanup (convert_from_reference (init));
- if (init != NULL_TREE)
- expand_expr (init, const0_rtx, VOIDmode, 0);
- }
- call_target = return_target = DECL_RTL (slot);
- }
- else
- call_target = return_target;
- }
-
- if (call_target != return_target)
- {
- my_friendly_assert (TYPE_HAS_TRIVIAL_INIT_REF (type), 317);
- if (GET_MODE (return_target) == BLKmode)
- emit_block_move (call_target, return_target, expr_size (exp),
- TYPE_ALIGN (type) / BITS_PER_UNIT);
- else
- emit_move_insn (call_target, return_target);
- }
-
- if (TREE_CODE (return_type) == REFERENCE_TYPE)
- {
- tree init;
-
- if (GET_CODE (call_target) == REG
- && REGNO (call_target) < FIRST_PSEUDO_REGISTER)
- my_friendly_abort (39);
-
- type = TREE_TYPE (exp);
-
- init = build (RTL_EXPR, return_type, 0, call_target);
- /* We got back a reference to the type we want. Now initialize
- target with that. */
- expand_aggr_init (slot, init, 0, LOOKUP_ONLYCONVERTING);
- }
-
- if (DECL_RTL (slot) != target)
- emit_move_insn (DECL_RTL (slot), target);
- return DECL_RTL (slot);
- }
-
- case OFFSET_REF:
- {
-#if 1
- return expand_expr (default_conversion (resolve_offset_ref (exp)),
- target, tmode, EXPAND_NORMAL);
-#else
- /* This is old crusty code, and does not handle all that the
- resolve_offset_ref function does. (mrs) */
- tree base = build_unary_op (ADDR_EXPR, TREE_OPERAND (exp, 0), 0);
- tree offset = build_unary_op (ADDR_EXPR, TREE_OPERAND (exp, 1), 0);
- return expand_expr (build (PLUS_EXPR, TREE_TYPE (exp), base, offset),
- target, tmode, EXPAND_NORMAL);
-#endif
- }
-
- case THUNK_DECL:
- return DECL_RTL (exp);
-
- case THROW_EXPR:
- expand_throw (TREE_OPERAND (exp, 0));
- return NULL;
-
- case VEC_INIT_EXPR:
- return expand_expr
- (expand_vec_init
- (NULL_TREE, TREE_OPERAND (exp, 0),
- build_binary_op (MINUS_EXPR, TREE_OPERAND (exp, 2),
- integer_one_node, 1),
- TREE_OPERAND (exp, 1), 0), target, tmode, modifier);
-
- default:
- break;
- }
- my_friendly_abort (40);
- /* NOTREACHED */
- return NULL;
-}
-
-void
-init_cplus_expand ()
-{
- lang_expand_expr = cplus_expand_expr;
-}
-
-/* If DECL had its rtl moved from where callers expect it
- to be, fix it up. RESULT is the nominal rtl for the RESULT_DECL,
- which may be a pseudo instead of a hard register. */
-
-void
-fixup_result_decl (decl, result)
- tree decl;
- rtx result;
-{
- if (REG_P (result))
- {
- if (REGNO (result) >= FIRST_PSEUDO_REGISTER)
- {
- rtx real_decl_result;
-
-#ifdef FUNCTION_OUTGOING_VALUE
- real_decl_result
- = FUNCTION_OUTGOING_VALUE (TREE_TYPE (decl), current_function_decl);
-#else
- real_decl_result
- = FUNCTION_VALUE (TREE_TYPE (decl), current_function_decl);
-#endif
- REG_FUNCTION_VALUE_P (real_decl_result) = 1;
- result = real_decl_result;
- }
- store_expr (decl, result, 0);
- emit_insn (gen_rtx (USE, VOIDmode, result));
- }
-}
-
-/* Expand this initialization inline and see if it's simple enough that
- it can be done at compile-time. */
-
-static tree
-extract_aggr_init (decl, init)
- tree decl, init;
-{
- return 0;
-}
-
-static tree
-extract_scalar_init (decl, init)
- tree decl, init;
-{
- rtx value, insns, insn;
- extern struct obstack temporary_obstack;
- tree t = NULL_TREE;
-
- push_obstacks (&temporary_obstack, &temporary_obstack);
- start_sequence ();
- value = expand_expr (init, NULL_RTX, VOIDmode, 0);
- insns = get_insns ();
- end_sequence ();
- reg_scan (insns, max_reg_num (), 0);
- jump_optimize (insns, 0, 0, 1);
- pop_obstacks ();
-
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- {
- rtx r, to;
-
- if (GET_CODE (insn) == NOTE)
- continue;
- else if (GET_CODE (insn) != INSN)
- return 0;
-
- r = PATTERN (insn);
- if (GET_CODE (r) != SET)
- return 0;
-
- to = XEXP (r, 0);
-
- if (! (to == value ||
- (GET_CODE (to) == SUBREG && XEXP (to, 0) == value)))
- return 0;
-
- r = XEXP (r, 1);
-
- switch (GET_CODE (r))
- {
- case CONST_INT:
- t = build_int_2 (XEXP (r, 0), 0);
- break;
- default:
- return 0;
- }
- }
-
- return t;
-}
-
-int
-extract_init (decl, init)
- tree decl, init;
-{
- return 0;
-
-#if 0
- if (IS_AGGR_TYPE (TREE_TYPE (decl))
- || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
- init = extract_aggr_init (decl, init);
- else
- init = extract_scalar_init (decl, init);
-
- if (init == NULL_TREE)
- return 0;
-
- DECL_INITIAL (decl) = init;
- return 1;
-#endif
-}
-
-void
-do_case (start, end)
- tree start, end;
-{
- tree value1 = NULL_TREE, value2 = NULL_TREE, label;
-
- if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE
- && POINTER_TYPE_P (TREE_TYPE (start)))
- error ("pointers are not permitted as case values");
-
- if (end && pedantic)
- pedwarn ("ANSI C++ forbids range expressions in switch statement");
-
- if (processing_template_decl)
- {
- add_tree (build_min_nt (CASE_LABEL, start, end));
- return;
- }
-
- if (start)
- value1 = check_cp_case_value (start);
- if (end)
- value2 = check_cp_case_value (end);
-
- label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- if (value1 != error_mark_node
- && value2 != error_mark_node)
- {
- tree duplicate;
- int success;
-
- if (end)
- success = pushcase_range (value1, value2, convert_and_check,
- label, &duplicate);
- else if (start)
- success = pushcase (value1, convert_and_check, label, &duplicate);
- else
- success = pushcase (NULL_TREE, 0, label, &duplicate);
-
- if (success == 1)
- {
- if (end)
- error ("case label not within a switch statement");
- else if (start)
- cp_error ("case label `%E' not within a switch statement", start);
- else
- error ("default label not within a switch statement");
- }
- else if (success == 2)
- {
- if (end)
- {
- error ("duplicate (or overlapping) case value");
- cp_error_at ("this is the first entry overlapping that value",
- duplicate);
- }
- else if (start)
- {
- cp_error ("duplicate case value `%E'", start);
- cp_error_at ("previously used here", duplicate);
- }
- else
- {
- error ("multiple default labels in one switch");
- cp_error_at ("this is the first default label", duplicate);
- }
- }
- else if (success == 3)
- warning ("case value out of range");
- else if (success == 4)
- warning ("empty range specified");
- else if (success == 5)
- {
- if (end)
- error ("case label within scope of cleanup or variable array");
- else
- cp_error ("case label `%E' within scope of cleanup or variable array", start);
- }
- }
- if (start)
- define_case_label (label);
- else
- define_case_label (NULL_TREE);
-}
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
deleted file mode 100644
index 6d7d9d54003..00000000000
--- a/gcc/cp/friend.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/* Help friends in C++.
- Copyright (C) 1997 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. */
-
-#include "config.h"
-#include "tree.h"
-#include "rtl.h"
-#include "cp-tree.h"
-#include "flags.h"
-#include "output.h"
-
-/* Friend data structures:
-
- Lists of friend functions come from TYPE_DECL nodes. Since all
- aggregate types are automatically typedef'd, these nodes are guaranteed
- to exist.
-
- The TREE_PURPOSE of a friend list is the name of the friend,
- and its TREE_VALUE is another list.
-
- For each element of that list, either the TREE_VALUE or the TREE_PURPOSE
- will be filled in, but not both. The TREE_VALUE of that list is an
- individual function which is a friend. The TREE_PURPOSE of that list
- indicates a type in which all functions by that name are friends.
-
- Lists of friend classes come from _TYPE nodes. Love that consistency
- thang. */
-
-int
-is_friend (type, supplicant)
- tree type, supplicant;
-{
- int declp;
- register tree list;
-
- if (supplicant == NULL_TREE || type == NULL_TREE)
- return 0;
-
- declp = (TREE_CODE_CLASS (TREE_CODE (supplicant)) == 'd');
-
- if (declp)
- /* It's a function decl. */
- {
- tree list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type));
- tree name = DECL_NAME (supplicant);
- tree ctype;
-
- if (DECL_FUNCTION_MEMBER_P (supplicant))
- ctype = DECL_CLASS_CONTEXT (supplicant);
- else
- ctype = NULL_TREE;
-
- for (; list ; list = TREE_CHAIN (list))
- {
- if (name == TREE_PURPOSE (list))
- {
- tree friends = TREE_VALUE (list);
- for (; friends ; friends = TREE_CHAIN (friends))
- {
- if (ctype == TREE_PURPOSE (friends))
- return 1;
- if (comptypes (TREE_TYPE (supplicant),
- TREE_TYPE (TREE_VALUE (friends)), 1))
- return 1;
- }
- break;
- }
- }
- }
- else
- /* It's a type. */
- {
- if (type == supplicant)
- return 1;
-
- list = CLASSTYPE_FRIEND_CLASSES (TREE_TYPE (TYPE_MAIN_DECL (type)));
- for (; list ; list = TREE_CHAIN (list))
- if (supplicant == TREE_VALUE (list))
- return 1;
- }
-
- {
- tree context;
-
- if (! declp)
- {
- /* Are we a nested or local class? If so, we aren't friends
- with the CONTEXT. */
- if (IS_AGGR_TYPE (supplicant))
- context = NULL_TREE;
- else
- context = DECL_CONTEXT (TYPE_MAIN_DECL (supplicant));
- }
- else if (DECL_FUNCTION_MEMBER_P (supplicant))
- context = DECL_CLASS_CONTEXT (supplicant);
- else
- context = NULL_TREE;
-
- if (context)
- return is_friend (type, context);
- }
-
- return 0;
-}
-
-/* Add a new friend to the friends of the aggregate type TYPE.
- DECL is the FUNCTION_DECL of the friend being added. */
-
-static void
-add_friend (type, decl)
- tree type, decl;
-{
- tree typedecl = TYPE_MAIN_DECL (type);
- tree list = DECL_FRIENDLIST (typedecl);
- tree name = DECL_NAME (decl);
-
- while (list)
- {
- if (name == TREE_PURPOSE (list))
- {
- tree friends = TREE_VALUE (list);
- for (; friends ; friends = TREE_CHAIN (friends))
- {
- if (decl == TREE_VALUE (friends))
- {
- cp_warning ("`%D' is already a friend of class `%T'",
- decl, type);
- cp_warning_at ("previous friend declaration of `%D'",
- TREE_VALUE (friends));
- return;
- }
- }
- TREE_VALUE (list) = tree_cons (error_mark_node, decl,
- TREE_VALUE (list));
- return;
- }
- list = TREE_CHAIN (list);
- }
- DECL_FRIENDLIST (typedecl)
- = tree_cons (DECL_NAME (decl), build_tree_list (error_mark_node, decl),
- DECL_FRIENDLIST (typedecl));
- if (DECL_NAME (decl) == ansi_opname[(int) MODIFY_EXPR])
- {
- tree parmtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));
- TYPE_HAS_ASSIGNMENT (TREE_TYPE (typedecl)) = 1;
- if (parmtypes && TREE_CHAIN (parmtypes))
- {
- tree parmtype = TREE_VALUE (TREE_CHAIN (parmtypes));
- if (TREE_CODE (parmtype) == REFERENCE_TYPE
- && TREE_TYPE (parmtypes) == TREE_TYPE (typedecl))
- TYPE_HAS_ASSIGN_REF (TREE_TYPE (typedecl)) = 1;
- }
- }
-}
-
-/* Declare that every member function NAME in FRIEND_TYPE
- (which may be NULL_TREE) is a friend of type TYPE. */
-
-static void
-add_friends (type, name, friend_type)
- tree type, name, friend_type;
-{
- tree typedecl = TYPE_MAIN_DECL (type);
- tree list = DECL_FRIENDLIST (typedecl);
-
- while (list)
- {
- if (name == TREE_PURPOSE (list))
- {
- tree friends = TREE_VALUE (list);
- while (friends && TREE_PURPOSE (friends) != friend_type)
- friends = TREE_CHAIN (friends);
- if (friends)
- if (friend_type)
- warning ("method `%s::%s' is already a friend of class",
- TYPE_NAME_STRING (friend_type),
- IDENTIFIER_POINTER (name));
- else
- warning ("function `%s' is already a friend of class `%s'",
- IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (DECL_NAME (typedecl)));
- else
- TREE_VALUE (list) = tree_cons (friend_type, NULL_TREE,
- TREE_VALUE (list));
- return;
- }
- list = TREE_CHAIN (list);
- }
- DECL_FRIENDLIST (typedecl) =
- tree_cons (name,
- build_tree_list (friend_type, NULL_TREE),
- DECL_FRIENDLIST (typedecl));
- if (! strncmp (IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (ansi_opname[(int) MODIFY_EXPR]),
- strlen (IDENTIFIER_POINTER (ansi_opname[(int) MODIFY_EXPR]))))
- {
- TYPE_HAS_ASSIGNMENT (TREE_TYPE (typedecl)) = 1;
- sorry ("declaring \"friend operator =\" will not find \"operator = (X&)\" if it exists");
- }
-}
-
-/* Make FRIEND_TYPE a friend class to TYPE. If FRIEND_TYPE has already
- been defined, we make all of its member functions friends of
- TYPE. If not, we make it a pending friend, which can later be added
- when its definition is seen. If a type is defined, then its TYPE_DECL's
- DECL_UNDEFINED_FRIENDS contains a (possibly empty) list of friend
- classes that are not defined. If a type has not yet been defined,
- then the DECL_WAITING_FRIENDS contains a list of types
- waiting to make it their friend. Note that these two can both
- be in use at the same time! */
-
-void
-make_friend_class (type, friend_type)
- tree type, friend_type;
-{
- tree classes;
-
- if (IS_SIGNATURE (type))
- {
- error ("`friend' declaration in signature definition");
- return;
- }
- if (IS_SIGNATURE (friend_type))
- {
- error ("signature type `%s' declared `friend'",
- IDENTIFIER_POINTER (TYPE_IDENTIFIER (friend_type)));
- return;
- }
- if (type == friend_type)
- {
- pedwarn ("class `%s' is implicitly friends with itself",
- TYPE_NAME_STRING (type));
- return;
- }
-
- GNU_xref_hier (TYPE_NAME_STRING (type),
- TYPE_NAME_STRING (friend_type), 0, 0, 1);
-
- classes = CLASSTYPE_FRIEND_CLASSES (type);
- while (classes && TREE_VALUE (classes) != friend_type)
- classes = TREE_CHAIN (classes);
- if (classes)
- warning ("class `%s' is already friends with class `%s'",
- TYPE_NAME_STRING (TREE_VALUE (classes)), TYPE_NAME_STRING (type));
- else
- {
- CLASSTYPE_FRIEND_CLASSES (type)
- = tree_cons (NULL_TREE, friend_type, CLASSTYPE_FRIEND_CLASSES (type));
- }
-}
-
-/* Main friend processor. This is large, and for modularity purposes,
- has been removed from grokdeclarator. It returns `void_type_node'
- to indicate that something happened, though a FIELD_DECL is
- not returned.
-
- CTYPE is the class this friend belongs to.
-
- DECLARATOR is the name of the friend.
-
- DECL is the FUNCTION_DECL that the friend is.
-
- In case we are parsing a friend which is part of an inline
- definition, we will need to store PARM_DECL chain that comes
- with it into the DECL_ARGUMENTS slot of the FUNCTION_DECL.
-
- FLAGS is just used for `grokclassfn'.
-
- QUALS say what special qualifies should apply to the object
- pointed to by `this'. */
-
-tree
-do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
- tree ctype, declarator, decl, parmdecls;
- enum overload_flags flags;
- tree quals;
- int funcdef_flag;
-{
- /* Every decl that gets here is a friend of something. */
- DECL_FRIEND_P (decl) = 1;
-
- if (ctype)
- {
- tree cname = TYPE_NAME (ctype);
- if (TREE_CODE (cname) == TYPE_DECL)
- cname = DECL_NAME (cname);
-
- /* A method friend. */
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- if (flags == NO_SPECIAL && ctype && declarator == cname)
- DECL_CONSTRUCTOR_P (decl) = 1;
-
- /* This will set up DECL_ARGUMENTS for us. */
- grokclassfn (ctype, cname, decl, flags, quals);
- if (TYPE_SIZE (ctype) != 0)
- decl = check_classfn (ctype, decl);
-
- if (TREE_TYPE (decl) != error_mark_node)
- {
- if (TYPE_SIZE (ctype))
- add_friend (current_class_type, decl);
- else
- {
- cp_error ("member `%D' declared as friend before type `%T' defined",
- decl, ctype);
- }
- }
- }
- else
- {
- /* Possibly a bunch of method friends. */
-
- /* Get the class they belong to. */
- tree ctype = IDENTIFIER_TYPE_VALUE (cname);
- tree fields = lookup_fnfields (TYPE_BINFO (ctype), declarator, 0);
-
- if (fields)
- add_friends (current_class_type, declarator, ctype);
- else
- error ("method `%s' is not a member of class `%s'",
- IDENTIFIER_POINTER (declarator),
- IDENTIFIER_POINTER (cname));
- decl = void_type_node;
- }
- }
- else if (TREE_CODE (decl) == FUNCTION_DECL
- && ((IDENTIFIER_LENGTH (declarator) == 4
- && IDENTIFIER_POINTER (declarator)[0] == 'm'
- && ! strcmp (IDENTIFIER_POINTER (declarator), "main"))
- || (IDENTIFIER_LENGTH (declarator) > 10
- && IDENTIFIER_POINTER (declarator)[0] == '_'
- && IDENTIFIER_POINTER (declarator)[1] == '_'
- && strncmp (IDENTIFIER_POINTER (declarator)+2,
- "builtin_", 8) == 0)))
- {
- /* raw "main", and builtin functions never gets overloaded,
- but they can become friends. */
- add_friend (current_class_type, decl);
- DECL_FRIEND_P (decl) = 1;
- decl = void_type_node;
- }
- /* A global friend.
- @@ or possibly a friend from a base class ?!? */
- else if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- /* Friends must all go through the overload machinery,
- even though they may not technically be overloaded.
-
- Note that because classes all wind up being top-level
- in their scope, their friend wind up in top-level scope as well. */
- DECL_ASSEMBLER_NAME (decl)
- = build_decl_overload (declarator, TYPE_ARG_TYPES (TREE_TYPE (decl)),
- TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE);
- DECL_ARGUMENTS (decl) = parmdecls;
- if (funcdef_flag)
- DECL_CLASS_CONTEXT (decl) = current_class_type;
-
- /* We can call pushdecl here, because the TREE_CHAIN of this
- FUNCTION_DECL is not needed for other purposes. */
- decl = pushdecl (decl);
-
- make_decl_rtl (decl, NULL_PTR, 1);
- add_friend (current_class_type, decl);
-
- DECL_FRIEND_P (decl) = 1;
- }
- else
- {
- /* @@ Should be able to ingest later definitions of this function
- before use. */
- tree decl = lookup_name_nonclass (declarator);
- if (decl == NULL_TREE)
- {
- warning ("implicitly declaring `%s' as struct",
- IDENTIFIER_POINTER (declarator));
- decl = xref_tag (record_type_node, declarator, NULL_TREE, 1);
- decl = TYPE_MAIN_DECL (decl);
- }
-
- /* Allow abbreviated declarations of overloaded functions,
- but not if those functions are really class names. */
- if (TREE_CODE (decl) == TREE_LIST && TREE_TYPE (TREE_PURPOSE (decl)))
- {
- warning ("`friend %s' archaic, use `friend class %s' instead",
- IDENTIFIER_POINTER (declarator),
- IDENTIFIER_POINTER (declarator));
- decl = TREE_TYPE (TREE_PURPOSE (decl));
- }
-
- if (TREE_CODE (decl) == TREE_LIST)
- add_friends (current_class_type, TREE_PURPOSE (decl), NULL_TREE);
- else
- make_friend_class (current_class_type, TREE_TYPE (decl));
- decl = void_type_node;
- }
- return decl;
-}
diff --git a/gcc/cp/g++.1 b/gcc/cp/g++.1
deleted file mode 100644
index ae016fad082..00000000000
--- a/gcc/cp/g++.1
+++ /dev/null
@@ -1,674 +0,0 @@
-.\" Copyright (c) 1991, 1992 Free Software Foundation -*-Text-*-
-.\" See section COPYING for conditions for redistribution
-.\" FIXME: no info here on predefines. Should there be? extra for C++...
-.TH G++ 1 "30apr1993" "GNU Tools" "GNU Tools"
-.de BP
-.sp
-.ti \-.2i
-\(**
-..
-.SH NAME
-g++ \- GNU project C++ Compiler
-.SH SYNOPSIS
-.RB g++ " [" \c
-.IR option " | " filename " ].\|.\|.
-.SH DESCRIPTION
-The C and C++ compilers are integrated;
-.B g++
-is a script to call
-.B gcc with options to recognize C++.
-.B gcc
-processes input files
-through one or more of four stages: preprocessing, compilation,
-assembly, and linking. This man page contains full descriptions for
-.I only
-C++ specific aspects of the compiler, though it also contains
-summaries of some general-purpose options. For a fuller explanation
-of the compiler, see
-.BR gcc ( 1 ).
-
-C++ source files use one of the suffixes `\|\c
-.B .C\c
-\&\|', `\|\c
-.B .cc\c
-\&\|', `\|\c
-.B .cxx\c
-\&\|', `\|\c
-.B .cpp\c
-\&\|', or `\|\c
-.B .c++\c
-\&\|'; preprocessed C++ files use the suffix `\|\c
-.B .ii\c
-\&\|'.
-.SH OPTIONS
-There are many command-line options, including options to control
-details of optimization, warnings, and code generation, which are
-common to both
-.B gcc
-and
-.B g++\c
-\&. For full information on all options, see
-.BR gcc ( 1 ).
-
-Options must be separate: `\|\c
-.B \-dr\c
-\&\|' is quite different from `\|\c
-.B \-d \-r
-\&\|'.
-
-Most `\|\c
-.B \-f\c
-\&\|' and `\|\c
-.B \-W\c
-\&\|' options have two contrary forms:
-.BI \-f name
-and
-.BI \-fno\- name\c
-\& (or
-.BI \-W name
-and
-.BI \-Wno\- name\c
-\&). Only the non-default forms are shown here.
-
-.TP
-.B \-c
-Compile or assemble the source files, but do not link. The compiler
-output is an object file corresponding to each source file.
-.TP
-.BI \-D macro
-Define macro \c
-.I macro\c
-\& with the string `\|\c
-.B 1\c
-\&\|' as its definition.
-.TP
-.BI \-D macro = defn
-Define macro \c
-.I macro\c
-\& as \c
-.I defn\c
-\&.
-.TP
-.B \-E
-Stop after the preprocessing stage; do not run the compiler proper. The
-output is preprocessed source code, which is sent to the
-standard output.
-.TP
-.B \-fall\-virtual
-Treat all possible member functions as virtual, implicitly. All
-member functions (except for constructor functions and
-.B new
-or
-.B delete
-member operators) are treated as virtual functions of the class where
-they appear.
-
-This does not mean that all calls to these member functions will be
-made through the internal table of virtual functions. Under some
-circumstances, the compiler can determine that a call to a given
-virtual function can be made directly; in these cases the calls are
-direct in any case.
-.TP
-.B \-fdollars\-in\-identifiers
-Permit the use of `\|\c
-.B $\c
-\&\|' in identifiers.
-Traditional C allowed the character `\|\c
-.B $\c
-\&\|' to form part of identifiers; by default, GNU C also
-allows this. However, ANSI C forbids `\|\c
-.B $\c
-\&\|' in identifiers, and GNU C++ also forbids it by default on most
-platforms (though on some platforms it's enabled by default for GNU
-C++ as well).
-.TP
-.B \-felide\-constructors
-Use this option to instruct the compiler to be smarter about when it can
-elide constructors. Without this flag, GNU C++ and cfront both
-generate effectively the same code for:
-.sp
-.br
-A\ foo\ ();
-.br
-A\ x\ (foo\ ());\ \ \ //\ x\ initialized\ by\ `foo\ ()',\ no\ ctor\ called
-.br
-A\ y\ =\ foo\ ();\ \ \ //\ call\ to\ `foo\ ()'\ heads\ to\ temporary,
-.br
-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ //\ y\ is\ initialized\ from\ the\ temporary.
-.br
-.sp
-Note the difference! With this flag, GNU C++ initializes `\|\c
-.B y\c
-\&\|' directly
-from the call to
-.B foo ()
-without going through a temporary.
-.TP
-.B \-fenum\-int\-equiv
-Normally GNU C++ allows conversion of
-.B enum
-to
-.B int\c
-\&, but not the other way around. Use this option if you want GNU C++
-to allow conversion of
-.B int
-to
-.B enum
-as well.
-.TP
-.B \-fexternal\-templates
-Produce smaller code for template declarations, by generating only a
-single copy of each template function where it is defined.
-To use this option successfully, you must also mark all files that
-use templates with either `\|\c
-.B #pragma implementation\c
-\&\|' (the definition) or
-`\|\c
-.B #pragma interface\c
-\&\|' (declarations).
-
-When your code is compiled with `\|\c
-.B \-fexternal\-templates\c
-\&\|', all
-template instantiations are external. You must arrange for all
-necessary instantiations to appear in the implementation file; you can
-do this with a \c
-.B typedef\c
-\& that references each instantiation needed.
-Conversely, when you compile using the default option
-`\|\c
-.B \-fno\-external\-templates\c
-\&\|', all template instantiations are
-explicitly internal.
-.TP
-.B \-fno\-gnu\-linker
-Do not output global initializations (such as C++ constructors and
-destructors) in the form used by the GNU linker (on systems where the GNU
-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
-.B collect2
-program to make sure the system linker includes
-constructors and destructors. (\c
-.B collect2
-is included in the GNU CC distribution.) For systems which
-.I must
-use
-.B collect2\c
-\&, the compiler driver
-.B gcc
-is configured to do this automatically.
-.TP
-.B \-fmemoize\-lookups
-.TP
-.B \-fsave\-memoized
-These flags are used to get the compiler to compile programs faster
-using heuristics. They are not on by default since they are only effective
-about half the time. The other half of the time programs compile more
-slowly (and take more memory).
-
-The first time the compiler must build a call to a member function (or
-reference to a data member), it must (1) determine whether the class
-implements member functions of that name; (2) resolve which member
-function to call (which involves figuring out what sorts of type
-conversions need to be made); and (3) check the visibility of the member
-function to the caller. All of this adds up to slower compilation.
-Normally, the second time a call is made to that member function (or
-reference to that data member), it must go through the same lengthy
-process again. This means that code like this
-.sp
-.br
-\ \ cout\ <<\ "This\ "\ <<\ p\ <<\ "\ has\ "\ <<\ n\ <<\ "\ legs.\en";
-.br
-.sp
-makes six passes through all three steps. By using a software cache,
-a ``hit'' significantly reduces this cost. Unfortunately, using the
-cache introduces another layer of mechanisms which must be implemented,
-and so incurs its own overhead. `\|\c
-.B \-fmemoize\-lookups\c
-\&\|' enables
-the software cache.
-
-Because access privileges (visibility) to members and member functions
-may differ from one function context to the next,
-.B g++
-may need to flush the cache. With the `\|\c
-.B \-fmemoize\-lookups\c
-\&\|' flag, the cache is flushed after every
-function that is compiled. The `\|\c
-\-fsave\-memoized\c
-\&\|' flag enables the same software cache, but when the compiler
-determines that the context of the last function compiled would yield
-the same access privileges of the next function to compile, it
-preserves the cache.
-This is most helpful when defining many member functions for the same
-class: with the exception of member functions which are friends of
-other classes, each member function has exactly the same access
-privileges as every other, and the cache need not be flushed.
-.TP
-.B \-fno\-default\-inline
-Do not make member functions inline by default merely because they are
-defined inside the class scope. Otherwise, when you specify
-.B \-O\c
-\&, member functions defined inside class scope are compiled
-inline by default; i.e., you don't need to add `\|\c
-.B inline\c
-\&\|' in front of
-the member function name.
-.TP
-.B \-fno\-strict\-prototype
-Consider the declaration \c
-.B int foo ();\c
-\&. In C++, this means that the
-function \c
-.B foo\c
-\& takes no arguments. In ANSI C, this is declared
-.B int foo(void);\c
-\&. With the flag `\|\c
-.B \-fno\-strict\-prototype\c
-\&\|',
-declaring functions with no arguments is equivalent to declaring its
-argument list to be untyped, i.e., \c
-.B int foo ();\c
-\& is equivalent to
-saying \c
-.B int foo (...);\c
-\&.
-.TP
-.B \-fnonnull\-objects
-Normally, GNU C++ makes conservative assumptions about objects reached
-through references. For example, the compiler must check that `\|\c
-.B a\c
-\&\|' is not null in code like the following:
-.br
-\ \ \ \ obj\ &a\ =\ g\ ();
-.br
-\ \ \ \ a.f\ (2);
-.br
-Checking that references of this sort have non-null values requires
-extra code, however, and it is unnecessary for many programs. You can
-use `\|\c
-.B \-fnonnull\-objects\c
-\&\|' to omit the checks for null, if your program doesn't require the
-default checking.
-.TP
-.B \-fhandle\-signatures
-.TP
-.B \-fno\-handle\-signatures
-These options control the recognition of the \c
-.B signature\c
-\& and \c
-.B sigof\c
-\& constructs for specifying abstract types. By default, these
-constructs are not recognized.
-.TP
-.B \-fthis\-is\-variable
-The incorporation of user-defined free store management into C++ has
-made assignment to \c
-.B this\c
-\& an anachronism. Therefore, by default GNU
-C++ treats the type of \c
-.B this\c
-\& in a member function of \c
-.B class X\c
-\&
-to be \c
-.B X *const\c
-\&. In other words, it is illegal to assign to
-\c
-.B this\c
-\& within a class member function. However, for backwards
-compatibility, you can invoke the old behavior by using
-\&`\|\c
-.B \-fthis\-is\-variable\c
-\&\|'.
-.TP
-.B \-g
-Produce debugging information in the operating system's native format
-(for DBX or SDB or DWARF). GDB also can work with this debugging
-information. On most systems that use DBX format, `\|\c
-.B \-g\c
-\&\|' enables use
-of extra debugging information that only GDB can use.
-
-Unlike most other C compilers, GNU CC allows you to use `\|\c
-.B \-g\c
-\&\|' with
-`\|\c
-.B \-O\c
-\&\|'. 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.
-
-Nevertheless it proves possible to debug optimized output. This makes
-it reasonable to use the optimizer for programs that might have bugs.
-.TP
-.BI "\-I" "dir"\c
-\&
-Append directory \c
-.I dir\c
-\& to the list of directories searched for include files.
-.TP
-.BI "\-L" "dir"\c
-\&
-Add directory \c
-.I dir\c
-\& to the list of directories to be searched
-for `\|\c
-.B \-l\c
-\&\|'.
-.TP
-.BI \-l library\c
-\&
-Use the library named \c
-.I library\c
-\& when linking. (C++ programs often require `\|\c
-\-lg++\c
-\&\|' for successful linking.)
-.TP
-.B \-nostdinc
-Do not search the standard system directories for header files. Only
-the directories you have specified with
-.B \-I
-options (and the current directory, if appropriate) are searched.
-.TP
-.B \-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 libg++.)
-.TP
-.B \-O
-Optimize. Optimizing compilation takes somewhat more time, and a lot
-more memory for a large function.
-.TP
-.BI "\-o " file\c
-\&
-Place output in file \c
-.I file\c
-\&.
-.TP
-.B \-S
-Stop after the stage of compilation proper; do not assemble. The output
-is an assembler code file for each non-assembler input
-file specified.
-.TP
-.B \-traditional
-Attempt to support some aspects of traditional C compilers.
-
-Specifically, for both C and C++ programs:
-.TP
-\ \ \ \(bu
-In the preprocessor, comments convert to nothing at all, rather than
-to a space. This allows traditional token concatenation.
-.TP
-\ \ \ \(bu
-In the preprocessor, macro arguments are recognized within string
-constants in a macro definition (and their values are stringified,
-though without additional quote marks, when they appear in such a
-context). The preprocessor always considers a string constant to end
-at a newline.
-.TP
-\ \ \ \(bu
-The preprocessor does not predefine the macro \c
-.B __STDC__\c
-\& when you use
-`\|\c
-.B \-traditional\c
-\&\|', but still predefines\c
-.B __GNUC__\c
-\& (since the GNU extensions indicated by
-.B __GNUC__\c
-\& are not affected by
-`\|\c
-.B \-traditional\c
-\&\|'). If you need to write header files that work
-differently depending on whether `\|\c
-.B \-traditional\c
-\&\|' is in use, by
-testing both of these predefined macros you can distinguish four
-situations: GNU C, traditional GNU C, other ANSI C compilers, and
-other old C compilers.
-.TP
-\ \ \ \(bu
-In the preprocessor, comments convert to nothing at all, rather than
-to a space. This allows traditional token concatenation.
-.TP
-\ \ \ \(bu
-In the preprocessor, macro arguments are recognized within string
-constants in a macro definition (and their values are stringified,
-though without additional quote marks, when they appear in such a
-context). The preprocessor always considers a string constant to end
-at a newline.
-.TP
-\ \ \ \(bu
-The preprocessor does not predefine the macro \c
-.B __STDC__\c
-\& when you use
-`\|\c
-.B \-traditional\c
-\&\|', but still predefines\c
-.B __GNUC__\c
-\& (since the GNU extensions indicated by
-.B __GNUC__\c
-\& are not affected by
-`\|\c
-.B \-traditional\c
-\&\|'). If you need to write header files that work
-differently depending on whether `\|\c
-.B \-traditional\c
-\&\|' is in use, by
-testing both of these predefined macros you can distinguish four
-situations: GNU C, traditional GNU C, other ANSI C compilers, and
-other old C compilers.
-.PP
-.TP
-\ \ \ \(bu
-String ``constants'' are not necessarily constant; they are stored in
-writable space, and identical looking constants are allocated
-separately.
-
-For C++ programs only (not C), `\|\c
-.B \-traditional\c
-\&\|' has one additional effect: assignment to
-.B this
-is permitted. This is the same as the effect of `\|\c
-.B \-fthis\-is\-variable\c
-\&\|'.
-.TP
-.BI \-U macro
-Undefine macro \c
-.I macro\c
-\&.
-.TP
-.B \-Wall
-Issue warnings for conditions which pertain to usage that we recommend
-avoiding and that we believe is easy to avoid, even in conjunction
-with macros.
-.TP
-.B \-Wenum\-clash
-Warn when converting between different enumeration types.
-.TP
-.B \-Woverloaded\-virtual
-In a derived class, the definitions of virtual functions must match
-the type signature of a virtual function declared in the base class.
-Use this option to request warnings when a derived class declares a
-function that may be an erroneous attempt to define a virtual
-function: that is, warn when a function with the same name as a
-virtual function in the base class, but with a type signature that
-doesn't match any virtual functions from the base class.
-.TP
-.B \-Wtemplate\-debugging
-When using templates in a C++ program, warn if debugging is not yet
-fully available.
-.TP
-.B \-w
-Inhibit all warning messages.
-.TP
-.BI +e N
-Control how virtual function definitions are used, in a fashion
-compatible with
-.B cfront
-1.x.
-.PP
-
-.SH PRAGMAS
-Two `\|\c
-.B #pragma\c
-\&\|' directives are supported for GNU C++, to permit using the same
-header file for two purposes: as a definition of interfaces to a given
-object class, and as the full definition of the contents of that object class.
-.TP
-.B #pragma interface
-Use this directive in header files that define object classes, to save
-space in most of the object files that use those classes. Normally,
-local copies of certain information (backup copies of inline member
-functions, debugging information, and the internal tables that
-implement virtual functions) must be kept in each object file that
-includes class definitions. You can use this pragma to avoid such
-duplication. When a header file containing `\|\c
-.B #pragma interface\c
-\&\|' is included in a compilation, this auxiliary information
-will not be generated (unless the main input source file itself uses
-`\|\c
-.B #pragma implementation\c
-\&\|'). Instead, the object files will contain references to be
-resolved at link time.
-.tr !"
-.TP
-.B #pragma implementation
-.TP
-.BI "#pragma implementation !" objects .h!
-Use this pragma in a main input file, when you want full output from
-included header files to be generated (and made globally visible).
-The included header file, in turn, should use `\|\c
-.B #pragma interface\c
-\&\|'.
-Backup copies of inline member functions, debugging information, and
-the internal tables used to implement virtual functions are all
-generated in implementation files.
-
-If you use `\|\c
-.B #pragma implementation\c
-\&\|' with no argument, it applies to an include file with the same
-basename as your source file; for example, in `\|\c
-.B allclass.cc\c
-\&\|', `\|\c
-.B #pragma implementation\c
-\&\|' by itself is equivalent to `\|\c
-.B
-#pragma implementation "allclass.h"\c
-\&\|'. Use the string argument if you want a single implementation
-file to include code from multiple header files.
-
-There is no way to split up the contents of a single header file into
-multiple implementation files.
-.SH FILES
-.ta \w'LIBDIR/g++\-include 'u
-file.h C header (preprocessor) file
-.br
-file.i preprocessed C source file
-.br
-file.C C++ source file
-.br
-file.cc C++ source file
-.br
-file.cxx C++ source file
-.br
-file.s assembly language file
-.br
-file.o object file
-.br
-a.out link edited output
-.br
-\fITMPDIR\fR/cc\(** temporary files
-.br
-\fILIBDIR\fR/cpp preprocessor
-.br
-\fILIBDIR\fR/cc1plus compiler
-.br
-\fILIBDIR\fR/collect linker front end needed on some machines
-.br
-\fILIBDIR\fR/libgcc.a GCC subroutine library
-.br
-/lib/crt[01n].o start-up routine
-.br
-\fILIBDIR\fR/ccrt0 additional start-up routine for C++
-.br
-/lib/libc.a standard C library, see
-.IR intro (3)
-.br
-/usr/include standard directory for
-.B #include
-files
-.br
-\fILIBDIR\fR/include standard gcc directory for
-.B #include
-files
-.br
-\fILIBDIR\fR/g++\-include additional g++ directory for
-.B #include
-.sp
-.I LIBDIR
-is usually
-.B /usr/local/lib/\c
-.IR machine / version .
-.br
-.I TMPDIR
-comes from the environment variable
-.B TMPDIR
-(default
-.B /usr/tmp
-if available, else
-.B /tmp\c
-\&).
-.SH "SEE ALSO"
-gcc(1), cpp(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1).
-.br
-.RB "`\|" gcc "\|', `\|" cpp \|',
-.RB `\| as \|', `\| ld \|',
-and
-.RB `\| gdb \|'
-entries in
-.B info\c
-\&.
-.br
-.I
-Using and Porting GNU CC (for version 2.0)\c
-, Richard M. Stallman;
-.I
-The C Preprocessor\c
-, Richard M. Stallman;
-.I
-Debugging with GDB: the GNU Source-Level Debugger\c
-, Richard M. Stallman and Roland H. Pesch;
-.I
-Using as: the GNU Assembler\c
-, Dean Elsner, Jay Fenlason & friends;
-.I
-gld: the GNU linker\c
-, Steve Chamberlain and Roland Pesch.
-
-.SH BUGS
-For instructions on how to report bugs, see the GCC manual.
-
-.SH COPYING
-Copyright (c) 1991, 1992, 1993 Free Software Foundation, Inc.
-.PP
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-.PP
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-.PP
-Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be included in
-translations approved by the Free Software Foundation instead of in
-the original English.
-.SH AUTHORS
-See the GNU CC Manual for the contributors to GNU CC.
diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
deleted file mode 100644
index d41c516f64e..00000000000
--- a/gcc/cp/g++spec.c
+++ /dev/null
@@ -1,226 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-
-#include "config.h"
-#include "gansidecl.h"
-
-/* This bit is set if we saw a `-xfoo' language specification. */
-#define LANGSPEC (1<<1)
-/* This bit is set if they did `-lm' or `-lmath'. */
-#define MATHLIB (1<<2)
-/* This bit is set if they did `-lc'. */
-#define WITHLIBC (1<<3)
-
-#ifndef MATH_LIBRARY
-#define MATH_LIBRARY "-lm"
-#endif
-
-extern char *xmalloc PROTO((size_t));
-
-void
-lang_specific_driver (fn, in_argc, in_argv)
- void (*fn)();
- int *in_argc;
- char ***in_argv;
-{
- int i, j;
-
- /* If non-zero, the user gave us the `-v' flag. */
- int saw_verbose_flag = 0;
-
- /* This will be 0 if we encounter a situation where we should not
- link in libstdc++. */
- int library = 1;
-
- /* The number of arguments being added to what's in argv, other than
- libraries. We use this to track the number of times we've inserted
- -xc++/-xnone. */
- int added = 2;
-
- /* Used to track options that take arguments, so we don't go wrapping
- those with -xc++/-xnone. */
- char *quote = NULL;
-
- /* The new argument list will be contained in this. */
- char **arglist;
-
- /* Non-zero if we saw a `-xfoo' language specification on the
- command line. Used to avoid adding our own -xc++ if the user
- already gave a language for the file. */
- int saw_speclang = 0;
-
- /* "-lm" or "-lmath" if it appears on the command line. */
- char *saw_math = 0;
-
- /* "-lc" if it appears on the command line. */
- char *saw_libc = 0;
-
- /* An array used to flag each argument that needs a bit set for
- LANGSPEC, MATHLIB, or WITHLIBC. */
- int *args;
-
- /* By default, we throw on the math library. */
- int need_math = 1;
-
- /* The total number of arguments with the new stuff. */
- int argc;
-
- /* The argument list. */
- char **argv;
-
- /* The total number of arguments with the new stuff. */
- int num_args = 1;
-
- argc = *in_argc;
- argv = *in_argv;
-
-
- args = (int *) xmalloc (argc * sizeof (int));
- bzero ((char *) args, argc * sizeof (int));
-
- for (i = 1; i < argc; i++)
- {
- /* If the previous option took an argument, we swallow it here. */
- if (quote)
- {
- quote = NULL;
- continue;
- }
-
- /* We don't do this anymore, since we don't get them with minus
- signs on them. */
- if (argv[i][0] == '\0' || argv[i][1] == '\0')
- continue;
-
- if (argv[i][0] == '-')
- {
- if (library != 0 && (strcmp (argv[i], "-nostdlib") == 0
- || strcmp (argv[i], "-nodefaultlibs") == 0))
- {
- library = 0;
- }
- else if (strcmp (argv[i], "-lm") == 0
- || strcmp (argv[i], "-lmath") == 0
-#ifdef ALT_LIBM
- || strcmp (argv[i], ALT_LIBM) == 0
-#endif
- )
- {
- args[i] |= MATHLIB;
- need_math = 0;
- }
- else if (strcmp (argv[i], "-lc") == 0)
- args[i] |= WITHLIBC;
- else if (strcmp (argv[i], "-v") == 0)
- {
- saw_verbose_flag = 1;
- if (argc == 2)
- {
- /* If they only gave us `-v', don't try to link
- in libg++. */
- library = 0;
- }
- }
- else if (strncmp (argv[i], "-x", 2) == 0)
- saw_speclang = 1;
- else if (((argv[i][2] == '\0'
- && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL)
- || strcmp (argv[i], "-Tdata") == 0))
- quote = argv[i];
- else if (library != 0 && ((argv[i][2] == '\0'
- && (char *) strchr ("cSEM", argv[i][1]) != NULL)
- || strcmp (argv[i], "-MM") == 0))
- {
- /* Don't specify libraries if we won't link, since that would
- cause a warning. */
- library = 0;
- added -= 2;
- }
- else
- /* Pass other options through. */
- continue;
- }
- else
- {
- int len;
-
- if (saw_speclang)
- {
- saw_speclang = 0;
- continue;
- }
-
- /* If the filename ends in .c or .i, put options around it.
- But not if a specified -x option is currently active. */
- len = strlen (argv[i]);
- if (len > 2
- && (argv[i][len - 1] == 'c' || argv[i][len - 1] == 'i')
- && argv[i][len - 2] == '.')
- {
- args[i] |= LANGSPEC;
- added += 2;
- }
- }
- }
-
- if (quote)
- (*fn) ("argument to `%s' missing\n", quote);
-
- /* If we know we don't have to do anything, bail now. */
- if (! added && ! library)
- {
- free (args);
- return;
- }
-
- num_args = argc + added + need_math;
- arglist = (char **) xmalloc (num_args * sizeof (char *));
-
- /* NOTE: We start at 1 now, not 0. */
- for (i = 0, j = 0; i < argc; i++, j++)
- {
- arglist[j] = argv[i];
-
- /* Make sure -lstdc++ is before the math library, since libstdc++
- itself uses those math routines. */
- if (!saw_math && (args[i] & MATHLIB) && library)
- {
- --j;
- saw_math = argv[i];
- }
-
- if (!saw_libc && (args[i] & WITHLIBC) && library)
- {
- --j;
- saw_libc = argv[i];
- }
-
- /* Wrap foo.c and foo.i files in a language specification to
- force the gcc compiler driver to run cc1plus on them. */
- if (args[i] & LANGSPEC)
- {
- int len = strlen (argv[i]);
- if (argv[i][len - 1] == 'i')
- arglist[j++] = "-xc++-cpp-output";
- else
- arglist[j++] = "-xc++";
- arglist[j++] = argv[i];
- arglist[j] = "-xnone";
- }
- }
-
- /* Add `-lstdc++' if we haven't already done so. */
- if (library)
- arglist[j++] = "-lstdc++";
- if (saw_math)
- arglist[j++] = saw_math;
- else if (library)
- arglist[j++] = MATH_LIBRARY;
- if (saw_libc)
- arglist[j++] = saw_libc;
-
- arglist[j] = NULL;
-
- *in_argc = j;
- *in_argv = arglist;
-}
diff --git a/gcc/cp/gxx.gperf b/gcc/cp/gxx.gperf
deleted file mode 100644
index 6cb2a97abe4..00000000000
--- a/gcc/cp/gxx.gperf
+++ /dev/null
@@ -1,102 +0,0 @@
-%{
-/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */
-%}
-struct resword { char *name; short token; enum rid rid;};
-%%
-__alignof, ALIGNOF, NORID
-__alignof__, ALIGNOF, NORID
-__asm, GCC_ASM_KEYWORD, NORID
-__asm__, GCC_ASM_KEYWORD, NORID
-__attribute, ATTRIBUTE, NORID
-__attribute__, ATTRIBUTE, NORID
-__const, CV_QUALIFIER, RID_CONST
-__const__, CV_QUALIFIER, RID_CONST
-__extension__, EXTENSION, NORID
-__inline, SCSPEC, RID_INLINE
-__inline__, SCSPEC, RID_INLINE
-__label__, LABEL, NORID
-__null, CONSTANT, RID_NULL
-__signature__, AGGR, RID_SIGNATURE /* Extension */,
-__signed, TYPESPEC, RID_SIGNED
-__signed__, TYPESPEC, RID_SIGNED
-__sigof__, SIGOF, NORID /* Extension */,
-__typeof, TYPEOF, NORID
-__typeof__, TYPEOF, NORID
-__volatile, CV_QUALIFIER, RID_VOLATILE
-__volatile__, CV_QUALIFIER, RID_VOLATILE
-__wchar_t, TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,
-asm, ASM_KEYWORD, NORID,
-and, ANDAND, NORID,
-and_eq, ASSIGN, NORID,
-auto, SCSPEC, RID_AUTO,
-bitand, '&', NORID,
-bitor, '|', NORID,
-bool, TYPESPEC, RID_BOOL,
-break, BREAK, NORID,
-case, CASE, NORID,
-catch, CATCH, NORID,
-char, TYPESPEC, RID_CHAR,
-class, AGGR, RID_CLASS,
-compl, '~', NORID,
-const, CV_QUALIFIER, RID_CONST,
-const_cast, CONST_CAST, NORID,
-continue, CONTINUE, NORID,
-default, DEFAULT, NORID,
-delete, DELETE, NORID,
-do, DO, NORID,
-double, TYPESPEC, RID_DOUBLE,
-dynamic_cast, DYNAMIC_CAST, NORID,
-else, ELSE, NORID,
-enum, ENUM, NORID,
-explicit, SCSPEC, RID_EXPLICIT,
-extern, SCSPEC, RID_EXTERN,
-false, CXX_FALSE, NORID,
-float, TYPESPEC, RID_FLOAT,
-for, FOR, NORID,
-friend, SCSPEC, RID_FRIEND,
-goto, GOTO, NORID,
-if, IF, NORID,
-inline, SCSPEC, RID_INLINE,
-int, TYPESPEC, RID_INT,
-long, TYPESPEC, RID_LONG,
-mutable, SCSPEC, RID_MUTABLE,
-namespace, NAMESPACE, NORID,
-new, NEW, NORID,
-not, '!', NORID,
-not_eq, EQCOMPARE, NORID,
-operator, OPERATOR, NORID,
-or, OROR, NORID,
-or_eq, ASSIGN, NORID,
-private, VISSPEC, RID_PRIVATE,
-protected, VISSPEC, RID_PROTECTED,
-public, VISSPEC, RID_PUBLIC,
-register, SCSPEC, RID_REGISTER,
-reinterpret_cast, REINTERPRET_CAST, NORID,
-return, RETURN, NORID,
-short, TYPESPEC, RID_SHORT,
-signature, AGGR, RID_SIGNATURE /* Extension */,
-signed, TYPESPEC, RID_SIGNED,
-sigof, SIGOF, NORID /* Extension */,
-sizeof, SIZEOF, NORID,
-static, SCSPEC, RID_STATIC,
-static_cast, STATIC_CAST, NORID,
-struct, AGGR, RID_RECORD,
-switch, SWITCH, NORID,
-template, TEMPLATE, RID_TEMPLATE,
-this, THIS, NORID,
-throw, THROW, NORID,
-true, CXX_TRUE, NORID,
-try, TRY, NORID,
-typedef, SCSPEC, RID_TYPEDEF,
-typename, TYPENAME_KEYWORD, NORID,
-typeid, TYPEID, NORID,
-typeof, TYPEOF, NORID,
-union, AGGR, RID_UNION,
-unsigned, TYPESPEC, RID_UNSIGNED,
-using, USING, NORID,
-virtual, SCSPEC, RID_VIRTUAL,
-void, TYPESPEC, RID_VOID,
-volatile, CV_QUALIFIER, RID_VOLATILE,
-while, WHILE, NORID,
-xor, '^', NORID,
-xor_eq, ASSIGN, NORID,
diff --git a/gcc/cp/gxxint.texi b/gcc/cp/gxxint.texi
deleted file mode 100644
index 2c91fbfc98d..00000000000
--- a/gcc/cp/gxxint.texi
+++ /dev/null
@@ -1,1539 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@c %**start of header
-@setfilename g++int.info
-@settitle G++ internals
-@setchapternewpage odd
-@c %**end of header
-
-@node Top, Limitations of g++, (dir), (dir)
-@chapter Internal Architecture of the Compiler
-
-This is meant to describe the C++ front-end for gcc in detail.
-Questions and comments to Mike Stump @code{<mrs@@cygnus.com>}.
-
-@menu
-* Limitations of g++::
-* Routines::
-* Implementation Specifics::
-* Glossary::
-* Macros::
-* Typical Behavior::
-* Coding Conventions::
-* Templates::
-* Access Control::
-* Error Reporting::
-* Parser::
-* Copying Objects::
-* Exception Handling::
-* Free Store::
-* Concept Index::
-@end menu
-
-@node Limitations of g++, Routines, Top, Top
-@section Limitations of g++
-
-@itemize @bullet
-@item
-Limitations on input source code: 240 nesting levels with the parser
-stacksize (YYSTACKSIZE) set to 500 (the default), and requires around
-16.4k swap space per nesting level. The parser needs about 2.09 *
-number of nesting levels worth of stackspace.
-
-@cindex pushdecl_class_level
-@item
-I suspect there are other uses of pushdecl_class_level that do not call
-set_identifier_type_value in tandem with the call to
-pushdecl_class_level. It would seem to be an omission.
-
-@cindex access checking
-@item
-Access checking is unimplemented for nested types.
-
-@cindex @code{volatile}
-@item
-@code{volatile} is not implemented in general.
-
-@end itemize
-
-@node Routines, Implementation Specifics, Limitations of g++, Top
-@section Routines
-
-This section describes some of the routines used in the C++ front-end.
-
-@code{build_vtable} and @code{prepare_fresh_vtable} is used only within
-the @file{cp-class.c} file, and only in @code{finish_struct} and
-@code{modify_vtable_entries}.
-
-@code{build_vtable}, @code{prepare_fresh_vtable}, and
-@code{finish_struct} are the only routines that set @code{DECL_VPARENT}.
-
-@code{finish_struct} can steal the virtual function table from parents,
-this prohibits related_vslot from working. When finish_struct steals,
-we know that
-
-@example
-get_binfo (DECL_FIELD_CONTEXT (CLASSTYPE_VFIELD (t)), t, 0)
-@end example
-
-@noindent
-will get the related binfo.
-
-@code{layout_basetypes} does something with the VIRTUALS.
-
-Supposedly (according to Tiemann) most of the breadth first searching
-done, like in @code{get_base_distance} and in @code{get_binfo} was not
-because of any design decision. I have since found out the at least one
-part of the compiler needs the notion of depth first binfo searching, I
-am going to try and convert the whole thing, it should just work. The
-term left-most refers to the depth first left-most node. It uses
-@code{MAIN_VARIANT == type} as the condition to get left-most, because
-the things that have @code{BINFO_OFFSET}s of zero are shared and will
-have themselves as their own @code{MAIN_VARIANT}s. The non-shared right
-ones, are copies of the left-most one, hence if it is its own
-@code{MAIN_VARIANT}, we know it IS a left-most one, if it is not, it is
-a non-left-most one.
-
-@code{get_base_distance}'s path and distance matters in its use in:
-
-@itemize @bullet
-@item
-@code{prepare_fresh_vtable} (the code is probably wrong)
-@item
-@code{init_vfields} Depends upon distance probably in a safe way,
-build_offset_ref might use partial paths to do further lookups,
-hack_identifier is probably not properly checking access.
-
-@item
-@code{get_first_matching_virtual} probably should check for
-@code{get_base_distance} returning -2.
-
-@item
-@code{resolve_offset_ref} should be called in a more deterministic
-manner. Right now, it is called in some random contexts, like for
-arguments at @code{build_method_call} time, @code{default_conversion}
-time, @code{convert_arguments} time, @code{build_unary_op} time,
-@code{build_c_cast} time, @code{build_modify_expr} time,
-@code{convert_for_assignment} time, and
-@code{convert_for_initialization} time.
-
-But, there are still more contexts it needs to be called in, one was the
-ever simple:
-
-@example
-if (obj.*pmi != 7)
- @dots{}
-@end example
-
-Seems that the problems were due to the fact that @code{TREE_TYPE} of
-the @code{OFFSET_REF} was not a @code{OFFSET_TYPE}, but rather the type
-of the referent (like @code{INTEGER_TYPE}). This problem was fixed by
-changing @code{default_conversion} to check @code{TREE_CODE (x)},
-instead of only checking @code{TREE_CODE (TREE_TYPE (x))} to see if it
-was @code{OFFSET_TYPE}.
-
-@end itemize
-
-@node Implementation Specifics, Glossary, Routines, Top
-@section Implementation Specifics
-
-@itemize @bullet
-@item Explicit Initialization
-
-The global list @code{current_member_init_list} contains the list of
-mem-initializers specified in a constructor declaration. For example:
-
-@example
-foo::foo() : a(1), b(2) @{@}
-@end example
-
-@noindent
-will initialize @samp{a} with 1 and @samp{b} with 2.
-@code{expand_member_init} places each initialization (a with 1) on the
-global list. Then, when the fndecl is being processed,
-@code{emit_base_init} runs down the list, initializing them. It used to
-be the case that g++ first ran down @code{current_member_init_list},
-then ran down the list of members initializing the ones that weren't
-explicitly initialized. Things were rewritten to perform the
-initializations in order of declaration in the class. So, for the above
-example, @samp{a} and @samp{b} will be initialized in the order that
-they were declared:
-
-@example
-class foo @{ public: int b; int a; foo (); @};
-@end example
-
-@noindent
-Thus, @samp{b} will be initialized with 2 first, then @samp{a} will be
-initialized with 1, regardless of how they're listed in the mem-initializer.
-
-@item Argument Matching
-
-In early 1993, the argument matching scheme in @sc{gnu} C++ changed
-significantly. The original code was completely replaced with a new
-method that will, hopefully, be easier to understand and make fixing
-specific cases much easier.
-
-The @samp{-fansi-overloading} option is used to enable the new code; at
-some point in the future, it will become the default behavior of the
-compiler.
-
-The file @file{cp-call.c} contains all of the new work, in the functions
-@code{rank_for_overload}, @code{compute_harshness},
-@code{compute_conversion_costs}, and @code{ideal_candidate}.
-
-Instead of using obscure numerical values, the quality of an argument
-match is now represented by clear, individual codes. The new data
-structure @code{struct harshness} (it used to be an @code{unsigned}
-number) contains:
-
-@enumerate a
-@item the @samp{code} field, to signify what was involved in matching two
-arguments;
-@item the @samp{distance} field, used in situations where inheritance
-decides which function should be called (one is ``closer'' than
-another);
-@item and the @samp{int_penalty} field, used by some codes as a tie-breaker.
-@end enumerate
-
-The @samp{code} field is a number with a given bit set for each type of
-code, OR'd together. The new codes are:
-
-@itemize @bullet
-@item @code{EVIL_CODE}
-The argument was not a permissible match.
-
-@item @code{CONST_CODE}
-Currently, this is only used by @code{compute_conversion_costs}, to
-distinguish when a non-@code{const} member function is called from a
-@code{const} member function.
-
-@item @code{ELLIPSIS_CODE}
-A match against an ellipsis @samp{...} is considered worse than all others.
-
-@item @code{USER_CODE}
-Used for a match involving a user-defined conversion.
-
-@item @code{STD_CODE}
-A match involving a standard conversion.
-
-@item @code{PROMO_CODE}
-A match involving an integral promotion. For these, the
-@code{int_penalty} field is used to handle the ARM's rule (XXX cite)
-that a smaller @code{unsigned} type should promote to a @code{int}, not
-to an @code{unsigned int}.
-
-@item @code{QUAL_CODE}
-Used to mark use of qualifiers like @code{const} and @code{volatile}.
-
-@item @code{TRIVIAL_CODE}
-Used for trivial conversions. The @samp{int_penalty} field is used by
-@code{convert_harshness} to communicate further penalty information back
-to @code{build_overload_call_real} when deciding which function should
-be call.
-@end itemize
-
-The functions @code{convert_to_aggr} and @code{build_method_call} use
-@code{compute_conversion_costs} to rate each argument's suitability for
-a given candidate function (that's how we get the list of candidates for
-@code{ideal_candidate}).
-
-@end itemize
-
-@node Glossary, Macros, Implementation Specifics, Top
-@section Glossary
-
-@table @r
-@item binfo
-The main data structure in the compiler used to represent the
-inheritance relationships between classes. The data in the binfo can be
-accessed by the BINFO_ accessor macros.
-
-@item vtable
-@itemx virtual function table
-
-The virtual function table holds information used in virtual function
-dispatching. In the compiler, they are usually referred to as vtables,
-or vtbls. The first index is not used in the normal way, I believe it
-is probably used for the virtual destructor.
-
-@item vfield
-
-vfields can be thought of as the base information needed to build
-vtables. For every vtable that exists for a class, there is a vfield.
-See also vtable and virtual function table pointer. When a type is used
-as a base class to another type, the virtual function table for the
-derived class can be based upon the vtable for the base class, just
-extended to include the additional virtual methods declared in the
-derived class. The virtual function table from a virtual base class is
-never reused in a derived class. @code{is_normal} depends upon this.
-
-@item virtual function table pointer
-
-These are @code{FIELD_DECL}s that are pointer types that point to
-vtables. See also vtable and vfield.
-@end table
-
-@node Macros, Typical Behavior, Glossary, Top
-@section Macros
-
-This section describes some of the macros used on trees. The list
-should be alphabetical. Eventually all macros should be documented
-here.
-
-@table @code
-@item BINFO_BASETYPES
-A vector of additional binfos for the types inherited by this basetype.
-The binfos are fully unshared (except for virtual bases, in which
-case the binfo structure is shared).
-
- If this basetype describes type D as inherited in C,
- and if the basetypes of D are E anf F,
- then this vector contains binfos for inheritance of E and F by C.
-
-Has values of:
-
- TREE_VECs
-
-
-@item BINFO_INHERITANCE_CHAIN
-Temporarily used to represent specific inheritances. It usually points
-to the binfo associated with the lesser derived type, but it can be
-reversed by reverse_path. For example:
-
-@example
- Z ZbY least derived
- |
- Y YbX
- |
- X Xb most derived
-
-TYPE_BINFO (X) == Xb
-BINFO_INHERITANCE_CHAIN (Xb) == YbX
-BINFO_INHERITANCE_CHAIN (Yb) == ZbY
-BINFO_INHERITANCE_CHAIN (Zb) == 0
-@end example
-
-Not sure is the above is really true, get_base_distance has is point
-towards the most derived type, opposite from above.
-
-Set by build_vbase_path, recursive_bounded_basetype_p,
-get_base_distance, lookup_field, lookup_fnfields, and reverse_path.
-
-What things can this be used on:
-
- TREE_VECs that are binfos
-
-
-@item BINFO_OFFSET
-The offset where this basetype appears in its containing type.
-BINFO_OFFSET slot holds the offset (in bytes) from the base of the
-complete object to the base of the part of the object that is allocated
-on behalf of this `type'. This is always 0 except when there is
-multiple inheritance.
-
-Used on TREE_VEC_ELTs of the binfos BINFO_BASETYPES (...) for example.
-
-
-@item BINFO_VIRTUALS
-A unique list of functions for the virtual function table. See also
-TYPE_BINFO_VIRTUALS.
-
-What things can this be used on:
-
- TREE_VECs that are binfos
-
-
-@item BINFO_VTABLE
-Used to find the VAR_DECL that is the virtual function table associated
-with this binfo. See also TYPE_BINFO_VTABLE. To get the virtual
-function table pointer, see CLASSTYPE_VFIELD.
-
-What things can this be used on:
-
- TREE_VECs that are binfos
-
-Has values of:
-
- VAR_DECLs that are virtual function tables
-
-
-@item BLOCK_SUPERCONTEXT
-In the outermost scope of each function, it points to the FUNCTION_DECL
-node. It aids in better DWARF support of inline functions.
-
-
-@item CLASSTYPE_TAGS
-CLASSTYPE_TAGS is a linked (via TREE_CHAIN) list of member classes of a
-class. TREE_PURPOSE is the name, TREE_VALUE is the type (pushclass scans
-these and calls pushtag on them.)
-
-finish_struct scans these to produce TYPE_DECLs to add to the
-TYPE_FIELDS of the type.
-
-It is expected that name found in the TREE_PURPOSE slot is unique,
-resolve_scope_to_name is one such place that depends upon this
-uniqueness.
-
-
-@item CLASSTYPE_METHOD_VEC
-The following is true after finish_struct has been called (on the
-class?) but not before. Before finish_struct is called, things are
-different to some extent. Contains a TREE_VEC of methods of the class.
-The TREE_VEC_LENGTH is the number of differently named methods plus one
-for the 0th entry. The 0th entry is always allocated, and reserved for
-ctors and dtors. If there are none, TREE_VEC_ELT(N,0) == NULL_TREE.
-Each entry of the TREE_VEC is a FUNCTION_DECL. For each FUNCTION_DECL,
-there is a DECL_CHAIN slot. If the FUNCTION_DECL is the last one with a
-given name, the DECL_CHAIN slot is NULL_TREE. Otherwise it is the next
-method that has the same name (but a different signature). It would
-seem that it is not true that because the DECL_CHAIN slot is used in
-this way, we cannot call pushdecl to put the method in the global scope
-(cause that would overwrite the TREE_CHAIN slot), because they use
-different _CHAINs. finish_struct_methods setups up one version of the
-TREE_CHAIN slots on the FUNCTION_DECLs.
-
-friends are kept in TREE_LISTs, so that there's no need to use their
-TREE_CHAIN slot for anything.
-
-Has values of:
-
- TREE_VECs
-
-
-@item CLASSTYPE_VFIELD
-Seems to be in the process of being renamed TYPE_VFIELD. Use on types
-to get the main virtual function table pointer. To get the virtual
-function table use BINFO_VTABLE (TYPE_BINFO ()).
-
-Has values of:
-
- FIELD_DECLs that are virtual function table pointers
-
-What things can this be used on:
-
- RECORD_TYPEs
-
-
-@item DECL_CLASS_CONTEXT
-Identifies the context that the _DECL was found in. For virtual function
-tables, it points to the type associated with the virtual function
-table. See also DECL_CONTEXT, DECL_FIELD_CONTEXT and DECL_FCONTEXT.
-
-The difference between this and DECL_CONTEXT, is that for virtuals
-functions like:
-
-@example
-struct A
-@{
- virtual int f ();
-@};
-
-struct B : A
-@{
- int f ();
-@};
-
-DECL_CONTEXT (A::f) == A
-DECL_CLASS_CONTEXT (A::f) == A
-
-DECL_CONTEXT (B::f) == A
-DECL_CLASS_CONTEXT (B::f) == B
-@end example
-
-Has values of:
-
- RECORD_TYPEs, or UNION_TYPEs
-
-What things can this be used on:
-
- TYPE_DECLs, _DECLs
-
-
-@item DECL_CONTEXT
-Identifies the context that the _DECL was found in. Can be used on
-virtual function tables to find the type associated with the virtual
-function table, but since they are FIELD_DECLs, DECL_FIELD_CONTEXT is a
-better access method. Internally the same as DECL_FIELD_CONTEXT, so
-don't us both. See also DECL_FIELD_CONTEXT, DECL_FCONTEXT and
-DECL_CLASS_CONTEXT.
-
-Has values of:
-
- RECORD_TYPEs
-
-
-What things can this be used on:
-
-@display
-VAR_DECLs that are virtual function tables
-_DECLs
-@end display
-
-
-@item DECL_FIELD_CONTEXT
-Identifies the context that the FIELD_DECL was found in. Internally the
-same as DECL_CONTEXT, so don't us both. See also DECL_CONTEXT,
-DECL_FCONTEXT and DECL_CLASS_CONTEXT.
-
-Has values of:
-
- RECORD_TYPEs
-
-What things can this be used on:
-
-@display
-FIELD_DECLs that are virtual function pointers
-FIELD_DECLs
-@end display
-
-
-@item DECL_NESTED_TYPENAME
-Holds the fully qualified type name. Example, Base::Derived.
-
-Has values of:
-
- IDENTIFIER_NODEs
-
-What things can this be used on:
-
- TYPE_DECLs
-
-
-@item DECL_NAME
-
-Has values of:
-
-@display
-0 for things that don't have names
-IDENTIFIER_NODEs for TYPE_DECLs
-@end display
-
-@item DECL_IGNORED_P
-A bit that can be set to inform the debug information output routines in
-the back-end that a certain _DECL node should be totally ignored.
-
-Used in cases where it is known that the debugging information will be
-output in another file, or where a sub-type is known not to be needed
-because the enclosing type is not needed.
-
-A compiler constructed virtual destructor in derived classes that do not
-define an explicit destructor that was defined explicit in a base class
-has this bit set as well. Also used on __FUNCTION__ and
-__PRETTY_FUNCTION__ to mark they are ``compiler generated.'' c-decl and
-c-lex.c both want DECL_IGNORED_P set for ``internally generated vars,''
-and ``user-invisible variable.''
-
-Functions built by the C++ front-end such as default destructors,
-virtual destructors and default constructors want to be marked that
-they are compiler generated, but unsure why.
-
-Currently, it is used in an absolute way in the C++ front-end, as an
-optimization, to tell the debug information output routines to not
-generate debugging information that will be output by another separately
-compiled file.
-
-
-@item DECL_VIRTUAL_P
-A flag used on FIELD_DECLs and VAR_DECLs. (Documentation in tree.h is
-wrong.) Used in VAR_DECLs to indicate that the variable is a vtable.
-It is also used in FIELD_DECLs for vtable pointers.
-
-What things can this be used on:
-
- FIELD_DECLs and VAR_DECLs
-
-
-@item DECL_VPARENT
-Used to point to the parent type of the vtable if there is one, else it
-is just the type associated with the vtable. Because of the sharing of
-virtual function tables that goes on, this slot is not very useful, and
-is in fact, not used in the compiler at all. It can be removed.
-
-What things can this be used on:
-
- VAR_DECLs that are virtual function tables
-
-Has values of:
-
- RECORD_TYPEs maybe UNION_TYPEs
-
-
-@item DECL_FCONTEXT
-Used to find the first baseclass in which this FIELD_DECL is defined.
-See also DECL_CONTEXT, DECL_FIELD_CONTEXT and DECL_CLASS_CONTEXT.
-
-How it is used:
-
- Used when writing out debugging information about vfield and
- vbase decls.
-
-What things can this be used on:
-
- FIELD_DECLs that are virtual function pointers
- FIELD_DECLs
-
-
-@item DECL_REFERENCE_SLOT
-Used to hold the initialize for the reference.
-
-What things can this be used on:
-
- PARM_DECLs and VAR_DECLs that have a reference type
-
-
-@item DECL_VINDEX
-Used for FUNCTION_DECLs in two different ways. Before the structure
-containing the FUNCTION_DECL is laid out, DECL_VINDEX may point to a
-FUNCTION_DECL in a base class which is the FUNCTION_DECL which this
-FUNCTION_DECL will replace as a virtual function. When the class is
-laid out, this pointer is changed to an INTEGER_CST node which is
-suitable to find an index into the virtual function table. See
-get_vtable_entry as to how one can find the right index into the virtual
-function table. The first index 0, of a virtual function table it not
-used in the normal way, so the first real index is 1.
-
-DECL_VINDEX may be a TREE_LIST, that would seem to be a list of
-overridden FUNCTION_DECLs. add_virtual_function has code to deal with
-this when it uses the variable base_fndecl_list, but it would seem that
-somehow, it is possible for the TREE_LIST to pursist until method_call,
-and it should not.
-
-
-What things can this be used on:
-
- FUNCTION_DECLs
-
-
-@item DECL_SOURCE_FILE
-Identifies what source file a particular declaration was found in.
-
-Has values of:
-
- "<built-in>" on TYPE_DECLs to mean the typedef is built in
-
-
-@item DECL_SOURCE_LINE
-Identifies what source line number in the source file the declaration
-was found at.
-
-Has values of:
-
-@display
-0 for an undefined label
-
-0 for TYPE_DECLs that are internally generated
-
-0 for FUNCTION_DECLs for functions generated by the compiler
- (not yet, but should be)
-
-0 for ``magic'' arguments to functions, that the user has no
- control over
-@end display
-
-
-@item TREE_USED
-
-Has values of:
-
- 0 for unused labels
-
-
-@item TREE_ADDRESSABLE
-A flag that is set for any type that has a constructor.
-
-
-@item TREE_COMPLEXITY
-They seem a kludge way to track recursion, poping, and pushing. They only
-appear in cp-decl.c and cp-decl2.c, so the are a good candidate for
-proper fixing, and removal.
-
-
-@item TREE_HAS_CONSTRUCTOR
-A flag to indicate when a CALL_EXPR represents a call to a constructor.
-If set, we know that the type of the object, is the complete type of the
-object, and that the value returned is nonnull. When used in this
-fashion, it is an optimization. Can also be used on SAVE_EXPRs to
-indicate when they are of fixed type and nonnull. Can also be used on
-INDIRECT_EXPRs on CALL_EXPRs that represent a call to a constructor.
-
-
-@item TREE_PRIVATE
-Set for FIELD_DECLs by finish_struct. But not uniformly set.
-
-The following routines do something with PRIVATE access:
-build_method_call, alter_access, finish_struct_methods,
-finish_struct, convert_to_aggr, CWriteLanguageDecl, CWriteLanguageType,
-CWriteUseObject, compute_access, lookup_field, dfs_pushdecl,
-GNU_xref_member, dbxout_type_fields, dbxout_type_method_1
-
-
-@item TREE_PROTECTED
-The following routines do something with PROTECTED access:
-build_method_call, alter_access, finish_struct, convert_to_aggr,
-CWriteLanguageDecl, CWriteLanguageType, CWriteUseObject,
-compute_access, lookup_field, GNU_xref_member, dbxout_type_fields,
-dbxout_type_method_1
-
-
-@item TYPE_BINFO
-Used to get the binfo for the type.
-
-Has values of:
-
- TREE_VECs that are binfos
-
-What things can this be used on:
-
- RECORD_TYPEs
-
-
-@item TYPE_BINFO_BASETYPES
-See also BINFO_BASETYPES.
-
-@item TYPE_BINFO_VIRTUALS
-A unique list of functions for the virtual function table. See also
-BINFO_VIRTUALS.
-
-What things can this be used on:
-
- RECORD_TYPEs
-
-
-@item TYPE_BINFO_VTABLE
-Points to the virtual function table associated with the given type.
-See also BINFO_VTABLE.
-
-What things can this be used on:
-
- RECORD_TYPEs
-
-Has values of:
-
- VAR_DECLs that are virtual function tables
-
-
-@item TYPE_NAME
-Names the type.
-
-Has values of:
-
-@display
-0 for things that don't have names.
-should be IDENTIFIER_NODE for RECORD_TYPEs UNION_TYPEs and
- ENUM_TYPEs.
-TYPE_DECL for RECORD_TYPEs, UNION_TYPEs and ENUM_TYPEs, but
- shouldn't be.
-TYPE_DECL for typedefs, unsure why.
-@end display
-
-What things can one use this on:
-
-@display
-TYPE_DECLs
-RECORD_TYPEs
-UNION_TYPEs
-ENUM_TYPEs
-@end display
-
-History:
-
- It currently points to the TYPE_DECL for RECORD_TYPEs,
- UNION_TYPEs and ENUM_TYPEs, but it should be history soon.
-
-
-@item TYPE_METHODS
-Synonym for @code{CLASSTYPE_METHOD_VEC}. Chained together with
-@code{TREE_CHAIN}. @file{dbxout.c} uses this to get at the methods of a
-class.
-
-
-@item TYPE_DECL
-Used to represent typedefs, and used to represent bindings layers.
-
-Components:
-
- DECL_NAME is the name of the typedef. For example, foo would
- be found in the DECL_NAME slot when @code{typedef int foo;} is
- seen.
-
- DECL_SOURCE_LINE identifies what source line number in the
- source file the declaration was found at. A value of 0
- indicates that this TYPE_DECL is just an internal binding layer
- marker, and does not correspond to a user supplied typedef.
-
- DECL_SOURCE_FILE
-
-@item TYPE_FIELDS
-A linked list (via @code{TREE_CHAIN}) of member types of a class. The
-list can contain @code{TYPE_DECL}s, but there can also be other things
-in the list apparently. See also @code{CLASSTYPE_TAGS}.
-
-
-@item TYPE_VIRTUAL_P
-A flag used on a @code{FIELD_DECL} or a @code{VAR_DECL}, indicates it is
-a virtual function table or a pointer to one. When used on a
-@code{FUNCTION_DECL}, indicates that it is a virtual function. When
-used on an @code{IDENTIFIER_NODE}, indicates that a function with this
-same name exists and has been declared virtual.
-
-When used on types, it indicates that the type has virtual functions, or
-is derived from one that does.
-
-Not sure if the above about virtual function tables is still true. See
-also info on @code{DECL_VIRTUAL_P}.
-
-What things can this be used on:
-
- FIELD_DECLs, VAR_DECLs, FUNCTION_DECLs, IDENTIFIER_NODEs
-
-
-@item VF_BASETYPE_VALUE
-Get the associated type from the binfo that caused the given vfield to
-exist. This is the least derived class (the most parent class) that
-needed a virtual function table. It is probably the case that all uses
-of this field are misguided, but they need to be examined on a
-case-by-case basis. See history for more information on why the
-previous statement was made.
-
-Set at @code{finish_base_struct} time.
-
-What things can this be used on:
-
- TREE_LISTs that are vfields
-
-History:
-
- This field was used to determine if a virtual function table's
- slot should be filled in with a certain virtual function, by
- checking to see if the type returned by VF_BASETYPE_VALUE was a
- parent of the context in which the old virtual function existed.
- This incorrectly assumes that a given type _could_ not appear as
- a parent twice in a given inheritance lattice. For single
- inheritance, this would in fact work, because a type could not
- possibly appear more than once in an inheritance lattice, but
- with multiple inheritance, a type can appear more than once.
-
-
-@item VF_BINFO_VALUE
-Identifies the binfo that caused this vfield to exist. If this vfield
-is from the first direct base class that has a virtual function table,
-then VF_BINFO_VALUE is NULL_TREE, otherwise it will be the binfo of the
-direct base where the vfield came from. Can use @code{TREE_VIA_VIRTUAL}
-on result to find out if it is a virtual base class. Related to the
-binfo found by
-
-@example
-get_binfo (VF_BASETYPE_VALUE (vfield), t, 0)
-@end example
-
-@noindent
-where @samp{t} is the type that has the given vfield.
-
-@example
-get_binfo (VF_BASETYPE_VALUE (vfield), t, 0)
-@end example
-
-@noindent
-will return the binfo for the the given vfield.
-
-May or may not be set at @code{modify_vtable_entries} time. Set at
-@code{finish_base_struct} time.
-
-What things can this be used on:
-
- TREE_LISTs that are vfields
-
-
-@item VF_DERIVED_VALUE
-Identifies the type of the most derived class of the vfield, excluding
-the the class this vfield is for.
-
-Set at @code{finish_base_struct} time.
-
-What things can this be used on:
-
- TREE_LISTs that are vfields
-
-
-@item VF_NORMAL_VALUE
-Identifies the type of the most derived class of the vfield, including
-the class this vfield is for.
-
-Set at @code{finish_base_struct} time.
-
-What things can this be used on:
-
- TREE_LISTs that are vfields
-
-
-@item WRITABLE_VTABLES
-This is a option that can be defined when building the compiler, that
-will cause the compiler to output vtables into the data segment so that
-the vtables maybe written. This is undefined by default, because
-normally the vtables should be unwritable. People that implement object
-I/O facilities may, or people that want to change the dynamic type of
-objects may want to have the vtables writable. Another way of achieving
-this would be to make a copy of the vtable into writable memory, but the
-drawback there is that that method only changes the type for one object.
-
-@end table
-
-@node Typical Behavior, Coding Conventions, Macros, Top
-@section Typical Behavior
-
-@cindex parse errors
-
-Whenever seemingly normal code fails with errors like
-@code{syntax error at `\@{'}, it's highly likely that grokdeclarator is
-returning a NULL_TREE for whatever reason.
-
-@node Coding Conventions, Templates, Typical Behavior, Top
-@section Coding Conventions
-
-It should never be that case that trees are modified in-place by the
-back-end, @emph{unless} it is guaranteed that the semantics are the same
-no matter how shared the tree structure is. @file{fold-const.c} still
-has some cases where this is not true, but rms hypothesizes that this
-will never be a problem.
-
-@node Templates, Access Control, Coding Conventions, Top
-@section Templates
-
-A template is represented by a @code{TEMPLATE_DECL}. The specific
-fields used are:
-
-@table @code
-@item DECL_TEMPLATE_RESULT
-The generic decl on which instantiations are based. This looks just
-like any other decl.
-
-@item DECL_TEMPLATE_PARMS
-The parameters to this template.
-@end table
-
-The generic decl is parsed as much like any other decl as possible,
-given the parameterization. The template decl is not built up until the
-generic decl has been completed. For template classes, a template decl
-is generated for each member function and static data member, as well.
-
-Template members of template classes are represented by a TEMPLATE_DECL
-for the class' parameters around another TEMPLATE_DECL for the member's
-parameters.
-
-All declarations that are instantiations or specializations of templates
-refer to their template and parameters through DECL_TEMPLATE_INFO.
-
-How should I handle parsing member functions with the proper param
-decls? Set them up again or try to use the same ones? Currently we do
-the former. We can probably do this without any extra machinery in
-store_pending_inline, by deducing the parameters from the decl in
-do_pending_inlines. PRE_PARSED_TEMPLATE_DECL?
-
-If a base is a parm, we can't check anything about it. If a base is not
-a parm, we need to check it for name binding. Do finish_base_struct if
-no bases are parameterized (only if none, including indirect, are
-parms). Nah, don't bother trying to do any of this until instantiation
--- we only need to do name binding in advance.
-
-Always set up method vec and fields, inc. synthesized methods. Really?
-We can't know the types of the copy folks, or whether we need a
-destructor, or can have a default ctor, until we know our bases and
-fields. Otherwise, we can assume and fix ourselves later. Hopefully.
-
-@node Access Control, Error Reporting, Templates, Top
-@section Access Control
-The function compute_access returns one of three values:
-
-@table @code
-@item access_public
-means that the field can be accessed by the current lexical scope.
-
-@item access_protected
-means that the field cannot be accessed by the current lexical scope
-because it is protected.
-
-@item access_private
-means that the field cannot be accessed by the current lexical scope
-because it is private.
-@end table
-
-DECL_ACCESS is used for access declarations; alter_access creates a list
-of types and accesses for a given decl.
-
-Formerly, DECL_@{PUBLIC,PROTECTED,PRIVATE@} corresponded to the return
-codes of compute_access and were used as a cache for compute_access.
-Now they are not used at all.
-
-TREE_PROTECTED and TREE_PRIVATE are used to record the access levels
-granted by the containing class. BEWARE: TREE_PUBLIC means something
-completely unrelated to access control!
-
-@node Error Reporting, Parser, Access Control, Top
-@section Error Reporting
-
-The C++ front-end uses a call-back mechanism to allow functions to print
-out reasonable strings for types and functions without putting extra
-logic in the functions where errors are found. The interface is through
-the @code{cp_error} function (or @code{cp_warning}, etc.). The
-syntax is exactly like that of @code{error}, except that a few more
-conversions are supported:
-
-@itemize @bullet
-@item
-%C indicates a value of `enum tree_code'.
-@item
-%D indicates a *_DECL node.
-@item
-%E indicates a *_EXPR node.
-@item
-%L indicates a value of `enum languages'.
-@item
-%P indicates the name of a parameter (i.e. "this", "1", "2", ...)
-@item
-%T indicates a *_TYPE node.
-@item
-%O indicates the name of an operator (MODIFY_EXPR -> "operator =").
-
-@end itemize
-
-There is some overlap between these; for instance, any of the node
-options can be used for printing an identifier (though only @code{%D}
-tries to decipher function names).
-
-For a more verbose message (@code{class foo} as opposed to just @code{foo},
-including the return type for functions), use @code{%#c}.
-To have the line number on the error message indicate the line of the
-DECL, use @code{cp_error_at} and its ilk; to indicate which argument you want,
-use @code{%+D}, or it will default to the first.
-
-@node Parser, Copying Objects, Error Reporting, Top
-@section Parser
-
-Some comments on the parser:
-
-The @code{after_type_declarator} / @code{notype_declarator} hack is
-necessary in order to allow redeclarations of @code{TYPENAME}s, for
-instance
-
-@example
-typedef int foo;
-class A @{
- char *foo;
-@};
-@end example
-
-In the above, the first @code{foo} is parsed as a @code{notype_declarator},
-and the second as a @code{after_type_declarator}.
-
-Ambiguities:
-
-There are currently four reduce/reduce ambiguities in the parser. They are:
-
-1) Between @code{template_parm} and
-@code{named_class_head_sans_basetype}, for the tokens @code{aggr
-identifier}. This situation occurs in code looking like
-
-@example
-template <class T> class A @{ @};
-@end example
-
-It is ambiguous whether @code{class T} should be parsed as the
-declaration of a template type parameter named @code{T} or an unnamed
-constant parameter of type @code{class T}. Section 14.6, paragraph 3 of
-the January '94 working paper states that the first interpretation is
-the correct one. This ambiguity results in two reduce/reduce conflicts.
-
-2) Between @code{primary} and @code{type_id} for code like @samp{int()}
-in places where both can be accepted, such as the argument to
-@code{sizeof}. Section 8.1 of the pre-San Diego working paper specifies
-that these ambiguous constructs will be interpreted as @code{typename}s.
-This ambiguity results in six reduce/reduce conflicts between
-@samp{absdcl} and @samp{functional_cast}.
-
-3) Between @code{functional_cast} and
-@code{complex_direct_notype_declarator}, for various token strings.
-This situation occurs in code looking like
-
-@example
-int (*a);
-@end example
-
-This code is ambiguous; it could be a declaration of the variable
-@samp{a} as a pointer to @samp{int}, or it could be a functional cast of
-@samp{*a} to @samp{int}. Section 6.8 specifies that the former
-interpretation is correct. This ambiguity results in 7 reduce/reduce
-conflicts. Another aspect of this ambiguity is code like 'int (x[2]);',
-which is resolved at the '[' and accounts for 6 reduce/reduce conflicts
-between @samp{direct_notype_declarator} and
-@samp{primary}/@samp{overqualified_id}. Finally, there are 4 r/r
-conflicts between @samp{expr_or_declarator} and @samp{primary} over code
-like 'int (a);', which could probably be resolved but would also
-probably be more trouble than it's worth. In all, this situation
-accounts for 17 conflicts. Ack!
-
-The second case above is responsible for the failure to parse 'LinppFile
-ppfile (String (argv[1]), &outs, argc, argv);' (from Rogue Wave
-Math.h++) as an object declaration, and must be fixed so that it does
-not resolve until later.
-
-4) Indirectly between @code{after_type_declarator} and @code{parm}, for
-type names. This occurs in (as one example) code like
-
-@example
-typedef int foo, bar;
-class A @{
- foo (bar);
-@};
-@end example
-
-What is @code{bar} inside the class definition? We currently interpret
-it as a @code{parm}, as does Cfront, but IBM xlC interprets it as an
-@code{after_type_declarator}. I believe that xlC is correct, in light
-of 7.1p2, which says "The longest sequence of @i{decl-specifiers} that
-could possibly be a type name is taken as the @i{decl-specifier-seq} of
-a @i{declaration}." However, it seems clear that this rule must be
-violated in the case of constructors. This ambiguity accounts for 8
-conflicts.
-
-Unlike the others, this ambiguity is not recognized by the Working Paper.
-
-@node Copying Objects, Exception Handling, Parser, Top
-@section Copying Objects
-
-The generated copy assignment operator in g++ does not currently do the
-right thing for multiple inheritance involving virtual bases; it just
-calls the copy assignment operators for its direct bases. What it
-should probably do is:
-
-1) Split up the copy assignment operator for all classes that have
-vbases into "copy my vbases" and "copy everything else" parts. Or do
-the trickiness that the constructors do to ensure that vbases don't get
-initialized by intermediate bases.
-
-2) Wander through the class lattice, find all vbases for which no
-intermediate base has a user-defined copy assignment operator, and call
-their "copy everything else" routines. If not all of my vbases satisfy
-this criterion, warn, because this may be surprising behavior.
-
-3) Call the "copy everything else" routine for my direct bases.
-
-If we only have one direct base, we can just foist everything off onto
-them.
-
-This issue is currently under discussion in the core reflector
-(2/28/94).
-
-@node Exception Handling, Free Store, Copying Objects, Top
-@section Exception Handling
-
-Note, exception handling in g++ is still under development.
-
-This section describes the mapping of C++ exceptions in the C++
-front-end, into the back-end exception handling framework.
-
-The basic mechanism of exception handling in the back-end is
-unwind-protect a la elisp. This is a general, robust, and language
-independent representation for exceptions.
-
-The C++ front-end exceptions are mapping into the unwind-protect
-semantics by the C++ front-end. The mapping is describe below.
-
-When -frtti is used, rtti is used to do exception object type checking,
-when it isn't used, the encoded name for the type of the object being
-thrown is used instead. All code that originates exceptions, even code
-that throws exceptions as a side effect, like dynamic casting, and all
-code that catches exceptions must be compiled with either -frtti, or
--fno-rtti. It is not possible to mix rtti base exception handling
-objects with code that doesn't use rtti. The exceptions to this, are
-code that doesn't catch or throw exceptions, catch (...), and code that
-just rethrows an exception.
-
-Currently we use the normal mangling used in building functions names
-(int's are "i", const char * is PCc) to build the non-rtti base type
-descriptors for exception handling. These descriptors are just plain
-NULL terminated strings, and internally they are passed around as char
-*.
-
-In C++, all cleanups should be protected by exception regions. The
-region starts just after the reason why the cleanup is created has
-ended. For example, with an automatic variable, that has a constructor,
-it would be right after the constructor is run. The region ends just
-before the finalization is expanded. Since the backend may expand the
-cleanup multiple times along different paths, once for normal end of the
-region, once for non-local gotos, once for returns, etc, the backend
-must take special care to protect the finalization expansion, if the
-expansion is for any other reason than normal region end, and it is
-`inline' (it is inside the exception region). The backend can either
-choose to move them out of line, or it can created an exception region
-over the finalization to protect it, and in the handler associated with
-it, it would not run the finalization as it otherwise would have, but
-rather just rethrow to the outer handler, careful to skip the normal
-handler for the original region.
-
-In Ada, they will use the more runtime intensive approach of having
-fewer regions, but at the cost of additional work at run time, to keep a
-list of things that need cleanups. When a variable has finished
-construction, they add the cleanup to the list, when the come to the end
-of the lifetime of the variable, the run the list down. If the take a
-hit before the section finishes normally, they examine the list for
-actions to perform. I hope they add this logic into the back-end, as it
-would be nice to get that alternative approach in C++.
-
-On an rs6000, xlC stores exception objects on that stack, under the try
-block. When is unwinds down into a handler, the frame pointer is
-adjusted back to the normal value for the frame in which the handler
-resides, and the stack pointer is left unchanged from the time at which
-the object was thrown. This is so that there is always someplace for
-the exception object, and nothing can overwrite it, once we start
-throwing. The only bad part, is that the stack remains large.
-
-The below points out some things that work in g++'s exception handling.
-
-All completely constructed temps and local variables are cleaned up in
-all unwinded scopes. Completely constructed parts of partially
-constructed objects are cleaned up. This includes partially built
-arrays. Exception specifications are now handled. Thrown objects are
-now cleaned up all the time. We can now tell if we have an active
-exception being thrown or not (__eh_type != 0). We use this to call
-terminate if someone does a throw; without there being an active
-exception object. uncaught_exception () works.
-
-The below points out some flaws in g++'s exception handling, as it now
-stands.
-
-Only exact type matching or reference matching of throw types works when
--fno-rtti is used. Only works on a SPARC (like Suns), SPARClite, i386,
-arm, rs6000, PowerPC, Alpha, mips, VAX, m68k and z8k machines. Partial
-support is in for all other machines, but a stack unwinder called
-__unwind_function has to be written, and added to libgcc2 for them. The
-new EH code doesn't rely upon the __unwind_function for C++ code,
-instead it creates per function unwinders right inside the function,
-unfortunately, on many platforms the definition of RETURN_ADDR_RTX in
-the tm.h file for the machine port is wrong. The HPPA has a brain dead
-abi that prevents exception handling from just working. See below for
-details on __unwind_function. Don't expect exception handling to work
-right if you optimize, in fact the compiler will probably core dump.
-RTL_EXPRs for EH cond variables for && and || exprs should probably be
-wrapped in UNSAVE_EXPRs, and RTL_EXPRs tweaked so that they can be
-unsaved, and the UNSAVE_EXPR code should be in the backend, or
-alternatively, UNSAVE_EXPR should be ripped out and exactly one
-finalization allowed to be expanded by the backend. I talked with
-kenner about this, and we have to allow multiple expansions.
-
-We only do pointer conversions on exception matching a la 15.3 p2 case
-3: `A handler with type T, const T, T&, or const T& is a match for a
-throw-expression with an object of type E if [3]T is a pointer type and
-E is a pointer type that can be converted to T by a standard pointer
-conversion (_conv.ptr_) not involving conversions to pointers to private
-or protected base classes.' when -frtti is given.
-
-We don't call delete on new expressions that die because the ctor threw
-an exception. See except/18 for a test case.
-
-15.2 para 13: The exception being handled should be rethrown if control
-reaches the end of a handler of the function-try-block of a constructor
-or destructor, right now, it is not.
-
-15.2 para 12: If a return statement appears in a handler of
-function-try-block of a constructor, the program is ill-formed, but this
-isn't diagnosed.
-
-15.2 para 11: If the handlers of a function-try-block contain a jump
-into the body of a constructor or destructor, the program is ill-formed,
-but this isn't diagnosed.
-
-15.2 para 9: Check that the fully constructed base classes and members
-of an object are destroyed before entering the handler of a
-function-try-block of a constructor or destructor for that object.
-
-build_exception_variant should sort the incoming list, so that it
-implements set compares, not exact list equality. Type smashing should
-smash exception specifications using set union.
-
-Thrown objects are usually allocated on the heap, in the usual way. If
-one runs out of heap space, throwing an object will probably never work.
-This could be relaxed some by passing an __in_chrg parameter to track
-who has control over the exception object. Thrown objects are not
-allocated on the heap when they are pointer to object types. We should
-extend it so that all small (<4*sizeof(void*)) objects are stored
-directly, instead of allocated on the heap.
-
-When the backend returns a value, it can create new exception regions
-that need protecting. The new region should rethrow the object in
-context of the last associated cleanup that ran to completion.
-
-The structure of the code that is generated for C++ exception handling
-code is shown below:
-
-@example
-Ln: throw value;
- copy value onto heap
- jump throw (Ln, id, address of copy of value on heap)
-
- try @{
-+Lstart: the start of the main EH region
-|... ...
-+Lend: the end of the main EH region
- @} catch (T o) @{
- ...1
- @}
-Lresume:
- nop used to make sure there is something before
- the next region ends, if there is one
-... ...
-
- jump Ldone
-[
-Lmainhandler: handler for the region Lstart-Lend
- cleanup
-] zero or more, depending upon automatic vars with dtors
-+Lpartial:
-| jump Lover
-+Lhere:
- rethrow (Lhere, same id, same obj);
-Lterm: handler for the region Lpartial-Lhere
- call terminate
-Lover:
-[
- [
- call throw_type_match
- if (eq) @{
- ] these lines disappear when there is no catch condition
-+Lsregion2:
-| ...1
-| jump Lresume
-|Lhandler: handler for the region Lsregion2-Leregion2
-| rethrow (Lresume, same id, same obj);
-+Leregion2
- @}
-] there are zero or more of these sections, depending upon how many
- catch clauses there are
------------------------------ expand_end_all_catch --------------------------
- here we have fallen off the end of all catch
- clauses, so we rethrow to outer
- rethrow (Lresume, same id, same obj);
------------------------------ expand_end_all_catch --------------------------
-[
-L1: maybe throw routine
-] depending upon if we have expanded it or not
-Ldone:
- ret
-
-start_all_catch emits labels: Lresume,
-
-@end example
-
-The __unwind_function takes a pointer to the throw handler, and is
-expected to pop the stack frame that was built to call it, as well as
-the frame underneath and then jump to the throw handler. It must
-restore all registers to their proper values as well as all other
-machine state as determined by the context in which we are unwinding
-into. The way I normally start is to compile:
-
- void *g;
- foo(void* a) @{ g = a; @}
-
-with -S, and change the thing that alters the PC (return, or ret
-usually) to not alter the PC, making sure to leave all other semantics
-(like adjusting the stack pointer, or frame pointers) in. After that,
-replicate the prologue once more at the end, again, changing the PC
-altering instructions, and finally, at the very end, jump to `g'.
-
-It takes about a week to write this routine, if someone wants to
-volunteer to write this routine for any architecture, exception support
-for that architecture will be added to g++. Please send in those code
-donations. One other thing that needs to be done, is to double check
-that __builtin_return_address (0) works.
-
-@subsection Specific Targets
-
-For the alpha, the __unwind_function will be something resembling:
-
-@example
-void
-__unwind_function(void *ptr)
-@{
- /* First frame */
- asm ("ldq $15, 8($30)"); /* get the saved frame ptr; 15 is fp, 30 is sp */
- asm ("bis $15, $15, $30"); /* reload sp with the fp we found */
-
- /* Second frame */
- asm ("ldq $15, 8($30)"); /* fp */
- asm ("bis $15, $15, $30"); /* reload sp with the fp we found */
-
- /* Return */
- asm ("ret $31, ($16), 1"); /* return to PTR, stored in a0 */
-@}
-@end example
-
-@noindent
-However, there are a few problems preventing it from working. First of
-all, the gcc-internal function @code{__builtin_return_address} needs to
-work given an argument of 0 for the alpha. As it stands as of August
-30th, 1995, the code for @code{BUILT_IN_RETURN_ADDRESS} in @file{expr.c}
-will definitely not work on the alpha. Instead, we need to define
-the macros @code{DYNAMIC_CHAIN_ADDRESS} (maybe),
-@code{RETURN_ADDR_IN_PREVIOUS_FRAME}, and definitely need a new
-definition for @code{RETURN_ADDR_RTX}.
-
-In addition (and more importantly), we need a way to reliably find the
-frame pointer on the alpha. The use of the value 8 above to restore the
-frame pointer (register 15) is incorrect. On many systems, the frame
-pointer is consistently offset to a specific point on the stack. On the
-alpha, however, the frame pointer is pushed last. First the return
-address is stored, then any other registers are saved (e.g., @code{s0}),
-and finally the frame pointer is put in place. So @code{fp} could have
-an offset of 8, but if the calling function saved any registers at all,
-they add to the offset.
-
-The only places the frame size is noted are with the @samp{.frame}
-directive, for use by the debugger and the OSF exception handling model
-(useless to us), and in the initial computation of the new value for
-@code{sp}, the stack pointer. For example, the function may start with:
-
-@example
-lda $30,-32($30)
-.frame $15,32,$26,0
-@end example
-
-@noindent
-The 32 above is exactly the value we need. With this, we can be sure
-that the frame pointer is stored 8 bytes less---in this case, at 24(sp)).
-The drawback is that there is no way that I (Brendan) have found to let
-us discover the size of a previous frame @emph{inside} the definition
-of @code{__unwind_function}.
-
-So to accomplish exception handling support on the alpha, we need two
-things: first, a way to figure out where the frame pointer was stored,
-and second, a functional @code{__builtin_return_address} implementation
-for except.c to be able to use it.
-
-@subsection Backend Exception Support
-
-The backend must be extended to fully support exceptions. Right now
-there are a few hooks into the alpha exception handling backend that
-resides in the C++ frontend from that backend that allows exception
-handling to work in g++. An exception region is a segment of generated
-code that has a handler associated with it. The exception regions are
-denoted in the generated code as address ranges denoted by a starting PC
-value and an ending PC value of the region. Some of the limitations
-with this scheme are:
-
-@itemize @bullet
-@item
-The backend replicates insns for such things as loop unrolling and
-function inlining. Right now, there are no hooks into the frontend's
-exception handling backend to handle the replication of insns. When
-replication happens, a new exception region descriptor needs to be
-generated for the new region.
-
-@item
-The backend expects to be able to rearrange code, for things like jump
-optimization. Any rearranging of the code needs have exception region
-descriptors updated appropriately.
-
-@item
-The backend can eliminate dead code. Any associated exception region
-descriptor that refers to fully contained code that has been eliminated
-should also be removed, although not doing this is harmless in terms of
-semantics.
-
-@end itemize
-
-The above is not meant to be exhaustive, but does include all things I
-have thought of so far. I am sure other limitations exist.
-
-Below are some notes on the migration of the exception handling code
-backend from the C++ frontend to the backend.
-
-NOTEs are to be used to denote the start of an exception region, and the
-end of the region. I presume that the interface used to generate these
-notes in the backend would be two functions, start_exception_region and
-end_exception_region (or something like that). The frontends are
-required to call them in pairs. When marking the end of a region, an
-argument can be passed to indicate the handler for the marked region.
-This can be passed in many ways, currently a tree is used. Another
-possibility would be insns for the handler, or a label that denotes a
-handler. I have a feeling insns might be the the best way to pass it.
-Semantics are, if an exception is thrown inside the region, control is
-transfered unconditionally to the handler. If control passes through
-the handler, then the backend is to rethrow the exception, in the
-context of the end of the original region. The handler is protected by
-the conventional mechanisms; it is the frontend's responsibility to
-protect the handler, if special semantics are required.
-
-This is a very low level view, and it would be nice is the backend
-supported a somewhat higher level view in addition to this view. This
-higher level could include source line number, name of the source file,
-name of the language that threw the exception and possibly the name of
-the exception. Kenner may want to rope you into doing more than just
-the basics required by C++. You will have to resolve this. He may want
-you to do support for non-local gotos, first scan for exception handler,
-if none is found, allow the debugger to be entered, without any cleanups
-being done. To do this, the backend would have to know the difference
-between a cleanup-rethrower, and a real handler, if would also have to
-have a way to know if a handler `matches' a thrown exception, and this
-is frontend specific.
-
-The stack unwinder is one of the hardest parts to do. It is highly
-machine dependent. The form that kenner seems to like was a couple of
-macros, that would do the machine dependent grunt work. One preexisting
-function that might be of some use is __builtin_return_address (). One
-macro he seemed to want was __builtin_return_address, and the other
-would do the hard work of fixing up the registers, adjusting the stack
-pointer, frame pointer, arg pointer and so on.
-
-
-@node Free Store, Concept Index, Exception Handling, Top
-@section Free Store
-
-@code{operator new []} adds a magic cookie to the beginning of arrays
-for which the number of elements will be needed by @code{operator delete
-[]}. These are arrays of objects with destructors and arrays of objects
-that define @code{operator delete []} with the optional size_t argument.
-This cookie can be examined from a program as follows:
-
-@example
-typedef unsigned long size_t;
-extern "C" int printf (const char *, ...);
-
-size_t nelts (void *p)
-@{
- struct cookie @{
- size_t nelts __attribute__ ((aligned (sizeof (double))));
- @};
-
- cookie *cp = (cookie *)p;
- --cp;
-
- return cp->nelts;
-@}
-
-struct A @{
- ~A() @{ @}
-@};
-
-main()
-@{
- A *ap = new A[3];
- printf ("%ld\n", nelts (ap));
-@}
-@end example
-
-@section Linkage
-The linkage code in g++ is horribly twisted in order to meet two design goals:
-
-1) Avoid unnecessary emission of inlines and vtables.
-
-2) Support pedantic assemblers like the one in AIX.
-
-To meet the first goal, we defer emission of inlines and vtables until
-the end of the translation unit, where we can decide whether or not they
-are needed, and how to emit them if they are.
-
-@node Concept Index, , Free Store, Top
-@section Concept Index
-
-@printindex cp
-
-@bye
diff --git a/gcc/cp/hash.h b/gcc/cp/hash.h
deleted file mode 100644
index d3f6be7330d..00000000000
--- a/gcc/cp/hash.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/* C code produced by gperf version 2.5 (GNU C++ version) */
-/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,7,$ ../../../devo/gcc/cp/gxx.gperf */
-/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */
-struct resword { char *name; short token; enum rid rid;};
-
-#define TOTAL_KEYWORDS 97
-#define MIN_WORD_LENGTH 2
-#define MAX_WORD_LENGTH 16
-#define MIN_HASH_VALUE 4
-#define MAX_HASH_VALUE 202
-/* maximum key range = 199, duplicates = 0 */
-
-#ifdef __GNUC__
-inline
-#endif
-static unsigned int
-hash (str, len)
- register char *str;
- register int unsigned len;
-{
- static unsigned char asso_values[] =
- {
- 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 0, 203, 29, 22, 32,
- 35, 0, 73, 8, 19, 48, 203, 0, 7, 15,
- 11, 66, 9, 11, 19, 58, 1, 7, 83, 21,
- 89, 5, 203, 203, 203, 203, 203, 203,
- };
- register int hval = len;
-
- switch (hval)
- {
- default:
- case 7:
- hval += asso_values[str[6]];
- case 6:
- case 5:
- case 4:
- hval += asso_values[str[3]];
- case 3:
- case 2:
- case 1:
- hval += asso_values[str[0]];
- break;
- }
- return hval + asso_values[str[len - 1]];
-}
-
-#ifdef __GNUC__
-inline
-#endif
-struct resword *
-is_reserved_word (str, len)
- register char *str;
- register unsigned int len;
-{
- static struct resword wordlist[] =
- {
- {"",}, {"",}, {"",}, {"",},
- {"else", ELSE, NORID,},
- {"true", CXX_TRUE, NORID,},
- {"",}, {"",}, {"",},
- {"try", TRY, NORID,},
- {"",}, {"",}, {"",}, {"",}, {"",},
- {"not", '!', NORID,},
- {"",},
- {"extern", SCSPEC, RID_EXTERN,},
- {"",},
- {"template", TEMPLATE, RID_TEMPLATE,},
- {"__null", CONSTANT, RID_NULL},
- {"",}, {"",}, {"",},
- {"typename", TYPENAME_KEYWORD, NORID,},
- {"",}, {"",},
- {"long", TYPESPEC, RID_LONG,},
- {"not_eq", EQCOMPARE, NORID,},
- {"__alignof__", ALIGNOF, NORID},
- {"__inline", SCSPEC, RID_INLINE},
- {"using", USING, NORID,},
- {"__inline__", SCSPEC, RID_INLINE},
- {"while", WHILE, NORID,},
- {"enum", ENUM, NORID,},
- {"new", NEW, NORID,},
- {"case", CASE, NORID,},
- {"",}, {"",}, {"",},
- {"bool", TYPESPEC, RID_BOOL,},
- {"delete", DELETE, NORID,},
- {"typeid", TYPEID, NORID,},
- {"return", RETURN, NORID,},
- {"",},
- {"__label__", LABEL, NORID},
- {"and_eq", ASSIGN, NORID,},
- {"asm", ASM_KEYWORD, NORID,},
- {"continue", CONTINUE, NORID,},
- {"namespace", NAMESPACE, NORID,},
- {"",},
- {"mutable", SCSPEC, RID_MUTABLE,},
- {"int", TYPESPEC, RID_INT,},
- {"compl", '~', NORID,},
- {"public", VISSPEC, RID_PUBLIC,},
- {"protected", VISSPEC, RID_PROTECTED,},
- {"break", BREAK, NORID,},
- {"",},
- {"__signed__", TYPESPEC, RID_SIGNED},
- {"",},
- {"__attribute", ATTRIBUTE, NORID},
- {"__wchar_t", TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */,},
- {"__attribute__", ATTRIBUTE, NORID},
- {"double", TYPESPEC, RID_DOUBLE,},
- {"explicit", SCSPEC, RID_EXPLICIT,},
- {"__asm__", GCC_ASM_KEYWORD, NORID},
- {"reinterpret_cast", REINTERPRET_CAST, NORID,},
- {"and", ANDAND, NORID,},
- {"",}, {"",}, {"",},
- {"static_cast", STATIC_CAST, NORID,},
- {"struct", AGGR, RID_RECORD,},
- {"default", DEFAULT, NORID,},
- {"char", TYPESPEC, RID_CHAR,},
- {"__const", CV_QUALIFIER, RID_CONST},
- {"__const__", CV_QUALIFIER, RID_CONST},
- {"__volatile", CV_QUALIFIER, RID_VOLATILE},
- {"__asm", GCC_ASM_KEYWORD, NORID},
- {"__volatile__", CV_QUALIFIER, RID_VOLATILE},
- {"typeof", TYPEOF, NORID,},
- {"__typeof__", TYPEOF, NORID},
- {"or_eq", ASSIGN, NORID,},
- {"short", TYPESPEC, RID_SHORT,},
- {"switch", SWITCH, NORID,},
- {"signature", AGGR, RID_SIGNATURE /* Extension */,},
- {"",},
- {"or", OROR, NORID,},
- {"catch", CATCH, NORID,},
- {"union", AGGR, RID_UNION,},
- {"__signature__", AGGR, RID_SIGNATURE /* Extension */,},
- {"__signed", TYPESPEC, RID_SIGNED},
- {"bitand", '&', NORID,},
- {"throw", THROW, NORID,},
- {"register", SCSPEC, RID_REGISTER,},
- {"for", FOR, NORID,},
- {"const", CV_QUALIFIER, RID_CONST,},
- {"static", SCSPEC, RID_STATIC,},
- {"unsigned", TYPESPEC, RID_UNSIGNED,},
- {"private", VISSPEC, RID_PRIVATE,},
- {"__alignof", ALIGNOF, NORID},
- {"",},
- {"inline", SCSPEC, RID_INLINE,},
- {"do", DO, NORID,},
- {"",},
- {"virtual", SCSPEC, RID_VIRTUAL,},
- {"xor_eq", ASSIGN, NORID,},
- {"",},
- {"float", TYPESPEC, RID_FLOAT,},
- {"dynamic_cast", DYNAMIC_CAST, NORID,},
- {"signed", TYPESPEC, RID_SIGNED,},
- {"xor", '^', NORID,},
- {"bitor", '|', NORID,},
- {"__extension__", EXTENSION, NORID},
- {"friend", SCSPEC, RID_FRIEND,},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"this", THIS, NORID,},
- {"",},
- {"if", IF, NORID,},
- {"",}, {"",}, {"",},
- {"volatile", CV_QUALIFIER, RID_VOLATILE,},
- {"",}, {"",},
- {"__sigof__", SIGOF, NORID /* Extension */,},
- {"",}, {"",},
- {"const_cast", CONST_CAST, NORID,},
- {"",}, {"",},
- {"false", CXX_FALSE, NORID,},
- {"sizeof", SIZEOF, NORID,},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"goto", GOTO, NORID,},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"__typeof", TYPEOF, NORID},
- {"class", AGGR, RID_CLASS,},
- {"typedef", SCSPEC, RID_TYPEDEF,},
- {"",}, {"",},
- {"void", TYPESPEC, RID_VOID,},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"auto", SCSPEC, RID_AUTO,},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"",}, {"",}, {"",},
- {"operator", OPERATOR, NORID,},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"",}, {"",}, {"",}, {"",}, {"",},
- {"sigof", SIGOF, NORID /* Extension */,},
- };
-
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = hash (str, len);
-
- if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register char *s = wordlist[key].name;
-
- if (*s == *str && !strcmp (str + 1, s + 1))
- return &wordlist[key];
- }
- }
- return 0;
-}
diff --git a/gcc/cp/inc/exception b/gcc/cp/inc/exception
deleted file mode 100644
index d38806b81c4..00000000000
--- a/gcc/cp/inc/exception
+++ /dev/null
@@ -1,42 +0,0 @@
-// Exception Handling support header for -*- C++ -*-
-// Copyright (C) 1995, 1996 Free Software Foundation
-
-#ifndef __EXCEPTION__
-#define __EXCEPTION__
-
-#pragma interface "exception"
-
-extern "C++" {
-
-#if 0
-namespace std {
-#endif
-
-class exception {
-public:
- exception () { }
- virtual ~exception () { }
- virtual const char* what () const;
-};
-
-class bad_exception : public exception {
-public:
- bad_exception () { }
- virtual ~bad_exception () { }
-};
-
-typedef void (*terminate_handler) ();
-typedef void (*unexpected_handler) ();
-
-terminate_handler set_terminate (terminate_handler);
-void terminate (void);
-unexpected_handler set_unexpected (unexpected_handler);
-void unexpected (void);
-bool uncaught_exception ();
-} // extern "C++"
-
-#if 0
-} // namespace std
-#endif
-
-#endif
diff --git a/gcc/cp/inc/new b/gcc/cp/inc/new
deleted file mode 100644
index f4b0b975cdb..00000000000
--- a/gcc/cp/inc/new
+++ /dev/null
@@ -1,48 +0,0 @@
-// The -*- C++ -*- dynamic memory management header.
-// Copyright (C) 1994, 1996 Free Software Foundation
-
-#ifndef __NEW__
-#define __NEW__
-
-#pragma interface "new"
-#include <stddef.h>
-#include <exception>
-
-extern "C++" {
-
-#if 0
-namespace std {
-#endif
-
- class bad_alloc : public exception {
- public:
- virtual const char* what() const throw() { return "bad_alloc"; }
- };
-
- struct nothrow_t {};
- extern const nothrow_t nothrow;
- typedef void (*new_handler)();
- extern "C" new_handler set_new_handler (new_handler);
-
-#if 0
-} // namespace std
-#endif
-
-// G++ implementation internals
-extern new_handler __new_handler;
-extern "C" void __default_new_handler (void);
-
-// replaceable signatures
-void *operator new (size_t);
-void *operator new (size_t, const nothrow_t&) throw();
-void *operator new[] (size_t);
-void *operator new[] (size_t, const nothrow_t&) throw();
-void operator delete (void *) throw();
-void operator delete[] (void *) throw();
-
-// default placement versions of operator new
-inline void *operator new(size_t, void *place) throw() { return place; }
-inline void *operator new[](size_t, void *place) throw() { return place; }
-} // extern "C++"
-
-#endif
diff --git a/gcc/cp/inc/new.h b/gcc/cp/inc/new.h
deleted file mode 100644
index eed0910b668..00000000000
--- a/gcc/cp/inc/new.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// -*- C++ -*- forwarding header.
-
-#ifndef __NEW_H__
-#define __NEW_H__
-
-#include <new>
-
-#if 0
-using std::new_handler;
-using std::set_new_handler;
-#endif
-
-#endif // __NEW_H__
diff --git a/gcc/cp/inc/typeinfo b/gcc/cp/inc/typeinfo
deleted file mode 100644
index bad3b66a8d1..00000000000
--- a/gcc/cp/inc/typeinfo
+++ /dev/null
@@ -1,71 +0,0 @@
-// RTTI support for -*- C++ -*-
-// Copyright (C) 1994, 1995, 1996 Free Software Foundation
-
-#ifndef __TYPEINFO__
-#define __TYPEINFO__
-
-#include <exception>
-
-extern "C++" {
-
-#if 0
-namespace std {
-#endif
-
-class type_info {
-private:
- // assigning type_info is not supported. made private.
- type_info& operator= (const type_info&);
- type_info (const type_info&);
-
-protected:
- type_info (const char *n): _name (n) { }
-
- const char *_name;
-
-public:
- // destructor
- virtual ~type_info ();
-
- bool before (const type_info& arg);
- const char* name () const
- { return _name; }
- bool operator== (const type_info& arg) const;
- bool operator!= (const type_info& arg) const;
-};
-
-// We can't rely on common symbols being shared between translation units
-// under Windows. Sigh.
-
-#ifndef _WIN32
-inline bool type_info::
-operator== (const type_info& arg) const
-{
- return &arg == this;
-}
-
-inline bool type_info::
-operator!= (const type_info& arg) const
-{
- return &arg != this;
-}
-#endif
-
-class bad_cast : public exception {
-public:
- bad_cast() { }
- virtual ~bad_cast() { }
-};
-
-class bad_typeid : public exception {
- public:
- bad_typeid () { }
- virtual ~bad_typeid () { }
-};
-
-#if 0
-} // namespace std
-#endif
-
-} // extern "C++"
-#endif
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
deleted file mode 100644
index 4e1785d8ec9..00000000000
--- a/gcc/cp/init.c
+++ /dev/null
@@ -1,3508 +0,0 @@
-/* Handle initialization things in C++.
- Copyright (C) 1987, 89, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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. */
-
-/* High-level class interface. */
-
-#include "config.h"
-#include "tree.h"
-#include "rtl.h"
-#include "cp-tree.h"
-#include "flags.h"
-#include "output.h"
-
-/* In C++, structures with well-defined constructors are initialized by
- those constructors, unasked. CURRENT_BASE_INIT_LIST
- holds a list of stmts for a BASE_INIT term in the grammar.
- This list has one element for each base class which must be
- initialized. The list elements are [basename, init], with
- type basetype. This allows the possibly anachronistic form
- (assuming d : a, b, c) "d (int a) : c(a+5), b (a-4), a (a+3)"
- where each successive term can be handed down the constructor
- line. Perhaps this was not intended. */
-tree current_base_init_list, current_member_init_list;
-
-extern tree cleanups_this_call;
-
-void emit_base_init ();
-void check_base_init ();
-static void expand_aggr_vbase_init ();
-void expand_member_init ();
-void expand_aggr_init ();
-
-static void expand_aggr_init_1 PROTO((tree, tree, tree, tree, int, int));
-static void expand_virtual_init PROTO((tree, tree));
-tree expand_vec_init ();
-
-/* Cache _builtin_new and _builtin_delete exprs. */
-static tree BIN, BID, BIVN, BIVD;
-
-/* Cache the identifier nodes for the magic field of a new cookie. */
-static tree nc_nelts_field_id;
-
-static tree minus_one;
-
-/* Set up local variable for this file. MUST BE CALLED AFTER
- INIT_DECL_PROCESSING. */
-
-static tree BI_header_type, BI_header_size;
-
-void init_init_processing ()
-{
- tree fields[1];
-
- /* Define implicit `operator new' and `operator delete' functions. */
- BIN = default_conversion (get_first_fn (IDENTIFIER_GLOBAL_VALUE (ansi_opname[(int) NEW_EXPR])));
- TREE_USED (TREE_OPERAND (BIN, 0)) = 0;
- BID = default_conversion (get_first_fn (IDENTIFIER_GLOBAL_VALUE (ansi_opname[(int) DELETE_EXPR])));
- TREE_USED (TREE_OPERAND (BID, 0)) = 0;
- BIVN = default_conversion (get_first_fn (IDENTIFIER_GLOBAL_VALUE (ansi_opname[(int) VEC_NEW_EXPR])));
- TREE_USED (TREE_OPERAND (BIVN, 0)) = 0;
- BIVD = default_conversion (get_first_fn (IDENTIFIER_GLOBAL_VALUE (ansi_opname[(int) VEC_DELETE_EXPR])));
- TREE_USED (TREE_OPERAND (BIVD, 0)) = 0;
- minus_one = build_int_2 (-1, -1);
-
- /* Define the structure that holds header information for
- arrays allocated via operator new. */
- BI_header_type = make_lang_type (RECORD_TYPE);
- nc_nelts_field_id = get_identifier ("nelts");
- fields[0] = build_lang_field_decl (FIELD_DECL, nc_nelts_field_id, sizetype);
- finish_builtin_type (BI_header_type, "__new_cookie", fields,
- 0, double_type_node);
- BI_header_size = size_in_bytes (BI_header_type);
-}
-
-/* Subroutine of emit_base_init. For BINFO, initialize all the
- virtual function table pointers, except those that come from
- virtual base classes. Initialize binfo's vtable pointer, if
- INIT_SELF is true. CAN_ELIDE is true when we know that all virtual
- function table pointers in all bases have been initialized already,
- probably because their constructors have just be run. ADDR is the
- pointer to the object whos vtables we are going to initialize.
-
- REAL_BINFO is usually the same as BINFO, except when addr is not of
- pointer to the type of the real derived type that we want to
- initialize for. This is the case when addr is a pointer to a sub
- object of a complete object, and we only want to do part of the
- complete object's initialization of vtable pointers. This is done
- for all virtual table pointers in virtual base classes. REAL_BINFO
- is used to find the BINFO_VTABLE that we initialize with. BINFO is
- used for conversions of addr to subobjects.
-
- BINFO_TYPE (real_binfo) must be BINFO_TYPE (binfo).
-
- Relies upon binfo being inside TYPE_BINFO (TREE_TYPE (TREE_TYPE
- (addr))). */
-
-void
-expand_direct_vtbls_init (real_binfo, binfo, init_self, can_elide, addr)
- tree real_binfo, binfo, addr;
- int init_self, can_elide;
-{
- tree real_binfos = BINFO_BASETYPES (real_binfo);
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = real_binfos ? TREE_VEC_LENGTH (real_binfos) : 0;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree real_base_binfo = TREE_VEC_ELT (real_binfos, i);
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable =
- i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (real_binfo));
- if (! TREE_VIA_VIRTUAL (real_base_binfo))
- expand_direct_vtbls_init (real_base_binfo, base_binfo,
- is_not_base_vtable, can_elide, addr);
- }
-#if 0
- /* Before turning this on, make sure it is correct. */
- if (can_elide && ! BINFO_MODIFIED (binfo))
- return;
-#endif
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (init_self && CLASSTYPE_VFIELDS (BINFO_TYPE (real_binfo)))
- {
- tree base_ptr = convert_pointer_to_real (binfo, addr);
- expand_virtual_init (real_binfo, base_ptr);
- }
-}
-
-/* 348 - 351 */
-/* Subroutine of emit_base_init. */
-
-static void
-perform_member_init (member, name, init, explicit)
- tree member, name, init;
- int explicit;
-{
- tree decl;
- tree type = TREE_TYPE (member);
- extern int temp_slot_level;
- extern int target_temp_slot_level;
- tree old_cleanups = cleanups_this_call;
- int old_temp_level = target_temp_slot_level;
- push_temp_slots ();
- push_temp_slots ();
- target_temp_slot_level = temp_slot_level;
-
- if (TYPE_NEEDS_CONSTRUCTING (type)
- || (init && TYPE_HAS_CONSTRUCTOR (type)))
- {
- /* Since `init' is already a TREE_LIST on the current_member_init_list,
- only build it into one if we aren't already a list. */
- if (init != NULL_TREE && TREE_CODE (init) != TREE_LIST)
- init = build_tree_list (NULL_TREE, init);
-
- decl = build_component_ref (current_class_ref, name, NULL_TREE, explicit);
-
- if (explicit
- && TREE_CODE (type) == ARRAY_TYPE
- && init != NULL_TREE
- && TREE_CHAIN (init) == NULL_TREE
- && TREE_CODE (TREE_TYPE (TREE_VALUE (init))) == ARRAY_TYPE)
- {
- /* Initialization of one array from another. */
- expand_vec_init (TREE_OPERAND (decl, 1), decl,
- array_type_nelts (type), TREE_VALUE (init), 1);
- }
- else
- expand_aggr_init (decl, init, 0, 0);
- }
- else
- {
- if (init == NULL_TREE)
- {
- if (explicit)
- {
- cp_error ("incomplete initializer for member `%D' of class `%T' which has no constructor",
- member, current_class_type);
- init = error_mark_node;
- }
- /* member traversal: note it leaves init NULL */
- else if (TREE_CODE (TREE_TYPE (member)) == REFERENCE_TYPE)
- cp_pedwarn ("uninitialized reference member `%D'", member);
- }
- else if (TREE_CODE (init) == TREE_LIST)
- {
- /* There was an explicit member initialization. Do some
- work in that case. */
- if (TREE_CHAIN (init))
- {
- warning ("initializer list treated as compound expression");
- init = build_compound_expr (init);
- }
- else
- init = TREE_VALUE (init);
- }
-
- /* We only build this with a null init if we got it from the
- current_member_init_list. */
- if (init || explicit)
- {
- decl = build_component_ref (current_class_ref, name, NULL_TREE, explicit);
- expand_expr_stmt (build_modify_expr (decl, INIT_EXPR, init));
- }
- }
- expand_cleanups_to (old_cleanups);
- pop_temp_slots ();
- pop_temp_slots ();
- target_temp_slot_level = old_temp_level;
- /* There might something left from building the trees. */
- if (cleanups_this_call)
- {
- expand_cleanups_to (NULL_TREE);
- }
- free_temp_slots ();
-
- if (TYPE_NEEDS_DESTRUCTOR (type))
- {
- tree expr;
-
- /* All cleanups must be on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
-
- expr = build_component_ref (current_class_ref, name, NULL_TREE, explicit);
- expr = build_delete (type, expr, integer_zero_node,
- LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0);
-
- if (expr != error_mark_node)
- add_partial_entry (expr);
-
- pop_obstacks ();
- }
-}
-
-extern int warn_reorder;
-
-/* Subroutine of emit_member_init. */
-
-static tree
-sort_member_init (t)
- tree t;
-{
- tree x, member, name, field;
- tree init_list = NULL_TREE;
- int last_pos = 0;
- tree last_field;
-
- for (member = TYPE_FIELDS (t); member ; member = TREE_CHAIN (member))
- {
- int pos;
-
- /* member could be, for example, a CONST_DECL for an enumerated
- tag; we don't want to try to initialize that, since it already
- has a value. */
- if (TREE_CODE (member) != FIELD_DECL || !DECL_NAME (member))
- continue;
-
- for (x = current_member_init_list, pos = 0; x; x = TREE_CHAIN (x), ++pos)
- {
- /* If we cleared this out, then pay no attention to it. */
- if (TREE_PURPOSE (x) == NULL_TREE)
- continue;
- name = TREE_PURPOSE (x);
-
-#if 0
- /* This happens in templates, since the IDENTIFIER is replaced
- with the COMPONENT_REF in tsubst_expr. */
- field = (TREE_CODE (name) == COMPONENT_REF
- ? TREE_OPERAND (name, 1) : IDENTIFIER_CLASS_VALUE (name));
-#else
- /* Let's find out when this happens. */
- my_friendly_assert (TREE_CODE (name) != COMPONENT_REF, 348);
- field = IDENTIFIER_CLASS_VALUE (name);
-#endif
-
- /* If one member shadows another, get the outermost one. */
- if (TREE_CODE (field) == TREE_LIST)
- field = TREE_VALUE (field);
-
- if (field == member)
- {
- if (warn_reorder)
- {
- if (pos < last_pos)
- {
- cp_warning_at ("member initializers for `%#D'", last_field);
- cp_warning_at (" and `%#D'", field);
- warning (" will be re-ordered to match declaration order");
- }
- last_pos = pos;
- last_field = field;
- }
-
- /* Make sure we won't try to work on this init again. */
- TREE_PURPOSE (x) = NULL_TREE;
- x = build_tree_list (name, TREE_VALUE (x));
- goto got_it;
- }
- }
-
- /* If we didn't find MEMBER in the list, create a dummy entry
- so the two lists (INIT_LIST and the list of members) will be
- symmetrical. */
- x = build_tree_list (NULL_TREE, NULL_TREE);
- got_it:
- init_list = chainon (init_list, x);
- }
-
- /* Initializers for base members go at the end. */
- for (x = current_member_init_list ; x ; x = TREE_CHAIN (x))
- {
- name = TREE_PURPOSE (x);
- if (name)
- {
- if (purpose_member (name, init_list))
- {
- cp_error ("multiple initializations given for member `%D'",
- IDENTIFIER_CLASS_VALUE (name));
- continue;
- }
-
- init_list = chainon (init_list,
- build_tree_list (name, TREE_VALUE (x)));
- TREE_PURPOSE (x) = NULL_TREE;
- }
- }
-
- return init_list;
-}
-
-static void
-sort_base_init (t, rbase_ptr, vbase_ptr)
- tree t, *rbase_ptr, *vbase_ptr;
-{
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
- int n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- int i;
- tree x;
- tree last;
-
- /* For warn_reorder. */
- int last_pos = 0;
- tree last_base = NULL_TREE;
-
- tree rbases = NULL_TREE;
- tree vbases = NULL_TREE;
-
- /* First walk through and splice out vbase and invalid initializers.
- Also replace names with binfos. */
-
- last = tree_cons (NULL_TREE, NULL_TREE, current_base_init_list);
- for (x = TREE_CHAIN (last); x; x = TREE_CHAIN (x))
- {
- tree basetype = TREE_PURPOSE (x);
- tree binfo;
-
- if (basetype == NULL_TREE)
- {
- /* Initializer for single base class. Must not
- use multiple inheritance or this is ambiguous. */
- switch (n_baseclasses)
- {
- case 0:
- cp_error ("`%T' does not have a base class to initialize",
- current_class_type);
- return;
- case 1:
- break;
- default:
- cp_error ("unnamed initializer ambiguous for `%T' which uses multiple inheritance",
- current_class_type);
- return;
- }
- binfo = TREE_VEC_ELT (binfos, 0);
- }
- else if (is_aggr_type (basetype, 1))
- {
- binfo = binfo_or_else (basetype, t);
- if (binfo == NULL_TREE)
- continue;
-
- /* Virtual base classes are special cases. Their initializers
- are recorded with this constructor, and they are used when
- this constructor is the top-level constructor called. */
- if (TREE_VIA_VIRTUAL (binfo))
- {
- tree v = CLASSTYPE_VBASECLASSES (t);
- while (BINFO_TYPE (v) != BINFO_TYPE (binfo))
- v = TREE_CHAIN (v);
-
- vbases = tree_cons (v, TREE_VALUE (x), vbases);
- continue;
- }
- else
- {
- /* Otherwise, if it is not an immediate base class, complain. */
- for (i = n_baseclasses-1; i >= 0; i--)
- if (BINFO_TYPE (binfo) == BINFO_TYPE (TREE_VEC_ELT (binfos, i)))
- break;
- if (i < 0)
- {
- cp_error ("`%T' is not an immediate base class of `%T'",
- basetype, current_class_type);
- continue;
- }
- }
- }
- else
- my_friendly_abort (365);
-
- TREE_PURPOSE (x) = binfo;
- TREE_CHAIN (last) = x;
- last = x;
- }
- TREE_CHAIN (last) = NULL_TREE;
-
- /* Now walk through our regular bases and make sure they're initialized. */
-
- for (i = 0; i < n_baseclasses; ++i)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int pos;
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- continue;
-
- for (x = current_base_init_list, pos = 0; x; x = TREE_CHAIN (x), ++pos)
- {
- tree binfo = TREE_PURPOSE (x);
-
- if (binfo == NULL_TREE)
- continue;
-
- if (binfo == base_binfo)
- {
- if (warn_reorder)
- {
- if (pos < last_pos)
- {
- cp_warning_at ("base initializers for `%#T'", last_base);
- cp_warning_at (" and `%#T'", BINFO_TYPE (binfo));
- warning (" will be re-ordered to match inheritance order");
- }
- last_pos = pos;
- last_base = BINFO_TYPE (binfo);
- }
-
- /* Make sure we won't try to work on this init again. */
- TREE_PURPOSE (x) = NULL_TREE;
- x = build_tree_list (binfo, TREE_VALUE (x));
- goto got_it;
- }
- }
-
- /* If we didn't find BASE_BINFO in the list, create a dummy entry
- so the two lists (RBASES and the list of bases) will be
- symmetrical. */
- x = build_tree_list (NULL_TREE, NULL_TREE);
- got_it:
- rbases = chainon (rbases, x);
- }
-
- *rbase_ptr = rbases;
- *vbase_ptr = vbases;
-}
-
-/* Perform partial cleanups for a base for exception handling. */
-
-static tree
-build_partial_cleanup_for (binfo)
- tree binfo;
-{
- return build_scoped_method_call
- (current_class_ref, binfo, dtor_identifier,
- build_tree_list (NULL_TREE, integer_zero_node));
-}
-
-/* Perform whatever initializations have yet to be done on the base
- class of the class variable. These actions are in the global
- variable CURRENT_BASE_INIT_LIST. Such an action could be
- NULL_TREE, meaning that the user has explicitly called the base
- class constructor with no arguments.
-
- If there is a need for a call to a constructor, we must surround
- that call with a pushlevel/poplevel pair, since we are technically
- at the PARM level of scope.
-
- Argument IMMEDIATELY, if zero, forces a new sequence to be
- generated to contain these new insns, so it can be emitted later.
- This sequence is saved in the global variable BASE_INIT_EXPR.
- Otherwise, the insns are emitted into the current sequence.
-
- Note that emit_base_init does *not* initialize virtual base
- classes. That is done specially, elsewhere. */
-
-extern tree base_init_expr, rtl_expr_chain;
-
-void
-emit_base_init (t, immediately)
- tree t;
- int immediately;
-{
- tree member;
- tree mem_init_list;
- tree rbase_init_list, vbase_init_list;
- tree t_binfo = TYPE_BINFO (t);
- tree binfos = BINFO_BASETYPES (t_binfo);
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree expr = NULL_TREE;
-
- if (! immediately)
- {
- int momentary;
- do_pending_stack_adjust ();
- /* Make the RTL_EXPR node temporary, not momentary,
- so that rtl_expr_chain doesn't become garbage. */
- momentary = suspend_momentary ();
- expr = make_node (RTL_EXPR);
- resume_momentary (momentary);
- start_sequence_for_rtl_expr (expr);
- }
-
- if (write_symbols == NO_DEBUG)
- /* As a matter of principle, `start_sequence' should do this. */
- emit_note (0, -1);
- else
- /* Always emit a line number note so we can step into constructors. */
- emit_line_note_force (DECL_SOURCE_FILE (current_function_decl),
- DECL_SOURCE_LINE (current_function_decl));
-
- mem_init_list = sort_member_init (t);
- current_member_init_list = NULL_TREE;
-
- sort_base_init (t, &rbase_init_list, &vbase_init_list);
- current_base_init_list = NULL_TREE;
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (t))
- {
- tree first_arg = TREE_CHAIN (DECL_ARGUMENTS (current_function_decl));
-
- expand_start_cond (first_arg, 0);
- expand_aggr_vbase_init (t_binfo, current_class_ref, current_class_ptr,
- vbase_init_list);
- expand_end_cond ();
- }
-
- /* Now, perform initialization of non-virtual base classes. */
- for (i = 0; i < n_baseclasses; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree init = void_list_node;
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- continue;
-
-#if 0 /* Once unsharing happens soon enough. */
- my_friendly_assert (BINFO_INHERITANCE_CHAIN (base_binfo) == t_binfo, 999);
-#else
- BINFO_INHERITANCE_CHAIN (base_binfo) = t_binfo;
-#endif
-
- if (TREE_PURPOSE (rbase_init_list))
- init = TREE_VALUE (rbase_init_list);
- else if (TYPE_NEEDS_CONSTRUCTING (BINFO_TYPE (base_binfo)))
- {
- init = NULL_TREE;
- if (extra_warnings && copy_args_p (current_function_decl))
- cp_warning ("base class `%#T' should be explicitly initialized in the copy constructor",
- BINFO_TYPE (base_binfo));
- }
-
- if (init != void_list_node)
- {
- extern int temp_slot_level;
- extern int target_temp_slot_level;
- tree old_cleanups = cleanups_this_call;
- int old_temp_level = target_temp_slot_level;
- push_temp_slots ();
- push_temp_slots ();
- target_temp_slot_level = temp_slot_level;
-
- member = convert_pointer_to_real (base_binfo, current_class_ptr);
- expand_aggr_init_1 (base_binfo, NULL_TREE,
- build_indirect_ref (member, NULL_PTR), init,
- BINFO_OFFSET_ZEROP (base_binfo), LOOKUP_NORMAL);
- expand_cleanups_to (old_cleanups);
- pop_temp_slots ();
- pop_temp_slots ();
- target_temp_slot_level = old_temp_level;
- /* There might something left from building the trees. */
- if (cleanups_this_call)
- {
- expand_cleanups_to (NULL_TREE);
- }
- free_temp_slots ();
- }
-
- if (TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo)))
- {
- tree expr;
-
- /* All cleanups must be on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
- expr = build_partial_cleanup_for (base_binfo);
- pop_obstacks ();
- add_partial_entry (expr);
- }
-
- rbase_init_list = TREE_CHAIN (rbase_init_list);
- }
-
- /* Initialize all the virtual function table fields that
- do come from virtual base classes. */
- if (TYPE_USES_VIRTUAL_BASECLASSES (t))
- expand_indirect_vtbls_init (t_binfo, current_class_ref, current_class_ptr);
-
- /* Initialize all the virtual function table fields that
- do not come from virtual base classes. */
- expand_direct_vtbls_init (t_binfo, t_binfo, 1, 1, current_class_ptr);
-
- for (member = TYPE_FIELDS (t); member; member = TREE_CHAIN (member))
- {
- tree init, name;
- int from_init_list;
-
- /* member could be, for example, a CONST_DECL for an enumerated
- tag; we don't want to try to initialize that, since it already
- has a value. */
- if (TREE_CODE (member) != FIELD_DECL || !DECL_NAME (member))
- continue;
-
- /* See if we had a user-specified member initialization. */
- if (TREE_PURPOSE (mem_init_list))
- {
- name = TREE_PURPOSE (mem_init_list);
- init = TREE_VALUE (mem_init_list);
- from_init_list = 1;
-
-#if 0
- if (TREE_CODE (name) == COMPONENT_REF)
- name = DECL_NAME (TREE_OPERAND (name, 1));
-#else
- /* Also see if it's ever a COMPONENT_REF here. If it is, we
- need to do `expand_assignment (name, init, 0, 0);' and
- a continue. */
- my_friendly_assert (TREE_CODE (name) != COMPONENT_REF, 349);
-#endif
- }
- else
- {
- name = DECL_NAME (member);
- init = DECL_INITIAL (member);
-
- from_init_list = 0;
-
- /* Effective C++ rule 12. */
- if (extra_warnings && init == NULL_TREE
- && TREE_CODE (TREE_TYPE (member)) != ARRAY_TYPE)
- cp_warning ("`%D' should be initialized in the member initialization list", member);
- }
-
- perform_member_init (member, name, init, from_init_list);
- mem_init_list = TREE_CHAIN (mem_init_list);
- }
-
- /* Now initialize any members from our bases. */
- while (mem_init_list)
- {
- tree name, init, field;
-
- if (TREE_PURPOSE (mem_init_list))
- {
- name = TREE_PURPOSE (mem_init_list);
- init = TREE_VALUE (mem_init_list);
- /* XXX: this may need the COMPONENT_REF operand 0 check if
- it turns out we actually get them. */
- field = IDENTIFIER_CLASS_VALUE (name);
-
- /* If one member shadows another, get the outermost one. */
- if (TREE_CODE (field) == TREE_LIST)
- {
- field = TREE_VALUE (field);
- if (decl_type_context (field) != current_class_type)
- cp_error ("field `%D' not in immediate context", field);
- }
-
-#if 0
- /* It turns out if you have an anonymous union in the
- class, a member from it can end up not being on the
- list of fields (rather, the type is), and therefore
- won't be seen by the for loop above. */
-
- /* The code in this for loop is derived from a general loop
- which had this check in it. Theoretically, we've hit
- every initialization for the list of members in T, so
- we shouldn't have anything but these left in this list. */
- my_friendly_assert (DECL_FIELD_CONTEXT (field) != t, 351);
-#endif
-
- perform_member_init (field, name, init, 1);
- }
- mem_init_list = TREE_CHAIN (mem_init_list);
- }
-
- if (! immediately)
- {
- do_pending_stack_adjust ();
- my_friendly_assert (base_init_expr == 0, 207);
- base_init_expr = expr;
- TREE_TYPE (expr) = void_type_node;
- RTL_EXPR_RTL (expr) = const0_rtx;
- RTL_EXPR_SEQUENCE (expr) = get_insns ();
- rtl_expr_chain = tree_cons (NULL_TREE, expr, rtl_expr_chain);
- end_sequence ();
- TREE_SIDE_EFFECTS (expr) = 1;
- }
-
- /* All the implicit try blocks we built up will be zapped
- when we come to a real binding contour boundary. */
-}
-
-/* Check that all fields are properly initialized after
- an assignment to `this'. */
-
-void
-check_base_init (t)
- tree t;
-{
- tree member;
- for (member = TYPE_FIELDS (t); member; member = TREE_CHAIN (member))
- if (DECL_NAME (member) && TREE_USED (member))
- cp_error ("field `%D' used before initialized (after assignment to `this')",
- member);
-}
-
-/* This code sets up the virtual function tables appropriate for
- the pointer DECL. It is a one-ply initialization.
-
- BINFO is the exact type that DECL is supposed to be. In
- multiple inheritance, this might mean "C's A" if C : A, B. */
-
-static void
-expand_virtual_init (binfo, decl)
- tree binfo, decl;
-{
- tree type = BINFO_TYPE (binfo);
- tree vtbl, vtbl_ptr;
- tree vtype, vtype_binfo;
-
- /* This code is crusty. Should be simple, like:
- vtbl = BINFO_VTABLE (binfo);
- */
- vtype = DECL_CONTEXT (CLASSTYPE_VFIELD (type));
- vtype_binfo = get_binfo (vtype, TREE_TYPE (TREE_TYPE (decl)), 0);
- vtbl = BINFO_VTABLE (binfo_value (DECL_FIELD_CONTEXT (CLASSTYPE_VFIELD (type)), binfo));
- assemble_external (vtbl);
- TREE_USED (vtbl) = 1;
- vtbl = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (vtbl)), vtbl);
- decl = convert_pointer_to_real (vtype_binfo, decl);
- vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, NULL_PTR), vtype);
- if (vtbl_ptr == error_mark_node)
- return;
-
- /* Have to convert VTBL since array sizes may be different. */
- vtbl = convert_force (TREE_TYPE (vtbl_ptr), vtbl, 0);
- expand_expr_stmt (build_modify_expr (vtbl_ptr, NOP_EXPR, vtbl));
-}
-
-/* Subroutine of `expand_aggr_vbase_init'.
- BINFO is the binfo of the type that is being initialized.
- INIT_LIST is the list of initializers for the virtual baseclass. */
-
-static void
-expand_aggr_vbase_init_1 (binfo, exp, addr, init_list)
- tree binfo, exp, addr, init_list;
-{
- tree init = purpose_member (binfo, init_list);
- tree ref = build_indirect_ref (addr, NULL_PTR);
-
- extern int temp_slot_level;
- extern int target_temp_slot_level;
- tree old_cleanups = cleanups_this_call;
- int old_temp_level = target_temp_slot_level;
- push_temp_slots ();
- push_temp_slots ();
- target_temp_slot_level = temp_slot_level;
-
- if (init)
- init = TREE_VALUE (init);
- /* Call constructors, but don't set up vtables. */
- expand_aggr_init_1 (binfo, exp, ref, init, 0, LOOKUP_COMPLAIN);
-
- expand_cleanups_to (old_cleanups);
- pop_temp_slots ();
- pop_temp_slots ();
- target_temp_slot_level = old_temp_level;
- /* There might something left from building the trees. */
- if (cleanups_this_call)
- {
- expand_cleanups_to (NULL_TREE);
- }
- free_temp_slots ();
-}
-
-/* Initialize this object's virtual base class pointers. This must be
- done only at the top-level of the object being constructed.
-
- INIT_LIST is list of initialization for constructor to perform. */
-
-static void
-expand_aggr_vbase_init (binfo, exp, addr, init_list)
- tree binfo;
- tree exp;
- tree addr;
- tree init_list;
-{
- tree type = BINFO_TYPE (binfo);
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- {
- tree result = init_vbase_pointers (type, addr);
- tree vbases;
-
- if (result)
- expand_expr_stmt (build_compound_expr (result));
-
- for (vbases = CLASSTYPE_VBASECLASSES (type); vbases;
- vbases = TREE_CHAIN (vbases))
- {
- tree tmp = purpose_member (vbases, result);
- expand_aggr_vbase_init_1 (vbases, exp,
- TREE_OPERAND (TREE_VALUE (tmp), 0),
- init_list);
- }
- }
-}
-
-/* Subroutine to perform parser actions for member initialization.
- S_ID is the scoped identifier.
- NAME is the name of the member.
- INIT is the initializer, or `void_type_node' if none. */
-
-void
-do_member_init (s_id, name, init)
- tree s_id, name, init;
-{
- tree binfo, base;
-
- if (current_class_type == NULL_TREE
- || ! is_aggr_typedef (s_id, 1))
- return;
- binfo = get_binfo (IDENTIFIER_TYPE_VALUE (s_id),
- current_class_type, 1);
- if (binfo == error_mark_node)
- return;
- if (binfo == 0)
- {
- error_not_base_type (IDENTIFIER_TYPE_VALUE (s_id), current_class_type);
- return;
- }
-
- base = convert_pointer_to (binfo, current_class_ptr);
- expand_member_init (build_indirect_ref (base, NULL_PTR), name, init);
-}
-
-/* Find the context in which this FIELD can be initialized. */
-
-static tree
-initializing_context (field)
- tree field;
-{
- tree t = DECL_CONTEXT (field);
-
- /* Anonymous union members can be initialized in the first enclosing
- non-anonymous union context. */
- while (t && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- t = TYPE_CONTEXT (t);
- return t;
-}
-
-/* Function to give error message if member initialization specification
- is erroneous. FIELD is the member we decided to initialize.
- TYPE is the type for which the initialization is being performed.
- FIELD must be a member of TYPE.
-
- MEMBER_NAME is the name of the member. */
-
-static int
-member_init_ok_or_else (field, type, member_name)
- tree field;
- tree type;
- char *member_name;
-{
- if (field == error_mark_node)
- return 0;
- if (field == NULL_TREE || initializing_context (field) != type)
- {
- cp_error ("class `%T' does not have any field named `%s'", type,
- member_name);
- return 0;
- }
- if (TREE_STATIC (field))
- {
- cp_error ("field `%#D' is static; only point of initialization is its declaration",
- field);
- return 0;
- }
-
- return 1;
-}
-
-/* If NAME is a viable field name for the aggregate DECL,
- and PARMS is a viable parameter list, then expand an _EXPR
- which describes this initialization.
-
- Note that we do not need to chase through the class's base classes
- to look for NAME, because if it's in that list, it will be handled
- by the constructor for that base class.
-
- We do not yet have a fixed-point finder to instantiate types
- being fed to overloaded constructors. If there is a unique
- constructor, then argument types can be got from that one.
-
- If INIT is non-NULL, then it the initialization should
- be placed in `current_base_init_list', where it will be processed
- by `emit_base_init'. */
-
-void
-expand_member_init (exp, name, init)
- tree exp, name, init;
-{
- extern tree ptr_type_node; /* should be in tree.h */
-
- tree basetype = NULL_TREE, field;
- tree parm;
- tree rval, type;
-
- if (exp == NULL_TREE)
- return; /* complain about this later */
-
- type = TYPE_MAIN_VARIANT (TREE_TYPE (exp));
-
- if (name && TREE_CODE (name) == TYPE_DECL)
- {
- basetype = TREE_TYPE (name);
- name = DECL_NAME (name);
- }
-
- if (name == NULL_TREE && IS_AGGR_TYPE (type))
- switch (CLASSTYPE_N_BASECLASSES (type))
- {
- case 0:
- error ("base class initializer specified, but no base class to initialize");
- return;
- case 1:
- basetype = TYPE_BINFO_BASETYPE (type, 0);
- break;
- default:
- error ("initializer for unnamed base class ambiguous");
- cp_error ("(type `%T' uses multiple inheritance)", type);
- return;
- }
-
- if (init)
- {
- /* The grammar should not allow fields which have names
- that are TYPENAMEs. Therefore, if the field has
- a non-NULL TREE_TYPE, we may assume that this is an
- attempt to initialize a base class member of the current
- type. Otherwise, it is an attempt to initialize a
- member field. */
-
- if (init == void_type_node)
- init = NULL_TREE;
-
- if (name == NULL_TREE || basetype)
- {
- tree base_init;
-
- if (name == NULL_TREE)
- {
-#if 0
- if (basetype)
- name = TYPE_IDENTIFIER (basetype);
- else
- {
- error ("no base class to initialize");
- return;
- }
-#endif
- }
- else if (basetype != type
- && ! current_template_parms
- && ! vec_binfo_member (basetype,
- TYPE_BINFO_BASETYPES (type))
- && ! binfo_member (basetype, CLASSTYPE_VBASECLASSES (type)))
- {
- if (IDENTIFIER_CLASS_VALUE (name))
- goto try_member;
- if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- cp_error ("type `%T' is not an immediate or virtual basetype for `%T'",
- basetype, type);
- else
- cp_error ("type `%T' is not an immediate basetype for `%T'",
- basetype, type);
- return;
- }
-
- if (purpose_member (basetype, current_base_init_list))
- {
- cp_error ("base class `%T' already initialized", basetype);
- return;
- }
-
- if (warn_reorder && current_member_init_list)
- {
- cp_warning ("base initializer for `%T'", basetype);
- warning (" will be re-ordered to precede member initializations");
- }
-
- base_init = build_tree_list (basetype, init);
- current_base_init_list = chainon (current_base_init_list, base_init);
- }
- else
- {
- tree member_init;
-
- try_member:
- field = lookup_field (type, name, 1, 0);
-
- if (! member_init_ok_or_else (field, type, IDENTIFIER_POINTER (name)))
- return;
-
- if (purpose_member (name, current_member_init_list))
- {
- cp_error ("field `%D' already initialized", field);
- return;
- }
-
- member_init = build_tree_list (name, init);
- current_member_init_list = chainon (current_member_init_list, member_init);
- }
- return;
- }
- else if (name == NULL_TREE)
- {
- compiler_error ("expand_member_init: name == NULL_TREE");
- return;
- }
-
- basetype = type;
- field = lookup_field (basetype, name, 0, 0);
-
- if (! member_init_ok_or_else (field, basetype, IDENTIFIER_POINTER (name)))
- return;
-
- /* now see if there is a constructor for this type
- which will take these args. */
-
- if (TYPE_HAS_CONSTRUCTOR (TREE_TYPE (field)))
- {
- tree parmtypes, fndecl;
-
- if (TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == PARM_DECL)
- {
- /* just know that we've seen something for this node */
- DECL_INITIAL (exp) = error_mark_node;
- TREE_USED (exp) = 1;
- }
- type = TYPE_MAIN_VARIANT (TREE_TYPE (field));
- parm = build_component_ref (exp, name, NULL_TREE, 0);
-
- /* Now get to the constructors. */
- fndecl = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), 0);
-
- if (fndecl)
- my_friendly_assert (TREE_CODE (fndecl) == FUNCTION_DECL, 209);
-
- /* If the field is unique, we can use the parameter
- types to guide possible type instantiation. */
- if (DECL_CHAIN (fndecl) == NULL_TREE)
- {
- /* There was a confusion here between
- FIELD and FNDECL. The following code
- should be correct, but abort is here
- to make sure. */
- my_friendly_abort (48);
- parmtypes = FUNCTION_ARG_CHAIN (fndecl);
- }
- else
- {
- parmtypes = NULL_TREE;
- fndecl = NULL_TREE;
- }
-
- init = convert_arguments (parm, parmtypes, NULL_TREE, fndecl, LOOKUP_NORMAL);
- if (init == NULL_TREE || TREE_TYPE (init) != error_mark_node)
- rval = build_method_call (NULL_TREE, ctor_identifier, init,
- TYPE_BINFO (type), LOOKUP_NORMAL);
- else
- return;
-
- if (rval != error_mark_node)
- {
- /* Now, fill in the first parm with our guy */
- TREE_VALUE (TREE_OPERAND (rval, 1))
- = build_unary_op (ADDR_EXPR, parm, 0);
- TREE_TYPE (rval) = ptr_type_node;
- TREE_SIDE_EFFECTS (rval) = 1;
- }
- }
- else if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (field)))
- {
- parm = build_component_ref (exp, name, NULL_TREE, 0);
- expand_aggr_init (parm, NULL_TREE, 0, 0);
- rval = error_mark_node;
- }
-
- /* Now initialize the member. It does not have to
- be of aggregate type to receive initialization. */
- if (rval != error_mark_node)
- expand_expr_stmt (rval);
-}
-
-/* This is like `expand_member_init', only it stores one aggregate
- value into another.
-
- INIT comes in two flavors: it is either a value which
- is to be stored in EXP, or it is a parameter list
- to go to a constructor, which will operate on EXP.
- If INIT is not a parameter list for a constructor, then set
- LOOKUP_ONLYCONVERTING.
- If FLAGS is LOOKUP_ONLYCONVERTING then it is the = init form of
- the initializer, if FLAGS is 0, then it is the (init) form.
- If `init' is a CONSTRUCTOR, then we emit a warning message,
- explaining that such initializations are invalid.
-
- ALIAS_THIS is nonzero iff we are initializing something which is
- essentially an alias for current_class_ref. In this case, the base
- constructor may move it on us, and we must keep track of such
- deviations.
-
- If INIT resolves to a CALL_EXPR which happens to return
- something of the type we are looking for, then we know
- that we can safely use that call to perform the
- initialization.
-
- The virtual function table pointer cannot be set up here, because
- we do not really know its type.
-
- Virtual baseclass pointers are also set up here.
-
- This never calls operator=().
-
- When initializing, nothing is CONST.
-
- A default copy constructor may have to be used to perform the
- initialization.
-
- A constructor or a conversion operator may have to be used to
- perform the initialization, but not both, as it would be ambiguous. */
-
-void
-expand_aggr_init (exp, init, alias_this, flags)
- tree exp, init;
- int alias_this;
- int flags;
-{
- tree type = TREE_TYPE (exp);
- int was_const = TREE_READONLY (exp);
- int was_volatile = TREE_THIS_VOLATILE (exp);
-
- if (init == error_mark_node)
- return;
-
- TREE_READONLY (exp) = 0;
- TREE_THIS_VOLATILE (exp) = 0;
-
- if (init && TREE_CODE (init) != TREE_LIST)
- flags |= LOOKUP_ONLYCONVERTING;
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- /* Must arrange to initialize each element of EXP
- from elements of INIT. */
- tree itype = init ? TREE_TYPE (init) : NULL_TREE;
- if (TYPE_READONLY (TREE_TYPE (type)) || TYPE_VOLATILE (TREE_TYPE (type)))
- {
- TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
- if (init)
- TREE_TYPE (init) = TYPE_MAIN_VARIANT (itype);
- }
- if (init && TREE_TYPE (init) == NULL_TREE)
- {
- /* Handle bad initializers like:
- class COMPLEX {
- public:
- double re, im;
- COMPLEX(double r = 0.0, double i = 0.0) {re = r; im = i;};
- ~COMPLEX() {};
- };
-
- int main(int argc, char **argv) {
- COMPLEX zees(1.0, 0.0)[10];
- }
- */
- error ("bad array initializer");
- return;
- }
- expand_vec_init (exp, exp, array_type_nelts (type), init,
- init && comptypes (TREE_TYPE (init), TREE_TYPE (exp), 1));
- TREE_READONLY (exp) = was_const;
- TREE_THIS_VOLATILE (exp) = was_volatile;
- TREE_TYPE (exp) = type;
- if (init)
- TREE_TYPE (init) = itype;
- return;
- }
-
- if (TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == PARM_DECL)
- /* just know that we've seen something for this node */
- TREE_USED (exp) = 1;
-
-#if 0
- /* If initializing from a GNU C CONSTRUCTOR, consider the elts in the
- constructor as parameters to an implicit GNU C++ constructor. */
- if (init && TREE_CODE (init) == CONSTRUCTOR
- && TYPE_HAS_CONSTRUCTOR (type)
- && TREE_TYPE (init) == type)
- init = CONSTRUCTOR_ELTS (init);
-#endif
-
- TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
- expand_aggr_init_1 (TYPE_BINFO (type), exp, exp,
- init, alias_this, LOOKUP_NORMAL|flags);
- TREE_TYPE (exp) = type;
- TREE_READONLY (exp) = was_const;
- TREE_THIS_VOLATILE (exp) = was_volatile;
-}
-
-static void
-expand_default_init (binfo, true_exp, exp, init, alias_this, flags)
- tree binfo;
- tree true_exp, exp;
- tree init;
- int alias_this;
- int flags;
-{
- tree type = TREE_TYPE (exp);
-
- /* It fails because there may not be a constructor which takes
- its own type as the first (or only parameter), but which does
- take other types via a conversion. So, if the thing initializing
- the expression is a unit element of type X, first try X(X&),
- followed by initialization by X. If neither of these work
- out, then look hard. */
- tree rval;
- tree parms;
-
- if (flag_ansi_overloading && init && TREE_CODE (init) != TREE_LIST
- && (flags & LOOKUP_ONLYCONVERTING))
- {
- /* Base subobjects should only get direct-initialization. */
- if (true_exp != exp)
- abort ();
-
- /* We special-case TARGET_EXPRs here to avoid an error about
- private copy constructors for temporaries bound to reference vars.
- If the TARGET_EXPR represents a call to a function that has
- permission to create such objects, a reference can bind directly
- to the return value. An object variable must be initialized
- via the copy constructor, even if the call is elided. */
- if (! (TREE_CODE (exp) == VAR_DECL && DECL_ARTIFICIAL (exp)
- && TREE_CODE (init) == TARGET_EXPR && TREE_TYPE (init) == type))
- init = cp_convert (type, init, CONV_IMPLICIT|CONV_FORCE_TEMP, flags);
-
- expand_assignment (exp, init, 0, 0);
- return;
- }
-
- if (init == NULL_TREE
- || (TREE_CODE (init) == TREE_LIST && ! TREE_TYPE (init)))
- {
- parms = init;
- if (parms)
- init = TREE_VALUE (parms);
- }
- else if (! flag_ansi_overloading
- && TREE_CODE (init) == INDIRECT_REF && TREE_HAS_CONSTRUCTOR (init)
- && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (init)))
- {
- rval = convert_for_initialization (exp, type, init, 0, 0, 0, 0);
- TREE_USED (rval) = 1;
- expand_expr_stmt (rval);
- return;
- }
- else
- parms = build_tree_list (NULL_TREE, init);
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- {
- if (true_exp == exp)
- parms = tree_cons (NULL_TREE, integer_one_node, parms);
- else
- parms = tree_cons (NULL_TREE, integer_zero_node, parms);
- flags |= LOOKUP_HAS_IN_CHARGE;
- }
-
- if (flag_ansi_overloading)
- {
- rval = build_method_call (exp, ctor_identifier,
- parms, binfo, flags);
- expand_expr_stmt (rval);
- return;
- }
-
- if (init && TREE_CHAIN (parms) == NULL_TREE
- && TYPE_HAS_TRIVIAL_INIT_REF (type)
- && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (init)))
- {
- rval = build (INIT_EXPR, type, exp, init);
- TREE_SIDE_EFFECTS (rval) = 1;
- expand_expr_stmt (rval);
- }
- else
- {
- if (flags & LOOKUP_ONLYCONVERTING)
- flags |= LOOKUP_NO_CONVERSION;
- rval = build_method_call (exp, ctor_identifier,
- parms, binfo, flags);
-
- /* Private, protected, or otherwise unavailable. */
- if (rval == error_mark_node)
- {
- if (flags & LOOKUP_COMPLAIN)
- cp_error ("in base initialization for %sclass `%T'",
- TREE_VIA_VIRTUAL (binfo) ? "virtual base " : "",
- binfo);
- }
- else if (rval == NULL_TREE)
- my_friendly_abort (361);
- else
- {
- /* p. 222: if the base class assigns to `this', then that
- value is used in the derived class. */
- if ((flag_this_is_variable & 1) && alias_this)
- {
- TREE_TYPE (rval) = TREE_TYPE (current_class_ptr);
- expand_assignment (current_class_ptr, rval, 0, 0);
- }
- else
- expand_expr_stmt (rval);
- }
- }
-}
-
-/* This function is responsible for initializing EXP with INIT
- (if any).
-
- BINFO is the binfo of the type for who we are performing the
- initialization. For example, if W is a virtual base class of A and B,
- and C : A, B.
- If we are initializing B, then W must contain B's W vtable, whereas
- were we initializing C, W must contain C's W vtable.
-
- TRUE_EXP is nonzero if it is the true expression being initialized.
- In this case, it may be EXP, or may just contain EXP. The reason we
- need this is because if EXP is a base element of TRUE_EXP, we
- don't necessarily know by looking at EXP where its virtual
- baseclass fields should really be pointing. But we do know
- from TRUE_EXP. In constructors, we don't know anything about
- the value being initialized.
-
- ALIAS_THIS serves the same purpose it serves for expand_aggr_init.
-
- FLAGS is just passes to `build_method_call'. See that function for
- its description. */
-
-static void
-expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
- tree binfo;
- tree true_exp, exp;
- tree init;
- int alias_this;
- int flags;
-{
- tree type = TREE_TYPE (exp);
- tree init_type = NULL_TREE;
-
- my_friendly_assert (init != error_mark_node && type != error_mark_node, 211);
-
- /* Use a function returning the desired type to initialize EXP for us.
- If the function is a constructor, and its first argument is
- NULL_TREE, know that it was meant for us--just slide exp on
- in and expand the constructor. Constructors now come
- as TARGET_EXPRs. */
-
- if (init && TREE_CODE (exp) == VAR_DECL
- && TREE_CODE (init) == CONSTRUCTOR
- && TREE_HAS_CONSTRUCTOR (init))
- {
- tree t = store_init_value (exp, init);
- if (!t)
- {
- expand_decl_init (exp);
- return;
- }
- t = build (INIT_EXPR, type, exp, init);
- TREE_SIDE_EFFECTS (t) = 1;
- expand_expr_stmt (t);
- return;
- }
-
- if (init && ! flag_ansi_overloading)
- {
- tree init_list = NULL_TREE;
-
- if (TREE_CODE (init) == TREE_LIST)
- {
- init_list = init;
- if (TREE_CHAIN (init) == NULL_TREE)
- init = TREE_VALUE (init);
- }
-
- init_type = TREE_TYPE (init);
-
- if (TREE_CODE (init) != TREE_LIST)
- {
- if (init_type == error_mark_node)
- return;
-
- /* This happens when we use C++'s functional cast notation.
- If the types match, then just use the TARGET_EXPR
- directly. Otherwise, we need to create the initializer
- separately from the object being initialized. */
- if (TREE_CODE (init) == TARGET_EXPR)
- {
- if (TYPE_MAIN_VARIANT (init_type) == TYPE_MAIN_VARIANT (type))
- {
- if (TREE_CODE (exp) == VAR_DECL
- || TREE_CODE (exp) == RESULT_DECL)
- /* Unify the initialization targets. */
- DECL_RTL (TREE_OPERAND (init, 0)) = DECL_RTL (exp);
- else
- DECL_RTL (TREE_OPERAND (init, 0)) = expand_expr (exp, NULL_RTX, VOIDmode, 0);
-
- expand_expr_stmt (init);
- return;
- }
- }
-
- if (init_type == type && TREE_CODE (init) == CALL_EXPR)
- {
- /* A CALL_EXPR is a legitimate form of initialization, so
- we should not print this warning message. */
-
- expand_assignment (exp, init, 0, 0);
- if (exp == DECL_RESULT (current_function_decl))
- {
- /* Failing this assertion means that the return value
- from receives multiple initializations. */
- my_friendly_assert (DECL_INITIAL (exp) == NULL_TREE
- || DECL_INITIAL (exp) == error_mark_node,
- 212);
- DECL_INITIAL (exp) = init;
- }
- return;
- }
- else if (init_type == type
- && TREE_CODE (init) == COND_EXPR)
- {
- /* Push value to be initialized into the cond, where possible.
- Avoid spurious warning messages when initializing the
- result of this function. */
- TREE_OPERAND (init, 1)
- = build_modify_expr (exp, INIT_EXPR, TREE_OPERAND (init, 1));
- if (exp == DECL_RESULT (current_function_decl))
- DECL_INITIAL (exp) = NULL_TREE;
- TREE_OPERAND (init, 2)
- = build_modify_expr (exp, INIT_EXPR, TREE_OPERAND (init, 2));
- if (exp == DECL_RESULT (current_function_decl))
- DECL_INITIAL (exp) = init;
- TREE_SIDE_EFFECTS (init) = 1;
- expand_expr (init, const0_rtx, VOIDmode, 0);
- free_temp_slots ();
- return;
- }
- }
-
- /* We did not know what we were initializing before. Now we do. */
- if (TREE_CODE (init) == TARGET_EXPR)
- {
- tree tmp = TREE_OPERAND (TREE_OPERAND (init, 1), 1);
-
- if (tmp && TREE_CODE (TREE_VALUE (tmp)) == NOP_EXPR
- && TREE_OPERAND (TREE_VALUE (tmp), 0) == integer_zero_node)
- {
- /* In order for this to work for RESULT_DECLs, if their
- type has a constructor, then they must be BLKmode
- so that they will be meaningfully addressable. */
- tree arg = build_unary_op (ADDR_EXPR, exp, 0);
- init = TREE_OPERAND (init, 1);
- init = build (CALL_EXPR, build_pointer_type (TREE_TYPE (init)),
- TREE_OPERAND (init, 0), TREE_OPERAND (init, 1), NULL_TREE);
- TREE_SIDE_EFFECTS (init) = 1;
- TREE_VALUE (TREE_OPERAND (init, 1))
- = convert_pointer_to (TREE_TYPE (TREE_TYPE (TREE_VALUE (tmp))), arg);
-
- if (alias_this)
- {
- expand_assignment (current_function_decl, init, 0, 0);
- return;
- }
- if (exp == DECL_RESULT (current_function_decl))
- {
- if (DECL_INITIAL (DECL_RESULT (current_function_decl)))
- fatal ("return value from function receives multiple initializations");
- DECL_INITIAL (exp) = init;
- }
- expand_expr_stmt (init);
- return;
- }
- }
-
- /* Handle this case: when calling a constructor: xyzzy foo(bar);
- which really means: xyzzy foo = bar; Ugh!
-
- More useful for this case: xyzzy *foo = new xyzzy (bar); */
-
- if (! TYPE_NEEDS_CONSTRUCTING (type) && ! IS_AGGR_TYPE (type))
- {
- if (init_list && TREE_CHAIN (init_list))
- {
- warning ("initializer list being treated as compound expression");
- init = convert (type, build_compound_expr (init_list));
- if (init == error_mark_node)
- return;
- }
-
- expand_assignment (exp, init, 0, 0);
-
- return;
- }
-
- /* If this is copy-initialization, see whether we can go through a
- type conversion operator. */
- if (TREE_CODE (init) != TREE_LIST && (flags & LOOKUP_ONLYCONVERTING))
- {
- tree ttype = TREE_CODE (init_type) == REFERENCE_TYPE
- ? TREE_TYPE (init_type) : init_type;
-
- if (ttype != type && IS_AGGR_TYPE (ttype))
- {
- tree rval = build_type_conversion (CONVERT_EXPR, type, init, 1);
-
- if (rval)
- {
- /* See if there is a constructor for``type'' that takes a
- ``ttype''-typed object. */
- tree parms = build_tree_list (NULL_TREE, init);
- tree as_cons = NULL_TREE;
- if (TYPE_HAS_CONSTRUCTOR (type))
- as_cons = build_method_call (exp, ctor_identifier,
- parms, binfo,
- LOOKUP_SPECULATIVELY|LOOKUP_NO_CONVERSION);
- if (as_cons != NULL_TREE && as_cons != error_mark_node)
- /* ANSI C++ June 5 1992 WP 12.3.2.6.1 */
- cp_error ("ambiguity between conversion to `%T' and constructor",
- type);
- else
- if (rval != error_mark_node)
- expand_aggr_init_1 (binfo, true_exp, exp, rval, alias_this, flags);
- return;
- }
- }
- }
- }
-
- /* We know that expand_default_init can handle everything we want
- at this point. */
- expand_default_init (binfo, true_exp, exp, init, alias_this, flags);
-}
-
-/* Report an error if NAME is not the name of a user-defined,
- aggregate type. If OR_ELSE is nonzero, give an error message. */
-
-int
-is_aggr_typedef (name, or_else)
- tree name;
- int or_else;
-{
- tree type;
-
- if (name == error_mark_node)
- return 0;
-
- if (IDENTIFIER_HAS_TYPE_VALUE (name))
- type = IDENTIFIER_TYPE_VALUE (name);
- else
- {
- if (or_else)
- cp_error ("`%T' is not an aggregate typedef", name);
- return 0;
- }
-
- if (! IS_AGGR_TYPE (type)
- && TREE_CODE (type) != TEMPLATE_TYPE_PARM)
- {
- if (or_else)
- cp_error ("`%T' is not an aggregate type", type);
- return 0;
- }
- return 1;
-}
-
-/* Report an error if TYPE is not a user-defined, aggregate type. If
- OR_ELSE is nonzero, give an error message. */
-
-int
-is_aggr_type (type, or_else)
- tree type;
- int or_else;
-{
- if (type == error_mark_node)
- return 0;
-
- if (! IS_AGGR_TYPE (type)
- && TREE_CODE (type) != TEMPLATE_TYPE_PARM)
- {
- if (or_else)
- cp_error ("`%T' is not an aggregate type", type);
- return 0;
- }
- return 1;
-}
-
-/* Like is_aggr_typedef, but returns typedef if successful. */
-
-tree
-get_aggr_from_typedef (name, or_else)
- tree name;
- int or_else;
-{
- tree type;
-
- if (name == error_mark_node)
- return NULL_TREE;
-
- if (IDENTIFIER_HAS_TYPE_VALUE (name))
- type = IDENTIFIER_TYPE_VALUE (name);
- else
- {
- if (or_else)
- cp_error ("`%T' fails to be an aggregate typedef", name);
- return NULL_TREE;
- }
-
- if (! IS_AGGR_TYPE (type)
- && TREE_CODE (type) != TEMPLATE_TYPE_PARM)
- {
- if (or_else)
- cp_error ("type `%T' is of non-aggregate type", type);
- return NULL_TREE;
- }
- return type;
-}
-
-tree
-get_type_value (name)
- tree name;
-{
- if (name == error_mark_node)
- return NULL_TREE;
-
- if (IDENTIFIER_HAS_TYPE_VALUE (name))
- return IDENTIFIER_TYPE_VALUE (name);
- else
- return NULL_TREE;
-}
-
-
-/* This code could just as well go in `class.c', but is placed here for
- modularity. */
-
-/* For an expression of the form TYPE :: NAME (PARMLIST), build
- the appropriate function call. */
-
-tree
-build_member_call (type, name, parmlist)
- tree type, name, parmlist;
-{
- tree t;
- tree method_name = name;
- int dtor = 0;
- int dont_use_this = 0;
- tree basetype_path, decl;
-
- if (TREE_CODE (method_name) == BIT_NOT_EXPR)
- {
- method_name = TREE_OPERAND (method_name, 0);
- dtor = 1;
- }
-
- /* This shouldn't be here, and build_member_call shouldn't appear in
- parse.y! (mrs) */
- if (type && TREE_CODE (type) == IDENTIFIER_NODE
- && get_aggr_from_typedef (type, 0) == 0)
- {
- tree ns = lookup_name (type, 0);
- if (ns && TREE_CODE (ns) == NAMESPACE_DECL)
- {
- return build_x_function_call (build_offset_ref (type, name), parmlist, current_class_ref);
- }
- }
-
- if (type == NULL_TREE || ! is_aggr_type (type, 1))
- return error_mark_node;
-
- /* An operator we did not like. */
- if (name == NULL_TREE)
- return error_mark_node;
-
- if (dtor)
- {
- cp_error ("cannot call destructor `%T::~%T' without object", type,
- method_name);
- return error_mark_node;
- }
-
- /* No object? Then just fake one up, and let build_method_call
- figure out what to do. */
- if (current_class_type == 0
- || get_base_distance (type, current_class_type, 0, &basetype_path) == -1)
- dont_use_this = 1;
-
- if (dont_use_this)
- {
- basetype_path = TYPE_BINFO (type);
- decl = build1 (NOP_EXPR, build_pointer_type (type), error_mark_node);
- }
- else if (current_class_ptr == 0)
- {
- dont_use_this = 1;
- decl = build1 (NOP_EXPR, build_pointer_type (type), error_mark_node);
- }
- else
- {
- tree olddecl = current_class_ptr;
- tree oldtype = TREE_TYPE (TREE_TYPE (olddecl));
- if (oldtype != type)
- {
- tree newtype = build_type_variant (type, TYPE_READONLY (oldtype),
- TYPE_VOLATILE (oldtype));
- decl = convert_force (build_pointer_type (newtype), olddecl, 0);
- }
- else
- decl = olddecl;
- }
-
- decl = build_indirect_ref (decl, NULL_PTR);
-
- if (method_name == constructor_name (type)
- || method_name == constructor_name_full (type))
- return build_functional_cast (type, parmlist);
- if (t = lookup_fnfields (basetype_path, method_name, 0))
- return build_method_call (decl, method_name, parmlist, basetype_path,
- LOOKUP_NORMAL|LOOKUP_NONVIRTUAL);
- if (TREE_CODE (name) == IDENTIFIER_NODE
- && ((t = lookup_field (TYPE_BINFO (type), name, 1, 0))))
- {
- if (t == error_mark_node)
- return error_mark_node;
- if (TREE_CODE (t) == FIELD_DECL)
- {
- if (dont_use_this)
- {
- cp_error ("invalid use of non-static field `%D'", t);
- return error_mark_node;
- }
- decl = build (COMPONENT_REF, TREE_TYPE (t), decl, t);
- }
- else if (TREE_CODE (t) == VAR_DECL)
- decl = t;
- else
- {
- cp_error ("invalid use of member `%D'", t);
- return error_mark_node;
- }
- if (TYPE_LANG_SPECIFIC (TREE_TYPE (decl))
- && TYPE_OVERLOADS_CALL_EXPR (TREE_TYPE (decl)))
- return build_opfncall (CALL_EXPR, LOOKUP_NORMAL, decl, parmlist, NULL_TREE);
- return build_function_call (decl, parmlist);
- }
- else
- {
- cp_error ("no method `%T::%D'", type, name);
- return error_mark_node;
- }
-}
-
-/* Build a reference to a member of an aggregate. This is not a
- C++ `&', but really something which can have its address taken,
- and then act as a pointer to member, for example TYPE :: FIELD
- can have its address taken by saying & TYPE :: FIELD.
-
- @@ Prints out lousy diagnostics for operator <typename>
- @@ fields.
-
- @@ This function should be rewritten and placed in search.c. */
-
-tree
-build_offset_ref (type, name)
- tree type, name;
-{
- tree decl, fnfields, fields, t = error_mark_node;
- tree basebinfo = NULL_TREE;
- int dtor = 0;
-
- if (processing_template_decl)
- return build_min_nt (SCOPE_REF, type, name);
-
- /* Handle namespace names fully here. */
- if (TREE_CODE (type) == IDENTIFIER_NODE
- && get_aggr_from_typedef (type, 0) == 0)
- {
- tree ns = lookup_name (type, 0);
- tree val;
- if (ns && TREE_CODE (ns) == NAMESPACE_DECL)
- {
- val = lookup_namespace_name (ns, name);
- if (val)
- return val;
- cp_error ("namespace `%D' has no member named `%D'", ns, name);
- return error_mark_node;
- }
- }
-
- if (type == NULL_TREE || ! is_aggr_type (type, 1))
- return error_mark_node;
-
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- dtor = 1;
- name = TREE_OPERAND (name, 0);
- }
-
- if (name == constructor_name_full (type))
- name = constructor_name (type);
-
- if (TYPE_SIZE (complete_type (type)) == 0)
- {
- if (type == current_class_type)
- t = IDENTIFIER_CLASS_VALUE (name);
- else
- t = NULL_TREE;
- if (t == 0)
- {
- cp_error ("incomplete type `%T' does not have member `%D'", type,
- name);
- return error_mark_node;
- }
- if (TREE_CODE (t) == TYPE_DECL || TREE_CODE (t) == VAR_DECL
- || TREE_CODE (t) == CONST_DECL)
- {
- mark_used (t);
- return t;
- }
- if (TREE_CODE (t) == FIELD_DECL)
- sorry ("use of member in incomplete aggregate type");
- else if (TREE_CODE (t) == FUNCTION_DECL)
- sorry ("use of member function in incomplete aggregate type");
- else
- my_friendly_abort (52);
- return error_mark_node;
- }
-
- if (current_class_type == 0
- || get_base_distance (type, current_class_type, 0, &basebinfo) == -1)
- {
- basebinfo = TYPE_BINFO (type);
- decl = build1 (NOP_EXPR, type, error_mark_node);
- }
- else if (current_class_ptr == 0)
- decl = build1 (NOP_EXPR, type, error_mark_node);
- else
- decl = current_class_ref;
-
- if (constructor_name (BINFO_TYPE (basebinfo)) == name)
- if (dtor)
- name = dtor_identifier;
- else
- name = ctor_identifier;
- else
- if (dtor)
- my_friendly_abort (999);
-
-
- fnfields = lookup_fnfields (basebinfo, name, 1);
- fields = lookup_field (basebinfo, name, 0, 0);
-
- if (fields == error_mark_node || fnfields == error_mark_node)
- return error_mark_node;
-
- /* A lot of this logic is now handled in lookup_field and
- lookup_fnfield. */
- if (fnfields)
- {
- extern int flag_save_memoized_contexts;
- basebinfo = TREE_PURPOSE (fnfields);
-
- /* Go from the TREE_BASELINK to the member function info. */
- t = TREE_VALUE (fnfields);
-
- if (DECL_CHAIN (t) == NULL_TREE)
- {
- tree access;
-
- /* unique functions are handled easily. */
- unique:
- access = compute_access (basebinfo, t);
- if (access == access_protected_node)
- {
- cp_error_at ("member function `%#D' is protected", t);
- error ("in this context");
- return error_mark_node;
- }
- if (access == access_private_node)
- {
- cp_error_at ("member function `%#D' is private", t);
- error ("in this context");
- return error_mark_node;
- }
- mark_used (t);
- return build (OFFSET_REF, TREE_TYPE (t), decl, t);
- }
-
- /* FNFIELDS is most likely allocated on the search_obstack,
- which will go away after this class scope. If we need
- to save this value for later (either for memoization
- or for use as an initializer for a static variable), then
- do so here.
-
- ??? The smart thing to do for the case of saving initializers
- is to resolve them before we're done with this scope. */
- if (!TREE_PERMANENT (fnfields)
- && ((flag_save_memoized_contexts && global_bindings_p ())
- || ! allocation_temporary_p ()))
- fnfields = copy_list (fnfields);
-
- t = build_tree_list (error_mark_node, fnfields);
- TREE_TYPE (t) = build_offset_type (type, unknown_type_node);
- return t;
- }
-
- /* Now that we know we are looking for a field, see if we
- have access to that field. Lookup_field will give us the
- error message. */
-
- t = lookup_field (basebinfo, name, 1, 0);
-
- if (t == error_mark_node)
- return error_mark_node;
-
- if (t == NULL_TREE)
- {
- cp_error ("`%D' is not a member of type `%T'", name, type);
- return error_mark_node;
- }
-
- if (TREE_CODE (t) == TYPE_DECL)
- {
- TREE_USED (t) = 1;
- return t;
- }
- /* static class members and class-specific enum
- values can be returned without further ado. */
- if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == CONST_DECL)
- {
- mark_used (t);
- return t;
- }
-
- if (TREE_CODE (t) == FIELD_DECL && DECL_BIT_FIELD (t))
- {
- cp_error ("illegal pointer to bit field `%D'", t);
- return error_mark_node;
- }
-
- /* static class functions too. */
- if (TREE_CODE (t) == FUNCTION_DECL
- && TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
- my_friendly_abort (53);
-
- /* In member functions, the form `type::name' is no longer
- equivalent to `this->type::name', at least not until
- resolve_offset_ref. */
- return build (OFFSET_REF, build_offset_type (type, TREE_TYPE (t)), decl, t);
-}
-
-/* If a OFFSET_REF made it through to here, then it did
- not have its address taken. */
-
-tree
-resolve_offset_ref (exp)
- tree exp;
-{
- tree type = TREE_TYPE (exp);
- tree base = NULL_TREE;
- tree member;
- tree basetype, addr;
-
- if (TREE_CODE (exp) == TREE_LIST)
- return build_unary_op (ADDR_EXPR, exp, 0);
-
- if (TREE_CODE (exp) == OFFSET_REF)
- {
- member = TREE_OPERAND (exp, 1);
- base = TREE_OPERAND (exp, 0);
- }
- else
- {
- my_friendly_assert (TREE_CODE (type) == OFFSET_TYPE, 214);
- if (TYPE_OFFSET_BASETYPE (type) != current_class_type)
- {
- error ("object missing in use of pointer-to-member construct");
- return error_mark_node;
- }
- member = exp;
- type = TREE_TYPE (type);
- base = current_class_ref;
- }
-
- if ((TREE_CODE (member) == VAR_DECL
- && ! TYPE_PTRMEMFUNC_P (TREE_TYPE (member)))
- || TREE_CODE (TREE_TYPE (member)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (member)) == METHOD_TYPE)
- {
- /* These were static members. */
- if (mark_addressable (member) == 0)
- return error_mark_node;
- return member;
- }
-
- if (TREE_CODE (TREE_TYPE (member)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_TYPE (member))) == METHOD_TYPE)
- return member;
-
- /* Syntax error can cause a member which should
- have been seen as static to be grok'd as non-static. */
- if (TREE_CODE (member) == FIELD_DECL && current_class_ref == NULL_TREE)
- {
- if (TREE_ADDRESSABLE (member) == 0)
- {
- cp_error_at ("member `%D' is non-static but referenced as a static member",
- member);
- error ("at this point in file");
- TREE_ADDRESSABLE (member) = 1;
- }
- return error_mark_node;
- }
-
- /* The first case is really just a reference to a member of `this'. */
- if (TREE_CODE (member) == FIELD_DECL
- && (base == current_class_ref
- || (TREE_CODE (base) == NOP_EXPR
- && TREE_OPERAND (base, 0) == error_mark_node)))
- {
- tree basetype_path, access;
-
- if (TREE_CODE (exp) == OFFSET_REF && TREE_CODE (type) == OFFSET_TYPE)
- basetype = TYPE_OFFSET_BASETYPE (type);
- else
- basetype = DECL_CONTEXT (member);
-
- base = current_class_ptr;
-
- if (get_base_distance (basetype, TREE_TYPE (TREE_TYPE (base)), 0, &basetype_path) < 0)
- {
- error_not_base_type (basetype, TREE_TYPE (TREE_TYPE (base)));
- return error_mark_node;
- }
- addr = convert_pointer_to (basetype, base);
- access = compute_access (basetype_path, member);
- if (access == access_public_node)
- return build (COMPONENT_REF, TREE_TYPE (member),
- build_indirect_ref (addr, NULL_PTR), member);
- if (access == access_protected_node)
- {
- cp_error_at ("member `%D' is protected", member);
- error ("in this context");
- return error_mark_node;
- }
- if (access == access_private_node)
- {
- cp_error_at ("member `%D' is private", member);
- error ("in this context");
- return error_mark_node;
- }
- my_friendly_abort (55);
- }
-
- /* Ensure that we have an object. */
- if (TREE_CODE (base) == NOP_EXPR
- && TREE_OPERAND (base, 0) == error_mark_node)
- addr = error_mark_node;
- else
- {
- /* If this is a reference to a member function, then return the
- address of the member function (which may involve going
- through the object's vtable), otherwise, return an expression
- for the dereferenced pointer-to-member construct. */
- addr = build_unary_op (ADDR_EXPR, base, 0);
- }
-
- if (TREE_CODE (TREE_TYPE (member)) == OFFSET_TYPE)
- {
- if (addr == error_mark_node)
- {
- cp_error ("object missing in `%E'", exp);
- return error_mark_node;
- }
-
- basetype = TYPE_OFFSET_BASETYPE (TREE_TYPE (member));
- addr = convert_pointer_to (basetype, addr);
- member = convert (ptrdiff_type_node,
- build_unary_op (ADDR_EXPR, member, 0));
-
- /* Pointer to data mebers are offset by one, so that a null
- pointer with a real value of 0 is distinguishable from an
- offset of the first member of a structure. */
- member = build_binary_op (MINUS_EXPR, member,
- convert (ptrdiff_type_node, integer_one_node),
- 0);
-
- return build1 (INDIRECT_REF, type,
- build (PLUS_EXPR, build_pointer_type (type),
- addr, member));
- }
- else if (TYPE_PTRMEMFUNC_P (TREE_TYPE (member)))
- {
- return get_member_function_from_ptrfunc (&addr, member);
- }
- my_friendly_abort (56);
- /* NOTREACHED */
- return NULL_TREE;
-}
-
-/* Return either DECL or its known constant value (if it has one). */
-
-tree
-decl_constant_value (decl)
- tree decl;
-{
- if (! TREE_THIS_VOLATILE (decl)
-#if 0
- /* These may be necessary for C, but they break C++. */
- ! TREE_PUBLIC (decl)
- /* Don't change a variable array bound or initial value to a constant
- in a place where a variable is invalid. */
- && ! pedantic
-#endif /* 0 */
- && DECL_INITIAL (decl) != 0
- && DECL_INITIAL (decl) != error_mark_node
- /* This is invalid if initial value is not constant.
- If it has either a function call, a memory reference,
- or a variable, then re-evaluating it could give different results. */
- && TREE_CONSTANT (DECL_INITIAL (decl))
- /* Check for cases where this is sub-optimal, even though valid. */
- && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR
-#if 0
- /* We must allow this to work outside of functions so that
- static constants can be used for array sizes. */
- && current_function_decl != 0
- && DECL_MODE (decl) != BLKmode
-#endif
- )
- return DECL_INITIAL (decl);
- return decl;
-}
-
-/* Common subroutines of build_new and build_vec_delete. */
-
-/* Common interface for calling "builtin" functions that are not
- really builtin. */
-
-static tree
-build_builtin_call (type, node, arglist)
- tree type;
- tree node;
- tree arglist;
-{
- tree rval = build (CALL_EXPR, type, node, arglist, NULL_TREE);
- TREE_SIDE_EFFECTS (rval) = 1;
- assemble_external (TREE_OPERAND (node, 0));
- TREE_USED (TREE_OPERAND (node, 0)) = 1;
- return rval;
-}
-
-/* Generate a C++ "new" expression. DECL is either a TREE_LIST
- (which needs to go through some sort of groktypename) or it
- is the name of the class we are newing. INIT is an initialization value.
- It is either an EXPRLIST, an EXPR_NO_COMMAS, or something in braces.
- If INIT is void_type_node, it means do *not* call a constructor
- for this instance.
-
- For types with constructors, the data returned is initialized
- by the appropriate constructor.
-
- Whether the type has a constructor or not, if it has a pointer
- to a virtual function table, then that pointer is set up
- here.
-
- Unless I am mistaken, a call to new () will return initialized
- data regardless of whether the constructor itself is private or
- not. NOPE; new fails if the constructor is private (jcm).
-
- Note that build_new does nothing to assure that any special
- alignment requirements of the type are met. Rather, it leaves
- it up to malloc to do the right thing. Otherwise, folding to
- the right alignment cal cause problems if the user tries to later
- free the memory returned by `new'.
-
- PLACEMENT is the `placement' list for user-defined operator new (). */
-
-extern int flag_check_new;
-
-tree
-build_new (placement, decl, init, use_global_new)
- tree placement;
- tree decl, init;
- int use_global_new;
-{
- tree type, true_type, size, rval;
- tree nelts;
- tree alloc_expr;
- int has_array = 0;
- enum tree_code code = NEW_EXPR;
- int use_cookie, nothrow, check_new;
-
- tree pending_sizes = NULL_TREE;
-
- if (decl == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (decl) == TREE_LIST)
- {
- tree absdcl = TREE_VALUE (decl);
- tree last_absdcl = NULL_TREE;
- int old_immediate_size_expand;
-
- if (current_function_decl
- && DECL_CONSTRUCTOR_P (current_function_decl))
- {
- old_immediate_size_expand = immediate_size_expand;
- immediate_size_expand = 0;
- }
-
- nelts = integer_one_node;
-
- if (absdcl && TREE_CODE (absdcl) == CALL_EXPR)
- my_friendly_abort (215);
- while (absdcl && TREE_CODE (absdcl) == INDIRECT_REF)
- {
- last_absdcl = absdcl;
- absdcl = TREE_OPERAND (absdcl, 0);
- }
-
- if (absdcl && TREE_CODE (absdcl) == ARRAY_REF)
- {
- /* probably meant to be a vec new */
- tree this_nelts;
-
- while (TREE_OPERAND (absdcl, 0)
- && TREE_CODE (TREE_OPERAND (absdcl, 0)) == ARRAY_REF)
- {
- last_absdcl = absdcl;
- absdcl = TREE_OPERAND (absdcl, 0);
- }
-
- has_array = 1;
- this_nelts = TREE_OPERAND (absdcl, 1);
- if (this_nelts != error_mark_node)
- {
- if (this_nelts == NULL_TREE)
- error ("new of array type fails to specify size");
- else if (processing_template_decl)
- {
- nelts = this_nelts;
- absdcl = TREE_OPERAND (absdcl, 0);
- }
- else
- {
- this_nelts = save_expr (convert (sizetype, this_nelts));
- absdcl = TREE_OPERAND (absdcl, 0);
- if (this_nelts == integer_zero_node)
- {
- warning ("zero size array reserves no space");
- nelts = integer_zero_node;
- }
- else
- nelts = build_binary_op (MULT_EXPR, nelts, this_nelts, 1);
- }
- }
- else
- nelts = integer_zero_node;
- }
-
- if (last_absdcl)
- TREE_OPERAND (last_absdcl, 0) = absdcl;
- else
- TREE_VALUE (decl) = absdcl;
-
- type = true_type = groktypename (decl);
- if (! type || type == error_mark_node)
- {
- immediate_size_expand = old_immediate_size_expand;
- return error_mark_node;
- }
-
- if (current_function_decl
- && DECL_CONSTRUCTOR_P (current_function_decl))
- {
- pending_sizes = get_pending_sizes ();
- immediate_size_expand = old_immediate_size_expand;
- }
- }
- else if (TREE_CODE (decl) == IDENTIFIER_NODE)
- {
- if (IDENTIFIER_HAS_TYPE_VALUE (decl))
- {
- /* An aggregate type. */
- type = IDENTIFIER_TYPE_VALUE (decl);
- decl = TYPE_MAIN_DECL (type);
- }
- else
- {
- /* A builtin type. */
- decl = lookup_name (decl, 1);
- my_friendly_assert (TREE_CODE (decl) == TYPE_DECL, 215);
- type = TREE_TYPE (decl);
- }
- true_type = type;
- }
- else if (TREE_CODE (decl) == TYPE_DECL)
- {
- type = TREE_TYPE (decl);
- true_type = type;
- }
- else
- {
- type = decl;
- true_type = type;
- decl = TYPE_MAIN_DECL (type);
- }
-
- if (processing_template_decl)
- {
- tree t;
- if (has_array)
- t = min_tree_cons (min_tree_cons (NULL_TREE, type, NULL_TREE),
- build_min_nt (ARRAY_REF, NULL_TREE, nelts),
- NULL_TREE);
- else
- t = type;
-
- rval = build_min_nt (NEW_EXPR, placement, t, init);
- NEW_EXPR_USE_GLOBAL (rval) = use_global_new;
- return rval;
- }
-
- /* ``A reference cannot be created by the new operator. A reference
- is not an object (8.2.2, 8.4.3), so a pointer to it could not be
- returned by new.'' ARM 5.3.3 */
- if (TREE_CODE (type) == REFERENCE_TYPE)
- {
- error ("new cannot be applied to a reference type");
- type = true_type = TREE_TYPE (type);
- }
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- {
- error ("new cannot be applied to a function type");
- return error_mark_node;
- }
-
- /* When the object being created is an array, the new-expression yields a
- pointer to the initial element (if any) of the array. For example,
- both new int and new int[10] return an int*. 5.3.4. */
- if (TREE_CODE (type) == ARRAY_TYPE && has_array == 0)
- {
- nelts = array_type_nelts_top (type);
- has_array = 1;
- type = true_type = TREE_TYPE (type);
- }
-
- if (TYPE_READONLY (type) || TYPE_VOLATILE (type))
- type = TYPE_MAIN_VARIANT (type);
-
- /* If our base type is an array, then make sure we know how many elements
- it has. */
- while (TREE_CODE (true_type) == ARRAY_TYPE)
- {
- tree this_nelts = array_type_nelts_top (true_type);
- nelts = build_binary_op (MULT_EXPR, nelts, this_nelts, 1);
- true_type = TREE_TYPE (true_type);
- }
-
- if (TYPE_SIZE (complete_type (true_type)) == 0)
- {
- incomplete_type_error (0, true_type);
- return error_mark_node;
- }
-
- if (has_array)
- size = fold (build_binary_op (MULT_EXPR, size_in_bytes (true_type),
- nelts, 1));
- else
- size = size_in_bytes (type);
-
- if (true_type == void_type_node)
- {
- error ("invalid type `void' for new");
- return error_mark_node;
- }
-
- if (TYPE_LANG_SPECIFIC (true_type)
- && CLASSTYPE_ABSTRACT_VIRTUALS (true_type))
- {
- abstract_virtuals_error (NULL_TREE, true_type);
- return error_mark_node;
- }
-
- if (TYPE_LANG_SPECIFIC (true_type) && IS_SIGNATURE (true_type))
- {
- signature_error (NULL_TREE, true_type);
- return error_mark_node;
- }
-
- nothrow = (placement
- && TREE_TYPE (placement)
- && IS_AGGR_TYPE (TREE_TYPE (placement))
- && (TYPE_IDENTIFIER (TREE_TYPE (placement))
- == get_identifier ("nothrow_t")));
-
- check_new = flag_check_new || nothrow;
-
-#if 1
- /* Get a little extra space to store a couple of things before the new'ed
- array, if this isn't the default placement new. */
-
- use_cookie = (has_array && TYPE_VEC_NEW_USES_COOKIE (true_type)
- && ! (placement && ! TREE_CHAIN (placement)
- && TREE_TYPE (TREE_VALUE (placement)) == ptr_type_node));
-#else
- /* Get a little extra space to store a couple of things before the new'ed
- array, if this is either non-placement new or new (nothrow). */
-
- use_cookie = (has_array && TYPE_VEC_NEW_USES_COOKIE (true_type)
- && (! placement || nothrow));
-#endif
-
- if (use_cookie)
- {
- tree extra = BI_header_size;
-
- size = size_binop (PLUS_EXPR, size, extra);
- }
-
- if (has_array)
- {
- code = VEC_NEW_EXPR;
-
- if (init && pedantic)
- cp_pedwarn ("initialization in array new");
- }
-
- /* Allocate the object. */
- if (! use_global_new && TYPE_LANG_SPECIFIC (true_type)
- && (TYPE_GETS_NEW (true_type) & (1 << has_array)))
- rval = build_opfncall (code, LOOKUP_NORMAL,
- build_pointer_type (true_type), size, placement);
- else if (placement)
- {
- rval = build_opfncall (code, LOOKUP_GLOBAL|LOOKUP_COMPLAIN,
- ptr_type_node, size, placement);
- rval = convert (build_pointer_type (true_type), rval);
- }
- else if (! has_array && flag_this_is_variable > 0
- && TYPE_NEEDS_CONSTRUCTING (true_type) && init != void_type_node)
- {
- if (init == NULL_TREE || TREE_CODE (init) == TREE_LIST)
- rval = NULL_TREE;
- else
- {
- error ("constructors take parameter lists");
- return error_mark_node;
- }
- }
- else
- {
- rval = build_builtin_call (build_pointer_type (true_type),
- has_array ? BIVN : BIN,
- build_tree_list (NULL_TREE, size));
- TREE_CALLS_NEW (rval) = 1;
- }
-
- if (check_new && rval)
- alloc_expr = rval = save_expr (rval);
- else
- alloc_expr = NULL_TREE;
-
- /* if rval is NULL_TREE I don't have to allocate it, but are we totally
- sure we have some extra bytes in that case for the BI_header_size
- cookies? And how does that interact with the code below? (mrs) */
- /* Finish up some magic for new'ed arrays */
- if (use_cookie && rval != NULL_TREE)
- {
- tree extra = BI_header_size;
- tree cookie, exp1;
- rval = convert (ptr_type_node, rval); /* convert to void * first */
- rval = convert (string_type_node, rval); /* lets not add void* and ints */
- rval = save_expr (build_binary_op (PLUS_EXPR, rval, extra, 1));
- /* Store header info. */
- cookie = build_indirect_ref (build (MINUS_EXPR, build_pointer_type (BI_header_type),
- rval, extra), NULL_PTR);
- exp1 = build (MODIFY_EXPR, void_type_node,
- build_component_ref (cookie, nc_nelts_field_id, NULL_TREE, 0),
- nelts);
- TREE_SIDE_EFFECTS (exp1) = 1;
- rval = convert (build_pointer_type (true_type), rval);
- TREE_CALLS_NEW (rval) = 1;
- TREE_SIDE_EFFECTS (rval) = 1;
- rval = build_compound_expr (tree_cons (NULL_TREE, exp1,
- build_tree_list (NULL_TREE, rval)));
- }
-
- if (rval == error_mark_node)
- return error_mark_node;
-
- /* Don't call any constructors or do any initialization. */
- if (init == void_type_node)
- goto done;
-
- if (TYPE_NEEDS_CONSTRUCTING (type) || init)
- {
- if (! TYPE_NEEDS_CONSTRUCTING (type)
- && ! IS_AGGR_TYPE (type) && ! has_array)
- {
- /* New 2.0 interpretation: `new int (10)' means
- allocate an int, and initialize it with 10. */
- tree deref;
-
- rval = save_expr (rval);
- deref = build_indirect_ref (rval, NULL_PTR);
- TREE_READONLY (deref) = 0;
-
- if (TREE_CHAIN (init) != NULL_TREE)
- pedwarn ("initializer list being treated as compound expression");
- else if (TREE_CODE (init) == CONSTRUCTOR)
- {
- pedwarn ("initializer list appears where operand should be used");
- init = TREE_OPERAND (init, 1);
- }
- init = build_compound_expr (init);
-
- init = convert_for_initialization (deref, type, init, LOOKUP_NORMAL,
- "new", NULL_TREE, 0);
- rval = build (COMPOUND_EXPR, TREE_TYPE (rval),
- build_modify_expr (deref, NOP_EXPR, init),
- rval);
- TREE_NO_UNUSED_WARNING (rval) = 1;
- TREE_SIDE_EFFECTS (rval) = 1;
- TREE_CALLS_NEW (rval) = 1;
- }
- else if (! has_array)
- {
- tree newrval;
- /* Constructors are never virtual. If it has an initialization, we
- need to complain if we aren't allowed to use the ctor that took
- that argument. */
- int flags = LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_COMPLAIN;
-
- if (rval && TYPE_USES_VIRTUAL_BASECLASSES (true_type))
- {
- init = tree_cons (NULL_TREE, integer_one_node, init);
- flags |= LOOKUP_HAS_IN_CHARGE;
- }
-
- newrval = rval;
-
- if (newrval && TREE_CODE (TREE_TYPE (newrval)) == POINTER_TYPE)
- newrval = build_indirect_ref (newrval, NULL_PTR);
-
- newrval = build_method_call (newrval, ctor_identifier,
- init, TYPE_BINFO (true_type), flags);
-
- if (newrval)
- {
- rval = newrval;
- TREE_HAS_CONSTRUCTOR (rval) = 1;
- }
- else
- rval = error_mark_node;
- }
- else
- rval = build (VEC_INIT_EXPR, TREE_TYPE (rval),
- save_expr (rval), init, nelts);
-#if 0
- else if (current_function_decl == NULL_TREE)
- {
- extern tree static_aggregates;
-
- /* In case of static initialization, SAVE_EXPR is good enough. */
- rval = save_expr (rval);
- rval = copy_to_permanent (rval);
- init = copy_to_permanent (init);
- init = expand_vec_init (decl, rval,
- build_binary_op (MINUS_EXPR, nelts,
- integer_one_node, 1),
- init, 0);
- init = copy_to_permanent (init);
- static_aggregates = perm_tree_cons (init, rval, static_aggregates);
- }
- else
- {
- /* Have to wrap this in RTL_EXPR for two cases:
- in base or member initialization and if we
- are a branch of a ?: operator. Since we
- can't easily know the latter, just do it always. */
- tree xval = make_node (RTL_EXPR);
-
- /* If we want to check the value of the allocation expression,
- and the number of elements in the array is not a constant, we
- *must* expand the SAVE_EXPR for nelts in alloc_expr before we
- expand it in the actual initialization. So we need to build up
- an RTL_EXPR for alloc_expr. Sigh. */
- if (alloc_expr && ! TREE_CONSTANT (nelts))
- {
- tree xval = make_node (RTL_EXPR);
- rtx rtxval;
- TREE_TYPE (xval) = TREE_TYPE (alloc_expr);
- do_pending_stack_adjust ();
- start_sequence_for_rtl_expr (xval);
- emit_note (0, -1);
- rtxval = expand_expr (alloc_expr, NULL_RTX, VOIDmode, 0);
- do_pending_stack_adjust ();
- TREE_SIDE_EFFECTS (xval) = 1;
- RTL_EXPR_SEQUENCE (xval) = get_insns ();
- end_sequence ();
- RTL_EXPR_RTL (xval) = rtxval;
- TREE_TYPE (xval) = TREE_TYPE (alloc_expr);
- alloc_expr = xval;
- }
-
- TREE_TYPE (xval) = TREE_TYPE (rval);
- do_pending_stack_adjust ();
- start_sequence_for_rtl_expr (xval);
-
- /* As a matter of principle, `start_sequence' should do this. */
- emit_note (0, -1);
-
- rval = save_expr (rval);
- rval = expand_vec_init (decl, rval,
- build_binary_op (MINUS_EXPR, nelts,
- integer_one_node, 1),
- init, 0);
-
- do_pending_stack_adjust ();
-
- TREE_SIDE_EFFECTS (xval) = 1;
- TREE_CALLS_NEW (xval) = 1;
- RTL_EXPR_SEQUENCE (xval) = get_insns ();
- end_sequence ();
-
- if (TREE_CODE (rval) == SAVE_EXPR)
- {
- /* Errors may cause this to not get evaluated. */
- if (SAVE_EXPR_RTL (rval) == 0)
- SAVE_EXPR_RTL (rval) = const0_rtx;
- RTL_EXPR_RTL (xval) = SAVE_EXPR_RTL (rval);
- }
- else
- {
- my_friendly_assert (TREE_CODE (rval) == VAR_DECL, 217);
- RTL_EXPR_RTL (xval) = DECL_RTL (rval);
- }
- rval = xval;
- }
-#endif
- }
- else if (TYPE_READONLY (true_type))
- cp_error ("uninitialized const in `new' of `%#T'", true_type);
-
- done:
-
- if (alloc_expr && rval != alloc_expr)
- {
- /* Did we modify the storage? */
- tree ifexp = build_binary_op (NE_EXPR, alloc_expr,
- integer_zero_node, 1);
- rval = build_conditional_expr (ifexp, rval, alloc_expr);
- }
-
- if (rval && TREE_TYPE (rval) != build_pointer_type (type))
- {
- /* The type of new int [3][3] is not int *, but int [3] * */
- rval = build_c_cast (build_pointer_type (type), rval);
- }
-
- if (pending_sizes)
- rval = build_compound_expr (chainon (pending_sizes,
- build_tree_list (NULL_TREE, rval)));
-
- return rval;
-}
-
-static tree
-build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
- use_global_delete)
- tree base, maxindex, type;
- tree auto_delete_vec, auto_delete;
- int use_global_delete;
-{
- tree virtual_size;
- tree ptype = build_pointer_type (type = complete_type (type));
- tree size_exp = size_in_bytes (type);
-
- /* Temporary variables used by the loop. */
- tree tbase, tbase_init;
-
- /* This is the body of the loop that implements the deletion of a
- single element, and moves temp variables to next elements. */
- tree body;
-
- /* This is the LOOP_EXPR that governs the deletion of the elements. */
- tree loop;
-
- /* This is the thing that governs what to do after the loop has run. */
- tree deallocate_expr = 0;
-
- /* This is the BIND_EXPR which holds the outermost iterator of the
- loop. It is convenient to set this variable up and test it before
- executing any other code in the loop.
- This is also the containing expression returned by this function. */
- tree controller = NULL_TREE;
-
- /* This is the BLOCK to record the symbol binding for debugging. */
- tree block;
-
- if (! IS_AGGR_TYPE (type) || ! TYPE_NEEDS_DESTRUCTOR (type))
- {
- loop = integer_zero_node;
- goto no_destructor;
- }
-
- /* The below is short by BI_header_size */
- virtual_size = fold (size_binop (MULT_EXPR, size_exp, maxindex));
-
- tbase = build_decl (VAR_DECL, NULL_TREE, ptype);
- tbase_init = build_modify_expr (tbase, NOP_EXPR,
- fold (build (PLUS_EXPR, ptype,
- base,
- virtual_size)));
- DECL_REGISTER (tbase) = 1;
- controller = build (BIND_EXPR, void_type_node, tbase, NULL_TREE, NULL_TREE);
- TREE_SIDE_EFFECTS (controller) = 1;
- block = build_block (tbase, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE);
- add_block_current_level (block);
-
- if (auto_delete != integer_zero_node
- && auto_delete != integer_two_node)
- {
- tree base_tbd = convert (ptype,
- build_binary_op (MINUS_EXPR,
- convert (ptr_type_node, base),
- BI_header_size,
- 1));
- /* This is the real size */
- virtual_size = size_binop (PLUS_EXPR, virtual_size, BI_header_size);
- body = build_tree_list (NULL_TREE,
- build_x_delete (ptype, base_tbd,
- 2 | use_global_delete,
- virtual_size));
- body = build (COND_EXPR, void_type_node,
- build (BIT_AND_EXPR, integer_type_node,
- auto_delete, integer_one_node),
- body, integer_zero_node);
- }
- else
- body = NULL_TREE;
-
- body = tree_cons (NULL_TREE,
- build_delete (ptype, tbase, auto_delete,
- LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 1),
- body);
-
- body = tree_cons (NULL_TREE,
- build_modify_expr (tbase, NOP_EXPR, build (MINUS_EXPR, ptype, tbase, size_exp)),
- body);
-
- body = tree_cons (NULL_TREE,
- build (EXIT_EXPR, void_type_node,
- build (EQ_EXPR, boolean_type_node, base, tbase)),
- body);
-
- loop = build (LOOP_EXPR, void_type_node, build_compound_expr (body));
-
- loop = tree_cons (NULL_TREE, tbase_init,
- tree_cons (NULL_TREE, loop, NULL_TREE));
- loop = build_compound_expr (loop);
-
- no_destructor:
- /* If the delete flag is one, or anything else with the low bit set,
- delete the storage. */
- if (auto_delete_vec == integer_zero_node
- || auto_delete_vec == integer_two_node)
- deallocate_expr = integer_zero_node;
- else
- {
- tree base_tbd;
-
- /* The below is short by BI_header_size */
- virtual_size = fold (size_binop (MULT_EXPR, size_exp, maxindex));
-
- if (! TYPE_VEC_NEW_USES_COOKIE (type))
- /* no header */
- base_tbd = base;
- else
- {
- base_tbd = convert (ptype,
- build_binary_op (MINUS_EXPR,
- convert (string_type_node, base),
- BI_header_size,
- 1));
- /* True size with header. */
- virtual_size = size_binop (PLUS_EXPR, virtual_size, BI_header_size);
- }
- deallocate_expr = build_x_delete (ptype, base_tbd,
- 2 | use_global_delete,
- virtual_size);
- if (auto_delete_vec != integer_one_node)
- deallocate_expr = build (COND_EXPR, void_type_node,
- build (BIT_AND_EXPR, integer_type_node,
- auto_delete_vec, integer_one_node),
- deallocate_expr, integer_zero_node);
- }
-
- if (loop && deallocate_expr != integer_zero_node)
- {
- body = tree_cons (NULL_TREE, loop,
- tree_cons (NULL_TREE, deallocate_expr, NULL_TREE));
- body = build_compound_expr (body);
- }
- else
- body = loop;
-
- /* Outermost wrapper: If pointer is null, punt. */
- body = build (COND_EXPR, void_type_node,
- build (NE_EXPR, boolean_type_node, base, integer_zero_node),
- body, integer_zero_node);
- body = build1 (NOP_EXPR, void_type_node, body);
-
- if (controller)
- {
- TREE_OPERAND (controller, 1) = body;
- return controller;
- }
- else
- return convert (void_type_node, body);
-}
-
-/* Build a tree to cleanup partially built arrays.
- BASE is that starting address of the array.
- COUNT is the count of objects that have been built, that need destroying.
- TYPE is the type of elements in the array. */
-
-static tree
-build_array_eh_cleanup (base, count, type)
- tree base, count, type;
-{
- tree expr = build_vec_delete_1 (base, count, type, integer_two_node,
- integer_zero_node, 0);
- return expr;
-}
-
-/* `expand_vec_init' performs initialization of a vector of aggregate
- types.
-
- DECL is passed only for error reporting, and provides line number
- and source file name information.
- BASE is the space where the vector will be.
- MAXINDEX is the maximum index of the array (one less than the
- number of elements).
- INIT is the (possibly NULL) initializer.
-
- FROM_ARRAY is 0 if we should init everything with INIT
- (i.e., every element initialized from INIT).
- FROM_ARRAY is 1 if we should index into INIT in parallel
- with initialization of DECL.
- FROM_ARRAY is 2 if we should index into INIT in parallel,
- but use assignment instead of initialization. */
-
-tree
-expand_vec_init (decl, base, maxindex, init, from_array)
- tree decl, base, maxindex, init;
- int from_array;
-{
- tree rval;
- tree iterator, base2 = NULL_TREE;
- tree type = TREE_TYPE (TREE_TYPE (base));
- tree size;
-
- maxindex = convert (ptrdiff_type_node, maxindex);
- if (maxindex == error_mark_node)
- return error_mark_node;
-
- if (current_function_decl == NULL_TREE)
- {
- rval = make_tree_vec (3);
- TREE_VEC_ELT (rval, 0) = base;
- TREE_VEC_ELT (rval, 1) = maxindex;
- TREE_VEC_ELT (rval, 2) = init;
- return rval;
- }
-
- size = size_in_bytes (type);
-
- /* Set to zero in case size is <= 0. Optimizer will delete this if
- it is not needed. */
- rval = get_temp_regvar (build_pointer_type (type),
- convert (build_pointer_type (type), null_pointer_node));
- base = default_conversion (base);
- base = convert (build_pointer_type (type), base);
- expand_assignment (rval, base, 0, 0);
- base = get_temp_regvar (build_pointer_type (type), base);
-
- if (init != NULL_TREE && TREE_CODE (init) == TREE_LIST)
- init = build_compound_expr (init);
-
- if (init != NULL_TREE
- && TREE_CODE (init) == CONSTRUCTOR
- && (! decl || TREE_TYPE (init) == TREE_TYPE (decl)))
- {
- /* Initialization of array from {...}. */
- tree elts = CONSTRUCTOR_ELTS (init);
- tree baseref = build1 (INDIRECT_REF, type, base);
- tree baseinc = build (PLUS_EXPR, build_pointer_type (type), base, size);
- int host_i = TREE_INT_CST_LOW (maxindex);
-
- if (IS_AGGR_TYPE (type))
- {
- while (elts)
- {
- host_i -= 1;
- expand_aggr_init (baseref, TREE_VALUE (elts), 0, 0);
-
- expand_assignment (base, baseinc, 0, 0);
- elts = TREE_CHAIN (elts);
- }
- /* Initialize any elements by default if possible. */
- if (host_i >= 0)
- {
- if (TYPE_NEEDS_CONSTRUCTING (type) == 0)
- {
- if (obey_regdecls)
- use_variable (DECL_RTL (base));
- goto done_init;
- }
-
- iterator = get_temp_regvar (ptrdiff_type_node,
- build_int_2 (host_i, 0));
- init = NULL_TREE;
- goto init_by_default;
- }
- }
- else
- while (elts)
- {
- expand_assignment (baseref, TREE_VALUE (elts), 0, 0);
-
- expand_assignment (base, baseinc, 0, 0);
- elts = TREE_CHAIN (elts);
- }
-
- if (obey_regdecls)
- use_variable (DECL_RTL (base));
- }
- else
- {
- tree itype;
-
- iterator = get_temp_regvar (ptrdiff_type_node, maxindex);
-
- init_by_default:
-
- /* If initializing one array from another,
- initialize element by element. */
- if (from_array)
- {
- /* We rely upon the below calls the do argument checking */
- if (decl == NULL_TREE)
- {
- sorry ("initialization of array from dissimilar array type");
- return error_mark_node;
- }
- if (init)
- {
- base2 = default_conversion (init);
- itype = TREE_TYPE (base2);
- base2 = get_temp_regvar (itype, base2);
- itype = TREE_TYPE (itype);
- }
- else if (TYPE_LANG_SPECIFIC (type)
- && TYPE_NEEDS_CONSTRUCTING (type)
- && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
- {
- error ("initializer ends prematurely");
- return error_mark_node;
- }
- }
-
- expand_start_cond (build (GE_EXPR, boolean_type_node,
- iterator, integer_zero_node), 0);
- if (TYPE_NEEDS_DESTRUCTOR (type))
- expand_eh_region_start ();
- expand_start_loop_continue_elsewhere (1);
-
- if (from_array)
- {
- tree to = build1 (INDIRECT_REF, type, base);
- tree from;
-
- if (base2)
- from = build1 (INDIRECT_REF, itype, base2);
- else
- from = NULL_TREE;
-
- if (from_array == 2)
- expand_expr_stmt (build_modify_expr (to, NOP_EXPR, from));
- else if (TYPE_NEEDS_CONSTRUCTING (type))
- expand_aggr_init (to, from, 0, 0);
- else if (from)
- expand_assignment (to, from, 0, 0);
- else
- my_friendly_abort (57);
- }
- else if (TREE_CODE (type) == ARRAY_TYPE)
- {
- if (init != 0)
- sorry ("cannot initialize multi-dimensional array with initializer");
- expand_vec_init (decl, build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (type)), base),
- array_type_nelts (type), 0, 0);
- }
- else
- {
- tree targ = build1 (INDIRECT_REF, type, base);
- tree rhs;
-
- if (init)
- rhs = convert_for_initialization (targ, type, init, LOOKUP_NORMAL,
- "initialization", NULL_TREE, 0);
- else
- rhs = NULL_TREE;
-
- expand_aggr_init (targ, rhs, 0, 0);
- }
-
- expand_assignment (base,
- build (PLUS_EXPR, build_pointer_type (type), base, size),
- 0, 0);
- if (base2)
- expand_assignment (base2,
- build (PLUS_EXPR, build_pointer_type (type), base2, size), 0, 0);
- expand_loop_continue_here ();
- expand_exit_loop_if_false (0, build (NE_EXPR, boolean_type_node,
- build (PREDECREMENT_EXPR, ptrdiff_type_node, iterator, integer_one_node), minus_one));
-
- if (obey_regdecls)
- {
- use_variable (DECL_RTL (base));
- if (base2)
- use_variable (DECL_RTL (base2));
- }
- expand_end_loop ();
- if (TYPE_NEEDS_DESTRUCTOR (type) && flag_exceptions)
- {
- /* We have to ensure that this can live to the cleanup
- expansion time, since we know it is only ever needed
- once, generate code now. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
- {
- tree e1, e2 = make_node (RTL_EXPR);
- TREE_TYPE (e2) = void_type_node;
- RTL_EXPR_RTL (e2) = const0_rtx;
- TREE_SIDE_EFFECTS (e2) = 1;
- start_sequence_for_rtl_expr (e2);
-
- e1 = build_array_eh_cleanup
- (rval,
- build_binary_op (MINUS_EXPR, maxindex, iterator, 1),
- type);
- expand_expr (e1, const0_rtx, VOIDmode, 0);
- RTL_EXPR_SEQUENCE (e2) = get_insns ();
- end_sequence ();
- expand_eh_region_end (e2);
- }
- pop_obstacks ();
- }
- expand_end_cond ();
- if (obey_regdecls)
- use_variable (DECL_RTL (iterator));
- }
- done_init:
-
- if (obey_regdecls)
- use_variable (DECL_RTL (rval));
- return rval;
-}
-
-/* Free up storage of type TYPE, at address ADDR.
-
- TYPE is a POINTER_TYPE and can be ptr_type_node for no special type
- of pointer.
-
- VIRTUAL_SIZE is the amount of storage that was allocated, and is
- used as the second argument to operator delete. It can include
- things like padding and magic size cookies. It has virtual in it,
- because if you have a base pointer and you delete through a virtual
- destructor, it should be the size of the dynamic object, not the
- static object, see Free Store 12.5 ANSI C++ WP.
-
- This does not call any destructors. */
-
-tree
-build_x_delete (type, addr, which_delete, virtual_size)
- tree type, addr;
- int which_delete;
- tree virtual_size;
-{
- int use_global_delete = which_delete & 1;
- int use_vec_delete = !!(which_delete & 2);
- tree rval;
- enum tree_code code = use_vec_delete ? VEC_DELETE_EXPR : DELETE_EXPR;
-
- if (! use_global_delete && TYPE_LANG_SPECIFIC (TREE_TYPE (type))
- && (TYPE_GETS_DELETE (TREE_TYPE (type)) & (1 << use_vec_delete)))
- rval = build_opfncall (code, LOOKUP_NORMAL, addr, virtual_size, NULL_TREE);
- else
- rval = build_builtin_call (void_type_node, use_vec_delete ? BIVD : BID,
- build_tree_list (NULL_TREE, addr));
- return rval;
-}
-
-/* Generate a call to a destructor. TYPE is the type to cast ADDR to.
- ADDR is an expression which yields the store to be destroyed.
- AUTO_DELETE is nonzero if a call to DELETE should be made or not.
- If in the program, (AUTO_DELETE & 2) is non-zero, we tear down the
- virtual baseclasses.
- If in the program, (AUTO_DELETE & 1) is non-zero, then we deallocate.
-
- FLAGS is the logical disjunction of zero or more LOOKUP_
- flags. See cp-tree.h for more info.
-
- This function does not delete an object's virtual base classes. */
-
-tree
-build_delete (type, addr, auto_delete, flags, use_global_delete)
- tree type, addr;
- tree auto_delete;
- int flags;
- int use_global_delete;
-{
- tree function;
- tree member;
- tree expr;
- tree ref;
- int ptr;
-
- if (addr == error_mark_node)
- return error_mark_node;
-
- /* Can happen when CURRENT_EXCEPTION_OBJECT gets its type
- set to `error_mark_node' before it gets properly cleaned up. */
- if (type == error_mark_node)
- return error_mark_node;
-
- type = TYPE_MAIN_VARIANT (type);
-
- if (TREE_CODE (type) == POINTER_TYPE)
- {
- type = TYPE_MAIN_VARIANT (TREE_TYPE (type));
- if (TYPE_SIZE (complete_type (type)) == 0)
- {
- incomplete_type_error (0, type);
- return error_mark_node;
- }
- if (TREE_CODE (type) == ARRAY_TYPE)
- goto handle_array;
- if (! IS_AGGR_TYPE (type))
- {
- /* Call the builtin operator delete. */
- return build_builtin_call (void_type_node, BID,
- build_tree_list (NULL_TREE, addr));
- }
- if (TREE_SIDE_EFFECTS (addr))
- addr = save_expr (addr);
-
- /* throw away const and volatile on target type of addr */
- addr = convert_force (build_pointer_type (type), addr, 0);
- ref = build_indirect_ref (addr, NULL_PTR);
- ptr = 1;
- }
- else if (TREE_CODE (type) == ARRAY_TYPE)
- {
- handle_array:
- if (TREE_SIDE_EFFECTS (addr))
- addr = save_expr (addr);
- if (TYPE_DOMAIN (type) == NULL_TREE)
- {
- error ("unknown array size in delete");
- return error_mark_node;
- }
- return build_vec_delete (addr, array_type_nelts (type),
- auto_delete, integer_two_node,
- use_global_delete);
- }
- else
- {
- /* Don't check PROTECT here; leave that decision to the
- destructor. If the destructor is accessible, call it,
- else report error. */
- addr = build_unary_op (ADDR_EXPR, addr, 0);
- if (TREE_SIDE_EFFECTS (addr))
- addr = save_expr (addr);
-
- if (TREE_CONSTANT (addr))
- addr = convert_pointer_to (type, addr);
- else
- addr = convert_force (build_pointer_type (type), addr, 0);
-
- ref = build_indirect_ref (addr, NULL_PTR);
- ptr = 0;
- }
-
- my_friendly_assert (IS_AGGR_TYPE (type), 220);
-
- if (! TYPE_NEEDS_DESTRUCTOR (type))
- {
- if (auto_delete == integer_zero_node)
- return void_zero_node;
-
- /* Pass the size of the object down to the operator delete() in
- addition to the ADDR. */
- if (TYPE_GETS_REG_DELETE (type) && !use_global_delete)
- {
- tree virtual_size = c_sizeof_nowarn (type);
- return build_opfncall (DELETE_EXPR, LOOKUP_NORMAL, addr,
- virtual_size, NULL_TREE);
- }
-
- /* Call the builtin operator delete. */
- return build_builtin_call (void_type_node, BID,
- build_tree_list (NULL_TREE, addr));
- }
-
- /* Below, we will reverse the order in which these calls are made.
- If we have a destructor, then that destructor will take care
- of the base classes; otherwise, we must do that here. */
- if (TYPE_HAS_DESTRUCTOR (type))
- {
- tree parms = build_tree_list (NULL_TREE, addr);
- tree dtor = DECL_MAIN_VARIANT (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), 1));
- tree passed_auto_delete;
- tree do_delete = NULL_TREE;
- tree ifexp;
- int nonnull;
-
- if (use_global_delete)
- {
- tree cond = fold (build (BIT_AND_EXPR, integer_type_node,
- auto_delete, integer_one_node));
- tree call = build_builtin_call
- (void_type_node, BID, build_tree_list (NULL_TREE, addr));
-
- cond = fold (build (COND_EXPR, void_type_node, cond,
- call, void_zero_node));
- if (cond != void_zero_node)
- do_delete = cond;
-
- passed_auto_delete = fold (build (BIT_AND_EXPR, integer_type_node,
- auto_delete, integer_two_node));
- }
- else
- passed_auto_delete = auto_delete;
-
- expr = build_method_call
- (ref, dtor_identifier, build_tree_list (NULL_TREE, passed_auto_delete),
- NULL_TREE, flags);
-
- if (do_delete)
- expr = build (COMPOUND_EXPR, void_type_node, expr, do_delete);
-
- if (flags & LOOKUP_DESTRUCTOR)
- /* Explicit destructor call; don't check for null pointer. */
- ifexp = integer_one_node;
- else
- /* Handle deleting a null pointer. */
- ifexp = fold (build_binary_op (NE_EXPR, addr, integer_zero_node, 1));
-
- if (ifexp != integer_one_node)
- expr = build (COND_EXPR, void_type_node,
- ifexp, expr, void_zero_node);
-
- return expr;
- }
- else
- {
- /* We only get here from finish_function for a destructor. */
- tree binfos = BINFO_BASETYPES (TYPE_BINFO (type));
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree base_binfo = n_baseclasses > 0 ? TREE_VEC_ELT (binfos, 0) : NULL_TREE;
- tree exprstmt = NULL_TREE;
- tree parent_auto_delete = auto_delete;
- tree cond;
-
- /* If we have member delete or vbases, we call delete in
- finish_function. */
- if (auto_delete == integer_zero_node)
- cond = NULL_TREE;
- else if (base_binfo == NULL_TREE
- || ! TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo)))
- {
- cond = build (COND_EXPR, void_type_node,
- build (BIT_AND_EXPR, integer_type_node, auto_delete, integer_one_node),
- build_builtin_call (void_type_node, BID,
- build_tree_list (NULL_TREE, addr)),
- void_zero_node);
- }
- else
- cond = NULL_TREE;
-
- if (cond)
- exprstmt = build_tree_list (NULL_TREE, cond);
-
- if (base_binfo
- && ! TREE_VIA_VIRTUAL (base_binfo)
- && TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo)))
- {
- tree this_auto_delete;
-
- if (BINFO_OFFSET_ZEROP (base_binfo))
- this_auto_delete = parent_auto_delete;
- else
- this_auto_delete = integer_zero_node;
-
- expr = build_scoped_method_call
- (ref, base_binfo, dtor_identifier,
- build_tree_list (NULL_TREE, this_auto_delete));
- exprstmt = tree_cons (NULL_TREE, expr, exprstmt);
- }
-
- /* Take care of the remaining baseclasses. */
- for (i = 1; i < n_baseclasses; i++)
- {
- base_binfo = TREE_VEC_ELT (binfos, i);
- if (! TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo))
- || TREE_VIA_VIRTUAL (base_binfo))
- continue;
-
- expr = build_scoped_method_call
- (ref, base_binfo, dtor_identifier,
- build_tree_list (NULL_TREE, integer_zero_node));
-
- exprstmt = tree_cons (NULL_TREE, expr, exprstmt);
- }
-
- for (member = TYPE_FIELDS (type); member; member = TREE_CHAIN (member))
- {
- if (TREE_CODE (member) != FIELD_DECL)
- continue;
- if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (member)))
- {
- tree this_member = build_component_ref (ref, DECL_NAME (member), NULL_TREE, 0);
- tree this_type = TREE_TYPE (member);
- expr = build_delete (this_type, this_member, integer_two_node, flags, 0);
- exprstmt = tree_cons (NULL_TREE, expr, exprstmt);
- }
- }
-
- if (exprstmt)
- return build_compound_expr (exprstmt);
- /* Virtual base classes make this function do nothing. */
- return void_zero_node;
- }
-}
-
-/* For type TYPE, delete the virtual baseclass objects of DECL. */
-
-tree
-build_vbase_delete (type, decl)
- tree type, decl;
-{
- tree vbases = CLASSTYPE_VBASECLASSES (type);
- tree result = NULL_TREE;
- tree addr = build_unary_op (ADDR_EXPR, decl, 0);
-
- my_friendly_assert (addr != error_mark_node, 222);
-
- while (vbases)
- {
- tree this_addr = convert_force (build_pointer_type (BINFO_TYPE (vbases)),
- addr, 0);
- result = tree_cons (NULL_TREE,
- build_delete (TREE_TYPE (this_addr), this_addr,
- integer_zero_node,
- LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0),
- result);
- vbases = TREE_CHAIN (vbases);
- }
- return build_compound_expr (nreverse (result));
-}
-
-/* Build a C++ vector delete expression.
- MAXINDEX is the number of elements to be deleted.
- ELT_SIZE is the nominal size of each element in the vector.
- BASE is the expression that should yield the store to be deleted.
- This function expands (or synthesizes) these calls itself.
- AUTO_DELETE_VEC says whether the container (vector) should be deallocated.
- AUTO_DELETE say whether each item in the container should be deallocated.
-
- This also calls delete for virtual baseclasses of elements of the vector.
-
- Update: MAXINDEX is no longer needed. The size can be extracted from the
- start of the vector for pointers, and from the type for arrays. We still
- use MAXINDEX for arrays because it happens to already have one of the
- values we'd have to extract. (We could use MAXINDEX with pointers to
- confirm the size, and trap if the numbers differ; not clear that it'd
- be worth bothering.) */
-
-tree
-build_vec_delete (base, maxindex, auto_delete_vec, auto_delete,
- use_global_delete)
- tree base, maxindex;
- tree auto_delete_vec, auto_delete;
- int use_global_delete;
-{
- tree type;
-
- if (TREE_CODE (base) == OFFSET_REF)
- base = resolve_offset_ref (base);
-
- type = TREE_TYPE (base);
-
- base = stabilize_reference (base);
-
- /* Since we can use base many times, save_expr it. */
- if (TREE_SIDE_EFFECTS (base))
- base = save_expr (base);
-
- if (TREE_CODE (type) == POINTER_TYPE)
- {
- /* Step back one from start of vector, and read dimension. */
- tree cookie_addr = build (MINUS_EXPR, build_pointer_type (BI_header_type),
- base, BI_header_size);
- tree cookie = build_indirect_ref (cookie_addr, NULL_PTR);
- maxindex = build_component_ref (cookie, nc_nelts_field_id, NULL_TREE, 0);
- do
- type = TREE_TYPE (type);
- while (TREE_CODE (type) == ARRAY_TYPE);
- }
- else if (TREE_CODE (type) == ARRAY_TYPE)
- {
- /* get the total number of things in the array, maxindex is a bad name */
- maxindex = array_type_nelts_total (type);
- while (TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
- base = build_unary_op (ADDR_EXPR, base, 1);
- }
- else
- {
- if (base != error_mark_node)
- error ("type to vector delete is neither pointer or array type");
- return error_mark_node;
- }
-
- return build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
- use_global_delete);
-}
diff --git a/gcc/cp/input.c b/gcc/cp/input.c
deleted file mode 100644
index e142bf4f99d..00000000000
--- a/gcc/cp/input.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Input handling for G++.
- Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
- Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
-
-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. */
-
-/* G++ needs to do enough saving and re-parsing of text that it is
- necessary to abandon the simple FILE* model and use a mechanism where
- we can pre-empt one input stream with another derived from saved text;
- we may need to do this arbitrarily often, and cannot depend on having
- the GNU library available, so FILE objects just don't cut it.
-
- This file is written as a separate module, but can be included by
- lex.c for very minor efficiency gains (primarily in function
- inlining). */
-
-#include <stdio.h>
-#include "obstack.h"
-
-extern FILE *finput;
-
-struct pending_input *save_pending_input ();
-void restore_pending_input ();
-
-struct input_source {
- /* saved string */
- char *str;
- int length;
- /* current position, when reading as input */
- int offset;
- /* obstack to free this input string from when finished, if any */
- struct obstack *obstack;
- /* linked list maintenance */
- struct input_source *next;
- /* values to restore after reading all of current string */
- char *filename;
- int lineno;
- struct pending_input *input;
- int putback_char;
-};
-
-static struct input_source *input, *free_inputs;
-
-extern char *input_filename;
-extern int lineno;
-
-#ifdef __GNUC__
-#define inline __inline__
-#else
-#define inline
-#endif
-
-static inline struct input_source *
-allocate_input ()
-{
- struct input_source *inp;
- if (free_inputs)
- {
- inp = free_inputs;
- free_inputs = inp->next;
- inp->next = 0;
- return inp;
- }
- inp = (struct input_source *) xmalloc (sizeof (struct input_source));
- inp->next = 0;
- inp->obstack = 0;
- return inp;
-}
-
-static inline void
-free_input (inp)
- struct input_source *inp;
-{
- if (inp->obstack)
- obstack_free (inp->obstack, inp->str);
- inp->obstack = 0;
- inp->str = 0;
- inp->length = 0;
- inp->next = free_inputs;
- free_inputs = inp;
-}
-
-static int putback_char = -1;
-
-/* Some of these external functions are declared inline in case this file
- is included in lex.c. */
-
-inline
-void
-feed_input (str, len, delete)
- char *str;
- int len;
- struct obstack *delete;
-{
- struct input_source *inp = allocate_input ();
-
- /* This shouldn't be necessary. */
- while (len && !str[len-1])
- len--;
-
- inp->str = str;
- inp->length = len;
- inp->obstack = delete;
- inp->offset = 0;
- inp->next = input;
- inp->filename = input_filename;
- inp->lineno = lineno;
- inp->input = save_pending_input ();
- inp->putback_char = putback_char;
- putback_char = -1;
- input = inp;
-}
-
-struct pending_input *to_be_restored; /* XXX */
-extern int end_of_file;
-
-static inline int
-sub_getch ()
-{
- if (putback_char != -1)
- {
- int ch = putback_char;
- putback_char = -1;
- return ch;
- }
- if (input)
- {
- if (input->offset == input->length)
- {
- struct input_source *inp = input;
- my_friendly_assert (putback_char == -1, 223);
- to_be_restored = inp->input;
- input->offset++;
- return EOF;
- }
- else if (input->offset > input->length)
- {
- struct input_source *inp = input;
-
- end_of_file = 0;
- input = inp->next;
- input_filename = inp->filename;
- lineno = inp->lineno;
- /* Get interface/implementation back in sync. */
- extract_interface_info ();
- putback_char = inp->putback_char;
- free_input (inp);
- return getch ();
- }
- if (input)
- return (unsigned char)input->str[input->offset++];
- }
- return getc (finput);
-}
-
-inline
-void
-put_back (ch)
- int ch;
-{
- if (ch != EOF)
- {
- my_friendly_assert (putback_char == -1, 224);
- putback_char = ch;
- }
-}
-
-extern int linemode;
-
-int
-getch ()
-{
- int ch = sub_getch ();
- if (linemode && ch == '\n')
- {
- put_back (ch);
- ch = EOF;
- }
- return ch;
-}
-
-inline
-int
-input_redirected ()
-{
- return input != 0;
-}
diff --git a/gcc/cp/lang-options.h b/gcc/cp/lang-options.h
deleted file mode 100644
index ed76bcf349f..00000000000
--- a/gcc/cp/lang-options.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Definitions for switches for C++.
- Copyright (C) 1995 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 `lang_options' array in gcc.c for
- g++. */
-
- "-+e0", /* gcc.c tacks the `-' on the front. */
- "-+e1",
- "-+e2",
- "-faccess-control",
- "-fno-access-control",
- "-fall-virtual",
- "-fno-all-virtual",
- "-falt-external-templates",
- "-fno-alt-external-templates",
- "-fansi-overloading",
- "-fno-ansi-overloading",
- "-fcheck-new",
- "-fno-check-new",
- "-fconserve-space",
- "-fno-conserve-space",
- "-fdefault-inline",
- "-fno-default-inline",
- "-frtti",
- "-fno-rtti",
- "-felide-constructors",
- "-fno-elide-constructors",
- "-fenum-int-equiv",
- "-fno-enum-int-equiv",
- "-fexternal-templates",
- "-fno-external-templates",
- "-ffor-scope",
- "-fno-for-scope",
- "-fgnu-keywords",
- "-fno-gnu-keywords",
- "-fhandle-signatures",
- "-fno-handle-signatures",
- "-fhuge-objects",
- "-fno-huge-objects",
- "-fimplement-inlines",
- "-fno-implement-inlines",
- "-fimplicit-templates",
- "-fno-implicit-templates",
- "-flabels-ok",
- "-fno-labels-ok",
- "-fmemoize-lookups",
- "-fno-memoize-lookups",
- "-fnonnull-objects",
- "-fno-nonnull-objects",
- "-foperator-names",
- "-fno-operator-names",
- "-frepo",
- "-fno-repo",
- "-fsave-memoized",
- "-fno-save-memoized",
- "-fshort-temps",
- "-fno-short-temps",
- "-fstats",
- "-fno-stats",
- "-fstrict-prototype",
- "-fno-strict-prototype",
- "-ftemplate-depth-",
- "-fthis-is-variable",
- "-fno-this-is-variable",
- "-fvtable-thunks",
- "-fno-vtable-thunks",
- "-fweak",
- "-fno-weak",
- "-fxref",
- "-fno-xref",
-
- "-Wreturn-type",
- "-Wno-return-type",
- "-Woverloaded-virtual",
- "-Wno-overloaded-virtual",
- "-Wtemplate-debugging",
- "-Wno-template-debugging",
- "-Wctor-dtor-privacy",
- "-Wno-ctor-dtor-privacy",
- "-Wnon-virtual-dtor",
- "-Wno-non-virtual-dtor",
- "-Wextern-inline",
- "-Wno-extern-inline",
- "-Wreorder",
- "-Wno-reorder",
- "-Wsynth",
- "-Wno-synth",
- "-Wpmf-conversions",
- "-Wno-pmf-conversions",
diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
deleted file mode 100644
index b3b6c0b6833..00000000000
--- a/gcc/cp/lang-specs.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Definitions for specs for C++.
- Copyright (C) 1995 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
- g++. */
-
- {".cc", "@c++"},
- {".cp", "@c++"},
- {".cxx", "@c++"},
- {".cpp", "@c++"},
- {".c++", "@c++"},
- {".C", "@c++"},
- {"@c++",
- "cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
- %{C:%{!E:%eGNU C++ does not support -C without using -E}}\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
- -undef -D__GNUC__=%v1 -D__GNUG__=%v1 -D__cplusplus -D__GNUC_MINOR__=%v2\
- %{ansi:-trigraphs -$ -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
- %{traditional-cpp:-traditional} %{trigraphs}\
- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
- %i %{!M:%{!MM:%{!E:%{!pipe:%g.ii}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
- "%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.ii} %1 %2\
- %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\
- %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
- %{traditional} %{v:-version} %{pg:-p} %{p}\
- %{f*} %{+e*} %{aux-info*}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}}|\n\
- %{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}}}"},
- {".ii", "@c++-cpp-output"},
- {"@c++-cpp-output",
- "%{!M:%{!MM:%{!E:cc1plus %i %1 %2 %{!Q:-quiet} %{d*} %{m*} %{a}\
- %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
- %{traditional} %{v:-version} %{pg:-p} %{p}\
- %{f*} %{+e*} %{aux-info*}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
- %{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}}}"},
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
deleted file mode 100644
index befb5a15211..00000000000
--- a/gcc/cp/lex.c
+++ /dev/null
@@ -1,4458 +0,0 @@
-/* Separate lexical analyzer for GNU C++.
- Copyright (C) 1987, 89, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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 file is the lexical analyzer for GNU C++. */
-
-/* Cause the `yydebug' variable to be defined. */
-#define YYDEBUG 1
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <errno.h>
-#include <setjmp.h>
-#include "config.h"
-#include "input.h"
-#include "tree.h"
-#include "lex.h"
-#include "cp-tree.h"
-#include "parse.h"
-#include "flags.h"
-#include "obstack.h"
-#include "c-pragma.h"
-
-#ifdef MULTIBYTE_CHARS
-#include <stdlib.h>
-#include <locale.h>
-#endif
-
-#ifndef errno
-extern int errno; /* needed for VAX. */
-#endif
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern struct obstack permanent_obstack;
-extern struct obstack *current_obstack, *saveable_obstack;
-
-extern double atof ();
-
-extern char *get_directive_line (); /* In c-common.c */
-
-/* Given a file name X, return the nondirectory portion.
- Keep in mind that X can be computed more than once. */
-#ifndef FILE_NAME_NONDIRECTORY
-#define FILE_NAME_NONDIRECTORY(X) \
- (rindex (X, '/') != 0 ? rindex (X, '/') + 1 : X)
-#endif
-
-extern char *index ();
-extern char *rindex ();
-void yyerror ();
-
-/* This obstack is needed to hold text. It is not safe to use
- TOKEN_BUFFER because `check_newline' calls `yylex'. */
-struct obstack inline_text_obstack;
-
-int end_of_file;
-
-/* Pending language change.
- Positive is push count, negative is pop count. */
-int pending_lang_change = 0;
-
-/* Wrap the current header file in extern "C". */
-static int c_header_level = 0;
-
-extern int first_token;
-extern struct obstack token_obstack;
-
-/* ??? Don't really know where this goes yet. */
-#if 1
-#include "input.c"
-#else
-extern void put_back (/* int */);
-extern int input_redirected ();
-extern void feed_input (/* char *, int, struct obstack * */);
-#endif
-
-/* Holds translations from TREE_CODEs to operator name strings,
- i.e., opname_tab[PLUS_EXPR] == "+". */
-char **opname_tab;
-char **assignop_tab;
-
-extern int yychar; /* the lookahead symbol */
-extern YYSTYPE yylval; /* the semantic value of the */
- /* lookahead symbol */
-
-#if 0
-YYLTYPE yylloc; /* location data for the lookahead */
- /* symbol */
-#endif
-
-
-/* the declaration found for the last IDENTIFIER token read in.
- yylex must look this up to detect typedefs, which get token type TYPENAME,
- so it is left around in case the identifier is not a typedef but is
- used in a context which makes it a reference to a variable. */
-tree lastiddecl;
-
-/* The elements of `ridpointers' are identifier nodes
- for the reserved type names and storage classes.
- It is indexed by a RID_... value. */
-tree ridpointers[(int) RID_MAX];
-
-/* We may keep statistics about how long which files took to compile. */
-static int header_time, body_time;
-static tree get_time_identifier ();
-static tree filename_times;
-static tree this_filename_time;
-
-/* Array for holding counts of the numbers of tokens seen. */
-extern int *token_count;
-
-/* Return something to represent absolute declarators containing a *.
- TARGET is the absolute declarator that the * contains.
- CV_QUALIFIERS is a list of modifiers such as const or volatile
- to apply to the pointer type, represented as identifiers.
-
- We return an INDIRECT_REF whose "contents" are TARGET
- and whose type is the modifier list. */
-
-tree
-make_pointer_declarator (cv_qualifiers, target)
- tree cv_qualifiers, target;
-{
- if (target && TREE_CODE (target) == IDENTIFIER_NODE
- && ANON_AGGRNAME_P (target))
- error ("type name expected before `*'");
- target = build_parse_node (INDIRECT_REF, target);
- TREE_TYPE (target) = cv_qualifiers;
- return target;
-}
-
-/* Return something to represent absolute declarators containing a &.
- TARGET is the absolute declarator that the & contains.
- CV_QUALIFIERS is a list of modifiers such as const or volatile
- to apply to the reference type, represented as identifiers.
-
- We return an ADDR_EXPR whose "contents" are TARGET
- and whose type is the modifier list. */
-
-tree
-make_reference_declarator (cv_qualifiers, target)
- tree cv_qualifiers, target;
-{
- if (target)
- {
- if (TREE_CODE (target) == ADDR_EXPR)
- {
- error ("cannot declare references to references");
- return target;
- }
- if (TREE_CODE (target) == INDIRECT_REF)
- {
- error ("cannot declare pointers to references");
- return target;
- }
- if (TREE_CODE (target) == IDENTIFIER_NODE && ANON_AGGRNAME_P (target))
- error ("type name expected before `&'");
- }
- target = build_parse_node (ADDR_EXPR, target);
- TREE_TYPE (target) = cv_qualifiers;
- return target;
-}
-
-tree
-make_call_declarator (target, parms, cv_qualifiers, exception_specification)
- tree target, parms, cv_qualifiers, exception_specification;
-{
- target = build_parse_node (CALL_EXPR, target, parms, cv_qualifiers);
- TREE_TYPE (target) = exception_specification;
- return target;
-}
-
-void
-set_quals_and_spec (call_declarator, cv_qualifiers, exception_specification)
- tree call_declarator, cv_qualifiers, exception_specification;
-{
- TREE_OPERAND (call_declarator, 2) = cv_qualifiers;
- TREE_TYPE (call_declarator) = exception_specification;
-}
-
-/* Build names and nodes for overloaded operators. */
-
-tree ansi_opname[LAST_CPLUS_TREE_CODE];
-tree ansi_assopname[LAST_CPLUS_TREE_CODE];
-
-char *
-operator_name_string (name)
- tree name;
-{
- char *opname = IDENTIFIER_POINTER (name) + 2;
- tree *opname_table;
- int i, assign;
-
- /* Works for builtin and user defined types. */
- if (IDENTIFIER_GLOBAL_VALUE (name)
- && TREE_CODE (IDENTIFIER_GLOBAL_VALUE (name)) == TYPE_DECL)
- return IDENTIFIER_POINTER (name);
-
- if (opname[0] == 'a' && opname[2] != '\0' && opname[2] != '_')
- {
- opname += 1;
- assign = 1;
- opname_table = ansi_assopname;
- }
- else
- {
- assign = 0;
- opname_table = ansi_opname;
- }
-
- for (i = 0; i < (int) LAST_CPLUS_TREE_CODE; i++)
- {
- if (opname[0] == IDENTIFIER_POINTER (opname_table[i])[2+assign]
- && opname[1] == IDENTIFIER_POINTER (opname_table[i])[3+assign])
- break;
- }
-
- if (i == LAST_CPLUS_TREE_CODE)
- return "<invalid operator>";
-
- if (assign)
- return assignop_tab[i];
- else
- return opname_tab[i];
-}
-
-int interface_only; /* whether or not current file is only for
- interface definitions. */
-int interface_unknown; /* whether or not we know this class
- to behave according to #pragma interface. */
-
-/* lexical analyzer */
-
-/* File used for outputting assembler code. */
-extern FILE *asm_out_file;
-
-#ifndef WCHAR_TYPE_SIZE
-#ifdef INT_TYPE_SIZE
-#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
-#else
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-#endif
-#endif
-
-/* Number of bytes in a wide character. */
-#define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
-
-static int maxtoken; /* Current nominal length of token buffer. */
-char *token_buffer; /* Pointer to token buffer.
- Actual allocated length is maxtoken + 2. */
-
-#include "hash.h"
-
-static int check_newline ();
-
-/* Nonzero tells yylex to ignore \ in string constants. */
-static int ignore_escape_flag = 0;
-
-static int skip_white_space ();
-
-static tree
-get_time_identifier (name)
- char *name;
-{
- tree time_identifier;
- int len = strlen (name);
- char *buf = (char *) alloca (len + 6);
- strcpy (buf, "file ");
- bcopy (name, buf+5, len);
- buf[len+5] = '\0';
- time_identifier = get_identifier (buf);
- if (IDENTIFIER_LOCAL_VALUE (time_identifier) == NULL_TREE)
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- IDENTIFIER_LOCAL_VALUE (time_identifier) = build_int_2 (0, 0);
- IDENTIFIER_CLASS_VALUE (time_identifier) = build_int_2 (0, 1);
- IDENTIFIER_GLOBAL_VALUE (time_identifier) = filename_times;
- filename_times = time_identifier;
- pop_obstacks ();
- }
- return time_identifier;
-}
-
-#ifdef __GNUC__
-__inline
-#endif
-static int
-my_get_run_time ()
-{
- int old_quiet_flag = quiet_flag;
- int this_time;
- quiet_flag = 0;
- this_time = get_run_time ();
- quiet_flag = old_quiet_flag;
- return this_time;
-}
-
-/* Table indexed by tree code giving a string containing a character
- classifying the tree code. Possibilities are
- t, d, s, c, r, <, 1 and 2. See cp/cp-tree.def for details. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-
-char *cplus_tree_code_type[] = {
- "x",
-#include "cp-tree.def"
-};
-#undef DEFTREECODE
-
-/* Table indexed by tree code giving number of expression
- operands beyond the fixed part of the node structure.
- Not used for types or decls. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
-
-int cplus_tree_code_length[] = {
- 0,
-#include "cp-tree.def"
-};
-#undef DEFTREECODE
-
-/* Names of tree components.
- Used for printing out the tree and error messages. */
-#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
-
-char *cplus_tree_code_name[] = {
- "@@dummy",
-#include "cp-tree.def"
-};
-#undef DEFTREECODE
-
-/* toplev.c needs to call these. */
-
-void
-lang_init ()
-{
- /* the beginning of the file is a new line; check for # */
- /* With luck, we discover the real source file's name from that
- and put it in input_filename. */
- put_back (check_newline ());
- if (flag_gnu_xref) GNU_xref_begin (input_filename);
- init_repo (input_filename);
-}
-
-void
-lang_finish ()
-{
- extern int errorcount, sorrycount;
- if (flag_gnu_xref) GNU_xref_end (errorcount+sorrycount);
-}
-
-char *
-lang_identify ()
-{
- return "cplusplus";
-}
-
-void
-init_filename_times ()
-{
- this_filename_time = get_time_identifier ("<top level>");
- if (flag_detailed_statistics)
- {
- header_time = 0;
- body_time = my_get_run_time ();
- TREE_INT_CST_LOW (IDENTIFIER_LOCAL_VALUE (this_filename_time)) = body_time;
- }
-}
-
-/* Change by Bryan Boreham, Kewill, Thu Jul 27 09:46:05 1989.
- Stuck this hack in to get the files open correctly; this is called
- in place of init_lex if we are an unexec'd binary. */
-
-#if 0
-void
-reinit_lang_specific ()
-{
- init_filename_times ();
- reinit_search_statistics ();
-}
-#endif
-
-int *init_parse ();
-
-void
-init_lex ()
-{
- extern char *(*decl_printable_name) ();
- extern int flag_no_gnu_keywords;
- extern int flag_operator_names;
-
- int i;
-
- /* Initialize the lookahead machinery. */
- init_spew ();
-
- /* Make identifier nodes long enough for the language-specific slots. */
- set_identifier_size (sizeof (struct lang_identifier));
- decl_printable_name = lang_printable_name;
-
- init_cplus_expand ();
-
- tree_code_type
- = (char **) realloc (tree_code_type,
- sizeof (char *) * LAST_CPLUS_TREE_CODE);
- tree_code_length
- = (int *) realloc (tree_code_length,
- sizeof (int) * LAST_CPLUS_TREE_CODE);
- tree_code_name
- = (char **) realloc (tree_code_name,
- sizeof (char *) * LAST_CPLUS_TREE_CODE);
- bcopy ((char *)cplus_tree_code_type,
- (char *)(tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE),
- (LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
- bcopy ((char *)cplus_tree_code_length,
- (char *)(tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE),
- (LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (int));
- bcopy ((char *)cplus_tree_code_name,
- (char *)(tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE),
- (LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
-
- opname_tab = (char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *));
- bzero ((char *)opname_tab, (int)LAST_CPLUS_TREE_CODE * sizeof (char *));
- assignop_tab = (char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *));
- bzero ((char *)assignop_tab, (int)LAST_CPLUS_TREE_CODE * sizeof (char *));
-
- ansi_opname[0] = get_identifier ("<invalid operator>");
- for (i = 0; i < (int) LAST_CPLUS_TREE_CODE; i++)
- {
- ansi_opname[i] = ansi_opname[0];
- ansi_assopname[i] = ansi_opname[0];
- }
-
- ansi_opname[(int) MULT_EXPR] = get_identifier ("__ml");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MULT_EXPR]) = 1;
- ansi_opname[(int) INDIRECT_REF] = ansi_opname[(int) MULT_EXPR];
- ansi_assopname[(int) MULT_EXPR] = get_identifier ("__aml");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) MULT_EXPR]) = 1;
- ansi_assopname[(int) INDIRECT_REF] = ansi_assopname[(int) MULT_EXPR];
- ansi_opname[(int) TRUNC_MOD_EXPR] = get_identifier ("__md");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUNC_MOD_EXPR]) = 1;
- ansi_assopname[(int) TRUNC_MOD_EXPR] = get_identifier ("__amd");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) TRUNC_MOD_EXPR]) = 1;
- ansi_opname[(int) CEIL_MOD_EXPR] = ansi_opname[(int) TRUNC_MOD_EXPR];
- ansi_opname[(int) FLOOR_MOD_EXPR] = ansi_opname[(int) TRUNC_MOD_EXPR];
- ansi_opname[(int) ROUND_MOD_EXPR] = ansi_opname[(int) TRUNC_MOD_EXPR];
- ansi_opname[(int) MINUS_EXPR] = get_identifier ("__mi");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MINUS_EXPR]) = 1;
- ansi_opname[(int) NEGATE_EXPR] = ansi_opname[(int) MINUS_EXPR];
- ansi_assopname[(int) MINUS_EXPR] = get_identifier ("__ami");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) MINUS_EXPR]) = 1;
- ansi_assopname[(int) NEGATE_EXPR] = ansi_assopname[(int) MINUS_EXPR];
- ansi_opname[(int) RSHIFT_EXPR] = get_identifier ("__rs");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) RSHIFT_EXPR]) = 1;
- ansi_assopname[(int) RSHIFT_EXPR] = get_identifier ("__ars");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) RSHIFT_EXPR]) = 1;
- ansi_opname[(int) NE_EXPR] = get_identifier ("__ne");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) NE_EXPR]) = 1;
- ansi_opname[(int) GT_EXPR] = get_identifier ("__gt");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) GT_EXPR]) = 1;
- ansi_opname[(int) GE_EXPR] = get_identifier ("__ge");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) GE_EXPR]) = 1;
- ansi_opname[(int) BIT_IOR_EXPR] = get_identifier ("__or");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_IOR_EXPR]) = 1;
- ansi_assopname[(int) BIT_IOR_EXPR] = get_identifier ("__aor");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) BIT_IOR_EXPR]) = 1;
- ansi_opname[(int) TRUTH_ANDIF_EXPR] = get_identifier ("__aa");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUTH_ANDIF_EXPR]) = 1;
- ansi_opname[(int) TRUTH_NOT_EXPR] = get_identifier ("__nt");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUTH_NOT_EXPR]) = 1;
- ansi_opname[(int) PREINCREMENT_EXPR] = get_identifier ("__pp");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) PREINCREMENT_EXPR]) = 1;
- ansi_opname[(int) POSTINCREMENT_EXPR] = ansi_opname[(int) PREINCREMENT_EXPR];
- ansi_opname[(int) MODIFY_EXPR] = get_identifier ("__as");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MODIFY_EXPR]) = 1;
- ansi_assopname[(int) NOP_EXPR] = ansi_opname[(int) MODIFY_EXPR];
- ansi_opname[(int) COMPOUND_EXPR] = get_identifier ("__cm");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) COMPOUND_EXPR]) = 1;
- ansi_opname[(int) EXACT_DIV_EXPR] = get_identifier ("__dv");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) EXACT_DIV_EXPR]) = 1;
- ansi_assopname[(int) EXACT_DIV_EXPR] = get_identifier ("__adv");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) EXACT_DIV_EXPR]) = 1;
- ansi_opname[(int) TRUNC_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR];
- ansi_opname[(int) CEIL_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR];
- ansi_opname[(int) FLOOR_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR];
- ansi_opname[(int) ROUND_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR];
- ansi_opname[(int) PLUS_EXPR] = get_identifier ("__pl");
- ansi_assopname[(int) TRUNC_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR];
- ansi_assopname[(int) CEIL_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR];
- ansi_assopname[(int) FLOOR_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR];
- ansi_assopname[(int) ROUND_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR];
- IDENTIFIER_OPNAME_P (ansi_opname[(int) PLUS_EXPR]) = 1;
- ansi_assopname[(int) PLUS_EXPR] = get_identifier ("__apl");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) PLUS_EXPR]) = 1;
- ansi_opname[(int) CONVERT_EXPR] = ansi_opname[(int) PLUS_EXPR];
- ansi_assopname[(int) CONVERT_EXPR] = ansi_assopname[(int) PLUS_EXPR];
- ansi_opname[(int) LSHIFT_EXPR] = get_identifier ("__ls");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) LSHIFT_EXPR]) = 1;
- ansi_assopname[(int) LSHIFT_EXPR] = get_identifier ("__als");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) LSHIFT_EXPR]) = 1;
- ansi_opname[(int) EQ_EXPR] = get_identifier ("__eq");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) EQ_EXPR]) = 1;
- ansi_opname[(int) LT_EXPR] = get_identifier ("__lt");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) LT_EXPR]) = 1;
- ansi_opname[(int) LE_EXPR] = get_identifier ("__le");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) LE_EXPR]) = 1;
- ansi_opname[(int) BIT_AND_EXPR] = get_identifier ("__ad");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_AND_EXPR]) = 1;
- ansi_assopname[(int) BIT_AND_EXPR] = get_identifier ("__aad");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) BIT_AND_EXPR]) = 1;
- ansi_opname[(int) ADDR_EXPR] = ansi_opname[(int) BIT_AND_EXPR];
- ansi_assopname[(int) ADDR_EXPR] = ansi_assopname[(int) BIT_AND_EXPR];
- ansi_opname[(int) BIT_XOR_EXPR] = get_identifier ("__er");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_XOR_EXPR]) = 1;
- ansi_assopname[(int) BIT_XOR_EXPR] = get_identifier ("__aer");
- IDENTIFIER_OPNAME_P (ansi_assopname[(int) BIT_XOR_EXPR]) = 1;
- ansi_opname[(int) TRUTH_ORIF_EXPR] = get_identifier ("__oo");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUTH_ORIF_EXPR]) = 1;
- ansi_opname[(int) BIT_NOT_EXPR] = get_identifier ("__co");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_NOT_EXPR]) = 1;
- ansi_opname[(int) PREDECREMENT_EXPR] = get_identifier ("__mm");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) PREDECREMENT_EXPR]) = 1;
- ansi_opname[(int) POSTDECREMENT_EXPR] = ansi_opname[(int) PREDECREMENT_EXPR];
- ansi_opname[(int) COMPONENT_REF] = get_identifier ("__rf");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) COMPONENT_REF]) = 1;
- ansi_opname[(int) MEMBER_REF] = get_identifier ("__rm");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MEMBER_REF]) = 1;
- ansi_opname[(int) CALL_EXPR] = get_identifier ("__cl");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) CALL_EXPR]) = 1;
- ansi_opname[(int) ARRAY_REF] = get_identifier ("__vc");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) ARRAY_REF]) = 1;
- ansi_opname[(int) NEW_EXPR] = get_identifier ("__nw");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) NEW_EXPR]) = 1;
- ansi_opname[(int) DELETE_EXPR] = get_identifier ("__dl");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) DELETE_EXPR]) = 1;
- ansi_opname[(int) VEC_NEW_EXPR] = get_identifier ("__vn");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) VEC_NEW_EXPR]) = 1;
- ansi_opname[(int) VEC_DELETE_EXPR] = get_identifier ("__vd");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) VEC_DELETE_EXPR]) = 1;
- ansi_opname[(int) TYPE_EXPR] = get_identifier ("__op");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) TYPE_EXPR]) = 1;
-
- /* This is not true: these operators are not defined in ANSI,
- but we need them anyway. */
- ansi_opname[(int) MIN_EXPR] = get_identifier ("__mn");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MIN_EXPR]) = 1;
- ansi_opname[(int) MAX_EXPR] = get_identifier ("__mx");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) MAX_EXPR]) = 1;
- ansi_opname[(int) COND_EXPR] = get_identifier ("__cn");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) COND_EXPR]) = 1;
- ansi_opname[(int) METHOD_CALL_EXPR] = get_identifier ("__wr");
- IDENTIFIER_OPNAME_P (ansi_opname[(int) METHOD_CALL_EXPR]) = 1;
-
- init_method ();
- init_error ();
- gcc_obstack_init (&inline_text_obstack);
-
- /* Start it at 0, because check_newline is called at the very beginning
- and will increment it to 1. */
- lineno = 0;
- input_filename = "<internal>";
- current_function_decl = NULL;
-
- maxtoken = 40;
- token_buffer = (char *) xmalloc (maxtoken + 2);
-
- ridpointers[(int) RID_INT] = get_identifier ("int");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_INT],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_INT]));
- ridpointers[(int) RID_BOOL] = get_identifier ("bool");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_BOOL],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_BOOL]));
- ridpointers[(int) RID_CHAR] = get_identifier ("char");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_CHAR],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]));
- ridpointers[(int) RID_VOID] = get_identifier ("void");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_VOID],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_VOID]));
- ridpointers[(int) RID_FLOAT] = get_identifier ("float");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_FLOAT],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_FLOAT]));
- ridpointers[(int) RID_DOUBLE] = get_identifier ("double");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_DOUBLE],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_DOUBLE]));
- ridpointers[(int) RID_SHORT] = get_identifier ("short");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_SHORT],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_SHORT]));
- ridpointers[(int) RID_LONG] = get_identifier ("long");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_LONG],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_LONG]));
- ridpointers[(int) RID_UNSIGNED] = get_identifier ("unsigned");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_UNSIGNED],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_UNSIGNED]));
- ridpointers[(int) RID_SIGNED] = get_identifier ("signed");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_SIGNED],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_SIGNED]));
- ridpointers[(int) RID_INLINE] = get_identifier ("inline");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_INLINE],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_INLINE]));
- ridpointers[(int) RID_CONST] = get_identifier ("const");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_CONST],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_CONST]));
- ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_VOLATILE],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_VOLATILE]));
- ridpointers[(int) RID_AUTO] = get_identifier ("auto");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_AUTO],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_AUTO]));
- ridpointers[(int) RID_STATIC] = get_identifier ("static");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_STATIC],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_STATIC]));
- ridpointers[(int) RID_EXTERN] = get_identifier ("extern");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_EXTERN],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_EXTERN]));
- ridpointers[(int) RID_TYPEDEF] = get_identifier ("typedef");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_TYPEDEF],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_TYPEDEF]));
- ridpointers[(int) RID_REGISTER] = get_identifier ("register");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_REGISTER],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_REGISTER]));
-
- /* C++ extensions. These are probably not correctly named. */
- ridpointers[(int) RID_WCHAR] = get_identifier ("__wchar_t");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_WCHAR],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_WCHAR]));
- class_type_node = build_int_2 (class_type, 0);
- TREE_TYPE (class_type_node) = class_type_node;
- ridpointers[(int) RID_CLASS] = class_type_node;
-
- record_type_node = build_int_2 (record_type, 0);
- TREE_TYPE (record_type_node) = record_type_node;
- ridpointers[(int) RID_RECORD] = record_type_node;
-
- union_type_node = build_int_2 (union_type, 0);
- TREE_TYPE (union_type_node) = union_type_node;
- ridpointers[(int) RID_UNION] = union_type_node;
-
- enum_type_node = build_int_2 (enum_type, 0);
- TREE_TYPE (enum_type_node) = enum_type_node;
- ridpointers[(int) RID_ENUM] = enum_type_node;
-
- ridpointers[(int) RID_VIRTUAL] = get_identifier ("virtual");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_VIRTUAL],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_VIRTUAL]));
- ridpointers[(int) RID_EXPLICIT] = get_identifier ("explicit");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_EXPLICIT],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_EXPLICIT]));
- ridpointers[(int) RID_FRIEND] = get_identifier ("friend");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_FRIEND],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_FRIEND]));
-
- ridpointers[(int) RID_PUBLIC] = get_identifier ("public");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_PUBLIC],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_PUBLIC]));
- ridpointers[(int) RID_PRIVATE] = get_identifier ("private");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_PRIVATE],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_PRIVATE]));
- ridpointers[(int) RID_PROTECTED] = get_identifier ("protected");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_PROTECTED],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_PROTECTED]));
- ridpointers[(int) RID_TEMPLATE] = get_identifier ("template");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_TEMPLATE],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_TEMPLATE]));
- /* This is for ANSI C++. */
- ridpointers[(int) RID_MUTABLE] = get_identifier ("mutable");
- SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_MUTABLE],
- build_tree_list (NULL_TREE, ridpointers[(int) RID_MUTABLE]));
-
- /* Signature handling extensions. */
- signature_type_node = build_int_2 (signature_type, 0);
- TREE_TYPE (signature_type_node) = signature_type_node;
- ridpointers[(int) RID_SIGNATURE] = signature_type_node;
-
- null_node = build_int_2 (0, 0);
- ridpointers[RID_NULL] = null_node;
-
- opname_tab[(int) COMPONENT_REF] = "->";
- opname_tab[(int) MEMBER_REF] = "->*";
- opname_tab[(int) METHOD_CALL_EXPR] = "->()";
- opname_tab[(int) INDIRECT_REF] = "*";
- opname_tab[(int) ARRAY_REF] = "[]";
- opname_tab[(int) MODIFY_EXPR] = "=";
- opname_tab[(int) NEW_EXPR] = "new";
- opname_tab[(int) DELETE_EXPR] = "delete";
- opname_tab[(int) VEC_NEW_EXPR] = "new []";
- opname_tab[(int) VEC_DELETE_EXPR] = "delete []";
- opname_tab[(int) COND_EXPR] = "?:";
- opname_tab[(int) CALL_EXPR] = "()";
- opname_tab[(int) PLUS_EXPR] = "+";
- opname_tab[(int) MINUS_EXPR] = "-";
- opname_tab[(int) MULT_EXPR] = "*";
- opname_tab[(int) TRUNC_DIV_EXPR] = "/";
- opname_tab[(int) CEIL_DIV_EXPR] = "(ceiling /)";
- opname_tab[(int) FLOOR_DIV_EXPR] = "(floor /)";
- opname_tab[(int) ROUND_DIV_EXPR] = "(round /)";
- opname_tab[(int) TRUNC_MOD_EXPR] = "%";
- opname_tab[(int) CEIL_MOD_EXPR] = "(ceiling %)";
- opname_tab[(int) FLOOR_MOD_EXPR] = "(floor %)";
- opname_tab[(int) ROUND_MOD_EXPR] = "(round %)";
- opname_tab[(int) NEGATE_EXPR] = "-";
- opname_tab[(int) MIN_EXPR] = "<?";
- opname_tab[(int) MAX_EXPR] = ">?";
- opname_tab[(int) ABS_EXPR] = "abs";
- opname_tab[(int) FFS_EXPR] = "ffs";
- opname_tab[(int) LSHIFT_EXPR] = "<<";
- opname_tab[(int) RSHIFT_EXPR] = ">>";
- opname_tab[(int) BIT_IOR_EXPR] = "|";
- opname_tab[(int) BIT_XOR_EXPR] = "^";
- opname_tab[(int) BIT_AND_EXPR] = "&";
- opname_tab[(int) BIT_ANDTC_EXPR] = "&~";
- opname_tab[(int) BIT_NOT_EXPR] = "~";
- opname_tab[(int) TRUTH_ANDIF_EXPR] = "&&";
- opname_tab[(int) TRUTH_ORIF_EXPR] = "||";
- opname_tab[(int) TRUTH_AND_EXPR] = "strict &&";
- opname_tab[(int) TRUTH_OR_EXPR] = "strict ||";
- opname_tab[(int) TRUTH_NOT_EXPR] = "!";
- opname_tab[(int) LT_EXPR] = "<";
- opname_tab[(int) LE_EXPR] = "<=";
- opname_tab[(int) GT_EXPR] = ">";
- opname_tab[(int) GE_EXPR] = ">=";
- opname_tab[(int) EQ_EXPR] = "==";
- opname_tab[(int) NE_EXPR] = "!=";
- opname_tab[(int) IN_EXPR] = "in";
- opname_tab[(int) RANGE_EXPR] = "...";
- opname_tab[(int) CONVERT_EXPR] = "+";
- opname_tab[(int) ADDR_EXPR] = "&";
- opname_tab[(int) PREDECREMENT_EXPR] = "--";
- opname_tab[(int) PREINCREMENT_EXPR] = "++";
- opname_tab[(int) POSTDECREMENT_EXPR] = "--";
- opname_tab[(int) POSTINCREMENT_EXPR] = "++";
- opname_tab[(int) COMPOUND_EXPR] = ",";
-
- assignop_tab[(int) NOP_EXPR] = "=";
- assignop_tab[(int) PLUS_EXPR] = "+=";
- assignop_tab[(int) CONVERT_EXPR] = "+=";
- assignop_tab[(int) MINUS_EXPR] = "-=";
- assignop_tab[(int) NEGATE_EXPR] = "-=";
- assignop_tab[(int) MULT_EXPR] = "*=";
- assignop_tab[(int) INDIRECT_REF] = "*=";
- assignop_tab[(int) TRUNC_DIV_EXPR] = "/=";
- assignop_tab[(int) EXACT_DIV_EXPR] = "(exact /=)";
- assignop_tab[(int) CEIL_DIV_EXPR] = "(ceiling /=)";
- assignop_tab[(int) FLOOR_DIV_EXPR] = "(floor /=)";
- assignop_tab[(int) ROUND_DIV_EXPR] = "(round /=)";
- assignop_tab[(int) TRUNC_MOD_EXPR] = "%=";
- assignop_tab[(int) CEIL_MOD_EXPR] = "(ceiling %=)";
- assignop_tab[(int) FLOOR_MOD_EXPR] = "(floor %=)";
- assignop_tab[(int) ROUND_MOD_EXPR] = "(round %=)";
- assignop_tab[(int) MIN_EXPR] = "<?=";
- assignop_tab[(int) MAX_EXPR] = ">?=";
- assignop_tab[(int) LSHIFT_EXPR] = "<<=";
- assignop_tab[(int) RSHIFT_EXPR] = ">>=";
- assignop_tab[(int) BIT_IOR_EXPR] = "|=";
- assignop_tab[(int) BIT_XOR_EXPR] = "^=";
- assignop_tab[(int) BIT_AND_EXPR] = "&=";
- assignop_tab[(int) ADDR_EXPR] = "&=";
-
- init_filename_times ();
-
- /* Some options inhibit certain reserved words.
- Clear those words out of the hash table so they won't be recognized. */
-#define UNSET_RESERVED_WORD(STRING) \
- do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \
- if (s) s->name = ""; } while (0)
-
-#if 0
- /* let's parse things, and if they use it, then give them an error. */
- if (!flag_exceptions)
- {
- UNSET_RESERVED_WORD ("throw");
- UNSET_RESERVED_WORD ("try");
- UNSET_RESERVED_WORD ("catch");
- }
-#endif
-
- if (!flag_rtti || flag_no_gnu_keywords)
- {
- UNSET_RESERVED_WORD ("classof");
- UNSET_RESERVED_WORD ("headof");
- }
- if (! flag_handle_signatures || flag_no_gnu_keywords)
- {
- /* Easiest way to not recognize signature
- handling extensions... */
- UNSET_RESERVED_WORD ("signature");
- UNSET_RESERVED_WORD ("sigof");
- }
- if (flag_no_asm || flag_no_gnu_keywords)
- UNSET_RESERVED_WORD ("typeof");
- if (! flag_operator_names)
- {
- /* These are new ANSI keywords that may break code. */
- UNSET_RESERVED_WORD ("and");
- UNSET_RESERVED_WORD ("and_eq");
- UNSET_RESERVED_WORD ("bitand");
- UNSET_RESERVED_WORD ("bitor");
- UNSET_RESERVED_WORD ("compl");
- UNSET_RESERVED_WORD ("not");
- UNSET_RESERVED_WORD ("not_eq");
- UNSET_RESERVED_WORD ("or");
- UNSET_RESERVED_WORD ("or_eq");
- UNSET_RESERVED_WORD ("xor");
- UNSET_RESERVED_WORD ("xor_eq");
- }
-
- token_count = init_parse ();
- interface_unknown = 1;
-}
-
-void
-reinit_parse_for_function ()
-{
- current_base_init_list = NULL_TREE;
- current_member_init_list = NULL_TREE;
-}
-
-#ifdef __GNUC__
-__inline
-#endif
-void
-yyprint (file, yychar, yylval)
- FILE *file;
- int yychar;
- YYSTYPE yylval;
-{
- tree t;
- switch (yychar)
- {
- case IDENTIFIER:
- case TYPENAME:
- case TYPESPEC:
- case PTYPENAME:
- case IDENTIFIER_DEFN:
- case TYPENAME_DEFN:
- case PTYPENAME_DEFN:
- case TYPENAME_ELLIPSIS:
- case SCSPEC:
- case PRE_PARSED_CLASS_DECL:
- t = yylval.ttype;
- if (TREE_CODE (t) == TYPE_DECL)
- {
- fprintf (file, " `%s'", DECL_NAME (t));
- break;
- }
- my_friendly_assert (TREE_CODE (t) == IDENTIFIER_NODE, 224);
- if (IDENTIFIER_POINTER (t))
- fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
- break;
- case AGGR:
- if (yylval.ttype == class_type_node)
- fprintf (file, " `class'");
- else if (yylval.ttype == record_type_node)
- fprintf (file, " `struct'");
- else if (yylval.ttype == union_type_node)
- fprintf (file, " `union'");
- else if (yylval.ttype == enum_type_node)
- fprintf (file, " `enum'");
- else if (yylval.ttype == signature_type_node)
- fprintf (file, " `signature'");
- else
- my_friendly_abort (80);
- break;
- }
-}
-
-#if defined(GATHER_STATISTICS) && defined(REDUCE_LENGTH)
-static int *reduce_count;
-#endif
-
-int *token_count;
-
-#if 0
-#define REDUCE_LENGTH (sizeof (yyr2) / sizeof (yyr2[0]))
-#define TOKEN_LENGTH (256 + sizeof (yytname) / sizeof (yytname[0]))
-#endif
-
-int *
-init_parse ()
-{
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
- reduce_count = (int *)malloc (sizeof (int) * (REDUCE_LENGTH + 1));
- bzero (reduce_count, sizeof (int) * (REDUCE_LENGTH + 1));
- reduce_count += 1;
- token_count = (int *)malloc (sizeof (int) * (TOKEN_LENGTH + 1));
- bzero (token_count, sizeof (int) * (TOKEN_LENGTH + 1));
- token_count += 1;
-#endif
-#endif
- return token_count;
-}
-
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
-void
-yyhook (yyn)
- int yyn;
-{
- reduce_count[yyn] += 1;
-}
-
-static int
-reduce_cmp (p, q)
- int *p, *q;
-{
- return reduce_count[*q] - reduce_count[*p];
-}
-
-static int
-token_cmp (p, q)
- int *p, *q;
-{
- return token_count[*q] - token_count[*p];
-}
-#endif
-#endif
-
-void
-print_parse_statistics ()
-{
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
-#if YYDEBUG != 0
- int i;
- int maxlen = REDUCE_LENGTH;
- unsigned *sorted;
-
- if (reduce_count[-1] == 0)
- return;
-
- if (TOKEN_LENGTH > REDUCE_LENGTH)
- maxlen = TOKEN_LENGTH;
- sorted = (unsigned *) alloca (sizeof (int) * maxlen);
-
- for (i = 0; i < TOKEN_LENGTH; i++)
- sorted[i] = i;
- qsort (sorted, TOKEN_LENGTH, sizeof (int), token_cmp);
- for (i = 0; i < TOKEN_LENGTH; i++)
- {
- int idx = sorted[i];
- if (token_count[idx] == 0)
- break;
- if (token_count[idx] < token_count[-1])
- break;
- fprintf (stderr, "token %d, `%s', count = %d\n",
- idx, yytname[YYTRANSLATE (idx)], token_count[idx]);
- }
- fprintf (stderr, "\n");
- for (i = 0; i < REDUCE_LENGTH; i++)
- sorted[i] = i;
- qsort (sorted, REDUCE_LENGTH, sizeof (int), reduce_cmp);
- for (i = 0; i < REDUCE_LENGTH; i++)
- {
- int idx = sorted[i];
- if (reduce_count[idx] == 0)
- break;
- if (reduce_count[idx] < reduce_count[-1])
- break;
- fprintf (stderr, "rule %d, line %d, count = %d\n",
- idx, yyrline[idx], reduce_count[idx]);
- }
- fprintf (stderr, "\n");
-#endif
-#endif
-#endif
-}
-
-/* Sets the value of the 'yydebug' variable to VALUE.
- This is a function so we don't have to have YYDEBUG defined
- in order to build the compiler. */
-
-void
-set_yydebug (value)
- int value;
-{
-#if YYDEBUG != 0
- extern int yydebug;
- yydebug = value;
-#else
- warning ("YYDEBUG not defined.");
-#endif
-}
-
-
-/* Functions and data structures for #pragma interface.
-
- `#pragma implementation' means that the main file being compiled
- is considered to implement (provide) the classes that appear in
- its main body. I.e., if this is file "foo.cc", and class `bar'
- is defined in "foo.cc", then we say that "foo.cc implements bar".
-
- All main input files "implement" themselves automagically.
-
- `#pragma interface' means that unless this file (of the form "foo.h"
- is not presently being included by file "foo.cc", the
- CLASSTYPE_INTERFACE_ONLY bit gets set. The effect is that none
- of the vtables nor any of the inline functions defined in foo.h
- will ever be output.
-
- There are cases when we want to link files such as "defs.h" and
- "main.cc". In this case, we give "defs.h" a `#pragma interface',
- and "main.cc" has `#pragma implementation "defs.h"'. */
-
-struct impl_files
-{
- char *filename;
- struct impl_files *next;
-};
-
-static struct impl_files *impl_file_chain;
-
-/* Helper function to load global variables with interface
- information. */
-
-void
-extract_interface_info ()
-{
- tree fileinfo = 0;
-
- if (flag_alt_external_templates)
- {
- struct tinst_level *til = tinst_for_decl ();
-
- if (til)
- fileinfo = get_time_identifier (til->file);
- }
- if (!fileinfo)
- fileinfo = get_time_identifier (input_filename);
- fileinfo = IDENTIFIER_CLASS_VALUE (fileinfo);
- interface_only = TREE_INT_CST_LOW (fileinfo);
- interface_unknown = TREE_INT_CST_HIGH (fileinfo);
-}
-
-/* Return nonzero if S is not considered part of an
- INTERFACE/IMPLEMENTATION pair. Otherwise, return 0. */
-
-static int
-interface_strcmp (s)
- char *s;
-{
- /* Set the interface/implementation bits for this scope. */
- struct impl_files *ifiles;
- char *s1;
-
- for (ifiles = impl_file_chain; ifiles; ifiles = ifiles->next)
- {
- char *t1 = ifiles->filename;
- s1 = s;
-
- if (*s1 != *t1 || *s1 == 0)
- continue;
-
- while (*s1 == *t1 && *s1 != 0)
- s1++, t1++;
-
- /* A match. */
- if (*s1 == *t1)
- return 0;
-
- /* Don't get faked out by xxx.yyy.cc vs xxx.zzz.cc. */
- if (index (s1, '.') || index (t1, '.'))
- continue;
-
- if (*s1 == '\0' || s1[-1] != '.' || t1[-1] != '.')
- continue;
-
- /* A match. */
- return 0;
- }
-
- /* No matches. */
- return 1;
-}
-
-static void
-set_typedecl_interface_info (prev, vars)
- tree prev, vars;
-{
- tree id = get_time_identifier (DECL_SOURCE_FILE (vars));
- tree fileinfo = IDENTIFIER_CLASS_VALUE (id);
- tree type = TREE_TYPE (vars);
-
- CLASSTYPE_INTERFACE_ONLY (type) = TREE_INT_CST_LOW (fileinfo)
- = interface_strcmp (FILE_NAME_NONDIRECTORY (DECL_SOURCE_FILE (vars)));
-}
-
-static int
-set_vardecl_interface_info (prev, vars)
- tree prev, vars;
-{
- tree type = DECL_CONTEXT (vars);
-
- if (CLASSTYPE_INTERFACE_KNOWN (type))
- {
- if (CLASSTYPE_INTERFACE_ONLY (type))
- set_typedecl_interface_info (prev, TYPE_MAIN_DECL (type));
- else
- CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 1;
- DECL_EXTERNAL (vars) = CLASSTYPE_INTERFACE_ONLY (type);
- TREE_PUBLIC (vars) = 1;
- return 1;
- }
- return 0;
-}
-
-/* Called from the top level: if there are any pending inlines to
- do, set up to process them now. This function sets up the first function
- to be parsed; after it has been, the rule for fndef in parse.y will
- call process_next_inline to start working on the next one. */
-
-void
-do_pending_inlines ()
-{
- struct pending_inline *t;
- tree context;
-
- /* Oops, we're still dealing with the last batch. */
- if (yychar == PRE_PARSED_FUNCTION_DECL)
- return;
-
- /* Reverse the pending inline functions, since
- they were cons'd instead of appended. */
- {
- struct pending_inline *prev = 0, *tail;
- t = pending_inlines;
- pending_inlines = 0;
-
- for (; t; t = tail)
- {
- tail = t->next;
- t->next = prev;
- t->deja_vu = 1;
- prev = t;
- }
- t = prev;
- }
-
- if (t == 0)
- return;
-
- /* Now start processing the first inline function. */
- context = hack_decl_function_context (t->fndecl);
- if (context)
- push_cp_function_context (context);
- if (t->len > 0)
- {
- feed_input (t->buf, t->len, t->can_free ? &inline_text_obstack : 0);
- lineno = t->lineno;
-#if 0
- if (input_filename != t->filename)
- {
- input_filename = t->filename;
- /* Get interface/implementation back in sync. */
- extract_interface_info ();
- }
-#else
- input_filename = t->filename;
- interface_unknown = t->interface == 1;
- interface_only = t->interface == 0;
-#endif
- yychar = PRE_PARSED_FUNCTION_DECL;
- }
- /* Pass back a handle on the rest of the inline functions, so that they
- can be processed later. */
- yylval.ttype = build_tree_list ((tree) t, t->fndecl);
- DECL_PENDING_INLINE_INFO (t->fndecl) = 0;
-}
-
-extern struct pending_input *to_be_restored;
-static int nextchar = -1;
-
-/* Called from the fndecl rule in the parser when the function just parsed
- was declared using a PRE_PARSED_FUNCTION_DECL (i.e. came from
- do_pending_inlines). */
-
-void
-process_next_inline (t)
- tree t;
-{
- tree context;
- struct pending_inline *i = (struct pending_inline *) TREE_PURPOSE (t);
- context = hack_decl_function_context (i->fndecl);
- if (context)
- pop_cp_function_context (context);
- i = i->next;
- if (yychar == YYEMPTY)
- yychar = yylex ();
- if (yychar != END_OF_SAVED_INPUT)
- {
- error ("parse error at end of saved function text");
-
- /* restore_pending_input will abort unless yychar is either
- END_OF_SAVED_INPUT or YYEMPTY; since we already know we're
- hosed, feed back YYEMPTY. We also need to discard nextchar,
- since that may have gotten set as well. */
- nextchar = -1;
- }
- yychar = YYEMPTY;
- if (to_be_restored == 0)
- my_friendly_abort (123);
- restore_pending_input (to_be_restored);
- to_be_restored = 0;
- if (i && i->fndecl != NULL_TREE)
- {
- context = hack_decl_function_context (i->fndecl);
- if (context)
- push_cp_function_context (context);
- feed_input (i->buf, i->len, i->can_free ? &inline_text_obstack : 0);
- lineno = i->lineno;
- input_filename = i->filename;
- yychar = PRE_PARSED_FUNCTION_DECL;
- yylval.ttype = build_tree_list ((tree) i, i->fndecl);
- DECL_PENDING_INLINE_INFO (i->fndecl) = 0;
- }
- if (i)
- {
- interface_unknown = i->interface == 1;
- interface_only = i->interface == 0;
- }
- else
- extract_interface_info ();
-}
-
-/* Since inline methods can refer to text which has not yet been seen,
- we store the text of the method in a structure which is placed in the
- DECL_PENDING_INLINE_INFO field of the FUNCTION_DECL.
- After parsing the body of the class definition, the FUNCTION_DECL's are
- scanned to see which ones have this field set. Those are then digested
- one at a time.
-
- This function's FUNCTION_DECL will have a bit set in its common so
- that we know to watch out for it. */
-
-static void
-consume_string (this_obstack, matching_char)
- register struct obstack *this_obstack;
- int matching_char;
-{
- register int c;
- int starting_lineno = lineno;
- do
- {
- c = getch ();
- if (c == EOF)
- {
- int save_lineno = lineno;
- lineno = starting_lineno;
- if (matching_char == '"')
- error ("end of file encountered inside string constant");
- else
- error ("end of file encountered inside character constant");
- lineno = save_lineno;
- return;
- }
- if (c == '\\')
- {
- obstack_1grow (this_obstack, c);
- c = getch ();
- obstack_1grow (this_obstack, c);
-
- /* Make sure we continue the loop */
- c = 0;
- continue;
- }
- if (c == '\n')
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids newline in string constant");
- lineno++;
- }
- obstack_1grow (this_obstack, c);
- }
- while (c != matching_char);
-}
-
-static int nextyychar = YYEMPTY;
-static YYSTYPE nextyylval;
-
-struct pending_input {
- int nextchar, yychar, nextyychar, eof;
- YYSTYPE yylval, nextyylval;
- struct obstack token_obstack;
- int first_token;
-};
-
-struct pending_input *
-save_pending_input ()
-{
- struct pending_input *p;
- p = (struct pending_input *) xmalloc (sizeof (struct pending_input));
- p->nextchar = nextchar;
- p->yychar = yychar;
- p->nextyychar = nextyychar;
- p->yylval = yylval;
- p->nextyylval = nextyylval;
- p->eof = end_of_file;
- yychar = nextyychar = YYEMPTY;
- nextchar = -1;
- p->first_token = first_token;
- p->token_obstack = token_obstack;
-
- first_token = 0;
- gcc_obstack_init (&token_obstack);
- end_of_file = 0;
- return p;
-}
-
-void
-restore_pending_input (p)
- struct pending_input *p;
-{
- my_friendly_assert (nextchar == -1, 229);
- nextchar = p->nextchar;
- my_friendly_assert (yychar == YYEMPTY || yychar == END_OF_SAVED_INPUT, 230);
- yychar = p->yychar;
- my_friendly_assert (nextyychar == YYEMPTY, 231);
- nextyychar = p->nextyychar;
- yylval = p->yylval;
- nextyylval = p->nextyylval;
- first_token = p->first_token;
- obstack_free (&token_obstack, (char *) 0);
- token_obstack = p->token_obstack;
- end_of_file = p->eof;
- free (p);
-}
-
-/* Return next non-whitespace input character, which may come
- from `finput', or from `nextchar'. */
-
-static int
-yynextch ()
-{
- int c;
-
- if (nextchar >= 0)
- {
- c = nextchar;
- nextchar = -1;
- }
- else c = getch ();
- return skip_white_space (c);
-}
-
-/* Unget character CH from the input stream.
- If RESCAN is non-zero, then we want to `see' this
- character as the next input token. */
-
-void
-yyungetc (ch, rescan)
- int ch;
- int rescan;
-{
- /* Unget a character from the input stream. */
- if (yychar == YYEMPTY || rescan == 0)
- {
- if (nextchar >= 0)
- put_back (nextchar);
- nextchar = ch;
- }
- else
- {
- my_friendly_assert (nextyychar == YYEMPTY, 232);
- nextyychar = yychar;
- nextyylval = yylval;
- yychar = ch;
- }
-}
-
-/* This function stores away the text for an inline function that should
- be processed later. It decides how much later, and may need to move
- the info between obstacks; therefore, the caller should not refer to
- the T parameter after calling this function. */
-
-static void
-store_pending_inline (decl, t)
- tree decl;
- struct pending_inline *t;
-{
- t->fndecl = decl;
- DECL_PENDING_INLINE_INFO (decl) = t;
-
- /* Because we use obstacks, we must process these in precise order. */
- t->next = pending_inlines;
- pending_inlines = t;
-}
-
-static void reinit_parse_for_block PROTO((int, struct obstack *));
-
-void
-reinit_parse_for_method (yychar, decl)
- int yychar;
- tree decl;
-{
- int len;
- int starting_lineno = lineno;
- char *starting_filename = input_filename;
-
- reinit_parse_for_block (yychar, &inline_text_obstack);
-
- len = obstack_object_size (&inline_text_obstack);
- current_base_init_list = NULL_TREE;
- current_member_init_list = NULL_TREE;
- if (decl == void_type_node
- || (current_class_type && TYPE_REDEFINED (current_class_type)))
- {
- /* Happens when we get two declarations of the same
- function in the same scope. */
- char *buf = obstack_finish (&inline_text_obstack);
- obstack_free (&inline_text_obstack, buf);
- return;
- }
- else
- {
- struct pending_inline *t;
- char *buf = obstack_finish (&inline_text_obstack);
-
- t = (struct pending_inline *) obstack_alloc (&inline_text_obstack,
- sizeof (struct pending_inline));
- t->lineno = starting_lineno;
- t->filename = starting_filename;
- t->token = YYEMPTY;
- t->token_value = 0;
- t->buf = buf;
- t->len = len;
- t->can_free = 1;
- t->deja_vu = 0;
-#if 0
- if (interface_unknown && processing_template_defn && flag_external_templates && ! DECL_IN_SYSTEM_HEADER (decl))
- warn_if_unknown_interface (decl);
-#endif
- t->interface = (interface_unknown ? 1 : (interface_only ? 0 : 2));
- store_pending_inline (decl, t);
- }
-}
-
-/* Consume a block -- actually, a method beginning
- with `:' or `{' -- and save it away on the specified obstack. */
-
-static void
-reinit_parse_for_block (pyychar, obstackp)
- int pyychar;
- struct obstack *obstackp;
-{
- register int c = 0;
- int blev = 1;
- int starting_lineno = lineno;
- char *starting_filename = input_filename;
- int len;
- int look_for_semicolon = 0;
- int look_for_lbrac = 0;
-
- if (pyychar == '{')
- obstack_1grow (obstackp, '{');
- else if (pyychar == '=')
- look_for_semicolon = 1;
- else if (pyychar == ':')
- {
- obstack_1grow (obstackp, pyychar);
- look_for_lbrac = 1;
- blev = 0;
- }
- else if (pyychar == RETURN)
- {
- obstack_grow (obstackp, "return", 6);
- look_for_lbrac = 1;
- blev = 0;
- }
- else if (pyychar == TRY)
- {
- obstack_grow (obstackp, "try", 3);
- look_for_lbrac = 1;
- blev = 0;
- }
- else
- {
- yyerror ("parse error in method specification");
- obstack_1grow (obstackp, '{');
- }
-
- if (nextchar != EOF)
- {
- c = nextchar;
- nextchar = EOF;
- }
- else
- c = getch ();
-
- while (c != EOF)
- {
- int this_lineno = lineno;
-
- c = skip_white_space (c);
-
- /* Don't lose our cool if there are lots of comments. */
- if (lineno == this_lineno + 1)
- obstack_1grow (obstackp, '\n');
- else if (lineno == this_lineno)
- ;
- else if (lineno - this_lineno < 10)
- {
- int i;
- for (i = lineno - this_lineno; i > 0; i--)
- obstack_1grow (obstackp, '\n');
- }
- else
- {
- char buf[16];
- sprintf (buf, "\n# %d \"", lineno);
- len = strlen (buf);
- obstack_grow (obstackp, buf, len);
-
- len = strlen (input_filename);
- obstack_grow (obstackp, input_filename, len);
- obstack_1grow (obstackp, '\"');
- obstack_1grow (obstackp, '\n');
- }
-
- while (c > ' ') /* ASCII dependent... */
- {
- obstack_1grow (obstackp, c);
- if (c == '{')
- {
- look_for_lbrac = 0;
- blev++;
- }
- else if (c == '}')
- {
- blev--;
- if (blev == 0 && !look_for_semicolon)
- {
- if (pyychar == TRY)
- {
- if (peekyylex () == CATCH)
- {
- yylex ();
- obstack_grow (obstackp, " catch ", 7);
- look_for_lbrac = 1;
- }
- else
- {
- yychar = '{';
- goto done;
- }
- }
- else
- {
- goto done;
- }
- }
- }
- else if (c == '\\')
- {
- /* Don't act on the next character...e.g, doing an escaped
- double-quote. */
- c = getch ();
- if (c == EOF)
- {
- error_with_file_and_line (starting_filename,
- starting_lineno,
- "end of file read inside definition");
- goto done;
- }
- obstack_1grow (obstackp, c);
- }
- else if (c == '\"')
- consume_string (obstackp, c);
- else if (c == '\'')
- consume_string (obstackp, c);
- else if (c == ';')
- {
- if (look_for_lbrac)
- {
- error ("function body for constructor missing");
- obstack_1grow (obstackp, '{');
- obstack_1grow (obstackp, '}');
- len += 2;
- goto done;
- }
- else if (look_for_semicolon && blev == 0)
- goto done;
- }
- c = getch ();
- }
-
- if (c == EOF)
- {
- error_with_file_and_line (starting_filename,
- starting_lineno,
- "end of file read inside definition");
- goto done;
- }
- else if (c != '\n')
- {
- obstack_1grow (obstackp, c);
- c = getch ();
- }
- }
- done:
- obstack_1grow (obstackp, '\0');
-}
-
-/* Build a default function named NAME for type TYPE.
- KIND says what to build.
-
- When KIND == 0, build default destructor.
- When KIND == 1, build virtual destructor.
- When KIND == 2, build default constructor.
- When KIND == 3, build default X(const X&) constructor.
- When KIND == 4, build default X(X&) constructor.
- When KIND == 5, build default operator = (const X&).
- When KIND == 6, build default operator = (X&). */
-
-tree
-cons_up_default_function (type, full_name, kind)
- tree type, full_name;
- int kind;
-{
- extern tree void_list_node;
- tree declspecs = NULL_TREE;
- tree fn, args;
- tree argtype;
- int retref = 0;
- tree name = constructor_name (full_name);
-
- switch (kind)
- {
- /* Destructors. */
- case 1:
- declspecs = build_decl_list (NULL_TREE, ridpointers [(int) RID_VIRTUAL]);
- /* Fall through... */
- case 0:
- name = build_parse_node (BIT_NOT_EXPR, name);
- args = void_list_node;
- break;
-
- case 2:
- /* Default constructor. */
- args = void_list_node;
- break;
-
- case 3:
- type = build_type_variant (type, 1, 0);
- /* Fall through... */
- case 4:
- /* According to ARM $12.8, the default copy ctor will be declared, but
- not defined, unless it's needed. */
- argtype = build_reference_type (type);
- args = tree_cons (NULL_TREE,
- build_tree_list (hash_tree_chain (argtype, NULL_TREE),
- get_identifier ("_ctor_arg")),
- void_list_node);
- break;
-
- case 5:
- case 6:
- retref = 1;
- declspecs = build_decl_list (NULL_TREE, type);
-
- if (kind == 5)
- type = build_type_variant (type, 1, 0);
-
- name = ansi_opname [(int) MODIFY_EXPR];
-
- argtype = build_reference_type (type);
- args = tree_cons (NULL_TREE,
- build_tree_list (hash_tree_chain (argtype, NULL_TREE),
- get_identifier ("_ctor_arg")),
- void_list_node);
- break;
-
- default:
- my_friendly_abort (59);
- }
-
- declspecs = decl_tree_cons (NULL_TREE, ridpointers [(int) RID_INLINE],
- declspecs);
-
- TREE_PARMLIST (args) = 1;
-
- {
- tree declarator = make_call_declarator (name, args, NULL_TREE, NULL_TREE);
- if (retref)
- declarator = build_parse_node (ADDR_EXPR, declarator);
-
- fn = grokfield (declarator, declspecs, NULL_TREE, NULL_TREE, NULL_TREE);
- }
-
- if (fn == void_type_node)
- return fn;
-
- if (kind > 2)
- SET_DECL_ARTIFICIAL (TREE_CHAIN (DECL_ARGUMENTS (fn)));
-
-#if 0
- if (processing_template_defn)
- {
- SET_DECL_IMPLICIT_INSTANTIATION (fn);
- repo_template_used (fn);
- }
-#endif
-
-#if 0
- if (CLASSTYPE_INTERFACE_KNOWN (type))
- {
- DECL_INTERFACE_KNOWN (fn) = 1;
- DECL_NOT_REALLY_EXTERN (fn) = (!CLASSTYPE_INTERFACE_ONLY (type)
- && flag_implement_inlines);
- }
- else
-#endif
- DECL_NOT_REALLY_EXTERN (fn) = 1;
-
- mark_inline_for_output (fn);
-
-#ifdef DEBUG_DEFAULT_FUNCTIONS
- { char *fn_type = NULL;
- tree t = name;
- switch (kind)
- {
- case 0: fn_type = "default destructor"; break;
- case 1: fn_type = "virtual destructor"; break;
- case 2: fn_type = "default constructor"; break;
- case 3: fn_type = "default X(const X&)"; break;
- case 4: fn_type = "default X(X&)"; break;
- }
- if (fn_type)
- {
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- t = TREE_OPERAND (name, 0);
- fprintf (stderr, "[[[[ %s for %s:\n%s]]]]\n", fn_type,
- IDENTIFIER_POINTER (t), func_buf);
- }
- }
-#endif /* DEBUG_DEFAULT_FUNCTIONS */
-
- /* Show that this function was generated by the compiler. */
- SET_DECL_ARTIFICIAL (fn);
-
- return fn;
-}
-
-/* Heuristic to tell whether the user is missing a semicolon
- after a struct or enum declaration. Emit an error message
- if we know the user has blown it. */
-
-void
-check_for_missing_semicolon (type)
- tree type;
-{
- if (yychar < 0)
- yychar = yylex ();
-
- if ((yychar > 255
- && yychar != SCSPEC
- && yychar != IDENTIFIER
- && yychar != TYPENAME
- && yychar != SELFNAME)
- || end_of_file)
- {
- if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (type)))
- error ("semicolon missing after %s declaration",
- TREE_CODE (type) == ENUMERAL_TYPE ? "enum" : "struct");
- else
- cp_error ("semicolon missing after declaration of `%T'", type);
- shadow_tag (build_tree_list (0, type));
- }
- /* Could probably also hack cases where class { ... } f (); appears. */
- clear_anon_tags ();
-}
-
-void
-note_got_semicolon (type)
- tree type;
-{
- if (TREE_CODE_CLASS (TREE_CODE (type)) != 't')
- my_friendly_abort (60);
- if (IS_AGGR_TYPE (type))
- CLASSTYPE_GOT_SEMICOLON (type) = 1;
-}
-
-void
-note_list_got_semicolon (declspecs)
- tree declspecs;
-{
- tree link;
-
- for (link = declspecs; link; link = TREE_CHAIN (link))
- {
- tree type = TREE_VALUE (link);
- if (TREE_CODE_CLASS (TREE_CODE (type)) == 't')
- note_got_semicolon (type);
- }
- clear_anon_tags ();
-}
-
-/* If C is not whitespace, return C.
- Otherwise skip whitespace and return first nonwhite char read. */
-
-static int
-skip_white_space (c)
- register int c;
-{
- for (;;)
- {
- switch (c)
- {
- case '\n':
- c = check_newline ();
- break;
-
- case ' ':
- case '\t':
- case '\f':
- case '\r':
- case '\v':
- case '\b':
- do
- c = getch ();
- while (c == ' ' || c == '\t');
- break;
-
- case '\\':
- c = getch ();
- if (c == '\n')
- lineno++;
- else
- error ("stray '\\' in program");
- c = getch ();
- break;
-
- default:
- return (c);
- }
- }
-}
-
-
-
-/* Make the token buffer longer, preserving the data in it.
- P should point to just beyond the last valid character in the old buffer.
- The value we return is a pointer to the new buffer
- at a place corresponding to P. */
-
-static char *
-extend_token_buffer (p)
- char *p;
-{
- int offset = p - token_buffer;
-
- maxtoken = maxtoken * 2 + 10;
- token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2);
-
- return token_buffer + offset;
-}
-
-static int
-get_last_nonwhite_on_line ()
-{
- register int c;
-
- /* Is this the last nonwhite stuff on the line? */
- if (nextchar >= 0)
- c = nextchar, nextchar = -1;
- else
- c = getch ();
-
- while (c == ' ' || c == '\t')
- c = getch ();
- return c;
-}
-
-/* At the beginning of a line, increment the line number
- and process any #-directive on this line.
- If the line is a #-directive, read the entire line and return a newline.
- Otherwise, return the line's first non-whitespace character. */
-
-int linemode;
-
-#ifdef HANDLE_SYSV_PRAGMA
-static int handle_sysv_pragma ();
-#endif
-static int handle_cp_pragma ();
-
-static int
-check_newline ()
-{
- register int c;
- register int token;
-
- /* Read first nonwhite char on the line. Do this before incrementing the
- line number, in case we're at the end of saved text. */
-
- do
- c = getch ();
- while (c == ' ' || c == '\t');
-
- lineno++;
-
- if (c != '#')
- {
- /* If not #, return it so caller will use it. */
- return c;
- }
-
- /* Don't read beyond this line. */
- linemode = 1;
-
- /* Read first nonwhite char after the `#'. */
-
- do
- c = getch ();
- while (c == ' ' || c == '\t');
-
- /* If a letter follows, then if the word here is `line', skip
- it and ignore it; otherwise, ignore the line, with an error
- if the word isn't `pragma'. */
-
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
- {
- if (c == 'p')
- {
- if (getch () == 'r'
- && getch () == 'a'
- && getch () == 'g'
- && getch () == 'm'
- && getch () == 'a')
- {
- token = real_yylex ();
- if (token == IDENTIFIER
- && TREE_CODE (yylval.ttype) == IDENTIFIER_NODE)
- {
- /* If this is 1, we handled it; if it's -1, it was one we
- wanted but had something wrong with it. Only if it's
- 0 was it not handled. */
- if (handle_cp_pragma (IDENTIFIER_POINTER (yylval.ttype)))
- goto skipline;
- }
- else if (token == END_OF_LINE)
- goto skipline;
-
-#ifdef HANDLE_SYSV_PRAGMA
- if (handle_sysv_pragma (finput, token))
- goto skipline;
-#else
-#ifdef HANDLE_PRAGMA
- if (HANDLE_PRAGMA (finput, yylval.ttype))
- goto skipline;
-#endif
-#endif
- }
- goto skipline;
- }
- else if (c == 'd')
- {
- if (getch () == 'e'
- && getch () == 'f'
- && getch () == 'i'
- && getch () == 'n'
- && getch () == 'e'
- && ((c = getch ()) == ' ' || c == '\t'))
- {
- debug_define (lineno, get_directive_line (finput));
- goto skipline;
- }
- }
- else if (c == 'u')
- {
- if (getch () == 'n'
- && getch () == 'd'
- && getch () == 'e'
- && getch () == 'f'
- && ((c = getch ()) == ' ' || c == '\t'))
- {
- debug_undef (lineno, get_directive_line (finput));
- goto skipline;
- }
- }
- else if (c == 'l')
- {
- if (getch () == 'i'
- && getch () == 'n'
- && getch () == 'e'
- && ((c = getch ()) == ' ' || c == '\t'))
- goto linenum;
- }
- else if (c == 'i')
- {
- if (getch () == 'd'
- && getch () == 'e'
- && getch () == 'n'
- && getch () == 't'
- && ((c = getch ()) == ' ' || c == '\t'))
- {
-#ifdef ASM_OUTPUT_IDENT
- extern FILE *asm_out_file;
-#endif
- /* #ident. The pedantic warning is now in cccp.c. */
-
- /* Here we have just seen `#ident '.
- A string constant should follow. */
-
- token = real_yylex ();
- if (token == END_OF_LINE)
- goto skipline;
- if (token != STRING
- || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #ident");
- goto skipline;
- }
-
- if (! flag_no_ident)
- {
-#ifdef ASM_OUTPUT_IDENT
- ASM_OUTPUT_IDENT (asm_out_file,
- TREE_STRING_POINTER (yylval.ttype));
-#endif
- }
-
- /* Skip the rest of this line. */
- goto skipline;
- }
- }
- else if (c == 'n')
- {
- if (getch () == 'e'
- && getch () == 'w'
- && getch () == 'w'
- && getch () == 'o'
- && getch () == 'r'
- && getch () == 'l'
- && getch () == 'd'
- && ((c = getch ()) == ' ' || c == '\t'))
- {
- /* Used to test incremental compilation. */
- sorry ("#pragma newworld");
- goto skipline;
- }
- }
- error ("undefined or invalid # directive");
- goto skipline;
- }
-
-linenum:
- /* Here we have either `#line' or `# <nonletter>'.
- In either case, it should be a line number; a digit should follow. */
-
- while (c == ' ' || c == '\t')
- c = getch ();
-
- /* If the # is the only nonwhite char on the line,
- just ignore it. Check the new newline. */
- if (c == EOF)
- goto skipline;
-
- /* Something follows the #; read a token. */
-
- put_back (c);
- token = real_yylex ();
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST)
- {
- int old_lineno = lineno;
- enum { act_none, act_push, act_pop } action = act_none;
- int entering_system_header = 0;
- int entering_c_header = 0;
-
- /* subtract one, because it is the following line that
- gets the specified number */
-
- int l = TREE_INT_CST_LOW (yylval.ttype) - 1;
- c = get_last_nonwhite_on_line ();
- if (c == EOF)
- {
- /* No more: store the line number and check following line. */
- lineno = l;
- goto skipline;
- }
- put_back (c);
-
- /* More follows: it must be a string constant (filename). */
-
- /* Read the string constant, but don't treat \ as special. */
- ignore_escape_flag = 1;
- token = real_yylex ();
- ignore_escape_flag = 0;
-
- if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #line");
- goto skipline;
- }
-
- /* Changing files again. This means currently collected time
- is charged against header time, and body time starts back
- at 0. */
- if (flag_detailed_statistics)
- {
- int this_time = my_get_run_time ();
- tree time_identifier = get_time_identifier (TREE_STRING_POINTER (yylval.ttype));
- header_time += this_time - body_time;
- TREE_INT_CST_LOW (IDENTIFIER_LOCAL_VALUE (this_filename_time))
- += this_time - body_time;
- this_filename_time = time_identifier;
- body_time = this_time;
- }
-
- input_filename
- = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
- strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
- lineno = l;
- GNU_xref_file (input_filename);
-
- if (main_input_filename == 0)
- {
- struct impl_files *ifiles = impl_file_chain;
-
- if (ifiles)
- {
- while (ifiles->next)
- ifiles = ifiles->next;
- ifiles->filename = FILE_NAME_NONDIRECTORY (input_filename);
- }
-
- main_input_filename = input_filename;
- if (write_virtuals == 3)
- walk_vtables (set_typedecl_interface_info, set_vardecl_interface_info);
- }
-
- extract_interface_info ();
-
- c = get_last_nonwhite_on_line ();
- if (c == EOF)
- {
- /* Update the name in the top element of input_file_stack. */
- if (input_file_stack)
- input_file_stack->name = input_filename;
- }
- else
- {
- put_back (c);
-
- token = real_yylex ();
-
- /* `1' after file name means entering new file.
- `2' after file name means just left a file. */
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST)
- {
- if (TREE_INT_CST_LOW (yylval.ttype) == 1)
- action = act_push;
- else if (TREE_INT_CST_LOW (yylval.ttype) == 2)
- action = act_pop;
-
- if (action)
- {
- c = get_last_nonwhite_on_line ();
- if (c != EOF)
- {
- put_back (c);
- token = real_yylex ();
- }
- }
- }
-
- /* `3' after file name means this is a system header file. */
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST
- && TREE_INT_CST_LOW (yylval.ttype) == 3)
- {
- entering_system_header = 1;
-
- c = get_last_nonwhite_on_line ();
- if (c != EOF)
- {
- put_back (c);
- token = real_yylex ();
- }
- }
-
- /* `4' after file name means this is a C header file. */
-
- if (token == CONSTANT
- && TREE_CODE (yylval.ttype) == INTEGER_CST
- && TREE_INT_CST_LOW (yylval.ttype) == 4)
- {
- entering_c_header = 1;
-
- c = get_last_nonwhite_on_line ();
- if (c != EOF)
- {
- put_back (c);
- token = real_yylex ();
- }
- }
-
- /* Do the actions implied by the preceding numbers. */
-
- if (action == act_push)
- {
- /* Pushing to a new file. */
- struct file_stack *p;
-
- p = (struct file_stack *) xmalloc (sizeof (struct file_stack));
- input_file_stack->line = old_lineno;
- p->next = input_file_stack;
- p->name = input_filename;
- input_file_stack = p;
- input_file_stack_tick++;
- debug_start_source_file (input_filename);
- in_system_header = entering_system_header;
- if (c_header_level)
- ++c_header_level;
- else if (entering_c_header)
- {
- c_header_level = 1;
- ++pending_lang_change;
- }
- }
- else if (action == act_pop)
- {
- /* Popping out of a file. */
- if (input_file_stack->next)
- {
- struct file_stack *p;
-
- if (c_header_level && --c_header_level == 0)
- {
- if (entering_c_header)
- warning ("badly nested C headers from preprocessor");
- --pending_lang_change;
- }
- in_system_header = entering_system_header;
-
- p = input_file_stack;
- input_file_stack = p->next;
- free (p);
- input_file_stack_tick++;
- debug_end_source_file (input_file_stack->line);
- }
- else
- error ("#-lines for entering and leaving files don't match");
- }
- else
- in_system_header = entering_system_header;
- }
-
- /* If NEXTCHAR is not end of line, we don't care what it is. */
- if (nextchar == EOF)
- c = EOF;
- }
- else
- error ("invalid #-line");
-
- /* skip the rest of this line. */
- skipline:
- linemode = 0;
- end_of_file = 0;
- nextchar = -1;
- while ((c = getch ()) != EOF && c != '\n');
- return c;
-}
-
-void
-do_pending_lang_change ()
-{
- for (; pending_lang_change > 0; --pending_lang_change)
- push_lang_context (lang_name_c);
- for (; pending_lang_change < 0; ++pending_lang_change)
- pop_lang_context ();
-}
-
-#if 0
-#define isalnum(char) (char >= 'a' ? char <= 'z' : char >= '0' ? char <= '9' || (char >= 'A' && char <= 'Z') : 0)
-#define isdigit(char) (char >= '0' && char <= '9')
-#else
-#include <ctype.h>
-#endif
-
-#define ENDFILE -1 /* token that represents end-of-file */
-
-/* Read an escape sequence, returning its equivalent as a character,
- or store 1 in *ignore_ptr if it is backslash-newline. */
-
-static int
-readescape (ignore_ptr)
- int *ignore_ptr;
-{
- register int c = getch ();
- register int code;
- register unsigned count;
- unsigned firstdig;
- int nonnull;
-
- switch (c)
- {
- case 'x':
- code = 0;
- count = 0;
- nonnull = 0;
- while (1)
- {
- c = getch ();
- if (! isxdigit (c))
- {
- put_back (c);
- break;
- }
- code *= 16;
- if (c >= 'a' && c <= 'f')
- code += c - 'a' + 10;
- if (c >= 'A' && c <= 'F')
- code += c - 'A' + 10;
- if (c >= '0' && c <= '9')
- code += c - '0';
- if (code != 0 || count != 0)
- {
- if (count == 0)
- firstdig = code;
- count++;
- }
- nonnull = 1;
- }
- if (! nonnull)
- error ("\\x used with no following hex digits");
- else if (count == 0)
- /* Digits are all 0's. Ok. */
- ;
- else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node)
- || (count > 1
- && ((1 << (TYPE_PRECISION (integer_type_node) - (count - 1) * 4))
- <= firstdig)))
- pedwarn ("hex escape out of range");
- return code;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7':
- code = 0;
- count = 0;
- while ((c <= '7') && (c >= '0') && (count++ < 3))
- {
- code = (code * 8) + (c - '0');
- c = getch ();
- }
- put_back (c);
- return code;
-
- case '\\': case '\'': case '"':
- return c;
-
- case '\n':
- lineno++;
- *ignore_ptr = 1;
- return 0;
-
- case 'n':
- return TARGET_NEWLINE;
-
- case 't':
- return TARGET_TAB;
-
- case 'r':
- return TARGET_CR;
-
- case 'f':
- return TARGET_FF;
-
- case 'b':
- return TARGET_BS;
-
- case 'a':
- return TARGET_BELL;
-
- case 'v':
- return TARGET_VT;
-
- case 'e':
- case 'E':
- if (pedantic)
- pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
- return 033;
-
- case '?':
- return c;
-
- /* `\(', etc, are used at beginning of line to avoid confusing Emacs. */
- case '(':
- case '{':
- case '[':
- /* `\%' is used to prevent SCCS from getting confused. */
- case '%':
- if (pedantic)
- pedwarn ("unknown escape sequence `\\%c'", c);
- return c;
- }
- if (c >= 040 && c < 0177)
- pedwarn ("unknown escape sequence `\\%c'", c);
- else
- pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
- return c;
-}
-
-/* Value is 1 (or 2) if we should try to make the next identifier look like
- a typename (when it may be a local variable or a class variable).
- Value is 0 if we treat this name in a default fashion. */
-int looking_for_typename = 0;
-
-#ifdef __GNUC__
-extern __inline int identifier_type ();
-__inline
-#endif
-int
-identifier_type (decl)
- tree decl;
-{
- if (TREE_CODE (decl) == TEMPLATE_DECL)
- {
- if (TREE_CODE (DECL_RESULT (decl)) == TYPE_DECL)
- return PTYPENAME;
- }
- if (TREE_CODE (decl) == NAMESPACE_DECL)
- return NSNAME;
- if (TREE_CODE (decl) != TYPE_DECL)
- return IDENTIFIER;
- if (((got_scope && TREE_TYPE (decl) == got_scope)
- || TREE_TYPE (decl) == current_class_type)
- && DECL_ARTIFICIAL (decl))
- return SELFNAME;
- return TYPENAME;
-}
-
-void
-see_typename ()
-{
- looking_for_typename = 1;
- if (yychar < 0)
- if ((yychar = yylex ()) < 0) yychar = 0;
- looking_for_typename = 0;
- if (yychar == IDENTIFIER)
- {
- lastiddecl = lookup_name (yylval.ttype, -2);
- if (lastiddecl == 0)
- {
- if (flag_labels_ok)
- lastiddecl = IDENTIFIER_LABEL_VALUE (yylval.ttype);
- }
- else
- yychar = identifier_type (lastiddecl);
- }
-}
-
-tree
-do_identifier (token, parsing)
- register tree token;
- int parsing;
-{
- register tree id;
-
- if (! parsing || IDENTIFIER_OPNAME_P (token))
- id = lookup_name (token, 0);
- else
- id = lastiddecl;
-
- if (parsing && yychar == YYEMPTY)
- yychar = yylex ();
- /* Scope class declarations before global
- declarations. */
- if (id == IDENTIFIER_GLOBAL_VALUE (token)
- && current_class_type != 0
- && TYPE_SIZE (current_class_type) == 0)
- {
- /* Could be from one of the base classes. */
- tree field = lookup_field (current_class_type, token, 1, 0);
- if (field == 0)
- ;
- else if (field == error_mark_node)
- /* We have already generated the error message.
- But we still want to return this value. */
- id = lookup_field (current_class_type, token, 0, 0);
- else if (TREE_CODE (field) == VAR_DECL
- || TREE_CODE (field) == CONST_DECL)
- id = field;
- else if (TREE_CODE (field) != FIELD_DECL)
- my_friendly_abort (61);
- else
- {
- cp_error ("invalid use of member `%D' from base class `%T'", field,
- DECL_FIELD_CONTEXT (field));
- id = error_mark_node;
- return id;
- }
- }
-
- /* Remember that this name has been used in the class definition, as per
- [class.scope0] */
- if (id && current_class_type && parsing
- && TYPE_BEING_DEFINED (current_class_type)
- && ! IDENTIFIER_CLASS_VALUE (token)
- /* Avoid breaking if we get called for a default argument that
- refers to an overloaded method. Eventually this will not be
- necessary, since default arguments shouldn't be parsed until
- after the class is complete. (jason 3/12/97) */
- && TREE_CODE (id) != TREE_LIST)
- pushdecl_class_level (id);
-
- if (!id || id == error_mark_node)
- {
- if (id == error_mark_node && current_class_type != NULL_TREE)
- {
- id = lookup_nested_field (token, 1);
- /* In lookup_nested_field(), we marked this so we can gracefully
- leave this whole mess. */
- if (id && id != error_mark_node && TREE_TYPE (id) == error_mark_node)
- return id;
- }
-
- if (current_template_parms)
- return build_min_nt (LOOKUP_EXPR, token, NULL_TREE);
- else if (IDENTIFIER_OPNAME_P (token))
- {
- if (token != ansi_opname[ERROR_MARK])
- cp_error ("`%D' not defined", token);
- id = error_mark_node;
- }
- else if (parsing && (yychar == '(' || yychar == LEFT_RIGHT))
- {
- id = implicitly_declare (token);
- }
- else if (current_function_decl == 0)
- {
- cp_error ("`%D' was not declared in this scope", token);
- id = error_mark_node;
- }
- else
- {
- if (IDENTIFIER_GLOBAL_VALUE (token) != error_mark_node
- || IDENTIFIER_ERROR_LOCUS (token) != current_function_decl)
- {
- static int undeclared_variable_notice;
-
- cp_error ("`%D' undeclared (first use this function)", token);
-
- if (! undeclared_variable_notice)
- {
- error ("(Each undeclared identifier is reported only once");
- error ("for each function it appears in.)");
- undeclared_variable_notice = 1;
- }
- }
- id = error_mark_node;
- /* Prevent repeated error messages. */
- IDENTIFIER_GLOBAL_VALUE (token) = error_mark_node;
- SET_IDENTIFIER_ERROR_LOCUS (token, current_function_decl);
- }
- }
-
- if (TREE_CODE (id) == VAR_DECL && DECL_DEAD_FOR_LOCAL (id))
- {
- tree shadowed = DECL_SHADOWED_FOR_VAR (id);
- while (shadowed != NULL_TREE && TREE_CODE (shadowed) == VAR_DECL
- && DECL_DEAD_FOR_LOCAL (shadowed))
- shadowed = DECL_SHADOWED_FOR_VAR (shadowed);
- if (!shadowed)
- shadowed = IDENTIFIER_GLOBAL_VALUE (DECL_NAME (id));
- if (shadowed)
- {
- if (!DECL_ERROR_REPORTED (id))
- {
- warning ("name lookup of `%s' changed",
- IDENTIFIER_POINTER (token));
- cp_warning_at (" matches this `%D' under current ANSI rules",
- shadowed);
- cp_warning_at (" matches this `%D' under old rules", id);
- DECL_ERROR_REPORTED (id) = 1;
- }
- id = shadowed;
- }
- else if (!DECL_ERROR_REPORTED (id))
- {
- static char msg[]
- = "name lookup of `%s' changed for new ANSI `for' scoping";
- DECL_ERROR_REPORTED (id) = 1;
- if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (id)))
- {
- error (msg, IDENTIFIER_POINTER (token));
- cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", id);
- id = error_mark_node;
- }
- else
- {
- pedwarn (msg, IDENTIFIER_POINTER (token));
- cp_pedwarn_at (" using obsolete binding at `%D'", id);
- }
- }
- }
- /* TREE_USED is set in `hack_identifier'. */
- if (TREE_CODE (id) == CONST_DECL)
- {
- if (IDENTIFIER_CLASS_VALUE (token) == id)
- {
- /* Check access. */
- tree access = compute_access (TYPE_BINFO (current_class_type), id);
- if (access == access_private_node)
- cp_error ("enum `%D' is private", id);
- /* protected is OK, since it's an enum of `this'. */
- }
- if (! processing_template_decl
- || (DECL_INITIAL (id)
- && TREE_CODE (DECL_INITIAL (id)) == TEMPLATE_CONST_PARM))
- id = DECL_INITIAL (id);
- }
- else
- id = hack_identifier (id, token);
-
- if (current_template_parms)
- {
- if (is_overloaded_fn (id))
- {
- tree t = build_min (LOOKUP_EXPR, unknown_type_node,
- token, get_first_fn (id));
- if (id != IDENTIFIER_GLOBAL_VALUE (token))
- TREE_OPERAND (t, 1) = error_mark_node;
- id = t;
- }
- else if (! TREE_PERMANENT (id) || TREE_CODE (id) == PARM_DECL
- || TREE_CODE (id) == USING_DECL)
- id = build_min (LOOKUP_EXPR, TREE_TYPE (id), token, error_mark_node);
- /* else just use the decl */
- }
-
- return id;
-}
-
-tree
-do_scoped_id (token, parsing)
- tree token;
- int parsing;
-{
- tree id = IDENTIFIER_GLOBAL_VALUE (token);
- if (parsing && yychar == YYEMPTY)
- yychar = yylex ();
- if (! id)
- {
- if (processing_template_decl)
- {
- id = build_min_nt (LOOKUP_EXPR, token, NULL_TREE);
- LOOKUP_EXPR_GLOBAL (id) = 1;
- return id;
- }
- if (parsing && yychar == '(' || yychar == LEFT_RIGHT)
- id = implicitly_declare (token);
- else
- {
- if (IDENTIFIER_GLOBAL_VALUE (token) != error_mark_node)
- error ("undeclared variable `%s' (first use here)",
- IDENTIFIER_POINTER (token));
- id = error_mark_node;
- /* Prevent repeated error messages. */
- IDENTIFIER_GLOBAL_VALUE (token) = error_mark_node;
- }
- }
- else
- {
- if (TREE_CODE (id) == ADDR_EXPR)
- mark_used (TREE_OPERAND (id, 0));
- else if (TREE_CODE (id) != TREE_LIST)
- mark_used (id);
- }
- if (TREE_CODE (id) == CONST_DECL && ! processing_template_decl)
- {
- /* XXX CHS - should we set TREE_USED of the constant? */
- id = DECL_INITIAL (id);
- /* This is to prevent an enum whose value is 0
- from being considered a null pointer constant. */
- id = build1 (NOP_EXPR, TREE_TYPE (id), id);
- TREE_CONSTANT (id) = 1;
- }
-
- if (processing_template_decl)
- {
- if (is_overloaded_fn (id))
- {
- id = build_min (LOOKUP_EXPR, unknown_type_node,
- token, get_first_fn (id));
- LOOKUP_EXPR_GLOBAL (id) = 1;
- }
- /* else just use the decl */
- }
- return id;
-}
-
-tree
-identifier_typedecl_value (node)
- tree node;
-{
- tree t, type;
- type = IDENTIFIER_TYPE_VALUE (node);
- if (type == NULL_TREE)
- return NULL_TREE;
-#define do(X) \
- { \
- t = (X); \
- if (t && TREE_CODE (t) == TYPE_DECL && TREE_TYPE (t) == type) \
- return t; \
- }
- do (IDENTIFIER_LOCAL_VALUE (node));
- do (IDENTIFIER_CLASS_VALUE (node));
- do (IDENTIFIER_GLOBAL_VALUE (node));
-#undef do
- /* Will this one ever happen? */
- if (TYPE_MAIN_DECL (type))
- return TYPE_MAIN_DECL (type);
-
- /* We used to do an internal error of 62 here, but instead we will
- handle the return of a null appropriately in the callers. */
- return NULL_TREE;
-}
-
-int
-real_yylex ()
-{
- register int c;
- register int value;
- int wide_flag = 0;
- int dollar_seen = 0;
- int i;
-
- if (nextchar >= 0)
- c = nextchar, nextchar = -1;
- else
- c = getch ();
-
- /* Effectively do c = skip_white_space (c)
- but do it faster in the usual cases. */
- while (1)
- switch (c)
- {
- case ' ':
- case '\t':
- case '\f':
- case '\v':
- case '\b':
- c = getch ();
- break;
-
- case '\r':
- /* Call skip_white_space so we can warn if appropriate. */
-
- case '\n':
- case '/':
- case '\\':
- c = skip_white_space (c);
- default:
- goto found_nonwhite;
- }
- found_nonwhite:
-
- token_buffer[0] = c;
- token_buffer[1] = 0;
-
-/* yylloc.first_line = lineno; */
-
- switch (c)
- {
- case EOF:
- token_buffer[0] = '\0';
- end_of_file = 1;
- if (input_redirected ())
- value = END_OF_SAVED_INPUT;
- else if (linemode)
- value = END_OF_LINE;
- else
- value = ENDFILE;
- break;
-
- case '$':
- if (dollars_in_ident)
- {
- dollar_seen = 1;
- goto letter;
- }
- value = '$';
- goto done;
-
- case 'L':
- /* Capital L may start a wide-string or wide-character constant. */
- {
- register int c = getch ();
- if (c == '\'')
- {
- wide_flag = 1;
- goto char_constant;
- }
- if (c == '"')
- {
- wide_flag = 1;
- goto string_constant;
- }
- put_back (c);
- }
-
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F': case 'G': case 'H': case 'I': case 'J':
- case 'K': case 'M': case 'N': case 'O':
- case 'P': case 'Q': case 'R': case 'S': case 'T':
- case 'U': case 'V': case 'W': case 'X': case 'Y':
- case 'Z':
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f': case 'g': case 'h': case 'i': case 'j':
- case 'k': case 'l': case 'm': case 'n': case 'o':
- case 'p': case 'q': case 'r': case 's': case 't':
- case 'u': case 'v': case 'w': case 'x': case 'y':
- case 'z':
- case '_':
- letter:
- {
- register char *p;
-
- p = token_buffer;
- if (input == 0)
- {
- /* We know that `token_buffer' can hold at least on char,
- so we install C immediately.
- We may have to read the value in `putback_char', so call
- `getch' once. */
- *p++ = c;
- c = getch ();
-
- /* Make this run fast. We know that we are reading straight
- from FINPUT in this case (since identifiers cannot straddle
- input sources. */
- while (isalnum (c) || (c == '_') || c == '$')
- {
- if (c == '$' && ! dollars_in_ident)
- break;
- if (p >= token_buffer + maxtoken)
- p = extend_token_buffer (p);
-
- *p++ = c;
- c = getc (finput);
- }
-
- if (linemode && c == '\n')
- {
- put_back (c);
- c = EOF;
- }
- }
- else
- {
- /* We know that `token_buffer' can hold at least on char,
- so we install C immediately. */
- *p++ = c;
- c = getch ();
-
- while (isalnum (c) || (c == '_') || c == '$')
- {
- if (c == '$' && ! dollars_in_ident)
- break;
- if (p >= token_buffer + maxtoken)
- p = extend_token_buffer (p);
-
- *p++ = c;
- c = getch ();
- }
- }
-
- *p = 0;
- nextchar = c;
-
- value = IDENTIFIER;
- yylval.itype = 0;
-
- /* Try to recognize a keyword. Uses minimum-perfect hash function */
-
- {
- register struct resword *ptr;
-
- if (ptr = is_reserved_word (token_buffer, p - token_buffer))
- {
- if (ptr->rid)
- {
- tree old_ttype = ridpointers[(int) ptr->rid];
-
- /* If this provides a type for us, then revert lexical
- state to standard state. */
- if (TREE_CODE (old_ttype) == IDENTIFIER_NODE
- && IDENTIFIER_GLOBAL_VALUE (old_ttype) != 0
- && TREE_CODE (IDENTIFIER_GLOBAL_VALUE (old_ttype)) == TYPE_DECL)
- looking_for_typename = 0;
- else if (ptr->token == AGGR || ptr->token == ENUM)
- looking_for_typename = 1;
-
- /* Check if this is a language-type declaration.
- Just glimpse the next non-white character. */
- nextchar = skip_white_space (nextchar);
- if (nextchar == '"')
- {
- /* We are looking at a string. Complain
- if the token before the string is no `extern'.
-
- Could cheat some memory by placing this string
- on the temporary_, instead of the saveable_
- obstack. */
-
- if (ptr->rid != RID_EXTERN)
- error ("invalid modifier `%s' for language string",
- ptr->name);
- real_yylex ();
- value = EXTERN_LANG_STRING;
- yylval.ttype = get_identifier (TREE_STRING_POINTER (yylval.ttype));
- break;
- }
- if (ptr->token == VISSPEC)
- {
- switch (ptr->rid)
- {
- case RID_PUBLIC:
- yylval.ttype = access_public_node;
- break;
- case RID_PRIVATE:
- yylval.ttype = access_private_node;
- break;
- case RID_PROTECTED:
- yylval.ttype = access_protected_node;
- break;
- default:
- my_friendly_abort (63);
- }
- }
- else
- yylval.ttype = old_ttype;
- }
- else if (ptr->token == EQCOMPARE)
- {
- yylval.code = NE_EXPR;
- token_buffer[0] = '!';
- token_buffer[1] = '=';
- token_buffer[2] = 0;
- }
- else if (ptr->token == ASSIGN)
- {
- if (strcmp ("and_eq", token_buffer) == 0)
- {
- yylval.code = BIT_AND_EXPR;
- token_buffer[0] = '&';
- }
- else if (strcmp ("or_eq", token_buffer) == 0)
- {
- yylval.code = BIT_IOR_EXPR;
- token_buffer[0] = '|';
- }
- else if (strcmp ("xor_eq", token_buffer) == 0)
- {
- yylval.code = BIT_XOR_EXPR;
- token_buffer[0] = '^';
- }
- token_buffer[1] = '=';
- token_buffer[2] = 0;
- }
- else if (ptr->token == '&')
- {
- yylval.code = BIT_AND_EXPR;
- token_buffer[0] = '&';
- token_buffer[1] = 0;
- }
- else if (ptr->token == '|')
- {
- yylval.code = BIT_IOR_EXPR;
- token_buffer[0] = '|';
- token_buffer[1] = 0;
- }
- else if (ptr->token == '^')
- {
- yylval.code = BIT_XOR_EXPR;
- token_buffer[0] = '^';
- token_buffer[1] = 0;
- }
- else if (ptr->token == NAMESPACE)
- {
- static int warned;
- if (! warned)
- warning ("namespaces are mostly broken in this version of g++");
-
- warned = 1;
- }
-
- value = (int) ptr->token;
- }
- }
-
- /* If we did not find a keyword, look for an identifier
- (or a typename). */
-
- if (value == IDENTIFIER || value == TYPESPEC)
- GNU_xref_ref (current_function_decl, token_buffer);
-
- if (value == IDENTIFIER)
- {
- register tree tmp = get_identifier (token_buffer);
-
-#if !defined(VMS) && defined(JOINER)
- /* Make sure that user does not collide with our internal
- naming scheme. */
- if (JOINER == '$'
- && dollar_seen
- && (THIS_NAME_P (tmp)
- || VPTR_NAME_P (tmp)
- || DESTRUCTOR_NAME_P (tmp)
- || VTABLE_NAME_P (tmp)
- || TEMP_NAME_P (tmp)
- || ANON_AGGRNAME_P (tmp)
- || ANON_PARMNAME_P (tmp)))
- warning ("identifier name `%s' conflicts with GNU C++ internal naming strategy",
- token_buffer);
-#endif
-
- yylval.ttype = tmp;
-
- /* A user-invisible read-only initialized variable
- should be replaced by its value. We only handle strings
- since that's the only case used in C (and C++). */
- /* Note we go right after the local value for the identifier
- (e.g., __FUNCTION__ or __PRETTY_FUNCTION__). We used to
- call lookup_name, but that could result in an error about
- ambiguities. */
- tmp = IDENTIFIER_LOCAL_VALUE (yylval.ttype);
- if (tmp != NULL_TREE
- && TREE_CODE (tmp) == VAR_DECL
- && DECL_IGNORED_P (tmp)
- && TREE_READONLY (tmp)
- && DECL_INITIAL (tmp) != NULL_TREE
- && TREE_CODE (DECL_INITIAL (tmp)) == STRING_CST)
- {
- tree stringval = DECL_INITIAL (tmp);
-
- /* Copy the string value so that we won't clobber anything
- if we put something in the TREE_CHAIN of this one. */
- yylval.ttype = build_string (TREE_STRING_LENGTH (stringval),
- TREE_STRING_POINTER (stringval));
- value = STRING;
- }
- }
- if (value == NEW && ! global_bindings_p ())
- {
- value = NEW;
- goto done;
- }
- }
- break;
-
- case '.':
- {
- register int c1 = getch ();
- token_buffer[0] = c;
- token_buffer[1] = c1;
- if (c1 == '*')
- {
- value = DOT_STAR;
- token_buffer[2] = 0;
- goto done;
- }
- if (c1 == '.')
- {
- c1 = getch ();
- if (c1 == '.')
- {
- token_buffer[2] = c1;
- token_buffer[3] = 0;
- value = ELLIPSIS;
- goto done;
- }
- error ("parse error at `..'");
- }
- if (isdigit (c1))
- {
- put_back (c1);
- goto resume_numerical_scan;
- }
- nextchar = c1;
- value = '.';
- token_buffer[1] = 0;
- goto done;
- }
- case '0': case '1':
- /* Optimize for most frequent case. */
- {
- register int c1 = getch ();
- if (! isalnum (c1) && c1 != '.')
- {
- /* Terminate string. */
- token_buffer[0] = c;
- token_buffer[1] = 0;
- if (c == '0')
- yylval.ttype = integer_zero_node;
- else
- yylval.ttype = integer_one_node;
- nextchar = c1;
- value = CONSTANT;
- goto done;
- }
- put_back (c1);
- }
- /* fall through... */
- case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- resume_numerical_scan:
- {
- register char *p;
- int base = 10;
- int count = 0;
- int largest_digit = 0;
- int numdigits = 0;
- /* for multi-precision arithmetic,
- we actually store only HOST_BITS_PER_CHAR bits in each part.
- The number of parts is chosen so as to be sufficient to hold
- the enough bits to fit into the two HOST_WIDE_INTs that contain
- the integer value (this is always at least as many bits as are
- in a target `long long' value, but may be wider). */
-#define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2 + 2)
- int parts[TOTAL_PARTS];
- int overflow = 0;
-
- enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS} floatflag
- = NOT_FLOAT;
-
- p = token_buffer;
- *p++ = c;
-
- for (count = 0; count < TOTAL_PARTS; count++)
- parts[count] = 0;
-
- if (c == '0')
- {
- *p++ = (c = getch ());
- if ((c == 'x') || (c == 'X'))
- {
- base = 16;
- *p++ = (c = getch ());
- }
- /* Leading 0 forces octal unless the 0 is the only digit. */
- else if (c >= '0' && c <= '9')
- {
- base = 8;
- numdigits++;
- }
- else
- numdigits++;
- }
-
- /* Read all the digits-and-decimal-points. */
-
- while (c == '.'
- || (isalnum (c) && (c != 'l') && (c != 'L')
- && (c != 'u') && (c != 'U')
- && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F')))))
- {
- if (c == '.')
- {
- if (base == 16)
- error ("floating constant may not be in radix 16");
- if (floatflag == AFTER_POINT)
- {
- error ("malformed floating constant");
- floatflag = TOO_MANY_POINTS;
- }
- else
- floatflag = AFTER_POINT;
-
- base = 10;
- *p++ = c = getch ();
- /* Accept '.' as the start of a floating-point number
- only when it is followed by a digit.
- Otherwise, unread the following non-digit
- and use the '.' as a structural token. */
- if (p == token_buffer + 2 && !isdigit (c))
- {
- if (c == '.')
- {
- c = getch ();
- if (c == '.')
- {
- *p++ = '.';
- *p = '\0';
- value = ELLIPSIS;
- goto done;
- }
- error ("parse error at `..'");
- }
- nextchar = c;
- token_buffer[1] = '\0';
- value = '.';
- goto done;
- }
- }
- else
- {
- /* It is not a decimal point.
- It should be a digit (perhaps a hex digit). */
-
- if (isdigit (c))
- {
- c = c - '0';
- }
- else if (base <= 10)
- {
- if (c == 'e' || c == 'E')
- {
- base = 10;
- floatflag = AFTER_POINT;
- break; /* start of exponent */
- }
- error ("nondigits in number and not hexadecimal");
- c = 0;
- }
- else if (c >= 'a')
- {
- c = c - 'a' + 10;
- }
- else
- {
- c = c - 'A' + 10;
- }
- if (c >= largest_digit)
- largest_digit = c;
- numdigits++;
-
- for (count = 0; count < TOTAL_PARTS; count++)
- {
- parts[count] *= base;
- if (count)
- {
- parts[count]
- += (parts[count-1] >> HOST_BITS_PER_CHAR);
- parts[count-1]
- &= (1 << HOST_BITS_PER_CHAR) - 1;
- }
- else
- parts[0] += c;
- }
-
- /* If the extra highest-order part ever gets anything in it,
- the number is certainly too big. */
- if (parts[TOTAL_PARTS - 1] != 0)
- overflow = 1;
-
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = (c = getch ());
- }
- }
-
- if (numdigits == 0)
- error ("numeric constant with no digits");
-
- if (largest_digit >= base)
- error ("numeric constant contains digits beyond the radix");
-
- /* Remove terminating char from the token buffer and delimit the string */
- *--p = 0;
-
- if (floatflag != NOT_FLOAT)
- {
- tree type = double_type_node;
- char f_seen = 0;
- char l_seen = 0;
- int garbage_chars = 0;
- REAL_VALUE_TYPE value;
- jmp_buf handler;
-
- /* Read explicit exponent if any, and put it in tokenbuf. */
-
- if ((c == 'e') || (c == 'E'))
- {
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getch ();
- if ((c == '+') || (c == '-'))
- {
- *p++ = c;
- c = getch ();
- }
- if (! isdigit (c))
- error ("floating constant exponent has no digits");
- while (isdigit (c))
- {
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getch ();
- }
- }
-
- *p = 0;
- errno = 0;
-
- /* Convert string to a double, checking for overflow. */
- if (setjmp (handler))
- {
- error ("floating constant out of range");
- value = dconst0;
- }
- else
- {
- set_float_handler (handler);
- /* The second argument, machine_mode, of REAL_VALUE_ATOF
- tells the desired precision of the binary result of
- decimal-to-binary conversion. */
-
- /* Read the suffixes to choose a data type. */
- switch (c)
- {
- case 'f': case 'F':
- type = float_type_node;
- value = REAL_VALUE_ATOF (token_buffer, TYPE_MODE (type));
- garbage_chars = -1;
- break;
-
- case 'l': case 'L':
- type = long_double_type_node;
- value = REAL_VALUE_ATOF (token_buffer, TYPE_MODE (type));
- garbage_chars = -1;
- break;
-
- default:
- value = REAL_VALUE_ATOF (token_buffer, TYPE_MODE (type));
- }
- set_float_handler (NULL_PTR);
- }
- if (pedantic
- && (REAL_VALUE_ISINF (value)
-#ifdef ERANGE
- || (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- && errno == ERANGE
- /* ERANGE is also reported for underflow, so test the
- value to distinguish overflow from that. */
- && (REAL_VALUES_LESS (dconst1, value)
- || REAL_VALUES_LESS (value, dconstm1)))
-#endif
- ))
- {
- pedwarn ("floating point number exceeds range of `%s'",
- IDENTIFIER_POINTER (TYPE_IDENTIFIER (type)));
- }
- /* Note: garbage_chars is -1 if first char is *not* garbage. */
- while (isalnum (c))
- {
- if (c == 'f' || c == 'F')
- {
- if (f_seen)
- error ("two `f's in floating constant");
- f_seen = 1;
- }
- if (c == 'l' || c == 'L')
- {
- if (l_seen)
- error ("two `l's in floating constant");
- l_seen = 1;
- }
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getch ();
- garbage_chars++;
- }
-
- if (garbage_chars > 0)
- error ("garbage at end of number");
-
- /* Create a node with determined type and value. */
- yylval.ttype = build_real (type, value);
-
- put_back (c);
- *p = 0;
- }
- else
- {
- tree type;
- HOST_WIDE_INT high, low;
- int spec_unsigned = 0;
- int spec_long = 0;
- int spec_long_long = 0;
- int bytes, warn;
-
- while (1)
- {
- if (c == 'u' || c == 'U')
- {
- if (spec_unsigned)
- error ("two `u's in integer constant");
- spec_unsigned = 1;
- }
- else if (c == 'l' || c == 'L')
- {
- if (spec_long)
- {
- if (spec_long_long)
- error ("three `l's in integer constant");
- else if (pedantic)
- pedwarn ("ANSI C++ forbids long long integer constants");
- spec_long_long = 1;
- }
- spec_long = 1;
- }
- else
- {
- if (isalnum (c))
- {
- error ("garbage at end of number");
- while (isalnum (c))
- {
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getch ();
- }
- }
- break;
- }
- if (p >= token_buffer + maxtoken - 3)
- p = extend_token_buffer (p);
- *p++ = c;
- c = getch ();
- }
-
- put_back (c);
-
- /* If the constant is not long long and it won't fit in an
- unsigned long, or if the constant is long long and won't fit
- in an unsigned long long, then warn that the constant is out
- of range. */
-
- /* ??? This assumes that long long and long integer types are
- a multiple of 8 bits. This better than the original code
- though which assumed that long was exactly 32 bits and long
- long was exactly 64 bits. */
-
- if (spec_long_long)
- bytes = TYPE_PRECISION (long_long_integer_type_node) / 8;
- else
- bytes = TYPE_PRECISION (long_integer_type_node) / 8;
-
- warn = overflow;
- for (i = bytes; i < TOTAL_PARTS; i++)
- if (parts[i])
- warn = 1;
- if (warn)
- pedwarn ("integer constant out of range");
-
- /* This is simplified by the fact that our constant
- is always positive. */
- high = low = 0;
-
- for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
- {
- high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT
- / HOST_BITS_PER_CHAR)]
- << (i * HOST_BITS_PER_CHAR));
- low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR);
- }
-
-
- yylval.ttype = build_int_2 (low, high);
- TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node;
-
- if (!spec_long && !spec_unsigned
- && int_fits_type_p (yylval.ttype, integer_type_node))
- {
- type = integer_type_node;
- }
- else if (!spec_long && (base != 10 || spec_unsigned)
- && int_fits_type_p (yylval.ttype, unsigned_type_node))
- {
- /* Nondecimal constants try unsigned even in traditional C. */
- type = unsigned_type_node;
- }
-
- else if (!spec_unsigned && !spec_long_long
- && int_fits_type_p (yylval.ttype, long_integer_type_node))
- type = long_integer_type_node;
-
- else if (! spec_long_long
- && int_fits_type_p (yylval.ttype,
- long_unsigned_type_node))
- type = long_unsigned_type_node;
-
- else if (! spec_unsigned
- /* Verify value does not overflow into sign bit. */
- && TREE_INT_CST_HIGH (yylval.ttype) >= 0
- && int_fits_type_p (yylval.ttype,
- long_long_integer_type_node))
- type = long_long_integer_type_node;
-
- else if (int_fits_type_p (yylval.ttype,
- long_long_unsigned_type_node))
- type = long_long_unsigned_type_node;
-
- else
- {
- type = long_long_integer_type_node;
- warning ("integer constant out of range");
-
- if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
- warning ("decimal integer constant is so large that it is unsigned");
- }
-
- TREE_TYPE (yylval.ttype) = type;
- *p = 0;
- }
-
- value = CONSTANT; break;
- }
-
- case '\'':
- char_constant:
- {
- register int result = 0;
- register int num_chars = 0;
- unsigned width = TYPE_PRECISION (char_type_node);
- int max_chars;
-
- if (wide_flag)
- {
- width = WCHAR_TYPE_SIZE;
-#ifdef MULTIBYTE_CHARS
- max_chars = MB_CUR_MAX;
-#else
- max_chars = 1;
-#endif
- }
- else
- max_chars = TYPE_PRECISION (integer_type_node) / width;
-
- while (1)
- {
- tryagain:
-
- c = getch ();
-
- if (c == '\'' || c == EOF)
- break;
-
- if (c == '\\')
- {
- int ignore = 0;
- c = readescape (&ignore);
- if (ignore)
- goto tryagain;
- if (width < HOST_BITS_PER_INT
- && (unsigned) c >= (1 << width))
- warning ("escape sequence out of range for character");
-#ifdef MAP_CHARACTER
- if (isprint (c))
- c = MAP_CHARACTER (c);
-#endif
- }
- else if (c == '\n')
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids newline in character constant");
- lineno++;
- }
-#ifdef MAP_CHARACTER
- else
- c = MAP_CHARACTER (c);
-#endif
-
- num_chars++;
- if (num_chars > maxtoken - 4)
- extend_token_buffer (token_buffer);
-
- token_buffer[num_chars] = c;
-
- /* Merge character into result; ignore excess chars. */
- if (num_chars < max_chars + 1)
- {
- if (width < HOST_BITS_PER_INT)
- result = (result << width) | (c & ((1 << width) - 1));
- else
- result = c;
- }
- }
-
- token_buffer[num_chars + 1] = '\'';
- token_buffer[num_chars + 2] = 0;
-
- if (c != '\'')
- error ("malformatted character constant");
- else if (num_chars == 0)
- error ("empty character constant");
- else if (num_chars > max_chars)
- {
- num_chars = max_chars;
- error ("character constant too long");
- }
- else if (num_chars != 1)
- warning ("multi-character character constant");
-
- /* If char type is signed, sign-extend the constant. */
- if (! wide_flag)
- {
- int num_bits = num_chars * width;
- if (num_bits == 0)
- /* We already got an error; avoid invalid shift. */
- yylval.ttype = build_int_2 (0, 0);
- else if (TREE_UNSIGNED (char_type_node)
- || ((result >> (num_bits - 1)) & 1) == 0)
- yylval.ttype
- = build_int_2 (result & ((unsigned HOST_WIDE_INT) ~0
- >> (HOST_BITS_PER_WIDE_INT - num_bits)),
- 0);
- else
- yylval.ttype
- = build_int_2 (result | ~((unsigned HOST_WIDE_INT) ~0
- >> (HOST_BITS_PER_WIDE_INT - num_bits)),
- -1);
- if (num_chars<=1)
- TREE_TYPE (yylval.ttype) = char_type_node;
- else
- TREE_TYPE (yylval.ttype) = integer_type_node;
- }
- else
- {
-#ifdef MULTIBYTE_CHARS
- /* Set the initial shift state and convert the next sequence. */
- result = 0;
- /* In all locales L'\0' is zero and mbtowc will return zero,
- so don't use it. */
- if (num_chars > 1
- || (num_chars == 1 && token_buffer[1] != '\0'))
- {
- wchar_t wc;
- (void) mbtowc (NULL, NULL, 0);
- if (mbtowc (& wc, token_buffer + 1, num_chars) == num_chars)
- result = wc;
- else
- warning ("Ignoring invalid multibyte character");
- }
-#endif
- yylval.ttype = build_int_2 (result, 0);
- TREE_TYPE (yylval.ttype) = wchar_type_node;
- }
-
- value = CONSTANT;
- break;
- }
-
- case '"':
- string_constant:
- {
- register char *p;
-
- c = getch ();
- p = token_buffer + 1;
-
- while (c != '"' && c >= 0)
- {
- /* ignore_escape_flag is set for reading the filename in #line. */
- if (!ignore_escape_flag && c == '\\')
- {
- int ignore = 0;
- c = readescape (&ignore);
- if (ignore)
- goto skipnewline;
- if (!wide_flag
- && TYPE_PRECISION (char_type_node) < HOST_BITS_PER_INT
- && c >= ((unsigned) 1 << TYPE_PRECISION (char_type_node)))
- warning ("escape sequence out of range for character");
- }
- else if (c == '\n')
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids newline in string constant");
- lineno++;
- }
-
- if (p == token_buffer + maxtoken)
- p = extend_token_buffer (p);
- *p++ = c;
-
- skipnewline:
- c = getch ();
- if (c == EOF) {
- error ("Unterminated string");
- break;
- }
- }
- *p = 0;
-
- /* We have read the entire constant.
- Construct a STRING_CST for the result. */
-
- if (wide_flag)
- {
- /* If this is a L"..." wide-string, convert the multibyte string
- to a wide character string. */
- char *widep = (char *) alloca ((p - token_buffer) * WCHAR_BYTES);
- int len;
-
-#ifdef MULTIBYTE_CHARS
- len = mbstowcs ((wchar_t *) widep, token_buffer + 1, p - token_buffer);
- if (len < 0 || len >= (p - token_buffer))
- {
- warning ("Ignoring invalid multibyte string");
- len = 0;
- }
- bzero (widep + (len * WCHAR_BYTES), WCHAR_BYTES);
-#else
- {
- union { long l; char c[sizeof (long)]; } u;
- int big_endian;
- char *wp, *cp;
-
- /* Determine whether host is little or big endian. */
- u.l = 1;
- big_endian = u.c[sizeof (long) - 1];
- wp = widep + (big_endian ? WCHAR_BYTES - 1 : 0);
-
- bzero (widep, (p - token_buffer) * WCHAR_BYTES);
- for (cp = token_buffer + 1; cp < p; cp++)
- *wp = *cp, wp += WCHAR_BYTES;
- len = p - token_buffer - 1;
- }
-#endif
- if (processing_template_decl)
- push_obstacks (&permanent_obstack, &permanent_obstack);
- yylval.ttype = build_string ((len + 1) * WCHAR_BYTES, widep);
- if (processing_template_decl)
- pop_obstacks ();
- TREE_TYPE (yylval.ttype) = wchar_array_type_node;
- }
- else
- {
- if (processing_template_decl)
- push_obstacks (&permanent_obstack, &permanent_obstack);
- yylval.ttype = build_string (p - token_buffer, token_buffer + 1);
- if (processing_template_decl)
- pop_obstacks ();
- TREE_TYPE (yylval.ttype) = char_array_type_node;
- }
-
- *p++ = '"';
- *p = 0;
-
- value = STRING; break;
- }
-
- case '+':
- case '-':
- case '&':
- case '|':
- case '<':
- case '>':
- case '*':
- case '/':
- case '%':
- case '^':
- case '!':
- case '=':
- {
- register int c1;
-
- combine:
-
- switch (c)
- {
- case '+':
- yylval.code = PLUS_EXPR; break;
- case '-':
- yylval.code = MINUS_EXPR; break;
- case '&':
- yylval.code = BIT_AND_EXPR; break;
- case '|':
- yylval.code = BIT_IOR_EXPR; break;
- case '*':
- yylval.code = MULT_EXPR; break;
- case '/':
- yylval.code = TRUNC_DIV_EXPR; break;
- case '%':
- yylval.code = TRUNC_MOD_EXPR; break;
- case '^':
- yylval.code = BIT_XOR_EXPR; break;
- case LSHIFT:
- yylval.code = LSHIFT_EXPR; break;
- case RSHIFT:
- yylval.code = RSHIFT_EXPR; break;
- case '<':
- yylval.code = LT_EXPR; break;
- case '>':
- yylval.code = GT_EXPR; break;
- }
-
- token_buffer[1] = c1 = getch ();
- token_buffer[2] = 0;
-
- if (c1 == '=')
- {
- switch (c)
- {
- case '<':
- value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
- case '>':
- value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
- case '!':
- value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
- case '=':
- value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
- }
- value = ASSIGN; goto done;
- }
- else if (c == c1)
- switch (c)
- {
- case '+':
- value = PLUSPLUS; goto done;
- case '-':
- value = MINUSMINUS; goto done;
- case '&':
- value = ANDAND; goto done;
- case '|':
- value = OROR; goto done;
- case '<':
- c = LSHIFT;
- goto combine;
- case '>':
- c = RSHIFT;
- goto combine;
- }
- else if ((c == '-') && (c1 == '>'))
- {
- nextchar = getch ();
- if (nextchar == '*')
- {
- nextchar = -1;
- value = POINTSAT_STAR;
- }
- else
- value = POINTSAT;
- goto done;
- }
- else if (c1 == '?' && (c == '<' || c == '>'))
- {
- token_buffer[3] = 0;
-
- c1 = getch ();
- yylval.code = (c == '<' ? MIN_EXPR : MAX_EXPR);
- if (c1 == '=')
- {
- /* <?= or >?= expression. */
- token_buffer[2] = c1;
- value = ASSIGN;
- }
- else
- {
- value = MIN_MAX;
- nextchar = c1;
- }
- if (pedantic)
- pedwarn ("use of `operator %s' is not standard C++",
- token_buffer);
- goto done;
- }
- /* digraphs */
- else if (c == '<' && c1 == '%')
- { value = '{'; goto done; }
- else if (c == '<' && c1 == ':')
- { value = '['; goto done; }
- else if (c == '%' && c1 == '>')
- { value = '}'; goto done; }
- else if (c == '%' && c1 == ':')
- { value = '#'; goto done; }
-
- nextchar = c1;
- token_buffer[1] = 0;
-
- value = c;
- goto done;
- }
-
- case ':':
- c = getch ();
- if (c == ':')
- {
- token_buffer[1] = ':';
- token_buffer[2] = '\0';
- value = SCOPE;
- yylval.itype = 1;
- }
- else if (c == '>')
- {
- value = ']';
- goto done;
- }
- else
- {
- nextchar = c;
- value = ':';
- }
- break;
-
- case 0:
- /* Don't make yyparse think this is eof. */
- value = 1;
- break;
-
- case '(':
- /* try, weakly, to handle casts to pointers to functions. */
- nextchar = skip_white_space (getch ());
- if (nextchar == '*')
- {
- int next_c = skip_white_space (getch ());
- if (next_c == ')')
- {
- nextchar = -1;
- yylval.ttype = build1 (INDIRECT_REF, 0, 0);
- value = PAREN_STAR_PAREN;
- }
- else
- {
- put_back (next_c);
- value = c;
- }
- }
- else if (nextchar == ')')
- {
- nextchar = -1;
- yylval.ttype = NULL_TREE;
- value = LEFT_RIGHT;
- }
- else value = c;
- break;
-
- default:
- value = c;
- }
-
-done:
-/* yylloc.last_line = lineno; */
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
- token_count[value] += 1;
-#endif
-#endif
-
- return value;
-}
-
-int
-is_rid (t)
- tree t;
-{
- return !!is_reserved_word (IDENTIFIER_POINTER (t), IDENTIFIER_LENGTH (t));
-}
-
-#ifdef GATHER_STATISTICS
-/* The original for tree_node_kind is in the toplevel tree.c; changes there
- need to be brought into here, unless this were actually put into a header
- instead. */
-/* Statistics-gathering stuff. */
-typedef enum
-{
- d_kind,
- t_kind,
- b_kind,
- s_kind,
- r_kind,
- e_kind,
- c_kind,
- id_kind,
- op_id_kind,
- perm_list_kind,
- temp_list_kind,
- vec_kind,
- x_kind,
- lang_decl,
- lang_type,
- all_kinds
-} tree_node_kind;
-
-extern int tree_node_counts[];
-extern int tree_node_sizes[];
-#endif
-
-/* Place to save freed lang_decls which were allocated on the
- permanent_obstack. @@ Not currently used. */
-tree free_lang_decl_chain;
-
-tree
-build_lang_decl (code, name, type)
- enum tree_code code;
- tree name;
- tree type;
-{
- register tree t = build_decl (code, name, type);
- struct obstack *obstack = current_obstack;
- register int i = sizeof (struct lang_decl) / sizeof (int);
- register int *pi;
-
- if (! TREE_PERMANENT (t))
- obstack = saveable_obstack;
- else
- /* Could be that saveable is permanent and current is not. */
- obstack = &permanent_obstack;
-
- if (free_lang_decl_chain && obstack == &permanent_obstack)
- {
- pi = (int *)free_lang_decl_chain;
- free_lang_decl_chain = TREE_CHAIN (free_lang_decl_chain);
- }
- else
- pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl));
-
- while (i > 0)
- pi[--i] = 0;
-
- DECL_LANG_SPECIFIC (t) = (struct lang_decl *) pi;
- LANG_DECL_PERMANENT ((struct lang_decl *) pi)
- = obstack == &permanent_obstack;
- my_friendly_assert (LANG_DECL_PERMANENT ((struct lang_decl *) pi)
- == TREE_PERMANENT (t), 234);
- DECL_MAIN_VARIANT (t) = t;
- if (current_lang_name == lang_name_cplusplus)
- DECL_LANGUAGE (t) = lang_cplusplus;
- else if (current_lang_name == lang_name_c)
- DECL_LANGUAGE (t) = lang_c;
- else my_friendly_abort (64);
-
-#if 0 /* not yet, should get fixed properly later */
- if (code == TYPE_DECL)
- {
- tree id;
- id = get_identifier (build_overload_name (type, 1, 1));
- DECL_ASSEMBLER_NAME (t) = id;
- }
-
-#endif
-#ifdef GATHER_STATISTICS
- tree_node_counts[(int)lang_decl] += 1;
- tree_node_sizes[(int)lang_decl] += sizeof (struct lang_decl);
-#endif
-
- return t;
-}
-
-tree
-build_lang_field_decl (code, name, type)
- enum tree_code code;
- tree name;
- tree type;
-{
- extern struct obstack *current_obstack, *saveable_obstack;
- register tree t = build_decl (code, name, type);
- struct obstack *obstack = current_obstack;
- register int i = sizeof (struct lang_decl_flags) / sizeof (int);
- register int *pi;
-#if 0 /* not yet, should get fixed properly later */
-
- if (code == TYPE_DECL)
- {
- tree id;
- id = get_identifier (build_overload_name (type, 1, 1));
- DECL_ASSEMBLER_NAME (t) = id;
- }
-#endif
-
- if (! TREE_PERMANENT (t))
- obstack = saveable_obstack;
- else
- my_friendly_assert (obstack == &permanent_obstack, 235);
-
- pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl_flags));
- while (i > 0)
- pi[--i] = 0;
-
- DECL_LANG_SPECIFIC (t) = (struct lang_decl *) pi;
- return t;
-}
-
-void
-copy_lang_decl (node)
- tree node;
-{
- int size;
- int *pi;
-
- if (! DECL_LANG_SPECIFIC (node))
- return;
-
- if (TREE_CODE (node) == FIELD_DECL)
- size = sizeof (struct lang_decl_flags);
- else
- size = sizeof (struct lang_decl);
- pi = (int *)obstack_alloc (&permanent_obstack, size);
- bcopy ((char *)DECL_LANG_SPECIFIC (node), (char *)pi, size);
- DECL_LANG_SPECIFIC (node) = (struct lang_decl *)pi;
-}
-
-tree
-make_lang_type (code)
- enum tree_code code;
-{
- extern struct obstack *current_obstack, *saveable_obstack;
- register tree t = make_node (code);
- struct obstack *obstack = current_obstack;
- register int i = sizeof (struct lang_type) / sizeof (int);
- register int *pi;
-
- /* Set up some flags that give proper default behavior. */
- IS_AGGR_TYPE (t) = 1;
-
- if (! TREE_PERMANENT (t))
- obstack = saveable_obstack;
- else
- my_friendly_assert (obstack == &permanent_obstack, 236);
-
- pi = (int *) obstack_alloc (obstack, sizeof (struct lang_type));
- while (i > 0)
- pi[--i] = 0;
-
- TYPE_LANG_SPECIFIC (t) = (struct lang_type *) pi;
- CLASSTYPE_AS_LIST (t) = build_tree_list (NULL_TREE, t);
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
- CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
- CLASSTYPE_VBASE_SIZE (t) = integer_zero_node;
- TYPE_BINFO (t) = make_binfo (integer_zero_node, t, NULL_TREE, NULL_TREE,
- NULL_TREE);
- CLASSTYPE_BINFO_AS_LIST (t) = build_tree_list (NULL_TREE, TYPE_BINFO (t));
-
- /* Make sure this is laid out, for ease of use later.
- In the presence of parse errors, the normal was of assuring
- this might not ever get executed, so we lay it out *immediately*. */
- build_pointer_type (t);
-
-#ifdef GATHER_STATISTICS
- tree_node_counts[(int)lang_type] += 1;
- tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
-#endif
-
- return t;
-}
-
-void
-dump_time_statistics ()
-{
- register tree prev = 0, decl, next;
- int this_time = my_get_run_time ();
- TREE_INT_CST_LOW (IDENTIFIER_LOCAL_VALUE (this_filename_time))
- += this_time - body_time;
-
- fprintf (stderr, "\n******\n");
- print_time ("header files (total)", header_time);
- print_time ("main file (total)", this_time - body_time);
- fprintf (stderr, "ratio = %g : 1\n",
- (double)header_time / (double)(this_time - body_time));
- fprintf (stderr, "\n******\n");
-
- for (decl = filename_times; decl; decl = next)
- {
- next = IDENTIFIER_GLOBAL_VALUE (decl);
- IDENTIFIER_GLOBAL_VALUE (decl) = prev;
- prev = decl;
- }
-
- for (decl = prev; decl; decl = IDENTIFIER_GLOBAL_VALUE (decl))
- print_time (IDENTIFIER_POINTER (decl),
- TREE_INT_CST_LOW (IDENTIFIER_LOCAL_VALUE (decl)));
-}
-
-void
-compiler_error (s, v, v2)
- char *s;
- HOST_WIDE_INT v, v2; /* @@also used as pointer */
-{
- char buf[1024];
- sprintf (buf, s, v, v2);
- error_with_file_and_line (input_filename, lineno, "%s (compiler error)", buf);
-}
-
-void
-yyerror (string)
- char *string;
-{
- extern int end_of_file;
- char buf[200];
-
- strcpy (buf, string);
-
- /* We can't print string and character constants well
- because the token_buffer contains the result of processing escapes. */
- if (end_of_file)
- strcat (buf, input_redirected ()
- ? " at end of saved text"
- : " at end of input");
- else if (token_buffer[0] == 0)
- strcat (buf, " at null character");
- else if (token_buffer[0] == '"')
- strcat (buf, " before string constant");
- else if (token_buffer[0] == '\'')
- strcat (buf, " before character constant");
- else if (token_buffer[0] < 040 || (unsigned char) token_buffer[0] >= 0177)
- sprintf (buf + strlen (buf), " before character 0%o",
- (unsigned char) token_buffer[0]);
- else
- strcat (buf, " before `%s'");
-
- error (buf, token_buffer);
-}
-
-static int
-handle_cp_pragma (pname)
- char *pname;
-{
- register int token;
-
- if (! strcmp (pname, "vtable"))
- {
- extern tree pending_vtables;
-
- /* More follows: it must be a string constant (class name). */
- token = real_yylex ();
- if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #pragma vtable");
- return -1;
- }
-
- if (write_virtuals != 2)
- {
- warning ("use `+e2' option to enable #pragma vtable");
- return -1;
- }
- pending_vtables
- = perm_tree_cons (NULL_TREE,
- get_identifier (TREE_STRING_POINTER (yylval.ttype)),
- pending_vtables);
- token = real_yylex ();
- if (token != END_OF_LINE)
- warning ("trailing characters ignored");
- return 1;
- }
- else if (! strcmp (pname, "unit"))
- {
- /* More follows: it must be a string constant (unit name). */
- token = real_yylex ();
- if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid #pragma unit");
- return -1;
- }
- token = real_yylex ();
- if (token != END_OF_LINE)
- warning ("trailing characters ignored");
- return 1;
- }
- else if (! strcmp (pname, "interface"))
- {
- tree fileinfo = IDENTIFIER_CLASS_VALUE (get_time_identifier (input_filename));
- char *main_filename = input_filename;
-
- main_filename = FILE_NAME_NONDIRECTORY (main_filename);
-
- token = real_yylex ();
-
- if (token != END_OF_LINE)
- {
- if (token != STRING
- || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid `#pragma interface'");
- return -1;
- }
- main_filename = TREE_STRING_POINTER (yylval.ttype);
- token = real_yylex ();
- }
-
- if (token != END_OF_LINE)
- warning ("garbage after `#pragma interface' ignored");
-
-#ifndef NO_LINKAGE_HEURISTICS
- write_virtuals = 3;
-
- if (impl_file_chain == 0)
- {
- /* If this is zero at this point, then we are
- auto-implementing. */
- if (main_input_filename == 0)
- main_input_filename = input_filename;
-
-#ifdef AUTO_IMPLEMENT
- filename = FILE_NAME_NONDIRECTORY (main_input_filename);
- fi = get_time_identifier (filename);
- fi = IDENTIFIER_CLASS_VALUE (fi);
- TREE_INT_CST_LOW (fi) = 0;
- TREE_INT_CST_HIGH (fi) = 1;
- /* Get default. */
- impl_file_chain = (struct impl_files *)permalloc (sizeof (struct impl_files));
- impl_file_chain->filename = filename;
- impl_file_chain->next = 0;
-#endif
- }
-
- interface_only = interface_strcmp (main_filename);
- interface_unknown = 0;
- TREE_INT_CST_LOW (fileinfo) = interface_only;
- TREE_INT_CST_HIGH (fileinfo) = interface_unknown;
-#endif /* NO_LINKAGE_HEURISTICS */
-
- return 1;
- }
- else if (! strcmp (pname, "implementation"))
- {
- tree fileinfo = IDENTIFIER_CLASS_VALUE (get_time_identifier (input_filename));
- char *main_filename = main_input_filename ? main_input_filename : input_filename;
-
- main_filename = FILE_NAME_NONDIRECTORY (main_filename);
- token = real_yylex ();
- if (token != END_OF_LINE)
- {
- if (token != STRING
- || TREE_CODE (yylval.ttype) != STRING_CST)
- {
- error ("invalid `#pragma implementation'");
- return -1;
- }
- main_filename = TREE_STRING_POINTER (yylval.ttype);
- token = real_yylex ();
- }
-
- if (token != END_OF_LINE)
- warning ("garbage after `#pragma implementation' ignored");
-
-#ifndef NO_LINKAGE_HEURISTICS
- if (write_virtuals == 3)
- {
- struct impl_files *ifiles = impl_file_chain;
- while (ifiles)
- {
- if (! strcmp (ifiles->filename, main_filename))
- break;
- ifiles = ifiles->next;
- }
- if (ifiles == 0)
- {
- ifiles = (struct impl_files*) permalloc (sizeof (struct impl_files));
- ifiles->filename = main_filename;
- ifiles->next = impl_file_chain;
- impl_file_chain = ifiles;
- }
- }
- else if ((main_input_filename != 0
- && ! strcmp (main_input_filename, input_filename))
- || ! strcmp (input_filename, main_filename))
- {
- write_virtuals = 3;
- if (impl_file_chain == 0)
- {
- impl_file_chain = (struct impl_files*) permalloc (sizeof (struct impl_files));
- impl_file_chain->filename = main_filename;
- impl_file_chain->next = 0;
- }
- }
- else
- error ("`#pragma implementation' can only appear at top-level");
- interface_only = 0;
-#if 1
- /* We make this non-zero so that we infer decl linkage
- in the impl file only for variables first declared
- in the interface file. */
- interface_unknown = 1;
-#else
- /* We make this zero so that templates in the impl
- file will be emitted properly. */
- interface_unknown = 0;
-#endif
- TREE_INT_CST_LOW (fileinfo) = interface_only;
- TREE_INT_CST_HIGH (fileinfo) = interface_unknown;
-#endif /* NO_LINKAGE_HEURISTICS */
-
- return 1;
- }
-
- return 0;
-}
-
-#ifdef HANDLE_SYSV_PRAGMA
-
-/* Handle a #pragma directive. INPUT is the current input stream,
- and C is a character to reread. Processes the entire input line
- and returns a character for the caller to reread: either \n or EOF. */
-
-/* This function has to be in this file, in order to get at
- the token types. */
-
-static int
-handle_sysv_pragma (finput, token)
- FILE *finput;
- register int token;
-{
- for (;;)
- {
- switch (token)
- {
- case IDENTIFIER:
- case TYPENAME:
- case STRING:
- case CONSTANT:
- handle_pragma_token ("ignored", yylval.ttype);
- break;
- case '(':
- handle_pragma_token ("(", NULL_TREE);
- break;
- case ')':
- handle_pragma_token (")", NULL_TREE);
- break;
- case ',':
- handle_pragma_token (",", NULL_TREE);
- break;
- case '=':
- handle_pragma_token ("=", NULL_TREE);
- break;
- case LEFT_RIGHT:
- handle_pragma_token ("(", NULL_TREE);
- handle_pragma_token (")", NULL_TREE);
- break;
- case END_OF_LINE:
- default:
- handle_pragma_token (NULL_PTR, NULL_TREE);
- return 1;
- }
- token = real_yylex ();
- }
-}
-#endif /* HANDLE_SYSV_PRAGMA */
diff --git a/gcc/cp/lex.h b/gcc/cp/lex.h
deleted file mode 100644
index 4a2c7d133d2..00000000000
--- a/gcc/cp/lex.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Define constants and variables for communication with parse.y.
- Copyright (C) 1987, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.com)
- and by Brendan Kehoe (brendan@cygnus.com).
-
-This file is part of GNU CC.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY. No author or distributor
-accepts responsibility to anyone for the consequences of using it
-or for whether it serves any particular purpose or works at all,
-unless he says so in writing. Refer to the GNU CC General Public
-License for full details.
-
-Everyone is granted permission to copy, modify and redistribute
-GNU CC, but only under the conditions described in the
-GNU CC General Public License. A copy of this license is
-supposed to have been given to you along with GNU CC so you
-can know your rights and responsibilities. It should be in a
-file named COPYING. Among other things, the copyright notice
-and this notice must be preserved on all copies. */
-
-
-
-enum rid
-{
- RID_UNUSED,
- RID_INT,
- RID_BOOL,
- RID_CHAR,
- RID_WCHAR,
- RID_FLOAT,
- RID_DOUBLE,
- RID_VOID,
-
- /* C++ extension */
- RID_CLASS,
- RID_RECORD,
- RID_UNION,
- RID_ENUM,
- RID_LONGLONG,
-
- /* This is where grokdeclarator starts its search when setting the specbits.
- The first seven are in the order of most frequently used, as found
- building libg++. */
-
- RID_EXTERN,
- RID_CONST,
- RID_LONG,
- RID_TYPEDEF,
- RID_UNSIGNED,
- RID_SHORT,
- RID_INLINE,
-
- RID_STATIC,
-
- RID_REGISTER,
- RID_VOLATILE,
- RID_FRIEND,
- RID_VIRTUAL,
- RID_EXPLICIT,
- RID_SIGNED,
- RID_AUTO,
- RID_MUTABLE,
-
- /* This is where grokdeclarator ends its search when setting the
- specbits. */
-
- RID_PUBLIC,
- RID_PRIVATE,
- RID_PROTECTED,
- RID_EXCEPTION,
- RID_TEMPLATE,
- RID_SIGNATURE,
- RID_NULL,
- /* Before adding enough to get up to 64, the RIDBIT_* macros
- will have to be changed a little. */
- RID_MAX
-};
-
-#define NORID RID_UNUSED
-
-#define RID_FIRST_MODIFIER RID_EXTERN
-#define RID_LAST_MODIFIER RID_MUTABLE
-
-/* The type that can represent all values of RIDBIT. */
-/* We assume that we can stick in at least 32 bits into this. */
-typedef struct { unsigned long idata[2]; }
- RID_BIT_TYPE;
-
-/* Be careful, all these modify N twice. */
-#define RIDBIT_SETP(N, V) (((unsigned long)1 << (int) ((N)%32)) \
- & (V).idata[(N)/32])
-#define RIDBIT_NOTSETP(NN, VV) (! RIDBIT_SETP (NN, VV))
-#define RIDBIT_SET(N, V) do { \
- (V).idata[(N)/32] \
- |= ((unsigned long)1 << (int) ((N)%32)); \
- } while (0)
-#define RIDBIT_RESET(N, V) do { \
- (V).idata[(N)/32] \
- &= ~((unsigned long)1 << (int) ((N)%32)); \
- } while (0)
-#define RIDBIT_RESET_ALL(V) do { \
- (V).idata[0] = 0; \
- (V).idata[1] = 0; \
- } while (0)
-#define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1])
-
-/* The elements of `ridpointers' are identifier nodes
- for the reserved type names and storage classes.
- It is indexed by a RID_... value. */
-extern tree ridpointers[(int) RID_MAX];
-
-/* the declaration found for the last IDENTIFIER token read in.
- yylex must look this up to detect typedefs, which get token type TYPENAME,
- so it is left around in case the identifier is not a typedef but is
- used in a context which makes it a reference to a variable. */
-extern tree lastiddecl;
-
-extern char *token_buffer; /* Pointer to token buffer. */
-
-/* Back-door communication channel to the lexer. */
-extern int looking_for_typename;
-extern int looking_for_template;
-
-/* Tell the lexer where to look for names. */
-extern tree got_scope;
-extern tree got_object;
-
-/* Pending language change.
- Positive is push count, negative is pop count. */
-extern int pending_lang_change;
-
-extern tree make_pointer_declarator (), make_reference_declarator ();
-extern void reinit_parse_for_function ();
-extern void reinit_parse_for_method ();
-extern int yylex ();
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
deleted file mode 100644
index a9dd9d5de8e..00000000000
--- a/gcc/cp/method.c
+++ /dev/null
@@ -1,2218 +0,0 @@
-/* Handle the hair of processing (but not expanding) inline functions.
- Also manage function and variable name overloading.
- Copyright (C) 1987, 89, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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 PARM_CAN_BE_ARRAY_TYPE
-#define PARM_CAN_BE_ARRAY_TYPE 1
-#endif
-
-/* Handle method declarations. */
-#include <stdio.h>
-#include "config.h"
-#include "tree.h"
-#include "cp-tree.h"
-#include "class.h"
-#include "obstack.h"
-#include <ctype.h>
-#include "rtl.h"
-#include "expr.h"
-#include "output.h"
-#include "hard-reg-set.h"
-#include "flags.h"
-
-/* TREE_LIST of the current inline functions that need to be
- processed. */
-struct pending_inline *pending_inlines;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-/* Obstack where we build text strings for overloading, etc. */
-static struct obstack scratch_obstack;
-static char *scratch_firstobj;
-
-# define OB_INIT() (scratch_firstobj ? (obstack_free (&scratch_obstack, scratch_firstobj), 0) : 0)
-# define OB_PUTC(C) (obstack_1grow (&scratch_obstack, (C)))
-# define OB_PUTC2(C1,C2) \
- (obstack_1grow (&scratch_obstack, (C1)), obstack_1grow (&scratch_obstack, (C2)))
-# define OB_PUTS(S) (obstack_grow (&scratch_obstack, (S), sizeof (S) - 1))
-# define OB_PUTID(ID) \
- (obstack_grow (&scratch_obstack, IDENTIFIER_POINTER (ID), \
- IDENTIFIER_LENGTH (ID)))
-# define OB_PUTCP(S) (obstack_grow (&scratch_obstack, (S), strlen (S)))
-# define OB_FINISH() (obstack_1grow (&scratch_obstack, '\0'))
-# define OB_LAST() (obstack_next_free (&scratch_obstack)[-1])
-
-void
-init_method ()
-{
- gcc_obstack_init (&scratch_obstack);
- scratch_firstobj = (char *)obstack_alloc (&scratch_obstack, 0);
-}
-
-/* This must be large enough to hold any printed integer or floating-point
- value. */
-static char digit_buffer[128];
-
-/* Move inline function definitions out of structure so that they
- can be processed normally. CNAME is the name of the class
- we are working from, METHOD_LIST is the list of method lists
- of the structure. We delete friend methods here, after
- saving away their inline function definitions (if any). */
-
-void
-do_inline_function_hair (type, friend_list)
- tree type, friend_list;
-{
- tree method = TYPE_METHODS (type);
-
- if (method && TREE_CODE (method) == TREE_VEC)
- {
- if (TREE_VEC_ELT (method, 1))
- method = TREE_VEC_ELT (method, 1);
- else if (TREE_VEC_ELT (method, 0))
- method = TREE_VEC_ELT (method, 0);
- else
- method = TREE_VEC_ELT (method, 2);
- }
-
- while (method)
- {
- /* Do inline member functions. */
- struct pending_inline *info = DECL_PENDING_INLINE_INFO (method);
- if (info)
- {
- tree args;
-
- my_friendly_assert (info->fndecl == method, 238);
- args = DECL_ARGUMENTS (method);
- while (args)
- {
- DECL_CONTEXT (args) = method;
- args = TREE_CHAIN (args);
- }
-
- /* Allow this decl to be seen in global scope. Don't do this for
- local class methods, though. */
- if (! current_function_decl)
- IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (method)) = method;
- }
- method = TREE_CHAIN (method);
- }
- while (friend_list)
- {
- tree fndecl = TREE_VALUE (friend_list);
- struct pending_inline *info = DECL_PENDING_INLINE_INFO (fndecl);
- if (info)
- {
- tree args;
-
- my_friendly_assert (info->fndecl == fndecl, 239);
- args = DECL_ARGUMENTS (fndecl);
- while (args)
- {
- DECL_CONTEXT (args) = fndecl;
- args = TREE_CHAIN (args);
- }
-
- /* Allow this decl to be seen in global scope */
- if (! current_function_decl)
- IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (fndecl)) = fndecl;
- }
-
- friend_list = TREE_CHAIN (friend_list);
- }
-}
-
-/* Report an argument type mismatch between the best declared function
- we could find and the current argument list that we have. */
-
-void
-report_type_mismatch (cp, parmtypes, name_kind)
- struct candidate *cp;
- tree parmtypes;
- char *name_kind;
-{
- int i = cp->u.bad_arg;
- tree ttf, tta;
- char *tmp_firstobj;
-
- switch (i)
- {
- case -4:
- my_friendly_assert (TREE_CODE (cp->function) == TEMPLATE_DECL, 240);
- cp_error ("type unification failed for function template `%#D'",
- cp->function);
- return;
-
- case -2:
- cp_error ("too few arguments for %s `%#D'", name_kind, cp->function);
- return;
- case -1:
- cp_error ("too many arguments for %s `%#D'", name_kind, cp->function);
- return;
- case 0:
- if (TREE_CODE (TREE_TYPE (cp->function)) != METHOD_TYPE)
- break;
- case -3:
- /* Happens when the implicit object parameter is rejected. */
- my_friendly_assert (! TYPE_READONLY (TREE_TYPE (TREE_VALUE (parmtypes))),
- 241);
- if (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (TREE_VALUE (parmtypes))))
- && ! TYPE_VOLATILE (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (cp->function))))))
- cp_error ("call to non-volatile %s `%#D' with volatile object",
- name_kind, cp->function);
- else
- cp_error ("call to non-const %s `%#D' with const object",
- name_kind, cp->function);
- return;
- }
-
- ttf = TYPE_ARG_TYPES (TREE_TYPE (cp->function));
- tta = parmtypes;
-
- while (i-- > 0)
- {
- ttf = TREE_CHAIN (ttf);
- tta = TREE_CHAIN (tta);
- }
-
- OB_INIT ();
- OB_PUTS ("bad argument ");
- sprintf (digit_buffer, "%d", cp->u.bad_arg
- - (TREE_CODE (TREE_TYPE (cp->function)) == METHOD_TYPE)
- + 1);
- OB_PUTCP (digit_buffer);
-
- OB_PUTS (" for function `");
- OB_PUTCP (decl_as_string (cp->function, 1));
- OB_PUTS ("' (type was ");
-
- /* Reset `i' so that type printing routines do the right thing. */
- if (tta)
- {
- enum tree_code code = TREE_CODE (TREE_TYPE (TREE_VALUE (tta)));
- if (code == ERROR_MARK)
- OB_PUTS ("(failed type instantiation)");
- else
- {
- i = (code == FUNCTION_TYPE || code == METHOD_TYPE);
- OB_PUTCP (type_as_string (TREE_TYPE (TREE_VALUE (tta)), 1));
- }
- }
- else OB_PUTS ("void");
- OB_PUTC (')');
- OB_FINISH ();
-
- tmp_firstobj = (char *)alloca (obstack_object_size (&scratch_obstack));
- bcopy (obstack_base (&scratch_obstack), tmp_firstobj,
- obstack_object_size (&scratch_obstack));
- error (tmp_firstobj);
-}
-
-/* Here is where overload code starts. */
-
-/* Array of types seen so far in top-level call to `build_overload_name'.
- Allocated and deallocated by caller. */
-static tree *typevec;
-
-/* Number of types interned by `build_overload_name' so far. */
-static int maxtype;
-
-/* Number of occurrences of last type seen. */
-static int nrepeats;
-
-/* Nonzero if we should not try folding parameter types. */
-static int nofold;
-
-#define ALLOCATE_TYPEVEC(PARMTYPES) \
- do { maxtype = 0, nrepeats = 0; \
- typevec = (tree *)alloca (list_length (PARMTYPES) * sizeof (tree)); } while (0)
-
-#define DEALLOCATE_TYPEVEC(PARMTYPES) \
- do { tree t = (PARMTYPES); \
- while (t) { TREE_USED (TREE_VALUE (t)) = 0; t = TREE_CHAIN (t); } \
- } while (0)
-
-/* Code to concatenate an asciified integer to a string. */
-
-static
-#ifdef __GNUC__
-__inline
-#endif
-void
-icat (i)
- HOST_WIDE_INT i;
-{
- unsigned HOST_WIDE_INT ui;
-
- /* Handle this case first, to go really quickly. For many common values,
- the result of ui/10 below is 1. */
- if (i == 1)
- {
- OB_PUTC ('1');
- return;
- }
-
- if (i >= 0)
- ui = i;
- else
- {
- OB_PUTC ('m');
- ui = -i;
- }
-
- if (ui >= 10)
- icat (ui / 10);
-
- OB_PUTC ('0' + (ui % 10));
-}
-
-static void
-dicat (lo, hi)
- HOST_WIDE_INT lo, hi;
-{
- unsigned HOST_WIDE_INT ulo, uhi, qlo, qhi;
-
- if (hi >= 0)
- {
- uhi = hi;
- ulo = lo;
- }
- else
- {
- uhi = (lo == 0 ? -hi : -hi-1);
- ulo = -lo;
- }
- if (uhi == 0
- && ulo < ((unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT - 1)))
- {
- icat (ulo);
- return;
- }
- /* Divide 2^HOST_WIDE_INT*uhi+ulo by 10. */
- qhi = uhi / 10;
- uhi = uhi % 10;
- qlo = uhi * (((unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT - 1)) / 5);
- qlo += ulo / 10;
- ulo = ulo % 10;
- ulo += uhi * (((unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT - 1)) % 5)
- * 2;
- qlo += ulo / 10;
- ulo = ulo % 10;
- /* Quotient is 2^HOST_WIDE_INT*qhi+qlo, remainder is ulo. */
- dicat (qlo, qhi);
- OB_PUTC ('0' + ulo);
-}
-
-static
-#ifdef __GNUC__
-__inline
-#endif
-void
-flush_repeats (type)
- tree type;
-{
- int tindex = 0;
-
- while (typevec[tindex] != type)
- tindex++;
-
- if (nrepeats > 1)
- {
- OB_PUTC ('N');
- icat (nrepeats);
- if (nrepeats > 9)
- OB_PUTC ('_');
- }
- else
- OB_PUTC ('T');
- nrepeats = 0;
- icat (tindex);
- if (tindex > 9)
- OB_PUTC ('_');
-}
-
-static int numeric_output_need_bar;
-static void build_overload_identifier ();
-
-static void
-build_overload_nested_name (decl)
- tree decl;
-{
- if (DECL_CONTEXT (decl))
- {
- tree context = DECL_CONTEXT (decl);
- if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
- context = TYPE_NAME (context);
- build_overload_nested_name (context);
- }
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- tree name = DECL_ASSEMBLER_NAME (decl);
- char *label;
- extern int var_labelno;
-
- ASM_FORMAT_PRIVATE_NAME (label, IDENTIFIER_POINTER (name), var_labelno);
- var_labelno++;
-
- if (numeric_output_need_bar)
- {
- OB_PUTC ('_');
- numeric_output_need_bar = 0;
- }
- icat (strlen (label));
- OB_PUTCP (label);
- }
- else /* TYPE_DECL */
- build_overload_identifier (decl);
-}
-
-/* Encoding for an INTEGER_CST value. */
-
-static void
-build_overload_int (value)
- tree value;
-{
- if (TREE_CODE (value) == TEMPLATE_CONST_PARM)
- {
- OB_PUTC ('Y');
- if (TEMPLATE_CONST_IDX (value) > 9)
- OB_PUTC ('_');
- icat (TEMPLATE_CONST_IDX (value));
- if (TEMPLATE_CONST_IDX (value) > 9)
- OB_PUTC ('_');
- return;
- }
- else if (processing_template_decl
- && TREE_CODE (value) != INTEGER_CST)
- /* We don't ever want this output, but it's inconvenient not to
- be able to build the string. This should cause assembler
- errors we'll notice. */
- {
- static int n;
- sprintf (digit_buffer, " *%d", n++);
- OB_PUTCP (digit_buffer);
- return;
- }
-
- my_friendly_assert (TREE_CODE (value) == INTEGER_CST, 243);
- if (TYPE_PRECISION (TREE_TYPE (value)) == 2 * HOST_BITS_PER_WIDE_INT)
- {
- if (TREE_INT_CST_HIGH (value)
- != (TREE_INT_CST_LOW (value) >> (HOST_BITS_PER_WIDE_INT - 1)))
- {
- /* need to print a DImode value in decimal */
- dicat (TREE_INT_CST_LOW (value), TREE_INT_CST_HIGH (value));
- return;
- }
- /* else fall through to print in smaller mode */
- }
- /* Wordsize or smaller */
- icat (TREE_INT_CST_LOW (value));
-}
-
-static void
-build_overload_value (type, value)
- tree type, value;
-{
- while (TREE_CODE (value) == NON_LVALUE_EXPR
- || TREE_CODE (value) == NOP_EXPR)
- value = TREE_OPERAND (value, 0);
- my_friendly_assert (TREE_CODE (type) == PARM_DECL, 242);
- type = TREE_TYPE (type);
-
- if (numeric_output_need_bar)
- {
- OB_PUTC ('_');
- numeric_output_need_bar = 0;
- }
-
- if (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type)) == OFFSET_TYPE)
- {
- /* Handle a pointer to data member as a template instantiation
- parameter, boy, what fun! */
- type = integer_type_node;
- if (TREE_CODE (value) != INTEGER_CST)
- {
- sorry ("unknown pointer to member constant");
- return;
- }
- }
-
- if (TYPE_PTRMEMFUNC_P (type))
- type = TYPE_PTRMEMFUNC_FN_TYPE (type);
-
- switch (TREE_CODE (type))
- {
- case INTEGER_TYPE:
- case ENUMERAL_TYPE:
- case BOOLEAN_TYPE:
- {
- build_overload_int (value);
- numeric_output_need_bar = 1;
- return;
- }
- case REAL_TYPE:
- {
- REAL_VALUE_TYPE val;
- char *bufp = digit_buffer;
- extern char *index ();
-
- pedwarn ("ANSI C++ forbids floating-point template arguments");
-
- my_friendly_assert (TREE_CODE (value) == REAL_CST, 244);
- val = TREE_REAL_CST (value);
- if (REAL_VALUE_ISNAN (val))
- {
- sprintf (bufp, "NaN");
- }
- else
- {
- if (REAL_VALUE_NEGATIVE (val))
- {
- val = REAL_VALUE_NEGATE (val);
- *bufp++ = 'm';
- }
- if (REAL_VALUE_ISINF (val))
- {
- sprintf (bufp, "Infinity");
- }
- else
- {
- ereal_to_decimal (val, bufp);
- bufp = (char *) index (bufp, 'e');
- if (!bufp)
- strcat (digit_buffer, "e0");
- else
- {
- char *p;
- bufp++;
- if (*bufp == '-')
- {
- *bufp++ = 'm';
- }
- p = bufp;
- if (*p == '+')
- p++;
- while (*p == '0')
- p++;
- if (*p == 0)
- {
- *bufp++ = '0';
- *bufp = 0;
- }
- else if (p != bufp)
- {
- while (*p)
- *bufp++ = *p++;
- *bufp = 0;
- }
- }
-#ifdef NO_DOT_IN_LABEL
- bufp = (char *) index (bufp, '.');
- if (bufp)
- *bufp = '_';
-#endif
- }
- }
- OB_PUTCP (digit_buffer);
- numeric_output_need_bar = 1;
- return;
- }
- case POINTER_TYPE:
- if (TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE
- && TREE_CODE (value) != ADDR_EXPR)
- {
- if (TREE_CODE (value) == CONSTRUCTOR)
- {
- /* This is dangerous code, crack built up pointer to members. */
- tree args = CONSTRUCTOR_ELTS (value);
- tree a1 = TREE_VALUE (args);
- tree a2 = TREE_VALUE (TREE_CHAIN (args));
- tree a3 = CONSTRUCTOR_ELTS (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (args))));
- a3 = TREE_VALUE (a3);
- STRIP_NOPS (a3);
- if (TREE_CODE (a1) == INTEGER_CST
- && TREE_CODE (a2) == INTEGER_CST)
- {
- build_overload_int (a1);
- OB_PUTC ('_');
- build_overload_int (a2);
- OB_PUTC ('_');
- if (TREE_CODE (a3) == ADDR_EXPR)
- {
- a3 = TREE_OPERAND (a3, 0);
- if (TREE_CODE (a3) == FUNCTION_DECL)
- {
- numeric_output_need_bar = 0;
- build_overload_identifier (DECL_ASSEMBLER_NAME (a3));
- return;
- }
- }
- else if (TREE_CODE (a3) == INTEGER_CST)
- {
- OB_PUTC ('i');
- build_overload_int (a3);
- numeric_output_need_bar = 1;
- return;
- }
- }
- }
- sorry ("template instantiation with pointer to method that is too complex");
- return;
- }
- if (TREE_CODE (value) == INTEGER_CST
- || TREE_CODE (value) == TEMPLATE_CONST_PARM)
- {
- build_overload_int (value);
- numeric_output_need_bar = 1;
- return;
- }
- value = TREE_OPERAND (value, 0);
- if (TREE_CODE (value) == VAR_DECL)
- {
- my_friendly_assert (DECL_NAME (value) != 0, 245);
- build_overload_identifier (DECL_ASSEMBLER_NAME (value));
- return;
- }
- else if (TREE_CODE (value) == FUNCTION_DECL)
- {
- my_friendly_assert (DECL_NAME (value) != 0, 246);
- build_overload_identifier (DECL_ASSEMBLER_NAME (value));
- return;
- }
- else
- my_friendly_abort (71);
- break; /* not really needed */
-
- default:
- sorry ("conversion of %s as template parameter",
- tree_code_name [(int) TREE_CODE (type)]);
- my_friendly_abort (72);
- }
-}
-
-static void
-build_overload_identifier (name)
- tree name;
-{
- if (TREE_CODE (name) == TYPE_DECL
- && IS_AGGR_TYPE (TREE_TYPE (name))
- && CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (name))
- && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (TREE_TYPE (name))))
- {
- tree template, parmlist, arglist, tname;
- int i, nparms;
- template = CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (name));
- arglist = TREE_VALUE (template);
- template = TREE_PURPOSE (template);
- tname = DECL_NAME (template);
- parmlist = DECL_ARGUMENTS (template);
- nparms = TREE_VEC_LENGTH (parmlist);
- OB_PUTC ('t');
- icat (IDENTIFIER_LENGTH (tname));
- OB_PUTID (tname);
- icat (nparms);
- for (i = 0; i < nparms; i++)
- {
- tree parm = TREE_VALUE (TREE_VEC_ELT (parmlist, i));
- tree arg = TREE_VEC_ELT (arglist, i);
- if (TREE_CODE (parm) == TYPE_DECL)
- {
- /* This parameter is a type. */
- OB_PUTC ('Z');
- build_overload_name (arg, 0, 0);
- }
- else
- {
- parm = tsubst (parm, &TREE_VEC_ELT (arglist, 0),
- TREE_VEC_LENGTH (arglist), NULL_TREE);
- /* It's a PARM_DECL. */
- build_overload_name (TREE_TYPE (parm), 0, 0);
- build_overload_value (parm, arg);
- }
- }
- }
- else
- {
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
- if (numeric_output_need_bar)
- {
- OB_PUTC ('_');
- numeric_output_need_bar = 0;
- }
- icat (IDENTIFIER_LENGTH (name));
- OB_PUTID (name);
- }
-}
-
-/* Given a list of parameters in PARMTYPES, create an unambiguous
- overload string. Should distinguish any type that C (or C++) can
- distinguish. I.e., pointers to functions are treated correctly.
-
- Caller must deal with whether a final `e' goes on the end or not.
-
- Any default conversions must take place before this function
- is called.
-
- BEGIN and END control initialization and finalization of the
- obstack where we build the string. */
-
-char *
-build_overload_name (parmtypes, begin, end)
- tree parmtypes;
- int begin, end;
-{
- int just_one;
- tree parmtype;
-
- if (begin) OB_INIT ();
- numeric_output_need_bar = 0;
-
- if ((just_one = (TREE_CODE (parmtypes) != TREE_LIST)))
- {
- parmtype = parmtypes;
- goto only_one;
- }
-
- while (parmtypes)
- {
- parmtype = TREE_VALUE (parmtypes);
-
- only_one:
-
- if (! nofold && ! just_one)
- {
- /* Every argument gets counted. */
- typevec[maxtype++] = parmtype;
-
- if (TREE_USED (parmtype) && parmtype == typevec[maxtype-2])
- {
- nrepeats++;
- goto next;
- }
-
- if (nrepeats)
- flush_repeats (typevec[maxtype-2]);
-
- if (TREE_USED (parmtype))
- {
-#if 0
- /* We can turn this on at some point when we want
- improved symbol mangling. */
- nrepeats++;
-#else
- /* This is bug compatible with 2.7.x */
- flush_repeats (parmtype);
-#endif
- goto next;
- }
-
- /* Only cache types which take more than one character. */
- if (parmtype != TYPE_MAIN_VARIANT (parmtype)
- || (TREE_CODE (parmtype) != INTEGER_TYPE
- && TREE_CODE (parmtype) != REAL_TYPE))
- TREE_USED (parmtype) = 1;
- }
-
- if (TYPE_PTRMEMFUNC_P (parmtype))
- parmtype = TYPE_PTRMEMFUNC_FN_TYPE (parmtype);
-
- if (TREE_READONLY (parmtype))
- OB_PUTC ('C');
- if (TREE_CODE (parmtype) == INTEGER_TYPE
- && TYPE_MAIN_VARIANT (parmtype) == unsigned_type (TYPE_MAIN_VARIANT (parmtype)))
- OB_PUTC ('U');
- if (TYPE_VOLATILE (parmtype))
- OB_PUTC ('V');
-
- switch (TREE_CODE (parmtype))
- {
- case OFFSET_TYPE:
- OB_PUTC ('O');
- build_overload_name (TYPE_OFFSET_BASETYPE (parmtype), 0, 0);
- OB_PUTC ('_');
- build_overload_name (TREE_TYPE (parmtype), 0, 0);
- break;
-
- case REFERENCE_TYPE:
- OB_PUTC ('R');
- goto more;
-
- case ARRAY_TYPE:
-#if PARM_CAN_BE_ARRAY_TYPE
- {
- tree length;
-
- OB_PUTC ('A');
- if (TYPE_DOMAIN (parmtype) == NULL_TREE)
- error ("pointer or reference to array of unknown bound in parm type");
- else
- {
- length = array_type_nelts (parmtype);
- if (TREE_CODE (length) == INTEGER_CST)
- icat (TREE_INT_CST_LOW (length) + 1);
- }
- OB_PUTC ('_');
- goto more;
- }
-#else
- OB_PUTC ('P');
- goto more;
-#endif
-
- case POINTER_TYPE:
- OB_PUTC ('P');
- more:
- build_overload_name (TREE_TYPE (parmtype), 0, 0);
- break;
-
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- {
- tree firstarg = TYPE_ARG_TYPES (parmtype);
- /* Otherwise have to implement reentrant typevecs,
- unmark and remark types, etc. */
- int old_nofold = nofold;
- nofold = 1;
-
- if (nrepeats)
- flush_repeats (typevec[maxtype-1]);
-
- /* @@ It may be possible to pass a function type in
- which is not preceded by a 'P'. */
- if (TREE_CODE (parmtype) == FUNCTION_TYPE)
- {
- OB_PUTC ('F');
- if (firstarg == NULL_TREE)
- OB_PUTC ('e');
- else if (firstarg == void_list_node)
- OB_PUTC ('v');
- else
- build_overload_name (firstarg, 0, 0);
- }
- else
- {
- int constp = TYPE_READONLY (TREE_TYPE (TREE_VALUE (firstarg)));
- int volatilep = TYPE_VOLATILE (TREE_TYPE (TREE_VALUE (firstarg)));
- OB_PUTC ('M');
- firstarg = TREE_CHAIN (firstarg);
-
- build_overload_name (TYPE_METHOD_BASETYPE (parmtype), 0, 0);
- if (constp)
- OB_PUTC ('C');
- if (volatilep)
- OB_PUTC ('V');
-
- /* For cfront 2.0 compatibility. */
- OB_PUTC ('F');
-
- if (firstarg == NULL_TREE)
- OB_PUTC ('e');
- else if (firstarg == void_list_node)
- OB_PUTC ('v');
- else
- build_overload_name (firstarg, 0, 0);
- }
-
- /* Separate args from return type. */
- OB_PUTC ('_');
- build_overload_name (TREE_TYPE (parmtype), 0, 0);
- nofold = old_nofold;
- break;
- }
-
- case INTEGER_TYPE:
- parmtype = TYPE_MAIN_VARIANT (parmtype);
- if (parmtype == integer_type_node
- || parmtype == unsigned_type_node)
- OB_PUTC ('i');
- else if (parmtype == long_integer_type_node
- || parmtype == long_unsigned_type_node)
- OB_PUTC ('l');
- else if (parmtype == short_integer_type_node
- || parmtype == short_unsigned_type_node)
- OB_PUTC ('s');
- else if (parmtype == signed_char_type_node)
- {
- OB_PUTC ('S');
- OB_PUTC ('c');
- }
- else if (parmtype == char_type_node
- || parmtype == unsigned_char_type_node)
- OB_PUTC ('c');
- else if (parmtype == wchar_type_node)
- OB_PUTC ('w');
- else if (parmtype == long_long_integer_type_node
- || parmtype == long_long_unsigned_type_node)
- OB_PUTC ('x');
-#if 0
- /* it would seem there is no way to enter these in source code,
- yet. (mrs) */
- else if (parmtype == long_long_long_integer_type_node
- || parmtype == long_long_long_unsigned_type_node)
- OB_PUTC ('q');
-#endif
- else
- my_friendly_abort (73);
- break;
-
- case BOOLEAN_TYPE:
- OB_PUTC ('b');
- break;
-
- case REAL_TYPE:
- parmtype = TYPE_MAIN_VARIANT (parmtype);
- if (parmtype == long_double_type_node)
- OB_PUTC ('r');
- else if (parmtype == double_type_node)
- OB_PUTC ('d');
- else if (parmtype == float_type_node)
- OB_PUTC ('f');
- else my_friendly_abort (74);
- break;
-
- case VOID_TYPE:
- if (! just_one)
- {
-#if 0
- extern tree void_list_node;
-
- /* See if anybody is wasting memory. */
- my_friendly_assert (parmtypes == void_list_node, 247);
-#endif
- /* This is the end of a parameter list. */
- if (end) OB_FINISH ();
- return (char *)obstack_base (&scratch_obstack);
- }
- OB_PUTC ('v');
- break;
-
- case ERROR_MARK: /* not right, but nothing is anyway */
- break;
-
- /* have to do these */
- case UNION_TYPE:
- case RECORD_TYPE:
- if (! just_one)
- /* Make this type signature look incompatible
- with AT&T. */
- OB_PUTC ('G');
- goto common;
- case ENUMERAL_TYPE:
- common:
- {
- tree name = TYPE_NAME (parmtype);
- int i = 1;
-
- if (TREE_CODE (name) == TYPE_DECL)
- {
- tree context = name;
-
- /* If DECL_ASSEMBLER_NAME has been set properly, use it. */
- if (DECL_ASSEMBLER_NAME (context) != DECL_NAME (context))
- {
- OB_PUTID (DECL_ASSEMBLER_NAME (context));
- break;
- }
- while (DECL_CONTEXT (context))
- {
- i += 1;
- context = DECL_CONTEXT (context);
- if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
- context = TYPE_NAME (context);
- }
- name = DECL_NAME (name);
- }
- my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 248);
- if (i > 1)
- {
- OB_PUTC ('Q');
- if (i > 9)
- OB_PUTC ('_');
- icat (i);
- if (i > 9)
- OB_PUTC ('_');
- numeric_output_need_bar = 0;
- build_overload_nested_name (TYPE_NAME (parmtype));
- }
- else
- build_overload_identifier (TYPE_NAME (parmtype));
- break;
- }
-
- case UNKNOWN_TYPE:
- /* This will take some work. */
- OB_PUTC ('?');
- break;
-
- case TEMPLATE_TYPE_PARM:
- OB_PUTC ('X');
- if (TEMPLATE_TYPE_IDX (parmtype) > 9)
- OB_PUTC ('_');
- icat (TEMPLATE_TYPE_IDX (parmtype));
- if (TEMPLATE_TYPE_IDX (parmtype) > 9)
- OB_PUTC ('_');
- break;
-
- case TYPENAME_TYPE:
- /* We don't ever want this output, but it's inconvenient not to
- be able to build the string. This should cause assembler
- errors we'll notice. */
- {
- static int n;
- sprintf (digit_buffer, " *%d", n++);
- OB_PUTCP (digit_buffer);
- }
- break;
-
- default:
- my_friendly_abort (75);
- }
-
- next:
- if (just_one) break;
- parmtypes = TREE_CHAIN (parmtypes);
- }
- if (! just_one)
- {
- if (nrepeats)
- flush_repeats (typevec[maxtype-1]);
-
- /* To get here, parms must end with `...'. */
- OB_PUTC ('e');
- }
-
- if (end) OB_FINISH ();
- return (char *)obstack_base (&scratch_obstack);
-}
-
-tree
-build_static_name (basetype, name)
- tree basetype, name;
-{
- char *basename = build_overload_name (basetype, 1, 1);
- char *buf = (char *) alloca (IDENTIFIER_LENGTH (name)
- + sizeof (STATIC_NAME_FORMAT)
- + strlen (basename));
- sprintf (buf, STATIC_NAME_FORMAT, basename, IDENTIFIER_POINTER (name));
- return get_identifier (buf);
-}
-
-/* Change the name of a function definition so that it may be
- overloaded. NAME is the name of the function to overload,
- PARMS is the parameter list (which determines what name the
- final function obtains).
-
- FOR_METHOD is 1 if this overload is being performed
- for a method, rather than a function type. It is 2 if
- this overload is being performed for a constructor. */
-
-tree
-build_decl_overload (dname, parms, for_method)
- tree dname;
- tree parms;
- int for_method;
-{
- char *name = IDENTIFIER_POINTER (dname);
-
- /* member operators new and delete look like methods at this point. */
- if (! for_method && parms != NULL_TREE && TREE_CODE (parms) == TREE_LIST)
- {
- if (dname == ansi_opname[(int) DELETE_EXPR])
- return get_identifier ("__builtin_delete");
- else if (dname == ansi_opname[(int) VEC_DELETE_EXPR])
- return get_identifier ("__builtin_vec_delete");
- else if (TREE_CHAIN (parms) == void_list_node)
- {
- if (dname == ansi_opname[(int) NEW_EXPR])
- return get_identifier ("__builtin_new");
- else if (dname == ansi_opname[(int) VEC_NEW_EXPR])
- return get_identifier ("__builtin_vec_new");
- }
- }
-
- OB_INIT ();
- if (for_method != 2)
- OB_PUTCP (name);
- /* Otherwise, we can divine that this is a constructor,
- and figure out its name without any extra encoding. */
-
- OB_PUTC2 ('_', '_');
- if (for_method)
- {
-#if 0
- /* We can get away without doing this. */
- OB_PUTC ('M');
-#endif
- {
- tree this_type = TREE_VALUE (parms);
-
- if (TREE_CODE (this_type) == RECORD_TYPE) /* a signature pointer */
- parms = temp_tree_cons (NULL_TREE, SIGNATURE_TYPE (this_type),
- TREE_CHAIN (parms));
- else
- parms = temp_tree_cons (NULL_TREE, TREE_TYPE (this_type),
- TREE_CHAIN (parms));
- }
- }
- else
- OB_PUTC ('F');
-
- if (parms == NULL_TREE)
- OB_PUTC2 ('e', '\0');
- else if (parms == void_list_node)
- OB_PUTC2 ('v', '\0');
- else
- {
- ALLOCATE_TYPEVEC (parms);
- nofold = 0;
- if (for_method)
- {
- build_overload_name (TREE_VALUE (parms), 0, 0);
-
- typevec[maxtype++] = TREE_VALUE (parms);
- TREE_USED (TREE_VALUE (parms)) = 1;
-
- if (TREE_CHAIN (parms))
- build_overload_name (TREE_CHAIN (parms), 0, 1);
- else
- OB_PUTC2 ('e', '\0');
- }
- else
- build_overload_name (parms, 0, 1);
- DEALLOCATE_TYPEVEC (parms);
- }
- {
- tree n = get_identifier (obstack_base (&scratch_obstack));
- if (IDENTIFIER_OPNAME_P (dname))
- IDENTIFIER_OPNAME_P (n) = 1;
- return n;
- }
-}
-
-/* Build an overload name for the type expression TYPE. */
-
-tree
-build_typename_overload (type)
- tree type;
-{
- tree id;
-
- OB_INIT ();
- OB_PUTID (ansi_opname[(int) TYPE_EXPR]);
- nofold = 1;
- build_overload_name (type, 0, 1);
- id = get_identifier (obstack_base (&scratch_obstack));
- IDENTIFIER_OPNAME_P (id) = 1;
-#if 0
- IDENTIFIER_GLOBAL_VALUE (id) = TYPE_MAIN_DECL (type);
-#endif
- TREE_TYPE (id) = type;
- return id;
-}
-
-tree
-build_overload_with_type (name, type)
- tree name, type;
-{
- OB_INIT ();
- OB_PUTID (name);
- nofold = 1;
-
- build_overload_name (type, 0, 1);
- return get_identifier (obstack_base (&scratch_obstack));
-}
-
-tree
-get_id_2 (name, name2)
- char *name;
- tree name2;
-{
- OB_INIT ();
- OB_PUTCP (name);
- OB_PUTID (name2);
- OB_FINISH ();
- return get_identifier (obstack_base (&scratch_obstack));
-}
-
-/* Given a tree_code CODE, and some arguments (at least one),
- attempt to use an overloaded operator on the arguments.
-
- For unary operators, only the first argument need be checked.
- For binary operators, both arguments may need to be checked.
-
- Member functions can convert class references to class pointers,
- for one-level deep indirection. More than that is not supported.
- Operators [](), ()(), and ->() must be member functions.
-
- We call function call building calls with LOOKUP_COMPLAIN if they
- are our only hope. This is true when we see a vanilla operator
- applied to something of aggregate type. If this fails, we are free
- to return `error_mark_node', because we will have reported the
- error.
-
- Operators NEW and DELETE overload in funny ways: operator new takes
- a single `size' parameter, and operator delete takes a pointer to the
- storage being deleted. When overloading these operators, success is
- assumed. If there is a failure, report an error message and return
- `error_mark_node'. */
-
-/* NOSTRICT */
-tree
-build_opfncall (code, flags, xarg1, xarg2, arg3)
- enum tree_code code;
- int flags;
- tree xarg1, xarg2, arg3;
-{
- tree rval = 0;
- tree arg1, arg2;
- tree type1, type2, fnname;
- tree fields1 = 0, parms = 0;
- tree global_fn;
- int try_second;
- int binary_is_unary;
-
- if (flag_ansi_overloading)
- return build_new_op (code, flags, xarg1, xarg2, arg3);
-
- if (xarg1 == error_mark_node)
- return error_mark_node;
-
- if (code == COND_EXPR)
- {
- if (xarg2 == error_mark_node
- || arg3 == error_mark_node)
- return error_mark_node;
- }
- if (code == COMPONENT_REF)
- if (TREE_CODE (TREE_TYPE (xarg1)) == POINTER_TYPE)
- return rval;
-
- /* First, see if we can work with the first argument */
- type1 = TREE_TYPE (xarg1);
-
- /* Some tree codes have length > 1, but we really only want to
- overload them if their first argument has a user defined type. */
- switch (code)
- {
- case PREINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case COMPONENT_REF:
- binary_is_unary = 1;
- try_second = 0;
- break;
-
- /* ARRAY_REFs and CALL_EXPRs must overload successfully.
- If they do not, return error_mark_node instead of NULL_TREE. */
- case ARRAY_REF:
- if (xarg2 == error_mark_node)
- return error_mark_node;
- case CALL_EXPR:
- rval = error_mark_node;
- binary_is_unary = 0;
- try_second = 0;
- break;
-
- case VEC_NEW_EXPR:
- case NEW_EXPR:
- {
- tree args = tree_cons (NULL_TREE, xarg2, arg3);
- fnname = ansi_opname[(int) code];
- if (flags & LOOKUP_GLOBAL)
- return build_overload_call (fnname, args, flags & LOOKUP_COMPLAIN);
-
- rval = build_method_call
- (build_indirect_ref (build1 (NOP_EXPR, xarg1, error_mark_node),
- "new"),
- fnname, args, NULL_TREE, flags);
- if (rval == error_mark_node)
- /* User might declare fancy operator new, but invoke it
- like standard one. */
- return rval;
-
- TREE_TYPE (rval) = xarg1;
- TREE_CALLS_NEW (rval) = 1;
- return rval;
- }
- break;
-
- case VEC_DELETE_EXPR:
- case DELETE_EXPR:
- {
- fnname = ansi_opname[(int) code];
- if (flags & LOOKUP_GLOBAL)
- return build_overload_call (fnname,
- build_tree_list (NULL_TREE, xarg1),
- flags & LOOKUP_COMPLAIN);
- arg1 = TREE_TYPE (xarg1);
-
- /* This handles the case where we're trying to delete
- X (*a)[10];
- a=new X[5][10];
- delete[] a; */
-
- if (TREE_CODE (TREE_TYPE (arg1)) == ARRAY_TYPE)
- {
- /* Strip off the pointer and the array. */
- arg1 = TREE_TYPE (TREE_TYPE (arg1));
-
- while (TREE_CODE (arg1) == ARRAY_TYPE)
- arg1 = (TREE_TYPE (arg1));
-
- arg1 = build_pointer_type (arg1);
- }
-
- rval = build_method_call
- (build_indirect_ref (build1 (NOP_EXPR, arg1,
- error_mark_node),
- NULL_PTR),
- fnname, tree_cons (NULL_TREE, xarg1,
- build_tree_list (NULL_TREE, xarg2)),
- NULL_TREE, flags);
-#if 0
- /* This can happen when operator delete is protected. */
- my_friendly_assert (rval != error_mark_node, 250);
- TREE_TYPE (rval) = void_type_node;
-#endif
- return rval;
- }
- break;
-
- default:
- binary_is_unary = 0;
- try_second = tree_code_length [(int) code] == 2;
- if (try_second && xarg2 == error_mark_node)
- return error_mark_node;
- break;
- }
-
- if (try_second && xarg2 == error_mark_node)
- return error_mark_node;
-
- /* What ever it was, we do not know how to deal with it. */
- if (type1 == NULL_TREE)
- return rval;
-
- if (TREE_CODE (type1) == OFFSET_TYPE)
- type1 = TREE_TYPE (type1);
-
- if (TREE_CODE (type1) == REFERENCE_TYPE)
- {
- arg1 = convert_from_reference (xarg1);
- type1 = TREE_TYPE (arg1);
- }
- else
- {
- arg1 = xarg1;
- }
-
- if (!IS_AGGR_TYPE (type1) || TYPE_PTRMEMFUNC_P (type1))
- {
- /* Try to fail. First, fail if unary */
- if (! try_second)
- return rval;
- /* Second, see if second argument is non-aggregate. */
- type2 = TREE_TYPE (xarg2);
- if (TREE_CODE (type2) == OFFSET_TYPE)
- type2 = TREE_TYPE (type2);
- if (TREE_CODE (type2) == REFERENCE_TYPE)
- {
- arg2 = convert_from_reference (xarg2);
- type2 = TREE_TYPE (arg2);
- }
- else
- {
- arg2 = xarg2;
- }
-
- if (!IS_AGGR_TYPE (type2))
- return rval;
- try_second = 0;
- }
-
- if (try_second)
- {
- /* First arg may succeed; see whether second should. */
- type2 = TREE_TYPE (xarg2);
- if (TREE_CODE (type2) == OFFSET_TYPE)
- type2 = TREE_TYPE (type2);
- if (TREE_CODE (type2) == REFERENCE_TYPE)
- {
- arg2 = convert_from_reference (xarg2);
- type2 = TREE_TYPE (arg2);
- }
- else
- {
- arg2 = xarg2;
- }
-
- if (! IS_AGGR_TYPE (type2))
- try_second = 0;
- }
-
- if (type1 == unknown_type_node
- || (try_second && TREE_TYPE (xarg2) == unknown_type_node))
- {
- /* This will not be implemented in the foreseeable future. */
- return rval;
- }
-
- if (code == MODIFY_EXPR)
- fnname = ansi_assopname[(int) TREE_CODE (arg3)];
- else
- fnname = ansi_opname[(int) code];
-
- global_fn = lookup_name_nonclass (fnname);
-
- /* This is the last point where we will accept failure. This
- may be too eager if we wish an overloaded operator not to match,
- but would rather a normal operator be called on a type-converted
- argument. */
-
- if (IS_AGGR_TYPE (type1))
- {
- fields1 = lookup_fnfields (TYPE_BINFO (type1), fnname, 0);
- /* ARM $13.4.7, prefix/postfix ++/--. */
- if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR)
- {
- xarg2 = integer_zero_node;
- binary_is_unary = 0;
-
- if (fields1)
- {
- tree t, t2;
- int have_postfix = 0;
-
- /* Look for an `operator++ (int)'. If they didn't have
- one, then we fall back to the old way of doing things. */
- for (t = TREE_VALUE (fields1); t ; t = DECL_CHAIN (t))
- {
- t2 = TYPE_ARG_TYPES (TREE_TYPE (t));
- if (TREE_CHAIN (t2) != NULL_TREE
- && TREE_VALUE (TREE_CHAIN (t2)) == integer_type_node)
- {
- have_postfix = 1;
- break;
- }
- }
-
- if (! have_postfix)
- {
- char *op = POSTINCREMENT_EXPR ? "++" : "--";
-
- /* There's probably a LOT of code in the world that
- relies upon this old behavior. */
- pedwarn ("no `operator%s (int)' declared for postfix `%s', using prefix operator instead",
- op, op);
- xarg2 = NULL_TREE;
- binary_is_unary = 1;
- }
- }
- }
- }
-
- if (fields1 == NULL_TREE && global_fn == NULL_TREE)
- return rval;
-
- /* If RVAL winds up being `error_mark_node', we will return
- that... There is no way that normal semantics of these
- operators will succeed. */
-
- /* This argument may be an uncommitted OFFSET_REF. This is
- the case for example when dealing with static class members
- which are referenced from their class name rather than
- from a class instance. */
- if (TREE_CODE (xarg1) == OFFSET_REF
- && TREE_CODE (TREE_OPERAND (xarg1, 1)) == VAR_DECL)
- xarg1 = TREE_OPERAND (xarg1, 1);
- if (try_second && xarg2 && TREE_CODE (xarg2) == OFFSET_REF
- && TREE_CODE (TREE_OPERAND (xarg2, 1)) == VAR_DECL)
- xarg2 = TREE_OPERAND (xarg2, 1);
-
- if (global_fn)
- flags |= LOOKUP_GLOBAL;
-
- if (code == CALL_EXPR)
- {
- /* This can only be a member function. */
- return build_method_call (xarg1, fnname, xarg2,
- NULL_TREE, LOOKUP_NORMAL);
- }
- else if (tree_code_length[(int) code] == 1 || binary_is_unary)
- {
- parms = NULL_TREE;
- rval = build_method_call (xarg1, fnname, NULL_TREE, NULL_TREE, flags);
- }
- else if (code == COND_EXPR)
- {
- parms = tree_cons (NULL_TREE, xarg2, build_tree_list (NULL_TREE, arg3));
- rval = build_method_call (xarg1, fnname, parms, NULL_TREE, flags);
- }
- else if (code == METHOD_CALL_EXPR)
- {
- /* must be a member function. */
- parms = tree_cons (NULL_TREE, xarg2, arg3);
- return build_method_call (xarg1, fnname, parms, NULL_TREE,
- LOOKUP_NORMAL);
- }
- else if (fields1)
- {
- parms = build_tree_list (NULL_TREE, xarg2);
- rval = build_method_call (xarg1, fnname, parms, NULL_TREE, flags);
- }
- else
- {
- parms = tree_cons (NULL_TREE, xarg1,
- build_tree_list (NULL_TREE, xarg2));
- rval = build_overload_call (fnname, parms, flags);
- }
-
- return rval;
-}
-
-/* This function takes an identifier, ID, and attempts to figure out what
- it means. There are a number of possible scenarios, presented in increasing
- order of hair:
-
- 1) not in a class's scope
- 2) in class's scope, member name of the class's method
- 3) in class's scope, but not a member name of the class
- 4) in class's scope, member name of a class's variable
-
- NAME is $1 from the bison rule. It is an IDENTIFIER_NODE.
- VALUE is $$ from the bison rule. It is the value returned by lookup_name ($1)
-
- As a last ditch, try to look up the name as a label and return that
- address.
-
- Values which are declared as being of REFERENCE_TYPE are
- automatically dereferenced here (as a hack to make the
- compiler faster). */
-
-tree
-hack_identifier (value, name)
- tree value, name;
-{
- tree type;
-
- if (value == error_mark_node)
- {
- if (current_class_name)
- {
- tree fields = lookup_fnfields (TYPE_BINFO (current_class_type), name, 1);
- if (fields == error_mark_node)
- return error_mark_node;
- if (fields)
- {
- tree fndecl;
-
- fndecl = TREE_VALUE (fields);
- my_friendly_assert (TREE_CODE (fndecl) == FUNCTION_DECL, 251);
- if (DECL_CHAIN (fndecl) == NULL_TREE)
- {
- warning ("methods cannot be converted to function pointers");
- return fndecl;
- }
- else
- {
- error ("ambiguous request for method pointer `%s'",
- IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- }
- }
- if (flag_labels_ok && IDENTIFIER_LABEL_VALUE (name))
- {
- return IDENTIFIER_LABEL_VALUE (name);
- }
- return error_mark_node;
- }
-
- type = TREE_TYPE (value);
- if (TREE_CODE (value) == FIELD_DECL)
- {
- if (current_class_ptr == NULL_TREE)
- {
- error ("request for member `%s' in static member function",
- IDENTIFIER_POINTER (DECL_NAME (value)));
- return error_mark_node;
- }
- TREE_USED (current_class_ptr) = 1;
-
- /* Mark so that if we are in a constructor, and then find that
- this field was initialized by a base initializer,
- we can emit an error message. */
- TREE_USED (value) = 1;
- value = build_component_ref (current_class_ref, name, NULL_TREE, 1);
- }
- else if (really_overloaded_fn (value))
- {
-#if 0
- tree t = get_first_fn (value);
- for (; t; t = DECL_CHAIN (t))
- {
- if (TREE_CODE (t) == TEMPLATE_DECL)
- continue;
-
- assemble_external (t);
- TREE_USED (t) = 1;
- }
-#endif
- }
- else if (TREE_CODE (value) == TREE_LIST)
- {
- /* Ambiguous reference to base members, possibly other cases?. */
- tree t = value;
- while (t && TREE_CODE (t) == TREE_LIST)
- {
- mark_used (TREE_VALUE (t));
- t = TREE_CHAIN (t);
- }
- }
- else
- mark_used (value);
-
- if (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == PARM_DECL)
- {
- tree context = decl_function_context (value);
- if (context != NULL_TREE && context != current_function_decl
- && ! TREE_STATIC (value))
- {
- cp_error ("use of %s from containing function",
- (TREE_CODE (value) == VAR_DECL
- ? "`auto' variable" : "parameter"));
- cp_error_at (" `%#D' declared here", value);
- value = error_mark_node;
- }
- }
-
- if (TREE_CODE_CLASS (TREE_CODE (value)) == 'd' && DECL_NONLOCAL (value))
- {
- if (DECL_LANG_SPECIFIC (value)
- && DECL_CLASS_CONTEXT (value) != current_class_type)
- {
- tree path, access;
- register tree context
- = (TREE_CODE (value) == FUNCTION_DECL && DECL_VIRTUAL_P (value))
- ? DECL_CLASS_CONTEXT (value)
- : DECL_CONTEXT (value);
-
- get_base_distance (context, current_class_type, 0, &path);
- if (path)
- {
- access = compute_access (path, value);
- if (access != access_public_node)
- {
- if (TREE_CODE (value) == VAR_DECL)
- error ("static member `%s' is %s",
- IDENTIFIER_POINTER (name),
- TREE_PRIVATE (value) ? "private" :
- "from a private base class");
- else
- error ("enum `%s' is from private base class",
- IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
- }
- }
- return value;
- }
- if (TREE_CODE (value) == TREE_LIST && TREE_NONLOCAL_FLAG (value))
- {
- if (type == 0)
- {
- error ("request for member `%s' is ambiguous in multiple inheritance lattice",
- IDENTIFIER_POINTER (name));
- return error_mark_node;
- }
-
- return value;
- }
-
- if (TREE_CODE (type) == REFERENCE_TYPE && ! processing_template_decl)
- value = convert_from_reference (value);
- return value;
-}
-
-
-static char *
-thunk_printable_name (decl)
- tree decl;
-{
- return "<thunk function>";
-}
-
-tree
-make_thunk (function, delta)
- tree function;
- int delta;
-{
- char buffer[250];
- tree thunk_fndecl, thunk_id;
- tree thunk;
- char *func_name;
- static int thunk_number = 0;
- tree func_decl;
- if (TREE_CODE (function) != ADDR_EXPR)
- abort ();
- func_decl = TREE_OPERAND (function, 0);
- if (TREE_CODE (func_decl) != FUNCTION_DECL)
- abort ();
- func_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (func_decl));
- if (delta<=0)
- sprintf (buffer, "__thunk_%d_%s", -delta, func_name);
- else
- sprintf (buffer, "__thunk_n%d_%s", delta, func_name);
- thunk_id = get_identifier (buffer);
- thunk = IDENTIFIER_GLOBAL_VALUE (thunk_id);
- if (thunk && TREE_CODE (thunk) != THUNK_DECL)
- {
- cp_error ("implementation-reserved name `%D' used", thunk_id);
- IDENTIFIER_GLOBAL_VALUE (thunk_id) = thunk = NULL_TREE;
- }
- if (thunk == NULL_TREE)
- {
- thunk = build_decl (FUNCTION_DECL, thunk_id, TREE_TYPE (func_decl));
- DECL_RESULT (thunk)
- = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (TREE_TYPE (vtable_entry_type)));
- TREE_READONLY (thunk) = TYPE_READONLY (TREE_TYPE (vtable_entry_type));
- TREE_THIS_VOLATILE (thunk) = TYPE_VOLATILE (TREE_TYPE (vtable_entry_type));
- make_function_rtl (thunk);
- comdat_linkage (thunk);
- TREE_SET_CODE (thunk, THUNK_DECL);
- DECL_INITIAL (thunk) = function;
- THUNK_DELTA (thunk) = delta;
- DECL_EXTERNAL (thunk) = 1;
- /* So that finish_file can write out any thunks that need to be: */
- pushdecl_top_level (thunk);
- }
- return thunk;
-}
-
-void
-emit_thunk (thunk_fndecl)
- tree thunk_fndecl;
-{
- rtx insns;
- char buffer[250];
- tree argp;
- struct args_size stack_args_size;
- tree function = TREE_OPERAND (DECL_INITIAL (thunk_fndecl), 0);
- int delta = THUNK_DELTA (thunk_fndecl);
- char *fnname = XSTR (XEXP (DECL_RTL (thunk_fndecl), 0), 0);
- int tem;
- int failure = 0;
- int save_ofp;
-
- /* Used to remember which regs we need to emit a USE rtx for. */
- rtx need_use[FIRST_PSEUDO_REGISTER];
- int need_use_count = 0;
-
- /* rtx for the 'this' parameter. */
- rtx this_rtx = 0, this_reg_rtx = 0, fixed_this_rtx;
-
- char *(*save_decl_printable_name) () = decl_printable_name;
- /* Data on reg parms scanned so far. */
- CUMULATIVE_ARGS args_so_far;
-
- if (TREE_ASM_WRITTEN (thunk_fndecl))
- return;
-
- TREE_ASM_WRITTEN (thunk_fndecl) = 1;
-
- TREE_ADDRESSABLE (function) = 1;
- mark_used (function);
-
- decl_printable_name = thunk_printable_name;
- if (current_function_decl)
- abort ();
- current_function_decl = thunk_fndecl;
-
- TREE_SET_CODE (thunk_fndecl, FUNCTION_DECL);
-#ifdef ASM_OUTPUT_MI_THUNK
- temporary_allocation ();
- assemble_start_function (thunk_fndecl, fnname);
- ASM_OUTPUT_MI_THUNK (asm_out_file, thunk_fndecl, delta, function);
- assemble_end_function (thunk_fndecl, fnname);
- permanent_allocation (1);
-#else
- save_ofp = flag_omit_frame_pointer;
- flag_omit_frame_pointer = 1;
- init_function_start (thunk_fndecl, input_filename, lineno);
- pushlevel (0);
- expand_start_bindings (1);
-
- temporary_allocation ();
-
- /* Start updating where the next arg would go. */
- INIT_CUMULATIVE_ARGS (args_so_far, TREE_TYPE (function), NULL_RTX, 0);
- stack_args_size.constant = 0;
- stack_args_size.var = 0;
- /* SETUP for possible structure return address FIXME */
-
- /* Now look through all the parameters, make sure that we
- don't clobber any registers used for parameters.
- Also, pick up an rtx for the first "this" parameter. */
- for (argp = TYPE_ARG_TYPES (TREE_TYPE (function));
- argp != NULL_TREE;
- argp = TREE_CHAIN (argp))
-
- {
- tree passed_type = TREE_VALUE (argp);
- register rtx entry_parm;
- int named = 1; /* FIXME */
- struct args_size stack_offset;
- struct args_size arg_size;
-
- if (passed_type == void_type_node)
- break;
-
- if ((TREE_CODE (TYPE_SIZE (passed_type)) != INTEGER_CST
- && contains_placeholder_p (TYPE_SIZE (passed_type)))
-#ifdef FUNCTION_ARG_PASS_BY_REFERENCE
- || FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far,
- TYPE_MODE (passed_type),
- passed_type, named)
-#endif
- )
- passed_type = build_pointer_type (passed_type);
-
- entry_parm = FUNCTION_ARG (args_so_far,
- TYPE_MODE (passed_type),
- passed_type,
- named);
- if (entry_parm != 0)
- need_use[need_use_count++] = entry_parm;
-
- locate_and_pad_parm (TYPE_MODE (passed_type), passed_type,
-#ifdef STACK_PARMS_IN_REG_PARM_AREA
- 1,
-#else
- entry_parm != 0,
-#endif
- thunk_fndecl,
- &stack_args_size, &stack_offset, &arg_size);
-
-/* REGNO (entry_parm);*/
- if (this_rtx == 0)
- {
- this_reg_rtx = entry_parm;
- if (!entry_parm)
- {
- rtx offset_rtx = ARGS_SIZE_RTX (stack_offset);
-
- rtx internal_arg_pointer, stack_parm;
-
- if ((ARG_POINTER_REGNUM == STACK_POINTER_REGNUM
- || ! (fixed_regs[ARG_POINTER_REGNUM]
- || ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM)))
- internal_arg_pointer = copy_to_reg (virtual_incoming_args_rtx);
- else
- internal_arg_pointer = virtual_incoming_args_rtx;
-
- if (offset_rtx == const0_rtx)
- entry_parm = gen_rtx (MEM, TYPE_MODE (passed_type),
- internal_arg_pointer);
- else
- entry_parm = gen_rtx (MEM, TYPE_MODE (passed_type),
- gen_rtx (PLUS, Pmode,
- internal_arg_pointer,
- offset_rtx));
- }
-
- this_rtx = entry_parm;
- }
-
- FUNCTION_ARG_ADVANCE (args_so_far,
- TYPE_MODE (passed_type),
- passed_type,
- named);
- }
-
- fixed_this_rtx = plus_constant (this_rtx, delta);
- if (this_rtx != fixed_this_rtx)
- emit_move_insn (this_rtx, fixed_this_rtx);
-
- if (this_reg_rtx)
- emit_insn (gen_rtx (USE, VOIDmode, this_reg_rtx));
-
- emit_indirect_jump (XEXP (DECL_RTL (function), 0));
-
- while (need_use_count > 0)
- emit_insn (gen_rtx (USE, VOIDmode, need_use[--need_use_count]));
-
- expand_end_bindings (NULL, 1, 0);
- poplevel (0, 0, 1);
-
- /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
- Note that that may have been done above, in save_for_inline_copying.
- The call to resume_temporary_allocation near the end of this function
- goes back to the usual state of affairs. */
-
- rtl_in_current_obstack ();
-
- insns = get_insns ();
-
- /* Copy any shared structure that should not be shared. */
-
- unshare_all_rtl (insns);
-
- /* Instantiate all virtual registers. */
-
- instantiate_virtual_regs (current_function_decl, get_insns ());
-
- /* We are no longer anticipating cse in this function, at least. */
-
- cse_not_expected = 1;
-
- /* Now we choose between stupid (pcc-like) register allocation
- (if we got the -noreg switch and not -opt)
- and smart register allocation. */
-
- if (optimize > 0) /* Stupid allocation probably won't work */
- obey_regdecls = 0; /* if optimizations being done. */
-
- regclass_init ();
-
- regclass (insns, max_reg_num ());
- if (obey_regdecls)
- {
- stupid_life_analysis (insns, max_reg_num (), NULL);
- failure = reload (insns, 0, NULL);
- }
- else
- {
- /* Do control and data flow analysis,
- and write some of the results to dump file. */
-
- flow_analysis (insns, max_reg_num (), NULL);
- local_alloc ();
- failure = global_alloc (NULL);
- }
-
- reload_completed = 1;
-
-#ifdef LEAF_REGISTERS
- leaf_function = 0;
- if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
- leaf_function = 1;
-#endif
-
- /* If a machine dependent reorganization is needed, call it. */
-#ifdef MACHINE_DEPENDENT_REORG
- MACHINE_DEPENDENT_REORG (insns);
-#endif
-
- /* Now turn the rtl into assembler code. */
-
- assemble_start_function (thunk_fndecl, fnname);
- final (insns, asm_out_file, optimize, 0);
- assemble_end_function (thunk_fndecl, fnname);
-
- reload_completed = 0;
-
- /* Cancel the effect of rtl_in_current_obstack. */
-
- permanent_allocation (1);
- flag_omit_frame_pointer = save_ofp;
-#endif /* ASM_OUTPUT_MI_THUNK */
- TREE_SET_CODE (thunk_fndecl, THUNK_DECL);
-
- decl_printable_name = save_decl_printable_name;
- current_function_decl = 0;
-}
-
-/* Code for synthesizing methods which have default semantics defined. */
-
-/* For the anonymous union in TYPE, return the member that is at least as
- large as the rest of the members, so we can copy it. */
-
-static tree
-largest_union_member (type)
- tree type;
-{
- tree f, type_size = TYPE_SIZE (type);
-
- for (f = TYPE_FIELDS (type); f; f = TREE_CHAIN (f))
- if (simple_cst_equal (DECL_SIZE (f), type_size) == 1)
- return f;
-
- /* We should always find one. */
- my_friendly_abort (323);
- return NULL_TREE;
-}
-
-/* Generate code for default X(X&) constructor. */
-
-static void
-do_build_copy_constructor (fndecl)
- tree fndecl;
-{
- tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl));
- tree t;
-
- clear_last_expr ();
- push_momentary ();
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
- parm = TREE_CHAIN (parm);
- parm = convert_from_reference (parm);
-
- if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
- {
- t = build (INIT_EXPR, void_type_node, current_class_ref, parm);
- TREE_SIDE_EFFECTS (t) = 1;
- cplus_expand_expr_stmt (t);
- }
- else
- {
- tree fields = TYPE_FIELDS (current_class_type);
- int n_bases = CLASSTYPE_N_BASECLASSES (current_class_type);
- tree binfos = TYPE_BINFO_BASETYPES (current_class_type);
- int i;
-
- for (t = CLASSTYPE_VBASECLASSES (current_class_type); t;
- t = TREE_CHAIN (t))
- {
- tree basetype = BINFO_TYPE (t);
- tree p = convert_to_reference
- (build_reference_type (basetype), parm,
- CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE);
- p = convert_from_reference (p);
-
- if (p == error_mark_node)
- cp_error ("in default copy constructor");
- else
- current_base_init_list = tree_cons (basetype,
- p, current_base_init_list);
- }
-
- for (i = 0; i < n_bases; ++i)
- {
- tree p, basetype = TREE_VEC_ELT (binfos, i);
- if (TREE_VIA_VIRTUAL (basetype))
- continue;
-
- basetype = BINFO_TYPE (basetype);
- p = convert_to_reference
- (build_reference_type (basetype), parm,
- CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE);
-
- if (p == error_mark_node)
- cp_error ("in default copy constructor");
- else
- {
- p = convert_from_reference (p);
- current_base_init_list = tree_cons (basetype,
- p, current_base_init_list);
- }
- }
- for (; fields; fields = TREE_CHAIN (fields))
- {
- tree init, t;
- tree field = fields;
-
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
- if (DECL_NAME (field))
- {
- if (VFIELD_NAME_P (DECL_NAME (field)))
- continue;
- if (VBASE_NAME_P (DECL_NAME (field)))
- continue;
-
- /* True for duplicate members. */
- if (IDENTIFIER_CLASS_VALUE (DECL_NAME (field)) != field)
- continue;
- }
- else if ((t = TREE_TYPE (field)) != NULL_TREE
- && TREE_CODE (t) == UNION_TYPE
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))
- && TYPE_FIELDS (t) != NULL_TREE)
- field = largest_union_member (t);
- else
- continue;
-
- init = build (COMPONENT_REF, TREE_TYPE (field), parm, field);
- init = build_tree_list (NULL_TREE, init);
-
- current_member_init_list
- = tree_cons (DECL_NAME (field), init, current_member_init_list);
- }
- current_member_init_list = nreverse (current_member_init_list);
- current_base_init_list = nreverse (current_base_init_list);
- setup_vtbl_ptr ();
- }
-
- pop_momentary ();
-}
-
-static void
-do_build_assign_ref (fndecl)
- tree fndecl;
-{
- tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl));
-
- clear_last_expr ();
- push_momentary ();
-
- parm = convert_from_reference (parm);
-
- if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
- {
- tree t = build (MODIFY_EXPR, void_type_node, current_class_ref, parm);
- TREE_SIDE_EFFECTS (t) = 1;
- cplus_expand_expr_stmt (t);
- }
- else
- {
- tree fields = TYPE_FIELDS (current_class_type);
- int n_bases = CLASSTYPE_N_BASECLASSES (current_class_type);
- tree binfos = TYPE_BINFO_BASETYPES (current_class_type);
- int i;
-
- for (i = 0; i < n_bases; ++i)
- {
- tree basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, i));
- tree p = convert_to_reference
- (build_reference_type (basetype), parm,
- CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE);
- p = convert_from_reference (p);
- p = build_member_call (basetype, ansi_opname [MODIFY_EXPR],
- build_tree_list (NULL_TREE, p));
- expand_expr_stmt (p);
- }
- for (; fields; fields = TREE_CHAIN (fields))
- {
- tree comp, init, t;
- tree field = fields;
-
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- if (TREE_READONLY (field))
- {
- if (DECL_NAME (field))
- cp_error ("non-static const member `%#D', can't use default assignment operator", field);
- else
- cp_error ("non-static const member in type `%T', can't use default assignment operator", current_class_type);
- continue;
- }
- else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
- {
- if (DECL_NAME (field))
- cp_error ("non-static reference member `%#D', can't use default assignment operator", field);
- else
- cp_error ("non-static reference member in type `%T', can't use default assignment operator", current_class_type);
- continue;
- }
-
- if (DECL_NAME (field))
- {
- if (VFIELD_NAME_P (DECL_NAME (field)))
- continue;
- if (VBASE_NAME_P (DECL_NAME (field)))
- continue;
-
- /* True for duplicate members. */
- if (IDENTIFIER_CLASS_VALUE (DECL_NAME (field)) != field)
- continue;
- }
- else if ((t = TREE_TYPE (field)) != NULL_TREE
- && TREE_CODE (t) == UNION_TYPE
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))
- && TYPE_FIELDS (t) != NULL_TREE)
- field = largest_union_member (t);
- else
- continue;
-
- comp = build (COMPONENT_REF, TREE_TYPE (field), current_class_ref, field);
- init = build (COMPONENT_REF, TREE_TYPE (field), parm, field);
-
- expand_expr_stmt (build_modify_expr (comp, NOP_EXPR, init));
- }
- }
- c_expand_return (current_class_ref);
- pop_momentary ();
-}
-
-void
-synthesize_method (fndecl)
- tree fndecl;
-{
- int nested = (current_function_decl != NULL_TREE);
- tree context = hack_decl_function_context (fndecl);
-
- if (! context)
- push_to_top_level ();
- else if (nested)
- push_cp_function_context (context);
-
- interface_unknown = 1;
- start_function (NULL_TREE, fndecl, NULL_TREE, 1);
- store_parm_decls ();
-
- if (DECL_NAME (fndecl) == ansi_opname[MODIFY_EXPR])
- do_build_assign_ref (fndecl);
- else if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl)))
- ;
- else
- {
- tree arg_chain = FUNCTION_ARG_CHAIN (fndecl);
- if (DECL_CONSTRUCTOR_FOR_VBASE_P (fndecl))
- arg_chain = TREE_CHAIN (arg_chain);
- if (arg_chain != void_list_node)
- do_build_copy_constructor (fndecl);
- else if (TYPE_NEEDS_CONSTRUCTING (current_class_type))
- setup_vtbl_ptr ();
- }
-
- finish_function (lineno, 0, nested);
-
- /* Do we really *want* to inline this function? */
- if (DECL_INLINE (fndecl))
- {
- /* Turn off DECL_INLINE for the moment so function_cannot_inline_p
- will check our size. */
- DECL_INLINE (fndecl) = 0;
-
- /* We say !at_eof because at the end of the file some of the rtl
- for fndecl may have been allocated on the temporary obstack.
- (The function_obstack is the temporary one if we're not in a
- function). */
- if ((! at_eof) && function_cannot_inline_p (fndecl) == 0)
- DECL_INLINE (fndecl) = 1;
- }
-
- extract_interface_info ();
- if (! context)
- pop_from_top_level ();
- else if (nested)
- pop_cp_function_context (context);
-}
diff --git a/gcc/cp/mpw-config.in b/gcc/cp/mpw-config.in
deleted file mode 100644
index 88dd85f72e9..00000000000
--- a/gcc/cp/mpw-config.in
+++ /dev/null
@@ -1,11 +0,0 @@
-# Configuration fragment for G++.
-# Most of the real configuration work happens in the main GCC configure.
-
-# We need to join some lines in the Makefile.in before the sed
-# process will work properly. The funky little sed script works by
-# recognizing lines with a trailing '$@ \', adding the next line to
-# its "pattern space", editing out the backslash and line, then
-# putting the result out.
-
-sed -e '/$@ \\/{N;s/$@ \\./$@ /;P;D;}' \Option-d
- "{srcdir}"Makefile.in >"{o}"hacked_Makefile.in
diff --git a/gcc/cp/mpw-make.sed b/gcc/cp/mpw-make.sed
deleted file mode 100644
index 120b5a1fa3a..00000000000
--- a/gcc/cp/mpw-make.sed
+++ /dev/null
@@ -1,112 +0,0 @@
-# Sed commands to finish translating the G++ Unix makefile into MPW syntax.
-
-# Remove control-Ls, they upset MPW make.
-s/ //g
-
-# Remove references to always-empty variables used to mark things.
-/CYGNUS-LOCAL-/s/{CYGNUS-LOCAL-[a-z0-9]*}//g
-
-# Add a bunch of definitions, mostly empty.
-/^# Variables that exist for you to override.$/a\
-\
-xmake_file = \
-tmake_file = \
-build_xm_file = \
-MALLOC = \
-MD_DEPS = \
-REAL_H = \
-HOST_CC_LD = {CC_LD}\
-ALL_CCLDFLAGS = \
-HOST_CCLDFLAGS = \
-CONFIG_H = \
-LIBDEPS = \
-
-# The "target" variable is special to MPW make, avoid it.
-/{target}/s/{target}/{target_canonical}/g
-
-# Suppress the suppression of smart makes.
-/^\.y\.c/d
-
-# Whack out "..." assignments.
-/\.\.\./s/^\([a-z_]*= \.\.\.\)/#\1/
-
-# Previous edits go a little overboard, undo.
-/^objext = /s/"{o}"//
-
-# Always link in low-level MPW functions.
-/^LIBDEPS=/s/$/ ::strerror.c.o ::mpwlib.c.o/
-/{CLIB}/s/{CLIB}/ ::strerror.c.o ::mpwlib.c.o {CLIB}/
-
-# Don't get tricky about finding various .o file, point at dir above.
-/^SUBDIR_OBSTACK/s/`.*`/::obstack.c.o/
-/^SUBDIR_USE_ALLOCA/s/`.*`/::alloca.c.o/
-/^SUBDIR_MALLOC/s/`.*`//
-
-# Point includes at parent directly correctly.
-/^INCLUDES = /s/:\./::/g
-/^INCLUDES = /s/"{srcdir}"\.\./"{topsrcdir}"gcc:/g
-/^INCLUDES = /s,"{srcdir}"/\.\.,"{topsrcdir}"gcc:,g
-/^INCLUDES = /s,"{srcdir}":config,"{topsrcdir}"gcc:config:,g
-
-# Add the special MPW include dirs.
-/^INCLUDES = /s/$/ -i "{topsrcdir}"include:mpw: -i :::extra-include:/
-
-# A nasty hack to reduce confusion.
-/true/s/ ; @true$//
-
-# (should be in common translation?)
-/{CC_LD} /s/$/ {EXTRALIBS}/
-
-# Don't use general compiler flags (which may include definitions
-# and other compiler-only bits) with linking commands.
-/{CC_LD} /s/ALL_CFLAGS/ALL_CCLDFLAGS/
-
-# Whack out build rules that are not useful.
-/^Makefile \\Option-f /,/^$/d
-/^config.status \\Option-f /,/^$/d
-# (Note that MPW make is not case sensitive, and so this name
-# is considered the same as "md_file".)
-/^{MD_FILE} \\Option-f/,/^$/d
-
-# Depending on config.status is not useful for us.
-/config.status/s/ config.status//
-
-# Repeat of stuff from generic edit.
-/{s}/s/"{s}""{s}"/"{s}"/g
-/{s}/s/"{s}""{srcdir}"/"{s}"/g
-/{s}/s/"{srcdir}""{s}"/"{s}"/g
-
-# Fix references to C frontend files in main dir.
-/::c-/s/"{o}"::c-/"{o}":c-/g
-
-# Fix pathnames to generated files in the objdir.
-/parse/s/"{s}"parse\.\([chy]\)/"{o}"parse.\1/g
-/parse/s/^parse\.\([chy]\)/"{o}"parse.\1/
-/y.tab.c/s/"{s}"y\.tab\.c/"{o}"y.tab.c/g
-/y.tab.c/s/^y\.tab\.c/"{o}"y.tab.c/
-/y.tab.h/s/"{s}"y\.tab\.h/"{o}"y.tab.h/g
-/y.tab.h/s/^y\.tab\.h/"{o}"y.tab.h/
-
-# Put in the definition of YYEMPTY directly.
-/grep/s/grep .* >>/Echo '#define YYEMPTY -1' >>/
-
-# If the dates are wrong, then this tries to run gperf, which we don't
-# really want.
-/^"{srcdir}"hash.h/,/hash.h$/d
-
-# Sed the object file list instead of using cat (meow).
-/cat/s/`cat /`sed -e 's,:,::,g' -e 's,{objext},.o,g' /
-
-# Simplify dependencies of generated parser files.
-/^{PARSE_C}/s/^/#/
-/^stamp-parse/s/^stamp-parse/{PARSE_C}/
-
-# Fix the compile line for the generated parser.
-/{CC} -c/,/echo {PARSE_C}/c\
- {CC} @DASH_C_FLAG@ {ALL_CFLAGS} {ALL_CPPFLAGS} {INCLUDES} {BIG_SWITCHFLAG} "{o}"parse.c -o "{o}"parse.c.o\
-
-# Change all Rez commands to use mac-gcc.r.
-/{REZ}/s/"{s}"[-a-zA-Z{}]*\.r/"{topsrcdir}"gcc:mac-gcc.r/
-
-# Remove pathname junk from the container name.
-/{REZ}/s/'"'::cc1plus'"'/'"'cc1plus'"'/
diff --git a/gcc/cp/new.cc b/gcc/cp/new.cc
deleted file mode 100644
index 0db3497f1fa..00000000000
--- a/gcc/cp/new.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-// Implementation file for the -*- C++ -*- dynamic memory management header.
-// Copyright (C) 1996 Free Software Foundation
-
-// 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.
-
-// As a special exception, if you link this library with other files,
-// some of which are compiled with GCC, to produce an executable,
-// this library 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.
-
-#pragma implementation "new"
-#include "new"
-
-const nothrow_t nothrow = { };
diff --git a/gcc/cp/new1.cc b/gcc/cp/new1.cc
deleted file mode 100644
index 0ee111d2939..00000000000
--- a/gcc/cp/new1.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Support routine for the -*- C++ -*- dynamic memory management.
-// Copyright (C) 1997 Free Software Foundation
-
-// 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.
-
-// As a special exception, if you link this library with other files,
-// some of which are compiled with GCC, to produce an executable,
-// this library 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.
-
-#include "new"
-
-extern "C" void *malloc (size_t);
-
-typedef void (*vfp)(void);
-extern vfp __new_handler;
-extern void __default_new_handler (void);
-
-void *operator new (size_t sz, const nothrow_t&) throw()
-{
- void *p;
- vfp handler = __new_handler;
-
- /* malloc (0) is unpredictable; avoid it. */
- if (sz == 0)
- sz = 1;
- p = (void *) malloc (sz);
- while (p == 0)
- {
- if (! handler)
- return 0;
- (*handler) ();
- p = (void *) malloc (sz);
- }
-
- return p;
-}
diff --git a/gcc/cp/new2.cc b/gcc/cp/new2.cc
deleted file mode 100644
index 5aca49d21d1..00000000000
--- a/gcc/cp/new2.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-// Support routine for the -*- C++ -*- dynamic memory management.
-// Copyright (C) 1997 Free Software Foundation
-
-// 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.
-
-// As a special exception, if you link this library with other files,
-// some of which are compiled with GCC, to produce an executable,
-// this library 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.
-
-#include "new"
-
-void *operator new[] (size_t sz, const nothrow_t& nothrow) throw()
-{
- return ::operator new(sz, nothrow);
-}
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
deleted file mode 100644
index 720c041eef4..00000000000
--- a/gcc/cp/parse.y
+++ /dev/null
@@ -1,4154 +0,0 @@
-/* YACC parser for C++ syntax.
- Copyright (C) 1988, 89, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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 grammar is based on the GNU CC grammar. */
-
-/* Note: Bison automatically applies a default action of "$$ = $1" for
- all derivations; this is applied before the explicit action, if one
- is given. Keep this in mind when reading the actions. */
-
-%{
-/* Cause the `yydebug' variable to be defined. */
-#define YYDEBUG 1
-
-#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
-
-#include "tree.h"
-#include "input.h"
-#include "flags.h"
-#include "lex.h"
-#include "cp-tree.h"
-#include "output.h"
-
-/* Since parsers are distinct for each language, put the language string
- definition here. (fnf) */
-char *language_string = "GNU C++";
-
-extern tree void_list_node;
-extern struct obstack permanent_obstack;
-
-#ifndef errno
-extern int errno;
-#endif
-
-extern int end_of_file;
-extern int current_class_depth;
-extern tree last_tree;
-
-/* FSF LOCAL dje prefix attributes */
-extern tree strip_attrs PROTO((tree));
-/* END FSF LOCAL */
-
-void yyerror ();
-
-/* Like YYERROR but do call yyerror. */
-#define YYERROR1 { yyerror ("syntax error"); YYERROR; }
-
-#define OP0(NODE) (TREE_OPERAND (NODE, 0))
-#define OP1(NODE) (TREE_OPERAND (NODE, 1))
-
-/* Contains the statement keyword (if/while/do) to include in an
- error message if the user supplies an empty conditional expression. */
-static char *cond_stmt_keyword;
-
-/* Nonzero if we have an `extern "C"' acting as an extern specifier. */
-int have_extern_spec;
-int used_extern_spec;
-
-void yyhook ();
-
-/* Cons up an empty parameter list. */
-#ifdef __GNUC__
-__inline
-#endif
-static tree
-empty_parms ()
-{
- tree parms;
-
- if (strict_prototype
- || current_class_type != NULL)
- parms = void_list_node;
- else
- parms = NULL_TREE;
- return parms;
-}
-%}
-
-%start program
-
-%union {long itype; tree ttype; char *strtype; enum tree_code code; flagged_type_tree ftype; }
-
-/* All identifiers that are not reserved words
- and are not declared typedefs in the current block */
-%token IDENTIFIER
-
-/* All identifiers that are declared typedefs in the current block.
- In some contexts, they are treated just like IDENTIFIER,
- but they can also serve as typespecs in declarations. */
-%token TYPENAME
-%token SELFNAME
-
-/* Reserved words that specify storage class.
- yylval contains an IDENTIFIER_NODE which indicates which one. */
-%token SCSPEC
-
-/* Reserved words that specify type.
- yylval contains an IDENTIFIER_NODE which indicates which one. */
-%token TYPESPEC
-
-/* Reserved words that qualify type: "const" or "volatile".
- yylval contains an IDENTIFIER_NODE which indicates which one. */
-%token CV_QUALIFIER
-
-/* Character or numeric constants.
- yylval is the node for the constant. */
-%token CONSTANT
-
-/* String constants in raw form.
- yylval is a STRING_CST node. */
-%token STRING
-
-/* "...", used for functions with variable arglists. */
-%token ELLIPSIS
-
-/* the reserved words */
-/* SCO include files test "ASM", so use something else. */
-%token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
-%token BREAK CONTINUE RETURN GOTO ASM_KEYWORD GCC_ASM_KEYWORD TYPEOF ALIGNOF
-%token SIGOF
-%token ATTRIBUTE EXTENSION LABEL
-
-/* the reserved words... C++ extensions */
-%token <ttype> AGGR
-%token <ttype> VISSPEC
-%token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
-%token NAMESPACE TYPENAME_KEYWORD USING
-%token LEFT_RIGHT TEMPLATE
-%token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
-%token <itype> SCOPE
-
-/* Define the operator tokens and their precedences.
- The value is an integer because, if used, it is the tree code
- to use in the expression made from the operator. */
-
-%left EMPTY /* used to resolve s/r with epsilon */
-
-%left error
-
-/* Add precedence rules to solve dangling else s/r conflict */
-%nonassoc IF
-%nonassoc ELSE
-
-%left IDENTIFIER TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
-
-%left '{' ',' ';'
-
-%nonassoc THROW
-%right <code> ':'
-%right <code> ASSIGN '='
-%right <code> '?'
-%left <code> OROR
-%left <code> ANDAND
-%left <code> '|'
-%left <code> '^'
-%left <code> '&'
-%left <code> MIN_MAX
-%left <code> EQCOMPARE
-%left <code> ARITHCOMPARE '<' '>'
-%left <code> LSHIFT RSHIFT
-%left <code> '+' '-'
-%left <code> '*' '/' '%'
-%left <code> POINTSAT_STAR DOT_STAR
-%right <code> UNARY PLUSPLUS MINUSMINUS '~'
-%left HYPERUNARY
-%left <ttype> PAREN_STAR_PAREN LEFT_RIGHT
-%left <code> POINTSAT '.' '(' '['
-
-%right SCOPE /* C++ extension */
-%nonassoc NEW DELETE TRY CATCH
-
-%type <code> unop
-
-%type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
-%type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
-%type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
-%type <ttype> reserved_declspecs boolean.literal
-%type <ttype> reserved_typespecquals
-%type <ttype> declmods
-%type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
-%type <itype> initdecls notype_initdecls initdcl /* C++ modification */
-%type <ttype> init initlist maybeasm maybe_init
-%type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
-%type <ttype> maybe_attribute attributes attribute attribute_list attrib
-%type <ttype> any_word
-
-%type <ttype> compstmt implicitly_scoped_stmt
-
-%type <ttype> declarator notype_declarator after_type_declarator
-%type <ttype> direct_notype_declarator direct_after_type_declarator
-
-%type <ttype> opt.component_decl_list component_decl_list
-%type <ttype> component_decl component_decl_1 components notype_components
-%type <ttype> component_declarator component_declarator0 self_reference
-%type <ttype> notype_component_declarator notype_component_declarator0
-%type <ttype> after_type_component_declarator after_type_component_declarator0
-%type <ttype> enumlist enumerator
-%type <ttype> absdcl cv_qualifiers
-%type <ttype> direct_abstract_declarator conversion_declarator
-%type <ttype> new_declarator direct_new_declarator
-%type <ttype> xexpr parmlist parms bad_parm
-%type <ttype> identifiers_or_typenames
-%type <ttype> fcast_or_absdcl regcast_or_absdcl
-%type <ttype> expr_or_declarator complex_notype_declarator
-%type <ttype> notype_unqualified_id unqualified_id qualified_id
-%type <ttype> overqualified_id notype_qualified_id any_id
-%type <ttype> complex_direct_notype_declarator functional_cast
-%type <ttype> complex_parmlist parms_comma
-
-%type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs
-%type <ftype> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
-%type <ftype> structsp typespecqual_reserved parm named_parm full_parm
-
-/* C++ extensions */
-%token <ttype> TYPENAME_ELLIPSIS PTYPENAME
-%token <ttype> PRE_PARSED_FUNCTION_DECL EXTERN_LANG_STRING ALL
-%token <ttype> PRE_PARSED_CLASS_DECL
-%type <ttype> fn.def1 /* Not really! */ component_constructor_declarator
-%type <ttype> fn.def2 return_id fn.defpen constructor_declarator
-%type <itype> ctor_initializer_opt
-%type <ttype> named_class_head named_class_head_sans_basetype
-%type <ttype> named_complex_class_head_sans_basetype
-%type <ttype> unnamed_class_head
-%type <ttype> class_head base_class_list
-%type <ttype> base_class_access_list
-%type <ttype> base_class maybe_base_class_list base_class.1
-%type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
-%type <ttype> operator_name
-%type <ttype> object aggr
-%type <itype> new delete
-/* %type <ttype> primary_no_id */
-%type <ttype> nonmomentary_expr maybe_parmlist
-%type <itype> initdcl0 notype_initdcl0 member_init_list
-%type <ttype> template_header template_parm_list template_parm
-%type <ttype> template_type_parm
-%type <code> template_close_bracket
-%type <ttype> template_type template_arg_list template_arg
-%type <ttype> condition xcond paren_cond_or_null
-%type <ttype> type_name nested_name_specifier nested_type ptr_to_mem
-%type <ttype> complete_type_name notype_identifier
-%type <ttype> complex_type_name nested_name_specifier_1
-%type <itype> nomods_initdecls nomods_initdcl0
-%type <ttype> new_initializer new_placement
-%type <ttype> using_decl .poplevel
-
-/* in order to recognize aggr tags as defining and thus shadowing. */
-%token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
-%type <ttype> named_class_head_sans_basetype_defn
-%type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
-
-%type <ttype> self_template_type
-
-%token NSNAME
-%type <ttype> NSNAME
-
-/* Used in lex.c for parsing pragmas. */
-%token END_OF_LINE
-
-/* lex.c and pt.c depend on this being the last token. Define
- any new tokens before this one! */
-%token END_OF_SAVED_INPUT
-
-%{
-/* List of types and structure classes of the current declaration. */
-static tree current_declspecs;
-/* List of prefix attributes in effect.
- Prefix attributes are parsed by the reserved_declspecs and declmods
- rules. They create a list that contains *both* declspecs and attrs. */
-/* ??? It is not clear yet that all cases where an attribute can now appear in
- a declspec list have been updated. */
-static tree prefix_attributes;
-
-/* When defining an aggregate, this is the most recent one being defined. */
-static tree current_aggr;
-
-/* Tell yyparse how to print a token's value, if yydebug is set. */
-
-#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
-extern void yyprint ();
-extern tree combine_strings PROTO((tree));
-%}
-
-%%
-program:
- /* empty */
- | extdefs
- {
- /* In case there were missing closebraces,
- get us back to the global binding level. */
- while (! global_bindings_p ())
- poplevel (0, 0, 0);
- finish_file ();
- }
- ;
-
-/* the reason for the strange actions in this rule
- is so that notype_initdecls when reached via datadef
- can find a valid list of type and sc specs in $0. */
-
-extdefs:
- { $<ttype>$ = NULL_TREE; }
- lang_extdef
- { $<ttype>$ = NULL_TREE; }
- | extdefs lang_extdef
- { $<ttype>$ = NULL_TREE; }
- ;
-
-extdefs_opt:
- extdefs
- | /* empty */
- ;
-
-.hush_warning:
- { have_extern_spec = 1;
- used_extern_spec = 0;
- $<ttype>$ = NULL_TREE; }
- ;
-.warning_ok:
- { have_extern_spec = 0; }
- ;
-
-extension:
- EXTENSION
- { $<itype>$ = pedantic;
- pedantic = 0; }
- ;
-
-asm_keyword:
- ASM_KEYWORD
- | GCC_ASM_KEYWORD
- ;
-
-lang_extdef:
- { if (pending_lang_change) do_pending_lang_change(); }
- extdef
- { if (! toplevel_bindings_p () && ! pseudo_global_level_p())
- pop_everything (); }
- ;
-
-extdef:
- fndef
- { if (pending_inlines) do_pending_inlines (); }
- | datadef
- { if (pending_inlines) do_pending_inlines (); }
- | template_def
- { if (pending_inlines) do_pending_inlines (); }
- | asm_keyword '(' string ')' ';'
- { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
- assemble_asm ($3); }
- | extern_lang_string '{' extdefs_opt '}'
- { pop_lang_context (); }
- | extern_lang_string .hush_warning fndef .warning_ok
- { if (pending_inlines) do_pending_inlines ();
- pop_lang_context (); }
- | extern_lang_string .hush_warning datadef .warning_ok
- { if (pending_inlines) do_pending_inlines ();
- pop_lang_context (); }
- | NAMESPACE identifier '{'
- { push_namespace ($2); }
- extdefs_opt '}'
- { pop_namespace (); }
- | NAMESPACE '{'
- { push_namespace (NULL_TREE); }
- extdefs_opt '}'
- { pop_namespace (); }
- | NAMESPACE identifier '=' any_id ';'
- { do_namespace_alias ($2, $4); }
- | using_decl ';'
- { do_toplevel_using_decl ($1); }
- | USING NAMESPACE any_id ';'
- { do_using_directive ($3); }
- | extension extdef
- { pedantic = $<itype>1; }
- ;
-
-using_decl:
- USING qualified_id
- { $$ = $2; }
- | USING global_scope qualified_id
- { $$ = $3; }
- | USING global_scope unqualified_id
- { $$ = $3; }
- ;
-
-any_id:
- unqualified_id
- | qualified_id
- | global_scope qualified_id
- { $$ = $2; }
- | global_scope unqualified_id
- { $$ = $2; }
- ;
-
-extern_lang_string:
- EXTERN_LANG_STRING
- { push_lang_context ($1); }
- | extern_lang_string EXTERN_LANG_STRING
- { if (current_lang_name != $2)
- cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
- pop_lang_context (); push_lang_context ($2); }
- ;
-
-template_header:
- TEMPLATE '<'
- { begin_template_parm_list (); }
- template_parm_list '>'
- { $$ = end_template_parm_list ($4); }
- | TEMPLATE '<' '>'
- { $$ = NULL_TREE; }
- ;
-
-template_parm_list:
- template_parm
- { $$ = process_template_parm (NULL_TREE, $1); }
- | template_parm_list ',' template_parm
- { $$ = process_template_parm ($1, $3); }
- ;
-
-template_type_parm:
- aggr
- {
- $$ = build_tree_list ($1, NULL_TREE);
- ttpa:
- if (TREE_PURPOSE ($$) == signature_type_node)
- sorry ("signature as template type parameter");
- else if (TREE_PURPOSE ($$) != class_type_node)
- {
- pedwarn ("template type parameters must use the keyword `class'");
- TREE_PURPOSE ($$) = class_type_node;
- }
- }
- | aggr identifier
- { $$ = build_tree_list ($1, $2); goto ttpa; }
- | TYPENAME_KEYWORD
- { $$ = build_tree_list (class_type_node, NULL_TREE); }
- | TYPENAME_KEYWORD identifier
- { $$ = build_tree_list (class_type_node, $2); }
- ;
-
-template_parm:
- /* The following rules introduce a new reduce/reduce
- conflict on the ',' and '>' input tokens: they are valid
- prefixes for a `structsp', which means they could match a
- nameless parameter. See 14.6, paragraph 3.
- By putting them before the `parm' rule, we get
- their match before considering them nameless parameter
- declarations. */
- template_type_parm
- { $$ = build_tree_list (NULL_TREE, $1); }
- | template_type_parm '=' type_id
- { $$ = build_tree_list (groktypename ($3.t), $1); }
- | parm
- { $$ = build_tree_list (NULL_TREE, $1.t); }
- | parm '=' expr_no_commas %prec ARITHCOMPARE
- { $$ = build_tree_list ($3, $1.t); }
- ;
-
-template_def:
- template_header
- extdef
- { end_template_decl (); }
- | template_header
- error %prec EMPTY
- { end_template_decl (); }
- ;
-
-datadef:
- nomods_initdecls ';'
- {}
- | declmods notype_initdecls ';'
- {}
- | typed_declspecs initdecls ';'
- {
- note_list_got_semicolon ($1.t);
- }
- | declmods ';'
- { pedwarn ("empty declaration"); }
- | explicit_instantiation ';'
- | typed_declspecs ';'
- {
- tree t, attrs;
- split_specs_attrs ($1.t, &t, &attrs);
- shadow_tag (t);
- note_list_got_semicolon ($1.t);
- }
- | error ';'
- | error '}'
- | ';'
- ;
-
-ctor_initializer_opt:
- nodecls
- { $$ = 0; }
- | base_init
- { $$ = 1; }
- ;
-
-maybe_return_init:
- /* empty */
- | return_init
- | return_init ';'
- ;
-
-eat_saved_input:
- /* empty */
- | END_OF_SAVED_INPUT
- ;
-
-fndef:
- fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
- { finish_function (lineno, (int)$3, 0); }
- | fn.def1 maybe_return_init function_try_block
- { if ($<ttype>$) process_next_inline ($<ttype>$); }
- eat_saved_input
- ;
-
-constructor_declarator:
- nested_name_specifier SELFNAME '('
- {
- $$ = build_parse_node (SCOPE_REF, $1, $2);
- if ($1 != current_class_type)
- {
- push_nested_class ($1, 3);
- TREE_COMPLEXITY ($$) = current_class_depth;
- }
- }
- parmlist ')' cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
- | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
- {
- $$ = build_parse_node (SCOPE_REF, $1, $2);
- if ($1 != current_class_type)
- {
- push_nested_class ($1, 3);
- TREE_COMPLEXITY ($$) = current_class_depth;
- }
- $$ = make_call_declarator ($$, empty_parms (), $4, $5);
- }
- | global_scope nested_name_specifier SELFNAME '('
- {
- $$ = build_parse_node (SCOPE_REF, $2, $3);
- if ($2 != current_class_type)
- {
- push_nested_class ($2, 3);
- TREE_COMPLEXITY ($$) = current_class_depth;
- }
- }
- parmlist ')' cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
- | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
- {
- $$ = build_parse_node (SCOPE_REF, $2, $3);
- if ($2 != current_class_type)
- {
- push_nested_class ($2, 3);
- TREE_COMPLEXITY ($$) = current_class_depth;
- }
- $$ = make_call_declarator ($$, empty_parms (), $5, $6);
- }
- | nested_name_specifier self_template_type '('
- {
- $$ = build_parse_node (SCOPE_REF, $1, $2);
- if ($1 != current_class_type)
- {
- push_nested_class ($1, 3);
- TREE_COMPLEXITY ($$) = current_class_depth;
- }
- }
- parmlist ')' cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
- | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
- {
- $$ = build_parse_node (SCOPE_REF, $1, $2);
- if ($1 != current_class_type)
- {
- push_nested_class ($1, 3);
- TREE_COMPLEXITY ($$) = current_class_depth;
- }
- $$ = make_call_declarator ($$, empty_parms (), $4, $5);
- }
- | global_scope nested_name_specifier self_template_type '('
- {
- $$ = build_parse_node (SCOPE_REF, $2, $3);
- if ($2 != current_class_type)
- {
- push_nested_class ($2, 3);
- TREE_COMPLEXITY ($$) = current_class_depth;
- }
- }
- parmlist ')' cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
- | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
- {
- $$ = build_parse_node (SCOPE_REF, $2, $3);
- if ($2 != current_class_type)
- {
- push_nested_class ($2, 3);
- TREE_COMPLEXITY ($$) = current_class_depth;
- }
- $$ = make_call_declarator ($$, empty_parms (), $5, $6);
- }
- ;
-
-fn.def1:
- typed_declspecs declarator
- { tree specs, attrs;
- split_specs_attrs ($1.t, &specs, &attrs);
- if (! start_function (specs, $2, attrs, 0))
- YYERROR1;
- reinit_parse_for_function ();
- $$ = NULL_TREE; }
- | declmods notype_declarator
- { tree specs, attrs;
- split_specs_attrs ($1, &specs, &attrs);
- if (! start_function (specs, $2, attrs, 0))
- YYERROR1;
- reinit_parse_for_function ();
- $$ = NULL_TREE; }
- | notype_declarator
- { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
- YYERROR1;
- reinit_parse_for_function ();
- $$ = NULL_TREE; }
- | declmods constructor_declarator
- { tree specs, attrs;
- split_specs_attrs ($1, &specs, &attrs);
- if (! start_function (specs, $2, attrs, 0))
- YYERROR1;
- reinit_parse_for_function ();
- $$ = NULL_TREE; }
- | constructor_declarator
- { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
- YYERROR1;
- reinit_parse_for_function ();
- $$ = NULL_TREE; }
- ;
-
-component_constructor_declarator:
- SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($1, $3, $5, $6); }
- | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
- | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($1, $3, $5, $6); }
- | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
- { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
- ;
-
-/* more C++ complexity. See component_decl for a comment on the
- reduce/reduce conflict introduced by these rules. */
-fn.def2:
- declmods component_constructor_declarator
- { tree specs = strip_attrs ($1);
- $$ = start_method (specs, $2);
- rest_of_mdef:
- if (! $$)
- YYERROR1;
- if (yychar == YYEMPTY)
- yychar = YYLEX;
- reinit_parse_for_method (yychar, $$); }
- | component_constructor_declarator
- { $$ = start_method (NULL_TREE, $1); goto rest_of_mdef; }
- | typed_declspecs declarator
- { tree specs = strip_attrs ($1.t);
- $$ = start_method (specs, $2); goto rest_of_mdef; }
- | declmods notype_declarator
- { tree specs = strip_attrs ($1);
- $$ = start_method (specs, $2); goto rest_of_mdef; }
- | notype_declarator
- { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
- | declmods constructor_declarator
- { tree specs = strip_attrs ($1);
- $$ = start_method (specs, $2); goto rest_of_mdef; }
- | constructor_declarator
- { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
- ;
-
-return_id:
- RETURN IDENTIFIER
- {
- if (! current_function_parms_stored)
- store_parm_decls ();
- $$ = $2;
- }
- ;
-
-return_init:
- return_id maybe_init
- { store_return_init ($<ttype>$, $2); }
- | return_id '(' nonnull_exprlist ')'
- { store_return_init ($<ttype>$, $3); }
- | return_id LEFT_RIGHT
- { store_return_init ($<ttype>$, NULL_TREE); }
- ;
-
-base_init:
- ':' .set_base_init member_init_list
- {
- if ($3 == 0)
- error ("no base initializers given following ':'");
- setup_vtbl_ptr ();
- /* Always keep the BLOCK node associated with the outermost
- pair of curley braces of a function. These are needed
- for correct operation of dwarfout.c. */
- keep_next_level ();
- }
- ;
-
-.set_base_init:
- /* empty */
- {
- if (! current_function_parms_stored)
- store_parm_decls ();
-
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- {
- /* Make a contour for the initializer list. */
- pushlevel (0);
- clear_last_expr ();
- expand_start_bindings (0);
- }
- else if (current_class_type == NULL_TREE)
- error ("base initializers not allowed for non-member functions");
- else if (! DECL_CONSTRUCTOR_P (current_function_decl))
- error ("only constructors take base initializers");
- }
- ;
-
-member_init_list:
- /* empty */
- { $$ = 0; }
- | member_init
- { $$ = 1; }
- | member_init_list ',' member_init
- | member_init_list error
- ;
-
-member_init:
- '(' nonnull_exprlist ')'
- {
- if (current_class_name)
- pedwarn ("anachronistic old style base class initializer");
- expand_member_init (current_class_ref, NULL_TREE, $2);
- }
- | LEFT_RIGHT
- {
- if (current_class_name)
- pedwarn ("anachronistic old style base class initializer");
- expand_member_init (current_class_ref, NULL_TREE, void_type_node);
- }
- | notype_identifier '(' nonnull_exprlist ')'
- { expand_member_init (current_class_ref, $1, $3); }
- | notype_identifier LEFT_RIGHT
- { expand_member_init (current_class_ref, $1, void_type_node); }
- | complete_type_name '(' nonnull_exprlist ')'
- { expand_member_init (current_class_ref, $1, $3); }
- | complete_type_name LEFT_RIGHT
- { expand_member_init (current_class_ref, $1, void_type_node); }
- /* GNU extension */
- | notype_qualified_id '(' nonnull_exprlist ')'
- {
- do_member_init (OP0 ($1), OP1 ($1), $3);
- }
- | notype_qualified_id LEFT_RIGHT
- {
- do_member_init (OP0 ($1), OP1 ($1), void_type_node);
- }
- ;
-
-identifier:
- IDENTIFIER
- | TYPENAME
- | SELFNAME
- | PTYPENAME
- | NSNAME
- ;
-
-notype_identifier:
- IDENTIFIER
- | PTYPENAME
- | NSNAME %prec EMPTY
- ;
-
-identifier_defn:
- IDENTIFIER_DEFN
- | TYPENAME_DEFN
- | PTYPENAME_DEFN
- ;
-
-explicit_instantiation:
- TEMPLATE aggr template_type
- { do_type_instantiation ($3, NULL_TREE); }
- | TEMPLATE typed_declspecs declarator
- { tree specs = strip_attrs ($2.t);
- do_function_instantiation (specs, $3, NULL_TREE); }
- | TEMPLATE notype_declarator
- { do_function_instantiation (NULL_TREE, $2, NULL_TREE); }
- | TEMPLATE constructor_declarator
- { do_function_instantiation (NULL_TREE, $2, NULL_TREE); }
- | SCSPEC TEMPLATE aggr template_type
- { do_type_instantiation ($4, $1); }
- | SCSPEC TEMPLATE typed_declspecs declarator
- { tree specs = strip_attrs ($3.t);
- do_function_instantiation (specs, $4, $1); }
- | SCSPEC TEMPLATE notype_declarator
- { do_function_instantiation (NULL_TREE, $3, $1); }
- | SCSPEC TEMPLATE constructor_declarator
- { do_function_instantiation (NULL_TREE, $3, $1); }
- ;
-
-/* The TYPENAME expansions are to deal with use of a template class name as
- a template within the class itself, where the template decl is hidden by
- a type decl. Got all that? */
-
-template_type:
- PTYPENAME '<' template_arg_list template_close_bracket
- {
- $$ = lookup_template_class ($1, $3, NULL_TREE);
- if ($$ != error_mark_node)
- $$ = TYPE_STUB_DECL ($$);
- }
- | PTYPENAME '<' template_close_bracket
- {
- $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
- if ($$ != error_mark_node)
- $$ = TYPE_STUB_DECL ($$);
- }
- | TYPENAME '<' template_arg_list template_close_bracket
- {
- $$ = lookup_template_class ($1, $3, NULL_TREE);
- if ($$ != error_mark_node)
- $$ = TYPE_STUB_DECL ($$);
- }
- | TYPENAME '<' template_close_bracket
- {
- $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
- if ($$ != error_mark_node)
- $$ = TYPE_STUB_DECL ($$);
- }
- | self_template_type
- ;
-
-self_template_type:
- SELFNAME '<' template_arg_list template_close_bracket
- {
- $$ = lookup_template_class ($1, $3, NULL_TREE);
- if ($$ != error_mark_node)
- $$ = TYPE_STUB_DECL ($$);
- }
- | SELFNAME '<' template_close_bracket
- {
- $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
- if ($$ != error_mark_node)
- $$ = TYPE_STUB_DECL ($$);
- }
- ;
-
-template_close_bracket:
- '>'
- | RSHIFT
- {
- /* Handle `Class<Class<Type>>' without space in the `>>' */
- pedwarn ("`>>' should be `> >' in template class name");
- yyungetc ('>', 1);
- }
- ;
-
-template_arg_list:
- template_arg
- { $$ = build_tree_list (NULL_TREE, $$); }
- | template_arg_list ',' template_arg
- { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
- ;
-
-template_arg:
- type_id
- { $$ = groktypename ($1.t); }
- | expr_no_commas %prec ARITHCOMPARE
- ;
-
-unop:
- '-'
- { $$ = NEGATE_EXPR; }
- | '+'
- { $$ = CONVERT_EXPR; }
- | PLUSPLUS
- { $$ = PREINCREMENT_EXPR; }
- | MINUSMINUS
- { $$ = PREDECREMENT_EXPR; }
- | '!'
- { $$ = TRUTH_NOT_EXPR; }
- ;
-
-expr:
- nontrivial_exprlist
- { $$ = build_x_compound_expr ($$); }
- | expr_no_commas
- ;
-
-paren_expr_or_null:
- LEFT_RIGHT
- { error ("ANSI C++ forbids an empty condition for `%s'",
- cond_stmt_keyword);
- $$ = integer_zero_node; }
- | '(' expr ')'
- { $$ = condition_conversion ($2); }
- ;
-
-paren_cond_or_null:
- LEFT_RIGHT
- { error ("ANSI C++ forbids an empty condition for `%s'",
- cond_stmt_keyword);
- $$ = integer_zero_node; }
- | '(' condition ')'
- { $$ = condition_conversion ($2); }
- ;
-
-xcond:
- /* empty */
- { $$ = NULL_TREE; }
- | condition
- { $$ = condition_conversion ($$); }
- | error
- { $$ = NULL_TREE; }
- ;
-
-condition:
- type_specifier_seq declarator maybeasm maybe_attribute '='
- { {
- tree d;
- for (d = getdecls (); d; d = TREE_CHAIN (d))
- if (TREE_CODE (d) == TYPE_DECL) {
- tree s = TREE_TYPE (d);
- if (TREE_CODE (s) == RECORD_TYPE)
- cp_error ("definition of class `%T' in condition", s);
- else if (TREE_CODE (s) == ENUMERAL_TYPE)
- cp_error ("definition of enum `%T' in condition", s);
- }
- }
- current_declspecs = $1.t;
- $<itype>5 = suspend_momentary ();
- $<ttype>$ = start_decl ($<ttype>2, current_declspecs, 1);
- cplus_decl_attributes ($<ttype>$, $4,
- /*prefix_attributes*/ NULL_TREE);
- }
- init
- {
- cp_finish_decl ($<ttype>6, $7, $4, 1, LOOKUP_ONLYCONVERTING);
- resume_momentary ($<itype>5);
- $$ = $<ttype>6;
- if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
- cp_error ("definition of array `%#D' in condition", $$);
- }
- | expr
- ;
-
-compstmtend:
- '}'
- | maybe_label_decls stmts '}'
- | maybe_label_decls stmts error '}'
- | maybe_label_decls error '}'
- ;
-
-already_scoped_stmt:
- '{'
- {
- if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
- COMPOUND_STMT_NO_SCOPE ($<ttype>$) = 1;
- add_tree ($<ttype>$);
- }
- }
- compstmtend
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- finish_stmt ();
- }
- | simple_stmt
- ;
-
-
-nontrivial_exprlist:
- expr_no_commas ',' expr_no_commas
- { $$ = tree_cons (NULL_TREE, $$,
- build_tree_list (NULL_TREE, $3)); }
- | expr_no_commas ',' error
- { $$ = tree_cons (NULL_TREE, $$,
- build_tree_list (NULL_TREE, error_mark_node)); }
- | nontrivial_exprlist ',' expr_no_commas
- { chainon ($$, build_tree_list (NULL_TREE, $3)); }
- | nontrivial_exprlist ',' error
- { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
- ;
-
-nonnull_exprlist:
- expr_no_commas
- { $$ = build_tree_list (NULL_TREE, $$); }
- | nontrivial_exprlist
- ;
-
-unary_expr:
- primary %prec UNARY
- { $$ = $1; }
- /* __extension__ turns off -pedantic for following primary. */
- | extension cast_expr %prec UNARY
- { $$ = $2;
- pedantic = $<itype>1; }
- | '*' cast_expr %prec UNARY
- { $$ = build_x_indirect_ref ($2, "unary *"); }
- | '&' cast_expr %prec UNARY
- { $$ = build_x_unary_op (ADDR_EXPR, $2); }
- | '~' cast_expr
- { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
- | unop cast_expr %prec UNARY
- { $$ = build_x_unary_op ($1, $2);
- if ($1 == NEGATE_EXPR && TREE_CODE ($2) == INTEGER_CST)
- TREE_NEGATED_INT ($$) = 1;
- overflow_warning ($$);
- }
- /* Refer to the address of a label as a pointer. */
- | ANDAND identifier
- { tree label = lookup_label ($2);
- if (label == NULL_TREE)
- $$ = null_pointer_node;
- else
- {
- TREE_USED (label) = 1;
- $$ = build1 (ADDR_EXPR, ptr_type_node, label);
- TREE_CONSTANT ($$) = 1;
- }
- }
- | SIZEOF unary_expr %prec UNARY
- { $$ = expr_sizeof ($2); }
- | SIZEOF '(' type_id ')' %prec HYPERUNARY
- { $$ = c_sizeof (groktypename ($3.t)); }
- | ALIGNOF unary_expr %prec UNARY
- { $$ = grok_alignof ($2); }
- | ALIGNOF '(' type_id ')' %prec HYPERUNARY
- { $$ = c_alignof (groktypename ($3.t));
- check_for_new_type ("alignof", $3); }
-
- /* The %prec EMPTY's here are required by the = init initializer
- syntax extension; see below. */
- | new new_type_id %prec EMPTY
- { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
- check_for_new_type ("new", $2); }
- | new new_type_id new_initializer
- { $$ = build_new (NULL_TREE, $2.t, $3, $1);
- check_for_new_type ("new", $2); }
- | new new_placement new_type_id %prec EMPTY
- { $$ = build_new ($2, $3.t, NULL_TREE, $1);
- check_for_new_type ("new", $3); }
- | new new_placement new_type_id new_initializer
- { $$ = build_new ($2, $3.t, $4, $1);
- check_for_new_type ("new", $3); }
- | new '(' type_id ')' %prec EMPTY
- { $$ = build_new (NULL_TREE, groktypename($3.t),
- NULL_TREE, $1);
- check_for_new_type ("new", $3); }
- | new '(' type_id ')' new_initializer
- { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
- check_for_new_type ("new", $3); }
- | new new_placement '(' type_id ')' %prec EMPTY
- { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
- check_for_new_type ("new", $4); }
- | new new_placement '(' type_id ')' new_initializer
- { $$ = build_new ($2, groktypename($4.t), $6, $1);
- check_for_new_type ("new", $4); }
-
- | delete cast_expr %prec UNARY
- { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
- | delete '[' ']' cast_expr %prec UNARY
- { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
- if (yychar == YYEMPTY)
- yychar = YYLEX; }
- | delete '[' expr ']' cast_expr %prec UNARY
- { $$ = delete_sanity ($5, $3, 2, $1);
- if (yychar == YYEMPTY)
- yychar = YYLEX; }
- ;
-
-new_placement:
- '(' nonnull_exprlist ')'
- { $$ = $2; }
- | '{' nonnull_exprlist '}'
- {
- $$ = $2;
- pedwarn ("old style placement syntax, use () instead");
- }
- ;
-
-new_initializer:
- '(' nonnull_exprlist ')'
- { $$ = $2; }
- | LEFT_RIGHT
- { $$ = NULL_TREE; }
- | '(' typespec ')'
- {
- cp_error ("`%T' is not a valid expression", $2.t);
- $$ = error_mark_node;
- }
- /* GNU extension so people can use initializer lists. Note that
- this alters the meaning of `new int = 1', which was previously
- syntactically valid but semantically invalid. */
- | '=' init
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids initialization of new expression with `='");
- $$ = $2;
- }
- ;
-
-/* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
-regcast_or_absdcl:
- '(' type_id ')' %prec EMPTY
- { $2.t = tree_cons (NULL_TREE, $2.t, void_list_node);
- TREE_PARMLIST ($2.t) = 1;
- $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
- check_for_new_type ("cast", $2); }
- | regcast_or_absdcl '(' type_id ')' %prec EMPTY
- { $3.t = tree_cons (NULL_TREE, $3.t, void_list_node);
- TREE_PARMLIST ($3.t) = 1;
- $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
- check_for_new_type ("cast", $3); }
- ;
-
-cast_expr:
- unary_expr
- | regcast_or_absdcl unary_expr %prec UNARY
- { $$ = reparse_absdcl_as_casts ($$, $2); }
- | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
- {
- tree init = build_nt (CONSTRUCTOR, NULL_TREE,
- nreverse ($3));
- if (pedantic)
- pedwarn ("ANSI C++ forbids constructor-expressions");
- /* Indicate that this was a GNU C constructor expression. */
- TREE_HAS_CONSTRUCTOR (init) = 1;
-
- $$ = reparse_absdcl_as_casts ($$, init);
- }
- ;
-
-expr_no_commas:
- cast_expr
- /* Handle general members. */
- | expr_no_commas POINTSAT_STAR expr_no_commas
- { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
- | expr_no_commas DOT_STAR expr_no_commas
- { $$ = build_m_component_ref ($$, $3); }
- | expr_no_commas '+' expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas '-' expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas '*' expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas '/' expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas '%' expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas LSHIFT expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas RSHIFT expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas ARITHCOMPARE expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas '<' expr_no_commas
- { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
- | expr_no_commas '>' expr_no_commas
- { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
- | expr_no_commas EQCOMPARE expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas MIN_MAX expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas '&' expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas '|' expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas '^' expr_no_commas
- { $$ = build_x_binary_op ($2, $$, $3); }
- | expr_no_commas ANDAND expr_no_commas
- { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
- | expr_no_commas OROR expr_no_commas
- { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
- | expr_no_commas '?' xexpr ':' expr_no_commas
- { $$ = build_x_conditional_expr ($$, $3, $5); }
- | expr_no_commas '=' expr_no_commas
- { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
- if ($$ != error_mark_node)
- C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
- | expr_no_commas ASSIGN expr_no_commas
- { $$ = build_x_modify_expr ($$, $2, $3); }
- | THROW
- { $$ = build_throw (NULL_TREE); }
- | THROW expr_no_commas
- { $$ = build_throw ($2); }
-/* These extensions are not defined. The second arg to build_m_component_ref
- is old, build_m_component_ref now does an implicit
- build_indirect_ref (x, NULL_PTR) on the second argument.
- | object '&' expr_no_commas %prec UNARY
- { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
- | object unop expr_no_commas %prec UNARY
- { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
- | object '(' type_id ')' expr_no_commas %prec UNARY
- { tree type = groktypename ($3.t);
- $$ = build_m_component_ref ($$, build_c_cast (type, $5)); }
- | object primary_no_id %prec UNARY
- { $$ = build_m_component_ref ($$, $2); }
-*/
- ;
-
-notype_unqualified_id:
- '~' see_typename identifier
- { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
- | operator_name
- | IDENTIFIER
- | PTYPENAME
- | NSNAME %prec EMPTY
- ;
-
-unqualified_id:
- notype_unqualified_id
- | TYPENAME
- | SELFNAME
- ;
-
-expr_or_declarator:
- notype_unqualified_id
- | '*' expr_or_declarator %prec UNARY
- { $$ = build_parse_node (INDIRECT_REF, $2); }
- | '&' expr_or_declarator %prec UNARY
- { $$ = build_parse_node (ADDR_EXPR, $2); }
- | '(' expr_or_declarator ')'
- { $$ = $2; }
- ;
-
-direct_notype_declarator:
- complex_direct_notype_declarator
- | notype_unqualified_id
- | '(' expr_or_declarator ')'
- { $$ = finish_decl_parsing ($2); }
- ;
-
-primary:
- notype_unqualified_id
- {
- if (TREE_CODE ($$) == BIT_NOT_EXPR)
- $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0));
- else
- $$ = do_identifier ($$, 1);
- }
- | CONSTANT
- | boolean.literal
- | string
- {
- if (processing_template_decl)
- push_obstacks (&permanent_obstack, &permanent_obstack);
- $$ = combine_strings ($$);
- if (processing_template_decl)
- pop_obstacks ();
- }
- | '(' expr ')'
- { char class;
- $$ = $2;
- class = TREE_CODE_CLASS (TREE_CODE ($$));
- if (class == 'e' || class == '1'
- || class == '2' || class == '<')
- /* This inhibits warnings in truthvalue_conversion. */
- C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
- | '(' expr_or_declarator ')'
- { char class;
- $$ = reparse_decl_as_expr (NULL_TREE, $2);
- class = TREE_CODE_CLASS (TREE_CODE ($$));
- if (class == 'e' || class == '1'
- || class == '2' || class == '<')
- /* This inhibits warnings in truthvalue_conversion. */
- C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
- | '(' error ')'
- { $$ = error_mark_node; }
- | '('
- { if (current_function_decl == 0)
- {
- error ("braced-group within expression allowed only inside a function");
- YYERROR;
- }
- keep_next_level ();
- $<ttype>$ = expand_start_stmt_expr (); }
- compstmt ')'
- { tree rtl_exp;
- if (pedantic)
- pedwarn ("ANSI C++ forbids braced-groups within expressions");
- rtl_exp = expand_end_stmt_expr ($<ttype>2);
- /* The statements have side effects, so the group does. */
- TREE_SIDE_EFFECTS (rtl_exp) = 1;
-
- if (TREE_CODE ($3) == BLOCK)
- {
- /* Make a BIND_EXPR for the BLOCK already made. */
- $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
- NULL_TREE, rtl_exp, $3);
- /* Remove the block from the tree at this point.
- It gets put back at the proper place
- when the BIND_EXPR is expanded. */
- delete_block ($3);
- }
- else
- $$ = $3;
- }
- | primary '(' nonnull_exprlist ')'
- {
- $$ = build_x_function_call ($1, $3, current_class_ref);
- if (TREE_CODE ($$) == CALL_EXPR
- && TREE_TYPE ($$) != void_type_node)
- $$ = require_complete_type ($$);
- }
- | primary LEFT_RIGHT
- {
- $$ = build_x_function_call ($$, NULL_TREE, current_class_ref);
- if (TREE_CODE ($$) == CALL_EXPR
- && TREE_TYPE ($$) != void_type_node)
- $$ = require_complete_type ($$);
- }
- | primary '[' expr ']'
- { $$ = grok_array_decl ($$, $3); }
- | primary PLUSPLUS
- { /* If we get an OFFSET_REF, turn it into what it really
- means (e.g., a COMPONENT_REF). This way if we've got,
- say, a reference to a static member that's being operated
- on, we don't end up trying to find a member operator for
- the class it's in. */
- if (TREE_CODE ($$) == OFFSET_REF)
- $$ = resolve_offset_ref ($$);
- $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
- | primary MINUSMINUS
- { if (TREE_CODE ($$) == OFFSET_REF)
- $$ = resolve_offset_ref ($$);
- $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
- /* C++ extensions */
- | THIS
- { if (current_class_ptr)
- {
-#ifdef WARNING_ABOUT_CCD
- TREE_USED (current_class_ptr) = 1;
-#endif
- $$ = current_class_ptr;
- }
- else if (current_function_decl
- && DECL_STATIC_FUNCTION_P (current_function_decl))
- {
- error ("`this' is unavailable for static member functions");
- $$ = error_mark_node;
- }
- else
- {
- if (current_function_decl)
- error ("invalid use of `this' in non-member function");
- else
- error ("invalid use of `this' at top level");
- $$ = error_mark_node;
- }
- }
- | CV_QUALIFIER '(' nonnull_exprlist ')'
- {
- tree type;
- tree id = $$;
-
- /* This is a C cast in C++'s `functional' notation. */
- if ($3 == error_mark_node)
- {
- $$ = error_mark_node;
- break;
- }
-#if 0
- if ($3 == NULL_TREE)
- {
- error ("cannot cast null list to type `%s'",
- IDENTIFIER_POINTER (TYPE_NAME (id)));
- $$ = error_mark_node;
- break;
- }
-#endif
-#if 0
- /* type is not set! (mrs) */
- if (type == error_mark_node)
- $$ = error_mark_node;
- else
-#endif
- {
- if (id == ridpointers[(int) RID_CONST])
- type = build_type_variant (integer_type_node, 1, 0);
- else if (id == ridpointers[(int) RID_VOLATILE])
- type = build_type_variant (integer_type_node, 0, 1);
-#if 0
- /* should not be able to get here (mrs) */
- else if (id == ridpointers[(int) RID_FRIEND])
- {
- error ("cannot cast expression to `friend' type");
- $$ = error_mark_node;
- break;
- }
-#endif
- else my_friendly_abort (79);
- $$ = build_c_cast (type, build_compound_expr ($3));
- }
- }
- | functional_cast
- | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
- { tree type = groktypename ($3.t);
- check_for_new_type ("dynamic_cast", $3);
- $$ = build_dynamic_cast (type, $6); }
- | STATIC_CAST '<' type_id '>' '(' expr ')'
- { tree type = groktypename ($3.t);
- check_for_new_type ("static_cast", $3);
- $$ = build_static_cast (type, $6); }
- | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
- { tree type = groktypename ($3.t);
- check_for_new_type ("reinterpret_cast", $3);
- $$ = build_reinterpret_cast (type, $6); }
- | CONST_CAST '<' type_id '>' '(' expr ')'
- { tree type = groktypename ($3.t);
- check_for_new_type ("const_cast", $3);
- $$ = build_const_cast (type, $6); }
- | TYPEID '(' expr ')'
- { $$ = build_x_typeid ($3); }
- | TYPEID '(' type_id ')'
- { tree type = groktypename ($3.t);
- check_for_new_type ("typeid", $3);
- $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
- | global_scope IDENTIFIER
- { $$ = do_scoped_id ($2, 1); }
- | global_scope operator_name
- {
- got_scope = NULL_TREE;
- if (TREE_CODE ($2) == IDENTIFIER_NODE)
- $$ = do_scoped_id ($2, 1);
- else
- $$ = $2;
- }
- | overqualified_id %prec HYPERUNARY
- { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
- | overqualified_id '(' nonnull_exprlist ')'
- { if (processing_template_decl)
- $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1), $3, NULL_TREE);
- else
- $$ = build_member_call (OP0 ($$), OP1 ($$), $3); }
- | overqualified_id LEFT_RIGHT
- { if (processing_template_decl)
- $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1),
- NULL_TREE, NULL_TREE);
- else
- $$ = build_member_call (OP0 ($$), OP1 ($$), NULL_TREE); }
- | object unqualified_id %prec UNARY
- { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
- | object overqualified_id %prec UNARY
- { if (processing_template_decl)
- $$ = build_min_nt (COMPONENT_REF, $1, copy_to_permanent ($2));
- else
- $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
- | object unqualified_id '(' nonnull_exprlist ')'
- {
-#if 0
- /* This is a future direction of this code, but because
- build_x_function_call cannot always undo what is done
- in build_component_ref entirely yet, we cannot do this. */
- $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), $4, current_class_ref);
- if (TREE_CODE ($$) == CALL_EXPR
- && TREE_TYPE ($$) != void_type_node)
- $$ = require_complete_type ($$);
-#else
- $$ = build_method_call ($$, $2, $4, NULL_TREE,
- LOOKUP_NORMAL);
-#endif
- }
- | object unqualified_id LEFT_RIGHT
- {
-#if 0
- /* This is a future direction of this code, but because
- build_x_function_call cannot always undo what is done
- in build_component_ref entirely yet, we cannot do this. */
- $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), NULL_TREE, current_class_ref);
- if (TREE_CODE ($$) == CALL_EXPR
- && TREE_TYPE ($$) != void_type_node)
- $$ = require_complete_type ($$);
-#else
- $$ = build_method_call ($$, $2, NULL_TREE, NULL_TREE,
- LOOKUP_NORMAL);
-#endif
- }
- | object overqualified_id '(' nonnull_exprlist ')'
- {
- if (IS_SIGNATURE (OP0 ($2)))
- {
- warning ("signature name in scope resolution ignored");
- $$ = build_method_call ($$, OP1 ($2), $4, NULL_TREE,
- LOOKUP_NORMAL);
- }
- else
- $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), $4);
- }
- | object overqualified_id LEFT_RIGHT
- {
- if (IS_SIGNATURE (OP0 ($2)))
- {
- warning ("signature name in scope resolution ignored");
- $$ = build_method_call ($$, OP1 ($2), NULL_TREE, NULL_TREE,
- LOOKUP_NORMAL);
- }
- else
- $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), NULL_TREE);
- }
- /* p->int::~int() is valid -- 12.4 */
- | object '~' TYPESPEC LEFT_RIGHT
- {
- if (IDENTIFIER_GLOBAL_VALUE ($3)
- && (TREE_CODE (TREE_TYPE ($1))
- != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3)))))
- cp_error ("`%E' is not of type `%T'", $1, $3);
- $$ = convert (void_type_node, $1);
- }
- | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
- {
- if ($2 != $5)
- cp_error ("destructor specifier `%T::~%T()' must have matching names", $2, $5);
- if (TREE_CODE (TREE_TYPE ($1))
- != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($2))))
- cp_error ("`%E' is not of type `%T'", $1, $2);
- $$ = convert (void_type_node, $1);
- }
- | object error
- {
- $$ = error_mark_node;
- }
- ;
-
-/* Not needed for now.
-
-primary_no_id:
- '(' expr ')'
- { $$ = $2; }
- | '(' error ')'
- { $$ = error_mark_node; }
- | '('
- { if (current_function_decl == 0)
- {
- error ("braced-group within expression allowed only inside a function");
- YYERROR;
- }
- $<ttype>$ = expand_start_stmt_expr (); }
- compstmt ')'
- { if (pedantic)
- pedwarn ("ANSI C++ forbids braced-groups within expressions");
- $$ = expand_end_stmt_expr ($<ttype>2); }
- | primary_no_id '(' nonnull_exprlist ')'
- { $$ = build_x_function_call ($$, $3, current_class_ref); }
- | primary_no_id LEFT_RIGHT
- { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
- | primary_no_id '[' expr ']'
- { goto do_array; }
- | primary_no_id PLUSPLUS
- { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
- | primary_no_id MINUSMINUS
- { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
- | SCOPE IDENTIFIER
- { goto do_scoped_id; }
- | SCOPE operator_name
- { if (TREE_CODE ($2) == IDENTIFIER_NODE)
- goto do_scoped_id;
- goto do_scoped_operator;
- }
- ;
-*/
-
-new:
- NEW
- { $$ = 0; }
- | global_scope NEW
- { got_scope = NULL_TREE; $$ = 1; }
- ;
-
-delete:
- DELETE
- { $$ = 0; }
- | global_scope delete
- { got_scope = NULL_TREE; $$ = 1; }
- ;
-
-boolean.literal:
- CXX_TRUE
- { $$ = boolean_true_node; }
- | CXX_FALSE
- { $$ = boolean_false_node; }
- ;
-
-/* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
-string:
- STRING
- | string STRING
- { $$ = chainon ($$, $2); }
- ;
-
-nodecls:
- /* empty */
- {
- if (! current_function_parms_stored)
- store_parm_decls ();
- setup_vtbl_ptr ();
- /* Always keep the BLOCK node associated with the outermost
- pair of curley braces of a function. These are needed
- for correct operation of dwarfout.c. */
- keep_next_level ();
- }
- ;
-
-object:
- primary '.'
- { got_object = TREE_TYPE ($$); }
- | primary POINTSAT
- {
- $$ = build_x_arrow ($$);
- got_object = TREE_TYPE ($$);
- }
- ;
-
-decl:
- typespec initdecls ';'
- {
- resume_momentary ($2);
- if (IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
- note_got_semicolon ($1.t);
- }
- | typed_declspecs initdecls ';'
- {
- resume_momentary ($2);
- note_list_got_semicolon ($1.t);
- }
- | declmods notype_initdecls ';'
- { resume_momentary ($2); }
- | typed_declspecs ';'
- {
- shadow_tag ($1.t);
- note_list_got_semicolon ($1.t);
- }
- | declmods ';'
- { warning ("empty declaration"); }
- | extension decl
- { pedantic = $<itype>1; }
- ;
-
-/* Any kind of declarator (thus, all declarators allowed
- after an explicit typespec). */
-
-declarator:
- after_type_declarator %prec EMPTY
- | notype_declarator %prec EMPTY
- ;
-
-/* This is necessary to postpone reduction of `int()()()()'. */
-fcast_or_absdcl:
- LEFT_RIGHT %prec EMPTY
- { $$ = make_call_declarator (NULL_TREE, empty_parms (),
- NULL_TREE, NULL_TREE); }
- | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
- { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
- NULL_TREE); }
- ;
-
-/* ANSI type-id (8.1) */
-type_id:
- typed_typespecs absdcl
- { $$.t = build_decl_list ($1.t, $2);
- $$.new_type_flag = $1.new_type_flag; }
- | nonempty_cv_qualifiers absdcl
- { $$.t = build_decl_list ($1.t, $2);
- $$.new_type_flag = $1.new_type_flag; }
- | typespec absdcl
- { $$.t = build_decl_list (get_decl_list ($1.t), $2);
- $$.new_type_flag = $1.new_type_flag; }
- | typed_typespecs %prec EMPTY
- { $$.t = build_decl_list ($1.t, NULL_TREE);
- $$.new_type_flag = $1.new_type_flag; }
- | nonempty_cv_qualifiers %prec EMPTY
- { $$.t = build_decl_list ($1.t, NULL_TREE);
- $$.new_type_flag = $1.new_type_flag; }
- ;
-
-/* Declspecs which contain at least one type specifier or typedef name.
- (Just `const' or `volatile' is not enough.)
- A typedef'd name following these is taken as a name to be declared.
- In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
-
-typed_declspecs:
- typed_typespecs %prec EMPTY
- | typed_declspecs1
- ;
-
-typed_declspecs1:
- declmods typespec
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1);
- $$.new_type_flag = $2.new_type_flag; }
- | typespec reserved_declspecs %prec HYPERUNARY
- { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
- $$.new_type_flag = $1.new_type_flag; }
- | typespec reserved_typespecquals reserved_declspecs
- { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
- $$.new_type_flag = $1.new_type_flag; }
- | declmods typespec reserved_declspecs
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
- $$.new_type_flag = $2.new_type_flag; }
- | declmods typespec reserved_typespecquals
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
- $$.new_type_flag = $2.new_type_flag; }
- | declmods typespec reserved_typespecquals reserved_declspecs
- { $$.t = decl_tree_cons (NULL_TREE, $2.t,
- chainon ($3, chainon ($4, $1)));
- $$.new_type_flag = $2.new_type_flag; }
- ;
-
-reserved_declspecs:
- SCSPEC
- { if (extra_warnings)
- warning ("`%s' is not at beginning of declaration",
- IDENTIFIER_POINTER ($$));
- $$ = build_decl_list (NULL_TREE, $$); }
- | reserved_declspecs typespecqual_reserved
- { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); }
- | reserved_declspecs SCSPEC
- { if (extra_warnings)
- warning ("`%s' is not at beginning of declaration",
- IDENTIFIER_POINTER ($2));
- $$ = decl_tree_cons (NULL_TREE, $2, $$); }
- | reserved_declspecs attributes
- { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
- | attributes
- { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
- ;
-
-/* List of just storage classes and type modifiers.
- A declaration can start with just this, but then it cannot be used
- to redeclare a typedef-name.
- In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
-
-declmods:
- nonempty_cv_qualifiers %prec EMPTY
- { $$ = $1.t; TREE_STATIC ($$) = 1; }
- | SCSPEC
- { $$ = IDENTIFIER_AS_LIST ($$); }
- | declmods CV_QUALIFIER
- { $$ = decl_tree_cons (NULL_TREE, $2, $$);
- TREE_STATIC ($$) = 1; }
- | declmods SCSPEC
- { if (extra_warnings && TREE_STATIC ($$))
- warning ("`%s' is not at beginning of declaration",
- IDENTIFIER_POINTER ($2));
- $$ = decl_tree_cons (NULL_TREE, $2, $$);
- TREE_STATIC ($$) = TREE_STATIC ($1); }
- | declmods attributes
- { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
- | attributes
- { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
- ;
-
-/* Used instead of declspecs where storage classes are not allowed
- (that is, for typenames and structure components).
-
- C++ can takes storage classes for structure components.
- Don't accept a typedef-name if anything but a modifier precedes it. */
-
-typed_typespecs:
- typespec %prec EMPTY
- { $$.t = get_decl_list ($1.t);
- $$.new_type_flag = $1.new_type_flag; }
- | nonempty_cv_qualifiers typespec
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t);
- $$.new_type_flag = $2.new_type_flag; }
- | typespec reserved_typespecquals
- { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
- $$.new_type_flag = $1.new_type_flag; }
- | nonempty_cv_qualifiers typespec reserved_typespecquals
- { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
- $$.new_type_flag = $1.new_type_flag; }
- ;
-
-reserved_typespecquals:
- typespecqual_reserved
- { $$ = build_decl_list (NULL_TREE, $1.t); }
- | reserved_typespecquals typespecqual_reserved
- { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); }
- ;
-
-/* A typespec (but not a type qualifier).
- Once we have seen one of these in a declaration,
- if a typedef name appears then it is being redeclared. */
-
-typespec:
- structsp
- | TYPESPEC %prec EMPTY
- { $$.t = $1; $$.new_type_flag = 0; }
- | complete_type_name
- { $$.t = $1; $$.new_type_flag = 0; }
- | TYPEOF '(' expr ')'
- { $$.t = TREE_TYPE ($3);
- $$.new_type_flag = 0;
- if (pedantic && !in_system_header)
- pedwarn ("ANSI C++ forbids `typeof'"); }
- | TYPEOF '(' type_id ')'
- { $$.t = groktypename ($3.t);
- if (pedantic && !in_system_header)
- pedwarn ("ANSI C++ forbids `typeof'");
- $$.new_type_flag = 0; }
- | SIGOF '(' expr ')'
- { tree type = TREE_TYPE ($3);
-
- $$.new_type_flag = 0;
- if (IS_AGGR_TYPE (type))
- {
- sorry ("sigof type specifier");
- $$.t = type;
- }
- else
- {
- error ("`sigof' applied to non-aggregate expression");
- $$.t = error_mark_node;
- }
- }
- | SIGOF '(' type_id ')'
- { tree type = groktypename ($3.t);
-
- $$.new_type_flag = 0;
- if (IS_AGGR_TYPE (type))
- {
- sorry ("sigof type specifier");
- $$.t = type;
- }
- else
- {
- error("`sigof' applied to non-aggregate type");
- $$.t = error_mark_node;
- }
- }
- ;
-
-/* A typespec that is a reserved word, or a type qualifier. */
-
-typespecqual_reserved:
- TYPESPEC
- { $$.t = $1; $$.new_type_flag = 0; }
- | CV_QUALIFIER
- { $$.t = $1; $$.new_type_flag = 0; }
- | structsp
- ;
-
-initdecls:
- initdcl0
- | initdecls ',' initdcl
- ;
-
-notype_initdecls:
- notype_initdcl0
- | notype_initdecls ',' initdcl
- ;
-
-nomods_initdecls:
- nomods_initdcl0
- | nomods_initdecls ',' initdcl
- ;
-
-maybeasm:
- /* empty */
- { $$ = NULL_TREE; }
- | asm_keyword '(' string ')'
- { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
- ;
-
-initdcl0:
- declarator maybeasm maybe_attribute '='
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- if (TREE_CODE (current_declspecs) != TREE_LIST)
- current_declspecs = get_decl_list (current_declspecs);
- if (have_extern_spec && !used_extern_spec)
- {
- current_declspecs = decl_tree_cons
- (NULL_TREE, get_identifier ("extern"),
- current_declspecs);
- used_extern_spec = 1;
- }
- $<itype>4 = suspend_momentary ();
- $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
- cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
- init
-/* Note how the declaration of the variable is in effect while its init is parsed! */
- { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
- $$ = $<itype>4; }
- | declarator maybeasm maybe_attribute
- { tree d;
- split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- if (TREE_CODE (current_declspecs) != TREE_LIST)
- current_declspecs = get_decl_list (current_declspecs);
- if (have_extern_spec && !used_extern_spec)
- {
- current_declspecs = decl_tree_cons
- (NULL_TREE, get_identifier ("extern"),
- current_declspecs);
- used_extern_spec = 1;
- }
- $$ = suspend_momentary ();
- d = start_decl ($<ttype>1, current_declspecs, 0);
- cplus_decl_attributes (d, $3, prefix_attributes);
- cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
- ;
-
-initdcl:
- declarator maybeasm maybe_attribute '='
- { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
- cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
- init
-/* Note how the declaration of the variable is in effect while its init is parsed! */
- { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING); }
- | declarator maybeasm maybe_attribute
- { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 0);
- cplus_decl_attributes ($<ttype>$, $3, prefix_attributes);
- cp_finish_decl ($<ttype>$, NULL_TREE, $2, 1, 0); }
- ;
-
-notype_initdcl0:
- notype_declarator maybeasm maybe_attribute '='
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<itype>4 = suspend_momentary ();
- $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
- cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
- init
-/* Note how the declaration of the variable is in effect while its init is parsed! */
- { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
- $$ = $<itype>4; }
- | notype_declarator maybeasm maybe_attribute
- { tree d;
- split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $$ = suspend_momentary ();
- d = start_decl ($<ttype>1, current_declspecs, 0);
- cplus_decl_attributes (d, $3, prefix_attributes);
- cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
- ;
-
-nomods_initdcl0:
- notype_declarator maybeasm maybe_attribute '='
- { current_declspecs = NULL_TREE;
- prefix_attributes = NULL_TREE;
- $<itype>4 = suspend_momentary ();
- $<ttype>$ = start_decl ($1, current_declspecs, 1);
- cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
- init
-/* Note how the declaration of the variable is in effect while its init is parsed! */
- { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
- $$ = $<itype>4; }
- | notype_declarator maybeasm maybe_attribute
- { tree d;
- current_declspecs = NULL_TREE;
- prefix_attributes = NULL_TREE;
- $$ = suspend_momentary ();
- d = start_decl ($1, current_declspecs, 0);
- cplus_decl_attributes (d, $3, prefix_attributes);
- cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
- ;
-
-/* the * rules are dummies to accept the Apollo extended syntax
- so that the header files compile. */
-maybe_attribute:
- /* empty */
- { $$ = NULL_TREE; }
- | attributes
- { $$ = $1; }
- ;
-
-attributes:
- attribute
- { $$ = $1; }
- | attributes attribute
- { $$ = chainon ($1, $2); }
- ;
-
-attribute:
- ATTRIBUTE '(' '(' attribute_list ')' ')'
- { $$ = $4; }
- ;
-
-attribute_list:
- attrib
- { $$ = $1; }
- | attribute_list ',' attrib
- { $$ = chainon ($1, $3); }
- ;
-
-attrib:
- /* empty */
- { $$ = NULL_TREE; }
- | any_word
- { $$ = build_tree_list ($1, NULL_TREE); }
- | any_word '(' IDENTIFIER ')'
- { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
- | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
- { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
- | any_word '(' nonnull_exprlist ')'
- { $$ = build_tree_list ($1, $3); }
- ;
-
-/* This still leaves out most reserved keywords,
- shouldn't we include them? */
-
-any_word:
- identifier
- | SCSPEC
- | TYPESPEC
- | CV_QUALIFIER
- ;
-
-/* A nonempty list of identifiers, including typenames. */
-identifiers_or_typenames:
- identifier
- { $$ = build_tree_list (NULL_TREE, $1); }
- | identifiers_or_typenames ',' identifier
- { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
- ;
-
-maybe_init:
- /* empty */ %prec EMPTY
- { $$ = NULL_TREE; }
- | '=' init
- { $$ = $2; }
-
-/* If we are processing a template, we don't want to expand this
- initializer yet. */
-
-init:
- expr_no_commas %prec '='
- | '{' '}'
- { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
- TREE_HAS_CONSTRUCTOR ($$) = 1; }
- | '{' initlist '}'
- { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
- TREE_HAS_CONSTRUCTOR ($$) = 1; }
- | '{' initlist ',' '}'
- { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
- TREE_HAS_CONSTRUCTOR ($$) = 1; }
- | error
- { $$ = NULL_TREE; }
- ;
-
-/* This chain is built in reverse order,
- and put in forward order where initlist is used. */
-initlist:
- init
- { $$ = build_tree_list (NULL_TREE, $$); }
- | initlist ',' init
- { $$ = tree_cons (NULL_TREE, $3, $$); }
- /* These are for labeled elements. */
- | '[' expr_no_commas ']' init
- { $$ = build_tree_list ($2, $4); }
- | initlist ',' CASE expr_no_commas ':' init
- { $$ = tree_cons ($4, $6, $$); }
- | identifier ':' init
- { $$ = build_tree_list ($$, $3); }
- | initlist ',' identifier ':' init
- { $$ = tree_cons ($3, $5, $$); }
- ;
-
-fn.defpen:
- PRE_PARSED_FUNCTION_DECL
- { start_function (NULL_TREE, TREE_VALUE ($1),
- NULL_TREE, 1);
- reinit_parse_for_function (); }
-
-pending_inlines:
- /* empty */
- | pending_inlines fn.defpen maybe_return_init ctor_initializer_opt
- compstmt_or_error
- {
- int nested = (hack_decl_function_context
- (current_function_decl) != NULL_TREE);
- finish_function (lineno, (int)$4, nested);
- process_next_inline ($2);
- }
- | pending_inlines fn.defpen maybe_return_init function_try_block
- { process_next_inline ($2); }
- eat_saved_input
- ;
-
-structsp:
- ENUM identifier '{'
- { $<itype>3 = suspend_momentary ();
- $<ttype>$ = start_enum ($2); }
- enumlist maybecomma_warn '}'
- { $$.t = finish_enum ($<ttype>4, $5);
- $$.new_type_flag = 1;
- resume_momentary ((int) $<itype>3);
- check_for_missing_semicolon ($<ttype>4); }
- | ENUM identifier '{' '}'
- { $$.t = finish_enum (start_enum ($2), NULL_TREE);
- $$.new_type_flag = 1;
- check_for_missing_semicolon ($$.t); }
- | ENUM '{'
- { $<itype>2 = suspend_momentary ();
- $<ttype>$ = start_enum (make_anon_name ()); }
- enumlist maybecomma_warn '}'
- { $$.t = finish_enum ($<ttype>3, $4);
- resume_momentary ((int) $<itype>1);
- check_for_missing_semicolon ($<ttype>3);
- $$.new_type_flag = 1; }
- | ENUM '{' '}'
- { $$.t = finish_enum (start_enum (make_anon_name()), NULL_TREE);
- $$.new_type_flag = 1;
- check_for_missing_semicolon ($$.t); }
- | ENUM identifier
- { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
- $$.new_type_flag = 0; }
- | ENUM complex_type_name
- { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
- $$.new_type_flag = 0; }
- | TYPENAME_KEYWORD nested_name_specifier identifier
- { $$.t = make_typename_type ($2, $3);
- $$.new_type_flag = 0; }
- | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
- { $$.t = make_typename_type ($3, $4);
- $$.new_type_flag = 0; }
- /* C++ extensions, merged with C to avoid shift/reduce conflicts */
- | class_head left_curly opt.component_decl_list '}' maybe_attribute
- {
- int semi;
- tree id;
-
- $<ttype>$ = $1;
-#if 0
- /* Need to rework class nesting in the
- presence of nested classes, etc. */
- shadow_tag (CLASSTYPE_AS_LIST ($1)); */
-#endif
- if (yychar == YYEMPTY)
- yychar = YYLEX;
- semi = yychar == ';';
- /* finish_struct nukes this anyway; if
- finish_exception does too, then it can go. */
- if (semi)
- note_got_semicolon ($1);
-
- if (TREE_CODE ($1) == ENUMERAL_TYPE)
- ;
- else
- {
- $<ttype>$ = finish_struct ($1, $3, $5, semi);
- if (semi) note_got_semicolon ($<ttype>$);
- }
-
- pop_obstacks ();
-
- if (! semi)
- check_for_missing_semicolon ($1);
- if (pending_inlines
- && current_scope () == current_function_decl)
- do_pending_inlines ();
- }
- pending_inlines
- { $$.t = $<ttype>6;
- $$.new_type_flag = 1; }
- | class_head %prec EMPTY
- {
- $$.t = $1;
- $$.new_type_flag = 0;
- /* struct B: public A; is not accepted by the WP grammar. */
- if (TYPE_BINFO_BASETYPES ($$.t) && !TYPE_SIZE ($$.t)
- && ! TYPE_BEING_DEFINED ($$.t))
- cp_error ("base clause without member specification for `%#T'",
- $$.t);
- }
- ;
-
-maybecomma:
- /* empty */
- | ','
- ;
-
-maybecomma_warn:
- /* empty */
- | ','
- { if (pedantic && !in_system_header)
- pedwarn ("comma at end of enumerator list"); }
- ;
-
-aggr:
- AGGR
- | aggr SCSPEC
- { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
- | aggr TYPESPEC
- { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
- | aggr CV_QUALIFIER
- { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
- | aggr AGGR
- { error ("no body nor ';' separates two class, struct or union declarations"); }
- ;
-
-named_class_head_sans_basetype:
- aggr identifier
- { current_aggr = $$; $$ = $2; }
- ;
-
-named_class_head_sans_basetype_defn:
- aggr identifier_defn %prec EMPTY
- { current_aggr = $$; $$ = $2; }
- ;
-
-named_complex_class_head_sans_basetype:
- aggr nested_name_specifier identifier
- {
- current_aggr = $1;
- if (TREE_CODE ($3) == TYPE_DECL)
- $$ = $3;
- else
- {
- cp_error ("`%T' does not have a nested type named `%D'",
- $2, $3);
- $$ = xref_tag
- (current_aggr, make_anon_name (), NULL_TREE, 1);
- $$ = TYPE_MAIN_DECL ($$);
- }
- }
- | aggr template_type
- { current_aggr = $$; $$ = $2; }
- | aggr nested_name_specifier template_type
- { current_aggr = $$; $$ = $3; }
- ;
-
-do_xref_defn:
- /* empty */ %prec EMPTY
- { $<ttype>$ = xref_tag (current_aggr, $<ttype>0, NULL_TREE, 0); }
- ;
-
-named_class_head:
- named_class_head_sans_basetype %prec EMPTY
- { $$ = xref_tag (current_aggr, $1, NULL_TREE, 1); }
- | named_class_head_sans_basetype_defn do_xref_defn
- maybe_base_class_list %prec EMPTY
- {
- $$ = $<ttype>2;
- if ($3)
- xref_basetypes (current_aggr, $1, $<ttype>2, $3);
- }
- | named_complex_class_head_sans_basetype maybe_base_class_list
- {
- $$ = TREE_TYPE ($1);
- if (TREE_INT_CST_LOW (current_aggr) == union_type
- && TREE_CODE ($$) != UNION_TYPE)
- cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
- else if (TREE_CODE ($$) == UNION_TYPE
- && TREE_INT_CST_LOW (current_aggr) != union_type)
- cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
- if ($2)
- {
- if (IS_AGGR_TYPE ($$) && CLASSTYPE_USE_TEMPLATE ($$))
- {
- if (CLASSTYPE_IMPLICIT_INSTANTIATION ($$)
- && TYPE_SIZE ($$) == NULL_TREE)
- {
- SET_CLASSTYPE_TEMPLATE_SPECIALIZATION ($$);
- if (processing_template_decl)
- push_template_decl (TYPE_MAIN_DECL ($$));
- }
- else if (CLASSTYPE_TEMPLATE_INSTANTIATION ($$))
- cp_error ("specialization after instantiation of `%T'", $$);
- }
- xref_basetypes (current_aggr, $1, $$, $2);
- }
- }
- ;
-
-unnamed_class_head:
- aggr '{'
- { $$ = xref_tag ($$, make_anon_name (), NULL_TREE, 0);
- yyungetc ('{', 1); }
- ;
-
-class_head:
- unnamed_class_head
- | named_class_head
- ;
-
-maybe_base_class_list:
- /* empty */ %prec EMPTY
- { $$ = NULL_TREE; }
- | ':' see_typename %prec EMPTY
- { yyungetc(':', 1); $$ = NULL_TREE; }
- | ':' see_typename base_class_list %prec EMPTY
- { $$ = $3; }
- ;
-
-base_class_list:
- base_class
- | base_class_list ',' see_typename base_class
- { $$ = chainon ($$, $4); }
- ;
-
-base_class:
- base_class.1
- {
- tree type = TREE_TYPE ($1);
- if (! is_aggr_type (type, 1))
- $$ = NULL_TREE;
- else if (current_aggr == signature_type_node
- && (! type) && (! IS_SIGNATURE (type)))
- {
- error ("class name not allowed as base signature");
- $$ = NULL_TREE;
- }
- else if (current_aggr == signature_type_node)
- {
- sorry ("signature inheritance, base type `%s' ignored",
- IDENTIFIER_POINTER ($$));
- $$ = build_tree_list (access_public_node, type);
- }
- else if (type && IS_SIGNATURE (type))
- {
- error ("signature name not allowed as base class");
- $$ = NULL_TREE;
- }
- else
- $$ = build_tree_list (access_default_node, type);
- }
- | base_class_access_list see_typename base_class.1
- {
- tree type = TREE_TYPE ($3);
- if (current_aggr == signature_type_node)
- error ("access and source specifiers not allowed in signature");
- if (! IS_AGGR_TYPE (type))
- $$ = NULL_TREE;
- else if (current_aggr == signature_type_node
- && (! type) && (! IS_SIGNATURE (type)))
- {
- error ("class name not allowed as base signature");
- $$ = NULL_TREE;
- }
- else if (current_aggr == signature_type_node)
- {
- sorry ("signature inheritance, base type `%s' ignored",
- IDENTIFIER_POINTER ($$));
- $$ = build_tree_list (access_public_node, type);
- }
- else if (type && IS_SIGNATURE (type))
- {
- error ("signature name not allowed as base class");
- $$ = NULL_TREE;
- }
- else
- $$ = build_tree_list ($$, type);
- }
- ;
-
-base_class.1:
- complete_type_name
- | TYPENAME_KEYWORD nested_name_specifier identifier
- { $$ = TYPE_MAIN_DECL (make_typename_type ($2, $3)); }
- | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
- { $$ = TYPE_MAIN_DECL (make_typename_type ($3, $4)); }
- | SIGOF '(' expr ')'
- {
- if (current_aggr == signature_type_node)
- {
- if (IS_AGGR_TYPE (TREE_TYPE ($3)))
- {
- sorry ("`sigof' as base signature specifier");
- $$ = TREE_TYPE ($3);
- }
- else
- {
- error ("`sigof' applied to non-aggregate expression");
- $$ = error_mark_node;
- }
- }
- else
- {
- error ("`sigof' in struct or class declaration");
- $$ = error_mark_node;
- }
- }
- | SIGOF '(' type_id ')'
- {
- if (current_aggr == signature_type_node)
- {
- if (IS_AGGR_TYPE (groktypename ($3.t)))
- {
- sorry ("`sigof' as base signature specifier");
- $$ = groktypename ($3.t);
- }
- else
- {
- error ("`sigof' applied to non-aggregate expression");
- $$ = error_mark_node;
- }
- }
- else
- {
- error ("`sigof' in struct or class declaration");
- $$ = error_mark_node;
- }
- }
- ;
-
-base_class_access_list:
- VISSPEC see_typename
- | SCSPEC see_typename
- { if ($<ttype>$ != ridpointers[(int)RID_VIRTUAL])
- sorry ("non-virtual access");
- $$ = access_default_virtual_node; }
- | base_class_access_list VISSPEC see_typename
- { int err = 0;
- if ($2 == access_protected_node)
- {
- warning ("`protected' access not implemented");
- $2 = access_public_node;
- err++;
- }
- else if ($2 == access_public_node)
- {
- if ($1 == access_private_node)
- {
- mixed:
- error ("base class cannot be public and private");
- }
- else if ($1 == access_default_virtual_node)
- $$ = access_public_virtual_node;
- }
- else /* $2 == access_private_node */
- {
- if ($1 == access_public_node)
- goto mixed;
- else if ($1 == access_default_virtual_node)
- $$ = access_private_virtual_node;
- }
- }
- | base_class_access_list SCSPEC see_typename
- { if ($2 != ridpointers[(int)RID_VIRTUAL])
- sorry ("non-virtual access");
- if ($$ == access_public_node)
- $$ = access_public_virtual_node;
- else if ($$ == access_private_node)
- $$ = access_private_virtual_node; }
- ;
-
-left_curly:
- '{'
- { tree t = $<ttype>0;
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- if (t == error_mark_node
- || ! IS_AGGR_TYPE (t))
- {
- t = $<ttype>0 = make_lang_type (RECORD_TYPE);
- pushtag (make_anon_name (), t, 0);
- }
- if (TYPE_SIZE (t))
- duplicate_tag_error (t);
- if (TYPE_SIZE (t) || TYPE_BEING_DEFINED (t))
- {
- t = make_lang_type (TREE_CODE (t));
- pushtag (TYPE_IDENTIFIER ($<ttype>0), t, 0);
- $<ttype>0 = t;
- }
- if (processing_template_decl && TYPE_CONTEXT (t)
- && ! current_class_type)
- push_template_decl (TYPE_STUB_DECL (t));
- pushclass (t, 0);
- TYPE_BEING_DEFINED (t) = 1;
- if (IS_AGGR_TYPE (t) && CLASSTYPE_USE_TEMPLATE (t))
- {
- if (CLASSTYPE_IMPLICIT_INSTANTIATION (t)
- && TYPE_SIZE (t) == NULL_TREE)
- {
- SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (t);
- if (processing_template_decl)
- push_template_decl (TYPE_MAIN_DECL (t));
- }
- else if (CLASSTYPE_TEMPLATE_INSTANTIATION (t))
- cp_error ("specialization after instantiation of `%T'", t);
- }
- /* Reset the interface data, at the earliest possible
- moment, as it might have been set via a class foo;
- before. */
- /* Don't change signatures. */
- if (! IS_SIGNATURE (t))
- {
- extern tree pending_vtables;
- int needs_writing;
- tree name = TYPE_IDENTIFIER (t);
-
- if (! ANON_AGGRNAME_P (name))
- {
- CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X
- (t, interface_unknown);
- }
-
- /* Record how to set the access of this class's
- virtual functions. If write_virtuals == 2 or 3, then
- inline virtuals are ``extern inline''. */
- switch (write_virtuals)
- {
- case 0:
- case 1:
- needs_writing = 1;
- break;
- case 2:
- needs_writing = !! value_member (name, pending_vtables);
- break;
- case 3:
- needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t)
- && CLASSTYPE_INTERFACE_KNOWN (t);
- break;
- default:
- needs_writing = 0;
- }
- CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing;
- }
-#if 0
- t = TYPE_IDENTIFIER ($<ttype>0);
- if (t && IDENTIFIER_TEMPLATE (t))
- overload_template_name (t, 1);
-#endif
- }
- ;
-
-self_reference:
- /* empty */
- {
- if (CLASSTYPE_TEMPLATE_INFO (current_class_type))
- $$ = NULL_TREE;
- else
- $$ = build_self_reference ();
- }
- ;
-
-opt.component_decl_list:
- self_reference
- { if ($$) $$ = build_tree_list (access_public_node, $$); }
- | self_reference component_decl_list
- {
- if (current_aggr == signature_type_node)
- $$ = build_tree_list (access_public_node, $2);
- else
- $$ = build_tree_list (access_default_node, $2);
- if ($1) $$ = tree_cons (access_public_node, $1, $$);
- }
- | opt.component_decl_list VISSPEC ':' component_decl_list
- {
- tree visspec = $2;
-
- if (current_aggr == signature_type_node)
- {
- error ("access specifier not allowed in signature");
- visspec = access_public_node;
- }
- $$ = chainon ($$, build_tree_list (visspec, $4));
- }
- | opt.component_decl_list VISSPEC ':'
- {
- if (current_aggr == signature_type_node)
- error ("access specifier not allowed in signature");
- }
- ;
-
-/* Note: we no longer warn about the semicolon after a component_decl_list.
- ARM $9.2 says that the semicolon is optional, and therefore allowed. */
-component_decl_list:
- component_decl
- { if ($$ == void_type_node) $$ = NULL_TREE;
- }
- | component_decl_list component_decl
- { /* In pushdecl, we created a reverse list of names
- in this binding level. Make sure that the chain
- of what we're trying to add isn't the item itself
- (which can happen with what pushdecl's doing). */
- if ($2 != NULL_TREE && $2 != void_type_node)
- {
- if (TREE_CHAIN ($2) != $$)
- $$ = chainon ($$, $2);
- else
- $$ = $2;
- }
- }
- ;
-
-component_decl:
- component_decl_1 ';'
- { }
- | component_decl_1 '}'
- { error ("missing ';' before right brace");
- yyungetc ('}', 0); }
- /* C++: handle constructors, destructors and inline functions */
- /* note that INLINE is like a TYPESPEC */
- | fn.def2 ':' /* base_init compstmt */
- { $$ = finish_method ($$); }
- | fn.def2 TRY /* base_init compstmt */
- { $$ = finish_method ($$); }
- | fn.def2 RETURN /* base_init compstmt */
- { $$ = finish_method ($$); }
- | fn.def2 '{' /* nodecls compstmt */
- { $$ = finish_method ($$); }
- | ';'
- { $$ = NULL_TREE; }
- | extension component_decl
- { $$ = $2;
- pedantic = $<itype>1; }
- ;
-
-component_decl_1:
- /* Do not add a "typed_declspecs declarator" rule here for
- speed; we need to call grok_x_components for enums, so the
- speedup would be insignificant. */
- typed_declspecs components
- { $$ = grok_x_components ($1.t, $2); }
- | declmods notype_components
- { $$ = grok_x_components ($1, $2); }
- | notype_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, NULL_TREE, $4, $2,
- build_tree_list ($3, NULL_TREE)); }
- | constructor_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, NULL_TREE, $4, $2,
- build_tree_list ($3, NULL_TREE)); }
- | ':' expr_no_commas
- { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
- | error
- { $$ = NULL_TREE; }
-
- /* These rules introduce a reduce/reduce conflict; in
- typedef int foo, bar;
- class A {
- foo (bar);
- };
- should "A::foo" be declared as a function or "A::bar" as a data
- member? In other words, is "bar" an after_type_declarator or a
- parmlist? */
- | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
- { tree specs, attrs;
- split_specs_attrs ($1, &specs, &attrs);
- $$ = grokfield ($2, specs, $5, $3,
- build_tree_list ($4, attrs)); }
- | component_constructor_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, NULL_TREE, $4, $2,
- build_tree_list ($3, NULL_TREE)); }
- | using_decl
- { $$ = do_class_using_decl ($1); }
- ;
-
-/* The case of exactly one component is handled directly by component_decl. */
-/* ??? Huh? ^^^ */
-components:
- /* empty: possibly anonymous */
- { $$ = NULL_TREE; }
- | component_declarator0
- | components ',' component_declarator
- {
- /* In this context, void_type_node encodes
- friends. They have been recorded elsewhere. */
- if ($$ == void_type_node)
- $$ = $3;
- else
- $$ = chainon ($$, $3);
- }
- ;
-
-notype_components:
- /* empty: possibly anonymous */
- { $$ = NULL_TREE; }
- | notype_component_declarator0
- | notype_components ',' notype_component_declarator
- {
- /* In this context, void_type_node encodes
- friends. They have been recorded elsewhere. */
- if ($$ == void_type_node)
- $$ = $3;
- else
- $$ = chainon ($$, $3);
- }
- ;
-
-component_declarator0:
- after_type_component_declarator0
- | notype_component_declarator0
- ;
-
-component_declarator:
- after_type_component_declarator
- | notype_component_declarator
- ;
-
-after_type_component_declarator0:
- after_type_declarator maybeasm maybe_attribute maybe_init
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
- | TYPENAME ':' expr_no_commas maybe_attribute
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokbitfield ($$, current_declspecs, $3);
- cplus_decl_attributes ($$, $4, prefix_attributes); }
- ;
-
-notype_component_declarator0:
- notype_declarator maybeasm maybe_attribute maybe_init
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
- | constructor_declarator maybeasm maybe_attribute maybe_init
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
- | IDENTIFIER ':' expr_no_commas maybe_attribute
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokbitfield ($$, current_declspecs, $3);
- cplus_decl_attributes ($$, $4, prefix_attributes); }
- | ':' expr_no_commas maybe_attribute
- { split_specs_attrs ($<ttype>0, &current_declspecs,
- &prefix_attributes);
- $<ttype>0 = current_declspecs;
- $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
- cplus_decl_attributes ($$, $3, prefix_attributes); }
- ;
-
-after_type_component_declarator:
- after_type_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
- | TYPENAME ':' expr_no_commas maybe_attribute
- { $$ = grokbitfield ($$, current_declspecs, $3);
- cplus_decl_attributes ($$, $4, prefix_attributes); }
- ;
-
-notype_component_declarator:
- notype_declarator maybeasm maybe_attribute maybe_init
- { $$ = grokfield ($$, current_declspecs, $4, $2,
- build_tree_list ($3, prefix_attributes)); }
- | IDENTIFIER ':' expr_no_commas maybe_attribute
- { $$ = grokbitfield ($$, current_declspecs, $3);
- cplus_decl_attributes ($$, $4, prefix_attributes); }
- | ':' expr_no_commas maybe_attribute
- { $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
- cplus_decl_attributes ($$, $3, prefix_attributes); }
- ;
-
-/* We chain the enumerators in reverse order.
- Because of the way enums are built, the order is
- insignificant. Take advantage of this fact. */
-
-enumlist:
- enumerator
- | enumlist ',' enumerator
- { TREE_CHAIN ($3) = $$; $$ = $3; }
- ;
-
-enumerator:
- identifier
- { $$ = build_enumerator ($$, NULL_TREE); }
- | identifier '=' expr_no_commas
- { $$ = build_enumerator ($$, $3); }
- ;
-
-/* ANSI new-type-id (5.3.4) */
-new_type_id:
- type_specifier_seq new_declarator
- { $$.t = build_decl_list ($1.t, $2);
- $$.new_type_flag = $1.new_type_flag; }
- | type_specifier_seq %prec EMPTY
- { $$.t = build_decl_list ($1.t, NULL_TREE);
- $$.new_type_flag = $1.new_type_flag; }
- /* GNU extension to allow arrays of arbitrary types with
- non-constant dimension. */
- | '(' type_id ')' '[' expr ']'
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
- $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($2.t), $5);
- $$.t = build_decl_list (TREE_PURPOSE ($2.t), $$.t);
- $$.new_type_flag = $2.new_type_flag;
- }
- ;
-
-cv_qualifiers:
- /* empty */ %prec EMPTY
- { $$ = NULL_TREE; }
- | cv_qualifiers CV_QUALIFIER
- { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
- ;
-
-nonempty_cv_qualifiers:
- CV_QUALIFIER
- { $$.t = IDENTIFIER_AS_LIST ($1);
- $$.new_type_flag = 0; }
- | nonempty_cv_qualifiers CV_QUALIFIER
- { $$.t = decl_tree_cons (NULL_TREE, $2, $1.t);
- $$.new_type_flag = $1.new_type_flag; }
- ;
-
-/* These rules must follow the rules for function declarations
- and component declarations. That way, longer rules are preferred. */
-
-suspend_mom:
- /* empty */
- { $<itype>$ = suspend_momentary (); }
-
-/* An expression which will not live on the momentary obstack. */
-nonmomentary_expr:
- suspend_mom expr
- { resume_momentary ((int) $<itype>1); $$ = $2; }
- ;
-
-/* An expression which will not live on the momentary obstack. */
-maybe_parmlist:
- suspend_mom '(' nonnull_exprlist ')'
- { resume_momentary ((int) $<itype>1); $$ = $3; }
- | suspend_mom '(' parmlist ')'
- { resume_momentary ((int) $<itype>1); $$ = $3; }
- | suspend_mom LEFT_RIGHT
- { resume_momentary ((int) $<itype>1); $$ = empty_parms (); }
- | suspend_mom '(' error ')'
- { resume_momentary ((int) $<itype>1); $$ = NULL_TREE; }
- ;
-
-/* A declarator that is allowed only after an explicit typespec. */
-/* may all be followed by prec '.' */
-after_type_declarator:
- '*' nonempty_cv_qualifiers after_type_declarator %prec UNARY
- { $$ = make_pointer_declarator ($2.t, $3); }
- | '&' nonempty_cv_qualifiers after_type_declarator %prec UNARY
- { $$ = make_reference_declarator ($2.t, $3); }
- | '*' after_type_declarator %prec UNARY
- { $$ = make_pointer_declarator (NULL_TREE, $2); }
- | '&' after_type_declarator %prec UNARY
- { $$ = make_reference_declarator (NULL_TREE, $2); }
- | ptr_to_mem cv_qualifiers after_type_declarator
- { tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
- }
- | direct_after_type_declarator
- ;
-
-complete_type_name:
- type_name %prec EMPTY
- {
- if (TREE_CODE ($1) == IDENTIFIER_NODE)
- {
- if (current_class_type
- && TYPE_BEING_DEFINED (current_class_type)
- && ! IDENTIFIER_CLASS_VALUE ($1))
- {
- /* Be sure to get an inherited typedef. */
- $$ = lookup_name ($1, 1);
- /* Remember that this name has been used in the class
- definition, as per [class.scope0] */
- pushdecl_class_level ($$);
- }
- else
- $$ = identifier_typedecl_value ($1);
- }
- else
- $$ = $1;
- }
- | global_scope type_name
- {
- if (TREE_CODE ($2) == IDENTIFIER_NODE)
- $$ = identifier_typedecl_value ($2);
- else
- $$ = $2;
- got_scope = NULL_TREE;
- }
- | nested_type
- | global_scope nested_type
- { $$ = $2; }
- ;
-
-nested_type:
- nested_name_specifier type_name %prec EMPTY
- { $$ = get_type_decl ($2); }
- ;
-
-direct_after_type_declarator:
- direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
- { $$ = make_call_declarator ($$, $2, $3, $4); }
- | direct_after_type_declarator '[' nonmomentary_expr ']'
- { $$ = build_parse_node (ARRAY_REF, $$, $3); }
- | direct_after_type_declarator '[' ']'
- { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
- | '(' after_type_declarator ')'
- { $$ = $2; }
- | nested_name_specifier type_name %prec EMPTY
- { push_nested_class ($1, 3);
- $$ = build_parse_node (SCOPE_REF, $$, $2);
- TREE_COMPLEXITY ($$) = current_class_depth; }
- | type_name %prec EMPTY
- ;
-
-/* A declarator allowed whether or not there has been
- an explicit typespec. These cannot redeclare a typedef-name. */
-
-notype_declarator:
- '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
- { $$ = make_pointer_declarator ($2.t, $3); }
- | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
- { $$ = make_reference_declarator ($2.t, $3); }
- | '*' notype_declarator %prec UNARY
- { $$ = make_pointer_declarator (NULL_TREE, $2); }
- | '&' notype_declarator %prec UNARY
- { $$ = make_reference_declarator (NULL_TREE, $2); }
- | ptr_to_mem cv_qualifiers notype_declarator
- { tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
- }
- | direct_notype_declarator
- ;
-
-complex_notype_declarator:
- '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
- { $$ = make_pointer_declarator ($2.t, $3); }
- | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
- { $$ = make_reference_declarator ($2.t, $3); }
- | '*' complex_notype_declarator %prec UNARY
- { $$ = make_pointer_declarator (NULL_TREE, $2); }
- | '&' complex_notype_declarator %prec UNARY
- { $$ = make_reference_declarator (NULL_TREE, $2); }
- | ptr_to_mem cv_qualifiers notype_declarator
- { tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
- }
- | complex_direct_notype_declarator
- ;
-
-complex_direct_notype_declarator:
- direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
- { $$ = make_call_declarator ($$, $2, $3, $4); }
- | '(' complex_notype_declarator ')'
- { $$ = $2; }
- | direct_notype_declarator '[' nonmomentary_expr ']'
- { $$ = build_parse_node (ARRAY_REF, $$, $3); }
- | direct_notype_declarator '[' ']'
- { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
- | notype_qualified_id
- { if (OP0 ($$) != current_class_type)
- {
- push_nested_class (OP0 ($$), 3);
- TREE_COMPLEXITY ($$) = current_class_depth;
- }
- }
- ;
-
-qualified_id:
- nested_name_specifier unqualified_id
- { got_scope = NULL_TREE;
- $$ = build_parse_node (SCOPE_REF, $$, $2); }
- ;
-
-notype_qualified_id:
- nested_name_specifier notype_unqualified_id
- { got_scope = NULL_TREE;
- $$ = build_parse_node (SCOPE_REF, $$, $2); }
- ;
-
-overqualified_id:
- notype_qualified_id
- | global_scope notype_qualified_id
- { $$ = $2; }
- ;
-
-functional_cast:
- typespec '(' nonnull_exprlist ')'
- { $$ = build_functional_cast ($1.t, $3); }
- | typespec '(' expr_or_declarator ')'
- { $$ = reparse_decl_as_expr ($1.t, $3); }
- | typespec fcast_or_absdcl %prec EMPTY
- { $$ = reparse_absdcl_as_expr ($1.t, $2); }
- ;
-
-type_name:
- TYPENAME
- | SELFNAME
- | template_type %prec EMPTY
- ;
-
-nested_name_specifier:
- nested_name_specifier_1
- | nested_name_specifier nested_name_specifier_1
- { $$ = $2; }
- ;
-
-/* Why the @#$%^& do type_name and notype_identifier need to be expanded
- inline here?!? (jason) */
-nested_name_specifier_1:
- TYPENAME SCOPE
- {
- if (TREE_CODE ($1) == IDENTIFIER_NODE)
- {
- $$ = lastiddecl;
- /* Remember that this name has been used in the class
- definition, as per [class.scope0] */
- if (current_class_type
- && TYPE_BEING_DEFINED (current_class_type)
- && ! IDENTIFIER_CLASS_VALUE ($1))
- pushdecl_class_level ($$);
- }
- got_scope = $$ = TREE_TYPE ($$);
- }
- | SELFNAME SCOPE
- {
- if (TREE_CODE ($1) == IDENTIFIER_NODE)
- $$ = lastiddecl;
- got_scope = $$ = TREE_TYPE ($$);
- }
- | NSNAME SCOPE
- { got_scope = $$ = $1; }
- | template_type SCOPE
- { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
-/* These break 'const i;'
- | IDENTIFIER SCOPE
- {
- failed_scope:
- cp_error ("`%D' is not an aggregate typedef",
- lastiddecl ? lastiddecl : $$);
- $$ = error_mark_node;
- }
- | PTYPENAME SCOPE
- { goto failed_scope; } */
- ;
-
-complex_type_name:
- global_scope type_name
- {
- if (TREE_CODE ($2) == IDENTIFIER_NODE)
- $$ = identifier_typedecl_value ($2);
- else
- $$ = $2;
- got_scope = NULL_TREE;
- }
- | nested_type
- | global_scope nested_type
- { $$ = $2; }
- ;
-
-ptr_to_mem:
- nested_name_specifier '*'
- { got_scope = NULL_TREE; }
- | global_scope nested_name_specifier '*'
- { $$ = $2; got_scope = NULL_TREE; }
- ;
-
-/* All uses of explicit global scope must go through this nonterminal so
- that got_scope will be set before yylex is called to get the next token. */
-global_scope:
- SCOPE
- { got_scope = void_type_node; }
- ;
-
-/* ANSI new-declarator (5.3.4) */
-new_declarator:
- '*' cv_qualifiers new_declarator
- { $$ = make_pointer_declarator ($2, $3); }
- | '*' cv_qualifiers %prec EMPTY
- { $$ = make_pointer_declarator ($2, NULL_TREE); }
- | '&' cv_qualifiers new_declarator %prec EMPTY
- { $$ = make_reference_declarator ($2, $3); }
- | '&' cv_qualifiers %prec EMPTY
- { $$ = make_reference_declarator ($2, NULL_TREE); }
- | ptr_to_mem cv_qualifiers %prec EMPTY
- { tree arg = make_pointer_declarator ($2, NULL_TREE);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
- }
- | ptr_to_mem cv_qualifiers new_declarator
- { tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
- }
- | direct_new_declarator %prec EMPTY
- ;
-
-/* ANSI direct-new-declarator (5.3.4) */
-direct_new_declarator:
- '[' expr ']'
- { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
- | direct_new_declarator '[' nonmomentary_expr ']'
- { $$ = build_parse_node (ARRAY_REF, $$, $3); }
- ;
-
-/* ANSI abstract-declarator (8.1) */
-absdcl:
- '*' nonempty_cv_qualifiers absdcl
- { $$ = make_pointer_declarator ($2.t, $3); }
- | '*' absdcl
- { $$ = make_pointer_declarator (NULL_TREE, $2); }
- | '*' nonempty_cv_qualifiers %prec EMPTY
- { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
- | '*' %prec EMPTY
- { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
- | '&' nonempty_cv_qualifiers absdcl
- { $$ = make_reference_declarator ($2.t, $3); }
- | '&' absdcl
- { $$ = make_reference_declarator (NULL_TREE, $2); }
- | '&' nonempty_cv_qualifiers %prec EMPTY
- { $$ = make_reference_declarator ($2.t, NULL_TREE); }
- | '&' %prec EMPTY
- { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
- | ptr_to_mem cv_qualifiers %prec EMPTY
- { tree arg = make_pointer_declarator ($2, NULL_TREE);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
- }
- | ptr_to_mem cv_qualifiers absdcl
- { tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
- }
- | direct_abstract_declarator %prec EMPTY
- ;
-
-/* ANSI direct-abstract-declarator (8.1) */
-direct_abstract_declarator:
- '(' absdcl ')'
- { $$ = $2; }
- /* `(typedef)1' is `int'. */
- | PAREN_STAR_PAREN
- | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
- { $$ = make_call_declarator ($$, $3, $5, $6); }
- | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
- { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
- | direct_abstract_declarator '[' nonmomentary_expr ']' %prec '.'
- { $$ = build_parse_node (ARRAY_REF, $$, $3); }
- | direct_abstract_declarator '[' ']' %prec '.'
- { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
- | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
- { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
- | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
- { set_quals_and_spec ($$, $2, $3); }
- | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
- { set_quals_and_spec ($$, $2, $3); }
- | '[' nonmomentary_expr ']' %prec '.'
- { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
- | '[' ']' %prec '.'
- { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
- ;
-
-/* For C++, decls and stmts can be intermixed, so we don't need to
- have a special rule that won't start parsing the stmt section
- until we have a stmt that parses without errors. */
-
-stmts:
- stmt
- | errstmt
- | stmts stmt
- | stmts errstmt
- ;
-
-errstmt:
- error ';'
- ;
-
-/* build the LET_STMT node before parsing its contents,
- so that any LET_STMTs within the context can have their display pointers
- set up to point at this one. */
-
-.pushlevel:
- /* empty */
- { do_pushlevel (); }
- ;
-
-.poplevel:
- /* empty */
- { $$ = do_poplevel (); }
- ;
-
-/* Read zero or more forward-declarations for labels
- that nested functions can jump to. */
-maybe_label_decls:
- /* empty */
- | label_decls
- { if (pedantic)
- pedwarn ("ANSI C++ forbids label declarations"); }
- ;
-
-label_decls:
- label_decl
- | label_decls label_decl
- ;
-
-label_decl:
- LABEL identifiers_or_typenames ';'
- { tree link;
- for (link = $2; link; link = TREE_CHAIN (link))
- {
- tree label = shadow_label (TREE_VALUE (link));
- C_DECLARED_LABEL_FLAG (label) = 1;
- declare_nonlocal_label (label);
- }
- }
- ;
-
-/* This is the body of a function definition.
- It causes syntax errors to ignore to the next openbrace. */
-compstmt_or_error:
- compstmt
- {}
- | error compstmt
- ;
-
-compstmt:
- '{'
- {
- if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
- add_tree ($<ttype>$);
- }
- }
- .pushlevel compstmtend .poplevel
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- $$ = $5;
- }
- ;
-
-simple_if:
- IF
- {
- if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE,
- NULL_TREE);
- add_tree ($<ttype>$);
- }
- cond_stmt_keyword = "if";
- }
- .pushlevel paren_cond_or_null
- {
- if (processing_template_decl)
- {
- if (last_tree != $<ttype>2)
- {
- TREE_OPERAND ($<ttype>2, 0) = last_tree;
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- else
- TREE_OPERAND ($<ttype>2, 0) = $4;
- }
- else
- {
- emit_line_note (input_filename, lineno);
- expand_start_cond ($4, 0);
- }
- }
- implicitly_scoped_stmt
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- $<ttype>$ = last_tree = $<ttype>2;
- }
- }
- ;
-
-implicitly_scoped_stmt:
- compstmt
- { finish_stmt (); }
- | .pushlevel
- {
- if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
- add_tree ($<ttype>$);
- }
- }
- simple_stmt .poplevel
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- $$ = $4;
- }
- ;
-
-stmt:
- compstmt
- { finish_stmt (); }
- | simple_stmt
- ;
-
-simple_stmt:
- decl
- { finish_stmt (); }
- | expr ';'
- {
- tree expr = $1;
- if (! processing_template_decl)
- {
- emit_line_note (input_filename, lineno);
- /* Do default conversion if safe and possibly important,
- in case within ({...}). */
- if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
- && lvalue_p (expr))
- || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
- expr = default_conversion (expr);
- }
- cplus_expand_expr_stmt (expr);
- clear_momentary ();
- finish_stmt (); }
- | simple_if ELSE
- { if (! processing_template_decl) expand_start_else (); }
- implicitly_scoped_stmt
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>1, 2) = TREE_CHAIN ($<ttype>1);
- TREE_CHAIN ($<ttype>1) = NULL_TREE;
- last_tree = $<ttype>1;
- }
- else
- expand_end_cond ();
- }
- .poplevel
- { finish_stmt (); }
- | simple_if %prec IF
- { if (! processing_template_decl) expand_end_cond ();
- do_poplevel ();
- finish_stmt (); }
- | WHILE
- {
- if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
- add_tree ($<ttype>$);
- }
- else
- {
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop (1);
- }
- cond_stmt_keyword = "while";
- }
- .pushlevel paren_cond_or_null
- {
- if (processing_template_decl)
- {
- if (last_tree != $<ttype>2)
- {
- TREE_OPERAND ($<ttype>2, 0) = last_tree;
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- else
- TREE_OPERAND ($<ttype>2, 0) = $4;
- }
- else
- {
- emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (0, $4);
- }
- }
- already_scoped_stmt .poplevel
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- else
- expand_end_loop ();
- finish_stmt ();
- }
- | DO
- {
- if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
- add_tree ($<ttype>$);
- }
- else
- {
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop_continue_elsewhere (1);
- }
- }
- implicitly_scoped_stmt WHILE
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- else
- {
- expand_loop_continue_here ();
- cond_stmt_keyword = "do";
- }
- }
- paren_expr_or_null ';'
- {
- if (processing_template_decl)
- TREE_OPERAND ($<ttype>2, 1) = $6;
- else
- {
- emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (0, $6);
- expand_end_loop ();
- }
- clear_momentary ();
- finish_stmt ();
- }
- | FOR
- { if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
- NULL_TREE, NULL_TREE);
- add_tree ($<ttype>$);
- }
- else
- emit_line_note (input_filename, lineno);
- if (flag_new_for_scope > 0)
- {
- /* Conditionalize .pushlevel */
- pushlevel (0);
- note_level_for_for ();
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
- }
- }
- '(' for.init.statement
- {
- if (processing_template_decl)
- {
- if (last_tree != $<ttype>2)
- {
- TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- }
- else
- {
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop_continue_elsewhere (1);
- }
- }
- .pushlevel xcond ';'
- {
- if (processing_template_decl)
- {
- if (last_tree != $<ttype>2)
- {
- TREE_OPERAND ($<ttype>2, 1) = last_tree;
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- else
- TREE_OPERAND ($<ttype>2, 1) = $7;
- }
- else
- {
- emit_line_note (input_filename, lineno);
- if ($7) expand_exit_loop_if_false (0, $7);
- }
- }
- xexpr ')'
- /* Don't let the tree nodes for $10 be discarded
- by clear_momentary during the parsing of the next stmt. */
- {
- if (processing_template_decl)
- TREE_OPERAND ($<ttype>2, 2) = $10;
- push_momentary ();
- }
- already_scoped_stmt .poplevel
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 3) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- else
- {
- emit_line_note (input_filename, lineno);
- expand_loop_continue_here ();
- if ($10) cplus_expand_expr_stmt ($10);
- expand_end_loop ();
- }
- pop_momentary ();
- if (flag_new_for_scope > 0)
- {
- do_poplevel ();
- }
- finish_stmt (); }
- | SWITCH .pushlevel '(' condition ')'
- {
- if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (SWITCH_STMT, $4, NULL_TREE);
- add_tree ($<ttype>$);
- }
- else
- {
- emit_line_note (input_filename, lineno);
- c_expand_start_case ($4);
- }
- push_switch ();
- /* Don't let the tree nodes for $4 be discarded by
- clear_momentary during the parsing of the next stmt. */
- push_momentary ();
- }
- implicitly_scoped_stmt
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>6, 1) = TREE_CHAIN ($<ttype>6);
- TREE_CHAIN ($<ttype>6) = NULL_TREE;
- last_tree = $<ttype>6;
- }
- else
- expand_end_case ($4);
- pop_momentary ();
- pop_switch ();
- }
- .poplevel
- { finish_stmt (); }
- | CASE expr_no_commas ':'
- { do_case ($2, NULL_TREE); }
- stmt
- | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
- { do_case ($2, $4); }
- stmt
- | DEFAULT ':'
- { do_case (NULL_TREE, NULL_TREE); }
- stmt
- | BREAK ';'
- { emit_line_note (input_filename, lineno);
- if (processing_template_decl)
- add_tree (build_min_nt (BREAK_STMT));
- else if ( ! expand_exit_something ())
- error ("break statement not within loop or switch"); }
- | CONTINUE ';'
- { emit_line_note (input_filename, lineno);
- if (processing_template_decl)
- add_tree (build_min_nt (CONTINUE_STMT));
- else if (! expand_continue_loop (0))
- error ("continue statement not within a loop"); }
- | RETURN ';'
- { emit_line_note (input_filename, lineno);
- c_expand_return (NULL_TREE); }
- | RETURN expr ';'
- { emit_line_note (input_filename, lineno);
- c_expand_return ($2);
- finish_stmt ();
- }
- | asm_keyword maybe_cv_qualifier '(' string ')' ';'
- { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
- emit_line_note (input_filename, lineno);
- expand_asm ($4);
- finish_stmt ();
- }
- /* This is the case with just output operands. */
- | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
- { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
- emit_line_note (input_filename, lineno);
- c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
- $2 == ridpointers[(int)RID_VOLATILE],
- input_filename, lineno);
- finish_stmt ();
- }
- /* This is the case with input operands as well. */
- | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
- { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
- emit_line_note (input_filename, lineno);
- c_expand_asm_operands ($4, $6, $8, NULL_TREE,
- $2 == ridpointers[(int)RID_VOLATILE],
- input_filename, lineno);
- finish_stmt ();
- }
- /* This is the case with clobbered registers as well. */
- | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
- asm_operands ':' asm_clobbers ')' ';'
- { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
- emit_line_note (input_filename, lineno);
- c_expand_asm_operands ($4, $6, $8, $10,
- $2 == ridpointers[(int)RID_VOLATILE],
- input_filename, lineno);
- finish_stmt ();
- }
- | GOTO '*' expr ';'
- {
- if (processing_template_decl)
- add_tree (build_min_nt (GOTO_STMT, $3));
- else
- { emit_line_note (input_filename, lineno);
- expand_computed_goto ($3); }
- }
- | GOTO identifier ';'
- {
- if (processing_template_decl)
- add_tree (build_min_nt (GOTO_STMT, $2));
- else
- {
- tree decl;
- emit_line_note (input_filename, lineno);
- decl = lookup_label ($2);
- TREE_USED (decl) = 1;
- expand_goto (decl);
- }
- }
- | label_colon stmt
- { finish_stmt (); }
- | label_colon '}'
- { error ("label must be followed by statement");
- yyungetc ('}', 0);
- finish_stmt (); }
- | ';'
- { finish_stmt (); }
- | try_block
- ;
-
-function_try_block:
- TRY
- {
- if (! current_function_parms_stored)
- store_parm_decls ();
- expand_start_early_try_stmts ();
- }
- ctor_initializer_opt compstmt_or_error
- { expand_start_all_catch (); }
- handler_seq
- {
- int nested = (hack_decl_function_context
- (current_function_decl) != NULL_TREE);
- expand_end_all_catch ();
- finish_function (lineno, (int)$3, nested);
- }
- ;
-
-try_block:
- TRY
- {
- if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (TRY_BLOCK, NULL_TREE,
- NULL_TREE);
- add_tree ($<ttype>$);
- }
- else
- {
- emit_line_note (input_filename, lineno);
- expand_start_try_stmts ();
- }
- }
- compstmt
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- else
- expand_start_all_catch ();
- }
- handler_seq
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- else
- expand_end_all_catch ();
- }
- ;
-
-handler_seq:
- handler
- | handler_seq handler
- ;
-
-handler:
- CATCH
- {
- if (processing_template_decl)
- {
- $<ttype>$ = build_min_nt (HANDLER, NULL_TREE,
- NULL_TREE);
- add_tree ($<ttype>$);
- }
- }
- .pushlevel handler_args
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- }
- compstmt
- {
- if (processing_template_decl)
- {
- TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
- TREE_CHAIN ($<ttype>2) = NULL_TREE;
- last_tree = $<ttype>2;
- }
- else
- expand_end_catch_block ();
- }
- .poplevel
- ;
-
-type_specifier_seq:
- typed_typespecs %prec EMPTY
- | nonempty_cv_qualifiers %prec EMPTY
- ;
-
-handler_args:
- '(' ELLIPSIS ')'
- { expand_start_catch_block (NULL_TREE, NULL_TREE); }
- /* This doesn't allow reference parameters, the below does.
- | '(' type_specifier_seq absdcl ')'
- { check_for_new_type ("inside exception declarations", $2);
- expand_start_catch_block ($2.t, $3); }
- | '(' type_specifier_seq ')'
- { check_for_new_type ("inside exception declarations", $2);
- expand_start_catch_block ($2.t, NULL_TREE); }
- | '(' type_specifier_seq notype_declarator ')'
- { check_for_new_type ("inside exception declarations", $2);
- expand_start_catch_block ($2.t, $3); }
- | '(' typed_typespecs after_type_declarator ')'
- { check_for_new_type ("inside exception declarations", $2);
- expand_start_catch_block ($2.t, $3); }
- This allows reference parameters... */
- | '(' parm ')'
- { check_for_new_type ("inside exception declarations", $2);
- expand_start_catch_block (TREE_PURPOSE ($2.t),
- TREE_VALUE ($2.t)); }
- ;
-
-label_colon:
- IDENTIFIER ':'
- { tree label;
- do_label:
- label = define_label (input_filename, lineno, $1);
- if (label && ! minimal_parse_mode)
- expand_label (label);
- }
- | PTYPENAME ':'
- { goto do_label; }
- | TYPENAME ':'
- { goto do_label; }
- | SELFNAME ':'
- { goto do_label; }
- ;
-
-for.init.statement:
- xexpr ';'
- { if ($1) cplus_expand_expr_stmt ($1); }
- | decl
- | '{' compstmtend
- { if (pedantic)
- pedwarn ("ANSI C++ forbids compound statements inside for initializations");
- }
- ;
-
-/* Either a type-qualifier or nothing. First thing in an `asm' statement. */
-
-maybe_cv_qualifier:
- /* empty */
- { emit_line_note (input_filename, lineno);
- $$ = NULL_TREE; }
- | CV_QUALIFIER
- { emit_line_note (input_filename, lineno); }
- ;
-
-xexpr:
- /* empty */
- { $$ = NULL_TREE; }
- | expr
- | error
- { $$ = NULL_TREE; }
- ;
-
-/* These are the operands other than the first string and colon
- in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
-asm_operands:
- /* empty */
- { $$ = NULL_TREE; }
- | nonnull_asm_operands
- ;
-
-nonnull_asm_operands:
- asm_operand
- | nonnull_asm_operands ',' asm_operand
- { $$ = chainon ($$, $3); }
- ;
-
-asm_operand:
- STRING '(' expr ')'
- { $$ = build_tree_list ($$, $3); }
- ;
-
-asm_clobbers:
- STRING
- { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
- | asm_clobbers ',' STRING
- { $$ = tree_cons (NULL_TREE, $3, $$); }
- ;
-
-/* This is what appears inside the parens in a function declarator.
- Its value is represented in the format that grokdeclarator expects.
-
- In C++, declaring a function with no parameters
- means that that function takes *no* parameters. */
-
-parmlist:
- /* empty */
- {
- $$ = empty_parms();
- }
- | complex_parmlist
- | type_id
- { $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
- TREE_PARMLIST ($$) = 1;
- check_for_new_type ("inside parameter list", $1); }
- ;
-
-/* This nonterminal does not include the common sequence '(' type_id ')',
- as it is ambiguous and must be disambiguated elsewhere. */
-complex_parmlist:
- parms
- {
- $$ = chainon ($$, void_list_node);
- TREE_PARMLIST ($$) = 1;
- }
- | parms_comma ELLIPSIS
- {
- TREE_PARMLIST ($$) = 1;
- }
- /* C++ allows an ellipsis without a separating ',' */
- | parms ELLIPSIS
- {
- TREE_PARMLIST ($$) = 1;
- }
- | type_id ELLIPSIS
- {
- $$ = build_tree_list (NULL_TREE, $1.t);
- TREE_PARMLIST ($$) = 1;
- }
- | ELLIPSIS
- {
- $$ = NULL_TREE;
- }
- | TYPENAME_ELLIPSIS
- {
- TREE_PARMLIST ($$) = 1;
- }
- | parms TYPENAME_ELLIPSIS
- {
- TREE_PARMLIST ($$) = 1;
- }
- | type_id TYPENAME_ELLIPSIS
- {
- $$ = build_tree_list (NULL_TREE, $1.t);
- TREE_PARMLIST ($$) = 1;
- }
- | parms ':'
- {
- /* This helps us recover from really nasty
- parse errors, for example, a missing right
- parenthesis. */
- yyerror ("possibly missing ')'");
- $$ = chainon ($$, void_list_node);
- TREE_PARMLIST ($$) = 1;
- yyungetc (':', 0);
- yychar = ')';
- }
- | type_id ':'
- {
- /* This helps us recover from really nasty
- parse errors, for example, a missing right
- parenthesis. */
- yyerror ("possibly missing ')'");
- $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
- TREE_PARMLIST ($$) = 1;
- yyungetc (':', 0);
- yychar = ')';
- }
- ;
-
-/* A nonempty list of parameter declarations or type names. */
-parms:
- named_parm
- { check_for_new_type ("in a parameter list", $1);
- $$ = build_tree_list (NULL_TREE, $1.t); }
- | parm '=' init
- { check_for_new_type ("in a parameter list", $1);
- $$ = build_tree_list ($3, $1.t); }
- | parms_comma full_parm
- { check_for_new_type ("in a parameter list", $2);
- $$ = chainon ($$, $2.t); }
- | parms_comma bad_parm
- { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
- | parms_comma bad_parm '=' init
- { $$ = chainon ($$, build_tree_list ($4, $2)); }
- ;
-
-parms_comma:
- parms ','
- | type_id ','
- { check_for_new_type ("in a parameter list", $1);
- $$ = build_tree_list (NULL_TREE, $1.t); }
- ;
-
-/* A single parameter declaration or parameter type name,
- as found in a parmlist. */
-named_parm:
- /* Here we expand typed_declspecs inline to avoid mis-parsing of
- TYPESPEC IDENTIFIER. */
- typed_declspecs1 declarator
- { tree specs = strip_attrs ($1.t);
- $$.new_type_flag = $1.new_type_flag;
- $$.t = build_tree_list (specs, $2); }
- | typed_typespecs declarator
- { $$.t = build_tree_list ($1.t, $2);
- $$.new_type_flag = $1.new_type_flag; }
- | typespec declarator
- { $$.t = build_tree_list (get_decl_list ($1.t), $2);
- $$.new_type_flag = $1.new_type_flag; }
- | typed_declspecs1 absdcl
- { tree specs = strip_attrs ($1.t);
- $$.t = build_tree_list (specs, $2);
- $$.new_type_flag = $1.new_type_flag; }
- | typed_declspecs1 %prec EMPTY
- { tree specs = strip_attrs ($1.t);
- $$.t = build_tree_list (specs, NULL_TREE);
- $$.new_type_flag = $1.new_type_flag; }
- | declmods notype_declarator
- { tree specs = strip_attrs ($1);
- $$.t = build_tree_list (specs, $2);
- $$.new_type_flag = 0; }
- ;
-
-full_parm:
- parm maybe_init
- { $$.t = build_tree_list ($2, $1.t);
- $$.new_type_flag = $1.new_type_flag; }
- ;
-
-parm:
- named_parm
- | type_id
- ;
-
-see_typename:
- /* empty */ %prec EMPTY
- { see_typename (); }
- ;
-
-bad_parm:
- /* empty */ %prec EMPTY
- {
- error ("type specifier omitted for parameter");
- $$ = build_tree_list (integer_type_node, NULL_TREE);
- }
- | notype_declarator
- {
- error ("type specifier omitted for parameter");
- if (TREE_CODE ($$) == SCOPE_REF
- && TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM)
- cp_error (" perhaps you want `typename %E' to make it a type", $$);
- $$ = build_tree_list (integer_type_node, $$);
- }
- ;
-
-exception_specification_opt:
- /* empty */ %prec EMPTY
- { $$ = NULL_TREE; }
- | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
- { $$ = $3; }
- | THROW LEFT_RIGHT %prec EMPTY
- { $$ = build_decl_list (NULL_TREE, NULL_TREE); }
- ;
-
-ansi_raise_identifier:
- type_id
- { $$ = build_decl_list (NULL_TREE, groktypename($1.t)); }
- ;
-
-ansi_raise_identifiers:
- ansi_raise_identifier
- | ansi_raise_identifiers ',' ansi_raise_identifier
- {
- TREE_CHAIN ($3) = $$;
- $$ = $3;
- }
- ;
-
-conversion_declarator:
- /* empty */ %prec EMPTY
- { $$ = NULL_TREE; }
- | '*' cv_qualifiers conversion_declarator
- { $$ = make_pointer_declarator ($2, $3); }
- | '&' cv_qualifiers conversion_declarator
- { $$ = make_reference_declarator ($2, $3); }
- | ptr_to_mem cv_qualifiers conversion_declarator
- { tree arg = make_pointer_declarator ($2, $3);
- $$ = build_parse_node (SCOPE_REF, $1, arg);
- }
- ;
-
-operator:
- OPERATOR
- { got_scope = NULL_TREE; }
- ;
-
-operator_name:
- operator '*'
- { $$ = ansi_opname[MULT_EXPR]; }
- | operator '/'
- { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
- | operator '%'
- { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
- | operator '+'
- { $$ = ansi_opname[PLUS_EXPR]; }
- | operator '-'
- { $$ = ansi_opname[MINUS_EXPR]; }
- | operator '&'
- { $$ = ansi_opname[BIT_AND_EXPR]; }
- | operator '|'
- { $$ = ansi_opname[BIT_IOR_EXPR]; }
- | operator '^'
- { $$ = ansi_opname[BIT_XOR_EXPR]; }
- | operator '~'
- { $$ = ansi_opname[BIT_NOT_EXPR]; }
- | operator ','
- { $$ = ansi_opname[COMPOUND_EXPR]; }
- | operator ARITHCOMPARE
- { $$ = ansi_opname[$2]; }
- | operator '<'
- { $$ = ansi_opname[LT_EXPR]; }
- | operator '>'
- { $$ = ansi_opname[GT_EXPR]; }
- | operator EQCOMPARE
- { $$ = ansi_opname[$2]; }
- | operator ASSIGN
- { $$ = ansi_assopname[$2]; }
- | operator '='
- { $$ = ansi_opname [MODIFY_EXPR]; }
- | operator LSHIFT
- { $$ = ansi_opname[$2]; }
- | operator RSHIFT
- { $$ = ansi_opname[$2]; }
- | operator PLUSPLUS
- { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
- | operator MINUSMINUS
- { $$ = ansi_opname[PREDECREMENT_EXPR]; }
- | operator ANDAND
- { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
- | operator OROR
- { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
- | operator '!'
- { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
- | operator '?' ':'
- { $$ = ansi_opname[COND_EXPR]; }
- | operator MIN_MAX
- { $$ = ansi_opname[$2]; }
- | operator POINTSAT %prec EMPTY
- { $$ = ansi_opname[COMPONENT_REF]; }
- | operator POINTSAT_STAR %prec EMPTY
- { $$ = ansi_opname[MEMBER_REF]; }
- | operator LEFT_RIGHT
- { $$ = ansi_opname[CALL_EXPR]; }
- | operator '[' ']'
- { $$ = ansi_opname[ARRAY_REF]; }
- | operator NEW %prec EMPTY
- { $$ = ansi_opname[NEW_EXPR]; }
- | operator DELETE %prec EMPTY
- { $$ = ansi_opname[DELETE_EXPR]; }
- | operator NEW '[' ']'
- { $$ = ansi_opname[VEC_NEW_EXPR]; }
- | operator DELETE '[' ']'
- { $$ = ansi_opname[VEC_DELETE_EXPR]; }
- /* Names here should be looked up in class scope ALSO. */
- | operator type_specifier_seq conversion_declarator
- { $$ = grokoptypename ($2.t, $3); }
- | operator error
- { $$ = ansi_opname[ERROR_MARK]; }
- ;
-
-%%
-
-#ifdef SPEW_DEBUG
-const char *
-debug_yytranslate (value)
- int value;
-{
- return yytname[YYTRANSLATE (value)];
-}
-
-#endif
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
deleted file mode 100644
index d0a6c7644ef..00000000000
--- a/gcc/cp/pt.c
+++ /dev/null
@@ -1,3577 +0,0 @@
-/* Handle parameterized types (templates) for GNU C++.
- Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
- Rewritten by Jason Merrill (jason@cygnus.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. */
-
-/* Known bugs or deficiencies include:
-
- templates for class static data don't work (methods only),
- duplicated method templates can crash the compiler,
- interface/impl data is taken from file defining the template,
- all methods must be provided in header files; can't use a source
- file that contains only the method templates and "just win". */
-
-#include "config.h"
-#include <stdio.h>
-#include "obstack.h"
-
-#include "tree.h"
-#include "flags.h"
-#include "cp-tree.h"
-#include "decl.h"
-#include "parse.h"
-#include "lex.h"
-#include "output.h"
-#include "defaults.h"
-
-extern struct obstack permanent_obstack;
-
-extern int lineno;
-extern char *input_filename;
-struct pending_inline *pending_template_expansions;
-
-tree current_template_parms;
-HOST_WIDE_INT processing_template_decl;
-
-tree pending_templates;
-static tree *template_tail = &pending_templates;
-
-tree maybe_templates;
-static tree *maybe_template_tail = &maybe_templates;
-
-int minimal_parse_mode;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-static int unify ();
-
-void pop_template_decls ();
-
-static tree classtype_mangled_name ();
-static char * mangle_class_name_for_template ();
-static tree tsubst_expr_values ();
-static int comp_template_args PROTO((tree, tree));
-tree most_specialized_class PROTO((tree, tree));
-static tree get_class_bindings PROTO((tree, tree, tree));
-tree make_temp_vec PROTO((int));
-
-/* We've got a template header coming up; push to a new level for storing
- the parms. */
-
-void
-begin_template_parm_list ()
-{
- pushlevel (0);
- declare_pseudo_global_level ();
- ++processing_template_decl;
-}
-
-/* Process information from new template parameter NEXT and append it to the
- LIST being built. */
-
-tree
-process_template_parm (list, next)
- tree list, next;
-{
- tree parm;
- tree decl = 0;
- tree defval;
- int is_type, idx;
- parm = next;
- my_friendly_assert (TREE_CODE (parm) == TREE_LIST, 259);
- defval = TREE_PURPOSE (parm);
- parm = TREE_VALUE (parm);
- is_type = TREE_PURPOSE (parm) == class_type_node;
-
- if (list)
- {
- tree p = TREE_VALUE (tree_last (list));
-
- if (TREE_CODE (p) == TYPE_DECL)
- idx = TEMPLATE_TYPE_IDX (TREE_TYPE (p));
- else
- idx = TEMPLATE_CONST_IDX (DECL_INITIAL (p));
- ++idx;
- }
- else
- idx = 0;
-
- if (!is_type)
- {
- tree tinfo = 0;
- my_friendly_assert (TREE_CODE (TREE_PURPOSE (parm)) == TREE_LIST, 260);
- /* is a const-param */
- parm = grokdeclarator (TREE_VALUE (parm), TREE_PURPOSE (parm),
- PARM, 0, NULL_TREE);
- /* A template parameter is not modifiable. */
- TREE_READONLY (parm) = 1;
- if (IS_AGGR_TYPE (TREE_TYPE (parm))
- && TREE_CODE (TREE_TYPE (parm)) != TEMPLATE_TYPE_PARM)
- {
- cp_error ("`%#T' is not a valid type for a template constant parameter",
- TREE_TYPE (parm));
- if (DECL_NAME (parm) == NULL_TREE)
- error (" a template type parameter must begin with `class' or `typename'");
- TREE_TYPE (parm) = void_type_node;
- }
- tinfo = make_node (TEMPLATE_CONST_PARM);
- my_friendly_assert (TREE_PERMANENT (tinfo), 260.5);
- if (TREE_PERMANENT (parm) == 0)
- {
- parm = copy_node (parm);
- TREE_PERMANENT (parm) = 1;
- }
- TREE_TYPE (tinfo) = TREE_TYPE (parm);
- decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm));
- DECL_INITIAL (decl) = tinfo;
- DECL_INITIAL (parm) = tinfo;
- TEMPLATE_CONST_SET_INFO (tinfo, idx, processing_template_decl);
- }
- else
- {
- tree t = make_lang_type (TEMPLATE_TYPE_PARM);
- CLASSTYPE_GOT_SEMICOLON (t) = 1;
- decl = build_decl (TYPE_DECL, TREE_VALUE (parm), t);
- TYPE_NAME (t) = decl;
- TYPE_STUB_DECL (t) = decl;
- parm = decl;
- TEMPLATE_TYPE_SET_INFO (t, idx, processing_template_decl);
- }
- SET_DECL_ARTIFICIAL (decl);
- pushdecl (decl);
- parm = build_tree_list (defval, parm);
- return chainon (list, parm);
-}
-
-/* The end of a template parameter list has been reached. Process the
- tree list into a parameter vector, converting each parameter into a more
- useful form. Type parameters are saved as IDENTIFIER_NODEs, and others
- as PARM_DECLs. */
-
-tree
-end_template_parm_list (parms)
- tree parms;
-{
- int nparms;
- tree parm;
- tree saved_parmlist = make_tree_vec (list_length (parms));
-
- current_template_parms
- = tree_cons (build_int_2 (0, processing_template_decl),
- saved_parmlist, current_template_parms);
-
- for (parm = parms, nparms = 0; parm; parm = TREE_CHAIN (parm), nparms++)
- TREE_VEC_ELT (saved_parmlist, nparms) = parm;
-
- return saved_parmlist;
-}
-
-/* end_template_decl is called after a template declaration is seen. */
-
-void
-end_template_decl ()
-{
- if (! processing_template_decl)
- return;
-
- /* This matches the pushlevel in begin_template_parm_list. */
- poplevel (0, 0, 0);
-
- --processing_template_decl;
- current_template_parms = TREE_CHAIN (current_template_parms);
- (void) get_pending_sizes (); /* Why? */
-}
-
-/* Generate a valid set of template args from current_template_parms. */
-
-tree
-current_template_args ()
-{
- tree header = current_template_parms;
- tree args = NULL_TREE;
- while (header)
- {
- tree a = copy_node (TREE_VALUE (header));
- int i = TREE_VEC_LENGTH (a);
- TREE_TYPE (a) = NULL_TREE;
- while (i--)
- {
- tree t = TREE_VALUE (TREE_VEC_ELT (a, i));
- if (TREE_CODE (t) == TYPE_DECL)
- t = TREE_TYPE (t);
- else
- t = DECL_INITIAL (t);
- TREE_VEC_ELT (a, i) = t;
- }
- args = tree_cons (TREE_PURPOSE (header), a, args);
- header = TREE_CHAIN (header);
- }
- args = nreverse (args);
-
- /* FIXME Remove this when we support member templates. */
- args = TREE_VALUE (args);
-
- return args;
-}
-
-void
-push_template_decl (decl)
- tree decl;
-{
- tree tmpl;
- tree args = NULL_TREE;
- tree info;
- tree ctx = DECL_CONTEXT (decl) ? DECL_CONTEXT (decl) : current_class_type;
- int primary = 0;
-
- /* Kludge! */
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_FRIEND_P (decl)
- && DECL_CLASS_CONTEXT (decl))
- ;
- /* Note that this template is a "primary template" */
- else if (! ctx || ! CLASSTYPE_TEMPLATE_INFO (ctx)
- /* || (processing_template_decl > CLASSTYPE_TEMPLATE_LEVEL (ctx)) */)
- primary = 1;
-
- /* Partial specialization. */
- if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl)
- && CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl)))
- {
- tree type = TREE_TYPE (decl);
- tree maintmpl = CLASSTYPE_TI_TEMPLATE (type);
- tree mainargs = CLASSTYPE_TI_ARGS (type);
- tree spec = DECL_TEMPLATE_SPECIALIZATIONS (maintmpl);
-
- for (; spec; spec = TREE_CHAIN (spec))
- {
- /* purpose: args to main template
- value: spec template */
- if (comp_template_args (TREE_PURPOSE (spec), mainargs))
- return;
- }
-
- DECL_TEMPLATE_SPECIALIZATIONS (maintmpl) = perm_tree_cons
- (mainargs, TREE_VALUE (current_template_parms),
- DECL_TEMPLATE_SPECIALIZATIONS (maintmpl));
- TREE_TYPE (DECL_TEMPLATE_SPECIALIZATIONS (maintmpl)) = type;
- return;
- }
-
- args = current_template_args ();
-
- if (! ctx || TYPE_BEING_DEFINED (ctx))
- {
- tmpl = build_lang_decl (TEMPLATE_DECL, DECL_NAME (decl), NULL_TREE);
- DECL_TEMPLATE_PARMS (tmpl) = TREE_VALUE (current_template_parms);
- DECL_CONTEXT (tmpl) = DECL_CONTEXT (decl);
- }
- else
- {
- if (CLASSTYPE_TEMPLATE_INSTANTIATION (ctx))
- cp_error ("must specialize `%#T' before defining member `%#D'",
- ctx, decl);
- if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl))
- tmpl = CLASSTYPE_TI_TEMPLATE (TREE_TYPE (decl));
- else if (! DECL_TEMPLATE_INFO (decl))
- {
- cp_error ("template definition of non-template `%#D'", decl);
- return;
- }
- else
- tmpl = DECL_TI_TEMPLATE (decl);
- }
-
- DECL_TEMPLATE_RESULT (tmpl) = decl;
- TREE_TYPE (tmpl) = TREE_TYPE (decl);
-
- if (! ctx)
- tmpl = pushdecl_top_level (tmpl);
-
- if (primary)
- TREE_TYPE (DECL_TEMPLATE_PARMS (tmpl)) = tmpl;
-
- info = perm_tree_cons (tmpl, args, NULL_TREE);
-
- if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl))
- {
- CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (tmpl)) = info;
- DECL_NAME (decl) = classtype_mangled_name (TREE_TYPE (decl));
- }
- else if (! DECL_LANG_SPECIFIC (decl))
- cp_error ("template declaration of `%#D'", decl);
- else
- DECL_TEMPLATE_INFO (decl) = info;
-}
-
-tree tsubst PROTO ((tree, tree*, int, tree));
-
-/* Convert all template arguments to their appropriate types, and return
- a vector containing the resulting values. If any error occurs, return
- error_mark_node. */
-
-static tree
-coerce_template_parms (parms, arglist, in_decl)
- tree parms, arglist;
- tree in_decl;
-{
- int nparms, nargs, i, lost = 0;
- tree vec;
-
- if (arglist == NULL_TREE)
- nargs = 0;
- else if (TREE_CODE (arglist) == TREE_VEC)
- nargs = TREE_VEC_LENGTH (arglist);
- else
- nargs = list_length (arglist);
-
- nparms = TREE_VEC_LENGTH (parms);
-
- if (nargs > nparms
- || (nargs < nparms
- && TREE_PURPOSE (TREE_VEC_ELT (parms, nargs)) == NULL_TREE))
- {
- error ("incorrect number of parameters (%d, should be %d)",
- nargs, nparms);
- if (in_decl)
- cp_error_at ("in template expansion for decl `%D'", in_decl);
- return error_mark_node;
- }
-
- if (arglist && TREE_CODE (arglist) == TREE_VEC)
- vec = copy_node (arglist);
- else
- {
- vec = make_tree_vec (nparms);
- for (i = 0; i < nparms; i++)
- {
- tree arg;
-
- if (arglist)
- {
- arg = arglist;
- arglist = TREE_CHAIN (arglist);
-
- if (arg == error_mark_node)
- lost++;
- else
- arg = TREE_VALUE (arg);
- }
- else if (TREE_CODE (TREE_VALUE (TREE_VEC_ELT (parms, i)))
- == TYPE_DECL)
- arg = tsubst (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
- &TREE_VEC_ELT (vec, 0), i, in_decl);
- else
- arg = tsubst_expr (TREE_PURPOSE (TREE_VEC_ELT (parms, i)),
- &TREE_VEC_ELT (vec, 0), i, in_decl);
-
- TREE_VEC_ELT (vec, i) = arg;
- }
- }
- for (i = 0; i < nparms; i++)
- {
- tree arg = TREE_VEC_ELT (vec, i);
- tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
- tree val = 0;
- int is_type, requires_type;
-
- is_type = TREE_CODE_CLASS (TREE_CODE (arg)) == 't';
- requires_type = TREE_CODE (parm) == TYPE_DECL;
-
- if (requires_type && ! is_type && TREE_CODE (arg) == SCOPE_REF
- && TREE_CODE (TREE_OPERAND (arg, 0)) == TEMPLATE_TYPE_PARM)
- {
- cp_pedwarn ("to refer to a type member of a template parameter,");
- cp_pedwarn (" use `typename %E'", arg);
- arg = make_typename_type (TREE_OPERAND (arg, 0),
- TREE_OPERAND (arg, 1));
- is_type = 1;
- }
- if (is_type != requires_type)
- {
- if (in_decl)
- {
- cp_error ("type/value mismatch at argument %d in template parameter list for `%D'",
- i, in_decl);
- if (is_type)
- cp_error (" expected a constant of type `%T', got `%T'",
- TREE_TYPE (parm), arg);
- else
- cp_error (" expected a type, got `%E'", arg);
- }
- lost++;
- TREE_VEC_ELT (vec, i) = error_mark_node;
- continue;
- }
- if (is_type)
- {
- val = groktypename (arg);
- if (! processing_template_decl)
- {
- tree t = target_type (val);
- if (IS_AGGR_TYPE (t)
- && decl_function_context (TYPE_MAIN_DECL (t)))
- {
- cp_error ("type `%T' composed from a local class is not a valid template-argument", val);
- return error_mark_node;
- }
- }
- }
- else
- {
- tree t = tsubst (TREE_TYPE (parm), &TREE_VEC_ELT (vec, 0),
- TREE_VEC_LENGTH (vec), in_decl);
- if (processing_template_decl)
- val = arg;
- else
- val = digest_init (t, arg, (tree *) 0);
-
- if (val == error_mark_node || processing_template_decl)
- ;
-
- /* 14.2: Other template-arguments must be constant-expressions,
- addresses of objects or functions with external linkage, or of
- static class members. */
- else if (IS_AGGR_TYPE (TREE_TYPE (val)))
- {
- cp_error ("object `%E' cannot be used as template argument", arg);
- val = error_mark_node;
- }
- else if (!TREE_CONSTANT (val))
- {
- cp_error ("non-const `%E' cannot be used as template argument",
- arg);
- val = error_mark_node;
- }
- else if (POINTER_TYPE_P (TREE_TYPE (val))
- && ! integer_zerop (val)
- && TREE_CODE (TREE_TYPE (TREE_TYPE (val))) != OFFSET_TYPE
- && TREE_CODE (TREE_TYPE (TREE_TYPE (val))) != METHOD_TYPE)
- {
- t = val;
- STRIP_NOPS (t);
- if (TREE_CODE (t) == ADDR_EXPR)
- {
- tree a = TREE_OPERAND (t, 0);
- STRIP_NOPS (a);
- if (TREE_CODE (a) == STRING_CST)
- {
- cp_error ("string literal %E is not a valid template argument", a);
- error ("because it is the address of an object with static linkage");
- val = error_mark_node;
- }
- else if (TREE_CODE (a) != VAR_DECL
- && TREE_CODE (a) != FUNCTION_DECL)
- goto bad;
- else if (! DECL_PUBLIC (a))
- {
- cp_error ("address of non-extern `%E' cannot be used as template argument", a);
- val = error_mark_node;
- }
- }
- else
- {
- bad:
- cp_error ("`%E' is not a valid template argument", t);
- error ("it must be %s%s with external linkage",
- TREE_CODE (TREE_TYPE (val)) == POINTER_TYPE
- ? "a pointer to " : "",
- TREE_CODE (TREE_TYPE (TREE_TYPE (val))) == FUNCTION_TYPE
- ? "a function" : "an object");
- val = error_mark_node;
- }
- }
- }
-
- if (val == error_mark_node)
- lost++;
-
- TREE_VEC_ELT (vec, i) = val;
- }
- if (lost)
- return error_mark_node;
- return vec;
-}
-
-static int
-comp_template_args (oldargs, newargs)
- tree oldargs, newargs;
-{
- int i;
-
- for (i = 0; i < TREE_VEC_LENGTH (oldargs); ++i)
- {
- tree nt = TREE_VEC_ELT (newargs, i);
- tree ot = TREE_VEC_ELT (oldargs, i);
-
- if (nt == ot)
- continue;
- if (TREE_CODE (nt) != TREE_CODE (ot))
- return 0;
- if (TREE_CODE_CLASS (TREE_CODE (ot)) == 't')
- {
- if (comptypes (ot, nt, 1))
- continue;
- }
- else if (cp_tree_equal (ot, nt) > 0)
- continue;
- return 0;
- }
- return 1;
-}
-
-/* Given class template name and parameter list, produce a user-friendly name
- for the instantiation. */
-
-static char *
-mangle_class_name_for_template (name, parms, arglist)
- char *name;
- tree parms, arglist;
-{
- static struct obstack scratch_obstack;
- static char *scratch_firstobj;
- int i, nparms;
-
- if (!scratch_firstobj)
- gcc_obstack_init (&scratch_obstack);
- else
- obstack_free (&scratch_obstack, scratch_firstobj);
- scratch_firstobj = obstack_alloc (&scratch_obstack, 1);
-
-#if 0
-#define buflen sizeof(buf)
-#define check if (bufp >= buf+buflen-1) goto too_long
-#define ccat(c) *bufp++=(c); check
-#define advance bufp+=strlen(bufp); check
-#define cat(s) strncpy(bufp, s, buf+buflen-bufp-1); advance
-#else
-#define check
-#define ccat(c) obstack_1grow (&scratch_obstack, (c));
-#define advance
-#define cat(s) obstack_grow (&scratch_obstack, (s), strlen (s))
-#endif
-
- cat (name);
- ccat ('<');
- nparms = TREE_VEC_LENGTH (parms);
- my_friendly_assert (nparms == TREE_VEC_LENGTH (arglist), 268);
- for (i = 0; i < nparms; i++)
- {
- tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
- tree arg = TREE_VEC_ELT (arglist, i);
-
- if (i)
- ccat (',');
-
- if (TREE_CODE (parm) == TYPE_DECL)
- {
- cat (type_as_string (arg, 0));
- continue;
- }
- else
- my_friendly_assert (TREE_CODE (parm) == PARM_DECL, 269);
-
- if (TREE_CODE (arg) == TREE_LIST)
- {
- /* New list cell was built because old chain link was in
- use. */
- my_friendly_assert (TREE_PURPOSE (arg) == NULL_TREE, 270);
- arg = TREE_VALUE (arg);
- }
- /* No need to check arglist against parmlist here; we did that
- in coerce_template_parms, called from lookup_template_class. */
- cat (expr_as_string (arg, 0));
- }
- {
- char *bufp = obstack_next_free (&scratch_obstack);
- int offset = 0;
- while (bufp[offset - 1] == ' ')
- offset--;
- obstack_blank_fast (&scratch_obstack, offset);
-
- /* B<C<char> >, not B<C<char>> */
- if (bufp[offset - 1] == '>')
- ccat (' ');
- }
- ccat ('>');
- ccat ('\0');
- return (char *) obstack_base (&scratch_obstack);
-
-#if 0
- too_long:
-#endif
- fatal ("out of (preallocated) string space creating template instantiation name");
- /* NOTREACHED */
- return NULL;
-}
-
-static tree
-classtype_mangled_name (t)
- tree t;
-{
- if (CLASSTYPE_TEMPLATE_INFO (t)
- && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)))
- {
- tree name = DECL_NAME (CLASSTYPE_TI_TEMPLATE (t));
- char *mangled_name = mangle_class_name_for_template
- (IDENTIFIER_POINTER (name),
- DECL_TEMPLATE_PARMS (CLASSTYPE_TI_TEMPLATE (t)),
- CLASSTYPE_TI_ARGS (t));
- tree id = get_identifier (mangled_name);
- IDENTIFIER_TEMPLATE (id) = name;
- return id;
- }
- else
- return TYPE_IDENTIFIER (t);
-}
-
-static void
-add_pending_template (d)
- tree d;
-{
- tree ti;
-
- if (TREE_CODE_CLASS (TREE_CODE (d)) == 't')
- ti = CLASSTYPE_TEMPLATE_INFO (d);
- else
- ti = DECL_TEMPLATE_INFO (d);
-
- if (TI_PENDING_TEMPLATE_FLAG (ti))
- return;
-
- *template_tail = perm_tree_cons
- (current_function_decl, d, NULL_TREE);
- template_tail = &TREE_CHAIN (*template_tail);
- TI_PENDING_TEMPLATE_FLAG (ti) = 1;
-}
-
-/* Given an IDENTIFIER_NODE (type TEMPLATE_DECL) and a chain of
- parameters, find the desired type.
-
- D1 is the PTYPENAME terminal, and ARGLIST is the list of arguments.
- Since ARGLIST is build on the decl_obstack, we must copy it here
- to keep it from being reclaimed when the decl storage is reclaimed.
-
- IN_DECL, if non-NULL, is the template declaration we are trying to
- instantiate. */
-
-tree
-lookup_template_class (d1, arglist, in_decl)
- tree d1, arglist;
- tree in_decl;
-{
- tree template, parmlist;
- char *mangled_name;
- tree id, t;
-
- if (TREE_CODE (d1) == IDENTIFIER_NODE)
- {
- template = IDENTIFIER_GLOBAL_VALUE (d1); /* XXX */
- if (! template)
- template = IDENTIFIER_CLASS_VALUE (d1);
- }
- else if (TREE_CODE (d1) == TYPE_DECL && IS_AGGR_TYPE (TREE_TYPE (d1)))
- {
- template = CLASSTYPE_TI_TEMPLATE (TREE_TYPE (d1));
- d1 = DECL_NAME (template);
- }
- else if (TREE_CODE_CLASS (TREE_CODE (d1)) == 't' && IS_AGGR_TYPE (d1))
- {
- template = CLASSTYPE_TI_TEMPLATE (d1);
- d1 = DECL_NAME (template);
- }
- else
- my_friendly_abort (272);
-
- /* With something like `template <class T> class X class X { ... };'
- we could end up with D1 having nothing but an IDENTIFIER_LOCAL_VALUE.
- We don't want to do that, but we have to deal with the situation, so
- let's give them some syntax errors to chew on instead of a crash. */
- if (! template)
- return error_mark_node;
- if (TREE_CODE (template) != TEMPLATE_DECL)
- {
- cp_error ("non-template type `%T' used as a template", d1);
- if (in_decl)
- cp_error_at ("for template declaration `%D'", in_decl);
- return error_mark_node;
- }
-
- if (PRIMARY_TEMPLATE_P (template))
- {
- parmlist = DECL_TEMPLATE_PARMS (template);
-
- arglist = coerce_template_parms (parmlist, arglist, template);
- if (arglist == error_mark_node)
- return error_mark_node;
- if (uses_template_parms (arglist))
- {
- tree found;
- if (comp_template_args
- (CLASSTYPE_TI_ARGS (TREE_TYPE (template)), arglist))
- found = TREE_TYPE (template);
- else
- {
- for (found = DECL_TEMPLATE_INSTANTIATIONS (template);
- found; found = TREE_CHAIN (found))
- {
- if (TI_USES_TEMPLATE_PARMS (found)
- && comp_template_args (TREE_PURPOSE (found), arglist))
- break;
- }
- if (found)
- found = TREE_VALUE (found);
- }
-
- if (found)
- {
- if (can_free (&permanent_obstack, arglist))
- obstack_free (&permanent_obstack, arglist);
- return found;
- }
- }
-
- mangled_name = mangle_class_name_for_template (IDENTIFIER_POINTER (d1),
- parmlist, arglist);
- id = get_identifier (mangled_name);
- IDENTIFIER_TEMPLATE (id) = d1;
-
- maybe_push_to_top_level (uses_template_parms (arglist));
- t = xref_tag_from_type (TREE_TYPE (template), id, 1);
- pop_from_top_level ();
- }
- else
- {
- tree ctx = lookup_template_class (TYPE_CONTEXT (TREE_TYPE (template)),
- arglist, in_decl);
- id = d1;
- arglist = CLASSTYPE_TI_ARGS (ctx);
-
- if (TYPE_BEING_DEFINED (ctx) && ctx == current_class_type)
- {
- int save_temp = processing_template_decl;
- processing_template_decl = 0;
- t = xref_tag_from_type (TREE_TYPE (template), id, 0);
- processing_template_decl = save_temp;
- }
- else
- {
- t = lookup_nested_type_by_name (ctx, id);
- my_friendly_assert (t != NULL_TREE, 42);
- }
- }
-
- /* Seems to be wanted. */
- CLASSTYPE_GOT_SEMICOLON (t) = 1;
-
- if (! CLASSTYPE_TEMPLATE_INFO (t))
- {
- arglist = copy_to_permanent (arglist);
- CLASSTYPE_TEMPLATE_INFO (t)
- = perm_tree_cons (template, arglist, NULL_TREE);
- DECL_TEMPLATE_INSTANTIATIONS (template) = perm_tree_cons
- (arglist, t, DECL_TEMPLATE_INSTANTIATIONS (template));
- TI_USES_TEMPLATE_PARMS (DECL_TEMPLATE_INSTANTIATIONS (template))
- = uses_template_parms (arglist);
-
- SET_CLASSTYPE_IMPLICIT_INSTANTIATION (t);
-
- /* We need to set this again after CLASSTYPE_TEMPLATE_INFO is set up. */
- DECL_ASSEMBLER_NAME (TYPE_MAIN_DECL (t)) = id;
- if (! uses_template_parms (arglist))
- DECL_ASSEMBLER_NAME (TYPE_MAIN_DECL (t))
- = get_identifier (build_overload_name (t, 1, 1));
-
- if (flag_external_templates && ! uses_template_parms (arglist)
- && CLASSTYPE_INTERFACE_KNOWN (TREE_TYPE (template))
- && ! CLASSTYPE_INTERFACE_ONLY (TREE_TYPE (template)))
- add_pending_template (t);
- }
-
- return t;
-}
-
-/* Should be defined in parse.h. */
-extern int yychar;
-
-int
-uses_template_parms (t)
- tree t;
-{
- if (!t)
- return 0;
- switch (TREE_CODE (t))
- {
- case INDIRECT_REF:
- case COMPONENT_REF:
- /* We assume that the object must be instantiated in order to build
- the COMPONENT_REF, so we test only whether the type of the
- COMPONENT_REF uses template parms. */
- return uses_template_parms (TREE_TYPE (t));
-
- case IDENTIFIER_NODE:
- if (!IDENTIFIER_TEMPLATE (t))
- return 0;
- my_friendly_abort (42);
-
- /* aggregates of tree nodes */
- case TREE_VEC:
- {
- int i = TREE_VEC_LENGTH (t);
- while (i--)
- if (uses_template_parms (TREE_VEC_ELT (t, i)))
- return 1;
- return 0;
- }
- case TREE_LIST:
- if (uses_template_parms (TREE_PURPOSE (t))
- || uses_template_parms (TREE_VALUE (t)))
- return 1;
- return uses_template_parms (TREE_CHAIN (t));
-
- /* constructed type nodes */
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- return uses_template_parms (TREE_TYPE (t));
- case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_FLAG (t))
- return uses_template_parms (TYPE_PTRMEMFUNC_FN_TYPE (t));
- case UNION_TYPE:
- if (! CLASSTYPE_TEMPLATE_INFO (t))
- return 0;
- return uses_template_parms (TREE_VALUE (CLASSTYPE_TEMPLATE_INFO (t)));
- case FUNCTION_TYPE:
- if (uses_template_parms (TYPE_ARG_TYPES (t)))
- return 1;
- return uses_template_parms (TREE_TYPE (t));
- case ARRAY_TYPE:
- if (uses_template_parms (TYPE_DOMAIN (t)))
- return 1;
- return uses_template_parms (TREE_TYPE (t));
- case OFFSET_TYPE:
- if (uses_template_parms (TYPE_OFFSET_BASETYPE (t)))
- return 1;
- return uses_template_parms (TREE_TYPE (t));
- case METHOD_TYPE:
- if (uses_template_parms (TYPE_METHOD_BASETYPE (t)))
- return 1;
- if (uses_template_parms (TYPE_ARG_TYPES (t)))
- return 1;
- return uses_template_parms (TREE_TYPE (t));
-
- /* decl nodes */
- case TYPE_DECL:
- return uses_template_parms (TREE_TYPE (t));
-
- case FUNCTION_DECL:
- case VAR_DECL:
- /* ??? What about FIELD_DECLs? */
- if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t)
- && uses_template_parms (DECL_TI_ARGS (t)))
- return 1;
- /* fall through */
- case CONST_DECL:
- case PARM_DECL:
- if (uses_template_parms (TREE_TYPE (t)))
- return 1;
- if (DECL_CONTEXT (t) && uses_template_parms (DECL_CONTEXT (t)))
- return 1;
- return 0;
-
- case CALL_EXPR:
- return uses_template_parms (TREE_TYPE (t));
- case ADDR_EXPR:
- return uses_template_parms (TREE_OPERAND (t, 0));
-
- /* template parm nodes */
- case TEMPLATE_TYPE_PARM:
- case TEMPLATE_CONST_PARM:
- return 1;
-
- /* simple type nodes */
- case INTEGER_TYPE:
- if (uses_template_parms (TYPE_MIN_VALUE (t)))
- return 1;
- return uses_template_parms (TYPE_MAX_VALUE (t));
-
- case REAL_TYPE:
- case VOID_TYPE:
- case ENUMERAL_TYPE:
- case BOOLEAN_TYPE:
- return 0;
-
- /* constants */
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- return 0;
-
- case ERROR_MARK:
- /* Non-error_mark_node ERROR_MARKs are bad things. */
- my_friendly_assert (t == error_mark_node, 274);
- /* NOTREACHED */
- return 0;
-
- case LOOKUP_EXPR:
- case TYPENAME_TYPE:
- return 1;
-
- case SCOPE_REF:
- return uses_template_parms (TREE_OPERAND (t, 0));
-
- case CONSTRUCTOR:
- if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
- return uses_template_parms (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t)));
- return uses_template_parms (TREE_OPERAND (t, 1));
-
- default:
- switch (TREE_CODE_CLASS (TREE_CODE (t)))
- {
- case '1':
- case '2':
- case 'e':
- case '<':
- {
- int i;
- for (i = tree_code_length[(int) TREE_CODE (t)]; --i >= 0;)
- if (uses_template_parms (TREE_OPERAND (t, i)))
- return 1;
- return 0;
- }
- default:
- break;
- }
- sorry ("testing %s for template parms",
- tree_code_name [(int) TREE_CODE (t)]);
- my_friendly_abort (82);
- /* NOTREACHED */
- return 0;
- }
-}
-
-static struct tinst_level *current_tinst_level = 0;
-static struct tinst_level *free_tinst_level = 0;
-static int tinst_depth = 0;
-extern int max_tinst_depth;
-#ifdef GATHER_STATISTICS
-int depth_reached = 0;
-#endif
-
-static int
-push_tinst_level (d)
- tree d;
-{
- struct tinst_level *new;
-
- if (tinst_depth >= max_tinst_depth)
- {
- struct tinst_level *p = current_tinst_level;
- int line = lineno;
- char *file = input_filename;
-
- error ("template instantiation depth exceeds maximum of %d",
- max_tinst_depth);
- error (" (use -ftemplate-depth-NN to increase the maximum)");
- cp_error (" instantiating `%D'", d);
-
- for (; p; p = p->next)
- {
- cp_error (" instantiated from `%D'", p->decl);
- lineno = p->line;
- input_filename = p->file;
- }
- error (" instantiated from here");
-
- lineno = line;
- input_filename = file;
-
- return 0;
- }
-
- if (free_tinst_level)
- {
- new = free_tinst_level;
- free_tinst_level = new->next;
- }
- else
- new = (struct tinst_level *) xmalloc (sizeof (struct tinst_level));
-
- new->decl = d;
- new->line = lineno;
- new->file = input_filename;
- new->next = current_tinst_level;
- current_tinst_level = new;
-
- ++tinst_depth;
-#ifdef GATHER_STATISTICS
- if (tinst_depth > depth_reached)
- depth_reached = tinst_depth;
-#endif
-
- return 1;
-}
-
-void
-pop_tinst_level ()
-{
- struct tinst_level *old = current_tinst_level;
-
- current_tinst_level = old->next;
- old->next = free_tinst_level;
- free_tinst_level = old;
- --tinst_depth;
-}
-
-struct tinst_level *
-tinst_for_decl ()
-{
- struct tinst_level *p = current_tinst_level;
-
- if (p)
- for (; p->next ; p = p->next )
- ;
- return p;
-}
-
-tree
-instantiate_class_template (type)
- tree type;
-{
- tree template, template_info, args, pattern, t, *field_chain;
-
- if (type == error_mark_node)
- return error_mark_node;
-
- template_info = CLASSTYPE_TEMPLATE_INFO (type);
-
- if (TYPE_BEING_DEFINED (type) || TYPE_SIZE (type))
- return type;
-
- template = TI_TEMPLATE (template_info);
- my_friendly_assert (TREE_CODE (template) == TEMPLATE_DECL, 279);
- args = TI_ARGS (template_info);
-
- t = most_specialized_class
- (DECL_TEMPLATE_SPECIALIZATIONS (template), args);
-
- if (t == error_mark_node)
- {
- char *str = "candidates are:";
- cp_error ("ambiguous class template instantiation for `%#T'", type);
- for (t = DECL_TEMPLATE_SPECIALIZATIONS (template); t; t = TREE_CHAIN (t))
- {
- if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t), args))
- {
- cp_error_at ("%s %+#T", str, TREE_TYPE (t));
- str = " ";
- }
- }
- TYPE_BEING_DEFINED (type) = 1;
- return error_mark_node;
- }
- else if (t)
- pattern = TREE_TYPE (t);
- else
- pattern = TREE_TYPE (template);
-
- if (TYPE_SIZE (pattern) == NULL_TREE)
- return type;
-
- if (t)
- args = get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t), args);
-
- TYPE_BEING_DEFINED (type) = 1;
-
- if (! push_tinst_level (type))
- return type;
-
- maybe_push_to_top_level (uses_template_parms (type));
- pushclass (type, 0);
-
- if (flag_external_templates)
- {
- if (flag_alt_external_templates)
- {
- CLASSTYPE_INTERFACE_ONLY (type) = interface_only;
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X (type, interface_unknown);
- CLASSTYPE_VTABLE_NEEDS_WRITING (type)
- = ! CLASSTYPE_INTERFACE_ONLY (type)
- && CLASSTYPE_INTERFACE_KNOWN (type);
- }
- else
- {
- CLASSTYPE_INTERFACE_ONLY (type) = CLASSTYPE_INTERFACE_ONLY (pattern);
- SET_CLASSTYPE_INTERFACE_UNKNOWN_X
- (type, CLASSTYPE_INTERFACE_UNKNOWN (pattern));
- CLASSTYPE_VTABLE_NEEDS_WRITING (type)
- = ! CLASSTYPE_INTERFACE_ONLY (type)
- && CLASSTYPE_INTERFACE_KNOWN (type);
- }
- }
- else
- {
- SET_CLASSTYPE_INTERFACE_UNKNOWN (type);
- CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 1;
- }
-
- TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern);
- TYPE_HAS_DESTRUCTOR (type) = TYPE_HAS_DESTRUCTOR (pattern);
- TYPE_HAS_ASSIGNMENT (type) = TYPE_HAS_ASSIGNMENT (pattern);
- TYPE_OVERLOADS_CALL_EXPR (type) = TYPE_OVERLOADS_CALL_EXPR (pattern);
- TYPE_OVERLOADS_ARRAY_REF (type) = TYPE_OVERLOADS_ARRAY_REF (pattern);
- TYPE_OVERLOADS_ARROW (type) = TYPE_OVERLOADS_ARROW (pattern);
- TYPE_GETS_NEW (type) = TYPE_GETS_NEW (pattern);
- TYPE_GETS_DELETE (type) = TYPE_GETS_DELETE (pattern);
- TYPE_VEC_DELETE_TAKES_SIZE (type) = TYPE_VEC_DELETE_TAKES_SIZE (pattern);
- TYPE_HAS_ASSIGN_REF (type) = TYPE_HAS_ASSIGN_REF (pattern);
- TYPE_HAS_CONST_ASSIGN_REF (type) = TYPE_HAS_CONST_ASSIGN_REF (pattern);
- TYPE_HAS_ABSTRACT_ASSIGN_REF (type) = TYPE_HAS_ABSTRACT_ASSIGN_REF (pattern);
- TYPE_HAS_INIT_REF (type) = TYPE_HAS_INIT_REF (pattern);
- TYPE_HAS_CONST_INIT_REF (type) = TYPE_HAS_CONST_INIT_REF (pattern);
- TYPE_GETS_INIT_AGGR (type) = TYPE_GETS_INIT_AGGR (pattern);
- TYPE_HAS_DEFAULT_CONSTRUCTOR (type) = TYPE_HAS_DEFAULT_CONSTRUCTOR (pattern);
- TYPE_HAS_CONVERSION (type) = TYPE_HAS_CONVERSION (pattern);
- TYPE_USES_COMPLEX_INHERITANCE (type)
- = TYPE_USES_COMPLEX_INHERITANCE (pattern);
- TYPE_USES_MULTIPLE_INHERITANCE (type)
- = TYPE_USES_MULTIPLE_INHERITANCE (pattern);
- TYPE_USES_VIRTUAL_BASECLASSES (type)
- = TYPE_USES_VIRTUAL_BASECLASSES (pattern);
- TYPE_PACKED (type) = TYPE_PACKED (pattern);
- TYPE_ALIGN (type) = TYPE_ALIGN (pattern);
-
- {
- tree binfo = TYPE_BINFO (type);
- tree pbases = TYPE_BINFO_BASETYPES (pattern);
-
- if (pbases)
- {
- tree bases;
- int i;
- int len = TREE_VEC_LENGTH (pbases);
- bases = make_tree_vec (len);
- for (i = 0; i < len; ++i)
- {
- tree elt;
-
- TREE_VEC_ELT (bases, i) = elt
- = tsubst (TREE_VEC_ELT (pbases, i), &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), NULL_TREE);
- BINFO_INHERITANCE_CHAIN (elt) = binfo;
-
- if (! uses_template_parms (type) &&
- TYPE_SIZE (complete_type (TREE_TYPE (elt))) == NULL_TREE)
- cp_error ("base class `%T' of `%T' has incomplete type",
- TREE_TYPE (elt), type);
- }
- /* Don't initialize this until the vector is filled out, or
- lookups will crash. */
- BINFO_BASETYPES (binfo) = bases;
- }
- }
-
- CLASSTYPE_LOCAL_TYPEDECLS (type) = CLASSTYPE_LOCAL_TYPEDECLS (pattern);
-
- field_chain = &TYPE_FIELDS (type);
-
- for (t = CLASSTYPE_TAGS (pattern); t; t = TREE_CHAIN (t))
- {
- tree name = TREE_PURPOSE (t);
- tree tag = TREE_VALUE (t);
- tree newtag;
-
- /* These will add themselves to CLASSTYPE_TAGS for the new type. */
- if (TREE_CODE (tag) == ENUMERAL_TYPE)
- newtag = start_enum (name);
- else
- newtag = tsubst (tag, &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), NULL_TREE);
-
- if (TREE_CODE (tag) == ENUMERAL_TYPE)
- {
- tree e, values = NULL_TREE, *last = &values;
-
- for (e = TYPE_VALUES (tag); e; e = TREE_CHAIN (e))
- {
- tree elt = build_enumerator
- (TREE_PURPOSE (e),
- tsubst_expr (TREE_VALUE (e), &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), NULL_TREE));
- DECL_FIELD_CONTEXT (TREE_VALUE (elt)) = type;
- *last = elt;
- last = &TREE_CHAIN (elt);
- }
-
- finish_enum (newtag, values);
-
- *field_chain = grok_enum_decls (newtag, NULL_TREE);
- while (*field_chain)
- field_chain = &TREE_CHAIN (*field_chain);
- }
- }
-
- /* Don't replace enum constants here. */
- for (t = TYPE_FIELDS (pattern); t; t = TREE_CHAIN (t))
- if (TREE_CODE (t) != CONST_DECL)
- {
- tree r = tsubst (t, &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), NULL_TREE);
- if (TREE_CODE (r) == VAR_DECL)
- {
- if (! uses_template_parms (r))
- pending_statics = perm_tree_cons (NULL_TREE, r, pending_statics);
- /* Perhaps I should do more of grokfield here. */
- start_decl_1 (r);
- DECL_IN_AGGR_P (r) = 1;
- DECL_EXTERNAL (r) = 1;
- cp_finish_decl (r, DECL_INITIAL (r), NULL_TREE, 0, 0);
- }
-
- *field_chain = r;
- field_chain = &TREE_CHAIN (r);
- }
-
- TYPE_METHODS (type) = tsubst_chain (TYPE_METHODS (pattern), args);
- for (t = TYPE_METHODS (type); t; t = TREE_CHAIN (t))
- {
- if (DECL_CONSTRUCTOR_P (t))
- grok_ctor_properties (type, t);
- else if (IDENTIFIER_OPNAME_P (DECL_NAME (t)))
- grok_op_properties (t, DECL_VIRTUAL_P (t), 0);
- }
-
- DECL_FRIENDLIST (TYPE_MAIN_DECL (type))
- = tsubst (DECL_FRIENDLIST (TYPE_MAIN_DECL (pattern)),
- &TREE_VEC_ELT (args, 0), TREE_VEC_LENGTH (args), NULL_TREE);
-
- {
- tree d = CLASSTYPE_FRIEND_CLASSES (type) =
- tsubst (CLASSTYPE_FRIEND_CLASSES (pattern), &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), NULL_TREE);
-
- /* This does injection for friend classes. */
- for (; d; d = TREE_CHAIN (d))
- TREE_VALUE (d) = xref_tag_from_type (TREE_VALUE (d), NULL_TREE, 1);
-
- d = tsubst (DECL_TEMPLATE_INJECT (template), &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), NULL_TREE);
-
- for (; d; d = TREE_CHAIN (d))
- {
- tree t = TREE_VALUE (d);
-
- if (TREE_CODE (t) == TYPE_DECL)
- /* Already injected. */;
- else
- pushdecl (t);
- }
- }
-
- if (! uses_template_parms (type))
- {
- tree tmp;
- for (tmp = TYPE_FIELDS (type); tmp; tmp = TREE_CHAIN (tmp))
- if (TREE_CODE (tmp) == FIELD_DECL)
- {
- TREE_TYPE (tmp) = complete_type (TREE_TYPE (tmp));
- require_complete_type (tmp);
- }
-
- type = finish_struct_1 (type, 0);
- CLASSTYPE_GOT_SEMICOLON (type) = 1;
- if (at_eof && TYPE_BINFO_VTABLE (type) != NULL_TREE)
- finish_prevtable_vardecl (NULL, TYPE_BINFO_VTABLE (type));
-
- repo_template_used (type);
- }
- else
- {
- TYPE_SIZE (type) = integer_zero_node;
- CLASSTYPE_METHOD_VEC (type)
- = finish_struct_methods (type, TYPE_METHODS (type), 1);
- }
-
- TYPE_BEING_DEFINED (type) = 0;
- popclass (0);
-
- pop_from_top_level ();
- pop_tinst_level ();
-
- return type;
-}
-
-static int
-list_eq (t1, t2)
- tree t1, t2;
-{
- if (t1 == NULL_TREE)
- return t2 == NULL_TREE;
- if (t2 == NULL_TREE)
- return 0;
- /* Don't care if one declares its arg const and the other doesn't -- the
- main variant of the arg type is all that matters. */
- if (TYPE_MAIN_VARIANT (TREE_VALUE (t1))
- != TYPE_MAIN_VARIANT (TREE_VALUE (t2)))
- return 0;
- return list_eq (TREE_CHAIN (t1), TREE_CHAIN (t2));
-}
-
-tree
-lookup_nested_type_by_name (ctype, name)
- tree ctype, name;
-{
- tree t;
-
- complete_type (ctype);
-
- for (t = CLASSTYPE_TAGS (ctype); t; t = TREE_CHAIN (t))
- {
- if (name == TREE_PURPOSE (t))
- return TREE_VALUE (t);
- }
- return NULL_TREE;
-}
-
-tree
-tsubst (t, args, nargs, in_decl)
- tree t, *args;
- int nargs;
- tree in_decl;
-{
- tree type;
-
- if (t == NULL_TREE || t == error_mark_node
- || t == integer_type_node
- || t == void_type_node
- || t == char_type_node)
- return t;
-
- type = TREE_TYPE (t);
- if (type == unknown_type_node)
- my_friendly_abort (42);
- if (type && TREE_CODE (t) != FUNCTION_DECL
- && TREE_CODE (t) != TYPENAME_TYPE)
- type = tsubst (type, args, nargs, in_decl);
-
- switch (TREE_CODE (t))
- {
- case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_P (t))
- {
- tree r = build_ptrmemfunc_type
- (tsubst (TYPE_PTRMEMFUNC_FN_TYPE (t), args, nargs, in_decl));
- return cp_build_type_variant (r, TYPE_READONLY (t),
- TYPE_VOLATILE (t));
- }
-
- /* else fall through */
- case UNION_TYPE:
- if (uses_template_parms (t))
- {
- tree argvec = tsubst (CLASSTYPE_TI_ARGS (t), args, nargs, in_decl);
- tree r = lookup_template_class (t, argvec, in_decl);
- return cp_build_type_variant (r, TYPE_READONLY (t),
- TYPE_VOLATILE (t));
- }
-
- /* else fall through */
- case ERROR_MARK:
- case IDENTIFIER_NODE:
- case OP_IDENTIFIER:
- case VOID_TYPE:
- case REAL_TYPE:
- case BOOLEAN_TYPE:
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- return t;
-
- case ENUMERAL_TYPE:
- {
- tree ctx = tsubst (TYPE_CONTEXT (t), args, nargs, in_decl);
- if (ctx == NULL_TREE)
- return t;
- else
- return lookup_nested_type_by_name (ctx, TYPE_IDENTIFIER (t));
- }
-
- case INTEGER_TYPE:
- if (t == integer_type_node)
- return t;
-
- if (TREE_CODE (TYPE_MIN_VALUE (t)) == INTEGER_CST
- && TREE_CODE (TYPE_MAX_VALUE (t)) == INTEGER_CST)
- return t;
-
- {
- tree max = tsubst_expr (TYPE_MAX_VALUE (t), args, nargs, in_decl);
- if (processing_template_decl)
- {
- tree itype = make_node (INTEGER_TYPE);
- TYPE_MIN_VALUE (itype) = size_zero_node;
- TYPE_MAX_VALUE (itype) = max;
- return itype;
- }
- return build_index_2_type (size_zero_node, max);
- }
-
- case TEMPLATE_TYPE_PARM:
- {
- tree arg = args[TEMPLATE_TYPE_IDX (t)];
- return cp_build_type_variant
- (arg, TYPE_READONLY (arg) || TYPE_READONLY (t),
- TYPE_VOLATILE (arg) || TYPE_VOLATILE (t));
- }
-
- case TEMPLATE_CONST_PARM:
- return args[TEMPLATE_CONST_IDX (t)];
-
- case FUNCTION_DECL:
- {
- tree r = NULL_TREE;
- tree arg_types, ctx;
-
- int member;
-
- if (DECL_CONTEXT (t) != NULL_TREE
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (t))) == 't')
- {
- if (DECL_NAME (t) == constructor_name (DECL_CONTEXT (t)))
- member = 2;
- else
- member = 1;
- ctx = tsubst (DECL_CLASS_CONTEXT (t), args, nargs, t);
- type = tsubst (type, args, nargs, in_decl);
- }
- else
- {
- member = 0;
- ctx = NULL_TREE;
- type = tsubst (type, args, nargs, in_decl);
- }
-
- if (type == TREE_TYPE (t)
- && (! member || ctx == DECL_CLASS_CONTEXT (t)))
- {
- t = copy_node (t);
- copy_lang_decl (t);
- return t;
- }
-
- /* Do we already have this instantiation? */
- if (DECL_TEMPLATE_INFO (t) != NULL_TREE)
- {
- tree tmpl = TREE_PURPOSE (DECL_TEMPLATE_INFO (t));
- tree decls = DECL_TEMPLATE_INSTANTIATIONS (tmpl);
-
- for (; decls; decls = TREE_CHAIN (decls))
- if (TREE_TYPE (TREE_VALUE (decls)) == type
- && DECL_CLASS_CONTEXT (TREE_VALUE (decls)) == ctx)
- return TREE_VALUE (decls);
- }
-
- /* We do NOT check for matching decls pushed separately at this
- point, as they may not represent instantiations of this
- template, and in any case are considered separate under the
- discrete model. Instead, see add_maybe_template. */
-
- r = copy_node (t);
- copy_lang_decl (r);
- TREE_TYPE (r) = type;
-
- DECL_CONTEXT (r)
- = tsubst (DECL_CONTEXT (t), args, nargs, t);
- DECL_CLASS_CONTEXT (r) = ctx;
-
- if (member && !strncmp (OPERATOR_TYPENAME_FORMAT,
- IDENTIFIER_POINTER (DECL_NAME (r)),
- sizeof (OPERATOR_TYPENAME_FORMAT) - 1))
- {
- /* Type-conversion operator. Reconstruct the name, in
- case it's the name of one of the template's parameters. */
- DECL_NAME (r) = build_typename_overload (TREE_TYPE (type));
- }
-
- arg_types = TYPE_VALUES (type);
-
- if (member && TREE_CODE (type) == FUNCTION_TYPE)
- arg_types = hash_tree_chain
- (build_pointer_type (DECL_CONTEXT (r)), arg_types);
-
- if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (t)))
- {
- char *buf, *dbuf = build_overload_name (ctx, 1, 1);
- int len = sizeof (DESTRUCTOR_DECL_PREFIX) - 1;
- buf = (char *) alloca (strlen (dbuf)
- + sizeof (DESTRUCTOR_DECL_PREFIX));
- bcopy (DESTRUCTOR_DECL_PREFIX, buf, len);
- buf[len] = '\0';
- strcat (buf, dbuf);
- DECL_ASSEMBLER_NAME (r) = get_identifier (buf);
- }
- else
- DECL_ASSEMBLER_NAME (r)
- = build_decl_overload (DECL_NAME (r), arg_types, member);
- DECL_RTL (r) = 0;
- make_decl_rtl (r, NULL_PTR, 1);
-
- DECL_ARGUMENTS (r) = tsubst (DECL_ARGUMENTS (t), args, nargs, t);
- DECL_MAIN_VARIANT (r) = r;
- DECL_RESULT (r) = NULL_TREE;
- DECL_INITIAL (r) = NULL_TREE;
-
- TREE_STATIC (r) = 0;
- TREE_PUBLIC (r) = 1;
- DECL_EXTERNAL (r) = 1;
- DECL_INTERFACE_KNOWN (r) = 0;
- DECL_DEFER_OUTPUT (r) = 0;
- TREE_CHAIN (r) = NULL_TREE;
- DECL_CHAIN (r) = NULL_TREE;
-
- if (IDENTIFIER_OPNAME_P (DECL_NAME (r)))
- grok_op_properties (r, DECL_VIRTUAL_P (r), DECL_FRIEND_P (r));
-
- /* Look for matching decls for the moment. */
- if (! member && ! flag_ansi_overloading)
- {
- tree decls = lookup_name_nonclass (DECL_NAME (t));
- tree d = NULL_TREE;
-
- if (decls == NULL_TREE)
- /* no match */;
- else if (is_overloaded_fn (decls))
- for (decls = get_first_fn (decls); decls;
- decls = DECL_CHAIN (decls))
- {
- if (TREE_CODE (decls) == FUNCTION_DECL
- && TREE_TYPE (decls) == type)
- {
- d = decls;
- break;
- }
- }
-
- if (d)
- {
- int dcl_only = ! DECL_INITIAL (d);
- if (dcl_only)
- DECL_INITIAL (r) = error_mark_node;
- duplicate_decls (r, d);
- r = d;
- if (dcl_only)
- DECL_INITIAL (r) = 0;
- }
- }
-
- if (DECL_TEMPLATE_INFO (t) != NULL_TREE)
- {
- tree tmpl = DECL_TI_TEMPLATE (t);
- tree *declsp = &DECL_TEMPLATE_INSTANTIATIONS (tmpl);
- tree argvec = tsubst (TREE_VALUE (DECL_TEMPLATE_INFO (t)),
- args, nargs, in_decl);
-
- DECL_TEMPLATE_INFO (r) = perm_tree_cons (tmpl, argvec, NULL_TREE);
- *declsp = perm_tree_cons (argvec, r, *declsp);
-
- /* If we have a preexisting version of this function, don't expand
- the template version, use the other instead. */
- if (TREE_STATIC (r) || DECL_TEMPLATE_SPECIALIZATION (r))
- SET_DECL_TEMPLATE_SPECIALIZATION (r);
- else
- SET_DECL_IMPLICIT_INSTANTIATION (r);
-
- DECL_TEMPLATE_INSTANTIATIONS (tmpl) =
- tree_cons (argvec, r, DECL_TEMPLATE_INSTANTIATIONS (tmpl));
- }
-
- /* Like grokfndecl. If we don't do this, pushdecl will mess up our
- TREE_CHAIN because it doesn't find a previous decl. Sigh. */
- if (member
- && IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (r)) == NULL_TREE)
- IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (r)) = r;
-
- return r;
- }
-
- case PARM_DECL:
- {
- tree r = copy_node (t);
- TREE_TYPE (r) = type;
- DECL_INITIAL (r) = TREE_TYPE (r);
- DECL_CONTEXT (r) = NULL_TREE;
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
- DECL_ARG_TYPE (r) = integer_type_node;
-#endif
- if (TREE_CHAIN (t))
- TREE_CHAIN (r) = tsubst (TREE_CHAIN (t), args, nargs, TREE_CHAIN (t));
- return r;
- }
-
- case FIELD_DECL:
- {
- tree r = copy_node (t);
- TREE_TYPE (r) = type;
- copy_lang_decl (r);
-#if 0
- DECL_FIELD_CONTEXT (r) = tsubst (DECL_FIELD_CONTEXT (t), args, nargs, in_decl);
-#endif
- DECL_INITIAL (r) = tsubst_expr (DECL_INITIAL (t), args, nargs, in_decl);
- TREE_CHAIN (r) = NULL_TREE;
- return r;
- }
-
- case USING_DECL:
- {
- tree r = copy_node (t);
- DECL_INITIAL (r)
- = tsubst_copy (DECL_INITIAL (t), args, nargs, in_decl);
- TREE_CHAIN (r) = NULL_TREE;
- return r;
- }
-
- case VAR_DECL:
- {
- tree r;
- tree ctx = tsubst_copy (DECL_CONTEXT (t), args, nargs, in_decl);
-
- /* Do we already have this instantiation? */
- if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t))
- {
- tree tmpl = DECL_TI_TEMPLATE (t);
- tree decls = DECL_TEMPLATE_INSTANTIATIONS (tmpl);
-
- for (; decls; decls = TREE_CHAIN (decls))
- if (DECL_CONTEXT (TREE_VALUE (decls)) == ctx)
- return TREE_VALUE (decls);
- }
-
- r = copy_node (t);
- TREE_TYPE (r) = type;
- DECL_CONTEXT (r) = ctx;
- if (TREE_STATIC (r))
- DECL_ASSEMBLER_NAME (r)
- = build_static_name (DECL_CONTEXT (r), DECL_NAME (r));
-
- /* Don't try to expand the initializer until someone tries to use
- this variable; otherwise we run into circular dependencies. */
- DECL_INITIAL (r) = NULL_TREE;
-
- DECL_RTL (r) = 0;
- DECL_SIZE (r) = 0;
-
- if (DECL_LANG_SPECIFIC (r))
- {
- copy_lang_decl (r);
- DECL_CLASS_CONTEXT (r) = DECL_CONTEXT (r);
- }
-
- if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t))
- {
- tree tmpl = DECL_TI_TEMPLATE (t);
- tree *declsp = &DECL_TEMPLATE_INSTANTIATIONS (tmpl);
- tree argvec = tsubst (TREE_VALUE (DECL_TEMPLATE_INFO (t)),
- args, nargs, in_decl);
-
- DECL_TEMPLATE_INFO (r) = perm_tree_cons (tmpl, argvec, NULL_TREE);
- *declsp = perm_tree_cons (argvec, r, *declsp);
- SET_DECL_IMPLICIT_INSTANTIATION (r);
- }
- TREE_CHAIN (r) = NULL_TREE;
- return r;
- }
-
- case TYPE_DECL:
- if (t == TYPE_NAME (TREE_TYPE (t)))
- return TYPE_NAME (type);
-
- {
- tree r = copy_node (t);
- TREE_TYPE (r) = type;
- DECL_CONTEXT (r) = current_class_type;
- TREE_CHAIN (r) = NULL_TREE;
- return r;
- }
-
- case TREE_LIST:
- {
- tree purpose, value, chain, result;
- int via_public, via_virtual, via_protected;
-
- if (t == void_list_node)
- return t;
-
- via_public = TREE_VIA_PUBLIC (t);
- via_protected = TREE_VIA_PROTECTED (t);
- via_virtual = TREE_VIA_VIRTUAL (t);
-
- purpose = TREE_PURPOSE (t);
- if (purpose)
- purpose = tsubst (purpose, args, nargs, in_decl);
- value = TREE_VALUE (t);
- if (value)
- value = tsubst (value, args, nargs, in_decl);
- chain = TREE_CHAIN (t);
- if (chain && chain != void_type_node)
- chain = tsubst (chain, args, nargs, in_decl);
- if (purpose == TREE_PURPOSE (t)
- && value == TREE_VALUE (t)
- && chain == TREE_CHAIN (t))
- return t;
- result = hash_tree_cons (via_public, via_virtual, via_protected,
- purpose, value, chain);
- TREE_PARMLIST (result) = TREE_PARMLIST (t);
- return result;
- }
- case TREE_VEC:
- if (type != NULL_TREE)
- {
- t = copy_node (t);
-
- if (type == TREE_TYPE (t))
- return t;
-
- TREE_TYPE (t) = complete_type (type);
- BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (type);
- BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (type);
- if (TYPE_BINFO_BASETYPES (type) != NULL_TREE)
- BINFO_BASETYPES (t) = copy_node (TYPE_BINFO_BASETYPES (type));
-
- return t;
- }
- {
- int len = TREE_VEC_LENGTH (t), need_new = 0, i;
- tree *elts = (tree *) alloca (len * sizeof (tree));
-
- bzero ((char *) elts, len * sizeof (tree));
-
- for (i = 0; i < len; i++)
- {
- elts[i] = tsubst_expr (TREE_VEC_ELT (t, i), args, nargs, in_decl);
- if (elts[i] != TREE_VEC_ELT (t, i))
- need_new = 1;
- }
-
- if (!need_new)
- return t;
-
- t = make_tree_vec (len);
- for (i = 0; i < len; i++)
- TREE_VEC_ELT (t, i) = elts[i];
-
- return t;
- }
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- {
- tree r;
- enum tree_code code;
- if (type == TREE_TYPE (t))
- return t;
-
- code = TREE_CODE (t);
- if (code == POINTER_TYPE)
- r = build_pointer_type (type);
- else
- r = build_reference_type (type);
- r = cp_build_type_variant (r, TYPE_READONLY (t), TYPE_VOLATILE (t));
- /* Will this ever be needed for TYPE_..._TO values? */
- layout_type (r);
- return r;
- }
- case OFFSET_TYPE:
- return build_offset_type
- (tsubst (TYPE_OFFSET_BASETYPE (t), args, nargs, in_decl), type);
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- {
- tree values = TYPE_ARG_TYPES (t);
- tree context = TYPE_CONTEXT (t);
- tree raises = TYPE_RAISES_EXCEPTIONS (t);
- tree fntype;
-
- /* Don't bother recursing if we know it won't change anything. */
- if (values != void_list_node)
- {
- /* This should probably be rewritten to use hash_tree_cons for
- the memory savings. */
- tree first = NULL_TREE;
- tree last;
-
- for (; values && values != void_list_node;
- values = TREE_CHAIN (values))
- {
- tree value = TYPE_MAIN_VARIANT (type_decays_to
- (tsubst (TREE_VALUE (values), args, nargs, in_decl)));
- /* Don't instantiate default args unless they are used.
- Handle it in build_over_call instead. */
- tree purpose = TREE_PURPOSE (values);
- tree x = build_tree_list (purpose, value);
-
- if (purpose)
- PARM_DEFAULT_FROM_TEMPLATE (x) = 1;
-
- if (first)
- TREE_CHAIN (last) = x;
- else
- first = x;
- last = x;
- }
-
- if (values == void_list_node)
- TREE_CHAIN (last) = void_list_node;
-
- values = first;
- }
- if (context)
- context = tsubst (context, args, nargs, in_decl);
- /* Could also optimize cases where return value and
- values have common elements (e.g., T min(const &T, const T&). */
-
- /* If the above parameters haven't changed, just return the type. */
- if (type == TREE_TYPE (t)
- && values == TYPE_VALUES (t)
- && context == TYPE_CONTEXT (t))
- return t;
-
- /* Construct a new type node and return it. */
- if (TREE_CODE (t) == FUNCTION_TYPE
- && context == NULL_TREE)
- {
- fntype = build_function_type (type, values);
- }
- else if (context == NULL_TREE)
- {
- tree base = tsubst (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))),
- args, nargs, in_decl);
- fntype = build_cplus_method_type (base, type,
- TREE_CHAIN (values));
- }
- else
- {
- fntype = make_node (TREE_CODE (t));
- TREE_TYPE (fntype) = type;
- TYPE_CONTEXT (fntype) = context;
- TYPE_VALUES (fntype) = values;
- TYPE_SIZE (fntype) = TYPE_SIZE (t);
- TYPE_ALIGN (fntype) = TYPE_ALIGN (t);
- TYPE_MODE (fntype) = TYPE_MODE (t);
- if (TYPE_METHOD_BASETYPE (t))
- TYPE_METHOD_BASETYPE (fntype) = tsubst (TYPE_METHOD_BASETYPE (t),
- args, nargs, in_decl);
- /* Need to generate hash value. */
- my_friendly_abort (84);
- }
- fntype = build_type_variant (fntype,
- TYPE_READONLY (t),
- TYPE_VOLATILE (t));
- if (raises)
- {
- raises = tsubst (raises, args, nargs, in_decl);
- fntype = build_exception_variant (fntype, raises);
- }
- return fntype;
- }
- case ARRAY_TYPE:
- {
- tree domain = tsubst (TYPE_DOMAIN (t), args, nargs, in_decl);
- tree r;
- if (type == TREE_TYPE (t) && domain == TYPE_DOMAIN (t))
- return t;
- r = build_cplus_array_type (type, domain);
- return r;
- }
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- return fold (build (TREE_CODE (t), TREE_TYPE (t),
- tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl)));
-
- case NEGATE_EXPR:
- case NOP_EXPR:
- return fold (build1 (TREE_CODE (t), TREE_TYPE (t),
- tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl)));
-
- case TYPENAME_TYPE:
- {
- tree ctx = tsubst (TYPE_CONTEXT (t), args, nargs, in_decl);
- tree f = make_typename_type (ctx, TYPE_IDENTIFIER (t));
- return cp_build_type_variant
- (f, TYPE_READONLY (f) || TYPE_READONLY (t),
- TYPE_VOLATILE (f) || TYPE_VOLATILE (t));
- }
-
- case INDIRECT_REF:
- return make_pointer_declarator
- (type, tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl));
-
- case ADDR_EXPR:
- return make_reference_declarator
- (type, tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl));
-
- case ARRAY_REF:
- return build_parse_node
- (ARRAY_REF, tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst_expr (TREE_OPERAND (t, 1), args, nargs, in_decl));
-
- case CALL_EXPR:
- return make_call_declarator
- (tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl),
- TREE_OPERAND (t, 2),
- tsubst (TREE_TYPE (t), args, nargs, in_decl));
-
- case SCOPE_REF:
- return build_parse_node
- (TREE_CODE (t), tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl));
-
- default:
- sorry ("use of `%s' in template",
- tree_code_name [(int) TREE_CODE (t)]);
- return error_mark_node;
- }
-}
-
-void
-do_pushlevel ()
-{
- emit_line_note (input_filename, lineno);
- pushlevel (0);
- clear_last_expr ();
- push_momentary ();
- expand_start_bindings (0);
-}
-
-tree
-do_poplevel ()
-{
- tree t;
-
- expand_end_bindings (getdecls (), kept_level_p (), 1);
- t = poplevel (kept_level_p (), 1, 0);
- pop_momentary ();
- return t;
-}
-
-tree
-tsubst_copy (t, args, nargs, in_decl)
- tree t, *args;
- int nargs;
- tree in_decl;
-{
- enum tree_code code;
-
- if (t == NULL_TREE || t == error_mark_node)
- return t;
-
- code = TREE_CODE (t);
-
- switch (code)
- {
- case PARM_DECL:
- return do_identifier (DECL_NAME (t), 0);
-
- case CONST_DECL:
- case FIELD_DECL:
- if (DECL_CONTEXT (t))
- {
- tree ctx = tsubst (DECL_CONTEXT (t), args, nargs, in_decl);
- if (ctx != DECL_CONTEXT (t))
- return lookup_field (ctx, DECL_NAME (t), 0, 0);
- }
- return t;
-
- case VAR_DECL:
- case FUNCTION_DECL:
- if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t))
- t = tsubst (t, args, nargs, in_decl);
- mark_used (t);
- return t;
-
-#if 0
- case IDENTIFIER_NODE:
- return do_identifier (t, 0);
-#endif
-
- case CAST_EXPR:
- case REINTERPRET_CAST_EXPR:
- case CONST_CAST_EXPR:
- case STATIC_CAST_EXPR:
- case DYNAMIC_CAST_EXPR:
- return build1
- (code, tsubst (TREE_TYPE (t), args, nargs, in_decl),
- tsubst_copy (TREE_OPERAND (t, 0), args, nargs, in_decl));
-
- case INDIRECT_REF:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case NEGATE_EXPR:
- case TRUTH_NOT_EXPR:
- case ADDR_EXPR:
- case CONVERT_EXPR: /* Unary + */
- case SIZEOF_EXPR:
- case ARROW_EXPR:
- case THROW_EXPR:
- case TYPEID_EXPR:
- return build1
- (code, NULL_TREE,
- tsubst_copy (TREE_OPERAND (t, 0), args, nargs, in_decl));
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case EXACT_DIV_EXPR:
- case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case RSHIFT_EXPR:
- case LSHIFT_EXPR:
- case RROTATE_EXPR:
- case LROTATE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case MAX_EXPR:
- case MIN_EXPR:
- case LE_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case GT_EXPR:
- case COMPONENT_REF:
- case ARRAY_REF:
- case COMPOUND_EXPR:
- case SCOPE_REF:
- case DOTSTAR_EXPR:
- case MEMBER_REF:
- return build_nt
- (code, tsubst_copy (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst_copy (TREE_OPERAND (t, 1), args, nargs, in_decl));
-
- case CALL_EXPR:
- {
- tree fn = TREE_OPERAND (t, 0);
- if (really_overloaded_fn (fn))
- fn = tsubst_copy (TREE_VALUE (fn), args, nargs, in_decl);
- else
- fn = tsubst_copy (fn, args, nargs, in_decl);
- return build_nt
- (code, fn, tsubst_copy (TREE_OPERAND (t, 1), args, nargs, in_decl),
- NULL_TREE);
- }
-
- case METHOD_CALL_EXPR:
- {
- tree name = TREE_OPERAND (t, 0);
- if (TREE_CODE (name) == BIT_NOT_EXPR)
- {
- name = tsubst_copy (TREE_OPERAND (name, 0), args, nargs, in_decl);
- name = build1 (BIT_NOT_EXPR, NULL_TREE, TYPE_MAIN_VARIANT (name));
- }
- else if (TREE_CODE (name) == SCOPE_REF
- && TREE_CODE (TREE_OPERAND (name, 1)) == BIT_NOT_EXPR)
- {
- tree base = tsubst_copy (TREE_OPERAND (name, 0), args, nargs, in_decl);
- name = TREE_OPERAND (name, 1);
- name = tsubst_copy (TREE_OPERAND (name, 0), args, nargs, in_decl);
- name = build1 (BIT_NOT_EXPR, NULL_TREE, TYPE_MAIN_VARIANT (name));
- name = build_nt (SCOPE_REF, base, name);
- }
- else
- name = tsubst_copy (TREE_OPERAND (t, 0), args, nargs, in_decl);
- return build_nt
- (code, name, tsubst_copy (TREE_OPERAND (t, 1), args, nargs, in_decl),
- tsubst_copy (TREE_OPERAND (t, 2), args, nargs, in_decl),
- NULL_TREE);
- }
-
- case COND_EXPR:
- case MODOP_EXPR:
- return build_nt
- (code, tsubst_copy (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst_copy (TREE_OPERAND (t, 1), args, nargs, in_decl),
- tsubst_copy (TREE_OPERAND (t, 2), args, nargs, in_decl));
-
- case NEW_EXPR:
- {
- tree r = build_nt
- (code, tsubst_copy (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst_copy (TREE_OPERAND (t, 1), args, nargs, in_decl),
- tsubst_copy (TREE_OPERAND (t, 2), args, nargs, in_decl));
- NEW_EXPR_USE_GLOBAL (r) = NEW_EXPR_USE_GLOBAL (t);
- return r;
- }
-
- case DELETE_EXPR:
- {
- tree r = build_nt
- (code, tsubst_copy (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst_copy (TREE_OPERAND (t, 1), args, nargs, in_decl));
- DELETE_EXPR_USE_GLOBAL (r) = DELETE_EXPR_USE_GLOBAL (t);
- DELETE_EXPR_USE_VEC (r) = DELETE_EXPR_USE_VEC (t);
- return r;
- }
-
- case TREE_LIST:
- {
- tree purpose, value, chain;
-
- if (t == void_list_node)
- return t;
-
- purpose = TREE_PURPOSE (t);
- if (purpose)
- purpose = tsubst_copy (purpose, args, nargs, in_decl);
- value = TREE_VALUE (t);
- if (value)
- value = tsubst_copy (value, args, nargs, in_decl);
- chain = TREE_CHAIN (t);
- if (chain && chain != void_type_node)
- chain = tsubst_copy (chain, args, nargs, in_decl);
- if (purpose == TREE_PURPOSE (t)
- && value == TREE_VALUE (t)
- && chain == TREE_CHAIN (t))
- return t;
- return tree_cons (purpose, value, chain);
- }
-
- case RECORD_TYPE:
- case UNION_TYPE:
- case ENUMERAL_TYPE:
- case INTEGER_TYPE:
- case TEMPLATE_TYPE_PARM:
- case TEMPLATE_CONST_PARM:
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- case OFFSET_TYPE:
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- case ARRAY_TYPE:
- case TYPENAME_TYPE:
- return tsubst (t, args, nargs, in_decl);
-
- case IDENTIFIER_NODE:
- if (IDENTIFIER_TYPENAME_P (t))
- return build_typename_overload
- (tsubst (TREE_TYPE (t), args, nargs, in_decl));
- else
- return t;
-
- case CONSTRUCTOR:
- return build
- (CONSTRUCTOR, tsubst (TREE_TYPE (t), args, nargs, in_decl), NULL_TREE,
- tsubst_copy (CONSTRUCTOR_ELTS (t), args, nargs, in_decl));
-
- default:
- return t;
- }
-}
-
-tree
-tsubst_expr (t, args, nargs, in_decl)
- tree t, *args;
- int nargs;
- tree in_decl;
-{
- if (t == NULL_TREE || t == error_mark_node)
- return t;
-
- if (processing_template_decl)
- return tsubst_copy (t, args, nargs, in_decl);
-
- switch (TREE_CODE (t))
- {
- case RETURN_STMT:
- lineno = TREE_COMPLEXITY (t);
- emit_line_note (input_filename, lineno);
- c_expand_return
- (tsubst_expr (TREE_OPERAND (t, 0), args, nargs, in_decl));
- finish_stmt ();
- break;
-
- case EXPR_STMT:
- lineno = TREE_COMPLEXITY (t);
- emit_line_note (input_filename, lineno);
- t = tsubst_expr (TREE_OPERAND (t, 0), args, nargs, in_decl);
- /* Do default conversion if safe and possibly important,
- in case within ({...}). */
- if ((TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE && lvalue_p (t))
- || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
- t = default_conversion (t);
- cplus_expand_expr_stmt (t);
- clear_momentary ();
- finish_stmt ();
- break;
-
- case DECL_STMT:
- {
- int i = suspend_momentary ();
- tree dcl, init;
-
- lineno = TREE_COMPLEXITY (t);
- emit_line_note (input_filename, lineno);
- dcl = start_decl
- (tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl),
- TREE_OPERAND (t, 2) != 0);
- init = tsubst_expr (TREE_OPERAND (t, 2), args, nargs, in_decl);
- cp_finish_decl
- (dcl, init, NULL_TREE, 1, /*init ? LOOKUP_ONLYCONVERTING :*/ 0);
- resume_momentary (i);
- return dcl;
- }
-
- case FOR_STMT:
- {
- tree tmp;
- int init_scope = (flag_new_for_scope > 0 && TREE_OPERAND (t, 0)
- && TREE_CODE (TREE_OPERAND (t, 0)) == DECL_STMT);
- int cond_scope = (TREE_OPERAND (t, 1)
- && TREE_CODE (TREE_OPERAND (t, 1)) == DECL_STMT);
-
- lineno = TREE_COMPLEXITY (t);
- emit_line_note (input_filename, lineno);
- if (init_scope)
- do_pushlevel ();
- for (tmp = TREE_OPERAND (t, 0); tmp; tmp = TREE_CHAIN (tmp))
- tsubst_expr (tmp, args, nargs, in_decl);
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop_continue_elsewhere (1);
-
- if (cond_scope)
- do_pushlevel ();
- tmp = tsubst_expr (TREE_OPERAND (t, 1), args, nargs, in_decl);
- emit_line_note (input_filename, lineno);
- if (tmp)
- expand_exit_loop_if_false (0, condition_conversion (tmp));
-
- if (! cond_scope)
- do_pushlevel ();
- tsubst_expr (TREE_OPERAND (t, 3), args, nargs, in_decl);
- do_poplevel ();
-
- emit_line_note (input_filename, lineno);
- expand_loop_continue_here ();
- tmp = tsubst_expr (TREE_OPERAND (t, 2), args, nargs, in_decl);
- if (tmp)
- cplus_expand_expr_stmt (tmp);
-
- expand_end_loop ();
- if (init_scope)
- do_poplevel ();
- finish_stmt ();
- }
- break;
-
- case WHILE_STMT:
- {
- tree cond;
-
- lineno = TREE_COMPLEXITY (t);
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop (1);
-
- cond = TREE_OPERAND (t, 0);
- if (TREE_CODE (cond) == DECL_STMT)
- do_pushlevel ();
- cond = tsubst_expr (cond, args, nargs, in_decl);
- emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (0, condition_conversion (cond));
-
- if (TREE_CODE (TREE_OPERAND (t, 0)) != DECL_STMT)
- do_pushlevel ();
- tsubst_expr (TREE_OPERAND (t, 1), args, nargs, in_decl);
- do_poplevel ();
-
- expand_end_loop ();
- finish_stmt ();
- }
- break;
-
- case DO_STMT:
- {
- tree cond;
-
- lineno = TREE_COMPLEXITY (t);
- emit_nop ();
- emit_line_note (input_filename, lineno);
- expand_start_loop_continue_elsewhere (1);
-
- tsubst_expr (TREE_OPERAND (t, 0), args, nargs, in_decl);
- expand_loop_continue_here ();
-
- cond = tsubst_expr (TREE_OPERAND (t, 1), args, nargs, in_decl);
- emit_line_note (input_filename, lineno);
- expand_exit_loop_if_false (0, condition_conversion (cond));
- expand_end_loop ();
-
- clear_momentary ();
- finish_stmt ();
- }
- break;
-
- case IF_STMT:
- {
- tree tmp;
- int cond_scope = (TREE_CODE (TREE_OPERAND (t, 0)) == DECL_STMT);
-
- lineno = TREE_COMPLEXITY (t);
- if (cond_scope)
- do_pushlevel ();
- tmp = tsubst_expr (TREE_OPERAND (t, 0), args, nargs, in_decl);
- emit_line_note (input_filename, lineno);
- expand_start_cond (condition_conversion (tmp), 0);
-
- if (tmp = TREE_OPERAND (t, 1), tmp)
- tsubst_expr (tmp, args, nargs, in_decl);
-
- if (tmp = TREE_OPERAND (t, 2), tmp)
- {
- expand_start_else ();
- tsubst_expr (tmp, args, nargs, in_decl);
- }
-
- expand_end_cond ();
-
- if (cond_scope)
- do_poplevel ();
-
- finish_stmt ();
- }
- break;
-
- case COMPOUND_STMT:
- {
- tree substmt = TREE_OPERAND (t, 0);
-
- lineno = TREE_COMPLEXITY (t);
-
- if (COMPOUND_STMT_NO_SCOPE (t) == 0)
- do_pushlevel ();
-
- for (; substmt; substmt = TREE_CHAIN (substmt))
- tsubst_expr (substmt, args, nargs, in_decl);
-
- if (COMPOUND_STMT_NO_SCOPE (t) == 0)
- do_poplevel ();
- }
- break;
-
- case BREAK_STMT:
- lineno = TREE_COMPLEXITY (t);
- emit_line_note (input_filename, lineno);
- if (! expand_exit_something ())
- error ("break statement not within loop or switch");
- break;
-
- case CONTINUE_STMT:
- lineno = TREE_COMPLEXITY (t);
- emit_line_note (input_filename, lineno);
- if (! expand_continue_loop (0))
- error ("continue statement not within a loop");
- break;
-
- case SWITCH_STMT:
- {
- tree val, tmp;
- int cond_scope = (TREE_CODE (TREE_OPERAND (t, 0)) == DECL_STMT);
-
- lineno = TREE_COMPLEXITY (t);
- if (cond_scope)
- do_pushlevel ();
- val = tsubst_expr (TREE_OPERAND (t, 0), args, nargs, in_decl);
- emit_line_note (input_filename, lineno);
- c_expand_start_case (val);
- push_switch ();
-
- if (tmp = TREE_OPERAND (t, 1), tmp)
- tsubst_expr (tmp, args, nargs, in_decl);
-
- expand_end_case (val);
- pop_switch ();
-
- if (cond_scope)
- do_poplevel ();
-
- finish_stmt ();
- }
- break;
-
- case CASE_LABEL:
- do_case (tsubst_expr (TREE_OPERAND (t, 0), args, nargs, in_decl),
- tsubst_expr (TREE_OPERAND (t, 1), args, nargs, in_decl));
- break;
-
- case LABEL_DECL:
- t = define_label (DECL_SOURCE_FILE (t), DECL_SOURCE_LINE (t),
- DECL_NAME (t));
- if (t)
- expand_label (t);
- break;
-
- case GOTO_STMT:
- lineno = TREE_COMPLEXITY (t);
- emit_line_note (input_filename, lineno);
- if (TREE_CODE (TREE_OPERAND (t, 0)) == IDENTIFIER_NODE)
- {
- tree decl = lookup_label (TREE_OPERAND (t, 0));
- TREE_USED (decl) = 1;
- expand_goto (decl);
- }
- else
- expand_computed_goto
- (tsubst_expr (TREE_OPERAND (t, 0), args, nargs, in_decl));
- break;
-
- case TRY_BLOCK:
- lineno = TREE_COMPLEXITY (t);
- emit_line_note (input_filename, lineno);
- expand_start_try_stmts ();
- tsubst_expr (TREE_OPERAND (t, 0), args, nargs, in_decl);
- expand_start_all_catch ();
- {
- tree handler = TREE_OPERAND (t, 1);
- for (; handler; handler = TREE_CHAIN (handler))
- tsubst_expr (handler, args, nargs, in_decl);
- }
- expand_end_all_catch ();
- break;
-
- case HANDLER:
- lineno = TREE_COMPLEXITY (t);
- do_pushlevel ();
- if (TREE_OPERAND (t, 0))
- {
- tree d = TREE_OPERAND (t, 0);
- expand_start_catch_block
- (tsubst (TREE_OPERAND (d, 1), args, nargs, in_decl),
- tsubst (TREE_OPERAND (d, 0), args, nargs, in_decl));
- }
- else
- expand_start_catch_block (NULL_TREE, NULL_TREE);
- tsubst_expr (TREE_OPERAND (t, 1), args, nargs, in_decl);
- expand_end_catch_block ();
- do_poplevel ();
- break;
-
- default:
- return build_expr_from_tree (tsubst_copy (t, args, nargs, in_decl));
- }
- return NULL_TREE;
-}
-
-tree
-instantiate_template (tmpl, targ_ptr)
- tree tmpl, *targ_ptr;
-{
- tree fndecl;
- int i, len;
- struct obstack *old_fmp_obstack;
- extern struct obstack *function_maybepermanent_obstack;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- old_fmp_obstack = function_maybepermanent_obstack;
- function_maybepermanent_obstack = &permanent_obstack;
-
- my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 283);
- len = TREE_VEC_LENGTH (DECL_TEMPLATE_PARMS (tmpl));
-
- i = len;
- while (i--)
- {
- tree t = targ_ptr [i];
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
- {
- tree nt = target_type (t);
- if (IS_AGGR_TYPE (nt) && decl_function_context (TYPE_MAIN_DECL (nt)))
- {
- cp_error ("type `%T' composed from a local class is not a valid template-argument", t);
- cp_error (" trying to instantiate `%D'", tmpl);
- fndecl = error_mark_node;
- goto out;
- }
- }
- targ_ptr[i] = copy_to_permanent (t);
- }
-
- /* substitute template parameters */
- fndecl = tsubst (DECL_RESULT (tmpl), targ_ptr, len, tmpl);
-
- if (flag_external_templates)
- add_pending_template (fndecl);
-
- out:
- function_maybepermanent_obstack = old_fmp_obstack;
- pop_obstacks ();
-
- return fndecl;
-}
-
-/* Push the name of the class template into the scope of the instantiation. */
-
-void
-overload_template_name (type)
- tree type;
-{
- tree id = DECL_NAME (CLASSTYPE_TI_TEMPLATE (type));
- tree decl;
-
- if (IDENTIFIER_CLASS_VALUE (id)
- && TREE_TYPE (IDENTIFIER_CLASS_VALUE (id)) == type)
- return;
-
- decl = build_decl (TYPE_DECL, id, type);
- SET_DECL_ARTIFICIAL (decl);
- pushdecl_class_level (decl);
-}
-
-/* Type unification.
-
- We have a function template signature with one or more references to
- template parameters, and a parameter list we wish to fit to this
- template. If possible, produce a list of parameters for the template
- which will cause it to fit the supplied parameter list.
-
- Return zero for success, 2 for an incomplete match that doesn't resolve
- all the types, and 1 for complete failure. An error message will be
- printed only for an incomplete match.
-
- TPARMS[NTPARMS] is an array of template parameter types;
- TARGS[NTPARMS] is the array of template parameter values. PARMS is
- the function template's signature (using TEMPLATE_PARM_IDX nodes),
- and ARGS is the argument list we're trying to match against it.
-
- If SUBR is 1, we're being called recursively (to unify the arguments of
- a function or method parameter of a function template), so don't zero
- out targs and don't fail on an incomplete match.
-
- If STRICT is 1, the match must be exact (for casts of overloaded
- addresses, explicit instantiation, and more_specialized). */
-
-int
-type_unification (tparms, targs, parms, args, nsubsts, subr, strict)
- tree tparms, *targs, parms, args;
- int *nsubsts, subr, strict;
-{
- tree parm, arg;
- int i;
- int ntparms = TREE_VEC_LENGTH (tparms);
-
- my_friendly_assert (TREE_CODE (tparms) == TREE_VEC, 289);
- my_friendly_assert (TREE_CODE (parms) == TREE_LIST, 290);
- /* ARGS could be NULL (via a call from parse.y to
- build_x_function_call). */
- if (args)
- my_friendly_assert (TREE_CODE (args) == TREE_LIST, 291);
- my_friendly_assert (ntparms > 0, 292);
-
- if (!subr)
- bzero ((char *) targs, sizeof (tree) * ntparms);
-
- while (parms
- && parms != void_list_node
- && args
- && args != void_list_node)
- {
- parm = TREE_VALUE (parms);
- parms = TREE_CHAIN (parms);
- arg = TREE_VALUE (args);
- args = TREE_CHAIN (args);
-
- if (arg == error_mark_node)
- return 1;
- if (arg == unknown_type_node)
- return 1;
-
- if (! uses_template_parms (parm)
- && TREE_CODE_CLASS (TREE_CODE (arg)) != 't')
- {
- if (can_convert_arg (parm, TREE_TYPE (arg), arg))
- continue;
- return 1;
- }
-
-#if 0
- if (TREE_CODE (arg) == VAR_DECL)
- arg = TREE_TYPE (arg);
- else if (TREE_CODE_CLASS (TREE_CODE (arg)) == 'e')
- arg = TREE_TYPE (arg);
-#else
- if (TREE_CODE_CLASS (TREE_CODE (arg)) != 't')
- {
- my_friendly_assert (TREE_TYPE (arg) != NULL_TREE, 293);
- if (TREE_CODE (arg) == TREE_LIST
- && TREE_TYPE (arg) == unknown_type_node
- && TREE_CODE (TREE_VALUE (arg)) == TEMPLATE_DECL)
- {
- int nsubsts, ntparms;
- tree *targs;
-
- /* Have to back unify here */
- arg = TREE_VALUE (arg);
- nsubsts = 0;
- ntparms = TREE_VEC_LENGTH (DECL_TEMPLATE_PARMS (arg));
- targs = (tree *) alloca (sizeof (tree) * ntparms);
- parm = tree_cons (NULL_TREE, parm, NULL_TREE);
- return type_unification (DECL_TEMPLATE_PARMS (arg), targs,
- TYPE_ARG_TYPES (TREE_TYPE (arg)),
- parm, &nsubsts, 0, strict);
- }
- arg = TREE_TYPE (arg);
- }
-#endif
- if (TREE_CODE (arg) == REFERENCE_TYPE)
- arg = TREE_TYPE (arg);
-
- if (TREE_CODE (parm) != REFERENCE_TYPE)
- {
- if (TREE_CODE (arg) == FUNCTION_TYPE
- || TREE_CODE (arg) == METHOD_TYPE)
- arg = build_pointer_type (arg);
- else if (TREE_CODE (arg) == ARRAY_TYPE)
- arg = build_pointer_type (TREE_TYPE (arg));
- else
- arg = TYPE_MAIN_VARIANT (arg);
- }
-
- switch (unify (tparms, targs, ntparms, parm, arg, nsubsts, strict))
- {
- case 0:
- break;
- case 1:
- return 1;
- }
- }
- /* Fail if we've reached the end of the parm list, and more args
- are present, and the parm list isn't variadic. */
- if (args && args != void_list_node && parms == void_list_node)
- return 1;
- /* Fail if parms are left and they don't have default values. */
- if (parms
- && parms != void_list_node
- && TREE_PURPOSE (parms) == NULL_TREE)
- return 1;
- if (!subr)
- for (i = 0; i < ntparms; i++)
- if (!targs[i])
- {
- error ("incomplete type unification");
- return 2;
- }
- return 0;
-}
-
-/* Tail recursion is your friend. */
-
-static int
-unify (tparms, targs, ntparms, parm, arg, nsubsts, strict)
- tree tparms, *targs, parm, arg;
- int *nsubsts, ntparms, strict;
-{
- int idx;
-
- /* I don't think this will do the right thing with respect to types.
- But the only case I've seen it in so far has been array bounds, where
- signedness is the only information lost, and I think that will be
- okay. */
- while (TREE_CODE (parm) == NOP_EXPR)
- parm = TREE_OPERAND (parm, 0);
-
- if (arg == error_mark_node)
- return 1;
- if (arg == unknown_type_node)
- return 1;
- if (arg == parm)
- return 0;
-
- switch (TREE_CODE (parm))
- {
- case TEMPLATE_TYPE_PARM:
- (*nsubsts)++;
- idx = TEMPLATE_TYPE_IDX (parm);
- if (strict && (TYPE_READONLY (arg) < TYPE_READONLY (parm)
- || TYPE_VOLATILE (arg) < TYPE_VOLATILE (parm)))
- return 1;
-#if 0
- /* Template type parameters cannot contain cv-quals; i.e.
- template <class T> void f (T& a, T& b) will not generate
- void f (const int& a, const int& b). */
- if (TYPE_READONLY (arg) > TYPE_READONLY (parm)
- || TYPE_VOLATILE (arg) > TYPE_VOLATILE (parm))
- return 1;
- arg = TYPE_MAIN_VARIANT (arg);
-#else
- {
- int constp = TYPE_READONLY (arg) > TYPE_READONLY (parm);
- int volatilep = TYPE_VOLATILE (arg) > TYPE_VOLATILE (parm);
- arg = cp_build_type_variant (arg, constp, volatilep);
- }
-#endif
- /* Simple cases: Value already set, does match or doesn't. */
- if (targs[idx] == arg)
- return 0;
- else if (targs[idx])
- return 1;
- /* Check for mixed types and values. */
- if (TREE_CODE (TREE_VALUE (TREE_VEC_ELT (tparms, idx))) != TYPE_DECL)
- return 1;
- targs[idx] = arg;
- return 0;
- case TEMPLATE_CONST_PARM:
- (*nsubsts)++;
- idx = TEMPLATE_CONST_IDX (parm);
- if (targs[idx])
- {
- int i = cp_tree_equal (targs[idx], arg);
- if (i == 1)
- return 0;
- else if (i == 0)
- return 1;
- else
- my_friendly_abort (42);
- }
-
- targs[idx] = copy_to_permanent (arg);
- return 0;
-
- case POINTER_TYPE:
- if (TREE_CODE (arg) == RECORD_TYPE && TYPE_PTRMEMFUNC_FLAG (arg))
- return unify (tparms, targs, ntparms, parm,
- TYPE_PTRMEMFUNC_FN_TYPE (arg), nsubsts, strict);
-
- if (TREE_CODE (arg) != POINTER_TYPE)
- return 1;
- return unify (tparms, targs, ntparms, TREE_TYPE (parm), TREE_TYPE (arg),
- nsubsts, strict);
-
- case REFERENCE_TYPE:
- if (TREE_CODE (arg) == REFERENCE_TYPE)
- arg = TREE_TYPE (arg);
- return unify (tparms, targs, ntparms, TREE_TYPE (parm), arg,
- nsubsts, strict);
-
- case ARRAY_TYPE:
- if (TREE_CODE (arg) != ARRAY_TYPE)
- return 1;
- if (unify (tparms, targs, ntparms, TYPE_DOMAIN (parm), TYPE_DOMAIN (arg),
- nsubsts, strict) != 0)
- return 1;
- return unify (tparms, targs, ntparms, TREE_TYPE (parm), TREE_TYPE (arg),
- nsubsts, strict);
-
- case REAL_TYPE:
- case INTEGER_TYPE:
- if (TREE_CODE (arg) != TREE_CODE (parm))
- return 1;
-
- if (TREE_CODE (parm) == INTEGER_TYPE)
- {
- if (TYPE_MIN_VALUE (parm) && TYPE_MIN_VALUE (arg)
- && unify (tparms, targs, ntparms, TYPE_MIN_VALUE (parm),
- TYPE_MIN_VALUE (arg), nsubsts, strict))
- return 1;
- if (TYPE_MAX_VALUE (parm) && TYPE_MAX_VALUE (arg)
- && unify (tparms, targs, ntparms, TYPE_MAX_VALUE (parm),
- TYPE_MAX_VALUE (arg), nsubsts, strict))
- return 1;
- }
- /* As far as unification is concerned, this wins. Later checks
- will invalidate it if necessary. */
- return 0;
-
- /* Types INTEGER_CST and MINUS_EXPR can come from array bounds. */
- /* Type INTEGER_CST can come from ordinary constant template args. */
- case INTEGER_CST:
- while (TREE_CODE (arg) == NOP_EXPR)
- arg = TREE_OPERAND (arg, 0);
-
- if (TREE_CODE (arg) != INTEGER_CST)
- return 1;
- return !tree_int_cst_equal (parm, arg);
-
- case MINUS_EXPR:
- {
- tree t1, t2;
- t1 = TREE_OPERAND (parm, 0);
- t2 = TREE_OPERAND (parm, 1);
- return unify (tparms, targs, ntparms, t1,
- fold (build (PLUS_EXPR, integer_type_node, arg, t2)),
- nsubsts, strict);
- }
-
- case TREE_VEC:
- {
- int i;
- if (TREE_CODE (arg) != TREE_VEC)
- return 1;
- if (TREE_VEC_LENGTH (parm) != TREE_VEC_LENGTH (arg))
- return 1;
- for (i = TREE_VEC_LENGTH (parm) - 1; i >= 0; i--)
- if (unify (tparms, targs, ntparms,
- TREE_VEC_ELT (parm, i), TREE_VEC_ELT (arg, i),
- nsubsts, strict))
- return 1;
- return 0;
- }
-
- case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_FLAG (parm))
- return unify (tparms, targs, ntparms, TYPE_PTRMEMFUNC_FN_TYPE (parm),
- arg, nsubsts, strict);
-
- /* Allow trivial conversions. */
- if (TREE_CODE (arg) != RECORD_TYPE
- || TYPE_READONLY (parm) < TYPE_READONLY (arg)
- || TYPE_VOLATILE (parm) < TYPE_VOLATILE (arg))
- return 1;
-
- if (CLASSTYPE_TEMPLATE_INFO (parm) && uses_template_parms (parm))
- {
- tree t = NULL_TREE;
- if (flag_ansi_overloading && ! strict)
- t = get_template_base (CLASSTYPE_TI_TEMPLATE (parm), arg);
- else if
- (CLASSTYPE_TEMPLATE_INFO (arg)
- && CLASSTYPE_TI_TEMPLATE (parm) == CLASSTYPE_TI_TEMPLATE (arg))
- t = arg;
- if (! t || t == error_mark_node)
- return 1;
-
- return unify (tparms, targs, ntparms, CLASSTYPE_TI_ARGS (parm),
- CLASSTYPE_TI_ARGS (t), nsubsts, strict);
- }
- else if (TYPE_MAIN_VARIANT (parm) != TYPE_MAIN_VARIANT (arg))
- return 1;
- return 0;
-
- case METHOD_TYPE:
- if (TREE_CODE (arg) != METHOD_TYPE)
- return 1;
- goto check_args;
-
- case FUNCTION_TYPE:
- if (TREE_CODE (arg) != FUNCTION_TYPE)
- return 1;
- check_args:
- if (unify (tparms, targs, ntparms, TREE_TYPE (parm),
- TREE_TYPE (arg), nsubsts, strict))
- return 1;
- return type_unification (tparms, targs, TYPE_ARG_TYPES (parm),
- TYPE_ARG_TYPES (arg), nsubsts, 1, strict);
-
- case OFFSET_TYPE:
- if (TREE_CODE (arg) != OFFSET_TYPE)
- return 1;
- if (unify (tparms, targs, ntparms, TYPE_OFFSET_BASETYPE (parm),
- TYPE_OFFSET_BASETYPE (arg), nsubsts, strict))
- return 1;
- return unify (tparms, targs, ntparms, TREE_TYPE (parm),
- TREE_TYPE (arg), nsubsts, strict);
-
- default:
- sorry ("use of `%s' in template type unification",
- tree_code_name [(int) TREE_CODE (parm)]);
- return 1;
- }
-}
-
-void
-mark_decl_instantiated (result, extern_p)
- tree result;
- int extern_p;
-{
- if (DECL_TEMPLATE_INSTANTIATION (result))
- SET_DECL_EXPLICIT_INSTANTIATION (result);
- TREE_PUBLIC (result) = 1;
-
- if (! extern_p)
- {
- DECL_INTERFACE_KNOWN (result) = 1;
- DECL_NOT_REALLY_EXTERN (result) = 1;
- }
- else if (TREE_CODE (result) == FUNCTION_DECL)
- mark_inline_for_output (result);
-}
-
-/* Given two function templates PAT1 and PAT2, return:
-
- 1 if PAT1 is more specialized than PAT2 as described in [temp.func.order].
- -1 if PAT2 is more specialized than PAT1.
- 0 if neither is more specialized. */
-
-int
-more_specialized (pat1, pat2)
- tree pat1, pat2;
-{
- tree *targs;
- int winner = 0;
-
- targs = get_bindings (pat1, pat2);
- if (targs)
- {
- free (targs);
- --winner;
- }
-
- targs = get_bindings (pat2, pat1);
- if (targs)
- {
- free (targs);
- ++winner;
- }
-
- return winner;
-}
-
-/* Given two class template specialization list nodes PAT1 and PAT2, return:
-
- 1 if PAT1 is more specialized than PAT2 as described in [temp.class.order].
- -1 if PAT2 is more specialized than PAT1.
- 0 if neither is more specialized. */
-
-int
-more_specialized_class (pat1, pat2)
- tree pat1, pat2;
-{
- tree targs;
- int winner = 0;
-
- targs = get_class_bindings
- (TREE_VALUE (pat1), TREE_PURPOSE (pat1), TREE_PURPOSE (pat2));
- if (targs)
- --winner;
-
- targs = get_class_bindings
- (TREE_VALUE (pat2), TREE_PURPOSE (pat2), TREE_PURPOSE (pat1));
- if (targs)
- ++winner;
-
- return winner;
-}
-
-/* Return the template arguments that will produce the function signature
- DECL from the function template FN. */
-
-tree *
-get_bindings (fn, decl)
- tree fn, decl;
-{
- int ntparms = TREE_VEC_LENGTH (DECL_TEMPLATE_PARMS (fn));
- tree *targs = (tree *) malloc (sizeof (tree) * ntparms);
- int i, dummy = 0;
- i = type_unification (DECL_TEMPLATE_PARMS (fn), targs,
- TYPE_ARG_TYPES (TREE_TYPE (fn)),
- TYPE_ARG_TYPES (TREE_TYPE (decl)),
- &dummy, 0, 1);
- if (i == 0)
- return targs;
- free (targs);
- return 0;
-}
-
-static tree
-get_class_bindings (tparms, parms, args)
- tree tparms, parms, args;
-{
- int i, dummy, ntparms = TREE_VEC_LENGTH (tparms);
- tree vec = make_temp_vec (ntparms);
-
- for (i = 0; i < TREE_VEC_LENGTH (parms); ++i)
- {
- switch (unify (tparms, &TREE_VEC_ELT (vec, 0), ntparms,
- TREE_VEC_ELT (parms, i), TREE_VEC_ELT (args, i),
- &dummy, 1))
- {
- case 0:
- break;
- case 1:
- return NULL_TREE;
- }
- }
-
- for (i = 0; i < ntparms; ++i)
- if (! TREE_VEC_ELT (vec, i))
- return NULL_TREE;
-
- return vec;
-}
-
-/* Return the most specialized of the list of templates in FNS that can
- produce an instantiation matching DECL. */
-
-tree
-most_specialized (fns, decl)
- tree fns, decl;
-{
- tree fn, champ, *args, *p;
- int fate;
-
- for (p = &fns; *p; )
- {
- args = get_bindings (TREE_VALUE (*p), decl);
- if (args)
- {
- free (args);
- p = &TREE_CHAIN (*p);
- }
- else
- *p = TREE_CHAIN (*p);
- }
-
- if (! fns)
- return NULL_TREE;
-
- fn = fns;
- champ = TREE_VALUE (fn);
- fn = TREE_CHAIN (fn);
- for (; fn; fn = TREE_CHAIN (fn))
- {
- fate = more_specialized (champ, TREE_VALUE (fn));
- if (fate == 1)
- ;
- else
- {
- if (fate == 0)
- {
- fn = TREE_CHAIN (fn);
- if (! fn)
- return error_mark_node;
- }
- champ = TREE_VALUE (fn);
- }
- }
-
- for (fn = fns; fn && TREE_VALUE (fn) != champ; fn = TREE_CHAIN (fn))
- {
- fate = more_specialized (champ, TREE_VALUE (fn));
- if (fate != 1)
- return error_mark_node;
- }
-
- return champ;
-}
-
-/* Return the most specialized of the class template specializations in
- SPECS that can produce an instantiation matching ARGS. */
-
-tree
-most_specialized_class (specs, mainargs)
- tree specs, mainargs;
-{
- tree list = NULL_TREE, t, args, champ;
- int fate;
-
- for (t = specs; t; t = TREE_CHAIN (t))
- {
- args = get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t), mainargs);
- if (args)
- {
- list = decl_tree_cons (TREE_PURPOSE (t), TREE_VALUE (t), list);
- TREE_TYPE (list) = TREE_TYPE (t);
- }
- }
-
- if (! list)
- return NULL_TREE;
-
- t = list;
- champ = t;
- t = TREE_CHAIN (t);
- for (; t; t = TREE_CHAIN (t))
- {
- fate = more_specialized_class (champ, t);
- if (fate == 1)
- ;
- else
- {
- if (fate == 0)
- {
- t = TREE_CHAIN (t);
- if (! t)
- return error_mark_node;
- }
- champ = t;
- }
- }
-
- for (t = list; t && t != champ; t = TREE_CHAIN (t))
- {
- fate = more_specialized (champ, t);
- if (fate != 1)
- return error_mark_node;
- }
-
- return champ;
-}
-
-/* called from the parser. */
-
-void
-do_function_instantiation (declspecs, declarator, storage)
- tree declspecs, declarator, storage;
-{
- tree decl = grokdeclarator (declarator, declspecs, NORMAL, 0, NULL_TREE);
- tree name;
- tree fn;
- tree result = NULL_TREE;
- int extern_p = 0;
-
- if (! DECL_LANG_SPECIFIC (decl))
- {
- cp_error ("explicit instantiation of non-template `%#D'", decl);
- return;
- }
-
- /* If we've already seen this template instance, use it. */
- if (DECL_FUNCTION_MEMBER_P (decl))
- {
- if (DECL_TEMPLATE_INSTANTIATION (decl))
- result = decl;
- else if (name = DECL_ASSEMBLER_NAME (decl),
- fn = IDENTIFIER_GLOBAL_VALUE (name),
- fn && DECL_TEMPLATE_INSTANTIATION (fn))
- result = fn;
- }
- else if (name = DECL_NAME (decl), fn = IDENTIFIER_GLOBAL_VALUE (name), fn)
- {
- tree templates = NULL_TREE;
- for (fn = get_first_fn (fn); fn; fn = DECL_CHAIN (fn))
- if (decls_match (fn, decl)
- && DECL_DEFER_OUTPUT (fn))
- {
- result = fn;
- break;
- }
- else if (TREE_CODE (fn) == TEMPLATE_DECL)
- templates = decl_tree_cons (NULL_TREE, fn, templates);
-
- if (! result)
- {
- tree *args;
- result = most_specialized (templates, decl);
- if (result == error_mark_node)
- {
- char *str = "candidates are:";
- cp_error ("ambiguous template instantiation for `%D' requested", decl);
- for (fn = templates; fn; fn = TREE_CHAIN (fn))
- {
- cp_error_at ("%s %+#D", str, TREE_VALUE (fn));
- str = " ";
- }
- return;
- }
- else if (result)
- {
- args = get_bindings (result, decl);
- result = instantiate_template (result, args);
- free (args);
- }
- }
- }
- if (! result)
- {
- cp_error ("no matching template for `%D' found", decl);
- return;
- }
-
- if (flag_external_templates)
- return;
-
- if (storage == NULL_TREE)
- ;
- else if (storage == ridpointers[(int) RID_EXTERN])
- extern_p = 1;
- else
- cp_error ("storage class `%D' applied to template instantiation",
- storage);
-
- mark_decl_instantiated (result, extern_p);
- repo_template_instantiated (result, extern_p);
- if (! extern_p)
- instantiate_decl (result);
-}
-
-void
-mark_class_instantiated (t, extern_p)
- tree t;
- int extern_p;
-{
- SET_CLASSTYPE_EXPLICIT_INSTANTIATION (t);
- SET_CLASSTYPE_INTERFACE_KNOWN (t);
- CLASSTYPE_INTERFACE_ONLY (t) = extern_p;
- CLASSTYPE_VTABLE_NEEDS_WRITING (t) = ! extern_p;
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = extern_p;
- if (! extern_p)
- {
- CLASSTYPE_DEBUG_REQUESTED (t) = 1;
- rest_of_type_compilation (t, 1);
- }
-}
-
-void
-do_type_instantiation (name, storage)
- tree name, storage;
-{
- tree t = TREE_TYPE (name);
- int extern_p = 0;
- int nomem_p = 0;
- int static_p = 0;
-
- complete_type (t);
-
- /* With -fexternal-templates, explicit instantiations are treated the same
- as implicit ones. */
- if (flag_external_templates)
- return;
-
- if (TYPE_SIZE (t) == NULL_TREE)
- {
- cp_error ("explicit instantiation of `%#T' before definition of template",
- t);
- return;
- }
-
- if (storage == NULL_TREE)
- /* OK */;
- else if (storage == ridpointers[(int) RID_INLINE])
- nomem_p = 1;
- else if (storage == ridpointers[(int) RID_EXTERN])
- extern_p = 1;
- else if (storage == ridpointers[(int) RID_STATIC])
- static_p = 1;
- else
- {
- cp_error ("storage class `%D' applied to template instantiation",
- storage);
- extern_p = 0;
- }
-
- /* We've already instantiated this. */
- if (CLASSTYPE_EXPLICIT_INSTANTIATION (t) && ! CLASSTYPE_INTERFACE_ONLY (t)
- && extern_p)
- return;
-
- if (! CLASSTYPE_TEMPLATE_SPECIALIZATION (t))
- {
- mark_class_instantiated (t, extern_p);
- repo_template_instantiated (t, extern_p);
- }
-
- if (nomem_p)
- return;
-
- {
- tree tmp;
-
- if (! static_p)
- for (tmp = TYPE_METHODS (t); tmp; tmp = TREE_CHAIN (tmp))
- if (DECL_TEMPLATE_INSTANTIATION (tmp))
- {
- mark_decl_instantiated (tmp, extern_p);
- repo_template_instantiated (tmp, extern_p);
- if (! extern_p)
- instantiate_decl (tmp);
- }
-
- for (tmp = TYPE_FIELDS (t); tmp; tmp = TREE_CHAIN (tmp))
- if (TREE_CODE (tmp) == VAR_DECL && DECL_TEMPLATE_INSTANTIATION (tmp))
- {
- mark_decl_instantiated (tmp, extern_p);
- repo_template_instantiated (tmp, extern_p);
- if (! extern_p)
- instantiate_decl (tmp);
- }
-
- for (tmp = CLASSTYPE_TAGS (t); tmp; tmp = TREE_CHAIN (tmp))
- if (IS_AGGR_TYPE (TREE_VALUE (tmp)))
- do_type_instantiation (TYPE_MAIN_DECL (TREE_VALUE (tmp)), storage);
- }
-}
-
-tree
-instantiate_decl (d)
- tree d;
-{
- tree ti = DECL_TEMPLATE_INFO (d);
- tree tmpl = TI_TEMPLATE (ti);
- tree args = TI_ARGS (ti);
- tree td;
- tree pattern = DECL_TEMPLATE_RESULT (tmpl);
- tree save_ti;
- int nested = in_function_p ();
- int d_defined;
- int pattern_defined;
- int line = lineno;
- char *file = input_filename;
-
- if (TREE_CODE (d) == FUNCTION_DECL)
- {
- d_defined = (DECL_INITIAL (d) != NULL_TREE);
- pattern_defined = (DECL_INITIAL (pattern) != NULL_TREE);
- }
- else
- {
- d_defined = ! DECL_IN_AGGR_P (d);
- pattern_defined = ! DECL_IN_AGGR_P (pattern);
- }
-
- if (d_defined)
- return d;
-
- /* This needs to happen before any tsubsting. */
- if (! push_tinst_level (d))
- return d;
-
- push_to_top_level ();
- lineno = DECL_SOURCE_LINE (d);
- input_filename = DECL_SOURCE_FILE (d);
-
- /* We need to set up DECL_INITIAL regardless of pattern_defined if the
- variable is a static const initialized in the class body. */
- if (TREE_CODE (d) == VAR_DECL
- && ! DECL_INITIAL (d) && DECL_INITIAL (pattern))
- {
- pushclass (DECL_CONTEXT (d), 2);
- DECL_INITIAL (d) = tsubst_expr
- (DECL_INITIAL (pattern), &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), tmpl);
- popclass (1);
- }
-
- /* import_export_decl has to happen after DECL_INITIAL is set up. */
- if (pattern_defined)
- {
- repo_template_used (d);
-
- if (flag_external_templates && ! DECL_INTERFACE_KNOWN (d))
- {
- if (flag_alt_external_templates)
- {
- if (interface_unknown)
- warn_if_unknown_interface (d);
- }
- else if (DECL_INTERFACE_KNOWN (pattern))
- {
- DECL_INTERFACE_KNOWN (d) = 1;
- DECL_NOT_REALLY_EXTERN (d) = ! DECL_EXTERNAL (pattern);
- }
- else
- warn_if_unknown_interface (pattern);
- }
-
- if (at_eof)
- import_export_decl (d);
- }
-
- if (! pattern_defined
- || (TREE_CODE (d) == FUNCTION_DECL && ! DECL_INLINE (d)
- && (! DECL_INTERFACE_KNOWN (d)
- || ! DECL_NOT_REALLY_EXTERN (d)))
- /* Kludge: if we compile a constructor in the middle of processing a
- toplevel declaration, we blow away the declspecs in
- temp_decl_obstack when we call permanent_allocation in
- finish_function. So don't compile it yet. */
- || (TREE_CODE (d) == FUNCTION_DECL && ! nested && ! at_eof))
- {
- add_pending_template (d);
- goto out;
- }
-
- lineno = DECL_SOURCE_LINE (d);
- input_filename = DECL_SOURCE_FILE (d);
-
- /* Trick tsubst into giving us a new decl in case the template changed. */
- save_ti = DECL_TEMPLATE_INFO (pattern);
- DECL_TEMPLATE_INFO (pattern) = NULL_TREE;
- td = tsubst (pattern, &TREE_VEC_ELT (args, 0), TREE_VEC_LENGTH (args), tmpl);
- DECL_TEMPLATE_INFO (pattern) = save_ti;
-
- /* And set up DECL_INITIAL, since tsubst doesn't. */
- if (TREE_CODE (td) == VAR_DECL)
- {
- pushclass (DECL_CONTEXT (d), 2);
- DECL_INITIAL (td) = tsubst_expr
- (DECL_INITIAL (pattern), &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), tmpl);
- popclass (1);
- }
-
- /* Convince duplicate_decls to use the DECL_ARGUMENTS from the new decl. */
- if (TREE_CODE (d) == FUNCTION_DECL)
- DECL_INITIAL (td) = error_mark_node;
- duplicate_decls (td, d);
- if (TREE_CODE (d) == FUNCTION_DECL)
- DECL_INITIAL (td) = 0;
-
- if (TREE_CODE (d) == VAR_DECL)
- {
- DECL_IN_AGGR_P (d) = 0;
- if (DECL_INTERFACE_KNOWN (d))
- DECL_EXTERNAL (d) = ! DECL_NOT_REALLY_EXTERN (d);
- else
- {
- DECL_EXTERNAL (d) = 1;
- DECL_NOT_REALLY_EXTERN (d) = 1;
- }
- cp_finish_decl (d, DECL_INITIAL (d), NULL_TREE, 0, 0);
- }
- else if (TREE_CODE (d) == FUNCTION_DECL)
- {
- tree t = DECL_SAVED_TREE (pattern);
-
- start_function (NULL_TREE, d, NULL_TREE, 1);
- store_parm_decls ();
-
- if (t && TREE_CODE (t) == RETURN_INIT)
- {
- store_return_init
- (TREE_OPERAND (t, 0),
- tsubst_expr (TREE_OPERAND (t, 1), &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), tmpl));
- t = TREE_CHAIN (t);
- }
-
- if (t && TREE_CODE (t) == CTOR_INITIALIZER)
- {
- current_member_init_list
- = tsubst_expr_values (TREE_OPERAND (t, 0), args);
- current_base_init_list
- = tsubst_expr_values (TREE_OPERAND (t, 1), args);
- t = TREE_CHAIN (t);
- }
-
- setup_vtbl_ptr ();
- /* Always keep the BLOCK node associated with the outermost
- pair of curley braces of a function. These are needed
- for correct operation of dwarfout.c. */
- keep_next_level ();
-
- my_friendly_assert (TREE_CODE (t) == COMPOUND_STMT, 42);
- tsubst_expr (t, &TREE_VEC_ELT (args, 0),
- TREE_VEC_LENGTH (args), tmpl);
-
- finish_function (lineno, 0, nested);
- }
-
-out:
- lineno = line;
- input_filename = file;
-
- pop_from_top_level ();
- pop_tinst_level ();
-
- return d;
-}
-
-tree
-tsubst_chain (t, argvec)
- tree t, argvec;
-{
- if (t)
- {
- tree first = tsubst (t, &TREE_VEC_ELT (argvec, 0),
- TREE_VEC_LENGTH (argvec), NULL_TREE);
- tree last = first;
-
- for (t = TREE_CHAIN (t); t; t = TREE_CHAIN (t))
- {
- tree x = tsubst (t, &TREE_VEC_ELT (argvec, 0),
- TREE_VEC_LENGTH (argvec), NULL_TREE);
- TREE_CHAIN (last) = x;
- last = x;
- }
-
- return first;
- }
- return NULL_TREE;
-}
-
-static tree
-tsubst_expr_values (t, argvec)
- tree t, argvec;
-{
- tree first = NULL_TREE;
- tree *p = &first;
-
- for (; t; t = TREE_CHAIN (t))
- {
- tree pur = tsubst_copy (TREE_PURPOSE (t), &TREE_VEC_ELT (argvec, 0),
- TREE_VEC_LENGTH (argvec), NULL_TREE);
- tree val = tsubst_expr (TREE_VALUE (t), &TREE_VEC_ELT (argvec, 0),
- TREE_VEC_LENGTH (argvec), NULL_TREE);
- *p = build_tree_list (pur, val);
- p = &TREE_CHAIN (*p);
- }
- return first;
-}
-
-tree last_tree;
-
-void
-add_tree (t)
- tree t;
-{
- last_tree = TREE_CHAIN (last_tree) = t;
-}
-
-/* D is an undefined function declaration in the presence of templates with
- the same name, listed in FNS. If one of them can produce D as an
- instantiation, remember this so we can instantiate it at EOF if D has
- not been defined by that time. */
-
-void
-add_maybe_template (d, fns)
- tree d, fns;
-{
- tree t;
-
- if (DECL_MAYBE_TEMPLATE (d))
- return;
-
- t = most_specialized (fns, d);
- if (! t)
- return;
- if (t == error_mark_node)
- {
- cp_error ("ambiguous template instantiation for `%D'", d);
- return;
- }
-
- *maybe_template_tail = perm_tree_cons (t, d, NULL_TREE);
- maybe_template_tail = &TREE_CHAIN (*maybe_template_tail);
- DECL_MAYBE_TEMPLATE (d) = 1;
-}
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
deleted file mode 100644
index 5a859561512..00000000000
--- a/gcc/cp/ptree.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Prints out trees in human readable form.
- Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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 "tree.h"
-#include <stdio.h>
-#include "cp-tree.h"
-
-void
-print_lang_decl (file, node, indent)
- FILE *file;
- tree node;
- int indent;
-{
- if (!DECL_LANG_SPECIFIC (node))
- return;
- /* A FIELD_DECL only has the flags structure, which we aren't displaying
- anyways. */
- if (DECL_MUTABLE_P (node))
- {
- indent_to (file, indent + 3);
- fprintf (file, " mutable ");
- }
- if (TREE_CODE (node) == FIELD_DECL)
- return;
- indent_to (file, indent + 3);
- if (DECL_MAIN_VARIANT (node))
- {
- fprintf (file, " decl-main-variant ");
- fprintf (file, HOST_PTR_PRINTF, DECL_MAIN_VARIANT (node));
- }
- if (DECL_PENDING_INLINE_INFO (node))
- {
- fprintf (file, " pending-inline-info ");
- fprintf (file, HOST_PTR_PRINTF, DECL_PENDING_INLINE_INFO (node));
- }
- if (DECL_TEMPLATE_INFO (node))
- {
- fprintf (file, " template-info ");
- fprintf (file, HOST_PTR_PRINTF, DECL_TEMPLATE_INFO (node));
- }
-}
-
-void
-print_lang_type (file, node, indent)
- FILE *file;
- register tree node;
- int indent;
-{
- if (TREE_CODE (node) == TEMPLATE_TYPE_PARM)
- {
- print_node (file, "tinfo", TYPE_VALUES (node), indent + 4);
- return;
- }
-
- if (! (TREE_CODE (node) == RECORD_TYPE
- || TREE_CODE (node) == UNION_TYPE))
- return;
-
- if (!TYPE_LANG_SPECIFIC (node))
- return;
-
- indent_to (file, indent + 3);
-
- if (TYPE_NEEDS_CONSTRUCTING (node))
- fputs ( "needs-constructor", file);
- if (TYPE_NEEDS_DESTRUCTOR (node))
- fputs (" needs-destructor", 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-type-conversion", file);
- if (TYPE_HAS_INT_CONVERSION (node))
- fputs (" has-int-conversion", file);
- if (TYPE_HAS_REAL_CONVERSION (node))
- fputs (" has-float-conversion", 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_GETS_NEW (node) & 1)
- fputs (" new", file);
- if (TYPE_GETS_NEW (node) & 2)
- fputs (" new[]", file);
- if (TYPE_GETS_DELETE (node) & 1)
- fputs (" delete", file);
- if (TYPE_GETS_DELETE (node) & 2)
- fputs (" delete[]", file);
- if (TYPE_HAS_ASSIGNMENT (node))
- fputs (" has=", file);
- if (TYPE_HAS_ASSIGN_REF (node))
- fputs (" this=(X&)", file);
- if (TYPE_OVERLOADS_METHOD_CALL_EXPR (node))
- fputs (" op->()", file);
- if (TYPE_GETS_INIT_AGGR (node))
- fputs (" gets X(X, ...)", file);
- if (TYPE_OVERLOADS_CALL_EXPR (node))
- fputs (" op()", file);
- if (TYPE_OVERLOADS_ARRAY_REF (node))
- fputs (" op[]", file);
- if (TYPE_OVERLOADS_ARROW (node))
- fputs (" op->", file);
- if (TYPE_USES_MULTIPLE_INHERITANCE (node))
- fputs (" uses-multiple-inheritance", file);
-
- if (TREE_CODE (node) == RECORD_TYPE)
- {
- fprintf (file, " n_parents %d n_ancestors %d",
- CLASSTYPE_N_BASECLASSES (node),
- CLASSTYPE_N_SUPERCLASSES (node));
- fprintf (file, " use_template=%d", CLASSTYPE_USE_TEMPLATE (node));
- if (CLASSTYPE_INTERFACE_ONLY (node))
- fprintf (file, " interface-only");
- if (CLASSTYPE_INTERFACE_UNKNOWN (node))
- fprintf (file, " interface-unknown");
- print_node (file, "member-functions", CLASSTYPE_METHOD_VEC (node),
- indent + 4);
- print_node (file, "baselinks",
- TYPE_BINFO_BASETYPES (node) ? CLASSTYPE_BASELINK_VEC (node) : NULL_TREE,
- indent + 4);
- }
-}
-
-void
-print_lang_identifier (file, node, indent)
- FILE *file;
- tree node;
- int indent;
-{
- print_node (file, "global", IDENTIFIER_GLOBAL_VALUE (node), indent + 4);
- print_node (file, "class", IDENTIFIER_CLASS_VALUE (node), indent + 4);
- print_node (file, "local", IDENTIFIER_LOCAL_VALUE (node), indent + 4);
- print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
- print_node (file, "template", IDENTIFIER_TEMPLATE (node), indent + 4);
- print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4);
- print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4);
-}
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
deleted file mode 100644
index 47a111bc00d..00000000000
--- a/gcc/cp/repo.c
+++ /dev/null
@@ -1,413 +0,0 @@
-/* Code to maintain a C++ template repository.
- Copyright (C) 1995 Free Software Foundation, Inc.
- Contributed by Jason Merrill (jason@cygnus.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. */
-
-/* My strategy here is as follows:
-
- Everything should be emitted in a translation unit where it is used.
- The results of the automatic process should be easily reproducible with
- explicit code. */
-
-#include <stdio.h>
-#include "config.h"
-#include "tree.h"
-#include "cp-tree.h"
-#include "input.h"
-#include "obstack.h"
-
-extern char * rindex ();
-extern char * getenv ();
-extern char * getpwd ();
-
-static tree pending_repo;
-static tree original_repo;
-static char *repo_name;
-static FILE *repo_file;
-
-extern int flag_use_repository;
-extern int errorcount, sorrycount;
-extern struct obstack temporary_obstack;
-extern struct obstack permanent_obstack;
-
-#define IDENTIFIER_REPO_USED(NODE) (TREE_LANG_FLAG_3 (NODE))
-#define IDENTIFIER_REPO_CHOSEN(NODE) (TREE_LANG_FLAG_4 (NODE))
-
-#if 0
-/* Record the flags used to compile this translation unit. */
-
-void
-repo_compile_flags (argc, argv)
- int argc;
- char **argv;
-{
-}
-
-/* If this template has not been seen before, add a note to the repository
- saying where the declaration was. This may be used to find the
- definition at link time. */
-
-void
-repo_template_declared (t)
- tree t;
-{}
-
-/* Note where the definition of a template lives so that instantiations can
- be generated later. */
-
-void
-repo_template_defined (t)
- tree t;
-{}
-
-/* Note where the definition of a class lives to that template
- instantiations can use it. */
-
-void
-repo_class_defined (t)
- tree t;
-{}
-#endif
-
-static tree
-repo_get_id (t)
- tree t;
-{
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
- {
- t = TYPE_BINFO_VTABLE (t);
- if (t == NULL_TREE)
- return t;
- }
- return DECL_ASSEMBLER_NAME (t);
-}
-
-/* Note that a template has been used. If we can see the definition, offer
- to emit it. */
-
-void
-repo_template_used (t)
- tree t;
-{
- tree id;
-
- if (! flag_use_repository)
- return;
-
- id = repo_get_id (t);
- if (id == NULL_TREE)
- return;
-
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
- {
- if (IDENTIFIER_REPO_CHOSEN (id))
- mark_class_instantiated (t, 0);
- }
- else if (TREE_CODE_CLASS (TREE_CODE (t)) == 'd')
- {
- if (IDENTIFIER_REPO_CHOSEN (id))
- mark_decl_instantiated (t, 0);
- }
- else
- my_friendly_abort (1);
-
- if (! IDENTIFIER_REPO_USED (id))
- {
- IDENTIFIER_REPO_USED (id) = 1;
- pending_repo = perm_tree_cons (NULL_TREE, id, pending_repo);
- }
-}
-
-#if 0
-/* Note that the vtable for a class has been used, and offer to emit it. */
-
-static void
-repo_vtable_used (t)
- tree t;
-{
- if (! flag_use_repository)
- return;
-
- pending_repo = perm_tree_cons (NULL_TREE, t, pending_repo);
-}
-
-/* Note that an inline with external linkage has been used, and offer to
- emit it. */
-
-void
-repo_inline_used (fn)
- tree fn;
-{
- if (! flag_use_repository)
- return;
-
- /* Member functions of polymorphic classes go with their vtables. */
- if (DECL_FUNCTION_MEMBER_P (fn) && TYPE_VIRTUAL_P (DECL_CLASS_CONTEXT (fn)))
- {
- repo_vtable_used (DECL_CLASS_CONTEXT (fn));
- return;
- }
-
- pending_repo = perm_tree_cons (NULL_TREE, fn, pending_repo);
-}
-
-/* Note that a particular typeinfo node has been used, and offer to
- emit it. */
-
-void
-repo_tinfo_used (ti)
- tree ti;
-{
-}
-#endif
-
-void
-repo_template_instantiated (t, extern_p)
- tree t;
- int extern_p;
-{
- if (! extern_p)
- {
- tree id = repo_get_id (t);
- if (id)
- IDENTIFIER_REPO_CHOSEN (id) = 1;
- }
-}
-
-static char *
-save_string (s, len)
- char *s;
- int len;
-{
- return obstack_copy0 (&temporary_obstack, s, len);
-}
-
-static char *
-get_base_filename (filename)
- char *filename;
-{
- char *p = getenv ("COLLECT_GCC_OPTIONS");
- char *output = 0;
- int compiling = 0;
-
- if (p)
- while (*p)
- {
- char *q = p;
- while (*q && *q != ' ') q++;
- if (*p == '-' && p[1] == 'o')
- {
- p += 2;
- if (p == q)
- {
- p++; q++;
- if (*q)
- while (*q && *q != ' ') q++;
- }
-
- output = save_string (p, q - p);
- }
- else if (*p == '-' && p[1] == 'c')
- compiling = 1;
- if (*q) q++;
- p = q;
- }
-
- if (compiling && output)
- return output;
-
- if (p && ! compiling)
- {
- warning ("-frepo must be used with -c");
- flag_use_repository = 0;
- return NULL;
- }
-
- p = rindex (filename, '/');
- if (p)
- return p+1;
- else
- return filename;
-}
-
-static void
-open_repo_file (filename)
- char *filename;
-{
- register char *p;
- char *s = get_base_filename (filename);
-
- if (s == NULL)
- return;
-
- p = rindex (s, '/');
- if (! p)
- p = s;
- p = rindex (p, '.');
- if (! p)
- p = s + strlen (s);
-
- obstack_grow (&permanent_obstack, s, p - s);
- repo_name = obstack_copy0 (&permanent_obstack, ".rpo", 4);
-
- repo_file = fopen (repo_name, "r");
-}
-
-static char *
-afgets (stream)
- FILE *stream;
-{
- int c;
- while ((c = getc (stream)) != EOF && c != '\n')
- obstack_1grow (&temporary_obstack, c);
- if (obstack_object_size (&temporary_obstack) == 0)
- return NULL;
- obstack_1grow (&temporary_obstack, '\0');
- return obstack_finish (&temporary_obstack);
-}
-
-void
-init_repo (filename)
- char *filename;
-{
- char *buf;
-
- if (! flag_use_repository)
- return;
-
- open_repo_file (filename);
-
- if (repo_file == 0)
- return;
-
- while (buf = afgets (repo_file))
- {
- switch (buf[0])
- {
- case 'A':
- case 'D':
- case 'M':
- break;
- case 'C':
- case 'O':
- {
- tree id = get_identifier (buf + 2);
- tree orig;
-
- if (buf[0] == 'C')
- {
- IDENTIFIER_REPO_CHOSEN (id) = 1;
- orig = integer_one_node;
- }
- else
- orig = NULL_TREE;
-
- original_repo = perm_tree_cons (orig, id, original_repo);
- }
- break;
- default:
- error ("mysterious repository information in %s", repo_name);
- }
- obstack_free (&temporary_obstack, buf);
- }
-}
-
-static void
-reopen_repo_file_for_write ()
-{
- if (repo_file)
- fclose (repo_file);
- repo_file = fopen (repo_name, "w");
-
- if (repo_file == 0)
- {
- error ("can't create repository information file `%s'", repo_name);
- flag_use_repository = 0;
- }
-}
-
-/* Emit any pending repos. */
-
-void
-finish_repo ()
-{
- tree t;
- char *p;
- int repo_changed = 0;
-
- if (! flag_use_repository)
- return;
-
- /* Do we have to write out a new info file? */
-
- /* Are there any old templates that aren't used any longer or that are
- newly chosen? */
-
- for (t = original_repo; t; t = TREE_CHAIN (t))
- {
- if (! IDENTIFIER_REPO_USED (TREE_VALUE (t))
- || (! TREE_PURPOSE (t) && IDENTIFIER_REPO_CHOSEN (TREE_VALUE (t))))
- {
- repo_changed = 1;
- break;
- }
- IDENTIFIER_REPO_USED (TREE_VALUE (t)) = 0;
- }
-
- /* Are there any templates that are newly used? */
-
- if (! repo_changed)
- for (t = pending_repo; t; t = TREE_CHAIN (t))
- {
- if (IDENTIFIER_REPO_USED (TREE_VALUE (t)))
- {
- repo_changed = 1;
- break;
- }
- }
-
- if (! repo_changed || errorcount || sorrycount)
- goto out;
-
- reopen_repo_file_for_write ();
-
- if (repo_file == 0)
- goto out;
-
- fprintf (repo_file, "M %s\n", main_input_filename);
-
- p = getpwd ();
- fprintf (repo_file, "D %s\n", p);
-
- p = getenv ("COLLECT_GCC_OPTIONS");
- if (p != 0)
- fprintf (repo_file, "A %s\n", p);
-
- for (t = pending_repo; t; t = TREE_CHAIN (t))
- {
- tree val = TREE_VALUE (t);
- char type = IDENTIFIER_REPO_CHOSEN (val) ? 'C' : 'O';
-
- fprintf (repo_file, "%c %s\n", type, IDENTIFIER_POINTER (val));
- }
-
- out:
- if (repo_file)
- fclose (repo_file);
-}
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
deleted file mode 100644
index 0fbfc01eff9..00000000000
--- a/gcc/cp/rtti.c
+++ /dev/null
@@ -1,1373 +0,0 @@
-/* RunTime Type Identification
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
- Mostly written by Jason Merrill (jason@cygnus.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 "tree.h"
-#include "cp-tree.h"
-#include "flags.h"
-#include "output.h"
-#include "assert.h"
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-extern tree define_function ();
-extern tree build_t_desc_overload ();
-extern struct obstack *permanent_obstack;
-
-tree type_info_type_node;
-tree tinfo_fn_id;
-tree tinfo_fn_type;
-
-void
-init_rtti_processing ()
-{
- type_info_type_node = xref_tag
- (class_type_node, get_identifier ("type_info"), NULL_TREE, 1);
- tinfo_fn_id = get_identifier ("__tf");
- tinfo_fn_type = build_function_type
- (build_reference_type (build_type_variant (type_info_type_node, 1, 0)),
- void_list_node);
-}
-
-/* Given a pointer to an object with at least one virtual table
- pointer somewhere, return a pointer to a possible sub-object that
- has a virtual table pointer in it that is the vtable parent for
- that sub-object. */
-
-static tree
-build_headof_sub (exp)
- tree exp;
-{
- tree type = TREE_TYPE (TREE_TYPE (exp));
- tree basetype = CLASSTYPE_RTTI (type);
- tree binfo = get_binfo (basetype, type, 0);
-
- exp = convert_pointer_to_real (binfo, exp);
- return exp;
-}
-
-/* Given the expression EXP of type `class *', return the head of the
- object pointed to by EXP with type cv void*, if the class has any
- virtual functions (TYPE_VIRTUAL_P), else just return the
- expression. */
-
-static tree
-build_headof (exp)
- tree exp;
-{
- tree type = TREE_TYPE (exp);
- tree aref;
- tree offset;
-
- if (TREE_CODE (type) != POINTER_TYPE)
- {
- error ("`headof' applied to non-pointer type");
- return error_mark_node;
- }
- type = TREE_TYPE (type);
-
- if (!TYPE_VIRTUAL_P (type))
- return exp;
-
- /* If we don't have rtti stuff, get to a sub-object that does. */
- if (!CLASSTYPE_VFIELDS (TREE_TYPE (TREE_TYPE (exp))))
- exp = build_headof_sub (exp);
-
- /* We use this a couple of times below, protect it. */
- exp = save_expr (exp);
-
- aref = build_vtbl_ref (build_indirect_ref (exp, NULL_PTR), integer_zero_node);
-
- if (flag_vtable_thunks)
- offset = aref;
- else
- offset = build_component_ref (aref, delta_identifier, NULL_TREE, 0);
-
- type = build_type_variant (ptr_type_node, TREE_READONLY (exp),
- TREE_THIS_VOLATILE (exp));
- return build (PLUS_EXPR, type, exp,
- convert (ptrdiff_type_node, offset));
-}
-
-/* Build a call to a generic entry point taking and returning void. */
-
-static tree
-call_void_fn (name)
- char *name;
-{
- tree d = get_identifier (name);
- tree type;
-
- if (IDENTIFIER_GLOBAL_VALUE (d))
- d = IDENTIFIER_GLOBAL_VALUE (d);
- else
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- type = build_function_type (void_type_node, void_list_node);
- d = build_lang_decl (FUNCTION_DECL, d, type);
- DECL_EXTERNAL (d) = 1;
- TREE_PUBLIC (d) = 1;
- DECL_ARTIFICIAL (d) = 1;
- pushdecl_top_level (d);
- make_function_rtl (d);
- assemble_external (d);
-
- pop_obstacks ();
- }
-
- return build_call (d, void_type_node, NULL_TREE);
-}
-
-/* Get a bad_cast node for the program to throw...
-
- See libstdc++/exception.cc for __throw_bad_cast */
-
-static tree
-throw_bad_cast ()
-{
- return call_void_fn ("__throw_bad_cast");
-}
-
-static tree
-throw_bad_typeid ()
-{
- return call_void_fn ("__throw_bad_typeid");
-}
-
-/* Return the type_info function associated with the expression EXP. If
- EXP is a reference to a polymorphic class, return the dynamic type;
- otherwise return the static type of the expression. */
-
-tree
-get_tinfo_fn_dynamic (exp)
- tree exp;
-{
- tree type;
-
- if (exp == error_mark_node)
- return error_mark_node;
-
- if (type_unknown_p (exp))
- {
- error ("typeid of overloaded function");
- return error_mark_node;
- }
-
- type = TREE_TYPE (exp);
-
- /* peel back references, so they match. */
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- /* Peel off cv qualifiers. */
- type = TYPE_MAIN_VARIANT (type);
-
- /* If exp is a reference to polymorphic type, get the real type_info. */
- if (TYPE_VIRTUAL_P (type) && ! resolves_to_fixed_type_p (exp, 0))
- {
- /* build reference to type_info from vtable. */
- tree t;
-
- if (! flag_rtti)
- warning ("taking dynamic typeid of object without -frtti");
-
- /* If we don't have rtti stuff, get to a sub-object that does. */
- if (! CLASSTYPE_VFIELDS (type))
- {
- exp = build_unary_op (ADDR_EXPR, exp, 0);
- exp = build_headof_sub (exp);
- exp = build_indirect_ref (exp, NULL_PTR);
- }
-
- if (flag_vtable_thunks)
- t = build_vfn_ref ((tree *) 0, exp, integer_one_node);
- else
- t = build_vfn_ref ((tree *) 0, exp, integer_zero_node);
- TREE_TYPE (t) = build_pointer_type (tinfo_fn_type);
- return t;
- }
-
- /* otherwise return the type_info for the static type of the expr. */
- return get_tinfo_fn (TYPE_MAIN_VARIANT (type));
-}
-
-tree
-build_typeid (exp)
- tree exp;
-{
- exp = get_tinfo_fn_dynamic (exp);
- exp = build_call (exp, TREE_TYPE (tinfo_fn_type), NULL_TREE);
- return convert_from_reference (exp);
-}
-
-tree
-build_x_typeid (exp)
- tree exp;
-{
- tree cond = NULL_TREE;
- tree type = TREE_TYPE (tinfo_fn_type);
- int nonnull;
-
- if (processing_template_decl)
- return build_min_nt (TYPEID_EXPR, exp);
-
- if (TREE_CODE (exp) == INDIRECT_REF
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
- && TYPE_VIRTUAL_P (TREE_TYPE (exp))
- && ! resolves_to_fixed_type_p (exp, &nonnull)
- && ! nonnull)
- {
- exp = stabilize_reference (exp);
- cond = convert (boolean_type_node, TREE_OPERAND (exp, 0));
- }
-
- exp = get_tinfo_fn_dynamic (exp);
-
- if (exp == error_mark_node)
- return error_mark_node;
-
- exp = build_call (exp, type, NULL_TREE);
-
- if (cond)
- {
- tree bad = throw_bad_typeid ();
-
- bad = build_compound_expr
- (tree_cons (NULL_TREE, bad, build_tree_list
- (NULL_TREE, convert (type, integer_zero_node))));
- exp = build (COND_EXPR, type, cond, exp, bad);
- }
-
- return convert_from_reference (exp);
-}
-
-static tree
-get_tinfo_var (type)
- tree type;
-{
- tree tname = build_overload_with_type (get_identifier ("__ti"), type);
- tree tdecl, arrtype;
- int size;
-
- if (IDENTIFIER_GLOBAL_VALUE (tname))
- return IDENTIFIER_GLOBAL_VALUE (tname);
-
- /* Figure out how much space we need to allocate for the type_info object.
- If our struct layout or the type_info classes are changed, this will
- need to be modified. */
- if (TYPE_VOLATILE (type) || TYPE_READONLY (type))
- size = 3 * POINTER_SIZE + INT_TYPE_SIZE;
- else if (TREE_CODE (type) == POINTER_TYPE
- && ! (TREE_CODE (TREE_TYPE (type)) == OFFSET_TYPE
- || TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE))
- size = 3 * POINTER_SIZE;
- else if (IS_AGGR_TYPE (type))
- {
- if (CLASSTYPE_N_BASECLASSES (type) == 0)
- size = 2 * POINTER_SIZE;
- else if (! TYPE_USES_COMPLEX_INHERITANCE (type)
- && (TREE_VIA_PUBLIC
- (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0))))
- size = 3 * POINTER_SIZE;
- else
- size = 3 * POINTER_SIZE + INT_TYPE_SIZE;
- }
- else
- size = 2 * POINTER_SIZE;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- /* The type for a character array of the appropriate size. */
- arrtype = build_cplus_array_type
- (unsigned_char_type_node,
- build_index_type (size_int (size / BITS_PER_UNIT - 1)));
-
- tdecl = build_decl (VAR_DECL, tname, arrtype);
- TREE_PUBLIC (tdecl) = 1;
- DECL_EXTERNAL (tdecl) = 1;
- DECL_ARTIFICIAL (tdecl) = 1;
- pushdecl_top_level (tdecl);
- cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0);
-
- pop_obstacks ();
-
- return tdecl;
-}
-
-tree
-get_tinfo_fn (type)
- tree type;
-{
- tree name;
- tree d;
-
- if (TREE_CODE (type) == OFFSET_TYPE)
- type = TREE_TYPE (type);
- if (TREE_CODE (type) == METHOD_TYPE)
- type = build_function_type (TREE_TYPE (type),
- TREE_CHAIN (TYPE_ARG_TYPES (type)));
-
- name = build_overload_with_type (tinfo_fn_id, type);
-
- if (IDENTIFIER_GLOBAL_VALUE (name))
- return IDENTIFIER_GLOBAL_VALUE (name);
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
-
- d = build_lang_decl (FUNCTION_DECL, name, tinfo_fn_type);
- DECL_EXTERNAL (d) = 1;
- TREE_PUBLIC (d) = 1;
- DECL_ARTIFICIAL (d) = 1;
- DECL_NOT_REALLY_EXTERN (d) = 1;
- DECL_MUTABLE_P (d) = 1;
- TREE_TYPE (name) = copy_to_permanent (type);
- pushdecl_top_level (d);
- make_function_rtl (d);
- assemble_external (d);
- mark_inline_for_output (d);
- if (at_eof)
- import_export_decl (d);
-
- pop_obstacks ();
-
- return d;
-}
-
-static tree
-get_typeid_1 (type)
- tree type;
-{
- tree t = build_call
- (get_tinfo_fn (type), TREE_TYPE (tinfo_fn_type), NULL_TREE);
- return convert_from_reference (t);
-}
-
-/* Return the type_info object for TYPE, creating it if necessary. */
-
-tree
-get_typeid (type)
- tree type;
-{
- if (type == error_mark_node)
- return error_mark_node;
-
- if (processing_template_decl)
- return build_min_nt (TYPEID_EXPR, type);
-
- /* If the type of the type-id is a reference type, the result of the
- typeid expression refers to a type_info object representing the
- referenced type. */
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- /* The top-level cv-qualifiers of the lvalue expression or the type-id
- that is the operand of typeid are always ignored. */
- type = TYPE_MAIN_VARIANT (type);
-
- return get_typeid_1 (type);
-}
-
-/* Check whether TEST is null before returning RESULT. If TEST is used in
- RESULT, it must have previously had a save_expr applied to it. */
-
-static tree
-ifnonnull (test, result)
- tree test, result;
-{
- return build (COND_EXPR, TREE_TYPE (result),
- build (EQ_EXPR, boolean_type_node, test, integer_zero_node),
- convert (TREE_TYPE (result), integer_zero_node),
- result);
-}
-
-/* Execute a dynamic cast, as described in section 5.2.6 of the 9/93 working
- paper. */
-
-tree
-build_dynamic_cast (type, expr)
- tree type, expr;
-{
- enum tree_code tc = TREE_CODE (type);
- tree exprtype = TREE_TYPE (expr);
- enum tree_code ec;
- tree dcast_fn;
-
- if (type == error_mark_node || expr == error_mark_node)
- return error_mark_node;
-
- if (processing_template_decl)
- {
- tree t = build_min (DYNAMIC_CAST_EXPR, type, expr);
- return t;
- }
-
- assert (exprtype != NULL_TREE);
- ec = TREE_CODE (exprtype);
-
- switch (tc)
- {
- case POINTER_TYPE:
- if (ec == REFERENCE_TYPE)
- {
- expr = convert_from_reference (expr);
- exprtype = TREE_TYPE (expr);
- ec = TREE_CODE (exprtype);
- }
- if (ec != POINTER_TYPE)
- goto fail;
- if (TREE_CODE (TREE_TYPE (exprtype)) != RECORD_TYPE)
- goto fail;
- if (TYPE_SIZE (TREE_TYPE (exprtype)) == NULL_TREE)
- goto fail;
- if (TREE_READONLY (TREE_TYPE (exprtype)) &&
- ! TYPE_READONLY (TREE_TYPE (type)))
- goto fail;
- if (TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node)
- break;
- /* else fall through */
- case REFERENCE_TYPE:
- if (TREE_CODE (TREE_TYPE (type)) != RECORD_TYPE)
- goto fail;
- if (TYPE_SIZE (TREE_TYPE (type)) == NULL_TREE)
- goto fail;
- break;
- /* else fall through */
- default:
- goto fail;
- }
-
- /* Apply trivial conversion T -> T& for dereferenced ptrs. */
- if (ec == RECORD_TYPE)
- {
- exprtype = build_type_variant (exprtype, TREE_READONLY (expr),
- TREE_THIS_VOLATILE (expr));
- exprtype = build_reference_type (exprtype);
- expr = convert_to_reference (exprtype, expr, CONV_IMPLICIT,
- LOOKUP_NORMAL, NULL_TREE);
- ec = REFERENCE_TYPE;
- }
-
- if (tc == REFERENCE_TYPE)
- {
- if (ec != REFERENCE_TYPE)
- goto fail;
- if (TREE_CODE (TREE_TYPE (exprtype)) != RECORD_TYPE)
- goto fail;
- if (TYPE_SIZE (TREE_TYPE (exprtype)) == NULL_TREE)
- goto fail;
- if (TREE_READONLY (TREE_TYPE (exprtype)) &&
- ! TYPE_READONLY (TREE_TYPE (type)))
- goto fail;
- }
-
- /* If *type is an unambiguous accessible base class of *exprtype,
- convert statically. */
- {
- int distance;
- tree path;
-
- distance = get_base_distance (TREE_TYPE (type), TREE_TYPE (exprtype), 1,
- &path);
- if (distance >= 0)
- return build_vbase_path (PLUS_EXPR, type, expr, path, 0);
- }
-
- /* Otherwise *exprtype must be a polymorphic class (have a vtbl). */
- if (TYPE_VIRTUAL_P (TREE_TYPE (exprtype)))
- {
- tree expr1;
- /* if TYPE is `void *', return pointer to complete object. */
- if (tc == POINTER_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node)
- {
- /* if b is an object, dynamic_cast<void *>(&b) == (void *)&b. */
- if (TREE_CODE (expr) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (expr, 0)) == VAR_DECL
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == RECORD_TYPE)
- return build1 (NOP_EXPR, type, expr);
-
- /* Since expr is used twice below, save it. */
- expr = save_expr (expr);
-
- expr1 = build_headof (expr);
- if (TREE_TYPE (expr1) != type)
- expr1 = build1 (NOP_EXPR, type, expr1);
- return ifnonnull (expr, expr1);
- }
- else
- {
- tree retval;
- tree result, td1, td2, td3, elems, expr2;
-
- /* If we got here, we can't convert statically. Therefore,
- dynamic_cast<D&>(b) (b an object) cannot succeed. */
- if (ec == REFERENCE_TYPE)
- {
- if (TREE_CODE (expr) == VAR_DECL
- && TREE_CODE (TREE_TYPE (expr)) == RECORD_TYPE)
- {
- cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
- expr, type);
- return throw_bad_cast ();
- }
- }
- /* Ditto for dynamic_cast<D*>(&b). */
- else if (TREE_CODE (expr) == ADDR_EXPR)
- {
- tree op = TREE_OPERAND (expr, 0);
- if (TREE_CODE (op) == VAR_DECL
- && TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE)
- {
- cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed",
- expr, type);
- retval = build_int_2 (0, 0);
- TREE_TYPE (retval) = type;
- return retval;
- }
- }
-
- /* Since expr is used twice below, save it. */
- expr = save_expr (expr);
-
- expr1 = expr;
- if (tc == REFERENCE_TYPE)
- expr1 = build_unary_op (ADDR_EXPR, expr1, 0);
-
- /* Build run-time conversion. */
- expr2 = build_headof (expr1);
-
- if (ec == POINTER_TYPE)
- td1 = get_tinfo_fn_dynamic (build_indirect_ref (expr, NULL_PTR));
- else
- td1 = get_tinfo_fn_dynamic (expr);
- td1 = decay_conversion (td1);
-
- td2 = decay_conversion
- (get_tinfo_fn (TYPE_MAIN_VARIANT (TREE_TYPE (type))));
- td3 = decay_conversion
- (get_tinfo_fn (TYPE_MAIN_VARIANT (TREE_TYPE (exprtype))));
-
- elems = tree_cons
- (NULL_TREE, td1, tree_cons
- (NULL_TREE, td2, tree_cons
- (NULL_TREE, build_int_2 (1, 0), tree_cons
- (NULL_TREE, expr2, tree_cons
- (NULL_TREE, td3, tree_cons
- (NULL_TREE, expr1, NULL_TREE))))));
-
- dcast_fn = get_identifier ("__dynamic_cast");
- if (IDENTIFIER_GLOBAL_VALUE (dcast_fn))
- dcast_fn = IDENTIFIER_GLOBAL_VALUE (dcast_fn);
- else
- {
- tree tmp;
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, TREE_TYPE (td1), tree_cons
- (NULL_TREE, TREE_TYPE (td1), tree_cons
- (NULL_TREE, integer_type_node, tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, TREE_TYPE (td1), tree_cons
- (NULL_TREE, ptr_type_node, void_list_node))))));
- tmp = build_function_type (ptr_type_node, tmp);
- dcast_fn = build_lang_decl (FUNCTION_DECL, dcast_fn, tmp);
- DECL_EXTERNAL (dcast_fn) = 1;
- TREE_PUBLIC (dcast_fn) = 1;
- DECL_ARTIFICIAL (dcast_fn) = 1;
- pushdecl_top_level (dcast_fn);
- make_function_rtl (dcast_fn);
- assemble_external (dcast_fn);
- pop_obstacks ();
- }
-
- result = build_call
- (dcast_fn, TREE_TYPE (TREE_TYPE (dcast_fn)), elems);
-
- if (tc == REFERENCE_TYPE)
- {
- expr1 = throw_bad_cast ();
- expr1 = build_compound_expr
- (tree_cons (NULL_TREE, expr1,
- build_tree_list (NULL_TREE, convert
- (type, integer_zero_node))));
- TREE_TYPE (expr1) = type;
- result = save_expr (result);
- return build (COND_EXPR, type, result, result, expr1);
- }
-
- /* Now back to the type we want from a void*. */
- result = convert (type, result);
- return ifnonnull (expr, result);
- }
- }
-
- fail:
- cp_error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T'",
- expr, exprtype, type);
- return error_mark_node;
-}
-
-/* Build and initialize various sorts of descriptors. Every descriptor
- node has a name associated with it (the name created by mangling).
- For this reason, we use the identifier as our access to the __*_desc
- nodes, instead of sticking them directly in the types. Otherwise we
- would burden all built-in types (and pointer types) with slots that
- we don't necessarily want to use.
-
- For each descriptor we build, we build a variable that contains
- the descriptor's information. When we need this info at runtime,
- all we need is access to these variables.
-
- Note: these constructors always return the address of the descriptor
- info, since that is simplest for their mutual interaction. */
-
-extern tree const_string_type_node;
-
-/* Build an initializer for a __si_type_info node. */
-
-static void
-expand_si_desc (tdecl, type)
- tree tdecl;
- tree type;
-{
- tree t, elems, fn;
- char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name)+1, name));
-
- type = BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0));
- expand_expr_stmt (get_typeid_1 (type));
- t = decay_conversion (get_tinfo_var (type));
- elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), tree_cons
- (NULL_TREE, t, NULL_TREE)));
-
- fn = get_identifier ("__rtti_si");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- tree tmp;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, tree_cons
- (NULL_TREE, build_pointer_type (type_info_type_node),
- void_list_node)));
- tmp = build_function_type (void_type_node, tmp);
-
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- assemble_external (fn);
- pop_obstacks ();
- }
-
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
-}
-
-/* Build an initializer for a __class_type_info node. */
-
-static void
-expand_class_desc (tdecl, type)
- tree tdecl;
- tree type;
-{
- tree name_string;
- tree fn, tmp;
- char *name;
-
- int i = CLASSTYPE_N_BASECLASSES (type);
- int base_cnt = 0;
- tree binfos = TYPE_BINFO_BASETYPES (type);
-#if 0
- /* See code below that used these. */
- tree vb = CLASSTYPE_VBASECLASSES (type);
- int n_base = i;
-#endif
- tree base, elems, access, offset, isvir;
- tree elt, elts = NULL_TREE;
- static tree base_info_type_node;
-
- if (base_info_type_node == NULL_TREE)
- {
- tree fields [4];
-
- /* A reasonably close approximation of __class_type_info::base_info */
-
- push_obstacks (&permanent_obstack, &permanent_obstack);
- base_info_type_node = make_lang_type (RECORD_TYPE);
-
- /* Actually const __user_type_info * */
- fields [0] = build_lang_field_decl
- (FIELD_DECL, NULL_TREE,
- build_pointer_type (build_type_variant (type_info_type_node, 1, 0)));
- fields [1] = build_lang_field_decl
- (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node);
- DECL_BIT_FIELD (fields[1]) = 1;
- DECL_FIELD_SIZE (fields[1]) = 29;
-
- fields [2] = build_lang_field_decl
- (FIELD_DECL, NULL_TREE, boolean_type_node);
- DECL_BIT_FIELD (fields[2]) = 1;
- DECL_FIELD_SIZE (fields[2]) = 1;
-
- /* Actually enum access */
- fields [3] = build_lang_field_decl
- (FIELD_DECL, NULL_TREE, integer_type_node);
- DECL_BIT_FIELD (fields[3]) = 1;
- DECL_FIELD_SIZE (fields[3]) = 2;
-
- finish_builtin_type (base_info_type_node, "__base_info", fields,
- 3, ptr_type_node);
- pop_obstacks ();
- }
-
- while (--i >= 0)
- {
- tree binfo = TREE_VEC_ELT (binfos, i);
-
- expand_expr_stmt (get_typeid_1 (BINFO_TYPE (binfo)));
- base = decay_conversion (get_tinfo_var (BINFO_TYPE (binfo)));
-
- if (TREE_VIA_VIRTUAL (binfo))
- {
- tree t = BINFO_TYPE (binfo);
- char *name;
- tree field;
-
- name = (char *) alloca (TYPE_NAME_LENGTH (t)+sizeof (VBASE_NAME)+1);
- sprintf (name, VBASE_NAME_FORMAT, TYPE_NAME_STRING (t));
- field = lookup_field (type, get_identifier (name), 0, 0);
- offset = size_binop (FLOOR_DIV_EXPR,
- DECL_FIELD_BITPOS (field), size_int (BITS_PER_UNIT));
- }
- else
- offset = BINFO_OFFSET (binfo);
-
- if (TREE_VIA_PUBLIC (binfo))
- access = access_public_node;
- else if (TREE_VIA_PROTECTED (binfo))
- access = access_protected_node;
- else
- access = access_private_node;
- if (TREE_VIA_VIRTUAL (binfo))
- isvir = boolean_true_node;
- else
- isvir = boolean_false_node;
-
- elt = build
- (CONSTRUCTOR, base_info_type_node, NULL_TREE, tree_cons
- (NULL_TREE, base, tree_cons
- (NULL_TREE, offset, tree_cons
- (NULL_TREE, isvir, tree_cons
- (NULL_TREE, access, NULL_TREE)))));
- TREE_HAS_CONSTRUCTOR (elt) = TREE_CONSTANT (elt) = TREE_STATIC (elt) = 1;
- elts = tree_cons (NULL_TREE, elt, elts);
- base_cnt++;
- }
-#if 0
- i = n_base;
- while (vb)
- {
- tree b;
- access = access_public_node;
- while (--i >= 0)
- {
- b = TREE_VEC_ELT (binfos, i);
- if (BINFO_TYPE (vb) == BINFO_TYPE (b) && TREE_VIA_VIRTUAL (b))
- {
- if (TREE_VIA_PUBLIC (b))
- access = access_public_node;
- else if (TREE_VIA_PROTECTED (b))
- access = access_protected_node;
- else
- access = access_private_node;
- break;
- }
- }
- base = build_t_desc (BINFO_TYPE (vb), 1);
- offset = BINFO_OFFSET (vb);
- isvir = build_int_2 (1, 0);
-
- base_list = tree_cons (NULL_TREE, base, base_list);
- isvir_list = tree_cons (NULL_TREE, isvir, isvir_list);
- acc_list = tree_cons (NULL_TREE, access, acc_list);
- off_list = tree_cons (NULL_TREE, offset, off_list);
-
- base_cnt++;
- vb = TREE_CHAIN (vb);
- }
-#endif
-
- name = build_overload_name (type, 1, 1);
- name_string = combine_strings (build_string (strlen (name)+1, name));
-
- {
- tree arrtype = build_array_type (base_info_type_node, NULL_TREE);
- elts = build (CONSTRUCTOR, arrtype, NULL_TREE, elts);
- TREE_HAS_CONSTRUCTOR (elts) = TREE_CONSTANT (elts) =
- TREE_STATIC (elts) = 1;
- complete_array_type (arrtype, elts, 1);
- }
-
- elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), tree_cons
- (NULL_TREE, decay_conversion (elts), tree_cons
- (NULL_TREE, build_int_2 (base_cnt, 0), NULL_TREE))));
-
- fn = get_identifier ("__rtti_class");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, tree_cons
- (NULL_TREE, build_pointer_type (base_info_type_node), tree_cons
- (NULL_TREE, sizetype, void_list_node))));
- tmp = build_function_type (void_type_node, tmp);
-
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- assemble_external (fn);
- pop_obstacks ();
- }
-
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
-}
-
-/* Build an initializer for a __pointer_type_info node. */
-
-static void
-expand_ptr_desc (tdecl, type)
- tree tdecl;
- tree type;
-{
- tree t, elems, fn;
- char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name)+1, name));
-
- type = TREE_TYPE (type);
- expand_expr_stmt (get_typeid_1 (type));
- t = decay_conversion (get_tinfo_var (type));
- elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), tree_cons
- (NULL_TREE, t, NULL_TREE)));
-
- fn = get_identifier ("__rtti_ptr");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- tree tmp;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, tree_cons
- (NULL_TREE, build_pointer_type (type_info_type_node),
- void_list_node)));
- tmp = build_function_type (void_type_node, tmp);
-
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- assemble_external (fn);
- pop_obstacks ();
- }
-
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
-}
-
-/* Build an initializer for a __attr_type_info node. */
-
-static void
-expand_attr_desc (tdecl, type)
- tree tdecl;
- tree type;
-{
- tree elems, t, fn;
- char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name)+1, name));
- tree attrval = build_int_2
- (TYPE_READONLY (type) | TYPE_VOLATILE (type) * 2, 0);
-
- expand_expr_stmt (get_typeid_1 (TYPE_MAIN_VARIANT (type)));
- t = decay_conversion (get_tinfo_var (TYPE_MAIN_VARIANT (type)));
- elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), tree_cons
- (NULL_TREE, attrval, tree_cons (NULL_TREE, t, NULL_TREE))));
-
- fn = get_identifier ("__rtti_attr");
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- tree tmp;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, tree_cons
- (NULL_TREE, integer_type_node, tree_cons
- (NULL_TREE, build_pointer_type (type_info_type_node),
- void_list_node))));
- tmp = build_function_type (void_type_node, tmp);
-
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- assemble_external (fn);
- pop_obstacks ();
- }
-
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
-}
-
-/* Build an initializer for a type_info node that just has a name. */
-
-static void
-expand_generic_desc (tdecl, type, fnname)
- tree tdecl;
- tree type;
- char *fnname;
-{
- char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name)+1, name));
- tree elems = tree_cons
- (NULL_TREE, decay_conversion (tdecl), tree_cons
- (NULL_TREE, decay_conversion (name_string), NULL_TREE));
-
- tree fn = get_identifier (fnname);
- if (IDENTIFIER_GLOBAL_VALUE (fn))
- fn = IDENTIFIER_GLOBAL_VALUE (fn);
- else
- {
- tree tmp;
- push_obstacks (&permanent_obstack, &permanent_obstack);
- tmp = tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, const_string_type_node, void_list_node));
- tmp = build_function_type (void_type_node, tmp);
-
- fn = build_lang_decl (FUNCTION_DECL, fn, tmp);
- DECL_EXTERNAL (fn) = 1;
- TREE_PUBLIC (fn) = 1;
- DECL_ARTIFICIAL (fn) = 1;
- pushdecl_top_level (fn);
- make_function_rtl (fn);
- assemble_external (fn);
- pop_obstacks ();
- }
-
- fn = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), elems);
- expand_expr_stmt (fn);
-}
-
-/* Generate the code for a type_info initialization function.
- Note that we take advantage of the passage
-
- 5.2.7 Type identification [expr.typeid]
-
- Whether or not the destructor is called for the type_info object at the
- end of the program is unspecified.
-
- and don't bother to arrange for these objects to be destroyed. It
- doesn't matter, anyway, since the destructors don't do anything.
-
- This must only be called from toplevel (i.e. from finish_file)! */
-
-void
-synthesize_tinfo_fn (fndecl)
- tree fndecl;
-{
- tree type = TREE_TYPE (DECL_NAME (fndecl));
- tree tmp, addr;
-
- tree tdecl = get_tinfo_var (type);
- DECL_EXTERNAL (tdecl) = 0;
- TREE_STATIC (tdecl) = 1;
- DECL_COMMON (tdecl) = 1;
- TREE_USED (tdecl) = 1;
- DECL_ALIGN (tdecl) = TYPE_ALIGN (ptr_type_node);
- cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0);
-
- start_function (NULL_TREE, fndecl, NULL_TREE, 1);
- store_parm_decls ();
- clear_last_expr ();
- push_momentary ();
-
- /* If the first word of the array (the vtable) is non-zero, we've already
- initialized the object, so don't do it again. */
- addr = decay_conversion (tdecl);
- tmp = convert (build_pointer_type (ptr_type_node), addr);
- tmp = build_indirect_ref (tmp, 0);
- tmp = build_binary_op (EQ_EXPR, tmp, integer_zero_node, 1);
- expand_start_cond (tmp, 0);
-
- if (TREE_CODE (type) == FUNCTION_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_func");
- else if (TREE_CODE (type) == ARRAY_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_array");
- else if (TYPE_VOLATILE (type) || TYPE_READONLY (type))
- expand_attr_desc (tdecl, type);
- else if (TREE_CODE (type) == POINTER_TYPE)
- {
- if (TREE_CODE (TREE_TYPE (type)) == OFFSET_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_ptmd");
- else if (TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_ptmf");
- else
- expand_ptr_desc (tdecl, type);
- }
- else if (TYPE_PTRMEMFUNC_P (type))
- expand_generic_desc (tdecl, type, "__rtti_ptmf");
- else if (IS_AGGR_TYPE (type))
- {
- if (CLASSTYPE_N_BASECLASSES (type) == 0)
- expand_generic_desc (tdecl, type, "__rtti_user");
- else if (! TYPE_USES_COMPLEX_INHERITANCE (type)
- && (TREE_VIA_PUBLIC
- (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0))))
- expand_si_desc (tdecl, type);
- else
- expand_class_desc (tdecl, type);
- }
- else if (TREE_CODE (type) == ENUMERAL_TYPE)
- expand_generic_desc (tdecl, type, "__rtti_user");
- else
- my_friendly_abort (252);
-
- expand_end_cond ();
-
- /* OK, now return the type_info object. */
- tmp = convert (build_pointer_type (type_info_type_node), addr);
- tmp = build_indirect_ref (tmp, 0);
- c_expand_return (tmp);
- finish_function (lineno, 0, 0);
-}
-
-#if 0
-/* This is the old dossier type descriptor generation code, it's much
- more extended than rtti. It's reserved for later use. */
-/* Build an initializer for a __t_desc node. So that we can take advantage
- of recursion, we accept NULL for TYPE.
- DEFINITION is greater than zero iff we must define the type descriptor
- (as opposed to merely referencing it). 1 means treat according to
- #pragma interface/#pragma implementation rules. 2 means define as
- global and public, no matter what. */
-
-tree
-build_t_desc (type, definition)
- tree type;
- int definition;
-{
- tree tdecl;
- tree tname, name_string;
- tree elems, fields;
- tree parents, vbases, offsets, ivars, methods, target_type;
- int method_count = 0, field_count = 0;
-
- if (type == NULL_TREE)
- return NULL_TREE;
-
- tname = build_t_desc_overload (type);
- if (IDENTIFIER_AS_DESC (tname)
- && (!definition || TREE_ASM_WRITTEN (IDENTIFIER_AS_DESC (tname))))
- return IDENTIFIER_AS_DESC (tname);
-
- tdecl = lookup_name (tname, 0);
- if (tdecl == NULL_TREE)
- {
- tdecl = build_decl (VAR_DECL, tname, __t_desc_type_node);
- DECL_EXTERNAL (tdecl) = 1;
- TREE_PUBLIC (tdecl) = 1;
- tdecl = pushdecl_top_level (tdecl);
- }
- /* If we previously defined it, return the defined result. */
- else if (definition && DECL_INITIAL (tdecl))
- return IDENTIFIER_AS_DESC (tname);
-
- if (definition)
- {
- tree taggr = type;
- /* Let T* and T& be written only when T is written (if T is an aggr).
- We do this for const, but not for volatile, since volatile
- is rare and const is not. */
- if (!TYPE_VOLATILE (taggr)
- && (TREE_CODE (taggr) == POINTER_TYPE
- || TREE_CODE (taggr) == REFERENCE_TYPE)
- && IS_AGGR_TYPE (TREE_TYPE (taggr)))
- taggr = TREE_TYPE (taggr);
-
- /* If we know that we don't need to write out this type's
- vtable, then don't write out it's dossier. Somebody
- else will take care of that. */
- if (IS_AGGR_TYPE (taggr) && CLASSTYPE_VFIELD (taggr))
- {
- if (CLASSTYPE_VTABLE_NEEDS_WRITING (taggr))
- {
- TREE_PUBLIC (tdecl) = ! CLASSTYPE_INTERFACE_ONLY (taggr)
- && CLASSTYPE_INTERFACE_KNOWN (taggr);
- DECL_EXTERNAL (tdecl) = 0;
- }
- else
- {
- if (write_virtuals != 0)
- TREE_PUBLIC (tdecl) = 1;
- }
- }
- else
- {
- DECL_EXTERNAL (tdecl) = 0;
- TREE_PUBLIC (tdecl) = (definition > 1);
- }
- }
- SET_IDENTIFIER_AS_DESC (tname, build_unary_op (ADDR_EXPR, tdecl, 0));
-
- if (!definition || DECL_EXTERNAL (tdecl))
- {
- /* That's it! */
- cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0);
- return IDENTIFIER_AS_DESC (tname);
- }
-
- /* Show that we are defining the t_desc for this type. */
- DECL_INITIAL (tdecl) = error_mark_node;
-
- parents = build_tree_list (NULL_TREE, integer_zero_node);
- vbases = build_tree_list (NULL_TREE, integer_zero_node);
- offsets = build_tree_list (NULL_TREE, integer_zero_node);
- methods = NULL_TREE;
- ivars = NULL_TREE;
-
- if (TYPE_LANG_SPECIFIC (type))
- {
- int i = CLASSTYPE_N_BASECLASSES (type);
- tree method_vec = CLASSTYPE_METHOD_VEC (type);
- tree *meth, *end;
- tree binfos = TYPE_BINFO_BASETYPES (type);
- tree vb = CLASSTYPE_VBASECLASSES (type);
-
- while (--i >= 0)
- parents = tree_cons (NULL_TREE, build_t_desc (BINFO_TYPE (TREE_VEC_ELT (binfos, i)), 0), parents);
-
- while (vb)
- {
- vbases = tree_cons (NULL_TREE, build_t_desc (BINFO_TYPE (vb), 0), vbases);
- offsets = tree_cons (NULL_TREE, BINFO_OFFSET (vb), offsets);
- vb = TREE_CHAIN (vb);
- }
-
- if (method_vec)
- for (meth = TREE_VEC_END (method_vec),
- end = &TREE_VEC_ELT (method_vec, 0); meth-- != end; )
- if (*meth)
- {
- methods = tree_cons (NULL_TREE, build_m_desc (*meth), methods);
- method_count++;
- }
- }
-
- if (IS_AGGR_TYPE (type))
- {
- for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
- if (TREE_CODE (fields) == FIELD_DECL
- || TREE_CODE (fields) == VAR_DECL)
- {
- ivars = tree_cons (NULL_TREE, build_i_desc (fields), ivars);
- field_count++;
- }
- ivars = nreverse (ivars);
- }
-
- parents = finish_table (NULL_TREE, build_pointer_type (__t_desc_type_node), parents, 0);
- vbases = finish_table (NULL_TREE, build_pointer_type (__t_desc_type_node), vbases, 0);
- offsets = finish_table (NULL_TREE, integer_type_node, offsets, 0);
- if (methods == NULL_TREE)
- methods = null_pointer_node;
- else
- methods = build_unary_op (ADDR_EXPR,
- finish_table (NULL_TREE, __m_desc_type_node, methods, 0),
- 0);
- if (ivars == NULL_TREE)
- ivars = null_pointer_node;
- else
- ivars = build_unary_op (ADDR_EXPR,
- finish_table (NULL_TREE, __i_desc_type_node, ivars, 0),
- 0);
- if (TREE_TYPE (type))
- target_type = build_t_desc (TREE_TYPE (type), definition);
- else
- target_type = integer_zero_node;
-
- name_string = combine_strings (build_string (IDENTIFIER_LENGTH (tname)+1, IDENTIFIER_POINTER (tname)));
-
- elems = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, name_string, 0),
- tree_cons (NULL_TREE,
- TYPE_SIZE(type)? size_in_bytes(type) : integer_zero_node,
- /* really should use bitfield initialization here. */
- tree_cons (NULL_TREE, integer_zero_node,
- tree_cons (NULL_TREE, target_type,
- tree_cons (NULL_TREE, build_int_2 (field_count, 2),
- tree_cons (NULL_TREE, build_int_2 (method_count, 2),
- tree_cons (NULL_TREE, ivars,
- tree_cons (NULL_TREE, methods,
- tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, parents, 0),
- tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, vbases, 0),
- build_tree_list (NULL_TREE, build_unary_op (ADDR_EXPR, offsets, 0))))))))))));
- return build_generic_desc (tdecl, elems);
-}
-
-/* Build an initializer for a __i_desc node. */
-
-tree
-build_i_desc (decl)
- tree decl;
-{
- tree elems, name_string;
- tree taggr;
-
- name_string = DECL_NAME (decl);
- name_string = combine_strings (build_string (IDENTIFIER_LENGTH (name_string)+1, IDENTIFIER_POINTER (name_string)));
-
- /* Now decide whether this ivar should cause it's type to get
- def'd or ref'd in this file. If the type we are looking at
- has a proxy definition, we look at the proxy (i.e., a
- `foo *' is equivalent to a `foo'). */
- taggr = TREE_TYPE (decl);
-
- if ((TREE_CODE (taggr) == POINTER_TYPE
- || TREE_CODE (taggr) == REFERENCE_TYPE)
- && TYPE_VOLATILE (taggr) == 0)
- taggr = TREE_TYPE (taggr);
-
- elems = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, name_string, 0),
- tree_cons (NULL_TREE, DECL_FIELD_BITPOS (decl),
- build_tree_list (NULL_TREE, build_t_desc (TREE_TYPE (decl),
- ! IS_AGGR_TYPE (taggr)))));
- taggr = build (CONSTRUCTOR, __i_desc_type_node, NULL_TREE, elems);
- TREE_CONSTANT (taggr) = 1;
- TREE_STATIC (taggr) = 1;
- TREE_READONLY (taggr) = 1;
- return taggr;
-}
-
-/* Build an initializer for a __m_desc node. */
-
-tree
-build_m_desc (decl)
- tree decl;
-{
- tree taggr, elems, name_string;
- tree parm_count, req_count, vindex, vcontext;
- tree parms;
- int p_count, r_count;
- tree parm_types = NULL_TREE;
-
- for (parms = TYPE_ARG_TYPES (TREE_TYPE (decl)), p_count = 0, r_count = 0;
- parms != NULL_TREE; parms = TREE_CHAIN (parms), p_count++)
- {
- taggr = TREE_VALUE (parms);
- if ((TREE_CODE (taggr) == POINTER_TYPE
- || TREE_CODE (taggr) == REFERENCE_TYPE)
- && TYPE_VOLATILE (taggr) == 0)
- taggr = TREE_TYPE (taggr);
-
- parm_types = tree_cons (NULL_TREE, build_t_desc (TREE_VALUE (parms),
- ! IS_AGGR_TYPE (taggr)),
- parm_types);
- if (TREE_PURPOSE (parms) == NULL_TREE)
- r_count++;
- }
-
- parm_types = finish_table (NULL_TREE, build_pointer_type (__t_desc_type_node),
- nreverse (parm_types), 0);
- parm_count = build_int_2 (p_count, 0);
- req_count = build_int_2 (r_count, 0);
-
- if (DECL_VINDEX (decl))
- vindex = DECL_VINDEX (decl);
- else
- vindex = integer_zero_node;
- if (DECL_CONTEXT (decl)
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
- vcontext = build_t_desc (DECL_CONTEXT (decl), 0);
- else
- vcontext = integer_zero_node;
- name_string = DECL_NAME (decl);
- if (name_string == NULL)
- name_string = DECL_ASSEMBLER_NAME (decl);
- name_string = combine_strings (build_string (IDENTIFIER_LENGTH (name_string)+1, IDENTIFIER_POINTER (name_string)));
-
- /* Now decide whether the return type of this mvar
- should cause it's type to get def'd or ref'd in this file.
- If the type we are looking at has a proxy definition,
- we look at the proxy (i.e., a `foo *' is equivalent to a `foo'). */
- taggr = TREE_TYPE (TREE_TYPE (decl));
-
- if ((TREE_CODE (taggr) == POINTER_TYPE
- || TREE_CODE (taggr) == REFERENCE_TYPE)
- && TYPE_VOLATILE (taggr) == 0)
- taggr = TREE_TYPE (taggr);
-
- elems = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, name_string, 0),
- tree_cons (NULL_TREE, vindex,
- tree_cons (NULL_TREE, vcontext,
- tree_cons (NULL_TREE, build_t_desc (TREE_TYPE (TREE_TYPE (decl)),
- ! IS_AGGR_TYPE (taggr)),
- tree_cons (NULL_TREE, build_c_cast (build_pointer_type (default_function_type), build_unary_op (ADDR_EXPR, decl, 0)),
- tree_cons (NULL_TREE, parm_count,
- tree_cons (NULL_TREE, req_count,
- build_tree_list (NULL_TREE, build_unary_op (ADDR_EXPR, parm_types, 0)))))))));
-
- taggr = build (CONSTRUCTOR, __m_desc_type_node, NULL_TREE, elems);
- TREE_CONSTANT (taggr) = 1;
- TREE_STATIC (taggr) = 1;
- TREE_READONLY (taggr) = 1;
- return taggr;
-}
-#endif /* dossier */
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
deleted file mode 100644
index f5f372c3943..00000000000
--- a/gcc/cp/search.c
+++ /dev/null
@@ -1,3683 +0,0 @@
-/* Breadth-first and depth-first routines for
- searching multiple-inheritance lattice for GNU C++.
- Copyright (C) 1987, 89, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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. */
-
-/* High-level class interface. */
-
-#include "config.h"
-#include "tree.h"
-#include <stdio.h>
-#include "cp-tree.h"
-#include "obstack.h"
-#include "flags.h"
-#include "rtl.h"
-#include "output.h"
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern struct obstack *current_obstack;
-extern tree abort_fndecl;
-
-#include "stack.h"
-
-/* Obstack used for remembering decision points of breadth-first. */
-
-static struct obstack search_obstack;
-
-/* Methods for pushing and popping objects to and from obstacks. */
-
-struct stack_level *
-push_stack_level (obstack, tp, size)
- struct obstack *obstack;
- char *tp; /* Sony NewsOS 5.0 compiler doesn't like void * here. */
- int size;
-{
- struct stack_level *stack;
- obstack_grow (obstack, tp, size);
- stack = (struct stack_level *) ((char*)obstack_next_free (obstack) - size);
- obstack_finish (obstack);
- stack->obstack = obstack;
- stack->first = (tree *) obstack_base (obstack);
- stack->limit = obstack_room (obstack) / sizeof (tree *);
- return stack;
-}
-
-struct stack_level *
-pop_stack_level (stack)
- struct stack_level *stack;
-{
- struct stack_level *tem = stack;
- struct obstack *obstack = tem->obstack;
- stack = tem->prev;
- obstack_free (obstack, tem);
- return stack;
-}
-
-#define search_level stack_level
-static struct search_level *search_stack;
-
-static tree lookup_field_1 ();
-static int lookup_fnfields_1 PROTO((tree, tree));
-static void dfs_walk ();
-static int markedp ();
-static void dfs_unmark ();
-static void dfs_init_vbase_pointers ();
-
-static tree vbase_types;
-static tree vbase_decl_ptr_intermediate, vbase_decl_ptr;
-static tree vbase_init_result;
-
-/* Allocate a level of searching. */
-
-static struct search_level *
-push_search_level (stack, obstack)
- struct stack_level *stack;
- struct obstack *obstack;
-{
- struct search_level tem;
-
- tem.prev = stack;
- return push_stack_level (obstack, (char *)&tem, sizeof (tem));
-}
-
-/* Discard a level of search allocation. */
-
-static struct search_level *
-pop_search_level (obstack)
- struct stack_level *obstack;
-{
- register struct search_level *stack = pop_stack_level (obstack);
-
- return stack;
-}
-
-/* Search memoization. */
-
-struct type_level
-{
- struct stack_level base;
-
- /* First object allocated in obstack of entries. */
- char *entries;
-
- /* Number of types memoized in this context. */
- int len;
-
- /* Type being memoized; save this if we are saving
- memoized contexts. */
- tree type;
-};
-
-/* Obstack used for memoizing member and member function lookup. */
-
-static struct obstack type_obstack, type_obstack_entries;
-static struct type_level *type_stack;
-static tree _vptr_name;
-
-/* Make things that look like tree nodes, but allocate them
- on type_obstack_entries. */
-static int my_tree_node_counter;
-static tree my_tree_cons (), my_build_string ();
-
-extern int flag_memoize_lookups, flag_save_memoized_contexts;
-
-/* Variables for gathering statistics. */
-static int my_memoized_entry_counter;
-static int memoized_fast_finds[2], memoized_adds[2], memoized_fast_rejects[2];
-static int memoized_fields_searched[2];
-#ifdef GATHER_STATISTICS
-static int n_fields_searched;
-static int n_calls_lookup_field, n_calls_lookup_field_1;
-static int n_calls_lookup_fnfields, n_calls_lookup_fnfields_1;
-static int n_calls_get_base_type;
-static int n_outer_fields_searched;
-static int n_contexts_saved;
-#endif /* GATHER_STATISTICS */
-
-/* Local variables to help save memoization contexts. */
-static tree prev_type_memoized;
-static struct type_level *prev_type_stack;
-
-/* This list is used by push_class_decls to know what decls need to
- be pushed into class scope. */
-static tree closed_envelopes = NULL_TREE;
-
-/* Allocate a level of type memoization context. */
-
-static struct type_level *
-push_type_level (stack, obstack)
- struct stack_level *stack;
- struct obstack *obstack;
-{
- struct type_level tem;
-
- tem.base.prev = stack;
-
- obstack_finish (&type_obstack_entries);
- tem.entries = (char *) obstack_base (&type_obstack_entries);
- tem.len = 0;
- tem.type = NULL_TREE;
-
- return (struct type_level *)push_stack_level (obstack, (char *)&tem, sizeof (tem));
-}
-
-/* Discard a level of type memoization context. */
-
-static struct type_level *
-pop_type_level (stack)
- struct type_level *stack;
-{
- obstack_free (&type_obstack_entries, stack->entries);
- return (struct type_level *)pop_stack_level ((struct stack_level *)stack);
-}
-
-/* Make something that looks like a TREE_LIST, but
- do it on the type_obstack_entries obstack. */
-
-static tree
-my_tree_cons (purpose, value, chain)
- tree purpose, value, chain;
-{
- tree p = (tree)obstack_alloc (&type_obstack_entries, sizeof (struct tree_list));
- ++my_tree_node_counter;
- TREE_TYPE (p) = NULL_TREE;
- ((HOST_WIDE_INT *)p)[3] = 0;
- TREE_SET_CODE (p, TREE_LIST);
- TREE_PURPOSE (p) = purpose;
- TREE_VALUE (p) = value;
- TREE_CHAIN (p) = chain;
- return p;
-}
-
-static tree
-my_build_string (str)
- char *str;
-{
- tree p = (tree)obstack_alloc (&type_obstack_entries, sizeof (struct tree_string));
- ++my_tree_node_counter;
- TREE_TYPE (p) = 0;
- ((int *)p)[3] = 0;
- TREE_SET_CODE (p, STRING_CST);
- TREE_STRING_POINTER (p) = str;
- TREE_STRING_LENGTH (p) = strlen (str);
- return p;
-}
-
-/* Memoizing machinery to make searches for multiple inheritance
- reasonably efficient. */
-
-#define MEMOIZE_HASHSIZE 8
-typedef struct memoized_entry
-{
- struct memoized_entry *chain;
- int uid;
- tree data_members[MEMOIZE_HASHSIZE];
- tree function_members[MEMOIZE_HASHSIZE];
-} *ME;
-
-#define MEMOIZED_CHAIN(ENTRY) (((ME)ENTRY)->chain)
-#define MEMOIZED_UID(ENTRY) (((ME)ENTRY)->uid)
-#define MEMOIZED_FIELDS(ENTRY,INDEX) (((ME)ENTRY)->data_members[INDEX])
-#define MEMOIZED_FNFIELDS(ENTRY,INDEX) (((ME)ENTRY)->function_members[INDEX])
-/* The following is probably a lousy hash function. */
-#define MEMOIZED_HASH_FN(NODE) (((long)(NODE)>>4)&(MEMOIZE_HASHSIZE - 1))
-
-static struct memoized_entry *
-my_new_memoized_entry (chain)
- struct memoized_entry *chain;
-{
- struct memoized_entry *p =
- (struct memoized_entry *)obstack_alloc (&type_obstack_entries,
- sizeof (struct memoized_entry));
- bzero ((char *) p, sizeof (struct memoized_entry));
- MEMOIZED_CHAIN (p) = chain;
- MEMOIZED_UID (p) = ++my_memoized_entry_counter;
- return p;
-}
-
-/* Clears the deferred pop from pop_memoized_context, if any. */
-
-static void
-clear_memoized_cache ()
-{
- if (prev_type_stack)
- {
- type_stack = pop_type_level (prev_type_stack);
- prev_type_memoized = 0;
- prev_type_stack = 0;
- }
-}
-
-/* Make an entry in the memoized table for type TYPE
- that the entry for NAME is FIELD. */
-
-static tree
-make_memoized_table_entry (type, name, function_p)
- tree type, name;
- int function_p;
-{
- int idx = MEMOIZED_HASH_FN (name);
- tree entry, *prev_entry;
-
- /* Since we allocate from the type_obstack, we must pop any deferred
- levels. */
- clear_memoized_cache ();
-
- memoized_adds[function_p] += 1;
- if (CLASSTYPE_MTABLE_ENTRY (type) == 0)
- {
- obstack_ptr_grow (&type_obstack, type);
- obstack_blank (&type_obstack, sizeof (struct memoized_entry *));
- CLASSTYPE_MTABLE_ENTRY (type) = (char *)my_new_memoized_entry ((struct memoized_entry *)0);
- type_stack->len++;
- if (type_stack->len * 2 >= type_stack->base.limit)
- my_friendly_abort (88);
- }
- if (function_p)
- prev_entry = &MEMOIZED_FNFIELDS (CLASSTYPE_MTABLE_ENTRY (type), idx);
- else
- prev_entry = &MEMOIZED_FIELDS (CLASSTYPE_MTABLE_ENTRY (type), idx);
-
- entry = my_tree_cons (name, NULL_TREE, *prev_entry);
- *prev_entry = entry;
-
- /* Don't know the error message to give yet. */
- TREE_TYPE (entry) = error_mark_node;
-
- return entry;
-}
-
-/* When a new function or class context is entered, we build
- a table of types which have been searched for members.
- The table is an array (obstack) of types. When a type is
- entered into the obstack, its CLASSTYPE_MTABLE_ENTRY
- field is set to point to a new record, of type struct memoized_entry.
-
- A non-NULL TREE_TYPE of the entry contains an access control error message.
-
- The slots for the data members are arrays of tree nodes.
- These tree nodes are lists, with the TREE_PURPOSE
- of this list the known member name, and the TREE_VALUE
- as the FIELD_DECL for the member.
-
- For member functions, the TREE_PURPOSE is again the
- name of the member functions for that class,
- and the TREE_VALUE of the list is a pairs
- whose TREE_PURPOSE is a member functions of this name,
- and whose TREE_VALUE is a list of known argument lists this
- member function has been called with. The TREE_TYPE of the pair,
- if non-NULL, is an error message to print. */
-
-/* Tell search machinery that we are entering a new context, and
- to update tables appropriately.
-
- TYPE is the type of the context we are entering, which can
- be NULL_TREE if we are not in a class's scope.
-
- USE_OLD, if nonzero tries to use previous context. */
-
-void
-push_memoized_context (type, use_old)
- tree type;
- int use_old;
-{
- int len;
- tree *tem;
-
- if (prev_type_stack)
- {
- if (use_old && prev_type_memoized == type)
- {
-#ifdef GATHER_STATISTICS
- n_contexts_saved++;
-#endif /* GATHER_STATISTICS */
- type_stack = prev_type_stack;
- prev_type_stack = 0;
-
- tem = &type_stack->base.first[0];
- len = type_stack->len;
- while (len--)
- CLASSTYPE_MTABLE_ENTRY (tem[len*2]) = (char *)tem[len*2+1];
- return;
- }
- /* Otherwise, need to pop old stack here. */
- clear_memoized_cache ();
- }
-
- type_stack = push_type_level ((struct stack_level *)type_stack,
- &type_obstack);
- type_stack->type = type;
-}
-
-/* Tell search machinery that we have left a context.
- We do not currently save these contexts for later use.
- If we wanted to, we could not use pop_search_level, since
- poping that level allows the data we have collected to
- be clobbered; a stack of obstacks would be needed. */
-
-void
-pop_memoized_context (use_old)
- int use_old;
-{
- int len;
- tree *tem = &type_stack->base.first[0];
-
- if (! flag_save_memoized_contexts)
- use_old = 0;
- else if (use_old)
- {
- len = type_stack->len;
- while (len--)
- tem[len*2+1] = (tree)CLASSTYPE_MTABLE_ENTRY (tem[len*2]);
-
- /* If there was a deferred pop, we need to pop it now. */
- clear_memoized_cache ();
-
- prev_type_stack = type_stack;
- prev_type_memoized = type_stack->type;
- }
-
- if (flag_memoize_lookups)
- {
- len = type_stack->len;
- while (len--)
- CLASSTYPE_MTABLE_ENTRY (tem[len*2])
- = (char *)MEMOIZED_CHAIN (CLASSTYPE_MTABLE_ENTRY (tem[len*2]));
- }
- if (! use_old)
- type_stack = pop_type_level (type_stack);
- else
- type_stack = (struct type_level *)type_stack->base.prev;
-}
-
-/* Get a virtual binfo that is found inside BINFO's hierarchy that is
- the same type as the type given in PARENT. To be optimal, we want
- the first one that is found by going through the least number of
- virtual bases. */
-
-static tree
-get_vbase_1 (parent, binfo, depth)
- tree parent, binfo;
- unsigned int *depth;
-{
- tree binfos;
- int i, n_baselinks;
- tree rval = NULL_TREE;
-
- if (BINFO_TYPE (binfo) == parent && TREE_VIA_VIRTUAL (binfo))
- {
- *depth = 0;
- return binfo;
- }
-
- *depth = *depth - 1;
-
- binfos = BINFO_BASETYPES (binfo);
- n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Process base types. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree nrval;
-
- if (*depth == 0)
- break;
-
- nrval = get_vbase_1 (parent, base_binfo, depth);
- if (nrval)
- rval = nrval;
- }
- *depth = *depth+1;
- return rval;
-}
-
-tree
-get_vbase (parent, binfo)
- tree parent;
- tree binfo;
-{
- unsigned int d = (unsigned int)-1;
- return get_vbase_1 (parent, binfo, &d);
-}
-
-/* Convert EXPR to a virtual base class of type TYPE. We know that
- EXPR is a non-null POINTER_TYPE to RECORD_TYPE. We also know that
- the type of what expr points to has a virtual base of type TYPE. */
-
-static tree
-convert_pointer_to_vbase (type, expr)
- tree type;
- tree expr;
-{
- tree vb = get_vbase (type, TYPE_BINFO (TREE_TYPE (TREE_TYPE (expr))));
- return convert_pointer_to_real (vb, expr);
-}
-
-/* Check whether the type given in BINFO is derived from PARENT. If
- it isn't, return 0. If it is, but the derivation is MI-ambiguous
- AND protect != 0, emit an error message and return error_mark_node.
-
- Otherwise, if TYPE is derived from PARENT, return the actual base
- information, unless a one of the protection violations below
- occurs, in which case emit an error message and return error_mark_node.
-
- If PROTECT is 1, then check if access to a public field of PARENT
- would be private. Also check for ambiguity. */
-
-tree
-get_binfo (parent, binfo, protect)
- register tree parent, binfo;
- int protect;
-{
- tree type;
- int dist;
- tree rval = NULL_TREE;
-
- if (TREE_CODE (parent) == TREE_VEC)
- parent = BINFO_TYPE (parent);
- else if (! IS_AGGR_TYPE_CODE (TREE_CODE (parent)))
- my_friendly_abort (89);
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (binfo)))
- type = binfo;
- else
- my_friendly_abort (90);
-
- dist = get_base_distance (parent, binfo, protect, &rval);
-
- if (dist == -3)
- {
- cp_error ("fields of `%T' are inaccessible in `%T' due to private inheritance",
- parent, type);
- return error_mark_node;
- }
- else if (dist == -2 && protect)
- {
- cp_error ("type `%T' is ambiguous base class for type `%T'", parent,
- type);
- return error_mark_node;
- }
-
- return rval;
-}
-
-/* This is the newer depth first get_base_distance routine. */
-
-static int
-get_base_distance_recursive (binfo, depth, is_private, rval,
- rval_private_ptr, new_binfo_ptr, parent, path_ptr,
- protect, via_virtual_ptr, via_virtual,
- current_scope_in_chain)
- tree binfo;
- int depth, is_private, rval;
- int *rval_private_ptr;
- tree *new_binfo_ptr, parent, *path_ptr;
- int protect, *via_virtual_ptr, via_virtual;
- int current_scope_in_chain;
-{
- tree binfos;
- int i, n_baselinks;
-
- if (protect
- && !current_scope_in_chain
- && is_friend (BINFO_TYPE (binfo), current_scope ()))
- current_scope_in_chain = 1;
-
- if (BINFO_TYPE (binfo) == parent || binfo == parent)
- {
- if (rval == -1)
- {
- rval = depth;
- *rval_private_ptr = is_private;
- *new_binfo_ptr = binfo;
- *via_virtual_ptr = via_virtual;
- }
- else
- {
- int same_object = (tree_int_cst_equal (BINFO_OFFSET (*new_binfo_ptr),
- BINFO_OFFSET (binfo))
- && *via_virtual_ptr && via_virtual);
-
- if (*via_virtual_ptr && via_virtual==0)
- {
- *rval_private_ptr = is_private;
- *new_binfo_ptr = binfo;
- *via_virtual_ptr = via_virtual;
- }
- else if (same_object)
- {
- if (*rval_private_ptr && ! is_private)
- {
- *rval_private_ptr = is_private;
- *new_binfo_ptr = binfo;
- *via_virtual_ptr = via_virtual;
- }
- return rval;
- }
-
- rval = -2;
- }
- return rval;
- }
-
- binfos = BINFO_BASETYPES (binfo);
- n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- depth += 1;
-
- /* Process base types. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
-
- /* Find any specific instance of a virtual base, when searching with
- a binfo... */
- if (BINFO_MARKED (base_binfo) == 0 || TREE_CODE (parent) == TREE_VEC)
- {
- int via_private
- = (protect
- && (is_private
- || (!TREE_VIA_PUBLIC (base_binfo)
- && !(TREE_VIA_PROTECTED (base_binfo)
- && current_scope_in_chain)
- && !is_friend (BINFO_TYPE (binfo), current_scope ()))));
- int this_virtual = via_virtual || TREE_VIA_VIRTUAL (base_binfo);
- int was;
-
- /* When searching for a non-virtual, we cannot mark
- virtually found binfos. */
- if (! this_virtual)
- SET_BINFO_MARKED (base_binfo);
-
-#define WATCH_VALUES(rval, via_private) (rval == -1 ? 3 : via_private)
-
- was = WATCH_VALUES (rval, *via_virtual_ptr);
- rval = get_base_distance_recursive (base_binfo, depth, via_private,
- rval, rval_private_ptr,
- new_binfo_ptr, parent, path_ptr,
- protect, via_virtual_ptr,
- this_virtual,
- current_scope_in_chain);
- /* watch for updates; only update if path is good. */
- if (path_ptr && WATCH_VALUES (rval, *via_virtual_ptr) != was)
- BINFO_INHERITANCE_CHAIN (base_binfo) = binfo;
- if (rval == -2 && *via_virtual_ptr == 0)
- return rval;
-
-#undef WATCH_VALUES
-
- }
- }
-
- return rval;
-}
-
-/* Return the number of levels between type PARENT and the type given
- in BINFO, following the leftmost path to PARENT not found along a
- virtual path, if there are no real PARENTs (all come from virtual
- base classes), then follow the leftmost path to PARENT.
-
- Return -1 if TYPE is not derived from PARENT.
- Return -2 if PARENT is an ambiguous base class of TYPE, and PROTECT is
- non-negative.
- Return -3 if PARENT is private to TYPE, and PROTECT is non-zero.
-
- If PATH_PTR is non-NULL, then also build the list of types
- from PARENT to TYPE, with TREE_VIA_VIRTUAL and TREE_VIA_PUBLIC
- set.
-
- PARENT can also be a binfo, in which case that exact parent is found
- and no other. convert_pointer_to_real uses this functionality.
-
- If BINFO is a binfo, its BINFO_INHERITANCE_CHAIN will be left alone. */
-
-int
-get_base_distance (parent, binfo, protect, path_ptr)
- register tree parent, binfo;
- int protect;
- tree *path_ptr;
-{
- int rval;
- int rval_private = 0;
- tree type;
- tree new_binfo = NULL_TREE;
- int via_virtual;
- int watch_access = protect;
-
- /* Should we be completing types here? */
- if (TREE_CODE (parent) != TREE_VEC)
- parent = complete_type (TYPE_MAIN_VARIANT (parent));
- else
- complete_type (TREE_TYPE (parent));
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (binfo)))
- {
- type = complete_type (binfo);
- binfo = TYPE_BINFO (type);
-
- if (path_ptr)
- BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE;
- }
- else
- my_friendly_abort (92);
-
- if (parent == type || parent == binfo)
- {
- /* If the distance is 0, then we don't really need
- a path pointer, but we shouldn't let garbage go back. */
- if (path_ptr)
- *path_ptr = binfo;
- return 0;
- }
-
- if (path_ptr)
- watch_access = 1;
-
- rval = get_base_distance_recursive (binfo, 0, 0, -1,
- &rval_private, &new_binfo, parent,
- path_ptr, watch_access, &via_virtual, 0,
- 0);
-
- dfs_walk (binfo, dfs_unmark, markedp);
-
- /* Access restrictions don't count if we found an ambiguous basetype. */
- if (rval == -2 && protect >= 0)
- rval_private = 0;
-
- if (rval && protect && rval_private)
- return -3;
-
- /* find real virtual base classes. */
- if (rval == -1 && TREE_CODE (parent) == TREE_VEC
- && parent == binfo_member (BINFO_TYPE (parent),
- CLASSTYPE_VBASECLASSES (type)))
- {
- BINFO_INHERITANCE_CHAIN (parent) = binfo;
- new_binfo = parent;
- rval = 1;
- }
-
- if (path_ptr)
- *path_ptr = new_binfo;
- return rval;
-}
-
-/* Search for a member with name NAME in a multiple inheritance lattice
- specified by TYPE. If it does not exist, return NULL_TREE.
- If the member is ambiguously referenced, return `error_mark_node'.
- Otherwise, return the FIELD_DECL. */
-
-/* Do a 1-level search for NAME as a member of TYPE. The caller must
- figure out whether it can access this field. (Since it is only one
- level, this is reasonable.) */
-
-static tree
-lookup_field_1 (type, name)
- tree type, name;
-{
- register tree field = TYPE_FIELDS (type);
-
-#ifdef GATHER_STATISTICS
- n_calls_lookup_field_1++;
-#endif /* GATHER_STATISTICS */
- while (field)
- {
-#ifdef GATHER_STATISTICS
- n_fields_searched++;
-#endif /* GATHER_STATISTICS */
- if (DECL_NAME (field) == NULL_TREE
- && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
- {
- tree temp = lookup_field_1 (TREE_TYPE (field), name);
- if (temp)
- return temp;
- }
- if (DECL_NAME (field) == name)
- {
- if ((TREE_CODE(field) == VAR_DECL || TREE_CODE(field) == CONST_DECL)
- && DECL_ASSEMBLER_NAME (field) != NULL)
- GNU_xref_ref(current_function_decl,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (field)));
- return field;
- }
- field = TREE_CHAIN (field);
- }
- /* Not found. */
- if (name == _vptr_name)
- {
- /* Give the user what s/he thinks s/he wants. */
- if (TYPE_VIRTUAL_P (type))
- return CLASSTYPE_VFIELD (type);
- }
- return NULL_TREE;
-}
-
-/* There are a number of cases we need to be aware of here:
- current_class_type current_function_decl
- global NULL NULL
- fn-local NULL SET
- class-local SET NULL
- class->fn SET SET
- fn->class SET SET
-
- Those last two make life interesting. If we're in a function which is
- itself inside a class, we need decls to go into the fn's decls (our
- second case below). But if we're in a class and the class itself is
- inside a function, we need decls to go into the decls for the class. To
- achieve this last goal, we must see if, when both current_class_ptr and
- current_function_decl are set, the class was declared inside that
- function. If so, we know to put the decls into the class's scope. */
-
-tree
-current_scope ()
-{
- if (current_function_decl == NULL_TREE)
- return current_class_type;
- if (current_class_type == NULL_TREE)
- return current_function_decl;
- if (DECL_CLASS_CONTEXT (current_function_decl) == current_class_type)
- return current_function_decl;
-
- return current_class_type;
-}
-
-/* Compute the access of FIELD. This is done by computing
- the access available to each type in BASETYPES (which comes
- as a list of [via_public/basetype] in reverse order, namely base
- class before derived class). The first one which defines a
- access defines the access for the field. Otherwise, the
- access of the field is that which occurs normally.
-
- Uses global variables CURRENT_CLASS_TYPE and
- CURRENT_FUNCTION_DECL to use friend relationships
- if necessary.
-
- This will be static when lookup_fnfield comes into this file.
-
- access_public_node means that the field can be accessed by the current lexical
- scope.
-
- access_protected_node means that the field cannot be accessed by the current
- lexical scope because it is protected.
-
- access_private_node means that the field cannot be accessed by the current
- lexical scope because it is private. */
-
-#if 0
-#define PUBLIC_RETURN return (DECL_PUBLIC (field) = 1), access_public_node
-#define PROTECTED_RETURN return (DECL_PROTECTED (field) = 1), access_protected_node
-#define PRIVATE_RETURN return (DECL_PRIVATE (field) = 1), access_private_node
-#else
-#define PUBLIC_RETURN return access_public_node
-#define PROTECTED_RETURN return access_protected_node
-#define PRIVATE_RETURN return access_private_node
-#endif
-
-#if 0
-/* Disabled with DECL_PUBLIC &c. */
-static tree previous_scope = NULL_TREE;
-#endif
-
-tree
-compute_access (basetype_path, field)
- tree basetype_path, field;
-{
- tree access;
- tree types;
- tree context;
- int protected_ok, via_protected;
- extern int flag_access_control;
-#if 1
- /* Replaces static decl above. */
- tree previous_scope;
-#endif
- int static_mem =
- ((TREE_CODE (field) == FUNCTION_DECL && DECL_STATIC_FUNCTION_P (field))
- || (TREE_CODE (field) != FUNCTION_DECL && TREE_STATIC (field)));
-
- if (! flag_access_control)
- return access_public_node;
-
- /* The field lives in the current class. */
- if (BINFO_TYPE (basetype_path) == current_class_type)
- return access_public_node;
-
-#if 0
- /* Disabled until pushing function scope clears these out. If ever. */
- /* Make these special cases fast. */
- if (current_scope () == previous_scope)
- {
- if (DECL_PUBLIC (field))
- return access_public_node;
- if (DECL_PROTECTED (field))
- return access_protected_node;
- if (DECL_PRIVATE (field))
- return access_private_node;
- }
-#endif
-
- /* We don't currently support access control on nested types. */
- if (TREE_CODE (field) == TYPE_DECL)
- return access_public_node;
-
- previous_scope = current_scope ();
-
- context = DECL_CLASS_CONTEXT (field);
- if (context == NULL_TREE)
- context = DECL_CONTEXT (field);
-
- /* Fields coming from nested anonymous unions have their DECL_CLASS_CONTEXT
- slot set to the union type rather than the record type containing
- the anonymous union. */
- if (context && TREE_CODE (context) == UNION_TYPE
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (context)))
- context = TYPE_CONTEXT (context);
-
- /* Virtual function tables are never private. But we should know that
- we are looking for this, and not even try to hide it. */
- if (DECL_NAME (field) && VFIELD_NAME_P (DECL_NAME (field)) == 1)
- PUBLIC_RETURN;
-
- /* Member found immediately within object. */
- if (BINFO_INHERITANCE_CHAIN (basetype_path) == NULL_TREE)
- {
- /* Are we (or an enclosing scope) friends with the class that has
- FIELD? */
- if (is_friend (context, previous_scope))
- PUBLIC_RETURN;
-
- /* If it's private, it's private, you letch. */
- if (TREE_PRIVATE (field))
- PRIVATE_RETURN;
-
- /* ARM $11.5. Member functions of a derived class can access the
- non-static protected members of a base class only through a
- pointer to the derived class, a reference to it, or an object
- of it. Also any subsequently derived classes also have
- access. */
- else if (TREE_PROTECTED (field))
- {
- if (current_class_type
- && static_mem
- && ACCESSIBLY_DERIVED_FROM_P (context, current_class_type))
- PUBLIC_RETURN;
- else
- PROTECTED_RETURN;
- }
- else
- PUBLIC_RETURN;
- }
-
- /* must reverse more than one element */
- basetype_path = reverse_path (basetype_path);
- types = basetype_path;
- via_protected = 0;
- access = access_default_node;
- protected_ok = static_mem && current_class_type
- && ACCESSIBLY_DERIVED_FROM_P (BINFO_TYPE (types), current_class_type);
-
- while (1)
- {
- tree member;
- tree binfo = types;
- tree type = BINFO_TYPE (binfo);
- int private_ok = 0;
-
- /* Friends of a class can see protected members of its bases.
- Note that classes are their own friends. */
- if (is_friend (type, previous_scope))
- {
- protected_ok = 1;
- private_ok = 1;
- }
-
- member = purpose_member (type, DECL_ACCESS (field));
- if (member)
- {
- access = TREE_VALUE (member);
- break;
- }
-
- types = BINFO_INHERITANCE_CHAIN (types);
-
- /* If the next type was VIA_PROTECTED, then fields of all remaining
- classes past that one are *at least* protected. */
- if (types)
- {
- if (TREE_VIA_PROTECTED (types))
- via_protected = 1;
- else if (! TREE_VIA_PUBLIC (types) && ! private_ok)
- {
- access = access_private_node;
- break;
- }
- }
- else
- break;
- }
- reverse_path (basetype_path);
-
- /* No special visibilities apply. Use normal rules. */
-
- if (access == access_default_node)
- {
- if (is_friend (context, previous_scope))
- access = access_public_node;
- else if (TREE_PRIVATE (field))
- access = access_private_node;
- else if (TREE_PROTECTED (field))
- access = access_protected_node;
- else
- access = access_public_node;
- }
-
- if (access == access_public_node && via_protected)
- access = access_protected_node;
-
- if (access == access_protected_node && protected_ok)
- access = access_public_node;
-
-#if 0
- if (access == access_public_node)
- DECL_PUBLIC (field) = 1;
- else if (access == access_protected_node)
- DECL_PROTECTED (field) = 1;
- else if (access == access_private_node)
- DECL_PRIVATE (field) = 1;
- else my_friendly_abort (96);
-#endif
- return access;
-}
-
-/* Routine to see if the sub-object denoted by the binfo PARENT can be
- found as a base class and sub-object of the object denoted by
- BINFO. This routine relies upon binfos not being shared, except
- for binfos for virtual bases. */
-
-static int
-is_subobject_of_p (parent, binfo)
- tree parent, binfo;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- if (parent == binfo)
- return 1;
-
- /* Process and/or queue base types. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- if (TREE_VIA_VIRTUAL (base_binfo))
- base_binfo = TYPE_BINFO (BINFO_TYPE (base_binfo));
- if (is_subobject_of_p (parent, base_binfo))
- return 1;
- }
- return 0;
-}
-
-/* See if a one FIELD_DECL hides another. This routine is meant to
- correspond to ANSI working paper Sept 17, 1992 10p4. The two
- binfos given are the binfos corresponding to the particular places
- the FIELD_DECLs are found. This routine relies upon binfos not
- being shared, except for virtual bases. */
-
-static int
-hides (hider_binfo, hidee_binfo)
- tree hider_binfo, hidee_binfo;
-{
- /* hider hides hidee, if hider has hidee as a base class and
- the instance of hidee is a sub-object of hider. The first
- part is always true is the second part is true.
-
- When hider and hidee are the same (two ways to get to the exact
- same member) we consider either one as hiding the other. */
- return is_subobject_of_p (hidee_binfo, hider_binfo);
-}
-
-/* Very similar to lookup_fnfields_1 but it ensures that at least one
- function was declared inside the class given by TYPE. It really should
- only return functions that match the given TYPE. */
-
-static int
-lookup_fnfields_here (type, name)
- tree type, name;
-{
- int idx = lookup_fnfields_1 (type, name);
- tree fndecls;
-
- /* ctors and dtors are always only in the right class. */
- if (idx <= 1)
- return idx;
- fndecls = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
- while (fndecls)
- {
- if (TYPE_MAIN_VARIANT (DECL_CLASS_CONTEXT (fndecls))
- == TYPE_MAIN_VARIANT (type))
- return idx;
- fndecls = TREE_CHAIN (fndecls);
- }
- return -1;
-}
-
-/* Look for a field named NAME in an inheritance lattice dominated by
- XBASETYPE. PROTECT is zero if we can avoid computing access
- information, otherwise it is 1. WANT_TYPE is 1 when we should only
- return TYPE_DECLs, if no TYPE_DECL can be found return NULL_TREE.
-
- It was not clear what should happen if WANT_TYPE is set, and an
- ambiguity is found. At least one use (lookup_name) to not see
- the error. */
-
-tree
-lookup_field (xbasetype, name, protect, want_type)
- register tree xbasetype, name;
- int protect, want_type;
-{
- int head = 0, tail = 0;
- tree rval, rval_binfo = NULL_TREE, rval_binfo_h;
- tree type, basetype_chain, basetype_path;
- tree this_v = access_default_node;
- tree entry, binfo, binfo_h;
- tree own_access = access_default_node;
- int vbase_name_p = VBASE_NAME_P (name);
-
- /* rval_binfo is the binfo associated with the found member, note,
- this can be set with useful information, even when rval is not
- set, because it must deal with ALL members, not just non-function
- members. It is used for ambiguity checking and the hidden
- checks. Whereas rval is only set if a proper (not hidden)
- non-function member is found. */
-
- /* rval_binfo_h and binfo_h are binfo values used when we perform the
- hiding checks, as virtual base classes may not be shared. The strategy
- is we always go into the the binfo hierarchy owned by TYPE_BINFO of
- virtual base classes, as we cross virtual base class lines. This way
- we know that binfo of a virtual base class will always == itself when
- found along any line. (mrs) */
-
- char *errstr = 0;
-
- /* Set this to nonzero if we don't know how to compute
- accurate error messages for access control. */
- int idx = MEMOIZED_HASH_FN (name);
-
-#if 0
- /* We cannot search for constructor/destructor names like this. */
- /* This can't go here, but where should it go? */
- /* If we are looking for a constructor in a templated type, use the
- unspecialized name, as that is how we store it. */
- if (IDENTIFIER_TEMPLATE (name))
- name = constructor_name (name);
-#endif
-
- if (xbasetype == current_class_type && TYPE_BEING_DEFINED (xbasetype)
- && IDENTIFIER_CLASS_VALUE (name))
- {
- tree field = IDENTIFIER_CLASS_VALUE (name);
- if (TREE_CODE (field) != FUNCTION_DECL
- && ! (want_type && TREE_CODE (field) != TYPE_DECL))
- return field;
- }
-
- if (TREE_CODE (xbasetype) == TREE_VEC)
- {
- type = BINFO_TYPE (xbasetype);
- basetype_path = xbasetype;
- }
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)))
- {
- type = complete_type (xbasetype);
- basetype_path = TYPE_BINFO (type);
- BINFO_VIA_PUBLIC (basetype_path) = 1;
- BINFO_INHERITANCE_CHAIN (basetype_path) = NULL_TREE;
- }
- else my_friendly_abort (97);
-
- if (CLASSTYPE_MTABLE_ENTRY (type))
- {
- tree tem = MEMOIZED_FIELDS (CLASSTYPE_MTABLE_ENTRY (type), idx);
-
- while (tem && TREE_PURPOSE (tem) != name)
- {
- memoized_fields_searched[0]++;
- tem = TREE_CHAIN (tem);
- }
- if (tem)
- {
- if (protect && TREE_TYPE (tem))
- {
- error (TREE_STRING_POINTER (TREE_TYPE (tem)),
- IDENTIFIER_POINTER (name),
- TYPE_NAME_STRING (DECL_FIELD_CONTEXT (TREE_VALUE (tem))));
- return error_mark_node;
- }
- if (TREE_VALUE (tem) == NULL_TREE)
- memoized_fast_rejects[0] += 1;
- else
- memoized_fast_finds[0] += 1;
- return TREE_VALUE (tem);
- }
- }
-
-#ifdef GATHER_STATISTICS
- n_calls_lookup_field++;
-#endif /* GATHER_STATISTICS */
- if (protect && flag_memoize_lookups && ! global_bindings_p ())
- entry = make_memoized_table_entry (type, name, 0);
- else
- entry = 0;
-
- rval = lookup_field_1 (type, name);
-
- if (rval || lookup_fnfields_here (type, name) >= 0)
- {
- if (rval)
- {
- if (want_type)
- {
- if (TREE_CODE (rval) != TYPE_DECL)
- {
- rval = purpose_member (name, CLASSTYPE_TAGS (type));
- if (rval)
- rval = TYPE_MAIN_DECL (TREE_VALUE (rval));
- }
- }
- else
- {
- if (TREE_CODE (rval) == TYPE_DECL
- && lookup_fnfields_here (type, name) >= 0)
- rval = NULL_TREE;
- }
- }
-
- if (protect && rval)
- {
- if (TREE_PRIVATE (rval) | TREE_PROTECTED (rval))
- this_v = compute_access (basetype_path, rval);
- if (TREE_CODE (rval) == CONST_DECL)
- {
- if (this_v == access_private_node)
- errstr = "enum `%D' is a private value of class `%T'";
- else if (this_v == access_protected_node)
- errstr = "enum `%D' is a protected value of class `%T'";
- }
- else
- {
- if (this_v == access_private_node)
- errstr = "member `%D' is a private member of class `%T'";
- else if (this_v == access_protected_node)
- errstr = "member `%D' is a protected member of class `%T'";
- }
- }
-
- if (entry)
- {
- if (errstr)
- {
- /* This depends on behavior of lookup_field_1! */
- tree error_string = my_build_string (errstr);
- TREE_TYPE (entry) = error_string;
- }
- else
- {
- /* Let entry know there is no problem with this access. */
- TREE_TYPE (entry) = NULL_TREE;
- }
- TREE_VALUE (entry) = rval;
- }
-
- if (errstr && protect)
- {
- cp_error (errstr, name, type);
- return error_mark_node;
- }
- return rval;
- }
-
- basetype_chain = build_tree_list (NULL_TREE, basetype_path);
- TREE_VIA_PUBLIC (basetype_chain) = TREE_VIA_PUBLIC (basetype_path);
- TREE_VIA_PROTECTED (basetype_chain) = TREE_VIA_PROTECTED (basetype_path);
- TREE_VIA_VIRTUAL (basetype_chain) = TREE_VIA_VIRTUAL (basetype_path);
-
- /* The ambiguity check relies upon breadth first searching. */
-
- search_stack = push_search_level (search_stack, &search_obstack);
- binfo = basetype_path;
- binfo_h = binfo;
-
- while (1)
- {
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- tree nval;
-
- /* Process and/or queue base types. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- if (BINFO_FIELDS_MARKED (base_binfo) == 0)
- {
- tree btypes;
-
- SET_BINFO_FIELDS_MARKED (base_binfo);
- btypes = my_tree_cons (NULL_TREE, base_binfo, basetype_chain);
- TREE_VIA_PUBLIC (btypes) = TREE_VIA_PUBLIC (base_binfo);
- TREE_VIA_PROTECTED (btypes) = TREE_VIA_PROTECTED (base_binfo);
- TREE_VIA_VIRTUAL (btypes) = TREE_VIA_VIRTUAL (base_binfo);
- if (TREE_VIA_VIRTUAL (base_binfo))
- btypes = tree_cons (NULL_TREE,
- TYPE_BINFO (BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (binfo_h), i))),
- btypes);
- else
- btypes = tree_cons (NULL_TREE,
- TREE_VEC_ELT (BINFO_BASETYPES (binfo_h), i),
- btypes);
- obstack_ptr_grow (&search_obstack, btypes);
- tail += 1;
- if (tail >= search_stack->limit)
- my_friendly_abort (98);
- }
- }
-
- /* Process head of queue, if one exists. */
- if (head >= tail)
- break;
-
- basetype_chain = search_stack->first[head++];
- binfo_h = TREE_VALUE (basetype_chain);
- basetype_chain = TREE_CHAIN (basetype_chain);
- basetype_path = TREE_VALUE (basetype_chain);
- if (TREE_CHAIN (basetype_chain))
- BINFO_INHERITANCE_CHAIN (basetype_path) = TREE_VALUE (TREE_CHAIN (basetype_chain));
- else
- BINFO_INHERITANCE_CHAIN (basetype_path) = NULL_TREE;
-
- binfo = basetype_path;
- type = BINFO_TYPE (binfo);
-
- /* See if we can find NAME in TYPE. If RVAL is nonzero,
- and we do find NAME in TYPE, verify that such a second
- sighting is in fact valid. */
-
- nval = lookup_field_1 (type, name);
-
- if (nval || lookup_fnfields_here (type, name)>=0)
- {
- if (nval && nval == rval && SHARED_MEMBER_P (nval))
- {
- /* This is ok, the member found is the same [class.ambig] */
- }
- else if (rval_binfo && hides (rval_binfo_h, binfo_h))
- {
- /* This is ok, the member found is in rval_binfo, not
- here (binfo). */
- }
- else if (rval_binfo==NULL_TREE || hides (binfo_h, rval_binfo_h))
- {
- /* This is ok, the member found is here (binfo), not in
- rval_binfo. */
- if (nval)
- {
- rval = nval;
- if (entry || protect)
- this_v = compute_access (basetype_path, rval);
- /* These may look ambiguous, but they really are not. */
- if (vbase_name_p)
- break;
- }
- else
- {
- /* Undo finding it before, as something else hides it. */
- rval = NULL_TREE;
- }
- rval_binfo = binfo;
- rval_binfo_h = binfo_h;
- }
- else
- {
- /* This is ambiguous. */
- errstr = "request for member `%D' is ambiguous";
- protect += 2;
- break;
- }
- }
- }
- {
- tree *tp = search_stack->first;
- tree *search_tail = tp + tail;
-
- if (entry)
- TREE_VALUE (entry) = rval;
-
- if (rval_binfo)
- {
- type = BINFO_TYPE (rval_binfo);
-
- if (rval)
- {
- if (want_type)
- {
- if (TREE_CODE (rval) != TYPE_DECL)
- {
- rval = purpose_member (name, CLASSTYPE_TAGS (type));
- if (rval)
- rval = TYPE_MAIN_DECL (TREE_VALUE (rval));
- }
- }
- else
- {
- if (TREE_CODE (rval) == TYPE_DECL
- && lookup_fnfields_here (type, name) >= 0)
- rval = NULL_TREE;
- }
- }
- }
-
- if (rval == NULL_TREE)
- errstr = 0;
-
- /* If this FIELD_DECL defines its own access level, deal with that. */
- if (rval && errstr == 0
- && ((protect&1) || entry)
- && DECL_LANG_SPECIFIC (rval)
- && DECL_ACCESS (rval))
- {
- while (tp < search_tail)
- {
- /* If is possible for one of the derived types on the path to
- have defined special access for this field. Look for such
- declarations and report an error if a conflict is found. */
- tree new_v;
-
- if (this_v != access_default_node)
- new_v = compute_access (TREE_VALUE (TREE_CHAIN (*tp)), rval);
- if (this_v != access_default_node && new_v != this_v)
- {
- errstr = "conflicting access to member `%D'";
- this_v = access_default_node;
- }
- own_access = new_v;
- CLEAR_BINFO_FIELDS_MARKED (TREE_VALUE (TREE_CHAIN (*tp)));
- tp += 1;
- }
- }
- else
- {
- while (tp < search_tail)
- {
- CLEAR_BINFO_FIELDS_MARKED (TREE_VALUE (TREE_CHAIN (*tp)));
- tp += 1;
- }
- }
- }
- search_stack = pop_search_level (search_stack);
-
- if (errstr == 0)
- {
- if (own_access == access_private_node)
- errstr = "member `%D' declared private";
- else if (own_access == access_protected_node)
- errstr = "member `%D' declared protected";
- else if (this_v == access_private_node)
- errstr = TREE_PRIVATE (rval)
- ? "member `%D' is private"
- : "member `%D' is from private base class";
- else if (this_v == access_protected_node)
- errstr = TREE_PROTECTED (rval)
- ? "member `%D' is protected"
- : "member `%D' is from protected base class";
- }
-
- if (entry)
- {
- if (errstr)
- {
- tree error_string = my_build_string (errstr);
- /* Save error message with entry. */
- TREE_TYPE (entry) = error_string;
- }
- else
- {
- /* Mark entry as having no error string. */
- TREE_TYPE (entry) = NULL_TREE;
- }
- }
-
- if (protect == 2)
- {
- /* If we are not interested in ambiguities, don't report them,
- just return NULL_TREE. */
- rval = NULL_TREE;
- protect = 0;
- }
-
- if (errstr && protect)
- {
- cp_error (errstr, name, type);
- rval = error_mark_node;
- }
- return rval;
-}
-
-/* Try to find NAME inside a nested class. */
-
-tree
-lookup_nested_field (name, complain)
- tree name;
- int complain;
-{
- register tree t;
-
- tree id = NULL_TREE;
- if (TREE_CHAIN (current_class_type))
- {
- /* Climb our way up the nested ladder, seeing if we're trying to
- modify a field in an enclosing class. If so, we should only
- be able to modify if it's static. */
- for (t = TREE_CHAIN (current_class_type);
- t && DECL_CONTEXT (t);
- t = TREE_CHAIN (DECL_CONTEXT (t)))
- {
- if (TREE_CODE (DECL_CONTEXT (t)) != RECORD_TYPE)
- break;
-
- /* N.B.: lookup_field will do the access checking for us */
- id = lookup_field (DECL_CONTEXT (t), name, complain, 0);
- if (id == error_mark_node)
- {
- id = NULL_TREE;
- continue;
- }
-
- if (id != NULL_TREE)
- {
- if (TREE_CODE (id) == FIELD_DECL
- && ! TREE_STATIC (id)
- && TREE_TYPE (id) != error_mark_node)
- {
- if (complain)
- {
- /* At parse time, we don't want to give this error, since
- we won't have enough state to make this kind of
- decision properly. But there are times (e.g., with
- enums in nested classes) when we do need to call
- this fn at parse time. So, in those cases, we pass
- complain as a 0 and just return a NULL_TREE. */
- cp_error ("assignment to non-static member `%D' of enclosing class `%T'",
- id, DECL_CONTEXT (t));
- /* Mark this for do_identifier(). It would otherwise
- claim that the variable was undeclared. */
- TREE_TYPE (id) = error_mark_node;
- }
- else
- {
- id = NULL_TREE;
- continue;
- }
- }
- break;
- }
- }
- }
-
- return id;
-}
-
-/* TYPE is a class type. Return the index of the fields within
- the method vector with name NAME, or -1 is no such field exists. */
-
-static int
-lookup_fnfields_1 (type, name)
- tree type, name;
-{
- register tree method_vec = CLASSTYPE_METHOD_VEC (type);
-
- if (method_vec != 0)
- {
- register tree *methods = &TREE_VEC_ELT (method_vec, 0);
- register tree *end = TREE_VEC_END (method_vec);
-
-#ifdef GATHER_STATISTICS
- n_calls_lookup_fnfields_1++;
-#endif /* GATHER_STATISTICS */
-
- /* Constructors are first... */
- if (*methods && name == ctor_identifier)
- return 0;
-
- /* and destructors are second. */
- if (*++methods && name == dtor_identifier)
- return 1;
-
- while (++methods != end)
- {
-#ifdef GATHER_STATISTICS
- n_outer_fields_searched++;
-#endif /* GATHER_STATISTICS */
- if (DECL_NAME (*methods) == name)
- break;
- }
- if (methods != end)
- return methods - &TREE_VEC_ELT (method_vec, 0);
- }
-
- return -1;
-}
-
-/* Starting from BASETYPE, return a TREE_BASELINK-like object
- which gives the following information (in a list):
-
- TREE_TYPE: list of basetypes needed to get to...
- TREE_VALUE: list of all functions in a given type
- which have name NAME.
-
- No access information is computed by this function,
- other then to adorn the list of basetypes with
- TREE_VIA_PUBLIC.
-
- If there are two ways to find a name (two members), if COMPLAIN is
- non-zero, then error_mark_node is returned, and an error message is
- printed, otherwise, just an error_mark_node is returned.
-
- As a special case, is COMPLAIN is -1, we don't complain, and we
- don't return error_mark_node, but rather the complete list of
- virtuals. This is used by get_virtuals_named_this. */
-
-tree
-lookup_fnfields (basetype_path, name, complain)
- tree basetype_path, name;
- int complain;
-{
- int head = 0, tail = 0;
- tree type, rval, rval_binfo = NULL_TREE, rvals = NULL_TREE, rval_binfo_h;
- tree entry, binfo, basetype_chain, binfo_h;
- int find_all = 0;
-
- /* rval_binfo is the binfo associated with the found member, note,
- this can be set with useful information, even when rval is not
- set, because it must deal with ALL members, not just function
- members. It is used for ambiguity checking and the hidden
- checks. Whereas rval is only set if a proper (not hidden)
- function member is found. */
-
- /* rval_binfo_h and binfo_h are binfo values used when we perform the
- hiding checks, as virtual base classes may not be shared. The strategy
- is we always go into the the binfo hierarchy owned by TYPE_BINFO of
- virtual base classes, as we cross virtual base class lines. This way
- we know that binfo of a virtual base class will always == itself when
- found along any line. (mrs) */
-
- /* For now, don't try this. */
- int protect = complain;
-
- char *errstr = 0;
-
- /* Set this to nonzero if we don't know how to compute
- accurate error messages for access control. */
- int idx = MEMOIZED_HASH_FN (name);
-
- if (complain == -1)
- {
- find_all = 1;
- protect = complain = 0;
- }
-
-#if 0
- /* We cannot search for constructor/destructor names like this. */
- /* This can't go here, but where should it go? */
- /* If we are looking for a constructor in a templated type, use the
- unspecialized name, as that is how we store it. */
- if (IDENTIFIER_TEMPLATE (name))
- name = constructor_name (name);
-#endif
-
- binfo = basetype_path;
- binfo_h = binfo;
- type = complete_type (BINFO_TYPE (basetype_path));
-
- /* The memoization code is in need of maintenance. */
- if (!find_all && CLASSTYPE_MTABLE_ENTRY (type))
- {
- tree tem = MEMOIZED_FNFIELDS (CLASSTYPE_MTABLE_ENTRY (type), idx);
-
- while (tem && TREE_PURPOSE (tem) != name)
- {
- memoized_fields_searched[1]++;
- tem = TREE_CHAIN (tem);
- }
- if (tem)
- {
- if (protect && TREE_TYPE (tem))
- {
- error (TREE_STRING_POINTER (TREE_TYPE (tem)),
- IDENTIFIER_POINTER (name),
- TYPE_NAME_STRING (DECL_CLASS_CONTEXT (TREE_VALUE (TREE_VALUE (tem)))));
- return error_mark_node;
- }
- if (TREE_VALUE (tem) == NULL_TREE)
- {
- memoized_fast_rejects[1] += 1;
- return NULL_TREE;
- }
- else
- {
- /* Want to return this, but we must make sure
- that access information is consistent. */
- tree baselink = TREE_VALUE (tem);
- tree memoized_basetypes = TREE_PURPOSE (baselink);
- tree these_basetypes = basetype_path;
- while (memoized_basetypes && these_basetypes)
- {
- memoized_fields_searched[1]++;
- if (TREE_VALUE (memoized_basetypes) != these_basetypes)
- break;
- memoized_basetypes = TREE_CHAIN (memoized_basetypes);
- these_basetypes = BINFO_INHERITANCE_CHAIN (these_basetypes);
- }
- /* The following statement is true only when both are NULL. */
- if (memoized_basetypes == these_basetypes)
- {
- memoized_fast_finds[1] += 1;
- return TREE_VALUE (tem);
- }
- /* else, we must re-find this field by hand. */
- baselink = tree_cons (basetype_path, TREE_VALUE (baselink), TREE_CHAIN (baselink));
- return baselink;
- }
- }
- }
-
-#ifdef GATHER_STATISTICS
- n_calls_lookup_fnfields++;
-#endif /* GATHER_STATISTICS */
- if (protect && flag_memoize_lookups && ! global_bindings_p ())
- entry = make_memoized_table_entry (type, name, 1);
- else
- entry = 0;
-
- idx = lookup_fnfields_here (type, name);
- if (idx >= 0 || lookup_field_1 (type, name))
- {
- rval_binfo = basetype_path;
- rval_binfo_h = rval_binfo;
- }
-
- if (idx >= 0)
- {
- rval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
- rvals = my_tree_cons (basetype_path, rval, rvals);
- if (BINFO_BASETYPES (binfo) && CLASSTYPE_BASELINK_VEC (type))
- TREE_TYPE (rvals) = TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), idx);
-
- if (entry)
- {
- TREE_VALUE (entry) = rvals;
- TREE_TYPE (entry) = NULL_TREE;
- }
-
- return rvals;
- }
- rval = NULL_TREE;
-
- if (name == ctor_identifier || name == dtor_identifier)
- {
- /* Don't allow lookups of constructors and destructors to go
- deeper than the first place we look. */
- if (entry)
- TREE_TYPE (entry) = TREE_VALUE (entry) = NULL_TREE;
-
- return NULL_TREE;
- }
-
- if (basetype_path == TYPE_BINFO (type))
- {
- basetype_chain = CLASSTYPE_BINFO_AS_LIST (type);
- TREE_VIA_PUBLIC (basetype_chain) = 1;
- BINFO_VIA_PUBLIC (basetype_path) = 1;
- BINFO_INHERITANCE_CHAIN (basetype_path) = NULL_TREE;
- }
- else
- {
- basetype_chain = build_tree_list (NULL_TREE, basetype_path);
- TREE_VIA_PUBLIC (basetype_chain) = TREE_VIA_PUBLIC (basetype_path);
- TREE_VIA_PROTECTED (basetype_chain) = TREE_VIA_PROTECTED (basetype_path);
- TREE_VIA_VIRTUAL (basetype_chain) = TREE_VIA_VIRTUAL (basetype_path);
- }
-
- /* The ambiguity check relies upon breadth first searching. */
-
- search_stack = push_search_level (search_stack, &search_obstack);
- binfo = basetype_path;
- binfo_h = binfo;
-
- while (1)
- {
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- int idx;
-
- /* Process and/or queue base types. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- if (BINFO_FIELDS_MARKED (base_binfo) == 0)
- {
- tree btypes;
-
- SET_BINFO_FIELDS_MARKED (base_binfo);
- btypes = my_tree_cons (NULL_TREE, base_binfo, basetype_chain);
- TREE_VIA_PUBLIC (btypes) = TREE_VIA_PUBLIC (base_binfo);
- TREE_VIA_PROTECTED (btypes) = TREE_VIA_PROTECTED (base_binfo);
- TREE_VIA_VIRTUAL (btypes) = TREE_VIA_VIRTUAL (base_binfo);
- if (TREE_VIA_VIRTUAL (base_binfo))
- btypes = tree_cons (NULL_TREE,
- TYPE_BINFO (BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (binfo_h), i))),
- btypes);
- else
- btypes = tree_cons (NULL_TREE,
- TREE_VEC_ELT (BINFO_BASETYPES (binfo_h), i),
- btypes);
- obstack_ptr_grow (&search_obstack, btypes);
- tail += 1;
- if (tail >= search_stack->limit)
- my_friendly_abort (99);
- }
- }
-
- /* Process head of queue, if one exists. */
- if (head >= tail)
- break;
-
- basetype_chain = search_stack->first[head++];
- binfo_h = TREE_VALUE (basetype_chain);
- basetype_chain = TREE_CHAIN (basetype_chain);
- basetype_path = TREE_VALUE (basetype_chain);
- if (TREE_CHAIN (basetype_chain))
- BINFO_INHERITANCE_CHAIN (basetype_path) = TREE_VALUE (TREE_CHAIN (basetype_chain));
- else
- BINFO_INHERITANCE_CHAIN (basetype_path) = NULL_TREE;
-
- binfo = basetype_path;
- type = BINFO_TYPE (binfo);
-
- /* See if we can find NAME in TYPE. If RVAL is nonzero,
- and we do find NAME in TYPE, verify that such a second
- sighting is in fact valid. */
-
- idx = lookup_fnfields_here (type, name);
-
- if (idx >= 0 || (lookup_field_1 (type, name)!=NULL_TREE && !find_all))
- {
- if (rval_binfo && !find_all && hides (rval_binfo_h, binfo_h))
- {
- /* This is ok, the member found is in rval_binfo, not
- here (binfo). */
- }
- else if (rval_binfo==NULL_TREE || find_all || hides (binfo_h, rval_binfo_h))
- {
- /* This is ok, the member found is here (binfo), not in
- rval_binfo. */
- if (idx >= 0)
- {
- rval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
- /* Note, rvals can only be previously set if find_all is
- true. */
- rvals = my_tree_cons (basetype_path, rval, rvals);
- if (TYPE_BINFO_BASETYPES (type)
- && CLASSTYPE_BASELINK_VEC (type))
- TREE_TYPE (rvals) = TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), idx);
- }
- else
- {
- /* Undo finding it before, as something else hides it. */
- rval = NULL_TREE;
- rvals = NULL_TREE;
- }
- rval_binfo = binfo;
- rval_binfo_h = binfo_h;
- }
- else
- {
- /* This is ambiguous. */
- errstr = "request for method `%D' is ambiguous";
- rvals = error_mark_node;
- break;
- }
- }
- }
- {
- tree *tp = search_stack->first;
- tree *search_tail = tp + tail;
-
- while (tp < search_tail)
- {
- CLEAR_BINFO_FIELDS_MARKED (TREE_VALUE (TREE_CHAIN (*tp)));
- tp += 1;
- }
- }
- search_stack = pop_search_level (search_stack);
-
- if (entry)
- {
- if (errstr)
- {
- tree error_string = my_build_string (errstr);
- /* Save error message with entry. */
- TREE_TYPE (entry) = error_string;
- }
- else
- {
- /* Mark entry as having no error string. */
- TREE_TYPE (entry) = NULL_TREE;
- TREE_VALUE (entry) = rvals;
- }
- }
-
- if (errstr && protect)
- {
- cp_error (errstr, name);
- rvals = error_mark_node;
- }
-
- return rvals;
-}
-
-/* BREADTH-FIRST SEARCH ROUTINES. */
-
-/* Search a multiple inheritance hierarchy by breadth-first search.
-
- BINFO is an aggregate type, possibly in a multiple-inheritance hierarchy.
- TESTFN is a function, which, if true, means that our condition has been met,
- and its return value should be returned.
- QFN, if non-NULL, is a predicate dictating whether the type should
- even be queued. */
-
-static HOST_WIDE_INT
-breadth_first_search (binfo, testfn, qfn)
- tree binfo;
- int (*testfn)();
- int (*qfn)();
-{
- int head = 0, tail = 0;
- int rval = 0;
-
- search_stack = push_search_level (search_stack, &search_obstack);
-
- while (1)
- {
- tree binfos = BINFO_BASETYPES (binfo);
- int n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- int i;
-
- /* Process and/or queue base types. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
-
- if (BINFO_MARKED (base_binfo) == 0
- && (qfn == 0 || (*qfn) (binfo, i)))
- {
- SET_BINFO_MARKED (base_binfo);
- obstack_ptr_grow (&search_obstack, binfo);
- obstack_ptr_grow (&search_obstack, (HOST_WIDE_INT) i);
- tail += 2;
- if (tail >= search_stack->limit)
- my_friendly_abort (100);
- }
- }
- /* Process head of queue, if one exists. */
- if (head >= tail)
- {
- rval = 0;
- break;
- }
-
- binfo = search_stack->first[head++];
- i = (HOST_WIDE_INT) search_stack->first[head++];
- if (rval = (*testfn) (binfo, i))
- break;
- binfo = BINFO_BASETYPE (binfo, i);
- }
- {
- tree *tp = search_stack->first;
- tree *search_tail = tp + tail;
- while (tp < search_tail)
- {
- tree binfo = *tp++;
- int i = (HOST_WIDE_INT)(*tp++);
- CLEAR_BINFO_MARKED (BINFO_BASETYPE (binfo, i));
- }
- }
-
- search_stack = pop_search_level (search_stack);
- return rval;
-}
-
-/* Functions to use in breadth first searches. */
-typedef tree (*pft)();
-typedef int (*pfi)();
-
-static tree declarator;
-
-static tree
-get_virtuals_named_this (binfo)
- tree binfo;
-{
- tree fields;
-
- fields = lookup_fnfields (binfo, declarator, -1);
- /* fields cannot be error_mark_node */
-
- if (fields == 0)
- return 0;
-
- /* Get to the function decls, and return the first virtual function
- with this name, if there is one. */
- while (fields)
- {
- tree fndecl;
-
- for (fndecl = TREE_VALUE (fields); fndecl; fndecl = DECL_CHAIN (fndecl))
- if (DECL_VINDEX (fndecl))
- return fields;
- fields = next_baselink (fields);
- }
- return NULL_TREE;
-}
-
-static tree
-get_virtual_destructor (binfo, i)
- tree binfo;
- int i;
-{
- tree type = BINFO_TYPE (binfo);
- if (i >= 0)
- type = BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (binfo), i));
- if (TYPE_HAS_DESTRUCTOR (type)
- && DECL_VINDEX (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), 1)))
- return TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), 1);
- return 0;
-}
-
-static int
-tree_has_any_destructor_p (binfo, i)
- tree binfo;
- int i;
-{
- tree type = BINFO_TYPE (binfo);
- if (i >= 0)
- type = BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (binfo), i));
- return TYPE_NEEDS_DESTRUCTOR (type);
-}
-
-/* Given a class type TYPE, and a function decl FNDECL, look for a
- virtual function in TYPE's hierarchy which FNDECL could match as a
- virtual function. It doesn't matter which one we find.
-
- DTORP is nonzero if we are looking for a destructor. Destructors
- need special treatment because they do not match by name. */
-
-tree
-get_matching_virtual (binfo, fndecl, dtorp)
- tree binfo, fndecl;
- int dtorp;
-{
- tree tmp = NULL_TREE;
-
- /* Breadth first search routines start searching basetypes
- of TYPE, so we must perform first ply of search here. */
- if (dtorp)
- {
- if (tree_has_any_destructor_p (binfo, -1))
- tmp = get_virtual_destructor (binfo, -1);
-
- if (tmp)
- return tmp;
-
- tmp = (tree) breadth_first_search (binfo,
- (pfi) get_virtual_destructor,
- tree_has_any_destructor_p);
- return tmp;
- }
- else
- {
- tree drettype, dtypes, btypes, instptr_type;
- tree basetype = DECL_CLASS_CONTEXT (fndecl);
- tree baselink, best = NULL_TREE;
- tree name = DECL_ASSEMBLER_NAME (fndecl);
-
- declarator = DECL_NAME (fndecl);
- if (IDENTIFIER_VIRTUAL_P (declarator) == 0)
- return NULL_TREE;
-
- baselink = get_virtuals_named_this (binfo);
- if (baselink == NULL_TREE)
- return NULL_TREE;
-
- drettype = TREE_TYPE (TREE_TYPE (fndecl));
- dtypes = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
- if (DECL_STATIC_FUNCTION_P (fndecl))
- instptr_type = NULL_TREE;
- else
- instptr_type = TREE_TYPE (TREE_VALUE (dtypes));
-
- for (; baselink; baselink = next_baselink (baselink))
- {
- for (tmp = TREE_VALUE (baselink); tmp; tmp = DECL_CHAIN (tmp))
- {
- if (! DECL_VINDEX (tmp))
- continue;
-
- btypes = TYPE_ARG_TYPES (TREE_TYPE (tmp));
- if (instptr_type == NULL_TREE)
- {
- if (compparms (TREE_CHAIN (btypes), dtypes, 3))
- /* Caller knows to give error in this case. */
- return tmp;
- return NULL_TREE;
- }
-
- if ((TYPE_READONLY (TREE_TYPE (TREE_VALUE (btypes)))
- == TYPE_READONLY (instptr_type))
- && compparms (TREE_CHAIN (btypes), TREE_CHAIN (dtypes), 3))
- {
- tree brettype = TREE_TYPE (TREE_TYPE (tmp));
- if (comptypes (brettype, drettype, 1))
- /* OK */;
- else if
- (TREE_CODE (brettype) == TREE_CODE (drettype)
- && (TREE_CODE (brettype) == POINTER_TYPE
- || TREE_CODE (brettype) == REFERENCE_TYPE)
- && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (brettype)),
- TYPE_MAIN_VARIANT (TREE_TYPE (drettype)),
- 0))
- /* covariant return type */
- {
- tree b = TREE_TYPE (brettype), d = TREE_TYPE (drettype);
- if (TYPE_MAIN_VARIANT (b) != TYPE_MAIN_VARIANT (d))
- {
- tree binfo = get_binfo (b, d, 1);
- if (binfo != error_mark_node
- && ! BINFO_OFFSET_ZEROP (binfo))
- sorry ("adjusting pointers for covariant returns");
- }
- if (TYPE_READONLY (d) > TYPE_READONLY (b))
- {
- cp_error_at ("return type of `%#D' adds const", fndecl);
- cp_error_at (" overriding definition as `%#D'",
- tmp);
- }
- else if (TYPE_VOLATILE (d) > TYPE_VOLATILE (b))
- {
- cp_error_at ("return type of `%#D' adds volatile",
- fndecl);
- cp_error_at (" overriding definition as `%#D'",
- tmp);
- }
- }
- else if (IS_AGGR_TYPE_2 (brettype, drettype)
- && comptypes (brettype, drettype, 0))
- {
- error ("invalid covariant return type (must use pointer or reference)");
- cp_error_at (" overriding `%#D'", tmp);
- cp_error_at (" with `%#D'", fndecl);
- }
- else if (IDENTIFIER_ERROR_LOCUS (name) == NULL_TREE)
- {
- cp_error_at ("conflicting return type specified for virtual function `%#D'", fndecl);
- cp_error_at (" overriding definition as `%#D'", tmp);
- SET_IDENTIFIER_ERROR_LOCUS (name, basetype);
- }
- break;
- }
- }
- if (tmp)
- {
- best = tmp;
- break;
- }
- }
-
- return best;
- }
-}
-
-/* Return the list of virtual functions which are abstract in type
- TYPE that come from non virtual base classes. See
- expand_direct_vtbls_init for the style of search we do. */
-
-static tree
-get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)
- tree binfo;
- int do_self;
- tree abstract_virtuals;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable =
- i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
- if (! TREE_VIA_VIRTUAL (base_binfo))
- abstract_virtuals
- = get_abstract_virtuals_1 (base_binfo, is_not_base_vtable,
- abstract_virtuals);
- }
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
- {
- tree virtuals = BINFO_VIRTUALS (binfo);
-
- skip_rtti_stuff (&virtuals);
-
- while (virtuals)
- {
- tree base_pfn = FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals));
- tree base_fndecl = TREE_OPERAND (base_pfn, 0);
- if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))
- abstract_virtuals = tree_cons (NULL_TREE, base_fndecl, abstract_virtuals);
- virtuals = TREE_CHAIN (virtuals);
- }
- }
- return abstract_virtuals;
-}
-
-/* Return the list of virtual functions which are abstract in type TYPE.
- This information is cached, and so must be built on a
- non-temporary obstack. */
-
-tree
-get_abstract_virtuals (type)
- tree type;
-{
- tree vbases;
- tree abstract_virtuals = CLASSTYPE_ABSTRACT_VIRTUALS (type);
-
- /* First get all from non-virtual bases. */
- abstract_virtuals
- = get_abstract_virtuals_1 (TYPE_BINFO (type), 1, abstract_virtuals);
-
- for (vbases = CLASSTYPE_VBASECLASSES (type); vbases; vbases = TREE_CHAIN (vbases))
- {
- tree virtuals = BINFO_VIRTUALS (vbases);
-
- skip_rtti_stuff (&virtuals);
-
- while (virtuals)
- {
- tree base_pfn = FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals));
- tree base_fndecl = TREE_OPERAND (base_pfn, 0);
- if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))
- abstract_virtuals = tree_cons (NULL_TREE, base_fndecl, abstract_virtuals);
- virtuals = TREE_CHAIN (virtuals);
- }
- }
- return nreverse (abstract_virtuals);
-}
-
-/* For the type TYPE, return a list of member functions available from
- base classes with name NAME. The TREE_VALUE of the list is a chain of
- member functions with name NAME. The TREE_PURPOSE of the list is a
- basetype, or a list of base types (in reverse order) which were
- traversed to reach the chain of member functions. If we reach a base
- type which provides a member function of name NAME, and which has at
- most one base type itself, then we can terminate the search. */
-
-tree
-get_baselinks (type_as_binfo_list, type, name)
- tree type_as_binfo_list;
- tree type, name;
-{
- int head = 0, tail = 0, idx;
- tree rval = 0, nval = 0;
- tree basetypes = type_as_binfo_list;
- tree binfo = TYPE_BINFO (type);
-
- search_stack = push_search_level (search_stack, &search_obstack);
-
- while (1)
- {
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Process and/or queue base types. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree btypes;
-
- btypes = hash_tree_cons (TREE_VIA_PUBLIC (base_binfo),
- TREE_VIA_VIRTUAL (base_binfo),
- TREE_VIA_PROTECTED (base_binfo),
- NULL_TREE, base_binfo,
- basetypes);
- obstack_ptr_grow (&search_obstack, btypes);
- search_stack->first = (tree *)obstack_base (&search_obstack);
- tail += 1;
- }
-
- dont_queue:
- /* Process head of queue, if one exists. */
- if (head >= tail)
- break;
-
- basetypes = search_stack->first[head++];
- binfo = TREE_VALUE (basetypes);
- type = BINFO_TYPE (binfo);
- idx = lookup_fnfields_1 (type, name);
- if (idx >= 0)
- {
- nval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
- rval = hash_tree_cons (0, 0, 0, basetypes, nval, rval);
- if (TYPE_BINFO_BASETYPES (type) == 0)
- goto dont_queue;
- else if (TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type)) == 1)
- {
- if (CLASSTYPE_BASELINK_VEC (type))
- TREE_TYPE (rval) = TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), idx);
- goto dont_queue;
- }
- }
- nval = NULL_TREE;
- }
-
- search_stack = pop_search_level (search_stack);
- return rval;
-}
-
-tree
-next_baselink (baselink)
- tree baselink;
-{
- tree tmp = TREE_TYPE (baselink);
- baselink = TREE_CHAIN (baselink);
- while (tmp)
- {
- /* @@ does not yet add previous base types. */
- baselink = tree_cons (TREE_PURPOSE (tmp), TREE_VALUE (tmp),
- baselink);
- TREE_TYPE (baselink) = TREE_TYPE (tmp);
- tmp = TREE_CHAIN (tmp);
- }
- return baselink;
-}
-
-/* DEPTH-FIRST SEARCH ROUTINES. */
-
-/* Assign unique numbers to _CLASSTYPE members of the lattice
- specified by TYPE. The root nodes are marked first; the nodes
- are marked depth-fisrt, left-right. */
-
-static int cid;
-
-/* Matrix implementing a relation from CLASSTYPE X CLASSTYPE => INT.
- Relation yields 1 if C1 <= C2, 0 otherwise. */
-typedef char mi_boolean;
-static mi_boolean *mi_matrix;
-
-/* Type for which this matrix is defined. */
-static tree mi_type;
-
-/* Size of the matrix for indexing purposes. */
-static int mi_size;
-
-/* Return nonzero if class C2 derives from class C1. */
-#define BINFO_DERIVES_FROM(C1, C2) \
- ((mi_matrix+mi_size*(BINFO_CID (C1)-1))[BINFO_CID (C2)-1])
-#define TYPE_DERIVES_FROM(C1, C2) \
- ((mi_matrix+mi_size*(CLASSTYPE_CID (C1)-1))[CLASSTYPE_CID (C2)-1])
-#define BINFO_DERIVES_FROM_STAR(C) \
- (mi_matrix+(BINFO_CID (C)-1))
-
-/* This routine converts a pointer to be a pointer of an immediate
- base class. The normal convert_pointer_to routine would diagnose
- the conversion as ambiguous, under MI code that has the base class
- as an ambiguous base class. */
-
-static tree
-convert_pointer_to_single_level (to_type, expr)
- tree to_type, expr;
-{
- tree binfo_of_derived;
- tree last;
-
- binfo_of_derived = TYPE_BINFO (TREE_TYPE (TREE_TYPE (expr)));
- last = get_binfo (to_type, TREE_TYPE (TREE_TYPE (expr)), 0);
- BINFO_INHERITANCE_CHAIN (last) = binfo_of_derived;
- BINFO_INHERITANCE_CHAIN (binfo_of_derived) = NULL_TREE;
- return build_vbase_path (PLUS_EXPR, build_pointer_type (to_type), expr, last, 1);
-}
-
-/* The main function which implements depth first search.
-
- This routine has to remember the path it walked up, when
- dfs_init_vbase_pointers is the work function, as otherwise there
- would be no record. */
-
-static void
-dfs_walk (binfo, fn, qfn)
- tree binfo;
- void (*fn)();
- int (*qfn)();
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
-
- if (qfn == 0 || (*qfn)(base_binfo))
- {
- if (TREE_CODE (BINFO_TYPE (base_binfo)) == TEMPLATE_TYPE_PARM)
- /* Pass */;
- else if (fn == dfs_init_vbase_pointers)
- {
- /* When traversing an arbitrary MI hierarchy, we need to keep
- a record of the path we took to get down to the final base
- type, as otherwise there would be no record of it, and just
- trying to blindly convert at the bottom would be ambiguous.
-
- The easiest way is to do the conversions one step at a time,
- as we know we want the immediate base class at each step.
-
- The only special trick to converting one step at a time,
- is that when we hit the last virtual base class, we must
- use the SLOT value for it, and not use the normal convert
- routine. We use the last virtual base class, as in our
- implementation, we have pointers to all virtual base
- classes in the base object. */
-
- tree saved_vbase_decl_ptr_intermediate
- = vbase_decl_ptr_intermediate;
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- {
- /* No need for the conversion here, as we know it is the
- right type. */
- vbase_decl_ptr_intermediate
- = CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (base_binfo));
- }
- else
- {
- vbase_decl_ptr_intermediate
- = convert_pointer_to_single_level (BINFO_TYPE (base_binfo),
- vbase_decl_ptr_intermediate);
- }
-
- dfs_walk (base_binfo, fn, qfn);
-
- vbase_decl_ptr_intermediate = saved_vbase_decl_ptr_intermediate;
- }
- else
- dfs_walk (base_binfo, fn, qfn);
- }
- }
-
- fn (binfo);
-}
-
-/* Predicate functions which serve for dfs_walk. */
-static int numberedp (binfo) tree binfo;
-{ return BINFO_CID (binfo); }
-static int unnumberedp (binfo) tree binfo;
-{ return BINFO_CID (binfo) == 0; }
-
-static int markedp (binfo) tree binfo;
-{ return BINFO_MARKED (binfo); }
-static int unmarkedp (binfo) tree binfo;
-{ return BINFO_MARKED (binfo) == 0; }
-
-#if 0
-static int bfs_markedp (binfo, i) tree binfo; int i;
-{ return BINFO_MARKED (BINFO_BASETYPE (binfo, i)); }
-static int bfs_unmarkedp (binfo, i) tree binfo; int i;
-{ return BINFO_MARKED (BINFO_BASETYPE (binfo, i)) == 0; }
-static int bfs_marked_vtable_pathp (binfo, i) tree binfo; int i;
-{ return BINFO_VTABLE_PATH_MARKED (BINFO_BASETYPE (binfo, i)); }
-static int bfs_unmarked_vtable_pathp (binfo, i) tree binfo; int i;
-{ return BINFO_VTABLE_PATH_MARKED (BINFO_BASETYPE (binfo, i)) == 0; }
-static int bfs_marked_new_vtablep (binfo, i) tree binfo; int i;
-{ return BINFO_NEW_VTABLE_MARKED (BINFO_BASETYPE (binfo, i)); }
-static int bfs_unmarked_new_vtablep (binfo, i) tree binfo; int i;
-{ return BINFO_NEW_VTABLE_MARKED (BINFO_BASETYPE (binfo, i)) == 0; }
-#endif
-
-static int marked_vtable_pathp (binfo) tree binfo;
-{ return BINFO_VTABLE_PATH_MARKED (binfo); }
-static int unmarked_vtable_pathp (binfo) tree binfo;
-{ return BINFO_VTABLE_PATH_MARKED (binfo) == 0; }
-static int marked_new_vtablep (binfo) tree binfo;
-{ return BINFO_NEW_VTABLE_MARKED (binfo); }
-static int unmarked_new_vtablep (binfo) tree binfo;
-{ return BINFO_NEW_VTABLE_MARKED (binfo) == 0; }
-
-#if 0
-static int dfs_search_slot_nonempty_p (binfo) tree binfo;
-{ return CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (binfo)) != 0; }
-#endif
-
-static int dfs_debug_unmarkedp (binfo) tree binfo;
-{ return CLASSTYPE_DEBUG_REQUESTED (BINFO_TYPE (binfo)) == 0; }
-
-/* The worker functions for `dfs_walk'. These do not need to
- test anything (vis a vis marking) if they are paired with
- a predicate function (above). */
-
-/* Assign each type within the lattice a number which is unique
- in the lattice. The first number assigned is 1. */
-
-static void
-dfs_number (binfo)
- tree binfo;
-{
- BINFO_CID (binfo) = ++cid;
-}
-
-static void
-dfs_unnumber (binfo)
- tree binfo;
-{
- BINFO_CID (binfo) = 0;
-}
-
-#if 0
-static void
-dfs_mark (binfo) tree binfo;
-{ SET_BINFO_MARKED (binfo); }
-#endif
-
-static void
-dfs_unmark (binfo) tree binfo;
-{ CLEAR_BINFO_MARKED (binfo); }
-
-#if 0
-static void
-dfs_mark_vtable_path (binfo) tree binfo;
-{ SET_BINFO_VTABLE_PATH_MARKED (binfo); }
-
-static void
-dfs_unmark_vtable_path (binfo) tree binfo;
-{ CLEAR_BINFO_VTABLE_PATH_MARKED (binfo); }
-
-static void
-dfs_mark_new_vtable (binfo) tree binfo;
-{ SET_BINFO_NEW_VTABLE_MARKED (binfo); }
-
-static void
-dfs_unmark_new_vtable (binfo) tree binfo;
-{ CLEAR_BINFO_NEW_VTABLE_MARKED (binfo); }
-
-static void
-dfs_clear_search_slot (binfo) tree binfo;
-{ CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (binfo)) = 0; }
-#endif
-
-static void
-dfs_debug_mark (binfo)
- tree binfo;
-{
- tree t = BINFO_TYPE (binfo);
-
- /* Use heuristic that if there are virtual functions,
- ignore until we see a non-inline virtual function. */
- tree methods = CLASSTYPE_METHOD_VEC (t);
-
- CLASSTYPE_DEBUG_REQUESTED (t) = 1;
-
- if (methods == 0)
- return;
-
- /* If interface info is known, either we've already emitted the debug
- info or we don't need to. */
- if (CLASSTYPE_INTERFACE_KNOWN (t)
- || (write_virtuals == 2 && TYPE_VIRTUAL_P (t)))
- return;
-
- /* If debug info is requested from this context for this type, supply it.
- If debug info is requested from another context for this type,
- see if some third context can supply it. */
- if (current_function_decl == NULL_TREE
- || DECL_CLASS_CONTEXT (current_function_decl) != t)
- {
- if (TREE_VEC_ELT (methods, 1))
- methods = TREE_VEC_ELT (methods, 1);
- else if (TREE_VEC_ELT (methods, 0))
- methods = TREE_VEC_ELT (methods, 0);
- else
- methods = TREE_VEC_ELT (methods, 2);
- while (methods)
- {
- if (DECL_VINDEX (methods)
- && DECL_THIS_INLINE (methods) == 0
- && DECL_ABSTRACT_VIRTUAL_P (methods) == 0)
- {
- /* Somebody, somewhere is going to have to define this
- virtual function. When they do, they will provide
- the debugging info. */
- return;
- }
- methods = TREE_CHAIN (methods);
- }
- }
- /* We cannot rely on some alien method to solve our problems,
- so we must write out the debug info ourselves. */
- TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = 0;
- rest_of_type_compilation (t, global_bindings_p ());
-}
-
-/* Attach to the type of the virtual base class, the pointer to the
- virtual base class, given the global pointer vbase_decl_ptr.
-
- We use the global vbase_types. ICK! */
-
-static void
-dfs_find_vbases (binfo)
- tree binfo;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = n_baselinks-1; i >= 0; i--)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
-
- if (TREE_VIA_VIRTUAL (base_binfo)
- && CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (base_binfo)) == 0)
- {
- tree vbase = BINFO_TYPE (base_binfo);
- tree binfo = binfo_member (vbase, vbase_types);
-
- CLASSTYPE_SEARCH_SLOT (vbase)
- = build (PLUS_EXPR, build_pointer_type (vbase),
- vbase_decl_ptr, BINFO_OFFSET (binfo));
- }
- }
- SET_BINFO_VTABLE_PATH_MARKED (binfo);
- SET_BINFO_NEW_VTABLE_MARKED (binfo);
-}
-
-static void
-dfs_init_vbase_pointers (binfo)
- tree binfo;
-{
- tree type = BINFO_TYPE (binfo);
- tree fields = TYPE_FIELDS (type);
- tree this_vbase_ptr;
-
- CLEAR_BINFO_VTABLE_PATH_MARKED (binfo);
-
-#if 0
- /* See finish_struct_1 for when we can enable this. */
- /* If we have a vtable pointer first, skip it. */
- if (VFIELD_NAME_P (DECL_NAME (fields)))
- fields = TREE_CHAIN (fields);
-#endif
-
- if (fields == NULL_TREE
- || DECL_NAME (fields) == NULL_TREE
- || ! VBASE_NAME_P (DECL_NAME (fields)))
- return;
-
- this_vbase_ptr = vbase_decl_ptr_intermediate;
-
- if (build_pointer_type (type) != TYPE_MAIN_VARIANT (TREE_TYPE (this_vbase_ptr)))
- my_friendly_abort (125);
-
- while (fields && DECL_NAME (fields)
- && VBASE_NAME_P (DECL_NAME (fields)))
- {
- tree ref = build (COMPONENT_REF, TREE_TYPE (fields),
- build_indirect_ref (this_vbase_ptr, NULL_PTR), fields);
- tree init = CLASSTYPE_SEARCH_SLOT (TREE_TYPE (TREE_TYPE (fields)));
- vbase_init_result = tree_cons (binfo_member (TREE_TYPE (TREE_TYPE (fields)),
- vbase_types),
- build_modify_expr (ref, NOP_EXPR, init),
- vbase_init_result);
- fields = TREE_CHAIN (fields);
- }
-}
-
-/* Sometimes this needs to clear both VTABLE_PATH and NEW_VTABLE. Other
- times, just NEW_VTABLE, but optimizer should make both with equal
- efficiency (though it does not currently). */
-
-static void
-dfs_clear_vbase_slots (binfo)
- tree binfo;
-{
- tree type = BINFO_TYPE (binfo);
- CLASSTYPE_SEARCH_SLOT (type) = 0;
- CLEAR_BINFO_VTABLE_PATH_MARKED (binfo);
- CLEAR_BINFO_NEW_VTABLE_MARKED (binfo);
-}
-
-tree
-init_vbase_pointers (type, decl_ptr)
- tree type;
- tree decl_ptr;
-{
- if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- {
- int old_flag = flag_this_is_variable;
- tree binfo = TYPE_BINFO (type);
- flag_this_is_variable = -2;
- vbase_types = CLASSTYPE_VBASECLASSES (type);
- vbase_decl_ptr = vbase_decl_ptr_intermediate = decl_ptr;
- vbase_init_result = NULL_TREE;
- dfs_walk (binfo, dfs_find_vbases, unmarked_vtable_pathp);
- dfs_walk (binfo, dfs_init_vbase_pointers, marked_vtable_pathp);
- dfs_walk (binfo, dfs_clear_vbase_slots, marked_new_vtablep);
- flag_this_is_variable = old_flag;
- return vbase_init_result;
- }
- return 0;
-}
-
-/* get the virtual context (the vbase that directly contains the
- DECL_CLASS_CONTEXT of the FNDECL) that the given FNDECL is declared in,
- or NULL_TREE if there is none.
-
- FNDECL must come from a virtual table from a virtual base to ensure that
- there is only one possible DECL_CLASS_CONTEXT.
-
- We know that if there is more than one place (binfo) the fndecl that the
- declared, they all refer to the same binfo. See get_class_offset_1 for
- the check that ensures this. */
-
-static tree
-virtual_context (fndecl, t, vbase)
- tree fndecl, t, vbase;
-{
- tree path;
- if (get_base_distance (DECL_CLASS_CONTEXT (fndecl), t, 0, &path) < 0)
- {
- /* DECL_CLASS_CONTEXT can be ambiguous in t. */
- if (get_base_distance (DECL_CLASS_CONTEXT (fndecl), vbase, 0, &path) >= 0)
- {
- while (path)
- {
- /* Not sure if checking path == vbase is necessary here, but just in
- case it is. */
- if (TREE_VIA_VIRTUAL (path) || path == vbase)
- return binfo_member (BINFO_TYPE (path), CLASSTYPE_VBASECLASSES (t));
- path = BINFO_INHERITANCE_CHAIN (path);
- }
- }
- /* This shouldn't happen, I don't want errors! */
- warning ("recoverable compiler error, fixups for virtual function");
- return vbase;
- }
- while (path)
- {
- if (TREE_VIA_VIRTUAL (path))
- return binfo_member (BINFO_TYPE (path), CLASSTYPE_VBASECLASSES (t));
- path = BINFO_INHERITANCE_CHAIN (path);
- }
- return 0;
-}
-
-/* Fixups upcast offsets for one vtable.
- Entries may stay within the VBASE given, or
- they may upcast into a direct base, or
- they may upcast into a different vbase.
-
- We only need to do fixups in case 2 and 3. In case 2, we add in
- the virtual base offset to effect an upcast, in case 3, we add in
- the virtual base offset to effect an upcast, then subtract out the
- offset for the other virtual base, to effect a downcast into it.
-
- This routine mirrors fixup_vtable_deltas in functionality, though
- this one is runtime based, and the other is compile time based.
- Conceivably that routine could be removed entirely, and all fixups
- done at runtime.
-
- VBASE_OFFSETS is an association list of virtual bases that contains
- offset information for the virtual bases, so the offsets are only
- calculated once. The offsets are computed by where we think the
- vbase should be (as noted by the CLASSTYPE_SEARCH_SLOT) minus where
- the vbase really is. */
-
-static void
-expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
- vbase_offsets)
- tree binfo, addr, orig_addr, vbase, vbase_addr, t, *vbase_offsets;
-{
- tree virtuals = BINFO_VIRTUALS (binfo);
- tree vc;
- tree delta;
- unsigned HOST_WIDE_INT n;
-
- delta = purpose_member (vbase, *vbase_offsets);
- if (! delta)
- {
- delta = CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (vbase));
- delta = build (MINUS_EXPR, ptrdiff_type_node, delta, vbase_addr);
- delta = save_expr (delta);
- delta = tree_cons (vbase, delta, *vbase_offsets);
- *vbase_offsets = delta;
- }
-
- n = skip_rtti_stuff (&virtuals);
-
- while (virtuals)
- {
- tree current_fndecl = TREE_VALUE (virtuals);
- current_fndecl = FNADDR_FROM_VTABLE_ENTRY (current_fndecl);
- current_fndecl = TREE_OPERAND (current_fndecl, 0);
- if (current_fndecl
- && current_fndecl != abort_fndecl
- && (vc=virtual_context (current_fndecl, t, vbase)) != vbase)
- {
- /* This may in fact need a runtime fixup. */
- tree idx = build_int_2 (n, 0);
- tree vtbl = BINFO_VTABLE (binfo);
- tree nvtbl = lookup_name (DECL_NAME (vtbl), 0);
- tree aref, ref, naref;
- tree old_delta, new_delta;
- tree init;
-
- if (nvtbl == NULL_TREE
- || nvtbl == IDENTIFIER_GLOBAL_VALUE (DECL_NAME (vtbl)))
- {
- /* Dup it if it isn't in local scope yet. */
- nvtbl = build_decl (VAR_DECL,
- DECL_NAME (vtbl),
- TYPE_MAIN_VARIANT (TREE_TYPE (BINFO_VTABLE (binfo))));
- DECL_ALIGN (nvtbl) = MAX (TYPE_ALIGN (double_type_node),
- DECL_ALIGN (nvtbl));
- TREE_READONLY (nvtbl) = 0;
- DECL_ARTIFICIAL (nvtbl) = 1;
- nvtbl = pushdecl (nvtbl);
- init = NULL_TREE;
- cp_finish_decl (nvtbl, init, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
- DECL_VIRTUAL_P (nvtbl) = 1;
- DECL_CONTEXT (nvtbl) = t;
- init = build (MODIFY_EXPR, TREE_TYPE (nvtbl),
- nvtbl, vtbl);
- TREE_SIDE_EFFECTS (init) = 1;
- expand_expr_stmt (init);
- /* Update the vtable pointers as necessary. */
- ref = build_vfield_ref (build_indirect_ref (addr, NULL_PTR), DECL_CONTEXT (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))));
- expand_expr_stmt (build_modify_expr (ref, NOP_EXPR,
- build_unary_op (ADDR_EXPR, nvtbl, 0)));
- }
- assemble_external (vtbl);
- aref = build_array_ref (vtbl, idx);
- naref = build_array_ref (nvtbl, idx);
- old_delta = build_component_ref (aref, delta_identifier, NULL_TREE, 0);
- new_delta = build_component_ref (naref, delta_identifier, NULL_TREE, 0);
-
- /* This is a upcast, so we have to add the offset for the
- virtual base. */
- old_delta = build_binary_op (PLUS_EXPR, old_delta,
- TREE_VALUE (delta), 0);
- if (vc)
- {
- /* If this is set, we need to subtract out the delta
- adjustments for the other virtual base that we
- downcast into. */
- tree vc_delta = purpose_member (vc, *vbase_offsets);
- if (! vc_delta)
- {
- tree vc_addr = convert_pointer_to_real (vc, orig_addr);
- vc_delta = CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (vc));
- vc_delta = build (MINUS_EXPR, ptrdiff_type_node,
- vc_delta, vc_addr);
- vc_delta = save_expr (vc_delta);
- *vbase_offsets = tree_cons (vc, vc_delta, *vbase_offsets);
- }
- else
- vc_delta = TREE_VALUE (vc_delta);
-
- /* This is a downcast, so we have to subtract the offset
- for the virtual base. */
- old_delta = build_binary_op (MINUS_EXPR, old_delta, vc_delta, 0);
- }
-
- TREE_READONLY (new_delta) = 0;
- expand_expr_stmt (build_modify_expr (new_delta, NOP_EXPR,
- old_delta));
- }
- ++n;
- virtuals = TREE_CHAIN (virtuals);
- }
-}
-
-/* Fixup upcast offsets for all direct vtables. Patterned after
- expand_direct_vtbls_init. */
-
-static void
-fixup_virtual_upcast_offsets (real_binfo, binfo, init_self, can_elide, addr, orig_addr, type, vbase, vbase_offsets)
- tree real_binfo, binfo;
- int init_self, can_elide;
- tree addr, orig_addr, type, vbase, *vbase_offsets;
-{
- tree real_binfos = BINFO_BASETYPES (real_binfo);
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = real_binfos ? TREE_VEC_LENGTH (real_binfos) : 0;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree real_base_binfo = TREE_VEC_ELT (real_binfos, i);
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- int is_not_base_vtable =
- i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (real_binfo));
- if (! TREE_VIA_VIRTUAL (real_base_binfo))
- fixup_virtual_upcast_offsets (real_base_binfo, base_binfo,
- is_not_base_vtable, can_elide, addr,
- orig_addr, type, vbase, vbase_offsets);
- }
-#if 0
- /* Before turning this on, make sure it is correct. */
- if (can_elide && ! BINFO_MODIFIED (binfo))
- return;
-#endif
- /* Should we use something besides CLASSTYPE_VFIELDS? */
- if (init_self && CLASSTYPE_VFIELDS (BINFO_TYPE (real_binfo)))
- {
- tree new_addr = convert_pointer_to_real (binfo, addr);
- expand_upcast_fixups (real_binfo, new_addr, orig_addr, vbase, addr,
- type, vbase_offsets);
- }
-}
-
-/* Build a COMPOUND_EXPR which when expanded will generate the code
- needed to initialize all the virtual function table slots of all
- the virtual baseclasses. MAIN_BINFO is the binfo which determines
- the virtual baseclasses to use; TYPE is the type of the object to
- which the initialization applies. TRUE_EXP is the true object we
- are initializing, and DECL_PTR is the pointer to the sub-object we
- are initializing.
-
- When USE_COMPUTED_OFFSETS is non-zero, we can assume that the
- object was laid out by a top-level constructor and the computed
- offsets are valid to store vtables. When zero, we must store new
- vtables through virtual baseclass pointers.
-
- We setup and use the globals: vbase_decl_ptr, vbase_types
- ICK! */
-
-void
-expand_indirect_vtbls_init (binfo, true_exp, decl_ptr)
- tree binfo;
- tree true_exp, decl_ptr;
-{
- tree type = BINFO_TYPE (binfo);
-
- if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- {
- rtx fixup_insns = NULL_RTX;
- tree vbases = CLASSTYPE_VBASECLASSES (type);
- vbase_types = vbases;
- vbase_decl_ptr = true_exp ? build_unary_op (ADDR_EXPR, true_exp, 0) : decl_ptr;
-
- dfs_walk (binfo, dfs_find_vbases, unmarked_new_vtablep);
-
- /* Initialized with vtables of type TYPE. */
- for (; vbases; vbases = TREE_CHAIN (vbases))
- {
- tree addr;
-
- addr = convert_pointer_to_vbase (TREE_TYPE (vbases), vbase_decl_ptr);
-
- /* Do all vtables from this virtual base. */
- /* This assumes that virtual bases can never serve as parent
- binfos. (in the CLASSTPE_VFIELD_PARENT sense) */
- expand_direct_vtbls_init (vbases, TYPE_BINFO (BINFO_TYPE (vbases)),
- 1, 0, addr);
-
- /* Now we adjust the offsets for virtual functions that
- cross virtual boundaries on an implicit upcast on vf call
- so that the layout of the most complete type is used,
- instead of assuming the layout of the virtual bases from
- our current type. */
-
- if (flag_vtable_thunks)
- {
- /* We don't have dynamic thunks yet!
- So for now, just fail silently. */
- }
- else
- {
- tree vbase_offsets = NULL_TREE;
- push_to_sequence (fixup_insns);
- fixup_virtual_upcast_offsets (vbases,
- TYPE_BINFO (BINFO_TYPE (vbases)),
- 1, 0, addr, vbase_decl_ptr,
- type, vbases, &vbase_offsets);
- fixup_insns = get_insns ();
- end_sequence ();
- }
- }
-
- if (fixup_insns)
- {
- extern tree in_charge_identifier;
- tree in_charge_node = lookup_name (in_charge_identifier, 0);
- if (! in_charge_node)
- {
- warning ("recoverable internal compiler error, nobody's in charge!");
- in_charge_node = integer_zero_node;
- }
- in_charge_node = build_binary_op (EQ_EXPR, in_charge_node, integer_zero_node, 1);
- expand_start_cond (in_charge_node, 0);
- emit_insns (fixup_insns);
- expand_end_cond ();
- }
-
- dfs_walk (binfo, dfs_clear_vbase_slots, marked_new_vtablep);
- }
-}
-
-/* get virtual base class types.
- This adds type to the vbase_types list in reverse dfs order.
- Ordering is very important, so don't change it. */
-
-static void
-dfs_get_vbase_types (binfo)
- tree binfo;
-{
- if (TREE_VIA_VIRTUAL (binfo) && ! BINFO_VBASE_MARKED (binfo))
- {
- vbase_types = make_binfo (integer_zero_node, binfo,
- BINFO_VTABLE (binfo),
- BINFO_VIRTUALS (binfo), vbase_types);
- TREE_VIA_VIRTUAL (vbase_types) = 1;
- SET_BINFO_VBASE_MARKED (binfo);
- }
- SET_BINFO_MARKED (binfo);
-}
-
-/* get a list of virtual base classes in dfs order. */
-
-tree
-get_vbase_types (type)
- tree type;
-{
- tree vbases;
- tree binfo;
-
- if (TREE_CODE (type) == TREE_VEC)
- binfo = type;
- else
- binfo = TYPE_BINFO (type);
-
- vbase_types = NULL_TREE;
- dfs_walk (binfo, dfs_get_vbase_types, unmarkedp);
- dfs_walk (binfo, dfs_unmark, markedp);
- /* Rely upon the reverse dfs ordering from dfs_get_vbase_types, and now
- reverse it so that we get normal dfs ordering. */
- vbase_types = nreverse (vbase_types);
-
- /* unmark marked vbases */
- for (vbases = vbase_types; vbases; vbases = TREE_CHAIN (vbases))
- CLEAR_BINFO_VBASE_MARKED (vbases);
-
- return vbase_types;
-}
-
-static void
-dfs_record_inheritance (binfo)
- tree binfo;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
- mi_boolean *derived_row = BINFO_DERIVES_FROM_STAR (binfo);
-
- for (i = n_baselinks-1; i >= 0; i--)
- {
- int j;
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tree baseclass = BINFO_TYPE (base_binfo);
- mi_boolean *base_row = BINFO_DERIVES_FROM_STAR (base_binfo);
-
- /* Don't search if there's nothing there! MI_SIZE can be
- zero as a result of parse errors. */
- if (TYPE_BINFO_BASETYPES (baseclass) && mi_size > 0)
- for (j = mi_size*(CLASSTYPE_CID (baseclass)-1); j >= 0; j -= mi_size)
- derived_row[j] |= base_row[j];
- TYPE_DERIVES_FROM (baseclass, BINFO_TYPE (binfo)) = 1;
- }
-
- SET_BINFO_MARKED (binfo);
-}
-
-/* Given a _CLASSTYPE node in a multiple inheritance lattice,
- convert the lattice into a simple relation such that,
- given to CIDs, C1 and C2, one can determine if C1 <= C2
- or C2 <= C1 or C1 <> C2.
-
- Once constructed, we walk the lattice depth fisrt,
- applying various functions to elements as they are encountered.
-
- We use xmalloc here, in case we want to randomly free these tables. */
-
-#define SAVE_MI_MATRIX
-
-void
-build_mi_matrix (type)
- tree type;
-{
- tree binfo = TYPE_BINFO (type);
- cid = 0;
-
-#ifdef SAVE_MI_MATRIX
- if (CLASSTYPE_MI_MATRIX (type))
- {
- mi_size = CLASSTYPE_N_SUPERCLASSES (type) + CLASSTYPE_N_VBASECLASSES (type);
- mi_matrix = CLASSTYPE_MI_MATRIX (type);
- mi_type = type;
- dfs_walk (binfo, dfs_number, unnumberedp);
- return;
- }
-#endif
-
- dfs_walk (binfo, dfs_number, unnumberedp);
-
- mi_size = CLASSTYPE_N_SUPERCLASSES (type) + CLASSTYPE_N_VBASECLASSES (type);
- if (mi_size < (cid-1))
- mi_size = cid-1;
- mi_matrix = (char *)xmalloc ((mi_size + 1) * (mi_size + 1));
- mi_type = type;
- bzero (mi_matrix, (mi_size + 1) * (mi_size + 1));
- dfs_walk (binfo, dfs_record_inheritance, unmarkedp);
- dfs_walk (binfo, dfs_unmark, markedp);
-}
-
-void
-free_mi_matrix ()
-{
- dfs_walk (TYPE_BINFO (mi_type), dfs_unnumber, numberedp);
-
-#ifdef SAVE_MI_MATRIX
- CLASSTYPE_MI_MATRIX (mi_type) = mi_matrix;
-#else
- free (mi_matrix);
- mi_size = 0;
- cid = 0;
-#endif
-}
-
-/* If we want debug info for a type TYPE, make sure all its base types
- are also marked as being potentially interesting. This avoids
- the problem of not writing any debug info for intermediate basetypes
- that have abstract virtual functions. Also mark member types. */
-
-void
-note_debug_info_needed (type)
- tree type;
-{
- tree field;
-
- if (current_template_parms)
- return;
-
- /* We can't do the TYPE_DECL_SUPPRESS_DEBUG thing with DWARF, which
- does not support name references between translation units. Well, we
- could, but that would mean putting global labels in the debug output
- before each exported type and each of its functions and static data
- members. */
- if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
- return;
-
- dfs_walk (TYPE_BINFO (type), dfs_debug_mark, dfs_debug_unmarkedp);
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- {
- tree ttype;
- if (TREE_CODE (field) == FIELD_DECL
- && IS_AGGR_TYPE (ttype = target_type (TREE_TYPE (field)))
- && dfs_debug_unmarkedp (TYPE_BINFO (ttype)))
- note_debug_info_needed (ttype);
- }
-}
-
-/* Subroutines of push_class_decls (). */
-
-/* Add in a decl to the envelope. */
-static void
-envelope_add_decl (type, decl, values)
- tree type, decl, *values;
-{
- tree context, *tmp;
- tree name = DECL_NAME (decl);
- int dont_add = 0;
-
- /* virtual base names are always unique. */
- if (VBASE_NAME_P (name))
- *values = NULL_TREE;
-
- /* Possible ambiguity. If its defining type(s)
- is (are all) derived from us, no problem. */
- else if (*values && TREE_CODE (*values) != TREE_LIST)
- {
- tree value = *values;
- /* Only complain if we shadow something we can access. */
- if (warn_shadow && TREE_CODE (decl) == FUNCTION_DECL
- && ((DECL_LANG_SPECIFIC (*values)
- && DECL_CLASS_CONTEXT (value) == current_class_type)
- || ! TREE_PRIVATE (value)))
- /* Should figure out access control more accurately. */
- {
- cp_warning_at ("member `%#D' is shadowed", value);
- cp_warning_at ("by member function `%#D'", decl);
- warning ("in this context");
- }
-
- context = (TREE_CODE (value) == FUNCTION_DECL
- && DECL_VIRTUAL_P (value))
- ? DECL_CLASS_CONTEXT (value)
- : DECL_CONTEXT (value);
-
- if (context == type)
- {
- if (TREE_CODE (value) == TYPE_DECL
- && DECL_ARTIFICIAL (value))
- *values = NULL_TREE;
- else
- dont_add = 1;
- }
- /* If we don't check CLASSTYPE_CID on CONTEXT right now, we'll end
- up subtracting from the address of MI_MATRIX, putting us off
- in la la land. */
- else if (context
- && CLASSTYPE_CID (context)
- && TYPE_DERIVES_FROM (context, type))
- {
- /* Don't add in *values to list */
- *values = NULL_TREE;
- }
- else
- *values = build_tree_list (NULL_TREE, value);
- }
- else
- for (tmp = values; *tmp;)
- {
- tree value = TREE_VALUE (*tmp);
- my_friendly_assert (TREE_CODE (value) != TREE_LIST, 999);
- context = (TREE_CODE (value) == FUNCTION_DECL
- && DECL_VIRTUAL_P (value))
- ? DECL_CLASS_CONTEXT (value)
- : DECL_CONTEXT (value);
-
- /* If we don't check CLASSTYPE_CID on CONTEXT right now, we'll end
- up subtracting from the address of MI_MATRIX, putting us off
- in la la land. */
- if (context
- && CLASSTYPE_CID (context)
- && TYPE_DERIVES_FROM (context, type))
- {
- /* remove *tmp from list */
- *tmp = TREE_CHAIN (*tmp);
- }
- else
- tmp = &TREE_CHAIN (*tmp);
- }
-
- if (! dont_add)
- {
- /* Put the new contents in our envelope. */
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- *values = tree_cons (name, decl, *values);
- TREE_NONLOCAL_FLAG (*values) = 1;
- TREE_TYPE (*values) = unknown_type_node;
- }
- else
- {
- if (*values)
- {
- *values = tree_cons (NULL_TREE, decl, *values);
- /* Mark this as a potentially ambiguous member. */
- /* Leaving TREE_TYPE blank is intentional.
- We cannot use `error_mark_node' (lookup_name)
- or `unknown_type_node' (all member functions use this). */
- TREE_NONLOCAL_FLAG (*values) = 1;
- }
- else
- *values = decl;
- }
- }
-}
-
-/* Add the instance variables which this class contributed to the
- current class binding contour. When a redefinition occurs, if the
- redefinition is strictly within a single inheritance path, we just
- overwrite the old declaration with the new. If the fields are not
- within a single inheritance path, we must cons them.
-
- In order to know what decls are new (stemming from the current
- invocation of push_class_decls) we enclose them in an "envelope",
- which is a TREE_LIST node where the TREE_PURPOSE slot contains the
- new decl (or possibly a list of competing ones), the TREE_VALUE slot
- points to the old value and the TREE_CHAIN slot chains together all
- envelopes which needs to be "opened" in push_class_decls. Opening an
- envelope means: push the old value onto the class_shadowed list,
- install the new one and if it's a TYPE_DECL do the same to the
- IDENTIFIER_TYPE_VALUE. Such an envelope is recognized by seeing that
- the TREE_PURPOSE slot is non-null, and that it is not an identifier.
- Because if it is, it could be a set of overloaded methods from an
- outer scope. */
-
-static void
-dfs_pushdecls (binfo)
- tree binfo;
-{
- tree type = BINFO_TYPE (binfo);
- tree fields, *methods, *end;
- tree method_vec;
-
- for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
- {
- /* Unmark so that if we are in a constructor, and then find that
- this field was initialized by a base initializer,
- we can emit an error message. */
- if (TREE_CODE (fields) == FIELD_DECL)
- TREE_USED (fields) = 0;
-
- /* Recurse into anonymous unions. */
- if (DECL_NAME (fields) == NULL_TREE
- && TREE_CODE (TREE_TYPE (fields)) == UNION_TYPE)
- {
- dfs_pushdecls (TYPE_BINFO (TREE_TYPE (fields)));
- continue;
- }
-
- if (DECL_NAME (fields))
- {
- tree name = DECL_NAME (fields);
- tree class_value = IDENTIFIER_CLASS_VALUE (name);
-
- /* If the class value is not an envelope of the kind described in
- the comment above, we create a new envelope. */
- if (class_value == NULL_TREE || TREE_CODE (class_value) != TREE_LIST
- || TREE_PURPOSE (class_value) == NULL_TREE
- || TREE_CODE (TREE_PURPOSE (class_value)) == IDENTIFIER_NODE)
- {
- /* See comment above for a description of envelopes. */
- closed_envelopes = tree_cons (NULL_TREE, class_value,
- closed_envelopes);
- IDENTIFIER_CLASS_VALUE (name) = closed_envelopes;
- class_value = IDENTIFIER_CLASS_VALUE (name);
- }
-
- envelope_add_decl (type, fields, &TREE_PURPOSE (class_value));
- }
- }
-
- method_vec = CLASSTYPE_METHOD_VEC (type);
- if (method_vec)
- {
- /* Farm out constructors and destructors. */
- methods = &TREE_VEC_ELT (method_vec, 2);
- end = TREE_VEC_END (method_vec);
-
- while (methods != end)
- {
- /* This will cause lookup_name to return a pointer
- to the tree_list of possible methods of this name. */
- tree name = DECL_NAME (*methods);
- tree class_value = IDENTIFIER_CLASS_VALUE (name);
-
- /* If the class value is not an envelope of the kind described in
- the comment above, we create a new envelope. */
- if (class_value == NULL_TREE || TREE_CODE (class_value) != TREE_LIST
- || TREE_PURPOSE (class_value) == NULL_TREE
- || TREE_CODE (TREE_PURPOSE (class_value)) == IDENTIFIER_NODE)
- {
- /* See comment above for a description of envelopes. */
- closed_envelopes = tree_cons (NULL_TREE, class_value,
- closed_envelopes);
- IDENTIFIER_CLASS_VALUE (name) = closed_envelopes;
- class_value = IDENTIFIER_CLASS_VALUE (name);
- }
-
- /* Here we try to rule out possible ambiguities.
- If we can't do that, keep a TREE_LIST with possibly ambiguous
- decls in there. */
- maybe_push_cache_obstack ();
- envelope_add_decl (type, *methods, &TREE_PURPOSE (class_value));
- pop_obstacks ();
-
- methods++;
- }
- }
- SET_BINFO_MARKED (binfo);
-}
-
-/* Consolidate unique (by name) member functions. */
-
-static void
-dfs_compress_decls (binfo)
- tree binfo;
-{
- tree type = BINFO_TYPE (binfo);
- tree method_vec = CLASSTYPE_METHOD_VEC (type);
-
- if (method_vec != 0)
- {
- /* Farm out constructors and destructors. */
- tree *methods = &TREE_VEC_ELT (method_vec, 2);
- tree *end = TREE_VEC_END (method_vec);
-
- for (; methods != end; methods++)
- {
- /* This is known to be an envelope of the kind described before
- dfs_pushdecls. */
- tree class_value = IDENTIFIER_CLASS_VALUE (DECL_NAME (*methods));
- tree tmp = TREE_PURPOSE (class_value);
-
- /* This was replaced in scope by somebody else. Just leave it
- alone. */
- if (TREE_CODE (tmp) != TREE_LIST)
- continue;
-
- if (TREE_CHAIN (tmp) == NULL_TREE
- && TREE_VALUE (tmp)
- && DECL_CHAIN (TREE_VALUE (tmp)) == NULL_TREE)
- {
- TREE_PURPOSE (class_value) = TREE_VALUE (tmp);
- }
- }
- }
- CLEAR_BINFO_MARKED (binfo);
-}
-
-/* When entering the scope of a class, we cache all of the
- fields that that class provides within its inheritance
- lattice. Where ambiguities result, we mark them
- with `error_mark_node' so that if they are encountered
- without explicit qualification, we can emit an error
- message. */
-
-void
-push_class_decls (type)
- tree type;
-{
- struct obstack *ambient_obstack = current_obstack;
- search_stack = push_search_level (search_stack, &search_obstack);
-
- /* Push class fields into CLASS_VALUE scope, and mark. */
- dfs_walk (TYPE_BINFO (type), dfs_pushdecls, unmarkedp);
-
- /* Compress fields which have only a single entry
- by a given name, and unmark. */
- dfs_walk (TYPE_BINFO (type), dfs_compress_decls, markedp);
-
- /* Open up all the closed envelopes and push the contained decls into
- class scope. */
- while (closed_envelopes)
- {
- tree new = TREE_PURPOSE (closed_envelopes);
- tree id;
-
- /* This is messy because the class value may be a *_DECL, or a
- TREE_LIST of overloaded *_DECLs or even a TREE_LIST of ambiguous
- *_DECLs. The name is stored at different places in these three
- cases. */
- if (TREE_CODE (new) == TREE_LIST)
- {
- if (TREE_PURPOSE (new) != NULL_TREE)
- id = TREE_PURPOSE (new);
- else
- {
- tree node = TREE_VALUE (new);
-
- while (TREE_CODE (node) == TREE_LIST)
- node = TREE_VALUE (node);
- id = DECL_NAME (node);
- }
- }
- else
- id = DECL_NAME (new);
-
- /* Install the original class value in order to make
- pushdecl_class_level work correctly. */
- IDENTIFIER_CLASS_VALUE (id) = TREE_VALUE (closed_envelopes);
- if (TREE_CODE (new) == TREE_LIST)
- push_class_level_binding (id, new);
- else
- pushdecl_class_level (new);
- closed_envelopes = TREE_CHAIN (closed_envelopes);
- }
- current_obstack = ambient_obstack;
-}
-
-/* Here's a subroutine we need because C lacks lambdas. */
-
-static void
-dfs_unuse_fields (binfo)
- tree binfo;
-{
- tree type = TREE_TYPE (binfo);
- tree fields;
-
- for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
- {
- if (TREE_CODE (fields) != FIELD_DECL)
- continue;
-
- TREE_USED (fields) = 0;
- if (DECL_NAME (fields) == NULL_TREE
- && TREE_CODE (TREE_TYPE (fields)) == UNION_TYPE)
- unuse_fields (TREE_TYPE (fields));
- }
-}
-
-void
-unuse_fields (type)
- tree type;
-{
- dfs_walk (TYPE_BINFO (type), dfs_unuse_fields, unmarkedp);
-}
-
-void
-pop_class_decls ()
-{
- /* We haven't pushed a search level when dealing with cached classes,
- so we'd better not try to pop it. */
- if (search_stack)
- search_stack = pop_search_level (search_stack);
-}
-
-void
-print_search_statistics ()
-{
-#ifdef GATHER_STATISTICS
- if (flag_memoize_lookups)
- {
- fprintf (stderr, "%d memoized contexts saved\n",
- n_contexts_saved);
- fprintf (stderr, "%d local tree nodes made\n", my_tree_node_counter);
- fprintf (stderr, "%d local hash nodes made\n", my_memoized_entry_counter);
- fprintf (stderr, "fields statistics:\n");
- fprintf (stderr, " memoized finds = %d; rejects = %d; (searches = %d)\n",
- memoized_fast_finds[0], memoized_fast_rejects[0],
- memoized_fields_searched[0]);
- fprintf (stderr, " memoized_adds = %d\n", memoized_adds[0]);
- fprintf (stderr, "fnfields statistics:\n");
- fprintf (stderr, " memoized finds = %d; rejects = %d; (searches = %d)\n",
- memoized_fast_finds[1], memoized_fast_rejects[1],
- memoized_fields_searched[1]);
- fprintf (stderr, " memoized_adds = %d\n", memoized_adds[1]);
- }
- fprintf (stderr, "%d fields searched in %d[%d] calls to lookup_field[_1]\n",
- n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1);
- fprintf (stderr, "%d fnfields searched in %d calls to lookup_fnfields\n",
- n_outer_fields_searched, n_calls_lookup_fnfields);
- fprintf (stderr, "%d calls to get_base_type\n", n_calls_get_base_type);
-#else /* GATHER_STATISTICS */
- fprintf (stderr, "no search statistics\n");
-#endif /* GATHER_STATISTICS */
-}
-
-void
-init_search_processing ()
-{
- gcc_obstack_init (&search_obstack);
- gcc_obstack_init (&type_obstack);
- gcc_obstack_init (&type_obstack_entries);
-
- /* This gives us room to build our chains of basetypes,
- whether or not we decide to memoize them. */
- type_stack = push_type_level ((struct stack_level *)0, &type_obstack);
- _vptr_name = get_identifier ("_vptr");
-}
-
-void
-reinit_search_statistics ()
-{
- my_memoized_entry_counter = 0;
- memoized_fast_finds[0] = 0;
- memoized_fast_finds[1] = 0;
- memoized_adds[0] = 0;
- memoized_adds[1] = 0;
- memoized_fast_rejects[0] = 0;
- memoized_fast_rejects[1] = 0;
- memoized_fields_searched[0] = 0;
- memoized_fields_searched[1] = 0;
-#ifdef GATHER_STATISTICS
- n_fields_searched = 0;
- n_calls_lookup_field = 0, n_calls_lookup_field_1 = 0;
- n_calls_lookup_fnfields = 0, n_calls_lookup_fnfields_1 = 0;
- n_calls_get_base_type = 0;
- n_outer_fields_searched = 0;
- n_contexts_saved = 0;
-#endif /* GATHER_STATISTICS */
-}
-
-static tree conversions;
-static void
-add_conversions (binfo)
- tree binfo;
-{
- int i;
- tree method_vec = CLASSTYPE_METHOD_VEC (BINFO_TYPE (binfo));
-
- for (i = 2; i < TREE_VEC_LENGTH (method_vec); ++i)
- {
- tree tmp = TREE_VEC_ELT (method_vec, i);
- if (! IDENTIFIER_TYPENAME_P (DECL_NAME (tmp)))
- break;
- conversions = tree_cons (binfo, tmp, conversions);
- }
- SET_BINFO_MARKED (binfo);
-}
-
-tree
-lookup_conversions (type)
- tree type;
-{
- conversions = NULL_TREE;
- if (TYPE_SIZE (type))
- {
- dfs_walk (TYPE_BINFO (type), add_conversions, unmarkedp);
- dfs_walk (TYPE_BINFO (type), dfs_unmark, markedp);
- }
- return conversions;
-}
-
-/* Subroutine of get_template_base. */
-
-static tree
-get_template_base_recursive (binfo, rval, template, via_virtual)
- tree binfo, template, rval;
- int via_virtual;
-{
- tree binfos;
- int i, n_baselinks;
- tree type = BINFO_TYPE (binfo);
-
- if (CLASSTYPE_TEMPLATE_INFO (type)
- && CLASSTYPE_TI_TEMPLATE (type) == template)
- {
- if (rval == NULL_TREE || rval == type)
- return type;
- else
- return error_mark_node;
- }
-
- binfos = BINFO_BASETYPES (binfo);
- n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Process base types. */
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
-
- /* Find any specific instance of a virtual base, when searching with
- a binfo... */
- if (BINFO_MARKED (base_binfo) == 0)
- {
- int this_virtual = via_virtual || TREE_VIA_VIRTUAL (base_binfo);
-
- /* When searching for a non-virtual, we cannot mark
- virtually found binfos. */
- if (! this_virtual)
- SET_BINFO_MARKED (base_binfo);
-
- rval = get_template_base_recursive
- (base_binfo, rval, template, this_virtual);
- if (rval == error_mark_node)
- return rval;
- }
- }
-
- return rval;
-}
-
-/* Given a class template TEMPLATE and a class type or binfo node BINFO,
- find the unique base type in BINFO that is an instance of TEMPLATE.
- If there are more than one, return error_mark_node. Used by unify. */
-
-tree
-get_template_base (template, binfo)
- register tree template, binfo;
-{
- tree type, rval;
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else if (IS_AGGR_TYPE_CODE (TREE_CODE (binfo)))
- {
- type = complete_type (binfo);
- binfo = TYPE_BINFO (type);
- }
- else
- my_friendly_abort (92);
-
- if (CLASSTYPE_TEMPLATE_INFO (type)
- && CLASSTYPE_TI_TEMPLATE (type) == template)
- return type;
-
- rval = get_template_base_recursive (binfo, NULL_TREE, template, 0);
- dfs_walk (binfo, dfs_unmark, markedp);
-
- return rval;
-}
diff --git a/gcc/cp/sig.c b/gcc/cp/sig.c
deleted file mode 100644
index 2a5efcd59f7..00000000000
--- a/gcc/cp/sig.c
+++ /dev/null
@@ -1,1059 +0,0 @@
-/* Functions dealing with signatures and signature pointers/references.
- Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Contributed by Gerald Baumgartner (gb@cs.purdue.edu)
-
-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 <stdio.h>
-#include "obstack.h"
-#include "tree.h"
-#include "cp-tree.h"
-#include "flags.h"
-#include "assert.h"
-
-extern struct obstack *current_obstack;
-extern struct obstack permanent_obstack;
-extern struct obstack *saveable_obstack;
-
-extern void error ();
-extern void sorry ();
-extern void compiler_error ();
-extern void make_decl_rtl PROTO((tree, char *, int));
-
-static tree build_sptr_ref PROTO((tree));
-
-/* Used to help generate globally unique names for signature tables. */
-
-static int global_sigtable_name_counter;
-
-/* Build an identifier for a signature pointer or reference, so we
- can use it's name in function name mangling. */
-
-static tree
-build_signature_pointer_or_reference_name (to_type, constp, volatilep, refp)
- tree to_type;
- int constp, volatilep, refp;
-{
- char * sig_name = TYPE_NAME_STRING (to_type);
- int name_len = TYPE_NAME_LENGTH (to_type) + constp + volatilep;
- char * name;
-
- if (refp)
- {
- name = (char *) alloca (name_len + sizeof (SIGNATURE_REFERENCE_NAME) +2);
- sprintf (name, SIGNATURE_REFERENCE_NAME_FORMAT,
- constp ? "C" : "", volatilep ? "V": "", sig_name);
- }
- else
- {
- name = (char *) alloca (name_len + sizeof (SIGNATURE_POINTER_NAME) + 2);
- sprintf (name, SIGNATURE_POINTER_NAME_FORMAT,
- constp ? "C" : "", volatilep ? "V": "", sig_name);
- }
- return get_identifier (name);
-}
-
-/* Build a DECL node for a signature pointer or reference, so we can
- tell the debugger the structure of signature pointers/references.
- This function is called at most eight times for a given signature,
- once for each [const] [volatile] signature pointer/reference. */
-
-static void
-build_signature_pointer_or_reference_decl (type, name)
- tree type, name;
-{
- tree decl;
-
- /* We don't enter this declaration in any sort of symbol table. */
- decl = build_decl (TYPE_DECL, name, type);
- TYPE_NAME (type) = decl;
- TREE_CHAIN (type) = decl;
-}
-
-/* Construct, lay out and return the type of pointers or references
- to signature TO_TYPE. If such a type has already been constructed,
- reuse it. If CONSTP or VOLATILEP is specified, make the `optr' const
- or volatile, respectively. If we are constructing a const/volatile
- type variant and the main type variant doesn't exist yet, it is built
- as well. If REFP is 1, we construct a signature reference, otherwise
- a signature pointer is constructed.
-
- This function is a subroutine of `build_signature_pointer_type' and
- `build_signature_reference_type'. */
-
-static tree
-build_signature_pointer_or_reference_type (to_type, constp, volatilep, refp)
- tree to_type;
- int constp, volatilep, refp;
-{
- register tree t, m;
- register struct obstack *ambient_obstack = current_obstack;
- register struct obstack *ambient_saveable_obstack = saveable_obstack;
-
- m = refp ? SIGNATURE_REFERENCE_TO (to_type) : SIGNATURE_POINTER_TO (to_type);
-
- /* If we don't have the main variant yet, construct it. */
- if (m == NULL_TREE
- && (constp || volatilep))
- m = build_signature_pointer_or_reference_type (to_type, 0, 0, refp);
-
- /* Treat any nonzero argument as 1. */
- constp = !!constp;
- volatilep = !!volatilep;
- refp = !!refp;
-
- /* If not generating auxiliary info, search the chain of variants to see
- if there is already one there just like the one we need to have. If so,
- use that existing one.
-
- We don't do this in the case where we are generating aux info because
- in that case we want each typedef names to get it's own distinct type
- node, even if the type of this new typedef is the same as some other
- (existing) type. */
-
- if (m && !flag_gen_aux_info)
- for (t = m; t; t = TYPE_NEXT_VARIANT (t))
- if (constp == TYPE_READONLY (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (t))))
- && volatilep == TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (t)))))
- return t;
-
- /* We need a new one. If TO_TYPE is permanent, make this permanent too. */
- if (TREE_PERMANENT (to_type))
- {
- current_obstack = &permanent_obstack;
- saveable_obstack = &permanent_obstack;
- }
-
- /* A signature pointer or reference to a signature `s' looks like this:
-
- struct {
- void * optr;
- const s * sptr;
- };
-
- A `const' signature pointer/reference is a
-
- struct {
- const void * optr;
- const s * sptr;
- };
-
- Similarly, for `volatile' and `const volatile'. */
-
- t = make_lang_type (RECORD_TYPE);
- {
- tree obj_type = build_type_variant (void_type_node, constp, volatilep);
- tree optr_type = build_pointer_type (obj_type);
- tree optr, sptr;
-
- optr = build_lang_field_decl (FIELD_DECL,
- get_identifier (SIGNATURE_OPTR_NAME),
- optr_type);
- DECL_FIELD_CONTEXT (optr) = t;
- DECL_CLASS_CONTEXT (optr) = t;
-
- if (m)
- /* We can share the `sptr' field among type variants. */
- sptr = TREE_CHAIN (TYPE_FIELDS (m));
- else
- {
- tree sig_tbl_type = cp_build_type_variant (to_type, 1, 0);
-
- sptr = build_lang_field_decl (FIELD_DECL,
- get_identifier (SIGNATURE_SPTR_NAME),
- build_pointer_type (sig_tbl_type));
- DECL_FIELD_CONTEXT (sptr) = t;
- DECL_CLASS_CONTEXT (sptr) = t;
- TREE_CHAIN (sptr) = NULL_TREE;
- }
-
- TREE_CHAIN (optr) = sptr;
- TYPE_FIELDS (t) = optr;
- /* Allow signature pointers/references to be grabbed 2 words at a time.
- For this to work on a Sparc, we need 8-byte alignment. */
- TYPE_ALIGN (t) = MAX (TYPE_ALIGN (double_type_node),
- TYPE_ALIGN (optr_type));
-
- /* A signature pointer/reference type isn't a `real' class type. */
- IS_AGGR_TYPE (t) = 0;
- }
-
- {
- tree name = build_signature_pointer_or_reference_name (to_type, constp,
- volatilep, refp);
-
- /* Build a DECL node for this type, so the debugger has access to it. */
- build_signature_pointer_or_reference_decl (t, name);
- }
-
- CLASSTYPE_GOT_SEMICOLON (t) = 1;
- IS_SIGNATURE_POINTER (t) = ! refp;
- IS_SIGNATURE_REFERENCE (t) = refp;
- SIGNATURE_TYPE (t) = to_type;
-
- if (m)
- {
- /* Add this type to the chain of variants of TYPE.
- Every type has to be its own TYPE_MAIN_VARIANT. */
- TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
- TYPE_NEXT_VARIANT (m) = t;
- }
- else if (refp)
- /* Record this type as the reference to TO_TYPE. */
- SIGNATURE_REFERENCE_TO (to_type) = t;
- else
- /* Record this type as the pointer to TO_TYPE. */
- SIGNATURE_POINTER_TO (to_type) = t;
-
- /* Lay out the type. This function has many callers that are concerned
- with expression-construction, and this simplifies them all.
- Also, it guarantees the TYPE_SIZE is permanent if the type is. */
- layout_type (t);
-
- current_obstack = ambient_obstack;
- saveable_obstack = ambient_saveable_obstack;
-
- /* Output debug information for this type. */
- rest_of_type_compilation (t, 1);
-
- return t;
-}
-
-/* Construct, lay out and return the type of pointers to signature TO_TYPE. */
-
-tree
-build_signature_pointer_type (to_type, constp, volatilep)
- tree to_type;
- int constp, volatilep;
-{
- return
- build_signature_pointer_or_reference_type (to_type, constp, volatilep, 0);
-}
-
-/* Construct, lay out and return the type of pointers to signature TO_TYPE. */
-
-tree
-build_signature_reference_type (to_type, constp, volatilep)
- tree to_type;
- int constp, volatilep;
-{
- return
- build_signature_pointer_or_reference_type (to_type, constp, volatilep, 1);
-}
-
-/* Return the name of the signature table (as an IDENTIFIER_NODE)
- for the given signature type SIG_TYPE and rhs type RHS_TYPE. */
-
-static tree
-get_sigtable_name (sig_type, rhs_type)
- tree sig_type, rhs_type;
-{
- tree sig_type_id = build_typename_overload (sig_type);
- tree rhs_type_id = build_typename_overload (rhs_type);
- char *buf = (char *) alloca (sizeof (SIGTABLE_NAME_FORMAT_LONG)
- + IDENTIFIER_LENGTH (sig_type_id)
- + IDENTIFIER_LENGTH (rhs_type_id) + 20);
- char *sig_ptr = IDENTIFIER_POINTER (sig_type_id);
- char *rhs_ptr = IDENTIFIER_POINTER (rhs_type_id);
- int i, j;
-
- for (i = 0; sig_ptr[i] == OPERATOR_TYPENAME_FORMAT[i]; i++)
- /* do nothing */;
- while (sig_ptr[i] >= '0' && sig_ptr[i] <= '9')
- i += 1;
-
- for (j = 0; rhs_ptr[j] == OPERATOR_TYPENAME_FORMAT[j]; j++)
- /* do nothing */;
- while (rhs_ptr[j] >= '0' && rhs_ptr[j] <= '9')
- j += 1;
-
- if (IS_SIGNATURE (rhs_type))
- sprintf (buf, SIGTABLE_NAME_FORMAT_LONG, sig_ptr+i, rhs_ptr+j,
- global_sigtable_name_counter++);
- else
- sprintf (buf, SIGTABLE_NAME_FORMAT, sig_ptr+i, rhs_ptr+j);
- return get_identifier (buf);
-}
-
-/* Build a field decl that points to a signature member function. */
-
-static tree
-build_member_function_pointer (member)
- tree member;
-{
- char *namstr = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (member));
- int namlen = IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (member));
- char *name;
- tree entry;
-
- name = (char *) alloca (namlen + sizeof (SIGNATURE_FIELD_NAME) + 2);
- sprintf (name, SIGNATURE_FIELD_NAME_FORMAT, namstr);
-
- /* @@ Do we really want to xref signature table fields? */
- GNU_xref_ref (current_function_decl, name);
-
- entry = build_lang_field_decl (FIELD_DECL, get_identifier (name),
- TYPE_MAIN_VARIANT (sigtable_entry_type));
- TREE_CONSTANT (entry) = 1;
- TREE_READONLY (entry) = 1;
-
- /* @@ Do we really want to xref signature table fields? */
- GNU_xref_decl (current_function_decl, entry);
-
- return entry;
-}
-
-/* For each FUNCTION_DECL in a signature we construct a member function
- pointer of the appropriate type. We also need two flags to test
- whether the member function pointer points to a virtual function or
- to a default implementation. Those flags will be the two lower order
- bits of the member function pointer (or the two higher order bits,
- based on the configuration).
-
- The new FIELD_DECLs are appended at the end of the last (and only)
- sublist of `list_of_fieldlists.'
-
- As a side effect, each member function in the signature gets the
- `decl.ignored' bit turned on, so we don't output debug info for it. */
-
-void
-append_signature_fields (list_of_fieldlists)
- tree list_of_fieldlists;
-{
- tree l, x;
- tree last_x = NULL_TREE;
- tree mfptr;
- tree last_mfptr;
- tree mfptr_list = NULL_TREE;
-
- /* For signatures it should actually be only a list with one element. */
- for (l = list_of_fieldlists; l; l = TREE_CHAIN (l))
- {
- for (x = TREE_VALUE (l); x; x = TREE_CHAIN (x))
- {
- if (TREE_CODE (x) == FUNCTION_DECL)
- {
- mfptr = build_member_function_pointer (x);
- DECL_MEMFUNC_POINTER_TO (x) = mfptr;
- DECL_MEMFUNC_POINTING_TO (mfptr) = x;
- DECL_IGNORED_P (x) = 1;
- DECL_IN_AGGR_P (mfptr) = 1;
- if (! mfptr_list)
- mfptr_list = last_mfptr = mfptr;
- else
- {
- TREE_CHAIN (last_mfptr) = mfptr;
- last_mfptr = mfptr;
- }
- }
- last_x = x;
- }
- }
-
- /* Append the lists. */
- if (last_x && mfptr_list)
- {
- TREE_CHAIN (last_x) = mfptr_list;
- TREE_CHAIN (last_mfptr) = NULL_TREE;
- }
-}
-
-/* Compare the types of a signature member function and a class member
- function. Returns 1 if the types are in the C++ `<=' relationship.
-
- If we have a signature pointer/reference as argument or return type
- we don't want to do a recursive conformance check. The conformance
- check only succeeds if both LHS and RHS refer to the same signature
- pointer. Otherwise we need to keep information about parameter types
- around at run time to initialize the signature table correctly. */
-
-static int
-match_method_types (sig_mtype, class_mtype)
- tree sig_mtype, class_mtype;
-{
- tree sig_return_type = TREE_TYPE (sig_mtype);
- tree sig_arg_types = TYPE_ARG_TYPES (sig_mtype);
- tree class_return_type = TREE_TYPE (class_mtype);
- tree class_arg_types = TYPE_ARG_TYPES (class_mtype);
-
- /* The return types have to be the same. */
- if (! comptypes (sig_return_type, class_return_type, 1))
- return 0;
-
- /* Compare the first argument `this.' */
- {
- /* Get the type of what the `optr' is pointing to. */
- tree sig_this =
- TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_VALUE (sig_arg_types))));
- tree class_this = TREE_VALUE (class_arg_types);
-
- if (TREE_CODE (class_this) == RECORD_TYPE) /* Is `this' a sig ptr? */
- class_this = TREE_TYPE (TREE_TYPE (TYPE_FIELDS (class_this)));
- else
- class_this = TREE_TYPE (class_this);
-
- /* If a signature method's `this' is const or volatile, so has to be
- the corresponding class method's `this.' */
- if ((TYPE_READONLY (sig_this) && ! TYPE_READONLY (class_this))
- || (TYPE_VOLATILE (sig_this) && ! TYPE_VOLATILE (class_this)))
- return 0;
- }
-
- sig_arg_types = TREE_CHAIN (sig_arg_types);
- class_arg_types = TREE_CHAIN (class_arg_types);
-
- /* The number of arguments and the argument types have to be the same. */
- return compparms (sig_arg_types, class_arg_types, 3);
-}
-
-/* Undo casts of opaque type variables to the RHS types. */
-
-static void
-undo_casts (sig_ty)
- tree sig_ty;
-{
- tree field = TYPE_FIELDS (sig_ty);
-
- /* Since all the FIELD_DECLs for the signature table entries are at the end
- of the chain (see `append_signature_fields'), we can do it this way. */
- for (; field && TREE_CODE (field) != FIELD_DECL; field = TREE_CHAIN (field))
- if (TYPE_MAIN_VARIANT (TREE_TYPE (field)) == opaque_type_node)
- TREE_TYPE (TREE_TYPE (field)) = TREE_TYPE (ptr_type_node);
-}
-
-/* Do the type checking necessary to see whether the `rhs' conforms to
- the lhs's `sig_ty'. Depending on the type of `rhs' return a NULL_TREE,
- an integer_zero_node, a constructor, or an expression offsetting the
- `rhs' signature table. */
-
-static tree
-build_signature_table_constructor (sig_ty, rhs)
- tree sig_ty, rhs;
-{
- tree rhstype = TREE_TYPE (rhs);
- tree sig_field = TYPE_FIELDS (sig_ty);
- tree result = NULL_TREE;
- tree first_rhs_field = NULL_TREE;
- tree last_rhs_field;
- int sig_ptr_p = IS_SIGNATURE (rhstype);
- int offset_p = sig_ptr_p;
-
- rhstype = sig_ptr_p ? rhstype : TREE_TYPE (rhstype);
-
- if (CLASSTYPE_TAGS (sig_ty))
- {
- sorry ("conformance check with signature containing class declarations");
- return error_mark_node;
- }
-
- for (; sig_field; sig_field = TREE_CHAIN (sig_field))
- {
- tree basetype_path, baselink, basetypes;
- tree sig_method, sig_mname, sig_mtype;
- tree rhs_method, tbl_entry;
-
- if (TREE_CODE (sig_field) == TYPE_DECL)
- {
- tree sig_field_type = TREE_TYPE (sig_field);
-
- if (TYPE_MAIN_VARIANT (sig_field_type) == opaque_type_node)
- {
- /* We've got an opaque type here. */
- tree oty_name = DECL_NAME (sig_field);
- tree oty_type = lookup_field (rhstype, oty_name, 1, 1);
-
- if (oty_type == NULL_TREE || oty_type == error_mark_node)
- {
- cp_error ("class `%T' does not contain type `%T'",
- rhstype, oty_type);
- undo_casts (sig_ty);
- return error_mark_node;
- }
- oty_type = TREE_TYPE (oty_type);
-
- /* Cast `sig_field' to be of type `oty_type'. This will be
- undone in `undo_casts' by walking over all the TYPE_DECLs. */
- TREE_TYPE (sig_field_type) = TREE_TYPE (oty_type);
- }
- /* If we don't have an opaque type, we can ignore the `typedef'. */
- continue;
- }
-
- /* Find the signature method corresponding to `sig_field'. */
- sig_method = DECL_MEMFUNC_POINTING_TO (sig_field);
- sig_mname = DECL_NAME (sig_method);
- sig_mtype = TREE_TYPE (sig_method);
-
- basetype_path = TYPE_BINFO (rhstype);
- baselink = lookup_fnfields (basetype_path, sig_mname, 0);
- if (baselink == NULL_TREE || baselink == error_mark_node)
- {
- if (! IS_DEFAULT_IMPLEMENTATION (sig_method))
- {
- cp_error ("class `%T' does not contain method `%D'",
- rhstype, sig_mname);
- undo_casts (sig_ty);
- return error_mark_node;
- }
- else
- {
- /* We use the signature's default implementation. */
- rhs_method = sig_method;
- }
- }
- else
- {
- /* Find the class method of the correct type. */
-
- basetypes = TREE_PURPOSE (baselink);
- if (TREE_CODE (basetypes) == TREE_LIST)
- basetypes = TREE_VALUE (basetypes);
-
- rhs_method = TREE_VALUE (baselink);
- for (; rhs_method; rhs_method = TREE_CHAIN (rhs_method))
- if (sig_mname == DECL_NAME (rhs_method)
- && ! DECL_STATIC_FUNCTION_P (rhs_method)
- && match_method_types (sig_mtype, TREE_TYPE (rhs_method)))
- break;
-
- if (rhs_method == NULL_TREE
- || (compute_access (basetypes, rhs_method)
- != access_public_node))
- {
- error ("class `%s' does not contain a method conforming to `%s'",
- TYPE_NAME_STRING (rhstype),
- fndecl_as_string (sig_method, 1));
- undo_casts (sig_ty);
- return error_mark_node;
- }
- }
-
- if (sig_ptr_p && rhs_method != sig_method)
- {
- tree rhs_field = DECL_MEMFUNC_POINTER_TO (rhs_method);
-
- if (first_rhs_field == NULL_TREE)
- {
- first_rhs_field = rhs_field;
- last_rhs_field = rhs_field;
- }
- else if (TREE_CHAIN (last_rhs_field) == rhs_field)
- last_rhs_field = rhs_field;
- else
- offset_p = 0;
-
- tbl_entry = build_component_ref (rhs, DECL_NAME (rhs_field),
- NULL_TREE, 1);
- }
- else
- {
- tree tag, vb_off, delta, idx, pfn, vt_off;
- tree tag_decl, vb_off_decl, delta_decl, index_decl;
- tree pfn_decl, vt_off_decl;
-
- if (rhs_method == sig_method)
- {
- /* default implementation */
- tag = build_unary_op (NEGATE_EXPR, integer_one_node, 0);
- vb_off = build_unary_op (NEGATE_EXPR, integer_one_node, 0);
- delta = integer_zero_node;
- idx = integer_zero_node;
- pfn = build_addr_func (rhs_method);
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (rhs_method)) = 1;
- TREE_TYPE (pfn) = ptr_type_node;
- TREE_ADDRESSABLE (rhs_method) = 1;
- offset_p = 0; /* we can't offset the rhs sig table */
- }
- else if (DECL_VINDEX (rhs_method))
- {
- /* virtual member function */
- tag = integer_one_node;
- vb_off = build_unary_op (NEGATE_EXPR, integer_one_node, 0);
- if (flag_vtable_thunks)
- delta = BINFO_OFFSET
- (get_binfo (DECL_CONTEXT (rhs_method), rhstype, 1));
- else
- delta = BINFO_OFFSET
- (get_binfo (DECL_CLASS_CONTEXT (rhs_method), rhstype, 1));
- idx = DECL_VINDEX (rhs_method);
- vt_off = get_vfield_offset (get_binfo (DECL_CONTEXT (rhs_method),
- rhstype, 0));
- }
- else
- {
- /* non-virtual member function */
- tag = integer_zero_node;
- vb_off = build_unary_op (NEGATE_EXPR, integer_one_node, 0);
- delta = BINFO_OFFSET (get_binfo (DECL_CLASS_CONTEXT (rhs_method),
- rhstype, 1));
- idx = integer_zero_node;
- pfn = build_addr_func (rhs_method);
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (rhs_method)) = 1;
- TREE_TYPE (pfn) = ptr_type_node;
- TREE_ADDRESSABLE (rhs_method) = 1;
- }
-
- /* Since digest_init doesn't handle initializing selected fields
- of a struct (i.e., anonymous union), we build the constructor
- by hand, without calling digest_init. */
- tag_decl = TYPE_FIELDS (sigtable_entry_type);
- vb_off_decl = TREE_CHAIN (tag_decl);
- delta_decl = TREE_CHAIN (vb_off_decl);
- index_decl = TREE_CHAIN (delta_decl);
- pfn_decl = TREE_CHAIN (index_decl);
- vt_off_decl = TREE_CHAIN (pfn_decl);
-
- tag = convert (TREE_TYPE (tag_decl), tag);
- vb_off = convert (TREE_TYPE (vb_off_decl), vb_off);
- delta = convert (TREE_TYPE (delta_decl), delta);
- idx = convert (TREE_TYPE (index_decl), idx);
-
- if (DECL_VINDEX (rhs_method))
- {
- vt_off = convert (TREE_TYPE (vt_off_decl), vt_off);
-
- tbl_entry = build_tree_list (vt_off_decl, vt_off);
- }
- else
- {
- pfn = convert (TREE_TYPE (pfn_decl), pfn);
-
- tbl_entry = build_tree_list (pfn_decl, pfn);
- }
- tbl_entry = tree_cons (delta_decl, delta,
- tree_cons (index_decl, idx, tbl_entry));
- tbl_entry = tree_cons (tag_decl, tag,
- tree_cons (vb_off_decl, vb_off, tbl_entry));
- tbl_entry = build (CONSTRUCTOR, sigtable_entry_type,
- NULL_TREE, tbl_entry);
-
- TREE_CONSTANT (tbl_entry) = 1;
- }
-
- /* Chain those function address expressions together. */
- if (result)
- result = tree_cons (NULL_TREE, tbl_entry, result);
- else
- result = build_tree_list (NULL_TREE, tbl_entry);
- }
-
- if (result == NULL_TREE)
- {
- /* The signature was empty, we don't need a signature table. */
- undo_casts (sig_ty);
- return NULL_TREE;
- }
-
- if (offset_p)
- {
- if (first_rhs_field == TYPE_FIELDS (rhstype))
- {
- /* The sptr field on the lhs can be copied from the rhs. */
- undo_casts (sig_ty);
- return integer_zero_node;
- }
- else
- {
- /* The sptr field on the lhs will point into the rhs sigtable. */
- undo_casts (sig_ty);
- return build_component_ref (rhs, DECL_NAME (first_rhs_field),
- NULL_TREE, 0);
- }
- }
-
- /* We need to construct a new signature table. */
- result = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (result));
- TREE_HAS_CONSTRUCTOR (result) = 1;
- TREE_CONSTANT (result) = !sig_ptr_p;
-
- undo_casts (sig_ty);
- return result;
-}
-
-/* Build a signature table declaration and initialize it or return an
- existing one if we built one already. If we don't get a constructor
- as initialization expression, we don't need a new signature table
- variable and just hand back the init expression.
-
- The declaration processing is done by hand instead of using `cp_finish_decl'
- so that we can make signature pointers global variables instead of
- static ones. */
-
-static tree
-build_sigtable (sig_type, rhs_type, init_from)
- tree sig_type, rhs_type, init_from;
-{
- tree name = NULL_TREE;
- tree decl = NULL_TREE;
- tree init_expr;
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- if (! IS_SIGNATURE (rhs_type))
- {
- name = get_sigtable_name (sig_type, rhs_type);
- decl = IDENTIFIER_GLOBAL_VALUE (name);
- }
- if (decl == NULL_TREE)
- {
- tree init;
-
- /* We allow only one signature table to be generated for signatures
- with opaque types. Otherwise we create a loophole in the type
- system since we could cast data from one classes implementation
- of the opaque type to that of another class. */
- if (SIGNATURE_HAS_OPAQUE_TYPEDECLS (sig_type)
- && SIGTABLE_HAS_BEEN_GENERATED (sig_type))
- {
- error ("signature with opaque type implemented by multiple classes");
- return error_mark_node;
- }
- SIGTABLE_HAS_BEEN_GENERATED (sig_type) = 1;
-
- init_expr = build_signature_table_constructor (sig_type, init_from);
- if (init_expr == NULL_TREE || TREE_CODE (init_expr) != CONSTRUCTOR)
- return init_expr;
-
- if (name == NULL_TREE)
- name = get_sigtable_name (sig_type, rhs_type);
- {
- tree context = current_function_decl;
-
- /* Make the signature table global, not just static in whichever
- function a signature pointer/ref is used for the first time. */
- current_function_decl = NULL_TREE;
- decl = pushdecl_top_level (build_decl (VAR_DECL, name, sig_type));
- current_function_decl = context;
- }
- IDENTIFIER_GLOBAL_VALUE (name) = decl;
- store_init_value (decl, init_expr);
- if (IS_SIGNATURE (rhs_type))
- {
- init = DECL_INITIAL (decl);
- DECL_INITIAL (decl) = error_mark_node;
- }
-
- DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
- DECL_ALIGN (decl));
-#if 0
- /* GDB-4.7 doesn't find the initialization value of a signature table
- when it is constant. */
- TREE_READONLY (decl) = 1;
-#endif
- TREE_STATIC (decl) = 1;
- TREE_USED (decl) = 1;
-
- make_decl_rtl (decl, NULL, 1);
- if (IS_SIGNATURE (rhs_type))
- expand_static_init (decl, init);
- }
-
- pop_obstacks ();
-
- return decl;
-}
-
-/* Create a constructor or modify expression if the LHS of an assignment
- is a signature pointer or a signature reference. If LHS is a record
- type node, we build a constructor, otherwise a compound expression. */
-
-tree
-build_signature_pointer_constructor (lhs, rhs)
- tree lhs, rhs;
-{
- register struct obstack *ambient_obstack = current_obstack;
- register struct obstack *ambient_saveable_obstack = saveable_obstack;
- int initp = (TREE_CODE (lhs) == RECORD_TYPE);
- tree lhstype = initp ? lhs : TREE_TYPE (lhs);
- tree rhstype = TREE_TYPE (rhs);
- tree sig_ty = SIGNATURE_TYPE (lhstype);
- tree sig_tbl, sptr_expr, optr_expr;
- tree result;
-
- if (! ((TREE_CODE (rhstype) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (rhstype)) == RECORD_TYPE)
- || (TYPE_LANG_SPECIFIC (rhstype) &&
- (IS_SIGNATURE_POINTER (rhstype)
- || IS_SIGNATURE_REFERENCE (rhstype)))))
- {
- error ("invalid assignment to signature pointer or reference");
- return error_mark_node;
- }
-
- if (TYPE_SIZE (sig_ty) == NULL_TREE)
- {
- cp_error ("undefined signature `%T' used in signature %s declaration",
- sig_ty,
- IS_SIGNATURE_POINTER (lhstype) ? "pointer" : "reference");
- return error_mark_node;
- }
-
- /* If SIG_TY is permanent, make the signature table constructor and
- the signature pointer/reference constructor permanent too. */
- if (TREE_PERMANENT (sig_ty))
- {
- current_obstack = &permanent_obstack;
- saveable_obstack = &permanent_obstack;
- }
-
- if (TYPE_LANG_SPECIFIC (rhstype) &&
- (IS_SIGNATURE_POINTER (rhstype) || IS_SIGNATURE_REFERENCE (rhstype)))
- {
- if (SIGNATURE_TYPE (rhstype) == sig_ty)
- {
- /* LHS and RHS are signature pointers/refs of the same signature. */
- optr_expr = build_optr_ref (rhs);
- sptr_expr = build_sptr_ref (rhs);
- }
- else
- {
- /* We need to create a new signature table and copy
- elements from the rhs signature table. */
- tree rhs_sptr_ref = build_sptr_ref (rhs);
- tree rhs_tbl = build1 (INDIRECT_REF, SIGNATURE_TYPE (rhstype),
- rhs_sptr_ref);
-
- sig_tbl = build_sigtable (sig_ty, SIGNATURE_TYPE (rhstype), rhs_tbl);
- if (sig_tbl == error_mark_node)
- return error_mark_node;
-
- optr_expr = build_optr_ref (rhs);
- if (sig_tbl == NULL_TREE)
- /* The signature was empty. The signature pointer is
- pretty useless, but the user has been warned. */
- sptr_expr = copy_node (null_pointer_node);
- else if (sig_tbl == integer_zero_node)
- sptr_expr = rhs_sptr_ref;
- else
- sptr_expr = build_unary_op (ADDR_EXPR, sig_tbl, 0);
- TREE_TYPE (sptr_expr) = build_pointer_type (sig_ty);
- }
- }
- else
- {
- sig_tbl = build_sigtable (sig_ty, TREE_TYPE (rhstype), rhs);
- if (sig_tbl == error_mark_node)
- return error_mark_node;
-
- optr_expr = rhs;
- if (sig_tbl == NULL_TREE)
- /* The signature was empty. The signature pointer is
- pretty useless, but the user has been warned. */
- {
- sptr_expr = copy_node (null_pointer_node);
- TREE_TYPE (sptr_expr) = build_pointer_type (sig_ty);
- }
- else
- sptr_expr = build_unary_op (ADDR_EXPR, sig_tbl, 0);
- }
-
- if (initp)
- {
- result = tree_cons (NULL_TREE, optr_expr,
- build_tree_list (NULL_TREE, sptr_expr));
- result = build_nt (CONSTRUCTOR, NULL_TREE, result);
- TREE_HAS_CONSTRUCTOR (result) = 1;
- result = digest_init (lhstype, result, 0);
- }
- else
- {
- if (TREE_READONLY (lhs) || TYPE_READONLY (lhstype))
- readonly_error (lhs, "assignment", 0);
-
- optr_expr = build_modify_expr (build_optr_ref (lhs), NOP_EXPR,
- optr_expr);
- sptr_expr = build_modify_expr (build_sptr_ref (lhs), NOP_EXPR,
- sptr_expr);
-
- result = tree_cons (NULL_TREE, optr_expr,
- tree_cons (NULL_TREE, sptr_expr,
- build_tree_list (NULL_TREE, lhs)));
- result = build_compound_expr (result);
- }
-
- current_obstack = ambient_obstack;
- saveable_obstack = ambient_saveable_obstack;
- return result;
-}
-
-/* Build a temporary variable declaration for the instance of a signature
- member function call if it isn't a declaration node already. Simply
- using a SAVE_EXPR doesn't work since we need `this' in both branches
- of a conditional expression. */
-
-static tree
-save_this (instance)
- tree instance;
-{
- tree decl;
-
- if (TREE_CODE_CLASS (TREE_CODE (instance)) == 'd')
- decl = instance;
- else
- {
- decl = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (instance));
- DECL_REGISTER (decl) = 1;
- layout_decl (decl, 0);
- expand_decl (decl);
- }
-
- return decl;
-}
-
-/* Build a signature member function call. Looks up the signature table
- entry corresponding to FUNCTION. Depending on the value of the CODE
- field, either call the function in PFN directly, or use OFFSET to
- index the object's virtual function table. */
-
-tree
-build_signature_method_call (function, parms)
- tree function, parms;
-{
- tree instance = TREE_VALUE (parms);
- tree saved_instance = save_this (instance); /* Create temp for `this'. */
- tree object_ptr = build_optr_ref (saved_instance);
- tree new_object_ptr, new_parms;
- tree signature_tbl_ptr = build_sptr_ref (saved_instance);
- tree sig_field_name = DECL_NAME (DECL_MEMFUNC_POINTER_TO (function));
- tree basetype = DECL_CONTEXT (function);
- tree basetype_path = TYPE_BINFO (basetype);
- tree tbl_entry = build_component_ref (build1 (INDIRECT_REF, basetype,
- signature_tbl_ptr),
- sig_field_name, basetype_path, 1);
- tree tag, delta, pfn, vt_off, idx, vfn;
- tree deflt_call = NULL_TREE, direct_call, virtual_call, result;
-
- tbl_entry = save_expr (tbl_entry);
- tag = build_component_ref (tbl_entry, tag_identifier, NULL_TREE, 1);
- delta = build_component_ref (tbl_entry, delta_identifier, NULL_TREE, 1);
- pfn = build_component_ref (tbl_entry, pfn_identifier, NULL_TREE, 1);
- vt_off = build_component_ref (tbl_entry, vt_off_identifier, NULL_TREE, 1);
- idx = build_component_ref (tbl_entry, index_identifier, NULL_TREE, 1);
- TREE_TYPE (pfn) = build_pointer_type (TREE_TYPE (function));
-
- if (IS_DEFAULT_IMPLEMENTATION (function))
- {
- pfn = save_expr (pfn);
- deflt_call = build_function_call (pfn, parms);
- }
-
- new_object_ptr = build (PLUS_EXPR, build_pointer_type (basetype),
- convert (ptrdiff_type_node, object_ptr),
- convert (ptrdiff_type_node, delta));
-
- parms = tree_cons (NULL_TREE,
- convert (build_pointer_type (basetype), object_ptr),
- TREE_CHAIN (parms));
- new_parms = tree_cons (NULL_TREE, new_object_ptr, TREE_CHAIN (parms));
-
- {
- /* Cast the signature method to have `this' of a normal pointer type. */
- tree old_this = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (TREE_TYPE (pfn))));
-
- TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (TREE_TYPE (pfn)))) =
- build_type_variant (build_pointer_type (basetype),
- TYPE_READONLY (old_this),
- TYPE_VOLATILE (old_this));
-
- direct_call = build_function_call (pfn, new_parms);
-
- {
- tree vfld, vtbl, aref;
-
- vfld = build (PLUS_EXPR,
- build_pointer_type (build_pointer_type (vtbl_type_node)),
- convert (ptrdiff_type_node, object_ptr),
- convert (ptrdiff_type_node, vt_off));
- vtbl = build_indirect_ref (build_indirect_ref (vfld, NULL_PTR),
- NULL_PTR);
- aref = build_array_ref (vtbl, idx);
-
- if (flag_vtable_thunks)
- vfn = aref;
- else
- vfn = build_component_ref (aref, pfn_identifier, NULL_TREE, 0);
-
- TREE_TYPE (vfn) = build_pointer_type (TREE_TYPE (function));
-
- virtual_call = build_function_call (vfn, new_parms);
- }
-
- /* Undo the cast, make `this' a signature pointer again. */
- TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (TREE_TYPE (pfn)))) = old_this;
- }
-
- /* Once the function was found, there should be no reason why we
- couldn't build the member function pointer call. */
- if (!direct_call || direct_call == error_mark_node
- || !virtual_call || virtual_call == error_mark_node
- || (IS_DEFAULT_IMPLEMENTATION (function)
- && (!deflt_call || deflt_call == error_mark_node)))
- {
- compiler_error ("cannot build call of signature member function `%s'",
- fndecl_as_string (function, 1));
- return error_mark_node;
- }
-
- if (IS_DEFAULT_IMPLEMENTATION (function))
- {
- tree test = build_binary_op_nodefault (LT_EXPR, tag, integer_zero_node,
- LT_EXPR);
- result = build_conditional_expr (tag,
- build_conditional_expr (test,
- deflt_call,
- virtual_call),
- direct_call);
- }
- else
- result = build_conditional_expr (tag, virtual_call, direct_call);
-
- /* If we created a temporary variable for `this', initialize it first. */
- if (instance != saved_instance)
- result = build (COMPOUND_EXPR, TREE_TYPE (result),
- build_modify_expr (saved_instance, NOP_EXPR, instance),
- result);
-
- return result;
-}
-
-/* Create a COMPONENT_REF expression for referencing the OPTR field
- of a signature pointer or reference. */
-
-tree
-build_optr_ref (instance)
- tree instance;
-{
- tree field = get_identifier (SIGNATURE_OPTR_NAME);
-
- return build_component_ref (instance, field, NULL_TREE, 1);
-}
-
-/* Create a COMPONENT_REF expression for referencing the SPTR field
- of a signature pointer or reference. */
-
-static tree
-build_sptr_ref (instance)
- tree instance;
-{
- tree field = get_identifier (SIGNATURE_SPTR_NAME);
-
- return build_component_ref (instance, field, NULL_TREE, 1);
-}
diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c
deleted file mode 100644
index 90deea77c20..00000000000
--- a/gcc/cp/spew.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/* Type Analyzer for GNU C++.
- Copyright (C) 1987, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
- Hacked... nay, bludgeoned... by Mark Eichin (eichin@cygnus.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 file is the type analyzer for GNU C++. To debug it, define SPEW_DEBUG
- when compiling parse.c and spew.c. */
-
-#include "config.h"
-#include <stdio.h>
-#include "input.h"
-#include "tree.h"
-#include "lex.h"
-#include "cp-tree.h"
-#include "parse.h"
-#include "flags.h"
-#include "obstack.h"
-
-/* This takes a token stream that hasn't decided much about types and
- tries to figure out as much as it can, with excessive lookahead and
- backtracking. */
-
-/* fifo of tokens recognized and available to parser. */
-struct token {
- /* The values for YYCHAR will fit in a short. */
- short yychar;
- short end_of_file;
- YYSTYPE yylval;
-};
-
-static int do_aggr ();
-
-/* From lex.c: */
-/* the declaration found for the last IDENTIFIER token read in.
- yylex must look this up to detect typedefs, which get token type TYPENAME,
- so it is left around in case the identifier is not a typedef but is
- used in a context which makes it a reference to a variable. */
-extern tree lastiddecl; /* let our brains leak out here too */
-extern int yychar; /* the lookahead symbol */
-extern YYSTYPE yylval; /* the semantic value of the */
- /* lookahead symbol */
-extern int end_of_file;
-
-struct obstack token_obstack;
-int first_token;
-
-#ifdef SPEW_DEBUG
-int spew_debug = 0;
-static unsigned int yylex_ctr = 0;
-static int debug_yychar ();
-#endif
-
-/* Initialize token_obstack. Called once, from init_lex. */
-
-void
-init_spew ()
-{
- gcc_obstack_init (&token_obstack);
-}
-
-#ifdef SPEW_DEBUG
-/* Use functions for debugging... */
-
-/* Return the number of tokens available on the fifo. */
-
-static int
-num_tokens ()
-{
- return (obstack_object_size (&token_obstack) / sizeof (struct token))
- - first_token;
-}
-
-/* Fetch the token N down the line from the head of the fifo. */
-
-static struct token*
-nth_token (n)
- int n;
-{
- /* could just have this do slurp_ implicitly, but this way is easier
- to debug... */
- my_friendly_assert (n < num_tokens (), 298);
- return ((struct token*)obstack_base (&token_obstack)) + n + first_token;
-}
-
-/* Add a token to the token fifo. */
-
-static void
-add_token (t)
- struct token* t;
-{
- obstack_grow (&token_obstack, t, sizeof (struct token));
-}
-
-/* Consume the next token out of the fifo. */
-
-static void
-consume_token ()
-{
- if (num_tokens () == 1)
- {
- obstack_free (&token_obstack, obstack_base (&token_obstack));
- first_token = 0;
- }
- else
- first_token++;
-}
-
-#else
-/* ...otherwise use macros. */
-
-#define num_tokens() \
- ((obstack_object_size (&token_obstack) / sizeof (struct token)) - first_token)
-
-#define nth_token(N) \
- (((struct token*)obstack_base (&token_obstack))+(N)+first_token)
-
-#define add_token(T) obstack_grow (&token_obstack, (T), sizeof (struct token))
-
-#define consume_token() \
- (num_tokens () == 1 \
- ? (obstack_free (&token_obstack, obstack_base (&token_obstack)), \
- (first_token = 0)) \
- : first_token++)
-#endif
-
-/* Pull in enough tokens from real_yylex that the queue is N long beyond
- the current token. */
-
-static void
-scan_tokens (n)
- int n;
-{
- int i;
- struct token *tmp;
-
- /* We cannot read past certain tokens, so make sure we don't. */
- i = num_tokens ();
- if (i > n)
- return;
- while (i-- > 0)
- {
- tmp = nth_token (i);
- /* Never read past these characters: they might separate
- the current input stream from one we save away later. */
- if (tmp->yychar == '{' || tmp->yychar == ':' || tmp->yychar == ';')
- goto pad_tokens;
- }
-
- while (num_tokens () <= n)
- {
- obstack_blank (&token_obstack, sizeof (struct token));
- tmp = ((struct token *)obstack_next_free (&token_obstack))-1;
- tmp->yychar = real_yylex ();
- tmp->end_of_file = end_of_file;
- tmp->yylval = yylval;
- end_of_file = 0;
- if (tmp->yychar == '{'
- || tmp->yychar == ':'
- || tmp->yychar == ';')
- {
- pad_tokens:
- while (num_tokens () <= n)
- {
- obstack_blank (&token_obstack, sizeof (struct token));
- tmp = ((struct token *)obstack_next_free (&token_obstack))-1;
- tmp->yychar = EMPTY;
- tmp->end_of_file = 0;
- }
- }
- }
-}
-
-static int
-probe_obstack (h, obj, nlevels)
- struct obstack *h;
- tree obj;
- unsigned int nlevels;
-{
- register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk* plp; /* point to previous chunk if any */
-
- lp = (h)->chunk;
- /* We use >= rather than > since the object cannot be exactly at
- the beginning of the chunk but might be an empty object exactly
- at the end of an adjacent chunk. */
- for (; nlevels != 0 && lp != 0 && ((tree)lp >= obj || (tree)lp->limit < obj);
- nlevels -= 1)
- {
- plp = lp->prev;
- lp = plp;
- }
- return nlevels != 0 && lp != 0;
-}
-
-/* from lex.c: */
-/* Value is 1 (or 2) if we should try to make the next identifier look like
- a typename (when it may be a local variable or a class variable).
- Value is 0 if we treat this name in a default fashion. */
-extern int looking_for_typename;
-int looking_for_template;
-
-extern struct obstack *current_obstack, *saveable_obstack;
-tree got_scope;
-tree got_object;
-
-int
-peekyylex ()
-{
- scan_tokens (0);
- return nth_token (0)->yychar;
-}
-
-int
-yylex ()
-{
- struct token tmp_token;
- tree trrr;
-
- retry:
-#ifdef SPEW_DEBUG
- if (spew_debug)
- {
- yylex_ctr ++;
- fprintf (stderr, "\t\t## %d ##", yylex_ctr);
- }
-#endif
-
- /* if we've got tokens, send them */
- if (num_tokens ())
- {
- tmp_token= *nth_token (0);
-
- /* TMP_TOKEN.YYLVAL.TTYPE may have been allocated on the wrong obstack.
- If we don't find it in CURRENT_OBSTACK's current or immediately
- previous chunk, assume it was and copy it to the current obstack. */
- if ((tmp_token.yychar == CONSTANT
- || tmp_token.yychar == STRING)
- && ! TREE_PERMANENT (tmp_token.yylval.ttype)
- && ! probe_obstack (current_obstack, tmp_token.yylval.ttype, 2)
- && ! probe_obstack (saveable_obstack, tmp_token.yylval.ttype, 2))
- tmp_token.yylval.ttype = copy_node (tmp_token.yylval.ttype);
- }
- else
- {
- /* if not, grab the next one and think about it */
- tmp_token.yychar = real_yylex ();
- tmp_token.yylval = yylval;
- tmp_token.end_of_file = end_of_file;
- add_token (&tmp_token);
- }
-
- /* many tokens just need to be returned. At first glance, all we
- have to do is send them back up, but some of them are needed to
- figure out local context. */
- switch (tmp_token.yychar)
- {
- case EMPTY:
- /* This is a lexical no-op. */
- consume_token ();
-#ifdef SPEW_DEBUG
- if (spew_debug)
- debug_yychar (tmp_token.yychar);
-#endif
- goto retry;
-
- case IDENTIFIER:
- scan_tokens (1);
- if (nth_token (1)->yychar == SCOPE)
- /* Don't interfere with the setting from an 'aggr' prefix. */
- looking_for_typename++;
- else if (nth_token (1)->yychar == '<')
- looking_for_template = 1;
-
- trrr = lookup_name (tmp_token.yylval.ttype, -2);
-
- if (trrr)
- {
- tmp_token.yychar = identifier_type (trrr);
- switch (tmp_token.yychar)
- {
- case TYPENAME:
- case SELFNAME:
- lastiddecl = identifier_typedecl_value (tmp_token.yylval.ttype);
- if (lastiddecl != trrr)
- {
- lastiddecl = trrr;
- if (got_scope)
- tmp_token.yylval.ttype = trrr;
- }
- break;
- case IDENTIFIER:
- lastiddecl = trrr;
- break;
- case PTYPENAME:
- lastiddecl = NULL_TREE;
- break;
- case NSNAME:
- lastiddecl = trrr;
- if (got_scope)
- tmp_token.yylval.ttype = trrr;
- break;
- default:
- my_friendly_abort (101);
- }
- }
- else
- lastiddecl = trrr;
- got_scope = NULL_TREE;
- /* and fall through to... */
- case IDENTIFIER_DEFN:
- case TYPENAME:
- case TYPENAME_DEFN:
- case PTYPENAME:
- case PTYPENAME_DEFN:
- consume_token ();
- if (looking_for_typename > 0)
- looking_for_typename--;
- looking_for_template = 0;
- break;
-
- case SCSPEC:
- case NEW:
- /* do_aggr needs to check if the previous token was RID_NEW,
- so just increment first_token instead of calling consume_token. */
- ++first_token;
- break;
-
- case TYPESPEC:
- consume_token ();
- break;
-
- case AGGR:
- *nth_token (0) = tmp_token;
- do_aggr ();
- /* fall through to output... */
- case ENUM:
- /* Set this again, in case we are rescanning. */
- looking_for_typename = 1;
- /* fall through... */
- default:
- consume_token ();
- }
-
- got_object = NULL_TREE;
- yylval = tmp_token.yylval;
- yychar = tmp_token.yychar;
- end_of_file = tmp_token.end_of_file;
-#ifdef SPEW_DEBUG
- if (spew_debug)
- debug_yychar (yychar);
-#endif
- return yychar;
-}
-
-/* token[0] == AGGR (struct/union/enum)
- Thus, token[1] is either a TYPENAME or a TYPENAME_DEFN.
- If token[2] == '{' or ':' then it's TYPENAME_DEFN.
- It's also a definition if it's a forward declaration (as in 'struct Foo;')
- which we can tell if token[2] == ';' *and* token[-1] != FRIEND or NEW. */
-
-static int
-do_aggr ()
-{
- int yc1, yc2;
-
- scan_tokens (2);
- yc1 = nth_token (1)->yychar;
- if (yc1 != TYPENAME && yc1 != IDENTIFIER && yc1 != PTYPENAME)
- return 0;
- yc2 = nth_token (2)->yychar;
- if (yc2 == ';')
- {
- /* It's a forward declaration iff we were not preceded by
- 'friend' or `new'. */
- if (first_token > 0)
- {
- if (nth_token (-1)->yychar == SCSPEC
- && nth_token (-1)->yylval.ttype == ridpointers[(int) RID_FRIEND])
- return 0;
- if (nth_token (-1)->yychar == NEW)
- return 0;
- }
- }
- else if (yc2 != '{' && yc2 != ':')
- return 0;
-
- switch (yc1)
- {
- case TYPENAME:
- nth_token (1)->yychar = TYPENAME_DEFN;
- break;
- case PTYPENAME:
- nth_token (1)->yychar = PTYPENAME_DEFN;
- break;
- case IDENTIFIER:
- nth_token (1)->yychar = IDENTIFIER_DEFN;
- break;
- default:
- my_friendly_abort (102);
- }
- return 0;
-}
-
-#ifdef SPEW_DEBUG
-/* debug_yychar takes a yychar (token number) value and prints its name. */
-
-static int
-debug_yychar (yy)
- int yy;
-{
- /* In parse.y: */
- extern char *debug_yytranslate ();
-
- int i;
-
- if (yy<256) {
- fprintf (stderr, "<%d: %c >\n", yy, yy);
- return 0;
- }
- fprintf (stderr, "<%d:%s>\n", yy, debug_yytranslate (yy));
- return 1;
-}
-
-#endif
diff --git a/gcc/cp/tinfo.cc b/gcc/cp/tinfo.cc
deleted file mode 100644
index d82aaaf0431..00000000000
--- a/gcc/cp/tinfo.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// Methods for type_info for -*- C++ -*- Run Time Type Identification.
-// Copyright (C) 1994, 1996 Free Software Foundation
-
-// 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.
-
-// As a special exception, if you link this library with other files,
-// some of which are compiled with GCC, to produce an executable,
-// this library 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.
-
-#include <stddef.h>
-#include "tinfo.h"
-#include "new" // for placement new
-
-// This file contains the minimal working set necessary to link with code
-// that uses virtual functions and -frtti but does not actually use RTTI
-// functionality.
-
-type_info::
-~type_info ()
-{ }
-
-extern "C" void
-__rtti_class (void *addr, const char *name,
- const __class_type_info::base_info *bl, size_t bn)
-{ new (addr) __class_type_info (name, bl, bn); }
-
-extern "C" void
-__rtti_si (void *addr, const char *n, const type_info *ti)
-{
- new (addr) __si_type_info
- (n, static_cast <const __user_type_info &> (*ti));
-}
-
-extern "C" void
-__rtti_user (void *addr, const char *name)
-{ new (addr) __user_type_info (name); }
-
-// dynamic_cast helper methods.
-// Returns a pointer to the desired sub-object or 0.
-
-void * __user_type_info::
-dcast (const type_info& to, int, void *addr, const type_info *, void *) const
-{ return (*this == to) ? addr : 0; }
-
-void * __si_type_info::
-dcast (const type_info& to, int require_public, void *addr,
- const type_info *sub, void *subptr) const
-{
- if (*this == to)
- return addr;
- return base.dcast (to, require_public, addr, sub, subptr);
-}
-
-void* __class_type_info::
-dcast (const type_info& desired, int is_public, void *objptr,
- const type_info *sub, void *subptr) const
-{
- if (*this == desired)
- return objptr;
-
- void *match_found = 0;
- for (int i = 0; i < n_bases; i++)
- {
- if (is_public && base_list[i].access != PUBLIC)
- continue;
-
- void *p = (char *)objptr + base_list[i].offset;
- if (base_list[i].is_virtual)
- p = *(void **)p;
- p = base_list[i].base->dcast (desired, is_public, p, sub, subptr);
- if (p)
- {
- if (match_found == 0)
- match_found = p;
- else if (match_found != p)
- {
- if (sub)
- {
- // Perhaps we're downcasting from *sub to desired; see if
- // subptr is a subobject of exactly one of {match_found,p}.
-
- const __user_type_info &d =
- static_cast <const __user_type_info &> (desired);
-
- void *os = d.dcast (*sub, 1, match_found);
- void *ns = d.dcast (*sub, 1, p);
-
- if (os == ns)
- /* ambiguous -- subptr is a virtual base */;
- else if (os == subptr)
- continue;
- else if (ns == subptr)
- {
- match_found = p;
- continue;
- }
- }
-
- // base found at two different pointers,
- // conversion is not unique
- return 0;
- }
- }
- }
-
- return match_found;
-}
diff --git a/gcc/cp/tinfo.h b/gcc/cp/tinfo.h
deleted file mode 100644
index 3df55a5c709..00000000000
--- a/gcc/cp/tinfo.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// RTTI support internals for -*- C++ -*-
-// Copyright (C) 1994, 1995, 1996 Free Software Foundation
-
-#include "typeinfo"
-
-// Class declarations shared between the typeinfo implementation files.
-
-// type_info for a class with no base classes (or an enum).
-
-struct __user_type_info : public type_info {
- __user_type_info (const char *n) : type_info (n) {}
-
- // If our type can be converted to the desired type,
- // return the pointer, adjusted accordingly; else return 0.
- virtual void* dcast (const type_info &, int, void *,
- const type_info * = 0, void * = 0) const;
-};
-
-// type_info for a class with one public, nonvirtual base class.
-
-class __si_type_info : public __user_type_info {
- const __user_type_info &base;
-
-public:
- __si_type_info (const char *n, const __user_type_info &b)
- : __user_type_info (n), base (b) { }
-
- virtual void *dcast (const type_info &, int, void *,
- const type_info * = 0, void * = 0) const;
-};
-
-// type_info for a general class.
-
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-
-struct __class_type_info : public __user_type_info {
- enum access { PUBLIC = 1, PROTECTED = 2, PRIVATE = 3 };
-
- struct base_info {
- const __user_type_info *base;
- USItype offset: 29;
- bool is_virtual: 1;
- access access: 2;
- };
-
- const base_info *base_list;
- size_t n_bases;
-
- __class_type_info (const char *name, const base_info *bl, size_t bn)
- : __user_type_info (name), base_list (bl), n_bases (bn) {}
-
- // This is a little complex.
- virtual void* dcast (const type_info &, int, void *,
- const type_info * = 0, void * = 0) const;
-};
diff --git a/gcc/cp/tinfo2.cc b/gcc/cp/tinfo2.cc
deleted file mode 100644
index 10290a8e52b..00000000000
--- a/gcc/cp/tinfo2.cc
+++ /dev/null
@@ -1,311 +0,0 @@
-// Methods for type_info for -*- C++ -*- Run Time Type Identification.
-// Copyright (C) 1994, 1996 Free Software Foundation
-
-// 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.
-
-// As a special exception, if you link this library with other files,
-// some of which are compiled with GCC, to produce an executable,
-// this library 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.
-
-#include <stddef.h>
-#include "tinfo.h"
-#include "new" // for placement new
-
-// service function for comparing types by name.
-
-static inline int
-fast_compare (const char *n1, const char *n2) {
- int c;
- if (n1 == n2) return 0;
- if (n1 == 0) return *n2;
- else if (n2 == 0) return *n1;
-
- c = (int)*n1++ - (int)*n2++;
- return c == 0 ? strcmp (n1, n2) : c;
-};
-
-bool
-type_info::before (const type_info &arg)
-{
- return fast_compare (name (), arg.name ()) < 0;
-}
-
-#ifdef _WIN32
-bool type_info::
-operator== (const type_info& arg) const
-{
- return fast_compare (name (), arg.name ()) == 0;
-}
-
-bool type_info::
-operator!= (const type_info& arg) const
-{
- return fast_compare (name (), arg.name ()) != 0;
-}
-#endif
-
-// type info for pointer type.
-
-struct __pointer_type_info : public type_info {
- const type_info& type;
-
- __pointer_type_info (const char *n, const type_info& ti)
- : type_info (n), type (ti) {}
-};
-
-// type info for attributes
-
-struct __attr_type_info : public type_info {
- enum cv { NONE = 0, CONST = 1, VOLATILE = 2, CONSTVOL = 1 | 2 };
-
- const type_info& type;
- cv attr;
-
- __attr_type_info (const char *n, cv a, const type_info& t)
- : type_info (n), type (t), attr (a) {}
-};
-
-// type_info for builtin type
-
-struct __builtin_type_info : public type_info {
- __builtin_type_info (const char *n): type_info (n) {}
-};
-
-// type info for function.
-
-struct __func_type_info : public type_info {
- __func_type_info (const char *n) : type_info (n) {}
-};
-
-// type info for pointer to member function.
-
-struct __ptmf_type_info : public type_info {
- __ptmf_type_info (const char *n) : type_info (n) {}
-};
-
-// type info for pointer to data member.
-
-struct __ptmd_type_info : public type_info {
- __ptmd_type_info (const char *n): type_info (n) {}
-};
-
-// type info for array.
-
-struct __array_type_info : public type_info {
- __array_type_info (const char *n): type_info (n) {}
-};
-
-// Entry points for the compiler.
-
-/* Low level match routine used by compiler to match types of catch
- variables and thrown objects. */
-
-extern "C" void*
-__throw_type_match_rtti (void *catch_type_r, void *throw_type_r, void *objptr)
-{
- const type_info &catch_type = *(const type_info *)catch_type_r;
- const type_info &throw_type = *(const type_info *)throw_type_r;
-
- if (catch_type == throw_type)
- return objptr;
-
-#if 0
- printf ("We want to match a %s against a %s!\n",
- throw_type.name (), catch_type.name ());
-#endif
-
- void *new_objptr = 0;
-
- if (const __user_type_info *p
- = dynamic_cast <const __user_type_info *> (&throw_type))
- {
- /* The 1 skips conversions to private bases. */
- new_objptr = p->dcast (catch_type, 1, objptr);
- }
- else if (const __pointer_type_info *fr =
- dynamic_cast <const __pointer_type_info *> (&throw_type))
- {
- const __pointer_type_info *to =
- dynamic_cast <const __pointer_type_info *> (&catch_type);
-
- if (! to)
- goto fail;
-
- const type_info *subfr = &fr->type, *subto = &to->type;
- __attr_type_info::cv cvfrom, cvto;
-
- if (const __attr_type_info *at
- = dynamic_cast <const __attr_type_info *> (subfr))
- {
- cvfrom = at->attr;
- subfr = &at->type;
- }
- else
- cvfrom = __attr_type_info::NONE;
-
- if (const __attr_type_info *at
- = dynamic_cast <const __attr_type_info *> (subto))
- {
- cvto = at->attr;
- subto = &at->type;
- }
- else
- cvto = __attr_type_info::NONE;
-
- if (((cvfrom & __attr_type_info::CONST)
- > (cvto & __attr_type_info::CONST))
- || ((cvfrom & __attr_type_info::VOLATILE)
- > (cvto & __attr_type_info::VOLATILE)))
- goto fail;
-
- if (*subto == *subfr)
- new_objptr = objptr;
- else if (*subto == typeid (void)
- && dynamic_cast <const __func_type_info *> (subfr) == 0)
- new_objptr = objptr;
- else if (const __user_type_info *p
- = dynamic_cast <const __user_type_info *> (subfr))
- {
- /* The 1 skips conversions to private bases. */
- new_objptr = p->dcast (*subto, 1, objptr);
- }
- else if (const __pointer_type_info *pfr
- = dynamic_cast <const __pointer_type_info *> (subfr))
- {
- // Multi-level pointer conversion.
-
- const __pointer_type_info *pto
- = dynamic_cast <const __pointer_type_info *> (subto);
-
- if (! pto)
- goto fail;
-
- bool constp = (cvto & __attr_type_info::CONST);
- for (subto = &pto->type, subfr = &pfr->type; ;
- subto = &pto->type, subfr = &pfr->type)
- {
- if (const __attr_type_info *at
- = dynamic_cast <const __attr_type_info *> (subfr))
- {
- cvfrom = at->attr;
- subfr = &at->type;
- }
- else
- cvfrom = __attr_type_info::NONE;
-
- if (const __attr_type_info *at
- = dynamic_cast <const __attr_type_info *> (subto))
- {
- cvto = at->attr;
- subto = &at->type;
- }
- else
- cvto = __attr_type_info::NONE;
-
- if (((cvfrom & __attr_type_info::CONST)
- > (cvto & __attr_type_info::CONST))
- || ((cvfrom & __attr_type_info::VOLATILE)
- > (cvto & __attr_type_info::VOLATILE)))
- goto fail;
-
- if (! constp
- && (((cvfrom & __attr_type_info::CONST)
- < (cvto & __attr_type_info::CONST))
- || ((cvfrom & __attr_type_info::VOLATILE)
- < (cvto & __attr_type_info::VOLATILE))))
- goto fail;
-
- if (*subto == *subfr)
- {
- new_objptr = objptr;
- break;
- }
-
- pto = dynamic_cast <const __pointer_type_info *> (subto);
- pfr = dynamic_cast <const __pointer_type_info *> (subfr);
- if (! pto || ! pfr)
- goto fail;
-
- if (! (cvto & __attr_type_info::CONST))
- constp = false;
- }
- }
- }
- fail:
-
-#if 0
- if (new_objptr)
- printf ("It converts, delta is %d\n", new_objptr-objptr);
-#endif
- return new_objptr;
-}
-
-extern "C" void
-__rtti_ptr (void *addr, const char *n, const type_info *ti)
-{ new (addr) __pointer_type_info (n, *ti); }
-
-extern "C" void
-__rtti_attr (void *addr, const char *n, int attrval, const type_info *ti)
-{
- new (addr) __attr_type_info
- (n, static_cast <__attr_type_info::cv> (attrval), *ti);
-}
-
-extern "C" void
-__rtti_func (void *addr, const char *name)
-{ new (addr) __func_type_info (name); }
-
-extern "C" void
-__rtti_ptmf (void *addr, const char *name)
-{ new (addr) __ptmf_type_info (name); }
-
-extern "C" void
-__rtti_ptmd (void *addr, const char *name)
-{ new (addr) __ptmd_type_info (name); }
-
-extern "C" void
-__rtti_array (void *addr, const char *name)
-{ new (addr) __array_type_info (name); }
-
-extern "C" void *
-__dynamic_cast (const type_info& (*from)(void), const type_info& (*to)(void),
- int require_public, void *address,
- const type_info & (*sub)(void), void *subptr)
-{
- return static_cast <const __user_type_info &> (from ()).dcast
- (to (), require_public, address, &(sub ()), subptr);
-}
-
-// type_info nodes and functions for the builtin types. The mangling here
-// must match the mangling in gcc/cp/rtti.c.
-
-#define BUILTIN(mangled) \
-unsigned char __ti##mangled [sizeof (__builtin_type_info)] \
- __attribute__ ((aligned (__alignof__ (void *)))); \
-extern "C" const type_info &__tf##mangled (void) { \
- if ((*(void **) __ti##mangled) == 0) \
- new (__ti##mangled) __builtin_type_info (#mangled); \
- return *(type_info *)__ti##mangled; \
-}
-
-BUILTIN (v); BUILTIN (x); BUILTIN (l); BUILTIN (i); BUILTIN (s); BUILTIN (b);
-BUILTIN (c); BUILTIN (w); BUILTIN (r); BUILTIN (d); BUILTIN (f);
-BUILTIN (Ui); BUILTIN (Ul); BUILTIN (Ux); BUILTIN (Us); BUILTIN (Uc);
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
deleted file mode 100644
index aefce65b2cb..00000000000
--- a/gcc/cp/tree.c
+++ /dev/null
@@ -1,2104 +0,0 @@
-/* Language-dependent node constructors for parse phase of GNU compiler.
- Copyright (C) 1987, 88, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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 <stdio.h>
-#include "obstack.h"
-#include "tree.h"
-#include "cp-tree.h"
-#include "flags.h"
-#include "rtl.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#define CEIL(x,y) (((x) + (y) - 1) / (y))
-
-/* Return nonzero if REF is an lvalue valid for this language.
- Lvalues can be assigned, unless they have TREE_READONLY.
- Lvalues can have their address taken, unless they have DECL_REGISTER. */
-
-int
-real_lvalue_p (ref)
- tree ref;
-{
- if (! language_lvalue_valid (ref))
- return 0;
-
- if (TREE_CODE (TREE_TYPE (ref)) == REFERENCE_TYPE)
- return 1;
-
- if (ref == current_class_ptr && flag_this_is_variable <= 0)
- return 0;
-
- switch (TREE_CODE (ref))
- {
- /* preincrements and predecrements are valid lvals, provided
- what they refer to are valid lvals. */
- case PREINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case COMPONENT_REF:
- case SAVE_EXPR:
- return real_lvalue_p (TREE_OPERAND (ref, 0));
-
- case STRING_CST:
- return 1;
-
- case VAR_DECL:
- if (TREE_READONLY (ref) && ! TREE_STATIC (ref)
- && DECL_LANG_SPECIFIC (ref)
- && DECL_IN_AGGR_P (ref))
- return 0;
- case INDIRECT_REF:
- case ARRAY_REF:
- case PARM_DECL:
- case RESULT_DECL:
- case ERROR_MARK:
- if (TREE_CODE (TREE_TYPE (ref)) != FUNCTION_TYPE
- && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
- return 1;
- break;
-
- /* A currently unresolved scope ref. */
- case SCOPE_REF:
- my_friendly_abort (103);
- case OFFSET_REF:
- if (TREE_CODE (TREE_OPERAND (ref, 1)) == FUNCTION_DECL)
- return 1;
- return real_lvalue_p (TREE_OPERAND (ref, 0))
- && real_lvalue_p (TREE_OPERAND (ref, 1));
- break;
-
- case COND_EXPR:
- return (real_lvalue_p (TREE_OPERAND (ref, 1))
- && real_lvalue_p (TREE_OPERAND (ref, 2)));
-
- case MODIFY_EXPR:
- return 1;
-
- case COMPOUND_EXPR:
- return real_lvalue_p (TREE_OPERAND (ref, 1));
-
- case MAX_EXPR:
- case MIN_EXPR:
- return (real_lvalue_p (TREE_OPERAND (ref, 0))
- && real_lvalue_p (TREE_OPERAND (ref, 1)));
- }
-
- return 0;
-}
-
-int
-lvalue_p (ref)
- tree ref;
-{
- if (! language_lvalue_valid (ref))
- return 0;
-
- if (TREE_CODE (TREE_TYPE (ref)) == REFERENCE_TYPE)
- return 1;
-
- if (ref == current_class_ptr && flag_this_is_variable <= 0)
- return 0;
-
- switch (TREE_CODE (ref))
- {
- /* preincrements and predecrements are valid lvals, provided
- what they refer to are valid lvals. */
- case PREINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case COMPONENT_REF:
- case SAVE_EXPR:
- return lvalue_p (TREE_OPERAND (ref, 0));
-
- case STRING_CST:
- return 1;
-
- case VAR_DECL:
- if (TREE_READONLY (ref) && ! TREE_STATIC (ref)
- && DECL_LANG_SPECIFIC (ref)
- && DECL_IN_AGGR_P (ref))
- return 0;
- case INDIRECT_REF:
- case ARRAY_REF:
- case PARM_DECL:
- case RESULT_DECL:
- case ERROR_MARK:
- if (TREE_CODE (TREE_TYPE (ref)) != FUNCTION_TYPE
- && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
- return 1;
- break;
-
- case TARGET_EXPR:
- return 1;
-
- case CALL_EXPR:
- if (IS_AGGR_TYPE (TREE_TYPE (ref)))
- return 1;
- break;
-
- /* A currently unresolved scope ref. */
- case SCOPE_REF:
- my_friendly_abort (103);
- case OFFSET_REF:
- if (TREE_CODE (TREE_OPERAND (ref, 1)) == FUNCTION_DECL)
- return 1;
- return lvalue_p (TREE_OPERAND (ref, 0))
- && lvalue_p (TREE_OPERAND (ref, 1));
- break;
-
- case COND_EXPR:
- return (lvalue_p (TREE_OPERAND (ref, 1))
- && lvalue_p (TREE_OPERAND (ref, 2)));
-
- case MODIFY_EXPR:
- return 1;
-
- case COMPOUND_EXPR:
- return lvalue_p (TREE_OPERAND (ref, 1));
-
- case MAX_EXPR:
- case MIN_EXPR:
- return (lvalue_p (TREE_OPERAND (ref, 0))
- && lvalue_p (TREE_OPERAND (ref, 1)));
- }
-
- return 0;
-}
-
-/* Return nonzero if REF is an lvalue valid for this language;
- otherwise, print an error message and return zero. */
-
-int
-lvalue_or_else (ref, string)
- tree ref;
- char *string;
-{
- int win = lvalue_p (ref);
- if (! win)
- error ("non-lvalue in %s", string);
- return win;
-}
-
-/* INIT is a CALL_EXPR which needs info about its target.
- TYPE is the type that this initialization should appear to have.
-
- Build an encapsulation of the initialization to perform
- and return it so that it can be processed by language-independent
- and language-specific expression expanders. */
-
-tree
-build_cplus_new (type, init)
- tree type;
- tree init;
-{
- tree slot;
- tree rval;
-
- if (TREE_CODE (init) == TARGET_EXPR || init == error_mark_node)
- return init;
-
- slot = build (VAR_DECL, type);
- layout_decl (slot, 0);
- rval = build (NEW_EXPR, type,
- TREE_OPERAND (init, 0), TREE_OPERAND (init, 1), slot);
- TREE_SIDE_EFFECTS (rval) = 1;
- TREE_ADDRESSABLE (rval) = 1;
- rval = build (TARGET_EXPR, type, slot, rval, NULL_TREE, NULL_TREE);
- TREE_SIDE_EFFECTS (rval) = 1;
- TREE_ADDRESSABLE (rval) = 1;
-
- return rval;
-}
-
-/* Recursively search EXP for CALL_EXPRs that need cleanups and replace
- these CALL_EXPRs with tree nodes that will perform the cleanups. */
-
-tree
-break_out_cleanups (exp)
- tree exp;
-{
- tree tmp = exp;
-
- if (TREE_CODE (tmp) == CALL_EXPR
- && TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (tmp)))
- return build_cplus_new (TREE_TYPE (tmp), tmp);
-
- while (TREE_CODE (tmp) == NOP_EXPR
- || TREE_CODE (tmp) == CONVERT_EXPR
- || TREE_CODE (tmp) == NON_LVALUE_EXPR)
- {
- if (TREE_CODE (TREE_OPERAND (tmp, 0)) == CALL_EXPR
- && TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (TREE_OPERAND (tmp, 0))))
- {
- TREE_OPERAND (tmp, 0)
- = build_cplus_new (TREE_TYPE (TREE_OPERAND (tmp, 0)),
- TREE_OPERAND (tmp, 0));
- break;
- }
- else
- tmp = TREE_OPERAND (tmp, 0);
- }
- return exp;
-}
-
-/* Recursively perform a preorder search EXP for CALL_EXPRs, making
- copies where they are found. Returns a deep copy all nodes transitively
- containing CALL_EXPRs. */
-
-tree
-break_out_calls (exp)
- tree exp;
-{
- register tree t1, t2;
- register enum tree_code code;
- register int changed = 0;
- register int i;
-
- if (exp == NULL_TREE)
- return exp;
-
- code = TREE_CODE (exp);
-
- if (code == CALL_EXPR)
- return copy_node (exp);
-
- /* Don't try and defeat a save_expr, as it should only be done once. */
- if (code == SAVE_EXPR)
- return exp;
-
- switch (TREE_CODE_CLASS (code))
- {
- default:
- abort ();
-
- case 'c': /* a constant */
- case 't': /* a type node */
- case 'x': /* something random, like an identifier or an ERROR_MARK. */
- return exp;
-
- case 'd': /* A decl node */
-#if 0 /* This is bogus. jason 9/21/94 */
-
- t1 = break_out_calls (DECL_INITIAL (exp));
- if (t1 != DECL_INITIAL (exp))
- {
- exp = copy_node (exp);
- DECL_INITIAL (exp) = t1;
- }
-#endif
- return exp;
-
- case 'b': /* A block node */
- {
- /* Don't know how to handle these correctly yet. Must do a
- break_out_calls on all DECL_INITIAL values for local variables,
- and also break_out_calls on all sub-blocks and sub-statements. */
- abort ();
- }
- return exp;
-
- case 'e': /* an expression */
- case 'r': /* a reference */
- case 's': /* an expression with side effects */
- for (i = tree_code_length[(int) code] - 1; i >= 0; i--)
- {
- t1 = break_out_calls (TREE_OPERAND (exp, i));
- if (t1 != TREE_OPERAND (exp, i))
- {
- exp = copy_node (exp);
- TREE_OPERAND (exp, i) = t1;
- }
- }
- return exp;
-
- case '<': /* a comparison expression */
- case '2': /* a binary arithmetic expression */
- t2 = break_out_calls (TREE_OPERAND (exp, 1));
- if (t2 != TREE_OPERAND (exp, 1))
- changed = 1;
- case '1': /* a unary arithmetic expression */
- t1 = break_out_calls (TREE_OPERAND (exp, 0));
- if (t1 != TREE_OPERAND (exp, 0))
- changed = 1;
- if (changed)
- {
- if (tree_code_length[(int) code] == 1)
- return build1 (code, TREE_TYPE (exp), t1);
- else
- return build (code, TREE_TYPE (exp), t1, t2);
- }
- return exp;
- }
-
-}
-
-extern struct obstack *current_obstack;
-extern struct obstack permanent_obstack, class_obstack;
-extern struct obstack *saveable_obstack;
-extern struct obstack *expression_obstack;
-
-/* Here is how primitive or already-canonicalized types' hash
- codes are made. MUST BE CONSISTENT WITH tree.c !!! */
-#define TYPE_HASH(TYPE) ((HOST_WIDE_INT) (TYPE) & 0777777)
-
-/* Construct, lay out and return the type of methods belonging to class
- BASETYPE and whose arguments are described by ARGTYPES and whose values
- are described by RETTYPE. If each type exists already, reuse it. */
-
-tree
-build_cplus_method_type (basetype, rettype, argtypes)
- tree basetype, rettype, argtypes;
-{
- register tree t;
- tree ptype;
- int hashcode;
-
- /* Make a node of the sort we want. */
- t = make_node (METHOD_TYPE);
-
- TYPE_METHOD_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype);
- TREE_TYPE (t) = rettype;
- if (IS_SIGNATURE (basetype))
- ptype = build_signature_pointer_type (TYPE_MAIN_VARIANT (basetype),
- TYPE_READONLY (basetype),
- TYPE_VOLATILE (basetype));
- else
- ptype = build_pointer_type (basetype);
-
- /* The actual arglist for this function includes a "hidden" argument
- which is "this". Put it into the list of argument types. */
-
- argtypes = tree_cons (NULL_TREE, ptype, argtypes);
- TYPE_ARG_TYPES (t) = argtypes;
- TREE_SIDE_EFFECTS (argtypes) = 1; /* Mark first argtype as "artificial". */
-
- /* If we already have such a type, use the old one and free this one.
- Note that it also frees up the above cons cell if found. */
- hashcode = TYPE_HASH (basetype) + TYPE_HASH (rettype) + type_hash_list (argtypes);
- t = type_hash_canon (hashcode, t);
-
- if (TYPE_SIZE (t) == 0)
- layout_type (t);
-
- return t;
-}
-
-static tree
-build_cplus_array_type_1 (elt_type, index_type)
- tree elt_type;
- tree index_type;
-{
- register struct obstack *ambient_obstack = current_obstack;
- register struct obstack *ambient_saveable_obstack = saveable_obstack;
- tree t;
-
- /* We need a new one. If both ELT_TYPE and INDEX_TYPE are permanent,
- make this permanent too. */
- if (TREE_PERMANENT (elt_type)
- && (index_type == 0 || TREE_PERMANENT (index_type)))
- {
- current_obstack = &permanent_obstack;
- saveable_obstack = &permanent_obstack;
- }
-
- if (processing_template_decl)
- {
- t = make_node (ARRAY_TYPE);
- TREE_TYPE (t) = elt_type;
- TYPE_DOMAIN (t) = index_type;
- }
- else
- t = build_array_type (elt_type, index_type);
-
- /* Push these needs up so that initialization takes place
- more easily. */
- TYPE_NEEDS_CONSTRUCTING (t) = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
- TYPE_NEEDS_DESTRUCTOR (t) = TYPE_NEEDS_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
- current_obstack = ambient_obstack;
- saveable_obstack = ambient_saveable_obstack;
- return t;
-}
-
-tree
-build_cplus_array_type (elt_type, index_type)
- tree elt_type;
- tree index_type;
-{
- tree t;
- int constp = TYPE_READONLY (elt_type);
- int volatilep = TYPE_VOLATILE (elt_type);
- elt_type = TYPE_MAIN_VARIANT (elt_type);
-
- t = build_cplus_array_type_1 (elt_type, index_type);
-
- if (constp || volatilep)
- t = cp_build_type_variant (t, constp, volatilep);
-
- return t;
-}
-
-/* Make a variant type in the proper way for C/C++, propagating qualifiers
- down to the element type of an array. */
-
-tree
-cp_build_type_variant (type, constp, volatilep)
- tree type;
- int constp, volatilep;
-{
- if (type == error_mark_node)
- return type;
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- tree real_main_variant = TYPE_MAIN_VARIANT (type);
-
- push_obstacks (TYPE_OBSTACK (real_main_variant),
- TYPE_OBSTACK (real_main_variant));
- type = build_cplus_array_type_1 (cp_build_type_variant
- (TREE_TYPE (type), constp, volatilep),
- TYPE_DOMAIN (type));
-
- /* TYPE must be on same obstack as REAL_MAIN_VARIANT. If not,
- make a copy. (TYPE might have come from the hash table and
- REAL_MAIN_VARIANT might be in some function's obstack.) */
-
- if (TYPE_OBSTACK (type) != TYPE_OBSTACK (real_main_variant))
- {
- type = copy_node (type);
- TYPE_POINTER_TO (type) = TYPE_REFERENCE_TO (type) = 0;
- }
-
- TYPE_MAIN_VARIANT (type) = real_main_variant;
- pop_obstacks ();
- return type;
- }
- return build_type_variant (type, constp, volatilep);
-}
-
-/* Add OFFSET to all base types of T.
-
- OFFSET, which is a type offset, is number of bytes.
-
- Note that we don't have to worry about having two paths to the
- same base type, since this type owns its association list. */
-
-void
-propagate_binfo_offsets (binfo, offset)
- tree binfo;
- tree offset;
-{
- tree binfos = BINFO_BASETYPES (binfo);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baselinks; /* note increment is done in the loop. */)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- i += 1;
- else
- {
- int j;
- tree base_binfos = BINFO_BASETYPES (base_binfo);
- tree delta;
-
- for (j = i+1; j < n_baselinks; j++)
- if (! TREE_VIA_VIRTUAL (TREE_VEC_ELT (binfos, j)))
- {
- /* The next basetype offset must take into account the space
- between the classes, not just the size of each class. */
- delta = size_binop (MINUS_EXPR,
- BINFO_OFFSET (TREE_VEC_ELT (binfos, j)),
- BINFO_OFFSET (base_binfo));
- break;
- }
-
-#if 0
- if (BINFO_OFFSET_ZEROP (base_binfo))
- BINFO_OFFSET (base_binfo) = offset;
- else
- BINFO_OFFSET (base_binfo)
- = size_binop (PLUS_EXPR, BINFO_OFFSET (base_binfo), offset);
-#else
- BINFO_OFFSET (base_binfo) = offset;
-#endif
- if (base_binfos)
- {
- int k;
- tree chain = NULL_TREE;
-
- /* Now unshare the structure beneath BASE_BINFO. */
- for (k = TREE_VEC_LENGTH (base_binfos)-1;
- k >= 0; k--)
- {
- tree base_base_binfo = TREE_VEC_ELT (base_binfos, k);
- if (! TREE_VIA_VIRTUAL (base_base_binfo))
- TREE_VEC_ELT (base_binfos, k)
- = make_binfo (BINFO_OFFSET (base_base_binfo),
- base_base_binfo,
- BINFO_VTABLE (base_base_binfo),
- BINFO_VIRTUALS (base_base_binfo),
- chain);
- chain = TREE_VEC_ELT (base_binfos, k);
- TREE_VIA_PUBLIC (chain) = TREE_VIA_PUBLIC (base_base_binfo);
- TREE_VIA_PROTECTED (chain) = TREE_VIA_PROTECTED (base_base_binfo);
- BINFO_INHERITANCE_CHAIN (chain) = base_binfo;
- }
- /* Now propagate the offset to the base types. */
- propagate_binfo_offsets (base_binfo, offset);
- }
-
- /* Go to our next class that counts for offset propagation. */
- i = j;
- if (i < n_baselinks)
- offset = size_binop (PLUS_EXPR, offset, delta);
- }
- }
-}
-
-/* Compute the actual offsets that our virtual base classes
- will have *for this type*. This must be performed after
- the fields are laid out, since virtual baseclasses must
- lay down at the end of the record.
-
- Returns the maximum number of virtual functions any of the virtual
- baseclasses provide. */
-
-int
-layout_vbasetypes (rec, max)
- tree rec;
- int max;
-{
- /* Get all the virtual base types that this type uses.
- The TREE_VALUE slot holds the virtual baseclass type. */
- tree vbase_types = get_vbase_types (rec);
-
-#ifdef STRUCTURE_SIZE_BOUNDARY
- unsigned record_align = MAX (STRUCTURE_SIZE_BOUNDARY, TYPE_ALIGN (rec));
-#else
- unsigned record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (rec));
-#endif
- int desired_align;
-
- /* Record size so far is CONST_SIZE + VAR_SIZE bits,
- where CONST_SIZE is an integer
- and VAR_SIZE is a tree expression.
- If VAR_SIZE is null, the size is just CONST_SIZE.
- Naturally we try to avoid using VAR_SIZE. */
- register unsigned const_size = 0;
- register tree var_size = 0;
- int nonvirtual_const_size;
-
- CLASSTYPE_VBASECLASSES (rec) = vbase_types;
-
- if (TREE_CODE (TYPE_SIZE (rec)) == INTEGER_CST)
- const_size = TREE_INT_CST_LOW (TYPE_SIZE (rec));
- else
- var_size = TYPE_SIZE (rec);
-
- nonvirtual_const_size = const_size;
-
- while (vbase_types)
- {
- tree basetype = BINFO_TYPE (vbase_types);
- tree offset;
-
- desired_align = TYPE_ALIGN (basetype);
- record_align = MAX (record_align, desired_align);
-
- if (const_size == 0)
- offset = integer_zero_node;
- else
- {
- /* Give each virtual base type the alignment it wants. */
- const_size = CEIL (const_size, TYPE_ALIGN (basetype))
- * TYPE_ALIGN (basetype);
- offset = size_int (CEIL (const_size, BITS_PER_UNIT));
- }
-
- if (CLASSTYPE_VSIZE (basetype) > max)
- max = CLASSTYPE_VSIZE (basetype);
- BINFO_OFFSET (vbase_types) = offset;
-
- if (TREE_CODE (TYPE_SIZE (basetype)) == INTEGER_CST)
- {
- /* Every virtual baseclass takes a least a UNIT, so that we can
- take it's address and get something different for each base. */
- const_size += MAX (BITS_PER_UNIT,
- TREE_INT_CST_LOW (TYPE_SIZE (basetype))
- - TREE_INT_CST_LOW (CLASSTYPE_VBASE_SIZE (basetype)));
- }
- else if (var_size == 0)
- var_size = TYPE_SIZE (basetype);
- else
- var_size = size_binop (PLUS_EXPR, var_size, TYPE_SIZE (basetype));
-
- vbase_types = TREE_CHAIN (vbase_types);
- }
-
- if (const_size)
- {
- /* Because a virtual base might take a single byte above,
- we have to re-adjust the total size to make sure it it
- a multiple of the alignment. */
- /* Give the whole object the alignment it wants. */
- const_size = CEIL (const_size, record_align) * record_align;
- }
-
- /* Set the alignment in the complete type. We don't set CLASSTYPE_ALIGN
- here, as that is for this class, without any virtual base classes. */
- TYPE_ALIGN (rec) = record_align;
- if (const_size != nonvirtual_const_size)
- {
- CLASSTYPE_VBASE_SIZE (rec)
- = size_int (const_size - nonvirtual_const_size);
- TYPE_SIZE (rec) = size_int (const_size);
- }
-
- /* Now propagate offset information throughout the lattice
- under the vbase type. */
- for (vbase_types = CLASSTYPE_VBASECLASSES (rec); vbase_types;
- vbase_types = TREE_CHAIN (vbase_types))
- {
- tree base_binfos = BINFO_BASETYPES (vbase_types);
-
- BINFO_INHERITANCE_CHAIN (vbase_types) = TYPE_BINFO (rec);
-
- if (base_binfos)
- {
- tree chain = NULL_TREE;
- int j;
- /* Now unshare the structure beneath BASE_BINFO. */
-
- for (j = TREE_VEC_LENGTH (base_binfos)-1;
- j >= 0; j--)
- {
- tree base_base_binfo = TREE_VEC_ELT (base_binfos, j);
- if (! TREE_VIA_VIRTUAL (base_base_binfo))
- TREE_VEC_ELT (base_binfos, j)
- = make_binfo (BINFO_OFFSET (base_base_binfo),
- base_base_binfo,
- BINFO_VTABLE (base_base_binfo),
- BINFO_VIRTUALS (base_base_binfo),
- chain);
- chain = TREE_VEC_ELT (base_binfos, j);
- TREE_VIA_PUBLIC (chain) = TREE_VIA_PUBLIC (base_base_binfo);
- TREE_VIA_PROTECTED (chain) = TREE_VIA_PROTECTED (base_base_binfo);
- BINFO_INHERITANCE_CHAIN (chain) = vbase_types;
- }
-
- propagate_binfo_offsets (vbase_types, BINFO_OFFSET (vbase_types));
- }
- }
-
- return max;
-}
-
-/* Lay out the base types of a record type, REC.
- Tentatively set the size and alignment of REC
- according to the base types alone.
-
- Offsets for immediate nonvirtual baseclasses are also computed here.
-
- TYPE_BINFO (REC) should be NULL_TREE on entry, and this routine
- creates a list of base_binfos in TYPE_BINFO (REC) from BINFOS.
-
- Returns list of virtual base classes in a FIELD_DECL chain. */
-
-tree
-layout_basetypes (rec, binfos)
- tree rec, binfos;
-{
- /* Chain to hold all the new FIELD_DECLs which point at virtual
- base classes. */
- tree vbase_decls = NULL_TREE;
-
-#ifdef STRUCTURE_SIZE_BOUNDARY
- unsigned record_align = MAX (STRUCTURE_SIZE_BOUNDARY, TYPE_ALIGN (rec));
-#else
- unsigned record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (rec));
-#endif
-
- /* Record size so far is CONST_SIZE + VAR_SIZE bits, where CONST_SIZE is
- an integer and VAR_SIZE is a tree expression. If VAR_SIZE is null,
- the size is just CONST_SIZE. Naturally we try to avoid using
- VAR_SIZE. And so far, we've been successful. */
-#if 0
- register tree var_size = 0;
-#endif
-
- register unsigned const_size = 0;
- int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- /* Handle basetypes almost like fields, but record their
- offsets differently. */
-
- for (i = 0; i < n_baseclasses; i++)
- {
- int inc, desired_align, int_vbase_size;
- register tree base_binfo = TREE_VEC_ELT (binfos, i);
- register tree basetype = BINFO_TYPE (base_binfo);
- tree decl, offset;
-
- if (TYPE_SIZE (basetype) == 0)
- {
-#if 0
- /* This error is now reported in xref_tag, thus giving better
- location information. */
- error_with_aggr_type (base_binfo,
- "base class `%s' has incomplete type");
-
- TREE_VIA_PUBLIC (base_binfo) = 1;
- TREE_VIA_PROTECTED (base_binfo) = 0;
- TREE_VIA_VIRTUAL (base_binfo) = 0;
-
- /* Should handle this better so that
-
- class A;
- class B: private A { virtual void F(); };
-
- does not dump core when compiled. */
- my_friendly_abort (121);
-#endif
- continue;
- }
-
- /* All basetypes are recorded in the association list of the
- derived type. */
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- {
- int j;
- char *name = (char *)alloca (TYPE_NAME_LENGTH (basetype)
- + sizeof (VBASE_NAME) + 1);
-
- /* The offset for a virtual base class is only used in computing
- virtual function tables and for initializing virtual base
- pointers. It is built once `get_vbase_types' is called. */
-
- /* If this basetype can come from another vbase pointer
- without an additional indirection, we will share
- that pointer. If an indirection is involved, we
- make our own pointer. */
- for (j = 0; j < n_baseclasses; j++)
- {
- tree other_base_binfo = TREE_VEC_ELT (binfos, j);
- if (! TREE_VIA_VIRTUAL (other_base_binfo)
- && binfo_member (basetype,
- CLASSTYPE_VBASECLASSES (BINFO_TYPE (other_base_binfo))))
- goto got_it;
- }
- sprintf (name, VBASE_NAME_FORMAT, TYPE_NAME_STRING (basetype));
- decl = build_lang_field_decl (FIELD_DECL, get_identifier (name),
- build_pointer_type (basetype));
- /* If you change any of the below, take a look at all the
- other VFIELD_BASEs and VTABLE_BASEs in the code, and change
- them too. */
- DECL_ASSEMBLER_NAME (decl) = get_identifier (VTABLE_BASE);
- DECL_VIRTUAL_P (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- DECL_FIELD_CONTEXT (decl) = rec;
- DECL_CLASS_CONTEXT (decl) = rec;
- DECL_FCONTEXT (decl) = basetype;
- DECL_SAVED_INSNS (decl) = NULL_RTX;
- DECL_FIELD_SIZE (decl) = 0;
- DECL_ALIGN (decl) = TYPE_ALIGN (ptr_type_node);
- TREE_CHAIN (decl) = vbase_decls;
- BINFO_VPTR_FIELD (base_binfo) = decl;
- vbase_decls = decl;
-
- if (warn_nonvdtor && TYPE_HAS_DESTRUCTOR (basetype)
- && DECL_VINDEX (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (basetype), 1)) == NULL_TREE)
- {
- warning_with_decl (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (basetype), 1),
- "destructor `%s' non-virtual");
- warning ("in inheritance relationship `%s: virtual %s'",
- TYPE_NAME_STRING (rec),
- TYPE_NAME_STRING (basetype));
- }
- got_it:
- /* The space this decl occupies has already been accounted for. */
- continue;
- }
-
- if (const_size == 0)
- offset = integer_zero_node;
- else
- {
- /* Give each base type the alignment it wants. */
- const_size = CEIL (const_size, TYPE_ALIGN (basetype))
- * TYPE_ALIGN (basetype);
- offset = size_int ((const_size + BITS_PER_UNIT - 1) / BITS_PER_UNIT);
-
-#if 0
- /* bpk: Disabled this check until someone is willing to
- claim it as theirs and explain exactly what circumstances
- warrant the warning. */
- if (warn_nonvdtor && TYPE_HAS_DESTRUCTOR (basetype)
- && DECL_VINDEX (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (basetype), 1)) == NULL_TREE)
- {
- warning_with_decl (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (basetype), 1),
- "destructor `%s' non-virtual");
- warning ("in inheritance relationship `%s:%s %s'",
- TYPE_NAME_STRING (rec),
- TREE_VIA_VIRTUAL (base_binfo) ? " virtual" : "",
- TYPE_NAME_STRING (basetype));
- }
-#endif
- }
- BINFO_OFFSET (base_binfo) = offset;
- if (CLASSTYPE_VSIZE (basetype))
- {
- BINFO_VTABLE (base_binfo) = TYPE_BINFO_VTABLE (basetype);
- BINFO_VIRTUALS (base_binfo) = TYPE_BINFO_VIRTUALS (basetype);
- }
- TREE_CHAIN (base_binfo) = TYPE_BINFO (rec);
- TYPE_BINFO (rec) = base_binfo;
-
- /* Add only the amount of storage not present in
- the virtual baseclasses. */
-
- int_vbase_size = TREE_INT_CST_LOW (CLASSTYPE_VBASE_SIZE (basetype));
- if (TREE_INT_CST_LOW (TYPE_SIZE (basetype)) > int_vbase_size)
- {
- inc = MAX (record_align,
- (TREE_INT_CST_LOW (TYPE_SIZE (basetype))
- - int_vbase_size));
-
- /* Record must have at least as much alignment as any field. */
- desired_align = TYPE_ALIGN (basetype);
- record_align = MAX (record_align, desired_align);
-
- const_size += inc;
- }
- }
-
- if (const_size)
- CLASSTYPE_SIZE (rec) = size_int (const_size);
- else
- CLASSTYPE_SIZE (rec) = integer_zero_node;
- CLASSTYPE_ALIGN (rec) = record_align;
-
- return vbase_decls;
-}
-
-/* Hashing of lists so that we don't make duplicates.
- The entry point is `list_hash_canon'. */
-
-/* Each hash table slot is a bucket containing a chain
- of these structures. */
-
-struct list_hash
-{
- struct list_hash *next; /* Next structure in the bucket. */
- int hashcode; /* Hash code of this list. */
- tree list; /* The list recorded here. */
-};
-
-/* Now here is the hash table. When recording a list, it is added
- to the slot whose index is the hash code mod the table size.
- Note that the hash table is used for several kinds of lists.
- While all these live in the same table, they are completely independent,
- and the hash code is computed differently for each of these. */
-
-#define TYPE_HASH_SIZE 59
-struct list_hash *list_hash_table[TYPE_HASH_SIZE];
-
-/* Compute a hash code for a list (chain of TREE_LIST nodes
- with goodies in the TREE_PURPOSE, TREE_VALUE, and bits of the
- TREE_COMMON slots), by adding the hash codes of the individual entries. */
-
-int
-list_hash (list)
- tree list;
-{
- register int hashcode = 0;
-
- if (TREE_CHAIN (list))
- hashcode += TYPE_HASH (TREE_CHAIN (list));
-
- if (TREE_VALUE (list))
- hashcode += TYPE_HASH (TREE_VALUE (list));
- else
- hashcode += 1007;
- if (TREE_PURPOSE (list))
- hashcode += TYPE_HASH (TREE_PURPOSE (list));
- else
- hashcode += 1009;
- return hashcode;
-}
-
-/* Look in the type hash table for a type isomorphic to TYPE.
- If one is found, return it. Otherwise return 0. */
-
-tree
-list_hash_lookup (hashcode, list)
- int hashcode;
- tree list;
-{
- register struct list_hash *h;
- for (h = list_hash_table[hashcode % TYPE_HASH_SIZE]; h; h = h->next)
- if (h->hashcode == hashcode
- && TREE_VIA_VIRTUAL (h->list) == TREE_VIA_VIRTUAL (list)
- && TREE_VIA_PUBLIC (h->list) == TREE_VIA_PUBLIC (list)
- && TREE_VIA_PROTECTED (h->list) == TREE_VIA_PROTECTED (list)
- && TREE_PURPOSE (h->list) == TREE_PURPOSE (list)
- && TREE_VALUE (h->list) == TREE_VALUE (list)
- && TREE_CHAIN (h->list) == TREE_CHAIN (list))
- {
- my_friendly_assert (TREE_TYPE (h->list) == TREE_TYPE (list), 299);
- return h->list;
- }
- return 0;
-}
-
-/* Add an entry to the list-hash-table
- for a list TYPE whose hash code is HASHCODE. */
-
-void
-list_hash_add (hashcode, list)
- int hashcode;
- tree list;
-{
- register struct list_hash *h;
-
- h = (struct list_hash *) obstack_alloc (&class_obstack, sizeof (struct list_hash));
- h->hashcode = hashcode;
- h->list = list;
- h->next = list_hash_table[hashcode % TYPE_HASH_SIZE];
- list_hash_table[hashcode % TYPE_HASH_SIZE] = h;
-}
-
-/* Given TYPE, and HASHCODE its hash code, return the canonical
- object for an identical list if one already exists.
- Otherwise, return TYPE, and record it as the canonical object
- if it is a permanent object.
-
- To use this function, first create a list of the sort you want.
- Then compute its hash code from the fields of the list that
- make it different from other similar lists.
- Then call this function and use the value.
- This function frees the list you pass in if it is a duplicate. */
-
-/* Set to 1 to debug without canonicalization. Never set by program. */
-
-static int debug_no_list_hash = 0;
-
-tree
-list_hash_canon (hashcode, list)
- int hashcode;
- tree list;
-{
- tree t1;
-
- if (debug_no_list_hash)
- return list;
-
- t1 = list_hash_lookup (hashcode, list);
- if (t1 != 0)
- {
- obstack_free (&class_obstack, list);
- return t1;
- }
-
- /* If this is a new list, record it for later reuse. */
- list_hash_add (hashcode, list);
-
- return list;
-}
-
-tree
-hash_tree_cons (via_public, via_virtual, via_protected, purpose, value, chain)
- int via_public, via_virtual, via_protected;
- tree purpose, value, chain;
-{
- struct obstack *ambient_obstack = current_obstack;
- tree t;
- int hashcode;
-
- current_obstack = &class_obstack;
- t = tree_cons (purpose, value, chain);
- TREE_VIA_PUBLIC (t) = via_public;
- TREE_VIA_PROTECTED (t) = via_protected;
- TREE_VIA_VIRTUAL (t) = via_virtual;
- hashcode = list_hash (t);
- t = list_hash_canon (hashcode, t);
- current_obstack = ambient_obstack;
- return t;
-}
-
-/* Constructor for hashed lists. */
-
-tree
-hash_tree_chain (value, chain)
- tree value, chain;
-{
- struct obstack *ambient_obstack = current_obstack;
- tree t;
- int hashcode;
-
- current_obstack = &class_obstack;
- t = tree_cons (NULL_TREE, value, chain);
- hashcode = list_hash (t);
- t = list_hash_canon (hashcode, t);
- current_obstack = ambient_obstack;
- return t;
-}
-
-/* Similar, but used for concatenating two lists. */
-
-tree
-hash_chainon (list1, list2)
- tree list1, list2;
-{
- if (list2 == 0)
- return list1;
- if (list1 == 0)
- return list2;
- if (TREE_CHAIN (list1) == NULL_TREE)
- return hash_tree_chain (TREE_VALUE (list1), list2);
- return hash_tree_chain (TREE_VALUE (list1),
- hash_chainon (TREE_CHAIN (list1), list2));
-}
-
-static tree
-get_identifier_list (value)
- tree value;
-{
- tree list = IDENTIFIER_AS_LIST (value);
- if (list != NULL_TREE
- && (TREE_CODE (list) != TREE_LIST
- || TREE_VALUE (list) != value))
- list = NULL_TREE;
- else if (IDENTIFIER_HAS_TYPE_VALUE (value)
- && TREE_CODE (IDENTIFIER_TYPE_VALUE (value)) == RECORD_TYPE
- && IDENTIFIER_TYPE_VALUE (value)
- == TYPE_MAIN_VARIANT (IDENTIFIER_TYPE_VALUE (value)))
- {
- tree type = IDENTIFIER_TYPE_VALUE (value);
-
- if (TYPE_PTRMEMFUNC_P (type))
- list = NULL_TREE;
- else if (type == current_class_type)
- /* Don't mess up the constructor name. */
- list = tree_cons (NULL_TREE, value, NULL_TREE);
- else
- {
- if (! CLASSTYPE_ID_AS_LIST (type))
- CLASSTYPE_ID_AS_LIST (type)
- = perm_tree_cons (NULL_TREE, TYPE_IDENTIFIER (type), NULL_TREE);
- list = CLASSTYPE_ID_AS_LIST (type);
- }
- }
- return list;
-}
-
-tree
-get_decl_list (value)
- tree value;
-{
- tree list = NULL_TREE;
-
- if (TREE_CODE (value) == IDENTIFIER_NODE)
- list = get_identifier_list (value);
- else if (TREE_CODE (value) == RECORD_TYPE
- && TYPE_LANG_SPECIFIC (value)
- && value == TYPE_MAIN_VARIANT (value))
- list = CLASSTYPE_AS_LIST (value);
-
- if (list != NULL_TREE)
- {
- my_friendly_assert (TREE_CHAIN (list) == NULL_TREE, 301);
- return list;
- }
-
- return build_decl_list (NULL_TREE, value);
-}
-
-/* Build an association between TYPE and some parameters:
-
- OFFSET is the offset added to `this' to convert it to a pointer
- of type `TYPE *'
-
- BINFO is the base binfo to use, if we are deriving from one. This
- is necessary, as we want specialized parent binfos from base
- classes, so that the VTABLE_NAMEs of bases are for the most derived
- type, instead of of the simple type.
-
- VTABLE is the virtual function table with which to initialize
- sub-objects of type TYPE.
-
- VIRTUALS are the virtual functions sitting in VTABLE.
-
- CHAIN are more associations we must retain. */
-
-tree
-make_binfo (offset, binfo, vtable, virtuals, chain)
- tree offset, binfo;
- tree vtable, virtuals;
- tree chain;
-{
- tree new_binfo = make_tree_vec (6);
- tree type;
-
- if (TREE_CODE (binfo) == TREE_VEC)
- type = BINFO_TYPE (binfo);
- else
- {
- type = binfo;
- binfo = TYPE_BINFO (binfo);
- }
-
- TREE_CHAIN (new_binfo) = chain;
- if (chain)
- TREE_USED (new_binfo) = TREE_USED (chain);
-
- TREE_TYPE (new_binfo) = TYPE_MAIN_VARIANT (type);
- BINFO_OFFSET (new_binfo) = offset;
- BINFO_VTABLE (new_binfo) = vtable;
- BINFO_VIRTUALS (new_binfo) = virtuals;
- BINFO_VPTR_FIELD (new_binfo) = NULL_TREE;
-
- if (binfo && BINFO_BASETYPES (binfo) != NULL_TREE)
- BINFO_BASETYPES (new_binfo) = copy_node (BINFO_BASETYPES (binfo));
- return new_binfo;
-}
-
-/* Return the binfo value for ELEM in TYPE. */
-
-tree
-binfo_value (elem, type)
- tree elem;
- tree type;
-{
- if (get_base_distance (elem, type, 0, (tree *)0) == -2)
- compiler_error ("base class `%s' ambiguous in binfo_value",
- TYPE_NAME_STRING (elem));
- if (elem == type)
- return TYPE_BINFO (type);
- if (TREE_CODE (elem) == RECORD_TYPE && TYPE_BINFO (elem) == type)
- return type;
- return get_binfo (elem, type, 0);
-}
-
-tree
-reverse_path (path)
- tree path;
-{
- register tree prev = 0, tmp, next;
- for (tmp = path; tmp; tmp = next)
- {
- next = BINFO_INHERITANCE_CHAIN (tmp);
- BINFO_INHERITANCE_CHAIN (tmp) = prev;
- prev = tmp;
- }
- return prev;
-}
-
-void
-debug_binfo (elem)
- tree elem;
-{
- unsigned HOST_WIDE_INT n;
- tree virtuals;
-
- fprintf (stderr, "type \"%s\"; offset = %d\n",
- TYPE_NAME_STRING (BINFO_TYPE (elem)),
- TREE_INT_CST_LOW (BINFO_OFFSET (elem)));
- fprintf (stderr, "vtable type:\n");
- debug_tree (BINFO_TYPE (elem));
- if (BINFO_VTABLE (elem))
- fprintf (stderr, "vtable decl \"%s\"\n", IDENTIFIER_POINTER (DECL_NAME (BINFO_VTABLE (elem))));
- else
- fprintf (stderr, "no vtable decl yet\n");
- fprintf (stderr, "virtuals:\n");
- virtuals = BINFO_VIRTUALS (elem);
-
- n = skip_rtti_stuff (&virtuals);
-
- while (virtuals)
- {
- tree fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0);
- fprintf (stderr, "%s [%d =? %d]\n",
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)),
- n, TREE_INT_CST_LOW (DECL_VINDEX (fndecl)));
- ++n;
- virtuals = TREE_CHAIN (virtuals);
- }
-}
-
-/* Return the length of a chain of nodes chained through DECL_CHAIN.
- We expect a null pointer to mark the end of the chain.
- This is the Lisp primitive `length'. */
-
-int
-decl_list_length (t)
- tree t;
-{
- register tree tail;
- register int len = 0;
-
- my_friendly_assert (TREE_CODE (t) == FUNCTION_DECL
- || TREE_CODE (t) == TEMPLATE_DECL, 300);
- for (tail = t; tail; tail = DECL_CHAIN (tail))
- len++;
-
- return len;
-}
-
-int
-count_functions (t)
- tree t;
-{
- if (TREE_CODE (t) == FUNCTION_DECL)
- return 1;
- else if (TREE_CODE (t) == TREE_LIST)
- return decl_list_length (TREE_VALUE (t));
-
- my_friendly_abort (359);
- return 0;
-}
-
-int
-is_overloaded_fn (x)
- tree x;
-{
- if (TREE_CODE (x) == FUNCTION_DECL)
- return 1;
-
- if (TREE_CODE (x) == TREE_LIST
- && (TREE_CODE (TREE_VALUE (x)) == FUNCTION_DECL
- || TREE_CODE (TREE_VALUE (x)) == TEMPLATE_DECL))
- return 1;
-
- return 0;
-}
-
-int
-really_overloaded_fn (x)
- tree x;
-{
- if (TREE_CODE (x) == TREE_LIST
- && (TREE_CODE (TREE_VALUE (x)) == FUNCTION_DECL
- || TREE_CODE (TREE_VALUE (x)) == TEMPLATE_DECL))
- return 1;
-
- return 0;
-}
-
-tree
-get_first_fn (from)
- tree from;
-{
- if (TREE_CODE (from) == FUNCTION_DECL)
- return from;
-
- my_friendly_assert (TREE_CODE (from) == TREE_LIST, 9);
-
- return TREE_VALUE (from);
-}
-
-int
-is_aggr_type_2 (t1, t2)
- tree t1, t2;
-{
- if (TREE_CODE (t1) != TREE_CODE (t2))
- return 0;
- return IS_AGGR_TYPE (t1) && IS_AGGR_TYPE (t2);
-}
-
-/* Give message using types TYPE1 and TYPE2 as arguments.
- PFN is the function which will print the message;
- S is the format string for PFN to use. */
-
-void
-message_2_types (pfn, s, type1, type2)
- void (*pfn) ();
- char *s;
- tree type1, type2;
-{
- tree name1 = TYPE_NAME (type1);
- tree name2 = TYPE_NAME (type2);
- if (TREE_CODE (name1) == TYPE_DECL)
- name1 = DECL_NAME (name1);
- if (TREE_CODE (name2) == TYPE_DECL)
- name2 = DECL_NAME (name2);
- (*pfn) (s, IDENTIFIER_POINTER (name1), IDENTIFIER_POINTER (name2));
-}
-
-#define PRINT_RING_SIZE 4
-
-char *
-lang_printable_name (decl, v)
- tree decl;
- int v;
-{
- static tree decl_ring[PRINT_RING_SIZE];
- static char *print_ring[PRINT_RING_SIZE];
- static int ring_counter;
- int i;
-
- /* Only cache functions. */
- if (v < 2
- || TREE_CODE (decl) != FUNCTION_DECL
- || DECL_LANG_SPECIFIC (decl) == 0)
- return lang_decl_name (decl, v);
-
- /* See if this print name is lying around. */
- for (i = 0; i < PRINT_RING_SIZE; i++)
- if (decl_ring[i] == decl)
- /* yes, so return it. */
- return print_ring[i];
-
- if (++ring_counter == PRINT_RING_SIZE)
- ring_counter = 0;
-
- if (current_function_decl != NULL_TREE)
- {
- if (decl_ring[ring_counter] == current_function_decl)
- ring_counter += 1;
- if (ring_counter == PRINT_RING_SIZE)
- ring_counter = 0;
- if (decl_ring[ring_counter] == current_function_decl)
- my_friendly_abort (106);
- }
-
- if (print_ring[ring_counter])
- free (print_ring[ring_counter]);
-
- print_ring[ring_counter] = xstrdup (lang_decl_name (decl, v));
- decl_ring[ring_counter] = decl;
- return print_ring[ring_counter];
-}
-
-/* Build the FUNCTION_TYPE or METHOD_TYPE which may throw exceptions
- listed in RAISES. */
-
-tree
-build_exception_variant (type, raises)
- tree type;
- tree raises;
-{
- tree v = TYPE_MAIN_VARIANT (type);
- int constp = TYPE_READONLY (type);
- int volatilep = TYPE_VOLATILE (type);
-
- for (; v; v = TYPE_NEXT_VARIANT (v))
- {
- if (TYPE_READONLY (v) != constp
- || TYPE_VOLATILE (v) != volatilep)
- continue;
-
- /* @@ This should do set equality, not exact match. */
- if (simple_cst_list_equal (TYPE_RAISES_EXCEPTIONS (v), raises))
- /* List of exceptions raised matches previously found list.
-
- @@ Nice to free up storage used in consing up the
- @@ list of exceptions raised. */
- return v;
- }
-
- /* Need to build a new variant. */
- v = build_type_copy (type);
-
- if (raises && ! TREE_PERMANENT (raises))
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- raises = copy_list (raises);
- pop_obstacks ();
- }
-
- TYPE_RAISES_EXCEPTIONS (v) = raises;
- return v;
-}
-
-/* Subroutine of copy_to_permanent
-
- Assuming T is a node build bottom-up, make it all exist on
- permanent obstack, if it is not permanent already. */
-
-tree
-mapcar (t, func)
- tree t;
- tree (*func)();
-{
- tree tmp;
-
- if (t == NULL_TREE)
- return t;
-
- if (tmp = func (t), tmp != NULL_TREE)
- return tmp;
-
- switch (TREE_CODE (t))
- {
- case ERROR_MARK:
- return error_mark_node;
-
- case VAR_DECL:
- case FUNCTION_DECL:
- case CONST_DECL:
- break;
-
- case PARM_DECL:
- {
- tree chain = TREE_CHAIN (t);
- t = copy_node (t);
- TREE_CHAIN (t) = mapcar (chain, func);
- TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
- DECL_INITIAL (t) = mapcar (DECL_INITIAL (t), func);
- DECL_SIZE (t) = mapcar (DECL_SIZE (t), func);
- return t;
- }
-
- case TREE_LIST:
- {
- tree chain = TREE_CHAIN (t);
- t = copy_node (t);
- TREE_PURPOSE (t) = mapcar (TREE_PURPOSE (t), func);
- TREE_VALUE (t) = mapcar (TREE_VALUE (t), func);
- TREE_CHAIN (t) = mapcar (chain, func);
- return t;
- }
-
- case TREE_VEC:
- {
- int len = TREE_VEC_LENGTH (t);
-
- t = copy_node (t);
- while (len--)
- TREE_VEC_ELT (t, len) = mapcar (TREE_VEC_ELT (t, len), func);
- return t;
- }
-
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- return copy_node (t);
-
- case COND_EXPR:
- case TARGET_EXPR:
- case NEW_EXPR:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
- TREE_OPERAND (t, 2) = mapcar (TREE_OPERAND (t, 2), func);
- return t;
-
- case SAVE_EXPR:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- return t;
-
- case MODIFY_EXPR:
- case PLUS_EXPR:
- case MINUS_EXPR:
- case MULT_EXPR:
- case TRUNC_DIV_EXPR:
- case TRUNC_MOD_EXPR:
- case MIN_EXPR:
- case MAX_EXPR:
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case LT_EXPR:
- case LE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case CEIL_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case ROUND_MOD_EXPR:
- case COMPOUND_EXPR:
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case CALL_EXPR:
- case ARRAY_REF:
- case SCOPE_REF:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
- return t;
-
- case CONVERT_EXPR:
- case ADDR_EXPR:
- case INDIRECT_REF:
- case NEGATE_EXPR:
- case BIT_NOT_EXPR:
- case TRUTH_NOT_EXPR:
- case NOP_EXPR:
- case COMPONENT_REF:
- t = copy_node (t);
- TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
- return t;
-
- case POINTER_TYPE:
- tmp = build_pointer_type (mapcar (TREE_TYPE (t), func));
- return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
- case REFERENCE_TYPE:
- tmp = build_reference_type (mapcar (TREE_TYPE (t), func));
- return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
- case FUNCTION_TYPE:
- tmp = build_function_type (mapcar (TREE_TYPE (t), func),
- mapcar (TYPE_ARG_TYPES (t), func));
- return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
- case ARRAY_TYPE:
- tmp = build_cplus_array_type (mapcar (TREE_TYPE (t), func),
- mapcar (TYPE_DOMAIN (t), func));
- return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
- case INTEGER_TYPE:
- tmp = build_index_type (mapcar (TYPE_MAX_VALUE (t), func));
- return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
- case OFFSET_TYPE:
- tmp = build_offset_type (mapcar (TYPE_OFFSET_BASETYPE (t), func),
- mapcar (TREE_TYPE (t), func));
- return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
- case METHOD_TYPE:
- tmp = build_cplus_method_type
- (mapcar (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))), func),
- mapcar (TREE_TYPE (t), func),
- mapcar (TREE_CHAIN (TYPE_ARG_TYPES (t)), func));
- return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
-
- case CONSTRUCTOR:
- t = copy_node (t);
- CONSTRUCTOR_ELTS (t) = mapcar (CONSTRUCTOR_ELTS (t), func);
- return t;
-
- case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_P (t))
- return build_ptrmemfunc_type
- (mapcar (TYPE_PTRMEMFUNC_FN_TYPE (t), func));
- /* else fall through */
-
- /* This list is incomplete, but should suffice for now.
- It is very important that `sorry' not call
- `report_error_function'. That could cause an infinite loop. */
- default:
- sorry ("initializer contains unrecognized tree code");
- return error_mark_node;
-
- }
- my_friendly_abort (107);
- /* NOTREACHED */
- return NULL_TREE;
-}
-
-static tree
-perm_manip (t)
- tree t;
-{
- if (TREE_PERMANENT (t))
- return t;
- /* Support `void f () { extern int i; A<&i> a; }' */
- if ((TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == FUNCTION_DECL)
- && TREE_PUBLIC (t))
- return copy_node (t);
- return NULL_TREE;
-}
-
-/* Assuming T is a node built bottom-up, make it all exist on
- permanent obstack, if it is not permanent already. */
-
-tree
-copy_to_permanent (t)
- tree t;
-{
- register struct obstack *ambient_obstack = current_obstack;
- register struct obstack *ambient_saveable_obstack = saveable_obstack;
- register struct obstack *ambient_expression_obstack = expression_obstack;
-
- if (t == NULL_TREE || TREE_PERMANENT (t))
- return t;
-
- saveable_obstack = &permanent_obstack;
- current_obstack = saveable_obstack;
- expression_obstack = saveable_obstack;
-
- t = mapcar (t, perm_manip);
-
- current_obstack = ambient_obstack;
- saveable_obstack = ambient_saveable_obstack;
- expression_obstack = ambient_expression_obstack;
-
- return t;
-}
-
-#ifdef GATHER_STATISTICS
-extern int depth_reached;
-#endif
-
-void
-print_lang_statistics ()
-{
- extern struct obstack maybepermanent_obstack, decl_obstack;
- print_obstack_statistics ("class_obstack", &class_obstack);
- print_obstack_statistics ("decl_obstack", &decl_obstack);
- print_obstack_statistics ("permanent_obstack", &permanent_obstack);
- print_obstack_statistics ("maybepermanent_obstack", &maybepermanent_obstack);
- print_search_statistics ();
- print_class_statistics ();
-#ifdef GATHER_STATISTICS
- fprintf (stderr, "maximum template instantiation depth reached: %d\n",
- depth_reached);
-#endif
-}
-
-/* This is used by the `assert' macro. It is provided in libgcc.a,
- which `cc' doesn't know how to link. Note that the C++ front-end
- no longer actually uses the `assert' macro (instead, it calls
- my_friendly_assert). But all of the back-end files still need this. */
-
-void
-__eprintf (string, expression, line, filename)
-#ifdef __STDC__
- const char *string;
- const char *expression;
- unsigned line;
- const char *filename;
-#else
- char *string;
- char *expression;
- unsigned line;
- char *filename;
-#endif
-{
- fprintf (stderr, string, expression, line, filename);
- fflush (stderr);
- abort ();
-}
-
-/* Return, as an INTEGER_CST node, the number of elements for TYPE
- (which is an ARRAY_TYPE). This counts only elements of the top
- array. */
-
-tree
-array_type_nelts_top (type)
- tree type;
-{
- return fold (build (PLUS_EXPR, sizetype,
- array_type_nelts (type),
- integer_one_node));
-}
-
-/* Return, as an INTEGER_CST node, the number of elements for TYPE
- (which is an ARRAY_TYPE). This one is a recursive count of all
- ARRAY_TYPEs that are clumped together. */
-
-tree
-array_type_nelts_total (type)
- tree type;
-{
- tree sz = array_type_nelts_top (type);
- type = TREE_TYPE (type);
- while (TREE_CODE (type) == ARRAY_TYPE)
- {
- tree n = array_type_nelts_top (type);
- sz = fold (build (MULT_EXPR, sizetype, sz, n));
- type = TREE_TYPE (type);
- }
- return sz;
-}
-
-static
-tree
-bot_manip (t)
- tree t;
-{
- if (TREE_CODE (t) != TREE_LIST && ! TREE_SIDE_EFFECTS (t))
- return t;
- else if (TREE_CODE (t) == TARGET_EXPR)
- {
- if (TREE_CODE (TREE_OPERAND (t, 1)) == NEW_EXPR)
- {
- mark_used (TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (t, 1), 0), 0));
- return build_cplus_new
- (TREE_TYPE (t), break_out_target_exprs (TREE_OPERAND (t, 1)));
- }
- t = copy_node (t);
- TREE_OPERAND (t, 0) = build (VAR_DECL, TREE_TYPE (t));
- layout_decl (TREE_OPERAND (t, 0), 0);
- return t;
- }
- else if (TREE_CODE (t) == CALL_EXPR)
- mark_used (TREE_OPERAND (TREE_OPERAND (t, 0), 0));
-
- return NULL_TREE;
-}
-
-/* Actually, we'll just clean out the target exprs for the moment. */
-
-tree
-break_out_target_exprs (t)
- tree t;
-{
- return mapcar (t, bot_manip);
-}
-
-/* Obstack used for allocating nodes in template function and variable
- definitions. */
-
-extern struct obstack *expression_obstack;
-
-/* Similar to `build_nt', except we build
- on the permanent_obstack, regardless. */
-
-tree
-build_min_nt VPROTO((enum tree_code code, ...))
-{
-#ifndef __STDC__
- enum tree_code code;
-#endif
- register struct obstack *ambient_obstack = expression_obstack;
- va_list p;
- register tree t;
- register int length;
- register int i;
-
- VA_START (p, code);
-
-#ifndef __STDC__
- code = va_arg (p, enum tree_code);
-#endif
-
- expression_obstack = &permanent_obstack;
-
- t = make_node (code);
- length = tree_code_length[(int) code];
- TREE_COMPLEXITY (t) = lineno;
-
- for (i = 0; i < length; i++)
- {
- tree x = va_arg (p, tree);
- TREE_OPERAND (t, i) = copy_to_permanent (x);
- }
-
- va_end (p);
- expression_obstack = ambient_obstack;
- return t;
-}
-
-/* Similar to `build', except we build
- on the permanent_obstack, regardless. */
-
-tree
-build_min VPROTO((enum tree_code code, tree tt, ...))
-{
-#ifndef __STDC__
- enum tree_code code;
- tree tt;
-#endif
- register struct obstack *ambient_obstack = expression_obstack;
- va_list p;
- register tree t;
- register int length;
- register int i;
-
- VA_START (p, tt);
-
-#ifndef __STDC__
- code = va_arg (p, enum tree_code);
- tt = va_arg (p, tree);
-#endif
-
- expression_obstack = &permanent_obstack;
-
- t = make_node (code);
- length = tree_code_length[(int) code];
- TREE_TYPE (t) = tt;
- TREE_COMPLEXITY (t) = lineno;
-
- for (i = 0; i < length; i++)
- {
- tree x = va_arg (p, tree);
- TREE_OPERAND (t, i) = copy_to_permanent (x);
- }
-
- va_end (p);
- expression_obstack = ambient_obstack;
- return t;
-}
-
-/* Same as `tree_cons' but make a permanent object. */
-
-tree
-min_tree_cons (purpose, value, chain)
- tree purpose, value, chain;
-{
- register tree node;
- register struct obstack *ambient_obstack = current_obstack;
- current_obstack = &permanent_obstack;
-
- node = tree_cons (copy_to_permanent (purpose),
- copy_to_permanent (value), chain);
- current_obstack = ambient_obstack;
- return node;
-}
-
-tree
-get_type_decl (t)
- tree t;
-{
- if (TREE_CODE (t) == IDENTIFIER_NODE)
- return identifier_typedecl_value (t);
- if (TREE_CODE (t) == TYPE_DECL)
- return t;
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
- return TYPE_STUB_DECL (t);
-
- my_friendly_abort (42);
-}
-
-int
-can_free (obstack, t)
- struct obstack *obstack;
- tree t;
-{
- int size;
-
- if (TREE_CODE (t) == TREE_VEC)
- size = (TREE_VEC_LENGTH (t)-1) * sizeof (tree) + sizeof (struct tree_vec);
- else
- my_friendly_abort (42);
-
-#define ROUND(x) ((x + obstack_alignment_mask (obstack)) \
- & ~ obstack_alignment_mask (obstack))
- if ((char *)t + ROUND (size) == obstack_next_free (obstack))
- return 1;
-#undef ROUND
-
- return 0;
-}
-
-/* Return first vector element whose BINFO_TYPE is ELEM.
- Return 0 if ELEM is not in VEC. VEC may be NULL_TREE. */
-
-tree
-vec_binfo_member (elem, vec)
- tree elem, vec;
-{
- int i;
-
- if (vec)
- for (i = 0; i < TREE_VEC_LENGTH (vec); ++i)
- if (comptypes (elem, BINFO_TYPE (TREE_VEC_ELT (vec, i)), 1))
- return TREE_VEC_ELT (vec, i);
-
- return NULL_TREE;
-}
-
-/* Kludge around the fact that DECL_CONTEXT for virtual functions returns
- the wrong thing for decl_function_context. Hopefully the uses in the
- backend won't matter, since we don't need a static chain for local class
- methods. FIXME! */
-
-tree
-hack_decl_function_context (decl)
- tree decl;
-{
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (decl))
- return decl_function_context (TYPE_MAIN_DECL (DECL_CLASS_CONTEXT (decl)));
- return decl_function_context (decl);
-}
-
-/* Return truthvalue of whether T1 is the same tree structure as T2.
- Return 1 if they are the same.
- Return 0 if they are understandably different.
- Return -1 if either contains tree structure not understood by
- this function. */
-
-int
-cp_tree_equal (t1, t2)
- tree t1, t2;
-{
- register enum tree_code code1, code2;
- int cmp;
-
- if (t1 == t2)
- return 1;
- if (t1 == 0 || t2 == 0)
- return 0;
-
- code1 = TREE_CODE (t1);
- code2 = TREE_CODE (t2);
-
- if (code1 == NOP_EXPR || code1 == CONVERT_EXPR || code1 == NON_LVALUE_EXPR)
- if (code2 == NOP_EXPR || code2 == CONVERT_EXPR || code2 == NON_LVALUE_EXPR)
- return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- else
- return cp_tree_equal (TREE_OPERAND (t1, 0), t2);
- else if (code2 == NOP_EXPR || code2 == CONVERT_EXPR
- || code2 == NON_LVALUE_EXPR)
- return cp_tree_equal (t1, TREE_OPERAND (t2, 0));
-
- if (code1 != code2)
- return 0;
-
- switch (code1)
- {
- case INTEGER_CST:
- return TREE_INT_CST_LOW (t1) == TREE_INT_CST_LOW (t2)
- && TREE_INT_CST_HIGH (t1) == TREE_INT_CST_HIGH (t2);
-
- case REAL_CST:
- return REAL_VALUES_EQUAL (TREE_REAL_CST (t1), TREE_REAL_CST (t2));
-
- case STRING_CST:
- return TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2)
- && !bcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2),
- TREE_STRING_LENGTH (t1));
-
- case CONSTRUCTOR:
- abort ();
-
- case SAVE_EXPR:
- return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
-
- case CALL_EXPR:
- cmp = cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- if (cmp <= 0)
- return cmp;
- return simple_cst_list_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
-
- case TARGET_EXPR:
- /* Special case: if either target is an unallocated VAR_DECL,
- it means that it's going to be unified with whatever the
- TARGET_EXPR is really supposed to initialize, so treat it
- as being equivalent to anything. */
- if ((TREE_CODE (TREE_OPERAND (t1, 0)) == VAR_DECL
- && DECL_NAME (TREE_OPERAND (t1, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t1, 0)) == 0)
- || (TREE_CODE (TREE_OPERAND (t2, 0)) == VAR_DECL
- && DECL_NAME (TREE_OPERAND (t2, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t2, 0)) == 0))
- cmp = 1;
- else
- cmp = cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- if (cmp <= 0)
- return cmp;
- return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
-
- case WITH_CLEANUP_EXPR:
- cmp = cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- if (cmp <= 0)
- return cmp;
- return cp_tree_equal (TREE_OPERAND (t1, 2), TREE_OPERAND (t1, 2));
-
- case COMPONENT_REF:
- if (TREE_OPERAND (t1, 1) == TREE_OPERAND (t2, 1))
- return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- return 0;
-
- case VAR_DECL:
- case PARM_DECL:
- case CONST_DECL:
- case FUNCTION_DECL:
- return 0;
-
- case TEMPLATE_CONST_PARM:
- return TEMPLATE_CONST_IDX (t1) == TEMPLATE_CONST_IDX (t2);
-
- case SIZEOF_EXPR:
- if (TREE_CODE (TREE_OPERAND (t1, 0)) != TREE_CODE (TREE_OPERAND (t2, 0)))
- return 0;
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t1, 0))) == 't')
- return comptypes (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0), 1);
- break;
- }
-
- switch (TREE_CODE_CLASS (code1))
- {
- int i;
- case '1':
- case '2':
- case '<':
- case 'e':
- case 'r':
- case 's':
- cmp = 1;
- for (i=0; i<tree_code_length[(int) code1]; ++i)
- {
- cmp = cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
- if (cmp <= 0)
- return cmp;
- }
- return cmp;
- }
-
- return -1;
-}
-
-/* Similar to make_tree_vec, but build on a temporary obstack. */
-
-tree
-make_temp_vec (len)
- int len;
-{
- register tree node;
- push_obstacks_nochange ();
- resume_temporary_allocation ();
- node = make_tree_vec (len);
- pop_obstacks ();
- return node;
-}
-
-/* The type of ARG when used as an lvalue. */
-
-tree
-lvalue_type (arg)
- tree arg;
-{
- return cp_build_type_variant
- (TREE_TYPE (arg), TREE_READONLY (arg), TREE_THIS_VOLATILE (arg));
-}
-
-/* The type of ARG for printing error messages; denote lvalues with
- reference types. */
-
-tree
-error_type (arg)
- tree arg;
-{
- tree type = TREE_TYPE (arg);
- if (TREE_CODE (type) == ARRAY_TYPE)
- ;
- else if (real_lvalue_p (arg))
- type = build_reference_type (lvalue_type (arg));
- else if (IS_AGGR_TYPE (type))
- type = lvalue_type (arg);
-
- return type;
-}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
deleted file mode 100644
index a734c01344a..00000000000
--- a/gcc/cp/typeck.c
+++ /dev/null
@@ -1,7437 +0,0 @@
-/* Build expressions with type checking for C++ compiler.
- Copyright (C) 1987, 88, 89, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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 file is part of the C++ front end.
- It contains routines to build C++ expressions given their operands,
- including computing the types of the result, C and C++ specific error
- checks, and some optimization.
-
- There are also routines to build RETURN_STMT nodes and CASE_STMT nodes,
- and to process initializations in declarations (since they work
- like a strange sort of assignment). */
-
-extern void error ();
-extern void warning ();
-
-#include "config.h"
-#include <stdio.h>
-#include "tree.h"
-#include "rtl.h"
-#include "cp-tree.h"
-#include "flags.h"
-#include "output.h"
-
-int mark_addressable PROTO((tree));
-static tree convert_for_assignment PROTO((tree, tree, char*, tree, int));
-/* static */ tree convert_for_initialization PROTO((tree, tree, tree, int, char*, tree, int));
-extern tree shorten_compare ();
-static tree pointer_int_sum PROTO((enum tree_code, register tree, register tree));
-static tree pointer_diff PROTO((register tree, register tree));
-static int comp_target_parms PROTO((tree, tree, int));
-static int comp_ptr_ttypes_const PROTO((tree, tree));
-static int comp_ptr_ttypes_reinterpret PROTO((tree, tree));
-#if 0
-static tree convert_sequence ();
-#endif
-/* static */ tree unary_complex_lvalue PROTO((enum tree_code, tree));
-static tree get_delta_difference PROTO((tree, tree, int));
-
-/* Return the target type of TYPE, which meas return T for:
- T*, T&, T[], T (...), and otherwise, just T. */
-
-tree
-target_type (type)
- tree type;
-{
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
- while (TREE_CODE (type) == POINTER_TYPE
- || TREE_CODE (type) == ARRAY_TYPE
- || TREE_CODE (type) == FUNCTION_TYPE
- || TREE_CODE (type) == METHOD_TYPE
- || TREE_CODE (type) == OFFSET_TYPE)
- type = TREE_TYPE (type);
- return type;
-}
-
-/* Do `exp = require_complete_type (exp);' to make sure exp
- does not have an incomplete type. (That includes void types.) */
-
-tree
-require_complete_type (value)
- tree value;
-{
- tree type;
-
- if (processing_template_decl)
- return value;
-
- type = TREE_TYPE (value);
-
- /* First, detect a valid value with a complete type. */
- if (TYPE_SIZE (type) != 0
- && type != void_type_node
- && ! (TYPE_LANG_SPECIFIC (type)
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type))
- && TYPE_SIZE (SIGNATURE_TYPE (type)) == 0))
- return value;
-
- /* If we see X::Y, we build an OFFSET_TYPE which has
- not been laid out. Try to avoid an error by interpreting
- it as this->X::Y, if reasonable. */
- if (TREE_CODE (value) == OFFSET_REF
- && current_class_ref != 0
- && TREE_OPERAND (value, 0) == current_class_ref)
- {
- tree base, member = TREE_OPERAND (value, 1);
- tree basetype = TYPE_OFFSET_BASETYPE (type);
- my_friendly_assert (TREE_CODE (member) == FIELD_DECL, 305);
- base = convert_pointer_to (basetype, current_class_ptr);
- value = build (COMPONENT_REF, TREE_TYPE (member),
- build_indirect_ref (base, NULL_PTR), member);
- return require_complete_type (value);
- }
-
- if (IS_AGGR_TYPE (type) && CLASSTYPE_TEMPLATE_INSTANTIATION (type))
- {
- instantiate_class_template (TYPE_MAIN_VARIANT (type));
- if (TYPE_SIZE (type) != 0)
- return value;
- }
-
- incomplete_type_error (value, type);
- return error_mark_node;
-}
-
-tree
-complete_type (type)
- tree type;
-{
- if (type == error_mark_node || TYPE_SIZE (type) != NULL_TREE)
- ;
- else if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type))
- {
- tree t = complete_type (TREE_TYPE (type));
- if (TYPE_SIZE (t) != NULL_TREE && ! processing_template_decl)
- layout_type (type);
- TYPE_NEEDS_CONSTRUCTING (type)
- = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (t));
- TYPE_NEEDS_DESTRUCTOR (type)
- = TYPE_NEEDS_DESTRUCTOR (TYPE_MAIN_VARIANT (t));
- }
- else if (IS_AGGR_TYPE (type) && CLASSTYPE_TEMPLATE_INSTANTIATION (type))
- instantiate_class_template (TYPE_MAIN_VARIANT (type));
-
- return type;
-}
-
-/* Return truthvalue of whether type of EXP is instantiated. */
-
-int
-type_unknown_p (exp)
- tree exp;
-{
- return (TREE_CODE (exp) == TREE_LIST
- || TREE_TYPE (exp) == unknown_type_node
- || (TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE
- && TREE_TYPE (TREE_TYPE (exp)) == unknown_type_node));
-}
-
-/* Return truthvalue of whether T is function (or pfn) type. */
-
-int
-fntype_p (t)
- tree t;
-{
- return (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE
- || (TREE_CODE (t) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE)));
-}
-
-/* Do `exp = require_instantiated_type (type, exp);' to make sure EXP
- does not have an uninstantiated type.
- TYPE is type to instantiate with, if uninstantiated. */
-
-tree
-require_instantiated_type (type, exp, errval)
- tree type, exp, errval;
-{
- if (TREE_TYPE (exp) == NULL_TREE)
- {
- error ("argument list may not have an initializer list");
- return errval;
- }
-
- if (TREE_TYPE (exp) == unknown_type_node
- || (TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE
- && TREE_TYPE (TREE_TYPE (exp)) == unknown_type_node))
- {
- exp = instantiate_type (type, exp, 1);
- if (TREE_TYPE (exp) == error_mark_node)
- return errval;
- }
- return exp;
-}
-
-/* Return a variant of TYPE which has all the type qualifiers of LIKE
- as well as those of TYPE. */
-
-static tree
-qualify_type (type, like)
- tree type, like;
-{
- int constflag = TYPE_READONLY (type) || TYPE_READONLY (like);
- int volflag = TYPE_VOLATILE (type) || TYPE_VOLATILE (like);
- /* @@ Must do member pointers here. */
- return cp_build_type_variant (type, constflag, volflag);
-}
-
-/* Return the common type of two parameter lists.
- We assume that comptypes has already been done and returned 1;
- if that isn't so, this may crash.
-
- As an optimization, free the space we allocate if the parameter
- lists are already common. */
-
-tree
-commonparms (p1, p2)
- tree p1, p2;
-{
- tree oldargs = p1, newargs, n;
- int i, len;
- int any_change = 0;
- char *first_obj = (char *) oballoc (0);
-
- len = list_length (p1);
- newargs = tree_last (p1);
-
- if (newargs == void_list_node)
- i = 1;
- else
- {
- i = 0;
- newargs = 0;
- }
-
- for (; i < len; i++)
- newargs = tree_cons (NULL_TREE, NULL_TREE, newargs);
-
- n = newargs;
-
- for (i = 0; p1;
- p1 = TREE_CHAIN (p1), p2 = TREE_CHAIN (p2), n = TREE_CHAIN (n), i++)
- {
- if (TREE_PURPOSE (p1) && !TREE_PURPOSE (p2))
- {
- TREE_PURPOSE (n) = TREE_PURPOSE (p1);
- any_change = 1;
- }
- else if (! TREE_PURPOSE (p1))
- {
- if (TREE_PURPOSE (p2))
- {
- TREE_PURPOSE (n) = TREE_PURPOSE (p2);
- any_change = 1;
- }
- }
- else
- {
- if (1 != simple_cst_equal (TREE_PURPOSE (p1), TREE_PURPOSE (p2)))
- any_change = 1;
- TREE_PURPOSE (n) = TREE_PURPOSE (p2);
- }
- if (TREE_VALUE (p1) != TREE_VALUE (p2))
- {
- any_change = 1;
- TREE_VALUE (n) = common_type (TREE_VALUE (p1), TREE_VALUE (p2));
- }
- else
- TREE_VALUE (n) = TREE_VALUE (p1);
- }
- if (! any_change)
- {
- obfree (first_obj);
- return oldargs;
- }
-
- return newargs;
-}
-
-/* Return the common type of two types.
- We assume that comptypes has already been done and returned 1;
- if that isn't so, this may crash.
-
- This is the type for the result of most arithmetic operations
- if the operands have the given two types.
-
- We do not deal with enumeral types here because they have already been
- converted to integer types. */
-
-tree
-common_type (t1, t2)
- tree t1, t2;
-{
- register enum tree_code code1;
- register enum tree_code code2;
- tree attributes;
-
- /* Save time if the two types are the same. */
-
- if (t1 == t2) return t1;
-
- /* If one type is nonsense, use the other. */
- if (t1 == error_mark_node)
- return t2;
- if (t2 == error_mark_node)
- return t1;
-
- /* Merge the attributes */
-
- { register tree a1, a2;
- a1 = TYPE_ATTRIBUTES (t1);
- a2 = TYPE_ATTRIBUTES (t2);
-
- /* Either one unset? Take the set one. */
-
- if (!(attributes = a1))
- attributes = a2;
-
- /* One that completely contains the other? Take it. */
-
- else if (a2 && !attribute_list_contained (a1, a2))
- if (attribute_list_contained (a2, a1))
- attributes = a2;
- else
- {
- /* Pick the longest list, and hang on the other list. */
- /* ??? For the moment we punt on the issue of attrs with args. */
-
- if (list_length (a1) < list_length (a2))
- attributes = a2, a2 = a1;
-
- for (; a2; a2 = TREE_CHAIN (a2))
- if (lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (a2)),
- attributes) == NULL_TREE)
- {
- a1 = copy_node (a2);
- TREE_CHAIN (a1) = attributes;
- attributes = a1;
- }
- }
- }
-
- /* Treat an enum type as the unsigned integer type of the same width. */
-
- if (TREE_CODE (t1) == ENUMERAL_TYPE)
- t1 = type_for_size (TYPE_PRECISION (t1), 1);
- if (TREE_CODE (t2) == ENUMERAL_TYPE)
- t2 = type_for_size (TYPE_PRECISION (t2), 1);
-
- if (TYPE_PTRMEMFUNC_P (t1))
- t1 = TYPE_PTRMEMFUNC_FN_TYPE (t1);
- if (TYPE_PTRMEMFUNC_P (t2))
- t2 = TYPE_PTRMEMFUNC_FN_TYPE (t2);
-
- code1 = TREE_CODE (t1);
- code2 = TREE_CODE (t2);
-
- switch (code1)
- {
- case INTEGER_TYPE:
- case REAL_TYPE:
- /* If only one is real, use it as the result. */
-
- if (code1 == REAL_TYPE && code2 != REAL_TYPE)
- return build_type_attribute_variant (t1, attributes);
-
- if (code2 == REAL_TYPE && code1 != REAL_TYPE)
- return build_type_attribute_variant (t2, attributes);
-
- /* Both real or both integers; use the one with greater precision. */
-
- if (TYPE_PRECISION (t1) > TYPE_PRECISION (t2))
- return build_type_attribute_variant (t1, attributes);
- else if (TYPE_PRECISION (t2) > TYPE_PRECISION (t1))
- return build_type_attribute_variant (t2, attributes);
-
- /* Same precision. Prefer longs to ints even when same size. */
-
- if (TYPE_MAIN_VARIANT (t1) == long_unsigned_type_node
- || TYPE_MAIN_VARIANT (t2) == long_unsigned_type_node)
- return build_type_attribute_variant (long_unsigned_type_node,
- attributes);
-
- if (TYPE_MAIN_VARIANT (t1) == long_integer_type_node
- || TYPE_MAIN_VARIANT (t2) == long_integer_type_node)
- {
- /* But preserve unsignedness from the other type,
- since long cannot hold all the values of an unsigned int. */
- if (TREE_UNSIGNED (t1) || TREE_UNSIGNED (t2))
- t1 = long_unsigned_type_node;
- else
- t1 = long_integer_type_node;
- return build_type_attribute_variant (t1, attributes);
- }
-
- if (TYPE_MAIN_VARIANT (t1) == long_double_type_node
- || TYPE_MAIN_VARIANT (t2) == long_double_type_node)
- return build_type_attribute_variant (long_double_type_node,
- attributes);
-
- /* Otherwise prefer the unsigned one. */
-
- if (TREE_UNSIGNED (t1))
- return build_type_attribute_variant (t1, attributes);
- else
- return build_type_attribute_variant (t2, attributes);
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- /* For two pointers, do this recursively on the target type,
- and combine the qualifiers of the two types' targets. */
- /* This code was turned off; I don't know why.
- But ANSI C++ specifies doing this with the qualifiers.
- So I turned it on again. */
- {
- tree tt1 = TYPE_MAIN_VARIANT (TREE_TYPE (t1));
- tree tt2 = TYPE_MAIN_VARIANT (TREE_TYPE (t2));
- int constp
- = TYPE_READONLY (TREE_TYPE (t1)) || TYPE_READONLY (TREE_TYPE (t2));
- int volatilep
- = TYPE_VOLATILE (TREE_TYPE (t1)) || TYPE_VOLATILE (TREE_TYPE (t2));
- tree target;
-
- if (tt1 == tt2)
- target = tt1;
- else if (tt1 == void_type_node || tt2 == void_type_node)
- target = void_type_node;
- else
- target = common_type (tt1, tt2);
-
- target = cp_build_type_variant (target, constp, volatilep);
- if (code1 == POINTER_TYPE)
- t1 = build_pointer_type (target);
- else
- t1 = build_reference_type (target);
- t1 = build_type_attribute_variant (t1, attributes);
-
- if (TREE_CODE (target) == METHOD_TYPE)
- t1 = build_ptrmemfunc_type (t1);
-
- return t1;
- }
-
- case ARRAY_TYPE:
- {
- tree elt = common_type (TREE_TYPE (t1), TREE_TYPE (t2));
- /* Save space: see if the result is identical to one of the args. */
- if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1))
- return build_type_attribute_variant (t1, attributes);
- if (elt == TREE_TYPE (t2) && TYPE_DOMAIN (t2))
- return build_type_attribute_variant (t2, attributes);
- /* Merge the element types, and have a size if either arg has one. */
- t1 = build_cplus_array_type
- (elt, TYPE_DOMAIN (TYPE_DOMAIN (t1) ? t1 : t2));
- return build_type_attribute_variant (t1, attributes);
- }
-
- case FUNCTION_TYPE:
- /* Function types: prefer the one that specified arg types.
- If both do, merge the arg types. Also merge the return types. */
- {
- tree valtype = common_type (TREE_TYPE (t1), TREE_TYPE (t2));
- tree p1 = TYPE_ARG_TYPES (t1);
- tree p2 = TYPE_ARG_TYPES (t2);
- tree rval, raises;
-
- /* Save space: see if the result is identical to one of the args. */
- if (valtype == TREE_TYPE (t1) && ! p2)
- return build_type_attribute_variant (t1, attributes);
- if (valtype == TREE_TYPE (t2) && ! p1)
- return build_type_attribute_variant (t2, attributes);
-
- /* Simple way if one arg fails to specify argument types. */
- if (p1 == NULL_TREE || TREE_VALUE (p1) == void_type_node)
- {
- rval = build_function_type (valtype, p2);
- if ((raises = TYPE_RAISES_EXCEPTIONS (t2)))
- rval = build_exception_variant (rval, raises);
- return build_type_attribute_variant (rval, attributes);
- }
- raises = TYPE_RAISES_EXCEPTIONS (t1);
- if (p2 == NULL_TREE || TREE_VALUE (p2) == void_type_node)
- {
- rval = build_function_type (valtype, p1);
- if (raises)
- rval = build_exception_variant (rval, raises);
- return build_type_attribute_variant (rval, attributes);
- }
-
- rval = build_function_type (valtype, commonparms (p1, p2));
- rval = build_exception_variant (rval, raises);
- return build_type_attribute_variant (rval, attributes);
- }
-
- case RECORD_TYPE:
- case UNION_TYPE:
- my_friendly_assert (TYPE_MAIN_VARIANT (t1) == t1
- && TYPE_MAIN_VARIANT (t2) == t2, 306);
-
- if (DERIVED_FROM_P (t1, t2) && binfo_or_else (t1, t2))
- return build_type_attribute_variant (t1, attributes);
- else if (binfo_or_else (t2, t1))
- return build_type_attribute_variant (t2, attributes);
- else
- compiler_error ("common_type called with uncommon aggregate types");
-
- case METHOD_TYPE:
- if (TREE_CODE (TREE_TYPE (t1)) == TREE_CODE (TREE_TYPE (t2)))
- {
- /* Get this value the long way, since TYPE_METHOD_BASETYPE
- is just the main variant of this. */
- tree basetype;
- tree raises, t3;
-
- tree b1 = TYPE_OFFSET_BASETYPE (t1);
- tree b2 = TYPE_OFFSET_BASETYPE (t2);
-
- if (comptypes (b1, b2, 1)
- || (DERIVED_FROM_P (b1, b2) && binfo_or_else (b1, b2)))
- basetype = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t2)));
- else
- {
- if (binfo_or_else (b2, b1) == NULL_TREE)
- compiler_error ("common_type called with uncommon method types");
- basetype = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t1)));
- }
-
- raises = TYPE_RAISES_EXCEPTIONS (t1);
-
- /* If this was a member function type, get back to the
- original type of type member function (i.e., without
- the class instance variable up front. */
- t1 = build_function_type (TREE_TYPE (t1), TREE_CHAIN (TYPE_ARG_TYPES (t1)));
- t2 = build_function_type (TREE_TYPE (t2), TREE_CHAIN (TYPE_ARG_TYPES (t2)));
- t3 = common_type (t1, t2);
- t3 = build_cplus_method_type (basetype, TREE_TYPE (t3), TYPE_ARG_TYPES (t3));
- t1 = build_exception_variant (t3, raises);
- }
- else
- compiler_error ("common_type called with uncommon method types");
-
- return build_type_attribute_variant (t1, attributes);
-
- case OFFSET_TYPE:
- if (TREE_TYPE (t1) == TREE_TYPE (t2))
- {
- tree b1 = TYPE_OFFSET_BASETYPE (t1);
- tree b2 = TYPE_OFFSET_BASETYPE (t2);
-
- if (comptypes (b1, b2, 1)
- || (DERIVED_FROM_P (b1, b2) && binfo_or_else (b1, b2)))
- return build_type_attribute_variant (t2, attributes);
- else if (binfo_or_else (b2, b1))
- return build_type_attribute_variant (t1, attributes);
- }
- compiler_error ("common_type called with uncommon member types");
-
- default:
- return build_type_attribute_variant (t1, attributes);
- }
-}
-
-/* Return 1 if TYPE1 and TYPE2 raise the same exceptions. */
-
-int
-compexcepttypes (t1, t2)
- tree t1, t2;
-{
- return TYPE_RAISES_EXCEPTIONS (t1) == TYPE_RAISES_EXCEPTIONS (t2);
-}
-
-static int
-comp_array_types (cmp, t1, t2, strict)
- register int (*cmp)();
- tree t1, t2;
- int strict;
-{
- tree d1 = TYPE_DOMAIN (t1);
- tree d2 = TYPE_DOMAIN (t2);
-
- /* Target types must match incl. qualifiers. */
- if (!(TREE_TYPE (t1) == TREE_TYPE (t2)
- || (*cmp) (TREE_TYPE (t1), TREE_TYPE (t2), strict)))
- return 0;
-
- /* Sizes must match unless one is missing or variable. */
- if (d1 == 0 || d2 == 0 || d1 == d2
- || TREE_CODE (TYPE_MIN_VALUE (d1)) != INTEGER_CST
- || TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST
- || TREE_CODE (TYPE_MAX_VALUE (d1)) != INTEGER_CST
- || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST)
- return 1;
-
- return ((TREE_INT_CST_LOW (TYPE_MIN_VALUE (d1))
- == TREE_INT_CST_LOW (TYPE_MIN_VALUE (d2)))
- && (TREE_INT_CST_HIGH (TYPE_MIN_VALUE (d1))
- == TREE_INT_CST_HIGH (TYPE_MIN_VALUE (d2)))
- && (TREE_INT_CST_LOW (TYPE_MAX_VALUE (d1))
- == TREE_INT_CST_LOW (TYPE_MAX_VALUE (d2)))
- && (TREE_INT_CST_HIGH (TYPE_MAX_VALUE (d1))
- == TREE_INT_CST_HIGH (TYPE_MAX_VALUE (d2))));
-}
-
-/* Return 1 if TYPE1 and TYPE2 are compatible types for assignment
- or various other operations. This is what ANSI C++ speaks of as
- "being the same".
-
- For C++: argument STRICT says we should be strict about this
- comparison:
-
- 2 : strict, except that if one type is a reference and
- the other is not, compare the target type of the
- reference to the type that's not a reference (ARM, p308).
- This is used for checking for invalid overloading.
- 1 : strict (compared according to ANSI C)
- This is used for checking whether two function decls match.
- 0 : <= (compared according to C++)
- -1: <= or >= (relaxed)
-
- Otherwise, pointers involving base classes and derived classes
- can be mixed as valid: i.e. a pointer to a base class may be assigned
- to a pointer to one of its derived classes, as per C++. A pointer to
- a derived class may be passed as a parameter to a function expecting a
- pointer to a base classes. These allowances do not commute. In this
- case, TYPE1 is assumed to be the base class, and TYPE2 is assumed to
- be the derived class. */
-
-int
-comptypes (type1, type2, strict)
- tree type1, type2;
- int strict;
-{
- register tree t1 = type1;
- register tree t2 = type2;
- int attrval, val;
-
- /* Suppress errors caused by previously reported errors */
-
- if (t1 == t2)
- return 1;
-
- /* This should never happen. */
- my_friendly_assert (t1 != error_mark_node, 307);
-
- if (t2 == error_mark_node)
- return 0;
-
- if (strict < 0)
- {
- /* Treat an enum type as the unsigned integer type of the same width. */
-
- if (TREE_CODE (t1) == ENUMERAL_TYPE)
- t1 = type_for_size (TYPE_PRECISION (t1), 1);
- if (TREE_CODE (t2) == ENUMERAL_TYPE)
- t2 = type_for_size (TYPE_PRECISION (t2), 1);
-
- if (t1 == t2)
- return 1;
- }
-
- if (TYPE_PTRMEMFUNC_P (t1))
- t1 = TYPE_PTRMEMFUNC_FN_TYPE (t1);
- if (TYPE_PTRMEMFUNC_P (t2))
- t2 = TYPE_PTRMEMFUNC_FN_TYPE (t2);
-
- /* Different classes of types can't be compatible. */
-
- if (TREE_CODE (t1) != TREE_CODE (t2))
- {
- if (strict == 2
- && ((TREE_CODE (t1) == REFERENCE_TYPE)
- ^ (TREE_CODE (t2) == REFERENCE_TYPE)))
- {
- if (TREE_CODE (t1) == REFERENCE_TYPE)
- return comptypes (TREE_TYPE (t1), t2, 1);
- return comptypes (t1, TREE_TYPE (t2), 1);
- }
-
- return 0;
- }
- if (strict > 1)
- strict = 1;
-
- /* Qualifiers must match. */
-
- if (TYPE_READONLY (t1) != TYPE_READONLY (t2))
- return 0;
- if (TYPE_VOLATILE (t1) != TYPE_VOLATILE (t2))
- return 0;
-
- /* Allow for two different type nodes which have essentially the same
- definition. Note that we already checked for equality of the type
- type qualifiers (just above). */
-
- if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
- return 1;
-
- /* ??? COMP_TYPE_ATTRIBUTES is currently useless for variables as each
- attribute is its own main variant (`val' will remain 0). */
-#ifndef COMP_TYPE_ATTRIBUTES
-#define COMP_TYPE_ATTRIBUTES(t1,t2) 1
-#endif
-
- /* 1 if no need for warning yet, 2 if warning cause has been seen. */
- if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2)))
- return 0;
-
- /* 1 if no need for warning yet, 2 if warning cause has been seen. */
- val = 0;
-
- switch (TREE_CODE (t1))
- {
- case RECORD_TYPE:
- case UNION_TYPE:
- if (CLASSTYPE_TEMPLATE_INFO (t1) && CLASSTYPE_TEMPLATE_INFO (t2)
- && CLASSTYPE_TI_TEMPLATE (t1) == CLASSTYPE_TI_TEMPLATE (t2))
- {
- int i = TREE_VEC_LENGTH (CLASSTYPE_TI_ARGS (t1));
- tree *p1 = &TREE_VEC_ELT (CLASSTYPE_TI_ARGS (t1), 0);
- tree *p2 = &TREE_VEC_ELT (CLASSTYPE_TI_ARGS (t2), 0);
-
- while (i--)
- {
- if (TREE_CODE_CLASS (TREE_CODE (p1[i])) == 't')
- {
- if (! comptypes (p1[i], p2[i], 1))
- return 0;
- }
- else
- {
- if (simple_cst_equal (p1[i], p2[i]) <= 0)
- return 0;
- }
- }
- return 1;
- }
- if (strict <= 0)
- goto look_hard;
- return 0;
-
- case OFFSET_TYPE:
- val = (comptypes (build_pointer_type (TYPE_OFFSET_BASETYPE (t1)),
- build_pointer_type (TYPE_OFFSET_BASETYPE (t2)), strict)
- && comptypes (TREE_TYPE (t1), TREE_TYPE (t2), strict));
- break;
-
- case METHOD_TYPE:
- if (! compexcepttypes (t1, t2))
- return 0;
-
- /* This case is anti-symmetrical!
- One can pass a base member (or member function)
- to something expecting a derived member (or member function),
- but not vice-versa! */
-
- val = (comptypes (TREE_TYPE (t1), TREE_TYPE (t2), strict)
- && compparms (TYPE_ARG_TYPES (t1),
- TYPE_ARG_TYPES (t2), strict));
- break;
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- t1 = TREE_TYPE (t1);
- t2 = TREE_TYPE (t2);
- if (t1 == t2)
- {
- val = 1;
- break;
- }
- if (strict <= 0)
- {
- if (TREE_CODE (t1) == RECORD_TYPE && TREE_CODE (t2) == RECORD_TYPE)
- {
- int rval;
- look_hard:
- rval = t1 == t2 || DERIVED_FROM_P (t1, t2);
-
- if (rval)
- {
- val = 1;
- break;
- }
- if (strict < 0)
- {
- val = DERIVED_FROM_P (t2, t1);
- break;
- }
- }
- return 0;
- }
- else
- val = comptypes (t1, t2, strict);
- break;
-
- case FUNCTION_TYPE:
- if (! compexcepttypes (t1, t2))
- return 0;
-
- val = ((TREE_TYPE (t1) == TREE_TYPE (t2)
- || comptypes (TREE_TYPE (t1), TREE_TYPE (t2), strict))
- && compparms (TYPE_ARG_TYPES (t1), TYPE_ARG_TYPES (t2), strict));
- break;
-
- case ARRAY_TYPE:
- /* Target types must match incl. qualifiers. */
- val = comp_array_types (comptypes, t1, t2, strict);
- break;
-
- case TEMPLATE_TYPE_PARM:
- return TEMPLATE_TYPE_IDX (t1) == TEMPLATE_TYPE_IDX (t2);
-
- case TYPENAME_TYPE:
- if (TYPE_IDENTIFIER (t1) != TYPE_IDENTIFIER (t2))
- return 0;
- return comptypes (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2), 1);
- }
- return attrval == 2 && val == 1 ? 2 : val;
-}
-
-/* Return 1 if TTL and TTR are pointers to types that are equivalent,
- ignoring their qualifiers.
-
- NPTRS is the number of pointers we can strip off and keep cool.
- This is used to permit (for aggr A, aggr B) A, B* to convert to A*,
- but to not permit B** to convert to A**. */
-
-int
-comp_target_types (ttl, ttr, nptrs)
- tree ttl, ttr;
- int nptrs;
-{
- ttl = TYPE_MAIN_VARIANT (ttl);
- ttr = TYPE_MAIN_VARIANT (ttr);
- if (ttl == ttr)
- return 1;
-
- if (TREE_CODE (ttr) != TREE_CODE (ttl))
- return 0;
-
- if (TREE_CODE (ttr) == POINTER_TYPE)
- {
- ttl = TREE_TYPE (ttl);
- ttr = TREE_TYPE (ttr);
-
- if (nptrs > 0)
- {
- if (TREE_CODE (ttl) == VOID_TYPE
- && TREE_CODE (ttr) != FUNCTION_TYPE
- && TREE_CODE (ttr) != METHOD_TYPE
- && TREE_CODE (ttr) != OFFSET_TYPE)
- return 1;
- else if (TREE_CODE (ttr) == VOID_TYPE
- && TREE_CODE (ttl) != FUNCTION_TYPE
- && TREE_CODE (ttl) != METHOD_TYPE
- && TREE_CODE (ttl) != OFFSET_TYPE)
- return -1;
- else if (TREE_CODE (ttl) == POINTER_TYPE
- || TREE_CODE (ttl) == ARRAY_TYPE)
- {
- if (comp_ptr_ttypes (ttl, ttr))
- return 1;
- else if (comp_ptr_ttypes (ttr, ttl))
- return -1;
- return 0;
- }
- }
-
- /* Const and volatile mean something different for function types,
- so the usual checks are not appropriate. */
- if (TREE_CODE (ttl) == FUNCTION_TYPE || TREE_CODE (ttl) == METHOD_TYPE)
- return comp_target_types (ttl, ttr, nptrs - 1);
-
- /* Make sure that the cv-quals change only in the same direction as
- the target type. */
- {
- int t;
- int c = TYPE_READONLY (ttl) - TYPE_READONLY (ttr);
- int v = TYPE_VOLATILE (ttl) - TYPE_VOLATILE (ttr);
-
- if ((c > 0 && v < 0) || (c < 0 && v > 0))
- return 0;
-
- if (TYPE_MAIN_VARIANT (ttl) == TYPE_MAIN_VARIANT (ttr))
- return (c + v < 0) ? -1 : 1;
-
- t = comp_target_types (ttl, ttr, nptrs - 1);
- if ((t == 1 && c + v >= 0) || (t == -1 && c + v <= 0))
- return t;
-
- return 0;
- }
- }
-
- if (TREE_CODE (ttr) == REFERENCE_TYPE)
- return comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), nptrs);
- if (TREE_CODE (ttr) == ARRAY_TYPE)
- return comp_array_types (comp_target_types, ttl, ttr, 0);
- else if (TREE_CODE (ttr) == FUNCTION_TYPE || TREE_CODE (ttr) == METHOD_TYPE)
- if (comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), nptrs))
- switch (comp_target_parms (TYPE_ARG_TYPES (ttl), TYPE_ARG_TYPES (ttr), 1))
- {
- case 0:
- return 0;
- case 1:
- return 1;
- case 2:
- return -1;
- default:
- my_friendly_abort (112);
- }
- else
- return 0;
-
- /* for C++ */
- else if (TREE_CODE (ttr) == OFFSET_TYPE)
- {
- /* Contravariance: we can assign a pointer to base member to a pointer
- to derived member. Note difference from simple pointer case, where
- we can pass a pointer to derived to a pointer to base. */
- if (comptypes (TYPE_OFFSET_BASETYPE (ttr), TYPE_OFFSET_BASETYPE (ttl), 0))
- return comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), nptrs);
- else if (comptypes (TYPE_OFFSET_BASETYPE (ttl), TYPE_OFFSET_BASETYPE (ttr), 0)
- && comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), nptrs))
- return -1;
- }
- else if (IS_AGGR_TYPE (ttl))
- {
- if (nptrs < 0)
- return 0;
- if (comptypes (build_pointer_type (ttl), build_pointer_type (ttr), 0))
- return 1;
- if (comptypes (build_pointer_type (ttr), build_pointer_type (ttl), 0))
- return -1;
- return 0;
- }
-
- return 0;
-}
-
-/* If two types share a common base type, return that basetype.
- If there is not a unique most-derived base type, this function
- returns ERROR_MARK_NODE. */
-
-static tree
-common_base_type (tt1, tt2)
- tree tt1, tt2;
-{
- tree best = NULL_TREE;
- int i;
-
- /* If one is a baseclass of another, that's good enough. */
- if (UNIQUELY_DERIVED_FROM_P (tt1, tt2))
- return tt1;
- if (UNIQUELY_DERIVED_FROM_P (tt2, tt1))
- return tt2;
-
- /* Otherwise, try to find a unique baseclass of TT1
- that is shared by TT2, and follow that down. */
- for (i = CLASSTYPE_N_BASECLASSES (tt1)-1; i >= 0; i--)
- {
- tree basetype = TYPE_BINFO_BASETYPE (tt1, i);
- tree trial = common_base_type (basetype, tt2);
- if (trial)
- {
- if (trial == error_mark_node)
- return trial;
- if (best == NULL_TREE)
- best = trial;
- else if (best != trial)
- return error_mark_node;
- }
- }
-
- /* Same for TT2. */
- for (i = CLASSTYPE_N_BASECLASSES (tt2)-1; i >= 0; i--)
- {
- tree basetype = TYPE_BINFO_BASETYPE (tt2, i);
- tree trial = common_base_type (tt1, basetype);
- if (trial)
- {
- if (trial == error_mark_node)
- return trial;
- if (best == NULL_TREE)
- best = trial;
- else if (best != trial)
- return error_mark_node;
- }
- }
- return best;
-}
-
-/* Subroutines of `comptypes'. */
-
-/* Return 1 if two parameter type lists PARMS1 and PARMS2
- are equivalent in the sense that functions with those parameter types
- can have equivalent types.
- If either list is empty, we win.
- Otherwise, the two lists must be equivalent, element by element.
-
- C++: See comment above about TYPE1, TYPE2, STRICT.
- If STRICT == 3, it means checking is strict, but do not compare
- default parameter values. */
-
-int
-compparms (parms1, parms2, strict)
- tree parms1, parms2;
- int strict;
-{
- register tree t1 = parms1, t2 = parms2;
-
- /* An unspecified parmlist matches any specified parmlist
- whose argument types don't need default promotions. */
-
- if (strict <= 0 && t1 == 0)
- return self_promoting_args_p (t2);
- if (strict < 0 && t2 == 0)
- return self_promoting_args_p (t1);
-
- while (1)
- {
- if (t1 == 0 && t2 == 0)
- return 1;
- /* If one parmlist is shorter than the other,
- they fail to match, unless STRICT is <= 0. */
- if (t1 == 0 || t2 == 0)
- {
- if (strict > 0)
- return 0;
- if (strict < 0)
- return 1;
- if (strict == 0)
- return t1 && TREE_PURPOSE (t1);
- }
- if (! comptypes (TREE_VALUE (t2), TREE_VALUE (t1), strict))
- {
- if (strict > 0)
- return 0;
- if (strict == 0)
- return t2 == void_list_node && TREE_PURPOSE (t1);
- return TREE_PURPOSE (t1) || TREE_PURPOSE (t2);
- }
-
- t1 = TREE_CHAIN (t1);
- t2 = TREE_CHAIN (t2);
- }
-}
-
-/* This really wants return whether or not parameter type lists
- would make their owning functions assignment compatible or not. */
-
-static int
-comp_target_parms (parms1, parms2, strict)
- tree parms1, parms2;
- int strict;
-{
- register tree t1 = parms1, t2 = parms2;
- int warn_contravariance = 0;
-
- /* An unspecified parmlist matches any specified parmlist
- whose argument types don't need default promotions.
- @@@ see 13.3.3 for a counterexample... */
-
- if (t1 == 0 && t2 != 0)
- {
- cp_pedwarn ("ANSI C++ prohibits conversion from `(%#T)' to `(...)'",
- parms2);
- return self_promoting_args_p (t2);
- }
- if (t2 == 0)
- return self_promoting_args_p (t1);
-
- for (; t1 || t2; t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2))
- {
- tree p1, p2;
-
- /* If one parmlist is shorter than the other,
- they fail to match, unless STRICT is <= 0. */
- if (t1 == 0 || t2 == 0)
- {
- if (strict > 0)
- return 0;
- if (strict < 0)
- return 1 + warn_contravariance;
- return ((t1 && TREE_PURPOSE (t1)) + warn_contravariance);
- }
- p1 = TREE_VALUE (t1);
- p2 = TREE_VALUE (t2);
- if (p1 == p2)
- continue;
-
- if ((TREE_CODE (p1) == POINTER_TYPE && TREE_CODE (p2) == POINTER_TYPE)
- || (TREE_CODE (p1) == REFERENCE_TYPE && TREE_CODE (p2) == REFERENCE_TYPE))
- {
- if (strict <= 0
- && (TYPE_MAIN_VARIANT (TREE_TYPE (p1))
- == TYPE_MAIN_VARIANT (TREE_TYPE (p2))))
- continue;
-
- /* The following is wrong for contravariance,
- but many programs depend on it. */
- if (TREE_TYPE (p1) == void_type_node)
- continue;
- if (TREE_TYPE (p2) == void_type_node)
- {
- warn_contravariance = 1;
- continue;
- }
- if (IS_AGGR_TYPE (TREE_TYPE (p1)))
- {
- if (comptypes (p2, p1, 0) == 0)
- {
- if (comptypes (p1, p2, 0) != 0)
- warn_contravariance = 1;
- else
- return 0;
- }
- continue;
- }
- }
- /* Note backwards order due to contravariance. */
- if (comp_target_types (p2, p1, 1) == 0)
- {
- if (comp_target_types (p1, p2, 1))
- {
- warn_contravariance = 1;
- continue;
- }
- if (strict != 0)
- return 0;
- }
- /* Target types are compatible--just make sure that if
- we use parameter lists, that they are ok as well. */
- if (TREE_CODE (p1) == FUNCTION_TYPE || TREE_CODE (p1) == METHOD_TYPE)
- switch (comp_target_parms (TYPE_ARG_TYPES (p1),
- TYPE_ARG_TYPES (p2),
- strict))
- {
- case 0:
- return 0;
- case 1:
- break;
- case 2:
- warn_contravariance = 1;
- }
-
- if (TREE_PURPOSE (t1) && TREE_PURPOSE (t2))
- {
- int cmp = simple_cst_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2));
- if (cmp < 0)
- my_friendly_abort (114);
- if (cmp == 0)
- return 0;
- }
- }
- return 1 + warn_contravariance;
-}
-
-/* Return 1 if PARMS specifies a fixed number of parameters
- and none of their types is affected by default promotions. */
-
-int
-self_promoting_args_p (parms)
- tree parms;
-{
- register tree t;
- for (t = parms; t; t = TREE_CHAIN (t))
- {
- register tree type = TREE_VALUE (t);
-
- if (TREE_CHAIN (t) == 0 && type != void_type_node)
- return 0;
-
- if (type == 0)
- return 0;
-
- if (TYPE_MAIN_VARIANT (type) == float_type_node)
- return 0;
-
- if (C_PROMOTING_INTEGER_TYPE_P (type))
- return 0;
- }
- return 1;
-}
-
-/* Return an unsigned type the same as TYPE in other respects.
-
- C++: must make these work for type variants as well. */
-
-tree
-unsigned_type (type)
- tree type;
-{
- tree type1 = TYPE_MAIN_VARIANT (type);
- if (type1 == signed_char_type_node || type1 == char_type_node)
- return unsigned_char_type_node;
- if (type1 == integer_type_node)
- return unsigned_type_node;
- if (type1 == short_integer_type_node)
- return short_unsigned_type_node;
- if (type1 == long_integer_type_node)
- return long_unsigned_type_node;
- if (type1 == long_long_integer_type_node)
- return long_long_unsigned_type_node;
- if (type1 == intDI_type_node)
- return unsigned_intDI_type_node;
- if (type1 == intSI_type_node)
- return unsigned_intSI_type_node;
- if (type1 == intHI_type_node)
- return unsigned_intHI_type_node;
- if (type1 == intQI_type_node)
- return unsigned_intQI_type_node;
-
- return signed_or_unsigned_type (1, type);
-}
-
-/* Return a signed type the same as TYPE in other respects. */
-
-tree
-signed_type (type)
- tree type;
-{
- tree type1 = TYPE_MAIN_VARIANT (type);
- if (type1 == unsigned_char_type_node || type1 == char_type_node)
- return signed_char_type_node;
- if (type1 == unsigned_type_node)
- return integer_type_node;
- if (type1 == short_unsigned_type_node)
- return short_integer_type_node;
- if (type1 == long_unsigned_type_node)
- return long_integer_type_node;
- if (type1 == long_long_unsigned_type_node)
- return long_long_integer_type_node;
- if (type1 == unsigned_intDI_type_node)
- return intDI_type_node;
- if (type1 == unsigned_intSI_type_node)
- return intSI_type_node;
- if (type1 == unsigned_intHI_type_node)
- return intHI_type_node;
- if (type1 == unsigned_intQI_type_node)
- return intQI_type_node;
-
- return signed_or_unsigned_type (0, type);
-}
-
-/* Return a type the same as TYPE except unsigned or
- signed according to UNSIGNEDP. */
-
-tree
-signed_or_unsigned_type (unsignedp, type)
- int unsignedp;
- tree type;
-{
- if (! INTEGRAL_TYPE_P (type)
- || TREE_UNSIGNED (type) == unsignedp)
- return type;
-
- if (TYPE_PRECISION (type) == TYPE_PRECISION (signed_char_type_node))
- return unsignedp ? unsigned_char_type_node : signed_char_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
- return unsignedp ? unsigned_type_node : integer_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (short_integer_type_node))
- return unsignedp ? short_unsigned_type_node : short_integer_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (long_integer_type_node))
- return unsignedp ? long_unsigned_type_node : long_integer_type_node;
- if (TYPE_PRECISION (type) == TYPE_PRECISION (long_long_integer_type_node))
- return (unsignedp ? long_long_unsigned_type_node
- : long_long_integer_type_node);
- return type;
-}
-
-/* Compute the value of the `sizeof' operator. */
-
-tree
-c_sizeof (type)
- tree type;
-{
- enum tree_code code = TREE_CODE (type);
- tree t;
-
- if (processing_template_decl)
- return build_min (SIZEOF_EXPR, sizetype, type);
-
- if (code == FUNCTION_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids taking the sizeof a function type");
- return size_int (1);
- }
- if (code == METHOD_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids taking the sizeof a method type");
- return size_int (1);
- }
- if (code == VOID_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids taking the sizeof a void type");
- return size_int (1);
- }
- if (code == ERROR_MARK)
- return size_int (1);
-
- /* ARM $5.3.2: ``When applied to a reference, the result is the size of the
- referenced object.'' */
- if (code == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- /* We couldn't find anything in the ARM or the draft standard that says,
- one way or the other, if doing sizeof on something that doesn't have
- an object associated with it is correct or incorrect. For example, if
- you declare `struct S { char str[16]; };', and in your program do
- a `sizeof (S::str)', should we flag that as an error or should we give
- the size of it? Since it seems like a reasonable thing to do, we'll go
- with giving the value. */
- if (code == OFFSET_TYPE)
- type = TREE_TYPE (type);
-
- /* @@ This also produces an error for a signature ref.
- In that case we should be able to do better. */
- if (IS_SIGNATURE (type))
- {
- error ("`sizeof' applied to a signature type");
- return size_int (0);
- }
-
- if (TYPE_SIZE (complete_type (type)) == 0)
- {
- cp_error ("`sizeof' applied to incomplete type `%T'", type);
- return size_int (0);
- }
-
- /* Convert in case a char is more than one unit. */
- t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
- size_int (TYPE_PRECISION (char_type_node)));
- /* size_binop does not put the constant in range, so do it now. */
- if (TREE_CODE (t) == INTEGER_CST && force_fit_type (t, 0))
- TREE_CONSTANT_OVERFLOW (t) = TREE_OVERFLOW (t) = 1;
- return t;
-}
-
-tree
-expr_sizeof (e)
- tree e;
-{
- if (processing_template_decl)
- return build_min (SIZEOF_EXPR, sizetype, e);
-
- if (TREE_CODE (e) == COMPONENT_REF
- && DECL_BIT_FIELD (TREE_OPERAND (e, 1)))
- error ("sizeof applied to a bit-field");
- /* ANSI says arrays and functions are converted inside comma.
- But we can't really convert them in build_compound_expr
- because that would break commas in lvalues.
- So do the conversion here if operand was a comma. */
- if (TREE_CODE (e) == COMPOUND_EXPR
- && (TREE_CODE (TREE_TYPE (e)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (e)) == FUNCTION_TYPE))
- e = default_conversion (e);
- else if (TREE_CODE (e) == TREE_LIST)
- {
- tree t = TREE_VALUE (e);
- if (t != NULL_TREE
- && ((TREE_TYPE (t)
- && TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
- || is_overloaded_fn (t)))
- pedwarn ("ANSI C++ forbids taking the sizeof a function type");
- }
- return c_sizeof (TREE_TYPE (e));
-}
-
-tree
-c_sizeof_nowarn (type)
- tree type;
-{
- enum tree_code code = TREE_CODE (type);
- tree t;
-
- if (code == FUNCTION_TYPE
- || code == METHOD_TYPE
- || code == VOID_TYPE
- || code == ERROR_MARK)
- return size_int (1);
- if (code == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- if (TYPE_SIZE (type) == 0)
- return size_int (0);
-
- /* Convert in case a char is more than one unit. */
- t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
- size_int (TYPE_PRECISION (char_type_node)));
- force_fit_type (t, 0);
- return t;
-}
-
-/* Implement the __alignof keyword: Return the minimum required
- alignment of TYPE, measured in bytes. */
-
-tree
-c_alignof (type)
- tree type;
-{
- enum tree_code code = TREE_CODE (type);
- tree t;
-
- if (code == FUNCTION_TYPE || code == METHOD_TYPE)
- return size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);
-
- if (code == VOID_TYPE || code == ERROR_MARK)
- return size_int (1);
-
- /* C++: this is really correct! */
- if (code == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- /* @@ This also produces an error for a signature ref.
- In that case we should be able to do better. */
- if (IS_SIGNATURE (type))
- {
- error ("`__alignof' applied to a signature type");
- return size_int (1);
- }
-
- t = size_int (TYPE_ALIGN (type) / BITS_PER_UNIT);
- force_fit_type (t, 0);
- return t;
-}
-
-/* Perform default promotions for C data used in expressions.
- Arrays and functions are converted to pointers;
- enumeral types or short or char, to int.
- In addition, manifest constants symbols are replaced by their values.
-
- C++: this will automatically bash references to their target type. */
-
-tree
-decay_conversion (exp)
- tree exp;
-{
- register tree type = TREE_TYPE (exp);
- register enum tree_code code = TREE_CODE (type);
-
- if (code == OFFSET_TYPE)
- {
- if (TREE_CODE (exp) == OFFSET_REF)
- return decay_conversion (resolve_offset_ref (exp));
-
- type = TREE_TYPE (type);
- code = TREE_CODE (type);
-
- if (type == unknown_type_node)
- {
- cp_pedwarn ("assuming & on overloaded member function");
- return build_unary_op (ADDR_EXPR, exp, 0);
- }
- }
-
- if (code == REFERENCE_TYPE)
- {
- exp = convert_from_reference (exp);
- type = TREE_TYPE (exp);
- code = TREE_CODE (type);
- }
-
- /* Constants can be used directly unless they're not loadable. */
- if (TREE_CODE (exp) == CONST_DECL)
- exp = DECL_INITIAL (exp);
- /* Replace a nonvolatile const static variable with its value. */
- else if (TREE_READONLY_DECL_P (exp))
- {
- exp = decl_constant_value (exp);
- type = TREE_TYPE (exp);
- }
-
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Leave such NOP_EXPRs, since RHS is being used in non-lvalue context. */
-
- if (code == VOID_TYPE)
- {
- error ("void value not ignored as it ought to be");
- return error_mark_node;
- }
- if (code == FUNCTION_TYPE)
- {
- return build_unary_op (ADDR_EXPR, exp, 0);
- }
- if (code == METHOD_TYPE)
- {
- cp_pedwarn ("assuming & on `%E'", exp);
- return build_unary_op (ADDR_EXPR, exp, 0);
- }
- if (code == ARRAY_TYPE)
- {
- register tree adr;
- tree restype;
- tree ptrtype;
- int constp, volatilep;
-
- if (TREE_CODE (exp) == INDIRECT_REF)
- {
- /* Stripping away the INDIRECT_REF is not the right
- thing to do for references... */
- tree inner = TREE_OPERAND (exp, 0);
- if (TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE)
- {
- inner = build1 (CONVERT_EXPR,
- build_pointer_type (TREE_TYPE (TREE_TYPE (inner))),
- inner);
- TREE_REFERENCE_EXPR (inner) = 1;
- }
- return convert (build_pointer_type (TREE_TYPE (type)), inner);
- }
-
- if (TREE_CODE (exp) == COMPOUND_EXPR)
- {
- tree op1 = decay_conversion (TREE_OPERAND (exp, 1));
- return build (COMPOUND_EXPR, TREE_TYPE (op1),
- TREE_OPERAND (exp, 0), op1);
- }
-
- if (!lvalue_p (exp)
- && ! (TREE_CODE (exp) == CONSTRUCTOR && TREE_STATIC (exp)))
- {
- error ("invalid use of non-lvalue array");
- return error_mark_node;
- }
-
- constp = volatilep = 0;
- if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'r'
- || TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
- {
- constp = TREE_READONLY (exp);
- volatilep = TREE_THIS_VOLATILE (exp);
- }
-
- restype = TREE_TYPE (type);
- if (TYPE_READONLY (type) || TYPE_VOLATILE (type)
- || constp || volatilep)
- restype = cp_build_type_variant (restype,
- TYPE_READONLY (type) || constp,
- TYPE_VOLATILE (type) || volatilep);
- ptrtype = build_pointer_type (restype);
-
- if (TREE_CODE (exp) == VAR_DECL)
- {
- /* ??? This is not really quite correct
- in that the type of the operand of ADDR_EXPR
- is not the target type of the type of the ADDR_EXPR itself.
- Question is, can this lossage be avoided? */
- adr = build1 (ADDR_EXPR, ptrtype, exp);
- if (mark_addressable (exp) == 0)
- return error_mark_node;
- TREE_CONSTANT (adr) = staticp (exp);
- TREE_SIDE_EFFECTS (adr) = 0; /* Default would be, same as EXP. */
- return adr;
- }
- /* This way is better for a COMPONENT_REF since it can
- simplify the offset for a component. */
- adr = build_unary_op (ADDR_EXPR, exp, 1);
- return convert (ptrtype, adr);
- }
-
- return exp;
-}
-
-tree
-default_conversion (exp)
- tree exp;
-{
- tree type;
- enum tree_code code;
-
- exp = decay_conversion (exp);
-
- type = TREE_TYPE (exp);
- code = TREE_CODE (type);
-
- if (INTEGRAL_CODE_P (code))
- {
- tree t = type_promotes_to (type);
- if (t != type)
- return convert (t, exp);
- }
-
- return exp;
-}
-
-/* Take the address of an inline function without setting TREE_ADDRESSABLE
- or TREE_USED. */
-
-tree
-inline_conversion (exp)
- tree exp;
-{
- if (TREE_CODE (exp) == FUNCTION_DECL)
- {
- tree type = build_type_variant
- (TREE_TYPE (exp), TREE_READONLY (exp), TREE_THIS_VOLATILE (exp));
- exp = build1 (ADDR_EXPR, build_pointer_type (type), exp);
- }
- return exp;
-}
-
-tree
-build_object_ref (datum, basetype, field)
- tree datum, basetype, field;
-{
- tree dtype;
- if (datum == error_mark_node)
- return error_mark_node;
-
- dtype = TREE_TYPE (datum);
- if (TREE_CODE (dtype) == REFERENCE_TYPE)
- dtype = TREE_TYPE (dtype);
- if (! IS_AGGR_TYPE_CODE (TREE_CODE (dtype)))
- {
- cp_error ("request for member `%T::%D' in expression of non-aggregate type `%T'",
- basetype, field, dtype);
- return error_mark_node;
- }
- else if (IS_SIGNATURE (basetype))
- {
- warning ("signature name in scope resolution ignored");
- return build_component_ref (datum, field, NULL_TREE, 1);
- }
- else if (is_aggr_type (basetype, 1))
- {
- tree binfo = binfo_or_else (basetype, dtype);
- if (binfo)
- return build_x_component_ref (build_scoped_ref (datum, basetype),
- field, binfo, 1);
- }
- return error_mark_node;
-}
-
-/* Like `build_component_ref, but uses an already found field.
- Must compute access for current_class_ref. Otherwise, ok. */
-
-tree
-build_component_ref_1 (datum, field, protect)
- tree datum, field;
- int protect;
-{
- return build_component_ref (datum, field, NULL_TREE, protect);
-}
-
-/* Given a COND_EXPR in T, return it in a form that we can, for
- example, use as an lvalue. This code used to be in unary_complex_lvalue,
- but we needed it to deal with `a = (d == c) ? b : c' expressions, where
- we're dealing with aggregates. So, we now call this in unary_complex_lvalue,
- and in build_modify_expr. The case (in particular) that led to this was
- with CODE == ADDR_EXPR, since it's not an lvalue when we'd get it there. */
-
-static tree
-rationalize_conditional_expr (code, t)
- enum tree_code code;
- tree t;
-{
- return
- build_conditional_expr (TREE_OPERAND (t, 0),
- build_unary_op (code, TREE_OPERAND (t, 1), 0),
- build_unary_op (code, TREE_OPERAND (t, 2), 0));
-}
-
-/* Given the TYPE of an anonymous union field inside T, return the
- FIELD_DECL for the field. If not found return NULL_TREE. Because
- anonymous unions can nest, we must also search all anonymous unions
- that are directly reachable. */
-
-static tree
-lookup_anon_field (t, type)
- tree t, type;
-{
- tree field;
-
- for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
- {
- if (TREE_STATIC (field))
- continue;
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- /* If we find it directly, return the field. */
- if (DECL_NAME (field) == NULL_TREE
- && type == TREE_TYPE (field))
- {
- return field;
- }
-
- /* Otherwise, it could be nested, search harder. */
- if (DECL_NAME (field) == NULL_TREE
- && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
- {
- tree subfield = lookup_anon_field (TREE_TYPE (field), type);
- if (subfield)
- return subfield;
- }
- }
- return NULL_TREE;
-}
-
-/* Build a COMPONENT_REF for a given DATUM, and it's member COMPONENT.
- COMPONENT can be an IDENTIFIER_NODE that is the name of the member
- that we are interested in, or it can be a FIELD_DECL. */
-
-tree
-build_component_ref (datum, component, basetype_path, protect)
- tree datum, component, basetype_path;
- int protect;
-{
- register tree basetype = TREE_TYPE (datum);
- register enum tree_code code;
- register tree field = NULL;
- register tree ref;
-
- if (processing_template_decl)
- return build_min_nt (COMPONENT_REF, datum, component);
-
- /* If DATUM is a COMPOUND_EXPR or COND_EXPR, move our reference
- inside it. */
- switch (TREE_CODE (datum))
- {
- case COMPOUND_EXPR:
- {
- tree value = build_component_ref (TREE_OPERAND (datum, 1), component,
- basetype_path, protect);
- return build (COMPOUND_EXPR, TREE_TYPE (value),
- TREE_OPERAND (datum, 0), value);
- }
- case COND_EXPR:
- return build_conditional_expr
- (TREE_OPERAND (datum, 0),
- build_component_ref (TREE_OPERAND (datum, 1), component,
- basetype_path, protect),
- build_component_ref (TREE_OPERAND (datum, 2), component,
- basetype_path, protect));
- }
-
- code = TREE_CODE (basetype);
-
- if (code == REFERENCE_TYPE)
- {
- datum = convert_from_reference (datum);
- basetype = TREE_TYPE (datum);
- code = TREE_CODE (basetype);
- }
- if (TREE_CODE (datum) == OFFSET_REF)
- {
- datum = resolve_offset_ref (datum);
- basetype = TREE_TYPE (datum);
- code = TREE_CODE (basetype);
- }
-
- /* First, see if there is a field or component with name COMPONENT. */
- if (TREE_CODE (component) == TREE_LIST)
- {
- my_friendly_assert (!(TREE_CHAIN (component) == NULL_TREE
- && DECL_CHAIN (TREE_VALUE (component)) == NULL_TREE), 309);
- return build (COMPONENT_REF, TREE_TYPE (component), datum, component);
- }
-
- if (! IS_AGGR_TYPE_CODE (code))
- {
- if (code != ERROR_MARK)
- cp_error ("request for member `%D' in `%E', which is of non-aggregate type `%T'",
- component, datum, basetype);
- return error_mark_node;
- }
-
- if (TYPE_SIZE (complete_type (basetype)) == 0)
- {
- incomplete_type_error (0, basetype);
- return error_mark_node;
- }
-
- if (TREE_CODE (component) == BIT_NOT_EXPR)
- {
- if (TYPE_IDENTIFIER (basetype) != TREE_OPERAND (component, 0))
- {
- cp_error ("destructor specifier `%T::~%T' must have matching names",
- basetype, TREE_OPERAND (component, 0));
- return error_mark_node;
- }
- if (! TYPE_HAS_DESTRUCTOR (basetype))
- {
- cp_error ("type `%T' has no destructor", basetype);
- return error_mark_node;
- }
- return TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (basetype), 1);
- }
-
- /* Look up component name in the structure type definition. */
- if (CLASSTYPE_VFIELD (basetype)
- && DECL_NAME (CLASSTYPE_VFIELD (basetype)) == component)
- /* Special-case this because if we use normal lookups in an ambiguous
- hierarchy, the compiler will abort (because vptr lookups are
- not supposed to be ambiguous. */
- field = CLASSTYPE_VFIELD (basetype);
- else if (TREE_CODE (component) == FIELD_DECL
- || TREE_CODE (component) == TYPE_DECL)
- {
- field = component;
- }
- else
- {
- tree name = component;
- if (TREE_CODE (component) == VAR_DECL)
- name = DECL_NAME (component);
- if (basetype_path == NULL_TREE)
- basetype_path = TYPE_BINFO (basetype);
- field = lookup_field (basetype_path, name,
- protect && !VFIELD_NAME_P (name), 0);
- if (field == error_mark_node)
- return error_mark_node;
-
- if (field == NULL_TREE)
- {
- /* Not found as a data field, look for it as a method. If found,
- then if this is the only possible one, return it, else
- report ambiguity error. */
- tree fndecls = lookup_fnfields (basetype_path, name, 1);
- if (fndecls == error_mark_node)
- return error_mark_node;
- if (fndecls)
- {
- if (TREE_CHAIN (fndecls) == NULL_TREE
- && DECL_CHAIN (TREE_VALUE (fndecls)) == NULL_TREE)
- {
- tree access, fndecl;
-
- /* Unique, so use this one now. */
- basetype = TREE_PURPOSE (fndecls);
- fndecl = TREE_VALUE (fndecls);
- access = compute_access (TREE_PURPOSE (fndecls), fndecl);
- if (access == access_public_node)
- {
- if (DECL_VINDEX (fndecl)
- && ! resolves_to_fixed_type_p (datum, 0))
- {
- tree addr = build_unary_op (ADDR_EXPR, datum, 0);
- tree fntype = TREE_TYPE (fndecl);
-
- addr = convert_pointer_to (DECL_CONTEXT (fndecl), addr);
- datum = build_indirect_ref (addr, NULL_PTR);
- my_friendly_assert (datum != error_mark_node, 310);
- fndecl = build_vfn_ref (&addr, datum, DECL_VINDEX (fndecl));
- TREE_TYPE (fndecl) = build_pointer_type (fntype);
- }
- mark_used (fndecl);
- return build (OFFSET_REF, TREE_TYPE (fndecl), datum, fndecl);
- }
- if (access == access_protected_node)
- cp_error ("member function `%D' is protected", fndecl);
- else
- cp_error ("member function `%D' is private", fndecl);
- return error_mark_node;
- }
- else
- {
- /* Just act like build_offset_ref, since the object does
- not matter unless we're actually calling the function. */
- tree t;
-
- t = build_tree_list (error_mark_node, fndecls);
- TREE_TYPE (t) = build_offset_type (basetype,
- unknown_type_node);
- return t;
- }
- }
-
- cp_error ("`%#T' has no member named `%D'", basetype, name);
- return error_mark_node;
- }
- else if (TREE_TYPE (field) == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (field) != FIELD_DECL)
- {
- if (TREE_CODE (field) == TYPE_DECL)
- {
- cp_error ("invalid use of type decl `%#D' as expression", field);
- return error_mark_node;
- }
- else if (DECL_RTL (field) != 0)
- mark_used (field);
- else
- TREE_USED (field) = 1;
- return field;
- }
- }
-
- /* See if we have to do any conversions so that we pick up the field from the
- right context. */
- if (DECL_FIELD_CONTEXT (field) != basetype)
- {
- tree context = DECL_FIELD_CONTEXT (field);
- tree base = context;
- while (base != basetype && TYPE_NAME (base)
- && ANON_AGGRNAME_P (TYPE_IDENTIFIER (base)))
- {
- base = TYPE_CONTEXT (base);
- }
-
- /* Handle base classes here... */
- if (base != basetype && TYPE_USES_COMPLEX_INHERITANCE (basetype))
- {
- tree addr = build_unary_op (ADDR_EXPR, datum, 0);
- if (integer_zerop (addr))
- {
- error ("invalid reference to NULL ptr, use ptr-to-member instead");
- return error_mark_node;
- }
- if (VBASE_NAME_P (DECL_NAME (field)))
- {
- /* It doesn't matter which vbase pointer we grab, just
- find one of them. */
- tree binfo = get_binfo (base,
- TREE_TYPE (TREE_TYPE (addr)), 0);
- addr = convert_pointer_to_real (binfo, addr);
- }
- else
- addr = convert_pointer_to (base, addr);
- datum = build_indirect_ref (addr, NULL_PTR);
- my_friendly_assert (datum != error_mark_node, 311);
- }
- basetype = base;
-
- /* Handle things from anon unions here... */
- if (TYPE_NAME (context) && ANON_AGGRNAME_P (TYPE_IDENTIFIER (context)))
- {
- tree subfield = lookup_anon_field (basetype, context);
- tree subdatum = build_component_ref (datum, subfield,
- basetype_path, protect);
- return build_component_ref (subdatum, field, basetype_path, protect);
- }
- }
-
- ref = fold (build (COMPONENT_REF, TREE_TYPE (field),
- break_out_cleanups (datum), field));
-
- if (TREE_READONLY (datum) || TREE_READONLY (field))
- TREE_READONLY (ref) = 1;
- if (TREE_THIS_VOLATILE (datum) || TREE_THIS_VOLATILE (field))
- TREE_THIS_VOLATILE (ref) = 1;
- if (DECL_MUTABLE_P (field))
- TREE_READONLY (ref) = 0;
-
- return ref;
-}
-
-/* Variant of build_component_ref for use in expressions, which should
- never have REFERENCE_TYPE. */
-
-tree
-build_x_component_ref (datum, component, basetype_path, protect)
- tree datum, component, basetype_path;
- int protect;
-{
- tree t = build_component_ref (datum, component, basetype_path, protect);
-
- if (! processing_template_decl)
- t = convert_from_reference (t);
-
- return t;
-}
-
-/* Given an expression PTR for a pointer, return an expression
- for the value pointed to.
- ERRORSTRING is the name of the operator to appear in error messages.
-
- This function may need to overload OPERATOR_FNNAME.
- Must also handle REFERENCE_TYPEs for C++. */
-
-tree
-build_x_indirect_ref (ptr, errorstring)
- tree ptr;
- char *errorstring;
-{
- tree rval;
-
- if (processing_template_decl)
- return build_min_nt (INDIRECT_REF, ptr);
-
- rval = build_opfncall (INDIRECT_REF, LOOKUP_NORMAL, ptr, NULL_TREE, NULL_TREE);
- if (rval)
- return rval;
- return build_indirect_ref (ptr, errorstring);
-}
-
-tree
-build_indirect_ref (ptr, errorstring)
- tree ptr;
- char *errorstring;
-{
- register tree pointer, type;
-
- if (ptr == error_mark_node)
- return error_mark_node;
-
- pointer = (TREE_CODE (TREE_TYPE (ptr)) == REFERENCE_TYPE
- ? ptr : default_conversion (ptr));
- type = TREE_TYPE (pointer);
-
- if (ptr == current_class_ptr)
- return current_class_ref;
-
- if (IS_AGGR_TYPE (type))
- {
- ptr = build_expr_type_conversion (WANT_POINTER, pointer, 1);
-
- if (ptr)
- {
- pointer = ptr;
- type = TREE_TYPE (pointer);
- }
- }
-
- if (TREE_CODE (type) == POINTER_TYPE || TREE_CODE (type) == REFERENCE_TYPE)
- {
- if (TREE_CODE (pointer) == ADDR_EXPR
- && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (pointer, 0)))
- == TYPE_MAIN_VARIANT (TREE_TYPE (type)))
- && (TREE_READONLY (TREE_OPERAND (pointer, 0))
- == TYPE_READONLY (TREE_TYPE (type)))
- && (TREE_THIS_VOLATILE (TREE_OPERAND (pointer, 0))
- == TYPE_VOLATILE (TREE_TYPE (type))))
- return TREE_OPERAND (pointer, 0);
- else
- {
- tree t = TREE_TYPE (type);
- register tree ref = build1 (INDIRECT_REF,
- TYPE_MAIN_VARIANT (t), pointer);
-
- TREE_READONLY (ref) = TYPE_READONLY (t);
- TREE_THIS_VOLATILE (ref) = TYPE_VOLATILE (t);
- TREE_SIDE_EFFECTS (ref)
- = TYPE_VOLATILE (t) || TREE_SIDE_EFFECTS (pointer);
- return ref;
- }
- }
- /* `pointer' won't be an error_mark_node if we were given a
- pointer to member, so it's cool to check for this here. */
- else if (TYPE_PTRMEMFUNC_P (type))
- error ("invalid use of `%s' on pointer to member function", errorstring);
- else if (TREE_CODE (type) == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type)))
- error ("cannot dereference signature pointer/reference");
- else if (pointer != error_mark_node)
- {
- if (errorstring)
- error ("invalid type argument of `%s'", errorstring);
- else
- error ("invalid type argument");
- }
- return error_mark_node;
-}
-
-/* This handles expressions of the form "a[i]", which denotes
- an array reference.
-
- This is logically equivalent in C to *(a+i), but we may do it differently.
- If A is a variable or a member, we generate a primitive ARRAY_REF.
- This avoids forcing the array out of registers, and can work on
- arrays that are not lvalues (for example, members of structures returned
- by functions).
-
- If INDEX is of some user-defined type, it must be converted to
- integer type. Otherwise, to make a compatible PLUS_EXPR, it
- will inherit the type of the array, which will be some pointer type. */
-
-tree
-build_array_ref (array, idx)
- tree array, idx;
-{
- if (idx == 0)
- {
- error ("subscript missing in array reference");
- return error_mark_node;
- }
-
- if (TREE_TYPE (array) == error_mark_node
- || TREE_TYPE (idx) == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE
- && TREE_CODE (array) != INDIRECT_REF)
- {
- tree rval, type;
-
- /* Subscripting with type char is likely to lose
- on a machine where chars are signed.
- So warn on any machine, but optionally.
- Don't warn for unsigned char since that type is safe.
- Don't warn for signed char because anyone who uses that
- must have done so deliberately. */
- if (warn_char_subscripts
- && TYPE_MAIN_VARIANT (TREE_TYPE (idx)) == char_type_node)
- warning ("array subscript has type `char'");
-
- /* Apply default promotions *after* noticing character types. */
- idx = default_conversion (idx);
-
- if (TREE_CODE (TREE_TYPE (idx)) != INTEGER_TYPE)
- {
- error ("array subscript is not an integer");
- return error_mark_node;
- }
-
- /* An array that is indexed by a non-constant
- cannot be stored in a register; we must be able to do
- address arithmetic on its address.
- Likewise an array of elements of variable size. */
- if (TREE_CODE (idx) != INTEGER_CST
- || (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))) != 0
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array)))) != INTEGER_CST))
- {
- if (mark_addressable (array) == 0)
- return error_mark_node;
- }
- /* An array that is indexed by a constant value which is not within
- the array bounds cannot be stored in a register either; because we
- would get a crash in store_bit_field/extract_bit_field when trying
- to access a non-existent part of the register. */
- if (TREE_CODE (idx) == INTEGER_CST
- && TYPE_VALUES (TREE_TYPE (array))
- && ! int_fits_type_p (idx, TYPE_VALUES (TREE_TYPE (array))))
- {
- if (mark_addressable (array) == 0)
- return error_mark_node;
- }
-
- if (pedantic && !lvalue_p (array))
- pedwarn ("ANSI C++ forbids subscripting non-lvalue array");
-
- /* Note in C++ it is valid to subscript a `register' array, since
- it is valid to take the address of something with that
- storage specification. */
- if (extra_warnings)
- {
- tree foo = array;
- while (TREE_CODE (foo) == COMPONENT_REF)
- foo = TREE_OPERAND (foo, 0);
- if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo))
- warning ("subscripting array declared `register'");
- }
-
- type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (array)));
- rval = build (ARRAY_REF, type, array, idx);
- /* Array ref is const/volatile if the array elements are
- or if the array is.. */
- TREE_READONLY (rval)
- |= (TYPE_READONLY (TREE_TYPE (TREE_TYPE (array)))
- | TREE_READONLY (array));
- TREE_SIDE_EFFECTS (rval)
- |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array)))
- | TREE_SIDE_EFFECTS (array));
- TREE_THIS_VOLATILE (rval)
- |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array)))
- /* This was added by rms on 16 Nov 91.
- It fixes vol struct foo *a; a->elts[1]
- in an inline function.
- Hope it doesn't break something else. */
- | TREE_THIS_VOLATILE (array));
- return require_complete_type (fold (rval));
- }
-
- {
- tree ar = default_conversion (array);
- tree ind = default_conversion (idx);
-
- /* Put the integer in IND to simplify error checking. */
- if (TREE_CODE (TREE_TYPE (ar)) == INTEGER_TYPE)
- {
- tree temp = ar;
- ar = ind;
- ind = temp;
- }
-
- if (ar == error_mark_node)
- return ar;
-
- if (TREE_CODE (TREE_TYPE (ar)) != POINTER_TYPE)
- {
- error ("subscripted value is neither array nor pointer");
- return error_mark_node;
- }
- if (TREE_CODE (TREE_TYPE (ind)) != INTEGER_TYPE)
- {
- error ("array subscript is not an integer");
- return error_mark_node;
- }
-
- return build_indirect_ref (build_binary_op_nodefault (PLUS_EXPR, ar, ind, PLUS_EXPR),
- "array indexing");
- }
-}
-
-/* Build a function call to function FUNCTION with parameters PARAMS.
- PARAMS is a list--a chain of TREE_LIST nodes--in which the
- TREE_VALUE of each node is a parameter-expression. The PARAMS do
- not include any object pointer that may be required. FUNCTION's
- data type may be a function type or a pointer-to-function.
-
- For C++: If FUNCTION's data type is a TREE_LIST, then the tree list
- is the list of possible methods that FUNCTION could conceivably
- be. If the list of methods comes from a class, then it will be
- a list of lists (where each element is associated with the class
- that produced it), otherwise it will be a simple list (for
- functions overloaded in global scope).
-
- In the first case, TREE_VALUE (function) is the head of one of those
- lists, and TREE_PURPOSE is the name of the function.
-
- In the second case, TREE_PURPOSE (function) is the function's
- name directly.
-
- DECL is the class instance variable, usually CURRENT_CLASS_REF.
-
- When calling a TEMPLATE_DECL, we don't require a complete return
- type. */
-
-tree
-build_x_function_call (function, params, decl)
- tree function, params, decl;
-{
- tree type;
- int is_method;
-
- if (function == error_mark_node)
- return error_mark_node;
-
- if (processing_template_decl)
- return build_min_nt (CALL_EXPR, function, params, NULL_TREE);
-
- type = TREE_TYPE (function);
-
- if (TREE_CODE (type) == OFFSET_TYPE
- && TREE_TYPE (type) == unknown_type_node
- && TREE_CODE (function) == TREE_LIST
- && TREE_CHAIN (function) == NULL_TREE)
- {
- /* Undo (Foo:bar)()... */
- type = TYPE_OFFSET_BASETYPE (type);
- function = TREE_VALUE (function);
- my_friendly_assert (TREE_CODE (function) == TREE_LIST, 999);
- my_friendly_assert (TREE_CHAIN (function) == NULL_TREE, 999);
- function = TREE_VALUE (function);
- my_friendly_assert (TREE_CODE (function) == FUNCTION_DECL, 999);
- function = DECL_NAME (function);
- return build_method_call (decl, function, params, TYPE_BINFO (type), LOOKUP_NORMAL);
- }
-
- is_method = ((TREE_CODE (function) == TREE_LIST
- && current_class_type != NULL_TREE
- && IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (function)) == function)
- || TREE_CODE (function) == IDENTIFIER_NODE
- || TREE_CODE (type) == METHOD_TYPE
- || TYPE_PTRMEMFUNC_P (type));
-
- if (TREE_CODE (function) == FUNCTION_DECL
- && DECL_STATIC_FUNCTION_P (function))
- return build_member_call
- (DECL_CONTEXT (function), DECL_NAME (function), params);
-
- /* Handle methods, friends, and overloaded functions, respectively. */
- if (is_method)
- {
- tree basetype = NULL_TREE;
-
- if (TREE_CODE (function) == FUNCTION_DECL)
- {
- basetype = DECL_CLASS_CONTEXT (function);
-
- if (DECL_NAME (function))
- function = DECL_NAME (function);
- else
- function = TYPE_IDENTIFIER (DECL_CLASS_CONTEXT (function));
- }
- else if (TREE_CODE (function) == TREE_LIST)
- {
- my_friendly_assert (TREE_CODE (TREE_VALUE (function)) == FUNCTION_DECL, 312);
- basetype = DECL_CLASS_CONTEXT (TREE_VALUE (function));
- function = TREE_PURPOSE (function);
- }
- else if (TREE_CODE (function) != IDENTIFIER_NODE)
- {
- if (TREE_CODE (function) == OFFSET_REF)
- {
- if (TREE_OPERAND (function, 0))
- decl = TREE_OPERAND (function, 0);
- }
- /* Call via a pointer to member function. */
- if (decl == NULL_TREE)
- {
- error ("pointer to member function called, but not in class scope");
- return error_mark_node;
- }
- /* What other type of POINTER_TYPE could this be? */
- if (TREE_CODE (TREE_TYPE (function)) != POINTER_TYPE
- && ! TYPE_PTRMEMFUNC_P (TREE_TYPE (function))
- && TREE_CODE (function) != OFFSET_REF)
- function = build (OFFSET_REF, TREE_TYPE (type), NULL_TREE, function);
- goto do_x_function;
- }
-
- /* this is an abbreviated method call.
- must go through here in case it is a virtual function.
- @@ Perhaps this could be optimized. */
-
- if (basetype && (! current_class_type
- || ! DERIVED_FROM_P (basetype, current_class_type)))
- return build_member_call (basetype, function, params);
-
- if (decl == NULL_TREE)
- {
- if (current_class_type == NULL_TREE)
- {
- error ("object missing in call to method `%s'",
- IDENTIFIER_POINTER (function));
- return error_mark_node;
- }
- /* Yow: call from a static member function. */
- decl = build1 (NOP_EXPR, build_pointer_type (current_class_type),
- error_mark_node);
- decl = build_indirect_ref (decl, NULL_PTR);
- }
-
- return build_method_call (decl, function, params,
- NULL_TREE, LOOKUP_NORMAL);
- }
- else if (TREE_CODE (function) == COMPONENT_REF
- && type == unknown_type_node)
- {
- /* Should we undo what was done in build_component_ref? */
- if (TREE_CODE (TREE_PURPOSE (TREE_OPERAND (function, 1))) == TREE_VEC)
- /* Get the name that build_component_ref hid. */
- function = DECL_NAME (TREE_VALUE (TREE_OPERAND (function, 1)));
- else
- function = TREE_PURPOSE (TREE_OPERAND (function, 1));
- return build_method_call (decl, function, params,
- NULL_TREE, LOOKUP_NORMAL);
- }
- else if (TREE_CODE (function) == TREE_LIST)
- {
- if (TREE_VALUE (function) == NULL_TREE)
- {
- cp_error ("function `%D' declared overloaded, but no definitions appear with which to resolve it?!?",
- TREE_PURPOSE (function));
- return error_mark_node;
- }
- else
- {
- tree val = TREE_VALUE (function);
-
- if (flag_ansi_overloading)
- return build_new_function_call (function, params, NULL_TREE);
-
- if (TREE_CODE (val) == TEMPLATE_DECL)
- return build_overload_call_real
- (function, params, LOOKUP_COMPLAIN, (struct candidate *)0, 0);
- else if (DECL_CHAIN (val) != NULL_TREE)
- return build_overload_call
- (function, params, LOOKUP_COMPLAIN);
- else
- my_friendly_abort (360);
- }
- }
-
- do_x_function:
- if (TREE_CODE (function) == OFFSET_REF)
- {
- /* If the component is a data element (or a virtual function), we play
- games here to make things work. */
- tree decl_addr;
-
- if (TREE_OPERAND (function, 0))
- decl = TREE_OPERAND (function, 0);
- else
- decl = current_class_ref;
-
- decl_addr = build_unary_op (ADDR_EXPR, decl, 0);
- function = get_member_function_from_ptrfunc (&decl_addr,
- TREE_OPERAND (function, 1));
- params = tree_cons (NULL_TREE, decl_addr, params);
- return build_function_call (function, params);
- }
-
- type = TREE_TYPE (function);
- if (type != error_mark_node)
- {
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- if (IS_AGGR_TYPE (type))
- return build_opfncall (CALL_EXPR, LOOKUP_NORMAL, function, params, NULL_TREE);
- }
-
- if (is_method)
- {
- tree fntype = TREE_TYPE (function);
- tree ctypeptr;
-
- /* Explicitly named method? */
- if (TREE_CODE (function) == FUNCTION_DECL)
- ctypeptr = build_pointer_type (DECL_CLASS_CONTEXT (function));
- /* Expression with ptr-to-method type? It could either be a plain
- usage, or it might be a case where the ptr-to-method is being
- passed in as an argument. */
- else if (TYPE_PTRMEMFUNC_P (fntype))
- {
- tree rec = TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (fntype)));
- ctypeptr = build_pointer_type (rec);
- }
- /* Unexpected node type? */
- else
- my_friendly_abort (116);
- if (decl == NULL_TREE)
- {
- if (current_function_decl
- && DECL_STATIC_FUNCTION_P (current_function_decl))
- error ("invalid call to member function needing `this' in static member function scope");
- else
- error ("pointer to member function called, but not in class scope");
- return error_mark_node;
- }
- if (TREE_CODE (TREE_TYPE (decl)) != POINTER_TYPE
- && ! TYPE_PTRMEMFUNC_P (TREE_TYPE (decl)))
- {
- decl = build_unary_op (ADDR_EXPR, decl, 0);
- decl = convert_pointer_to (TREE_TYPE (ctypeptr), decl);
- }
- else
- decl = build_c_cast (ctypeptr, decl);
- params = tree_cons (NULL_TREE, decl, params);
- }
-
- return build_function_call (function, params);
-}
-
-/* Resolve a pointer to member function. INSTANCE is the object
- instance to use, if the member points to a virtual member. */
-
-tree
-get_member_function_from_ptrfunc (instance_ptrptr, function)
- tree *instance_ptrptr;
- tree function;
-{
- if (TREE_CODE (function) == OFFSET_REF)
- {
- function = TREE_OPERAND (function, 1);
- }
-
- if (TYPE_PTRMEMFUNC_P (TREE_TYPE (function)))
- {
- tree fntype, idx, e1, delta, delta2, e2, e3, aref, vtbl;
- tree instance;
-
- tree instance_ptr = *instance_ptrptr;
-
- if (TREE_SIDE_EFFECTS (instance_ptr))
- instance_ptr = save_expr (instance_ptr);
-
- if (TREE_SIDE_EFFECTS (function))
- function = save_expr (function);
-
- fntype = TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (function));
- idx = save_expr (build_component_ref (function,
- index_identifier,
- NULL_TREE, 0));
- e1 = fold (build (GT_EXPR, boolean_type_node, idx,
- convert (delta_type_node, integer_zero_node)));
- delta = convert (ptrdiff_type_node,
- build_component_ref (function, delta_identifier, NULL_TREE, 0));
- delta2 = DELTA2_FROM_PTRMEMFUNC (function);
-
- /* convert down to the right base, before using the instance. */
- instance
- = convert_pointer_to_real (TYPE_METHOD_BASETYPE (TREE_TYPE (fntype)),
- instance_ptr);
- if (instance == error_mark_node && instance_ptr != error_mark_node)
- return instance;
-
- vtbl = convert_pointer_to (ptr_type_node, instance);
- vtbl
- = build (PLUS_EXPR,
- build_pointer_type (build_pointer_type (vtable_entry_type)),
- vtbl, convert (ptrdiff_type_node, delta2));
- vtbl = build_indirect_ref (vtbl, NULL_PTR);
- aref = build_array_ref (vtbl, build_binary_op (MINUS_EXPR,
- idx,
- integer_one_node, 1));
- if (! flag_vtable_thunks)
- {
- aref = save_expr (aref);
-
- delta = build_binary_op (PLUS_EXPR,
- build_conditional_expr (e1, build_component_ref (aref, delta_identifier, NULL_TREE, 0), integer_zero_node),
- delta, 1);
- }
-
- *instance_ptrptr = build (PLUS_EXPR, TREE_TYPE (instance_ptr),
- instance_ptr, delta);
- if (flag_vtable_thunks)
- e2 = aref;
- else
- e2 = build_component_ref (aref, pfn_identifier, NULL_TREE, 0);
-
- e3 = PFN_FROM_PTRMEMFUNC (function);
- TREE_TYPE (e2) = TREE_TYPE (e3);
- e1 = build_conditional_expr (e1, e2, e3);
-
- if (instance_ptr == error_mark_node
- && TREE_CODE (e1) != ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (e1, 0)) != FUNCTION_DECL)
- cp_error ("object missing in `%E'", function);
-
- function = e1;
-
- /* Make sure this doesn't get evaluated first inside one of the
- branches of the COND_EXPR. */
- if (TREE_CODE (instance_ptr) == SAVE_EXPR)
- function = build (COMPOUND_EXPR, TREE_TYPE (function),
- instance_ptr, function);
- }
- return function;
-}
-
-tree
-build_function_call_real (function, params, require_complete, flags)
- tree function, params;
- int require_complete, flags;
-{
- register tree fntype, fndecl;
- register tree value_type;
- register tree coerced_params;
- tree name = NULL_TREE, assembler_name = NULL_TREE;
- int is_method;
-
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Strip such NOP_EXPRs, since FUNCTION is used in non-lvalue context. */
- if (TREE_CODE (function) == NOP_EXPR
- && TREE_TYPE (function) == TREE_TYPE (TREE_OPERAND (function, 0)))
- function = TREE_OPERAND (function, 0);
-
- if (TREE_CODE (function) == FUNCTION_DECL)
- {
- name = DECL_NAME (function);
- assembler_name = DECL_ASSEMBLER_NAME (function);
-
- GNU_xref_call (current_function_decl,
- IDENTIFIER_POINTER (name ? name
- : TYPE_IDENTIFIER (DECL_CLASS_CONTEXT (function))));
- mark_used (function);
- fndecl = function;
-
- /* Convert anything with function type to a pointer-to-function. */
- if (pedantic
- && name
- && IDENTIFIER_LENGTH (name) == 4
- && ! strcmp (IDENTIFIER_POINTER (name), "main")
- && DECL_CONTEXT (function) == NULL_TREE)
- {
- pedwarn ("ANSI C++ forbids calling `main' from within program");
- }
-
- if (pedantic && DECL_THIS_INLINE (function) && ! DECL_INITIAL (function)
- && ! DECL_ARTIFICIAL (function)
- && ! DECL_PENDING_INLINE_INFO (function))
- cp_pedwarn ("inline function `%#D' called before definition",
- function);
-
- /* Differs from default_conversion by not setting TREE_ADDRESSABLE
- (because calling an inline function does not mean the function
- needs to be separately compiled). */
-
- if (DECL_INLINE (function))
- function = inline_conversion (function);
- else
- function = build_addr_func (function);
- }
- else
- {
- fndecl = NULL_TREE;
-
- function = build_addr_func (function);
- }
-
- if (function == error_mark_node)
- return error_mark_node;
-
- fntype = TREE_TYPE (function);
-
- if (TYPE_PTRMEMFUNC_P (fntype))
- {
- cp_error ("must use .* or ->* to call pointer-to-member function in `%E (...)'",
- function);
- return error_mark_node;
- }
-
- is_method = (TREE_CODE (fntype) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (fntype)) == METHOD_TYPE);
-
- if (!((TREE_CODE (fntype) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE)
- || is_method))
- {
- cp_error ("`%E' cannot be used as a function", function);
- return error_mark_node;
- }
-
- /* fntype now gets the type of function pointed to. */
- fntype = TREE_TYPE (fntype);
-
- /* Convert the parameters to the types declared in the
- function prototype, or apply default promotions. */
-
- if (flags & LOOKUP_COMPLAIN)
- coerced_params = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype),
- params, fndecl, LOOKUP_NORMAL);
- else
- coerced_params = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype),
- params, fndecl, 0);
-
- if (coerced_params == error_mark_node)
- if (flags & LOOKUP_SPECULATIVELY)
- return NULL_TREE;
- else
- return error_mark_node;
-
- /* Check for errors in format strings. */
-
- if (warn_format && (name || assembler_name))
- check_function_format (name, assembler_name, coerced_params);
-
- /* Recognize certain built-in functions so we can make tree-codes
- other than CALL_EXPR. We do this when it enables fold-const.c
- to do something useful. */
-
- if (TREE_CODE (function) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL
- && DECL_BUILT_IN (TREE_OPERAND (function, 0)))
- switch (DECL_FUNCTION_CODE (TREE_OPERAND (function, 0)))
- {
- case BUILT_IN_ABS:
- case BUILT_IN_LABS:
- case BUILT_IN_FABS:
- if (coerced_params == 0)
- return integer_zero_node;
- return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0);
- }
-
- /* C++ */
- value_type = TREE_TYPE (fntype) ? TREE_TYPE (fntype) : void_type_node;
- {
- register tree result
- = build_call (function, value_type, coerced_params);
-
- if (require_complete)
- {
- if (value_type == void_type_node)
- return result;
- result = require_complete_type (result);
- }
- if (IS_AGGR_TYPE (value_type))
- result = build_cplus_new (value_type, result);
- return convert_from_reference (result);
- }
-}
-
-tree
-build_function_call (function, params)
- tree function, params;
-{
- return build_function_call_real (function, params, 1, LOOKUP_NORMAL);
-}
-
-/* Convert the actual parameter expressions in the list VALUES
- to the types in the list TYPELIST.
- If parmdecls is exhausted, or when an element has NULL as its type,
- perform the default conversions.
-
- RETURN_LOC is the location of the return value, if known, NULL_TREE
- otherwise. This is useful in the case where we can avoid creating
- a temporary variable in the case where we can initialize the return
- value directly. If we are not eliding constructors, then we set this
- to NULL_TREE to avoid this avoidance.
-
- NAME is an IDENTIFIER_NODE or 0. It is used only for error messages.
-
- This is also where warnings about wrong number of args are generated.
-
- Return a list of expressions for the parameters as converted.
-
- Both VALUES and the returned value are chains of TREE_LIST nodes
- with the elements of the list in the TREE_VALUE slots of those nodes.
-
- In C++, unspecified trailing parameters can be filled in with their
- default arguments, if such were specified. Do so here. */
-
-tree
-convert_arguments (return_loc, typelist, values, fndecl, flags)
- tree return_loc, typelist, values, fndecl;
- int flags;
-{
- register tree typetail, valtail;
- register tree result = NULL_TREE;
- char *called_thing;
- int i = 0;
-
- if (! flag_elide_constructors)
- return_loc = 0;
-
- /* Argument passing is always copy-initialization. */
- flags |= LOOKUP_ONLYCONVERTING;
-
- if (fndecl)
- {
- if (TREE_CODE (TREE_TYPE (fndecl)) == METHOD_TYPE)
- {
- if (DECL_NAME (fndecl) == NULL_TREE
- || IDENTIFIER_HAS_TYPE_VALUE (DECL_NAME (fndecl)))
- called_thing = "constructor";
- else
- called_thing = "member function";
- }
- else
- called_thing = "function";
- }
-
- for (valtail = values, typetail = typelist;
- valtail;
- valtail = TREE_CHAIN (valtail), i++)
- {
- register tree type = typetail ? TREE_VALUE (typetail) : 0;
- register tree val = TREE_VALUE (valtail);
-
- if (val == error_mark_node)
- return error_mark_node;
-
- if (type == void_type_node)
- {
- if (fndecl)
- {
- cp_error_at ("too many arguments to %s `%+D'", called_thing,
- fndecl);
- error ("at this point in file");
- }
- else
- error ("too many arguments to function");
- /* In case anybody wants to know if this argument
- list is valid. */
- if (result)
- TREE_TYPE (tree_last (result)) = error_mark_node;
- break;
- }
-
- /* The tree type of the parameter being passed may not yet be
- known. In this case, its type is TYPE_UNKNOWN, and will
- be instantiated by the type given by TYPE. If TYPE
- is also NULL, the tree type of VAL is ERROR_MARK_NODE. */
- if (type && type_unknown_p (val))
- val = require_instantiated_type (type, val, integer_zero_node);
- else if (type_unknown_p (val))
- {
- /* Strip the `&' from an overloaded FUNCTION_DECL. */
- if (TREE_CODE (val) == ADDR_EXPR)
- val = TREE_OPERAND (val, 0);
- if (TREE_CODE (val) == TREE_LIST
- && TREE_CHAIN (val) == NULL_TREE
- && TREE_TYPE (TREE_VALUE (val)) != NULL_TREE
- && (TREE_TYPE (val) == unknown_type_node
- || DECL_CHAIN (TREE_VALUE (val)) == NULL_TREE))
- /* Instantiates automatically. */
- val = TREE_VALUE (val);
- else
- {
- error ("insufficient type information in parameter list");
- val = integer_zero_node;
- }
- }
- else if (TREE_CODE (val) == OFFSET_REF
- && TREE_CODE (TREE_TYPE (val)) == METHOD_TYPE)
- {
- /* This is unclean. Should be handled elsewhere. */
- val = build_unary_op (ADDR_EXPR, val, 0);
- }
- else if (TREE_CODE (val) == OFFSET_REF)
- val = resolve_offset_ref (val);
-
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Strip such NOP_EXPRs, since VAL is used in non-lvalue context. */
- if (TREE_CODE (val) == NOP_EXPR
- && TREE_TYPE (val) == TREE_TYPE (TREE_OPERAND (val, 0))
- && (type == 0 || TREE_CODE (type) != REFERENCE_TYPE))
- val = TREE_OPERAND (val, 0);
-
- if (type == 0 || TREE_CODE (type) != REFERENCE_TYPE)
- {
- if (TREE_CODE (TREE_TYPE (val)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (val)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (val)) == METHOD_TYPE)
- val = default_conversion (val);
-
- val = require_complete_type (val);
- }
-
- if (val == error_mark_node)
- return error_mark_node;
-
- if (type != 0)
- {
- /* Formal parm type is specified by a function prototype. */
- tree parmval;
-
- if (TYPE_SIZE (complete_type (type)) == 0)
- {
- error ("parameter type of called function is incomplete");
- parmval = val;
- }
- else
- {
- parmval = convert_for_initialization
- (return_loc, type, val, flags,
- "argument passing", fndecl, i);
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
- parmval = default_conversion (parmval);
-#endif
- }
-
- if (parmval == error_mark_node)
- return error_mark_node;
-
- result = tree_cons (NULL_TREE, parmval, result);
- }
- else
- {
- if (TREE_CODE (TREE_TYPE (val)) == REFERENCE_TYPE)
- val = convert_from_reference (val);
-
- if (TREE_CODE (TREE_TYPE (val)) == REAL_TYPE
- && (TYPE_PRECISION (TREE_TYPE (val))
- < TYPE_PRECISION (double_type_node)))
- /* Convert `float' to `double'. */
- result = tree_cons (NULL_TREE, convert (double_type_node, val), result);
- else if (TYPE_LANG_SPECIFIC (TREE_TYPE (val))
- && ! TYPE_HAS_TRIVIAL_INIT_REF (TREE_TYPE (val)))
- {
- cp_warning ("cannot pass objects of type `%T' through `...'",
- TREE_TYPE (val));
- result = tree_cons (NULL_TREE, val, result);
- }
- else
- /* Convert `short' and `char' to full-size `int'. */
- result = tree_cons (NULL_TREE, default_conversion (val), result);
- }
-
- if (typetail)
- typetail = TREE_CHAIN (typetail);
- }
-
- if (typetail != 0 && typetail != void_list_node)
- {
- /* See if there are default arguments that can be used */
- if (TREE_PURPOSE (typetail))
- {
- for (; typetail != void_list_node; ++i)
- {
- tree type = TREE_VALUE (typetail);
- tree val = break_out_target_exprs (TREE_PURPOSE (typetail));
- tree parmval;
-
- if (val == NULL_TREE)
- parmval = error_mark_node;
- else if (TREE_CODE (val) == CONSTRUCTOR)
- {
- parmval = digest_init (type, val, (tree *)0);
- parmval = convert_for_initialization (return_loc, type, parmval, flags,
- "default constructor", fndecl, i);
- }
- else
- {
- /* This could get clobbered by the following call. */
- if (TREE_HAS_CONSTRUCTOR (val))
- val = copy_node (val);
-
- parmval = convert_for_initialization (return_loc, type, val, flags,
- "default argument", fndecl, i);
-#ifdef PROMOTE_PROTOTYPES
- if ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
- parmval = default_conversion (parmval);
-#endif
- }
-
- if (parmval == error_mark_node)
- return error_mark_node;
-
- result = tree_cons (0, parmval, result);
- typetail = TREE_CHAIN (typetail);
- /* ends with `...'. */
- if (typetail == NULL_TREE)
- break;
- }
- }
- else
- {
- if (fndecl)
- {
- char *buf = (char *)alloca (32 + strlen (called_thing));
- sprintf (buf, "too few arguments to %s `%%#D'", called_thing);
- cp_error_at (buf, fndecl);
- error ("at this point in file");
- }
- else
- error ("too few arguments to function");
- return error_mark_list;
- }
- }
-
- return nreverse (result);
-}
-
-/* Build a binary-operation expression, after performing default
- conversions on the operands. CODE is the kind of expression to build. */
-
-tree
-build_x_binary_op (code, arg1, arg2)
- enum tree_code code;
- tree arg1, arg2;
-{
- tree rval;
-
- if (processing_template_decl)
- return build_min_nt (code, arg1, arg2);
-
- if (flag_ansi_overloading)
- return build_new_op (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE);
-
- rval = build_opfncall (code, LOOKUP_SPECULATIVELY,
- arg1, arg2, NULL_TREE);
- if (rval)
- return build_opfncall (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE);
- if (code == MEMBER_REF)
- return build_m_component_ref (build_indirect_ref (arg1, NULL_PTR),
- arg2);
- return build_binary_op (code, arg1, arg2, 1);
-}
-
-tree
-build_binary_op (code, arg1, arg2, convert_p)
- enum tree_code code;
- tree arg1, arg2;
- int convert_p;
-{
- tree args[2];
-
- args[0] = arg1;
- args[1] = arg2;
-
- if (convert_p)
- {
- tree type0, type1;
- args[0] = decay_conversion (args[0]);
- args[1] = decay_conversion (args[1]);
-
- if (args[0] == error_mark_node || args[1] == error_mark_node)
- return error_mark_node;
-
- type0 = TREE_TYPE (args[0]);
- type1 = TREE_TYPE (args[1]);
-
- if (type_unknown_p (args[0]))
- {
- args[0] = instantiate_type (type1, args[0], 1);
- args[0] = decay_conversion (args[0]);
- }
- else if (type_unknown_p (args[1]))
- {
- args[1] = require_instantiated_type (type0, args[1],
- error_mark_node);
- args[1] = decay_conversion (args[1]);
- }
-
- if (IS_AGGR_TYPE (type0) || IS_AGGR_TYPE (type1))
- {
- /* Try to convert this to something reasonable. */
- if (! build_default_binary_type_conversion(code, &args[0], &args[1]))
- {
- cp_error ("no match for `%O(%#T, %#T)'", code,
- TREE_TYPE (arg1), TREE_TYPE (arg2));
- return error_mark_node;
- }
- }
- }
- return build_binary_op_nodefault (code, args[0], args[1], code);
-}
-
-/* Build a binary-operation expression without default conversions.
- CODE is the kind of expression to build.
- This function differs from `build' in several ways:
- the data type of the result is computed and recorded in it,
- warnings are generated if arg data types are invalid,
- special handling for addition and subtraction of pointers is known,
- and some optimization is done (operations on narrow ints
- are done in the narrower type when that gives the same result).
- Constant folding is also done before the result is returned.
-
- ERROR_CODE is the code that determines what to say in error messages.
- It is usually, but not always, the same as CODE.
-
- Note that the operands will never have enumeral types
- because either they have just had the default conversions performed
- or they have both just been converted to some other type in which
- the arithmetic is to be done.
-
- C++: must do special pointer arithmetic when implementing
- multiple inheritance, and deal with pointer to member functions. */
-
-tree
-build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
- enum tree_code code;
- tree orig_op0, orig_op1;
- enum tree_code error_code;
-{
- tree op0, op1;
- register enum tree_code code0, code1;
- tree type0, type1;
-
- /* Expression code to give to the expression when it is built.
- Normally this is CODE, which is what the caller asked for,
- but in some special cases we change it. */
- register enum tree_code resultcode = code;
-
- /* Data type in which the computation is to be performed.
- In the simplest cases this is the common type of the arguments. */
- register tree result_type = NULL;
-
- /* Nonzero means operands have already been type-converted
- in whatever way is necessary.
- Zero means they need to be converted to RESULT_TYPE. */
- int converted = 0;
-
- /* Nonzero means create the expression with this type, rather than
- RESULT_TYPE. */
- tree build_type = 0;
-
- /* Nonzero means after finally constructing the expression
- convert it to this type. */
- tree final_type = 0;
-
- /* Nonzero if this is an operation like MIN or MAX which can
- safely be computed in short if both args are promoted shorts.
- Also implies COMMON.
- -1 indicates a bitwise operation; this makes a difference
- in the exact conditions for when it is safe to do the operation
- in a narrower mode. */
- int shorten = 0;
-
- /* Nonzero if this is a comparison operation;
- if both args are promoted shorts, compare the original shorts.
- Also implies COMMON. */
- int short_compare = 0;
-
- /* Nonzero if this is a right-shift operation, which can be computed on the
- original short and then promoted if the operand is a promoted short. */
- int short_shift = 0;
-
- /* Nonzero means set RESULT_TYPE to the common type of the args. */
- int common = 0;
-
- /* Apply default conversions. */
- if (code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR
- || code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR
- || code == TRUTH_XOR_EXPR)
- {
- op0 = decay_conversion (orig_op0);
- op1 = decay_conversion (orig_op1);
- }
- else
- {
- op0 = default_conversion (orig_op0);
- op1 = default_conversion (orig_op1);
- }
-
- type0 = TREE_TYPE (op0);
- type1 = TREE_TYPE (op1);
-
- /* The expression codes of the data types of the arguments tell us
- whether the arguments are integers, floating, pointers, etc. */
- code0 = TREE_CODE (type0);
- code1 = TREE_CODE (type1);
-
- /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */
- STRIP_TYPE_NOPS (op0);
- STRIP_TYPE_NOPS (op1);
-
- /* If an error was already reported for one of the arguments,
- avoid reporting another error. */
-
- if (code0 == ERROR_MARK || code1 == ERROR_MARK)
- return error_mark_node;
-
- switch (code)
- {
- case PLUS_EXPR:
- /* Handle the pointer + int case. */
- if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
- return pointer_int_sum (PLUS_EXPR, op0, op1);
- else if (code1 == POINTER_TYPE && code0 == INTEGER_TYPE)
- return pointer_int_sum (PLUS_EXPR, op1, op0);
- else
- common = 1;
- break;
-
- case MINUS_EXPR:
- /* Subtraction of two similar pointers.
- We must subtract them as integers, then divide by object size. */
- if (code0 == POINTER_TYPE && code1 == POINTER_TYPE
- && comp_target_types (type0, type1, 1))
- return pointer_diff (op0, op1);
- /* Handle pointer minus int. Just like pointer plus int. */
- else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
- return pointer_int_sum (MINUS_EXPR, op0, op1);
- else
- common = 1;
- break;
-
- case MULT_EXPR:
- common = 1;
- break;
-
- case TRUNC_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case EXACT_DIV_EXPR:
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
- && (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
- {
- if (TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1))
- cp_warning ("division by zero in `%E / 0'", op0);
- else if (TREE_CODE (op1) == REAL_CST && real_zerop (op1))
- cp_warning ("division by zero in `%E / 0.'", op0);
-
- if (!(code0 == INTEGER_TYPE && code1 == INTEGER_TYPE))
- resultcode = RDIV_EXPR;
- else
- /* When dividing two signed integers, we have to promote to int.
- unless we divide by a constant != -1. Note that default
- conversion will have been performed on the operands at this
- point, so we have to dig out the original type to find out if
- it was unsigned. */
- shorten = ((TREE_CODE (op0) == NOP_EXPR
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
- || (TREE_CODE (op1) == INTEGER_CST
- && (TREE_INT_CST_LOW (op1) != -1
- || TREE_INT_CST_HIGH (op1) != -1)));
- common = 1;
- }
- break;
-
- case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
- case BIT_IOR_EXPR:
- case BIT_XOR_EXPR:
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- shorten = -1;
- /* If one operand is a constant, and the other is a short type
- that has been converted to an int,
- really do the work in the short type and then convert the
- result to int. If we are lucky, the constant will be 0 or 1
- in the short type, making the entire operation go away. */
- if (TREE_CODE (op0) == INTEGER_CST
- && TREE_CODE (op1) == NOP_EXPR
- && TYPE_PRECISION (type1) > TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0)))
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op1, 0))))
- {
- final_type = result_type;
- op1 = TREE_OPERAND (op1, 0);
- result_type = TREE_TYPE (op1);
- }
- if (TREE_CODE (op1) == INTEGER_CST
- && TREE_CODE (op0) == NOP_EXPR
- && TYPE_PRECISION (type0) > TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0)))
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
- {
- final_type = result_type;
- op0 = TREE_OPERAND (op0, 0);
- result_type = TREE_TYPE (op0);
- }
- break;
-
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- if (code1 == INTEGER_TYPE && integer_zerop (op1))
- cp_warning ("division by zero in `%E % 0'", op0);
- else if (code1 == REAL_TYPE && real_zerop (op1))
- cp_warning ("division by zero in `%E % 0.'", op0);
-
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- {
- /* Although it would be tempting to shorten always here, that loses
- on some targets, since the modulo instruction is undefined if the
- quotient can't be represented in the computation mode. We shorten
- only if unsigned or if dividing by something we know != -1. */
- shorten = ((TREE_CODE (op0) == NOP_EXPR
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
- || (TREE_CODE (op1) == INTEGER_CST
- && (TREE_INT_CST_LOW (op1) != -1
- || TREE_INT_CST_HIGH (op1) != -1)));
- common = 1;
- }
- break;
-
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- result_type = boolean_type_node;
- break;
-
- /* Shift operations: result has same type as first operand;
- always convert second operand to int.
- Also set SHORT_SHIFT if shifting rightward. */
-
- case RSHIFT_EXPR:
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- {
- result_type = type0;
- if (TREE_CODE (op1) == INTEGER_CST)
- {
- if (tree_int_cst_lt (op1, integer_zero_node))
- warning ("right shift count is negative");
- else
- {
- if (TREE_INT_CST_LOW (op1) | TREE_INT_CST_HIGH (op1))
- short_shift = 1;
- if (TREE_INT_CST_HIGH (op1) != 0
- || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
- >= TYPE_PRECISION (type0)))
- warning ("right shift count >= width of type");
- }
- }
- /* Convert the shift-count to an integer, regardless of
- size of value being shifted. */
- if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
- op1 = convert (integer_type_node, op1);
- /* Avoid converting op1 to result_type later. */
- converted = 1;
- }
- break;
-
- case LSHIFT_EXPR:
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- {
- result_type = type0;
- if (TREE_CODE (op1) == INTEGER_CST)
- {
- if (tree_int_cst_lt (op1, integer_zero_node))
- warning ("left shift count is negative");
- else if (TREE_INT_CST_HIGH (op1) != 0
- || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
- >= TYPE_PRECISION (type0)))
- warning ("left shift count >= width of type");
- }
- /* Convert the shift-count to an integer, regardless of
- size of value being shifted. */
- if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
- op1 = convert (integer_type_node, op1);
- /* Avoid converting op1 to result_type later. */
- converted = 1;
- }
- break;
-
- case RROTATE_EXPR:
- case LROTATE_EXPR:
- if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- {
- result_type = type0;
- if (TREE_CODE (op1) == INTEGER_CST)
- {
- if (tree_int_cst_lt (op1, integer_zero_node))
- warning ("%s rotate count is negative",
- (code == LROTATE_EXPR) ? "left" : "right");
- else if (TREE_INT_CST_HIGH (op1) != 0
- || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1)
- >= TYPE_PRECISION (type0)))
- warning ("%s rotate count >= width of type",
- (code == LROTATE_EXPR) ? "left" : "right");
- }
- /* Convert the shift-count to an integer, regardless of
- size of value being shifted. */
- if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
- op1 = convert (integer_type_node, op1);
- }
- break;
-
- case EQ_EXPR:
- case NE_EXPR:
- build_type = boolean_type_node;
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
- && (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
- short_compare = 1;
- else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- {
- register tree tt0 = TYPE_MAIN_VARIANT (TREE_TYPE (type0));
- register tree tt1 = TYPE_MAIN_VARIANT (TREE_TYPE (type1));
-
- if (comp_target_types (type0, type1, 1))
- result_type = common_type (type0, type1);
- else if (tt0 == void_type_node)
- {
- if (pedantic && TREE_CODE (tt1) == FUNCTION_TYPE
- && tree_int_cst_lt (TYPE_SIZE (type0), TYPE_SIZE (type1)))
- pedwarn ("ANSI C++ forbids comparison of `void *' with function pointer");
- else if (TREE_CODE (tt1) == OFFSET_TYPE)
- pedwarn ("ANSI C++ forbids conversion of a pointer to member to `void *'");
- }
- else if (tt1 == void_type_node)
- {
- if (pedantic && TREE_CODE (tt0) == FUNCTION_TYPE
- && tree_int_cst_lt (TYPE_SIZE (type1), TYPE_SIZE (type0)))
- pedwarn ("ANSI C++ forbids comparison of `void *' with function pointer");
- }
- else
- cp_pedwarn ("comparison of distinct pointer types `%T' and `%T' lacks a cast",
- type0, type1);
-
- if (result_type == NULL_TREE)
- result_type = ptr_type_node;
- }
- else if (code0 == POINTER_TYPE && TREE_CODE (op1) == INTEGER_CST
- && integer_zerop (op1))
- result_type = type0;
- else if (code1 == POINTER_TYPE && TREE_CODE (op0) == INTEGER_CST
- && integer_zerop (op0))
- result_type = type1;
- else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
- {
- result_type = type0;
- error ("ANSI C++ forbids comparison between pointer and integer");
- }
- else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
- {
- result_type = type1;
- error ("ANSI C++ forbids comparison between pointer and integer");
- }
- else if (TYPE_PTRMEMFUNC_P (type0) && TREE_CODE (op1) == INTEGER_CST
- && integer_zerop (op1))
- {
- op0 = build_component_ref (op0, index_identifier, NULL_TREE, 0);
- op1 = integer_zero_node;
- result_type = TREE_TYPE (op0);
- }
- else if (TYPE_PTRMEMFUNC_P (type1) && TREE_CODE (op0) == INTEGER_CST
- && integer_zerop (op0))
- {
- op0 = build_component_ref (op1, index_identifier, NULL_TREE, 0);
- op1 = integer_zero_node;
- result_type = TREE_TYPE (op0);
- }
- else if (TYPE_PTRMEMFUNC_P (type0) && TYPE_PTRMEMFUNC_P (type1)
- && (TYPE_PTRMEMFUNC_FN_TYPE (type0)
- == TYPE_PTRMEMFUNC_FN_TYPE (type1)))
- {
- /* The code we generate for the test is:
-
- (op0.index == op1.index
- && ((op1.index != -1 && op0.delta2 == op1.delta2)
- || op0.pfn == op1.pfn)) */
-
- tree index0 = build_component_ref (op0, index_identifier, NULL_TREE, 0);
- tree index1 = save_expr (build_component_ref (op1, index_identifier, NULL_TREE, 0));
- tree pfn0 = PFN_FROM_PTRMEMFUNC (op0);
- tree pfn1 = PFN_FROM_PTRMEMFUNC (op1);
- tree delta20 = DELTA2_FROM_PTRMEMFUNC (op0);
- tree delta21 = DELTA2_FROM_PTRMEMFUNC (op1);
- tree e1, e2, e3;
- tree integer_neg_one_node
- = build_binary_op (MINUS_EXPR, integer_zero_node, integer_one_node, 1);
- e1 = build_binary_op (EQ_EXPR, index0, index1, 1);
- e2 = build_binary_op (NE_EXPR, index1, integer_neg_one_node, 1);
- e2 = build_binary_op (TRUTH_ANDIF_EXPR, e2, build_binary_op (EQ_EXPR, delta20, delta21, 1), 1);
- e3 = build_binary_op (EQ_EXPR, pfn0, pfn1, 1);
- e2 = build_binary_op (TRUTH_ORIF_EXPR, e2, e3, 1);
- e2 = build_binary_op (TRUTH_ANDIF_EXPR, e1, e2, 1);
- if (code == EQ_EXPR)
- return e2;
- return build_binary_op (EQ_EXPR, e2, integer_zero_node, 1);
- }
- else if (TYPE_PTRMEMFUNC_P (type0)
- && TYPE_PTRMEMFUNC_FN_TYPE (type0) == type1)
- {
- tree index0 = build_component_ref (op0, index_identifier, NULL_TREE, 0);
- tree index1;
- tree pfn0 = PFN_FROM_PTRMEMFUNC (op0);
- tree delta20 = DELTA2_FROM_PTRMEMFUNC (op0);
- tree delta21 = integer_zero_node;
- tree e1, e2, e3;
- tree integer_neg_one_node
- = build_binary_op (MINUS_EXPR, integer_zero_node, integer_one_node, 1);
- if (TREE_CODE (TREE_OPERAND (op1, 0)) == FUNCTION_DECL
- && DECL_VINDEX (TREE_OPERAND (op1, 0)))
- {
- /* Map everything down one to make room for the null pointer to member. */
- index1 = size_binop (PLUS_EXPR,
- DECL_VINDEX (TREE_OPERAND (op1, 0)),
- integer_one_node);
- op1 = integer_zero_node;
- delta21 = CLASSTYPE_VFIELD (TYPE_METHOD_BASETYPE (TREE_TYPE (type1)));
- delta21 = DECL_FIELD_BITPOS (delta21);
- delta21 = size_binop (FLOOR_DIV_EXPR, delta21, size_int (BITS_PER_UNIT));
- }
- else
- index1 = integer_neg_one_node;
- {
- tree nop1 = build1 (NOP_EXPR, TYPE_PTRMEMFUNC_FN_TYPE (type0), op1);
- TREE_CONSTANT (nop1) = TREE_CONSTANT (op1);
- op1 = nop1;
- }
- e1 = build_binary_op (EQ_EXPR, index0, index1, 1);
- e2 = build_binary_op (NE_EXPR, index1, integer_neg_one_node, 1);
- e2 = build_binary_op (TRUTH_ANDIF_EXPR, e2, build_binary_op (EQ_EXPR, delta20, delta21, 1), 1);
- e3 = build_binary_op (EQ_EXPR, pfn0, op1, 1);
- e2 = build_binary_op (TRUTH_ORIF_EXPR, e2, e3, 1);
- e2 = build_binary_op (TRUTH_ANDIF_EXPR, e1, e2, 1);
- if (code == EQ_EXPR)
- return e2;
- return build_binary_op (EQ_EXPR, e2, integer_zero_node, 1);
- }
- else if (TYPE_PTRMEMFUNC_P (type1)
- && TYPE_PTRMEMFUNC_FN_TYPE (type1) == type0)
- {
- return build_binary_op (code, op1, op0, 1);
- }
- break;
-
- case MAX_EXPR:
- case MIN_EXPR:
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
- && (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
- shorten = 1;
- else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- {
- if (comp_target_types (type0, type1, 1))
- result_type = common_type (type0, type1);
- else
- {
- cp_pedwarn ("comparison of distinct pointer types `%T' and `%T' lacks a cast",
- type0, type1);
- result_type = ptr_type_node;
- }
- }
- break;
-
- case LE_EXPR:
- case GE_EXPR:
- case LT_EXPR:
- case GT_EXPR:
- build_type = boolean_type_node;
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
- && (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
- short_compare = 1;
- else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- {
- if (comp_target_types (type0, type1, 1))
- result_type = common_type (type0, type1);
- else
- {
- cp_pedwarn ("comparison of distinct pointer types `%T' and `%T' lacks a cast",
- type0, type1);
- result_type = ptr_type_node;
- }
- }
- else if (code0 == POINTER_TYPE && TREE_CODE (op1) == INTEGER_CST
- && integer_zerop (op1))
- result_type = type0;
- else if (code1 == POINTER_TYPE && TREE_CODE (op0) == INTEGER_CST
- && integer_zerop (op0))
- result_type = type1;
- else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
- {
- result_type = type0;
- pedwarn ("ANSI C++ forbids comparison between pointer and integer");
- }
- else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE)
- {
- result_type = type1;
- pedwarn ("ANSI C++ forbids comparison between pointer and integer");
- }
- break;
- }
-
- if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
- && (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
- {
- if (shorten || common || short_compare)
- result_type = common_type (type0, type1);
-
- /* For certain operations (which identify themselves by shorten != 0)
- if both args were extended from the same smaller type,
- do the arithmetic in that type and then extend.
-
- shorten !=0 and !=1 indicates a bitwise operation.
- For them, this optimization is safe only if
- both args are zero-extended or both are sign-extended.
- Otherwise, we might change the result.
- Eg, (short)-1 | (unsigned short)-1 is (int)-1
- but calculated in (unsigned short) it would be (unsigned short)-1. */
-
- if (shorten)
- {
- int unsigned0, unsigned1;
- tree arg0 = get_narrower (op0, &unsigned0);
- tree arg1 = get_narrower (op1, &unsigned1);
- /* UNS is 1 if the operation to be done is an unsigned one. */
- int uns = TREE_UNSIGNED (result_type);
- tree type;
-
- final_type = result_type;
-
- /* Handle the case that OP0 does not *contain* a conversion
- but it *requires* conversion to FINAL_TYPE. */
-
- if (op0 == arg0 && TREE_TYPE (op0) != final_type)
- unsigned0 = TREE_UNSIGNED (TREE_TYPE (op0));
- if (op1 == arg1 && TREE_TYPE (op1) != final_type)
- unsigned1 = TREE_UNSIGNED (TREE_TYPE (op1));
-
- /* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */
-
- /* For bitwise operations, signedness of nominal type
- does not matter. Consider only how operands were extended. */
- if (shorten == -1)
- uns = unsigned0;
-
- /* Note that in all three cases below we refrain from optimizing
- an unsigned operation on sign-extended args.
- That would not be valid. */
-
- /* Both args variable: if both extended in same way
- from same width, do it in that width.
- Do it unsigned if args were zero-extended. */
- if ((TYPE_PRECISION (TREE_TYPE (arg0))
- < TYPE_PRECISION (result_type))
- && (TYPE_PRECISION (TREE_TYPE (arg1))
- == TYPE_PRECISION (TREE_TYPE (arg0)))
- && unsigned0 == unsigned1
- && (unsigned0 || !uns))
- result_type
- = signed_or_unsigned_type (unsigned0,
- common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
- else if (TREE_CODE (arg0) == INTEGER_CST
- && (unsigned1 || !uns)
- && (TYPE_PRECISION (TREE_TYPE (arg1))
- < TYPE_PRECISION (result_type))
- && (type = signed_or_unsigned_type (unsigned1,
- TREE_TYPE (arg1)),
- int_fits_type_p (arg0, type)))
- result_type = type;
- else if (TREE_CODE (arg1) == INTEGER_CST
- && (unsigned0 || !uns)
- && (TYPE_PRECISION (TREE_TYPE (arg0))
- < TYPE_PRECISION (result_type))
- && (type = signed_or_unsigned_type (unsigned0,
- TREE_TYPE (arg0)),
- int_fits_type_p (arg1, type)))
- result_type = type;
- }
-
- /* Shifts can be shortened if shifting right. */
-
- if (short_shift)
- {
- int unsigned_arg;
- tree arg0 = get_narrower (op0, &unsigned_arg);
-
- final_type = result_type;
-
- if (arg0 == op0 && final_type == TREE_TYPE (op0))
- unsigned_arg = TREE_UNSIGNED (TREE_TYPE (op0));
-
- if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)
- /* We can shorten only if the shift count is less than the
- number of bits in the smaller type size. */
- && TREE_INT_CST_HIGH (op1) == 0
- && TYPE_PRECISION (TREE_TYPE (arg0)) > TREE_INT_CST_LOW (op1)
- /* If arg is sign-extended and then unsigned-shifted,
- we can simulate this with a signed shift in arg's type
- only if the extended result is at least twice as wide
- as the arg. Otherwise, the shift could use up all the
- ones made by sign-extension and bring in zeros.
- We can't optimize that case at all, but in most machines
- it never happens because available widths are 2**N. */
- && (!TREE_UNSIGNED (final_type)
- || unsigned_arg
- || (((unsigned) 2 * TYPE_PRECISION (TREE_TYPE (arg0)))
- <= TYPE_PRECISION (result_type))))
- {
- /* Do an unsigned shift if the operand was zero-extended. */
- result_type
- = signed_or_unsigned_type (unsigned_arg,
- TREE_TYPE (arg0));
- /* Convert value-to-be-shifted to that type. */
- if (TREE_TYPE (op0) != result_type)
- op0 = convert (result_type, op0);
- converted = 1;
- }
- }
-
- /* Comparison operations are shortened too but differently.
- They identify themselves by setting short_compare = 1. */
-
- if (short_compare)
- {
- /* Don't write &op0, etc., because that would prevent op0
- from being kept in a register.
- Instead, make copies of the our local variables and
- pass the copies by reference, then copy them back afterward. */
- tree xop0 = op0, xop1 = op1, xresult_type = result_type;
- enum tree_code xresultcode = resultcode;
- tree val
- = shorten_compare (&xop0, &xop1, &xresult_type, &xresultcode);
- if (val != 0)
- return convert (boolean_type_node, val);
- op0 = xop0, op1 = xop1;
- converted = 1;
- resultcode = xresultcode;
- }
-
- if (short_compare && warn_sign_compare)
- {
- int op0_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op0));
- int op1_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op1));
-
- int unsignedp0, unsignedp1;
- tree primop0 = get_narrower (op0, &unsignedp0);
- tree primop1 = get_narrower (op1, &unsignedp1);
-
- /* Check for comparison of different enum types. */
- if (flag_int_enum_equivalence == 0
- && TREE_CODE (TREE_TYPE (orig_op0)) == ENUMERAL_TYPE
- && TREE_CODE (TREE_TYPE (orig_op1)) == ENUMERAL_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
- != TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1)))
- {
- cp_warning ("comparison between `%#T' and `%#T'",
- TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
- }
-
- /* Give warnings for comparisons between signed and unsigned
- quantities that may fail. */
- /* Do the checking based on the original operand trees, so that
- casts will be considered, but default promotions won't be. */
-
- /* Do not warn if the comparison is being done in a signed type,
- since the signed type will only be chosen if it can represent
- all the values of the unsigned type. */
- if (! TREE_UNSIGNED (result_type))
- /* OK */;
- /* Do not warn if both operands are unsigned. */
- else if (op0_signed == op1_signed)
- /* OK */;
- /* Do not warn if the signed quantity is an unsuffixed
- integer literal (or some static constant expression
- involving such literals) and it is non-negative. */
- else if ((op0_signed && TREE_CODE (orig_op0) == INTEGER_CST
- && tree_int_cst_sgn (orig_op0) >= 0)
- || (op1_signed && TREE_CODE (orig_op1) == INTEGER_CST
- && tree_int_cst_sgn (orig_op1) >= 0))
- /* OK */;
- /* Do not warn if the comparison is an equality operation,
- the unsigned quantity is an integral constant and it does
- not use the most significant bit of result_type. */
- else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
- && ((op0_signed && TREE_CODE (orig_op1) == INTEGER_CST
- && int_fits_type_p (orig_op1, signed_type (result_type))
- || (op1_signed && TREE_CODE (orig_op0) == INTEGER_CST
- && int_fits_type_p (orig_op0, signed_type (result_type))))))
- /* OK */;
- else
- warning ("comparison between signed and unsigned");
-
- /* Warn if two unsigned values are being compared in a size
- larger than their original size, and one (and only one) is the
- result of a `~' operator. This comparison will always fail.
-
- Also warn if one operand is a constant, and the constant does not
- have all bits set that are set in the ~ operand when it is
- extended. */
-
- if ((TREE_CODE (primop0) == BIT_NOT_EXPR)
- ^ (TREE_CODE (primop1) == BIT_NOT_EXPR))
- {
- if (TREE_CODE (primop0) == BIT_NOT_EXPR)
- primop0 = get_narrower (TREE_OPERAND (op0, 0), &unsignedp0);
- if (TREE_CODE (primop1) == BIT_NOT_EXPR)
- primop1 = get_narrower (TREE_OPERAND (op1, 0), &unsignedp1);
-
- if (TREE_CODE (primop0) == INTEGER_CST
- || TREE_CODE (primop1) == INTEGER_CST)
- {
- tree primop;
- HOST_WIDE_INT constant, mask;
- int unsignedp;
- unsigned bits;
-
- if (TREE_CODE (primop0) == INTEGER_CST)
- {
- primop = primop1;
- unsignedp = unsignedp1;
- constant = TREE_INT_CST_LOW (primop0);
- }
- else
- {
- primop = primop0;
- unsignedp = unsignedp0;
- constant = TREE_INT_CST_LOW (primop1);
- }
-
- bits = TYPE_PRECISION (TREE_TYPE (primop));
- if (bits < TYPE_PRECISION (result_type)
- && bits < HOST_BITS_PER_LONG && unsignedp)
- {
- mask = (~ (HOST_WIDE_INT) 0) << bits;
- if ((mask & constant) != mask)
- warning ("comparison of promoted ~unsigned with constant");
- }
- }
- else if (unsignedp0 && unsignedp1
- && (TYPE_PRECISION (TREE_TYPE (primop0))
- < TYPE_PRECISION (result_type))
- && (TYPE_PRECISION (TREE_TYPE (primop1))
- < TYPE_PRECISION (result_type)))
- warning ("comparison of promoted ~unsigned with unsigned");
- }
- }
- }
-
- /* At this point, RESULT_TYPE must be nonzero to avoid an error message.
- If CONVERTED is zero, both args will be converted to type RESULT_TYPE.
- Then the expression will be built.
- It will be given type FINAL_TYPE if that is nonzero;
- otherwise, it will be given type RESULT_TYPE. */
-
- if (!result_type)
- {
- cp_error ("invalid operands `%T' and `%T' to binary `%O'",
- TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), error_code);
- return error_mark_node;
- }
-
- if (! converted)
- {
- if (TREE_TYPE (op0) != result_type)
- op0 = convert (result_type, op0);
- if (TREE_TYPE (op1) != result_type)
- op1 = convert (result_type, op1);
- }
-
- if (build_type == NULL_TREE)
- build_type = result_type;
-
- {
- register tree result = build (resultcode, build_type, op0, op1);
- register tree folded;
-
- folded = fold (result);
- if (folded == result)
- TREE_CONSTANT (folded) = TREE_CONSTANT (op0) & TREE_CONSTANT (op1);
- if (final_type != 0)
- return convert (final_type, folded);
- return folded;
- }
-}
-
-/* Return a tree for the sum or difference (RESULTCODE says which)
- of pointer PTROP and integer INTOP. */
-
-static tree
-pointer_int_sum (resultcode, ptrop, intop)
- enum tree_code resultcode;
- register tree ptrop, intop;
-{
- tree size_exp;
-
- register tree result;
- register tree folded = fold (intop);
-
- /* The result is a pointer of the same type that is being added. */
-
- register tree result_type = TREE_TYPE (ptrop);
-
- if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids using pointer of type `void *' in arithmetic");
- size_exp = integer_one_node;
- }
- else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids using pointer to a function in arithmetic");
- size_exp = integer_one_node;
- }
- else if (TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids using pointer to a method in arithmetic");
- size_exp = integer_one_node;
- }
- else if (TREE_CODE (TREE_TYPE (result_type)) == OFFSET_TYPE)
- {
- if (pedantic || warn_pointer_arith)
- pedwarn ("ANSI C++ forbids using pointer to a member in arithmetic");
- size_exp = integer_one_node;
- }
- else
- size_exp = size_in_bytes (complete_type (TREE_TYPE (result_type)));
-
- /* Needed to make OOPS V2R3 work. */
- intop = folded;
- if (TREE_CODE (intop) == INTEGER_CST
- && TREE_INT_CST_LOW (intop) == 0
- && TREE_INT_CST_HIGH (intop) == 0)
- return ptrop;
-
- /* If what we are about to multiply by the size of the elements
- contains a constant term, apply distributive law
- and multiply that constant term separately.
- This helps produce common subexpressions. */
-
- if ((TREE_CODE (intop) == PLUS_EXPR || TREE_CODE (intop) == MINUS_EXPR)
- && ! TREE_CONSTANT (intop)
- && TREE_CONSTANT (TREE_OPERAND (intop, 1))
- && TREE_CONSTANT (size_exp))
- {
- enum tree_code subcode = resultcode;
- if (TREE_CODE (intop) == MINUS_EXPR)
- subcode = (subcode == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR);
- ptrop = build_binary_op (subcode, ptrop, TREE_OPERAND (intop, 1), 1);
- intop = TREE_OPERAND (intop, 0);
- }
-
- /* Convert the integer argument to a type the same size as sizetype
- so the multiply won't overflow spuriously. */
-
- if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype))
- intop = convert (type_for_size (TYPE_PRECISION (sizetype), 0), intop);
-
- /* Replace the integer argument with a suitable product by the object size.
- Do this multiplication as signed, then convert to the appropriate
- pointer type (actually unsigned integral). */
-
- intop = convert (result_type,
- build_binary_op (MULT_EXPR, intop,
- convert (TREE_TYPE (intop), size_exp), 1));
-
- /* Create the sum or difference. */
-
- result = build (resultcode, result_type, ptrop, intop);
-
- folded = fold (result);
- if (folded == result)
- TREE_CONSTANT (folded) = TREE_CONSTANT (ptrop) & TREE_CONSTANT (intop);
- return folded;
-}
-
-/* Return a tree for the difference of pointers OP0 and OP1.
- The resulting tree has type int. */
-
-static tree
-pointer_diff (op0, op1)
- register tree op0, op1;
-{
- register tree result, folded;
- tree restype = ptrdiff_type_node;
- tree target_type = TREE_TYPE (TREE_TYPE (op0));
-
- if (pedantic || warn_pointer_arith)
- {
- if (TREE_CODE (target_type) == VOID_TYPE)
- pedwarn ("ANSI C++ forbids using pointer of type `void *' in subtraction");
- if (TREE_CODE (target_type) == FUNCTION_TYPE)
- pedwarn ("ANSI C++ forbids using pointer to a function in subtraction");
- if (TREE_CODE (target_type) == METHOD_TYPE)
- pedwarn ("ANSI C++ forbids using pointer to a method in subtraction");
- if (TREE_CODE (target_type) == OFFSET_TYPE)
- pedwarn ("ANSI C++ forbids using pointer to a member in subtraction");
- }
-
- /* First do the subtraction as integers;
- then drop through to build the divide operator. */
-
- op0 = build_binary_op (MINUS_EXPR,
- convert (restype, op0), convert (restype, op1), 1);
-
- /* This generates an error if op1 is a pointer to an incomplete type. */
- if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (op1))) == 0)
- error ("arithmetic on pointer to an incomplete type");
-
- op1 = ((TREE_CODE (target_type) == VOID_TYPE
- || TREE_CODE (target_type) == FUNCTION_TYPE
- || TREE_CODE (target_type) == METHOD_TYPE
- || TREE_CODE (target_type) == OFFSET_TYPE)
- ? integer_one_node
- : size_in_bytes (target_type));
-
- /* Do the division. */
-
- result = build (EXACT_DIV_EXPR, restype, op0, convert (restype, op1));
-
- folded = fold (result);
- if (folded == result)
- TREE_CONSTANT (folded) = TREE_CONSTANT (op0) & TREE_CONSTANT (op1);
- return folded;
-}
-
-/* Handle the case of taking the address of a COMPONENT_REF.
- Called by `build_unary_op' and `build_up_reference'.
-
- ARG is the COMPONENT_REF whose address we want.
- ARGTYPE is the pointer type that this address should have.
- MSG is an error message to print if this COMPONENT_REF is not
- addressable (such as a bitfield). */
-
-tree
-build_component_addr (arg, argtype, msg)
- tree arg, argtype;
- char *msg;
-{
- tree field = TREE_OPERAND (arg, 1);
- tree basetype = decl_type_context (field);
- tree rval = build_unary_op (ADDR_EXPR, TREE_OPERAND (arg, 0), 0);
-
- if (DECL_BIT_FIELD (field))
- {
- error (msg, IDENTIFIER_POINTER (DECL_NAME (field)));
- return error_mark_node;
- }
-
- if (TREE_CODE (field) == FIELD_DECL
- && TYPE_USES_COMPLEX_INHERITANCE (basetype))
- {
- /* Can't convert directly to ARGTYPE, since that
- may have the same pointer type as one of our
- baseclasses. */
- rval = build1 (NOP_EXPR, argtype,
- convert_pointer_to (basetype, rval));
- TREE_CONSTANT (rval) = TREE_CONSTANT (TREE_OPERAND (rval, 0));
- }
- else
- /* This conversion is harmless. */
- rval = convert_force (argtype, rval, 0);
-
- if (! integer_zerop (DECL_FIELD_BITPOS (field)))
- {
- tree offset = size_binop (EASY_DIV_EXPR, DECL_FIELD_BITPOS (field),
- size_int (BITS_PER_UNIT));
- int flag = TREE_CONSTANT (rval);
- rval = fold (build (PLUS_EXPR, argtype,
- rval, convert (argtype, offset)));
- TREE_CONSTANT (rval) = flag;
- }
- return rval;
-}
-
-/* Construct and perhaps optimize a tree representation
- for a unary operation. CODE, a tree_code, specifies the operation
- and XARG is the operand. */
-
-tree
-build_x_unary_op (code, xarg)
- enum tree_code code;
- tree xarg;
-{
- if (processing_template_decl)
- return build_min_nt (code, xarg, NULL_TREE);
-
- /* & rec, on incomplete RECORD_TYPEs is the simple opr &, not an
- error message. */
- if (code == ADDR_EXPR
- && ((IS_AGGR_TYPE_CODE (TREE_CODE (TREE_TYPE (xarg)))
- && TYPE_SIZE (TREE_TYPE (xarg)) == NULL_TREE)
- || (TREE_CODE (xarg) == OFFSET_REF)))
- /* don't look for a function */;
- else
- {
- tree rval;
-
- if (flag_ansi_overloading)
- {
- rval = build_new_op (code, LOOKUP_NORMAL, xarg,
- NULL_TREE, NULL_TREE);
- if (rval || code != ADDR_EXPR)
- return rval;
- }
- else
- {
- rval = build_opfncall (code, LOOKUP_SPECULATIVELY, xarg,
- NULL_TREE, NULL_TREE);
- if (rval)
- return build_opfncall (code, LOOKUP_NORMAL, xarg,
- NULL_TREE, NULL_TREE);
- }
- }
-
- if (code == ADDR_EXPR)
- {
- if (TREE_CODE (xarg) == TARGET_EXPR)
- warning ("taking address of temporary");
- }
-
- return build_unary_op (code, xarg, 0);
-}
-
-/* Just like truthvalue_conversion, but we want a CLEANUP_POINT_EXPR. */
-
-tree
-condition_conversion (expr)
- tree expr;
-{
- tree t;
- if (processing_template_decl)
- return expr;
- t = convert (boolean_type_node, expr);
- t = fold (build1 (CLEANUP_POINT_EXPR, boolean_type_node, t));
- return t;
-}
-
-/* C++: Must handle pointers to members.
-
- Perhaps type instantiation should be extended to handle conversion
- from aggregates to types we don't yet know we want? (Or are those
- cases typically errors which should be reported?)
-
- NOCONVERT nonzero suppresses the default promotions
- (such as from short to int). */
-
-tree
-build_unary_op (code, xarg, noconvert)
- enum tree_code code;
- tree xarg;
- int noconvert;
-{
- /* No default_conversion here. It causes trouble for ADDR_EXPR. */
- register tree arg = xarg;
- register tree argtype = 0;
- char *errstring = NULL;
- tree val;
-
- if (arg == error_mark_node)
- return error_mark_node;
-
- switch (code)
- {
- case CONVERT_EXPR:
- /* This is used for unary plus, because a CONVERT_EXPR
- is enough to prevent anybody from looking inside for
- associativity, but won't generate any code. */
- if (!(arg = build_expr_type_conversion
- (WANT_ARITH | WANT_ENUM | WANT_POINTER, arg, 1)))
- errstring = "wrong type argument to unary plus";
- else
- {
- if (!noconvert)
- arg = default_conversion (arg);
- arg = build1 (NON_LVALUE_EXPR, TREE_TYPE (arg), arg);
- }
- break;
-
- case NEGATE_EXPR:
- if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
- errstring = "wrong type argument to unary minus";
- else if (!noconvert)
- arg = default_conversion (arg);
- break;
-
- case BIT_NOT_EXPR:
- if (!(arg = build_expr_type_conversion (WANT_INT | WANT_ENUM, arg, 1)))
- errstring = "wrong type argument to bit-complement";
- else if (!noconvert)
- arg = default_conversion (arg);
- break;
-
- case ABS_EXPR:
- if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
- errstring = "wrong type argument to abs";
- else if (!noconvert)
- arg = default_conversion (arg);
- break;
-
- case TRUTH_NOT_EXPR:
- arg = convert (boolean_type_node, arg);
- val = invert_truthvalue (arg);
- if (arg != error_mark_node)
- return val;
- errstring = "in argument to unary !";
- break;
-
- case NOP_EXPR:
- break;
-
- case PREINCREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- /* Handle complex lvalues (when permitted)
- by reduction to simpler cases. */
-
- val = unary_complex_lvalue (code, arg);
- if (val != 0)
- return val;
-
- /* Report invalid types. */
-
- if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_POINTER,
- arg, 1)))
- {
- if (code == PREINCREMENT_EXPR)
- errstring ="no pre-increment operator for type";
- else if (code == POSTINCREMENT_EXPR)
- errstring ="no post-increment operator for type";
- else if (code == PREDECREMENT_EXPR)
- errstring ="no pre-decrement operator for type";
- else
- errstring ="no post-decrement operator for type";
- break;
- }
-
- /* Report something read-only. */
-
- if (TYPE_READONLY (TREE_TYPE (arg))
- || TREE_READONLY (arg))
- readonly_error (arg, ((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? "increment" : "decrement"),
- 0);
-
- {
- register tree inc;
- tree result_type = TREE_TYPE (arg);
-
- arg = get_unwidened (arg, 0);
- argtype = TREE_TYPE (arg);
-
- /* ARM $5.2.5 last annotation says this should be forbidden. */
- if (TREE_CODE (argtype) == ENUMERAL_TYPE)
- pedwarn ("ANSI C++ forbids %sing an enum",
- (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
- ? "increment" : "decrement");
-
- /* Compute the increment. */
-
- if (TREE_CODE (argtype) == POINTER_TYPE)
- {
- enum tree_code tmp = TREE_CODE (TREE_TYPE (argtype));
- if (TYPE_SIZE (complete_type (TREE_TYPE (argtype))) == 0)
- cp_error ("cannot %s a pointer to incomplete type `%T'",
- ((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? "increment" : "decrement"), TREE_TYPE (argtype));
- else if (tmp == FUNCTION_TYPE || tmp == METHOD_TYPE
- || tmp == VOID_TYPE || tmp == OFFSET_TYPE)
- cp_pedwarn ("ANSI C++ forbids %sing a pointer of type `%T'",
- ((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? "increment" : "decrement"), argtype);
- inc = c_sizeof_nowarn (TREE_TYPE (argtype));
- }
- else
- inc = integer_one_node;
-
- inc = convert (argtype, inc);
-
- /* Handle incrementing a cast-expression. */
-
- switch (TREE_CODE (arg))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- {
- tree incremented, modify, value, compound;
- if (! lvalue_p (arg) && pedantic)
- pedwarn ("cast to non-reference type used as lvalue");
- arg = stabilize_reference (arg);
- if (code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR)
- value = arg;
- else
- value = save_expr (arg);
- incremented = build (((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? PLUS_EXPR : MINUS_EXPR),
- argtype, value, inc);
- TREE_SIDE_EFFECTS (incremented) = 1;
-
- modify = build_modify_expr (arg, NOP_EXPR, incremented);
- compound = build (COMPOUND_EXPR, TREE_TYPE (arg), modify, value);
-
- /* Eliminate warning about unused result of + or -. */
- TREE_NO_UNUSED_WARNING (compound) = 1;
- return compound;
- }
- }
-
- /* Complain about anything else that is not a true lvalue. */
- if (!lvalue_or_else (arg, ((code == PREINCREMENT_EXPR
- || code == POSTINCREMENT_EXPR)
- ? "increment" : "decrement")))
- return error_mark_node;
-
- /* Forbid using -- on `bool'. */
- if (TREE_TYPE (arg) == boolean_type_node)
- {
- if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR)
- {
- cp_error ("invalid use of `--' on bool variable `%D'", arg);
- return error_mark_node;
- }
-#if 0
- /* This will only work if someone can convince Kenner to accept
- my patch to expand_increment. (jason) */
- val = build (code, TREE_TYPE (arg), arg, inc);
-#else
- if (code == POSTINCREMENT_EXPR)
- {
- arg = stabilize_reference (arg);
- val = build (MODIFY_EXPR, TREE_TYPE (arg), arg,
- boolean_true_node);
- TREE_SIDE_EFFECTS (val) = 1;
- arg = save_expr (arg);
- val = build (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
- val = build (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
- }
- else
- val = build (MODIFY_EXPR, TREE_TYPE (arg), arg,
- boolean_true_node);
-#endif
- }
- else
- val = build (code, TREE_TYPE (arg), arg, inc);
-
- TREE_SIDE_EFFECTS (val) = 1;
- return convert (result_type, val);
- }
-
- case ADDR_EXPR:
- /* Note that this operation never does default_conversion
- regardless of NOCONVERT. */
-
- argtype = TREE_TYPE (arg);
- if (TREE_CODE (argtype) == REFERENCE_TYPE)
- {
- arg = build1 (CONVERT_EXPR, build_pointer_type (TREE_TYPE (TREE_TYPE (arg))), arg);
- TREE_REFERENCE_EXPR (arg) = 1;
- return arg;
- }
- else if (pedantic
- && TREE_CODE (arg) == FUNCTION_DECL
- && DECL_NAME (arg)
- && DECL_CONTEXT (arg) == NULL_TREE
- && IDENTIFIER_LENGTH (DECL_NAME (arg)) == 4
- && IDENTIFIER_POINTER (DECL_NAME (arg))[0] == 'm'
- && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (arg)), "main"))
- /* ARM $3.4 */
- pedwarn ("taking address of function `main'");
-
- /* Let &* cancel out to simplify resulting code. */
- if (TREE_CODE (arg) == INDIRECT_REF)
- {
- /* We don't need to have `current_class_ptr' wrapped in a
- NON_LVALUE_EXPR node. */
- if (arg == current_class_ref)
- return current_class_ptr;
-
- /* Keep `default_conversion' from converting if
- ARG is of REFERENCE_TYPE. */
- arg = TREE_OPERAND (arg, 0);
- if (TREE_CODE (TREE_TYPE (arg)) == REFERENCE_TYPE)
- {
- if (TREE_CODE (arg) == VAR_DECL && DECL_INITIAL (arg)
- && !TREE_SIDE_EFFECTS (DECL_INITIAL (arg)))
- arg = DECL_INITIAL (arg);
- arg = build1 (CONVERT_EXPR, build_pointer_type (TREE_TYPE (TREE_TYPE (arg))), arg);
- TREE_REFERENCE_EXPR (arg) = 1;
- TREE_CONSTANT (arg) = TREE_CONSTANT (TREE_OPERAND (arg, 0));
- }
- else if (lvalue_p (arg))
- /* Don't let this be an lvalue. */
- return non_lvalue (arg);
- return arg;
- }
-
- /* For &x[y], return x+y */
- if (TREE_CODE (arg) == ARRAY_REF)
- {
- if (mark_addressable (TREE_OPERAND (arg, 0)) == 0)
- return error_mark_node;
- return build_binary_op (PLUS_EXPR, TREE_OPERAND (arg, 0),
- TREE_OPERAND (arg, 1), 1);
- }
-
- /* Uninstantiated types are all functions. Taking the
- address of a function is a no-op, so just return the
- argument. */
-
- if (TREE_CODE (arg) == IDENTIFIER_NODE
- && IDENTIFIER_OPNAME_P (arg))
- {
- my_friendly_abort (117);
- /* We don't know the type yet, so just work around the problem.
- We know that this will resolve to an lvalue. */
- return build1 (ADDR_EXPR, unknown_type_node, arg);
- }
-
- if (TREE_CODE (arg) == TREE_LIST)
- {
- if (TREE_CODE (TREE_VALUE (arg)) == FUNCTION_DECL
- && DECL_CHAIN (TREE_VALUE (arg)) == NULL_TREE)
- /* Unique overloaded non-member function. */
- return build_unary_op (ADDR_EXPR, TREE_VALUE (arg), 0);
- if (TREE_CHAIN (arg) == NULL_TREE
- && TREE_CODE (TREE_VALUE (arg)) == TREE_LIST
- && DECL_CHAIN (TREE_VALUE (TREE_VALUE (arg))) == NULL_TREE)
- /* Unique overloaded member function. */
- return build_unary_op (ADDR_EXPR, TREE_VALUE (TREE_VALUE (arg)),
- 0);
- return build1 (ADDR_EXPR, unknown_type_node, arg);
- }
-
- /* Handle complex lvalues (when permitted)
- by reduction to simpler cases. */
- val = unary_complex_lvalue (code, arg);
- if (val != 0)
- return val;
-
- switch (TREE_CODE (arg))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- if (! lvalue_p (arg) && pedantic)
- pedwarn ("taking the address of a cast to non-reference type");
- }
-
- /* Allow the address of a constructor if all the elements
- are constant. */
- if (TREE_CODE (arg) == CONSTRUCTOR && TREE_CONSTANT (arg))
- ;
- /* Anything not already handled and not a true memory reference
- is an error. */
- else if (TREE_CODE (argtype) != FUNCTION_TYPE
- && TREE_CODE (argtype) != METHOD_TYPE
- && !lvalue_or_else (arg, "unary `&'"))
- return error_mark_node;
-
- /* Ordinary case; arg is a COMPONENT_REF or a decl. */
- /* If the lvalue is const or volatile,
- merge that into the type that the address will point to. */
- if (TREE_CODE_CLASS (TREE_CODE (arg)) == 'd'
- || TREE_CODE_CLASS (TREE_CODE (arg)) == 'r')
- {
- if (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg))
- argtype = cp_build_type_variant (argtype,
- TREE_READONLY (arg),
- TREE_THIS_VOLATILE (arg));
- }
-
- argtype = build_pointer_type (argtype);
-
- if (mark_addressable (arg) == 0)
- return error_mark_node;
-
- {
- tree addr;
-
- if (TREE_CODE (arg) == COMPONENT_REF)
- addr = build_component_addr (arg, argtype,
- "attempt to take address of bit-field structure member `%s'");
- else
- addr = build1 (code, argtype, arg);
-
- /* Address of a static or external variable or
- function counts as a constant */
- if (staticp (arg))
- TREE_CONSTANT (addr) = 1;
-
- if (TREE_CODE (argtype) == POINTER_TYPE &&
- TREE_CODE (TREE_TYPE (argtype)) == METHOD_TYPE)
- {
- build_ptrmemfunc_type (argtype);
- addr = build_ptrmemfunc (argtype, addr, 0);
- }
-
- return addr;
- }
- }
-
- if (!errstring)
- {
- if (argtype == 0)
- argtype = TREE_TYPE (arg);
- return fold (build1 (code, argtype, arg));
- }
-
- error (errstring);
- return error_mark_node;
-}
-
-#if 0
-/* If CONVERSIONS is a conversion expression or a nested sequence of such,
- convert ARG with the same conversions in the same order
- and return the result. */
-
-static tree
-convert_sequence (conversions, arg)
- tree conversions;
- tree arg;
-{
- switch (TREE_CODE (conversions))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- return convert (TREE_TYPE (conversions),
- convert_sequence (TREE_OPERAND (conversions, 0),
- arg));
-
- default:
- return arg;
- }
-}
-#endif
-
-/* Apply unary lvalue-demanding operator CODE to the expression ARG
- for certain kinds of expressions which are not really lvalues
- but which we can accept as lvalues.
-
- If ARG is not a kind of expression we can handle, return zero. */
-
-tree
-unary_complex_lvalue (code, arg)
- enum tree_code code;
- tree arg;
-{
- /* Handle (a, b) used as an "lvalue". */
- if (TREE_CODE (arg) == COMPOUND_EXPR)
- {
- tree real_result = build_unary_op (code, TREE_OPERAND (arg, 1), 0);
- return build (COMPOUND_EXPR, TREE_TYPE (real_result),
- TREE_OPERAND (arg, 0), real_result);
- }
-
- /* Handle (a ? b : c) used as an "lvalue". */
- if (TREE_CODE (arg) == COND_EXPR)
- return rationalize_conditional_expr (code, arg);
-
- if (TREE_CODE (arg) == MODIFY_EXPR
- || TREE_CODE (arg) == PREINCREMENT_EXPR
- || TREE_CODE (arg) == PREDECREMENT_EXPR)
- return unary_complex_lvalue
- (code, build (COMPOUND_EXPR, TREE_TYPE (TREE_OPERAND (arg, 0)),
- arg, TREE_OPERAND (arg, 0)));
-
- if (code != ADDR_EXPR)
- return 0;
-
- /* Handle (a = b) used as an "lvalue" for `&'. */
- if (TREE_CODE (arg) == MODIFY_EXPR
- || TREE_CODE (arg) == INIT_EXPR)
- {
- tree real_result = build_unary_op (code, TREE_OPERAND (arg, 0), 0);
- arg = build (COMPOUND_EXPR, TREE_TYPE (real_result), arg, real_result);
- TREE_NO_UNUSED_WARNING (arg) = 1;
- return arg;
- }
-
- if (TREE_CODE (TREE_TYPE (arg)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (arg)) == METHOD_TYPE
- || TREE_CODE (TREE_TYPE (arg)) == OFFSET_TYPE)
- {
- /* The representation of something of type OFFSET_TYPE
- is really the representation of a pointer to it.
- Here give the representation its true type. */
- tree t;
-
- my_friendly_assert (TREE_CODE (arg) != SCOPE_REF, 313);
-
- if (TREE_CODE (arg) != OFFSET_REF)
- return 0;
-
- t = TREE_OPERAND (arg, 1);
-
- if (TREE_CODE (t) == FUNCTION_DECL) /* Check all this code for right semantics. */
- return build_unary_op (ADDR_EXPR, t, 0);
- if (TREE_CODE (t) == VAR_DECL)
- return build_unary_op (ADDR_EXPR, t, 0);
- else
- {
- tree type;
- tree offset = integer_zero_node;
-
- if (TREE_OPERAND (arg, 0)
- && (TREE_CODE (TREE_OPERAND (arg, 0)) != NOP_EXPR
- || TREE_OPERAND (TREE_OPERAND (arg, 0), 0) != error_mark_node))
- if (TREE_CODE (t) != FIELD_DECL)
- {
- /* Don't know if this should return address to just
- _DECL, or actual address resolved in this expression. */
- sorry ("address of bound pointer-to-member expression");
- return error_mark_node;
- }
-
- type = TREE_TYPE (TREE_OPERAND (arg, 0));
-
- if (TREE_CODE (TREE_TYPE (arg)) == OFFSET_TYPE)
- {
- /* Add in the offset to the intermediate subobject, if any. */
- offset = get_delta_difference (TYPE_OFFSET_BASETYPE (TREE_TYPE (arg)),
- type,
- 0);
- type = TYPE_OFFSET_BASETYPE (TREE_TYPE (arg));
- }
-
- /* Now in the offset to the final subobject. */
- offset = size_binop (PLUS_EXPR,
- offset,
- get_delta_difference (DECL_FIELD_CONTEXT (t),
- type,
- 0));
-
- /* Add in the offset to the field. */
- offset = size_binop (PLUS_EXPR, offset,
- size_binop (EASY_DIV_EXPR,
- DECL_FIELD_BITPOS (t),
- size_int (BITS_PER_UNIT)));
-
- /* We offset all pointer to data memebers by 1 so that we can
- distinguish between a null pointer to data member and the first
- data member of a structure. */
- offset = size_binop (PLUS_EXPR, offset, size_int (1));
-
- return convert (build_pointer_type (TREE_TYPE (arg)), offset);
- }
- }
-
-
- /* We permit compiler to make function calls returning
- objects of aggregate type look like lvalues. */
- {
- tree targ = arg;
-
- if (TREE_CODE (targ) == SAVE_EXPR)
- targ = TREE_OPERAND (targ, 0);
-
- if (TREE_CODE (targ) == CALL_EXPR && IS_AGGR_TYPE (TREE_TYPE (targ)))
- {
- if (TREE_CODE (arg) == SAVE_EXPR)
- targ = arg;
- else
- targ = build_cplus_new (TREE_TYPE (arg), arg);
- return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (arg)), targ);
- }
-
- if (TREE_CODE (arg) == SAVE_EXPR && TREE_CODE (targ) == INDIRECT_REF)
- return build (SAVE_EXPR, build_pointer_type (TREE_TYPE (arg)),
- TREE_OPERAND (targ, 0), current_function_decl, NULL);
- }
-
- /* Don't let anything else be handled specially. */
- return 0;
-}
-
-/* Mark EXP saying that we need to be able to take the
- address of it; it should not be allocated in a register.
- Value is 1 if successful.
-
- C++: we do not allow `current_class_ptr' to be addressable. */
-
-int
-mark_addressable (exp)
- tree exp;
-{
- register tree x = exp;
-
- if (TREE_ADDRESSABLE (x) == 1)
- return 1;
-
- while (1)
- switch (TREE_CODE (x))
- {
- case ADDR_EXPR:
- case COMPONENT_REF:
- case ARRAY_REF:
- x = TREE_OPERAND (x, 0);
- break;
-
- case PARM_DECL:
- if (x == current_class_ptr)
- {
- if (! flag_this_is_variable)
- error ("address of `this' not available");
- TREE_ADDRESSABLE (x) = 1; /* so compiler doesn't die later */
- put_var_into_stack (x);
- return 1;
- }
- case VAR_DECL:
- if (TREE_STATIC (x) && TREE_READONLY (x)
- && DECL_RTL (x) != 0
- && ! DECL_IN_MEMORY_P (x))
- {
- /* We thought this would make a good constant variable,
- but we were wrong. */
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- TREE_ASM_WRITTEN (x) = 0;
- DECL_RTL (x) = 0;
- rest_of_decl_compilation (x, 0, IDENTIFIER_LOCAL_VALUE (x) == 0, 0);
- TREE_ADDRESSABLE (x) = 1;
-
- pop_obstacks ();
-
- return 1;
- }
- /* Caller should not be trying to mark initialized
- constant fields addressable. */
- my_friendly_assert (DECL_LANG_SPECIFIC (x) == 0
- || DECL_IN_AGGR_P (x) == 0
- || TREE_STATIC (x)
- || DECL_EXTERNAL (x), 314);
-
- case CONST_DECL:
- case RESULT_DECL:
- if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
- && !DECL_ARTIFICIAL (x) && extra_warnings)
- cp_warning ("address requested for `%D', which is declared `register'",
- x);
- put_var_into_stack (x);
- TREE_ADDRESSABLE (x) = 1;
- return 1;
-
- case FUNCTION_DECL:
- /* We have to test both conditions here. The first may
- be non-zero in the case of processing a default function.
- The second may be non-zero in the case of a template function. */
- x = DECL_MAIN_VARIANT (x);
- if ((DECL_THIS_INLINE (x) || DECL_PENDING_INLINE_INFO (x))
- && (DECL_CONTEXT (x) == NULL_TREE
- || TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (x))) != 't'
- || ! CLASSTYPE_INTERFACE_ONLY (DECL_CONTEXT (x))))
- {
- mark_inline_for_output (x);
- if (x == current_function_decl)
- DECL_EXTERNAL (x) = 0;
- }
- TREE_ADDRESSABLE (x) = 1;
- TREE_USED (x) = 1;
- TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (x)) = 1;
- return 1;
-
- case CONSTRUCTOR:
- TREE_ADDRESSABLE (x) = 1;
- return 1;
-
- case TARGET_EXPR:
- TREE_ADDRESSABLE (x) = 1;
- mark_addressable (TREE_OPERAND (x, 0));
- return 1;
-
- default:
- return 1;
- }
-}
-
-/* Build and return a conditional expression IFEXP ? OP1 : OP2. */
-
-tree
-build_x_conditional_expr (ifexp, op1, op2)
- tree ifexp, op1, op2;
-{
- tree rval = NULL_TREE;
-
- if (processing_template_decl)
- return build_min_nt (COND_EXPR, ifexp, op1, op2);
-
- if (flag_ansi_overloading)
- return build_new_op (COND_EXPR, LOOKUP_NORMAL, ifexp, op1, op2);
-
- /* See comments in `build_x_binary_op'. */
- if (op1 != 0)
- rval = build_opfncall (COND_EXPR, LOOKUP_SPECULATIVELY, ifexp, op1, op2);
- if (rval)
- return build_opfncall (COND_EXPR, LOOKUP_NORMAL, ifexp, op1, op2);
-
- return build_conditional_expr (ifexp, op1, op2);
-}
-
-tree
-build_conditional_expr (ifexp, op1, op2)
- tree ifexp, op1, op2;
-{
- register tree type1;
- register tree type2;
- register enum tree_code code1;
- register enum tree_code code2;
- register tree result_type = NULL_TREE;
-
- /* If second operand is omitted, it is the same as the first one;
- make sure it is calculated only once. */
- if (op1 == 0)
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids omitting the middle term of a ?: expression");
- ifexp = op1 = save_expr (ifexp);
- }
-
- ifexp = convert (boolean_type_node, ifexp);
-
- if (TREE_CODE (ifexp) == ERROR_MARK)
- return error_mark_node;
-
- op1 = require_instantiated_type (TREE_TYPE (op2), op1, error_mark_node);
- if (op1 == error_mark_node)
- return error_mark_node;
- op2 = require_instantiated_type (TREE_TYPE (op1), op2, error_mark_node);
- if (op2 == error_mark_node)
- return error_mark_node;
-
- /* C++: REFERENCE_TYPES must be dereferenced. */
- type1 = TREE_TYPE (op1);
- code1 = TREE_CODE (type1);
- type2 = TREE_TYPE (op2);
- code2 = TREE_CODE (type2);
-
- if (code1 == REFERENCE_TYPE)
- {
- op1 = convert_from_reference (op1);
- type1 = TREE_TYPE (op1);
- code1 = TREE_CODE (type1);
- }
- if (code2 == REFERENCE_TYPE)
- {
- op2 = convert_from_reference (op2);
- type2 = TREE_TYPE (op2);
- code2 = TREE_CODE (type2);
- }
-
- /* Don't promote the operands separately if they promote
- the same way. Return the unpromoted type and let the combined
- value get promoted if necessary. */
-
- if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2)
- && code2 != ARRAY_TYPE
- && code2 != FUNCTION_TYPE
- && code2 != METHOD_TYPE)
- {
- tree result;
-
- if (TREE_CONSTANT (ifexp)
- && (TREE_CODE (ifexp) == INTEGER_CST
- || TREE_CODE (ifexp) == ADDR_EXPR))
- return (integer_zerop (ifexp) ? op2 : op1);
-
- if (TREE_CODE (op1) == CONST_DECL)
- op1 = DECL_INITIAL (op1);
- else if (TREE_READONLY_DECL_P (op1))
- op1 = decl_constant_value (op1);
- if (TREE_CODE (op2) == CONST_DECL)
- op2 = DECL_INITIAL (op2);
- else if (TREE_READONLY_DECL_P (op2))
- op2 = decl_constant_value (op2);
- if (type1 != type2)
- type1 = cp_build_type_variant
- (type1,
- TREE_READONLY (op1) || TREE_READONLY (op2),
- TREE_THIS_VOLATILE (op1) || TREE_THIS_VOLATILE (op2));
- /* ??? This is a kludge to deal with the fact that
- we don't sort out integers and enums properly, yet. */
- result = fold (build (COND_EXPR, type1, ifexp, op1, op2));
- if (TREE_TYPE (result) != type1)
- result = build1 (NOP_EXPR, type1, result);
- /* Expand both sides into the same slot,
- hopefully the target of the ?: expression. */
- if (TREE_CODE (op1) == TARGET_EXPR && TREE_CODE (op2) == TARGET_EXPR)
- {
- tree slot = build (VAR_DECL, TREE_TYPE (result));
- layout_decl (slot, 0);
- result = build (TARGET_EXPR, TREE_TYPE (result),
- slot, result, NULL_TREE, NULL_TREE);
- }
- return result;
- }
-
- /* They don't match; promote them both and then try to reconcile them.
- But don't permit mismatching enum types. */
- if (code1 == ENUMERAL_TYPE)
- {
- if (code2 == ENUMERAL_TYPE)
- {
- cp_error ("enumeral mismatch in conditional expression: `%T' vs `%T'", type1, type2);
- return error_mark_node;
- }
- else if (extra_warnings && ! IS_AGGR_TYPE_CODE (code2)
- && type2 != type_promotes_to (type1))
- warning ("enumeral and non-enumeral type in conditional expression");
- }
- else if (extra_warnings
- && code2 == ENUMERAL_TYPE && ! IS_AGGR_TYPE_CODE (code1)
- && type1 != type_promotes_to (type2))
- warning ("enumeral and non-enumeral type in conditional expression");
-
- if (code1 != VOID_TYPE)
- {
- op1 = default_conversion (op1);
- type1 = TREE_TYPE (op1);
- if (TYPE_PTRMEMFUNC_P (type1))
- type1 = TYPE_PTRMEMFUNC_FN_TYPE (type1);
- code1 = TREE_CODE (type1);
- }
- if (code2 != VOID_TYPE)
- {
- op2 = default_conversion (op2);
- type2 = TREE_TYPE (op2);
- if (TYPE_PTRMEMFUNC_P (type2))
- type2 = TYPE_PTRMEMFUNC_FN_TYPE (type2);
- code2 = TREE_CODE (type2);
- }
-
- if (code1 == RECORD_TYPE && code2 == RECORD_TYPE
- && real_lvalue_p (op1) && real_lvalue_p (op2)
- && comptypes (type1, type2, -1))
- {
- type1 = build_reference_type (type1);
- type2 = build_reference_type (type2);
- result_type = common_type (type1, type2);
- op1 = convert_to_reference (result_type, op1, CONV_IMPLICIT,
- LOOKUP_NORMAL, NULL_TREE);
- op2 = convert_to_reference (result_type, op2, CONV_IMPLICIT,
- LOOKUP_NORMAL, NULL_TREE);
- }
- /* Quickly detect the usual case where op1 and op2 have the same type
- after promotion. */
- else if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2))
- {
- if (type1 == type2)
- result_type = type1;
- else
- result_type = cp_build_type_variant
- (type1,
- TREE_READONLY (op1) || TREE_READONLY (op2),
- TREE_THIS_VOLATILE (op1) || TREE_THIS_VOLATILE (op2));
- }
- else if ((code1 == INTEGER_TYPE || code1 == REAL_TYPE)
- && (code2 == INTEGER_TYPE || code2 == REAL_TYPE))
- {
- result_type = common_type (type1, type2);
- }
- else if (code1 == VOID_TYPE || code2 == VOID_TYPE)
- {
- if (pedantic && (code1 != VOID_TYPE || code2 != VOID_TYPE))
- pedwarn ("ANSI C++ forbids conditional expr with only one void side");
- result_type = void_type_node;
- }
- else if (code1 == POINTER_TYPE && null_ptr_cst_p (op2))
- result_type = qualify_type (type1, type2);
- else if (code2 == POINTER_TYPE && null_ptr_cst_p (op1))
- result_type = qualify_type (type2, type1);
- else if (code1 == POINTER_TYPE && code2 == POINTER_TYPE)
- {
- if (comp_target_types (type1, type2, 1))
- result_type = common_type (type1, type2);
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (type1)) == void_type_node)
- {
- if (pedantic && TREE_CODE (type2) == FUNCTION_TYPE)
- pedwarn ("ANSI C++ forbids conditional expr between `void *' and function pointer");
- result_type = qualify_type (type1, type2);
- }
- else if (TYPE_MAIN_VARIANT (TREE_TYPE (type2)) == void_type_node)
- {
- if (pedantic && TREE_CODE (type1) == FUNCTION_TYPE)
- pedwarn ("ANSI C++ forbids conditional expr between `void *' and function pointer");
- result_type = qualify_type (type2, type1);
- }
- /* C++ */
- else if (comptypes (type2, type1, 0))
- result_type = type2;
- else if (IS_AGGR_TYPE (TREE_TYPE (type1))
- && IS_AGGR_TYPE (TREE_TYPE (type2))
- && (result_type = common_base_type (TREE_TYPE (type1), TREE_TYPE (type2))))
- {
- if (result_type == error_mark_node)
- {
- cp_error ("common base type of types `%T' and `%T' is ambiguous",
- TREE_TYPE (type1), TREE_TYPE (type2));
- result_type = ptr_type_node;
- }
- else
- {
- if (pedantic
- && result_type != TREE_TYPE (type1)
- && result_type != TREE_TYPE (type2))
- cp_pedwarn ("`%T' and `%T' converted to `%T *' in conditional expression",
- type1, type2, result_type);
-
- result_type = build_pointer_type (result_type);
- }
- }
- else
- {
- pedwarn ("pointer type mismatch in conditional expression");
- result_type = ptr_type_node;
- }
- }
- else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE)
- {
- pedwarn ("pointer/integer type mismatch in conditional expression");
- result_type = type1;
- }
- else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE)
- {
- pedwarn ("pointer/integer type mismatch in conditional expression");
- result_type = type2;
- }
-
- if (!result_type)
- {
- /* The match does not look good. If either is
- an aggregate value, try converting to a scalar type. */
- if (code1 == RECORD_TYPE && code2 == RECORD_TYPE)
- {
- cp_error ("aggregate mismatch in conditional expression: `%T' vs `%T'", type1, type2);
- return error_mark_node;
- }
- /* Warning: this code assumes that conversion between cv-variants of
- a type is done using NOP_EXPRs. */
- if (code1 == RECORD_TYPE && TYPE_HAS_CONVERSION (type1))
- {
- /* There are other types besides pointers and records. */
- tree tmp;
- if (code2 == POINTER_TYPE)
- tmp = build_pointer_type
- (build_type_variant (TREE_TYPE (type2), 1, 1));
- else
- tmp = type2;
- tmp = build_type_conversion (CONVERT_EXPR, tmp, op1, 0);
- if (tmp == NULL_TREE)
- {
- cp_error ("incompatible types `%T' and `%T' in `?:'",
- type1, type2);
- return error_mark_node;
- }
- if (tmp == error_mark_node)
- error ("ambiguous pointer conversion");
- else
- STRIP_NOPS (tmp);
- result_type = common_type (type2, TREE_TYPE (tmp));
- op1 = tmp;
- }
- else if (code2 == RECORD_TYPE && TYPE_HAS_CONVERSION (type2))
- {
- tree tmp;
- if (code1 == POINTER_TYPE)
- tmp = build_pointer_type
- (build_type_variant (TREE_TYPE (type1), 1, 1));
- else
- tmp = type1;
-
- tmp = build_type_conversion (CONVERT_EXPR, tmp, op2, 0);
- if (tmp == NULL_TREE)
- {
- cp_error ("incompatible types `%T' and `%T' in `?:'",
- type1, type2);
- return error_mark_node;
- }
- if (tmp == error_mark_node)
- error ("ambiguous pointer conversion");
- else
- STRIP_NOPS (tmp);
- result_type = common_type (type1, TREE_TYPE (tmp));
- op2 = tmp;
- }
- else if (flag_cond_mismatch)
- result_type = void_type_node;
- else
- {
- error ("type mismatch in conditional expression");
- return error_mark_node;
- }
- }
-
- if (TREE_CODE (result_type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
- result_type = build_ptrmemfunc_type (result_type);
-
- if (result_type != TREE_TYPE (op1))
- op1 = convert_and_check (result_type, op1);
- if (result_type != TREE_TYPE (op2))
- op2 = convert_and_check (result_type, op2);
-
- if (TREE_CONSTANT (ifexp))
- return integer_zerop (ifexp) ? op2 : op1;
-
- return convert_from_reference
- (fold (build (COND_EXPR, result_type, ifexp, op1, op2)));
-}
-
-/* Handle overloading of the ',' operator when needed. Otherwise,
- this function just builds an expression list. */
-
-tree
-build_x_compound_expr (list)
- tree list;
-{
- tree rest = TREE_CHAIN (list);
- tree result;
-
- if (processing_template_decl)
- return build_min_nt (COMPOUND_EXPR, list, NULL_TREE);
-
- if (rest == NULL_TREE)
- return build_compound_expr (list);
-
- result = build_opfncall (COMPOUND_EXPR, LOOKUP_NORMAL,
- TREE_VALUE (list), TREE_VALUE (rest), NULL_TREE);
- if (result)
- return build_x_compound_expr (tree_cons (NULL_TREE, result, TREE_CHAIN (rest)));
-
- if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)))
- {
- /* the left-hand operand of a comma expression is like an expression
- statement: we should warn if it doesn't have any side-effects,
- unless it was explicitly cast to (void). */
- if ((extra_warnings || warn_unused)
- && !(TREE_CODE (TREE_VALUE(list)) == CONVERT_EXPR
- && TREE_TYPE (TREE_VALUE(list)) == void_type_node))
- warning("left-hand operand of comma expression has no effect");
- }
-#if 0 /* this requires a gcc backend patch to export warn_if_unused_value */
- else if (warn_unused)
- warn_if_unused_value (TREE_VALUE(list));
-#endif
-
- return build_compound_expr (tree_cons (NULL_TREE, TREE_VALUE (list),
- build_tree_list (NULL_TREE, build_x_compound_expr (rest))));
-}
-
-/* Given a list of expressions, return a compound expression
- that performs them all and returns the value of the last of them. */
-
-tree
-build_compound_expr (list)
- tree list;
-{
- register tree rest;
-
- if (TREE_READONLY_DECL_P (TREE_VALUE (list)))
- TREE_VALUE (list) = decl_constant_value (TREE_VALUE (list));
-
- if (TREE_CHAIN (list) == 0)
- {
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Strip such NOP_EXPRs, since LIST is used in non-lvalue context. */
- if (TREE_CODE (list) == NOP_EXPR
- && TREE_TYPE (list) == TREE_TYPE (TREE_OPERAND (list, 0)))
- list = TREE_OPERAND (list, 0);
-
- /* Convert arrays to pointers. */
- if (TREE_CODE (TREE_TYPE (TREE_VALUE (list))) == ARRAY_TYPE)
- return default_conversion (TREE_VALUE (list));
- else
- return TREE_VALUE (list);
- }
-
- rest = build_compound_expr (TREE_CHAIN (list));
-
- /* When pedantic, a compound expression cannot be a constant expression. */
- if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)) && ! pedantic)
- return rest;
-
- return build (COMPOUND_EXPR, TREE_TYPE (rest),
- break_out_cleanups (TREE_VALUE (list)), rest);
-}
-
-tree
-build_static_cast (type, expr)
- tree type, expr;
-{
- tree intype, binfo;
- int ok;
-
- if (type == error_mark_node || expr == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (expr) == OFFSET_REF)
- expr = resolve_offset_ref (expr);
-
- if (processing_template_decl)
- {
- tree t = build_min (STATIC_CAST_EXPR, type, expr);
- return t;
- }
-
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Strip such NOP_EXPRs if VALUE is being used in non-lvalue context. */
- if (TREE_CODE (type) != REFERENCE_TYPE
- && TREE_CODE (expr) == NOP_EXPR
- && TREE_TYPE (expr) == TREE_TYPE (TREE_OPERAND (expr, 0)))
- expr = TREE_OPERAND (expr, 0);
-
- if (TREE_CODE (type) == VOID_TYPE)
- return build1 (CONVERT_EXPR, type, expr);
-
- if (type_unknown_p (expr))
- {
- expr = instantiate_type (type, expr, 1);
- if (expr == error_mark_node)
- return error_mark_node;
- }
-
- if (TREE_CODE (type) == REFERENCE_TYPE)
- return (convert_from_reference
- (convert_to_reference (type, expr, CONV_STATIC|CONV_IMPLICIT,
- LOOKUP_COMPLAIN, NULL_TREE)));
-
- if (IS_AGGR_TYPE (type))
- return build_cplus_new
- (type, (build_method_call
- (NULL_TREE, ctor_identifier, build_tree_list (NULL_TREE, expr),
- TYPE_BINFO (type), LOOKUP_NORMAL)));
-
- expr = decay_conversion (expr);
- intype = TREE_TYPE (expr);
-
- /* FIXME handle casting to array type. */
-
- ok = 0;
- if (can_convert_arg (type, intype, expr))
- ok = 1;
- else if (TYPE_PTROB_P (type) && TYPE_PTROB_P (intype))
- {
- tree binfo;
- if (IS_AGGR_TYPE (TREE_TYPE (type)) && IS_AGGR_TYPE (TREE_TYPE (intype))
- && (TYPE_READONLY (TREE_TYPE (type))
- >= TYPE_READONLY (TREE_TYPE (intype)))
- && (TYPE_VOLATILE (TREE_TYPE (type))
- >= TYPE_VOLATILE (TREE_TYPE (intype)))
- && (binfo = get_binfo (TREE_TYPE (intype), TREE_TYPE (type), 0))
- && ! TREE_VIA_VIRTUAL (binfo))
- ok = 1;
- }
- else if (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
- {
- if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))),
- TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (intype))), 1)
- && (TYPE_READONLY (TREE_TYPE (TREE_TYPE (type)))
- >= TYPE_READONLY (TREE_TYPE (TREE_TYPE (intype))))
- && (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (type)))
- >= TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (intype))))
- && (binfo = get_binfo (TYPE_OFFSET_BASETYPE (intype),
- TYPE_OFFSET_BASETYPE (type), 0))
- && ! TREE_VIA_VIRTUAL (binfo))
- ok = 1;
- }
- else if (TREE_CODE (intype) != BOOLEAN_TYPE
- && TREE_CODE (type) != ARRAY_TYPE
- && TREE_CODE (type) != FUNCTION_TYPE
- && can_convert (intype, type))
- ok = 1;
-
- if (ok)
- return build_c_cast (type, expr);
-
- cp_error ("static_cast from `%T' to `%T'", intype, type);
- return error_mark_node;
-}
-
-tree
-build_reinterpret_cast (type, expr)
- tree type, expr;
-{
- tree intype;
-
- if (type == error_mark_node || expr == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (expr) == OFFSET_REF)
- expr = resolve_offset_ref (expr);
-
- if (processing_template_decl)
- {
- tree t = build_min (REINTERPRET_CAST_EXPR, type, expr);
- return t;
- }
-
- if (TREE_CODE (type) != REFERENCE_TYPE)
- {
- expr = decay_conversion (expr);
-
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Strip such NOP_EXPRs if VALUE is being used in non-lvalue context. */
- if (TREE_CODE (expr) == NOP_EXPR
- && TREE_TYPE (expr) == TREE_TYPE (TREE_OPERAND (expr, 0)))
- expr = TREE_OPERAND (expr, 0);
- }
-
- if (type_unknown_p (expr))
- {
- expr = instantiate_type (type, expr, 1);
- if (expr == error_mark_node)
- return error_mark_node;
- }
-
- intype = TREE_TYPE (expr);
-
- if (TREE_CODE (type) == REFERENCE_TYPE)
- {
- if (! real_lvalue_p (expr))
- {
- cp_error ("reinterpret_cast from `%T' rvalue to `%T'", intype, type);
- return error_mark_node;
- }
- expr = build_unary_op (ADDR_EXPR, expr, 0);
- if (expr != error_mark_node)
- expr = build_reinterpret_cast
- (build_pointer_type (TREE_TYPE (type)), expr);
- if (expr != error_mark_node)
- expr = build_indirect_ref (expr, 0);
- return expr;
- }
- else if (comptypes (TYPE_MAIN_VARIANT (intype), TYPE_MAIN_VARIANT (type), 1))
- return build_static_cast (type, expr);
-
- if (TYPE_PTR_P (type) && (TREE_CODE (intype) == INTEGER_TYPE
- || TREE_CODE (intype) == ENUMERAL_TYPE))
- /* OK */;
- else if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PTR_P (intype))
- {
- if (TYPE_PRECISION (type) < TYPE_PRECISION (intype))
- cp_pedwarn ("reinterpret_cast from `%T' to `%T' loses precision",
- intype, type);
- }
- else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype))
- || (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
- {
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
- return fold (build1 (NOP_EXPR, type, expr));
- }
- else if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
- || (TYPE_PTROBV_P (type) && TYPE_PTROBV_P (intype)))
- {
- if (! comp_ptr_ttypes_reinterpret (TREE_TYPE (type), TREE_TYPE (intype)))
- cp_pedwarn ("reinterpret_cast from `%T' to `%T' casts away const (or volatile)",
- intype, type);
-
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
- return fold (build1 (NOP_EXPR, type, expr));
- }
- else
- {
- cp_error ("reinterpret_cast from `%T' to `%T'", intype, type);
- return error_mark_node;
- }
-
- return convert (type, expr);
-}
-
-tree
-build_const_cast (type, expr)
- tree type, expr;
-{
- tree intype;
-
- if (type == error_mark_node || expr == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (expr) == OFFSET_REF)
- expr = resolve_offset_ref (expr);
-
- if (processing_template_decl)
- {
- tree t = build_min (CONST_CAST_EXPR, type, expr);
- return t;
- }
-
- if (TREE_CODE (type) != REFERENCE_TYPE)
- {
- expr = decay_conversion (expr);
-
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Strip such NOP_EXPRs if VALUE is being used in non-lvalue context. */
- if (TREE_CODE (expr) == NOP_EXPR
- && TREE_TYPE (expr) == TREE_TYPE (TREE_OPERAND (expr, 0)))
- expr = TREE_OPERAND (expr, 0);
- }
-
- if (type_unknown_p (expr))
- {
- expr = instantiate_type (type, expr, 1);
- if (expr == error_mark_node)
- return error_mark_node;
- }
-
- intype = TREE_TYPE (expr);
-
- if (comptypes (TYPE_MAIN_VARIANT (intype), TYPE_MAIN_VARIANT (type), 1))
- return build_static_cast (type, expr);
- else if (TREE_CODE (type) == REFERENCE_TYPE)
- {
- if (! real_lvalue_p (expr))
- {
- cp_error ("const_cast from `%T' rvalue to `%T'", intype, type);
- return error_mark_node;
- }
-
- if (comp_ptr_ttypes_const (TREE_TYPE (type), intype))
- return (convert_from_reference
- (convert_to_reference (type, expr, CONV_CONST|CONV_IMPLICIT,
- LOOKUP_COMPLAIN, NULL_TREE)));
- }
- else if (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (intype) == POINTER_TYPE
- && comp_ptr_ttypes_const (TREE_TYPE (type), TREE_TYPE (intype)))
- return convert (type, expr);
-
- cp_error ("const_cast from `%T' to `%T'", intype, type);
- return error_mark_node;
-}
-
-/* Build an expression representing a cast to type TYPE of expression EXPR.
-
- ALLOW_NONCONVERTING is true if we should allow non-converting constructors
- when doing the cast. */
-
-tree
-build_c_cast (type, expr)
- tree type, expr;
-{
- register tree value = expr;
-
- if (type == error_mark_node || expr == error_mark_node)
- return error_mark_node;
-
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Strip such NOP_EXPRs if VALUE is being used in non-lvalue context. */
- if (TREE_CODE (type) != REFERENCE_TYPE
- && TREE_CODE (value) == NOP_EXPR
- && TREE_TYPE (value) == TREE_TYPE (TREE_OPERAND (value, 0)))
- value = TREE_OPERAND (value, 0);
-
- if (TREE_TYPE (expr)
- && TREE_CODE (TREE_TYPE (expr)) == OFFSET_TYPE
- && TREE_CODE (type) != OFFSET_TYPE)
- value = resolve_offset_ref (value);
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- /* Allow casting from T1* to T2[] because Cfront allows it.
- NIHCL uses it. It is not valid ANSI C however, and hence, not
- valid ANSI C++. */
- if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
- {
- if (pedantic)
- pedwarn ("ANSI C++ forbids casting to an array type");
- type = build_pointer_type (TREE_TYPE (type));
- }
- else
- {
- error ("ANSI C++ forbids casting to an array type");
- return error_mark_node;
- }
- }
-
- if (TREE_CODE (type) == FUNCTION_TYPE
- || TREE_CODE (type) == METHOD_TYPE)
- {
- cp_error ("casting to function type `%T'", type);
- return error_mark_node;
- }
-
- if (IS_SIGNATURE (type))
- {
- error ("cast specifies signature type");
- return error_mark_node;
- }
-
- if (processing_template_decl)
- {
- tree t = build_min (CAST_EXPR, type,
- min_tree_cons (NULL_TREE, value, NULL_TREE));
- return t;
- }
-
- if (TREE_CODE (type) == VOID_TYPE)
- value = build1 (CONVERT_EXPR, type, value);
- else if (TREE_TYPE (value) == NULL_TREE
- || type_unknown_p (value))
- {
- value = instantiate_type (type, value, 1);
- /* Did we lose? */
- if (value == error_mark_node)
- return error_mark_node;
- }
- else
- {
- tree otype;
-
- /* Convert functions and arrays to pointers and
- convert references to their expanded types,
- but don't convert any other types. */
- if (TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE
- || (TREE_CODE (TREE_TYPE (value)) == METHOD_TYPE
- /* Don't do the default conversion if we want a
- pointer to a function. */
- && TREE_CODE (type) != POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE)
- || TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (value)) == REFERENCE_TYPE)
- value = default_conversion (value);
- otype = TREE_TYPE (value);
-
- /* Optionally warn about potentially worrisome casts. */
-
- if (warn_cast_qual
- && TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (otype) == POINTER_TYPE)
- {
- /* For C++ we make these regular warnings, rather than
- softening them into pedwarns. */
- if (TYPE_VOLATILE (TREE_TYPE (otype))
- && ! TYPE_VOLATILE (TREE_TYPE (type)))
- warning ("cast discards `volatile' from pointer target type");
- if (TYPE_READONLY (TREE_TYPE (otype))
- && ! TYPE_READONLY (TREE_TYPE (type)))
- warning ("cast discards `const' from pointer target type");
- }
-
- /* Warn about possible alignment problems. */
- if (STRICT_ALIGNMENT && warn_cast_align
- && TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (otype) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE
- && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
- && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
- warning ("cast increases required alignment of target type");
-
-#if 0
- /* We should see about re-enabling these, they seem useful to
- me. */
- if (TREE_CODE (type) == INTEGER_TYPE
- && TREE_CODE (otype) == POINTER_TYPE
- && TYPE_PRECISION (type) != TYPE_PRECISION (otype))
- warning ("cast from pointer to integer of different size");
-
- if (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (otype) == INTEGER_TYPE
- && TYPE_PRECISION (type) != TYPE_PRECISION (otype)
- /* Don't warn about converting 0 to pointer,
- provided the 0 was explicit--not cast or made by folding. */
- && !(TREE_CODE (value) == INTEGER_CST && integer_zerop (value)))
- warning ("cast to pointer from integer of different size");
-#endif
-
- if (TREE_CODE (type) == REFERENCE_TYPE)
- value = (convert_from_reference
- (convert_to_reference (type, value, CONV_C_CAST,
- LOOKUP_COMPLAIN, NULL_TREE)));
- else
- {
- tree ovalue;
-
- if (TREE_READONLY_DECL_P (value))
- value = decl_constant_value (value);
-
- ovalue = value;
- value = convert_force (type, value, CONV_C_CAST);
-
- /* Ignore any integer overflow caused by the cast. */
- if (TREE_CODE (value) == INTEGER_CST)
- {
- TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue);
- TREE_CONSTANT_OVERFLOW (value) = TREE_CONSTANT_OVERFLOW (ovalue);
- }
- }
- }
-
- /* Always produce some operator for an explicit cast,
- so we can tell (for -pedantic) that the cast is no lvalue. */
- if (TREE_CODE (type) != REFERENCE_TYPE && value == expr
- && real_lvalue_p (value))
- value = non_lvalue (value);
-
- return value;
-}
-
-tree
-expand_target_expr (t)
- tree t;
-{
- extern int temp_slot_level;
- extern int target_temp_slot_level;
- int old_temp_level = target_temp_slot_level;
-
- tree xval = make_node (RTL_EXPR);
- rtx rtxval;
-
- /* Any TARGET_EXPR temps live only as long as the outer temp level.
- Since they are preserved in this new inner level, we know they
- will make it into the outer level. */
- push_temp_slots ();
- target_temp_slot_level = temp_slot_level;
-
- do_pending_stack_adjust ();
- start_sequence_for_rtl_expr (xval);
- emit_note (0, -1);
- rtxval = expand_expr (t, NULL_RTX, VOIDmode, 0);
- do_pending_stack_adjust ();
- TREE_SIDE_EFFECTS (xval) = 1;
- RTL_EXPR_SEQUENCE (xval) = get_insns ();
- end_sequence ();
- RTL_EXPR_RTL (xval) = rtxval;
- TREE_TYPE (xval) = TREE_TYPE (t);
-
- pop_temp_slots ();
- target_temp_slot_level = old_temp_level;
-
- return xval;
-}
-
-/* Build an assignment expression of lvalue LHS from value RHS.
- MODIFYCODE is the code for a binary operator that we use
- to combine the old value of LHS with RHS to get the new value.
- Or else MODIFYCODE is NOP_EXPR meaning do a simple assignment.
-
- C++: If MODIFYCODE is INIT_EXPR, then leave references unbashed. */
-
-tree
-build_modify_expr (lhs, modifycode, rhs)
- tree lhs;
- enum tree_code modifycode;
- tree rhs;
-{
- register tree result;
- tree newrhs = rhs;
- tree lhstype = TREE_TYPE (lhs);
- tree olhstype = lhstype;
- tree olhs = lhs;
-
- /* Avoid duplicate error messages from operands that had errors. */
- if (lhs == error_mark_node || rhs == error_mark_node)
- return error_mark_node;
-
- /* Types that aren't fully specified cannot be used in assignments. */
- lhs = require_complete_type (lhs);
-
- newrhs = rhs;
-
- /* Handle assignment to signature pointers/refs. */
-
- if (TYPE_LANG_SPECIFIC (lhstype) &&
- (IS_SIGNATURE_POINTER (lhstype) || IS_SIGNATURE_REFERENCE (lhstype)))
- {
- return build_signature_pointer_constructor (lhs, rhs);
- }
-
- /* Handle control structure constructs used as "lvalues". */
-
- switch (TREE_CODE (lhs))
- {
- /* Handle --foo = 5; as these are valid constructs in C++ */
- case PREDECREMENT_EXPR:
- case PREINCREMENT_EXPR:
- if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0)))
- lhs = build (TREE_CODE (lhs), TREE_TYPE (lhs),
- stabilize_reference (TREE_OPERAND (lhs, 0)),
- TREE_OPERAND (lhs, 1));
- return build (COMPOUND_EXPR, lhstype,
- lhs,
- build_modify_expr (TREE_OPERAND (lhs, 0),
- modifycode, rhs));
-
- /* Handle (a, b) used as an "lvalue". */
- case COMPOUND_EXPR:
- newrhs = build_modify_expr (TREE_OPERAND (lhs, 1),
- modifycode, rhs);
- if (newrhs == error_mark_node)
- return error_mark_node;
- return build (COMPOUND_EXPR, lhstype,
- TREE_OPERAND (lhs, 0), newrhs);
-
- case MODIFY_EXPR:
- newrhs = build_modify_expr (TREE_OPERAND (lhs, 0), modifycode, rhs);
- if (newrhs == error_mark_node)
- return error_mark_node;
- return build (COMPOUND_EXPR, lhstype, lhs, newrhs);
-
- /* Handle (a ? b : c) used as an "lvalue". */
- case COND_EXPR:
- rhs = save_expr (rhs);
- {
- /* Produce (a ? (b = rhs) : (c = rhs))
- except that the RHS goes through a save-expr
- so the code to compute it is only emitted once. */
- tree cond
- = build_conditional_expr (TREE_OPERAND (lhs, 0),
- build_modify_expr (convert (TREE_TYPE (lhs), TREE_OPERAND (lhs, 1)),
- modifycode, rhs),
- build_modify_expr (convert (TREE_TYPE (lhs), TREE_OPERAND (lhs, 2)),
- modifycode, rhs));
- if (cond == error_mark_node)
- return cond;
- /* Make sure the code to compute the rhs comes out
- before the split. */
- return build (COMPOUND_EXPR, TREE_TYPE (lhs),
- /* Case to void to suppress warning
- from warn_if_unused_value. */
- convert (void_type_node, rhs), cond);
- }
- }
-
- if (TREE_CODE (lhs) == OFFSET_REF)
- {
- if (TREE_OPERAND (lhs, 0) == NULL_TREE)
- {
- /* Static class member? */
- tree member = TREE_OPERAND (lhs, 1);
- if (TREE_CODE (member) == VAR_DECL)
- lhs = member;
- else
- {
- compiler_error ("invalid static class member");
- return error_mark_node;
- }
- }
- else
- lhs = resolve_offset_ref (lhs);
-
- olhstype = lhstype = TREE_TYPE (lhs);
- }
-
- if (TREE_CODE (lhstype) == REFERENCE_TYPE
- && modifycode != INIT_EXPR)
- {
- lhs = convert_from_reference (lhs);
- olhstype = lhstype = TREE_TYPE (lhs);
- }
-
- /* If a binary op has been requested, combine the old LHS value with the RHS
- producing the value we should actually store into the LHS. */
-
- if (modifycode == INIT_EXPR)
- {
- if (! IS_AGGR_TYPE (lhstype))
- /* Do the default thing */;
- else if (! TYPE_HAS_CONSTRUCTOR (lhstype))
- {
- cp_error ("`%T' has no constructors", lhstype);
- return error_mark_node;
- }
- else if (TYPE_HAS_TRIVIAL_INIT_REF (lhstype)
- && TYPE_MAIN_VARIANT (lhstype) == TYPE_MAIN_VARIANT (TREE_TYPE (newrhs)))
- /* Do the default thing */;
- else
- {
- result = build_method_call (lhs, ctor_identifier,
- build_tree_list (NULL_TREE, rhs),
- TYPE_BINFO (lhstype), LOOKUP_NORMAL);
- if (result == NULL_TREE)
- return error_mark_node;
- return result;
- }
- }
- else if (modifycode == NOP_EXPR)
- {
- /* `operator=' is not an inheritable operator. */
- if (! IS_AGGR_TYPE (lhstype))
- /* Do the default thing */;
- else if (! TYPE_HAS_ASSIGNMENT (lhstype))
- {
- cp_error ("`%T' does not define operator=", lhstype);
- return error_mark_node;
- }
- else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (lhstype)
- && TYPE_MAIN_VARIANT (lhstype) == TYPE_MAIN_VARIANT (TREE_TYPE (newrhs)))
- {
- build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL,
- lhs, rhs, make_node (NOP_EXPR));
-
- /* Do the default thing */;
- }
- else
- {
- result = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL,
- lhs, rhs, make_node (NOP_EXPR));
- if (result == NULL_TREE)
- return error_mark_node;
- return result;
- }
- lhstype = olhstype;
- }
- else if (PROMOTES_TO_AGGR_TYPE (lhstype, REFERENCE_TYPE))
- {
- /* This case must convert to some sort of lvalue that
- can participate in an op= operation. */
- tree lhs_tmp = lhs;
- tree rhs_tmp = rhs;
- if (build_default_binary_type_conversion (modifycode, &lhs_tmp, &rhs_tmp))
- {
- lhs = stabilize_reference (lhs_tmp);
- /* Forget it was ever anything else. */
- olhstype = lhstype = TREE_TYPE (lhs);
- newrhs = build_binary_op (modifycode, lhs, rhs_tmp, 1);
- }
- else
- {
- cp_error ("no match for `%Q(%#T, %#T)'", modifycode,
- TREE_TYPE (lhs), TREE_TYPE (rhs));
- return error_mark_node;
- }
- }
- else
- {
- lhs = stabilize_reference (lhs);
- newrhs = build_binary_op (modifycode, lhs, rhs, 1);
- if (newrhs == error_mark_node)
- {
- cp_error (" in evaluation of `%Q(%#T, %#T)'", modifycode,
- TREE_TYPE (lhs), TREE_TYPE (rhs));
- return error_mark_node;
- }
- }
-
- /* Handle a cast used as an "lvalue".
- We have already performed any binary operator using the value as cast.
- Now convert the result to the cast type of the lhs,
- and then true type of the lhs and store it there;
- then convert result back to the cast type to be the value
- of the assignment. */
-
- switch (TREE_CODE (lhs))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- if (TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (newrhs)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (newrhs)) == METHOD_TYPE
- || TREE_CODE (TREE_TYPE (newrhs)) == OFFSET_TYPE)
- newrhs = default_conversion (newrhs);
- {
- tree inner_lhs = TREE_OPERAND (lhs, 0);
- tree result;
-
- /* WP 5.4.1: The result is an lvalue if T is a reference type,
- otherwise the result is an rvalue. */
- if (! lvalue_p (lhs))
- pedwarn ("ANSI C++ forbids cast to non-reference type used as lvalue");
-
- result = build_modify_expr (inner_lhs, NOP_EXPR,
- convert (TREE_TYPE (inner_lhs),
- convert (lhstype, newrhs)));
- if (result == error_mark_node)
- return result;
- return convert (TREE_TYPE (lhs), result);
- }
- }
-
- /* Now we have handled acceptable kinds of LHS that are not truly lvalues.
- Reject anything strange now. */
-
- if (!lvalue_or_else (lhs, "assignment"))
- return error_mark_node;
-
- GNU_xref_assign (lhs);
-
- /* Warn about storing in something that is `const'. */
- /* For C++, don't warn if this is initialization. */
- if (modifycode != INIT_EXPR
- /* For assignment to `const' signature pointer/reference fields,
- don't warn either, we already printed a better message before. */
- && ! (TREE_CODE (lhs) == COMPONENT_REF
- && (IS_SIGNATURE_POINTER (TREE_TYPE (TREE_OPERAND (lhs, 0)))
- || IS_SIGNATURE_REFERENCE (TREE_TYPE (TREE_OPERAND (lhs, 0)))))
- && (TREE_READONLY (lhs) || TYPE_READONLY (lhstype)
- || ((TREE_CODE (lhstype) == RECORD_TYPE
- || TREE_CODE (lhstype) == UNION_TYPE)
- && C_TYPE_FIELDS_READONLY (lhstype))
- || (TREE_CODE (lhstype) == REFERENCE_TYPE
- && TYPE_READONLY (TREE_TYPE (lhstype)))))
- readonly_error (lhs, "assignment", 0);
-
- /* If storing into a structure or union member,
- it has probably been given type `int'.
- Compute the type that would go with
- the actual amount of storage the member occupies. */
-
- if (TREE_CODE (lhs) == COMPONENT_REF
- && (TREE_CODE (lhstype) == INTEGER_TYPE
- || TREE_CODE (lhstype) == REAL_TYPE
- || TREE_CODE (lhstype) == ENUMERAL_TYPE))
- {
- lhstype = TREE_TYPE (get_unwidened (lhs, 0));
-
- /* If storing in a field that is in actuality a short or narrower
- than one, we must store in the field in its actual type. */
-
- if (lhstype != TREE_TYPE (lhs))
- {
- lhs = copy_node (lhs);
- TREE_TYPE (lhs) = lhstype;
- }
- }
-
- /* check to see if there is an assignment to `this' */
- if (lhs == current_class_ptr)
- {
- if (flag_this_is_variable > 0
- && DECL_NAME (current_function_decl) != NULL_TREE
- && (DECL_NAME (current_function_decl)
- != constructor_name (current_class_type)))
- warning ("assignment to `this' not in constructor or destructor");
- current_function_just_assigned_this = 1;
- }
-
- /* The TREE_TYPE of RHS may be TYPE_UNKNOWN. This can happen
- when the type of RHS is not yet known, i.e. its type
- is inherited from LHS. */
- rhs = require_instantiated_type (lhstype, newrhs, error_mark_node);
- if (rhs == error_mark_node)
- return error_mark_node;
- newrhs = rhs;
-
- if (modifycode != INIT_EXPR)
- {
- /* Make modifycode now either a NOP_EXPR or an INIT_EXPR. */
- modifycode = NOP_EXPR;
- /* Reference-bashing */
- if (TREE_CODE (lhstype) == REFERENCE_TYPE)
- {
- tree tmp = convert_from_reference (lhs);
- lhstype = TREE_TYPE (tmp);
- if (TYPE_SIZE (lhstype) == 0)
- {
- incomplete_type_error (lhs, lhstype);
- return error_mark_node;
- }
- lhs = tmp;
- olhstype = lhstype;
- }
- if (TREE_CODE (TREE_TYPE (newrhs)) == REFERENCE_TYPE)
- {
- tree tmp = convert_from_reference (newrhs);
- if (TYPE_SIZE (TREE_TYPE (tmp)) == 0)
- {
- incomplete_type_error (newrhs, TREE_TYPE (tmp));
- return error_mark_node;
- }
- newrhs = tmp;
- }
- }
-
- if (TREE_SIDE_EFFECTS (lhs))
- lhs = stabilize_reference (lhs);
- if (TREE_SIDE_EFFECTS (newrhs))
- newrhs = stabilize_reference (newrhs);
-
- /* Convert new value to destination type. */
-
- if (TREE_CODE (lhstype) == ARRAY_TYPE)
- {
- int from_array;
-
- if (! comptypes (lhstype, TREE_TYPE (rhs), 0))
- {
- cp_error ("incompatible types in assignment of `%T' to `%T'",
- TREE_TYPE (rhs), lhstype);
- return error_mark_node;
- }
-
- /* Allow array assignment in compiler-generated code. */
- if (pedantic && ! DECL_ARTIFICIAL (current_function_decl))
- pedwarn ("ANSI C++ forbids assignment of arrays");
-
- /* Have to wrap this in RTL_EXPR for two cases:
- in base or member initialization and if we
- are a branch of a ?: operator. Since we
- can't easily know the latter, just do it always. */
-
- result = make_node (RTL_EXPR);
-
- TREE_TYPE (result) = void_type_node;
- do_pending_stack_adjust ();
- start_sequence_for_rtl_expr (result);
-
- /* As a matter of principle, `start_sequence' should do this. */
- emit_note (0, -1);
-
- from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
- ? 1 + (modifycode != INIT_EXPR): 0;
- expand_vec_init (lhs, lhs, array_type_nelts (lhstype), newrhs,
- from_array);
-
- do_pending_stack_adjust ();
-
- TREE_SIDE_EFFECTS (result) = 1;
- RTL_EXPR_SEQUENCE (result) = get_insns ();
- RTL_EXPR_RTL (result) = const0_rtx;
- end_sequence ();
- return result;
- }
-
- if (modifycode == INIT_EXPR)
- {
- newrhs = convert_for_initialization (lhs, lhstype, newrhs, LOOKUP_NORMAL,
- "assignment", NULL_TREE, 0);
- if (lhs == DECL_RESULT (current_function_decl))
- {
- if (DECL_INITIAL (lhs))
- warning ("return value from function receives multiple initializations");
- DECL_INITIAL (lhs) = newrhs;
- }
- }
- else
- {
- /* Avoid warnings on enum bit fields. */
- if (TREE_CODE (olhstype) == ENUMERAL_TYPE
- && TREE_CODE (lhstype) == INTEGER_TYPE)
- {
- newrhs = convert_for_assignment (olhstype, newrhs, "assignment",
- NULL_TREE, 0);
- newrhs = convert_force (lhstype, newrhs, 0);
- }
- else
- newrhs = convert_for_assignment (lhstype, newrhs, "assignment",
- NULL_TREE, 0);
- if (TREE_CODE (newrhs) == CALL_EXPR
- && TYPE_NEEDS_CONSTRUCTING (lhstype))
- newrhs = build_cplus_new (lhstype, newrhs);
-
- /* Can't initialize directly from a TARGET_EXPR, since that would
- cause the lhs to be constructed twice, and possibly result in
- accidental self-initialization. So we force the TARGET_EXPR to be
- expanded without a target. */
- if (TREE_CODE (newrhs) == TARGET_EXPR)
- newrhs = build (COMPOUND_EXPR, TREE_TYPE (newrhs), newrhs,
- TREE_OPERAND (newrhs, 0));
- }
-
- if (newrhs == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (newrhs) == COND_EXPR)
- {
- tree lhs1;
- tree cond = TREE_OPERAND (newrhs, 0);
-
- if (TREE_SIDE_EFFECTS (lhs))
- cond = build_compound_expr (tree_cons
- (NULL_TREE, lhs,
- build_tree_list (NULL_TREE, cond)));
-
- /* Cannot have two identical lhs on this one tree (result) as preexpand
- calls will rip them out and fill in RTL for them, but when the
- rtl is generated, the calls will only be in the first side of the
- condition, not on both, or before the conditional jump! (mrs) */
- lhs1 = break_out_calls (lhs);
-
- if (lhs == lhs1)
- /* If there's no change, the COND_EXPR behaves like any other rhs. */
- result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR,
- lhstype, lhs, newrhs);
- else
- {
- tree result_type = TREE_TYPE (newrhs);
- /* We have to convert each arm to the proper type because the
- types may have been munged by constant folding. */
- result
- = build (COND_EXPR, result_type, cond,
- build_modify_expr (lhs, modifycode,
- convert (result_type,
- TREE_OPERAND (newrhs, 1))),
- build_modify_expr (lhs1, modifycode,
- convert (result_type,
- TREE_OPERAND (newrhs, 2))));
- }
- }
- else
- result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR,
- lhstype, lhs, newrhs);
-
- TREE_SIDE_EFFECTS (result) = 1;
-
- /* If we got the LHS in a different type for storing in,
- convert the result back to the nominal type of LHS
- so that the value we return always has the same type
- as the LHS argument. */
-
- if (olhstype == TREE_TYPE (result))
- return result;
- /* Avoid warnings converting integral types back into enums
- for enum bit fields. */
- if (TREE_CODE (TREE_TYPE (result)) == INTEGER_TYPE
- && TREE_CODE (olhstype) == ENUMERAL_TYPE)
- {
- result = build (COMPOUND_EXPR, olhstype, result, olhs);
- TREE_NO_UNUSED_WARNING (result) = 1;
- return result;
- }
- return convert_for_assignment (olhstype, result, "assignment",
- NULL_TREE, 0);
-}
-
-tree
-build_x_modify_expr (lhs, modifycode, rhs)
- tree lhs;
- enum tree_code modifycode;
- tree rhs;
-{
- if (processing_template_decl)
- return build_min_nt (MODOP_EXPR, lhs,
- build_min_nt (modifycode, NULL_TREE, NULL_TREE), rhs);
-
- if (modifycode != NOP_EXPR)
- {
- tree rval = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL, lhs, rhs,
- make_node (modifycode));
- if (rval)
- return rval;
- }
- return build_modify_expr (lhs, modifycode, rhs);
-}
-
-/* Return 0 if EXP is not a valid lvalue in this language
- even though `lvalue_or_else' would accept it. */
-
-int
-language_lvalue_valid (exp)
- tree exp;
-{
- return 1;
-}
-
-/* Get difference in deltas for different pointer to member function
- types. Return integer_zero_node, if FROM cannot be converted to a
- TO type. If FORCE is true, then allow reverse conversions as well. */
-
-static tree
-get_delta_difference (from, to, force)
- tree from, to;
- int force;
-{
- tree delta = integer_zero_node;
- tree binfo;
-
- if (to == from)
- return delta;
-
- /* Should get_base_distance here, so we can check if any thing along the
- path is virtual, and we need to make sure we stay
- inside the real binfos when going through virtual bases.
- Maybe we should replace virtual bases with
- binfo_member (...CLASSTYPE_VBASECLASSES...)... (mrs) */
- binfo = get_binfo (from, to, 1);
- if (binfo == error_mark_node)
- {
- error (" in pointer to member function conversiona");
- return delta;
- }
- if (binfo == 0)
- {
- if (!force)
- {
- error_not_base_type (from, to);
- error (" in pointer to member conversion");
- return delta;
- }
- binfo = get_binfo (to, from, 1);
- if (binfo == error_mark_node)
- {
- if (!force)
- error (" in pointer to member conversion");
- return delta;
- }
- if (binfo == 0)
- {
- if (!force)
- cp_error ("cannot convert pointer to member of type %T to unrelated pointer to member of type %T", from, to);
- return delta;
- }
- if (TREE_VIA_VIRTUAL (binfo))
- {
- binfo = binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (from));
- warning ("pointer to member conversion to virtual base class will only work if you are very careful");
- }
- delta = BINFO_OFFSET (binfo);
- delta = convert (ptrdiff_type_node, delta);
-
- return build_binary_op (MINUS_EXPR,
- integer_zero_node,
- delta, 1);
- }
- if (TREE_VIA_VIRTUAL (binfo))
- {
- warning ("pointer to member conversion from virtual base class will only work if you are very careful");
- }
- return BINFO_OFFSET (binfo);
-}
-
-static tree
-build_ptrmemfunc1 (type, delta, idx, pfn, delta2)
- tree type, delta, idx, pfn, delta2;
-{
- tree u;
-
-#if 0
- /* This is the old way we did it. We want to avoid calling
- digest_init, so that it can give an error if we use { } when
- initializing a pointer to member function. */
-
- if (pfn)
- {
- u = build_nt (CONSTRUCTOR, NULL_TREE,
- tree_cons (pfn_identifier, pfn, NULL_TREE));
- }
- else
- {
- u = build_nt (CONSTRUCTOR, NULL_TREE,
- tree_cons (delta2_identifier, delta2, NULL_TREE));
- }
-
- u = build_nt (CONSTRUCTOR, NULL_TREE,
- tree_cons (NULL_TREE, delta,
- tree_cons (NULL_TREE, idx,
- tree_cons (NULL_TREE, u, NULL_TREE))));
-
- return digest_init (type, u, (tree*)0);
-#else
- tree delta_field, idx_field, pfn_or_delta2_field, pfn_field, delta2_field;
- tree subtype;
- int allconstant, allsimple;
-
- 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 (pfn)
- {
- allconstant = TREE_CONSTANT (pfn);
- allsimple = initializer_constant_valid_p (pfn, TREE_TYPE (pfn));
- u = tree_cons (pfn_field, pfn, NULL_TREE);
- }
- else
- {
- delta2 = convert_and_check (delta_type_node, delta2);
- allconstant = TREE_CONSTANT (delta2);
- allsimple = initializer_constant_valid_p (delta2, TREE_TYPE (delta2));
- u = tree_cons (delta2_field, delta2, NULL_TREE);
- }
-
- delta = convert_and_check (delta_type_node, delta);
- idx = convert_and_check (delta_type_node, idx);
-
- 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;
-#endif
-}
-
-/* Build a constructor for a pointer to member function. It can be
- used to initialize global variables, local variable, or used
- as a value in expressions. TYPE is the POINTER to METHOD_TYPE we
- want to be.
-
- If FORCE is non-zero, then force this conversion, even if
- we would rather not do it. Usually set when using an explicit
- cast.
-
- Return error_mark_node, if something goes wrong. */
-
-tree
-build_ptrmemfunc (type, pfn, force)
- tree type, pfn;
- int force;
-{
- tree idx = integer_zero_node;
- tree delta = integer_zero_node;
- tree delta2 = integer_zero_node;
- tree vfield_offset;
- tree npfn = NULL_TREE;
-
- /* Handle multiple conversions of pointer to member functions. */
- if (TYPE_PTRMEMFUNC_P (TREE_TYPE (pfn)))
- {
- tree ndelta, ndelta2;
- tree e1, e2, e3, n;
-
- /* Is is already the right type? */
- if (type == TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (pfn)))
- return pfn;
-
- ndelta = convert (ptrdiff_type_node, build_component_ref (pfn, delta_identifier, NULL_TREE, 0));
- ndelta2 = convert (ptrdiff_type_node, DELTA2_FROM_PTRMEMFUNC (pfn));
- idx = build_component_ref (pfn, index_identifier, NULL_TREE, 0);
-
- n = get_delta_difference (TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (pfn)))),
- TYPE_METHOD_BASETYPE (TREE_TYPE (type)),
- force);
-
- delta = build_binary_op (PLUS_EXPR, ndelta, n, 1);
- delta2 = build_binary_op (PLUS_EXPR, ndelta2, n, 1);
- e1 = fold (build (GT_EXPR, boolean_type_node, idx, integer_zero_node));
-
- e2 = build_ptrmemfunc1 (TYPE_GET_PTRMEMFUNC_TYPE (type), delta, idx,
- NULL_TREE, delta2);
-
- pfn = PFN_FROM_PTRMEMFUNC (pfn);
- npfn = build1 (NOP_EXPR, type, pfn);
- TREE_CONSTANT (npfn) = TREE_CONSTANT (pfn);
-
- e3 = build_ptrmemfunc1 (TYPE_GET_PTRMEMFUNC_TYPE (type), delta, idx, npfn,
- NULL_TREE);
- return build_conditional_expr (e1, e2, e3);
- }
-
- /* Handle null pointer to member function conversions. */
- if (integer_zerop (pfn))
- {
- pfn = build_c_cast (type, integer_zero_node);
- return build_ptrmemfunc1 (TYPE_GET_PTRMEMFUNC_TYPE (type),
- integer_zero_node, integer_zero_node,
- pfn, NULL_TREE);
- }
-
- if (TREE_CODE (pfn) == TREE_LIST
- || (TREE_CODE (pfn) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (pfn, 0)) == TREE_LIST))
- return instantiate_type (type, pfn, 1);
-
- /* Allow pointer to member conversions here. */
- delta = get_delta_difference (TYPE_METHOD_BASETYPE (TREE_TYPE (TREE_TYPE (pfn))),
- TYPE_METHOD_BASETYPE (TREE_TYPE (type)),
- force);
- delta2 = build_binary_op (PLUS_EXPR, delta2, delta, 1);
-
-#if 0
- /* We need to check the argument types to see if they are compatible
- (any const or volatile violations. */
- something like this:
- comptype (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (type))),
- TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (TREE_TYPE (pfn)))), ?);
-#endif
-
- if (TREE_CODE (TREE_OPERAND (pfn, 0)) != FUNCTION_DECL)
- warning ("assuming pointer to member function is non-virtual");
-
- if (TREE_CODE (TREE_OPERAND (pfn, 0)) == FUNCTION_DECL
- && DECL_VINDEX (TREE_OPERAND (pfn, 0)))
- {
- /* Find the offset to the vfield pointer in the object. */
- vfield_offset = get_binfo (DECL_CONTEXT (TREE_OPERAND (pfn, 0)),
- DECL_CLASS_CONTEXT (TREE_OPERAND (pfn, 0)),
- 0);
- vfield_offset = get_vfield_offset (vfield_offset);
- delta2 = size_binop (PLUS_EXPR, vfield_offset, delta2);
-
- /* Map everything down one to make room for the null pointer to member. */
- idx = size_binop (PLUS_EXPR,
- DECL_VINDEX (TREE_OPERAND (pfn, 0)),
- integer_one_node);
- }
- else
- {
- idx = size_binop (MINUS_EXPR, integer_zero_node, integer_one_node);
-
- if (type == TREE_TYPE (pfn))
- {
- npfn = pfn;
- }
- else
- {
- npfn = build1 (NOP_EXPR, type, pfn);
- TREE_CONSTANT (npfn) = TREE_CONSTANT (pfn);
- }
- }
-
- return build_ptrmemfunc1 (TYPE_GET_PTRMEMFUNC_TYPE (type), delta, idx, npfn, delta2);
-}
-
-/* Convert value RHS to type TYPE as preparation for an assignment
- to an lvalue of type TYPE.
- The real work of conversion is done by `convert'.
- The purpose of this function is to generate error messages
- for assignments that are not allowed in C.
- ERRTYPE is a string to use in error messages:
- "assignment", "return", etc.
-
- C++: attempts to allow `convert' to find conversions involving
- implicit type conversion between aggregate and scalar types
- as per 8.5.6 of C++ manual. Does not randomly dereference
- pointers to aggregates! */
-
-static tree
-convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
- tree type, rhs;
- char *errtype;
- tree fndecl;
- int parmnum;
-{
- register enum tree_code codel = TREE_CODE (type);
- register tree rhstype;
- register enum tree_code coder = TREE_CODE (TREE_TYPE (rhs));
-
- if (coder == UNKNOWN_TYPE)
- rhs = instantiate_type (type, rhs, 1);
-
- if (coder == ERROR_MARK)
- return error_mark_node;
-
- if (codel == OFFSET_TYPE)
- {
- type = TREE_TYPE (type);
- codel = TREE_CODE (type);
- }
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- if (TREE_CODE (rhs) == NON_LVALUE_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
-
- if (rhs == error_mark_node)
- return error_mark_node;
-
- if (TREE_VALUE (rhs) == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (TREE_TYPE (rhs)) == OFFSET_TYPE)
- {
- rhs = resolve_offset_ref (rhs);
- if (rhs == error_mark_node)
- return error_mark_node;
- rhstype = TREE_TYPE (rhs);
- coder = TREE_CODE (rhstype);
- }
-
- if (TREE_CODE (TREE_TYPE (rhs)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (rhs)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (rhs)) == METHOD_TYPE)
- rhs = default_conversion (rhs);
- else if (TREE_CODE (TREE_TYPE (rhs)) == REFERENCE_TYPE)
- rhs = convert_from_reference (rhs);
-
- rhstype = TREE_TYPE (rhs);
- coder = TREE_CODE (rhstype);
-
- /* This should no longer change types on us. */
- if (TREE_CODE (rhs) == CONST_DECL)
- rhs = DECL_INITIAL (rhs);
- else if (TREE_READONLY_DECL_P (rhs))
- rhs = decl_constant_value (rhs);
-
- if (type == rhstype)
- {
- overflow_warning (rhs);
- return rhs;
- }
-
- if (coder == VOID_TYPE)
- {
- error ("void value not ignored as it ought to be");
- return error_mark_node;
- }
- /* Arithmetic types all interconvert. */
- if ((codel == INTEGER_TYPE || codel == REAL_TYPE || codel == BOOLEAN_TYPE)
- && (coder == INTEGER_TYPE || coder == REAL_TYPE || coder == BOOLEAN_TYPE))
- {
- /* But we should warn if assigning REAL_TYPE to INTEGER_TYPE. */
- if (coder == REAL_TYPE && codel == INTEGER_TYPE)
- {
- if (fndecl)
- cp_warning ("`%T' used for argument %P of `%D'",
- rhstype, parmnum, fndecl);
- else
- cp_warning ("%s to `%T' from `%T'", errtype, type, rhstype);
- }
- /* And we should warn if assigning a negative value to
- an unsigned variable. */
- else if (TREE_UNSIGNED (type) && codel != BOOLEAN_TYPE)
- {
- if (TREE_CODE (rhs) == INTEGER_CST
- && TREE_NEGATED_INT (rhs))
- {
- if (fndecl)
- cp_warning ("negative value `%E' passed as argument %P of `%D'",
- rhs, parmnum, fndecl);
- else
- cp_warning ("%s of negative value `%E' to `%T'",
- errtype, rhs, type);
- }
- overflow_warning (rhs);
- if (TREE_CONSTANT (rhs))
- rhs = fold (rhs);
- }
-
- return convert_and_check (type, rhs);
- }
- /* Conversions involving enums. */
- else if ((codel == ENUMERAL_TYPE
- && (INTEGRAL_CODE_P (coder) || coder == REAL_TYPE))
- || (coder == ENUMERAL_TYPE
- && (INTEGRAL_CODE_P (codel) || codel == REAL_TYPE)))
- {
- return cp_convert (type, rhs, CONV_IMPLICIT, LOOKUP_NORMAL);
- }
- /* Conversions among pointers */
- else if (codel == POINTER_TYPE
- && (coder == POINTER_TYPE
- || (coder == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (rhstype)
- || IS_SIGNATURE_REFERENCE (rhstype)))))
- {
- register tree ttl = TREE_TYPE (type);
- register tree ttr;
- int ctt = 0;
-
- if (coder == RECORD_TYPE)
- {
- rhs = build_optr_ref (rhs);
- rhstype = TREE_TYPE (rhs);
- }
- ttr = TREE_TYPE (rhstype);
-
- /* If both pointers are of aggregate type, then we
- can give better error messages, and save some work
- as well. */
- if (TREE_CODE (ttl) == RECORD_TYPE && TREE_CODE (ttr) == RECORD_TYPE)
- {
- tree binfo;
-
- if (TYPE_MAIN_VARIANT (ttl) == TYPE_MAIN_VARIANT (ttr)
- || type == class_star_type_node
- || rhstype == class_star_type_node)
- binfo = TYPE_BINFO (ttl);
- else
- binfo = get_binfo (ttl, ttr, 1);
-
- if (binfo == error_mark_node)
- return error_mark_node;
- if (binfo == 0)
- return error_not_base_type (ttl, ttr);
-
- if (! TYPE_READONLY (ttl) && TYPE_READONLY (ttr))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' discards const",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' discards const",
- errtype, type, rhstype);
- }
- if (! TYPE_VOLATILE (ttl) && TYPE_VOLATILE (ttr))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' discards volatile",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' discards volatile",
- errtype, type, rhstype);
- }
- }
-
- /* Any non-function converts to a [const][volatile] void *
- and vice versa; otherwise, targets must be the same.
- Meanwhile, the lhs target must have all the qualifiers of the rhs. */
- else if (TYPE_MAIN_VARIANT (ttl) == void_type_node
- || TYPE_MAIN_VARIANT (ttr) == void_type_node
- || (ctt = comp_target_types (type, rhstype, 1))
- || (unsigned_type (TYPE_MAIN_VARIANT (ttl))
- == unsigned_type (TYPE_MAIN_VARIANT (ttr))))
- {
- /* ARM $4.8, commentary on p39. */
- if (TYPE_MAIN_VARIANT (ttl) == void_type_node
- && TREE_CODE (ttr) == OFFSET_TYPE)
- {
- cp_error ("no standard conversion from `%T' to `void *'", ttr);
- return error_mark_node;
- }
-
- if (ctt < 0 && TYPE_MAIN_VARIANT (ttl) != TYPE_MAIN_VARIANT (ttr))
- cp_pedwarn ("converting `%T' to `%T' is a contravariance violation",
- rhstype, type);
-
- if (TYPE_MAIN_VARIANT (ttl) != void_type_node
- && TYPE_MAIN_VARIANT (ttr) == void_type_node
- && ! null_ptr_cst_p (rhs))
- {
- if (coder == RECORD_TYPE)
- cp_pedwarn ("implicit conversion of signature pointer to type `%T'",
- type);
- else
- pedwarn ("ANSI C++ forbids implicit conversion from `void *' in %s",
- errtype);
- }
- /* Const and volatile mean something different for function types,
- so the usual warnings are not appropriate. */
- else if ((TREE_CODE (ttr) != FUNCTION_TYPE && TREE_CODE (ttr) != METHOD_TYPE)
- || (TREE_CODE (ttl) != FUNCTION_TYPE && TREE_CODE (ttl) != METHOD_TYPE))
- {
- if (TREE_CODE (ttl) == OFFSET_TYPE
- && binfo_member (TYPE_OFFSET_BASETYPE (ttr),
- CLASSTYPE_VBASECLASSES (TYPE_OFFSET_BASETYPE (ttl))))
- {
- sorry ("%s between pointer to members converting across virtual baseclasses", errtype);
- return error_mark_node;
- }
- else if (! TYPE_READONLY (ttl) && TYPE_READONLY (ttr))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' discards const",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' discards const",
- errtype, type, rhstype);
- }
- else if (! TYPE_VOLATILE (ttl) && TYPE_VOLATILE (ttr))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' discards volatile",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' discards volatile",
- errtype, type, rhstype);
- }
- else if (TREE_CODE (ttl) == TREE_CODE (ttr)
- && ! comp_target_types (type, rhstype, 1))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' changes signedness",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' changes signedness",
- errtype, type, rhstype);
- }
- }
- }
- else
- {
- int add_quals = 0, const_parity = 0, volatile_parity = 0;
- int left_const = 1;
- int unsigned_parity;
- int nptrs = 0;
-
- /* This code is basically a duplicate of comp_ptr_ttypes_real. */
- for (; ; ttl = TREE_TYPE (ttl), ttr = TREE_TYPE (ttr))
- {
- nptrs -= 1;
- const_parity |= (TYPE_READONLY (ttl) < TYPE_READONLY (ttr));
- volatile_parity |= (TYPE_VOLATILE (ttl) < TYPE_VOLATILE (ttr));
-
- if (! left_const
- && (TYPE_READONLY (ttl) > TYPE_READONLY (ttr)
- || TYPE_VOLATILE (ttl) > TYPE_VOLATILE (ttr)))
- add_quals = 1;
- left_const &= TYPE_READONLY (ttl);
-
- if (TREE_CODE (ttl) != POINTER_TYPE
- || TREE_CODE (ttr) != POINTER_TYPE)
- break;
- }
- unsigned_parity = TREE_UNSIGNED (ttl) - TREE_UNSIGNED (ttr);
- if (unsigned_parity)
- {
- if (TREE_UNSIGNED (ttl))
- ttr = unsigned_type (ttr);
- else
- ttl = unsigned_type (ttl);
- }
-
- if (comp_target_types (ttl, ttr, nptrs) > 0)
- {
- if (add_quals)
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' adds cv-quals without intervening `const'",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' adds cv-quals without intervening `const'",
- errtype, type, rhstype);
- }
- if (const_parity)
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' discards const",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' discards const",
- errtype, type, rhstype);
- }
- if (volatile_parity)
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' discards volatile",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' discards volatile",
- errtype, type, rhstype);
- }
- if (unsigned_parity > 0)
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' changes signed to unsigned",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' changes signed to unsigned",
- errtype, type, rhstype);
- }
- else if (unsigned_parity < 0)
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' as argument %P of `%D' changes unsigned to signed",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' changes unsigned to signed",
- errtype, type, rhstype);
- }
-
- /* C++ is not so friendly about converting function and
- member function pointers as C. Emit warnings here. */
- if (TREE_CODE (ttl) == FUNCTION_TYPE
- || TREE_CODE (ttl) == METHOD_TYPE)
- if (! comptypes (ttl, ttr, 0))
- {
- warning ("conflicting function types in %s:", errtype);
- cp_warning ("\t`%T' != `%T'", type, rhstype);
- }
- }
- else
- {
- if (fndecl)
- cp_error ("passing `%T' as argument %P of `%D'",
- rhstype, parmnum, fndecl);
- else
- cp_error ("%s to `%T' from `%T'", errtype, type, rhstype);
- return error_mark_node;
- }
- }
- return convert (type, rhs);
- }
- else if (codel == POINTER_TYPE && coder == INTEGER_TYPE)
- {
- /* An explicit constant 0 can convert to a pointer,
- but not a 0 that results from casting or folding. */
- if (! (TREE_CODE (rhs) == INTEGER_CST && integer_zerop (rhs)))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' to argument %P of `%D' lacks a cast",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' lacks a cast",
- errtype, type, rhstype);
- }
- return convert (type, rhs);
- }
- else if (codel == INTEGER_TYPE
- && (coder == POINTER_TYPE
- || (coder == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (rhstype)
- || TYPE_PTRMEMFUNC_FLAG (rhstype)
- || IS_SIGNATURE_REFERENCE (rhstype)))))
- {
- if (fndecl)
- cp_pedwarn ("passing `%T' to argument %P of `%D' lacks a cast",
- rhstype, parmnum, fndecl);
- else
- cp_pedwarn ("%s to `%T' from `%T' lacks a cast",
- errtype, type, rhstype);
- return convert (type, rhs);
- }
- else if (codel == BOOLEAN_TYPE
- && (coder == POINTER_TYPE
- || (coder == RECORD_TYPE
- && (IS_SIGNATURE_POINTER (rhstype)
- || TYPE_PTRMEMFUNC_FLAG (rhstype)
- || IS_SIGNATURE_REFERENCE (rhstype)))))
- return convert (type, rhs);
-
- /* C++ */
- else if (((coder == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (rhstype)) == METHOD_TYPE)
- || integer_zerop (rhs)
- || TYPE_PTRMEMFUNC_P (rhstype))
- && TYPE_PTRMEMFUNC_P (type))
- {
- tree ttl = TYPE_PTRMEMFUNC_FN_TYPE (type);
- tree ttr = (TREE_CODE (rhstype) == POINTER_TYPE ? rhstype
- : TYPE_PTRMEMFUNC_FN_TYPE (type));
- int ctt = comp_target_types (ttl, ttr, 1);
-
- if (ctt < 0)
- cp_pedwarn ("converting `%T' to `%T' is a contravariance violation",
- ttr, ttl);
- else if (ctt == 0)
- cp_error ("%s to `%T' from `%T'", errtype, ttl, ttr);
-
- /* compatible pointer to member functions. */
- return build_ptrmemfunc (ttl, rhs, 0);
- }
- else if (codel == ERROR_MARK || coder == ERROR_MARK)
- return error_mark_node;
-
- /* This should no longer happen. References are initialized via
- `convert_for_initialization'. They should otherwise be
- bashed before coming here. */
- else if (codel == REFERENCE_TYPE)
- my_friendly_abort (317);
- else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (rhs)))
- {
- tree nrhs = build1 (NOP_EXPR, type, rhs);
- TREE_CONSTANT (nrhs) = TREE_CONSTANT (rhs);
- return nrhs;
- }
- else if (TYPE_HAS_CONSTRUCTOR (type) || IS_AGGR_TYPE (TREE_TYPE (rhs)))
- return convert (type, rhs);
- /* Handle anachronistic conversions from (::*)() to cv void* or (*)(). */
- else if (TREE_CODE (type) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
- || TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node)
- && TREE_TYPE (rhs)
- && TYPE_PTRMEMFUNC_P (TREE_TYPE (rhs)))
- return convert (type, rhs);
-
- cp_error ("%s to `%T' from `%T'", errtype, type, rhstype);
- return error_mark_node;
-}
-
-/* Convert RHS to be of type TYPE. If EXP is non-zero,
- it is the target of the initialization.
- ERRTYPE is a string to use in error messages.
-
- Two major differences between the behavior of
- `convert_for_assignment' and `convert_for_initialization'
- are that references are bashed in the former, while
- copied in the latter, and aggregates are assigned in
- the former (operator=) while initialized in the
- latter (X(X&)).
-
- If using constructor make sure no conversion operator exists, if one does
- exist, an ambiguity exists.
-
- If flags doesn't include LOOKUP_COMPLAIN, don't complain about anything. */
-
-tree
-convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
- tree exp, type, rhs;
- int flags;
- char *errtype;
- tree fndecl;
- int parmnum;
-{
- register enum tree_code codel = TREE_CODE (type);
- register tree rhstype;
- register enum tree_code coder;
-
- /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
- Strip such NOP_EXPRs, since RHS is used in non-lvalue context. */
- if (TREE_CODE (rhs) == NOP_EXPR
- && TREE_TYPE (rhs) == TREE_TYPE (TREE_OPERAND (rhs, 0))
- && codel != REFERENCE_TYPE)
- rhs = TREE_OPERAND (rhs, 0);
-
- if (rhs == error_mark_node
- || (TREE_CODE (rhs) == TREE_LIST && TREE_VALUE (rhs) == error_mark_node))
- return error_mark_node;
-
- if (TREE_CODE (TREE_TYPE (rhs)) == OFFSET_TYPE)
- {
- rhs = resolve_offset_ref (rhs);
- if (rhs == error_mark_node)
- return error_mark_node;
- }
-
- if (TREE_CODE (TREE_TYPE (rhs)) == REFERENCE_TYPE)
- rhs = convert_from_reference (rhs);
-
- if ((TREE_CODE (TREE_TYPE (rhs)) == ARRAY_TYPE
- && TREE_CODE (type) != ARRAY_TYPE
- && (TREE_CODE (type) != REFERENCE_TYPE
- || TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE))
- || TREE_CODE (TREE_TYPE (rhs)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (rhs)) == METHOD_TYPE)
- rhs = default_conversion (rhs);
-
- rhstype = TREE_TYPE (rhs);
- coder = TREE_CODE (rhstype);
-
- if (coder == UNKNOWN_TYPE)
- {
- rhs = instantiate_type (type, rhs, 1);
- rhstype = TREE_TYPE (rhs);
- coder = TREE_CODE (rhstype);
- }
-
- if (coder == ERROR_MARK)
- return error_mark_node;
-
- /* We accept references to incomplete types, so we can
- return here before checking if RHS is of complete type. */
-
- if (codel == REFERENCE_TYPE)
- {
- /* This should eventually happen in convert_arguments. */
- extern int warningcount, errorcount;
- int savew, savee;
-
- if (fndecl)
- savew = warningcount, savee = errorcount;
- rhs = convert_to_reference (type, rhs, CONV_IMPLICIT, flags,
- exp ? exp : error_mark_node);
- if (fndecl)
- {
- if (warningcount > savew)
- cp_warning_at ("in passing argument %P of `%+D'", parmnum, fndecl);
- else if (errorcount > savee)
- cp_error_at ("in passing argument %P of `%+D'", parmnum, fndecl);
- }
- return rhs;
- }
-
- rhs = require_complete_type (rhs);
- if (rhs == error_mark_node)
- return error_mark_node;
-
- if (exp != 0) exp = require_complete_type (exp);
- if (exp == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (rhstype) == REFERENCE_TYPE)
- rhstype = TREE_TYPE (rhstype);
-
- type = complete_type (type);
-
- if (TYPE_LANG_SPECIFIC (type)
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type)))
- return build_signature_pointer_constructor (type, rhs);
-
- if (IS_AGGR_TYPE (type)
- && (TYPE_NEEDS_CONSTRUCTING (type) || TREE_HAS_CONSTRUCTOR (rhs)))
- {
- if (flag_ansi_overloading)
- return cp_convert (type, rhs, CONV_IMPLICIT|CONV_FORCE_TEMP, flags);
-
- if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype))
- {
- /* This is sufficient to perform initialization. No need,
- apparently, to go through X(X&) to do first-cut
- initialization. Return through a TARGET_EXPR so that we get
- cleanups if it is used. */
- if (TREE_CODE (rhs) == CALL_EXPR)
- {
- rhs = build_cplus_new (type, rhs);
- return rhs;
- }
- /* Handle the case of default parameter initialization and
- initialization of static variables. */
- else if (TREE_CODE (rhs) == TARGET_EXPR)
- return rhs;
- else if (TREE_CODE (rhs) == INDIRECT_REF && TREE_HAS_CONSTRUCTOR (rhs))
- {
- my_friendly_assert (TREE_CODE (TREE_OPERAND (rhs, 0)) == CALL_EXPR, 318);
- if (exp)
- {
- my_friendly_assert (TREE_VALUE (TREE_OPERAND (TREE_OPERAND (rhs, 0), 1)) == NULL_TREE, 316);
- TREE_VALUE (TREE_OPERAND (TREE_OPERAND (rhs, 0), 1))
- = build_unary_op (ADDR_EXPR, exp, 0);
- }
- else
- rhs = build_cplus_new (type, TREE_OPERAND (rhs, 0));
- return rhs;
- }
- else if (TYPE_HAS_TRIVIAL_INIT_REF (type))
- return rhs;
- }
- if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype)
- || (IS_AGGR_TYPE (rhstype) && UNIQUELY_DERIVED_FROM_P (type, rhstype)))
- {
- if (TYPE_HAS_INIT_REF (type))
- {
- tree init = build_method_call (exp, ctor_identifier,
- build_tree_list (NULL_TREE, rhs),
- TYPE_BINFO (type), LOOKUP_NORMAL);
-
- if (init == error_mark_node)
- return error_mark_node;
-
- if (exp == 0)
- {
- exp = build_cplus_new (type, init);
- return exp;
- }
-
- return build (COMPOUND_EXPR, type, init, exp);
- }
-
- /* ??? The following warnings are turned off because
- this is another place where the default X(X&) constructor
- is implemented. */
- if (TYPE_HAS_ASSIGNMENT (type))
- cp_warning ("bitwise copy: `%T' defines operator=", type);
-
- if (TREE_CODE (TREE_TYPE (rhs)) == REFERENCE_TYPE)
- rhs = convert_from_reference (rhs);
- if (type != rhstype)
- {
- tree nrhs = build1 (NOP_EXPR, type, rhs);
- TREE_CONSTANT (nrhs) = TREE_CONSTANT (rhs);
- rhs = nrhs;
- }
- return rhs;
- }
-
- return cp_convert (type, rhs, CONV_OLD_CONVERT,
- flags | LOOKUP_NO_CONVERSION);
- }
-
- if (type == TREE_TYPE (rhs))
- {
- if (TREE_READONLY_DECL_P (rhs))
- rhs = decl_constant_value (rhs);
- return rhs;
- }
-
- return convert_for_assignment (type, rhs, errtype, fndecl, parmnum);
-}
-
-/* Expand an ASM statement with operands, handling output operands
- that are not variables or INDIRECT_REFS by transforming such
- cases into cases that expand_asm_operands can handle.
-
- Arguments are same as for expand_asm_operands.
-
- We don't do default conversions on all inputs, because it can screw
- up operands that are expected to be in memory. */
-
-void
-c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
- tree string, outputs, inputs, clobbers;
- int vol;
- char *filename;
- int line;
-{
- int noutputs = list_length (outputs);
- register int i;
- /* o[I] is the place that output number I should be written. */
- register tree *o = (tree *) alloca (noutputs * sizeof (tree));
- register tree tail;
-
- /* Record the contents of OUTPUTS before it is modified. */
- for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
- o[i] = TREE_VALUE (tail);
-
- /* Generate the ASM_OPERANDS insn;
- store into the TREE_VALUEs of OUTPUTS some trees for
- where the values were actually stored. */
- expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line);
-
- /* Copy all the intermediate outputs into the specified outputs. */
- for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
- {
- if (o[i] != TREE_VALUE (tail))
- {
- expand_expr (build_modify_expr (o[i], NOP_EXPR, TREE_VALUE (tail)),
- const0_rtx, VOIDmode, 0);
- free_temp_slots ();
- }
- /* Detect modification of read-only values.
- (Otherwise done by build_modify_expr.) */
- else
- {
- tree type = TREE_TYPE (o[i]);
- if (TYPE_READONLY (type)
- || ((TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE)
- && C_TYPE_FIELDS_READONLY (type)))
- readonly_error (o[i], "modification by `asm'", 1);
- }
- }
-
- /* Those MODIFY_EXPRs could do autoincrements. */
- emit_queue ();
-}
-
-/* Expand a C `return' statement.
- RETVAL is the expression for what to return,
- or a null pointer for `return;' with no value.
-
- C++: upon seeing a `return', we must call destructors on all
- variables in scope which had constructors called on them.
- This means that if in a destructor, the base class destructors
- must be called before returning.
-
- The RETURN statement in C++ has initialization semantics. */
-
-void
-c_expand_return (retval)
- tree retval;
-{
- extern struct nesting *cond_stack, *loop_stack, *case_stack;
- extern tree dtor_label, ctor_label;
- tree result = DECL_RESULT (current_function_decl);
- tree valtype = TREE_TYPE (result);
-
- if (TREE_THIS_VOLATILE (current_function_decl))
- warning ("function declared `noreturn' has a `return' statement");
-
- if (retval == error_mark_node)
- {
- current_function_returns_null = 1;
- return;
- }
-
- if (processing_template_decl)
- {
- add_tree (build_min_nt (RETURN_STMT, retval));
- return;
- }
-
- if (retval == NULL_TREE)
- {
- /* A non-named return value does not count. */
-
- /* Can't just return from a destructor. */
- if (dtor_label)
- {
- expand_goto (dtor_label);
- return;
- }
-
- if (DECL_CONSTRUCTOR_P (current_function_decl))
- retval = current_class_ptr;
- else if (DECL_NAME (result) != NULL_TREE
- && TREE_CODE (valtype) != VOID_TYPE)
- retval = result;
- else
- {
- current_function_returns_null = 1;
-
- if (valtype != NULL_TREE && TREE_CODE (valtype) != VOID_TYPE)
- {
- if (DECL_NAME (DECL_RESULT (current_function_decl)) == NULL_TREE)
- {
- pedwarn ("`return' with no value, in function returning non-void");
- /* Clear this, so finish_function won't say that we
- reach the end of a non-void function (which we don't,
- we gave a return!). */
- current_function_returns_null = 0;
- }
- }
-
- expand_null_return ();
- return;
- }
- }
- else if (DECL_CONSTRUCTOR_P (current_function_decl)
- && retval != current_class_ptr)
- {
- if (flag_this_is_variable)
- error ("return from a constructor: use `this = ...' instead");
- else
- error ("return from a constructor");
- retval = current_class_ptr;
- }
-
- /* Effective C++ rule 15. See also start_function. */
- if (extra_warnings
- && DECL_NAME (current_function_decl) == ansi_opname[(int) MODIFY_EXPR]
- && retval != current_class_ref)
- cp_warning ("`operator=' should return a reference to `*this'");
-
- if (valtype == NULL_TREE || TREE_CODE (valtype) == VOID_TYPE)
- {
- current_function_returns_null = 1;
- if (pedantic || TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE)
- pedwarn ("`return' with a value, in function returning void");
- expand_return (retval);
- return;
- }
- /* Add some useful error checking for C++. */
- else if (TREE_CODE (valtype) == REFERENCE_TYPE)
- {
- tree whats_returned;
- tree tmp_result = result;
-
- /* Don't initialize directly into a non-BLKmode retval, since that
- could lose when being inlined by another caller. (GCC can't
- read the function return register in an inline function when
- the return value is being ignored). */
- if (result && TYPE_MODE (TREE_TYPE (tmp_result)) != BLKmode)
- tmp_result = 0;
-
- /* convert to reference now, so we can give error if we
- return an reference to a non-lvalue. */
- retval = convert_for_initialization
- (tmp_result, valtype, retval, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
- "return", NULL_TREE, 0);
-
- /* Sort through common things to see what it is
- we are returning. */
- whats_returned = retval;
- if (TREE_CODE (whats_returned) == COMPOUND_EXPR)
- {
- whats_returned = TREE_OPERAND (whats_returned, 1);
- if (TREE_CODE (whats_returned) == ADDR_EXPR)
- whats_returned = TREE_OPERAND (whats_returned, 0);
- }
- if (TREE_CODE (whats_returned) == ADDR_EXPR)
- {
- whats_returned = TREE_OPERAND (whats_returned, 0);
- while (TREE_CODE (whats_returned) == NEW_EXPR
- || TREE_CODE (whats_returned) == TARGET_EXPR)
- {
- /* Get the target. */
- whats_returned = TREE_OPERAND (whats_returned, 0);
- warning ("returning reference to temporary");
- }
- }
-
- if (TREE_CODE (whats_returned) == VAR_DECL && DECL_NAME (whats_returned))
- {
- if (TEMP_NAME_P (DECL_NAME (whats_returned)))
- warning ("reference to non-lvalue returned");
- else if (! TREE_STATIC (whats_returned)
- && IDENTIFIER_LOCAL_VALUE (DECL_NAME (whats_returned))
- && !TREE_PUBLIC (whats_returned))
- cp_warning_at ("reference to local variable `%D' returned", whats_returned);
- }
- }
- else if (TREE_CODE (retval) == ADDR_EXPR)
- {
- tree whats_returned = TREE_OPERAND (retval, 0);
-
- if (TREE_CODE (whats_returned) == VAR_DECL
- && DECL_NAME (whats_returned)
- && IDENTIFIER_LOCAL_VALUE (DECL_NAME (whats_returned))
- && !TREE_STATIC (whats_returned)
- && !TREE_PUBLIC (whats_returned))
- cp_warning_at ("address of local variable `%D' returned", whats_returned);
- }
- else if (TREE_CODE (retval) == VAR_DECL)
- {
- if (TREE_CODE (TREE_TYPE (retval)) == ARRAY_TYPE
- && DECL_NAME (retval)
- && IDENTIFIER_LOCAL_VALUE (DECL_NAME (retval))
- && !TREE_STATIC (retval)
- && !TREE_PUBLIC (retval))
- cp_warning_at ("address of local array `%D' returned", retval);
- }
-
- /* Now deal with possible C++ hair:
- (1) Compute the return value.
- (2) If there are aggregate values with destructors which
- must be cleaned up, clean them (taking care
- not to clobber the return value).
- (3) If an X(X&) constructor is defined, the return
- value must be returned via that. */
-
- if (retval == result
- || DECL_CONSTRUCTOR_P (current_function_decl))
- /* It's already done for us. */;
- else if (TREE_TYPE (retval) == void_type_node)
- {
- pedwarn ("return of void value in function returning non-void");
- expand_expr_stmt (retval);
- retval = 0;
- }
- else
- {
- /* We already did this above for refs, don't do it again. */
- if (TREE_CODE (valtype) != REFERENCE_TYPE)
- retval = convert_for_initialization
- (NULL_TREE, valtype, retval, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
- "return", NULL_TREE, 0);
-
- /* We can't initialize a register from a NEW_EXPR. */
- if (! current_function_returns_struct
- && TREE_CODE (retval) == TARGET_EXPR
- && TREE_CODE (TREE_OPERAND (retval, 1)) == NEW_EXPR)
- retval = build (COMPOUND_EXPR, TREE_TYPE (retval), retval,
- TREE_OPERAND (retval, 0));
-
- if (retval == error_mark_node)
- {
- /* Avoid warning about control reaching end of function. */
- expand_null_return ();
- return;
- }
- }
-
- if (retval != NULL_TREE
- && TREE_CODE_CLASS (TREE_CODE (retval)) == 'd'
- && cond_stack == 0 && loop_stack == 0 && case_stack == 0)
- current_function_return_value = retval;
-
- if (ctor_label && TREE_CODE (ctor_label) != ERROR_MARK)
- {
- /* Here RETVAL is CURRENT_CLASS_PTR, so there's nothing to do. */
- expand_goto (ctor_label);
- }
-
- if (retval && retval != result)
- {
- result = build (INIT_EXPR, TREE_TYPE (result), result, retval);
- TREE_SIDE_EFFECTS (result) = 1;
- }
- expand_return (result);
- current_function_returns_value = 1;
-}
-
-/* Start a C switch statement, testing expression EXP.
- Return EXP if it is valid, an error node otherwise. */
-
-tree
-c_expand_start_case (exp)
- tree exp;
-{
- tree type;
- register enum tree_code code;
-
- /* Convert from references, etc. */
- exp = default_conversion (exp);
- type = TREE_TYPE (exp);
- code = TREE_CODE (type);
-
- if (IS_AGGR_TYPE_CODE (code))
- exp = build_type_conversion (CONVERT_EXPR, integer_type_node, exp, 1);
-
- if (exp == NULL_TREE)
- {
- error ("switch quantity not an integer");
- exp = error_mark_node;
- }
- type = TREE_TYPE (exp);
- code = TREE_CODE (type);
-
- if (code != INTEGER_TYPE && code != ENUMERAL_TYPE && code != ERROR_MARK)
- {
- error ("switch quantity not an integer");
- exp = error_mark_node;
- }
- else
- {
- tree idx;
-
- exp = default_conversion (exp);
- type = TREE_TYPE (exp);
- idx = get_unwidened (exp, 0);
- /* We can't strip a conversion from a signed type to an unsigned,
- because if we did, int_fits_type_p would do the wrong thing
- when checking case values for being in range,
- and it's too hard to do the right thing. */
- if (TREE_UNSIGNED (TREE_TYPE (exp))
- == TREE_UNSIGNED (TREE_TYPE (idx)))
- exp = idx;
- }
-
- expand_start_case
- (1, fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp)),
- type, "switch statement");
-
- return exp;
-}
-
-/* CONSTP remembers whether or not all the intervening pointers in the `to'
- type have been const. */
-
-static int
-comp_ptr_ttypes_real (to, from, constp)
- tree to, from;
- int constp;
-{
- for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
- {
- if (TREE_CODE (to) != TREE_CODE (from))
- return 0;
-
- if (TREE_CODE (from) == OFFSET_TYPE
- && comptypes (TYPE_OFFSET_BASETYPE (from),
- TYPE_OFFSET_BASETYPE (to), 1))
- continue;
-
- /* Const and volatile mean something different for function types,
- so the usual checks are not appropriate. */
- if (TREE_CODE (to) != FUNCTION_TYPE && TREE_CODE (to) != METHOD_TYPE)
- {
- if (TYPE_READONLY (from) > TYPE_READONLY (to)
- || TYPE_VOLATILE (from) > TYPE_VOLATILE (to))
- return 0;
-
- if (! constp
- && (TYPE_READONLY (to) > TYPE_READONLY (from)
- || TYPE_VOLATILE (to) > TYPE_READONLY (from)))
- return 0;
- constp &= TYPE_READONLY (to);
- }
-
- if (TREE_CODE (to) != POINTER_TYPE)
- return comptypes (TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from), 1);
- }
-}
-
-/* When comparing, say, char ** to char const **, this function takes the
- 'char *' and 'char const *'. Do not pass non-pointer types to this
- function. */
-
-int
-comp_ptr_ttypes (to, from)
- tree to, from;
-{
- return comp_ptr_ttypes_real (to, from, 1);
-}
-
-/* Returns 1 if to and from are (possibly multi-level) pointers to the same
- type or inheritance-related types, regardless of cv-quals. */
-
-int
-ptr_reasonably_similar (to, from)
- tree to, from;
-{
- for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
- {
- if (TREE_CODE (to) != TREE_CODE (from))
- return 0;
-
- if (TREE_CODE (from) == OFFSET_TYPE
- && comptypes (TYPE_OFFSET_BASETYPE (to),
- TYPE_OFFSET_BASETYPE (from), -1))
- continue;
-
- if (TREE_CODE (to) != POINTER_TYPE)
- return comptypes
- (TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from), -1);
- }
-}
-
-/* Like comp_ptr_ttypes, for const_cast. */
-
-static int
-comp_ptr_ttypes_const (to, from)
- tree to, from;
-{
- for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
- {
- if (TREE_CODE (to) != TREE_CODE (from))
- return 0;
-
- if (TREE_CODE (from) == OFFSET_TYPE
- && comptypes (TYPE_OFFSET_BASETYPE (from),
- TYPE_OFFSET_BASETYPE (to), 1))
- continue;
-
- if (TREE_CODE (to) != POINTER_TYPE)
- return comptypes (TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from), 1);
- }
-}
-
-/* Like comp_ptr_ttypes, for reinterpret_cast. */
-
-static int
-comp_ptr_ttypes_reinterpret (to, from)
- tree to, from;
-{
- int constp = 1;
-
- for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
- {
- if (TREE_CODE (from) == OFFSET_TYPE)
- from = TREE_TYPE (from);
- if (TREE_CODE (to) == OFFSET_TYPE)
- to = TREE_TYPE (to);
-
- if (TREE_CODE (to) != TREE_CODE (from))
- return 1;
-
- /* Const and volatile mean something different for function types,
- so the usual checks are not appropriate. */
- if (TREE_CODE (to) != FUNCTION_TYPE && TREE_CODE (to) != METHOD_TYPE)
- {
- if (TYPE_READONLY (from) > TYPE_READONLY (to)
- || TYPE_VOLATILE (from) > TYPE_VOLATILE (to))
- return 0;
-
- if (! constp
- && (TYPE_READONLY (to) > TYPE_READONLY (from)
- || TYPE_VOLATILE (to) > TYPE_READONLY (from)))
- return 0;
- constp &= TYPE_READONLY (to);
- }
-
- if (TREE_CODE (to) != POINTER_TYPE)
- return 1;
- }
-}
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
deleted file mode 100644
index d499846c5a4..00000000000
--- a/gcc/cp/typeck2.c
+++ /dev/null
@@ -1,1610 +0,0 @@
-/* Report error messages, build initializers, and perform
- some front-end optimizations for C++ compiler.
- Copyright (C) 1987, 88, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
- Hacked by Michael Tiemann (tiemann@cygnus.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 file is part of the C++ front end.
- It contains routines to build C++ expressions given their operands,
- including computing the types of the result, C and C++ specific error
- checks, and some optimization.
-
- There are also routines to build RETURN_STMT nodes and CASE_STMT nodes,
- and to process initializations in declarations (since they work
- like a strange sort of assignment). */
-
-#include "config.h"
-#include <stdio.h>
-#include "tree.h"
-#include "cp-tree.h"
-#include "flags.h"
-
-static tree process_init_constructor ();
-extern void pedwarn (), error ();
-
-extern int errorcount;
-extern int sorrycount;
-
-/* Print an error message stemming from an attempt to use
- BASETYPE as a base class for TYPE. */
-
-tree
-error_not_base_type (basetype, type)
- tree basetype, type;
-{
- if (TREE_CODE (basetype) == FUNCTION_DECL)
- basetype = DECL_CLASS_CONTEXT (basetype);
- cp_error ("type `%T' is not a base type for type `%T'", basetype, type);
- return error_mark_node;
-}
-
-tree
-binfo_or_else (parent_or_type, type)
- tree parent_or_type, type;
-{
- tree binfo;
- if (TYPE_MAIN_VARIANT (parent_or_type) == TYPE_MAIN_VARIANT (type))
- return TYPE_BINFO (parent_or_type);
- if ((binfo = get_binfo (parent_or_type, TYPE_MAIN_VARIANT (type), 0)))
- {
- if (binfo == error_mark_node)
- return NULL_TREE;
- return binfo;
- }
- error_not_base_type (parent_or_type, type);
- return NULL_TREE;
-}
-
-/* According to ARM $7.1.6, "A `const' object may be initialized, but its
- value may not be changed thereafter. Thus, we emit hard errors for these,
- rather than just pedwarns. If `SOFT' is 1, then we just pedwarn. (For
- example, conversions to references.) */
-
-void
-readonly_error (arg, string, soft)
- tree arg;
- char *string;
- int soft;
-{
- char *fmt;
- void (*fn)();
-
- if (soft)
- fn = cp_pedwarn;
- else
- fn = cp_error;
-
- if (TREE_CODE (arg) == COMPONENT_REF)
- {
- if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
- fmt = "%s of member `%D' in read-only structure";
- else
- fmt = "%s of read-only member `%D'";
- (*fn) (fmt, string, TREE_OPERAND (arg, 1));
- }
- else if (TREE_CODE (arg) == VAR_DECL)
- {
- if (DECL_LANG_SPECIFIC (arg)
- && DECL_IN_AGGR_P (arg)
- && !TREE_STATIC (arg))
- fmt = "%s of constant field `%D'";
- else
- fmt = "%s of read-only variable `%D'";
- (*fn) (fmt, string, arg);
- }
- else if (TREE_CODE (arg) == PARM_DECL)
- (*fn) ("%s of read-only parameter `%D'", string, arg);
- else if (TREE_CODE (arg) == INDIRECT_REF
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE
- && (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
- || TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
- (*fn) ("%s of read-only reference `%D'", string, TREE_OPERAND (arg, 0));
- else if (TREE_CODE (arg) == RESULT_DECL)
- (*fn) ("%s of read-only named return value `%D'", string, arg);
- else
- (*fn) ("%s of read-only location", string);
-}
-
-/* Print an error message for invalid use of a type which declares
- virtual functions which are not inheritable. */
-
-void
-abstract_virtuals_error (decl, type)
- tree decl;
- tree type;
-{
- tree u = CLASSTYPE_ABSTRACT_VIRTUALS (type);
-
- if (decl)
- {
- if (TREE_CODE (decl) == RESULT_DECL)
- return;
-
- if (TREE_CODE (decl) == VAR_DECL)
- cp_error ("cannot declare variable `%D' to be of type `%T'",
- decl, type);
- else if (TREE_CODE (decl) == PARM_DECL)
- cp_error ("cannot declare parameter `%D' to be of type `%T'",
- decl, type);
- else if (TREE_CODE (decl) == FIELD_DECL)
- cp_error ("cannot declare field `%D' to be of type `%T'",
- decl, type);
- else if (TREE_CODE (decl) == FUNCTION_DECL
- && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
- cp_error ("invalid return type for method `%#D'", decl);
- else if (TREE_CODE (decl) == FUNCTION_DECL)
- cp_error ("invalid return type for function `%#D'", decl);
- }
- else cp_error ("cannot allocate an object of type `%T'", type);
- /* Only go through this once. */
- if (TREE_PURPOSE (u) == NULL_TREE)
- {
- error (" since the following virtual functions are abstract:");
- TREE_PURPOSE (u) = error_mark_node;
- while (u)
- {
- cp_error ("\t%#D", TREE_VALUE (u));
- u = TREE_CHAIN (u);
- }
- }
- else cp_error (" since type `%T' has abstract virtual functions", type);
-}
-
-/* Print an error message for invalid use of a signature type.
- Signatures are treated similar to abstract classes here, they
- cannot be instantiated. */
-
-void
-signature_error (decl, type)
- tree decl;
- tree type;
-{
- if (decl)
- {
- if (TREE_CODE (decl) == RESULT_DECL)
- return;
-
- if (TREE_CODE (decl) == VAR_DECL)
- cp_error ("cannot declare variable `%D' to be of signature type `%T'",
- decl, type);
- else if (TREE_CODE (decl) == PARM_DECL)
- cp_error ("cannot declare parameter `%D' to be of signature type `%T'",
- decl, type);
- else if (TREE_CODE (decl) == FIELD_DECL)
- cp_error ("cannot declare field `%D' to be of signature type `%T'",
- decl, type);
- else if (TREE_CODE (decl) == FUNCTION_DECL
- && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
- cp_error ("invalid return type for method `%#D'", decl);
- else if (TREE_CODE (decl) == FUNCTION_DECL)
- cp_error ("invalid return type for function `%#D'", decl);
- }
- else
- cp_error ("cannot allocate an object of signature type `%T'", type);
-}
-
-/* Print an error message for invalid use of an incomplete type.
- VALUE is the expression that was used (or 0 if that isn't known)
- and TYPE is the type that was invalid. */
-
-void
-incomplete_type_error (value, type)
- tree value;
- tree type;
-{
- char *errmsg;
-
- /* Avoid duplicate error message. */
- if (TREE_CODE (type) == ERROR_MARK)
- return;
-
- if (value != 0 && (TREE_CODE (value) == VAR_DECL
- || TREE_CODE (value) == PARM_DECL))
- cp_error ("`%D' has incomplete type", value);
- else
- {
- retry:
- /* We must print an error message. Be clever about what it says. */
-
- switch (TREE_CODE (type))
- {
- case RECORD_TYPE:
- case UNION_TYPE:
- case ENUMERAL_TYPE:
- errmsg = "invalid use of undefined type `%#T'";
- break;
-
- case VOID_TYPE:
- error ("invalid use of void expression");
- return;
-
- case ARRAY_TYPE:
- if (TYPE_DOMAIN (type))
- {
- type = TREE_TYPE (type);
- goto retry;
- }
- error ("invalid use of array with unspecified bounds");
- return;
-
- case OFFSET_TYPE:
- error ("invalid use of member type (did you forget the `&' ?)");
- return;
-
- default:
- my_friendly_abort (108);
- }
-
- cp_error (errmsg, type);
- }
-}
-
-/* Like error(), but don't call report_error_function(). */
-
-static void
-ack (s, v, v2)
- char *s;
- HOST_WIDE_INT v;
- HOST_WIDE_INT v2;
-{
- extern char * progname;
-
- if (input_filename)
- fprintf (stderr, "%s:%d: ", input_filename, lineno);
- else
- fprintf (stderr, "%s: ", progname);
-
- fprintf (stderr, s, v, v2);
- fprintf (stderr, "\n");
-}
-
-/* There are times when the compiler can get very confused, confused
- to the point of giving up by aborting, simply because of previous
- input errors. It is much better to have the user go back and
- correct those errors first, and see if it makes us happier, than it
- is to abort on him. This is because when one has a 10,000 line
- program, and the compiler comes back with ``core dump'', the user
- is left not knowing even where to begin to fix things and no place
- to even try and work around things.
-
- The parameter is to uniquely identify the problem to the user, so
- that they can say, I am having problem 59, and know that fix 7 will
- probably solve their problem. Or, we can document what problem
- 59 is, so they can understand how to work around it, should they
- ever run into it.
-
- Note, there will be no more calls in the C++ front end to abort,
- because the C++ front end is so unreliable still. The C front end
- can get away with calling abort, because for most of the calls to
- abort on most machines, it, I suspect, can be proven that it is
- impossible to ever call abort. The same is not yet true for C++,
- one day, maybe it will be.
-
- We used to tell people to "fix the above error[s] and try recompiling
- the program" via a call to fatal, but that message tended to look
- silly. So instead, we just do the equivalent of a call to fatal in the
- same situation (call exit). */
-
-/* First used: 0 (reserved), Last used: 367. Free: */
-
-static int abortcount = 0;
-
-void
-my_friendly_abort (i)
- int i;
-{
- /* if the previous error came through here, i.e. report_error_function
- ended up calling us again, don't just exit; we want a diagnostic of
- some kind. */
- if (abortcount == 1)
- current_function_decl = NULL_TREE;
- else if (errorcount > 0 || sorrycount > 0)
- {
- if (abortcount > 1)
- {
- if (i == 0)
- ack ("Internal compiler error.");
- else
- ack ("Internal compiler error %d.", i);
- ack ("Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.");
- }
- else
- error ("confused by earlier errors, bailing out");
-
- exit (34);
- }
- ++abortcount;
-
- if (i == 0)
- error ("Internal compiler error.");
- else
- error ("Internal compiler error %d.", i);
-
- fatal ("Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.");
-}
-
-void
-my_friendly_assert (cond, where)
- int cond, where;
-{
- if (cond == 0)
- my_friendly_abort (where);
-}
-
-/* Return nonzero if VALUE is a valid constant-valued expression
- for use in initializing a static variable; one that can be an
- element of a "constant" initializer.
-
- Return null_pointer_node if the value is absolute;
- if it is relocatable, return the variable that determines the relocation.
- We assume that VALUE has been folded as much as possible;
- therefore, we do not need to check for such things as
- arithmetic-combinations of integers. */
-
-tree
-initializer_constant_valid_p (value, endtype)
- tree value;
- tree endtype;
-{
- switch (TREE_CODE (value))
- {
- case CONSTRUCTOR:
- if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE
- && TREE_CONSTANT (value))
- return
- initializer_constant_valid_p (TREE_VALUE (CONSTRUCTOR_ELTS (value)),
- endtype);
-
- return TREE_STATIC (value) ? null_pointer_node : 0;
-
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- case COMPLEX_CST:
- return null_pointer_node;
-
- case ADDR_EXPR:
- return TREE_OPERAND (value, 0);
-
- case NON_LVALUE_EXPR:
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- case CONVERT_EXPR:
- case NOP_EXPR:
- /* Allow conversions between pointer types. */
- if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == POINTER_TYPE)
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- /* Allow conversions between real types. */
- if (TREE_CODE (TREE_TYPE (value)) == REAL_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == REAL_TYPE)
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- /* Allow length-preserving conversions between integer types. */
- if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (value))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
-
- /* Allow conversions between other integer types only if
- explicit value. */
- if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE)
- {
- tree inner = initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- if (inner == null_pointer_node)
- return null_pointer_node;
- return 0;
- }
-
- /* Allow (int) &foo provided int is as wide as a pointer. */
- if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == POINTER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (value))
- >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
-
- /* Likewise conversions from int to pointers. */
- if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (value))
- <= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))))
- return initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
-
- /* Allow conversions to union types if the value inside is okay. */
- if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE)
- return initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- return 0;
-
- case PLUS_EXPR:
- if ((TREE_CODE (endtype) == INTEGER_TYPE)
- && (TYPE_PRECISION (endtype) < POINTER_SIZE))
- return 0;
- {
- tree valid0 = initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- tree valid1 = initializer_constant_valid_p (TREE_OPERAND (value, 1),
- endtype);
- /* If either term is absolute, use the other terms relocation. */
- if (valid0 == null_pointer_node)
- return valid1;
- if (valid1 == null_pointer_node)
- return valid0;
- return 0;
- }
-
- case MINUS_EXPR:
- if ((TREE_CODE (endtype) == INTEGER_TYPE)
- && (TYPE_PRECISION (endtype) < POINTER_SIZE))
- return 0;
- {
- tree valid0 = initializer_constant_valid_p (TREE_OPERAND (value, 0),
- endtype);
- tree valid1 = initializer_constant_valid_p (TREE_OPERAND (value, 1),
- endtype);
- /* Win if second argument is absolute. */
- if (valid1 == null_pointer_node)
- return valid0;
- /* Win if both arguments have the same relocation.
- Then the value is absolute. */
- if (valid0 == valid1)
- return null_pointer_node;
- return 0;
- }
- }
-
- return 0;
-}
-
-/* Perform appropriate conversions on the initial value of a variable,
- store it in the declaration DECL,
- and print any error messages that are appropriate.
- If the init is invalid, store an ERROR_MARK.
-
- C++: Note that INIT might be a TREE_LIST, which would mean that it is
- a base class initializer for some aggregate type, hopefully compatible
- with DECL. If INIT is a single element, and DECL is an aggregate
- type, we silently convert INIT into a TREE_LIST, allowing a constructor
- to be called.
-
- If INIT is a TREE_LIST and there is no constructor, turn INIT
- into a CONSTRUCTOR and use standard initialization techniques.
- Perhaps a warning should be generated?
-
- Returns value of initializer if initialization could not be
- performed for static variable. In that case, caller must do
- the storing. */
-
-tree
-store_init_value (decl, init)
- tree decl, init;
-{
- register tree value, type;
-
- /* If variable's type was invalidly declared, just ignore it. */
-
- type = TREE_TYPE (decl);
- if (TREE_CODE (type) == ERROR_MARK)
- return NULL_TREE;
-
-#if 0
- /* This breaks arrays, and should not have any effect for other decls. */
- /* Take care of C++ business up here. */
- type = TYPE_MAIN_VARIANT (type);
-#endif
-
- if (IS_AGGR_TYPE (type))
- {
- if (! TYPE_HAS_TRIVIAL_INIT_REF (type)
- && TREE_CODE (init) != CONSTRUCTOR)
- my_friendly_abort (109);
-
- /* Although we are not allowed to declare variables of signature
- type, we complain about a possible constructor call in such a
- declaration as well. */
- if (TREE_CODE (init) == TREE_LIST
- && IS_SIGNATURE (type))
- {
- cp_error ("constructor syntax cannot be used with signature type `%T'",
- type);
- init = error_mark_node;
- }
- else if (TREE_CODE (init) == TREE_LIST)
- {
- cp_error ("constructor syntax used, but no constructor declared for type `%T'", type);
- init = build_nt (CONSTRUCTOR, NULL_TREE, nreverse (init));
- }
-#if 0
- if (TREE_CODE (init) == CONSTRUCTOR)
- {
- tree field;
-
- /* Check that we're really an aggregate as ARM 8.4.1 defines it. */
- if (CLASSTYPE_N_BASECLASSES (type))
- cp_error_at ("initializer list construction invalid for derived class object `%D'", decl);
- if (CLASSTYPE_VTBL_PTR (type))
- cp_error_at ("initializer list construction invalid for polymorphic class object `%D'", decl);
- if (TYPE_NEEDS_CONSTRUCTING (type))
- {
- cp_error_at ("initializer list construction invalid for `%D'", decl);
- error ("due to the presence of a constructor");
- }
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- if (TREE_PRIVATE (field) || TREE_PROTECTED (field))
- {
- cp_error_at ("initializer list construction invalid for `%D'", decl);
- cp_error_at ("due to non-public access of member `%D'", field);
- }
- for (field = TYPE_METHODS (type); field; field = TREE_CHAIN (field))
- if (TREE_PRIVATE (field) || TREE_PROTECTED (field))
- {
- cp_error_at ("initializer list construction invalid for `%D'", decl);
- cp_error_at ("due to non-public access of member `%D'", field);
- }
- }
-#endif
- }
- else if (TREE_CODE (init) == TREE_LIST
- && TREE_TYPE (init) != unknown_type_node)
- {
- if (TREE_CODE (decl) == RESULT_DECL)
- {
- if (TREE_CHAIN (init))
- {
- warning ("comma expression used to initialize return value");
- init = build_compound_expr (init);
- }
- else
- init = TREE_VALUE (init);
- }
- else if (TREE_TYPE (init) != 0
- && TREE_CODE (TREE_TYPE (init)) == OFFSET_TYPE)
- {
- /* Use the type of our variable to instantiate
- the type of our initializer. */
- init = instantiate_type (type, init, 1);
- }
- else if (TREE_CODE (init) == TREE_LIST
- && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
- {
- error ("cannot initialize arrays using this syntax");
- return NULL_TREE;
- }
- else
- {
- /* We get here with code like `int a (2);' */
-
- if (TREE_CHAIN (init) != NULL_TREE)
- {
- pedwarn ("initializer list being treated as compound expression");
- init = build_compound_expr (init);
- }
- else
- init = TREE_VALUE (init);
- }
- }
-
- if (TYPE_PTRMEMFUNC_P (type) && TREE_CODE (init) == CONSTRUCTOR
- && TREE_TYPE (init) == NULL_TREE)
- cp_pedwarn ("initializer list for `%T'", type);
-
- /* End of special C++ code. */
-
- /* Digest the specified initializer into an expression. */
-
- value = digest_init (type, init, (tree *) 0);
-
- /* Store the expression if valid; else report error. */
-
- if (TREE_CODE (value) == ERROR_MARK)
- ;
- else if (TREE_STATIC (decl)
- && (! TREE_CONSTANT (value)
- || ! initializer_constant_valid_p (value, TREE_TYPE (value))
-#if 0
- /* A STATIC PUBLIC int variable doesn't have to be
- run time inited when doing pic. (mrs) */
- /* Since ctors and dtors are the only things that can
- reference vtables, and they are always written down
- the the vtable definition, we can leave the
- vtables in initialized data space.
- However, other initialized data cannot be initialized
- this way. Instead a global file-level initializer
- must do the job. */
- || (flag_pic && !DECL_VIRTUAL_P (decl) && TREE_PUBLIC (decl))
-#endif
- ))
-
- return value;
-#if 0 /* No, that's C. jason 9/19/94 */
- else
- {
- if (pedantic && TREE_CODE (value) == CONSTRUCTOR
- /* Don't complain about non-constant initializers of
- signature tables and signature pointers/references. */
- && ! (TYPE_LANG_SPECIFIC (type)
- && (IS_SIGNATURE (type)
- || IS_SIGNATURE_POINTER (type)
- || IS_SIGNATURE_REFERENCE (type))))
- {
- if (! TREE_CONSTANT (value) || ! TREE_STATIC (value))
- pedwarn ("ANSI C++ forbids non-constant aggregate initializer expressions");
- }
- }
-#endif
- DECL_INITIAL (decl) = value;
- return NULL_TREE;
-}
-
-/* Digest the parser output INIT as an initializer for type TYPE.
- Return a C expression of type TYPE to represent the initial value.
-
- If TAIL is nonzero, it points to a variable holding a list of elements
- of which INIT is the first. We update the list stored there by
- removing from the head all the elements that we use.
- Normally this is only one; we use more than one element only if
- TYPE is an aggregate and INIT is not a constructor. */
-
-tree
-digest_init (type, init, tail)
- tree type, init, *tail;
-{
- enum tree_code code = TREE_CODE (type);
- tree element = NULL_TREE;
- tree old_tail_contents;
- /* Nonzero if INIT is a braced grouping, which comes in as a CONSTRUCTOR
- tree node which has no TREE_TYPE. */
- int raw_constructor;
-
- /* By default, assume we use one element from a list.
- We correct this later in the sole case where it is not true. */
-
- if (tail)
- {
- old_tail_contents = *tail;
- *tail = TREE_CHAIN (*tail);
- }
-
- if (init == error_mark_node || (TREE_CODE (init) == TREE_LIST
- && TREE_VALUE (init) == error_mark_node))
- return error_mark_node;
-
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- if (TREE_CODE (init) == NON_LVALUE_EXPR)
- init = TREE_OPERAND (init, 0);
-
- if (init && TREE_TYPE (init) && TYPE_PTRMEMFUNC_P (type))
- init = default_conversion (init);
-
- if (init && TYPE_PTRMEMFUNC_P (type)
- && ((TREE_CODE (init) == ADDR_EXPR
- && ((TREE_CODE (TREE_TYPE (init)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_TYPE (init))) == METHOD_TYPE)
- || TREE_CODE (TREE_OPERAND (init, 0)) == TREE_LIST))
- || TREE_CODE (init) == TREE_LIST
- || integer_zerop (init)
- || (TREE_TYPE (init) && TYPE_PTRMEMFUNC_P (TREE_TYPE (init)))))
- {
- return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), init, 0);
- }
-
- raw_constructor = TREE_CODE (init) == CONSTRUCTOR && TREE_TYPE (init) == 0;
-
- if (init && raw_constructor
- && CONSTRUCTOR_ELTS (init) != 0
- && TREE_CHAIN (CONSTRUCTOR_ELTS (init)) == 0)
- {
- element = TREE_VALUE (CONSTRUCTOR_ELTS (init));
- /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
- if (element && TREE_CODE (element) == NON_LVALUE_EXPR)
- element = TREE_OPERAND (element, 0);
- if (element == error_mark_node)
- return element;
- }
-
- /* Any type can be initialized from an expression of the same type,
- optionally with braces. */
-
- if (init && TREE_TYPE (init)
- && (TYPE_MAIN_VARIANT (TREE_TYPE (init)) == type
- || (code == ARRAY_TYPE && comptypes (TREE_TYPE (init), type, 1))))
- {
- if (pedantic && code == ARRAY_TYPE
- && TREE_CODE (init) != STRING_CST)
- pedwarn ("ANSI C++ forbids initializing array from array expression");
- if (TREE_CODE (init) == CONST_DECL)
- init = DECL_INITIAL (init);
- else if (TREE_READONLY_DECL_P (init))
- init = decl_constant_value (init);
- return init;
- }
-
- if (element && (TREE_TYPE (element) == type
- || (code == ARRAY_TYPE && TREE_TYPE (element)
- && comptypes (TREE_TYPE (element), type, 1))))
- {
- if (pedantic && code == ARRAY_TYPE)
- pedwarn ("ANSI C++ forbids initializing array from array expression");
- if (pedantic && (code == RECORD_TYPE || code == UNION_TYPE))
- pedwarn ("ANSI C++ forbids single nonscalar initializer with braces");
- if (TREE_CODE (element) == CONST_DECL)
- element = DECL_INITIAL (element);
- else if (TREE_READONLY_DECL_P (element))
- element = decl_constant_value (element);
- return element;
- }
-
- /* Initialization of an array of chars from a string constant
- optionally enclosed in braces. */
-
- if (code == ARRAY_TYPE)
- {
- tree typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (type));
- if ((typ1 == char_type_node
- || typ1 == signed_char_type_node
- || typ1 == unsigned_char_type_node
- || typ1 == unsigned_wchar_type_node
- || typ1 == signed_wchar_type_node)
- && ((init && TREE_CODE (init) == STRING_CST)
- || (element && TREE_CODE (element) == STRING_CST)))
- {
- tree string = element ? element : init;
-
- if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (string)))
- != char_type_node)
- && 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)))
- == char_type_node)
- && TYPE_PRECISION (typ1) != BITS_PER_UNIT)
- {
- error ("int-array initialized from non-wide string");
- return error_mark_node;
- }
-
- if (pedantic
- && typ1 != char_type_node
- && typ1 != signed_char_type_node
- && typ1 != unsigned_char_type_node)
- pedwarn ("ANSI C++ forbids string initializer except for `char' elements");
- TREE_TYPE (string) = type;
- if (TYPE_DOMAIN (type) != 0
- && TREE_CONSTANT (TYPE_SIZE (type)))
- {
- register int size
- = TREE_INT_CST_LOW (TYPE_SIZE (type));
- size = (size + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
- /* In C it is ok to subtract 1 from the length of the string
- because it's ok to ignore the terminating null char that is
- counted in the length of the constant, but in C++ this would
- be invalid. */
- if (size < TREE_STRING_LENGTH (string))
- pedwarn ("initializer-string for array of chars is too long");
- }
- return string;
- }
- }
-
- /* Handle scalar types, including conversions,
- and signature pointers and references. */
-
- if (code == INTEGER_TYPE || code == REAL_TYPE || code == POINTER_TYPE
- || code == ENUMERAL_TYPE || code == REFERENCE_TYPE
- || code == BOOLEAN_TYPE
- || (code == RECORD_TYPE && ! raw_constructor
- && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type))))
- {
- if (raw_constructor)
- {
- if (element == 0)
- {
- error ("initializer for scalar variable requires one element");
- return error_mark_node;
- }
- init = element;
- }
- while (TREE_CODE (init) == CONSTRUCTOR
- && ! (TREE_TYPE (init)
- && TYPE_PTRMEMFUNC_P (TREE_TYPE (init))))
- {
- cp_pedwarn ("braces around scalar initializer for `%T'", type);
- init = CONSTRUCTOR_ELTS (init);
- if (TREE_CHAIN (init))
- cp_pedwarn ("ignoring extra initializers for `%T'", type);
- init = TREE_VALUE (init);
- }
-
- return convert_for_initialization (0, type, init, LOOKUP_NORMAL,
- "initialization", NULL_TREE, 0);
- }
-
- /* Come here only for records and arrays (and unions with constructors). */
-
- if (TYPE_SIZE (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
- {
- cp_error ("variable-sized object of type `%T' may not be initialized",
- type);
- return error_mark_node;
- }
-
- if (code == ARRAY_TYPE || code == RECORD_TYPE || code == UNION_TYPE)
- {
- if (raw_constructor && TYPE_NON_AGGREGATE_CLASS (type))
- {
- cp_error ("subobject of type `%T' must be initialized by constructor, not by `%E'",
- type, init);
- return error_mark_node;
- }
- else if (raw_constructor)
- return process_init_constructor (type, init, (tree *)0);
- else if (TYPE_NON_AGGREGATE_CLASS (type))
- {
- int flags = LOOKUP_NORMAL;
- /* Initialization from { } is copy-initialization. */
- if (tail)
- flags |= LOOKUP_ONLYCONVERTING;
- return convert_for_initialization (0, type, init, flags,
- "initialization", NULL_TREE, 0);
- }
- else if (tail != 0)
- {
- *tail = old_tail_contents;
- return process_init_constructor (type, 0, tail);
- }
-
- if (code != ARRAY_TYPE)
- return convert_for_initialization (NULL_TREE, type, init, LOOKUP_NORMAL,
- "initialization", NULL_TREE, 0);
- }
-
- error ("invalid initializer");
- return error_mark_node;
-}
-
-/* Process a constructor for a variable of type TYPE.
- The constructor elements may be specified either with INIT or with ELTS,
- only one of which should be non-null.
-
- If INIT is specified, it is a CONSTRUCTOR node which is specifically
- and solely for initializing this datum.
-
- If ELTS is specified, it is the address of a variable containing
- a list of expressions. We take as many elements as we need
- from the head of the list and update the list.
-
- In the resulting constructor, TREE_CONSTANT is set if all elts are
- constant, and TREE_STATIC is set if, in addition, all elts are simple enough
- constants that the assembler and linker can compute them. */
-
-static tree
-process_init_constructor (type, init, elts)
- tree type, init, *elts;
-{
- register tree tail;
- /* List of the elements of the result constructor,
- in reverse order. */
- register tree members = NULL;
- tree result;
- int allconstant = 1;
- int allsimple = 1;
- int erroneous = 0;
-
- /* Make TAIL be the list of elements to use for the initialization,
- no matter how the data was given to us. */
-
- if (elts)
- {
- if (warn_missing_braces)
- warning ("aggregate has a partly bracketed initializer");
- tail = *elts;
- }
- else
- tail = CONSTRUCTOR_ELTS (init);
-
- /* Gobble as many elements as needed, and make a constructor or initial value
- for each element of this aggregate. Chain them together in result.
- If there are too few, use 0 for each scalar ultimate component. */
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- tree domain = TYPE_DOMAIN (type);
- register long len;
- register int i;
-
- if (domain)
- len = (TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain))
- - TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain))
- + 1);
- else
- len = -1; /* Take as many as there are */
-
- for (i = 0; (len < 0 || i < len) && tail != 0; i++)
- {
- register tree next1;
-
- if (TREE_VALUE (tail) != 0)
- {
- tree tail1 = tail;
- next1 = digest_init (TYPE_MAIN_VARIANT (TREE_TYPE (type)),
- TREE_VALUE (tail), &tail1);
- if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (type))
- && TYPE_MAIN_VARIANT (TREE_TYPE (type)) != TYPE_MAIN_VARIANT (TREE_TYPE (next1)))
- {
- /* The fact this needs to be done suggests this code needs
- to be totally rewritten. */
- next1 = convert_for_initialization (NULL_TREE, TREE_TYPE (type), next1, LOOKUP_NORMAL, "initialization", NULL_TREE, 0);
- }
- my_friendly_assert (tail1 == 0
- || TREE_CODE (tail1) == TREE_LIST, 319);
- if (tail == tail1 && len < 0)
- {
- error ("non-empty initializer for array of empty elements");
- /* Just ignore what we were supposed to use. */
- tail1 = NULL_TREE;
- }
- tail = tail1;
- }
- else
- {
- next1 = error_mark_node;
- tail = TREE_CHAIN (tail);
- }
-
- if (next1 == error_mark_node)
- erroneous = 1;
- else if (!TREE_CONSTANT (next1))
- allconstant = 0;
- else if (! initializer_constant_valid_p (next1, TREE_TYPE (next1)))
- allsimple = 0;
- members = tree_cons (NULL_TREE, next1, members);
- }
- }
- if (TREE_CODE (type) == RECORD_TYPE)
- {
- register tree field;
-
- if (tail)
- {
- if (TYPE_USES_VIRTUAL_BASECLASSES (type))
- {
- sorry ("initializer list for object of class with virtual baseclasses");
- return error_mark_node;
- }
-
- if (TYPE_BINFO_BASETYPES (type))
- {
- sorry ("initializer list for object of class with baseclasses");
- return error_mark_node;
- }
-
- if (TYPE_VIRTUAL_P (type))
- {
- sorry ("initializer list for object using virtual functions");
- return error_mark_node;
- }
- }
-
- for (field = TYPE_FIELDS (type); field && tail;
- field = TREE_CHAIN (field))
- {
- register tree next1;
-
- if (! DECL_NAME (field))
- {
- members = tree_cons (field, integer_zero_node, members);
- continue;
- }
-
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- if (TREE_VALUE (tail) != 0)
- {
- tree tail1 = tail;
-
- next1 = digest_init (TREE_TYPE (field),
- TREE_VALUE (tail), &tail1);
- my_friendly_assert (tail1 == 0
- || TREE_CODE (tail1) == TREE_LIST, 320);
- tail = tail1;
- }
- else
- {
- next1 = error_mark_node;
- tail = TREE_CHAIN (tail);
- }
-
- if (next1 == error_mark_node)
- erroneous = 1;
- else if (!TREE_CONSTANT (next1))
- allconstant = 0;
- else if (! initializer_constant_valid_p (next1, TREE_TYPE (next1)))
- allsimple = 0;
- members = tree_cons (field, next1, members);
- }
- for (; field; field = TREE_CHAIN (field))
- {
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- /* Does this field have a default initialization? */
- if (DECL_INITIAL (field))
- {
- register tree next1 = DECL_INITIAL (field);
- if (TREE_CODE (next1) == ERROR_MARK)
- erroneous = 1;
- else if (!TREE_CONSTANT (next1))
- allconstant = 0;
- else if (! initializer_constant_valid_p (next1, TREE_TYPE (next1)))
- allsimple = 0;
- members = tree_cons (field, next1, members);
- }
- else if (TREE_READONLY (field))
- error ("uninitialized const member `%s'",
- IDENTIFIER_POINTER (DECL_NAME (field)));
- else if (TYPE_LANG_SPECIFIC (TREE_TYPE (field))
- && CLASSTYPE_READONLY_FIELDS_NEED_INIT (TREE_TYPE (field)))
- error ("member `%s' with uninitialized const fields",
- IDENTIFIER_POINTER (DECL_NAME (field)));
- else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
- error ("member `%s' is uninitialized reference",
- IDENTIFIER_POINTER (DECL_NAME (field)));
- }
- }
-
- if (TREE_CODE (type) == UNION_TYPE)
- {
- register tree field = TYPE_FIELDS (type);
- register tree next1;
-
- /* Find the first named field. ANSI decided in September 1990
- that only named fields count here. */
- while (field && (DECL_NAME (field) == 0
- || TREE_CODE (field) != FIELD_DECL))
- field = TREE_CHAIN (field);
-
- /* If this element specifies a field, initialize via that field. */
- if (TREE_PURPOSE (tail) != NULL_TREE)
- {
- int win = 0;
-
- if (TREE_CODE (TREE_PURPOSE (tail)) == FIELD_DECL)
- /* Handle the case of a call by build_c_cast. */
- field = TREE_PURPOSE (tail), win = 1;
- else if (TREE_CODE (TREE_PURPOSE (tail)) != IDENTIFIER_NODE)
- error ("index value instead of field name in union initializer");
- else
- {
- tree temp;
- for (temp = TYPE_FIELDS (type);
- temp;
- temp = TREE_CHAIN (temp))
- if (DECL_NAME (temp) == TREE_PURPOSE (tail))
- break;
- if (temp)
- field = temp, win = 1;
- else
- error ("no field `%s' in union being initialized",
- IDENTIFIER_POINTER (TREE_PURPOSE (tail)));
- }
- if (!win)
- TREE_VALUE (tail) = error_mark_node;
- }
- else if (field == 0)
- {
- cp_error ("union `%T' with no named members cannot be initialized",
- type);
- TREE_VALUE (tail) = error_mark_node;
- }
-
- if (TREE_VALUE (tail) != 0)
- {
- tree tail1 = tail;
-
- next1 = digest_init (TREE_TYPE (field),
- TREE_VALUE (tail), &tail1);
- if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST)
- my_friendly_abort (357);
- tail = tail1;
- }
- else
- {
- next1 = error_mark_node;
- tail = TREE_CHAIN (tail);
- }
-
- if (next1 == error_mark_node)
- erroneous = 1;
- else if (!TREE_CONSTANT (next1))
- allconstant = 0;
- else if (initializer_constant_valid_p (next1, TREE_TYPE (next1)) == 0)
- allsimple = 0;
- members = tree_cons (field, next1, members);
- }
-
- /* If arguments were specified as a list, just remove the ones we used. */
- if (elts)
- *elts = tail;
- /* If arguments were specified as a constructor,
- complain unless we used all the elements of the constructor. */
- else if (tail)
- pedwarn ("excess elements in aggregate initializer");
-
- if (erroneous)
- return error_mark_node;
-
- result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (members));
- if (init)
- TREE_HAS_CONSTRUCTOR (result) = TREE_HAS_CONSTRUCTOR (init);
- if (allconstant) TREE_CONSTANT (result) = 1;
- if (allconstant && allsimple) TREE_STATIC (result) = 1;
- return result;
-}
-
-/* Given a structure or union value DATUM, construct and return
- the structure or union component which results from narrowing
- that value by the type specified in BASETYPE. For example, given the
- hierarchy
-
- class L { int ii; };
- class A : L { ... };
- class B : L { ... };
- class C : A, B { ... };
-
- and the declaration
-
- C x;
-
- then the expression
-
- x.A::ii refers to the ii member of the L part of
- of A part of the C object named by X. In this case,
- DATUM would be x, and BASETYPE would be A. */
-
-tree
-build_scoped_ref (datum, basetype)
- tree datum;
- tree basetype;
-{
- tree ref;
- tree type = TREE_TYPE (datum);
-
- if (datum == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
-
- type = TYPE_MAIN_VARIANT (type);
-
- /* This is an easy conversion. */
- if (is_aggr_type (basetype, 1))
- {
- tree binfo = TYPE_BINFO (basetype);
- if (binfo != TYPE_BINFO (type))
- {
- binfo = get_binfo (binfo, type, 1);
- if (binfo == error_mark_node)
- return error_mark_node;
- if (binfo == 0)
- return error_not_base_type (basetype, type);
- }
-
- switch (TREE_CODE (datum))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- ref = convert_pointer_to (binfo,
- build_unary_op (ADDR_EXPR, TREE_OPERAND (datum, 0), 0));
- break;
- default:
- ref = convert_pointer_to (binfo,
- build_unary_op (ADDR_EXPR, datum, 0));
- }
- return build_indirect_ref (ref, "(compiler error in build_scoped_ref)");
- }
- return error_mark_node;
-}
-
-/* Build a reference to an object specified by the C++ `->' operator.
- Usually this just involves dereferencing the object, but if the
- `->' operator is overloaded, then such overloads must be
- performed until an object which does not have the `->' operator
- overloaded is found. An error is reported when circular pointer
- delegation is detected. */
-
-tree
-build_x_arrow (datum)
- tree datum;
-{
- tree types_memoized = NULL_TREE;
- register tree rval = datum;
- tree type = TREE_TYPE (rval);
- tree last_rval;
-
- if (type == error_mark_node)
- return error_mark_node;
-
- if (processing_template_decl)
- return build_min_nt (ARROW_EXPR, rval);
-
- if (TREE_CODE (rval) == OFFSET_REF)
- {
- rval = resolve_offset_ref (datum);
- type = TREE_TYPE (rval);
- }
-
- if (TREE_CODE (type) == REFERENCE_TYPE)
- {
- rval = convert_from_reference (rval);
- type = TREE_TYPE (rval);
- }
-
- if (IS_AGGR_TYPE (type) && TYPE_OVERLOADS_ARROW (complete_type (type)))
- {
- while ((rval = build_opfncall (COMPONENT_REF, LOOKUP_NORMAL, rval, NULL_TREE, NULL_TREE)))
- {
- if (rval == error_mark_node)
- return error_mark_node;
-
- if (value_member (TREE_TYPE (rval), types_memoized))
- {
- error ("circular pointer delegation detected");
- return error_mark_node;
- }
- else
- {
- types_memoized = tree_cons (NULL_TREE, TREE_TYPE (rval),
- types_memoized);
- }
- last_rval = rval;
- }
- if (TREE_CODE (TREE_TYPE (last_rval)) == REFERENCE_TYPE)
- last_rval = convert_from_reference (last_rval);
- }
- else
- last_rval = default_conversion (rval);
-
- /* Signature pointers are not dereferenced. */
- if (TYPE_LANG_SPECIFIC (TREE_TYPE (last_rval))
- && IS_SIGNATURE_POINTER (TREE_TYPE (last_rval)))
- return last_rval;
-
- if (TREE_CODE (TREE_TYPE (last_rval)) == POINTER_TYPE)
- return build_indirect_ref (last_rval, NULL_PTR);
-
- if (types_memoized)
- error ("result of `operator->()' yields non-pointer result");
- else
- error ("base operand of `->' is not a pointer");
- return error_mark_node;
-}
-
-/* Make an expression to refer to the COMPONENT field of
- structure or union value DATUM. COMPONENT is an arbitrary
- expression. DATUM has not already been checked out to be of
- aggregate type.
-
- For C++, COMPONENT may be a TREE_LIST. This happens when we must
- return an object of member type to a method of the current class,
- but there is not yet enough typing information to know which one.
- As a special case, if there is only one method by that name,
- it is returned. Otherwise we return an expression which other
- routines will have to know how to deal with later. */
-
-tree
-build_m_component_ref (datum, component)
- tree datum, component;
-{
- tree type;
- tree objtype = TREE_TYPE (datum);
- tree rettype;
- tree binfo;
-
- if (processing_template_decl)
- return build_min_nt (DOTSTAR_EXPR, datum, component);
-
- if (TYPE_PTRMEMFUNC_P (TREE_TYPE (component)))
- {
- type = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (component)));
- rettype = type;
- }
- else
- {
- component = build_indirect_ref (component, NULL_PTR);
- type = TREE_TYPE (component);
- rettype = TREE_TYPE (type);
- }
-
- if (datum == error_mark_node || component == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (type) != OFFSET_TYPE && TREE_CODE (type) != METHOD_TYPE)
- {
- cp_error ("`%E' cannot be used as a member pointer, since it is of type `%T'", component, type);
- return error_mark_node;
- }
-
- if (TREE_CODE (objtype) == REFERENCE_TYPE)
- objtype = TREE_TYPE (objtype);
- objtype = TYPE_MAIN_VARIANT (objtype);
-
- if (! IS_AGGR_TYPE (objtype))
- {
- cp_error ("cannot apply member pointer `%E' to `%E'", component, datum);
- cp_error ("which is of non-aggregate type `%T'", objtype);
- return error_mark_node;
- }
-
- binfo = get_binfo (TYPE_METHOD_BASETYPE (type), objtype, 1);
- if (binfo == NULL_TREE)
- {
- cp_error ("member type `%T::' incompatible with object type `%T'",
- TYPE_METHOD_BASETYPE (type), objtype);
- return error_mark_node;
- }
- else if (binfo == error_mark_node)
- return error_mark_node;
-
- component = build (OFFSET_REF, rettype, datum, component);
- if (TREE_CODE (type) == OFFSET_TYPE)
- component = resolve_offset_ref (component);
- return component;
-}
-
-/* Return a tree node for the expression TYPENAME '(' PARMS ')'. */
-
-tree
-build_functional_cast (exp, parms)
- tree exp;
- tree parms;
-{
- /* This is either a call to a constructor,
- or a C cast in C++'s `functional' notation. */
- tree type;
-
- if (exp == error_mark_node || parms == error_mark_node)
- return error_mark_node;
-
- if (TREE_CODE (exp) == IDENTIFIER_NODE)
- {
- if (IDENTIFIER_HAS_TYPE_VALUE (exp))
- /* Either an enum or an aggregate type. */
- type = IDENTIFIER_TYPE_VALUE (exp);
- else
- {
- type = lookup_name (exp, 1);
- if (!type || TREE_CODE (type) != TYPE_DECL)
- {
- cp_error ("`%T' fails to be a typedef or built-in type", exp);
- return error_mark_node;
- }
- type = TREE_TYPE (type);
- }
- }
- else if (TREE_CODE (exp) == TYPE_DECL)
- type = TREE_TYPE (exp);
- else
- type = exp;
-
- if (processing_template_decl)
- return build_min (CAST_EXPR, type, parms);
-
- if (IS_SIGNATURE (type))
- {
- error ("signature type not allowed in cast or constructor expression");
- return error_mark_node;
- }
-
- if (! IS_AGGR_TYPE (type))
- {
- /* this must build a C cast */
- if (parms == NULL_TREE)
- parms = integer_zero_node;
- else
- {
- if (TREE_CHAIN (parms) != NULL_TREE)
- pedwarn ("initializer list being treated as compound expression");
- parms = build_compound_expr (parms);
- }
-
- return build_c_cast (type, parms);
- }
-
- /* Prepare to evaluate as a call to a constructor. If this expression
- is actually used, for example,
-
- return X (arg1, arg2, ...);
-
- then the slot being initialized will be filled in. */
-
- if (TYPE_SIZE (complete_type (type)) == NULL_TREE)
- {
- cp_error ("type `%T' is not yet defined", type);
- return error_mark_node;
- }
-
- if (parms && TREE_CHAIN (parms) == NULL_TREE)
- return build_c_cast (type, TREE_VALUE (parms));
-
- exp = build_method_call (NULL_TREE, ctor_identifier, parms,
- TYPE_BINFO (type), LOOKUP_NORMAL);
-
- if (exp == error_mark_node)
- return error_mark_node;
-
- return build_cplus_new (type, exp);
-}
-
-/* Return the character string for the name that encodes the
- enumeral value VALUE in the domain TYPE. */
-
-char *
-enum_name_string (value, type)
- tree value;
- tree type;
-{
- register tree values = TYPE_VALUES (type);
- register HOST_WIDE_INT intval = TREE_INT_CST_LOW (value);
-
- my_friendly_assert (TREE_CODE (type) == ENUMERAL_TYPE, 324);
- while (values
- && TREE_INT_CST_LOW (TREE_VALUE (values)) != intval)
- values = TREE_CHAIN (values);
- if (values == NULL_TREE)
- {
- char *buf = (char *)oballoc (16 + TYPE_NAME_LENGTH (type));
-
- /* Value must have been cast. */
- sprintf (buf, "(enum %s)%d",
- TYPE_NAME_STRING (type), intval);
- return buf;
- }
- return IDENTIFIER_POINTER (TREE_PURPOSE (values));
-}
-
-#if 0
-/* Print out a language-specific error message for
- (Pascal) case or (C) switch statements.
- CODE tells what sort of message to print.
- TYPE is the type of the switch index expression.
- NEW is the new value that we were trying to add.
- OLD is the old value that stopped us from adding it. */
-
-void
-report_case_error (code, type, new_value, old_value)
- int code;
- tree type;
- tree new_value, old_value;
-{
- if (code == 1)
- {
- if (new_value)
- error ("case label not within a switch statement");
- else
- error ("default label not within a switch statement");
- }
- else if (code == 2)
- {
- if (new_value == 0)
- {
- error ("multiple default labels in one switch");
- return;
- }
- if (TREE_CODE (new_value) == RANGE_EXPR)
- if (TREE_CODE (old_value) == RANGE_EXPR)
- {
- char *buf = (char *)alloca (4 * (8 + TYPE_NAME_LENGTH (type)));
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- sprintf (buf, "overlapping ranges [%s..%s], [%s..%s] in case expression",
- enum_name_string (TREE_OPERAND (new_value, 0), type),
- enum_name_string (TREE_OPERAND (new_value, 1), type),
- enum_name_string (TREE_OPERAND (old_value, 0), type),
- enum_name_string (TREE_OPERAND (old_value, 1), type));
- else
- sprintf (buf, "overlapping ranges [%d..%d], [%d..%d] in case expression",
- TREE_INT_CST_LOW (TREE_OPERAND (new_value, 0)),
- TREE_INT_CST_LOW (TREE_OPERAND (new_value, 1)),
- TREE_INT_CST_LOW (TREE_OPERAND (old_value, 0)),
- TREE_INT_CST_LOW (TREE_OPERAND (old_value, 1)));
- error (buf);
- }
- else
- {
- char *buf = (char *)alloca (4 * (8 + TYPE_NAME_LENGTH (type)));
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- sprintf (buf, "range [%s..%s] includes element `%s' in case expression",
- enum_name_string (TREE_OPERAND (new_value, 0), type),
- enum_name_string (TREE_OPERAND (new_value, 1), type),
- enum_name_string (old_value, type));
- else
- sprintf (buf, "range [%d..%d] includes (%d) in case expression",
- TREE_INT_CST_LOW (TREE_OPERAND (new_value, 0)),
- TREE_INT_CST_LOW (TREE_OPERAND (new_value, 1)),
- TREE_INT_CST_LOW (old_value));
- error (buf);
- }
- else if (TREE_CODE (old_value) == RANGE_EXPR)
- {
- char *buf = (char *)alloca (4 * (8 + TYPE_NAME_LENGTH (type)));
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- sprintf (buf, "range [%s..%s] includes element `%s' in case expression",
- enum_name_string (TREE_OPERAND (old_value, 0), type),
- enum_name_string (TREE_OPERAND (old_value, 1), type),
- enum_name_string (new_value, type));
- else
- sprintf (buf, "range [%d..%d] includes (%d) in case expression",
- TREE_INT_CST_LOW (TREE_OPERAND (old_value, 0)),
- TREE_INT_CST_LOW (TREE_OPERAND (old_value, 1)),
- TREE_INT_CST_LOW (new_value));
- error (buf);
- }
- else
- {
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- error ("duplicate label `%s' in switch statement",
- enum_name_string (new_value, type));
- else
- error ("duplicate label (%d) in switch statement",
- TREE_INT_CST_LOW (new_value));
- }
- }
- else if (code == 3)
- {
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- warning ("case value out of range for enum %s",
- TYPE_NAME_STRING (type));
- else
- warning ("case value out of range");
- }
- else if (code == 4)
- {
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- error ("range values `%s' and `%s' reversed",
- enum_name_string (new_value, type),
- enum_name_string (old_value, type));
- else
- error ("range values reversed");
- }
-}
-#endif
-
-void
-check_for_new_type (string, inptree)
- char *string;
- flagged_type_tree inptree;
-{
- if (pedantic && inptree.new_type_flag)
- pedwarn ("ANSI C++ forbids defining types within %s",string);
-}
diff --git a/gcc/cp/xref.c b/gcc/cp/xref.c
deleted file mode 100644
index a09ab7ff295..00000000000
--- a/gcc/cp/xref.c
+++ /dev/null
@@ -1,842 +0,0 @@
-/* Code for handling XREF output from GNU C++.
- Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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 "tree.h"
-#include <stdio.h>
-#include "cp-tree.h"
-#include "input.h"
-
-#include <ctype.h>
-
-extern char *getpwd ();
-
-extern char *index ();
-extern char *rindex ();
-
-/* The character(s) used to join a directory specification (obtained with
- getwd or equivalent) with a non-absolute file name. */
-
-#ifndef FILE_NAME_JOINER
-#define FILE_NAME_JOINER "/"
-#endif
-
-/* Nonzero if NAME as a file name is absolute. */
-#ifndef FILE_NAME_ABSOLUTE_P
-#define FILE_NAME_ABSOLUTE_P(NAME) (NAME[0] == '/')
-#endif
-
-/* For cross referencing. */
-
-int flag_gnu_xref;
-
-/************************************************************************/
-/* */
-/* Common definitions */
-/* */
-/************************************************************************/
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#define PALLOC(typ) ((typ *) calloc(1,sizeof(typ)))
-
-
-/* Return a malloc'd copy of STR. */
-#define SALLOC(str) \
- ((char *) ((str) == NULL ? NULL \
- : (char *) strcpy ((char *) malloc (strlen ((str)) + 1), (str))))
-#define SFREE(str) (str != NULL && (free(str),0))
-
-#define STREQL(s1,s2) (strcmp((s1),(s2)) == 0)
-#define STRNEQ(s1,s2) (strcmp((s1),(s2)) != 0)
-#define STRLSS(s1,s2) (strcmp((s1),(s2)) < 0)
-#define STRLEQ(s1,s2) (strcmp((s1),(s2)) <= 0)
-#define STRGTR(s1,s2) (strcmp((s1),(s2)) > 0)
-#define STRGEQ(s1,s2) (strcmp((s1),(s2)) >= 0)
-
-/************************************************************************/
-/* */
-/* Type definitions */
-/* */
-/************************************************************************/
-
-
-typedef struct _XREF_FILE * XREF_FILE;
-typedef struct _XREF_SCOPE * XREF_SCOPE;
-
-typedef struct _XREF_FILE
-{
- char *name;
- char *outname;
- XREF_FILE next;
-} XREF_FILE_INFO;
-
-typedef struct _XREF_SCOPE
-{
- int gid;
- int lid;
- XREF_FILE file;
- int start;
- XREF_SCOPE outer;
-} XREF_SCOPE_INFO;
-
-/************************************************************************/
-/* */
-/* Local storage */
-/* */
-/************************************************************************/
-
-static char doing_xref = 0;
-static FILE * xref_file = NULL;
-static char xref_name[1024];
-static XREF_FILE all_files = NULL;
-static char * wd_name = NULL;
-static XREF_SCOPE cur_scope = NULL;
-static int scope_ctr = 0;
-static XREF_FILE last_file = NULL;
-static tree last_fndecl = NULL;
-
-/************************************************************************/
-/* */
-/* Forward definitions */
-/* */
-/************************************************************************/
-
-extern void GNU_xref_begin();
-extern void GNU_xref_end();
-extern void GNU_xref_file();
-extern void GNU_xref_start_scope();
-extern void GNU_xref_end_scope();
-extern void GNU_xref_ref();
-extern void GNU_xref_decl();
-extern void GNU_xref_call();
-extern void GNU_xref_function();
-extern void GNU_xref_assign();
-extern void GNU_xref_hier();
-extern void GNU_xref_member();
-
-static void gen_assign();
-static XREF_FILE find_file();
-static char * filename();
-static char * fctname();
-static char * declname();
-static void simplify_type();
-static char * fixname();
-static void open_xref_file();
-
-extern char * type_as_string();
-
-/* Start cross referencing. FILE is the name of the file we xref. */
-
-void
-GNU_xref_begin (file)
- char *file;
-{
- doing_xref = 1;
-
- if (file != NULL && STRNEQ (file,"-"))
- {
- open_xref_file(file);
- GNU_xref_file(file);
- }
-}
-
-/* Finish cross-referencing. ERRCNT is the number of errors
- we encountered. */
-
-void
-GNU_xref_end (ect)
- int ect;
-{
- XREF_FILE xf;
-
- if (!doing_xref) return;
-
- xf = find_file (input_filename);
- if (xf == NULL) return;
-
- while (cur_scope != NULL)
- GNU_xref_end_scope(cur_scope->gid,0,0,0);
-
- doing_xref = 0;
-
- if (xref_file == NULL) return;
-
- fclose (xref_file);
-
- xref_file = NULL;
- all_files = NULL;
-
- if (ect > 0) unlink (xref_name);
-}
-
-/* Write out xref for file named NAME. */
-
-void
-GNU_xref_file (name)
- char *name;
-{
- XREF_FILE xf;
-
- if (!doing_xref || name == NULL) return;
-
- if (xref_file == NULL)
- {
- open_xref_file (name);
- if (!doing_xref) return;
- }
-
- if (all_files == NULL)
- fprintf(xref_file,"SCP * 0 0 0 0 RESET\n");
-
- xf = find_file (name);
- if (xf != NULL) return;
-
- xf = PALLOC (XREF_FILE_INFO);
- xf->name = SALLOC (name);
- xf->next = all_files;
- all_files = xf;
-
- if (wd_name == NULL)
- wd_name = getpwd ();
-
- if (FILE_NAME_ABSOLUTE_P (name) || ! wd_name)
- xf->outname = xf->name;
- else
- {
- char *nmbuf
- = (char *) malloc (strlen (wd_name) + strlen (FILE_NAME_JOINER)
- + strlen (name) + 1);
- sprintf (nmbuf, "%s%s%s", wd_name, FILE_NAME_JOINER, name);
- name = nmbuf;
- xf->outname = nmbuf;
- }
-
- fprintf (xref_file, "FIL %s %s 0\n", name, wd_name);
-
- filename (xf);
- fctname (NULL);
-}
-
-/* Start a scope identified at level ID. */
-
-void
-GNU_xref_start_scope (id)
- HOST_WIDE_INT id;
-{
- XREF_SCOPE xs;
- XREF_FILE xf;
-
- if (!doing_xref) return;
- xf = find_file (input_filename);
-
- xs = PALLOC (XREF_SCOPE_INFO);
- xs->file = xf;
- xs->start = lineno;
- if (xs->start <= 0) xs->start = 1;
- xs->gid = id;
- xs->lid = ++scope_ctr;
- xs->outer = cur_scope;
- cur_scope = xs;
-}
-
-/* Finish a scope at level ID.
- INID is ???
- PRM is ???
- KEEP is nonzero iff this scope is retained (nonzero if it's
- a compiler-generated invisible scope).
- TRNS is ??? */
-
-void
-GNU_xref_end_scope (id,inid,prm,keep)
- HOST_WIDE_INT id;
- HOST_WIDE_INT inid;
- int prm,keep;
-{
- XREF_FILE xf;
- XREF_SCOPE xs,lxs,oxs;
- char *stype;
-
- if (!doing_xref) return;
- xf = find_file (input_filename);
- if (xf == NULL) return;
-
- lxs = NULL;
- for (xs = cur_scope; xs != NULL; xs = xs->outer)
- {
- if (xs->gid == id) break;
- lxs = xs;
- }
- if (xs == NULL) return;
-
- if (inid != 0) {
- for (oxs = cur_scope; oxs != NULL; oxs = oxs->outer) {
- if (oxs->gid == inid) break;
- }
- if (oxs == NULL) return;
- inid = oxs->lid;
- }
-
- if (prm == 2) stype = "SUE";
- else if (prm != 0) stype = "ARGS";
- else if (keep == 2 || inid != 0) stype = "INTERN";
- else stype = "EXTERN";
-
- fprintf (xref_file,"SCP %s %d %d %d %d %s\n",
- filename (xf), xs->start, lineno,xs->lid, inid, stype);
-
- if (lxs == NULL) cur_scope = xs->outer;
- else lxs->outer = xs->outer;
-
- free (xs);
-}
-
-/* Output a reference to NAME in FNDECL. */
-
-void
-GNU_xref_ref (fndecl,name)
- tree fndecl;
- char *name;
-{
- XREF_FILE xf;
-
- if (!doing_xref) return;
- xf = find_file (input_filename);
- if (xf == NULL) return;
-
- fprintf (xref_file, "REF %s %d %s %s\n",
- filename (xf), lineno, fctname (fndecl), name);
-}
-
-/* Output a reference to DECL in FNDECL. */
-
-void
-GNU_xref_decl (fndecl,decl)
- tree fndecl;
- tree decl;
-{
- XREF_FILE xf,xf1;
- char *cls;
- char *name;
- char buf[10240];
- int uselin;
-
- if (!doing_xref) return;
- xf = find_file (input_filename);
- if (xf == NULL) return;
-
- uselin = FALSE;
-
- if (TREE_CODE (decl) == TYPE_DECL) cls = "TYPEDEF";
- else if (TREE_CODE (decl) == FIELD_DECL) cls = "FIELD";
- else if (TREE_CODE (decl) == VAR_DECL)
- {
- if (fndecl == NULL && TREE_STATIC(decl)
- && TREE_READONLY(decl) && DECL_INITIAL(decl) != 0
- && !TREE_PUBLIC(decl) && !DECL_EXTERNAL(decl)
- && DECL_MODE(decl) != BLKmode) cls = "CONST";
- else if (DECL_EXTERNAL(decl)) cls = "EXTERN";
- else if (TREE_PUBLIC(decl)) cls = "EXTDEF";
- else if (TREE_STATIC(decl)) cls = "STATIC";
- else if (DECL_REGISTER(decl)) cls = "REGISTER";
- else cls = "AUTO";
- }
- else if (TREE_CODE (decl) == PARM_DECL) cls = "PARAM";
- else if (TREE_CODE (decl) == FIELD_DECL) cls = "FIELD";
- else if (TREE_CODE (decl) == CONST_DECL) cls = "CONST";
- else if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- if (DECL_EXTERNAL (decl)) cls = "EXTERN";
- else if (TREE_PUBLIC (decl)) cls = "EFUNCTION";
- else cls = "SFUNCTION";
- }
- else if (TREE_CODE (decl) == LABEL_DECL) cls = "LABEL";
- else if (TREE_CODE (decl) == UNION_TYPE)
- {
- cls = "UNIONID";
- decl = TYPE_NAME (decl);
- uselin = TRUE;
- }
- else if (TREE_CODE (decl) == RECORD_TYPE)
- {
- if (CLASSTYPE_DECLARED_CLASS (decl)) cls = "CLASSID";
- else if (IS_SIGNATURE (decl)) cls = "SIGNATUREID";
- else cls = "STRUCTID";
- decl = TYPE_NAME (decl);
- uselin = TRUE;
- }
- else if (TREE_CODE (decl) == ENUMERAL_TYPE)
- {
- cls = "ENUMID";
- decl = TYPE_NAME (decl);
- uselin = TRUE;
- }
- else if (TREE_CODE (decl) == TEMPLATE_DECL)
- {
- if (TREE_CODE (DECL_RESULT (decl)) == TYPE_DECL)
- cls = "CLASSTEMP";
- else if (TREE_CODE (DECL_RESULT (decl)) == FUNCTION_DECL)
- cls = "FUNCTEMP";
- else if (TREE_CODE (DECL_RESULT (decl)) == VAR_DECL)
- cls = "VARTEMP";
- else
- my_friendly_abort (358);
- uselin = TRUE;
- }
- else cls = "UNKNOWN";
-
- if (decl == NULL || DECL_NAME (decl) == NULL) return;
-
- if (uselin && decl->decl.linenum > 0 && decl->decl.filename != NULL)
- {
- xf1 = find_file (decl->decl.filename);
- if (xf1 != NULL)
- {
- lineno = decl->decl.linenum;
- xf = xf1;
- }
- }
-
- if (DECL_ASSEMBLER_NAME (decl))
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
- else
- name = IDENTIFIER_POINTER (DECL_NAME (decl));
-
- strcpy (buf, type_as_string (TREE_TYPE (decl), 0));
- simplify_type (buf);
-
- fprintf (xref_file, "DCL %s %d %s %d %s %s %s\n",
- filename(xf), lineno, name,
- (cur_scope != NULL ? cur_scope->lid : 0),
- cls, fctname(fndecl), buf);
-
- if (STREQL (cls, "STRUCTID") || STREQL (cls, "UNIONID")
- || STREQL (cls, "SIGNATUREID"))
- {
- cls = "CLASSID";
- fprintf (xref_file, "DCL %s %d %s %d %s %s %s\n",
- filename(xf), lineno,name,
- (cur_scope != NULL ? cur_scope->lid : 0),
- cls, fctname(fndecl), buf);
- }
-}
-
-/* Output a reference to a call to NAME in FNDECL. */
-
-void
-GNU_xref_call (fndecl, name)
- tree fndecl;
- char *name;
-{
- XREF_FILE xf;
- char buf[1024];
- char *s;
-
- if (!doing_xref) return;
- xf = find_file (input_filename);
- if (xf == NULL) return;
- name = fixname (name, buf);
-
- for (s = name; *s != 0; ++s)
- if (*s == '_' && s[1] == '_') break;
- if (*s != 0) GNU_xref_ref (fndecl, name);
-
- fprintf (xref_file, "CAL %s %d %s %s\n",
- filename (xf), lineno, name, fctname (fndecl));
-}
-
-/* Output cross-reference info about FNDECL. If non-NULL,
- ARGS are the arguments for the function (i.e., before the FUNCTION_DECL
- has been fully built). */
-
-void
-GNU_xref_function (fndecl, args)
- tree fndecl;
- tree args;
-{
- XREF_FILE xf;
- int ct;
- char buf[1024];
-
- if (!doing_xref) return;
- xf = find_file (input_filename);
- if (xf == NULL) return;
-
- ct = 0;
- buf[0] = 0;
- if (args == NULL) args = DECL_ARGUMENTS (fndecl);
-
- GNU_xref_decl (NULL, fndecl);
-
- for ( ; args != NULL; args = TREE_CHAIN (args))
- {
- GNU_xref_decl (fndecl,args);
- if (ct != 0) strcat (buf,",");
- strcat (buf, declname (args));
- ++ct;
- }
-
- fprintf (xref_file, "PRC %s %d %s %d %d %s\n",
- filename(xf), lineno, declname(fndecl),
- (cur_scope != NULL ? cur_scope->lid : 0),
- ct, buf);
-}
-
-/* Output cross-reference info about an assignment to NAME. */
-
-void
-GNU_xref_assign(name)
- tree name;
-{
- XREF_FILE xf;
-
- if (!doing_xref) return;
- xf = find_file(input_filename);
- if (xf == NULL) return;
-
- gen_assign(xf, name);
-}
-
-static void
-gen_assign(xf, name)
- XREF_FILE xf;
- tree name;
-{
- char *s;
-
- s = NULL;
-
- switch (TREE_CODE (name))
- {
- case IDENTIFIER_NODE :
- s = IDENTIFIER_POINTER(name);
- break;
- case VAR_DECL :
- s = declname(name);
- break;
- case COMPONENT_REF :
- gen_assign(xf, TREE_OPERAND(name, 0));
- gen_assign(xf, TREE_OPERAND(name, 1));
- break;
- case INDIRECT_REF :
- case OFFSET_REF :
- case ARRAY_REF :
- case BUFFER_REF :
- gen_assign(xf, TREE_OPERAND(name, 0));
- break;
- case COMPOUND_EXPR :
- gen_assign(xf, TREE_OPERAND(name, 1));
- break;
- default :
- break;
- }
-
- if (s != NULL)
- fprintf(xref_file, "ASG %s %d %s\n", filename(xf), lineno, s);
-}
-
-/* Output cross-reference info about a class hierarchy.
- CLS is the class type of interest. BASE is a baseclass
- for CLS. PUB and VIRT give the access info about
- the class derivation. FRND is nonzero iff BASE is a friend
- of CLS.
-
- ??? Needs to handle nested classes. */
-
-void
-GNU_xref_hier(cls, base, pub, virt, frnd)
- char *cls;
- char *base;
- int pub;
- int virt;
- int frnd;
-{
- XREF_FILE xf;
-
- if (!doing_xref) return;
- xf = find_file(input_filename);
- if (xf == NULL) return;
-
- fprintf(xref_file, "HIE %s %d %s %s %d %d %d\n",
- filename(xf), lineno, cls, base, pub, virt, frnd);
-}
-
-/* Output cross-reference info about class members. CLS
- is the containing type; FLD is the class member. */
-
-void
-GNU_xref_member(cls, fld)
- tree cls;
- tree fld;
-{
- XREF_FILE xf;
- char *prot;
- int confg, pure;
- char *d;
-#ifdef XREF_SHORT_MEMBER_NAMES
- int i;
-#endif
- char buf[1024], bufa[1024];
-
- if (!doing_xref) return;
- xf = find_file(fld->decl.filename);
- if (xf == NULL) return;
-
- if (TREE_PRIVATE (fld)) prot = "PRIVATE";
- else if (TREE_PROTECTED(fld)) prot = "PROTECTED";
- else prot = "PUBLIC";
-
- confg = 0;
- if (TREE_CODE (fld) == FUNCTION_DECL && DECL_CONST_MEMFUNC_P(fld))
- confg = 1;
- else if (TREE_CODE (fld) == CONST_DECL)
- confg = 1;
-
- pure = 0;
- if (TREE_CODE (fld) == FUNCTION_DECL && DECL_ABSTRACT_VIRTUAL_P(fld))
- pure = 1;
-
- d = IDENTIFIER_POINTER(cls);
- sprintf(buf, "%d%s", strlen(d), d);
-#ifdef XREF_SHORT_MEMBER_NAMES
- i = strlen(buf);
-#endif
- strcpy(bufa, declname(fld));
-
-#ifdef XREF_SHORT_MEMBER_NAMES
- for (p = &bufa[1]; *p != 0; ++p)
- {
- if (p[0] == '_' && p[1] == '_' && p[2] >= '0' && p[2] <= '9') {
- if (strncmp(&p[2], buf, i) == 0) *p = 0;
- break;
- }
- else if (p[0] == '_' && p[1] == '_' && p[2] == 'C' && p[3] >= '0' && p[3] <= '9') {
- if (strncmp(&p[3], buf, i) == 0) *p = 0;
- break;
- }
- }
-#endif
-
- fprintf(xref_file, "MEM %s %d %s %s %s %d %d %d %d %d %d %d\n",
- filename(xf), fld->decl.linenum, d, bufa, prot,
- (TREE_CODE (fld) == FUNCTION_DECL ? 0 : 1),
- (DECL_INLINE (fld) ? 1 : 0),
- (DECL_FRIEND_P(fld) ? 1 : 0),
- (DECL_VINDEX(fld) ? 1 : 0),
- (TREE_STATIC(fld) ? 1 : 0),
- pure, confg);
-}
-
-/* Find file entry given name. */
-
-static XREF_FILE
-find_file(name)
- char *name;
-{
- XREF_FILE xf;
-
- for (xf = all_files; xf != NULL; xf = xf->next) {
- if (STREQL(name, xf->name)) break;
- }
-
- return xf;
-}
-
-/* Return filename for output purposes. */
-
-static char *
-filename(xf)
- XREF_FILE xf;
-{
- if (xf == NULL) {
- last_file = NULL;
- return "*";
- }
-
- if (last_file == xf) return "*";
-
- last_file = xf;
-
- return xf->outname;
-}
-
-/* Return function name for output purposes. */
-
-static char *
-fctname(fndecl)
- tree fndecl;
-{
- static char fctbuf[1024];
- char *s;
-
- if (fndecl == NULL && last_fndecl == NULL) return "*";
-
- if (fndecl == NULL)
- {
- last_fndecl = NULL;
- return "*TOP*";
- }
-
- if (fndecl == last_fndecl) return "*";
-
- last_fndecl = fndecl;
-
- s = declname(fndecl);
- s = fixname(s, fctbuf);
-
- return s;
-}
-
-/* Return decl name for output purposes. */
-
-static char *
-declname(dcl)
- tree dcl;
-{
- if (DECL_NAME (dcl) == NULL) return "?";
-
- if (DECL_ASSEMBLER_NAME (dcl))
- return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (dcl));
- else
- return IDENTIFIER_POINTER (DECL_NAME (dcl));
-}
-
-/* Simplify a type string by removing unneeded parenthesis. */
-
-static void
-simplify_type(typ)
- char *typ;
-{
- char *s;
- int lvl, i;
-
- i = strlen(typ);
- while (i > 0 && isspace(typ[i-1])) typ[--i] = 0;
-
- if (i > 7 && STREQL(&typ[i-5], "const"))
- {
- typ[i-5] = 0;
- i -= 5;
- }
-
- if (typ[i-1] != ')') return;
-
- s = &typ[i-2];
- lvl = 1;
- while (*s != 0) {
- if (*s == ')') ++lvl;
- else if (*s == '(')
- {
- --lvl;
- if (lvl == 0)
- {
- s[1] = ')';
- s[2] = 0;
- break;
- }
- }
- --s;
- }
-
- if (*s != 0 && s[-1] == ')')
- {
- --s;
- --s;
- if (*s == '(') s[2] = 0;
- else if (*s == ':') {
- while (*s != '(') --s;
- s[1] = ')';
- s[2] = 0;
- }
- }
-}
-
-/* Fixup a function name (take care of embedded spaces). */
-
-static char *
-fixname(nam, buf)
- char *nam;
- char *buf;
-{
- char *s, *t;
- int fg;
-
- s = nam;
- t = buf;
- fg = 0;
-
- while (*s != 0)
- {
- if (*s == ' ')
- {
- *t++ = '\36';
- ++fg;
- }
- else *t++ = *s;
- ++s;
- }
- *t = 0;
-
- if (fg == 0) return nam;
-
- return buf;
-}
-
-/* Open file for xreffing. */
-
-static void
-open_xref_file(file)
- char *file;
-{
- char *s, *t;
-
-#ifdef XREF_FILE_NAME
- XREF_FILE_NAME (xref_name, file);
-#else
- s = rindex (file, '/');
- if (s == NULL)
- sprintf (xref_name, ".%s.gxref", file);
- else
- {
- ++s;
- strcpy (xref_name, file);
- t = rindex (xref_name, '/');
- ++t;
- *t++ = '.';
- strcpy (t, s);
- strcat (t, ".gxref");
- }
-#endif /* no XREF_FILE_NAME */
-
- xref_file = fopen(xref_name, "w");
-
- if (xref_file == NULL)
- {
- error("Can't create cross-reference file `%s'", xref_name);
- doing_xref = 0;
- }
-}
diff --git a/gcc/cplus-dem.c b/gcc/cplus-dem.c
deleted file mode 100644
index f43f7c1562d..00000000000
--- a/gcc/cplus-dem.c
+++ /dev/null
@@ -1,3058 +0,0 @@
-/* Demangler for GNU C++
- Copyright 1989, 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
- Written by James Clark (jjc@jclark.uucp)
- Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This file exports two functions; cplus_mangle_opname and cplus_demangle.
-
- This file imports xmalloc and xrealloc, which are like malloc and
- realloc except that they generate a fatal error if there is no
- available memory. */
-
-/* This file lives in both GCC and libiberty. When making changes, please
- try not to break either. */
-
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <demangle.h>
-#undef CURRENT_DEMANGLING_STYLE
-#define CURRENT_DEMANGLING_STYLE work->options
-
-extern char *xmalloc PARAMS((unsigned));
-extern char *xrealloc PARAMS((char *, unsigned));
-
-static const char *mystrstr PARAMS ((const char *, const char *));
-
-static const char *
-mystrstr (s1, s2)
- const char *s1, *s2;
-{
- register const char *p = s1;
- register int len = strlen (s2);
-
- for (; (p = strchr (p, *s2)) != 0; p++)
- {
- if (strncmp (p, s2, len) == 0)
- {
- return (p);
- }
- }
- return (0);
-}
-
-/* In order to allow a single demangler executable to demangle strings
- using various common values of CPLUS_MARKER, as well as any specific
- one set at compile time, we maintain a string containing all the
- commonly used ones, and check to see if the marker we are looking for
- is in that string. CPLUS_MARKER is usually '$' on systems where the
- assembler can deal with that. Where the assembler can't, it's usually
- '.' (but on many systems '.' is used for other things). We put the
- current defined CPLUS_MARKER first (which defaults to '$'), followed
- by the next most common value, followed by an explicit '$' in case
- the value of CPLUS_MARKER is not '$'.
-
- We could avoid this if we could just get g++ to tell us what the actual
- cplus marker character is as part of the debug information, perhaps by
- ensuring that it is the character that terminates the gcc<n>_compiled
- marker symbol (FIXME). */
-
-#if !defined (CPLUS_MARKER)
-#define CPLUS_MARKER '$'
-#endif
-
-enum demangling_styles current_demangling_style = gnu_demangling;
-
-static char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' };
-
-void
-set_cplus_marker_for_demangling (ch)
- int ch;
-{
- cplus_markers[0] = ch;
-}
-
-/* Stuff that is shared between sub-routines.
- Using a shared structure allows cplus_demangle to be reentrant. */
-
-struct work_stuff
-{
- int options;
- char **typevec;
- int ntypes;
- int typevec_size;
- int constructor;
- int destructor;
- int static_type; /* A static member function */
- int const_type; /* A const member function */
-};
-
-#define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI)
-#define PRINT_ARG_TYPES (work -> options & DMGL_PARAMS)
-
-static const struct optable
-{
- const char *in;
- const char *out;
- int flags;
-} optable[] = {
- {"nw", " new", DMGL_ANSI}, /* new (1.92, ansi) */
- {"dl", " delete", DMGL_ANSI}, /* new (1.92, ansi) */
- {"new", " new", 0}, /* old (1.91, and 1.x) */
- {"delete", " delete", 0}, /* old (1.91, and 1.x) */
- {"vn", " new []", DMGL_ANSI}, /* GNU, pending ansi */
- {"vd", " delete []", DMGL_ANSI}, /* GNU, pending ansi */
- {"as", "=", DMGL_ANSI}, /* ansi */
- {"ne", "!=", DMGL_ANSI}, /* old, ansi */
- {"eq", "==", DMGL_ANSI}, /* old, ansi */
- {"ge", ">=", DMGL_ANSI}, /* old, ansi */
- {"gt", ">", DMGL_ANSI}, /* old, ansi */
- {"le", "<=", DMGL_ANSI}, /* old, ansi */
- {"lt", "<", DMGL_ANSI}, /* old, ansi */
- {"plus", "+", 0}, /* old */
- {"pl", "+", DMGL_ANSI}, /* ansi */
- {"apl", "+=", DMGL_ANSI}, /* ansi */
- {"minus", "-", 0}, /* old */
- {"mi", "-", DMGL_ANSI}, /* ansi */
- {"ami", "-=", DMGL_ANSI}, /* ansi */
- {"mult", "*", 0}, /* old */
- {"ml", "*", DMGL_ANSI}, /* ansi */
- {"amu", "*=", DMGL_ANSI}, /* ansi (ARM/Lucid) */
- {"aml", "*=", DMGL_ANSI}, /* ansi (GNU/g++) */
- {"convert", "+", 0}, /* old (unary +) */
- {"negate", "-", 0}, /* old (unary -) */
- {"trunc_mod", "%", 0}, /* old */
- {"md", "%", DMGL_ANSI}, /* ansi */
- {"amd", "%=", DMGL_ANSI}, /* ansi */
- {"trunc_div", "/", 0}, /* old */
- {"dv", "/", DMGL_ANSI}, /* ansi */
- {"adv", "/=", DMGL_ANSI}, /* ansi */
- {"truth_andif", "&&", 0}, /* old */
- {"aa", "&&", DMGL_ANSI}, /* ansi */
- {"truth_orif", "||", 0}, /* old */
- {"oo", "||", DMGL_ANSI}, /* ansi */
- {"truth_not", "!", 0}, /* old */
- {"nt", "!", DMGL_ANSI}, /* ansi */
- {"postincrement","++", 0}, /* old */
- {"pp", "++", DMGL_ANSI}, /* ansi */
- {"postdecrement","--", 0}, /* old */
- {"mm", "--", DMGL_ANSI}, /* ansi */
- {"bit_ior", "|", 0}, /* old */
- {"or", "|", DMGL_ANSI}, /* ansi */
- {"aor", "|=", DMGL_ANSI}, /* ansi */
- {"bit_xor", "^", 0}, /* old */
- {"er", "^", DMGL_ANSI}, /* ansi */
- {"aer", "^=", DMGL_ANSI}, /* ansi */
- {"bit_and", "&", 0}, /* old */
- {"ad", "&", DMGL_ANSI}, /* ansi */
- {"aad", "&=", DMGL_ANSI}, /* ansi */
- {"bit_not", "~", 0}, /* old */
- {"co", "~", DMGL_ANSI}, /* ansi */
- {"call", "()", 0}, /* old */
- {"cl", "()", DMGL_ANSI}, /* ansi */
- {"alshift", "<<", 0}, /* old */
- {"ls", "<<", DMGL_ANSI}, /* ansi */
- {"als", "<<=", DMGL_ANSI}, /* ansi */
- {"arshift", ">>", 0}, /* old */
- {"rs", ">>", DMGL_ANSI}, /* ansi */
- {"ars", ">>=", DMGL_ANSI}, /* ansi */
- {"component", "->", 0}, /* old */
- {"pt", "->", DMGL_ANSI}, /* ansi; Lucid C++ form */
- {"rf", "->", DMGL_ANSI}, /* ansi; ARM/GNU form */
- {"indirect", "*", 0}, /* old */
- {"method_call", "->()", 0}, /* old */
- {"addr", "&", 0}, /* old (unary &) */
- {"array", "[]", 0}, /* old */
- {"vc", "[]", DMGL_ANSI}, /* ansi */
- {"compound", ", ", 0}, /* old */
- {"cm", ", ", DMGL_ANSI}, /* ansi */
- {"cond", "?:", 0}, /* old */
- {"cn", "?:", DMGL_ANSI}, /* pseudo-ansi */
- {"max", ">?", 0}, /* old */
- {"mx", ">?", DMGL_ANSI}, /* pseudo-ansi */
- {"min", "<?", 0}, /* old */
- {"mn", "<?", DMGL_ANSI}, /* pseudo-ansi */
- {"nop", "", 0}, /* old (for operator=) */
- {"rm", "->*", DMGL_ANSI} /* ansi */
-};
-
-
-typedef struct string /* Beware: these aren't required to be */
-{ /* '\0' terminated. */
- char *b; /* pointer to start of string */
- char *p; /* pointer after last character */
- char *e; /* pointer after end of allocated space */
-} string;
-
-#define STRING_EMPTY(str) ((str) -> b == (str) -> p)
-#define PREPEND_BLANK(str) {if (!STRING_EMPTY(str)) \
- string_prepend(str, " ");}
-#define APPEND_BLANK(str) {if (!STRING_EMPTY(str)) \
- string_append(str, " ");}
-
-#define ARM_VTABLE_STRING "__vtbl__" /* Lucid/ARM virtual table prefix */
-#define ARM_VTABLE_STRLEN 8 /* strlen (ARM_VTABLE_STRING) */
-
-/* Prototypes for local functions */
-
-static char *
-mop_up PARAMS ((struct work_stuff *, string *, int));
-
-#if 0
-static int
-demangle_method_args PARAMS ((struct work_stuff *work, const char **, string *));
-#endif
-
-static int
-demangle_template PARAMS ((struct work_stuff *work, const char **, string *,
- string *));
-
-static int
-arm_pt PARAMS ((struct work_stuff *, const char *, int, const char **,
- const char **));
-
-static void
-demangle_arm_pt PARAMS ((struct work_stuff *, const char **, int, string *));
-
-static int
-demangle_class_name PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-demangle_qualified PARAMS ((struct work_stuff *, const char **, string *,
- int, int));
-
-static int
-demangle_class PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-demangle_fund_type PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-demangle_signature PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-demangle_prefix PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-gnu_special PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-arm_special PARAMS ((struct work_stuff *, const char **, string *));
-
-static void
-string_need PARAMS ((string *, int));
-
-static void
-string_delete PARAMS ((string *));
-
-static void
-string_init PARAMS ((string *));
-
-static void
-string_clear PARAMS ((string *));
-
-#if 0
-static int
-string_empty PARAMS ((string *));
-#endif
-
-static void
-string_append PARAMS ((string *, const char *));
-
-static void
-string_appends PARAMS ((string *, string *));
-
-static void
-string_appendn PARAMS ((string *, const char *, int));
-
-static void
-string_prepend PARAMS ((string *, const char *));
-
-static void
-string_prependn PARAMS ((string *, const char *, int));
-
-static int
-get_count PARAMS ((const char **, int *));
-
-static int
-consume_count PARAMS ((const char **));
-
-static int
-demangle_args PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-do_type PARAMS ((struct work_stuff *, const char **, string *));
-
-static int
-do_arg PARAMS ((struct work_stuff *, const char **, string *));
-
-static void
-demangle_function_name PARAMS ((struct work_stuff *, const char **, string *,
- const char *));
-
-static void
-remember_type PARAMS ((struct work_stuff *, const char *, int));
-
-static void
-forget_types PARAMS ((struct work_stuff *));
-
-static void
-string_prepends PARAMS ((string *, string *));
-
-/* Translate count to integer, consuming tokens in the process.
- Conversion terminates on the first non-digit character.
- Trying to consume something that isn't a count results in
- no consumption of input and a return of 0. */
-
-static int
-consume_count (type)
- const char **type;
-{
- int count = 0;
-
- while (isdigit (**type))
- {
- count *= 10;
- count += **type - '0';
- (*type)++;
- }
- return (count);
-}
-
-int
-cplus_demangle_opname (opname, result, options)
- const char *opname;
- char *result;
- int options;
-{
- int len, i, len1, ret;
- string type;
- struct work_stuff work[1];
- const char *tem;
-
- len = strlen(opname);
- result[0] = '\0';
- ret = 0;
- work->options = options;
-
- if (opname[0] == '_' && opname[1] == '_'
- && opname[2] == 'o' && opname[3] == 'p')
- {
- /* ANSI. */
- /* type conversion operator. */
- tem = opname + 4;
- if (do_type (work, &tem, &type))
- {
- strcat (result, "operator ");
- strncat (result, type.b, type.p - type.b);
- string_delete (&type);
- ret = 1;
- }
- }
- else if (opname[0] == '_' && opname[1] == '_'
- && opname[2] >= 'a' && opname[2] <= 'z'
- && opname[3] >= 'a' && opname[3] <= 'z')
- {
- if (opname[4] == '\0')
- {
- /* Operator. */
- for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
- {
- if (strlen (optable[i].in) == 2
- && memcmp (optable[i].in, opname + 2, 2) == 0)
- {
- strcat (result, "operator");
- strcat (result, optable[i].out);
- ret = 1;
- break;
- }
- }
- }
- else
- {
- if (opname[2] == 'a' && opname[5] == '\0')
- {
- /* Assignment. */
- for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
- {
- if (strlen (optable[i].in) == 3
- && memcmp (optable[i].in, opname + 2, 3) == 0)
- {
- strcat (result, "operator");
- strcat (result, optable[i].out);
- ret = 1;
- break;
- }
- }
- }
- }
- }
- else if (len >= 3
- && opname[0] == 'o'
- && opname[1] == 'p'
- && strchr (cplus_markers, opname[2]) != NULL)
- {
- /* see if it's an assignment expression */
- if (len >= 10 /* op$assign_ */
- && memcmp (opname + 3, "assign_", 7) == 0)
- {
- for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
- {
- len1 = len - 10;
- if (strlen (optable[i].in) == len1
- && memcmp (optable[i].in, opname + 10, len1) == 0)
- {
- strcat (result, "operator");
- strcat (result, optable[i].out);
- strcat (result, "=");
- ret = 1;
- break;
- }
- }
- }
- else
- {
- for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
- {
- len1 = len - 3;
- if (strlen (optable[i].in) == len1
- && memcmp (optable[i].in, opname + 3, len1) == 0)
- {
- strcat (result, "operator");
- strcat (result, optable[i].out);
- ret = 1;
- break;
- }
- }
- }
- }
- else if (len >= 5 && memcmp (opname, "type", 4) == 0
- && strchr (cplus_markers, opname[4]) != NULL)
- {
- /* type conversion operator */
- tem = opname + 5;
- if (do_type (work, &tem, &type))
- {
- strcat (result, "operator ");
- strncat (result, type.b, type.p - type.b);
- string_delete (&type);
- ret = 1;
- }
- }
- return ret;
-
-}
-/* Takes operator name as e.g. "++" and returns mangled
- operator name (e.g. "postincrement_expr"), or NULL if not found.
-
- If OPTIONS & DMGL_ANSI == 1, return the ANSI name;
- if OPTIONS & DMGL_ANSI == 0, return the old GNU name. */
-
-const char *
-cplus_mangle_opname (opname, options)
- const char *opname;
- int options;
-{
- int i;
- int len;
-
- len = strlen (opname);
- for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
- {
- if (strlen (optable[i].out) == len
- && (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI)
- && memcmp (optable[i].out, opname, len) == 0)
- return optable[i].in;
- }
- return (0);
-}
-
-/* char *cplus_demangle (const char *mangled, int options)
-
- If MANGLED is a mangled function name produced by GNU C++, then
- a pointer to a malloced string giving a C++ representation
- of the name will be returned; otherwise NULL will be returned.
- It is the caller's responsibility to free the string which
- is returned.
-
- The OPTIONS arg may contain one or more of the following bits:
-
- DMGL_ANSI ANSI qualifiers such as `const' and `void' are
- included.
- DMGL_PARAMS Function parameters are included.
-
- For example,
-
- cplus_demangle ("foo__1Ai", DMGL_PARAMS) => "A::foo(int)"
- cplus_demangle ("foo__1Ai", DMGL_PARAMS | DMGL_ANSI) => "A::foo(int)"
- cplus_demangle ("foo__1Ai", 0) => "A::foo"
-
- cplus_demangle ("foo__1Afe", DMGL_PARAMS) => "A::foo(float,...)"
- cplus_demangle ("foo__1Afe", DMGL_PARAMS | DMGL_ANSI)=> "A::foo(float,...)"
- cplus_demangle ("foo__1Afe", 0) => "A::foo"
-
- Note that any leading underscores, or other such characters prepended by
- the compilation system, are presumed to have already been stripped from
- MANGLED. */
-
-char *
-cplus_demangle (mangled, options)
- const char *mangled;
- int options;
-{
- string decl;
- int success = 0;
- struct work_stuff work[1];
- char *demangled = NULL;
-
- if ((mangled != NULL) && (*mangled != '\0'))
- {
- memset ((char *) work, 0, sizeof (work));
- work -> options = options;
- if ((work->options & DMGL_STYLE_MASK) == 0)
- work->options |= (int)current_demangling_style & DMGL_STYLE_MASK;
-
- string_init (&decl);
-
- /* First check to see if gnu style demangling is active and if the
- string to be demangled contains a CPLUS_MARKER. If so, attempt to
- recognize one of the gnu special forms rather than looking for a
- standard prefix. In particular, don't worry about whether there
- is a "__" string in the mangled string. Consider "_$_5__foo" for
- example. */
-
- if ((AUTO_DEMANGLING || GNU_DEMANGLING))
- {
- success = gnu_special (work, &mangled, &decl);
- }
- if (!success)
- {
- success = demangle_prefix (work, &mangled, &decl);
- }
- if (success && (*mangled != '\0'))
- {
- success = demangle_signature (work, &mangled, &decl);
- }
- if (work->constructor == 2)
- {
- string_prepend(&decl, "global constructors keyed to ");
- work->constructor = 0;
- }
- else if (work->destructor == 2)
- {
- string_prepend(&decl, "global destructors keyed to ");
- work->destructor = 0;
- }
- demangled = mop_up (work, &decl, success);
- }
- return (demangled);
-}
-
-static char *
-mop_up (work, declp, success)
- struct work_stuff *work;
- string *declp;
- int success;
-{
- char *demangled = NULL;
-
- /* Discard the remembered types, if any. */
-
- forget_types (work);
- if (work -> typevec != NULL)
- {
- free ((char *) work -> typevec);
- }
-
- /* If demangling was successful, ensure that the demangled string is null
- terminated and return it. Otherwise, free the demangling decl. */
-
- if (!success)
- {
- string_delete (declp);
- }
- else
- {
- string_appendn (declp, "", 1);
- demangled = declp -> b;
- }
- return (demangled);
-}
-
-/*
-
-LOCAL FUNCTION
-
- demangle_signature -- demangle the signature part of a mangled name
-
-SYNOPSIS
-
- static int
- demangle_signature (struct work_stuff *work, const char **mangled,
- string *declp);
-
-DESCRIPTION
-
- Consume and demangle the signature portion of the mangled name.
-
- DECLP is the string where demangled output is being built. At
- entry it contains the demangled root name from the mangled name
- prefix. I.E. either a demangled operator name or the root function
- name. In some special cases, it may contain nothing.
-
- *MANGLED points to the current unconsumed location in the mangled
- name. As tokens are consumed and demangling is performed, the
- pointer is updated to continuously point at the next token to
- be consumed.
-
- Demangling GNU style mangled names is nasty because there is no
- explicit token that marks the start of the outermost function
- argument list. */
-
-static int
-demangle_signature (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int success = 1;
- int func_done = 0;
- int expect_func = 0;
- const char *oldmangled = NULL;
- string trawname;
- string tname;
-
- while (success && (**mangled != '\0'))
- {
- switch (**mangled)
- {
- case 'Q':
- oldmangled = *mangled;
- success = demangle_qualified (work, mangled, declp, 1, 0);
- if (success)
- {
- remember_type (work, oldmangled, *mangled - oldmangled);
- }
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- {
- expect_func = 1;
- }
- oldmangled = NULL;
- break;
-
- case 'S':
- /* Static member function */
- if (oldmangled == NULL)
- {
- oldmangled = *mangled;
- }
- (*mangled)++;
- work -> static_type = 1;
- break;
-
- case 'C':
- /* a const member function */
- if (oldmangled == NULL)
- {
- oldmangled = *mangled;
- }
- (*mangled)++;
- work -> const_type = 1;
- break;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- if (oldmangled == NULL)
- {
- oldmangled = *mangled;
- }
- success = demangle_class (work, mangled, declp);
- if (success)
- {
- remember_type (work, oldmangled, *mangled - oldmangled);
- }
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- {
- expect_func = 1;
- }
- oldmangled = NULL;
- break;
-
- case 'F':
- /* Function */
- /* ARM style demangling includes a specific 'F' character after
- the class name. For GNU style, it is just implied. So we can
- safely just consume any 'F' at this point and be compatible
- with either style. */
-
- oldmangled = NULL;
- func_done = 1;
- (*mangled)++;
-
- /* For lucid/ARM style we have to forget any types we might
- have remembered up to this point, since they were not argument
- types. GNU style considers all types seen as available for
- back references. See comment in demangle_args() */
-
- if (LUCID_DEMANGLING || ARM_DEMANGLING)
- {
- forget_types (work);
- }
- success = demangle_args (work, mangled, declp);
- break;
-
- case 't':
- /* G++ Template */
- string_init(&trawname);
- string_init(&tname);
- if (oldmangled == NULL)
- {
- oldmangled = *mangled;
- }
- success = demangle_template (work, mangled, &tname, &trawname);
- if (success)
- {
- remember_type (work, oldmangled, *mangled - oldmangled);
- }
- string_append(&tname, "::");
- string_prepends(declp, &tname);
- if (work -> destructor & 1)
- {
- string_prepend (&trawname, "~");
- string_appends (declp, &trawname);
- work->destructor -= 1;
- }
- if ((work->constructor & 1) || (work->destructor & 1))
- {
- string_appends (declp, &trawname);
- work->constructor -= 1;
- }
- string_delete(&trawname);
- string_delete(&tname);
- oldmangled = NULL;
- expect_func = 1;
- break;
-
- case '_':
- /* At the outermost level, we cannot have a return type specified,
- so if we run into another '_' at this point we are dealing with
- a mangled name that is either bogus, or has been mangled by
- some algorithm we don't know how to deal with. So just
- reject the entire demangling. */
- success = 0;
- break;
-
- default:
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- {
- /* Assume we have stumbled onto the first outermost function
- argument token, and start processing args. */
- func_done = 1;
- success = demangle_args (work, mangled, declp);
- }
- else
- {
- /* Non-GNU demanglers use a specific token to mark the start
- of the outermost function argument tokens. Typically 'F',
- for ARM-demangling, for example. So if we find something
- we are not prepared for, it must be an error. */
- success = 0;
- }
- break;
- }
- /*
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- */
- {
- if (success && expect_func)
- {
- func_done = 1;
- success = demangle_args (work, mangled, declp);
- }
- }
- }
- if (success && !func_done)
- {
- if (AUTO_DEMANGLING || GNU_DEMANGLING)
- {
- /* With GNU style demangling, bar__3foo is 'foo::bar(void)', and
- bar__3fooi is 'foo::bar(int)'. We get here when we find the
- first case, and need to ensure that the '(void)' gets added to
- the current declp. Note that with ARM, the first case
- represents the name of a static data member 'foo::bar',
- which is in the current declp, so we leave it alone. */
- success = demangle_args (work, mangled, declp);
- }
- }
- if (success && work -> static_type && PRINT_ARG_TYPES)
- {
- string_append (declp, " static");
- }
- if (success && work -> const_type && PRINT_ARG_TYPES)
- {
- string_append (declp, " const");
- }
- return (success);
-}
-
-#if 0
-
-static int
-demangle_method_args (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int success = 0;
-
- if (work -> static_type)
- {
- string_append (declp, *mangled + 1);
- *mangled += strlen (*mangled);
- success = 1;
- }
- else
- {
- success = demangle_args (work, mangled, declp);
- }
- return (success);
-}
-
-#endif
-
-static int
-demangle_template (work, mangled, tname, trawname)
- struct work_stuff *work;
- const char **mangled;
- string *tname;
- string *trawname;
-{
- int i;
- int is_pointer;
- int is_real;
- int is_integral;
- int is_char;
- int is_bool;
- int r;
- int need_comma = 0;
- int success = 0;
- int done;
- const char *old_p;
- const char *start;
- int symbol_len;
- string temp;
-
- (*mangled)++;
- start = *mangled;
- /* get template name */
- if ((r = consume_count (mangled)) == 0 || strlen (*mangled) < r)
- {
- return (0);
- }
- if (trawname)
- string_appendn (trawname, *mangled, r);
- string_appendn (tname, *mangled, r);
- *mangled += r;
- string_append (tname, "<");
- /* get size of template parameter list */
- if (!get_count (mangled, &r))
- {
- return (0);
- }
- for (i = 0; i < r; i++)
- {
- if (need_comma)
- {
- string_append (tname, ", ");
- }
- /* Z for type parameters */
- if (**mangled == 'Z')
- {
- (*mangled)++;
- /* temp is initialized in do_type */
- success = do_type (work, mangled, &temp);
- if (success)
- {
- string_appends (tname, &temp);
- }
- string_delete(&temp);
- if (!success)
- {
- break;
- }
- }
- else
- {
- /* otherwise, value parameter */
- old_p = *mangled;
- is_pointer = 0;
- is_real = 0;
- is_integral = 0;
- is_char = 0;
- is_bool = 0;
- done = 0;
- /* temp is initialized in do_type */
- success = do_type (work, mangled, &temp);
- /*
- if (success)
- {
- string_appends (tname, &temp);
- }
- */
- string_delete(&temp);
- if (!success)
- {
- break;
- }
- /*
- string_append (tname, "=");
- */
- while (*old_p && !done)
- {
- switch (*old_p)
- {
- case 'P':
- case 'p':
- case 'R':
- done = is_pointer = 1;
- break;
- case 'C': /* const */
- case 'S': /* explicitly signed [char] */
- case 'U': /* unsigned */
- case 'V': /* volatile */
- case 'F': /* function */
- case 'M': /* member function */
- case 'O': /* ??? */
- old_p++;
- continue;
- case 'Q': /* qualified name */
- done = is_integral = 1;
- break;
- case 'T': /* remembered type */
- abort ();
- break;
- case 'v': /* void */
- abort ();
- break;
- case 'x': /* long long */
- case 'l': /* long */
- case 'i': /* int */
- case 's': /* short */
- case 'w': /* wchar_t */
- done = is_integral = 1;
- break;
- case 'b': /* bool */
- done = is_bool = 1;
- break;
- case 'c': /* char */
- done = is_char = 1;
- break;
- case 'r': /* long double */
- case 'd': /* double */
- case 'f': /* float */
- done = is_real = 1;
- break;
- default:
- /* it's probably user defined type, let's assume
- it's integral, it seems hard to figure out
- what it really is */
- done = is_integral = 1;
- }
- }
- if (is_integral)
- {
- if (**mangled == 'm')
- {
- string_appendn (tname, "-", 1);
- (*mangled)++;
- }
- while (isdigit (**mangled))
- {
- string_appendn (tname, *mangled, 1);
- (*mangled)++;
- }
- }
- else if (is_char)
- {
- char tmp[2];
- int val;
- if (**mangled == 'm')
- {
- string_appendn (tname, "-", 1);
- (*mangled)++;
- }
- string_appendn (tname, "'", 1);
- val = consume_count(mangled);
- if (val == 0)
- {
- success = 0;
- break;
- }
- tmp[0] = (char)val;
- tmp[1] = '\0';
- string_appendn (tname, &tmp[0], 1);
- string_appendn (tname, "'", 1);
- }
- else if (is_bool)
- {
- int val = consume_count (mangled);
- if (val == 0)
- string_appendn (tname, "false", 5);
- else if (val == 1)
- string_appendn (tname, "true", 4);
- else
- success = 0;
- }
- else if (is_real)
- {
- if (**mangled == 'm')
- {
- string_appendn (tname, "-", 1);
- (*mangled)++;
- }
- while (isdigit (**mangled))
- {
- string_appendn (tname, *mangled, 1);
- (*mangled)++;
- }
- if (**mangled == '.') /* fraction */
- {
- string_appendn (tname, ".", 1);
- (*mangled)++;
- while (isdigit (**mangled))
- {
- string_appendn (tname, *mangled, 1);
- (*mangled)++;
- }
- }
- if (**mangled == 'e') /* exponent */
- {
- string_appendn (tname, "e", 1);
- (*mangled)++;
- while (isdigit (**mangled))
- {
- string_appendn (tname, *mangled, 1);
- (*mangled)++;
- }
- }
- }
- else if (is_pointer)
- {
- symbol_len = consume_count (mangled);
- if (symbol_len == 0)
- {
- success = 0;
- break;
- }
- if (symbol_len == 0)
- string_appendn (tname, "0", 1);
- else
- {
- char *p = xmalloc (symbol_len + 1), *q;
- strncpy (p, *mangled, symbol_len);
- p [symbol_len] = '\0';
- q = cplus_demangle (p, work->options);
- string_appendn (tname, "&", 1);
- if (q)
- {
- string_append (tname, q);
- free (q);
- }
- else
- string_append (tname, p);
- free (p);
- }
- *mangled += symbol_len;
- }
- }
- need_comma = 1;
- }
- if (tname->p[-1] == '>')
- string_append (tname, " ");
- string_append (tname, ">");
-
- /*
- if (work -> static_type)
- {
- string_append (declp, *mangled + 1);
- *mangled += strlen (*mangled);
- success = 1;
- }
- else
- {
- success = demangle_args (work, mangled, declp);
- }
- }
- */
- return (success);
-}
-
-static int
-arm_pt (work, mangled, n, anchor, args)
- struct work_stuff *work;
- const char *mangled;
- int n;
- const char **anchor, **args;
-{
- /* ARM template? */
- if (ARM_DEMANGLING && (*anchor = mystrstr (mangled, "__pt__")))
- {
- int len;
- *args = *anchor + 6;
- len = consume_count (args);
- if (*args + len == mangled + n && **args == '_')
- {
- ++*args;
- return 1;
- }
- }
- return 0;
-}
-
-static void
-demangle_arm_pt (work, mangled, n, declp)
- struct work_stuff *work;
- const char **mangled;
- int n;
- string *declp;
-{
- const char *p;
- const char *args;
- const char *e = *mangled + n;
-
- /* ARM template? */
- if (arm_pt (work, *mangled, n, &p, &args))
- {
- string arg;
- string_init (&arg);
- string_appendn (declp, *mangled, p - *mangled);
- string_append (declp, "<");
- /* should do error checking here */
- while (args < e) {
- string_clear (&arg);
- do_type (work, &args, &arg);
- string_appends (declp, &arg);
- string_append (declp, ",");
- }
- string_delete (&arg);
- --declp->p;
- string_append (declp, ">");
- }
- else
- {
- string_appendn (declp, *mangled, n);
- }
- *mangled += n;
-}
-
-static int
-demangle_class_name (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int n;
- int success = 0;
-
- n = consume_count (mangled);
- if (strlen (*mangled) >= n)
- {
- demangle_arm_pt (work, mangled, n, declp);
- success = 1;
- }
-
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- demangle_class -- demangle a mangled class sequence
-
-SYNOPSIS
-
- static int
- demangle_class (struct work_stuff *work, const char **mangled,
- strint *declp)
-
-DESCRIPTION
-
- DECLP points to the buffer into which demangling is being done.
-
- *MANGLED points to the current token to be demangled. On input,
- it points to a mangled class (I.E. "3foo", "13verylongclass", etc.)
- On exit, it points to the next token after the mangled class on
- success, or the first unconsumed token on failure.
-
- If the CONSTRUCTOR or DESTRUCTOR flags are set in WORK, then
- we are demangling a constructor or destructor. In this case
- we prepend "class::class" or "class::~class" to DECLP.
-
- Otherwise, we prepend "class::" to the current DECLP.
-
- Reset the constructor/destructor flags once they have been
- "consumed". This allows demangle_class to be called later during
- the same demangling, to do normal class demangling.
-
- Returns 1 if demangling is successful, 0 otherwise.
-
-*/
-
-static int
-demangle_class (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int success = 0;
- string class_name;
-
- string_init (&class_name);
- if (demangle_class_name (work, mangled, &class_name))
- {
- if ((work->constructor & 1) || (work->destructor & 1))
- {
- string_prepends (declp, &class_name);
- if (work -> destructor & 1)
- {
- string_prepend (declp, "~");
- work -> destructor -= 1;
- }
- else
- {
- work -> constructor -= 1;
- }
- }
- string_prepend (declp, "::");
- string_prepends (declp, &class_name);
- success = 1;
- }
- string_delete (&class_name);
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- demangle_prefix -- consume the mangled name prefix and find signature
-
-SYNOPSIS
-
- static int
- demangle_prefix (struct work_stuff *work, const char **mangled,
- string *declp);
-
-DESCRIPTION
-
- Consume and demangle the prefix of the mangled name.
-
- DECLP points to the string buffer into which demangled output is
- placed. On entry, the buffer is empty. On exit it contains
- the root function name, the demangled operator name, or in some
- special cases either nothing or the completely demangled result.
-
- MANGLED points to the current pointer into the mangled name. As each
- token of the mangled name is consumed, it is updated. Upon entry
- the current mangled name pointer points to the first character of
- the mangled name. Upon exit, it should point to the first character
- of the signature if demangling was successful, or to the first
- unconsumed character if demangling of the prefix was unsuccessful.
-
- Returns 1 on success, 0 otherwise.
- */
-
-static int
-demangle_prefix (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int success = 1;
- const char *scan;
- int i;
-
- if (strlen(*mangled) >= 11 && strncmp(*mangled, "_GLOBAL_", 8) == 0)
- {
- char *marker = strchr (cplus_markers, (*mangled)[8]);
- if (marker != NULL && *marker == (*mangled)[10])
- {
- if ((*mangled)[9] == 'D')
- {
- /* it's a GNU global destructor to be executed at program exit */
- (*mangled) += 11;
- work->destructor = 2;
- if (gnu_special (work, mangled, declp))
- return success;
- }
- else if ((*mangled)[9] == 'I')
- {
- /* it's a GNU global constructor to be executed at program init */
- (*mangled) += 11;
- work->constructor = 2;
- if (gnu_special (work, mangled, declp))
- return success;
- }
- }
- }
- else if (ARM_DEMANGLING && strncmp(*mangled, "__std__", 7) == 0)
- {
- /* it's a ARM global destructor to be executed at program exit */
- (*mangled) += 7;
- work->destructor = 2;
- }
- else if (ARM_DEMANGLING && strncmp(*mangled, "__sti__", 7) == 0)
- {
- /* it's a ARM global constructor to be executed at program initial */
- (*mangled) += 7;
- work->constructor = 2;
- }
-
- /* This block of code is a reduction in strength time optimization
- of:
- scan = mystrstr (*mangled, "__"); */
-
- {
- scan = *mangled;
-
- do {
- scan = strchr (scan, '_');
- } while (scan != NULL && *++scan != '_');
-
- if (scan != NULL) --scan;
- }
-
- if (scan != NULL)
- {
- /* We found a sequence of two or more '_', ensure that we start at
- the last pair in the sequence. */
- i = strspn (scan, "_");
- if (i > 2)
- {
- scan += (i - 2);
- }
- }
-
- if (scan == NULL)
- {
- success = 0;
- }
- else if (work -> static_type)
- {
- if (!isdigit (scan[0]) && (scan[0] != 't'))
- {
- success = 0;
- }
- }
- else if ((scan == *mangled) &&
- (isdigit (scan[2]) || (scan[2] == 'Q') || (scan[2] == 't')))
- {
- /* The ARM says nothing about the mangling of local variables.
- But cfront mangles local variables by prepending __<nesting_level>
- to them. As an extension to ARM demangling we handle this case. */
- if ((LUCID_DEMANGLING || ARM_DEMANGLING) && isdigit (scan[2]))
- {
- *mangled = scan + 2;
- consume_count (mangled);
- string_append (declp, *mangled);
- *mangled += strlen (*mangled);
- success = 1;
- }
- else
- {
- /* A GNU style constructor starts with __[0-9Qt]. But cfront uses
- names like __Q2_3foo3bar for nested type names. So don't accept
- this style of constructor for cfront demangling. */
- if (!(LUCID_DEMANGLING || ARM_DEMANGLING))
- work -> constructor += 1;
- *mangled = scan + 2;
- }
- }
- else if ((scan == *mangled) && !isdigit (scan[2]) && (scan[2] != 't'))
- {
- /* Mangled name starts with "__". Skip over any leading '_' characters,
- then find the next "__" that separates the prefix from the signature.
- */
- if (!(ARM_DEMANGLING || LUCID_DEMANGLING)
- || (arm_special (work, mangled, declp) == 0))
- {
- while (*scan == '_')
- {
- scan++;
- }
- if ((scan = mystrstr (scan, "__")) == NULL || (*(scan + 2) == '\0'))
- {
- /* No separator (I.E. "__not_mangled"), or empty signature
- (I.E. "__not_mangled_either__") */
- success = 0;
- }
- else
- {
- demangle_function_name (work, mangled, declp, scan);
- }
- }
- }
- else if (ARM_DEMANGLING && scan[2] == 'p' && scan[3] == 't')
- {
- /* Cfront-style parameterized type. Handled later as a signature. */
- success = 1;
-
- /* ARM template? */
- demangle_arm_pt (work, mangled, strlen (*mangled), declp);
- }
- else if (*(scan + 2) != '\0')
- {
- /* Mangled name does not start with "__" but does have one somewhere
- in there with non empty stuff after it. Looks like a global
- function name. */
- demangle_function_name (work, mangled, declp, scan);
- }
- else
- {
- /* Doesn't look like a mangled name */
- success = 0;
- }
-
- if (!success && (work->constructor == 2 || work->destructor == 2))
- {
- string_append (declp, *mangled);
- *mangled += strlen (*mangled);
- success = 1;
- }
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- gnu_special -- special handling of gnu mangled strings
-
-SYNOPSIS
-
- static int
- gnu_special (struct work_stuff *work, const char **mangled,
- string *declp);
-
-
-DESCRIPTION
-
- Process some special GNU style mangling forms that don't fit
- the normal pattern. For example:
-
- _$_3foo (destructor for class foo)
- _vt$foo (foo virtual table)
- _vt$foo$bar (foo::bar virtual table)
- __vt_foo (foo virtual table, new style with thunks)
- _3foo$varname (static data member)
- _Q22rs2tu$vw (static data member)
- __t6vector1Zii (constructor with template)
- __thunk_4__$_7ostream (virtual function thunk)
- */
-
-static int
-gnu_special (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int n;
- int success = 1;
- const char *p;
-
- if ((*mangled)[0] == '_'
- && strchr (cplus_markers, (*mangled)[1]) != NULL
- && (*mangled)[2] == '_')
- {
- /* Found a GNU style destructor, get past "_<CPLUS_MARKER>_" */
- (*mangled) += 3;
- work -> destructor += 1;
- }
- else if ((*mangled)[0] == '_'
- && (((*mangled)[1] == '_'
- && (*mangled)[2] == 'v'
- && (*mangled)[3] == 't'
- && (*mangled)[4] == '_')
- || ((*mangled)[1] == 'v'
- && (*mangled)[2] == 't'
- && strchr (cplus_markers, (*mangled)[3]) != NULL)))
- {
- /* Found a GNU style virtual table, get past "_vt<CPLUS_MARKER>"
- and create the decl. Note that we consume the entire mangled
- input string, which means that demangle_signature has no work
- to do. */
- if ((*mangled)[2] == 'v')
- (*mangled) += 5; /* New style, with thunks: "__vt_" */
- else
- (*mangled) += 4; /* Old style, no thunks: "_vt<CPLUS_MARKER>" */
- while (**mangled != '\0')
- {
- p = strpbrk (*mangled, cplus_markers);
- switch (**mangled)
- {
- case 'Q':
- success = demangle_qualified (work, mangled, declp, 0, 1);
- break;
- case 't':
- success = demangle_template (work, mangled, declp, 0);
- break;
- default:
- if (isdigit(*mangled[0]))
- {
- n = consume_count(mangled);
- }
- else
- {
- n = strcspn (*mangled, cplus_markers);
- }
- string_appendn (declp, *mangled, n);
- (*mangled) += n;
- }
-
- if (success && ((p == NULL) || (p == *mangled)))
- {
- if (p != NULL)
- {
- string_append (declp, "::");
- (*mangled)++;
- }
- }
- else
- {
- success = 0;
- break;
- }
- }
- if (success)
- string_append (declp, " virtual table");
- }
- else if ((*mangled)[0] == '_'
- && (strchr("0123456789Qt", (*mangled)[1]) != NULL)
- && (p = strpbrk (*mangled, cplus_markers)) != NULL)
- {
- /* static data member, "_3foo$varname" for example */
- (*mangled)++;
- switch (**mangled)
- {
- case 'Q':
- success = demangle_qualified (work, mangled, declp, 0, 1);
- break;
- case 't':
- success = demangle_template (work, mangled, declp, 0);
- break;
- default:
- n = consume_count (mangled);
- string_appendn (declp, *mangled, n);
- (*mangled) += n;
- }
- if (success && (p == *mangled))
- {
- /* Consumed everything up to the cplus_marker, append the
- variable name. */
- (*mangled)++;
- string_append (declp, "::");
- n = strlen (*mangled);
- string_appendn (declp, *mangled, n);
- (*mangled) += n;
- }
- else
- {
- success = 0;
- }
- }
- else if (strncmp (*mangled, "__thunk_", 8) == 0)
- {
- int delta = ((*mangled) += 8, consume_count (mangled));
- char *method = cplus_demangle (++*mangled, work->options);
- if (method)
- {
- char buf[50];
- sprintf (buf, "virtual function thunk (delta:%d) for ", -delta);
- string_append (declp, buf);
- string_append (declp, method);
- free (method);
- n = strlen (*mangled);
- (*mangled) += n;
- }
- else
- {
- success = 0;
- }
- }
- else if (strncmp (*mangled, "__t", 3) == 0
- && ((*mangled)[3] == 'i' || (*mangled)[3] == 'f'))
- {
- p = (*mangled)[3] == 'i' ? " type_info node" : " type_info function";
- (*mangled) += 4;
- switch (**mangled)
- {
- case 'Q':
- success = demangle_qualified (work, mangled, declp, 0, 1);
- break;
- case 't':
- success = demangle_template (work, mangled, declp, 0);
- break;
- default:
- success = demangle_fund_type (work, mangled, declp);
- break;
- }
- if (success && **mangled != '\0')
- success = 0;
- if (success)
- string_append (declp, p);
- }
- else
- {
- success = 0;
- }
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- arm_special -- special handling of ARM/lucid mangled strings
-
-SYNOPSIS
-
- static int
- arm_special (struct work_stuff *work, const char **mangled,
- string *declp);
-
-
-DESCRIPTION
-
- Process some special ARM style mangling forms that don't fit
- the normal pattern. For example:
-
- __vtbl__3foo (foo virtual table)
- __vtbl__3foo__3bar (bar::foo virtual table)
-
- */
-
-static int
-arm_special (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- int n;
- int success = 1;
- const char *scan;
-
- if (strncmp (*mangled, ARM_VTABLE_STRING, ARM_VTABLE_STRLEN) == 0)
- {
- /* Found a ARM style virtual table, get past ARM_VTABLE_STRING
- and create the decl. Note that we consume the entire mangled
- input string, which means that demangle_signature has no work
- to do. */
- scan = *mangled + ARM_VTABLE_STRLEN;
- while (*scan != '\0') /* first check it can be demangled */
- {
- n = consume_count (&scan);
- if (n==0)
- {
- return (0); /* no good */
- }
- scan += n;
- if (scan[0] == '_' && scan[1] == '_')
- {
- scan += 2;
- }
- }
- (*mangled) += ARM_VTABLE_STRLEN;
- while (**mangled != '\0')
- {
- n = consume_count (mangled);
- string_prependn (declp, *mangled, n);
- (*mangled) += n;
- if ((*mangled)[0] == '_' && (*mangled)[1] == '_')
- {
- string_prepend (declp, "::");
- (*mangled) += 2;
- }
- }
- string_append (declp, " virtual table");
- }
- else
- {
- success = 0;
- }
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- demangle_qualified -- demangle 'Q' qualified name strings
-
-SYNOPSIS
-
- static int
- demangle_qualified (struct work_stuff *, const char *mangled,
- string *result, int isfuncname, int append);
-
-DESCRIPTION
-
- Demangle a qualified name, such as "Q25Outer5Inner" which is
- the mangled form of "Outer::Inner". The demangled output is
- prepended or appended to the result string according to the
- state of the append flag.
-
- If isfuncname is nonzero, then the qualified name we are building
- is going to be used as a member function name, so if it is a
- constructor or destructor function, append an appropriate
- constructor or destructor name. I.E. for the above example,
- the result for use as a constructor is "Outer::Inner::Inner"
- and the result for use as a destructor is "Outer::Inner::~Inner".
-
-BUGS
-
- Numeric conversion is ASCII dependent (FIXME).
-
- */
-
-static int
-demangle_qualified (work, mangled, result, isfuncname, append)
- struct work_stuff *work;
- const char **mangled;
- string *result;
- int isfuncname;
- int append;
-{
- int qualifiers;
- int namelength;
- int success = 1;
- const char *p;
- char num[2];
- string temp;
-
- string_init (&temp);
- switch ((*mangled)[1])
- {
- case '_':
- /* GNU mangled name with more than 9 classes. The count is preceded
- by an underscore (to distinguish it from the <= 9 case) and followed
- by an underscore. */
- p = *mangled + 2;
- qualifiers = atoi (p);
- if (!isdigit (*p) || *p == '0')
- success = 0;
-
- /* Skip the digits. */
- while (isdigit (*p))
- ++p;
-
- if (*p != '_')
- success = 0;
-
- *mangled = p + 1;
- break;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- /* The count is in a single digit. */
- num[0] = (*mangled)[1];
- num[1] = '\0';
- qualifiers = atoi (num);
-
- /* If there is an underscore after the digit, skip it. This is
- said to be for ARM-qualified names, but the ARM makes no
- mention of such an underscore. Perhaps cfront uses one. */
- if ((*mangled)[2] == '_')
- {
- (*mangled)++;
- }
- (*mangled) += 2;
- break;
-
- case '0':
- default:
- success = 0;
- }
-
- if (!success)
- return success;
-
- /* Pick off the names and collect them in the temp buffer in the order
- in which they are found, separated by '::'. */
-
- while (qualifiers-- > 0)
- {
- if (*mangled[0] == '_')
- *mangled = *mangled + 1;
- if (*mangled[0] == 't')
- {
- success = demangle_template(work, mangled, &temp, 0);
- if (!success) break;
- }
- else
- {
- namelength = consume_count (mangled);
- if (strlen (*mangled) < namelength)
- {
- /* Simple sanity check failed */
- success = 0;
- break;
- }
- string_appendn (&temp, *mangled, namelength);
- *mangled += namelength;
- }
- if (qualifiers > 0)
- {
- string_appendn (&temp, "::", 2);
- }
- }
-
- /* If we are using the result as a function name, we need to append
- the appropriate '::' separated constructor or destructor name.
- We do this here because this is the most convenient place, where
- we already have a pointer to the name and the length of the name. */
-
- if (isfuncname && (work->constructor & 1 || work->destructor & 1))
- {
- string_appendn (&temp, "::", 2);
- if (work -> destructor & 1)
- {
- string_append (&temp, "~");
- }
- string_appendn (&temp, (*mangled) - namelength, namelength);
- }
-
- /* Now either prepend the temp buffer to the result, or append it,
- depending upon the state of the append flag. */
-
- if (append)
- {
- string_appends (result, &temp);
- }
- else
- {
- if (!STRING_EMPTY (result))
- {
- string_appendn (&temp, "::", 2);
- }
- string_prepends (result, &temp);
- }
-
- string_delete (&temp);
- return (success);
-}
-
-/*
-
-LOCAL FUNCTION
-
- get_count -- convert an ascii count to integer, consuming tokens
-
-SYNOPSIS
-
- static int
- get_count (const char **type, int *count)
-
-DESCRIPTION
-
- Return 0 if no conversion is performed, 1 if a string is converted.
-*/
-
-static int
-get_count (type, count)
- const char **type;
- int *count;
-{
- const char *p;
- int n;
-
- if (!isdigit (**type))
- {
- return (0);
- }
- else
- {
- *count = **type - '0';
- (*type)++;
- if (isdigit (**type))
- {
- p = *type;
- n = *count;
- do
- {
- n *= 10;
- n += *p - '0';
- p++;
- }
- while (isdigit (*p));
- if (*p == '_')
- {
- *type = p + 1;
- *count = n;
- }
- }
- }
- return (1);
-}
-
-/* result will be initialised here; it will be freed on failure */
-
-static int
-do_type (work, mangled, result)
- struct work_stuff *work;
- const char **mangled;
- string *result;
-{
- int n;
- int done;
- int success;
- string decl;
- const char *remembered_type;
- int constp;
- int volatilep;
-
- string_init (&decl);
- string_init (result);
-
- done = 0;
- success = 1;
- while (success && !done)
- {
- int member;
- switch (**mangled)
- {
-
- /* A pointer type */
- case 'P':
- case 'p':
- (*mangled)++;
- string_prepend (&decl, "*");
- break;
-
- /* A reference type */
- case 'R':
- (*mangled)++;
- string_prepend (&decl, "&");
- break;
-
- /* An array */
- case 'A':
- {
- const char *p = ++(*mangled);
-
- string_prepend (&decl, "(");
- string_append (&decl, ")[");
- /* Copy anything up until the next underscore (the size of the
- array). */
- while (**mangled && **mangled != '_')
- ++(*mangled);
- if (**mangled == '_')
- {
- string_appendn (&decl, p, *mangled - p);
- string_append (&decl, "]");
- *mangled += 1;
- }
- else
- success = 0;
- break;
- }
-
- /* A back reference to a previously seen type */
- case 'T':
- (*mangled)++;
- if (!get_count (mangled, &n) || n >= work -> ntypes)
- {
- success = 0;
- }
- else
- {
- remembered_type = work -> typevec[n];
- mangled = &remembered_type;
- }
- break;
-
- /* A function */
- case 'F':
- (*mangled)++;
- if (!STRING_EMPTY (&decl) && decl.b[0] == '*')
- {
- string_prepend (&decl, "(");
- string_append (&decl, ")");
- }
- /* After picking off the function args, we expect to either find the
- function return type (preceded by an '_') or the end of the
- string. */
- if (!demangle_args (work, mangled, &decl)
- || (**mangled != '_' && **mangled != '\0'))
- {
- success = 0;
- }
- if (success && (**mangled == '_'))
- {
- (*mangled)++;
- }
- break;
-
- case 'M':
- case 'O':
- {
- constp = 0;
- volatilep = 0;
-
- member = **mangled == 'M';
- (*mangled)++;
- if (!isdigit (**mangled) && **mangled != 't')
- {
- success = 0;
- break;
- }
-
- string_append (&decl, ")");
- string_prepend (&decl, "::");
- if (isdigit (**mangled))
- {
- n = consume_count (mangled);
- if (strlen (*mangled) < n)
- {
- success = 0;
- break;
- }
- string_prependn (&decl, *mangled, n);
- *mangled += n;
- }
- else
- {
- string temp;
- string_init (&temp);
- success = demangle_template (work, mangled, &temp, NULL);
- if (success)
- {
- string_prependn (&decl, temp.b, temp.p - temp.b);
- string_clear (&temp);
- }
- else
- break;
- }
- string_prepend (&decl, "(");
- if (member)
- {
- if (**mangled == 'C')
- {
- (*mangled)++;
- constp = 1;
- }
- if (**mangled == 'V')
- {
- (*mangled)++;
- volatilep = 1;
- }
- if (*(*mangled)++ != 'F')
- {
- success = 0;
- break;
- }
- }
- if ((member && !demangle_args (work, mangled, &decl))
- || **mangled != '_')
- {
- success = 0;
- break;
- }
- (*mangled)++;
- if (! PRINT_ANSI_QUALIFIERS)
- {
- break;
- }
- if (constp)
- {
- APPEND_BLANK (&decl);
- string_append (&decl, "const");
- }
- if (volatilep)
- {
- APPEND_BLANK (&decl);
- string_append (&decl, "volatile");
- }
- break;
- }
- case 'G':
- (*mangled)++;
- break;
-
- case 'C':
- (*mangled)++;
- /*
- if ((*mangled)[1] == 'P')
- {
- */
- if (PRINT_ANSI_QUALIFIERS)
- {
- if (!STRING_EMPTY (&decl))
- {
- string_prepend (&decl, " ");
- }
- string_prepend (&decl, "const");
- }
- break;
- /*
- }
- */
-
- /* fall through */
- default:
- done = 1;
- break;
- }
- }
-
- switch (**mangled)
- {
- /* A qualified name, such as "Outer::Inner". */
- case 'Q':
- success = demangle_qualified (work, mangled, result, 0, 1);
- break;
-
- default:
- success = demangle_fund_type (work, mangled, result);
- break;
- }
-
- if (success)
- {
- if (!STRING_EMPTY (&decl))
- {
- string_append (result, " ");
- string_appends (result, &decl);
- }
- }
- else
- {
- string_delete (result);
- }
- string_delete (&decl);
- return (success);
-}
-
-/* Given a pointer to a type string that represents a fundamental type
- argument (int, long, unsigned int, etc) in TYPE, a pointer to the
- string in which the demangled output is being built in RESULT, and
- the WORK structure, decode the types and add them to the result.
-
- For example:
-
- "Ci" => "const int"
- "Sl" => "signed long"
- "CUs" => "const unsigned short"
-
- */
-
-static int
-demangle_fund_type (work, mangled, result)
- struct work_stuff *work;
- const char **mangled;
- string *result;
-{
- int done = 0;
- int success = 1;
-
- /* First pick off any type qualifiers. There can be more than one. */
-
- while (!done)
- {
- switch (**mangled)
- {
- case 'C':
- (*mangled)++;
- if (PRINT_ANSI_QUALIFIERS)
- {
- APPEND_BLANK (result);
- string_append (result, "const");
- }
- break;
- case 'U':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "unsigned");
- break;
- case 'S': /* signed char only */
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "signed");
- break;
- case 'V':
- (*mangled)++;
- if (PRINT_ANSI_QUALIFIERS)
- {
- APPEND_BLANK (result);
- string_append (result, "volatile");
- }
- break;
- default:
- done = 1;
- break;
- }
- }
-
- /* Now pick off the fundamental type. There can be only one. */
-
- switch (**mangled)
- {
- case '\0':
- case '_':
- break;
- case 'v':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "void");
- break;
- case 'x':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "long long");
- break;
- case 'l':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "long");
- break;
- case 'i':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "int");
- break;
- case 's':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "short");
- break;
- case 'b':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "bool");
- break;
- case 'c':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "char");
- break;
- case 'w':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "wchar_t");
- break;
- case 'r':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "long double");
- break;
- case 'd':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "double");
- break;
- case 'f':
- (*mangled)++;
- APPEND_BLANK (result);
- string_append (result, "float");
- break;
- case 'G':
- (*mangled)++;
- if (!isdigit (**mangled))
- {
- success = 0;
- break;
- }
- /* fall through */
- /* An explicit type, such as "6mytype" or "7integer" */
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- APPEND_BLANK (result);
- if (!demangle_class_name (work, mangled, result)) {
- --result->p;
- success = 0;
- }
- break;
- case 't':
- success = demangle_template(work,mangled, result, 0);
- break;
- default:
- success = 0;
- break;
- }
-
- return (success);
-}
-
-/* `result' will be initialized in do_type; it will be freed on failure */
-
-static int
-do_arg (work, mangled, result)
- struct work_stuff *work;
- const char **mangled;
- string *result;
-{
- const char *start = *mangled;
-
- if (!do_type (work, mangled, result))
- {
- return (0);
- }
- else
- {
- remember_type (work, start, *mangled - start);
- return (1);
- }
-}
-
-static void
-remember_type (work, start, len)
- struct work_stuff *work;
- const char *start;
- int len;
-{
- char *tem;
-
- if (work -> ntypes >= work -> typevec_size)
- {
- if (work -> typevec_size == 0)
- {
- work -> typevec_size = 3;
- work -> typevec =
- (char **) xmalloc (sizeof (char *) * work -> typevec_size);
- }
- else
- {
- work -> typevec_size *= 2;
- work -> typevec =
- (char **) xrealloc ((char *)work -> typevec,
- sizeof (char *) * work -> typevec_size);
- }
- }
- tem = xmalloc (len + 1);
- memcpy (tem, start, len);
- tem[len] = '\0';
- work -> typevec[work -> ntypes++] = tem;
-}
-
-/* Forget the remembered types, but not the type vector itself. */
-
-static void
-forget_types (work)
- struct work_stuff *work;
-{
- int i;
-
- while (work -> ntypes > 0)
- {
- i = --(work -> ntypes);
- if (work -> typevec[i] != NULL)
- {
- free (work -> typevec[i]);
- work -> typevec[i] = NULL;
- }
- }
-}
-
-/* Process the argument list part of the signature, after any class spec
- has been consumed, as well as the first 'F' character (if any). For
- example:
-
- "__als__3fooRT0" => process "RT0"
- "complexfunc5__FPFPc_PFl_i" => process "PFPc_PFl_i"
-
- DECLP must be already initialised, usually non-empty. It won't be freed
- on failure.
-
- Note that g++ differs significantly from ARM and lucid style mangling
- with regards to references to previously seen types. For example, given
- the source fragment:
-
- class foo {
- public:
- foo::foo (int, foo &ia, int, foo &ib, int, foo &ic);
- };
-
- foo::foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; }
- void foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; }
-
- g++ produces the names:
-
- __3fooiRT0iT2iT2
- foo__FiR3fooiT1iT1
-
- while lcc (and presumably other ARM style compilers as well) produces:
-
- foo__FiR3fooT1T2T1T2
- __ct__3fooFiR3fooT1T2T1T2
-
- Note that g++ bases it's type numbers starting at zero and counts all
- previously seen types, while lucid/ARM bases it's type numbers starting
- at one and only considers types after it has seen the 'F' character
- indicating the start of the function args. For lucid/ARM style, we
- account for this difference by discarding any previously seen types when
- we see the 'F' character, and subtracting one from the type number
- reference.
-
- */
-
-static int
-demangle_args (work, mangled, declp)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
-{
- string arg;
- int need_comma = 0;
- int r;
- int t;
- const char *tem;
- char temptype;
-
- if (PRINT_ARG_TYPES)
- {
- string_append (declp, "(");
- if (**mangled == '\0')
- {
- string_append (declp, "void");
- }
- }
-
- while (**mangled != '_' && **mangled != '\0' && **mangled != 'e')
- {
- if ((**mangled == 'N') || (**mangled == 'T'))
- {
- temptype = *(*mangled)++;
-
- if (temptype == 'N')
- {
- if (!get_count (mangled, &r))
- {
- return (0);
- }
- }
- else
- {
- r = 1;
- }
- if (ARM_DEMANGLING && work -> ntypes >= 10)
- {
- /* If we have 10 or more types we might have more than a 1 digit
- index so we'll have to consume the whole count here. This
- will lose if the next thing is a type name preceded by a
- count but it's impossible to demangle that case properly
- anyway. Eg if we already have 12 types is T12Pc "(..., type1,
- Pc, ...)" or "(..., type12, char *, ...)" */
- if ((t = consume_count(mangled)) == 0)
- {
- return (0);
- }
- }
- else
- {
- if (!get_count (mangled, &t))
- {
- return (0);
- }
- }
- if (LUCID_DEMANGLING || ARM_DEMANGLING)
- {
- t--;
- }
- /* Validate the type index. Protect against illegal indices from
- malformed type strings. */
- if ((t < 0) || (t >= work -> ntypes))
- {
- return (0);
- }
- while (--r >= 0)
- {
- tem = work -> typevec[t];
- if (need_comma && PRINT_ARG_TYPES)
- {
- string_append (declp, ", ");
- }
- if (!do_arg (work, &tem, &arg))
- {
- return (0);
- }
- if (PRINT_ARG_TYPES)
- {
- string_appends (declp, &arg);
- }
- string_delete (&arg);
- need_comma = 1;
- }
- }
- else
- {
- if (need_comma & PRINT_ARG_TYPES)
- {
- string_append (declp, ", ");
- }
- if (!do_arg (work, mangled, &arg))
- {
- return (0);
- }
- if (PRINT_ARG_TYPES)
- {
- string_appends (declp, &arg);
- }
- string_delete (&arg);
- need_comma = 1;
- }
- }
-
- if (**mangled == 'e')
- {
- (*mangled)++;
- if (PRINT_ARG_TYPES)
- {
- if (need_comma)
- {
- string_append (declp, ",");
- }
- string_append (declp, "...");
- }
- }
-
- if (PRINT_ARG_TYPES)
- {
- string_append (declp, ")");
- }
- return (1);
-}
-
-static void
-demangle_function_name (work, mangled, declp, scan)
- struct work_stuff *work;
- const char **mangled;
- string *declp;
- const char *scan;
-{
- int i;
- int len;
- string type;
- const char *tem;
-
- string_appendn (declp, (*mangled), scan - (*mangled));
- string_need (declp, 1);
- *(declp -> p) = '\0';
-
- /* Consume the function name, including the "__" separating the name
- from the signature. We are guaranteed that SCAN points to the
- separator. */
-
- (*mangled) = scan + 2;
-
- if (LUCID_DEMANGLING || ARM_DEMANGLING)
- {
-
- /* See if we have an ARM style constructor or destructor operator.
- If so, then just record it, clear the decl, and return.
- We can't build the actual constructor/destructor decl until later,
- when we recover the class name from the signature. */
-
- if (strcmp (declp -> b, "__ct") == 0)
- {
- work -> constructor += 1;
- string_clear (declp);
- return;
- }
- else if (strcmp (declp -> b, "__dt") == 0)
- {
- work -> destructor += 1;
- string_clear (declp);
- return;
- }
- }
-
- if (declp->p - declp->b >= 3
- && declp->b[0] == 'o'
- && declp->b[1] == 'p'
- && strchr (cplus_markers, declp->b[2]) != NULL)
- {
- /* see if it's an assignment expression */
- if (declp->p - declp->b >= 10 /* op$assign_ */
- && memcmp (declp->b + 3, "assign_", 7) == 0)
- {
- for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
- {
- len = declp->p - declp->b - 10;
- if (strlen (optable[i].in) == len
- && memcmp (optable[i].in, declp->b + 10, len) == 0)
- {
- string_clear (declp);
- string_append (declp, "operator");
- string_append (declp, optable[i].out);
- string_append (declp, "=");
- break;
- }
- }
- }
- else
- {
- for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
- {
- int len = declp->p - declp->b - 3;
- if (strlen (optable[i].in) == len
- && memcmp (optable[i].in, declp->b + 3, len) == 0)
- {
- string_clear (declp);
- string_append (declp, "operator");
- string_append (declp, optable[i].out);
- break;
- }
- }
- }
- }
- else if (declp->p - declp->b >= 5 && memcmp (declp->b, "type", 4) == 0
- && strchr (cplus_markers, declp->b[4]) != NULL)
- {
- /* type conversion operator */
- tem = declp->b + 5;
- if (do_type (work, &tem, &type))
- {
- string_clear (declp);
- string_append (declp, "operator ");
- string_appends (declp, &type);
- string_delete (&type);
- }
- }
- else if (declp->b[0] == '_' && declp->b[1] == '_'
- && declp->b[2] == 'o' && declp->b[3] == 'p')
- {
- /* ANSI. */
- /* type conversion operator. */
- tem = declp->b + 4;
- if (do_type (work, &tem, &type))
- {
- string_clear (declp);
- string_append (declp, "operator ");
- string_appends (declp, &type);
- string_delete (&type);
- }
- }
- else if (declp->b[0] == '_' && declp->b[1] == '_'
- && declp->b[2] >= 'a' && declp->b[2] <= 'z'
- && declp->b[3] >= 'a' && declp->b[3] <= 'z')
- {
- if (declp->b[4] == '\0')
- {
- /* Operator. */
- for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
- {
- if (strlen (optable[i].in) == 2
- && memcmp (optable[i].in, declp->b + 2, 2) == 0)
- {
- string_clear (declp);
- string_append (declp, "operator");
- string_append (declp, optable[i].out);
- break;
- }
- }
- }
- else
- {
- if (declp->b[2] == 'a' && declp->b[5] == '\0')
- {
- /* Assignment. */
- for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
- {
- if (strlen (optable[i].in) == 3
- && memcmp (optable[i].in, declp->b + 2, 3) == 0)
- {
- string_clear (declp);
- string_append (declp, "operator");
- string_append (declp, optable[i].out);
- break;
- }
- }
- }
- }
- }
-}
-
-/* a mini string-handling package */
-
-static void
-string_need (s, n)
- string *s;
- int n;
-{
- int tem;
-
- if (s->b == NULL)
- {
- if (n < 32)
- {
- n = 32;
- }
- s->p = s->b = xmalloc (n);
- s->e = s->b + n;
- }
- else if (s->e - s->p < n)
- {
- tem = s->p - s->b;
- n += tem;
- n *= 2;
- s->b = xrealloc (s->b, n);
- s->p = s->b + tem;
- s->e = s->b + n;
- }
-}
-
-static void
-string_delete (s)
- string *s;
-{
- if (s->b != NULL)
- {
- free (s->b);
- s->b = s->e = s->p = NULL;
- }
-}
-
-static void
-string_init (s)
- string *s;
-{
- s->b = s->p = s->e = NULL;
-}
-
-static void
-string_clear (s)
- string *s;
-{
- s->p = s->b;
-}
-
-#if 0
-
-static int
-string_empty (s)
- string *s;
-{
- return (s->b == s->p);
-}
-
-#endif
-
-static void
-string_append (p, s)
- string *p;
- const char *s;
-{
- int n;
- if (s == NULL || *s == '\0')
- return;
- n = strlen (s);
- string_need (p, n);
- memcpy (p->p, s, n);
- p->p += n;
-}
-
-static void
-string_appends (p, s)
- string *p, *s;
-{
- int n;
-
- if (s->b != s->p)
- {
- n = s->p - s->b;
- string_need (p, n);
- memcpy (p->p, s->b, n);
- p->p += n;
- }
-}
-
-static void
-string_appendn (p, s, n)
- string *p;
- const char *s;
- int n;
-{
- if (n != 0)
- {
- string_need (p, n);
- memcpy (p->p, s, n);
- p->p += n;
- }
-}
-
-static void
-string_prepend (p, s)
- string *p;
- const char *s;
-{
- if (s != NULL && *s != '\0')
- {
- string_prependn (p, s, strlen (s));
- }
-}
-
-static void
-string_prepends (p, s)
- string *p, *s;
-{
- if (s->b != s->p)
- {
- string_prependn (p, s->b, s->p - s->b);
- }
-}
-
-static void
-string_prependn (p, s, n)
- string *p;
- const char *s;
- int n;
-{
- char *q;
-
- if (n != 0)
- {
- string_need (p, n);
- for (q = p->p - 1; q >= p->b; q--)
- {
- q[n] = q[0];
- }
- memcpy (p->b, s, n);
- p->p += n;
- }
-}
-
-/* To generate a standalone demangler program for testing purposes,
- just compile and link this file with -DMAIN and libiberty.a. When
- run, it demangles each command line arg, or each stdin string, and
- prints the result on stdout. */
-
-#ifdef MAIN
-
-static void
-demangle_it (mangled_name)
- char *mangled_name;
-{
- char *result;
-
- result = cplus_demangle (mangled_name, DMGL_PARAMS | DMGL_ANSI);
- if (result == NULL)
- {
- printf ("%s\n", mangled_name);
- }
- else
- {
- printf ("%s\n", result);
- free (result);
- }
-}
-
-#include "getopt.h"
-
-static char *program_name;
-static char *program_version = VERSION;
-
-static void
-usage (stream, status)
- FILE *stream;
- int status;
-{
- fprintf (stream, "\
-Usage: %s [-_] [-n] [-s {gnu,lucid,arm}] [--strip-underscores]\n\
- [--no-strip-underscores] [--format={gnu,lucid,arm}]\n\
- [--help] [--version] [arg...]\n",
- program_name);
- exit (status);
-}
-
-#define MBUF_SIZE 512
-char mbuffer[MBUF_SIZE];
-
-/* Defined in the automatically-generated underscore.c. */
-extern int prepends_underscore;
-
-int strip_underscore = 0;
-
-static struct option long_options[] = {
- {"strip-underscores", no_argument, 0, '_'},
- {"format", required_argument, 0, 's'},
- {"help", no_argument, 0, 'h'},
- {"no-strip-underscores", no_argument, 0, 'n'},
- {"version", no_argument, 0, 'v'},
- {0, no_argument, 0, 0}
-};
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- char *result;
- int c;
-
- program_name = argv[0];
-
- strip_underscore = prepends_underscore;
-
- while ((c = getopt_long (argc, argv, "_ns:", long_options, (int *) 0)) != EOF)
- {
- switch (c)
- {
- case '?':
- usage (stderr, 1);
- break;
- case 'h':
- usage (stdout, 0);
- case 'n':
- strip_underscore = 0;
- break;
- case 'v':
- printf ("GNU %s version %s\n", program_name, program_version);
- exit (0);
- case '_':
- strip_underscore = 1;
- break;
- case 's':
- if (strcmp (optarg, "gnu") == 0)
- {
- current_demangling_style = gnu_demangling;
- }
- else if (strcmp (optarg, "lucid") == 0)
- {
- current_demangling_style = lucid_demangling;
- }
- else if (strcmp (optarg, "arm") == 0)
- {
- current_demangling_style = arm_demangling;
- }
- else
- {
- fprintf (stderr, "%s: unknown demangling style `%s'\n",
- program_name, optarg);
- exit (1);
- }
- break;
- }
- }
-
- if (optind < argc)
- {
- for ( ; optind < argc; optind++)
- {
- demangle_it (argv[optind]);
- }
- }
- else
- {
- for (;;)
- {
- int i = 0;
- c = getchar ();
- /* Try to read a label. */
- while (c != EOF && (isalnum(c) || c == '_' || c == '$' || c == '.'))
- {
- if (i >= MBUF_SIZE-1)
- break;
- mbuffer[i++] = c;
- c = getchar ();
- }
- if (i > 0)
- {
- int skip_first = 0;
-
- if (mbuffer[0] == '.')
- ++skip_first;
- if (strip_underscore && mbuffer[skip_first] == '_')
- ++skip_first;
-
- if (skip_first > i)
- skip_first = i;
-
- mbuffer[i] = 0;
-
- result = cplus_demangle (mbuffer + skip_first,
- DMGL_PARAMS | DMGL_ANSI);
- if (result)
- {
- if (mbuffer[0] == '.')
- putc ('.', stdout);
- fputs (result, stdout);
- free (result);
- }
- else
- fputs (mbuffer, stdout);
-
- fflush (stdout);
- }
- if (c == EOF)
- break;
- putchar (c);
- }
- }
-
- exit (0);
-}
-
-static void
-fatal (str)
- char *str;
-{
- fprintf (stderr, "%s: %s\n", program_name, str);
- exit (1);
-}
-
-char * malloc ();
-char * realloc ();
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *value = (char *) malloc (size);
- if (value == 0)
- fatal ("virtual memory exhausted");
- return value;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- register char *value = (char *) realloc (ptr, size);
- if (value == 0)
- fatal ("virtual memory exhausted");
- return value;
-}
-#endif /* main */
diff --git a/gcc/cpp.1 b/gcc/cpp.1
deleted file mode 100644
index 54c4dfb1983..00000000000
--- a/gcc/cpp.1
+++ /dev/null
@@ -1 +0,0 @@
-.so man1/cccp.1
diff --git a/gcc/cpp.texi b/gcc/cpp.texi
deleted file mode 100644
index c3164b97b02..00000000000
--- a/gcc/cpp.texi
+++ /dev/null
@@ -1,2869 +0,0 @@
-\input texinfo
-@setfilename cpp.info
-@settitle The C Preprocessor
-
-@ignore
-@ifinfo
-@format
-START-INFO-DIR-ENTRY
-* Cpp: (cpp). The C preprocessor.
-END-INFO-DIR-ENTRY
-@end format
-@end ifinfo
-@end ignore
-
-@c @smallbook
-@c @cropmarks
-@c @finalout
-@setchapternewpage odd
-@ifinfo
-This file documents the GNU C Preprocessor.
-
-Copyright 1987, 1989, 1991, 1992, 1993, 1994, 1995 Free Software
-Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-@ignore
-Permission is granted to process this file through Tex and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-
-@end ignore
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end ifinfo
-
-@titlepage
-@c @finalout
-@title The C Preprocessor
-@subtitle Last revised March 1997
-@subtitle for GCC version 2
-@author Richard M. Stallman
-@page
-@vskip 2pc
-This booklet is eventually intended to form the first chapter of a GNU
-C Language manual.
-
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997 Free
-Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided also that
-the entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions.
-@end titlepage
-@page
-
-@node Top, Global Actions,, (DIR)
-@chapter The C Preprocessor
-
-The C preprocessor is a @dfn{macro processor} that is used automatically by
-the C compiler to transform your program before actual compilation. It is
-called a macro processor because it allows you to define @dfn{macros},
-which are brief abbreviations for longer constructs.
-
-The C preprocessor provides four separate facilities that you can use as
-you see fit:
-
-@itemize @bullet
-@item
-Inclusion of header files. These are files of declarations that can be
-substituted into your program.
-
-@item
-Macro expansion. You can define @dfn{macros}, which are abbreviations
-for arbitrary fragments of C code, and then the C preprocessor will
-replace the macros with their definitions throughout the program.
-
-@item
-Conditional compilation. Using special preprocessing directives, you
-can include or exclude parts of the program according to various
-conditions.
-
-@item
-Line control. If you use a program to combine or rearrange source files into
-an intermediate file which is then compiled, you can use line control
-to inform the compiler of where each source line originally came from.
-@end itemize
-
-C preprocessors vary in some details. This manual discusses the GNU C
-preprocessor, the C Compatible Compiler Preprocessor. The GNU C
-preprocessor provides a superset of the features of ANSI Standard C@.
-
-ANSI Standard C requires the rejection of many harmless constructs commonly
-used by today's C programs. Such incompatibility would be inconvenient for
-users, so the GNU C preprocessor is configured to accept these constructs
-by default. Strictly speaking, to get ANSI Standard C, you must use the
-options @samp{-trigraphs}, @samp{-undef} and @samp{-pedantic}, but in
-practice the consequences of having strict ANSI Standard C make it
-undesirable to do this. @xref{Invocation}.
-
-The C preprocessor is designed for C-like languages; you may run into
-problems if you apply it to other kinds of languages, because it assumes
-that it is dealing with C@. For example, the C preprocessor sometimes
-outputs extra white space to avoid inadvertent C token concatenation,
-and this may cause problems with other languages.
-
-@menu
-* Global Actions:: Actions made uniformly on all input files.
-* Directives:: General syntax of preprocessing directives.
-* Header Files:: How and why to use header files.
-* Macros:: How and why to use macros.
-* Conditionals:: How and why to use conditionals.
-* Combining Sources:: Use of line control when you combine source files.
-* Other Directives:: Miscellaneous preprocessing directives.
-* Output:: Format of output from the C preprocessor.
-* Invocation:: How to invoke the preprocessor; command options.
-* Concept Index:: Index of concepts and terms.
-* Index:: Index of directives, predefined macros and options.
-@end menu
-
-@node Global Actions, Directives, Top, Top
-@section Transformations Made Globally
-
-Most C preprocessor features are inactive unless you give specific directives
-to request their use. (Preprocessing directives are lines starting with
-@samp{#}; @pxref{Directives}). But there are three transformations that the
-preprocessor always makes on all the input it receives, even in the absence
-of directives.
-
-@itemize @bullet
-@item
-All C comments are replaced with single spaces.
-
-@item
-Backslash-Newline sequences are deleted, no matter where. This
-feature allows you to break long lines for cosmetic purposes without
-changing their meaning.
-
-@item
-Predefined macro names are replaced with their expansions
-(@pxref{Predefined}).
-@end itemize
-
-The first two transformations are done @emph{before} nearly all other parsing
-and before preprocessing directives are recognized. Thus, for example, you
-can split a line cosmetically with Backslash-Newline anywhere (except
-when trigraphs are in use; see below).
-
-@example
-/*
-*/ # /*
-*/ defi\
-ne FO\
-O 10\
-20
-@end example
-
-@noindent
-is equivalent into @samp{#define FOO 1020}. You can split even an escape
-sequence with Backslash-Newline. For example, you can split @code{"foo\bar"}
-between the @samp{\} and the @samp{b} to get
-
-@example
-"foo\\
-bar"
-@end example
-
-@noindent
-This behavior is unclean: in all other contexts, a Backslash can be
-inserted in a string constant as an ordinary character by writing a double
-Backslash, and this creates an exception. But the ANSI C standard requires
-it. (Strict ANSI C does not allow Newlines in string constants, so they
-do not consider this a problem.)
-
-But there are a few exceptions to all three transformations.
-
-@itemize @bullet
-@item
-C comments and predefined macro names are not recognized inside a
-@samp{#include} directive in which the file name is delimited with
-@samp{<} and @samp{>}.
-
-@item
-C comments and predefined macro names are never recognized within a
-character or string constant. (Strictly speaking, this is the rule,
-not an exception, but it is worth noting here anyway.)
-
-@item
-Backslash-Newline may not safely be used within an ANSI ``trigraph''.
-Trigraphs are converted before Backslash-Newline is deleted. If you
-write what looks like a trigraph with a Backslash-Newline inside, the
-Backslash-Newline is deleted as usual, but it is then too late to
-recognize the trigraph.
-
-This exception is relevant only if you use the @samp{-trigraphs}
-option to enable trigraph processing. @xref{Invocation}.
-@end itemize
-
-@node Directives, Header Files, Global Actions, Top
-@section Preprocessing Directives
-
-@cindex preprocessing directives
-@cindex directives
-Most preprocessor features are active only if you use preprocessing directives
-to request their use.
-
-Preprocessing directives are lines in your program that start with @samp{#}.
-The @samp{#} is followed by an identifier that is the @dfn{directive name}.
-For example, @samp{#define} is the directive that defines a macro.
-Whitespace is also allowed before and after the @samp{#}.
-
-The set of valid directive names is fixed. Programs cannot define new
-preprocessing directives.
-
-Some directive names require arguments; these make up the rest of the directive
-line and must be separated from the directive name by whitespace. For example,
-@samp{#define} must be followed by a macro name and the intended expansion
-of the macro. @xref{Simple Macros}.
-
-A preprocessing directive cannot be more than one line in normal circumstances.
-It may be split cosmetically with Backslash-Newline, but that has no effect
-on its meaning. Comments containing Newlines can also divide the
-directive into multiple lines, but the comments are changed to Spaces
-before the directive is interpreted. The only way a significant Newline
-can occur in a preprocessing directive is within a string constant or
-character constant. Note that
-most C compilers that might be applied to the output from the preprocessor
-do not accept string or character constants containing Newlines.
-
-The @samp{#} and the directive name cannot come from a macro expansion. For
-example, if @samp{foo} is defined as a macro expanding to @samp{define},
-that does not make @samp{#foo} a valid preprocessing directive.
-
-@node Header Files, Macros, Directives, Top
-@section Header Files
-
-@cindex header file
-A header file is a file containing C declarations and macro definitions
-(@pxref{Macros}) to be shared between several source files. You request
-the use of a header file in your program with the C preprocessing directive
-@samp{#include}.
-
-@menu
-* Header Uses:: What header files are used for.
-* Include Syntax:: How to write @samp{#include} directives.
-* Include Operation:: What @samp{#include} does.
-* Once-Only:: Preventing multiple inclusion of one header file.
-* Inheritance:: Including one header file in another header file.
-@end menu
-
-@node Header Uses, Include Syntax, Header Files, Header Files
-@subsection Uses of Header Files
-
-Header files serve two kinds of purposes.
-
-@itemize @bullet
-@item
-@findex system header files
-System header files declare the interfaces to parts of the operating
-system. You include them in your program to supply the definitions and
-declarations you need to invoke system calls and libraries.
-
-@item
-Your own header files contain declarations for interfaces between the
-source files of your program. Each time you have a group of related
-declarations and macro definitions all or most of which are needed in
-several different source files, it is a good idea to create a header
-file for them.
-@end itemize
-
-Including a header file produces the same results in C compilation as
-copying the header file into each source file that needs it. But such
-copying would be time-consuming and error-prone. With a header file, the
-related declarations appear in only one place. If they need to be changed,
-they can be changed in one place, and programs that include the header file
-will automatically use the new version when next recompiled. The header
-file eliminates the labor of finding and changing all the copies as well as
-the risk that a failure to find one copy will result in inconsistencies
-within a program.
-
-The usual convention is to give header files names that end with
-@file{.h}. Avoid unusual characters in header file names, as they
-reduce portability.
-
-@node Include Syntax, Include Operation, Header Uses, Header Files
-@subsection The @samp{#include} Directive
-
-@findex #include
-Both user and system header files are included using the preprocessing
-directive @samp{#include}. It has three variants:
-
-@table @code
-@item #include <@var{file}>
-This variant is used for system header files. It searches for a file
-named @var{file} in a list of directories specified by you, then in a
-standard list of system directories. You specify directories to
-search for header files with the command option @samp{-I}
-(@pxref{Invocation}). The option @samp{-nostdinc} inhibits searching
-the standard system directories; in this case only the directories
-you specify are searched.
-
-The parsing of this form of @samp{#include} is slightly special
-because comments are not recognized within the @samp{<@dots{}>}.
-Thus, in @samp{#include <x/*y>} the @samp{/*} does not start a comment
-and the directive specifies inclusion of a system header file named
-@file{x/*y}. Of course, a header file with such a name is unlikely to
-exist on Unix, where shell wildcard features would make it hard to
-manipulate.@refill
-
-The argument @var{file} may not contain a @samp{>} character. It may,
-however, contain a @samp{<} character.
-
-@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 current directory,
-then in the same directories used for system header files. The
-current directory is the directory of the current input file. It is
-tried first because it is presumed to be the location of the files
-that the current input file refers to. (If the @samp{-I-} option is
-used, the special treatment of the current directory is inhibited.)
-
-The argument @var{file} may not contain @samp{"} characters. If
-backslashes occur within @var{file}, they are considered ordinary text
-characters, not escape characters. None of the character escape
-sequences appropriate to string constants in C are processed. Thus,
-@samp{#include "x\n\\y"} specifies a filename containing three
-backslashes. It is not clear why this behavior is ever useful, but
-the ANSI standard specifies it.
-
-@item #include @var{anything else}
-@cindex computed @samp{#include}
-This variant is called a @dfn{computed #include}. Any @samp{#include}
-directive whose argument does not fit the above two forms is a computed
-include. The text @var{anything else} is checked for macro calls,
-which are expanded (@pxref{Macros}). When this is done, the result
-must fit one of the above two variants---in particular, the expanded
-text must in the end be surrounded by either quotes or angle braces.
-
-This feature allows you to define a macro which controls the file name
-to be used at a later point in the program. One application of this is
-to allow a site-specific configuration file for your program to specify
-the names of the system include files to be used. This can help in
-porting the program to various operating systems in which the necessary
-system header files are found in different places.
-@end table
-
-@node Include Operation, Once-Only, Include Syntax, Header Files
-@subsection How @samp{#include} Works
-
-The @samp{#include} directive works by directing the C preprocessor to scan
-the specified file as input before continuing with the rest of the current
-file. The output from the preprocessor contains the output already
-generated, followed by the output resulting from the included file,
-followed by the output that comes from the text after the @samp{#include}
-directive. For example, given a header file @file{header.h} as follows,
-
-@example
-char *test ();
-@end example
-
-@noindent
-and a main program called @file{program.c} that uses the header file,
-like this,
-
-@example
-int x;
-#include "header.h"
-
-main ()
-@{
- printf (test ());
-@}
-@end example
-
-@noindent
-the output generated by the C preprocessor for @file{program.c} as input
-would be
-
-@example
-int x;
-char *test ();
-
-main ()
-@{
- printf (test ());
-@}
-@end example
-
-Included files are not limited to declarations and macro definitions; those
-are merely the typical uses. Any fragment of a C program can be included
-from another file. The include file could even contain the beginning of a
-statement that is concluded in the containing file, or the end of a
-statement that was started in the including file. However, a comment or a
-string or character constant may not start in the included file and finish
-in the including file. An unterminated comment, string constant or
-character constant in an included file is considered to end (with an error
-message) at the end of the file.
-
-It is possible for a header file to begin or end a syntactic unit such
-as a function definition, but that would be very confusing, so don't do
-it.
-
-The line following the @samp{#include} directive is always treated as a
-separate line by the C preprocessor even if the included file lacks a final
-newline.
-
-@node Once-Only, Inheritance, Include Operation, Header Files
-@subsection Once-Only Include Files
-@cindex repeated inclusion
-@cindex including just once
-
-Very often, one header file includes another. It can easily result that a
-certain header file is included more than once. This may lead to errors,
-if the header file defines structure types or typedefs, and is certainly
-wasteful. Therefore, we often wish to prevent multiple inclusion of a
-header file.
-
-The standard way to do this is to enclose the entire real contents of the
-file in a conditional, like this:
-
-@example
-#ifndef FILE_FOO_SEEN
-#define FILE_FOO_SEEN
-
-@var{the entire file}
-
-#endif /* FILE_FOO_SEEN */
-@end example
-
-The macro @code{FILE_FOO_SEEN} indicates that the file has been included
-once already. In a user header file, the macro name should not begin
-with @samp{_}. In a system header file, this name should begin with
-@samp{__} to avoid conflicts with user programs. In any kind of header
-file, the macro name should contain the name of the file and some
-additional text, to avoid conflicts with other header files.
-
-The GNU C preprocessor is programmed to notice when a header file uses
-this particular construct and handle it efficiently. If a header file
-is contained entirely in a @samp{#ifndef} conditional, then it records
-that fact. If a subsequent @samp{#include} specifies the same file,
-and the macro in the @samp{#ifndef} is already defined, then the file
-is entirely skipped, without even reading it.
-
-@findex #pragma once
-There is also an explicit directive to tell the preprocessor that it need
-not include a file more than once. This is called @samp{#pragma once},
-and was used @emph{in addition to} the @samp{#ifndef} conditional around
-the contents of the header file. @samp{#pragma once} is now obsolete
-and should not be used at all.
-
-@findex #import
-In the Objective C language, there is a variant of @samp{#include}
-called @samp{#import} which includes a file, but does so at most once.
-If you use @samp{#import} @emph{instead of} @samp{#include}, then you
-don't need the conditionals inside the header file to prevent multiple
-execution of the contents.
-
-@samp{#import} is obsolete because it is not a well designed feature.
-It requires the users of a header file---the applications
-programmers---to know that a certain header file should only be included
-once. It is much better for the header file's implementor to write the
-file so that users don't need to know this. Using @samp{#ifndef}
-accomplishes this goal.
-
-@node Inheritance,, Once-Only, Header Files
-@subsection Inheritance and Header Files
-@cindex inheritance
-@cindex overriding a header file
-
-@dfn{Inheritance} is what happens when one object or file derives some
-of its contents by virtual copying from another object or file. In
-the case of C header files, inheritance means that one header file
-includes another header file and then replaces or adds something.
-
-If the inheriting header file and the base header file have different
-names, then inheritance is straightforward: simply write @samp{#include
-"@var{base}"} in the inheriting file.
-
-Sometimes it is necessary to give the inheriting file the same name as
-the base file. This is less straightforward.
-
-For example, suppose an application program uses the system header
-@file{sys/signal.h}, but the version of @file{/usr/include/sys/signal.h}
-on a particular system doesn't do what the application program expects.
-It might be convenient to define a ``local'' version, perhaps under the
-name @file{/usr/local/include/sys/signal.h}, to override or add to the
-one supplied by the system.
-
-You can do this by compiling with the option @samp{-I.}, and
-writing a file @file{sys/signal.h} that does what the application
-program expects. But making this file include the standard
-@file{sys/signal.h} is not so easy---writing @samp{#include
-<sys/signal.h>} in that file doesn't work, because it includes your own
-version of the file, not the standard system version. Used in that file
-itself, this leads to an infinite recursion and a fatal error in
-compilation.
-
-@samp{#include </usr/include/sys/signal.h>} would find the proper file,
-but that is not clean, since it makes an assumption about where the
-system header file is found. This is bad for maintenance, since it
-means that any change in where the system's header files are kept
-requires a change somewhere else.
-
-@findex #include_next
-The clean way to solve this problem is to use
-@samp{#include_next}, which means, ``Include the @emph{next} file with
-this name.'' This directive works like @samp{#include} except in
-searching for the specified file: it starts searching the list of header
-file directories @emph{after} the directory in which the current file
-was found.
-
-Suppose you specify @samp{-I /usr/local/include}, and the list of
-directories to search also includes @file{/usr/include}; and suppose
-both directories contain @file{sys/signal.h}. Ordinary
-@samp{#include <sys/signal.h>} finds the file under
-@file{/usr/local/include}. If that file contains @samp{#include_next
-<sys/signal.h>}, it starts searching after that directory, and finds the
-file in @file{/usr/include}.
-
-@node Macros, Conditionals, Header Files, Top
-@section Macros
-
-A macro is a sort of abbreviation which you can define once and then
-use later. There are many complicated features associated with macros
-in the C preprocessor.
-
-@menu
-* Simple Macros:: Macros that always expand the same way.
-* Argument Macros:: Macros that accept arguments that are substituted
- into the macro expansion.
-* Predefined:: Predefined macros that are always available.
-* Stringification:: Macro arguments converted into string constants.
-* Concatenation:: Building tokens from parts taken from macro arguments.
-* Undefining:: Cancelling a macro's definition.
-* Redefining:: Changing a macro's definition.
-* Macro Pitfalls:: Macros can confuse the unwary. Here we explain
- several common problems and strange features.
-@end menu
-
-@node Simple Macros, Argument Macros, Macros, Macros
-@subsection Simple Macros
-@cindex simple macro
-@cindex manifest constant
-
-A @dfn{simple macro} is a kind of abbreviation. It is a name which
-stands for a fragment of code. Some people refer to these as
-@dfn{manifest constants}.
-
-Before you can use a macro, you must @dfn{define} it explicitly with the
-@samp{#define} directive. @samp{#define} is followed by the name of the
-macro and then the code it should be an abbreviation for. For example,
-
-@example
-#define BUFFER_SIZE 1020
-@end example
-
-@noindent
-defines a macro named @samp{BUFFER_SIZE} as an abbreviation for the text
-@samp{1020}. If somewhere after this @samp{#define} directive there comes
-a C statement of the form
-
-@example
-foo = (char *) xmalloc (BUFFER_SIZE);
-@end example
-
-@noindent
-then the C preprocessor will recognize and @dfn{expand} the macro
-@samp{BUFFER_SIZE}, resulting in
-
-@example
-foo = (char *) xmalloc (1020);
-@end example
-
-The use of all upper case for macro names is a standard convention.
-Programs are easier to read when it is possible to tell at a glance which
-names are macros.
-
-Normally, a macro definition must be a single line, like all C
-preprocessing directives. (You can split a long macro definition
-cosmetically with Backslash-Newline.) There is one exception: Newlines
-can be included in the macro definition if within a string or character
-constant. This is because it is not possible for a macro definition to
-contain an unbalanced quote character; the definition automatically
-extends to include the matching quote character that ends the string or
-character constant. Comments within a macro definition may contain
-Newlines, which make no difference since the comments are entirely
-replaced with Spaces regardless of their contents.
-
-Aside from the above, there is no restriction on what can go in a macro
-body. Parentheses need not balance. The body need not resemble valid C
-code. (But if it does not, you may get error messages from the C
-compiler when you use the macro.)
-
-The C preprocessor scans your program sequentially, so macro definitions
-take effect at the place you write them. Therefore, the following input to
-the C preprocessor
-
-@example
-foo = X;
-#define X 4
-bar = X;
-@end example
-
-@noindent
-produces as output
-
-@example
-foo = X;
-
-bar = 4;
-@end example
-
-After the preprocessor expands a macro name, the macro's definition body is
-appended to the front of the remaining input, and the check for macro calls
-continues. Therefore, the macro body can contain calls to other macros.
-For example, after
-
-@example
-#define BUFSIZE 1020
-#define TABLESIZE BUFSIZE
-@end example
-
-@noindent
-the name @samp{TABLESIZE} when used in the program would go through two
-stages of expansion, resulting ultimately in @samp{1020}.
-
-This is not at all the same as defining @samp{TABLESIZE} to be @samp{1020}.
-The @samp{#define} for @samp{TABLESIZE} uses exactly the body you
-specify---in this case, @samp{BUFSIZE}---and does not check to see whether
-it too is the name of a macro. It's only when you @emph{use} @samp{TABLESIZE}
-that the result of its expansion is checked for more macro names.
-@xref{Cascaded Macros}.
-
-@node Argument Macros, Predefined, Simple Macros, Macros
-@subsection Macros with Arguments
-@cindex macros with argument
-@cindex arguments in macro definitions
-@cindex function-like macro
-
-A simple macro always stands for exactly the same text, each time it is
-used. Macros can be more flexible when they accept @dfn{arguments}.
-Arguments are fragments of code that you supply each time the macro is
-used. These fragments are included in the expansion of the macro
-according to the directions in the macro definition. A macro that
-accepts arguments is called a @dfn{function-like macro} because the
-syntax for using it looks like a function call.
-
-@findex #define
-To define a macro that uses arguments, you write a @samp{#define} directive
-with a list of @dfn{argument names} in parentheses after the name of the
-macro. The argument names may be any valid C identifiers, separated by
-commas and optionally whitespace. The open-parenthesis must follow the
-macro name immediately, with no space in between.
-
-For example, here is a macro that computes the minimum of two numeric
-values, as it is defined in many C programs:
-
-@example
-#define min(X, Y) ((X) < (Y) ? (X) : (Y))
-@end example
-
-@noindent
-(This is not the best way to define a ``minimum'' macro in GNU C@.
-@xref{Side Effects}, for more information.)
-
-To use a macro that expects arguments, you write the name of the macro
-followed by a list of @dfn{actual arguments} in parentheses, separated by
-commas. The number of actual arguments you give must match the number of
-arguments the macro expects. Examples of use of the macro @samp{min}
-include @samp{min (1, 2)} and @samp{min (x + 28, *p)}.
-
-The expansion text of the macro depends on the arguments you use.
-Each of the argument names of the macro is replaced, throughout the
-macro definition, with the corresponding actual argument. Using the
-same macro @samp{min} defined above, @samp{min (1, 2)} expands into
-
-@example
-((1) < (2) ? (1) : (2))
-@end example
-
-@noindent
-where @samp{1} has been substituted for @samp{X} and @samp{2} for @samp{Y}.
-
-Likewise, @samp{min (x + 28, *p)} expands into
-
-@example
-((x + 28) < (*p) ? (x + 28) : (*p))
-@end example
-
-Parentheses in the actual arguments must balance; a comma within
-parentheses does not end an argument. However, there is no requirement
-for brackets or braces to balance, and they do not prevent a comma from
-separating arguments. Thus,
-
-@example
-macro (array[x = y, x + 1])
-@end example
-
-@noindent
-passes two arguments to @code{macro}: @samp{array[x = y} and @samp{x +
-1]}. If you want to supply @samp{array[x = y, x + 1]} as an argument,
-you must write it as @samp{array[(x = y, x + 1)]}, which is equivalent C
-code.
-
-After the actual arguments are substituted into the macro body, the entire
-result is appended to the front of the remaining input, and the check for
-macro calls continues. Therefore, the actual arguments can contain calls
-to other macros, either with or without arguments, or even to the same
-macro. The macro body can also contain calls to other macros. For
-example, @samp{min (min (a, b), c)} expands into this text:
-
-@example
-((((a) < (b) ? (a) : (b))) < (c)
- ? (((a) < (b) ? (a) : (b)))
- : (c))
-@end example
-
-@noindent
-(Line breaks shown here for clarity would not actually be generated.)
-
-@cindex blank macro arguments
-@cindex space as macro argument
-If a macro @code{foo} takes one argument, and you want to supply an
-empty argument, you must write at least some whitespace between the
-parentheses, like this: @samp{foo ( )}. Just @samp{foo ()} is providing
-no arguments, which is an error if @code{foo} expects an argument. But
-@samp{foo0 ()} is the correct way to call a macro defined to take zero
-arguments, like this:
-
-@example
-#define foo0() @dots{}
-@end example
-
-If you use the macro name followed by something other than an
-open-parenthesis (after ignoring any spaces, tabs and comments that
-follow), it is not a call to the macro, and the preprocessor does not
-change what you have written. Therefore, it is possible for the same name
-to be a variable or function in your program as well as a macro, and you
-can choose in each instance whether to refer to the macro (if an actual
-argument list follows) or the variable or function (if an argument list
-does not follow).
-
-Such dual use of one name could be confusing and should be avoided
-except when the two meanings are effectively synonymous: that is, when the
-name is both a macro and a function and the two have similar effects. You
-can think of the name simply as a function; use of the name for purposes
-other than calling it (such as, to take the address) will refer to the
-function, while calls will expand the macro and generate better but
-equivalent code. For example, you can use a function named @samp{min} in
-the same source file that defines the macro. If you write @samp{&min} with
-no argument list, you refer to the function. If you write @samp{min (x,
-bb)}, with an argument list, the macro is expanded. If you write
-@samp{(min) (a, bb)}, where the name @samp{min} is not followed by an
-open-parenthesis, the macro is not expanded, so you wind up with a call to
-the function @samp{min}.
-
-You may not define the same name as both a simple macro and a macro with
-arguments.
-
-In the definition of a macro with arguments, the list of argument names
-must follow the macro name immediately with no space in between. If there
-is a space after the macro name, the macro is defined as taking no
-arguments, and all the rest of the line is taken to be the expansion. The
-reason for this is that it is often useful to define a macro that takes no
-arguments and whose definition begins with an identifier in parentheses.
-This rule about spaces makes it possible for you to do either this:
-
-@example
-#define FOO(x) - 1 / (x)
-@end example
-
-@noindent
-(which defines @samp{FOO} to take an argument and expand into minus the
-reciprocal of that argument) or this:
-
-@example
-#define BAR (x) - 1 / (x)
-@end example
-
-@noindent
-(which defines @samp{BAR} to take no argument and always expand into
-@samp{(x) - 1 / (x)}).
-
-Note that the @emph{uses} of a macro with arguments can have spaces before
-the left parenthesis; it's the @emph{definition} where it matters whether
-there is a space.
-
-@node Predefined, Stringification, Argument Macros, Macros
-@subsection Predefined Macros
-
-@cindex predefined macros
-Several simple macros are predefined. You can use them without giving
-definitions for them. They fall into two classes: standard macros and
-system-specific macros.
-
-@menu
-* Standard Predefined:: Standard predefined macros.
-* Nonstandard Predefined:: Nonstandard predefined macros.
-@end menu
-
-@node Standard Predefined, Nonstandard Predefined, Predefined, Predefined
-@subsubsection Standard Predefined Macros
-@cindex standard predefined macros
-
-The standard predefined macros are available with the same meanings
-regardless of the machine or operating system on which you are using GNU C@.
-Their names all start and end with double underscores. Those preceding
-@code{__GNUC__} in this table are standardized by ANSI C; the rest are
-GNU C extensions.
-
-@table @code
-@item __FILE__
-@findex __FILE__
-This macro expands to the name of the current input file, in the form of
-a C string constant. The precise name returned is the one that was
-specified in @samp{#include} or as the input file name argument.
-
-@item __LINE__
-@findex __LINE__
-This macro expands to the current input line number, in the form of a
-decimal integer constant. While we call it a predefined macro, it's
-a pretty strange macro, since its ``definition'' changes with each
-new line of source code.
-
-This and @samp{__FILE__} are useful in generating an error message to
-report an inconsistency detected by the program; the message can state
-the source line at which the inconsistency was detected. For example,
-
-@smallexample
-fprintf (stderr, "Internal error: "
- "negative string length "
- "%d at %s, line %d.",
- length, __FILE__, __LINE__);
-@end smallexample
-
-A @samp{#include} directive changes the expansions of @samp{__FILE__}
-and @samp{__LINE__} to correspond to the included file. At the end of
-that file, when processing resumes on the input file that contained
-the @samp{#include} directive, the expansions of @samp{__FILE__} and
-@samp{__LINE__} revert to the values they had before the
-@samp{#include} (but @samp{__LINE__} is then incremented by one as
-processing moves to the line after the @samp{#include}).
-
-The expansions of both @samp{__FILE__} and @samp{__LINE__} are altered
-if a @samp{#line} directive is used. @xref{Combining Sources}.
-
-@item __DATE__
-@findex __DATE__
-This macro expands to a string constant that describes the date on
-which the preprocessor is being run. The string constant contains
-eleven characters and looks like @w{@samp{"Feb 1 1996"}}.
-@c After reformatting the above, check that the date remains `Feb 1 1996',
-@c all on one line, with two spaces between the `Feb' and the `1'.
-
-@item __TIME__
-@findex __TIME__
-This macro expands to a string constant that describes the time at
-which the preprocessor is being run. The string constant contains
-eight characters and looks like @samp{"23:59:01"}.
-
-@item __STDC__
-@findex __STDC__
-This macro expands to the constant 1, to signify that this is ANSI
-Standard C@. (Whether that is actually true depends on what C compiler
-will operate on the output from the preprocessor.)
-
-@item __STDC_VERSION__
-@findex __STDC_VERSION__
-This macro expands to the C Standard's version number,
-a long integer constant of the form @samp{@var{yyyy}@var{mm}L}
-where @var{yyyy} and @var{mm} are the year and month of the Standard version.
-This signifies which version of the C Standard the preprocessor conforms to.
-Like @samp{__STDC__}, whether this version number is accurate
-for the entire implementation depends on what C compiler
-will operate on the output from the preprocessor.
-
-@item __GNUC__
-@findex __GNUC__
-This macro is defined if and only if this is GNU C@. This macro is
-defined only when the entire GNU C compiler is in use; if you invoke the
-preprocessor directly, @samp{__GNUC__} is undefined. The value
-identifies the major version number of GNU CC (@samp{1} for GNU CC
-version 1, which is now obsolete, and @samp{2} for version 2).
-
-@item __GNUC_MINOR__
-@findex __GNUC_MINOR__
-The macro contains the minor version number of the compiler. This can
-be used to work around differences between different releases of the
-compiler (for example, if gcc 2.6.3 is known to support a feature, you
-can test for @code{__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6)}).
-The last number, @samp{3} in the
-example above, denotes the bugfix level of the compiler; no macro
-contains this value.
-
-@item __GNUG__
-@findex __GNUG__
-The GNU C compiler defines this when the compilation language is
-C++; use @samp{__GNUG__} to distinguish between GNU C and GNU
-C++.
-
-@item __cplusplus
-@findex __cplusplus
-The draft ANSI standard for C++ used to require predefining this
-variable. Though it is no longer required, GNU C++ continues to define
-it, as do other popular C++ compilers. You can use @samp{__cplusplus}
-to test whether a header is compiled by a C compiler or a C++ compiler.
-
-@item __STRICT_ANSI__
-@findex __STRICT_ANSI__
-This macro is defined if and only if the @samp{-ansi} switch was
-specified when GNU C was invoked. Its definition is the null string.
-This macro exists primarily to direct certain GNU header files not to
-define certain traditional Unix constructs which are incompatible with
-ANSI C@.
-
-@item __BASE_FILE__
-@findex __BASE_FILE__
-This macro expands to the name of the main input file, in the form
-of a C string constant. This is the source file that was specified
-as an argument when the C compiler was invoked.
-
-@item __INCLUDE_LEVEL__
-@findex __INCLUDE_LEVEL_
-This macro expands to a decimal integer constant that represents the
-depth of nesting in include files. The value of this macro is
-incremented on every @samp{#include} directive and decremented at every
-end of file. For input files specified by command line arguments,
-the nesting level is zero.
-
-@item __VERSION__
-@findex __VERSION__
-This macro expands to a string which describes the version number of
-GNU C@. The string is normally a sequence of decimal numbers separated
-by periods, such as @samp{"2.6.0"}. The only reasonable use of this
-macro is to incorporate it into a string constant.
-
-@item __OPTIMIZE__
-@findex __OPTIMIZE__
-This macro is defined in optimizing compilations. It causes certain
-GNU header files to define alternative macro definitions for some
-system library functions. It is unwise to refer to or test the
-definition of this macro unless you make very sure that programs will
-execute with the same effect regardless.
-
-@item __CHAR_UNSIGNED__
-@findex __CHAR_UNSIGNED__
-This macro is defined if and only if the data type @code{char} is
-unsigned on the target machine. It exists to cause the standard
-header file @file{limits.h} to work correctly. It is bad practice
-to refer to this macro yourself; instead, refer to the standard
-macros defined in @file{limits.h}. The preprocessor uses
-this macro to determine whether or not to sign-extend large character
-constants written in octal; see @ref{#if Directive,,The @samp{#if} Directive}.
-
-@item __REGISTER_PREFIX__
-@findex __REGISTER_PREFIX__
-This macro expands to a string describing the prefix applied to cpu
-registers in assembler code. It can be used to write assembler code
-that is usable in multiple environments. For example, in the
-@samp{m68k-aout} environment it expands to the string @samp{""},
-but in the @samp{m68k-coff} environment it expands to the string
-@samp{"%"}.
-
-@item __USER_LABEL_PREFIX__
-@findex __USER_LABEL_PREFIX__
-This macro expands to a string describing the prefix applied to user
-generated labels in assembler code. It can be used to write assembler
-code that is usable in multiple environments. For example, in the
-@samp{m68k-aout} environment it expands to the string @samp{"_"}, but in
-the @samp{m68k-coff} environment it expands to the string @samp{""}.
-This does not work with the @samp{-mno-underscores} option that the
-i386 OSF/rose and m88k targets provide nor with the @samp{-mcall*} options
-of the rs6000 System V Release 4 target.
-@end table
-
-@node Nonstandard Predefined,, Standard Predefined, Predefined
-@subsubsection Nonstandard Predefined Macros
-
-The C preprocessor normally has several predefined macros that vary between
-machines because their purpose is to indicate what type of system and
-machine is in use. This manual, being for all systems and machines, cannot
-tell you exactly what their names are; instead, we offer a list of some
-typical ones. You can use @samp{cpp -dM} to see the values of
-predefined macros; see @ref{Invocation}.
-
-Some nonstandard predefined macros describe the operating system in use,
-with more or less specificity. For example,
-
-@table @code
-@item unix
-@findex unix
-@samp{unix} is normally predefined on all Unix systems.
-
-@item BSD
-@findex BSD
-@samp{BSD} is predefined on recent versions of Berkeley Unix
-(perhaps only in version 4.3).
-@end table
-
-Other nonstandard predefined macros describe the kind of CPU, with more or
-less specificity. For example,
-
-@table @code
-@item vax
-@findex vax
-@samp{vax} is predefined on Vax computers.
-
-@item mc68000
-@findex mc68000
-@samp{mc68000} is predefined on most computers whose CPU is a Motorola
-68000, 68010 or 68020.
-
-@item m68k
-@findex m68k
-@samp{m68k} is also predefined on most computers whose CPU is a 68000,
-68010 or 68020; however, some makers use @samp{mc68000} and some use
-@samp{m68k}. Some predefine both names. What happens in GNU C
-depends on the system you are using it on.
-
-@item M68020
-@findex M68020
-@samp{M68020} has been observed to be predefined on some systems that
-use 68020 CPUs---in addition to @samp{mc68000} and @samp{m68k}, which
-are less specific.
-
-@item _AM29K
-@findex _AM29K
-@itemx _AM29000
-@findex _AM29000
-Both @samp{_AM29K} and @samp{_AM29000} are predefined for the AMD 29000
-CPU family.
-
-@item ns32000
-@findex ns32000
-@samp{ns32000} is predefined on computers which use the National
-Semiconductor 32000 series CPU.
-@end table
-
-Yet other nonstandard predefined macros describe the manufacturer of
-the system. For example,
-
-@table @code
-@item sun
-@findex sun
-@samp{sun} is predefined on all models of Sun computers.
-
-@item pyr
-@findex pyr
-@samp{pyr} is predefined on all models of Pyramid computers.
-
-@item sequent
-@findex sequent
-@samp{sequent} is predefined on all models of Sequent computers.
-@end table
-
-These predefined symbols are not only nonstandard, they are contrary to the
-ANSI standard because their names do not start with underscores.
-Therefore, the option @samp{-ansi} inhibits the definition of these
-symbols.
-
-This tends to make @samp{-ansi} useless, since many programs depend on the
-customary nonstandard predefined symbols. Even system header files check
-them and will generate incorrect declarations if they do not find the names
-that are expected. You might think that the header files supplied for the
-Uglix computer would not need to test what machine they are running on,
-because they can simply assume it is the Uglix; but often they do, and they
-do so using the customary names. As a result, very few C programs will
-compile with @samp{-ansi}. We intend to avoid such problems on the GNU
-system.
-
-What, then, should you do in an ANSI C program to test the type of machine
-it will run on?
-
-GNU C offers a parallel series of symbols for this purpose, whose names
-are made from the customary ones by adding @samp{__} at the beginning
-and end. Thus, the symbol @code{__vax__} would be available on a Vax,
-and so on.
-
-The set of nonstandard predefined names in the GNU C preprocessor is
-controlled (when @code{cpp} is itself compiled) by the macro
-@samp{CPP_PREDEFINES}, which should be a string containing @samp{-D}
-options, separated by spaces. For example, on the Sun 3, we use the
-following definition:
-
-@example
-#define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix -Dm68k"
-@end example
-
-@noindent
-This macro is usually specified in @file{tm.h}.
-
-@node Stringification, Concatenation, Predefined, Macros
-@subsection Stringification
-
-@cindex stringification
-@dfn{Stringification} means turning a code fragment into a string constant
-whose contents are the text for the code fragment. For example,
-stringifying @samp{foo (z)} results in @samp{"foo (z)"}.
-
-In the C preprocessor, stringification is an option available when macro
-arguments are substituted into the macro definition. In the body of the
-definition, when an argument name appears, the character @samp{#} before
-the name specifies stringification of the corresponding actual argument
-when it is substituted at that point in the definition. The same argument
-may be substituted in other places in the definition without
-stringification if the argument name appears in those places with no
-@samp{#}.
-
-Here is an example of a macro definition that uses stringification:
-
-@smallexample
-@group
-#define WARN_IF(EXP) \
-do @{ if (EXP) \
- fprintf (stderr, "Warning: " #EXP "\n"); @} \
-while (0)
-@end group
-@end smallexample
-
-@noindent
-Here the actual argument for @samp{EXP} is substituted once as given,
-into the @samp{if} statement, and once as stringified, into the
-argument to @samp{fprintf}. The @samp{do} and @samp{while (0)} are
-a kludge to make it possible to write @samp{WARN_IF (@var{arg});},
-which the resemblance of @samp{WARN_IF} to a function would make
-C programmers want to do; see @ref{Swallow Semicolon}.
-
-The stringification feature is limited to transforming one macro argument
-into one string constant: there is no way to combine the argument with
-other text and then stringify it all together. But the example above shows
-how an equivalent result can be obtained in ANSI Standard C using the
-feature that adjacent string constants are concatenated as one string
-constant. The preprocessor stringifies the actual value of @samp{EXP}
-into a separate string constant, resulting in text like
-
-@smallexample
-@group
-do @{ if (x == 0) \
- fprintf (stderr, "Warning: " "x == 0" "\n"); @} \
-while (0)
-@end group
-@end smallexample
-
-@noindent
-but the C compiler then sees three consecutive string constants and
-concatenates them into one, producing effectively
-
-@smallexample
-do @{ if (x == 0) \
- fprintf (stderr, "Warning: x == 0\n"); @} \
-while (0)
-@end smallexample
-
-Stringification in C involves more than putting doublequote characters
-around the fragment; it is necessary to put backslashes in front of all
-doublequote characters, and all backslashes in string and character
-constants, in order to get a valid C string constant with the proper
-contents. Thus, stringifying @samp{p = "foo\n";} results in @samp{"p =
-\"foo\\n\";"}. However, backslashes that are not inside of string or
-character constants are not duplicated: @samp{\n} by itself stringifies to
-@samp{"\n"}.
-
-Whitespace (including comments) in the text being stringified is handled
-according to precise rules. All leading and trailing whitespace is ignored.
-Any sequence of whitespace in the middle of the text is converted to
-a single space in the stringified result.
-
-@node Concatenation, Undefining, Stringification, Macros
-@subsection Concatenation
-@cindex concatenation
-@cindex @samp{##}
-@dfn{Concatenation} means joining two strings into one. In the context
-of macro expansion, concatenation refers to joining two lexical units
-into one longer one. Specifically, an actual argument to the macro can be
-concatenated with another actual argument or with fixed text to produce
-a longer name. The longer name might be the name of a function,
-variable or type, or a C keyword; it might even be the name of another
-macro, in which case it will be expanded.
-
-When you define a macro, you request concatenation with the special
-operator @samp{##} in the macro body. When the macro is called,
-after actual arguments are substituted, all @samp{##} operators are
-deleted, and so is any whitespace next to them (including whitespace
-that was part of an actual argument). The result is to concatenate
-the syntactic tokens on either side of the @samp{##}.
-
-Consider a C program that interprets named commands. There probably needs
-to be a table of commands, perhaps an array of structures declared as
-follows:
-
-@example
-struct command
-@{
- char *name;
- void (*function) ();
-@};
-
-struct command commands[] =
-@{
- @{ "quit", quit_command@},
- @{ "help", help_command@},
- @dots{}
-@};
-@end example
-
-It would be cleaner not to have to give each command name twice, once in
-the string constant and once in the function name. A macro which takes the
-name of a command as an argument can make this unnecessary. The string
-constant can be created with stringification, and the function name by
-concatenating the argument with @samp{_command}. Here is how it is done:
-
-@example
-#define COMMAND(NAME) @{ #NAME, NAME ## _command @}
-
-struct command commands[] =
-@{
- COMMAND (quit),
- COMMAND (help),
- @dots{}
-@};
-@end example
-
-The usual case of concatenation is concatenating two names (or a name and a
-number) into a longer name. But this isn't the only valid case. It is
-also possible to concatenate two numbers (or a number and a name, such as
-@samp{1.5} and @samp{e3}) into a number. Also, multi-character operators
-such as @samp{+=} can be formed by concatenation. In some cases it is even
-possible to piece together a string constant. However, two pieces of text
-that don't together form a valid lexical unit cannot be concatenated. For
-example, concatenation with @samp{x} on one side and @samp{+} on the other
-is not meaningful because those two characters can't fit together in any
-lexical unit of C@. The ANSI standard says that such attempts at
-concatenation are undefined, but in the GNU C preprocessor it is well
-defined: it puts the @samp{x} and @samp{+} side by side with no particular
-special results.
-
-Keep in mind that the C preprocessor converts comments to whitespace before
-macros are even considered. Therefore, you cannot create a comment by
-concatenating @samp{/} and @samp{*}: the @samp{/*} sequence that starts a
-comment is not a lexical unit, but rather the beginning of a ``long'' space
-character. Also, you can freely use comments next to a @samp{##} in a
-macro definition, or in actual arguments that will be concatenated, because
-the comments will be converted to spaces at first sight, and concatenation
-will later discard the spaces.
-
-@node Undefining, Redefining, Concatenation, Macros
-@subsection Undefining Macros
-
-@cindex undefining macros
-To @dfn{undefine} a macro means to cancel its definition. This is done
-with the @samp{#undef} directive. @samp{#undef} is followed by the macro
-name to be undefined.
-
-Like definition, undefinition occurs at a specific point in the source
-file, and it applies starting from that point. The name ceases to be a
-macro name, and from that point on it is treated by the preprocessor as if
-it had never been a macro name.
-
-For example,
-
-@example
-#define FOO 4
-x = FOO;
-#undef FOO
-x = FOO;
-@end example
-
-@noindent
-expands into
-
-@example
-x = 4;
-
-x = FOO;
-@end example
-
-@noindent
-In this example, @samp{FOO} had better be a variable or function as well
-as (temporarily) a macro, in order for the result of the expansion to be
-valid C code.
-
-The same form of @samp{#undef} directive will cancel definitions with
-arguments or definitions that don't expect arguments. The @samp{#undef}
-directive has no effect when used on a name not currently defined as a macro.
-
-@node Redefining, Macro Pitfalls, Undefining, Macros
-@subsection Redefining Macros
-
-@cindex redefining macros
-@dfn{Redefining} a macro means defining (with @samp{#define}) a name that
-is already defined as a macro.
-
-A redefinition is trivial if the new definition is transparently identical
-to the old one. You probably wouldn't deliberately write a trivial
-redefinition, but they can happen automatically when a header file is
-included more than once (@pxref{Header Files}), so they are accepted
-silently and without effect.
-
-Nontrivial redefinition is considered likely to be an error, so
-it provokes a warning message from the preprocessor. However, sometimes it
-is useful to change the definition of a macro in mid-compilation. You can
-inhibit the warning by undefining the macro with @samp{#undef} before the
-second definition.
-
-In order for a redefinition to be trivial, the new definition must
-exactly match the one already in effect, with two possible exceptions:
-
-@itemize @bullet
-@item
-Whitespace may be added or deleted at the beginning or the end.
-
-@item
-Whitespace may be changed in the middle (but not inside strings).
-However, it may not be eliminated entirely, and it may not be added
-where there was no whitespace at all.
-@end itemize
-
-Recall that a comment counts as whitespace.
-
-@node Macro Pitfalls,, Redefining, Macros
-@subsection Pitfalls and Subtleties of Macros
-@cindex problems with macros
-@cindex pitfalls of macros
-
-In this section we describe some special rules that apply to macros and
-macro expansion, and point out certain cases in which the rules have
-counterintuitive consequences that you must watch out for.
-
-@menu
-* Misnesting:: Macros can contain unmatched parentheses.
-* Macro Parentheses:: Why apparently superfluous parentheses
- may be necessary to avoid incorrect grouping.
-* Swallow Semicolon:: Macros that look like functions
- but expand into compound statements.
-* Side Effects:: Unsafe macros that cause trouble when
- arguments contain side effects.
-* Self-Reference:: Macros whose definitions use the macros' own names.
-* Argument Prescan:: Actual arguments are checked for macro calls
- before they are substituted.
-* Cascaded Macros:: Macros whose definitions use other macros.
-* Newlines in Args:: Sometimes line numbers get confused.
-@end menu
-
-@node Misnesting, Macro Parentheses, Macro Pitfalls, Macro Pitfalls
-@subsubsection Improperly Nested Constructs
-
-Recall that when a macro is called with arguments, the arguments are
-substituted into the macro body and the result is checked, together with
-the rest of the input file, for more macro calls.
-
-It is possible to piece together a macro call coming partially from the
-macro body and partially from the actual arguments. For example,
-
-@example
-#define double(x) (2*(x))
-#define call_with_1(x) x(1)
-@end example
-
-@noindent
-would expand @samp{call_with_1 (double)} into @samp{(2*(1))}.
-
-Macro definitions do not have to have balanced parentheses. By writing an
-unbalanced open parenthesis in a macro body, it is possible to create a
-macro call that begins inside the macro body but ends outside of it. For
-example,
-
-@example
-#define strange(file) fprintf (file, "%s %d",
-@dots{}
-strange(stderr) p, 35)
-@end example
-
-@noindent
-This bizarre example expands to @samp{fprintf (stderr, "%s %d", p, 35)}!
-
-@node Macro Parentheses, Swallow Semicolon, Misnesting, Macro Pitfalls
-@subsubsection Unintended Grouping of Arithmetic
-@cindex parentheses in macro bodies
-
-You may have noticed that in most of the macro definition examples shown
-above, each occurrence of a macro argument name had parentheses around it.
-In addition, another pair of parentheses usually surround the entire macro
-definition. Here is why it is best to write macros that way.
-
-Suppose you define a macro as follows,
-
-@example
-#define ceil_div(x, y) (x + y - 1) / y
-@end example
-
-@noindent
-whose purpose is to divide, rounding up. (One use for this operation is
-to compute how many @samp{int} objects are needed to hold a certain
-number of @samp{char} objects.) Then suppose it is used as follows:
-
-@example
-a = ceil_div (b & c, sizeof (int));
-@end example
-
-@noindent
-This expands into
-
-@example
-a = (b & c + sizeof (int) - 1) / sizeof (int);
-@end example
-
-@noindent
-which does not do what is intended. The operator-precedence rules of
-C make it equivalent to this:
-
-@example
-a = (b & (c + sizeof (int) - 1)) / sizeof (int);
-@end example
-
-@noindent
-But what we want is this:
-
-@example
-a = ((b & c) + sizeof (int) - 1)) / sizeof (int);
-@end example
-
-@noindent
-Defining the macro as
-
-@example
-#define ceil_div(x, y) ((x) + (y) - 1) / (y)
-@end example
-
-@noindent
-provides the desired result.
-
-Unintended grouping can result in another way. Consider
-@samp{sizeof ceil_div(1, 2)}. That has the appearance of a C expression
-that would compute the size of the type of @samp{ceil_div (1, 2)}, but in
-fact it means something very different. Here is what it expands to:
-
-@example
-sizeof ((1) + (2) - 1) / (2)
-@end example
-
-@noindent
-This would take the size of an integer and divide it by two. The precedence
-rules have put the division outside the @samp{sizeof} when it was intended
-to be inside.
-
-Parentheses around the entire macro definition can prevent such problems.
-Here, then, is the recommended way to define @samp{ceil_div}:
-
-@example
-#define ceil_div(x, y) (((x) + (y) - 1) / (y))
-@end example
-
-@node Swallow Semicolon, Side Effects, Macro Parentheses, Macro Pitfalls
-@subsubsection Swallowing the Semicolon
-
-@cindex semicolons (after macro calls)
-Often it is desirable to define a macro that expands into a compound
-statement. Consider, for example, the following macro, that advances a
-pointer (the argument @samp{p} says where to find it) across whitespace
-characters:
-
-@example
-#define SKIP_SPACES (p, limit) \
-@{ register char *lim = (limit); \
- while (p != lim) @{ \
- if (*p++ != ' ') @{ \
- p--; break; @}@}@}
-@end example
-
-@noindent
-Here Backslash-Newline is used to split the macro definition, which must
-be a single line, so that it resembles the way such C code would be
-laid out if not part of a macro definition.
-
-A call to this macro might be @samp{SKIP_SPACES (p, lim)}. Strictly
-speaking, the call expands to a compound statement, which is a complete
-statement with no need for a semicolon to end it. But it looks like a
-function call. So it minimizes confusion if you can use it like a function
-call, writing a semicolon afterward, as in @samp{SKIP_SPACES (p, lim);}
-
-But this can cause trouble before @samp{else} statements, because the
-semicolon is actually a null statement. Suppose you write
-
-@example
-if (*p != 0)
- SKIP_SPACES (p, lim);
-else @dots{}
-@end example
-
-@noindent
-The presence of two statements---the compound statement and a null
-statement---in between the @samp{if} condition and the @samp{else}
-makes invalid C code.
-
-The definition of the macro @samp{SKIP_SPACES} can be altered to solve
-this problem, using a @samp{do @dots{} while} statement. Here is how:
-
-@example
-#define SKIP_SPACES (p, limit) \
-do @{ register char *lim = (limit); \
- while (p != lim) @{ \
- if (*p++ != ' ') @{ \
- p--; break; @}@}@} \
-while (0)
-@end example
-
-Now @samp{SKIP_SPACES (p, lim);} expands into
-
-@example
-do @{@dots{}@} while (0);
-@end example
-
-@noindent
-which is one statement.
-
-@node Side Effects, Self-Reference, Swallow Semicolon, Macro Pitfalls
-@subsubsection Duplication of Side Effects
-
-@cindex side effects (in macro arguments)
-@cindex unsafe macros
-Many C programs define a macro @samp{min}, for ``minimum'', like this:
-
-@example
-#define min(X, Y) ((X) < (Y) ? (X) : (Y))
-@end example
-
-When you use this macro with an argument containing a side effect,
-as shown here,
-
-@example
-next = min (x + y, foo (z));
-@end example
-
-@noindent
-it expands as follows:
-
-@example
-next = ((x + y) < (foo (z)) ? (x + y) : (foo (z)));
-@end example
-
-@noindent
-where @samp{x + y} has been substituted for @samp{X} and @samp{foo (z)}
-for @samp{Y}.
-
-The function @samp{foo} is used only once in the statement as it appears
-in the program, but the expression @samp{foo (z)} has been substituted
-twice into the macro expansion. As a result, @samp{foo} might be called
-two times when the statement is executed. If it has side effects or
-if it takes a long time to compute, the results might not be what you
-intended. We say that @samp{min} is an @dfn{unsafe} macro.
-
-The best solution to this problem is to define @samp{min} in a way that
-computes the value of @samp{foo (z)} only once. The C language offers no
-standard way to do this, but it can be done with GNU C extensions as
-follows:
-
-@example
-#define min(X, Y) \
-(@{ typeof (X) __x = (X), __y = (Y); \
- (__x < __y) ? __x : __y; @})
-@end example
-
-If you do not wish to use GNU C extensions, the only solution is to be
-careful when @emph{using} the macro @samp{min}. For example, you can
-calculate the value of @samp{foo (z)}, save it in a variable, and use that
-variable in @samp{min}:
-
-@example
-#define min(X, Y) ((X) < (Y) ? (X) : (Y))
-@dots{}
-@{
- int tem = foo (z);
- next = min (x + y, tem);
-@}
-@end example
-
-@noindent
-(where we assume that @samp{foo} returns type @samp{int}).
-
-@node Self-Reference, Argument Prescan, Side Effects, Macro Pitfalls
-@subsubsection Self-Referential Macros
-
-@cindex self-reference
-A @dfn{self-referential} macro is one whose name appears in its definition.
-A special feature of ANSI Standard C is that the self-reference is not
-considered a macro call. It is passed into the preprocessor output
-unchanged.
-
-Let's consider an example:
-
-@example
-#define foo (4 + foo)
-@end example
-
-@noindent
-where @samp{foo} is also a variable in your program.
-
-Following the ordinary rules, each reference to @samp{foo} will expand into
-@samp{(4 + foo)}; then this will be rescanned and will expand into @samp{(4
-+ (4 + foo))}; and so on until it causes a fatal error (memory full) in the
-preprocessor.
-
-However, the special rule about self-reference cuts this process short
-after one step, at @samp{(4 + foo)}. Therefore, this macro definition
-has the possibly useful effect of causing the program to add 4 to
-the value of @samp{foo} wherever @samp{foo} is referred to.
-
-In most cases, it is a bad idea to take advantage of this feature. A
-person reading the program who sees that @samp{foo} is a variable will
-not expect that it is a macro as well. The reader will come across the
-identifier @samp{foo} in the program and think its value should be that
-of the variable @samp{foo}, whereas in fact the value is four greater.
-
-The special rule for self-reference applies also to @dfn{indirect}
-self-reference. This is the case where a macro @var{x} expands to use a
-macro @samp{y}, and the expansion of @samp{y} refers to the macro
-@samp{x}. The resulting reference to @samp{x} comes indirectly from the
-expansion of @samp{x}, so it is a self-reference and is not further
-expanded. Thus, after
-
-@example
-#define x (4 + y)
-#define y (2 * x)
-@end example
-
-@noindent
-@samp{x} would expand into @samp{(4 + (2 * x))}. Clear?
-
-But suppose @samp{y} is used elsewhere, not from the definition of @samp{x}.
-Then the use of @samp{x} in the expansion of @samp{y} is not a self-reference
-because @samp{x} is not ``in progress''. So it does expand. However,
-the expansion of @samp{x} contains a reference to @samp{y}, and that
-is an indirect self-reference now because @samp{y} is ``in progress''.
-The result is that @samp{y} expands to @samp{(2 * (4 + y))}.
-
-It is not clear that this behavior would ever be useful, but it is specified
-by the ANSI C standard, so you may need to understand it.
-
-@node Argument Prescan, Cascaded Macros, Self-Reference, Macro Pitfalls
-@subsubsection Separate Expansion of Macro Arguments
-@cindex expansion of arguments
-@cindex macro argument expansion
-@cindex prescan of macro arguments
-
-We have explained that the expansion of a macro, including the substituted
-actual arguments, is scanned over again for macro calls to be expanded.
-
-What really happens is more subtle: first each actual argument text is scanned
-separately for macro calls. Then the results of this are substituted into
-the macro body to produce the macro expansion, and the macro expansion
-is scanned again for macros to expand.
-
-The result is that the actual arguments are scanned @emph{twice} to expand
-macro calls in them.
-
-Most of the time, this has no effect. If the actual argument contained
-any macro calls, they are expanded during the first scan. The result
-therefore contains no macro calls, so the second scan does not change it.
-If the actual argument were substituted as given, with no prescan,
-the single remaining scan would find the same macro calls and produce
-the same results.
-
-You might expect the double scan to change the results when a
-self-referential macro is used in an actual argument of another macro
-(@pxref{Self-Reference}): the self-referential macro would be expanded once
-in the first scan, and a second time in the second scan. But this is not
-what happens. The self-references that do not expand in the first scan are
-marked so that they will not expand in the second scan either.
-
-The prescan is not done when an argument is stringified or concatenated.
-Thus,
-
-@example
-#define str(s) #s
-#define foo 4
-str (foo)
-@end example
-
-@noindent
-expands to @samp{"foo"}. Once more, prescan has been prevented from
-having any noticeable effect.
-
-More precisely, stringification and concatenation use the argument as
-written, in un-prescanned form. The same actual argument would be used in
-prescanned form if it is substituted elsewhere without stringification or
-concatenation.
-
-@example
-#define str(s) #s lose(s)
-#define foo 4
-str (foo)
-@end example
-
-expands to @samp{"foo" lose(4)}.
-
-You might now ask, ``Why mention the prescan, if it makes no difference?
-And why not skip it and make the preprocessor faster?'' The answer is
-that the prescan does make a difference in three special cases:
-
-@itemize @bullet
-@item
-Nested calls to a macro.
-
-@item
-Macros that call other macros that stringify or concatenate.
-
-@item
-Macros whose expansions contain unshielded commas.
-@end itemize
-
-We say that @dfn{nested} calls to a macro occur when a macro's actual
-argument contains a call to that very macro. For example, if @samp{f}
-is a macro that expects one argument, @samp{f (f (1))} is a nested
-pair of calls to @samp{f}. The desired expansion is made by
-expanding @samp{f (1)} and substituting that into the definition of
-@samp{f}. The prescan causes the expected result to happen.
-Without the prescan, @samp{f (1)} itself would be substituted as
-an actual argument, and the inner use of @samp{f} would appear
-during the main scan as an indirect self-reference and would not
-be expanded. Here, the prescan cancels an undesirable side effect
-(in the medical, not computational, sense of the term) of the special
-rule for self-referential macros.
-
-But prescan causes trouble in certain other cases of nested macro calls.
-Here is an example:
-
-@example
-#define foo a,b
-#define bar(x) lose(x)
-#define lose(x) (1 + (x))
-
-bar(foo)
-@end example
-
-@noindent
-We would like @samp{bar(foo)} to turn into @samp{(1 + (foo))}, which
-would then turn into @samp{(1 + (a,b))}. But instead, @samp{bar(foo)}
-expands into @samp{lose(a,b)}, and you get an error because @code{lose}
-requires a single argument. In this case, the problem is easily solved
-by the same parentheses that ought to be used to prevent misnesting of
-arithmetic operations:
-
-@example
-#define foo (a,b)
-#define bar(x) lose((x))
-@end example
-
-The problem is more serious when the operands of the macro are not
-expressions; for example, when they are statements. Then parentheses
-are unacceptable because they would make for invalid C code:
-
-@example
-#define foo @{ int a, b; @dots{} @}
-@end example
-
-@noindent
-In GNU C you can shield the commas using the @samp{(@{@dots{}@})}
-construct which turns a compound statement into an expression:
-
-@example
-#define foo (@{ int a, b; @dots{} @})
-@end example
-
-Or you can rewrite the macro definition to avoid such commas:
-
-@example
-#define foo @{ int a; int b; @dots{} @}
-@end example
-
-There is also one case where prescan is useful. It is possible
-to use prescan to expand an argument and then stringify it---if you use
-two levels of macros. Let's add a new macro @samp{xstr} to the
-example shown above:
-
-@example
-#define xstr(s) str(s)
-#define str(s) #s
-#define foo 4
-xstr (foo)
-@end example
-
-This expands into @samp{"4"}, not @samp{"foo"}. The reason for the
-difference is that the argument of @samp{xstr} is expanded at prescan
-(because @samp{xstr} does not specify stringification or concatenation of
-the argument). The result of prescan then forms the actual argument for
-@samp{str}. @samp{str} uses its argument without prescan because it
-performs stringification; but it cannot prevent or undo the prescanning
-already done by @samp{xstr}.
-
-@node Cascaded Macros, Newlines in Args, Argument Prescan, Macro Pitfalls
-@subsubsection Cascaded Use of Macros
-
-@cindex cascaded macros
-@cindex macro body uses macro
-A @dfn{cascade} of macros is when one macro's body contains a reference
-to another macro. This is very common practice. For example,
-
-@example
-#define BUFSIZE 1020
-#define TABLESIZE BUFSIZE
-@end example
-
-This is not at all the same as defining @samp{TABLESIZE} to be @samp{1020}.
-The @samp{#define} for @samp{TABLESIZE} uses exactly the body you
-specify---in this case, @samp{BUFSIZE}---and does not check to see whether
-it too is the name of a macro.
-
-It's only when you @emph{use} @samp{TABLESIZE} that the result of its expansion
-is checked for more macro names.
-
-This makes a difference if you change the definition of @samp{BUFSIZE}
-at some point in the source file. @samp{TABLESIZE}, defined as shown,
-will always expand using the definition of @samp{BUFSIZE} that is
-currently in effect:
-
-@example
-#define BUFSIZE 1020
-#define TABLESIZE BUFSIZE
-#undef BUFSIZE
-#define BUFSIZE 37
-@end example
-
-@noindent
-Now @samp{TABLESIZE} expands (in two stages) to @samp{37}. (The
-@samp{#undef} is to prevent any warning about the nontrivial
-redefinition of @code{BUFSIZE}.)
-
-@node Newlines in Args,, Cascaded Macros, Macro Pitfalls
-@subsection Newlines in Macro Arguments
-@cindex newlines in macro arguments
-
-Traditional macro processing carries forward all newlines in macro
-arguments into the expansion of the macro. This means that, if some of
-the arguments are substituted more than once, or not at all, or out of
-order, newlines can be duplicated, lost, or moved around within the
-expansion. If the expansion consists of multiple statements, then the
-effect is to distort the line numbers of some of these statements. The
-result can be incorrect line numbers, in error messages or displayed in
-a debugger.
-
-The GNU C preprocessor operating in ANSI C mode adjusts appropriately
-for multiple use of an argument---the first use expands all the
-newlines, and subsequent uses of the same argument produce no newlines.
-But even in this mode, it can produce incorrect line numbering if
-arguments are used out of order, or not used at all.
-
-Here is an example illustrating this problem:
-
-@example
-#define ignore_second_arg(a,b,c) a; c
-
-ignore_second_arg (foo (),
- ignored (),
- syntax error);
-@end example
-
-@noindent
-The syntax error triggered by the tokens @samp{syntax error} results
-in an error message citing line four, even though the statement text
-comes from line five.
-
-@node Conditionals, Combining Sources, Macros, Top
-@section Conditionals
-
-@cindex conditionals
-In a macro processor, a @dfn{conditional} is a directive that allows a part
-of the program to be ignored during compilation, on some conditions.
-In the C preprocessor, a conditional can test either an arithmetic expression
-or whether a name is defined as a macro.
-
-A conditional in the C preprocessor resembles in some ways an @samp{if}
-statement in C, but it is important to understand the difference between
-them. The condition in an @samp{if} statement is tested during the execution
-of your program. Its purpose is to allow your program to behave differently
-from run to run, depending on the data it is operating on. The condition
-in a preprocessing conditional directive is tested when your program is compiled.
-Its purpose is to allow different code to be included in the program depending
-on the situation at the time of compilation.
-
-@menu
-* Uses: Conditional Uses. What conditionals are for.
-* Syntax: Conditional Syntax. How conditionals are written.
-* Deletion: Deleted Code. Making code into a comment.
-* Macros: Conditionals-Macros. Why conditionals are used with macros.
-* Assertions:: How and why to use assertions.
-* Errors: #error Directive. Detecting inconsistent compilation parameters.
-@end menu
-
-@node Conditional Uses
-@subsection Why Conditionals are Used
-
-Generally there are three kinds of reason to use a conditional.
-
-@itemize @bullet
-@item
-A program may need to use different code depending on the machine or
-operating system it is to run on. In some cases the code for one
-operating system may be erroneous on another operating system; for
-example, it might refer to library routines that do not exist on the
-other system. When this happens, it is not enough to avoid executing
-the invalid code: merely having it in the program makes it impossible
-to link the program and run it. With a preprocessing conditional, the
-offending code can be effectively excised from the program when it is
-not valid.
-
-@item
-You may want to be able to compile the same source file into two
-different programs. Sometimes the difference between the programs is
-that one makes frequent time-consuming consistency checks on its
-intermediate data, or prints the values of those data for debugging,
-while the other does not.
-
-@item
-A conditional whose condition is always false is a good way to exclude
-code from the program but keep it as a sort of comment for future
-reference.
-@end itemize
-
-Most simple programs that are intended to run on only one machine will
-not need to use preprocessing conditionals.
-
-@node Conditional Syntax
-@subsection Syntax of Conditionals
-
-@findex #if
-A conditional in the C preprocessor begins with a @dfn{conditional
-directive}: @samp{#if}, @samp{#ifdef} or @samp{#ifndef}.
-@xref{Conditionals-Macros}, for information on @samp{#ifdef} and
-@samp{#ifndef}; only @samp{#if} is explained here.
-
-@menu
-* If: #if Directive. Basic conditionals using @samp{#if} and @samp{#endif}.
-* Else: #else Directive. Including some text if the condition fails.
-* Elif: #elif Directive. Testing several alternative possibilities.
-@end menu
-
-@node #if Directive
-@subsubsection The @samp{#if} Directive
-
-The @samp{#if} directive in its simplest form consists of
-
-@example
-#if @var{expression}
-@var{controlled text}
-#endif /* @var{expression} */
-@end example
-
-The comment following the @samp{#endif} is not required, but it is a good
-practice because it helps people match the @samp{#endif} to the
-corresponding @samp{#if}. Such comments should always be used, except in
-short conditionals that are not nested. In fact, you can put anything at
-all after the @samp{#endif} and it will be ignored by the GNU C preprocessor,
-but only comments are acceptable in ANSI Standard C@.
-
-@var{expression} is a C expression of integer type, subject to stringent
-restrictions. It may contain
-
-@itemize @bullet
-@item
-Integer constants, which are all regarded as @code{long} or
-@code{unsigned long}.
-
-@item
-Character constants, which are interpreted according to the character
-set and conventions of the machine and operating system on which the
-preprocessor is running. The GNU C preprocessor uses the C data type
-@samp{char} for these character constants; therefore, whether some
-character codes are negative is determined by the C compiler used to
-compile the preprocessor. If it treats @samp{char} as signed, then
-character codes large enough to set the sign bit will be considered
-negative; otherwise, no character code is considered negative.
-
-@item
-Arithmetic operators for addition, subtraction, multiplication,
-division, bitwise operations, shifts, comparisons, and logical
-operations (@samp{&&} and @samp{||}).
-
-@item
-Identifiers that are not macros, which are all treated as zero(!).
-
-@item
-Macro calls. All macro calls in the expression are expanded before
-actual computation of the expression's value begins.
-@end itemize
-
-Note that @samp{sizeof} operators and @code{enum}-type values are not allowed.
-@code{enum}-type values, like all other identifiers that are not taken
-as macro calls and expanded, are treated as zero.
-
-The @var{controlled text} inside of a conditional can include
-preprocessing directives. Then the directives inside the conditional are
-obeyed only if that branch of the conditional succeeds. The text can
-also contain other conditional groups. However, the @samp{#if} and
-@samp{#endif} directives must balance.
-
-@node #else Directive
-@subsubsection The @samp{#else} Directive
-
-@findex #else
-The @samp{#else} directive can be added to a conditional to provide
-alternative text to be used if the condition is false. This is what
-it looks like:
-
-@example
-#if @var{expression}
-@var{text-if-true}
-#else /* Not @var{expression} */
-@var{text-if-false}
-#endif /* Not @var{expression} */
-@end example
-
-If @var{expression} is nonzero, and thus the @var{text-if-true} is
-active, then @samp{#else} acts like a failing conditional and the
-@var{text-if-false} is ignored. Contrariwise, if the @samp{#if}
-conditional fails, the @var{text-if-false} is considered included.
-
-@node #elif Directive
-@subsubsection The @samp{#elif} Directive
-
-@findex #elif
-One common case of nested conditionals is used to check for more than two
-possible alternatives. For example, you might have
-
-@example
-#if X == 1
-@dots{}
-#else /* X != 1 */
-#if X == 2
-@dots{}
-#else /* X != 2 */
-@dots{}
-#endif /* X != 2 */
-#endif /* X != 1 */
-@end example
-
-Another conditional directive, @samp{#elif}, allows this to be abbreviated
-as follows:
-
-@example
-#if X == 1
-@dots{}
-#elif X == 2
-@dots{}
-#else /* X != 2 and X != 1*/
-@dots{}
-#endif /* X != 2 and X != 1*/
-@end example
-
-@samp{#elif} stands for ``else if''. Like @samp{#else}, it goes in the
-middle of a @samp{#if}-@samp{#endif} pair and subdivides it; it does not
-require a matching @samp{#endif} of its own. Like @samp{#if}, the
-@samp{#elif} directive includes an expression to be tested.
-
-The text following the @samp{#elif} is processed only if the original
-@samp{#if}-condition failed and the @samp{#elif} condition succeeds.
-More than one @samp{#elif} can go in the same @samp{#if}-@samp{#endif}
-group. Then the text after each @samp{#elif} is processed only if the
-@samp{#elif} condition succeeds after the original @samp{#if} and any
-previous @samp{#elif} directives within it have failed. @samp{#else} is
-equivalent to @samp{#elif 1}, and @samp{#else} is allowed after any
-number of @samp{#elif} directives, but @samp{#elif} may not follow
-@samp{#else}.
-
-@node Deleted Code
-@subsection Keeping Deleted Code for Future Reference
-@cindex commenting out code
-
-If you replace or delete a part of the program but want to keep the old
-code around as a comment for future reference, the easy way to do this
-is to put @samp{#if 0} before it and @samp{#endif} after it. This is
-better than using comment delimiters @samp{/*} and @samp{*/} since those
-won't work if the code already contains comments (C comments do not
-nest).
-
-This works even if the code being turned off contains conditionals, but
-they must be entire conditionals (balanced @samp{#if} and @samp{#endif}).
-
-Conversely, do not use @samp{#if 0} for comments which are not C code.
-Use the comment delimiters @samp{/*} and @samp{*/} instead. The
-interior of @samp{#if 0} must consist of complete tokens; in particular,
-singlequote characters must balance. But comments often contain
-unbalanced singlequote characters (known in English as apostrophes).
-These confuse @samp{#if 0}. They do not confuse @samp{/*}.
-
-@node Conditionals-Macros
-@subsection Conditionals and Macros
-
-Conditionals are useful in connection with macros or assertions, because
-those are the only ways that an expression's value can vary from one
-compilation to another. A @samp{#if} directive whose expression uses no
-macros or assertions is equivalent to @samp{#if 1} or @samp{#if 0}; you
-might as well determine which one, by computing the value of the
-expression yourself, and then simplify the program.
-
-For example, here is a conditional that tests the expression
-@samp{BUFSIZE == 1020}, where @samp{BUFSIZE} must be a macro.
-
-@example
-#if BUFSIZE == 1020
- printf ("Large buffers!\n");
-#endif /* BUFSIZE is large */
-@end example
-
-(Programmers often wish they could test the size of a variable or data
-type in @samp{#if}, but this does not work. The preprocessor does not
-understand @code{sizeof}, or typedef names, or even the type keywords
-such as @code{int}.)
-
-@findex defined
-The special operator @samp{defined} is used in @samp{#if} expressions to
-test whether a certain name is defined as a macro. Either @samp{defined
-@var{name}} or @samp{defined (@var{name})} is an expression whose value
-is 1 if @var{name} is defined as macro at the current point in the
-program, and 0 otherwise. For the @samp{defined} operator it makes no
-difference what the definition of the macro is; all that matters is
-whether there is a definition. Thus, for example,@refill
-
-@example
-#if defined (vax) || defined (ns16000)
-@end example
-
-@noindent
-would succeed if either of the names @samp{vax} and @samp{ns16000} is
-defined as a macro. You can test the same condition using assertions
-(@pxref{Assertions}), like this:
-
-@example
-#if #cpu (vax) || #cpu (ns16000)
-@end example
-
-If a macro is defined and later undefined with @samp{#undef},
-subsequent use of the @samp{defined} operator returns 0, because
-the name is no longer defined. If the macro is defined again with
-another @samp{#define}, @samp{defined} will recommence returning 1.
-
-@findex #ifdef
-@findex #ifndef
-Conditionals that test whether just one name is defined are very common,
-so there are two special short conditional directives for this case.
-
-@table @code
-@item #ifdef @var{name}
-is equivalent to @samp{#if defined (@var{name})}.
-
-@item #ifndef @var{name}
-is equivalent to @samp{#if ! defined (@var{name})}.
-@end table
-
-Macro definitions can vary between compilations for several reasons.
-
-@itemize @bullet
-@item
-Some macros are predefined on each kind of machine. For example, on a
-Vax, the name @samp{vax} is a predefined macro. On other machines, it
-would not be defined.
-
-@item
-Many more macros are defined by system header files. Different
-systems and machines define different macros, or give them different
-values. It is useful to test these macros with conditionals to avoid
-using a system feature on a machine where it is not implemented.
-
-@item
-Macros are a common way of allowing users to customize a program for
-different machines or applications. For example, the macro
-@samp{BUFSIZE} might be defined in a configuration file for your
-program that is included as a header file in each source file. You
-would use @samp{BUFSIZE} in a preprocessing conditional in order to
-generate different code depending on the chosen configuration.
-
-@item
-Macros can be defined or undefined with @samp{-D} and @samp{-U}
-command options when you compile the program. You can arrange to
-compile the same source file into two different programs by choosing
-a macro name to specify which program you want, writing conditionals
-to test whether or how this macro is defined, and then controlling
-the state of the macro with compiler command options.
-@xref{Invocation}.
-@end itemize
-
-@ifinfo
-Assertions are usually predefined, but can be defined with preprocessor
-directives or command-line options.
-@end ifinfo
-
-@node Assertions
-@subsection Assertions
-
-@cindex assertions
-@dfn{Assertions} are a more systematic alternative to macros in writing
-conditionals to test what sort of computer or system the compiled
-program will run on. Assertions are usually predefined, but you can
-define them with preprocessing directives or command-line options.
-
-@cindex predicates
-The macros traditionally used to describe the type of target are not
-classified in any way according to which question they answer; they may
-indicate a hardware architecture, a particular hardware model, an
-operating system, a particular version of an operating system, or
-specific configuration options. These are jumbled together in a single
-namespace. In contrast, each assertion consists of a named question and
-an answer. The question is usually called the @dfn{predicate}.
-An assertion looks like this:
-
-@example
-#@var{predicate} (@var{answer})
-@end example
-
-@noindent
-You must use a properly formed identifier for @var{predicate}. The
-value of @var{answer} can be any sequence of words; all characters are
-significant except for leading and trailing whitespace, and differences
-in internal whitespace sequences are ignored. Thus, @samp{x + y} is
-different from @samp{x+y} but equivalent to @samp{x + y}. @samp{)} is
-not allowed in an answer.
-
-@cindex testing predicates
-Here is a conditional to test whether the answer @var{answer} is asserted
-for the predicate @var{predicate}:
-
-@example
-#if #@var{predicate} (@var{answer})
-@end example
-
-@noindent
-There may be more than one answer asserted for a given predicate. If
-you omit the answer, you can test whether @emph{any} answer is asserted
-for @var{predicate}:
-
-@example
-#if #@var{predicate}
-@end example
-
-@findex #system
-@findex #machine
-@findex #cpu
-Most of the time, the assertions you test will be predefined assertions.
-GNU C provides three predefined predicates: @code{system}, @code{cpu},
-and @code{machine}. @code{system} is for assertions about the type of
-software, @code{cpu} describes the type of computer architecture, and
-@code{machine} gives more information about the computer. For example,
-on a GNU system, the following assertions would be true:
-
-@example
-#system (gnu)
-#system (mach)
-#system (mach 3)
-#system (mach 3.@var{subversion})
-#system (hurd)
-#system (hurd @var{version})
-@end example
-
-@noindent
-and perhaps others. The alternatives with
-more or less version information let you ask more or less detailed
-questions about the type of system software.
-
-On a Unix system, you would find @code{#system (unix)} and perhaps one of:
-@code{#system (aix)}, @code{#system (bsd)}, @code{#system (hpux)},
-@code{#system (lynx)}, @code{#system (mach)}, @code{#system (posix)},
-@code{#system (svr3)}, @code{#system (svr4)}, or @code{#system (xpg4)}
-with possible version numbers following.
-
-Other values for @code{system} are @code{#system (mvs)}
-and @code{#system (vms)}.
-
-@strong{Portability note:} Many Unix C compilers provide only one answer
-for the @code{system} assertion: @code{#system (unix)}, if they support
-assertions at all. This is less than useful.
-
-An assertion with a multi-word answer is completely different from several
-assertions with individual single-word answers. For example, the presence
-of @code{system (mach 3.0)} does not mean that @code{system (3.0)} is true.
-It also does not directly imply @code{system (mach)}, but in GNU C, that
-last will normally be asserted as well.
-
-The current list of possible assertion values for @code{cpu} is:
-@code{#cpu (a29k)}, @code{#cpu (alpha)}, @code{#cpu (arm)}, @code{#cpu
-(clipper)}, @code{#cpu (convex)}, @code{#cpu (elxsi)}, @code{#cpu
-(tron)}, @code{#cpu (h8300)}, @code{#cpu (i370)}, @code{#cpu (i386)},
-@code{#cpu (i860)}, @code{#cpu (i960)}, @code{#cpu (m68k)}, @code{#cpu
-(m88k)}, @code{#cpu (mips)}, @code{#cpu (ns32k)}, @code{#cpu (hppa)},
-@code{#cpu (pyr)}, @code{#cpu (ibm032)}, @code{#cpu (rs6000)},
-@code{#cpu (sh)}, @code{#cpu (sparc)}, @code{#cpu (spur)}, @code{#cpu
-(tahoe)}, @code{#cpu (vax)}, @code{#cpu (we32000)}.
-
-@findex #assert
-You can create assertions within a C program using @samp{#assert}, like
-this:
-
-@example
-#assert @var{predicate} (@var{answer})
-@end example
-
-@noindent
-(Note the absence of a @samp{#} before @var{predicate}.)
-
-@cindex unassert
-@cindex assertions, undoing
-@cindex retracting assertions
-@findex #unassert
-Each time you do this, you assert a new true answer for @var{predicate}.
-Asserting one answer does not invalidate previously asserted answers;
-they all remain true. The only way to remove an assertion is with
-@samp{#unassert}. @samp{#unassert} has the same syntax as
-@samp{#assert}. You can also remove all assertions about
-@var{predicate} like this:
-
-@example
-#unassert @var{predicate}
-@end example
-
-You can also add or cancel assertions using command options
-when you run @code{gcc} or @code{cpp}. @xref{Invocation}.
-
-@node #error Directive
-@subsection The @samp{#error} and @samp{#warning} Directives
-
-@findex #error
-The directive @samp{#error} causes the preprocessor to report a fatal
-error. The rest of the line that follows @samp{#error} is used as the
-error message. The line must consist of complete tokens.
-
-You would use @samp{#error} inside of a conditional that detects a
-combination of parameters which you know the program does not properly
-support. For example, if you know that the program will not run
-properly on a Vax, you might write
-
-@smallexample
-@group
-#ifdef __vax__
-#error "Won't work on Vaxen. See comments at get_last_object."
-#endif
-@end group
-@end smallexample
-
-@noindent
-@xref{Nonstandard Predefined}, for why this works.
-
-If you have several configuration parameters that must be set up by
-the installation in a consistent way, you can use conditionals to detect
-an inconsistency and report it with @samp{#error}. For example,
-
-@smallexample
-#if HASH_TABLE_SIZE % 2 == 0 || HASH_TABLE_SIZE % 3 == 0 \
- || HASH_TABLE_SIZE % 5 == 0
-#error HASH_TABLE_SIZE should not be divisible by a small prime
-#endif
-@end smallexample
-
-@findex #warning
-The directive @samp{#warning} is like the directive @samp{#error}, but causes
-the preprocessor to issue a warning and continue preprocessing. The rest of
-the line that follows @samp{#warning} is used as the warning message.
-
-You might use @samp{#warning} in obsolete header files, with a message
-directing the user to the header file which should be used instead.
-
-@node Combining Sources, Other Directives, Conditionals, Top
-@section Combining Source Files
-
-@cindex line control
-One of the jobs of the C preprocessor is to inform the C compiler of where
-each line of C code came from: which source file and which line number.
-
-C code can come from multiple source files if you use @samp{#include};
-both @samp{#include} and the use of conditionals and macros can cause
-the line number of a line in the preprocessor output to be different
-from the line's number in the original source file. You will appreciate
-the value of making both the C compiler (in error messages) and symbolic
-debuggers such as GDB use the line numbers in your source file.
-
-The C preprocessor builds on this feature by offering a directive by which
-you can control the feature explicitly. This is useful when a file for
-input to the C preprocessor is the output from another program such as the
-@code{bison} parser generator, which operates on another file that is the
-true source file. Parts of the output from @code{bison} are generated from
-scratch, other parts come from a standard parser file. The rest are copied
-nearly verbatim from the source file, but their line numbers in the
-@code{bison} output are not the same as their original line numbers.
-Naturally you would like compiler error messages and symbolic debuggers to
-know the original source file and line number of each line in the
-@code{bison} input.
-
-@findex #line
-@code{bison} arranges this by writing @samp{#line} directives into the output
-file. @samp{#line} is a directive that specifies the original line number
-and source file name for subsequent input in the current preprocessor input
-file. @samp{#line} has three variants:
-
-@table @code
-@item #line @var{linenum}
-Here @var{linenum} is a decimal integer constant. This specifies that
-the line number of the following line of input, in its original source file,
-was @var{linenum}.
-
-@item #line @var{linenum} @var{filename}
-Here @var{linenum} is a decimal integer constant and @var{filename}
-is a string constant. This specifies that the following line of input
-came originally from source file @var{filename} and its line number there
-was @var{linenum}. Keep in mind that @var{filename} is not just a
-file name; it is surrounded by doublequote characters so that it looks
-like a string constant.
-
-@item #line @var{anything else}
-@var{anything else} is checked for macro calls, which are expanded.
-The result should be a decimal integer constant followed optionally
-by a string constant, as described above.
-@end table
-
-@samp{#line} directives alter the results of the @samp{__FILE__} and
-@samp{__LINE__} predefined macros from that point on. @xref{Standard
-Predefined}.
-
-The output of the preprocessor (which is the input for the rest of the
-compiler) contains directives that look much like @samp{#line} directives.
-They start with just @samp{#} instead of @samp{#line}, but this is
-followed by a line number and file name as in @samp{#line}. @xref{Output}.
-
-@node Other Directives, Output, Combining Sources, Top
-@section Miscellaneous Preprocessing Directives
-
-@cindex null directive
-This section describes three additional preprocessing directives. They are
-not very useful, but are mentioned for completeness.
-
-The @dfn{null directive} consists of a @samp{#} followed by a Newline, with
-only whitespace (including comments) in between. A null directive is
-understood as a preprocessing directive but has no effect on the preprocessor
-output. The primary significance of the existence of the null directive is
-that an input line consisting of just a @samp{#} will produce no output,
-rather than a line of output containing just a @samp{#}. Supposedly
-some old C programs contain such lines.
-
-@findex #pragma
-The ANSI standard specifies that the effect of the @samp{#pragma}
-directive is implementation-defined. In the GNU C preprocessor,
-@samp{#pragma} directives are not used, except for @samp{#pragma once}
-(@pxref{Once-Only}). However, they are left in the preprocessor output,
-so they are available to the compilation pass.
-
-@findex #ident
-The @samp{#ident} directive is supported for compatibility with certain
-other systems. It is followed by a line of text. On some systems, the
-text is copied into a special place in the object file; on most systems,
-the text is ignored and this directive has no effect. Typically
-@samp{#ident} is only used in header files supplied with those systems
-where it is meaningful.
-
-@node Output, Invocation, Other Directives, Top
-@section C Preprocessor Output
-
-@cindex output format
-The output from the C preprocessor looks much like the input, except
-that all preprocessing directive lines have been replaced with blank lines
-and all comments with spaces. Whitespace within a line is not altered;
-however, unless @samp{-traditional} is used, spaces may be inserted into
-the expansions of macro calls to prevent tokens from being concatenated.
-
-Source file name and line number information is conveyed by lines of
-the form
-
-@example
-# @var{linenum} @var{filename} @var{flags}
-@end example
-
-@noindent
-which are inserted as needed into the middle of the input (but never
-within a string or character constant). Such a line means that the
-following line originated in file @var{filename} at line @var{linenum}.
-
-After the file name comes zero or more flags, which are @samp{1},
-@samp{2}, @samp{3}, or @samp{4}. If there are multiple flags, spaces separate
-them. Here is what the flags mean:
-
-@table @samp
-@item 1
-This indicates the start of a new file.
-@item 2
-This indicates returning to a file (after having included another file).
-@item 3
-This indicates that the following text comes from a system header file,
-so certain warnings should be suppressed.
-@item 4
-This indicates that the following text should be treated as C@.
-@c maybe cross reference NO_IMPLICIT_EXTERN_C
-@end table
-
-@node Invocation, Concept Index, Output, Top
-@section Invoking the C Preprocessor
-@cindex invocation of the preprocessor
-
-Most often when you use the C preprocessor you will not have to invoke it
-explicitly: the C compiler will do so automatically. However, the
-preprocessor is sometimes useful on its own.
-
-The C preprocessor expects two file names as arguments, @var{infile} and
-@var{outfile}. The preprocessor reads @var{infile} together with any other
-files it specifies with @samp{#include}. All the output generated by the
-combined input files is written in @var{outfile}.
-
-Either @var{infile} or @var{outfile} may be @samp{-}, which as @var{infile}
-means to read from standard input and as @var{outfile} means to write to
-standard output. Also, if @var{outfile} or both file names are omitted,
-the standard output and standard input are used for the omitted file names.
-
-@cindex options
-Here is a table of command options accepted by the C preprocessor.
-These options can also be given when compiling a C program; they are
-passed along automatically to the preprocessor when it is invoked by the
-compiler.
-
-@table @samp
-@item -P
-@findex -P
-Inhibit generation of @samp{#}-lines with line-number information in
-the output from the preprocessor (@pxref{Output}). 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
-@samp{#}-lines.
-
-@item -C
-@findex -C
-Do not discard comments: pass them through to the output file.
-Comments appearing in arguments of a macro call will be copied to the
-output before the expansion of the macro call.
-
-@item -traditional
-@findex -traditional
-Try to imitate the behavior of old-fashioned C, as opposed to ANSI C@.
-
-@itemize @bullet
-@item
-Traditional macro expansion pays no attention to singlequote or
-doublequote characters; macro argument symbols are replaced by the
-argument values even when they appear within apparent string or
-character constants.
-
-@item
-Traditionally, it is permissible for a macro expansion to end in the
-middle of a string or character constant. The constant continues into
-the text surrounding the macro call.
-
-@item
-However, traditionally the end of the line terminates a string or
-character constant, with no error.
-
-@item
-In traditional C, a comment is equivalent to no text at all. (In ANSI
-C, a comment counts as whitespace.)
-
-@item
-Traditional C does not have the concept of a ``preprocessing number''.
-It considers @samp{1.0e+4} to be three tokens: @samp{1.0e}, @samp{+},
-and @samp{4}.
-
-@item
-A macro is not suppressed within its own definition, in traditional C@.
-Thus, any macro that is used recursively inevitably causes an error.
-
-@item
-The character @samp{#} has no special meaning within a macro definition
-in traditional C@.
-
-@item
-In traditional C, the text at the end of a macro expansion can run
-together with the text after the macro call, to produce a single token.
-(This is impossible in ANSI C@.)
-
-@item
-Traditionally, @samp{\} inside a macro argument suppresses the syntactic
-significance of the following character.
-@end itemize
-
-@item -trigraphs
-@findex -trigraphs
-Process ANSI standard trigraph sequences. These are three-character
-sequences, all starting with @samp{??}, that are defined by ANSI C to
-stand for single characters. For example, @samp{??/} stands for
-@samp{\}, so @samp{'??/n'} is a character constant for a newline.
-Strictly speaking, the GNU C preprocessor does not support all
-programs in ANSI Standard C unless @samp{-trigraphs} is used, but if
-you ever notice the difference it will be with relief.
-
-You don't want to know any more about trigraphs.
-
-@item -pedantic
-@findex -pedantic
-Issue warnings required by the ANSI C standard in certain cases such
-as when text other than a comment follows @samp{#else} or @samp{#endif}.
-
-@item -pedantic-errors
-@findex -pedantic-errors
-Like @samp{-pedantic}, except that errors are produced rather than
-warnings.
-
-@item -Wtrigraphs
-@findex -Wtrigraphs
-Warn if any trigraphs are encountered (assuming they are enabled).
-
-@item -Wcomment
-@findex -Wcomment
-@ignore
-@c "Not worth documenting" both singular and plural forms of this
-@c option, per RMS. But also unclear which is better; hence may need to
-@c switch this at some future date. pesch@cygnus.com, 2jan92.
-@itemx -Wcomments
-(Both forms have the same effect).
-@end ignore
-Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
-comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
-
-@item -Wall
-@findex -Wall
-Requests both @samp{-Wtrigraphs} and @samp{-Wcomment} (but not
-@samp{-Wtraditional}).
-
-@item -Wtraditional
-@findex -Wtraditional
-Warn about certain constructs that behave differently in traditional and
-ANSI C@.
-
-@item -I @var{directory}
-@findex -I
-Add the directory @var{directory} to the head of the list of
-directories to be searched for header files (@pxref{Include Syntax}).
-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. If you use more than one @samp{-I} option,
-the directories are scanned in left-to-right order; the standard
-system directories come after.
-
-@item -I-
-Any directories specified with @samp{-I} options before the @samp{-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 @samp{-I} options after
-the @samp{-I-}, these directories are searched for all @samp{#include}
-directives.
-
-In addition, the @samp{-I-} option inhibits the use of the current
-directory as the first search directory for @samp{#include "@var{file}"}.
-Therefore, the current directory is searched only if it is requested
-explicitly with @samp{-I.}. Specifying both @samp{-I-} and @samp{-I.}
-allows you to control precisely which directories are searched before
-the current one and which are searched after.
-
-@item -nostdinc
-@findex -nostdinc
-Do not search the standard system directories for header files.
-Only the directories you have specified with @samp{-I} options
-(and the current directory, if appropriate) are searched.
-
-@item -nostdinc++
-@findex -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 libg++.)
-
-@item -D @var{name}
-@findex -D
-Predefine @var{name} as a macro, with definition @samp{1}.
-
-@item -D @var{name}=@var{definition}
-Predefine @var{name} as a macro, with definition @var{definition}.
-There are no restrictions on the contents of @var{definition}, 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. If you use more than
-one @samp{-D} for the same @var{name}, the rightmost definition takes
-effect.
-
-@item -U @var{name}
-@findex -U
-Do not predefine @var{name}. If both @samp{-U} and @samp{-D} are
-specified for one name, the @samp{-U} beats the @samp{-D} and the name
-is not predefined.
-
-@item -undef
-@findex -undef
-Do not predefine any nonstandard macros.
-
-@item -A @var{predicate}(@var{answer})
-@findex -A
-Make an assertion with the predicate @var{predicate} and answer
-@var{answer}. @xref{Assertions}.
-
-@noindent
-You can use @samp{-A-} to disable all predefined assertions; it also
-undefines all predefined macros that identify the type of target system.
-
-@item -dM
-@findex -dM
-Instead of outputting the result of preprocessing, output a list of
-@samp{#define} 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 @samp{foo.h}, the command
-
-@example
-touch foo.h; cpp -dM foo.h
-@end example
-
-@noindent
-will show the values of any predefined macros.
-
-@item -dD
-@findex -dD
-Like @samp{-dM} except in two respects: it does @emph{not} include the
-predefined macros, and it outputs @emph{both} the @samp{#define}
-directives and the result of preprocessing. Both kinds of output go to
-the standard output file.
-
-@item -M [-MG]
-@findex -M
-Instead of outputting the result of preprocessing, output a rule
-suitable for @code{make} describing the dependencies of the main
-source file. The preprocessor outputs one @code{make} rule containing
-the object file name for that source file, a colon, and the names of
-all the included files. If there are many included files then the
-rule is split into several lines using @samp{\}-newline.
-
-@samp{-MG} says to treat missing header files as generated files and assume
-they live in the same directory as the source file. It must be specified
-in addition to @samp{-M}.
-
-This feature is used in automatic updating of makefiles.
-
-@item -MM [-MG]
-@findex -MM
-Like @samp{-M} but mention only the files included with @samp{#include
-"@var{file}"}. System header files included with @samp{#include
-<@var{file}>} are omitted.
-
-@item -MD @var{file}
-@findex -MD
-Like @samp{-M} but the dependency information is written to @var{file}.
-This is in addition to compiling the file as specified---@samp{-MD} does
-not inhibit ordinary compilation the way @samp{-M} does.
-
-When invoking gcc, do not specify the @var{file} argument.
-Gcc will create file names made by replacing ".c" with ".d" at
-the end of the input file names.
-
-In Mach, you can use the utility @code{md} to merge multiple dependency
-files into a single dependency file suitable for using with the @samp{make}
-command.
-
-@item -MMD @var{file}
-@findex -MMD
-Like @samp{-MD} except mention only user header files, not system
-header files.
-
-@item -H
-@findex -H
-Print the name of each header file used, in addition to other normal
-activities.
-
-@item -imacros @var{file}
-@findex -imacros
-Process @var{file} as input, discarding the resulting output, before
-processing the regular input file. Because the output generated from
-@var{file} is discarded, the only effect of @samp{-imacros @var{file}}
-is to make the macros defined in @var{file} available for use in the
-main input.
-
-@item -include @var{file}
-@findex -include
-Process @var{file} as input, and include all the resulting output,
-before processing the regular input file.
-
-@item -idirafter @var{dir}
-@findex -idirafter
-@cindex second include path
-Add the directory @var{dir} to the second include path. The directories
-on the second include path are searched when a header file is not found
-in any of the directories in the main include path (the one that
-@samp{-I} adds to).
-
-@item -iprefix @var{prefix}
-@findex -iprefix
-Specify @var{prefix} as the prefix for subsequent @samp{-iwithprefix}
-options.
-
-@item -iwithprefix @var{dir}
-@findex -iwithprefix
-Add a directory to the second include path. The directory's name is
-made by concatenating @var{prefix} and @var{dir}, where @var{prefix}
-was specified previously with @samp{-iprefix}.
-
-@item -isystem @var{dir}
-@findex -isystem
-Add a directory to the beginning of the second include path, marking it
-as a system directory, so that it gets the same special treatment as
-is applied to the standard system directories.
-
-@item -lang-c
-@itemx -lang-c89
-@itemx -lang-c++
-@itemx -lang-objc
-@itemx -lang-objc++
-@findex -lang-c
-@findex -lang-c89
-@findex -lang-c++
-@findex -lang-objc
-@findex -lang-objc++
-Specify the source language. @samp{-lang-c} is the default; it
-allows recognition of C++ comments (comments that begin with
-@samp{//} and end at end of line) and hexadecimal floating-point constants,
-since these features will most likely appear in the next C standard.
-@samp{-lang-c89} disables recognition of C++ comments and
-hexadecimal floating-point constants. @samp{-lang-c++}
-handles C++ comment syntax and includes extra default include
-directories for C++. @samp{-lang-objc} enables the Objective C
-@samp{#import} directive. @samp{-lang-objc++} enables both C++ and Objective C
-extensions.
-
-These options are generated by the compiler driver @code{gcc}, but not
-passed from the @samp{gcc} command line unless you use the driver's
-@samp{-Wp} option.
-
-@item -lint
-Look for commands to the program checker @code{lint} embedded in
-comments, and emit them preceded by @samp{#pragma lint}. For example,
-the comment @samp{/* NOTREACHED */} becomes @samp{#pragma lint
-NOTREACHED}.
-
-This option is available only when you call @code{cpp} directly;
-@code{gcc} will not pass it from its command line.
-
-@item -$
-@findex -$
-Forbid the use of @samp{$} in identifiers. This was formerly required
-for strict conformance to the C Standard before the standard was
-corrected.
-
-This option is available only when you call @code{cpp} directly;
-@code{gcc} will not pass it from its command line.
-
-@end table
-
-@node Concept Index, Index, Invocation, Top
-@unnumbered Concept Index
-@printindex cp
-
-@node Index,, Concept Index, Top
-@unnumbered Index of Directives, Macros and Options
-@printindex fn
-
-@contents
-@bye
diff --git a/gcc/cppalloc.c b/gcc/cppalloc.c
deleted file mode 100644
index 79d4c9b3f65..00000000000
--- a/gcc/cppalloc.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Part of CPP library. (memory allocation - xmalloc etc)
- Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
- Written by Per Bothner, 1994.
- Based on CCCP program by by Paul Rubin, June 1986
- Adapted to ANSI C, Richard Stallman, Jan 1987
-
-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, 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.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-#include "config.h"
-#include <stdio.h>
-#include "cpplib.h"
-
-static void
-memory_full ()
-{
- fprintf (stderr, "%s: Memory exhausted.\n", progname);
- exit (FATAL_EXIT_CODE);
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *ptr = (char *) malloc (size);
- if (ptr == 0)
- memory_full ();
- return ptr;
-}
-
-char *
-xrealloc (old, size)
- char *old;
- unsigned size;
-{
- register char *ptr = (char *) realloc (old, size);
- if (ptr == 0)
- memory_full ();
- return ptr;
-}
diff --git a/gcc/cpperror.c b/gcc/cpperror.c
deleted file mode 100644
index 0cf24b90ce3..00000000000
--- a/gcc/cpperror.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Default error handlers for CPP Library.
- Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
- Written by Per Bothner, 1994.
- Based on CCCP program by by Paul Rubin, June 1986
- Adapted to ANSI C, Richard Stallman, Jan 1987
-
-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, 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.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-#ifndef EMACS
-#include "config.h"
-#endif /* not EMACS */
-
-#include "cpplib.h"
-#include <stdio.h>
-
-/* Print the file names and line numbers of the #include
- commands which led to the current file. */
-
-void
-cpp_print_containing_files (pfile)
- cpp_reader *pfile;
-{
- cpp_buffer *ip;
- int i;
- int first = 1;
-
- /* If stack of files hasn't changed since we last printed
- this info, don't repeat it. */
- if (pfile->input_stack_listing_current)
- return;
-
- ip = cpp_file_buffer (pfile);
-
- /* Give up if we don't find a source file. */
- if (ip == NULL)
- return;
-
- /* Find the other, outer source files. */
- while ((ip = CPP_PREV_BUFFER (ip)), ip != CPP_NULL_BUFFER (pfile))
- {
- long line, col;
- cpp_buf_line_and_col (ip, &line, &col);
- if (ip->fname != NULL)
- {
- if (first)
- {
- first = 0;
- fprintf (stderr, "In file included");
- }
- else
- fprintf (stderr, ",\n ");
- }
-
- fprintf (stderr, " from %s:%d", ip->nominal_fname, line);
- }
- if (! first)
- fprintf (stderr, ":\n");
-
- /* Record we have printed the status as of this time. */
- pfile->input_stack_listing_current = 1;
-}
-
-void
-cpp_file_line_for_message (pfile, filename, line, column)
- cpp_reader *pfile;
- char *filename;
- int line, column;
-{
- if (column > 0)
- fprintf (stderr, "%s:%d:%d: ", filename, line, column);
- else
- fprintf (stderr, "%s:%d: ", filename, line);
-}
-
-/* IS_ERROR is 2 for "fatal" error, 1 for error, 0 for warning */
-
-void
-cpp_message (pfile, is_error, msg, arg1, arg2, arg3)
- int is_error;
- cpp_reader *pfile;
- char *msg;
- char *arg1, *arg2, *arg3;
-{
- if (!is_error)
- fprintf (stderr, "warning: ");
- else if (is_error == 2)
- pfile->errors = CPP_FATAL_LIMIT;
- else if (pfile->errors < CPP_FATAL_LIMIT)
- pfile->errors++;
- fprintf (stderr, msg, arg1, arg2, arg3);
- fprintf (stderr, "\n");
-}
-
-/* Same as cpp_error, except we consider the error to be "fatal",
- such as inconsistent options. I.e. there is little point in continuing.
- (We do not exit, to support use of cpplib as a library.
- Instead, it is the caller's responsibility to check
- CPP_FATAL_ERRORS. */
-
-void
-cpp_fatal (pfile, str, arg)
- cpp_reader *pfile;
- char *str, *arg;
-{
- fprintf (stderr, "%s: ", progname);
- cpp_message (pfile, 2, str, arg);
-}
-
-void
-cpp_pfatal_with_name (pfile, name)
- cpp_reader *pfile;
- char *name;
-{
- cpp_perror_with_name (pfile, name);
-#ifdef VMS
- exit (vaxc$errno);
-#else
- exit (FATAL_EXIT_CODE);
-#endif
-}
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
deleted file mode 100644
index 471818a9a91..00000000000
--- a/gcc/cppexp.c
+++ /dev/null
@@ -1,1028 +0,0 @@
-/* Parse C expressions for CCCP.
- Copyright (C) 1987, 1992, 1994, 1995, 1997 Free Software Foundation.
-
-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, 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.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding!
-
-Written by Per Bothner 1994. */
-
-/* Parse a C expression from text in a string */
-
-#include "config.h"
-#include "cpplib.h"
-
-extern char *xmalloc PARAMS ((unsigned));
-extern char *xrealloc PARAMS ((char *, unsigned));
-
-#ifdef MULTIBYTE_CHARS
-#include <stdlib.h>
-#include <locale.h>
-#endif
-
-#include <stdio.h>
-
-/* This is used for communicating lists of keywords with cccp.c. */
-struct arglist {
- struct arglist *next;
- U_CHAR *name;
- int length;
- int argno;
-};
-
-/* Define a generic NULL if one hasn't already been defined. */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef GENERIC_PTR
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#define GENERIC_PTR void *
-#else
-#define GENERIC_PTR char *
-#endif
-#endif
-
-#ifndef NULL_PTR
-#define NULL_PTR ((GENERIC_PTR) 0)
-#endif
-
-extern char *xmalloc ();
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
-#endif
-
-#ifndef MAX_CHAR_TYPE_SIZE
-#define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
-#endif
-
-#ifndef MAX_INT_TYPE_SIZE
-#define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
-#endif
-
-#ifndef MAX_LONG_TYPE_SIZE
-#define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
-#endif
-
-#ifndef MAX_WCHAR_TYPE_SIZE
-#define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
-#endif
-
-/* Yield nonzero if adding two numbers with A's and B's signs can yield a
- number with SUM's sign, where A, B, and SUM are all C integers. */
-#define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
-
-static void integer_overflow ();
-static long left_shift ();
-static long right_shift ();
-
-#define ERROR 299
-#define OROR 300
-#define ANDAND 301
-#define EQUAL 302
-#define NOTEQUAL 303
-#define LEQ 304
-#define GEQ 305
-#define LSH 306
-#define RSH 307
-#define NAME 308
-#define INT 309
-#define CHAR 310
-
-#define LEFT_OPERAND_REQUIRED 1
-#define RIGHT_OPERAND_REQUIRED 2
-#define HAVE_VALUE 4
-/* SKIP_OPERAND is set for '&&' '||' '?' and ':' when the
- following operand should be short-circuited instead of evaluated. */
-#define SKIP_OPERAND 8
-/*#define UNSIGNEDP 16*/
-
-#ifndef HOST_BITS_PER_WIDE_INT
-
-#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
-#define HOST_WIDE_INT long
-#else
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
-#define HOST_WIDE_INT int
-#endif
-
-#endif
-
-struct operation {
- short op;
- char rprio; /* Priority of op (relative to it right operand). */
- char flags;
- char unsignedp; /* true if value should be treated as unsigned */
- HOST_WIDE_INT value; /* The value logically "right" of op. */
-};
-
-/* Take care of parsing a number (anything that starts with a digit).
- LEN is the number of characters in it. */
-
-/* maybe needs to actually deal with floating point numbers */
-
-struct operation
-parse_number (pfile, start, olen)
- cpp_reader *pfile;
- char *start;
- int olen;
-{
- struct operation op;
- register char *p = start;
- register int c;
- register unsigned long n = 0, nd, ULONG_MAX_over_base;
- register int base = 10;
- register int len = olen;
- register int overflow = 0;
- register int digit, largest_digit = 0;
- int spec_long = 0;
-
- op.unsignedp = 0;
-
- for (c = 0; c < len; c++)
- if (p[c] == '.') {
- /* It's a float since it contains a point. */
- cpp_error (pfile,
- "floating point numbers not allowed in #if expressions");
- op.op = ERROR;
- return op;
- }
-
- if (len >= 3 && (!strncmp (p, "0x", 2) || !strncmp (p, "0X", 2))) {
- p += 2;
- base = 16;
- len -= 2;
- }
- else if (*p == '0')
- base = 8;
-
- /* Some buggy compilers (e.g. MPW C) seem to need both casts. */
- ULONG_MAX_over_base = ((unsigned long) -1) / ((unsigned long) base);
-
- for (; len > 0; len--) {
- c = *p++;
-
- if (c >= '0' && c <= '9')
- digit = c - '0';
- else if (base == 16 && c >= 'a' && c <= 'f')
- digit = c - 'a' + 10;
- else if (base == 16 && c >= 'A' && c <= 'F')
- digit = c - 'A' + 10;
- else {
- /* `l' means long, and `u' means unsigned. */
- while (1) {
- if (c == 'l' || c == 'L')
- {
- if (spec_long)
- cpp_error (pfile, "two `l's in integer constant");
- spec_long = 1;
- }
- else if (c == 'u' || c == 'U')
- {
- if (op.unsignedp)
- cpp_error (pfile, "two `u's in integer constant");
- op.unsignedp = 1;
- }
- else
- break;
-
- if (--len == 0)
- break;
- c = *p++;
- }
- /* Don't look for any more digits after the suffixes. */
- break;
- }
- if (largest_digit < digit)
- largest_digit = digit;
- nd = n * base + digit;
- overflow |= ULONG_MAX_over_base < n | nd < n;
- n = nd;
- }
-
- if (len != 0)
- {
- cpp_error (pfile, "Invalid number in #if expression");
- op.op = ERROR;
- return op;
- }
-
- if (base <= largest_digit)
- cpp_pedwarn (pfile, "integer constant contains digits beyond the radix");
-
- if (overflow)
- cpp_pedwarn (pfile, "integer constant out of range");
-
- /* If too big to be signed, consider it unsigned. */
- if ((long) n < 0 && ! op.unsignedp)
- {
- if (base == 10)
- cpp_warning (pfile, "integer constant is so large that it is unsigned");
- op.unsignedp = 1;
- }
-
- op.value = n;
- op.op = INT;
- return op;
-}
-
-struct token {
- char *operator;
- int token;
-};
-
-static struct token tokentab2[] = {
- {"&&", ANDAND},
- {"||", OROR},
- {"<<", LSH},
- {">>", RSH},
- {"==", EQUAL},
- {"!=", NOTEQUAL},
- {"<=", LEQ},
- {">=", GEQ},
- {"++", ERROR},
- {"--", ERROR},
- {NULL, ERROR}
-};
-
-/* Read one token. */
-
-struct operation
-cpp_lex (pfile)
- cpp_reader *pfile;
-{
- register int c;
- register int namelen;
- register struct token *toktab;
- enum cpp_token token;
- struct operation op;
- U_CHAR *tok_start, *tok_end;
- int old_written;
-
- retry:
-
- old_written = CPP_WRITTEN (pfile);
- cpp_skip_hspace (pfile);
- c = CPP_BUF_PEEK (CPP_BUFFER (pfile));
- if (c == '#')
- return parse_number (pfile,
- cpp_read_check_assertion (pfile) ? "1" : "0", 1);
-
- if (c == '\n')
- {
- op.op = 0;
- return op;
- }
-
- token = cpp_get_token (pfile);
- tok_start = pfile->token_buffer + old_written;
- tok_end = CPP_PWRITTEN (pfile);
- pfile->limit = tok_start;
- switch (token)
- {
- case CPP_EOF: /* Should not happen ... */
- case CPP_VSPACE:
- op.op = 0;
- return op;
- case CPP_POP:
- if (CPP_BUFFER (pfile)->fname != NULL)
- {
- op.op = 0;
- return op;
- }
- cpp_pop_buffer (pfile);
- goto retry;
- case CPP_HSPACE: case CPP_COMMENT:
- goto retry;
- case CPP_NUMBER:
- return parse_number (pfile, tok_start, tok_end - tok_start);
- case CPP_STRING:
- cpp_error (pfile, "string constants not allowed in #if expressions");
- op.op = ERROR;
- return op;
- case CPP_CHAR:
- /* This code for reading a character constant
- handles multicharacter constants and wide characters.
- It is mostly copied from c-lex.c. */
- {
- register int result = 0;
- register num_chars = 0;
- unsigned width = MAX_CHAR_TYPE_SIZE;
- int wide_flag = 0;
- int max_chars;
- U_CHAR *ptr = tok_start;
-#ifdef MULTIBYTE_CHARS
- char token_buffer[MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + MB_CUR_MAX];
-#else
- char token_buffer[MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + 1];
-#endif
-
- if (*ptr == 'L')
- {
- ptr++;
- wide_flag = 1;
- width = MAX_WCHAR_TYPE_SIZE;
-#ifdef MULTIBYTE_CHARS
- max_chars = MB_CUR_MAX;
-#else
- max_chars = 1;
-#endif
- }
- else
- max_chars = MAX_LONG_TYPE_SIZE / width;
-
- ++ptr;
- while (ptr < tok_end && ((c = *ptr++) != '\''))
- {
- if (c == '\\')
- {
- c = cpp_parse_escape (pfile, &ptr);
- if (width < HOST_BITS_PER_INT
- && (unsigned) c >= (1 << width))
- cpp_pedwarn (pfile,
- "escape sequence out of range for character");
- }
-
- num_chars++;
-
- /* Merge character into result; ignore excess chars. */
- if (num_chars < max_chars + 1)
- {
- if (width < HOST_BITS_PER_INT)
- result = (result << width) | (c & ((1 << width) - 1));
- else
- result = c;
- token_buffer[num_chars - 1] = c;
- }
- }
-
- token_buffer[num_chars] = 0;
-
- if (c != '\'')
- cpp_error (pfile, "malformatted character constant");
- else if (num_chars == 0)
- cpp_error (pfile, "empty character constant");
- else if (num_chars > max_chars)
- {
- num_chars = max_chars;
- cpp_error (pfile, "character constant too long");
- }
- else if (num_chars != 1 && ! CPP_TRADITIONAL (pfile))
- cpp_warning (pfile, "multi-character character constant");
-
- /* If char type is signed, sign-extend the constant. */
- if (! wide_flag)
- {
- int num_bits = num_chars * width;
-
- if (cpp_lookup (pfile, "__CHAR_UNSIGNED__",
- sizeof ("__CHAR_UNSIGNED__")-1, -1)
- || ((result >> (num_bits - 1)) & 1) == 0)
- op.value
- = result & ((unsigned long) ~0 >> (HOST_BITS_PER_LONG - num_bits));
- else
- op.value
- = result | ~((unsigned long) ~0 >> (HOST_BITS_PER_LONG - num_bits));
- }
- else
- {
-#ifdef MULTIBYTE_CHARS
- /* Set the initial shift state and convert the next sequence. */
- result = 0;
- /* In all locales L'\0' is zero and mbtowc will return zero,
- so don't use it. */
- if (num_chars > 1
- || (num_chars == 1 && token_buffer[0] != '\0'))
- {
- wchar_t wc;
- (void) mbtowc (NULL_PTR, NULL_PTR, 0);
- if (mbtowc (& wc, token_buffer, num_chars) == num_chars)
- result = wc;
- else
- cpp_pedwarn (pfile,"Ignoring invalid multibyte character");
- }
-#endif
- op.value = result;
- }
- }
-
- /* This is always a signed type. */
- op.unsignedp = 0;
- op.op = CHAR;
-
- return op;
-
- case CPP_NAME:
- return parse_number (pfile, "0", 0);
-
- case CPP_OTHER:
- /* See if it is a special token of length 2. */
- if (tok_start + 2 == tok_end)
- {
- for (toktab = tokentab2; toktab->operator != NULL; toktab++)
- if (tok_start[0] == toktab->operator[0]
- && tok_start[1] == toktab->operator[1])
- break;
- if (toktab->token == ERROR)
- {
- char *buf = (char *) alloca (40);
- sprintf (buf, "`%s' not allowed in operand of `#if'", tok_start);
- cpp_error (pfile, buf);
- }
- op.op = toktab->token;
- return op;
- }
- /* fall through */
- default:
- op.op = *tok_start;
- return op;
- }
-}
-
-
-/* Parse a C escape sequence. STRING_PTR points to a variable
- containing a pointer to the string to parse. That pointer
- is updated past the characters we use. The value of the
- escape sequence is returned.
-
- A negative value means the sequence \ newline was seen,
- which is supposed to be equivalent to nothing at all.
-
- If \ is followed by a null character, we return a negative
- value and leave the string pointer pointing at the null character.
-
- If \ is followed by 000, we return 0 and leave the string pointer
- after the zeros. A value of 0 does not mean end of string. */
-
-int
-cpp_parse_escape (pfile, string_ptr)
- cpp_reader *pfile;
- char **string_ptr;
-{
- register int c = *(*string_ptr)++;
- switch (c)
- {
- case 'a':
- return TARGET_BELL;
- case 'b':
- return TARGET_BS;
- case 'e':
- case 'E':
- if (CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "non-ANSI-standard escape sequence, `\\%c'", c);
- return 033;
- case 'f':
- return TARGET_FF;
- case 'n':
- return TARGET_NEWLINE;
- case 'r':
- return TARGET_CR;
- case 't':
- return TARGET_TAB;
- case 'v':
- return TARGET_VT;
- case '\n':
- return -2;
- case 0:
- (*string_ptr)--;
- return 0;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- register int i = c - '0';
- register int count = 0;
- while (++count < 3)
- {
- c = *(*string_ptr)++;
- if (c >= '0' && c <= '7')
- i = (i << 3) + c - '0';
- else
- {
- (*string_ptr)--;
- break;
- }
- }
- if ((i & ~((1 << MAX_CHAR_TYPE_SIZE) - 1)) != 0)
- {
- i &= (1 << MAX_CHAR_TYPE_SIZE) - 1;
- cpp_pedwarn (pfile,
- "octal character constant does not fit in a byte");
- }
- return i;
- }
- case 'x':
- {
- register unsigned i = 0, overflow = 0, digits_found = 0, digit;
- for (;;)
- {
- c = *(*string_ptr)++;
- if (c >= '0' && c <= '9')
- digit = c - '0';
- else if (c >= 'a' && c <= 'f')
- digit = c - 'a' + 10;
- else if (c >= 'A' && c <= 'F')
- digit = c - 'A' + 10;
- else
- {
- (*string_ptr)--;
- break;
- }
- overflow |= i ^ (i << 4 >> 4);
- i = (i << 4) + digit;
- digits_found = 1;
- }
- if (!digits_found)
- cpp_error (pfile, "\\x used with no following hex digits");
- if (overflow | (i & ~((1 << BITS_PER_UNIT) - 1)))
- {
- i &= (1 << BITS_PER_UNIT) - 1;
- cpp_pedwarn (pfile,
- "hex character constant does not fit in a byte");
- }
- return i;
- }
- default:
- return c;
- }
-}
-
-static void
-integer_overflow (pfile)
- cpp_reader *pfile;
-{
- if (CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "integer overflow in preprocessor expression");
-}
-
-static long
-left_shift (pfile, a, unsignedp, b)
- cpp_reader *pfile;
- long a;
- int unsignedp;
- unsigned long b;
-{
- if (b >= HOST_BITS_PER_LONG)
- {
- if (! unsignedp && a != 0)
- integer_overflow (pfile);
- return 0;
- }
- else if (unsignedp)
- return (unsigned long) a << b;
- else
- {
- long l = a << b;
- if (l >> b != a)
- integer_overflow (pfile);
- return l;
- }
-}
-
-static long
-right_shift (pfile, a, unsignedp, b)
- cpp_reader *pfile;
- long a;
- int unsignedp;
- unsigned long b;
-{
- if (b >= HOST_BITS_PER_LONG)
- return unsignedp ? 0 : a >> (HOST_BITS_PER_LONG - 1);
- else if (unsignedp)
- return (unsigned long) a >> b;
- else
- return a >> b;
-}
-
-/* These priorities are all even, so we can handle associatively. */
-#define PAREN_INNER_PRIO 0
-#define COMMA_PRIO 4
-#define COND_PRIO (COMMA_PRIO+2)
-#define OROR_PRIO (COND_PRIO+2)
-#define ANDAND_PRIO (OROR_PRIO+2)
-#define OR_PRIO (ANDAND_PRIO+2)
-#define XOR_PRIO (OR_PRIO+2)
-#define AND_PRIO (XOR_PRIO+2)
-#define EQUAL_PRIO (AND_PRIO+2)
-#define LESS_PRIO (EQUAL_PRIO+2)
-#define SHIFT_PRIO (LESS_PRIO+2)
-#define PLUS_PRIO (SHIFT_PRIO+2)
-#define MUL_PRIO (PLUS_PRIO+2)
-#define UNARY_PRIO (MUL_PRIO+2)
-#define PAREN_OUTER_PRIO (UNARY_PRIO+2)
-
-#define COMPARE(OP) \
- top->unsignedp = 0;\
- top->value = (unsigned1 || unsigned2) ? (unsigned long) v1 OP v2 : (v1 OP v2)
-
-/* Parse and evaluate a C expression, reading from PFILE.
- Returns the value of the expression. */
-
-HOST_WIDE_INT
-cpp_parse_expr (pfile)
- cpp_reader *pfile;
-{
- /* The implementation is an operator precedence parser,
- i.e. a bottom-up parser, using a stack for not-yet-reduced tokens.
-
- The stack base is 'stack', and the current stack pointer is 'top'.
- There is a stack element for each operator (only),
- and the most recently pushed operator is 'top->op'.
- An operand (value) is stored in the 'value' field of the stack
- element of the operator that precedes it.
- In that case the 'flags' field has the HAVE_VALUE flag set. */
-
-#define INIT_STACK_SIZE 20
- struct operation init_stack[INIT_STACK_SIZE];
- struct operation *stack = init_stack;
- struct operation *limit = stack + INIT_STACK_SIZE;
- register struct operation *top = stack;
- int lprio, rprio;
- int skip_evaluation = 0;
-
- top->rprio = 0;
- top->flags = 0;
- for (;;)
- {
- struct operation op;
- char flags = 0;
-
- /* Read a token */
- op = cpp_lex (pfile);
-
- /* See if the token is an operand, in which case go to set_value.
- If the token is an operator, figure out its left and right
- priorities, and then goto maybe_reduce. */
-
- switch (op.op)
- {
- case NAME:
- top->value = 0, top->unsignedp = 0;
- goto set_value;
- case INT: case CHAR:
- top->value = op.value;
- top->unsignedp = op.unsignedp;
- goto set_value;
- case 0:
- lprio = 0; goto maybe_reduce;
- case '+': case '-':
- /* Is this correct if unary ? FIXME */
- flags = RIGHT_OPERAND_REQUIRED;
- lprio = PLUS_PRIO; rprio = lprio + 1; goto maybe_reduce;
- case '!': case '~':
- flags = RIGHT_OPERAND_REQUIRED;
- rprio = UNARY_PRIO; lprio = rprio + 1; goto maybe_reduce;
- case '*': case '/': case '%':
- lprio = MUL_PRIO; goto binop;
- case '<': case '>': case LEQ: case GEQ:
- lprio = LESS_PRIO; goto binop;
- case EQUAL: case NOTEQUAL:
- lprio = EQUAL_PRIO; goto binop;
- case LSH: case RSH:
- lprio = SHIFT_PRIO; goto binop;
- case '&': lprio = AND_PRIO; goto binop;
- case '^': lprio = XOR_PRIO; goto binop;
- case '|': lprio = OR_PRIO; goto binop;
- case ANDAND: lprio = ANDAND_PRIO; goto binop;
- case OROR: lprio = OROR_PRIO; goto binop;
- case ',':
- lprio = COMMA_PRIO; goto binop;
- case '(':
- lprio = PAREN_OUTER_PRIO; rprio = PAREN_INNER_PRIO;
- goto maybe_reduce;
- case ')':
- lprio = PAREN_INNER_PRIO; rprio = PAREN_OUTER_PRIO;
- goto maybe_reduce;
- case ':':
- lprio = COND_PRIO; rprio = COND_PRIO;
- goto maybe_reduce;
- case '?':
- lprio = COND_PRIO + 1; rprio = COND_PRIO;
- goto maybe_reduce;
- binop:
- flags = LEFT_OPERAND_REQUIRED|RIGHT_OPERAND_REQUIRED;
- rprio = lprio + 1;
- goto maybe_reduce;
- default:
- cpp_error (pfile, "invalid character in #if");
- goto syntax_error;
- }
-
- set_value:
- /* Push a value onto the stack. */
- if (top->flags & HAVE_VALUE)
- {
- cpp_error (pfile, "syntax error in #if");
- goto syntax_error;
- }
- top->flags |= HAVE_VALUE;
- continue;
-
- maybe_reduce:
- /* Push an operator, and check if we can reduce now. */
- while (top->rprio > lprio)
- {
- long v1 = top[-1].value, v2 = top[0].value;
- int unsigned1 = top[-1].unsignedp, unsigned2 = top[0].unsignedp;
- top--;
- if ((top[1].flags & LEFT_OPERAND_REQUIRED)
- && ! (top[0].flags & HAVE_VALUE))
- {
- cpp_error (pfile, "syntax error - missing left operand");
- goto syntax_error;
- }
- if ((top[1].flags & RIGHT_OPERAND_REQUIRED)
- && ! (top[1].flags & HAVE_VALUE))
- {
- cpp_error (pfile, "syntax error - missing right operand");
- goto syntax_error;
- }
- /* top[0].value = (top[1].op)(v1, v2);*/
- switch (top[1].op)
- {
- case '+':
- if (!(top->flags & HAVE_VALUE))
- { /* Unary '+' */
- top->value = v2;
- top->unsignedp = unsigned2;
- top->flags |= HAVE_VALUE;
- }
- else
- {
- top->value = v1 + v2;
- top->unsignedp = unsigned1 || unsigned2;
- if (! top->unsignedp && ! skip_evaluation
- && ! possible_sum_sign (v1, v2, top->value))
- integer_overflow (pfile);
- }
- break;
- case '-':
- if (!(top->flags & HAVE_VALUE))
- { /* Unary '-' */
- top->value = - v2;
- if (!skip_evaluation && (top->value & v2) < 0 && !unsigned2)
- integer_overflow (pfile);
- top->unsignedp = unsigned2;
- top->flags |= HAVE_VALUE;
- }
- else
- { /* Binary '-' */
- top->value = v1 - v2;
- top->unsignedp = unsigned1 || unsigned2;
- if (! top->unsignedp && ! skip_evaluation
- && ! possible_sum_sign (top->value, v2, v1))
- integer_overflow (pfile);
- }
- break;
- case '*':
- top->unsignedp = unsigned1 || unsigned2;
- if (top->unsignedp)
- top->value = (unsigned long) v1 * v2;
- else if (!skip_evaluation)
- {
- top->value = v1 * v2;
- if (v1
- && (top->value / v1 != v2
- || (top->value & v1 & v2) < 0))
- integer_overflow (pfile);
- }
- break;
- case '/':
- if (skip_evaluation)
- break;
- if (v2 == 0)
- {
- cpp_error (pfile, "division by zero in #if");
- v2 = 1;
- }
- top->unsignedp = unsigned1 || unsigned2;
- if (top->unsignedp)
- top->value = (unsigned long) v1 / v2;
- else
- {
- top->value = v1 / v2;
- if ((top->value & v1 & v2) < 0)
- integer_overflow (pfile);
- }
- break;
- case '%':
- if (skip_evaluation)
- break;
- if (v2 == 0)
- {
- cpp_error (pfile, "division by zero in #if");
- v2 = 1;
- }
- top->unsignedp = unsigned1 || unsigned2;
- if (top->unsignedp)
- top->value = (unsigned long) v1 % v2;
- else
- top->value = v1 % v2;
- break;
- case '!':
- if (top->flags & HAVE_VALUE)
- {
- cpp_error (pfile, "syntax error");
- goto syntax_error;
- }
- top->value = ! v2;
- top->unsignedp = 0;
- top->flags |= HAVE_VALUE;
- break;
- case '~':
- if (top->flags & HAVE_VALUE)
- {
- cpp_error (pfile, "syntax error");
- goto syntax_error;
- }
- top->value = ~ v2;
- top->unsignedp = unsigned2;
- top->flags |= HAVE_VALUE;
- break;
- case '<': COMPARE(<); break;
- case '>': COMPARE(>); break;
- case LEQ: COMPARE(<=); break;
- case GEQ: COMPARE(>=); break;
- case EQUAL:
- top->value = (v1 == v2);
- top->unsignedp = 0;
- break;
- case NOTEQUAL:
- top->value = (v1 != v2);
- top->unsignedp = 0;
- break;
- case LSH:
- if (skip_evaluation)
- break;
- top->unsignedp = unsigned1;
- if (v2 < 0 && ! unsigned2)
- top->value = right_shift (pfile, v1, unsigned1, -v2);
- else
- top->value = left_shift (pfile, v1, unsigned1, v2);
- break;
- case RSH:
- if (skip_evaluation)
- break;
- top->unsignedp = unsigned1;
- if (v2 < 0 && ! unsigned2)
- top->value = left_shift (pfile, v1, unsigned1, -v2);
- else
- top->value = right_shift (pfile, v1, unsigned1, v2);
- break;
-#define LOGICAL(OP) \
- top->value = v1 OP v2;\
- top->unsignedp = unsigned1 || unsigned2;
- case '&': LOGICAL(&); break;
- case '^': LOGICAL(^); break;
- case '|': LOGICAL(|); break;
- case ANDAND:
- top->value = v1 && v2; top->unsignedp = 0;
- if (!v1) skip_evaluation--;
- break;
- case OROR:
- top->value = v1 || v2; top->unsignedp = 0;
- if (v1) skip_evaluation--;
- break;
- case ',':
- if (CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "comma operator in operand of `#if'");
- top->value = v2;
- top->unsignedp = unsigned2;
- break;
- case '(': case '?':
- cpp_error (pfile, "syntax error in #if");
- goto syntax_error;
- case ':':
- if (top[0].op != '?')
- {
- cpp_error (pfile,
- "syntax error ':' without preceding '?'");
- goto syntax_error;
- }
- else if (! (top[1].flags & HAVE_VALUE)
- || !(top[-1].flags & HAVE_VALUE)
- || !(top[0].flags & HAVE_VALUE))
- {
- cpp_error (pfile, "bad syntax for ?: operator");
- goto syntax_error;
- }
- else
- {
- top--;
- if (top->value) skip_evaluation--;
- top->value = top->value ? v1 : v2;
- top->unsignedp = unsigned1 || unsigned2;
- }
- break;
- case ')':
- if ((top[1].flags & HAVE_VALUE)
- || ! (top[0].flags & HAVE_VALUE)
- || top[0].op != '('
- || (top[-1].flags & HAVE_VALUE))
- {
- cpp_error (pfile, "mismatched parentheses in #if");
- goto syntax_error;
- }
- else
- {
- top--;
- top->value = v1;
- top->unsignedp = unsigned1;
- top->flags |= HAVE_VALUE;
- }
- break;
- default:
- fprintf (stderr,
- top[1].op >= ' ' && top[1].op <= '~'
- ? "unimplemented operator '%c'\n"
- : "unimplemented operator '\\%03o'\n",
- top[1].op);
- }
- }
- if (op.op == 0)
- {
- if (top != stack)
- cpp_error (pfile, "internal error in #if expression");
- if (stack != init_stack)
- free (stack);
- return top->value;
- }
- top++;
-
- /* Check for and handle stack overflow. */
- if (top == limit)
- {
- struct operation *new_stack;
- int old_size = (char *) limit - (char *) stack;
- int new_size = 2 * old_size;
- if (stack != init_stack)
- new_stack = (struct operation *) xrealloc (stack, new_size);
- else
- {
- new_stack = (struct operation *) xmalloc (new_size);
- bcopy ((char *) stack, (char *) new_stack, old_size);
- }
- stack = new_stack;
- top = (struct operation *) ((char *) new_stack + old_size);
- limit = (struct operation *) ((char *) new_stack + new_size);
- }
-
- top->flags = flags;
- top->rprio = rprio;
- top->op = op.op;
- if ((op.op == OROR && top[-1].value)
- || (op.op == ANDAND && !top[-1].value)
- || (op.op == '?' && !top[-1].value))
- {
- skip_evaluation++;
- }
- else if (op.op == ':')
- {
- if (top[-2].value) /* Was condition true? */
- skip_evaluation++;
- else
- skip_evaluation--;
- }
- }
- syntax_error:
- if (stack != init_stack)
- free (stack);
- skip_rest_of_line (pfile);
- return 0;
-}
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
deleted file mode 100644
index 737ac39ef11..00000000000
--- a/gcc/cpphash.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Part of CPP library. (Macro hash table support.)
- Copyright (C) 1986, 87, 89, 92-95, 1996 Free Software Foundation, Inc.
- Written by Per Bothner, 1994.
- Based on CCCP program by by Paul Rubin, June 1986
- Adapted to ANSI C, Richard Stallman, Jan 1987
-
-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, 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.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-#include "cpplib.h"
-#include "cpphash.h"
-#include "gansidecl.h"
-
-extern char *xmalloc PARAMS ((unsigned));
-
-/* Return hash function on name. must be compatible with the one
- computed a step at a time, elsewhere */
-
-int
-hashf (name, len, hashsize)
- register const U_CHAR *name;
- register int len;
- int hashsize;
-{
- register int r = 0;
-
- while (len--)
- r = HASHSTEP (r, *name++);
-
- return MAKE_POS (r) % hashsize;
-}
-
-/* Find the most recent hash node for name name (ending with first
- non-identifier char) installed by install
-
- If LEN is >= 0, it is the length of the name.
- Otherwise, compute the length by scanning the entire name.
-
- If HASH is >= 0, it is the precomputed hash code.
- Otherwise, compute the hash code. */
-
-HASHNODE *
-cpp_lookup (pfile, name, len, hash)
- cpp_reader *pfile;
- const U_CHAR *name;
- int len;
- int hash;
-{
- register const U_CHAR *bp;
- register HASHNODE *bucket;
-
- if (len < 0)
- {
- for (bp = name; is_idchar[*bp]; bp++) ;
- len = bp - name;
- }
-
- if (hash < 0)
- hash = hashf (name, len, HASHSIZE);
-
- bucket = hashtab[hash];
- while (bucket) {
- if (bucket->length == len && strncmp (bucket->name, name, len) == 0)
- return bucket;
- bucket = bucket->next;
- }
- return (HASHNODE *) 0;
-}
-
-/*
- * Delete a hash node. Some weirdness to free junk from macros.
- * More such weirdness will have to be added if you define more hash
- * types that need it.
- */
-
-/* Note that the DEFINITION of a macro is removed from the hash table
- but its storage is not freed. This would be a storage leak
- except that it is not reasonable to keep undefining and redefining
- large numbers of macros many times.
- In any case, this is necessary, because a macro can be #undef'd
- in the middle of reading the arguments to a call to it.
- If #undef freed the DEFINITION, that would crash. */
-
-void
-delete_macro (hp)
- HASHNODE *hp;
-{
-
- if (hp->prev != NULL)
- hp->prev->next = hp->next;
- if (hp->next != NULL)
- hp->next->prev = hp->prev;
-
- /* make sure that the bucket chain header that
- the deleted guy was on points to the right thing afterwards. */
- if (hp == *hp->bucket_hdr)
- *hp->bucket_hdr = hp->next;
-
- if (hp->type == T_MACRO)
- {
- DEFINITION *d = hp->value.defn;
- struct reflist *ap, *nextap;
-
- for (ap = d->pattern; ap != NULL; ap = nextap)
- {
- nextap = ap->next;
- free (ap);
- }
- if (d->nargs >= 0)
- free (d->args.argnames);
- free (d);
- }
-
- free (hp);
-}
-
-/* Install a name in the main hash table, even if it is already there.
- name stops with first non alphanumeric, except leading '#'.
- caller must check against redefinition if that is desired.
- delete_macro () removes things installed by install () in fifo order.
- this is important because of the `defined' special symbol used
- in #if, and also if pushdef/popdef directives are ever implemented.
-
- If LEN is >= 0, it is the length of the name.
- Otherwise, compute the length by scanning the entire name.
-
- If HASH is >= 0, it is the precomputed hash code.
- Otherwise, compute the hash code. */
-
-HASHNODE *
-install (name, len, type, ivalue, value, hash)
- U_CHAR *name;
- int len;
- enum node_type type;
- int ivalue;
- char *value;
- int hash;
-{
- register HASHNODE *hp;
- register int i, bucket;
- register U_CHAR *p, *q;
-
- if (len < 0) {
- p = name;
- while (is_idchar[*p])
- p++;
- len = p - name;
- }
-
- if (hash < 0)
- hash = hashf (name, len, HASHSIZE);
-
- i = sizeof (HASHNODE) + len + 1;
- hp = (HASHNODE *) xmalloc (i);
- bucket = hash;
- hp->bucket_hdr = &hashtab[bucket];
- hp->next = hashtab[bucket];
- hashtab[bucket] = hp;
- hp->prev = NULL;
- if (hp->next != NULL)
- hp->next->prev = hp;
- hp->type = type;
- hp->length = len;
- if (hp->type == T_CONST)
- hp->value.ival = ivalue;
- else
- hp->value.cpval = value;
- hp->name = ((U_CHAR *) hp) + sizeof (HASHNODE);
- p = hp->name;
- q = name;
- for (i = 0; i < len; i++)
- *p++ = *q++;
- hp->name[len] = 0;
- return hp;
-}
-
-void
-cpp_hash_cleanup (pfile)
- cpp_reader *pfile;
-{
- register int i;
- for (i = HASHSIZE; --i >= 0; )
- {
- while (hashtab[i])
- delete_macro (hashtab[i]);
- }
-}
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
deleted file mode 100644
index ed06c186aed..00000000000
--- a/gcc/cpphash.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* different kinds of things that can appear in the value field
- of a hash node. Actually, this may be useless now. */
-union hashval {
- int ival;
- char *cpval;
- DEFINITION *defn;
-#if 0
- KEYDEF *keydef;
-#endif
-};
-
-struct hashnode {
- struct hashnode *next; /* double links for easy deletion */
- struct hashnode *prev;
- struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash
- chain is kept, in case the node is the head
- of the chain and gets deleted. */
- enum node_type type; /* type of special token */
- int length; /* length of token, for quick comparison */
- U_CHAR *name; /* the actual name */
- union hashval value; /* pointer to expansion, or whatever */
-};
-
-typedef struct hashnode HASHNODE;
-
-/* Some definitions for the hash table. The hash function MUST be
- computed as shown in hashf () below. That is because the rescan
- loop computes the hash value `on the fly' for most tokens,
- in order to avoid the overhead of a lot of procedure calls to
- the hashf () function. Hashf () only exists for the sake of
- politeness, for use when speed isn't so important. */
-
-#define HASHSIZE 1403
-static HASHNODE *hashtab[HASHSIZE];
-#define HASHSTEP(old, c) ((old << 2) + c)
-#define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
-
-extern HASHNODE *install PARAMS ((U_CHAR *,int,enum node_type, int,char *,int));
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
deleted file mode 100644
index f7e43ff75c3..00000000000
--- a/gcc/cpplib.c
+++ /dev/null
@@ -1,7551 +0,0 @@
-/* CPP Library.
- Copyright (C) 1986, 87, 89, 92-6, 1997 Free Software Foundation, Inc.
- Contributed by Per Bothner, 1994-95.
- Based on CCCP program by Paul Rubin, June 1986
- Adapted to ANSI C, Richard Stallman, Jan 1987
-
-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, 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.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-#ifdef EMACS
-#define NO_SHORTNAMES
-#include "../src/config.h"
-#ifdef open
-#undef open
-#undef read
-#undef write
-#endif /* open */
-#endif /* EMACS */
-
-/* The macro EMACS is defined when cpp is distributed as part of Emacs,
- for the sake of machines with limited C compilers. */
-#ifndef EMACS
-#include "config.h"
-#endif /* not EMACS */
-
-#ifndef STANDARD_INCLUDE_DIR
-#define STANDARD_INCLUDE_DIR "/usr/include"
-#endif
-
-#if 0 /* We can't get ptrdiff_t, so I arranged not to need PTR_INT_TYPE. */
-#ifdef __STDC__
-#define PTR_INT_TYPE ptrdiff_t
-#else
-#define PTR_INT_TYPE long
-#endif
-#endif /* 0 */
-
-#include "cpplib.h"
-#include "cpphash.h"
-
-#ifndef STDC_VALUE
-#define STDC_VALUE 1
-#endif
-
-/* By default, colon separates directories in a path. */
-#ifndef PATH_SEPARATOR
-#define PATH_SEPARATOR ':'
-#endif
-
-#include <ctype.h>
-#include <stdio.h>
-#include <signal.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-
-#ifndef VMS
-#ifndef USG
-#include <sys/time.h> /* for __DATE__ and __TIME__ */
-#include <sys/resource.h>
-#else
-#include <sys/times.h>
-#include <time.h>
-#include <fcntl.h>
-#endif /* USG */
-#endif /* not VMS */
-
-/* This defines "errno" properly for VMS, and gives us EACCES. */
-#include <errno.h>
-
-extern char *index ();
-extern char *rindex ();
-
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-
-#undef MIN
-#undef MAX
-#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
-#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
-
-/* Find the largest host integer type and set its size and type. */
-
-#ifndef HOST_BITS_PER_WIDE_INT
-
-#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
-#define HOST_WIDE_INT long
-#else
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
-#define HOST_WIDE_INT int
-#endif
-
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-
-/* Define a generic NULL if one hasn't already been defined. */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef GENERIC_PTR
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#define GENERIC_PTR void *
-#else
-#define GENERIC_PTR char *
-#endif
-#endif
-
-#ifndef NULL_PTR
-#define NULL_PTR ((GENERIC_PTR) 0)
-#endif
-
-#ifndef INCLUDE_LEN_FUDGE
-#define INCLUDE_LEN_FUDGE 0
-#endif
-
-/* Symbols to predefine. */
-
-#ifdef CPP_PREDEFINES
-static char *predefs = CPP_PREDEFINES;
-#else
-static char *predefs = "";
-#endif
-
-/* We let tm.h override the types used here, to handle trivial differences
- such as the choice of unsigned int or long unsigned int for size_t.
- When machines start needing nontrivial differences in the size type,
- it would be best to do something here to figure out automatically
- from other information what type to use. */
-
-/* The string value for __SIZE_TYPE__. */
-
-#ifndef SIZE_TYPE
-#define SIZE_TYPE "long unsigned int"
-#endif
-
-/* The string value for __PTRDIFF_TYPE__. */
-
-#ifndef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "long int"
-#endif
-
-/* The string value for __WCHAR_TYPE__. */
-
-#ifndef WCHAR_TYPE
-#define WCHAR_TYPE "int"
-#endif
-#define CPP_WCHAR_TYPE(PFILE) \
- (CPP_OPTIONS (PFILE)->cplusplus ? "__wchar_t" : WCHAR_TYPE)
-
-/* The string value for __USER_LABEL_PREFIX__ */
-
-#ifndef USER_LABEL_PREFIX
-#define USER_LABEL_PREFIX ""
-#endif
-
-/* The string value for __REGISTER_PREFIX__ */
-
-#ifndef REGISTER_PREFIX
-#define REGISTER_PREFIX ""
-#endif
-
-/* In the definition of a #assert name, this structure forms
- a list of the individual values asserted.
- Each value is itself a list of "tokens".
- These are strings that are compared by name. */
-
-struct tokenlist_list {
- struct tokenlist_list *next;
- struct arglist *tokens;
-};
-
-struct assertion_hashnode {
- struct assertion_hashnode *next; /* double links for easy deletion */
- struct assertion_hashnode *prev;
- /* also, a back pointer to this node's hash
- chain is kept, in case the node is the head
- of the chain and gets deleted. */
- struct assertion_hashnode **bucket_hdr;
- int length; /* length of token, for quick comparison */
- U_CHAR *name; /* the actual name */
- /* List of token-sequences. */
- struct tokenlist_list *value;
-};
-
-#define SKIP_WHITE_SPACE(p) do { while (is_hor_space[*p]) p++; } while (0)
-#define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[*p]) p++; } while (0)
-
-#define PEEKN(N) (CPP_BUFFER (pfile)->rlimit - CPP_BUFFER (pfile)->cur >= (N) ? CPP_BUFFER (pfile)->cur[N] : EOF)
-#define FORWARD(N) CPP_FORWARD (CPP_BUFFER (pfile), (N))
-#define GETC() CPP_BUF_GET (CPP_BUFFER (pfile))
-#define PEEKC() CPP_BUF_PEEK (CPP_BUFFER (pfile))
-/* CPP_IS_MACRO_BUFFER is true if the buffer contains macro expansion.
- (Note that it is false while we're expanding marco *arguments*.) */
-#define CPP_IS_MACRO_BUFFER(PBUF) ((PBUF)->cleanup == macro_cleanup)
-
-/* Move all backslash-newline pairs out of embarrassing places.
- Exchange all such pairs following BP
- with any potentially-embarrassing characters that follow them.
- Potentially-embarrassing characters are / and *
- (because a backslash-newline inside a comment delimiter
- would cause it not to be recognized). */
-
-#define NEWLINE_FIX \
- do {while (PEEKC() == '\\' && PEEKN(1) == '\n') FORWARD(2); } while(0)
-
-/* Same, but assume we've already read the potential '\\' into C. */
-#define NEWLINE_FIX1(C) do { \
- while ((C) == '\\' && PEEKC() == '\n') { FORWARD(1); (C) = GETC(); }\
- } while(0)
-
-struct cpp_pending {
- struct cpp_pending *next;
- char *cmd;
- char *arg;
-};
-
-/* Forward declarations. */
-
-extern char *xmalloc ();
-
-static void add_import ();
-static void append_include_chain ();
-static void make_undef ();
-static void make_assertion ();
-static void path_include ();
-static void initialize_builtins ();
-static void initialize_char_syntax ();
-static void dump_arg_n ();
-static void dump_defn_1 ();
-extern void delete_macro ();
-static void trigraph_pcp ();
-static int finclude ();
-static void validate_else ();
-static int comp_def_part ();
-#ifdef abort
-extern void fancy_abort ();
-#endif
-static void pipe_closed ();
-static void print_containing_files ();
-static int lookup_import ();
-static int redundant_include_p ();
-static is_system_include ();
-static struct file_name_map *read_name_map ();
-static char *read_filename_string ();
-static int open_include_file ();
-static int check_preconditions ();
-static void pcfinclude ();
-static void pcstring_used ();
-static int check_macro_name ();
-static int compare_defs ();
-static int compare_token_lists ();
-static HOST_WIDE_INT eval_if_expression ();
-static int change_newlines ();
-extern int hashf ();
-static int file_size_and_mode ();
-static struct arglist *read_token_list ();
-static void free_token_list ();
-static int safe_read ();
-static void push_macro_expansion PARAMS ((cpp_reader *,
- U_CHAR *, int, HASHNODE *));
-static struct cpp_pending *nreverse_pending PARAMS ((struct cpp_pending *));
-extern char *xrealloc ();
-static char *xcalloc ();
-static char *savestring ();
-
-static void conditional_skip ();
-static void skip_if_group ();
-
-/* Last arg to output_line_command. */
-enum file_change_code {same_file, enter_file, leave_file};
-
-/* External declarations. */
-
-extern HOST_WIDE_INT cpp_parse_expr PARAMS ((cpp_reader *));
-
-extern char *getenv ();
-extern FILE *fdopen ();
-extern char *version_string;
-extern struct tm *localtime ();
-
-/* These functions are declared to return int instead of void since they
- are going to be placed in a table and some old compilers have trouble with
- pointers to functions returning void. */
-
-static int do_define ();
-static int do_line ();
-static int do_include ();
-static int do_undef ();
-static int do_error ();
-static int do_pragma ();
-static int do_ident ();
-static int do_if ();
-static int do_xifdef ();
-static int do_else ();
-static int do_elif ();
-static int do_endif ();
-static int do_sccs ();
-static int do_once ();
-static int do_assert ();
-static int do_unassert ();
-static int do_warning ();
-
-struct file_name_list
- {
- struct file_name_list *next;
- char *fname;
- /* If the following is nonzero, it is a macro name.
- Don't include the file again if that macro is defined. */
- U_CHAR *control_macro;
- /* If the following is nonzero, it is a C-language system include
- directory. */
- int c_system_include_path;
- /* Mapping of file names for this directory. */
- struct file_name_map *name_map;
- /* Non-zero if name_map is valid. */
- int got_name_map;
- };
-
-/* If a buffer's dir field is SELF_DIR_DUMMY, it means the file was found
- via the same directory as the file that #included it. */
-#define SELF_DIR_DUMMY ((struct file_name_list *) (~0))
-
-/* #include "file" looks in source file dir, then stack. */
-/* #include <file> just looks in the stack. */
-/* -I directories are added to the end, then the defaults are added. */
-/* The */
-static struct default_include {
- char *fname; /* The name of the directory. */
- int cplusplus; /* Only look here if we're compiling C++. */
- int cxx_aware; /* Includes in this directory don't need to
- be wrapped in extern "C" when compiling
- C++. */
-} include_defaults_array[]
-#ifdef INCLUDE_DEFAULTS
- = INCLUDE_DEFAULTS;
-#else
- = {
- /* Pick up GNU C++ specific include files. */
- { GPLUSPLUS_INCLUDE_DIR, 1, 1 },
- { OLD_GPLUSPLUS_INCLUDE_DIR, 1, 1 },
-#ifdef CROSS_COMPILE
- /* This is the dir for fixincludes. Put it just before
- the files that we fix. */
- { GCC_INCLUDE_DIR, 0, 0 },
- /* For cross-compilation, this dir name is generated
- automatically in Makefile.in. */
- { CROSS_INCLUDE_DIR, 0, 0 },
-#ifdef TOOL_INCLUDE_DIR
- /* This is another place that the target system's headers might be. */
- { TOOL_INCLUDE_DIR, 0, 1 },
-#endif
-#else /* not CROSS_COMPILE */
-#ifdef LOCAL_INCLUDE_DIR
- /* This should be /usr/local/include and should come before
- the fixincludes-fixed header files. */
- { LOCAL_INCLUDE_DIR, 0, 1 },
-#endif
-#ifdef TOOL_INCLUDE_DIR
- /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
- Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */
- { TOOL_INCLUDE_DIR, 0, 1 },
-#endif
- /* This is the dir for fixincludes. Put it just before
- the files that we fix. */
- { GCC_INCLUDE_DIR, 0, 0 },
- /* Some systems have an extra dir of include files. */
-#ifdef SYSTEM_INCLUDE_DIR
- { SYSTEM_INCLUDE_DIR, 0, 0 },
-#endif
- { STANDARD_INCLUDE_DIR, 0, 0 },
-#endif /* not CROSS_COMPILE */
- { 0, 0, 0 }
- };
-#endif /* no INCLUDE_DEFAULTS */
-
-/* `struct directive' defines one #-directive, including how to handle it. */
-
-struct directive {
- int length; /* Length of name */
- int (*func)(); /* Function to handle directive */
- char *name; /* Name of directive */
- enum node_type type; /* Code which describes which directive. */
- char command_reads_line; /* One if rest of line is read by func. */
- char traditional_comments; /* Nonzero: keep comments if -traditional. */
- char pass_thru; /* Copy preprocessed directive to output file.*/
-};
-
-/* Here is the actual list of #-directives, most-often-used first.
- The initialize_builtins function assumes #define is the very first. */
-
-static struct directive directive_table[] = {
- { 6, do_define, "define", T_DEFINE, 0, 1},
- { 5, do_xifdef, "ifdef", T_IFDEF, 1},
- { 6, do_xifdef, "ifndef", T_IFNDEF, 1},
- { 7, do_include, "include", T_INCLUDE, 1},
- { 12, do_include, "include_next", T_INCLUDE_NEXT, 1},
- { 6, do_include, "import", T_IMPORT, 1},
- { 5, do_endif, "endif", T_ENDIF, 1},
- { 4, do_else, "else", T_ELSE, 1},
- { 2, do_if, "if", T_IF, 1},
- { 4, do_elif, "elif", T_ELIF, 1},
- { 5, do_undef, "undef", T_UNDEF},
- { 5, do_error, "error", T_ERROR},
- { 7, do_warning, "warning", T_WARNING},
- { 6, do_pragma, "pragma", T_PRAGMA, 0, 0, 1},
- { 4, do_line, "line", T_LINE, 1},
- { 5, do_ident, "ident", T_IDENT, 1, 0, 1},
-#ifdef SCCS_DIRECTIVE
- { 4, do_sccs, "sccs", T_SCCS},
-#endif
- { 6, do_assert, "assert", T_ASSERT, 1},
- { 8, do_unassert, "unassert", T_UNASSERT, 1},
- { -1, 0, "", T_UNUSED},
-};
-
-/* table to tell if char can be part of a C identifier. */
-U_CHAR is_idchar[256];
-/* table to tell if char can be first char of a c identifier. */
-U_CHAR is_idstart[256];
-/* table to tell if c is horizontal space. */
-U_CHAR is_hor_space[256];
-/* table to tell if c is horizontal or vertical space. */
-static U_CHAR is_space[256];
-
-/* Initialize syntactic classifications of characters. */
-
-static void
-initialize_char_syntax (opts)
- struct cpp_options *opts;
-{
- register int i;
-
- /*
- * Set up is_idchar and is_idstart tables. These should be
- * faster than saying (is_alpha (c) || c == '_'), etc.
- * Set up these things before calling any routines tthat
- * refer to them.
- */
- for (i = 'a'; i <= 'z'; i++) {
- is_idchar[i - 'a' + 'A'] = 1;
- is_idchar[i] = 1;
- is_idstart[i - 'a' + 'A'] = 1;
- is_idstart[i] = 1;
- }
- for (i = '0'; i <= '9'; i++)
- is_idchar[i] = 1;
- is_idchar['_'] = 1;
- is_idstart['_'] = 1;
- is_idchar['$'] = opts->dollars_in_ident;
- is_idstart['$'] = opts->dollars_in_ident;
-
- /* horizontal space table */
- is_hor_space[' '] = 1;
- is_hor_space['\t'] = 1;
- is_hor_space['\v'] = 1;
- is_hor_space['\f'] = 1;
- is_hor_space['\r'] = 1;
-
- is_space[' '] = 1;
- is_space['\t'] = 1;
- is_space['\v'] = 1;
- is_space['\f'] = 1;
- is_space['\n'] = 1;
- is_space['\r'] = 1;
-}
-
-
-/* Place into PFILE a quoted string representing the string SRC.
- Caller must reserve enough space in pfile->token_buffer. */
-
-static void
-quote_string (pfile, src)
- cpp_reader *pfile;
- char *src;
-{
- U_CHAR c;
-
- CPP_PUTC_Q (pfile, '\"');
- for (;;)
- switch ((c = *src++))
- {
- default:
- if (isprint (c))
- CPP_PUTC_Q (pfile, c);
- else
- {
- sprintf (CPP_PWRITTEN (pfile), "\\%03o", c);
- CPP_ADJUST_WRITTEN (pfile, 4);
- }
- break;
-
- case '\"':
- case '\\':
- CPP_PUTC_Q (pfile, '\\');
- CPP_PUTC_Q (pfile, c);
- break;
-
- case '\0':
- CPP_PUTC_Q (pfile, '\"');
- CPP_NUL_TERMINATE_Q (pfile);
- return;
- }
-}
-
-/* Re-allocates PFILE->token_buffer so it will hold at least N more chars. */
-
-void
-cpp_grow_buffer (pfile, n)
- cpp_reader *pfile;
- long n;
-{
- long old_written = CPP_WRITTEN (pfile);
- pfile->token_buffer_size = n + 2 * pfile->token_buffer_size;
- pfile->token_buffer = (U_CHAR *)
- xrealloc(pfile->token_buffer, pfile->token_buffer_size);
- CPP_SET_WRITTEN (pfile, old_written);
-}
-
-
-/*
- * process a given definition string, for initialization
- * If STR is just an identifier, define it with value 1.
- * If STR has anything after the identifier, then it should
- * be identifier=definition.
- */
-
-void
-cpp_define (pfile, str)
- cpp_reader *pfile;
- U_CHAR *str;
-{
- U_CHAR *buf, *p;
-
- buf = str;
- p = str;
- if (!is_idstart[*p])
- {
- cpp_error (pfile, "malformed option `-D %s'", str);
- return;
- }
- while (is_idchar[*++p])
- ;
- if (*p == 0)
- {
- buf = (U_CHAR *) alloca (p - buf + 4);
- strcpy ((char *)buf, str);
- strcat ((char *)buf, " 1");
- }
- else if (*p != '=')
- {
- cpp_error (pfile, "malformed option `-D %s'", str);
- return;
- }
- else
- {
- U_CHAR *q;
- /* Copy the entire option so we can modify it. */
- buf = (U_CHAR *) alloca (2 * strlen (str) + 1);
- strncpy (buf, str, p - str);
- /* Change the = to a space. */
- buf[p - str] = ' ';
- /* Scan for any backslash-newline and remove it. */
- p++;
- q = &buf[p - str];
- while (*p)
- {
- if (*p == '\\' && p[1] == '\n')
- p += 2;
- else
- *q++ = *p++;
- }
- *q = 0;
- }
-
- do_define (pfile, NULL, buf, buf + strlen (buf));
-}
-
-/* Process the string STR as if it appeared as the body of a #assert.
- OPTION is the option name for which STR was the argument. */
-
-static void
-make_assertion (pfile, option, str)
- cpp_reader *pfile;
- char *option;
- U_CHAR *str;
-{
- struct directive *kt;
- U_CHAR *buf, *p, *q;
-
- /* Copy the entire option so we can modify it. */
- buf = (U_CHAR *) alloca (strlen (str) + 1);
- strcpy ((char *) buf, str);
- /* Scan for any backslash-newline and remove it. */
- p = q = buf;
- while (*p) {
-#if 0
- if (*p == '\\' && p[1] == '\n')
- p += 2;
- else
-#endif
- *q++ = *p++;
- }
- *q = 0;
-
- p = buf;
- if (!is_idstart[*p]) {
- cpp_error (pfile, "malformed option `%s %s'", option, str);
- return;
- }
- while (is_idchar[*++p])
- ;
- while (*p == ' ' || *p == '\t') p++;
- if (! (*p == 0 || *p == '(')) {
- cpp_error (pfile, "malformed option `%s %s'", option, str);
- return;
- }
-
- if (cpp_push_buffer (pfile, buf, strlen (buf)) != NULL)
- {
- do_assert (pfile, NULL, NULL, NULL);
- cpp_pop_buffer (pfile);
- }
-}
-
-/* Append a chain of `struct file_name_list's
- to the end of the main include chain.
- FIRST is the beginning of the chain to append, and LAST is the end. */
-
-static void
-append_include_chain (pfile, first, last)
- cpp_reader *pfile;
- struct file_name_list *first, *last;
-{
- struct cpp_options *opts = CPP_OPTIONS (pfile);
- struct file_name_list *dir;
-
- if (!first || !last)
- return;
-
- if (opts->include == 0)
- opts->include = first;
- else
- opts->last_include->next = first;
-
- if (opts->first_bracket_include == 0)
- opts->first_bracket_include = first;
-
- for (dir = first; ; dir = dir->next) {
- int len = strlen (dir->fname) + INCLUDE_LEN_FUDGE;
- if (len > pfile->max_include_len)
- pfile->max_include_len = len;
- if (dir == last)
- break;
- }
-
- last->next = NULL;
- opts->last_include = last;
-}
-
-/* Add output to `deps_buffer' for the -M switch.
- STRING points to the text to be output.
- SPACER is ':' for targets, ' ' for dependencies, zero for text
- to be inserted literally. */
-
-static void
-deps_output (pfile, string, spacer)
- cpp_reader *pfile;
- char *string;
- int spacer;
-{
- int size = strlen (string);
-
- if (size == 0)
- return;
-
-#ifndef MAX_OUTPUT_COLUMNS
-#define MAX_OUTPUT_COLUMNS 72
-#endif
- if (spacer
- && pfile->deps_column > 0
- && (pfile->deps_column + size) > MAX_OUTPUT_COLUMNS)
- {
- deps_output (pfile, " \\\n ", 0);
- pfile->deps_column = 0;
- }
-
- if (pfile->deps_size + size + 8 > pfile->deps_allocated_size)
- {
- pfile->deps_allocated_size = (pfile->deps_size + size + 50) * 2;
- pfile->deps_buffer = (char *) xrealloc (pfile->deps_buffer,
- pfile->deps_allocated_size);
- }
- if (spacer == ' ' && pfile->deps_column > 0)
- pfile->deps_buffer[pfile->deps_size++] = ' ';
- bcopy (string, &pfile->deps_buffer[pfile->deps_size], size);
- pfile->deps_size += size;
- pfile->deps_column += size;
- if (spacer == ':')
- pfile->deps_buffer[pfile->deps_size++] = ':';
- pfile->deps_buffer[pfile->deps_size] = 0;
-}
-
-/* Given a colon-separated list of file names PATH,
- add all the names to the search path for include files. */
-
-static void
-path_include (pfile, path)
- cpp_reader *pfile;
- char *path;
-{
- char *p;
-
- p = path;
-
- if (*p)
- while (1) {
- char *q = p;
- char *name;
- struct file_name_list *dirtmp;
-
- /* Find the end of this name. */
- while (*q != 0 && *q != PATH_SEPARATOR) q++;
- if (p == q) {
- /* An empty name in the path stands for the current directory. */
- name = (char *) xmalloc (2);
- name[0] = '.';
- name[1] = 0;
- } else {
- /* Otherwise use the directory that is named. */
- name = (char *) xmalloc (q - p + 1);
- bcopy (p, name, q - p);
- name[q - p] = 0;
- }
-
- dirtmp = (struct file_name_list *)
- xmalloc (sizeof (struct file_name_list));
- dirtmp->next = 0; /* New one goes on the end */
- dirtmp->control_macro = 0;
- dirtmp->c_system_include_path = 0;
- dirtmp->fname = name;
- dirtmp->got_name_map = 0;
- append_include_chain (pfile, dirtmp, dirtmp);
-
- /* Advance past this name. */
- p = q;
- if (*p == 0)
- break;
- /* Skip the colon. */
- p++;
- }
-}
-
-void
-cpp_options_init (opts)
- cpp_options *opts;
-{
- bzero ((char *) opts, sizeof *opts);
- opts->in_fname = NULL;
- opts->out_fname = NULL;
-
- /* Initialize is_idchar to allow $. */
- opts->dollars_in_ident = 1;
- initialize_char_syntax (opts);
-
- opts->no_line_commands = 0;
- opts->no_trigraphs = 1;
- opts->put_out_comments = 0;
- opts->print_include_names = 0;
- opts->dump_macros = dump_none;
- opts->no_output = 0;
- opts->cplusplus = 0;
- opts->cplusplus_comments = 0;
-
- opts->verbose = 0;
- opts->objc = 0;
- opts->lang_asm = 0;
- opts->for_lint = 0;
- opts->chill = 0;
- opts->pedantic_errors = 0;
- opts->inhibit_warnings = 0;
- opts->warn_comments = 0;
- opts->warn_import = 1;
- opts->warnings_are_errors = 0;
-}
-
-enum cpp_token
-null_underflow (pfile)
- cpp_reader *pfile;
-{
- return CPP_EOF;
-}
-
-int
-null_cleanup (pbuf, pfile)
- cpp_buffer *pbuf;
- cpp_reader *pfile;
-{
- return 0;
-}
-
-int
-macro_cleanup (pbuf, pfile)
- cpp_buffer *pbuf;
- cpp_reader *pfile;
-{
- HASHNODE *macro = (HASHNODE *) pbuf->data;
- if (macro->type == T_DISABLED)
- macro->type = T_MACRO;
- if (macro->type != T_MACRO || pbuf->buf != macro->value.defn->expansion)
- free (pbuf->buf);
- return 0;
-}
-
-int
-file_cleanup (pbuf, pfile)
- cpp_buffer *pbuf;
- cpp_reader *pfile;
-{
- if (pbuf->buf)
- {
- free (pbuf->buf);
- pbuf->buf = 0;
- }
- return 0;
-}
-
-/* Assuming we have read '/'.
- If this is the start of a comment (followed by '*' or '/'),
- skip to the end of the comment, and return ' '.
- Return EOF if we reached the end of file before the end of the comment.
- If not the start of a comment, return '/'. */
-
-static int
-skip_comment (pfile, linep)
- cpp_reader *pfile;
- long *linep;
-{
- int c = 0;
- while (PEEKC() == '\\' && PEEKN(1) == '\n')
- {
- if (linep)
- (*linep)++;
- FORWARD(2);
- }
- if (PEEKC() == '*')
- {
- FORWARD(1);
- for (;;)
- {
- int prev_c = c;
- c = GETC ();
- if (c == EOF)
- return EOF;
- while (c == '\\' && PEEKC() == '\n')
- {
- if (linep)
- (*linep)++;
- FORWARD(1), c = GETC();
- }
- if (prev_c == '*' && c == '/')
- return ' ';
- if (c == '\n' && linep)
- (*linep)++;
- }
- }
- else if (PEEKC() == '/' && CPP_OPTIONS (pfile)->cplusplus_comments)
- {
- FORWARD(1);
- for (;;)
- {
- c = GETC ();
- if (c == EOF)
- return ' '; /* Allow // to be terminated by EOF. */
- while (c == '\\' && PEEKC() == '\n')
- {
- FORWARD(1);
- c = GETC();
- if (linep)
- (*linep)++;
- }
- if (c == '\n')
- {
- /* Don't consider final '\n' to be part of comment. */
- FORWARD(-1);
- return ' ';
- }
- }
- }
- else
- return '/';
-}
-
-/* Skip whitespace \-newline and comments. Does not macro-expand. */
-
-void
-cpp_skip_hspace (pfile)
- cpp_reader *pfile;
-{
- while (1)
- {
- int c = PEEKC();
- if (c == EOF)
- return; /* FIXME */
- if (is_hor_space[c])
- {
- if ((c == '\f' || c == '\v') && CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "%s in preprocessing directive",
- c == '\f' ? "formfeed" : "vertical tab");
- FORWARD(1);
- }
- else if (c == '/')
- {
- FORWARD (1);
- c = skip_comment (pfile, NULL);
- if (c == '/')
- FORWARD(-1);
- if (c == EOF || c == '/')
- return;
- }
- else if (c == '\\' && PEEKN(1) == '\n') {
- FORWARD(2);
- }
- else if (c == '@' && CPP_BUFFER (pfile)->has_escapes
- && is_hor_space[PEEKN(1)])
- FORWARD(2);
- else return;
- }
-}
-
-/* Read the rest of the current line.
- The line is appended to PFILE's output buffer. */
-
-static void
-copy_rest_of_line (pfile)
- cpp_reader *pfile;
-{
- struct cpp_options *opts = CPP_OPTIONS (pfile);
- for (;;)
- {
- int c = GETC();
- int nextc;
- switch (c)
- {
- case EOF:
- goto end_directive;
- case '\\':
- if (PEEKC() == '\n')
- {
- FORWARD (1);
- continue;
- }
- case '\'':
- case '\"':
- goto scan_directive_token;
- break;
- case '/':
- nextc = PEEKC();
- if (nextc == '*' || (opts->cplusplus_comments && nextc == '*'))
- goto scan_directive_token;
- break;
- case '\f':
- case '\v':
- if (CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "%s in preprocessing directive",
- c == '\f' ? "formfeed" : "vertical tab");
- break;
-
- case '\n':
- FORWARD(-1);
- goto end_directive;
- scan_directive_token:
- FORWARD(-1);
- cpp_get_token (pfile);
- continue;
- }
- CPP_PUTC (pfile, c);
- }
- end_directive: ;
- CPP_NUL_TERMINATE (pfile);
-}
-
-void
-skip_rest_of_line (pfile)
- cpp_reader *pfile;
-{
- long old = CPP_WRITTEN (pfile);
- copy_rest_of_line (pfile);
- CPP_SET_WRITTEN (pfile, old);
-}
-
-/* Handle a possible # directive.
- '#' has already been read. */
-
-int
-handle_directive (pfile)
- cpp_reader *pfile;
-{ int c;
- register struct directive *kt;
- int ident_length;
- long after_ident;
- U_CHAR *ident, *line_end;
- long old_written = CPP_WRITTEN (pfile);
-
- cpp_skip_hspace (pfile);
-
- c = PEEKC ();
- if (c >= '0' && c <= '9')
- {
- /* Handle # followed by a line number. */
- if (CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "`#' followed by integer");
- do_line (pfile, NULL);
- goto done_a_directive;
- }
-
- /* Now find the directive name. */
- CPP_PUTC (pfile, '#');
- parse_name (pfile, GETC());
- ident = pfile->token_buffer + old_written + 1;
- ident_length = CPP_PWRITTEN (pfile) - ident;
- if (ident_length == 0 && PEEKC() == '\n')
- {
- /* A line of just `#' becomes blank. */
- goto done_a_directive;
- }
-
-#if 0
- if (ident_length == 0 || !is_idstart[*ident]) {
- U_CHAR *p = ident;
- while (is_idchar[*p]) {
- if (*p < '0' || *p > '9')
- break;
- p++;
- }
- /* Avoid error for `###' and similar cases unless -pedantic. */
- if (p == ident) {
- while (*p == '#' || is_hor_space[*p]) p++;
- if (*p == '\n') {
- if (pedantic && !lang_asm)
- cpp_warning (pfile, "invalid preprocessor directive");
- return 0;
- }
- }
-
- if (!lang_asm)
- cpp_error (pfile, "invalid preprocessor directive name");
-
- return 0;
- }
-#endif
- /*
- * Decode the keyword and call the appropriate expansion
- * routine, after moving the input pointer up to the next line.
- */
- for (kt = directive_table; ; kt++) {
- if (kt->length <= 0)
- goto not_a_directive;
- if (kt->length == ident_length && !strncmp (kt->name, ident, ident_length))
- break;
- }
-
- if (kt->command_reads_line)
- after_ident = 0;
- else
- {
- /* Nonzero means do not delete comments within the directive.
- #define needs this when -traditional. */
- int comments = CPP_TRADITIONAL (pfile) && kt->traditional_comments;
- int save_put_out_comments = CPP_OPTIONS (pfile)->put_out_comments;
- CPP_OPTIONS (pfile)->put_out_comments = comments;
- after_ident = CPP_WRITTEN (pfile);
- copy_rest_of_line (pfile);
- CPP_OPTIONS (pfile)->put_out_comments = save_put_out_comments;
- }
-
- /* For #pragma and #define, we may want to pass through the directive.
- Other directives may create output, but we don't want the directive
- itself out, so we pop it now. For example #include may write a #line
- command (see comment in do_include), and conditionals may emit
- #failed ... #endfailed stuff. But note that popping the buffer
- means the parameters to kt->func may point after pfile->limit
- so these parameters are invalid as soon as something gets appended
- to the token_buffer. */
-
- line_end = CPP_PWRITTEN (pfile);
- if (!kt->pass_thru && kt->type != T_DEFINE)
- CPP_SET_WRITTEN (pfile, old_written);
-
- (*kt->func) (pfile, kt, pfile->token_buffer + after_ident, line_end);
- if (kt->pass_thru
- || (kt->type == T_DEFINE
- && CPP_OPTIONS (pfile)->dump_macros == dump_definitions))
- {
- /* Just leave the entire #define in the output stack. */
- }
- else if (kt->type == T_DEFINE
- && CPP_OPTIONS (pfile)->dump_macros == dump_names)
- {
- U_CHAR *p = pfile->token_buffer + old_written + 7; /* Skip "#define". */
- SKIP_WHITE_SPACE (p);
- while (is_idchar[*p]) p++;
- pfile->limit = p;
- CPP_PUTC (pfile, '\n');
- }
- else if (kt->type == T_DEFINE)
- CPP_SET_WRITTEN (pfile, old_written);
- done_a_directive:
- return 1;
-
- not_a_directive:
- return 0;
-}
-
-/* Pass a directive through to the output file.
- BUF points to the contents of the directive, as a contiguous string.
- LIMIT points to the first character past the end of the directive.
- KEYWORD is the keyword-table entry for the directive. */
-
-static void
-pass_thru_directive (buf, limit, pfile, keyword)
- U_CHAR *buf, *limit;
- cpp_reader *pfile;
- struct directive *keyword;
-{
- register unsigned keyword_length = keyword->length;
-
- CPP_RESERVE (pfile, 1 + keyword_length + (limit - buf));
- CPP_PUTC_Q (pfile, '#');
- CPP_PUTS_Q (pfile, keyword->name, keyword_length);
- if (limit != buf && buf[0] != ' ')
- CPP_PUTC_Q (pfile, ' ');
- CPP_PUTS_Q (pfile, buf, limit - buf);
-#if 0
- CPP_PUTS_Q (pfile, '\n');
- /* Count the line we have just made in the output,
- to get in sync properly. */
- pfile->lineno++;
-#endif
-}
-
-/* The arglist structure is built by do_define to tell
- collect_definition where the argument names begin. That
- is, for a define like "#define f(x,y,z) foo+x-bar*y", the arglist
- would contain pointers to the strings x, y, and z.
- Collect_definition would then build a DEFINITION node,
- with reflist nodes pointing to the places x, y, and z had
- appeared. So the arglist is just convenience data passed
- between these two routines. It is not kept around after
- the current #define has been processed and entered into the
- hash table. */
-
-struct arglist {
- struct arglist *next;
- U_CHAR *name;
- int length;
- int argno;
- char rest_args;
-};
-
-/* Read a replacement list for a macro with parameters.
- Build the DEFINITION structure.
- Reads characters of text starting at BUF until END.
- ARGLIST specifies the formal parameters to look for
- in the text of the definition; NARGS is the number of args
- in that list, or -1 for a macro name that wants no argument list.
- MACRONAME is the macro name itself (so we can avoid recursive expansion)
- and NAMELEN is its length in characters.
-
- Note that comments, backslash-newlines, and leading white space
- have already been deleted from the argument. */
-
-static DEFINITION *
-collect_expansion (pfile, buf, limit, nargs, arglist)
- cpp_reader *pfile;
- U_CHAR *buf, *limit;
- int nargs;
- struct arglist *arglist;
-{
- DEFINITION *defn;
- register U_CHAR *p, *lastp, *exp_p;
- struct reflist *endpat = NULL;
- /* Pointer to first nonspace after last ## seen. */
- U_CHAR *concat = 0;
- /* Pointer to first nonspace after last single-# seen. */
- U_CHAR *stringify = 0;
- int maxsize;
- int expected_delimiter = '\0';
-
- /* Scan thru the replacement list, ignoring comments and quoted
- strings, picking up on the macro calls. It does a linear search
- thru the arg list on every potential symbol. Profiling might say
- that something smarter should happen. */
-
- if (limit < buf)
- abort ();
-
- /* Find the beginning of the trailing whitespace. */
- p = buf;
- while (p < limit && is_space[limit[-1]]) limit--;
-
- /* Allocate space for the text in the macro definition.
- Leading and trailing whitespace chars need 2 bytes each.
- Each other input char may or may not need 1 byte,
- so this is an upper bound. The extra 5 are for invented
- leading and trailing newline-marker and final null. */
- maxsize = (sizeof (DEFINITION)
- + (limit - p) + 5);
- /* Occurrences of '@' get doubled, so allocate extra space for them. */
- while (p < limit)
- if (*p++ == '@')
- maxsize++;
- defn = (DEFINITION *) xcalloc (1, maxsize);
-
- defn->nargs = nargs;
- exp_p = defn->expansion = (U_CHAR *) defn + sizeof (DEFINITION);
- lastp = exp_p;
-
- p = buf;
-
- /* Add one initial space escape-marker to prevent accidental
- token-pasting (often removed by macroexpand). */
- *exp_p++ = '@';
- *exp_p++ = ' ';
-
- if (limit - p >= 2 && p[0] == '#' && p[1] == '#') {
- cpp_error (pfile, "`##' at start of macro definition");
- p += 2;
- }
-
- /* Process the main body of the definition. */
- while (p < limit) {
- int skipped_arg = 0;
- register U_CHAR c = *p++;
-
- *exp_p++ = c;
-
- if (!CPP_TRADITIONAL (pfile)) {
- switch (c) {
- case '\'':
- case '\"':
- if (expected_delimiter != '\0') {
- if (c == expected_delimiter)
- expected_delimiter = '\0';
- } else
- expected_delimiter = c;
- break;
-
- case '\\':
- if (p < limit && expected_delimiter) {
- /* In a string, backslash goes through
- and makes next char ordinary. */
- *exp_p++ = *p++;
- }
- break;
-
- case '@':
- /* An '@' in a string or character constant stands for itself,
- and does not need to be escaped. */
- if (!expected_delimiter)
- *exp_p++ = c;
- break;
-
- case '#':
- /* # is ordinary inside a string. */
- if (expected_delimiter)
- break;
- if (p < limit && *p == '#') {
- /* ##: concatenate preceding and following tokens. */
- /* Take out the first #, discard preceding whitespace. */
- exp_p--;
- while (exp_p > lastp && is_hor_space[exp_p[-1]])
- --exp_p;
- /* Skip the second #. */
- p++;
- /* Discard following whitespace. */
- SKIP_WHITE_SPACE (p);
- concat = p;
- if (p == limit)
- cpp_error (pfile, "`##' at end of macro definition");
- } else if (nargs >= 0) {
- /* Single #: stringify following argument ref.
- Don't leave the # in the expansion. */
- exp_p--;
- SKIP_WHITE_SPACE (p);
- if (p == limit || ! is_idstart[*p]
- || (*p == 'L' && p + 1 < limit && (p[1] == '\'' || p[1] == '"')))
- cpp_error (pfile,
- "`#' operator is not followed by a macro argument name");
- else
- stringify = p;
- }
- break;
- }
- } else {
- /* In -traditional mode, recognize arguments inside strings and
- and character constants, and ignore special properties of #.
- Arguments inside strings are considered "stringified", but no
- extra quote marks are supplied. */
- switch (c) {
- case '\'':
- case '\"':
- if (expected_delimiter != '\0') {
- if (c == expected_delimiter)
- expected_delimiter = '\0';
- } else
- expected_delimiter = c;
- break;
-
- case '\\':
- /* Backslash quotes delimiters and itself, but not macro args. */
- if (expected_delimiter != 0 && p < limit
- && (*p == expected_delimiter || *p == '\\')) {
- *exp_p++ = *p++;
- continue;
- }
- break;
-
- case '/':
- if (expected_delimiter != '\0') /* No comments inside strings. */
- break;
- if (*p == '*') {
- /* If we find a comment that wasn't removed by handle_directive,
- this must be -traditional. So replace the comment with
- nothing at all. */
- exp_p--;
- p += 1;
- while (p < limit && !(p[-2] == '*' && p[-1] == '/'))
- p++;
-#if 0
- /* Mark this as a concatenation-point, as if it had been ##. */
- concat = p;
-#endif
- }
- break;
- }
- }
-
- /* Handle the start of a symbol. */
- if (is_idchar[c] && nargs > 0) {
- U_CHAR *id_beg = p - 1;
- int id_len;
-
- --exp_p;
- while (p != limit && is_idchar[*p]) p++;
- id_len = p - id_beg;
-
- if (is_idstart[c]
- && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '"'))) {
- register struct arglist *arg;
-
- for (arg = arglist; arg != NULL; arg = arg->next) {
- struct reflist *tpat;
-
- if (arg->name[0] == c
- && arg->length == id_len
- && strncmp (arg->name, id_beg, id_len) == 0) {
- if (expected_delimiter && CPP_OPTIONS (pfile)->warn_stringify) {
- if (CPP_TRADITIONAL (pfile)) {
- cpp_warning (pfile, "macro argument `%.*s' is stringified.",
- id_len, arg->name);
- } else {
- cpp_warning (pfile,
- "macro arg `%.*s' would be stringified with -traditional.",
- id_len, arg->name);
- }
- }
- /* If ANSI, don't actually substitute inside a string. */
- if (!CPP_TRADITIONAL (pfile) && expected_delimiter)
- break;
- /* make a pat node for this arg and append it to the end of
- the pat list */
- tpat = (struct reflist *) xmalloc (sizeof (struct reflist));
- tpat->next = NULL;
- tpat->raw_before = concat == id_beg;
- tpat->raw_after = 0;
- tpat->rest_args = arg->rest_args;
- tpat->stringify = (CPP_TRADITIONAL (pfile)
- ? expected_delimiter != '\0'
- : stringify == id_beg);
-
- if (endpat == NULL)
- defn->pattern = tpat;
- else
- endpat->next = tpat;
- endpat = tpat;
-
- tpat->argno = arg->argno;
- tpat->nchars = exp_p - lastp;
- {
- register U_CHAR *p1 = p;
- SKIP_WHITE_SPACE (p1);
- if (p1 + 2 <= limit && p1[0] == '#' && p1[1] == '#')
- tpat->raw_after = 1;
- }
- lastp = exp_p; /* place to start copying from next time */
- skipped_arg = 1;
- break;
- }
- }
- }
-
- /* If this was not a macro arg, copy it into the expansion. */
- if (! skipped_arg) {
- register U_CHAR *lim1 = p;
- p = id_beg;
- while (p != lim1)
- *exp_p++ = *p++;
- if (stringify == id_beg)
- cpp_error (pfile,
- "`#' operator should be followed by a macro argument name");
- }
- }
- }
-
- if (!CPP_TRADITIONAL (pfile) && expected_delimiter == 0)
- {
- /* If ANSI, put in a "@ " marker to prevent token pasting.
- But not if "inside a string" (which in ANSI mode
- happens only for -D option). */
- *exp_p++ = '@';
- *exp_p++ = ' ';
- }
-
- *exp_p = '\0';
-
- defn->length = exp_p - defn->expansion;
-
- /* Crash now if we overrun the allocated size. */
- if (defn->length + 1 > maxsize)
- abort ();
-
-#if 0
-/* This isn't worth the time it takes. */
- /* give back excess storage */
- defn->expansion = (U_CHAR *) xrealloc (defn->expansion, defn->length + 1);
-#endif
-
- return defn;
-}
-
-/*
- * special extension string that can be added to the last macro argument to
- * allow it to absorb the "rest" of the arguments when expanded. Ex:
- * #define wow(a, b...) process (b, a, b)
- * { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); }
- * { wow (one, two); } -> { process (two, one, two); }
- * if this "rest_arg" is used with the concat token '##' and if it is not
- * supplied then the token attached to with ## will not be outputted. Ex:
- * #define wow (a, b...) process (b ## , a, ## b)
- * { wow (1, 2); } -> { process (2, 1, 2); }
- * { wow (one); } -> { process (one); {
- */
-static char rest_extension[] = "...";
-#define REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1)
-
-/* Create a DEFINITION node from a #define directive. Arguments are
- as for do_define. */
-
-static MACRODEF
-create_definition (buf, limit, pfile, predefinition)
- U_CHAR *buf, *limit;
- cpp_reader *pfile;
- int predefinition;
-{
- U_CHAR *bp; /* temp ptr into input buffer */
- U_CHAR *symname; /* remember where symbol name starts */
- int sym_length; /* and how long it is */
- int rest_args = 0;
- long line, col;
- char *file = CPP_BUFFER (pfile) ? CPP_BUFFER (pfile)->nominal_fname : "";
- DEFINITION *defn;
- int arglengths = 0; /* Accumulate lengths of arg names
- plus number of args. */
- MACRODEF mdef;
- cpp_buf_line_and_col (CPP_BUFFER (pfile), &line, &col);
-
- bp = buf;
-
- while (is_hor_space[*bp])
- bp++;
-
- symname = bp; /* remember where it starts */
-
- sym_length = check_macro_name (pfile, bp, "macro");
- bp += sym_length;
-
- /* Lossage will occur if identifiers or control keywords are broken
- across lines using backslash. This is not the right place to take
- care of that. */
-
- if (*bp == '(') {
- struct arglist *arg_ptrs = NULL;
- int argno = 0;
-
- bp++; /* skip '(' */
- SKIP_WHITE_SPACE (bp);
-
- /* Loop over macro argument names. */
- while (*bp != ')') {
- struct arglist *temp;
-
- temp = (struct arglist *) alloca (sizeof (struct arglist));
- temp->name = bp;
- temp->next = arg_ptrs;
- temp->argno = argno++;
- temp->rest_args = 0;
- arg_ptrs = temp;
-
- if (rest_args)
- cpp_pedwarn (pfile, "another parameter follows `%s'", rest_extension);
-
- if (!is_idstart[*bp])
- cpp_pedwarn (pfile, "invalid character in macro parameter name");
-
- /* Find the end of the arg name. */
- while (is_idchar[*bp]) {
- bp++;
- /* do we have a "special" rest-args extension here? */
- if (limit - bp > REST_EXTENSION_LENGTH &&
- strncmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) {
- rest_args = 1;
- temp->rest_args = 1;
- break;
- }
- }
- temp->length = bp - temp->name;
- if (rest_args == 1)
- bp += REST_EXTENSION_LENGTH;
- arglengths += temp->length + 2;
- SKIP_WHITE_SPACE (bp);
- if (temp->length == 0 || (*bp != ',' && *bp != ')')) {
- cpp_error (pfile, "badly punctuated parameter list in `#define'");
- goto nope;
- }
- if (*bp == ',') {
- bp++;
- SKIP_WHITE_SPACE (bp);
- }
- if (bp >= limit) {
- cpp_error (pfile, "unterminated parameter list in `#define'");
- goto nope;
- }
- {
- struct arglist *otemp;
-
- for (otemp = temp->next; otemp != NULL; otemp = otemp->next)
- if (temp->length == otemp->length &&
- strncmp (temp->name, otemp->name, temp->length) == 0) {
- U_CHAR *name;
-
- name = (U_CHAR *) alloca (temp->length + 1);
- (void) strncpy (name, temp->name, temp->length);
- name[temp->length] = '\0';
- cpp_error (pfile,
- "duplicate argument name `%s' in `#define'", name);
- goto nope;
- }
- }
- }
-
- ++bp; /* skip paren */
- SKIP_WHITE_SPACE (bp);
- /* now everything from bp before limit is the definition. */
- defn = collect_expansion (pfile, bp, limit, argno, arg_ptrs);
- defn->rest_args = rest_args;
-
- /* Now set defn->args.argnames to the result of concatenating
- the argument names in reverse order
- with comma-space between them. */
- defn->args.argnames = (U_CHAR *) xmalloc (arglengths + 1);
- {
- struct arglist *temp;
- int i = 0;
- for (temp = arg_ptrs; temp; temp = temp->next) {
- bcopy (temp->name, &defn->args.argnames[i], temp->length);
- i += temp->length;
- if (temp->next != 0) {
- defn->args.argnames[i++] = ',';
- defn->args.argnames[i++] = ' ';
- }
- }
- defn->args.argnames[i] = 0;
- }
- } else {
- /* Simple expansion or empty definition. */
-
- if (bp < limit)
- {
- if (is_hor_space[*bp]) {
- bp++;
- SKIP_WHITE_SPACE (bp);
- } else {
- switch (*bp) {
- case '!': case '"': case '#': case '%': case '&': case '\'':
- case ')': case '*': case '+': case ',': case '-': case '.':
- case '/': case ':': case ';': case '<': case '=': case '>':
- case '?': case '[': case '\\': case ']': case '^': case '{':
- case '|': case '}': case '~':
- cpp_warning (pfile, "missing white space after `#define %.*s'",
- sym_length, symname);
- break;
-
- default:
- cpp_pedwarn (pfile, "missing white space after `#define %.*s'",
- sym_length, symname);
- break;
- }
- }
- }
- /* now everything from bp before limit is the definition. */
- defn = collect_expansion (pfile, bp, limit, -1, NULL_PTR);
- defn->args.argnames = (U_CHAR *) "";
- }
-
- defn->line = line;
- defn->file = file;
-
- /* OP is null if this is a predefinition */
- defn->predefined = predefinition;
- mdef.defn = defn;
- mdef.symnam = symname;
- mdef.symlen = sym_length;
-
- return mdef;
-
- nope:
- mdef.defn = 0;
- return mdef;
-}
-
-/* Check a purported macro name SYMNAME, and yield its length.
- USAGE is the kind of name this is intended for. */
-
-static int
-check_macro_name (pfile, symname, usage)
- cpp_reader *pfile;
- U_CHAR *symname;
- char *usage;
-{
- U_CHAR *p;
- int sym_length;
-
- for (p = symname; is_idchar[*p]; p++)
- ;
- sym_length = p - symname;
- if (sym_length == 0
- || (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '"')))
- cpp_error (pfile, "invalid %s name", usage);
- else if (!is_idstart[*symname]) {
- U_CHAR *msg; /* what pain... */
- msg = (U_CHAR *) alloca (sym_length + 1);
- bcopy (symname, msg, sym_length);
- msg[sym_length] = 0;
- cpp_error (pfile, "invalid %s name `%s'", usage, msg);
- } else {
- if (! strncmp (symname, "defined", 7) && sym_length == 7)
- cpp_error (pfile, "invalid %s name `defined'", usage);
- }
- return sym_length;
-}
-
-/* Return zero if two DEFINITIONs are isomorphic. */
-
-static int
-compare_defs (d1, d2)
- DEFINITION *d1, *d2;
-{
- register struct reflist *a1, *a2;
- register U_CHAR *p1 = d1->expansion;
- register U_CHAR *p2 = d2->expansion;
- int first = 1;
-
- if (d1->nargs != d2->nargs)
- return 1;
- if (strcmp ((char *)d1->args.argnames, (char *)d2->args.argnames))
- return 1;
- for (a1 = d1->pattern, a2 = d2->pattern; a1 && a2;
- a1 = a1->next, a2 = a2->next) {
- if (!((a1->nchars == a2->nchars && ! strncmp (p1, p2, a1->nchars))
- || ! comp_def_part (first, p1, a1->nchars, p2, a2->nchars, 0))
- || a1->argno != a2->argno
- || a1->stringify != a2->stringify
- || a1->raw_before != a2->raw_before
- || a1->raw_after != a2->raw_after)
- return 1;
- first = 0;
- p1 += a1->nchars;
- p2 += a2->nchars;
- }
- if (a1 != a2)
- return 1;
- if (comp_def_part (first, p1, d1->length - (p1 - d1->expansion),
- p2, d2->length - (p2 - d2->expansion), 1))
- return 1;
- return 0;
-}
-
-/* Return 1 if two parts of two macro definitions are effectively different.
- One of the parts starts at BEG1 and has LEN1 chars;
- the other has LEN2 chars at BEG2.
- Any sequence of whitespace matches any other sequence of whitespace.
- FIRST means these parts are the first of a macro definition;
- so ignore leading whitespace entirely.
- LAST means these parts are the last of a macro definition;
- so ignore trailing whitespace entirely. */
-
-static int
-comp_def_part (first, beg1, len1, beg2, len2, last)
- int first;
- U_CHAR *beg1, *beg2;
- int len1, len2;
- int last;
-{
- register U_CHAR *end1 = beg1 + len1;
- register U_CHAR *end2 = beg2 + len2;
- if (first) {
- while (beg1 != end1 && is_space[*beg1]) beg1++;
- while (beg2 != end2 && is_space[*beg2]) beg2++;
- }
- if (last) {
- while (beg1 != end1 && is_space[end1[-1]]) end1--;
- while (beg2 != end2 && is_space[end2[-1]]) end2--;
- }
- while (beg1 != end1 && beg2 != end2) {
- if (is_space[*beg1] && is_space[*beg2]) {
- while (beg1 != end1 && is_space[*beg1]) beg1++;
- while (beg2 != end2 && is_space[*beg2]) beg2++;
- } else if (*beg1 == *beg2) {
- beg1++; beg2++;
- } else break;
- }
- return (beg1 != end1) || (beg2 != end2);
-}
-
-/* Process a #define command.
-BUF points to the contents of the #define command, as a contiguous string.
-LIMIT points to the first character past the end of the definition.
-KEYWORD is the keyword-table entry for #define,
-or NULL for a "predefined" macro. */
-
-static int
-do_define (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- int hashcode;
- MACRODEF mdef;
- HASHNODE *hp;
-
-#if 0
- /* If this is a precompiler run (with -pcp) pass thru #define commands. */
- if (pcp_outfile && keyword)
- pass_thru_directive (buf, limit, pfile, keyword);
-#endif
-
- mdef = create_definition (buf, limit, pfile, keyword == NULL);
- if (mdef.defn == 0)
- goto nope;
-
- hashcode = hashf (mdef.symnam, mdef.symlen, HASHSIZE);
-
- if ((hp = cpp_lookup (pfile, mdef.symnam, mdef.symlen, hashcode)) != NULL)
- {
- int ok = 0;
- /* Redefining a precompiled key is ok. */
- if (hp->type == T_PCSTRING)
- ok = 1;
- /* Redefining a macro is ok if the definitions are the same. */
- else if (hp->type == T_MACRO)
- ok = ! compare_defs (mdef.defn, hp->value.defn);
- /* Redefining a constant is ok with -D. */
- else if (hp->type == T_CONST)
- ok = ! CPP_OPTIONS (pfile)->done_initializing;
- /* Print the warning if it's not ok. */
- if (!ok)
- {
- U_CHAR *msg; /* what pain... */
-
- /* If we are passing through #define and #undef directives, do
- that for this re-definition now. */
- if (CPP_OPTIONS (pfile)->debug_output && keyword)
- pass_thru_directive (buf, limit, pfile, keyword);
-
- msg = (U_CHAR *) alloca (mdef.symlen + 22);
- *msg = '`';
- bcopy (mdef.symnam, msg + 1, mdef.symlen);
- strcpy ((char *) (msg + mdef.symlen + 1), "' redefined");
- cpp_pedwarn (pfile, msg);
- if (hp->type == T_MACRO)
- cpp_pedwarn_with_file_and_line (pfile, hp->value.defn->file, hp->value.defn->line,
- "this is the location of the previous definition");
- }
- /* Replace the old definition. */
- hp->type = T_MACRO;
- hp->value.defn = mdef.defn;
- }
- else
- {
- /* If we are passing through #define and #undef directives, do
- that for this new definition now. */
- if (CPP_OPTIONS (pfile)->debug_output && keyword)
- pass_thru_directive (buf, limit, pfile, keyword);
- install (mdef.symnam, mdef.symlen, T_MACRO, 0,
- (char *) mdef.defn, hashcode);
- }
-
- return 0;
-
-nope:
-
- return 1;
-}
-
-/* This structure represents one parsed argument in a macro call.
- `raw' points to the argument text as written (`raw_length' is its length).
- `expanded' points to the argument's macro-expansion
- (its length is `expand_length').
- `stringified_length' is the length the argument would have
- if stringified.
- `use_count' is the number of times this macro arg is substituted
- into the macro. If the actual use count exceeds 10,
- the value stored is 10. */
-
-/* raw and expanded are relative to ARG_BASE */
-#define ARG_BASE ((pfile)->token_buffer)
-
-struct argdata {
- /* Strings relative to pfile->token_buffer */
- long raw, expanded, stringified;
- int raw_length, expand_length;
- int stringified_length;
- char newlines;
- char use_count;
-};
-
-/* Allocate a new cpp_buffer for PFILE, and push it on the input buffer stack.
- If BUFFER != NULL, then use the LENGTH characters in BUFFER
- as the new input buffer.
- Return the new buffer, or NULL on failure. */
-
-cpp_buffer *
-cpp_push_buffer (pfile, buffer, length)
- cpp_reader *pfile;
- U_CHAR *buffer;
- long length;
-{
- register cpp_buffer *buf = CPP_BUFFER (pfile);
- if (buf == pfile->buffer_stack)
- {
- cpp_fatal (pfile, "%s: macro or `#include' recursion too deep",
- buf->fname);
- return NULL;
- }
- buf--;
- bzero ((char *) buf, sizeof (cpp_buffer));
- CPP_BUFFER (pfile) = buf;
- buf->if_stack = pfile->if_stack;
- buf->cleanup = null_cleanup;
- buf->underflow = null_underflow;
- buf->buf = buf->cur = buffer;
- buf->alimit = buf->rlimit = buffer + length;
-
- return buf;
-}
-
-cpp_buffer *
-cpp_pop_buffer (pfile)
- cpp_reader *pfile;
-{
- cpp_buffer *buf = CPP_BUFFER (pfile);
- (*buf->cleanup) (buf, pfile);
- return ++CPP_BUFFER (pfile);
-}
-
-/* Scan until CPP_BUFFER (PFILE) is exhausted into PFILE->token_buffer.
- Pop the buffer when done. */
-
-void
-cpp_scan_buffer (pfile)
- cpp_reader *pfile;
-{
- cpp_buffer *buffer = CPP_BUFFER (pfile);
- for (;;)
- {
- enum cpp_token token = cpp_get_token (pfile);
- if (token == CPP_EOF) /* Should not happen ... */
- break;
- if (token == CPP_POP && CPP_BUFFER (pfile) == buffer)
- {
- cpp_pop_buffer (pfile);
- break;
- }
- }
-}
-
-/*
- * Rescan a string (which may have escape marks) into pfile's buffer.
- * Place the result in pfile->token_buffer.
- *
- * The input is copied before it is scanned, so it is safe to pass
- * it something from the token_buffer that will get overwritten
- * (because it follows CPP_WRITTEN). This is used by do_include.
- */
-
-static void
-cpp_expand_to_buffer (pfile, buf, length)
- cpp_reader *pfile;
- U_CHAR *buf;
- int length;
-{
- register cpp_buffer *ip;
- cpp_buffer obuf;
- U_CHAR *limit = buf + length;
- U_CHAR *buf1;
-#if 0
- int odepth = indepth;
-#endif
-
- if (length < 0)
- abort ();
-
- /* Set up the input on the input stack. */
-
- buf1 = (U_CHAR *) alloca (length + 1);
- {
- register U_CHAR *p1 = buf;
- register U_CHAR *p2 = buf1;
-
- while (p1 != limit)
- *p2++ = *p1++;
- }
- buf1[length] = 0;
-
- ip = cpp_push_buffer (pfile, buf1, length);
- if (ip == NULL)
- return;
- ip->has_escapes = 1;
-#if 0
- ip->lineno = obuf.lineno = 1;
-#endif
-
- /* Scan the input, create the output. */
- cpp_scan_buffer (pfile);
-
-#if 0
- if (indepth != odepth)
- abort ();
-#endif
-
- CPP_NUL_TERMINATE (pfile);
-}
-
-
-static void
-adjust_position (buf, limit, linep, colp)
- U_CHAR *buf;
- U_CHAR *limit;
- long *linep;
- long *colp;
-{
- while (buf < limit)
- {
- U_CHAR ch = *buf++;
- if (ch == '\n')
- (*linep)++, (*colp) = 1;
- else
- (*colp)++;
- }
-}
-
-/* Move line_base forward, updating lineno and colno. */
-
-static void
-update_position (pbuf)
- register cpp_buffer *pbuf;
-{
- unsigned char *old_pos = pbuf->buf + pbuf->line_base;
- unsigned char *new_pos = pbuf->cur;
- register struct parse_marker *mark;
- for (mark = pbuf->marks; mark != NULL; mark = mark->next)
- {
- if (pbuf->buf + mark->position < new_pos)
- new_pos = pbuf->buf + mark->position;
- }
- pbuf->line_base += new_pos - old_pos;
- adjust_position (old_pos, new_pos, &pbuf->lineno, &pbuf->colno);
-}
-
-void
-cpp_buf_line_and_col (pbuf, linep, colp)
- register cpp_buffer *pbuf;
- long *linep, *colp;
-{
- long dummy;
- if (colp == NULL)
- colp = &dummy;
- if (pbuf)
- {
- *linep = pbuf->lineno;
- *colp = pbuf->colno;
- adjust_position (pbuf->buf + pbuf->line_base, pbuf->cur, linep, colp);
- }
- else
- {
- *linep = 0;
- *colp = 0;
- }
-}
-
-/* Return the cpp_buffer that corresponds to a file (not a macro). */
-
-cpp_buffer *
-cpp_file_buffer (pfile)
- cpp_reader *pfile;
-{
- cpp_buffer *ip = CPP_BUFFER (pfile);
-
- for ( ; ip != CPP_NULL_BUFFER (pfile); ip = CPP_PREV_BUFFER (ip))
- if (ip->fname != NULL)
- return ip;
- return NULL;
-}
-
-static long
-count_newlines (buf, limit)
- register U_CHAR *buf;
- register U_CHAR *limit;
-{
- register long count = 0;
- while (buf < limit)
- {
- U_CHAR ch = *buf++;
- if (ch == '\n')
- count++;
- }
- return count;
-}
-
-/*
- * write out a #line command, for instance, after an #include file.
- * If CONDITIONAL is nonzero, we can omit the #line if it would
- * appear to be a no-op, and we can output a few newlines instead
- * if we want to increase the line number by a small amount.
- * FILE_CHANGE says whether we are entering a file, leaving, or neither.
- */
-
-static void
-output_line_command (pfile, conditional, file_change)
- cpp_reader *pfile;
- int conditional;
- enum file_change_code file_change;
-{
- int len;
- char *line_cmd_buf, *line_end;
- long line, col;
- cpp_buffer *ip = CPP_BUFFER (pfile);
-
- if (ip->fname == NULL)
- return;
-
- update_position (ip);
-
- if (CPP_OPTIONS (pfile)->no_line_commands
- || CPP_OPTIONS (pfile)->no_output)
- return;
-
- line = CPP_BUFFER (pfile)->lineno;
- col = CPP_BUFFER (pfile)->colno;
- adjust_position (CPP_LINE_BASE (ip), ip->cur, &line, &col);
-
- if (CPP_OPTIONS (pfile)->no_line_commands)
- return;
-
- if (conditional) {
- if (line == pfile->lineno)
- return;
-
- /* If the inherited line number is a little too small,
- output some newlines instead of a #line command. */
- if (line > pfile->lineno && line < pfile->lineno + 8) {
- CPP_RESERVE (pfile, 20);
- while (line > pfile->lineno) {
- CPP_PUTC_Q (pfile, '\n');
- pfile->lineno++;
- }
- return;
- }
- }
-
-#if 0
- /* Don't output a line number of 0 if we can help it. */
- if (ip->lineno == 0 && ip->bufp - ip->buf < ip->length
- && *ip->bufp == '\n') {
- ip->lineno++;
- ip->bufp++;
- }
-#endif
-
- CPP_RESERVE (pfile, 4 * strlen (ip->nominal_fname) + 50);
- {
-#ifdef OUTPUT_LINE_COMMANDS
- static char sharp_line[] = "#line ";
-#else
- static char sharp_line[] = "# ";
-#endif
- CPP_PUTS_Q (pfile, sharp_line, sizeof(sharp_line)-1);
- }
-
- sprintf (CPP_PWRITTEN (pfile), "%d ", line);
- CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile)));
-
- quote_string (pfile, ip->nominal_fname);
- if (file_change != same_file) {
- CPP_PUTC_Q (pfile, ' ');
- CPP_PUTC_Q (pfile, file_change == enter_file ? '1' : '2');
- }
- /* Tell cc1 if following text comes from a system header file. */
- if (ip->system_header_p) {
- CPP_PUTC_Q (pfile, ' ');
- CPP_PUTC_Q (pfile, '3');
- }
-#ifndef NO_IMPLICIT_EXTERN_C
- /* Tell cc1plus if following text should be treated as C. */
- if (ip->system_header_p == 2 && CPP_OPTIONS (pfile)->cplusplus) {
- CPP_PUTC_Q (pfile, ' ');
- CPP_PUTC_Q (pfile, '4');
- }
-#endif
- CPP_PUTC_Q (pfile, '\n');
- pfile->lineno = line;
-}
-
-/*
- * Parse a macro argument and append the info on PFILE's token_buffer.
- * REST_ARGS means to absorb the rest of the args.
- * Return nonzero to indicate a syntax error.
- */
-
-static enum cpp_token
-macarg (pfile, rest_args)
- cpp_reader *pfile;
- int rest_args;
-{
- int paren = 0;
- enum cpp_token token;
- long arg_start = CPP_WRITTEN (pfile);
- char save_put_out_comments = CPP_OPTIONS (pfile)->put_out_comments;
- CPP_OPTIONS (pfile)->put_out_comments = 0;
-
- /* Try to parse as much of the argument as exists at this
- input stack level. */
- pfile->no_macro_expand++;
- for (;;)
- {
- token = cpp_get_token (pfile);
- switch (token)
- {
- case CPP_EOF:
- goto done;
- case CPP_POP:
- /* If we've hit end of file, it's an error (reported by caller).
- Ditto if it's the end of cpp_expand_to_buffer text.
- If we've hit end of macro, just continue. */
- if (! CPP_IS_MACRO_BUFFER (CPP_BUFFER (pfile)))
- goto done;
- break;
- case CPP_LPAREN:
- paren++;
- break;
- case CPP_RPAREN:
- if (--paren < 0)
- goto found;
- break;
- case CPP_COMMA:
- /* if we've returned to lowest level and
- we aren't absorbing all args */
- if (paren == 0 && rest_args == 0)
- goto found;
- break;
- found:
- /* Remove ',' or ')' from argument buffer. */
- CPP_ADJUST_WRITTEN (pfile, -1);
- goto done;
- default: ;
- }
- }
-
- done:
- CPP_OPTIONS (pfile)->put_out_comments = save_put_out_comments;
- pfile->no_macro_expand--;
-
- return token;
-}
-
-/* Turn newlines to spaces in the string of length LENGTH at START,
- except inside of string constants.
- The string is copied into itself with its beginning staying fixed. */
-
-static int
-change_newlines (start, length)
- U_CHAR *start;
- int length;
-{
- register U_CHAR *ibp;
- register U_CHAR *obp;
- register U_CHAR *limit;
- register int c;
-
- ibp = start;
- limit = start + length;
- obp = start;
-
- while (ibp < limit) {
- *obp++ = c = *ibp++;
- switch (c) {
-
- case '\'':
- case '\"':
- /* Notice and skip strings, so that we don't delete newlines in them. */
- {
- int quotec = c;
- while (ibp < limit) {
- *obp++ = c = *ibp++;
- if (c == quotec)
- break;
- if (c == '\n' && quotec == '\'')
- break;
- }
- }
- break;
- }
- }
-
- return obp - start;
-}
-
-
-static struct tm *
-timestamp (pfile)
- cpp_reader *pfile;
-{
- if (!pfile->timebuf) {
- time_t t = time ((time_t *) 0);
- pfile->timebuf = localtime (&t);
- }
- return pfile->timebuf;
-}
-
-static char *monthnames[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
- };
-
-/*
- * expand things like __FILE__. Place the expansion into the output
- * buffer *without* rescanning.
- */
-
-static void
-special_symbol (hp, pfile)
- HASHNODE *hp;
- cpp_reader *pfile;
-{
- char *buf;
- int i, len;
- int true_indepth;
- cpp_buffer *ip = NULL;
- struct tm *timebuf;
-
- int paren = 0; /* For special `defined' keyword */
-
-#if 0
- if (pcp_outfile && pcp_inside_if
- && hp->type != T_SPEC_DEFINED && hp->type != T_CONST)
- cpp_error (pfile,
- "Predefined macro `%s' used inside `#if' during precompilation",
- hp->name);
-#endif
-
- for (ip = CPP_BUFFER (pfile); ; ip = CPP_PREV_BUFFER (ip))
- {
- if (ip == CPP_NULL_BUFFER (pfile))
- {
- cpp_error (pfile, "cccp error: not in any file?!");
- return; /* the show must go on */
- }
- if (ip->fname != NULL)
- break;
- }
-
- switch (hp->type)
- {
- case T_FILE:
- case T_BASE_FILE:
- {
- char *string;
- if (hp->type == T_BASE_FILE)
- {
- while (CPP_PREV_BUFFER (ip) != CPP_NULL_BUFFER (pfile))
- ip = CPP_PREV_BUFFER (ip);
- }
- string = ip->nominal_fname;
-
- if (!string)
- string = "";
- CPP_RESERVE (pfile, 3 + 4 * strlen (string));
- quote_string (pfile, string);
- return;
- }
-
- case T_INCLUDE_LEVEL:
- true_indepth = 0;
- ip = CPP_BUFFER (pfile);
- for (; ip != CPP_NULL_BUFFER (pfile); ip = CPP_PREV_BUFFER (ip))
- if (ip->fname != NULL)
- true_indepth++;
-
- buf = (char *) alloca (8); /* Eight bytes ought to be more than enough */
- sprintf (buf, "%d", true_indepth - 1);
- break;
-
- case T_VERSION:
- buf = (char *) alloca (3 + strlen (version_string));
- sprintf (buf, "\"%s\"", version_string);
- break;
-
-#ifndef NO_BUILTIN_SIZE_TYPE
- case T_SIZE_TYPE:
- buf = SIZE_TYPE;
- break;
-#endif
-
-#ifndef NO_BUILTIN_PTRDIFF_TYPE
- case T_PTRDIFF_TYPE:
- buf = PTRDIFF_TYPE;
- break;
-#endif
-
- case T_WCHAR_TYPE:
- buf = CPP_WCHAR_TYPE (pfile);
- break;
-
- case T_USER_LABEL_PREFIX_TYPE:
- buf = USER_LABEL_PREFIX;
- break;
-
- case T_REGISTER_PREFIX_TYPE:
- buf = REGISTER_PREFIX;
- break;
-
- case T_CONST:
- buf = (char *) alloca (4 * sizeof (int));
- sprintf (buf, "%d", hp->value.ival);
-#if 0
- if (pcp_inside_if && pcp_outfile)
- /* Output a precondition for this macro use */
- fprintf (pcp_outfile, "#define %s %d\n", hp->name, hp->value.ival);
-#endif
- break;
-
- case T_SPECLINE:
- {
- long line = ip->lineno;
- long col = ip->colno;
- adjust_position (CPP_LINE_BASE (ip), ip->cur, &line, &col);
-
- buf = (char *) alloca (10);
- sprintf (buf, "%d", line);
- }
- break;
-
- case T_DATE:
- case T_TIME:
- buf = (char *) alloca (20);
- timebuf = timestamp (pfile);
- if (hp->type == T_DATE)
- sprintf (buf, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon],
- timebuf->tm_mday, timebuf->tm_year + 1900);
- else
- sprintf (buf, "\"%02d:%02d:%02d\"", timebuf->tm_hour, timebuf->tm_min,
- timebuf->tm_sec);
- break;
-
- case T_SPEC_DEFINED:
- buf = " 0 "; /* Assume symbol is not defined */
- ip = CPP_BUFFER (pfile);
- SKIP_WHITE_SPACE (ip->cur);
- if (*ip->cur == '(')
- {
- paren++;
- ip->cur++; /* Skip over the paren */
- SKIP_WHITE_SPACE (ip->cur);
- }
-
- if (!is_idstart[*ip->cur])
- goto oops;
- if (ip->cur[0] == 'L' && (ip->cur[1] == '\'' || ip->cur[1] == '"'))
- goto oops;
- if (hp = cpp_lookup (pfile, ip->cur, -1, -1))
- {
-#if 0
- if (pcp_outfile && pcp_inside_if
- && (hp->type == T_CONST
- || (hp->type == T_MACRO && hp->value.defn->predefined)))
- /* Output a precondition for this macro use. */
- fprintf (pcp_outfile, "#define %s\n", hp->name);
-#endif
- buf = " 1 ";
- }
-#if 0
- else
- if (pcp_outfile && pcp_inside_if)
- {
- /* Output a precondition for this macro use */
- U_CHAR *cp = ip->bufp;
- fprintf (pcp_outfile, "#undef ");
- while (is_idchar[*cp]) /* Ick! */
- fputc (*cp++, pcp_outfile);
- putc ('\n', pcp_outfile);
- }
-#endif
- while (is_idchar[*ip->cur])
- ++ip->cur;
- SKIP_WHITE_SPACE (ip->cur);
- if (paren)
- {
- if (*ip->cur != ')')
- goto oops;
- ++ip->cur;
- }
- break;
-
- oops:
-
- cpp_error (pfile, "`defined' without an identifier");
- break;
-
- default:
- cpp_error (pfile, "cccp error: invalid special hash type"); /* time for gdb */
- abort ();
- }
- len = strlen (buf);
- CPP_RESERVE (pfile, len + 1);
- CPP_PUTS_Q (pfile, buf, len);
- CPP_NUL_TERMINATE_Q (pfile);
-
- return;
-}
-
-/* Write out a #define command for the special named MACRO_NAME
- to PFILE's token_buffer. */
-
-static void
-dump_special_to_buffer (pfile, macro_name)
- cpp_reader *pfile;
- char *macro_name;
-{
- static char define_directive[] = "#define ";
- int macro_name_length = strlen (macro_name);
- output_line_command (pfile, 0, same_file);
- CPP_RESERVE (pfile, sizeof(define_directive) + macro_name_length);
- CPP_PUTS_Q (pfile, define_directive, sizeof(define_directive)-1);
- CPP_PUTS_Q (pfile, macro_name, macro_name_length);
- CPP_PUTC_Q (pfile, ' ');
- cpp_expand_to_buffer (pfile, macro_name, macro_name_length);
- CPP_PUTC (pfile, '\n');
-}
-
-/* Initialize the built-in macros. */
-
-static void
-initialize_builtins (pfile)
- cpp_reader *pfile;
-{
- install ("__LINE__", -1, T_SPECLINE, 0, 0, -1);
- install ("__DATE__", -1, T_DATE, 0, 0, -1);
- install ("__FILE__", -1, T_FILE, 0, 0, -1);
- install ("__BASE_FILE__", -1, T_BASE_FILE, 0, 0, -1);
- install ("__INCLUDE_LEVEL__", -1, T_INCLUDE_LEVEL, 0, 0, -1);
- install ("__VERSION__", -1, T_VERSION, 0, 0, -1);
-#ifndef NO_BUILTIN_SIZE_TYPE
- install ("__SIZE_TYPE__", -1, T_SIZE_TYPE, 0, 0, -1);
-#endif
-#ifndef NO_BUILTIN_PTRDIFF_TYPE
- install ("__PTRDIFF_TYPE__ ", -1, T_PTRDIFF_TYPE, 0, 0, -1);
-#endif
- install ("__WCHAR_TYPE__", -1, T_WCHAR_TYPE, 0, 0, -1);
- install ("__USER_LABEL_PREFIX__", -1, T_USER_LABEL_PREFIX_TYPE, 0, 0, -1);
- install ("__REGISTER_PREFIX__", -1, T_REGISTER_PREFIX_TYPE, 0, 0, -1);
- install ("__TIME__", -1, T_TIME, 0, 0, -1);
- if (!CPP_TRADITIONAL (pfile))
- install ("__STDC__", -1, T_CONST, STDC_VALUE, 0, -1);
- if (CPP_OPTIONS (pfile)->objc)
- install ("__OBJC__", -1, T_CONST, 1, 0, -1);
-/* This is supplied using a -D by the compiler driver
- so that it is present only when truly compiling with GNU C. */
-/* install ("__GNUC__", -1, T_CONST, 2, 0, -1); */
-
- if (CPP_OPTIONS (pfile)->debug_output)
- {
- dump_special_to_buffer (pfile, "__BASE_FILE__");
- dump_special_to_buffer (pfile, "__VERSION__");
-#ifndef NO_BUILTIN_SIZE_TYPE
- dump_special_to_buffer (pfile, "__SIZE_TYPE__");
-#endif
-#ifndef NO_BUILTIN_PTRDIFF_TYPE
- dump_special_to_buffer (pfile, "__PTRDIFF_TYPE__");
-#endif
- dump_special_to_buffer (pfile, "__WCHAR_TYPE__");
- dump_special_to_buffer (pfile, "__DATE__");
- dump_special_to_buffer (pfile, "__TIME__");
- if (!CPP_TRADITIONAL (pfile))
- dump_special_to_buffer (pfile, "__STDC__");
- if (CPP_OPTIONS (pfile)->objc)
- dump_special_to_buffer (pfile, "__OBJC__");
- }
-}
-
-/* Return 1 iff a token ending in C1 followed directly by a token C2
- could cause mis-tokenization. */
-
-static int
-unsafe_chars (c1, c2)
- int c1, c2;
-{
- switch (c1)
- {
- case '+': case '-':
- if (c2 == c1 || c2 == '=')
- return 1;
- goto letter;
- case '.':
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case 'e': case 'E': case 'p': case 'P':
- if (c2 == '-' || c2 == '+')
- return 1; /* could extend a pre-processing number */
- goto letter;
- case 'L':
- if (c2 == '\'' || c2 == '\"')
- return 1; /* Could turn into L"xxx" or L'xxx'. */
- goto letter;
- letter:
- case '_':
- case 'a': case 'b': case 'c': case 'd': case 'f':
- case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
- case 'm': case 'n': case 'o': case 'q': case 'r':
- case 's': case 't': case 'u': case 'v': case 'w': case 'x':
- case 'y': case 'z':
- case 'A': case 'B': case 'C': case 'D': case 'F':
- case 'G': case 'H': case 'I': case 'J': case 'K':
- case 'M': case 'N': case 'O': case 'Q': case 'R':
- case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
- case 'Y': case 'Z':
- /* We're in the middle of either a name or a pre-processing number. */
- return (is_idchar[c2] || c2 == '.');
- case '<': case '>': case '!': case '%': case '#': case ':':
- case '^': case '&': case '|': case '*': case '/': case '=':
- return (c2 == c1 || c2 == '=');
- }
- return 0;
-}
-
-/* Expand a macro call.
- HP points to the symbol that is the macro being called.
- Put the result of expansion onto the input stack
- so that subsequent input by our caller will use it.
-
- If macro wants arguments, caller has already verified that
- an argument list follows; arguments come from the input stack. */
-
-static void
-macroexpand (pfile, hp)
- cpp_reader *pfile;
- HASHNODE *hp;
-{
- int nargs;
- DEFINITION *defn = hp->value.defn;
- register U_CHAR *xbuf;
- long start_line, start_column;
- int xbuf_len;
- struct argdata *args;
- long old_written = CPP_WRITTEN (pfile);
-#if 0
- int start_line = instack[indepth].lineno;
-#endif
- int rest_args, rest_zero;
- register int i;
-
-#if 0
- CHECK_DEPTH (return;);
-#endif
-
-#if 0
- /* This macro is being used inside a #if, which means it must be */
- /* recorded as a precondition. */
- if (pcp_inside_if && pcp_outfile && defn->predefined)
- dump_single_macro (hp, pcp_outfile);
-#endif
-
- pfile->output_escapes++;
- cpp_buf_line_and_col (cpp_file_buffer (pfile), &start_line, &start_column);
-
- nargs = defn->nargs;
-
- if (nargs >= 0)
- {
- enum cpp_token token;
-
- args = (struct argdata *) alloca ((nargs + 1) * sizeof (struct argdata));
-
- for (i = 0; i < nargs; i++)
- {
- args[i].raw = args[i].expanded = 0;
- args[i].raw_length = 0;
- args[i].expand_length = args[i].stringified_length = -1;
- args[i].use_count = 0;
- }
-
- /* Parse all the macro args that are supplied. I counts them.
- The first NARGS args are stored in ARGS.
- The rest are discarded. If rest_args is set then we assume
- macarg absorbed the rest of the args. */
- i = 0;
- rest_args = 0;
- rest_args = 0;
- FORWARD(1); /* Discard the open-parenthesis before the first arg. */
- do
- {
- if (rest_args)
- continue;
- if (i < nargs || (nargs == 0 && i == 0))
- {
- /* if we are working on last arg which absorbs rest of args... */
- if (i == nargs - 1 && defn->rest_args)
- rest_args = 1;
- args[i].raw = CPP_WRITTEN (pfile);
- token = macarg (pfile, rest_args);
- args[i].raw_length = CPP_WRITTEN (pfile) - args[i].raw;
- args[i].newlines = 0; /* FIXME */
- }
- else
- token = macarg (pfile, 0);
- if (token == CPP_EOF || token == CPP_POP)
- {
- cpp_error_with_line (pfile, start_line, start_column,
- "unterminated macro call");
- return;
- }
- i++;
- } while (token == CPP_COMMA);
-
- /* If we got one arg but it was just whitespace, call that 0 args. */
- if (i == 1)
- {
- register U_CHAR *bp = ARG_BASE + args[0].raw;
- register U_CHAR *lim = bp + args[0].raw_length;
- /* cpp.texi says for foo ( ) we provide one argument.
- However, if foo wants just 0 arguments, treat this as 0. */
- if (nargs == 0)
- while (bp != lim && is_space[*bp]) bp++;
- if (bp == lim)
- i = 0;
- }
-
- /* Don't output an error message if we have already output one for
- a parse error above. */
- rest_zero = 0;
- if (nargs == 0 && i > 0)
- {
- cpp_error (pfile, "arguments given to macro `%s'", hp->name);
- }
- else if (i < nargs)
- {
- /* traditional C allows foo() if foo wants one argument. */
- if (nargs == 1 && i == 0 && CPP_TRADITIONAL (pfile))
- ;
- /* the rest args token is allowed to absorb 0 tokens */
- else if (i == nargs - 1 && defn->rest_args)
- rest_zero = 1;
- else if (i == 0)
- cpp_error (pfile, "macro `%s' used without args", hp->name);
- else if (i == 1)
- cpp_error (pfile, "macro `%s' used with just one arg", hp->name);
- else
- cpp_error (pfile, "macro `%s' used with only %d args",
- hp->name, i);
- }
- else if (i > nargs)
- {
- cpp_error (pfile,
- "macro `%s' used with too many (%d) args", hp->name, i);
- }
- }
-
- /* If macro wants zero args, we parsed the arglist for checking only.
- Read directly from the macro definition. */
- if (nargs <= 0)
- {
- xbuf = defn->expansion;
- xbuf_len = defn->length;
- }
- else
- {
- register U_CHAR *exp = defn->expansion;
- register int offset; /* offset in expansion,
- copied a piece at a time */
- register int totlen; /* total amount of exp buffer filled so far */
-
- register struct reflist *ap, *last_ap;
-
- /* Macro really takes args. Compute the expansion of this call. */
-
- /* Compute length in characters of the macro's expansion.
- Also count number of times each arg is used. */
- xbuf_len = defn->length;
- for (ap = defn->pattern; ap != NULL; ap = ap->next)
- {
- if (ap->stringify)
- {
- register struct argdata *arg = &args[ap->argno];
- /* Stringify it it hasn't already been */
- if (arg->stringified_length < 0)
- {
- int arglen = arg->raw_length;
- int escaped = 0;
- int in_string = 0;
- int c;
- /* Initially need_space is -1. Otherwise, 1 means the
- previous character was a space, but we suppressed it;
- 0 means the previous character was a non-space. */
- int need_space = -1;
- i = 0;
- arg->stringified = CPP_WRITTEN (pfile);
- if (!CPP_TRADITIONAL (pfile))
- CPP_PUTC (pfile, '\"'); /* insert beginning quote */
- for (; i < arglen; i++)
- {
- c = (ARG_BASE + arg->raw)[i];
-
- if (! in_string)
- {
- /* Internal sequences of whitespace are replaced by
- one space except within an string or char token.*/
- if (is_space[c])
- {
- if (CPP_WRITTEN (pfile) > arg->stringified
- && (CPP_PWRITTEN (pfile))[-1] == '@')
- {
- /* "@ " escape markers are removed */
- CPP_ADJUST_WRITTEN (pfile, -1);
- continue;
- }
- if (need_space == 0)
- need_space = 1;
- continue;
- }
- else if (need_space > 0)
- CPP_PUTC (pfile, ' ');
- need_space = 0;
- }
-
- if (escaped)
- escaped = 0;
- else
- {
- if (c == '\\')
- escaped = 1;
- if (in_string)
- {
- if (c == in_string)
- in_string = 0;
- }
- else if (c == '\"' || c == '\'')
- in_string = c;
- }
-
- /* Escape these chars */
- if (c == '\"' || (in_string && c == '\\'))
- CPP_PUTC (pfile, '\\');
- if (isprint (c))
- CPP_PUTC (pfile, c);
- else
- {
- CPP_RESERVE (pfile, 4);
- sprintf (CPP_PWRITTEN (pfile), "\\%03o",
- (unsigned int) c);
- CPP_ADJUST_WRITTEN (pfile, 4);
- }
- }
- if (!CPP_TRADITIONAL (pfile))
- CPP_PUTC (pfile, '\"'); /* insert ending quote */
- arg->stringified_length
- = CPP_WRITTEN (pfile) - arg->stringified;
- }
- xbuf_len += args[ap->argno].stringified_length;
- }
- else if (ap->raw_before || ap->raw_after || CPP_TRADITIONAL (pfile))
- /* Add 4 for two newline-space markers to prevent
- token concatenation. */
- xbuf_len += args[ap->argno].raw_length + 4;
- else
- {
- /* We have an ordinary (expanded) occurrence of the arg.
- So compute its expansion, if we have not already. */
- if (args[ap->argno].expand_length < 0)
- {
- args[ap->argno].expanded = CPP_WRITTEN (pfile);
- cpp_expand_to_buffer (pfile,
- ARG_BASE + args[ap->argno].raw,
- args[ap->argno].raw_length);
-
- args[ap->argno].expand_length
- = CPP_WRITTEN (pfile) - args[ap->argno].expanded;
- }
-
- /* Add 4 for two newline-space markers to prevent
- token concatenation. */
- xbuf_len += args[ap->argno].expand_length + 4;
- }
- if (args[ap->argno].use_count < 10)
- args[ap->argno].use_count++;
- }
-
- xbuf = (U_CHAR *) xmalloc (xbuf_len + 1);
-
- /* Generate in XBUF the complete expansion
- with arguments substituted in.
- TOTLEN is the total size generated so far.
- OFFSET is the index in the definition
- of where we are copying from. */
- offset = totlen = 0;
- for (last_ap = NULL, ap = defn->pattern; ap != NULL;
- last_ap = ap, ap = ap->next)
- {
- register struct argdata *arg = &args[ap->argno];
- int count_before = totlen;
-
- /* Add chars to XBUF. */
- for (i = 0; i < ap->nchars; i++, offset++)
- xbuf[totlen++] = exp[offset];
-
- /* If followed by an empty rest arg with concatenation,
- delete the last run of nonwhite chars. */
- if (rest_zero && totlen > count_before
- && ((ap->rest_args && ap->raw_before)
- || (last_ap != NULL && last_ap->rest_args
- && last_ap->raw_after)))
- {
- /* Delete final whitespace. */
- while (totlen > count_before && is_space[xbuf[totlen - 1]])
- totlen--;
-
- /* Delete the nonwhites before them. */
- while (totlen > count_before && ! is_space[xbuf[totlen - 1]])
- totlen--;
- }
-
- if (ap->stringify != 0)
- {
- bcopy (ARG_BASE + arg->stringified,
- xbuf + totlen, arg->stringified_length);
- totlen += arg->stringified_length;
- }
- else if (ap->raw_before || ap->raw_after || CPP_TRADITIONAL (pfile))
- {
- U_CHAR *p1 = ARG_BASE + arg->raw;
- U_CHAR *l1 = p1 + arg->raw_length;
- if (ap->raw_before)
- {
- while (p1 != l1 && is_space[*p1]) p1++;
- while (p1 != l1 && is_idchar[*p1])
- xbuf[totlen++] = *p1++;
- /* Delete any no-reexpansion marker that follows
- an identifier at the beginning of the argument
- if the argument is concatenated with what precedes it. */
- if (p1[0] == '@' && p1[1] == '-')
- p1 += 2;
- }
- if (ap->raw_after)
- {
- /* Arg is concatenated after: delete trailing whitespace,
- whitespace markers, and no-reexpansion markers. */
- while (p1 != l1)
- {
- if (is_space[l1[-1]]) l1--;
- else if (l1[-1] == '-')
- {
- U_CHAR *p2 = l1 - 1;
- /* If a `-' is preceded by an odd number of newlines then it
- and the last newline are a no-reexpansion marker. */
- while (p2 != p1 && p2[-1] == '\n') p2--;
- if ((l1 - 1 - p2) & 1) {
- l1 -= 2;
- }
- else break;
- }
- else break;
- }
- }
-
- bcopy (p1, xbuf + totlen, l1 - p1);
- totlen += l1 - p1;
- }
- else
- {
- U_CHAR *expanded = ARG_BASE + arg->expanded;
- if (!ap->raw_before && totlen > 0 && arg->expand_length
- && !CPP_TRADITIONAL(pfile)
- && unsafe_chars (xbuf[totlen-1], expanded[0]))
- {
- xbuf[totlen++] = '@';
- xbuf[totlen++] = ' ';
- }
-
- bcopy (expanded, xbuf + totlen, arg->expand_length);
- totlen += arg->expand_length;
-
- if (!ap->raw_after && totlen > 0 && offset < defn->length
- && !CPP_TRADITIONAL(pfile)
- && unsafe_chars (xbuf[totlen-1], exp[offset]))
- {
- xbuf[totlen++] = '@';
- xbuf[totlen++] = ' ';
- }
-
- /* If a macro argument with newlines is used multiple times,
- then only expand the newlines once. This avoids creating
- output lines which don't correspond to any input line,
- which confuses gdb and gcov. */
- if (arg->use_count > 1 && arg->newlines > 0)
- {
- /* Don't bother doing change_newlines for subsequent
- uses of arg. */
- arg->use_count = 1;
- arg->expand_length
- = change_newlines (expanded, arg->expand_length);
- }
- }
-
- if (totlen > xbuf_len)
- abort ();
- }
-
- /* if there is anything left of the definition
- after handling the arg list, copy that in too. */
-
- for (i = offset; i < defn->length; i++)
- {
- /* if we've reached the end of the macro */
- if (exp[i] == ')')
- rest_zero = 0;
- if (! (rest_zero && last_ap != NULL && last_ap->rest_args
- && last_ap->raw_after))
- xbuf[totlen++] = exp[i];
- }
-
- xbuf[totlen] = 0;
- xbuf_len = totlen;
-
- }
-
- pfile->output_escapes--;
-
- /* Now put the expansion on the input stack
- so our caller will commence reading from it. */
- push_macro_expansion (pfile, xbuf, xbuf_len, hp);
- CPP_BUFFER (pfile)->has_escapes = 1;
-
- /* Pop the space we've used in the token_buffer for argument expansion. */
- CPP_SET_WRITTEN (pfile, old_written);
-
- /* Recursive macro use sometimes works traditionally.
- #define foo(x,y) bar (x (y,0), y)
- foo (foo, baz) */
-
- if (!CPP_TRADITIONAL (pfile))
- hp->type = T_DISABLED;
-}
-
-static void
-push_macro_expansion (pfile, xbuf, xbuf_len, hp)
- cpp_reader *pfile;
- register U_CHAR *xbuf;
- int xbuf_len;
- HASHNODE *hp;
-{
- register cpp_buffer *mbuf = cpp_push_buffer (pfile, xbuf, xbuf_len);
- if (mbuf == NULL)
- return;
- mbuf->cleanup = macro_cleanup;
- mbuf->data = hp;
-
- /* The first chars of the expansion should be a "@ " added by
- collect_expansion. This is to prevent accidental token-pasting
- between the text preceding the macro invocation, and the macro
- expansion text.
-
- We would like to avoid adding unneeded spaces (for the sake of
- tools that use cpp, such as imake). In some common cases we can
- tell that it is safe to omit the space.
-
- The character before the macro invocation cannot have been an
- idchar (or else it would have been pasted with the idchars of
- the macro name). Therefore, if the first non-space character
- of the expansion is an idchar, we do not need the extra space
- to prevent token pasting.
-
- Also, we don't need the extra space if the first char is '(',
- or some other (less common) characters. */
-
- if (xbuf[0] == '@' && xbuf[1] == ' '
- && (is_idchar[xbuf[2]] || xbuf[2] == '(' || xbuf[2] == '\''
- || xbuf[2] == '\"'))
- mbuf->cur += 2;
-}
-
-/* Like cpp_get_token, except that it does not read past end-of-line.
- Also, horizontal space is skipped, and macros are popped. */
-
-static enum cpp_token
-get_directive_token (pfile)
- cpp_reader *pfile;
-{
- for (;;)
- {
- long old_written = CPP_WRITTEN (pfile);
- enum cpp_token token;
- cpp_skip_hspace (pfile);
- if (PEEKC () == '\n')
- return CPP_VSPACE;
- token = cpp_get_token (pfile);
- switch (token)
- {
- case CPP_POP:
- if (! CPP_IS_MACRO_BUFFER (CPP_BUFFER (pfile)))
- return token;
- /* ... else fall though ... */
- case CPP_HSPACE: case CPP_COMMENT:
- CPP_SET_WRITTEN (pfile, old_written);
- break;
- default:
- return token;
- }
- }
-}
-
-/* Handle #include and #import.
- This function expects to see "fname" or <fname> on the input.
-
- The input is normally in part of the output_buffer following
- CPP_WRITTEN, and will get overwritten by output_line_command.
- I.e. in input file specification has been popped by handle_directive.
- This is safe. */
-
-static int
-do_include (pfile, keyword, unused1, unused2)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *unused1, *unused2;
-{
- int importing = (keyword->type == T_IMPORT);
- int skip_dirs = (keyword->type == T_INCLUDE_NEXT);
- char *fname; /* Dynamically allocated fname buffer */
- char *pcftry;
- char *pcfname;
- U_CHAR *fbeg, *fend; /* Beginning and end of fname */
- enum cpp_token token;
-
- /* Chain of dirs to search */
- struct file_name_list *search_start = CPP_OPTIONS (pfile)->include;
- struct file_name_list dsp[1]; /* First in chain, if #include "..." */
- struct file_name_list *searchptr = 0;
- long old_written = CPP_WRITTEN (pfile);
-
- int flen;
-
- int f; /* file number */
-
- int retried = 0; /* Have already tried macro
- expanding the include line */
- int angle_brackets = 0; /* 0 for "...", 1 for <...> */
- int pcf = -1;
- char *pcfbuf;
- char *pcfbuflimit;
- int pcfnum;
- f= -1; /* JF we iz paranoid! */
-
- if (importing && CPP_OPTIONS (pfile)->warn_import
- && !CPP_OPTIONS (pfile)->inhibit_warnings
- && !CPP_BUFFER (pfile)->system_header_p && !pfile->import_warning)
- {
- pfile->import_warning = 1;
- cpp_warning (pfile, "using `#import' is not recommended");
- fprintf (stderr, "The fact that a certain header file need not be processed more than once\n");
- fprintf (stderr, "should be indicated in the header file, not where it is used.\n");
- fprintf (stderr, "The best way to do this is with a conditional of this form:\n\n");
- fprintf (stderr, " #ifndef _FOO_H_INCLUDED\n");
- fprintf (stderr, " #define _FOO_H_INCLUDED\n");
- fprintf (stderr, " ... <real contents of file> ...\n");
- fprintf (stderr, " #endif /* Not _FOO_H_INCLUDED */\n\n");
- fprintf (stderr, "Then users can use `#include' any number of times.\n");
- fprintf (stderr, "GNU C automatically avoids processing the file more than once\n");
- fprintf (stderr, "when it is equipped with such a conditional.\n");
- }
-
- pfile->parsing_include_directive++;
- token = get_directive_token (pfile);
- pfile->parsing_include_directive--;
-
- if (token == CPP_STRING)
- {
- /* FIXME - check no trailing garbage */
- fbeg = pfile->token_buffer + old_written + 1;
- fend = CPP_PWRITTEN (pfile) - 1;
- if (fbeg[-1] == '<')
- {
- angle_brackets = 1;
- /* If -I-, start with the first -I dir after the -I-. */
- if (CPP_OPTIONS (pfile)->first_bracket_include)
- search_start = CPP_OPTIONS (pfile)->first_bracket_include;
- }
- /* If -I- was specified, don't search current dir, only spec'd ones. */
- else if (! CPP_OPTIONS (pfile)->ignore_srcdir)
- {
- cpp_buffer *fp = CPP_BUFFER (pfile);
- /* We have "filename". Figure out directory this source
- file is coming from and put it on the front of the list. */
-
- for ( ; fp != CPP_NULL_BUFFER (pfile); fp = CPP_PREV_BUFFER (fp))
- {
- int n;
- char *ep,*nam;
-
- if ((nam = fp->nominal_fname) != NULL)
- {
- /* Found a named file. Figure out dir of the file,
- and put it in front of the search list. */
- dsp[0].next = search_start;
- search_start = dsp;
-#ifndef VMS
- ep = rindex (nam, '/');
-#else /* VMS */
- ep = rindex (nam, ']');
- if (ep == NULL) ep = rindex (nam, '>');
- if (ep == NULL) ep = rindex (nam, ':');
- if (ep != NULL) ep++;
-#endif /* VMS */
- if (ep != NULL)
- {
- n = ep - nam;
- dsp[0].fname = (char *) alloca (n + 1);
- strncpy (dsp[0].fname, nam, n);
- dsp[0].fname[n] = '\0';
- if (n + INCLUDE_LEN_FUDGE > pfile->max_include_len)
- pfile->max_include_len = n + INCLUDE_LEN_FUDGE;
- }
- else
- {
- dsp[0].fname = 0; /* Current directory */
- }
- dsp[0].got_name_map = 0;
- break;
- }
- }
- }
- }
-#ifdef VMS
- else if (token == CPP_NAME)
- {
- /*
- * Support '#include xyz' like VAX-C to allow for easy use of all the
- * decwindow include files. It defaults to '#include <xyz.h>' (so the
- * code from case '<' is repeated here) and generates a warning.
- */
- cpp_warning (pfile,
- "VAX-C-style include specification found, use '#include <filename.h>' !");
- angle_brackets = 1;
- /* If -I-, start with the first -I dir after the -I-. */
- if (CPP_OPTIONS (pfile)->first_bracket_include)
- search_start = CPP_OPTIONS (pfile)->first_bracket_include;
- fbeg = pfile->token_buffer + old_written;
- fend = CPP_PWRITTEN (pfile);
- }
-#endif
- else
- {
- cpp_error (pfile,
- "`#%s' expects \"FILENAME\" or <FILENAME>", keyword->name);
- CPP_SET_WRITTEN (pfile, old_written);
- skip_rest_of_line (pfile);
- return 0;
- }
-
- *fend = 0;
-
- token = get_directive_token (pfile);
- if (token != CPP_VSPACE)
- {
- cpp_error (pfile, "junk at end of `#include'");
- while (token != CPP_VSPACE && token != CPP_EOF && token != CPP_POP)
- token = get_directive_token (pfile);
- }
-
- /* For #include_next, skip in the search path
- past the dir in which the containing file was found. */
- if (skip_dirs)
- {
- cpp_buffer *fp = CPP_BUFFER (pfile);
- for (; fp != CPP_NULL_BUFFER (pfile); fp = CPP_PREV_BUFFER (fp))
- if (fp->fname != NULL)
- {
- /* fp->dir is null if the containing file was specified with
- an absolute file name. In that case, don't skip anything. */
- if (fp->dir == SELF_DIR_DUMMY)
- search_start = CPP_OPTIONS (pfile)->include;
- else if (fp->dir)
- search_start = fp->dir->next;
- break;
- }
- }
-
- CPP_SET_WRITTEN (pfile, old_written);
-
- flen = fend - fbeg;
-
- if (flen == 0)
- {
- cpp_error (pfile, "empty file name in `#%s'", keyword->name);
- return 0;
- }
-
- /* Allocate this permanently, because it gets stored in the definitions
- of macros. */
- fname = (char *) xmalloc (pfile->max_include_len + flen + 4);
- /* + 2 above for slash and terminating null. */
- /* + 2 added for '.h' on VMS (to support '#include filename') */
-
- /* If specified file name is absolute, just open it. */
-
- if (*fbeg == '/') {
- strncpy (fname, fbeg, flen);
- fname[flen] = 0;
- if (redundant_include_p (pfile, fname))
- return 0;
- if (importing)
- f = lookup_import (pfile, fname, NULL_PTR);
- else
- f = open_include_file (pfile, fname, NULL_PTR);
- if (f == -2)
- return 0; /* Already included this file */
- } else {
- /* Search directory path, trying to open the file.
- Copy each filename tried into FNAME. */
-
- for (searchptr = search_start; searchptr; searchptr = searchptr->next) {
- if (searchptr->fname) {
- /* The empty string in a search path is ignored.
- This makes it possible to turn off entirely
- a standard piece of the list. */
- if (searchptr->fname[0] == 0)
- continue;
- strcpy (fname, searchptr->fname);
- strcat (fname, "/");
- fname[strlen (fname) + flen] = 0;
- } else {
- fname[0] = 0;
- }
- strncat (fname, fbeg, flen);
-#ifdef VMS
- /* Change this 1/2 Unix 1/2 VMS file specification into a
- full VMS file specification */
- if (searchptr->fname && (searchptr->fname[0] != 0)) {
- /* Fix up the filename */
- hack_vms_include_specification (fname);
- } else {
- /* This is a normal VMS filespec, so use it unchanged. */
- strncpy (fname, fbeg, flen);
- fname[flen] = 0;
- /* if it's '#include filename', add the missing .h */
- if (index(fname,'.')==NULL) {
- strcat (fname, ".h");
- }
- }
-#endif /* VMS */
- /* ??? There are currently 3 separate mechanisms for avoiding processing
- of redundant include files: #import, #pragma once, and
- redundant_include_p. It would be nice if they were unified. */
- if (redundant_include_p (pfile, fname))
- return 0;
- if (importing)
- f = lookup_import (pfile, fname, searchptr);
- else
- f = open_include_file (pfile, fname, searchptr);
- if (f == -2)
- return 0; /* Already included this file */
-#ifdef EACCES
- else if (f == -1 && errno == EACCES)
- cpp_warning (pfile, "Header file %s exists, but is not readable",
- fname);
-#endif
- if (f >= 0)
- break;
- }
- }
-
- if (f < 0)
- {
- /* A file that was not found. */
- strncpy (fname, fbeg, flen);
- fname[flen] = 0;
- /* If generating dependencies and -MG was specified, we assume missing
- files are leaf files, living in the same directory as the source file
- or other similar place; these missing files may be generated from
- other files and may not exist yet (eg: y.tab.h). */
-
- if (CPP_OPTIONS(pfile)->print_deps_missing_files
- && CPP_PRINT_DEPS (pfile)
- > (angle_brackets || (pfile->system_include_depth > 0)))
- {
- /* If it was requested as a system header file,
- then assume it belongs in the first place to look for such. */
- if (angle_brackets)
- {
- for (searchptr = search_start; searchptr;
- searchptr = searchptr->next)
- {
- if (searchptr->fname)
- {
- char *p;
-
- if (searchptr->fname[0] == 0)
- continue;
- p = (char *) alloca (strlen (searchptr->fname)
- + strlen (fname) + 2);
- strcpy (p, searchptr->fname);
- strcat (p, "/");
- strcat (p, fname);
- deps_output (pfile, p, ' ');
- break;
- }
- }
- }
- else
- {
- /* Otherwise, omit the directory, as if the file existed
- in the directory with the source. */
- deps_output (pfile, fname, ' ');
- }
- }
- /* If -M was specified, and this header file won't be added to the
- dependency list, then don't count this as an error, because we can
- still produce correct output. Otherwise, we can't produce correct
- output, because there may be dependencies we need inside the missing
- file, and we don't know what directory this missing file exists in.*/
- else if (CPP_PRINT_DEPS (pfile)
- && (CPP_PRINT_DEPS (pfile)
- <= (angle_brackets || (pfile->system_include_depth > 0))))
- cpp_warning (pfile, "No include path in which to find %s", fname);
- else if (search_start)
- cpp_error_from_errno (pfile, fname);
- else
- cpp_error (pfile, "No include path in which to find %s", fname);
- }
- else {
- /* Check to see if this include file is a once-only include file.
- If so, give up. */
-
- struct file_name_list *ptr;
-
- for (ptr = pfile->dont_repeat_files; ptr; ptr = ptr->next) {
- if (!strcmp (ptr->fname, fname)) {
- close (f);
- return 0; /* This file was once'd. */
- }
- }
-
- for (ptr = pfile->all_include_files; ptr; ptr = ptr->next) {
- if (!strcmp (ptr->fname, fname))
- break; /* This file was included before. */
- }
-
- if (ptr == 0) {
- /* This is the first time for this file. */
- /* Add it to list of files included. */
-
- ptr = (struct file_name_list *) xmalloc (sizeof (struct file_name_list));
- ptr->control_macro = 0;
- ptr->c_system_include_path = 0;
- ptr->next = pfile->all_include_files;
- pfile->all_include_files = ptr;
- ptr->fname = savestring (fname);
- ptr->got_name_map = 0;
-
- /* For -M, add this file to the dependencies. */
- if (CPP_PRINT_DEPS (pfile)
- > (angle_brackets || (pfile->system_include_depth > 0)))
- deps_output (pfile, fname, ' ');
- }
-
- /* Handle -H option. */
- if (CPP_OPTIONS(pfile)->print_include_names)
- {
- cpp_buffer *buf = CPP_BUFFER (pfile);
- while ((buf = CPP_PREV_BUFFER (buf)) != CPP_NULL_BUFFER (pfile))
- putc ('.', stderr);
- fprintf (stderr, "%s\n", fname);
- }
-
- if (angle_brackets)
- pfile->system_include_depth++;
-
- /* Actually process the file. */
-
- /* Record file on "seen" list for #import. */
- add_import (pfile, f, fname);
-
- pcftry = (char *) alloca (strlen (fname) + 30);
- pcfbuf = 0;
- pcfnum = 0;
-
-#if 0
- if (!no_precomp)
- {
- struct stat stat_f;
-
- fstat (f, &stat_f);
-
- do {
- sprintf (pcftry, "%s%d", fname, pcfnum++);
-
- pcf = open (pcftry, O_RDONLY, 0666);
- if (pcf != -1)
- {
- struct stat s;
-
- fstat (pcf, &s);
- if (bcmp ((char *) &stat_f.st_ino, (char *) &s.st_ino,
- sizeof (s.st_ino))
- || stat_f.st_dev != s.st_dev)
- {
- pcfbuf = check_precompiled (pcf, fname, &pcfbuflimit);
- /* Don't need it any more. */
- close (pcf);
- }
- else
- {
- /* Don't need it at all. */
- close (pcf);
- break;
- }
- }
- } while (pcf != -1 && !pcfbuf);
- }
-#endif
-
- /* Actually process the file */
- if (cpp_push_buffer (pfile, NULL, 0) == NULL)
- return 0;
- if (finclude (pfile, f, fname, is_system_include (pfile, fname),
- searchptr != dsp ? searchptr : SELF_DIR_DUMMY))
- {
- output_line_command (pfile, 0, enter_file);
- pfile->only_seen_white = 2;
- }
-
- if (angle_brackets)
- pfile->system_include_depth--;
- }
- return 0;
-}
-
-/* Return nonzero if there is no need to include file NAME
- because it has already been included and it contains a conditional
- to make a repeated include do nothing. */
-
-static int
-redundant_include_p (pfile, name)
- cpp_reader *pfile;
- char *name;
-{
- struct file_name_list *l = pfile->all_include_files;
- for (; l; l = l->next)
- if (! strcmp (name, l->fname)
- && l->control_macro
- && cpp_lookup (pfile, l->control_macro, -1, -1))
- return 1;
- return 0;
-}
-
-/* Return nonzero if the given FILENAME is an absolute pathname which
- designates a file within one of the known "system" include file
- directories. We assume here that if the given FILENAME looks like
- it is the name of a file which resides either directly in a "system"
- include file directory, or within any subdirectory thereof, then the
- given file must be a "system" include file. This function tells us
- if we should suppress pedantic errors/warnings for the given FILENAME.
-
- The value is 2 if the file is a C-language system header file
- for which C++ should (on most systems) assume `extern "C"'. */
-
-static int
-is_system_include (pfile, filename)
- cpp_reader *pfile;
- register char *filename;
-{
- struct file_name_list *searchptr;
-
- for (searchptr = CPP_OPTIONS (pfile)->first_system_include; searchptr;
- searchptr = searchptr->next)
- if (searchptr->fname) {
- register char *sys_dir = searchptr->fname;
- register unsigned length = strlen (sys_dir);
-
- if (! strncmp (sys_dir, filename, length) && filename[length] == '/')
- {
- if (searchptr->c_system_include_path)
- return 2;
- else
- return 1;
- }
- }
- return 0;
-}
-
-
-/*
- * Install a name in the assertion hash table.
- *
- * If LEN is >= 0, it is the length of the name.
- * Otherwise, compute the length by scanning the entire name.
- *
- * If HASH is >= 0, it is the precomputed hash code.
- * Otherwise, compute the hash code.
- */
-
-static ASSERTION_HASHNODE *
-assertion_install (pfile, name, len, hash)
- cpp_reader *pfile;
- U_CHAR *name;
- int len;
- int hash;
-{
- register ASSERTION_HASHNODE *hp;
- register int i, bucket;
- register U_CHAR *p, *q;
-
- i = sizeof (ASSERTION_HASHNODE) + len + 1;
- hp = (ASSERTION_HASHNODE *) xmalloc (i);
- bucket = hash;
- hp->bucket_hdr = &pfile->assertion_hashtab[bucket];
- hp->next = pfile->assertion_hashtab[bucket];
- pfile->assertion_hashtab[bucket] = hp;
- hp->prev = NULL;
- if (hp->next != NULL)
- hp->next->prev = hp;
- hp->length = len;
- hp->value = 0;
- hp->name = ((U_CHAR *) hp) + sizeof (ASSERTION_HASHNODE);
- p = hp->name;
- q = name;
- for (i = 0; i < len; i++)
- *p++ = *q++;
- hp->name[len] = 0;
- return hp;
-}
-/*
- * find the most recent hash node for name name (ending with first
- * non-identifier char) installed by install
- *
- * If LEN is >= 0, it is the length of the name.
- * Otherwise, compute the length by scanning the entire name.
- *
- * If HASH is >= 0, it is the precomputed hash code.
- * Otherwise, compute the hash code.
- */
-
-static ASSERTION_HASHNODE *
-assertion_lookup (pfile, name, len, hash)
- cpp_reader *pfile;
- U_CHAR *name;
- int len;
- int hash;
-{
- register ASSERTION_HASHNODE *bucket;
-
- bucket = pfile->assertion_hashtab[hash];
- while (bucket) {
- if (bucket->length == len && strncmp (bucket->name, name, len) == 0)
- return bucket;
- bucket = bucket->next;
- }
- return NULL;
-}
-
-static void
-delete_assertion (hp)
- ASSERTION_HASHNODE *hp;
-{
- struct tokenlist_list *tail;
- if (hp->prev != NULL)
- hp->prev->next = hp->next;
- if (hp->next != NULL)
- hp->next->prev = hp->prev;
-
- for (tail = hp->value; tail; )
- {
- struct tokenlist_list *next = tail->next;
- free_token_list (tail->tokens);
- free (tail);
- tail = next;
- }
-
- /* Make sure that the bucket chain header that
- the deleted guy was on points to the right thing afterwards. */
- if (hp == *hp->bucket_hdr)
- *hp->bucket_hdr = hp->next;
-
- free (hp);
-}
-
-/* Convert a character string literal into a nul-terminated string.
- The input string is [IN ... LIMIT).
- The result is placed in RESULT. RESULT can be the same as IN.
- The value returned in the end of the string written to RESULT,
- or NULL on error. */
-
-static U_CHAR *
-convert_string (pfile, result, in, limit, handle_escapes)
- cpp_reader *pfile;
- register U_CHAR *result, *in, *limit;
- int handle_escapes;
-{
- U_CHAR c;
- c = *in++;
- if (c != '\"')
- return NULL;
- while (in < limit)
- {
- U_CHAR c = *in++;
- switch (c)
- {
- case '\0':
- return NULL;
- case '\"':
- limit = in;
- break;
- case '\\':
- if (handle_escapes)
- {
- char *bpc = (char *) in;
- int i = (U_CHAR) cpp_parse_escape (pfile, &bpc);
- in = (U_CHAR *) bpc;
- if (i >= 0)
- *result++ = (U_CHAR)c;
- break;
- }
- /* else fall through */
- default:
- *result++ = c;
- }
- }
- *result = 0;
- return result;
-}
-
-/*
- * interpret #line command. Remembers previously seen fnames
- * in its very own hash table.
- */
-#define FNAME_HASHSIZE 37
-
-static int
-do_line (pfile, keyword)
- cpp_reader *pfile;
- struct directive *keyword;
-{
- cpp_buffer *ip = CPP_BUFFER (pfile);
- int new_lineno;
- long old_written = CPP_WRITTEN (pfile);
- enum file_change_code file_change = same_file;
- enum cpp_token token;
- int i;
-
- token = get_directive_token (pfile);
-
- if (token != CPP_NUMBER
- || !isdigit(pfile->token_buffer[old_written]))
- {
- cpp_error (pfile, "invalid format `#line' command");
- goto bad_line_directive;
- }
-
- /* The Newline at the end of this line remains to be processed.
- To put the next line at the specified line number,
- we must store a line number now that is one less. */
- new_lineno = atoi (pfile->token_buffer + old_written) - 1;
- CPP_SET_WRITTEN (pfile, old_written);
-
- /* NEW_LINENO is one less than the actual line number here. */
- if (CPP_PEDANTIC (pfile) && new_lineno < 0)
- cpp_pedwarn (pfile, "line number out of range in `#line' command");
-
-#if 0 /* #line 10"foo.c" is supposed to be allowed. */
- if (PEEKC() && !is_space[PEEKC()]) {
- cpp_error (pfile, "invalid format `#line' command");
- goto bad_line_directive;
- }
-#endif
-
- token = get_directive_token (pfile);
-
- if (token == CPP_STRING) {
- U_CHAR *fname = pfile->token_buffer + old_written;
- U_CHAR *end_name;
- static HASHNODE *fname_table[FNAME_HASHSIZE];
- HASHNODE *hp, **hash_bucket;
- U_CHAR *p;
- long num_start;
- int fname_length;
-
- /* Turn the file name, which is a character string literal,
- into a null-terminated string. Do this in place. */
- end_name = convert_string (pfile, fname, fname, CPP_PWRITTEN (pfile), 1);
- if (end_name == NULL)
- {
- cpp_error (pfile, "invalid format `#line' command");
- goto bad_line_directive;
- }
-
- fname_length = end_name - fname;
-
- num_start = CPP_WRITTEN (pfile);
- token = get_directive_token (pfile);
- if (token != CPP_VSPACE && token != CPP_EOF && token != CPP_POP) {
- p = pfile->token_buffer + num_start;
- if (CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "garbage at end of `#line' command");
-
- if (token != CPP_NUMBER || *p < '0' || *p > '4' || p[1] != '\0')
- {
- cpp_error (pfile, "invalid format `#line' command");
- goto bad_line_directive;
- }
- if (*p == '1')
- file_change = enter_file;
- else if (*p == 2)
- file_change = leave_file;
- else if (*p == 3)
- ip->system_header_p = 1;
- else /* if (*p == 4) */
- ip->system_header_p = 2;
-
- CPP_SET_WRITTEN (pfile, num_start);
- token = get_directive_token (pfile);
- p = pfile->token_buffer + num_start;
- if (token == CPP_NUMBER && p[1] == '\0' && (*p == '3' || *p== '4')) {
- ip->system_header_p = *p == 3 ? 1 : 2;
- token = get_directive_token (pfile);
- }
- if (token != CPP_VSPACE) {
- cpp_error (pfile, "invalid format `#line' command");
- goto bad_line_directive;
- }
- }
-
- hash_bucket =
- &fname_table[hashf (fname, fname_length, FNAME_HASHSIZE)];
- for (hp = *hash_bucket; hp != NULL; hp = hp->next)
- if (hp->length == fname_length &&
- strncmp (hp->value.cpval, fname, fname_length) == 0) {
- ip->nominal_fname = hp->value.cpval;
- break;
- }
- if (hp == 0) {
- /* Didn't find it; cons up a new one. */
- hp = (HASHNODE *) xcalloc (1, sizeof (HASHNODE) + fname_length + 1);
- hp->next = *hash_bucket;
- *hash_bucket = hp;
-
- hp->length = fname_length;
- ip->nominal_fname = hp->value.cpval = ((char *) hp) + sizeof (HASHNODE);
- bcopy (fname, hp->value.cpval, fname_length);
- }
- }
- else if (token != CPP_VSPACE && token != CPP_EOF) {
- cpp_error (pfile, "invalid format `#line' command");
- goto bad_line_directive;
- }
-
- ip->lineno = new_lineno;
- bad_line_directive:
- skip_rest_of_line (pfile);
- CPP_SET_WRITTEN (pfile, old_written);
- output_line_command (pfile, 0, file_change);
- return 0;
-}
-
-/*
- * remove the definition of a symbol from the symbol table.
- * according to un*x /lib/cpp, it is not an error to undef
- * something that has no definitions, so it isn't one here either.
- */
-
-static int
-do_undef (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- int sym_length;
- HASHNODE *hp;
- U_CHAR *orig_buf = buf;
-
-#if 0
- /* If this is a precompiler run (with -pcp) pass thru #undef commands. */
- if (pcp_outfile && keyword)
- pass_thru_directive (buf, limit, pfile, keyword);
-#endif
-
- SKIP_WHITE_SPACE (buf);
- sym_length = check_macro_name (pfile, buf, "macro");
-
- while ((hp = cpp_lookup (pfile, buf, sym_length, -1)) != NULL)
- {
- /* If we are generating additional info for debugging (with -g) we
- need to pass through all effective #undef commands. */
- if (CPP_OPTIONS (pfile)->debug_output && keyword)
- pass_thru_directive (orig_buf, limit, pfile, keyword);
- if (hp->type != T_MACRO)
- cpp_warning (pfile, "undefining `%s'", hp->name);
- delete_macro (hp);
- }
-
- if (CPP_PEDANTIC (pfile)) {
- buf += sym_length;
- SKIP_WHITE_SPACE (buf);
- if (buf != limit)
- cpp_pedwarn (pfile, "garbage after `#undef' directive");
- }
- return 0;
-}
-
-/*
- * Report an error detected by the program we are processing.
- * Use the text of the line in the error message.
- * (We use error because it prints the filename & line#.)
- */
-
-static int
-do_error (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- int length = limit - buf;
- U_CHAR *copy = (U_CHAR *) alloca (length + 1);
- bcopy (buf, copy, length);
- copy[length] = 0;
- SKIP_WHITE_SPACE (copy);
- cpp_error (pfile, "#error %s", copy);
- return 0;
-}
-
-/*
- * Report a warning detected by the program we are processing.
- * Use the text of the line in the warning message, then continue.
- * (We use error because it prints the filename & line#.)
- */
-
-static int
-do_warning (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- int length = limit - buf;
- U_CHAR *copy = (U_CHAR *) alloca (length + 1);
- bcopy (buf, copy, length);
- copy[length] = 0;
- SKIP_WHITE_SPACE (copy);
- cpp_warning (pfile, "#warning %s", copy);
- return 0;
-}
-
-/* Remember the name of the current file being read from so that we can
- avoid ever including it again. */
-
-static int
-do_once (pfile)
- cpp_reader *pfile;
-{
- cpp_buffer *ip = NULL;
- struct file_name_list *new;
-
- for (ip = CPP_BUFFER (pfile); ; ip = CPP_PREV_BUFFER (ip))
- {
- if (ip == CPP_NULL_BUFFER (pfile))
- return 0;
- if (ip->fname != NULL)
- break;
- }
-
-
- new = (struct file_name_list *) xmalloc (sizeof (struct file_name_list));
- new->next = pfile->dont_repeat_files;
- pfile->dont_repeat_files = new;
- new->fname = savestring (ip->fname);
- new->control_macro = 0;
- new->got_name_map = 0;
- new->c_system_include_path = 0;
-
- return 0;
-}
-
-/* #ident has already been copied to the output file, so just ignore it. */
-
-static int
-do_ident (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
-/* long old_written = CPP_WRITTEN (pfile);*/
- int len;
-
- /* Allow #ident in system headers, since that's not user's fault. */
- if (CPP_PEDANTIC (pfile) && !CPP_BUFFER (pfile)->system_header_p)
- cpp_pedwarn (pfile, "ANSI C does not allow `#ident'");
-
- /* Leave rest of line to be read by later calls to cpp_get_token. */
-
- return 0;
-}
-
-/* #pragma and its argument line have already been copied to the output file.
- Just check for some recognized pragmas that need validation here. */
-
-static int
-do_pragma (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- while (*buf == ' ' || *buf == '\t')
- buf++;
- if (!strncmp (buf, "once", 4)) {
- /* Allow #pragma once in system headers, since that's not the user's
- fault. */
- if (!CPP_BUFFER (pfile)->system_header_p)
- cpp_warning (pfile, "`#pragma once' is obsolete");
- do_once (pfile);
- }
-
- if (!strncmp (buf, "implementation", 14)) {
- /* Be quiet about `#pragma implementation' for a file only if it hasn't
- been included yet. */
- struct file_name_list *ptr;
- U_CHAR *p = buf + 14, *fname, *inc_fname;
- int fname_len;
- SKIP_WHITE_SPACE (p);
- if (*p == '\n' || *p != '\"')
- return 0;
-
- fname = p + 1;
- p = (U_CHAR *) index (fname, '\"');
- fname_len = p != NULL ? p - fname : strlen (fname);
-
- for (ptr = pfile->all_include_files; ptr; ptr = ptr->next) {
- inc_fname = (U_CHAR *) rindex (ptr->fname, '/');
- inc_fname = inc_fname ? inc_fname + 1 : (U_CHAR *) ptr->fname;
- if (inc_fname && !strncmp (inc_fname, fname, fname_len))
- cpp_warning (pfile,
- "`#pragma implementation' for `%s' appears after file is included",
- fname);
- }
- }
-
- return 0;
-}
-
-#if 0
-/* This was a fun hack, but #pragma seems to start to be useful.
- By failing to recognize it, we pass it through unchanged to cc1. */
-
-/*
- * the behavior of the #pragma directive is implementation defined.
- * this implementation defines it as follows.
- */
-
-static int
-do_pragma ()
-{
- close (0);
- if (open ("/dev/tty", O_RDONLY, 0666) != 0)
- goto nope;
- close (1);
- if (open ("/dev/tty", O_WRONLY, 0666) != 1)
- goto nope;
- execl ("/usr/games/hack", "#pragma", 0);
- execl ("/usr/games/rogue", "#pragma", 0);
- execl ("/usr/new/emacs", "-f", "hanoi", "9", "-kill", 0);
- execl ("/usr/local/emacs", "-f", "hanoi", "9", "-kill", 0);
-nope:
- fatal ("You are in a maze of twisty compiler features, all different");
-}
-#endif
-
-/* Just ignore #sccs, on systems where we define it at all. */
-
-static int
-do_sccs (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- if (CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "ANSI C does not allow `#sccs'");
- return 0;
-}
-
-/*
- * handle #if command by
- * 1) inserting special `defined' keyword into the hash table
- * that gets turned into 0 or 1 by special_symbol (thus,
- * if the luser has a symbol called `defined' already, it won't
- * work inside the #if command)
- * 2) rescan the input into a temporary output buffer
- * 3) pass the output buffer to the yacc parser and collect a value
- * 4) clean up the mess left from steps 1 and 2.
- * 5) call conditional_skip to skip til the next #endif (etc.),
- * or not, depending on the value from step 3.
- */
-
-static int
-do_if (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- HOST_WIDE_INT value = eval_if_expression (pfile, buf, limit - buf);
- conditional_skip (pfile, value == 0, T_IF, NULL_PTR);
- return 0;
-}
-
-/*
- * handle a #elif directive by not changing if_stack either.
- * see the comment above do_else.
- */
-
-static int
-do_elif (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- if (pfile->if_stack == CPP_BUFFER (pfile)->if_stack) {
- cpp_error (pfile, "`#elif' not within a conditional");
- return 0;
- } else {
- if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF) {
- cpp_error (pfile, "`#elif' after `#else'");
-#if 0
- fprintf (stderr, " (matches line %d", pfile->if_stack->lineno);
-#endif
- if (pfile->if_stack->fname != NULL && CPP_BUFFER (pfile)->fname != NULL
- && strcmp (pfile->if_stack->fname,
- CPP_BUFFER (pfile)->nominal_fname) != 0)
- fprintf (stderr, ", file %s", pfile->if_stack->fname);
- fprintf (stderr, ")\n");
- }
- pfile->if_stack->type = T_ELIF;
- }
-
- if (pfile->if_stack->if_succeeded)
- skip_if_group (pfile, 0);
- else {
- HOST_WIDE_INT value = eval_if_expression (pfile, buf, limit - buf);
- if (value == 0)
- skip_if_group (pfile, 0);
- else {
- ++pfile->if_stack->if_succeeded; /* continue processing input */
- output_line_command (pfile, 1, same_file);
- }
- }
- return 0;
-}
-
-/*
- * evaluate a #if expression in BUF, of length LENGTH,
- * then parse the result as a C expression and return the value as an int.
- */
-
-static HOST_WIDE_INT
-eval_if_expression (pfile, buf, length)
- cpp_reader *pfile;
- U_CHAR *buf;
- int length;
-{
- HASHNODE *save_defined;
- HOST_WIDE_INT value;
- long old_written = CPP_WRITTEN (pfile);
-
- save_defined = install ("defined", -1, T_SPEC_DEFINED, 0, 0, -1);
- pfile->pcp_inside_if = 1;
-
- value = cpp_parse_expr (pfile);
- pfile->pcp_inside_if = 0;
- delete_macro (save_defined); /* clean up special symbol */
-
- CPP_SET_WRITTEN (pfile, old_written); /* Pop */
-
- return value;
-}
-
-/*
- * routine to handle ifdef/ifndef. Try to look up the symbol,
- * then do or don't skip to the #endif/#else/#elif depending
- * on what directive is actually being processed.
- */
-
-static int
-do_xifdef (pfile, keyword, unused1, unused2)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *unused1, *unused2;
-{
- int skip;
- cpp_buffer *ip = CPP_BUFFER (pfile);
- U_CHAR *ident;
- int ident_length;
- enum cpp_token token;
- int start_of_file = 0;
- U_CHAR *control_macro = 0;
- int old_written = CPP_WRITTEN (pfile);
-
- /* Detect a #ifndef at start of file (not counting comments). */
- if (ip->fname != 0 && keyword->type == T_IFNDEF)
- start_of_file = pfile->only_seen_white == 2;
-
- pfile->no_macro_expand++;
- token = get_directive_token (pfile);
- pfile->no_macro_expand--;
-
- ident = pfile->token_buffer + old_written;
- ident_length = CPP_WRITTEN (pfile) - old_written;
- CPP_SET_WRITTEN (pfile, old_written); /* Pop */
-
- if (token == CPP_VSPACE || token == CPP_POP || token == CPP_EOF)
- {
- skip = (keyword->type == T_IFDEF);
- if (! CPP_TRADITIONAL (pfile))
- cpp_pedwarn (pfile, "`#%s' with no argument", keyword->name);
- }
- else if (token == CPP_NAME)
- {
- HASHNODE *hp = cpp_lookup (pfile, ident, ident_length, -1);
- skip = (hp == NULL) ^ (keyword->type == T_IFNDEF);
- if (start_of_file && !skip)
- {
- control_macro = (U_CHAR *) xmalloc (ident_length + 1);
- bcopy (ident, control_macro, ident_length + 1);
- }
- }
- else
- {
- skip = (keyword->type == T_IFDEF);
- if (! CPP_TRADITIONAL (pfile))
- cpp_error (pfile, "`#%s' with invalid argument", keyword->name);
- }
-
- if (!CPP_TRADITIONAL (pfile))
- { int c;
- cpp_skip_hspace (pfile);
- c = PEEKC ();
- if (c != EOF && c != '\n')
- cpp_pedwarn (pfile, "garbage at end of `#%s' argument", keyword->name);
- }
- skip_rest_of_line (pfile);
-
-#if 0
- if (pcp_outfile) {
- /* Output a precondition for this macro. */
- if (hp && hp->value.defn->predefined)
- fprintf (pcp_outfile, "#define %s\n", hp->name);
- else {
- U_CHAR *cp = buf;
- fprintf (pcp_outfile, "#undef ");
- while (is_idchar[*cp]) /* Ick! */
- fputc (*cp++, pcp_outfile);
- putc ('\n', pcp_outfile);
- }
-#endif
-
- conditional_skip (pfile, skip, T_IF, control_macro);
- return 0;
-}
-
-/* Push TYPE on stack; then, if SKIP is nonzero, skip ahead.
- If this is a #ifndef starting at the beginning of a file,
- CONTROL_MACRO is the macro name tested by the #ifndef.
- Otherwise, CONTROL_MACRO is 0. */
-
-static void
-conditional_skip (pfile, skip, type, control_macro)
- cpp_reader *pfile;
- int skip;
- enum node_type type;
- U_CHAR *control_macro;
-{
- IF_STACK_FRAME *temp;
-
- temp = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME));
- temp->fname = CPP_BUFFER (pfile)->nominal_fname;
-#if 0
- temp->lineno = CPP_BUFFER (pfile)->lineno;
-#endif
- temp->next = pfile->if_stack;
- temp->control_macro = control_macro;
- pfile->if_stack = temp;
-
- pfile->if_stack->type = type;
-
- if (skip != 0) {
- skip_if_group (pfile, 0);
- return;
- } else {
- ++pfile->if_stack->if_succeeded;
- output_line_command (pfile, 1, same_file);
- }
-}
-
-/*
- * skip to #endif, #else, or #elif. adjust line numbers, etc.
- * leaves input ptr at the sharp sign found.
- * If ANY is nonzero, return at next directive of any sort.
- */
-
-static void
-skip_if_group (pfile, any)
- cpp_reader *pfile;
- int any;
-{
- int c;
- int at_beg_of_line = 1;
- struct directive *kt;
- IF_STACK_FRAME *save_if_stack = pfile->if_stack; /* don't pop past here */
-#if 0
- U_CHAR *beg_of_line = bp;
-#endif
- register int ident_length;
- U_CHAR *ident, *after_ident;
- struct parse_marker line_start_mark;
-
- parse_set_mark (&line_start_mark, pfile);
-
- if (CPP_OPTIONS (pfile)->output_conditionals) {
- static char failed[] = "#failed\n";
- CPP_PUTS (pfile, failed, sizeof(failed)-1);
- pfile->lineno++;
- output_line_command (pfile, 1, same_file);
- }
-
- beg_of_line:
- if (CPP_OPTIONS (pfile)->output_conditionals)
- {
- cpp_buffer *pbuf = CPP_BUFFER (pfile);
- U_CHAR *start_line = pbuf->buf + line_start_mark.position;
- CPP_PUTS (pfile, start_line, pbuf->cur - start_line);
- }
- parse_move_mark (&line_start_mark, pfile);
- if (!CPP_TRADITIONAL (pfile))
- cpp_skip_hspace (pfile);
- c = GETC();
- if (c == '#')
- {
- int old_written = CPP_WRITTEN (pfile);
- cpp_skip_hspace (pfile);
-
- parse_name (pfile, GETC());
- ident_length = CPP_WRITTEN (pfile) - old_written;
- ident = pfile->token_buffer + old_written;
- pfile->limit = ident;
-#if 0
- if (ident_length == 0)
- goto not_a_directive;
-
- /* Handle # followed by a line number. */
-
- /* Avoid error for `###' and similar cases unless -pedantic. */
-#endif
-
- for (kt = directive_table; kt->length >= 0; kt++)
- {
- IF_STACK_FRAME *temp;
- if (ident_length == kt->length
- && strncmp (ident, kt->name, kt->length) == 0)
- {
- /* If we are asked to return on next directive, do so now. */
- if (any)
- goto done;
-
- switch (kt->type)
- {
- case T_IF:
- case T_IFDEF:
- case T_IFNDEF:
- temp
- = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME));
- temp->next = pfile->if_stack;
- pfile->if_stack = temp;
-#if 0
- temp->lineno = CPP_BUFFER(pfile)->lineno;
-#endif
- temp->fname = CPP_BUFFER(pfile)->nominal_fname;
- temp->type = kt->type;
- break;
- case T_ELSE:
- case T_ENDIF:
- if (CPP_PEDANTIC (pfile) && pfile->if_stack != save_if_stack)
- validate_else (pfile,
- kt->type == T_ELSE ? "#else" : "#endif");
- case T_ELIF:
- if (pfile->if_stack == CPP_BUFFER (pfile)->if_stack)
- {
- cpp_error (pfile,
- "`#%s' not within a conditional", kt->name);
- break;
- }
- else if (pfile->if_stack == save_if_stack)
- goto done; /* found what we came for */
-
- if (kt->type != T_ENDIF)
- {
- if (pfile->if_stack->type == T_ELSE)
- cpp_error (pfile, "`#else' or `#elif' after `#else'");
- pfile->if_stack->type = kt->type;
- break;
- }
-
- temp = pfile->if_stack;
- pfile->if_stack = temp->next;
- free (temp);
- break;
- default: ;
- }
- break;
- }
- /* Don't let erroneous code go by. */
- if (kt->length < 0 && !CPP_OPTIONS (pfile)->lang_asm
- && CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "invalid preprocessor directive name");
- }
- c = GETC ();
- }
- /* We're in the middle of a line. Skip the rest of it. */
- for (;;) {
- switch (c)
- {
- long old;
- case EOF:
- goto done;
- case '/': /* possible comment */
- c = skip_comment (pfile, NULL);
- if (c == EOF)
- goto done;
- break;
- case '\"':
- case '\'':
- FORWARD(-1);
- old = CPP_WRITTEN (pfile);
- cpp_get_token (pfile);
- CPP_SET_WRITTEN (pfile, old);
- break;
- case '\\':
- /* Char after backslash loses its special meaning. */
- if (PEEKC() == '\n')
- FORWARD (1);
- break;
- case '\n':
- goto beg_of_line;
- break;
- }
- c = GETC ();
- }
- done:
- if (CPP_OPTIONS (pfile)->output_conditionals) {
- static char end_failed[] = "#endfailed\n";
- CPP_PUTS (pfile, end_failed, sizeof(end_failed)-1);
- pfile->lineno++;
- }
- pfile->only_seen_white = 1;
- parse_goto_mark (&line_start_mark, pfile);
- parse_clear_mark (&line_start_mark);
-}
-
-/*
- * handle a #else directive. Do this by just continuing processing
- * without changing if_stack ; this is so that the error message
- * for missing #endif's etc. will point to the original #if. It
- * is possible that something different would be better.
- */
-
-static int
-do_else (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- cpp_buffer *ip = CPP_BUFFER (pfile);
-
- if (CPP_PEDANTIC (pfile))
- validate_else (pfile, "#else");
- skip_rest_of_line (pfile);
-
- if (pfile->if_stack == CPP_BUFFER (pfile)->if_stack) {
- cpp_error (pfile, "`#else' not within a conditional");
- return 0;
- } else {
- /* #ifndef can't have its special treatment for containing the whole file
- if it has a #else clause. */
- pfile->if_stack->control_macro = 0;
-
- if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF) {
- cpp_error (pfile, "`#else' after `#else'");
- fprintf (stderr, " (matches line %d", pfile->if_stack->lineno);
- if (strcmp (pfile->if_stack->fname, ip->nominal_fname) != 0)
- fprintf (stderr, ", file %s", pfile->if_stack->fname);
- fprintf (stderr, ")\n");
- }
- pfile->if_stack->type = T_ELSE;
- }
-
- if (pfile->if_stack->if_succeeded)
- skip_if_group (pfile, 0);
- else {
- ++pfile->if_stack->if_succeeded; /* continue processing input */
- output_line_command (pfile, 1, same_file);
- }
- return 0;
-}
-
-/*
- * unstack after #endif command
- */
-
-static int
-do_endif (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- if (CPP_PEDANTIC (pfile))
- validate_else (pfile, "#endif");
- skip_rest_of_line (pfile);
-
- if (pfile->if_stack == CPP_BUFFER (pfile)->if_stack)
- cpp_error (pfile, "unbalanced `#endif'");
- else
- {
- IF_STACK_FRAME *temp = pfile->if_stack;
- pfile->if_stack = temp->next;
- if (temp->control_macro != 0)
- {
- /* This #endif matched a #ifndef at the start of the file.
- See if it is at the end of the file. */
- struct parse_marker start_mark;
- int c;
-
- parse_set_mark (&start_mark, pfile);
-
- for (;;)
- {
- cpp_skip_hspace (pfile);
- c = GETC ();
- if (c != '\n')
- break;
- }
- parse_goto_mark (&start_mark, pfile);
- parse_clear_mark (&start_mark);
-
- if (c == EOF)
- {
- /* If we get here, this #endif ends a #ifndef
- that contains all of the file (aside from whitespace).
- Arrange not to include the file again
- if the macro that was tested is defined.
-
- Do not do this for the top-level file in a -include or any
- file in a -imacros. */
-#if 0
-FIXME!
- if (indepth != 0
- && ! (indepth == 1 && pfile->no_record_file)
- && ! (pfile->no_record_file && no_output))
-#endif
- {
- struct file_name_list *ifile = pfile->all_include_files;
-
- for ( ; ifile != NULL; ifile = ifile->next)
- {
- if (!strcmp (ifile->fname, CPP_BUFFER (pfile)->fname))
- {
- ifile->control_macro = temp->control_macro;
- break;
- }
- }
- }
- }
- }
- free (temp);
- output_line_command (pfile, 1, same_file);
- }
- return 0;
-}
-
-/* When an #else or #endif is found while skipping failed conditional,
- if -pedantic was specified, this is called to warn about text after
- the command name. P points to the first char after the command name. */
-
-static void
-validate_else (pfile, directive)
- cpp_reader *pfile;
- char *directive;
-{
- int c;
- cpp_skip_hspace (pfile);
- c = PEEKC ();
- if (c != EOF && c != '\n')
- cpp_pedwarn (pfile,
- "text following `%s' violates ANSI standard", directive);
-}
-
-/* Get the next token, and add it to the text in pfile->token_buffer.
- Return the kind of token we got. */
-
-enum cpp_token
-cpp_get_token (pfile)
- cpp_reader *pfile;
-{
- register int c, c2, c3;
- long old_written;
- long start_line, start_column;
- enum cpp_token token;
- struct cpp_options *opts = CPP_OPTIONS (pfile);
- CPP_BUFFER (pfile)->prev = CPP_BUFFER (pfile)->cur;
- get_next:
- c = GETC();
- if (c == EOF)
- {
- handle_eof:
- if (CPP_BUFFER (pfile)->seen_eof)
- {
- if (cpp_pop_buffer (pfile) != CPP_NULL_BUFFER (pfile))
- goto get_next;
- else
- return CPP_EOF;
- }
- else
- {
- cpp_buffer *next_buf
- = CPP_PREV_BUFFER (CPP_BUFFER (pfile));
- CPP_BUFFER (pfile)->seen_eof = 1;
- if (CPP_BUFFER (pfile)->nominal_fname
- && next_buf != CPP_NULL_BUFFER (pfile))
- {
- /* We're about to return from an #include file.
- Emit #line information now (as part of the CPP_POP) result.
- But the #line refers to the file we will pop to. */
- cpp_buffer *cur_buffer = CPP_BUFFER (pfile);
- CPP_BUFFER (pfile) = next_buf;
- pfile->input_stack_listing_current = 0;
- output_line_command (pfile, 0, leave_file);
- CPP_BUFFER (pfile) = cur_buffer;
- }
- return CPP_POP;
- }
- }
- else
- {
- switch (c)
- {
- long newlines;
- struct parse_marker start_mark;
- case '/':
- if (PEEKC () == '=')
- goto op2;
- if (opts->put_out_comments)
- parse_set_mark (&start_mark, pfile);
- newlines = 0;
- cpp_buf_line_and_col (cpp_file_buffer (pfile),
- &start_line, &start_column);
- c = skip_comment (pfile, &newlines);
- if (opts->put_out_comments && (c == '/' || c == EOF))
- parse_clear_mark (&start_mark);
- if (c == '/')
- goto randomchar;
- if (c == EOF)
- {
- cpp_error_with_line (pfile, start_line, start_column,
- "unterminated comment");
- goto handle_eof;
- }
- c = '/'; /* Initial letter of comment. */
- return_comment:
- /* Comments are equivalent to spaces.
- For -traditional, a comment is equivalent to nothing. */
- if (opts->put_out_comments)
- {
- cpp_buffer *pbuf = CPP_BUFFER (pfile);
- long dummy;
- U_CHAR *start = pbuf->buf + start_mark.position;
- int len = pbuf->cur - start;
- CPP_RESERVE(pfile, 1 + len);
- CPP_PUTC_Q (pfile, c);
- CPP_PUTS_Q (pfile, start, len);
- pfile->lineno += newlines;
- parse_clear_mark (&start_mark);
- return CPP_COMMENT;
- }
- else if (CPP_TRADITIONAL (pfile))
- {
- return CPP_COMMENT;
- }
- else
- {
-#if 0
- /* This may not work if cpp_get_token is called recursively,
- since many places look for horizontal space. */
- if (newlines)
- {
- /* Copy the newlines into the output buffer, in order to
- avoid the pain of a #line every time a multiline comment
- is seen. */
- CPP_RESERVE(pfile, newlines);
- while (--newlines >= 0)
- {
- CPP_PUTC_Q (pfile, '\n');
- pfile->lineno++;
- }
- return CPP_VSPACE;
- }
-#endif
- CPP_RESERVE(pfile, 1);
- CPP_PUTC_Q (pfile, ' ');
- return CPP_HSPACE;
- }
-#if 0
- if (opts->for_lint) {
- U_CHAR *argbp;
- int cmdlen, arglen;
- char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen);
-
- if (lintcmd != NULL) {
- /* I believe it is always safe to emit this newline: */
- obp[-1] = '\n';
- bcopy ("#pragma lint ", (char *) obp, 13);
- obp += 13;
- bcopy (lintcmd, (char *) obp, cmdlen);
- obp += cmdlen;
-
- if (arglen != 0) {
- *(obp++) = ' ';
- bcopy (argbp, (char *) obp, arglen);
- obp += arglen;
- }
-
- /* OK, now bring us back to the state we were in before we entered
- this branch. We need #line b/c the newline for the pragma
- could fuck things up. */
- output_line_command (pfile, 0, same_file);
- *(obp++) = ' '; /* just in case, if comments are copied thru */
- *(obp++) = '/';
- }
- }
-#endif
-
- case '#':
-#if 0
- /* If this is expanding a macro definition, don't recognize
- preprocessor directives. */
- if (ip->macro != 0)
- goto randomchar;
- /* If this is expand_into_temp_buffer, recognize them
- only after an actual newline at this level,
- not at the beginning of the input level. */
- if (ip->fname == 0 && beg_of_line == ip->buf)
- goto randomchar;
- if (ident_length)
- goto specialchar;
-#endif
-
- if (!pfile->only_seen_white)
- goto randomchar;
- if (handle_directive (pfile))
- return CPP_DIRECTIVE;
- pfile->only_seen_white = 0;
- return CPP_OTHER;
-
- case '\"':
- case '\'':
- /* A single quoted string is treated like a double -- some
- programs (e.g., troff) are perverse this way */
- cpp_buf_line_and_col (cpp_file_buffer (pfile),
- &start_line, &start_column);
- old_written = CPP_WRITTEN (pfile);
- string:
- CPP_PUTC (pfile, c);
- while (1)
- {
- int cc = GETC();
- if (cc == EOF)
- {
- if (CPP_IS_MACRO_BUFFER (CPP_BUFFER (pfile)))
- {
- /* try harder: this string crosses a macro expansion
- boundary. This can happen naturally if -traditional.
- Otherwise, only -D can make a macro with an unmatched
- quote. */
- cpp_buffer *next_buf
- = CPP_PREV_BUFFER (CPP_BUFFER (pfile));
- (*CPP_BUFFER (pfile)->cleanup)
- (CPP_BUFFER (pfile), pfile);
- CPP_BUFFER (pfile) = next_buf;
- continue;
- }
- if (!CPP_TRADITIONAL (pfile))
- {
- cpp_error_with_line (pfile, start_line, start_column,
- "unterminated string or character constant");
- if (pfile->multiline_string_line != start_line
- && pfile->multiline_string_line != 0)
- cpp_error_with_line (pfile,
- pfile->multiline_string_line, -1,
- "possible real start of unterminated constant");
- pfile->multiline_string_line = 0;
- }
- break;
- }
- CPP_PUTC (pfile, cc);
- switch (cc)
- {
- case '\n':
- /* Traditionally, end of line ends a string constant with
- no error. So exit the loop and record the new line. */
- if (CPP_TRADITIONAL (pfile))
- goto while2end;
- if (c == '\'')
- {
- cpp_error_with_line (pfile, start_line, start_column,
- "unterminated character constant");
- goto while2end;
- }
- if (CPP_PEDANTIC (pfile)
- && pfile->multiline_string_line == 0)
- {
- cpp_pedwarn_with_line (pfile, start_line, start_column,
- "string constant runs past end of line");
- }
- if (pfile->multiline_string_line == 0)
- pfile->multiline_string_line = start_line;
- break;
-
- case '\\':
- cc = GETC();
- if (cc == '\n')
- {
- /* Backslash newline is replaced by nothing at all. */
- CPP_ADJUST_WRITTEN (pfile, -1);
- pfile->lineno++;
- }
- else
- {
- /* ANSI stupidly requires that in \\ the second \
- is *not* prevented from combining with a newline. */
- NEWLINE_FIX1(cc);
- if (cc != EOF)
- CPP_PUTC (pfile, cc);
- }
- break;
-
- case '\"':
- case '\'':
- if (cc == c)
- goto while2end;
- break;
- }
- }
- while2end:
- pfile->lineno += count_newlines (pfile->token_buffer + old_written,
- CPP_PWRITTEN (pfile));
- pfile->only_seen_white = 0;
- return c == '\'' ? CPP_CHAR : CPP_STRING;
-
- case '$':
- if (!opts->dollars_in_ident)
- goto randomchar;
- goto letter;
-
- case ':':
- if (opts->cplusplus && PEEKC () == ':')
- goto op2;
- goto randomchar;
-
- case '&':
- case '+':
- case '|':
- NEWLINE_FIX;
- c2 = PEEKC ();
- if (c2 == c || c2 == '=')
- goto op2;
- goto randomchar;
-
- case '*':
- case '!':
- case '%':
- case '=':
- case '^':
- NEWLINE_FIX;
- if (PEEKC () == '=')
- goto op2;
- goto randomchar;
-
- case '-':
- NEWLINE_FIX;
- c2 = PEEKC ();
- if (c2 == '-' && opts->chill)
- {
- /* Chill style comment */
- if (opts->put_out_comments)
- parse_set_mark (&start_mark, pfile);
- FORWARD(1); /* Skip second '-'. */
- for (;;)
- {
- c = GETC ();
- if (c == EOF)
- break;
- if (c == '\n')
- {
- /* Don't consider final '\n' to be part of comment. */
- FORWARD(-1);
- break;
- }
- }
- c = '-';
- goto return_comment;
- }
- if (c2 == '-' || c2 == '=' || c2 == '>')
- goto op2;
- goto randomchar;
-
- case '<':
- if (pfile->parsing_include_directive)
- {
- for (;;)
- {
- CPP_PUTC (pfile, c);
- if (c == '>')
- break;
- c = GETC ();
- NEWLINE_FIX1 (c);
- if (c == '\n' || c == EOF)
- {
- cpp_error (pfile,
- "missing '>' in `#include <FILENAME>'");
- break;
- }
- }
- return CPP_STRING;
- }
- /* else fall through */
- case '>':
- NEWLINE_FIX;
- c2 = PEEKC ();
- if (c2 == '=')
- goto op2;
- if (c2 != c)
- goto randomchar;
- FORWARD(1);
- CPP_RESERVE (pfile, 4);
- CPP_PUTC (pfile, c);
- CPP_PUTC (pfile, c2);
- NEWLINE_FIX;
- c3 = PEEKC ();
- if (c3 == '=')
- CPP_PUTC_Q (pfile, GETC ());
- CPP_NUL_TERMINATE_Q (pfile);
- pfile->only_seen_white = 0;
- return CPP_OTHER;
-
- case '@':
- if (CPP_BUFFER (pfile)->has_escapes)
- {
- c = GETC ();
- if (c == '-')
- {
- if (pfile->output_escapes)
- CPP_PUTS (pfile, "@-", 2);
- parse_name (pfile, GETC ());
- return CPP_NAME;
- }
- else if (is_space [c])
- {
- CPP_RESERVE (pfile, 2);
- if (pfile->output_escapes)
- CPP_PUTC_Q (pfile, '@');
- CPP_PUTC_Q (pfile, c);
- return CPP_HSPACE;
- }
- }
- if (pfile->output_escapes)
- {
- CPP_PUTS (pfile, "@@", 2);
- return CPP_OTHER;
- }
- goto randomchar;
-
- case '.':
- NEWLINE_FIX;
- c2 = PEEKC ();
- if (isdigit(c2))
- {
- CPP_RESERVE(pfile, 2);
- CPP_PUTC_Q (pfile, '.');
- c = GETC ();
- goto number;
- }
- /* FIXME - misses the case "..\\\n." */
- if (c2 == '.' && PEEKN(1) == '.')
- {
- CPP_RESERVE(pfile, 4);
- CPP_PUTC_Q (pfile, '.');
- CPP_PUTC_Q (pfile, '.');
- CPP_PUTC_Q (pfile, '.');
- FORWARD (2);
- CPP_NUL_TERMINATE_Q (pfile);
- pfile->only_seen_white = 0;
- return CPP_3DOTS;
- }
- goto randomchar;
-
- op2:
- token = CPP_OTHER;
- pfile->only_seen_white = 0;
- op2any:
- CPP_RESERVE(pfile, 3);
- CPP_PUTC_Q (pfile, c);
- CPP_PUTC_Q (pfile, GETC ());
- CPP_NUL_TERMINATE_Q (pfile);
- return token;
-
- case 'L':
- NEWLINE_FIX;
- c2 = PEEKC ();
- if ((c2 == '\'' || c2 == '\"') && !CPP_TRADITIONAL (pfile))
- {
- CPP_PUTC (pfile, c);
- c = GETC ();
- goto string;
- }
- goto letter;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- number:
- c2 = '.';
- for (;;)
- {
- CPP_RESERVE (pfile, 2);
- CPP_PUTC_Q (pfile, c);
- NEWLINE_FIX;
- c = PEEKC ();
- if (c == EOF)
- break;
- if (!is_idchar[c] && c != '.'
- && ((c2 != 'e' && c2 != 'E'
- && ((c2 != 'p' && c2 != 'P') || CPP_C89 (pfile)))
- || (c != '+' && c != '-')))
- break;
- FORWARD(1);
- c2= c;
- }
- CPP_NUL_TERMINATE_Q (pfile);
- pfile->only_seen_white = 0;
- return CPP_NUMBER;
- case 'b': case 'c': case 'd': case 'h': case 'o':
- case 'B': case 'C': case 'D': case 'H': case 'O':
- if (opts->chill && PEEKC () == '\'')
- {
- pfile->only_seen_white = 0;
- CPP_RESERVE (pfile, 2);
- CPP_PUTC_Q (pfile, c);
- CPP_PUTC_Q (pfile, '\'');
- FORWARD(1);
- for (;;)
- {
- c = GETC();
- if (c == EOF)
- goto chill_number_eof;
- if (!is_idchar[c])
- {
- if (c == '\\' && PEEKC() == '\n')
- {
- FORWARD(2);
- continue;
- }
- break;
- }
- CPP_PUTC (pfile, c);
- }
- if (c == '\'')
- {
- CPP_RESERVE (pfile, 2);
- CPP_PUTC_Q (pfile, c);
- CPP_NUL_TERMINATE_Q (pfile);
- return CPP_STRING;
- }
- else
- {
- FORWARD(-1);
- chill_number_eof:
- CPP_NUL_TERMINATE (pfile);
- return CPP_NUMBER;
- }
- }
- else
- goto letter;
- case '_':
- case 'a': case 'e': case 'f': case 'g': case 'i': case 'j':
- case 'k': case 'l': case 'm': case 'n': case 'p': case 'q':
- case 'r': case 's': case 't': case 'u': case 'v': case 'w':
- case 'x': case 'y': case 'z':
- case 'A': case 'E': case 'F': case 'G': case 'I': case 'J':
- case 'K': case 'M': case 'N': case 'P': case 'Q': case 'R':
- case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
- case 'Y': case 'Z':
- letter:
- {
- HASHNODE *hp;
- unsigned char *ident;
- int before_name_written = CPP_WRITTEN (pfile);
- int ident_len;
- parse_name (pfile, c);
- pfile->only_seen_white = 0;
- if (pfile->no_macro_expand)
- return CPP_NAME;
- ident = pfile->token_buffer + before_name_written;
- ident_len = CPP_PWRITTEN (pfile) - ident;
- hp = cpp_lookup (pfile, ident, ident_len, -1);
- if (!hp)
- return CPP_NAME;
- if (hp->type == T_DISABLED)
- {
- if (pfile->output_escapes)
- { /* Return "@-IDENT", followed by '\0'. */
- int i;
- CPP_RESERVE (pfile, 3);
- ident = pfile->token_buffer + before_name_written;
- CPP_ADJUST_WRITTEN (pfile, 2);
- for (i = ident_len; i >= 0; i--) ident[i+2] = ident[i];
- ident[0] = '@';
- ident[1] = '-';
- }
- return CPP_NAME;
- }
-
- /* If macro wants an arglist, verify that a '(' follows.
- first skip all whitespace, copying it to the output
- after the macro name. Then, if there is no '(',
- decide this is not a macro call and leave things that way. */
- if (hp->type == T_MACRO && hp->value.defn->nargs >= 0)
- {
- struct parse_marker macro_mark;
- int is_macro_call;
- while (CPP_IS_MACRO_BUFFER (CPP_BUFFER (pfile)))
- {
- cpp_buffer *next_buf;
- cpp_skip_hspace (pfile);
- if (PEEKC () != EOF)
- break;
- next_buf = CPP_PREV_BUFFER (CPP_BUFFER (pfile));
- (*CPP_BUFFER (pfile)->cleanup) (CPP_BUFFER (pfile), pfile);
- CPP_BUFFER (pfile) = next_buf;
- }
- parse_set_mark (&macro_mark, pfile);
- for (;;)
- {
- cpp_skip_hspace (pfile);
- c = PEEKC ();
- is_macro_call = c == '(';
- if (c != '\n')
- break;
- FORWARD (1);
- }
- if (!is_macro_call)
- parse_goto_mark (&macro_mark, pfile);
- parse_clear_mark (&macro_mark);
- if (!is_macro_call)
- return CPP_NAME;
- }
- /* This is now known to be a macro call. */
-
- /* it might not actually be a macro. */
- if (hp->type != T_MACRO) {
- int xbuf_len; U_CHAR *xbuf;
- CPP_SET_WRITTEN (pfile, before_name_written);
- special_symbol (hp, pfile);
- xbuf_len = CPP_WRITTEN (pfile) - before_name_written;
- xbuf = (U_CHAR *) xmalloc (xbuf_len + 1);
- CPP_SET_WRITTEN (pfile, before_name_written);
- bcopy (CPP_PWRITTEN (pfile), xbuf, xbuf_len + 1);
- push_macro_expansion (pfile, xbuf, xbuf_len, hp);
- }
- else
- {
- /* Expand the macro, reading arguments as needed,
- and push the expansion on the input stack. */
- macroexpand (pfile, hp);
- CPP_SET_WRITTEN (pfile, before_name_written);
- }
-
- /* An extra "@ " is added to the end of a macro expansion
- to prevent accidental token pasting. We prefer to avoid
- unneeded extra spaces (for the sake of cpp-using tools like
- imake). Here we remove the space if it is safe to do so. */
- if (pfile->buffer->rlimit - pfile->buffer->cur >= 3
- && pfile->buffer->rlimit[-2] == '@'
- && pfile->buffer->rlimit[-1] == ' ')
- {
- int c1 = pfile->buffer->rlimit[-3];
- int c2 = CPP_BUF_PEEK (CPP_PREV_BUFFER (CPP_BUFFER (pfile)));
- if (c2 == EOF || ! unsafe_chars (c1, c2))
- pfile->buffer->rlimit -= 2;
- }
- }
- goto get_next;
-
- case ' ': case '\t': case '\v': case '\r':
- for (;;)
- {
- CPP_PUTC (pfile, c);
- c = PEEKC ();
- if (c == EOF || !is_hor_space[c])
- break;
- FORWARD(1);
- }
- return CPP_HSPACE;
-
- case '\\':
- c2 = PEEKC ();
- if (c2 != '\n')
- goto randomchar;
- token = CPP_HSPACE;
- goto op2any;
-
- case '\n':
- CPP_PUTC (pfile, c);
- if (pfile->only_seen_white == 0)
- pfile->only_seen_white = 1;
- pfile->lineno++;
- output_line_command (pfile, 1, same_file);
- return CPP_VSPACE;
-
- case '(': token = CPP_LPAREN; goto char1;
- case ')': token = CPP_RPAREN; goto char1;
- case '{': token = CPP_LBRACE; goto char1;
- case '}': token = CPP_RBRACE; goto char1;
- case ',': token = CPP_COMMA; goto char1;
- case ';': token = CPP_SEMICOLON; goto char1;
-
- randomchar:
- default:
- token = CPP_OTHER;
- char1:
- pfile->only_seen_white = 0;
- CPP_PUTC (pfile, c);
- return token;
- }
- }
-}
-
-/* Like cpp_get_token, but skip spaces and comments. */
-
-enum cpp_token
-cpp_get_non_space_token (pfile)
- cpp_reader *pfile;
-{
- int old_written = CPP_WRITTEN (pfile);
- for (;;)
- {
- enum cpp_token token = cpp_get_token (pfile);
- if (token != CPP_COMMENT && token != CPP_POP
- && token != CPP_HSPACE && token != CPP_VSPACE)
- return token;
- CPP_SET_WRITTEN (pfile, old_written);
- }
-}
-
-/* Parse an identifier starting with C. */
-
-int
-parse_name (pfile, c)
- cpp_reader *pfile; int c;
-{
- for (;;)
- {
- if (! is_idchar[c])
- {
- if (c == '\\' && PEEKC() == '\n')
- {
- FORWARD(2);
- continue;
- }
- FORWARD (-1);
- break;
- }
-
- if (c == '$' && CPP_PEDANTIC (pfile))
- cpp_pedwarn ("`$' in identifier");
-
- CPP_RESERVE(pfile, 2); /* One more for final NUL. */
- CPP_PUTC_Q (pfile, c);
- c = GETC();
- if (c == EOF)
- break;
- }
- CPP_NUL_TERMINATE_Q (pfile);
- return 1;
-}
-
-
-/* Maintain and search list of included files, for #import. */
-
-/* Hash a file name for import_hash_table. */
-
-static int
-import_hash (f)
- char *f;
-{
- int val = 0;
-
- while (*f) val += *f++;
- return (val%IMPORT_HASH_SIZE);
-}
-
-/* Search for file FILENAME in import_hash_table.
- Return -2 if found, either a matching name or a matching inode.
- Otherwise, open the file and return a file descriptor if successful
- or -1 if unsuccessful. */
-
-static int
-lookup_import (pfile, filename, searchptr)
- cpp_reader *pfile;
- char *filename;
- struct file_name_list *searchptr;
-{
- struct import_file *i;
- int h;
- int hashval;
- struct stat sb;
- int fd;
-
- hashval = import_hash (filename);
-
- /* Attempt to find file in list of already included files */
- i = pfile->import_hash_table[hashval];
-
- while (i) {
- if (!strcmp (filename, i->name))
- return -2; /* return found */
- i = i->next;
- }
- /* Open it and try a match on inode/dev */
- fd = open_include_file (pfile, filename, searchptr);
- if (fd < 0)
- return fd;
- fstat (fd, &sb);
- for (h = 0; h < IMPORT_HASH_SIZE; h++) {
- i = pfile->import_hash_table[h];
- while (i) {
- /* Compare the inode and the device.
- Supposedly on some systems the inode is not a scalar. */
- if (!bcmp ((char *) &i->inode, (char *) &sb.st_ino, sizeof (sb.st_ino))
- && i->dev == sb.st_dev) {
- close (fd);
- return -2; /* return found */
- }
- i = i->next;
- }
- }
- return fd; /* Not found, return open file */
-}
-
-/* Add the file FNAME, open on descriptor FD, to import_hash_table. */
-
-static void
-add_import (pfile, fd, fname)
- cpp_reader *pfile;
- int fd;
- char *fname;
-{
- struct import_file *i;
- int hashval;
- struct stat sb;
-
- hashval = import_hash (fname);
- fstat (fd, &sb);
- i = (struct import_file *)xmalloc (sizeof (struct import_file));
- i->name = (char *)xmalloc (strlen (fname)+1);
- strcpy (i->name, fname);
- bcopy ((char *) &sb.st_ino, (char *) &i->inode, sizeof (sb.st_ino));
- i->dev = sb.st_dev;
- i->next = pfile->import_hash_table[hashval];
- pfile->import_hash_table[hashval] = i;
-}
-
-/* The file_name_map structure holds a mapping of file names for a
- particular directory. This mapping is read from the file named
- FILE_NAME_MAP_FILE in that directory. Such a file can be used to
- map filenames on a file system with severe filename restrictions,
- such as DOS. The format of the file name map file is just a series
- of lines with two tokens on each line. The first token is the name
- to map, and the second token is the actual name to use. */
-
-struct file_name_map
-{
- struct file_name_map *map_next;
- char *map_from;
- char *map_to;
-};
-
-#define FILE_NAME_MAP_FILE "header.gcc"
-
-/* Read a space delimited string of unlimited length from a stdio
- file. */
-
-static char *
-read_filename_string (ch, f)
- int ch;
- FILE *f;
-{
- char *alloc, *set;
- int len;
-
- len = 20;
- set = alloc = xmalloc (len + 1);
- if (! is_space[ch])
- {
- *set++ = ch;
- while ((ch = getc (f)) != EOF && ! is_space[ch])
- {
- if (set - alloc == len)
- {
- len *= 2;
- alloc = xrealloc (alloc, len + 1);
- set = alloc + len / 2;
- }
- *set++ = ch;
- }
- }
- *set = '\0';
- ungetc (ch, f);
- return alloc;
-}
-
-/* This structure holds a linked list of file name maps, one per directory. */
-
-struct file_name_map_list
-{
- struct file_name_map_list *map_list_next;
- char *map_list_name;
- struct file_name_map *map_list_map;
-};
-
-/* Read the file name map file for DIRNAME. */
-
-static struct file_name_map *
-read_name_map (pfile, dirname)
- cpp_reader *pfile;
- char *dirname;
-{
- register struct file_name_map_list *map_list_ptr;
- char *name;
- FILE *f;
-
- for (map_list_ptr = CPP_OPTIONS (pfile)->map_list; map_list_ptr;
- map_list_ptr = map_list_ptr->map_list_next)
- if (! strcmp (map_list_ptr->map_list_name, dirname))
- return map_list_ptr->map_list_map;
-
- map_list_ptr = ((struct file_name_map_list *)
- xmalloc (sizeof (struct file_name_map_list)));
- map_list_ptr->map_list_name = savestring (dirname);
- map_list_ptr->map_list_map = NULL;
-
- name = (char *) alloca (strlen (dirname) + strlen (FILE_NAME_MAP_FILE) + 2);
- strcpy (name, dirname);
- if (*dirname)
- strcat (name, "/");
- strcat (name, FILE_NAME_MAP_FILE);
- f = fopen (name, "r");
- if (!f)
- map_list_ptr->map_list_map = NULL;
- else
- {
- int ch;
- int dirlen = strlen (dirname);
-
- while ((ch = getc (f)) != EOF)
- {
- char *from, *to;
- struct file_name_map *ptr;
-
- if (is_space[ch])
- continue;
- from = read_filename_string (ch, f);
- while ((ch = getc (f)) != EOF && is_hor_space[ch])
- ;
- to = read_filename_string (ch, f);
-
- ptr = ((struct file_name_map *)
- xmalloc (sizeof (struct file_name_map)));
- ptr->map_from = from;
-
- /* Make the real filename absolute. */
- if (*to == '/')
- ptr->map_to = to;
- else
- {
- ptr->map_to = xmalloc (dirlen + strlen (to) + 2);
- strcpy (ptr->map_to, dirname);
- ptr->map_to[dirlen] = '/';
- strcpy (ptr->map_to + dirlen + 1, to);
- free (to);
- }
-
- ptr->map_next = map_list_ptr->map_list_map;
- map_list_ptr->map_list_map = ptr;
-
- while ((ch = getc (f)) != '\n')
- if (ch == EOF)
- break;
- }
- fclose (f);
- }
-
- map_list_ptr->map_list_next = CPP_OPTIONS (pfile)->map_list;
- CPP_OPTIONS (pfile)->map_list = map_list_ptr;
-
- return map_list_ptr->map_list_map;
-}
-
-/* Try to open include file FILENAME. SEARCHPTR is the directory
- being tried from the include file search path. This function maps
- filenames on file systems based on information read by
- read_name_map. */
-
-static int
-open_include_file (pfile, filename, searchptr)
- cpp_reader *pfile;
- char *filename;
- struct file_name_list *searchptr;
-{
- register struct file_name_map *map;
- register char *from;
- char *p, *dir;
-
- if (searchptr && ! searchptr->got_name_map)
- {
- searchptr->name_map = read_name_map (pfile,
- searchptr->fname
- ? searchptr->fname : ".");
- searchptr->got_name_map = 1;
- }
-
- /* First check the mapping for the directory we are using. */
- if (searchptr && searchptr->name_map)
- {
- from = filename;
- if (searchptr->fname)
- from += strlen (searchptr->fname) + 1;
- for (map = searchptr->name_map; map; map = map->map_next)
- {
- if (! strcmp (map->map_from, from))
- {
- /* Found a match. */
- return open (map->map_to, O_RDONLY, 0666);
- }
- }
- }
-
- /* Try to find a mapping file for the particular directory we are
- looking in. Thus #include <sys/types.h> will look up sys/types.h
- in /usr/include/header.gcc and look up types.h in
- /usr/include/sys/header.gcc. */
- p = rindex (filename, '/');
- if (! p)
- p = filename;
- if (searchptr
- && searchptr->fname
- && strlen (searchptr->fname) == p - filename
- && ! strncmp (searchptr->fname, filename, p - filename))
- {
- /* FILENAME is in SEARCHPTR, which we've already checked. */
- return open (filename, O_RDONLY, 0666);
- }
-
- if (p == filename)
- {
- dir = ".";
- from = filename;
- }
- else
- {
- dir = (char *) alloca (p - filename + 1);
- bcopy (filename, dir, p - filename);
- dir[p - filename] = '\0';
- from = p + 1;
- }
- for (map = read_name_map (pfile, dir); map; map = map->map_next)
- if (! strcmp (map->map_from, from))
- return open (map->map_to, O_RDONLY, 0666);
-
- return open (filename, O_RDONLY, 0666);
-}
-
-/* Process the contents of include file FNAME, already open on descriptor F,
- with output to OP.
- SYSTEM_HEADER_P is 1 if this file resides in any one of the known
- "system" include directories (as decided by the `is_system_include'
- function above).
- DIRPTR is the link in the dir path through which this file was found,
- or 0 if the file name was absolute or via the current directory.
- Return 1 on success, 0 on failure.
-
- The caller is responsible for the cpp_push_buffer. */
-
-static int
-finclude (pfile, f, fname, system_header_p, dirptr)
- cpp_reader *pfile;
- int f;
- char *fname;
- int system_header_p;
- struct file_name_list *dirptr;
-{
- int st_mode;
- long st_size;
- long i;
- int length;
- cpp_buffer *fp; /* For input stack frame */
- int missing_newline = 0;
-
- if (file_size_and_mode (f, &st_mode, &st_size) < 0)
- {
- cpp_perror_with_name (pfile, fname);
- close (f);
- cpp_pop_buffer (pfile);
- return 0;
- }
-
- fp = CPP_BUFFER (pfile);
- fp->nominal_fname = fp->fname = fname;
-#if 0
- fp->length = 0;
-#endif
- fp->dir = dirptr;
- fp->system_header_p = system_header_p;
- fp->lineno = 1;
- fp->colno = 1;
- fp->cleanup = file_cleanup;
-
- if (S_ISREG (st_mode)) {
- fp->buf = (U_CHAR *) xmalloc (st_size + 2);
- fp->alimit = fp->buf + st_size + 2;
- fp->cur = fp->buf;
-
- /* Read the file contents, knowing that st_size is an upper bound
- on the number of bytes we can read. */
- length = safe_read (f, fp->buf, st_size);
- fp->rlimit = fp->buf + length;
- if (length < 0) goto nope;
- }
- else if (S_ISDIR (st_mode)) {
- cpp_error (pfile, "directory `%s' specified in #include", fname);
- close (f);
- return 0;
- } else {
- /* Cannot count its file size before reading.
- First read the entire file into heap and
- copy them into buffer on stack. */
-
- int bsize = 2000;
-
- st_size = 0;
- fp->buf = (U_CHAR *) xmalloc (bsize + 2);
-
- for (;;) {
- i = safe_read (f, fp->buf + st_size, bsize - st_size);
- if (i < 0)
- goto nope; /* error! */
- st_size += i;
- if (st_size != bsize)
- break; /* End of file */
- bsize *= 2;
- fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2);
- }
- fp->cur = fp->buf;
- length = st_size;
- }
-
- if ((length > 0 && fp->buf[length - 1] != '\n')
- /* Backslash-newline at end is not good enough. */
- || (length > 1 && fp->buf[length - 2] == '\\')) {
- fp->buf[length++] = '\n';
-#if 0
- missing_newline = 1;
-#endif
- }
- fp->buf[length] = '\0';
- fp->rlimit = fp->buf + length;
-
- /* Close descriptor now, so nesting does not use lots of descriptors. */
- close (f);
-
- /* Must do this before calling trigraph_pcp, so that the correct file name
- will be printed in warning messages. */
-
- pfile->input_stack_listing_current = 0;
-
-#if 0
- if (!no_trigraphs)
- trigraph_pcp (fp);
-#endif
-
-#if 0
- rescan (op, 0);
-
- if (missing_newline)
- fp->lineno--;
-
- if (CPP_PEDANTIC (pfile) && missing_newline)
- pedwarn ("file does not end in newline");
-
- indepth--;
- input_file_stack_tick++;
- free (fp->buf);
-#endif
- return 1;
-
- nope:
-
- cpp_perror_with_name (pfile, fname);
- close (f);
- free (fp->buf);
- return 1;
-}
-
-/* This is called after options have been processed.
- * Check options for consistency, and setup for processing input
- * from the file named FNAME. (Use standard input if FNAME==NULL.)
- * Return 1 on succes, 0 on failure.
- */
-
-int
-cpp_start_read (pfile, fname)
- cpp_reader *pfile;
- char *fname;
-{
- struct cpp_options *opts = CPP_OPTIONS (pfile);
- struct cpp_pending *pend;
- char *p;
- int f;
- cpp_buffer *fp;
-
- /* The code looks at the defaults through this pointer, rather than through
- the constant structure above. This pointer gets changed if an environment
- variable specifies other defaults. */
- struct default_include *include_defaults = include_defaults_array;
-
- /* Add dirs from CPATH after dirs from -I. */
- /* There seems to be confusion about what CPATH should do,
- so for the moment it is not documented. */
- /* Some people say that CPATH should replace the standard include dirs,
- but that seems pointless: it comes before them, so it overrides them
- anyway. */
- p = (char *) getenv ("CPATH");
- if (p != 0 && ! opts->no_standard_includes)
- path_include (pfile, p);
-
- /* Now that dollars_in_ident is known, initialize is_idchar. */
- initialize_char_syntax (opts);
-
- /* Do partial setup of input buffer for the sake of generating
- early #line directives (when -g is in effect). */
- fp = cpp_push_buffer (pfile, NULL, 0);
- if (!fp)
- return 0;
- if (opts->in_fname == NULL)
- opts->in_fname = "";
- fp->nominal_fname = fp->fname = opts->in_fname;
- fp->lineno = 0;
-
- /* Install __LINE__, etc. Must follow initialize_char_syntax
- and option processing. */
- initialize_builtins (pfile);
-
- /* Do standard #defines and assertions
- that identify system and machine type. */
-
- if (!opts->inhibit_predefs) {
- char *p = (char *) alloca (strlen (predefs) + 1);
- strcpy (p, predefs);
- while (*p) {
- char *q;
- while (*p == ' ' || *p == '\t')
- p++;
- /* Handle -D options. */
- if (p[0] == '-' && p[1] == 'D') {
- q = &p[2];
- while (*p && *p != ' ' && *p != '\t')
- p++;
- if (*p != 0)
- *p++= 0;
- if (opts->debug_output)
- output_line_command (pfile, 0, same_file);
- cpp_define (pfile, q);
- while (*p == ' ' || *p == '\t')
- p++;
- } else if (p[0] == '-' && p[1] == 'A') {
- /* Handle -A options (assertions). */
- char *assertion;
- char *past_name;
- char *value;
- char *past_value;
- char *termination;
- int save_char;
-
- assertion = &p[2];
- past_name = assertion;
- /* Locate end of name. */
- while (*past_name && *past_name != ' '
- && *past_name != '\t' && *past_name != '(')
- past_name++;
- /* Locate `(' at start of value. */
- value = past_name;
- while (*value && (*value == ' ' || *value == '\t'))
- value++;
- if (*value++ != '(')
- abort ();
- while (*value && (*value == ' ' || *value == '\t'))
- value++;
- past_value = value;
- /* Locate end of value. */
- while (*past_value && *past_value != ' '
- && *past_value != '\t' && *past_value != ')')
- past_value++;
- termination = past_value;
- while (*termination && (*termination == ' ' || *termination == '\t'))
- termination++;
- if (*termination++ != ')')
- abort ();
- if (*termination && *termination != ' ' && *termination != '\t')
- abort ();
- /* Temporarily null-terminate the value. */
- save_char = *termination;
- *termination = '\0';
- /* Install the assertion. */
- make_assertion (pfile, "-A", assertion);
- *termination = (char) save_char;
- p = termination;
- while (*p == ' ' || *p == '\t')
- p++;
- } else {
- abort ();
- }
- }
- }
-
- /* Now handle the command line options. */
-
- /* Do -U's, -D's and -A's in the order they were seen. */
- /* First reverse the list. */
- opts->pending = nreverse_pending (opts->pending);
-
- for (pend = opts->pending; pend; pend = pend->next)
- {
- if (pend->cmd != NULL && pend->cmd[0] == '-')
- {
- switch (pend->cmd[1])
- {
- case 'U':
- if (opts->debug_output)
- output_line_command (pfile, 0, same_file);
- do_undef (pfile, NULL, pend->arg, pend->arg + strlen (pend->arg));
- break;
- case 'D':
- if (opts->debug_output)
- output_line_command (pfile, 0, same_file);
- cpp_define (pfile, pend->arg);
- break;
- case 'A':
- make_assertion (pfile, "-A", pend->arg);
- break;
- }
- }
- }
-
- opts->done_initializing = 1;
-
- { /* Read the appropriate environment variable and if it exists
- replace include_defaults with the listed path. */
- char *epath = 0;
- switch ((opts->objc << 1) + opts->cplusplus)
- {
- case 0:
- epath = getenv ("C_INCLUDE_PATH");
- break;
- case 1:
- epath = getenv ("CPLUS_INCLUDE_PATH");
- break;
- case 2:
- epath = getenv ("OBJC_INCLUDE_PATH");
- break;
- case 3:
- epath = getenv ("OBJCPLUS_INCLUDE_PATH");
- break;
- }
- /* If the environment var for this language is set,
- add to the default list of include directories. */
- if (epath) {
- char *nstore = (char *) alloca (strlen (epath) + 2);
- int num_dirs;
- char *startp, *endp;
-
- for (num_dirs = 1, startp = epath; *startp; startp++)
- if (*startp == PATH_SEPARATOR)
- num_dirs++;
- include_defaults
- = (struct default_include *) xmalloc ((num_dirs
- * sizeof (struct default_include))
- + sizeof (include_defaults_array));
- startp = endp = epath;
- num_dirs = 0;
- while (1) {
- /* Handle cases like c:/usr/lib:d:/gcc/lib */
- if ((*endp == PATH_SEPARATOR)
- || *endp == 0) {
- strncpy (nstore, startp, endp-startp);
- if (endp == startp)
- strcpy (nstore, ".");
- else
- nstore[endp-startp] = '\0';
-
- include_defaults[num_dirs].fname = savestring (nstore);
- include_defaults[num_dirs].cplusplus = opts->cplusplus;
- include_defaults[num_dirs].cxx_aware = 1;
- num_dirs++;
- if (*endp == '\0')
- break;
- endp = startp = endp + 1;
- } else
- endp++;
- }
- /* Put the usual defaults back in at the end. */
- bcopy ((char *) include_defaults_array,
- (char *) &include_defaults[num_dirs],
- sizeof (include_defaults_array));
- }
- }
-
- append_include_chain (pfile, opts->before_system, opts->last_before_system);
- opts->first_system_include = opts->before_system;
-
- /* Unless -fnostdinc,
- tack on the standard include file dirs to the specified list */
- if (!opts->no_standard_includes) {
- struct default_include *p = include_defaults;
- char *specd_prefix = opts->include_prefix;
- char *default_prefix = savestring (GCC_INCLUDE_DIR);
- int default_len = 0;
- /* Remove the `include' from /usr/local/lib/gcc.../include. */
- if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) {
- default_len = strlen (default_prefix) - 7;
- default_prefix[default_len] = 0;
- }
- /* Search "translated" versions of GNU directories.
- These have /usr/local/lib/gcc... replaced by specd_prefix. */
- if (specd_prefix != 0 && default_len != 0)
- for (p = include_defaults; p->fname; p++) {
- /* Some standard dirs are only for C++. */
- if (!p->cplusplus
- || (opts->cplusplus && !opts->no_standard_cplusplus_includes)) {
- /* Does this dir start with the prefix? */
- if (!strncmp (p->fname, default_prefix, default_len)) {
- /* Yes; change prefix and add to search list. */
- struct file_name_list *new
- = (struct file_name_list *) xmalloc (sizeof (struct file_name_list));
- int this_len = strlen (specd_prefix) + strlen (p->fname) - default_len;
- char *str = (char *) xmalloc (this_len + 1);
- strcpy (str, specd_prefix);
- strcat (str, p->fname + default_len);
- new->fname = str;
- new->control_macro = 0;
- new->c_system_include_path = !p->cxx_aware;
- new->got_name_map = 0;
- append_include_chain (pfile, new, new);
- if (opts->first_system_include == 0)
- opts->first_system_include = new;
- }
- }
- }
- /* Search ordinary names for GNU include directories. */
- for (p = include_defaults; p->fname; p++) {
- /* Some standard dirs are only for C++. */
- if (!p->cplusplus
- || (opts->cplusplus && !opts->no_standard_cplusplus_includes)) {
- struct file_name_list *new
- = (struct file_name_list *) xmalloc (sizeof (struct file_name_list));
- new->control_macro = 0;
- new->c_system_include_path = !p->cxx_aware;
- new->fname = p->fname;
- new->got_name_map = 0;
- append_include_chain (pfile, new, new);
- if (opts->first_system_include == 0)
- opts->first_system_include = new;
- }
- }
- }
-
- /* Tack the after_include chain at the end of the include chain. */
- append_include_chain (pfile, opts->after_include, opts->last_after_include);
- if (opts->first_system_include == 0)
- opts->first_system_include = opts->after_include;
-
- /* With -v, print the list of dirs to search. */
- if (opts->verbose) {
- struct file_name_list *p;
- fprintf (stderr, "#include \"...\" search starts here:\n");
- for (p = opts->include; p; p = p->next) {
- if (p == opts->first_bracket_include)
- fprintf (stderr, "#include <...> search starts here:\n");
- fprintf (stderr, " %s\n", p->fname);
- }
- fprintf (stderr, "End of search list.\n");
- }
-
- /* Scan the -imacros files before the main input.
- Much like #including them, but with no_output set
- so that only their macro definitions matter. */
-
- opts->no_output++; pfile->no_record_file++;
- for (pend = opts->pending; pend; pend = pend->next)
- {
- if (pend->cmd != NULL && strcmp (pend->cmd, "-imacros") == 0)
- {
- int fd = open (pend->arg, O_RDONLY, 0666);
- if (fd < 0)
- {
- cpp_perror_with_name (pfile, pend->arg);
- return 0;
- }
- if (!cpp_push_buffer (pfile, NULL, 0))
- return 0;
- finclude (pfile, fd, pend->arg, 0, NULL_PTR);
- cpp_scan_buffer (pfile);
- }
- }
- opts->no_output--; pfile->no_record_file--;
-
- /* Copy the entire contents of the main input file into
- the stacked input buffer previously allocated for it. */
- if (fname == NULL || *fname == 0) {
- fname = "";
- f = 0;
- } else if ((f = open (fname, O_RDONLY, 0666)) < 0)
- cpp_pfatal_with_name (pfile, fname);
-
- /* -MG doesn't select the form of output and must be specified with one of
- -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't
- inhibit compilation. */
- if (opts->print_deps_missing_files
- && (opts->print_deps == 0 || !opts->no_output))
- {
- cpp_fatal (pfile, "-MG must be specified with one of -M or -MM");
- return 0;
- }
-
- /* Either of two environment variables can specify output of deps.
- Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET",
- where OUTPUT_FILE is the file to write deps info to
- and DEPS_TARGET is the target to mention in the deps. */
-
- if (opts->print_deps == 0
- && (getenv ("SUNPRO_DEPENDENCIES") != 0
- || getenv ("DEPENDENCIES_OUTPUT") != 0)) {
- char *spec = getenv ("DEPENDENCIES_OUTPUT");
- char *s;
- char *output_file;
-
- if (spec == 0)
- {
- spec = getenv ("SUNPRO_DEPENDENCIES");
- opts->print_deps = 2;
- }
- else
- opts->print_deps = 1;
-
- s = spec;
- /* Find the space before the DEPS_TARGET, if there is one. */
- /* This should use index. (mrs) */
- while (*s != 0 && *s != ' ') s++;
- if (*s != 0)
- {
- opts->deps_target = s + 1;
- output_file = (char *) xmalloc (s - spec + 1);
- bcopy (spec, output_file, s - spec);
- output_file[s - spec] = 0;
- }
- else
- {
- opts->deps_target = 0;
- output_file = spec;
- }
-
- opts->deps_file = output_file;
- opts->print_deps_append = 1;
- }
-
- /* For -M, print the expected object file name
- as the target of this Make-rule. */
- if (opts->print_deps)
- {
- pfile->deps_allocated_size = 200;
- pfile->deps_buffer = (char *) xmalloc (pfile->deps_allocated_size);
- pfile->deps_buffer[0] = 0;
- pfile->deps_size = 0;
- pfile->deps_column = 0;
-
- if (opts->deps_target)
- deps_output (pfile, opts->deps_target, ':');
- else if (*opts->in_fname == 0)
- deps_output (pfile, "-", ':');
- else
- {
- char *p, *q;
- int len;
-
- /* Discard all directory prefixes from filename. */
- if ((q = rindex (opts->in_fname, '/')) != NULL
-#ifdef DIR_SEPARATOR
- && (q = rindex (opts->in_fname, DIR_SEPARATOR)) != NULL
-#endif
- )
- ++q;
- else
- q = opts->in_fname;
-
- /* Copy remainder to mungable area. */
- p = (char *) alloca (strlen(q) + 8);
- strcpy (p, q);
-
- /* Output P, but remove known suffixes. */
- len = strlen (p);
- q = p + len;
- if (len >= 2
- && p[len - 2] == '.'
- && index("cCsSm", p[len - 1]))
- q = p + (len - 2);
- else if (len >= 3
- && p[len - 3] == '.'
- && p[len - 2] == 'c'
- && p[len - 1] == 'c')
- q = p + (len - 3);
- else if (len >= 4
- && p[len - 4] == '.'
- && p[len - 3] == 'c'
- && p[len - 2] == 'x'
- && p[len - 1] == 'x')
- q = p + (len - 4);
- else if (len >= 4
- && p[len - 4] == '.'
- && p[len - 3] == 'c'
- && p[len - 2] == 'p'
- && p[len - 1] == 'p')
- q = p + (len - 4);
-
- /* Supply our own suffix. */
-#ifndef VMS
- strcpy (q, ".o");
-#else
- strcpy (q, ".obj");
-#endif
-
- deps_output (pfile, p, ':');
- deps_output (pfile, opts->in_fname, ' ');
- }
- }
-
-#if 0
- /* Make sure data ends with a newline. And put a null after it. */
-
- if ((fp->length > 0 && fp->buf[fp->length - 1] != '\n')
- /* Backslash-newline at end is not good enough. */
- || (fp->length > 1 && fp->buf[fp->length - 2] == '\\')) {
- fp->buf[fp->length++] = '\n';
- missing_newline = 1;
- }
- fp->buf[fp->length] = '\0';
-
- /* Unless inhibited, convert trigraphs in the input. */
-
- if (!no_trigraphs)
- trigraph_pcp (fp);
-#endif
-
- /* Scan the -include files before the main input.
- We push these in reverse order, so that the first one is handled first. */
-
- pfile->no_record_file++;
- opts->pending = nreverse_pending (opts->pending);
- for (pend = opts->pending; pend; pend = pend->next)
- {
- if (pend->cmd != NULL && strcmp (pend->cmd, "-include") == 0)
- {
- int fd = open (pend->arg, O_RDONLY, 0666);
- if (fd < 0)
- {
- cpp_perror_with_name (pfile, pend->arg);
- return 0;
- }
- if (!cpp_push_buffer (pfile, NULL, 0))
- return 0;
- finclude (pfile, fd, pend->arg, 0, NULL_PTR);
- }
- }
- pfile->no_record_file--;
-
- /* Free the pending list. */
- for (pend = opts->pending; pend; )
- {
- struct cpp_pending *next = pend->next;
- free (pend);
- pend = next;
- }
- opts->pending = NULL;
-
-#if 0
- /* Scan the input, processing macros and directives. */
-
- rescan (&outbuf, 0);
-
- if (missing_newline)
- fp->lineno--;
-
- if (CPP_PEDANTIC (pfile) && missing_newline)
- pedwarn ("file does not end in newline");
-
-#endif
- if (finclude (pfile, f, fname, 0, NULL_PTR))
- output_line_command (pfile, 0, same_file);
- return 1;
-}
-
-void
-cpp_reader_init (pfile)
- cpp_reader *pfile;
-{
- bzero ((char *) pfile, sizeof (cpp_reader));
- pfile->get_token = cpp_get_token;
-
- pfile->token_buffer_size = 200;
- pfile->token_buffer = (U_CHAR *) xmalloc (pfile->token_buffer_size);
- CPP_SET_WRITTEN (pfile, 0);
-
- pfile->system_include_depth = 0;
- pfile->dont_repeat_files = 0;
- pfile->all_include_files = 0;
- pfile->max_include_len = 0;
- pfile->timebuf = NULL;
- pfile->only_seen_white = 1;
- pfile->buffer = CPP_NULL_BUFFER(pfile);
-}
-
-static struct cpp_pending *
-nreverse_pending (list)
- struct cpp_pending *list;
-
-{
- register struct cpp_pending *prev = 0, *next, *pend;
- for (pend = list; pend; pend = next)
- {
- next = pend->next;
- pend->next = prev;
- prev = pend;
- }
- return prev;
-}
-
-static void
-push_pending (pfile, cmd, arg)
- cpp_reader *pfile;
- char *cmd;
- char *arg;
-{
- struct cpp_pending *pend
- = (struct cpp_pending *) xmalloc (sizeof (struct cpp_pending));
- pend->cmd = cmd;
- pend->arg = arg;
- pend->next = CPP_OPTIONS (pfile)->pending;
- CPP_OPTIONS (pfile)->pending = pend;
-}
-
-/* Handle command-line options in (argc, argv).
- Can be called multiple times, to handle multiple sets of options.
- Returns if an unrecognized option is seen.
- Returns number of handled arguments. */
-
-int
-cpp_handle_options (pfile, argc, argv)
- cpp_reader *pfile;
- int argc;
- char **argv;
-{
- int i;
- struct cpp_options *opts = CPP_OPTIONS (pfile);
- for (i = 0; i < argc; i++) {
- if (argv[i][0] != '-') {
- if (opts->out_fname != NULL)
- {
- cpp_fatal (pfile, "Usage: %s [switches] input output", argv[0]);
- return argc;
- }
- else if (opts->in_fname != NULL)
- opts->out_fname = argv[i];
- else
- opts->in_fname = argv[i];
- } else {
- switch (argv[i][1]) {
-
- missing_filename:
- cpp_fatal (pfile, "Filename missing after `%s' option", argv[i]);
- return argc;
- missing_dirname:
- cpp_fatal (pfile, "Directory name missing after `%s' option", argv[i]);
- return argc;
-
- case 'i':
- if (!strcmp (argv[i], "-include")
- || !strcmp (argv[i], "-imacros")) {
- if (i + 1 == argc)
- goto missing_filename;
- else
- push_pending (pfile, argv[i], argv[i+1]), i++;
- }
- if (!strcmp (argv[i], "-iprefix")) {
- if (i + 1 == argc)
- goto missing_filename;
- else
- opts->include_prefix = argv[++i];
- }
- if (!strcmp (argv[i], "-ifoutput")) {
- opts->output_conditionals = 1;
- }
- if (!strcmp (argv[i], "-isystem")) {
- struct file_name_list *dirtmp;
-
- if (i + 1 == argc)
- goto missing_filename;
-
- dirtmp = (struct file_name_list *)
- xmalloc (sizeof (struct file_name_list));
- dirtmp->next = 0;
- dirtmp->control_macro = 0;
- dirtmp->c_system_include_path = 1;
- dirtmp->fname = (char *) xmalloc (strlen (argv[i+1]) + 1);
- strcpy (dirtmp->fname, argv[++i]);
- dirtmp->got_name_map = 0;
-
- if (opts->before_system == 0)
- opts->before_system = dirtmp;
- else
- opts->last_before_system->next = dirtmp;
- opts->last_before_system = dirtmp; /* Tail follows the last one */
- }
- /* Add directory to end of path for includes,
- with the default prefix at the front of its name. */
- if (!strcmp (argv[i], "-iwithprefix")) {
- struct file_name_list *dirtmp;
- char *prefix;
-
- if (opts->include_prefix != 0)
- prefix = opts->include_prefix;
- else {
- prefix = savestring (GCC_INCLUDE_DIR);
- /* Remove the `include' from /usr/local/lib/gcc.../include. */
- if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
- prefix[strlen (prefix) - 7] = 0;
- }
-
- dirtmp = (struct file_name_list *)
- xmalloc (sizeof (struct file_name_list));
- dirtmp->next = 0; /* New one goes on the end */
- dirtmp->control_macro = 0;
- dirtmp->c_system_include_path = 0;
- if (i + 1 == argc)
- goto missing_dirname;
-
- dirtmp->fname = (char *) xmalloc (strlen (argv[i+1])
- + strlen (prefix) + 1);
- strcpy (dirtmp->fname, prefix);
- strcat (dirtmp->fname, argv[++i]);
- dirtmp->got_name_map = 0;
-
- if (opts->after_include == 0)
- opts->after_include = dirtmp;
- else
- opts->last_after_include->next = dirtmp;
- opts->last_after_include = dirtmp; /* Tail follows the last one */
- }
- /* Add directory to main path for includes,
- with the default prefix at the front of its name. */
- if (!strcmp (argv[i], "-iwithprefixbefore")) {
- struct file_name_list *dirtmp;
- char *prefix;
-
- if (opts->include_prefix != 0)
- prefix = opts->include_prefix;
- else {
- prefix = savestring (GCC_INCLUDE_DIR);
- /* Remove the `include' from /usr/local/lib/gcc.../include. */
- if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
- prefix[strlen (prefix) - 7] = 0;
- }
-
- dirtmp = (struct file_name_list *)
- xmalloc (sizeof (struct file_name_list));
- dirtmp->next = 0; /* New one goes on the end */
- dirtmp->control_macro = 0;
- dirtmp->c_system_include_path = 0;
- if (i + 1 == argc)
- goto missing_dirname;
-
- dirtmp->fname = (char *) xmalloc (strlen (argv[i+1])
- + strlen (prefix) + 1);
- strcpy (dirtmp->fname, prefix);
- strcat (dirtmp->fname, argv[++i]);
- dirtmp->got_name_map = 0;
-
- append_include_chain (pfile, dirtmp, dirtmp);
- }
- /* Add directory to end of path for includes. */
- if (!strcmp (argv[i], "-idirafter")) {
- struct file_name_list *dirtmp;
-
- dirtmp = (struct file_name_list *)
- xmalloc (sizeof (struct file_name_list));
- dirtmp->next = 0; /* New one goes on the end */
- dirtmp->control_macro = 0;
- dirtmp->c_system_include_path = 0;
- if (i + 1 == argc)
- goto missing_dirname;
- else
- dirtmp->fname = argv[++i];
- dirtmp->got_name_map = 0;
-
- if (opts->after_include == 0)
- opts->after_include = dirtmp;
- else
- opts->last_after_include->next = dirtmp;
- opts->last_after_include = dirtmp; /* Tail follows the last one */
- }
- break;
-
- case 'o':
- if (opts->out_fname != NULL)
- {
- cpp_fatal (pfile, "Output filename specified twice");
- return argc;
- }
- if (i + 1 == argc)
- goto missing_filename;
- opts->out_fname = argv[++i];
- if (!strcmp (opts->out_fname, "-"))
- opts->out_fname = "";
- break;
-
- case 'p':
- if (!strcmp (argv[i], "-pedantic"))
- CPP_PEDANTIC (pfile) = 1;
- else if (!strcmp (argv[i], "-pedantic-errors")) {
- CPP_PEDANTIC (pfile) = 1;
- opts->pedantic_errors = 1;
- }
-#if 0
- else if (!strcmp (argv[i], "-pcp")) {
- char *pcp_fname = argv[++i];
- pcp_outfile =
- ((pcp_fname[0] != '-' || pcp_fname[1] != '\0')
- ? fopen (pcp_fname, "w")
- : fdopen (dup (fileno (stdout)), "w"));
- if (pcp_outfile == 0)
- cpp_pfatal_with_name (pfile, pcp_fname);
- no_precomp = 1;
- }
-#endif
- break;
-
- case 't':
- if (!strcmp (argv[i], "-traditional")) {
- opts->traditional = 1;
- } else if (!strcmp (argv[i], "-trigraphs")) {
- if (!opts->chill)
- opts->no_trigraphs = 0;
- }
- break;
-
- case 'l':
- if (! strcmp (argv[i], "-lang-c"))
- opts->cplusplus = 0, opts->cplusplus_comments = 1, opts->c89 = 0,
- opts->objc = 0;
- if (! strcmp (argv[i], "-lang-c89"))
- opts->cplusplus = 0, opts->cplusplus_comments = 0, opts->c89 = 1,
- opts->objc = 0;
- if (! strcmp (argv[i], "-lang-c++"))
- opts->cplusplus = 1, opts->cplusplus_comments = 1, opts->c89 = 0,
- opts->objc = 0;
- if (! strcmp (argv[i], "-lang-objc"))
- opts->cplusplus = 0, opts->cplusplus_comments = 1, opts->c89 = 0,
- opts->objc = 1;
- if (! strcmp (argv[i], "-lang-objc++"))
- opts->cplusplus = 1, opts->cplusplus_comments = 1, opts->c89 = 0,
- opts->objc = 1;
- if (! strcmp (argv[i], "-lang-asm"))
- opts->lang_asm = 1;
- if (! strcmp (argv[i], "-lint"))
- opts->for_lint = 1;
- if (! strcmp (argv[i], "-lang-chill"))
- opts->objc = 0, opts->cplusplus = 0, opts->chill = 1,
- opts->traditional = 1, opts->no_trigraphs = 1;
- break;
-
- case '+':
- opts->cplusplus = 1, opts->cplusplus_comments = 1;
- break;
-
- case 'w':
- opts->inhibit_warnings = 1;
- break;
-
- case 'W':
- if (!strcmp (argv[i], "-Wtrigraphs"))
- opts->warn_trigraphs = 1;
- else if (!strcmp (argv[i], "-Wno-trigraphs"))
- opts->warn_trigraphs = 0;
- else if (!strcmp (argv[i], "-Wcomment"))
- opts->warn_comments = 1;
- else if (!strcmp (argv[i], "-Wno-comment"))
- opts->warn_comments = 0;
- else if (!strcmp (argv[i], "-Wcomments"))
- opts->warn_comments = 1;
- else if (!strcmp (argv[i], "-Wno-comments"))
- opts->warn_comments = 0;
- else if (!strcmp (argv[i], "-Wtraditional"))
- opts->warn_stringify = 1;
- else if (!strcmp (argv[i], "-Wno-traditional"))
- opts->warn_stringify = 0;
- else if (!strcmp (argv[i], "-Wimport"))
- opts->warn_import = 1;
- else if (!strcmp (argv[i], "-Wno-import"))
- opts->warn_import = 0;
- else if (!strcmp (argv[i], "-Werror"))
- opts->warnings_are_errors = 1;
- else if (!strcmp (argv[i], "-Wno-error"))
- opts->warnings_are_errors = 0;
- else if (!strcmp (argv[i], "-Wall"))
- {
- opts->warn_trigraphs = 1;
- opts->warn_comments = 1;
- }
- break;
-
- case 'M':
- /* The style of the choices here is a bit mixed.
- The chosen scheme is a hybrid of keeping all options in one string
- and specifying each option in a separate argument:
- -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
- -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
- -M[M][G][D file]. This is awkward to handle in specs, and is not
- as extensible. */
- /* ??? -MG must be specified in addition to one of -M or -MM.
- This can be relaxed in the future without breaking anything.
- The converse isn't true. */
-
- /* -MG isn't valid with -MD or -MMD. This is checked for later. */
- if (!strcmp (argv[i], "-MG"))
- {
- opts->print_deps_missing_files = 1;
- break;
- }
- if (!strcmp (argv[i], "-M"))
- opts->print_deps = 2;
- else if (!strcmp (argv[i], "-MM"))
- opts->print_deps = 1;
- else if (!strcmp (argv[i], "-MD"))
- opts->print_deps = 2;
- else if (!strcmp (argv[i], "-MMD"))
- opts->print_deps = 1;
- /* For -MD and -MMD options, write deps on file named by next arg. */
- if (!strcmp (argv[i], "-MD") || !strcmp (argv[i], "-MMD"))
- {
- if (i+1 == argc)
- goto missing_filename;
- opts->deps_file = argv[++i];
- }
- else
- {
- /* For -M and -MM, write deps on standard output
- and suppress the usual output. */
- opts->no_output = 1;
- }
- break;
-
- case 'd':
- {
- char *p = argv[i] + 2;
- char c;
- while ((c = *p++) != 0) {
- /* Arg to -d specifies what parts of macros to dump */
- switch (c) {
- case 'M':
- opts->dump_macros = dump_only;
- opts->no_output = 1;
- break;
- case 'N':
- opts->dump_macros = dump_names;
- break;
- case 'D':
- opts->dump_macros = dump_definitions;
- break;
- }
- }
- }
- break;
-
- case 'g':
- if (argv[i][2] == '3')
- opts->debug_output = 1;
- break;
-
- case 'v':
- fprintf (stderr, "GNU CPP version %s", version_string);
-#ifdef TARGET_VERSION
- TARGET_VERSION;
-#endif
- fprintf (stderr, "\n");
- opts->verbose = 1;
- break;
-
- case 'H':
- opts->print_include_names = 1;
- break;
-
- case 'D':
- if (argv[i][2] != 0)
- push_pending (pfile, "-D", argv[i] + 2);
- else if (i + 1 == argc)
- {
- cpp_fatal (pfile, "Macro name missing after -D option");
- return argc;
- }
- else
- i++, push_pending (pfile, "-D", argv[i]);
- break;
-
- case 'A':
- {
- char *p;
-
- if (argv[i][2] != 0)
- p = argv[i] + 2;
- else if (i + 1 == argc)
- {
- cpp_fatal (pfile, "Assertion missing after -A option");
- return argc;
- }
- else
- p = argv[++i];
-
- if (!strcmp (p, "-")) {
- struct cpp_pending **ptr;
- /* -A- eliminates all predefined macros and assertions.
- Let's include also any that were specified earlier
- on the command line. That way we can get rid of any
- that were passed automatically in from GCC. */
- int j;
- opts->inhibit_predefs = 1;
- for (ptr = &opts->pending; *ptr != NULL; )
- {
- struct cpp_pending *pend = *ptr;
- if (pend->cmd && pend->cmd[0] == '-'
- && (pend->cmd[1] == 'D' || pend->cmd[1] == 'A'))
- {
- *ptr = pend->next;
- free (pend);
- }
- else
- ptr = &pend->next;
- }
- } else {
- push_pending (pfile, "-A", p);
- }
- }
- break;
-
- case 'U': /* JF #undef something */
- if (argv[i][2] != 0)
- push_pending (pfile, "-U", argv[i] + 2);
- else if (i + 1 == argc)
- {
- cpp_fatal (pfile, "Macro name missing after -U option", NULL);
- return argc;
- }
- else
- push_pending (pfile, "-U", argv[i+1]), i++;
- break;
-
- case 'C':
- opts->put_out_comments = 1;
- break;
-
- case 'E': /* -E comes from cc -E; ignore it. */
- break;
-
- case 'P':
- opts->no_line_commands = 1;
- break;
-
- case '$': /* Don't include $ in identifiers. */
- opts->dollars_in_ident = 0;
- break;
-
- case 'I': /* Add directory to path for includes. */
- {
- struct file_name_list *dirtmp;
-
- if (! CPP_OPTIONS(pfile)->ignore_srcdir
- && !strcmp (argv[i] + 2, "-")) {
- CPP_OPTIONS (pfile)->ignore_srcdir = 1;
- /* Don't use any preceding -I directories for #include <...>. */
- CPP_OPTIONS (pfile)->first_bracket_include = 0;
- }
- else {
- dirtmp = (struct file_name_list *)
- xmalloc (sizeof (struct file_name_list));
- dirtmp->next = 0; /* New one goes on the end */
- dirtmp->control_macro = 0;
- dirtmp->c_system_include_path = 0;
- if (argv[i][2] != 0)
- dirtmp->fname = argv[i] + 2;
- else if (i + 1 == argc)
- goto missing_dirname;
- else
- dirtmp->fname = argv[++i];
- dirtmp->got_name_map = 0;
- append_include_chain (pfile, dirtmp, dirtmp);
- }
- }
- break;
-
- case 'n':
- if (!strcmp (argv[i], "-nostdinc"))
- /* -nostdinc causes no default include directories.
- You must specify all include-file directories with -I. */
- opts->no_standard_includes = 1;
- else if (!strcmp (argv[i], "-nostdinc++"))
- /* -nostdinc++ causes no default C++-specific include directories. */
- opts->no_standard_cplusplus_includes = 1;
-#if 0
- else if (!strcmp (argv[i], "-noprecomp"))
- no_precomp = 1;
-#endif
- break;
-
- case 'u':
- /* Sun compiler passes undocumented switch "-undef".
- Let's assume it means to inhibit the predefined symbols. */
- opts->inhibit_predefs = 1;
- break;
-
- case '\0': /* JF handle '-' as file name meaning stdin or stdout */
- if (opts->in_fname == NULL) {
- opts->in_fname = "";
- break;
- } else if (opts->out_fname == NULL) {
- opts->out_fname = "";
- break;
- } /* else fall through into error */
-
- default:
- return i;
- }
- }
- }
- return i;
-}
-
-void
-cpp_finish (pfile)
- cpp_reader *pfile;
-{
- struct cpp_options *opts = CPP_OPTIONS (pfile);
-
- if (opts->print_deps)
- {
- /* Stream on which to print the dependency information. */
- FILE *deps_stream;
-
- /* Don't actually write the deps file if compilation has failed. */
- if (pfile->errors == 0)
- {
- char *deps_mode = opts->print_deps_append ? "a" : "w";
- if (opts->deps_file == 0)
- deps_stream = stdout;
- else if ((deps_stream = fopen (opts->deps_file, deps_mode)) == 0)
- cpp_pfatal_with_name (pfile, opts->deps_file);
- fputs (pfile->deps_buffer, deps_stream);
- putc ('\n', deps_stream);
- if (opts->deps_file)
- {
- if (ferror (deps_stream) || fclose (deps_stream) != 0)
- cpp_fatal (pfile, "I/O error on output");
- }
- }
- }
-}
-
-/* Free resources used by PFILE.
- This is the cpp_reader 'finalizer' or 'destructor' (in C++ terminology). */
-
-void
-cpp_cleanup (pfile)
- cpp_reader *pfile;
-{
- int i;
- while ( CPP_BUFFER (pfile) != CPP_NULL_BUFFER (pfile))
- cpp_pop_buffer (pfile);
-
- if (pfile->token_buffer)
- {
- free (pfile->token_buffer);
- pfile->token_buffer = NULL;
- }
-
- if (pfile->deps_buffer)
- {
- free (pfile->deps_buffer);
- pfile->deps_buffer = NULL;
- pfile->deps_allocated_size = 0;
- }
-
- while (pfile->if_stack)
- {
- IF_STACK_FRAME *temp = pfile->if_stack;
- pfile->if_stack = temp->next;
- free (temp);
- }
-
- while (pfile->dont_repeat_files)
- {
- struct file_name_list *temp = pfile->dont_repeat_files;
- pfile->dont_repeat_files = temp->next;
- free (temp->fname);
- free (temp);
- }
-
- while (pfile->all_include_files)
- {
- struct file_name_list *temp = pfile->all_include_files;
- pfile->all_include_files = temp->next;
- free (temp->fname);
- free (temp);
- }
-
- for (i = IMPORT_HASH_SIZE; --i >= 0; )
- {
- register struct import_file *imp = pfile->import_hash_table[i];
- while (imp)
- {
- struct import_file *next = imp->next;
- free (imp->name);
- free (imp);
- imp = next;
- }
- pfile->import_hash_table[i] = 0;
- }
-
- for (i = ASSERTION_HASHSIZE; --i >= 0; )
- {
- while (pfile->assertion_hashtab[i])
- delete_assertion (pfile->assertion_hashtab[i]);
- }
-
- cpp_hash_cleanup (pfile);
-}
-
-static int
-do_assert (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- long symstart; /* remember where symbol name starts */
- int c;
- int sym_length; /* and how long it is */
- struct arglist *tokens = NULL;
-
- if (CPP_PEDANTIC (pfile) && CPP_OPTIONS (pfile)->done_initializing
- && !CPP_BUFFER (pfile)->system_header_p)
- cpp_pedwarn (pfile, "ANSI C does not allow `#assert'");
-
- cpp_skip_hspace (pfile);
- symstart = CPP_WRITTEN (pfile); /* remember where it starts */
- parse_name (pfile, GETC());
- sym_length = check_macro_name (pfile, pfile->token_buffer + symstart,
- "assertion");
-
- cpp_skip_hspace (pfile);
- if (PEEKC() != '(') {
- cpp_error (pfile, "missing token-sequence in `#assert'");
- goto error;
- }
-
- {
- int error_flag = 0;
- tokens = read_token_list (pfile, &error_flag);
- if (error_flag)
- goto error;
- if (tokens == 0) {
- cpp_error (pfile, "empty token-sequence in `#assert'");
- goto error;
- }
- cpp_skip_hspace (pfile);
- c = PEEKC ();
- if (c != EOF && c != '\n')
- cpp_pedwarn (pfile, "junk at end of `#assert'");
- skip_rest_of_line (pfile);
- }
-
- /* If this name isn't already an assertion name, make it one.
- Error if it was already in use in some other way. */
-
- {
- ASSERTION_HASHNODE *hp;
- U_CHAR *symname = pfile->token_buffer + symstart;
- int hashcode = hashf (symname, sym_length, ASSERTION_HASHSIZE);
- struct tokenlist_list *value
- = (struct tokenlist_list *) xmalloc (sizeof (struct tokenlist_list));
-
- hp = assertion_lookup (pfile, symname, sym_length, hashcode);
- if (hp == NULL) {
- if (sym_length == 7 && ! strncmp (symname, "defined", sym_length))
- cpp_error (pfile, "`defined' redefined as assertion");
- hp = assertion_install (pfile, symname, sym_length, hashcode);
- }
-
- /* Add the spec'd token-sequence to the list of such. */
- value->tokens = tokens;
- value->next = hp->value;
- hp->value = value;
- }
- CPP_SET_WRITTEN (pfile, symstart); /* Pop */
- return 0;
- error:
- CPP_SET_WRITTEN (pfile, symstart); /* Pop */
- skip_rest_of_line (pfile);
- return 1;
-}
-
-static int
-do_unassert (pfile, keyword, buf, limit)
- cpp_reader *pfile;
- struct directive *keyword;
- U_CHAR *buf, *limit;
-{
- long symstart; /* remember where symbol name starts */
- int sym_length; /* and how long it is */
- int c;
-
- struct arglist *tokens = NULL;
- int tokens_specified = 0;
-
- if (CPP_PEDANTIC (pfile) && CPP_OPTIONS (pfile)->done_initializing
- && !CPP_BUFFER (pfile)->system_header_p)
- cpp_pedwarn (pfile, "ANSI C does not allow `#unassert'");
-
- cpp_skip_hspace (pfile);
-
- symstart = CPP_WRITTEN (pfile); /* remember where it starts */
- parse_name (pfile, GETC());
- sym_length = check_macro_name (pfile, pfile->token_buffer + symstart,
- "assertion");
-
- cpp_skip_hspace (pfile);
- if (PEEKC() == '(') {
- int error_flag = 0;
-
- tokens = read_token_list (pfile, &error_flag);
- if (error_flag)
- goto error;
- if (tokens == 0) {
- cpp_error (pfile, "empty token list in `#unassert'");
- goto error;
- }
-
- tokens_specified = 1;
- }
-
- cpp_skip_hspace (pfile);
- c = PEEKC ();
- if (c != EOF && c != '\n')
- cpp_error (pfile, "junk at end of `#unassert'");
- skip_rest_of_line (pfile);
-
- {
- ASSERTION_HASHNODE *hp;
- U_CHAR *symname = pfile->token_buffer + symstart;
- int hashcode = hashf (symname, sym_length, ASSERTION_HASHSIZE);
- struct tokenlist_list *tail, *prev;
-
- hp = assertion_lookup (pfile, symname, sym_length, hashcode);
- if (hp == NULL)
- return 1;
-
- /* If no token list was specified, then eliminate this assertion
- entirely. */
- if (! tokens_specified)
- delete_assertion (hp);
- else {
- /* If a list of tokens was given, then delete any matching list. */
-
- tail = hp->value;
- prev = 0;
- while (tail) {
- struct tokenlist_list *next = tail->next;
- if (compare_token_lists (tail->tokens, tokens)) {
- if (prev)
- prev->next = next;
- else
- hp->value = tail->next;
- free_token_list (tail->tokens);
- free (tail);
- } else {
- prev = tail;
- }
- tail = next;
- }
- }
- }
-
- CPP_SET_WRITTEN (pfile, symstart); /* Pop */
- return 0;
- error:
- CPP_SET_WRITTEN (pfile, symstart); /* Pop */
- skip_rest_of_line (pfile);
- return 1;
-}
-
-/* Test whether there is an assertion named NAME
- and optionally whether it has an asserted token list TOKENS.
- NAME is not null terminated; its length is SYM_LENGTH.
- If TOKENS_SPECIFIED is 0, then don't check for any token list. */
-
-int
-check_assertion (pfile, name, sym_length, tokens_specified, tokens)
- cpp_reader *pfile;
- U_CHAR *name;
- int sym_length;
- int tokens_specified;
- struct arglist *tokens;
-{
- ASSERTION_HASHNODE *hp;
- int hashcode = hashf (name, sym_length, ASSERTION_HASHSIZE);
-
- if (CPP_PEDANTIC (pfile) && !CPP_BUFFER (pfile)->system_header_p)
- cpp_pedwarn (pfile, "ANSI C does not allow testing assertions");
-
- hp = assertion_lookup (pfile, name, sym_length, hashcode);
- if (hp == NULL)
- /* It is not an assertion; just return false. */
- return 0;
-
- /* If no token list was specified, then value is 1. */
- if (! tokens_specified)
- return 1;
-
- {
- struct tokenlist_list *tail;
-
- tail = hp->value;
-
- /* If a list of tokens was given,
- then succeed if the assertion records a matching list. */
-
- while (tail) {
- if (compare_token_lists (tail->tokens, tokens))
- return 1;
- tail = tail->next;
- }
-
- /* Fail if the assertion has no matching list. */
- return 0;
- }
-}
-
-/* Compare two lists of tokens for equality including order of tokens. */
-
-static int
-compare_token_lists (l1, l2)
- struct arglist *l1, *l2;
-{
- while (l1 && l2) {
- if (l1->length != l2->length)
- return 0;
- if (strncmp (l1->name, l2->name, l1->length))
- return 0;
- l1 = l1->next;
- l2 = l2->next;
- }
-
- /* Succeed if both lists end at the same time. */
- return l1 == l2;
-}
-
-struct arglist *
-reverse_token_list (tokens)
- struct arglist *tokens;
-{
- register struct arglist *prev = 0, *this, *next;
- for (this = tokens; this; this = next)
- {
- next = this->next;
- this->next = prev;
- prev = this;
- }
- return prev;
-}
-
-/* Read a space-separated list of tokens ending in a close parenthesis.
- Return a list of strings, in the order they were written.
- (In case of error, return 0 and store -1 in *ERROR_FLAG.) */
-
-static struct arglist *
-read_token_list (pfile, error_flag)
- cpp_reader *pfile;
- int *error_flag;
-{
- struct arglist *token_ptrs = 0;
- int depth = 1;
- int length;
-
- *error_flag = 0;
- FORWARD (1); /* Skip '(' */
-
- /* Loop over the assertion value tokens. */
- while (depth > 0)
- {
- struct arglist *temp;
- long name_written = CPP_WRITTEN (pfile);
- int eofp = 0; int c;
-
- cpp_skip_hspace (pfile);
-
- c = GETC ();
-
- /* Find the end of the token. */
- if (c == '(')
- {
- CPP_PUTC (pfile, c);
- depth++;
- }
- else if (c == ')')
- {
- depth--;
- if (depth == 0)
- break;
- CPP_PUTC (pfile, c);
- }
- else if (c == '"' || c == '\'')
- {
- FORWARD(-1);
- cpp_get_token (pfile);
- }
- else if (c == '\n')
- break;
- else
- {
- while (c != EOF && ! is_space[c] && c != '(' && c != ')'
- && c != '"' && c != '\'')
- {
- CPP_PUTC (pfile, c);
- c = GETC();
- }
- if (c != EOF) FORWARD(-1);
- }
-
- length = CPP_WRITTEN (pfile) - name_written;
- temp = (struct arglist *)
- xmalloc (sizeof (struct arglist) + length + 1);
- temp->name = (U_CHAR *) (temp + 1);
- bcopy ((char *) (pfile->token_buffer + name_written),
- (char *) temp->name, length);
- temp->name[length] = 0;
- temp->next = token_ptrs;
- token_ptrs = temp;
- temp->length = length;
-
- CPP_ADJUST_WRITTEN (pfile, -length); /* pop */
-
- if (c == EOF || c == '\n')
- { /* FIXME */
- cpp_error (pfile,
- "unterminated token sequence following `#' operator");
- return 0;
- }
- }
-
- /* We accumulated the names in reverse order.
- Now reverse them to get the proper order. */
- return reverse_token_list (token_ptrs);
-}
-
-static void
-free_token_list (tokens)
- struct arglist *tokens;
-{
- while (tokens) {
- struct arglist *next = tokens->next;
- free (tokens->name);
- free (tokens);
- tokens = next;
- }
-}
-
-/* Get the file-mode and data size of the file open on FD
- and store them in *MODE_POINTER and *SIZE_POINTER. */
-
-static int
-file_size_and_mode (fd, mode_pointer, size_pointer)
- int fd;
- int *mode_pointer;
- long int *size_pointer;
-{
- struct stat sbuf;
-
- if (fstat (fd, &sbuf) < 0) return (-1);
- if (mode_pointer) *mode_pointer = sbuf.st_mode;
- if (size_pointer) *size_pointer = sbuf.st_size;
- return 0;
-}
-
-/* Read LEN bytes at PTR from descriptor DESC, for file FILENAME,
- retrying if necessary. Return a negative value if an error occurs,
- otherwise return the actual number of bytes read,
- which must be LEN unless end-of-file was reached. */
-
-static int
-safe_read (desc, ptr, len)
- int desc;
- char *ptr;
- int len;
-{
- int left = len;
- while (left > 0) {
- int nchars = read (desc, ptr, left);
- if (nchars < 0)
- {
-#ifdef EINTR
- if (errno == EINTR)
- continue;
-#endif
- return nchars;
- }
- if (nchars == 0)
- break;
- ptr += nchars;
- left -= nchars;
- }
- return len - left;
-}
-
-static char *
-xcalloc (number, size)
- unsigned number, size;
-{
- register unsigned total = number * size;
- register char *ptr = (char *) xmalloc (total);
- bzero (ptr, total);
- return ptr;
-}
-
-static char *
-savestring (input)
- char *input;
-{
- unsigned size = strlen (input);
- char *output = xmalloc (size + 1);
- strcpy (output, input);
- return output;
-}
-
-/* Initialize PMARK to remember the current position of PFILE. */
-
-void
-parse_set_mark (pmark, pfile)
- struct parse_marker *pmark;
- cpp_reader *pfile;
-{
- cpp_buffer *pbuf = CPP_BUFFER (pfile);
- pmark->next = pbuf->marks;
- pbuf->marks = pmark;
- pmark->buf = pbuf;
- pmark->position = pbuf->cur - pbuf->buf;
-}
-
-/* Cleanup PMARK - we no longer need it. */
-
-void
-parse_clear_mark (pmark)
- struct parse_marker *pmark;
-{
- struct parse_marker **pp = &pmark->buf->marks;
- for (; ; pp = &(*pp)->next) {
- if (*pp == NULL) abort ();
- if (*pp == pmark) break;
- }
- *pp = pmark->next;
-}
-
-/* Backup the current position of PFILE to that saved in PMARK. */
-
-void
-parse_goto_mark (pmark, pfile)
- struct parse_marker *pmark;
- cpp_reader *pfile;
-{
- cpp_buffer *pbuf = CPP_BUFFER (pfile);
- if (pbuf != pmark->buf)
- cpp_fatal (pfile, "internal error %s", "parse_goto_mark");
- pbuf->cur = pbuf->buf + pmark->position;
-}
-
-/* Reset PMARK to point to the current position of PFILE. (Same
- as parse_clear_mark (PMARK), parse_set_mark (PMARK, PFILE) but faster. */
-
-void
-parse_move_mark (pmark, pfile)
- struct parse_marker *pmark;
- cpp_reader *pfile;
-{
- cpp_buffer *pbuf = CPP_BUFFER (pfile);
- if (pbuf != pmark->buf)
- cpp_fatal (pfile, "internal error %s", "parse_move_mark");
- pmark->position = pbuf->cur - pbuf->buf;
-}
-
-int
-cpp_read_check_assertion (pfile)
- cpp_reader *pfile;
-{
- int name_start = CPP_WRITTEN (pfile);
- int name_length, name_written;
- int result;
- FORWARD (1); /* Skip '#' */
- cpp_skip_hspace (pfile);
- parse_name (pfile, GETC ());
- name_written = CPP_WRITTEN (pfile);
- name_length = name_written - name_start;
- cpp_skip_hspace (pfile);
- if (CPP_BUF_PEEK (CPP_BUFFER (pfile)) == '(')
- {
- int error_flag;
- struct arglist *token_ptrs = read_token_list (pfile, &error_flag);
- result = check_assertion (pfile,
- pfile->token_buffer + name_start, name_length,
- 1, token_ptrs);
- }
- else
- result = check_assertion (pfile,
- pfile->token_buffer + name_start, name_length,
- 0, NULL_PTR);
- CPP_ADJUST_WRITTEN (pfile, - name_length); /* pop */
- return result;
-}
-
-void
-cpp_print_file_and_line (pfile)
- cpp_reader *pfile;
-{
- cpp_buffer *ip = cpp_file_buffer (pfile);
-
- if (ip != NULL)
- {
- long line, col;
- cpp_buf_line_and_col (ip, &line, &col);
- cpp_file_line_for_message (pfile, ip->nominal_fname,
- line, pfile->show_column ? col : -1);
- }
-}
-
-void
-cpp_error (pfile, msg, arg1, arg2, arg3)
- cpp_reader *pfile;
- char *msg;
- char *arg1, *arg2, *arg3;
-{
- cpp_print_containing_files (pfile);
- cpp_print_file_and_line (pfile);
- cpp_message (pfile, 1, msg, arg1, arg2, arg3);
-}
-
-/* Print error message but don't count it. */
-
-void
-cpp_warning (pfile, msg, arg1, arg2, arg3)
- cpp_reader *pfile;
- char *msg;
- char *arg1, *arg2, *arg3;
-{
- if (CPP_OPTIONS (pfile)->inhibit_warnings)
- return;
-
- if (CPP_OPTIONS (pfile)->warnings_are_errors)
- pfile->errors++;
-
- cpp_print_containing_files (pfile);
- cpp_print_file_and_line (pfile);
- cpp_message (pfile, 0, msg, arg1, arg2, arg3);
-}
-
-/* Print an error message and maybe count it. */
-
-void
-cpp_pedwarn (pfile, msg, arg1, arg2, arg3)
- cpp_reader *pfile;
- char *msg;
- char *arg1, *arg2, *arg3;
-{
- if (CPP_OPTIONS (pfile)->pedantic_errors)
- cpp_error (pfile, msg, arg1, arg2, arg3);
- else
- cpp_warning (pfile, msg, arg1, arg2, arg3);
-}
-
-void
-cpp_error_with_line (pfile, line, column, msg, arg1, arg2, arg3)
- cpp_reader *pfile;
- int line, column;
- char *msg;
- char *arg1, *arg2, *arg3;
-{
- int i;
- cpp_buffer *ip = cpp_file_buffer (pfile);
-
- cpp_print_containing_files (pfile);
-
- if (ip != NULL)
- cpp_file_line_for_message (pfile, ip->nominal_fname, line, column);
-
- cpp_message (pfile, 1, msg, arg1, arg2, arg3);
-}
-
-static void
-cpp_warning_with_line (pfile, line, column, msg, arg1, arg2, arg3)
- cpp_reader *pfile;
- int line, column;
- char *msg;
- char *arg1, *arg2, *arg3;
-{
- int i;
- cpp_buffer *ip;
-
- if (CPP_OPTIONS (pfile)->inhibit_warnings)
- return;
-
- if (CPP_OPTIONS (pfile)->warnings_are_errors)
- pfile->errors++;
-
- cpp_print_containing_files (pfile);
-
- ip = cpp_file_buffer (pfile);
-
- if (ip != NULL)
- cpp_file_line_for_message (pfile, ip->nominal_fname, line, column);
-
- cpp_message (pfile, 0, msg, arg1, arg2, arg3);
-}
-
-void
-cpp_pedwarn_with_line (pfile, line, column, msg, arg1, arg2, arg3)
- cpp_reader *pfile;
- int line;
- char *msg;
- char *arg1, *arg2, *arg3;
-{
- if (CPP_OPTIONS (pfile)->pedantic_errors)
- cpp_error_with_line (pfile, column, line, msg, arg1, arg2, arg3);
- else
- cpp_warning_with_line (pfile, line, column, msg, arg1, arg2, arg3);
-}
-
-/* Report a warning (or an error if pedantic_errors)
- giving specified file name and line number, not current. */
-
-void
-cpp_pedwarn_with_file_and_line (pfile, file, line, msg, arg1, arg2, arg3)
- cpp_reader *pfile;
- char *file;
- int line;
- char *msg;
- char *arg1, *arg2, *arg3;
-{
- if (!CPP_OPTIONS (pfile)->pedantic_errors
- && CPP_OPTIONS (pfile)->inhibit_warnings)
- return;
- if (file != NULL)
- cpp_file_line_for_message (pfile, file, line, -1);
- cpp_message (pfile, CPP_OPTIONS (pfile)->pedantic_errors,
- msg, arg1, arg2, arg3);
-}
-
-/* This defines "errno" properly for VMS, and gives us EACCES. */
-#include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-
-#ifndef VMS
-#ifndef HAVE_STRERROR
-extern int sys_nerr;
-#if defined(bsd4_4)
-extern const char *const sys_errlist[];
-#else
-extern char *sys_errlist[];
-#endif
-#else /* HAVE_STRERROR */
-char *strerror ();
-#endif
-#else /* VMS */
-char *strerror (int,...);
-#endif
-
-/* my_strerror - return the descriptive text associated with an
- `errno' code. */
-
-char *
-my_strerror (errnum)
- int errnum;
-{
- char *result;
-
-#ifndef VMS
-#ifndef HAVE_STRERROR
- result = (char *) ((errnum < sys_nerr) ? sys_errlist[errnum] : 0);
-#else
- result = strerror (errnum);
-#endif
-#else /* VMS */
- /* VAXCRTL's strerror() takes an optional second argument, which only
- matters when the first argument is EVMSERR. However, it's simplest
- just to pass it unconditionally. `vaxc$errno' is declared in
- <errno.h>, and maintained by the library in parallel with `errno'.
- We assume that caller's `errnum' either matches the last setting of
- `errno' by the library or else does not have the value `EVMSERR'. */
-
- result = strerror (errnum, vaxc$errno);
-#endif
-
- if (!result)
- result = "undocumented I/O error";
-
- return result;
-}
-
-/* Error including a message from `errno'. */
-
-void
-cpp_error_from_errno (pfile, name)
- cpp_reader *pfile;
- char *name;
-{
- int i;
- cpp_buffer *ip = cpp_file_buffer (pfile);
-
- cpp_print_containing_files (pfile);
-
- if (ip != NULL)
- cpp_file_line_for_message (pfile, ip->nominal_fname, ip->lineno, -1);
-
- cpp_message (pfile, 1, "%s: %s", name, my_strerror (errno));
-}
-
-void
-cpp_perror_with_name (pfile, name)
- cpp_reader *pfile;
- char *name;
-{
- cpp_message (pfile, 1, "%s: %s: %s", progname, name, my_strerror (errno));
-}
-
-/* TODO:
- * No pre-compiled header file support.
- *
- * Possibly different enum token codes for each C/C++ token.
- *
- * Should clean up remaining directives to that do_XXX functions
- * only take two arguments and all have command_reads_line.
- *
- * Find and cleanup remaining uses of static variables,
- *
- * Support for trigraphs.
- *
- * Support -dM flag (dump_all_macros).
- *
- * Support for_lint flag.
- */
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
deleted file mode 100644
index ae73e8aedac..00000000000
--- a/gcc/cpplib.h
+++ /dev/null
@@ -1,657 +0,0 @@
-/* Definitions for CPP library.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
- Written by Per Bothner, 1994-95.
-
-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, 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.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef unsigned char U_CHAR;
-
-typedef struct cpp_reader cpp_reader;
-typedef struct cpp_buffer cpp_buffer;
-typedef struct cpp_options cpp_options;
-typedef struct hashnode cpp_hashnode;
-
-enum cpp_token {
- CPP_EOF = -1,
- CPP_OTHER = 0,
- CPP_COMMENT = 1,
- CPP_HSPACE,
- CPP_VSPACE, /* newlines and #line directives */
- CPP_NAME,
- CPP_NUMBER,
- CPP_CHAR,
- CPP_STRING,
- CPP_DIRECTIVE,
- CPP_LPAREN, /* "(" */
- CPP_RPAREN, /* ")" */
- CPP_LBRACE, /* "{" */
- CPP_RBRACE, /* "}" */
- CPP_COMMA, /* "," */
- CPP_SEMICOLON,/* ";" */
- CPP_3DOTS, /* "..." */
-#if 0
- CPP_ANDAND, /* "&&" */
- CPP_OROR, /* "||" */
- CPP_LSH, /* "<<" */
- CPP_RSH, /* ">>" */
- CPP_EQL, /* "==" */
- CPP_NEQ, /* "!=" */
- CPP_LEQ, /* "<=" */
- CPP_GEQ, /* ">=" */
- CPP_PLPL, /* "++" */
- CPP_MINMIN, /* "--" */
-#endif
- /* POP_TOKEN is returned when we've popped a cpp_buffer. */
- CPP_POP
-};
-
-#ifndef PARAMS
-#ifdef __STDC
-#define PARAMS(P) P
-#else
-#define PARAMS(P) ()
-#endif
-#endif /* !PARAMS */
-
-typedef enum cpp_token (*parse_underflow_t) PARAMS((cpp_reader *));
-typedef int (*parse_cleanup_t) PARAMS((cpp_buffer *, cpp_reader *));
-
-/* A parse_marker indicates a previous position,
- which we can backtrack to. */
-
-struct parse_marker {
- cpp_buffer *buf;
- struct parse_marker *next;
- int position;
-};
-
-extern void parse_set_mark PARAMS ((struct parse_marker *, cpp_reader *));
-extern void parse_clear_mark PARAMS ((struct parse_marker *));
-extern void parse_goto_mark PARAMS((struct parse_marker *, cpp_reader *));
-extern void parse_move_mark PARAMS((struct parse_marker *, cpp_reader *));
-
-extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
-extern enum cpp_token cpp_get_token PARAMS ((struct parse_marker *));
-extern void cpp_skip_hspace PARAMS((cpp_reader *));
-extern enum cpp_token cpp_get_non_space_token PARAMS ((cpp_reader *));
-
-/* This frees resources used by PFILE. */
-extern void cpp_cleanup PARAMS ((cpp_reader *PFILE));
-
-/* Maintain and search list of included files, for #import. */
-
-#define IMPORT_HASH_SIZE 31
-
-struct import_file {
- char *name;
- ino_t inode;
- dev_t dev;
- struct import_file *next;
-};
-
-/* If we have a huge buffer, may need to cache more recent counts */
-#define CPP_LINE_BASE(BUF) ((BUF)->buf + (BUF)->line_base)
-
-struct cpp_buffer {
- unsigned char *buf;
- unsigned char *cur;
- unsigned char *rlimit; /* end of valid data */
- unsigned char *alimit; /* end of allocated buffer */
- unsigned char *prev; /* start of current token */
-
- char *fname;
- /* Filename specified with #line command. */
- char *nominal_fname;
-
- /* Record where in the search path this file was found.
- For #include_next. */
- struct file_name_list *dir;
-
- long line_base;
- long lineno; /* Line number at CPP_LINE_BASE. */
- long colno; /* Column number at CPP_LINE_BASE. */
- parse_underflow_t underflow;
- parse_cleanup_t cleanup;
- void *data;
- struct parse_marker *marks;
- /* Value of if_stack at start of this file.
- Used to prohibit unmatched #endif (etc) in an include file. */
- struct if_stack *if_stack;
-
- /* True if this is a header file included using <FILENAME>. */
- char system_header_p;
- char seen_eof;
-
- /* True if buffer contains escape sequences.
- Currently there are three kinds:
- "@-" means following identifier should not be macro-expanded.
- "@ " means a token-separator. This turns into " " in final output
- if not stringizing and needed to separate tokens; otherwise nothing.
- "@@" means a normal '@'.
- (An '@' inside a string stands for itself and is never an escape.) */
- char has_escapes;
-};
-
-struct cpp_pending; /* Forward declaration - for C++. */
-struct file_name_map_list;
-
-typedef struct assertion_hashnode ASSERTION_HASHNODE;
-#define ASSERTION_HASHSIZE 37
-
-/* Maximum nesting of cpp_buffers. We use a static limit, partly for
- efficiency, and partly to limit runaway recursion. */
-#define CPP_STACK_MAX 200
-
-/* 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. */
-
-struct cpp_reader {
- parse_underflow_t get_token;
- cpp_buffer *buffer;
- cpp_buffer buffer_stack[CPP_STACK_MAX];
-
- int errors; /* Error counter for exit code */
- void *data;
-
- /* A buffer used for both for cpp_get_token's output, and also internally. */
- unsigned char *token_buffer;
- /* Alocated size of token_buffer. CPP_RESERVE allocates space. */
- int token_buffer_size;
- /* End of the written part of token_buffer. */
- unsigned char *limit;
-
- /* Line where a newline was first seen in a string constant. */
- int multiline_string_line;
-
- /* Current depth in #include directives that use <...>. */
- int system_include_depth;
-
- /* List of included files that contained #pragma once. */
- struct file_name_list *dont_repeat_files;
-
- /* List of other included files.
- If ->control_macro if nonzero, the file had a #ifndef
- around the entire contents, and ->control_macro gives the macro name. */
- struct file_name_list *all_include_files;
-
- /* Current maximum length of directory names in the search path
- for include files. (Altered as we get more of them.) */
- int max_include_len;
-
- /* Hash table of files already included with #include or #import. */
- struct import_file *import_hash_table[IMPORT_HASH_SIZE];
-
- struct if_stack *if_stack;
-
- /* Nonzero means we are inside an IF during a -pcp run. In this mode
- macro expansion is done, and preconditions are output for all macro
- uses requiring them. */
- char pcp_inside_if;
-
- /* Nonzero means we have printed (while error reporting) a list of
- containing files that matches the current status. */
- char input_stack_listing_current;
-
- /* If non-zero, macros are not expanded. */
- char no_macro_expand;
-
- /* Print column number in error messages. */
- char show_column;
-
- /* We're printed a warning recommending against using #import. */
- char import_warning;
-
- /* If true, character between '<' and '>' are a single (string) token. */
- char parsing_include_directive;
-
- /* True if escape sequences (as described for has_escapes in
- parse_buffer) should be emitted. */
- char output_escapes;
-
- /* 0: Have seen non-white-space on this line.
- 1: Only seen white space so far on this line.
- 2: Only seen white space so far in this file. */
- char only_seen_white;
-
- /* Nonzero means this file was included with a -imacros or -include
- command line and should not be recorded as an include file. */
-
- int no_record_file;
-
- long lineno;
-
- struct tm *timebuf;
-
- ASSERTION_HASHNODE *assertion_hashtab[ASSERTION_HASHSIZE];
-
- /* Buffer of -M output. */
- char *deps_buffer;
-
- /* Number of bytes allocated in above. */
- int deps_allocated_size;
-
- /* Number of bytes used. */
- int deps_size;
-
- /* Number of bytes since the last newline. */
- int deps_column;
-
-#ifdef __cplusplus
- ~cpp_reader () { cpp_cleanup (this); }
-#endif
-};
-
-#define CPP_FATAL_LIMIT 1000
-/* True if we have seen a "fatal" error. */
-#define CPP_FATAL_ERRORS(READER) ((READER)->errors >= CPP_FATAL_LIMIT)
-
-#define CPP_BUF_PEEK(BUFFER) \
- ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur : EOF)
-#define CPP_BUF_GET(BUFFER) \
- ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF)
-#define CPP_FORWARD(BUFFER, N) ((BUFFER)->cur += (N))
-
-/* Macros for manipulating the token_buffer. */
-
-#define CPP_OUT_BUFFER(PFILE) ((PFILE)->token_buffer)
-
-/* Number of characters currently in PFILE's output buffer. */
-#define CPP_WRITTEN(PFILE) ((PFILE)->limit - (PFILE)->token_buffer)
-#define CPP_PWRITTEN(PFILE) ((PFILE)->limit)
-
-/* Make sure PFILE->token_buffer has space for at least N more characters. */
-#define CPP_RESERVE(PFILE, N) \
- (CPP_WRITTEN (PFILE) + N > (PFILE)->token_buffer_size \
- && (cpp_grow_buffer (PFILE, N), 0))
-
-/* Append string STR (of length N) to PFILE's output buffer.
- Assume there is enough space. */
-#define CPP_PUTS_Q(PFILE, STR, N) \
- (bcopy (STR, (PFILE)->limit, (N)), (PFILE)->limit += (N))
-/* Append string STR (of length N) to PFILE's output buffer. Make space. */
-#define CPP_PUTS(PFILE, STR, N) CPP_RESERVE(PFILE, N), CPP_PUTS_Q(PFILE, STR,N)
-/* Append character CH to PFILE's output buffer. Assume sufficient space. */
-#define CPP_PUTC_Q(PFILE, CH) (*(PFILE)->limit++ = (CH))
-/* Append character CH to PFILE's output buffer. Make space if need be. */
-#define CPP_PUTC(PFILE, CH) (CPP_RESERVE (PFILE, 1), CPP_PUTC_Q (PFILE, CH))
-/* Make sure PFILE->limit is followed by '\0'. */
-#define CPP_NUL_TERMINATE_Q(PFILE) (*(PFILE)->limit = 0)
-#define CPP_NUL_TERMINATE(PFILE) (CPP_RESERVE(PFILE, 1), *(PFILE)->limit = 0)
-#define CPP_ADJUST_WRITTEN(PFILE,DELTA) ((PFILE)->limit += (DELTA))
-#define CPP_SET_WRITTEN(PFILE,N) ((PFILE)->limit = (PFILE)->token_buffer + (N))
-
-#define CPP_OPTIONS(PFILE) ((cpp_options *) (PFILE)->data)
-
-#define CPP_BUFFER(PFILE) ((PFILE)->buffer)
-#define CPP_PREV_BUFFER(BUFFER) ((BUFFER)+1)
-/* The bottom of the buffer stack. */
-#define CPP_NULL_BUFFER(PFILE) (&(PFILE)->buffer_stack[CPP_STACK_MAX])
-
-/* Pointed to by cpp_reader::data. */
-struct cpp_options {
- char *in_fname;
-
- /* Name of output file, for error messages. */
- char *out_fname;
-
- struct file_name_map_list *map_list;
-
- /* Non-0 means -v, so print the full set of include dirs. */
- char verbose;
-
- /* Nonzero means use extra default include directories for C++. */
-
- char cplusplus;
-
- /* Nonzero means handle cplusplus style comments */
-
- char cplusplus_comments;
-
- /* Nonzero means handle #import, for objective C. */
-
- char objc;
-
- /* Nonzero means this is an assembly file, and allow
- unknown directives, which could be comments. */
-
- int lang_asm;
-
- /* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */
-
- char for_lint;
-
- /* Nonzero means handle CHILL comment syntax
- and output CHILL string delimiter for __DATE___ etc. */
-
- char chill;
-
- /* Nonzero means copy comments into the output file. */
-
- char put_out_comments;
-
- /* Nonzero means don't process the ANSI trigraph sequences. */
-
- char no_trigraphs;
-
- /* Nonzero means print the names of included files rather than
- the preprocessed output. 1 means just the #include "...",
- 2 means #include <...> as well. */
-
- char print_deps;
-
- /* Nonzero if missing .h files in -M output are assumed to be generated
- files and not errors. */
-
- char print_deps_missing_files;
-
- /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
- char print_deps_append;
-
- /* Nonzero means print names of header files (-H). */
-
- char print_include_names;
-
- /* Nonzero means try to make failure to fit ANSI C an error. */
-
- char pedantic_errors;
-
- /* Nonzero means don't print warning messages. -w. */
-
- char inhibit_warnings;
-
- /* Nonzero means warn if slash-star appears in a comment. */
-
- char warn_comments;
-
- /* Nonzero means warn if there are any trigraphs. */
-
- char warn_trigraphs;
-
- /* Nonzero means warn if #import is used. */
-
- char warn_import;
-
- /* Nonzero means warn if a macro argument is (or would be)
- stringified with -traditional. */
-
- char warn_stringify;
-
- /* Nonzero means turn warnings into errors. */
-
- char warnings_are_errors;
-
- /* Nonzero causes output not to be done,
- but directives such as #define that have side effects
- are still obeyed. */
-
- char no_output;
-
- /* Nonzero means don't output line number information. */
-
- char no_line_commands;
-
-/* Nonzero means output the text in failing conditionals,
- inside #failed ... #endfailed. */
-
- char output_conditionals;
-
- /* Nonzero means -I- has been seen,
- so don't look for #include "foo" the source-file directory. */
- char ignore_srcdir;
-
- /* Zero means dollar signs are punctuation.
- This used to be needed for conformance to the C Standard,
- before the C Standard was corrected. */
- char dollars_in_ident;
-
- /* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */
- char traditional;
-
- /* Nonzero for the 1989 C Standard, including corrigenda and amendments. */
- char c89;
-
- /* Nonzero means give all the error messages the ANSI standard requires. */
- char pedantic;
-
- char done_initializing;
-
- struct file_name_list *include; /* First dir to search */
- /* First dir to search for <file> */
- /* This is the first element to use for #include <...>.
- If it is 0, use the entire chain for such includes. */
- struct file_name_list *first_bracket_include;
- /* This is the first element in the chain that corresponds to
- a directory of system header files. */
- struct file_name_list *first_system_include;
- struct file_name_list *last_include; /* Last in chain */
-
- /* Chain of include directories to put at the end of the other chain. */
- struct file_name_list *after_include;
- struct file_name_list *last_after_include; /* Last in chain */
-
- /* Chain to put at the start of the system include files. */
- struct file_name_list *before_system;
- struct file_name_list *last_before_system; /* Last in chain */
-
- /* Directory prefix that should replace `/usr' in the standard
- include file directories. */
- char *include_prefix;
-
- char inhibit_predefs;
- char no_standard_includes;
- char no_standard_cplusplus_includes;
-
-/* dump_only means inhibit output of the preprocessed text
- and instead output the definitions of all user-defined
- macros in a form suitable for use as input to cccp.
- dump_names means pass #define and the macro name through to output.
- dump_definitions means pass the whole definition (plus #define) through
-*/
-
- enum {dump_none = 0, dump_only, dump_names, dump_definitions}
- dump_macros;
-
-/* Nonzero means pass all #define and #undef directives which we actually
- process through to the output stream. This feature is used primarily
- to allow cc1 to record the #defines and #undefs for the sake of
- debuggers which understand about preprocessor macros, but it may
- also be useful with -E to figure out how symbols are defined, and
- where they are defined. */
- int debug_output;
-
- /* Pending -D, -U and -A options, in reverse order. */
- struct cpp_pending *pending;
-
- /* File name which deps are being written to.
- This is 0 if deps are being written to stdout. */
- char *deps_file;
-
- /* Target-name to write with the dependency information. */
- char *deps_target;
-};
-
-#define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional)
-#define CPP_C89(PFILE) (CPP_OPTIONS(PFILE)->c89)
-#define CPP_PEDANTIC(PFILE) (CPP_OPTIONS (PFILE)->pedantic)
-#define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps)
-
-/* Name under which this program was invoked. */
-
-extern char *progname;
-
-/* The structure of a node in the hash table. The hash table
- has entries for all tokens defined by #define commands (type T_MACRO),
- plus some special tokens like __LINE__ (these each have their own
- type, and the appropriate code is run when that type of node is seen.
- It does not contain control words like "#define", which are recognized
- by a separate piece of code. */
-
-/* different flavors of hash nodes --- also used in keyword table */
-enum node_type {
- T_DEFINE = 1, /* the `#define' keyword */
- T_INCLUDE, /* the `#include' keyword */
- T_INCLUDE_NEXT, /* the `#include_next' keyword */
- T_IMPORT, /* the `#import' keyword */
- T_IFDEF, /* the `#ifdef' keyword */
- T_IFNDEF, /* the `#ifndef' keyword */
- T_IF, /* the `#if' keyword */
- T_ELSE, /* `#else' */
- T_PRAGMA, /* `#pragma' */
- T_ELIF, /* `#elif' */
- T_UNDEF, /* `#undef' */
- T_LINE, /* `#line' */
- T_ERROR, /* `#error' */
- T_WARNING, /* `#warning' */
- T_ENDIF, /* `#endif' */
- T_SCCS, /* `#sccs', used on system V. */
- T_IDENT, /* `#ident', used on system V. */
- T_ASSERT, /* `#assert', taken from system V. */
- T_UNASSERT, /* `#unassert', taken from system V. */
- T_SPECLINE, /* special symbol `__LINE__' */
- T_DATE, /* `__DATE__' */
- T_FILE, /* `__FILE__' */
- T_BASE_FILE, /* `__BASE_FILE__' */
- T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
- T_VERSION, /* `__VERSION__' */
- T_SIZE_TYPE, /* `__SIZE_TYPE__' */
- T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */
- T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */
- T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */
- T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */
- T_TIME, /* `__TIME__' */
- T_CONST, /* Constant value, used by `__STDC__' */
- T_MACRO, /* macro defined by `#define' */
- T_DISABLED, /* macro temporarily turned off for rescan */
- T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */
- T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
- T_UNUSED /* Used for something not defined. */
- };
-
-/* Structure returned by create_definition */
-typedef struct macrodef MACRODEF;
-struct macrodef
-{
- struct definition *defn;
- unsigned char *symnam;
- int symlen;
-};
-
-/* Structure allocated for every #define. For a simple replacement
- such as
- #define foo bar ,
- nargs = -1, the `pattern' list is null, and the expansion is just
- the replacement text. Nargs = 0 means a functionlike macro with no args,
- e.g.,
- #define getchar() getc (stdin) .
- When there are args, the expansion is the replacement text with the
- args squashed out, and the reflist is a list describing how to
- build the output from the input: e.g., "3 chars, then the 1st arg,
- then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg".
- The chars here come from the expansion. Whatever is left of the
- expansion after the last arg-occurrence is copied after that arg.
- Note that the reflist can be arbitrarily long---
- its length depends on the number of times the arguments appear in
- the replacement text, not how many args there are. Example:
- #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and
- pattern list
- { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL }
- where (x, y) means (nchars, argno). */
-
-typedef struct definition DEFINITION;
-struct definition {
- int nargs;
- int length; /* length of expansion string */
- int predefined; /* True if the macro was builtin or */
- /* came from the command line */
- unsigned char *expansion;
- int line; /* Line number of definition */
- char *file; /* File of definition */
- char rest_args; /* Nonzero if last arg. absorbs the rest */
- struct reflist {
- struct reflist *next;
- char stringify; /* nonzero if this arg was preceded by a
- # operator. */
- char raw_before; /* Nonzero if a ## operator before arg. */
- char raw_after; /* Nonzero if a ## operator after arg. */
- char rest_args; /* Nonzero if this arg. absorbs the rest */
- int nchars; /* Number of literal chars to copy before
- this arg occurrence. */
- int argno; /* Number of arg to substitute (origin-0) */
- } *pattern;
- union {
- /* Names of macro args, concatenated in reverse order
- with comma-space between them.
- The only use of this is that we warn on redefinition
- if this differs between the old and new definitions. */
- unsigned char *argnames;
- } args;
-};
-
-extern unsigned char is_idchar[256];
-
-/* Stack of conditionals currently in progress
- (including both successful and failing conditionals). */
-
-struct if_stack {
- struct if_stack *next; /* for chaining to the next stack frame */
- char *fname; /* copied from input when frame is made */
- int lineno; /* similarly */
- int if_succeeded; /* true if a leg of this if-group
- has been passed through rescan */
- unsigned char *control_macro; /* For #ifndef at start of file,
- this is the macro name tested. */
- enum node_type type; /* type of last directive seen in this group */
-};
-typedef struct if_stack IF_STACK_FRAME;
-
-extern void cpp_buf_line_and_col PARAMS((cpp_buffer *, long *, long *));
-extern cpp_buffer* cpp_file_buffer PARAMS((cpp_reader *));
-extern void cpp_define PARAMS ((cpp_reader*, unsigned char *));
-
-extern void cpp_error ();
-extern void cpp_warning ();
-extern void cpp_pedwarn ();
-extern void cpp_error_with_line ();
-extern void cpp_pedwarn_with_line ();
-extern void cpp_pedwarn_with_file_and_line ();
-extern void fatal ();
-extern void cpp_error_from_errno ();
-extern void cpp_perror_with_name ();
-extern void cpp_pfatal_with_name ();
-
-extern void cpp_grow_buffer PARAMS ((cpp_reader *, long));
-extern int cpp_parse_escape PARAMS ((cpp_reader *, char **));
-extern cpp_buffer *cpp_push_buffer PARAMS ((cpp_reader *,
- unsigned char *, long));
-extern cpp_buffer *cpp_pop_buffer PARAMS ((cpp_reader *));
-
-extern cpp_hashnode *cpp_lookup PARAMS ((cpp_reader *, const unsigned char *,
- int, int));
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/gcc/cppmain.c b/gcc/cppmain.c
deleted file mode 100644
index 4f8d89ce3e0..00000000000
--- a/gcc/cppmain.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* CPP main program, using CPP Library.
- Copyright (C) 1995 Free Software Foundation, Inc.
- Written by Per Bothner, 1994-95.
-
-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, 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.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
-
-#include "cpplib.h"
-#include <stdio.h>
-
-#ifndef EMACS
-#include "config.h"
-#endif /* not EMACS */
-
-extern char *getenv ();
-
-char *progname;
-
-cpp_reader parse_in;
-cpp_options options;
-
-#ifdef abort
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-#endif
-
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- char *p;
- int i;
- int argi = 1; /* Next argument to handle. */
- struct cpp_options *opts = &options;
-
- p = argv[0] + strlen (argv[0]);
- while (p != argv[0] && p[-1] != '/') --p;
- progname = p;
-
- cpp_reader_init (&parse_in);
- parse_in.data = opts;
-
- cpp_options_init (opts);
-
- argi += cpp_handle_options (&parse_in, argc - argi , argv + argi);
- if (argi < argc && ! CPP_FATAL_ERRORS (&parse_in))
- cpp_fatal (&parse_in, "Invalid option `%s'", argv[argi]);
- if (CPP_FATAL_ERRORS (&parse_in))
- exit (FATAL_EXIT_CODE);
-
- parse_in.show_column = 1;
-
- if (! cpp_start_read (&parse_in, opts->in_fname))
- exit (FATAL_EXIT_CODE);
-
- /* Now that we know the input file is valid, open the output. */
-
- if (!opts->out_fname || !strcmp (opts->out_fname, ""))
- opts->out_fname = "stdout";
- else if (! freopen (opts->out_fname, "w", stdout))
- cpp_pfatal_with_name (&parse_in, opts->out_fname);
-
- for (;;)
- {
- enum cpp_token kind;
- if (! opts->no_output)
- {
- fwrite (parse_in.token_buffer, 1, CPP_WRITTEN (&parse_in), stdout);
- }
- CPP_SET_WRITTEN (&parse_in, 0);
- kind = cpp_get_token (&parse_in);
- if (kind == CPP_EOF)
- break;
- }
-
- cpp_finish (&parse_in);
-
- if (parse_in.errors)
- exit (FATAL_EXIT_CODE);
- exit (SUCCESS_EXIT_CODE);
-}
diff --git a/gcc/cross-make b/gcc/cross-make
deleted file mode 100644
index 5e5a93fb44e..00000000000
--- a/gcc/cross-make
+++ /dev/null
@@ -1,24 +0,0 @@
-# Build libgcc1.a for a cross-compiler.
-# By default this expects the user to provide libgcc1.a,
-# and gives up immediately if the user has not done so.
-LIBGCC1 = $(CROSS_LIBGCC1)
-
-# Specify tools and options for manipulating libraries for the target machine.
-AR = $(AR_FOR_TARGET)
-AR_FLAGS = $(AR_FOR_TARGET_FLAGS)
-OLDAR = $(AR_FOR_TARGET)
-OLDAR_FLAGS = $(AR_FOR_TARGET_FLAGS)
-RANLIB = $(RANLIB_FOR_TARGET)
-RANLIB_TEST = $(RANLIB_TEST_FOR_TARGET)
-
-# Dir to search for system headers. Normally /usr/include.
-SYSTEM_HEADER_DIR = $(tooldir)/include
-
-# Don't try to compile the things we can't compile.
-ALL = all.cross
-
-# Use cross-compiler version of float.h.
-FLOAT_H = $(CROSS_FLOAT_H)
-
-# Don't install assert.h in /usr/local/include.
-assertdir = $(tooldir)/include
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c
deleted file mode 100644
index 2c682436069..00000000000
--- a/gcc/crtstuff.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* Specialized bits of code needed to support construction and
- destruction of file-scope objects in C++ code.
- Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@monkeys.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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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. */
-
-/* This file is a bit like libgcc1.c/libgcc2.c in that it is compiled
- multiple times and yields multiple .o files.
-
- This file is useful on target machines where the object file format
- supports multiple "user-defined" sections (e.g. COFF, ELF, ROSE). On
- such systems, this file allows us to avoid running collect (or any
- other such slow and painful kludge). Additionally, if the target
- system supports a .init section, this file allows us to support the
- linking of C++ code with a non-C++ main program.
-
- Note that if INIT_SECTION_ASM_OP is defined in the tm.h file, then
- this file *will* make use of the .init section. If that symbol is
- not defined however, then the .init section will not be used.
-
- Currently, only ELF and COFF are supported. It is likely however that
- ROSE could also be supported, if someone was willing to do the work to
- make whatever (small?) adaptations are needed. (Some work may be
- needed on the ROSE assembler and linker also.)
-
- This file must be compiled with gcc. */
-
-/* It is incorrect to include config.h here, because this file is being
- compiled for the target, and hence definitions concerning only the host
- do not apply. */
-
-#include "tm.h"
-
-/* Provide default definitions for the pseudo-ops used to switch to the
- .ctors and .dtors sections.
-
- Note that we want to give these sections the SHF_WRITE attribute
- because these sections will actually contain data (i.e. tables of
- addresses of functions in the current root executable or shared library
- file) and, in the case of a shared library, the relocatable addresses
- will have to be properly resolved/relocated (and then written into) by
- the dynamic linker when it actually attaches the given shared library
- to the executing process. (Note that on SVR4, you may wish to use the
- `-z text' option to the ELF linker, when building a shared library, as
- an additional check that you are doing everything right. But if you do
- use the `-z text' option when building a shared library, you will get
- errors unless the .ctors and .dtors sections are marked as writable
- via the SHF_WRITE attribute.) */
-
-#ifndef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\""
-#endif
-#ifndef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\""
-#endif
-
-#ifdef OBJECT_FORMAT_ELF
-
-/* Declare a pointer to void function type. */
-typedef void (*func_ptr) (void);
-#define STATIC static
-
-#else /* OBJECT_FORMAT_ELF */
-
-#include "gbl-ctors.h"
-
-#ifndef ON_EXIT
-#define ON_EXIT(a, b)
-#endif
-#define STATIC
-
-#endif /* OBJECT_FORMAT_ELF */
-
-#ifdef CRT_BEGIN
-
-#ifdef INIT_SECTION_ASM_OP
-
-#ifdef OBJECT_FORMAT_ELF
-
-/* Run all the global destructors on exit from the program. */
-
-/* Some systems place the number of pointers in the first word of the
- table. On SVR4 however, that word is -1. In all cases, the table is
- null-terminated. On SVR4, we start from the beginning of the list and
- invoke each per-compilation-unit destructor routine in order
- until we find that null.
-
- Note that this function MUST be static. There will be one of these
- functions in each root executable and one in each shared library, but
- although they all have the same code, each one is unique in that it
- refers to one particular associated `__DTOR_LIST__' which belongs to the
- same particular root executable or shared library file.
-
- On some systems, this routine is run more than once from the .fini,
- when exit is called recursively, so we arrange to remember where in
- the list we left off processing, and we resume at that point,
- should we be re-invoked. */
-
-static func_ptr __DTOR_LIST__[];
-static void
-__do_global_dtors_aux ()
-{
- static func_ptr *p = __DTOR_LIST__ + 1;
- while (*p)
- {
- p++;
- (*(p-1)) ();
- }
-}
-
-/* Stick a call to __do_global_dtors_aux into the .fini section. */
-
-static void
-fini_dummy ()
-{
- asm (FINI_SECTION_ASM_OP);
- __do_global_dtors_aux ();
-#ifdef FORCE_FINI_SECTION_ALIGN
- FORCE_FINI_SECTION_ALIGN;
-#endif
- asm (TEXT_SECTION_ASM_OP);
-}
-
-#else /* OBJECT_FORMAT_ELF */
-
-/* The function __do_global_ctors_aux is compiled twice (once in crtbegin.o
- and once in crtend.o). It must be declared static to avoid a link
- error. Here, we define __do_global_ctors as an externally callable
- function. It is externally callable so that __main can invoke it when
- INVOKE__main is defined. This has the additional effect of forcing cc1
- to switch to the .text section. */
-
-static void __do_global_ctors_aux ();
-void __do_global_ctors ()
-{
-#ifdef INVOKE__main /* If __main won't actually call __do_global_ctors
- then it doesn't matter what's inside the function.
- The inside of __do_global_ctors_aux is called
- automatically in that case.
- And the Alliant fx2800 linker crashes
- on this reference. So prevent the crash. */
- __do_global_ctors_aux ();
-#endif
-}
-
-asm (INIT_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
-
-/* On some svr4 systems, the initial .init section preamble code provided in
- crti.o may do something, such as bump the stack, which we have to
- undo before we reach the function prologue code for __do_global_ctors
- (directly below). For such systems, define the macro INIT_SECTION_PREAMBLE
- to expand into the code needed to undo the actions of the crti.o file. */
-
-#ifdef INIT_SECTION_PREAMBLE
- INIT_SECTION_PREAMBLE;
-#endif
-
-/* A routine to invoke all of the global constructors upon entry to the
- program. We put this into the .init section (for systems that have
- such a thing) so that we can properly perform the construction of
- file-scope static-storage C++ objects within shared libraries. */
-
-static void
-__do_global_ctors_aux () /* prologue goes in .init section */
-{
-#ifdef FORCE_INIT_SECTION_ALIGN
- FORCE_INIT_SECTION_ALIGN; /* Explicit align before switch to .text */
-#endif
- asm (TEXT_SECTION_ASM_OP); /* don't put epilogue and body in .init */
- DO_GLOBAL_CTORS_BODY;
- ON_EXIT (__do_global_dtors, 0);
-}
-
-#endif /* OBJECT_FORMAT_ELF */
-
-#else /* defined(INIT_SECTION_ASM_OP) */
-
-#ifdef HAS_INIT_SECTION
-/* This case is used by the Irix 6 port, which supports named sections but
- not an SVR4-style .fini section. __do_global_dtors can be non-static
- in this case because the -fini switch to ld binds strongly. */
-static func_ptr __DTOR_LIST__[];
-void
-__do_global_dtors ()
-{
- func_ptr *p;
- for (p = __DTOR_LIST__ + 1; *p; p++)
- (*p) ();
-}
-#endif
-
-#endif /* defined(INIT_SECTION_ASM_OP) */
-
-/* Force cc1 to switch to .data section. */
-static func_ptr force_to_data[0] = { };
-
-/* NOTE: In order to be able to support SVR4 shared libraries, we arrange
- to have one set of symbols { __CTOR_LIST__, __DTOR_LIST__, __CTOR_END__,
- __DTOR_END__ } per root executable and also one set of these symbols
- per shared library. So in any given whole process image, we may have
- multiple definitions of each of these symbols. In order to prevent
- these definitions from conflicting with one another, and in order to
- ensure that the proper lists are used for the initialization/finalization
- of each individual shared library (respectively), we give these symbols
- only internal (i.e. `static') linkage, and we also make it a point to
- refer to only the __CTOR_END__ symbol in crtend.o and the __DTOR_LIST__
- symbol in crtbegin.o, where they are defined. */
-
-/* The -1 is a flag to __do_global_[cd]tors
- indicating that this table does not start with a count of elements. */
-#ifdef CTOR_LIST_BEGIN
-CTOR_LIST_BEGIN;
-#else
-asm (CTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
-STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) };
-#endif
-
-#ifdef DTOR_LIST_BEGIN
-DTOR_LIST_BEGIN;
-#else
-asm (DTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
-STATIC func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };
-#endif
-
-#endif /* defined(CRT_BEGIN) */
-
-#ifdef CRT_END
-
-#ifdef INIT_SECTION_ASM_OP
-
-#ifdef OBJECT_FORMAT_ELF
-
-static func_ptr __CTOR_END__[];
-static void
-__do_global_ctors_aux ()
-{
- func_ptr *p;
- for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
- (*p) ();
-}
-
-/* Stick a call to __do_global_ctors_aux into the .init section. */
-
-static void
-init_dummy ()
-{
- asm (INIT_SECTION_ASM_OP);
- __do_global_ctors_aux ();
-#ifdef FORCE_INIT_SECTION_ALIGN
- FORCE_INIT_SECTION_ALIGN;
-#endif
- asm (TEXT_SECTION_ASM_OP);
-
-/* This is a kludge. The i386 Linux dynamic linker needs ___brk_addr,
- __environ and atexit (). We have to make sure they are in the .dynsym
- section. We accomplish it by making a dummy call here. This
- code is never reached. */
-
-#if defined(__linux__) && defined(__PIC__) && defined(__i386__)
- {
- extern void *___brk_addr;
- extern char **__environ;
-
- ___brk_addr = __environ;
- atexit ();
- }
-#endif
-}
-
-#else /* OBJECT_FORMAT_ELF */
-
-/* Stick the real initialization code, followed by a normal sort of
- function epilogue at the very end of the .init section for this
- entire root executable file or for this entire shared library file.
-
- Note that we use some tricks here to get *just* the body and just
- a function epilogue (but no function prologue) into the .init
- section of the crtend.o file. Specifically, we switch to the .text
- section, start to define a function, and then we switch to the .init
- section just before the body code.
-
- Earlier on, we put the corresponding function prologue into the .init
- section of the crtbegin.o file (which will be linked in first).
-
- Note that we want to invoke all constructors for C++ file-scope static-
- storage objects AFTER any other possible initialization actions which
- may be performed by the code in the .init section contributions made by
- other libraries, etc. That's because those other initializations may
- include setup operations for very primitive things (e.g. initializing
- the state of the floating-point coprocessor, etc.) which should be done
- before we start to execute any of the user's code. */
-
-static void
-__do_global_ctors_aux () /* prologue goes in .text section */
-{
- asm (INIT_SECTION_ASM_OP);
- DO_GLOBAL_CTORS_BODY;
- ON_EXIT (__do_global_dtors, 0);
-} /* epilogue and body go in .init section */
-
-#endif /* OBJECT_FORMAT_ELF */
-
-#else /* defined(INIT_SECTION_ASM_OP) */
-
-#ifdef HAS_INIT_SECTION
-/* This case is used by the Irix 6 port, which supports named sections but
- not an SVR4-style .init section. __do_global_ctors can be non-static
- in this case because the -init switch to ld binds strongly. */
-static func_ptr __CTOR_END__[];
-void
-__do_global_ctors ()
-{
- func_ptr *p;
- for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
- (*p) ();
-}
-#endif
-
-#endif /* defined(INIT_SECTION_ASM_OP) */
-
-/* Force cc1 to switch to .data section. */
-static func_ptr force_to_data[0] = { };
-
-/* Put a word containing zero at the end of each of our two lists of function
- addresses. Note that the words defined here go into the .ctors and .dtors
- sections of the crtend.o file, and since that file is always linked in
- last, these words naturally end up at the very ends of the two lists
- contained in these two sections. */
-
-#ifdef CTOR_LIST_END
-CTOR_LIST_END;
-#else
-asm (CTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
-STATIC func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
-#endif
-
-#ifdef DTOR_LIST_END
-DTOR_LIST_END;
-#else
-asm (DTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
-STATIC func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
-#endif
-
-#endif /* defined(CRT_END) */
diff --git a/gcc/cse.c b/gcc/cse.c
deleted file mode 100644
index 893f1a4266c..00000000000
--- a/gcc/cse.c
+++ /dev/null
@@ -1,8821 +0,0 @@
-/* Common subexpression elimination for GNU compiler.
- Copyright (C) 1987, 88, 89, 92-6, 1997 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. */
-
-
-#include "config.h"
-/* Must precede rtl.h for FFS. */
-#include <stdio.h>
-
-#include "rtl.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "flags.h"
-#include "real.h"
-#include "insn-config.h"
-#include "recog.h"
-
-#include <setjmp.h>
-
-/* The basic idea of common subexpression elimination is to go
- through the code, keeping a record of expressions that would
- have the same value at the current scan point, and replacing
- expressions encountered with the cheapest equivalent expression.
-
- It is too complicated to keep track of the different possibilities
- when control paths merge; so, at each label, we forget all that is
- known and start fresh. This can be described as processing each
- basic block separately. Note, however, that these are not quite
- the same as the basic blocks found by a later pass and used for
- data flow analysis and register packing. We do not need to start fresh
- after a conditional jump instruction if there is no label there.
-
- We use two data structures to record the equivalent expressions:
- a hash table for most expressions, and several vectors together
- with "quantity numbers" to record equivalent (pseudo) registers.
-
- The use of the special data structure for registers is desirable
- because it is faster. It is possible because registers references
- contain a fairly small number, the register number, taken from
- a contiguously allocated series, and two register references are
- identical if they have the same number. General expressions
- do not have any such thing, so the only way to retrieve the
- information recorded on an expression other than a register
- is to keep it in a hash table.
-
-Registers and "quantity numbers":
-
- At the start of each basic block, all of the (hardware and pseudo)
- registers used in the function are given distinct quantity
- numbers to indicate their contents. During scan, when the code
- copies one register into another, we copy the quantity number.
- When a register is loaded in any other way, we allocate a new
- quantity number to describe the value generated by this operation.
- `reg_qty' records what quantity a register is currently thought
- of as containing.
-
- All real quantity numbers are greater than or equal to `max_reg'.
- If register N has not been assigned a quantity, reg_qty[N] will equal N.
-
- Quantity numbers below `max_reg' do not exist and none of the `qty_...'
- variables should be referenced with an index below `max_reg'.
-
- We also maintain a bidirectional chain of registers for each
- quantity number. `qty_first_reg', `qty_last_reg',
- `reg_next_eqv' and `reg_prev_eqv' hold these chains.
-
- The first register in a chain is the one whose lifespan is least local.
- Among equals, it is the one that was seen first.
- We replace any equivalent register with that one.
-
- If two registers have the same quantity number, it must be true that
- REG expressions with `qty_mode' must be in the hash table for both
- registers and must be in the same class.
-
- The converse is not true. Since hard registers may be referenced in
- any mode, two REG expressions might be equivalent in the hash table
- but not have the same quantity number if the quantity number of one
- of the registers is not the same mode as those expressions.
-
-Constants and quantity numbers
-
- When a quantity has a known constant value, that value is stored
- in the appropriate element of qty_const. This is in addition to
- putting the constant in the hash table as is usual for non-regs.
-
- Whether a reg or a constant is preferred is determined by the configuration
- macro CONST_COSTS and will often depend on the constant value. In any
- event, expressions containing constants can be simplified, by fold_rtx.
-
- When a quantity has a known nearly constant value (such as an address
- of a stack slot), that value is stored in the appropriate element
- of qty_const.
-
- Integer constants don't have a machine mode. However, cse
- determines the intended machine mode from the destination
- of the instruction that moves the constant. The machine mode
- is recorded in the hash table along with the actual RTL
- constant expression so that different modes are kept separate.
-
-Other expressions:
-
- To record known equivalences among expressions in general
- we use a hash table called `table'. It has a fixed number of buckets
- that contain chains of `struct table_elt' elements for expressions.
- These chains connect the elements whose expressions have the same
- hash codes.
-
- Other chains through the same elements connect the elements which
- currently have equivalent values.
-
- Register references in an expression are canonicalized before hashing
- the expression. This is done using `reg_qty' and `qty_first_reg'.
- The hash code of a register reference is computed using the quantity
- number, not the register number.
-
- When the value of an expression changes, it is necessary to remove from the
- hash table not just that expression but all expressions whose values
- could be different as a result.
-
- 1. If the value changing is in memory, except in special cases
- ANYTHING referring to memory could be changed. That is because
- nobody knows where a pointer does not point.
- The function `invalidate_memory' removes what is necessary.
-
- The special cases are when the address is constant or is
- a constant plus a fixed register such as the frame pointer
- or a static chain pointer. When such addresses are stored in,
- we can tell exactly which other such addresses must be invalidated
- due to overlap. `invalidate' does this.
- All expressions that refer to non-constant
- memory addresses are also invalidated. `invalidate_memory' does this.
-
- 2. If the value changing is a register, all expressions
- containing references to that register, and only those,
- must be removed.
-
- Because searching the entire hash table for expressions that contain
- a register is very slow, we try to figure out when it isn't necessary.
- Precisely, this is necessary only when expressions have been
- entered in the hash table using this register, and then the value has
- changed, and then another expression wants to be added to refer to
- the register's new value. This sequence of circumstances is rare
- within any one basic block.
-
- The vectors `reg_tick' and `reg_in_table' are used to detect this case.
- reg_tick[i] is incremented whenever a value is stored in register i.
- reg_in_table[i] holds -1 if no references to register i have been
- entered in the table; otherwise, it contains the value reg_tick[i] had
- when the references were entered. If we want to enter a reference
- and reg_in_table[i] != reg_tick[i], we must scan and remove old references.
- Until we want to enter a new entry, the mere fact that the two vectors
- don't match makes the entries be ignored if anyone tries to match them.
-
- Registers themselves are entered in the hash table as well as in
- the equivalent-register chains. However, the vectors `reg_tick'
- and `reg_in_table' do not apply to expressions which are simple
- register references. These expressions are removed from the table
- immediately when they become invalid, and this can be done even if
- we do not immediately search for all the expressions that refer to
- the register.
-
- A CLOBBER rtx in an instruction invalidates its operand for further
- reuse. A CLOBBER or SET rtx whose operand is a MEM:BLK
- invalidates everything that resides in memory.
-
-Related expressions:
-
- Constant expressions that differ only by an additive integer
- are called related. When a constant expression is put in
- the table, the related expression with no constant term
- is also entered. These are made to point at each other
- so that it is possible to find out if there exists any
- register equivalent to an expression related to a given expression. */
-
-/* One plus largest register number used in this function. */
-
-static int max_reg;
-
-/* Length of vectors indexed by quantity number.
- We know in advance we will not need a quantity number this big. */
-
-static int max_qty;
-
-/* Next quantity number to be allocated.
- This is 1 + the largest number needed so far. */
-
-static int next_qty;
-
-/* Indexed by quantity number, gives the first (or last) (pseudo) register
- in the chain of registers that currently contain this quantity. */
-
-static int *qty_first_reg;
-static int *qty_last_reg;
-
-/* Index by quantity number, gives the mode of the quantity. */
-
-static enum machine_mode *qty_mode;
-
-/* Indexed by quantity number, gives the rtx of the constant value of the
- quantity, or zero if it does not have a known value.
- A sum of the frame pointer (or arg pointer) plus a constant
- can also be entered here. */
-
-static rtx *qty_const;
-
-/* Indexed by qty number, gives the insn that stored the constant value
- recorded in `qty_const'. */
-
-static rtx *qty_const_insn;
-
-/* The next three variables are used to track when a comparison between a
- quantity and some constant or register has been passed. In that case, we
- know the results of the comparison in case we see it again. These variables
- record a comparison that is known to be true. */
-
-/* Indexed by qty number, gives the rtx code of a comparison with a known
- result involving this quantity. If none, it is UNKNOWN. */
-static enum rtx_code *qty_comparison_code;
-
-/* Indexed by qty number, gives the constant being compared against in a
- comparison of known result. If no such comparison, it is undefined.
- If the comparison is not with a constant, it is zero. */
-
-static rtx *qty_comparison_const;
-
-/* Indexed by qty number, gives the quantity being compared against in a
- comparison of known result. If no such comparison, if it undefined.
- If the comparison is not with a register, it is -1. */
-
-static int *qty_comparison_qty;
-
-#ifdef HAVE_cc0
-/* For machines that have a CC0, we do not record its value in the hash
- table since its use is guaranteed to be the insn immediately following
- its definition and any other insn is presumed to invalidate it.
-
- Instead, we store below the value last assigned to CC0. If it should
- happen to be a constant, it is stored in preference to the actual
- assigned value. In case it is a constant, we store the mode in which
- the constant should be interpreted. */
-
-static rtx prev_insn_cc0;
-static enum machine_mode prev_insn_cc0_mode;
-#endif
-
-/* Previous actual insn. 0 if at first insn of basic block. */
-
-static rtx prev_insn;
-
-/* Insn being scanned. */
-
-static rtx this_insn;
-
-/* Index by (pseudo) register number, gives the quantity number
- of the register's current contents. */
-
-static int *reg_qty;
-
-/* Index by (pseudo) register number, gives the number of the next (or
- previous) (pseudo) register in the chain of registers sharing the same
- value.
-
- Or -1 if this register is at the end of the chain.
-
- If reg_qty[N] == N, reg_next_eqv[N] is undefined. */
-
-static int *reg_next_eqv;
-static int *reg_prev_eqv;
-
-/* Index by (pseudo) register number, gives the number of times
- that register has been altered in the current basic block. */
-
-static int *reg_tick;
-
-/* Index by (pseudo) register number, gives the reg_tick value at which
- rtx's containing this register are valid in the hash table.
- If this does not equal the current reg_tick value, such expressions
- existing in the hash table are invalid.
- If this is -1, no expressions containing this register have been
- entered in the table. */
-
-static int *reg_in_table;
-
-/* A HARD_REG_SET containing all the hard registers for which there is
- currently a REG expression in the hash table. Note the difference
- from the above variables, which indicate if the REG is mentioned in some
- expression in the table. */
-
-static HARD_REG_SET hard_regs_in_table;
-
-/* A HARD_REG_SET containing all the hard registers that are invalidated
- by a CALL_INSN. */
-
-static HARD_REG_SET regs_invalidated_by_call;
-
-/* Two vectors of ints:
- one containing max_reg -1's; the other max_reg + 500 (an approximation
- for max_qty) elements where element i contains i.
- These are used to initialize various other vectors fast. */
-
-static int *all_minus_one;
-static int *consec_ints;
-
-/* CUID of insn that starts the basic block currently being cse-processed. */
-
-static int cse_basic_block_start;
-
-/* CUID of insn that ends the basic block currently being cse-processed. */
-
-static int cse_basic_block_end;
-
-/* Vector mapping INSN_UIDs to cuids.
- The cuids are like uids but increase monotonically always.
- We use them to see whether a reg is used outside a given basic block. */
-
-static int *uid_cuid;
-
-/* Highest UID in UID_CUID. */
-static int max_uid;
-
-/* Get the cuid of an insn. */
-
-#define INSN_CUID(INSN) (uid_cuid[INSN_UID (INSN)])
-
-/* Nonzero if cse has altered conditional jump insns
- in such a way that jump optimization should be redone. */
-
-static int cse_jumps_altered;
-
-/* Nonzero if we put a LABEL_REF into the hash table. Since we may have put
- it into an INSN without a REG_LABEL, we have to rerun jump after CSE
- to put in the note. */
-static int recorded_label_ref;
-
-/* canon_hash stores 1 in do_not_record
- if it notices a reference to CC0, PC, or some other volatile
- subexpression. */
-
-static int do_not_record;
-
-#ifdef LOAD_EXTEND_OP
-
-/* Scratch rtl used when looking for load-extended copy of a MEM. */
-static rtx memory_extend_rtx;
-#endif
-
-/* canon_hash stores 1 in hash_arg_in_memory
- if it notices a reference to memory within the expression being hashed. */
-
-static int hash_arg_in_memory;
-
-/* canon_hash stores 1 in hash_arg_in_struct
- if it notices a reference to memory that's part of a structure. */
-
-static int hash_arg_in_struct;
-
-/* The hash table contains buckets which are chains of `struct table_elt's,
- each recording one expression's information.
- That expression is in the `exp' field.
-
- Those elements with the same hash code are chained in both directions
- through the `next_same_hash' and `prev_same_hash' fields.
-
- Each set of expressions with equivalent values
- are on a two-way chain through the `next_same_value'
- and `prev_same_value' fields, and all point with
- the `first_same_value' field at the first element in
- that chain. The chain is in order of increasing cost.
- Each element's cost value is in its `cost' field.
-
- The `in_memory' field is nonzero for elements that
- involve any reference to memory. These elements are removed
- whenever a write is done to an unidentified location in memory.
- To be safe, we assume that a memory address is unidentified unless
- the address is either a symbol constant or a constant plus
- the frame pointer or argument pointer.
-
- The `in_struct' field is nonzero for elements that
- involve any reference to memory inside a structure or array.
-
- The `related_value' field is used to connect related expressions
- (that differ by adding an integer).
- The related expressions are chained in a circular fashion.
- `related_value' is zero for expressions for which this
- chain is not useful.
-
- The `cost' field stores the cost of this element's expression.
-
- The `is_const' flag is set if the element is a constant (including
- a fixed address).
-
- The `flag' field is used as a temporary during some search routines.
-
- The `mode' field is usually the same as GET_MODE (`exp'), but
- if `exp' is a CONST_INT and has no machine mode then the `mode'
- field is the mode it was being used as. Each constant is
- recorded separately for each mode it is used with. */
-
-
-struct table_elt
-{
- rtx exp;
- struct table_elt *next_same_hash;
- struct table_elt *prev_same_hash;
- struct table_elt *next_same_value;
- struct table_elt *prev_same_value;
- struct table_elt *first_same_value;
- struct table_elt *related_value;
- int cost;
- enum machine_mode mode;
- char in_memory;
- char in_struct;
- char is_const;
- char flag;
-};
-
-/* We don't want a lot of buckets, because we rarely have very many
- things stored in the hash table, and a lot of buckets slows
- down a lot of loops that happen frequently. */
-#define NBUCKETS 31
-
-/* Compute hash code of X in mode M. Special-case case where X is a pseudo
- register (hard registers may require `do_not_record' to be set). */
-
-#define HASH(X, M) \
- (GET_CODE (X) == REG && REGNO (X) >= FIRST_PSEUDO_REGISTER \
- ? (((unsigned) REG << 7) + (unsigned) reg_qty[REGNO (X)]) % NBUCKETS \
- : canon_hash (X, M) % NBUCKETS)
-
-/* Determine whether register number N is considered a fixed register for CSE.
- It is desirable to replace other regs with fixed regs, to reduce need for
- non-fixed hard regs.
- A reg wins if it is either the frame pointer or designated as fixed,
- but not if it is an overlapping register. */
-#ifdef OVERLAPPING_REGNO_P
-#define FIXED_REGNO_P(N) \
- (((N) == FRAME_POINTER_REGNUM || (N) == HARD_FRAME_POINTER_REGNUM \
- || fixed_regs[N] || global_regs[N]) \
- && ! OVERLAPPING_REGNO_P ((N)))
-#else
-#define FIXED_REGNO_P(N) \
- ((N) == FRAME_POINTER_REGNUM || (N) == HARD_FRAME_POINTER_REGNUM \
- || fixed_regs[N] || global_regs[N])
-#endif
-
-/* Compute cost of X, as stored in the `cost' field of a table_elt. Fixed
- hard registers and pointers into the frame are the cheapest with a cost
- of 0. Next come pseudos with a cost of one and other hard registers with
- a cost of 2. Aside from these special cases, call `rtx_cost'. */
-
-#define CHEAP_REGNO(N) \
- ((N) == FRAME_POINTER_REGNUM || (N) == HARD_FRAME_POINTER_REGNUM \
- || (N) == STACK_POINTER_REGNUM || (N) == ARG_POINTER_REGNUM \
- || ((N) >= FIRST_VIRTUAL_REGISTER && (N) <= LAST_VIRTUAL_REGISTER) \
- || ((N) < FIRST_PSEUDO_REGISTER \
- && FIXED_REGNO_P (N) && REGNO_REG_CLASS (N) != NO_REGS))
-
-/* A register is cheap if it is a user variable assigned to the register
- or if its register number always corresponds to a cheap register. */
-
-#define CHEAP_REG(N) \
- ((REG_USERVAR_P (N) && REGNO (N) < FIRST_PSEUDO_REGISTER) \
- || CHEAP_REGNO (REGNO (N)))
-
-#define COST(X) \
- (GET_CODE (X) == REG \
- ? (CHEAP_REG (X) ? 0 \
- : REGNO (X) >= FIRST_PSEUDO_REGISTER ? 1 \
- : 2) \
- : ((GET_CODE (X) == SUBREG \
- && GET_CODE (SUBREG_REG (X)) == REG \
- && GET_MODE_CLASS (GET_MODE (X)) == MODE_INT \
- && GET_MODE_CLASS (GET_MODE (SUBREG_REG (X))) == MODE_INT \
- && (GET_MODE_SIZE (GET_MODE (X)) \
- < GET_MODE_SIZE (GET_MODE (SUBREG_REG (X)))) \
- && subreg_lowpart_p (X) \
- && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE (X)), \
- GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (X))))) \
- ? (CHEAP_REG (SUBREG_REG (X)) ? 0 \
- : REGNO (SUBREG_REG (X)) >= FIRST_PSEUDO_REGISTER ? 1 \
- : 2) \
- : rtx_cost (X, SET) * 2))
-
-/* Determine if the quantity number for register X represents a valid index
- into the `qty_...' variables. */
-
-#define REGNO_QTY_VALID_P(N) (reg_qty[N] != (N))
-
-static struct table_elt *table[NBUCKETS];
-
-/* Chain of `struct table_elt's made so far for this function
- but currently removed from the table. */
-
-static struct table_elt *free_element_chain;
-
-/* Number of `struct table_elt' structures made so far for this function. */
-
-static int n_elements_made;
-
-/* Maximum value `n_elements_made' has had so far in this compilation
- for functions previously processed. */
-
-static int max_elements_made;
-
-/* Surviving equivalence class when two equivalence classes are merged
- by recording the effects of a jump in the last insn. Zero if the
- last insn was not a conditional jump. */
-
-static struct table_elt *last_jump_equiv_class;
-
-/* Set to the cost of a constant pool reference if one was found for a
- symbolic constant. If this was found, it means we should try to
- convert constants into constant pool entries if they don't fit in
- the insn. */
-
-static int constant_pool_entries_cost;
-
-/* Bits describing what kind of values in memory must be invalidated
- for a particular instruction. If all three bits are zero,
- no memory refs need to be invalidated. Each bit is more powerful
- than the preceding ones, and if a bit is set then the preceding
- bits are also set.
-
- Here is how the bits are set:
- Pushing onto the stack invalidates only the stack pointer,
- writing at a fixed address invalidates only variable addresses,
- writing in a structure element at variable address
- invalidates all but scalar variables,
- and writing in anything else at variable address invalidates everything. */
-
-struct write_data
-{
- int sp : 1; /* Invalidate stack pointer. */
- int var : 1; /* Invalidate variable addresses. */
- int nonscalar : 1; /* Invalidate all but scalar variables. */
- int all : 1; /* Invalidate all memory refs. */
-};
-
-/* Define maximum length of a branch path. */
-
-#define PATHLENGTH 10
-
-/* This data describes a block that will be processed by cse_basic_block. */
-
-struct cse_basic_block_data {
- /* Lowest CUID value of insns in block. */
- int low_cuid;
- /* Highest CUID value of insns in block. */
- int high_cuid;
- /* Total number of SETs in block. */
- int nsets;
- /* Last insn in the block. */
- rtx last;
- /* Size of current branch path, if any. */
- int path_size;
- /* Current branch path, indicating which branches will be taken. */
- struct branch_path {
- /* The branch insn. */
- rtx branch;
- /* Whether it should be taken or not. AROUND is the same as taken
- except that it is used when the destination label is not preceded
- by a BARRIER. */
- enum taken {TAKEN, NOT_TAKEN, AROUND} status;
- } path[PATHLENGTH];
-};
-
-/* Nonzero if X has the form (PLUS frame-pointer integer). We check for
- virtual regs here because the simplify_*_operation routines are called
- by integrate.c, which is called before virtual register instantiation. */
-
-#define FIXED_BASE_PLUS_P(X) \
- ((X) == frame_pointer_rtx || (X) == hard_frame_pointer_rtx \
- || (X) == arg_pointer_rtx \
- || (X) == virtual_stack_vars_rtx \
- || (X) == virtual_incoming_args_rtx \
- || (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (XEXP (X, 0) == frame_pointer_rtx \
- || XEXP (X, 0) == hard_frame_pointer_rtx \
- || XEXP (X, 0) == arg_pointer_rtx \
- || XEXP (X, 0) == virtual_stack_vars_rtx \
- || XEXP (X, 0) == virtual_incoming_args_rtx)))
-
-/* Similar, but also allows reference to the stack pointer.
-
- This used to include FIXED_BASE_PLUS_P, however, we can't assume that
- arg_pointer_rtx by itself is nonzero, because on at least one machine,
- the i960, the arg pointer is zero when it is unused. */
-
-#define NONZERO_BASE_PLUS_P(X) \
- ((X) == frame_pointer_rtx || (X) == hard_frame_pointer_rtx \
- || (X) == virtual_stack_vars_rtx \
- || (X) == virtual_incoming_args_rtx \
- || (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (XEXP (X, 0) == frame_pointer_rtx \
- || XEXP (X, 0) == hard_frame_pointer_rtx \
- || XEXP (X, 0) == arg_pointer_rtx \
- || XEXP (X, 0) == virtual_stack_vars_rtx \
- || XEXP (X, 0) == virtual_incoming_args_rtx)) \
- || (X) == stack_pointer_rtx \
- || (X) == virtual_stack_dynamic_rtx \
- || (X) == virtual_outgoing_args_rtx \
- || (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && (XEXP (X, 0) == stack_pointer_rtx \
- || XEXP (X, 0) == virtual_stack_dynamic_rtx \
- || XEXP (X, 0) == virtual_outgoing_args_rtx)))
-
-static void new_basic_block PROTO((void));
-static void make_new_qty PROTO((int));
-static void make_regs_eqv PROTO((int, int));
-static void delete_reg_equiv PROTO((int));
-static int mention_regs PROTO((rtx));
-static int insert_regs PROTO((rtx, struct table_elt *, int));
-static void free_element PROTO((struct table_elt *));
-static void remove_from_table PROTO((struct table_elt *, unsigned));
-static struct table_elt *get_element PROTO((void));
-static struct table_elt *lookup PROTO((rtx, unsigned, enum machine_mode)),
- *lookup_for_remove PROTO((rtx, unsigned, enum machine_mode));
-static rtx lookup_as_function PROTO((rtx, enum rtx_code));
-static struct table_elt *insert PROTO((rtx, struct table_elt *, unsigned,
- enum machine_mode));
-static void merge_equiv_classes PROTO((struct table_elt *,
- struct table_elt *));
-static void invalidate PROTO((rtx, enum machine_mode));
-static void remove_invalid_refs PROTO((int));
-static void rehash_using_reg PROTO((rtx));
-static void invalidate_memory PROTO((struct write_data *));
-static void invalidate_for_call PROTO((void));
-static rtx use_related_value PROTO((rtx, struct table_elt *));
-static unsigned canon_hash PROTO((rtx, enum machine_mode));
-static unsigned safe_hash PROTO((rtx, enum machine_mode));
-static int exp_equiv_p PROTO((rtx, rtx, int, int));
-static void set_nonvarying_address_components PROTO((rtx, int, rtx *,
- HOST_WIDE_INT *,
- HOST_WIDE_INT *));
-static int refers_to_p PROTO((rtx, rtx));
-static int refers_to_mem_p PROTO((rtx, rtx, HOST_WIDE_INT,
- HOST_WIDE_INT));
-static int cse_rtx_addr_varies_p PROTO((rtx));
-static rtx canon_reg PROTO((rtx, rtx));
-static void find_best_addr PROTO((rtx, rtx *));
-static enum rtx_code find_comparison_args PROTO((enum rtx_code, rtx *, rtx *,
- enum machine_mode *,
- enum machine_mode *));
-static rtx cse_gen_binary PROTO((enum rtx_code, enum machine_mode,
- rtx, rtx));
-static rtx simplify_plus_minus PROTO((enum rtx_code, enum machine_mode,
- rtx, rtx));
-static rtx fold_rtx PROTO((rtx, rtx));
-static rtx equiv_constant PROTO((rtx));
-static void record_jump_equiv PROTO((rtx, int));
-static void record_jump_cond PROTO((enum rtx_code, enum machine_mode,
- rtx, rtx, int));
-static void cse_insn PROTO((rtx, int));
-static void note_mem_written PROTO((rtx, struct write_data *));
-static void invalidate_from_clobbers PROTO((struct write_data *, rtx));
-static rtx cse_process_notes PROTO((rtx, rtx));
-static void cse_around_loop PROTO((rtx));
-static void invalidate_skipped_set PROTO((rtx, rtx));
-static void invalidate_skipped_block PROTO((rtx));
-static void cse_check_loop_start PROTO((rtx, rtx));
-static void cse_set_around_loop PROTO((rtx, rtx, rtx));
-static rtx cse_basic_block PROTO((rtx, rtx, struct branch_path *, int));
-static void count_reg_usage PROTO((rtx, int *, rtx, int));
-
-extern int rtx_equal_function_value_matters;
-
-/* Return an estimate of the cost of computing rtx X.
- One use is in cse, to decide which expression to keep in the hash table.
- Another is in rtl generation, to pick the cheapest way to multiply.
- Other uses like the latter are expected in the future. */
-
-/* Return the right cost to give to an operation
- to make the cost of the corresponding register-to-register instruction
- N times that of a fast register-to-register instruction. */
-
-#define COSTS_N_INSNS(N) ((N) * 4 - 2)
-
-int
-rtx_cost (x, outer_code)
- rtx x;
- enum rtx_code outer_code;
-{
- register int i, j;
- register enum rtx_code code;
- register char *fmt;
- register int total;
-
- if (x == 0)
- return 0;
-
- /* Compute the default costs of certain things.
- Note that RTX_COSTS can override the defaults. */
-
- code = GET_CODE (x);
- switch (code)
- {
- case MULT:
- /* Count multiplication by 2**n as a shift,
- because if we are considering it, we would output it as a shift. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && exact_log2 (INTVAL (XEXP (x, 1))) >= 0)
- total = 2;
- else
- total = COSTS_N_INSNS (5);
- break;
- case DIV:
- case UDIV:
- case MOD:
- case UMOD:
- total = COSTS_N_INSNS (7);
- break;
- case USE:
- /* Used in loop.c and combine.c as a marker. */
- total = 0;
- break;
- case ASM_OPERANDS:
- /* We don't want these to be used in substitutions because
- we have no way of validating the resulting insn. So assign
- anything containing an ASM_OPERANDS a very high cost. */
- total = 1000;
- break;
- default:
- total = 2;
- }
-
- switch (code)
- {
- case REG:
- return ! CHEAP_REG (x);
-
- case SUBREG:
- /* If we can't tie these modes, make this expensive. The larger
- the mode, the more expensive it is. */
- if (! MODES_TIEABLE_P (GET_MODE (x), GET_MODE (SUBREG_REG (x))))
- return COSTS_N_INSNS (2
- + GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD);
- return 2;
-#ifdef RTX_COSTS
- RTX_COSTS (x, code, outer_code);
-#endif
- CONST_COSTS (x, code, outer_code);
- }
-
- /* Sum the costs of the sub-rtx's, plus cost of this operation,
- which is already in total. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- total += rtx_cost (XEXP (x, i), code);
- else if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- total += rtx_cost (XVECEXP (x, i, j), code);
-
- return total;
-}
-
-/* Clear the hash table and initialize each register with its own quantity,
- for a new basic block. */
-
-static void
-new_basic_block ()
-{
- register int i;
-
- next_qty = max_reg;
-
- bzero ((char *) reg_tick, max_reg * sizeof (int));
-
- bcopy ((char *) all_minus_one, (char *) reg_in_table,
- max_reg * sizeof (int));
- bcopy ((char *) consec_ints, (char *) reg_qty, max_reg * sizeof (int));
- CLEAR_HARD_REG_SET (hard_regs_in_table);
-
- /* The per-quantity values used to be initialized here, but it is
- much faster to initialize each as it is made in `make_new_qty'. */
-
- for (i = 0; i < NBUCKETS; i++)
- {
- register struct table_elt *this, *next;
- for (this = table[i]; this; this = next)
- {
- next = this->next_same_hash;
- free_element (this);
- }
- }
-
- bzero ((char *) table, sizeof table);
-
- prev_insn = 0;
-
-#ifdef HAVE_cc0
- prev_insn_cc0 = 0;
-#endif
-}
-
-/* Say that register REG contains a quantity not in any register before
- and initialize that quantity. */
-
-static void
-make_new_qty (reg)
- register int reg;
-{
- register int q;
-
- if (next_qty >= max_qty)
- abort ();
-
- q = reg_qty[reg] = next_qty++;
- qty_first_reg[q] = reg;
- qty_last_reg[q] = reg;
- qty_const[q] = qty_const_insn[q] = 0;
- qty_comparison_code[q] = UNKNOWN;
-
- reg_next_eqv[reg] = reg_prev_eqv[reg] = -1;
-}
-
-/* Make reg NEW equivalent to reg OLD.
- OLD is not changing; NEW is. */
-
-static void
-make_regs_eqv (new, old)
- register int new, old;
-{
- register int lastr, firstr;
- register int q = reg_qty[old];
-
- /* Nothing should become eqv until it has a "non-invalid" qty number. */
- if (! REGNO_QTY_VALID_P (old))
- abort ();
-
- reg_qty[new] = q;
- firstr = qty_first_reg[q];
- lastr = qty_last_reg[q];
-
- /* Prefer fixed hard registers to anything. Prefer pseudo regs to other
- hard regs. Among pseudos, if NEW will live longer than any other reg
- of the same qty, and that is beyond the current basic block,
- make it the new canonical replacement for this qty. */
- if (! (firstr < FIRST_PSEUDO_REGISTER && FIXED_REGNO_P (firstr))
- /* Certain fixed registers might be of the class NO_REGS. This means
- that not only can they not be allocated by the compiler, but
- they cannot be used in substitutions or canonicalizations
- either. */
- && (new >= FIRST_PSEUDO_REGISTER || REGNO_REG_CLASS (new) != NO_REGS)
- && ((new < FIRST_PSEUDO_REGISTER && FIXED_REGNO_P (new))
- || (new >= FIRST_PSEUDO_REGISTER
- && (firstr < FIRST_PSEUDO_REGISTER
- || ((uid_cuid[regno_last_uid[new]] > cse_basic_block_end
- || (uid_cuid[regno_first_uid[new]]
- < cse_basic_block_start))
- && (uid_cuid[regno_last_uid[new]]
- > uid_cuid[regno_last_uid[firstr]]))))))
- {
- reg_prev_eqv[firstr] = new;
- reg_next_eqv[new] = firstr;
- reg_prev_eqv[new] = -1;
- qty_first_reg[q] = new;
- }
- else
- {
- /* If NEW is a hard reg (known to be non-fixed), insert at end.
- Otherwise, insert before any non-fixed hard regs that are at the
- end. Registers of class NO_REGS cannot be used as an
- equivalent for anything. */
- while (lastr < FIRST_PSEUDO_REGISTER && reg_prev_eqv[lastr] >= 0
- && (REGNO_REG_CLASS (lastr) == NO_REGS || ! FIXED_REGNO_P (lastr))
- && new >= FIRST_PSEUDO_REGISTER)
- lastr = reg_prev_eqv[lastr];
- reg_next_eqv[new] = reg_next_eqv[lastr];
- if (reg_next_eqv[lastr] >= 0)
- reg_prev_eqv[reg_next_eqv[lastr]] = new;
- else
- qty_last_reg[q] = new;
- reg_next_eqv[lastr] = new;
- reg_prev_eqv[new] = lastr;
- }
-}
-
-/* Remove REG from its equivalence class. */
-
-static void
-delete_reg_equiv (reg)
- register int reg;
-{
- register int q = reg_qty[reg];
- register int p, n;
-
- /* If invalid, do nothing. */
- if (q == reg)
- return;
-
- p = reg_prev_eqv[reg];
- n = reg_next_eqv[reg];
-
- if (n != -1)
- reg_prev_eqv[n] = p;
- else
- qty_last_reg[q] = p;
- if (p != -1)
- reg_next_eqv[p] = n;
- else
- qty_first_reg[q] = n;
-
- reg_qty[reg] = reg;
-}
-
-/* Remove any invalid expressions from the hash table
- that refer to any of the registers contained in expression X.
-
- Make sure that newly inserted references to those registers
- as subexpressions will be considered valid.
-
- mention_regs is not called when a register itself
- is being stored in the table.
-
- Return 1 if we have done something that may have changed the hash code
- of X. */
-
-static int
-mention_regs (x)
- rtx x;
-{
- register enum rtx_code code;
- register int i, j;
- register char *fmt;
- register int changed = 0;
-
- if (x == 0)
- return 0;
-
- code = GET_CODE (x);
- if (code == REG)
- {
- register int regno = REGNO (x);
- register int endregno
- = regno + (regno >= FIRST_PSEUDO_REGISTER ? 1
- : HARD_REGNO_NREGS (regno, GET_MODE (x)));
- int i;
-
- for (i = regno; i < endregno; i++)
- {
- if (reg_in_table[i] >= 0 && reg_in_table[i] != reg_tick[i])
- remove_invalid_refs (i);
-
- reg_in_table[i] = reg_tick[i];
- }
-
- return 0;
- }
-
- /* If X is a comparison or a COMPARE and either operand is a register
- that does not have a quantity, give it one. This is so that a later
- call to record_jump_equiv won't cause X to be assigned a different
- hash code and not found in the table after that call.
-
- It is not necessary to do this here, since rehash_using_reg can
- fix up the table later, but doing this here eliminates the need to
- call that expensive function in the most common case where the only
- use of the register is in the comparison. */
-
- if (code == COMPARE || GET_RTX_CLASS (code) == '<')
- {
- if (GET_CODE (XEXP (x, 0)) == REG
- && ! REGNO_QTY_VALID_P (REGNO (XEXP (x, 0))))
- if (insert_regs (XEXP (x, 0), NULL_PTR, 0))
- {
- rehash_using_reg (XEXP (x, 0));
- changed = 1;
- }
-
- if (GET_CODE (XEXP (x, 1)) == REG
- && ! REGNO_QTY_VALID_P (REGNO (XEXP (x, 1))))
- if (insert_regs (XEXP (x, 1), NULL_PTR, 0))
- {
- rehash_using_reg (XEXP (x, 1));
- changed = 1;
- }
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- changed |= mention_regs (XEXP (x, i));
- else if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- changed |= mention_regs (XVECEXP (x, i, j));
-
- return changed;
-}
-
-/* Update the register quantities for inserting X into the hash table
- with a value equivalent to CLASSP.
- (If the class does not contain a REG, it is irrelevant.)
- If MODIFIED is nonzero, X is a destination; it is being modified.
- Note that delete_reg_equiv should be called on a register
- before insert_regs is done on that register with MODIFIED != 0.
-
- Nonzero value means that elements of reg_qty have changed
- so X's hash code may be different. */
-
-static int
-insert_regs (x, classp, modified)
- rtx x;
- struct table_elt *classp;
- int modified;
-{
- if (GET_CODE (x) == REG)
- {
- register int regno = REGNO (x);
-
- /* If REGNO is in the equivalence table already but is of the
- wrong mode for that equivalence, don't do anything here. */
-
- if (REGNO_QTY_VALID_P (regno)
- && qty_mode[reg_qty[regno]] != GET_MODE (x))
- return 0;
-
- if (modified || ! REGNO_QTY_VALID_P (regno))
- {
- if (classp)
- for (classp = classp->first_same_value;
- classp != 0;
- classp = classp->next_same_value)
- if (GET_CODE (classp->exp) == REG
- && GET_MODE (classp->exp) == GET_MODE (x))
- {
- make_regs_eqv (regno, REGNO (classp->exp));
- return 1;
- }
-
- make_new_qty (regno);
- qty_mode[reg_qty[regno]] = GET_MODE (x);
- return 1;
- }
-
- return 0;
- }
-
- /* If X is a SUBREG, we will likely be inserting the inner register in the
- table. If that register doesn't have an assigned quantity number at
- this point but does later, the insertion that we will be doing now will
- not be accessible because its hash code will have changed. So assign
- a quantity number now. */
-
- else if (GET_CODE (x) == SUBREG && GET_CODE (SUBREG_REG (x)) == REG
- && ! REGNO_QTY_VALID_P (REGNO (SUBREG_REG (x))))
- {
- insert_regs (SUBREG_REG (x), NULL_PTR, 0);
- mention_regs (SUBREG_REG (x));
- return 1;
- }
- else
- return mention_regs (x);
-}
-
-/* Look in or update the hash table. */
-
-/* Put the element ELT on the list of free elements. */
-
-static void
-free_element (elt)
- struct table_elt *elt;
-{
- elt->next_same_hash = free_element_chain;
- free_element_chain = elt;
-}
-
-/* Return an element that is free for use. */
-
-static struct table_elt *
-get_element ()
-{
- struct table_elt *elt = free_element_chain;
- if (elt)
- {
- free_element_chain = elt->next_same_hash;
- return elt;
- }
- n_elements_made++;
- return (struct table_elt *) oballoc (sizeof (struct table_elt));
-}
-
-/* Remove table element ELT from use in the table.
- HASH is its hash code, made using the HASH macro.
- It's an argument because often that is known in advance
- and we save much time not recomputing it. */
-
-static void
-remove_from_table (elt, hash)
- register struct table_elt *elt;
- unsigned hash;
-{
- if (elt == 0)
- return;
-
- /* Mark this element as removed. See cse_insn. */
- elt->first_same_value = 0;
-
- /* Remove the table element from its equivalence class. */
-
- {
- register struct table_elt *prev = elt->prev_same_value;
- register struct table_elt *next = elt->next_same_value;
-
- if (next) next->prev_same_value = prev;
-
- if (prev)
- prev->next_same_value = next;
- else
- {
- register struct table_elt *newfirst = next;
- while (next)
- {
- next->first_same_value = newfirst;
- next = next->next_same_value;
- }
- }
- }
-
- /* Remove the table element from its hash bucket. */
-
- {
- register struct table_elt *prev = elt->prev_same_hash;
- register struct table_elt *next = elt->next_same_hash;
-
- if (next) next->prev_same_hash = prev;
-
- if (prev)
- prev->next_same_hash = next;
- else if (table[hash] == elt)
- table[hash] = next;
- else
- {
- /* This entry is not in the proper hash bucket. This can happen
- when two classes were merged by `merge_equiv_classes'. Search
- for the hash bucket that it heads. This happens only very
- rarely, so the cost is acceptable. */
- for (hash = 0; hash < NBUCKETS; hash++)
- if (table[hash] == elt)
- table[hash] = next;
- }
- }
-
- /* Remove the table element from its related-value circular chain. */
-
- if (elt->related_value != 0 && elt->related_value != elt)
- {
- register struct table_elt *p = elt->related_value;
- while (p->related_value != elt)
- p = p->related_value;
- p->related_value = elt->related_value;
- if (p->related_value == p)
- p->related_value = 0;
- }
-
- free_element (elt);
-}
-
-/* Look up X in the hash table and return its table element,
- or 0 if X is not in the table.
-
- MODE is the machine-mode of X, or if X is an integer constant
- with VOIDmode then MODE is the mode with which X will be used.
-
- Here we are satisfied to find an expression whose tree structure
- looks like X. */
-
-static struct table_elt *
-lookup (x, hash, mode)
- rtx x;
- unsigned hash;
- enum machine_mode mode;
-{
- register struct table_elt *p;
-
- for (p = table[hash]; p; p = p->next_same_hash)
- if (mode == p->mode && ((x == p->exp && GET_CODE (x) == REG)
- || exp_equiv_p (x, p->exp, GET_CODE (x) != REG, 0)))
- return p;
-
- return 0;
-}
-
-/* Like `lookup' but don't care whether the table element uses invalid regs.
- Also ignore discrepancies in the machine mode of a register. */
-
-static struct table_elt *
-lookup_for_remove (x, hash, mode)
- rtx x;
- unsigned hash;
- enum machine_mode mode;
-{
- register struct table_elt *p;
-
- if (GET_CODE (x) == REG)
- {
- int regno = REGNO (x);
- /* Don't check the machine mode when comparing registers;
- invalidating (REG:SI 0) also invalidates (REG:DF 0). */
- for (p = table[hash]; p; p = p->next_same_hash)
- if (GET_CODE (p->exp) == REG
- && REGNO (p->exp) == regno)
- return p;
- }
- else
- {
- for (p = table[hash]; p; p = p->next_same_hash)
- if (mode == p->mode && (x == p->exp || exp_equiv_p (x, p->exp, 0, 0)))
- return p;
- }
-
- return 0;
-}
-
-/* Look for an expression equivalent to X and with code CODE.
- If one is found, return that expression. */
-
-static rtx
-lookup_as_function (x, code)
- rtx x;
- enum rtx_code code;
-{
- register struct table_elt *p = lookup (x, safe_hash (x, VOIDmode) % NBUCKETS,
- GET_MODE (x));
- if (p == 0)
- return 0;
-
- for (p = p->first_same_value; p; p = p->next_same_value)
- {
- if (GET_CODE (p->exp) == code
- /* Make sure this is a valid entry in the table. */
- && exp_equiv_p (p->exp, p->exp, 1, 0))
- return p->exp;
- }
-
- return 0;
-}
-
-/* Insert X in the hash table, assuming HASH is its hash code
- and CLASSP is an element of the class it should go in
- (or 0 if a new class should be made).
- It is inserted at the proper position to keep the class in
- the order cheapest first.
-
- MODE is the machine-mode of X, or if X is an integer constant
- with VOIDmode then MODE is the mode with which X will be used.
-
- For elements of equal cheapness, the most recent one
- goes in front, except that the first element in the list
- remains first unless a cheaper element is added. The order of
- pseudo-registers does not matter, as canon_reg will be called to
- find the cheapest when a register is retrieved from the table.
-
- The in_memory field in the hash table element is set to 0.
- The caller must set it nonzero if appropriate.
-
- You should call insert_regs (X, CLASSP, MODIFY) before calling here,
- and if insert_regs returns a nonzero value
- you must then recompute its hash code before calling here.
-
- If necessary, update table showing constant values of quantities. */
-
-#define CHEAPER(X,Y) ((X)->cost < (Y)->cost)
-
-static struct table_elt *
-insert (x, classp, hash, mode)
- register rtx x;
- register struct table_elt *classp;
- unsigned hash;
- enum machine_mode mode;
-{
- register struct table_elt *elt;
-
- /* If X is a register and we haven't made a quantity for it,
- something is wrong. */
- if (GET_CODE (x) == REG && ! REGNO_QTY_VALID_P (REGNO (x)))
- abort ();
-
- /* If X is a hard register, show it is being put in the table. */
- if (GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
- {
- int regno = REGNO (x);
- int endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
- int i;
-
- for (i = regno; i < endregno; i++)
- SET_HARD_REG_BIT (hard_regs_in_table, i);
- }
-
- /* If X is a label, show we recorded it. */
- if (GET_CODE (x) == LABEL_REF
- || (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF))
- recorded_label_ref = 1;
-
- /* Put an element for X into the right hash bucket. */
-
- elt = get_element ();
- elt->exp = x;
- elt->cost = COST (x);
- elt->next_same_value = 0;
- elt->prev_same_value = 0;
- elt->next_same_hash = table[hash];
- elt->prev_same_hash = 0;
- elt->related_value = 0;
- elt->in_memory = 0;
- elt->mode = mode;
- elt->is_const = (CONSTANT_P (x)
- /* GNU C++ takes advantage of this for `this'
- (and other const values). */
- || (RTX_UNCHANGING_P (x)
- && GET_CODE (x) == REG
- && REGNO (x) >= FIRST_PSEUDO_REGISTER)
- || FIXED_BASE_PLUS_P (x));
-
- if (table[hash])
- table[hash]->prev_same_hash = elt;
- table[hash] = elt;
-
- /* Put it into the proper value-class. */
- if (classp)
- {
- classp = classp->first_same_value;
- if (CHEAPER (elt, classp))
- /* Insert at the head of the class */
- {
- register struct table_elt *p;
- elt->next_same_value = classp;
- classp->prev_same_value = elt;
- elt->first_same_value = elt;
-
- for (p = classp; p; p = p->next_same_value)
- p->first_same_value = elt;
- }
- else
- {
- /* Insert not at head of the class. */
- /* Put it after the last element cheaper than X. */
- register struct table_elt *p, *next;
- for (p = classp; (next = p->next_same_value) && CHEAPER (next, elt);
- p = next);
- /* Put it after P and before NEXT. */
- elt->next_same_value = next;
- if (next)
- next->prev_same_value = elt;
- elt->prev_same_value = p;
- p->next_same_value = elt;
- elt->first_same_value = classp;
- }
- }
- else
- elt->first_same_value = elt;
-
- /* If this is a constant being set equivalent to a register or a register
- being set equivalent to a constant, note the constant equivalence.
-
- If this is a constant, it cannot be equivalent to a different constant,
- and a constant is the only thing that can be cheaper than a register. So
- we know the register is the head of the class (before the constant was
- inserted).
-
- If this is a register that is not already known equivalent to a
- constant, we must check the entire class.
-
- If this is a register that is already known equivalent to an insn,
- update `qty_const_insn' to show that `this_insn' is the latest
- insn making that quantity equivalent to the constant. */
-
- if (elt->is_const && classp && GET_CODE (classp->exp) == REG
- && GET_CODE (x) != REG)
- {
- qty_const[reg_qty[REGNO (classp->exp)]]
- = gen_lowpart_if_possible (qty_mode[reg_qty[REGNO (classp->exp)]], x);
- qty_const_insn[reg_qty[REGNO (classp->exp)]] = this_insn;
- }
-
- else if (GET_CODE (x) == REG && classp && ! qty_const[reg_qty[REGNO (x)]]
- && ! elt->is_const)
- {
- register struct table_elt *p;
-
- for (p = classp; p != 0; p = p->next_same_value)
- {
- if (p->is_const && GET_CODE (p->exp) != REG)
- {
- qty_const[reg_qty[REGNO (x)]]
- = gen_lowpart_if_possible (GET_MODE (x), p->exp);
- qty_const_insn[reg_qty[REGNO (x)]] = this_insn;
- break;
- }
- }
- }
-
- else if (GET_CODE (x) == REG && qty_const[reg_qty[REGNO (x)]]
- && GET_MODE (x) == qty_mode[reg_qty[REGNO (x)]])
- qty_const_insn[reg_qty[REGNO (x)]] = this_insn;
-
- /* If this is a constant with symbolic value,
- and it has a term with an explicit integer value,
- link it up with related expressions. */
- if (GET_CODE (x) == CONST)
- {
- rtx subexp = get_related_value (x);
- unsigned subhash;
- struct table_elt *subelt, *subelt_prev;
-
- if (subexp != 0)
- {
- /* Get the integer-free subexpression in the hash table. */
- subhash = safe_hash (subexp, mode) % NBUCKETS;
- subelt = lookup (subexp, subhash, mode);
- if (subelt == 0)
- subelt = insert (subexp, NULL_PTR, subhash, mode);
- /* Initialize SUBELT's circular chain if it has none. */
- if (subelt->related_value == 0)
- subelt->related_value = subelt;
- /* Find the element in the circular chain that precedes SUBELT. */
- subelt_prev = subelt;
- while (subelt_prev->related_value != subelt)
- subelt_prev = subelt_prev->related_value;
- /* Put new ELT into SUBELT's circular chain just before SUBELT.
- This way the element that follows SUBELT is the oldest one. */
- elt->related_value = subelt_prev->related_value;
- subelt_prev->related_value = elt;
- }
- }
-
- return elt;
-}
-
-/* Given two equivalence classes, CLASS1 and CLASS2, put all the entries from
- CLASS2 into CLASS1. This is done when we have reached an insn which makes
- the two classes equivalent.
-
- CLASS1 will be the surviving class; CLASS2 should not be used after this
- call.
-
- Any invalid entries in CLASS2 will not be copied. */
-
-static void
-merge_equiv_classes (class1, class2)
- struct table_elt *class1, *class2;
-{
- struct table_elt *elt, *next, *new;
-
- /* Ensure we start with the head of the classes. */
- class1 = class1->first_same_value;
- class2 = class2->first_same_value;
-
- /* If they were already equal, forget it. */
- if (class1 == class2)
- return;
-
- for (elt = class2; elt; elt = next)
- {
- unsigned hash;
- rtx exp = elt->exp;
- enum machine_mode mode = elt->mode;
-
- next = elt->next_same_value;
-
- /* Remove old entry, make a new one in CLASS1's class.
- Don't do this for invalid entries as we cannot find their
- hash code (it also isn't necessary). */
- if (GET_CODE (exp) == REG || exp_equiv_p (exp, exp, 1, 0))
- {
- hash_arg_in_memory = 0;
- hash_arg_in_struct = 0;
- hash = HASH (exp, mode);
-
- if (GET_CODE (exp) == REG)
- delete_reg_equiv (REGNO (exp));
-
- remove_from_table (elt, hash);
-
- if (insert_regs (exp, class1, 0))
- {
- rehash_using_reg (exp);
- hash = HASH (exp, mode);
- }
- new = insert (exp, class1, hash, mode);
- new->in_memory = hash_arg_in_memory;
- new->in_struct = hash_arg_in_struct;
- }
- }
-}
-
-/* Remove from the hash table, or mark as invalid,
- all expressions whose values could be altered by storing in X.
- X is a register, a subreg, or a memory reference with nonvarying address
- (because, when a memory reference with a varying address is stored in,
- all memory references are removed by invalidate_memory
- so specific invalidation is superfluous).
- FULL_MODE, if not VOIDmode, indicates that this much should be invalidated
- instead of just the amount indicated by the mode of X. This is only used
- for bitfield stores into memory.
-
- A nonvarying address may be just a register or just
- a symbol reference, or it may be either of those plus
- a numeric offset. */
-
-static void
-invalidate (x, full_mode)
- rtx x;
- enum machine_mode full_mode;
-{
- register int i;
- register struct table_elt *p;
- rtx base;
- HOST_WIDE_INT start, end;
-
- /* If X is a register, dependencies on its contents
- are recorded through the qty number mechanism.
- Just change the qty number of the register,
- mark it as invalid for expressions that refer to it,
- and remove it itself. */
-
- if (GET_CODE (x) == REG)
- {
- register int regno = REGNO (x);
- register unsigned hash = HASH (x, GET_MODE (x));
-
- /* Remove REGNO from any quantity list it might be on and indicate
- that it's value might have changed. If it is a pseudo, remove its
- entry from the hash table.
-
- For a hard register, we do the first two actions above for any
- additional hard registers corresponding to X. Then, if any of these
- registers are in the table, we must remove any REG entries that
- overlap these registers. */
-
- delete_reg_equiv (regno);
- reg_tick[regno]++;
-
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- /* Because a register can be referenced in more than one mode,
- we might have to remove more than one table entry. */
-
- struct table_elt *elt;
-
- while (elt = lookup_for_remove (x, hash, GET_MODE (x)))
- remove_from_table (elt, hash);
- }
- else
- {
- HOST_WIDE_INT in_table
- = TEST_HARD_REG_BIT (hard_regs_in_table, regno);
- int endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
- int tregno, tendregno;
- register struct table_elt *p, *next;
-
- CLEAR_HARD_REG_BIT (hard_regs_in_table, regno);
-
- for (i = regno + 1; i < endregno; i++)
- {
- in_table |= TEST_HARD_REG_BIT (hard_regs_in_table, i);
- CLEAR_HARD_REG_BIT (hard_regs_in_table, i);
- delete_reg_equiv (i);
- reg_tick[i]++;
- }
-
- if (in_table)
- for (hash = 0; hash < NBUCKETS; hash++)
- for (p = table[hash]; p; p = next)
- {
- next = p->next_same_hash;
-
- if (GET_CODE (p->exp) != REG
- || REGNO (p->exp) >= FIRST_PSEUDO_REGISTER)
- continue;
-
- tregno = REGNO (p->exp);
- tendregno
- = tregno + HARD_REGNO_NREGS (tregno, GET_MODE (p->exp));
- if (tendregno > regno && tregno < endregno)
- remove_from_table (p, hash);
- }
- }
-
- return;
- }
-
- if (GET_CODE (x) == SUBREG)
- {
- if (GET_CODE (SUBREG_REG (x)) != REG)
- abort ();
- invalidate (SUBREG_REG (x), VOIDmode);
- return;
- }
-
- /* X is not a register; it must be a memory reference with
- a nonvarying address. Remove all hash table elements
- that refer to overlapping pieces of memory. */
-
- if (GET_CODE (x) != MEM)
- abort ();
-
- if (full_mode == VOIDmode)
- full_mode = GET_MODE (x);
-
- set_nonvarying_address_components (XEXP (x, 0), GET_MODE_SIZE (full_mode),
- &base, &start, &end);
-
- for (i = 0; i < NBUCKETS; i++)
- {
- register struct table_elt *next;
- for (p = table[i]; p; p = next)
- {
- next = p->next_same_hash;
- if (refers_to_mem_p (p->exp, base, start, end))
- remove_from_table (p, i);
- }
- }
-}
-
-/* Remove all expressions that refer to register REGNO,
- since they are already invalid, and we are about to
- mark that register valid again and don't want the old
- expressions to reappear as valid. */
-
-static void
-remove_invalid_refs (regno)
- int regno;
-{
- register int i;
- register struct table_elt *p, *next;
-
- for (i = 0; i < NBUCKETS; i++)
- for (p = table[i]; p; p = next)
- {
- next = p->next_same_hash;
- if (GET_CODE (p->exp) != REG
- && refers_to_regno_p (regno, regno + 1, p->exp, NULL_PTR))
- remove_from_table (p, i);
- }
-}
-
-/* Recompute the hash codes of any valid entries in the hash table that
- reference X, if X is a register, or SUBREG_REG (X) if X is a SUBREG.
-
- This is called when we make a jump equivalence. */
-
-static void
-rehash_using_reg (x)
- rtx x;
-{
- int i;
- struct table_elt *p, *next;
- unsigned hash;
-
- if (GET_CODE (x) == SUBREG)
- x = SUBREG_REG (x);
-
- /* If X is not a register or if the register is known not to be in any
- valid entries in the table, we have no work to do. */
-
- if (GET_CODE (x) != REG
- || reg_in_table[REGNO (x)] < 0
- || reg_in_table[REGNO (x)] != reg_tick[REGNO (x)])
- return;
-
- /* Scan all hash chains looking for valid entries that mention X.
- If we find one and it is in the wrong hash chain, move it. We can skip
- objects that are registers, since they are handled specially. */
-
- for (i = 0; i < NBUCKETS; i++)
- for (p = table[i]; p; p = next)
- {
- next = p->next_same_hash;
- if (GET_CODE (p->exp) != REG && reg_mentioned_p (x, p->exp)
- && exp_equiv_p (p->exp, p->exp, 1, 0)
- && i != (hash = safe_hash (p->exp, p->mode) % NBUCKETS))
- {
- if (p->next_same_hash)
- p->next_same_hash->prev_same_hash = p->prev_same_hash;
-
- if (p->prev_same_hash)
- p->prev_same_hash->next_same_hash = p->next_same_hash;
- else
- table[i] = p->next_same_hash;
-
- p->next_same_hash = table[hash];
- p->prev_same_hash = 0;
- if (table[hash])
- table[hash]->prev_same_hash = p;
- table[hash] = p;
- }
- }
-}
-
-/* Remove from the hash table all expressions that reference memory,
- or some of them as specified by *WRITES. */
-
-static void
-invalidate_memory (writes)
- struct write_data *writes;
-{
- register int i;
- register struct table_elt *p, *next;
- int all = writes->all;
- int nonscalar = writes->nonscalar;
-
- for (i = 0; i < NBUCKETS; i++)
- for (p = table[i]; p; p = next)
- {
- next = p->next_same_hash;
- if (p->in_memory
- && (all
- || (nonscalar && p->in_struct)
- || cse_rtx_addr_varies_p (p->exp)))
- remove_from_table (p, i);
- }
-}
-
-/* Remove from the hash table any expression that is a call-clobbered
- register. Also update their TICK values. */
-
-static void
-invalidate_for_call ()
-{
- int regno, endregno;
- int i;
- unsigned hash;
- struct table_elt *p, *next;
- int in_table = 0;
-
- /* Go through all the hard registers. For each that is clobbered in
- a CALL_INSN, remove the register from quantity chains and update
- reg_tick if defined. Also see if any of these registers is currently
- in the table. */
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
- {
- delete_reg_equiv (regno);
- if (reg_tick[regno] >= 0)
- reg_tick[regno]++;
-
- in_table |= (TEST_HARD_REG_BIT (hard_regs_in_table, regno) != 0);
- }
-
- /* In the case where we have no call-clobbered hard registers in the
- table, we are done. Otherwise, scan the table and remove any
- entry that overlaps a call-clobbered register. */
-
- if (in_table)
- for (hash = 0; hash < NBUCKETS; hash++)
- for (p = table[hash]; p; p = next)
- {
- next = p->next_same_hash;
-
- if (GET_CODE (p->exp) != REG
- || REGNO (p->exp) >= FIRST_PSEUDO_REGISTER)
- continue;
-
- regno = REGNO (p->exp);
- endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (p->exp));
-
- for (i = regno; i < endregno; i++)
- if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
- {
- remove_from_table (p, hash);
- break;
- }
- }
-}
-
-/* Given an expression X of type CONST,
- and ELT which is its table entry (or 0 if it
- is not in the hash table),
- return an alternate expression for X as a register plus integer.
- If none can be found, return 0. */
-
-static rtx
-use_related_value (x, elt)
- rtx x;
- struct table_elt *elt;
-{
- register struct table_elt *relt = 0;
- register struct table_elt *p, *q;
- HOST_WIDE_INT offset;
-
- /* First, is there anything related known?
- If we have a table element, we can tell from that.
- Otherwise, must look it up. */
-
- if (elt != 0 && elt->related_value != 0)
- relt = elt;
- else if (elt == 0 && GET_CODE (x) == CONST)
- {
- rtx subexp = get_related_value (x);
- if (subexp != 0)
- relt = lookup (subexp,
- safe_hash (subexp, GET_MODE (subexp)) % NBUCKETS,
- GET_MODE (subexp));
- }
-
- if (relt == 0)
- return 0;
-
- /* Search all related table entries for one that has an
- equivalent register. */
-
- p = relt;
- while (1)
- {
- /* This loop is strange in that it is executed in two different cases.
- The first is when X is already in the table. Then it is searching
- the RELATED_VALUE list of X's class (RELT). The second case is when
- X is not in the table. Then RELT points to a class for the related
- value.
-
- Ensure that, whatever case we are in, that we ignore classes that have
- the same value as X. */
-
- if (rtx_equal_p (x, p->exp))
- q = 0;
- else
- for (q = p->first_same_value; q; q = q->next_same_value)
- if (GET_CODE (q->exp) == REG)
- break;
-
- if (q)
- break;
-
- p = p->related_value;
-
- /* We went all the way around, so there is nothing to be found.
- Alternatively, perhaps RELT was in the table for some other reason
- and it has no related values recorded. */
- if (p == relt || p == 0)
- break;
- }
-
- if (q == 0)
- return 0;
-
- offset = (get_integer_term (x) - get_integer_term (p->exp));
- /* Note: OFFSET may be 0 if P->xexp and X are related by commutativity. */
- return plus_constant (q->exp, offset);
-}
-
-/* Hash an rtx. We are careful to make sure the value is never negative.
- Equivalent registers hash identically.
- MODE is used in hashing for CONST_INTs only;
- otherwise the mode of X is used.
-
- Store 1 in do_not_record if any subexpression is volatile.
-
- Store 1 in hash_arg_in_memory if X contains a MEM rtx
- which does not have the RTX_UNCHANGING_P bit set.
- In this case, also store 1 in hash_arg_in_struct
- if there is a MEM rtx which has the MEM_IN_STRUCT_P bit set.
-
- Note that cse_insn knows that the hash code of a MEM expression
- is just (int) MEM plus the hash code of the address. */
-
-static unsigned
-canon_hash (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- register int i, j;
- register unsigned hash = 0;
- register enum rtx_code code;
- register char *fmt;
-
- /* repeat is used to turn tail-recursion into iteration. */
- repeat:
- if (x == 0)
- return hash;
-
- code = GET_CODE (x);
- switch (code)
- {
- case REG:
- {
- register int regno = REGNO (x);
-
- /* On some machines, we can't record any non-fixed hard register,
- because extending its life will cause reload problems. We
- consider ap, fp, and sp to be fixed for this purpose.
- On all machines, we can't record any global registers. */
-
- if (regno < FIRST_PSEUDO_REGISTER
- && (global_regs[regno]
-#ifdef SMALL_REGISTER_CLASSES
- || (SMALL_REGISTER_CLASSES
- && ! fixed_regs[regno]
- && regno != FRAME_POINTER_REGNUM
- && regno != HARD_FRAME_POINTER_REGNUM
- && regno != ARG_POINTER_REGNUM
- && regno != STACK_POINTER_REGNUM)
-#endif
- ))
- {
- do_not_record = 1;
- return 0;
- }
- hash += ((unsigned) REG << 7) + (unsigned) reg_qty[regno];
- return hash;
- }
-
- case CONST_INT:
- {
- unsigned HOST_WIDE_INT tem = INTVAL (x);
- hash += ((unsigned) CONST_INT << 7) + (unsigned) mode + tem;
- return hash;
- }
-
- case CONST_DOUBLE:
- /* This is like the general case, except that it only counts
- the integers representing the constant. */
- hash += (unsigned) code + (unsigned) GET_MODE (x);
- if (GET_MODE (x) != VOIDmode)
- for (i = 2; i < GET_RTX_LENGTH (CONST_DOUBLE); i++)
- {
- unsigned tem = XINT (x, i);
- hash += tem;
- }
- else
- hash += ((unsigned) CONST_DOUBLE_LOW (x)
- + (unsigned) CONST_DOUBLE_HIGH (x));
- return hash;
-
- /* Assume there is only one rtx object for any given label. */
- case LABEL_REF:
- hash
- += ((unsigned) LABEL_REF << 7) + (unsigned HOST_WIDE_INT) XEXP (x, 0);
- return hash;
-
- case SYMBOL_REF:
- hash
- += ((unsigned) SYMBOL_REF << 7) + (unsigned HOST_WIDE_INT) XSTR (x, 0);
- return hash;
-
- case MEM:
- if (MEM_VOLATILE_P (x))
- {
- do_not_record = 1;
- return 0;
- }
- if (! RTX_UNCHANGING_P (x) || FIXED_BASE_PLUS_P (XEXP (x, 0)))
- {
- hash_arg_in_memory = 1;
- if (MEM_IN_STRUCT_P (x)) hash_arg_in_struct = 1;
- }
- /* Now that we have already found this special case,
- might as well speed it up as much as possible. */
- hash += (unsigned) MEM;
- x = XEXP (x, 0);
- goto repeat;
-
- case PRE_DEC:
- case PRE_INC:
- case POST_DEC:
- case POST_INC:
- case PC:
- case CC0:
- case CALL:
- case UNSPEC_VOLATILE:
- do_not_record = 1;
- return 0;
-
- case ASM_OPERANDS:
- if (MEM_VOLATILE_P (x))
- {
- do_not_record = 1;
- return 0;
- }
- }
-
- i = GET_RTX_LENGTH (code) - 1;
- hash += (unsigned) code + (unsigned) GET_MODE (x);
- fmt = GET_RTX_FORMAT (code);
- for (; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- rtx tem = XEXP (x, i);
-
- /* If we are about to do the last recursive call
- needed at this level, change it into iteration.
- This function is called enough to be worth it. */
- if (i == 0)
- {
- x = tem;
- goto repeat;
- }
- hash += canon_hash (tem, 0);
- }
- else if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- hash += canon_hash (XVECEXP (x, i, j), 0);
- else if (fmt[i] == 's')
- {
- register unsigned char *p = (unsigned char *) XSTR (x, i);
- if (p)
- while (*p)
- hash += *p++;
- }
- else if (fmt[i] == 'i')
- {
- register unsigned tem = XINT (x, i);
- hash += tem;
- }
- else
- abort ();
- }
- return hash;
-}
-
-/* Like canon_hash but with no side effects. */
-
-static unsigned
-safe_hash (x, mode)
- rtx x;
- enum machine_mode mode;
-{
- int save_do_not_record = do_not_record;
- int save_hash_arg_in_memory = hash_arg_in_memory;
- int save_hash_arg_in_struct = hash_arg_in_struct;
- unsigned hash = canon_hash (x, mode);
- hash_arg_in_memory = save_hash_arg_in_memory;
- hash_arg_in_struct = save_hash_arg_in_struct;
- do_not_record = save_do_not_record;
- return hash;
-}
-
-/* Return 1 iff X and Y would canonicalize into the same thing,
- without actually constructing the canonicalization of either one.
- If VALIDATE is nonzero,
- we assume X is an expression being processed from the rtl
- and Y was found in the hash table. We check register refs
- in Y for being marked as valid.
-
- If EQUAL_VALUES is nonzero, we allow a register to match a constant value
- that is known to be in the register. Ordinarily, we don't allow them
- to match, because letting them match would cause unpredictable results
- in all the places that search a hash table chain for an equivalent
- for a given value. A possible equivalent that has different structure
- has its hash code computed from different data. Whether the hash code
- is the same as that of the the given value is pure luck. */
-
-static int
-exp_equiv_p (x, y, validate, equal_values)
- rtx x, y;
- int validate;
- int equal_values;
-{
- register int i, j;
- register enum rtx_code code;
- register char *fmt;
-
- /* Note: it is incorrect to assume an expression is equivalent to itself
- if VALIDATE is nonzero. */
- if (x == y && !validate)
- return 1;
- if (x == 0 || y == 0)
- return x == y;
-
- code = GET_CODE (x);
- if (code != GET_CODE (y))
- {
- if (!equal_values)
- return 0;
-
- /* If X is a constant and Y is a register or vice versa, they may be
- equivalent. We only have to validate if Y is a register. */
- if (CONSTANT_P (x) && GET_CODE (y) == REG
- && REGNO_QTY_VALID_P (REGNO (y))
- && GET_MODE (y) == qty_mode[reg_qty[REGNO (y)]]
- && rtx_equal_p (x, qty_const[reg_qty[REGNO (y)]])
- && (! validate || reg_in_table[REGNO (y)] == reg_tick[REGNO (y)]))
- return 1;
-
- if (CONSTANT_P (y) && code == REG
- && REGNO_QTY_VALID_P (REGNO (x))
- && GET_MODE (x) == qty_mode[reg_qty[REGNO (x)]]
- && rtx_equal_p (y, qty_const[reg_qty[REGNO (x)]]))
- return 1;
-
- return 0;
- }
-
- /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent. */
- if (GET_MODE (x) != GET_MODE (y))
- return 0;
-
- switch (code)
- {
- case PC:
- case CC0:
- return x == y;
-
- case CONST_INT:
- return INTVAL (x) == INTVAL (y);
-
- case LABEL_REF:
- return XEXP (x, 0) == XEXP (y, 0);
-
- case SYMBOL_REF:
- return XSTR (x, 0) == XSTR (y, 0);
-
- case REG:
- {
- int regno = REGNO (y);
- int endregno
- = regno + (regno >= FIRST_PSEUDO_REGISTER ? 1
- : HARD_REGNO_NREGS (regno, GET_MODE (y)));
- int i;
-
- /* If the quantities are not the same, the expressions are not
- equivalent. If there are and we are not to validate, they
- are equivalent. Otherwise, ensure all regs are up-to-date. */
-
- if (reg_qty[REGNO (x)] != reg_qty[regno])
- return 0;
-
- if (! validate)
- return 1;
-
- for (i = regno; i < endregno; i++)
- if (reg_in_table[i] != reg_tick[i])
- return 0;
-
- return 1;
- }
-
- /* For commutative operations, check both orders. */
- case PLUS:
- case MULT:
- case AND:
- case IOR:
- case XOR:
- case NE:
- case EQ:
- return ((exp_equiv_p (XEXP (x, 0), XEXP (y, 0), validate, equal_values)
- && exp_equiv_p (XEXP (x, 1), XEXP (y, 1),
- validate, equal_values))
- || (exp_equiv_p (XEXP (x, 0), XEXP (y, 1),
- validate, equal_values)
- && exp_equiv_p (XEXP (x, 1), XEXP (y, 0),
- validate, equal_values)));
- }
-
- /* Compare the elements. If any pair of corresponding elements
- fail to match, return 0 for the whole things. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- switch (fmt[i])
- {
- case 'e':
- if (! exp_equiv_p (XEXP (x, i), XEXP (y, i), validate, equal_values))
- return 0;
- break;
-
- case 'E':
- if (XVECLEN (x, i) != XVECLEN (y, i))
- return 0;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (! exp_equiv_p (XVECEXP (x, i, j), XVECEXP (y, i, j),
- validate, equal_values))
- return 0;
- break;
-
- case 's':
- if (strcmp (XSTR (x, i), XSTR (y, i)))
- return 0;
- break;
-
- case 'i':
- if (XINT (x, i) != XINT (y, i))
- return 0;
- break;
-
- case 'w':
- if (XWINT (x, i) != XWINT (y, i))
- return 0;
- break;
-
- case '0':
- break;
-
- default:
- abort ();
- }
- }
-
- return 1;
-}
-
-/* Return 1 iff any subexpression of X matches Y.
- Here we do not require that X or Y be valid (for registers referred to)
- for being in the hash table. */
-
-static int
-refers_to_p (x, y)
- rtx x, y;
-{
- register int i;
- register enum rtx_code code;
- register char *fmt;
-
- repeat:
- if (x == y)
- return 1;
- if (x == 0 || y == 0)
- return 0;
-
- code = GET_CODE (x);
- /* If X as a whole has the same code as Y, they may match.
- If so, return 1. */
- if (code == GET_CODE (y))
- {
- if (exp_equiv_p (x, y, 0, 1))
- return 1;
- }
-
- /* X does not match, so try its subexpressions. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- {
- if (i == 0)
- {
- x = XEXP (x, 0);
- goto repeat;
- }
- else
- if (refers_to_p (XEXP (x, i), y))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (refers_to_p (XVECEXP (x, i, j), y))
- return 1;
- }
-
- return 0;
-}
-
-/* Given ADDR and SIZE (a memory address, and the size of the memory reference),
- set PBASE, PSTART, and PEND which correspond to the base of the address,
- the starting offset, and ending offset respectively.
-
- ADDR is known to be a nonvarying address. */
-
-/* ??? Despite what the comments say, this function is in fact frequently
- passed varying addresses. This does not appear to cause any problems. */
-
-static void
-set_nonvarying_address_components (addr, size, pbase, pstart, pend)
- rtx addr;
- int size;
- rtx *pbase;
- HOST_WIDE_INT *pstart, *pend;
-{
- rtx base;
- HOST_WIDE_INT start, end;
-
- base = addr;
- start = 0;
- end = 0;
-
- /* Registers with nonvarying addresses usually have constant equivalents;
- but the frame pointer register is also possible. */
- if (GET_CODE (base) == REG
- && qty_const != 0
- && REGNO_QTY_VALID_P (REGNO (base))
- && qty_mode[reg_qty[REGNO (base)]] == GET_MODE (base)
- && qty_const[reg_qty[REGNO (base)]] != 0)
- base = qty_const[reg_qty[REGNO (base)]];
- else if (GET_CODE (base) == PLUS
- && GET_CODE (XEXP (base, 1)) == CONST_INT
- && GET_CODE (XEXP (base, 0)) == REG
- && qty_const != 0
- && REGNO_QTY_VALID_P (REGNO (XEXP (base, 0)))
- && (qty_mode[reg_qty[REGNO (XEXP (base, 0))]]
- == GET_MODE (XEXP (base, 0)))
- && qty_const[reg_qty[REGNO (XEXP (base, 0))]])
- {
- start = INTVAL (XEXP (base, 1));
- base = qty_const[reg_qty[REGNO (XEXP (base, 0))]];
- }
- /* This can happen as the result of virtual register instantiation,
- if the initial offset is too large to be a valid address. */
- else if (GET_CODE (base) == PLUS
- && GET_CODE (XEXP (base, 0)) == REG
- && GET_CODE (XEXP (base, 1)) == REG
- && qty_const != 0
- && REGNO_QTY_VALID_P (REGNO (XEXP (base, 0)))
- && (qty_mode[reg_qty[REGNO (XEXP (base, 0))]]
- == GET_MODE (XEXP (base, 0)))
- && qty_const[reg_qty[REGNO (XEXP (base, 0))]]
- && REGNO_QTY_VALID_P (REGNO (XEXP (base, 1)))
- && (qty_mode[reg_qty[REGNO (XEXP (base, 1))]]
- == GET_MODE (XEXP (base, 1)))
- && qty_const[reg_qty[REGNO (XEXP (base, 1))]])
- {
- rtx tem = qty_const[reg_qty[REGNO (XEXP (base, 1))]];
- base = qty_const[reg_qty[REGNO (XEXP (base, 0))]];
-
- /* One of the two values must be a constant. */
- if (GET_CODE (base) != CONST_INT)
- {
- if (GET_CODE (tem) != CONST_INT)
- abort ();
- start = INTVAL (tem);
- }
- else
- {
- start = INTVAL (base);
- base = tem;
- }
- }
-
- /* Handle everything that we can find inside an address that has been
- viewed as constant. */
-
- while (1)
- {
- /* If no part of this switch does a "continue", the code outside
- will exit this loop. */
-
- switch (GET_CODE (base))
- {
- case LO_SUM:
- /* By definition, operand1 of a LO_SUM is the associated constant
- address. Use the associated constant address as the base
- instead. */
- base = XEXP (base, 1);
- continue;
-
- case CONST:
- /* Strip off CONST. */
- base = XEXP (base, 0);
- continue;
-
- case PLUS:
- if (GET_CODE (XEXP (base, 1)) == CONST_INT)
- {
- start += INTVAL (XEXP (base, 1));
- base = XEXP (base, 0);
- continue;
- }
- break;
-
- case AND:
- /* Handle the case of an AND which is the negative of a power of
- two. This is used to represent unaligned memory operations. */
- if (GET_CODE (XEXP (base, 1)) == CONST_INT
- && exact_log2 (- INTVAL (XEXP (base, 1))) > 0)
- {
- set_nonvarying_address_components (XEXP (base, 0), size,
- pbase, pstart, pend);
-
- /* Assume the worst misalignment. START is affected, but not
- END, so compensate but adjusting SIZE. Don't lose any
- constant we already had. */
-
- size = *pend - *pstart - INTVAL (XEXP (base, 1)) - 1;
- start += *pstart + INTVAL (XEXP (base, 1)) + 1;
- end += *pend;
- base = *pbase;
- }
- break;
- }
-
- break;
- }
-
- if (GET_CODE (base) == CONST_INT)
- {
- start += INTVAL (base);
- base = const0_rtx;
- }
-
- end = start + size;
-
- /* Set the return values. */
- *pbase = base;
- *pstart = start;
- *pend = end;
-}
-
-/* Return 1 iff any subexpression of X refers to memory
- at an address of BASE plus some offset
- such that any of the bytes' offsets fall between START (inclusive)
- and END (exclusive).
-
- The value is undefined if X is a varying address (as determined by
- cse_rtx_addr_varies_p). This function is not used in such cases.
-
- When used in the cse pass, `qty_const' is nonzero, and it is used
- to treat an address that is a register with a known constant value
- as if it were that constant value.
- In the loop pass, `qty_const' is zero, so this is not done. */
-
-static int
-refers_to_mem_p (x, base, start, end)
- rtx x, base;
- HOST_WIDE_INT start, end;
-{
- register HOST_WIDE_INT i;
- register enum rtx_code code;
- register char *fmt;
-
- repeat:
- if (x == 0)
- return 0;
-
- code = GET_CODE (x);
- if (code == MEM)
- {
- register rtx addr = XEXP (x, 0); /* Get the address. */
- rtx mybase;
- HOST_WIDE_INT mystart, myend;
-
- set_nonvarying_address_components (addr, GET_MODE_SIZE (GET_MODE (x)),
- &mybase, &mystart, &myend);
-
-
- /* refers_to_mem_p is never called with varying addresses.
- If the base addresses are not equal, there is no chance
- of the memory addresses conflicting. */
- if (! rtx_equal_p (mybase, base))
- return 0;
-
- return myend > start && mystart < end;
- }
-
- /* X does not match, so try its subexpressions. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- {
- if (i == 0)
- {
- x = XEXP (x, 0);
- goto repeat;
- }
- else
- if (refers_to_mem_p (XEXP (x, i), base, start, end))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (refers_to_mem_p (XVECEXP (x, i, j), base, start, end))
- return 1;
- }
-
- return 0;
-}
-
-/* Nonzero if X refers to memory at a varying address;
- except that a register which has at the moment a known constant value
- isn't considered variable. */
-
-static int
-cse_rtx_addr_varies_p (x)
- rtx x;
-{
- /* We need not check for X and the equivalence class being of the same
- mode because if X is equivalent to a constant in some mode, it
- doesn't vary in any mode. */
-
- if (GET_CODE (x) == MEM
- && GET_CODE (XEXP (x, 0)) == REG
- && REGNO_QTY_VALID_P (REGNO (XEXP (x, 0)))
- && GET_MODE (XEXP (x, 0)) == qty_mode[reg_qty[REGNO (XEXP (x, 0))]]
- && qty_const[reg_qty[REGNO (XEXP (x, 0))]] != 0)
- return 0;
-
- if (GET_CODE (x) == MEM
- && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
- && REGNO_QTY_VALID_P (REGNO (XEXP (XEXP (x, 0), 0)))
- && (GET_MODE (XEXP (XEXP (x, 0), 0))
- == qty_mode[reg_qty[REGNO (XEXP (XEXP (x, 0), 0))]])
- && qty_const[reg_qty[REGNO (XEXP (XEXP (x, 0), 0))]])
- return 0;
-
- /* This can happen as the result of virtual register instantiation, if
- the initial constant is too large to be a valid address. This gives
- us a three instruction sequence, load large offset into a register,
- load fp minus a constant into a register, then a MEM which is the
- sum of the two `constant' registers. */
- if (GET_CODE (x) == MEM
- && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == REG
- && REGNO_QTY_VALID_P (REGNO (XEXP (XEXP (x, 0), 0)))
- && (GET_MODE (XEXP (XEXP (x, 0), 0))
- == qty_mode[reg_qty[REGNO (XEXP (XEXP (x, 0), 0))]])
- && qty_const[reg_qty[REGNO (XEXP (XEXP (x, 0), 0))]]
- && REGNO_QTY_VALID_P (REGNO (XEXP (XEXP (x, 0), 1)))
- && (GET_MODE (XEXP (XEXP (x, 0), 1))
- == qty_mode[reg_qty[REGNO (XEXP (XEXP (x, 0), 1))]])
- && qty_const[reg_qty[REGNO (XEXP (XEXP (x, 0), 1))]])
- return 0;
-
- return rtx_addr_varies_p (x);
-}
-
-/* Canonicalize an expression:
- replace each register reference inside it
- with the "oldest" equivalent register.
-
- If INSN is non-zero and we are replacing a pseudo with a hard register
- or vice versa, validate_change is used to ensure that INSN remains valid
- after we make our substitution. The calls are made with IN_GROUP non-zero
- so apply_change_group must be called upon the outermost return from this
- function (unless INSN is zero). The result of apply_change_group can
- generally be discarded since the changes we are making are optional. */
-
-static rtx
-canon_reg (x, insn)
- rtx x;
- rtx insn;
-{
- register int i;
- register enum rtx_code code;
- register char *fmt;
-
- if (x == 0)
- return x;
-
- code = GET_CODE (x);
- switch (code)
- {
- case PC:
- case CC0:
- case CONST:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- return x;
-
- case REG:
- {
- register int first;
-
- /* Never replace a hard reg, because hard regs can appear
- in more than one machine mode, and we must preserve the mode
- of each occurrence. Also, some hard regs appear in
- MEMs that are shared and mustn't be altered. Don't try to
- replace any reg that maps to a reg of class NO_REGS. */
- if (REGNO (x) < FIRST_PSEUDO_REGISTER
- || ! REGNO_QTY_VALID_P (REGNO (x)))
- return x;
-
- first = qty_first_reg[reg_qty[REGNO (x)]];
- return (first >= FIRST_PSEUDO_REGISTER ? regno_reg_rtx[first]
- : REGNO_REG_CLASS (first) == NO_REGS ? x
- : gen_rtx (REG, qty_mode[reg_qty[REGNO (x)]], first));
- }
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- register int j;
-
- if (fmt[i] == 'e')
- {
- rtx new = canon_reg (XEXP (x, i), insn);
-
- /* If replacing pseudo with hard reg or vice versa, ensure the
- insn remains valid. Likewise if the insn has MATCH_DUPs. */
- if (insn != 0 && new != 0
- && GET_CODE (new) == REG && GET_CODE (XEXP (x, i)) == REG
- && (((REGNO (new) < FIRST_PSEUDO_REGISTER)
- != (REGNO (XEXP (x, i)) < FIRST_PSEUDO_REGISTER))
- || insn_n_dups[recog_memoized (insn)] > 0))
- validate_change (insn, &XEXP (x, i), new, 1);
- else
- XEXP (x, i) = new;
- }
- else if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- XVECEXP (x, i, j) = canon_reg (XVECEXP (x, i, j), insn);
- }
-
- return x;
-}
-
-/* LOC is a location within INSN that is an operand address (the contents of
- a MEM). Find the best equivalent address to use that is valid for this
- insn.
-
- On most CISC machines, complicated address modes are costly, and rtx_cost
- is a good approximation for that cost. However, most RISC machines have
- only a few (usually only one) memory reference formats. If an address is
- valid at all, it is often just as cheap as any other address. Hence, for
- RISC machines, we use the configuration macro `ADDRESS_COST' to compare the
- costs of various addresses. For two addresses of equal cost, choose the one
- with the highest `rtx_cost' value as that has the potential of eliminating
- the most insns. For equal costs, we choose the first in the equivalence
- class. Note that we ignore the fact that pseudo registers are cheaper
- than hard registers here because we would also prefer the pseudo registers.
- */
-
-static void
-find_best_addr (insn, loc)
- rtx insn;
- rtx *loc;
-{
- struct table_elt *elt, *p;
- rtx addr = *loc;
- int our_cost;
- int found_better = 1;
- int save_do_not_record = do_not_record;
- int save_hash_arg_in_memory = hash_arg_in_memory;
- int save_hash_arg_in_struct = hash_arg_in_struct;
- int addr_volatile;
- int regno;
- unsigned hash;
-
- /* Do not try to replace constant addresses or addresses of local and
- argument slots. These MEM expressions are made only once and inserted
- in many instructions, as well as being used to control symbol table
- output. It is not safe to clobber them.
-
- There are some uncommon cases where the address is already in a register
- for some reason, but we cannot take advantage of that because we have
- no easy way to unshare the MEM. In addition, looking up all stack
- addresses is costly. */
- if ((GET_CODE (addr) == PLUS
- && GET_CODE (XEXP (addr, 0)) == REG
- && GET_CODE (XEXP (addr, 1)) == CONST_INT
- && (regno = REGNO (XEXP (addr, 0)),
- regno == FRAME_POINTER_REGNUM || regno == HARD_FRAME_POINTER_REGNUM
- || regno == ARG_POINTER_REGNUM))
- || (GET_CODE (addr) == REG
- && (regno = REGNO (addr), regno == FRAME_POINTER_REGNUM
- || regno == HARD_FRAME_POINTER_REGNUM
- || regno == ARG_POINTER_REGNUM))
- || CONSTANT_ADDRESS_P (addr))
- return;
-
- /* If this address is not simply a register, try to fold it. This will
- sometimes simplify the expression. Many simplifications
- will not be valid, but some, usually applying the associative rule, will
- be valid and produce better code. */
- if (GET_CODE (addr) != REG)
- {
- rtx folded = fold_rtx (copy_rtx (addr), NULL_RTX);
-
- if (1
-#ifdef ADDRESS_COST
- && (ADDRESS_COST (folded) < ADDRESS_COST (addr)
- || (ADDRESS_COST (folded) == ADDRESS_COST (addr)
- && rtx_cost (folded) > rtx_cost (addr)))
-#else
- && rtx_cost (folded) < rtx_cost (addr)
-#endif
- && validate_change (insn, loc, folded, 0))
- addr = folded;
- }
-
- /* If this address is not in the hash table, we can't look for equivalences
- of the whole address. Also, ignore if volatile. */
-
- do_not_record = 0;
- hash = HASH (addr, Pmode);
- addr_volatile = do_not_record;
- do_not_record = save_do_not_record;
- hash_arg_in_memory = save_hash_arg_in_memory;
- hash_arg_in_struct = save_hash_arg_in_struct;
-
- if (addr_volatile)
- return;
-
- elt = lookup (addr, hash, Pmode);
-
-#ifndef ADDRESS_COST
- if (elt)
- {
- our_cost = elt->cost;
-
- /* Find the lowest cost below ours that works. */
- for (elt = elt->first_same_value; elt; elt = elt->next_same_value)
- if (elt->cost < our_cost
- && (GET_CODE (elt->exp) == REG
- || exp_equiv_p (elt->exp, elt->exp, 1, 0))
- && validate_change (insn, loc,
- canon_reg (copy_rtx (elt->exp), NULL_RTX), 0))
- return;
- }
-#else
-
- if (elt)
- {
- /* We need to find the best (under the criteria documented above) entry
- in the class that is valid. We use the `flag' field to indicate
- choices that were invalid and iterate until we can't find a better
- one that hasn't already been tried. */
-
- for (p = elt->first_same_value; p; p = p->next_same_value)
- p->flag = 0;
-
- while (found_better)
- {
- int best_addr_cost = ADDRESS_COST (*loc);
- int best_rtx_cost = (elt->cost + 1) >> 1;
- struct table_elt *best_elt = elt;
-
- found_better = 0;
- for (p = elt->first_same_value; p; p = p->next_same_value)
- if (! p->flag
- && (GET_CODE (p->exp) == REG
- || exp_equiv_p (p->exp, p->exp, 1, 0))
- && (ADDRESS_COST (p->exp) < best_addr_cost
- || (ADDRESS_COST (p->exp) == best_addr_cost
- && (p->cost + 1) >> 1 > best_rtx_cost)))
- {
- found_better = 1;
- best_addr_cost = ADDRESS_COST (p->exp);
- best_rtx_cost = (p->cost + 1) >> 1;
- best_elt = p;
- }
-
- if (found_better)
- {
- if (validate_change (insn, loc,
- canon_reg (copy_rtx (best_elt->exp),
- NULL_RTX), 0))
- return;
- else
- best_elt->flag = 1;
- }
- }
- }
-
- /* If the address is a binary operation with the first operand a register
- and the second a constant, do the same as above, but looking for
- equivalences of the register. Then try to simplify before checking for
- the best address to use. This catches a few cases: First is when we
- have REG+const and the register is another REG+const. We can often merge
- the constants and eliminate one insn and one register. It may also be
- that a machine has a cheap REG+REG+const. Finally, this improves the
- code on the Alpha for unaligned byte stores. */
-
- if (flag_expensive_optimizations
- && (GET_RTX_CLASS (GET_CODE (*loc)) == '2'
- || GET_RTX_CLASS (GET_CODE (*loc)) == 'c')
- && GET_CODE (XEXP (*loc, 0)) == REG
- && GET_CODE (XEXP (*loc, 1)) == CONST_INT)
- {
- rtx c = XEXP (*loc, 1);
-
- do_not_record = 0;
- hash = HASH (XEXP (*loc, 0), Pmode);
- do_not_record = save_do_not_record;
- hash_arg_in_memory = save_hash_arg_in_memory;
- hash_arg_in_struct = save_hash_arg_in_struct;
-
- elt = lookup (XEXP (*loc, 0), hash, Pmode);
- if (elt == 0)
- return;
-
- /* We need to find the best (under the criteria documented above) entry
- in the class that is valid. We use the `flag' field to indicate
- choices that were invalid and iterate until we can't find a better
- one that hasn't already been tried. */
-
- for (p = elt->first_same_value; p; p = p->next_same_value)
- p->flag = 0;
-
- while (found_better)
- {
- int best_addr_cost = ADDRESS_COST (*loc);
- int best_rtx_cost = (COST (*loc) + 1) >> 1;
- struct table_elt *best_elt = elt;
- rtx best_rtx = *loc;
- int count;
-
- /* This is at worst case an O(n^2) algorithm, so limit our search
- to the first 32 elements on the list. This avoids trouble
- compiling code with very long basic blocks that can easily
- call cse_gen_binary so many times that we run out of memory. */
-
- found_better = 0;
- for (p = elt->first_same_value, count = 0;
- p && count < 32;
- p = p->next_same_value, count++)
- if (! p->flag
- && (GET_CODE (p->exp) == REG
- || exp_equiv_p (p->exp, p->exp, 1, 0)))
- {
- rtx new = cse_gen_binary (GET_CODE (*loc), Pmode, p->exp, c);
-
- if ((ADDRESS_COST (new) < best_addr_cost
- || (ADDRESS_COST (new) == best_addr_cost
- && (COST (new) + 1) >> 1 > best_rtx_cost)))
- {
- found_better = 1;
- best_addr_cost = ADDRESS_COST (new);
- best_rtx_cost = (COST (new) + 1) >> 1;
- best_elt = p;
- best_rtx = new;
- }
- }
-
- if (found_better)
- {
- if (validate_change (insn, loc,
- canon_reg (copy_rtx (best_rtx),
- NULL_RTX), 0))
- return;
- else
- best_elt->flag = 1;
- }
- }
- }
-#endif
-}
-
-/* Given an operation (CODE, *PARG1, *PARG2), where code is a comparison
- operation (EQ, NE, GT, etc.), follow it back through the hash table and
- what values are being compared.
-
- *PARG1 and *PARG2 are updated to contain the rtx representing the values
- actually being compared. For example, if *PARG1 was (cc0) and *PARG2
- was (const_int 0), *PARG1 and *PARG2 will be set to the objects that were
- compared to produce cc0.
-
- The return value is the comparison operator and is either the code of
- A or the code corresponding to the inverse of the comparison. */
-
-static enum rtx_code
-find_comparison_args (code, parg1, parg2, pmode1, pmode2)
- enum rtx_code code;
- rtx *parg1, *parg2;
- enum machine_mode *pmode1, *pmode2;
-{
- rtx arg1, arg2;
-
- arg1 = *parg1, arg2 = *parg2;
-
- /* If ARG2 is const0_rtx, see what ARG1 is equivalent to. */
-
- while (arg2 == CONST0_RTX (GET_MODE (arg1)))
- {
- /* Set non-zero when we find something of interest. */
- rtx x = 0;
- int reverse_code = 0;
- struct table_elt *p = 0;
-
- /* If arg1 is a COMPARE, extract the comparison arguments from it.
- On machines with CC0, this is the only case that can occur, since
- fold_rtx will return the COMPARE or item being compared with zero
- when given CC0. */
-
- if (GET_CODE (arg1) == COMPARE && arg2 == const0_rtx)
- x = arg1;
-
- /* If ARG1 is a comparison operator and CODE is testing for
- STORE_FLAG_VALUE, get the inner arguments. */
-
- else if (GET_RTX_CLASS (GET_CODE (arg1)) == '<')
- {
- if (code == NE
- || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_INT
- && code == LT && STORE_FLAG_VALUE == -1)
-#ifdef FLOAT_STORE_FLAG_VALUE
- || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_FLOAT
- && FLOAT_STORE_FLAG_VALUE < 0)
-#endif
- )
- x = arg1;
- else if (code == EQ
- || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_INT
- && code == GE && STORE_FLAG_VALUE == -1)
-#ifdef FLOAT_STORE_FLAG_VALUE
- || (GET_MODE_CLASS (GET_MODE (arg1)) == MODE_FLOAT
- && FLOAT_STORE_FLAG_VALUE < 0)
-#endif
- )
- x = arg1, reverse_code = 1;
- }
-
- /* ??? We could also check for
-
- (ne (and (eq (...) (const_int 1))) (const_int 0))
-
- and related forms, but let's wait until we see them occurring. */
-
- if (x == 0)
- /* Look up ARG1 in the hash table and see if it has an equivalence
- that lets us see what is being compared. */
- p = lookup (arg1, safe_hash (arg1, GET_MODE (arg1)) % NBUCKETS,
- GET_MODE (arg1));
- if (p) p = p->first_same_value;
-
- for (; p; p = p->next_same_value)
- {
- enum machine_mode inner_mode = GET_MODE (p->exp);
-
- /* If the entry isn't valid, skip it. */
- if (! exp_equiv_p (p->exp, p->exp, 1, 0))
- continue;
-
- if (GET_CODE (p->exp) == COMPARE
- /* Another possibility is that this machine has a compare insn
- that includes the comparison code. In that case, ARG1 would
- be equivalent to a comparison operation that would set ARG1 to
- either STORE_FLAG_VALUE or zero. If this is an NE operation,
- ORIG_CODE is the actual comparison being done; if it is an EQ,
- we must reverse ORIG_CODE. On machine with a negative value
- for STORE_FLAG_VALUE, also look at LT and GE operations. */
- || ((code == NE
- || (code == LT
- && GET_MODE_CLASS (inner_mode) == MODE_INT
- && (GET_MODE_BITSIZE (inner_mode)
- <= HOST_BITS_PER_WIDE_INT)
- && (STORE_FLAG_VALUE
- & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (inner_mode) - 1))))
-#ifdef FLOAT_STORE_FLAG_VALUE
- || (code == LT
- && GET_MODE_CLASS (inner_mode) == MODE_FLOAT
- && FLOAT_STORE_FLAG_VALUE < 0)
-#endif
- )
- && GET_RTX_CLASS (GET_CODE (p->exp)) == '<'))
- {
- x = p->exp;
- break;
- }
- else if ((code == EQ
- || (code == GE
- && GET_MODE_CLASS (inner_mode) == MODE_INT
- && (GET_MODE_BITSIZE (inner_mode)
- <= HOST_BITS_PER_WIDE_INT)
- && (STORE_FLAG_VALUE
- & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (inner_mode) - 1))))
-#ifdef FLOAT_STORE_FLAG_VALUE
- || (code == GE
- && GET_MODE_CLASS (inner_mode) == MODE_FLOAT
- && FLOAT_STORE_FLAG_VALUE < 0)
-#endif
- )
- && GET_RTX_CLASS (GET_CODE (p->exp)) == '<')
- {
- reverse_code = 1;
- x = p->exp;
- break;
- }
-
- /* If this is fp + constant, the equivalent is a better operand since
- it may let us predict the value of the comparison. */
- else if (NONZERO_BASE_PLUS_P (p->exp))
- {
- arg1 = p->exp;
- continue;
- }
- }
-
- /* If we didn't find a useful equivalence for ARG1, we are done.
- Otherwise, set up for the next iteration. */
- if (x == 0)
- break;
-
- arg1 = XEXP (x, 0), arg2 = XEXP (x, 1);
- if (GET_RTX_CLASS (GET_CODE (x)) == '<')
- code = GET_CODE (x);
-
- if (reverse_code)
- code = reverse_condition (code);
- }
-
- /* Return our results. Return the modes from before fold_rtx
- because fold_rtx might produce const_int, and then it's too late. */
- *pmode1 = GET_MODE (arg1), *pmode2 = GET_MODE (arg2);
- *parg1 = fold_rtx (arg1, 0), *parg2 = fold_rtx (arg2, 0);
-
- return code;
-}
-
-/* Try to simplify a unary operation CODE whose output mode is to be
- MODE with input operand OP whose mode was originally OP_MODE.
- Return zero if no simplification can be made. */
-
-rtx
-simplify_unary_operation (code, mode, op, op_mode)
- enum rtx_code code;
- enum machine_mode mode;
- rtx op;
- enum machine_mode op_mode;
-{
- register int width = GET_MODE_BITSIZE (mode);
-
- /* The order of these tests is critical so that, for example, we don't
- check the wrong mode (input vs. output) for a conversion operation,
- such as FIX. At some point, this should be simplified. */
-
-#if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
-
- if (code == FLOAT && GET_MODE (op) == VOIDmode
- && (GET_CODE (op) == CONST_DOUBLE || GET_CODE (op) == CONST_INT))
- {
- HOST_WIDE_INT hv, lv;
- REAL_VALUE_TYPE d;
-
- if (GET_CODE (op) == CONST_INT)
- lv = INTVAL (op), hv = INTVAL (op) < 0 ? -1 : 0;
- else
- lv = CONST_DOUBLE_LOW (op), hv = CONST_DOUBLE_HIGH (op);
-
-#ifdef REAL_ARITHMETIC
- REAL_VALUE_FROM_INT (d, lv, hv, mode);
-#else
- if (hv < 0)
- {
- d = (double) (~ hv);
- d *= ((double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2))
- * (double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2)));
- d += (double) (unsigned HOST_WIDE_INT) (~ lv);
- d = (- d - 1.0);
- }
- else
- {
- d = (double) hv;
- d *= ((double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2))
- * (double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2)));
- d += (double) (unsigned HOST_WIDE_INT) lv;
- }
-#endif /* REAL_ARITHMETIC */
- d = real_value_truncate (mode, d);
- return CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
- }
- else if (code == UNSIGNED_FLOAT && GET_MODE (op) == VOIDmode
- && (GET_CODE (op) == CONST_DOUBLE || GET_CODE (op) == CONST_INT))
- {
- HOST_WIDE_INT hv, lv;
- REAL_VALUE_TYPE d;
-
- if (GET_CODE (op) == CONST_INT)
- lv = INTVAL (op), hv = INTVAL (op) < 0 ? -1 : 0;
- else
- lv = CONST_DOUBLE_LOW (op), hv = CONST_DOUBLE_HIGH (op);
-
- if (op_mode == VOIDmode)
- {
- /* We don't know how to interpret negative-looking numbers in
- this case, so don't try to fold those. */
- if (hv < 0)
- return 0;
- }
- else if (GET_MODE_BITSIZE (op_mode) >= HOST_BITS_PER_WIDE_INT * 2)
- ;
- else
- hv = 0, lv &= GET_MODE_MASK (op_mode);
-
-#ifdef REAL_ARITHMETIC
- REAL_VALUE_FROM_UNSIGNED_INT (d, lv, hv, mode);
-#else
-
- d = (double) (unsigned HOST_WIDE_INT) hv;
- d *= ((double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2))
- * (double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2)));
- d += (double) (unsigned HOST_WIDE_INT) lv;
-#endif /* REAL_ARITHMETIC */
- d = real_value_truncate (mode, d);
- return CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
- }
-#endif
-
- if (GET_CODE (op) == CONST_INT
- && width <= HOST_BITS_PER_WIDE_INT && width > 0)
- {
- register HOST_WIDE_INT arg0 = INTVAL (op);
- register HOST_WIDE_INT val;
-
- switch (code)
- {
- case NOT:
- val = ~ arg0;
- break;
-
- case NEG:
- val = - arg0;
- break;
-
- case ABS:
- val = (arg0 >= 0 ? arg0 : - arg0);
- break;
-
- case FFS:
- /* Don't use ffs here. Instead, get low order bit and then its
- number. If arg0 is zero, this will return 0, as desired. */
- arg0 &= GET_MODE_MASK (mode);
- val = exact_log2 (arg0 & (- arg0)) + 1;
- break;
-
- case TRUNCATE:
- val = arg0;
- break;
-
- case ZERO_EXTEND:
- if (op_mode == VOIDmode)
- op_mode = mode;
- if (GET_MODE_BITSIZE (op_mode) == HOST_BITS_PER_WIDE_INT)
- {
- /* If we were really extending the mode,
- we would have to distinguish between zero-extension
- and sign-extension. */
- if (width != GET_MODE_BITSIZE (op_mode))
- abort ();
- val = arg0;
- }
- else if (GET_MODE_BITSIZE (op_mode) < HOST_BITS_PER_WIDE_INT)
- val = arg0 & ~((HOST_WIDE_INT) (-1) << GET_MODE_BITSIZE (op_mode));
- else
- return 0;
- break;
-
- case SIGN_EXTEND:
- if (op_mode == VOIDmode)
- op_mode = mode;
- if (GET_MODE_BITSIZE (op_mode) == HOST_BITS_PER_WIDE_INT)
- {
- /* If we were really extending the mode,
- we would have to distinguish between zero-extension
- and sign-extension. */
- if (width != GET_MODE_BITSIZE (op_mode))
- abort ();
- val = arg0;
- }
- else if (GET_MODE_BITSIZE (op_mode) < HOST_BITS_PER_WIDE_INT)
- {
- val
- = arg0 & ~((HOST_WIDE_INT) (-1) << GET_MODE_BITSIZE (op_mode));
- if (val
- & ((HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (op_mode) - 1)))
- val -= (HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (op_mode);
- }
- else
- return 0;
- break;
-
- case SQRT:
- return 0;
-
- default:
- abort ();
- }
-
- /* Clear the bits that don't belong in our mode,
- unless they and our sign bit are all one.
- So we get either a reasonable negative value or a reasonable
- unsigned value for this mode. */
- if (width < HOST_BITS_PER_WIDE_INT
- && ((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
- != ((HOST_WIDE_INT) (-1) << (width - 1))))
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- return GEN_INT (val);
- }
-
- /* We can do some operations on integer CONST_DOUBLEs. Also allow
- for a DImode operation on a CONST_INT. */
- else if (GET_MODE (op) == VOIDmode && width <= HOST_BITS_PER_INT * 2
- && (GET_CODE (op) == CONST_DOUBLE || GET_CODE (op) == CONST_INT))
- {
- HOST_WIDE_INT l1, h1, lv, hv;
-
- if (GET_CODE (op) == CONST_DOUBLE)
- l1 = CONST_DOUBLE_LOW (op), h1 = CONST_DOUBLE_HIGH (op);
- else
- l1 = INTVAL (op), h1 = l1 < 0 ? -1 : 0;
-
- switch (code)
- {
- case NOT:
- lv = ~ l1;
- hv = ~ h1;
- break;
-
- case NEG:
- neg_double (l1, h1, &lv, &hv);
- break;
-
- case ABS:
- if (h1 < 0)
- neg_double (l1, h1, &lv, &hv);
- else
- lv = l1, hv = h1;
- break;
-
- case FFS:
- hv = 0;
- if (l1 == 0)
- lv = HOST_BITS_PER_WIDE_INT + exact_log2 (h1 & (-h1)) + 1;
- else
- lv = exact_log2 (l1 & (-l1)) + 1;
- break;
-
- case TRUNCATE:
- /* This is just a change-of-mode, so do nothing. */
- lv = l1, hv = h1;
- break;
-
- case ZERO_EXTEND:
- if (op_mode == VOIDmode
- || GET_MODE_BITSIZE (op_mode) > HOST_BITS_PER_WIDE_INT)
- return 0;
-
- hv = 0;
- lv = l1 & GET_MODE_MASK (op_mode);
- break;
-
- case SIGN_EXTEND:
- if (op_mode == VOIDmode
- || GET_MODE_BITSIZE (op_mode) > HOST_BITS_PER_WIDE_INT)
- return 0;
- else
- {
- lv = l1 & GET_MODE_MASK (op_mode);
- if (GET_MODE_BITSIZE (op_mode) < HOST_BITS_PER_WIDE_INT
- && (lv & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (op_mode) - 1))) != 0)
- lv -= (HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (op_mode);
-
- hv = (lv < 0) ? ~ (HOST_WIDE_INT) 0 : 0;
- }
- break;
-
- case SQRT:
- return 0;
-
- default:
- return 0;
- }
-
- return immed_double_const (lv, hv, mode);
- }
-
-#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- else if (GET_CODE (op) == CONST_DOUBLE
- && GET_MODE_CLASS (mode) == MODE_FLOAT)
- {
- REAL_VALUE_TYPE d;
- jmp_buf handler;
- rtx x;
-
- if (setjmp (handler))
- /* There used to be a warning here, but that is inadvisable.
- People may want to cause traps, and the natural way
- to do it should not get a warning. */
- return 0;
-
- set_float_handler (handler);
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, op);
-
- switch (code)
- {
- case NEG:
- d = REAL_VALUE_NEGATE (d);
- break;
-
- case ABS:
- if (REAL_VALUE_NEGATIVE (d))
- d = REAL_VALUE_NEGATE (d);
- break;
-
- case FLOAT_TRUNCATE:
- d = real_value_truncate (mode, d);
- break;
-
- case FLOAT_EXTEND:
- /* All this does is change the mode. */
- break;
-
- case FIX:
- d = REAL_VALUE_RNDZINT (d);
- break;
-
- case UNSIGNED_FIX:
- d = REAL_VALUE_UNSIGNED_RNDZINT (d);
- break;
-
- case SQRT:
- return 0;
-
- default:
- abort ();
- }
-
- x = CONST_DOUBLE_FROM_REAL_VALUE (d, mode);
- set_float_handler (NULL_PTR);
- return x;
- }
-
- else if (GET_CODE (op) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT
- && GET_MODE_CLASS (mode) == MODE_INT
- && width <= HOST_BITS_PER_WIDE_INT && width > 0)
- {
- REAL_VALUE_TYPE d;
- jmp_buf handler;
- HOST_WIDE_INT val;
-
- if (setjmp (handler))
- return 0;
-
- set_float_handler (handler);
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, op);
-
- switch (code)
- {
- case FIX:
- val = REAL_VALUE_FIX (d);
- break;
-
- case UNSIGNED_FIX:
- val = REAL_VALUE_UNSIGNED_FIX (d);
- break;
-
- default:
- abort ();
- }
-
- set_float_handler (NULL_PTR);
-
- /* Clear the bits that don't belong in our mode,
- unless they and our sign bit are all one.
- So we get either a reasonable negative value or a reasonable
- unsigned value for this mode. */
- if (width < HOST_BITS_PER_WIDE_INT
- && ((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
- != ((HOST_WIDE_INT) (-1) << (width - 1))))
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- /* If this would be an entire word for the target, but is not for
- the host, then sign-extend on the host so that the number will look
- the same way on the host that it would on the target.
-
- For example, when building a 64 bit alpha hosted 32 bit sparc
- targeted compiler, then we want the 32 bit unsigned value -1 to be
- represented as a 64 bit value -1, and not as 0x00000000ffffffff.
- The later confuses the sparc backend. */
-
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
- && (val & ((HOST_WIDE_INT) 1 << (width - 1))))
- val |= ((HOST_WIDE_INT) (-1) << width);
-
- return GEN_INT (val);
- }
-#endif
- /* This was formerly used only for non-IEEE float.
- eggert@twinsun.com says it is safe for IEEE also. */
- else
- {
- /* There are some simplifications we can do even if the operands
- aren't constant. */
- switch (code)
- {
- case NEG:
- case NOT:
- /* (not (not X)) == X, similarly for NEG. */
- if (GET_CODE (op) == code)
- return XEXP (op, 0);
- break;
-
- case SIGN_EXTEND:
- /* (sign_extend (truncate (minus (label_ref L1) (label_ref L2))))
- becomes just the MINUS if its mode is MODE. This allows
- folding switch statements on machines using casesi (such as
- the Vax). */
- if (GET_CODE (op) == TRUNCATE
- && GET_MODE (XEXP (op, 0)) == mode
- && GET_CODE (XEXP (op, 0)) == MINUS
- && GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF
- && GET_CODE (XEXP (XEXP (op, 0), 1)) == LABEL_REF)
- return XEXP (op, 0);
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (! POINTERS_EXTEND_UNSIGNED
- && mode == Pmode && GET_MODE (op) == ptr_mode
- && CONSTANT_P (op))
- return convert_memory_address (Pmode, op);
-#endif
- break;
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- case ZERO_EXTEND:
- if (POINTERS_EXTEND_UNSIGNED
- && mode == Pmode && GET_MODE (op) == ptr_mode
- && CONSTANT_P (op))
- return convert_memory_address (Pmode, op);
- break;
-#endif
- }
-
- return 0;
- }
-}
-
-/* Simplify a binary operation CODE with result mode MODE, operating on OP0
- and OP1. Return 0 if no simplification is possible.
-
- Don't use this for relational operations such as EQ or LT.
- Use simplify_relational_operation instead. */
-
-rtx
-simplify_binary_operation (code, mode, op0, op1)
- enum rtx_code code;
- enum machine_mode mode;
- rtx op0, op1;
-{
- register HOST_WIDE_INT arg0, arg1, arg0s, arg1s;
- HOST_WIDE_INT val;
- int width = GET_MODE_BITSIZE (mode);
- rtx tem;
-
- /* Relational operations don't work here. We must know the mode
- of the operands in order to do the comparison correctly.
- Assuming a full word can give incorrect results.
- Consider comparing 128 with -128 in QImode. */
-
- if (GET_RTX_CLASS (code) == '<')
- abort ();
-
-#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- if (GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_CODE (op0) == CONST_DOUBLE && GET_CODE (op1) == CONST_DOUBLE
- && mode == GET_MODE (op0) && mode == GET_MODE (op1))
- {
- REAL_VALUE_TYPE f0, f1, value;
- jmp_buf handler;
-
- if (setjmp (handler))
- return 0;
-
- set_float_handler (handler);
-
- REAL_VALUE_FROM_CONST_DOUBLE (f0, op0);
- REAL_VALUE_FROM_CONST_DOUBLE (f1, op1);
- f0 = real_value_truncate (mode, f0);
- f1 = real_value_truncate (mode, f1);
-
-#ifdef REAL_ARITHMETIC
- REAL_ARITHMETIC (value, rtx_to_tree_code (code), f0, f1);
-#else
- switch (code)
- {
- case PLUS:
- value = f0 + f1;
- break;
- case MINUS:
- value = f0 - f1;
- break;
- case MULT:
- value = f0 * f1;
- break;
- case DIV:
-#ifndef REAL_INFINITY
- if (f1 == 0)
- return 0;
-#endif
- value = f0 / f1;
- break;
- case SMIN:
- value = MIN (f0, f1);
- break;
- case SMAX:
- value = MAX (f0, f1);
- break;
- default:
- abort ();
- }
-#endif
-
- value = real_value_truncate (mode, value);
- set_float_handler (NULL_PTR);
- return CONST_DOUBLE_FROM_REAL_VALUE (value, mode);
- }
-#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
-
- /* We can fold some multi-word operations. */
- if (GET_MODE_CLASS (mode) == MODE_INT
- && width == HOST_BITS_PER_WIDE_INT * 2
- && (GET_CODE (op0) == CONST_DOUBLE || GET_CODE (op0) == CONST_INT)
- && (GET_CODE (op1) == CONST_DOUBLE || GET_CODE (op1) == CONST_INT))
- {
- HOST_WIDE_INT l1, l2, h1, h2, lv, hv;
-
- if (GET_CODE (op0) == CONST_DOUBLE)
- l1 = CONST_DOUBLE_LOW (op0), h1 = CONST_DOUBLE_HIGH (op0);
- else
- l1 = INTVAL (op0), h1 = l1 < 0 ? -1 : 0;
-
- if (GET_CODE (op1) == CONST_DOUBLE)
- l2 = CONST_DOUBLE_LOW (op1), h2 = CONST_DOUBLE_HIGH (op1);
- else
- l2 = INTVAL (op1), h2 = l2 < 0 ? -1 : 0;
-
- switch (code)
- {
- case MINUS:
- /* A - B == A + (-B). */
- neg_double (l2, h2, &lv, &hv);
- l2 = lv, h2 = hv;
-
- /* .. fall through ... */
-
- case PLUS:
- add_double (l1, h1, l2, h2, &lv, &hv);
- break;
-
- case MULT:
- mul_double (l1, h1, l2, h2, &lv, &hv);
- break;
-
- case DIV: case MOD: case UDIV: case UMOD:
- /* We'd need to include tree.h to do this and it doesn't seem worth
- it. */
- return 0;
-
- case AND:
- lv = l1 & l2, hv = h1 & h2;
- break;
-
- case IOR:
- lv = l1 | l2, hv = h1 | h2;
- break;
-
- case XOR:
- lv = l1 ^ l2, hv = h1 ^ h2;
- break;
-
- case SMIN:
- if (h1 < h2
- || (h1 == h2
- && ((unsigned HOST_WIDE_INT) l1
- < (unsigned HOST_WIDE_INT) l2)))
- lv = l1, hv = h1;
- else
- lv = l2, hv = h2;
- break;
-
- case SMAX:
- if (h1 > h2
- || (h1 == h2
- && ((unsigned HOST_WIDE_INT) l1
- > (unsigned HOST_WIDE_INT) l2)))
- lv = l1, hv = h1;
- else
- lv = l2, hv = h2;
- break;
-
- case UMIN:
- if ((unsigned HOST_WIDE_INT) h1 < (unsigned HOST_WIDE_INT) h2
- || (h1 == h2
- && ((unsigned HOST_WIDE_INT) l1
- < (unsigned HOST_WIDE_INT) l2)))
- lv = l1, hv = h1;
- else
- lv = l2, hv = h2;
- break;
-
- case UMAX:
- if ((unsigned HOST_WIDE_INT) h1 > (unsigned HOST_WIDE_INT) h2
- || (h1 == h2
- && ((unsigned HOST_WIDE_INT) l1
- > (unsigned HOST_WIDE_INT) l2)))
- lv = l1, hv = h1;
- else
- lv = l2, hv = h2;
- break;
-
- case LSHIFTRT: case ASHIFTRT:
- case ASHIFT:
- case ROTATE: case ROTATERT:
-#ifdef SHIFT_COUNT_TRUNCATED
- if (SHIFT_COUNT_TRUNCATED)
- l2 &= (GET_MODE_BITSIZE (mode) - 1), h2 = 0;
-#endif
-
- if (h2 != 0 || l2 < 0 || l2 >= GET_MODE_BITSIZE (mode))
- return 0;
-
- if (code == LSHIFTRT || code == ASHIFTRT)
- rshift_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv,
- code == ASHIFTRT);
- else if (code == ASHIFT)
- lshift_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv, 1);
- else if (code == ROTATE)
- lrotate_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv);
- else /* code == ROTATERT */
- rrotate_double (l1, h1, l2, GET_MODE_BITSIZE (mode), &lv, &hv);
- break;
-
- default:
- return 0;
- }
-
- return immed_double_const (lv, hv, mode);
- }
-
- if (GET_CODE (op0) != CONST_INT || GET_CODE (op1) != CONST_INT
- || width > HOST_BITS_PER_WIDE_INT || width == 0)
- {
- /* Even if we can't compute a constant result,
- there are some cases worth simplifying. */
-
- switch (code)
- {
- case PLUS:
- /* In IEEE floating point, x+0 is not the same as x. Similarly
- for the other optimizations below. */
- if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
- && FLOAT_MODE_P (mode) && ! flag_fast_math)
- break;
-
- if (op1 == CONST0_RTX (mode))
- return op0;
-
- /* ((-a) + b) -> (b - a) and similarly for (a + (-b)) */
- if (GET_CODE (op0) == NEG)
- return cse_gen_binary (MINUS, mode, op1, XEXP (op0, 0));
- else if (GET_CODE (op1) == NEG)
- return cse_gen_binary (MINUS, mode, op0, XEXP (op1, 0));
-
- /* Handle both-operands-constant cases. We can only add
- CONST_INTs to constants since the sum of relocatable symbols
- can't be handled by most assemblers. Don't add CONST_INT
- to CONST_INT since overflow won't be computed properly if wider
- than HOST_BITS_PER_WIDE_INT. */
-
- if (CONSTANT_P (op0) && GET_MODE (op0) != VOIDmode
- && GET_CODE (op1) == CONST_INT)
- return plus_constant (op0, INTVAL (op1));
- else if (CONSTANT_P (op1) && GET_MODE (op1) != VOIDmode
- && GET_CODE (op0) == CONST_INT)
- return plus_constant (op1, INTVAL (op0));
-
- /* See if this is something like X * C - X or vice versa or
- if the multiplication is written as a shift. If so, we can
- distribute and make a new multiply, shift, or maybe just
- have X (if C is 2 in the example above). But don't make
- real multiply if we didn't have one before. */
-
- if (! FLOAT_MODE_P (mode))
- {
- HOST_WIDE_INT coeff0 = 1, coeff1 = 1;
- rtx lhs = op0, rhs = op1;
- int had_mult = 0;
-
- if (GET_CODE (lhs) == NEG)
- coeff0 = -1, lhs = XEXP (lhs, 0);
- else if (GET_CODE (lhs) == MULT
- && GET_CODE (XEXP (lhs, 1)) == CONST_INT)
- {
- coeff0 = INTVAL (XEXP (lhs, 1)), lhs = XEXP (lhs, 0);
- had_mult = 1;
- }
- else if (GET_CODE (lhs) == ASHIFT
- && GET_CODE (XEXP (lhs, 1)) == CONST_INT
- && INTVAL (XEXP (lhs, 1)) >= 0
- && INTVAL (XEXP (lhs, 1)) < HOST_BITS_PER_WIDE_INT)
- {
- coeff0 = ((HOST_WIDE_INT) 1) << INTVAL (XEXP (lhs, 1));
- lhs = XEXP (lhs, 0);
- }
-
- if (GET_CODE (rhs) == NEG)
- coeff1 = -1, rhs = XEXP (rhs, 0);
- else if (GET_CODE (rhs) == MULT
- && GET_CODE (XEXP (rhs, 1)) == CONST_INT)
- {
- coeff1 = INTVAL (XEXP (rhs, 1)), rhs = XEXP (rhs, 0);
- had_mult = 1;
- }
- else if (GET_CODE (rhs) == ASHIFT
- && GET_CODE (XEXP (rhs, 1)) == CONST_INT
- && INTVAL (XEXP (rhs, 1)) >= 0
- && INTVAL (XEXP (rhs, 1)) < HOST_BITS_PER_WIDE_INT)
- {
- coeff1 = ((HOST_WIDE_INT) 1) << INTVAL (XEXP (rhs, 1));
- rhs = XEXP (rhs, 0);
- }
-
- if (rtx_equal_p (lhs, rhs))
- {
- tem = cse_gen_binary (MULT, mode, lhs,
- GEN_INT (coeff0 + coeff1));
- return (GET_CODE (tem) == MULT && ! had_mult) ? 0 : tem;
- }
- }
-
- /* If one of the operands is a PLUS or a MINUS, see if we can
- simplify this by the associative law.
- Don't use the associative law for floating point.
- The inaccuracy makes it nonassociative,
- and subtle programs can break if operations are associated. */
-
- if (INTEGRAL_MODE_P (mode)
- && (GET_CODE (op0) == PLUS || GET_CODE (op0) == MINUS
- || GET_CODE (op1) == PLUS || GET_CODE (op1) == MINUS)
- && (tem = simplify_plus_minus (code, mode, op0, op1)) != 0)
- return tem;
- break;
-
- case COMPARE:
-#ifdef HAVE_cc0
- /* Convert (compare FOO (const_int 0)) to FOO unless we aren't
- using cc0, in which case we want to leave it as a COMPARE
- so we can distinguish it from a register-register-copy.
-
- In IEEE floating point, x-0 is not the same as x. */
-
- if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || ! FLOAT_MODE_P (mode) || flag_fast_math)
- && op1 == CONST0_RTX (mode))
- return op0;
-#else
- /* Do nothing here. */
-#endif
- break;
-
- case MINUS:
- /* None of these optimizations can be done for IEEE
- floating point. */
- if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
- && FLOAT_MODE_P (mode) && ! flag_fast_math)
- break;
-
- /* We can't assume x-x is 0 even with non-IEEE floating point,
- but since it is zero except in very strange circumstances, we
- will treat it as zero with -ffast-math. */
- if (rtx_equal_p (op0, op1)
- && ! side_effects_p (op0)
- && (! FLOAT_MODE_P (mode) || flag_fast_math))
- return CONST0_RTX (mode);
-
- /* Change subtraction from zero into negation. */
- if (op0 == CONST0_RTX (mode))
- return gen_rtx (NEG, mode, op1);
-
- /* (-1 - a) is ~a. */
- if (op0 == constm1_rtx)
- return gen_rtx (NOT, mode, op1);
-
- /* Subtracting 0 has no effect. */
- if (op1 == CONST0_RTX (mode))
- return op0;
-
- /* See if this is something like X * C - X or vice versa or
- if the multiplication is written as a shift. If so, we can
- distribute and make a new multiply, shift, or maybe just
- have X (if C is 2 in the example above). But don't make
- real multiply if we didn't have one before. */
-
- if (! FLOAT_MODE_P (mode))
- {
- HOST_WIDE_INT coeff0 = 1, coeff1 = 1;
- rtx lhs = op0, rhs = op1;
- int had_mult = 0;
-
- if (GET_CODE (lhs) == NEG)
- coeff0 = -1, lhs = XEXP (lhs, 0);
- else if (GET_CODE (lhs) == MULT
- && GET_CODE (XEXP (lhs, 1)) == CONST_INT)
- {
- coeff0 = INTVAL (XEXP (lhs, 1)), lhs = XEXP (lhs, 0);
- had_mult = 1;
- }
- else if (GET_CODE (lhs) == ASHIFT
- && GET_CODE (XEXP (lhs, 1)) == CONST_INT
- && INTVAL (XEXP (lhs, 1)) >= 0
- && INTVAL (XEXP (lhs, 1)) < HOST_BITS_PER_WIDE_INT)
- {
- coeff0 = ((HOST_WIDE_INT) 1) << INTVAL (XEXP (lhs, 1));
- lhs = XEXP (lhs, 0);
- }
-
- if (GET_CODE (rhs) == NEG)
- coeff1 = - 1, rhs = XEXP (rhs, 0);
- else if (GET_CODE (rhs) == MULT
- && GET_CODE (XEXP (rhs, 1)) == CONST_INT)
- {
- coeff1 = INTVAL (XEXP (rhs, 1)), rhs = XEXP (rhs, 0);
- had_mult = 1;
- }
- else if (GET_CODE (rhs) == ASHIFT
- && GET_CODE (XEXP (rhs, 1)) == CONST_INT
- && INTVAL (XEXP (rhs, 1)) >= 0
- && INTVAL (XEXP (rhs, 1)) < HOST_BITS_PER_WIDE_INT)
- {
- coeff1 = ((HOST_WIDE_INT) 1) << INTVAL (XEXP (rhs, 1));
- rhs = XEXP (rhs, 0);
- }
-
- if (rtx_equal_p (lhs, rhs))
- {
- tem = cse_gen_binary (MULT, mode, lhs,
- GEN_INT (coeff0 - coeff1));
- return (GET_CODE (tem) == MULT && ! had_mult) ? 0 : tem;
- }
- }
-
- /* (a - (-b)) -> (a + b). */
- if (GET_CODE (op1) == NEG)
- return cse_gen_binary (PLUS, mode, op0, XEXP (op1, 0));
-
- /* If one of the operands is a PLUS or a MINUS, see if we can
- simplify this by the associative law.
- Don't use the associative law for floating point.
- The inaccuracy makes it nonassociative,
- and subtle programs can break if operations are associated. */
-
- if (INTEGRAL_MODE_P (mode)
- && (GET_CODE (op0) == PLUS || GET_CODE (op0) == MINUS
- || GET_CODE (op1) == PLUS || GET_CODE (op1) == MINUS)
- && (tem = simplify_plus_minus (code, mode, op0, op1)) != 0)
- return tem;
-
- /* Don't let a relocatable value get a negative coeff. */
- if (GET_CODE (op1) == CONST_INT && GET_MODE (op0) != VOIDmode)
- return plus_constant (op0, - INTVAL (op1));
-
- /* (x - (x & y)) -> (x & ~y) */
- if (GET_CODE (op1) == AND)
- {
- if (rtx_equal_p (op0, XEXP (op1, 0)))
- return cse_gen_binary (AND, mode, op0, gen_rtx (NOT, mode, XEXP (op1, 1)));
- if (rtx_equal_p (op0, XEXP (op1, 1)))
- return cse_gen_binary (AND, mode, op0, gen_rtx (NOT, mode, XEXP (op1, 0)));
- }
- break;
-
- case MULT:
- if (op1 == constm1_rtx)
- {
- tem = simplify_unary_operation (NEG, mode, op0, mode);
-
- return tem ? tem : gen_rtx (NEG, mode, op0);
- }
-
- /* In IEEE floating point, x*0 is not always 0. */
- if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || ! FLOAT_MODE_P (mode) || flag_fast_math)
- && op1 == CONST0_RTX (mode)
- && ! side_effects_p (op0))
- return op1;
-
- /* In IEEE floating point, x*1 is not equivalent to x for nans.
- However, ANSI says we can drop signals,
- so we can do this anyway. */
- if (op1 == CONST1_RTX (mode))
- return op0;
-
- /* Convert multiply by constant power of two into shift unless
- we are still generating RTL. This test is a kludge. */
- if (GET_CODE (op1) == CONST_INT
- && (val = exact_log2 (INTVAL (op1))) >= 0
- /* If the mode is larger than the host word size, and the
- uppermost bit is set, then this isn't a power of two due
- to implicit sign extension. */
- && (width <= HOST_BITS_PER_WIDE_INT
- || val != HOST_BITS_PER_WIDE_INT - 1)
- && ! rtx_equal_function_value_matters)
- return gen_rtx (ASHIFT, mode, op0, GEN_INT (val));
-
- if (GET_CODE (op1) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (op1)) == MODE_FLOAT)
- {
- REAL_VALUE_TYPE d;
- jmp_buf handler;
- int op1is2, op1ism1;
-
- if (setjmp (handler))
- return 0;
-
- set_float_handler (handler);
- REAL_VALUE_FROM_CONST_DOUBLE (d, op1);
- op1is2 = REAL_VALUES_EQUAL (d, dconst2);
- op1ism1 = REAL_VALUES_EQUAL (d, dconstm1);
- set_float_handler (NULL_PTR);
-
- /* x*2 is x+x and x*(-1) is -x */
- if (op1is2 && GET_MODE (op0) == mode)
- return gen_rtx (PLUS, mode, op0, copy_rtx (op0));
-
- else if (op1ism1 && GET_MODE (op0) == mode)
- return gen_rtx (NEG, mode, op0);
- }
- break;
-
- case IOR:
- if (op1 == const0_rtx)
- return op0;
- if (GET_CODE (op1) == CONST_INT
- && (INTVAL (op1) & GET_MODE_MASK (mode)) == GET_MODE_MASK (mode))
- return op1;
- if (rtx_equal_p (op0, op1) && ! side_effects_p (op0))
- return op0;
- /* A | (~A) -> -1 */
- if (((GET_CODE (op0) == NOT && rtx_equal_p (XEXP (op0, 0), op1))
- || (GET_CODE (op1) == NOT && rtx_equal_p (XEXP (op1, 0), op0)))
- && ! side_effects_p (op0)
- && GET_MODE_CLASS (mode) != MODE_CC)
- return constm1_rtx;
- break;
-
- case XOR:
- if (op1 == const0_rtx)
- return op0;
- if (GET_CODE (op1) == CONST_INT
- && (INTVAL (op1) & GET_MODE_MASK (mode)) == GET_MODE_MASK (mode))
- return gen_rtx (NOT, mode, op0);
- if (op0 == op1 && ! side_effects_p (op0)
- && GET_MODE_CLASS (mode) != MODE_CC)
- return const0_rtx;
- break;
-
- case AND:
- if (op1 == const0_rtx && ! side_effects_p (op0))
- return const0_rtx;
- if (GET_CODE (op1) == CONST_INT
- && (INTVAL (op1) & GET_MODE_MASK (mode)) == GET_MODE_MASK (mode))
- return op0;
- if (op0 == op1 && ! side_effects_p (op0)
- && GET_MODE_CLASS (mode) != MODE_CC)
- return op0;
- /* A & (~A) -> 0 */
- if (((GET_CODE (op0) == NOT && rtx_equal_p (XEXP (op0, 0), op1))
- || (GET_CODE (op1) == NOT && rtx_equal_p (XEXP (op1, 0), op0)))
- && ! side_effects_p (op0)
- && GET_MODE_CLASS (mode) != MODE_CC)
- return const0_rtx;
- break;
-
- case UDIV:
- /* Convert divide by power of two into shift (divide by 1 handled
- below). */
- if (GET_CODE (op1) == CONST_INT
- && (arg1 = exact_log2 (INTVAL (op1))) > 0)
- return gen_rtx (LSHIFTRT, mode, op0, GEN_INT (arg1));
-
- /* ... fall through ... */
-
- case DIV:
- if (op1 == CONST1_RTX (mode))
- return op0;
-
- /* In IEEE floating point, 0/x is not always 0. */
- if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || ! FLOAT_MODE_P (mode) || flag_fast_math)
- && op0 == CONST0_RTX (mode)
- && ! side_effects_p (op1))
- return op0;
-
-#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- /* Change division by a constant into multiplication. Only do
- this with -ffast-math until an expert says it is safe in
- general. */
- else if (GET_CODE (op1) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (op1)) == MODE_FLOAT
- && op1 != CONST0_RTX (mode)
- && flag_fast_math)
- {
- REAL_VALUE_TYPE d;
- REAL_VALUE_FROM_CONST_DOUBLE (d, op1);
-
- if (! REAL_VALUES_EQUAL (d, dconst0))
- {
-#if defined (REAL_ARITHMETIC)
- REAL_ARITHMETIC (d, rtx_to_tree_code (DIV), dconst1, d);
- return gen_rtx (MULT, mode, op0,
- CONST_DOUBLE_FROM_REAL_VALUE (d, mode));
-#else
- return gen_rtx (MULT, mode, op0,
- CONST_DOUBLE_FROM_REAL_VALUE (1./d, mode));
-#endif
- }
- }
-#endif
- break;
-
- case UMOD:
- /* Handle modulus by power of two (mod with 1 handled below). */
- if (GET_CODE (op1) == CONST_INT
- && exact_log2 (INTVAL (op1)) > 0)
- return gen_rtx (AND, mode, op0, GEN_INT (INTVAL (op1) - 1));
-
- /* ... fall through ... */
-
- case MOD:
- if ((op0 == const0_rtx || op1 == const1_rtx)
- && ! side_effects_p (op0) && ! side_effects_p (op1))
- return const0_rtx;
- break;
-
- case ROTATERT:
- case ROTATE:
- /* Rotating ~0 always results in ~0. */
- if (GET_CODE (op0) == CONST_INT && width <= HOST_BITS_PER_WIDE_INT
- && INTVAL (op0) == GET_MODE_MASK (mode)
- && ! side_effects_p (op1))
- return op0;
-
- /* ... fall through ... */
-
- case ASHIFT:
- case ASHIFTRT:
- case LSHIFTRT:
- if (op1 == const0_rtx)
- return op0;
- if (op0 == const0_rtx && ! side_effects_p (op1))
- return op0;
- break;
-
- case SMIN:
- if (width <= HOST_BITS_PER_WIDE_INT && GET_CODE (op1) == CONST_INT
- && INTVAL (op1) == (HOST_WIDE_INT) 1 << (width -1)
- && ! side_effects_p (op0))
- return op1;
- else if (rtx_equal_p (op0, op1) && ! side_effects_p (op0))
- return op0;
- break;
-
- case SMAX:
- if (width <= HOST_BITS_PER_WIDE_INT && GET_CODE (op1) == CONST_INT
- && (INTVAL (op1)
- == (unsigned HOST_WIDE_INT) GET_MODE_MASK (mode) >> 1)
- && ! side_effects_p (op0))
- return op1;
- else if (rtx_equal_p (op0, op1) && ! side_effects_p (op0))
- return op0;
- break;
-
- case UMIN:
- if (op1 == const0_rtx && ! side_effects_p (op0))
- return op1;
- else if (rtx_equal_p (op0, op1) && ! side_effects_p (op0))
- return op0;
- break;
-
- case UMAX:
- if (op1 == constm1_rtx && ! side_effects_p (op0))
- return op1;
- else if (rtx_equal_p (op0, op1) && ! side_effects_p (op0))
- return op0;
- break;
-
- default:
- abort ();
- }
-
- return 0;
- }
-
- /* Get the integer argument values in two forms:
- zero-extended in ARG0, ARG1 and sign-extended in ARG0S, ARG1S. */
-
- arg0 = INTVAL (op0);
- arg1 = INTVAL (op1);
-
- if (width < HOST_BITS_PER_WIDE_INT)
- {
- arg0 &= ((HOST_WIDE_INT) 1 << width) - 1;
- arg1 &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- arg0s = arg0;
- if (arg0s & ((HOST_WIDE_INT) 1 << (width - 1)))
- arg0s |= ((HOST_WIDE_INT) (-1) << width);
-
- arg1s = arg1;
- if (arg1s & ((HOST_WIDE_INT) 1 << (width - 1)))
- arg1s |= ((HOST_WIDE_INT) (-1) << width);
- }
- else
- {
- arg0s = arg0;
- arg1s = arg1;
- }
-
- /* Compute the value of the arithmetic. */
-
- switch (code)
- {
- case PLUS:
- val = arg0s + arg1s;
- break;
-
- case MINUS:
- val = arg0s - arg1s;
- break;
-
- case MULT:
- val = arg0s * arg1s;
- break;
-
- case DIV:
- if (arg1s == 0)
- return 0;
- val = arg0s / arg1s;
- break;
-
- case MOD:
- if (arg1s == 0)
- return 0;
- val = arg0s % arg1s;
- break;
-
- case UDIV:
- if (arg1 == 0)
- return 0;
- val = (unsigned HOST_WIDE_INT) arg0 / arg1;
- break;
-
- case UMOD:
- if (arg1 == 0)
- return 0;
- val = (unsigned HOST_WIDE_INT) arg0 % arg1;
- break;
-
- case AND:
- val = arg0 & arg1;
- break;
-
- case IOR:
- val = arg0 | arg1;
- break;
-
- case XOR:
- val = arg0 ^ arg1;
- break;
-
- case LSHIFTRT:
- /* If shift count is undefined, don't fold it; let the machine do
- what it wants. But truncate it if the machine will do that. */
- if (arg1 < 0)
- return 0;
-
-#ifdef SHIFT_COUNT_TRUNCATED
- if (SHIFT_COUNT_TRUNCATED)
- arg1 %= width;
-#endif
-
- val = ((unsigned HOST_WIDE_INT) arg0) >> arg1;
- break;
-
- case ASHIFT:
- if (arg1 < 0)
- return 0;
-
-#ifdef SHIFT_COUNT_TRUNCATED
- if (SHIFT_COUNT_TRUNCATED)
- arg1 %= width;
-#endif
-
- val = ((unsigned HOST_WIDE_INT) arg0) << arg1;
- break;
-
- case ASHIFTRT:
- if (arg1 < 0)
- return 0;
-
-#ifdef SHIFT_COUNT_TRUNCATED
- if (SHIFT_COUNT_TRUNCATED)
- arg1 %= width;
-#endif
-
- val = arg0s >> arg1;
-
- /* Bootstrap compiler may not have sign extended the right shift.
- Manually extend the sign to insure bootstrap cc matches gcc. */
- if (arg0s < 0 && arg1 > 0)
- val |= ((HOST_WIDE_INT) -1) << (HOST_BITS_PER_WIDE_INT - arg1);
-
- break;
-
- case ROTATERT:
- if (arg1 < 0)
- return 0;
-
- arg1 %= width;
- val = ((((unsigned HOST_WIDE_INT) arg0) << (width - arg1))
- | (((unsigned HOST_WIDE_INT) arg0) >> arg1));
- break;
-
- case ROTATE:
- if (arg1 < 0)
- return 0;
-
- arg1 %= width;
- val = ((((unsigned HOST_WIDE_INT) arg0) << arg1)
- | (((unsigned HOST_WIDE_INT) arg0) >> (width - arg1)));
- break;
-
- case COMPARE:
- /* Do nothing here. */
- return 0;
-
- case SMIN:
- val = arg0s <= arg1s ? arg0s : arg1s;
- break;
-
- case UMIN:
- val = ((unsigned HOST_WIDE_INT) arg0
- <= (unsigned HOST_WIDE_INT) arg1 ? arg0 : arg1);
- break;
-
- case SMAX:
- val = arg0s > arg1s ? arg0s : arg1s;
- break;
-
- case UMAX:
- val = ((unsigned HOST_WIDE_INT) arg0
- > (unsigned HOST_WIDE_INT) arg1 ? arg0 : arg1);
- break;
-
- default:
- abort ();
- }
-
- /* Clear the bits that don't belong in our mode, unless they and our sign
- bit are all one. So we get either a reasonable negative value or a
- reasonable unsigned value for this mode. */
- if (width < HOST_BITS_PER_WIDE_INT
- && ((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
- != ((HOST_WIDE_INT) (-1) << (width - 1))))
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- /* If this would be an entire word for the target, but is not for
- the host, then sign-extend on the host so that the number will look
- the same way on the host that it would on the target.
-
- For example, when building a 64 bit alpha hosted 32 bit sparc
- targeted compiler, then we want the 32 bit unsigned value -1 to be
- represented as a 64 bit value -1, and not as 0x00000000ffffffff.
- The later confuses the sparc backend. */
-
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
- && (val & ((HOST_WIDE_INT) 1 << (width - 1))))
- val |= ((HOST_WIDE_INT) (-1) << width);
-
- return GEN_INT (val);
-}
-
-/* Simplify a PLUS or MINUS, at least one of whose operands may be another
- PLUS or MINUS.
-
- Rather than test for specific case, we do this by a brute-force method
- and do all possible simplifications until no more changes occur. Then
- we rebuild the operation. */
-
-static rtx
-simplify_plus_minus (code, mode, op0, op1)
- enum rtx_code code;
- enum machine_mode mode;
- rtx op0, op1;
-{
- rtx ops[8];
- int negs[8];
- rtx result, tem;
- int n_ops = 2, input_ops = 2, input_consts = 0, n_consts = 0;
- int first = 1, negate = 0, changed;
- int i, j;
-
- bzero ((char *) ops, sizeof ops);
-
- /* Set up the two operands and then expand them until nothing has been
- changed. If we run out of room in our array, give up; this should
- almost never happen. */
-
- ops[0] = op0, ops[1] = op1, negs[0] = 0, negs[1] = (code == MINUS);
-
- changed = 1;
- while (changed)
- {
- changed = 0;
-
- for (i = 0; i < n_ops; i++)
- switch (GET_CODE (ops[i]))
- {
- case PLUS:
- case MINUS:
- if (n_ops == 7)
- return 0;
-
- ops[n_ops] = XEXP (ops[i], 1);
- negs[n_ops++] = GET_CODE (ops[i]) == MINUS ? !negs[i] : negs[i];
- ops[i] = XEXP (ops[i], 0);
- input_ops++;
- changed = 1;
- break;
-
- case NEG:
- ops[i] = XEXP (ops[i], 0);
- negs[i] = ! negs[i];
- changed = 1;
- break;
-
- case CONST:
- ops[i] = XEXP (ops[i], 0);
- input_consts++;
- changed = 1;
- break;
-
- case NOT:
- /* ~a -> (-a - 1) */
- if (n_ops != 7)
- {
- ops[n_ops] = constm1_rtx;
- negs[n_ops++] = negs[i];
- ops[i] = XEXP (ops[i], 0);
- negs[i] = ! negs[i];
- changed = 1;
- }
- break;
-
- case CONST_INT:
- if (negs[i])
- ops[i] = GEN_INT (- INTVAL (ops[i])), negs[i] = 0, changed = 1;
- break;
- }
- }
-
- /* If we only have two operands, we can't do anything. */
- if (n_ops <= 2)
- return 0;
-
- /* Now simplify each pair of operands until nothing changes. The first
- time through just simplify constants against each other. */
-
- changed = 1;
- while (changed)
- {
- changed = first;
-
- for (i = 0; i < n_ops - 1; i++)
- for (j = i + 1; j < n_ops; j++)
- if (ops[i] != 0 && ops[j] != 0
- && (! first || (CONSTANT_P (ops[i]) && CONSTANT_P (ops[j]))))
- {
- rtx lhs = ops[i], rhs = ops[j];
- enum rtx_code ncode = PLUS;
-
- if (negs[i] && ! negs[j])
- lhs = ops[j], rhs = ops[i], ncode = MINUS;
- else if (! negs[i] && negs[j])
- ncode = MINUS;
-
- tem = simplify_binary_operation (ncode, mode, lhs, rhs);
- if (tem)
- {
- ops[i] = tem, ops[j] = 0;
- negs[i] = negs[i] && negs[j];
- if (GET_CODE (tem) == NEG)
- ops[i] = XEXP (tem, 0), negs[i] = ! negs[i];
-
- if (GET_CODE (ops[i]) == CONST_INT && negs[i])
- ops[i] = GEN_INT (- INTVAL (ops[i])), negs[i] = 0;
- changed = 1;
- }
- }
-
- first = 0;
- }
-
- /* Pack all the operands to the lower-numbered entries and give up if
- we didn't reduce the number of operands we had. Make sure we
- count a CONST as two operands. If we have the same number of
- operands, but have made more CONSTs than we had, this is also
- an improvement, so accept it. */
-
- for (i = 0, j = 0; j < n_ops; j++)
- if (ops[j] != 0)
- {
- ops[i] = ops[j], negs[i++] = negs[j];
- if (GET_CODE (ops[j]) == CONST)
- n_consts++;
- }
-
- if (i + n_consts > input_ops
- || (i + n_consts == input_ops && n_consts <= input_consts))
- return 0;
-
- n_ops = i;
-
- /* If we have a CONST_INT, put it last. */
- for (i = 0; i < n_ops - 1; i++)
- if (GET_CODE (ops[i]) == CONST_INT)
- {
- tem = ops[n_ops - 1], ops[n_ops - 1] = ops[i] , ops[i] = tem;
- j = negs[n_ops - 1], negs[n_ops - 1] = negs[i], negs[i] = j;
- }
-
- /* Put a non-negated operand first. If there aren't any, make all
- operands positive and negate the whole thing later. */
- for (i = 0; i < n_ops && negs[i]; i++)
- ;
-
- if (i == n_ops)
- {
- for (i = 0; i < n_ops; i++)
- negs[i] = 0;
- negate = 1;
- }
- else if (i != 0)
- {
- tem = ops[0], ops[0] = ops[i], ops[i] = tem;
- j = negs[0], negs[0] = negs[i], negs[i] = j;
- }
-
- /* Now make the result by performing the requested operations. */
- result = ops[0];
- for (i = 1; i < n_ops; i++)
- result = cse_gen_binary (negs[i] ? MINUS : PLUS, mode, result, ops[i]);
-
- return negate ? gen_rtx (NEG, mode, result) : result;
-}
-
-/* Make a binary operation by properly ordering the operands and
- seeing if the expression folds. */
-
-static rtx
-cse_gen_binary (code, mode, op0, op1)
- enum rtx_code code;
- enum machine_mode mode;
- rtx op0, op1;
-{
- rtx tem;
-
- /* Put complex operands first and constants second if commutative. */
- if (GET_RTX_CLASS (code) == 'c'
- && ((CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT)
- || (GET_RTX_CLASS (GET_CODE (op0)) == 'o'
- && GET_RTX_CLASS (GET_CODE (op1)) != 'o')
- || (GET_CODE (op0) == SUBREG
- && GET_RTX_CLASS (GET_CODE (SUBREG_REG (op0))) == 'o'
- && GET_RTX_CLASS (GET_CODE (op1)) != 'o')))
- tem = op0, op0 = op1, op1 = tem;
-
- /* If this simplifies, do it. */
- tem = simplify_binary_operation (code, mode, op0, op1);
-
- if (tem)
- return tem;
-
- /* Handle addition and subtraction of CONST_INT specially. Otherwise,
- just form the operation. */
-
- if (code == PLUS && GET_CODE (op1) == CONST_INT
- && GET_MODE (op0) != VOIDmode)
- return plus_constant (op0, INTVAL (op1));
- else if (code == MINUS && GET_CODE (op1) == CONST_INT
- && GET_MODE (op0) != VOIDmode)
- return plus_constant (op0, - INTVAL (op1));
- else
- return gen_rtx (code, mode, op0, op1);
-}
-
-/* Like simplify_binary_operation except used for relational operators.
- MODE is the mode of the operands, not that of the result. If MODE
- is VOIDmode, both operands must also be VOIDmode and we compare the
- operands in "infinite precision".
-
- If no simplification is possible, this function returns zero. Otherwise,
- it returns either const_true_rtx or const0_rtx. */
-
-rtx
-simplify_relational_operation (code, mode, op0, op1)
- enum rtx_code code;
- enum machine_mode mode;
- rtx op0, op1;
-{
- int equal, op0lt, op0ltu, op1lt, op1ltu;
- rtx tem;
-
- /* If op0 is a compare, extract the comparison arguments from it. */
- if (GET_CODE (op0) == COMPARE && op1 == const0_rtx)
- op1 = XEXP (op0, 1), op0 = XEXP (op0, 0);
-
- /* We can't simplify MODE_CC values since we don't know what the
- actual comparison is. */
- if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC
-#ifdef HAVE_cc0
- || op0 == cc0_rtx
-#endif
- )
- return 0;
-
- /* For integer comparisons of A and B maybe we can simplify A - B and can
- then simplify a comparison of that with zero. If A and B are both either
- a register or a CONST_INT, this can't help; testing for these cases will
- prevent infinite recursion here and speed things up.
-
- If CODE is an unsigned comparison, then we can never do this optimization,
- because it gives an incorrect result if the subtraction wraps around zero.
- ANSI C defines unsigned operations such that they never overflow, and
- thus such cases can not be ignored. */
-
- if (INTEGRAL_MODE_P (mode) && op1 != const0_rtx
- && ! ((GET_CODE (op0) == REG || GET_CODE (op0) == CONST_INT)
- && (GET_CODE (op1) == REG || GET_CODE (op1) == CONST_INT))
- && 0 != (tem = simplify_binary_operation (MINUS, mode, op0, op1))
- && code != GTU && code != GEU && code != LTU && code != LEU)
- return simplify_relational_operation (signed_condition (code),
- mode, tem, const0_rtx);
-
- /* For non-IEEE floating-point, if the two operands are equal, we know the
- result. */
- if (rtx_equal_p (op0, op1)
- && (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || ! FLOAT_MODE_P (GET_MODE (op0)) || flag_fast_math))
- equal = 1, op0lt = 0, op0ltu = 0, op1lt = 0, op1ltu = 0;
-
- /* If the operands are floating-point constants, see if we can fold
- the result. */
-#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- else if (GET_CODE (op0) == CONST_DOUBLE && GET_CODE (op1) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (op0)) == MODE_FLOAT)
- {
- REAL_VALUE_TYPE d0, d1;
- jmp_buf handler;
-
- if (setjmp (handler))
- return 0;
-
- set_float_handler (handler);
- REAL_VALUE_FROM_CONST_DOUBLE (d0, op0);
- REAL_VALUE_FROM_CONST_DOUBLE (d1, op1);
- equal = REAL_VALUES_EQUAL (d0, d1);
- op0lt = op0ltu = REAL_VALUES_LESS (d0, d1);
- op1lt = op1ltu = REAL_VALUES_LESS (d1, d0);
- set_float_handler (NULL_PTR);
- }
-#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
-
- /* Otherwise, see if the operands are both integers. */
- else if ((GET_MODE_CLASS (mode) == MODE_INT || mode == VOIDmode)
- && (GET_CODE (op0) == CONST_DOUBLE || GET_CODE (op0) == CONST_INT)
- && (GET_CODE (op1) == CONST_DOUBLE || GET_CODE (op1) == CONST_INT))
- {
- int width = GET_MODE_BITSIZE (mode);
- HOST_WIDE_INT l0s, h0s, l1s, h1s;
- unsigned HOST_WIDE_INT l0u, h0u, l1u, h1u;
-
- /* Get the two words comprising each integer constant. */
- if (GET_CODE (op0) == CONST_DOUBLE)
- {
- l0u = l0s = CONST_DOUBLE_LOW (op0);
- h0u = h0s = CONST_DOUBLE_HIGH (op0);
- }
- else
- {
- l0u = l0s = INTVAL (op0);
- h0u = 0, h0s = l0s < 0 ? -1 : 0;
- }
-
- if (GET_CODE (op1) == CONST_DOUBLE)
- {
- l1u = l1s = CONST_DOUBLE_LOW (op1);
- h1u = h1s = CONST_DOUBLE_HIGH (op1);
- }
- else
- {
- l1u = l1s = INTVAL (op1);
- h1u = 0, h1s = l1s < 0 ? -1 : 0;
- }
-
- /* If WIDTH is nonzero and smaller than HOST_BITS_PER_WIDE_INT,
- we have to sign or zero-extend the values. */
- if (width != 0 && width <= HOST_BITS_PER_WIDE_INT)
- h0u = h1u = 0, h0s = l0s < 0 ? -1 : 0, h1s = l1s < 0 ? -1 : 0;
-
- if (width != 0 && width < HOST_BITS_PER_WIDE_INT)
- {
- l0u &= ((HOST_WIDE_INT) 1 << width) - 1;
- l1u &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- if (l0s & ((HOST_WIDE_INT) 1 << (width - 1)))
- l0s |= ((HOST_WIDE_INT) (-1) << width);
-
- if (l1s & ((HOST_WIDE_INT) 1 << (width - 1)))
- l1s |= ((HOST_WIDE_INT) (-1) << width);
- }
-
- equal = (h0u == h1u && l0u == l1u);
- op0lt = (h0s < h1s || (h0s == h1s && l0s < l1s));
- op1lt = (h1s < h0s || (h1s == h0s && l1s < l0s));
- op0ltu = (h0u < h1u || (h0u == h1u && l0u < l1u));
- op1ltu = (h1u < h0u || (h1u == h0u && l1u < l0u));
- }
-
- /* Otherwise, there are some code-specific tests we can make. */
- else
- {
- switch (code)
- {
- case EQ:
- /* References to the frame plus a constant or labels cannot
- be zero, but a SYMBOL_REF can due to #pragma weak. */
- if (((NONZERO_BASE_PLUS_P (op0) && op1 == const0_rtx)
- || GET_CODE (op0) == LABEL_REF)
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- /* On some machines, the ap reg can be 0 sometimes. */
- && op0 != arg_pointer_rtx
-#endif
- )
- return const0_rtx;
- break;
-
- case NE:
- if (((NONZERO_BASE_PLUS_P (op0) && op1 == const0_rtx)
- || GET_CODE (op0) == LABEL_REF)
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- && op0 != arg_pointer_rtx
-#endif
- )
- return const_true_rtx;
- break;
-
- case GEU:
- /* Unsigned values are never negative. */
- if (op1 == const0_rtx)
- return const_true_rtx;
- break;
-
- case LTU:
- if (op1 == const0_rtx)
- return const0_rtx;
- break;
-
- case LEU:
- /* Unsigned values are never greater than the largest
- unsigned value. */
- if (GET_CODE (op1) == CONST_INT
- && INTVAL (op1) == GET_MODE_MASK (mode)
- && INTEGRAL_MODE_P (mode))
- return const_true_rtx;
- break;
-
- case GTU:
- if (GET_CODE (op1) == CONST_INT
- && INTVAL (op1) == GET_MODE_MASK (mode)
- && INTEGRAL_MODE_P (mode))
- return const0_rtx;
- break;
- }
-
- return 0;
- }
-
- /* If we reach here, EQUAL, OP0LT, OP0LTU, OP1LT, and OP1LTU are set
- as appropriate. */
- switch (code)
- {
- case EQ:
- return equal ? const_true_rtx : const0_rtx;
- case NE:
- return ! equal ? const_true_rtx : const0_rtx;
- case LT:
- return op0lt ? const_true_rtx : const0_rtx;
- case GT:
- return op1lt ? const_true_rtx : const0_rtx;
- case LTU:
- return op0ltu ? const_true_rtx : const0_rtx;
- case GTU:
- return op1ltu ? const_true_rtx : const0_rtx;
- case LE:
- return equal || op0lt ? const_true_rtx : const0_rtx;
- case GE:
- return equal || op1lt ? const_true_rtx : const0_rtx;
- case LEU:
- return equal || op0ltu ? const_true_rtx : const0_rtx;
- case GEU:
- return equal || op1ltu ? const_true_rtx : const0_rtx;
- }
-
- abort ();
-}
-
-/* Simplify CODE, an operation with result mode MODE and three operands,
- OP0, OP1, and OP2. OP0_MODE was the mode of OP0 before it became
- a constant. Return 0 if no simplifications is possible. */
-
-rtx
-simplify_ternary_operation (code, mode, op0_mode, op0, op1, op2)
- enum rtx_code code;
- enum machine_mode mode, op0_mode;
- rtx op0, op1, op2;
-{
- int width = GET_MODE_BITSIZE (mode);
-
- /* VOIDmode means "infinite" precision. */
- if (width == 0)
- width = HOST_BITS_PER_WIDE_INT;
-
- switch (code)
- {
- case SIGN_EXTRACT:
- case ZERO_EXTRACT:
- if (GET_CODE (op0) == CONST_INT
- && GET_CODE (op1) == CONST_INT
- && GET_CODE (op2) == CONST_INT
- && INTVAL (op1) + INTVAL (op2) <= GET_MODE_BITSIZE (op0_mode)
- && width <= HOST_BITS_PER_WIDE_INT)
- {
- /* Extracting a bit-field from a constant */
- HOST_WIDE_INT val = INTVAL (op0);
-
- if (BITS_BIG_ENDIAN)
- val >>= (GET_MODE_BITSIZE (op0_mode)
- - INTVAL (op2) - INTVAL (op1));
- else
- val >>= INTVAL (op2);
-
- if (HOST_BITS_PER_WIDE_INT != INTVAL (op1))
- {
- /* First zero-extend. */
- val &= ((HOST_WIDE_INT) 1 << INTVAL (op1)) - 1;
- /* If desired, propagate sign bit. */
- if (code == SIGN_EXTRACT
- && (val & ((HOST_WIDE_INT) 1 << (INTVAL (op1) - 1))))
- val |= ~ (((HOST_WIDE_INT) 1 << INTVAL (op1)) - 1);
- }
-
- /* Clear the bits that don't belong in our mode,
- unless they and our sign bit are all one.
- So we get either a reasonable negative value or a reasonable
- unsigned value for this mode. */
- if (width < HOST_BITS_PER_WIDE_INT
- && ((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
- != ((HOST_WIDE_INT) (-1) << (width - 1))))
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- return GEN_INT (val);
- }
- break;
-
- case IF_THEN_ELSE:
- if (GET_CODE (op0) == CONST_INT)
- return op0 != const0_rtx ? op1 : op2;
- break;
-
- default:
- abort ();
- }
-
- return 0;
-}
-
-/* If X is a nontrivial arithmetic operation on an argument
- for which a constant value can be determined, return
- the result of operating on that value, as a constant.
- Otherwise, return X, possibly with one or more operands
- modified by recursive calls to this function.
-
- If X is a register whose contents are known, we do NOT
- return those contents here. equiv_constant is called to
- perform that task.
-
- INSN is the insn that we may be modifying. If it is 0, make a copy
- of X before modifying it. */
-
-static rtx
-fold_rtx (x, insn)
- rtx x;
- rtx insn;
-{
- register enum rtx_code code;
- register enum machine_mode mode;
- register char *fmt;
- register int i;
- rtx new = 0;
- int copied = 0;
- int must_swap = 0;
-
- /* Folded equivalents of first two operands of X. */
- rtx folded_arg0;
- rtx folded_arg1;
-
- /* Constant equivalents of first three operands of X;
- 0 when no such equivalent is known. */
- rtx const_arg0;
- rtx const_arg1;
- rtx const_arg2;
-
- /* The mode of the first operand of X. We need this for sign and zero
- extends. */
- enum machine_mode mode_arg0;
-
- if (x == 0)
- return x;
-
- mode = GET_MODE (x);
- code = GET_CODE (x);
- switch (code)
- {
- case CONST:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- case REG:
- /* No use simplifying an EXPR_LIST
- since they are used only for lists of args
- in a function call's REG_EQUAL note. */
- case EXPR_LIST:
- return x;
-
-#ifdef HAVE_cc0
- case CC0:
- return prev_insn_cc0;
-#endif
-
- case PC:
- /* If the next insn is a CODE_LABEL followed by a jump table,
- PC's value is a LABEL_REF pointing to that label. That
- lets us fold switch statements on the Vax. */
- if (insn && GET_CODE (insn) == JUMP_INSN)
- {
- rtx next = next_nonnote_insn (insn);
-
- if (next && GET_CODE (next) == CODE_LABEL
- && NEXT_INSN (next) != 0
- && GET_CODE (NEXT_INSN (next)) == JUMP_INSN
- && (GET_CODE (PATTERN (NEXT_INSN (next))) == ADDR_VEC
- || GET_CODE (PATTERN (NEXT_INSN (next))) == ADDR_DIFF_VEC))
- return gen_rtx (LABEL_REF, Pmode, next);
- }
- break;
-
- case SUBREG:
- /* See if we previously assigned a constant value to this SUBREG. */
- if ((new = lookup_as_function (x, CONST_INT)) != 0
- || (new = lookup_as_function (x, CONST_DOUBLE)) != 0)
- return new;
-
- /* If this is a paradoxical SUBREG, we have no idea what value the
- extra bits would have. However, if the operand is equivalent
- to a SUBREG whose operand is the same as our mode, and all the
- modes are within a word, we can just use the inner operand
- because these SUBREGs just say how to treat the register.
-
- Similarly if we find an integer constant. */
-
- if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- {
- enum machine_mode imode = GET_MODE (SUBREG_REG (x));
- struct table_elt *elt;
-
- if (GET_MODE_SIZE (mode) <= UNITS_PER_WORD
- && GET_MODE_SIZE (imode) <= UNITS_PER_WORD
- && (elt = lookup (SUBREG_REG (x), HASH (SUBREG_REG (x), imode),
- imode)) != 0)
- for (elt = elt->first_same_value;
- elt; elt = elt->next_same_value)
- {
- if (CONSTANT_P (elt->exp)
- && GET_MODE (elt->exp) == VOIDmode)
- return elt->exp;
-
- if (GET_CODE (elt->exp) == SUBREG
- && GET_MODE (SUBREG_REG (elt->exp)) == mode
- && exp_equiv_p (elt->exp, elt->exp, 1, 0))
- return copy_rtx (SUBREG_REG (elt->exp));
- }
-
- return x;
- }
-
- /* Fold SUBREG_REG. If it changed, see if we can simplify the SUBREG.
- We might be able to if the SUBREG is extracting a single word in an
- integral mode or extracting the low part. */
-
- folded_arg0 = fold_rtx (SUBREG_REG (x), insn);
- const_arg0 = equiv_constant (folded_arg0);
- if (const_arg0)
- folded_arg0 = const_arg0;
-
- if (folded_arg0 != SUBREG_REG (x))
- {
- new = 0;
-
- if (GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_SIZE (mode) == UNITS_PER_WORD
- && GET_MODE (SUBREG_REG (x)) != VOIDmode)
- new = operand_subword (folded_arg0, SUBREG_WORD (x), 0,
- GET_MODE (SUBREG_REG (x)));
- if (new == 0 && subreg_lowpart_p (x))
- new = gen_lowpart_if_possible (mode, folded_arg0);
- if (new)
- return new;
- }
-
- /* If this is a narrowing SUBREG and our operand is a REG, see if
- we can find an equivalence for REG that is an arithmetic operation
- in a wider mode where both operands are paradoxical SUBREGs
- from objects of our result mode. In that case, we couldn't report
- an equivalent value for that operation, since we don't know what the
- extra bits will be. But we can find an equivalence for this SUBREG
- by folding that operation is the narrow mode. This allows us to
- fold arithmetic in narrow modes when the machine only supports
- word-sized arithmetic.
-
- Also look for a case where we have a SUBREG whose operand is the
- same as our result. If both modes are smaller than a word, we
- are simply interpreting a register in different modes and we
- can use the inner value. */
-
- if (GET_CODE (folded_arg0) == REG
- && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (folded_arg0))
- && subreg_lowpart_p (x))
- {
- struct table_elt *elt;
-
- /* We can use HASH here since we know that canon_hash won't be
- called. */
- elt = lookup (folded_arg0,
- HASH (folded_arg0, GET_MODE (folded_arg0)),
- GET_MODE (folded_arg0));
-
- if (elt)
- elt = elt->first_same_value;
-
- for (; elt; elt = elt->next_same_value)
- {
- enum rtx_code eltcode = GET_CODE (elt->exp);
-
- /* Just check for unary and binary operations. */
- if (GET_RTX_CLASS (GET_CODE (elt->exp)) == '1'
- && GET_CODE (elt->exp) != SIGN_EXTEND
- && GET_CODE (elt->exp) != ZERO_EXTEND
- && GET_CODE (XEXP (elt->exp, 0)) == SUBREG
- && GET_MODE (SUBREG_REG (XEXP (elt->exp, 0))) == mode)
- {
- rtx op0 = SUBREG_REG (XEXP (elt->exp, 0));
-
- if (GET_CODE (op0) != REG && ! CONSTANT_P (op0))
- op0 = fold_rtx (op0, NULL_RTX);
-
- op0 = equiv_constant (op0);
- if (op0)
- new = simplify_unary_operation (GET_CODE (elt->exp), mode,
- op0, mode);
- }
- else if ((GET_RTX_CLASS (GET_CODE (elt->exp)) == '2'
- || GET_RTX_CLASS (GET_CODE (elt->exp)) == 'c')
- && eltcode != DIV && eltcode != MOD
- && eltcode != UDIV && eltcode != UMOD
- && eltcode != ASHIFTRT && eltcode != LSHIFTRT
- && eltcode != ROTATE && eltcode != ROTATERT
- && ((GET_CODE (XEXP (elt->exp, 0)) == SUBREG
- && (GET_MODE (SUBREG_REG (XEXP (elt->exp, 0)))
- == mode))
- || CONSTANT_P (XEXP (elt->exp, 0)))
- && ((GET_CODE (XEXP (elt->exp, 1)) == SUBREG
- && (GET_MODE (SUBREG_REG (XEXP (elt->exp, 1)))
- == mode))
- || CONSTANT_P (XEXP (elt->exp, 1))))
- {
- rtx op0 = gen_lowpart_common (mode, XEXP (elt->exp, 0));
- rtx op1 = gen_lowpart_common (mode, XEXP (elt->exp, 1));
-
- if (op0 && GET_CODE (op0) != REG && ! CONSTANT_P (op0))
- op0 = fold_rtx (op0, NULL_RTX);
-
- if (op0)
- op0 = equiv_constant (op0);
-
- if (op1 && GET_CODE (op1) != REG && ! CONSTANT_P (op1))
- op1 = fold_rtx (op1, NULL_RTX);
-
- if (op1)
- op1 = equiv_constant (op1);
-
- /* If we are looking for the low SImode part of
- (ashift:DI c (const_int 32)), it doesn't work
- to compute that in SImode, because a 32-bit shift
- in SImode is unpredictable. We know the value is 0. */
- if (op0 && op1
- && GET_CODE (elt->exp) == ASHIFT
- && GET_CODE (op1) == CONST_INT
- && INTVAL (op1) >= GET_MODE_BITSIZE (mode))
- {
- if (INTVAL (op1) < GET_MODE_BITSIZE (GET_MODE (elt->exp)))
-
- /* If the count fits in the inner mode's width,
- but exceeds the outer mode's width,
- the value will get truncated to 0
- by the subreg. */
- new = const0_rtx;
- else
- /* If the count exceeds even the inner mode's width,
- don't fold this expression. */
- new = 0;
- }
- else if (op0 && op1)
- new = simplify_binary_operation (GET_CODE (elt->exp), mode,
- op0, op1);
- }
-
- else if (GET_CODE (elt->exp) == SUBREG
- && GET_MODE (SUBREG_REG (elt->exp)) == mode
- && (GET_MODE_SIZE (GET_MODE (folded_arg0))
- <= UNITS_PER_WORD)
- && exp_equiv_p (elt->exp, elt->exp, 1, 0))
- new = copy_rtx (SUBREG_REG (elt->exp));
-
- if (new)
- return new;
- }
- }
-
- return x;
-
- case NOT:
- case NEG:
- /* If we have (NOT Y), see if Y is known to be (NOT Z).
- If so, (NOT Y) simplifies to Z. Similarly for NEG. */
- new = lookup_as_function (XEXP (x, 0), code);
- if (new)
- return fold_rtx (copy_rtx (XEXP (new, 0)), insn);
- break;
-
- case MEM:
- /* If we are not actually processing an insn, don't try to find the
- best address. Not only don't we care, but we could modify the
- MEM in an invalid way since we have no insn to validate against. */
- if (insn != 0)
- find_best_addr (insn, &XEXP (x, 0));
-
- {
- /* Even if we don't fold in the insn itself,
- we can safely do so here, in hopes of getting a constant. */
- rtx addr = fold_rtx (XEXP (x, 0), NULL_RTX);
- rtx base = 0;
- HOST_WIDE_INT offset = 0;
-
- if (GET_CODE (addr) == REG
- && REGNO_QTY_VALID_P (REGNO (addr))
- && GET_MODE (addr) == qty_mode[reg_qty[REGNO (addr)]]
- && qty_const[reg_qty[REGNO (addr)]] != 0)
- addr = qty_const[reg_qty[REGNO (addr)]];
-
- /* If address is constant, split it into a base and integer offset. */
- if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
- base = addr;
- else if (GET_CODE (addr) == CONST && GET_CODE (XEXP (addr, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST_INT)
- {
- base = XEXP (XEXP (addr, 0), 0);
- offset = INTVAL (XEXP (XEXP (addr, 0), 1));
- }
- else if (GET_CODE (addr) == LO_SUM
- && GET_CODE (XEXP (addr, 1)) == SYMBOL_REF)
- base = XEXP (addr, 1);
-
- /* If this is a constant pool reference, we can fold it into its
- constant to allow better value tracking. */
- if (base && GET_CODE (base) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (base))
- {
- rtx constant = get_pool_constant (base);
- enum machine_mode const_mode = get_pool_mode (base);
- rtx new;
-
- if (CONSTANT_P (constant) && GET_CODE (constant) != CONST_INT)
- constant_pool_entries_cost = COST (constant);
-
- /* If we are loading the full constant, we have an equivalence. */
- if (offset == 0 && mode == const_mode)
- return constant;
-
- /* If this actually isn't a constant (weird!), we can't do
- anything. Otherwise, handle the two most common cases:
- extracting a word from a multi-word constant, and extracting
- the low-order bits. Other cases don't seem common enough to
- worry about. */
- if (! CONSTANT_P (constant))
- return x;
-
- if (GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_SIZE (mode) == UNITS_PER_WORD
- && offset % UNITS_PER_WORD == 0
- && (new = operand_subword (constant,
- offset / UNITS_PER_WORD,
- 0, const_mode)) != 0)
- return new;
-
- if (((BYTES_BIG_ENDIAN
- && offset == GET_MODE_SIZE (GET_MODE (constant)) - 1)
- || (! BYTES_BIG_ENDIAN && offset == 0))
- && (new = gen_lowpart_if_possible (mode, constant)) != 0)
- return new;
- }
-
- /* If this is a reference to a label at a known position in a jump
- table, we also know its value. */
- if (base && GET_CODE (base) == LABEL_REF)
- {
- rtx label = XEXP (base, 0);
- rtx table_insn = NEXT_INSN (label);
-
- if (table_insn && GET_CODE (table_insn) == JUMP_INSN
- && GET_CODE (PATTERN (table_insn)) == ADDR_VEC)
- {
- rtx table = PATTERN (table_insn);
-
- if (offset >= 0
- && (offset / GET_MODE_SIZE (GET_MODE (table))
- < XVECLEN (table, 0)))
- return XVECEXP (table, 0,
- offset / GET_MODE_SIZE (GET_MODE (table)));
- }
- if (table_insn && GET_CODE (table_insn) == JUMP_INSN
- && GET_CODE (PATTERN (table_insn)) == ADDR_DIFF_VEC)
- {
- rtx table = PATTERN (table_insn);
-
- if (offset >= 0
- && (offset / GET_MODE_SIZE (GET_MODE (table))
- < XVECLEN (table, 1)))
- {
- offset /= GET_MODE_SIZE (GET_MODE (table));
- new = gen_rtx (MINUS, Pmode, XVECEXP (table, 1, offset),
- XEXP (table, 0));
-
- if (GET_MODE (table) != Pmode)
- new = gen_rtx (TRUNCATE, GET_MODE (table), new);
-
- /* Indicate this is a constant. This isn't a
- valid form of CONST, but it will only be used
- to fold the next insns and then discarded, so
- it should be safe. */
- return gen_rtx (CONST, GET_MODE (new), new);
- }
- }
- }
-
- return x;
- }
-
- case ASM_OPERANDS:
- for (i = XVECLEN (x, 3) - 1; i >= 0; i--)
- validate_change (insn, &XVECEXP (x, 3, i),
- fold_rtx (XVECEXP (x, 3, i), insn), 0);
- break;
- }
-
- const_arg0 = 0;
- const_arg1 = 0;
- const_arg2 = 0;
- mode_arg0 = VOIDmode;
-
- /* Try folding our operands.
- Then see which ones have constant values known. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- {
- rtx arg = XEXP (x, i);
- rtx folded_arg = arg, const_arg = 0;
- enum machine_mode mode_arg = GET_MODE (arg);
- rtx cheap_arg, expensive_arg;
- rtx replacements[2];
- int j;
-
- /* Most arguments are cheap, so handle them specially. */
- switch (GET_CODE (arg))
- {
- case REG:
- /* This is the same as calling equiv_constant; it is duplicated
- here for speed. */
- if (REGNO_QTY_VALID_P (REGNO (arg))
- && qty_const[reg_qty[REGNO (arg)]] != 0
- && GET_CODE (qty_const[reg_qty[REGNO (arg)]]) != REG
- && GET_CODE (qty_const[reg_qty[REGNO (arg)]]) != PLUS)
- const_arg
- = gen_lowpart_if_possible (GET_MODE (arg),
- qty_const[reg_qty[REGNO (arg)]]);
- break;
-
- case CONST:
- case CONST_INT:
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST_DOUBLE:
- const_arg = arg;
- break;
-
-#ifdef HAVE_cc0
- case CC0:
- folded_arg = prev_insn_cc0;
- mode_arg = prev_insn_cc0_mode;
- const_arg = equiv_constant (folded_arg);
- break;
-#endif
-
- default:
- folded_arg = fold_rtx (arg, insn);
- const_arg = equiv_constant (folded_arg);
- }
-
- /* For the first three operands, see if the operand
- is constant or equivalent to a constant. */
- switch (i)
- {
- case 0:
- folded_arg0 = folded_arg;
- const_arg0 = const_arg;
- mode_arg0 = mode_arg;
- break;
- case 1:
- folded_arg1 = folded_arg;
- const_arg1 = const_arg;
- break;
- case 2:
- const_arg2 = const_arg;
- break;
- }
-
- /* Pick the least expensive of the folded argument and an
- equivalent constant argument. */
- if (const_arg == 0 || const_arg == folded_arg
- || COST (const_arg) > COST (folded_arg))
- cheap_arg = folded_arg, expensive_arg = const_arg;
- else
- cheap_arg = const_arg, expensive_arg = folded_arg;
-
- /* Try to replace the operand with the cheapest of the two
- possibilities. If it doesn't work and this is either of the first
- two operands of a commutative operation, try swapping them.
- If THAT fails, try the more expensive, provided it is cheaper
- than what is already there. */
-
- if (cheap_arg == XEXP (x, i))
- continue;
-
- if (insn == 0 && ! copied)
- {
- x = copy_rtx (x);
- copied = 1;
- }
-
- replacements[0] = cheap_arg, replacements[1] = expensive_arg;
- for (j = 0;
- j < 2 && replacements[j]
- && COST (replacements[j]) < COST (XEXP (x, i));
- j++)
- {
- if (validate_change (insn, &XEXP (x, i), replacements[j], 0))
- break;
-
- if (code == NE || code == EQ || GET_RTX_CLASS (code) == 'c')
- {
- validate_change (insn, &XEXP (x, i), XEXP (x, 1 - i), 1);
- validate_change (insn, &XEXP (x, 1 - i), replacements[j], 1);
-
- if (apply_change_group ())
- {
- /* Swap them back to be invalid so that this loop can
- continue and flag them to be swapped back later. */
- rtx tem;
-
- tem = XEXP (x, 0); XEXP (x, 0) = XEXP (x, 1);
- XEXP (x, 1) = tem;
- must_swap = 1;
- break;
- }
- }
- }
- }
-
- else if (fmt[i] == 'E')
- /* Don't try to fold inside of a vector of expressions.
- Doing nothing is harmless. */
- ;
-
- /* If a commutative operation, place a constant integer as the second
- operand unless the first operand is also a constant integer. Otherwise,
- place any constant second unless the first operand is also a constant. */
-
- if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c')
- {
- if (must_swap || (const_arg0
- && (const_arg1 == 0
- || (GET_CODE (const_arg0) == CONST_INT
- && GET_CODE (const_arg1) != CONST_INT))))
- {
- register rtx tem = XEXP (x, 0);
-
- if (insn == 0 && ! copied)
- {
- x = copy_rtx (x);
- copied = 1;
- }
-
- validate_change (insn, &XEXP (x, 0), XEXP (x, 1), 1);
- validate_change (insn, &XEXP (x, 1), tem, 1);
- if (apply_change_group ())
- {
- tem = const_arg0, const_arg0 = const_arg1, const_arg1 = tem;
- tem = folded_arg0, folded_arg0 = folded_arg1, folded_arg1 = tem;
- }
- }
- }
-
- /* If X is an arithmetic operation, see if we can simplify it. */
-
- switch (GET_RTX_CLASS (code))
- {
- case '1':
- {
- int is_const = 0;
-
- /* We can't simplify extension ops unless we know the
- original mode. */
- if ((code == ZERO_EXTEND || code == SIGN_EXTEND)
- && mode_arg0 == VOIDmode)
- break;
-
- /* If we had a CONST, strip it off and put it back later if we
- fold. */
- if (const_arg0 != 0 && GET_CODE (const_arg0) == CONST)
- is_const = 1, const_arg0 = XEXP (const_arg0, 0);
-
- new = simplify_unary_operation (code, mode,
- const_arg0 ? const_arg0 : folded_arg0,
- mode_arg0);
- if (new != 0 && is_const)
- new = gen_rtx (CONST, mode, new);
- }
- break;
-
- case '<':
- /* See what items are actually being compared and set FOLDED_ARG[01]
- to those values and CODE to the actual comparison code. If any are
- constant, set CONST_ARG0 and CONST_ARG1 appropriately. We needn't
- do anything if both operands are already known to be constant. */
-
- if (const_arg0 == 0 || const_arg1 == 0)
- {
- struct table_elt *p0, *p1;
- rtx true = const_true_rtx, false = const0_rtx;
- enum machine_mode mode_arg1;
-
-#ifdef FLOAT_STORE_FLAG_VALUE
- if (GET_MODE_CLASS (mode) == MODE_FLOAT)
- {
- true = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE,
- mode);
- false = CONST0_RTX (mode);
- }
-#endif
-
- code = find_comparison_args (code, &folded_arg0, &folded_arg1,
- &mode_arg0, &mode_arg1);
- const_arg0 = equiv_constant (folded_arg0);
- const_arg1 = equiv_constant (folded_arg1);
-
- /* If the mode is VOIDmode or a MODE_CC mode, we don't know
- what kinds of things are being compared, so we can't do
- anything with this comparison. */
-
- if (mode_arg0 == VOIDmode || GET_MODE_CLASS (mode_arg0) == MODE_CC)
- break;
-
- /* If we do not now have two constants being compared, see
- if we can nevertheless deduce some things about the
- comparison. */
- if (const_arg0 == 0 || const_arg1 == 0)
- {
- /* Is FOLDED_ARG0 frame-pointer plus a constant? Or
- non-explicit constant? These aren't zero, but we
- don't know their sign. */
- if (const_arg1 == const0_rtx
- && (NONZERO_BASE_PLUS_P (folded_arg0)
-#if 0 /* Sad to say, on sysvr4, #pragma weak can make a symbol address
- come out as 0. */
- || GET_CODE (folded_arg0) == SYMBOL_REF
-#endif
- || GET_CODE (folded_arg0) == LABEL_REF
- || GET_CODE (folded_arg0) == CONST))
- {
- if (code == EQ)
- return false;
- else if (code == NE)
- return true;
- }
-
- /* See if the two operands are the same. We don't do this
- for IEEE floating-point since we can't assume x == x
- since x might be a NaN. */
-
- if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || ! FLOAT_MODE_P (mode_arg0) || flag_fast_math)
- && (folded_arg0 == folded_arg1
- || (GET_CODE (folded_arg0) == REG
- && GET_CODE (folded_arg1) == REG
- && (reg_qty[REGNO (folded_arg0)]
- == reg_qty[REGNO (folded_arg1)]))
- || ((p0 = lookup (folded_arg0,
- (safe_hash (folded_arg0, mode_arg0)
- % NBUCKETS), mode_arg0))
- && (p1 = lookup (folded_arg1,
- (safe_hash (folded_arg1, mode_arg0)
- % NBUCKETS), mode_arg0))
- && p0->first_same_value == p1->first_same_value)))
- return ((code == EQ || code == LE || code == GE
- || code == LEU || code == GEU)
- ? true : false);
-
- /* If FOLDED_ARG0 is a register, see if the comparison we are
- doing now is either the same as we did before or the reverse
- (we only check the reverse if not floating-point). */
- else if (GET_CODE (folded_arg0) == REG)
- {
- int qty = reg_qty[REGNO (folded_arg0)];
-
- if (REGNO_QTY_VALID_P (REGNO (folded_arg0))
- && (comparison_dominates_p (qty_comparison_code[qty], code)
- || (comparison_dominates_p (qty_comparison_code[qty],
- reverse_condition (code))
- && ! FLOAT_MODE_P (mode_arg0)))
- && (rtx_equal_p (qty_comparison_const[qty], folded_arg1)
- || (const_arg1
- && rtx_equal_p (qty_comparison_const[qty],
- const_arg1))
- || (GET_CODE (folded_arg1) == REG
- && (reg_qty[REGNO (folded_arg1)]
- == qty_comparison_qty[qty]))))
- return (comparison_dominates_p (qty_comparison_code[qty],
- code)
- ? true : false);
- }
- }
- }
-
- /* If we are comparing against zero, see if the first operand is
- equivalent to an IOR with a constant. If so, we may be able to
- determine the result of this comparison. */
-
- if (const_arg1 == const0_rtx)
- {
- rtx y = lookup_as_function (folded_arg0, IOR);
- rtx inner_const;
-
- if (y != 0
- && (inner_const = equiv_constant (XEXP (y, 1))) != 0
- && GET_CODE (inner_const) == CONST_INT
- && INTVAL (inner_const) != 0)
- {
- int sign_bitnum = GET_MODE_BITSIZE (mode_arg0) - 1;
- int has_sign = (HOST_BITS_PER_WIDE_INT >= sign_bitnum
- && (INTVAL (inner_const)
- & ((HOST_WIDE_INT) 1 << sign_bitnum)));
- rtx true = const_true_rtx, false = const0_rtx;
-
-#ifdef FLOAT_STORE_FLAG_VALUE
- if (GET_MODE_CLASS (mode) == MODE_FLOAT)
- {
- true = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE,
- mode);
- false = CONST0_RTX (mode);
- }
-#endif
-
- switch (code)
- {
- case EQ:
- return false;
- case NE:
- return true;
- case LT: case LE:
- if (has_sign)
- return true;
- break;
- case GT: case GE:
- if (has_sign)
- return false;
- break;
- }
- }
- }
-
- new = simplify_relational_operation (code, mode_arg0,
- const_arg0 ? const_arg0 : folded_arg0,
- const_arg1 ? const_arg1 : folded_arg1);
-#ifdef FLOAT_STORE_FLAG_VALUE
- if (new != 0 && GET_MODE_CLASS (mode) == MODE_FLOAT)
- new = ((new == const0_rtx) ? CONST0_RTX (mode)
- : CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE, mode));
-#endif
- break;
-
- case '2':
- case 'c':
- switch (code)
- {
- case PLUS:
- /* If the second operand is a LABEL_REF, see if the first is a MINUS
- with that LABEL_REF as its second operand. If so, the result is
- the first operand of that MINUS. This handles switches with an
- ADDR_DIFF_VEC table. */
- if (const_arg1 && GET_CODE (const_arg1) == LABEL_REF)
- {
- rtx y
- = GET_CODE (folded_arg0) == MINUS ? folded_arg0
- : lookup_as_function (folded_arg0, MINUS);
-
- if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF
- && XEXP (XEXP (y, 1), 0) == XEXP (const_arg1, 0))
- return XEXP (y, 0);
-
- /* Now try for a CONST of a MINUS like the above. */
- if ((y = (GET_CODE (folded_arg0) == CONST ? folded_arg0
- : lookup_as_function (folded_arg0, CONST))) != 0
- && GET_CODE (XEXP (y, 0)) == MINUS
- && GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
- && XEXP (XEXP (XEXP (y, 0),1), 0) == XEXP (const_arg1, 0))
- return XEXP (XEXP (y, 0), 0);
- }
-
- /* Likewise if the operands are in the other order. */
- if (const_arg0 && GET_CODE (const_arg0) == LABEL_REF)
- {
- rtx y
- = GET_CODE (folded_arg1) == MINUS ? folded_arg1
- : lookup_as_function (folded_arg1, MINUS);
-
- if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF
- && XEXP (XEXP (y, 1), 0) == XEXP (const_arg0, 0))
- return XEXP (y, 0);
-
- /* Now try for a CONST of a MINUS like the above. */
- if ((y = (GET_CODE (folded_arg1) == CONST ? folded_arg1
- : lookup_as_function (folded_arg1, CONST))) != 0
- && GET_CODE (XEXP (y, 0)) == MINUS
- && GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
- && XEXP (XEXP (XEXP (y, 0),1), 0) == XEXP (const_arg0, 0))
- return XEXP (XEXP (y, 0), 0);
- }
-
- /* If second operand is a register equivalent to a negative
- CONST_INT, see if we can find a register equivalent to the
- positive constant. Make a MINUS if so. Don't do this for
- a negative constant since we might then alternate between
- chosing positive and negative constants. Having the positive
- constant previously-used is the more common case. */
- if (const_arg1 && GET_CODE (const_arg1) == CONST_INT
- && INTVAL (const_arg1) < 0 && GET_CODE (folded_arg1) == REG)
- {
- rtx new_const = GEN_INT (- INTVAL (const_arg1));
- struct table_elt *p
- = lookup (new_const, safe_hash (new_const, mode) % NBUCKETS,
- mode);
-
- if (p)
- for (p = p->first_same_value; p; p = p->next_same_value)
- if (GET_CODE (p->exp) == REG)
- return cse_gen_binary (MINUS, mode, folded_arg0,
- canon_reg (p->exp, NULL_RTX));
- }
- goto from_plus;
-
- case MINUS:
- /* If we have (MINUS Y C), see if Y is known to be (PLUS Z C2).
- If so, produce (PLUS Z C2-C). */
- if (const_arg1 != 0 && GET_CODE (const_arg1) == CONST_INT)
- {
- rtx y = lookup_as_function (XEXP (x, 0), PLUS);
- if (y && GET_CODE (XEXP (y, 1)) == CONST_INT)
- return fold_rtx (plus_constant (copy_rtx (y),
- -INTVAL (const_arg1)),
- NULL_RTX);
- }
-
- /* ... fall through ... */
-
- from_plus:
- case SMIN: case SMAX: case UMIN: case UMAX:
- case IOR: case AND: case XOR:
- case MULT: case DIV: case UDIV:
- case ASHIFT: case LSHIFTRT: case ASHIFTRT:
- /* If we have (<op> <reg> <const_int>) for an associative OP and REG
- is known to be of similar form, we may be able to replace the
- operation with a combined operation. This may eliminate the
- intermediate operation if every use is simplified in this way.
- Note that the similar optimization done by combine.c only works
- if the intermediate operation's result has only one reference. */
-
- if (GET_CODE (folded_arg0) == REG
- && const_arg1 && GET_CODE (const_arg1) == CONST_INT)
- {
- int is_shift
- = (code == ASHIFT || code == ASHIFTRT || code == LSHIFTRT);
- rtx y = lookup_as_function (folded_arg0, code);
- rtx inner_const;
- enum rtx_code associate_code;
- rtx new_const;
-
- if (y == 0
- || 0 == (inner_const
- = equiv_constant (fold_rtx (XEXP (y, 1), 0)))
- || GET_CODE (inner_const) != CONST_INT
- /* If we have compiled a statement like
- "if (x == (x & mask1))", and now are looking at
- "x & mask2", we will have a case where the first operand
- of Y is the same as our first operand. Unless we detect
- this case, an infinite loop will result. */
- || XEXP (y, 0) == folded_arg0)
- break;
-
- /* Don't associate these operations if they are a PLUS with the
- same constant and it is a power of two. These might be doable
- with a pre- or post-increment. Similarly for two subtracts of
- identical powers of two with post decrement. */
-
- if (code == PLUS && INTVAL (const_arg1) == INTVAL (inner_const)
- && (0
-#if defined(HAVE_PRE_INCREMENT) || defined(HAVE_POST_INCREMENT)
- || exact_log2 (INTVAL (const_arg1)) >= 0
-#endif
-#if defined(HAVE_PRE_DECREMENT) || defined(HAVE_POST_DECREMENT)
- || exact_log2 (- INTVAL (const_arg1)) >= 0
-#endif
- ))
- break;
-
- /* Compute the code used to compose the constants. For example,
- A/C1/C2 is A/(C1 * C2), so if CODE == DIV, we want MULT. */
-
- associate_code
- = (code == MULT || code == DIV || code == UDIV ? MULT
- : is_shift || code == PLUS || code == MINUS ? PLUS : code);
-
- new_const = simplify_binary_operation (associate_code, mode,
- const_arg1, inner_const);
-
- if (new_const == 0)
- break;
-
- /* If we are associating shift operations, don't let this
- produce a shift of the size of the object or larger.
- This could occur when we follow a sign-extend by a right
- shift on a machine that does a sign-extend as a pair
- of shifts. */
-
- if (is_shift && GET_CODE (new_const) == CONST_INT
- && INTVAL (new_const) >= GET_MODE_BITSIZE (mode))
- {
- /* As an exception, we can turn an ASHIFTRT of this
- form into a shift of the number of bits - 1. */
- if (code == ASHIFTRT)
- new_const = GEN_INT (GET_MODE_BITSIZE (mode) - 1);
- else
- break;
- }
-
- y = copy_rtx (XEXP (y, 0));
-
- /* If Y contains our first operand (the most common way this
- can happen is if Y is a MEM), we would do into an infinite
- loop if we tried to fold it. So don't in that case. */
-
- if (! reg_mentioned_p (folded_arg0, y))
- y = fold_rtx (y, insn);
-
- return cse_gen_binary (code, mode, y, new_const);
- }
- }
-
- new = simplify_binary_operation (code, mode,
- const_arg0 ? const_arg0 : folded_arg0,
- const_arg1 ? const_arg1 : folded_arg1);
- break;
-
- case 'o':
- /* (lo_sum (high X) X) is simply X. */
- if (code == LO_SUM && const_arg0 != 0
- && GET_CODE (const_arg0) == HIGH
- && rtx_equal_p (XEXP (const_arg0, 0), const_arg1))
- return const_arg1;
- break;
-
- case '3':
- case 'b':
- new = simplify_ternary_operation (code, mode, mode_arg0,
- const_arg0 ? const_arg0 : folded_arg0,
- const_arg1 ? const_arg1 : folded_arg1,
- const_arg2 ? const_arg2 : XEXP (x, 2));
- break;
- }
-
- return new ? new : x;
-}
-
-/* Return a constant value currently equivalent to X.
- Return 0 if we don't know one. */
-
-static rtx
-equiv_constant (x)
- rtx x;
-{
- if (GET_CODE (x) == REG
- && REGNO_QTY_VALID_P (REGNO (x))
- && qty_const[reg_qty[REGNO (x)]])
- x = gen_lowpart_if_possible (GET_MODE (x), qty_const[reg_qty[REGNO (x)]]);
-
- if (x != 0 && CONSTANT_P (x))
- return x;
-
- /* If X is a MEM, try to fold it outside the context of any insn to see if
- it might be equivalent to a constant. That handles the case where it
- is a constant-pool reference. Then try to look it up in the hash table
- in case it is something whose value we have seen before. */
-
- if (GET_CODE (x) == MEM)
- {
- struct table_elt *elt;
-
- x = fold_rtx (x, NULL_RTX);
- if (CONSTANT_P (x))
- return x;
-
- elt = lookup (x, safe_hash (x, GET_MODE (x)) % NBUCKETS, GET_MODE (x));
- if (elt == 0)
- return 0;
-
- for (elt = elt->first_same_value; elt; elt = elt->next_same_value)
- if (elt->is_const && CONSTANT_P (elt->exp))
- return elt->exp;
- }
-
- return 0;
-}
-
-/* Assuming that X is an rtx (e.g., MEM, REG or SUBREG) for a fixed-point
- number, return an rtx (MEM, SUBREG, or CONST_INT) that refers to the
- least-significant part of X.
- MODE specifies how big a part of X to return.
-
- If the requested operation cannot be done, 0 is returned.
-
- This is similar to gen_lowpart in emit-rtl.c. */
-
-rtx
-gen_lowpart_if_possible (mode, x)
- enum machine_mode mode;
- register rtx x;
-{
- rtx result = gen_lowpart_common (mode, x);
-
- if (result)
- return result;
- else if (GET_CODE (x) == MEM)
- {
- /* This is the only other case we handle. */
- register int offset = 0;
- rtx new;
-
- if (WORDS_BIG_ENDIAN)
- offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
- if (BYTES_BIG_ENDIAN)
- /* Adjust the address so that the address-after-the-data is
- unchanged. */
- offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
- new = gen_rtx (MEM, mode, plus_constant (XEXP (x, 0), offset));
- if (! memory_address_p (mode, XEXP (new, 0)))
- return 0;
- MEM_VOLATILE_P (new) = MEM_VOLATILE_P (x);
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (x);
- MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (x);
- return new;
- }
- else
- return 0;
-}
-
-/* Given INSN, a jump insn, TAKEN indicates if we are following the "taken"
- branch. It will be zero if not.
-
- In certain cases, this can cause us to add an equivalence. For example,
- if we are following the taken case of
- if (i == 2)
- we can add the fact that `i' and '2' are now equivalent.
-
- In any case, we can record that this comparison was passed. If the same
- comparison is seen later, we will know its value. */
-
-static void
-record_jump_equiv (insn, taken)
- rtx insn;
- int taken;
-{
- int cond_known_true;
- rtx op0, op1;
- enum machine_mode mode, mode0, mode1;
- int reversed_nonequality = 0;
- enum rtx_code code;
-
- /* Ensure this is the right kind of insn. */
- if (! condjump_p (insn) || simplejump_p (insn))
- return;
-
- /* See if this jump condition is known true or false. */
- if (taken)
- cond_known_true = (XEXP (SET_SRC (PATTERN (insn)), 2) == pc_rtx);
- else
- cond_known_true = (XEXP (SET_SRC (PATTERN (insn)), 1) == pc_rtx);
-
- /* Get the type of comparison being done and the operands being compared.
- If we had to reverse a non-equality condition, record that fact so we
- know that it isn't valid for floating-point. */
- code = GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 0));
- op0 = fold_rtx (XEXP (XEXP (SET_SRC (PATTERN (insn)), 0), 0), insn);
- op1 = fold_rtx (XEXP (XEXP (SET_SRC (PATTERN (insn)), 0), 1), insn);
-
- code = find_comparison_args (code, &op0, &op1, &mode0, &mode1);
- if (! cond_known_true)
- {
- reversed_nonequality = (code != EQ && code != NE);
- code = reverse_condition (code);
- }
-
- /* The mode is the mode of the non-constant. */
- mode = mode0;
- if (mode1 != VOIDmode)
- mode = mode1;
-
- record_jump_cond (code, mode, op0, op1, reversed_nonequality);
-}
-
-/* We know that comparison CODE applied to OP0 and OP1 in MODE is true.
- REVERSED_NONEQUALITY is nonzero if CODE had to be swapped.
- Make any useful entries we can with that information. Called from
- above function and called recursively. */
-
-static void
-record_jump_cond (code, mode, op0, op1, reversed_nonequality)
- enum rtx_code code;
- enum machine_mode mode;
- rtx op0, op1;
- int reversed_nonequality;
-{
- unsigned op0_hash, op1_hash;
- int op0_in_memory, op0_in_struct, op1_in_memory, op1_in_struct;
- struct table_elt *op0_elt, *op1_elt;
-
- /* If OP0 and OP1 are known equal, and either is a paradoxical SUBREG,
- we know that they are also equal in the smaller mode (this is also
- true for all smaller modes whether or not there is a SUBREG, but
- is not worth testing for with no SUBREG. */
-
- /* Note that GET_MODE (op0) may not equal MODE. */
- if (code == EQ && GET_CODE (op0) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (op0))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0)))))
- {
- enum machine_mode inner_mode = GET_MODE (SUBREG_REG (op0));
- rtx tem = gen_lowpart_if_possible (inner_mode, op1);
-
- record_jump_cond (code, mode, SUBREG_REG (op0),
- tem ? tem : gen_rtx (SUBREG, inner_mode, op1, 0),
- reversed_nonequality);
- }
-
- if (code == EQ && GET_CODE (op1) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (op1))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (op1)))))
- {
- enum machine_mode inner_mode = GET_MODE (SUBREG_REG (op1));
- rtx tem = gen_lowpart_if_possible (inner_mode, op0);
-
- record_jump_cond (code, mode, SUBREG_REG (op1),
- tem ? tem : gen_rtx (SUBREG, inner_mode, op0, 0),
- reversed_nonequality);
- }
-
- /* Similarly, if this is an NE comparison, and either is a SUBREG
- making a smaller mode, we know the whole thing is also NE. */
-
- /* Note that GET_MODE (op0) may not equal MODE;
- if we test MODE instead, we can get an infinite recursion
- alternating between two modes each wider than MODE. */
-
- if (code == NE && GET_CODE (op0) == SUBREG
- && subreg_lowpart_p (op0)
- && (GET_MODE_SIZE (GET_MODE (op0))
- < GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0)))))
- {
- enum machine_mode inner_mode = GET_MODE (SUBREG_REG (op0));
- rtx tem = gen_lowpart_if_possible (inner_mode, op1);
-
- record_jump_cond (code, mode, SUBREG_REG (op0),
- tem ? tem : gen_rtx (SUBREG, inner_mode, op1, 0),
- reversed_nonequality);
- }
-
- if (code == NE && GET_CODE (op1) == SUBREG
- && subreg_lowpart_p (op1)
- && (GET_MODE_SIZE (GET_MODE (op1))
- < GET_MODE_SIZE (GET_MODE (SUBREG_REG (op1)))))
- {
- enum machine_mode inner_mode = GET_MODE (SUBREG_REG (op1));
- rtx tem = gen_lowpart_if_possible (inner_mode, op0);
-
- record_jump_cond (code, mode, SUBREG_REG (op1),
- tem ? tem : gen_rtx (SUBREG, inner_mode, op0, 0),
- reversed_nonequality);
- }
-
- /* Hash both operands. */
-
- do_not_record = 0;
- hash_arg_in_memory = 0;
- hash_arg_in_struct = 0;
- op0_hash = HASH (op0, mode);
- op0_in_memory = hash_arg_in_memory;
- op0_in_struct = hash_arg_in_struct;
-
- if (do_not_record)
- return;
-
- do_not_record = 0;
- hash_arg_in_memory = 0;
- hash_arg_in_struct = 0;
- op1_hash = HASH (op1, mode);
- op1_in_memory = hash_arg_in_memory;
- op1_in_struct = hash_arg_in_struct;
-
- if (do_not_record)
- return;
-
- /* Look up both operands. */
- op0_elt = lookup (op0, op0_hash, mode);
- op1_elt = lookup (op1, op1_hash, mode);
-
- /* If both operands are already equivalent or if they are not in the
- table but are identical, do nothing. */
- if ((op0_elt != 0 && op1_elt != 0
- && op0_elt->first_same_value == op1_elt->first_same_value)
- || op0 == op1 || rtx_equal_p (op0, op1))
- return;
-
- /* If we aren't setting two things equal all we can do is save this
- comparison. Similarly if this is floating-point. In the latter
- case, OP1 might be zero and both -0.0 and 0.0 are equal to it.
- If we record the equality, we might inadvertently delete code
- whose intent was to change -0 to +0. */
-
- if (code != EQ || FLOAT_MODE_P (GET_MODE (op0)))
- {
- /* If we reversed a floating-point comparison, if OP0 is not a
- register, or if OP1 is neither a register or constant, we can't
- do anything. */
-
- if (GET_CODE (op1) != REG)
- op1 = equiv_constant (op1);
-
- if ((reversed_nonequality && FLOAT_MODE_P (mode))
- || GET_CODE (op0) != REG || op1 == 0)
- return;
-
- /* Put OP0 in the hash table if it isn't already. This gives it a
- new quantity number. */
- if (op0_elt == 0)
- {
- if (insert_regs (op0, NULL_PTR, 0))
- {
- rehash_using_reg (op0);
- op0_hash = HASH (op0, mode);
-
- /* If OP0 is contained in OP1, this changes its hash code
- as well. Faster to rehash than to check, except
- for the simple case of a constant. */
- if (! CONSTANT_P (op1))
- op1_hash = HASH (op1,mode);
- }
-
- op0_elt = insert (op0, NULL_PTR, op0_hash, mode);
- op0_elt->in_memory = op0_in_memory;
- op0_elt->in_struct = op0_in_struct;
- }
-
- qty_comparison_code[reg_qty[REGNO (op0)]] = code;
- if (GET_CODE (op1) == REG)
- {
- /* Look it up again--in case op0 and op1 are the same. */
- op1_elt = lookup (op1, op1_hash, mode);
-
- /* Put OP1 in the hash table so it gets a new quantity number. */
- if (op1_elt == 0)
- {
- if (insert_regs (op1, NULL_PTR, 0))
- {
- rehash_using_reg (op1);
- op1_hash = HASH (op1, mode);
- }
-
- op1_elt = insert (op1, NULL_PTR, op1_hash, mode);
- op1_elt->in_memory = op1_in_memory;
- op1_elt->in_struct = op1_in_struct;
- }
-
- qty_comparison_qty[reg_qty[REGNO (op0)]] = reg_qty[REGNO (op1)];
- qty_comparison_const[reg_qty[REGNO (op0)]] = 0;
- }
- else
- {
- qty_comparison_qty[reg_qty[REGNO (op0)]] = -1;
- qty_comparison_const[reg_qty[REGNO (op0)]] = op1;
- }
-
- return;
- }
-
- /* If either side is still missing an equivalence, make it now,
- then merge the equivalences. */
-
- if (op0_elt == 0)
- {
- if (insert_regs (op0, NULL_PTR, 0))
- {
- rehash_using_reg (op0);
- op0_hash = HASH (op0, mode);
- }
-
- op0_elt = insert (op0, NULL_PTR, op0_hash, mode);
- op0_elt->in_memory = op0_in_memory;
- op0_elt->in_struct = op0_in_struct;
- }
-
- if (op1_elt == 0)
- {
- if (insert_regs (op1, NULL_PTR, 0))
- {
- rehash_using_reg (op1);
- op1_hash = HASH (op1, mode);
- }
-
- op1_elt = insert (op1, NULL_PTR, op1_hash, mode);
- op1_elt->in_memory = op1_in_memory;
- op1_elt->in_struct = op1_in_struct;
- }
-
- merge_equiv_classes (op0_elt, op1_elt);
- last_jump_equiv_class = op0_elt;
-}
-
-/* CSE processing for one instruction.
- First simplify sources and addresses of all assignments
- in the instruction, using previously-computed equivalents values.
- Then install the new sources and destinations in the table
- of available values.
-
- If IN_LIBCALL_BLOCK is nonzero, don't record any equivalence made in
- the insn. */
-
-/* Data on one SET contained in the instruction. */
-
-struct set
-{
- /* The SET rtx itself. */
- rtx rtl;
- /* The SET_SRC of the rtx (the original value, if it is changing). */
- rtx src;
- /* The hash-table element for the SET_SRC of the SET. */
- struct table_elt *src_elt;
- /* Hash value for the SET_SRC. */
- unsigned src_hash;
- /* Hash value for the SET_DEST. */
- unsigned dest_hash;
- /* The SET_DEST, with SUBREG, etc., stripped. */
- rtx inner_dest;
- /* Place where the pointer to the INNER_DEST was found. */
- rtx *inner_dest_loc;
- /* Nonzero if the SET_SRC is in memory. */
- char src_in_memory;
- /* Nonzero if the SET_SRC is in a structure. */
- char src_in_struct;
- /* Nonzero if the SET_SRC contains something
- whose value cannot be predicted and understood. */
- char src_volatile;
- /* Original machine mode, in case it becomes a CONST_INT. */
- enum machine_mode mode;
- /* A constant equivalent for SET_SRC, if any. */
- rtx src_const;
- /* Hash value of constant equivalent for SET_SRC. */
- unsigned src_const_hash;
- /* Table entry for constant equivalent for SET_SRC, if any. */
- struct table_elt *src_const_elt;
-};
-
-static void
-cse_insn (insn, in_libcall_block)
- rtx insn;
- int in_libcall_block;
-{
- register rtx x = PATTERN (insn);
- register int i;
- rtx tem;
- register int n_sets = 0;
-
- /* Records what this insn does to set CC0. */
- rtx this_insn_cc0 = 0;
- enum machine_mode this_insn_cc0_mode;
- struct write_data writes_memory;
- static struct write_data init = {0, 0, 0, 0};
-
- rtx src_eqv = 0;
- struct table_elt *src_eqv_elt = 0;
- int src_eqv_volatile;
- int src_eqv_in_memory;
- int src_eqv_in_struct;
- unsigned src_eqv_hash;
-
- struct set *sets;
-
- this_insn = insn;
- writes_memory = init;
-
- /* Find all the SETs and CLOBBERs in this instruction.
- Record all the SETs in the array `set' and count them.
- Also determine whether there is a CLOBBER that invalidates
- all memory references, or all references at varying addresses. */
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- for (tem = CALL_INSN_FUNCTION_USAGE (insn); tem; tem = XEXP (tem, 1))
- if (GET_CODE (XEXP (tem, 0)) == CLOBBER)
- invalidate (SET_DEST (XEXP (tem, 0)), VOIDmode);
- }
-
- if (GET_CODE (x) == SET)
- {
- sets = (struct set *) alloca (sizeof (struct set));
- sets[0].rtl = x;
-
- /* Ignore SETs that are unconditional jumps.
- They never need cse processing, so this does not hurt.
- The reason is not efficiency but rather
- so that we can test at the end for instructions
- that have been simplified to unconditional jumps
- and not be misled by unchanged instructions
- that were unconditional jumps to begin with. */
- if (SET_DEST (x) == pc_rtx
- && GET_CODE (SET_SRC (x)) == LABEL_REF)
- ;
-
- /* Don't count call-insns, (set (reg 0) (call ...)), as a set.
- The hard function value register is used only once, to copy to
- someplace else, so it isn't worth cse'ing (and on 80386 is unsafe)!
- Ensure we invalidate the destination register. On the 80386 no
- other code would invalidate it since it is a fixed_reg.
- We need not check the return of apply_change_group; see canon_reg. */
-
- else if (GET_CODE (SET_SRC (x)) == CALL)
- {
- canon_reg (SET_SRC (x), insn);
- apply_change_group ();
- fold_rtx (SET_SRC (x), insn);
- invalidate (SET_DEST (x), VOIDmode);
- }
- else
- n_sets = 1;
- }
- else if (GET_CODE (x) == PARALLEL)
- {
- register int lim = XVECLEN (x, 0);
-
- sets = (struct set *) alloca (lim * sizeof (struct set));
-
- /* Find all regs explicitly clobbered in this insn,
- and ensure they are not replaced with any other regs
- elsewhere in this insn.
- When a reg that is clobbered is also used for input,
- we should presume that that is for a reason,
- and we should not substitute some other register
- which is not supposed to be clobbered.
- Therefore, this loop cannot be merged into the one below
- because a CALL may precede a CLOBBER and refer to the
- value clobbered. We must not let a canonicalization do
- anything in that case. */
- for (i = 0; i < lim; i++)
- {
- register rtx y = XVECEXP (x, 0, i);
- if (GET_CODE (y) == CLOBBER)
- {
- rtx clobbered = XEXP (y, 0);
-
- if (GET_CODE (clobbered) == REG
- || GET_CODE (clobbered) == SUBREG)
- invalidate (clobbered, VOIDmode);
- else if (GET_CODE (clobbered) == STRICT_LOW_PART
- || GET_CODE (clobbered) == ZERO_EXTRACT)
- invalidate (XEXP (clobbered, 0), GET_MODE (clobbered));
- }
- }
-
- for (i = 0; i < lim; i++)
- {
- register rtx y = XVECEXP (x, 0, i);
- if (GET_CODE (y) == SET)
- {
- /* As above, we ignore unconditional jumps and call-insns and
- ignore the result of apply_change_group. */
- if (GET_CODE (SET_SRC (y)) == CALL)
- {
- canon_reg (SET_SRC (y), insn);
- apply_change_group ();
- fold_rtx (SET_SRC (y), insn);
- invalidate (SET_DEST (y), VOIDmode);
- }
- else if (SET_DEST (y) == pc_rtx
- && GET_CODE (SET_SRC (y)) == LABEL_REF)
- ;
- else
- sets[n_sets++].rtl = y;
- }
- else if (GET_CODE (y) == CLOBBER)
- {
- /* If we clobber memory, take note of that,
- and canon the address.
- This does nothing when a register is clobbered
- because we have already invalidated the reg. */
- if (GET_CODE (XEXP (y, 0)) == MEM)
- {
- canon_reg (XEXP (y, 0), NULL_RTX);
- note_mem_written (XEXP (y, 0), &writes_memory);
- }
- }
- else if (GET_CODE (y) == USE
- && ! (GET_CODE (XEXP (y, 0)) == REG
- && REGNO (XEXP (y, 0)) < FIRST_PSEUDO_REGISTER))
- canon_reg (y, NULL_RTX);
- else if (GET_CODE (y) == CALL)
- {
- /* The result of apply_change_group can be ignored; see
- canon_reg. */
- canon_reg (y, insn);
- apply_change_group ();
- fold_rtx (y, insn);
- }
- }
- }
- else if (GET_CODE (x) == CLOBBER)
- {
- if (GET_CODE (XEXP (x, 0)) == MEM)
- {
- canon_reg (XEXP (x, 0), NULL_RTX);
- note_mem_written (XEXP (x, 0), &writes_memory);
- }
- }
-
- /* Canonicalize a USE of a pseudo register or memory location. */
- else if (GET_CODE (x) == USE
- && ! (GET_CODE (XEXP (x, 0)) == REG
- && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER))
- canon_reg (XEXP (x, 0), NULL_RTX);
- else if (GET_CODE (x) == CALL)
- {
- /* The result of apply_change_group can be ignored; see canon_reg. */
- canon_reg (x, insn);
- apply_change_group ();
- fold_rtx (x, insn);
- }
-
- /* Store the equivalent value in SRC_EQV, if different, or if the DEST
- is a STRICT_LOW_PART. The latter condition is necessary because SRC_EQV
- is handled specially for this case, and if it isn't set, then there will
- be no equivalence for the destination. */
- if (n_sets == 1 && REG_NOTES (insn) != 0
- && (tem = find_reg_note (insn, REG_EQUAL, NULL_RTX)) != 0
- && (! rtx_equal_p (XEXP (tem, 0), SET_SRC (sets[0].rtl))
- || GET_CODE (SET_DEST (sets[0].rtl)) == STRICT_LOW_PART))
- src_eqv = canon_reg (XEXP (tem, 0), NULL_RTX);
-
- /* Canonicalize sources and addresses of destinations.
- We do this in a separate pass to avoid problems when a MATCH_DUP is
- present in the insn pattern. In that case, we want to ensure that
- we don't break the duplicate nature of the pattern. So we will replace
- both operands at the same time. Otherwise, we would fail to find an
- equivalent substitution in the loop calling validate_change below.
-
- We used to suppress canonicalization of DEST if it appears in SRC,
- but we don't do this any more. */
-
- for (i = 0; i < n_sets; i++)
- {
- rtx dest = SET_DEST (sets[i].rtl);
- rtx src = SET_SRC (sets[i].rtl);
- rtx new = canon_reg (src, insn);
-
- if ((GET_CODE (new) == REG && GET_CODE (src) == REG
- && ((REGNO (new) < FIRST_PSEUDO_REGISTER)
- != (REGNO (src) < FIRST_PSEUDO_REGISTER)))
- || insn_n_dups[recog_memoized (insn)] > 0)
- validate_change (insn, &SET_SRC (sets[i].rtl), new, 1);
- else
- SET_SRC (sets[i].rtl) = new;
-
- if (GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == SIGN_EXTRACT)
- {
- validate_change (insn, &XEXP (dest, 1),
- canon_reg (XEXP (dest, 1), insn), 1);
- validate_change (insn, &XEXP (dest, 2),
- canon_reg (XEXP (dest, 2), insn), 1);
- }
-
- while (GET_CODE (dest) == SUBREG || GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SIGN_EXTRACT)
- dest = XEXP (dest, 0);
-
- if (GET_CODE (dest) == MEM)
- canon_reg (dest, insn);
- }
-
- /* Now that we have done all the replacements, we can apply the change
- group and see if they all work. Note that this will cause some
- canonicalizations that would have worked individually not to be applied
- because some other canonicalization didn't work, but this should not
- occur often.
-
- The result of apply_change_group can be ignored; see canon_reg. */
-
- apply_change_group ();
-
- /* Set sets[i].src_elt to the class each source belongs to.
- Detect assignments from or to volatile things
- and set set[i] to zero so they will be ignored
- in the rest of this function.
-
- Nothing in this loop changes the hash table or the register chains. */
-
- for (i = 0; i < n_sets; i++)
- {
- register rtx src, dest;
- register rtx src_folded;
- register struct table_elt *elt = 0, *p;
- enum machine_mode mode;
- rtx src_eqv_here;
- rtx src_const = 0;
- rtx src_related = 0;
- struct table_elt *src_const_elt = 0;
- int src_cost = 10000, src_eqv_cost = 10000, src_folded_cost = 10000;
- int src_related_cost = 10000, src_elt_cost = 10000;
- /* Set non-zero if we need to call force_const_mem on with the
- contents of src_folded before using it. */
- int src_folded_force_flag = 0;
-
- dest = SET_DEST (sets[i].rtl);
- src = SET_SRC (sets[i].rtl);
-
- /* If SRC is a constant that has no machine mode,
- hash it with the destination's machine mode.
- This way we can keep different modes separate. */
-
- mode = GET_MODE (src) == VOIDmode ? GET_MODE (dest) : GET_MODE (src);
- sets[i].mode = mode;
-
- if (src_eqv)
- {
- enum machine_mode eqvmode = mode;
- if (GET_CODE (dest) == STRICT_LOW_PART)
- eqvmode = GET_MODE (SUBREG_REG (XEXP (dest, 0)));
- do_not_record = 0;
- hash_arg_in_memory = 0;
- hash_arg_in_struct = 0;
- src_eqv = fold_rtx (src_eqv, insn);
- src_eqv_hash = HASH (src_eqv, eqvmode);
-
- /* Find the equivalence class for the equivalent expression. */
-
- if (!do_not_record)
- src_eqv_elt = lookup (src_eqv, src_eqv_hash, eqvmode);
-
- src_eqv_volatile = do_not_record;
- src_eqv_in_memory = hash_arg_in_memory;
- src_eqv_in_struct = hash_arg_in_struct;
- }
-
- /* If this is a STRICT_LOW_PART assignment, src_eqv corresponds to the
- value of the INNER register, not the destination. So it is not
- a valid substitution for the source. But save it for later. */
- if (GET_CODE (dest) == STRICT_LOW_PART)
- src_eqv_here = 0;
- else
- src_eqv_here = src_eqv;
-
- /* Simplify and foldable subexpressions in SRC. Then get the fully-
- simplified result, which may not necessarily be valid. */
- src_folded = fold_rtx (src, insn);
-
-#if 0
- /* ??? This caused bad code to be generated for the m68k port with -O2.
- Suppose src is (CONST_INT -1), and that after truncation src_folded
- is (CONST_INT 3). Suppose src_folded is then used for src_const.
- At the end we will add src and src_const to the same equivalence
- class. We now have 3 and -1 on the same equivalence class. This
- causes later instructions to be mis-optimized. */
- /* If storing a constant in a bitfield, pre-truncate the constant
- so we will be able to record it later. */
- if (GET_CODE (SET_DEST (sets[i].rtl)) == ZERO_EXTRACT
- || GET_CODE (SET_DEST (sets[i].rtl)) == SIGN_EXTRACT)
- {
- rtx width = XEXP (SET_DEST (sets[i].rtl), 1);
-
- if (GET_CODE (src) == CONST_INT
- && GET_CODE (width) == CONST_INT
- && INTVAL (width) < HOST_BITS_PER_WIDE_INT
- && (INTVAL (src) & ((HOST_WIDE_INT) (-1) << INTVAL (width))))
- src_folded
- = GEN_INT (INTVAL (src) & (((HOST_WIDE_INT) 1
- << INTVAL (width)) - 1));
- }
-#endif
-
- /* Compute SRC's hash code, and also notice if it
- should not be recorded at all. In that case,
- prevent any further processing of this assignment. */
- do_not_record = 0;
- hash_arg_in_memory = 0;
- hash_arg_in_struct = 0;
-
- sets[i].src = src;
- sets[i].src_hash = HASH (src, mode);
- sets[i].src_volatile = do_not_record;
- sets[i].src_in_memory = hash_arg_in_memory;
- sets[i].src_in_struct = hash_arg_in_struct;
-
-#if 0
- /* It is no longer clear why we used to do this, but it doesn't
- appear to still be needed. So let's try without it since this
- code hurts cse'ing widened ops. */
- /* If source is a perverse subreg (such as QI treated as an SI),
- treat it as volatile. It may do the work of an SI in one context
- where the extra bits are not being used, but cannot replace an SI
- in general. */
- if (GET_CODE (src) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (src))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (src)))))
- sets[i].src_volatile = 1;
-#endif
-
- /* Locate all possible equivalent forms for SRC. Try to replace
- SRC in the insn with each cheaper equivalent.
-
- We have the following types of equivalents: SRC itself, a folded
- version, a value given in a REG_EQUAL note, or a value related
- to a constant.
-
- Each of these equivalents may be part of an additional class
- of equivalents (if more than one is in the table, they must be in
- the same class; we check for this).
-
- If the source is volatile, we don't do any table lookups.
-
- We note any constant equivalent for possible later use in a
- REG_NOTE. */
-
- if (!sets[i].src_volatile)
- elt = lookup (src, sets[i].src_hash, mode);
-
- sets[i].src_elt = elt;
-
- if (elt && src_eqv_here && src_eqv_elt)
- {
- if (elt->first_same_value != src_eqv_elt->first_same_value)
- {
- /* The REG_EQUAL is indicating that two formerly distinct
- classes are now equivalent. So merge them. */
- merge_equiv_classes (elt, src_eqv_elt);
- src_eqv_hash = HASH (src_eqv, elt->mode);
- src_eqv_elt = lookup (src_eqv, src_eqv_hash, elt->mode);
- }
-
- src_eqv_here = 0;
- }
-
- else if (src_eqv_elt)
- elt = src_eqv_elt;
-
- /* Try to find a constant somewhere and record it in `src_const'.
- Record its table element, if any, in `src_const_elt'. Look in
- any known equivalences first. (If the constant is not in the
- table, also set `sets[i].src_const_hash'). */
- if (elt)
- for (p = elt->first_same_value; p; p = p->next_same_value)
- if (p->is_const)
- {
- src_const = p->exp;
- src_const_elt = elt;
- break;
- }
-
- if (src_const == 0
- && (CONSTANT_P (src_folded)
- /* Consider (minus (label_ref L1) (label_ref L2)) as
- "constant" here so we will record it. This allows us
- to fold switch statements when an ADDR_DIFF_VEC is used. */
- || (GET_CODE (src_folded) == MINUS
- && GET_CODE (XEXP (src_folded, 0)) == LABEL_REF
- && GET_CODE (XEXP (src_folded, 1)) == LABEL_REF)))
- src_const = src_folded, src_const_elt = elt;
- else if (src_const == 0 && src_eqv_here && CONSTANT_P (src_eqv_here))
- src_const = src_eqv_here, src_const_elt = src_eqv_elt;
-
- /* If we don't know if the constant is in the table, get its
- hash code and look it up. */
- if (src_const && src_const_elt == 0)
- {
- sets[i].src_const_hash = HASH (src_const, mode);
- src_const_elt = lookup (src_const, sets[i].src_const_hash, mode);
- }
-
- sets[i].src_const = src_const;
- sets[i].src_const_elt = src_const_elt;
-
- /* If the constant and our source are both in the table, mark them as
- equivalent. Otherwise, if a constant is in the table but the source
- isn't, set ELT to it. */
- if (src_const_elt && elt
- && src_const_elt->first_same_value != elt->first_same_value)
- merge_equiv_classes (elt, src_const_elt);
- else if (src_const_elt && elt == 0)
- elt = src_const_elt;
-
- /* See if there is a register linearly related to a constant
- equivalent of SRC. */
- if (src_const
- && (GET_CODE (src_const) == CONST
- || (src_const_elt && src_const_elt->related_value != 0)))
- {
- src_related = use_related_value (src_const, src_const_elt);
- if (src_related)
- {
- struct table_elt *src_related_elt
- = lookup (src_related, HASH (src_related, mode), mode);
- if (src_related_elt && elt)
- {
- if (elt->first_same_value
- != src_related_elt->first_same_value)
- /* This can occur when we previously saw a CONST
- involving a SYMBOL_REF and then see the SYMBOL_REF
- twice. Merge the involved classes. */
- merge_equiv_classes (elt, src_related_elt);
-
- src_related = 0;
- src_related_elt = 0;
- }
- else if (src_related_elt && elt == 0)
- elt = src_related_elt;
- }
- }
-
- /* See if we have a CONST_INT that is already in a register in a
- wider mode. */
-
- if (src_const && src_related == 0 && GET_CODE (src_const) == CONST_INT
- && GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_BITSIZE (mode) < BITS_PER_WORD)
- {
- enum machine_mode wider_mode;
-
- for (wider_mode = GET_MODE_WIDER_MODE (mode);
- GET_MODE_BITSIZE (wider_mode) <= BITS_PER_WORD
- && src_related == 0;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- struct table_elt *const_elt
- = lookup (src_const, HASH (src_const, wider_mode), wider_mode);
-
- if (const_elt == 0)
- continue;
-
- for (const_elt = const_elt->first_same_value;
- const_elt; const_elt = const_elt->next_same_value)
- if (GET_CODE (const_elt->exp) == REG)
- {
- src_related = gen_lowpart_if_possible (mode,
- const_elt->exp);
- break;
- }
- }
- }
-
- /* Another possibility is that we have an AND with a constant in
- a mode narrower than a word. If so, it might have been generated
- as part of an "if" which would narrow the AND. If we already
- have done the AND in a wider mode, we can use a SUBREG of that
- value. */
-
- if (flag_expensive_optimizations && ! src_related
- && GET_CODE (src) == AND && GET_CODE (XEXP (src, 1)) == CONST_INT
- && GET_MODE_SIZE (mode) < UNITS_PER_WORD)
- {
- enum machine_mode tmode;
- rtx new_and = gen_rtx (AND, VOIDmode, NULL_RTX, XEXP (src, 1));
-
- for (tmode = GET_MODE_WIDER_MODE (mode);
- GET_MODE_SIZE (tmode) <= UNITS_PER_WORD;
- tmode = GET_MODE_WIDER_MODE (tmode))
- {
- rtx inner = gen_lowpart_if_possible (tmode, XEXP (src, 0));
- struct table_elt *larger_elt;
-
- if (inner)
- {
- PUT_MODE (new_and, tmode);
- XEXP (new_and, 0) = inner;
- larger_elt = lookup (new_and, HASH (new_and, tmode), tmode);
- if (larger_elt == 0)
- continue;
-
- for (larger_elt = larger_elt->first_same_value;
- larger_elt; larger_elt = larger_elt->next_same_value)
- if (GET_CODE (larger_elt->exp) == REG)
- {
- src_related
- = gen_lowpart_if_possible (mode, larger_elt->exp);
- break;
- }
-
- if (src_related)
- break;
- }
- }
- }
-
-#ifdef LOAD_EXTEND_OP
- /* See if a MEM has already been loaded with a widening operation;
- if it has, we can use a subreg of that. Many CISC machines
- also have such operations, but this is only likely to be
- beneficial these machines. */
-
- if (flag_expensive_optimizations && src_related == 0
- && (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
- && GET_MODE_CLASS (mode) == MODE_INT
- && GET_CODE (src) == MEM && ! do_not_record
- && LOAD_EXTEND_OP (mode) != NIL)
- {
- enum machine_mode tmode;
-
- /* Set what we are trying to extend and the operation it might
- have been extended with. */
- PUT_CODE (memory_extend_rtx, LOAD_EXTEND_OP (mode));
- XEXP (memory_extend_rtx, 0) = src;
-
- for (tmode = GET_MODE_WIDER_MODE (mode);
- GET_MODE_SIZE (tmode) <= UNITS_PER_WORD;
- tmode = GET_MODE_WIDER_MODE (tmode))
- {
- struct table_elt *larger_elt;
-
- PUT_MODE (memory_extend_rtx, tmode);
- larger_elt = lookup (memory_extend_rtx,
- HASH (memory_extend_rtx, tmode), tmode);
- if (larger_elt == 0)
- continue;
-
- for (larger_elt = larger_elt->first_same_value;
- larger_elt; larger_elt = larger_elt->next_same_value)
- if (GET_CODE (larger_elt->exp) == REG)
- {
- src_related = gen_lowpart_if_possible (mode,
- larger_elt->exp);
- break;
- }
-
- if (src_related)
- break;
- }
- }
-#endif /* LOAD_EXTEND_OP */
-
- if (src == src_folded)
- src_folded = 0;
-
- /* At this point, ELT, if non-zero, points to a class of expressions
- equivalent to the source of this SET and SRC, SRC_EQV, SRC_FOLDED,
- and SRC_RELATED, if non-zero, each contain additional equivalent
- expressions. Prune these latter expressions by deleting expressions
- already in the equivalence class.
-
- Check for an equivalent identical to the destination. If found,
- this is the preferred equivalent since it will likely lead to
- elimination of the insn. Indicate this by placing it in
- `src_related'. */
-
- if (elt) elt = elt->first_same_value;
- for (p = elt; p; p = p->next_same_value)
- {
- enum rtx_code code = GET_CODE (p->exp);
-
- /* If the expression is not valid, ignore it. Then we do not
- have to check for validity below. In most cases, we can use
- `rtx_equal_p', since canonicalization has already been done. */
- if (code != REG && ! exp_equiv_p (p->exp, p->exp, 1, 0))
- continue;
-
- if (src && GET_CODE (src) == code && rtx_equal_p (src, p->exp))
- src = 0;
- else if (src_folded && GET_CODE (src_folded) == code
- && rtx_equal_p (src_folded, p->exp))
- src_folded = 0;
- else if (src_eqv_here && GET_CODE (src_eqv_here) == code
- && rtx_equal_p (src_eqv_here, p->exp))
- src_eqv_here = 0;
- else if (src_related && GET_CODE (src_related) == code
- && rtx_equal_p (src_related, p->exp))
- src_related = 0;
-
- /* This is the same as the destination of the insns, we want
- to prefer it. Copy it to src_related. The code below will
- then give it a negative cost. */
- if (GET_CODE (dest) == code && rtx_equal_p (p->exp, dest))
- src_related = dest;
-
- }
-
- /* Find the cheapest valid equivalent, trying all the available
- possibilities. Prefer items not in the hash table to ones
- that are when they are equal cost. Note that we can never
- worsen an insn as the current contents will also succeed.
- If we find an equivalent identical to the destination, use it as best,
- since this insn will probably be eliminated in that case. */
- if (src)
- {
- if (rtx_equal_p (src, dest))
- src_cost = -1;
- else
- src_cost = COST (src);
- }
-
- if (src_eqv_here)
- {
- if (rtx_equal_p (src_eqv_here, dest))
- src_eqv_cost = -1;
- else
- src_eqv_cost = COST (src_eqv_here);
- }
-
- if (src_folded)
- {
- if (rtx_equal_p (src_folded, dest))
- src_folded_cost = -1;
- else
- src_folded_cost = COST (src_folded);
- }
-
- if (src_related)
- {
- if (rtx_equal_p (src_related, dest))
- src_related_cost = -1;
- else
- src_related_cost = COST (src_related);
- }
-
- /* If this was an indirect jump insn, a known label will really be
- cheaper even though it looks more expensive. */
- if (dest == pc_rtx && src_const && GET_CODE (src_const) == LABEL_REF)
- src_folded = src_const, src_folded_cost = -1;
-
- /* Terminate loop when replacement made. This must terminate since
- the current contents will be tested and will always be valid. */
- while (1)
- {
- rtx trial;
-
- /* Skip invalid entries. */
- while (elt && GET_CODE (elt->exp) != REG
- && ! exp_equiv_p (elt->exp, elt->exp, 1, 0))
- elt = elt->next_same_value;
-
- if (elt) src_elt_cost = elt->cost;
-
- /* Find cheapest and skip it for the next time. For items
- of equal cost, use this order:
- src_folded, src, src_eqv, src_related and hash table entry. */
- if (src_folded_cost <= src_cost
- && src_folded_cost <= src_eqv_cost
- && src_folded_cost <= src_related_cost
- && src_folded_cost <= src_elt_cost)
- {
- trial = src_folded, src_folded_cost = 10000;
- if (src_folded_force_flag)
- trial = force_const_mem (mode, trial);
- }
- else if (src_cost <= src_eqv_cost
- && src_cost <= src_related_cost
- && src_cost <= src_elt_cost)
- trial = src, src_cost = 10000;
- else if (src_eqv_cost <= src_related_cost
- && src_eqv_cost <= src_elt_cost)
- trial = copy_rtx (src_eqv_here), src_eqv_cost = 10000;
- else if (src_related_cost <= src_elt_cost)
- trial = copy_rtx (src_related), src_related_cost = 10000;
- else
- {
- trial = copy_rtx (elt->exp);
- elt = elt->next_same_value;
- src_elt_cost = 10000;
- }
-
- /* We don't normally have an insn matching (set (pc) (pc)), so
- check for this separately here. We will delete such an
- insn below.
-
- Tablejump insns contain a USE of the table, so simply replacing
- the operand with the constant won't match. This is simply an
- unconditional branch, however, and is therefore valid. Just
- insert the substitution here and we will delete and re-emit
- the insn later. */
-
- if (n_sets == 1 && dest == pc_rtx
- && (trial == pc_rtx
- || (GET_CODE (trial) == LABEL_REF
- && ! condjump_p (insn))))
- {
- /* If TRIAL is a label in front of a jump table, we are
- really falling through the switch (this is how casesi
- insns work), so we must branch around the table. */
- if (GET_CODE (trial) == CODE_LABEL
- && NEXT_INSN (trial) != 0
- && GET_CODE (NEXT_INSN (trial)) == JUMP_INSN
- && (GET_CODE (PATTERN (NEXT_INSN (trial))) == ADDR_DIFF_VEC
- || GET_CODE (PATTERN (NEXT_INSN (trial))) == ADDR_VEC))
-
- trial = gen_rtx (LABEL_REF, Pmode, get_label_after (trial));
-
- SET_SRC (sets[i].rtl) = trial;
- cse_jumps_altered = 1;
- break;
- }
-
- /* Look for a substitution that makes a valid insn. */
- else if (validate_change (insn, &SET_SRC (sets[i].rtl), trial, 0))
- {
- /* The result of apply_change_group can be ignored; see
- canon_reg. */
-
- validate_change (insn, &SET_SRC (sets[i].rtl),
- canon_reg (SET_SRC (sets[i].rtl), insn),
- 1);
- apply_change_group ();
- break;
- }
-
- /* If we previously found constant pool entries for
- constants and this is a constant, try making a
- pool entry. Put it in src_folded unless we already have done
- this since that is where it likely came from. */
-
- else if (constant_pool_entries_cost
- && CONSTANT_P (trial)
- && ! (GET_CODE (trial) == CONST
- && GET_CODE (XEXP (trial, 0)) == TRUNCATE)
- && (src_folded == 0
- || (GET_CODE (src_folded) != MEM
- && ! src_folded_force_flag))
- && GET_MODE_CLASS (mode) != MODE_CC)
- {
- src_folded_force_flag = 1;
- src_folded = trial;
- src_folded_cost = constant_pool_entries_cost;
- }
- }
-
- src = SET_SRC (sets[i].rtl);
-
- /* In general, it is good to have a SET with SET_SRC == SET_DEST.
- However, there is an important exception: If both are registers
- that are not the head of their equivalence class, replace SET_SRC
- with the head of the class. If we do not do this, we will have
- both registers live over a portion of the basic block. This way,
- their lifetimes will likely abut instead of overlapping. */
- if (GET_CODE (dest) == REG
- && REGNO_QTY_VALID_P (REGNO (dest))
- && qty_mode[reg_qty[REGNO (dest)]] == GET_MODE (dest)
- && qty_first_reg[reg_qty[REGNO (dest)]] != REGNO (dest)
- && GET_CODE (src) == REG && REGNO (src) == REGNO (dest)
- /* Don't do this if the original insn had a hard reg as
- SET_SRC. */
- && (GET_CODE (sets[i].src) != REG
- || REGNO (sets[i].src) >= FIRST_PSEUDO_REGISTER))
- /* We can't call canon_reg here because it won't do anything if
- SRC is a hard register. */
- {
- int first = qty_first_reg[reg_qty[REGNO (src)]];
-
- src = SET_SRC (sets[i].rtl)
- = first >= FIRST_PSEUDO_REGISTER ? regno_reg_rtx[first]
- : gen_rtx (REG, GET_MODE (src), first);
-
- /* If we had a constant that is cheaper than what we are now
- setting SRC to, use that constant. We ignored it when we
- thought we could make this into a no-op. */
- if (src_const && COST (src_const) < COST (src)
- && validate_change (insn, &SET_SRC (sets[i].rtl), src_const, 0))
- src = src_const;
- }
-
- /* If we made a change, recompute SRC values. */
- if (src != sets[i].src)
- {
- do_not_record = 0;
- hash_arg_in_memory = 0;
- hash_arg_in_struct = 0;
- sets[i].src = src;
- sets[i].src_hash = HASH (src, mode);
- sets[i].src_volatile = do_not_record;
- sets[i].src_in_memory = hash_arg_in_memory;
- sets[i].src_in_struct = hash_arg_in_struct;
- sets[i].src_elt = lookup (src, sets[i].src_hash, mode);
- }
-
- /* If this is a single SET, we are setting a register, and we have an
- equivalent constant, we want to add a REG_NOTE. We don't want
- to write a REG_EQUAL note for a constant pseudo since verifying that
- that pseudo hasn't been eliminated is a pain. Such a note also
- won't help anything. */
- if (n_sets == 1 && src_const && GET_CODE (dest) == REG
- && GET_CODE (src_const) != REG)
- {
- tem = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
- /* Record the actual constant value in a REG_EQUAL note, making
- a new one if one does not already exist. */
- if (tem)
- XEXP (tem, 0) = src_const;
- else
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
- src_const, REG_NOTES (insn));
-
- /* If storing a constant value in a register that
- previously held the constant value 0,
- record this fact with a REG_WAS_0 note on this insn.
-
- Note that the *register* is required to have previously held 0,
- not just any register in the quantity and we must point to the
- insn that set that register to zero.
-
- Rather than track each register individually, we just see if
- the last set for this quantity was for this register. */
-
- if (REGNO_QTY_VALID_P (REGNO (dest))
- && qty_const[reg_qty[REGNO (dest)]] == const0_rtx)
- {
- /* See if we previously had a REG_WAS_0 note. */
- rtx note = find_reg_note (insn, REG_WAS_0, NULL_RTX);
- rtx const_insn = qty_const_insn[reg_qty[REGNO (dest)]];
-
- if ((tem = single_set (const_insn)) != 0
- && rtx_equal_p (SET_DEST (tem), dest))
- {
- if (note)
- XEXP (note, 0) = const_insn;
- else
- REG_NOTES (insn) = gen_rtx (INSN_LIST, REG_WAS_0,
- const_insn, REG_NOTES (insn));
- }
- }
- }
-
- /* Now deal with the destination. */
- do_not_record = 0;
- sets[i].inner_dest_loc = &SET_DEST (sets[0].rtl);
-
- /* Look within any SIGN_EXTRACT or ZERO_EXTRACT
- to the MEM or REG within it. */
- while (GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == STRICT_LOW_PART)
- {
- sets[i].inner_dest_loc = &XEXP (dest, 0);
- dest = XEXP (dest, 0);
- }
-
- sets[i].inner_dest = dest;
-
- if (GET_CODE (dest) == MEM)
- {
- dest = fold_rtx (dest, insn);
-
- /* Decide whether we invalidate everything in memory,
- or just things at non-fixed places.
- Writing a large aggregate must invalidate everything
- because we don't know how long it is. */
- note_mem_written (dest, &writes_memory);
- }
-
- /* Compute the hash code of the destination now,
- before the effects of this instruction are recorded,
- since the register values used in the address computation
- are those before this instruction. */
- sets[i].dest_hash = HASH (dest, mode);
-
- /* Don't enter a bit-field in the hash table
- because the value in it after the store
- may not equal what was stored, due to truncation. */
-
- if (GET_CODE (SET_DEST (sets[i].rtl)) == ZERO_EXTRACT
- || GET_CODE (SET_DEST (sets[i].rtl)) == SIGN_EXTRACT)
- {
- rtx width = XEXP (SET_DEST (sets[i].rtl), 1);
-
- if (src_const != 0 && GET_CODE (src_const) == CONST_INT
- && GET_CODE (width) == CONST_INT
- && INTVAL (width) < HOST_BITS_PER_WIDE_INT
- && ! (INTVAL (src_const)
- & ((HOST_WIDE_INT) (-1) << INTVAL (width))))
- /* Exception: if the value is constant,
- and it won't be truncated, record it. */
- ;
- else
- {
- /* This is chosen so that the destination will be invalidated
- but no new value will be recorded.
- We must invalidate because sometimes constant
- values can be recorded for bitfields. */
- sets[i].src_elt = 0;
- sets[i].src_volatile = 1;
- src_eqv = 0;
- src_eqv_elt = 0;
- }
- }
-
- /* If only one set in a JUMP_INSN and it is now a no-op, we can delete
- the insn. */
- else if (n_sets == 1 && dest == pc_rtx && src == pc_rtx)
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- cse_jumps_altered = 1;
- /* One less use of the label this insn used to jump to. */
- --LABEL_NUSES (JUMP_LABEL (insn));
- /* No more processing for this set. */
- sets[i].rtl = 0;
- }
-
- /* If this SET is now setting PC to a label, we know it used to
- be a conditional or computed branch. So we see if we can follow
- it. If it was a computed branch, delete it and re-emit. */
- else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF)
- {
- rtx p;
-
- /* If this is not in the format for a simple branch and
- we are the only SET in it, re-emit it. */
- if (! simplejump_p (insn) && n_sets == 1)
- {
- rtx new = emit_jump_insn_before (gen_jump (XEXP (src, 0)), insn);
- JUMP_LABEL (new) = XEXP (src, 0);
- LABEL_NUSES (XEXP (src, 0))++;
- delete_insn (insn);
- insn = new;
- }
- else
- /* Otherwise, force rerecognition, since it probably had
- a different pattern before.
- This shouldn't really be necessary, since whatever
- changed the source value above should have done this.
- Until the right place is found, might as well do this here. */
- INSN_CODE (insn) = -1;
-
- /* Now that we've converted this jump to an unconditional jump,
- there is dead code after it. Delete the dead code until we
- reach a BARRIER, the end of the function, or a label. Do
- not delete NOTEs except for NOTE_INSN_DELETED since later
- phases assume these notes are retained. */
-
- p = insn;
-
- while (NEXT_INSN (p) != 0
- && GET_CODE (NEXT_INSN (p)) != BARRIER
- && GET_CODE (NEXT_INSN (p)) != CODE_LABEL)
- {
- if (GET_CODE (NEXT_INSN (p)) != NOTE
- || NOTE_LINE_NUMBER (NEXT_INSN (p)) == NOTE_INSN_DELETED)
- delete_insn (NEXT_INSN (p));
- else
- p = NEXT_INSN (p);
- }
-
- /* If we don't have a BARRIER immediately after INSN, put one there.
- Much code assumes that there are no NOTEs between a JUMP_INSN and
- BARRIER. */
-
- if (NEXT_INSN (insn) == 0
- || GET_CODE (NEXT_INSN (insn)) != BARRIER)
- emit_barrier_before (NEXT_INSN (insn));
-
- /* We might have two BARRIERs separated by notes. Delete the second
- one if so. */
-
- if (p != insn && NEXT_INSN (p) != 0
- && GET_CODE (NEXT_INSN (p)) == BARRIER)
- delete_insn (NEXT_INSN (p));
-
- cse_jumps_altered = 1;
- sets[i].rtl = 0;
- }
-
- /* If destination is volatile, invalidate it and then do no further
- processing for this assignment. */
-
- else if (do_not_record)
- {
- if (GET_CODE (dest) == REG || GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == MEM)
- invalidate (dest, VOIDmode);
- else if (GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == ZERO_EXTRACT)
- invalidate (XEXP (dest, 0), GET_MODE (dest));
- sets[i].rtl = 0;
- }
-
- if (sets[i].rtl != 0 && dest != SET_DEST (sets[i].rtl))
- sets[i].dest_hash = HASH (SET_DEST (sets[i].rtl), mode);
-
-#ifdef HAVE_cc0
- /* If setting CC0, record what it was set to, or a constant, if it
- is equivalent to a constant. If it is being set to a floating-point
- value, make a COMPARE with the appropriate constant of 0. If we
- don't do this, later code can interpret this as a test against
- const0_rtx, which can cause problems if we try to put it into an
- insn as a floating-point operand. */
- if (dest == cc0_rtx)
- {
- this_insn_cc0 = src_const && mode != VOIDmode ? src_const : src;
- this_insn_cc0_mode = mode;
- if (FLOAT_MODE_P (mode))
- this_insn_cc0 = gen_rtx (COMPARE, VOIDmode, this_insn_cc0,
- CONST0_RTX (mode));
- }
-#endif
- }
-
- /* Now enter all non-volatile source expressions in the hash table
- if they are not already present.
- Record their equivalence classes in src_elt.
- This way we can insert the corresponding destinations into
- the same classes even if the actual sources are no longer in them
- (having been invalidated). */
-
- if (src_eqv && src_eqv_elt == 0 && sets[0].rtl != 0 && ! src_eqv_volatile
- && ! rtx_equal_p (src_eqv, SET_DEST (sets[0].rtl)))
- {
- register struct table_elt *elt;
- register struct table_elt *classp = sets[0].src_elt;
- rtx dest = SET_DEST (sets[0].rtl);
- enum machine_mode eqvmode = GET_MODE (dest);
-
- if (GET_CODE (dest) == STRICT_LOW_PART)
- {
- eqvmode = GET_MODE (SUBREG_REG (XEXP (dest, 0)));
- classp = 0;
- }
- if (insert_regs (src_eqv, classp, 0))
- {
- rehash_using_reg (src_eqv);
- src_eqv_hash = HASH (src_eqv, eqvmode);
- }
- elt = insert (src_eqv, classp, src_eqv_hash, eqvmode);
- elt->in_memory = src_eqv_in_memory;
- elt->in_struct = src_eqv_in_struct;
- src_eqv_elt = elt;
-
- /* Check to see if src_eqv_elt is the same as a set source which
- does not yet have an elt, and if so set the elt of the set source
- to src_eqv_elt. */
- for (i = 0; i < n_sets; i++)
- if (sets[i].rtl && sets[i].src_elt == 0
- && rtx_equal_p (SET_SRC (sets[i].rtl), src_eqv))
- sets[i].src_elt = src_eqv_elt;
- }
-
- for (i = 0; i < n_sets; i++)
- if (sets[i].rtl && ! sets[i].src_volatile
- && ! rtx_equal_p (SET_SRC (sets[i].rtl), SET_DEST (sets[i].rtl)))
- {
- if (GET_CODE (SET_DEST (sets[i].rtl)) == STRICT_LOW_PART)
- {
- /* REG_EQUAL in setting a STRICT_LOW_PART
- gives an equivalent for the entire destination register,
- not just for the subreg being stored in now.
- This is a more interesting equivalence, so we arrange later
- to treat the entire reg as the destination. */
- sets[i].src_elt = src_eqv_elt;
- sets[i].src_hash = src_eqv_hash;
- }
- else
- {
- /* Insert source and constant equivalent into hash table, if not
- already present. */
- register struct table_elt *classp = src_eqv_elt;
- register rtx src = sets[i].src;
- register rtx dest = SET_DEST (sets[i].rtl);
- enum machine_mode mode
- = GET_MODE (src) == VOIDmode ? GET_MODE (dest) : GET_MODE (src);
-
- if (sets[i].src_elt == 0)
- {
- register struct table_elt *elt;
-
- /* Note that these insert_regs calls cannot remove
- any of the src_elt's, because they would have failed to
- match if not still valid. */
- if (insert_regs (src, classp, 0))
- {
- rehash_using_reg (src);
- sets[i].src_hash = HASH (src, mode);
- }
- elt = insert (src, classp, sets[i].src_hash, mode);
- elt->in_memory = sets[i].src_in_memory;
- elt->in_struct = sets[i].src_in_struct;
- sets[i].src_elt = classp = elt;
- }
-
- if (sets[i].src_const && sets[i].src_const_elt == 0
- && src != sets[i].src_const
- && ! rtx_equal_p (sets[i].src_const, src))
- sets[i].src_elt = insert (sets[i].src_const, classp,
- sets[i].src_const_hash, mode);
- }
- }
- else if (sets[i].src_elt == 0)
- /* If we did not insert the source into the hash table (e.g., it was
- volatile), note the equivalence class for the REG_EQUAL value, if any,
- so that the destination goes into that class. */
- sets[i].src_elt = src_eqv_elt;
-
- invalidate_from_clobbers (&writes_memory, x);
-
- /* Some registers are invalidated by subroutine calls. Memory is
- invalidated by non-constant calls. */
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- static struct write_data everything = {0, 1, 1, 1};
-
- if (! CONST_CALL_P (insn))
- invalidate_memory (&everything);
- invalidate_for_call ();
- }
-
- /* Now invalidate everything set by this instruction.
- If a SUBREG or other funny destination is being set,
- sets[i].rtl is still nonzero, so here we invalidate the reg
- a part of which is being set. */
-
- for (i = 0; i < n_sets; i++)
- if (sets[i].rtl)
- {
- /* We can't use the inner dest, because the mode associated with
- a ZERO_EXTRACT is significant. */
- register rtx dest = SET_DEST (sets[i].rtl);
-
- /* Needed for registers to remove the register from its
- previous quantity's chain.
- Needed for memory if this is a nonvarying address, unless
- we have just done an invalidate_memory that covers even those. */
- if (GET_CODE (dest) == REG || GET_CODE (dest) == SUBREG
- || (GET_CODE (dest) == MEM && ! writes_memory.all
- && ! cse_rtx_addr_varies_p (dest)))
- invalidate (dest, VOIDmode);
- else if (GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == ZERO_EXTRACT)
- invalidate (XEXP (dest, 0), GET_MODE (dest));
- }
-
- /* Make sure registers mentioned in destinations
- are safe for use in an expression to be inserted.
- This removes from the hash table
- any invalid entry that refers to one of these registers.
-
- We don't care about the return value from mention_regs because
- we are going to hash the SET_DEST values unconditionally. */
-
- for (i = 0; i < n_sets; i++)
- if (sets[i].rtl && GET_CODE (SET_DEST (sets[i].rtl)) != REG)
- mention_regs (SET_DEST (sets[i].rtl));
-
- /* We may have just removed some of the src_elt's from the hash table.
- So replace each one with the current head of the same class. */
-
- for (i = 0; i < n_sets; i++)
- if (sets[i].rtl)
- {
- if (sets[i].src_elt && sets[i].src_elt->first_same_value == 0)
- /* If elt was removed, find current head of same class,
- or 0 if nothing remains of that class. */
- {
- register struct table_elt *elt = sets[i].src_elt;
-
- while (elt && elt->prev_same_value)
- elt = elt->prev_same_value;
-
- while (elt && elt->first_same_value == 0)
- elt = elt->next_same_value;
- sets[i].src_elt = elt ? elt->first_same_value : 0;
- }
- }
-
- /* Now insert the destinations into their equivalence classes. */
-
- for (i = 0; i < n_sets; i++)
- if (sets[i].rtl)
- {
- register rtx dest = SET_DEST (sets[i].rtl);
- register struct table_elt *elt;
-
- /* Don't record value if we are not supposed to risk allocating
- floating-point values in registers that might be wider than
- memory. */
- if ((flag_float_store
- && GET_CODE (dest) == MEM
- && FLOAT_MODE_P (GET_MODE (dest)))
- /* Don't record values of destinations set inside a libcall block
- since we might delete the libcall. Things should have been set
- up so we won't want to reuse such a value, but we play it safe
- here. */
- || in_libcall_block
- /* If we didn't put a REG_EQUAL value or a source into the hash
- table, there is no point is recording DEST. */
- || sets[i].src_elt == 0
- /* If DEST is a paradoxical SUBREG and SRC is a ZERO_EXTEND
- or SIGN_EXTEND, don't record DEST since it can cause
- some tracking to be wrong.
-
- ??? Think about this more later. */
- || (GET_CODE (dest) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (dest))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))))
- && (GET_CODE (sets[i].src) == SIGN_EXTEND
- || GET_CODE (sets[i].src) == ZERO_EXTEND)))
- continue;
-
- /* STRICT_LOW_PART isn't part of the value BEING set,
- and neither is the SUBREG inside it.
- Note that in this case SETS[I].SRC_ELT is really SRC_EQV_ELT. */
- if (GET_CODE (dest) == STRICT_LOW_PART)
- dest = SUBREG_REG (XEXP (dest, 0));
-
- if (GET_CODE (dest) == REG || GET_CODE (dest) == SUBREG)
- /* Registers must also be inserted into chains for quantities. */
- if (insert_regs (dest, sets[i].src_elt, 1))
- {
- /* If `insert_regs' changes something, the hash code must be
- recalculated. */
- rehash_using_reg (dest);
- sets[i].dest_hash = HASH (dest, GET_MODE (dest));
- }
-
- elt = insert (dest, sets[i].src_elt,
- sets[i].dest_hash, GET_MODE (dest));
- elt->in_memory = (GET_CODE (sets[i].inner_dest) == MEM
- && (! RTX_UNCHANGING_P (sets[i].inner_dest)
- || FIXED_BASE_PLUS_P (XEXP (sets[i].inner_dest,
- 0))));
-
- if (elt->in_memory)
- {
- /* This implicitly assumes a whole struct
- need not have MEM_IN_STRUCT_P.
- But a whole struct is *supposed* to have MEM_IN_STRUCT_P. */
- elt->in_struct = (MEM_IN_STRUCT_P (sets[i].inner_dest)
- || sets[i].inner_dest != SET_DEST (sets[i].rtl));
- }
-
- /* If we have (set (subreg:m1 (reg:m2 foo) 0) (bar:m1)), M1 is no
- narrower than M2, and both M1 and M2 are the same number of words,
- we are also doing (set (reg:m2 foo) (subreg:m2 (bar:m1) 0)) so
- make that equivalence as well.
-
- However, BAR may have equivalences for which gen_lowpart_if_possible
- will produce a simpler value than gen_lowpart_if_possible applied to
- BAR (e.g., if BAR was ZERO_EXTENDed from M2), so we will scan all
- BAR's equivalences. If we don't get a simplified form, make
- the SUBREG. It will not be used in an equivalence, but will
- cause two similar assignments to be detected.
-
- Note the loop below will find SUBREG_REG (DEST) since we have
- already entered SRC and DEST of the SET in the table. */
-
- if (GET_CODE (dest) == SUBREG
- && (((GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))) - 1)
- / UNITS_PER_WORD)
- == (GET_MODE_SIZE (GET_MODE (dest)) - 1)/ UNITS_PER_WORD)
- && (GET_MODE_SIZE (GET_MODE (dest))
- >= GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))))
- && sets[i].src_elt != 0)
- {
- enum machine_mode new_mode = GET_MODE (SUBREG_REG (dest));
- struct table_elt *elt, *classp = 0;
-
- for (elt = sets[i].src_elt->first_same_value; elt;
- elt = elt->next_same_value)
- {
- rtx new_src = 0;
- unsigned src_hash;
- struct table_elt *src_elt;
-
- /* Ignore invalid entries. */
- if (GET_CODE (elt->exp) != REG
- && ! exp_equiv_p (elt->exp, elt->exp, 1, 0))
- continue;
-
- new_src = gen_lowpart_if_possible (new_mode, elt->exp);
- if (new_src == 0)
- new_src = gen_rtx (SUBREG, new_mode, elt->exp, 0);
-
- src_hash = HASH (new_src, new_mode);
- src_elt = lookup (new_src, src_hash, new_mode);
-
- /* Put the new source in the hash table is if isn't
- already. */
- if (src_elt == 0)
- {
- if (insert_regs (new_src, classp, 0))
- {
- rehash_using_reg (new_src);
- src_hash = HASH (new_src, new_mode);
- }
- src_elt = insert (new_src, classp, src_hash, new_mode);
- src_elt->in_memory = elt->in_memory;
- src_elt->in_struct = elt->in_struct;
- }
- else if (classp && classp != src_elt->first_same_value)
- /* Show that two things that we've seen before are
- actually the same. */
- merge_equiv_classes (src_elt, classp);
-
- classp = src_elt->first_same_value;
- }
- }
- }
-
- /* Special handling for (set REG0 REG1)
- where REG0 is the "cheapest", cheaper than REG1.
- After cse, REG1 will probably not be used in the sequel,
- so (if easily done) change this insn to (set REG1 REG0) and
- replace REG1 with REG0 in the previous insn that computed their value.
- Then REG1 will become a dead store and won't cloud the situation
- for later optimizations.
-
- Do not make this change if REG1 is a hard register, because it will
- then be used in the sequel and we may be changing a two-operand insn
- into a three-operand insn.
-
- Also do not do this if we are operating on a copy of INSN. */
-
- if (n_sets == 1 && sets[0].rtl && GET_CODE (SET_DEST (sets[0].rtl)) == REG
- && NEXT_INSN (PREV_INSN (insn)) == insn
- && GET_CODE (SET_SRC (sets[0].rtl)) == REG
- && REGNO (SET_SRC (sets[0].rtl)) >= FIRST_PSEUDO_REGISTER
- && REGNO_QTY_VALID_P (REGNO (SET_SRC (sets[0].rtl)))
- && (qty_first_reg[reg_qty[REGNO (SET_SRC (sets[0].rtl))]]
- == REGNO (SET_DEST (sets[0].rtl))))
- {
- rtx prev = PREV_INSN (insn);
- while (prev && GET_CODE (prev) == NOTE)
- prev = PREV_INSN (prev);
-
- if (prev && GET_CODE (prev) == INSN && GET_CODE (PATTERN (prev)) == SET
- && SET_DEST (PATTERN (prev)) == SET_SRC (sets[0].rtl))
- {
- rtx dest = SET_DEST (sets[0].rtl);
- rtx note = find_reg_note (prev, REG_EQUIV, NULL_RTX);
-
- validate_change (prev, & SET_DEST (PATTERN (prev)), dest, 1);
- validate_change (insn, & SET_DEST (sets[0].rtl),
- SET_SRC (sets[0].rtl), 1);
- validate_change (insn, & SET_SRC (sets[0].rtl), dest, 1);
- apply_change_group ();
-
- /* If REG1 was equivalent to a constant, REG0 is not. */
- if (note)
- PUT_REG_NOTE_KIND (note, REG_EQUAL);
-
- /* If there was a REG_WAS_0 note on PREV, remove it. Move
- any REG_WAS_0 note on INSN to PREV. */
- note = find_reg_note (prev, REG_WAS_0, NULL_RTX);
- if (note)
- remove_note (prev, note);
-
- note = find_reg_note (insn, REG_WAS_0, NULL_RTX);
- if (note)
- {
- remove_note (insn, note);
- XEXP (note, 1) = REG_NOTES (prev);
- REG_NOTES (prev) = note;
- }
-
- /* If INSN has a REG_EQUAL note, and this note mentions REG0,
- then we must delete it, because the value in REG0 has changed. */
- note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
- if (note && reg_mentioned_p (dest, XEXP (note, 0)))
- remove_note (insn, note);
- }
- }
-
- /* If this is a conditional jump insn, record any known equivalences due to
- the condition being tested. */
-
- last_jump_equiv_class = 0;
- if (GET_CODE (insn) == JUMP_INSN
- && n_sets == 1 && GET_CODE (x) == SET
- && GET_CODE (SET_SRC (x)) == IF_THEN_ELSE)
- record_jump_equiv (insn, 0);
-
-#ifdef HAVE_cc0
- /* If the previous insn set CC0 and this insn no longer references CC0,
- delete the previous insn. Here we use the fact that nothing expects CC0
- to be valid over an insn, which is true until the final pass. */
- if (prev_insn && GET_CODE (prev_insn) == INSN
- && (tem = single_set (prev_insn)) != 0
- && SET_DEST (tem) == cc0_rtx
- && ! reg_mentioned_p (cc0_rtx, x))
- {
- PUT_CODE (prev_insn, NOTE);
- NOTE_LINE_NUMBER (prev_insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (prev_insn) = 0;
- }
-
- prev_insn_cc0 = this_insn_cc0;
- prev_insn_cc0_mode = this_insn_cc0_mode;
-#endif
-
- prev_insn = insn;
-}
-
-/* Store 1 in *WRITES_PTR for those categories of memory ref
- that must be invalidated when the expression WRITTEN is stored in.
- If WRITTEN is null, say everything must be invalidated. */
-
-static void
-note_mem_written (written, writes_ptr)
- rtx written;
- struct write_data *writes_ptr;
-{
- static struct write_data everything = {0, 1, 1, 1};
-
- if (written == 0)
- *writes_ptr = everything;
- else if (GET_CODE (written) == MEM)
- {
- /* Pushing or popping the stack invalidates just the stack pointer. */
- rtx addr = XEXP (written, 0);
- if ((GET_CODE (addr) == PRE_DEC || GET_CODE (addr) == PRE_INC
- || GET_CODE (addr) == POST_DEC || GET_CODE (addr) == POST_INC)
- && GET_CODE (XEXP (addr, 0)) == REG
- && REGNO (XEXP (addr, 0)) == STACK_POINTER_REGNUM)
- {
- writes_ptr->sp = 1;
- return;
- }
- else if (GET_MODE (written) == BLKmode)
- *writes_ptr = everything;
- else if (cse_rtx_addr_varies_p (written))
- {
- /* A varying address that is a sum indicates an array element,
- and that's just as good as a structure element
- in implying that we need not invalidate scalar variables.
- However, we must allow QImode aliasing of scalars, because the
- ANSI C standard allows character pointers to alias anything.
- We must also allow AND addresses, because they may generate
- accesses outside the object being referenced. This is used to
- generate aligned addresses from unaligned addresses, for instance,
- the alpha storeqi_unaligned pattern. */
- if (! ((MEM_IN_STRUCT_P (written)
- || GET_CODE (XEXP (written, 0)) == PLUS)
- && GET_MODE (written) != QImode
- && GET_CODE (XEXP (written, 0)) != AND))
- writes_ptr->all = 1;
- writes_ptr->nonscalar = 1;
- }
- writes_ptr->var = 1;
- }
-}
-
-/* Perform invalidation on the basis of everything about an insn
- except for invalidating the actual places that are SET in it.
- This includes the places CLOBBERed, and anything that might
- alias with something that is SET or CLOBBERed.
-
- W points to the writes_memory for this insn, a struct write_data
- saying which kinds of memory references must be invalidated.
- X is the pattern of the insn. */
-
-static void
-invalidate_from_clobbers (w, x)
- struct write_data *w;
- rtx x;
-{
- /* If W->var is not set, W specifies no action.
- If W->all is set, this step gets all memory refs
- so they can be ignored in the rest of this function. */
- if (w->var)
- invalidate_memory (w);
-
- if (w->sp)
- {
- if (reg_tick[STACK_POINTER_REGNUM] >= 0)
- reg_tick[STACK_POINTER_REGNUM]++;
-
- /* This should be *very* rare. */
- if (TEST_HARD_REG_BIT (hard_regs_in_table, STACK_POINTER_REGNUM))
- invalidate (stack_pointer_rtx, VOIDmode);
- }
-
- if (GET_CODE (x) == CLOBBER)
- {
- rtx ref = XEXP (x, 0);
-
- if (GET_CODE (ref) == REG || GET_CODE (ref) == SUBREG
- || (GET_CODE (ref) == MEM && ! w->all))
- invalidate (ref, VOIDmode);
- else if (GET_CODE (ref) == STRICT_LOW_PART
- || GET_CODE (ref) == ZERO_EXTRACT)
- invalidate (XEXP (ref, 0), GET_MODE (ref));
- }
- else if (GET_CODE (x) == PARALLEL)
- {
- register int i;
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- {
- register rtx y = XVECEXP (x, 0, i);
- if (GET_CODE (y) == CLOBBER)
- {
- rtx ref = XEXP (y, 0);
- if (ref)
- {
- if (GET_CODE (ref) == REG || GET_CODE (ref) == SUBREG
- || (GET_CODE (ref) == MEM && !w->all))
- invalidate (ref, VOIDmode);
- else if (GET_CODE (ref) == STRICT_LOW_PART
- || GET_CODE (ref) == ZERO_EXTRACT)
- invalidate (XEXP (ref, 0), GET_MODE (ref));
- }
- }
- }
- }
-}
-
-/* Process X, part of the REG_NOTES of an insn. Look at any REG_EQUAL notes
- and replace any registers in them with either an equivalent constant
- or the canonical form of the register. If we are inside an address,
- only do this if the address remains valid.
-
- OBJECT is 0 except when within a MEM in which case it is the MEM.
-
- Return the replacement for X. */
-
-static rtx
-cse_process_notes (x, object)
- rtx x;
- rtx object;
-{
- enum rtx_code code = GET_CODE (x);
- char *fmt = GET_RTX_FORMAT (code);
- int i;
-
- switch (code)
- {
- case CONST_INT:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST_DOUBLE:
- case PC:
- case CC0:
- case LO_SUM:
- return x;
-
- case MEM:
- XEXP (x, 0) = cse_process_notes (XEXP (x, 0), x);
- return x;
-
- case EXPR_LIST:
- case INSN_LIST:
- if (REG_NOTE_KIND (x) == REG_EQUAL)
- XEXP (x, 0) = cse_process_notes (XEXP (x, 0), NULL_RTX);
- if (XEXP (x, 1))
- XEXP (x, 1) = cse_process_notes (XEXP (x, 1), NULL_RTX);
- return x;
-
- case SIGN_EXTEND:
- case ZERO_EXTEND:
- case SUBREG:
- {
- rtx new = cse_process_notes (XEXP (x, 0), object);
- /* We don't substitute VOIDmode constants into these rtx,
- since they would impede folding. */
- if (GET_MODE (new) != VOIDmode)
- validate_change (object, &XEXP (x, 0), new, 0);
- return x;
- }
-
- case REG:
- i = reg_qty[REGNO (x)];
-
- /* Return a constant or a constant register. */
- if (REGNO_QTY_VALID_P (REGNO (x))
- && qty_const[i] != 0
- && (CONSTANT_P (qty_const[i])
- || GET_CODE (qty_const[i]) == REG))
- {
- rtx new = gen_lowpart_if_possible (GET_MODE (x), qty_const[i]);
- if (new)
- return new;
- }
-
- /* Otherwise, canonicalize this register. */
- return canon_reg (x, NULL_RTX);
- }
-
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- if (fmt[i] == 'e')
- validate_change (object, &XEXP (x, i),
- cse_process_notes (XEXP (x, i), object), 0);
-
- return x;
-}
-
-/* Find common subexpressions between the end test of a loop and the beginning
- of the loop. LOOP_START is the CODE_LABEL at the start of a loop.
-
- Often we have a loop where an expression in the exit test is used
- in the body of the loop. For example "while (*p) *q++ = *p++;".
- Because of the way we duplicate the loop exit test in front of the loop,
- however, we don't detect that common subexpression. This will be caught
- when global cse is implemented, but this is a quite common case.
-
- This function handles the most common cases of these common expressions.
- It is called after we have processed the basic block ending with the
- NOTE_INSN_LOOP_END note that ends a loop and the previous JUMP_INSN
- jumps to a label used only once. */
-
-static void
-cse_around_loop (loop_start)
- rtx loop_start;
-{
- rtx insn;
- int i;
- struct table_elt *p;
-
- /* If the jump at the end of the loop doesn't go to the start, we don't
- do anything. */
- for (insn = PREV_INSN (loop_start);
- insn && (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) >= 0);
- insn = PREV_INSN (insn))
- ;
-
- if (insn == 0
- || GET_CODE (insn) != NOTE
- || NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_BEG)
- return;
-
- /* If the last insn of the loop (the end test) was an NE comparison,
- we will interpret it as an EQ comparison, since we fell through
- the loop. Any equivalences resulting from that comparison are
- therefore not valid and must be invalidated. */
- if (last_jump_equiv_class)
- for (p = last_jump_equiv_class->first_same_value; p;
- p = p->next_same_value)
- if (GET_CODE (p->exp) == MEM || GET_CODE (p->exp) == REG
- || (GET_CODE (p->exp) == SUBREG
- && GET_CODE (SUBREG_REG (p->exp)) == REG))
- invalidate (p->exp, VOIDmode);
- else if (GET_CODE (p->exp) == STRICT_LOW_PART
- || GET_CODE (p->exp) == ZERO_EXTRACT)
- invalidate (XEXP (p->exp, 0), GET_MODE (p->exp));
-
- /* Process insns starting after LOOP_START until we hit a CALL_INSN or
- a CODE_LABEL (we could handle a CALL_INSN, but it isn't worth it).
-
- The only thing we do with SET_DEST is invalidate entries, so we
- can safely process each SET in order. It is slightly less efficient
- to do so, but we only want to handle the most common cases. */
-
- for (insn = NEXT_INSN (loop_start);
- GET_CODE (insn) != CALL_INSN && GET_CODE (insn) != CODE_LABEL
- && ! (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END);
- insn = NEXT_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && (GET_CODE (PATTERN (insn)) == SET
- || GET_CODE (PATTERN (insn)) == CLOBBER))
- cse_set_around_loop (PATTERN (insn), insn, loop_start);
- else if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && GET_CODE (PATTERN (insn)) == PARALLEL)
- for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
- if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET
- || GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == CLOBBER)
- cse_set_around_loop (XVECEXP (PATTERN (insn), 0, i), insn,
- loop_start);
- }
-}
-
-/* Variable used for communications between the next two routines. */
-
-static struct write_data skipped_writes_memory;
-
-/* Process one SET of an insn that was skipped. We ignore CLOBBERs
- since they are done elsewhere. This function is called via note_stores. */
-
-static void
-invalidate_skipped_set (dest, set)
- rtx set;
- rtx dest;
-{
- if (GET_CODE (dest) == MEM)
- note_mem_written (dest, &skipped_writes_memory);
-
- /* There are times when an address can appear varying and be a PLUS
- during this scan when it would be a fixed address were we to know
- the proper equivalences. So promote "nonscalar" to be "all". */
- if (skipped_writes_memory.nonscalar)
- skipped_writes_memory.all = 1;
-
- if (GET_CODE (set) == CLOBBER
-#ifdef HAVE_cc0
- || dest == cc0_rtx
-#endif
- || dest == pc_rtx)
- return;
-
- if (GET_CODE (dest) == REG || GET_CODE (dest) == SUBREG
- || (! skipped_writes_memory.all && ! cse_rtx_addr_varies_p (dest)))
- invalidate (dest, VOIDmode);
- else if (GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == ZERO_EXTRACT)
- invalidate (XEXP (dest, 0), GET_MODE (dest));
-}
-
-/* Invalidate all insns from START up to the end of the function or the
- next label. This called when we wish to CSE around a block that is
- conditionally executed. */
-
-static void
-invalidate_skipped_block (start)
- rtx start;
-{
- rtx insn;
- static struct write_data init = {0, 0, 0, 0};
- static struct write_data everything = {0, 1, 1, 1};
-
- for (insn = start; insn && GET_CODE (insn) != CODE_LABEL;
- insn = NEXT_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
- continue;
-
- skipped_writes_memory = init;
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- invalidate_for_call ();
- skipped_writes_memory = everything;
- }
-
- note_stores (PATTERN (insn), invalidate_skipped_set);
- invalidate_from_clobbers (&skipped_writes_memory, PATTERN (insn));
- }
-}
-
-/* Used for communication between the following two routines; contains a
- value to be checked for modification. */
-
-static rtx cse_check_loop_start_value;
-
-/* If modifying X will modify the value in CSE_CHECK_LOOP_START_VALUE,
- indicate that fact by setting CSE_CHECK_LOOP_START_VALUE to 0. */
-
-static void
-cse_check_loop_start (x, set)
- rtx x;
- rtx set;
-{
- if (cse_check_loop_start_value == 0
- || GET_CODE (x) == CC0 || GET_CODE (x) == PC)
- return;
-
- if ((GET_CODE (x) == MEM && GET_CODE (cse_check_loop_start_value) == MEM)
- || reg_overlap_mentioned_p (x, cse_check_loop_start_value))
- cse_check_loop_start_value = 0;
-}
-
-/* X is a SET or CLOBBER contained in INSN that was found near the start of
- a loop that starts with the label at LOOP_START.
-
- If X is a SET, we see if its SET_SRC is currently in our hash table.
- If so, we see if it has a value equal to some register used only in the
- loop exit code (as marked by jump.c).
-
- If those two conditions are true, we search backwards from the start of
- the loop to see if that same value was loaded into a register that still
- retains its value at the start of the loop.
-
- If so, we insert an insn after the load to copy the destination of that
- load into the equivalent register and (try to) replace our SET_SRC with that
- register.
-
- In any event, we invalidate whatever this SET or CLOBBER modifies. */
-
-static void
-cse_set_around_loop (x, insn, loop_start)
- rtx x;
- rtx insn;
- rtx loop_start;
-{
- struct table_elt *src_elt;
- static struct write_data init = {0, 0, 0, 0};
- struct write_data writes_memory;
-
- writes_memory = init;
-
- /* If this is a SET, see if we can replace SET_SRC, but ignore SETs that
- are setting PC or CC0 or whose SET_SRC is already a register. */
- if (GET_CODE (x) == SET
- && GET_CODE (SET_DEST (x)) != PC && GET_CODE (SET_DEST (x)) != CC0
- && GET_CODE (SET_SRC (x)) != REG)
- {
- src_elt = lookup (SET_SRC (x),
- HASH (SET_SRC (x), GET_MODE (SET_DEST (x))),
- GET_MODE (SET_DEST (x)));
-
- if (src_elt)
- for (src_elt = src_elt->first_same_value; src_elt;
- src_elt = src_elt->next_same_value)
- if (GET_CODE (src_elt->exp) == REG && REG_LOOP_TEST_P (src_elt->exp)
- && COST (src_elt->exp) < COST (SET_SRC (x)))
- {
- rtx p, set;
-
- /* Look for an insn in front of LOOP_START that sets
- something in the desired mode to SET_SRC (x) before we hit
- a label or CALL_INSN. */
-
- for (p = prev_nonnote_insn (loop_start);
- p && GET_CODE (p) != CALL_INSN
- && GET_CODE (p) != CODE_LABEL;
- p = prev_nonnote_insn (p))
- if ((set = single_set (p)) != 0
- && GET_CODE (SET_DEST (set)) == REG
- && GET_MODE (SET_DEST (set)) == src_elt->mode
- && rtx_equal_p (SET_SRC (set), SET_SRC (x)))
- {
- /* We now have to ensure that nothing between P
- and LOOP_START modified anything referenced in
- SET_SRC (x). We know that nothing within the loop
- can modify it, or we would have invalidated it in
- the hash table. */
- rtx q;
-
- cse_check_loop_start_value = SET_SRC (x);
- for (q = p; q != loop_start; q = NEXT_INSN (q))
- if (GET_RTX_CLASS (GET_CODE (q)) == 'i')
- note_stores (PATTERN (q), cse_check_loop_start);
-
- /* If nothing was changed and we can replace our
- SET_SRC, add an insn after P to copy its destination
- to what we will be replacing SET_SRC with. */
- if (cse_check_loop_start_value
- && validate_change (insn, &SET_SRC (x),
- src_elt->exp, 0))
- emit_insn_after (gen_move_insn (src_elt->exp,
- SET_DEST (set)),
- p);
- break;
- }
- }
- }
-
- /* Now invalidate anything modified by X. */
- note_mem_written (SET_DEST (x), &writes_memory);
-
- if (writes_memory.var)
- invalidate_memory (&writes_memory);
-
- /* See comment on similar code in cse_insn for explanation of these
- tests. */
- if (GET_CODE (SET_DEST (x)) == REG || GET_CODE (SET_DEST (x)) == SUBREG
- || (GET_CODE (SET_DEST (x)) == MEM && ! writes_memory.all
- && ! cse_rtx_addr_varies_p (SET_DEST (x))))
- invalidate (SET_DEST (x), VOIDmode);
- else if (GET_CODE (SET_DEST (x)) == STRICT_LOW_PART
- || GET_CODE (SET_DEST (x)) == ZERO_EXTRACT)
- invalidate (XEXP (SET_DEST (x), 0), GET_MODE (SET_DEST (x)));
-}
-
-/* Find the end of INSN's basic block and return its range,
- the total number of SETs in all the insns of the block, the last insn of the
- block, and the branch path.
-
- The branch path indicates which branches should be followed. If a non-zero
- path size is specified, the block should be rescanned and a different set
- of branches will be taken. The branch path is only used if
- FLAG_CSE_FOLLOW_JUMPS or FLAG_CSE_SKIP_BLOCKS is non-zero.
-
- DATA is a pointer to a struct cse_basic_block_data, defined below, that is
- used to describe the block. It is filled in with the information about
- the current block. The incoming structure's branch path, if any, is used
- to construct the output branch path. */
-
-void
-cse_end_of_basic_block (insn, data, follow_jumps, after_loop, skip_blocks)
- rtx insn;
- struct cse_basic_block_data *data;
- int follow_jumps;
- int after_loop;
- int skip_blocks;
-{
- rtx p = insn, q;
- int nsets = 0;
- int low_cuid = INSN_CUID (insn), high_cuid = INSN_CUID (insn);
- rtx next = GET_RTX_CLASS (GET_CODE (insn)) == 'i' ? insn : next_real_insn (insn);
- int path_size = data->path_size;
- int path_entry = 0;
- int i;
-
- /* Update the previous branch path, if any. If the last branch was
- previously TAKEN, mark it NOT_TAKEN. If it was previously NOT_TAKEN,
- shorten the path by one and look at the previous branch. We know that
- at least one branch must have been taken if PATH_SIZE is non-zero. */
- while (path_size > 0)
- {
- if (data->path[path_size - 1].status != NOT_TAKEN)
- {
- data->path[path_size - 1].status = NOT_TAKEN;
- break;
- }
- else
- path_size--;
- }
-
- /* Scan to end of this basic block. */
- while (p && GET_CODE (p) != CODE_LABEL)
- {
- /* Don't cse out the end of a loop. This makes a difference
- only for the unusual loops that always execute at least once;
- all other loops have labels there so we will stop in any case.
- Cse'ing out the end of the loop is dangerous because it
- might cause an invariant expression inside the loop
- to be reused after the end of the loop. This would make it
- hard to move the expression out of the loop in loop.c,
- especially if it is one of several equivalent expressions
- and loop.c would like to eliminate it.
-
- If we are running after loop.c has finished, we can ignore
- the NOTE_INSN_LOOP_END. */
-
- if (! after_loop && GET_CODE (p) == NOTE
- && NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_END)
- break;
-
- /* Don't cse over a call to setjmp; on some machines (eg vax)
- the regs restored by the longjmp come from
- a later time than the setjmp. */
- if (GET_CODE (p) == NOTE
- && NOTE_LINE_NUMBER (p) == NOTE_INSN_SETJMP)
- break;
-
- /* A PARALLEL can have lots of SETs in it,
- especially if it is really an ASM_OPERANDS. */
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
- && GET_CODE (PATTERN (p)) == PARALLEL)
- nsets += XVECLEN (PATTERN (p), 0);
- else if (GET_CODE (p) != NOTE)
- nsets += 1;
-
- /* Ignore insns made by CSE; they cannot affect the boundaries of
- the basic block. */
-
- if (INSN_UID (p) <= max_uid && INSN_CUID (p) > high_cuid)
- high_cuid = INSN_CUID (p);
- if (INSN_UID (p) <= max_uid && INSN_CUID (p) < low_cuid)
- low_cuid = INSN_CUID (p);
-
- /* See if this insn is in our branch path. If it is and we are to
- take it, do so. */
- if (path_entry < path_size && data->path[path_entry].branch == p)
- {
- if (data->path[path_entry].status != NOT_TAKEN)
- p = JUMP_LABEL (p);
-
- /* Point to next entry in path, if any. */
- path_entry++;
- }
-
- /* If this is a conditional jump, we can follow it if -fcse-follow-jumps
- was specified, we haven't reached our maximum path length, there are
- insns following the target of the jump, this is the only use of the
- jump label, and the target label is preceded by a BARRIER.
-
- Alternatively, we can follow the jump if it branches around a
- block of code and there are no other branches into the block.
- In this case invalidate_skipped_block will be called to invalidate any
- registers set in the block when following the jump. */
-
- else if ((follow_jumps || skip_blocks) && path_size < PATHLENGTH - 1
- && GET_CODE (p) == JUMP_INSN
- && GET_CODE (PATTERN (p)) == SET
- && GET_CODE (SET_SRC (PATTERN (p))) == IF_THEN_ELSE
- && LABEL_NUSES (JUMP_LABEL (p)) == 1
- && NEXT_INSN (JUMP_LABEL (p)) != 0)
- {
- for (q = PREV_INSN (JUMP_LABEL (p)); q; q = PREV_INSN (q))
- if ((GET_CODE (q) != NOTE
- || NOTE_LINE_NUMBER (q) == NOTE_INSN_LOOP_END
- || NOTE_LINE_NUMBER (q) == NOTE_INSN_SETJMP)
- && (GET_CODE (q) != CODE_LABEL || LABEL_NUSES (q) != 0))
- break;
-
- /* If we ran into a BARRIER, this code is an extension of the
- basic block when the branch is taken. */
- if (follow_jumps && q != 0 && GET_CODE (q) == BARRIER)
- {
- /* Don't allow ourself to keep walking around an
- always-executed loop. */
- if (next_real_insn (q) == next)
- {
- p = NEXT_INSN (p);
- continue;
- }
-
- /* Similarly, don't put a branch in our path more than once. */
- for (i = 0; i < path_entry; i++)
- if (data->path[i].branch == p)
- break;
-
- if (i != path_entry)
- break;
-
- data->path[path_entry].branch = p;
- data->path[path_entry++].status = TAKEN;
-
- /* This branch now ends our path. It was possible that we
- didn't see this branch the last time around (when the
- insn in front of the target was a JUMP_INSN that was
- turned into a no-op). */
- path_size = path_entry;
-
- p = JUMP_LABEL (p);
- /* Mark block so we won't scan it again later. */
- PUT_MODE (NEXT_INSN (p), QImode);
- }
- /* Detect a branch around a block of code. */
- else if (skip_blocks && q != 0 && GET_CODE (q) != CODE_LABEL)
- {
- register rtx tmp;
-
- if (next_real_insn (q) == next)
- {
- p = NEXT_INSN (p);
- continue;
- }
-
- for (i = 0; i < path_entry; i++)
- if (data->path[i].branch == p)
- break;
-
- if (i != path_entry)
- break;
-
- /* This is no_labels_between_p (p, q) with an added check for
- reaching the end of a function (in case Q precedes P). */
- for (tmp = NEXT_INSN (p); tmp && tmp != q; tmp = NEXT_INSN (tmp))
- if (GET_CODE (tmp) == CODE_LABEL)
- break;
-
- if (tmp == q)
- {
- data->path[path_entry].branch = p;
- data->path[path_entry++].status = AROUND;
-
- path_size = path_entry;
-
- p = JUMP_LABEL (p);
- /* Mark block so we won't scan it again later. */
- PUT_MODE (NEXT_INSN (p), QImode);
- }
- }
- }
- p = NEXT_INSN (p);
- }
-
- data->low_cuid = low_cuid;
- data->high_cuid = high_cuid;
- data->nsets = nsets;
- data->last = p;
-
- /* If all jumps in the path are not taken, set our path length to zero
- so a rescan won't be done. */
- for (i = path_size - 1; i >= 0; i--)
- if (data->path[i].status != NOT_TAKEN)
- break;
-
- if (i == -1)
- data->path_size = 0;
- else
- data->path_size = path_size;
-
- /* End the current branch path. */
- data->path[path_size].branch = 0;
-}
-
-/* Perform cse on the instructions of a function.
- F is the first instruction.
- NREGS is one plus the highest pseudo-reg number used in the instruction.
-
- AFTER_LOOP is 1 if this is the cse call done after loop optimization
- (only if -frerun-cse-after-loop).
-
- Returns 1 if jump_optimize should be redone due to simplifications
- in conditional jump instructions. */
-
-int
-cse_main (f, nregs, after_loop, file)
- rtx f;
- int nregs;
- int after_loop;
- FILE *file;
-{
- struct cse_basic_block_data val;
- register rtx insn = f;
- register int i;
-
- cse_jumps_altered = 0;
- recorded_label_ref = 0;
- constant_pool_entries_cost = 0;
- val.path_size = 0;
-
- init_recog ();
-
- max_reg = nregs;
-
- all_minus_one = (int *) alloca (nregs * sizeof (int));
- consec_ints = (int *) alloca (nregs * sizeof (int));
-
- for (i = 0; i < nregs; i++)
- {
- all_minus_one[i] = -1;
- consec_ints[i] = i;
- }
-
- reg_next_eqv = (int *) alloca (nregs * sizeof (int));
- reg_prev_eqv = (int *) alloca (nregs * sizeof (int));
- reg_qty = (int *) alloca (nregs * sizeof (int));
- reg_in_table = (int *) alloca (nregs * sizeof (int));
- reg_tick = (int *) alloca (nregs * sizeof (int));
-
-#ifdef LOAD_EXTEND_OP
-
- /* Allocate scratch rtl here. cse_insn will fill in the memory reference
- and change the code and mode as appropriate. */
- memory_extend_rtx = gen_rtx (ZERO_EXTEND, VOIDmode, 0);
-#endif
-
- /* Discard all the free elements of the previous function
- since they are allocated in the temporarily obstack. */
- bzero ((char *) table, sizeof table);
- free_element_chain = 0;
- n_elements_made = 0;
-
- /* Find the largest uid. */
-
- max_uid = get_max_uid ();
- uid_cuid = (int *) alloca ((max_uid + 1) * sizeof (int));
- bzero ((char *) uid_cuid, (max_uid + 1) * sizeof (int));
-
- /* Compute the mapping from uids to cuids.
- CUIDs are numbers assigned to insns, like uids,
- except that cuids increase monotonically through the code.
- Don't assign cuids to line-number NOTEs, so that the distance in cuids
- between two insns is not affected by -g. */
-
- for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) != NOTE
- || NOTE_LINE_NUMBER (insn) < 0)
- INSN_CUID (insn) = ++i;
- else
- /* Give a line number note the same cuid as preceding insn. */
- INSN_CUID (insn) = i;
- }
-
- /* Initialize which registers are clobbered by calls. */
-
- CLEAR_HARD_REG_SET (regs_invalidated_by_call);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if ((call_used_regs[i]
- /* Used to check !fixed_regs[i] here, but that isn't safe;
- fixed regs are still call-clobbered, and sched can get
- confused if they can "live across calls".
-
- The frame pointer is always preserved across calls. The arg
- pointer is if it is fixed. The stack pointer usually is, unless
- RETURN_POPS_ARGS, in which case an explicit CLOBBER
- will be present. If we are generating PIC code, the PIC offset
- table register is preserved across calls. */
-
- && i != STACK_POINTER_REGNUM
- && i != FRAME_POINTER_REGNUM
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && i != HARD_FRAME_POINTER_REGNUM
-#endif
-#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && ! (i == ARG_POINTER_REGNUM && fixed_regs[i])
-#endif
-#if defined (PIC_OFFSET_TABLE_REGNUM) && !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
- && ! (i == PIC_OFFSET_TABLE_REGNUM && flag_pic)
-#endif
- )
- || global_regs[i])
- SET_HARD_REG_BIT (regs_invalidated_by_call, i);
-
- /* Loop over basic blocks.
- Compute the maximum number of qty's needed for each basic block
- (which is 2 for each SET). */
- insn = f;
- while (insn)
- {
- cse_end_of_basic_block (insn, &val, flag_cse_follow_jumps, after_loop,
- flag_cse_skip_blocks);
-
- /* If this basic block was already processed or has no sets, skip it. */
- if (val.nsets == 0 || GET_MODE (insn) == QImode)
- {
- PUT_MODE (insn, VOIDmode);
- insn = (val.last ? NEXT_INSN (val.last) : 0);
- val.path_size = 0;
- continue;
- }
-
- cse_basic_block_start = val.low_cuid;
- cse_basic_block_end = val.high_cuid;
- max_qty = val.nsets * 2;
-
- if (file)
- fprintf (file, ";; Processing block from %d to %d, %d sets.\n",
- INSN_UID (insn), val.last ? INSN_UID (val.last) : 0,
- val.nsets);
-
- /* Make MAX_QTY bigger to give us room to optimize
- past the end of this basic block, if that should prove useful. */
- if (max_qty < 500)
- max_qty = 500;
-
- max_qty += max_reg;
-
- /* If this basic block is being extended by following certain jumps,
- (see `cse_end_of_basic_block'), we reprocess the code from the start.
- Otherwise, we start after this basic block. */
- if (val.path_size > 0)
- cse_basic_block (insn, val.last, val.path, 0);
- else
- {
- int old_cse_jumps_altered = cse_jumps_altered;
- rtx temp;
-
- /* When cse changes a conditional jump to an unconditional
- jump, we want to reprocess the block, since it will give
- us a new branch path to investigate. */
- cse_jumps_altered = 0;
- temp = cse_basic_block (insn, val.last, val.path, ! after_loop);
- if (cse_jumps_altered == 0
- || (flag_cse_follow_jumps == 0 && flag_cse_skip_blocks == 0))
- insn = temp;
-
- cse_jumps_altered |= old_cse_jumps_altered;
- }
-
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
- }
-
- /* Tell refers_to_mem_p that qty_const info is not available. */
- qty_const = 0;
-
- if (max_elements_made < n_elements_made)
- max_elements_made = n_elements_made;
-
- return cse_jumps_altered || recorded_label_ref;
-}
-
-/* Process a single basic block. FROM and TO and the limits of the basic
- block. NEXT_BRANCH points to the branch path when following jumps or
- a null path when not following jumps.
-
- AROUND_LOOP is non-zero if we are to try to cse around to the start of a
- loop. This is true when we are being called for the last time on a
- block and this CSE pass is before loop.c. */
-
-static rtx
-cse_basic_block (from, to, next_branch, around_loop)
- register rtx from, to;
- struct branch_path *next_branch;
- int around_loop;
-{
- register rtx insn;
- int to_usage = 0;
- int in_libcall_block = 0;
-
- /* Each of these arrays is undefined before max_reg, so only allocate
- the space actually needed and adjust the start below. */
-
- qty_first_reg = (int *) alloca ((max_qty - max_reg) * sizeof (int));
- qty_last_reg = (int *) alloca ((max_qty - max_reg) * sizeof (int));
- qty_mode= (enum machine_mode *) alloca ((max_qty - max_reg) * sizeof (enum machine_mode));
- qty_const = (rtx *) alloca ((max_qty - max_reg) * sizeof (rtx));
- qty_const_insn = (rtx *) alloca ((max_qty - max_reg) * sizeof (rtx));
- qty_comparison_code
- = (enum rtx_code *) alloca ((max_qty - max_reg) * sizeof (enum rtx_code));
- qty_comparison_qty = (int *) alloca ((max_qty - max_reg) * sizeof (int));
- qty_comparison_const = (rtx *) alloca ((max_qty - max_reg) * sizeof (rtx));
-
- qty_first_reg -= max_reg;
- qty_last_reg -= max_reg;
- qty_mode -= max_reg;
- qty_const -= max_reg;
- qty_const_insn -= max_reg;
- qty_comparison_code -= max_reg;
- qty_comparison_qty -= max_reg;
- qty_comparison_const -= max_reg;
-
- new_basic_block ();
-
- /* TO might be a label. If so, protect it from being deleted. */
- if (to != 0 && GET_CODE (to) == CODE_LABEL)
- ++LABEL_NUSES (to);
-
- for (insn = from; insn != to; insn = NEXT_INSN (insn))
- {
- register enum rtx_code code;
-
- /* See if this is a branch that is part of the path. If so, and it is
- to be taken, do so. */
- if (next_branch->branch == insn)
- {
- enum taken status = next_branch++->status;
- if (status != NOT_TAKEN)
- {
- if (status == TAKEN)
- record_jump_equiv (insn, 1);
- else
- invalidate_skipped_block (NEXT_INSN (insn));
-
- /* Set the last insn as the jump insn; it doesn't affect cc0.
- Then follow this branch. */
-#ifdef HAVE_cc0
- prev_insn_cc0 = 0;
-#endif
- prev_insn = insn;
- insn = JUMP_LABEL (insn);
- continue;
- }
- }
-
- code = GET_CODE (insn);
- if (GET_MODE (insn) == QImode)
- PUT_MODE (insn, VOIDmode);
-
- if (GET_RTX_CLASS (code) == 'i')
- {
- /* Process notes first so we have all notes in canonical forms when
- looking for duplicate operations. */
-
- if (REG_NOTES (insn))
- REG_NOTES (insn) = cse_process_notes (REG_NOTES (insn), NULL_RTX);
-
- /* Track when we are inside in LIBCALL block. Inside such a block,
- we do not want to record destinations. The last insn of a
- LIBCALL block is not considered to be part of the block, since
- its destination is the result of the block and hence should be
- recorded. */
-
- if (find_reg_note (insn, REG_LIBCALL, NULL_RTX))
- in_libcall_block = 1;
- else if (find_reg_note (insn, REG_RETVAL, NULL_RTX))
- in_libcall_block = 0;
-
- cse_insn (insn, in_libcall_block);
- }
-
- /* If INSN is now an unconditional jump, skip to the end of our
- basic block by pretending that we just did the last insn in the
- basic block. If we are jumping to the end of our block, show
- that we can have one usage of TO. */
-
- if (simplejump_p (insn))
- {
- if (to == 0)
- return 0;
-
- if (JUMP_LABEL (insn) == to)
- to_usage = 1;
-
- /* Maybe TO was deleted because the jump is unconditional.
- If so, there is nothing left in this basic block. */
- /* ??? Perhaps it would be smarter to set TO
- to whatever follows this insn,
- and pretend the basic block had always ended here. */
- if (INSN_DELETED_P (to))
- break;
-
- insn = PREV_INSN (to);
- }
-
- /* See if it is ok to keep on going past the label
- which used to end our basic block. Remember that we incremented
- the count of that label, so we decrement it here. If we made
- a jump unconditional, TO_USAGE will be one; in that case, we don't
- want to count the use in that jump. */
-
- if (to != 0 && NEXT_INSN (insn) == to
- && GET_CODE (to) == CODE_LABEL && --LABEL_NUSES (to) == to_usage)
- {
- struct cse_basic_block_data val;
- rtx prev;
-
- insn = NEXT_INSN (to);
-
- if (LABEL_NUSES (to) == 0)
- insn = delete_insn (to);
-
- /* If TO was the last insn in the function, we are done. */
- if (insn == 0)
- return 0;
-
- /* If TO was preceded by a BARRIER we are done with this block
- because it has no continuation. */
- prev = prev_nonnote_insn (to);
- if (prev && GET_CODE (prev) == BARRIER)
- return insn;
-
- /* Find the end of the following block. Note that we won't be
- following branches in this case. */
- to_usage = 0;
- val.path_size = 0;
- cse_end_of_basic_block (insn, &val, 0, 0, 0);
-
- /* If the tables we allocated have enough space left
- to handle all the SETs in the next basic block,
- continue through it. Otherwise, return,
- and that block will be scanned individually. */
- if (val.nsets * 2 + next_qty > max_qty)
- break;
-
- cse_basic_block_start = val.low_cuid;
- cse_basic_block_end = val.high_cuid;
- to = val.last;
-
- /* Prevent TO from being deleted if it is a label. */
- if (to != 0 && GET_CODE (to) == CODE_LABEL)
- ++LABEL_NUSES (to);
-
- /* Back up so we process the first insn in the extension. */
- insn = PREV_INSN (insn);
- }
- }
-
- if (next_qty > max_qty)
- abort ();
-
- /* If we are running before loop.c, we stopped on a NOTE_INSN_LOOP_END, and
- the previous insn is the only insn that branches to the head of a loop,
- we can cse into the loop. Don't do this if we changed the jump
- structure of a loop unless we aren't going to be following jumps. */
-
- if ((cse_jumps_altered == 0
- || (flag_cse_follow_jumps == 0 && flag_cse_skip_blocks == 0))
- && around_loop && to != 0
- && GET_CODE (to) == NOTE && NOTE_LINE_NUMBER (to) == NOTE_INSN_LOOP_END
- && GET_CODE (PREV_INSN (to)) == JUMP_INSN
- && JUMP_LABEL (PREV_INSN (to)) != 0
- && LABEL_NUSES (JUMP_LABEL (PREV_INSN (to))) == 1)
- cse_around_loop (JUMP_LABEL (PREV_INSN (to)));
-
- return to ? NEXT_INSN (to) : 0;
-}
-
-/* Count the number of times registers are used (not set) in X.
- COUNTS is an array in which we accumulate the count, INCR is how much
- we count each register usage.
-
- Don't count a usage of DEST, which is the SET_DEST of a SET which
- contains X in its SET_SRC. This is because such a SET does not
- modify the liveness of DEST. */
-
-static void
-count_reg_usage (x, counts, dest, incr)
- rtx x;
- int *counts;
- rtx dest;
- int incr;
-{
- enum rtx_code code;
- char *fmt;
- int i, j;
-
- if (x == 0)
- return;
-
- switch (code = GET_CODE (x))
- {
- case REG:
- if (x != dest)
- counts[REGNO (x)] += incr;
- return;
-
- case PC:
- case CC0:
- case CONST:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- case CLOBBER:
- return;
-
- case SET:
- /* Unless we are setting a REG, count everything in SET_DEST. */
- if (GET_CODE (SET_DEST (x)) != REG)
- count_reg_usage (SET_DEST (x), counts, NULL_RTX, incr);
-
- /* If SRC has side-effects, then we can't delete this insn, so the
- usage of SET_DEST inside SRC counts.
-
- ??? Strictly-speaking, we might be preserving this insn
- because some other SET has side-effects, but that's hard
- to do and can't happen now. */
- count_reg_usage (SET_SRC (x), counts,
- side_effects_p (SET_SRC (x)) ? NULL_RTX : SET_DEST (x),
- incr);
- return;
-
- case CALL_INSN:
- count_reg_usage (CALL_INSN_FUNCTION_USAGE (x), counts, NULL_RTX, incr);
-
- /* ... falls through ... */
- case INSN:
- case JUMP_INSN:
- count_reg_usage (PATTERN (x), counts, NULL_RTX, incr);
-
- /* Things used in a REG_EQUAL note aren't dead since loop may try to
- use them. */
-
- count_reg_usage (REG_NOTES (x), counts, NULL_RTX, incr);
- return;
-
- case EXPR_LIST:
- case INSN_LIST:
- if (REG_NOTE_KIND (x) == REG_EQUAL
- || GET_CODE (XEXP (x,0)) == USE)
- count_reg_usage (XEXP (x, 0), counts, NULL_RTX, incr);
- count_reg_usage (XEXP (x, 1), counts, NULL_RTX, incr);
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- count_reg_usage (XEXP (x, i), counts, dest, incr);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- count_reg_usage (XVECEXP (x, i, j), counts, dest, incr);
- }
-}
-
-/* Scan all the insns and delete any that are dead; i.e., they store a register
- that is never used or they copy a register to itself.
-
- This is used to remove insns made obviously dead by cse. It improves the
- heuristics in loop since it won't try to move dead invariants out of loops
- or make givs for dead quantities. The remaining passes of the compilation
- are also sped up. */
-
-void
-delete_dead_from_cse (insns, nreg)
- rtx insns;
- int nreg;
-{
- int *counts = (int *) alloca (nreg * sizeof (int));
- rtx insn, prev;
- rtx tem;
- int i;
- int in_libcall = 0;
-
- /* First count the number of times each register is used. */
- bzero ((char *) counts, sizeof (int) * nreg);
- for (insn = next_real_insn (insns); insn; insn = next_real_insn (insn))
- count_reg_usage (insn, counts, NULL_RTX, 1);
-
- /* Go from the last insn to the first and delete insns that only set unused
- registers or copy a register to itself. As we delete an insn, remove
- usage counts for registers it uses. */
- for (insn = prev_real_insn (get_last_insn ()); insn; insn = prev)
- {
- int live_insn = 0;
-
- prev = prev_real_insn (insn);
-
- /* Don't delete any insns that are part of a libcall block.
- Flow or loop might get confused if we did that. Remember
- that we are scanning backwards. */
- if (find_reg_note (insn, REG_RETVAL, NULL_RTX))
- in_libcall = 1;
-
- if (in_libcall)
- live_insn = 1;
- else if (GET_CODE (PATTERN (insn)) == SET)
- {
- if (GET_CODE (SET_DEST (PATTERN (insn))) == REG
- && SET_DEST (PATTERN (insn)) == SET_SRC (PATTERN (insn)))
- ;
-
-#ifdef HAVE_cc0
- else if (GET_CODE (SET_DEST (PATTERN (insn))) == CC0
- && ! side_effects_p (SET_SRC (PATTERN (insn)))
- && ((tem = next_nonnote_insn (insn)) == 0
- || GET_RTX_CLASS (GET_CODE (tem)) != 'i'
- || ! reg_referenced_p (cc0_rtx, PATTERN (tem))))
- ;
-#endif
- else if (GET_CODE (SET_DEST (PATTERN (insn))) != REG
- || REGNO (SET_DEST (PATTERN (insn))) < FIRST_PSEUDO_REGISTER
- || counts[REGNO (SET_DEST (PATTERN (insn)))] != 0
- || side_effects_p (SET_SRC (PATTERN (insn))))
- live_insn = 1;
- }
- else if (GET_CODE (PATTERN (insn)) == PARALLEL)
- for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
- {
- rtx elt = XVECEXP (PATTERN (insn), 0, i);
-
- if (GET_CODE (elt) == SET)
- {
- if (GET_CODE (SET_DEST (elt)) == REG
- && SET_DEST (elt) == SET_SRC (elt))
- ;
-
-#ifdef HAVE_cc0
- else if (GET_CODE (SET_DEST (elt)) == CC0
- && ! side_effects_p (SET_SRC (elt))
- && ((tem = next_nonnote_insn (insn)) == 0
- || GET_RTX_CLASS (GET_CODE (tem)) != 'i'
- || ! reg_referenced_p (cc0_rtx, PATTERN (tem))))
- ;
-#endif
- else if (GET_CODE (SET_DEST (elt)) != REG
- || REGNO (SET_DEST (elt)) < FIRST_PSEUDO_REGISTER
- || counts[REGNO (SET_DEST (elt))] != 0
- || side_effects_p (SET_SRC (elt)))
- live_insn = 1;
- }
- else if (GET_CODE (elt) != CLOBBER && GET_CODE (elt) != USE)
- live_insn = 1;
- }
- else
- live_insn = 1;
-
- /* If this is a dead insn, delete it and show registers in it aren't
- being used. */
-
- if (! live_insn)
- {
- count_reg_usage (insn, counts, NULL_RTX, -1);
- delete_insn (insn);
- }
-
- if (find_reg_note (insn, REG_LIBCALL, NULL_RTX))
- in_libcall = 0;
- }
-}
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
deleted file mode 100644
index 51058dbe491..00000000000
--- a/gcc/dbxout.c
+++ /dev/null
@@ -1,2607 +0,0 @@
-/* Output dbx-format symbol table information from GNU compiler.
- Copyright (C) 1987, 88, 92-96, 1997 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. */
-
-
-/* Output dbx-format symbol table data.
- This consists of many symbol table entries, each of them
- a .stabs assembler pseudo-op with four operands:
- a "name" which is really a description of one symbol and its type,
- a "code", which is a symbol defined in stab.h whose name starts with N_,
- an unused operand always 0,
- and a "value" which is an address or an offset.
- The name is enclosed in doublequote characters.
-
- Each function, variable, typedef, and structure tag
- has a symbol table entry to define it.
- The beginning and end of each level of name scoping within
- a function are also marked by special symbol table entries.
-
- The "name" consists of the symbol name, a colon, a kind-of-symbol letter,
- and a data type number. The data type number may be followed by
- "=" and a type definition; normally this will happen the first time
- the type number is mentioned. The type definition may refer to
- other types by number, and those type numbers may be followed
- by "=" and nested definitions.
-
- This can make the "name" quite long.
- When a name is more than 80 characters, we split the .stabs pseudo-op
- into two .stabs pseudo-ops, both sharing the same "code" and "value".
- The first one is marked as continued with a double-backslash at the
- end of its "name".
-
- The kind-of-symbol letter distinguished function names from global
- variables from file-scope variables from parameters from auto
- variables in memory from typedef names from register variables.
- See `dbxout_symbol'.
-
- The "code" is mostly redundant with the kind-of-symbol letter
- that goes in the "name", but not entirely: for symbols located
- in static storage, the "code" says which segment the address is in,
- which controls how it is relocated.
-
- The "value" for a symbol in static storage
- is the core address of the symbol (actually, the assembler
- label for the symbol). For a symbol located in a stack slot
- it is the stack offset; for one in a register, the register number.
- For a typedef symbol, it is zero.
-
- If DEBUG_SYMS_TEXT is defined, all debugging symbols must be
- output while in the text section.
-
- For more on data type definitions, see `dbxout_type'. */
-
-/* Include these first, because they may define MIN and MAX. */
-#include <stdio.h>
-#include <errno.h>
-
-#include "config.h"
-#include "tree.h"
-#include "rtl.h"
-#include "flags.h"
-#include "regs.h"
-#include "insn-config.h"
-#include "reload.h"
-#include "defaults.h"
-#include "output.h" /* ASM_OUTPUT_SOURCE_LINE may refer to sdb functions. */
-
-#ifndef errno
-extern int errno;
-#endif
-
-#ifdef XCOFF_DEBUGGING_INFO
-#include "xcoffout.h"
-#endif
-
-#ifndef ASM_STABS_OP
-#define ASM_STABS_OP ".stabs"
-#endif
-
-#ifndef ASM_STABN_OP
-#define ASM_STABN_OP ".stabn"
-#endif
-
-#ifndef DBX_TYPE_DECL_STABS_CODE
-#define DBX_TYPE_DECL_STABS_CODE N_LSYM
-#endif
-
-#ifndef DBX_STATIC_CONST_VAR_CODE
-#define DBX_STATIC_CONST_VAR_CODE N_FUN
-#endif
-
-#ifndef DBX_REGPARM_STABS_CODE
-#define DBX_REGPARM_STABS_CODE N_RSYM
-#endif
-
-#ifndef DBX_REGPARM_STABS_LETTER
-#define DBX_REGPARM_STABS_LETTER 'P'
-#endif
-
-/* This is used for parameters passed by invisible reference in a register. */
-#ifndef GDB_INV_REF_REGPARM_STABS_LETTER
-#define GDB_INV_REF_REGPARM_STABS_LETTER 'a'
-#endif
-
-#ifndef DBX_MEMPARM_STABS_LETTER
-#define DBX_MEMPARM_STABS_LETTER 'p'
-#endif
-
-#ifndef FILE_NAME_JOINER
-#define FILE_NAME_JOINER "/"
-#endif
-
-/* Nonzero means if the type has methods, only output debugging
- information if methods are actually written to the asm file. This
- optimization only works if the debugger can detect the special C++
- marker. */
-
-#define MINIMAL_DEBUG 1
-
-#ifdef NO_DOLLAR_IN_LABEL
-#ifdef NO_DOT_IN_LABEL
-#undef MINIMAL_DEBUG
-#define MINIMAL_DEBUG 0
-#endif
-#endif
-
-static int flag_minimal_debug = MINIMAL_DEBUG;
-
-/* Nonzero if we have actually used any of the GDB extensions
- to the debugging format. The idea is that we use them for the
- first time only if there's a strong reason, but once we have done that,
- we use them whenever convenient. */
-
-static int have_used_extensions = 0;
-
-/* Number for the next N_SOL filename stabs label. The number 0 is reserved
- for the N_SO filename stabs label. */
-
-static int source_label_number = 1;
-
-static int scope_labelno = 0;
-
-char *getpwd ();
-
-/* Typical USG systems don't have stab.h, and they also have
- no use for DBX-format debugging info. */
-
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
-
-#ifdef DEBUG_SYMS_TEXT
-#define FORCE_TEXT text_section ();
-#else
-#define FORCE_TEXT
-#endif
-
-#if defined (USG) || defined (NO_STAB_H) || defined (CROSS_COMPILE)
-#include "gstab.h" /* If doing DBX on sysV, use our own stab.h. */
-#else
-#include <stab.h> /* On BSD, use the system's stab.h. */
-
-/* This is a GNU extension we need to reference in this file. */
-#ifndef N_CATCH
-#define N_CATCH 0x54
-#endif
-#endif /* not USG */
-
-#ifdef __GNU_STAB__
-#define STAB_CODE_TYPE enum __stab_debug_code
-#else
-#define STAB_CODE_TYPE int
-#endif
-
-/* 1 if PARM is passed to this function in memory. */
-
-#define PARM_PASSED_IN_MEMORY(PARM) \
- (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
-
-/* A C expression for the integer offset value of an automatic variable
- (N_LSYM) having address X (an RTX). */
-#ifndef DEBUGGER_AUTO_OFFSET
-#define DEBUGGER_AUTO_OFFSET(X) \
- (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
-#endif
-
-/* A C expression for the integer offset value of an argument (N_PSYM)
- having address X (an RTX). The nominal offset is OFFSET. */
-#ifndef DEBUGGER_ARG_OFFSET
-#define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
-#endif
-
-/* Stream for writing to assembler file. */
-
-static FILE *asmfile;
-
-/* Last source file name mentioned in a NOTE insn. */
-
-static char *lastfile;
-
-/* Current working directory. */
-
-static char *cwd;
-
-enum typestatus {TYPE_UNSEEN, TYPE_XREF, TYPE_DEFINED};
-
-/* Structure recording information about a C data type.
- The status element says whether we have yet output
- the definition of the type. TYPE_XREF says we have
- output it as a cross-reference only.
- The file_number and type_number elements are used if DBX_USE_BINCL
- is defined. */
-
-struct typeinfo
-{
- enum typestatus status;
-#ifdef DBX_USE_BINCL
- int file_number;
- int type_number;
-#endif
-};
-
-/* Vector recording information about C data types.
- When we first notice a data type (a tree node),
- we assign it a number using next_type_number.
- That is its index in this vector. */
-
-struct typeinfo *typevec;
-
-/* Number of elements of space allocated in `typevec'. */
-
-static int typevec_len;
-
-/* In dbx output, each type gets a unique number.
- This is the number for the next type output.
- The number, once assigned, is in the TYPE_SYMTAB_ADDRESS field. */
-
-static int next_type_number;
-
-#ifdef DBX_USE_BINCL
-
-/* When using N_BINCL in dbx output, each type number is actually a
- pair of the file number and the type number within the file.
- This is a stack of input files. */
-
-struct dbx_file
-{
- struct dbx_file *next;
- int file_number;
- int next_type_number;
-};
-
-/* This is the top of the stack. */
-
-static struct dbx_file *current_file;
-
-/* This is the next file number to use. */
-
-static int next_file_number;
-
-#endif /* DBX_USE_BINCL */
-
-/* In dbx output, we must assign symbol-blocks id numbers
- in the order in which their beginnings are encountered.
- We output debugging info that refers to the beginning and
- end of the ranges of code in each block
- with assembler labels LBBn and LBEn, where n is the block number.
- The labels are generated in final, which assigns numbers to the
- blocks in the same way. */
-
-static int next_block_number;
-
-/* These variables are for dbxout_symbol to communicate to
- dbxout_finish_symbol.
- current_sym_code is the symbol-type-code, a symbol N_... define in stab.h.
- current_sym_value and current_sym_addr are two ways to address the
- value to store in the symtab entry.
- current_sym_addr if nonzero represents the value as an rtx.
- If that is zero, current_sym_value is used. This is used
- when the value is an offset (such as for auto variables,
- register variables and parms). */
-
-static STAB_CODE_TYPE current_sym_code;
-static int current_sym_value;
-static rtx current_sym_addr;
-
-/* Number of chars of symbol-description generated so far for the
- current symbol. Used by CHARS and CONTIN. */
-
-static int current_sym_nchars;
-
-/* Report having output N chars of the current symbol-description. */
-
-#define CHARS(N) (current_sym_nchars += (N))
-
-/* Break the current symbol-description, generating a continuation,
- if it has become long. */
-
-#ifndef DBX_CONTIN_LENGTH
-#define DBX_CONTIN_LENGTH 80
-#endif
-
-#if DBX_CONTIN_LENGTH > 0
-#define CONTIN \
- do {if (current_sym_nchars > DBX_CONTIN_LENGTH) dbxout_continue ();} while (0)
-#else
-#define CONTIN
-#endif
-
-void dbxout_types ();
-void dbxout_args ();
-void dbxout_symbol ();
-
-static void dbxout_function_end PROTO((void));
-static void dbxout_typedefs PROTO((tree));
-static void dbxout_type_index PROTO((tree));
-static void dbxout_continue PROTO((void));
-static void dbxout_type_fields PROTO((tree));
-static void dbxout_type_method_1 PROTO((tree, char *));
-static void dbxout_type_methods PROTO((tree));
-static void dbxout_range_type PROTO((tree));
-static void dbxout_type PROTO((tree, int, int));
-static void print_int_cst_octal PROTO((tree));
-static void print_octal PROTO((unsigned HOST_WIDE_INT, int));
-static void dbxout_type_name PROTO((tree));
-static void dbxout_symbol_location PROTO((tree, tree, char *, rtx));
-static void dbxout_symbol_name PROTO((tree, char *, int));
-static void dbxout_prepare_symbol PROTO((tree));
-static void dbxout_finish_symbol PROTO((tree));
-static void dbxout_block PROTO((tree, int, tree));
-static void dbxout_really_begin_function PROTO((tree));
-
-static void
-dbxout_function_end ()
-{
- char lscope_label_name[100];
- /* Convert Ltext into the appropriate format for local labels in case
- the system doesn't insert underscores in front of user generated
- labels. */
- ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno);
- ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Lscope", scope_labelno);
- scope_labelno++;
-
- /* By convention, GCC will mark the end of a function with an N_FUN
- symbol and an empty string. */
- fprintf (asmfile, "%s \"\",%d,0,0,", ASM_STABS_OP, N_FUN);
- assemble_name (asmfile, lscope_label_name);
- fputc ('-', asmfile);
- assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
- fprintf (asmfile, "-1\n");
-}
-
-/* At the beginning of compilation, start writing the symbol table.
- Initialize `typevec' and output the standard data types of C. */
-
-void
-dbxout_init (asm_file, input_file_name, syms)
- FILE *asm_file;
- char *input_file_name;
- tree syms;
-{
- char ltext_label_name[100];
-
- asmfile = asm_file;
-
- typevec_len = 100;
- typevec = (struct typeinfo *) xmalloc (typevec_len * sizeof typevec[0]);
- bzero ((char *) typevec, typevec_len * sizeof typevec[0]);
-
- /* Convert Ltext into the appropriate format for local labels in case
- the system doesn't insert underscores in front of user generated
- labels. */
- ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0);
-
- /* Put the current working directory in an N_SO symbol. */
-#ifndef DBX_WORKING_DIRECTORY /* Only some versions of DBX want this,
- but GDB always does. */
- if (use_gnu_debug_info_extensions)
-#endif
- {
- if (!cwd && (cwd = getpwd ()) && (!*cwd || cwd[strlen (cwd) - 1] != '/'))
- {
- char *wdslash = xmalloc (strlen (cwd) + sizeof (FILE_NAME_JOINER));
- sprintf (wdslash, "%s%s", cwd, FILE_NAME_JOINER);
- cwd = wdslash;
- }
- if (cwd)
- {
-#ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
- DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (asmfile, cwd);
-#else /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
- fprintf (asmfile, "%s ", ASM_STABS_OP);
- output_quoted_string (asmfile, cwd);
- fprintf (asmfile, ",%d,0,0,%s\n", N_SO, &ltext_label_name[1]);
-#endif /* no DBX_OUTPUT_MAIN_SOURCE_DIRECTORY */
- }
- }
-
-#ifdef DBX_OUTPUT_MAIN_SOURCE_FILENAME
- /* This should NOT be DBX_OUTPUT_SOURCE_FILENAME. That
- would give us an N_SOL, and we want an N_SO. */
- DBX_OUTPUT_MAIN_SOURCE_FILENAME (asmfile, input_file_name);
-#else /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
- /* We include outputting `Ltext:' here,
- because that gives you a way to override it. */
- /* 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,%s\n",
- N_SO, &ltext_label_name[1]);
- text_section ();
- ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Ltext", 0);
-#endif /* no DBX_OUTPUT_MAIN_SOURCE_FILENAME */
-
- /* Possibly output something to inform GDB that this compilation was by
- GCC. It's easier for GDB to parse it when after the N_SO's. This
- is used in Solaris 2. */
-#ifdef ASM_IDENTIFY_GCC_AFTER_SOURCE
- ASM_IDENTIFY_GCC_AFTER_SOURCE (asmfile);
-#endif
-
- lastfile = input_file_name;
-
- next_type_number = 1;
- next_block_number = 2;
-
-#ifdef DBX_USE_BINCL
- current_file = (struct dbx_file *) xmalloc (sizeof *current_file);
- current_file->next = NULL;
- current_file->file_number = 0;
- current_file->next_type_number = 1;
- next_file_number = 1;
-#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). */
-
-#ifdef DBX_OUTPUT_STANDARD_TYPES
- DBX_OUTPUT_STANDARD_TYPES (syms);
-#else
- dbxout_symbol (TYPE_NAME (integer_type_node), 0);
- dbxout_symbol (TYPE_NAME (char_type_node), 0);
-#endif
-
- /* Get all permanent types that have typedef names,
- and output them all, except for those already output. */
-
- dbxout_typedefs (syms);
-}
-
-/* Output any typedef names for types described by TYPE_DECLs in SYMS,
- in the reverse order from that which is found in SYMS. */
-
-static void
-dbxout_typedefs (syms)
- tree syms;
-{
- if (syms)
- {
- dbxout_typedefs (TREE_CHAIN (syms));
- if (TREE_CODE (syms) == TYPE_DECL)
- {
- tree type = TREE_TYPE (syms);
- if (TYPE_NAME (type)
- && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && TYPE_SIZE (type) != NULL_TREE
- && ! TREE_ASM_WRITTEN (TYPE_NAME (type)))
- dbxout_symbol (TYPE_NAME (type), 0);
- }
- }
-}
-
-/* Change to reading from a new source file. Generate a N_BINCL stab. */
-
-void
-dbxout_start_new_source_file (filename)
- char *filename;
-{
-#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 \"%s\",%d,0,0,0\n", ASM_STABS_OP, filename, N_BINCL);
-#endif
-}
-
-/* Revert to reading a previous source file. Generate a N_EINCL stab. */
-
-void
-dbxout_resume_previous_source_file ()
-{
-#ifdef DBX_USE_BINCL
- struct dbx_file *next;
-
- fprintf (asmfile, "%s %d,0,0,0\n", ASM_STABN_OP, N_EINCL);
- next = current_file->next;
- free (current_file);
- current_file = next;
-#endif
-}
-
-/* Output debugging info to FILE to switch to sourcefile FILENAME. */
-
-void
-dbxout_source_file (file, filename)
- FILE *file;
- char *filename;
-{
- char ltext_label_name[100];
-
- if (filename && (lastfile == 0 || strcmp (filename, lastfile)))
- {
-#ifdef DBX_OUTPUT_SOURCE_FILENAME
- DBX_OUTPUT_SOURCE_FILENAME (file, filename);
-#else
- ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext",
- source_label_number);
- fprintf (file, "%s ", ASM_STABS_OP);
- output_quoted_string (file, filename);
- fprintf (file, ",%d,0,0,%s\n", N_SOL, &ltext_label_name[1]);
- if (current_function_decl != NULL_TREE
- && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
- ; /* Don't change section amid function. */
- else
- text_section ();
- ASM_OUTPUT_INTERNAL_LABEL (file, "Ltext", source_label_number);
- source_label_number++;
-#endif
- lastfile = filename;
- }
-}
-
-/* Output a line number symbol entry into output stream FILE,
- for source file FILENAME and line number LINENO. */
-
-void
-dbxout_source_line (file, filename, lineno)
- FILE *file;
- char *filename;
- int lineno;
-{
- dbxout_source_file (file, filename);
-
-#ifdef ASM_OUTPUT_SOURCE_LINE
- ASM_OUTPUT_SOURCE_LINE (file, lineno);
-#else
- fprintf (file, "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, lineno);
-#endif
-}
-
-/* At the end of compilation, finish writing the symbol table.
- Unless you define DBX_OUTPUT_MAIN_SOURCE_FILE_END, the default is
- to do nothing. */
-
-void
-dbxout_finish (file, filename)
- FILE *file;
- char *filename;
-{
-#ifdef DBX_OUTPUT_MAIN_SOURCE_FILE_END
- DBX_OUTPUT_MAIN_SOURCE_FILE_END (file, filename);
-#endif /* DBX_OUTPUT_MAIN_SOURCE_FILE_END */
-}
-
-/* Output the index of a type. */
-
-static void
-dbxout_type_index (type)
- tree type;
-{
-#ifndef DBX_USE_BINCL
- fprintf (asmfile, "%d", TYPE_SYMTAB_ADDRESS (type));
- CHARS (3);
-#else
- struct typeinfo *t = &typevec[TYPE_SYMTAB_ADDRESS (type)];
- fprintf (asmfile, "(%d,%d)", t->file_number, t->type_number);
- CHARS (7);
-#endif
-}
-
-/* Continue a symbol-description that gets too big.
- End one symbol table entry with a double-backslash
- and start a new one, eventually producing something like
- .stabs "start......\\",code,0,value
- .stabs "...rest",code,0,value */
-
-static void
-dbxout_continue ()
-{
-#ifdef DBX_CONTIN_CHAR
- fprintf (asmfile, "%c", DBX_CONTIN_CHAR);
-#else
- fprintf (asmfile, "\\\\");
-#endif
- dbxout_finish_symbol (NULL_TREE);
- fprintf (asmfile, "%s \"", ASM_STABS_OP);
- current_sym_nchars = 0;
-}
-
-/* Subroutine of `dbxout_type'. Output the type fields of TYPE.
- This must be a separate function because anonymous unions require
- recursive calls. */
-
-static void
-dbxout_type_fields (type)
- tree type;
-{
- tree tem;
- /* Output the name, type, position (in bits), size (in bits) of each
- field. */
- for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
- {
- /* Omit here local type decls until we know how to support them. */
- if (TREE_CODE (tem) == TYPE_DECL)
- continue;
- /* Omit fields whose position or size are variable. */
- else if (TREE_CODE (tem) == FIELD_DECL
- && (TREE_CODE (DECL_FIELD_BITPOS (tem)) != INTEGER_CST
- || TREE_CODE (DECL_SIZE (tem)) != INTEGER_CST))
- continue;
- /* Omit here the nameless fields that are used to skip bits. */
- else if (TREE_CODE (tem) != CONST_DECL)
- {
- /* Continue the line if necessary,
- but not before the first field. */
- if (tem != TYPE_FIELDS (type))
- CONTIN;
-
- if (use_gnu_debug_info_extensions
- && flag_minimal_debug
- && TREE_CODE (tem) == FIELD_DECL
- && DECL_VIRTUAL_P (tem)
- && DECL_ASSEMBLER_NAME (tem))
- {
- have_used_extensions = 1;
- CHARS (3 + IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (tem)));
- fputs (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (tem)), asmfile);
- dbxout_type (DECL_FCONTEXT (tem), 0, 0);
- fprintf (asmfile, ":");
- dbxout_type (TREE_TYPE (tem), 0, 0);
- fprintf (asmfile, ",%d;",
- TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
- continue;
- }
-
- if (DECL_NAME (tem))
- {
- fprintf (asmfile, "%s:", IDENTIFIER_POINTER (DECL_NAME (tem)));
- CHARS (2 + IDENTIFIER_LENGTH (DECL_NAME (tem)));
- }
- else
- {
- fprintf (asmfile, ":");
- CHARS (2);
- }
-
- if (use_gnu_debug_info_extensions
- && (TREE_PRIVATE (tem) || TREE_PROTECTED (tem)
- || TREE_CODE (tem) != FIELD_DECL))
- {
- have_used_extensions = 1;
- putc ('/', asmfile);
- putc ((TREE_PRIVATE (tem) ? '0'
- : TREE_PROTECTED (tem) ? '1' : '2'),
- asmfile);
- CHARS (2);
- }
-
- dbxout_type ((TREE_CODE (tem) == FIELD_DECL
- && DECL_BIT_FIELD_TYPE (tem))
- ? DECL_BIT_FIELD_TYPE (tem)
- : TREE_TYPE (tem), 0, 0);
-
- if (TREE_CODE (tem) == VAR_DECL)
- {
- if (TREE_STATIC (tem) && use_gnu_debug_info_extensions)
- {
- char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (tem));
- have_used_extensions = 1;
- fprintf (asmfile, ":%s;", name);
- CHARS (strlen (name));
- }
- else
- {
- /* If TEM is non-static, GDB won't understand it. */
- fprintf (asmfile, ",0,0;");
- }
- }
- else if (TREE_CODE (DECL_FIELD_BITPOS (tem)) == INTEGER_CST)
- {
- fprintf (asmfile, ",%d,%d;",
- TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)),
- TREE_INT_CST_LOW (DECL_SIZE (tem)));
- }
- CHARS (23);
- }
- }
-}
-
-/* Subroutine of `dbxout_type_methods'. Output debug info about the
- method described DECL. DEBUG_NAME is an encoding of the method's
- type signature. ??? We may be able to do without DEBUG_NAME altogether
- now. */
-
-static void
-dbxout_type_method_1 (decl, debug_name)
- tree decl;
- char *debug_name;
-{
- char c1 = 'A', c2;
-
- if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE)
- c2 = '?';
- else /* it's a METHOD_TYPE. */
- {
- tree firstarg = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)));
- /* A for normal functions.
- B for `const' member functions.
- C for `volatile' member functions.
- D for `const volatile' member functions. */
- if (TYPE_READONLY (TREE_TYPE (firstarg)))
- c1 += 1;
- if (TYPE_VOLATILE (TREE_TYPE (firstarg)))
- c1 += 2;
-
- if (DECL_VINDEX (decl))
- c2 = '*';
- else
- c2 = '.';
- }
-
- fprintf (asmfile, ":%s;%c%c%c", debug_name,
- TREE_PRIVATE (decl) ? '0' : TREE_PROTECTED (decl) ? '1' : '2', c1, c2);
- CHARS (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl)) + 6
- - (debug_name - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))));
- if (DECL_VINDEX (decl))
- {
- fprintf (asmfile, "%d;",
- TREE_INT_CST_LOW (DECL_VINDEX (decl)));
- dbxout_type (DECL_CONTEXT (decl), 0, 0);
- fprintf (asmfile, ";");
- CHARS (8);
- }
-}
-
-/* Subroutine of `dbxout_type'. Output debug info about the methods defined
- in TYPE. */
-
-static void
-dbxout_type_methods (type)
- register tree type;
-{
- /* C++: put out the method names and their parameter lists */
- tree methods = TYPE_METHODS (type);
- tree type_encoding;
- register tree fndecl;
- register tree last;
- char formatted_type_identifier_length[16];
- register int type_identifier_length;
-
- if (methods == NULL_TREE)
- return;
-
- type_encoding = DECL_NAME (TYPE_NAME (type));
-
-#if 0
- /* C++: Template classes break some assumptions made by this code about
- the class names, constructor names, and encodings for assembler
- label names. For now, disable output of dbx info for them. */
- {
- char *ptr = IDENTIFIER_POINTER (type_encoding);
- /* This should use index. (mrs) */
- while (*ptr && *ptr != '<') ptr++;
- if (*ptr != 0)
- {
- static int warned;
- if (!warned)
- {
- warned = 1;
-#ifdef HAVE_TEMPLATES
- if (warn_template_debugging)
- warning ("dbx info for template class methods not yet supported");
-#endif
- }
- return;
- }
- }
-#endif
-
- type_identifier_length = IDENTIFIER_LENGTH (type_encoding);
-
- sprintf(formatted_type_identifier_length, "%d", type_identifier_length);
-
- if (TREE_CODE (methods) == FUNCTION_DECL)
- fndecl = methods;
- else if (TREE_VEC_ELT (methods, 0) != NULL_TREE)
- fndecl = TREE_VEC_ELT (methods, 0);
- else
- fndecl = TREE_VEC_ELT (methods, 1);
-
- while (fndecl)
- {
- tree name = DECL_NAME (fndecl);
- int need_prefix = 1;
-
- /* Group together all the methods for the same operation.
- These differ in the types of the arguments. */
- for (last = NULL_TREE;
- fndecl && (last == NULL_TREE || DECL_NAME (fndecl) == DECL_NAME (last));
- fndecl = TREE_CHAIN (fndecl))
- /* Output the name of the field (after overloading), as
- well as the name of the field before overloading, along
- with its parameter list */
- {
- /* This is the "mangled" name of the method.
- It encodes the argument types. */
- char *debug_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl));
- int show_arg_types = 0;
-
- CONTIN;
-
- last = fndecl;
-
- if (DECL_IGNORED_P (fndecl))
- continue;
-
- if (flag_minimal_debug)
- {
- char marker;
-
- /* We can't optimize a method which uses an anonymous
- class, because the debugger will not be able to
- associate the arbitrary class name with the actual
- class. */
-#ifndef NO_DOLLAR_IN_LABEL
- marker = '$';
-#else
- marker = '.';
-#endif
- if (strchr (debug_name, marker))
- show_arg_types = 1;
- /* Detect ordinary methods because their mangled names
- start with the operation name. */
- else if (!strncmp (IDENTIFIER_POINTER (name), debug_name,
- IDENTIFIER_LENGTH (name)))
- {
- debug_name += IDENTIFIER_LENGTH (name);
- if (debug_name[0] == '_' && debug_name[1] == '_')
- {
- char *method_name = debug_name + 2;
- char *length_ptr = formatted_type_identifier_length;
- /* Get past const and volatile qualifiers. */
- while (*method_name == 'C' || *method_name == 'V')
- method_name++;
- /* Skip digits for length of type_encoding. */
- while (*method_name == *length_ptr && *length_ptr)
- length_ptr++, method_name++;
- if (! strncmp (method_name,
- IDENTIFIER_POINTER (type_encoding),
- type_identifier_length))
- method_name += type_identifier_length;
- debug_name = method_name;
- }
- }
- /* Detect constructors by their style of name mangling. */
- else if (debug_name[0] == '_' && debug_name[1] == '_')
- {
- char *ctor_name = debug_name + 2;
- char *length_ptr = formatted_type_identifier_length;
- while (*ctor_name == 'C' || *ctor_name == 'V')
- ctor_name++;
- /* Skip digits for length of type_encoding. */
- while (*ctor_name == *length_ptr && *length_ptr)
- length_ptr++, ctor_name++;
- if (!strncmp (IDENTIFIER_POINTER (type_encoding), ctor_name,
- type_identifier_length))
- debug_name = ctor_name + type_identifier_length;
- }
- /* The other alternative is a destructor. */
- else
- show_arg_types = 1;
-
- /* Output the operation name just once, for the first method
- that we output. */
- if (need_prefix)
- {
- fprintf (asmfile, "%s::", IDENTIFIER_POINTER (name));
- CHARS (IDENTIFIER_LENGTH (name) + 2);
- need_prefix = 0;
- }
- }
-
- dbxout_type (TREE_TYPE (fndecl), 0, show_arg_types);
-
- dbxout_type_method_1 (fndecl, debug_name);
- }
- if (!need_prefix)
- {
- putc (';', asmfile);
- CHARS (1);
- }
- }
-}
-
-/* Emit a "range" type specification, which has the form:
- "r<index type>;<lower bound>;<upper bound>;".
- TYPE is an INTEGER_TYPE. */
-
-static void
-dbxout_range_type (type)
- tree type;
-{
- fprintf (asmfile, "r");
- if (TREE_TYPE (type))
- dbxout_type (TREE_TYPE (type), 0, 0);
- else if (TREE_CODE (type) != INTEGER_TYPE)
- dbxout_type (type, 0, 0); /* E.g. Pascal's ARRAY [BOOLEAN] of INTEGER */
- else
- {
- /* Traditionally, we made sure 'int' was type 1, and builtin types
- were defined to be sub-ranges of int. Unfortunately, this
- does not allow us to distinguish true sub-ranges from integer
- types. So, instead we define integer (non-sub-range) types as
- sub-ranges of themselves. */
- dbxout_type_index (type);
- }
- if (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST)
- fprintf (asmfile, ";%d",
- TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)));
- else
- fprintf (asmfile, ";0");
- if (TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST)
- fprintf (asmfile, ";%d;",
- TREE_INT_CST_LOW (TYPE_MAX_VALUE (type)));
- else
- fprintf (asmfile, ";-1;");
-}
-
-/* Output a reference to a type. If the type has not yet been
- described in the dbx output, output its definition now.
- For a type already defined, just refer to its definition
- using the type number.
-
- If FULL is nonzero, and the type has been described only with
- a forward-reference, output the definition now.
- If FULL is zero in this case, just refer to the forward-reference
- using the number previously allocated.
-
- If SHOW_ARG_TYPES is nonzero, we output a description of the argument
- types for a METHOD_TYPE. */
-
-static void
-dbxout_type (type, full, show_arg_types)
- tree type;
- int full;
- int show_arg_types;
-{
- register tree tem;
- static int anonymous_type_number = 0;
-
- /* If there was an input error and we don't really have a type,
- avoid crashing and write something that is at least valid
- by assuming `int'. */
- if (type == error_mark_node)
- type = integer_type_node;
- else
- {
- /* Try to find the "main variant" with the same name but not const
- or volatile. (Since stabs does not distinguish const and volatile,
- there is no need to make them separate types. But types with
- different names are usefully distinguished.) */
-
- for (tem = TYPE_MAIN_VARIANT (type); tem; tem = TYPE_NEXT_VARIANT (tem))
- if (!TYPE_READONLY (tem) && !TYPE_VOLATILE (tem)
- && TYPE_NAME (tem) == TYPE_NAME (type))
- {
- type = tem;
- break;
- }
- if (TYPE_NAME (type)
- && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)))
- full = 0;
- }
-
- if (TYPE_SYMTAB_ADDRESS (type) == 0)
- {
- /* Type has no dbx number assigned. Assign next available number. */
- TYPE_SYMTAB_ADDRESS (type) = next_type_number++;
-
- /* Make sure type vector is long enough to record about this type. */
-
- if (next_type_number == typevec_len)
- {
- typevec =
- (struct typeinfo *) xrealloc (typevec,
- typevec_len * 2 * sizeof typevec[0]);
- bzero ((char *) (typevec + typevec_len),
- typevec_len * sizeof typevec[0]);
- typevec_len *= 2;
- }
-
-#ifdef DBX_USE_BINCL
- typevec[TYPE_SYMTAB_ADDRESS (type)].file_number =
- current_file->file_number;
- typevec[TYPE_SYMTAB_ADDRESS (type)].type_number =
- current_file->next_type_number++;
-#endif
- }
-
- /* Output the number of this type, to refer to it. */
- dbxout_type_index (type);
-
-#ifdef DBX_TYPE_DEFINED
- if (DBX_TYPE_DEFINED (type))
- return;
-#endif
-
- /* If this type's definition has been output or is now being output,
- that is all. */
-
- switch (typevec[TYPE_SYMTAB_ADDRESS (type)].status)
- {
- case TYPE_UNSEEN:
- break;
- case TYPE_XREF:
- /* If we have already had a cross reference,
- and either that's all we want or that's the best we could do,
- don't repeat the cross reference.
- Sun dbx crashes if we do. */
- if (! full || TYPE_SIZE (type) == 0
- /* No way in DBX fmt to describe a variable size. */
- || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- return;
- break;
- case TYPE_DEFINED:
- return;
- }
-
-#ifdef DBX_NO_XREFS
- /* For systems where dbx output does not allow the `=xsNAME:' syntax,
- leave the type-number completely undefined rather than output
- a cross-reference. If we have already used GNU debug info extensions,
- then it is OK to output a cross reference. This is necessary to get
- proper C++ debug output. */
- if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE
- || TREE_CODE (type) == QUAL_UNION_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE)
- && ! use_gnu_debug_info_extensions)
- /* We must use the same test here as we use twice below when deciding
- whether to emit a cross-reference. */
- if ((TYPE_NAME (type) != 0
- && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_IGNORED_P (TYPE_NAME (type)))
- && !full)
- || TYPE_SIZE (type) == 0
- /* No way in DBX fmt to describe a variable size. */
- || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- {
- typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
- return;
- }
-#endif
-
- /* Output a definition now. */
-
- fprintf (asmfile, "=");
- CHARS (1);
-
- /* Mark it as defined, so that if it is self-referent
- we will not get into an infinite recursion of definitions. */
-
- typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_DEFINED;
-
- if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
- {
- dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0, 0);
- return;
- }
-
- switch (TREE_CODE (type))
- {
- case VOID_TYPE:
- case LANG_TYPE:
- /* For a void type, just define it as itself; ie, "5=5".
- This makes us consider it defined
- without saying what it is. The debugger will make it
- a void type when the reference is seen, and nothing will
- ever override that default. */
- dbxout_type_index (type);
- break;
-
- case INTEGER_TYPE:
- if (type == char_type_node && ! TREE_UNSIGNED (type))
- {
- /* Output the type `char' as a subrange of itself!
- I don't understand this definition, just copied it
- from the output of pcc.
- This used to use `r2' explicitly and we used to
- take care to make sure that `char' was type number 2. */
- fprintf (asmfile, "r");
- dbxout_type_index (type);
- fprintf (asmfile, ";0;127;");
- }
- else if (use_gnu_debug_info_extensions
- && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
- || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT))
- {
- /* This used to say `r1' and we used to take care
- to make sure that `int' was type number 1. */
- fprintf (asmfile, "r");
- dbxout_type_index (integer_type_node);
- fprintf (asmfile, ";");
- print_int_cst_octal (TYPE_MIN_VALUE (type));
- fprintf (asmfile, ";");
- print_int_cst_octal (TYPE_MAX_VALUE (type));
- fprintf (asmfile, ";");
- }
- else /* Output other integer types as subranges of `int'. */
- dbxout_range_type (type);
- CHARS (22);
- break;
-
- case REAL_TYPE:
- /* This used to say `r1' and we used to take care
- to make sure that `int' was type number 1. */
- fprintf (asmfile, "r");
- dbxout_type_index (integer_type_node);
- fprintf (asmfile, ";%d;0;", int_size_in_bytes (type));
- CHARS (13);
- break;
-
- case CHAR_TYPE:
- if (use_gnu_debug_info_extensions)
- fprintf (asmfile, "@s%d;-20;",
- BITS_PER_UNIT * int_size_in_bytes (type));
- else
- {
- /* Output the type `char' as a subrange of itself.
- That is what pcc seems to do. */
- fprintf (asmfile, "r");
- dbxout_type_index (char_type_node);
- fprintf (asmfile, ";0;%d;", TREE_UNSIGNED (type) ? 255 : 127);
- }
- CHARS (9);
- break;
-
- case BOOLEAN_TYPE:
- if (use_gnu_debug_info_extensions)
- fprintf (asmfile, "@s%d;-16;",
- BITS_PER_UNIT * int_size_in_bytes (type));
- else /* Define as enumeral type (False, True) */
- fprintf (asmfile, "eFalse:0,True:1,;");
- CHARS (17);
- break;
-
- case FILE_TYPE:
- putc ('d', asmfile);
- CHARS (1);
- dbxout_type (TREE_TYPE (type), 0, 0);
- break;
-
- case COMPLEX_TYPE:
- /* Differs from the REAL_TYPE by its new data type number */
-
- if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
- {
- fprintf (asmfile, "r");
- dbxout_type_index (type);
- fprintf (asmfile, ";%d;0;",
- int_size_in_bytes (TREE_TYPE (type)));
- CHARS (12); /* The number is probably incorrect here. */
- }
- else
- {
- /* Output a complex integer type as a structure,
- pending some other way to do it. */
- fprintf (asmfile, "s%d", int_size_in_bytes (type));
-
- fprintf (asmfile, "real:");
- CHARS (10);
- dbxout_type (TREE_TYPE (type), 0, 0);
- fprintf (asmfile, ",%d,%d;",
- 0, TYPE_PRECISION (TREE_TYPE (type)));
- CHARS (8);
- fprintf (asmfile, "imag:");
- CHARS (5);
- dbxout_type (TREE_TYPE (type), 0, 0);
- fprintf (asmfile, ",%d,%d;;",
- TYPE_PRECISION (TREE_TYPE (type)),
- TYPE_PRECISION (TREE_TYPE (type)));
- CHARS (9);
- }
- break;
-
- case SET_TYPE:
- if (use_gnu_debug_info_extensions)
- {
- have_used_extensions = 1;
- fprintf (asmfile, "@s%d;",
- BITS_PER_UNIT * int_size_in_bytes (type));
- /* Check if a bitstring type, which in Chill is
- different from a [power]set. */
- if (TYPE_STRING_FLAG (type))
- fprintf (asmfile, "@S;");
- }
- putc ('S', asmfile);
- CHARS (1);
- dbxout_type (TYPE_DOMAIN (type), 0, 0);
- break;
-
- case ARRAY_TYPE:
- /* Output "a" followed by a range type definition
- for the index type of the array
- followed by a reference to the target-type.
- ar1;0;N;M for a C array of type M and size N+1. */
- /* Check if a character string type, which in Chill is
- different from an array of characters. */
- if (TYPE_STRING_FLAG (type) && use_gnu_debug_info_extensions)
- {
- have_used_extensions = 1;
- fprintf (asmfile, "@S;");
- }
- tem = TYPE_DOMAIN (type);
- if (tem == NULL)
- {
- fprintf (asmfile, "ar");
- dbxout_type_index (integer_type_node);
- fprintf (asmfile, ";0;-1;");
- }
- else
- {
- fprintf (asmfile, "a");
- dbxout_range_type (tem);
- }
- CHARS (14);
- dbxout_type (TREE_TYPE (type), 0, 0);
- break;
-
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- {
- int i, n_baseclasses = 0;
-
- if (TYPE_BINFO (type) != 0 && TYPE_BINFO_BASETYPES (type) != 0)
- n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
-
- /* Output a structure type. We must use the same test here as we
- use in the DBX_NO_XREFS case above. */
- if ((TYPE_NAME (type) != 0
- && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_IGNORED_P (TYPE_NAME (type)))
- && !full)
- || TYPE_SIZE (type) == 0
- /* No way in DBX fmt to describe a variable size. */
- || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- {
- /* If the type is just a cross reference, output one
- and mark the type as partially described.
- If it later becomes defined, we will output
- its real definition.
- If the type has a name, don't nest its definition within
- another type's definition; instead, output an xref
- and let the definition come when the name is defined. */
- fprintf (asmfile, (TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu");
- CHARS (3);
-#if 0 /* This assertion is legitimately false in C++. */
- /* We shouldn't be outputting a reference to a type before its
- definition unless the type has a tag name.
- A typedef name without a tag name should be impossible. */
- if (TREE_CODE (TYPE_NAME (type)) != IDENTIFIER_NODE)
- abort ();
-#endif
- if (TYPE_NAME (type) != 0)
- dbxout_type_name (type);
- else
- fprintf (asmfile, "$$%d", anonymous_type_number++);
- fprintf (asmfile, ":");
- typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
- break;
- }
-
- /* Identify record or union, and print its size. */
- fprintf (asmfile, (TREE_CODE (type) == RECORD_TYPE) ? "s%d" : "u%d",
- int_size_in_bytes (type));
-
- if (use_gnu_debug_info_extensions)
- {
- if (n_baseclasses)
- {
- have_used_extensions = 1;
- fprintf (asmfile, "!%d,", n_baseclasses);
- CHARS (8);
- }
- }
- for (i = 0; i < n_baseclasses; i++)
- {
- tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)), i);
- if (use_gnu_debug_info_extensions)
- {
- have_used_extensions = 1;
- putc (TREE_VIA_VIRTUAL (child) ? '1'
- : '0',
- asmfile);
- putc (TREE_VIA_PUBLIC (child) ? '2'
- : '0',
- asmfile);
- fprintf (asmfile, "%d,",
- TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT);
- CHARS (15);
- dbxout_type (BINFO_TYPE (child), 0, 0);
- putc (';', asmfile);
- }
- else
- {
- /* Print out the base class information with fields
- which have the same names at the types they hold. */
- dbxout_type_name (BINFO_TYPE (child));
- putc (':', asmfile);
- dbxout_type (BINFO_TYPE (child), full, 0);
- fprintf (asmfile, ",%d,%d;",
- TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT,
- TREE_INT_CST_LOW (DECL_SIZE (TYPE_NAME (BINFO_TYPE (child)))) * BITS_PER_UNIT);
- CHARS (20);
- }
- }
- }
-
- CHARS (11);
-
- /* Write out the field declarations. */
- dbxout_type_fields (type);
- if (use_gnu_debug_info_extensions && TYPE_METHODS (type) != NULL_TREE)
- {
- have_used_extensions = 1;
- dbxout_type_methods (type);
- }
- putc (';', asmfile);
-
- if (use_gnu_debug_info_extensions && TREE_CODE (type) == RECORD_TYPE
- /* Avoid the ~ if we don't really need it--it confuses dbx. */
- && TYPE_VFIELD (type))
- {
- have_used_extensions = 1;
-
- /* Tell GDB+ that it may keep reading. */
- putc ('~', asmfile);
-
- /* We need to write out info about what field this class
- uses as its "main" vtable pointer field, because if this
- field is inherited from a base class, GDB cannot necessarily
- figure out which field it's using in time. */
- if (TYPE_VFIELD (type))
- {
- putc ('%', asmfile);
- dbxout_type (DECL_FCONTEXT (TYPE_VFIELD (type)), 0, 0);
- }
- putc (';', asmfile);
- CHARS (3);
- }
- break;
-
- case ENUMERAL_TYPE:
- /* We must use the same test here as we use in the DBX_NO_XREFS case
- above. We simplify it a bit since an enum will never have a variable
- size. */
- if ((TYPE_NAME (type) != 0
- && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_IGNORED_P (TYPE_NAME (type)))
- && !full)
- || TYPE_SIZE (type) == 0)
- {
- fprintf (asmfile, "xe");
- CHARS (3);
- dbxout_type_name (type);
- typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_XREF;
- fprintf (asmfile, ":");
- return;
- }
-#ifdef DBX_OUTPUT_ENUM
- DBX_OUTPUT_ENUM (asmfile, type);
-#else
- if (use_gnu_debug_info_extensions
- && TYPE_PRECISION (type) != TYPE_PRECISION (integer_type_node))
- fprintf (asmfile, "@s%d;", TYPE_PRECISION (type));
- putc ('e', asmfile);
- CHARS (1);
- for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem))
- {
- fprintf (asmfile, "%s:", IDENTIFIER_POINTER (TREE_PURPOSE (tem)));
- if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == 0)
- fprintf (asmfile, "%lu",
- (unsigned long) TREE_INT_CST_LOW (TREE_VALUE (tem)));
- else if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == -1
- && TREE_INT_CST_LOW (TREE_VALUE (tem)) < 0)
- fprintf (asmfile, "%ld",
- (long) TREE_INT_CST_LOW (TREE_VALUE (tem)));
- else
- print_int_cst_octal (TREE_VALUE (tem));
- fprintf (asmfile, ",");
- CHARS (20 + IDENTIFIER_LENGTH (TREE_PURPOSE (tem)));
- if (TREE_CHAIN (tem) != 0)
- CONTIN;
- }
- putc (';', asmfile);
- CHARS (1);
-#endif
- break;
-
- case POINTER_TYPE:
- putc ('*', asmfile);
- CHARS (1);
- dbxout_type (TREE_TYPE (type), 0, 0);
- break;
-
- case METHOD_TYPE:
- if (use_gnu_debug_info_extensions)
- {
- have_used_extensions = 1;
- putc ('#', asmfile);
- CHARS (1);
- if (flag_minimal_debug && !show_arg_types)
- {
- /* Normally, just output the return type.
- The argument types are encoded in the method name. */
- putc ('#', asmfile);
- CHARS (1);
- dbxout_type (TREE_TYPE (type), 0, 0);
- putc (';', asmfile);
- CHARS (1);
- }
- else
- {
- /* When outputting destructors, we need to write
- the argument types out longhand. */
- dbxout_type (TYPE_METHOD_BASETYPE (type), 0, 0);
- putc (',', asmfile);
- CHARS (1);
- dbxout_type (TREE_TYPE (type), 0, 0);
- dbxout_args (TYPE_ARG_TYPES (type));
- putc (';', asmfile);
- CHARS (1);
- }
- }
- else
- {
- /* Treat it as a function type. */
- dbxout_type (TREE_TYPE (type), 0, 0);
- }
- break;
-
- case OFFSET_TYPE:
- if (use_gnu_debug_info_extensions)
- {
- have_used_extensions = 1;
- putc ('@', asmfile);
- CHARS (1);
- dbxout_type (TYPE_OFFSET_BASETYPE (type), 0, 0);
- putc (',', asmfile);
- CHARS (1);
- dbxout_type (TREE_TYPE (type), 0, 0);
- }
- else
- {
- /* Should print as an int, because it is really
- just an offset. */
- dbxout_type (integer_type_node, 0, 0);
- }
- break;
-
- case REFERENCE_TYPE:
- if (use_gnu_debug_info_extensions)
- have_used_extensions = 1;
- putc (use_gnu_debug_info_extensions ? '&' : '*', asmfile);
- CHARS (1);
- dbxout_type (TREE_TYPE (type), 0, 0);
- break;
-
- case FUNCTION_TYPE:
- putc ('f', asmfile);
- CHARS (1);
- dbxout_type (TREE_TYPE (type), 0, 0);
- break;
-
- default:
- abort ();
- }
-}
-
-/* Print the value of integer constant C, in octal,
- handling double precision. */
-
-static void
-print_int_cst_octal (c)
- tree c;
-{
- unsigned HOST_WIDE_INT high = TREE_INT_CST_HIGH (c);
- unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (c);
- int excess = (3 - (HOST_BITS_PER_WIDE_INT % 3));
- int width = TYPE_PRECISION (TREE_TYPE (c));
-
- /* GDB wants constants with no extra leading "1" bits, so
- we need to remove any sign-extension that might be
- present. */
- if (width == HOST_BITS_PER_WIDE_INT * 2)
- ;
- else if (width > HOST_BITS_PER_WIDE_INT)
- high &= (((HOST_WIDE_INT) 1 << (width - HOST_BITS_PER_WIDE_INT)) - 1);
- else if (width == HOST_BITS_PER_WIDE_INT)
- high = 0;
- else
- high = 0, low &= (((HOST_WIDE_INT) 1 << width) - 1);
-
- fprintf (asmfile, "0");
-
- if (excess == 3)
- {
- print_octal (high, HOST_BITS_PER_WIDE_INT / 3);
- print_octal (low, HOST_BITS_PER_WIDE_INT / 3);
- }
- else
- {
- unsigned HOST_WIDE_INT beg = high >> excess;
- unsigned HOST_WIDE_INT middle
- = ((high & (((HOST_WIDE_INT) 1 << excess) - 1)) << (3 - excess)
- | (low >> (HOST_BITS_PER_WIDE_INT / 3 * 3)));
- unsigned HOST_WIDE_INT end
- = low & (((unsigned HOST_WIDE_INT) 1
- << (HOST_BITS_PER_WIDE_INT / 3 * 3))
- - 1);
-
- fprintf (asmfile, "%o%01o", beg, middle);
- print_octal (end, HOST_BITS_PER_WIDE_INT / 3);
- }
-}
-
-static void
-print_octal (value, digits)
- unsigned HOST_WIDE_INT value;
- int digits;
-{
- int i;
-
- for (i = digits - 1; i >= 0; i--)
- fprintf (asmfile, "%01o", ((value >> (3 * i)) & 7));
-}
-
-/* Output the name of type TYPE, with no punctuation.
- Such names can be set up either by typedef declarations
- or by struct, enum and union tags. */
-
-static void
-dbxout_type_name (type)
- register tree type;
-{
- tree t;
- if (TYPE_NAME (type) == 0)
- abort ();
- if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- {
- t = TYPE_NAME (type);
- }
- else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
- {
- t = DECL_NAME (TYPE_NAME (type));
- }
- else
- abort ();
-
- fprintf (asmfile, "%s", IDENTIFIER_POINTER (t));
- CHARS (IDENTIFIER_LENGTH (t));
-}
-
-/* Output a .stabs for the symbol defined by DECL,
- which must be a ..._DECL node in the normal namespace.
- It may be a CONST_DECL, a FUNCTION_DECL, a PARM_DECL or a VAR_DECL.
- LOCAL is nonzero if the scope is less than the entire file. */
-
-void
-dbxout_symbol (decl, local)
- tree decl;
- int local;
-{
- tree type = TREE_TYPE (decl);
- tree context = NULL_TREE;
-
- /* Cast avoids warning in old compilers. */
- current_sym_code = (STAB_CODE_TYPE) 0;
- current_sym_value = 0;
- current_sym_addr = 0;
-
- /* Ignore nameless syms, but don't ignore type tags. */
-
- if ((DECL_NAME (decl) == 0 && TREE_CODE (decl) != TYPE_DECL)
- || DECL_IGNORED_P (decl))
- return;
-
- dbxout_prepare_symbol (decl);
-
- /* The output will always start with the symbol name,
- so always count that in the length-output-so-far. */
-
- if (DECL_NAME (decl) != 0)
- current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (decl));
-
- switch (TREE_CODE (decl))
- {
- case CONST_DECL:
- /* Enum values are defined by defining the enum type. */
- break;
-
- case FUNCTION_DECL:
- if (DECL_RTL (decl) == 0)
- return;
- if (DECL_EXTERNAL (decl))
- break;
- /* Don't mention a nested function under its parent. */
- context = decl_function_context (decl);
- if (context == current_function_decl)
- break;
- if (GET_CODE (DECL_RTL (decl)) != MEM
- || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
- break;
- FORCE_TEXT;
-
- fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
- TREE_PUBLIC (decl) ? 'F' : 'f');
-
- current_sym_code = N_FUN;
- current_sym_addr = XEXP (DECL_RTL (decl), 0);
-
- if (TREE_TYPE (type))
- dbxout_type (TREE_TYPE (type), 0, 0);
- else
- dbxout_type (void_type_node, 0, 0);
-
- /* For a nested function, when that function is compiled,
- mention the containing function name
- as well as (since dbx wants it) our own assembler-name. */
- if (context != 0)
- fprintf (asmfile, ",%s,%s",
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
- IDENTIFIER_POINTER (DECL_NAME (context)));
-
- dbxout_finish_symbol (decl);
- break;
-
- case TYPE_DECL:
-#if 0
- /* This seems all wrong. Outputting most kinds of types gives no name
- at all. A true definition gives no name; a cross-ref for a
- structure can give the tag name, but not a type name.
- It seems that no typedef name is defined by outputting a type. */
-
- /* If this typedef name was defined by outputting the type,
- don't duplicate it. */
- if (typevec[TYPE_SYMTAB_ADDRESS (type)].status == TYPE_DEFINED
- && TYPE_NAME (TREE_TYPE (decl)) == decl)
- return;
-#endif
- /* Don't output the same typedef twice.
- And don't output what language-specific stuff doesn't want output. */
- if (TREE_ASM_WRITTEN (decl) || TYPE_DECL_SUPPRESS_DEBUG (decl))
- return;
-
- FORCE_TEXT;
-
- {
- int tag_needed = 1;
- int did_output = 0;
-
- if (DECL_NAME (decl))
- {
- /* Nonzero means we must output a tag as well as a typedef. */
- tag_needed = 0;
-
- /* Handle the case of a C++ structure or union
- where the TYPE_NAME is a TYPE_DECL
- which gives both a typedef name and a tag. */
- /* dbx requires the tag first and the typedef second. */
- if ((TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE
- || TREE_CODE (type) == QUAL_UNION_TYPE)
- && TYPE_NAME (type) == decl
- && !(use_gnu_debug_info_extensions && have_used_extensions)
- && !TREE_ASM_WRITTEN (TYPE_NAME (type))
- /* Distinguish the implicit typedefs of C++
- from explicit ones that might be found in C. */
- && DECL_ARTIFICIAL (decl))
- {
- tree name = TYPE_NAME (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
-
- current_sym_code = DBX_TYPE_DECL_STABS_CODE;
- current_sym_value = 0;
- current_sym_addr = 0;
- current_sym_nchars = 2 + IDENTIFIER_LENGTH (name);
-
- fprintf (asmfile, "%s \"%s:T", ASM_STABS_OP,
- IDENTIFIER_POINTER (name));
- dbxout_type (type, 1, 0);
- dbxout_finish_symbol (NULL_TREE);
- }
-
- /* Output typedef name. */
- fprintf (asmfile, "%s \"%s:", ASM_STABS_OP,
- IDENTIFIER_POINTER (DECL_NAME (decl)));
-
- /* Short cut way to output a tag also. */
- if ((TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE
- || TREE_CODE (type) == QUAL_UNION_TYPE)
- && TYPE_NAME (type) == decl
- /* Distinguish the implicit typedefs of C++
- from explicit ones that might be found in C. */
- && DECL_ARTIFICIAL (decl))
- {
- if (use_gnu_debug_info_extensions && have_used_extensions)
- {
- putc ('T', asmfile);
- TREE_ASM_WRITTEN (TYPE_NAME (type)) = 1;
- }
-#if 0 /* Now we generate the tag for this case up above. */
- else
- tag_needed = 1;
-#endif
- }
-
- putc ('t', asmfile);
- current_sym_code = DBX_TYPE_DECL_STABS_CODE;
-
- dbxout_type (type, 1, 0);
- dbxout_finish_symbol (decl);
- did_output = 1;
- }
-
- /* Don't output a tag if this is an incomplete type (TYPE_SIZE is
- zero). This prevents the sun4 Sun OS 4.x dbx from crashing. */
-
- if (tag_needed && TYPE_NAME (type) != 0
- && (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE
- || (DECL_NAME (TYPE_NAME (type)) != 0))
- && TYPE_SIZE (type) != 0
- && !TREE_ASM_WRITTEN (TYPE_NAME (type)))
- {
- /* For a TYPE_DECL with no name, but the type has a name,
- output a tag.
- This is what represents `struct foo' with no typedef. */
- /* In C++, the name of a type is the corresponding typedef.
- In C, it is an IDENTIFIER_NODE. */
- tree name = TYPE_NAME (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
-
- current_sym_code = DBX_TYPE_DECL_STABS_CODE;
- current_sym_value = 0;
- current_sym_addr = 0;
- current_sym_nchars = 2 + IDENTIFIER_LENGTH (name);
-
- fprintf (asmfile, "%s \"%s:T", ASM_STABS_OP,
- IDENTIFIER_POINTER (name));
- dbxout_type (type, 1, 0);
- dbxout_finish_symbol (NULL_TREE);
- did_output = 1;
- }
-
- /* If an enum type has no name, it cannot be referred to,
- but we must output it anyway, since the enumeration constants
- can be referred to. */
- if (!did_output && TREE_CODE (type) == ENUMERAL_TYPE)
- {
- current_sym_code = DBX_TYPE_DECL_STABS_CODE;
- current_sym_value = 0;
- current_sym_addr = 0;
- current_sym_nchars = 2;
-
- /* Some debuggers fail when given NULL names, so give this a
- harmless name of ` '. */
- fprintf (asmfile, "%s \" :T", ASM_STABS_OP);
- dbxout_type (type, 1, 0);
- dbxout_finish_symbol (NULL_TREE);
- }
-
- /* Prevent duplicate output of a typedef. */
- TREE_ASM_WRITTEN (decl) = 1;
- break;
- }
-
- case PARM_DECL:
- /* Parm decls go in their own separate chains
- and are output by dbxout_reg_parms and dbxout_parms. */
- abort ();
-
- case RESULT_DECL:
- /* Named return value, treat like a VAR_DECL. */
- case VAR_DECL:
- if (DECL_RTL (decl) == 0)
- return;
- /* Don't mention a variable that is external.
- Let the file that defines it describe it. */
- if (DECL_EXTERNAL (decl))
- break;
-
- /* If the variable is really a constant
- and not written in memory, inform the debugger. */
- if (TREE_STATIC (decl) && TREE_READONLY (decl)
- && DECL_INITIAL (decl) != 0
- && ! TREE_ASM_WRITTEN (decl)
- && (DECL_FIELD_CONTEXT (decl) == NULL_TREE
- || TREE_CODE (DECL_FIELD_CONTEXT (decl)) == BLOCK))
- {
- if (TREE_PUBLIC (decl) == 0)
- {
- /* The sun4 assembler does not grok this. */
- char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
- if (TREE_CODE (TREE_TYPE (decl)) == INTEGER_TYPE
- || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
- {
- HOST_WIDE_INT ival = TREE_INT_CST_LOW (DECL_INITIAL (decl));
-#ifdef DBX_OUTPUT_CONSTANT_SYMBOL
- DBX_OUTPUT_CONSTANT_SYMBOL (asmfile, name, ival);
-#else
- fprintf (asmfile, "%s \"%s:c=i%d\",0x%x,0,0,0\n",
- ASM_STABS_OP, name, ival, N_LSYM);
-#endif
- return;
- }
- else if (TREE_CODE (TREE_TYPE (decl)) == REAL_TYPE)
- {
- /* don't know how to do this yet. */
- }
- break;
- }
- /* else it is something we handle like a normal variable. */
- }
-
- DECL_RTL (decl) = eliminate_regs (DECL_RTL (decl), 0, NULL_RTX, 0);
-#ifdef LEAF_REG_REMAP
- if (leaf_function)
- leaf_renumber_regs_insn (DECL_RTL (decl));
-#endif
-
- dbxout_symbol_location (decl, type, 0, DECL_RTL (decl));
- }
-}
-
-/* Output the stab for DECL, a VAR_DECL, RESULT_DECL or PARM_DECL.
- Add SUFFIX to its name, if SUFFIX is not 0.
- Describe the variable as residing in HOME
- (usually HOME is DECL_RTL (DECL), but not always). */
-
-static void
-dbxout_symbol_location (decl, type, suffix, home)
- tree decl, type;
- char *suffix;
- rtx home;
-{
- int letter = 0;
- int regno = -1;
-
- /* Don't mention a variable at all
- if it was completely optimized into nothingness.
-
- If the decl was from an inline function, then it's rtl
- is not identically the rtl that was used in this
- particular compilation. */
- if (GET_CODE (home) == REG)
- {
- regno = REGNO (home);
- if (regno >= FIRST_PSEUDO_REGISTER)
- return;
- }
- else if (GET_CODE (home) == SUBREG)
- {
- rtx value = home;
- int offset = 0;
- while (GET_CODE (value) == SUBREG)
- {
- offset += SUBREG_WORD (value);
- value = SUBREG_REG (value);
- }
- if (GET_CODE (value) == REG)
- {
- regno = REGNO (value);
- if (regno >= FIRST_PSEUDO_REGISTER)
- return;
- regno += offset;
- }
- alter_subreg (home);
- }
-
- /* The kind-of-variable letter depends on where
- the variable is and on the scope of its name:
- G and N_GSYM for static storage and global scope,
- S for static storage and file scope,
- V for static storage and local scope,
- for those two, use N_LCSYM if data is in bss segment,
- N_STSYM if in data segment, N_FUN otherwise.
- (We used N_FUN originally, then changed to N_STSYM
- to please GDB. However, it seems that confused ld.
- Now GDB has been fixed to like N_FUN, says Kingdon.)
- no letter at all, and N_LSYM, for auto variable,
- r and N_RSYM for register variable. */
-
- if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == SYMBOL_REF)
- {
- if (TREE_PUBLIC (decl))
- {
- letter = 'G';
- current_sym_code = N_GSYM;
- }
- else
- {
- current_sym_addr = XEXP (home, 0);
-
- letter = decl_function_context (decl) ? 'V' : 'S';
-
- /* This should be the same condition as in assemble_variable, but
- we don't have access to dont_output_data here. So, instead,
- we rely on the fact that error_mark_node initializers always
- end up in bss for C++ and never end up in bss for C. */
- if (DECL_INITIAL (decl) == 0
- || (!strcmp (lang_identify (), "cplusplus")
- && DECL_INITIAL (decl) == error_mark_node))
- current_sym_code = N_LCSYM;
- else if (DECL_IN_TEXT_SECTION (decl))
- /* This is not quite right, but it's the closest
- of all the codes that Unix defines. */
- current_sym_code = DBX_STATIC_CONST_VAR_CODE;
- else
- {
- /* Ultrix `as' seems to need this. */
-#ifdef DBX_STATIC_STAB_DATA_SECTION
- data_section ();
-#endif
- current_sym_code = N_STSYM;
- }
- }
- }
- else if (regno >= 0)
- {
- letter = 'r';
- current_sym_code = N_RSYM;
- current_sym_value = DBX_REGISTER_NUMBER (regno);
- }
- else if (GET_CODE (home) == MEM
- && (GET_CODE (XEXP (home, 0)) == MEM
- || (GET_CODE (XEXP (home, 0)) == REG
- && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM)))
- /* If the value is indirect by memory or by a register
- that isn't the frame pointer
- then it means the object is variable-sized and address through
- that register or stack slot. DBX has no way to represent this
- so all we can do is output the variable as a pointer.
- If it's not a parameter, ignore it.
- (VAR_DECLs like this can be made by integrate.c.) */
- {
- if (GET_CODE (XEXP (home, 0)) == REG)
- {
- letter = 'r';
- current_sym_code = N_RSYM;
- current_sym_value = DBX_REGISTER_NUMBER (REGNO (XEXP (home, 0)));
- }
- else
- {
- current_sym_code = N_LSYM;
- /* RTL looks like (MEM (MEM (PLUS (REG...) (CONST_INT...)))).
- We want the value of that CONST_INT. */
- current_sym_value
- = DEBUGGER_AUTO_OFFSET (XEXP (XEXP (home, 0), 0));
- }
-
- /* Effectively do build_pointer_type, but don't cache this type,
- since it might be temporary whereas the type it points to
- might have been saved for inlining. */
- /* Don't use REFERENCE_TYPE because dbx can't handle that. */
- type = make_node (POINTER_TYPE);
- TREE_TYPE (type) = TREE_TYPE (decl);
- }
- else if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == REG)
- {
- current_sym_code = N_LSYM;
- current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
- }
- else if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT)
- {
- current_sym_code = N_LSYM;
- /* RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
- We want the value of that CONST_INT. */
- current_sym_value = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
- }
- else if (GET_CODE (home) == MEM
- && GET_CODE (XEXP (home, 0)) == CONST)
- {
- /* Handle an obscure case which can arise when optimizing and
- when there are few available registers. (This is *always*
- the case for i386/i486 targets). The RTL looks like
- (MEM (CONST ...)) even though this variable is a local `auto'
- or a local `register' variable. In effect, what has happened
- is that the reload pass has seen that all assignments and
- references for one such a local variable can be replaced by
- equivalent assignments and references to some static storage
- variable, thereby avoiding the need for a register. In such
- cases we're forced to lie to debuggers and tell them that
- this variable was itself `static'. */
- current_sym_code = N_LCSYM;
- letter = 'V';
- current_sym_addr = XEXP (XEXP (home, 0), 0);
- }
- else if (GET_CODE (home) == CONCAT)
- {
- tree subtype = TREE_TYPE (type);
-
- /* If the variable's storage is in two parts,
- output each as a separate stab with a modified name. */
- if (WORDS_BIG_ENDIAN)
- dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 0));
- else
- dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 0));
-
- /* Cast avoids warning in old compilers. */
- current_sym_code = (STAB_CODE_TYPE) 0;
- current_sym_value = 0;
- current_sym_addr = 0;
- dbxout_prepare_symbol (decl);
-
- if (WORDS_BIG_ENDIAN)
- dbxout_symbol_location (decl, subtype, "$real", XEXP (home, 1));
- else
- dbxout_symbol_location (decl, subtype, "$imag", XEXP (home, 1));
- return;
- }
- else
- /* Address might be a MEM, when DECL is a variable-sized object.
- Or it might be const0_rtx, meaning previous passes
- want us to ignore this variable. */
- return;
-
- /* Ok, start a symtab entry and output the variable name. */
- FORCE_TEXT;
-
-#ifdef DBX_STATIC_BLOCK_START
- DBX_STATIC_BLOCK_START (asmfile, current_sym_code);
-#endif
-
- dbxout_symbol_name (decl, suffix, letter);
- dbxout_type (type, 0, 0);
- dbxout_finish_symbol (decl);
-
-#ifdef DBX_STATIC_BLOCK_END
- DBX_STATIC_BLOCK_END (asmfile, current_sym_code);
-#endif
-}
-
-/* Output the symbol name of DECL for a stabs, with suffix SUFFIX.
- Then output LETTER to indicate the kind of location the symbol has. */
-
-static void
-dbxout_symbol_name (decl, suffix, letter)
- tree decl;
- char *suffix;
- int letter;
-{
- /* One slight hitch: if this is a VAR_DECL which is a static
- class member, we must put out the mangled name instead of the
- DECL_NAME. Note also that static member (variable) names DO NOT begin
- with underscores in .stabs directives. */
- char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
- if (name == 0)
- name = "(anon)";
- fprintf (asmfile, "%s \"%s%s:", ASM_STABS_OP, name,
- (suffix ? suffix : ""));
-
- if (letter) putc (letter, asmfile);
-}
-
-static void
-dbxout_prepare_symbol (decl)
- tree decl;
-{
-#ifdef WINNING_GDB
- char *filename = DECL_SOURCE_FILE (decl);
-
- dbxout_source_file (asmfile, filename);
-#endif
-}
-
-static void
-dbxout_finish_symbol (sym)
- tree sym;
-{
-#ifdef DBX_FINISH_SYMBOL
- DBX_FINISH_SYMBOL (sym);
-#else
- int line = 0;
- if (use_gnu_debug_info_extensions && sym != 0)
- line = DECL_SOURCE_LINE (sym);
-
- fprintf (asmfile, "\",%d,0,%d,", current_sym_code, line);
- if (current_sym_addr)
- output_addr_const (asmfile, current_sym_addr);
- else
- fprintf (asmfile, "%d", current_sym_value);
- putc ('\n', asmfile);
-#endif
-}
-
-/* Output definitions of all the decls in a chain. */
-
-void
-dbxout_syms (syms)
- tree syms;
-{
- while (syms)
- {
- dbxout_symbol (syms, 1);
- syms = TREE_CHAIN (syms);
- }
-}
-
-/* The following two functions output definitions of function parameters.
- Each parameter gets a definition locating it in the parameter list.
- Each parameter that is a register variable gets a second definition
- locating it in the register.
-
- Printing or argument lists in gdb uses the definitions that
- locate in the parameter list. But reference to the variable in
- expressions uses preferentially the definition as a register. */
-
-/* Output definitions, referring to storage in the parmlist,
- of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
-
-void
-dbxout_parms (parms)
- tree parms;
-{
- for (; parms; parms = TREE_CHAIN (parms))
- if (DECL_NAME (parms) && TREE_TYPE (parms) != error_mark_node)
- {
- dbxout_prepare_symbol (parms);
-
- /* Perform any necessary register eliminations on the parameter's rtl,
- so that the debugging output will be accurate. */
- DECL_INCOMING_RTL (parms)
- = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX, 0);
- DECL_RTL (parms) = eliminate_regs (DECL_RTL (parms), 0, NULL_RTX, 0);
-#ifdef LEAF_REG_REMAP
- if (leaf_function)
- {
- leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms));
- leaf_renumber_regs_insn (DECL_RTL (parms));
- }
-#endif
-
- if (PARM_PASSED_IN_MEMORY (parms))
- {
- rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0);
-
- /* ??? Here we assume that the parm address is indexed
- off the frame pointer or arg pointer.
- If that is not true, we produce meaningless results,
- but do not crash. */
- if (GET_CODE (addr) == PLUS
- && GET_CODE (XEXP (addr, 1)) == CONST_INT)
- current_sym_value = INTVAL (XEXP (addr, 1));
- else
- current_sym_value = 0;
-
- current_sym_code = N_PSYM;
- current_sym_addr = 0;
-
- FORCE_TEXT;
- if (DECL_NAME (parms))
- {
- current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
-
- fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
- IDENTIFIER_POINTER (DECL_NAME (parms)),
- DBX_MEMPARM_STABS_LETTER);
- }
- else
- {
- current_sym_nchars = 8;
- fprintf (asmfile, "%s \"(anon):%c", ASM_STABS_OP,
- DBX_MEMPARM_STABS_LETTER);
- }
-
- dbxout_type (DECL_ARG_TYPE (parms), 0, 0);
- current_sym_value = DEBUGGER_ARG_OFFSET (current_sym_value, addr);
- dbxout_finish_symbol (parms);
- }
- else if (GET_CODE (DECL_RTL (parms)) == REG)
- {
- rtx best_rtl;
- char regparm_letter;
- tree parm_type;
- /* Parm passed in registers and lives in registers or nowhere. */
-
- current_sym_code = DBX_REGPARM_STABS_CODE;
- regparm_letter = DBX_REGPARM_STABS_LETTER;
- current_sym_addr = 0;
-
- /* If parm lives in a register, use that register;
- pretend the parm was passed there. It would be more consistent
- to describe the register where the parm was passed,
- but in practice that register usually holds something else.
-
- If we use DECL_RTL, then we must use the declared type of
- the variable, not the type that it arrived in. */
- if (REGNO (DECL_RTL (parms)) >= 0
- && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
- {
- best_rtl = DECL_RTL (parms);
- parm_type = TREE_TYPE (parms);
- }
- /* If the parm lives nowhere, use the register where it was
- passed. It is also better to use the declared type here. */
- else
- {
- best_rtl = DECL_INCOMING_RTL (parms);
- parm_type = TREE_TYPE (parms);
- }
- current_sym_value = DBX_REGISTER_NUMBER (REGNO (best_rtl));
-
- FORCE_TEXT;
- if (DECL_NAME (parms))
- {
- current_sym_nchars = 2 + IDENTIFIER_LENGTH (DECL_NAME (parms));
- fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
- IDENTIFIER_POINTER (DECL_NAME (parms)),
- regparm_letter);
- }
- else
- {
- current_sym_nchars = 8;
- fprintf (asmfile, "%s \"(anon):%c", ASM_STABS_OP,
- regparm_letter);
- }
-
- dbxout_type (parm_type, 0, 0);
- dbxout_finish_symbol (parms);
- }
- else if (GET_CODE (DECL_RTL (parms)) == MEM
- && GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG
- && REGNO (XEXP (DECL_RTL (parms), 0)) != HARD_FRAME_POINTER_REGNUM
- && REGNO (XEXP (DECL_RTL (parms), 0)) != STACK_POINTER_REGNUM
-#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- && REGNO (XEXP (DECL_RTL (parms), 0)) != ARG_POINTER_REGNUM
-#endif
- )
- {
- /* Parm was passed via invisible reference.
- That is, its address was passed in a register.
- Output it as if it lived in that register.
- The debugger will know from the type
- that it was actually passed by invisible reference. */
-
- char regparm_letter;
- /* Parm passed in registers and lives in registers or nowhere. */
-
- current_sym_code = DBX_REGPARM_STABS_CODE;
- if (use_gnu_debug_info_extensions)
- regparm_letter = GDB_INV_REF_REGPARM_STABS_LETTER;
- else
- regparm_letter = DBX_REGPARM_STABS_LETTER;
-
- /* DECL_RTL looks like (MEM (REG...). Get the register number.
- If it is an unallocated pseudo-reg, then use the register where
- it was passed instead. */
- if (REGNO (XEXP (DECL_RTL (parms), 0)) >= 0
- && REGNO (XEXP (DECL_RTL (parms), 0)) < FIRST_PSEUDO_REGISTER)
- current_sym_value = REGNO (XEXP (DECL_RTL (parms), 0));
- else
- current_sym_value = REGNO (DECL_INCOMING_RTL (parms));
-
- current_sym_addr = 0;
-
- FORCE_TEXT;
- if (DECL_NAME (parms))
- {
- current_sym_nchars = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms)));
-
- fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
- IDENTIFIER_POINTER (DECL_NAME (parms)),
- regparm_letter);
- }
- else
- {
- current_sym_nchars = 8;
- fprintf (asmfile, "%s \"(anon):%c", ASM_STABS_OP,
- regparm_letter);
- }
-
- dbxout_type (TREE_TYPE (parms), 0, 0);
- dbxout_finish_symbol (parms);
- }
- else if (GET_CODE (DECL_RTL (parms)) == MEM
- && XEXP (DECL_RTL (parms), 0) != const0_rtx
- /* ??? A constant address for a parm can happen
- when the reg it lives in is equiv to a constant in memory.
- Should make this not happen, after 2.4. */
- && ! CONSTANT_P (XEXP (DECL_RTL (parms), 0)))
- {
- /* Parm was passed in registers but lives on the stack. */
-
- current_sym_code = N_PSYM;
- /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
- in which case we want the value of that CONST_INT,
- or (MEM (REG ...)) or (MEM (MEM ...)),
- in which case we use a value of zero. */
- if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG
- || GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
- current_sym_value = 0;
- else
- current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
- current_sym_addr = 0;
-
- FORCE_TEXT;
- if (DECL_NAME (parms))
- {
- current_sym_nchars = 2 + strlen (IDENTIFIER_POINTER (DECL_NAME (parms)));
-
- fprintf (asmfile, "%s \"%s:%c", ASM_STABS_OP,
- IDENTIFIER_POINTER (DECL_NAME (parms)),
- DBX_MEMPARM_STABS_LETTER);
- }
- else
- {
- current_sym_nchars = 8;
- fprintf (asmfile, "%s \"(anon):%c", ASM_STABS_OP,
- DBX_MEMPARM_STABS_LETTER);
- }
-
- current_sym_value
- = DEBUGGER_ARG_OFFSET (current_sym_value,
- XEXP (DECL_RTL (parms), 0));
- dbxout_type (TREE_TYPE (parms), 0, 0);
- dbxout_finish_symbol (parms);
- }
- }
-}
-
-/* Output definitions for the places where parms live during the function,
- when different from where they were passed, when the parms were passed
- in memory.
-
- It is not useful to do this for parms passed in registers
- that live during the function in different registers, because it is
- impossible to look in the passed register for the passed value,
- so we use the within-the-function register to begin with.
-
- PARMS is a chain of PARM_DECL nodes. */
-
-void
-dbxout_reg_parms (parms)
- tree parms;
-{
- for (; parms; parms = TREE_CHAIN (parms))
- if (DECL_NAME (parms) && PARM_PASSED_IN_MEMORY (parms))
- {
- dbxout_prepare_symbol (parms);
-
- /* Report parms that live in registers during the function
- but were passed in memory. */
- if (GET_CODE (DECL_RTL (parms)) == REG
- && REGNO (DECL_RTL (parms)) >= 0
- && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
- dbxout_symbol_location (parms, TREE_TYPE (parms),
- 0, DECL_RTL (parms));
- else if (GET_CODE (DECL_RTL (parms)) == CONCAT)
- dbxout_symbol_location (parms, TREE_TYPE (parms),
- 0, DECL_RTL (parms));
- /* Report parms that live in memory but not where they were passed. */
- else if (GET_CODE (DECL_RTL (parms)) == MEM
- && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
- dbxout_symbol_location (parms, TREE_TYPE (parms),
- 0, DECL_RTL (parms));
- }
-}
-
-/* Given a chain of ..._TYPE nodes (as come in a parameter list),
- output definitions of those names, in raw form */
-
-void
-dbxout_args (args)
- tree args;
-{
- while (args)
- {
- putc (',', asmfile);
- dbxout_type (TREE_VALUE (args), 0, 0);
- CHARS (1);
- args = TREE_CHAIN (args);
- }
-}
-
-/* Given a chain of ..._TYPE nodes,
- find those which have typedef names and output those names.
- This is to ensure those types get output. */
-
-void
-dbxout_types (types)
- register tree types;
-{
- while (types)
- {
- if (TYPE_NAME (types)
- && TREE_CODE (TYPE_NAME (types)) == TYPE_DECL
- && ! TREE_ASM_WRITTEN (TYPE_NAME (types)))
- dbxout_symbol (TYPE_NAME (types), 1);
- types = TREE_CHAIN (types);
- }
-}
-
-/* Output everything about a symbol block (a BLOCK node
- that represents a scope level),
- including recursive output of contained blocks.
-
- BLOCK is the BLOCK node.
- DEPTH is its depth within containing symbol blocks.
- ARGS is usually zero; but for the outermost block of the
- body of a function, it is a chain of PARM_DECLs for the function parameters.
- We output definitions of all the register parms
- as if they were local variables of that block.
-
- If -g1 was used, we count blocks just the same, but output nothing
- except for the outermost block.
-
- Actually, BLOCK may be several blocks chained together.
- We handle them all in sequence. */
-
-static void
-dbxout_block (block, depth, args)
- register tree block;
- int depth;
- tree args;
-{
- int blocknum;
-
- while (block)
- {
- /* Ignore blocks never expanded or otherwise marked as real. */
- if (TREE_USED (block))
- {
-#ifndef DBX_LBRAC_FIRST
- /* In dbx format, the syms of a block come before the N_LBRAC. */
- if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
- dbxout_syms (BLOCK_VARS (block));
- if (args)
- dbxout_reg_parms (args);
-#endif
-
- /* Now output an N_LBRAC symbol to represent the beginning of
- the block. Use the block's tree-walk order to generate
- the assembler symbols LBBn and LBEn
- that final will define around the code in this block. */
- if (depth > 0 && debug_info_level != DINFO_LEVEL_TERSE)
- {
- char buf[20];
- blocknum = next_block_number++;
- ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
-
- if (BLOCK_HANDLER_BLOCK (block))
- {
- /* A catch block. Must precede N_LBRAC. */
- tree decl = BLOCK_VARS (block);
- while (decl)
- {
-#ifdef DBX_OUTPUT_CATCH
- DBX_OUTPUT_CATCH (asmfile, decl, buf);
-#else
- fprintf (asmfile, "%s \"%s:C1\",%d,0,0,", ASM_STABS_OP,
- IDENTIFIER_POINTER (DECL_NAME (decl)), N_CATCH);
- assemble_name (asmfile, buf);
- fprintf (asmfile, "\n");
-#endif
- decl = TREE_CHAIN (decl);
- }
- }
-
-#ifdef DBX_OUTPUT_LBRAC
- DBX_OUTPUT_LBRAC (asmfile, buf);
-#else
- fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC);
- assemble_name (asmfile, buf);
-#if DBX_BLOCKS_FUNCTION_RELATIVE
- fputc ('-', asmfile);
- assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
-#endif
- fprintf (asmfile, "\n");
-#endif
- }
- else if (depth > 0)
- /* Count blocks the same way regardless of debug_info_level. */
- next_block_number++;
-
-#ifdef DBX_LBRAC_FIRST
- /* On some weird machines, the syms of a block
- come after the N_LBRAC. */
- if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
- dbxout_syms (BLOCK_VARS (block));
- if (args)
- dbxout_reg_parms (args);
-#endif
-
- /* Output the subblocks. */
- dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
-
- /* Refer to the marker for the end of the block. */
- if (depth > 0 && debug_info_level != DINFO_LEVEL_TERSE)
- {
- char buf[20];
- ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
-#ifdef DBX_OUTPUT_RBRAC
- DBX_OUTPUT_RBRAC (asmfile, buf);
-#else
- fprintf (asmfile, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC);
- assemble_name (asmfile, buf);
-#if DBX_BLOCKS_FUNCTION_RELATIVE
- fputc ('-', asmfile);
- assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
-#endif
- fprintf (asmfile, "\n");
-#endif
- }
- }
- block = BLOCK_CHAIN (block);
- }
-}
-
-/* Output the information about a function and its arguments and result.
- Usually this follows the function's code,
- but on some systems, it comes before. */
-
-static void
-dbxout_really_begin_function (decl)
- tree decl;
-{
- dbxout_symbol (decl, 0);
- dbxout_parms (DECL_ARGUMENTS (decl));
- if (DECL_NAME (DECL_RESULT (decl)) != 0)
- dbxout_symbol (DECL_RESULT (decl), 1);
-}
-
-/* Called at beginning of output of function definition. */
-
-void
-dbxout_begin_function (decl)
- tree decl;
-{
-#ifdef DBX_FUNCTION_FIRST
- dbxout_really_begin_function (decl);
-#endif
-}
-
-/* Output dbx data for a function definition.
- This includes a definition of the function name itself (a symbol),
- definitions of the parameters (locating them in the parameter list)
- and then output the block that makes up the function's body
- (including all the auto variables of the function). */
-
-void
-dbxout_function (decl)
- tree decl;
-{
-#ifndef DBX_FUNCTION_FIRST
- dbxout_really_begin_function (decl);
-#endif
- dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
-#ifdef DBX_OUTPUT_FUNCTION_END
- DBX_OUTPUT_FUNCTION_END (asmfile, decl);
-#endif
-#if defined(ASM_OUTPUT_SECTION_NAME) && !defined(NO_DBX_FUNCTION_END)
- if (use_gnu_debug_info_extensions)
- dbxout_function_end ();
-#endif
-}
-#endif /* DBX_DEBUGGING_INFO */
diff --git a/gcc/dbxstclass.h b/gcc/dbxstclass.h
deleted file mode 100644
index 2d003fed3bb..00000000000
--- a/gcc/dbxstclass.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Storage classes in XCOFF object file format designed for DBX's use.
- This info is from the `Files Reference' manual for IBM's AIX version 3
- for the RS6000. */
-
-#define C_GSYM 0x80
-#define C_LSYM 0x81
-#define C_PSYM 0x82
-#define C_RSYM 0x83
-#define C_RPSYM 0x84
-#define C_STSYM 0x85
-
-#define C_BCOMM 0x87
-#define C_ECOML 0x88
-#define C_ECOMM 0x89
-#define C_DECL 0x8c
-#define C_ENTRY 0x8d
-#define C_FUN 0x8e
diff --git a/gcc/defaults.h b/gcc/defaults.h
deleted file mode 100644
index 1bf5d6ad010..00000000000
--- a/gcc/defaults.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Definitions of various defaults for how to do assembler output
- (most of which are designed to be appropriate for GAS or for
- some BSD assembler).
- Copyright (C) 1992, 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@monkeys.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. */
-
-/* Store in OUTPUT a string (made with alloca) containing
- an assembler-name for a local static variable or function named NAME.
- LABELNO is an integer which is different for each call. */
-
-#ifndef ASM_FORMAT_PRIVATE_NAME
-#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
- do { \
- int len = strlen (NAME); \
- char *temp = (char *) alloca (len + 3); \
- temp[0] = 'L'; \
- strcpy (&temp[1], (NAME)); \
- temp[len + 1] = '.'; \
- temp[len + 2] = 0; \
- (OUTPUT) = (char *) alloca (strlen (NAME) + 11); \
- ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO); \
- } while (0)
-#endif
-
-#ifndef ASM_STABD_OP
-#define ASM_STABD_OP ".stabd"
-#endif
-
-/* This is how to output an element of a case-vector that is absolute.
- Some targets don't use this, but we have to define it anyway. */
-
-#ifndef ASM_OUTPUT_ADDR_VEC_ELT
-#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
-do { fprintf (FILE, "\t%s\t", ASM_LONG); \
- ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE)); \
- fputc ('\n', FILE); \
- } while (0)
-#endif
-
-/* choose a reasonable default for ASM_OUTPUT_ASCII. */
-
-#ifndef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
- do { \
- FILE *_hide_asm_out_file = (MYFILE); \
- unsigned char *_hide_p = (unsigned char *) (MYSTRING); \
- int _hide_thissize = (MYLENGTH); \
- { \
- FILE *asm_out_file = _hide_asm_out_file; \
- unsigned char *p = _hide_p; \
- int thissize = _hide_thissize; \
- int i; \
- fprintf (asm_out_file, "\t.ascii \""); \
- \
- for (i = 0; i < thissize; i++) \
- { \
- register int c = p[i]; \
- if (c == '\"' || c == '\\') \
- putc ('\\', asm_out_file); \
- if (c >= ' ' && c < 0177) \
- putc (c, asm_out_file); \
- else \
- { \
- fprintf (asm_out_file, "\\%o", c); \
- /* After an octal-escape, if a digit follows, \
- terminate one string constant and start another. \
- The Vax assembler fails to stop reading the escape \
- after three digits, so this is the only way we \
- can get it to parse the data properly. */ \
- if (i < thissize - 1 \
- && p[i + 1] >= '0' && p[i + 1] <= '9') \
- fprintf (asm_out_file, "\"\n\t.ascii \""); \
- } \
- } \
- fprintf (asm_out_file, "\"\n"); \
- } \
- } \
- while (0)
-#endif
-
-#ifndef ASM_IDENTIFY_GCC
- /* Default the definition, only if ASM_IDENTIFY_GCC is not set,
- because if it is set, we might not want ASM_IDENTIFY_LANGUAGE
- outputting labels, if we do want it to, then it must be defined
- in the tm.h file. */
-#ifndef ASM_IDENTIFY_LANGUAGE
-#define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE);
-#endif
-#endif
-
-/* This is how we tell the assembler to equate two values. */
-#ifdef SET_ASM_OP
-#ifndef ASM_OUTPUT_DEF
-#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t%s\t", SET_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, ","); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
- } while (0)
-#endif
-#endif
-
-/* This is how to output a reference to a user-level label named NAME. */
-
-#ifndef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
- do { fputs (USER_LABEL_PREFIX, FILE); fputs (NAME, FILE); } while (0)
-#endif
-
-/* This determines whether or not we support weak symbols. */
-#ifndef SUPPORTS_WEAK
-#ifdef ASM_WEAKEN_LABEL
-#define SUPPORTS_WEAK 1
-#else
-#define SUPPORTS_WEAK 0
-#endif
-#endif
diff --git a/gcc/demangle.h b/gcc/demangle.h
deleted file mode 100644
index b0254af05f7..00000000000
--- a/gcc/demangle.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Defs for interface to demanglers.
- Copyright 1992, 1995, 1996 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, 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. */
-
-
-#if !defined (DEMANGLE_H)
-#define DEMANGLE_H
-
-#ifdef IN_GCC
-#include "gansidecl.h"
-#define PARAMS(ARGS) PROTO(ARGS)
-#else /* ! IN_GCC */
-#include <ansidecl.h>
-#endif /* IN_GCC */
-
-/* Options passed to cplus_demangle (in 2nd parameter). */
-
-#define DMGL_NO_OPTS 0 /* For readability... */
-#define DMGL_PARAMS (1 << 0) /* Include function args */
-#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
-
-#define DMGL_AUTO (1 << 8)
-#define DMGL_GNU (1 << 9)
-#define DMGL_LUCID (1 << 10)
-#define DMGL_ARM (1 << 11)
-/* If none of these are set, use 'current_demangling_style' as the default. */
-#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM)
-
-/* Enumeration of possible demangling styles.
-
- Lucid and ARM styles are still kept logically distinct, even though
- they now both behave identically. The resulting style is actual the
- union of both. I.E. either style recognizes both "__pt__" and "__rf__"
- for operator "->", even though the first is lucid style and the second
- is ARM style. (FIXME?) */
-
-extern enum demangling_styles
-{
- unknown_demangling = 0,
- auto_demangling = DMGL_AUTO,
- gnu_demangling = DMGL_GNU,
- lucid_demangling = DMGL_LUCID,
- arm_demangling = DMGL_ARM
-} current_demangling_style;
-
-/* Define string names for the various demangling styles. */
-
-#define AUTO_DEMANGLING_STYLE_STRING "auto"
-#define GNU_DEMANGLING_STYLE_STRING "gnu"
-#define LUCID_DEMANGLING_STYLE_STRING "lucid"
-#define ARM_DEMANGLING_STYLE_STRING "arm"
-
-/* Some macros to test what demangling style is active. */
-
-#define CURRENT_DEMANGLING_STYLE current_demangling_style
-#define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO)
-#define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU)
-#define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID)
-#define ARM_DEMANGLING (CURRENT_DEMANGLING_STYLE & DMGL_ARM)
-
-extern char *
-cplus_demangle PARAMS ((const char *mangled, int options));
-
-extern int
-cplus_demangle_opname PARAMS ((const char *opname, char *result, int options));
-
-extern const char *
-cplus_mangle_opname PARAMS ((const char *opname, int options));
-
-/* Note: This sets global state. FIXME if you care about multi-threading. */
-
-extern void
-set_cplus_marker_for_demangling PARAMS ((int ch));
-
-#endif /* DEMANGLE_H */
diff --git a/gcc/dostage2 b/gcc/dostage2
deleted file mode 100755
index bb33f7dc27e..00000000000
--- a/gcc/dostage2
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-make -k LANGUAGES=c $1 CC=stage1/xgcc XCFLAGS=-Bstage1/ CFLAGS="-g $2" >log2 2>&1
diff --git a/gcc/dostage3 b/gcc/dostage3
deleted file mode 100755
index 21f17fc11c7..00000000000
--- a/gcc/dostage3
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-make -k LANGUAGES=c $1 CC=stage2/xgcc XCFLAGS=-Bstage2/ CFLAGS="-g $2" >log3 2>&1
-
diff --git a/gcc/dwarf.h b/gcc/dwarf.h
deleted file mode 100644
index 6aca017e6e5..00000000000
--- a/gcc/dwarf.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/* Declarations and definitions of codes relating to the DWARF symbolic
- debugging information format.
-
- Written by Ron Guilmette (rfg@netcom.com)
-
-Copyright (C) 1992 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 is derived from the DWARF specification (a public document)
- Revision 1.0.1 (April 8, 1992) developed by the UNIX International
- Programming Languages Special Interest Group (UI/PLSIG) and distributed
- by UNIX International. Copies of this specification are available from
- UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
-*/
-
-/* Tag names and codes. */
-
-enum dwarf_tag {
- TAG_padding = 0x0000,
- TAG_array_type = 0x0001,
- TAG_class_type = 0x0002,
- TAG_entry_point = 0x0003,
- TAG_enumeration_type = 0x0004,
- TAG_formal_parameter = 0x0005,
- TAG_global_subroutine = 0x0006,
- TAG_global_variable = 0x0007,
- /* 0x0008 -- reserved */
- /* 0x0009 -- reserved */
- TAG_label = 0x000a,
- TAG_lexical_block = 0x000b,
- TAG_local_variable = 0x000c,
- TAG_member = 0x000d,
- /* 0x000e -- reserved */
- TAG_pointer_type = 0x000f,
- TAG_reference_type = 0x0010,
- TAG_compile_unit = 0x0011,
- TAG_string_type = 0x0012,
- TAG_structure_type = 0x0013,
- TAG_subroutine = 0x0014,
- TAG_subroutine_type = 0x0015,
- TAG_typedef = 0x0016,
- TAG_union_type = 0x0017,
- TAG_unspecified_parameters = 0x0018,
- TAG_variant = 0x0019,
- TAG_common_block = 0x001a,
- TAG_common_inclusion = 0x001b,
- TAG_inheritance = 0x001c,
- TAG_inlined_subroutine = 0x001d,
- TAG_module = 0x001e,
- TAG_ptr_to_member_type = 0x001f,
- TAG_set_type = 0x0020,
- TAG_subrange_type = 0x0021,
- TAG_with_stmt = 0x0022,
-
- /* GNU extensions */
-
- TAG_format_label = 0x8000, /* for FORTRAN 77 and Fortran 90 */
- TAG_namelist = 0x8001, /* For Fortran 90 */
- TAG_function_template = 0x8002, /* for C++ */
- TAG_class_template = 0x8003 /* for C++ */
-};
-
-#define TAG_lo_user 0x8000 /* implementation-defined range start */
-#define TAG_hi_user 0xffff /* implementation-defined range end */
-#define TAG_source_file TAG_compile_unit /* for backward compatibility */
-
-/* Form names and codes. */
-
-enum dwarf_form {
- FORM_ADDR = 0x1,
- FORM_REF = 0x2,
- FORM_BLOCK2 = 0x3,
- FORM_BLOCK4 = 0x4,
- FORM_DATA2 = 0x5,
- FORM_DATA4 = 0x6,
- FORM_DATA8 = 0x7,
- FORM_STRING = 0x8
-};
-
-/* Attribute names and codes. */
-
-enum dwarf_attribute {
- AT_sibling = (0x0010|FORM_REF),
- AT_location = (0x0020|FORM_BLOCK2),
- AT_name = (0x0030|FORM_STRING),
- AT_fund_type = (0x0050|FORM_DATA2),
- AT_mod_fund_type = (0x0060|FORM_BLOCK2),
- AT_user_def_type = (0x0070|FORM_REF),
- AT_mod_u_d_type = (0x0080|FORM_BLOCK2),
- AT_ordering = (0x0090|FORM_DATA2),
- AT_subscr_data = (0x00a0|FORM_BLOCK2),
- AT_byte_size = (0x00b0|FORM_DATA4),
- AT_bit_offset = (0x00c0|FORM_DATA2),
- AT_bit_size = (0x00d0|FORM_DATA4),
- /* (0x00e0|FORM_xxxx) -- reserved */
- AT_element_list = (0x00f0|FORM_BLOCK4),
- AT_stmt_list = (0x0100|FORM_DATA4),
- AT_low_pc = (0x0110|FORM_ADDR),
- AT_high_pc = (0x0120|FORM_ADDR),
- AT_language = (0x0130|FORM_DATA4),
- AT_member = (0x0140|FORM_REF),
- AT_discr = (0x0150|FORM_REF),
- AT_discr_value = (0x0160|FORM_BLOCK2),
- /* (0x0170|FORM_xxxx) -- reserved */
- /* (0x0180|FORM_xxxx) -- reserved */
- AT_string_length = (0x0190|FORM_BLOCK2),
- AT_common_reference = (0x01a0|FORM_REF),
- AT_comp_dir = (0x01b0|FORM_STRING),
- AT_const_value_string = (0x01c0|FORM_STRING),
- AT_const_value_data2 = (0x01c0|FORM_DATA2),
- AT_const_value_data4 = (0x01c0|FORM_DATA4),
- AT_const_value_data8 = (0x01c0|FORM_DATA8),
- AT_const_value_block2 = (0x01c0|FORM_BLOCK2),
- AT_const_value_block4 = (0x01c0|FORM_BLOCK4),
- AT_containing_type = (0x01d0|FORM_REF),
- AT_default_value_addr = (0x01e0|FORM_ADDR),
- AT_default_value_data2 = (0x01e0|FORM_DATA2),
- AT_default_value_data4 = (0x01e0|FORM_DATA4),
- AT_default_value_data8 = (0x01e0|FORM_DATA8),
- AT_default_value_string = (0x01e0|FORM_STRING),
- AT_friends = (0x01f0|FORM_BLOCK2),
- AT_inline = (0x0200|FORM_STRING),
- AT_is_optional = (0x0210|FORM_STRING),
- AT_lower_bound_ref = (0x0220|FORM_REF),
- AT_lower_bound_data2 = (0x0220|FORM_DATA2),
- AT_lower_bound_data4 = (0x0220|FORM_DATA4),
- AT_lower_bound_data8 = (0x0220|FORM_DATA8),
- AT_private = (0x0240|FORM_STRING),
- AT_producer = (0x0250|FORM_STRING),
- AT_program = (0x0230|FORM_STRING),
- AT_protected = (0x0260|FORM_STRING),
- AT_prototyped = (0x0270|FORM_STRING),
- AT_public = (0x0280|FORM_STRING),
- AT_pure_virtual = (0x0290|FORM_STRING),
- AT_return_addr = (0x02a0|FORM_BLOCK2),
- AT_abstract_origin = (0x02b0|FORM_REF),
- AT_start_scope = (0x02c0|FORM_DATA4),
- AT_stride_size = (0x02e0|FORM_DATA4),
- AT_upper_bound_ref = (0x02f0|FORM_REF),
- AT_upper_bound_data2 = (0x02f0|FORM_DATA2),
- AT_upper_bound_data4 = (0x02f0|FORM_DATA4),
- AT_upper_bound_data8 = (0x02f0|FORM_DATA8),
- AT_virtual = (0x0300|FORM_STRING),
-
- /* GNU extensions. */
-
- AT_sf_names = (0x8000|FORM_DATA4),
- AT_src_info = (0x8010|FORM_DATA4),
- AT_mac_info = (0x8020|FORM_DATA4),
- AT_src_coords = (0x8030|FORM_DATA4),
- AT_body_begin = (0x8040|FORM_ADDR),
- AT_body_end = (0x8050|FORM_ADDR)
-};
-
-#define AT_lo_user 0x2000 /* implementation-defined range start */
-#define AT_hi_user 0x3ff0 /* implementation-defined range end */
-
-/* Location atom names and codes. */
-
-enum dwarf_location_atom {
- OP_REG = 0x01,
- OP_BASEREG = 0x02,
- OP_ADDR = 0x03,
- OP_CONST = 0x04,
- OP_DEREF2 = 0x05,
- OP_DEREF4 = 0x06,
- OP_ADD = 0x07,
-
- /* GNU extensions. */
-
- OP_MULT = 0x80
-};
-
-#define OP_LO_USER 0x80 /* implementation-defined range start */
-#define OP_HI_USER 0xff /* implementation-defined range end */
-
-/* Fundamental type names and codes. */
-
-enum dwarf_fundamental_type {
- FT_char = 0x0001,
- FT_signed_char = 0x0002,
- FT_unsigned_char = 0x0003,
- FT_short = 0x0004,
- FT_signed_short = 0x0005,
- FT_unsigned_short = 0x0006,
- FT_integer = 0x0007,
- FT_signed_integer = 0x0008,
- FT_unsigned_integer = 0x0009,
- FT_long = 0x000a,
- FT_signed_long = 0x000b,
- FT_unsigned_long = 0x000c,
- FT_pointer = 0x000d, /* an alias for (void *) */
- FT_float = 0x000e,
- FT_dbl_prec_float = 0x000f,
- FT_ext_prec_float = 0x0010, /* breaks "classic" svr4 SDB */
- FT_complex = 0x0011, /* breaks "classic" svr4 SDB */
- FT_dbl_prec_complex = 0x0012, /* breaks "classic" svr4 SDB */
- /* 0x0013 -- reserved */
- FT_void = 0x0014,
- FT_boolean = 0x0015, /* breaks "classic" svr4 SDB */
- FT_ext_prec_complex = 0x0016, /* breaks "classic" svr4 SDB */
- FT_label = 0x0017,
-
- /* GNU extensions
- The low order byte must indicate the size (in bytes) for the type.
- All of these types will probably break "classic" svr4 SDB */
-
- FT_long_long = 0x8008,
- FT_signed_long_long = 0x8108,
- FT_unsigned_long_long = 0x8208,
-
- FT_int8 = 0x9001,
- FT_signed_int8 = 0x9101,
- FT_unsigned_int8 = 0x9201,
- FT_int16 = 0x9302,
- FT_signed_int16 = 0x9402,
- FT_unsigned_int16 = 0x9502,
- FT_int32 = 0x9604,
- FT_signed_int32 = 0x9704,
- FT_unsigned_int32 = 0x9804,
- FT_int64 = 0x9908,
- FT_signed_int64 = 0x9a08,
- FT_unsigned_int64 = 0x9b08,
-
- FT_real32 = 0xa004,
- FT_real64 = 0xa108,
- FT_real96 = 0xa20c,
- FT_real128 = 0xa310
-};
-
-#define FT_lo_user 0x8000 /* implementation-defined range start */
-#define FT_hi_user 0xffff /* implementation defined range end */
-
-/* Type modifier names and codes. */
-
-enum dwarf_type_modifier {
- MOD_pointer_to = 0x01,
- MOD_reference_to = 0x02,
- MOD_const = 0x03,
- MOD_volatile = 0x04
-};
-
-#define MOD_lo_user 0x80 /* implementation-defined range start */
-#define MOD_hi_user 0xff /* implementation-defined range end */
-
-/* Array ordering names and codes. */
-
-enum dwarf_array_dim_ordering {
- ORD_row_major = 0,
- ORD_col_major = 1
-};
-
-/* Array subscript format names and codes. */
-
-enum dwarf_subscr_data_formats {
- FMT_FT_C_C = 0x0,
- FMT_FT_C_X = 0x1,
- FMT_FT_X_C = 0x2,
- FMT_FT_X_X = 0x3,
- FMT_UT_C_C = 0x4,
- FMT_UT_C_X = 0x5,
- FMT_UT_X_C = 0x6,
- FMT_UT_X_X = 0x7,
- FMT_ET = 0x8
-};
-
-/* Derived from above for ease of use. */
-
-#define FMT_CODE(_FUNDAMENTAL_TYPE_P, _UB_CONST_P, _LB_CONST_P) \
- (((_FUNDAMENTAL_TYPE_P) ? 0 : 4) \
- | ((_UB_CONST_P) ? 0 : 2) \
- | ((_LB_CONST_P) ? 0 : 1))
-
-/* Source language names and codes. */
-
-enum dwarf_source_language {
- LANG_C89 = 0x00000001,
- LANG_C = 0x00000002,
- LANG_ADA83 = 0x00000003,
- LANG_C_PLUS_PLUS = 0x00000004,
- LANG_COBOL74 = 0x00000005,
- LANG_COBOL85 = 0x00000006,
- LANG_FORTRAN77 = 0x00000007,
- LANG_FORTRAN90 = 0x00000008,
- LANG_PASCAL83 = 0x00000009,
- LANG_MODULA2 = 0x0000000a
-};
-
-#define LANG_lo_user 0x00008000 /* implementation-defined range start */
-#define LANG_hi_user 0x0000ffff /* implementation-defined range end */
-
-/* Names and codes for GNU "macinfo" extension. */
-
-enum dwarf_macinfo_record_type {
- MACINFO_start = 's',
- MACINFO_resume = 'r',
- MACINFO_define = 'd',
- MACINFO_undef = 'u'
-};
diff --git a/gcc/dwarf2.h b/gcc/dwarf2.h
deleted file mode 100644
index b16c4a3d531..00000000000
--- a/gcc/dwarf2.h
+++ /dev/null
@@ -1,541 +0,0 @@
-/* Declarations and definitions of codes relating to the DWARF2 symbolic
- debugging information format.
- Copyright (C) 1992, 1993, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Gary Funck (gary@intrepid.com). Derived from the
- DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* This file is derived from the DWARF specification (a public document)
- Revision 2.0.0 (July 27, 1993) developed by the UNIX International
- Programming Languages Special Interest Group (UI/PLSIG) and distributed
- by UNIX International. Copies of this specification are available from
- UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054. */
-
-/* Tag names and codes. */
-
-enum dwarf_tag
- {
- DW_TAG_padding = 0x00,
- DW_TAG_array_type = 0x01,
- DW_TAG_class_type = 0x02,
- DW_TAG_entry_point = 0x03,
- DW_TAG_enumeration_type = 0x04,
- DW_TAG_formal_parameter = 0x05,
- DW_TAG_imported_declaration = 0x08,
- DW_TAG_label = 0x0a,
- DW_TAG_lexical_block = 0x0b,
- DW_TAG_member = 0x0d,
- DW_TAG_pointer_type = 0x0f,
- DW_TAG_reference_type = 0x10,
- DW_TAG_compile_unit = 0x11,
- DW_TAG_string_type = 0x12,
- DW_TAG_structure_type = 0x13,
- DW_TAG_subroutine_type = 0x15,
- DW_TAG_typedef = 0x16,
- DW_TAG_union_type = 0x17,
- DW_TAG_unspecified_parameters = 0x18,
- DW_TAG_variant = 0x19,
- DW_TAG_common_block = 0x1a,
- DW_TAG_common_inclusion = 0x1b,
- DW_TAG_inheritance = 0x1c,
- DW_TAG_inlined_subroutine = 0x1d,
- DW_TAG_module = 0x1e,
- DW_TAG_ptr_to_member_type = 0x1f,
- DW_TAG_set_type = 0x20,
- DW_TAG_subrange_type = 0x21,
- DW_TAG_with_stmt = 0x22,
- DW_TAG_access_declaration = 0x23,
- DW_TAG_base_type = 0x24,
- DW_TAG_catch_block = 0x25,
- DW_TAG_const_type = 0x26,
- DW_TAG_constant = 0x27,
- DW_TAG_enumerator = 0x28,
- DW_TAG_file_type = 0x29,
- DW_TAG_friend = 0x2a,
- DW_TAG_namelist = 0x2b,
- DW_TAG_namelist_item = 0x2c,
- DW_TAG_packed_type = 0x2d,
- DW_TAG_subprogram = 0x2e,
- DW_TAG_template_type_param = 0x2f,
- DW_TAG_template_value_param = 0x30,
- DW_TAG_thrown_type = 0x31,
- DW_TAG_try_block = 0x32,
- DW_TAG_variant_part = 0x33,
- DW_TAG_variable = 0x34,
- DW_TAG_volatile_type = 0x35,
- /* SGI/MIPS Extensions */
- DW_TAG_MIPS_loop = 0x4081,
- /* GNU extensions */
- DW_TAG_format_label = 0x4101, /* for FORTRAN 77 and Fortran 90 */
- DW_TAG_function_template = 0x4102, /* for C++ */
- DW_TAG_class_template = 0x4103 /* for C++ */
- };
-
-#define DW_TAG_lo_user 0x4080
-#define DW_TAG_hi_user 0xffff
-
-/* flag that tells whether entry has a child or not */
-#define DW_children_no 0
-#define DW_children_yes 1
-
-/* Form names and codes. */
-enum dwarf_form
- {
- DW_FORM_addr = 0x01,
- DW_FORM_block2 = 0x03,
- DW_FORM_block4 = 0x04,
- DW_FORM_data2 = 0x05,
- DW_FORM_data4 = 0x06,
- DW_FORM_data8 = 0x07,
- DW_FORM_string = 0x08,
- DW_FORM_block = 0x09,
- DW_FORM_block1 = 0x0a,
- DW_FORM_data1 = 0x0b,
- DW_FORM_flag = 0x0c,
- DW_FORM_sdata = 0x0d,
- DW_FORM_strp = 0x0e,
- DW_FORM_udata = 0x0f,
- DW_FORM_ref_addr = 0x10,
- DW_FORM_ref1 = 0x11,
- DW_FORM_ref2 = 0x12,
- DW_FORM_ref4 = 0x13,
- DW_FORM_ref8 = 0x14,
- DW_FORM_ref_udata = 0x15,
- DW_FORM_indirect = 0x16
- };
-
-/* Attribute names and codes. */
-
-enum dwarf_attribute
- {
- DW_AT_sibling = 0x01,
- DW_AT_location = 0x02,
- DW_AT_name = 0x03,
- DW_AT_ordering = 0x09,
- DW_AT_subscr_data = 0x0a,
- DW_AT_byte_size = 0x0b,
- DW_AT_bit_offset = 0x0c,
- DW_AT_bit_size = 0x0d,
- DW_AT_element_list = 0x0f,
- DW_AT_stmt_list = 0x10,
- DW_AT_low_pc = 0x11,
- DW_AT_high_pc = 0x12,
- DW_AT_language = 0x13,
- DW_AT_member = 0x14,
- DW_AT_discr = 0x15,
- DW_AT_discr_value = 0x16,
- DW_AT_visibility = 0x17,
- DW_AT_import = 0x18,
- DW_AT_string_length = 0x19,
- DW_AT_common_reference = 0x1a,
- DW_AT_comp_dir = 0x1b,
- DW_AT_const_value = 0x1c,
- DW_AT_containing_type = 0x1d,
- DW_AT_default_value = 0x1e,
- DW_AT_inline = 0x20,
- DW_AT_is_optional = 0x21,
- DW_AT_lower_bound = 0x22,
- DW_AT_producer = 0x25,
- DW_AT_prototyped = 0x27,
- DW_AT_return_addr = 0x2a,
- DW_AT_start_scope = 0x2c,
- DW_AT_stride_size = 0x2e,
- DW_AT_upper_bound = 0x2f,
- DW_AT_abstract_origin = 0x31,
- DW_AT_accessibility = 0x32,
- DW_AT_address_class = 0x33,
- DW_AT_artificial = 0x34,
- DW_AT_base_types = 0x35,
- DW_AT_calling_convention = 0x36,
- DW_AT_count = 0x37,
- DW_AT_data_member_location = 0x38,
- DW_AT_decl_column = 0x39,
- DW_AT_decl_file = 0x3a,
- DW_AT_decl_line = 0x3b,
- DW_AT_declaration = 0x3c,
- DW_AT_discr_list = 0x3d,
- DW_AT_encoding = 0x3e,
- DW_AT_external = 0x3f,
- DW_AT_frame_base = 0x40,
- DW_AT_friend = 0x41,
- DW_AT_identifier_case = 0x42,
- DW_AT_macro_info = 0x43,
- DW_AT_namelist_items = 0x44,
- DW_AT_priority = 0x45,
- DW_AT_segment = 0x46,
- DW_AT_specification = 0x47,
- DW_AT_static_link = 0x48,
- DW_AT_type = 0x49,
- DW_AT_use_location = 0x4a,
- DW_AT_variable_parameter = 0x4b,
- DW_AT_virtuality = 0x4c,
- DW_AT_vtable_elem_location = 0x4d,
- /* SGI/MIPS Extensions */
- DW_AT_MIPS_fde = 0x2001,
- DW_AT_MIPS_loop_begin = 0x2002,
- DW_AT_MIPS_tail_loop_begin = 0x2003,
- DW_AT_MIPS_epilog_begin = 0x2004,
- DW_AT_MIPS_loop_unroll_factor = 0x2005,
- DW_AT_MIPS_software_pipeline_depth = 0x2006,
- DW_AT_MIPS_linkage_name = 0x2007,
- DW_AT_MIPS_stride = 0x2008,
- DW_AT_MIPS_abstract_name = 0x2009,
- DW_AT_MIPS_clone_origin = 0x200a,
- DW_AT_MIPS_has_inlines = 0x200b,
- /* GNU extensions. */
- DW_AT_sf_names = 0x2101,
- DW_AT_src_info = 0x2102,
- DW_AT_mac_info = 0x2103,
- DW_AT_src_coords = 0x2104,
- DW_AT_body_begin = 0x2105,
- DW_AT_body_end = 0x2106
- };
-
-#define DW_AT_lo_user 0x2000 /* implementation-defined range start */
-#define DW_AT_hi_user 0x3ff0 /* implementation-defined range end */
-
-/* Location atom names and codes. */
-
-enum dwarf_location_atom
- {
- DW_OP_addr = 0x03,
- DW_OP_deref = 0x06,
- DW_OP_const1u = 0x08,
- DW_OP_const1s = 0x09,
- DW_OP_const2u = 0x0a,
- DW_OP_const2s = 0x0b,
- DW_OP_const4u = 0x0c,
- DW_OP_const4s = 0x0d,
- DW_OP_const8u = 0x0e,
- DW_OP_const8s = 0x0f,
- DW_OP_constu = 0x10,
- DW_OP_consts = 0x11,
- DW_OP_dup = 0x12,
- DW_OP_drop = 0x13,
- DW_OP_over = 0x14,
- DW_OP_pick = 0x15,
- DW_OP_swap = 0x16,
- DW_OP_rot = 0x17,
- DW_OP_xderef = 0x18,
- DW_OP_abs = 0x19,
- DW_OP_and = 0x1a,
- DW_OP_div = 0x1b,
- DW_OP_minus = 0x1c,
- DW_OP_mod = 0x1d,
- DW_OP_mul = 0x1e,
- DW_OP_neg = 0x1f,
- DW_OP_not = 0x20,
- DW_OP_or = 0x21,
- DW_OP_plus = 0x22,
- DW_OP_plus_uconst = 0x23,
- DW_OP_shl = 0x24,
- DW_OP_shr = 0x25,
- DW_OP_shra = 0x26,
- DW_OP_xor = 0x27,
- DW_OP_bra = 0x28,
- DW_OP_eq = 0x29,
- DW_OP_ge = 0x2a,
- DW_OP_gt = 0x2b,
- DW_OP_le = 0x2c,
- DW_OP_lt = 0x2d,
- DW_OP_ne = 0x2e,
- DW_OP_skip = 0x2f,
- DW_OP_lit0 = 0x30,
- DW_OP_lit1 = 0x31,
- DW_OP_lit2 = 0x32,
- DW_OP_lit3 = 0x33,
- DW_OP_lit4 = 0x34,
- DW_OP_lit5 = 0x35,
- DW_OP_lit6 = 0x36,
- DW_OP_lit7 = 0x37,
- DW_OP_lit8 = 0x38,
- DW_OP_lit9 = 0x39,
- DW_OP_lit10 = 0x3a,
- DW_OP_lit11 = 0x3b,
- DW_OP_lit12 = 0x3c,
- DW_OP_lit13 = 0x3d,
- DW_OP_lit14 = 0x3e,
- DW_OP_lit15 = 0x3f,
- DW_OP_lit16 = 0x40,
- DW_OP_lit17 = 0x41,
- DW_OP_lit18 = 0x42,
- DW_OP_lit19 = 0x43,
- DW_OP_lit20 = 0x44,
- DW_OP_lit21 = 0x45,
- DW_OP_lit22 = 0x46,
- DW_OP_lit23 = 0x47,
- DW_OP_lit24 = 0x48,
- DW_OP_lit25 = 0x49,
- DW_OP_lit26 = 0x4a,
- DW_OP_lit27 = 0x4b,
- DW_OP_lit28 = 0x4c,
- DW_OP_lit29 = 0x4d,
- DW_OP_lit30 = 0x4e,
- DW_OP_lit31 = 0x4f,
- DW_OP_reg0 = 0x50,
- DW_OP_reg1 = 0x51,
- DW_OP_reg2 = 0x52,
- DW_OP_reg3 = 0x53,
- DW_OP_reg4 = 0x54,
- DW_OP_reg5 = 0x55,
- DW_OP_reg6 = 0x56,
- DW_OP_reg7 = 0x57,
- DW_OP_reg8 = 0x58,
- DW_OP_reg9 = 0x59,
- DW_OP_reg10 = 0x5a,
- DW_OP_reg11 = 0x5b,
- DW_OP_reg12 = 0x5c,
- DW_OP_reg13 = 0x5d,
- DW_OP_reg14 = 0x5e,
- DW_OP_reg15 = 0x5f,
- DW_OP_reg16 = 0x60,
- DW_OP_reg17 = 0x61,
- DW_OP_reg18 = 0x62,
- DW_OP_reg19 = 0x63,
- DW_OP_reg20 = 0x64,
- DW_OP_reg21 = 0x65,
- DW_OP_reg22 = 0x66,
- DW_OP_reg23 = 0x67,
- DW_OP_reg24 = 0x68,
- DW_OP_reg25 = 0x69,
- DW_OP_reg26 = 0x6a,
- DW_OP_reg27 = 0x6b,
- DW_OP_reg28 = 0x6c,
- DW_OP_reg29 = 0x6d,
- DW_OP_reg30 = 0x6e,
- DW_OP_reg31 = 0x6f,
- DW_OP_breg0 = 0x70,
- DW_OP_breg1 = 0x71,
- DW_OP_breg2 = 0x72,
- DW_OP_breg3 = 0x73,
- DW_OP_breg4 = 0x74,
- DW_OP_breg5 = 0x75,
- DW_OP_breg6 = 0x76,
- DW_OP_breg7 = 0x77,
- DW_OP_breg8 = 0x78,
- DW_OP_breg9 = 0x79,
- DW_OP_breg10 = 0x7a,
- DW_OP_breg11 = 0x7b,
- DW_OP_breg12 = 0x7c,
- DW_OP_breg13 = 0x7d,
- DW_OP_breg14 = 0x7e,
- DW_OP_breg15 = 0x7f,
- DW_OP_breg16 = 0x80,
- DW_OP_breg17 = 0x81,
- DW_OP_breg18 = 0x82,
- DW_OP_breg19 = 0x83,
- DW_OP_breg20 = 0x84,
- DW_OP_breg21 = 0x85,
- DW_OP_breg22 = 0x86,
- DW_OP_breg23 = 0x87,
- DW_OP_breg24 = 0x88,
- DW_OP_breg25 = 0x89,
- DW_OP_breg26 = 0x8a,
- DW_OP_breg27 = 0x8b,
- DW_OP_breg28 = 0x8c,
- DW_OP_breg29 = 0x8d,
- DW_OP_breg30 = 0x8e,
- DW_OP_breg31 = 0x8f,
- DW_OP_regx = 0x90,
- DW_OP_fbreg = 0x91,
- DW_OP_bregx = 0x92,
- DW_OP_piece = 0x93,
- DW_OP_deref_size = 0x94,
- DW_OP_xderef_size = 0x95,
- DW_OP_nop = 0x96
- };
-
-#define DW_OP_lo_user 0x80 /* implementation-defined range start */
-#define DW_OP_hi_user 0xff /* implementation-defined range end */
-
-/* Type encodings. */
-
-enum dwarf_type
- {
- DW_ATE_void = 0x0,
- DW_ATE_address = 0x1,
- DW_ATE_boolean = 0x2,
- DW_ATE_complex_float = 0x3,
- DW_ATE_float = 0x4,
- DW_ATE_signed = 0x5,
- DW_ATE_signed_char = 0x6,
- DW_ATE_unsigned = 0x7,
- DW_ATE_unsigned_char = 0x8
- };
-
-#define DW_ATE_lo_user 0x80
-#define DW_ATE_hi_user 0xff
-
-/* Array ordering names and codes. */
-enum dwarf_array_dim_ordering
- {
- DW_ORD_row_major = 0,
- DW_ORD_col_major = 1
- };
-
-/* access attribute */
-enum dwarf_access_attribute
- {
- DW_ACCESS_public = 1,
- DW_ACCESS_protected = 2,
- DW_ACCESS_private = 3
- };
-
-/* visibility */
-enum dwarf_visibility_attribute
- {
- DW_VIS_local = 1,
- DW_VIS_exported = 2,
- DW_VIS_qualified = 3
- };
-
-/* virtuality */
-enum dwarf_virtuality_attribute
- {
- DW_VIRTUALITY_none = 0,
- DW_VIRTUALITY_virtual = 1,
- DW_VIRTUALITY_pure_virtual = 2
- };
-
-/* case sensitivity */
-enum dwarf_id_case
- {
- DW_ID_case_sensitive = 0,
- DW_ID_up_case = 1,
- DW_ID_down_case = 2,
- DW_ID_case_insensitive = 3
- };
-
-/* calling convention */
-enum dwarf_calling_convention
- {
- DW_CC_normal = 0x1,
- DW_CC_program = 0x2,
- DW_CC_nocall = 0x3
- };
-
-#define DW_CC_lo_user 0x40
-#define DW_CC_hi_user 0xff
-
-/* inline attribute */
-enum dwarf_inline_attribute
- {
- DW_INL_not_inlined = 0,
- DW_INL_inlined = 1,
- DW_INL_declared_not_inlined = 2,
- DW_INL_declared_inlined = 3
- };
-
-/* descriminant lists */
-enum dwarf_descrim_list
- {
- DW_DSC_label = 0,
- DW_DSC_range = 1
- };
-
-/* line number opcodes */
-enum dwarf_line_number_ops
- {
- DW_LNS_extended_op = 0,
- DW_LNS_copy = 1,
- DW_LNS_advance_pc = 2,
- DW_LNS_advance_line = 3,
- DW_LNS_set_file = 4,
- DW_LNS_set_column = 5,
- DW_LNS_negate_stmt = 6,
- DW_LNS_set_basic_block = 7,
- DW_LNS_const_add_pc = 8,
- DW_LNS_fixed_advance_pc = 9
- };
-
-/* line number extended opcodes */
-enum dwarf_line_number_x_ops
- {
- DW_LNE_end_sequence = 1,
- DW_LNE_set_address = 2,
- DW_LNE_define_file = 3
- };
-
-/* call frame information */
-enum dwarf_call_frame_info
- {
- DW_CFA_advance_loc = 0x40,
- DW_CFA_offset = 0x80,
- DW_CFA_restore = 0xc0,
- DW_CFA_nop = 0x00,
- DW_CFA_set_loc = 0x01,
- DW_CFA_advance_loc1 = 0x02,
- DW_CFA_advance_loc2 = 0x03,
- DW_CFA_advance_loc4 = 0x04,
- DW_CFA_offset_extended = 0x05,
- DW_CFA_restore_extended = 0x06,
- DW_CFA_undefined = 0x07,
- DW_CFA_same_value = 0x08,
- DW_CFA_register = 0x09,
- DW_CFA_remember_state = 0x0a,
- DW_CFA_restore_state = 0x0b,
- DW_CFA_def_cfa = 0x0c,
- DW_CFA_def_cfa_register = 0x0d,
- DW_CFA_def_cfa_offset = 0x0e,
- /* SGI/MIPS specific */
- DW_CFA_MIPS_advance_loc8 = 0x1d
- };
-
-#define DW_CIE_ID 0xffffffff
-#define DW_CIE_VERSION 1
-
-#define DW_CFA_extended 0
-#define DW_CFA_low_user 0x1c
-#define DW_CFA_high_user 0x3f
-
-#define DW_CHILDREN_no 0x00
-#define DW_CHILDREN_yes 0x01
-
-#define DW_ADDR_none 0
-
-/* Source language names and codes. */
-
-enum dwarf_source_language
- {
- DW_LANG_C89 = 0x0001,
- DW_LANG_C = 0x0002,
- DW_LANG_Ada83 = 0x0003,
- DW_LANG_C_plus_plus = 0x0004,
- DW_LANG_Cobol74 = 0x0005,
- DW_LANG_Cobol85 = 0x0006,
- DW_LANG_Fortran77 = 0x0007,
- DW_LANG_Fortran90 = 0x0008,
- DW_LANG_Pascal83 = 0x0009,
- DW_LANG_Modula2 = 0x000a,
- DW_LANG_Mips_Assembler = 0x8001
- };
-
-
-#define DW_LANG_lo_user 0x8000 /* implementation-defined range start */
-#define DW_LANG_hi_user 0xffff /* implementation-defined range start */
-
-/* Names and codes for macro information. */
-
-enum dwarf_macinfo_record_type
- {
- DW_MACINFO_define = 1,
- DW_MACINFO_undef = 2,
- DW_MACINFO_start_file = 3,
- DW_MACINFO_end_file = 4,
- DW_MACINFO_vendor_ext = 255
- };
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
deleted file mode 100644
index 4f9c83b0375..00000000000
--- a/gcc/dwarf2out.c
+++ /dev/null
@@ -1,8686 +0,0 @@
-/* Output Dwarf2 format symbol table information from the GNU C compiler.
- Copyright (C) 1992, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Gary Funck (gary@intrepid.com). Derived from the
- DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com).
- Extensively modified by Jason Merrill (jason@cygnus.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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "config.h"
-
-#ifdef DWARF2_DEBUGGING_INFO
-#include <stdio.h>
-#include <setjmp.h>
-#include "dwarf2.h"
-#include "tree.h"
-#include "flags.h"
-#include "rtl.h"
-#include "hard-reg-set.h"
-#include "regs.h"
-#include "insn-config.h"
-#include "reload.h"
-#include "output.h"
-#include "defaults.h"
-
-/* #define NDEBUG 1 */
-#include "assert.h"
-
-extern char *getpwd ();
-
-/* NOTE: In the comments in this file, many references are made to
- "Debugging Information Entries". This term is abbreviated as `DIE'
- throughout the remainder of this file. */
-
-#if defined(__GNUC__) && (NDEBUG == 1)
-#define inline static inline
-#else
-#define inline static
-#endif
-
-
-/* An internal representation of the DWARF output is built, and then
- walked to generate the DWARF debugging info. The walk of the internal
- representation is done after the entire program has been compiled.
- The types below are used to describe the internal representation. */
-
-/* Each DIE may have a series of attribute/value pairs. Values
- can take on several forms. The forms that are used in this
- impelementation are listed below. */
-typedef enum
- {
- dw_val_class_addr,
- dw_val_class_loc,
- dw_val_class_const,
- dw_val_class_unsigned_const,
- dw_val_class_long_long,
- dw_val_class_float,
- dw_val_class_flag,
- dw_val_class_die_ref,
- dw_val_class_fde_ref,
- dw_val_class_lbl_id,
- dw_val_class_section_offset,
- dw_val_class_str
- }
-dw_val_class;
-
-/* Various DIE's use offsets relative to the beginning of the
- .debug_info section to refer to each other. */
-typedef long int dw_offset;
-
-/* Define typedefs here to avoid circular dependencies. */
-typedef struct die_struct *dw_die_ref;
-typedef struct dw_attr_struct *dw_attr_ref;
-typedef struct dw_val_struct *dw_val_ref;
-typedef struct dw_line_info_struct *dw_line_info_ref;
-typedef struct dw_separate_line_info_struct *dw_separate_line_info_ref;
-typedef struct dw_loc_descr_struct *dw_loc_descr_ref;
-typedef struct dw_cfi_struct *dw_cfi_ref;
-typedef struct dw_fde_struct *dw_fde_ref;
-typedef union dw_cfi_oprnd_struct *dw_cfi_oprnd_ref;
-typedef struct pubname_struct *pubname_ref;
-typedef dw_die_ref *arange_ref;
-
-/* Describe a double word constant value. */
-typedef struct dw_long_long_struct
- {
- unsigned long hi;
- unsigned long low;
- }
-dw_long_long_const;
-
-/* Describe a floating point constant value. */
-typedef struct dw_fp_struct
- {
- long *array;
- unsigned length;
- }
-dw_float_const;
-
-/* Each entry in the line_info_table maintains the file and
- line nuber associated with the label generated for that
- entry. The label gives the PC value associated with
- the line number entry. */
-typedef struct dw_line_info_struct
- {
- unsigned long dw_file_num;
- unsigned long dw_line_num;
- }
-dw_line_info_entry;
-
-/* Line information for functions in separate sections; each one gets its
- own sequence. */
-typedef struct dw_separate_line_info_struct
- {
- unsigned long dw_file_num;
- unsigned long dw_line_num;
- unsigned long function;
- }
-dw_separate_line_info_entry;
-
-/* The dw_val_node describes an attibute's value, as it is
- represnted internally. */
-typedef struct dw_val_struct
- {
- dw_val_class val_class;
- union
- {
- char *val_addr;
- dw_loc_descr_ref val_loc;
- long int val_int;
- long unsigned val_unsigned;
- dw_long_long_const val_long_long;
- dw_float_const val_float;
- dw_die_ref val_die_ref;
- unsigned val_fde_index;
- char *val_str;
- char *val_lbl_id;
- char *val_section;
- unsigned char val_flag;
- }
- v;
- }
-dw_val_node;
-
-/* Locations in memory are described using a sequence of stack machine
- operations. */
-typedef struct dw_loc_descr_struct
- {
- dw_loc_descr_ref dw_loc_next;
- enum dwarf_location_atom dw_loc_opc;
- dw_val_node dw_loc_oprnd1;
- dw_val_node dw_loc_oprnd2;
- }
-dw_loc_descr_node;
-
-/* Each DIE attribute has a field specifying the attribute kind,
- a link to the next attribute in the chain, and an attribute value.
- Attributes are typically linked below the DIE they modify. */
-typedef struct dw_attr_struct
- {
- enum dwarf_attribute dw_attr;
- dw_attr_ref dw_attr_next;
- dw_val_node dw_attr_val;
- }
-dw_attr_node;
-
-/* Call frames are described using a sequence of Call Frame
- Information instructions. The register number, offset
- and address fields are provided as possible operands;
- their use is selected by the opcode field. */
-typedef union dw_cfi_oprnd_struct
- {
- unsigned long dw_cfi_reg_num;
- long int dw_cfi_offset;
- char *dw_cfi_addr;
- }
-dw_cfi_oprnd;
-
-typedef struct dw_cfi_struct
- {
- dw_cfi_ref dw_cfi_next;
- enum dwarf_call_frame_info dw_cfi_opc;
- dw_cfi_oprnd dw_cfi_oprnd1;
- dw_cfi_oprnd dw_cfi_oprnd2;
- }
-dw_cfi_node;
-
-/* All call frame descriptions (FDE's) in the GCC generated DWARF
- refer to a single Common Information Entry (CIE), defined at
- the beginning of the .debug_frame section. This used of a single
- CIE obviates the need to keep track of multiple CIE's
- in the DWARF generation routines below. */
-typedef struct dw_fde_struct
- {
- unsigned long dw_fde_offset;
- char *dw_fde_begin;
- char *dw_fde_current_label;
- char *dw_fde_end;
- dw_cfi_ref dw_fde_cfi;
- }
-dw_fde_node;
-
-/* The Debugging Information Entry (DIE) structure */
-typedef struct die_struct
- {
- enum dwarf_tag die_tag;
- dw_attr_ref die_attr;
- dw_attr_ref die_attr_last;
- dw_die_ref die_parent;
- dw_die_ref die_child;
- dw_die_ref die_child_last;
- dw_die_ref die_sib;
- dw_offset die_offset;
- unsigned long die_abbrev;
- }
-die_node;
-
-/* The pubname structure */
-typedef struct pubname_struct
-{
- dw_die_ref die;
- char * name;
-}
-pubname_entry;
-
-/* How to start an assembler comment. */
-#ifndef ASM_COMMENT_START
-#define ASM_COMMENT_START ";#"
-#endif
-
-/* Define a macro which returns non-zero for a TYPE_DECL which was
- implicitly generated for a tagged type.
-
- Note that unlike the gcc front end (which generates a NULL named
- TYPE_DECL node for each complete tagged type, each array type, and
- each function type node created) the g++ front end generates a
- _named_ TYPE_DECL node for each tagged type node created.
- These TYPE_DECLs have DECL_ARTIFICIAL set, so we know not to
- generate a DW_TAG_typedef DIE for them. */
-#define TYPE_DECL_IS_STUB(decl) \
- (DECL_NAME (decl) == NULL \
- || (DECL_ARTIFICIAL (decl) \
- && is_tagged_type (TREE_TYPE (decl)) \
- && decl == TYPE_STUB_DECL (TREE_TYPE (decl))))
-
-/* Information concerning the compilation unit's programming
- language, and compiler version. */
-extern int flag_traditional;
-extern char *version_string;
-extern char *language_string;
-
-/* Maximum size (in bytes) of an artificially generated label. */
-#define MAX_ARTIFICIAL_LABEL_BYTES 30
-
-/* Make sure we know the sizes of the various types dwarf can describe. These
- are only defaults. If the sizes are different for your target, you should
- override these values by defining the appropriate symbols in your tm.h
- file. */
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-#ifndef PTR_SIZE
-#define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
-#endif
-
-/* The size in bytes of a DWARF field indicating an offset or length
- relative to a debug info section, specified to be 4 bytes in the DWARF-2
- specification. The SGI/MIPS ABI defines it to be the same as PTR_SIZE. */
-#ifndef DWARF_OFFSET_SIZE
-#define DWARF_OFFSET_SIZE 4
-#endif
-
-#define DWARF_VERSION 2
-
-/* Fixed size portion of the DWARF compilation unit header. */
-#define DWARF_COMPILE_UNIT_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 3)
-
-/* Fixed size portion of debugging line information prolog. */
-#define DWARF_LINE_PROLOG_HEADER_SIZE 5
-
-/* Fixed size portion of public names info. */
-#define DWARF_PUBNAMES_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 2)
-
-/* Round SIZE up to the nearest BOUNDARY. */
-#define DWARF_ROUND(SIZE,BOUNDARY) \
- (((SIZE) + (BOUNDARY) - 1) & ~((BOUNDARY) - 1))
-
-/* Fixed size portion of the address range info. */
-#define DWARF_ARANGES_HEADER_SIZE \
- (DWARF_ROUND (2 * DWARF_OFFSET_SIZE + 4, PTR_SIZE * 2) - DWARF_OFFSET_SIZE)
-
-/* Fixed size portion of the CIE (including the length field). */
-#define DWARF_CIE_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 5)
-
-/* The un-padded size of the CIE. Initialized in calc_fde_sizes, used
- in output_call_frame_info. */
-static unsigned cie_size;
-
-/* Offsets recorded in opcodes are a multiple of this alignment factor. */
-#ifdef STACK_GROWS_DOWNWARD
-#define DWARF_CIE_DATA_ALIGNMENT (-UNITS_PER_WORD)
-#else
-#define DWARF_CIE_DATA_ALIGNMENT UNITS_PER_WORD
-#endif
-
-/* Fixed size portion of the FDE. */
-#define DWARF_FDE_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 2 * PTR_SIZE)
-
-/* Define the architecture-dependent minimum instruction length (in bytes).
- In this implementation of DWARF, this field is used for information
- purposes only. Since GCC generates assembly language, we have
- no a priori knowledge of how many instruction bytes are generated
- for each source line, and therefore can use only the DW_LNE_set_address
- and DW_LNS_fixed_advance_pc line information commands. */
-#ifndef DWARF_LINE_MIN_INSTR_LENGTH
-#define DWARF_LINE_MIN_INSTR_LENGTH 4
-#endif
-
-/* Minimum line offset in a special line info. opcode.
- This value was chosen to give a reasonable range of values. */
-#define DWARF_LINE_BASE -10
-
-/* First special line opcde - leave room for the standard opcodes. */
-#define DWARF_LINE_OPCODE_BASE 10
-
-/* Range of line offsets in a special line info. opcode. */
-#define DWARF_LINE_RANGE (254-DWARF_LINE_OPCODE_BASE+1)
-
-/* Flag that indicates the initial value of the is_stmt_start flag.
- In the present implementation, we do not mark any lines as
- the beginning of a source statement, because that information
- is not made available by the GCC front-end. */
-#define DWARF_LINE_DEFAULT_IS_STMT_START 1
-
-/* This location is used by calc_die_sizes() to keep track
- the offset of each DIE within the .debug_info section. */
-static unsigned long next_die_offset;
-
-/* This location is used by calc_fde_sizes() to keep track
- the offset of each FDE within the .debug_frame section. */
-static unsigned long next_fde_offset;
-
-/* Record the root of the DIE's built for the current compilation unit. */
-dw_die_ref comp_unit_die;
-
-/* The number of DIEs with a NULL parent waiting to be relocated. */
-static int limbo_die_count;
-
-/* Pointer to an array of filenames referenced by this compilation unit. */
-static char **file_table;
-
-/* Total number of entries in the table (i.e. array) pointed to by
- `file_table'. This is the *total* and includes both used and unused
- slots. */
-static unsigned file_table_allocated;
-
-/* Number of entries in the file_table which are actually in use. */
-static unsigned file_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the filename
- table. */
-#define FILE_TABLE_INCREMENT 64
-
-/* Local pointer to the name of the main input file. Initialized in
- dwarf2out_init. */
-static char *primary_filename;
-
-/* For Dwarf output, we must assign lexical-blocks id numbers in the order in
- which their beginnings are encountered. We output Dwarf debugging info
- that refers to the beginnings and ends of the ranges of code for each
- lexical block. The labels themselves are generated in final.c, which
- assigns numbers to the blocks in the same way. */
-static unsigned next_block_number = 2;
-
-/* A pointer to the base of a table of references to DIE's that describe
- declarations. The table is indexed by DECL_UID() which is a unique
- number, indentifying each decl. */
-static dw_die_ref *decl_die_table;
-
-/* Number of elements currently allocated for the decl_die_table. */
-static unsigned decl_die_table_allocated;
-
-/* Number of elements in decl_die_table currently in use. */
-static unsigned decl_die_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
- decl_die_table. */
-#define DECL_DIE_TABLE_INCREMENT 256
-
-/* A pointer to the base of a table of references to declaration
- scopes. This table is a display which tracks the nesting
- of declaration scopes at the current scope and containing
- scopes. This table is used to find the proper place to
- define type declaration DIE's. */
-static tree *decl_scope_table;
-
-/* Number of elements currently allocated for the decl_scope_table. */
-static unsigned decl_scope_table_allocated;
-
-/* Current level of nesting of declataion scopes. */
-static unsigned decl_scope_depth;
-
-/* Size (in elements) of increments by which we may expand the
- decl_scope_table. */
-#define DECL_SCOPE_TABLE_INCREMENT 64
-
-/* A pointer to the base of a list of references to DIE's that
- are uniquely identified by their tag, presence/absence of
- children DIE's, and list of attribute/value pairs. */
-static dw_die_ref *abbrev_die_table;
-
-/* Number of elements currently allocated for abbrev_die_table. */
-static unsigned abbrev_die_table_allocated;
-
-/* Number of elements in type_die_table currently in use. */
-static unsigned abbrev_die_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
- abbrev_die_table. */
-#define ABBREV_DIE_TABLE_INCREMENT 256
-
-/* A pointer to the base of a table that contains line information
- for each source code line in .text in the compilation unit. */
-static dw_line_info_ref line_info_table;
-
-/* Number of elements currently allocated for line_info_table. */
-static unsigned line_info_table_allocated;
-
-/* Number of elements in separate_line_info_table currently in use. */
-static unsigned separate_line_info_table_in_use;
-
-/* A pointer to the base of a table that contains line information
- for each source code line outside of .text in the compilation unit. */
-static dw_separate_line_info_ref separate_line_info_table;
-
-/* Number of elements currently allocated for separate_line_info_table. */
-static unsigned separate_line_info_table_allocated;
-
-/* Number of elements in line_info_table currently in use. */
-static unsigned line_info_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
- line_info_table. */
-#define LINE_INFO_TABLE_INCREMENT 1024
-
-/* A pointer to the base of a table that contains frame description
- information for each routine. */
-static dw_fde_ref fde_table;
-
-/* Number of elements currently allocated for fde_table. */
-static unsigned fde_table_allocated;
-
-/* Number of elements in fde_table currently in use. */
-static unsigned fde_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
- fde_table. */
-#define FDE_TABLE_INCREMENT 256
-
-/* A list of call frame insns for the CIE. */
-static dw_cfi_ref cie_cfi_head;
-
-/* A pointer to the base of a table that contains a list of publicly
- accessible names. */
-static pubname_ref pubname_table;
-
-/* Number of elements currently allocated for pubname_table. */
-static unsigned pubname_table_allocated;
-
-/* Number of elements in pubname_table currently in use. */
-static unsigned pubname_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
- pubname_table. */
-#define PUBNAME_TABLE_INCREMENT 64
-
-/* A pointer to the base of a table that contains a list of publicly
- accessible names. */
-static arange_ref arange_table;
-
-/* Number of elements currently allocated for arange_table. */
-static unsigned arange_table_allocated;
-
-/* Number of elements in arange_table currently in use. */
-static unsigned arange_table_in_use;
-
-/* Size (in elements) of increments by which we may expand the
- arange_table. */
-#define ARANGE_TABLE_INCREMENT 64
-
-/* A pointer to the base of a list of pending types which we haven't
- generated DIEs for yet, but which we will have to come back to
- later on. */
-
-static tree *pending_types_list;
-
-/* Number of elements currently allocated for the pending_types_list. */
-
-static unsigned pending_types_allocated;
-
-/* Number of elements of pending_types_list currently in use. */
-
-static unsigned pending_types;
-
-/* Size (in elements) of increments by which we may expand the pending
- types list. Actually, a single hunk of space of this size should
- be enough for most typical programs. */
-
-#define PENDING_TYPES_INCREMENT 64
-
-/* The number of the current function definition for which debugging
- information is being generated. These numbers range from 1 up to the
- maximum number of function definitions contained within the current
- compilation unit. These numbers are used to create unique label id's
- unique to each function definition. */
-static unsigned current_funcdef_number = 1;
-
-/* Some DWARF extensions (e.g., MIPS/SGI) implement a subprogram
- attribute that accelerates the lookup of the FDE associated
- with the subprogram. This variable holds the table index of the FDE
- associated with the current function (body) definition. */
-static unsigned current_funcdef_fde;
-
-/* Record whether the function being analyzed contains inlined functions. */
-static int current_function_has_inlines;
-static int comp_unit_has_inlines;
-
-/* A pointer to the ..._DECL node which we have most recently been working
- on. We keep this around just in case something about it looks screwy and
- we want to tell the user what the source coordinates for the actual
- declaration are. */
-static tree dwarf_last_decl;
-
-/* Forward declarations for functions defined in this file. */
-static void gen_type_die ();
-static void add_type_attribute ();
-static void decls_for_scope ();
-static void gen_decl_die ();
-static unsigned lookup_filename ();
-static int constant_size PROTO((long unsigned));
-static enum dwarf_form value_format PROTO((dw_val_ref));
-static unsigned reg_number ();
-
-/* Definitions of defaults for assembler-dependent names of various
- pseudo-ops and section names.
- Theses may be overridden in the tm.h file (if necessary) for a particular
- assembler. */
-#ifndef UNALIGNED_SHORT_ASM_OP
-#define UNALIGNED_SHORT_ASM_OP ".2byte"
-#endif
-#ifndef UNALIGNED_INT_ASM_OP
-#define UNALIGNED_INT_ASM_OP ".4byte"
-#endif
-#ifndef UNALIGNED_DOUBLE_INT_ASM_OP
-#define UNALIGNED_DOUBLE_INT_ASM_OP ".8byte"
-#endif
-#ifndef ASM_BYTE_OP
-#define ASM_BYTE_OP ".byte"
-#endif
-
-#ifndef UNALIGNED_OFFSET_ASM_OP
-#define UNALIGNED_OFFSET_ASM_OP \
- (DWARF_OFFSET_SIZE == 8 ? UNALIGNED_DOUBLE_INT_ASM_OP : UNALIGNED_INT_ASM_OP)
-#endif
-
-#ifndef UNALIGNED_WORD_ASM_OP
-#define UNALIGNED_WORD_ASM_OP \
- (PTR_SIZE == 8 ? UNALIGNED_DOUBLE_INT_ASM_OP : UNALIGNED_INT_ASM_OP)
-#endif
-
-/* Data and reference forms for relocatable data. */
-#define DW_FORM_data (DWARF_OFFSET_SIZE == 8 ? DW_FORM_data8 : DW_FORM_data4)
-#define DW_FORM_ref (DWARF_OFFSET_SIZE == 8 ? DW_FORM_ref8 : DW_FORM_ref4)
-
-/* Pseudo-op for defining a new section. */
-#ifndef SECTION_ASM_OP
-#define SECTION_ASM_OP ".section"
-#endif
-
-/* The default format used by the ASM_OUTPUT_SECTION macro (see below) to
- print the SECTION_ASM_OP and the section name. The default here works for
- almost all svr4 assemblers, except for the sparc, where the section name
- must be enclosed in double quotes. (See sparcv4.h). */
-#ifndef SECTION_FORMAT
-#define SECTION_FORMAT "\t%s\t%s\n"
-#endif
-
-/* Section names used to hold DWARF debugging information. */
-#ifndef DEBUG_SECTION
-#define DEBUG_SECTION ".debug_info"
-#endif
-#ifndef ABBREV_SECTION
-#define ABBREV_SECTION ".debug_abbrev"
-#endif
-#ifndef ARANGES_SECTION
-#define ARANGES_SECTION ".debug_aranges"
-#endif
-#ifndef DW_MACINFO_SECTION
-#define DW_MACINFO_SECTION ".debug_macinfo"
-#endif
-#ifndef FRAME_SECTION
-#define FRAME_SECTION ".debug_frame"
-#endif
-#ifndef LINE_SECTION
-#define LINE_SECTION ".debug_line"
-#endif
-#ifndef LOC_SECTION
-#define LOC_SECTION ".debug_loc"
-#endif
-#ifndef PUBNAMES_SECTION
-#define PUBNAMES_SECTION ".debug_pubnames"
-#endif
-#ifndef STR_SECTION
-#define STR_SECTION ".debug_str"
-#endif
-
-/* Standerd ELF section names for compiled code and data. */
-#ifndef TEXT_SECTION
-#define TEXT_SECTION ".text"
-#endif
-#ifndef DATA_SECTION
-#define DATA_SECTION ".data"
-#endif
-#ifndef BSS_SECTION
-#define BSS_SECTION ".bss"
-#endif
-
-
-/* Definitions of defaults for formats and names of various special
- (artificial) labels which may be generated within this file (when the -g
- options is used and DWARF_DEBUGGING_INFO is in effect.
- If necessary, these may be overridden from within the tm.h file, but
- typically, overriding these defaults is unnecessary. */
-
-char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
-#ifndef TEXT_END_LABEL
-#define TEXT_END_LABEL "Letext"
-#endif
-#ifndef DATA_END_LABEL
-#define DATA_END_LABEL "Ledata"
-#endif
-#ifndef BSS_END_LABEL
-#define BSS_END_LABEL "Lebss"
-#endif
-#ifndef INSN_LABEL_FMT
-#define INSN_LABEL_FMT "LI%u_"
-#endif
-#ifndef BLOCK_BEGIN_LABEL
-#define BLOCK_BEGIN_LABEL "LBB"
-#endif
-#ifndef BLOCK_END_LABEL
-#define BLOCK_END_LABEL "LBE"
-#endif
-#ifndef BODY_BEGIN_LABEL
-#define BODY_BEGIN_LABEL "Lbb"
-#endif
-#ifndef BODY_END_LABEL
-#define BODY_END_LABEL "Lbe"
-#endif
-#ifndef FUNC_BEGIN_LABEL
-#define FUNC_BEGIN_LABEL "LFB"
-#endif
-#ifndef FUNC_END_LABEL
-#define FUNC_END_LABEL "LFE"
-#endif
-#ifndef LINE_CODE_LABEL
-#define LINE_CODE_LABEL "LM"
-#endif
-#ifndef SEPARATE_LINE_CODE_LABEL
-#define SEPARATE_LINE_CODE_LABEL "LSM"
-#endif
-
-/* Definitions of defaults for various types of primitive assembly language
- output operations. These may be overridden from within the tm.h file,
- but typically, that is unecessary. */
-#ifndef ASM_OUTPUT_SECTION
-#define ASM_OUTPUT_SECTION(FILE, SECTION) \
- fprintf ((FILE), SECTION_FORMAT, SECTION_ASM_OP, SECTION)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA2
-#define ASM_OUTPUT_DWARF_DELTA2(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_SHORT_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA4
-#define ASM_OUTPUT_DWARF_DELTA4(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA
-#define ASM_OUTPUT_DWARF_DELTA(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_OFFSET_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR_DELTA
-#define ASM_OUTPUT_DWARF_ADDR_DELTA(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR
-#define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP); \
- assemble_name (FILE, LABEL); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR_CONST
-#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,ADDR) \
- fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, (ADDR))
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_OFFSET
-#define ASM_OUTPUT_DWARF_OFFSET(FILE,LABEL) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_OFFSET_ASM_OP); \
- assemble_name (FILE, LABEL); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA1
-#define ASM_OUTPUT_DWARF_DATA1(FILE,VALUE) \
- fprintf ((FILE), "\t%s\t0x%x", ASM_BYTE_OP, VALUE)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA2
-#define ASM_OUTPUT_DWARF_DATA2(FILE,VALUE) \
- fprintf ((FILE), "\t%s\t0x%x", UNALIGNED_SHORT_ASM_OP, (unsigned) VALUE)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA4
-#define ASM_OUTPUT_DWARF_DATA4(FILE,VALUE) \
- fprintf ((FILE), "\t%s\t0x%x", UNALIGNED_INT_ASM_OP, (unsigned) VALUE)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA
-#define ASM_OUTPUT_DWARF_DATA(FILE,VALUE) \
- fprintf ((FILE), "\t%s\t0x%lx", UNALIGNED_OFFSET_ASM_OP, \
- (unsigned long) VALUE)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR_DATA
-#define ASM_OUTPUT_DWARF_ADDR_DATA(FILE,VALUE) \
- fprintf ((FILE), "\t%s\t0x%lx", UNALIGNED_WORD_ASM_OP, \
- (unsigned long) VALUE)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA8
-#define ASM_OUTPUT_DWARF_DATA8(FILE,HIGH_VALUE,LOW_VALUE) \
- do { \
- if (WORDS_BIG_ENDIAN) \
- { \
- fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
- fprintf ((FILE), "\t%s\t0x%x", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
- } \
- else \
- { \
- fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
- fprintf ((FILE), "\t%s\t0x%x", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
- } \
- } while (0)
-#endif
-
-/* This is similar to the default ASM_OUTPUT_ASCII, except that no trailing
- newline is produced. When flag_verbose_asm is asserted, we add commnetary
- at the end of the line, so we must avoid output of a newline here. */
-#ifndef ASM_OUTPUT_DWARF_STRING
-#define ASM_OUTPUT_DWARF_STRING(FILE,P) \
- do { \
- register int slen = strlen(P); \
- register char *p = (P); \
- register int i; \
- fprintf (FILE, "\t.ascii \""); \
- for (i = 0; i < slen; i++) \
- { \
- register int c = p[i]; \
- if (c == '\"' || c == '\\') \
- putc ('\\', FILE); \
- if (c >= ' ' && c < 0177) \
- putc (c, FILE); \
- else \
- { \
- fprintf (FILE, "\\%o", c); \
- } \
- } \
- fprintf (FILE, "\\0\""); \
- } \
- while (0)
-#endif
-
-/* Convert a reference to the assembler name of a C-level name. This
- macro has the same effect as ASM_OUTPUT_LABELREF, but copies to
- a string rather than writing to a file. */
-#ifndef ASM_NAME_TO_STRING
-#define ASM_NAME_TO_STRING(STR, NAME) \
- do { \
- if ((NAME)[0] == '*') \
- strcpy (STR, NAME+1); \
- else \
- strcpy (STR, NAME); \
- } \
- while (0)
-#endif
-
-/* The DWARF 2 CFA column which tracks the return address. Normally this
- is the column for PC, or the first column after all of the hard
- registers. */
-#ifndef DWARF_FRAME_RETURN_COLUMN
-#ifdef PC_REGNUM
-#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (PC_REGNUM)
-#else
-#define DWARF_FRAME_RETURN_COLUMN FIRST_PSEUDO_REGISTER + 1
-#endif
-#endif
-
-/* The mapping from gcc register number to DWARF 2 CFA column number. By
- default, we just provide columns for all registers. */
-#ifndef DWARF_FRAME_REGNUM
-#define DWARF_FRAME_REGNUM(REG) DBX_REGISTER_NUMBER (REG)
-#endif
-
-/************************ general utility functions **************************/
-
-/* Return a pointer to a copy of the section string name 's' with all
- attributes stripped off. */
-inline char *
-stripattributes (s)
- register char *s;
-{
- register char *stripped, *p;
- stripped = xstrdup (s);
- p = stripped;
- while (*p && *p != ',')
- p++;
- *p = '\0';
- return stripped;
-}
-
-/* Convert an integer constant expression into assembler syntax.
- Addition and subtraction are the only arithmetic
- that may appear in these expressions. This is an adaptation
- of output_addr_const() in final.c. Here, the target of the
- conversion is a string buffer. We can't use output_addr_const
- directly, because it writes to a file. */
-static void
-addr_const_to_string (str, x)
- char *str;
- rtx x;
-{
- char buf1[256];
- char buf2[256];
-
-restart:
- str[0] = '\0';
- switch (GET_CODE (x))
- {
- case PC:
- if (flag_pic)
- strcat (str, ",");
- else
- abort ();
- break;
-
- case SYMBOL_REF:
- ASM_NAME_TO_STRING (buf1, XSTR (x, 0));
- strcat (str, buf1);
- break;
-
- case LABEL_REF:
- ASM_GENERATE_INTERNAL_LABEL (buf1, "L", CODE_LABEL_NUMBER (XEXP (x, 0)));
- ASM_NAME_TO_STRING (buf2, buf1);
- strcat (str, buf2);
- break;
-
- case CODE_LABEL:
- ASM_GENERATE_INTERNAL_LABEL (buf1, "L", CODE_LABEL_NUMBER (x));
- ASM_NAME_TO_STRING (buf2, buf1);
- strcat (str, buf2);
- break;
-
- case CONST_INT:
- sprintf (buf1,
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- "%d",
-#else
- "%ld",
-#endif
- INTVAL (x));
- strcat (str, buf1);
- break;
-
- case CONST:
- /* This used to output parentheses around the expression, but that does
- not work on the 386 (either ATT or BSD assembler). */
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- break;
-
- case CONST_DOUBLE:
- if (GET_MODE (x) == VOIDmode)
- {
- /* We can use %d if the number is one word and positive. */
- if (CONST_DOUBLE_HIGH (x))
- sprintf (buf1,
-#if HOST_BITS_PER_WIDE_INT == 64
-#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
- "0x%lx%016lx",
-#else
- "0x%x%016x",
-#endif
-#else
-#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
- "0x%lx%08lx",
-#else
- "0x%x%08x",
-#endif
-#endif
- CONST_DOUBLE_HIGH (x), CONST_DOUBLE_LOW (x));
- else if (CONST_DOUBLE_LOW (x) < 0)
- sprintf (buf1,
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- "0x%x",
-#else
- "0x%lx",
-#endif
- CONST_DOUBLE_LOW (x));
- else
- sprintf (buf1,
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- "%d",
-#else
- "%ld",
-#endif
- CONST_DOUBLE_LOW (x));
- strcat (str, buf1);
- }
- else
- /* We can't handle floating point constants; PRINT_OPERAND must
- handle them. */
- output_operand_lossage ("floating constant misused");
- break;
-
- case PLUS:
- /* Some assemblers need integer constants to appear last (eg masm). */
- if (GET_CODE (XEXP (x, 0)) == CONST_INT)
- {
- addr_const_to_string (buf1, XEXP (x, 1));
- strcat (str, buf1);
- if (INTVAL (XEXP (x, 0)) >= 0)
- strcat (str, "+");
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- }
- else
- {
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- if (INTVAL (XEXP (x, 1)) >= 0)
- strcat (str, "+");
- addr_const_to_string (buf1, XEXP (x, 1));
- strcat (str, buf1);
- }
- break;
-
- case MINUS:
- /* Avoid outputting things like x-x or x+5-x, since some assemblers
- can't handle that. */
- x = simplify_subtraction (x);
- if (GET_CODE (x) != MINUS)
- goto restart;
-
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- strcat (str, "-");
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) < 0)
- {
- strcat (str, ASM_OPEN_PAREN);
- addr_const_to_string (buf1, XEXP (x, 1));
- strcat (str, buf1);
- strcat (str, ASM_CLOSE_PAREN);
- }
- else
- {
- addr_const_to_string (buf1, XEXP (x, 1));
- strcat (str, buf1);
- }
- break;
-
- case ZERO_EXTEND:
- case SIGN_EXTEND:
- addr_const_to_string (buf1, XEXP (x, 0));
- strcat (str, buf1);
- break;
-
- default:
- output_operand_lossage ("invalid expression as operand");
- }
-}
-
-/* Convert an address constant to a string, and return a pointer to
- a copy of the result, located on the heap. */
-static char *
-addr_to_string (x)
- rtx x;
-{
- char buf[1024];
- addr_const_to_string (buf, x);
- return xstrdup (buf);
-}
-
-/* Test if rtl node points to a psuedo register. */
-inline int
-is_pseudo_reg (rtl)
- register rtx rtl;
-{
- return (((GET_CODE (rtl) == REG) && (REGNO (rtl) >= FIRST_PSEUDO_REGISTER))
- || ((GET_CODE (rtl) == SUBREG)
- && (REGNO (XEXP (rtl, 0)) >= FIRST_PSEUDO_REGISTER)));
-}
-
-
-/* Return a reference to a type, with its const and volatile qualifiers
- removed. */
-inline tree
-type_main_variant (type)
- register tree type;
-{
- type = TYPE_MAIN_VARIANT (type);
-
- /* There really should be only one main variant among any group of variants
- of a given type (and all of the MAIN_VARIANT values for all members of
- the group should point to that one type) but sometimes the C front-end
- messes this up for array types, so we work around that bug here. */
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- while (type != TYPE_MAIN_VARIANT (type))
- type = TYPE_MAIN_VARIANT (type);
- }
- return type;
-}
-
-/* Return non-zero if the given type node represents a tagged type. */
-inline int
-is_tagged_type (type)
- register tree type;
-{
- register enum tree_code code = TREE_CODE (type);
-
- return (code == RECORD_TYPE || code == UNION_TYPE
- || code == QUAL_UNION_TYPE || code == ENUMERAL_TYPE);
-}
-
-/* Convert a DIE tag into its string name. */
-static char *
-dwarf_tag_name (tag)
- register unsigned tag;
-{
- switch (tag)
- {
- case DW_TAG_padding:
- return "DW_TAG_padding";
- case DW_TAG_array_type:
- return "DW_TAG_array_type";
- case DW_TAG_class_type:
- return "DW_TAG_class_type";
- case DW_TAG_entry_point:
- return "DW_TAG_entry_point";
- case DW_TAG_enumeration_type:
- return "DW_TAG_enumeration_type";
- case DW_TAG_formal_parameter:
- return "DW_TAG_formal_parameter";
- case DW_TAG_imported_declaration:
- return "DW_TAG_imported_declaration";
- case DW_TAG_label:
- return "DW_TAG_label";
- case DW_TAG_lexical_block:
- return "DW_TAG_lexical_block";
- case DW_TAG_member:
- return "DW_TAG_member";
- case DW_TAG_pointer_type:
- return "DW_TAG_pointer_type";
- case DW_TAG_reference_type:
- return "DW_TAG_reference_type";
- case DW_TAG_compile_unit:
- return "DW_TAG_compile_unit";
- case DW_TAG_string_type:
- return "DW_TAG_string_type";
- case DW_TAG_structure_type:
- return "DW_TAG_structure_type";
- case DW_TAG_subroutine_type:
- return "DW_TAG_subroutine_type";
- case DW_TAG_typedef:
- return "DW_TAG_typedef";
- case DW_TAG_union_type:
- return "DW_TAG_union_type";
- case DW_TAG_unspecified_parameters:
- return "DW_TAG_unspecified_parameters";
- case DW_TAG_variant:
- return "DW_TAG_variant";
- case DW_TAG_common_block:
- return "DW_TAG_common_block";
- case DW_TAG_common_inclusion:
- return "DW_TAG_common_inclusion";
- case DW_TAG_inheritance:
- return "DW_TAG_inheritance";
- case DW_TAG_inlined_subroutine:
- return "DW_TAG_inlined_subroutine";
- case DW_TAG_module:
- return "DW_TAG_module";
- case DW_TAG_ptr_to_member_type:
- return "DW_TAG_ptr_to_member_type";
- case DW_TAG_set_type:
- return "DW_TAG_set_type";
- case DW_TAG_subrange_type:
- return "DW_TAG_subrange_type";
- case DW_TAG_with_stmt:
- return "DW_TAG_with_stmt";
- case DW_TAG_access_declaration:
- return "DW_TAG_access_declaration";
- case DW_TAG_base_type:
- return "DW_TAG_base_type";
- case DW_TAG_catch_block:
- return "DW_TAG_catch_block";
- case DW_TAG_const_type:
- return "DW_TAG_const_type";
- case DW_TAG_constant:
- return "DW_TAG_constant";
- case DW_TAG_enumerator:
- return "DW_TAG_enumerator";
- case DW_TAG_file_type:
- return "DW_TAG_file_type";
- case DW_TAG_friend:
- return "DW_TAG_friend";
- case DW_TAG_namelist:
- return "DW_TAG_namelist";
- case DW_TAG_namelist_item:
- return "DW_TAG_namelist_item";
- case DW_TAG_packed_type:
- return "DW_TAG_packed_type";
- case DW_TAG_subprogram:
- return "DW_TAG_subprogram";
- case DW_TAG_template_type_param:
- return "DW_TAG_template_type_param";
- case DW_TAG_template_value_param:
- return "DW_TAG_template_value_param";
- case DW_TAG_thrown_type:
- return "DW_TAG_thrown_type";
- case DW_TAG_try_block:
- return "DW_TAG_try_block";
- case DW_TAG_variant_part:
- return "DW_TAG_variant_part";
- case DW_TAG_variable:
- return "DW_TAG_variable";
- case DW_TAG_volatile_type:
- return "DW_TAG_volatile_type";
- case DW_TAG_MIPS_loop:
- return "DW_TAG_MIPS_loop";
- case DW_TAG_format_label:
- return "DW_TAG_format_label";
- case DW_TAG_function_template:
- return "DW_TAG_function_template";
- case DW_TAG_class_template:
- return "DW_TAG_class_template";
- default:
- return "DW_TAG_<unknown>";
- }
-}
-
-/* Convert a DWARF attribute code into its string name. */
-static char *
-dwarf_attr_name (attr)
- register unsigned attr;
-{
- switch (attr)
- {
- case DW_AT_sibling:
- return "DW_AT_sibling";
- case DW_AT_location:
- return "DW_AT_location";
- case DW_AT_name:
- return "DW_AT_name";
- case DW_AT_ordering:
- return "DW_AT_ordering";
- case DW_AT_subscr_data:
- return "DW_AT_subscr_data";
- case DW_AT_byte_size:
- return "DW_AT_byte_size";
- case DW_AT_bit_offset:
- return "DW_AT_bit_offset";
- case DW_AT_bit_size:
- return "DW_AT_bit_size";
- case DW_AT_element_list:
- return "DW_AT_element_list";
- case DW_AT_stmt_list:
- return "DW_AT_stmt_list";
- case DW_AT_low_pc:
- return "DW_AT_low_pc";
- case DW_AT_high_pc:
- return "DW_AT_high_pc";
- case DW_AT_language:
- return "DW_AT_language";
- case DW_AT_member:
- return "DW_AT_member";
- case DW_AT_discr:
- return "DW_AT_discr";
- case DW_AT_discr_value:
- return "DW_AT_discr_value";
- case DW_AT_visibility:
- return "DW_AT_visibility";
- case DW_AT_import:
- return "DW_AT_import";
- case DW_AT_string_length:
- return "DW_AT_string_length";
- case DW_AT_common_reference:
- return "DW_AT_common_reference";
- case DW_AT_comp_dir:
- return "DW_AT_comp_dir";
- case DW_AT_const_value:
- return "DW_AT_const_value";
- case DW_AT_containing_type:
- return "DW_AT_containing_type";
- case DW_AT_default_value:
- return "DW_AT_default_value";
- case DW_AT_inline:
- return "DW_AT_inline";
- case DW_AT_is_optional:
- return "DW_AT_is_optional";
- case DW_AT_lower_bound:
- return "DW_AT_lower_bound";
- case DW_AT_producer:
- return "DW_AT_producer";
- case DW_AT_prototyped:
- return "DW_AT_prototyped";
- case DW_AT_return_addr:
- return "DW_AT_return_addr";
- case DW_AT_start_scope:
- return "DW_AT_start_scope";
- case DW_AT_stride_size:
- return "DW_AT_stride_size";
- case DW_AT_upper_bound:
- return "DW_AT_upper_bound";
- case DW_AT_abstract_origin:
- return "DW_AT_abstract_origin";
- case DW_AT_accessibility:
- return "DW_AT_accessibility";
- case DW_AT_address_class:
- return "DW_AT_address_class";
- case DW_AT_artificial:
- return "DW_AT_artificial";
- case DW_AT_base_types:
- return "DW_AT_base_types";
- case DW_AT_calling_convention:
- return "DW_AT_calling_convention";
- case DW_AT_count:
- return "DW_AT_count";
- case DW_AT_data_member_location:
- return "DW_AT_data_member_location";
- case DW_AT_decl_column:
- return "DW_AT_decl_column";
- case DW_AT_decl_file:
- return "DW_AT_decl_file";
- case DW_AT_decl_line:
- return "DW_AT_decl_line";
- case DW_AT_declaration:
- return "DW_AT_declaration";
- case DW_AT_discr_list:
- return "DW_AT_discr_list";
- case DW_AT_encoding:
- return "DW_AT_encoding";
- case DW_AT_external:
- return "DW_AT_external";
- case DW_AT_frame_base:
- return "DW_AT_frame_base";
- case DW_AT_friend:
- return "DW_AT_friend";
- case DW_AT_identifier_case:
- return "DW_AT_identifier_case";
- case DW_AT_macro_info:
- return "DW_AT_macro_info";
- case DW_AT_namelist_items:
- return "DW_AT_namelist_items";
- case DW_AT_priority:
- return "DW_AT_priority";
- case DW_AT_segment:
- return "DW_AT_segment";
- case DW_AT_specification:
- return "DW_AT_specification";
- case DW_AT_static_link:
- return "DW_AT_static_link";
- case DW_AT_type:
- return "DW_AT_type";
- case DW_AT_use_location:
- return "DW_AT_use_location";
- case DW_AT_variable_parameter:
- return "DW_AT_variable_parameter";
- case DW_AT_virtuality:
- return "DW_AT_virtuality";
- case DW_AT_vtable_elem_location:
- return "DW_AT_vtable_elem_location";
-
- case DW_AT_MIPS_fde:
- return "DW_AT_MIPS_fde";
- case DW_AT_MIPS_loop_begin:
- return "DW_AT_MIPS_loop_begin";
- case DW_AT_MIPS_tail_loop_begin:
- return "DW_AT_MIPS_tail_loop_begin";
- case DW_AT_MIPS_epilog_begin:
- return "DW_AT_MIPS_epilog_begin";
- case DW_AT_MIPS_loop_unroll_factor:
- return "DW_AT_MIPS_loop_unroll_factor";
- case DW_AT_MIPS_software_pipeline_depth:
- return "DW_AT_MIPS_software_pipeline_depth";
- case DW_AT_MIPS_linkage_name:
- return "DW_AT_MIPS_linkage_name";
- case DW_AT_MIPS_stride:
- return "DW_AT_MIPS_stride";
- case DW_AT_MIPS_abstract_name:
- return "DW_AT_MIPS_abstract_name";
- case DW_AT_MIPS_clone_origin:
- return "DW_AT_MIPS_clone_origin";
- case DW_AT_MIPS_has_inlines:
- return "DW_AT_MIPS_has_inlines";
-
- case DW_AT_sf_names:
- return "DW_AT_sf_names";
- case DW_AT_src_info:
- return "DW_AT_src_info";
- case DW_AT_mac_info:
- return "DW_AT_mac_info";
- case DW_AT_src_coords:
- return "DW_AT_src_coords";
- case DW_AT_body_begin:
- return "DW_AT_body_begin";
- case DW_AT_body_end:
- return "DW_AT_body_end";
- default:
- return "DW_AT_<unknown>";
- }
-}
-
-/* Convert a DWARF value form code into its string name. */
-static char *
-dwarf_form_name (form)
- register unsigned form;
-{
- switch (form)
- {
- case DW_FORM_addr:
- return "DW_FORM_addr";
- case DW_FORM_block2:
- return "DW_FORM_block2";
- case DW_FORM_block4:
- return "DW_FORM_block4";
- case DW_FORM_data2:
- return "DW_FORM_data2";
- case DW_FORM_data4:
- return "DW_FORM_data4";
- case DW_FORM_data8:
- return "DW_FORM_data8";
- case DW_FORM_string:
- return "DW_FORM_string";
- case DW_FORM_block:
- return "DW_FORM_block";
- case DW_FORM_block1:
- return "DW_FORM_block1";
- case DW_FORM_data1:
- return "DW_FORM_data1";
- case DW_FORM_flag:
- return "DW_FORM_flag";
- case DW_FORM_sdata:
- return "DW_FORM_sdata";
- case DW_FORM_strp:
- return "DW_FORM_strp";
- case DW_FORM_udata:
- return "DW_FORM_udata";
- case DW_FORM_ref_addr:
- return "DW_FORM_ref_addr";
- case DW_FORM_ref1:
- return "DW_FORM_ref1";
- case DW_FORM_ref2:
- return "DW_FORM_ref2";
- case DW_FORM_ref4:
- return "DW_FORM_ref4";
- case DW_FORM_ref8:
- return "DW_FORM_ref8";
- case DW_FORM_ref_udata:
- return "DW_FORM_ref_udata";
- case DW_FORM_indirect:
- return "DW_FORM_indirect";
- default:
- return "DW_FORM_<unknown>";
- }
-}
-
-/* Convert a DWARF stack opcode into its string name. */
-static char *
-dwarf_stack_op_name (op)
- register unsigned op;
-{
- switch (op)
- {
- case DW_OP_addr:
- return "DW_OP_addr";
- case DW_OP_deref:
- return "DW_OP_deref";
- case DW_OP_const1u:
- return "DW_OP_const1u";
- case DW_OP_const1s:
- return "DW_OP_const1s";
- case DW_OP_const2u:
- return "DW_OP_const2u";
- case DW_OP_const2s:
- return "DW_OP_const2s";
- case DW_OP_const4u:
- return "DW_OP_const4u";
- case DW_OP_const4s:
- return "DW_OP_const4s";
- case DW_OP_const8u:
- return "DW_OP_const8u";
- case DW_OP_const8s:
- return "DW_OP_const8s";
- case DW_OP_constu:
- return "DW_OP_constu";
- case DW_OP_consts:
- return "DW_OP_consts";
- case DW_OP_dup:
- return "DW_OP_dup";
- case DW_OP_drop:
- return "DW_OP_drop";
- case DW_OP_over:
- return "DW_OP_over";
- case DW_OP_pick:
- return "DW_OP_pick";
- case DW_OP_swap:
- return "DW_OP_swap";
- case DW_OP_rot:
- return "DW_OP_rot";
- case DW_OP_xderef:
- return "DW_OP_xderef";
- case DW_OP_abs:
- return "DW_OP_abs";
- case DW_OP_and:
- return "DW_OP_and";
- case DW_OP_div:
- return "DW_OP_div";
- case DW_OP_minus:
- return "DW_OP_minus";
- case DW_OP_mod:
- return "DW_OP_mod";
- case DW_OP_mul:
- return "DW_OP_mul";
- case DW_OP_neg:
- return "DW_OP_neg";
- case DW_OP_not:
- return "DW_OP_not";
- case DW_OP_or:
- return "DW_OP_or";
- case DW_OP_plus:
- return "DW_OP_plus";
- case DW_OP_plus_uconst:
- return "DW_OP_plus_uconst";
- case DW_OP_shl:
- return "DW_OP_shl";
- case DW_OP_shr:
- return "DW_OP_shr";
- case DW_OP_shra:
- return "DW_OP_shra";
- case DW_OP_xor:
- return "DW_OP_xor";
- case DW_OP_bra:
- return "DW_OP_bra";
- case DW_OP_eq:
- return "DW_OP_eq";
- case DW_OP_ge:
- return "DW_OP_ge";
- case DW_OP_gt:
- return "DW_OP_gt";
- case DW_OP_le:
- return "DW_OP_le";
- case DW_OP_lt:
- return "DW_OP_lt";
- case DW_OP_ne:
- return "DW_OP_ne";
- case DW_OP_skip:
- return "DW_OP_skip";
- case DW_OP_lit0:
- return "DW_OP_lit0";
- case DW_OP_lit1:
- return "DW_OP_lit1";
- case DW_OP_lit2:
- return "DW_OP_lit2";
- case DW_OP_lit3:
- return "DW_OP_lit3";
- case DW_OP_lit4:
- return "DW_OP_lit4";
- case DW_OP_lit5:
- return "DW_OP_lit5";
- case DW_OP_lit6:
- return "DW_OP_lit6";
- case DW_OP_lit7:
- return "DW_OP_lit7";
- case DW_OP_lit8:
- return "DW_OP_lit8";
- case DW_OP_lit9:
- return "DW_OP_lit9";
- case DW_OP_lit10:
- return "DW_OP_lit10";
- case DW_OP_lit11:
- return "DW_OP_lit11";
- case DW_OP_lit12:
- return "DW_OP_lit12";
- case DW_OP_lit13:
- return "DW_OP_lit13";
- case DW_OP_lit14:
- return "DW_OP_lit14";
- case DW_OP_lit15:
- return "DW_OP_lit15";
- case DW_OP_lit16:
- return "DW_OP_lit16";
- case DW_OP_lit17:
- return "DW_OP_lit17";
- case DW_OP_lit18:
- return "DW_OP_lit18";
- case DW_OP_lit19:
- return "DW_OP_lit19";
- case DW_OP_lit20:
- return "DW_OP_lit20";
- case DW_OP_lit21:
- return "DW_OP_lit21";
- case DW_OP_lit22:
- return "DW_OP_lit22";
- case DW_OP_lit23:
- return "DW_OP_lit23";
- case DW_OP_lit24:
- return "DW_OP_lit24";
- case DW_OP_lit25:
- return "DW_OP_lit25";
- case DW_OP_lit26:
- return "DW_OP_lit26";
- case DW_OP_lit27:
- return "DW_OP_lit27";
- case DW_OP_lit28:
- return "DW_OP_lit28";
- case DW_OP_lit29:
- return "DW_OP_lit29";
- case DW_OP_lit30:
- return "DW_OP_lit30";
- case DW_OP_lit31:
- return "DW_OP_lit31";
- case DW_OP_reg0:
- return "DW_OP_reg0";
- case DW_OP_reg1:
- return "DW_OP_reg1";
- case DW_OP_reg2:
- return "DW_OP_reg2";
- case DW_OP_reg3:
- return "DW_OP_reg3";
- case DW_OP_reg4:
- return "DW_OP_reg4";
- case DW_OP_reg5:
- return "DW_OP_reg5";
- case DW_OP_reg6:
- return "DW_OP_reg6";
- case DW_OP_reg7:
- return "DW_OP_reg7";
- case DW_OP_reg8:
- return "DW_OP_reg8";
- case DW_OP_reg9:
- return "DW_OP_reg9";
- case DW_OP_reg10:
- return "DW_OP_reg10";
- case DW_OP_reg11:
- return "DW_OP_reg11";
- case DW_OP_reg12:
- return "DW_OP_reg12";
- case DW_OP_reg13:
- return "DW_OP_reg13";
- case DW_OP_reg14:
- return "DW_OP_reg14";
- case DW_OP_reg15:
- return "DW_OP_reg15";
- case DW_OP_reg16:
- return "DW_OP_reg16";
- case DW_OP_reg17:
- return "DW_OP_reg17";
- case DW_OP_reg18:
- return "DW_OP_reg18";
- case DW_OP_reg19:
- return "DW_OP_reg19";
- case DW_OP_reg20:
- return "DW_OP_reg20";
- case DW_OP_reg21:
- return "DW_OP_reg21";
- case DW_OP_reg22:
- return "DW_OP_reg22";
- case DW_OP_reg23:
- return "DW_OP_reg23";
- case DW_OP_reg24:
- return "DW_OP_reg24";
- case DW_OP_reg25:
- return "DW_OP_reg25";
- case DW_OP_reg26:
- return "DW_OP_reg26";
- case DW_OP_reg27:
- return "DW_OP_reg27";
- case DW_OP_reg28:
- return "DW_OP_reg28";
- case DW_OP_reg29:
- return "DW_OP_reg29";
- case DW_OP_reg30:
- return "DW_OP_reg30";
- case DW_OP_reg31:
- return "DW_OP_reg31";
- case DW_OP_breg0:
- return "DW_OP_breg0";
- case DW_OP_breg1:
- return "DW_OP_breg1";
- case DW_OP_breg2:
- return "DW_OP_breg2";
- case DW_OP_breg3:
- return "DW_OP_breg3";
- case DW_OP_breg4:
- return "DW_OP_breg4";
- case DW_OP_breg5:
- return "DW_OP_breg5";
- case DW_OP_breg6:
- return "DW_OP_breg6";
- case DW_OP_breg7:
- return "DW_OP_breg7";
- case DW_OP_breg8:
- return "DW_OP_breg8";
- case DW_OP_breg9:
- return "DW_OP_breg9";
- case DW_OP_breg10:
- return "DW_OP_breg10";
- case DW_OP_breg11:
- return "DW_OP_breg11";
- case DW_OP_breg12:
- return "DW_OP_breg12";
- case DW_OP_breg13:
- return "DW_OP_breg13";
- case DW_OP_breg14:
- return "DW_OP_breg14";
- case DW_OP_breg15:
- return "DW_OP_breg15";
- case DW_OP_breg16:
- return "DW_OP_breg16";
- case DW_OP_breg17:
- return "DW_OP_breg17";
- case DW_OP_breg18:
- return "DW_OP_breg18";
- case DW_OP_breg19:
- return "DW_OP_breg19";
- case DW_OP_breg20:
- return "DW_OP_breg20";
- case DW_OP_breg21:
- return "DW_OP_breg21";
- case DW_OP_breg22:
- return "DW_OP_breg22";
- case DW_OP_breg23:
- return "DW_OP_breg23";
- case DW_OP_breg24:
- return "DW_OP_breg24";
- case DW_OP_breg25:
- return "DW_OP_breg25";
- case DW_OP_breg26:
- return "DW_OP_breg26";
- case DW_OP_breg27:
- return "DW_OP_breg27";
- case DW_OP_breg28:
- return "DW_OP_breg28";
- case DW_OP_breg29:
- return "DW_OP_breg29";
- case DW_OP_breg30:
- return "DW_OP_breg30";
- case DW_OP_breg31:
- return "DW_OP_breg31";
- case DW_OP_regx:
- return "DW_OP_regx";
- case DW_OP_fbreg:
- return "DW_OP_fbreg";
- case DW_OP_bregx:
- return "DW_OP_bregx";
- case DW_OP_piece:
- return "DW_OP_piece";
- case DW_OP_deref_size:
- return "DW_OP_deref_size";
- case DW_OP_xderef_size:
- return "DW_OP_xderef_size";
- case DW_OP_nop:
- return "DW_OP_nop";
- default:
- return "OP_<unknown>";
- }
-}
-
-/* Convert a DWARF type code into its string name. */
-static char *
-dwarf_type_encoding_name (enc)
- register unsigned enc;
-{
- switch (enc)
- {
- case DW_ATE_address:
- return "DW_ATE_address";
- case DW_ATE_boolean:
- return "DW_ATE_boolean";
- case DW_ATE_complex_float:
- return "DW_ATE_complex_float";
- case DW_ATE_float:
- return "DW_ATE_float";
- case DW_ATE_signed:
- return "DW_ATE_signed";
- case DW_ATE_signed_char:
- return "DW_ATE_signed_char";
- case DW_ATE_unsigned:
- return "DW_ATE_unsigned";
- case DW_ATE_unsigned_char:
- return "DW_ATE_unsigned_char";
- default:
- return "DW_ATE_<unknown>";
- }
-}
-
-/* Convert a DWARF call frame info. operation to its string name */
-static char *
-dwarf_cfi_name (cfi_opc)
- register unsigned cfi_opc;
-{
- switch (cfi_opc)
- {
- case DW_CFA_advance_loc:
- return "DW_CFA_advance_loc";
- case DW_CFA_offset:
- return "DW_CFA_offset";
- case DW_CFA_restore:
- return "DW_CFA_restore";
- case DW_CFA_nop:
- return "DW_CFA_nop";
- case DW_CFA_set_loc:
- return "DW_CFA_set_loc";
- case DW_CFA_advance_loc1:
- return "DW_CFA_advance_loc1";
- case DW_CFA_advance_loc2:
- return "DW_CFA_advance_loc2";
- case DW_CFA_advance_loc4:
- return "DW_CFA_advance_loc4";
- case DW_CFA_offset_extended:
- return "DW_CFA_offset_extended";
- case DW_CFA_restore_extended:
- return "DW_CFA_restore_extended";
- case DW_CFA_undefined:
- return "DW_CFA_undefined";
- case DW_CFA_same_value:
- return "DW_CFA_same_value";
- case DW_CFA_register:
- return "DW_CFA_register";
- case DW_CFA_remember_state:
- return "DW_CFA_remember_state";
- case DW_CFA_restore_state:
- return "DW_CFA_restore_state";
- case DW_CFA_def_cfa:
- return "DW_CFA_def_cfa";
- case DW_CFA_def_cfa_register:
- return "DW_CFA_def_cfa_register";
- case DW_CFA_def_cfa_offset:
- return "DW_CFA_def_cfa_offset";
- /* SGI/MIPS specific */
- case DW_CFA_MIPS_advance_loc8:
- return "DW_CFA_MIPS_advance_loc8";
- default:
- return "DW_CFA_<unknown>";
- }
-}
-
-/* Determine the "ultimate origin" of a decl. The decl may be an inlined
- instance of an inlined instance of a decl which is local to an inline
- function, so we have to trace all of the way back through the origin chain
- to find out what sort of node actually served as the original seed for the
- given block. */
-static tree
-decl_ultimate_origin (decl)
- register tree decl;
-{
- register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl);
-
- if (immediate_origin == NULL)
- return NULL;
- else
- {
- register tree ret_val;
- register tree lookahead = immediate_origin;
-
- do
- {
- ret_val = lookahead;
- lookahead = DECL_ABSTRACT_ORIGIN (ret_val);
- }
- while (lookahead != NULL && lookahead != ret_val);
- return ret_val;
- }
-}
-
-/* Determine the "ultimate origin" of a block. The block may be an inlined
- instance of an inlined instance of a block which is local to an inline
- function, so we have to trace all of the way back through the origin chain
- to find out what sort of node actually served as the original seed for the
- given block. */
-static tree
-block_ultimate_origin (block)
- register tree block;
-{
- register tree immediate_origin = BLOCK_ABSTRACT_ORIGIN (block);
-
- if (immediate_origin == NULL)
- return NULL;
- else
- {
- register tree ret_val;
- register tree lookahead = immediate_origin;
-
- do
- {
- ret_val = lookahead;
- lookahead = (TREE_CODE (ret_val) == BLOCK)
- ? BLOCK_ABSTRACT_ORIGIN (ret_val)
- : NULL;
- }
- while (lookahead != NULL && lookahead != ret_val);
- return ret_val;
- }
-}
-
-/* Get the class to which DECL belongs, if any. In g++, the DECL_CONTEXT
- of a virtual function may refer to a base class, so we check the 'this'
- parameter. */
-
-static tree
-decl_class_context (decl)
- tree decl;
-{
- tree context = NULL_TREE;
- if (TREE_CODE (decl) != FUNCTION_DECL || ! DECL_VINDEX (decl))
- context = DECL_CONTEXT (decl);
- else
- context = TYPE_MAIN_VARIANT
- (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
-
- if (context && TREE_CODE_CLASS (TREE_CODE (context)) != 't')
- context = NULL_TREE;
-
- return context;
-}
-
-/**************** DIE internal representation constturction *******************/
-
-/* Add an attribute/value pair to a DIE */
-inline void
-add_dwarf_attr (die, attr)
- register dw_die_ref die;
- register dw_attr_ref attr;
-{
- if (die != NULL && attr != NULL)
- {
- if (die->die_attr == NULL)
- {
- die->die_attr = attr;
- die->die_attr_last = attr;
- }
- else
- {
- die->die_attr_last->dw_attr_next = attr;
- die->die_attr_last = attr;
- }
- }
-}
-
-/* Add a flag value attribute to a DIE. */
-inline void
-add_AT_flag (die, attr_kind, flag)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register unsigned flag;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_flag;
- attr->dw_attr_val.v.val_flag = flag;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add a signed integer attribute value to a DIE. */
-inline void
-add_AT_int (die, attr_kind, int_val)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register long int int_val;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_const;
- attr->dw_attr_val.v.val_int = int_val;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add an unsigned integer attribute value to a DIE. */
-inline void
-add_AT_unsigned (die, attr_kind, unsigned_val)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register unsigned long unsigned_val;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_unsigned_const;
- attr->dw_attr_val.v.val_unsigned = unsigned_val;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add an unsigned double integer attribute value to a DIE. */
-inline void
-add_AT_long_long (die, attr_kind, val_hi, val_low)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register unsigned long val_hi;
- register unsigned long val_low;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_long_long;
- attr->dw_attr_val.v.val_long_long.hi = val_hi;
- attr->dw_attr_val.v.val_long_long.low = val_low;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add a floating point attribute value to a DIE and return it. */
-inline void
-add_AT_float (die, attr_kind, length, array)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register unsigned length;
- register long *array;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_float;
- attr->dw_attr_val.v.val_float.length = length;
- attr->dw_attr_val.v.val_float.array = array;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add a string attribute value to a DIE. */
-inline void
-add_AT_string (die, attr_kind, str)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register char *str;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_str;
- attr->dw_attr_val.v.val_str = xstrdup (str);
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add a DIE reference attribute value to a DIE. */
-inline void
-add_AT_die_ref (die, attr_kind, targ_die)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register dw_die_ref targ_die;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_die_ref;
- attr->dw_attr_val.v.val_die_ref = targ_die;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add an FDE reference attribute value to a DIE. */
-inline void
-add_AT_fde_ref (die, attr_kind, targ_fde)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register unsigned targ_fde;
-{
- register dw_attr_ref attr;
-
- attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_fde_ref;
- attr->dw_attr_val.v.val_fde_index = targ_fde;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add a location description attribute value to a DIE. */
-inline void
-add_AT_loc (die, attr_kind, loc)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register dw_loc_descr_ref loc;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_loc;
- attr->dw_attr_val.v.val_loc = loc;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add an address constant attribute value to a DIE. */
-inline void
-add_AT_addr (die, attr_kind, addr)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- char *addr;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_addr;
- attr->dw_attr_val.v.val_addr = addr;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add a label identifier attribute value to a DIE. */
-inline void
-add_AT_lbl_id (die, attr_kind, lbl_id)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register char *lbl_id;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_lbl_id;
- attr->dw_attr_val.v.val_lbl_id = xstrdup (lbl_id);
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Add a section offset attribute value to a DIE. */
-inline void
-add_AT_section_offset (die, attr_kind, section)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
- register char *section;
-{
- register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_section_offset;
- attr->dw_attr_val.v.val_section = section;
- add_dwarf_attr (die, attr);
- }
-}
-
-/* Test if die refers to an external subroutine. */
-inline int
-is_extern_subr_die (die)
- register dw_die_ref die;
-{
- register dw_attr_ref a;
- register int is_subr = FALSE;
- register int is_extern = FALSE;
- if (die != NULL && die->die_tag == DW_TAG_subprogram)
- {
- is_subr = TRUE;
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
- {
- if (a->dw_attr == DW_AT_external
- && a->dw_attr_val.val_class == dw_val_class_flag
- && a->dw_attr_val.v.val_flag != 0)
- {
- is_extern = TRUE;
- break;
- }
- }
- }
- return is_subr && is_extern;
-}
-
-/* Get the attribute of type attr_kind. */
-inline dw_attr_ref
-get_AT (die, attr_kind)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
-{
- register dw_attr_ref a;
- register dw_die_ref spec = NULL;
-
- if (die != NULL)
- {
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
- {
- if (a->dw_attr == attr_kind)
- return a;
- if (a->dw_attr == DW_AT_specification
- || a->dw_attr == DW_AT_abstract_origin)
- spec = a->dw_attr_val.v.val_die_ref;
- }
- if (spec)
- return get_AT (spec, attr_kind);
- }
- return NULL;
-}
-
-/* Return the "low pc" attribute value, typically associated with
- a subprogram DIE. Return null if the "low pc" attribute is
- either not prsent, or if it cannot be represented as an
- assembler label identifier. */
-inline char *
-get_AT_low_pc (die)
- register dw_die_ref die;
-{
- register dw_attr_ref a = get_AT (die, DW_AT_low_pc);
- if (a && a->dw_attr_val.val_class == dw_val_class_lbl_id)
- return a->dw_attr_val.v.val_lbl_id;
- return NULL;
-}
-
-/* Return the "high pc" attribute value, typically associated with
- a subprogram DIE. Return null if the "high pc" attribute is
- either not prsent, or if it cannot be represented as an
- assembler label identifier. */
-inline char *
-get_AT_hi_pc (die)
- register dw_die_ref die;
-{
- register dw_attr_ref a = get_AT (die, DW_AT_high_pc);
- if (a && a->dw_attr_val.val_class == dw_val_class_lbl_id)
- return a->dw_attr_val.v.val_lbl_id;
- return NULL;
-}
-
-/* Return the value of the string attribute designated by ATTR_KIND, or
- NULL if it is not present. */
-inline char *
-get_AT_string (die, attr_kind)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
-{
- register dw_attr_ref a = get_AT (die, attr_kind);
- if (a && a->dw_attr_val.val_class == dw_val_class_str)
- return a->dw_attr_val.v.val_str;
- return NULL;
-}
-
-/* Return the value of the flag attribute designated by ATTR_KIND, or -1
- if it is not present. */
-inline int
-get_AT_flag (die, attr_kind)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
-{
- register dw_attr_ref a = get_AT (die, attr_kind);
- if (a && a->dw_attr_val.val_class == dw_val_class_flag)
- return a->dw_attr_val.v.val_flag;
- return -1;
-}
-
-/* Return the value of the unsigned attribute designated by ATTR_KIND, or 0
- if it is not present. */
-inline unsigned
-get_AT_unsigned (die, attr_kind)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
-{
- register dw_attr_ref a = get_AT (die, attr_kind);
- if (a && a->dw_attr_val.val_class == dw_val_class_unsigned_const)
- return a->dw_attr_val.v.val_unsigned;
- return 0;
-}
-
-inline int
-is_c_family ()
-{
- register unsigned lang = get_AT_unsigned (comp_unit_die, DW_AT_language);
- return (lang == DW_LANG_C || lang == DW_LANG_C89
- || lang == DW_LANG_C_plus_plus);
-}
-
-inline int
-is_fortran ()
-{
- register unsigned lang = get_AT_unsigned (comp_unit_die, DW_AT_language);
- return (lang == DW_LANG_Fortran77 || lang == DW_LANG_Fortran90);
-}
-
-/* Remove the specified attribute if present. */
-inline void
-remove_AT (die, attr_kind)
- register dw_die_ref die;
- register enum dwarf_attribute attr_kind;
-{
- register dw_attr_ref a;
- register dw_attr_ref removed = NULL;;
- if (die != NULL)
- {
- if (die->die_attr->dw_attr == attr_kind)
- {
- removed = die->die_attr;
- if (die->die_attr_last == die->die_attr)
- die->die_attr_last = NULL;
- die->die_attr = die->die_attr->dw_attr_next;
- }
- else for (a = die->die_attr; a->dw_attr_next != NULL;
- a = a->dw_attr_next)
- if (a->dw_attr_next->dw_attr == attr_kind)
- {
- removed = a->dw_attr_next;
- if (die->die_attr_last == a->dw_attr_next)
- die->die_attr_last = a;
- a->dw_attr_next = a->dw_attr_next->dw_attr_next;
- break;
- }
- if (removed)
- free (removed);
- }
-}
-
-/* Discard the children of this DIE. */
-inline void
-remove_children (die)
- register dw_die_ref die;
-{
- register dw_die_ref child_die = die->die_child;
- die->die_child = NULL;
- die->die_child_last = NULL;
- while (child_die != NULL)
- {
- register dw_die_ref tmp_die = child_die;
- register dw_attr_ref a;
- child_die = child_die->die_sib;
-
- for (a = tmp_die->die_attr; a != NULL; )
- {
- register dw_attr_ref tmp_a = a;
- a = a->dw_attr_next;
- free (tmp_a);
- }
- free (tmp_die);
- }
-}
-
-/* Add a child DIE below its parent. */
-inline void
-add_child_die (die, child_die)
- register dw_die_ref die;
- register dw_die_ref child_die;
-{
- if (die != NULL && child_die != NULL)
- {
- assert (die != child_die);
- child_die->die_parent = die;
- child_die->die_sib = NULL;
- if (die->die_child == NULL)
- {
- die->die_child = child_die;
- die->die_child_last = child_die;
- }
- else
- {
- die->die_child_last->die_sib = child_die;
- die->die_child_last = child_die;
- }
- }
-}
-
-/* Return a pointer to a newly created DIE node. */
-inline dw_die_ref
-new_die (tag_value, parent_die)
- register enum dwarf_tag tag_value;
- register dw_die_ref parent_die;
-{
- register dw_die_ref die = (dw_die_ref) xmalloc (sizeof (die_node));
- if (die != NULL)
- {
- die->die_tag = tag_value;
- die->die_abbrev = 0;
- die->die_offset = 0;
- die->die_child = NULL;
- die->die_parent = NULL;
- die->die_sib = NULL;
- die->die_child_last = NULL;
- die->die_attr = NULL;
- die->die_attr_last = NULL;
- if (parent_die != NULL)
- add_child_die (parent_die, die);
- else
- ++limbo_die_count;
- }
- return die;
-}
-
-/* Return the DIE associated with the given type specifier. */
-inline dw_die_ref
-lookup_type_die (type)
- register tree type;
-{
- return (dw_die_ref) TYPE_SYMTAB_POINTER (type);
-}
-
-/* Equate a DIE to a given type specifier. */
-static void
-equate_type_number_to_die (type, type_die)
- register tree type;
- register dw_die_ref type_die;
-{
- TYPE_SYMTAB_POINTER (type) = (char *) type_die;
-}
-
-/* Return the DIE associated with a given declaration. */
-inline dw_die_ref
-lookup_decl_die (decl)
- register tree decl;
-{
- register unsigned decl_id = DECL_UID (decl);
- return (decl_id < decl_die_table_in_use)
- ? decl_die_table[decl_id] : NULL;
-}
-
-/* Equate a DIE to a particular declaration. */
-static void
-equate_decl_number_to_die (decl, decl_die)
- register tree decl;
- register dw_die_ref decl_die;
-{
- register unsigned decl_id = DECL_UID (decl);
- register unsigned i;
- register unsigned num_allocated;
- if (decl_id >= decl_die_table_allocated)
- {
- num_allocated = (((decl_id + 1)
- + DECL_DIE_TABLE_INCREMENT - 1)
- / DECL_DIE_TABLE_INCREMENT)
- * DECL_DIE_TABLE_INCREMENT;
- decl_die_table = (dw_die_ref *) xrealloc (decl_die_table,
- sizeof (dw_die_ref) * num_allocated);
- bzero (&decl_die_table[decl_die_table_allocated],
- (num_allocated - decl_die_table_allocated) * sizeof (dw_die_ref));
- decl_die_table_allocated = num_allocated;
- }
- if (decl_id >= decl_die_table_in_use)
- {
- decl_die_table_in_use = (decl_id + 1);
- }
- decl_die_table[decl_id] = decl_die;
-}
-
-/* Return a pointer to a newly allocated location description. Location
- descriptions are simple expression terms that can be strung
- together to form more complicated location (address) descriptions. */
-inline dw_loc_descr_ref
-new_loc_descr (op, oprnd1, oprnd2)
- register enum dwarf_location_atom op;
- register unsigned long oprnd1;
- register unsigned long oprnd2;
-{
- register dw_loc_descr_ref descr =
- (dw_loc_descr_ref) xmalloc (sizeof (dw_loc_descr_node));
- if (descr != NULL)
- {
- descr->dw_loc_next = NULL;
- descr->dw_loc_opc = op;
- descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const;
- descr->dw_loc_oprnd1.v.val_unsigned = oprnd1;
- descr->dw_loc_oprnd2.val_class = dw_val_class_unsigned_const;
- descr->dw_loc_oprnd2.v.val_unsigned = oprnd2;
- }
- return descr;
-}
-
-/* Add a location description term to a location description expression. */
-inline void
-add_loc_descr (list_head, descr)
- register dw_loc_descr_ref *list_head;
- register dw_loc_descr_ref descr;
-{
- register dw_loc_descr_ref *d;
- /* find the end of the chain. */
- for (d = list_head; (*d) != NULL; d = &(*d)->dw_loc_next)
- {
- /* nothing */ ;
- }
- *d = descr;
-}
-
-/* Return a pointer to a newly allocated Call Frame Instruction. */
-inline dw_cfi_ref
-new_cfi ()
-{
- register dw_cfi_ref cfi = (dw_cfi_ref) xmalloc (sizeof (dw_cfi_node));
- if (cfi != NULL)
- {
- cfi->dw_cfi_next = NULL;
- cfi->dw_cfi_oprnd1.dw_cfi_reg_num = 0;
- cfi->dw_cfi_oprnd2.dw_cfi_reg_num = 0;
- }
- return cfi;
-}
-
-/* Add a Call Frame Instruction to list of instructions. */
-inline void
-add_cfi (list_head, cfi)
- register dw_cfi_ref *list_head;
- register dw_cfi_ref cfi;
-{
- register dw_cfi_ref *p;
- /* find the end of the chain. */
- for (p = list_head; (*p) != NULL; p = &(*p)->dw_cfi_next)
- {
- /* nothing */ ;
- }
- *p = cfi;
-}
-
-/********* Print DWARF Internal Representation (debugging aids) ***************/
-
-/* Keep track of the number of spaces used to indent the
- output of the debugging routines that print the structure of
- the DIE internal representation. */
-static int print_indent;
-
-/* Indent the line the number of spaces given by print_indent. */
-inline void
-print_spaces (outfile)
- FILE *outfile;
-{
- fprintf (outfile, "%*s", print_indent, "");
-}
-
-/* Print the information assoaciated with a given DIE, and its children.
- This routine is a debugging aid only. */
-static void
-print_die (die, outfile)
- dw_die_ref die;
- FILE *outfile;
-{
- register dw_attr_ref a;
- register dw_die_ref c;
- print_spaces (outfile);
- fprintf (outfile, "DIE %4u: %s\n",
- die->die_offset, dwarf_tag_name (die->die_tag));
- print_spaces (outfile);
- fprintf (outfile, " abbrev id: %u", die->die_abbrev);
- fprintf (outfile, " offset: %u\n", die->die_offset);
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
- {
- print_spaces (outfile);
- fprintf (outfile, " %s: ", dwarf_attr_name (a->dw_attr));
- switch (a->dw_attr_val.val_class)
- {
- case dw_val_class_addr:
- fprintf (outfile, "address");
- break;
- case dw_val_class_loc:
- fprintf (outfile, "location descriptor");
- break;
- case dw_val_class_const:
- fprintf (outfile, "%d", a->dw_attr_val.v.val_int);
- break;
- case dw_val_class_unsigned_const:
- fprintf (outfile, "%u", a->dw_attr_val.v.val_unsigned);
- break;
- case dw_val_class_long_long:
- fprintf (outfile, "constant (%u,%u)",
- a->dw_attr_val.v.val_long_long.hi,
- a->dw_attr_val.v.val_long_long.low);
- break;
- case dw_val_class_float:
- fprintf (outfile, "floating-point constant");
- break;
- case dw_val_class_flag:
- fprintf (outfile, "%u", a->dw_attr_val.v.val_flag);
- break;
- case dw_val_class_die_ref:
- if (a->dw_attr_val.v.val_die_ref != NULL)
- {
- fprintf (outfile, "die -> %u",
- a->dw_attr_val.v.val_die_ref->die_offset);
- }
- else
- {
- fprintf (outfile, "die -> <null>");
- }
- break;
- case dw_val_class_lbl_id:
- fprintf (outfile, "label: %s", a->dw_attr_val.v.val_lbl_id);
- break;
- case dw_val_class_section_offset:
- fprintf (outfile, "section: %s", a->dw_attr_val.v.val_section);
- break;
- case dw_val_class_str:
- if (a->dw_attr_val.v.val_str != NULL)
- {
- fprintf (outfile, "\"%s\"", a->dw_attr_val.v.val_str);
- }
- else
- {
- fprintf (outfile, "<null>");
- }
- break;
- }
- fprintf (outfile, "\n");
- }
- if (die->die_child != NULL)
- {
- print_indent += 4;
- for (c = die->die_child; c != NULL; c = c->die_sib)
- {
- print_die (c, outfile);
- }
- print_indent -= 4;
- }
-}
-
-/* Print the contents of the source code line number correspondence table.
- This routine is a debugging aid only. */
-static void
-print_dwarf_line_table (outfile)
- FILE *outfile;
-{
- register unsigned i;
- register dw_line_info_ref line_info;
- fprintf (outfile, "\n\nDWARF source line information\n");
- for (i = 1; i < line_info_table_in_use; ++i)
- {
- line_info = &line_info_table[i];
- fprintf (outfile, "%5d: ", i);
- fprintf (outfile, "%-20s", file_table[line_info->dw_file_num]);
- fprintf (outfile, "%6d", line_info->dw_line_num);
- fprintf (outfile, "\n");
- }
- fprintf (outfile, "\n\n");
-}
-
-/* Print the information collected for a given DIE. */
-void
-debug_dwarf_die (die)
- dw_die_ref die;
-{
- print_die (die, stderr);
-}
-
-/* Print all DWARF informaiton collected for the compilation unit.
- This routine is a debugging aid only. */
-void
-debug_dwarf ()
-{
- print_indent = 0;
- print_die (comp_unit_die, stderr);
- print_dwarf_line_table (stderr);
-}
-
-
-/***************** DWARF Information Construction Support *********************/
-
-/* Traverse the DIE, and add a sibling attribute if it may have the
- effect of speeding up access to siblings. To save some space,
- avoid generating sibling attributes for DIE's without children. */
-static void
-add_sibling_attributes(die)
- register dw_die_ref die;
-{
- register dw_die_ref c;
- register dw_attr_ref attr;
- if (die != comp_unit_die && die->die_child != NULL)
- {
- attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
- if (attr != NULL)
- {
- attr->dw_attr_next = NULL;
- attr->dw_attr = DW_AT_sibling;
- attr->dw_attr_val.val_class = dw_val_class_die_ref;
- attr->dw_attr_val.v.val_die_ref = die->die_sib;
- }
- /* add the sibling link to the front of the attribute list. */
- attr->dw_attr_next = die->die_attr;
- if (die->die_attr == NULL)
- {
- die->die_attr_last = attr;
- }
- die->die_attr = attr;
- }
- for (c = die->die_child; c != NULL; c = c->die_sib)
- {
- add_sibling_attributes (c);
- }
-}
-
-/* The format of each DIE (and its attribute value pairs)
- is encoded in an abbreviation table. This routine builds the
- abbreviation table and assigns a unique abbreviation id for
- each abbreviation entry. The children of each die are visited
- recursively. */
-static void
-build_abbrev_table (die)
- register dw_die_ref die;
-{
- register unsigned long abbrev_id;
- register unsigned long n_alloc;
- register dw_die_ref c;
- register dw_attr_ref d_attr, a_attr;
- for (abbrev_id = 1; abbrev_id < abbrev_die_table_in_use; ++abbrev_id)
- {
- register dw_die_ref abbrev = abbrev_die_table[abbrev_id];
- if (abbrev->die_tag == die->die_tag)
- {
- if ((abbrev->die_child != NULL) == (die->die_child != NULL))
- {
- a_attr = abbrev->die_attr;
- d_attr = die->die_attr;
- while (a_attr != NULL && d_attr != NULL)
- {
- if ((a_attr->dw_attr != d_attr->dw_attr)
- || (value_format (&a_attr->dw_attr_val)
- != value_format (&d_attr->dw_attr_val)))
- {
- break;
- }
- a_attr = a_attr->dw_attr_next;
- d_attr = d_attr->dw_attr_next;
- }
- if (a_attr == NULL && d_attr == NULL)
- {
- break;
- }
- }
- }
- }
- if (abbrev_id >= abbrev_die_table_in_use)
- {
- if (abbrev_die_table_in_use >= abbrev_die_table_allocated)
- {
- n_alloc = abbrev_die_table_allocated + ABBREV_DIE_TABLE_INCREMENT;
- abbrev_die_table = (dw_die_ref *)
- xmalloc (abbrev_die_table,
- sizeof (dw_die_ref) * n_alloc);
- bzero (&abbrev_die_table[abbrev_die_table_allocated],
- (n_alloc - abbrev_die_table_allocated) * sizeof (dw_die_ref));
- abbrev_die_table_allocated = n_alloc;
- }
- ++abbrev_die_table_in_use;
- abbrev_die_table[abbrev_id] = die;
- }
- die->die_abbrev = abbrev_id;
- for (c = die->die_child; c != NULL; c = c->die_sib)
- {
- build_abbrev_table (c);
- }
-}
-
-
-/********************** DWARF Information Sizing *****************************/
-
-/* Return the size of an unsigned LEB128 quantity. */
-inline unsigned long
-size_of_uleb128 (value)
- register unsigned long value;
-{
- register unsigned long size = 0;
- register unsigned byte;
- do
- {
- byte = (value & 0x7f);
- value >>= 7;
- size += 1;
- }
- while (value != 0);
- return size;
-}
-
-/* Return the size of a signed LEB128 quantity. */
-inline unsigned long
-size_of_sleb128 (value)
- register long value;
-{
- register unsigned long size = 0;
- register unsigned byte;
- do
- {
- byte = (value & 0x7f);
- value >>= 7;
- size += 1;
- }
- while (!(((value == 0) && ((byte & 0x40) == 0))
- || ((value == -1) && ((byte & 0x40) != 0))));
- return size;
-}
-
-/* Return the size of a string, including the null byte. */
-static unsigned long
-size_of_string (str)
- register char *str;
-{
- register unsigned long size = 0;
- register unsigned long slen = strlen (str);
- register unsigned long i;
- register unsigned c;
- for (i = 0; i < slen; ++i)
- {
- c = str[i];
- if (c == '\\')
- {
- ++i;
- }
- size += 1;
- }
- /* Null terminator. */
- size += 1;
- return size;
-}
-
-/* Return the size of a location descriptor. */
-static unsigned long
-size_of_loc_descr (loc)
- register dw_loc_descr_ref loc;
-{
- register unsigned long size = 1;
- switch (loc->dw_loc_opc)
- {
- case DW_OP_addr:
- size += PTR_SIZE;
- break;
- case DW_OP_const1u:
- case DW_OP_const1s:
- size += 1;
- break;
- case DW_OP_const2u:
- case DW_OP_const2s:
- size += 2;
- break;
- case DW_OP_const4u:
- case DW_OP_const4s:
- size += 4;
- break;
- case DW_OP_const8u:
- case DW_OP_const8s:
- size += 8;
- break;
- case DW_OP_constu:
- size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
- break;
- case DW_OP_consts:
- size += size_of_sleb128 (loc->dw_loc_oprnd1.v.val_int);
- break;
- case DW_OP_pick:
- size += 1;
- break;
- case DW_OP_plus_uconst:
- size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
- break;
- case DW_OP_skip:
- case DW_OP_bra:
- size += 2;
- break;
- case DW_OP_breg0:
- case DW_OP_breg1:
- case DW_OP_breg2:
- case DW_OP_breg3:
- case DW_OP_breg4:
- case DW_OP_breg5:
- case DW_OP_breg6:
- case DW_OP_breg7:
- case DW_OP_breg8:
- case DW_OP_breg9:
- case DW_OP_breg10:
- case DW_OP_breg11:
- case DW_OP_breg12:
- case DW_OP_breg13:
- case DW_OP_breg14:
- case DW_OP_breg15:
- case DW_OP_breg16:
- case DW_OP_breg17:
- case DW_OP_breg18:
- case DW_OP_breg19:
- case DW_OP_breg20:
- case DW_OP_breg21:
- case DW_OP_breg22:
- case DW_OP_breg23:
- case DW_OP_breg24:
- case DW_OP_breg25:
- case DW_OP_breg26:
- case DW_OP_breg27:
- case DW_OP_breg28:
- case DW_OP_breg29:
- case DW_OP_breg30:
- case DW_OP_breg31:
- size += size_of_sleb128 (loc->dw_loc_oprnd1.v.val_int);
- break;
- case DW_OP_regx:
- size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
- break;
- case DW_OP_fbreg:
- size += size_of_sleb128 (loc->dw_loc_oprnd1.v.val_int);
- break;
- case DW_OP_bregx:
- size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
- size += size_of_sleb128 (loc->dw_loc_oprnd2.v.val_int);
- break;
- case DW_OP_piece:
- size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
- break;
- case DW_OP_deref_size:
- case DW_OP_xderef_size:
- size += 1;
- break;
- default:
- break;
- }
- return size;
-}
-
-/* Return the size of a series of location descriptors. */
-static unsigned long
-size_of_locs (loc)
- register dw_loc_descr_ref loc;
-{
- register unsigned long size = 0;
- for (; loc != NULL; loc = loc->dw_loc_next)
- size += size_of_loc_descr (loc);
- return size;
-}
-
-/* Return the power-of-two number of bytes necessary to represent VALUE. */
-static int
-constant_size (value)
- long unsigned value;
-{
- int log;
-
- if (value == 0)
- log = 0;
- else
- log = floor_log2 (value);
-
- log = log / 8;
- log = 1 << (floor_log2 (log) + 1);
-
- return log;
-}
-
-/* Return the size of a DIE, as it is represented in the
- .debug_info section. */
-static unsigned long
-size_of_die (die)
- register dw_die_ref die;
-{
- register unsigned long size = 0;
- register dw_attr_ref a;
- size += size_of_uleb128 (die->die_abbrev);
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
- {
- switch (a->dw_attr_val.val_class)
- {
- case dw_val_class_addr:
- size += PTR_SIZE;
- break;
- case dw_val_class_loc:
- {
- register unsigned long lsize
- = size_of_locs (a->dw_attr_val.v.val_loc);
-
- /* Block length. */
- size += constant_size (lsize);
- size += lsize;
- }
- break;
- case dw_val_class_const:
- size += 4;
- break;
- case dw_val_class_unsigned_const:
- size += constant_size (a->dw_attr_val.v.val_unsigned);
- break;
- case dw_val_class_long_long:
- size += 1 + 8; /* block */
- break;
- case dw_val_class_float:
- size += 1 + a->dw_attr_val.v.val_float.length * 4; /* block */
- break;
- case dw_val_class_flag:
- size += 1;
- break;
- case dw_val_class_die_ref:
- size += DWARF_OFFSET_SIZE;
- break;
- case dw_val_class_fde_ref:
- size += DWARF_OFFSET_SIZE;
- break;
- case dw_val_class_lbl_id:
- size += PTR_SIZE;
- break;
- case dw_val_class_section_offset:
- size += DWARF_OFFSET_SIZE;
- break;
- case dw_val_class_str:
- size += size_of_string (a->dw_attr_val.v.val_str);
- break;
- default:
- abort ();
- }
- }
- return size;
-}
-
-/* Size the debgging information associted with a given DIE.
- Visits the DIE's children recursively. Updates the global
- variable next_die_offset, on each time through. Uses the
- current value of next_die_offset to updete the die_offset
- field in each DIE. */
-static void
-calc_die_sizes (die)
- dw_die_ref die;
-{
- register dw_die_ref c;
- die->die_offset = next_die_offset;
- next_die_offset += size_of_die (die);
- for (c = die->die_child; c != NULL; c = c->die_sib)
- {
- calc_die_sizes (c);
- }
- if (die->die_child != NULL)
- {
- /* Count the null byte used to terminate sibling lists. */
- next_die_offset += 1;
- }
-}
-
-/* Return the size of the line information prolog generated for the
- compilation unit. */
-static unsigned long
-size_of_line_prolog ()
-{
- register unsigned long size;
- register unsigned long ft_index;
- size = DWARF_LINE_PROLOG_HEADER_SIZE;
- /* Count the size of the table giving number of args for each
- standard opcode. */
- size += DWARF_LINE_OPCODE_BASE - 1;
- /* Include directory table is empty (at present). Count only the
- the null byte used to terminate the table. */
- size += 1;
- for (ft_index = 1; ft_index < file_table_in_use; ++ft_index)
- {
- /* File name entry. */
- size += size_of_string (file_table[ft_index]);
- /* Include directory index. */
- size += size_of_uleb128 (0);
- /* Modification time. */
- size += size_of_uleb128 (0);
- /* File length in bytes. */
- size += size_of_uleb128 (0);
- }
- /* Count the file table terminator. */
- size += 1;
- return size;
-}
-
-/* Return the size of the line information generated for this
- compilation unit. */
-static unsigned long
-size_of_line_info ()
-{
- register unsigned long size;
- register unsigned long lt_index;
- register unsigned long current_line;
- register long line_offset;
- register long line_delta;
- register unsigned long current_file;
- register unsigned long function;
- /* Version number. */
- size = 2;
- /* Prolog length specifier. */
- size += DWARF_OFFSET_SIZE;
- /* Prolog. */
- size += size_of_line_prolog ();
- /* Set address register instruction. */
- size += 1 + size_of_uleb128 (1 + PTR_SIZE)
- + 1 + PTR_SIZE;
- current_file = 1;
- current_line = 1;
- for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
- {
- register dw_line_info_ref line_info;
- /* Advance pc instruction. */
- size += 1 + 2;
- line_info = &line_info_table[lt_index];
- if (line_info->dw_file_num != current_file)
- {
- /* Set file number instruction. */
- size += 1;
- current_file = line_info->dw_file_num;
- size += size_of_uleb128 (current_file);
- }
- if (line_info->dw_line_num != current_line)
- {
- line_offset = line_info->dw_line_num - current_line;
- line_delta = line_offset - DWARF_LINE_BASE;
- current_line = line_info->dw_line_num;
- if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1))
- {
- /* 1-byte special line number instruction. */
- size += 1;
- }
- else
- {
- /* Advance line instruction. */
- size += 1;
- size += size_of_sleb128 (line_offset);
- /* Generate line entry instruction. */
- size += 1;
- }
- }
- }
- /* Advance pc instruction. */
- size += 1 + 2;
- /* End of line number info. marker. */
- size += 1 + size_of_uleb128 (1) + 1;
- function = 0;
- current_file = 1;
- current_line = 1;
- for (lt_index = 0; lt_index < separate_line_info_table_in_use; )
- {
- register dw_separate_line_info_ref line_info
- = &separate_line_info_table[lt_index];
- if (function != line_info->function)
- {
- function = line_info->function;
- /* Set address register instruction. */
- size += 1 + size_of_uleb128 (1 + PTR_SIZE)
- + 1 + PTR_SIZE;
- }
- else
- {
- /* Advance pc instruction. */
- size += 1 + 2;
- }
- if (line_info->dw_file_num != current_file)
- {
- /* Set file number instruction. */
- size += 1;
- current_file = line_info->dw_file_num;
- size += size_of_uleb128 (current_file);
- }
- if (line_info->dw_line_num != current_line)
- {
- line_offset = line_info->dw_line_num - current_line;
- line_delta = line_offset - DWARF_LINE_BASE;
- current_line = line_info->dw_line_num;
- if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1))
- {
- /* 1-byte special line number instruction. */
- size += 1;
- }
- else
- {
- /* Advance line instruction. */
- size += 1;
- size += size_of_sleb128 (line_offset);
- /* Generate line entry instruction. */
- size += 1;
- }
- }
- ++lt_index;
-
- /* If we're done with a function, end its sequence. */
- if (lt_index == separate_line_info_table_in_use
- || separate_line_info_table[lt_index].function != function)
- {
- current_file = 1;
- current_line = 1;
- /* Advance pc instruction. */
- size += 1 + 2;
- /* End of line number info. marker. */
- size += 1 + size_of_uleb128 (1) + 1;
- }
- }
- return size;
-}
-
-/* Return the size of the .debug_pubnames table generated for the
- compilation unit. */
-static unsigned long
-size_of_pubnames ()
-{
- register unsigned long size;
- register unsigned i;
-
- size = DWARF_PUBNAMES_HEADER_SIZE;
- for (i = 0; i < pubname_table_in_use; ++i)
- {
- register pubname_ref p = &pubname_table[i];
- size += DWARF_OFFSET_SIZE + size_of_string (p->name);
- }
- size += DWARF_OFFSET_SIZE;
- return size;
-}
-
-/* Return the size of the information in the .debug_aranges seciton. */
-static unsigned long
-size_of_aranges ()
-{
- register unsigned long size;
- size = DWARF_ARANGES_HEADER_SIZE;
- /* Count the address/length pair for this compilation unit. */
- size += 2 * PTR_SIZE;
- size += 2 * PTR_SIZE * arange_table_in_use;
- /* Count the two zero words used to terminated the address range table. */
- size += 2 * PTR_SIZE;
- return size;
-}
-
-/**************** DWARF Debug Information Output *****************************/
-
-/* Output an unsigned LEB128 quantity. */
-static void
-output_uleb128 (value)
- register unsigned long value;
-{
- unsigned long save_value = value;
- fprintf (asm_out_file, "\t%s\t", ASM_BYTE_OP);
- do
- {
- register unsigned byte = (value & 0x7f);
- value >>= 7;
- if (value != 0)
- {
- /* More bytes to follow. */
- byte |= 0x80;
- }
- fprintf (asm_out_file, "0x%x", byte);
- if (value != 0)
- {
- fprintf (asm_out_file, ",");
- }
- }
- while (value != 0);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s ULEB128 0x%x", ASM_COMMENT_START, save_value);
-}
-
-/* Output an signed LEB128 quantity. */
-static void
-output_sleb128 (value)
- register long value;
-{
- register int more;
- register unsigned byte;
- long save_value = value;
- fprintf (asm_out_file, "\t%s\t", ASM_BYTE_OP);
- do
- {
- byte = (value & 0x7f);
- /* arithmetic shift */
- value >>= 7;
- more = !((((value == 0) && ((byte & 0x40) == 0))
- || ((value == -1) && ((byte & 0x40) != 0))));
- if (more)
- {
- byte |= 0x80;
- }
- fprintf (asm_out_file, "0x%x", byte);
- if (more)
- {
- fprintf (asm_out_file, ",");
- }
- }
- while (more);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s SLEB128 %d", ASM_COMMENT_START, save_value);
-}
-
-/* Select the encoding of an attribute value. */
-static enum dwarf_form
-value_format (v)
- dw_val_ref v;
-{
- switch (v->val_class)
- {
- case dw_val_class_addr:
- return DW_FORM_addr;
- case dw_val_class_loc:
- switch (constant_size (size_of_locs (v->v.val_loc)))
- {
- case 1:
- return DW_FORM_block1;
- case 2:
- return DW_FORM_block2;
- default:
- abort ();
- }
- case dw_val_class_const:
- return DW_FORM_data4;
- case dw_val_class_unsigned_const:
- switch (constant_size (v->v.val_unsigned))
- {
- case 1:
- return DW_FORM_data1;
- case 2:
- return DW_FORM_data2;
- case 4:
- return DW_FORM_data4;
- default:
- abort ();
- }
- case dw_val_class_long_long:
- return DW_FORM_block1;
- case dw_val_class_float:
- return DW_FORM_block1;
- case dw_val_class_flag:
- return DW_FORM_flag;
- case dw_val_class_die_ref:
- return DW_FORM_ref;
- case dw_val_class_fde_ref:
- return DW_FORM_data;
- case dw_val_class_lbl_id:
- return DW_FORM_addr;
- case dw_val_class_section_offset:
- return DW_FORM_data;
- case dw_val_class_str:
- return DW_FORM_string;
- default:
- abort ();
- }
-}
-
-/* Output the encoding of an attribute value. */
-static void
-output_value_format (v)
- dw_val_ref v;
-{
- enum dwarf_form form = value_format (v);
- output_uleb128 (form);
- if (flag_verbose_asm)
- fprintf (asm_out_file, " (%s)", dwarf_form_name (form));
- fputc ('\n', asm_out_file);
-}
-
-/* Output the .debug_abbrev section which defines the DIE abbreviation
- table. */
-static void
-output_abbrev_section ()
-{
- unsigned long abbrev_id;
- dw_attr_ref a_attr;
- for (abbrev_id = 1; abbrev_id < abbrev_die_table_in_use; ++abbrev_id)
- {
- register dw_die_ref abbrev = abbrev_die_table[abbrev_id];
- output_uleb128 (abbrev_id);
- if (flag_verbose_asm)
- fprintf (asm_out_file, " (abbrev code)");
- fputc ('\n', asm_out_file);
- output_uleb128 (abbrev->die_tag);
- if (flag_verbose_asm)
- fprintf (asm_out_file, " (TAG: %s)",
- dwarf_tag_name (abbrev->die_tag));
- fputc ('\n', asm_out_file);
- fprintf (asm_out_file, "\t%s\t0x%x", ASM_BYTE_OP,
- (abbrev->die_child != NULL)
- ? DW_children_yes : DW_children_no);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START,
- (abbrev->die_child != NULL)
- ? "DW_children_yes" : "DW_children_no");
- }
- fputc ('\n', asm_out_file);
- for (a_attr = abbrev->die_attr; a_attr != NULL;
- a_attr = a_attr->dw_attr_next)
- {
- output_uleb128 (a_attr->dw_attr);
- if (flag_verbose_asm)
- fprintf (asm_out_file, " (%s)",
- dwarf_attr_name (a_attr->dw_attr));
- fputc ('\n', asm_out_file);
- output_value_format (&a_attr->dw_attr_val);
- }
- fprintf (asm_out_file, "\t%s\t0,0\n", ASM_BYTE_OP);
- }
-}
-
-/* Output location description stack opcode's operands (if any). */
-static void
-output_loc_operands (loc)
- register dw_loc_descr_ref loc;
-{
- register dw_val_ref val1 = &loc->dw_loc_oprnd1;
- register dw_val_ref val2 = &loc->dw_loc_oprnd2;
- switch (loc->dw_loc_opc)
- {
- case DW_OP_addr:
- ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file, val1->v.val_addr);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_const1u:
- case DW_OP_const1s:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_flag);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_const2u:
- case DW_OP_const2s:
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, val1->v.val_int);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_const4u:
- case DW_OP_const4s:
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, val1->v.val_int);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_const8u:
- case DW_OP_const8s:
- abort ();
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_constu:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_consts:
- output_sleb128 (val1->v.val_int);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_pick:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_int);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_plus_uconst:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_skip:
- case DW_OP_bra:
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, val1->v.val_int);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_breg0:
- case DW_OP_breg1:
- case DW_OP_breg2:
- case DW_OP_breg3:
- case DW_OP_breg4:
- case DW_OP_breg5:
- case DW_OP_breg6:
- case DW_OP_breg7:
- case DW_OP_breg8:
- case DW_OP_breg9:
- case DW_OP_breg10:
- case DW_OP_breg11:
- case DW_OP_breg12:
- case DW_OP_breg13:
- case DW_OP_breg14:
- case DW_OP_breg15:
- case DW_OP_breg16:
- case DW_OP_breg17:
- case DW_OP_breg18:
- case DW_OP_breg19:
- case DW_OP_breg20:
- case DW_OP_breg21:
- case DW_OP_breg22:
- case DW_OP_breg23:
- case DW_OP_breg24:
- case DW_OP_breg25:
- case DW_OP_breg26:
- case DW_OP_breg27:
- case DW_OP_breg28:
- case DW_OP_breg29:
- case DW_OP_breg30:
- case DW_OP_breg31:
- output_sleb128 (val1->v.val_int);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_regx:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_fbreg:
- output_sleb128 (val1->v.val_int);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_bregx:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
- output_sleb128 (val2->v.val_int);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_piece:
- output_uleb128 (val1->v.val_unsigned);
- fputc ('\n', asm_out_file);
- break;
- case DW_OP_deref_size:
- case DW_OP_xderef_size:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, val1->v.val_flag);
- fputc ('\n', asm_out_file);
- break;
- default:
- break;
- }
-}
-
-/* Compute the offset of a sibling. */
-static unsigned long
-sibling_offset (die)
- dw_die_ref die;
-{
- unsigned long offset;
- if (die->die_child_last == NULL)
- {
- offset = die->die_offset + size_of_die (die);
- }
- else
- {
- offset = sibling_offset (die->die_child_last) + 1;
- }
- return offset;
-}
-
-/* Output the DIE and its attributes. Called recursively to generate
- the definitions of each child DIE. */
-static void
-output_die (die)
- register dw_die_ref die;
-{
- register dw_attr_ref a;
- register dw_die_ref c;
- register unsigned long ref_offset;
- register unsigned long size;
- register dw_loc_descr_ref loc;
- register int i;
-
- output_uleb128 (die->die_abbrev);
- if (flag_verbose_asm)
- fprintf (asm_out_file, " (DIE (0x%x) %s)",
- die->die_offset, dwarf_tag_name (die->die_tag));
- fputc ('\n', asm_out_file);
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
- {
- switch (a->dw_attr_val.val_class)
- {
- case dw_val_class_addr:
- ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file,
- a->dw_attr_val.v.val_addr);
- break;
- case dw_val_class_loc:
- size = size_of_locs (a->dw_attr_val.v.val_loc);
- /* Output the block length for this list of location operations. */
- switch (constant_size (size))
- {
- case 1:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, size);
- break;
- case 2:
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, size);
- break;
- default:
- abort ();
- }
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
- }
- fputc ('\n', asm_out_file);
- for (loc = a->dw_attr_val.v.val_loc; loc != NULL;
- loc = loc->dw_loc_next)
- {
- /* Output the opcode. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, loc->dw_loc_opc);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START,
- dwarf_stack_op_name (loc->dw_loc_opc));
- }
- fputc ('\n', asm_out_file);
- /* Output the operand(s) (if any). */
- output_loc_operands (loc);
- }
- break;
- case dw_val_class_const:
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, a->dw_attr_val.v.val_int);
- break;
- case dw_val_class_unsigned_const:
- switch (constant_size (a->dw_attr_val.v.val_unsigned))
- {
- case 1:
- ASM_OUTPUT_DWARF_DATA1
- (asm_out_file, a->dw_attr_val.v.val_unsigned);
- break;
- case 2:
- ASM_OUTPUT_DWARF_DATA2
- (asm_out_file, a->dw_attr_val.v.val_unsigned);
- break;
- case 4:
- ASM_OUTPUT_DWARF_DATA4
- (asm_out_file, a->dw_attr_val.v.val_unsigned);
- break;
- default:
- abort ();
- }
- break;
- case dw_val_class_long_long:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 8);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA8 (asm_out_file,
- a->dw_attr_val.v.val_long_long.hi,
- a->dw_attr_val.v.val_long_long.low);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s long long constant",
- ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- break;
- case dw_val_class_float:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- a->dw_attr_val.v.val_float.length * 4);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
- fputc ('\n', asm_out_file);
- for (i = 0; i < a->dw_attr_val.v.val_float.length; ++i)
- {
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
- a->dw_attr_val.v.val_float.array[i]);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s fp constant word %d",
- ASM_COMMENT_START, i);
- fputc ('\n', asm_out_file);
- }
- break;
- case dw_val_class_flag:
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, a->dw_attr_val.v.val_flag);
- break;
- case dw_val_class_die_ref:
- if (a->dw_attr_val.v.val_die_ref != NULL)
- {
- ref_offset = a->dw_attr_val.v.val_die_ref->die_offset;
- }
- else if (a->dw_attr == DW_AT_sibling)
- {
- ref_offset = sibling_offset(die);
- }
- else
- {
- abort ();
- }
- ASM_OUTPUT_DWARF_DATA (asm_out_file, ref_offset);
- break;
- case dw_val_class_fde_ref:
- ref_offset = fde_table[a->dw_attr_val.v.val_fde_index].dw_fde_offset;
- fprintf (asm_out_file, "\t%s\t%s+0x%x", UNALIGNED_OFFSET_ASM_OP,
- stripattributes (FRAME_SECTION), ref_offset);
- break;
- case dw_val_class_lbl_id:
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, a->dw_attr_val.v.val_lbl_id);
- break;
- case dw_val_class_section_offset:
- ASM_OUTPUT_DWARF_OFFSET
- (asm_out_file, stripattributes (a->dw_attr_val.v.val_section));
- break;
- case dw_val_class_str:
- ASM_OUTPUT_DWARF_STRING (asm_out_file, a->dw_attr_val.v.val_str);
- break;
- default:
- abort ();
- }
- if (a->dw_attr_val.val_class != dw_val_class_loc
- && a->dw_attr_val.val_class != dw_val_class_long_long
- && a->dw_attr_val.val_class != dw_val_class_float)
- {
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START, dwarf_attr_name (a->dw_attr));
- }
- fputc ('\n', asm_out_file);
- }
- }
- for (c = die->die_child; c != NULL; c = c->die_sib)
- {
- output_die (c);
- }
- if (die->die_child != NULL)
- {
- /* Add null byte to terminate sibling list. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s end of children of DIE 0x%x",
- ASM_COMMENT_START, die->die_offset);
- fputc ('\n', asm_out_file);
- }
-}
-
-/* Output the compilation unit that appears at the beginning of the
- .debug_info section, and precedes the DIE descriptions. */
-static void
-output_compilation_unit_header ()
-{
- ASM_OUTPUT_DWARF_DATA (asm_out_file, next_die_offset - DWARF_OFFSET_SIZE);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Length of Compilation Unit Info.",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s DWARF version number",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (ABBREV_SECTION));
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Offset Into Abbrev. Section",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, PTR_SIZE);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Pointer Size (in bytes)",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
-}
-
-/* Generate a new label for the CFI info to refer to. */
-
-char *
-dwarf2out_cfi_label ()
-{
- static char label[20];
- static unsigned long label_num = 0;
-
- ASM_GENERATE_INTERNAL_LABEL (label, "LCFI", label_num++);
- ASM_OUTPUT_LABEL (asm_out_file, label);
-
- return label;
-}
-
-/* Add CFI to the current fde at the PC value indicated by LABEL if specified,
- or to the CIE if LABEL is NULL. */
-
-static void
-add_fde_cfi (label, cfi)
- register char * label;
- register dw_cfi_ref cfi;
-{
- if (label)
- {
- register dw_fde_ref fde = &fde_table[fde_table_in_use - 1];
- if (*label == 0)
- label = dwarf2out_cfi_label ();
- if (fde->dw_fde_current_label == NULL
- || strcmp (label, fde->dw_fde_current_label) != 0)
- {
- register dw_cfi_ref xcfi;
-
- fde->dw_fde_current_label = label = xstrdup (label);
-
- /* Set the location counter to the new label. */
- xcfi = new_cfi ();
- xcfi->dw_cfi_opc = DW_CFA_advance_loc4;
- xcfi->dw_cfi_oprnd1.dw_cfi_addr = label;
- add_cfi (&fde->dw_fde_cfi, xcfi);
- }
- add_cfi (&fde->dw_fde_cfi, cfi);
- }
- else
- add_cfi (&cie_cfi_head, cfi);
-}
-
-/* Subroutine of lookup_cfa. */
-inline void
-lookup_cfa_1 (cfi, regp, offsetp)
- register dw_cfi_ref cfi;
- register unsigned long *regp;
- register long *offsetp;
-{
- switch (cfi->dw_cfi_opc)
- {
- case DW_CFA_def_cfa_offset:
- *offsetp = cfi->dw_cfi_oprnd1.dw_cfi_offset;
- break;
- case DW_CFA_def_cfa_register:
- *regp = cfi->dw_cfi_oprnd1.dw_cfi_reg_num;
- break;
- case DW_CFA_def_cfa:
- *regp = cfi->dw_cfi_oprnd1.dw_cfi_reg_num;
- *offsetp = cfi->dw_cfi_oprnd2.dw_cfi_offset;
- break;
- }
-}
-
-/* Find the previous value for the CFA. */
-static void
-lookup_cfa (regp, offsetp)
- register unsigned long *regp;
- register long *offsetp;
-{
- register dw_cfi_ref cfi;
- *regp = (unsigned long) -1;
- *offsetp = 0;
-
- for (cfi = cie_cfi_head; cfi; cfi = cfi->dw_cfi_next)
- lookup_cfa_1 (cfi, regp, offsetp);
- if (fde_table_in_use)
- {
- register dw_fde_ref fde = &fde_table[fde_table_in_use - 1];
- for (cfi = fde->dw_fde_cfi; cfi; cfi = cfi->dw_cfi_next)
- lookup_cfa_1 (cfi, regp, offsetp);
- }
-}
-
-/* Entry point to update the canonical frame address (CFA).
- LABEL is passed to add_fde_cfi. The value of CFA is now to be
- calculated from REG+OFFSET. */
-
-void
-dwarf2out_def_cfa (label, reg, offset)
- register char * label;
- register unsigned reg;
- register long offset;
-{
- register dw_cfi_ref cfi;
- unsigned old_reg;
- long old_offset;
-
- reg = DWARF_FRAME_REGNUM (reg);
- lookup_cfa (&old_reg, &old_offset);
-
- if (reg == old_reg && offset == old_offset)
- return;
-
- cfi = new_cfi ();
-
- if (reg == old_reg)
- {
- cfi->dw_cfi_opc = DW_CFA_def_cfa_offset;
- cfi->dw_cfi_oprnd1.dw_cfi_offset = offset;
- }
-#ifndef MIPS_DEBUGGING_INFO /* SGI dbx thinks this means no offset. */
- else if (offset == old_offset && old_reg != (unsigned long) -1)
- {
- cfi->dw_cfi_opc = DW_CFA_def_cfa_register;
- cfi->dw_cfi_oprnd1.dw_cfi_reg_num = reg;
- }
-#endif
- else
- {
- cfi->dw_cfi_opc = DW_CFA_def_cfa;
- cfi->dw_cfi_oprnd1.dw_cfi_reg_num = reg;
- cfi->dw_cfi_oprnd2.dw_cfi_offset = offset;
- }
-
- add_fde_cfi (label, cfi);
-}
-
-/* Add the CFI for saving a register. REG is the CFA column number.
- LABEL is passed to add_fde_cfi.
- If SREG is -1, the register is saved at OFFSET from the CFA;
- otherwise it is saved in SREG. */
-
-static void
-reg_save (label, reg, sreg, offset)
- register char * label;
- register unsigned reg;
- register unsigned sreg;
- register long offset;
-{
- register dw_cfi_ref cfi = new_cfi ();
-
- cfi->dw_cfi_oprnd1.dw_cfi_reg_num = reg;
-
- if (sreg == -1)
- {
- if (reg & ~0x3f)
- /* The register number won't fit in 6 bits, so we have to use
- the long form. */
- cfi->dw_cfi_opc = DW_CFA_offset_extended;
- else
- cfi->dw_cfi_opc = DW_CFA_offset;
-
- offset /= DWARF_CIE_DATA_ALIGNMENT;
- assert (offset >= 0);
- cfi->dw_cfi_oprnd2.dw_cfi_offset = offset;
- }
- else
- {
- cfi->dw_cfi_opc = DW_CFA_register;
- cfi->dw_cfi_oprnd2.dw_cfi_reg_num = sreg;
- }
-
- add_fde_cfi (label, cfi);
-}
-
-/* Entry point for saving a register. REG is the GCC register number.
- LABEL and OFFSET are passed to reg_save. */
-
-void
-dwarf2out_reg_save (label, reg, offset)
- register char * label;
- register unsigned reg;
- register long offset;
-{
- reg_save (label, DWARF_FRAME_REGNUM (reg), -1, offset);
-}
-
-/* Record the initial position of the return address. RTL is
- INCOMING_RETURN_ADDR_RTX. */
-
-static void
-initial_return_save (rtl)
- register rtx rtl;
-{
- unsigned reg = -1;
- long offset = 0;
-
- switch (GET_CODE (rtl))
- {
- case REG:
- /* RA is in a register. */
- reg = reg_number (rtl);
- break;
- case MEM:
- /* RA is on the stack. */
- rtl = XEXP (rtl, 0);
- switch (GET_CODE (rtl))
- {
- case REG:
- assert (REGNO (rtl) == STACK_POINTER_REGNUM);
- offset = 0;
- break;
- case PLUS:
- assert (REGNO (XEXP (rtl, 0)) == STACK_POINTER_REGNUM);
- offset = INTVAL (XEXP (rtl, 1));
- break;
- case MINUS:
- assert (REGNO (XEXP (rtl, 0)) == STACK_POINTER_REGNUM);
- offset = -INTVAL (XEXP (rtl, 1));
- break;
- default:
- abort ();
- }
- break;
- default:
- abort ();
- }
-
- reg_save (NULL, DWARF_FRAME_RETURN_COLUMN, reg, offset);
-}
-
-/* Record call frame debugging information for INSN, which either
- sets SP or FP (adjusting how we calculate the frame address) or saves a
- register to the stack. If INSN is NULL_RTX, initialize our state. */
-
-void
-dwarf2out_frame_debug (insn)
- rtx insn;
-{
- char *label;
- rtx src, dest;
- long offset;
-
- /* The current rule for calculating the DWARF2 canonical frame address. */
- static unsigned cfa_reg;
- static long cfa_offset;
-
- /* The register used for saving registers to the stack, and its offset
- from the CFA. */
- static unsigned cfa_store_reg;
- static long cfa_store_offset;
-
- /* A temporary register used in adjusting SP or setting up the store_reg. */
- static unsigned cfa_temp_reg;
- static long cfa_temp_value;
-
- if (insn == NULL_RTX)
- {
- /* Set up state for generating call frame debug info. */
- cfa_reg = STACK_POINTER_REGNUM;
- cfa_offset = 0;
- cfa_store_reg = STACK_POINTER_REGNUM;
- cfa_store_offset = 0;
- cfa_temp_reg = -1;
- cfa_temp_value = 0;
- return;
- }
-
- label = dwarf2out_cfi_label ();
-
- insn = PATTERN (insn);
- assert (GET_CODE (insn) == SET);
-
- src = SET_SRC (insn);
- dest = SET_DEST (insn);
-
- switch (GET_CODE (dest))
- {
- case REG:
- /* Update the CFA rule wrt SP or FP. Make sure src is
- relative to the current CFA register. */
- switch (GET_CODE (src))
- {
- /* Setting FP from SP. */
- case REG:
- assert (cfa_reg == REGNO (src));
- assert (REGNO (dest) == STACK_POINTER_REGNUM
- || frame_pointer_needed && REGNO (dest) == FRAME_POINTER_REGNUM);
- cfa_reg = REGNO (dest);
- break;
-
- case PLUS:
- case MINUS:
- if (dest == stack_pointer_rtx)
- {
- /* Adjusting SP. */
- switch (GET_CODE (XEXP (src, 1)))
- {
- case CONST_INT:
- offset = INTVAL (XEXP (src, 1));
- break;
- case REG:
- assert (REGNO (XEXP (src, 1)) == cfa_temp_reg);
- offset = cfa_temp_value;
- break;
- default:
- abort ();
- }
- if (GET_CODE (src) == PLUS)
- offset = -offset;
- if (cfa_reg == STACK_POINTER_REGNUM)
- cfa_offset += offset;
- if (cfa_store_reg == STACK_POINTER_REGNUM)
- cfa_store_offset += offset;
- assert (XEXP (src, 0) == stack_pointer_rtx);
- }
- else
- {
- /* Initializing the store base register. */
- assert (GET_CODE (src) == PLUS);
- assert (XEXP (src, 1) == stack_pointer_rtx);
- assert (GET_CODE (XEXP (src, 0)) == REG
- && REGNO (XEXP (src, 0)) == cfa_temp_reg);
- assert (cfa_store_reg == STACK_POINTER_REGNUM);
- cfa_store_reg = REGNO (dest);
- cfa_store_offset -= cfa_temp_value;
- }
- break;
-
- case CONST_INT:
- cfa_temp_reg = REGNO (dest);
- cfa_temp_value = INTVAL (src);
- break;
-
- default:
- abort ();
- }
- dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
- break;
-
- case MEM:
- /* Saving a register to the stack. Make sure dest is relative to the
- CFA register. */
- assert (GET_CODE (src) == REG);
- switch (GET_CODE (XEXP (dest, 0)))
- {
- /* With a push. */
- case PRE_INC:
- case PRE_DEC:
- offset = GET_MODE_SIZE (GET_MODE (dest));
- if (GET_CODE (src) == PRE_INC)
- offset = -offset;
- assert (REGNO (XEXP (XEXP (dest, 0), 0)) == STACK_POINTER_REGNUM);
- assert (cfa_store_reg == STACK_POINTER_REGNUM);
- cfa_store_offset += offset;
- if (cfa_reg == STACK_POINTER_REGNUM)
- cfa_offset = cfa_store_offset;
- offset = -cfa_store_offset;
- break;
-
- /* With an offset. */
- case PLUS:
- case MINUS:
- offset = INTVAL (XEXP (XEXP (dest, 0), 1));
- if (GET_CODE (src) == MINUS)
- offset = -offset;
- assert (cfa_store_reg == REGNO (XEXP (XEXP (dest, 0), 0)));
- offset -= cfa_store_offset;
- break;
-
- default:
- abort ();
- }
- dwarf2out_def_cfa (label, cfa_reg, cfa_offset);
- dwarf2out_reg_save (label, REGNO (src), offset);
- break;
-
- default:
- abort ();
- }
-}
-
-/* Return the size of a Call Frame Instruction. */
-static unsigned long
-size_of_cfi (cfi)
- dw_cfi_ref cfi;
-{
- register unsigned long size;
- /* count the 1-byte opcode */
- size = 1;
- switch (cfi->dw_cfi_opc)
- {
- case DW_CFA_offset:
- size += size_of_uleb128(cfi->dw_cfi_oprnd2.dw_cfi_offset);
- break;
- case DW_CFA_set_loc:
- size += PTR_SIZE;
- break;
- case DW_CFA_advance_loc1:
- size += 1;
- break;
- case DW_CFA_advance_loc2:
- size += 2;
- break;
- case DW_CFA_advance_loc4:
- size += 4;
- break;
-#ifdef MIPS_DEBUGGING_INFO
- case DW_CFA_MIPS_advance_loc8:
- size += 8;
- break;
-#endif
- case DW_CFA_offset_extended:
- case DW_CFA_def_cfa:
- size += size_of_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- size += size_of_uleb128(cfi->dw_cfi_oprnd2.dw_cfi_offset);
- break;
- case DW_CFA_restore_extended:
- case DW_CFA_undefined:
- size += size_of_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- break;
- case DW_CFA_same_value:
- case DW_CFA_def_cfa_register:
- size += size_of_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- break;
- case DW_CFA_register:
- size += size_of_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- size += size_of_uleb128(cfi->dw_cfi_oprnd2.dw_cfi_reg_num);
- break;
- case DW_CFA_def_cfa_offset:
- size += size_of_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_offset);
- break;
- default:
- break;
- }
- return size;
-}
-
-/* Return the size of an FDE sans the length word. */
-inline unsigned long
-size_of_fde (fde, npad)
- dw_fde_ref fde;
- unsigned long *npad;
-{
- register dw_cfi_ref cfi;
- register unsigned long aligned_size;
- register unsigned long size;
- size = DWARF_FDE_HEADER_SIZE;
- for (cfi = fde->dw_fde_cfi; cfi != NULL; cfi = cfi->dw_cfi_next)
- {
- size += size_of_cfi(cfi);
- }
- /* Round the size up to a word boundary. */
- aligned_size = DWARF_ROUND (size, PTR_SIZE);
- *npad = aligned_size - size;
- return aligned_size;
-}
-
-/* Calculate the size of the FDE table, and establish the offset
- of each FDE in the .debug_frame section. */
-static void
-calc_fde_sizes ()
-{
- register unsigned long i;
- register dw_fde_ref fde;
- register unsigned long fde_size;
- register dw_cfi_ref cfi;
- unsigned long fde_pad;
-
- cie_size = DWARF_CIE_HEADER_SIZE;
- for (cfi = cie_cfi_head; cfi != NULL; cfi = cfi->dw_cfi_next)
- cie_size += size_of_cfi (cfi);
-
- /* Initialize the beginning FDE offset. */
- next_fde_offset = DWARF_ROUND (cie_size, PTR_SIZE);
-
- for (i = 0; i < fde_table_in_use; ++i)
- {
- fde = &fde_table[i];
- fde->dw_fde_offset = next_fde_offset;
- fde_size = size_of_fde (fde, &fde_pad);
- next_fde_offset += fde_size;
- }
-}
-
-/* Output a Call Frame Information opcode and its operand(s). */
-static void
-output_cfi (cfi, fde)
- register dw_cfi_ref cfi;
- register dw_fde_ref fde;
-{
- if (cfi->dw_cfi_opc == DW_CFA_advance_loc)
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- cfi->dw_cfi_opc
- | (cfi->dw_cfi_oprnd1.dw_cfi_offset & 0x3f));
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s DW_CFA_advance_loc 0x%x",
- ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_offset);
- fputc ('\n', asm_out_file);
- }
- else if (cfi->dw_cfi_opc == DW_CFA_offset)
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- cfi->dw_cfi_opc
- | (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f));
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s DW_CFA_offset, column 0x%x",
- ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- output_uleb128(cfi->dw_cfi_oprnd2.dw_cfi_offset);
- fputc ('\n', asm_out_file);
- }
- else if (cfi->dw_cfi_opc == DW_CFA_restore)
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- cfi->dw_cfi_opc
- | (cfi->dw_cfi_oprnd1.dw_cfi_reg_num & 0x3f));
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s DW_CFA_restore, column 0x%x",
- ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- }
- else
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, cfi->dw_cfi_opc);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s %s",
- ASM_COMMENT_START,
- dwarf_cfi_name (cfi->dw_cfi_opc));
- }
- fputc ('\n', asm_out_file);
- switch (cfi->dw_cfi_opc)
- {
- case DW_CFA_set_loc:
- ASM_OUTPUT_DWARF_ADDR (asm_out_file,
- cfi->dw_cfi_oprnd1.dw_cfi_addr);
- fputc ('\n', asm_out_file);
- break;
- case DW_CFA_advance_loc1:
- /* TODO: not currently implemented. */
- abort ();
- break;
- case DW_CFA_advance_loc2:
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file,
- cfi->dw_cfi_oprnd1.dw_cfi_addr,
- fde->dw_fde_current_label);
- fputc ('\n', asm_out_file);
- fde->dw_fde_current_label = cfi->dw_cfi_oprnd1.dw_cfi_addr;
- break;
- case DW_CFA_advance_loc4:
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file,
- cfi->dw_cfi_oprnd1.dw_cfi_addr,
- fde->dw_fde_current_label);
- fputc ('\n', asm_out_file);
- fde->dw_fde_current_label = cfi->dw_cfi_oprnd1.dw_cfi_addr;
- break;
-#ifdef MIPS_DEBUGGING_INFO
- case DW_CFA_MIPS_advance_loc8:
- /* TODO: not currently implemented. */
- abort ();
- break;
-#endif
- case DW_CFA_offset_extended:
- case DW_CFA_def_cfa:
- output_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- output_uleb128(cfi->dw_cfi_oprnd2.dw_cfi_offset);
- fputc ('\n', asm_out_file);
- break;
- case DW_CFA_restore_extended:
- case DW_CFA_undefined:
- output_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- break;
- case DW_CFA_same_value:
- case DW_CFA_def_cfa_register:
- output_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- break;
- case DW_CFA_register:
- output_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- output_uleb128(cfi->dw_cfi_oprnd2.dw_cfi_reg_num);
- fputc ('\n', asm_out_file);
- break;
- case DW_CFA_def_cfa_offset:
- output_uleb128(cfi->dw_cfi_oprnd1.dw_cfi_offset);
- fputc ('\n', asm_out_file);
- break;
- default:
- break;
- }
- }
-}
-
-/* Output the call frame information used to used to record information
- that relates to calculating the frame pointer, and records the
- location of saved registers. */
-static void
-output_call_frame_info ()
-{
- register unsigned long i, j;
- register dw_fde_ref fde;
- register unsigned long fde_size;
- register dw_cfi_ref cfi;
- unsigned long fde_pad;
-
- /* Only output the info if it will be interesting. */
- for (i = 0; i < fde_table_in_use; ++i)
- if (fde_table[i].dw_fde_cfi != NULL)
- break;
- if (i == fde_table_in_use)
- return;
-
- /* (re-)initialize the beginning FDE offset. */
- next_fde_offset = DWARF_ROUND (cie_size, PTR_SIZE);
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_SECTION (asm_out_file, FRAME_SECTION);
-
- /* Output the CIE. */
- ASM_OUTPUT_DWARF_DATA (asm_out_file, next_fde_offset - DWARF_OFFSET_SIZE);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Length of Common Information Entry",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, DW_CIE_ID);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s CIE Identifier Tag",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- if (DWARF_OFFSET_SIZE == 8)
- {
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, DW_CIE_ID);
- fputc ('\n', asm_out_file);
- }
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_CIE_VERSION);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s CIE Version",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s CIE Augmentation (none)",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- output_uleb128 (1);
- if (flag_verbose_asm)
- fprintf (asm_out_file, " (CIE Code Alignment Factor)");
- fputc ('\n', asm_out_file);
- output_sleb128 (DWARF_CIE_DATA_ALIGNMENT);
- if (flag_verbose_asm)
- fprintf (asm_out_file, " (CIE Data Alignment Factor)");
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF_FRAME_RETURN_COLUMN);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s CIE RA Column",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
-
- for (cfi = cie_cfi_head; cfi != NULL; cfi = cfi->dw_cfi_next)
- output_cfi (cfi);
-
- /* Pad the CIE out to an address sized boundary. */
- for (i = next_fde_offset - cie_size; i; --i)
- {
- /* Pad out to a pointer size boundary */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_CFA_nop);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s CIE DW_CFA_nop (pad)",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- }
-
- /* Loop through all of the FDE's. */
- for (i = 0; i < fde_table_in_use; ++i)
- {
- fde = &fde_table[i];
- if (fde->dw_fde_cfi == NULL)
- continue;
- fde_size = size_of_fde (fde, &fde_pad);
- ASM_OUTPUT_DWARF_DATA (asm_out_file, fde_size - DWARF_OFFSET_SIZE);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s FDE Length",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (FRAME_SECTION));
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s FDE CIE offset",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, fde->dw_fde_begin);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s FDE initial location",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR_DELTA
- (asm_out_file, fde->dw_fde_end, fde->dw_fde_begin);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s FDE address range",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
-
- /* Loop through the Call Frame Instructions associated with
- this FDE. */
- fde->dw_fde_current_label = fde->dw_fde_begin;
- for (cfi = fde->dw_fde_cfi; cfi != NULL; cfi = cfi->dw_cfi_next)
- output_cfi (cfi, fde);
-
- /* Pad to a double word boundary. */
- for (j = 0; j < fde_pad; ++j)
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_CFA_nop);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s CIE DW_CFA_nop (pad)",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- }
- }
-}
-
-/* The DWARF2 pubname for a nested thingy looks like "A::f". The output
- of decl_printable_name for C++ looks like "A::f(int)". Let's drop the
- argument list, and maybe the scope. */
-
-static char*
-dwarf2_name (decl, scope)
- tree decl;
- int scope;
-{
- return (*decl_printable_name) (decl, scope ? 1 : 0);
-}
-
-/* Add a new entry to .debug_pubnames if appropriate. */
-static void
-add_pubname (decl, die)
- tree decl;
- dw_die_ref die;
-{
- pubname_ref p;
-
- if (! TREE_PUBLIC (decl))
- return;
-
- if (pubname_table_in_use == pubname_table_allocated)
- {
- pubname_table_allocated += PUBNAME_TABLE_INCREMENT;
- pubname_table = (pubname_ref) xrealloc
- (pubname_table, pubname_table_allocated * sizeof (pubname_entry));
- }
- p = &pubname_table[pubname_table_in_use++];
- p->die = die;
-
- p->name = xstrdup (dwarf2_name (decl, 1));
-}
-
-/* Output the public names table used to speed up access to externally
- visible names. For now, only generate entries for externally
- visible procedures. */
-static void
-output_pubnames ()
-{
- register unsigned i;
- {
- register unsigned long pubnames_length = size_of_pubnames ();
- ASM_OUTPUT_DWARF_DATA (asm_out_file, pubnames_length);
- }
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Length of Public Names Info.",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s DWARF Version",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (DEBUG_SECTION));
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA (asm_out_file, next_die_offset);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Compilation Unit Length",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- for (i = 0; i < pubname_table_in_use; ++i)
- {
- register pubname_ref pub = &pubname_table[i];
- ASM_OUTPUT_DWARF_DATA (asm_out_file, pub->die->die_offset);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s DIE offset",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
-
- ASM_OUTPUT_DWARF_STRING (asm_out_file, pub->name);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "%s external name",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- }
- ASM_OUTPUT_DWARF_DATA (asm_out_file, 0);
- fputc ('\n', asm_out_file);
-}
-
-/* Add a new entry to .debug_aranges if appropriate. */
-static void
-add_arange (decl, die)
- tree decl;
- dw_die_ref die;
-{
- if (! DECL_SECTION_NAME (decl))
- return;
-
- if (arange_table_in_use == arange_table_allocated)
- {
- arange_table_allocated += ARANGE_TABLE_INCREMENT;
- arange_table = (arange_ref) xrealloc
- (arange_table, arange_table_allocated * sizeof (dw_die_ref));
- }
- arange_table[arange_table_in_use++] = die;
-}
-
-/* Output the information that goes into the .debug_aranges table.
- Namely, define the beginning and ending address range of the
- text section generated for this compilation unit. */
-static void
-output_aranges ()
-{
- register unsigned i;
- {
- register unsigned long aranges_length = size_of_aranges ();
- ASM_OUTPUT_DWARF_DATA (asm_out_file, aranges_length);
- }
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Length of Address Ranges Info.",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s DWARF Version",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_OFFSET (asm_out_file, stripattributes (DEBUG_SECTION));
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Offset of Compilation Unit Info.",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, PTR_SIZE);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Size of Address",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Size of Segment Descriptor",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 4);
- if (PTR_SIZE == 8)
- fprintf (asm_out_file, ",0,0");
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Pad to %d byte boundary",
- ASM_COMMENT_START, 2 * PTR_SIZE);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_SECTION);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file, text_end_label, TEXT_SECTION);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- for (i = 0; i < arange_table_in_use; ++i)
- {
- dw_die_ref a = arange_table[i];
- if (a->die_tag == DW_TAG_subprogram)
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, get_AT_low_pc (a));
- else
- {
- char *name = get_AT_string (a, DW_AT_MIPS_linkage_name);
- if (! name)
- name = get_AT_string (a, DW_AT_name);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, name);
- }
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- if (a->die_tag == DW_TAG_subprogram)
- ASM_OUTPUT_DWARF_ADDR_DELTA (asm_out_file, get_AT_hi_pc (a),
- get_AT_low_pc (a));
- else
- ASM_OUTPUT_DWARF_ADDR_DATA (asm_out_file,
- get_AT_unsigned (a, DW_AT_byte_size));
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "%s Length", ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- }
- /* Output the terminator words. */
- ASM_OUTPUT_DWARF_ADDR_DATA (asm_out_file, 0);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR_DATA (asm_out_file, 0);
- fputc ('\n', asm_out_file);
-}
-
-/* Output the source line number correspondence information. This
- information goes into the .debug_line section. */
-static void
-output_line_info ()
-{
- char line_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char prev_line_label[MAX_ARTIFICIAL_LABEL_BYTES];
- register unsigned opc;
- register unsigned n_op_args;
- register unsigned long ft_index;
- register unsigned long lt_index;
- register unsigned long current_line;
- register long line_offset;
- register long line_delta;
- register unsigned long current_file;
- register unsigned long function;
- ASM_OUTPUT_DWARF_DATA (asm_out_file, size_of_line_info ());
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Length of Source Line Info.",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s DWARF Version",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA (asm_out_file, size_of_line_prolog ());
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Prolog Length",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF_LINE_MIN_INSTR_LENGTH);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Minimum Instruction Length",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DWARF_LINE_DEFAULT_IS_STMT_START);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Default is_stmt_start flag",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- fprintf (asm_out_file, "\t%s\t%d", ASM_BYTE_OP, DWARF_LINE_BASE);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Line Base Value (Special Opcodes)",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- fprintf (asm_out_file, "\t%s\t%u", ASM_BYTE_OP, DWARF_LINE_RANGE);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Line Range Value (Special Opcodes)",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- fprintf (asm_out_file, "\t%s\t%u", ASM_BYTE_OP, DWARF_LINE_OPCODE_BASE);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s Special Opcode Base",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- for (opc = 1; opc < DWARF_LINE_OPCODE_BASE; ++opc)
- {
- switch (opc)
- {
- case DW_LNS_advance_pc:
- case DW_LNS_advance_line:
- case DW_LNS_set_file:
- case DW_LNS_set_column:
- case DW_LNS_fixed_advance_pc:
- n_op_args = 1;
- break;
- default:
- n_op_args = 0;
- break;
- }
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, n_op_args);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s opcode: 0x%x has %d args",
- ASM_COMMENT_START, opc, n_op_args);
- }
- fputc ('\n', asm_out_file);
- }
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "%s Include Directory Table\n",
- ASM_COMMENT_START);
- }
- /* Include directory table is empty, at present */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- fputc ('\n', asm_out_file);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "%s File Name Table\n", ASM_COMMENT_START);
- }
- for (ft_index = 1; ft_index < file_table_in_use; ++ft_index)
- {
- ASM_OUTPUT_DWARF_STRING (asm_out_file, file_table[ft_index]);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "%s File Entry: 0x%x",
- ASM_COMMENT_START, ft_index);
- }
- fputc ('\n', asm_out_file);
- /* Include directory index */
- output_uleb128 (0);
- fputc ('\n', asm_out_file);
- /* Modification time */
- output_uleb128 (0);
- fputc ('\n', asm_out_file);
- /* File length in bytes */
- output_uleb128 (0);
- fputc ('\n', asm_out_file);
- }
- /* Terminate the file name table */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- fputc ('\n', asm_out_file);
-
- /* Set the address register to the first location in the text section */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s DW_LNE_set_address", ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- output_uleb128 (1 + PTR_SIZE);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_SECTION);
- fputc ('\n', asm_out_file);
-
- /* Generate the line number to PC correspondence table, encoded as
- a series of state machine operations. */
- current_file = 1;
- current_line = 1;
- strcpy (prev_line_label, TEXT_SECTION);
- for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
- {
- register dw_line_info_ref line_info;
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s DW_LNS_fixed_advance_pc",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_GENERATE_INTERNAL_LABEL (line_label, LINE_CODE_LABEL, lt_index);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, line_label, prev_line_label);
- fputc ('\n', asm_out_file);
- line_info = &line_info_table[lt_index];
- if (line_info->dw_file_num != current_file)
- {
- current_file = line_info->dw_file_num;
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_set_file);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file,
- "\t%s DW_LNS_set_file", ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- output_uleb128 (current_file);
- if (flag_verbose_asm)
- fprintf (asm_out_file, " (\"%s\")", file_table[current_file]);
- fputc ('\n', asm_out_file);
- }
- line_offset = line_info->dw_line_num - current_line;
- line_delta = line_offset - DWARF_LINE_BASE;
- current_line = line_info->dw_line_num;
- if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1))
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- DWARF_LINE_OPCODE_BASE + line_delta);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file,
- "\t%s line %d", ASM_COMMENT_START, current_line);
- }
- fputc ('\n', asm_out_file);
- }
- else
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file,
- "\t%s advance to line %d",
- ASM_COMMENT_START, current_line);
- }
- fputc ('\n', asm_out_file);
- output_sleb128 (line_offset);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
- fputc ('\n', asm_out_file);
- }
- strcpy (prev_line_label, line_label);
- }
-
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s DW_LNS_fixed_advance_pc",
- ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, text_end_label, prev_line_label);
- fputc ('\n', asm_out_file);
-
- /* Output the marker for the end of the line number info. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file, "\t%s DW_LNE_end_sequence", ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- output_uleb128 (1);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_end_sequence);
- fputc ('\n', asm_out_file);
-
- function = 0;
- current_file = 1;
- current_line = 1;
- for (lt_index = 0; lt_index < separate_line_info_table_in_use; )
- {
- register dw_separate_line_info_ref line_info
- = &separate_line_info_table[lt_index];
- ASM_GENERATE_INTERNAL_LABEL (line_label, SEPARATE_LINE_CODE_LABEL,
- lt_index);
- if (function != line_info->function)
- {
- function = line_info->function;
- /* Set the address register to the first line in the function */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s DW_LNE_set_address",
- ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- output_uleb128 (1 + PTR_SIZE);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, line_label);
- fputc ('\n', asm_out_file);
- }
- else
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_fixed_advance_pc",
- ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, line_label, prev_line_label);
- fputc ('\n', asm_out_file);
- }
- if (line_info->dw_file_num != current_file)
- {
- current_file = line_info->dw_file_num;
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_set_file);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file,
- "\t%s DW_LNS_set_file", ASM_COMMENT_START);
- }
- fputc ('\n', asm_out_file);
- output_uleb128 (current_file);
- if (flag_verbose_asm)
- fprintf (asm_out_file, " (\"%s\")", file_table[current_file]);
- fputc ('\n', asm_out_file);
- }
- if (line_info->dw_line_num != current_line)
- {
- line_offset = line_info->dw_line_num - current_line;
- line_delta = line_offset - DWARF_LINE_BASE;
- current_line = line_info->dw_line_num;
- if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1))
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
- DWARF_LINE_OPCODE_BASE + line_delta);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file,
- "\t%s line %d", ASM_COMMENT_START, current_line);
- }
- fputc ('\n', asm_out_file);
- }
- else
- {
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
- if (flag_verbose_asm)
- {
- fprintf (asm_out_file,
- "\t%s advance to line %d",
- ASM_COMMENT_START, current_line);
- }
- fputc ('\n', asm_out_file);
- output_sleb128 (line_offset);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
- fputc ('\n', asm_out_file);
- }
- }
- ++lt_index;
- strcpy (prev_line_label, line_label);
-
- /* If we're done with a function, end its sequence. */
- if (lt_index == separate_line_info_table_in_use
- || separate_line_info_table[lt_index].function != function)
- {
- current_file = 1;
- current_line = 1;
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_fixed_advance_pc);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s DW_LNS_fixed_advance_pc",
- ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- ASM_GENERATE_INTERNAL_LABEL (line_label, FUNC_END_LABEL, function);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, line_label, prev_line_label);
- fputc ('\n', asm_out_file);
-
- /* Output the marker for the end of this sequence. */
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
- if (flag_verbose_asm)
- fprintf (asm_out_file, "\t%s DW_LNE_end_sequence",
- ASM_COMMENT_START);
- fputc ('\n', asm_out_file);
- output_uleb128 (1);
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_end_sequence);
- fputc ('\n', asm_out_file);
- }
- }
-}
-
-/**************** attribute support utilities ********************************/
-
-/*
- * Given a pointer to a BLOCK node return non-zero if (and only if) the node
- * in question represents the outermost pair of curly braces (i.e. the "body
- * block") of a function or method.
- *
- * For any BLOCK node representing a "body block" of a function or method, the
- * BLOCK_SUPERCONTEXT of the node will point to another BLOCK node which
- * represents the outermost (function) scope for the function or method (i.e.
- * the one which includes the formal parameters). The BLOCK_SUPERCONTEXT of
- * *that* node in turn will point to the relevant FUNCTION_DECL node.
- */
-inline int
-is_body_block (stmt)
- register tree stmt;
-{
- if (TREE_CODE (stmt) == BLOCK)
- {
- register tree parent = BLOCK_SUPERCONTEXT (stmt);
-
- if (TREE_CODE (parent) == BLOCK)
- {
- register tree grandparent = BLOCK_SUPERCONTEXT (parent);
-
- if (TREE_CODE (grandparent) == FUNCTION_DECL)
- return 1;
- }
- }
- return 0;
-}
-
-/* Given a pointer to a tree node for some base type, return a pointer to
- a DIE that describes the given type.
-
- This routine must only be called for GCC type nodes that correspond to
- Dwarf base (fundamental) types. */
-static dw_die_ref
-base_type_die (type)
- register tree type;
-{
- register dw_die_ref base_type_result;
- register char *type_name;
- register enum dwarf_type encoding;
-
- if (TREE_CODE (type) == ERROR_MARK
- || TREE_CODE (type) == VOID_TYPE)
- return 0;
-
- {
- register tree name = TYPE_NAME (type);
- if (TREE_CODE (name) == TYPE_DECL)
- name = DECL_NAME (name);
- type_name = IDENTIFIER_POINTER (name);
- }
-
- switch (TREE_CODE (type))
- {
- case INTEGER_TYPE:
- /* Carefully distinguish the C character types, without messing
- up if the language is not C. Note that we check only for the names
- that contain spaces; other names might occur by coincidence in other
- languages. */
- if (! (TYPE_PRECISION (type) == CHAR_TYPE_SIZE
- && (type == char_type_node
- || ! strcmp (type_name, "signed char")
- || ! strcmp (type_name, "unsigned char"))))
- {
- if (TREE_UNSIGNED (type))
- encoding = DW_ATE_unsigned;
- else
- encoding = DW_ATE_signed;
- break;
- }
- /* else fall through */
-
- case CHAR_TYPE:
- /* GNU Pascal/Ada CHAR type. Not used in C. */
- if (TREE_UNSIGNED (type))
- encoding = DW_ATE_unsigned_char;
- else
- encoding = DW_ATE_signed_char;
- break;
-
- case REAL_TYPE:
- encoding = DW_ATE_float;
- break;
-
- case COMPLEX_TYPE:
- encoding = DW_ATE_complex_float;
- break;
-
- case BOOLEAN_TYPE:
- /* GNU FORTRAN/Ada/C++ BOOLEAN type. */
- encoding = DW_ATE_boolean;
- break;
-
- default:
- abort (); /* No other TREE_CODEs are Dwarf fundamental types. */
- }
-
- base_type_result = new_die (DW_TAG_base_type, comp_unit_die);
- add_AT_string (base_type_result, DW_AT_name, type_name);
- add_AT_unsigned (base_type_result, DW_AT_byte_size,
- TYPE_PRECISION (type) / BITS_PER_UNIT);
- add_AT_unsigned (base_type_result, DW_AT_encoding, encoding);
-
- return base_type_result;
-}
-
-/* Given a pointer to an arbitrary ..._TYPE tree node, return a pointer to
- the Dwarf "root" type for the given input type. The Dwarf "root" type of
- a given type is generally the same as the given type, except that if the
- given type is a pointer or reference type, then the root type of the given
- type is the root type of the "basis" type for the pointer or reference
- type. (This definition of the "root" type is recursive.) Also, the root
- type of a `const' qualified type or a `volatile' qualified type is the
- root type of the given type without the qualifiers. */
-static tree
-root_type (type)
- register tree type;
-{
- if (TREE_CODE (type) == ERROR_MARK)
- return error_mark_node;
-
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- return error_mark_node;
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- return type_main_variant (root_type (TREE_TYPE (type)));
-
- default:
- return type_main_variant (type);
- }
-}
-
-/* Given a pointer to an arbitrary ..._TYPE tree node, return non-zero if the
- given input type is a Dwarf "fundamental" type. Otherwise return null. */
-inline int
-is_base_type (type)
- register tree type;
-{
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- case VOID_TYPE:
- case INTEGER_TYPE:
- case REAL_TYPE:
- case COMPLEX_TYPE:
- case BOOLEAN_TYPE:
- case CHAR_TYPE:
- return 1;
-
- case SET_TYPE:
- case ARRAY_TYPE:
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- case ENUMERAL_TYPE:
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- case FILE_TYPE:
- case OFFSET_TYPE:
- case LANG_TYPE:
- return 0;
-
- default:
- abort ();
- }
- return 0;
-}
-
-/* Given a pointer to an arbitrary ..._TYPE tree node, return a debugging
- entry that chains various modifiers in front of the given type. */
-static dw_die_ref
-modified_type_die (type, is_const_type, is_volatile_type, context_die)
- register tree type;
- register int is_const_type;
- register int is_volatile_type;
- register dw_die_ref context_die;
-{
- register enum tree_code code = TREE_CODE (type);
- register dw_die_ref mod_type_die = NULL;
- register dw_die_ref sub_die = NULL;
- register tree item_type = NULL;
-
- if (code != ERROR_MARK)
- {
- type = build_type_variant (type, is_const_type, is_volatile_type);
-
- mod_type_die = lookup_type_die (type);
- if (mod_type_die)
- return mod_type_die;
-
- /* Handle C typedef types. */
- if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
- {
- tree dtype = TREE_TYPE (TYPE_NAME (type));
- if (type == dtype)
- {
- /* For a named type, use the typedef. */
- gen_type_die (type, context_die);
- mod_type_die = lookup_type_die (type);
- }
- else if (is_const_type < TYPE_READONLY (dtype)
- || is_volatile_type < TYPE_VOLATILE (dtype))
- /* cv-unqualified version of named type. Just use the unnamed
- type to which it refers. */
- mod_type_die = modified_type_die
- (DECL_ORIGINAL_TYPE (TYPE_NAME (type)),
- is_const_type, is_volatile_type);
- /* else cv-qualified version of named type; fall through. */
- }
-
- if (mod_type_die)
- /* OK */;
- else if (is_const_type)
- {
- mod_type_die = new_die (DW_TAG_const_type, comp_unit_die);
- sub_die = modified_type_die (type, 0, is_volatile_type, context_die);
- }
- else if (is_volatile_type)
- {
- mod_type_die = new_die (DW_TAG_volatile_type, comp_unit_die);
- sub_die = modified_type_die (type, 0, 0, context_die);
- }
- else if (code == POINTER_TYPE)
- {
- mod_type_die = new_die (DW_TAG_pointer_type, comp_unit_die);
- add_AT_unsigned (mod_type_die, DW_AT_byte_size, PTR_SIZE);
-#if 0
- add_AT_unsigned (mod_type_die, DW_AT_address_class, 0);
-#endif
- item_type = TREE_TYPE (type);
- }
- else if (code == REFERENCE_TYPE)
- {
- mod_type_die = new_die (DW_TAG_reference_type, comp_unit_die);
- add_AT_unsigned (mod_type_die, DW_AT_byte_size, PTR_SIZE);
-#if 0
- add_AT_unsigned (mod_type_die, DW_AT_address_class, 0);
-#endif
- item_type = TREE_TYPE (type);
- }
- else if (is_base_type (type))
- {
- mod_type_die = base_type_die (type);
- }
- else
- {
- gen_type_die (type, context_die);
-
- /* We have to get the type_main_variant here (and pass that to the
- `lookup_type_die' routine) because the ..._TYPE node we have
- might simply be a *copy* of some original type node (where the
- copy was created to help us keep track of typedef names) and
- that copy might have a different TYPE_UID from the original
- ..._TYPE node. */
- mod_type_die = lookup_type_die (type_main_variant (type));
- assert (mod_type_die != NULL);
- }
- }
- equate_type_number_to_die (type, mod_type_die);
- if (item_type)
- {
- /* We must do this after the equate_type_number_to_die call, in case
- this is a recursive type. This ensures that the modified_type_die
- recursion will terminate even if the type is recursive. Recursive
- types are possible in Ada. */
- sub_die = modified_type_die (item_type,
- TYPE_READONLY (item_type),
- TYPE_VOLATILE (item_type),
- context_die);
- }
- if (sub_die != NULL)
- {
- add_AT_die_ref (mod_type_die, DW_AT_type, sub_die);
- }
- return mod_type_die;
-}
-
-/* Given a pointer to an arbitrary ..._TYPE tree node, return true if it is
- an enumerated type. */
-inline int
-type_is_enum (type)
- register tree type;
-{
- return TREE_CODE (type) == ENUMERAL_TYPE;
-}
-
-/* Return the register number described by a given RTL node. */
-static unsigned
-reg_number (rtl)
- register rtx rtl;
-{
- register unsigned regno = REGNO (rtl);
-
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- warning_with_decl (dwarf_last_decl, "internal regno botch: regno = %d\n",
- regno);
- regno = 0;
- }
- regno = DBX_REGISTER_NUMBER (regno);
- return regno;
-}
-
-/* Return a location descriptor that designates a machine register. */
-static dw_loc_descr_ref
-reg_loc_descriptor (rtl)
- register rtx rtl;
-{
- register dw_loc_descr_ref loc_result = NULL;
- register unsigned reg = reg_number (rtl);
- if (reg >= 0 && reg <= 31)
- {
- loc_result = new_loc_descr (DW_OP_reg0 + reg, 0);
- }
- else
- {
- loc_result = new_loc_descr (DW_OP_regx, reg, 0);
- }
- return loc_result;
-}
-
-/* Return a location descriptor that designates a base+offset location. */
-static dw_loc_descr_ref
-based_loc_descr (reg, offset)
- unsigned reg;
- long int offset;
-{
- register dw_loc_descr_ref loc_result;
- /* For the "frame base", we use the frame pointer or stack pointer
- registers, since the RTL for local variables is relative to one of
- them. */
- register unsigned fp_reg = DBX_REGISTER_NUMBER (frame_pointer_needed
- ? FRAME_POINTER_REGNUM
- : STACK_POINTER_REGNUM);
- if (reg == fp_reg)
- {
- loc_result = new_loc_descr (DW_OP_fbreg, offset, 0);
- }
- else if (reg >= 0 && reg <= 31)
- {
- loc_result = new_loc_descr (DW_OP_breg0 + reg, offset);
- }
- else
- {
- loc_result = new_loc_descr (DW_OP_bregx, reg, offset);
- }
- return loc_result;
-}
-
-/* Return true if this RTL expression describes a base+offset calculation. */
-inline int
-is_based_loc (rtl)
- register rtx rtl;
-{
- return GET_CODE (rtl) == PLUS
- && ((GET_CODE (XEXP (rtl, 0)) == REG
- && GET_CODE (XEXP (rtl, 1)) == CONST_INT));
-}
-
-/* The following routine converts the RTL for a variable or parameter
- (resident in memory) into an equivalent Dwarf representation of a
- mechanism for getting the address of that same variable onto the top of a
- hypothetical "address evaluation" stack.
- When creating memory location descriptors, we are effectively transforming
- the RTL for a memory-resident object into its Dwarf postfix expression
- equivalent. This routine recursively descends an RTL tree, turning
- it into Dwarf postfix code as it goes. */
-static dw_loc_descr_ref
-mem_loc_descriptor (rtl)
- register rtx rtl;
-{
- dw_loc_descr_ref mem_loc_result = NULL;
- /* Note that for a dynamically sized array, the location we will generate a
- description of here will be the lowest numbered location which is
- actually within the array. That's *not* necessarily the same as the
- zeroth element of the array. */
- switch (GET_CODE (rtl))
- {
- case SUBREG:
- /* The case of a subreg may arise when we have a local (register)
- variable or a formal (register) parameter which doesn't quite fill
- up an entire register. For now, just assume that it is
- legitimate to make the Dwarf info refer to the whole register which
- contains the given subreg. */
- rtl = XEXP (rtl, 0);
- /* Drop thru. */
-
- case REG:
- /* Whenever a register number forms a part of the description of the
- method for calculating the (dynamic) address of a memory resident
- object, DWARF rules require the register number be referred to as
- a "base register". This distinction is not based in any way upon
- what category of register the hardware believes the given register
- belongs to. This is strictly DWARF terminology we're dealing with
- here. Note that in cases where the location of a memory-resident
- data object could be expressed as: OP_ADD (OP_BASEREG (basereg),
- OP_CONST (0)) the actual DWARF location descriptor that we generate
- may just be OP_BASEREG (basereg). This may look deceptively like
- the object in question was allocated to a register (rather than in
- memory) so DWARF consumers need to be aware of the subtle
- distinction between OP_REG and OP_BASEREG. */
- mem_loc_result = based_loc_descr (reg_number (rtl), 0);
- break;
-
- case MEM:
- mem_loc_result = mem_loc_descriptor (XEXP (rtl, 0));
- add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_deref, 0, 0));
- break;
-
- case CONST:
- case SYMBOL_REF:
- mem_loc_result = new_loc_descr (DW_OP_addr, 0, 0);
- mem_loc_result->dw_loc_oprnd1.val_class = dw_val_class_addr;
- mem_loc_result->dw_loc_oprnd1.v.val_addr = addr_to_string (rtl);
- break;
-
- case PLUS:
- if (is_based_loc (rtl))
- {
- mem_loc_result = based_loc_descr (
- reg_number (XEXP (rtl, 0)),
- INTVAL (XEXP (rtl, 1)));
- }
- else
- {
- add_loc_descr (&mem_loc_result, mem_loc_descriptor (XEXP (rtl, 0)));
- add_loc_descr (&mem_loc_result, mem_loc_descriptor (XEXP (rtl, 1)));
- add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_plus, 0, 0));
- }
- break;
-
- case MULT:
- /* If a pseudo-reg is optimized away, it is possible for it to
- be replaced with a MEM containing a multiply. */
- add_loc_descr (&mem_loc_result, mem_loc_descriptor (XEXP (rtl, 0)));
- add_loc_descr (&mem_loc_result, mem_loc_descriptor (XEXP (rtl, 1)));
- add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_mul, 0, 0));
- break;
-
- case CONST_INT:
- mem_loc_result = new_loc_descr (DW_OP_constu, INTVAL (rtl), 0);
- break;
-
- default:
- abort ();
- }
- return mem_loc_result;
-}
-
-/* Output a proper Dwarf location descriptor for a variable or parameter
- which is either allocated in a register or in a memory location. For a
- register, we just generate an OP_REG and the register number. For a
- memory location we provide a Dwarf postfix expression describing how to
- generate the (dynamic) address of the object onto the address stack. */
-static dw_loc_descr_ref
-loc_descriptor (rtl)
- register rtx rtl;
-{
- dw_loc_descr_ref loc_result = NULL;
- switch (GET_CODE (rtl))
- {
- case SUBREG:
-
- /* The case of a subreg may arise when we have a local (register)
- variable or a formal (register) parameter which doesn't quite fill
- up an entire register. For now, just assume that it is
- legitimate to make the Dwarf info refer to the whole register which
- contains the given subreg. */
-
- rtl = XEXP (rtl, 0);
- /* fall through */
-
- case REG:
- loc_result = reg_loc_descriptor (rtl);
- break;
-
- case MEM:
- loc_result = mem_loc_descriptor (XEXP (rtl, 0));
- break;
-
- default:
- abort (); /* Should never happen */
- }
- return loc_result;
-}
-
-/* Given an unsigned value, round it up to the lowest multiple of `boundary'
- which is not less than the value itself. */
-inline unsigned
-ceiling (value, boundary)
- register unsigned value;
- register unsigned boundary;
-{
- return (((value + boundary - 1) / boundary) * boundary);
-}
-
-/* Given a pointer to what is assumed to be a FIELD_DECL node, return a
- pointer to the declared type for the relevant field variable, or return
- `integer_type_node' if the given node turns out to be an
- ERROR_MARK node. */
-inline tree
-field_type (decl)
- register tree decl;
-{
- register tree type;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- return integer_type_node;
-
- type = DECL_BIT_FIELD_TYPE (decl);
- if (type == NULL)
- type = TREE_TYPE (decl);
-
- return type;
-}
-
-/* Given a pointer to a tree node, assumed to be some kind of a ..._TYPE
- node, return the alignment in bits for the type, or else return
- BITS_PER_WORD if the node actually turns out to be an
- ERROR_MARK node. */
-inline unsigned
-simple_type_align_in_bits (type)
- register tree type;
-{
- return (TREE_CODE (type) != ERROR_MARK) ? TYPE_ALIGN (type) : BITS_PER_WORD;
-}
-
-/* Given a pointer to a tree node, assumed to be some kind of a ..._TYPE
- node, return the size in bits for the type if it is a constant, or else
- return the alignment for the type if the type's size is not constant, or
- else return BITS_PER_WORD if the type actually turns out to be an
- ERROR_MARK node. */
-inline unsigned
-simple_type_size_in_bits (type)
- register tree type;
-{
- if (TREE_CODE (type) == ERROR_MARK)
- return BITS_PER_WORD;
- else
- {
- register tree type_size_tree = TYPE_SIZE (type);
-
- if (TREE_CODE (type_size_tree) != INTEGER_CST)
- return TYPE_ALIGN (type);
-
- return (unsigned) TREE_INT_CST_LOW (type_size_tree);
- }
-}
-
-/* Given a pointer to what is assumed to be a FIELD_DECL node, compute and
- return the byte offset of the lowest addressed byte of the "containing
- object" for the given FIELD_DECL, or return 0 if we are unable to
- determine what that offset is, either because the argument turns out to
- be a pointer to an ERROR_MARK node, or because the offset is actually
- variable. (We can't handle the latter case just yet). */
-static unsigned
-field_byte_offset (decl)
- register tree decl;
-{
- register unsigned type_align_in_bytes;
- register unsigned type_align_in_bits;
- register unsigned type_size_in_bits;
- register unsigned object_offset_in_align_units;
- register unsigned object_offset_in_bits;
- register unsigned object_offset_in_bytes;
- register tree type;
- register tree bitpos_tree;
- register tree field_size_tree;
- register unsigned bitpos_int;
- register unsigned deepest_bitpos;
- register unsigned field_size_in_bits;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- return 0;
-
- if (TREE_CODE (decl) != FIELD_DECL)
- abort ();
-
- type = field_type (decl);
-
- bitpos_tree = DECL_FIELD_BITPOS (decl);
- field_size_tree = DECL_SIZE (decl);
-
- /* We cannot yet cope with fields whose positions or sizes are variable, so
- for now, when we see such things, we simply return 0. Someday, we may
- be able to handle such cases, but it will be damn difficult. */
- if (TREE_CODE (bitpos_tree) != INTEGER_CST)
- return 0;
- bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
-
- if (TREE_CODE (field_size_tree) != INTEGER_CST)
- return 0;
- field_size_in_bits = (unsigned) TREE_INT_CST_LOW (field_size_tree);
-
- type_size_in_bits = simple_type_size_in_bits (type);
-
- type_align_in_bits = simple_type_align_in_bits (type);
- type_align_in_bytes = type_align_in_bits / BITS_PER_UNIT;
-
- /* Note that the GCC front-end doesn't make any attempt to keep track of
- the starting bit offset (relative to the start of the containing
- structure type) of the hypothetical "containing object" for a bit-
- field. Thus, when computing the byte offset value for the start of the
- "containing object" of a bit-field, we must deduce this information on
- our own. This can be rather tricky to do in some cases. For example,
- handling the following structure type definition when compiling for an
- i386/i486 target (which only aligns long long's to 32-bit boundaries)
- can be very tricky:
-
- struct S { int field1; long long field2:31; };
-
- Fortunately, there is a simple rule-of-thumb which can be
- used in such cases. When compiling for an i386/i486, GCC will allocate
- 8 bytes for the structure shown above. It decides to do this based upon
- one simple rule for bit-field allocation. Quite simply, GCC allocates
- each "containing object" for each bit-field at the first (i.e. lowest
- addressed) legitimate alignment boundary (based upon the required
- minimum alignment for the declared type of the field) which it can
- possibly use, subject to the condition that there is still enough
- available space remaining in the containing object (when allocated at
- the selected point) to fully accommodate all of the bits of the
- bit-field itself. This simple rule makes it obvious why GCC allocates
- 8 bytes for each object of the structure type shown above. When looking
- for a place to allocate the "containing object" for `field2', the
- compiler simply tries to allocate a 64-bit "containing object" at each
- successive 32-bit boundary (starting at zero) until it finds a place to
- allocate that 64- bit field such that at least 31 contiguous (and
- previously unallocated) bits remain within that selected 64 bit field.
- (As it turns out, for the example above, the compiler finds that it is
- OK to allocate the "containing object" 64-bit field at bit-offset zero
- within the structure type.) Here we attempt to work backwards from the
- limited set of facts we're given, and we try to deduce from those facts,
- where GCC must have believed that the containing object started (within
- the structure type). The value we deduce is then used (by the callers of
- this routine) to generate DW_AT_location and DW_AT_bit_offset attributes
- for fields (both bit-fields and, in the case of DW_AT_location, regular
- fields as well). */
-
- /* Figure out the bit-distance from the start of the structure to the
- "deepest" bit of the bit-field. */
- deepest_bitpos = bitpos_int + field_size_in_bits;
-
- /* This is the tricky part. Use some fancy footwork to deduce where the
- lowest addressed bit of the containing object must be. */
- object_offset_in_bits
- = ceiling (deepest_bitpos, type_align_in_bits) - type_size_in_bits;
-
- /* Compute the offset of the containing object in "alignment units". */
- object_offset_in_align_units = object_offset_in_bits / type_align_in_bits;
-
- /* Compute the offset of the containing object in bytes. */
- object_offset_in_bytes = object_offset_in_align_units * type_align_in_bytes;
-
- return object_offset_in_bytes;
-}
-
-
-
-/****************************** attributes *********************************/
-
-/* The following routines define various Dwarf attributes
- (and any data associated with them). */
-
-
-/* Output the form of location attributes suitable for whole variables and
- whole parameters. Note that the location attributes for struct fields are
- generated by the routine `data_member_location_attribute' below. */
-static void
-add_location_attribute (die, rtl)
- dw_die_ref die;
- register rtx rtl;
-{
- dw_loc_descr_ref loc_descr = NULL;
-
- /* Handle a special case. If we are about to output a location descriptor
- for a variable or parameter which has been optimized out of existence,
- don't do that. Instead we output a null location descriptor value as
- part of the location attribute. A variable which has been optimized out
- of existence will have a DECL_RTL value which denotes a pseudo-reg.
- Currently, in some rare cases, variables can have DECL_RTL values which
- look like (MEM (REG pseudo-reg#)). These cases are due to bugs
- elsewhere in the compiler. We treat such cases as if the variable(s) in
- question had been optimized out of existence. Note that in all cases
- where we wish to express the fact that a variable has been optimized out
- of existence, we do not simply suppress the generation of the entire
- location attribute because the absence of a location attribute in
- certain kinds of DIEs is used to indicate something else entirely...
- i.e. that the DIE represents an object declaration, but not a
- definition. So sayeth the PLSIG. */
- if (!is_pseudo_reg (rtl)
- && (GET_CODE (rtl) != MEM
- || !is_pseudo_reg (XEXP (rtl, 0))))
- {
- loc_descr = loc_descriptor (eliminate_regs (rtl, 0, NULL_RTX, 0));
- }
-
-#ifdef MIPS_DEBUGGING_INFO
- /* ??? SGI's dwarf reader is buggy, and will not accept a zero size
- location descriptor. Lets just use r0 for now to represent a
- variable that has been optimized away. */
- if (loc_descr == NULL)
- {
- loc_descr = loc_descriptor (gen_rtx (REG, word_mode, 0));
- }
-#endif
-
- add_AT_loc (die, DW_AT_location, loc_descr);
-}
-
-/* Attach the specialized form of location attribute used for data
- members of struct and union types. In the special case of a
- FIELD_DECL node which represents a bit-field, the "offset" part
- of this special location descriptor must indicate the distance
- in bytes from the lowest-addressed byte of the containing struct
- or union type to the lowest-addressed byte of the "containing
- object" for the bit-field. (See the `field_byte_offset' function
- above).. For any given bit-field, the "containing object" is a
- hypothetical object (of some integral or enum type) within which
- the given bit-field lives. The type of this hypothetical
- "containing object" is always the same as the declared type of
- the individual bit-field itself (for GCC anyway... the DWARF
- spec doesn't actually mandate this). Note that it is the size
- (in bytes) of the hypothetical "containing object" which will
- be given in the DW_AT_byte_size attribute for this bit-field.
- (See the `byte_size_attribute' function below.) It is also used
- when calculating the value of the DW_AT_bit_offset attribute.
- (See the `bit_offset_attribute' function below). */
-static void
-add_data_member_location_attribute (die, decl)
- register dw_die_ref die;
- register tree decl;
-{
- register unsigned long offset;
- register dw_loc_descr_ref loc_descr;
- register enum dwarf_location_atom op;
-
- if (TREE_CODE (decl) == TREE_VEC)
- offset = TREE_INT_CST_LOW (BINFO_OFFSET (decl));
- else
- offset = field_byte_offset (decl);
-
- /* The DWARF2 standard says that we should assume that the structure address
- is already on the stack, so we can specify a structure field address
- by using DW_OP_plus_uconst. */
-#ifdef MIPS_DEBUGGING_INFO
- /* ??? The SGI dwarf reader does not handle the DW_OP_plus_uconst operator
- correctly. It works only if we leave the offset on the stack. */
- op = DW_OP_constu;
-#else
- op = DW_OP_plus_uconst;
-#endif
- loc_descr = new_loc_descr (op, offset, 0);
- add_AT_loc (die, DW_AT_data_member_location, loc_descr);
-}
-
-/* Attach an DW_AT_const_value attribute for a variable or a parameter which
- does not have a "location" either in memory or in a register. These
- things can arise in GNU C when a constant is passed as an actual parameter
- to an inlined function. They can also arise in C++ where declared
- constants do not necessarily get memory "homes". */
-static void
-add_const_value_attribute (die, rtl)
- register dw_die_ref die;
- register rtx rtl;
-{
- switch (GET_CODE (rtl))
- {
- case CONST_INT:
- /* Note that a CONST_INT rtx could represent either an integer or a
- floating-point constant. A CONST_INT is used whenever the constant
- will fit into a single word. In all such cases, the original mode
- of the constant value is wiped out, and the CONST_INT rtx is
- assigned VOIDmode. */
- add_AT_unsigned (die, DW_AT_const_value, (unsigned) INTVAL (rtl));
- break;
-
- case CONST_DOUBLE:
- /* Note that a CONST_DOUBLE rtx could represent either an integer or a
- floating-point constant. A CONST_DOUBLE is used whenever the
- constant requires more than one word in order to be adequately
- represented. We output CONST_DOUBLEs as blocks. */
- {
- register enum machine_mode mode = GET_MODE (rtl);
-
- if (GET_MODE_CLASS (mode) == MODE_FLOAT)
- {
- union real_extract u;
- jmp_buf handler;
- register unsigned length = GET_MODE_SIZE (mode) / 4;
- register long *array = (long *) xmalloc (length * sizeof (long));
-
- bcopy ((char *) &CONST_DOUBLE_LOW (rtl), (char *) &u, sizeof u);
-
- if (setjmp (handler))
- {
- error ("floating point trap outputting debug info");
- u.d = dconst0;
- }
-
- set_float_handler (handler);
-
- switch (mode)
- {
- case SFmode:
- REAL_VALUE_TO_TARGET_SINGLE (u.d, array[0]);
- break;
-
- case DFmode:
- REAL_VALUE_TO_TARGET_DOUBLE (u.d, array);
- break;
-
- case XFmode:
- case TFmode:
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (u.d, array);
- break;
-
- default:
- abort ();
- }
-
- set_float_handler (NULL_PTR);
-
- add_AT_float (die, DW_AT_const_value, length, array);
- }
- else
- add_AT_long_long (die, DW_AT_const_value,
- CONST_DOUBLE_HIGH (rtl), CONST_DOUBLE_LOW (rtl));
- }
- break;
-
- case CONST_STRING:
- add_AT_string (die, DW_AT_const_value, XSTR (rtl, 0));
- break;
-
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST:
- add_AT_addr (die, DW_AT_const_value, addr_to_string (rtl));
- break;
-
- case PLUS:
- /* In cases where an inlined instance of an inline function is passed
- the address of an `auto' variable (which is local to the caller) we
- can get a situation where the DECL_RTL of the artificial local
- variable (for the inlining) which acts as a stand-in for the
- corresponding formal parameter (of the inline function) will look
- like (plus:SI (reg:SI FRAME_PTR) (const_int ...)). This is not
- exactly a compile-time constant expression, but it isn't the address
- of the (artificial) local variable either. Rather, it represents the
- *value* which the artificial local variable always has during its
- lifetime. We currently have no way to represent such quasi-constant
- values in Dwarf, so for now we just punt and generate an
- DW_AT_const_value attribute with null address. */
- add_AT_addr (die, DW_AT_const_value, addr_to_string (const0_rtx));
- break;
-
- default:
- /* No other kinds of rtx should be possible here. */
- abort ();
- }
-
-}
-
-/* Generate *either* an DW_AT_location attribute or else an DW_AT_const_value
- data attribute for a variable or a parameter. We generate the
- DW_AT_const_value attribute only in those cases where the given variable
- or parameter does not have a true "location" either in memory or in a
- register. This can happen (for example) when a constant is passed as an
- actual argument in a call to an inline function. (It's possible that
- these things can crop up in other ways also.) Note that one type of
- constant value which can be passed into an inlined function is a constant
- pointer. This can happen for example if an actual argument in an inlined
- function call evaluates to a compile-time constant address. */
-static void
-add_location_or_const_value_attribute (die, decl)
- register dw_die_ref die;
- register tree decl;
-{
- register rtx rtl;
- register tree declared_type;
- register tree passed_type;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- {
- return;
- }
- if ((TREE_CODE (decl) != VAR_DECL)
- && (TREE_CODE (decl) != PARM_DECL))
- {
- /* Should never happen. */
- abort ();
- return;
- }
- /* Here we have to decide where we are going to say the parameter "lives"
- (as far as the debugger is concerned). We only have a couple of
- choices. GCC provides us with DECL_RTL and with DECL_INCOMING_RTL.
- DECL_RTL normally indicates where the parameter lives during most of the
- activa- tion of the function. If optimization is enabled however, this
- could be either NULL or else a pseudo-reg. Both of those cases indicate
- that the parameter doesn't really live anywhere (as far as the code
- generation parts of GCC are concerned) during most of the function's
- activation. That will happen (for example) if the parameter is never
- referenced within the function. We could just generate a location
- descriptor here for all non-NULL non-pseudo values of DECL_RTL and
- ignore all of the rest, but we can be a little nicer than that if we
- also consider DECL_INCOMING_RTL in cases where DECL_RTL is NULL or is a
- pseudo-reg. Note however that we can only get away with using
- DECL_INCOMING_RTL as a backup substitute for DECL_RTL in certain limited
- cases. In cases where DECL_ARG_TYPE(decl) indicates the same type as
- TREE_TYPE(decl) we can be sure that the parameter was passed using the
- same type as it is declared to have within the function, and that its
- DECL_INCOMING_RTL points us to a place where a value of that type is
- passed. In cases where DECL_ARG_TYPE(decl) and TREE_TYPE(decl) are
- different types however, we cannot (in general) use DECL_INCOMING_RTL as
- a backup substitute for DECL_RTL because in these cases,
- DECL_INCOMING_RTL points us to a value of some type which is *different*
- from the type of the parameter itself. Thus, if we tried to use
- DECL_INCOMING_RTL to generate a location attribute in such cases, the
- debugger would end up (for example) trying to fetch a `float' from a
- place which actually contains the first part of a `double'. That would
- lead to really incorrect and confusing output at debug-time, and we
- don't want that now do we? So in general, we DO NOT use
- DECL_INCOMING_RTL as a backup for DECL_RTL in cases where
- DECL_ARG_TYPE(decl) != TREE_TYPE(decl). There are a couple of cute
- exceptions however. On little-endian machines we can get away with
- using DECL_INCOMING_RTL even when DECL_ARG_TYPE(decl) is not the same as
- TREE_TYPE(decl) but only when DECL_ARG_TYPE(decl) is an integral type
- which is smaller than TREE_TYPE(decl). These cases arise when (on a
- little-endian machine) a non-prototyped function has a parameter
- declared to be of type `short' or `char'. In such cases,
- TREE_TYPE(decl) will be `short' or `char', DECL_ARG_TYPE(decl) will be
- `int', and DECL_INCOMING_RTL will point to the lowest-order byte of the
- passed `int' value. If the debugger then uses that address to fetch a
- `short' or a `char' (on a little-endian machine) the result will be the
- correct data, so we allow for such exceptional cases below. Note that
- our goal here is to describe the place where the given formal parameter
- lives during most of the function's activation (i.e. between the end of
- the prologue and the start of the epilogue). We'll do that as best as
- we can. Note however that if the given formal parameter is modified
- sometime during the execution of the function, then a stack backtrace
- (at debug-time) will show the function as having been called with the
- *new* value rather than the value which was originally passed in. This
- happens rarely enough that it is not a major problem, but it *is* a
- problem, and I'd like to fix it. A future version of dwarf2out.c may
- generate two additional attributes for any given DW_TAG_formal_parameter
- DIE which will describe the "passed type" and the "passed location" for
- the given formal parameter in addition to the attributes we now generate
- to indicate the "declared type" and the "active location" for each
- parameter. This additional set of attributes could be used by debuggers
- for stack backtraces. Separately, note that sometimes DECL_RTL can be
- NULL and DECL_INCOMING_RTL can be NULL also. This happens (for example)
- for inlined-instances of inline function formal parameters which are
- never referenced. This really shouldn't be happening. All PARM_DECL
- nodes should get valid non-NULL DECL_INCOMING_RTL values, but
- integrate.c doesn't currently generate these values for inlined
- instances of inline function parameters, so when we see such cases, we
- are just SOL (shit-out-of-luck) for the time being (until integrate.c
- gets fixed). */
-
- /* Use DECL_RTL as the "location" unless we find something better. */
- rtl = DECL_RTL (decl);
-
- if (TREE_CODE (decl) == PARM_DECL)
- {
- if (rtl == NULL_RTX || is_pseudo_reg (rtl))
- {
- declared_type = type_main_variant (TREE_TYPE (decl));
- passed_type = type_main_variant (DECL_ARG_TYPE (decl));
- /* This decl represents a formal parameter which was
- optimized out.
-
- Note that DECL_INCOMING_RTL may be NULL in here, but we handle
- all* cases where (rtl == NULL_RTX) just below. */
- if (declared_type == passed_type)
- {
- rtl = DECL_INCOMING_RTL (decl);
- }
- else if (!BYTES_BIG_ENDIAN)
- {
- if (TREE_CODE (declared_type) == INTEGER_TYPE)
- {
- if (TYPE_SIZE (declared_type) <= TYPE_SIZE (passed_type))
- {
- rtl = DECL_INCOMING_RTL (decl);
- }
- }
- }
- }
- }
- if (rtl == NULL_RTX)
- return;
-
- switch (GET_CODE (rtl))
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST_STRING:
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST:
- case PLUS:
- /* DECL_RTL could be (plus (reg ...) (const_int ...)) */
- add_const_value_attribute (die, rtl);
- break;
-
- case MEM:
- case REG:
- case SUBREG:
- add_location_attribute (die, rtl);
- break;
-
- default:
- abort (); /* Should never happen. */
- }
-}
-
-/* Generate an DW_AT_name attribute given some string value to be included as
- the value of the attribute. */
-inline void
-add_name_attribute (die, name_string)
- register dw_die_ref die;
- register char *name_string;
-{
- if (name_string && *name_string)
- {
- add_AT_string (die, DW_AT_name, name_string);
- }
-}
-
-/* Given a tree node describing an array bound (either lower or upper) output
- a representation for that bound.
-
- FIXME: This uses location descriptions for variable bounds, whereas the
- DWARF-2 spec only allowes for constants or DIE references. */
-static void
-add_bound_info (subrange_die, bound_attr, bound)
- register dw_die_ref subrange_die;
- register enum dwarf_attribute bound_attr;
- register tree bound;
-{
- register dw_loc_descr_ref bound_loc = NULL;
- register unsigned bound_value = 0;
- switch (TREE_CODE (bound))
- {
- case ERROR_MARK:
- return;
-
- /* All fixed-bounds are represented by INTEGER_CST nodes. */
- case INTEGER_CST:
- bound_value = TREE_INT_CST_LOW (bound);
- if (bound_attr == DW_AT_lower_bound
- && ((is_c_family () && bound_value == 0)
- || (is_fortran () && bound_value == 1)))
- /* use the default */;
- else
- add_AT_unsigned (subrange_die, bound_attr, bound_value);
- break;
-
- /* Dynamic bounds may be represented by NOP_EXPR nodes containing
- SAVE_EXPR nodes. */
- case NOP_EXPR:
- bound = TREE_OPERAND (bound, 0);
- /* ... fall thru... */
-
- case SAVE_EXPR:
- /* Handle the simple case of `int ar[i];'. */
- if (bound_attr == DW_AT_upper_bound && is_c_family ()
- && TREE_CODE (TREE_OPERAND (bound, 0)) == MINUS_EXPR)
- {
- tree t = TREE_OPERAND (bound, 0);
- if (integer_onep (TREE_OPERAND (bound, 1)))
- t = TREE_OPERAND (t, 0);
- if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL)
- {
- add_AT_die_ref (subrange_die, DW_AT_count, lookup_decl_die (t));
- return;
- }
- }
-
- /* If optimization is turned on, the SAVE_EXPRs that describe how to
- access the upper bound values are essentially bogus. They only
- describe (at best) how to get at these values at the points in the
- generated code right after they have just been computed. Worse
- yet, in the typical case, the upper bound values will not even
- *be* computed in the optimized code, so these SAVE_EXPRs are
- entirely bogus. In order to compensate for this fact, we check
- here to see if optimization is enabled, and if so, we don't add an
- attribute for the (unknown and unknowable) upper bound. This
- should not cause too much trouble for existing (stupid?)
- debuggers because they have to deal with empty upper bounds
- location descriptions anyway in order to be able to deal with
- incomplete array types. Of course an intelligent debugger (GDB?)
- should be able to comprehend that a missing upper bound
- specification in a array type used for a storage class `auto'
- local array variable indicates that the upper bound is both
- unknown (at compile- time) and unknowable (at run-time) due to
- optimization. */
- if (!optimize)
- {
- bound_loc = mem_loc_descriptor
- (eliminate_regs (SAVE_EXPR_RTL (bound), 0, NULL_RTX, 0));
- add_AT_loc (subrange_die, bound_attr, bound_loc);
- }
- /* else leave out the attribute. */
- break;
-
- default:
- abort ();
- }
-}
-
-/* Note that the block of subscript information for an array type also
- includes information about the element type of type given array type. */
-static void
-add_subscript_info (type_die, type)
- register dw_die_ref type_die;
- register tree type;
-{
- register unsigned dimension_number;
- register tree lower, upper;
- register dw_die_ref subrange_die;
-
- /* The GNU compilers represent multidimensional array types as sequences of
- one dimensional array types whose element types are themselves array
- types. Here we squish that down, so that each multidimensional array
- type gets only one array_type DIE in the Dwarf debugging info. The draft
- Dwarf specification say that we are allowed to do this kind of
- compression in C (because there is no difference between an array or
- arrays and a multidimensional array in C) but for other source languages
- (e.g. Ada) we probably shouldn't do this. */
- /* ??? The SGI dwarf reader fails for multidimensional arrays with a
- const enum type. E.g. const enum machine_mode insn_operand_mode[2][10].
- We work around this by disabling this feature. See also
- gen_array_type_die. */
-#ifndef MIPS_DEBUGGING_INFO
- for (dimension_number = 0;
- TREE_CODE (type) == ARRAY_TYPE;
- type = TREE_TYPE (type), dimension_number++)
- {
-#endif
- register tree domain = TYPE_DOMAIN (type);
-
- /* Arrays come in three flavors: Unspecified bounds, fixed bounds,
- and (in GNU C only) variable bounds. Handle all three forms
- here. */
- subrange_die = new_die (DW_TAG_subrange_type, type_die);
- if (domain)
- {
- /* We have an array type with specified bounds. */
- lower = TYPE_MIN_VALUE (domain);
- upper = TYPE_MAX_VALUE (domain);
-
- /* define the index type. */
- if (TREE_TYPE (domain))
- add_type_attribute (subrange_die, TREE_TYPE (domain), 0, 0,
- type_die);
-
- add_bound_info (subrange_die, DW_AT_lower_bound, lower);
- add_bound_info (subrange_die, DW_AT_upper_bound, upper);
- }
- else
- {
- /* We have an array type with an unspecified length. The DWARF-2
- spec does not say how to handle this; let's just leave out the
- bounds. */
- }
-#ifndef MIPS_DEBUGGING_INFO
- }
-#endif
-}
-
-static void
-add_byte_size_attribute (die, tree_node)
- dw_die_ref die;
- register tree tree_node;
-{
- register unsigned size;
-
- switch (TREE_CODE (tree_node))
- {
- case ERROR_MARK:
- size = 0;
- break;
- case ENUMERAL_TYPE:
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- size = int_size_in_bytes (tree_node);
- break;
- case FIELD_DECL:
- /* For a data member of a struct or union, the DW_AT_byte_size is
- generally given as the number of bytes normally allocated for an
- object of the *declared* type of the member itself. This is true
- even for bit-fields. */
- size = simple_type_size_in_bits (field_type (tree_node)) / BITS_PER_UNIT;
- break;
- default:
- abort ();
- }
-
- /* Note that `size' might be -1 when we get to this point. If it is, that
- indicates that the byte size of the entity in question is variable. We
- have no good way of expressing this fact in Dwarf at the present time,
- so just let the -1 pass on through. */
-
- add_AT_unsigned (die, DW_AT_byte_size, size);
-}
-
-/* For a FIELD_DECL node which represents a bit-field, output an attribute
- which specifies the distance in bits from the highest order bit of the
- "containing object" for the bit-field to the highest order bit of the
- bit-field itself.
-
- For any given bit-field, the "containing object" is a hypothetical
- object (of some integral or enum type) within which the given bit-field
- lives. The type of this hypothetical "containing object" is always the
- same as the declared type of the individual bit-field itself. The
- determination of the exact location of the "containing object" for a
- bit-field is rather complicated. It's handled by the
- `field_byte_offset' function (above).
-
- Note that it is the size (in bytes) of the hypothetical "containing object"
- which will be given in the DW_AT_byte_size attribute for this bit-field.
- (See `byte_size_attribute' above). */
-inline void
-add_bit_offset_attribute (die, decl)
- register dw_die_ref die;
- register tree decl;
-{
- register unsigned object_offset_in_bytes = field_byte_offset (decl);
- register tree type = DECL_BIT_FIELD_TYPE (decl);
- register tree bitpos_tree = DECL_FIELD_BITPOS (decl);
- register unsigned bitpos_int;
- register unsigned highest_order_object_bit_offset;
- register unsigned highest_order_field_bit_offset;
- register unsigned bit_offset;
-
- assert (TREE_CODE (decl) == FIELD_DECL); /* Must be a field. */
- assert (type); /* Must be a bit field. */
-
- /* We can't yet handle bit-fields whose offsets are variable, so if we
- encounter such things, just return without generating any attribute
- whatsoever. */
- if (TREE_CODE (bitpos_tree) != INTEGER_CST)
- {
- return;
- }
- bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
-
- /* Note that the bit offset is always the distance (in bits) from the
- highest-order bit of the "containing object" to the highest-order bit of
- the bit-field itself. Since the "high-order end" of any object or field
- is different on big-endian and little-endian machines, the computation
- below must take account of these differences. */
- highest_order_object_bit_offset = object_offset_in_bytes * BITS_PER_UNIT;
- highest_order_field_bit_offset = bitpos_int;
-
- if (!BYTES_BIG_ENDIAN)
- {
- highest_order_field_bit_offset
- += (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl));
-
- highest_order_object_bit_offset += simple_type_size_in_bits (type);
- }
- bit_offset =
- (!BYTES_BIG_ENDIAN
- ? highest_order_object_bit_offset - highest_order_field_bit_offset
- : highest_order_field_bit_offset - highest_order_object_bit_offset);
-
- add_AT_unsigned (die, DW_AT_bit_offset, bit_offset);
-}
-
-/* For a FIELD_DECL node which represents a bit field, output an attribute
- which specifies the length in bits of the given field. */
-inline void
-add_bit_size_attribute (die, decl)
- register dw_die_ref die;
- register tree decl;
-{
- assert (TREE_CODE (decl) == FIELD_DECL); /* Must be a field. */
- assert (DECL_BIT_FIELD_TYPE (decl)); /* Must be a bit field. */
- add_AT_unsigned (die, DW_AT_bit_size,
- (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl)));
-}
-
-/* If the compiled language is ANSI C, then add a 'prototyped'
- attribute, if arg types are given for the parameters of a function. */
-inline void
-add_prototyped_attribute (die, func_type)
- register dw_die_ref die;
- register tree func_type;
-{
- if (get_AT_unsigned (comp_unit_die, DW_AT_language) == DW_LANG_C89
- && TYPE_ARG_TYPES (func_type) != NULL)
- add_AT_flag (die, DW_AT_prototyped, 1);
-}
-
-
-/* Add an 'abstract_origin' attribute below a given DIE. The DIE is found
- by looking in either the type declaration or object declaration
- equate table. */
-inline void
-add_abstract_origin_attribute (die, origin)
- register dw_die_ref die;
- register tree origin;
-{
- dw_die_ref origin_die = NULL;
- if (TREE_CODE_CLASS (TREE_CODE (origin)) == 'd')
- {
- origin_die = lookup_decl_die (origin);
- }
- else if (TREE_CODE_CLASS (TREE_CODE (origin)) == 't')
- {
- origin_die = lookup_type_die (origin);
- }
- add_AT_die_ref (die, DW_AT_abstract_origin, origin_die);
-}
-
-/* We do not currently support the pure_virtual attribute. */
-
-inline void
-add_pure_or_virtual_attribute (die, func_decl)
- register dw_die_ref die;
- register tree func_decl;
-{
- if (DECL_VINDEX (func_decl))
- {
- add_AT_unsigned (die, DW_AT_virtuality, DW_VIRTUALITY_virtual);
- add_AT_loc (die, DW_AT_vtable_elem_location, new_loc_descr
- (DW_OP_constu, TREE_INT_CST_LOW (DECL_VINDEX (func_decl))));
- /* GNU extension: Record what type this method came from originally. */
- if (debug_info_level > DINFO_LEVEL_TERSE)
- add_AT_die_ref (die, DW_AT_containing_type,
- lookup_type_die (DECL_CONTEXT (func_decl)));
- }
-}
-
-/********************* utility routines for DIEs *************************/
-
-/* Add source coordinate attributes for the given decl. */
-static void
-add_src_coords_attributes (die, decl)
- register dw_die_ref die;
- register tree decl;
-{
- register unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl));
- add_AT_unsigned (die, DW_AT_decl_file, file_index);
- add_AT_unsigned (die, DW_AT_decl_line, DECL_SOURCE_LINE (decl));
-}
-
-/* Add an DW_AT_name attribute and source coordinate attribute for the
- given decl, but only if it actually has a name. */
-static void
-add_name_and_src_coords_attributes (die, decl)
- register dw_die_ref die;
- register tree decl;
-{
- register tree decl_name;
- decl_name = DECL_NAME (decl);
- if (decl_name && IDENTIFIER_POINTER (decl_name))
- {
- add_name_attribute (die, dwarf2_name (decl, 0));
- add_src_coords_attributes (die, decl);
- if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
- && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
- add_AT_string (die, DW_AT_MIPS_linkage_name,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
- }
-}
-
-/* Push a new declaration scope. */
-static void
-push_decl_scope (scope)
- tree scope;
-{
- /* Make room in the decl_scope_table, if necessary. */
- if (decl_scope_table_allocated == decl_scope_depth)
- {
- decl_scope_table_allocated += DECL_SCOPE_TABLE_INCREMENT;
- decl_scope_table = (tree *) xrealloc (decl_scope_table,
- decl_scope_table_allocated * sizeof (tree));
- }
- decl_scope_table[decl_scope_depth++] = scope;
-}
-
-/* Return the DIE for the scope the immediately contains this declaration. */
-static dw_die_ref
-scope_die_for (t, context_die)
- register tree t;
- register dw_die_ref context_die;
-{
- register dw_die_ref scope_die = NULL;
- register tree containing_scope;
- register unsigned long i;
-
- /* Function-local tags and functions get stuck in limbo until they are
- fixed up by decls_for_scope. */
- if (context_die == NULL
- && (TREE_CODE (t) == FUNCTION_DECL || is_tagged_type (t)))
- return NULL;
-
- /* Walk back up the declaration tree looking for a place to define
- this type. */
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
- containing_scope = TYPE_CONTEXT (t);
- else if (TREE_CODE (t) == FUNCTION_DECL && DECL_VINDEX (t))
- containing_scope = decl_class_context (t);
- else
- containing_scope = DECL_CONTEXT (t);
-
- if (containing_scope == NULL)
- {
- scope_die = comp_unit_die;
- }
- else
- {
- for (i = decl_scope_depth, scope_die = context_die;
- i > 0 && decl_scope_table[i - 1] != containing_scope;
- scope_die = scope_die->die_parent, --i)
- /* nothing */ ;
- if (i == 0)
- {
- assert (scope_die == comp_unit_die);
- assert (TREE_CODE_CLASS (TREE_CODE (containing_scope)) == 't');
- if (debug_info_level > DINFO_LEVEL_TERSE)
- assert (TREE_ASM_WRITTEN (containing_scope));
- }
- }
- return scope_die;
-}
-
-/* Pop a declaration scope. */
-inline void
-pop_decl_scope ()
-{
- assert (decl_scope_depth > 0);
- --decl_scope_depth;
-}
-
-/* Many forms of DIEs require a "type description" attribute. This
- routine locates the proper "type descriptor" die for the type given
- by 'type', and adds an DW_AT_type attribute below the given die. */
-static void
-add_type_attribute (object_die, type, decl_const, decl_volatile, context_die)
- register dw_die_ref object_die;
- register tree type;
- register int decl_const;
- register int decl_volatile;
- register dw_die_ref context_die;
-{
- register enum tree_code code = TREE_CODE (type);
- register dw_die_ref type_die = NULL;
-
- if (code == ERROR_MARK)
- {
- return;
- }
-
- /* Handle a special case. For functions whose return type is void, we
- generate *no* type attribute. (Note that no object may have type
- `void', so this only applies to function return types). */
- if (code == VOID_TYPE)
- {
- return;
- }
-
- type_die = modified_type_die (type,
- decl_const || TYPE_READONLY (type),
- decl_volatile || TYPE_VOLATILE (type),
- context_die);
- if (type_die != NULL)
- {
- add_AT_die_ref (object_die, DW_AT_type, type_die);
- }
-}
-
-/* Given a tree pointer to a struct, class, union, or enum type node, return
- a pointer to the (string) tag name for the given type, or zero if the type
- was declared without a tag. */
-static char *
-type_tag (type)
- register tree type;
-{
- register char *name = 0;
-
- if (TYPE_NAME (type) != 0)
- {
- register tree t = 0;
-
- /* Find the IDENTIFIER_NODE for the type name. */
- if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- t = TYPE_NAME (type);
-
- /* The g++ front end makes the TYPE_NAME of *each* tagged type point to
- a TYPE_DECL node, regardless of whether or not a `typedef' was
- involved. */
- else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && ! DECL_IGNORED_P (TYPE_NAME (type)))
- t = DECL_NAME (TYPE_NAME (type));
-
- /* Now get the name as a string, or invent one. */
- if (t != 0)
- name = IDENTIFIER_POINTER (t);
- }
- return (name == 0 || *name == '\0') ? 0 : name;
-}
-
-/* Return the type associated with a data member, make a special check
- for bit field types. */
-inline tree
-member_declared_type (member)
- register tree member;
-{
- return (DECL_BIT_FIELD_TYPE (member))
- ? DECL_BIT_FIELD_TYPE (member)
- : TREE_TYPE (member);
-}
-
-/* Get the decl's label, as described by its RTL. This may be different
- from the DECL_NAME name used in the source file. */
-static char *
-decl_start_label (decl)
- register tree decl;
-{
- rtx x;
- char *fnname;
- x = DECL_RTL (decl);
- if (GET_CODE (x) != MEM)
- {
- abort ();
- }
- x = XEXP (x, 0);
- if (GET_CODE (x) != SYMBOL_REF)
- {
- abort ();
- }
- fnname = XSTR (x, 0);
- return fnname;
-}
-
-/******************************* DIE Generation *************************/
-
-/* These routines generate the internnal representation of the DIE's for
- the compilation unit. Debugging information is collected by walking
- the declaration trees passed in from dwarf2out_decl(). */
-
-static void
-gen_array_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref scope_die = scope_die_for (type, context_die);
- register dw_die_ref array_die;
- register tree element_type;
-
- /* ??? The SGI dwarf reader fails for array of array of enum types unless
- the inner array type comes before the outer array type. Thus we must
- call gen_type_die before we call new_die. See below also. */
-#ifdef MIPS_DEBUGGING_INFO
- gen_type_die (TREE_TYPE (type), context_die);
-#endif
-
- array_die = new_die (DW_TAG_array_type, scope_die);
-
-#if 0
- /* We default the array ordering. SDB will probably do
- the right things even if DW_AT_ordering is not present. It's not even
- an issue until we start to get into multidimensional arrays anyway. If
- SDB is ever caught doing the Wrong Thing for multi-dimensional arrays,
- then we'll have to put the DW_AT_ordering attribute back in. (But if
- and when we find out that we need to put these in, we will only do so
- for multidimensional arrays. */
- add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_row_major);
-#endif
-
-#ifdef MIPS_DEBUGGING_INFO
- /* The SGI compilers handle arrays of unknown bound by setting
- AT_declaration and not emitting any subrange DIEs. */
- if (! TYPE_DOMAIN (type))
- add_AT_unsigned (array_die, DW_AT_declaration, 1);
- else
-#endif
- add_subscript_info (array_die, type);
-
- equate_type_number_to_die (type, array_die);
-
- /* Add representation of the type of the elements of this array type. */
- element_type = TREE_TYPE (type);
- /* ??? The SGI dwarf reader fails for multidimensional arrays with a
- const enum type. E.g. const enum machine_mode insn_operand_mode[2][10].
- We work around this by disabling this feature. See also
- add_subscript_info. */
-#ifndef MIPS_DEBUGGING_INFO
- while (TREE_CODE (element_type) == ARRAY_TYPE)
- {
- element_type = TREE_TYPE (element_type);
- }
- gen_type_die (element_type, context_die);
-#endif
-
- add_type_attribute (array_die, element_type, 0, 0, context_die);
-}
-
-static void
-gen_set_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref type_die = new_die
- (DW_TAG_set_type, scope_die_for (type, context_die));
- equate_type_number_to_die (type, type_die);
- add_type_attribute (type_die, TREE_TYPE (type), 0, 0, context_die);
-}
-
-static void
-gen_entry_point_die (decl, context_die)
- register tree decl;
- register dw_die_ref context_die;
-{
- register tree origin = decl_ultimate_origin (decl);
- register dw_die_ref decl_die = new_die (DW_TAG_entry_point, context_die);
- if (origin != NULL)
- {
- add_abstract_origin_attribute (decl_die, origin);
- }
- else
- {
- add_name_and_src_coords_attributes (decl_die, decl);
- add_type_attribute (decl_die, TREE_TYPE (TREE_TYPE (decl)),
- 0, 0, context_die);
- }
- if (DECL_ABSTRACT (decl))
- {
- equate_decl_number_to_die (decl, decl_die);
- }
- else
- {
- add_AT_lbl_id (decl_die, DW_AT_low_pc, decl_start_label (decl));
- }
-}
-
-/* Remember a type in the pending_types_list. */
-
-static void
-pend_type (type)
- register tree type;
-{
- if (pending_types == pending_types_allocated)
- {
- pending_types_allocated += PENDING_TYPES_INCREMENT;
- pending_types_list
- = (tree *) xrealloc (pending_types_list,
- sizeof (tree) * pending_types_allocated);
- }
- pending_types_list[pending_types++] = type;
-}
-
-/* Output any pending types (from the pending_types list) which we can output
- now (taking into account the scope that we are working on now).
-
- For each type output, remove the given type from the pending_types_list
- *before* we try to output it. */
-
-static void
-output_pending_types_for_scope (context_die)
- register dw_die_ref context_die;
-{
- register tree type;
-
- while (pending_types)
- {
- --pending_types;
- type = pending_types_list[pending_types];
- gen_type_die (type, context_die);
- assert (TREE_ASM_WRITTEN (type));
- }
-}
-
-/* Generate a DIE to represent an inlined instance of an enumeration type. */
-static void
-gen_inlined_enumeration_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref type_die;
- type_die = new_die (DW_TAG_enumeration_type,
- scope_die_for (type, context_die));
- assert (TREE_ASM_WRITTEN (type));
- add_abstract_origin_attribute (type_die, type);
-}
-
-/* Generate a DIE to represent an inlined instance of a structure type. */
-static void
-gen_inlined_structure_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref type_die;
- type_die = new_die (DW_TAG_structure_type,
- scope_die_for (type, context_die));
- assert (TREE_ASM_WRITTEN (type));
- add_abstract_origin_attribute (type_die, type);
-}
-
-/* Generate a DIE to represent an inlined instance of a union type. */
-static void
-gen_inlined_union_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref type_die;
- type_die = new_die (DW_TAG_union_type,
- scope_die_for (type, context_die));
- assert (TREE_ASM_WRITTEN (type));
- add_abstract_origin_attribute (type_die, type);
-}
-
-/* Generate a DIE to represent an enumeration type. Note that these DIEs
- include all of the information about the enumeration values also. Each
- enumerated type name/value is listed as a child of the enumerated type
- DIE. */
-static void
-gen_enumeration_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref type_die = lookup_type_die (type);
-
- if (type_die == NULL)
- {
- type_die = new_die (DW_TAG_enumeration_type,
- scope_die_for (type, context_die));
- equate_type_number_to_die (type, type_die);
- add_name_attribute (type_die, type_tag (type));
- }
- else if (! TYPE_SIZE (type))
- return;
- else
- remove_AT (type_die, DW_AT_declaration);
-
- /* Handle a GNU C/C++ extension, i.e. incomplete enum types. If the
- given enum type is incomplete, do not generate the DW_AT_byte_size
- attribute or the DW_AT_element_list attribute. */
- if (TYPE_SIZE (type))
- {
- register tree link;
- TREE_ASM_WRITTEN (type) = 1;
- add_byte_size_attribute (type_die, type);
- if (type_tag (type))
- add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
- for (link = TYPE_FIELDS (type);
- link != NULL; link = TREE_CHAIN (link))
- {
- register dw_die_ref enum_die = new_die (DW_TAG_enumerator, type_die);
- add_name_attribute (enum_die,
- IDENTIFIER_POINTER (TREE_PURPOSE (link)));
- add_AT_unsigned (enum_die, DW_AT_const_value,
- (unsigned) TREE_INT_CST_LOW (TREE_VALUE (link)));
- }
- }
- else
- add_AT_flag (type_die, DW_AT_declaration, 1);
-}
-
-
-/* Generate a DIE to represent either a real live formal parameter decl or to
- represent just the type of some formal parameter position in some function
- type.
- Note that this routine is a bit unusual because its argument may be a
- ..._DECL node (i.e. either a PARM_DECL or perhaps a VAR_DECL which
- represents an inlining of some PARM_DECL) or else some sort of a ..._TYPE
- node. If it's the former then this function is being called to output a
- DIE to represent a formal parameter object (or some inlining thereof). If
- it's the latter, then this function is only being called to output a
- DW_TAG_formal_parameter DIE to stand as a placeholder for some formal
- argument type of some subprogram type. */
-static dw_die_ref
-gen_formal_parameter_die (node, context_die)
- register tree node;
- register dw_die_ref context_die;
-{
- register dw_die_ref parm_die = new_die (DW_TAG_formal_parameter,
- context_die);
- register tree origin;
- switch (TREE_CODE_CLASS (TREE_CODE (node)))
- {
- /* We were called with some kind of a ..._DECL node. */
- case 'd':
- origin = decl_ultimate_origin (node);
- if (origin != NULL)
- add_abstract_origin_attribute (parm_die, origin);
- else
- {
- add_name_and_src_coords_attributes (parm_die, node);
- add_type_attribute (parm_die, TREE_TYPE (node),
- TREE_READONLY (node),
- TREE_THIS_VOLATILE (node),
- context_die);
- if (DECL_ARTIFICIAL (node))
- add_AT_flag (parm_die, DW_AT_artificial, 1);
- }
- equate_decl_number_to_die (node, parm_die);
- if (! DECL_ABSTRACT (node))
- add_location_or_const_value_attribute (parm_die, node);
- break;
-
- /* We were called with some kind of a ..._TYPE node. */
- case 't':
- add_type_attribute (parm_die, node, 0, 0, context_die);
- break;
-
- /* Should never happen. */
- default:
- abort ();
- }
- return parm_die;
-}
-
-/* Generate a special type of DIE used as a stand-in for a trailing ellipsis
- at the end of an (ANSI prototyped) formal parameters list. */
-static void
-gen_unspecified_parameters_die (decl_or_type, context_die)
- register tree decl_or_type;
- register dw_die_ref context_die;
-{
- register dw_die_ref parm_die = new_die (DW_TAG_unspecified_parameters,
- context_die);
-}
-
-/* Generate a list of nameless DW_TAG_formal_parameter DIEs (and perhaps a
- DW_TAG_unspecified_parameters DIE) to represent the types of the formal
- parameters as specified in some function type specification (except for
- those which appear as part of a function *definition*).
- Note that we must be careful here to output all of the parameter DIEs before*
- we output any DIEs needed to represent the types of the formal parameters.
- This keeps svr4 SDB happy because it (incorrectly) thinks that the first
- non-parameter DIE it sees ends the formal parameter list. */
-static void
-gen_formal_types_die (function_or_method_type, context_die)
- register tree function_or_method_type;
- register dw_die_ref context_die;
-{
- register tree link;
- register tree formal_type = NULL;
- register tree first_parm_type = TYPE_ARG_TYPES (function_or_method_type);
-
-#if 0
- /* In the case where we are generating a formal types list for a C++
- non-static member function type, skip over the first thing on the
- TYPE_ARG_TYPES list because it only represents the type of the hidden
- `this pointer'. The debugger should be able to figure out (without
- being explicitly told) that this non-static member function type takes a
- `this pointer' and should be able to figure what the type of that hidden
- parameter is from the DW_AT_member attribute of the parent
- DW_TAG_subroutine_type DIE. */
- if (TREE_CODE (function_or_method_type) == METHOD_TYPE)
- first_parm_type = TREE_CHAIN (first_parm_type);
-#endif
-
- /* Make our first pass over the list of formal parameter types and output a
- DW_TAG_formal_parameter DIE for each one. */
- for (link = first_parm_type; link; link = TREE_CHAIN (link))
- {
- register dw_die_ref parm_die;
-
- formal_type = TREE_VALUE (link);
- if (formal_type == void_type_node)
- break;
-
- /* Output a (nameless) DIE to represent the formal parameter itself. */
- parm_die = gen_formal_parameter_die (formal_type, context_die);
- if (TREE_CODE (function_or_method_type) == METHOD_TYPE
- && link == first_parm_type)
- add_AT_flag (parm_die, DW_AT_artificial, 1);
- }
-
- /* If this function type has an ellipsis, add a
- DW_TAG_unspecified_parameters DIE to the end of the parameter list. */
- if (formal_type != void_type_node)
- gen_unspecified_parameters_die (function_or_method_type, context_die);
-
- /* Make our second (and final) pass over the list of formal parameter types
- and output DIEs to represent those types (as necessary). */
- for (link = TYPE_ARG_TYPES (function_or_method_type);
- link;
- link = TREE_CHAIN (link))
- {
- formal_type = TREE_VALUE (link);
- if (formal_type == void_type_node)
- break;
-
- gen_type_die (formal_type, context_die);
- }
-}
-
-/* Generate a DIE to represent a declared function (either file-scope or
- block-local). */
-static void
-gen_subprogram_die (decl, context_die)
- register tree decl;
- register dw_die_ref context_die;
-{
- char label_id[MAX_ARTIFICIAL_LABEL_BYTES];
- register tree origin = decl_ultimate_origin (decl);
- register dw_die_ref subr_die;
- register dw_loc_descr_ref fp_loc = NULL;
- register unsigned fp_reg;
- register tree fn_arg_types;
- register tree outer_scope;
- register dw_die_ref old_die = lookup_decl_die (decl);
- register int declaration = (current_function_decl != decl
- || context_die->die_tag == DW_TAG_structure_type
- || context_die->die_tag == DW_TAG_union_type);
-
- if (origin != NULL)
- {
- subr_die = new_die (DW_TAG_subprogram, context_die);
- add_abstract_origin_attribute (subr_die, origin);
- }
- else if (old_die)
- {
- register unsigned file_index
- = lookup_filename (DECL_SOURCE_FILE (decl));
-
- assert (get_AT_flag (old_die, DW_AT_declaration) == 1);
-
- /* If the definition comes from the same place as the declaration,
- maybe use the old DIE. We always want the DIE for this function
- that has the *_pc attributes to be under comp_unit_die so the
- debugger can find it. For inlines, that is the concrete instance,
- so we can use the old DIE here. For non-inline methods, we want a
- specification DIE at toplevel, so we need a new DIE. For local
- class methods, this does not apply. */
- if ((DECL_ABSTRACT (decl) || old_die->die_parent == comp_unit_die
- || context_die == NULL)
- && get_AT_unsigned (old_die, DW_AT_decl_file) == file_index
- && (get_AT_unsigned (old_die, DW_AT_decl_line)
- == DECL_SOURCE_LINE (decl)))
- {
- subr_die = old_die;
-
- /* Clear out the declaration attribute and the parm types. */
- remove_AT (subr_die, DW_AT_declaration);
- remove_children (subr_die);
- }
- else
- {
- subr_die = new_die (DW_TAG_subprogram, context_die);
- add_AT_die_ref (subr_die, DW_AT_specification, old_die);
- if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index)
- add_AT_unsigned (subr_die, DW_AT_decl_file, file_index);
- if (get_AT_unsigned (old_die, DW_AT_decl_line)
- != DECL_SOURCE_LINE (decl))
- add_AT_unsigned
- (subr_die, DW_AT_decl_line, DECL_SOURCE_LINE (decl));
- }
- }
- else
- {
- register dw_die_ref scope_die;
-
- if (DECL_CONTEXT (decl))
- scope_die = scope_die_for (decl, context_die);
- else
- /* Don't put block extern declarations under comp_unit_die. */
- scope_die = context_die;
-
- subr_die = new_die (DW_TAG_subprogram, scope_die);
-
- if (TREE_PUBLIC (decl))
- add_AT_flag (subr_die, DW_AT_external, 1);
- add_name_and_src_coords_attributes (subr_die, decl);
- if (debug_info_level > DINFO_LEVEL_TERSE)
- {
- register tree type = TREE_TYPE (decl);
- add_prototyped_attribute (subr_die, type);
- add_type_attribute (subr_die, TREE_TYPE (type), 0, 0, context_die);
- }
- add_pure_or_virtual_attribute (subr_die, decl);
- if (DECL_ARTIFICIAL (decl))
- add_AT_flag (subr_die, DW_AT_artificial, 1);
- if (TREE_PROTECTED (decl))
- add_AT_unsigned (subr_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
- add_AT_unsigned (subr_die, DW_AT_accessibility, DW_ACCESS_private);
- }
-
- if (declaration)
- {
- add_AT_flag (subr_die, DW_AT_declaration, 1);
-
- /* The first time we see a member function, it is in the context of
- the class to which it belongs. We make sure of this by emitting
- the class first. The next time is the definition, which is
- handled above. The two may come from the same source text. */
- if (decl_class_context (decl))
- equate_decl_number_to_die (decl, subr_die);
- }
- else if (DECL_ABSTRACT (decl))
- {
- if (DECL_DEFER_OUTPUT (decl))
- {
- if (DECL_INLINE (decl))
- add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_inlined);
- else
- add_AT_unsigned (subr_die, DW_AT_inline,
- DW_INL_declared_not_inlined);
- }
- else if (DECL_INLINE (decl))
- add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_inlined);
- else if (declaration)
- /* block extern declaration in an inline function. */
- add_AT_flag (subr_die, DW_AT_declaration, 1);
- else
- abort ();
-
- equate_decl_number_to_die (decl, subr_die);
- }
- else if (!DECL_EXTERNAL (decl))
- {
- if (origin == NULL)
- equate_decl_number_to_die (decl, subr_die);
- ASM_GENERATE_INTERNAL_LABEL (label_id, FUNC_BEGIN_LABEL,
- current_funcdef_number);
- add_AT_lbl_id (subr_die, DW_AT_low_pc, label_id);
- ASM_GENERATE_INTERNAL_LABEL (label_id, FUNC_END_LABEL,
- current_funcdef_number);
- add_AT_lbl_id (subr_die, DW_AT_high_pc, label_id);
-
- add_pubname (decl, subr_die);
- add_arange (decl, subr_die);
-
-#ifdef MIPS_DEBUGGING_INFO
- /* Add a reference to the FDE for this routine. */
- add_AT_fde_ref (subr_die, DW_AT_MIPS_fde, current_funcdef_fde);
-#endif
-
- /* Define the "frame base" location for this routine. We use the
- frame pointer or stack pointer registers, since the RTL for local
- variables is relative to one of them. */
- fp_reg = DBX_REGISTER_NUMBER (frame_pointer_needed
- ? FRAME_POINTER_REGNUM
- : STACK_POINTER_REGNUM);
- assert (fp_reg >= 0 && fp_reg <= 31);
- fp_loc = new_loc_descr (DW_OP_reg0 + fp_reg);
- add_AT_loc (subr_die, DW_AT_frame_base, fp_loc);
-
- if (current_function_needs_context)
- add_AT_loc (subr_die, DW_AT_static_link,
- loc_descriptor (lookup_static_chain (decl)));
- }
-
- /* Now output descriptions of the arguments for this function. This gets
- (unnecessarily?) complex because of the fact that the DECL_ARGUMENT list
- for a FUNCTION_DECL doesn't indicate cases where there was a trailing
- `...' at the end of the formal parameter list. In order to find out if
- there was a trailing ellipsis or not, we must instead look at the type
- associated with the FUNCTION_DECL. This will be a node of type
- FUNCTION_TYPE. If the chain of type nodes hanging off of this
- FUNCTION_TYPE node ends with a void_type_node then there should *not* be
- an ellipsis at the end. */
-
- push_decl_scope (decl);
- /* In the case where we are describing a mere function declaration, all we
- need to do here (and all we *can* do here) is to describe the *types* of
- its formal parameters. */
- if (debug_info_level <= DINFO_LEVEL_TERSE)
- /* do nothing */;
- else if (declaration)
- gen_formal_types_die (TREE_TYPE (decl), subr_die);
- else
- {
- /* Generate DIEs to represent all known formal parameters */
- register tree arg_decls = DECL_ARGUMENTS (decl);
- register tree parm;
-
- /* When generating DIEs, generate the unspecified_parameters DIE
- instead if we come across the arg "__builtin_va_alist" */
- for (parm = arg_decls; parm; parm = TREE_CHAIN (parm))
- {
- if (TREE_CODE (parm) == PARM_DECL)
- {
- if (DECL_NAME (parm) &&
- !strcmp (IDENTIFIER_POINTER (DECL_NAME (parm)),
- "__builtin_va_alist"))
- {
- gen_unspecified_parameters_die (parm, subr_die);
- }
- else
- {
- gen_decl_die (parm, subr_die);
- }
- }
- }
-
- /* Decide whether we need a unspecified_parameters DIE at the end.
- There are 2 more cases to do this for: 1) the ansi ... declaration -
- this is detectable when the end of the arg list is not a
- void_type_node 2) an unprototyped function declaration (not a
- definition). This just means that we have no info about the
- parameters at all. */
- fn_arg_types = TYPE_ARG_TYPES (TREE_TYPE (decl));
- if (fn_arg_types)
- {
- /* this is the prototyped case, check for ... */
- if (TREE_VALUE (tree_last (fn_arg_types)) != void_type_node)
- {
- gen_unspecified_parameters_die (decl, subr_die);
- }
- }
- else
- {
- /* this is unprotoyped, check for undefined (just declaration) */
- if (!DECL_INITIAL (decl))
- {
- gen_unspecified_parameters_die (decl, subr_die);
- }
- }
- }
-
- /* Output Dwarf info for all of the stuff within the body of the function
- (if it has one - it may be just a declaration). */
- outer_scope = DECL_INITIAL (decl);
-
- /* Note that here, `outer_scope' is a pointer to the outermost BLOCK
- node created to represent a function. This outermost BLOCK actually
- represents the outermost binding contour for the function, i.e. the
- contour in which the function's formal parameters and labels get
- declared. Curiously, it appears that the front end doesn't actually
- put the PARM_DECL nodes for the current function onto the BLOCK_VARS
- list for this outer scope. (They are strung off of the DECL_ARGUMENTS
- list for the function instead.) The BLOCK_VARS list for the
- `outer_scope' does provide us with a list of the LABEL_DECL nodes for
- the function however, and we output DWARF info for those in
- decls_for_scope. Just within the `outer_scope' there will be a BLOCK
- node representing the function's outermost pair of curly braces, and
- any blocks used for the base and member initializers of a C++
- constructor function. */
- if (! declaration && TREE_CODE (outer_scope) != ERROR_MARK)
- {
- current_function_has_inlines = 0;
- decls_for_scope (outer_scope, subr_die, 0);
-#if 0 && defined (MIPS_DEBUGGING_INFO)
- if (current_function_has_inlines)
- {
- add_AT_flag (subr_die, DW_AT_MIPS_has_inlines, 1);
- if (! comp_unit_has_inlines)
- {
- add_AT_flag (comp_unit_die, DW_AT_MIPS_has_inlines, 1);
- comp_unit_has_inlines = 1;
- }
- }
-#endif
- }
- pop_decl_scope ();
-}
-
-/* Generate a DIE to represent a declared data object. */
-static void
-gen_variable_die (decl, context_die)
- register tree decl;
- register dw_die_ref context_die;
-{
- register tree origin = decl_ultimate_origin (decl);
- register dw_die_ref var_die = new_die (DW_TAG_variable, context_die);
- dw_die_ref old_die = lookup_decl_die (decl);
- int declaration
- = (DECL_EXTERNAL (decl)
- || current_function_decl != decl_function_context (decl)
- || context_die->die_tag == DW_TAG_structure_type
- || context_die->die_tag == DW_TAG_union_type);
-
- if (origin != NULL)
- {
- add_abstract_origin_attribute (var_die, origin);
- }
- else if (old_die && TREE_STATIC (decl))
- {
- assert (get_AT_flag (old_die, DW_AT_declaration) == 1);
- add_AT_die_ref (var_die, DW_AT_specification, old_die);
- if (DECL_NAME (decl))
- {
- register unsigned file_index
- = lookup_filename (DECL_SOURCE_FILE (decl));
- if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index)
- add_AT_unsigned (var_die, DW_AT_decl_file, file_index);
- if (get_AT_unsigned (old_die, DW_AT_decl_line)
- != DECL_SOURCE_LINE (decl))
- add_AT_unsigned
- (var_die, DW_AT_decl_line, DECL_SOURCE_LINE (decl));
- }
- }
- else
- {
- add_name_and_src_coords_attributes (var_die, decl);
- add_type_attribute (var_die, TREE_TYPE (decl),
- TREE_READONLY (decl),
- TREE_THIS_VOLATILE (decl), context_die);
- if (TREE_PUBLIC (decl))
- add_AT_flag (var_die, DW_AT_external, 1);
- if (DECL_ARTIFICIAL (decl))
- add_AT_flag (var_die, DW_AT_artificial, 1);
- if (TREE_PROTECTED (decl))
- add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
- add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_private);
- }
-
- if (declaration)
- add_AT_flag (var_die, DW_AT_declaration, 1);
-
- if ((declaration && decl_class_context (decl)) || DECL_ABSTRACT (decl))
- equate_decl_number_to_die (decl, var_die);
-
- if (! declaration && ! DECL_ABSTRACT (decl))
- {
- equate_decl_number_to_die (decl, var_die);
- add_location_or_const_value_attribute (var_die, decl);
- add_pubname (decl, var_die);
- }
-}
-
-/* Generate a DIE to represent a label identifier. */
-static void
-gen_label_die (decl, context_die)
- register tree decl;
- register dw_die_ref context_die;
-{
- register tree origin = decl_ultimate_origin (decl);
- register dw_die_ref lbl_die = new_die (DW_TAG_label, context_die);
- register rtx insn;
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
- char label2[MAX_ARTIFICIAL_LABEL_BYTES];
- if (origin != NULL)
- {
- add_abstract_origin_attribute (lbl_die, origin);
- }
- else
- {
- add_name_and_src_coords_attributes (lbl_die, decl);
- }
- if (DECL_ABSTRACT (decl))
- {
- equate_decl_number_to_die (decl, lbl_die);
- }
- else
- {
- insn = DECL_RTL (decl);
- if (GET_CODE (insn) == CODE_LABEL)
- {
- /* When optimization is enabled (via -O) some parts of the compiler
- (e.g. jump.c and cse.c) may try to delete CODE_LABEL insns which
- represent source-level labels which were explicitly declared by
- the user. This really shouldn't be happening though, so catch
- it if it ever does happen. */
- if (INSN_DELETED_P (insn))
- {
- abort (); /* Should never happen. */
- }
- sprintf (label2, INSN_LABEL_FMT, current_funcdef_number);
- ASM_GENERATE_INTERNAL_LABEL (label, label2,
- (unsigned) INSN_UID (insn));
- add_AT_lbl_id (lbl_die, DW_AT_low_pc, label);
- }
- }
-}
-
-/* Generate a DIE for a lexical block. */
-static void
-gen_lexical_block_die (stmt, context_die, depth)
- register tree stmt;
- register dw_die_ref context_die;
- int depth;
-{
- register dw_die_ref stmt_die = new_die (DW_TAG_lexical_block, context_die);
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
- if (!BLOCK_ABSTRACT (stmt))
- {
- ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
- next_block_number);
- add_AT_lbl_id (stmt_die, DW_AT_low_pc, label);
- ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL, next_block_number);
- add_AT_lbl_id (stmt_die, DW_AT_high_pc, label);
- }
- push_decl_scope (stmt);
- decls_for_scope (stmt, stmt_die, depth);
- pop_decl_scope ();
-}
-
-/* Generate a DIE for an inlined subprogram. */
-static void
-gen_inlined_subroutine_die (stmt, context_die, depth)
- register tree stmt;
- register dw_die_ref context_die;
- int depth;
-{
- if (!BLOCK_ABSTRACT (stmt))
- {
- register dw_die_ref subr_die = new_die (DW_TAG_inlined_subroutine,
- context_die);
- register tree decl = block_ultimate_origin (stmt);
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
- add_abstract_origin_attribute (subr_die, decl);
- ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
- next_block_number);
- add_AT_lbl_id (subr_die, DW_AT_low_pc, label);
- ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_END_LABEL, next_block_number);
- add_AT_lbl_id (subr_die, DW_AT_high_pc, label);
- push_decl_scope (decl);
- decls_for_scope (stmt, subr_die, depth);
- pop_decl_scope ();
- current_function_has_inlines = 1;
- }
-}
-
-/* Generate a DIE for a field in a record, or structure. */
-static void
-gen_field_die (decl, context_die)
- register tree decl;
- register dw_die_ref context_die;
-{
- register dw_die_ref decl_die = new_die (DW_TAG_member, context_die);
- add_name_and_src_coords_attributes (decl_die, decl);
- add_type_attribute (decl_die, member_declared_type (decl),
- TREE_READONLY (decl), TREE_THIS_VOLATILE (decl),
- context_die);
- /* If this is a bit field... */
- if (DECL_BIT_FIELD_TYPE (decl))
- {
- add_byte_size_attribute (decl_die, decl);
- add_bit_size_attribute (decl_die, decl);
- add_bit_offset_attribute (decl_die, decl);
- }
- if (TREE_CODE (DECL_FIELD_CONTEXT (decl)) != UNION_TYPE)
- add_data_member_location_attribute (decl_die, decl);
- if (DECL_ARTIFICIAL (decl))
- add_AT_flag (decl_die, DW_AT_artificial, 1);
- if (TREE_PROTECTED (decl))
- add_AT_unsigned (decl_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
- add_AT_unsigned (decl_die, DW_AT_accessibility, DW_ACCESS_private);
-}
-
-#if 0
-/* Don't generate either pointer_type DIEs or reference_type DIEs here.
- Use modified_type_die instead.
- We keep this code here just in case these types of DIEs may be needed to
- represent certain things in other languages (e.g. Pascal) someday. */
-static void
-gen_pointer_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref ptr_die = new_die
- (DW_TAG_pointer_type, scope_die_for (type, context_die));
- equate_type_number_to_die (type, ptr_die);
- add_type_attribute (ptr_die, TREE_TYPE (type), 0, 0, context_die);
- add_AT_unsigned (mod_type_die, DW_AT_byte_size, PTR_SIZE);
-}
-
-/* Don't generate either pointer_type DIEs or reference_type DIEs here.
- Use modified_type_die instead.
- We keep this code here just in case these types of DIEs may be needed to
- represent certain things in other languages (e.g. Pascal) someday. */
-static void
-gen_reference_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref ref_die = new_die
- (DW_TAG_reference_type, scope_die_for (type, context_die));
- equate_type_number_to_die (type, ref_die);
- add_type_attribute (ref_die, TREE_TYPE (type), 0, 0, context_die);
- add_AT_unsigned (mod_type_die, DW_AT_byte_size, PTR_SIZE);
-}
-#endif
-
-/* Generate a DIE for a pointer to a member type. */
-static void
-gen_ptr_to_mbr_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref ptr_die = new_die
- (DW_TAG_ptr_to_member_type, scope_die_for (type, context_die));
- equate_type_number_to_die (type, ptr_die);
- add_AT_die_ref (ptr_die, DW_AT_containing_type,
- lookup_type_die (TYPE_OFFSET_BASETYPE (type)));
- add_type_attribute (ptr_die, TREE_TYPE (type), 0, 0, context_die);
-}
-
-/* Generate the DIE for the compilation unit. */
-static void
-gen_compile_unit_die (main_input_filename)
- register char *main_input_filename;
-{
- char producer[250];
- char *wd = getpwd ();
-
- comp_unit_die = new_die (DW_TAG_compile_unit, NULL);
-
- add_name_attribute (comp_unit_die, main_input_filename);
-
- if (wd)
- {
- add_AT_string (comp_unit_die, DW_AT_comp_dir, wd);
- }
-
- sprintf (producer, "%s %s", language_string, version_string);
-
-#ifdef MIPS_DEBUGGING_INFO
- /* The MIPS/SGI compilers place the 'cc' command line options in the producer
- string. The SGI debugger looks for -g, -g1, -g2, or -g3; if they do
- not appear in the producer string, the debugger reaches the conclusion
- that the object file is stripped and has no debugging information.
- To get the MIPS/SGI debugger to believe that there is debugging
- information in the object file, we add a -g to the producer string. */
- if (debug_info_level > DINFO_LEVEL_TERSE)
- strcat (producer, " -g");
-#endif
-
- add_AT_string (comp_unit_die, DW_AT_producer, producer);
-
- if (strcmp (language_string, "GNU C++") == 0)
- add_AT_unsigned (comp_unit_die, DW_AT_language, DW_LANG_C_plus_plus);
- else if (strcmp (language_string, "GNU Ada") == 0)
- add_AT_unsigned (comp_unit_die, DW_AT_language, DW_LANG_Ada83);
- else if (strcmp (language_string, "GNU F77") == 0)
- add_AT_unsigned (comp_unit_die, DW_AT_language, DW_LANG_Fortran77);
- else if (flag_traditional)
- add_AT_unsigned (comp_unit_die, DW_AT_language, DW_LANG_C);
- else
- add_AT_unsigned (comp_unit_die, DW_AT_language, DW_LANG_C89);
-
-#if 0 /* unimplemented */
- if (debug_info_level >= DINFO_LEVEL_VERBOSE)
- add_AT_unsigned (comp_unit_die, DW_AT_macro_info, 0);
-#endif
-}
-
-/* Generate a DIE for a string type. */
-static void
-gen_string_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref type_die = new_die
- (DW_TAG_string_type, scope_die_for (type, context_die));
- equate_type_number_to_die (type, type_die);
-
- /* Fudge the string length attribute for now. */
-
- /* TODO: add string length info.
- string_length_attribute (TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
- bound_representation (upper_bound, 0, 'u'); */
-}
-
-/* Generate the DIE for a base class. */
-static void
-gen_inheritance_die (binfo, context_die)
- register tree binfo;
- register dw_die_ref context_die;
-{
- dw_die_ref die = new_die (DW_TAG_inheritance, context_die);
- add_type_attribute (die, BINFO_TYPE (binfo), 0, 0, context_die);
- add_data_member_location_attribute (die, binfo);
- if (TREE_VIA_VIRTUAL (binfo))
- add_AT_unsigned (die, DW_AT_virtuality, DW_VIRTUALITY_virtual);
- if (TREE_VIA_PUBLIC (binfo))
- add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_public);
- else if (TREE_VIA_PROTECTED (binfo))
- add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_protected);
-}
-
-/* Genearate a DIE for a class member. */
-static void
-gen_member_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register tree member;
- /* If this is not an incomplete type, output descriptions of each of its
- members. Note that as we output the DIEs necessary to represent the
- members of this record or union type, we will also be trying to output
- DIEs to represent the *types* of those members. However the `type'
- function (above) will specifically avoid generating type DIEs for member
- types *within* the list of member DIEs for this (containing) type execpt
- for those types (of members) which are explicitly marked as also being
- members of this (containing) type themselves. The g++ front- end can
- force any given type to be treated as a member of some other
- (containing) type by setting the TYPE_CONTEXT of the given (member) type
- to point to the TREE node representing the appropriate (containing)
- type. */
-
- /* First output info about the base classes. */
- if (TYPE_BINFO (type) && TYPE_BINFO_BASETYPES (type))
- {
- register tree bases = TYPE_BINFO_BASETYPES (type);
- register int n_bases = TREE_VEC_LENGTH (bases);
- register int i;
-
- for (i = 0; i < n_bases; i++)
- gen_inheritance_die (TREE_VEC_ELT (bases, i), context_die);
- }
-
- /* Now output info about the data members and type members. */
- for (member = TYPE_FIELDS (type); member; member = TREE_CHAIN (member))
- gen_decl_die (member, context_die);
-
- /* Now output info about the function members (if any). */
- for (member = TYPE_METHODS (type); member; member = TREE_CHAIN (member))
- gen_decl_die (member, context_die);
-}
-
-/* Generate a DIE for a structure or union type. */
-static void
-gen_struct_or_union_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register dw_die_ref type_die = lookup_type_die (type);
- register dw_die_ref scope_die = 0;
- register int nested = 0;
-
- if (type_die && ! TYPE_SIZE (type))
- return;
-
- if (TYPE_CONTEXT (type)
- && TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't')
- nested = 1;
-
- scope_die = scope_die_for (type, context_die);
-
- if (! type_die || (nested && scope_die == comp_unit_die))
- /* First occurrence of type or toplevel definition of nested class. */
- {
- register dw_die_ref old_die = type_die;
- type_die = new_die (TREE_CODE (type) == RECORD_TYPE
- ? DW_TAG_structure_type : DW_TAG_union_type,
- scope_die);
- equate_type_number_to_die (type, type_die);
- add_name_attribute (type_die, type_tag (type));
- if (old_die)
- add_AT_die_ref (type_die, DW_AT_specification, old_die);
- }
- else
- remove_AT (type_die, DW_AT_declaration);
-
- /* If we're not in the right context to be defining this type, defer to
- avoid tricky recursion. */
- if (TYPE_SIZE (type) && decl_scope_depth > 0 && scope_die == comp_unit_die)
- {
- add_AT_flag (type_die, DW_AT_declaration, 1);
- pend_type (type);
- }
- /* If this type has been completed, then give it a byte_size attribute and
- then give a list of members. */
- else if (TYPE_SIZE (type))
- {
- /* Prevent infinite recursion in cases where the type of some member of
- this type is expressed in terms of this type itself. */
- TREE_ASM_WRITTEN (type) = 1;
- add_byte_size_attribute (type_die, type);
- if (type_tag (type))
- add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
- push_decl_scope (type);
- gen_member_die (type, type_die);
- pop_decl_scope ();
- /* GNU extension: Record what type our vtable lives in. */
- if (TYPE_VFIELD (type))
- {
- tree vtype = DECL_FCONTEXT (TYPE_VFIELD (type));
- gen_type_die (vtype, context_die);
- add_AT_die_ref (type_die, DW_AT_containing_type,
- lookup_type_die (vtype));
- }
- }
- else
- add_AT_flag (type_die, DW_AT_declaration, 1);
-}
-
-/* Generate a DIE for a subroutine _type_. */
-static void
-gen_subroutine_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- register tree return_type = TREE_TYPE (type);
- register dw_die_ref subr_die = new_die
- (DW_TAG_subroutine_type, scope_die_for (type, context_die));
- equate_type_number_to_die (type, subr_die);
- add_prototyped_attribute (subr_die, type);
- add_type_attribute (subr_die, return_type, 0, 0, context_die);
- gen_formal_types_die (type, subr_die);
-}
-
-/* Generate a DIE for a type definition */
-static void
-gen_typedef_die (decl, context_die)
- register tree decl;
- register dw_die_ref context_die;
-{
- register dw_die_ref type_die;
- register tree origin;
-
- if (TREE_ASM_WRITTEN (decl))
- return;
- TREE_ASM_WRITTEN (decl) = 1;
-
- type_die = new_die (DW_TAG_typedef, scope_die_for (decl, context_die));
- origin = decl_ultimate_origin (decl);
- if (origin != NULL)
- add_abstract_origin_attribute (type_die, origin);
- else
- {
- register tree type;
- add_name_and_src_coords_attributes (type_die, decl);
- if (DECL_ORIGINAL_TYPE (decl))
- {
- type = DECL_ORIGINAL_TYPE (decl);
- equate_type_number_to_die (TREE_TYPE (decl), type_die);
- }
- else
- type = TREE_TYPE (decl);
- add_type_attribute (type_die, type, TREE_READONLY (decl),
- TREE_THIS_VOLATILE (decl), context_die);
- }
- if (DECL_ABSTRACT (decl))
- equate_decl_number_to_die (decl, type_die);
-}
-
-/* Generate a type description DIE. */
-static void
-gen_type_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- if (type == 0 || type == error_mark_node)
- {
- return;
- }
-
- /* We are going to output a DIE to represent the unqualified version of of
- this type (i.e. without any const or volatile qualifiers) so get the
- main variant (i.e. the unqualified version) of this type now. */
- type = type_main_variant (type);
-
- if (TREE_ASM_WRITTEN (type))
- {
- return;
- }
-
- if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
- {
- TREE_ASM_WRITTEN (type) = 1;
- gen_decl_die (TYPE_NAME (type), context_die);
- return;
- }
-
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- break;
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- /* For these types, all that is required is that we output a DIE (or a
- set of DIEs) to represent the "basis" type. */
- gen_type_die (TREE_TYPE (type), context_die);
- break;
-
- case OFFSET_TYPE:
- /* This code is used for C++ pointer-to-data-member types. */
- /* Output a description of the relevant class type. */
- gen_type_die (TYPE_OFFSET_BASETYPE (type), context_die);
- /* Output a description of the type of the object pointed to. */
- gen_type_die (TREE_TYPE (type), context_die);
- /* Now output a DIE to represent this pointer-to-data-member type
- itself. */
- gen_ptr_to_mbr_type_die (type, context_die);
- break;
-
- case SET_TYPE:
- gen_type_die (TYPE_DOMAIN (type), context_die);
- gen_set_type_die (type, context_die);
- break;
-
- case FILE_TYPE:
- gen_type_die (TREE_TYPE (type), context_die);
- abort (); /* No way to represent these in Dwarf yet! */
- break;
-
- case FUNCTION_TYPE:
- /* Force out return type (in case it wasn't forced out already). */
- gen_type_die (TREE_TYPE (type), context_die);
- gen_subroutine_type_die (type, context_die);
- break;
-
- case METHOD_TYPE:
- /* Force out return type (in case it wasn't forced out already). */
- gen_type_die (TREE_TYPE (type), context_die);
- gen_subroutine_type_die (type, context_die);
- break;
-
- case ARRAY_TYPE:
- if (TYPE_STRING_FLAG (type) && TREE_CODE (TREE_TYPE (type)) == CHAR_TYPE)
- {
- gen_type_die (TREE_TYPE (type), context_die);
- gen_string_type_die (type, context_die);
- }
- else
- {
- gen_array_type_die (type, context_die);
- }
- break;
-
- case ENUMERAL_TYPE:
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- /* If this is a nested type whose containing class hasn't been
- written out yet, writing it out will cover this one, too. */
- if (TYPE_CONTEXT (type)
- && TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't'
- && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
- {
- gen_type_die (TYPE_CONTEXT (type), context_die);
-
- if (TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
- return;
-
- /* If that failed, attach ourselves to the stub. */
- push_decl_scope (TYPE_CONTEXT (type));
- context_die = lookup_type_die (TYPE_CONTEXT (type));
- }
-
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- gen_enumeration_type_die (type, context_die);
- else
- gen_struct_or_union_type_die (type, context_die);
-
- if (TYPE_CONTEXT (type)
- && TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't'
- && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
- pop_decl_scope ();
-
- /* Don't set TREE_ASM_WRITTEN on an incomplete struct; we want to fix
- it up if it is ever completed. gen_*_type_die will set it for us
- when appropriate. */
- return;
-
- case VOID_TYPE:
- case INTEGER_TYPE:
- case REAL_TYPE:
- case COMPLEX_TYPE:
- case BOOLEAN_TYPE:
- case CHAR_TYPE:
- /* No DIEs needed for fundamental types. */
- break;
-
- case LANG_TYPE:
- /* No Dwarf representation currently defined. */
- break;
-
- default:
- abort ();
- }
-
- TREE_ASM_WRITTEN (type) = 1;
-}
-
-/* Generate a DIE for a tagged type instantiation. */
-static void
-gen_tagged_type_instantiation_die (type, context_die)
- register tree type;
- register dw_die_ref context_die;
-{
- if (type == 0 || type == error_mark_node)
- {
- return;
- }
-
- /* We are going to output a DIE to represent the unqualified version of of
- this type (i.e. without any const or volatile qualifiers) so make sure
- that we have the main variant (i.e. the unqualified version) of this
- type now. */
- assert (type == type_main_variant (type));
- assert (TREE_ASM_WRITTEN (type));
-
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- break;
-
- case ENUMERAL_TYPE:
- gen_inlined_enumeration_type_die (type, context_die);
- break;
-
- case RECORD_TYPE:
- gen_inlined_structure_type_die (type, context_die);
- break;
-
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- gen_inlined_union_type_die (type, context_die);
- break;
-
- default:
- abort (); /* Should never happen. */
- }
-}
-
-/* Generate a DW_TAG_lexical_block DIE followed by DIEs to represent all of the
- things which are local to the given block. */
-static void
-gen_block_die (stmt, context_die, depth)
- register tree stmt;
- register dw_die_ref context_die;
- int depth;
-{
- register int must_output_die = 0;
- register tree origin;
- register tree decl;
- register enum tree_code origin_code;
-
- /* Ignore blocks never really used to make RTL. */
-
- if (!stmt || !TREE_USED (stmt))
- {
- return;
- }
-
- /* Determine the "ultimate origin" of this block. This block may be an
- inlined instance of an inlined instance of inline function, so we have
- to trace all of the way back through the origin chain to find out what
- sort of node actually served as the original seed for the creation of
- the current block. */
- origin = block_ultimate_origin (stmt);
- origin_code = (origin != NULL) ? TREE_CODE (origin) : ERROR_MARK;
-
- /* Determine if we need to output any Dwarf DIEs at all to represent this
- block. */
- if (origin_code == FUNCTION_DECL)
- {
- /* The outer scopes for inlinings *must* always be represented. We
- generate DW_TAG_inlined_subroutine DIEs for them. (See below.) */
- must_output_die = 1;
- }
- else
- {
- /* In the case where the current block represents an inlining of the
- "body block" of an inline function, we must *NOT* output any DIE for
- this block because we have already output a DIE to represent the
- whole inlined function scope and the "body block" of any function
- doesn't really represent a different scope according to ANSI C
- rules. So we check here to make sure that this block does not
- represent a "body block inlining" before trying to set the
- `must_output_die' flag. */
- if (! is_body_block (origin ? origin : stmt))
- {
- /* Determine if this block directly contains any "significant"
- local declarations which we will need to output DIEs for. */
- if (debug_info_level > DINFO_LEVEL_TERSE)
- {
- /* We are not in terse mode so *any* local declaration counts
- as being a "significant" one. */
- must_output_die = (BLOCK_VARS (stmt) != NULL);
- }
- else
- {
- /* We are in terse mode, so only local (nested) function
- definitions count as "significant" local declarations. */
- for (decl = BLOCK_VARS (stmt);
- decl != NULL; decl = TREE_CHAIN (decl))
- {
- if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_INITIAL (decl))
- {
- must_output_die = 1;
- break;
- }
- }
- }
- }
- }
-
- /* It would be a waste of space to generate a Dwarf DW_TAG_lexical_block
- DIE for any block which contains no significant local declarations at
- all. Rather, in such cases we just call `decls_for_scope' so that any
- needed Dwarf info for any sub-blocks will get properly generated. Note
- that in terse mode, our definition of what constitutes a "significant"
- local declaration gets restricted to include only inlined function
- instances and local (nested) function definitions. */
- if (must_output_die)
- {
- if (origin_code == FUNCTION_DECL)
- {
- gen_inlined_subroutine_die (stmt, context_die, depth);
- }
- else
- {
- gen_lexical_block_die (stmt, context_die, depth);
- }
- }
- else
- decls_for_scope (stmt, context_die, depth);
-}
-
-/* Generate all of the decls declared within a given scope and (recursively)
- all of it's sub-blocks. */
-static void
-decls_for_scope (stmt, context_die, depth)
- register tree stmt;
- register dw_die_ref context_die;
- int depth;
-{
- register tree decl;
- register tree subblocks;
- /* Ignore blocks never really used to make RTL. */
- if (!stmt || !TREE_USED (stmt))
- {
- return;
- }
- if (!BLOCK_ABSTRACT (stmt) && depth > 0)
- {
- next_block_number++;
- }
-
- /* Output the DIEs to represent all of the data objects and typedefs
- declared directly within this block but not within any nested
- sub-blocks. Also, nested function and tag DIEs have been
- generated with a parent of NULL; fix that up now. */
- for (decl = BLOCK_VARS (stmt);
- decl != NULL; decl = TREE_CHAIN (decl))
- {
- register dw_die_ref die;
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- die = lookup_decl_die (decl);
- else if (TREE_CODE (decl) == TYPE_DECL && TYPE_DECL_IS_STUB (decl))
- die = lookup_type_die (TREE_TYPE (decl));
- else
- die = NULL;
-
- if (die && die->die_parent == NULL)
- {
- add_child_die (context_die, die);
- --limbo_die_count;
- }
- else
- gen_decl_die (decl, context_die);
- }
-
- /* Output the DIEs to represent all sub-blocks (and the items declared
- therein) of this block. */
- for (subblocks = BLOCK_SUBBLOCKS (stmt);
- subblocks != NULL;
- subblocks = BLOCK_CHAIN (subblocks))
- {
- gen_block_die (subblocks, context_die, depth + 1);
- }
-}
-
-/* Is this a typedef we can avoid emitting? */
-inline int
-is_redundant_typedef (decl)
- register tree decl;
-{
- if (TYPE_DECL_IS_STUB (decl))
- return 1;
- if (DECL_ARTIFICIAL (decl)
- && DECL_CONTEXT (decl)
- && is_tagged_type (DECL_CONTEXT (decl))
- && TREE_CODE (TYPE_NAME (DECL_CONTEXT (decl))) == TYPE_DECL
- && DECL_NAME (decl) == DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))))
- /* Also ignore the artificial member typedef for the class name. */
- return 1;
- return 0;
-}
-
-/* Generate Dwarf debug information for a decl described by DECL. */
-static void
-gen_decl_die (decl, context_die)
- register tree decl;
- register dw_die_ref context_die;
-{
- register tree origin;
- /* Make a note of the decl node we are going to be working on. We may need
- to give the user the source coordinates of where it appeared in case we
- notice (later on) that something about it looks screwy. */
- dwarf_last_decl = decl;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- {
- return;
- }
-
- /* If this ..._DECL node is marked to be ignored, then ignore it. But don't
- ignore a function definition, since that would screw up our count of
- blocks, and that it turn will completely screw up the the labels we will
- reference in subsequent DW_AT_low_pc and DW_AT_high_pc attributes (for
- subsequent blocks). */
- if (DECL_IGNORED_P (decl) && TREE_CODE (decl) != FUNCTION_DECL)
- {
- return;
- }
-
- switch (TREE_CODE (decl))
- {
- case CONST_DECL:
- /* The individual enumerators of an enum type get output when we output
- the Dwarf representation of the relevant enum type itself. */
- break;
-
- case FUNCTION_DECL:
- /* Don't output any DIEs to represent mere function declarations,
- unless they are class members or explicit block externs. */
- if (DECL_INITIAL (decl) == NULL_TREE && DECL_CONTEXT (decl) == NULL_TREE
- && (current_function_decl == NULL_TREE || ! DECL_ARTIFICIAL (decl)))
- {
- break;
- }
-
- if (debug_info_level > DINFO_LEVEL_TERSE)
- {
- /* Before we describe the FUNCTION_DECL itself, make sure that we
- have described its return type. */
- gen_type_die (TREE_TYPE (TREE_TYPE (decl)), context_die);
-
- /* And its containing type. */
- origin = decl_class_context (decl);
- if (origin)
- gen_type_die (origin, context_die);
-
- /* And its virtual context. */
- if (DECL_VINDEX (decl))
- gen_type_die (DECL_CONTEXT (decl), context_die);
- }
-
- /* Now output a DIE to represent the function itself. */
- gen_subprogram_die (decl, context_die);
- break;
-
- case TYPE_DECL:
- /* If we are in terse mode, don't generate any DIEs to represent any
- actual typedefs. */
- if (debug_info_level <= DINFO_LEVEL_TERSE)
- break;
-
- /* In the special case of a TYPE_DECL node representing the
- declaration of some type tag, if the given TYPE_DECL is marked as
- having been instantiated from some other (original) TYPE_DECL node
- (e.g. one which was generated within the original definition of an
- inline function) we have to generate a special (abbreviated)
- DW_TAG_structure_type, DW_TAG_union_type, or DW_TAG_enumeration-type
- DIE here. */
- if (TYPE_DECL_IS_STUB (decl) && DECL_ABSTRACT_ORIGIN (decl))
- {
- gen_tagged_type_instantiation_die (TREE_TYPE (decl), context_die);
- break;
- }
-
- if (is_redundant_typedef (decl))
- gen_type_die (TREE_TYPE (decl), context_die);
- else
- {
- /* Output a DIE to represent the typedef itself. */
- gen_typedef_die (decl, context_die);
- }
- break;
-
- case LABEL_DECL:
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- {
- gen_label_die (decl, context_die);
- }
- break;
-
- case VAR_DECL:
- /* If we are in terse mode, don't generate any DIEs to represent any
- variable declarations or definitions. */
- if (debug_info_level <= DINFO_LEVEL_TERSE)
- {
- break;
- }
-
- /* Output any DIEs that are needed to specify the type of this data
- object. */
- gen_type_die (TREE_TYPE (decl), context_die);
-
- /* And its containing type. */
- origin = decl_class_context (decl);
- if (origin)
- gen_type_die (origin, context_die);
-
- /* Now output the DIE to represent the data object itself. This gets
- complicated because of the possibility that the VAR_DECL really
- represents an inlined instance of a formal parameter for an inline
- function. */
- origin = decl_ultimate_origin (decl);
- if (origin != NULL && TREE_CODE (origin) == PARM_DECL)
- {
- gen_formal_parameter_die (decl, context_die);
- }
- else
- {
- gen_variable_die (decl, context_die);
- }
- break;
-
- case FIELD_DECL:
- /* Ignore the nameless fields that are used to skip bits, but
- handle C++ anonymous unions. */
- if (DECL_NAME (decl) != 0 || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE)
- {
- gen_type_die (member_declared_type (decl), context_die);
- gen_field_die (decl, context_die);
- }
- break;
-
- case PARM_DECL:
- gen_type_die (TREE_TYPE (decl), context_die);
- gen_formal_parameter_die (decl, context_die);
- break;
-
- default:
- abort ();
- }
-}
-
-/***************** Debug Information Generation Hooks ***********************/
-void
-dwarf2out_decl (decl)
- register tree decl;
-{
- register dw_die_ref context_die = comp_unit_die;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- {
- return;
- }
-
- /* If this ..._DECL node is marked to be ignored, then ignore it. We gotta
- hope that the node in question doesn't represent a function definition.
- If it does, then totally ignoring it is bound to screw up our count of
- blocks, and that it turn will completely screw up the the labels we will
- reference in subsequent DW_AT_low_pc and DW_AT_high_pc attributes (for
- subsequent blocks). (It's too bad that BLOCK nodes don't carry their
- own sequence numbers with them!) */
- if (DECL_IGNORED_P (decl))
- {
- if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_INITIAL (decl) != NULL)
- {
- abort ();
- }
- return;
- }
-
- switch (TREE_CODE (decl))
- {
- case FUNCTION_DECL:
- /* Ignore this FUNCTION_DECL if it refers to a builtin declaration of a
- builtin function. Explicit programmer-supplied declarations of
- these same functions should NOT be ignored however. */
- if (DECL_EXTERNAL (decl) && DECL_FUNCTION_CODE (decl))
- {
- return;
- }
-
- /* What we would really like to do here is to filter out all mere
- file-scope declarations of file-scope functions which are never
- referenced later within this translation unit (and keep all of ones
- that *are* referenced later on) but we aren't clarvoiant, so we have
- no idea which functions will be referenced in the future (i.e. later
- on within the current translation unit). So here we just ignore all
- file-scope function declarations which are not also definitions. If
- and when the debugger needs to know something about these funcstion,
- it wil have to hunt around and find the DWARF information associated
- with the definition of the function. Note that we can't just check
- `DECL_EXTERNAL' to find out which FUNCTION_DECL nodes represent
- definitions and which ones represent mere declarations. We have to
- check `DECL_INITIAL' instead. That's because the C front-end
- supports some weird semantics for "extern inline" function
- definitions. These can get inlined within the current translation
- unit (an thus, we need to generate DWARF info for their abstract
- instances so that the DWARF info for the concrete inlined instances
- can have something to refer to) but the compiler never generates any
- out-of-lines instances of such things (despite the fact that they
- *are* definitions). The important point is that the C front-end
- marks these "extern inline" functions as DECL_EXTERNAL, but we need
- to generate DWARF for them anyway. Note that the C++ front-end also
- plays some similar games for inline function definitions appearing
- within include files which also contain
- `#pragma interface' pragmas. */
- if (DECL_INITIAL (decl) == NULL_TREE)
- {
- return;
- }
-
- /* If we're a nested function, initially use a parent of NULL; if we're
- a plain function, this will be fixed up in decls_for_scope. If
- we're a method, it will be ignored, since we already have a DIE. */
- if (decl_function_context (decl))
- context_die = NULL;
-
- break;
-
- case VAR_DECL:
- /* Ignore this VAR_DECL if it refers to a file-scope extern data object
- declaration and if the declaration was never even referenced from
- within this entire compilation unit. We suppress these DIEs in
- order to save space in the .debug section (by eliminating entries
- which are probably useless). Note that we must not suppress
- block-local extern declarations (whether used or not) because that
- would screw-up the debugger's name lookup mechanism and cause it to
- miss things which really ought to be in scope at a given point. */
- if (DECL_EXTERNAL (decl) && !TREE_USED (decl))
- {
- return;
- }
-
- /* If we are in terse mode, don't generate any DIEs to represent any
- variable declarations or definitions. */
- if (debug_info_level <= DINFO_LEVEL_TERSE)
- {
- return;
- }
- break;
-
- case TYPE_DECL:
- /* Don't bother trying to generate any DIEs to represent any of the
- normal built-in types for the language we are compiling. */
- if (DECL_SOURCE_LINE (decl) == 0)
- {
- /* OK, we need to generate one for `bool' so GDB knows what type
- comparisons have. */
- if ((get_AT_unsigned (comp_unit_die, DW_AT_language)
- == DW_LANG_C_plus_plus)
- && TREE_CODE (TREE_TYPE (decl)) == BOOLEAN_TYPE)
- modified_type_die (TREE_TYPE (decl), 0, 0, NULL);
- return;
- }
-
- /* If we are in terse mode, don't generate any DIEs for types. */
- if (debug_info_level <= DINFO_LEVEL_TERSE)
- return;
-
- /* If we're a function-scope tag, initially use a parent of NULL;
- this will be fixed up in decls_for_scope. */
- if (decl_function_context (decl))
- context_die = NULL;
-
- break;
-
- default:
- return;
- }
-
- gen_decl_die (decl, context_die);
- output_pending_types_for_scope (comp_unit_die);
-
- if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_INITIAL (decl) != NULL)
- {
- current_funcdef_number++;
- }
-
-}
-
-/* Output a marker (i.e. a label) for the beginning of the generated code for
- a lexical block. */
-void
-dwarf2out_begin_block (blocknum)
- register unsigned blocknum;
-{
- function_section (current_function_decl);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, BLOCK_BEGIN_LABEL, blocknum);
-}
-
-/* Output a marker (i.e. a label) for the end of the generated code for a
- lexical block. */
-void
-dwarf2out_end_block (blocknum)
- register unsigned blocknum;
-{
- function_section (current_function_decl);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, BLOCK_END_LABEL, blocknum);
-}
-
-/* Output a marker (i.e. a label) at a point in the assembly code which
- corresponds to a given source level label. */
-void
-dwarf2out_label (insn)
- register rtx insn;
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- {
- function_section (current_function_decl);
- sprintf (label, INSN_LABEL_FMT, current_funcdef_number);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, label,
- (unsigned) INSN_UID (insn));
- }
-}
-
-/* Output a marker (i.e. a label) for the beginning of a function, before
- the prologue. */
-void
-dwarf2out_begin_prologue ()
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
- register dw_fde_ref fde;
-
- function_section (current_function_decl);
- ASM_GENERATE_INTERNAL_LABEL (label, FUNC_BEGIN_LABEL,
- current_funcdef_number);
- ASM_OUTPUT_LABEL (asm_out_file, label);
-
- /* Expand the fde table if necessary. */
- if (fde_table_in_use == fde_table_allocated)
- {
- fde_table_allocated += FDE_TABLE_INCREMENT;
- fde_table = (dw_fde_ref) xrealloc (fde_table,
- fde_table_allocated * sizeof (dw_fde_node));
- }
-
- /* Record the FDE associated with this function. */
- current_funcdef_fde = fde_table_in_use;
-
- /* Add the new FDE at the end of the fde_table. */
- fde = &fde_table[fde_table_in_use++];
- fde->dw_fde_begin = xstrdup (label);
- fde->dw_fde_current_label = NULL;
- fde->dw_fde_end = NULL;
- fde->dw_fde_cfi = NULL;
-}
-
-/* Output a marker (i.e. a label) for the absolute end of the generated code
- for a function definition. This gets called *after* the epilogue code has
- been generated. */
-void
-dwarf2out_end_epilogue ()
-{
- dw_fde_ref fde;
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
- /* Output a label to mark the endpoint of the code generated for this
- function. */
- ASM_GENERATE_INTERNAL_LABEL (label, FUNC_END_LABEL, current_funcdef_number);
- ASM_OUTPUT_LABEL (asm_out_file, label);
- fde = &fde_table[fde_table_in_use - 1];
- fde->dw_fde_end = xstrdup (label);
-}
-
-/* Lookup a filename (in the list of filenames that we know about here in
- dwarf2out.c) and return its "index". The index of each (known) filename is
- just a unique number which is associated with only that one filename.
- We need such numbers for the sake of generating labels
- (in the .debug_sfnames section) and references to those
- files numbers (in the .debug_srcinfo and.debug_macinfo sections).
- If the filename given as an argument is not found in our current list,
- add it to the list and assign it the next available unique index number.
- In order to speed up searches, we remember the index of the filename
- was looked up last. This handles the majority of all searches. */
-static unsigned
-lookup_filename (file_name)
- char *file_name;
-{
- static unsigned last_file_lookup_index = 0;
- register char *fn;
- register unsigned i;
-
- /* Check to see if the file name that was searched on the previous call
- matches this file name. If so, return the index. */
- if (last_file_lookup_index != 0)
- {
- fn = file_table[last_file_lookup_index];
- if (strcmp (file_name, fn) == 0)
- {
- return last_file_lookup_index;
- }
- }
-
- /* Didn't match the previous lookup, search the table */
- for (i = 1; i < file_table_in_use; ++i)
- {
- fn = file_table[i];
- if (strcmp (file_name, fn) == 0)
- {
- last_file_lookup_index = i;
- return i;
- }
- }
-
- /* Prepare to add a new table entry by making sure there is enough space in
- the table to do so. If not, expand the current table. */
- if (file_table_in_use == file_table_allocated)
- {
- file_table_allocated += FILE_TABLE_INCREMENT;
- file_table
- = (char **)
- xrealloc (file_table, file_table_allocated * sizeof (char *));
- }
-
- /* add the new entry to the end of the filename table. */
- file_table[file_table_in_use] = xstrdup (file_name);
- last_file_lookup_index = file_table_in_use++;
- return last_file_lookup_index;
-}
-
-/* Output a label to mark the beginning of a source code line entry
- and record information relating to this source line, in
- 'line_info_table' for later output of the .debug_line section. */
-void
-dwarf2out_line (filename, line)
- register char *filename;
- register unsigned line;
-{
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- {
- function_section (current_function_decl);
-
- if (DECL_SECTION_NAME (current_function_decl))
- {
- register dw_separate_line_info_ref line_info;
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, SEPARATE_LINE_CODE_LABEL,
- separate_line_info_table_in_use);
- fputc ('\n', asm_out_file);
-
- /* expand the line info table if necessary */
- if (separate_line_info_table_in_use
- == separate_line_info_table_allocated)
- {
- separate_line_info_table_allocated += LINE_INFO_TABLE_INCREMENT;
- separate_line_info_table
- = (dw_separate_line_info_ref) xrealloc
- (separate_line_info_table,
- separate_line_info_table_allocated
- * sizeof (dw_separate_line_info_entry));
- }
- /* add the new entry at the end of the line_info_table. */
- line_info
- = &separate_line_info_table[separate_line_info_table_in_use++];
- line_info->dw_file_num = lookup_filename (filename);
- line_info->dw_line_num = line;
- line_info->function = current_funcdef_number;
- }
- else
- {
- register dw_line_info_ref line_info;
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, LINE_CODE_LABEL,
- line_info_table_in_use);
- fputc ('\n', asm_out_file);
-
- /* expand the line info table if necessary */
- if (line_info_table_in_use == line_info_table_allocated)
- {
- line_info_table_allocated += LINE_INFO_TABLE_INCREMENT;
- line_info_table
- = (dw_line_info_ref) xrealloc
- (line_info_table,
- line_info_table_allocated * sizeof (dw_line_info_entry));
- }
- /* add the new entry at the end of the line_info_table. */
- line_info = &line_info_table[line_info_table_in_use++];
- line_info->dw_file_num = lookup_filename (filename);
- line_info->dw_line_num = line;
- }
- }
-}
-
-/* Record the beginning of a new source file, for later output
- of the .debug_macinfo section. At present, unimplemented. */
-void
-dwarf2out_start_source_file (filename)
- register char *filename;
-{
-}
-
-/* Record the end of a source file, for later output
- of the .debug_macinfo section. At present, unimplemented. */
-void
-dwarf2out_end_source_file ()
-{
-}
-
-/* Called from check_newline in c-parse.y. The `buffer' parameter contains
- the tail part of the directive line, i.e. the part which is past the
- initial whitespace, #, whitespace, directive-name, whitespace part. */
-void
-dwarf2out_define (lineno, buffer)
- register unsigned lineno;
- register char *buffer;
-{
- static int initialized = 0;
- if (!initialized)
- {
- dwarf2out_start_source_file (primary_filename);
- initialized = 1;
- }
-}
-
-/* Called from check_newline in c-parse.y. The `buffer' parameter contains
- the tail part of the directive line, i.e. the part which is past the
- initial whitespace, #, whitespace, directive-name, whitespace part. */
-void
-dwarf2out_undef (lineno, buffer)
- register unsigned lineno;
- register char *buffer;
-{
-}
-
-/* Set up for Dwarf output at the start of compilation. */
-void
-dwarf2out_init (asm_out_file, main_input_filename)
- register FILE *asm_out_file;
- register char *main_input_filename;
-{
- /* Remember the name of the primary input file. */
- primary_filename = main_input_filename;
-
- /* Allocate the initial hunk of the file_table. */
- file_table = (char **) xmalloc (FILE_TABLE_INCREMENT * sizeof (char *));
- bzero (file_table, FILE_TABLE_INCREMENT * sizeof (char *));
- file_table_allocated = FILE_TABLE_INCREMENT;
- /* skip the first entry - file numbers begin at 1 */
- file_table_in_use = 1;
-
- /* Allocate the initial hunk of the decl_die_table. */
- decl_die_table
- = (dw_die_ref *) xmalloc (DECL_DIE_TABLE_INCREMENT * sizeof (dw_die_ref));
- bzero (decl_die_table, DECL_DIE_TABLE_INCREMENT * sizeof (dw_die_ref));
- decl_die_table_allocated = DECL_DIE_TABLE_INCREMENT;
- decl_die_table_in_use = 0;
-
- /* Allocate the initial hunk of the decl_scope_table. */
- decl_scope_table
- = (tree *) xmalloc (DECL_SCOPE_TABLE_INCREMENT * sizeof (tree));
- bzero (decl_scope_table, DECL_SCOPE_TABLE_INCREMENT * sizeof (tree));
- decl_scope_table_allocated = DECL_SCOPE_TABLE_INCREMENT;
- decl_scope_depth = 0;
-
- /* Allocate the initial hunk of the abbrev_die_table. */
- abbrev_die_table
- = (dw_die_ref *) xmalloc (ABBREV_DIE_TABLE_INCREMENT
- * sizeof (dw_die_ref));
- bzero (abbrev_die_table, ABBREV_DIE_TABLE_INCREMENT * sizeof (dw_die_ref));
- abbrev_die_table_allocated = ABBREV_DIE_TABLE_INCREMENT;
- /* zero-th entry is allocated, but unused */
- abbrev_die_table_in_use = 1;
-
- /* Allocate the initial hunk of the line_info_table. */
- line_info_table
- = (dw_line_info_ref) xmalloc (LINE_INFO_TABLE_INCREMENT
- * sizeof (dw_line_info_entry));
- bzero (line_info_table, LINE_INFO_TABLE_INCREMENT
- * sizeof (dw_line_info_entry));
- line_info_table_allocated = LINE_INFO_TABLE_INCREMENT;
- /* zero-th entry is allocated, but unused */
- line_info_table_in_use = 1;
-
- /* Allocate the initial hunk of the fde_table. */
- fde_table = (dw_fde_ref) xmalloc (FDE_TABLE_INCREMENT * sizeof (dw_fde_node));
- bzero (fde_table, FDE_TABLE_INCREMENT * sizeof (dw_fde_node));
- fde_table_allocated = FDE_TABLE_INCREMENT;
- fde_table_in_use = 0;
-
- /* Generate the initial DIE for the .debug section. Note that the (string)
- value given in the DW_AT_name attribute of the DW_TAG_compile_unit DIE
- will (typically) be a relative pathname and that this pathname should be
- taken as being relative to the directory from which the compiler was
- invoked when the given (base) source file was compiled. */
- gen_compile_unit_die (main_input_filename);
-
- ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
-
- /* Generate the CFA instructions common to all FDE's. Do it now for the
- sake of lookup_cfa. */
-
-#ifdef INCOMING_RETURN_ADDR_RTX
- /* On entry, the Canonical Frame Address is at SP+0. */
- dwarf2out_def_cfa (NULL, STACK_POINTER_REGNUM, 0);
- initial_return_save (INCOMING_RETURN_ADDR_RTX);
-#endif
-}
-
-/* Output stuff that dwarf requires at the end of every file,
- and generate the DWARF-2 debugging info. */
-void
-dwarf2out_finish ()
-{
- /* Traverse the DIE tree and add sibling attributes to those DIE's
- that have children. */
- add_sibling_attributes (comp_unit_die);
-
- /* Output a terminator label for the .text section. */
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_SECTION (asm_out_file, TEXT_SECTION);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, TEXT_END_LABEL, 0);
-
-#if 0
- /* Output a terminator label for the .data section. */
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_SECTION (asm_out_file, DATA_SECTION);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, DATA_END_LABEL, 0);
-
- /* Output a terminator label for the .bss section. */
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_SECTION (asm_out_file, BSS_SECTION);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, BSS_END_LABEL, 0);
-#endif
-
- /* Output the source line correspondence table. */
- if (line_info_table_in_use > 1 || separate_line_info_table_in_use)
- {
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_SECTION (asm_out_file, LINE_SECTION);
- output_line_info ();
-
- /* We can only use the low/high_pc attributes if all of the code
- was in .text. */
- if (separate_line_info_table_in_use == 0)
- {
- add_AT_lbl_id (comp_unit_die, DW_AT_low_pc, TEXT_SECTION);
- add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label);
- }
- add_AT_section_offset (comp_unit_die, DW_AT_stmt_list, LINE_SECTION);
- }
-
- /* Output the abbreviation table. */
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_SECTION (asm_out_file, ABBREV_SECTION);
- build_abbrev_table (comp_unit_die);
- output_abbrev_section ();
-
- /* Initialize the beginning DIE offset - and calculate sizes/offsets. */
- next_die_offset = DWARF_COMPILE_UNIT_HEADER_SIZE;
- calc_die_sizes (comp_unit_die);
-
- /* calculate sizes/offsets for FDEs. */
- calc_fde_sizes ();
-
- /* Output debugging information. */
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_SECTION (asm_out_file, DEBUG_SECTION);
- output_compilation_unit_header ();
- output_die (comp_unit_die);
-
- if (pubname_table_in_use)
- {
- /* Output public names table. */
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_SECTION (asm_out_file, PUBNAMES_SECTION);
- output_pubnames ();
- }
-
- if (fde_table_in_use)
- {
- /* Output call frame information. */
- output_call_frame_info ();
-
- /* Output the address range information. */
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_SECTION (asm_out_file, ARANGES_SECTION);
- output_aranges ();
- }
-
- /* The only DIE we should have with a parent of NULL is comp_unit_die. */
- assert (limbo_die_count == 1);
-}
-#endif /* DWARF2_DEBUGGING_INFO */
diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c
deleted file mode 100644
index f91cccb3420..00000000000
--- a/gcc/dwarfout.c
+++ /dev/null
@@ -1,5910 +0,0 @@
-/* Output Dwarf format symbol table information from the GNU C compiler.
- Copyright (C) 1992, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@monkeys.com) of Network Computing Devices.
-
-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"
-
-#ifdef DWARF_DEBUGGING_INFO
-#include <stdio.h>
-#include "dwarf.h"
-#include "tree.h"
-#include "flags.h"
-#include "rtl.h"
-#include "hard-reg-set.h"
-#include "insn-config.h"
-#include "reload.h"
-#include "output.h"
-#include "defaults.h"
-
-/* #define NDEBUG 1 */
-#include "assert.h"
-
-#if defined(DWARF_TIMESTAMPS)
-#if defined(POSIX)
-#include <time.h>
-#else /* !defined(POSIX) */
-#include <sys/types.h>
-#if defined(__STDC__)
-extern time_t time (time_t *);
-#else /* !defined(__STDC__) */
-extern time_t time ();
-#endif /* !defined(__STDC__) */
-#endif /* !defined(POSIX) */
-#endif /* defined(DWARF_TIMESTAMPS) */
-
-extern char *getpwd ();
-
-extern char *index ();
-extern char *rindex ();
-
-/* IMPORTANT NOTE: Please see the file README.DWARF for important details
- regarding the GNU implementation of Dwarf. */
-
-/* NOTE: In the comments in this file, many references are made to
- so called "Debugging Information Entries". For the sake of brevity,
- this term is abbreviated to `DIE' throughout the remainder of this
- file. */
-
-/* Note that the implementation of C++ support herein is (as yet) unfinished.
- If you want to try to complete it, more power to you. */
-
-#if !defined(__GNUC__) || (NDEBUG != 1)
-#define inline
-#endif
-
-/* How to start an assembler comment. */
-#ifndef ASM_COMMENT_START
-#define ASM_COMMENT_START ";#"
-#endif
-
-/* How to print out a register name. */
-#ifndef PRINT_REG
-#define PRINT_REG(RTX, CODE, FILE) \
- fprintf ((FILE), "%s", reg_names[REGNO (RTX)])
-#endif
-
-/* Define a macro which returns non-zero for any tagged type which is
- used (directly or indirectly) in the specification of either some
- function's return type or some formal parameter of some function.
- We use this macro when we are operating in "terse" mode to help us
- know what tagged types have to be represented in Dwarf (even in
- terse mode) and which ones don't.
-
- A flag bit with this meaning really should be a part of the normal
- GCC ..._TYPE nodes, but at the moment, there is no such bit defined
- for these nodes. For now, we have to just fake it. It it safe for
- us to simply return zero for all complete tagged types (which will
- get forced out anyway if they were used in the specification of some
- formal or return type) and non-zero for all incomplete tagged types.
-*/
-
-#define TYPE_USED_FOR_FUNCTION(tagged_type) (TYPE_SIZE (tagged_type) == 0)
-
-/* Define a macro which returns non-zero for a TYPE_DECL which was
- implicitly generated for a tagged type.
-
- Note that unlike the gcc front end (which generates a NULL named
- TYPE_DECL node for each complete tagged type, each array type, and
- each function type node created) the g++ front end generates a
- _named_ TYPE_DECL node for each tagged type node created.
- These TYPE_DECLs have DECL_ARTIFICIAL set, so we know not to
- generate a DW_TAG_typedef DIE for them. */
-#define TYPE_DECL_IS_STUB(decl) \
- (DECL_NAME (decl) == NULL \
- || (DECL_ARTIFICIAL (decl) \
- && is_tagged_type (TREE_TYPE (decl)) \
- && decl == TYPE_STUB_DECL (TREE_TYPE (decl))))
-
-extern int flag_traditional;
-extern char *version_string;
-extern char *language_string;
-
-/* Maximum size (in bytes) of an artificially generated label. */
-
-#define MAX_ARTIFICIAL_LABEL_BYTES 30
-
-/* Make sure we know the sizes of the various types dwarf can describe.
- These are only defaults. If the sizes are different for your target,
- you should override these values by defining the appropriate symbols
- in your tm.h file. */
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * 2)
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
-#endif
-
-#ifndef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-/* Structure to keep track of source filenames. */
-
-struct filename_entry {
- unsigned number;
- char * name;
-};
-
-typedef struct filename_entry filename_entry;
-
-/* Pointer to an array of elements, each one having the structure above. */
-
-static filename_entry *filename_table;
-
-/* Total number of entries in the table (i.e. array) pointed to by
- `filename_table'. This is the *total* and includes both used and
- unused slots. */
-
-static unsigned ft_entries_allocated;
-
-/* Number of entries in the filename_table which are actually in use. */
-
-static unsigned ft_entries;
-
-/* Size (in elements) of increments by which we may expand the filename
- table. Actually, a single hunk of space of this size should be enough
- for most typical programs. */
-
-#define FT_ENTRIES_INCREMENT 64
-
-/* Local pointer to the name of the main input file. Initialized in
- dwarfout_init. */
-
-static char *primary_filename;
-
-/* Pointer to the most recent filename for which we produced some line info. */
-
-static char *last_filename;
-
-/* For Dwarf output, we must assign lexical-blocks id numbers
- in the order in which their beginnings are encountered.
- We output Dwarf debugging info that refers to the beginnings
- and ends of the ranges of code for each lexical block with
- assembler labels ..Bn and ..Bn.e, where n is the block number.
- The labels themselves are generated in final.c, which assigns
- numbers to the blocks in the same way. */
-
-static unsigned next_block_number = 2;
-
-/* Counter to generate unique names for DIEs. */
-
-static unsigned next_unused_dienum = 1;
-
-/* Number of the DIE which is currently being generated. */
-
-static unsigned current_dienum;
-
-/* Number to use for the special "pubname" label on the next DIE which
- represents a function or data object defined in this compilation
- unit which has "extern" linkage. */
-
-static next_pubname_number = 0;
-
-#define NEXT_DIE_NUM pending_sibling_stack[pending_siblings-1]
-
-/* Pointer to a dynamically allocated list of pre-reserved and still
- pending sibling DIE numbers. Note that this list will grow as needed. */
-
-static unsigned *pending_sibling_stack;
-
-/* Counter to keep track of the number of pre-reserved and still pending
- sibling DIE numbers. */
-
-static unsigned pending_siblings;
-
-/* The currently allocated size of the above list (expressed in number of
- list elements). */
-
-static unsigned pending_siblings_allocated;
-
-/* Size (in elements) of increments by which we may expand the pending
- sibling stack. Actually, a single hunk of space of this size should
- be enough for most typical programs. */
-
-#define PENDING_SIBLINGS_INCREMENT 64
-
-/* Non-zero if we are performing our file-scope finalization pass and if
- we should force out Dwarf descriptions of any and all file-scope
- tagged types which are still incomplete types. */
-
-static int finalizing = 0;
-
-/* A pointer to the base of a list of pending types which we haven't
- generated DIEs for yet, but which we will have to come back to
- later on. */
-
-static tree *pending_types_list;
-
-/* Number of elements currently allocated for the pending_types_list. */
-
-static unsigned pending_types_allocated;
-
-/* Number of elements of pending_types_list currently in use. */
-
-static unsigned pending_types;
-
-/* Size (in elements) of increments by which we may expand the pending
- types list. Actually, a single hunk of space of this size should
- be enough for most typical programs. */
-
-#define PENDING_TYPES_INCREMENT 64
-
-/* Pointer to an artificial RECORD_TYPE which we create in dwarfout_init.
- This is used in a hack to help us get the DIEs describing types of
- formal parameters to come *after* all of the DIEs describing the formal
- parameters themselves. That's necessary in order to be compatible
- with what the brain-damaged svr4 SDB debugger requires. */
-
-static tree fake_containing_scope;
-
-/* The number of the current function definition that we are generating
- debugging information for. These numbers range from 1 up to the maximum
- number of function definitions contained within the current compilation
- unit. These numbers are used to create unique labels for various things
- contained within various function definitions. */
-
-static unsigned current_funcdef_number = 1;
-
-/* A pointer to the ..._DECL node which we have most recently been working
- on. We keep this around just in case something about it looks screwy
- and we want to tell the user what the source coordinates for the actual
- declaration are. */
-
-static tree dwarf_last_decl;
-
-/* A flag indicating that we are emitting the member declarations of a
- class, so member functions and variables should not be entirely emitted.
- This is a kludge to avoid passing a second argument to output_*_die. */
-
-static int in_class;
-
-/* Forward declarations for functions defined in this file. */
-
-static char *dwarf_tag_name PROTO((unsigned));
-static char *dwarf_attr_name PROTO((unsigned));
-static char *dwarf_stack_op_name PROTO((unsigned));
-static char *dwarf_typemod_name PROTO((unsigned));
-static char *dwarf_fmt_byte_name PROTO((unsigned));
-static char *dwarf_fund_type_name PROTO((unsigned));
-static tree decl_ultimate_origin PROTO((tree));
-static tree block_ultimate_origin PROTO((tree));
-static void output_unsigned_leb128 PROTO((unsigned long));
-static void output_signed_leb128 PROTO((long));
-static inline int is_body_block PROTO((tree));
-static int fundamental_type_code PROTO((tree));
-static tree root_type_1 PROTO((tree, int));
-static tree root_type PROTO((tree));
-static void write_modifier_bytes_1 PROTO((tree, int, int, int));
-static void write_modifier_bytes PROTO((tree, int, int));
-static inline int type_is_fundamental PROTO((tree));
-static void equate_decl_number_to_die_number PROTO((tree));
-static inline void equate_type_number_to_die_number PROTO((tree));
-static void output_reg_number PROTO((rtx));
-static void output_mem_loc_descriptor PROTO((rtx));
-static void output_loc_descriptor PROTO((rtx));
-static void output_bound_representation PROTO((tree, unsigned, int));
-static void output_enumeral_list PROTO((tree));
-static inline unsigned ceiling PROTO((unsigned, unsigned));
-static inline tree field_type PROTO((tree));
-static inline unsigned simple_type_align_in_bits PROTO((tree));
-static inline unsigned simple_type_size_in_bits PROTO((tree));
-static unsigned field_byte_offset PROTO((tree));
-static inline void sibling_attribute PROTO((void));
-static void location_attribute PROTO((rtx));
-static void data_member_location_attribute PROTO((tree));
-static void const_value_attribute PROTO((rtx));
-static void location_or_const_value_attribute PROTO((tree));
-static inline void name_attribute PROTO((char *));
-static inline void fund_type_attribute PROTO((unsigned));
-static void mod_fund_type_attribute PROTO((tree, int, int));
-static inline void user_def_type_attribute PROTO((tree));
-static void mod_u_d_type_attribute PROTO((tree, int, int));
-static inline void ordering_attribute PROTO((unsigned));
-static void subscript_data_attribute PROTO((tree));
-static void byte_size_attribute PROTO((tree));
-static inline void bit_offset_attribute PROTO((tree));
-static inline void bit_size_attribute PROTO((tree));
-static inline void element_list_attribute PROTO((tree));
-static inline void stmt_list_attribute PROTO((char *));
-static inline void low_pc_attribute PROTO((char *));
-static inline void high_pc_attribute PROTO((char *));
-static inline void body_begin_attribute PROTO((char *));
-static inline void body_end_attribute PROTO((char *));
-static inline void langauge_attribute PROTO((unsigned));
-static inline void member_attribute PROTO((tree));
-static inline void string_length_attribute PROTO((tree));
-static inline void comp_dir_attribute PROTO((char *));
-static inline void sf_names_attribute PROTO((char *));
-static inline void src_info_attribute PROTO((char *));
-static inline void mac_info_attribute PROTO((char *));
-static inline void prototyped_attribute PROTO((tree));
-static inline void producer_attribute PROTO((char *));
-static inline void inline_attribute PROTO((tree));
-static inline void containing_type_attribute PROTO((tree));
-static inline void abstract_origin_attribute PROTO((tree));
-static inline void src_coords_attribute PROTO((unsigned, unsigned));
-static inline void pure_or_virtual_attribute PROTO((tree));
-static void name_and_src_coords_attributes PROTO((tree));
-static void type_attribute PROTO((tree, int, int));
-static char *type_tag PROTO((tree));
-static inline void dienum_push PROTO((void));
-static inline void dienum_pop PROTO((void));
-static inline tree member_declared_type PROTO((tree));
-static char *function_start_label PROTO((tree));
-static void output_array_type_die PROTO((void *));
-static void output_set_type_die PROTO((void *));
-static void output_entry_point_die PROTO((void *));
-static void output_inlined_enumeration_type_die PROTO((void *));
-static void output_inlined_structure_type_die PROTO((void *));
-static void output_inlined_union_type_die PROTO((void *));
-static void output_enumeration_type_die PROTO((void *));
-static void output_formal_parameter_die PROTO((void *));
-static void output_global_subroutine_die PROTO((void *));
-static void output_global_variable_die PROTO((void *));
-static void output_label_die PROTO((void *));
-static void output_lexical_block_die PROTO((void *));
-static void output_inlined_subroutine_die PROTO((void *));
-static void output_local_variable_die PROTO((void *));
-static void output_member_die PROTO((void *));
-static void output_pointer_type_die PROTO((void *));
-static void output_reference_type_die PROTO((void *));
-static void output_ptr_to_mbr_type_die PROTO((void *));
-static void output_compile_unit_die PROTO((void *));
-static void output_string_type_die PROTO((void *));
-static void output_structure_type_die PROTO((void *));
-static void output_local_subroutine_die PROTO((void *));
-static void output_subroutine_type_die PROTO((void *));
-static void output_typedef_die PROTO((void *));
-static void output_union_type_die PROTO((void *));
-static void output_unspecified_parameters_die PROTO((void *));
-static void output_padded_null_die PROTO((void *));
-static void output_die PROTO((void (*) (), void *));
-static void end_sibling_chain PROTO((void));
-static void output_formal_types PROTO((tree));
-static void pend_type PROTO((tree));
-static inline int type_of_for_scope PROTO((tree, tree));
-static void output_pending_types_for_scope PROTO((tree));
-static void output_type PROTO((tree, tree));
-static void output_tagged_type_instantiation PROTO((tree));
-static void output_block PROTO((tree, int));
-static void output_decls_for_scope PROTO((tree, int));
-static void output_decl PROTO((tree, tree));
-static void shuffle_filename_entry PROTO((filename_entry *));
-static void geneate_new_sfname_entry PROTO((void));
-static unsigned lookup_filename PROTO((char *));
-static void generate_srcinfo_entry PROTO((unsigned, unsigned));
-static void generate_macinfo_entry PROTO((char *, char *));
-
-/* Definitions of defaults for assembler-dependent names of various
- pseudo-ops and section names.
-
- Theses may be overridden in your tm.h file (if necessary) for your
- particular assembler. The default values provided here correspond to
- what is expected by "standard" AT&T System V.4 assemblers. */
-
-#ifndef FILE_ASM_OP
-#define FILE_ASM_OP ".file"
-#endif
-#ifndef VERSION_ASM_OP
-#define VERSION_ASM_OP ".version"
-#endif
-#ifndef UNALIGNED_SHORT_ASM_OP
-#define UNALIGNED_SHORT_ASM_OP ".2byte"
-#endif
-#ifndef UNALIGNED_INT_ASM_OP
-#define UNALIGNED_INT_ASM_OP ".4byte"
-#endif
-#ifndef ASM_BYTE_OP
-#define ASM_BYTE_OP ".byte"
-#endif
-#ifndef SET_ASM_OP
-#define SET_ASM_OP ".set"
-#endif
-
-/* Pseudo-ops for pushing the current section onto the section stack (and
- simultaneously changing to a new section) and for poping back to the
- section we were in immediately before this one. Note that most svr4
- assemblers only maintain a one level stack... you can push all the
- sections you want, but you can only pop out one level. (The sparc
- svr4 assembler is an exception to this general rule.) That's
- OK because we only use at most one level of the section stack herein. */
-
-#ifndef PUSHSECTION_ASM_OP
-#define PUSHSECTION_ASM_OP ".section"
-#endif
-#ifndef POPSECTION_ASM_OP
-#define POPSECTION_ASM_OP ".previous"
-#endif
-
-/* The default format used by the ASM_OUTPUT_PUSH_SECTION macro (see below)
- to print the PUSHSECTION_ASM_OP and the section name. The default here
- works for almost all svr4 assemblers, except for the sparc, where the
- section name must be enclosed in double quotes. (See sparcv4.h.) */
-
-#ifndef PUSHSECTION_FORMAT
-#define PUSHSECTION_FORMAT "\t%s\t%s\n"
-#endif
-
-#ifndef DEBUG_SECTION
-#define DEBUG_SECTION ".debug"
-#endif
-#ifndef LINE_SECTION
-#define LINE_SECTION ".line"
-#endif
-#ifndef SFNAMES_SECTION
-#define SFNAMES_SECTION ".debug_sfnames"
-#endif
-#ifndef SRCINFO_SECTION
-#define SRCINFO_SECTION ".debug_srcinfo"
-#endif
-#ifndef MACINFO_SECTION
-#define MACINFO_SECTION ".debug_macinfo"
-#endif
-#ifndef PUBNAMES_SECTION
-#define PUBNAMES_SECTION ".debug_pubnames"
-#endif
-#ifndef ARANGES_SECTION
-#define ARANGES_SECTION ".debug_aranges"
-#endif
-#ifndef TEXT_SECTION
-#define TEXT_SECTION ".text"
-#endif
-#ifndef DATA_SECTION
-#define DATA_SECTION ".data"
-#endif
-#ifndef DATA1_SECTION
-#define DATA1_SECTION ".data1"
-#endif
-#ifndef RODATA_SECTION
-#define RODATA_SECTION ".rodata"
-#endif
-#ifndef RODATA1_SECTION
-#define RODATA1_SECTION ".rodata1"
-#endif
-#ifndef BSS_SECTION
-#define BSS_SECTION ".bss"
-#endif
-
-/* Definitions of defaults for formats and names of various special
- (artificial) labels which may be generated within this file (when
- the -g options is used and DWARF_DEBUGGING_INFO is in effect.
-
- If necessary, these may be overridden from within your tm.h file,
- but typically, you should never need to override these.
-
- These labels have been hacked (temporarily) so that they all begin with
- a `.L' sequence so as to appease the stock sparc/svr4 assembler and the
- stock m88k/svr4 assembler, both of which need to see .L at the start of
- a label in order to prevent that label from going into the linker symbol
- table). When I get time, I'll have to fix this the right way so that we
- will use ASM_GENERATE_INTERNAL_LABEL and ASM_OUTPUT_INTERNAL_LABEL herein,
- but that will require a rather massive set of changes. For the moment,
- the following definitions out to produce the right results for all svr4
- and svr3 assemblers. -- rfg
-*/
-
-#ifndef TEXT_BEGIN_LABEL
-#define TEXT_BEGIN_LABEL ".L_text_b"
-#endif
-#ifndef TEXT_END_LABEL
-#define TEXT_END_LABEL ".L_text_e"
-#endif
-
-#ifndef DATA_BEGIN_LABEL
-#define DATA_BEGIN_LABEL ".L_data_b"
-#endif
-#ifndef DATA_END_LABEL
-#define DATA_END_LABEL ".L_data_e"
-#endif
-
-#ifndef DATA1_BEGIN_LABEL
-#define DATA1_BEGIN_LABEL ".L_data1_b"
-#endif
-#ifndef DATA1_END_LABEL
-#define DATA1_END_LABEL ".L_data1_e"
-#endif
-
-#ifndef RODATA_BEGIN_LABEL
-#define RODATA_BEGIN_LABEL ".L_rodata_b"
-#endif
-#ifndef RODATA_END_LABEL
-#define RODATA_END_LABEL ".L_rodata_e"
-#endif
-
-#ifndef RODATA1_BEGIN_LABEL
-#define RODATA1_BEGIN_LABEL ".L_rodata1_b"
-#endif
-#ifndef RODATA1_END_LABEL
-#define RODATA1_END_LABEL ".L_rodata1_e"
-#endif
-
-#ifndef BSS_BEGIN_LABEL
-#define BSS_BEGIN_LABEL ".L_bss_b"
-#endif
-#ifndef BSS_END_LABEL
-#define BSS_END_LABEL ".L_bss_e"
-#endif
-
-#ifndef LINE_BEGIN_LABEL
-#define LINE_BEGIN_LABEL ".L_line_b"
-#endif
-#ifndef LINE_LAST_ENTRY_LABEL
-#define LINE_LAST_ENTRY_LABEL ".L_line_last"
-#endif
-#ifndef LINE_END_LABEL
-#define LINE_END_LABEL ".L_line_e"
-#endif
-
-#ifndef DEBUG_BEGIN_LABEL
-#define DEBUG_BEGIN_LABEL ".L_debug_b"
-#endif
-#ifndef SFNAMES_BEGIN_LABEL
-#define SFNAMES_BEGIN_LABEL ".L_sfnames_b"
-#endif
-#ifndef SRCINFO_BEGIN_LABEL
-#define SRCINFO_BEGIN_LABEL ".L_srcinfo_b"
-#endif
-#ifndef MACINFO_BEGIN_LABEL
-#define MACINFO_BEGIN_LABEL ".L_macinfo_b"
-#endif
-
-#ifndef DIE_BEGIN_LABEL_FMT
-#define DIE_BEGIN_LABEL_FMT ".L_D%u"
-#endif
-#ifndef DIE_END_LABEL_FMT
-#define DIE_END_LABEL_FMT ".L_D%u_e"
-#endif
-#ifndef PUB_DIE_LABEL_FMT
-#define PUB_DIE_LABEL_FMT ".L_P%u"
-#endif
-#ifndef INSN_LABEL_FMT
-#define INSN_LABEL_FMT ".L_I%u_%u"
-#endif
-#ifndef BLOCK_BEGIN_LABEL_FMT
-#define BLOCK_BEGIN_LABEL_FMT ".L_B%u"
-#endif
-#ifndef BLOCK_END_LABEL_FMT
-#define BLOCK_END_LABEL_FMT ".L_B%u_e"
-#endif
-#ifndef SS_BEGIN_LABEL_FMT
-#define SS_BEGIN_LABEL_FMT ".L_s%u"
-#endif
-#ifndef SS_END_LABEL_FMT
-#define SS_END_LABEL_FMT ".L_s%u_e"
-#endif
-#ifndef EE_BEGIN_LABEL_FMT
-#define EE_BEGIN_LABEL_FMT ".L_e%u"
-#endif
-#ifndef EE_END_LABEL_FMT
-#define EE_END_LABEL_FMT ".L_e%u_e"
-#endif
-#ifndef MT_BEGIN_LABEL_FMT
-#define MT_BEGIN_LABEL_FMT ".L_t%u"
-#endif
-#ifndef MT_END_LABEL_FMT
-#define MT_END_LABEL_FMT ".L_t%u_e"
-#endif
-#ifndef LOC_BEGIN_LABEL_FMT
-#define LOC_BEGIN_LABEL_FMT ".L_l%u"
-#endif
-#ifndef LOC_END_LABEL_FMT
-#define LOC_END_LABEL_FMT ".L_l%u_e"
-#endif
-#ifndef BOUND_BEGIN_LABEL_FMT
-#define BOUND_BEGIN_LABEL_FMT ".L_b%u_%u_%c"
-#endif
-#ifndef BOUND_END_LABEL_FMT
-#define BOUND_END_LABEL_FMT ".L_b%u_%u_%c_e"
-#endif
-#ifndef DERIV_BEGIN_LABEL_FMT
-#define DERIV_BEGIN_LABEL_FMT ".L_d%u"
-#endif
-#ifndef DERIV_END_LABEL_FMT
-#define DERIV_END_LABEL_FMT ".L_d%u_e"
-#endif
-#ifndef SL_BEGIN_LABEL_FMT
-#define SL_BEGIN_LABEL_FMT ".L_sl%u"
-#endif
-#ifndef SL_END_LABEL_FMT
-#define SL_END_LABEL_FMT ".L_sl%u_e"
-#endif
-#ifndef BODY_BEGIN_LABEL_FMT
-#define BODY_BEGIN_LABEL_FMT ".L_b%u"
-#endif
-#ifndef BODY_END_LABEL_FMT
-#define BODY_END_LABEL_FMT ".L_b%u_e"
-#endif
-#ifndef FUNC_END_LABEL_FMT
-#define FUNC_END_LABEL_FMT ".L_f%u_e"
-#endif
-#ifndef TYPE_NAME_FMT
-#define TYPE_NAME_FMT ".L_T%u"
-#endif
-#ifndef DECL_NAME_FMT
-#define DECL_NAME_FMT ".L_E%u"
-#endif
-#ifndef LINE_CODE_LABEL_FMT
-#define LINE_CODE_LABEL_FMT ".L_LC%u"
-#endif
-#ifndef SFNAMES_ENTRY_LABEL_FMT
-#define SFNAMES_ENTRY_LABEL_FMT ".L_F%u"
-#endif
-#ifndef LINE_ENTRY_LABEL_FMT
-#define LINE_ENTRY_LABEL_FMT ".L_LE%u"
-#endif
-
-/* Definitions of defaults for various types of primitive assembly language
- output operations.
-
- If necessary, these may be overridden from within your tm.h file,
- but typically, you shouldn't need to override these. */
-
-#ifndef ASM_OUTPUT_PUSH_SECTION
-#define ASM_OUTPUT_PUSH_SECTION(FILE, SECTION) \
- fprintf ((FILE), PUSHSECTION_FORMAT, PUSHSECTION_ASM_OP, SECTION)
-#endif
-
-#ifndef ASM_OUTPUT_POP_SECTION
-#define ASM_OUTPUT_POP_SECTION(FILE) \
- fprintf ((FILE), "\t%s\n", POPSECTION_ASM_OP)
-#endif
-
-#ifndef ASM_OUTPUT_SOURCE_FILENAME
-#define ASM_OUTPUT_SOURCE_FILENAME(FILE,NAME) \
- do { fprintf (FILE, "\t%s\t", FILE_ASM_OP); \
- output_quoted_string (FILE, NAME); \
- fputc ('\n', FILE); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA2
-#define ASM_OUTPUT_DWARF_DELTA2(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_SHORT_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DELTA4
-#define ASM_OUTPUT_DWARF_DELTA4(FILE,LABEL1,LABEL2) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \
- assemble_name (FILE, LABEL1); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_TAG
-#define ASM_OUTPUT_DWARF_TAG(FILE,TAG) \
- do { \
- fprintf ((FILE), "\t%s\t0x%x", \
- UNALIGNED_SHORT_ASM_OP, (unsigned) TAG); \
- if (flag_debug_asm) \
- fprintf ((FILE), "\t%s %s", \
- ASM_COMMENT_START, dwarf_tag_name (TAG)); \
- fputc ('\n', (FILE)); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ATTRIBUTE
-#define ASM_OUTPUT_DWARF_ATTRIBUTE(FILE,ATTR) \
- do { \
- fprintf ((FILE), "\t%s\t0x%x", \
- UNALIGNED_SHORT_ASM_OP, (unsigned) ATTR); \
- if (flag_debug_asm) \
- fprintf ((FILE), "\t%s %s", \
- ASM_COMMENT_START, dwarf_attr_name (ATTR)); \
- fputc ('\n', (FILE)); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_STACK_OP
-#define ASM_OUTPUT_DWARF_STACK_OP(FILE,OP) \
- do { \
- fprintf ((FILE), "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) OP); \
- if (flag_debug_asm) \
- fprintf ((FILE), "\t%s %s", \
- ASM_COMMENT_START, dwarf_stack_op_name (OP)); \
- fputc ('\n', (FILE)); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_FUND_TYPE
-#define ASM_OUTPUT_DWARF_FUND_TYPE(FILE,FT) \
- do { \
- fprintf ((FILE), "\t%s\t0x%x", \
- UNALIGNED_SHORT_ASM_OP, (unsigned) FT); \
- if (flag_debug_asm) \
- fprintf ((FILE), "\t%s %s", \
- ASM_COMMENT_START, dwarf_fund_type_name (FT)); \
- fputc ('\n', (FILE)); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_FMT_BYTE
-#define ASM_OUTPUT_DWARF_FMT_BYTE(FILE,FMT) \
- do { \
- fprintf ((FILE), "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) FMT); \
- if (flag_debug_asm) \
- fprintf ((FILE), "\t%s %s", \
- ASM_COMMENT_START, dwarf_fmt_byte_name (FMT)); \
- fputc ('\n', (FILE)); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_TYPE_MODIFIER
-#define ASM_OUTPUT_DWARF_TYPE_MODIFIER(FILE,MOD) \
- do { \
- fprintf ((FILE), "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) MOD); \
- if (flag_debug_asm) \
- fprintf ((FILE), "\t%s %s", \
- ASM_COMMENT_START, dwarf_typemod_name (MOD)); \
- fputc ('\n', (FILE)); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR
-#define ASM_OUTPUT_DWARF_ADDR(FILE,LABEL) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \
- assemble_name (FILE, LABEL); \
- fprintf (FILE, "\n"); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_ADDR_CONST
-#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \
- do { \
- fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \
- output_addr_const ((FILE), (RTX)); \
- fputc ('\n', (FILE)); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_REF
-#define ASM_OUTPUT_DWARF_REF(FILE,LABEL) \
- do { fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \
- assemble_name (FILE, LABEL); \
- fprintf (FILE, "\n"); \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA1
-#define ASM_OUTPUT_DWARF_DATA1(FILE,VALUE) \
- fprintf ((FILE), "\t%s\t0x%x\n", ASM_BYTE_OP, VALUE)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA2
-#define ASM_OUTPUT_DWARF_DATA2(FILE,VALUE) \
- fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_SHORT_ASM_OP, (unsigned) VALUE)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA4
-#define ASM_OUTPUT_DWARF_DATA4(FILE,VALUE) \
- fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, (unsigned) VALUE)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_DATA8
-#define ASM_OUTPUT_DWARF_DATA8(FILE,HIGH_VALUE,LOW_VALUE) \
- do { \
- if (WORDS_BIG_ENDIAN) \
- { \
- fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
- fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
- } \
- else \
- { \
- fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, LOW_VALUE);\
- fprintf ((FILE), "\t%s\t0x%x\n", UNALIGNED_INT_ASM_OP, HIGH_VALUE); \
- } \
- } while (0)
-#endif
-
-#ifndef ASM_OUTPUT_DWARF_STRING
-#define ASM_OUTPUT_DWARF_STRING(FILE,P) \
- ASM_OUTPUT_ASCII ((FILE), P, strlen (P)+1)
-#endif
-
-/************************ general utility functions **************************/
-
-inline int
-is_pseudo_reg (rtl)
- register rtx rtl;
-{
- return (((GET_CODE (rtl) == REG) && (REGNO (rtl) >= FIRST_PSEUDO_REGISTER))
- || ((GET_CODE (rtl) == SUBREG)
- && (REGNO (XEXP (rtl, 0)) >= FIRST_PSEUDO_REGISTER)));
-}
-
-inline tree
-type_main_variant (type)
- register tree type;
-{
- type = TYPE_MAIN_VARIANT (type);
-
- /* There really should be only one main variant among any group of variants
- of a given type (and all of the MAIN_VARIANT values for all members of
- the group should point to that one type) but sometimes the C front-end
- messes this up for array types, so we work around that bug here. */
-
- if (TREE_CODE (type) == ARRAY_TYPE)
- {
- while (type != TYPE_MAIN_VARIANT (type))
- type = TYPE_MAIN_VARIANT (type);
- }
-
- return type;
-}
-
-/* Return non-zero if the given type node represents a tagged type. */
-
-inline int
-is_tagged_type (type)
- register tree type;
-{
- register enum tree_code code = TREE_CODE (type);
-
- return (code == RECORD_TYPE || code == UNION_TYPE
- || code == QUAL_UNION_TYPE || code == ENUMERAL_TYPE);
-}
-
-static char *
-dwarf_tag_name (tag)
- register unsigned tag;
-{
- switch (tag)
- {
- case TAG_padding: return "TAG_padding";
- case TAG_array_type: return "TAG_array_type";
- case TAG_class_type: return "TAG_class_type";
- case TAG_entry_point: return "TAG_entry_point";
- case TAG_enumeration_type: return "TAG_enumeration_type";
- case TAG_formal_parameter: return "TAG_formal_parameter";
- case TAG_global_subroutine: return "TAG_global_subroutine";
- case TAG_global_variable: return "TAG_global_variable";
- case TAG_label: return "TAG_label";
- case TAG_lexical_block: return "TAG_lexical_block";
- case TAG_local_variable: return "TAG_local_variable";
- case TAG_member: return "TAG_member";
- case TAG_pointer_type: return "TAG_pointer_type";
- case TAG_reference_type: return "TAG_reference_type";
- case TAG_compile_unit: return "TAG_compile_unit";
- case TAG_string_type: return "TAG_string_type";
- case TAG_structure_type: return "TAG_structure_type";
- case TAG_subroutine: return "TAG_subroutine";
- case TAG_subroutine_type: return "TAG_subroutine_type";
- case TAG_typedef: return "TAG_typedef";
- case TAG_union_type: return "TAG_union_type";
- case TAG_unspecified_parameters: return "TAG_unspecified_parameters";
- case TAG_variant: return "TAG_variant";
- case TAG_common_block: return "TAG_common_block";
- case TAG_common_inclusion: return "TAG_common_inclusion";
- case TAG_inheritance: return "TAG_inheritance";
- case TAG_inlined_subroutine: return "TAG_inlined_subroutine";
- case TAG_module: return "TAG_module";
- case TAG_ptr_to_member_type: return "TAG_ptr_to_member_type";
- case TAG_set_type: return "TAG_set_type";
- case TAG_subrange_type: return "TAG_subrange_type";
- case TAG_with_stmt: return "TAG_with_stmt";
-
- /* GNU extensions. */
-
- case TAG_format_label: return "TAG_format_label";
- case TAG_namelist: return "TAG_namelist";
- case TAG_function_template: return "TAG_function_template";
- case TAG_class_template: return "TAG_class_template";
-
- default: return "TAG_<unknown>";
- }
-}
-
-static char *
-dwarf_attr_name (attr)
- register unsigned attr;
-{
- switch (attr)
- {
- case AT_sibling: return "AT_sibling";
- case AT_location: return "AT_location";
- case AT_name: return "AT_name";
- case AT_fund_type: return "AT_fund_type";
- case AT_mod_fund_type: return "AT_mod_fund_type";
- case AT_user_def_type: return "AT_user_def_type";
- case AT_mod_u_d_type: return "AT_mod_u_d_type";
- case AT_ordering: return "AT_ordering";
- case AT_subscr_data: return "AT_subscr_data";
- case AT_byte_size: return "AT_byte_size";
- case AT_bit_offset: return "AT_bit_offset";
- case AT_bit_size: return "AT_bit_size";
- case AT_element_list: return "AT_element_list";
- case AT_stmt_list: return "AT_stmt_list";
- case AT_low_pc: return "AT_low_pc";
- case AT_high_pc: return "AT_high_pc";
- case AT_language: return "AT_language";
- case AT_member: return "AT_member";
- case AT_discr: return "AT_discr";
- case AT_discr_value: return "AT_discr_value";
- case AT_string_length: return "AT_string_length";
- case AT_common_reference: return "AT_common_reference";
- case AT_comp_dir: return "AT_comp_dir";
- case AT_const_value_string: return "AT_const_value_string";
- case AT_const_value_data2: return "AT_const_value_data2";
- case AT_const_value_data4: return "AT_const_value_data4";
- case AT_const_value_data8: return "AT_const_value_data8";
- case AT_const_value_block2: return "AT_const_value_block2";
- case AT_const_value_block4: return "AT_const_value_block4";
- case AT_containing_type: return "AT_containing_type";
- case AT_default_value_addr: return "AT_default_value_addr";
- case AT_default_value_data2: return "AT_default_value_data2";
- case AT_default_value_data4: return "AT_default_value_data4";
- case AT_default_value_data8: return "AT_default_value_data8";
- case AT_default_value_string: return "AT_default_value_string";
- case AT_friends: return "AT_friends";
- case AT_inline: return "AT_inline";
- case AT_is_optional: return "AT_is_optional";
- case AT_lower_bound_ref: return "AT_lower_bound_ref";
- case AT_lower_bound_data2: return "AT_lower_bound_data2";
- case AT_lower_bound_data4: return "AT_lower_bound_data4";
- case AT_lower_bound_data8: return "AT_lower_bound_data8";
- case AT_private: return "AT_private";
- case AT_producer: return "AT_producer";
- case AT_program: return "AT_program";
- case AT_protected: return "AT_protected";
- case AT_prototyped: return "AT_prototyped";
- case AT_public: return "AT_public";
- case AT_pure_virtual: return "AT_pure_virtual";
- case AT_return_addr: return "AT_return_addr";
- case AT_abstract_origin: return "AT_abstract_origin";
- case AT_start_scope: return "AT_start_scope";
- case AT_stride_size: return "AT_stride_size";
- case AT_upper_bound_ref: return "AT_upper_bound_ref";
- case AT_upper_bound_data2: return "AT_upper_bound_data2";
- case AT_upper_bound_data4: return "AT_upper_bound_data4";
- case AT_upper_bound_data8: return "AT_upper_bound_data8";
- case AT_virtual: return "AT_virtual";
-
- /* GNU extensions */
-
- case AT_sf_names: return "AT_sf_names";
- case AT_src_info: return "AT_src_info";
- case AT_mac_info: return "AT_mac_info";
- case AT_src_coords: return "AT_src_coords";
- case AT_body_begin: return "AT_body_begin";
- case AT_body_end: return "AT_body_end";
-
- default: return "AT_<unknown>";
- }
-}
-
-static char *
-dwarf_stack_op_name (op)
- register unsigned op;
-{
- switch (op)
- {
- case OP_REG: return "OP_REG";
- case OP_BASEREG: return "OP_BASEREG";
- case OP_ADDR: return "OP_ADDR";
- case OP_CONST: return "OP_CONST";
- case OP_DEREF2: return "OP_DEREF2";
- case OP_DEREF4: return "OP_DEREF4";
- case OP_ADD: return "OP_ADD";
- default: return "OP_<unknown>";
- }
-}
-
-static char *
-dwarf_typemod_name (mod)
- register unsigned mod;
-{
- switch (mod)
- {
- case MOD_pointer_to: return "MOD_pointer_to";
- case MOD_reference_to: return "MOD_reference_to";
- case MOD_const: return "MOD_const";
- case MOD_volatile: return "MOD_volatile";
- default: return "MOD_<unknown>";
- }
-}
-
-static char *
-dwarf_fmt_byte_name (fmt)
- register unsigned fmt;
-{
- switch (fmt)
- {
- case FMT_FT_C_C: return "FMT_FT_C_C";
- case FMT_FT_C_X: return "FMT_FT_C_X";
- case FMT_FT_X_C: return "FMT_FT_X_C";
- case FMT_FT_X_X: return "FMT_FT_X_X";
- case FMT_UT_C_C: return "FMT_UT_C_C";
- case FMT_UT_C_X: return "FMT_UT_C_X";
- case FMT_UT_X_C: return "FMT_UT_X_C";
- case FMT_UT_X_X: return "FMT_UT_X_X";
- case FMT_ET: return "FMT_ET";
- default: return "FMT_<unknown>";
- }
-}
-
-static char *
-dwarf_fund_type_name (ft)
- register unsigned ft;
-{
- switch (ft)
- {
- case FT_char: return "FT_char";
- case FT_signed_char: return "FT_signed_char";
- case FT_unsigned_char: return "FT_unsigned_char";
- case FT_short: return "FT_short";
- case FT_signed_short: return "FT_signed_short";
- case FT_unsigned_short: return "FT_unsigned_short";
- case FT_integer: return "FT_integer";
- case FT_signed_integer: return "FT_signed_integer";
- case FT_unsigned_integer: return "FT_unsigned_integer";
- case FT_long: return "FT_long";
- case FT_signed_long: return "FT_signed_long";
- case FT_unsigned_long: return "FT_unsigned_long";
- case FT_pointer: return "FT_pointer";
- case FT_float: return "FT_float";
- case FT_dbl_prec_float: return "FT_dbl_prec_float";
- case FT_ext_prec_float: return "FT_ext_prec_float";
- case FT_complex: return "FT_complex";
- case FT_dbl_prec_complex: return "FT_dbl_prec_complex";
- case FT_void: return "FT_void";
- case FT_boolean: return "FT_boolean";
- case FT_ext_prec_complex: return "FT_ext_prec_complex";
- case FT_label: return "FT_label";
-
- /* GNU extensions. */
-
- case FT_long_long: return "FT_long_long";
- case FT_signed_long_long: return "FT_signed_long_long";
- case FT_unsigned_long_long: return "FT_unsigned_long_long";
-
- case FT_int8: return "FT_int8";
- case FT_signed_int8: return "FT_signed_int8";
- case FT_unsigned_int8: return "FT_unsigned_int8";
- case FT_int16: return "FT_int16";
- case FT_signed_int16: return "FT_signed_int16";
- case FT_unsigned_int16: return "FT_unsigned_int16";
- case FT_int32: return "FT_int32";
- case FT_signed_int32: return "FT_signed_int32";
- case FT_unsigned_int32: return "FT_unsigned_int32";
- case FT_int64: return "FT_int64";
- case FT_signed_int64: return "FT_signed_int64";
- case FT_unsigned_int64: return "FT_unsigned_int64";
-
- case FT_real32: return "FT_real32";
- case FT_real64: return "FT_real64";
- case FT_real96: return "FT_real96";
- case FT_real128: return "FT_real128";
-
- default: return "FT_<unknown>";
- }
-}
-
-/* Determine the "ultimate origin" of a decl. The decl may be an
- inlined instance of an inlined instance of a decl which is local
- to an inline function, so we have to trace all of the way back
- through the origin chain to find out what sort of node actually
- served as the original seed for the given block. */
-
-static tree
-decl_ultimate_origin (decl)
- register tree decl;
-{
- register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl);
-
- if (immediate_origin == NULL)
- return NULL;
- else
- {
- register tree ret_val;
- register tree lookahead = immediate_origin;
-
- do
- {
- ret_val = lookahead;
- lookahead = DECL_ABSTRACT_ORIGIN (ret_val);
- }
- while (lookahead != NULL && lookahead != ret_val);
- return ret_val;
- }
-}
-
-/* Determine the "ultimate origin" of a block. The block may be an
- inlined instance of an inlined instance of a block which is local
- to an inline function, so we have to trace all of the way back
- through the origin chain to find out what sort of node actually
- served as the original seed for the given block. */
-
-static tree
-block_ultimate_origin (block)
- register tree block;
-{
- register tree immediate_origin = BLOCK_ABSTRACT_ORIGIN (block);
-
- if (immediate_origin == NULL)
- return NULL;
- else
- {
- register tree ret_val;
- register tree lookahead = immediate_origin;
-
- do
- {
- ret_val = lookahead;
- lookahead = (TREE_CODE (ret_val) == BLOCK)
- ? BLOCK_ABSTRACT_ORIGIN (ret_val)
- : NULL;
- }
- while (lookahead != NULL && lookahead != ret_val);
- return ret_val;
- }
-}
-
-/* Get the class to which DECL belongs, if any. In g++, the DECL_CONTEXT
- of a virtual function may refer to a base class, so we check the 'this'
- parameter. */
-
-static tree
-decl_class_context (decl)
- tree decl;
-{
- tree context = NULL_TREE;
- if (TREE_CODE (decl) != FUNCTION_DECL || ! DECL_VINDEX (decl))
- context = DECL_CONTEXT (decl);
- else
- context = TYPE_MAIN_VARIANT
- (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
-
- if (context && TREE_CODE_CLASS (TREE_CODE (context)) != 't')
- context = NULL_TREE;
-
- return context;
-}
-
-static void
-output_unsigned_leb128 (value)
- register unsigned long value;
-{
- register unsigned long orig_value = value;
-
- do
- {
- register unsigned byte = (value & 0x7f);
-
- value >>= 7;
- if (value != 0) /* more bytes to follow */
- byte |= 0x80;
- fprintf (asm_out_file, "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) byte);
- if (flag_debug_asm && value == 0)
- fprintf (asm_out_file, "\t%s ULEB128 number - value = %u",
- ASM_COMMENT_START, orig_value);
- fputc ('\n', asm_out_file);
- }
- while (value != 0);
-}
-
-static void
-output_signed_leb128 (value)
- register long value;
-{
- register long orig_value = value;
- register int negative = (value < 0);
- register int more;
-
- do
- {
- register unsigned byte = (value & 0x7f);
-
- value >>= 7;
- if (negative)
- value |= 0xfe000000; /* manually sign extend */
- if (((value == 0) && ((byte & 0x40) == 0))
- || ((value == -1) && ((byte & 0x40) == 1)))
- more = 0;
- else
- {
- byte |= 0x80;
- more = 1;
- }
- fprintf (asm_out_file, "\t%s\t0x%x", ASM_BYTE_OP, (unsigned) byte);
- if (flag_debug_asm && more == 0)
- fprintf (asm_out_file, "\t%s SLEB128 number - value = %d",
- ASM_COMMENT_START, orig_value);
- fputc ('\n', asm_out_file);
- }
- while (more);
-}
-
-/**************** utility functions for attribute functions ******************/
-
-/* Given a pointer to a BLOCK node return non-zero if (and only if) the
- node in question represents the outermost pair of curly braces (i.e.
- the "body block") of a function or method.
-
- For any BLOCK node representing a "body block" of a function or method,
- the BLOCK_SUPERCONTEXT of the node will point to another BLOCK node
- which represents the outermost (function) scope for the function or
- method (i.e. the one which includes the formal parameters). The
- BLOCK_SUPERCONTEXT of *that* node in turn will point to the relevant
- FUNCTION_DECL node.
-*/
-
-static inline int
-is_body_block (stmt)
- register tree stmt;
-{
- if (TREE_CODE (stmt) == BLOCK)
- {
- register tree parent = BLOCK_SUPERCONTEXT (stmt);
-
- if (TREE_CODE (parent) == BLOCK)
- {
- register tree grandparent = BLOCK_SUPERCONTEXT (parent);
-
- if (TREE_CODE (grandparent) == FUNCTION_DECL)
- return 1;
- }
- }
- return 0;
-}
-
-/* Given a pointer to a tree node for some type, return a Dwarf fundamental
- type code for the given type.
-
- This routine must only be called for GCC type nodes that correspond to
- Dwarf fundamental types.
-
- The current Dwarf draft specification calls for Dwarf fundamental types
- to accurately reflect the fact that a given type was either a "plain"
- integral type or an explicitly "signed" integral type. Unfortunately,
- we can't always do this, because GCC may already have thrown away the
- information about the precise way in which the type was originally
- specified, as in:
-
- typedef signed int my_type;
-
- struct s { my_type f; };
-
- Since we may be stuck here without enought information to do exactly
- what is called for in the Dwarf draft specification, we do the best
- that we can under the circumstances and always use the "plain" integral
- fundamental type codes for int, short, and long types. That's probably
- good enough. The additional accuracy called for in the current DWARF
- draft specification is probably never even useful in practice. */
-
-static int
-fundamental_type_code (type)
- register tree type;
-{
- if (TREE_CODE (type) == ERROR_MARK)
- return 0;
-
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- return FT_void;
-
- case VOID_TYPE:
- return FT_void;
-
- case INTEGER_TYPE:
- /* Carefully distinguish all the standard types of C,
- without messing up if the language is not C.
- Note that we check only for the names that contain spaces;
- other names might occur by coincidence in other languages. */
- if (TYPE_NAME (type) != 0
- && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_NAME (TYPE_NAME (type)) != 0
- && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
- {
- char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
-
- if (!strcmp (name, "unsigned char"))
- return FT_unsigned_char;
- if (!strcmp (name, "signed char"))
- return FT_signed_char;
- if (!strcmp (name, "unsigned int"))
- return FT_unsigned_integer;
- if (!strcmp (name, "short int"))
- return FT_short;
- if (!strcmp (name, "short unsigned int"))
- return FT_unsigned_short;
- if (!strcmp (name, "long int"))
- return FT_long;
- if (!strcmp (name, "long unsigned int"))
- return FT_unsigned_long;
- if (!strcmp (name, "long long int"))
- return FT_long_long; /* Not grok'ed by svr4 SDB */
- if (!strcmp (name, "long long unsigned int"))
- return FT_unsigned_long_long; /* Not grok'ed by svr4 SDB */
- }
-
- /* Most integer types will be sorted out above, however, for the
- sake of special `array index' integer types, the following code
- is also provided. */
-
- if (TYPE_PRECISION (type) == INT_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? FT_unsigned_integer : FT_integer);
-
- if (TYPE_PRECISION (type) == LONG_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? FT_unsigned_long : FT_long);
-
- if (TYPE_PRECISION (type) == LONG_LONG_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? FT_unsigned_long_long : FT_long_long);
-
- if (TYPE_PRECISION (type) == SHORT_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? FT_unsigned_short : FT_short);
-
- if (TYPE_PRECISION (type) == CHAR_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? FT_unsigned_char : FT_char);
-
- abort ();
-
- case REAL_TYPE:
- /* Carefully distinguish all the standard types of C,
- without messing up if the language is not C. */
- if (TYPE_NAME (type) != 0
- && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_NAME (TYPE_NAME (type)) != 0
- && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
- {
- char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
-
- /* Note that here we can run afowl of a serious bug in "classic"
- svr4 SDB debuggers. They don't seem to understand the
- FT_ext_prec_float type (even though they should). */
-
- if (!strcmp (name, "long double"))
- return FT_ext_prec_float;
- }
-
- if (TYPE_PRECISION (type) == DOUBLE_TYPE_SIZE)
- return FT_dbl_prec_float;
- if (TYPE_PRECISION (type) == FLOAT_TYPE_SIZE)
- return FT_float;
-
- /* Note that here we can run afowl of a serious bug in "classic"
- svr4 SDB debuggers. They don't seem to understand the
- FT_ext_prec_float type (even though they should). */
-
- if (TYPE_PRECISION (type) == LONG_DOUBLE_TYPE_SIZE)
- return FT_ext_prec_float;
- abort ();
-
- case COMPLEX_TYPE:
- return FT_complex; /* GNU FORTRAN COMPLEX type. */
-
- case CHAR_TYPE:
- return FT_char; /* GNU Pascal CHAR type. Not used in C. */
-
- case BOOLEAN_TYPE:
- return FT_boolean; /* GNU FORTRAN BOOLEAN type. */
-
- default:
- abort (); /* No other TREE_CODEs are Dwarf fundamental types. */
- }
- return 0;
-}
-
-/* Given a pointer to an arbitrary ..._TYPE tree node, return a pointer to
- the Dwarf "root" type for the given input type. The Dwarf "root" type
- of a given type is generally the same as the given type, except that if
- the given type is a pointer or reference type, then the root type of
- the given type is the root type of the "basis" type for the pointer or
- reference type. (This definition of the "root" type is recursive.)
- Also, the root type of a `const' qualified type or a `volatile'
- qualified type is the root type of the given type without the
- qualifiers. */
-
-static tree
-root_type_1 (type, count)
- register tree type;
- register int count;
-{
- /* Give up after searching 1000 levels, in case this is a recursive
- pointer type. Such types are possible in Ada, but it is not possible
- to represent them in DWARF1 debug info. */
- if (count > 1000)
- return error_mark_node;
-
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- return error_mark_node;
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- return root_type_1 (TREE_TYPE (type), count+1);
-
- default:
- return type;
- }
-}
-
-static tree
-root_type (type)
- register tree type;
-{
- type = root_type_1 (type, 0);
- if (type != error_mark_node)
- type = type_main_variant (type);
- return type;
-}
-
-/* Given a pointer to an arbitrary ..._TYPE tree node, write out a sequence
- of zero or more Dwarf "type-modifier" bytes applicable to the type. */
-
-static void
-write_modifier_bytes_1 (type, decl_const, decl_volatile, count)
- register tree type;
- register int decl_const;
- register int decl_volatile;
- register int count;
-{
- if (TREE_CODE (type) == ERROR_MARK)
- return;
-
- /* Give up after searching 1000 levels, in case this is a recursive
- pointer type. Such types are possible in Ada, but it is not possible
- to represent them in DWARF1 debug info. */
- if (count > 1000)
- return;
-
- if (TYPE_READONLY (type) || decl_const)
- ASM_OUTPUT_DWARF_TYPE_MODIFIER (asm_out_file, MOD_const);
- if (TYPE_VOLATILE (type) || decl_volatile)
- ASM_OUTPUT_DWARF_TYPE_MODIFIER (asm_out_file, MOD_volatile);
- switch (TREE_CODE (type))
- {
- case POINTER_TYPE:
- ASM_OUTPUT_DWARF_TYPE_MODIFIER (asm_out_file, MOD_pointer_to);
- write_modifier_bytes_1 (TREE_TYPE (type), 0, 0, count+1);
- return;
-
- case REFERENCE_TYPE:
- ASM_OUTPUT_DWARF_TYPE_MODIFIER (asm_out_file, MOD_reference_to);
- write_modifier_bytes_1 (TREE_TYPE (type), 0, 0, count+1);
- return;
-
- case ERROR_MARK:
- default:
- return;
- }
-}
-
-static void
-write_modifier_bytes (type, decl_const, decl_volatile)
- register tree type;
- register int decl_const;
- register int decl_volatile;
-{
- write_modifier_bytes_1 (type, decl_const, decl_volatile, 0);
-}
-
-/* Given a pointer to an arbitrary ..._TYPE tree node, return non-zero if the
- given input type is a Dwarf "fundamental" type. Otherwise return zero. */
-
-static inline int
-type_is_fundamental (type)
- register tree type;
-{
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- case VOID_TYPE:
- case INTEGER_TYPE:
- case REAL_TYPE:
- case COMPLEX_TYPE:
- case BOOLEAN_TYPE:
- case CHAR_TYPE:
- return 1;
-
- case SET_TYPE:
- case ARRAY_TYPE:
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- case ENUMERAL_TYPE:
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- case FILE_TYPE:
- case OFFSET_TYPE:
- case LANG_TYPE:
- return 0;
-
- default:
- abort ();
- }
- return 0;
-}
-
-/* Given a pointer to some ..._DECL tree node, generate an assembly language
- equate directive which will associate a symbolic name with the current DIE.
-
- The name used is an artificial label generated from the DECL_UID number
- associated with the given decl node. The name it gets equated to is the
- symbolic label that we (previously) output at the start of the DIE that
- we are currently generating.
-
- Calling this function while generating some "decl related" form of DIE
- makes it possible to later refer to the DIE which represents the given
- decl simply by re-generating the symbolic name from the ..._DECL node's
- UID number. */
-
-static void
-equate_decl_number_to_die_number (decl)
- register tree decl;
-{
- /* In the case where we are generating a DIE for some ..._DECL node
- which represents either some inline function declaration or some
- entity declared within an inline function declaration/definition,
- setup a symbolic name for the current DIE so that we have a name
- for this DIE that we can easily refer to later on within
- AT_abstract_origin attributes. */
-
- char decl_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char die_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- sprintf (decl_label, DECL_NAME_FMT, DECL_UID (decl));
- sprintf (die_label, DIE_BEGIN_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DEF (asm_out_file, decl_label, die_label);
-}
-
-/* Given a pointer to some ..._TYPE tree node, generate an assembly language
- equate directive which will associate a symbolic name with the current DIE.
-
- The name used is an artificial label generated from the TYPE_UID number
- associated with the given type node. The name it gets equated to is the
- symbolic label that we (previously) output at the start of the DIE that
- we are currently generating.
-
- Calling this function while generating some "type related" form of DIE
- makes it easy to later refer to the DIE which represents the given type
- simply by re-generating the alternative name from the ..._TYPE node's
- UID number. */
-
-static inline void
-equate_type_number_to_die_number (type)
- register tree type;
-{
- char type_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char die_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- /* We are generating a DIE to represent the main variant of this type
- (i.e the type without any const or volatile qualifiers) so in order
- to get the equate to come out right, we need to get the main variant
- itself here. */
-
- type = type_main_variant (type);
-
- sprintf (type_label, TYPE_NAME_FMT, TYPE_UID (type));
- sprintf (die_label, DIE_BEGIN_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DEF (asm_out_file, type_label, die_label);
-}
-
-static void
-output_reg_number (rtl)
- register rtx rtl;
-{
- register unsigned regno = REGNO (rtl);
-
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- warning_with_decl (dwarf_last_decl, "internal regno botch: regno = %d\n",
- regno);
- regno = 0;
- }
- fprintf (asm_out_file, "\t%s\t0x%x",
- UNALIGNED_INT_ASM_OP, DBX_REGISTER_NUMBER (regno));
- if (flag_debug_asm)
- {
- fprintf (asm_out_file, "\t%s ", ASM_COMMENT_START);
- PRINT_REG (rtl, 0, asm_out_file);
- }
- fputc ('\n', asm_out_file);
-}
-
-/* The following routine is a nice and simple transducer. It converts the
- RTL for a variable or parameter (resident in memory) into an equivalent
- Dwarf representation of a mechanism for getting the address of that same
- variable onto the top of a hypothetical "address evaluation" stack.
-
- When creating memory location descriptors, we are effectively trans-
- forming the RTL for a memory-resident object into its Dwarf postfix
- expression equivalent. This routine just recursively descends an
- RTL tree, turning it into Dwarf postfix code as it goes. */
-
-static void
-output_mem_loc_descriptor (rtl)
- register rtx rtl;
-{
- /* Note that for a dynamically sized array, the location we will
- generate a description of here will be the lowest numbered location
- which is actually within the array. That's *not* necessarily the
- same as the zeroth element of the array. */
-
- switch (GET_CODE (rtl))
- {
- case SUBREG:
-
- /* The case of a subreg may arise when we have a local (register)
- variable or a formal (register) parameter which doesn't quite
- fill up an entire register. For now, just assume that it is
- legitimate to make the Dwarf info refer to the whole register
- which contains the given subreg. */
-
- rtl = XEXP (rtl, 0);
- /* Drop thru. */
-
- case REG:
-
- /* Whenever a register number forms a part of the description of
- the method for calculating the (dynamic) address of a memory
- resident object, DWARF rules require the register number to
- be referred to as a "base register". This distinction is not
- based in any way upon what category of register the hardware
- believes the given register belongs to. This is strictly
- DWARF terminology we're dealing with here.
-
- Note that in cases where the location of a memory-resident data
- object could be expressed as:
-
- OP_ADD (OP_BASEREG (basereg), OP_CONST (0))
-
- the actual DWARF location descriptor that we generate may just
- be OP_BASEREG (basereg). This may look deceptively like the
- object in question was allocated to a register (rather than
- in memory) so DWARF consumers need to be aware of the subtle
- distinction between OP_REG and OP_BASEREG. */
-
- ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_BASEREG);
- output_reg_number (rtl);
- break;
-
- case MEM:
- output_mem_loc_descriptor (XEXP (rtl, 0));
- ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_DEREF4);
- break;
-
- case CONST:
- case SYMBOL_REF:
- ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_ADDR);
- ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file, rtl);
- break;
-
- case PLUS:
- output_mem_loc_descriptor (XEXP (rtl, 0));
- output_mem_loc_descriptor (XEXP (rtl, 1));
- ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_ADD);
- break;
-
- case CONST_INT:
- ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_CONST);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, INTVAL (rtl));
- break;
-
- case MULT:
- /* If a pseudo-reg is optimized away, it is possible for it to
- be replaced with a MEM containing a multiply. Use a GNU extension
- to describe it. */
- output_mem_loc_descriptor (XEXP (rtl, 0));
- output_mem_loc_descriptor (XEXP (rtl, 1));
- ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_MULT);
- break;
-
- default:
- abort ();
- }
-}
-
-/* Output a proper Dwarf location descriptor for a variable or parameter
- which is either allocated in a register or in a memory location. For
- a register, we just generate an OP_REG and the register number. For a
- memory location we provide a Dwarf postfix expression describing how to
- generate the (dynamic) address of the object onto the address stack. */
-
-static void
-output_loc_descriptor (rtl)
- register rtx rtl;
-{
- switch (GET_CODE (rtl))
- {
- case SUBREG:
-
- /* The case of a subreg may arise when we have a local (register)
- variable or a formal (register) parameter which doesn't quite
- fill up an entire register. For now, just assume that it is
- legitimate to make the Dwarf info refer to the whole register
- which contains the given subreg. */
-
- rtl = XEXP (rtl, 0);
- /* Drop thru. */
-
- case REG:
- ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_REG);
- output_reg_number (rtl);
- break;
-
- case MEM:
- output_mem_loc_descriptor (XEXP (rtl, 0));
- break;
-
- default:
- abort (); /* Should never happen */
- }
-}
-
-/* Given a tree node describing an array bound (either lower or upper)
- output a representation for that bound. */
-
-static void
-output_bound_representation (bound, dim_num, u_or_l)
- register tree bound;
- register unsigned dim_num; /* For multi-dimensional arrays. */
- register char u_or_l; /* Designates upper or lower bound. */
-{
- switch (TREE_CODE (bound))
- {
-
- case ERROR_MARK:
- return;
-
- /* All fixed-bounds are represented by INTEGER_CST nodes. */
-
- case INTEGER_CST:
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
- (unsigned) TREE_INT_CST_LOW (bound));
- break;
-
- default:
-
- /* Dynamic bounds may be represented by NOP_EXPR nodes containing
- SAVE_EXPR nodes, in which case we can do something, or as
- an expression, which we cannot represent. */
- {
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- sprintf (begin_label, BOUND_BEGIN_LABEL_FMT,
- current_dienum, dim_num, u_or_l);
-
- sprintf (end_label, BOUND_END_LABEL_FMT,
- current_dienum, dim_num, u_or_l);
-
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, end_label, begin_label);
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
-
- /* If optimization is turned on, the SAVE_EXPRs that describe
- how to access the upper bound values are essentially bogus.
- They only describe (at best) how to get at these values at
- the points in the generated code right after they have just
- been computed. Worse yet, in the typical case, the upper
- bound values will not even *be* computed in the optimized
- code, so these SAVE_EXPRs are entirely bogus.
-
- In order to compensate for this fact, we check here to see
- if optimization is enabled, and if so, we effectively create
- an empty location description for the (unknown and unknowable)
- upper bound.
-
- This should not cause too much trouble for existing (stupid?)
- debuggers because they have to deal with empty upper bounds
- location descriptions anyway in order to be able to deal with
- incomplete array types.
-
- Of course an intelligent debugger (GDB?) should be able to
- comprehend that a missing upper bound specification in a
- array type used for a storage class `auto' local array variable
- indicates that the upper bound is both unknown (at compile-
- time) and unknowable (at run-time) due to optimization. */
-
- if (! optimize)
- {
- while (TREE_CODE (bound) == NOP_EXPR
- || TREE_CODE (bound) == CONVERT_EXPR)
- bound = TREE_OPERAND (bound, 0);
-
- if (TREE_CODE (bound) == SAVE_EXPR)
- output_loc_descriptor
- (eliminate_regs (SAVE_EXPR_RTL (bound), 0, NULL_RTX, 0));
- }
-
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
- }
- break;
-
- }
-}
-
-/* Recursive function to output a sequence of value/name pairs for
- enumeration constants in reversed order. This is called from
- enumeration_type_die. */
-
-static void
-output_enumeral_list (link)
- register tree link;
-{
- if (link)
- {
- output_enumeral_list (TREE_CHAIN (link));
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
- (unsigned) TREE_INT_CST_LOW (TREE_VALUE (link)));
- ASM_OUTPUT_DWARF_STRING (asm_out_file,
- IDENTIFIER_POINTER (TREE_PURPOSE (link)));
- }
-}
-
-/* Given an unsigned value, round it up to the lowest multiple of `boundary'
- which is not less than the value itself. */
-
-static inline unsigned
-ceiling (value, boundary)
- register unsigned value;
- register unsigned boundary;
-{
- return (((value + boundary - 1) / boundary) * boundary);
-}
-
-/* Given a pointer to what is assumed to be a FIELD_DECL node, return a
- pointer to the declared type for the relevant field variable, or return
- `integer_type_node' if the given node turns out to be an ERROR_MARK node. */
-
-static inline tree
-field_type (decl)
- register tree decl;
-{
- register tree type;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- return integer_type_node;
-
- type = DECL_BIT_FIELD_TYPE (decl);
- if (type == NULL)
- type = TREE_TYPE (decl);
- return type;
-}
-
-/* Given a pointer to a tree node, assumed to be some kind of a ..._TYPE
- node, return the alignment in bits for the type, or else return
- BITS_PER_WORD if the node actually turns out to be an ERROR_MARK node. */
-
-static inline unsigned
-simple_type_align_in_bits (type)
- register tree type;
-{
- return (TREE_CODE (type) != ERROR_MARK) ? TYPE_ALIGN (type) : BITS_PER_WORD;
-}
-
-/* Given a pointer to a tree node, assumed to be some kind of a ..._TYPE
- node, return the size in bits for the type if it is a constant, or
- else return the alignment for the type if the type's size is not
- constant, or else return BITS_PER_WORD if the type actually turns out
- to be an ERROR_MARK node. */
-
-static inline unsigned
-simple_type_size_in_bits (type)
- register tree type;
-{
- if (TREE_CODE (type) == ERROR_MARK)
- return BITS_PER_WORD;
- else
- {
- register tree type_size_tree = TYPE_SIZE (type);
-
- if (TREE_CODE (type_size_tree) != INTEGER_CST)
- return TYPE_ALIGN (type);
-
- return (unsigned) TREE_INT_CST_LOW (type_size_tree);
- }
-}
-
-/* Given a pointer to what is assumed to be a FIELD_DECL node, compute and
- return the byte offset of the lowest addressed byte of the "containing
- object" for the given FIELD_DECL, or return 0 if we are unable to deter-
- mine what that offset is, either because the argument turns out to be a
- pointer to an ERROR_MARK node, or because the offset is actually variable.
- (We can't handle the latter case just yet.) */
-
-static unsigned
-field_byte_offset (decl)
- register tree decl;
-{
- register unsigned type_align_in_bytes;
- register unsigned type_align_in_bits;
- register unsigned type_size_in_bits;
- register unsigned object_offset_in_align_units;
- register unsigned object_offset_in_bits;
- register unsigned object_offset_in_bytes;
- register tree type;
- register tree bitpos_tree;
- register tree field_size_tree;
- register unsigned bitpos_int;
- register unsigned deepest_bitpos;
- register unsigned field_size_in_bits;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- return 0;
-
- if (TREE_CODE (decl) != FIELD_DECL)
- abort ();
-
- type = field_type (decl);
-
- bitpos_tree = DECL_FIELD_BITPOS (decl);
- field_size_tree = DECL_SIZE (decl);
-
- /* We cannot yet cope with fields whose positions or sizes are variable,
- so for now, when we see such things, we simply return 0. Someday,
- we may be able to handle such cases, but it will be damn difficult. */
-
- if (TREE_CODE (bitpos_tree) != INTEGER_CST)
- return 0;
- bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
-
- if (TREE_CODE (field_size_tree) != INTEGER_CST)
- return 0;
- field_size_in_bits = (unsigned) TREE_INT_CST_LOW (field_size_tree);
-
- type_size_in_bits = simple_type_size_in_bits (type);
-
- type_align_in_bits = simple_type_align_in_bits (type);
- type_align_in_bytes = type_align_in_bits / BITS_PER_UNIT;
-
- /* Note that the GCC front-end doesn't make any attempt to keep track
- of the starting bit offset (relative to the start of the containing
- structure type) of the hypothetical "containing object" for a bit-
- field. Thus, when computing the byte offset value for the start of
- the "containing object" of a bit-field, we must deduce this infor-
- mation on our own.
-
- This can be rather tricky to do in some cases. For example, handling
- the following structure type definition when compiling for an i386/i486
- target (which only aligns long long's to 32-bit boundaries) can be very
- tricky:
-
- struct S {
- int field1;
- long long field2:31;
- };
-
- Fortunately, there is a simple rule-of-thumb which can be used in such
- cases. When compiling for an i386/i486, GCC will allocate 8 bytes for
- the structure shown above. It decides to do this based upon one simple
- rule for bit-field allocation. Quite simply, GCC allocates each "con-
- taining object" for each bit-field at the first (i.e. lowest addressed)
- legitimate alignment boundary (based upon the required minimum alignment
- for the declared type of the field) which it can possibly use, subject
- to the condition that there is still enough available space remaining
- in the containing object (when allocated at the selected point) to
- fully accommodate all of the bits of the bit-field itself.
-
- This simple rule makes it obvious why GCC allocates 8 bytes for each
- object of the structure type shown above. When looking for a place to
- allocate the "containing object" for `field2', the compiler simply tries
- to allocate a 64-bit "containing object" at each successive 32-bit
- boundary (starting at zero) until it finds a place to allocate that 64-
- bit field such that at least 31 contiguous (and previously unallocated)
- bits remain within that selected 64 bit field. (As it turns out, for
- the example above, the compiler finds that it is OK to allocate the
- "containing object" 64-bit field at bit-offset zero within the
- structure type.)
-
- Here we attempt to work backwards from the limited set of facts we're
- given, and we try to deduce from those facts, where GCC must have
- believed that the containing object started (within the structure type).
-
- The value we deduce is then used (by the callers of this routine) to
- generate AT_location and AT_bit_offset attributes for fields (both
- bit-fields and, in the case of AT_location, regular fields as well).
- */
-
- /* Figure out the bit-distance from the start of the structure to the
- "deepest" bit of the bit-field. */
- deepest_bitpos = bitpos_int + field_size_in_bits;
-
- /* This is the tricky part. Use some fancy footwork to deduce where the
- lowest addressed bit of the containing object must be. */
- object_offset_in_bits
- = ceiling (deepest_bitpos, type_align_in_bits) - type_size_in_bits;
-
- /* Compute the offset of the containing object in "alignment units". */
- object_offset_in_align_units = object_offset_in_bits / type_align_in_bits;
-
- /* Compute the offset of the containing object in bytes. */
- object_offset_in_bytes = object_offset_in_align_units * type_align_in_bytes;
-
- return object_offset_in_bytes;
-}
-
-/****************************** attributes *********************************/
-
-/* The following routines are responsible for writing out the various types
- of Dwarf attributes (and any following data bytes associated with them).
- These routines are listed in order based on the numerical codes of their
- associated attributes. */
-
-/* Generate an AT_sibling attribute. */
-
-static inline void
-sibling_attribute ()
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_sibling);
- sprintf (label, DIE_BEGIN_LABEL_FMT, NEXT_DIE_NUM);
- ASM_OUTPUT_DWARF_REF (asm_out_file, label);
-}
-
-/* Output the form of location attributes suitable for whole variables and
- whole parameters. Note that the location attributes for struct fields
- are generated by the routine `data_member_location_attribute' below. */
-
-static void
-location_attribute (rtl)
- register rtx rtl;
-{
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_location);
- sprintf (begin_label, LOC_BEGIN_LABEL_FMT, current_dienum);
- sprintf (end_label, LOC_END_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, end_label, begin_label);
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
-
- /* Handle a special case. If we are about to output a location descriptor
- for a variable or parameter which has been optimized out of existence,
- don't do that. Instead we output a zero-length location descriptor
- value as part of the location attribute.
-
- A variable which has been optimized out of existence will have a
- DECL_RTL value which denotes a pseudo-reg.
-
- Currently, in some rare cases, variables can have DECL_RTL values
- which look like (MEM (REG pseudo-reg#)). These cases are due to
- bugs elsewhere in the compiler. We treat such cases
- as if the variable(s) in question had been optimized out of existence.
-
- Note that in all cases where we wish to express the fact that a
- variable has been optimized out of existence, we do not simply
- suppress the generation of the entire location attribute because
- the absence of a location attribute in certain kinds of DIEs is
- used to indicate something else entirely... i.e. that the DIE
- represents an object declaration, but not a definition. So saith
- the PLSIG.
- */
-
- if (! is_pseudo_reg (rtl)
- && (GET_CODE (rtl) != MEM || ! is_pseudo_reg (XEXP (rtl, 0))))
- output_loc_descriptor (eliminate_regs (rtl, 0, NULL_RTX, 0));
-
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
-}
-
-/* Output the specialized form of location attribute used for data members
- of struct and union types.
-
- In the special case of a FIELD_DECL node which represents a bit-field,
- the "offset" part of this special location descriptor must indicate the
- distance in bytes from the lowest-addressed byte of the containing
- struct or union type to the lowest-addressed byte of the "containing
- object" for the bit-field. (See the `field_byte_offset' function above.)
-
- For any given bit-field, the "containing object" is a hypothetical
- object (of some integral or enum type) within which the given bit-field
- lives. The type of this hypothetical "containing object" is always the
- same as the declared type of the individual bit-field itself (for GCC
- anyway... the DWARF spec doesn't actually mandate this).
-
- Note that it is the size (in bytes) of the hypothetical "containing
- object" which will be given in the AT_byte_size attribute for this
- bit-field. (See the `byte_size_attribute' function below.) It is
- also used when calculating the value of the AT_bit_offset attribute.
- (See the `bit_offset_attribute' function below.) */
-
-static void
-data_member_location_attribute (t)
- register tree t;
-{
- register unsigned object_offset_in_bytes;
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- if (TREE_CODE (t) == TREE_VEC)
- object_offset_in_bytes = TREE_INT_CST_LOW (BINFO_OFFSET (t));
- else
- object_offset_in_bytes = field_byte_offset (t);
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_location);
- sprintf (begin_label, LOC_BEGIN_LABEL_FMT, current_dienum);
- sprintf (end_label, LOC_END_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, end_label, begin_label);
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
- ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_CONST);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, object_offset_in_bytes);
- ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_ADD);
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
-}
-
-/* Output an AT_const_value attribute for a variable or a parameter which
- does not have a "location" either in memory or in a register. These
- things can arise in GNU C when a constant is passed as an actual
- parameter to an inlined function. They can also arise in C++ where
- declared constants do not necessarily get memory "homes". */
-
-static void
-const_value_attribute (rtl)
- register rtx rtl;
-{
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_const_value_block4);
- sprintf (begin_label, LOC_BEGIN_LABEL_FMT, current_dienum);
- sprintf (end_label, LOC_END_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, end_label, begin_label);
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
-
- switch (GET_CODE (rtl))
- {
- case CONST_INT:
- /* Note that a CONST_INT rtx could represent either an integer or
- a floating-point constant. A CONST_INT is used whenever the
- constant will fit into a single word. In all such cases, the
- original mode of the constant value is wiped out, and the
- CONST_INT rtx is assigned VOIDmode. Since we no longer have
- precise mode information for these constants, we always just
- output them using 4 bytes. */
-
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, (unsigned) INTVAL (rtl));
- break;
-
- case CONST_DOUBLE:
- /* Note that a CONST_DOUBLE rtx could represent either an integer
- or a floating-point constant. A CONST_DOUBLE is used whenever
- the constant requires more than one word in order to be adequately
- represented. In all such cases, the original mode of the constant
- value is preserved as the mode of the CONST_DOUBLE rtx, but for
- simplicity we always just output CONST_DOUBLEs using 8 bytes. */
-
- ASM_OUTPUT_DWARF_DATA8 (asm_out_file,
- (unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (rtl),
- (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (rtl));
- break;
-
- case CONST_STRING:
- ASM_OUTPUT_DWARF_STRING (asm_out_file, XSTR (rtl, 0));
- break;
-
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST:
- ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file, rtl);
- break;
-
- case PLUS:
- /* In cases where an inlined instance of an inline function is passed
- the address of an `auto' variable (which is local to the caller)
- we can get a situation where the DECL_RTL of the artificial
- local variable (for the inlining) which acts as a stand-in for
- the corresponding formal parameter (of the inline function)
- will look like (plus:SI (reg:SI FRAME_PTR) (const_int ...)).
- This is not exactly a compile-time constant expression, but it
- isn't the address of the (artificial) local variable either.
- Rather, it represents the *value* which the artificial local
- variable always has during its lifetime. We currently have no
- way to represent such quasi-constant values in Dwarf, so for now
- we just punt and generate an AT_const_value attribute with form
- FORM_BLOCK4 and a length of zero. */
- break;
-
- default:
- abort (); /* No other kinds of rtx should be possible here. */
- }
-
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
-}
-
-/* Generate *either* an AT_location attribute or else an AT_const_value
- data attribute for a variable or a parameter. We generate the
- AT_const_value attribute only in those cases where the given
- variable or parameter does not have a true "location" either in
- memory or in a register. This can happen (for example) when a
- constant is passed as an actual argument in a call to an inline
- function. (It's possible that these things can crop up in other
- ways also.) Note that one type of constant value which can be
- passed into an inlined function is a constant pointer. This can
- happen for example if an actual argument in an inlined function
- call evaluates to a compile-time constant address. */
-
-static void
-location_or_const_value_attribute (decl)
- register tree decl;
-{
- register rtx rtl;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- return;
-
- if ((TREE_CODE (decl) != VAR_DECL) && (TREE_CODE (decl) != PARM_DECL))
- {
- /* Should never happen. */
- abort ();
- return;
- }
-
- /* Here we have to decide where we are going to say the parameter "lives"
- (as far as the debugger is concerned). We only have a couple of choices.
- GCC provides us with DECL_RTL and with DECL_INCOMING_RTL. DECL_RTL
- normally indicates where the parameter lives during most of the activa-
- tion of the function. If optimization is enabled however, this could
- be either NULL or else a pseudo-reg. Both of those cases indicate that
- the parameter doesn't really live anywhere (as far as the code generation
- parts of GCC are concerned) during most of the function's activation.
- That will happen (for example) if the parameter is never referenced
- within the function.
-
- We could just generate a location descriptor here for all non-NULL
- non-pseudo values of DECL_RTL and ignore all of the rest, but we can
- be a little nicer than that if we also consider DECL_INCOMING_RTL in
- cases where DECL_RTL is NULL or is a pseudo-reg.
-
- Note however that we can only get away with using DECL_INCOMING_RTL as
- a backup substitute for DECL_RTL in certain limited cases. In cases
- where DECL_ARG_TYPE(decl) indicates the same type as TREE_TYPE(decl)
- we can be sure that the parameter was passed using the same type as it
- is declared to have within the function, and that its DECL_INCOMING_RTL
- points us to a place where a value of that type is passed. In cases
- where DECL_ARG_TYPE(decl) and TREE_TYPE(decl) are different types
- however, we cannot (in general) use DECL_INCOMING_RTL as a backup
- substitute for DECL_RTL because in these cases, DECL_INCOMING_RTL
- points us to a value of some type which is *different* from the type
- of the parameter itself. Thus, if we tried to use DECL_INCOMING_RTL
- to generate a location attribute in such cases, the debugger would
- end up (for example) trying to fetch a `float' from a place which
- actually contains the first part of a `double'. That would lead to
- really incorrect and confusing output at debug-time, and we don't
- want that now do we?
-
- So in general, we DO NOT use DECL_INCOMING_RTL as a backup for DECL_RTL
- in cases where DECL_ARG_TYPE(decl) != TREE_TYPE(decl). There are a
- couple of cute exceptions however. On little-endian machines we can
- get away with using DECL_INCOMING_RTL even when DECL_ARG_TYPE(decl) is
- not the same as TREE_TYPE(decl) but only when DECL_ARG_TYPE(decl) is
- an integral type which is smaller than TREE_TYPE(decl). These cases
- arise when (on a little-endian machine) a non-prototyped function has
- a parameter declared to be of type `short' or `char'. In such cases,
- TREE_TYPE(decl) will be `short' or `char', DECL_ARG_TYPE(decl) will be
- `int', and DECL_INCOMING_RTL will point to the lowest-order byte of the
- passed `int' value. If the debugger then uses that address to fetch a
- `short' or a `char' (on a little-endian machine) the result will be the
- correct data, so we allow for such exceptional cases below.
-
- Note that our goal here is to describe the place where the given formal
- parameter lives during most of the function's activation (i.e. between
- the end of the prologue and the start of the epilogue). We'll do that
- as best as we can. Note however that if the given formal parameter is
- modified sometime during the execution of the function, then a stack
- backtrace (at debug-time) will show the function as having been called
- with the *new* value rather than the value which was originally passed
- in. This happens rarely enough that it is not a major problem, but it
- *is* a problem, and I'd like to fix it. A future version of dwarfout.c
- may generate two additional attributes for any given TAG_formal_parameter
- DIE which will describe the "passed type" and the "passed location" for
- the given formal parameter in addition to the attributes we now generate
- to indicate the "declared type" and the "active location" for each
- parameter. This additional set of attributes could be used by debuggers
- for stack backtraces.
-
- Separately, note that sometimes DECL_RTL can be NULL and DECL_INCOMING_RTL
- can be NULL also. This happens (for example) for inlined-instances of
- inline function formal parameters which are never referenced. This really
- shouldn't be happening. All PARM_DECL nodes should get valid non-NULL
- DECL_INCOMING_RTL values, but integrate.c doesn't currently generate
- these values for inlined instances of inline function parameters, so
- when we see such cases, we are just SOL (shit-out-of-luck) for the time
- being (until integrate.c gets fixed).
- */
-
- /* Use DECL_RTL as the "location" unless we find something better. */
- rtl = DECL_RTL (decl);
-
- if (TREE_CODE (decl) == PARM_DECL)
- if (rtl == NULL_RTX || is_pseudo_reg (rtl))
- {
- /* This decl represents a formal parameter which was optimized out. */
- register tree declared_type = type_main_variant (TREE_TYPE (decl));
- register tree passed_type = type_main_variant (DECL_ARG_TYPE (decl));
-
- /* Note that DECL_INCOMING_RTL may be NULL in here, but we handle
- *all* cases where (rtl == NULL_RTX) just below. */
-
- if (declared_type == passed_type)
- rtl = DECL_INCOMING_RTL (decl);
- else if (! BYTES_BIG_ENDIAN)
- if (TREE_CODE (declared_type) == INTEGER_TYPE)
- if (TYPE_SIZE (declared_type) <= TYPE_SIZE (passed_type))
- rtl = DECL_INCOMING_RTL (decl);
- }
-
- if (rtl == NULL_RTX)
- return;
-
- switch (GET_CODE (rtl))
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST_STRING:
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST:
- case PLUS: /* DECL_RTL could be (plus (reg ...) (const_int ...)) */
- const_value_attribute (rtl);
- break;
-
- case MEM:
- case REG:
- case SUBREG:
- location_attribute (rtl);
- break;
-
- case CONCAT:
- /* ??? CONCAT is used for complex variables, which may have the real
- part stored in one place and the imag part stored somewhere else.
- DWARF1 has no way to describe a variable that lives in two different
- places, so we just describe where the first part lives, and hope that
- the second part is stored after it. */
- location_attribute (XEXP (rtl, 0));
- break;
-
- default:
- abort (); /* Should never happen. */
- }
-}
-
-/* Generate an AT_name attribute given some string value to be included as
- the value of the attribute. */
-
-static inline void
-name_attribute (name_string)
- register char *name_string;
-{
- if (name_string && *name_string)
- {
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_name);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, name_string);
- }
-}
-
-static inline void
-fund_type_attribute (ft_code)
- register unsigned ft_code;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_fund_type);
- ASM_OUTPUT_DWARF_FUND_TYPE (asm_out_file, ft_code);
-}
-
-static void
-mod_fund_type_attribute (type, decl_const, decl_volatile)
- register tree type;
- register int decl_const;
- register int decl_volatile;
-{
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_mod_fund_type);
- sprintf (begin_label, MT_BEGIN_LABEL_FMT, current_dienum);
- sprintf (end_label, MT_END_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, end_label, begin_label);
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
- write_modifier_bytes (type, decl_const, decl_volatile);
- ASM_OUTPUT_DWARF_FUND_TYPE (asm_out_file,
- fundamental_type_code (root_type (type)));
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
-}
-
-static inline void
-user_def_type_attribute (type)
- register tree type;
-{
- char ud_type_name[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_user_def_type);
- sprintf (ud_type_name, TYPE_NAME_FMT, TYPE_UID (type));
- ASM_OUTPUT_DWARF_REF (asm_out_file, ud_type_name);
-}
-
-static void
-mod_u_d_type_attribute (type, decl_const, decl_volatile)
- register tree type;
- register int decl_const;
- register int decl_volatile;
-{
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char ud_type_name[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_mod_u_d_type);
- sprintf (begin_label, MT_BEGIN_LABEL_FMT, current_dienum);
- sprintf (end_label, MT_END_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, end_label, begin_label);
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
- write_modifier_bytes (type, decl_const, decl_volatile);
- sprintf (ud_type_name, TYPE_NAME_FMT, TYPE_UID (root_type (type)));
- ASM_OUTPUT_DWARF_REF (asm_out_file, ud_type_name);
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
-}
-
-#ifdef USE_ORDERING_ATTRIBUTE
-static inline void
-ordering_attribute (ordering)
- register unsigned ordering;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_ordering);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, ordering);
-}
-#endif /* defined(USE_ORDERING_ATTRIBUTE) */
-
-/* Note that the block of subscript information for an array type also
- includes information about the element type of type given array type. */
-
-static void
-subscript_data_attribute (type)
- register tree type;
-{
- register unsigned dimension_number;
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_subscr_data);
- sprintf (begin_label, SS_BEGIN_LABEL_FMT, current_dienum);
- sprintf (end_label, SS_END_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, end_label, begin_label);
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
-
- /* The GNU compilers represent multidimensional array types as sequences
- of one dimensional array types whose element types are themselves array
- types. Here we squish that down, so that each multidimensional array
- type gets only one array_type DIE in the Dwarf debugging info. The
- draft Dwarf specification say that we are allowed to do this kind
- of compression in C (because there is no difference between an
- array or arrays and a multidimensional array in C) but for other
- source languages (e.g. Ada) we probably shouldn't do this. */
-
- for (dimension_number = 0;
- TREE_CODE (type) == ARRAY_TYPE;
- type = TREE_TYPE (type), dimension_number++)
- {
- register tree domain = TYPE_DOMAIN (type);
-
- /* Arrays come in three flavors. Unspecified bounds, fixed
- bounds, and (in GNU C only) variable bounds. Handle all
- three forms here. */
-
- if (domain)
- {
- /* We have an array type with specified bounds. */
-
- register tree lower = TYPE_MIN_VALUE (domain);
- register tree upper = TYPE_MAX_VALUE (domain);
-
- /* Handle only fundamental types as index types for now. */
-
- if (! type_is_fundamental (domain))
- abort ();
-
- /* Output the representation format byte for this dimension. */
-
- ASM_OUTPUT_DWARF_FMT_BYTE (asm_out_file,
- FMT_CODE (1,
- TREE_CODE (lower) == INTEGER_CST,
- TREE_CODE (upper) == INTEGER_CST));
-
- /* Output the index type for this dimension. */
-
- ASM_OUTPUT_DWARF_FUND_TYPE (asm_out_file,
- fundamental_type_code (domain));
-
- /* Output the representation for the lower bound. */
-
- output_bound_representation (lower, dimension_number, 'l');
-
- /* Output the representation for the upper bound. */
-
- output_bound_representation (upper, dimension_number, 'u');
- }
- else
- {
- /* We have an array type with an unspecified length. For C and
- C++ we can assume that this really means that (a) the index
- type is an integral type, and (b) the lower bound is zero.
- Note that Dwarf defines the representation of an unspecified
- (upper) bound as being a zero-length location description. */
-
- /* Output the array-bounds format byte. */
-
- ASM_OUTPUT_DWARF_FMT_BYTE (asm_out_file, FMT_FT_C_X);
-
- /* Output the (assumed) index type. */
-
- ASM_OUTPUT_DWARF_FUND_TYPE (asm_out_file, FT_integer);
-
- /* Output the (assumed) lower bound (constant) value. */
-
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
-
- /* Output the (empty) location description for the upper bound. */
-
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, 0);
- }
- }
-
- /* Output the prefix byte that says that the element type is coming up. */
-
- ASM_OUTPUT_DWARF_FMT_BYTE (asm_out_file, FMT_ET);
-
- /* Output a representation of the type of the elements of this array type. */
-
- type_attribute (type, 0, 0);
-
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
-}
-
-static void
-byte_size_attribute (tree_node)
- register tree tree_node;
-{
- register unsigned size;
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_byte_size);
- switch (TREE_CODE (tree_node))
- {
- case ERROR_MARK:
- size = 0;
- break;
-
- case ENUMERAL_TYPE:
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- size = int_size_in_bytes (tree_node);
- break;
-
- case FIELD_DECL:
- /* For a data member of a struct or union, the AT_byte_size is
- generally given as the number of bytes normally allocated for
- an object of the *declared* type of the member itself. This
- is true even for bit-fields. */
- size = simple_type_size_in_bits (field_type (tree_node))
- / BITS_PER_UNIT;
- break;
-
- default:
- abort ();
- }
-
- /* Note that `size' might be -1 when we get to this point. If it
- is, that indicates that the byte size of the entity in question
- is variable. We have no good way of expressing this fact in Dwarf
- at the present time, so just let the -1 pass on through. */
-
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, size);
-}
-
-/* For a FIELD_DECL node which represents a bit-field, output an attribute
- which specifies the distance in bits from the highest order bit of the
- "containing object" for the bit-field to the highest order bit of the
- bit-field itself.
-
- For any given bit-field, the "containing object" is a hypothetical
- object (of some integral or enum type) within which the given bit-field
- lives. The type of this hypothetical "containing object" is always the
- same as the declared type of the individual bit-field itself.
-
- The determination of the exact location of the "containing object" for
- a bit-field is rather complicated. It's handled by the `field_byte_offset'
- function (above).
-
- Note that it is the size (in bytes) of the hypothetical "containing
- object" which will be given in the AT_byte_size attribute for this
- bit-field. (See `byte_size_attribute' above.) */
-
-static inline void
-bit_offset_attribute (decl)
- register tree decl;
-{
- register unsigned object_offset_in_bytes = field_byte_offset (decl);
- register tree type = DECL_BIT_FIELD_TYPE (decl);
- register tree bitpos_tree = DECL_FIELD_BITPOS (decl);
- register unsigned bitpos_int;
- register unsigned highest_order_object_bit_offset;
- register unsigned highest_order_field_bit_offset;
- register unsigned bit_offset;
-
- assert (TREE_CODE (decl) == FIELD_DECL); /* Must be a field. */
- assert (type); /* Must be a bit field. */
-
- /* We can't yet handle bit-fields whose offsets are variable, so if we
- encounter such things, just return without generating any attribute
- whatsoever. */
-
- if (TREE_CODE (bitpos_tree) != INTEGER_CST)
- return;
- bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
-
- /* Note that the bit offset is always the distance (in bits) from the
- highest-order bit of the "containing object" to the highest-order
- bit of the bit-field itself. Since the "high-order end" of any
- object or field is different on big-endian and little-endian machines,
- the computation below must take account of these differences. */
-
- highest_order_object_bit_offset = object_offset_in_bytes * BITS_PER_UNIT;
- highest_order_field_bit_offset = bitpos_int;
-
- if (! BYTES_BIG_ENDIAN)
- {
- highest_order_field_bit_offset
- += (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl));
-
- highest_order_object_bit_offset += simple_type_size_in_bits (type);
- }
-
- bit_offset =
- (! BYTES_BIG_ENDIAN
- ? highest_order_object_bit_offset - highest_order_field_bit_offset
- : highest_order_field_bit_offset - highest_order_object_bit_offset);
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_bit_offset);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, bit_offset);
-}
-
-/* For a FIELD_DECL node which represents a bit field, output an attribute
- which specifies the length in bits of the given field. */
-
-static inline void
-bit_size_attribute (decl)
- register tree decl;
-{
- assert (TREE_CODE (decl) == FIELD_DECL); /* Must be a field. */
- assert (DECL_BIT_FIELD_TYPE (decl)); /* Must be a bit field. */
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_bit_size);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
- (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl)));
-}
-
-/* The following routine outputs the `element_list' attribute for enumeration
- type DIEs. The element_lits attribute includes the names and values of
- all of the enumeration constants associated with the given enumeration
- type. */
-
-static inline void
-element_list_attribute (element)
- register tree element;
-{
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_element_list);
- sprintf (begin_label, EE_BEGIN_LABEL_FMT, current_dienum);
- sprintf (end_label, EE_END_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, end_label, begin_label);
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
-
- /* Here we output a list of value/name pairs for each enumeration constant
- defined for this enumeration type (as required), but we do it in REVERSE
- order. The order is the one required by the draft #5 Dwarf specification
- published by the UI/PLSIG. */
-
- output_enumeral_list (element); /* Recursively output the whole list. */
-
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
-}
-
-/* Generate an AT_stmt_list attribute. These are normally present only in
- DIEs with a TAG_compile_unit tag. */
-
-static inline void
-stmt_list_attribute (label)
- register char *label;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_stmt_list);
- /* Don't use ASM_OUTPUT_DWARF_DATA4 here. */
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, label);
-}
-
-/* Generate an AT_low_pc attribute for a label DIE, a lexical_block DIE or
- for a subroutine DIE. */
-
-static inline void
-low_pc_attribute (asm_low_label)
- register char *asm_low_label;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_low_pc);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, asm_low_label);
-}
-
-/* Generate an AT_high_pc attribute for a lexical_block DIE or for a
- subroutine DIE. */
-
-static inline void
-high_pc_attribute (asm_high_label)
- register char *asm_high_label;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_high_pc);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, asm_high_label);
-}
-
-/* Generate an AT_body_begin attribute for a subroutine DIE. */
-
-static inline void
-body_begin_attribute (asm_begin_label)
- register char *asm_begin_label;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_body_begin);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, asm_begin_label);
-}
-
-/* Generate an AT_body_end attribute for a subroutine DIE. */
-
-static inline void
-body_end_attribute (asm_end_label)
- register char *asm_end_label;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_body_end);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, asm_end_label);
-}
-
-/* Generate an AT_language attribute given a LANG value. These attributes
- are used only within TAG_compile_unit DIEs. */
-
-static inline void
-language_attribute (language_code)
- register unsigned language_code;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_language);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, language_code);
-}
-
-static inline void
-member_attribute (context)
- register tree context;
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- /* Generate this attribute only for members in C++. */
-
- if (context != NULL && is_tagged_type (context))
- {
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_member);
- sprintf (label, TYPE_NAME_FMT, TYPE_UID (context));
- ASM_OUTPUT_DWARF_REF (asm_out_file, label);
- }
-}
-
-static inline void
-string_length_attribute (upper_bound)
- register tree upper_bound;
-{
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_string_length);
- sprintf (begin_label, SL_BEGIN_LABEL_FMT, current_dienum);
- sprintf (end_label, SL_END_LABEL_FMT, current_dienum);
- ASM_OUTPUT_DWARF_DELTA2 (asm_out_file, end_label, begin_label);
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
- output_bound_representation (upper_bound, 0, 'u');
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
-}
-
-static inline void
-comp_dir_attribute (dirname)
- register char *dirname;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_comp_dir);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, dirname);
-}
-
-static inline void
-sf_names_attribute (sf_names_start_label)
- register char *sf_names_start_label;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_sf_names);
- /* Don't use ASM_OUTPUT_DWARF_DATA4 here. */
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, sf_names_start_label);
-}
-
-static inline void
-src_info_attribute (src_info_start_label)
- register char *src_info_start_label;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_src_info);
- /* Don't use ASM_OUTPUT_DWARF_DATA4 here. */
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, src_info_start_label);
-}
-
-static inline void
-mac_info_attribute (mac_info_start_label)
- register char *mac_info_start_label;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_mac_info);
- /* Don't use ASM_OUTPUT_DWARF_DATA4 here. */
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, mac_info_start_label);
-}
-
-static inline void
-prototyped_attribute (func_type)
- register tree func_type;
-{
- if ((strcmp (language_string, "GNU C") == 0)
- && (TYPE_ARG_TYPES (func_type) != NULL))
- {
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_prototyped);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
- }
-}
-
-static inline void
-producer_attribute (producer)
- register char *producer;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_producer);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, producer);
-}
-
-static inline void
-inline_attribute (decl)
- register tree decl;
-{
- if (DECL_INLINE (decl))
- {
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_inline);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
- }
-}
-
-static inline void
-containing_type_attribute (containing_type)
- register tree containing_type;
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_containing_type);
- sprintf (label, TYPE_NAME_FMT, TYPE_UID (containing_type));
- ASM_OUTPUT_DWARF_REF (asm_out_file, label);
-}
-
-static inline void
-abstract_origin_attribute (origin)
- register tree origin;
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_abstract_origin);
- switch (TREE_CODE_CLASS (TREE_CODE (origin)))
- {
- case 'd':
- sprintf (label, DECL_NAME_FMT, DECL_UID (origin));
- break;
-
- case 't':
- sprintf (label, TYPE_NAME_FMT, TYPE_UID (origin));
- break;
-
- default:
- abort (); /* Should never happen. */
-
- }
- ASM_OUTPUT_DWARF_REF (asm_out_file, label);
-}
-
-#ifdef DWARF_DECL_COORDINATES
-static inline void
-src_coords_attribute (src_fileno, src_lineno)
- register unsigned src_fileno;
- register unsigned src_lineno;
-{
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_src_coords);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, src_fileno);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, src_lineno);
-}
-#endif /* defined(DWARF_DECL_COORDINATES) */
-
-static inline void
-pure_or_virtual_attribute (func_decl)
- register tree func_decl;
-{
- if (DECL_VIRTUAL_P (func_decl))
- {
-#if 0 /* DECL_ABSTRACT_VIRTUAL_P is C++-specific. */
- if (DECL_ABSTRACT_VIRTUAL_P (func_decl))
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_pure_virtual);
- else
-#endif
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
- }
-}
-
-/************************* end of attributes *****************************/
-
-/********************* utility routines for DIEs *************************/
-
-/* Output an AT_name attribute and an AT_src_coords attribute for the
- given decl, but only if it actually has a name. */
-
-static void
-name_and_src_coords_attributes (decl)
- register tree decl;
-{
- register tree decl_name = DECL_NAME (decl);
-
- if (decl_name && IDENTIFIER_POINTER (decl_name))
- {
- name_attribute (IDENTIFIER_POINTER (decl_name));
-#ifdef DWARF_DECL_COORDINATES
- {
- register unsigned file_index;
-
- /* This is annoying, but we have to pop out of the .debug section
- for a moment while we call `lookup_filename' because calling it
- may cause a temporary switch into the .debug_sfnames section and
- most svr4 assemblers are not smart enough be be able to nest
- section switches to any depth greater than one. Note that we
- also can't skirt this issue by delaying all output to the
- .debug_sfnames section unit the end of compilation because that
- would cause us to have inter-section forward references and
- Fred Fish sez that m68k/svr4 assemblers botch those. */
-
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- file_index = lookup_filename (DECL_SOURCE_FILE (decl));
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION);
-
- src_coords_attribute (file_index, DECL_SOURCE_LINE (decl));
- }
-#endif /* defined(DWARF_DECL_COORDINATES) */
- }
-}
-
-/* Many forms of DIEs contain a "type description" part. The following
- routine writes out these "type descriptor" parts. */
-
-static void
-type_attribute (type, decl_const, decl_volatile)
- register tree type;
- register int decl_const;
- register int decl_volatile;
-{
- register enum tree_code code = TREE_CODE (type);
- register int root_type_modified;
-
- if (code == ERROR_MARK)
- return;
-
- /* Handle a special case. For functions whose return type is void,
- we generate *no* type attribute. (Note that no object may have
- type `void', so this only applies to function return types. */
-
- if (code == VOID_TYPE)
- return;
-
- /* If this is a subtype, find the underlying type. Eventually,
- this should write out the appropriate subtype info. */
- while ((code == INTEGER_TYPE || code == REAL_TYPE)
- && TREE_TYPE (type) != 0)
- type = TREE_TYPE (type), code = TREE_CODE (type);
-
- root_type_modified = (code == POINTER_TYPE || code == REFERENCE_TYPE
- || decl_const || decl_volatile
- || TYPE_READONLY (type) || TYPE_VOLATILE (type));
-
- if (type_is_fundamental (root_type (type)))
- if (root_type_modified)
- mod_fund_type_attribute (type, decl_const, decl_volatile);
- else
- fund_type_attribute (fundamental_type_code (type));
- else
- if (root_type_modified)
- mod_u_d_type_attribute (type, decl_const, decl_volatile);
- else
- /* We have to get the type_main_variant here (and pass that to the
- `user_def_type_attribute' routine) because the ..._TYPE node we
- have might simply be a *copy* of some original type node (where
- the copy was created to help us keep track of typedef names)
- and that copy might have a different TYPE_UID from the original
- ..._TYPE node. (Note that when `equate_type_number_to_die_number'
- is labeling a given type DIE for future reference, it always and
- only creates labels for DIEs representing *main variants*, and it
- never even knows about non-main-variants.) */
- user_def_type_attribute (type_main_variant (type));
-}
-
-/* Given a tree pointer to a struct, class, union, or enum type node, return
- a pointer to the (string) tag name for the given type, or zero if the
- type was declared without a tag. */
-
-static char *
-type_tag (type)
- register tree type;
-{
- register char *name = 0;
-
- if (TYPE_NAME (type) != 0)
- {
- register tree t = 0;
-
- /* Find the IDENTIFIER_NODE for the type name. */
- if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- t = TYPE_NAME (type);
-
- /* The g++ front end makes the TYPE_NAME of *each* tagged type point to
- a TYPE_DECL node, regardless of whether or not a `typedef' was
- involved. */
- else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && ! DECL_IGNORED_P (TYPE_NAME (type)))
- t = DECL_NAME (TYPE_NAME (type));
-
- /* Now get the name as a string, or invent one. */
- if (t != 0)
- name = IDENTIFIER_POINTER (t);
- }
-
- return (name == 0 || *name == '\0') ? 0 : name;
-}
-
-static inline void
-dienum_push ()
-{
- /* Start by checking if the pending_sibling_stack needs to be expanded.
- If necessary, expand it. */
-
- if (pending_siblings == pending_siblings_allocated)
- {
- pending_siblings_allocated += PENDING_SIBLINGS_INCREMENT;
- pending_sibling_stack
- = (unsigned *) xrealloc (pending_sibling_stack,
- pending_siblings_allocated * sizeof(unsigned));
- }
-
- pending_siblings++;
- NEXT_DIE_NUM = next_unused_dienum++;
-}
-
-/* Pop the sibling stack so that the most recently pushed DIEnum becomes the
- NEXT_DIE_NUM. */
-
-static inline void
-dienum_pop ()
-{
- pending_siblings--;
-}
-
-static inline tree
-member_declared_type (member)
- register tree member;
-{
- return (DECL_BIT_FIELD_TYPE (member))
- ? DECL_BIT_FIELD_TYPE (member)
- : TREE_TYPE (member);
-}
-
-/* Get the function's label, as described by its RTL.
- This may be different from the DECL_NAME name used
- in the source file. */
-
-static char *
-function_start_label (decl)
- register tree decl;
-{
- rtx x;
- char *fnname;
-
- x = DECL_RTL (decl);
- if (GET_CODE (x) != MEM)
- abort ();
- x = XEXP (x, 0);
- if (GET_CODE (x) != SYMBOL_REF)
- abort ();
- fnname = XSTR (x, 0);
- return fnname;
-}
-
-
-/******************************* DIEs ************************************/
-
-/* Output routines for individual types of DIEs. */
-
-/* Note that every type of DIE (except a null DIE) gets a sibling. */
-
-static void
-output_array_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_array_type);
- sibling_attribute ();
- equate_type_number_to_die_number (type);
- member_attribute (TYPE_CONTEXT (type));
-
- /* I believe that we can default the array ordering. SDB will probably
- do the right things even if AT_ordering is not present. It's not
- even an issue until we start to get into multidimensional arrays
- anyway. If SDB is ever caught doing the Wrong Thing for multi-
- dimensional arrays, then we'll have to put the AT_ordering attribute
- back in. (But if and when we find out that we need to put these in,
- we will only do so for multidimensional arrays. After all, we don't
- want to waste space in the .debug section now do we?) */
-
-#ifdef USE_ORDERING_ATTRIBUTE
- ordering_attribute (ORD_row_major);
-#endif /* defined(USE_ORDERING_ATTRIBUTE) */
-
- subscript_data_attribute (type);
-}
-
-static void
-output_set_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_set_type);
- sibling_attribute ();
- equate_type_number_to_die_number (type);
- member_attribute (TYPE_CONTEXT (type));
- type_attribute (TREE_TYPE (type), 0, 0);
-}
-
-#if 0
-/* Implement this when there is a GNU FORTRAN or GNU Ada front end. */
-
-static void
-output_entry_point_die (arg)
- register void *arg;
-{
- register tree decl = arg;
- register tree origin = decl_ultimate_origin (decl);
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_entry_point);
- sibling_attribute ();
- dienum_push ();
- if (origin != NULL)
- abstract_origin_attribute (origin);
- else
- {
- name_and_src_coords_attributes (decl);
- member_attribute (DECL_CONTEXT (decl));
- type_attribute (TREE_TYPE (TREE_TYPE (decl)), 0, 0);
- }
- if (DECL_ABSTRACT (decl))
- equate_decl_number_to_die_number (decl);
- else
- low_pc_attribute (function_start_label (decl));
-}
-#endif
-
-/* Output a DIE to represent an inlined instance of an enumeration type. */
-
-static void
-output_inlined_enumeration_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_enumeration_type);
- sibling_attribute ();
- assert (TREE_ASM_WRITTEN (type));
- abstract_origin_attribute (type);
-}
-
-/* Output a DIE to represent an inlined instance of a structure type. */
-
-static void
-output_inlined_structure_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_structure_type);
- sibling_attribute ();
- assert (TREE_ASM_WRITTEN (type));
- abstract_origin_attribute (type);
-}
-
-/* Output a DIE to represent an inlined instance of a union type. */
-
-static void
-output_inlined_union_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_union_type);
- sibling_attribute ();
- assert (TREE_ASM_WRITTEN (type));
- abstract_origin_attribute (type);
-}
-
-/* Output a DIE to represent an enumeration type. Note that these DIEs
- include all of the information about the enumeration values also.
- This information is encoded into the element_list attribute. */
-
-static void
-output_enumeration_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_enumeration_type);
- sibling_attribute ();
- equate_type_number_to_die_number (type);
- name_attribute (type_tag (type));
- member_attribute (TYPE_CONTEXT (type));
-
- /* Handle a GNU C/C++ extension, i.e. incomplete enum types. If the
- given enum type is incomplete, do not generate the AT_byte_size
- attribute or the AT_element_list attribute. */
-
- if (TYPE_SIZE (type))
- {
- byte_size_attribute (type);
- element_list_attribute (TYPE_FIELDS (type));
- }
-}
-
-/* Output a DIE to represent either a real live formal parameter decl or
- to represent just the type of some formal parameter position in some
- function type.
-
- Note that this routine is a bit unusual because its argument may be
- a ..._DECL node (i.e. either a PARM_DECL or perhaps a VAR_DECL which
- represents an inlining of some PARM_DECL) or else some sort of a
- ..._TYPE node. If it's the former then this function is being called
- to output a DIE to represent a formal parameter object (or some inlining
- thereof). If it's the latter, then this function is only being called
- to output a TAG_formal_parameter DIE to stand as a placeholder for some
- formal argument type of some subprogram type. */
-
-static void
-output_formal_parameter_die (arg)
- register void *arg;
-{
- register tree node = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_formal_parameter);
- sibling_attribute ();
-
- switch (TREE_CODE_CLASS (TREE_CODE (node)))
- {
- case 'd': /* We were called with some kind of a ..._DECL node. */
- {
- register tree origin = decl_ultimate_origin (node);
-
- if (origin != NULL)
- abstract_origin_attribute (origin);
- else
- {
- name_and_src_coords_attributes (node);
- type_attribute (TREE_TYPE (node),
- TREE_READONLY (node), TREE_THIS_VOLATILE (node));
- }
- if (DECL_ABSTRACT (node))
- equate_decl_number_to_die_number (node);
- else
- location_or_const_value_attribute (node);
- }
- break;
-
- case 't': /* We were called with some kind of a ..._TYPE node. */
- type_attribute (node, 0, 0);
- break;
-
- default:
- abort (); /* Should never happen. */
- }
-}
-
-/* Output a DIE to represent a declared function (either file-scope
- or block-local) which has "external linkage" (according to ANSI-C). */
-
-static void
-output_global_subroutine_die (arg)
- register void *arg;
-{
- register tree decl = arg;
- register tree origin = decl_ultimate_origin (decl);
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_global_subroutine);
- sibling_attribute ();
- dienum_push ();
- if (origin != NULL)
- abstract_origin_attribute (origin);
- else
- {
- register tree type = TREE_TYPE (decl);
-
- name_and_src_coords_attributes (decl);
- inline_attribute (decl);
- prototyped_attribute (type);
- member_attribute (DECL_CONTEXT (decl));
- type_attribute (TREE_TYPE (type), 0, 0);
- pure_or_virtual_attribute (decl);
- }
- if (DECL_ABSTRACT (decl))
- equate_decl_number_to_die_number (decl);
- else
- {
- if (! DECL_EXTERNAL (decl) && ! in_class
- && decl == current_function_decl)
- {
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- low_pc_attribute (function_start_label (decl));
- sprintf (label, FUNC_END_LABEL_FMT, current_funcdef_number);
- high_pc_attribute (label);
- if (use_gnu_debug_info_extensions)
- {
- sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
- body_begin_attribute (label);
- sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
- body_end_attribute (label);
- }
- }
- }
-}
-
-/* Output a DIE to represent a declared data object (either file-scope
- or block-local) which has "external linkage" (according to ANSI-C). */
-
-static void
-output_global_variable_die (arg)
- register void *arg;
-{
- register tree decl = arg;
- register tree origin = decl_ultimate_origin (decl);
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_global_variable);
- sibling_attribute ();
- if (origin != NULL)
- abstract_origin_attribute (origin);
- else
- {
- name_and_src_coords_attributes (decl);
- member_attribute (DECL_CONTEXT (decl));
- type_attribute (TREE_TYPE (decl),
- TREE_READONLY (decl), TREE_THIS_VOLATILE (decl));
- }
- if (DECL_ABSTRACT (decl))
- equate_decl_number_to_die_number (decl);
- else
- {
- if (! DECL_EXTERNAL (decl) && ! in_class
- && current_function_decl == decl_function_context (decl))
- location_or_const_value_attribute (decl);
- }
-}
-
-static void
-output_label_die (arg)
- register void *arg;
-{
- register tree decl = arg;
- register tree origin = decl_ultimate_origin (decl);
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_label);
- sibling_attribute ();
- if (origin != NULL)
- abstract_origin_attribute (origin);
- else
- name_and_src_coords_attributes (decl);
- if (DECL_ABSTRACT (decl))
- equate_decl_number_to_die_number (decl);
- else
- {
- register rtx insn = DECL_RTL (decl);
-
- if (GET_CODE (insn) == CODE_LABEL)
- {
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- /* When optimization is enabled (via -O) some parts of the compiler
- (e.g. jump.c and cse.c) may try to delete CODE_LABEL insns which
- represent source-level labels which were explicitly declared by
- the user. This really shouldn't be happening though, so catch
- it if it ever does happen. */
-
- if (INSN_DELETED_P (insn))
- abort (); /* Should never happen. */
-
- sprintf (label, INSN_LABEL_FMT, current_funcdef_number,
- (unsigned) INSN_UID (insn));
- low_pc_attribute (label);
- }
- }
-}
-
-static void
-output_lexical_block_die (arg)
- register void *arg;
-{
- register tree stmt = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_lexical_block);
- sibling_attribute ();
- dienum_push ();
- if (! BLOCK_ABSTRACT (stmt))
- {
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- sprintf (begin_label, BLOCK_BEGIN_LABEL_FMT, next_block_number);
- low_pc_attribute (begin_label);
- sprintf (end_label, BLOCK_END_LABEL_FMT, next_block_number);
- high_pc_attribute (end_label);
- }
-}
-
-static void
-output_inlined_subroutine_die (arg)
- register void *arg;
-{
- register tree stmt = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_inlined_subroutine);
- sibling_attribute ();
- dienum_push ();
- abstract_origin_attribute (block_ultimate_origin (stmt));
- if (! BLOCK_ABSTRACT (stmt))
- {
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- sprintf (begin_label, BLOCK_BEGIN_LABEL_FMT, next_block_number);
- low_pc_attribute (begin_label);
- sprintf (end_label, BLOCK_END_LABEL_FMT, next_block_number);
- high_pc_attribute (end_label);
- }
-}
-
-/* Output a DIE to represent a declared data object (either file-scope
- or block-local) which has "internal linkage" (according to ANSI-C). */
-
-static void
-output_local_variable_die (arg)
- register void *arg;
-{
- register tree decl = arg;
- register tree origin = decl_ultimate_origin (decl);
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_local_variable);
- sibling_attribute ();
- if (origin != NULL)
- abstract_origin_attribute (origin);
- else
- {
- name_and_src_coords_attributes (decl);
- member_attribute (DECL_CONTEXT (decl));
- type_attribute (TREE_TYPE (decl),
- TREE_READONLY (decl), TREE_THIS_VOLATILE (decl));
- }
- if (DECL_ABSTRACT (decl))
- equate_decl_number_to_die_number (decl);
- else
- location_or_const_value_attribute (decl);
-}
-
-static void
-output_member_die (arg)
- register void *arg;
-{
- register tree decl = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_member);
- sibling_attribute ();
- name_and_src_coords_attributes (decl);
- member_attribute (DECL_CONTEXT (decl));
- type_attribute (member_declared_type (decl),
- TREE_READONLY (decl), TREE_THIS_VOLATILE (decl));
- if (DECL_BIT_FIELD_TYPE (decl)) /* If this is a bit field... */
- {
- byte_size_attribute (decl);
- bit_size_attribute (decl);
- bit_offset_attribute (decl);
- }
- data_member_location_attribute (decl);
-}
-
-#if 0
-/* Don't generate either pointer_type DIEs or reference_type DIEs. Use
- modified types instead.
-
- We keep this code here just in case these types of DIEs may be
- needed to represent certain things in other languages (e.g. Pascal)
- someday. */
-
-static void
-output_pointer_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_pointer_type);
- sibling_attribute ();
- equate_type_number_to_die_number (type);
- member_attribute (TYPE_CONTEXT (type));
- type_attribute (TREE_TYPE (type), 0, 0);
-}
-
-static void
-output_reference_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_reference_type);
- sibling_attribute ();
- equate_type_number_to_die_number (type);
- member_attribute (TYPE_CONTEXT (type));
- type_attribute (TREE_TYPE (type), 0, 0);
-}
-#endif
-
-static void
-output_ptr_to_mbr_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_ptr_to_member_type);
- sibling_attribute ();
- equate_type_number_to_die_number (type);
- member_attribute (TYPE_CONTEXT (type));
- containing_type_attribute (TYPE_OFFSET_BASETYPE (type));
- type_attribute (TREE_TYPE (type), 0, 0);
-}
-
-static void
-output_compile_unit_die (arg)
- register void *arg;
-{
- register char *main_input_filename = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_compile_unit);
- sibling_attribute ();
- dienum_push ();
- name_attribute (main_input_filename);
-
- {
- char producer[250];
-
- sprintf (producer, "%s %s", language_string, version_string);
- producer_attribute (producer);
- }
-
- if (strcmp (language_string, "GNU C++") == 0)
- language_attribute (LANG_C_PLUS_PLUS);
- else if (strcmp (language_string, "GNU Ada") == 0)
- language_attribute (LANG_ADA83);
- else if (strcmp (language_string, "GNU F77") == 0)
- language_attribute (LANG_FORTRAN77);
- else if (flag_traditional)
- language_attribute (LANG_C);
- else
- language_attribute (LANG_C89);
- low_pc_attribute (TEXT_BEGIN_LABEL);
- high_pc_attribute (TEXT_END_LABEL);
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- stmt_list_attribute (LINE_BEGIN_LABEL);
- last_filename = xstrdup (main_input_filename);
-
- {
- char *wd = getpwd ();
- if (wd)
- comp_dir_attribute (wd);
- }
-
- if (debug_info_level >= DINFO_LEVEL_NORMAL && use_gnu_debug_info_extensions)
- {
- sf_names_attribute (SFNAMES_BEGIN_LABEL);
- src_info_attribute (SRCINFO_BEGIN_LABEL);
- if (debug_info_level >= DINFO_LEVEL_VERBOSE)
- mac_info_attribute (MACINFO_BEGIN_LABEL);
- }
-}
-
-static void
-output_string_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_string_type);
- sibling_attribute ();
- member_attribute (TYPE_CONTEXT (type));
-
- /* Fudge the string length attribute for now. */
-
- string_length_attribute (TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
-}
-
-static void
-output_inheritance_die (arg)
- register void *arg;
-{
- register tree binfo = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_inheritance);
- sibling_attribute ();
- type_attribute (BINFO_TYPE (binfo), 0, 0);
- data_member_location_attribute (binfo);
- if (TREE_VIA_VIRTUAL (binfo))
- {
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
- }
- if (TREE_VIA_PUBLIC (binfo))
- {
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_public);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
- }
- else if (TREE_VIA_PROTECTED (binfo))
- {
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_protected);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
- }
-}
-
-static void
-output_structure_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_structure_type);
- sibling_attribute ();
- equate_type_number_to_die_number (type);
- name_attribute (type_tag (type));
- member_attribute (TYPE_CONTEXT (type));
-
- /* If this type has been completed, then give it a byte_size attribute
- and prepare to give a list of members. Otherwise, don't do either of
- these things. In the latter case, we will not be generating a list
- of members (since we don't have any idea what they might be for an
- incomplete type). */
-
- if (TYPE_SIZE (type))
- {
- dienum_push ();
- byte_size_attribute (type);
- }
-}
-
-/* Output a DIE to represent a declared function (either file-scope
- or block-local) which has "internal linkage" (according to ANSI-C). */
-
-static void
-output_local_subroutine_die (arg)
- register void *arg;
-{
- register tree decl = arg;
- register tree origin = decl_ultimate_origin (decl);
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_subroutine);
- sibling_attribute ();
- dienum_push ();
- if (origin != NULL)
- abstract_origin_attribute (origin);
- else
- {
- register tree type = TREE_TYPE (decl);
-
- name_and_src_coords_attributes (decl);
- inline_attribute (decl);
- prototyped_attribute (type);
- member_attribute (DECL_CONTEXT (decl));
- type_attribute (TREE_TYPE (type), 0, 0);
- pure_or_virtual_attribute (decl);
- }
- if (DECL_ABSTRACT (decl))
- equate_decl_number_to_die_number (decl);
- else
- {
- /* Avoid getting screwed up in cases where a function was declared
- static but where no definition was ever given for it. */
-
- if (TREE_ASM_WRITTEN (decl))
- {
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
- low_pc_attribute (function_start_label (decl));
- sprintf (label, FUNC_END_LABEL_FMT, current_funcdef_number);
- high_pc_attribute (label);
- if (use_gnu_debug_info_extensions)
- {
- sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
- body_begin_attribute (label);
- sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
- body_end_attribute (label);
- }
- }
- }
-}
-
-static void
-output_subroutine_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
- register tree return_type = TREE_TYPE (type);
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_subroutine_type);
- sibling_attribute ();
- dienum_push ();
- equate_type_number_to_die_number (type);
- prototyped_attribute (type);
- member_attribute (TYPE_CONTEXT (type));
- type_attribute (return_type, 0, 0);
-}
-
-static void
-output_typedef_die (arg)
- register void *arg;
-{
- register tree decl = arg;
- register tree origin = decl_ultimate_origin (decl);
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_typedef);
- sibling_attribute ();
- if (origin != NULL)
- abstract_origin_attribute (origin);
- else
- {
- name_and_src_coords_attributes (decl);
- member_attribute (DECL_CONTEXT (decl));
- type_attribute (TREE_TYPE (decl),
- TREE_READONLY (decl), TREE_THIS_VOLATILE (decl));
- }
- if (DECL_ABSTRACT (decl))
- equate_decl_number_to_die_number (decl);
-}
-
-static void
-output_union_type_die (arg)
- register void *arg;
-{
- register tree type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_union_type);
- sibling_attribute ();
- equate_type_number_to_die_number (type);
- name_attribute (type_tag (type));
- member_attribute (TYPE_CONTEXT (type));
-
- /* If this type has been completed, then give it a byte_size attribute
- and prepare to give a list of members. Otherwise, don't do either of
- these things. In the latter case, we will not be generating a list
- of members (since we don't have any idea what they might be for an
- incomplete type). */
-
- if (TYPE_SIZE (type))
- {
- dienum_push ();
- byte_size_attribute (type);
- }
-}
-
-/* Generate a special type of DIE used as a stand-in for a trailing ellipsis
- at the end of an (ANSI prototyped) formal parameters list. */
-
-static void
-output_unspecified_parameters_die (arg)
- register void *arg;
-{
- register tree decl_or_type = arg;
-
- ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_unspecified_parameters);
- sibling_attribute ();
-
- /* This kludge is here only for the sake of being compatible with what
- the USL CI5 C compiler does. The specification of Dwarf Version 1
- doesn't say that TAG_unspecified_parameters DIEs should contain any
- attributes other than the AT_sibling attribute, but they are certainly
- allowed to contain additional attributes, and the CI5 compiler
- generates AT_name, AT_fund_type, and AT_location attributes within
- TAG_unspecified_parameters DIEs which appear in the child lists for
- DIEs representing function definitions, so we do likewise here. */
-
- if (TREE_CODE (decl_or_type) == FUNCTION_DECL && DECL_INITIAL (decl_or_type))
- {
- name_attribute ("...");
- fund_type_attribute (FT_pointer);
- /* location_attribute (?); */
- }
-}
-
-static void
-output_padded_null_die (arg)
- register void *arg;
-{
- ASM_OUTPUT_ALIGN (asm_out_file, 2); /* 2**2 == 4 */
-}
-
-/*************************** end of DIEs *********************************/
-
-/* Generate some type of DIE. This routine generates the generic outer
- wrapper stuff which goes around all types of DIE's (regardless of their
- TAGs. All forms of DIEs start with a DIE-specific label, followed by a
- DIE-length word, followed by the guts of the DIE itself. After the guts
- of the DIE, there must always be a terminator label for the DIE. */
-
-static void
-output_die (die_specific_output_function, param)
- register void (*die_specific_output_function)();
- register void *param;
-{
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
- char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- current_dienum = NEXT_DIE_NUM;
- NEXT_DIE_NUM = next_unused_dienum;
-
- sprintf (begin_label, DIE_BEGIN_LABEL_FMT, current_dienum);
- sprintf (end_label, DIE_END_LABEL_FMT, current_dienum);
-
- /* Write a label which will act as the name for the start of this DIE. */
-
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
-
- /* Write the DIE-length word. */
-
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, end_label, begin_label);
-
- /* Fill in the guts of the DIE. */
-
- next_unused_dienum++;
- die_specific_output_function (param);
-
- /* Write a label which will act as the name for the end of this DIE. */
-
- ASM_OUTPUT_LABEL (asm_out_file, end_label);
-}
-
-static void
-end_sibling_chain ()
-{
- char begin_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- current_dienum = NEXT_DIE_NUM;
- NEXT_DIE_NUM = next_unused_dienum;
-
- sprintf (begin_label, DIE_BEGIN_LABEL_FMT, current_dienum);
-
- /* Write a label which will act as the name for the start of this DIE. */
-
- ASM_OUTPUT_LABEL (asm_out_file, begin_label);
-
- /* Write the DIE-length word. */
-
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 4);
-
- dienum_pop ();
-}
-
-/* Generate a list of nameless TAG_formal_parameter DIEs (and perhaps a
- TAG_unspecified_parameters DIE) to represent the types of the formal
- parameters as specified in some function type specification (except
- for those which appear as part of a function *definition*).
-
- Note that we must be careful here to output all of the parameter
- DIEs *before* we output any DIEs needed to represent the types of
- the formal parameters. This keeps svr4 SDB happy because it
- (incorrectly) thinks that the first non-parameter DIE it sees ends
- the formal parameter list. */
-
-static void
-output_formal_types (function_or_method_type)
- register tree function_or_method_type;
-{
- register tree link;
- register tree formal_type = NULL;
- register tree first_parm_type = TYPE_ARG_TYPES (function_or_method_type);
-
- /* In the case where we are generating a formal types list for a C++
- non-static member function type, skip over the first thing on the
- TYPE_ARG_TYPES list because it only represents the type of the
- hidden `this pointer'. The debugger should be able to figure
- out (without being explicitly told) that this non-static member
- function type takes a `this pointer' and should be able to figure
- what the type of that hidden parameter is from the AT_member
- attribute of the parent TAG_subroutine_type DIE. */
-
- if (TREE_CODE (function_or_method_type) == METHOD_TYPE)
- first_parm_type = TREE_CHAIN (first_parm_type);
-
- /* Make our first pass over the list of formal parameter types and output
- a TAG_formal_parameter DIE for each one. */
-
- for (link = first_parm_type; link; link = TREE_CHAIN (link))
- {
- formal_type = TREE_VALUE (link);
- if (formal_type == void_type_node)
- break;
-
- /* Output a (nameless) DIE to represent the formal parameter itself. */
-
- output_die (output_formal_parameter_die, formal_type);
- }
-
- /* If this function type has an ellipsis, add a TAG_unspecified_parameters
- DIE to the end of the parameter list. */
-
- if (formal_type != void_type_node)
- output_die (output_unspecified_parameters_die, function_or_method_type);
-
- /* Make our second (and final) pass over the list of formal parameter types
- and output DIEs to represent those types (as necessary). */
-
- for (link = TYPE_ARG_TYPES (function_or_method_type);
- link;
- link = TREE_CHAIN (link))
- {
- formal_type = TREE_VALUE (link);
- if (formal_type == void_type_node)
- break;
-
- output_type (formal_type, function_or_method_type);
- }
-}
-
-/* Remember a type in the pending_types_list. */
-
-static void
-pend_type (type)
- register tree type;
-{
- if (pending_types == pending_types_allocated)
- {
- pending_types_allocated += PENDING_TYPES_INCREMENT;
- pending_types_list
- = (tree *) xrealloc (pending_types_list,
- sizeof (tree) * pending_types_allocated);
- }
- pending_types_list[pending_types++] = type;
-
- /* Mark the pending type as having been output already (even though
- it hasn't been). This prevents the type from being added to the
- pending_types_list more than once. */
-
- TREE_ASM_WRITTEN (type) = 1;
-}
-
-/* Return non-zero if it is legitimate to output DIEs to represent a
- given type while we are generating the list of child DIEs for some
- DIE (e.g. a function or lexical block DIE) associated with a given scope.
-
- See the comments within the function for a description of when it is
- considered legitimate to output DIEs for various kinds of types.
-
- Note that TYPE_CONTEXT(type) may be NULL (to indicate global scope)
- or it may point to a BLOCK node (for types local to a block), or to a
- FUNCTION_DECL node (for types local to the heading of some function
- definition), or to a FUNCTION_TYPE node (for types local to the
- prototyped parameter list of a function type specification), or to a
- RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE node
- (in the case of C++ nested types).
-
- The `scope' parameter should likewise be NULL or should point to a
- BLOCK node, a FUNCTION_DECL node, a FUNCTION_TYPE node, a RECORD_TYPE
- node, a UNION_TYPE node, or a QUAL_UNION_TYPE node.
-
- This function is used only for deciding when to "pend" and when to
- "un-pend" types to/from the pending_types_list.
-
- Note that we sometimes make use of this "type pending" feature in a
- rather twisted way to temporarily delay the production of DIEs for the
- types of formal parameters. (We do this just to make svr4 SDB happy.)
- It order to delay the production of DIEs representing types of formal
- parameters, callers of this function supply `fake_containing_scope' as
- the `scope' parameter to this function. Given that fake_containing_scope
- is a tagged type which is *not* the containing scope for *any* other type,
- the desired effect is achieved, i.e. output of DIEs representing types
- is temporarily suspended, and any type DIEs which would have otherwise
- been output are instead placed onto the pending_types_list. Later on,
- we force these (temporarily pended) types to be output simply by calling
- `output_pending_types_for_scope' with an actual argument equal to the
- true scope of the types we temporarily pended. */
-
-static inline int
-type_ok_for_scope (type, scope)
- register tree type;
- register tree scope;
-{
- /* Tagged types (i.e. struct, union, and enum types) must always be
- output only in the scopes where they actually belong (or else the
- scoping of their own tag names and the scoping of their member
- names will be incorrect). Non-tagged-types on the other hand can
- generally be output anywhere, except that svr4 SDB really doesn't
- want to see them nested within struct or union types, so here we
- say it is always OK to immediately output any such a (non-tagged)
- type, so long as we are not within such a context. Note that the
- only kinds of non-tagged types which we will be dealing with here
- (for C and C++ anyway) will be array types and function types. */
-
- return is_tagged_type (type)
- ? (TYPE_CONTEXT (type) == scope
- || (scope == NULL_TREE && is_tagged_type (TYPE_CONTEXT (type))
- && TREE_ASM_WRITTEN (TYPE_CONTEXT (type))))
- : (scope == NULL_TREE || ! is_tagged_type (scope));
-}
-
-/* Output any pending types (from the pending_types list) which we can output
- now (taking into account the scope that we are working on now).
-
- For each type output, remove the given type from the pending_types_list
- *before* we try to output it.
-
- Note that we have to process the list in beginning-to-end order,
- because the call made here to output_type may cause yet more types
- to be added to the end of the list, and we may have to output some
- of them too. */
-
-static void
-output_pending_types_for_scope (containing_scope)
- register tree containing_scope;
-{
- register unsigned i;
-
- for (i = 0; i < pending_types; )
- {
- register tree type = pending_types_list[i];
-
- if (type_ok_for_scope (type, containing_scope))
- {
- register tree *mover;
- register tree *limit;
-
- pending_types--;
- limit = &pending_types_list[pending_types];
- for (mover = &pending_types_list[i]; mover < limit; mover++)
- *mover = *(mover+1);
-
- /* Un-mark the type as having been output already (because it
- hasn't been, really). Then call output_type to generate a
- Dwarf representation of it. */
-
- TREE_ASM_WRITTEN (type) = 0;
- output_type (type, containing_scope);
-
- /* Don't increment the loop counter in this case because we
- have shifted all of the subsequent pending types down one
- element in the pending_types_list array. */
- }
- else
- i++;
- }
-}
-
-static void
-output_type (type, containing_scope)
- register tree type;
- register tree containing_scope;
-{
- if (type == 0 || type == error_mark_node)
- return;
-
- /* We are going to output a DIE to represent the unqualified version of
- of this type (i.e. without any const or volatile qualifiers) so get
- the main variant (i.e. the unqualified version) of this type now. */
-
- type = type_main_variant (type);
-
- if (TREE_ASM_WRITTEN (type))
- return;
-
- /* If this is a nested type whose containing class hasn't been
- written out yet, writing it out will cover this one, too. */
-
- if (TYPE_CONTEXT (type)
- && TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't'
- && ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
- {
- output_type (TYPE_CONTEXT (type), containing_scope);
- return;
- }
-
- /* Don't generate any DIEs for this type now unless it is OK to do so
- (based upon what `type_ok_for_scope' tells us). */
-
- if (! type_ok_for_scope (type, containing_scope))
- {
- pend_type (type);
- return;
- }
-
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- break;
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- /* Prevent infinite recursion in cases where this is a recursive
- type. Recursive types are possible in Ada. */
- TREE_ASM_WRITTEN (type) = 1;
- /* For these types, all that is required is that we output a DIE
- (or a set of DIEs) to represent the "basis" type. */
- output_type (TREE_TYPE (type), containing_scope);
- break;
-
- case OFFSET_TYPE:
- /* This code is used for C++ pointer-to-data-member types. */
- /* Output a description of the relevant class type. */
- output_type (TYPE_OFFSET_BASETYPE (type), containing_scope);
- /* Output a description of the type of the object pointed to. */
- output_type (TREE_TYPE (type), containing_scope);
- /* Now output a DIE to represent this pointer-to-data-member type
- itself. */
- output_die (output_ptr_to_mbr_type_die, type);
- break;
-
- case SET_TYPE:
- output_type (TYPE_DOMAIN (type), containing_scope);
- output_die (output_set_type_die, type);
- break;
-
- case FILE_TYPE:
- output_type (TREE_TYPE (type), containing_scope);
- abort (); /* No way to represent these in Dwarf yet! */
- break;
-
- case FUNCTION_TYPE:
- /* Force out return type (in case it wasn't forced out already). */
- output_type (TREE_TYPE (type), containing_scope);
- output_die (output_subroutine_type_die, type);
- output_formal_types (type);
- end_sibling_chain ();
- break;
-
- case METHOD_TYPE:
- /* Force out return type (in case it wasn't forced out already). */
- output_type (TREE_TYPE (type), containing_scope);
- output_die (output_subroutine_type_die, type);
- output_formal_types (type);
- end_sibling_chain ();
- break;
-
- case ARRAY_TYPE:
- if (TYPE_STRING_FLAG (type) && TREE_CODE(TREE_TYPE(type)) == CHAR_TYPE)
- {
- output_type (TREE_TYPE (type), containing_scope);
- output_die (output_string_type_die, type);
- }
- else
- {
- register tree element_type;
-
- element_type = TREE_TYPE (type);
- while (TREE_CODE (element_type) == ARRAY_TYPE)
- element_type = TREE_TYPE (element_type);
-
- output_type (element_type, containing_scope);
- output_die (output_array_type_die, type);
- }
- break;
-
- case ENUMERAL_TYPE:
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
-
- /* For a non-file-scope tagged type, we can always go ahead and
- output a Dwarf description of this type right now, even if
- the type in question is still incomplete, because if this
- local type *was* ever completed anywhere within its scope,
- that complete definition would already have been attached to
- this RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE or ENUMERAL_TYPE
- node by the time we reach this point. That's true because of the
- way the front-end does its processing of file-scope declarations (of
- functions and class types) within which other types might be
- nested. The C and C++ front-ends always gobble up such "local
- scope" things en-mass before they try to output *any* debugging
- information for any of the stuff contained inside them and thus,
- we get the benefit here of what is (in effect) a pre-resolution
- of forward references to tagged types in local scopes.
-
- Note however that for file-scope tagged types we cannot assume
- that such pre-resolution of forward references has taken place.
- A given file-scope tagged type may appear to be incomplete when
- we reach this point, but it may yet be given a full definition
- (at file-scope) later on during compilation. In order to avoid
- generating a premature (and possibly incorrect) set of Dwarf
- DIEs for such (as yet incomplete) file-scope tagged types, we
- generate nothing at all for as-yet incomplete file-scope tagged
- types here unless we are making our special "finalization" pass
- for file-scope things at the very end of compilation. At that
- time, we will certainly know as much about each file-scope tagged
- type as we are ever going to know, so at that point in time, we
- can safely generate correct Dwarf descriptions for these file-
- scope tagged types. */
-
- if (TYPE_SIZE (type) == 0
- && (TYPE_CONTEXT (type) == NULL
- || TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't')
- && !finalizing)
- return; /* EARLY EXIT! Avoid setting TREE_ASM_WRITTEN. */
-
- /* Prevent infinite recursion in cases where the type of some
- member of this type is expressed in terms of this type itself. */
-
- TREE_ASM_WRITTEN (type) = 1;
-
- /* Output a DIE to represent the tagged type itself. */
-
- switch (TREE_CODE (type))
- {
- case ENUMERAL_TYPE:
- output_die (output_enumeration_type_die, type);
- return; /* a special case -- nothing left to do so just return */
-
- case RECORD_TYPE:
- output_die (output_structure_type_die, type);
- break;
-
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- output_die (output_union_type_die, type);
- break;
-
- default:
- abort (); /* Should never happen. */
- }
-
- /* If this is not an incomplete type, output descriptions of
- each of its members.
-
- Note that as we output the DIEs necessary to represent the
- members of this record or union type, we will also be trying
- to output DIEs to represent the *types* of those members.
- However the `output_type' function (above) will specifically
- avoid generating type DIEs for member types *within* the list
- of member DIEs for this (containing) type execpt for those
- types (of members) which are explicitly marked as also being
- members of this (containing) type themselves. The g++ front-
- end can force any given type to be treated as a member of some
- other (containing) type by setting the TYPE_CONTEXT of the
- given (member) type to point to the TREE node representing the
- appropriate (containing) type.
- */
-
- if (TYPE_SIZE (type))
- {
- /* First output info about the base classes. */
- if (TYPE_BINFO (type) && TYPE_BINFO_BASETYPES (type))
- {
- register tree bases = TYPE_BINFO_BASETYPES (type);
- register int n_bases = TREE_VEC_LENGTH (bases);
- register int i;
-
- for (i = 0; i < n_bases; i++)
- output_die (output_inheritance_die, TREE_VEC_ELT (bases, i));
- }
-
- ++in_class;
-
- {
- register tree normal_member;
-
- /* Now output info about the data members and type members. */
-
- for (normal_member = TYPE_FIELDS (type);
- normal_member;
- normal_member = TREE_CHAIN (normal_member))
- output_decl (normal_member, type);
- }
-
- {
- register tree func_member;
-
- /* Now output info about the function members (if any). */
-
- for (func_member = TYPE_METHODS (type);
- func_member;
- func_member = TREE_CHAIN (func_member))
- output_decl (func_member, type);
- }
-
- --in_class;
-
- /* RECORD_TYPEs, UNION_TYPEs, and QUAL_UNION_TYPEs are themselves
- scopes (at least in C++) so we must now output any nested
- pending types which are local just to this type. */
-
- output_pending_types_for_scope (type);
-
- end_sibling_chain (); /* Terminate member chain. */
- }
-
- break;
-
- case VOID_TYPE:
- case INTEGER_TYPE:
- case REAL_TYPE:
- case COMPLEX_TYPE:
- case BOOLEAN_TYPE:
- case CHAR_TYPE:
- break; /* No DIEs needed for fundamental types. */
-
- case LANG_TYPE: /* No Dwarf representation currently defined. */
- break;
-
- default:
- abort ();
- }
-
- TREE_ASM_WRITTEN (type) = 1;
-}
-
-static void
-output_tagged_type_instantiation (type)
- register tree type;
-{
- if (type == 0 || type == error_mark_node)
- return;
-
- /* We are going to output a DIE to represent the unqualified version of
- of this type (i.e. without any const or volatile qualifiers) so make
- sure that we have the main variant (i.e. the unqualified version) of
- this type now. */
-
- assert (type == type_main_variant (type));
-
- assert (TREE_ASM_WRITTEN (type));
-
- switch (TREE_CODE (type))
- {
- case ERROR_MARK:
- break;
-
- case ENUMERAL_TYPE:
- output_die (output_inlined_enumeration_type_die, type);
- break;
-
- case RECORD_TYPE:
- output_die (output_inlined_structure_type_die, type);
- break;
-
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- output_die (output_inlined_union_type_die, type);
- break;
-
- default:
- abort (); /* Should never happen. */
- }
-}
-
-/* Output a TAG_lexical_block DIE followed by DIEs to represent all of
- the things which are local to the given block. */
-
-static void
-output_block (stmt, depth)
- register tree stmt;
- int depth;
-{
- register int must_output_die = 0;
- register tree origin;
- register enum tree_code origin_code;
-
- /* Ignore blocks never really used to make RTL. */
-
- if (! stmt || ! TREE_USED (stmt))
- return;
-
- /* Determine the "ultimate origin" of this block. This block may be an
- inlined instance of an inlined instance of inline function, so we
- have to trace all of the way back through the origin chain to find
- out what sort of node actually served as the original seed for the
- creation of the current block. */
-
- origin = block_ultimate_origin (stmt);
- origin_code = (origin != NULL) ? TREE_CODE (origin) : ERROR_MARK;
-
- /* Determine if we need to output any Dwarf DIEs at all to represent this
- block. */
-
- if (origin_code == FUNCTION_DECL)
- /* The outer scopes for inlinings *must* always be represented. We
- generate TAG_inlined_subroutine DIEs for them. (See below.) */
- must_output_die = 1;
- else
- {
- /* In the case where the current block represents an inlining of the
- "body block" of an inline function, we must *NOT* output any DIE
- for this block because we have already output a DIE to represent
- the whole inlined function scope and the "body block" of any
- function doesn't really represent a different scope according to
- ANSI C rules. So we check here to make sure that this block does
- not represent a "body block inlining" before trying to set the
- `must_output_die' flag. */
-
- if (! is_body_block (origin ? origin : stmt))
- {
- /* Determine if this block directly contains any "significant"
- local declarations which we will need to output DIEs for. */
-
- if (debug_info_level > DINFO_LEVEL_TERSE)
- /* We are not in terse mode so *any* local declaration counts
- as being a "significant" one. */
- must_output_die = (BLOCK_VARS (stmt) != NULL);
- else
- {
- register tree decl;
-
- /* We are in terse mode, so only local (nested) function
- definitions count as "significant" local declarations. */
-
- for (decl = BLOCK_VARS (stmt); decl; decl = TREE_CHAIN (decl))
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl))
- {
- must_output_die = 1;
- break;
- }
- }
- }
- }
-
- /* It would be a waste of space to generate a Dwarf TAG_lexical_block
- DIE for any block which contains no significant local declarations
- at all. Rather, in such cases we just call `output_decls_for_scope'
- so that any needed Dwarf info for any sub-blocks will get properly
- generated. Note that in terse mode, our definition of what constitutes
- a "significant" local declaration gets restricted to include only
- inlined function instances and local (nested) function definitions. */
-
- if (origin_code == FUNCTION_DECL && BLOCK_ABSTRACT (stmt))
- /* We don't care about an abstract inlined subroutine. */;
- else if (must_output_die)
- {
- output_die ((origin_code == FUNCTION_DECL)
- ? output_inlined_subroutine_die
- : output_lexical_block_die,
- stmt);
- output_decls_for_scope (stmt, depth);
- end_sibling_chain ();
- }
- else
- output_decls_for_scope (stmt, depth);
-}
-
-/* Output all of the decls declared within a given scope (also called
- a `binding contour') and (recursively) all of it's sub-blocks. */
-
-static void
-output_decls_for_scope (stmt, depth)
- register tree stmt;
- int depth;
-{
- /* Ignore blocks never really used to make RTL. */
-
- if (! stmt || ! TREE_USED (stmt))
- return;
-
- if (! BLOCK_ABSTRACT (stmt) && depth > 0)
- next_block_number++;
-
- /* Output the DIEs to represent all of the data objects, functions,
- typedefs, and tagged types declared directly within this block
- but not within any nested sub-blocks. */
-
- {
- register tree decl;
-
- for (decl = BLOCK_VARS (stmt); decl; decl = TREE_CHAIN (decl))
- output_decl (decl, stmt);
- }
-
- output_pending_types_for_scope (stmt);
-
- /* Output the DIEs to represent all sub-blocks (and the items declared
- therein) of this block. */
-
- {
- register tree subblocks;
-
- for (subblocks = BLOCK_SUBBLOCKS (stmt);
- subblocks;
- subblocks = BLOCK_CHAIN (subblocks))
- output_block (subblocks, depth + 1);
- }
-}
-
-/* Is this a typedef we can avoid emitting? */
-
-inline int
-is_redundant_typedef (decl)
- register tree decl;
-{
- if (TYPE_DECL_IS_STUB (decl))
- return 1;
- if (DECL_ARTIFICIAL (decl)
- && DECL_CONTEXT (decl)
- && is_tagged_type (DECL_CONTEXT (decl))
- && TREE_CODE (TYPE_NAME (DECL_CONTEXT (decl))) == TYPE_DECL
- && DECL_NAME (decl) == DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl))))
- /* Also ignore the artificial member typedef for the class name. */
- return 1;
- return 0;
-}
-
-/* Output Dwarf .debug information for a decl described by DECL. */
-
-static void
-output_decl (decl, containing_scope)
- register tree decl;
- register tree containing_scope;
-{
- /* Make a note of the decl node we are going to be working on. We may
- need to give the user the source coordinates of where it appeared in
- case we notice (later on) that something about it looks screwy. */
-
- dwarf_last_decl = decl;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- return;
-
- /* If a structure is declared within an initialization, e.g. as the
- operand of a sizeof, then it will not have a name. We don't want
- to output a DIE for it, as the tree nodes are in the temporary obstack */
-
- if ((TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE)
- && ((DECL_NAME (decl) == 0 && TYPE_NAME (TREE_TYPE (decl)) == 0)
- || (TYPE_FIELDS (TREE_TYPE (decl))
- && (TREE_CODE (TYPE_FIELDS (TREE_TYPE (decl))) == ERROR_MARK))))
- return;
-
- /* If this ..._DECL node is marked to be ignored, then ignore it.
- But don't ignore a function definition, since that would screw
- up our count of blocks, and that it turn will completely screw up the
- the labels we will reference in subsequent AT_low_pc and AT_high_pc
- attributes (for subsequent blocks). */
-
- if (DECL_IGNORED_P (decl) && TREE_CODE (decl) != FUNCTION_DECL)
- return;
-
- switch (TREE_CODE (decl))
- {
- case CONST_DECL:
- /* The individual enumerators of an enum type get output when we
- output the Dwarf representation of the relevant enum type itself. */
- break;
-
- case FUNCTION_DECL:
- /* If we are in terse mode, don't output any DIEs to represent
- mere function declarations. Also, if we are conforming
- to the DWARF version 1 specification, don't output DIEs for
- mere function declarations. */
-
- if (DECL_INITIAL (decl) == NULL_TREE)
-#if (DWARF_VERSION > 1)
- if (debug_info_level <= DINFO_LEVEL_TERSE)
-#endif
- break;
-
- /* Before we describe the FUNCTION_DECL itself, make sure that we
- have described its return type. */
-
- output_type (TREE_TYPE (TREE_TYPE (decl)), containing_scope);
-
- {
- /* And its containing type. */
- register tree origin = decl_class_context (decl);
- if (origin)
- output_type (origin, containing_scope);
- }
-
- /* If the following DIE will represent a function definition for a
- function with "extern" linkage, output a special "pubnames" DIE
- label just ahead of the actual DIE. A reference to this label
- was already generated in the .debug_pubnames section sub-entry
- for this function definition. */
-
- if (TREE_PUBLIC (decl))
- {
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- sprintf (label, PUB_DIE_LABEL_FMT, next_pubname_number++);
- ASM_OUTPUT_LABEL (asm_out_file, label);
- }
-
- /* Now output a DIE to represent the function itself. */
-
- output_die (TREE_PUBLIC (decl) || DECL_EXTERNAL (decl)
- ? output_global_subroutine_die
- : output_local_subroutine_die,
- decl);
-
- /* Now output descriptions of the arguments for this function.
- This gets (unnecessarily?) complex because of the fact that
- the DECL_ARGUMENT list for a FUNCTION_DECL doesn't indicate
- cases where there was a trailing `...' at the end of the formal
- parameter list. In order to find out if there was a trailing
- ellipsis or not, we must instead look at the type associated
- with the FUNCTION_DECL. This will be a node of type FUNCTION_TYPE.
- If the chain of type nodes hanging off of this FUNCTION_TYPE node
- ends with a void_type_node then there should *not* be an ellipsis
- at the end. */
-
- /* In the case where we are describing a mere function declaration, all
- we need to do here (and all we *can* do here) is to describe
- the *types* of its formal parameters. */
-
- if (decl != current_function_decl || in_class)
- output_formal_types (TREE_TYPE (decl));
- else
- {
- /* Generate DIEs to represent all known formal parameters */
-
- register tree arg_decls = DECL_ARGUMENTS (decl);
- register tree parm;
-
- /* WARNING! Kludge zone ahead! Here we have a special
- hack for svr4 SDB compatibility. Instead of passing the
- current FUNCTION_DECL node as the second parameter (i.e.
- the `containing_scope' parameter) to `output_decl' (as
- we ought to) we instead pass a pointer to our own private
- fake_containing_scope node. That node is a RECORD_TYPE
- node which NO OTHER TYPE may ever actually be a member of.
-
- This pointer will ultimately get passed into `output_type'
- as its `containing_scope' parameter. `Output_type' will
- then perform its part in the hack... i.e. it will pend
- the type of the formal parameter onto the pending_types
- list. Later on, when we are done generating the whole
- sequence of formal parameter DIEs for this function
- definition, we will un-pend all previously pended types
- of formal parameters for this function definition.
-
- This whole kludge prevents any type DIEs from being
- mixed in with the formal parameter DIEs. That's good
- because svr4 SDB believes that the list of formal
- parameter DIEs for a function ends wherever the first
- non-formal-parameter DIE appears. Thus, we have to
- keep the formal parameter DIEs segregated. They must
- all appear (consecutively) at the start of the list of
- children for the DIE representing the function definition.
- Then (and only then) may we output any additional DIEs
- needed to represent the types of these formal parameters.
- */
-
- /*
- When generating DIEs, generate the unspecified_parameters
- DIE instead if we come across the arg "__builtin_va_alist"
- */
-
- for (parm = arg_decls; parm; parm = TREE_CHAIN (parm))
- if (TREE_CODE (parm) == PARM_DECL)
- {
- if (DECL_NAME(parm) &&
- !strcmp(IDENTIFIER_POINTER(DECL_NAME(parm)),
- "__builtin_va_alist") )
- output_die (output_unspecified_parameters_die, decl);
- else
- output_decl (parm, fake_containing_scope);
- }
-
- /*
- Now that we have finished generating all of the DIEs to
- represent the formal parameters themselves, force out
- any DIEs needed to represent their types. We do this
- simply by un-pending all previously pended types which
- can legitimately go into the chain of children DIEs for
- the current FUNCTION_DECL.
- */
-
- output_pending_types_for_scope (decl);
-
- /*
- Decide whether we need a unspecified_parameters DIE at the end.
- There are 2 more cases to do this for:
- 1) the ansi ... declaration - this is detectable when the end
- of the arg list is not a void_type_node
- 2) an unprototyped function declaration (not a definition). This
- just means that we have no info about the parameters at all.
- */
-
- {
- register tree fn_arg_types = TYPE_ARG_TYPES (TREE_TYPE (decl));
-
- if (fn_arg_types)
- {
- /* this is the prototyped case, check for ... */
- if (TREE_VALUE (tree_last (fn_arg_types)) != void_type_node)
- output_die (output_unspecified_parameters_die, decl);
- }
- else
- {
- /* this is unprototyped, check for undefined (just declaration) */
- if (!DECL_INITIAL (decl))
- output_die (output_unspecified_parameters_die, decl);
- }
- }
-
- /* Output Dwarf info for all of the stuff within the body of the
- function (if it has one - it may be just a declaration). */
-
- {
- register tree outer_scope = DECL_INITIAL (decl);
-
- if (outer_scope && TREE_CODE (outer_scope) != ERROR_MARK)
- {
- /* Note that here, `outer_scope' is a pointer to the outermost
- BLOCK node created to represent a function.
- This outermost BLOCK actually represents the outermost
- binding contour for the function, i.e. the contour in which
- the function's formal parameters and labels get declared.
-
- Curiously, it appears that the front end doesn't actually
- put the PARM_DECL nodes for the current function onto the
- BLOCK_VARS list for this outer scope. (They are strung
- off of the DECL_ARGUMENTS list for the function instead.)
- The BLOCK_VARS list for the `outer_scope' does provide us
- with a list of the LABEL_DECL nodes for the function however,
- and we output DWARF info for those here.
-
- Just within the `outer_scope' there will be a BLOCK node
- representing the function's outermost pair of curly braces,
- and any blocks used for the base and member initializers of
- a C++ constructor function. */
-
- output_decls_for_scope (outer_scope, 0);
-
- /* Finally, force out any pending types which are local to the
- outermost block of this function definition. These will
- all have a TYPE_CONTEXT which points to the FUNCTION_DECL
- node itself. */
-
- output_pending_types_for_scope (decl);
- }
- }
- }
-
- /* Generate a terminator for the list of stuff `owned' by this
- function. */
-
- end_sibling_chain ();
-
- break;
-
- case TYPE_DECL:
- /* If we are in terse mode, don't generate any DIEs to represent
- any actual typedefs. Note that even when we are in terse mode,
- we must still output DIEs to represent those tagged types which
- are used (directly or indirectly) in the specification of either
- a return type or a formal parameter type of some function. */
-
- if (debug_info_level <= DINFO_LEVEL_TERSE)
- if (! TYPE_DECL_IS_STUB (decl)
- || (! TYPE_USED_FOR_FUNCTION (TREE_TYPE (decl)) && ! in_class))
- return;
-
- /* In the special case of a TYPE_DECL node representing
- the declaration of some type tag, if the given TYPE_DECL is
- marked as having been instantiated from some other (original)
- TYPE_DECL node (e.g. one which was generated within the original
- definition of an inline function) we have to generate a special
- (abbreviated) TAG_structure_type, TAG_union_type, or
- TAG_enumeration-type DIE here. */
-
- if (TYPE_DECL_IS_STUB (decl) && DECL_ABSTRACT_ORIGIN (decl))
- {
- output_tagged_type_instantiation (TREE_TYPE (decl));
- return;
- }
-
- output_type (TREE_TYPE (decl), containing_scope);
-
- if (! is_redundant_typedef (decl))
- /* Output a DIE to represent the typedef itself. */
- output_die (output_typedef_die, decl);
- break;
-
- case LABEL_DECL:
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- output_die (output_label_die, decl);
- break;
-
- case VAR_DECL:
- /* If we are conforming to the DWARF version 1 specification, don't
- generated any DIEs to represent mere external object declarations. */
-
-#if (DWARF_VERSION <= 1)
- if (DECL_EXTERNAL (decl) && ! TREE_PUBLIC (decl))
- break;
-#endif
-
- /* If we are in terse mode, don't generate any DIEs to represent
- any variable declarations or definitions. */
-
- if (debug_info_level <= DINFO_LEVEL_TERSE)
- break;
-
- /* Output any DIEs that are needed to specify the type of this data
- object. */
-
- output_type (TREE_TYPE (decl), containing_scope);
-
- {
- /* And its containing type. */
- register tree origin = decl_class_context (decl);
- if (origin)
- output_type (origin, containing_scope);
- }
-
- /* If the following DIE will represent a data object definition for a
- data object with "extern" linkage, output a special "pubnames" DIE
- label just ahead of the actual DIE. A reference to this label
- was already generated in the .debug_pubnames section sub-entry
- for this data object definition. */
-
- if (TREE_PUBLIC (decl) && ! DECL_ABSTRACT (decl))
- {
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- sprintf (label, PUB_DIE_LABEL_FMT, next_pubname_number++);
- ASM_OUTPUT_LABEL (asm_out_file, label);
- }
-
- /* Now output the DIE to represent the data object itself. This gets
- complicated because of the possibility that the VAR_DECL really
- represents an inlined instance of a formal parameter for an inline
- function. */
-
- {
- register void (*func) ();
- register tree origin = decl_ultimate_origin (decl);
-
- if (origin != NULL && TREE_CODE (origin) == PARM_DECL)
- func = output_formal_parameter_die;
- else
- {
- if (TREE_PUBLIC (decl) || DECL_EXTERNAL (decl))
- func = output_global_variable_die;
- else
- func = output_local_variable_die;
- }
- output_die (func, decl);
- }
- break;
-
- case FIELD_DECL:
- /* Ignore the nameless fields that are used to skip bits. */
- if (DECL_NAME (decl) != 0)
- {
- output_type (member_declared_type (decl), containing_scope);
- output_die (output_member_die, decl);
- }
- break;
-
- case PARM_DECL:
- /* Force out the type of this formal, if it was not forced out yet.
- Note that here we can run afowl of a bug in "classic" svr4 SDB.
- It should be able to grok the presence of type DIEs within a list
- of TAG_formal_parameter DIEs, but it doesn't. */
-
- output_type (TREE_TYPE (decl), containing_scope);
- output_die (output_formal_parameter_die, decl);
- break;
-
- default:
- abort ();
- }
-}
-
-void
-dwarfout_file_scope_decl (decl, set_finalizing)
- register tree decl;
- register int set_finalizing;
-{
- if (TREE_CODE (decl) == ERROR_MARK)
- return;
-
- /* If this ..._DECL node is marked to be ignored, then ignore it. We
- gotta hope that the node in question doesn't represent a function
- definition. If it does, then totally ignoring it is bound to screw
- up our count of blocks, and that it turn will completely screw up the
- the labels we will reference in subsequent AT_low_pc and AT_high_pc
- attributes (for subsequent blocks). (It's too bad that BLOCK nodes
- don't carry their own sequence numbers with them!) */
-
- if (DECL_IGNORED_P (decl))
- {
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl) != NULL)
- abort ();
- return;
- }
-
- switch (TREE_CODE (decl))
- {
- case FUNCTION_DECL:
-
- /* Ignore this FUNCTION_DECL if it refers to a builtin declaration of
- a builtin function. Explicit programmer-supplied declarations of
- these same functions should NOT be ignored however. */
-
- if (DECL_EXTERNAL (decl) && DECL_FUNCTION_CODE (decl))
- return;
-
- /* What we would really like to do here is to filter out all mere
- file-scope declarations of file-scope functions which are never
- referenced later within this translation unit (and keep all of
- ones that *are* referenced later on) but we aren't clairvoyant,
- so we have no idea which functions will be referenced in the
- future (i.e. later on within the current translation unit).
- So here we just ignore all file-scope function declarations
- which are not also definitions. If and when the debugger needs
- to know something about these functions, it wil have to hunt
- around and find the DWARF information associated with the
- *definition* of the function.
-
- Note that we can't just check `DECL_EXTERNAL' to find out which
- FUNCTION_DECL nodes represent definitions and which ones represent
- mere declarations. We have to check `DECL_INITIAL' instead. That's
- because the C front-end supports some weird semantics for "extern
- inline" function definitions. These can get inlined within the
- current translation unit (an thus, we need to generate DWARF info
- for their abstract instances so that the DWARF info for the
- concrete inlined instances can have something to refer to) but
- the compiler never generates any out-of-lines instances of such
- things (despite the fact that they *are* definitions). The
- important point is that the C front-end marks these "extern inline"
- functions as DECL_EXTERNAL, but we need to generate DWARF for them
- anyway.
-
- Note that the C++ front-end also plays some similar games for inline
- function definitions appearing within include files which also
- contain `#pragma interface' pragmas. */
-
- if (DECL_INITIAL (decl) == NULL_TREE)
- return;
-
- if (TREE_PUBLIC (decl)
- && ! DECL_EXTERNAL (decl)
- && ! DECL_ABSTRACT (decl))
- {
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- /* Output a .debug_pubnames entry for a public function
- defined in this compilation unit. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION);
- sprintf (label, PUB_DIE_LABEL_FMT, next_pubname_number);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, label);
- ASM_OUTPUT_DWARF_STRING (asm_out_file,
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
-
- break;
-
- case VAR_DECL:
-
- /* Ignore this VAR_DECL if it refers to a file-scope extern data
- object declaration and if the declaration was never even
- referenced from within this entire compilation unit. We
- suppress these DIEs in order to save space in the .debug section
- (by eliminating entries which are probably useless). Note that
- we must not suppress block-local extern declarations (whether
- used or not) because that would screw-up the debugger's name
- lookup mechanism and cause it to miss things which really ought
- to be in scope at a given point. */
-
- if (DECL_EXTERNAL (decl) && !TREE_USED (decl))
- return;
-
- if (TREE_PUBLIC (decl)
- && ! DECL_EXTERNAL (decl)
- && GET_CODE (DECL_RTL (decl)) == MEM
- && ! DECL_ABSTRACT (decl))
- {
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- {
- /* Output a .debug_pubnames entry for a public variable
- defined in this compilation unit. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION);
- sprintf (label, PUB_DIE_LABEL_FMT, next_pubname_number);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, label);
- ASM_OUTPUT_DWARF_STRING (asm_out_file,
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
-
- if (DECL_INITIAL (decl) == NULL)
- {
- /* Output a .debug_aranges entry for a public variable
- which is tentatively defined in this compilation unit. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, ARANGES_SECTION);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
- (unsigned) int_size_in_bytes (TREE_TYPE (decl)));
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
- }
-
- /* If we are in terse mode, don't generate any DIEs to represent
- any variable declarations or definitions. */
-
- if (debug_info_level <= DINFO_LEVEL_TERSE)
- return;
-
- break;
-
- case TYPE_DECL:
- /* Don't bother trying to generate any DIEs to represent any of the
- normal built-in types for the language we are compiling, except
- in cases where the types in question are *not* DWARF fundamental
- types. We make an exception in the case of non-fundamental types
- for the sake of objective C (and perhaps C++) because the GNU
- front-ends for these languages may in fact create certain "built-in"
- types which are (for example) RECORD_TYPEs. In such cases, we
- really need to output these (non-fundamental) types because other
- DIEs may contain references to them. */
-
- if (DECL_SOURCE_LINE (decl) == 0
- && type_is_fundamental (TREE_TYPE (decl)))
- return;
-
- /* If we are in terse mode, don't generate any DIEs to represent
- any actual typedefs. Note that even when we are in terse mode,
- we must still output DIEs to represent those tagged types which
- are used (directly or indirectly) in the specification of either
- a return type or a formal parameter type of some function. */
-
- if (debug_info_level <= DINFO_LEVEL_TERSE)
- if (DECL_NAME (decl) != NULL
- || ! TYPE_USED_FOR_FUNCTION (TREE_TYPE (decl)))
- return;
-
- break;
-
- default:
- return;
- }
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION);
- finalizing = set_finalizing;
- output_decl (decl, NULL_TREE);
-
- /* NOTE: The call above to `output_decl' may have caused one or more
- file-scope named types (i.e. tagged types) to be placed onto the
- pending_types_list. We have to get those types off of that list
- at some point, and this is the perfect time to do it. If we didn't
- take them off now, they might still be on the list when cc1 finally
- exits. That might be OK if it weren't for the fact that when we put
- types onto the pending_types_list, we set the TREE_ASM_WRITTEN flag
- for these types, and that causes them never to be output unless
- `output_pending_types_for_scope' takes them off of the list and un-sets
- their TREE_ASM_WRITTEN flags. */
-
- output_pending_types_for_scope (NULL_TREE);
-
- /* The above call should have totally emptied the pending_types_list. */
-
- assert (pending_types == 0);
-
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl) != NULL)
- current_funcdef_number++;
-}
-
-/* Output a marker (i.e. a label) for the beginning of the generated code
- for a lexical block. */
-
-void
-dwarfout_begin_block (blocknum)
- register unsigned blocknum;
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- function_section (current_function_decl);
- sprintf (label, BLOCK_BEGIN_LABEL_FMT, blocknum);
- ASM_OUTPUT_LABEL (asm_out_file, label);
-}
-
-/* Output a marker (i.e. a label) for the end of the generated code
- for a lexical block. */
-
-void
-dwarfout_end_block (blocknum)
- register unsigned blocknum;
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- function_section (current_function_decl);
- sprintf (label, BLOCK_END_LABEL_FMT, blocknum);
- ASM_OUTPUT_LABEL (asm_out_file, label);
-}
-
-/* Output a marker (i.e. a label) at a point in the assembly code which
- corresponds to a given source level label. */
-
-void
-dwarfout_label (insn)
- register rtx insn;
-{
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- {
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- function_section (current_function_decl);
- sprintf (label, INSN_LABEL_FMT, current_funcdef_number,
- (unsigned) INSN_UID (insn));
- ASM_OUTPUT_LABEL (asm_out_file, label);
- }
-}
-
-/* Output a marker (i.e. a label) for the point in the generated code where
- the real body of the function begins (after parameters have been moved
- to their home locations). */
-
-void
-dwarfout_begin_function ()
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- if (! use_gnu_debug_info_extensions)
- return;
- function_section (current_function_decl);
- sprintf (label, BODY_BEGIN_LABEL_FMT, current_funcdef_number);
- ASM_OUTPUT_LABEL (asm_out_file, label);
-}
-
-/* Output a marker (i.e. a label) for the point in the generated code where
- the real body of the function ends (just before the epilogue code). */
-
-void
-dwarfout_end_function ()
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- if (! use_gnu_debug_info_extensions)
- return;
- function_section (current_function_decl);
- sprintf (label, BODY_END_LABEL_FMT, current_funcdef_number);
- ASM_OUTPUT_LABEL (asm_out_file, label);
-}
-
-/* Output a marker (i.e. a label) for the absolute end of the generated code
- for a function definition. This gets called *after* the epilogue code
- has been generated. */
-
-void
-dwarfout_end_epilogue ()
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- /* Output a label to mark the endpoint of the code generated for this
- function. */
-
- sprintf (label, FUNC_END_LABEL_FMT, current_funcdef_number);
- ASM_OUTPUT_LABEL (asm_out_file, label);
-}
-
-static void
-shuffle_filename_entry (new_zeroth)
- register filename_entry *new_zeroth;
-{
- filename_entry temp_entry;
- register filename_entry *limit_p;
- register filename_entry *move_p;
-
- if (new_zeroth == &filename_table[0])
- return;
-
- temp_entry = *new_zeroth;
-
- /* Shift entries up in the table to make room at [0]. */
-
- limit_p = &filename_table[0];
- for (move_p = new_zeroth; move_p > limit_p; move_p--)
- *move_p = *(move_p-1);
-
- /* Install the found entry at [0]. */
-
- filename_table[0] = temp_entry;
-}
-
-/* Create a new (string) entry for the .debug_sfnames section. */
-
-static void
-generate_new_sfname_entry ()
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, SFNAMES_SECTION);
- sprintf (label, SFNAMES_ENTRY_LABEL_FMT, filename_table[0].number);
- ASM_OUTPUT_LABEL (asm_out_file, label);
- ASM_OUTPUT_DWARF_STRING (asm_out_file,
- filename_table[0].name
- ? filename_table[0].name
- : "");
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-}
-
-/* Lookup a filename (in the list of filenames that we know about here in
- dwarfout.c) and return its "index". The index of each (known) filename
- is just a unique number which is associated with only that one filename.
- We need such numbers for the sake of generating labels (in the
- .debug_sfnames section) and references to those unique labels (in the
- .debug_srcinfo and .debug_macinfo sections).
-
- If the filename given as an argument is not found in our current list,
- add it to the list and assign it the next available unique index number.
-
- Whatever we do (i.e. whether we find a pre-existing filename or add a new
- one), we shuffle the filename found (or added) up to the zeroth entry of
- our list of filenames (which is always searched linearly). We do this so
- as to optimize the most common case for these filename lookups within
- dwarfout.c. The most common case by far is the case where we call
- lookup_filename to lookup the very same filename that we did a lookup
- on the last time we called lookup_filename. We make sure that this
- common case is fast because such cases will constitute 99.9% of the
- lookups we ever do (in practice).
-
- If we add a new filename entry to our table, we go ahead and generate
- the corresponding entry in the .debug_sfnames section right away.
- Doing so allows us to avoid tickling an assembler bug (present in some
- m68k assemblers) which yields assembly-time errors in cases where the
- difference of two label addresses is taken and where the two labels
- are in a section *other* than the one where the difference is being
- calculated, and where at least one of the two symbol references is a
- forward reference. (This bug could be tickled by our .debug_srcinfo
- entries if we don't output their corresponding .debug_sfnames entries
- before them.) */
-
-static unsigned
-lookup_filename (file_name)
- char *file_name;
-{
- register filename_entry *search_p;
- register filename_entry *limit_p = &filename_table[ft_entries];
-
- for (search_p = filename_table; search_p < limit_p; search_p++)
- if (!strcmp (file_name, search_p->name))
- {
- /* When we get here, we have found the filename that we were
- looking for in the filename_table. Now we want to make sure
- that it gets moved to the zero'th entry in the table (if it
- is not already there) so that subsequent attempts to find the
- same filename will find it as quickly as possible. */
-
- shuffle_filename_entry (search_p);
- return filename_table[0].number;
- }
-
- /* We come here whenever we have a new filename which is not registered
- in the current table. Here we add it to the table. */
-
- /* Prepare to add a new table entry by making sure there is enough space
- in the table to do so. If not, expand the current table. */
-
- if (ft_entries == ft_entries_allocated)
- {
- ft_entries_allocated += FT_ENTRIES_INCREMENT;
- filename_table
- = (filename_entry *)
- xrealloc (filename_table,
- ft_entries_allocated * sizeof (filename_entry));
- }
-
- /* Initially, add the new entry at the end of the filename table. */
-
- filename_table[ft_entries].number = ft_entries;
- filename_table[ft_entries].name = xstrdup (file_name);
-
- /* Shuffle the new entry into filename_table[0]. */
-
- shuffle_filename_entry (&filename_table[ft_entries]);
-
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- generate_new_sfname_entry ();
-
- ft_entries++;
- return filename_table[0].number;
-}
-
-static void
-generate_srcinfo_entry (line_entry_num, files_entry_num)
- unsigned line_entry_num;
- unsigned files_entry_num;
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, SRCINFO_SECTION);
- sprintf (label, LINE_ENTRY_LABEL_FMT, line_entry_num);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, label, LINE_BEGIN_LABEL);
- sprintf (label, SFNAMES_ENTRY_LABEL_FMT, files_entry_num);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, label, SFNAMES_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-}
-
-void
-dwarfout_line (filename, line)
- register char *filename;
- register unsigned line;
-{
- if (debug_info_level >= DINFO_LEVEL_NORMAL
- /* We can't emit line number info for functions in separate sections,
- because the assembler can't subtract labels in different sections. */
- && DECL_SECTION_NAME (current_function_decl) == NULL_TREE)
- {
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
- static unsigned last_line_entry_num = 0;
- static unsigned prev_file_entry_num = (unsigned) -1;
- register unsigned this_file_entry_num;
-
- function_section (current_function_decl);
- sprintf (label, LINE_CODE_LABEL_FMT, ++last_line_entry_num);
- ASM_OUTPUT_LABEL (asm_out_file, label);
-
- fputc ('\n', asm_out_file);
-
- if (use_gnu_debug_info_extensions)
- this_file_entry_num = lookup_filename (filename);
- else
- this_file_entry_num = (unsigned) -1;
-
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, LINE_SECTION);
- if (this_file_entry_num != prev_file_entry_num)
- {
- char line_entry_label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- sprintf (line_entry_label, LINE_ENTRY_LABEL_FMT, last_line_entry_num);
- ASM_OUTPUT_LABEL (asm_out_file, line_entry_label);
- }
-
- {
- register char *tail = rindex (filename, '/');
-
- if (tail != NULL)
- filename = tail;
- }
-
- fprintf (asm_out_file, "\t%s\t%u\t%s %s:%u\n",
- UNALIGNED_INT_ASM_OP, line, ASM_COMMENT_START,
- filename, line);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, 0xffff);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, label, TEXT_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- if (this_file_entry_num != prev_file_entry_num)
- generate_srcinfo_entry (last_line_entry_num, this_file_entry_num);
- prev_file_entry_num = this_file_entry_num;
- }
-}
-
-/* Generate an entry in the .debug_macinfo section. */
-
-static void
-generate_macinfo_entry (type_and_offset, string)
- register char *type_and_offset;
- register char *string;
-{
- if (! use_gnu_debug_info_extensions)
- return;
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, MACINFO_SECTION);
- fprintf (asm_out_file, "\t%s\t%s\n", UNALIGNED_INT_ASM_OP, type_and_offset);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, string);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-}
-
-void
-dwarfout_start_new_source_file (filename)
- register char *filename;
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
- char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*3];
-
- sprintf (label, SFNAMES_ENTRY_LABEL_FMT, lookup_filename (filename));
- sprintf (type_and_offset, "0x%08x+%s-%s",
- ((unsigned) MACINFO_start << 24), label, SFNAMES_BEGIN_LABEL);
- generate_macinfo_entry (type_and_offset, "");
-}
-
-void
-dwarfout_resume_previous_source_file (lineno)
- register unsigned lineno;
-{
- char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*2];
-
- sprintf (type_and_offset, "0x%08x+%u",
- ((unsigned) MACINFO_resume << 24), lineno);
- generate_macinfo_entry (type_and_offset, "");
-}
-
-/* Called from check_newline in c-parse.y. The `buffer' parameter
- contains the tail part of the directive line, i.e. the part which
- is past the initial whitespace, #, whitespace, directive-name,
- whitespace part. */
-
-void
-dwarfout_define (lineno, buffer)
- register unsigned lineno;
- register char *buffer;
-{
- static int initialized = 0;
- char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*2];
-
- if (!initialized)
- {
- dwarfout_start_new_source_file (primary_filename);
- initialized = 1;
- }
- sprintf (type_and_offset, "0x%08x+%u",
- ((unsigned) MACINFO_define << 24), lineno);
- generate_macinfo_entry (type_and_offset, buffer);
-}
-
-/* Called from check_newline in c-parse.y. The `buffer' parameter
- contains the tail part of the directive line, i.e. the part which
- is past the initial whitespace, #, whitespace, directive-name,
- whitespace part. */
-
-void
-dwarfout_undef (lineno, buffer)
- register unsigned lineno;
- register char *buffer;
-{
- char type_and_offset[MAX_ARTIFICIAL_LABEL_BYTES*2];
-
- sprintf (type_and_offset, "0x%08x+%u",
- ((unsigned) MACINFO_undef << 24), lineno);
- generate_macinfo_entry (type_and_offset, buffer);
-}
-
-/* Set up for Dwarf output at the start of compilation. */
-
-void
-dwarfout_init (asm_out_file, main_input_filename)
- register FILE *asm_out_file;
- register char *main_input_filename;
-{
- /* Remember the name of the primary input file. */
-
- primary_filename = main_input_filename;
-
- /* Allocate the initial hunk of the pending_sibling_stack. */
-
- pending_sibling_stack
- = (unsigned *)
- xmalloc (PENDING_SIBLINGS_INCREMENT * sizeof (unsigned));
- pending_siblings_allocated = PENDING_SIBLINGS_INCREMENT;
- pending_siblings = 1;
-
- /* Allocate the initial hunk of the filename_table. */
-
- filename_table
- = (filename_entry *)
- xmalloc (FT_ENTRIES_INCREMENT * sizeof (filename_entry));
- ft_entries_allocated = FT_ENTRIES_INCREMENT;
- ft_entries = 0;
-
- /* Allocate the initial hunk of the pending_types_list. */
-
- pending_types_list
- = (tree *) xmalloc (PENDING_TYPES_INCREMENT * sizeof (tree));
- pending_types_allocated = PENDING_TYPES_INCREMENT;
- pending_types = 0;
-
- /* Create an artificial RECORD_TYPE node which we can use in our hack
- to get the DIEs representing types of formal parameters to come out
- only *after* the DIEs for the formal parameters themselves. */
-
- fake_containing_scope = make_node (RECORD_TYPE);
-
- /* Output a starting label for the .text section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, TEXT_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, TEXT_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- /* Output a starting label for the .data section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, DATA_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, DATA_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
-#if 0 /* GNU C doesn't currently use .data1. */
- /* Output a starting label for the .data1 section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, DATA1_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, DATA1_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-#endif
-
- /* Output a starting label for the .rodata section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, RODATA_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, RODATA_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
-#if 0 /* GNU C doesn't currently use .rodata1. */
- /* Output a starting label for the .rodata1 section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, RODATA1_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, RODATA1_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-#endif
-
- /* Output a starting label for the .bss section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, BSS_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, BSS_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- {
- if (use_gnu_debug_info_extensions)
- {
- /* Output a starting label and an initial (compilation directory)
- entry for the .debug_sfnames section. The starting label will be
- referenced by the initial entry in the .debug_srcinfo section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, SFNAMES_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, SFNAMES_BEGIN_LABEL);
- {
- register char *pwd;
- register unsigned len;
- register char *dirname;
-
- pwd = getpwd ();
- if (!pwd)
- pfatal_with_name ("getpwd");
- len = strlen (pwd);
- dirname = (char *) xmalloc (len + 2);
-
- strcpy (dirname, pwd);
- strcpy (dirname + len, "/");
- ASM_OUTPUT_DWARF_STRING (asm_out_file, dirname);
- free (dirname);
- }
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
-
- if (debug_info_level >= DINFO_LEVEL_VERBOSE
- && use_gnu_debug_info_extensions)
- {
- /* Output a starting label for the .debug_macinfo section. This
- label will be referenced by the AT_mac_info attribute in the
- TAG_compile_unit DIE. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, MACINFO_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, MACINFO_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
-
- /* Generate the initial entry for the .line section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, LINE_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, LINE_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, LINE_END_LABEL, LINE_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- if (use_gnu_debug_info_extensions)
- {
- /* Generate the initial entry for the .debug_srcinfo section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, SRCINFO_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, SRCINFO_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, LINE_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, SFNAMES_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_END_LABEL);
-#ifdef DWARF_TIMESTAMPS
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, time (NULL));
-#else
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, -1);
-#endif
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
-
- /* Generate the initial entry for the .debug_pubnames section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, DEBUG_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- /* Generate the initial entry for the .debug_aranges section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, ARANGES_SECTION);
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, DEBUG_BEGIN_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
-
- /* Setup first DIE number == 1. */
- NEXT_DIE_NUM = next_unused_dienum++;
-
- /* Generate the initial DIE for the .debug section. Note that the
- (string) value given in the AT_name attribute of the TAG_compile_unit
- DIE will (typically) be a relative pathname and that this pathname
- should be taken as being relative to the directory from which the
- compiler was invoked when the given (base) source file was compiled. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, DEBUG_BEGIN_LABEL);
- output_die (output_compile_unit_die, main_input_filename);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- fputc ('\n', asm_out_file);
-}
-
-/* Output stuff that dwarf requires at the end of every file. */
-
-void
-dwarfout_finish ()
-{
- char label[MAX_ARTIFICIAL_LABEL_BYTES];
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION);
-
- /* Mark the end of the chain of siblings which represent all file-scope
- declarations in this compilation unit. */
-
- /* The (null) DIE which represents the terminator for the (sibling linked)
- list of file-scope items is *special*. Normally, we would just call
- end_sibling_chain at this point in order to output a word with the
- value `4' and that word would act as the terminator for the list of
- DIEs describing file-scope items. Unfortunately, if we were to simply
- do that, the label that would follow this DIE in the .debug section
- (i.e. `..D2') would *not* be properly aligned (as it must be on some
- machines) to a 4 byte boundary.
-
- In order to force the label `..D2' to get aligned to a 4 byte boundary,
- the trick used is to insert extra (otherwise useless) padding bytes
- into the (null) DIE that we know must precede the ..D2 label in the
- .debug section. The amount of padding required can be anywhere between
- 0 and 3 bytes. The length word at the start of this DIE (i.e. the one
- with the padding) would normally contain the value 4, but now it will
- also have to include the padding bytes, so it will instead have some
- value in the range 4..7.
-
- Fortunately, the rules of Dwarf say that any DIE whose length word
- contains *any* value less than 8 should be treated as a null DIE, so
- this trick works out nicely. Clever, eh? Don't give me any credit
- (or blame). I didn't think of this scheme. I just conformed to it.
- */
-
- output_die (output_padded_null_die, (void *) 0);
- dienum_pop ();
-
- sprintf (label, DIE_BEGIN_LABEL_FMT, NEXT_DIE_NUM);
- ASM_OUTPUT_LABEL (asm_out_file, label); /* should be ..D2 */
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- /* Output a terminator label for the .text section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, TEXT_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, TEXT_END_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- /* Output a terminator label for the .data section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, DATA_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, DATA_END_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
-#if 0 /* GNU C doesn't currently use .data1. */
- /* Output a terminator label for the .data1 section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, DATA1_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, DATA1_END_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-#endif
-
- /* Output a terminator label for the .rodata section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, RODATA_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, RODATA_END_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
-#if 0 /* GNU C doesn't currently use .rodata1. */
- /* Output a terminator label for the .rodata1 section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, RODATA1_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, RODATA1_END_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-#endif
-
- /* Output a terminator label for the .bss section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, BSS_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, BSS_END_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- if (debug_info_level >= DINFO_LEVEL_NORMAL)
- {
- /* Output a terminating entry for the .line section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, LINE_SECTION);
- ASM_OUTPUT_LABEL (asm_out_file, LINE_LAST_ENTRY_LABEL);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
- ASM_OUTPUT_DWARF_DATA2 (asm_out_file, 0xffff);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, TEXT_END_LABEL, TEXT_BEGIN_LABEL);
- ASM_OUTPUT_LABEL (asm_out_file, LINE_END_LABEL);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- if (use_gnu_debug_info_extensions)
- {
- /* Output a terminating entry for the .debug_srcinfo section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, SRCINFO_SECTION);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file,
- LINE_LAST_ENTRY_LABEL, LINE_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, -1);
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
-
- if (debug_info_level >= DINFO_LEVEL_VERBOSE)
- {
- /* Output terminating entries for the .debug_macinfo section. */
-
- dwarfout_resume_previous_source_file (0);
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, MACINFO_SECTION);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
-
- /* Generate the terminating entry for the .debug_pubnames section. */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
- ASM_OUTPUT_DWARF_STRING (asm_out_file, "");
- ASM_OUTPUT_POP_SECTION (asm_out_file);
-
- /* Generate the terminating entries for the .debug_aranges section.
-
- Note that we want to do this only *after* we have output the end
- labels (for the various program sections) which we are going to
- refer to here. This allows us to work around a bug in the m68k
- svr4 assembler. That assembler gives bogus assembly-time errors
- if (within any given section) you try to take the difference of
- two relocatable symbols, both of which are located within some
- other section, and if one (or both?) of the symbols involved is
- being forward-referenced. By generating the .debug_aranges
- entries at this late point in the assembly output, we skirt the
- issue simply by avoiding forward-references.
- */
-
- fputc ('\n', asm_out_file);
- ASM_OUTPUT_PUSH_SECTION (asm_out_file, ARANGES_SECTION);
-
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, TEXT_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, TEXT_END_LABEL, TEXT_BEGIN_LABEL);
-
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, DATA_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, DATA_END_LABEL, DATA_BEGIN_LABEL);
-
-#if 0 /* GNU C doesn't currently use .data1. */
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, DATA1_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, DATA1_END_LABEL,
- DATA1_BEGIN_LABEL);
-#endif
-
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, RODATA_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, RODATA_END_LABEL,
- RODATA_BEGIN_LABEL);
-
-#if 0 /* GNU C doesn't currently use .rodata1. */
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, RODATA1_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, RODATA1_END_LABEL,
- RODATA1_BEGIN_LABEL);
-#endif
-
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, BSS_BEGIN_LABEL);
- ASM_OUTPUT_DWARF_DELTA4 (asm_out_file, BSS_END_LABEL, BSS_BEGIN_LABEL);
-
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0);
-
- ASM_OUTPUT_POP_SECTION (asm_out_file);
- }
-}
-
-#endif /* DWARF_DEBUGGING_INFO */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
deleted file mode 100644
index 734ec3f371b..00000000000
--- a/gcc/emit-rtl.c
+++ /dev/null
@@ -1,3470 +0,0 @@
-/* Emit RTL for the GNU C-Compiler expander.
- Copyright (C) 1987, 88, 92-96, 1997 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. */
-
-
-/* Middle-to-low level generation of rtx code and insns.
-
- This file contains the functions `gen_rtx', `gen_reg_rtx'
- and `gen_label_rtx' that are the usual ways of creating rtl
- expressions for most purposes.
-
- It also has the functions for creating insns and linking
- them in the doubly-linked chain.
-
- The patterns of the insns are created by machine-dependent
- routines in insn-emit.c, which is generated automatically from
- the machine description. These routines use `gen_rtx' to make
- the individual rtx's of the pattern; what is machine dependent
- is the kind of rtx's they make and what arguments they use. */
-
-#include "config.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "except.h"
-#include "function.h"
-#include "expr.h"
-#include "regs.h"
-#include "insn-config.h"
-#include "real.h"
-#include "obstack.h"
-
-#include "bytecode.h"
-#include "machmode.h"
-#include "bc-opcode.h"
-#include "bc-typecd.h"
-#include "bc-optab.h"
-#include "bc-emit.h"
-
-#include <stdio.h>
-
-
-/* Opcode names */
-#ifdef BCDEBUG_PRINT_CODE
-char *opcode_name[] =
-{
-#include "bc-opname.h"
-
-"***END***"
-};
-#endif
-
-
-/* Commonly used modes. */
-
-enum machine_mode byte_mode; /* Mode whose width is BITS_PER_UNIT. */
-enum machine_mode word_mode; /* Mode whose width is BITS_PER_WORD. */
-enum machine_mode ptr_mode; /* Mode whose width is POINTER_SIZE. */
-
-/* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function.
- After rtl generation, it is 1 plus the largest register number used. */
-
-int reg_rtx_no = LAST_VIRTUAL_REGISTER + 1;
-
-/* This is *not* reset after each function. It gives each CODE_LABEL
- in the entire compilation a unique label number. */
-
-static int label_num = 1;
-
-/* Lowest label number in current function. */
-
-static int first_label_num;
-
-/* Highest label number in current function.
- Zero means use the value of label_num instead.
- This is nonzero only when belatedly compiling an inline function. */
-
-static int last_label_num;
-
-/* Value label_num had when set_new_first_and_last_label_number was called.
- If label_num has not changed since then, last_label_num is valid. */
-
-static int base_label_num;
-
-/* Nonzero means do not generate NOTEs for source line numbers. */
-
-static int no_line_numbers;
-
-/* Commonly used rtx's, so that we only need space for one copy.
- These are initialized once for the entire compilation.
- All of these except perhaps the floating-point CONST_DOUBLEs
- are unique; no other rtx-object will be equal to any of these. */
-
-rtx pc_rtx; /* (PC) */
-rtx cc0_rtx; /* (CC0) */
-rtx cc1_rtx; /* (CC1) (not actually used nowadays) */
-rtx const0_rtx; /* (CONST_INT 0) */
-rtx const1_rtx; /* (CONST_INT 1) */
-rtx const2_rtx; /* (CONST_INT 2) */
-rtx constm1_rtx; /* (CONST_INT -1) */
-rtx const_true_rtx; /* (CONST_INT STORE_FLAG_VALUE) */
-
-/* We record floating-point CONST_DOUBLEs in each floating-point mode for
- the values of 0, 1, and 2. For the integer entries and VOIDmode, we
- record a copy of const[012]_rtx. */
-
-rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE];
-
-REAL_VALUE_TYPE dconst0;
-REAL_VALUE_TYPE dconst1;
-REAL_VALUE_TYPE dconst2;
-REAL_VALUE_TYPE dconstm1;
-
-/* All references to the following fixed hard registers go through
- these unique rtl objects. On machines where the frame-pointer and
- arg-pointer are the same register, they use the same unique object.
-
- After register allocation, other rtl objects which used to be pseudo-regs
- may be clobbered to refer to the frame-pointer register.
- But references that were originally to the frame-pointer can be
- distinguished from the others because they contain frame_pointer_rtx.
-
- When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little
- tricky: until register elimination has taken place hard_frame_pointer_rtx
- should be used if it is being set, and frame_pointer_rtx otherwise. After
- register elimination hard_frame_pointer_rtx should always be used.
- On machines where the two registers are same (most) then these are the
- same.
-
- In an inline procedure, the stack and frame pointer rtxs may not be
- used for anything else. */
-rtx stack_pointer_rtx; /* (REG:Pmode STACK_POINTER_REGNUM) */
-rtx frame_pointer_rtx; /* (REG:Pmode FRAME_POINTER_REGNUM) */
-rtx hard_frame_pointer_rtx; /* (REG:Pmode HARD_FRAME_POINTER_REGNUM) */
-rtx arg_pointer_rtx; /* (REG:Pmode ARG_POINTER_REGNUM) */
-rtx struct_value_rtx; /* (REG:Pmode STRUCT_VALUE_REGNUM) */
-rtx struct_value_incoming_rtx; /* (REG:Pmode STRUCT_VALUE_INCOMING_REGNUM) */
-rtx static_chain_rtx; /* (REG:Pmode STATIC_CHAIN_REGNUM) */
-rtx static_chain_incoming_rtx; /* (REG:Pmode STATIC_CHAIN_INCOMING_REGNUM) */
-rtx pic_offset_table_rtx; /* (REG:Pmode PIC_OFFSET_TABLE_REGNUM) */
-
-/* This is used to implement __builtin_return_address for some machines.
- See for instance the MIPS port. */
-rtx return_address_pointer_rtx; /* (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM) */
-
-rtx virtual_incoming_args_rtx; /* (REG:Pmode VIRTUAL_INCOMING_ARGS_REGNUM) */
-rtx virtual_stack_vars_rtx; /* (REG:Pmode VIRTUAL_STACK_VARS_REGNUM) */
-rtx virtual_stack_dynamic_rtx; /* (REG:Pmode VIRTUAL_STACK_DYNAMIC_REGNUM) */
-rtx virtual_outgoing_args_rtx; /* (REG:Pmode VIRTUAL_OUTGOING_ARGS_REGNUM) */
-
-/* We make one copy of (const_int C) where C is in
- [- MAX_SAVED_CONST_INT, MAX_SAVED_CONST_INT]
- to save space during the compilation and simplify comparisons of
- integers. */
-
-#define MAX_SAVED_CONST_INT 64
-
-static rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1];
-
-/* The ends of the doubly-linked chain of rtl for the current function.
- Both are reset to null at the start of rtl generation for the function.
-
- start_sequence saves both of these on `sequence_stack' along with
- `sequence_rtl_expr' and then starts a new, nested sequence of insns. */
-
-static rtx first_insn = NULL;
-static rtx last_insn = NULL;
-
-/* RTL_EXPR within which the current sequence will be placed. Use to
- prevent reuse of any temporaries within the sequence until after the
- RTL_EXPR is emitted. */
-
-tree sequence_rtl_expr = NULL;
-
-/* INSN_UID for next insn emitted.
- Reset to 1 for each function compiled. */
-
-static int cur_insn_uid = 1;
-
-/* Line number and source file of the last line-number NOTE emitted.
- This is used to avoid generating duplicates. */
-
-static int last_linenum = 0;
-static char *last_filename = 0;
-
-/* A vector indexed by pseudo reg number. The allocated length
- of this vector is regno_pointer_flag_length. Since this
- vector is needed during the expansion phase when the total
- number of registers in the function is not yet known,
- it is copied and made bigger when necessary. */
-
-char *regno_pointer_flag;
-int regno_pointer_flag_length;
-
-/* Indexed by pseudo register number, if nonzero gives the known alignment
- for that pseudo (if regno_pointer_flag is set).
- Allocated in parallel with regno_pointer_flag. */
-char *regno_pointer_align;
-
-/* Indexed by pseudo register number, gives the rtx for that pseudo.
- Allocated in parallel with regno_pointer_flag. */
-
-rtx *regno_reg_rtx;
-
-/* Stack of pending (incomplete) sequences saved by `start_sequence'.
- Each element describes one pending sequence.
- The main insn-chain is saved in the last element of the chain,
- unless the chain is empty. */
-
-struct sequence_stack *sequence_stack;
-
-/* start_sequence and gen_sequence can make a lot of rtx expressions which are
- shortly thrown away. We use two mechanisms to prevent this waste:
-
- First, we keep a list of the expressions used to represent the sequence
- stack in sequence_element_free_list.
-
- Second, for sizes up to 5 elements, we keep a SEQUENCE and its associated
- rtvec for use by gen_sequence. One entry for each size is sufficient
- because most cases are calls to gen_sequence followed by immediately
- emitting the SEQUENCE. Reuse is safe since emitting a sequence is
- destructive on the insn in it anyway and hence can't be redone.
-
- We do not bother to save this cached data over nested function calls.
- Instead, we just reinitialize them. */
-
-#define SEQUENCE_RESULT_SIZE 5
-
-static struct sequence_stack *sequence_element_free_list;
-static rtx sequence_result[SEQUENCE_RESULT_SIZE];
-
-/* During RTL generation, we also keep a list of free INSN rtl codes. */
-static rtx free_insn;
-
-extern int rtx_equal_function_value_matters;
-
-/* Filename and line number of last line-number note,
- whether we actually emitted it or not. */
-extern char *emit_filename;
-extern int emit_lineno;
-
-rtx change_address ();
-void init_emit ();
-
-extern struct obstack *rtl_obstack;
-
-extern int stack_depth;
-extern int max_stack_depth;
-
-/* rtx gen_rtx (code, mode, [element1, ..., elementn])
-**
-** This routine generates an RTX of the size specified by
-** <code>, which is an RTX code. The RTX structure is initialized
-** from the arguments <element1> through <elementn>, which are
-** interpreted according to the specific RTX type's format. The
-** special machine mode associated with the rtx (if any) is specified
-** in <mode>.
-**
-** gen_rtx can be invoked in a way which resembles the lisp-like
-** rtx it will generate. For example, the following rtx structure:
-**
-** (plus:QI (mem:QI (reg:SI 1))
-** (mem:QI (plusw:SI (reg:SI 2) (reg:SI 3))))
-**
-** ...would be generated by the following C code:
-**
-** gen_rtx (PLUS, QImode,
-** gen_rtx (MEM, QImode,
-** gen_rtx (REG, SImode, 1)),
-** gen_rtx (MEM, QImode,
-** gen_rtx (PLUS, SImode,
-** gen_rtx (REG, SImode, 2),
-** gen_rtx (REG, SImode, 3)))),
-*/
-
-/*VARARGS2*/
-rtx
-gen_rtx VPROTO((enum rtx_code code, enum machine_mode mode, ...))
-{
-#ifndef __STDC__
- enum rtx_code code;
- enum machine_mode mode;
-#endif
- va_list p;
- register int i; /* Array indices... */
- register char *fmt; /* Current rtx's format... */
- register rtx rt_val; /* RTX to return to caller... */
-
- VA_START (p, mode);
-
-#ifndef __STDC__
- code = va_arg (p, enum rtx_code);
- mode = va_arg (p, enum machine_mode);
-#endif
-
- if (code == CONST_INT)
- {
- HOST_WIDE_INT arg = va_arg (p, HOST_WIDE_INT);
-
- if (arg >= - MAX_SAVED_CONST_INT && arg <= MAX_SAVED_CONST_INT)
- return const_int_rtx[arg + MAX_SAVED_CONST_INT];
-
- if (const_true_rtx && arg == STORE_FLAG_VALUE)
- return const_true_rtx;
-
- rt_val = rtx_alloc (code);
- INTVAL (rt_val) = arg;
- }
- else if (code == REG)
- {
- int regno = va_arg (p, int);
-
- /* In case the MD file explicitly references the frame pointer, have
- all such references point to the same frame pointer. This is used
- during frame pointer elimination to distinguish the explicit
- references to these registers from pseudos that happened to be
- assigned to them.
-
- If we have eliminated the frame pointer or arg pointer, we will
- be using it as a normal register, for example as a spill register.
- In such cases, we might be accessing it in a mode that is not
- Pmode and therefore cannot use the pre-allocated rtx.
-
- Also don't do this when we are making new REGs in reload,
- since we don't want to get confused with the real pointers. */
-
- if (frame_pointer_rtx && regno == FRAME_POINTER_REGNUM && mode == Pmode
- && ! reload_in_progress)
- return frame_pointer_rtx;
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- if (hard_frame_pointer_rtx && regno == HARD_FRAME_POINTER_REGNUM
- && mode == Pmode && ! reload_in_progress)
- return hard_frame_pointer_rtx;
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM && HARD_FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- if (arg_pointer_rtx && regno == ARG_POINTER_REGNUM && mode == Pmode
- && ! reload_in_progress)
- return arg_pointer_rtx;
-#endif
-#ifdef RETURN_ADDRESS_POINTER_REGNUM
- if (return_address_pointer_rtx && regno == RETURN_ADDRESS_POINTER_REGNUM
- && mode == Pmode && ! reload_in_progress)
- return return_address_pointer_rtx;
-#endif
- if (stack_pointer_rtx && regno == STACK_POINTER_REGNUM && mode == Pmode
- && ! reload_in_progress)
- return stack_pointer_rtx;
- else
- {
- rt_val = rtx_alloc (code);
- rt_val->mode = mode;
- REGNO (rt_val) = regno;
- return rt_val;
- }
- }
- else
- {
- rt_val = rtx_alloc (code); /* Allocate the storage space. */
- rt_val->mode = mode; /* Store the machine mode... */
-
- fmt = GET_RTX_FORMAT (code); /* Find the right format... */
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*fmt++)
- {
- case '0': /* Unused field. */
- break;
-
- case 'i': /* An integer? */
- XINT (rt_val, i) = va_arg (p, int);
- break;
-
- case 'w': /* A wide integer? */
- XWINT (rt_val, i) = va_arg (p, HOST_WIDE_INT);
- break;
-
- case 's': /* A string? */
- XSTR (rt_val, i) = va_arg (p, char *);
- break;
-
- case 'e': /* An expression? */
- case 'u': /* An insn? Same except when printing. */
- XEXP (rt_val, i) = va_arg (p, rtx);
- break;
-
- case 'E': /* An RTX vector? */
- XVEC (rt_val, i) = va_arg (p, rtvec);
- break;
-
- default:
- abort ();
- }
- }
- }
- va_end (p);
- return rt_val; /* Return the new RTX... */
-}
-
-/* gen_rtvec (n, [rt1, ..., rtn])
-**
-** This routine creates an rtvec and stores within it the
-** pointers to rtx's which are its arguments.
-*/
-
-/*VARARGS1*/
-rtvec
-gen_rtvec VPROTO((int n, ...))
-{
-#ifndef __STDC__
- int n;
-#endif
- int i;
- va_list p;
- rtx *vector;
-
- VA_START (p, n);
-
-#ifndef __STDC__
- n = va_arg (p, int);
-#endif
-
- if (n == 0)
- return NULL_RTVEC; /* Don't allocate an empty rtvec... */
-
- vector = (rtx *) alloca (n * sizeof (rtx));
-
- for (i = 0; i < n; i++)
- vector[i] = va_arg (p, rtx);
- va_end (p);
-
- return gen_rtvec_v (n, vector);
-}
-
-rtvec
-gen_rtvec_v (n, argp)
- int n;
- rtx *argp;
-{
- register int i;
- register rtvec rt_val;
-
- if (n == 0)
- return NULL_RTVEC; /* Don't allocate an empty rtvec... */
-
- rt_val = rtvec_alloc (n); /* Allocate an rtvec... */
-
- for (i = 0; i < n; i++)
- rt_val->elem[i].rtx = *argp++;
-
- return rt_val;
-}
-
-rtvec
-gen_rtvec_vv (n, argp)
- int n;
- rtunion *argp;
-{
- register int i;
- register rtvec rt_val;
-
- if (n == 0)
- return NULL_RTVEC; /* Don't allocate an empty rtvec... */
-
- rt_val = rtvec_alloc (n); /* Allocate an rtvec... */
-
- for (i = 0; i < n; i++)
- rt_val->elem[i].rtx = (argp++)->rtx;
-
- return rt_val;
-}
-
-/* Generate a REG rtx for a new pseudo register of mode MODE.
- This pseudo is assigned the next sequential register number. */
-
-rtx
-gen_reg_rtx (mode)
- enum machine_mode mode;
-{
- register rtx val;
-
- /* Don't let anything called by or after reload create new registers
- (actually, registers can't be created after flow, but this is a good
- approximation). */
-
- if (reload_in_progress || reload_completed)
- abort ();
-
- if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
- || GET_MODE_CLASS (mode) == MODE_COMPLEX_INT)
- {
- /* For complex modes, don't make a single pseudo.
- Instead, make a CONCAT of two pseudos.
- This allows noncontiguous allocation of the real and imaginary parts,
- which makes much better code. Besides, allocating DCmode
- pseudos overstrains reload on some machines like the 386. */
- rtx realpart, imagpart;
- int size = GET_MODE_UNIT_SIZE (mode);
- enum machine_mode partmode
- = mode_for_size (size * BITS_PER_UNIT,
- (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
- ? MODE_FLOAT : MODE_INT),
- 0);
-
- realpart = gen_reg_rtx (partmode);
- imagpart = gen_reg_rtx (partmode);
- return gen_rtx (CONCAT, mode, realpart, imagpart);
- }
-
- /* Make sure regno_pointer_flag and regno_reg_rtx are large
- enough to have an element for this pseudo reg number. */
-
- if (reg_rtx_no == regno_pointer_flag_length)
- {
- rtx *new1;
- char *new =
- (char *) savealloc (regno_pointer_flag_length * 2);
- bcopy (regno_pointer_flag, new, regno_pointer_flag_length);
- bzero (&new[regno_pointer_flag_length], regno_pointer_flag_length);
- regno_pointer_flag = new;
-
- new = (char *) savealloc (regno_pointer_flag_length * 2);
- bcopy (regno_pointer_align, new, regno_pointer_flag_length);
- bzero (&new[regno_pointer_flag_length], regno_pointer_flag_length);
- regno_pointer_align = new;
-
- new1 = (rtx *) savealloc (regno_pointer_flag_length * 2 * sizeof (rtx));
- bcopy ((char *) regno_reg_rtx, (char *) new1,
- regno_pointer_flag_length * sizeof (rtx));
- bzero ((char *) &new1[regno_pointer_flag_length],
- regno_pointer_flag_length * sizeof (rtx));
- regno_reg_rtx = new1;
-
- regno_pointer_flag_length *= 2;
- }
-
- val = gen_rtx (REG, mode, reg_rtx_no);
- regno_reg_rtx[reg_rtx_no++] = val;
- return val;
-}
-
-/* Identify REG (which may be a CONCAT) as a user register. */
-
-void
-mark_user_reg (reg)
- rtx reg;
-{
- if (GET_CODE (reg) == CONCAT)
- {
- REG_USERVAR_P (XEXP (reg, 0)) = 1;
- REG_USERVAR_P (XEXP (reg, 1)) = 1;
- }
- else if (GET_CODE (reg) == REG)
- REG_USERVAR_P (reg) = 1;
- else
- abort ();
-}
-
-/* Identify REG as a probable pointer register and show its alignment
- as ALIGN, if nonzero. */
-
-void
-mark_reg_pointer (reg, align)
- rtx reg;
- int align;
-{
- REGNO_POINTER_FLAG (REGNO (reg)) = 1;
-
- if (align)
- REGNO_POINTER_ALIGN (REGNO (reg)) = align;
-}
-
-/* Return 1 plus largest pseudo reg number used in the current function. */
-
-int
-max_reg_num ()
-{
- return reg_rtx_no;
-}
-
-/* Return 1 + the largest label number used so far in the current function. */
-
-int
-max_label_num ()
-{
- if (last_label_num && label_num == base_label_num)
- return last_label_num;
- return label_num;
-}
-
-/* Return first label number used in this function (if any were used). */
-
-int
-get_first_label_num ()
-{
- return first_label_num;
-}
-
-/* Return a value representing some low-order bits of X, where the number
- of low-order bits is given by MODE. Note that no conversion is done
- between floating-point and fixed-point values, rather, the bit
- representation is returned.
-
- This function handles the cases in common between gen_lowpart, below,
- and two variants in cse.c and combine.c. These are the cases that can
- be safely handled at all points in the compilation.
-
- If this is not a case we can handle, return 0. */
-
-rtx
-gen_lowpart_common (mode, x)
- enum machine_mode mode;
- register rtx x;
-{
- int word = 0;
-
- if (GET_MODE (x) == mode)
- return x;
-
- /* MODE must occupy no more words than the mode of X. */
- if (GET_MODE (x) != VOIDmode
- && ((GET_MODE_SIZE (mode) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD
- > ((GET_MODE_SIZE (GET_MODE (x)) + (UNITS_PER_WORD - 1))
- / UNITS_PER_WORD)))
- return 0;
-
- if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
- word = ((GET_MODE_SIZE (GET_MODE (x))
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD))
- / UNITS_PER_WORD);
-
- if ((GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND)
- && (GET_MODE_CLASS (mode) == MODE_INT
- || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT))
- {
- /* If we are getting the low-order part of something that has been
- sign- or zero-extended, we can either just use the object being
- extended or make a narrower extension. If we want an even smaller
- piece than the size of the object being extended, call ourselves
- recursively.
-
- This case is used mostly by combine and cse. */
-
- if (GET_MODE (XEXP (x, 0)) == mode)
- return XEXP (x, 0);
- else if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (XEXP (x, 0))))
- return gen_lowpart_common (mode, XEXP (x, 0));
- else if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (x)))
- return gen_rtx (GET_CODE (x), mode, XEXP (x, 0));
- }
- else if (GET_CODE (x) == SUBREG
- && (GET_MODE_SIZE (mode) <= UNITS_PER_WORD
- || GET_MODE_SIZE (mode) == GET_MODE_UNIT_SIZE (GET_MODE (x))))
- return (GET_MODE (SUBREG_REG (x)) == mode && SUBREG_WORD (x) == 0
- ? SUBREG_REG (x)
- : gen_rtx (SUBREG, mode, SUBREG_REG (x), SUBREG_WORD (x)));
- else if (GET_CODE (x) == REG)
- {
- /* If the register is not valid for MODE, return 0. If we don't
- do this, there is no way to fix up the resulting REG later.
- But we do do this if the current REG is not valid for its
- mode. This latter is a kludge, but is required due to the
- way that parameters are passed on some machines, most
- notably Sparc. */
- if (REGNO (x) < FIRST_PSEUDO_REGISTER
- && ! HARD_REGNO_MODE_OK (REGNO (x) + word, mode)
- && HARD_REGNO_MODE_OK (REGNO (x), GET_MODE (x)))
- return 0;
- else if (REGNO (x) < FIRST_PSEUDO_REGISTER
- /* integrate.c can't handle parts of a return value register. */
- && (! REG_FUNCTION_VALUE_P (x)
- || ! rtx_equal_function_value_matters)
- /* We want to keep the stack, frame, and arg pointers
- special. */
- && x != frame_pointer_rtx
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- && x != arg_pointer_rtx
-#endif
- && x != stack_pointer_rtx)
- return gen_rtx (REG, mode, REGNO (x) + word);
- else
- return gen_rtx (SUBREG, mode, x, word);
- }
- /* If X is a CONST_INT or a CONST_DOUBLE, extract the appropriate bits
- from the low-order part of the constant. */
- else if ((GET_MODE_CLASS (mode) == MODE_INT
- || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
- && GET_MODE (x) == VOIDmode
- && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE))
- {
- /* If MODE is twice the host word size, X is already the desired
- representation. Otherwise, if MODE is wider than a word, we can't
- do this. If MODE is exactly a word, return just one CONST_INT.
- If MODE is smaller than a word, clear the bits that don't belong
- in our mode, unless they and our sign bit are all one. So we get
- either a reasonable negative value or a reasonable unsigned value
- for this mode. */
-
- if (GET_MODE_BITSIZE (mode) >= 2 * HOST_BITS_PER_WIDE_INT)
- return x;
- else if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT)
- return 0;
- else if (GET_MODE_BITSIZE (mode) == HOST_BITS_PER_WIDE_INT)
- return (GET_CODE (x) == CONST_INT ? x
- : GEN_INT (CONST_DOUBLE_LOW (x)));
- else
- {
- /* MODE must be narrower than HOST_BITS_PER_INT. */
- int width = GET_MODE_BITSIZE (mode);
- HOST_WIDE_INT val = (GET_CODE (x) == CONST_INT ? INTVAL (x)
- : CONST_DOUBLE_LOW (x));
-
- if (((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
- != ((HOST_WIDE_INT) (-1) << (width - 1))))
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
-
- return (GET_CODE (x) == CONST_INT && INTVAL (x) == val ? x
- : GEN_INT (val));
- }
- }
-
- /* If X is an integral constant but we want it in floating-point, it
- must be the case that we have a union of an integer and a floating-point
- value. If the machine-parameters allow it, simulate that union here
- and return the result. The two-word and single-word cases are
- different. */
-
- else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
- || flag_pretend_float)
- && GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_MODE_SIZE (mode) == UNITS_PER_WORD
- && GET_CODE (x) == CONST_INT
- && sizeof (float) * HOST_BITS_PER_CHAR == HOST_BITS_PER_WIDE_INT)
-#ifdef REAL_ARITHMETIC
- {
- REAL_VALUE_TYPE r;
- HOST_WIDE_INT i;
-
- i = INTVAL (x);
- r = REAL_VALUE_FROM_TARGET_SINGLE (i);
- return CONST_DOUBLE_FROM_REAL_VALUE (r, mode);
- }
-#else
- {
- union {HOST_WIDE_INT i; float d; } u;
-
- u.i = INTVAL (x);
- return CONST_DOUBLE_FROM_REAL_VALUE (u.d, mode);
- }
-#endif
- else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
- || flag_pretend_float)
- && GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)
- && GET_MODE (x) == VOIDmode
- && (sizeof (double) * HOST_BITS_PER_CHAR
- == 2 * HOST_BITS_PER_WIDE_INT))
-#ifdef REAL_ARITHMETIC
- {
- REAL_VALUE_TYPE r;
- HOST_WIDE_INT i[2];
- HOST_WIDE_INT low, high;
-
- if (GET_CODE (x) == CONST_INT)
- low = INTVAL (x), high = low >> (HOST_BITS_PER_WIDE_INT -1);
- else
- low = CONST_DOUBLE_LOW (x), high = CONST_DOUBLE_HIGH (x);
-
- /* REAL_VALUE_TARGET_DOUBLE takes the addressing order of the
- target machine. */
- if (WORDS_BIG_ENDIAN)
- i[0] = high, i[1] = low;
- else
- i[0] = low, i[1] = high;
-
- r = REAL_VALUE_FROM_TARGET_DOUBLE (i);
- return CONST_DOUBLE_FROM_REAL_VALUE (r, mode);
- }
-#else
- {
- union {HOST_WIDE_INT i[2]; double d; } u;
- HOST_WIDE_INT low, high;
-
- if (GET_CODE (x) == CONST_INT)
- low = INTVAL (x), high = low >> (HOST_BITS_PER_WIDE_INT -1);
- else
- low = CONST_DOUBLE_LOW (x), high = CONST_DOUBLE_HIGH (x);
-
-#ifdef HOST_WORDS_BIG_ENDIAN
- u.i[0] = high, u.i[1] = low;
-#else
- u.i[0] = low, u.i[1] = high;
-#endif
-
- return CONST_DOUBLE_FROM_REAL_VALUE (u.d, mode);
- }
-#endif
- /* Similarly, if this is converting a floating-point value into a
- single-word integer. Only do this is the host and target parameters are
- compatible. */
-
- else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
- || flag_pretend_float)
- && (GET_MODE_CLASS (mode) == MODE_INT
- || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
- && GET_CODE (x) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT
- && GET_MODE_BITSIZE (mode) == BITS_PER_WORD)
- return operand_subword (x, word, 0, GET_MODE (x));
-
- /* Similarly, if this is converting a floating-point value into a
- two-word integer, we can do this one word at a time and make an
- integer. Only do this is the host and target parameters are
- compatible. */
-
- else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
- || flag_pretend_float)
- && (GET_MODE_CLASS (mode) == MODE_INT
- || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
- && GET_CODE (x) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT
- && GET_MODE_BITSIZE (mode) == 2 * BITS_PER_WORD)
- {
- rtx lowpart
- = operand_subword (x, word + WORDS_BIG_ENDIAN, 0, GET_MODE (x));
- rtx highpart
- = operand_subword (x, word + ! WORDS_BIG_ENDIAN, 0, GET_MODE (x));
-
- if (lowpart && GET_CODE (lowpart) == CONST_INT
- && highpart && GET_CODE (highpart) == CONST_INT)
- return immed_double_const (INTVAL (lowpart), INTVAL (highpart), mode);
- }
-
- /* Otherwise, we can't do this. */
- return 0;
-}
-
-/* Return the real part (which has mode MODE) of a complex value X.
- This always comes at the low address in memory. */
-
-rtx
-gen_realpart (mode, x)
- enum machine_mode mode;
- register rtx x;
-{
- if (GET_CODE (x) == CONCAT && GET_MODE (XEXP (x, 0)) == mode)
- return XEXP (x, 0);
- else if (WORDS_BIG_ENDIAN)
- return gen_highpart (mode, x);
- else
- return gen_lowpart (mode, x);
-}
-
-/* Return the imaginary part (which has mode MODE) of a complex value X.
- This always comes at the high address in memory. */
-
-rtx
-gen_imagpart (mode, x)
- enum machine_mode mode;
- register rtx x;
-{
- if (GET_CODE (x) == CONCAT && GET_MODE (XEXP (x, 0)) == mode)
- return XEXP (x, 1);
- else if (WORDS_BIG_ENDIAN)
- return gen_lowpart (mode, x);
- else
- return gen_highpart (mode, x);
-}
-
-/* Return 1 iff X, assumed to be a SUBREG,
- refers to the real part of the complex value in its containing reg.
- Complex values are always stored with the real part in the first word,
- regardless of WORDS_BIG_ENDIAN. */
-
-int
-subreg_realpart_p (x)
- rtx x;
-{
- if (GET_CODE (x) != SUBREG)
- abort ();
-
- return SUBREG_WORD (x) == 0;
-}
-
-/* Assuming that X is an rtx (e.g., MEM, REG or SUBREG) for a value,
- return an rtx (MEM, SUBREG, or CONST_INT) that refers to the
- least-significant part of X.
- MODE specifies how big a part of X to return;
- it usually should not be larger than a word.
- If X is a MEM whose address is a QUEUED, the value may be so also. */
-
-rtx
-gen_lowpart (mode, x)
- enum machine_mode mode;
- register rtx x;
-{
- rtx result = gen_lowpart_common (mode, x);
-
- if (result)
- return result;
- else if (GET_CODE (x) == REG)
- {
- /* Must be a hard reg that's not valid in MODE. */
- result = gen_lowpart_common (mode, copy_to_reg (x));
- if (result == 0)
- abort ();
- return result;
- }
- else if (GET_CODE (x) == MEM)
- {
- /* The only additional case we can do is MEM. */
- register int offset = 0;
- if (WORDS_BIG_ENDIAN)
- offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
-
- if (BYTES_BIG_ENDIAN)
- /* Adjust the address so that the address-after-the-data
- is unchanged. */
- offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
-
- return change_address (x, mode, plus_constant (XEXP (x, 0), offset));
- }
- else
- abort ();
-}
-
-/* Like `gen_lowpart', but refer to the most significant part.
- This is used to access the imaginary part of a complex number. */
-
-rtx
-gen_highpart (mode, x)
- enum machine_mode mode;
- register rtx x;
-{
- /* This case loses if X is a subreg. To catch bugs early,
- complain if an invalid MODE is used even in other cases. */
- if (GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && GET_MODE_SIZE (mode) != GET_MODE_UNIT_SIZE (GET_MODE (x)))
- abort ();
- if (GET_CODE (x) == CONST_DOUBLE
-#if !(TARGET_FLOAT_FORMAT != HOST_FLOAT_FORMAT || defined (REAL_IS_NOT_DOUBLE))
- && GET_MODE_CLASS (GET_MODE (x)) != MODE_FLOAT
-#endif
- )
- return gen_rtx (CONST_INT, VOIDmode,
- CONST_DOUBLE_HIGH (x) & GET_MODE_MASK (mode));
- else if (GET_CODE (x) == CONST_INT)
- return const0_rtx;
- else if (GET_CODE (x) == MEM)
- {
- register int offset = 0;
- if (! WORDS_BIG_ENDIAN)
- offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
-
- if (! BYTES_BIG_ENDIAN
- && GET_MODE_SIZE (mode) < UNITS_PER_WORD)
- offset -= (GET_MODE_SIZE (mode)
- - MIN (UNITS_PER_WORD,
- GET_MODE_SIZE (GET_MODE (x))));
-
- return change_address (x, mode, plus_constant (XEXP (x, 0), offset));
- }
- else if (GET_CODE (x) == SUBREG)
- {
- /* The only time this should occur is when we are looking at a
- multi-word item with a SUBREG whose mode is the same as that of the
- item. It isn't clear what we would do if it wasn't. */
- if (SUBREG_WORD (x) != 0)
- abort ();
- return gen_highpart (mode, SUBREG_REG (x));
- }
- else if (GET_CODE (x) == REG)
- {
- int word = 0;
-
- if (! WORDS_BIG_ENDIAN
- && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
- word = ((GET_MODE_SIZE (GET_MODE (x))
- - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD))
- / UNITS_PER_WORD);
-
- /*
- * ??? This fails miserably for complex values being passed in registers
- * where the sizeof the real and imaginary part are not equal to the
- * sizeof SImode. FIXME
- */
-
- if (REGNO (x) < FIRST_PSEUDO_REGISTER
- /* integrate.c can't handle parts of a return value register. */
- && (! REG_FUNCTION_VALUE_P (x)
- || ! rtx_equal_function_value_matters)
- /* We want to keep the stack, frame, and arg pointers special. */
- && x != frame_pointer_rtx
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- && x != arg_pointer_rtx
-#endif
- && x != stack_pointer_rtx)
- return gen_rtx (REG, mode, REGNO (x) + word);
- else
- return gen_rtx (SUBREG, mode, x, word);
- }
- else
- abort ();
-}
-
-/* Return 1 iff X, assumed to be a SUBREG,
- refers to the least significant part of its containing reg.
- If X is not a SUBREG, always return 1 (it is its own low part!). */
-
-int
-subreg_lowpart_p (x)
- rtx x;
-{
- if (GET_CODE (x) != SUBREG)
- return 1;
- else if (GET_MODE (SUBREG_REG (x)) == VOIDmode)
- return 0;
-
- if (WORDS_BIG_ENDIAN
- && GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) > UNITS_PER_WORD)
- return (SUBREG_WORD (x)
- == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))
- - MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD))
- / UNITS_PER_WORD));
-
- return SUBREG_WORD (x) == 0;
-}
-
-/* Return subword I of operand OP.
- The word number, I, is interpreted as the word number starting at the
- low-order address. Word 0 is the low-order word if not WORDS_BIG_ENDIAN,
- otherwise it is the high-order word.
-
- If we cannot extract the required word, we return zero. Otherwise, an
- rtx corresponding to the requested word will be returned.
-
- VALIDATE_ADDRESS is nonzero if the address should be validated. Before
- reload has completed, a valid address will always be returned. After
- reload, if a valid address cannot be returned, we return zero.
-
- If VALIDATE_ADDRESS is zero, we simply form the required address; validating
- it is the responsibility of the caller.
-
- MODE is the mode of OP in case it is a CONST_INT. */
-
-rtx
-operand_subword (op, i, validate_address, mode)
- rtx op;
- int i;
- int validate_address;
- enum machine_mode mode;
-{
- HOST_WIDE_INT val;
- int size_ratio = HOST_BITS_PER_WIDE_INT / BITS_PER_WORD;
-
- if (mode == VOIDmode)
- mode = GET_MODE (op);
-
- if (mode == VOIDmode)
- abort ();
-
- /* If OP is narrower than a word or if we want a word outside OP, fail. */
- if (mode != BLKmode
- && (GET_MODE_SIZE (mode) < UNITS_PER_WORD
- || (i + 1) * UNITS_PER_WORD > GET_MODE_SIZE (mode)))
- return 0;
-
- /* If OP is already an integer word, return it. */
- if (GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_SIZE (mode) == UNITS_PER_WORD)
- return op;
-
- /* If OP is a REG or SUBREG, we can handle it very simply. */
- if (GET_CODE (op) == REG)
- {
- /* If the register is not valid for MODE, return 0. If we don't
- do this, there is no way to fix up the resulting REG later. */
- if (REGNO (op) < FIRST_PSEUDO_REGISTER
- && ! HARD_REGNO_MODE_OK (REGNO (op) + i, word_mode))
- return 0;
- else if (REGNO (op) >= FIRST_PSEUDO_REGISTER
- || (REG_FUNCTION_VALUE_P (op)
- && rtx_equal_function_value_matters)
- /* We want to keep the stack, frame, and arg pointers
- special. */
- || op == frame_pointer_rtx
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || op == arg_pointer_rtx
-#endif
- || op == stack_pointer_rtx)
- return gen_rtx (SUBREG, word_mode, op, i);
- else
- return gen_rtx (REG, word_mode, REGNO (op) + i);
- }
- else if (GET_CODE (op) == SUBREG)
- return gen_rtx (SUBREG, word_mode, SUBREG_REG (op), i + SUBREG_WORD (op));
- else if (GET_CODE (op) == CONCAT)
- {
- int partwords = GET_MODE_UNIT_SIZE (GET_MODE (op)) / UNITS_PER_WORD;
- if (i < partwords)
- return operand_subword (XEXP (op, 0), i, validate_address, mode);
- return operand_subword (XEXP (op, 1), i - partwords,
- validate_address, mode);
- }
-
- /* Form a new MEM at the requested address. */
- if (GET_CODE (op) == MEM)
- {
- rtx addr = plus_constant (XEXP (op, 0), i * UNITS_PER_WORD);
- rtx new;
-
- if (validate_address)
- {
- if (reload_completed)
- {
- if (! strict_memory_address_p (word_mode, addr))
- return 0;
- }
- else
- addr = memory_address (word_mode, addr);
- }
-
- new = gen_rtx (MEM, word_mode, addr);
-
- MEM_VOLATILE_P (new) = MEM_VOLATILE_P (op);
- MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (op);
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (op);
-
- return new;
- }
-
- /* The only remaining cases are when OP is a constant. If the host and
- target floating formats are the same, handling two-word floating
- constants are easy. Note that REAL_VALUE_TO_TARGET_{SINGLE,DOUBLE}
- are defined as returning one or two 32 bit values, respectively,
- and not values of BITS_PER_WORD bits. */
-#ifdef REAL_ARITHMETIC
-/* The output is some bits, the width of the target machine's word.
- A wider-word host can surely hold them in a CONST_INT. A narrower-word
- host can't. */
- if (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD
- && GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_MODE_BITSIZE (mode) == 64
- && GET_CODE (op) == CONST_DOUBLE)
- {
- long k[2];
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
- REAL_VALUE_TO_TARGET_DOUBLE (rv, k);
-
- /* We handle 32-bit and >= 64-bit words here. Note that the order in
- which the words are written depends on the word endianness.
-
- ??? This is a potential portability problem and should
- be fixed at some point. */
- if (BITS_PER_WORD == 32)
- return GEN_INT ((HOST_WIDE_INT) k[i]);
-#if HOST_BITS_PER_WIDE_INT > 32
- else if (BITS_PER_WORD >= 64 && i == 0)
- return GEN_INT ((((HOST_WIDE_INT) k[! WORDS_BIG_ENDIAN]) << 32)
- | (HOST_WIDE_INT) k[WORDS_BIG_ENDIAN]);
-#endif
- else if (BITS_PER_WORD == 16)
- {
- long value;
- value = k[i >> 1];
- if ((i & 0x1) == 0)
- value >>= 16;
- value &= 0xffff;
- return GEN_INT ((HOST_WIDE_INT) value);
- }
- else
- abort ();
- }
- else if (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD
- && GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_MODE_BITSIZE (mode) > 64
- && GET_CODE (op) == CONST_DOUBLE)
- {
- long k[4];
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, k);
-
- if (BITS_PER_WORD == 32)
- return GEN_INT ((HOST_WIDE_INT) k[i]);
- }
-#else /* no REAL_ARITHMETIC */
- if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
- || flag_pretend_float)
- && GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && GET_CODE (op) == CONST_DOUBLE)
- {
- /* The constant is stored in the host's word-ordering,
- but we want to access it in the target's word-ordering. Some
- compilers don't like a conditional inside macro args, so we have two
- copies of the return. */
-#ifdef HOST_WORDS_BIG_ENDIAN
- return GEN_INT (i == WORDS_BIG_ENDIAN
- ? CONST_DOUBLE_HIGH (op) : CONST_DOUBLE_LOW (op));
-#else
- return GEN_INT (i != WORDS_BIG_ENDIAN
- ? CONST_DOUBLE_HIGH (op) : CONST_DOUBLE_LOW (op));
-#endif
- }
-#endif /* no REAL_ARITHMETIC */
-
- /* Single word float is a little harder, since single- and double-word
- values often do not have the same high-order bits. We have already
- verified that we want the only defined word of the single-word value. */
-#ifdef REAL_ARITHMETIC
- if (GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_MODE_BITSIZE (mode) == 32
- && GET_CODE (op) == CONST_DOUBLE)
- {
- long l;
- REAL_VALUE_TYPE rv;
-
- REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
- REAL_VALUE_TO_TARGET_SINGLE (rv, l);
- return GEN_INT ((HOST_WIDE_INT) l);
- }
-#else
- if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
- || flag_pretend_float)
- && sizeof (float) * 8 == HOST_BITS_PER_WIDE_INT
- && GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_MODE_SIZE (mode) == UNITS_PER_WORD
- && GET_CODE (op) == CONST_DOUBLE)
- {
- double d;
- union {float f; HOST_WIDE_INT i; } u;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, op);
-
- u.f = d;
- return GEN_INT (u.i);
- }
- if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
- || flag_pretend_float)
- && sizeof (double) * 8 == HOST_BITS_PER_WIDE_INT
- && GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_MODE_SIZE (mode) == UNITS_PER_WORD
- && GET_CODE (op) == CONST_DOUBLE)
- {
- double d;
- union {double d; HOST_WIDE_INT i; } u;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, op);
-
- u.d = d;
- return GEN_INT (u.i);
- }
-#endif /* no REAL_ARITHMETIC */
-
- /* The only remaining cases that we can handle are integers.
- Convert to proper endianness now since these cases need it.
- At this point, i == 0 means the low-order word.
-
- We do not want to handle the case when BITS_PER_WORD <= HOST_BITS_PER_INT
- in general. However, if OP is (const_int 0), we can just return
- it for any word. */
-
- if (op == const0_rtx)
- return op;
-
- if (GET_MODE_CLASS (mode) != MODE_INT
- || (GET_CODE (op) != CONST_INT && GET_CODE (op) != CONST_DOUBLE)
- || BITS_PER_WORD > HOST_BITS_PER_WIDE_INT)
- return 0;
-
- if (WORDS_BIG_ENDIAN)
- i = GET_MODE_SIZE (mode) / UNITS_PER_WORD - 1 - i;
-
- /* Find out which word on the host machine this value is in and get
- it from the constant. */
- val = (i / size_ratio == 0
- ? (GET_CODE (op) == CONST_INT ? INTVAL (op) : CONST_DOUBLE_LOW (op))
- : (GET_CODE (op) == CONST_INT
- ? (INTVAL (op) < 0 ? ~0 : 0) : CONST_DOUBLE_HIGH (op)));
-
- /* If BITS_PER_WORD is smaller than an int, get the appropriate bits. */
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT)
- val = ((val >> ((i % size_ratio) * BITS_PER_WORD))
- & (((HOST_WIDE_INT) 1
- << (BITS_PER_WORD % HOST_BITS_PER_WIDE_INT)) - 1));
-
- return GEN_INT (val);
-}
-
-/* Similar to `operand_subword', but never return 0. If we can't extract
- the required subword, put OP into a register and try again. If that fails,
- abort. We always validate the address in this case. It is not valid
- to call this function after reload; it is mostly meant for RTL
- generation.
-
- MODE is the mode of OP, in case it is CONST_INT. */
-
-rtx
-operand_subword_force (op, i, mode)
- rtx op;
- int i;
- enum machine_mode mode;
-{
- rtx result = operand_subword (op, i, 1, mode);
-
- if (result)
- return result;
-
- if (mode != BLKmode && mode != VOIDmode)
- op = force_reg (mode, op);
-
- result = operand_subword (op, i, 1, mode);
- if (result == 0)
- abort ();
-
- return result;
-}
-
-/* Given a compare instruction, swap the operands.
- A test instruction is changed into a compare of 0 against the operand. */
-
-void
-reverse_comparison (insn)
- rtx insn;
-{
- rtx body = PATTERN (insn);
- rtx comp;
-
- if (GET_CODE (body) == SET)
- comp = SET_SRC (body);
- else
- comp = SET_SRC (XVECEXP (body, 0, 0));
-
- if (GET_CODE (comp) == COMPARE)
- {
- rtx op0 = XEXP (comp, 0);
- rtx op1 = XEXP (comp, 1);
- XEXP (comp, 0) = op1;
- XEXP (comp, 1) = op0;
- }
- else
- {
- rtx new = gen_rtx (COMPARE, VOIDmode,
- CONST0_RTX (GET_MODE (comp)), comp);
- if (GET_CODE (body) == SET)
- SET_SRC (body) = new;
- else
- SET_SRC (XVECEXP (body, 0, 0)) = new;
- }
-}
-
-/* Return a memory reference like MEMREF, but with its mode changed
- to MODE and its address changed to ADDR.
- (VOIDmode means don't change the mode.
- NULL for ADDR means don't change the address.) */
-
-rtx
-change_address (memref, mode, addr)
- rtx memref;
- enum machine_mode mode;
- rtx addr;
-{
- rtx new;
-
- if (GET_CODE (memref) != MEM)
- abort ();
- if (mode == VOIDmode)
- mode = GET_MODE (memref);
- if (addr == 0)
- addr = XEXP (memref, 0);
-
- /* If reload is in progress or has completed, ADDR must be valid.
- Otherwise, we can call memory_address to make it valid. */
- if (reload_completed || reload_in_progress)
- {
- if (! memory_address_p (mode, addr))
- abort ();
- }
- else
- addr = memory_address (mode, addr);
-
- if (rtx_equal_p (addr, XEXP (memref, 0)) && mode == GET_MODE (memref))
- return memref;
-
- new = gen_rtx (MEM, mode, addr);
- MEM_VOLATILE_P (new) = MEM_VOLATILE_P (memref);
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (memref);
- MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (memref);
- return new;
-}
-
-/* Return a newly created CODE_LABEL rtx with a unique label number. */
-
-rtx
-gen_label_rtx ()
-{
- register rtx label;
-
- label = (output_bytecode
- ? gen_rtx (CODE_LABEL, VOIDmode, NULL, bc_get_bytecode_label ())
- : gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0, label_num++, NULL_PTR));
-
- LABEL_NUSES (label) = 0;
- return label;
-}
-
-/* For procedure integration. */
-
-/* Return a newly created INLINE_HEADER rtx. Should allocate this
- from a permanent obstack when the opportunity arises. */
-
-rtx
-gen_inline_header_rtx (first_insn, first_parm_insn, first_labelno,
- last_labelno, max_parm_regnum, max_regnum, args_size,
- pops_args, stack_slots, forced_labels, function_flags,
- outgoing_args_size, original_arg_vector,
- original_decl_initial, regno_rtx, regno_flag,
- regno_align)
- rtx first_insn, first_parm_insn;
- int first_labelno, last_labelno, max_parm_regnum, max_regnum, args_size;
- int pops_args;
- rtx stack_slots;
- rtx forced_labels;
- int function_flags;
- int outgoing_args_size;
- rtvec original_arg_vector;
- rtx original_decl_initial;
- rtvec regno_rtx;
- char *regno_flag;
- char *regno_align;
-{
- rtx header = gen_rtx (INLINE_HEADER, VOIDmode,
- cur_insn_uid++, NULL_RTX,
- first_insn, first_parm_insn,
- first_labelno, last_labelno,
- max_parm_regnum, max_regnum, args_size, pops_args,
- stack_slots, forced_labels, function_flags,
- outgoing_args_size, original_arg_vector,
- original_decl_initial,
- regno_rtx, regno_flag, regno_align);
- return header;
-}
-
-/* Install new pointers to the first and last insns in the chain.
- Also, set cur_insn_uid to one higher than the last in use.
- Used for an inline-procedure after copying the insn chain. */
-
-void
-set_new_first_and_last_insn (first, last)
- rtx first, last;
-{
- rtx insn;
-
- first_insn = first;
- last_insn = last;
- cur_insn_uid = 0;
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- cur_insn_uid = MAX (cur_insn_uid, INSN_UID (insn));
-
- cur_insn_uid++;
-}
-
-/* Set the range of label numbers found in the current function.
- This is used when belatedly compiling an inline function. */
-
-void
-set_new_first_and_last_label_num (first, last)
- int first, last;
-{
- base_label_num = label_num;
- first_label_num = first;
- last_label_num = last;
-}
-
-/* Save all variables describing the current status into the structure *P.
- This is used before starting a nested function. */
-
-void
-save_emit_status (p)
- struct function *p;
-{
- p->reg_rtx_no = reg_rtx_no;
- p->first_label_num = first_label_num;
- p->first_insn = first_insn;
- p->last_insn = last_insn;
- p->sequence_rtl_expr = sequence_rtl_expr;
- p->sequence_stack = sequence_stack;
- p->cur_insn_uid = cur_insn_uid;
- p->last_linenum = last_linenum;
- p->last_filename = last_filename;
- p->regno_pointer_flag = regno_pointer_flag;
- p->regno_pointer_align = regno_pointer_align;
- p->regno_pointer_flag_length = regno_pointer_flag_length;
- p->regno_reg_rtx = regno_reg_rtx;
-}
-
-/* Restore all variables describing the current status from the structure *P.
- This is used after a nested function. */
-
-void
-restore_emit_status (p)
- struct function *p;
-{
- int i;
-
- reg_rtx_no = p->reg_rtx_no;
- first_label_num = p->first_label_num;
- last_label_num = 0;
- first_insn = p->first_insn;
- last_insn = p->last_insn;
- sequence_rtl_expr = p->sequence_rtl_expr;
- sequence_stack = p->sequence_stack;
- cur_insn_uid = p->cur_insn_uid;
- last_linenum = p->last_linenum;
- last_filename = p->last_filename;
- regno_pointer_flag = p->regno_pointer_flag;
- regno_pointer_align = p->regno_pointer_align;
- regno_pointer_flag_length = p->regno_pointer_flag_length;
- regno_reg_rtx = p->regno_reg_rtx;
-
- /* Clear our cache of rtx expressions for start_sequence and
- gen_sequence. */
- sequence_element_free_list = 0;
- for (i = 0; i < SEQUENCE_RESULT_SIZE; i++)
- sequence_result[i] = 0;
-
- free_insn = 0;
-}
-
-/* Go through all the RTL insn bodies and copy any invalid shared structure.
- It does not work to do this twice, because the mark bits set here
- are not cleared afterwards. */
-
-void
-unshare_all_rtl (insn)
- register rtx insn;
-{
- for (; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- PATTERN (insn) = copy_rtx_if_shared (PATTERN (insn));
- REG_NOTES (insn) = copy_rtx_if_shared (REG_NOTES (insn));
- LOG_LINKS (insn) = copy_rtx_if_shared (LOG_LINKS (insn));
- }
-
- /* Make sure the addresses of stack slots found outside the insn chain
- (such as, in DECL_RTL of a variable) are not shared
- with the insn chain.
-
- This special care is necessary when the stack slot MEM does not
- actually appear in the insn chain. If it does appear, its address
- is unshared from all else at that point. */
-
- copy_rtx_if_shared (stack_slot_list);
-}
-
-/* Mark ORIG as in use, and return a copy of it if it was already in use.
- Recursively does the same for subexpressions. */
-
-rtx
-copy_rtx_if_shared (orig)
- rtx orig;
-{
- register rtx x = orig;
- register int i;
- register enum rtx_code code;
- register char *format_ptr;
- int copied = 0;
-
- if (x == 0)
- return 0;
-
- code = GET_CODE (x);
-
- /* These types may be freely shared. */
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case SCRATCH:
- /* SCRATCH must be shared because they represent distinct values. */
- return x;
-
- case CONST:
- /* CONST can be shared if it contains a SYMBOL_REF. If it contains
- a LABEL_REF, it isn't sharable. */
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)
- return x;
- break;
-
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case NOTE:
- case BARRIER:
- /* The chain of insns is not being copied. */
- return x;
-
- case MEM:
- /* A MEM is allowed to be shared if its address is constant
- or is a constant plus one of the special registers. */
- if (CONSTANT_ADDRESS_P (XEXP (x, 0))
- || XEXP (x, 0) == virtual_stack_vars_rtx
- || XEXP (x, 0) == virtual_incoming_args_rtx)
- return x;
-
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && (XEXP (XEXP (x, 0), 0) == virtual_stack_vars_rtx
- || XEXP (XEXP (x, 0), 0) == virtual_incoming_args_rtx)
- && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
- {
- /* This MEM can appear in more than one place,
- but its address better not be shared with anything else. */
- if (! x->used)
- XEXP (x, 0) = copy_rtx_if_shared (XEXP (x, 0));
- x->used = 1;
- return x;
- }
- }
-
- /* This rtx may not be shared. If it has already been seen,
- replace it with a copy of itself. */
-
- if (x->used)
- {
- register rtx copy;
-
- copy = rtx_alloc (code);
- bcopy ((char *) x, (char *) copy,
- (sizeof (*copy) - sizeof (copy->fld)
- + sizeof (copy->fld[0]) * GET_RTX_LENGTH (code)));
- x = copy;
- copied = 1;
- }
- x->used = 1;
-
- /* Now scan the subexpressions recursively.
- We can store any replaced subexpressions directly into X
- since we know X is not shared! Any vectors in X
- must be copied if X was copied. */
-
- format_ptr = GET_RTX_FORMAT (code);
-
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- XEXP (x, i) = copy_rtx_if_shared (XEXP (x, i));
- break;
-
- case 'E':
- if (XVEC (x, i) != NULL)
- {
- register int j;
- int len = XVECLEN (x, i);
-
- if (copied && len > 0)
- XVEC (x, i) = gen_rtvec_vv (len, XVEC (x, i)->elem);
- for (j = 0; j < len; j++)
- XVECEXP (x, i, j) = copy_rtx_if_shared (XVECEXP (x, i, j));
- }
- break;
- }
- }
- return x;
-}
-
-/* Clear all the USED bits in X to allow copy_rtx_if_shared to be used
- to look for shared sub-parts. */
-
-void
-reset_used_flags (x)
- rtx x;
-{
- register int i, j;
- register enum rtx_code code;
- register char *format_ptr;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- /* These types may be freely shared so we needn't do any resetting
- for them. */
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- return;
-
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case NOTE:
- case LABEL_REF:
- case BARRIER:
- /* The chain of insns is not being copied. */
- return;
- }
-
- x->used = 0;
-
- format_ptr = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- reset_used_flags (XEXP (x, i));
- break;
-
- case 'E':
- for (j = 0; j < XVECLEN (x, i); j++)
- reset_used_flags (XVECEXP (x, i, j));
- break;
- }
- }
-}
-
-/* Copy X if necessary so that it won't be altered by changes in OTHER.
- Return X or the rtx for the pseudo reg the value of X was copied into.
- OTHER must be valid as a SET_DEST. */
-
-rtx
-make_safe_from (x, other)
- rtx x, other;
-{
- while (1)
- switch (GET_CODE (other))
- {
- case SUBREG:
- other = SUBREG_REG (other);
- break;
- case STRICT_LOW_PART:
- case SIGN_EXTEND:
- case ZERO_EXTEND:
- other = XEXP (other, 0);
- break;
- default:
- goto done;
- }
- done:
- if ((GET_CODE (other) == MEM
- && ! CONSTANT_P (x)
- && GET_CODE (x) != REG
- && GET_CODE (x) != SUBREG)
- || (GET_CODE (other) == REG
- && (REGNO (other) < FIRST_PSEUDO_REGISTER
- || reg_mentioned_p (other, x))))
- {
- rtx temp = gen_reg_rtx (GET_MODE (x));
- emit_move_insn (temp, x);
- return temp;
- }
- return x;
-}
-
-/* Emission of insns (adding them to the doubly-linked list). */
-
-/* Return the first insn of the current sequence or current function. */
-
-rtx
-get_insns ()
-{
- return first_insn;
-}
-
-/* Return the last insn emitted in current sequence or current function. */
-
-rtx
-get_last_insn ()
-{
- return last_insn;
-}
-
-/* Specify a new insn as the last in the chain. */
-
-void
-set_last_insn (insn)
- rtx insn;
-{
- if (NEXT_INSN (insn) != 0)
- abort ();
- last_insn = insn;
-}
-
-/* Return the last insn emitted, even if it is in a sequence now pushed. */
-
-rtx
-get_last_insn_anywhere ()
-{
- struct sequence_stack *stack;
- if (last_insn)
- return last_insn;
- for (stack = sequence_stack; stack; stack = stack->next)
- if (stack->last != 0)
- return stack->last;
- return 0;
-}
-
-/* Return a number larger than any instruction's uid in this function. */
-
-int
-get_max_uid ()
-{
- return cur_insn_uid;
-}
-
-/* Return the next insn. If it is a SEQUENCE, return the first insn
- of the sequence. */
-
-rtx
-next_insn (insn)
- rtx insn;
-{
- if (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn && GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, 0);
- }
-
- return insn;
-}
-
-/* Return the previous insn. If it is a SEQUENCE, return the last insn
- of the sequence. */
-
-rtx
-previous_insn (insn)
- rtx insn;
-{
- if (insn)
- {
- insn = PREV_INSN (insn);
- if (insn && GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1);
- }
-
- return insn;
-}
-
-/* Return the next insn after INSN that is not a NOTE. This routine does not
- look inside SEQUENCEs. */
-
-rtx
-next_nonnote_insn (insn)
- rtx insn;
-{
- while (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn == 0 || GET_CODE (insn) != NOTE)
- break;
- }
-
- return insn;
-}
-
-/* Return the previous insn before INSN that is not a NOTE. This routine does
- not look inside SEQUENCEs. */
-
-rtx
-prev_nonnote_insn (insn)
- rtx insn;
-{
- while (insn)
- {
- insn = PREV_INSN (insn);
- if (insn == 0 || GET_CODE (insn) != NOTE)
- break;
- }
-
- return insn;
-}
-
-/* Return the next INSN, CALL_INSN or JUMP_INSN after INSN;
- or 0, if there is none. This routine does not look inside
- SEQUENCEs. */
-
-rtx
-next_real_insn (insn)
- rtx insn;
-{
- while (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn == 0 || GET_CODE (insn) == INSN
- || GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN)
- break;
- }
-
- return insn;
-}
-
-/* Return the last INSN, CALL_INSN or JUMP_INSN before INSN;
- or 0, if there is none. This routine does not look inside
- SEQUENCEs. */
-
-rtx
-prev_real_insn (insn)
- rtx insn;
-{
- while (insn)
- {
- insn = PREV_INSN (insn);
- if (insn == 0 || GET_CODE (insn) == INSN || GET_CODE (insn) == CALL_INSN
- || GET_CODE (insn) == JUMP_INSN)
- break;
- }
-
- return insn;
-}
-
-/* Find the next insn after INSN that really does something. This routine
- does not look inside SEQUENCEs. Until reload has completed, this is the
- same as next_real_insn. */
-
-rtx
-next_active_insn (insn)
- rtx insn;
-{
- while (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn == 0
- || GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN
- || (GET_CODE (insn) == INSN
- && (! reload_completed
- || (GET_CODE (PATTERN (insn)) != USE
- && GET_CODE (PATTERN (insn)) != CLOBBER))))
- break;
- }
-
- return insn;
-}
-
-/* Find the last insn before INSN that really does something. This routine
- does not look inside SEQUENCEs. Until reload has completed, this is the
- same as prev_real_insn. */
-
-rtx
-prev_active_insn (insn)
- rtx insn;
-{
- while (insn)
- {
- insn = PREV_INSN (insn);
- if (insn == 0
- || GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN
- || (GET_CODE (insn) == INSN
- && (! reload_completed
- || (GET_CODE (PATTERN (insn)) != USE
- && GET_CODE (PATTERN (insn)) != CLOBBER))))
- break;
- }
-
- return insn;
-}
-
-/* Return the next CODE_LABEL after the insn INSN, or 0 if there is none. */
-
-rtx
-next_label (insn)
- rtx insn;
-{
- while (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn == 0 || GET_CODE (insn) == CODE_LABEL)
- break;
- }
-
- return insn;
-}
-
-/* Return the last CODE_LABEL before the insn INSN, or 0 if there is none. */
-
-rtx
-prev_label (insn)
- rtx insn;
-{
- while (insn)
- {
- insn = PREV_INSN (insn);
- if (insn == 0 || GET_CODE (insn) == CODE_LABEL)
- break;
- }
-
- return insn;
-}
-
-#ifdef HAVE_cc0
-/* INSN uses CC0 and is being moved into a delay slot. Set up REG_CC_SETTER
- and REG_CC_USER notes so we can find it. */
-
-void
-link_cc0_insns (insn)
- rtx insn;
-{
- rtx user = next_nonnote_insn (insn);
-
- if (GET_CODE (user) == INSN && GET_CODE (PATTERN (user)) == SEQUENCE)
- user = XVECEXP (PATTERN (user), 0, 0);
-
- REG_NOTES (user) = gen_rtx (INSN_LIST, REG_CC_SETTER, insn,
- REG_NOTES (user));
- REG_NOTES (insn) = gen_rtx (INSN_LIST, REG_CC_USER, user, REG_NOTES (insn));
-}
-
-/* Return the next insn that uses CC0 after INSN, which is assumed to
- set it. This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter
- applied to the result of this function should yield INSN).
-
- Normally, this is simply the next insn. However, if a REG_CC_USER note
- is present, it contains the insn that uses CC0.
-
- Return 0 if we can't find the insn. */
-
-rtx
-next_cc0_user (insn)
- rtx insn;
-{
- rtx note = find_reg_note (insn, REG_CC_USER, NULL_RTX);
-
- if (note)
- return XEXP (note, 0);
-
- insn = next_nonnote_insn (insn);
- if (insn && GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, 0);
-
- if (insn && GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_mentioned_p (cc0_rtx, PATTERN (insn)))
- return insn;
-
- return 0;
-}
-
-/* Find the insn that set CC0 for INSN. Unless INSN has a REG_CC_SETTER
- note, it is the previous insn. */
-
-rtx
-prev_cc0_setter (insn)
- rtx insn;
-{
- rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
- rtx link;
-
- if (note)
- return XEXP (note, 0);
-
- insn = prev_nonnote_insn (insn);
- if (! sets_cc0_p (PATTERN (insn)))
- abort ();
-
- return insn;
-}
-#endif
-
-/* Try splitting insns that can be split for better scheduling.
- PAT is the pattern which might split.
- TRIAL is the insn providing PAT.
- LAST is non-zero if we should return the last insn of the sequence produced.
-
- If this routine succeeds in splitting, it returns the first or last
- replacement insn depending on the value of LAST. Otherwise, it
- returns TRIAL. If the insn to be returned can be split, it will be. */
-
-rtx
-try_split (pat, trial, last)
- rtx pat, trial;
- int last;
-{
- rtx before = PREV_INSN (trial);
- rtx after = NEXT_INSN (trial);
- rtx seq = split_insns (pat, trial);
- int has_barrier = 0;
- rtx tem;
-
- /* If we are splitting a JUMP_INSN, it might be followed by a BARRIER.
- We may need to handle this specially. */
- if (after && GET_CODE (after) == BARRIER)
- {
- has_barrier = 1;
- after = NEXT_INSN (after);
- }
-
- if (seq)
- {
- /* SEQ can either be a SEQUENCE or the pattern of a single insn.
- The latter case will normally arise only when being done so that
- it, in turn, will be split (SFmode on the 29k is an example). */
- if (GET_CODE (seq) == SEQUENCE)
- {
- /* If we are splitting a JUMP_INSN, look for the JUMP_INSN in
- SEQ and copy our JUMP_LABEL to it. If JUMP_LABEL is non-zero,
- increment the usage count so we don't delete the label. */
- int i;
-
- if (GET_CODE (trial) == JUMP_INSN)
- for (i = XVECLEN (seq, 0) - 1; i >= 0; i--)
- if (GET_CODE (XVECEXP (seq, 0, i)) == JUMP_INSN)
- {
- JUMP_LABEL (XVECEXP (seq, 0, i)) = JUMP_LABEL (trial);
-
- if (JUMP_LABEL (trial))
- LABEL_NUSES (JUMP_LABEL (trial))++;
- }
-
- tem = emit_insn_after (seq, before);
-
- delete_insn (trial);
- if (has_barrier)
- emit_barrier_after (tem);
-
- /* Recursively call try_split for each new insn created; by the
- time control returns here that insn will be fully split, so
- set LAST and continue from the insn after the one returned.
- We can't use next_active_insn here since AFTER may be a note.
- Ignore deleted insns, which can be occur if not optimizing. */
- for (tem = NEXT_INSN (before); tem != after;
- tem = NEXT_INSN (tem))
- if (! INSN_DELETED_P (tem))
- tem = try_split (PATTERN (tem), tem, 1);
- }
- /* Avoid infinite loop if the result matches the original pattern. */
- else if (rtx_equal_p (seq, pat))
- return trial;
- else
- {
- PATTERN (trial) = seq;
- INSN_CODE (trial) = -1;
- try_split (seq, trial, last);
- }
-
- /* Return either the first or the last insn, depending on which was
- requested. */
- return last ? prev_active_insn (after) : next_active_insn (before);
- }
-
- return trial;
-}
-
-/* Make and return an INSN rtx, initializing all its slots.
- Store PATTERN in the pattern slots. */
-
-rtx
-make_insn_raw (pattern)
- rtx pattern;
-{
- register rtx insn;
-
- /* If in RTL generation phase, see if FREE_INSN can be used. */
- if (free_insn != 0 && rtx_equal_function_value_matters)
- {
- insn = free_insn;
- free_insn = NEXT_INSN (free_insn);
- PUT_CODE (insn, INSN);
- }
- else
- insn = rtx_alloc (INSN);
-
- INSN_UID (insn) = cur_insn_uid++;
- PATTERN (insn) = pattern;
- INSN_CODE (insn) = -1;
- LOG_LINKS (insn) = NULL;
- REG_NOTES (insn) = NULL;
-
- return insn;
-}
-
-/* Like `make_insn' but make a JUMP_INSN instead of an insn. */
-
-static rtx
-make_jump_insn_raw (pattern)
- rtx pattern;
-{
- register rtx insn;
-
- insn = rtx_alloc (JUMP_INSN);
- INSN_UID (insn) = cur_insn_uid++;
-
- PATTERN (insn) = pattern;
- INSN_CODE (insn) = -1;
- LOG_LINKS (insn) = NULL;
- REG_NOTES (insn) = NULL;
- JUMP_LABEL (insn) = NULL;
-
- return insn;
-}
-
-/* Like `make_insn' but make a CALL_INSN instead of an insn. */
-
-static rtx
-make_call_insn_raw (pattern)
- rtx pattern;
-{
- register rtx insn;
-
- insn = rtx_alloc (CALL_INSN);
- INSN_UID (insn) = cur_insn_uid++;
-
- PATTERN (insn) = pattern;
- INSN_CODE (insn) = -1;
- LOG_LINKS (insn) = NULL;
- REG_NOTES (insn) = NULL;
- CALL_INSN_FUNCTION_USAGE (insn) = NULL;
-
- return insn;
-}
-
-/* Add INSN to the end of the doubly-linked list.
- INSN may be an INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, BARRIER or NOTE. */
-
-void
-add_insn (insn)
- register rtx insn;
-{
- PREV_INSN (insn) = last_insn;
- NEXT_INSN (insn) = 0;
-
- if (NULL != last_insn)
- NEXT_INSN (last_insn) = insn;
-
- if (NULL == first_insn)
- first_insn = insn;
-
- last_insn = insn;
-}
-
-/* Add INSN into the doubly-linked list after insn AFTER. This and
- the next should be the only functions called to insert an insn once
- delay slots have been filled since only they know how to update a
- SEQUENCE. */
-
-void
-add_insn_after (insn, after)
- rtx insn, after;
-{
- rtx next = NEXT_INSN (after);
-
- if (optimize && INSN_DELETED_P (after))
- abort ();
-
- NEXT_INSN (insn) = next;
- PREV_INSN (insn) = after;
-
- if (next)
- {
- PREV_INSN (next) = insn;
- if (GET_CODE (next) == INSN && GET_CODE (PATTERN (next)) == SEQUENCE)
- PREV_INSN (XVECEXP (PATTERN (next), 0, 0)) = insn;
- }
- else if (last_insn == after)
- last_insn = insn;
- else
- {
- struct sequence_stack *stack = sequence_stack;
- /* Scan all pending sequences too. */
- for (; stack; stack = stack->next)
- if (after == stack->last)
- {
- stack->last = insn;
- break;
- }
-
- if (stack == 0)
- abort ();
- }
-
- NEXT_INSN (after) = insn;
- if (GET_CODE (after) == INSN && GET_CODE (PATTERN (after)) == SEQUENCE)
- {
- rtx sequence = PATTERN (after);
- NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = insn;
- }
-}
-
-/* Add INSN into the doubly-linked list before insn BEFORE. This and
- the previous should be the only functions called to insert an insn once
- delay slots have been filled since only they know how to update a
- SEQUENCE. */
-
-void
-add_insn_before (insn, before)
- rtx insn, before;
-{
- rtx prev = PREV_INSN (before);
-
- if (optimize && INSN_DELETED_P (before))
- abort ();
-
- PREV_INSN (insn) = prev;
- NEXT_INSN (insn) = before;
-
- if (prev)
- {
- NEXT_INSN (prev) = insn;
- if (GET_CODE (prev) == INSN && GET_CODE (PATTERN (prev)) == SEQUENCE)
- {
- rtx sequence = PATTERN (prev);
- NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = insn;
- }
- }
- else if (first_insn == before)
- first_insn = insn;
- else
- {
- struct sequence_stack *stack = sequence_stack;
- /* Scan all pending sequences too. */
- for (; stack; stack = stack->next)
- if (before == stack->first)
- {
- stack->first = insn;
- break;
- }
-
- if (stack == 0)
- abort ();
- }
-
- PREV_INSN (before) = insn;
- if (GET_CODE (before) == INSN && GET_CODE (PATTERN (before)) == SEQUENCE)
- PREV_INSN (XVECEXP (PATTERN (before), 0, 0)) = insn;
-}
-
-/* Delete all insns made since FROM.
- FROM becomes the new last instruction. */
-
-void
-delete_insns_since (from)
- rtx from;
-{
- if (from == 0)
- first_insn = 0;
- else
- NEXT_INSN (from) = 0;
- last_insn = from;
-}
-
-/* This function is deprecated, please use sequences instead.
-
- Move a consecutive bunch of insns to a different place in the chain.
- The insns to be moved are those between FROM and TO.
- They are moved to a new position after the insn AFTER.
- AFTER must not be FROM or TO or any insn in between.
-
- This function does not know about SEQUENCEs and hence should not be
- called after delay-slot filling has been done. */
-
-void
-reorder_insns (from, to, after)
- rtx from, to, after;
-{
- /* Splice this bunch out of where it is now. */
- if (PREV_INSN (from))
- NEXT_INSN (PREV_INSN (from)) = NEXT_INSN (to);
- if (NEXT_INSN (to))
- PREV_INSN (NEXT_INSN (to)) = PREV_INSN (from);
- if (last_insn == to)
- last_insn = PREV_INSN (from);
- if (first_insn == from)
- first_insn = NEXT_INSN (to);
-
- /* Make the new neighbors point to it and it to them. */
- if (NEXT_INSN (after))
- PREV_INSN (NEXT_INSN (after)) = to;
-
- NEXT_INSN (to) = NEXT_INSN (after);
- PREV_INSN (from) = after;
- NEXT_INSN (after) = from;
- if (after == last_insn)
- last_insn = to;
-}
-
-/* Return the line note insn preceding INSN. */
-
-static rtx
-find_line_note (insn)
- rtx insn;
-{
- if (no_line_numbers)
- return 0;
-
- for (; insn; insn = PREV_INSN (insn))
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) >= 0)
- break;
-
- return insn;
-}
-
-/* Like reorder_insns, but inserts line notes to preserve the line numbers
- of the moved insns when debugging. This may insert a note between AFTER
- and FROM, and another one after TO. */
-
-void
-reorder_insns_with_line_notes (from, to, after)
- rtx from, to, after;
-{
- rtx from_line = find_line_note (from);
- rtx after_line = find_line_note (after);
-
- reorder_insns (from, to, after);
-
- if (from_line == after_line)
- return;
-
- if (from_line)
- emit_line_note_after (NOTE_SOURCE_FILE (from_line),
- NOTE_LINE_NUMBER (from_line),
- after);
- if (after_line)
- emit_line_note_after (NOTE_SOURCE_FILE (after_line),
- NOTE_LINE_NUMBER (after_line),
- to);
-}
-
-/* Emit an insn of given code and pattern
- at a specified place within the doubly-linked list. */
-
-/* Make an instruction with body PATTERN
- and output it before the instruction BEFORE. */
-
-rtx
-emit_insn_before (pattern, before)
- register rtx pattern, before;
-{
- register rtx insn = before;
-
- if (GET_CODE (pattern) == SEQUENCE)
- {
- register int i;
-
- for (i = 0; i < XVECLEN (pattern, 0); i++)
- {
- insn = XVECEXP (pattern, 0, i);
- add_insn_before (insn, before);
- }
- if (XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE)
- sequence_result[XVECLEN (pattern, 0)] = pattern;
- }
- else
- {
- insn = make_insn_raw (pattern);
- add_insn_before (insn, before);
- }
-
- return insn;
-}
-
-/* Make an instruction with body PATTERN and code JUMP_INSN
- and output it before the instruction BEFORE. */
-
-rtx
-emit_jump_insn_before (pattern, before)
- register rtx pattern, before;
-{
- register rtx insn;
-
- if (GET_CODE (pattern) == SEQUENCE)
- insn = emit_insn_before (pattern, before);
- else
- {
- insn = make_jump_insn_raw (pattern);
- add_insn_before (insn, before);
- }
-
- return insn;
-}
-
-/* Make an instruction with body PATTERN and code CALL_INSN
- and output it before the instruction BEFORE. */
-
-rtx
-emit_call_insn_before (pattern, before)
- register rtx pattern, before;
-{
- register rtx insn;
-
- if (GET_CODE (pattern) == SEQUENCE)
- insn = emit_insn_before (pattern, before);
- else
- {
- insn = make_call_insn_raw (pattern);
- add_insn_before (insn, before);
- PUT_CODE (insn, CALL_INSN);
- }
-
- return insn;
-}
-
-/* Make an insn of code BARRIER
- and output it before the insn AFTER. */
-
-rtx
-emit_barrier_before (before)
- register rtx before;
-{
- register rtx insn = rtx_alloc (BARRIER);
-
- INSN_UID (insn) = cur_insn_uid++;
-
- add_insn_before (insn, before);
- return insn;
-}
-
-/* Emit a note of subtype SUBTYPE before the insn BEFORE. */
-
-rtx
-emit_note_before (subtype, before)
- int subtype;
- rtx before;
-{
- register rtx note = rtx_alloc (NOTE);
- INSN_UID (note) = cur_insn_uid++;
- NOTE_SOURCE_FILE (note) = 0;
- NOTE_LINE_NUMBER (note) = subtype;
-
- add_insn_before (note, before);
- return note;
-}
-
-/* Make an insn of code INSN with body PATTERN
- and output it after the insn AFTER. */
-
-rtx
-emit_insn_after (pattern, after)
- register rtx pattern, after;
-{
- register rtx insn = after;
-
- if (GET_CODE (pattern) == SEQUENCE)
- {
- register int i;
-
- for (i = 0; i < XVECLEN (pattern, 0); i++)
- {
- insn = XVECEXP (pattern, 0, i);
- add_insn_after (insn, after);
- after = insn;
- }
- if (XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE)
- sequence_result[XVECLEN (pattern, 0)] = pattern;
- }
- else
- {
- insn = make_insn_raw (pattern);
- add_insn_after (insn, after);
- }
-
- return insn;
-}
-
-/* Similar to emit_insn_after, except that line notes are to be inserted so
- as to act as if this insn were at FROM. */
-
-void
-emit_insn_after_with_line_notes (pattern, after, from)
- rtx pattern, after, from;
-{
- rtx from_line = find_line_note (from);
- rtx after_line = find_line_note (after);
- rtx insn = emit_insn_after (pattern, after);
-
- if (from_line)
- emit_line_note_after (NOTE_SOURCE_FILE (from_line),
- NOTE_LINE_NUMBER (from_line),
- after);
-
- if (after_line)
- emit_line_note_after (NOTE_SOURCE_FILE (after_line),
- NOTE_LINE_NUMBER (after_line),
- insn);
-}
-
-/* Make an insn of code JUMP_INSN with body PATTERN
- and output it after the insn AFTER. */
-
-rtx
-emit_jump_insn_after (pattern, after)
- register rtx pattern, after;
-{
- register rtx insn;
-
- if (GET_CODE (pattern) == SEQUENCE)
- insn = emit_insn_after (pattern, after);
- else
- {
- insn = make_jump_insn_raw (pattern);
- add_insn_after (insn, after);
- }
-
- return insn;
-}
-
-/* Make an insn of code BARRIER
- and output it after the insn AFTER. */
-
-rtx
-emit_barrier_after (after)
- register rtx after;
-{
- register rtx insn = rtx_alloc (BARRIER);
-
- INSN_UID (insn) = cur_insn_uid++;
-
- add_insn_after (insn, after);
- return insn;
-}
-
-/* Emit the label LABEL after the insn AFTER. */
-
-rtx
-emit_label_after (label, after)
- rtx label, after;
-{
- /* This can be called twice for the same label
- as a result of the confusion that follows a syntax error!
- So make it harmless. */
- if (INSN_UID (label) == 0)
- {
- INSN_UID (label) = cur_insn_uid++;
- add_insn_after (label, after);
- }
-
- return label;
-}
-
-/* Emit a note of subtype SUBTYPE after the insn AFTER. */
-
-rtx
-emit_note_after (subtype, after)
- int subtype;
- rtx after;
-{
- register rtx note = rtx_alloc (NOTE);
- INSN_UID (note) = cur_insn_uid++;
- NOTE_SOURCE_FILE (note) = 0;
- NOTE_LINE_NUMBER (note) = subtype;
- add_insn_after (note, after);
- return note;
-}
-
-/* Emit a line note for FILE and LINE after the insn AFTER. */
-
-rtx
-emit_line_note_after (file, line, after)
- char *file;
- int line;
- rtx after;
-{
- register rtx note;
-
- if (no_line_numbers && line > 0)
- {
- cur_insn_uid++;
- return 0;
- }
-
- note = rtx_alloc (NOTE);
- INSN_UID (note) = cur_insn_uid++;
- NOTE_SOURCE_FILE (note) = file;
- NOTE_LINE_NUMBER (note) = line;
- add_insn_after (note, after);
- return note;
-}
-
-/* Make an insn of code INSN with pattern PATTERN
- and add it to the end of the doubly-linked list.
- If PATTERN is a SEQUENCE, take the elements of it
- and emit an insn for each element.
-
- Returns the last insn emitted. */
-
-rtx
-emit_insn (pattern)
- rtx pattern;
-{
- rtx insn = last_insn;
-
- if (GET_CODE (pattern) == SEQUENCE)
- {
- register int i;
-
- for (i = 0; i < XVECLEN (pattern, 0); i++)
- {
- insn = XVECEXP (pattern, 0, i);
- add_insn (insn);
- }
- if (XVECLEN (pattern, 0) < SEQUENCE_RESULT_SIZE)
- sequence_result[XVECLEN (pattern, 0)] = pattern;
- }
- else
- {
- insn = make_insn_raw (pattern);
- add_insn (insn);
- }
-
- return insn;
-}
-
-/* Emit the insns in a chain starting with INSN.
- Return the last insn emitted. */
-
-rtx
-emit_insns (insn)
- rtx insn;
-{
- rtx last = 0;
-
- while (insn)
- {
- rtx next = NEXT_INSN (insn);
- add_insn (insn);
- last = insn;
- insn = next;
- }
-
- return last;
-}
-
-/* Emit the insns in a chain starting with INSN and place them in front of
- the insn BEFORE. Return the last insn emitted. */
-
-rtx
-emit_insns_before (insn, before)
- rtx insn;
- rtx before;
-{
- rtx last = 0;
-
- while (insn)
- {
- rtx next = NEXT_INSN (insn);
- add_insn_before (insn, before);
- last = insn;
- insn = next;
- }
-
- return last;
-}
-
-/* Emit the insns in a chain starting with FIRST and place them in back of
- the insn AFTER. Return the last insn emitted. */
-
-rtx
-emit_insns_after (first, after)
- register rtx first;
- register rtx after;
-{
- register rtx last;
- register rtx after_after;
-
- if (!after)
- abort ();
-
- if (!first)
- return first;
-
- for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
- continue;
-
- after_after = NEXT_INSN (after);
-
- NEXT_INSN (after) = first;
- PREV_INSN (first) = after;
- NEXT_INSN (last) = after_after;
- if (after_after)
- PREV_INSN (after_after) = last;
-
- if (after == last_insn)
- last_insn = last;
- return last;
-}
-
-/* Make an insn of code JUMP_INSN with pattern PATTERN
- and add it to the end of the doubly-linked list. */
-
-rtx
-emit_jump_insn (pattern)
- rtx pattern;
-{
- if (GET_CODE (pattern) == SEQUENCE)
- return emit_insn (pattern);
- else
- {
- register rtx insn = make_jump_insn_raw (pattern);
- add_insn (insn);
- return insn;
- }
-}
-
-/* Make an insn of code CALL_INSN with pattern PATTERN
- and add it to the end of the doubly-linked list. */
-
-rtx
-emit_call_insn (pattern)
- rtx pattern;
-{
- if (GET_CODE (pattern) == SEQUENCE)
- return emit_insn (pattern);
- else
- {
- register rtx insn = make_call_insn_raw (pattern);
- add_insn (insn);
- PUT_CODE (insn, CALL_INSN);
- return insn;
- }
-}
-
-/* Add the label LABEL to the end of the doubly-linked list. */
-
-rtx
-emit_label (label)
- rtx label;
-{
- /* This can be called twice for the same label
- as a result of the confusion that follows a syntax error!
- So make it harmless. */
- if (INSN_UID (label) == 0)
- {
- INSN_UID (label) = cur_insn_uid++;
- add_insn (label);
- }
- return label;
-}
-
-/* Make an insn of code BARRIER
- and add it to the end of the doubly-linked list. */
-
-rtx
-emit_barrier ()
-{
- register rtx barrier = rtx_alloc (BARRIER);
- INSN_UID (barrier) = cur_insn_uid++;
- add_insn (barrier);
- return barrier;
-}
-
-/* Make an insn of code NOTE
- with data-fields specified by FILE and LINE
- and add it to the end of the doubly-linked list,
- but only if line-numbers are desired for debugging info. */
-
-rtx
-emit_line_note (file, line)
- char *file;
- int line;
-{
- if (output_bytecode)
- {
- /* FIXME: for now we do nothing, but eventually we will have to deal with
- debugging information. */
- return 0;
- }
-
- emit_filename = file;
- emit_lineno = line;
-
-#if 0
- if (no_line_numbers)
- return 0;
-#endif
-
- return emit_note (file, line);
-}
-
-/* Make an insn of code NOTE
- with data-fields specified by FILE and LINE
- and add it to the end of the doubly-linked list.
- If it is a line-number NOTE, omit it if it matches the previous one. */
-
-rtx
-emit_note (file, line)
- char *file;
- int line;
-{
- register rtx note;
-
- if (line > 0)
- {
- if (file && last_filename && !strcmp (file, last_filename)
- && line == last_linenum)
- return 0;
- last_filename = file;
- last_linenum = line;
- }
-
- if (no_line_numbers && line > 0)
- {
- cur_insn_uid++;
- return 0;
- }
-
- note = rtx_alloc (NOTE);
- INSN_UID (note) = cur_insn_uid++;
- NOTE_SOURCE_FILE (note) = file;
- NOTE_LINE_NUMBER (note) = line;
- add_insn (note);
- return note;
-}
-
-/* Emit a NOTE, and don't omit it even if LINE it the previous note. */
-
-rtx
-emit_line_note_force (file, line)
- char *file;
- int line;
-{
- last_linenum = -1;
- return emit_line_note (file, line);
-}
-
-/* Cause next statement to emit a line note even if the line number
- has not changed. This is used at the beginning of a function. */
-
-void
-force_next_line_note ()
-{
- last_linenum = -1;
-}
-
-/* Return an indication of which type of insn should have X as a body.
- The value is CODE_LABEL, INSN, CALL_INSN or JUMP_INSN. */
-
-enum rtx_code
-classify_insn (x)
- rtx x;
-{
- if (GET_CODE (x) == CODE_LABEL)
- return CODE_LABEL;
- if (GET_CODE (x) == CALL)
- return CALL_INSN;
- if (GET_CODE (x) == RETURN)
- return JUMP_INSN;
- if (GET_CODE (x) == SET)
- {
- if (SET_DEST (x) == pc_rtx)
- return JUMP_INSN;
- else if (GET_CODE (SET_SRC (x)) == CALL)
- return CALL_INSN;
- else
- return INSN;
- }
- if (GET_CODE (x) == PARALLEL)
- {
- register int j;
- for (j = XVECLEN (x, 0) - 1; j >= 0; j--)
- if (GET_CODE (XVECEXP (x, 0, j)) == CALL)
- return CALL_INSN;
- else if (GET_CODE (XVECEXP (x, 0, j)) == SET
- && SET_DEST (XVECEXP (x, 0, j)) == pc_rtx)
- return JUMP_INSN;
- else if (GET_CODE (XVECEXP (x, 0, j)) == SET
- && GET_CODE (SET_SRC (XVECEXP (x, 0, j))) == CALL)
- return CALL_INSN;
- }
- return INSN;
-}
-
-/* Emit the rtl pattern X as an appropriate kind of insn.
- If X is a label, it is simply added into the insn chain. */
-
-rtx
-emit (x)
- rtx x;
-{
- enum rtx_code code = classify_insn (x);
-
- if (code == CODE_LABEL)
- return emit_label (x);
- else if (code == INSN)
- return emit_insn (x);
- else if (code == JUMP_INSN)
- {
- register rtx insn = emit_jump_insn (x);
- if (simplejump_p (insn) || GET_CODE (x) == RETURN)
- return emit_barrier ();
- return insn;
- }
- else if (code == CALL_INSN)
- return emit_call_insn (x);
- else
- abort ();
-}
-
-/* Begin emitting insns to a sequence which can be packaged in an RTL_EXPR. */
-
-void
-start_sequence ()
-{
- struct sequence_stack *tem;
-
- if (sequence_element_free_list)
- {
- /* Reuse a previously-saved struct sequence_stack. */
- tem = sequence_element_free_list;
- sequence_element_free_list = tem->next;
- }
- else
- tem = (struct sequence_stack *) permalloc (sizeof (struct sequence_stack));
-
- tem->next = sequence_stack;
- tem->first = first_insn;
- tem->last = last_insn;
- tem->sequence_rtl_expr = sequence_rtl_expr;
-
- sequence_stack = tem;
-
- first_insn = 0;
- last_insn = 0;
-}
-
-/* Similarly, but indicate that this sequence will be placed in
- T, an RTL_EXPR. */
-
-void
-start_sequence_for_rtl_expr (t)
- tree t;
-{
- start_sequence ();
-
- sequence_rtl_expr = t;
-}
-
-/* Set up the insn chain starting with FIRST
- as the current sequence, saving the previously current one. */
-
-void
-push_to_sequence (first)
- rtx first;
-{
- rtx last;
-
- start_sequence ();
-
- for (last = first; last && NEXT_INSN (last); last = NEXT_INSN (last));
-
- first_insn = first;
- last_insn = last;
-}
-
-/* Set up the outer-level insn chain
- as the current sequence, saving the previously current one. */
-
-void
-push_topmost_sequence ()
-{
- struct sequence_stack *stack, *top;
-
- start_sequence ();
-
- for (stack = sequence_stack; stack; stack = stack->next)
- top = stack;
-
- first_insn = top->first;
- last_insn = top->last;
- sequence_rtl_expr = top->sequence_rtl_expr;
-}
-
-/* After emitting to the outer-level insn chain, update the outer-level
- insn chain, and restore the previous saved state. */
-
-void
-pop_topmost_sequence ()
-{
- struct sequence_stack *stack, *top;
-
- for (stack = sequence_stack; stack; stack = stack->next)
- top = stack;
-
- top->first = first_insn;
- top->last = last_insn;
- /* ??? Why don't we save sequence_rtl_expr here? */
-
- end_sequence ();
-}
-
-/* After emitting to a sequence, restore previous saved state.
-
- To get the contents of the sequence just made,
- you must call `gen_sequence' *before* calling here. */
-
-void
-end_sequence ()
-{
- struct sequence_stack *tem = sequence_stack;
-
- first_insn = tem->first;
- last_insn = tem->last;
- sequence_rtl_expr = tem->sequence_rtl_expr;
- sequence_stack = tem->next;
-
- tem->next = sequence_element_free_list;
- sequence_element_free_list = tem;
-}
-
-/* Return 1 if currently emitting into a sequence. */
-
-int
-in_sequence_p ()
-{
- return sequence_stack != 0;
-}
-
-/* Generate a SEQUENCE rtx containing the insns already emitted
- to the current sequence.
-
- This is how the gen_... function from a DEFINE_EXPAND
- constructs the SEQUENCE that it returns. */
-
-rtx
-gen_sequence ()
-{
- rtx result;
- rtx tem;
- int i;
- int len;
-
- /* Count the insns in the chain. */
- len = 0;
- for (tem = first_insn; tem; tem = NEXT_INSN (tem))
- len++;
-
- /* If only one insn, return its pattern rather than a SEQUENCE.
- (Now that we cache SEQUENCE expressions, it isn't worth special-casing
- the case of an empty list.) */
- if (len == 1
- && (GET_CODE (first_insn) == INSN
- || GET_CODE (first_insn) == JUMP_INSN
- /* Don't discard the call usage field. */
- || (GET_CODE (first_insn) == CALL_INSN
- && CALL_INSN_FUNCTION_USAGE (first_insn) == NULL_RTX)))
- {
- NEXT_INSN (first_insn) = free_insn;
- free_insn = first_insn;
- return PATTERN (first_insn);
- }
-
- /* Put them in a vector. See if we already have a SEQUENCE of the
- appropriate length around. */
- if (len < SEQUENCE_RESULT_SIZE && (result = sequence_result[len]) != 0)
- sequence_result[len] = 0;
- else
- {
- /* Ensure that this rtl goes in saveable_obstack, since we may
- cache it. */
- push_obstacks_nochange ();
- rtl_in_saveable_obstack ();
- result = gen_rtx (SEQUENCE, VOIDmode, rtvec_alloc (len));
- pop_obstacks ();
- }
-
- for (i = 0, tem = first_insn; tem; tem = NEXT_INSN (tem), i++)
- XVECEXP (result, 0, i) = tem;
-
- return result;
-}
-
-/* Initialize data structures and variables in this file
- before generating rtl for each function. */
-
-void
-init_emit ()
-{
- int i;
-
- first_insn = NULL;
- last_insn = NULL;
- sequence_rtl_expr = NULL;
- cur_insn_uid = 1;
- reg_rtx_no = LAST_VIRTUAL_REGISTER + 1;
- last_linenum = 0;
- last_filename = 0;
- first_label_num = label_num;
- last_label_num = 0;
- sequence_stack = NULL;
-
- /* Clear the start_sequence/gen_sequence cache. */
- sequence_element_free_list = 0;
- for (i = 0; i < SEQUENCE_RESULT_SIZE; i++)
- sequence_result[i] = 0;
- free_insn = 0;
-
- /* Init the tables that describe all the pseudo regs. */
-
- regno_pointer_flag_length = LAST_VIRTUAL_REGISTER + 101;
-
- regno_pointer_flag
- = (char *) savealloc (regno_pointer_flag_length);
- bzero (regno_pointer_flag, regno_pointer_flag_length);
-
- regno_pointer_align
- = (char *) savealloc (regno_pointer_flag_length);
- bzero (regno_pointer_align, regno_pointer_flag_length);
-
- regno_reg_rtx
- = (rtx *) savealloc (regno_pointer_flag_length * sizeof (rtx));
- bzero ((char *) regno_reg_rtx, regno_pointer_flag_length * sizeof (rtx));
-
- /* Put copies of all the virtual register rtx into regno_reg_rtx. */
- regno_reg_rtx[VIRTUAL_INCOMING_ARGS_REGNUM] = virtual_incoming_args_rtx;
- regno_reg_rtx[VIRTUAL_STACK_VARS_REGNUM] = virtual_stack_vars_rtx;
- regno_reg_rtx[VIRTUAL_STACK_DYNAMIC_REGNUM] = virtual_stack_dynamic_rtx;
- regno_reg_rtx[VIRTUAL_OUTGOING_ARGS_REGNUM] = virtual_outgoing_args_rtx;
-
- /* Indicate that the virtual registers and stack locations are
- all pointers. */
- REGNO_POINTER_FLAG (STACK_POINTER_REGNUM) = 1;
- REGNO_POINTER_FLAG (FRAME_POINTER_REGNUM) = 1;
- REGNO_POINTER_FLAG (HARD_FRAME_POINTER_REGNUM) = 1;
- REGNO_POINTER_FLAG (ARG_POINTER_REGNUM) = 1;
-
- REGNO_POINTER_FLAG (VIRTUAL_INCOMING_ARGS_REGNUM) = 1;
- REGNO_POINTER_FLAG (VIRTUAL_STACK_VARS_REGNUM) = 1;
- REGNO_POINTER_FLAG (VIRTUAL_STACK_DYNAMIC_REGNUM) = 1;
- REGNO_POINTER_FLAG (VIRTUAL_OUTGOING_ARGS_REGNUM) = 1;
-
-#ifdef STACK_BOUNDARY
- REGNO_POINTER_ALIGN (STACK_POINTER_REGNUM) = STACK_BOUNDARY / BITS_PER_UNIT;
- REGNO_POINTER_ALIGN (FRAME_POINTER_REGNUM) = STACK_BOUNDARY / BITS_PER_UNIT;
- REGNO_POINTER_ALIGN (HARD_FRAME_POINTER_REGNUM)
- = STACK_BOUNDARY / BITS_PER_UNIT;
- REGNO_POINTER_ALIGN (ARG_POINTER_REGNUM) = STACK_BOUNDARY / BITS_PER_UNIT;
-
- REGNO_POINTER_ALIGN (VIRTUAL_INCOMING_ARGS_REGNUM)
- = STACK_BOUNDARY / BITS_PER_UNIT;
- REGNO_POINTER_ALIGN (VIRTUAL_STACK_VARS_REGNUM)
- = STACK_BOUNDARY / BITS_PER_UNIT;
- REGNO_POINTER_ALIGN (VIRTUAL_STACK_DYNAMIC_REGNUM)
- = STACK_BOUNDARY / BITS_PER_UNIT;
- REGNO_POINTER_ALIGN (VIRTUAL_OUTGOING_ARGS_REGNUM)
- = STACK_BOUNDARY / BITS_PER_UNIT;
-#endif
-
-#ifdef INIT_EXPANDERS
- INIT_EXPANDERS;
-#endif
-}
-
-/* Create some permanent unique rtl objects shared between all functions.
- LINE_NUMBERS is nonzero if line numbers are to be generated. */
-
-void
-init_emit_once (line_numbers)
- int line_numbers;
-{
- int i;
- enum machine_mode mode;
-
- no_line_numbers = ! line_numbers;
-
- sequence_stack = NULL;
-
- /* Compute the word and byte modes. */
-
- byte_mode = VOIDmode;
- word_mode = VOIDmode;
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- {
- if (GET_MODE_BITSIZE (mode) == BITS_PER_UNIT
- && byte_mode == VOIDmode)
- byte_mode = mode;
-
- if (GET_MODE_BITSIZE (mode) == BITS_PER_WORD
- && word_mode == VOIDmode)
- word_mode = mode;
- }
-
- ptr_mode = mode_for_size (POINTER_SIZE, GET_MODE_CLASS (Pmode), 0);
-
- /* Create the unique rtx's for certain rtx codes and operand values. */
-
- pc_rtx = gen_rtx (PC, VOIDmode);
- cc0_rtx = gen_rtx (CC0, VOIDmode);
-
- /* Don't use gen_rtx here since gen_rtx in this case
- tries to use these variables. */
- for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++)
- {
- const_int_rtx[i + MAX_SAVED_CONST_INT] = rtx_alloc (CONST_INT);
- PUT_MODE (const_int_rtx[i + MAX_SAVED_CONST_INT], VOIDmode);
- INTVAL (const_int_rtx[i + MAX_SAVED_CONST_INT]) = i;
- }
-
- /* These four calls obtain some of the rtx expressions made above. */
- const0_rtx = GEN_INT (0);
- const1_rtx = GEN_INT (1);
- const2_rtx = GEN_INT (2);
- constm1_rtx = GEN_INT (-1);
-
- /* This will usually be one of the above constants, but may be a new rtx. */
- const_true_rtx = GEN_INT (STORE_FLAG_VALUE);
-
- dconst0 = REAL_VALUE_ATOF ("0", DFmode);
- dconst1 = REAL_VALUE_ATOF ("1", DFmode);
- dconst2 = REAL_VALUE_ATOF ("2", DFmode);
- dconstm1 = REAL_VALUE_ATOF ("-1", DFmode);
-
- for (i = 0; i <= 2; i++)
- {
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- {
- rtx tem = rtx_alloc (CONST_DOUBLE);
- union real_extract u;
-
- bzero ((char *) &u, sizeof u); /* Zero any holes in a structure. */
- u.d = i == 0 ? dconst0 : i == 1 ? dconst1 : dconst2;
-
- bcopy ((char *) &u, (char *) &CONST_DOUBLE_LOW (tem), sizeof u);
- CONST_DOUBLE_MEM (tem) = cc0_rtx;
- PUT_MODE (tem, mode);
-
- const_tiny_rtx[i][(int) mode] = tem;
- }
-
- const_tiny_rtx[i][(int) VOIDmode] = GEN_INT (i);
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- const_tiny_rtx[i][(int) mode] = GEN_INT (i);
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_PARTIAL_INT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- const_tiny_rtx[i][(int) mode] = GEN_INT (i);
- }
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_CC); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- const_tiny_rtx[0][(int) mode] = const0_rtx;
-
- stack_pointer_rtx = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
- frame_pointer_rtx = gen_rtx (REG, Pmode, FRAME_POINTER_REGNUM);
-
- if (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM)
- hard_frame_pointer_rtx = frame_pointer_rtx;
- else
- hard_frame_pointer_rtx = gen_rtx (REG, Pmode, HARD_FRAME_POINTER_REGNUM);
-
- if (FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
- arg_pointer_rtx = frame_pointer_rtx;
- else if (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM)
- arg_pointer_rtx = hard_frame_pointer_rtx;
- else if (STACK_POINTER_REGNUM == ARG_POINTER_REGNUM)
- arg_pointer_rtx = stack_pointer_rtx;
- else
- arg_pointer_rtx = gen_rtx (REG, Pmode, ARG_POINTER_REGNUM);
-
-#ifdef RETURN_ADDRESS_POINTER_REGNUM
- return_address_pointer_rtx = gen_rtx (REG, Pmode,
- RETURN_ADDRESS_POINTER_REGNUM);
-#endif
-
- /* Create the virtual registers. Do so here since the following objects
- might reference them. */
-
- virtual_incoming_args_rtx = gen_rtx (REG, Pmode,
- VIRTUAL_INCOMING_ARGS_REGNUM);
- virtual_stack_vars_rtx = gen_rtx (REG, Pmode,
- VIRTUAL_STACK_VARS_REGNUM);
- virtual_stack_dynamic_rtx = gen_rtx (REG, Pmode,
- VIRTUAL_STACK_DYNAMIC_REGNUM);
- virtual_outgoing_args_rtx = gen_rtx (REG, Pmode,
- VIRTUAL_OUTGOING_ARGS_REGNUM);
-
-#ifdef STRUCT_VALUE
- struct_value_rtx = STRUCT_VALUE;
-#else
- struct_value_rtx = gen_rtx (REG, Pmode, STRUCT_VALUE_REGNUM);
-#endif
-
-#ifdef STRUCT_VALUE_INCOMING
- struct_value_incoming_rtx = STRUCT_VALUE_INCOMING;
-#else
-#ifdef STRUCT_VALUE_INCOMING_REGNUM
- struct_value_incoming_rtx
- = gen_rtx (REG, Pmode, STRUCT_VALUE_INCOMING_REGNUM);
-#else
- struct_value_incoming_rtx = struct_value_rtx;
-#endif
-#endif
-
-#ifdef STATIC_CHAIN_REGNUM
- static_chain_rtx = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
-
-#ifdef STATIC_CHAIN_INCOMING_REGNUM
- if (STATIC_CHAIN_INCOMING_REGNUM != STATIC_CHAIN_REGNUM)
- static_chain_incoming_rtx = gen_rtx (REG, Pmode, STATIC_CHAIN_INCOMING_REGNUM);
- else
-#endif
- static_chain_incoming_rtx = static_chain_rtx;
-#endif
-
-#ifdef STATIC_CHAIN
- static_chain_rtx = STATIC_CHAIN;
-
-#ifdef STATIC_CHAIN_INCOMING
- static_chain_incoming_rtx = STATIC_CHAIN_INCOMING;
-#else
- static_chain_incoming_rtx = static_chain_rtx;
-#endif
-#endif
-
-#ifdef PIC_OFFSET_TABLE_REGNUM
- pic_offset_table_rtx = gen_rtx (REG, Pmode, PIC_OFFSET_TABLE_REGNUM);
-#endif
-}
diff --git a/gcc/enquire.c b/gcc/enquire.c
deleted file mode 100644
index 2518c732a6b..00000000000
--- a/gcc/enquire.c
+++ /dev/null
@@ -1,2842 +0,0 @@
-/* Everything you wanted to know about your machine and C compiler,
- but didn't know who to ask. */
-
-#ifndef VERSION
-#define VERSION "4.3"
-#endif
-
-/* Author: Steven Pemberton, CWI, Amsterdam; steven@cwi.nl
- Bugfixes and upgrades gratefully received.
-
- Copyright (c) 1988, 1989, 1990 Steven Pemberton, CWI, Amsterdam.
- All rights reserved.
-
- Changes by Richard Stallman:
- Undef CHAR_BIT, etc., if defined in stdio.h, Richard Stallman, Aug 90.
- In EPROP, avoid a <= old if bad is set, Richard Stallman, May 91.
- Use gstddef.h, not stddef.h, Richard Stallman, Nov 91.
- Don't declare malloc, instead cast the value, Richard Stallman, Nov 91.
- Include sys/types.h before signal.h, Apr 92.
- Support NO_LONG_DOUBLE_IO in f_define and f_rep; new fn fake_f_rep, Apr 92.
- Enclose -f output in #ifndef _FLOAT_H___, Richard Stallman, May 92.
-
- Change by Jim Wilson:
- Add #undef before every #define, Dec 92.
- Use stddef.h not gstddef.h, Mar 94.
-
- Changes by Paul Eggert, installed Feb 93:
- (fake_f_rep): Clear all of u, initially. Make the ints in u unsigned.
- (f_define): Use ordinary constants for long double
- if it's same width as double. Make __convert_long_double_i unsigned.
- Richard Stallman, May 93:
- In F_check, check NO_LONG_DOUBLE_IO.
-
- Changes by Stephen Moshier, installed Sep 93:
- (FPROP): Recognize 80387 or 68881 XFmode format.
-
-
- COMPILING
- With luck and a following wind, just the following will work:
- cc enquire.c -o enquire
- You may get some messages about unreachable code, which you can ignore.
-
- If your compiler doesn't support: add flag:
- signed char (eg pcc) -DNO_SC
- unsigned char -DNO_UC
- unsigned short and long -DNO_UI
- void -DNO_VOID
- signal(), or setjmp/longjmp() -DNO_SIG
- %Lf in printf -DNO_LONG_DOUBLE_IO
-
- Try to compile first with no flags, and see if you get any errors -
- you might be surprised. (Most non-ANSI compilers need -DNO_SC, though.)
- Some compilers need a -f flag for floating point.
-
- Don't use any optimisation flags: the program may not work if you do.
- Though "while (a+1.0-a-1.0 == 0.0)" may look like "while(1)" to an
- optimiser, to a floating-point unit there's a world of difference.
-
- Some compilers offer various flags for different floating point
- modes; it's worth trying all possible combinations of these.
-
- Add -DID=\"name\" if you want the machine/flags identified in the output.
-
- FAULTY COMPILERS
- Because of bugs and/or inadequacies, some compilers need the following
- defines:
-
- If your C preprocessor doesn't have the predefined __FILE__ macro, and
- you don't want to call this file enquire.c but, say, tell.c, add the
- flag -DFILENAME=\"tell.c\" .
-
- Some compilers won't accept the line "#include FILENAME".
- Add flag -DNO_FILE. In that case, this file *must* be called enquire.c.
-
- Some compilers can't cope with "#ifdef __FILE__". Use -DFILENAME=
- or -DNO_FILE as above.
-
- Some naughty compilers define __STDC__, but don't really support it.
- Some define it as 0, in which case we treat it as undefined.
- But if your compiler defines it, and isn't really ANSI C,
- add flag -DNO_STDC. (To those compiler writers: for shame).
-
- Some naughty compilers define __STDC__, but don't have the stddef.h
- include file. Add flag -DNO_STDDEF.
-
- Summary of naughty-compiler flags:
- If your compiler doesn't support: add flag:
- __FILE__ (and you changed the filename) -DFILENAME=\"name.c\"
- #ifdef __FILE__ -DNO_FILE or -DFILENAME=...
- #include FILENAME -DNO_FILE
- __STDC__ (properly) -DNO_STDC
- stddef.h -DNO_STDDEF
-
- Some systems crash when you try to malloc all store. To save users of
- such defective systems too much grief, they may compile with -DNO_MEM,
- which ignores that bit of the code.
-
- While it is not our policy to support defective compilers, pity has been
- taken on people with compilers that can't produce object files bigger than
- 32k (especially since it was an easy addition). Compile the program
- into separate parts like this:
- cc -DSEP -DPASS0 -o p0.o <other flags> enquire.c
- cc -DSEP -DPASS1 -o p1.o <other flags> enquire.c
- cc -DSEP -DPASS2 -o p2.o <other flags> enquire.c
- cc -DSEP -DPASS3 -o p3.o <other flags> enquire.c
- cc -o enquire p0.o p1.o p2.o p3.o
-
- SYSTEM DEPENDENCIES
- You may possibly need to add some calls to signal() for other sorts of
- exception on your machine than SIGFPE, and SIGOVER. See lines beginning
- #ifdef SIGxxx in main() (and communicate the differences to me!).
-
- OUTPUT
- Run without argument to get the information as English text. If run
- with argument -l (e.g. enquire -l), output is a series of #define's for
- the ANSI standard limits.h include file, excluding MB_MAX_CHAR. If run
- with argument -f, output is a series of #define's for the ANSI standard
- float.h include file (according to ANSI C Draft of Dec 7, 1988).
- Flag -v gives verbose output: output includes the English text above
- as C comments. The program exit(0)'s if everything went ok, otherwise
- it exits with a positive number, telling how many problems there were.
-
- VERIFYING THE COMPILER
- If, having produced the float.h and limits.h header files, you want to
- verify that the compiler reads them back correctly (there are a lot of
- boundary cases, of course, like minimum and maximum numbers), you can
- recompile enquire.c with -DVERIFY set (plus the other flags that you used
- when compiling the version that produced the header files). This then
- recompiles the program so that it #includes "limits.h" and "float.h",
- and checks that the constants it finds there are the same as the
- constants it produces. Run the resulting program with enquire -fl.
- Very few compilers have passed without error.
- NB: You *must* recompile with the same compiler and flags, otherwise
- you may get odd results.
-
- You can also use this option if your compiler already has both files,
- and you want to confirm that this program produces the right results.
-
- TROUBLESHOOTING.
- This program is now quite trustworthy, and suspicious and wrong output
- may well be caused by bugs in the compiler, not in the program (however
- of course, this is not guaranteed, and no responsibility can be
- accepted, etc.)
-
- The program only works if overflows are ignored by the C system or
- are catchable with signal().
-
- If the program fails to run to completion (often with the error message
- "Unexpected signal at point x"), this often turns out to be a bug in the
- C compiler's run-time system. Check what was about to be printed, and
- try to narrow the problem down.
-
- Another possible problem is that you have compiled the program to produce
- loss-of-precision arithmetic traps. The program cannot cope with these,
- and you should re-compile without them. (They should never be the default).
-
- Make sure you compiled with optimisation turned off.
-
- Output preceded by *** WARNING: identifies behaviour of the C system
- deemed incorrect by the program. Likely problems are that printf or
- scanf don't cope properly with certain boundary numbers: this program
- goes to a lot of trouble to calculate its values, and these values
- are mostly boundary numbers. Experience has shown that often printf
- cannot cope with these values, and so in an attempt to increase
- confidence in the output, for each float and double that is printed,
- the printed value is checked by using sscanf to read it back.
- Care is taken that numbers are printed with enough digits to uniquely
- identify them, and therefore that they can be read back identically.
- If the number read back is different, then there is probably a bug in
- printf or sscanf, and the program prints the warning message.
- If the two numbers in the warning look identical, then printf is more
- than likely rounding the last digit(s) incorrectly. To put you at ease
- that the two really are different, the bit patterns of the two numbers
- are also printed. The difference is very likely in the last bit.
- Many scanf's read the minimum double back as 0.0, and similarly cause
- overflow when reading the maximum double. This program quite ruthlessly
- declares all these behaviours faulty. The point is that if you get
- one of these warnings, the output may be wrong, so you should check
- the result carefully if you intend to use the results. Of course, printf
- and sscanf may both be wrong, and cancel each other out, so you should
- check the output carefully anyway.
-
- The warning that "a cast didn't work" refers to cases like this:
-
- float f;
- #define C 1.234567890123456789
- f= C;
- if (f != (float) C) printf ("Wrong!");
-
- A faulty compiler will widen f to double and ignore the cast to float,
- and because there is more accuracy in a double than a float, fail to
- recognise that they are the same. In the actual case in point, f and C
- are passed as parameters to a function that discovers they are not equal,
- so it's just possible that the error was in the parameter passing,
- not in the cast (see function Validate()).
- For ANSI C, which has float constants, the error message is "constant has
- wrong precision".
-
- REPORTING PROBLEMS
- If the program doesn't work for you for any reason that can't be
- narrowed down to a problem in the C compiler, or it has to be changed in
- order to get it to compile, or it produces suspicious output (like a very
- low maximum float, for instance), please mail the problem and an example
- of the incorrect output to steven@cwi.nl or ..!hp4nl!cwi.nl!steven, so that
- improvements can be worked into future versions; cwi.nl is the European
- backbone, and is connected to uunet and other fine hosts.
-
- The program tries to catch and diagnose bugs in the compiler/run-time
- system. I would be especially pleased to have reports of failures so
- that I can improve this service.
-
- I apologise unreservedly for the contorted use of the preprocessor...
-
- THE SMALL PRINT
- You may copy and distribute verbatim copies of this source file.
-
- You may modify this source file, and copy and distribute such
- modified versions, provided that you leave the copyright notice
- at the top of the file and also cause the modified file to carry
- prominent notices stating that you changed the files and the date
- of any change; and cause the whole of any work that you distribute
- or publish, that in whole or in part contains or is a derivative of
- this program or any part thereof, to be licensed at no charge to
- all third parties on terms identical to those here.
-
- If you do have a fix to any problem, please send it to me, so that
- other people can have the benefits.
-
- While every effort has been taken to make this program as reliable as
- possible, no responsibility can be taken for the correctness of the
- output, nor suitability for any particular use.
-
- This program is an offshoot of a project funded by public funds.
- If you use this program for research or commercial use (i.e. more
- than just for the fun of knowing about your compiler) mailing a short
- note of acknowledgement may help keep enquire.c supported.
-
- ACKNOWLEDGEMENTS
- Many people have given time and ideas to making this program what it is.
- To all of them thanks, and apologies for not mentioning them by name.
-
- HISTORY
- Originally started as a program to generate configuration constants
- for a large piece of software we were writing, which later took on
- a life of its own...
- 1.0 Length 6658!; end 1984?
- Unix only. Only printed a dozen maximum int/double values.
- 2.0 Length 10535; Spring 1985
- Prints values as #defines (about 20 of them)
- More extensive floating point, using Cody and Waite
- Handles signals better
- Programs around optimisations
- Handles Cybers
- 3.0 Length 12648; Aug 1987; prints about 42 values
- Added PASS stuff, so treats float as well as double
- 4.0 Length 33891; Feb 1989; prints around 85 values
- First GNU version (for gcc, where they call it hard-params.c)
- Generates float.h and limits.h files
- Handles long double
- Generates warnings for dubious output
- 4.1 Length 47738; April 1989
- Added VERIFY and TEST
- 4.2 Length 63442; Feb 1990
- Added SEP
- Fixed eps/epsneg
- Added check for pseudo-unsigned chars
- Added description for each #define output
- Added check for absence of defines during verify
- Added prototypes
- Added NO_STDC and NO_FILE
- Fixed alignments output
- 4.3 Length 75000; Oct 1990; around 114 lines of output
- Function xmalloc defined, Richard Stallman, June 89.
- Alignments computed from member offsets rather than structure sizes,
- Richard Stallman, Oct 89.
- Print whether char* and int* pointers have the same format;
- also char * and function *.
- Update to Draft C version Dec 7, 1988
- - types of constants produced in limits.h
- (whether to put a U after unsigned shorts and chars and
- whether to output -1024 as (-1023-1))
- - values of SCHAR_MIN/MAX
- - values of *_EPSILON (not the smallest but the effective smallest)
- Added FILENAME, since standard C doesn't allow #define __FILE__
- Renamed from config.c to enquire.c
- Added size_t and ptrdiff_t enquiries
- Added promotion enquiries
- Added type checks of #defines
- Added NO_STDDEF
- Changed endian to allow for cases where not all bits are used
- Sanity check for max integrals
- Fixed definition of setjmp for -DNO_SIG
- Moved #define ... 0.0L inside #ifdef STDC, in case some cpp's tokenize
- Added NO_MEM
-*/
-
-/* Set FILENAME to the name of this file */
-#ifndef FILENAME
-#ifdef NO_FILE
-#define FILENAME "enquire.c"
-#else
-#ifdef __FILE__ /* It's a compiler bug if this fails. Compile with -DNO_FILE */
-#define FILENAME __FILE__
-#else
-#define FILENAME "enquire.c"
-#endif /* __FILE__ */
-#endif /* NO_FILE */
-#endif /* FILENAME */
-
-/* If PASS isn't defined, then this is the first pass over this file. */
-#ifndef PASS
-#ifndef SEP
-#define PASS 1
-#define PASS0 1
-#define PASS1 1
-#endif /* SEP */
-
-/* A description of the ANSI constants */
-#define D_CHAR_BIT "Number of bits in a storage unit"
-#define D_CHAR_MAX "Maximum char"
-#define D_CHAR_MIN "Minimum char"
-#define D_SCHAR_MAX "Maximum signed char"
-#define D_SCHAR_MIN "Minimum signed char"
-#define D_UCHAR_MAX "Maximum unsigned char (minimum is always 0)"
-
-#define D_INT_MAX "Maximum %s"
-#define D_INT_MIN "Minimum %s"
-#define D_UINT_MAX "Maximum unsigned %s (minimum is always 0)"
-
-#define D_FLT_ROUNDS "Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown"
-#define D_FLT_RADIX "Radix of exponent representation"
-#define D_MANT_DIG "Number of base-FLT_RADIX digits in the significand of a %s"
-#define D_DIG "Number of decimal digits of precision in a %s"
-#define D_MIN_EXP "Minimum int x such that FLT_RADIX**(x-1) is a normalised %s"
-#define D_MIN_10_EXP "Minimum int x such that 10**x is a normalised %s"
-#define D_MAX_EXP "Maximum int x such that FLT_RADIX**(x-1) is a representable %s"
-#define D_MAX_10_EXP "Maximum int x such that 10**x is a representable %s"
-#define D_MAX "Maximum %s"
-#define D_EPSILON "Difference between 1.0 and the minimum %s greater than 1.0"
-#define D_MIN "Minimum normalised %s"
-
-/* Procedure just marks the functions that don't return a result */
-#ifdef NO_VOID
-#define Procedure int
-#else
-#define Procedure void
-#endif
-
-/* Some bad compilers define __STDC__, when they don't support it.
- Compile with -DNO_STDC to get round this.
-*/
-#ifndef NO_STDC
-#ifdef __STDC__
-#if __STDC__ /* If __STDC__ is 0, assume it isn't supported */
-#define STDC
-#endif
-#endif
-#endif
-
-/* Stuff different for ANSI C, and old C:
- ARGS and NOARGS are used for function prototypes.
- Volatile is used to reduce the chance of optimisation,
- and to prevent variables being put in registers (when setjmp/longjmp
- wouldn't work as we want)
- Long_double is the longest floating point type available.
- stdc is used in tests like "if (stdc)", which is less ugly than #ifdef.
- U is output after unsigned constants.
- */
-#ifdef STDC
-
-#define ARGS(x) x
-#define NOARGS (void)
-#define Volatile volatile
-#define Long_double long double
-#define stdc 1
-#define U "U"
-
-#else /* Old style C */
-
-#define ARGS(x) ()
-#define NOARGS ()
-#define Volatile static
-#define Long_double double
-#define stdc 0
-#define U ""
-
-#endif /* STDC */
-
-/* include files */
-/* Stdio.h might include limits.h, and limits.h might include float.h, and
- float.h is probably the float.h put together by the gcc makefile to
- cause errors. We use our special define to assure float.h that we don't
- really need it. */
-#define __GCC_FLOAT_NOT_NEEDED
-#include <stdio.h>
-
-#ifdef STDC
-#ifndef NO_STDDEF
-#include <stddef.h> /* for size_t: if this fails, define NO_STDDEF */
-#endif
-#endif
-
-#ifdef NO_SIG
-#define jmp_buf int
-#else
-#include <sys/types.h>
-#include <signal.h>
-#include <setjmp.h>
-#endif
-
-/* Kludge around the possibility that <stdio.h> includes <limits.h> */
-#ifdef CHAR_BIT
-#undef CHAR_BIT
-#undef CHAR_MAX
-#undef CHAR_MIN
-#undef SCHAR_MAX
-#undef SCHAR_MIN
-#undef UCHAR_MAX
-#undef UCHAR_MIN
-#endif
-
-#ifdef VERIFY
-#include "limits.h"
-#include "float.h"
-#endif
-
-#define Vprintf if (V) printf
-#define Unexpected(place) if (setjmp(lab)!=0) croak(place)
-#define fabs(x) (((x)<0.0)?(-x):(x))
-
-#endif /* PASS */
-
-#ifdef PASS0
-
-/* Prototypes for what's to come: */
-
-int false NOARGS;
-
-#ifdef NO_STDDEF
-char *malloc (); /* Old style prototype */
-#else
-char *malloc ARGS((size_t size));
-#endif
-
-Procedure exit ARGS((int status));
-
-char *f_rep ARGS((int precision, Long_double val));
-char *fake_f_rep ARGS((char *type, Long_double val));
-
-int maximum_int NOARGS;
-int cprop NOARGS;
-int basic NOARGS;
-Procedure sprop NOARGS;
-Procedure iprop NOARGS;
-Procedure lprop NOARGS;
-Procedure usprop NOARGS;
-Procedure uiprop NOARGS;
-Procedure ulprop NOARGS;
-int fprop ARGS((int bits_per_byte));
-int dprop ARGS((int bits_per_byte));
-int ldprop ARGS((int bits_per_byte));
-Procedure efprop ARGS((int fprec, int dprec, int lprec));
-Procedure edprop ARGS((int fprec, int dprec, int lprec));
-Procedure eldprop ARGS((int fprec, int dprec, int lprec));
-
-int setmode ARGS((char *s));
-Procedure farewell ARGS((int bugs));
-Procedure describe ARGS((char *description, char *extra));
-Procedure missing ARGS((char *s));
-Procedure fmissing ARGS((char *s));
-Procedure check_defines NOARGS;
-Procedure bitpattern ARGS((char *p, unsigned int size));
-int ceil_log ARGS((int base, Long_double x));
-Procedure croak ARGS((int place));
-Procedure eek_a_bug ARGS((char *problem));
-Procedure endian ARGS((int bits_per_byte));
-int exponent ARGS((Long_double x, double *fract, int *exp));
-int floor_log ARGS((int base, Long_double x));
-Procedure f_define ARGS((char *desc, char *extra, char *sort, char *name,
- int prec, Long_double val, char *mark));
-Procedure i_define ARGS((char *desc, char *extra, char *sort, char *name,
- long val, long lim, long req, char *mark));
-Procedure u_define ARGS((char *desc, char *extra, char *sort, char *name,
- unsigned long val, unsigned long req, char *mark));
-
-#ifdef NO_SIG /* There's no signal(), or setjmp/longjmp() */
-
- /* Dummy routines instead */
-
- int setjmp ARGS((int lab));
-
- int lab=1;
- int setjmp(lab) int lab; { return(0); }
- Procedure signal(i, p) int i, (*p)(); {}
-
-#else
- jmp_buf lab;
- Procedure overflow(sig) int sig; { /* what to do on over/underflow */
- signal(sig, overflow);
- longjmp(lab, 1);
- }
-
-#endif /*NO_SIG*/
-
-int V= 0, /* verbose */
- L= 0, /* produce limits.h */
- F= 0, /* produce float.h */
- bugs=0; /* The number of (possible) bugs in the output */
-
-char co[4], oc[4]; /* Comment starter and ender symbols */
-
-int bits_per_byte; /* the number of bits per unit returned by sizeof() */
-int flt_rounds; /* The calculated value of FLT_ROUNDS */
-int flt_radix; /* The calculated value of FLT_RADIX */
-
-#ifdef TEST
-/* Set the fp modes on a SUN with 68881 chip, to check that different
- rounding modes etc. get properly detected.
- Compile with -f68881 for cc, -m68881 for gcc, and with additional flag
- -DTEST. Run with additional parameter +hex-number, to set the 68881 mode
- register to hex-number
-*/
-
-/* Bits 0x30 = rounding mode */
-#define ROUND_BITS 0x30
-#define TO_NEAREST 0x00
-#define TO_ZERO 0x10
-#define TO_MINUS_INF 0x20
-#define TO_PLUS_INF 0x30 /* The SUN FP user's guide seems to be wrong here */
-
-/* Bits 0xc0 = extended rounding */
-#define EXT_BITS 0xc0
-#define ROUND_EXTENDED 0x00
-#define ROUND_SINGLE 0x40
-#define ROUND_DOUBLE 0x80
-
-/* Enabled traps */
-#define EXE_INEX1 0x100
-#define EXE_INEX2 0x200
-#define EXE_DZ 0x400
-#define EXE_UNFL 0x800
-#define EXE_OVFL 0x1000
-#define EXE_OPERR 0x2000
-#define EXE_SNAN 0x4000
-#define EXE_BSUN 0x8000
-
-/* Only used for testing, on a Sun with 68881 chip */
-/* Print the FP mode */
-printmode(new) unsigned new; {
- fpmode_(&new);
- printf("New fp mode:\n");
- printf(" Round toward ");
- switch (new & ROUND_BITS) {
- case TO_NEAREST: printf("nearest"); break;
- case TO_ZERO: printf("zero"); break;
- case TO_MINUS_INF: printf("minus infinity"); break;
- case TO_PLUS_INF: printf("plus infinity"); break;
- default: printf("???"); break;
- }
-
- printf("\n Extended rounding precision: ");
-
- switch (new & EXT_BITS) {
- case ROUND_EXTENDED: printf("extended"); break;
- case ROUND_SINGLE: printf("single"); break;
- case ROUND_DOUBLE: printf("double"); break;
- default: printf("???"); break;
- }
-
- printf("\n Enabled exceptions:");
- if (new & (unsigned) EXE_INEX1) printf(" inex1");
- if (new & (unsigned) EXE_INEX2) printf(" inex2");
- if (new & (unsigned) EXE_DZ) printf(" dz");
- if (new & (unsigned) EXE_UNFL) printf(" unfl");
- if (new & (unsigned) EXE_OVFL) printf(" ovfl");
- if (new & (unsigned) EXE_OPERR) printf(" operr");
- if (new & (unsigned) EXE_SNAN) printf(" snan");
- if (new & (unsigned) EXE_BSUN) printf(" bsun");
- printf("\n");
-}
-
-/* Only used for testing, on a Sun with 68881 chip */
-/* Set the FP mode */
-int setmode(s) char *s; {
- unsigned mode=0, dig;
- char c;
-
- while (*s) {
- c= *s++;
- if (c>='0' && c<='9') dig= c-'0';
- else if (c>='a' && c<='f') dig= c-'a'+10;
- else if (c>='A' && c<='F') dig= c-'A'+10;
- else return 1;
- mode= mode<<4 | dig;
- }
- printmode(mode);
- return 0;
-}
-#else
-/* ARGSUSED */
-int setmode(s) char *s; {
- fprintf(stderr, "Can't set mode: not compiled with TEST\n");
- return(1);
-}
-#endif
-
-Procedure farewell(bugs) int bugs; {
- if (bugs == 0) exit(0);
- printf("\n%sFor hints on dealing with the ", co);
- if (bugs == 1) printf("problem");
- else printf("%d problems", bugs);
- printf(" above\n see the section 'TROUBLESHOOTING' in the file ");
- printf("%s%s\n", FILENAME, oc);
- exit(bugs);
-}
-
-/* The program has received a signal where it wasn't expecting one */
-Procedure croak(place) int place; {
- printf("*** Unexpected signal at point %d\n", place);
- farewell(bugs+1); /* An exit isn't essential here, but avoids loops */
-}
-
-/* This is here in case alloca.c is used, which calls this. */
-char *xmalloc(size) unsigned size; {
- char *value = (char *)malloc(size);
- if (value == 0) {
- fprintf(stderr, "Virtual memory exceeded\n");
- exit(bugs+1);
- }
- return value;
-}
-
-int maxint;
-
-int maximum_int() {
- /* Find the maximum integer */
- Volatile int newi, int_max, two=2;
-
- /* Calculate maxint ***********************************/
- /* Calculate 2**n-1 until overflow - then use the previous value */
-
- newi=1; int_max=0;
-
- if (setjmp(lab)==0) { /* Yields int_max */
- while(newi>int_max) {
- int_max=newi;
- newi=newi*two+1;
- }
- }
- Unexpected(0);
- return int_max;
-}
-
-int main(argc, argv) int argc; char *argv[]; {
- int dprec, fprec, lprec;
- int i; char *s; int bad;
-
-#ifdef SIGFPE
- signal(SIGFPE, overflow);
-#endif
-#ifdef SIGOVER
- signal(SIGOVER, overflow);
-#endif
-/* Add more calls as necessary */
-
- Unexpected(1);
-
- bad=0;
- for (i=1; i < argc; i++) {
- s= argv[i];
- if (*s == '-') {
- s++;
- while (*s) {
- switch (*(s++)) {
- case 'v': V=1; break;
- case 'l': L=1; break;
- case 'f': F=1; break;
- default: bad=1; break;
- }
- }
- } else if (*s == '+') {
- s++;
- bad= setmode(s);
- } else bad= 1;
- }
- if (bad) {
- fprintf(stderr,
- "Usage: %s [-vlf]\n v=Verbose l=Limits.h f=Float.h\n",
- argv[0]);
- exit(1);
- }
- if (L || F) {
- co[0]= '/'; oc[0]= ' ';
- co[1]= '*'; oc[1]= '*';
- co[2]= ' '; oc[2]= '/';
- co[3]= '\0'; oc[3]= '\0';
- } else {
- co[0]= '\0'; oc[0]= '\0';
- V=1;
- }
-
- if (L) printf("%slimits.h%s\n", co, oc);
- if (F) printf("%sfloat.h%s\n", co, oc);
- if (F) {
- printf ("#ifndef _FLOAT_H___\n");
- printf ("#define _FLOAT_H___\n");
- }
-#ifdef ID
- printf("%sProduced on %s by enquire version %s, CWI, Amsterdam%s\n",
- co, ID, VERSION, oc);
-#else
- printf("%sProduced by enquire version %s, CWI, Amsterdam%s\n",
- co, VERSION, oc);
-#endif
-
-#ifdef VERIFY
- printf("%sVerification phase%s\n", co, oc);
-#endif
-
-#ifdef NO_SIG
- Vprintf("%sCompiled without signal(): %s%s\n",
- co,
- "there's nothing that can be done if overflow occurs",
- oc);
-#endif
-#ifdef NO_SC
- Vprintf("%sCompiled without signed char%s\n", co, oc);
-#endif
-#ifdef NO_UC
- Vprintf("%Compiled without unsigned char%s\n", co, oc);
-#endif
-#ifdef NO_UI
- Vprintf("%Compiled without unsigned short or long%s\n", co, oc);
-#endif
-#ifdef __STDC__
- Vprintf("%sCompiler claims to be ANSI C level %d%s\n",
- co, __STDC__, oc);
-#else
- Vprintf("%sCompiler does not claim to be ANSI C%s\n", co, oc);
-#endif
- printf("\n");
- check_defines();
-
- maxint= maximum_int();
- bits_per_byte= basic();
- Vprintf("\n");
- if (F||V) {
- fprec= fprop(bits_per_byte);
- dprec= dprop(bits_per_byte);
- lprec= ldprop(bits_per_byte);
- efprop(fprec, dprec, lprec);
- edprop(fprec, dprec, lprec);
- eldprop(fprec, dprec, lprec);
- }
-#ifndef NO_MEM
- if (V) {
- unsigned int size;
- long total;
- /* An extra goody: the approximate amount of data-space */
- /* Allocate store until no more available */
- /* Different implementations have a different argument type
- to malloc. Here we assume that it's the same type as
- that which sizeof() returns */
- size=1<<((bits_per_byte*sizeof(int))-2);
- total=0;
- while (size!=0) {
- while ( malloc((false()?sizeof(int):size)) !=
- (char *)NULL
- ) {
- total+=(size/2);
- }
- size/=2;
- }
-
- Vprintf("%sMemory mallocatable ~= %ld Kbytes%s\n",
- co, (total+511)/512, oc);
- }
-#endif
- if (F) {
- printf ("#endif %s _FLOAT_H___%s\n", co, oc);
- }
- farewell(bugs);
- return bugs; /* To keep compilers and lint happy */
-}
-
-Procedure eek_a_bug(problem) char *problem; {
- /* The program has discovered a problem */
- printf("\n%s*** WARNING: %s%s\n", co, problem, oc);
- bugs++;
-}
-
-Procedure describe(description, extra) char *description, *extra; {
- /* Produce the description for a #define */
- printf(" %s", co);
- printf(description, extra);
- printf("%s\n", oc);
-}
-
-Procedure i_define(desc, extra, sort, name, val, lim, req, mark)
- char *desc, *extra, *sort, *name; long val, lim, req; char *mark; {
- /* Produce a #define for a signed int type */
- describe(desc, extra);
- printf("#undef %s%s\n", sort, name);
- if (val >= 0) {
- printf("#define %s%s %ld%s\n", sort, name, val, mark);
- } else if (val + lim < 0) {
- /* We may not produce a constant like -1024 if the max
- allowable value is 1023. It has then to be output as
- -1023-1. lim is the max allowable value. */
- printf("#define %s%s (%ld%s%ld%s)\n",
- sort, name, -lim, mark, val+lim, mark);
- } else {
- printf("#define %s%s (%ld%s)\n", sort, name, val, mark);
- }
- /* If VERIFY is not set, val and req are just the same value;
- if it is set, val is the value as calculated, and req is
- the #defined constant
- */
- if (val != req) {
- printf("%s*** Verify failed for above #define!\n", co);
- printf(" Compiler has %ld for value%s\n\n", req, oc);
- bugs++;
- }
- Vprintf("\n");
-}
-
-Procedure u_define(desc, extra, sort, name, val, req, mark)
- char *desc, *extra, *sort, *name; unsigned long val, req; char *mark; {
- /* Produce a #define for an unsigned value */
- describe(desc, extra);
- printf("#undef %s%s\n", sort, name);
- printf("#define %s%s %lu%s%s\n", sort, name, val, U, mark);
- if (val != req) {
- printf("%s*** Verify failed for above #define!\n", co);
- printf(" Compiler has %lu for value%s\n\n", req, oc);
- bugs++;
- }
- Vprintf("\n");
-}
-
-Procedure f_define(desc, extra, sort, name, precision, val, mark)
- char *desc, *extra, *sort, *name; int precision;
- Long_double val; char *mark; {
- /* Produce a #define for a float/double/long double */
- describe(desc, extra);
- printf ("#undef %s%s\n", sort, name);
- if (stdc) {
-#ifdef NO_LONG_DOUBLE_IO
- static int union_defined = 0;
- if (sizeof(double) != sizeof(Long_double)
- && !strcmp(sort, "LDBL")) {
- if (!union_defined) {
- printf("#ifndef __LDBL_UNION__\n");
- printf("#define __LDBL_UNION__\n");
- printf("union __convert_long_double {\n");
- printf(" unsigned __convert_long_double_i[4];\n");
- printf(" long double __convert_long_double_d;\n");
- printf("};\n");
- printf("#endif\n");
- union_defined = 1;
- }
- printf("#define %s%s %s\n",
- sort, name, fake_f_rep("long double", val));
- } else {
- printf("#define %s%s %s%s\n",
- sort, name, f_rep(precision, val), mark);
- }
-#else
- printf("#define %s%s %s%s\n",
- sort, name, f_rep(precision, val), mark);
-#endif
- } else if (*mark == 'F') {
- /* non-ANSI C has no float constants, so cast the constant */
- printf("#define %s%s ((float)%s)\n",
- sort, name, f_rep(precision, val));
- } else {
- printf("#define %s%s %s\n", sort, name, f_rep(precision, val));
- }
- Vprintf("\n");
-}
-
-int floor_log(base, x) int base; Long_double x; {
- /* return floor(log base(x)) */
- int r=0;
- while (x>=base) { r++; x/=base; }
- return r;
-}
-
-int ceil_log(base, x) int base; Long_double x; {
- int r=0;
- while (x>1.0) { r++; x/=base; }
- return r;
-}
-
-int exponent(x, fract, exp) Long_double x; double *fract; int *exp; {
- /* Split x into a fraction and a power of ten;
- returns 0 if x is unusable, 1 otherwise.
- Only used for error messages about faulty output.
- */
- int r=0, neg=0;
- Long_double old;
- *fract=0.0; *exp=0;
- if (x<0.0) {
- x= -x;
- neg= 1;
- }
- if (x==0.0) return 1;
- if (x>=10.0) {
- while (x>=10.0) {
- old=x; r++; x/=10.0;
- if (old==x) return 0;
- }
- } else {
- while (x<1.0) {
- old=x; r--; x*=10.0;
- if (old==x) return 0;
- }
- }
- if (neg) *fract= (double) -x;
- else *fract=(double) x;
- *exp=r;
- return 1;
-}
-
-/* Print a value of type TYPE with value VAL,
- assuming that sprintf can't handle this type properly (without truncation).
- We create an expression that uses type casting to create the value from
- a bit pattern. */
-
-char *fake_f_rep(type, val) char *type; Long_double val; {
- static char buf[1024];
- union { unsigned int i[4]; Long_double ld;} u;
- u.i[0] = u.i[1] = u.i[2] = u.i[3] = 0;
- u.ld = val;
- sprintf(buf, "(__extension__ ((union __convert_long_double) {0x%x, 0x%x, 0x%x, 0x%x}).__convert_long_double_d)",
- u.i[0], u.i[1], u.i[2], u.i[3]);
- return buf;
-}
-
-char *f_rep(precision, val) int precision; Long_double val; {
- /* Return the floating representation of val */
- static char buf[1024];
-#ifdef NO_LONG_DOUBLE_IO
- if (1)
-#else
- if (sizeof(double) == sizeof(Long_double))
-#endif
- {
- double d = val;
- /* Assume they're the same, and use non-stdc format */
- /* This is for stdc compilers using non-stdc libraries */
- sprintf(buf, "%.*e", precision, d);
- } else {
- /* It had better support Le then */
- sprintf(buf, "%.*Le", precision, val);
- }
- return buf;
-}
-
-Procedure bitpattern(p, size) char *p; unsigned int size; {
- /* Printf the bit-pattern of p */
- char c;
- int i, j;
-
- for (i=1; i<=size; i++) {
- c= *p;
- p++;
- for (j=bits_per_byte-1; j>=0; j--)
- printf("%c", (c>>j)&1 ? '1' : '0');
- if (i!=size) printf(" ");
- }
-}
-
-#define Order(x, px, mode)\
- printf("%s%s ", co, mode); for (i=0; i<sizeof(x); i++) px[i]= ab[i]; \
- for (i=1; i<=sizeof(x); i++) { c=((x>>(bits_per_byte*(sizeof(x)-i)))&mask);\
- putchar(c==0 ? '?' : (char)c); }\
- printf("%s\n", oc);
-
-Procedure endian(bits_per_byte) int bits_per_byte; {
- /* Printf the byte-order used on this machine */
- /*unsigned*/ short s=0;
- /*unsigned*/ int j=0;
- /*unsigned*/ long l=0;
-
- char *ps= (char *) &s,
- *pj= (char *) &j,
- *pl= (char *) &l,
- *ab= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- unsigned int mask, i, c;
-
- mask=0;
- for (i=1; i<=(unsigned)bits_per_byte; i++) mask= (mask<<1)|1;
-
- if (V) {
- printf("%sCHARACTER ORDER%s\n", co, oc);
- Order(s, ps, "short:");
- Order(j, pj, "int: ");
- Order(l, pl, "long: ");
- }
-}
-
-Procedure missing(s) char *s; {
- printf("%s*** #define %s missing from limits.h%s\n", co, s, oc);
- bugs++;
-}
-
-Procedure fmissing(s) char *s; {
- printf("%s*** #define %s missing from float.h%s\n", co, s, oc);
- bugs++;
-}
-
-/* To try and fool optimisers */
-int false() { return 0; }
-
-#define Promoted(x) (false()?(x):(-1))
-#define is_signed(x) (Promoted(x) < 0)
-#define sign_of(x) ((x)?"signed":"unsigned")
-#define Signed 1
-#define Unsigned 0
-#define sgn(x) ((is_signed(x))?Signed:Unsigned)
-
-#define showtype(t, x) Vprintf("%s%s %s %s%s\n", co, t, sign_of(is_signed(x)), type_of(sizeof(x)), oc)
-
-char *type_of(x) int x; {
- if (x == sizeof(char)) {
- if (sizeof(char) == sizeof(int)) return "char/short/int";
- if (sizeof(char) == sizeof(short)) return "char/short";
- return "char";
- }
- if (x == sizeof(short)) {
- if (sizeof(short) == sizeof(int)) return "short/int";
- return "short";
- }
- if (x == sizeof(int)) {
- if (sizeof(int) == sizeof(long)) return "int/long";
- return "int";
- }
- if (x == sizeof(long)) return "long";
- return "unknown-type";
-}
-
-char *ftype_of(x) int x; {
- if (x == sizeof(float)) {
- return "float";
- }
- if (x == sizeof(double)) {
- if (sizeof(double) == sizeof(Long_double))
- return "(long)double";
- return "double";
- }
- if (x == sizeof(Long_double)) {
- return "long double";
- }
- return "unknown-type";
-}
-
-Procedure typerr(name, esign, esize, sign, size)
- char *name; int esign, esize, sign, size;
-{
- Vprintf("*** %s has wrong type: expected %s %s, found %s %s\n",
- name, sign_of(esign), type_of(esize),
- sign_of(sign), type_of(size));
-}
-
-Procedure ftyperr(name, esize, size) char *name; int esize, size; {
- Vprintf("*** %s has wrong type: expected %s, found %s\n",
- name, ftype_of(esize), ftype_of(size));
-}
-
-int promotions() {
- int si = 0; long sl = 0;
- unsigned int ui; unsigned long ul;
- short ss; unsigned short us;
-
- Vprintf("\n%sPROMOTIONS%s\n", co, oc);
-
- if (
- /* Possible warnings here; no problem */
- (sizeof(Promoted(si)) != sizeof(int)) ||
- (sizeof(Promoted(sl)) != sizeof(long)) ||
- (sizeof(Promoted(ss)) != sizeof(int)) ||
- (sizeof(Promoted(ui)) != sizeof(int)) ||
- (sizeof(Promoted(ul)) != sizeof(long)) ||
- (sizeof(Promoted(us)) != sizeof(int)) ||
- is_signed(ui) || is_signed(ul) ||
- !is_signed(si) || !is_signed(sl)
- )
- {
- eek_a_bug("promotions don't work properly in conditional expressions\n");
- }
-
- showtype("unsigned short promotes to", Promoted((unsigned short) 0));
- showtype("long+unsigned gives", sl+ui);
- return 0;
-}
-
-#define checktype(x, n, s, t) if((sgn(x)!=s)||(sizeof(x)!=sizeof(t))) typerr(n, s, sizeof(t), sign_of(x), sizeof(x));
-
-#define fchecktype(x, n, t) if (sizeof(x) != sizeof(t)) ftyperr(n, sizeof(x), sizeof(t));
-
-Procedure check_defines() {
- /* ensure that all #defines are present and have the correct type */
-#ifdef VERIFY
- int usign;
-
-#ifdef NO_UI
- usign= Signed;
-#else
- /* Implementations promote unsigned short differently */
- usign= is_signed((unsigned short) 0);
-#endif
-
- if (L) {
-#ifdef CHAR_BIT
- checktype(CHAR_BIT, "CHAR_BIT", Signed, int);
-#else
- missing("CHAR_BIT");
-#endif
-#ifdef CHAR_MAX
- checktype(CHAR_MAX, "CHAR_MAX", Signed, int);
-#else
- missing("CHAR_MAX");
-#endif
-#ifdef CHAR_MIN
- checktype(CHAR_MIN, "CHAR_MIN", Signed, int);
-#else
- missing("CHAR_MIN");
-#endif
-#ifdef SCHAR_MAX
- checktype(SCHAR_MAX, "SCHAR_MAX", Signed, int);
-#else
- missing("SCHAR_MAX");
-#endif
-#ifdef SCHAR_MIN
- checktype(SCHAR_MIN, "SCHAR_MIN", Signed, int);
-#else
- missing("SCHAR_MIN");
-#endif
-#ifdef UCHAR_MAX
- checktype(UCHAR_MAX, "UCHAR_MAX", Signed, int);
-#else
- missing("UCHAR_MAX");
-#endif
-#ifdef SHRT_MAX
- checktype(SHRT_MAX, "SHRT_MAX", Signed, int);
-#else
- missing("SHRT_MAX");
-#endif
-#ifdef SHRT_MIN
- checktype(SHRT_MIN, "SHRT_MIN", Signed, int);
-#else
- missing("SHRT_MIN");
-#endif
-#ifdef INT_MAX
- checktype(INT_MAX, "INT_MAX", Signed, int);
-#else
- missing("INT_MAX");
-#endif
-#ifdef INT_MIN
- checktype(INT_MIN, "INT_MIN", Signed, int);
-#else
- missing("INT_MIN");
-#endif
-#ifdef LONG_MAX
- checktype(LONG_MAX, "LONG_MAX", Signed, long);
-#else
- missing("LONG_MAX");
-#endif
-#ifdef LONG_MIN
- checktype(LONG_MIN, "LONG_MIN", Signed, long);
-#else
- missing("LONG_MIN");
-#endif
-#ifdef USHRT_MAX
- checktype(USHRT_MAX, "USHRT_MAX", usign, int);
-#else
- missing("USHRT_MAX");
-#endif
-#ifdef UINT_MAX
- checktype(UINT_MAX, "UINT_MAX", Unsigned, int);
-#else
- missing("UINT_MAX");
-#endif
-#ifdef ULONG_MAX
- checktype(ULONG_MAX, "ULONG_MAX", Unsigned, long);
-#else
- missing("ULONG_MAX");
-#endif
- } /* if (L) */
-
- if (F) {
-#ifdef FLT_RADIX
- checktype(FLT_RADIX, "FLT_RADIX", Signed, int);
-#else
- fmissing("FLT_RADIX");
-#endif
-#ifdef FLT_MANT_DIG
- checktype(FLT_MANT_DIG, "FLT_MANT_DIG", Signed, int);
-#else
- fmissing("FLT_MANT_DIG");
-#endif
-#ifdef FLT_DIG
- checktype(FLT_DIG, "FLT_DIG", Signed, int);
-#else
- fmissing("FLT_DIG");
-#endif
-#ifdef FLT_ROUNDS
- checktype(FLT_ROUNDS, "FLT_ROUNDS", Signed, int);
-#else
- fmissing("FLT_ROUNDS");
-#endif
-#ifdef FLT_EPSILON
- fchecktype(FLT_EPSILON, "FLT_EPSILON", float);
-#else
- fmissing("FLT_EPSILON");
-#endif
-#ifdef FLT_MIN_EXP
- checktype(FLT_MIN_EXP, "FLT_MIN_EXP", Signed, int);
-#else
- fmissing("FLT_MIN_EXP");
-#endif
-#ifdef FLT_MIN
- fchecktype(FLT_MIN, "FLT_MIN", float);
-#else
- fmissing("FLT_MIN");
-#endif
-#ifdef FLT_MIN_10_EXP
- checktype(FLT_MIN_10_EXP, "FLT_MIN_10_EXP", Signed, int);
-#else
- fmissing("FLT_MIN_10_EXP");
-#endif
-#ifdef FLT_MAX_EXP
- checktype(FLT_MAX_EXP, "FLT_MAX_EXP", Signed, int);
-#else
- fmissing("FLT_MAX_EXP");
-#endif
-#ifdef FLT_MAX
- fchecktype(FLT_MAX, "FLT_MAX", float);
-#else
- fmissing("FLT_MAX");
-#endif
-#ifdef FLT_MAX_10_EXP
- checktype(FLT_MAX_10_EXP, "FLT_MAX_10_EXP", Signed, int);
-#else
- fmissing("FLT_MAX_10_EXP");
-#endif
-#ifdef DBL_MANT_DIG
- checktype(DBL_MANT_DIG, "DBL_MANT_DIG", Signed, int);
-#else
- fmissing("DBL_MANT_DIG");
-#endif
-#ifdef DBL_DIG
- checktype(DBL_DIG, "DBL_DIG", Signed, int);
-#else
- fmissing("DBL_DIG");
-#endif
-#ifdef DBL_EPSILON
- fchecktype(DBL_EPSILON, "DBL_EPSILON", double);
-#else
- fmissing("DBL_EPSILON");
-#endif
-#ifdef DBL_MIN_EXP
- checktype(DBL_MIN_EXP, "DBL_MIN_EXP", Signed, int);
-#else
- fmissing("DBL_MIN_EXP");
-#endif
-#ifdef DBL_MIN
- fchecktype(DBL_MIN, "DBL_MIN", double);
-#else
- fmissing("DBL_MIN");
-#endif
-#ifdef DBL_MIN_10_EXP
- checktype(DBL_MIN_10_EXP, "DBL_MIN_10_EXP", Signed, int);
-#else
- fmissing("DBL_MIN_10_EXP");
-#endif
-#ifdef DBL_MAX_EXP
- checktype(DBL_MAX_EXP, "DBL_MAX_EXP", Signed, int);
-#else
- fmissing("DBL_MAX_EXP");
-#endif
-#ifdef DBL_MAX
- fchecktype(DBL_MAX, "DBL_MAX", double);
-#else
- fmissing("DBL_MAX");
-#endif
-#ifdef DBL_MAX_10_EXP
- checktype(DBL_MAX_10_EXP, "DBL_MAX_10_EXP", Signed, int);
-#else
- fmissing("DBL_MAX_10_EXP");
-#endif
-#ifdef STDC
-#ifdef LDBL_MANT_DIG
- checktype(LDBL_MANT_DIG, "LDBL_MANT_DIG", Signed, int);
-#else
- fmissing("LDBL_MANT_DIG");
-#endif
-#ifdef LDBL_DIG
- checktype(LDBL_DIG, "LDBL_DIG", Signed, int);
-#else
- fmissing("LDBL_DIG");
-#endif
-#ifdef LDBL_EPSILON
- fchecktype(LDBL_EPSILON, "LDBL_EPSILON", long double);
-#else
- fmissing("LDBL_EPSILON");
-#endif
-#ifdef LDBL_MIN_EXP
- checktype(LDBL_MIN_EXP, "LDBL_MIN_EXP", Signed, int);
-#else
- fmissing("LDBL_MIN_EXP");
-#endif
-#ifdef LDBL_MIN
- fchecktype(LDBL_MIN, "LDBL_MIN", long double);
-#else
- fmissing("LDBL_MIN");
-#endif
-#ifdef LDBL_MIN_10_EXP
- checktype(LDBL_MIN_10_EXP, "LDBL_MIN_10_EXP", Signed, int);
-#else
- fmissing("LDBL_MIN_10_EXP");
-#endif
-#ifdef LDBL_MAX_EXP
- checktype(LDBL_MAX_EXP, "LDBL_MAX_EXP", Signed, int);
-#else
- fmissing("LDBL_MAX_EXP");
-#endif
-#ifdef LDBL_MAX
- fchecktype(LDBL_MAX, "LDBL_MAX", long double);
-#else
- fmissing("LDBL_MAX");
-#endif
-#ifdef LDBL_MAX_10_EXP
- checktype(LDBL_MAX_10_EXP, "LDBL_MAX_10_EXP", Signed, int);
-#else
- fmissing("LDBL_MAX_10_EXP");
-#endif
-#endif /* STDC */
- } /* if (F) */
-#endif /* VERIFY */
-}
-
-#ifdef VERIFY
-#ifndef SCHAR_MAX
-#define SCHAR_MAX char_max
-#endif
-#ifndef SCHAR_MIN
-#define SCHAR_MIN char_min
-#endif
-#ifndef UCHAR_MAX
-#define UCHAR_MAX char_max
-#endif
-#endif /* VERIFY */
-
-#ifndef CHAR_BIT
-#define CHAR_BIT char_bit
-#endif
-#ifndef CHAR_MAX
-#define CHAR_MAX char_max
-#endif
-#ifndef CHAR_MIN
-#define CHAR_MIN char_min
-#endif
-#ifndef SCHAR_MAX
-#define SCHAR_MAX char_max
-#endif
-#ifndef SCHAR_MIN
-#define SCHAR_MIN char_min
-#endif
-#ifndef UCHAR_MAX
-#define UCHAR_MAX char_max
-#endif
-
-int cprop() {
- /* Properties of type char */
- Volatile char c, char_max, char_min;
- Volatile int bits_per_byte, c_signed;
- long char_bit;
-
- Unexpected(2);
-
- /* Calculate number of bits per character *************************/
- c=1; bits_per_byte=0;
- do { c=c<<1; bits_per_byte++; } while(c!=0);
- c= (char)(-1);
- if (((int)c)<0) c_signed=1;
- else c_signed=0;
- Vprintf("%schar = %d bits, %ssigned%s\n",
- co, (int)sizeof(c)*bits_per_byte, (c_signed?"":"un"), oc);
- char_bit=(long)(sizeof(c)*bits_per_byte);
- if (L) i_define(D_CHAR_BIT, "", "CHAR", "_BIT",
- char_bit, 0L, (long) CHAR_BIT, "");
-
- c=0; char_max=0;
- c++;
- if (setjmp(lab)==0) { /* Yields char_max */
- while (c>char_max) {
- char_max=c;
- c++;
- }
- } else {
- Vprintf("%sCharacter overflow generates a trap!%s\n", co, oc);
- }
- c=0; char_min=0;
- c--;
- if (setjmp(lab)==0) { /* Yields char_min */
- while (c<char_min) {
- char_min=c;
- c--;
- }
- }
- if (c_signed && char_min == 0) {
- Vprintf("%sBEWARE! Chars are pseudo-unsigned:%s\n", co, oc);
- Vprintf("%s %s%s%s\n",
- "They contain only nonnegative values, ",
- "but sign extend when used as integers.", co, oc);
- }
- Unexpected(3);
-
- if (L) {
- /* Because of the integer promotions, you must use a U after
- the MAX_CHARS in the following cases */
- if ((sizeof(char) == sizeof(int)) && !c_signed) {
- u_define(D_CHAR_MAX, "", "CHAR", "_MAX",
- (long) char_max,
- (long) CHAR_MAX, "");
- } else {
- i_define(D_CHAR_MAX, "", "CHAR", "_MAX",
- (long) char_max, 0L,
- (long) CHAR_MAX, "");
- }
- i_define(D_CHAR_MIN, "", "CHAR", "_MIN",
- (long) char_min, (long) maxint,
- (long) CHAR_MIN, "");
- if (c_signed) {
- i_define(D_SCHAR_MAX, "", "SCHAR", "_MAX",
- (long) char_max, 0L,
- (long) SCHAR_MAX, "");
- i_define(D_SCHAR_MIN, "", "SCHAR", "_MIN",
- (long) char_min, (long) maxint,
- (long) SCHAR_MIN, "");
- } else {
- if (sizeof(char) == sizeof(int)) {
- u_define(D_UCHAR_MAX, "", "UCHAR", "_MAX",
- (long) char_max,
- (long) UCHAR_MAX, "");
- } else {
- i_define(D_UCHAR_MAX, "", "UCHAR", "_MAX",
- (long) char_max, 0L,
- (long) UCHAR_MAX, "");
- }
- }
-
- if (c_signed) {
-#ifndef NO_UC
- Volatile unsigned char c, char_max;
- c=0; char_max=0;
- c++;
- if (setjmp(lab)==0) { /* Yields char_max */
- while (c>char_max) {
- char_max=c;
- c++;
- }
- }
- Unexpected(4);
- if (sizeof(char) == sizeof(int)) {
- u_define(D_UCHAR_MAX, "", "UCHAR", "_MAX",
- (long) char_max,
- (long) UCHAR_MAX, "");
- } else {
- i_define(D_UCHAR_MAX, "", "UCHAR", "_MAX",
- (long) char_max, 0L,
- (long) UCHAR_MAX, "");
- }
-#endif
- } else {
-#ifndef NO_SC
-/* Define NO_SC if this gives a syntax error */ Volatile signed char c, char_max, char_min;
- c=0; char_max=0;
- c++;
- if (setjmp(lab)==0) { /* Yields char_max */
- while (c>char_max) {
- char_max=c;
- c++;
- }
- }
- c=0; char_min=0;
- c--;
- if (setjmp(lab)==0) { /* Yields char_min */
- while (c<char_min) {
- char_min=c;
- c--;
- }
- }
- Unexpected(5);
- i_define(D_SCHAR_MIN, "", "SCHAR", "_MIN",
- (long) char_min, (long) maxint,
- (long) SCHAR_MIN, "");
- i_define(D_SCHAR_MAX, "", "SCHAR", "_MAX",
- (long) char_max, 0L,
- (long) SCHAR_MAX, "");
-#endif /* NO_SC */
- }
- }
- return bits_per_byte;
-}
-
-int basic() {
- /* The properties of the basic types.
- Returns number of bits per sizeof unit */
- Volatile int bits_per_byte;
- typedef int function ();
- int variable;
- int *p, *q;
-
- Vprintf("%sSIZES%s\n", co, oc);
- bits_per_byte= cprop();
-
- /* Shorts, ints and longs *****************************************/
- Vprintf("%sshort=%d int=%d long=%d float=%d double=%d bits %s\n",
- co,
- (int) sizeof(short)*bits_per_byte,
- (int) sizeof(int)*bits_per_byte,
- (int) sizeof(long)*bits_per_byte,
- (int) sizeof(float)*bits_per_byte,
- (int) sizeof(double)*bits_per_byte, oc);
- if (stdc) {
- Vprintf("%slong double=%d bits%s\n",
- co, (int) sizeof(Long_double)*bits_per_byte, oc);
- }
- Vprintf("%schar*=%d bits%s%s\n",
- co, (int)sizeof(char *)*bits_per_byte,
- sizeof(char *)>sizeof(int)?" BEWARE! larger than int!":"",
- oc);
- Vprintf("%sint* =%d bits%s%s\n",
- co, (int)sizeof(int *)*bits_per_byte,
- sizeof(int *)>sizeof(int)?" BEWARE! larger than int!":"",
- oc);
- Vprintf("%sfunc*=%d bits%s%s\n",
- co, (int)sizeof(function *)*bits_per_byte,
- sizeof(function *)>sizeof(int)?" BEWARE! larger than int!":"",
- oc);
-if (V) printf ("%s%s %s %s%s\n", co, "Type size_t is",
- ((((false()?( sizeof(int)):(-1)) < 0) )?
- "signed":"unsigned") ,
- type_of(sizeof(
- sizeof(int)+0
- )
- ),
- oc);
- showtype("Type size_t is", sizeof(0));
-
- /* Alignment constants ********************************************/
-
-#define alignment(TYPE) \
- ((long)((char *)&((struct{char c; TYPE d;}*)0)->d - (char *) 0))
-
- Vprintf("\n%sALIGNMENTS%s\n", co, oc);
-
- Vprintf("%schar=%ld short=%ld int=%ld long=%ld%s\n",
- co,
- alignment(char), alignment(short),
- alignment(int), alignment(long),
- oc);
-
- Vprintf("%sfloat=%ld double=%ld%s\n",
- co,
- alignment(float), alignment(double),
- oc);
-
- if (stdc) {
- Vprintf("%slong double=%ld%s\n",
- co,
- alignment(Long_double),
- oc);
- }
- Vprintf("%schar*=%ld int*=%ld func*=%ld%s\n",
- co,
- alignment(char *), alignment(int *), alignment(function *),
- oc);
-
- Vprintf("\n");
-
- /* Ten little endians *********************************************/
-
- endian(bits_per_byte);
-
- /* Pointers *******************************************************/
-
- Vprintf("\n%sPROPERTIES OF POINTERS%s\n", co, oc);
-
- if ((long) (char *) &variable == (long) (int *) &variable)
- Vprintf("%sChar and int pointer formats seem identical%s\n",
- co, oc);
- else
- Vprintf("%sChar and int pointer formats are different%s\n",
- co, oc);
- if ((long) (char *) &variable == (long) (function *) &variable)
- Vprintf("%sChar and function pointer formats seem identical%s\n",
- co, oc);
- else
- Vprintf("%sChar and function pointer formats are different%s\n",
- co, oc);
-
- if (V) {
- if ("abcd"=="abcd")
- printf("%sStrings are shared%s\n", co, oc);
- else printf("%sStrings are not shared%s\n", co, oc);
- }
-
- p=0; q=0;
- showtype("Type ptrdiff_t is", p-q);
-
- Vprintf("\n%sPROPERTIES OF INTEGRAL TYPES%s\n", co, oc);
-
- sprop();
- iprop();
- lprop();
- usprop();
- uiprop();
- ulprop();
-
- promotions();
-
- Unexpected(6);
-
- return bits_per_byte;
-}
-
-#else /* not PASS0 */
-
-#ifdef SEP
-extern jmp_buf lab;
-extern int V, L, F, bugs, bits_per_byte;
-extern char co[], oc[];
-extern char *f_rep();
-#endif /* SEP */
-#endif /* ifdef PASS0 */
-
-/* As I said, I apologise for the contortions below. The functions are
- expanded by the preprocessor twice or three times (for float and double,
- and maybe for long double, and for short, int and long). That way,
- I never make a change to one that I forget to make to the other.
- You can look on it as C's fault for not supporting multi-line macro's.
- This whole file is read 3 times by the preprocessor, with PASSn set for
- n=1, 2 or 3, to decide which parts to reprocess.
-*/
-
-/* #undef on an already undefined thing is (wrongly) flagged as an error
- by some compilers, therefore the #ifdef that follows:
-*/
-#ifdef Number
-#undef Number
-#undef THING
-#undef Thing
-#undef thing
-#undef FPROP
-#undef Fname
-#undef Store
-#undef Sum
-#undef Diff
-#undef Mul
-#undef Div
-#undef ZERO
-#undef HALF
-#undef ONE
-#undef TWO
-#undef THREE
-#undef FOUR
-#undef Self
-#undef F_check
-#undef Validate
-#undef EPROP
-#undef MARK
-
-/* These are the float.h constants */
-#undef F_RADIX
-#undef F_MANT_DIG
-#undef F_DIG
-#undef F_ROUNDS
-#undef F_EPSILON
-#undef F_MIN_EXP
-#undef F_MIN
-#undef F_MIN_10_EXP
-#undef F_MAX_EXP
-#undef F_MAX
-#undef F_MAX_10_EXP
-#endif
-
-#ifdef Integer
-#undef Integer
-#undef INT
-#undef IPROP
-#undef Iname
-#undef UPROP
-#undef Uname
-#undef OK_UI
-#undef IMARK
-
-#undef I_MAX
-#undef I_MIN
-#undef U_MAX
-#endif
-
-#ifdef PASS1
-
-/* Define the things we're going to use this pass */
-
-#define Number float
-#define THING "FLOAT"
-#define Thing "Float"
-#define thing "float"
-#define Fname "FLT"
-#define FPROP fprop
-#define Store fStore
-#define Sum fSum
-#define Diff fDiff
-#define Mul fMul
-#define Div fDiv
-#define ZERO 0.0
-#define HALF 0.5
-#define ONE 1.0
-#define TWO 2.0
-#define THREE 3.0
-#define FOUR 4.0
-#define Self fSelf
-#define F_check fCheck
-#define MARK "F"
-#ifdef VERIFY
-#define Validate(prec, val, req, same) fValidate(prec, val, req, same)
-#endif
-
-#define EPROP efprop
-
-#define Integer short
-#define INT "short"
-#define IPROP sprop
-#define Iname "SHRT"
-#ifndef NO_UI
-#define OK_UI 1
-#endif
-#define IMARK ""
-
-#define UPROP usprop
-#define Uname "USHRT"
-
-#ifdef VERIFY
-#ifdef SHRT_MAX
-#define I_MAX SHRT_MAX
-#endif
-#ifdef SHRT_MIN
-#define I_MIN SHRT_MIN
-#endif
-#ifdef USHRT_MAX
-#define U_MAX USHRT_MAX
-#endif
-
-#ifdef FLT_RADIX
-#define F_RADIX FLT_RADIX
-#endif
-#ifdef FLT_MANT_DIG
-#define F_MANT_DIG FLT_MANT_DIG
-#endif
-#ifdef FLT_DIG
-#define F_DIG FLT_DIG
-#endif
-#ifdef FLT_ROUNDS
-#define F_ROUNDS FLT_ROUNDS
-#endif
-#ifdef FLT_EPSILON
-#define F_EPSILON FLT_EPSILON
-#endif
-#ifdef FLT_MIN_EXP
-#define F_MIN_EXP FLT_MIN_EXP
-#endif
-#ifdef FLT_MIN
-#define F_MIN FLT_MIN
-#endif
-#ifdef FLT_MIN_10_EXP
-#define F_MIN_10_EXP FLT_MIN_10_EXP
-#endif
-#ifdef FLT_MAX_EXP
-#define F_MAX_EXP FLT_MAX_EXP
-#endif
-#ifdef FLT_MAX
-#define F_MAX FLT_MAX
-#endif
-#ifdef FLT_MAX_10_EXP
-#define F_MAX_10_EXP FLT_MAX_10_EXP
-#endif
-#endif /* VERIFY */
-
-#endif /* PASS1 */
-
-#ifdef PASS2
-
-#define Number double
-#define THING "DOUBLE"
-#define Thing "Double"
-#define thing "double"
-#define Fname "DBL"
-#define FPROP dprop
-#define Store dStore
-#define Sum dSum
-#define Diff dDiff
-#define Mul dMul
-#define Div dDiv
-#define ZERO 0.0
-#define HALF 0.5
-#define ONE 1.0
-#define TWO 2.0
-#define THREE 3.0
-#define FOUR 4.0
-#define Self dSelf
-#define F_check dCheck
-#define MARK ""
-#ifdef VERIFY
-#define Validate(prec, val, req, same) dValidate(prec, val, req, same)
-#endif
-
-#define EPROP edprop
-
-#define Integer int
-#define INT "int"
-#define IPROP iprop
-#define Iname "INT"
-#define OK_UI 1 /* Unsigned int is always possible */
-#define IMARK ""
-
-#define UPROP uiprop
-#define Uname "UINT"
-
-#ifdef VERIFY
-#ifdef INT_MAX
-#define I_MAX INT_MAX
-#endif
-#ifdef INT_MIN
-#define I_MIN INT_MIN
-#endif
-#ifdef UINT_MAX
-#define U_MAX UINT_MAX
-#endif
-
-#ifdef DBL_MANT_DIG
-#define F_MANT_DIG DBL_MANT_DIG
-#endif
-#ifdef DBL_DIG
-#define F_DIG DBL_DIG
-#endif
-#ifdef DBL_EPSILON
-#define F_EPSILON DBL_EPSILON
-#endif
-#ifdef DBL_MIN_EXP
-#define F_MIN_EXP DBL_MIN_EXP
-#endif
-#ifdef DBL_MIN
-#define F_MIN DBL_MIN
-#endif
-#ifdef DBL_MIN_10_EXP
-#define F_MIN_10_EXP DBL_MIN_10_EXP
-#endif
-#ifdef DBL_MAX_EXP
-#define F_MAX_EXP DBL_MAX_EXP
-#endif
-#ifdef DBL_MAX
-#define F_MAX DBL_MAX
-#endif
-#ifdef DBL_MAX_10_EXP
-#define F_MAX_10_EXP DBL_MAX_10_EXP
-#endif
-#endif /* VERIFY */
-
-#endif /* PASS2 */
-
-#ifdef PASS3
-
-#ifdef STDC
-#define Number long double
-
-#define ZERO 0.0L
-#define HALF 0.5L
-#define ONE 1.0L
-#define TWO 2.0L
-#define THREE 3.0L
-#define FOUR 4.0L
-#endif
-
-#define THING "LONG DOUBLE"
-#define Thing "Long double"
-#define thing "long double"
-#define Fname "LDBL"
-#define FPROP ldprop
-#define Store ldStore
-#define Sum ldSum
-#define Diff ldDiff
-#define Mul ldMul
-#define Div ldDiv
-#define Self ldSelf
-#define F_check ldCheck
-#define MARK "L"
-#ifdef VERIFY
-#define Validate(prec, val, req, same) ldValidate(prec, val, req, same)
-#endif
-
-#define EPROP eldprop
-
-#define Integer long
-#define INT "long"
-#define IPROP lprop
-#define Iname "LONG"
-#ifndef NO_UI
-#define OK_UI 1
-#endif
-#define IMARK "L"
-
-#define UPROP ulprop
-#define Uname "ULONG"
-
-#ifdef VERIFY
-#ifdef LONG_MAX
-#define I_MAX LONG_MAX
-#endif
-#ifdef LONG_MIN
-#define I_MIN LONG_MIN
-#endif
-#ifdef ULONG_MAX
-#define U_MAX ULONG_MAX
-#endif
-
-#ifdef LDBL_MANT_DIG
-#define F_MANT_DIG LDBL_MANT_DIG
-#endif
-#ifdef LDBL_DIG
-#define F_DIG LDBL_DIG
-#endif
-#ifdef LDBL_EPSILON
-#define F_EPSILON LDBL_EPSILON
-#endif
-#ifdef LDBL_MIN_EXP
-#define F_MIN_EXP LDBL_MIN_EXP
-#endif
-#ifdef LDBL_MIN
-#define F_MIN LDBL_MIN
-#endif
-#ifdef LDBL_MIN_10_EXP
-#define F_MIN_10_EXP LDBL_MIN_10_EXP
-#endif
-#ifdef LDBL_MAX_EXP
-#define F_MAX_EXP LDBL_MAX_EXP
-#endif
-#ifdef LDBL_MAX
-#define F_MAX LDBL_MAX
-#endif
-#ifdef LDBL_MAX_10_EXP
-#define F_MAX_10_EXP LDBL_MAX_10_EXP
-#endif
-#endif /* VERIFY */
-
-#endif /* PASS3 */
-
-#ifndef I_MAX
-#define I_MAX int_max
-#endif
-#ifndef I_MIN
-#define I_MIN int_min
-#endif
-#ifndef U_MAX
-#define U_MAX u_max
-#endif
-
-#ifndef F_RADIX
-#define F_RADIX f_radix
-#endif
-#ifndef F_MANT_DIG
-#define F_MANT_DIG f_mant_dig
-#endif
-#ifndef F_DIG
-#define F_DIG f_dig
-#endif
-#ifndef F_ROUNDS
-#define F_ROUNDS f_rounds
-#endif
-#ifndef F_EPSILON
-#define F_EPSILON f_epsilon
-#endif
-#ifndef F_MIN_EXP
-#define F_MIN_EXP f_min_exp
-#endif
-#ifndef F_MIN
-#define F_MIN f_min
-#endif
-#ifndef F_MIN_10_EXP
-#define F_MIN_10_EXP f_min_10_exp
-#endif
-#ifndef F_MAX_EXP
-#define F_MAX_EXP f_max_exp
-#endif
-#ifndef F_MAX
-#define F_MAX f_max
-#endif
-#ifndef F_MAX_10_EXP
-#define F_MAX_10_EXP f_max_10_exp
-#endif
-
-#ifndef VERIFY
-#define Validate(prec, val, req, same) {;}
-#endif
-
-#ifdef Integer
-
-Procedure IPROP() {
- /* the properties of short, int, and long */
- Volatile Integer newi, int_max, maxeri, int_min, minneri;
- Volatile int ibits, ipower, two=2;
-
- /* Calculate max short/int/long ***********************************/
- /* Calculate 2**n-1 until overflow - then use the previous value */
-
- newi=1; int_max=0;
-
- if (setjmp(lab)==0) { /* Yields int_max */
- for(ipower=0; newi>int_max; ipower++) {
- int_max=newi;
- newi=newi*two+1;
- }
- Vprintf("%sOverflow of a%s %s does not generate a trap%s\n",
- co, INT[0]=='i'?"n":"", INT, oc);
- } else {
- Vprintf("%sOverflow of a%s %s generates a trap%s\n",
- co, INT[0]=='i'?"n":"", INT, oc);
- }
- Unexpected(7);
-
- /* Minimum value: assume either two's or one's complement *********/
- int_min= -int_max;
- if (setjmp(lab)==0) { /* Yields int_min */
- if (int_min-1 < int_min) int_min--;
- }
- Unexpected(8);
-
- /* Now for those daft Cybers */
-
- maxeri=0; newi=int_max;
-
- if (setjmp(lab)==0) { /* Yields maxeri */
- for(ibits=ipower; newi>maxeri; ibits++) {
- maxeri=newi;
- newi=newi+newi+1;
- }
- }
- Unexpected(9);
-
- minneri= -maxeri;
- if (setjmp(lab)==0) { /* Yields minneri */
- if (minneri-1 < minneri) minneri--;
- }
- Unexpected(10);
-
- Vprintf("%sMaximum %s = %ld (= 2**%d-1)%s\n",
- co, INT, (long)int_max, ipower, oc);
- Vprintf("%sMinimum %s = %ld%s\n", co, INT, (long)int_min, oc);
-
- if (L) i_define(D_INT_MAX, INT, Iname, "_MAX",
- (long) int_max, 0L,
- (long) I_MAX, IMARK);
- if (L) i_define(D_INT_MIN, INT, Iname, "_MIN",
- (long) int_min, (long) (PASS==1?maxint:int_max),
- (long) I_MIN, IMARK);
-
- if(int_max < 0) { /* It has happened */
- eek_a_bug("signed integral comparison faulty?");
- }
-
- if (maxeri>int_max) {
- Vprintf("%sThere is a larger %s, %ld (= 2**%d-1), %s %s%s\n",
- co, INT, (long)maxeri, ibits,
- "but only for addition, not multiplication",
- "(I smell a Cyber!)",
- oc);
- }
-
- if (minneri<int_min) {
- Vprintf("%sThere is a smaller %s, %ld, %s %s%s\n",
- co, INT, (long)minneri,
- "but only for addition, not multiplication",
- "(I smell a Cyber!)",
- oc);
- }
-}
-
-Procedure UPROP () {
- /* The properties of unsigned short/int/long */
-#ifdef OK_UI
- Volatile unsigned Integer u_max, newi, two;
- newi=1; u_max=0; two=2;
-
- if (setjmp(lab)==0) { /* Yields u_max */
- while(newi>u_max) {
- u_max=newi;
- newi=newi*two+1;
- }
- }
- Unexpected(11);
- Vprintf("%sMaximum unsigned %s = %lu%s\n",
- co, INT, (unsigned long) u_max, oc);
-
- /* Oh woe: new standard C defines value preserving promotions */
- if (L) {
- if (PASS == 1 && sizeof(short) < sizeof(int)) {
- /* Special only for short */
- i_define(D_UINT_MAX, INT, Uname, "_MAX",
- (unsigned long) u_max, 0L,
- (unsigned long) U_MAX, IMARK);
- } else {
- u_define(D_UINT_MAX, INT, Uname, "_MAX",
- (unsigned long) u_max,
- (unsigned long) U_MAX, IMARK);
- }
- }
-#endif
-}
-
-#endif /* Integer */
-
-#ifdef Number
-
-/* The following routines are intended to defeat any attempt at optimisation
- or use of extended precision, and to defeat faulty narrowing casts.
- The weird prototypes are because of widening incompatibilities.
-*/
-#ifdef STDC
-#define ARGS1(atype, a) (atype a)
-#define ARGS2(atype, a, btype, b) (atype a, btype b)
-#else
-#define ARGS1(atype, a) (a) atype a;
-#define ARGS2(atype, a, btype, b) (a, b) atype a; btype b;
-#endif
-
-Procedure Store ARGS2(Number, a, Number *, b) { *b=a; }
-Number Sum ARGS2(Number, a, Number, b) {Number r; Store(a+b, &r); return (r); }
-Number Diff ARGS2(Number, a, Number, b){Number r; Store(a-b, &r); return (r); }
-Number Mul ARGS2(Number, a, Number, b) {Number r; Store(a*b, &r); return (r); }
-Number Div ARGS2(Number, a, Number, b) {Number r; Store(a/b, &r); return (r); }
-Number Self ARGS1(Number, a) {Number r; Store(a, &r); return (r); }
-
-Procedure F_check ARGS((int precision, Long_double val1));
-
-Procedure F_check(precision, val1) int precision; Long_double val1; {
- /* You don't think I'm going to go to all the trouble of writing
- a program that works out what all sorts of values are, only to
- have printf go and print the wrong values out, do you?
- No, you're right, so this function tries to see if printf
- has written the right value, by reading it back again.
- This introduces a new problem of course: suppose printf writes
- the correct value, and scanf reads it back wrong... oh well.
- But I'm adamant about this: the precision given is enough
- to uniquely identify the printed number, therefore I insist
- that sscanf read the number back identically. Harsh yes, but
- sometimes you've got to be cruel to be kind.
- */
- Number val, new, diff;
- double rem;
- int e;
- char *rep;
- char *f2;
-
-#ifdef NO_LONG_DOUBLE_IO
- double new1;
- /* On the Sun 3, sscanf clobbers 4 words,
- which leads to a crash when this function tries to return. */
- f2= "%le"; /* Input */
- /* It is no use checking long doubles if we can't
- read and write them. */
- if (sizeof (Number) > sizeof(double))
- return;
-#else
- Long_double new1;
- if (sizeof(double) == sizeof(Long_double)) {
- /* Assume they're the same, and use non-stdc format */
- /* This is for stdc compilers using non-stdc libraries */
- f2= "%le"; /* Input */
- } else {
- /* It had better support Le then */
- f2= "%Le";
- }
-#endif
- val= val1;
- rep= f_rep(precision, (Long_double) val);
- if (setjmp(lab)==0) {
- sscanf(rep, f2, &new1);
- } else {
- eek_a_bug("sscanf caused a trap");
- printf("%s scanning: %s format: %s%s\n\n", co, rep, f2, oc);
- Unexpected(12);
- return;
- }
-
- if (setjmp(lab)==0) { /* See if new is usable */
- new= new1;
- if (new != 0.0) {
- diff= val/new - 1.0;
- if (diff < 0.1) diff= 1.0;
- /* That should be enough to generate a trap */
- }
- } else {
- eek_a_bug("sscanf returned an unusable number");
- printf("%s scanning: %s with format: %s%s\n\n",
- co, rep, f2, oc);
- Unexpected(13);
- return;
- }
-
- Unexpected(14);
- if (new != val) {
- eek_a_bug("Possibly bad output from printf above");
- if (!exponent((Long_double)val, &rem, &e)) {
- printf("%s but value was an unusable number%s\n\n",
- co, oc);
- return;
- }
- printf("%s expected value around %.*fe%d, bit pattern:\n ",
- co, precision, rem, e);
- bitpattern((char *) &val, (unsigned)sizeof(val));
- printf ("%s\n", oc);
- printf("%s sscanf gave %s, bit pattern:\n ",
- co, f_rep(precision, (Long_double) new));
- bitpattern((char *) &new, (unsigned)sizeof(new));
- printf ("%s\n", oc);
- if (setjmp(lab) == 0) {
- diff= val-new;
- printf("%s difference= %s%s\n\n",
- co, f_rep(precision, (Long_double) diff), oc);
- } /* else forget it */
- Unexpected(15);
- }
-}
-
-#ifdef VERIFY
-Procedure Validate(prec, val, req, same) int prec, same; Long_double val, req; {
- /* Check that the compiler has read a #define value correctly */
- Unexpected(16);
- if (!same) {
- printf("%s*** Verify failed for above #define!\n", co);
- if (setjmp(lab) == 0) { /* for the case that req == nan */
- printf(" Compiler has %s for value%s\n",
- f_rep(prec, req), oc);
- } else {
- printf(" Compiler has %s for value%s\n",
- "an unusable number", oc);
- }
- if (setjmp(lab) == 0) {
- F_check(prec, (Long_double) req);
- } /*else forget it*/
- if (setjmp(lab) == 0) {
- if (req > 0.0 && val > 0.0) {
- printf("%s difference= %s%s\n",
- co, f_rep(prec, val-req), oc);
- }
- } /*else forget it*/
- Unexpected(17);
- printf("\n");
- bugs++;
- } else if (val != req) {
- if (stdc) eek_a_bug("constant has the wrong precision");
- else eek_a_bug("the cast didn't work");
- printf("\n");
- }
-}
-#endif /* VERIFY */
-
-int FPROP(bits_per_byte) int bits_per_byte; {
- /* Properties of floating types, using algorithms by Cody and Waite
- from MA Malcolm, as modified by WM Gentleman and SB Marovich.
- Further extended by S Pemberton.
-
- Returns the number of digits in the fraction.
- */
-
- Volatile int
- i, f_radix, iexp, irnd, mrnd, f_rounds, f_mant_dig,
- iz, k, inf, machep, f_max_exp, f_min_exp, mx, negeps,
- mantbits, digs, f_dig, trap,
- hidden, normal, f_min_10_exp, f_max_10_exp;
- Volatile Number
- a, b, base, basein, basem1, f_epsilon, epsneg,
- eps, epsp1, etop, ebot,
- f_max, newxmax, f_min, xminner, y, y1, z, z1, z2;
-
- Unexpected(18);
-
- Vprintf("%sPROPERTIES OF %s%s\n", co, THING, oc);
-
- /* Base and size of significand **************************************/
- /* First repeatedly double until adding 1 has no effect. */
- /* For instance, if base is 10, with 3 significant digits */
- /* it will try 1, 2, 4, 8, ... 512, 1024, and stop there, */
- /* since 1024 is only representable as 1020. */
- a=1.0;
- if (setjmp(lab)==0) { /* inexact trap? */
- do { a=Sum(a, a); }
- while (Diff(Diff(Sum(a, ONE), a), ONE) == ZERO);
- } else {
- fprintf(stderr, "*** Program got loss-of-precision trap!\n");
- /* And supporting those is just TOO much trouble! */
- farewell(bugs+1);
- }
- Unexpected(19);
- /* Now double until you find a number that can be added to the */
- /* above number. For 1020 this is 8 or 16, depending whether the */
- /* result is rounded or truncated. */
- /* In either case the result is 1030. 1030-1020= the base, 10. */
- b=1.0;
- do { b=Sum(b, b); } while ((base=Diff(Sum(a, b), a)) == ZERO);
- f_radix=base;
- Vprintf("%sBase = %d%s\n", co, f_radix, oc);
-
- /* Sanity check; if base<2, I can't guarantee the rest will work */
- if (f_radix < 2) {
- eek_a_bug("Function return or parameter passing faulty? (This is a guess.)");
- printf("\n");
- return(0);
- }
-
- if (PASS == 1) { /* only for FLT */
- flt_radix= f_radix;
- if (F) i_define(D_FLT_RADIX, "", "FLT", "_RADIX",
- (long) f_radix, 0L, (long) F_RADIX, "");
- } else if (f_radix != flt_radix) {
- printf("\n%s*** WARNING: %s %s (%d) %s%s\n",
- co, thing, "arithmetic has a different radix",
- f_radix, "from float", oc);
- bugs++;
- }
-
- /* Now the number of digits precision */
- f_mant_dig=0; b=1.0;
- do { f_mant_dig++; b=Mul(b, base); }
- while (Diff(Diff(Sum(b, ONE), b), ONE) == ZERO);
- f_dig=floor_log(10, (Long_double)(b/base)) + (base==10?1:0);
- Vprintf("%sSignificant base digits = %d %s %d %s%s\n",
- co, f_mant_dig, "(= at least", f_dig, "decimal digits)", oc);
- if (F) i_define(D_MANT_DIG, thing, Fname, "_MANT_DIG",
- (long) f_mant_dig, 0L, (long) F_MANT_DIG, "");
- if (F) i_define(D_DIG, thing, Fname, "_DIG",
- (long) f_dig, 0L, (long) F_DIG, "");
- digs= ceil_log(10, (Long_double)b); /* the number of digits to printf */
-
- /* Rounding *******************************************************/
- basem1=Diff(base, HALF);
- if (Diff(Sum(a, basem1), a) != ZERO) {
- if (f_radix == 2) basem1=0.375;
- else basem1=1.0;
- if (Diff(Sum(a, basem1), a) != ZERO) irnd=2; /* away from 0 */
- else irnd=1; /* to nearest */
- } else irnd=0; /* towards 0 */
-
- basem1=Diff(base, HALF);
-
- if (Diff(Diff(-a, basem1), -a) != ZERO) {
- if (f_radix == 2) basem1=0.375;
- else basem1=1.0;
- if (Diff(Diff(-a, basem1), -a) != ZERO) mrnd=2; /* away from 0*/
- else mrnd=1; /* to nearest */
- } else mrnd=0; /* towards 0 */
-
- f_rounds= -1; /* Unknown rounding */
- if (irnd==0 && mrnd==0) f_rounds=0; /* zero = chops */
- if (irnd==1 && mrnd==1) f_rounds=1; /* nearest */
- if (irnd==2 && mrnd==0) f_rounds=2; /* +inf */
- if (irnd==0 && mrnd==2) f_rounds=3; /* -inf */
-
- if (f_rounds != -1) {
- Vprintf("%sArithmetic rounds towards ", co);
- switch (f_rounds) {
- case 0: Vprintf("zero (i.e. it chops)"); break;
- case 1: Vprintf("nearest"); break;
- case 2: Vprintf("+infinity"); break;
- case 3: Vprintf("-infinity"); break;
- default: Vprintf("???"); break;
- }
- Vprintf("%s\n", oc);
- } else { /* Hmm, try to give some help here */
- Vprintf("%sArithmetic rounds oddly: %s\n", co, oc);
- Vprintf("%s Negative numbers %s%s\n",
- co, mrnd==0 ? "towards zero" :
- mrnd==1 ? "to nearest" :
- "away from zero",
- oc);
- Vprintf("%s Positive numbers %s%s\n",
- co, irnd==0 ? "towards zero" :
- irnd==1 ? "to nearest" :
- "away from zero",
- oc);
- }
- /* An extra goody */
- if (f_radix == 2 && f_rounds == 1) {
- if (Diff(Sum(a, ONE), a) != ZERO) {
- Vprintf("%s Tie breaking rounds up%s\n", co, oc);
- } else if (Diff(Sum(a, THREE), a) == FOUR) {
- Vprintf("%s Tie breaking rounds to even%s\n", co, oc);
- } else {
- Vprintf("%s Tie breaking rounds down%s\n", co, oc);
- }
- }
- if (PASS == 1) { /* only for FLT */
- flt_rounds= f_rounds;
- if (F)
- i_define(D_FLT_ROUNDS, "", "FLT", "_ROUNDS",
- (long) f_rounds, 1L, (long) F_ROUNDS, "");
- } else if (f_rounds != flt_rounds) {
- printf("\n%s*** WARNING: %s %s (%d) %s%s\n",
- co, thing, "arithmetic rounds differently",
- f_rounds, "from float", oc);
- bugs++;
- }
-
- /* Various flavours of epsilon ************************************/
- negeps=f_mant_dig+f_mant_dig;
- basein=1.0/base;
- a=1.0;
- for(i=1; i<=negeps; i++) a*=basein;
-
- b=a;
- while (Diff(Diff(ONE, a), ONE) == ZERO) {
- a*=base;
- negeps--;
- }
- negeps= -negeps;
- Vprintf("%sSmallest x such that 1.0-base**x != 1.0 = %d%s\n",
- co, negeps, oc);
-
- etop = ONE;
- ebot = ZERO;
- eps = Sum(ebot, Div(Diff(etop, ebot), TWO));
- /* find the smallest epsneg (1-epsneg != 1) by binary search.
- ebot and etop are the current bounds */
- while (eps != ebot && eps != etop) {
- epsp1 = Diff(ONE, eps);
- if (epsp1 < ONE) etop = eps;
- else ebot = eps;
- eps = Sum(ebot, Div(Diff(etop, ebot), TWO));
- }
- eps= etop;
- /* Sanity check */
- if (Diff(ONE, etop) >= ONE || Diff(ONE, ebot) != ONE) {
- eek_a_bug("internal error calculating epsneg");
- }
- Vprintf("%sSmallest x such that 1.0-x != 1.0 = %s%s\n",
- co, f_rep(digs, (Long_double) eps), oc);
- if (V) F_check(digs, (Long_double) eps);
-
- epsneg=a;
- if ((f_radix!=2) && irnd) {
- /* a=(a*(1.0+a))/(1.0+1.0); => */
- a=Div(Mul(a, Sum(ONE, a)), Sum(ONE, ONE));
- /* if ((1.0-a)-1.0 != 0.0) epsneg=a; => */
- if (Diff(Diff(ONE, a), ONE) != ZERO) epsneg=a;
- }
- /* epsneg is used later */
- Unexpected(20);
-
- machep= -f_mant_dig-f_mant_dig;
- a=b;
- while (Diff(Sum(ONE, a), ONE) == ZERO) { a*=base; machep++; }
- Vprintf("%sSmallest x such that 1.0+base**x != 1.0 = %d%s\n",
- co, machep, oc);
-
- etop = ONE;
- ebot = ZERO;
- eps = Sum(ebot, Div(Diff(etop, ebot), TWO));
- /* find the smallest eps (1+eps != 1) by binary search.
- ebot and etop are the current bounds */
- while (eps != ebot && eps != etop) {
- epsp1 = Sum(ONE, eps);
- if (epsp1 > ONE) etop = eps;
- else ebot = eps;
- eps = Sum(ebot, Div(Diff(etop, ebot), TWO));
- }
- /* Sanity check */
- if (Sum(ONE, etop) <= ONE || Sum(ONE, ebot) != ONE) {
- eek_a_bug("internal error calculating eps");
- }
- f_epsilon=etop;
-
- Vprintf("%sSmallest x such that 1.0+x != 1.0 = %s%s\n",
- co, f_rep(digs, (Long_double) f_epsilon), oc);
-
- f_epsilon= Diff(Sum(ONE, f_epsilon), ONE); /* New C standard defn */
- Vprintf("%s(Above number + 1.0) - 1.0 = %s%s\n",
- co, f_rep(digs, (Long_double) (f_epsilon)), oc);
-
- /* Possible loss of precision warnings here from non-stdc compilers */
- if (F) f_define(D_EPSILON, thing,
- Fname, "_EPSILON", digs, (Long_double) f_epsilon, MARK);
- if (V || F) F_check(digs, (Long_double) f_epsilon);
- Unexpected(21);
- if (F) Validate(digs, (Long_double) f_epsilon, (Long_double) F_EPSILON,
- f_epsilon == Self(F_EPSILON));
- Unexpected(22);
-
- /* Extra chop info *************************************************/
- if (f_rounds == 0) {
- if (Diff(Mul(Sum(ONE,f_epsilon),ONE),ONE) != ZERO) {
- Vprintf("%sAlthough arithmetic chops, it uses guard digits%s\n", co, oc);
- }
- }
-
- /* Size of and minimum normalised exponent ************************/
- y=0; i=0; k=1; z=basein; z1=(1.0+f_epsilon)/base;
-
- /* Coarse search for the largest power of two */
- if (setjmp(lab)==0) { /* for underflow trap */ /* Yields i, k, y, y1 */
- do {
- y=z; y1=z1;
- z=Mul(y,y); z1=Mul(z1, y);
- a=Mul(z,ONE);
- z2=Div(z1,y);
- if (z2 != y1) break;
- if ((Sum(a,a) == ZERO) || (fabs(z) >= y)) break;
- i++;
- k+=k;
- } while(1);
- } else {
- Vprintf("%s%s underflow generates a trap%s\n", co, Thing, oc);
- }
- Unexpected(23);
-
- if (f_radix != 10) {
- iexp=i+1; /* for the sign */
- mx=k+k;
- } else {
- iexp=2;
- iz=f_radix;
- while (k >= iz) { iz*=f_radix; iexp++; }
- mx=iz+iz-1;
- }
-
- /* Fine tune starting with y and y1 */
- if (setjmp(lab)==0) { /* for underflow trap */ /* Yields k, f_min */
- do {
- f_min=y; z1=y1;
- y=Div(y,base); y1=Div(y1,base);
- a=Mul(y,ONE);
- z2=Mul(y1,base);
- if (z2 != z1) break;
- if ((Sum(a,a) == ZERO) || (fabs(y) >= f_min)) break;
- k++;
- } while (1);
- }
- Unexpected(24);
-
- f_min_exp=(-k)+1;
-
- if ((mx <= k+k-3) && (f_radix != 10)) { mx+=mx; iexp+=1; }
- Vprintf("%sNumber of bits used for exponent = %d%s\n", co, iexp, oc);
- Vprintf("%sMinimum normalised exponent = %d%s\n", co, f_min_exp-1, oc);
- if (F)
- i_define(D_MIN_EXP, thing, Fname, "_MIN_EXP",
- (long) f_min_exp, (long) maxint, (long) F_MIN_EXP, "");
-
- if (setjmp(lab)==0) {
- Vprintf("%sMinimum normalised positive number = %s%s\n",
- co, f_rep(digs, (Long_double) f_min), oc);
- } else {
- eek_a_bug("printf can't print the smallest normalised number");
- printf("\n");
- }
- Unexpected(25);
- /* Possible loss of precision warnings here from non-stdc compilers */
- if (setjmp(lab) == 0) {
- if (F) f_define(D_MIN, thing,
- Fname, "_MIN", digs, (Long_double) f_min, MARK);
- if (V || F) F_check(digs, (Long_double) f_min);
- } else {
- eek_a_bug("xxx_MIN caused a trap");
- printf("\n");
- }
-
- if (setjmp(lab) == 0) {
- if (F) Validate(digs, (Long_double) f_min, (Long_double) F_MIN,
- f_min == Self(F_MIN));
- } else {
- printf("%s*** Verify failed for above #define!\n %s %s\n\n",
- co, "Compiler has an unusable number for value", oc);
- bugs++;
- }
- Unexpected(26);
-
- a=1.0; f_min_10_exp=0;
- while (a > f_min*10.0) { a/=10.0; f_min_10_exp--; }
- if (F) i_define(D_MIN_10_EXP, thing, Fname, "_MIN_10_EXP",
- (long) f_min_10_exp, (long) maxint,
- (long) F_MIN_10_EXP, "");
-
- /* Minimum exponent ************************************************/
- if (setjmp(lab)==0) { /* for underflow trap */ /* Yields xminner */
- do {
- xminner=y;
- y=Div(y,base);
- a=Mul(y,ONE);
- if ((Sum(a,a) == ZERO) || (fabs(y) >= xminner)) break;
- } while (1);
- }
- Unexpected(27);
-
- if (xminner != 0.0 && xminner != f_min) {
- normal= 0;
- Vprintf("%sThe smallest numbers are not kept normalised%s\n",
- co, oc);
- if (setjmp(lab)==0) {
- Vprintf("%sSmallest unnormalised positive number = %s%s\n",
- co, f_rep(digs, (Long_double) xminner), oc);
- if (V) F_check(digs, (Long_double) xminner);
- } else {
- eek_a_bug("printf can't print the smallest unnormalised number.");
- printf("\n");
- }
- Unexpected(28);
- } else {
- normal= 1;
- Vprintf("%sThe smallest numbers are normalised%s\n", co, oc);
- }
-
- /* Maximum exponent ************************************************/
- f_max_exp=2; f_max=1.0; newxmax=base+1.0;
- inf=0; trap=0;
- while (f_max<newxmax) {
- f_max=newxmax;
- if (setjmp(lab) == 0) { /* Yields inf, f_max_exp */
- newxmax=Mul(newxmax, base);
- } else {
- trap=1;
- break;
- }
- if (Div(newxmax, base) != f_max) {
- inf=1; /* ieee infinity */
- break;
- }
- f_max_exp++;
- }
- Unexpected(29);
- if (trap) {
- Vprintf("%s%s overflow generates a trap%s\n", co, Thing, oc);
- }
-
- if (inf) Vprintf("%sThere is an 'infinite' value%s\n", co, oc);
- Vprintf("%sMaximum exponent = %d%s\n", co, f_max_exp, oc);
- if (F) i_define(D_MAX_EXP, thing, Fname, "_MAX_EXP",
- (long) f_max_exp, 0L, (long) F_MAX_EXP, "");
-
- /* Largest number ***************************************************/
- f_max=Diff(ONE, epsneg);
- if (Mul(f_max,ONE) != f_max) f_max=Diff(ONE, Mul(base,epsneg));
- for (i=1; i<=f_max_exp; i++) f_max=Mul(f_max, base);
-
- if (setjmp(lab)==0) {
- Vprintf("%sMaximum number = %s%s\n",
- co, f_rep(digs, (Long_double) f_max), oc);
- } else {
- eek_a_bug("printf can't print the largest double.");
- printf("\n");
- }
- if (setjmp(lab)==0) {
- /* Possible loss of precision warnings here from non-stdc compilers */
- if (F) f_define(D_MAX, thing,
- Fname, "_MAX", digs, (Long_double) f_max, MARK);
- if (V || F) F_check(digs, (Long_double) f_max);
- } else {
- eek_a_bug("xxx_MAX caused a trap");
- printf("\n");
- }
- if (setjmp(lab)==0) {
- if (F) Validate(digs, (Long_double) f_max, (Long_double) F_MAX,
- f_max == Self(F_MAX));
- } else {
- printf("%s*** Verify failed for above #define!\n %s %s\n\n",
- co, "Compiler has an unusable number for value", oc);
- bugs++;
- }
- Unexpected(30);
-
- a=1.0; f_max_10_exp=0;
- while (a < f_max/10.0) { a*=10.0; f_max_10_exp++; }
- if (F) i_define(D_MAX_10_EXP, thing, Fname, "_MAX_10_EXP",
- (long) f_max_10_exp, 0L, (long) F_MAX_10_EXP, "");
-
- /* Hidden bit + sanity check ****************************************/
- if (f_radix != 10) {
- hidden=0;
- mantbits=floor_log(2, (Long_double)f_radix)*f_mant_dig;
- if (mantbits == 64
- && iexp == 15
- && f_max_exp+f_min_exp > 0 /* ??? f_min_exp may be wrong. */
- && mantbits+iexp+17 == (int)sizeof(Number)*bits_per_byte) {
- Vprintf("%sArithmetic probably doesn't use a hidden bit%s\n", co, oc);
- Vprintf("%sIt's probably 80387 or 68881 extended real%s\n", co, oc);
- goto is_extended;
- }
- if (mantbits+iexp == (int)sizeof(Number)*bits_per_byte) {
- hidden=1;
- Vprintf("%sArithmetic uses a hidden bit%s\n", co, oc);
- } else if (mantbits+iexp+1 == (int)sizeof(Number)*bits_per_byte) {
- Vprintf("%sArithmetic doesn't use a hidden bit%s\n",
- co, oc);
- } else {
- printf("\n%s%s\n %s %s %s!%s\n\n",
- co,
- "*** Something fishy here!",
- "Exponent size + significand size doesn't match",
- "with the size of a", thing,
- oc);
- }
- if (hidden && f_radix == 2 && f_max_exp+f_min_exp==3) {
- Vprintf("%sIt looks like %s length IEEE format%s\n",
- co, f_mant_dig==24 ? "single" :
- f_mant_dig==53 ? "double" :
- f_mant_dig >53 ? "extended" :
- "some", oc);
-is_extended:
- if (f_rounds != 1 || normal) {
- Vprintf("%s though ", co);
- if (f_rounds != 1) {
- Vprintf("the rounding is unusual");
- if (normal) Vprintf(" and ");
- }
- if (normal) Vprintf("the normalisation is unusual");
- Vprintf("%s\n", oc);
- }
- } else {
- Vprintf("%sIt doesn't look like IEEE format%s\n",
- co, oc);
- }
- }
- printf("\n"); /* regardless of verbosity */
- return f_mant_dig;
-}
-
-Procedure EPROP(fprec, dprec, lprec) int fprec, dprec, lprec; {
- /* See if expressions are evaluated in extended precision.
- Some compilers optimise even if you don't want it,
- and then this function fails to produce the right result.
- We try to diagnose this if it happens.
- */
- Volatile int eprec;
- Volatile double a, b, base, old;
- Volatile Number d, oldd, dbase, one, zero;
- Volatile int bad=0;
-
- /* Size of significand **************************************/
- a=1.0;
- if (setjmp(lab) == 0) { /* Yields nothing */
- do { old=a; a=a+a; }
- while ((((a+1.0)-a)-1.0) == 0.0 && a>old);
- } else bad=1;
-
- /* Avoid the comparison if bad is set,
- to avoid trouble on the convex. */
- if (!bad && (a <= old)) bad=1;
-
- if (!bad) {
- b=1.0;
- if (setjmp(lab) == 0) { /* Yields nothing */
- do { old=b; b=b+b; }
- while ((base=((a+b)-a)) == 0.0 && b>old);
- if (b <= old) bad=1;
- } else bad=1;
- }
-
- if (!bad) {
- eprec=0; d=1.0; dbase=base; one=1.0; zero=0.0;
- if (setjmp(lab) == 0) { /* Yields nothing */
- do { eprec++; oldd=d; d=d*dbase; }
- while ((((d+one)-d)-one) == zero && d>oldd);
- if (d <= oldd) bad=1;
- } else bad=1;
- }
-
- Unexpected(31);
-
- if (bad) {
- Vprintf("%sCan't determine precision for %s expressions:\n%s%s\n",
- co, thing, " check that you compiled without optimisation!",
- oc);
- } else if (eprec==dprec) {
- Vprintf("%s%s expressions are evaluated in double precision%s\n",
- co, Thing, oc);
- } else if (eprec==fprec) {
- Vprintf("%s%s expressions are evaluated in float precision%s\n",
- co, Thing, oc);
- } else if (eprec==lprec) {
- Vprintf("%s%s expressions are evaluated in long double precision%s\n",
- co, Thing, oc);
- } else {
- Vprintf("%s%s expressions are evaluated in a %s %s %d %s%s\n",
- co, Thing, eprec>dprec ? "higher" : "lower",
- "precision than double,\n using",
- eprec, "base digits",
- oc);
- }
-}
-
-#else /* not Number */
-
-#ifdef FPROP /* Then create dummy routines for long double */
-/* ARGSUSED */
-int FPROP(bits_per_byte) int bits_per_byte; { return 0; }
-#endif
-#ifdef EPROP
-/* ARGSUSED */
-Procedure EPROP(fprec, dprec, lprec) int fprec, dprec, lprec; {}
-#endif
-
-#endif /* ifdef Number */
-
-/* Increment the pass number */
-#undef PASS
-
-#ifdef PASS2
-#undef PASS2
-#define PASS 3
-#define PASS3 1
-#endif
-
-#ifdef PASS1
-#undef PASS1
-#define PASS 2
-#define PASS2 1
-#endif
-
-#ifdef PASS0
-#undef PASS0
-#endif
-
-#ifdef PASS /* then rescan this file */
-#ifdef NO_FILE
-#include "enquire.c"
-#else
-#include FILENAME /* if this line fails to compile, define NO_FILE */
-#endif
-#endif /* PASS */
-
diff --git a/gcc/except.c b/gcc/except.c
deleted file mode 100644
index 4d8d1bc9a29..00000000000
--- a/gcc/except.c
+++ /dev/null
@@ -1,1571 +0,0 @@
-/* Implements exception handling.
- Copyright (C) 1989, 92-95, 1996 Free Software Foundation, Inc.
- Contributed by Mike Stump <mrs@cygnus.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. */
-
-
-/* An exception is an event that can be signaled from within a
- function. This event can then be "caught" or "trapped" by the
- callers of this function. This potentially allows program flow to
- be transferred to any arbitrary code assocated with a function call
- several levels up the stack.
-
- The intended use for this mechanism is for signaling "exceptional
- events" in an out-of-band fashion, hence its name. The C++ language
- (and many other OO-styled or functional languages) practically
- requires such a mechanism, as otherwise it becomes very difficult
- or even impossible to signal failure conditions in complex
- situations. The traditional C++ example is when an error occurs in
- the process of constructing an object; without such a mechanism, it
- is impossible to signal that the error occurs without adding global
- state variables and error checks around every object construction.
-
- The act of causing this event to occur is referred to as "throwing
- an exception". (Alternate terms include "raising an exception" or
- "signaling an exception".) The term "throw" is used because control
- is returned to the callers of the function that is signaling the
- exception, and thus there is the concept of "throwing" the
- exception up the call stack.
-
- It is appropriate to speak of the "context of a throw". This
- context refers to the address where the exception is thrown from,
- and is used to determine which exception region will handle the
- exception.
-
- Regions of code within a function can be marked such that if it
- contains the context of a throw, control will be passed to a
- designated "exception handler". These areas are known as "exception
- regions". Exception regions cannot overlap, but they can be nested
- to any arbitrary depth. Also, exception regions cannot cross
- function boundaries.
-
- Exception handlers can either be specified by the user (which we
- will call a "user-defined handler") or generated by the compiler
- (which we will designate as a "cleanup"). Cleanups are used to
- perform tasks such as destruction of objects allocated on the
- stack.
-
- In the current implementaion, cleanups are handled by allocating an
- exception region for the area that the cleanup is designated for,
- and the handler for the region performs the cleanup and then
- rethrows the exception to the outer exception region. From the
- standpoint of the current implementation, there is little
- distinction made between a cleanup and a user-defined handler, and
- the phrase "exception handler" can be used to refer to either one
- equally well. (The section "Future Directions" below discusses how
- this will change).
-
- Each object file that is compiled with exception handling contains
- a static array of exception handlers named __EXCEPTION_TABLE__.
- Each entry contains the starting and ending addresses of the
- exception region, and the address of the handler designated for
- that region.
-
- At program startup each object file invokes a function named
- __register_exceptions with the address of its local
- __EXCEPTION_TABLE__. __register_exceptions is defined in libgcc2.c,
- and is responsible for recording all of the exception regions into
- one list (which is kept in a static variable named exception_table_list).
-
- The function __throw () is actually responsible for doing the
- throw. In the C++ frontend, __throw () is generated on a
- per-object-file basis for each source file compiled with
- -fexceptions. Before __throw () is invoked, the current context
- of the throw needs to be placed in the global variable __eh_pc.
-
- __throw () attempts to find the appropriate exception handler for the
- PC value stored in __eh_pc by calling __find_first_exception_table_match
- (which is defined in libgcc2.c). If __find_first_exception_table_match
- finds a relevant handler, __throw jumps directly to it.
-
- If a handler for the context being thrown from can't be found,
- __throw is responsible for unwinding the stack, determining the
- address of the caller of the current function (which will be used
- as the new context to throw from), and then restarting the process
- of searching for a handler for the new context. __throw may also
- call abort () if it is unable to unwind the stack, and can also
- call an external library function named __terminate if it reaches
- the top of the stack without finding an appropriate handler. (By
- default __terminate () invokes abort (), but this behavior can be
- changed by the user to perform some sort of cleanup behavior before
- exiting).
-
- Internal implementation details:
-
- To associate a user-defined handler with a block of statements, the
- function expand_start_try_stmts () is used to mark the start of the
- block of statements with which the handler is to be associated
- (which is known as a "try block"). All statements that appear
- afterwards will be associated with the try block.
-
- A call to expand_start_all_catch () marks the end of the try block,
- and also marks the start of the "catch block" (the user-defined
- handler) associated with the try block.
-
- This user-defined handler will be invoked for *every* exception
- thrown with the context of the try block. It is up to the handler
- to decide whether or not it wishes to handle any given exception,
- as there is currently no mechanism in this implementation for doing
- this. (There are plans for conditionally processing an exception
- based on its "type", which will provide a language-independent
- mechanism).
-
- If the handler chooses not to process the exception (perhaps by
- looking at an "exception type" or some other additional data
- supplied with the exception), it can fall through to the end of the
- handler. expand_end_all_catch () and expand_leftover_cleanups ()
- add additional code to the end of each handler to take care of
- rethrowing to the outer exception handler.
-
- The handler also has the option to continue with "normal flow of
- code", or in other words to resume executing at the statement
- immediately after the end of the exception region. The variable
- caught_return_label_stack contains a stack of labels, and jumping
- to the topmost entry's label via expand_goto () will resume normal
- flow to the statement immediately after the end of the exception
- region. If the handler falls through to the end, the exception will
- be rethrown to the outer exception region.
-
- The instructions for the catch block are kept as a separate
- sequence, and will be emitted at the end of the function along with
- the handlers specified via expand_eh_region_end (). The end of the
- catch block is marked with expand_end_all_catch ().
-
- Any data associated with the exception must currently be handled by
- some external mechanism maintained in the frontend. For example,
- the C++ exception mechanism passes an arbitrary value along with
- the exception, and this is handled in the C++ frontend by using a
- global variable to hold the value. (This will be changing in the
- future.)
-
- The mechanism in C++ for handling data associated with the
- exception is clearly not thread-safe. For a thread-based
- environment, another mechanism must be used (possibly using a
- per-thread allocation mechanism if the size of the area that needs
- to be allocated isn't known at compile time.)
-
- Internally-generated exception regions (cleanups) are marked by
- calling expand_eh_region_start () to mark the start of the region,
- and expand_eh_region_end (handler) is used to both designate the
- end of the region and to associate a specified handler/cleanup with
- the region. The rtl code in HANDLER will be invoked whenever an
- exception occurs in the region between the calls to
- expand_eh_region_start and expand_eh_region_end. After HANDLER is
- executed, additional code is emitted to handle rethrowing the
- exception to the outer exception handler. The code for HANDLER will
- be emitted at the end of the function.
-
- TARGET_EXPRs can also be used to designate exception regions. A
- TARGET_EXPR gives an unwind-protect style interface commonly used
- in functional languages such as LISP. The associated expression is
- evaluated, and whether or not it (or any of the functions that it
- calls) throws an exception, the protect expression is always
- invoked. This implementation takes care of the details of
- associating an exception table entry with the expression and
- generating the necessary code (it actually emits the protect
- expression twice, once for normal flow and once for the exception
- case). As for the other handlers, the code for the exception case
- will be emitted at the end of the function.
-
- Cleanups can also be specified by using add_partial_entry (handler)
- and end_protect_partials (). add_partial_entry creates the start of
- a new exception region; HANDLER will be invoked if an exception is
- thrown with the context of the region between the calls to
- add_partial_entry and end_protect_partials. end_protect_partials is
- used to mark the end of these regions. add_partial_entry can be
- called as many times as needed before calling end_protect_partials.
- However, end_protect_partials should only be invoked once for each
- group of calls to add_partial_entry () as the entries are queued
- and all of the outstanding entries are processed simultaneously
- when end_protect_partials is invoked. Similarly to the other
- handlers, the code for HANDLER will be emitted at the end of the
- function.
-
- The generated RTL for an exception region includes
- NOTE_INSN_EH_REGION_BEG and NOTE_INSN_EH_REGION_END notes that mark
- the start and end of the exception region. A unique label is also
- generated at the start of the exception region, which is available
- by looking at the ehstack variable. The topmost entry corresponds
- to the current region.
-
- In the current implementation, an exception can only be thrown from
- a function call (since the mechanism used to actually throw an
- exception involves calling __throw). If an exception region is
- created but no function calls occur within that region, the region
- can be safely optimized away (along with its exception handlers)
- since no exceptions can ever be caught in that region.
-
- Unwinding the stack:
-
- The details of unwinding the stack to the next frame can be rather
- complex. While in many cases a generic __unwind_function () routine
- can be used by the generated exception handling code to do this, it
- is often necessary to generate inline code to do the unwinding.
-
- Whether or not these inlined unwinders are necessary is
- target-specific.
-
- By default, if the target-specific backend doesn't supply a
- definition for __unwind_function (), inlined unwinders will be used
- instead. The main tradeoff here is in text space utilization.
- Obviously, if inline unwinders have to be generated repeatedly,
- this uses much more space than if a single routine is used.
-
- However, it is simply not possible on some platforms to write a
- generalized routine for doing stack unwinding without having some
- form of additional data associated with each function. The current
- implementation encodes this data in the form of additional machine
- instructions. This is clearly not desirable, as it is extremely
- inefficient. The next implementation will provide a set of metadata
- for each function that will provide the needed information.
-
- The backend macro DOESNT_NEED_UNWINDER is used to conditionalize
- whether or not per-function unwinders are needed. If DOESNT_NEED_UNWINDER
- is defined and has a non-zero value, a per-function unwinder is
- not emitted for the current function.
-
- On some platforms it is possible that neither __unwind_function ()
- nor inlined unwinders are available. For these platforms it is not
- possible to throw through a function call, and abort () will be
- invoked instead of performing the throw.
-
- Future directions:
-
- Currently __throw () makes no differentiation between cleanups and
- user-defined exception regions. While this makes the implementation
- simple, it also implies that it is impossible to determine if a
- user-defined exception handler exists for a given exception without
- completely unwinding the stack in the process. This is undesirable
- from the standpoint of debugging, as ideally it would be possible
- to trap unhandled exceptions in the debugger before the process of
- unwinding has even started.
-
- This problem can be solved by marking user-defined handlers in a
- special way (probably by adding additional bits to exception_table_list).
- A two-pass scheme could then be used by __throw () to iterate
- through the table. The first pass would search for a relevant
- user-defined handler for the current context of the throw, and if
- one is found, the second pass would then invoke all needed cleanups
- before jumping to the user-defined handler.
-
- Many languages (including C++ and Ada) make execution of a
- user-defined handler conditional on the "type" of the exception
- thrown. (The type of the exception is actually the type of the data
- that is thrown with the exception.) It will thus be necessary for
- __throw () to be able to determine if a given user-defined
- exception handler will actually be executed, given the type of
- exception.
-
- One scheme is to add additional information to exception_table_list
- as to the types of exceptions accepted by each handler. __throw ()
- can do the type comparisons and then determine if the handler is
- actually going to be executed.
-
- There is currently no significant level of debugging support
- available, other than to place a breakpoint on __throw (). While
- this is sufficient in most cases, it would be helpful to be able to
- know where a given exception was going to be thrown to before it is
- actually thrown, and to be able to choose between stopping before
- every exception region (including cleanups), or just user-defined
- exception regions. This should be possible to do in the two-pass
- scheme by adding additional labels to __throw () for appropriate
- breakpoints, and additional debugger commands could be added to
- query various state variables to determine what actions are to be
- performed next.
-
- Another major problem that is being worked on is the issue with
- stack unwinding on various platforms. Currently the only platform
- that has support for __unwind_function () is the Sparc; all other
- ports require per-function unwinders, which causes large amounts of
- code bloat.
-
- Ideally it would be possible to store a small set of metadata with
- each function that would then make it possible to write a
- __unwind_function () for every platform. This would eliminate the
- need for per-function unwinders.
-
- The main reason the data is needed is that on some platforms the
- order and types of data stored on the stack can vary depending on
- the type of function, its arguments and returned values, and the
- compilation options used (optimization versus non-optimization,
- -fomit-frame-pointer, processor variations, etc).
-
- Unfortunately, this also means that throwing through functions that
- aren't compiled with exception handling support will still not be
- possible on some platforms. This problem is currently being
- investigated, but no solutions have been found that do not imply
- some unacceptable performance penalties. */
-
-
-#include "config.h"
-#include <stdio.h>
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "except.h"
-#include "function.h"
-#include "insn-flags.h"
-#include "expr.h"
-#include "insn-codes.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "insn-config.h"
-#include "recog.h"
-#include "output.h"
-#include "assert.h"
-
-/* A list of labels used for exception handlers. Created by
- find_exception_handler_labels for the optimization passes. */
-
-rtx exception_handler_labels;
-
-/* Nonzero means that __throw was invoked.
-
- This is used by the C++ frontend to know if code needs to be emitted
- for __throw or not. */
-
-int throw_used;
-
-/* A stack used for keeping track of the currectly active exception
- handling region. As each exception region is started, an entry
- describing the region is pushed onto this stack. The current
- region can be found by looking at the top of the stack, and as we
- exit regions, the corresponding entries are popped.
-
- Entries cannot overlap; they must be nested. So there is only one
- entry at most that corresponds to the current instruction, and that
- is the entry on the top of the stack. */
-
-struct eh_stack ehstack;
-
-/* A queue used for tracking which exception regions have closed but
- whose handlers have not yet been expanded. Regions are emitted in
- groups in an attempt to improve paging performance.
-
- As we exit a region, we enqueue a new entry. The entries are then
- dequeued during expand_leftover_cleanups () and expand_start_all_catch (),
-
- We should redo things so that we either take RTL for the handler,
- or we expand the handler expressed as a tree immediately at region
- end time. */
-
-struct eh_queue ehqueue;
-
-/* Insns for all of the exception handlers for the current function.
- They are currently emitted by the frontend code. */
-
-rtx catch_clauses;
-
-/* A TREE_CHAINed list of handlers for regions that are not yet
- closed. The TREE_VALUE of each entry contains the handler for the
- corresponding entry on the ehstack. */
-
-static tree protect_list;
-
-/* Stacks to keep track of various labels. */
-
-/* Keeps track of the label to resume to should one want to resume
- normal control flow out of a handler (instead of, say, returning to
- the caller of the current function or exiting the program). Also
- used as the context of a throw to rethrow an exception to the outer
- exception region. */
-
-struct label_node *caught_return_label_stack = NULL;
-
-/* A random data area for the front end's own use. */
-
-struct label_node *false_label_stack = NULL;
-
-/* The rtx and the tree for the saved PC value. */
-
-rtx eh_saved_pc_rtx;
-tree eh_saved_pc;
-
-rtx expand_builtin_return_addr PROTO((enum built_in_function, int, rtx));
-
-/* Various support routines to manipulate the various data structures
- used by the exception handling code. */
-
-/* Push a label entry onto the given STACK. */
-
-void
-push_label_entry (stack, rlabel, tlabel)
- struct label_node **stack;
- rtx rlabel;
- tree tlabel;
-{
- struct label_node *newnode
- = (struct label_node *) xmalloc (sizeof (struct label_node));
-
- if (rlabel)
- newnode->u.rlabel = rlabel;
- else
- newnode->u.tlabel = tlabel;
- newnode->chain = *stack;
- *stack = newnode;
-}
-
-/* Pop a label entry from the given STACK. */
-
-rtx
-pop_label_entry (stack)
- struct label_node **stack;
-{
- rtx label;
- struct label_node *tempnode;
-
- if (! *stack)
- return NULL_RTX;
-
- tempnode = *stack;
- label = tempnode->u.rlabel;
- *stack = (*stack)->chain;
- free (tempnode);
-
- return label;
-}
-
-/* Return the top element of the given STACK. */
-
-tree
-top_label_entry (stack)
- struct label_node **stack;
-{
- if (! *stack)
- return NULL_TREE;
-
- return (*stack)->u.tlabel;
-}
-
-/* Make a copy of ENTRY using xmalloc to allocate the space. */
-
-static struct eh_entry *
-copy_eh_entry (entry)
- struct eh_entry *entry;
-{
- struct eh_entry *newentry;
-
- newentry = (struct eh_entry *) xmalloc (sizeof (struct eh_entry));
- bcopy ((char *) entry, (char *) newentry, sizeof (struct eh_entry));
-
- return newentry;
-}
-
-/* Push a new eh_node entry onto STACK, and return the start label for
- the entry. */
-
-static rtx
-push_eh_entry (stack)
- struct eh_stack *stack;
-{
- struct eh_node *node = (struct eh_node *) xmalloc (sizeof (struct eh_node));
- struct eh_entry *entry = (struct eh_entry *) xmalloc (sizeof (struct eh_entry));
-
- entry->start_label = gen_label_rtx ();
- entry->end_label = gen_label_rtx ();
- entry->exception_handler_label = gen_label_rtx ();
- entry->finalization = NULL_TREE;
-
- node->entry = entry;
- node->chain = stack->top;
- stack->top = node;
-
- return entry->start_label;
-}
-
-/* Pop an entry from the given STACK. */
-
-static struct eh_entry *
-pop_eh_entry (stack)
- struct eh_stack *stack;
-{
- struct eh_node *tempnode;
- struct eh_entry *tempentry;
-
- tempnode = stack->top;
- tempentry = tempnode->entry;
- stack->top = stack->top->chain;
- free (tempnode);
-
- return tempentry;
-}
-
-/* Enqueue an ENTRY onto the given QUEUE. */
-
-static void
-enqueue_eh_entry (queue, entry)
- struct eh_queue *queue;
- struct eh_entry *entry;
-{
- struct eh_node *node = (struct eh_node *) xmalloc (sizeof (struct eh_node));
-
- node->entry = entry;
- node->chain = NULL;
-
- if (queue->head == NULL)
- {
- queue->head = node;
- }
- else
- {
- queue->tail->chain = node;
- }
- queue->tail = node;
-}
-
-/* Dequeue an entry from the given QUEUE. */
-
-static struct eh_entry *
-dequeue_eh_entry (queue)
- struct eh_queue *queue;
-{
- struct eh_node *tempnode;
- struct eh_entry *tempentry;
-
- if (queue->head == NULL)
- return NULL;
-
- tempnode = queue->head;
- queue->head = queue->head->chain;
-
- tempentry = tempnode->entry;
- free (tempnode);
-
- return tempentry;
-}
-
-/* Routine to see if exception exception handling is turned on.
- DO_WARN is non-zero if we want to inform the user that exception
- handling is turned off.
-
- This is used to ensure that -fexceptions has been specified if the
- compiler tries to use any exception-specific functions. */
-
-int
-doing_eh (do_warn)
- int do_warn;
-{
- if (! flag_exceptions)
- {
- static int warned = 0;
- if (! warned && do_warn)
- {
- error ("exception handling disabled, use -fexceptions to enable");
- warned = 1;
- }
- return 0;
- }
- return 1;
-}
-
-/* Given a return address in ADDR, determine the address we should use
- to find the corresponding EH region. */
-
-rtx
-eh_outer_context (addr)
- rtx addr;
-{
- /* First mask out any unwanted bits. */
-#ifdef MASK_RETURN_ADDR
- emit_insn (gen_rtx (SET, Pmode,
- addr,
- gen_rtx (AND, Pmode,
- addr, MASK_RETURN_ADDR)));
-#endif
-
- /* Then subtract out enough to get into the appropriate region. If
- this is defined, assume we don't need to subtract anything as it
- is already within the correct region. */
-#if ! defined (RETURN_ADDR_OFFSET)
- addr = plus_constant (addr, -1);
-#endif
-
- return addr;
-}
-
-/* Start a new exception region and push the HANDLER for the region
- onto protect_list. All of the regions created with add_partial_entry
- will be ended when end_protect_partials () is invoked. */
-
-void
-add_partial_entry (handler)
- tree handler;
-{
- expand_eh_region_start ();
-
- /* Make sure the entry is on the correct obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
- protect_list = tree_cons (NULL_TREE, handler, protect_list);
- pop_obstacks ();
-}
-
-/* Output a note marking the start of an exception handling region.
- All instructions emitted after this point are considered to be part
- of the region until expand_eh_region_end () is invoked. */
-
-void
-expand_eh_region_start ()
-{
- rtx note;
-
- /* This is the old code. */
- if (! doing_eh (0))
- return;
-
-#if 0
- /* Maybe do this to prevent jumping in and so on... */
- pushlevel (0);
-#endif
-
- note = emit_note (NULL_PTR, NOTE_INSN_EH_REGION_BEG);
- emit_label (push_eh_entry (&ehstack));
- NOTE_BLOCK_NUMBER (note)
- = CODE_LABEL_NUMBER (ehstack.top->entry->exception_handler_label);
-}
-
-/* Output a note marking the end of the exception handling region on
- the top of ehstack.
-
- HANDLER is either the cleanup for the exception region, or if we're
- marking the end of a try block, HANDLER is integer_zero_node.
-
- HANDLER will be transformed to rtl when expand_leftover_cleanups ()
- is invoked. */
-
-void
-expand_eh_region_end (handler)
- tree handler;
-{
- rtx note;
-
- struct eh_entry *entry;
-
- if (! doing_eh (0))
- return;
-
- entry = pop_eh_entry (&ehstack);
-
- note = emit_note (NULL_PTR, NOTE_INSN_EH_REGION_END);
- NOTE_BLOCK_NUMBER (note) = CODE_LABEL_NUMBER (entry->exception_handler_label);
-
- /* Emit a label marking the end of this exception region. */
- emit_label (entry->end_label);
-
- /* Put in something that takes up space, as otherwise the end
- address for this EH region could have the exact same address as
- its outer region. This would cause us to miss the fact that
- resuming exception handling with this PC value would be inside
- the outer region. */
- emit_insn (gen_nop ());
-
- entry->finalization = handler;
-
- enqueue_eh_entry (&ehqueue, entry);
-
-#if 0
- /* Maybe do this to prevent jumping in and so on... */
- poplevel (1, 0, 0);
-#endif
-}
-
-/* Emit a call to __throw and note that we threw something, so we know
- we need to generate the necessary code for __throw.
-
- Before invoking throw, the __eh_pc variable must have been set up
- to contain the PC being thrown from. This address is used by
- __throw () to determine which exception region (if any) is
- responsible for handling the exception. */
-
-static void
-emit_throw ()
-{
-#ifdef JUMP_TO_THROW
- emit_indirect_jump (throw_libfunc);
-#else
- SYMBOL_REF_USED (throw_libfunc) = 1;
- emit_library_call (throw_libfunc, 0, VOIDmode, 0);
-#endif
- throw_used = 1;
- emit_barrier ();
-}
-
-/* An internal throw with an indirect CONTEXT we want to throw from.
- CONTEXT evaluates to the context of the throw. */
-
-static void
-expand_internal_throw_indirect (context)
- rtx context;
-{
- assemble_external (eh_saved_pc);
- emit_move_insn (eh_saved_pc_rtx, context);
- emit_throw ();
-}
-
-/* An internal throw with a direct CONTEXT we want to throw from.
- CONTEXT must be a label; its address will be used as the context of
- the throw. */
-
-void
-expand_internal_throw (context)
- rtx context;
-{
- expand_internal_throw_indirect (gen_rtx (LABEL_REF, Pmode, context));
-}
-
-/* Called from expand_exception_blocks and expand_end_catch_block to
- emit any pending handlers/cleanups queued from expand_eh_region_end (). */
-
-void
-expand_leftover_cleanups ()
-{
- struct eh_entry *entry;
-
- while ((entry = dequeue_eh_entry (&ehqueue)) != 0)
- {
- rtx prev;
-
- /* A leftover try block. Shouldn't be one here. */
- if (entry->finalization == integer_zero_node)
- abort ();
-
- /* Output the label for the start of the exception handler. */
- emit_label (entry->exception_handler_label);
-
- /* And now generate the insns for the handler. */
- expand_expr (entry->finalization, const0_rtx, VOIDmode, 0);
-
- prev = get_last_insn ();
- if (! (prev && GET_CODE (prev) == BARRIER))
- {
- /* The below can be optimized away, and we could just fall into the
- next EH handler, if we are certain they are nested. */
- /* Emit code to throw to the outer context if we fall off
- the end of the handler. */
- expand_internal_throw (entry->end_label);
- }
-
- free (entry);
- }
-}
-
-/* Called at the start of a block of try statements. */
-void
-expand_start_try_stmts ()
-{
- if (! doing_eh (1))
- return;
-
- expand_eh_region_start ();
-}
-
-/* Generate RTL for the start of a group of catch clauses.
-
- It is responsible for starting a new instruction sequence for the
- instructions in the catch block, and expanding the handlers for the
- internally-generated exception regions nested within the try block
- corresponding to this catch block. */
-
-void
-expand_start_all_catch ()
-{
- struct eh_entry *entry;
- tree label;
-
- if (! doing_eh (1))
- return;
-
- /* End the try block. */
- expand_eh_region_end (integer_zero_node);
-
- emit_line_note (input_filename, lineno);
- label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- /* The label for the exception handling block that we will save.
- This is Lresume in the documention. */
- expand_label (label);
-
- /* Put in something that takes up space, as otherwise the end
- address for the EH region could have the exact same address as
- the outer region, causing us to miss the fact that resuming
- exception handling with this PC value would be inside the outer
- region. */
- emit_insn (gen_nop ());
-
- /* Push the label that points to where normal flow is resumed onto
- the top of the label stack. */
- push_label_entry (&caught_return_label_stack, NULL_RTX, label);
-
- /* Start a new sequence for all the catch blocks. We will add this
- to the global sequence catch_clauses when we have completed all
- the handlers in this handler-seq. */
- start_sequence ();
-
- while (1)
- {
- rtx prev;
-
- entry = dequeue_eh_entry (&ehqueue);
- /* Emit the label for the exception handler for this region, and
- expand the code for the handler.
-
- Note that a catch region is handled as a side-effect here;
- for a try block, entry->finalization will contain
- integer_zero_node, so no code will be generated in the
- expand_expr call below. But, the label for the handler will
- still be emitted, so any code emitted after this point will
- end up being the handler. */
- emit_label (entry->exception_handler_label);
- expand_expr (entry->finalization, const0_rtx, VOIDmode, 0);
-
- /* When we get down to the matching entry for this try block, stop. */
- if (entry->finalization == integer_zero_node)
- {
- /* Don't forget to free this entry. */
- free (entry);
- break;
- }
-
- prev = get_last_insn ();
- if (prev == NULL || GET_CODE (prev) != BARRIER)
- {
- /* Code to throw out to outer context when we fall off end
- of the handler. We can't do this here for catch blocks,
- so it's done in expand_end_all_catch () instead.
-
- The below can be optimized away (and we could just fall
- into the next EH handler) if we are certain they are
- nested. */
-
- expand_internal_throw (entry->end_label);
- }
- free (entry);
- }
-}
-
-/* Finish up the catch block. At this point all the insns for the
- catch clauses have already been generated, so we only have to add
- them to the catch_clauses list. We also want to make sure that if
- we fall off the end of the catch clauses that we rethrow to the
- outer EH region. */
-
-void
-expand_end_all_catch ()
-{
- rtx new_catch_clause;
-
- if (! doing_eh (1))
- return;
-
- /* Code to throw out to outer context, if we fall off end of catch
- handlers. This is rethrow (Lresume, same id, same obj) in the
- documentation. We use Lresume because we know that it will throw
- to the correct context.
-
- In other words, if the catch handler doesn't exit or return, we
- do a "throw" (using the address of Lresume as the point being
- thrown from) so that the outer EH region can then try to process
- the exception. */
-
- expand_internal_throw (DECL_RTL (top_label_entry (&caught_return_label_stack)));
-
- /* Now we have the complete catch sequence. */
- new_catch_clause = get_insns ();
- end_sequence ();
-
- /* This level of catch blocks is done, so set up the successful
- catch jump label for the next layer of catch blocks. */
- pop_label_entry (&caught_return_label_stack);
-
- /* Add the new sequence of catches to the main one for this function. */
- push_to_sequence (catch_clauses);
- emit_insns (new_catch_clause);
- catch_clauses = get_insns ();
- end_sequence ();
-
- /* Here we fall through into the continuation code. */
-}
-
-/* End all the pending exception regions on protect_list. The handlers
- will be emitted when expand_leftover_cleanups () is invoked. */
-
-void
-end_protect_partials ()
-{
- while (protect_list)
- {
- expand_eh_region_end (TREE_VALUE (protect_list));
- protect_list = TREE_CHAIN (protect_list);
- }
-}
-
-/* The exception table that we build that is used for looking up and
- dispatching exceptions, the current number of entries, and its
- maximum size before we have to extend it.
-
- The number in eh_table is the code label number of the exception
- handler for the region. This is added by add_eh_table_entry () and
- used by output_exception_table_entry (). */
-
-static int *eh_table;
-static int eh_table_size;
-static int eh_table_max_size;
-
-/* Note the need for an exception table entry for region N. If we
- don't need to output an explicit exception table, avoid all of the
- extra work.
-
- Called from final_scan_insn when a NOTE_INSN_EH_REGION_BEG is seen.
- N is the NOTE_BLOCK_NUMBER of the note, which comes from the code
- label number of the exception handler for the region. */
-
-void
-add_eh_table_entry (n)
- int n;
-{
-#ifndef OMIT_EH_TABLE
- if (eh_table_size >= eh_table_max_size)
- {
- if (eh_table)
- {
- eh_table_max_size += eh_table_max_size>>1;
-
- if (eh_table_max_size < 0)
- abort ();
-
- if ((eh_table = (int *) realloc (eh_table,
- eh_table_max_size * sizeof (int)))
- == 0)
- fatal ("virtual memory exhausted");
- }
- else
- {
- eh_table_max_size = 252;
- eh_table = (int *) xmalloc (eh_table_max_size * sizeof (int));
- }
- }
- eh_table[eh_table_size++] = n;
-#endif
-}
-
-/* Return a non-zero value if we need to output an exception table.
-
- On some platforms, we don't have to output a table explicitly.
- This routine doesn't mean we don't have one. */
-
-int
-exception_table_p ()
-{
- if (eh_table)
- return 1;
-
- return 0;
-}
-
-/* Output the entry of the exception table corresponding to to the
- exception region numbered N to file FILE.
-
- N is the code label number corresponding to the handler of the
- region. */
-
-static void
-output_exception_table_entry (file, n)
- FILE *file;
- int n;
-{
- char buf[256];
- rtx sym;
-
- ASM_GENERATE_INTERNAL_LABEL (buf, "LEHB", n);
- sym = gen_rtx (SYMBOL_REF, Pmode, buf);
- assemble_integer (sym, POINTER_SIZE / BITS_PER_UNIT, 1);
-
- ASM_GENERATE_INTERNAL_LABEL (buf, "LEHE", n);
- sym = gen_rtx (SYMBOL_REF, Pmode, buf);
- assemble_integer (sym, POINTER_SIZE / BITS_PER_UNIT, 1);
-
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", n);
- sym = gen_rtx (SYMBOL_REF, Pmode, buf);
- assemble_integer (sym, POINTER_SIZE / BITS_PER_UNIT, 1);
-
- putc ('\n', file); /* blank line */
-}
-
-/* Output the exception table if we have and need one. */
-
-void
-output_exception_table ()
-{
- int i;
- extern FILE *asm_out_file;
-
- if (! doing_eh (0))
- return;
-
- exception_section ();
-
- /* Beginning marker for table. */
- assemble_align (GET_MODE_ALIGNMENT (ptr_mode));
- assemble_label ("__EXCEPTION_TABLE__");
-
- assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
- assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
- assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
- putc ('\n', asm_out_file); /* blank line */
-
- for (i = 0; i < eh_table_size; ++i)
- output_exception_table_entry (asm_out_file, eh_table[i]);
-
- free (eh_table);
-
- /* Ending marker for table. */
- assemble_label ("__EXCEPTION_END__");
- assemble_integer (constm1_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
- assemble_integer (constm1_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
- assemble_integer (constm1_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
- putc ('\n', asm_out_file); /* blank line */
-}
-
-/* Generate code to initialize the exception table at program startup
- time. */
-
-void
-register_exception_table ()
-{
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__register_exceptions"), 0,
- VOIDmode, 1,
- gen_rtx (SYMBOL_REF, Pmode, "__EXCEPTION_TABLE__"),
- Pmode);
-}
-
-/* Emit the RTL for the start of the per-function unwinder for the
- current function. See emit_unwinder () for further information.
-
- DOESNT_NEED_UNWINDER is a target-specific macro that determines if
- the current function actually needs a per-function unwinder or not.
- By default, all functions need one. */
-
-void
-start_eh_unwinder ()
-{
-#ifdef DOESNT_NEED_UNWINDER
- if (DOESNT_NEED_UNWINDER)
- return;
-#endif
-
- expand_eh_region_start ();
-}
-
-/* Emit insns for the end of the per-function unwinder for the
- current function. */
-
-void
-end_eh_unwinder ()
-{
- tree expr;
- rtx return_val_rtx, ret_val, label, end, insns;
-
- if (! doing_eh (0))
- return;
-
-#ifdef DOESNT_NEED_UNWINDER
- if (DOESNT_NEED_UNWINDER)
- return;
-#endif
-
- assemble_external (eh_saved_pc);
-
- expr = make_node (RTL_EXPR);
- TREE_TYPE (expr) = void_type_node;
- RTL_EXPR_RTL (expr) = const0_rtx;
- TREE_SIDE_EFFECTS (expr) = 1;
- start_sequence_for_rtl_expr (expr);
-
- /* ret_val will contain the address of the code where the call
- to the current function occurred. */
- ret_val = expand_builtin_return_addr (BUILT_IN_RETURN_ADDRESS,
- 0, hard_frame_pointer_rtx);
- return_val_rtx = copy_to_reg (ret_val);
-
- /* Get the address we need to use to determine what exception
- handler should be invoked, and store it in __eh_pc. */
- return_val_rtx = eh_outer_context (return_val_rtx);
- emit_move_insn (eh_saved_pc_rtx, return_val_rtx);
-
- /* Either set things up so we do a return directly to __throw, or
- we return here instead. */
-#ifdef JUMP_TO_THROW
- emit_move_insn (ret_val, throw_libfunc);
-#else
- label = gen_label_rtx ();
- emit_move_insn (ret_val, gen_rtx (LABEL_REF, Pmode, label));
-#endif
-
-#ifdef RETURN_ADDR_OFFSET
- return_val_rtx = plus_constant (ret_val, -RETURN_ADDR_OFFSET);
- if (return_val_rtx != ret_val)
- emit_move_insn (ret_val, return_val_rtx);
-#endif
-
- end = gen_label_rtx ();
- emit_jump (end);
-
- RTL_EXPR_SEQUENCE (expr) = get_insns ();
- end_sequence ();
- expand_eh_region_end (expr);
-
- emit_jump (end);
-
-#ifndef JUMP_TO_THROW
- emit_label (label);
- emit_throw ();
-#endif
-
- expand_leftover_cleanups ();
-
- emit_label (end);
-}
-
-/* If necessary, emit insns for the per function unwinder for the
- current function. Called after all the code that needs unwind
- protection is output.
-
- The unwinder takes care of catching any exceptions that have not
- been previously caught within the function, unwinding the stack to
- the next frame, and rethrowing using the address of the current
- function's caller as the context of the throw.
-
- On some platforms __throw can do this by itself (or with the help
- of __unwind_function) so the per-function unwinder is
- unnecessary.
-
- We cannot place the unwinder into the function until after we know
- we are done inlining, as we don't want to have more than one
- unwinder per non-inlined function. */
-
-void
-emit_unwinder ()
-{
- rtx insns, insn;
-
- start_sequence ();
- start_eh_unwinder ();
- insns = get_insns ();
- end_sequence ();
-
- /* We place the start of the exception region associated with the
- per function unwinder at the top of the function. */
- if (insns)
- emit_insns_after (insns, get_insns ());
-
- start_sequence ();
- end_eh_unwinder ();
- insns = get_insns ();
- end_sequence ();
-
- /* And we place the end of the exception region before the USE and
- CLOBBER insns that may come at the end of the function. */
- if (insns == 0)
- return;
-
- insn = get_last_insn ();
- while (GET_CODE (insn) == NOTE
- || (GET_CODE (insn) == INSN
- && (GET_CODE (PATTERN (insn)) == USE
- || GET_CODE (PATTERN (insn)) == CLOBBER)))
- insn = PREV_INSN (insn);
-
- if (GET_CODE (insn) == CODE_LABEL
- && GET_CODE (PREV_INSN (insn)) == BARRIER)
- {
- insn = PREV_INSN (insn);
- }
- else
- {
- rtx label = gen_label_rtx ();
- emit_label_after (label, insn);
- insn = emit_jump_insn_after (gen_jump (label), insn);
- insn = emit_barrier_after (insn);
- }
-
- emit_insns_after (insns, insn);
-}
-
-/* Scan the current insns and build a list of handler labels. The
- resulting list is placed in the global variable exception_handler_labels.
-
- It is called after the last exception handling region is added to
- the current function (when the rtl is almost all built for the
- current function) and before the jump optimization pass. */
-
-void
-find_exception_handler_labels ()
-{
- rtx insn;
- int max_labelno = max_label_num ();
- int min_labelno = get_first_label_num ();
- rtx *labels;
-
- exception_handler_labels = NULL_RTX;
-
- /* If we aren't doing exception handling, there isn't much to check. */
- if (! doing_eh (0))
- return;
-
- /* Generate a handy reference to each label. */
-
- labels = (rtx *) alloca ((max_labelno - min_labelno) * sizeof (rtx));
- bzero ((char *) labels, (max_labelno - min_labelno) * sizeof (rtx));
-
- /* Arrange for labels to be indexed directly by CODE_LABEL_NUMBER. */
- labels -= min_labelno;
-
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL)
- if (CODE_LABEL_NUMBER (insn) >= min_labelno
- && CODE_LABEL_NUMBER (insn) < max_labelno)
- labels[CODE_LABEL_NUMBER (insn)] = insn;
- }
-
- /* For each start of a region, add its label to the list. */
-
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
- {
- rtx label = NULL_RTX;
-
- if (NOTE_BLOCK_NUMBER (insn) >= min_labelno
- && NOTE_BLOCK_NUMBER (insn) < max_labelno)
- {
- label = labels[NOTE_BLOCK_NUMBER (insn)];
-
- if (label)
- exception_handler_labels
- = gen_rtx (EXPR_LIST, VOIDmode,
- label, exception_handler_labels);
- else
- warning ("didn't find handler for EH region %d",
- NOTE_BLOCK_NUMBER (insn));
- }
- else
- warning ("mismatched EH region %d", NOTE_BLOCK_NUMBER (insn));
- }
- }
-}
-
-/* Perform sanity checking on the exception_handler_labels list.
-
- Can be called after find_exception_handler_labels is called to
- build the list of exception handlers for the current function and
- before we finish processing the current function. */
-
-void
-check_exception_handler_labels ()
-{
- rtx insn, handler;
-
- /* If we aren't doing exception handling, there isn't much to check. */
- if (! doing_eh (0))
- return;
-
- /* Ensure that the CODE_LABEL_NUMBER for the CODE_LABEL entry point
- in each handler corresponds to the CODE_LABEL_NUMBER of the
- handler. */
-
- for (handler = exception_handler_labels;
- handler;
- handler = XEXP (handler, 1))
- {
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL)
- {
- if (CODE_LABEL_NUMBER (insn)
- == CODE_LABEL_NUMBER (XEXP (handler, 0)))
- {
- if (insn != XEXP (handler, 0))
- warning ("mismatched handler %d",
- CODE_LABEL_NUMBER (insn));
- break;
- }
- }
- }
- if (insn == NULL_RTX)
- warning ("handler not found %d",
- CODE_LABEL_NUMBER (XEXP (handler, 0)));
- }
-
- /* Now go through and make sure that for each region there is a
- corresponding label. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE
- && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG ||
- NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END))
- {
- for (handler = exception_handler_labels;
- handler;
- handler = XEXP (handler, 1))
- {
- if (CODE_LABEL_NUMBER (XEXP (handler, 0))
- == NOTE_BLOCK_NUMBER (insn))
- break;
- }
- if (handler == NULL_RTX)
- warning ("region exists, no handler %d",
- NOTE_BLOCK_NUMBER (insn));
- }
- }
-}
-
-/* This group of functions initializes the exception handling data
- structures at the start of the compilation, initializes the data
- structures at the start of a function, and saves and restores the
- exception handling data structures for the start/end of a nested
- function. */
-
-/* Toplevel initialization for EH things. */
-
-void
-init_eh ()
-{
- /* Generate rtl to reference the variable in which the PC of the
- current context is saved. */
- tree type = build_pointer_type (make_node (VOID_TYPE));
-
- eh_saved_pc = build_decl (VAR_DECL, get_identifier ("__eh_pc"), type);
- DECL_EXTERNAL (eh_saved_pc) = 1;
- TREE_PUBLIC (eh_saved_pc) = 1;
- make_decl_rtl (eh_saved_pc, NULL_PTR, 1);
- eh_saved_pc_rtx = DECL_RTL (eh_saved_pc);
-}
-
-/* Initialize the per-function EH information. */
-
-void
-init_eh_for_function ()
-{
- ehstack.top = 0;
- ehqueue.head = ehqueue.tail = 0;
- catch_clauses = NULL_RTX;
- false_label_stack = 0;
- caught_return_label_stack = 0;
- protect_list = NULL_TREE;
-}
-
-/* Save some of the per-function EH info into the save area denoted by
- P.
-
- This is currently called from save_stmt_status (). */
-
-void
-save_eh_status (p)
- struct function *p;
-{
- assert (p != NULL);
-
- p->ehstack = ehstack;
- p->ehqueue = ehqueue;
- p->catch_clauses = catch_clauses;
- p->false_label_stack = false_label_stack;
- p->caught_return_label_stack = caught_return_label_stack;
- p->protect_list = protect_list;
-
- init_eh ();
-}
-
-/* Restore the per-function EH info saved into the area denoted by P.
-
- This is currently called from restore_stmt_status. */
-
-void
-restore_eh_status (p)
- struct function *p;
-{
- assert (p != NULL);
-
- protect_list = p->protect_list;
- caught_return_label_stack = p->caught_return_label_stack;
- false_label_stack = p->false_label_stack;
- catch_clauses = p->catch_clauses;
- ehqueue = p->ehqueue;
- ehstack = p->ehstack;
-}
-
-/* This section is for the exception handling specific optimization
- pass. First are the internal routines, and then the main
- optimization pass. */
-
-/* Determine if the given INSN can throw an exception. */
-
-static int
-can_throw (insn)
- rtx insn;
-{
- /* Calls can always potentially throw exceptions. */
- if (GET_CODE (insn) == CALL_INSN)
- return 1;
-
-#ifdef ASYNCH_EXCEPTIONS
- /* If we wanted asynchronous exceptions, then everything but NOTEs
- and CODE_LABELs could throw. */
- if (GET_CODE (insn) != NOTE && GET_CODE (insn) != CODE_LABEL)
- return 1;
-#endif
-
- return 0;
-}
-
-/* Scan a exception region looking for the matching end and then
- remove it if possible. INSN is the start of the region, N is the
- region number, and DELETE_OUTER is to note if anything in this
- region can throw.
-
- Regions are removed if they cannot possibly catch an exception.
- This is determined by invoking can_throw () on each insn within the
- region; if can_throw returns true for any of the instructions, the
- region can catch an exception, since there is an insn within the
- region that is capable of throwing an exception.
-
- Returns the NOTE_INSN_EH_REGION_END corresponding to this region, or
- calls abort () if it can't find one.
-
- Can abort if INSN is not a NOTE_INSN_EH_REGION_BEGIN, or if N doesn't
- correspond to the region number, or if DELETE_OUTER is NULL. */
-
-static rtx
-scan_region (insn, n, delete_outer)
- rtx insn;
- int n;
- int *delete_outer;
-{
- rtx start = insn;
-
- /* Assume we can delete the region. */
- int delete = 1;
-
- assert (insn != NULL_RTX
- && GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
- && NOTE_BLOCK_NUMBER (insn) == n
- && delete_outer != NULL);
-
- insn = NEXT_INSN (insn);
-
- /* Look for the matching end. */
- while (! (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END))
- {
- /* If anything can throw, we can't remove the region. */
- if (delete && can_throw (insn))
- {
- delete = 0;
- }
-
- /* Watch out for and handle nested regions. */
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
- {
- insn = scan_region (insn, NOTE_BLOCK_NUMBER (insn), &delete);
- }
-
- insn = NEXT_INSN (insn);
- }
-
- /* The _BEG/_END NOTEs must match and nest. */
- if (NOTE_BLOCK_NUMBER (insn) != n)
- abort ();
-
- /* If anything in this exception region can throw, we can throw. */
- if (! delete)
- *delete_outer = 0;
- else
- {
- /* Delete the start and end of the region. */
- delete_insn (start);
- delete_insn (insn);
-
- /* Only do this part if we have built the exception handler
- labels. */
- if (exception_handler_labels)
- {
- rtx x, *prev = &exception_handler_labels;
-
- /* Find it in the list of handlers. */
- for (x = exception_handler_labels; x; x = XEXP (x, 1))
- {
- rtx label = XEXP (x, 0);
- if (CODE_LABEL_NUMBER (label) == n)
- {
- /* If we are the last reference to the handler,
- delete it. */
- if (--LABEL_NUSES (label) == 0)
- delete_insn (label);
-
- if (optimize)
- {
- /* Remove it from the list of exception handler
- labels, if we are optimizing. If we are not, then
- leave it in the list, as we are not really going to
- remove the region. */
- *prev = XEXP (x, 1);
- XEXP (x, 1) = 0;
- XEXP (x, 0) = 0;
- }
-
- break;
- }
- prev = &XEXP (x, 1);
- }
- }
- }
- return insn;
-}
-
-/* Perform various interesting optimizations for exception handling
- code.
-
- We look for empty exception regions and make them go (away). The
- jump optimization code will remove the handler if nothing else uses
- it. */
-
-void
-exception_optimize ()
-{
- rtx insn, regions = NULL_RTX;
- int n;
-
- /* Remove empty regions. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
- {
- /* Since scan_region () will return the NOTE_INSN_EH_REGION_END
- insn, we will indirectly skip through all the insns
- inbetween. We are also guaranteed that the value of insn
- returned will be valid, as otherwise scan_region () won't
- return. */
- insn = scan_region (insn, NOTE_BLOCK_NUMBER (insn), &n);
- }
- }
-}
diff --git a/gcc/except.h b/gcc/except.h
deleted file mode 100644
index 7c31e950fee..00000000000
--- a/gcc/except.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/* Exception Handling interface routines.
- Copyright (C) 1996 Free Software Foundation, Inc.
- Contributed by Mike Stump <mrs@cygnus.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 GET_CODE
-#define rtx int *
-#endif
-
-#ifdef TREE_CODE
-
-/* A stack of labels. CHAIN points to the next entry in the stack. */
-
-struct label_node {
- union {
- rtx rlabel;
- tree tlabel;
- } u;
- struct label_node *chain;
-};
-
-/* An eh_entry is used to describe one exception handling region.
-
- START_LABEL is the label corresponding to the start of the region.
-
- END_LABEL is the label corresponding to the end of the region.
-
- EXCEPTION_HANDLER_LABEL is the label corresponding to the handler
- for this region.
-
- FINALIZATION is the tree codes for the handler, or is NULL_TREE if
- one hasn't been generated yet, or is integer_zero_node to mark the
- end of a group of try blocks. */
-
-struct eh_entry {
- rtx start_label;
- rtx end_label;
- rtx exception_handler_label;
-
- tree finalization;
-};
-
-/* A list of EH_ENTRYs. ENTRY is the entry; CHAIN points to the next
- entry in the list, or is NULL if this is the last entry. */
-
-struct eh_node {
- struct eh_entry *entry;
- struct eh_node *chain;
-};
-
-/* A stack of EH_ENTRYs. TOP is the topmost entry on the stack. TOP is
- NULL if the stack is empty. */
-
-struct eh_stack {
- struct eh_node *top;
-};
-
-/* A queue of EH_ENTRYs. HEAD is the front of the queue; TAIL is the
- end (the latest entry). HEAD and TAIL are NULL if the queue is
- empty. */
-
-struct eh_queue {
- struct eh_node *head;
- struct eh_node *tail;
-};
-
-
-extern void expand_eh_region_start PROTO((void));
-
-extern void expand_eh_region_end PROTO((tree));
-
-/* Push RLABEL or TLABEL onto LABELSTACK. Only one of RLABEL or TLABEL
- should be set; the other must be NULL. */
-
-extern void push_label_entry PROTO((struct label_node **labelstack, rtx rlabel, tree tlabel));
-
-/* Pop the topmost entry from LABELSTACK and return its value as an
- rtx node. If LABELSTACK is empty, return NULL. */
-
-extern rtx pop_label_entry PROTO((struct label_node **labelstack));
-
-/* Return the topmost entry of LABELSTACK as a tree node, or return
- NULL_TREE if LABELSTACK is empty. */
-
-extern tree top_label_entry PROTO((struct label_node **labelstack));
-
-/* The stack used to keep track of the exception region corresponding to
- the current instruction. */
-
-extern struct eh_stack ehstack;
-
-/* A queue used to track closed exception regions whose handlers have
- not been emitted yet. */
-
-extern struct eh_queue ehqueue;
-
-/* A set of insns for the catch clauses in the current function. They
- will be emitted at the end of the current function. */
-
-extern rtx catch_clauses;
-
-#endif
-
-struct function;
-
-/* Toplevel initialization for EH. */
-
-extern void init_eh PROTO((void));
-
-/* Initialization for the per-function EH data. */
-
-extern void init_eh_for_function PROTO((void));
-
-/* Saves the current per-function EH data into P. */
-
-extern void save_eh_status PROTO((struct function *p));
-
-/* Restores the per-function EH data from P. */
-
-extern void restore_eh_status PROTO((struct function *p));
-
-/* Adds an EH table entry for EH entry number N. Called from
- final_scan_insn for NOTE_INSN_EH_REGION_BEG. */
-
-extern void add_eh_table_entry PROTO((int n));
-
-/* Returns a non-zero value if we need to output an exception table. */
-
-extern int exception_table_p PROTO((void));
-
-/* Outputs the exception table if we have one. */
-
-extern void output_exception_table PROTO((void));
-
-/* Given a return address in ADDR, determine the address we should use
- to find the corresponding EH region. */
-
-extern rtx eh_outer_context PROTO((rtx addr));
-
-/* Called at the start of a block of try statements for which there is
- a supplied catch handler. */
-
-extern void expand_start_try_stmts PROTO((void));
-
-/* Called at the start of a block of catch statements. It terminates the
- previous set of try statements. */
-
-extern void expand_start_all_catch PROTO((void));
-
-/* Called at the end of a block of catch statements. */
-
-extern void expand_end_all_catch PROTO((void));
-
-#ifdef TREE_CODE
-/* Create a new exception region and add the handler for the region
- onto a list. These regions will be ended (and their handlers
- emitted) when end_protect_partials is invoked. */
-
-extern void add_partial_entry PROTO((tree handler));
-#endif
-
-/* End all of the pending exception regions that have handlers added with
- push_protect_entry (). */
-
-extern void end_protect_partials PROTO((void));
-
-/* An internal throw with a direct CONTEXT we want to throw
- from. CONTEXT must be a label. */
-
-extern void expand_internal_throw PROTO((rtx context));
-
-/* Called from expand_exception_blocks and expand_end_catch_block to
- expand and pending handlers. */
-
-extern void expand_leftover_cleanups PROTO((void));
-
-/* If necessary, emit insns for the start of per-function unwinder for
- the current function. */
-
-extern void emit_unwinder PROTO((void));
-
-/* If necessary, emit insns for the end of the per-function unwinder
- for the current function. */
-
-extern void end_eh_unwinder PROTO((void));
-
-/* Builds a list of handler labels and puts them in the global
- variable exception_handler_labels. */
-
-extern void find_exception_handler_labels PROTO((void));
-
-/* Performs sanity checking on the check_exception_handler_labels
- list. */
-
-extern void check_exception_handler_labels PROTO((void));
-
-/* A stack used to keep track of the label used to resume normal program
- flow out of the current exception handler region. */
-
-extern struct label_node *caught_return_label_stack;
-
-/* A random area used for purposes elsewhere. */
-
-extern struct label_node *false_label_stack;
-
-/* A list of labels used for exception handlers. It is created by
- find_exception_handler_labels for the optimization passes. */
-
-extern rtx exception_handler_labels;
-
-/* The rtx for the saved PC value. */
-
-extern rtx eh_saved_pc_rtx;
-
-/* Performs optimizations for exception handling, such as removing
- unnecessary exception regions. Invoked from jump_optimize (). */
-
-extern void exception_optimize PROTO((void));
diff --git a/gcc/explow.c b/gcc/explow.c
deleted file mode 100644
index db0fbc855ba..00000000000
--- a/gcc/explow.c
+++ /dev/null
@@ -1,1231 +0,0 @@
-/* Subroutines for manipulating rtx's in semantically interesting ways.
- Copyright (C) 1987, 91, 94, 95, 96, 1997 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. */
-
-
-#include "config.h"
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "expr.h"
-#include "hard-reg-set.h"
-#include "insn-config.h"
-#include "recog.h"
-#include "insn-flags.h"
-#include "insn-codes.h"
-
-static rtx break_out_memory_refs PROTO((rtx));
-
-/* Return an rtx for the sum of X and the integer C.
-
- This function should be used via the `plus_constant' macro. */
-
-rtx
-plus_constant_wide (x, c)
- register rtx x;
- register HOST_WIDE_INT c;
-{
- register RTX_CODE code;
- register enum machine_mode mode;
- register rtx tem;
- int all_constant = 0;
-
- if (c == 0)
- return x;
-
- restart:
-
- code = GET_CODE (x);
- mode = GET_MODE (x);
- switch (code)
- {
- case CONST_INT:
- return GEN_INT (INTVAL (x) + c);
-
- case CONST_DOUBLE:
- {
- HOST_WIDE_INT l1 = CONST_DOUBLE_LOW (x);
- HOST_WIDE_INT h1 = CONST_DOUBLE_HIGH (x);
- HOST_WIDE_INT l2 = c;
- HOST_WIDE_INT h2 = c < 0 ? ~0 : 0;
- HOST_WIDE_INT lv, hv;
-
- add_double (l1, h1, l2, h2, &lv, &hv);
-
- return immed_double_const (lv, hv, VOIDmode);
- }
-
- case MEM:
- /* If this is a reference to the constant pool, try replacing it with
- a reference to a new constant. If the resulting address isn't
- valid, don't return it because we have no way to validize it. */
- if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)))
- {
- tem
- = force_const_mem (GET_MODE (x),
- plus_constant (get_pool_constant (XEXP (x, 0)),
- c));
- if (memory_address_p (GET_MODE (tem), XEXP (tem, 0)))
- return tem;
- }
- break;
-
- case CONST:
- /* If adding to something entirely constant, set a flag
- so that we can add a CONST around the result. */
- x = XEXP (x, 0);
- all_constant = 1;
- goto restart;
-
- case SYMBOL_REF:
- case LABEL_REF:
- all_constant = 1;
- break;
-
- case PLUS:
- /* The interesting case is adding the integer to a sum.
- Look for constant term in the sum and combine
- with C. For an integer constant term, we make a combined
- integer. For a constant term that is not an explicit integer,
- we cannot really combine, but group them together anyway.
-
- Use a recursive call in case the remaining operand is something
- that we handle specially, such as a SYMBOL_REF. */
-
- if (GET_CODE (XEXP (x, 1)) == CONST_INT)
- return plus_constant (XEXP (x, 0), c + INTVAL (XEXP (x, 1)));
- else if (CONSTANT_P (XEXP (x, 0)))
- return gen_rtx (PLUS, mode,
- plus_constant (XEXP (x, 0), c),
- XEXP (x, 1));
- else if (CONSTANT_P (XEXP (x, 1)))
- return gen_rtx (PLUS, mode,
- XEXP (x, 0),
- plus_constant (XEXP (x, 1), c));
- }
-
- if (c != 0)
- x = gen_rtx (PLUS, mode, x, GEN_INT (c));
-
- if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
- return x;
- else if (all_constant)
- return gen_rtx (CONST, mode, x);
- else
- return x;
-}
-
-/* This is the same as `plus_constant', except that it handles LO_SUM.
-
- This function should be used via the `plus_constant_for_output' macro. */
-
-rtx
-plus_constant_for_output_wide (x, c)
- register rtx x;
- register HOST_WIDE_INT c;
-{
- register RTX_CODE code = GET_CODE (x);
- register enum machine_mode mode = GET_MODE (x);
- int all_constant = 0;
-
- if (GET_CODE (x) == LO_SUM)
- return gen_rtx (LO_SUM, mode, XEXP (x, 0),
- plus_constant_for_output (XEXP (x, 1), c));
-
- else
- return plus_constant (x, c);
-}
-
-/* If X is a sum, return a new sum like X but lacking any constant terms.
- Add all the removed constant terms into *CONSTPTR.
- X itself is not altered. The result != X if and only if
- it is not isomorphic to X. */
-
-rtx
-eliminate_constant_term (x, constptr)
- rtx x;
- rtx *constptr;
-{
- register rtx x0, x1;
- rtx tem;
-
- if (GET_CODE (x) != PLUS)
- return x;
-
- /* First handle constants appearing at this level explicitly. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && 0 != (tem = simplify_binary_operation (PLUS, GET_MODE (x), *constptr,
- XEXP (x, 1)))
- && GET_CODE (tem) == CONST_INT)
- {
- *constptr = tem;
- return eliminate_constant_term (XEXP (x, 0), constptr);
- }
-
- tem = const0_rtx;
- x0 = eliminate_constant_term (XEXP (x, 0), &tem);
- x1 = eliminate_constant_term (XEXP (x, 1), &tem);
- if ((x1 != XEXP (x, 1) || x0 != XEXP (x, 0))
- && 0 != (tem = simplify_binary_operation (PLUS, GET_MODE (x),
- *constptr, tem))
- && GET_CODE (tem) == CONST_INT)
- {
- *constptr = tem;
- return gen_rtx (PLUS, GET_MODE (x), x0, x1);
- }
-
- return x;
-}
-
-/* Returns the insn that next references REG after INSN, or 0
- if REG is clobbered before next referenced or we cannot find
- an insn that references REG in a straight-line piece of code. */
-
-rtx
-find_next_ref (reg, insn)
- rtx reg;
- rtx insn;
-{
- rtx next;
-
- for (insn = NEXT_INSN (insn); insn; insn = next)
- {
- next = NEXT_INSN (insn);
- if (GET_CODE (insn) == NOTE)
- continue;
- if (GET_CODE (insn) == CODE_LABEL
- || GET_CODE (insn) == BARRIER)
- return 0;
- if (GET_CODE (insn) == INSN
- || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- if (reg_set_p (reg, insn))
- return 0;
- if (reg_mentioned_p (reg, PATTERN (insn)))
- return insn;
- if (GET_CODE (insn) == JUMP_INSN)
- {
- if (simplejump_p (insn))
- next = JUMP_LABEL (insn);
- else
- return 0;
- }
- if (GET_CODE (insn) == CALL_INSN
- && REGNO (reg) < FIRST_PSEUDO_REGISTER
- && call_used_regs[REGNO (reg)])
- return 0;
- }
- else
- abort ();
- }
- return 0;
-}
-
-/* Return an rtx for the size in bytes of the value of EXP. */
-
-rtx
-expr_size (exp)
- tree exp;
-{
- tree size = size_in_bytes (TREE_TYPE (exp));
-
- if (TREE_CODE (size) != INTEGER_CST
- && contains_placeholder_p (size))
- size = build (WITH_RECORD_EXPR, sizetype, size, exp);
-
- return expand_expr (size, NULL_RTX, TYPE_MODE (sizetype), 0);
-}
-
-/* Return a copy of X in which all memory references
- and all constants that involve symbol refs
- have been replaced with new temporary registers.
- Also emit code to load the memory locations and constants
- into those registers.
-
- If X contains no such constants or memory references,
- X itself (not a copy) is returned.
-
- If a constant is found in the address that is not a legitimate constant
- in an insn, it is left alone in the hope that it might be valid in the
- address.
-
- X may contain no arithmetic except addition, subtraction and multiplication.
- Values returned by expand_expr with 1 for sum_ok fit this constraint. */
-
-static rtx
-break_out_memory_refs (x)
- register rtx x;
-{
- if (GET_CODE (x) == MEM
- || (CONSTANT_P (x) && CONSTANT_ADDRESS_P (x)
- && GET_MODE (x) != VOIDmode))
- x = force_reg (GET_MODE (x), x);
- else if (GET_CODE (x) == PLUS || GET_CODE (x) == MINUS
- || GET_CODE (x) == MULT)
- {
- register rtx op0 = break_out_memory_refs (XEXP (x, 0));
- register rtx op1 = break_out_memory_refs (XEXP (x, 1));
-
- if (op0 != XEXP (x, 0) || op1 != XEXP (x, 1))
- x = gen_rtx (GET_CODE (x), Pmode, op0, op1);
- }
-
- return x;
-}
-
-#ifdef POINTERS_EXTEND_UNSIGNED
-
-/* Given X, a memory address in ptr_mode, convert it to an address
- in Pmode, or vice versa (TO_MODE says which way). We take advantage of
- the fact that pointers are not allowed to overflow by commuting arithmetic
- operations over conversions so that address arithmetic insns can be
- used. */
-
-rtx
-convert_memory_address (to_mode, x)
- enum machine_mode to_mode;
- rtx x;
-{
- enum machine_mode from_mode = to_mode == ptr_mode ? Pmode : ptr_mode;
- rtx temp;
-
- /* Here we handle some special cases. If none of them apply, fall through
- to the default case. */
- switch (GET_CODE (x))
- {
- case CONST_INT:
- case CONST_DOUBLE:
- return x;
-
- case LABEL_REF:
- return gen_rtx (LABEL_REF, to_mode, XEXP (x, 0));
-
- case SYMBOL_REF:
- temp = gen_rtx (SYMBOL_REF, to_mode, XSTR (x, 0));
- SYMBOL_REF_FLAG (temp) = SYMBOL_REF_FLAG (x);
- CONSTANT_POOL_ADDRESS_P (temp) = CONSTANT_POOL_ADDRESS_P (x);
- return temp;
-
- case CONST:
- return gen_rtx (CONST, to_mode,
- convert_memory_address (to_mode, XEXP (x, 0)));
-
- case PLUS:
- case MULT:
- /* For addition the second operand is a small constant, we can safely
- permute the converstion and addition operation. We can always safely
- permute them if we are making the address narrower. In addition,
- always permute the operations if this is a constant. */
- if (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (from_mode)
- || (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 1)) == CONST_INT
- && (INTVAL (XEXP (x, 1)) + 20000 < 40000
- || CONSTANT_P (XEXP (x, 0)))))
- return gen_rtx (GET_CODE (x), to_mode,
- convert_memory_address (to_mode, XEXP (x, 0)),
- convert_memory_address (to_mode, XEXP (x, 1)));
- }
-
- return convert_modes (to_mode, from_mode,
- x, POINTERS_EXTEND_UNSIGNED);
-}
-#endif
-
-/* Given a memory address or facsimile X, construct a new address,
- currently equivalent, that is stable: future stores won't change it.
-
- X must be composed of constants, register and memory references
- combined with addition, subtraction and multiplication:
- in other words, just what you can get from expand_expr if sum_ok is 1.
-
- Works by making copies of all regs and memory locations used
- by X and combining them the same way X does.
- You could also stabilize the reference to this address
- by copying the address to a register with copy_to_reg;
- but then you wouldn't get indexed addressing in the reference. */
-
-rtx
-copy_all_regs (x)
- register rtx x;
-{
- if (GET_CODE (x) == REG)
- {
- if (REGNO (x) != FRAME_POINTER_REGNUM
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && REGNO (x) != HARD_FRAME_POINTER_REGNUM
-#endif
- )
- x = copy_to_reg (x);
- }
- else if (GET_CODE (x) == MEM)
- x = copy_to_reg (x);
- else if (GET_CODE (x) == PLUS || GET_CODE (x) == MINUS
- || GET_CODE (x) == MULT)
- {
- register rtx op0 = copy_all_regs (XEXP (x, 0));
- register rtx op1 = copy_all_regs (XEXP (x, 1));
- if (op0 != XEXP (x, 0) || op1 != XEXP (x, 1))
- x = gen_rtx (GET_CODE (x), Pmode, op0, op1);
- }
- return x;
-}
-
-/* Return something equivalent to X but valid as a memory address
- for something of mode MODE. When X is not itself valid, this
- works by copying X or subexpressions of it into registers. */
-
-rtx
-memory_address (mode, x)
- enum machine_mode mode;
- register rtx x;
-{
- register rtx oldx = x;
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (x) == ptr_mode)
- x = convert_memory_address (Pmode, x);
-#endif
-
- /* By passing constant addresses thru registers
- we get a chance to cse them. */
- if (! cse_not_expected && CONSTANT_P (x) && CONSTANT_ADDRESS_P (x))
- x = force_reg (Pmode, x);
-
- /* Accept a QUEUED that refers to a REG
- even though that isn't a valid address.
- On attempting to put this in an insn we will call protect_from_queue
- which will turn it into a REG, which is valid. */
- else if (GET_CODE (x) == QUEUED
- && GET_CODE (QUEUED_VAR (x)) == REG)
- ;
-
- /* We get better cse by rejecting indirect addressing at this stage.
- Let the combiner create indirect addresses where appropriate.
- For now, generate the code so that the subexpressions useful to share
- are visible. But not if cse won't be done! */
- else
- {
- if (! cse_not_expected && GET_CODE (x) != REG)
- x = break_out_memory_refs (x);
-
- /* At this point, any valid address is accepted. */
- GO_IF_LEGITIMATE_ADDRESS (mode, x, win);
-
- /* If it was valid before but breaking out memory refs invalidated it,
- use it the old way. */
- if (memory_address_p (mode, oldx))
- goto win2;
-
- /* Perform machine-dependent transformations on X
- in certain cases. This is not necessary since the code
- below can handle all possible cases, but machine-dependent
- transformations can make better code. */
- LEGITIMIZE_ADDRESS (x, oldx, mode, win);
-
- /* PLUS and MULT can appear in special ways
- as the result of attempts to make an address usable for indexing.
- Usually they are dealt with by calling force_operand, below.
- But a sum containing constant terms is special
- if removing them makes the sum a valid address:
- then we generate that address in a register
- and index off of it. We do this because it often makes
- shorter code, and because the addresses thus generated
- in registers often become common subexpressions. */
- if (GET_CODE (x) == PLUS)
- {
- rtx constant_term = const0_rtx;
- rtx y = eliminate_constant_term (x, &constant_term);
- if (constant_term == const0_rtx
- || ! memory_address_p (mode, y))
- x = force_operand (x, NULL_RTX);
- else
- {
- y = gen_rtx (PLUS, GET_MODE (x), copy_to_reg (y), constant_term);
- if (! memory_address_p (mode, y))
- x = force_operand (x, NULL_RTX);
- else
- x = y;
- }
- }
-
- else if (GET_CODE (x) == MULT || GET_CODE (x) == MINUS)
- x = force_operand (x, NULL_RTX);
-
- /* If we have a register that's an invalid address,
- it must be a hard reg of the wrong class. Copy it to a pseudo. */
- else if (GET_CODE (x) == REG)
- x = copy_to_reg (x);
-
- /* Last resort: copy the value to a register, since
- the register is a valid address. */
- else
- x = force_reg (Pmode, x);
-
- goto done;
-
- win2:
- x = oldx;
- win:
- if (flag_force_addr && ! cse_not_expected && GET_CODE (x) != REG
- /* Don't copy an addr via a reg if it is one of our stack slots. */
- && ! (GET_CODE (x) == PLUS
- && (XEXP (x, 0) == virtual_stack_vars_rtx
- || XEXP (x, 0) == virtual_incoming_args_rtx)))
- {
- if (general_operand (x, Pmode))
- x = force_reg (Pmode, x);
- else
- x = force_operand (x, NULL_RTX);
- }
- }
-
- done:
-
- /* If we didn't change the address, we are done. Otherwise, mark
- a reg as a pointer if we have REG or REG + CONST_INT. */
- if (oldx == x)
- return x;
- else if (GET_CODE (x) == REG)
- mark_reg_pointer (x, 1);
- else if (GET_CODE (x) == PLUS
- && GET_CODE (XEXP (x, 0)) == REG
- && GET_CODE (XEXP (x, 1)) == CONST_INT)
- mark_reg_pointer (XEXP (x, 0), 1);
-
- /* OLDX may have been the address on a temporary. Update the address
- to indicate that X is now used. */
- update_temp_slot_address (oldx, x);
-
- return x;
-}
-
-/* Like `memory_address' but pretend `flag_force_addr' is 0. */
-
-rtx
-memory_address_noforce (mode, x)
- enum machine_mode mode;
- rtx x;
-{
- int ambient_force_addr = flag_force_addr;
- rtx val;
-
- flag_force_addr = 0;
- val = memory_address (mode, x);
- flag_force_addr = ambient_force_addr;
- return val;
-}
-
-/* Convert a mem ref into one with a valid memory address.
- Pass through anything else unchanged. */
-
-rtx
-validize_mem (ref)
- rtx ref;
-{
- if (GET_CODE (ref) != MEM)
- return ref;
- if (memory_address_p (GET_MODE (ref), XEXP (ref, 0)))
- return ref;
- /* Don't alter REF itself, since that is probably a stack slot. */
- return change_address (ref, GET_MODE (ref), XEXP (ref, 0));
-}
-
-/* Return a modified copy of X with its memory address copied
- into a temporary register to protect it from side effects.
- If X is not a MEM, it is returned unchanged (and not copied).
- Perhaps even if it is a MEM, if there is no need to change it. */
-
-rtx
-stabilize (x)
- rtx x;
-{
- register rtx addr;
- if (GET_CODE (x) != MEM)
- return x;
- addr = XEXP (x, 0);
- if (rtx_unstable_p (addr))
- {
- rtx temp = copy_all_regs (addr);
- rtx mem;
- if (GET_CODE (temp) != REG)
- temp = copy_to_reg (temp);
- mem = gen_rtx (MEM, GET_MODE (x), temp);
-
- /* Mark returned memref with in_struct if it's in an array or
- structure. Copy const and volatile from original memref. */
-
- MEM_IN_STRUCT_P (mem) = MEM_IN_STRUCT_P (x) || GET_CODE (addr) == PLUS;
- RTX_UNCHANGING_P (mem) = RTX_UNCHANGING_P (x);
- MEM_VOLATILE_P (mem) = MEM_VOLATILE_P (x);
- return mem;
- }
- return x;
-}
-
-/* Copy the value or contents of X to a new temp reg and return that reg. */
-
-rtx
-copy_to_reg (x)
- rtx x;
-{
- register rtx temp = gen_reg_rtx (GET_MODE (x));
-
- /* If not an operand, must be an address with PLUS and MULT so
- do the computation. */
- if (! general_operand (x, VOIDmode))
- x = force_operand (x, temp);
-
- if (x != temp)
- emit_move_insn (temp, x);
-
- return temp;
-}
-
-/* Like copy_to_reg but always give the new register mode Pmode
- in case X is a constant. */
-
-rtx
-copy_addr_to_reg (x)
- rtx x;
-{
- return copy_to_mode_reg (Pmode, x);
-}
-
-/* Like copy_to_reg but always give the new register mode MODE
- in case X is a constant. */
-
-rtx
-copy_to_mode_reg (mode, x)
- enum machine_mode mode;
- rtx x;
-{
- register rtx temp = gen_reg_rtx (mode);
-
- /* If not an operand, must be an address with PLUS and MULT so
- do the computation. */
- if (! general_operand (x, VOIDmode))
- x = force_operand (x, temp);
-
- if (GET_MODE (x) != mode && GET_MODE (x) != VOIDmode)
- abort ();
- if (x != temp)
- emit_move_insn (temp, x);
- return temp;
-}
-
-/* Load X into a register if it is not already one.
- Use mode MODE for the register.
- X should be valid for mode MODE, but it may be a constant which
- is valid for all integer modes; that's why caller must specify MODE.
-
- The caller must not alter the value in the register we return,
- since we mark it as a "constant" register. */
-
-rtx
-force_reg (mode, x)
- enum machine_mode mode;
- rtx x;
-{
- register rtx temp, insn, set;
-
- if (GET_CODE (x) == REG)
- return x;
- temp = gen_reg_rtx (mode);
- insn = emit_move_insn (temp, x);
-
- /* Let optimizers know that TEMP's value never changes
- and that X can be substituted for it. Don't get confused
- if INSN set something else (such as a SUBREG of TEMP). */
- if (CONSTANT_P (x)
- && (set = single_set (insn)) != 0
- && SET_DEST (set) == temp)
- {
- rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
- if (note)
- XEXP (note, 0) = x;
- else
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL, x, REG_NOTES (insn));
- }
- return temp;
-}
-
-/* If X is a memory ref, copy its contents to a new temp reg and return
- that reg. Otherwise, return X. */
-
-rtx
-force_not_mem (x)
- rtx x;
-{
- register rtx temp;
- if (GET_CODE (x) != MEM || GET_MODE (x) == BLKmode)
- return x;
- temp = gen_reg_rtx (GET_MODE (x));
- emit_move_insn (temp, x);
- return temp;
-}
-
-/* Copy X to TARGET (if it's nonzero and a reg)
- or to a new temp reg and return that reg.
- MODE is the mode to use for X in case it is a constant. */
-
-rtx
-copy_to_suggested_reg (x, target, mode)
- rtx x, target;
- enum machine_mode mode;
-{
- register rtx temp;
-
- if (target && GET_CODE (target) == REG)
- temp = target;
- else
- temp = gen_reg_rtx (mode);
-
- emit_move_insn (temp, x);
- return temp;
-}
-
-/* Return the mode to use to store a scalar of TYPE and MODE.
- PUNSIGNEDP points to the signedness of the type and may be adjusted
- to show what signedness to use on extension operations.
-
- FOR_CALL is non-zero if this call is promoting args for a call. */
-
-enum machine_mode
-promote_mode (type, mode, punsignedp, for_call)
- tree type;
- enum machine_mode mode;
- int *punsignedp;
- int for_call;
-{
- enum tree_code code = TREE_CODE (type);
- int unsignedp = *punsignedp;
-
-#ifdef PROMOTE_FOR_CALL_ONLY
- if (! for_call)
- return mode;
-#endif
-
- switch (code)
- {
-#ifdef PROMOTE_MODE
- case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
- case CHAR_TYPE: case REAL_TYPE: case OFFSET_TYPE:
- PROMOTE_MODE (mode, unsignedp, type);
- break;
-#endif
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- case REFERENCE_TYPE:
- case POINTER_TYPE:
- mode = Pmode;
- unsignedp = POINTERS_EXTEND_UNSIGNED;
- break;
-#endif
- }
-
- *punsignedp = unsignedp;
- return mode;
-}
-
-/* Adjust the stack pointer by ADJUST (an rtx for a number of bytes).
- This pops when ADJUST is positive. ADJUST need not be constant. */
-
-void
-adjust_stack (adjust)
- rtx adjust;
-{
- rtx temp;
- adjust = protect_from_queue (adjust, 0);
-
- if (adjust == const0_rtx)
- return;
-
- temp = expand_binop (Pmode,
-#ifdef STACK_GROWS_DOWNWARD
- add_optab,
-#else
- sub_optab,
-#endif
- stack_pointer_rtx, adjust, stack_pointer_rtx, 0,
- OPTAB_LIB_WIDEN);
-
- if (temp != stack_pointer_rtx)
- emit_move_insn (stack_pointer_rtx, temp);
-}
-
-/* Adjust the stack pointer by minus ADJUST (an rtx for a number of bytes).
- This pushes when ADJUST is positive. ADJUST need not be constant. */
-
-void
-anti_adjust_stack (adjust)
- rtx adjust;
-{
- rtx temp;
- adjust = protect_from_queue (adjust, 0);
-
- if (adjust == const0_rtx)
- return;
-
- temp = expand_binop (Pmode,
-#ifdef STACK_GROWS_DOWNWARD
- sub_optab,
-#else
- add_optab,
-#endif
- stack_pointer_rtx, adjust, stack_pointer_rtx, 0,
- OPTAB_LIB_WIDEN);
-
- if (temp != stack_pointer_rtx)
- emit_move_insn (stack_pointer_rtx, temp);
-}
-
-/* Round the size of a block to be pushed up to the boundary required
- by this machine. SIZE is the desired size, which need not be constant. */
-
-rtx
-round_push (size)
- rtx size;
-{
-#ifdef STACK_BOUNDARY
- int align = STACK_BOUNDARY / BITS_PER_UNIT;
- if (align == 1)
- return size;
- if (GET_CODE (size) == CONST_INT)
- {
- int new = (INTVAL (size) + align - 1) / align * align;
- if (INTVAL (size) != new)
- size = GEN_INT (new);
- }
- else
- {
- /* CEIL_DIV_EXPR needs to worry about the addition overflowing,
- but we know it can't. So add ourselves and then do
- TRUNC_DIV_EXPR. */
- size = expand_binop (Pmode, add_optab, size, GEN_INT (align - 1),
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
- size = expand_divmod (0, TRUNC_DIV_EXPR, Pmode, size, GEN_INT (align),
- NULL_RTX, 1);
- size = expand_mult (Pmode, size, GEN_INT (align), NULL_RTX, 1);
- }
-#endif /* STACK_BOUNDARY */
- return size;
-}
-
-/* Save the stack pointer for the purpose in SAVE_LEVEL. PSAVE is a pointer
- to a previously-created save area. If no save area has been allocated,
- this function will allocate one. If a save area is specified, it
- must be of the proper mode.
-
- The insns are emitted after insn AFTER, if nonzero, otherwise the insns
- are emitted at the current position. */
-
-void
-emit_stack_save (save_level, psave, after)
- enum save_level save_level;
- rtx *psave;
- rtx after;
-{
- rtx sa = *psave;
- /* The default is that we use a move insn and save in a Pmode object. */
- rtx (*fcn) () = gen_move_insn;
- enum machine_mode mode = Pmode;
-
- /* See if this machine has anything special to do for this kind of save. */
- switch (save_level)
- {
-#ifdef HAVE_save_stack_block
- case SAVE_BLOCK:
- if (HAVE_save_stack_block)
- {
- fcn = gen_save_stack_block;
- mode = insn_operand_mode[CODE_FOR_save_stack_block][0];
- }
- break;
-#endif
-#ifdef HAVE_save_stack_function
- case SAVE_FUNCTION:
- if (HAVE_save_stack_function)
- {
- fcn = gen_save_stack_function;
- mode = insn_operand_mode[CODE_FOR_save_stack_function][0];
- }
- break;
-#endif
-#ifdef HAVE_save_stack_nonlocal
- case SAVE_NONLOCAL:
- if (HAVE_save_stack_nonlocal)
- {
- fcn = gen_save_stack_nonlocal;
- mode = insn_operand_mode[(int) CODE_FOR_save_stack_nonlocal][0];
- }
- break;
-#endif
- }
-
- /* If there is no save area and we have to allocate one, do so. Otherwise
- verify the save area is the proper mode. */
-
- if (sa == 0)
- {
- if (mode != VOIDmode)
- {
- if (save_level == SAVE_NONLOCAL)
- *psave = sa = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
- else
- *psave = sa = gen_reg_rtx (mode);
- }
- }
- else
- {
- if (mode == VOIDmode || GET_MODE (sa) != mode)
- abort ();
- }
-
- if (after)
- {
- rtx seq;
-
- start_sequence ();
- /* We must validize inside the sequence, to ensure that any instructions
- created by the validize call also get moved to the right place. */
- if (sa != 0)
- sa = validize_mem (sa);
- emit_insn (fcn (sa, stack_pointer_rtx));
- seq = gen_sequence ();
- end_sequence ();
- emit_insn_after (seq, after);
- }
- else
- {
- if (sa != 0)
- sa = validize_mem (sa);
- emit_insn (fcn (sa, stack_pointer_rtx));
- }
-}
-
-/* Restore the stack pointer for the purpose in SAVE_LEVEL. SA is the save
- area made by emit_stack_save. If it is zero, we have nothing to do.
-
- Put any emitted insns after insn AFTER, if nonzero, otherwise at
- current position. */
-
-void
-emit_stack_restore (save_level, sa, after)
- enum save_level save_level;
- rtx after;
- rtx sa;
-{
- /* The default is that we use a move insn. */
- rtx (*fcn) () = gen_move_insn;
-
- /* See if this machine has anything special to do for this kind of save. */
- switch (save_level)
- {
-#ifdef HAVE_restore_stack_block
- case SAVE_BLOCK:
- if (HAVE_restore_stack_block)
- fcn = gen_restore_stack_block;
- break;
-#endif
-#ifdef HAVE_restore_stack_function
- case SAVE_FUNCTION:
- if (HAVE_restore_stack_function)
- fcn = gen_restore_stack_function;
- break;
-#endif
-#ifdef HAVE_restore_stack_nonlocal
-
- case SAVE_NONLOCAL:
- if (HAVE_restore_stack_nonlocal)
- fcn = gen_restore_stack_nonlocal;
- break;
-#endif
- }
-
- if (sa != 0)
- sa = validize_mem (sa);
-
- if (after)
- {
- rtx seq;
-
- start_sequence ();
- emit_insn (fcn (stack_pointer_rtx, sa));
- seq = gen_sequence ();
- end_sequence ();
- emit_insn_after (seq, after);
- }
- else
- emit_insn (fcn (stack_pointer_rtx, sa));
-}
-
-/* Return an rtx representing the address of an area of memory dynamically
- pushed on the stack. This region of memory is always aligned to
- a multiple of BIGGEST_ALIGNMENT.
-
- Any required stack pointer alignment is preserved.
-
- SIZE is an rtx representing the size of the area.
- TARGET is a place in which the address can be placed.
-
- KNOWN_ALIGN is the alignment (in bits) that we know SIZE has. */
-
-rtx
-allocate_dynamic_stack_space (size, target, known_align)
- rtx size;
- rtx target;
- int known_align;
-{
- /* If we're asking for zero bytes, it doesn't matter what we point
- to since we can't dereference it. But return a reasonable
- address anyway. */
- if (size == const0_rtx)
- return virtual_stack_dynamic_rtx;
-
- /* Otherwise, show we're calling alloca or equivalent. */
- current_function_calls_alloca = 1;
-
- /* Ensure the size is in the proper mode. */
- if (GET_MODE (size) != VOIDmode && GET_MODE (size) != Pmode)
- size = convert_to_mode (Pmode, size, 1);
-
- /* We will need to ensure that the address we return is aligned to
- BIGGEST_ALIGNMENT. If STACK_DYNAMIC_OFFSET is defined, we don't
- always know its final value at this point in the compilation (it
- might depend on the size of the outgoing parameter lists, for
- example), so we must align the value to be returned in that case.
- (Note that STACK_DYNAMIC_OFFSET will have a default non-zero value if
- STACK_POINTER_OFFSET or ACCUMULATE_OUTGOING_ARGS are defined).
- We must also do an alignment operation on the returned value if
- the stack pointer alignment is less strict that BIGGEST_ALIGNMENT.
-
- If we have to align, we must leave space in SIZE for the hole
- that might result from the alignment operation. */
-
-#if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET) || ! defined (STACK_BOUNDARY)
-#define MUST_ALIGN 1
-#else
-#define MUST_ALIGN (STACK_BOUNDARY < BIGGEST_ALIGNMENT)
-#endif
-
- if (MUST_ALIGN)
- {
- if (GET_CODE (size) == CONST_INT)
- size = GEN_INT (INTVAL (size)
- + (BIGGEST_ALIGNMENT / BITS_PER_UNIT - 1));
- else
- size = expand_binop (Pmode, add_optab, size,
- GEN_INT (BIGGEST_ALIGNMENT / BITS_PER_UNIT - 1),
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
- }
-
-#ifdef SETJMP_VIA_SAVE_AREA
- /* If setjmp restores regs from a save area in the stack frame,
- avoid clobbering the reg save area. Note that the offset of
- virtual_incoming_args_rtx includes the preallocated stack args space.
- It would be no problem to clobber that, but it's on the wrong side
- of the old save area. */
- {
- rtx dynamic_offset
- = expand_binop (Pmode, sub_optab, virtual_stack_dynamic_rtx,
- stack_pointer_rtx, NULL_RTX, 1, OPTAB_LIB_WIDEN);
- size = expand_binop (Pmode, add_optab, size, dynamic_offset,
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
- }
-#endif /* SETJMP_VIA_SAVE_AREA */
-
- /* Round the size to a multiple of the required stack alignment.
- Since the stack if presumed to be rounded before this allocation,
- this will maintain the required alignment.
-
- If the stack grows downward, we could save an insn by subtracting
- SIZE from the stack pointer and then aligning the stack pointer.
- The problem with this is that the stack pointer may be unaligned
- between the execution of the subtraction and alignment insns and
- some machines do not allow this. Even on those that do, some
- signal handlers malfunction if a signal should occur between those
- insns. Since this is an extremely rare event, we have no reliable
- way of knowing which systems have this problem. So we avoid even
- momentarily mis-aligning the stack. */
-
-#ifdef STACK_BOUNDARY
- /* If we added a variable amount to SIZE,
- we can no longer assume it is aligned. */
-#if !defined (SETJMP_VIA_SAVE_AREA)
- if (MUST_ALIGN || known_align % STACK_BOUNDARY != 0)
-#endif
- size = round_push (size);
-#endif
-
- do_pending_stack_adjust ();
-
- /* Don't use a TARGET that isn't a pseudo. */
- if (target == 0 || GET_CODE (target) != REG
- || REGNO (target) < FIRST_PSEUDO_REGISTER)
- target = gen_reg_rtx (Pmode);
-
- mark_reg_pointer (target, known_align / BITS_PER_UNIT);
-
-#ifndef STACK_GROWS_DOWNWARD
- emit_move_insn (target, virtual_stack_dynamic_rtx);
-#endif
-
- /* Perform the required allocation from the stack. Some systems do
- this differently than simply incrementing/decrementing from the
- stack pointer. */
-#ifdef HAVE_allocate_stack
- if (HAVE_allocate_stack)
- {
- enum machine_mode mode
- = insn_operand_mode[(int) CODE_FOR_allocate_stack][0];
-
- size = convert_modes (mode, ptr_mode, size, 1);
-
- if (insn_operand_predicate[(int) CODE_FOR_allocate_stack][0]
- && ! ((*insn_operand_predicate[(int) CODE_FOR_allocate_stack][0])
- (size, mode)))
- size = copy_to_mode_reg (mode, size);
-
- emit_insn (gen_allocate_stack (size));
- }
- else
-#endif
- {
- size = convert_modes (Pmode, ptr_mode, size, 1);
- anti_adjust_stack (size);
- }
-
-#ifdef STACK_GROWS_DOWNWARD
- emit_move_insn (target, virtual_stack_dynamic_rtx);
-#endif
-
- if (MUST_ALIGN)
- {
- /* CEIL_DIV_EXPR needs to worry about the addition overflowing,
- but we know it can't. So add ourselves and then do
- TRUNC_DIV_EXPR. */
- target = expand_binop (Pmode, add_optab, target,
- GEN_INT (BIGGEST_ALIGNMENT / BITS_PER_UNIT - 1),
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
- target = expand_divmod (0, TRUNC_DIV_EXPR, Pmode, target,
- GEN_INT (BIGGEST_ALIGNMENT / BITS_PER_UNIT),
- NULL_RTX, 1);
- target = expand_mult (Pmode, target,
- GEN_INT (BIGGEST_ALIGNMENT / BITS_PER_UNIT),
- NULL_RTX, 1);
- }
-
- /* Some systems require a particular insn to refer to the stack
- to make the pages exist. */
-#ifdef HAVE_probe
- if (HAVE_probe)
- emit_insn (gen_probe ());
-#endif
-
- /* Record the new stack level for nonlocal gotos. */
- if (nonlocal_goto_handler_slot != 0)
- emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level, NULL_RTX);
-
- return target;
-}
-
-/* Return an rtx representing the register or memory location
- in which a scalar value of data type VALTYPE
- was returned by a function call to function FUNC.
- FUNC is a FUNCTION_DECL node if the precise function is known,
- otherwise 0. */
-
-rtx
-hard_function_value (valtype, func)
- tree valtype;
- tree func;
-{
- rtx val = FUNCTION_VALUE (valtype, func);
- if (GET_CODE (val) == REG
- && GET_MODE (val) == BLKmode)
- {
- int bytes = int_size_in_bytes (valtype);
- enum machine_mode tmpmode;
- for (tmpmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- tmpmode != MAX_MACHINE_MODE;
- tmpmode = GET_MODE_WIDER_MODE (tmpmode))
- {
- /* Have we found a large enough mode? */
- if (GET_MODE_SIZE (tmpmode) >= bytes)
- break;
- }
-
- /* No suitable mode found. */
- if (tmpmode == MAX_MACHINE_MODE)
- abort ();
-
- PUT_MODE (val, tmpmode);
- }
- return val;
-}
-
-/* Return an rtx representing the register or memory location
- in which a scalar value of mode MODE was returned by a library call. */
-
-rtx
-hard_libcall_value (mode)
- enum machine_mode mode;
-{
- return LIBCALL_VALUE (mode);
-}
-
-/* Look up the tree code for a given rtx code
- to provide the arithmetic operation for REAL_ARITHMETIC.
- The function returns an int because the caller may not know
- what `enum tree_code' means. */
-
-int
-rtx_to_tree_code (code)
- enum rtx_code code;
-{
- enum tree_code tcode;
-
- switch (code)
- {
- case PLUS:
- tcode = PLUS_EXPR;
- break;
- case MINUS:
- tcode = MINUS_EXPR;
- break;
- case MULT:
- tcode = MULT_EXPR;
- break;
- case DIV:
- tcode = RDIV_EXPR;
- break;
- case SMIN:
- tcode = MIN_EXPR;
- break;
- case SMAX:
- tcode = MAX_EXPR;
- break;
- default:
- tcode = LAST_AND_UNUSED_TREE_CODE;
- break;
- }
- return ((int) tcode);
-}
diff --git a/gcc/expmed.c b/gcc/expmed.c
deleted file mode 100644
index 65fb007da57..00000000000
--- a/gcc/expmed.c
+++ /dev/null
@@ -1,4315 +0,0 @@
-/* Medium-level subroutines: convert bit-field store and extract
- and shifts, multiplies and divides to rtl instructions.
- Copyright (C) 1987, 88, 89, 92-6, 1997 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. */
-
-
-#include "config.h"
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "insn-flags.h"
-#include "insn-codes.h"
-#include "insn-config.h"
-#include "expr.h"
-#include "real.h"
-#include "recog.h"
-
-static void store_fixed_bit_field PROTO((rtx, int, int, int, rtx, int));
-static void store_split_bit_field PROTO((rtx, int, int, rtx, int));
-static rtx extract_fixed_bit_field PROTO((enum machine_mode, rtx, int,
- int, int, rtx, int, int));
-static rtx mask_rtx PROTO((enum machine_mode, int,
- int, int));
-static rtx lshift_value PROTO((enum machine_mode, rtx,
- int, int));
-static rtx extract_split_bit_field PROTO((rtx, int, int, int, int));
-
-#define CEIL(x,y) (((x) + (y) - 1) / (y))
-
-/* Non-zero means divides or modulus operations are relatively cheap for
- powers of two, so don't use branches; emit the operation instead.
- Usually, this will mean that the MD file will emit non-branch
- sequences. */
-
-static int sdiv_pow2_cheap, smod_pow2_cheap;
-
-#ifndef SLOW_UNALIGNED_ACCESS
-#define SLOW_UNALIGNED_ACCESS STRICT_ALIGNMENT
-#endif
-
-/* For compilers that support multiple targets with different word sizes,
- MAX_BITS_PER_WORD contains the biggest value of BITS_PER_WORD. An example
- is the H8/300(H) compiler. */
-
-#ifndef MAX_BITS_PER_WORD
-#define MAX_BITS_PER_WORD BITS_PER_WORD
-#endif
-
-/* Cost of various pieces of RTL. Note that some of these are indexed by shift count,
- and some by mode. */
-static int add_cost, negate_cost, zero_cost;
-static int shift_cost[MAX_BITS_PER_WORD];
-static int shiftadd_cost[MAX_BITS_PER_WORD];
-static int shiftsub_cost[MAX_BITS_PER_WORD];
-static int mul_cost[NUM_MACHINE_MODES];
-static int div_cost[NUM_MACHINE_MODES];
-static int mul_widen_cost[NUM_MACHINE_MODES];
-static int mul_highpart_cost[NUM_MACHINE_MODES];
-
-void
-init_expmed ()
-{
- char *free_point;
- /* This is "some random pseudo register" for purposes of calling recog
- to see what insns exist. */
- rtx reg = gen_rtx (REG, word_mode, 10000);
- rtx shift_insn, shiftadd_insn, shiftsub_insn;
- int dummy;
- int m;
- enum machine_mode mode, wider_mode;
-
- start_sequence ();
-
- /* Since we are on the permanent obstack, we must be sure we save this
- spot AFTER we call start_sequence, since it will reuse the rtl it
- makes. */
-
- free_point = (char *) oballoc (0);
-
- zero_cost = rtx_cost (const0_rtx, 0);
- add_cost = rtx_cost (gen_rtx (PLUS, word_mode, reg, reg), SET);
-
- shift_insn = emit_insn (gen_rtx (SET, VOIDmode, reg,
- gen_rtx (ASHIFT, word_mode, reg,
- const0_rtx)));
-
- shiftadd_insn = emit_insn (gen_rtx (SET, VOIDmode, reg,
- gen_rtx (PLUS, word_mode,
- gen_rtx (MULT, word_mode,
- reg, const0_rtx),
- reg)));
-
- shiftsub_insn = emit_insn (gen_rtx (SET, VOIDmode, reg,
- gen_rtx (MINUS, word_mode,
- gen_rtx (MULT, word_mode,
- reg, const0_rtx),
- reg)));
-
- init_recog ();
-
- shift_cost[0] = 0;
- shiftadd_cost[0] = shiftsub_cost[0] = add_cost;
-
- for (m = 1; m < BITS_PER_WORD; m++)
- {
- shift_cost[m] = shiftadd_cost[m] = shiftsub_cost[m] = 32000;
-
- XEXP (SET_SRC (PATTERN (shift_insn)), 1) = GEN_INT (m);
- if (recog (PATTERN (shift_insn), shift_insn, &dummy) >= 0)
- shift_cost[m] = rtx_cost (SET_SRC (PATTERN (shift_insn)), SET);
-
- XEXP (XEXP (SET_SRC (PATTERN (shiftadd_insn)), 0), 1)
- = GEN_INT ((HOST_WIDE_INT) 1 << m);
- if (recog (PATTERN (shiftadd_insn), shiftadd_insn, &dummy) >= 0)
- shiftadd_cost[m] = rtx_cost (SET_SRC (PATTERN (shiftadd_insn)), SET);
-
- XEXP (XEXP (SET_SRC (PATTERN (shiftsub_insn)), 0), 1)
- = GEN_INT ((HOST_WIDE_INT) 1 << m);
- if (recog (PATTERN (shiftsub_insn), shiftsub_insn, &dummy) >= 0)
- shiftsub_cost[m] = rtx_cost (SET_SRC (PATTERN (shiftsub_insn)), SET);
- }
-
- negate_cost = rtx_cost (gen_rtx (NEG, word_mode, reg), SET);
-
- sdiv_pow2_cheap
- = (rtx_cost (gen_rtx (DIV, word_mode, reg, GEN_INT (32)), SET)
- <= 2 * add_cost);
- smod_pow2_cheap
- = (rtx_cost (gen_rtx (MOD, word_mode, reg, GEN_INT (32)), SET)
- <= 2 * add_cost);
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- {
- reg = gen_rtx (REG, mode, 10000);
- div_cost[(int) mode] = rtx_cost (gen_rtx (UDIV, mode, reg, reg), SET);
- mul_cost[(int) mode] = rtx_cost (gen_rtx (MULT, mode, reg, reg), SET);
- wider_mode = GET_MODE_WIDER_MODE (mode);
- if (wider_mode != VOIDmode)
- {
- mul_widen_cost[(int) wider_mode]
- = rtx_cost (gen_rtx (MULT, wider_mode,
- gen_rtx (ZERO_EXTEND, wider_mode, reg),
- gen_rtx (ZERO_EXTEND, wider_mode, reg)),
- SET);
- mul_highpart_cost[(int) mode]
- = rtx_cost (gen_rtx (TRUNCATE, mode,
- gen_rtx (LSHIFTRT, wider_mode,
- gen_rtx (MULT, wider_mode,
- gen_rtx (ZERO_EXTEND, wider_mode, reg),
- gen_rtx (ZERO_EXTEND, wider_mode, reg)),
- GEN_INT (GET_MODE_BITSIZE (mode)))),
- SET);
- }
- }
-
- /* Free the objects we just allocated. */
- end_sequence ();
- obfree (free_point);
-}
-
-/* Return an rtx representing minus the value of X.
- MODE is the intended mode of the result,
- useful if X is a CONST_INT. */
-
-rtx
-negate_rtx (mode, x)
- enum machine_mode mode;
- rtx x;
-{
- rtx result = simplify_unary_operation (NEG, mode, x, mode);
-
- if (result == 0)
- result = expand_unop (mode, neg_optab, x, NULL_RTX, 0);
-
- return result;
-}
-
-/* Generate code to store value from rtx VALUE
- into a bit-field within structure STR_RTX
- containing BITSIZE bits starting at bit BITNUM.
- FIELDMODE is the machine-mode of the FIELD_DECL node for this field.
- ALIGN is the alignment that STR_RTX is known to have, measured in bytes.
- TOTAL_SIZE is the size of the structure in bytes, or -1 if varying. */
-
-/* ??? Note that there are two different ideas here for how
- to determine the size to count bits within, for a register.
- One is BITS_PER_WORD, and the other is the size of operand 3
- of the insv pattern. (The latter assumes that an n-bit machine
- will be able to insert bit fields up to n bits wide.)
- It isn't certain that either of these is right.
- extract_bit_field has the same quandary. */
-
-rtx
-store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size)
- rtx str_rtx;
- register int bitsize;
- int bitnum;
- enum machine_mode fieldmode;
- rtx value;
- int align;
- int total_size;
-{
- int unit = (GET_CODE (str_rtx) == MEM) ? BITS_PER_UNIT : BITS_PER_WORD;
- register int offset = bitnum / unit;
- register int bitpos = bitnum % unit;
- register rtx op0 = str_rtx;
-
- if (GET_CODE (str_rtx) == MEM && ! MEM_IN_STRUCT_P (str_rtx))
- abort ();
-
- /* Discount the part of the structure before the desired byte.
- We need to know how many bytes are safe to reference after it. */
- if (total_size >= 0)
- total_size -= (bitpos / BIGGEST_ALIGNMENT
- * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
-
- while (GET_CODE (op0) == SUBREG)
- {
- /* The following line once was done only if WORDS_BIG_ENDIAN,
- but I think that is a mistake. WORDS_BIG_ENDIAN is
- meaningful at a much higher level; when structures are copied
- between memory and regs, the higher-numbered regs
- always get higher addresses. */
- offset += SUBREG_WORD (op0);
- /* We used to adjust BITPOS here, but now we do the whole adjustment
- right after the loop. */
- op0 = SUBREG_REG (op0);
- }
-
- /* If OP0 is a register, BITPOS must count within a word.
- But as we have it, it counts within whatever size OP0 now has.
- On a bigendian machine, these are not the same, so convert. */
- if (BYTES_BIG_ENDIAN
- && GET_CODE (op0) != MEM
- && unit > GET_MODE_BITSIZE (GET_MODE (op0)))
- bitpos += unit - GET_MODE_BITSIZE (GET_MODE (op0));
-
- value = protect_from_queue (value, 0);
-
- if (flag_force_mem)
- value = force_not_mem (value);
-
- /* Note that the adjustment of BITPOS above has no effect on whether
- BITPOS is 0 in a REG bigger than a word. */
- if (GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
- && (GET_CODE (op0) != MEM
- || ! SLOW_UNALIGNED_ACCESS
- || (offset * BITS_PER_UNIT % bitsize == 0
- && align % GET_MODE_SIZE (fieldmode) == 0))
- && bitpos == 0 && bitsize == GET_MODE_BITSIZE (fieldmode))
- {
- /* Storing in a full-word or multi-word field in a register
- can be done with just SUBREG. */
- if (GET_MODE (op0) != fieldmode)
- {
- if (GET_CODE (op0) == REG)
- op0 = gen_rtx (SUBREG, fieldmode, op0, offset);
- else
- op0 = change_address (op0, fieldmode,
- plus_constant (XEXP (op0, 0), offset));
- }
- emit_move_insn (op0, value);
- return value;
- }
-
- /* Storing an lsb-aligned field in a register
- can be done with a movestrict instruction. */
-
- if (GET_CODE (op0) != MEM
- && (BYTES_BIG_ENDIAN ? bitpos + bitsize == unit : bitpos == 0)
- && bitsize == GET_MODE_BITSIZE (fieldmode)
- && (GET_MODE (op0) == fieldmode
- || (movstrict_optab->handlers[(int) fieldmode].insn_code
- != CODE_FOR_nothing)))
- {
- /* Get appropriate low part of the value being stored. */
- if (GET_CODE (value) == CONST_INT || GET_CODE (value) == REG)
- value = gen_lowpart (fieldmode, value);
- else if (!(GET_CODE (value) == SYMBOL_REF
- || GET_CODE (value) == LABEL_REF
- || GET_CODE (value) == CONST))
- value = convert_to_mode (fieldmode, value, 0);
-
- if (GET_MODE (op0) == fieldmode)
- emit_move_insn (op0, value);
- else
- {
- int icode = movstrict_optab->handlers[(int) fieldmode].insn_code;
- if(! (*insn_operand_predicate[icode][1]) (value, fieldmode))
- value = copy_to_mode_reg (fieldmode, value);
- emit_insn (GEN_FCN (icode)
- (gen_rtx (SUBREG, fieldmode, op0, offset), value));
- }
- return value;
- }
-
- /* Handle fields bigger than a word. */
-
- if (bitsize > BITS_PER_WORD)
- {
- /* Here we transfer the words of the field
- in the order least significant first.
- This is because the most significant word is the one which may
- be less than full.
- However, only do that if the value is not BLKmode. */
-
- int backwards = WORDS_BIG_ENDIAN && fieldmode != BLKmode;
-
- int nwords = (bitsize + (BITS_PER_WORD - 1)) / BITS_PER_WORD;
- int i;
-
- /* This is the mode we must force value to, so that there will be enough
- subwords to extract. Note that fieldmode will often (always?) be
- VOIDmode, because that is what store_field uses to indicate that this
- is a bit field, but passing VOIDmode to operand_subword_force will
- result in an abort. */
- fieldmode = mode_for_size (nwords * BITS_PER_WORD, MODE_INT, 0);
-
- for (i = 0; i < nwords; i++)
- {
- /* If I is 0, use the low-order word in both field and target;
- if I is 1, use the next to lowest word; and so on. */
- int wordnum = (backwards ? nwords - i - 1 : i);
- int bit_offset = (backwards
- ? MAX (bitsize - (i + 1) * BITS_PER_WORD, 0)
- : i * BITS_PER_WORD);
- store_bit_field (op0, MIN (BITS_PER_WORD,
- bitsize - i * BITS_PER_WORD),
- bitnum + bit_offset, word_mode,
- operand_subword_force (value, wordnum,
- (GET_MODE (value) == VOIDmode
- ? fieldmode
- : GET_MODE (value))),
- align, total_size);
- }
- return value;
- }
-
- /* From here on we can assume that the field to be stored in is
- a full-word (whatever type that is), since it is shorter than a word. */
-
- /* OFFSET is the number of words or bytes (UNIT says which)
- from STR_RTX to the first word or byte containing part of the field. */
-
- if (GET_CODE (op0) == REG)
- {
- if (offset != 0
- || GET_MODE_SIZE (GET_MODE (op0)) > UNITS_PER_WORD)
- op0 = gen_rtx (SUBREG, TYPE_MODE (type_for_size (BITS_PER_WORD, 0)),
- op0, offset);
- offset = 0;
- }
- else
- {
- op0 = protect_from_queue (op0, 1);
- }
-
- /* If VALUE is a floating-point mode, access it as an integer of the
- corresponding size. This can occur on a machine with 64 bit registers
- that uses SFmode for float. This can also occur for unaligned float
- structure fields. */
- if (GET_MODE_CLASS (GET_MODE (value)) == MODE_FLOAT)
- {
- if (GET_CODE (value) != REG)
- value = copy_to_reg (value);
- value = gen_rtx (SUBREG, word_mode, value, 0);
- }
-
- /* Now OFFSET is nonzero only if OP0 is memory
- and is therefore always measured in bytes. */
-
-#ifdef HAVE_insv
- if (HAVE_insv
- && GET_MODE (value) != BLKmode
- && !(bitsize == 1 && GET_CODE (value) == CONST_INT)
- /* Ensure insv's size is wide enough for this field. */
- && (GET_MODE_BITSIZE (insn_operand_mode[(int) CODE_FOR_insv][3])
- >= bitsize)
- && ! ((GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG)
- && (bitsize + bitpos
- > GET_MODE_BITSIZE (insn_operand_mode[(int) CODE_FOR_insv][3]))))
- {
- int xbitpos = bitpos;
- rtx value1;
- rtx xop0 = op0;
- rtx last = get_last_insn ();
- rtx pat;
- enum machine_mode maxmode
- = insn_operand_mode[(int) CODE_FOR_insv][3];
-
- int save_volatile_ok = volatile_ok;
- volatile_ok = 1;
-
- /* If this machine's insv can only insert into a register, copy OP0
- into a register and save it back later. */
- /* This used to check flag_force_mem, but that was a serious
- de-optimization now that flag_force_mem is enabled by -O2. */
- if (GET_CODE (op0) == MEM
- && ! ((*insn_operand_predicate[(int) CODE_FOR_insv][0])
- (op0, VOIDmode)))
- {
- rtx tempreg;
- enum machine_mode bestmode;
-
- /* Get the mode to use for inserting into this field. If OP0 is
- BLKmode, get the smallest mode consistent with the alignment. If
- OP0 is a non-BLKmode object that is no wider than MAXMODE, use its
- mode. Otherwise, use the smallest mode containing the field. */
-
- if (GET_MODE (op0) == BLKmode
- || GET_MODE_SIZE (GET_MODE (op0)) > GET_MODE_SIZE (maxmode))
- bestmode
- = get_best_mode (bitsize, bitnum, align * BITS_PER_UNIT, maxmode,
- MEM_VOLATILE_P (op0));
- else
- bestmode = GET_MODE (op0);
-
- if (bestmode == VOIDmode
- || (SLOW_UNALIGNED_ACCESS && GET_MODE_SIZE (bestmode) > align))
- goto insv_loses;
-
- /* Adjust address to point to the containing unit of that mode. */
- unit = GET_MODE_BITSIZE (bestmode);
- /* Compute offset as multiple of this unit, counting in bytes. */
- offset = (bitnum / unit) * GET_MODE_SIZE (bestmode);
- bitpos = bitnum % unit;
- op0 = change_address (op0, bestmode,
- plus_constant (XEXP (op0, 0), offset));
-
- /* 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,
- align, total_size);
- emit_move_insn (op0, tempreg);
- return value;
- }
- volatile_ok = save_volatile_ok;
-
- /* Add OFFSET into OP0's address. */
- if (GET_CODE (xop0) == MEM)
- xop0 = change_address (xop0, byte_mode,
- plus_constant (XEXP (xop0, 0), offset));
-
- /* If xop0 is a register, we need it in MAXMODE
- to make it acceptable to the format of insv. */
- if (GET_CODE (xop0) == SUBREG)
- /* We can't just change the mode, because this might clobber op0,
- and we will need the original value of op0 if insv fails. */
- xop0 = gen_rtx (SUBREG, maxmode, SUBREG_REG (xop0), SUBREG_WORD (xop0));
- if (GET_CODE (xop0) == REG && GET_MODE (xop0) != maxmode)
- xop0 = gen_rtx (SUBREG, maxmode, xop0, 0);
-
- /* On big-endian machines, we count bits from the most significant.
- If the bit field insn does not, we must invert. */
-
- if (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN)
- xbitpos = unit - bitsize - xbitpos;
-
- /* We have been counting XBITPOS within UNIT.
- Count instead within the size of the register. */
- if (BITS_BIG_ENDIAN && GET_CODE (xop0) != MEM)
- xbitpos += GET_MODE_BITSIZE (maxmode) - unit;
-
- unit = GET_MODE_BITSIZE (maxmode);
-
- /* Convert VALUE to maxmode (which insv insn wants) in VALUE1. */
- value1 = value;
- if (GET_MODE (value) != maxmode)
- {
- if (GET_MODE_BITSIZE (GET_MODE (value)) >= bitsize)
- {
- /* Optimization: Don't bother really extending VALUE
- if it has all the bits we will actually use. However,
- if we must narrow it, be sure we do it correctly. */
-
- if (GET_MODE_SIZE (GET_MODE (value)) < GET_MODE_SIZE (maxmode))
- {
- /* Avoid making subreg of a subreg, or of a mem. */
- if (GET_CODE (value1) != REG)
- value1 = copy_to_reg (value1);
- value1 = gen_rtx (SUBREG, maxmode, value1, 0);
- }
- else
- value1 = gen_lowpart (maxmode, value1);
- }
- else if (!CONSTANT_P (value))
- /* Parse phase is supposed to make VALUE's data type
- match that of the component reference, which is a type
- at least as wide as the field; so VALUE should have
- a mode that corresponds to that type. */
- abort ();
- }
-
- /* If this machine's insv insists on a register,
- get VALUE1 into a register. */
- if (! ((*insn_operand_predicate[(int) CODE_FOR_insv][3])
- (value1, maxmode)))
- value1 = force_reg (maxmode, value1);
-
- pat = gen_insv (xop0, GEN_INT (bitsize), GEN_INT (xbitpos), value1);
- if (pat)
- emit_insn (pat);
- else
- {
- delete_insns_since (last);
- store_fixed_bit_field (op0, offset, bitsize, bitpos, value, align);
- }
- }
- else
- insv_loses:
-#endif
- /* Insv is not available; store using shifts and boolean ops. */
- store_fixed_bit_field (op0, offset, bitsize, bitpos, value, align);
- return value;
-}
-
-/* Use shifts and boolean operations to store VALUE
- into a bit field of width BITSIZE
- in a memory location specified by OP0 except offset by OFFSET bytes.
- (OFFSET must be 0 if OP0 is a register.)
- The field starts at position BITPOS within the byte.
- (If OP0 is a register, it may be a full word or a narrower mode,
- but BITPOS still counts within a full word,
- which is significant on bigendian machines.)
- STRUCT_ALIGN is the alignment the structure is known to have (in bytes).
-
- Note that protect_from_queue has already been done on OP0 and VALUE. */
-
-static void
-store_fixed_bit_field (op0, offset, bitsize, bitpos, value, struct_align)
- register rtx op0;
- register int offset, bitsize, bitpos;
- register rtx value;
- int struct_align;
-{
- register enum machine_mode mode;
- int total_bits = BITS_PER_WORD;
- rtx subtarget, temp;
- int all_zero = 0;
- int all_one = 0;
-
- if (! SLOW_UNALIGNED_ACCESS)
- struct_align = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
-
- /* There is a case not handled here:
- a structure with a known alignment of just a halfword
- and a field split across two aligned halfwords within the structure.
- Or likewise a structure with a known alignment of just a byte
- and a field split across two bytes.
- Such cases are not supposed to be able to occur. */
-
- if (GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG)
- {
- if (offset != 0)
- abort ();
- /* Special treatment for a bit field split across two registers. */
- if (bitsize + bitpos > BITS_PER_WORD)
- {
- store_split_bit_field (op0, bitsize, bitpos,
- value, BITS_PER_WORD);
- return;
- }
- }
- else
- {
- /* Get the proper mode to use for this field. We want a mode that
- includes the entire field. If such a mode would be larger than
- a word, we won't be doing the extraction the normal way. */
-
- mode = get_best_mode (bitsize, bitpos + offset * BITS_PER_UNIT,
- struct_align * BITS_PER_UNIT, word_mode,
- GET_CODE (op0) == MEM && MEM_VOLATILE_P (op0));
-
- if (mode == VOIDmode)
- {
- /* The only way this should occur is if the field spans word
- boundaries. */
- store_split_bit_field (op0,
- bitsize, bitpos + offset * BITS_PER_UNIT,
- value, struct_align);
- return;
- }
-
- total_bits = GET_MODE_BITSIZE (mode);
-
- /* Make sure bitpos is valid for the chosen mode. Adjust BITPOS to
- be be in the range 0 to total_bits-1, and put any excess bytes in
- OFFSET. */
- if (bitpos >= total_bits)
- {
- offset += (bitpos / total_bits) * (total_bits / BITS_PER_UNIT);
- bitpos -= ((bitpos / total_bits) * (total_bits / BITS_PER_UNIT)
- * BITS_PER_UNIT);
- }
-
- /* Get ref to an aligned byte, halfword, or word containing the field.
- Adjust BITPOS to be position within a word,
- and OFFSET to be the offset of that word.
- Then alter OP0 to refer to that word. */
- bitpos += (offset % (total_bits / BITS_PER_UNIT)) * BITS_PER_UNIT;
- offset -= (offset % (total_bits / BITS_PER_UNIT));
- op0 = change_address (op0, mode,
- plus_constant (XEXP (op0, 0), offset));
- }
-
- mode = GET_MODE (op0);
-
- /* Now MODE is either some integral mode for a MEM as OP0,
- or is a full-word for a REG as OP0. TOTAL_BITS corresponds.
- The bit field is contained entirely within OP0.
- BITPOS is the starting bit number within OP0.
- (OP0's mode may actually be narrower than MODE.) */
-
- if (BYTES_BIG_ENDIAN)
- /* BITPOS is the distance between our msb
- and that of the containing datum.
- Convert it to the distance from the lsb. */
- bitpos = total_bits - bitsize - bitpos;
-
- /* Now BITPOS is always the distance between our lsb
- and that of OP0. */
-
- /* Shift VALUE left by BITPOS bits. If VALUE is not constant,
- we must first convert its mode to MODE. */
-
- if (GET_CODE (value) == CONST_INT)
- {
- register HOST_WIDE_INT v = INTVAL (value);
-
- if (bitsize < HOST_BITS_PER_WIDE_INT)
- v &= ((HOST_WIDE_INT) 1 << bitsize) - 1;
-
- if (v == 0)
- all_zero = 1;
- else if ((bitsize < HOST_BITS_PER_WIDE_INT
- && v == ((HOST_WIDE_INT) 1 << bitsize) - 1)
- || (bitsize == HOST_BITS_PER_WIDE_INT && v == -1))
- all_one = 1;
-
- value = lshift_value (mode, value, bitpos, bitsize);
- }
- else
- {
- int must_and = (GET_MODE_BITSIZE (GET_MODE (value)) != bitsize
- && bitpos + bitsize != GET_MODE_BITSIZE (mode));
-
- if (GET_MODE (value) != mode)
- {
- if ((GET_CODE (value) == REG || GET_CODE (value) == SUBREG)
- && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (value)))
- value = gen_lowpart (mode, value);
- else
- value = convert_to_mode (mode, value, 1);
- }
-
- if (must_and)
- value = expand_binop (mode, and_optab, value,
- mask_rtx (mode, 0, bitsize, 0),
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
- if (bitpos > 0)
- value = expand_shift (LSHIFT_EXPR, mode, value,
- build_int_2 (bitpos, 0), NULL_RTX, 1);
- }
-
- /* Now clear the chosen bits in OP0,
- except that if VALUE is -1 we need not bother. */
-
- subtarget = (GET_CODE (op0) == REG || ! flag_force_mem) ? op0 : 0;
-
- if (! all_one)
- {
- temp = expand_binop (mode, and_optab, op0,
- mask_rtx (mode, bitpos, bitsize, 1),
- subtarget, 1, OPTAB_LIB_WIDEN);
- subtarget = temp;
- }
- else
- temp = op0;
-
- /* Now logical-or VALUE into OP0, unless it is zero. */
-
- if (! all_zero)
- temp = expand_binop (mode, ior_optab, temp, value,
- subtarget, 1, OPTAB_LIB_WIDEN);
- if (op0 != temp)
- emit_move_insn (op0, temp);
-}
-
-/* Store a bit field that is split across multiple accessible memory objects.
-
- OP0 is the REG, SUBREG or MEM rtx for the first of the objects.
- BITSIZE is the field width; BITPOS the position of its first bit
- (within the word).
- VALUE is the value to store.
- ALIGN is the known alignment of OP0, measured in bytes.
- This is also the size of the memory objects to be used.
-
- This does not yet handle fields wider than BITS_PER_WORD. */
-
-static void
-store_split_bit_field (op0, bitsize, bitpos, value, align)
- rtx op0;
- int bitsize, bitpos;
- rtx value;
- int align;
-{
- int unit;
- int bitsdone = 0;
-
- /* Make sure UNIT isn't larger than BITS_PER_WORD, we can only handle that
- much at a time. */
- if (GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG)
- unit = BITS_PER_WORD;
- else
- unit = MIN (align * BITS_PER_UNIT, BITS_PER_WORD);
-
- /* If VALUE is a constant other than a CONST_INT, get it into a register in
- WORD_MODE. If we can do this using gen_lowpart_common, do so. Note
- that VALUE might be a floating-point constant. */
- if (CONSTANT_P (value) && GET_CODE (value) != CONST_INT)
- {
- rtx word = gen_lowpart_common (word_mode, value);
-
- if (word && (value != word))
- value = word;
- else
- value = gen_lowpart_common (word_mode,
- force_reg (GET_MODE (value) != VOIDmode
- ? GET_MODE (value)
- : word_mode, value));
- }
-
- while (bitsdone < bitsize)
- {
- int thissize;
- rtx part, word;
- int thispos;
- int offset;
-
- offset = (bitpos + bitsdone) / unit;
- thispos = (bitpos + bitsdone) % unit;
-
- /* THISSIZE must not overrun a word boundary. Otherwise,
- store_fixed_bit_field will call us again, and we will mutually
- recurse forever. */
- thissize = MIN (bitsize - bitsdone, BITS_PER_WORD);
- thissize = MIN (thissize, unit - thispos);
-
- if (BYTES_BIG_ENDIAN)
- {
- int total_bits;
-
- /* We must do an endian conversion exactly the same way as it is
- done in extract_bit_field, so that the two calls to
- extract_fixed_bit_field will have comparable arguments. */
- if (GET_CODE (value) != MEM || GET_MODE (value) == BLKmode)
- total_bits = BITS_PER_WORD;
- else
- total_bits = GET_MODE_BITSIZE (GET_MODE (value));
-
- /* Fetch successively less significant portions. */
- if (GET_CODE (value) == CONST_INT)
- part = GEN_INT (((unsigned HOST_WIDE_INT) (INTVAL (value))
- >> (bitsize - bitsdone - thissize))
- & (((HOST_WIDE_INT) 1 << thissize) - 1));
- else
- /* The args are chosen so that the last part includes the
- lsb. Give extract_bit_field the value it needs (with
- endianness compensation) to fetch the piece we want.
-
- ??? We have no idea what the alignment of VALUE is, so
- we have to use a guess. */
- part
- = extract_fixed_bit_field
- (word_mode, value, 0, thissize,
- total_bits - bitsize + bitsdone, NULL_RTX, 1,
- GET_MODE (value) == VOIDmode
- ? UNITS_PER_WORD
- : (GET_MODE (value) == BLKmode
- ? 1
- : GET_MODE_ALIGNMENT (GET_MODE (value)) / BITS_PER_UNIT));
- }
- else
- {
- /* Fetch successively more significant portions. */
- if (GET_CODE (value) == CONST_INT)
- part = GEN_INT (((unsigned HOST_WIDE_INT) (INTVAL (value))
- >> bitsdone)
- & (((HOST_WIDE_INT) 1 << thissize) - 1));
- else
- part
- = extract_fixed_bit_field
- (word_mode, value, 0, thissize, bitsdone, NULL_RTX, 1,
- GET_MODE (value) == VOIDmode
- ? UNITS_PER_WORD
- : (GET_MODE (value) == BLKmode
- ? 1
- : GET_MODE_ALIGNMENT (GET_MODE (value)) / BITS_PER_UNIT));
- }
-
- /* If OP0 is a register, then handle OFFSET here.
-
- When handling multiword bitfields, extract_bit_field may pass
- down a word_mode SUBREG of a larger REG for a bitfield that actually
- crosses a word boundary. Thus, for a SUBREG, we must find
- the current word starting from the base register. */
- if (GET_CODE (op0) == SUBREG)
- {
- word = operand_subword_force (SUBREG_REG (op0),
- SUBREG_WORD (op0) + offset,
- GET_MODE (SUBREG_REG (op0)));
- offset = 0;
- }
- else if (GET_CODE (op0) == REG)
- {
- word = operand_subword_force (op0, offset, GET_MODE (op0));
- offset = 0;
- }
- else
- word = op0;
-
- /* OFFSET is in UNITs, and UNIT is in bits.
- store_fixed_bit_field wants offset in bytes. */
- store_fixed_bit_field (word, offset * unit / BITS_PER_UNIT,
- thissize, thispos, part, align);
- bitsdone += thissize;
- }
-}
-
-/* Generate code to extract a byte-field from STR_RTX
- containing BITSIZE bits, starting at BITNUM,
- and put it in TARGET if possible (if TARGET is nonzero).
- Regardless of TARGET, we return the rtx for where the value is placed.
- It may be a QUEUED.
-
- STR_RTX is the structure containing the byte (a REG or MEM).
- UNSIGNEDP is nonzero if this is an unsigned bit field.
- MODE is the natural mode of the field value once extracted.
- TMODE is the mode the caller would like the value to have;
- but the value may be returned with type MODE instead.
-
- ALIGN is the alignment that STR_RTX is known to have, measured in bytes.
- TOTAL_SIZE is the size in bytes of the containing structure,
- or -1 if varying.
-
- If a TARGET is specified and we can store in it at no extra cost,
- we do so, and return TARGET.
- Otherwise, we return a REG of mode TMODE or MODE, with TMODE preferred
- if they are equally easy. */
-
-rtx
-extract_bit_field (str_rtx, bitsize, bitnum, unsignedp,
- target, mode, tmode, align, total_size)
- rtx str_rtx;
- register int bitsize;
- int bitnum;
- int unsignedp;
- rtx target;
- enum machine_mode mode, tmode;
- int align;
- int total_size;
-{
- int unit = (GET_CODE (str_rtx) == MEM) ? BITS_PER_UNIT : BITS_PER_WORD;
- register int offset = bitnum / unit;
- register int bitpos = bitnum % unit;
- register rtx op0 = str_rtx;
- rtx spec_target = target;
- rtx spec_target_subreg = 0;
-
- /* Discount the part of the structure before the desired byte.
- We need to know how many bytes are safe to reference after it. */
- if (total_size >= 0)
- total_size -= (bitpos / BIGGEST_ALIGNMENT
- * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
-
- if (tmode == VOIDmode)
- tmode = mode;
- while (GET_CODE (op0) == SUBREG)
- {
- int outer_size = GET_MODE_BITSIZE (GET_MODE (op0));
- int inner_size = GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0)));
-
- offset += SUBREG_WORD (op0);
-
- if (BYTES_BIG_ENDIAN && (outer_size < inner_size))
- {
- bitpos += inner_size - outer_size;
- if (bitpos > unit)
- {
- offset += (bitpos / unit);
- bitpos %= unit;
- }
- }
-
- op0 = SUBREG_REG (op0);
- }
-
- /* ??? We currently assume TARGET is at least as big as BITSIZE.
- If that's wrong, the solution is to test for it and set TARGET to 0
- if needed. */
-
- /* If OP0 is a register, BITPOS must count within a word.
- But as we have it, it counts within whatever size OP0 now has.
- On a bigendian machine, these are not the same, so convert. */
- if (BYTES_BIG_ENDIAN &&
- GET_CODE (op0) != MEM
- && unit > GET_MODE_BITSIZE (GET_MODE (op0)))
- bitpos += unit - GET_MODE_BITSIZE (GET_MODE (op0));
-
- /* Extracting a full-word or multi-word value
- from a structure in a register or aligned memory.
- This can be done with just SUBREG.
- So too extracting a subword value in
- the least significant part of the register. */
-
- if (((GET_CODE (op0) == REG
- && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
- GET_MODE_BITSIZE (GET_MODE (op0))))
- || (GET_CODE (op0) == MEM
- && (! SLOW_UNALIGNED_ACCESS
- || (offset * BITS_PER_UNIT % bitsize == 0
- && align * BITS_PER_UNIT % bitsize == 0))))
- && ((bitsize >= BITS_PER_WORD && bitsize == GET_MODE_BITSIZE (mode)
- && bitpos % BITS_PER_WORD == 0)
- || (mode_for_size (bitsize, GET_MODE_CLASS (tmode), 0) != BLKmode
- && (BYTES_BIG_ENDIAN
- ? bitpos + bitsize == BITS_PER_WORD
- : bitpos == 0))))
- {
- enum machine_mode mode1
- = mode_for_size (bitsize, GET_MODE_CLASS (tmode), 0);
-
- if (mode1 != GET_MODE (op0))
- {
- if (GET_CODE (op0) == REG)
- op0 = gen_rtx (SUBREG, mode1, op0, offset);
- else
- op0 = change_address (op0, mode1,
- plus_constant (XEXP (op0, 0), offset));
- }
- if (mode1 != mode)
- return convert_to_mode (tmode, op0, unsignedp);
- return op0;
- }
-
- /* Handle fields bigger than a word. */
-
- if (bitsize > BITS_PER_WORD)
- {
- /* Here we transfer the words of the field
- in the order least significant first.
- This is because the most significant word is the one which may
- be less than full. */
-
- int nwords = (bitsize + (BITS_PER_WORD - 1)) / BITS_PER_WORD;
- int i;
-
- if (target == 0 || GET_CODE (target) != REG)
- target = gen_reg_rtx (mode);
-
- /* Indicate for flow that the entire target reg is being set. */
- emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
-
- for (i = 0; i < nwords; i++)
- {
- /* If I is 0, use the low-order word in both field and target;
- if I is 1, use the next to lowest word; and so on. */
- /* Word number in TARGET to use. */
- int wordnum = (WORDS_BIG_ENDIAN
- ? GET_MODE_SIZE (GET_MODE (target)) / UNITS_PER_WORD - i - 1
- : i);
- /* Offset from start of field in OP0. */
- int bit_offset = (WORDS_BIG_ENDIAN
- ? MAX (0, bitsize - (i + 1) * BITS_PER_WORD)
- : i * BITS_PER_WORD);
- rtx target_part = operand_subword (target, wordnum, 1, VOIDmode);
- rtx result_part
- = extract_bit_field (op0, MIN (BITS_PER_WORD,
- bitsize - i * BITS_PER_WORD),
- bitnum + bit_offset,
- 1, target_part, mode, word_mode,
- align, total_size);
-
- if (target_part == 0)
- abort ();
-
- if (result_part != target_part)
- emit_move_insn (target_part, result_part);
- }
-
- if (unsignedp)
- {
- /* Unless we've filled TARGET, the upper regs in a multi-reg value
- need to be zero'd out. */
- if (GET_MODE_SIZE (GET_MODE (target)) > nwords * UNITS_PER_WORD)
- {
- int i,total_words;
-
- total_words = GET_MODE_SIZE (GET_MODE (target)) / UNITS_PER_WORD;
- for (i = nwords; i < total_words; i++)
- {
- int wordnum = WORDS_BIG_ENDIAN ? total_words - i - 1 : i;
- rtx target_part = operand_subword (target, wordnum, 1, VOIDmode);
- emit_move_insn (target_part, const0_rtx);
- }
- }
- return target;
- }
-
- /* Signed bit field: sign-extend with two arithmetic shifts. */
- target = expand_shift (LSHIFT_EXPR, mode, target,
- build_int_2 (GET_MODE_BITSIZE (mode) - bitsize, 0),
- NULL_RTX, 0);
- return expand_shift (RSHIFT_EXPR, mode, target,
- build_int_2 (GET_MODE_BITSIZE (mode) - bitsize, 0),
- NULL_RTX, 0);
- }
-
- /* From here on we know the desired field is smaller than a word
- so we can assume it is an integer. So we can safely extract it as one
- size of integer, if necessary, and then truncate or extend
- to the size that is wanted. */
-
- /* OFFSET is the number of words or bytes (UNIT says which)
- from STR_RTX to the first word or byte containing part of the field. */
-
- if (GET_CODE (op0) == REG)
- {
- if (offset != 0
- || GET_MODE_SIZE (GET_MODE (op0)) > UNITS_PER_WORD)
- op0 = gen_rtx (SUBREG, TYPE_MODE (type_for_size (BITS_PER_WORD, 0)),
- op0, offset);
- offset = 0;
- }
- else
- {
- op0 = protect_from_queue (str_rtx, 1);
- }
-
- /* Now OFFSET is nonzero only for memory operands. */
-
- if (unsignedp)
- {
-#ifdef HAVE_extzv
- if (HAVE_extzv
- && (GET_MODE_BITSIZE (insn_operand_mode[(int) CODE_FOR_extzv][0])
- >= bitsize)
- && ! ((GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG)
- && (bitsize + bitpos
- > GET_MODE_BITSIZE (insn_operand_mode[(int) CODE_FOR_extzv][0]))))
- {
- int xbitpos = bitpos, xoffset = offset;
- rtx bitsize_rtx, bitpos_rtx;
- rtx last = get_last_insn();
- rtx xop0 = op0;
- rtx xtarget = target;
- rtx xspec_target = spec_target;
- rtx xspec_target_subreg = spec_target_subreg;
- rtx pat;
- enum machine_mode maxmode
- = insn_operand_mode[(int) CODE_FOR_extzv][0];
-
- if (GET_CODE (xop0) == MEM)
- {
- int save_volatile_ok = volatile_ok;
- volatile_ok = 1;
-
- /* Is the memory operand acceptable? */
- if (flag_force_mem
- || ! ((*insn_operand_predicate[(int) CODE_FOR_extzv][1])
- (xop0, GET_MODE (xop0))))
- {
- /* No, load into a reg and extract from there. */
- enum machine_mode bestmode;
-
- /* Get the mode to use for inserting into this field. If
- OP0 is BLKmode, get the smallest mode consistent with the
- alignment. If OP0 is a non-BLKmode object that is no
- wider than MAXMODE, use its mode. Otherwise, use the
- smallest mode containing the field. */
-
- if (GET_MODE (xop0) == BLKmode
- || (GET_MODE_SIZE (GET_MODE (op0))
- > GET_MODE_SIZE (maxmode)))
- bestmode = get_best_mode (bitsize, bitnum,
- align * BITS_PER_UNIT, maxmode,
- MEM_VOLATILE_P (xop0));
- else
- bestmode = GET_MODE (xop0);
-
- if (bestmode == VOIDmode
- || (SLOW_UNALIGNED_ACCESS && GET_MODE_SIZE (bestmode) > align))
- goto extzv_loses;
-
- /* Compute offset as multiple of this unit,
- counting in bytes. */
- unit = GET_MODE_BITSIZE (bestmode);
- xoffset = (bitnum / unit) * GET_MODE_SIZE (bestmode);
- xbitpos = bitnum % unit;
- xop0 = change_address (xop0, bestmode,
- plus_constant (XEXP (xop0, 0),
- xoffset));
- /* Fetch it to a register in that size. */
- xop0 = force_reg (bestmode, xop0);
-
- /* XBITPOS counts within UNIT, which is what is expected. */
- }
- else
- /* Get ref to first byte containing part of the field. */
- xop0 = change_address (xop0, byte_mode,
- plus_constant (XEXP (xop0, 0), xoffset));
-
- volatile_ok = save_volatile_ok;
- }
-
- /* If op0 is a register, we need it in MAXMODE (which is usually
- SImode). to make it acceptable to the format of extzv. */
- if (GET_CODE (xop0) == SUBREG && GET_MODE (xop0) != maxmode)
- abort ();
- if (GET_CODE (xop0) == REG && GET_MODE (xop0) != maxmode)
- xop0 = gen_rtx (SUBREG, maxmode, xop0, 0);
-
- /* On big-endian machines, we count bits from the most significant.
- If the bit field insn does not, we must invert. */
- if (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN)
- xbitpos = unit - bitsize - xbitpos;
-
- /* Now convert from counting within UNIT to counting in MAXMODE. */
- if (BITS_BIG_ENDIAN && GET_CODE (xop0) != MEM)
- xbitpos += GET_MODE_BITSIZE (maxmode) - unit;
-
- unit = GET_MODE_BITSIZE (maxmode);
-
- if (xtarget == 0
- || (flag_force_mem && GET_CODE (xtarget) == MEM))
- xtarget = xspec_target = gen_reg_rtx (tmode);
-
- if (GET_MODE (xtarget) != maxmode)
- {
- if (GET_CODE (xtarget) == REG)
- {
- int wider = (GET_MODE_SIZE (maxmode)
- > GET_MODE_SIZE (GET_MODE (xtarget)));
- xtarget = gen_lowpart (maxmode, xtarget);
- if (wider)
- xspec_target_subreg = xtarget;
- }
- else
- xtarget = gen_reg_rtx (maxmode);
- }
-
- /* If this machine's extzv insists on a register target,
- make sure we have one. */
- if (! ((*insn_operand_predicate[(int) CODE_FOR_extzv][0])
- (xtarget, maxmode)))
- xtarget = gen_reg_rtx (maxmode);
-
- bitsize_rtx = GEN_INT (bitsize);
- bitpos_rtx = GEN_INT (xbitpos);
-
- pat = gen_extzv (protect_from_queue (xtarget, 1),
- xop0, bitsize_rtx, bitpos_rtx);
- if (pat)
- {
- emit_insn (pat);
- target = xtarget;
- spec_target = xspec_target;
- spec_target_subreg = xspec_target_subreg;
- }
- else
- {
- delete_insns_since (last);
- target = extract_fixed_bit_field (tmode, op0, offset, bitsize,
- bitpos, target, 1, align);
- }
- }
- else
- extzv_loses:
-#endif
- target = extract_fixed_bit_field (tmode, op0, offset, bitsize, bitpos,
- target, 1, align);
- }
- else
- {
-#ifdef HAVE_extv
- if (HAVE_extv
- && (GET_MODE_BITSIZE (insn_operand_mode[(int) CODE_FOR_extv][0])
- >= bitsize)
- && ! ((GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG)
- && (bitsize + bitpos
- > GET_MODE_BITSIZE (insn_operand_mode[(int) CODE_FOR_extv][0]))))
- {
- int xbitpos = bitpos, xoffset = offset;
- rtx bitsize_rtx, bitpos_rtx;
- rtx last = get_last_insn();
- rtx xop0 = op0, xtarget = target;
- rtx xspec_target = spec_target;
- rtx xspec_target_subreg = spec_target_subreg;
- rtx pat;
- enum machine_mode maxmode
- = insn_operand_mode[(int) CODE_FOR_extv][0];
-
- if (GET_CODE (xop0) == MEM)
- {
- /* Is the memory operand acceptable? */
- if (! ((*insn_operand_predicate[(int) CODE_FOR_extv][1])
- (xop0, GET_MODE (xop0))))
- {
- /* No, load into a reg and extract from there. */
- enum machine_mode bestmode;
-
- /* Get the mode to use for inserting into this field. If
- OP0 is BLKmode, get the smallest mode consistent with the
- alignment. If OP0 is a non-BLKmode object that is no
- wider than MAXMODE, use its mode. Otherwise, use the
- smallest mode containing the field. */
-
- if (GET_MODE (xop0) == BLKmode
- || (GET_MODE_SIZE (GET_MODE (op0))
- > GET_MODE_SIZE (maxmode)))
- bestmode = get_best_mode (bitsize, bitnum,
- align * BITS_PER_UNIT, maxmode,
- MEM_VOLATILE_P (xop0));
- else
- bestmode = GET_MODE (xop0);
-
- if (bestmode == VOIDmode
- || (SLOW_UNALIGNED_ACCESS && GET_MODE_SIZE (bestmode) > align))
- goto extv_loses;
-
- /* Compute offset as multiple of this unit,
- counting in bytes. */
- unit = GET_MODE_BITSIZE (bestmode);
- xoffset = (bitnum / unit) * GET_MODE_SIZE (bestmode);
- xbitpos = bitnum % unit;
- xop0 = change_address (xop0, bestmode,
- plus_constant (XEXP (xop0, 0),
- xoffset));
- /* Fetch it to a register in that size. */
- xop0 = force_reg (bestmode, xop0);
-
- /* XBITPOS counts within UNIT, which is what is expected. */
- }
- else
- /* Get ref to first byte containing part of the field. */
- xop0 = change_address (xop0, byte_mode,
- plus_constant (XEXP (xop0, 0), xoffset));
- }
-
- /* If op0 is a register, we need it in MAXMODE (which is usually
- SImode) to make it acceptable to the format of extv. */
- if (GET_CODE (xop0) == SUBREG && GET_MODE (xop0) != maxmode)
- abort ();
- if (GET_CODE (xop0) == REG && GET_MODE (xop0) != maxmode)
- xop0 = gen_rtx (SUBREG, maxmode, xop0, 0);
-
- /* On big-endian machines, we count bits from the most significant.
- If the bit field insn does not, we must invert. */
- if (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN)
- xbitpos = unit - bitsize - xbitpos;
-
- /* XBITPOS counts within a size of UNIT.
- Adjust to count within a size of MAXMODE. */
- if (BITS_BIG_ENDIAN && GET_CODE (xop0) != MEM)
- xbitpos += (GET_MODE_BITSIZE (maxmode) - unit);
-
- unit = GET_MODE_BITSIZE (maxmode);
-
- if (xtarget == 0
- || (flag_force_mem && GET_CODE (xtarget) == MEM))
- xtarget = xspec_target = gen_reg_rtx (tmode);
-
- if (GET_MODE (xtarget) != maxmode)
- {
- if (GET_CODE (xtarget) == REG)
- {
- int wider = (GET_MODE_SIZE (maxmode)
- > GET_MODE_SIZE (GET_MODE (xtarget)));
- xtarget = gen_lowpart (maxmode, xtarget);
- if (wider)
- xspec_target_subreg = xtarget;
- }
- else
- xtarget = gen_reg_rtx (maxmode);
- }
-
- /* If this machine's extv insists on a register target,
- make sure we have one. */
- if (! ((*insn_operand_predicate[(int) CODE_FOR_extv][0])
- (xtarget, maxmode)))
- xtarget = gen_reg_rtx (maxmode);
-
- bitsize_rtx = GEN_INT (bitsize);
- bitpos_rtx = GEN_INT (xbitpos);
-
- pat = gen_extv (protect_from_queue (xtarget, 1),
- xop0, bitsize_rtx, bitpos_rtx);
- if (pat)
- {
- emit_insn (pat);
- target = xtarget;
- spec_target = xspec_target;
- spec_target_subreg = xspec_target_subreg;
- }
- else
- {
- delete_insns_since (last);
- target = extract_fixed_bit_field (tmode, op0, offset, bitsize,
- bitpos, target, 0, align);
- }
- }
- else
- extv_loses:
-#endif
- target = extract_fixed_bit_field (tmode, op0, offset, bitsize, bitpos,
- target, 0, align);
- }
- if (target == spec_target)
- return target;
- if (target == spec_target_subreg)
- return spec_target;
- if (GET_MODE (target) != tmode && GET_MODE (target) != mode)
- {
- /* If the target mode is floating-point, first convert to the
- integer mode of that size and then access it as a floating-point
- value via a SUBREG. */
- if (GET_MODE_CLASS (tmode) == MODE_FLOAT)
- {
- target = convert_to_mode (mode_for_size (GET_MODE_BITSIZE (tmode),
- MODE_INT, 0),
- target, unsignedp);
- if (GET_CODE (target) != REG)
- target = copy_to_reg (target);
- return gen_rtx (SUBREG, tmode, target, 0);
- }
- else
- return convert_to_mode (tmode, target, unsignedp);
- }
- return target;
-}
-
-/* Extract a bit field using shifts and boolean operations
- Returns an rtx to represent the value.
- OP0 addresses a register (word) or memory (byte).
- BITPOS says which bit within the word or byte the bit field starts in.
- OFFSET says how many bytes farther the bit field starts;
- it is 0 if OP0 is a register.
- BITSIZE says how many bits long the bit field is.
- (If OP0 is a register, it may be narrower than a full word,
- but BITPOS still counts within a full word,
- which is significant on bigendian machines.)
-
- UNSIGNEDP is nonzero for an unsigned bit field (don't sign-extend value).
- If TARGET is nonzero, attempts to store the value there
- and return TARGET, but this is not guaranteed.
- If TARGET is not used, create a pseudo-reg of mode TMODE for the value.
-
- ALIGN is the alignment that STR_RTX is known to have, measured in bytes. */
-
-static rtx
-extract_fixed_bit_field (tmode, op0, offset, bitsize, bitpos,
- target, unsignedp, align)
- enum machine_mode tmode;
- register rtx op0, target;
- register int offset, bitsize, bitpos;
- int unsignedp;
- int align;
-{
- int total_bits = BITS_PER_WORD;
- enum machine_mode mode;
-
- if (GET_CODE (op0) == SUBREG || GET_CODE (op0) == REG)
- {
- /* Special treatment for a bit field split across two registers. */
- if (bitsize + bitpos > BITS_PER_WORD)
- return extract_split_bit_field (op0, bitsize, bitpos,
- unsignedp, align);
- }
- else
- {
- /* Get the proper mode to use for this field. We want a mode that
- includes the entire field. If such a mode would be larger than
- a word, we won't be doing the extraction the normal way. */
-
- mode = get_best_mode (bitsize, bitpos + offset * BITS_PER_UNIT,
- align * BITS_PER_UNIT, word_mode,
- GET_CODE (op0) == MEM && MEM_VOLATILE_P (op0));
-
- if (mode == VOIDmode)
- /* The only way this should occur is if the field spans word
- boundaries. */
- return extract_split_bit_field (op0, bitsize,
- bitpos + offset * BITS_PER_UNIT,
- unsignedp, align);
-
- total_bits = GET_MODE_BITSIZE (mode);
-
- /* Make sure bitpos is valid for the chosen mode. Adjust BITPOS to
- be be in the range 0 to total_bits-1, and put any excess bytes in
- OFFSET. */
- if (bitpos >= total_bits)
- {
- offset += (bitpos / total_bits) * (total_bits / BITS_PER_UNIT);
- bitpos -= ((bitpos / total_bits) * (total_bits / BITS_PER_UNIT)
- * BITS_PER_UNIT);
- }
-
- /* Get ref to an aligned byte, halfword, or word containing the field.
- Adjust BITPOS to be position within a word,
- and OFFSET to be the offset of that word.
- Then alter OP0 to refer to that word. */
- bitpos += (offset % (total_bits / BITS_PER_UNIT)) * BITS_PER_UNIT;
- offset -= (offset % (total_bits / BITS_PER_UNIT));
- op0 = change_address (op0, mode,
- plus_constant (XEXP (op0, 0), offset));
- }
-
- mode = GET_MODE (op0);
-
- if (BYTES_BIG_ENDIAN)
- {
- /* BITPOS is the distance between our msb and that of OP0.
- Convert it to the distance from the lsb. */
-
- bitpos = total_bits - bitsize - bitpos;
- }
-
- /* Now BITPOS is always the distance between the field's lsb and that of OP0.
- We have reduced the big-endian case to the little-endian case. */
-
- if (unsignedp)
- {
- if (bitpos)
- {
- /* If the field does not already start at the lsb,
- shift it so it does. */
- tree amount = build_int_2 (bitpos, 0);
- /* Maybe propagate the target for the shift. */
- /* But not if we will return it--could confuse integrate.c. */
- rtx subtarget = (target != 0 && GET_CODE (target) == REG
- && !REG_FUNCTION_VALUE_P (target)
- ? target : 0);
- if (tmode != mode) subtarget = 0;
- op0 = expand_shift (RSHIFT_EXPR, mode, op0, amount, subtarget, 1);
- }
- /* Convert the value to the desired mode. */
- if (mode != tmode)
- op0 = convert_to_mode (tmode, op0, 1);
-
- /* Unless the msb of the field used to be the msb when we shifted,
- mask out the upper bits. */
-
- if (GET_MODE_BITSIZE (mode) != bitpos + bitsize
-#if 0
-#ifdef SLOW_ZERO_EXTEND
- /* Always generate an `and' if
- we just zero-extended op0 and SLOW_ZERO_EXTEND, since it
- will combine fruitfully with the zero-extend. */
- || tmode != mode
-#endif
-#endif
- )
- return expand_binop (GET_MODE (op0), and_optab, op0,
- mask_rtx (GET_MODE (op0), 0, bitsize, 0),
- target, 1, OPTAB_LIB_WIDEN);
- return op0;
- }
-
- /* To extract a signed bit-field, first shift its msb to the msb of the word,
- then arithmetic-shift its lsb to the lsb of the word. */
- op0 = force_reg (mode, op0);
- if (mode != tmode)
- target = 0;
-
- /* Find the narrowest integer mode that contains the field. */
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if (GET_MODE_BITSIZE (mode) >= bitsize + bitpos)
- {
- op0 = convert_to_mode (mode, op0, 0);
- break;
- }
-
- if (GET_MODE_BITSIZE (mode) != (bitsize + bitpos))
- {
- tree amount = build_int_2 (GET_MODE_BITSIZE (mode) - (bitsize + bitpos), 0);
- /* Maybe propagate the target for the shift. */
- /* But not if we will return the result--could confuse integrate.c. */
- rtx subtarget = (target != 0 && GET_CODE (target) == REG
- && ! REG_FUNCTION_VALUE_P (target)
- ? target : 0);
- op0 = expand_shift (LSHIFT_EXPR, mode, op0, amount, subtarget, 1);
- }
-
- return expand_shift (RSHIFT_EXPR, mode, op0,
- build_int_2 (GET_MODE_BITSIZE (mode) - bitsize, 0),
- target, 0);
-}
-
-/* Return a constant integer (CONST_INT or CONST_DOUBLE) mask value
- of mode MODE with BITSIZE ones followed by BITPOS zeros, or the
- complement of that if COMPLEMENT. The mask is truncated if
- necessary to the width of mode MODE. The mask is zero-extended if
- BITSIZE+BITPOS is too small for MODE. */
-
-static rtx
-mask_rtx (mode, bitpos, bitsize, complement)
- enum machine_mode mode;
- int bitpos, bitsize, complement;
-{
- HOST_WIDE_INT masklow, maskhigh;
-
- if (bitpos < HOST_BITS_PER_WIDE_INT)
- masklow = (HOST_WIDE_INT) -1 << bitpos;
- else
- masklow = 0;
-
- if (bitpos + bitsize < HOST_BITS_PER_WIDE_INT)
- masklow &= ((unsigned HOST_WIDE_INT) -1
- >> (HOST_BITS_PER_WIDE_INT - bitpos - bitsize));
-
- if (bitpos <= HOST_BITS_PER_WIDE_INT)
- maskhigh = -1;
- else
- maskhigh = (HOST_WIDE_INT) -1 << (bitpos - HOST_BITS_PER_WIDE_INT);
-
- if (bitpos + bitsize > HOST_BITS_PER_WIDE_INT)
- maskhigh &= ((unsigned HOST_WIDE_INT) -1
- >> (2 * HOST_BITS_PER_WIDE_INT - bitpos - bitsize));
- else
- maskhigh = 0;
-
- if (complement)
- {
- maskhigh = ~maskhigh;
- masklow = ~masklow;
- }
-
- return immed_double_const (masklow, maskhigh, mode);
-}
-
-/* Return a constant integer (CONST_INT or CONST_DOUBLE) rtx with the value
- VALUE truncated to BITSIZE bits and then shifted left BITPOS bits. */
-
-static rtx
-lshift_value (mode, value, bitpos, bitsize)
- enum machine_mode mode;
- rtx value;
- int bitpos, bitsize;
-{
- unsigned HOST_WIDE_INT v = INTVAL (value);
- HOST_WIDE_INT low, high;
-
- if (bitsize < HOST_BITS_PER_WIDE_INT)
- v &= ~((HOST_WIDE_INT) -1 << bitsize);
-
- if (bitpos < HOST_BITS_PER_WIDE_INT)
- {
- low = v << bitpos;
- high = (bitpos > 0 ? (v >> (HOST_BITS_PER_WIDE_INT - bitpos)) : 0);
- }
- else
- {
- low = 0;
- high = v << (bitpos - HOST_BITS_PER_WIDE_INT);
- }
-
- return immed_double_const (low, high, mode);
-}
-
-/* Extract a bit field that is split across two words
- and return an RTX for the result.
-
- OP0 is the REG, SUBREG or MEM rtx for the first of the two words.
- BITSIZE is the field width; BITPOS, position of its first bit, in the word.
- UNSIGNEDP is 1 if should zero-extend the contents; else sign-extend.
-
- ALIGN is the known alignment of OP0, measured in bytes.
- This is also the size of the memory objects to be used. */
-
-static rtx
-extract_split_bit_field (op0, bitsize, bitpos, unsignedp, align)
- rtx op0;
- int bitsize, bitpos, unsignedp, align;
-{
- int unit;
- int bitsdone = 0;
- rtx result;
- int first = 1;
-
- /* Make sure UNIT isn't larger than BITS_PER_WORD, we can only handle that
- much at a time. */
- if (GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG)
- unit = BITS_PER_WORD;
- else
- unit = MIN (align * BITS_PER_UNIT, BITS_PER_WORD);
-
- while (bitsdone < bitsize)
- {
- int thissize;
- rtx part, word;
- int thispos;
- int offset;
-
- offset = (bitpos + bitsdone) / unit;
- thispos = (bitpos + bitsdone) % unit;
-
- /* THISSIZE must not overrun a word boundary. Otherwise,
- extract_fixed_bit_field will call us again, and we will mutually
- recurse forever. */
- thissize = MIN (bitsize - bitsdone, BITS_PER_WORD);
- thissize = MIN (thissize, unit - thispos);
-
- /* If OP0 is a register, then handle OFFSET here.
-
- When handling multiword bitfields, extract_bit_field may pass
- down a word_mode SUBREG of a larger REG for a bitfield that actually
- crosses a word boundary. Thus, for a SUBREG, we must find
- the current word starting from the base register. */
- if (GET_CODE (op0) == SUBREG)
- {
- word = operand_subword_force (SUBREG_REG (op0),
- SUBREG_WORD (op0) + offset,
- GET_MODE (SUBREG_REG (op0)));
- offset = 0;
- }
- else if (GET_CODE (op0) == REG)
- {
- word = operand_subword_force (op0, offset, GET_MODE (op0));
- offset = 0;
- }
- else
- word = op0;
-
- /* Extract the parts in bit-counting order,
- whose meaning is determined by BYTES_PER_UNIT.
- OFFSET is in UNITs, and UNIT is in bits.
- extract_fixed_bit_field wants offset in bytes. */
- part = extract_fixed_bit_field (word_mode, word,
- offset * unit / BITS_PER_UNIT,
- thissize, thispos, 0, 1, align);
- bitsdone += thissize;
-
- /* Shift this part into place for the result. */
- if (BYTES_BIG_ENDIAN)
- {
- if (bitsize != bitsdone)
- part = expand_shift (LSHIFT_EXPR, word_mode, part,
- build_int_2 (bitsize - bitsdone, 0), 0, 1);
- }
- else
- {
- if (bitsdone != thissize)
- part = expand_shift (LSHIFT_EXPR, word_mode, part,
- build_int_2 (bitsdone - thissize, 0), 0, 1);
- }
-
- if (first)
- result = part;
- else
- /* Combine the parts with bitwise or. This works
- because we extracted each part as an unsigned bit field. */
- result = expand_binop (word_mode, ior_optab, part, result, NULL_RTX, 1,
- OPTAB_LIB_WIDEN);
-
- first = 0;
- }
-
- /* Unsigned bit field: we are done. */
- if (unsignedp)
- return result;
- /* Signed bit field: sign-extend with two arithmetic shifts. */
- result = expand_shift (LSHIFT_EXPR, word_mode, result,
- build_int_2 (BITS_PER_WORD - bitsize, 0),
- NULL_RTX, 0);
- return expand_shift (RSHIFT_EXPR, word_mode, result,
- build_int_2 (BITS_PER_WORD - bitsize, 0), NULL_RTX, 0);
-}
-
-/* Add INC into TARGET. */
-
-void
-expand_inc (target, inc)
- rtx target, inc;
-{
- rtx value = expand_binop (GET_MODE (target), add_optab,
- target, inc,
- target, 0, OPTAB_LIB_WIDEN);
- if (value != target)
- emit_move_insn (target, value);
-}
-
-/* Subtract DEC from TARGET. */
-
-void
-expand_dec (target, dec)
- rtx target, dec;
-{
- rtx value = expand_binop (GET_MODE (target), sub_optab,
- target, dec,
- target, 0, OPTAB_LIB_WIDEN);
- if (value != target)
- emit_move_insn (target, value);
-}
-
-/* Output a shift instruction for expression code CODE,
- with SHIFTED being the rtx for the value to shift,
- and AMOUNT the tree for the amount to shift by.
- Store the result in the rtx TARGET, if that is convenient.
- If UNSIGNEDP is nonzero, do a logical shift; otherwise, arithmetic.
- Return the rtx for where the value is. */
-
-rtx
-expand_shift (code, mode, shifted, amount, target, unsignedp)
- enum tree_code code;
- register enum machine_mode mode;
- rtx shifted;
- tree amount;
- register rtx target;
- int unsignedp;
-{
- register rtx op1, temp = 0;
- register int left = (code == LSHIFT_EXPR || code == LROTATE_EXPR);
- register int rotate = (code == LROTATE_EXPR || code == RROTATE_EXPR);
- int try;
-
- /* Previously detected shift-counts computed by NEGATE_EXPR
- and shifted in the other direction; but that does not work
- on all machines. */
-
- op1 = expand_expr (amount, NULL_RTX, VOIDmode, 0);
-
-#ifdef SHIFT_COUNT_TRUNCATED
- if (SHIFT_COUNT_TRUNCATED
- && GET_CODE (op1) == CONST_INT
- && (unsigned HOST_WIDE_INT) INTVAL (op1) >= GET_MODE_BITSIZE (mode))
- op1 = GEN_INT ((unsigned HOST_WIDE_INT) INTVAL (op1)
- % GET_MODE_BITSIZE (mode));
-#endif
-
- if (op1 == const0_rtx)
- return shifted;
-
- for (try = 0; temp == 0 && try < 3; try++)
- {
- enum optab_methods methods;
-
- if (try == 0)
- methods = OPTAB_DIRECT;
- else if (try == 1)
- methods = OPTAB_WIDEN;
- else
- methods = OPTAB_LIB_WIDEN;
-
- if (rotate)
- {
- /* Widening does not work for rotation. */
- if (methods == OPTAB_WIDEN)
- continue;
- else if (methods == OPTAB_LIB_WIDEN)
- {
- /* If we have been unable to open-code this by a rotation,
- do it as the IOR of two shifts. I.e., to rotate A
- by N bits, compute (A << N) | ((unsigned) A >> (C - N))
- where C is the bitsize of A.
-
- It is theoretically possible that the target machine might
- not be able to perform either shift and hence we would
- be making two libcalls rather than just the one for the
- shift (similarly if IOR could not be done). We will allow
- this extremely unlikely lossage to avoid complicating the
- code below. */
-
- rtx subtarget = target == shifted ? 0 : target;
- rtx temp1;
- tree type = TREE_TYPE (amount);
- tree new_amount = make_tree (type, op1);
- tree other_amount
- = fold (build (MINUS_EXPR, type,
- convert (type,
- build_int_2 (GET_MODE_BITSIZE (mode),
- 0)),
- amount));
-
- shifted = force_reg (mode, shifted);
-
- temp = expand_shift (left ? LSHIFT_EXPR : RSHIFT_EXPR,
- mode, shifted, new_amount, subtarget, 1);
- temp1 = expand_shift (left ? RSHIFT_EXPR : LSHIFT_EXPR,
- mode, shifted, other_amount, 0, 1);
- return expand_binop (mode, ior_optab, temp, temp1, target,
- unsignedp, methods);
- }
-
- temp = expand_binop (mode,
- left ? rotl_optab : rotr_optab,
- shifted, op1, target, unsignedp, methods);
-
- /* If we don't have the rotate, but we are rotating by a constant
- that is in range, try a rotate in the opposite direction. */
-
- if (temp == 0 && GET_CODE (op1) == CONST_INT
- && INTVAL (op1) > 0 && INTVAL (op1) < GET_MODE_BITSIZE (mode))
- temp = expand_binop (mode,
- left ? rotr_optab : rotl_optab,
- shifted,
- GEN_INT (GET_MODE_BITSIZE (mode)
- - INTVAL (op1)),
- target, unsignedp, methods);
- }
- else if (unsignedp)
- temp = expand_binop (mode,
- left ? ashl_optab : lshr_optab,
- shifted, op1, target, unsignedp, methods);
-
- /* Do arithmetic shifts.
- Also, if we are going to widen the operand, we can just as well
- use an arithmetic right-shift instead of a logical one. */
- if (temp == 0 && ! rotate
- && (! unsignedp || (! left && methods == OPTAB_WIDEN)))
- {
- enum optab_methods methods1 = methods;
-
- /* If trying to widen a log shift to an arithmetic shift,
- don't accept an arithmetic shift of the same size. */
- if (unsignedp)
- methods1 = OPTAB_MUST_WIDEN;
-
- /* Arithmetic shift */
-
- temp = expand_binop (mode,
- left ? ashl_optab : ashr_optab,
- shifted, op1, target, unsignedp, methods1);
- }
-
- /* We used to try extzv here for logical right shifts, but that was
- only useful for one machine, the VAX, and caused poor code
- generation there for lshrdi3, so the code was deleted and a
- define_expand for lshrsi3 was added to vax.md. */
- }
-
- if (temp == 0)
- abort ();
- return temp;
-}
-
-enum alg_code { alg_zero, alg_m, alg_shift,
- alg_add_t_m2, alg_sub_t_m2,
- alg_add_factor, alg_sub_factor,
- alg_add_t2_m, alg_sub_t2_m,
- alg_add, alg_subtract, alg_factor, alg_shiftop };
-
-/* This structure records a sequence of operations.
- `ops' is the number of operations recorded.
- `cost' is their total cost.
- The operations are stored in `op' and the corresponding
- logarithms of the integer coefficients in `log'.
-
- These are the operations:
- alg_zero total := 0;
- alg_m total := multiplicand;
- alg_shift total := total * coeff
- alg_add_t_m2 total := total + multiplicand * coeff;
- alg_sub_t_m2 total := total - multiplicand * coeff;
- alg_add_factor total := total * coeff + total;
- alg_sub_factor total := total * coeff - total;
- alg_add_t2_m total := total * coeff + multiplicand;
- alg_sub_t2_m total := total * coeff - multiplicand;
-
- The first operand must be either alg_zero or alg_m. */
-
-struct algorithm
-{
- short cost;
- short ops;
- /* The size of the OP and LOG fields are not directly related to the
- word size, but the worst-case algorithms will be if we have few
- consecutive ones or zeros, i.e., a multiplicand like 10101010101...
- In that case we will generate shift-by-2, add, shift-by-2, add,...,
- in total wordsize operations. */
- enum alg_code op[MAX_BITS_PER_WORD];
- char log[MAX_BITS_PER_WORD];
-};
-
-/* Compute and return the best algorithm for multiplying by T.
- The algorithm must cost less than cost_limit
- If retval.cost >= COST_LIMIT, no algorithm was found and all
- other field of the returned struct are undefined. */
-
-static void
-synth_mult (alg_out, t, cost_limit)
- struct algorithm *alg_out;
- unsigned HOST_WIDE_INT t;
- int cost_limit;
-{
- int m;
- struct algorithm *alg_in, *best_alg;
- unsigned int cost;
- unsigned HOST_WIDE_INT q;
-
- /* Indicate that no algorithm is yet found. If no algorithm
- is found, this value will be returned and indicate failure. */
- alg_out->cost = cost_limit;
-
- if (cost_limit <= 0)
- return;
-
- /* t == 1 can be done in zero cost. */
- if (t == 1)
- {
- alg_out->ops = 1;
- alg_out->cost = 0;
- alg_out->op[0] = alg_m;
- return;
- }
-
- /* t == 0 sometimes has a cost. If it does and it exceeds our limit,
- fail now. */
- if (t == 0)
- {
- if (zero_cost >= cost_limit)
- return;
- else
- {
- alg_out->ops = 1;
- alg_out->cost = zero_cost;
- alg_out->op[0] = alg_zero;
- return;
- }
- }
-
- /* We'll be needing a couple extra algorithm structures now. */
-
- alg_in = (struct algorithm *)alloca (sizeof (struct algorithm));
- best_alg = (struct algorithm *)alloca (sizeof (struct algorithm));
-
- /* If we have a group of zero bits at the low-order part of T, try
- multiplying by the remaining bits and then doing a shift. */
-
- if ((t & 1) == 0)
- {
- m = floor_log2 (t & -t); /* m = number of low zero bits */
- q = t >> m;
- cost = shift_cost[m];
- synth_mult (alg_in, q, cost_limit - cost);
-
- cost += alg_in->cost;
- if (cost < cost_limit)
- {
- struct algorithm *x;
- x = alg_in, alg_in = best_alg, best_alg = x;
- best_alg->log[best_alg->ops] = m;
- best_alg->op[best_alg->ops] = alg_shift;
- cost_limit = cost;
- }
- }
-
- /* If we have an odd number, add or subtract one. */
- if ((t & 1) != 0)
- {
- unsigned HOST_WIDE_INT w;
-
- for (w = 1; (w & t) != 0; w <<= 1)
- ;
- if (w > 2
- /* Reject the case where t is 3.
- Thus we prefer addition in that case. */
- && t != 3)
- {
- /* T ends with ...111. Multiply by (T + 1) and subtract 1. */
-
- cost = add_cost;
- synth_mult (alg_in, t + 1, cost_limit - cost);
-
- cost += alg_in->cost;
- if (cost < cost_limit)
- {
- struct algorithm *x;
- x = alg_in, alg_in = best_alg, best_alg = x;
- best_alg->log[best_alg->ops] = 0;
- best_alg->op[best_alg->ops] = alg_sub_t_m2;
- cost_limit = cost;
- }
- }
- else
- {
- /* T ends with ...01 or ...011. Multiply by (T - 1) and add 1. */
-
- cost = add_cost;
- synth_mult (alg_in, t - 1, cost_limit - cost);
-
- cost += alg_in->cost;
- if (cost < cost_limit)
- {
- struct algorithm *x;
- x = alg_in, alg_in = best_alg, best_alg = x;
- best_alg->log[best_alg->ops] = 0;
- best_alg->op[best_alg->ops] = alg_add_t_m2;
- cost_limit = cost;
- }
- }
- }
-
- /* Look for factors of t of the form
- t = q(2**m +- 1), 2 <= m <= floor(log2(t - 1)).
- If we find such a factor, we can multiply by t using an algorithm that
- multiplies by q, shift the result by m and add/subtract it to itself.
-
- We search for large factors first and loop down, even if large factors
- are less probable than small; if we find a large factor we will find a
- good sequence quickly, and therefore be able to prune (by decreasing
- COST_LIMIT) the search. */
-
- for (m = floor_log2 (t - 1); m >= 2; m--)
- {
- unsigned HOST_WIDE_INT d;
-
- d = ((unsigned HOST_WIDE_INT) 1 << m) + 1;
- if (t % d == 0 && t > d)
- {
- cost = MIN (shiftadd_cost[m], add_cost + shift_cost[m]);
- synth_mult (alg_in, t / d, cost_limit - cost);
-
- cost += alg_in->cost;
- if (cost < cost_limit)
- {
- struct algorithm *x;
- x = alg_in, alg_in = best_alg, best_alg = x;
- best_alg->log[best_alg->ops] = m;
- best_alg->op[best_alg->ops] = alg_add_factor;
- cost_limit = cost;
- }
- /* Other factors will have been taken care of in the recursion. */
- break;
- }
-
- d = ((unsigned HOST_WIDE_INT) 1 << m) - 1;
- if (t % d == 0 && t > d)
- {
- cost = MIN (shiftsub_cost[m], add_cost + shift_cost[m]);
- synth_mult (alg_in, t / d, cost_limit - cost);
-
- cost += alg_in->cost;
- if (cost < cost_limit)
- {
- struct algorithm *x;
- x = alg_in, alg_in = best_alg, best_alg = x;
- best_alg->log[best_alg->ops] = m;
- best_alg->op[best_alg->ops] = alg_sub_factor;
- cost_limit = cost;
- }
- break;
- }
- }
-
- /* Try shift-and-add (load effective address) instructions,
- i.e. do a*3, a*5, a*9. */
- if ((t & 1) != 0)
- {
- q = t - 1;
- q = q & -q;
- m = exact_log2 (q);
- if (m >= 0)
- {
- cost = shiftadd_cost[m];
- synth_mult (alg_in, (t - 1) >> m, cost_limit - cost);
-
- cost += alg_in->cost;
- if (cost < cost_limit)
- {
- struct algorithm *x;
- x = alg_in, alg_in = best_alg, best_alg = x;
- best_alg->log[best_alg->ops] = m;
- best_alg->op[best_alg->ops] = alg_add_t2_m;
- cost_limit = cost;
- }
- }
-
- q = t + 1;
- q = q & -q;
- m = exact_log2 (q);
- if (m >= 0)
- {
- cost = shiftsub_cost[m];
- synth_mult (alg_in, (t + 1) >> m, cost_limit - cost);
-
- cost += alg_in->cost;
- if (cost < cost_limit)
- {
- struct algorithm *x;
- x = alg_in, alg_in = best_alg, best_alg = x;
- best_alg->log[best_alg->ops] = m;
- best_alg->op[best_alg->ops] = alg_sub_t2_m;
- cost_limit = cost;
- }
- }
- }
-
- /* If cost_limit has not decreased since we stored it in alg_out->cost,
- we have not found any algorithm. */
- if (cost_limit == alg_out->cost)
- return;
-
- /* If we are getting a too long sequence for `struct algorithm'
- to record, make this search fail. */
- if (best_alg->ops == MAX_BITS_PER_WORD)
- return;
-
- /* Copy the algorithm from temporary space to the space at alg_out.
- We avoid using structure assignment because the majority of
- best_alg is normally undefined, and this is a critical function. */
- alg_out->ops = best_alg->ops + 1;
- alg_out->cost = cost_limit;
- bcopy ((char *) best_alg->op, (char *) alg_out->op,
- alg_out->ops * sizeof *alg_out->op);
- bcopy ((char *) best_alg->log, (char *) alg_out->log,
- alg_out->ops * sizeof *alg_out->log);
-}
-
-/* Perform a multiplication and return an rtx for the result.
- MODE is mode of value; OP0 and OP1 are what to multiply (rtx's);
- TARGET is a suggestion for where to store the result (an rtx).
-
- We check specially for a constant integer as OP1.
- If you want this check for OP0 as well, then before calling
- you should swap the two operands if OP0 would be constant. */
-
-rtx
-expand_mult (mode, op0, op1, target, unsignedp)
- enum machine_mode mode;
- register rtx op0, op1, target;
- int unsignedp;
-{
- rtx const_op1 = op1;
-
- /* synth_mult does an `unsigned int' multiply. As long as the mode is
- less than or equal in size to `unsigned int' this doesn't matter.
- If the mode is larger than `unsigned int', then synth_mult works only
- if the constant value exactly fits in an `unsigned int' without any
- truncation. This means that multiplying by negative values does
- not work; results are off by 2^32 on a 32 bit machine. */
-
- /* If we are multiplying in DImode, it may still be a win
- to try to work with shifts and adds. */
- if (GET_CODE (op1) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (op1)) == MODE_INT
- && HOST_BITS_PER_INT >= BITS_PER_WORD
- && CONST_DOUBLE_HIGH (op1) == 0)
- const_op1 = GEN_INT (CONST_DOUBLE_LOW (op1));
- else if (HOST_BITS_PER_INT < GET_MODE_BITSIZE (mode)
- && GET_CODE (op1) == CONST_INT
- && INTVAL (op1) < 0)
- const_op1 = 0;
-
- /* We used to test optimize here, on the grounds that it's better to
- produce a smaller program when -O is not used.
- But this causes such a terrible slowdown sometimes
- that it seems better to use synth_mult always. */
-
- if (const_op1 && GET_CODE (const_op1) == CONST_INT)
- {
- struct algorithm alg;
- struct algorithm alg2;
- HOST_WIDE_INT val = INTVAL (op1);
- HOST_WIDE_INT val_so_far;
- rtx insn;
- int mult_cost;
- enum {basic_variant, negate_variant, add_variant} variant = basic_variant;
-
- /* Try to do the computation three ways: multiply by the negative of OP1
- and then negate, do the multiplication directly, or do multiplication
- by OP1 - 1. */
-
- mult_cost = rtx_cost (gen_rtx (MULT, mode, op0, op1), SET);
- mult_cost = MIN (12 * add_cost, mult_cost);
-
- synth_mult (&alg, val, mult_cost);
-
- /* This works only if the inverted value actually fits in an
- `unsigned int' */
- if (HOST_BITS_PER_INT >= GET_MODE_BITSIZE (mode))
- {
- synth_mult (&alg2, - val,
- (alg.cost < mult_cost ? alg.cost : mult_cost) - negate_cost);
- if (alg2.cost + negate_cost < alg.cost)
- alg = alg2, variant = negate_variant;
- }
-
- /* This proves very useful for division-by-constant. */
- synth_mult (&alg2, val - 1,
- (alg.cost < mult_cost ? alg.cost : mult_cost) - add_cost);
- if (alg2.cost + add_cost < alg.cost)
- alg = alg2, variant = add_variant;
-
- if (alg.cost < mult_cost)
- {
- /* We found something cheaper than a multiply insn. */
- int opno;
- rtx accum, tem;
-
- op0 = protect_from_queue (op0, 0);
-
- /* Avoid referencing memory over and over.
- For speed, but also for correctness when mem is volatile. */
- if (GET_CODE (op0) == MEM)
- op0 = force_reg (mode, op0);
-
- /* ACCUM starts out either as OP0 or as a zero, depending on
- the first operation. */
-
- if (alg.op[0] == alg_zero)
- {
- accum = copy_to_mode_reg (mode, const0_rtx);
- val_so_far = 0;
- }
- else if (alg.op[0] == alg_m)
- {
- accum = copy_to_mode_reg (mode, op0);
- val_so_far = 1;
- }
- else
- abort ();
-
- for (opno = 1; opno < alg.ops; opno++)
- {
- int log = alg.log[opno];
- int preserve = preserve_subexpressions_p ();
- rtx shift_subtarget = preserve ? 0 : accum;
- rtx add_target
- = (opno == alg.ops - 1 && target != 0 && variant != add_variant
- ? target : 0);
- rtx accum_target = preserve ? 0 : accum;
-
- switch (alg.op[opno])
- {
- case alg_shift:
- accum = expand_shift (LSHIFT_EXPR, mode, accum,
- build_int_2 (log, 0), NULL_RTX, 0);
- val_so_far <<= log;
- break;
-
- case alg_add_t_m2:
- tem = expand_shift (LSHIFT_EXPR, mode, op0,
- build_int_2 (log, 0), NULL_RTX, 0);
- accum = force_operand (gen_rtx (PLUS, mode, accum, tem),
- add_target ? add_target : accum_target);
- val_so_far += (HOST_WIDE_INT) 1 << log;
- break;
-
- case alg_sub_t_m2:
- tem = expand_shift (LSHIFT_EXPR, mode, op0,
- build_int_2 (log, 0), NULL_RTX, 0);
- accum = force_operand (gen_rtx (MINUS, mode, accum, tem),
- add_target ? add_target : accum_target);
- val_so_far -= (HOST_WIDE_INT) 1 << log;
- break;
-
- case alg_add_t2_m:
- accum = expand_shift (LSHIFT_EXPR, mode, accum,
- build_int_2 (log, 0), shift_subtarget,
- 0);
- accum = force_operand (gen_rtx (PLUS, mode, accum, op0),
- add_target ? add_target : accum_target);
- val_so_far = (val_so_far << log) + 1;
- break;
-
- case alg_sub_t2_m:
- accum = expand_shift (LSHIFT_EXPR, mode, accum,
- build_int_2 (log, 0), shift_subtarget,
- 0);
- accum = force_operand (gen_rtx (MINUS, mode, accum, op0),
- add_target ? add_target : accum_target);
- val_so_far = (val_so_far << log) - 1;
- break;
-
- case alg_add_factor:
- tem = expand_shift (LSHIFT_EXPR, mode, accum,
- build_int_2 (log, 0), NULL_RTX, 0);
- accum = force_operand (gen_rtx (PLUS, mode, accum, tem),
- add_target ? add_target : accum_target);
- val_so_far += val_so_far << log;
- break;
-
- case alg_sub_factor:
- tem = expand_shift (LSHIFT_EXPR, mode, accum,
- build_int_2 (log, 0), NULL_RTX, 0);
- accum = force_operand (gen_rtx (MINUS, mode, tem, accum),
- (add_target ? add_target
- : preserve ? 0 : tem));
- val_so_far = (val_so_far << log) - val_so_far;
- break;
-
- default:
- abort ();;
- }
-
- /* Write a REG_EQUAL note on the last insn so that we can cse
- multiplication sequences. */
-
- insn = get_last_insn ();
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (MULT, mode, op0, GEN_INT (val_so_far)),
- REG_NOTES (insn));
- }
-
- if (variant == negate_variant)
- {
- val_so_far = - val_so_far;
- accum = expand_unop (mode, neg_optab, accum, target, 0);
- }
- else if (variant == add_variant)
- {
- val_so_far = val_so_far + 1;
- accum = force_operand (gen_rtx (PLUS, mode, accum, op0), target);
- }
-
- if (val != val_so_far)
- abort ();
-
- return accum;
- }
- }
-
- /* This used to use umul_optab if unsigned, but for non-widening multiply
- there is no difference between signed and unsigned. */
- op0 = expand_binop (mode, smul_optab,
- op0, op1, target, unsignedp, OPTAB_LIB_WIDEN);
- if (op0 == 0)
- abort ();
- return op0;
-}
-
-/* Return the smallest n such that 2**n >= X. */
-
-int
-ceil_log2 (x)
- unsigned HOST_WIDE_INT x;
-{
- return floor_log2 (x - 1) + 1;
-}
-
-/* Choose a minimal N + 1 bit approximation to 1/D that can be used to
- replace division by D, and put the least significant N bits of the result
- in *MULTIPLIER_PTR and return the most significant bit.
-
- The width of operations is N (should be <= HOST_BITS_PER_WIDE_INT), the
- needed precision is in PRECISION (should be <= N).
-
- PRECISION should be as small as possible so this function can choose
- multiplier more freely.
-
- The rounded-up logarithm of D is placed in *lgup_ptr. A shift count that
- is to be used for a final right shift is placed in *POST_SHIFT_PTR.
-
- Using this function, x/D will be equal to (x * m) >> (*POST_SHIFT_PTR),
- where m is the full HOST_BITS_PER_WIDE_INT + 1 bit multiplier. */
-
-static
-unsigned HOST_WIDE_INT
-choose_multiplier (d, n, precision, multiplier_ptr, post_shift_ptr, lgup_ptr)
- unsigned HOST_WIDE_INT d;
- int n;
- int precision;
- unsigned HOST_WIDE_INT *multiplier_ptr;
- int *post_shift_ptr;
- int *lgup_ptr;
-{
- unsigned HOST_WIDE_INT mhigh_hi, mhigh_lo;
- unsigned HOST_WIDE_INT mlow_hi, mlow_lo;
- int lgup, post_shift;
- int pow, pow2;
- unsigned HOST_WIDE_INT nh, nl, dummy1, dummy2;
-
- /* lgup = ceil(log2(divisor)); */
- lgup = ceil_log2 (d);
-
- if (lgup > n)
- abort ();
-
- pow = n + lgup;
- pow2 = n + lgup - precision;
-
- if (pow == 2 * HOST_BITS_PER_WIDE_INT)
- {
- /* We could handle this with some effort, but this case is much better
- handled directly with a scc insn, so rely on caller using that. */
- abort ();
- }
-
- /* mlow = 2^(N + lgup)/d */
- if (pow >= HOST_BITS_PER_WIDE_INT)
- {
- nh = (unsigned HOST_WIDE_INT) 1 << (pow - HOST_BITS_PER_WIDE_INT);
- nl = 0;
- }
- else
- {
- nh = 0;
- nl = (unsigned HOST_WIDE_INT) 1 << pow;
- }
- div_and_round_double (TRUNC_DIV_EXPR, 1, nl, nh, d, (HOST_WIDE_INT) 0,
- &mlow_lo, &mlow_hi, &dummy1, &dummy2);
-
- /* mhigh = (2^(N + lgup) + 2^N + lgup - precision)/d */
- if (pow2 >= HOST_BITS_PER_WIDE_INT)
- nh |= (unsigned HOST_WIDE_INT) 1 << (pow2 - HOST_BITS_PER_WIDE_INT);
- else
- nl |= (unsigned HOST_WIDE_INT) 1 << pow2;
- div_and_round_double (TRUNC_DIV_EXPR, 1, nl, nh, d, (HOST_WIDE_INT) 0,
- &mhigh_lo, &mhigh_hi, &dummy1, &dummy2);
-
- if (mhigh_hi && nh - d >= d)
- abort ();
- if (mhigh_hi > 1 || mlow_hi > 1)
- abort ();
- /* assert that mlow < mhigh. */
- if (! (mlow_hi < mhigh_hi || (mlow_hi == mhigh_hi && mlow_lo < mhigh_lo)))
- abort();
-
- /* If precision == N, then mlow, mhigh exceed 2^N
- (but they do not exceed 2^(N+1)). */
-
- /* Reduce to lowest terms */
- for (post_shift = lgup; post_shift > 0; post_shift--)
- {
- unsigned HOST_WIDE_INT ml_lo = (mlow_hi << (HOST_BITS_PER_WIDE_INT - 1)) | (mlow_lo >> 1);
- unsigned HOST_WIDE_INT mh_lo = (mhigh_hi << (HOST_BITS_PER_WIDE_INT - 1)) | (mhigh_lo >> 1);
- if (ml_lo >= mh_lo)
- break;
-
- mlow_hi = 0;
- mlow_lo = ml_lo;
- mhigh_hi = 0;
- mhigh_lo = mh_lo;
- }
-
- *post_shift_ptr = post_shift;
- *lgup_ptr = lgup;
- if (n < HOST_BITS_PER_WIDE_INT)
- {
- unsigned HOST_WIDE_INT mask = ((unsigned HOST_WIDE_INT) 1 << n) - 1;
- *multiplier_ptr = mhigh_lo & mask;
- return mhigh_lo >= mask;
- }
- else
- {
- *multiplier_ptr = mhigh_lo;
- return mhigh_hi;
- }
-}
-
-/* Compute the inverse of X mod 2**n, i.e., find Y such that X * Y is
- congruent to 1 (mod 2**N). */
-
-static unsigned HOST_WIDE_INT
-invert_mod2n (x, n)
- unsigned HOST_WIDE_INT x;
- int n;
-{
- /* Solve x*y == 1 (mod 2^n), where x is odd. Return y. */
-
- /* The algorithm notes that the choice y = x satisfies
- x*y == 1 mod 2^3, since x is assumed odd.
- Each iteration doubles the number of bits of significance in y. */
-
- unsigned HOST_WIDE_INT mask;
- unsigned HOST_WIDE_INT y = x;
- int nbit = 3;
-
- mask = (n == HOST_BITS_PER_WIDE_INT
- ? ~(unsigned HOST_WIDE_INT) 0
- : ((unsigned HOST_WIDE_INT) 1 << n) - 1);
-
- while (nbit < n)
- {
- y = y * (2 - x*y) & mask; /* Modulo 2^N */
- nbit *= 2;
- }
- return y;
-}
-
-/* Emit code to adjust ADJ_OPERAND after multiplication of wrong signedness
- flavor of OP0 and OP1. ADJ_OPERAND is already the high half of the
- product OP0 x OP1. If UNSIGNEDP is nonzero, adjust the signed product
- to become unsigned, if UNSIGNEDP is zero, adjust the unsigned product to
- become signed.
-
- The result is put in TARGET if that is convenient.
-
- MODE is the mode of operation. */
-
-rtx
-expand_mult_highpart_adjust (mode, adj_operand, op0, op1, target, unsignedp)
- enum machine_mode mode;
- register rtx adj_operand, op0, op1, target;
- int unsignedp;
-{
- rtx tem;
- enum rtx_code adj_code = unsignedp ? PLUS : MINUS;
-
- tem = expand_shift (RSHIFT_EXPR, mode, op0,
- build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0),
- NULL_RTX, 0);
- tem = expand_and (tem, op1, NULL_RTX);
- adj_operand = force_operand (gen_rtx (adj_code, mode, adj_operand, tem),
- adj_operand);
-
- tem = expand_shift (RSHIFT_EXPR, mode, op1,
- build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0),
- NULL_RTX, 0);
- tem = expand_and (tem, op0, NULL_RTX);
- target = force_operand (gen_rtx (adj_code, mode, adj_operand, tem), target);
-
- return target;
-}
-
-/* Emit code to multiply OP0 and CNST1, putting the high half of the result
- in TARGET if that is convenient, and return where the result is. If the
- operation can not be performed, 0 is returned.
-
- MODE is the mode of operation and result.
-
- UNSIGNEDP nonzero means unsigned multiply.
-
- MAX_COST is the total allowed cost for the expanded RTL. */
-
-rtx
-expand_mult_highpart (mode, op0, cnst1, target, unsignedp, max_cost)
- enum machine_mode mode;
- register rtx op0, target;
- unsigned HOST_WIDE_INT cnst1;
- int unsignedp;
- int max_cost;
-{
- enum machine_mode wider_mode = GET_MODE_WIDER_MODE (mode);
- optab mul_highpart_optab;
- optab moptab;
- rtx tem;
- int size = GET_MODE_BITSIZE (mode);
- rtx op1, wide_op1;
-
- /* We can't support modes wider than HOST_BITS_PER_INT. */
- if (size > HOST_BITS_PER_WIDE_INT)
- abort ();
-
- op1 = GEN_INT (cnst1);
-
- if (GET_MODE_BITSIZE (wider_mode) <= HOST_BITS_PER_INT)
- wide_op1 = op1;
- else
- wide_op1
- = immed_double_const (cnst1,
- (unsignedp
- ? (HOST_WIDE_INT) 0
- : -(cnst1 >> (HOST_BITS_PER_WIDE_INT - 1))),
- wider_mode);
-
- /* expand_mult handles constant multiplication of word_mode
- or narrower. It does a poor job for large modes. */
- if (size < BITS_PER_WORD
- && mul_cost[(int) wider_mode] + shift_cost[size-1] < max_cost)
- {
- /* We have to do this, since expand_binop doesn't do conversion for
- multiply. Maybe change expand_binop to handle widening multiply? */
- op0 = convert_to_mode (wider_mode, op0, unsignedp);
-
- tem = expand_mult (wider_mode, op0, wide_op1, NULL_RTX, unsignedp);
- tem = expand_shift (RSHIFT_EXPR, wider_mode, tem,
- build_int_2 (size, 0), NULL_RTX, 1);
- return convert_modes (mode, wider_mode, tem, unsignedp);
- }
-
- if (target == 0)
- target = gen_reg_rtx (mode);
-
- /* Firstly, try using a multiplication insn that only generates the needed
- high part of the product, and in the sign flavor of unsignedp. */
- if (mul_highpart_cost[(int) mode] < max_cost)
- {
- mul_highpart_optab = unsignedp ? umul_highpart_optab : smul_highpart_optab;
- target = expand_binop (mode, mul_highpart_optab,
- op0, wide_op1, target, unsignedp, OPTAB_DIRECT);
- if (target)
- return target;
- }
-
- /* Secondly, same as above, but use sign flavor opposite of unsignedp.
- Need to adjust the result after the multiplication. */
- if (mul_highpart_cost[(int) mode] + 2 * shift_cost[size-1] + 4 * add_cost < max_cost)
- {
- mul_highpart_optab = unsignedp ? smul_highpart_optab : umul_highpart_optab;
- target = expand_binop (mode, mul_highpart_optab,
- op0, wide_op1, target, unsignedp, OPTAB_DIRECT);
- if (target)
- /* We used the wrong signedness. Adjust the result. */
- return expand_mult_highpart_adjust (mode, target, op0,
- op1, target, unsignedp);
- }
-
- /* Try widening multiplication. */
- moptab = unsignedp ? umul_widen_optab : smul_widen_optab;
- if (moptab->handlers[(int) wider_mode].insn_code != CODE_FOR_nothing
- && mul_widen_cost[(int) wider_mode] < max_cost)
- {
- op1 = force_reg (mode, op1);
- goto try;
- }
-
- /* Try widening the mode and perform a non-widening multiplication. */
- moptab = smul_optab;
- if (smul_optab->handlers[(int) wider_mode].insn_code != CODE_FOR_nothing
- && mul_cost[(int) wider_mode] + shift_cost[size-1] < max_cost)
- {
- op1 = wide_op1;
- goto try;
- }
-
- /* Try widening multiplication of opposite signedness, and adjust. */
- moptab = unsignedp ? smul_widen_optab : umul_widen_optab;
- if (moptab->handlers[(int) wider_mode].insn_code != CODE_FOR_nothing
- && (mul_widen_cost[(int) wider_mode]
- + 2 * shift_cost[size-1] + 4 * add_cost < max_cost))
- {
- rtx regop1 = force_reg (mode, op1);
- tem = expand_binop (wider_mode, moptab, op0, regop1,
- NULL_RTX, ! unsignedp, OPTAB_WIDEN);
- if (tem != 0)
- {
- /* Extract the high half of the just generated product. */
- tem = expand_shift (RSHIFT_EXPR, wider_mode, tem,
- build_int_2 (size, 0), NULL_RTX, 1);
- tem = convert_modes (mode, wider_mode, tem, unsignedp);
- /* We used the wrong signedness. Adjust the result. */
- return expand_mult_highpart_adjust (mode, tem, op0, op1,
- target, unsignedp);
- }
- }
-
- return 0;
-
- try:
- /* Pass NULL_RTX as target since TARGET has wrong mode. */
- tem = expand_binop (wider_mode, moptab, op0, op1,
- NULL_RTX, unsignedp, OPTAB_WIDEN);
- if (tem == 0)
- return 0;
-
- /* Extract the high half of the just generated product. */
- if (mode == word_mode)
- {
- return gen_highpart (mode, tem);
- }
- else
- {
- tem = expand_shift (RSHIFT_EXPR, wider_mode, tem,
- build_int_2 (size, 0), NULL_RTX, 1);
- return convert_modes (mode, wider_mode, tem, unsignedp);
- }
-}
-
-/* Emit the code to divide OP0 by OP1, putting the result in TARGET
- if that is convenient, and returning where the result is.
- You may request either the quotient or the remainder as the result;
- specify REM_FLAG nonzero to get the remainder.
-
- CODE is the expression code for which kind of division this is;
- it controls how rounding is done. MODE is the machine mode to use.
- UNSIGNEDP nonzero means do unsigned division. */
-
-/* ??? For CEIL_MOD_EXPR, can compute incorrect remainder with ANDI
- and then correct it by or'ing in missing high bits
- if result of ANDI is nonzero.
- For ROUND_MOD_EXPR, can use ANDI and then sign-extend the result.
- This could optimize to a bfexts instruction.
- But C doesn't use these operations, so their optimizations are
- left for later. */
-
-#define EXACT_POWER_OF_2_OR_ZERO_P(x) (((x) & ((x) - 1)) == 0)
-
-rtx
-expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
- int rem_flag;
- enum tree_code code;
- enum machine_mode mode;
- register rtx op0, op1, target;
- int unsignedp;
-{
- enum machine_mode compute_mode;
- register rtx tquotient;
- rtx quotient = 0, remainder = 0;
- rtx last;
- int size;
- rtx insn, set;
- optab optab1, optab2;
- int op1_is_constant, op1_is_pow2;
- int max_cost, extra_cost;
-
- op1_is_constant = GET_CODE (op1) == CONST_INT;
- op1_is_pow2 = (op1_is_constant
- && ((EXACT_POWER_OF_2_OR_ZERO_P (INTVAL (op1))
- || EXACT_POWER_OF_2_OR_ZERO_P (-INTVAL (op1)))));
-
- /*
- This is the structure of expand_divmod:
-
- First comes code to fix up the operands so we can perform the operations
- correctly and efficiently.
-
- Second comes a switch statement with code specific for each rounding mode.
- For some special operands this code emits all RTL for the desired
- operation, for other cases, it generates only a quotient and stores it in
- QUOTIENT. The case for trunc division/remainder might leave quotient = 0,
- to indicate that it has not done anything.
-
- Last comes code that finishes the operation. If QUOTIENT is set and
- REM_FLAG is set, the remainder is computed as OP0 - QUOTIENT * OP1. If
- QUOTIENT is not set, it is computed using trunc rounding.
-
- We try to generate special code for division and remainder when OP1 is a
- constant. If |OP1| = 2**n we can use shifts and some other fast
- operations. For other values of OP1, we compute a carefully selected
- fixed-point approximation m = 1/OP1, and generate code that multiplies OP0
- by m.
-
- In all cases but EXACT_DIV_EXPR, this multiplication requires the upper
- half of the product. Different strategies for generating the product are
- implemented in expand_mult_highpart.
-
- If what we actually want is the remainder, we generate that by another
- by-constant multiplication and a subtraction. */
-
- /* We shouldn't be called with OP1 == const1_rtx, but some of the
- code below will malfunction if we are, so check here and handle
- the special case if so. */
- if (op1 == const1_rtx)
- return rem_flag ? const0_rtx : op0;
-
- if (target
- /* Don't use the function value register as a target
- since we have to read it as well as write it,
- and function-inlining gets confused by this. */
- && ((REG_P (target) && REG_FUNCTION_VALUE_P (target))
- /* Don't clobber an operand while doing a multi-step calculation. */
- || ((rem_flag || op1_is_constant)
- && (reg_mentioned_p (target, op0)
- || (GET_CODE (op0) == MEM && GET_CODE (target) == MEM)))
- || reg_mentioned_p (target, op1)
- || (GET_CODE (op1) == MEM && GET_CODE (target) == MEM)))
- target = 0;
-
- /* Get the mode in which to perform this computation. Normally it will
- be MODE, but sometimes we can't do the desired operation in MODE.
- If so, pick a wider mode in which we can do the operation. Convert
- to that mode at the start to avoid repeated conversions.
-
- First see what operations we need. These depend on the expression
- we are evaluating. (We assume that divxx3 insns exist under the
- same conditions that modxx3 insns and that these insns don't normally
- fail. If these assumptions are not correct, we may generate less
- efficient code in some cases.)
-
- Then see if we find a mode in which we can open-code that operation
- (either a division, modulus, or shift). Finally, check for the smallest
- mode for which we can do the operation with a library call. */
-
- /* We might want to refine this now that we have division-by-constant
- optimization. Since expand_mult_highpart tries so many variants, it is
- not straightforward to generalize this. Maybe we should make an array
- of possible modes in init_expmed? Save this for GCC 2.7. */
-
- optab1 = (op1_is_pow2 ? (unsignedp ? lshr_optab : ashr_optab)
- : (unsignedp ? udiv_optab : sdiv_optab));
- optab2 = (op1_is_pow2 ? optab1 : (unsignedp ? udivmod_optab : sdivmod_optab));
-
- for (compute_mode = mode; compute_mode != VOIDmode;
- compute_mode = GET_MODE_WIDER_MODE (compute_mode))
- if (optab1->handlers[(int) compute_mode].insn_code != CODE_FOR_nothing
- || optab2->handlers[(int) compute_mode].insn_code != CODE_FOR_nothing)
- break;
-
- if (compute_mode == VOIDmode)
- for (compute_mode = mode; compute_mode != VOIDmode;
- compute_mode = GET_MODE_WIDER_MODE (compute_mode))
- if (optab1->handlers[(int) compute_mode].libfunc
- || optab2->handlers[(int) compute_mode].libfunc)
- break;
-
- /* If we still couldn't find a mode, use MODE, but we'll probably abort
- in expand_binop. */
- if (compute_mode == VOIDmode)
- compute_mode = mode;
-
- if (target && GET_MODE (target) == compute_mode)
- tquotient = target;
- else
- tquotient = gen_reg_rtx (compute_mode);
-
- size = GET_MODE_BITSIZE (compute_mode);
-#if 0
- /* It should be possible to restrict the precision to GET_MODE_BITSIZE
- (mode), and thereby get better code when OP1 is a constant. Do that
- later. It will require going over all usages of SIZE below. */
- size = GET_MODE_BITSIZE (mode);
-#endif
-
- max_cost = div_cost[(int) compute_mode]
- - (rem_flag ? mul_cost[(int) compute_mode] + add_cost : 0);
-
- /* Now convert to the best mode to use. */
- if (compute_mode != mode)
- {
- op0 = convert_modes (compute_mode, mode, op0, unsignedp);
- op1 = convert_modes (compute_mode, mode, op1, unsignedp);
- }
-
- /* If one of the operands is a volatile MEM, copy it into a register. */
-
- if (GET_CODE (op0) == MEM && MEM_VOLATILE_P (op0))
- op0 = force_reg (compute_mode, op0);
- if (GET_CODE (op1) == MEM && MEM_VOLATILE_P (op1))
- op1 = force_reg (compute_mode, op1);
-
- /* If we need the remainder or if OP1 is constant, we need to
- put OP0 in a register in case it has any queued subexpressions. */
- if (rem_flag || op1_is_constant)
- op0 = force_reg (compute_mode, op0);
-
- last = get_last_insn ();
-
- /* Promote floor rounding to trunc rounding for unsigned operations. */
- if (unsignedp)
- {
- if (code == FLOOR_DIV_EXPR)
- code = TRUNC_DIV_EXPR;
- if (code == FLOOR_MOD_EXPR)
- code = TRUNC_MOD_EXPR;
- }
-
- if (op1 != const0_rtx)
- switch (code)
- {
- case TRUNC_MOD_EXPR:
- case TRUNC_DIV_EXPR:
- if (op1_is_constant)
- {
- if (unsignedp)
- {
- unsigned HOST_WIDE_INT mh, ml;
- int pre_shift, post_shift;
- int dummy;
- unsigned HOST_WIDE_INT d = INTVAL (op1);
-
- if (EXACT_POWER_OF_2_OR_ZERO_P (d))
- {
- pre_shift = floor_log2 (d);
- if (rem_flag)
- {
- remainder =
- expand_binop (compute_mode, and_optab, op0,
- GEN_INT (((HOST_WIDE_INT) 1 << pre_shift) - 1),
- remainder, 1,
- OPTAB_LIB_WIDEN);
- if (remainder)
- return gen_lowpart (mode, remainder);
- }
- quotient = expand_shift (RSHIFT_EXPR, compute_mode, op0,
- build_int_2 (pre_shift, 0),
- tquotient, 1);
- }
- else if (size <= HOST_BITS_PER_WIDE_INT)
- {
- if (d >= ((unsigned HOST_WIDE_INT) 1 << (size - 1)))
- {
- /* Most significant bit of divisor is set; emit an scc
- insn. */
- quotient = emit_store_flag (tquotient, GEU, op0, op1,
- compute_mode, 1, 1);
- if (quotient == 0)
- goto fail1;
- }
- else
- {
- /* Find a suitable multiplier and right shift count
- instead of multiplying with D. */
-
- mh = choose_multiplier (d, size, size,
- &ml, &post_shift, &dummy);
-
- /* If the suggested multiplier is more than SIZE bits,
- we can do better for even divisors, using an
- initial right shift. */
- if (mh != 0 && (d & 1) == 0)
- {
- pre_shift = floor_log2 (d & -d);
- mh = choose_multiplier (d >> pre_shift, size,
- size - pre_shift,
- &ml, &post_shift, &dummy);
- if (mh)
- abort ();
- }
- else
- pre_shift = 0;
-
- if (mh != 0)
- {
- rtx t1, t2, t3, t4;
-
- extra_cost = (shift_cost[post_shift - 1]
- + shift_cost[1] + 2 * add_cost);
- t1 = expand_mult_highpart (compute_mode, op0, ml,
- NULL_RTX, 1,
- max_cost - extra_cost);
- if (t1 == 0)
- goto fail1;
- t2 = force_operand (gen_rtx (MINUS, compute_mode,
- op0, t1),
- NULL_RTX);
- t3 = expand_shift (RSHIFT_EXPR, compute_mode, t2,
- build_int_2 (1, 0), NULL_RTX,1);
- t4 = force_operand (gen_rtx (PLUS, compute_mode,
- t1, t3),
- NULL_RTX);
- quotient =
- expand_shift (RSHIFT_EXPR, compute_mode, t4,
- build_int_2 (post_shift - 1, 0),
- tquotient, 1);
- }
- else
- {
- rtx t1, t2;
-
- t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
- build_int_2 (pre_shift, 0),
- NULL_RTX, 1);
- extra_cost = (shift_cost[pre_shift]
- + shift_cost[post_shift]);
- t2 = expand_mult_highpart (compute_mode, t1, ml,
- NULL_RTX, 1,
- max_cost - extra_cost);
- if (t2 == 0)
- goto fail1;
- quotient =
- expand_shift (RSHIFT_EXPR, compute_mode, t2,
- build_int_2 (post_shift, 0),
- tquotient, 1);
- }
- }
- }
- else /* Too wide mode to use tricky code */
- break;
-
- insn = get_last_insn ();
- if (insn != last
- && (set = single_set (insn)) != 0
- && SET_DEST (set) == quotient)
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (UDIV, compute_mode, op0, op1),
- REG_NOTES (insn));
- }
- else /* TRUNC_DIV, signed */
- {
- unsigned HOST_WIDE_INT ml;
- int lgup, post_shift;
- HOST_WIDE_INT d = INTVAL (op1);
- unsigned HOST_WIDE_INT abs_d = d >= 0 ? d : -d;
-
- /* n rem d = n rem -d */
- if (rem_flag && d < 0)
- {
- d = abs_d;
- op1 = GEN_INT (abs_d);
- }
-
- if (d == 1)
- quotient = op0;
- else if (d == -1)
- quotient = expand_unop (compute_mode, neg_optab, op0,
- tquotient, 0);
- else if (abs_d == (unsigned HOST_WIDE_INT) 1 << (size - 1))
- {
- /* This case is not handled correctly below. */
- quotient = emit_store_flag (tquotient, EQ, op0, op1,
- compute_mode, 1, 1);
- if (quotient == 0)
- goto fail1;
- }
- else if (EXACT_POWER_OF_2_OR_ZERO_P (d)
- && (rem_flag ? smod_pow2_cheap : sdiv_pow2_cheap))
- ;
- else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d))
- {
- lgup = floor_log2 (abs_d);
- if (abs_d != 2 && BRANCH_COST < 3)
- {
- rtx label = gen_label_rtx ();
- rtx t1;
-
- t1 = copy_to_mode_reg (compute_mode, op0);
- emit_cmp_insn (t1, const0_rtx, GE,
- NULL_RTX, compute_mode, 0, 0);
- emit_jump_insn (gen_bge (label));
- expand_inc (t1, GEN_INT (abs_d - 1));
- emit_label (label);
- quotient = expand_shift (RSHIFT_EXPR, compute_mode, t1,
- build_int_2 (lgup, 0),
- tquotient, 0);
- }
- else
- {
- rtx t1, t2, t3;
- t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
- build_int_2 (size - 1, 0),
- NULL_RTX, 0);
- t2 = expand_shift (RSHIFT_EXPR, compute_mode, t1,
- build_int_2 (size - lgup, 0),
- NULL_RTX, 1);
- t3 = force_operand (gen_rtx (PLUS, compute_mode,
- op0, t2),
- NULL_RTX);
- quotient = expand_shift (RSHIFT_EXPR, compute_mode, t3,
- build_int_2 (lgup, 0),
- tquotient, 0);
- }
-
- /* We have computed OP0 / abs(OP1). If OP1 is negative, negate
- the quotient. */
- if (d < 0)
- {
- insn = get_last_insn ();
- if (insn != last
- && (set = single_set (insn)) != 0
- && SET_DEST (set) == quotient)
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (DIV, compute_mode, op0,
- GEN_INT (abs_d)),
- REG_NOTES (insn));
-
- quotient = expand_unop (compute_mode, neg_optab,
- quotient, quotient, 0);
- }
- }
- else if (size <= HOST_BITS_PER_WIDE_INT)
- {
- choose_multiplier (abs_d, size, size - 1,
- &ml, &post_shift, &lgup);
- if (ml < (unsigned HOST_WIDE_INT) 1 << (size - 1))
- {
- rtx t1, t2, t3;
-
- extra_cost = (shift_cost[post_shift]
- + shift_cost[size - 1] + add_cost);
- t1 = expand_mult_highpart (compute_mode, op0, ml,
- NULL_RTX, 0,
- max_cost - extra_cost);
- if (t1 == 0)
- goto fail1;
- t2 = expand_shift (RSHIFT_EXPR, compute_mode, t1,
- build_int_2 (post_shift, 0), NULL_RTX, 0);
- t3 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
- build_int_2 (size - 1, 0), NULL_RTX, 0);
- if (d < 0)
- quotient = force_operand (gen_rtx (MINUS, compute_mode, t3, t2),
- tquotient);
- else
- quotient = force_operand (gen_rtx (MINUS, compute_mode, t2, t3),
- tquotient);
- }
- else
- {
- rtx t1, t2, t3, t4;
-
- ml |= (~(unsigned HOST_WIDE_INT) 0) << (size - 1);
- extra_cost = (shift_cost[post_shift]
- + shift_cost[size - 1] + 2 * add_cost);
- t1 = expand_mult_highpart (compute_mode, op0, ml,
- NULL_RTX, 0,
- max_cost - extra_cost);
- if (t1 == 0)
- goto fail1;
- t2 = force_operand (gen_rtx (PLUS, compute_mode, t1, op0),
- NULL_RTX);
- t3 = expand_shift (RSHIFT_EXPR, compute_mode, t2,
- build_int_2 (post_shift, 0), NULL_RTX, 0);
- t4 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
- build_int_2 (size - 1, 0), NULL_RTX, 0);
- if (d < 0)
- quotient = force_operand (gen_rtx (MINUS, compute_mode, t4, t3),
- tquotient);
- else
- quotient = force_operand (gen_rtx (MINUS, compute_mode, t3, t4),
- tquotient);
- }
- }
- else /* Too wide mode to use tricky code */
- break;
-
- insn = get_last_insn ();
- if (insn != last
- && (set = single_set (insn)) != 0
- && SET_DEST (set) == quotient)
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (DIV, compute_mode, op0, op1),
- REG_NOTES (insn));
- }
- break;
- }
- fail1:
- delete_insns_since (last);
- break;
-
- case FLOOR_DIV_EXPR:
- case FLOOR_MOD_EXPR:
- /* We will come here only for signed operations. */
- if (op1_is_constant && HOST_BITS_PER_WIDE_INT >= size)
- {
- unsigned HOST_WIDE_INT mh, ml;
- int pre_shift, lgup, post_shift;
- HOST_WIDE_INT d = INTVAL (op1);
-
- if (d > 0)
- {
- /* We could just as easily deal with negative constants here,
- but it does not seem worth the trouble for GCC 2.6. */
- if (EXACT_POWER_OF_2_OR_ZERO_P (d))
- {
- pre_shift = floor_log2 (d);
- if (rem_flag)
- {
- remainder = expand_binop (compute_mode, and_optab, op0,
- GEN_INT (((HOST_WIDE_INT) 1 << pre_shift) - 1),
- remainder, 0, OPTAB_LIB_WIDEN);
- if (remainder)
- return gen_lowpart (mode, remainder);
- }
- quotient = expand_shift (RSHIFT_EXPR, compute_mode, op0,
- build_int_2 (pre_shift, 0),
- tquotient, 0);
- }
- else
- {
- rtx t1, t2, t3, t4;
-
- mh = choose_multiplier (d, size, size - 1,
- &ml, &post_shift, &lgup);
- if (mh)
- abort ();
-
- t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
- build_int_2 (size - 1, 0), NULL_RTX, 0);
- t2 = expand_binop (compute_mode, xor_optab, op0, t1,
- NULL_RTX, 0, OPTAB_WIDEN);
- extra_cost = (shift_cost[post_shift]
- + shift_cost[size - 1] + 2 * add_cost);
- t3 = expand_mult_highpart (compute_mode, t2, ml,
- NULL_RTX, 1,
- max_cost - extra_cost);
- if (t3 != 0)
- {
- t4 = expand_shift (RSHIFT_EXPR, compute_mode, t3,
- build_int_2 (post_shift, 0),
- NULL_RTX, 1);
- quotient = expand_binop (compute_mode, xor_optab,
- t4, t1, tquotient, 0,
- OPTAB_WIDEN);
- }
- }
- }
- else
- {
- rtx nsign, t1, t2, t3, t4;
- t1 = force_operand (gen_rtx (PLUS, compute_mode,
- op0, constm1_rtx), NULL_RTX);
- t2 = expand_binop (compute_mode, ior_optab, op0, t1, NULL_RTX,
- 0, OPTAB_WIDEN);
- nsign = expand_shift (RSHIFT_EXPR, compute_mode, t2,
- build_int_2 (size - 1, 0), NULL_RTX, 0);
- t3 = force_operand (gen_rtx (MINUS, compute_mode, t1, nsign),
- NULL_RTX);
- t4 = expand_divmod (0, TRUNC_DIV_EXPR, compute_mode, t3, op1,
- NULL_RTX, 0);
- if (t4)
- {
- rtx t5;
- t5 = expand_unop (compute_mode, one_cmpl_optab, nsign,
- NULL_RTX, 0);
- quotient = force_operand (gen_rtx (PLUS, compute_mode,
- t4, t5),
- tquotient);
- }
- }
- }
-
- if (quotient != 0)
- break;
- delete_insns_since (last);
-
- /* Try using an instruction that produces both the quotient and
- remainder, using truncation. We can easily compensate the quotient
- or remainder to get floor rounding, once we have the remainder.
- Notice that we compute also the final remainder value here,
- and return the result right away. */
- if (target == 0 || GET_MODE (target) != compute_mode)
- target = gen_reg_rtx (compute_mode);
-
- if (rem_flag)
- {
- remainder
- = GET_CODE (target) == REG ? target : gen_reg_rtx (compute_mode);
- quotient = gen_reg_rtx (compute_mode);
- }
- else
- {
- quotient
- = GET_CODE (target) == REG ? target : gen_reg_rtx (compute_mode);
- remainder = gen_reg_rtx (compute_mode);
- }
-
- if (expand_twoval_binop (sdivmod_optab, op0, op1,
- quotient, remainder, 0))
- {
- /* This could be computed with a branch-less sequence.
- Save that for later. */
- rtx tem;
- rtx label = gen_label_rtx ();
- emit_cmp_insn (remainder, const0_rtx, EQ, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_beq (label));
- tem = expand_binop (compute_mode, xor_optab, op0, op1,
- NULL_RTX, 0, OPTAB_WIDEN);
- emit_cmp_insn (tem, const0_rtx, GE, NULL_RTX, compute_mode, 0, 0);
- emit_jump_insn (gen_bge (label));
- expand_dec (quotient, const1_rtx);
- expand_inc (remainder, op1);
- emit_label (label);
- return gen_lowpart (mode, rem_flag ? remainder : quotient);
- }
-
- /* No luck with division elimination or divmod. Have to do it
- by conditionally adjusting op0 *and* the result. */
- {
- rtx label1, label2, label3, label4, label5;
- rtx adjusted_op0;
- rtx tem;
-
- quotient = gen_reg_rtx (compute_mode);
- adjusted_op0 = copy_to_mode_reg (compute_mode, op0);
- label1 = gen_label_rtx ();
- label2 = gen_label_rtx ();
- label3 = gen_label_rtx ();
- label4 = gen_label_rtx ();
- label5 = gen_label_rtx ();
- emit_cmp_insn (op1, const0_rtx, LT, NULL_RTX, compute_mode, 0, 0);
- emit_jump_insn (gen_blt (label2));
- emit_cmp_insn (adjusted_op0, const0_rtx, LT, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_blt (label1));
- tem = expand_binop (compute_mode, sdiv_optab, adjusted_op0, op1,
- quotient, 0, OPTAB_LIB_WIDEN);
- if (tem != quotient)
- emit_move_insn (quotient, tem);
- emit_jump_insn (gen_jump (label5));
- emit_barrier ();
- emit_label (label1);
- expand_inc (adjusted_op0, const1_rtx);
- emit_jump_insn (gen_jump (label4));
- emit_barrier ();
- emit_label (label2);
- emit_cmp_insn (adjusted_op0, const0_rtx, GT, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_bgt (label3));
- tem = expand_binop (compute_mode, sdiv_optab, adjusted_op0, op1,
- quotient, 0, OPTAB_LIB_WIDEN);
- if (tem != quotient)
- emit_move_insn (quotient, tem);
- emit_jump_insn (gen_jump (label5));
- emit_barrier ();
- emit_label (label3);
- expand_dec (adjusted_op0, const1_rtx);
- emit_label (label4);
- tem = expand_binop (compute_mode, sdiv_optab, adjusted_op0, op1,
- quotient, 0, OPTAB_LIB_WIDEN);
- if (tem != quotient)
- emit_move_insn (quotient, tem);
- expand_dec (quotient, const1_rtx);
- emit_label (label5);
- }
- break;
-
- case CEIL_DIV_EXPR:
- case CEIL_MOD_EXPR:
- if (unsignedp)
- {
- if (op1_is_constant && EXACT_POWER_OF_2_OR_ZERO_P (INTVAL (op1)))
- {
- rtx t1, t2, t3;
- unsigned HOST_WIDE_INT d = INTVAL (op1);
- t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
- build_int_2 (floor_log2 (d), 0),
- tquotient, 1);
- t2 = expand_binop (compute_mode, and_optab, op0,
- GEN_INT (d - 1),
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
- t3 = gen_reg_rtx (compute_mode);
- t3 = emit_store_flag (t3, NE, t2, const0_rtx,
- compute_mode, 1, 1);
- if (t3 == 0)
- {
- rtx lab;
- lab = gen_label_rtx ();
- emit_cmp_insn (t2, const0_rtx, EQ, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_beq (lab));
- expand_inc (t1, const1_rtx);
- emit_label (lab);
- quotient = t1;
- }
- else
- quotient = force_operand (gen_rtx (PLUS, compute_mode,
- t1, t3),
- tquotient);
- break;
- }
-
- /* Try using an instruction that produces both the quotient and
- remainder, using truncation. We can easily compensate the
- quotient or remainder to get ceiling rounding, once we have the
- remainder. Notice that we compute also the final remainder
- value here, and return the result right away. */
- if (target == 0 || GET_MODE (target) != compute_mode)
- target = gen_reg_rtx (compute_mode);
-
- if (rem_flag)
- {
- remainder = (GET_CODE (target) == REG
- ? target : gen_reg_rtx (compute_mode));
- quotient = gen_reg_rtx (compute_mode);
- }
- else
- {
- quotient = (GET_CODE (target) == REG
- ? target : gen_reg_rtx (compute_mode));
- remainder = gen_reg_rtx (compute_mode);
- }
-
- if (expand_twoval_binop (udivmod_optab, op0, op1, quotient,
- remainder, 1))
- {
- /* This could be computed with a branch-less sequence.
- Save that for later. */
- rtx label = gen_label_rtx ();
- emit_cmp_insn (remainder, const0_rtx, EQ, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_beq (label));
- expand_inc (quotient, const1_rtx);
- expand_dec (remainder, op1);
- emit_label (label);
- return gen_lowpart (mode, rem_flag ? remainder : quotient);
- }
-
- /* No luck with division elimination or divmod. Have to do it
- by conditionally adjusting op0 *and* the result. */
- {
- rtx label1, label2;
- rtx adjusted_op0, tem;
-
- quotient = gen_reg_rtx (compute_mode);
- adjusted_op0 = copy_to_mode_reg (compute_mode, op0);
- label1 = gen_label_rtx ();
- label2 = gen_label_rtx ();
- emit_cmp_insn (adjusted_op0, const0_rtx, NE, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_bne (label1));
- emit_move_insn (quotient, const0_rtx);
- emit_jump_insn (gen_jump (label2));
- emit_barrier ();
- emit_label (label1);
- expand_dec (adjusted_op0, const1_rtx);
- tem = expand_binop (compute_mode, udiv_optab, adjusted_op0, op1,
- quotient, 1, OPTAB_LIB_WIDEN);
- if (tem != quotient)
- emit_move_insn (quotient, tem);
- expand_inc (quotient, const1_rtx);
- emit_label (label2);
- }
- }
- else /* signed */
- {
- if (op1_is_constant && EXACT_POWER_OF_2_OR_ZERO_P (INTVAL (op1))
- && INTVAL (op1) >= 0)
- {
- /* This is extremely similar to the code for the unsigned case
- above. For 2.7 we should merge these variants, but for
- 2.6.1 I don't want to touch the code for unsigned since that
- get used in C. The signed case will only be used by other
- languages (Ada). */
-
- rtx t1, t2, t3;
- unsigned HOST_WIDE_INT d = INTVAL (op1);
- t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
- build_int_2 (floor_log2 (d), 0),
- tquotient, 0);
- t2 = expand_binop (compute_mode, and_optab, op0,
- GEN_INT (d - 1),
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
- t3 = gen_reg_rtx (compute_mode);
- t3 = emit_store_flag (t3, NE, t2, const0_rtx,
- compute_mode, 1, 1);
- if (t3 == 0)
- {
- rtx lab;
- lab = gen_label_rtx ();
- emit_cmp_insn (t2, const0_rtx, EQ, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_beq (lab));
- expand_inc (t1, const1_rtx);
- emit_label (lab);
- quotient = t1;
- }
- else
- quotient = force_operand (gen_rtx (PLUS, compute_mode,
- t1, t3),
- tquotient);
- break;
- }
-
- /* Try using an instruction that produces both the quotient and
- remainder, using truncation. We can easily compensate the
- quotient or remainder to get ceiling rounding, once we have the
- remainder. Notice that we compute also the final remainder
- value here, and return the result right away. */
- if (target == 0 || GET_MODE (target) != compute_mode)
- target = gen_reg_rtx (compute_mode);
- if (rem_flag)
- {
- remainder= (GET_CODE (target) == REG
- ? target : gen_reg_rtx (compute_mode));
- quotient = gen_reg_rtx (compute_mode);
- }
- else
- {
- quotient = (GET_CODE (target) == REG
- ? target : gen_reg_rtx (compute_mode));
- remainder = gen_reg_rtx (compute_mode);
- }
-
- if (expand_twoval_binop (sdivmod_optab, op0, op1, quotient,
- remainder, 0))
- {
- /* This could be computed with a branch-less sequence.
- Save that for later. */
- rtx tem;
- rtx label = gen_label_rtx ();
- emit_cmp_insn (remainder, const0_rtx, EQ, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_beq (label));
- tem = expand_binop (compute_mode, xor_optab, op0, op1,
- NULL_RTX, 0, OPTAB_WIDEN);
- emit_cmp_insn (tem, const0_rtx, LT, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_blt (label));
- expand_inc (quotient, const1_rtx);
- expand_dec (remainder, op1);
- emit_label (label);
- return gen_lowpart (mode, rem_flag ? remainder : quotient);
- }
-
- /* No luck with division elimination or divmod. Have to do it
- by conditionally adjusting op0 *and* the result. */
- {
- rtx label1, label2, label3, label4, label5;
- rtx adjusted_op0;
- rtx tem;
-
- quotient = gen_reg_rtx (compute_mode);
- adjusted_op0 = copy_to_mode_reg (compute_mode, op0);
- label1 = gen_label_rtx ();
- label2 = gen_label_rtx ();
- label3 = gen_label_rtx ();
- label4 = gen_label_rtx ();
- label5 = gen_label_rtx ();
- emit_cmp_insn (op1, const0_rtx, LT, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_blt (label2));
- emit_cmp_insn (adjusted_op0, const0_rtx, GT, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_bgt (label1));
- tem = expand_binop (compute_mode, sdiv_optab, adjusted_op0, op1,
- quotient, 0, OPTAB_LIB_WIDEN);
- if (tem != quotient)
- emit_move_insn (quotient, tem);
- emit_jump_insn (gen_jump (label5));
- emit_barrier ();
- emit_label (label1);
- expand_dec (adjusted_op0, const1_rtx);
- emit_jump_insn (gen_jump (label4));
- emit_barrier ();
- emit_label (label2);
- emit_cmp_insn (adjusted_op0, const0_rtx, LT, NULL_RTX,
- compute_mode, 0, 0);
- emit_jump_insn (gen_blt (label3));
- tem = expand_binop (compute_mode, sdiv_optab, adjusted_op0, op1,
- quotient, 0, OPTAB_LIB_WIDEN);
- if (tem != quotient)
- emit_move_insn (quotient, tem);
- emit_jump_insn (gen_jump (label5));
- emit_barrier ();
- emit_label (label3);
- expand_inc (adjusted_op0, const1_rtx);
- emit_label (label4);
- tem = expand_binop (compute_mode, sdiv_optab, adjusted_op0, op1,
- quotient, 0, OPTAB_LIB_WIDEN);
- if (tem != quotient)
- emit_move_insn (quotient, tem);
- expand_inc (quotient, const1_rtx);
- emit_label (label5);
- }
- }
- break;
-
- case EXACT_DIV_EXPR:
- if (op1_is_constant && HOST_BITS_PER_WIDE_INT >= size)
- {
- HOST_WIDE_INT d = INTVAL (op1);
- unsigned HOST_WIDE_INT ml;
- int post_shift;
- rtx t1;
-
- post_shift = floor_log2 (d & -d);
- ml = invert_mod2n (d >> post_shift, size);
- t1 = expand_mult (compute_mode, op0, GEN_INT (ml), NULL_RTX,
- unsignedp);
- quotient = expand_shift (RSHIFT_EXPR, compute_mode, t1,
- build_int_2 (post_shift, 0),
- NULL_RTX, unsignedp);
-
- insn = get_last_insn ();
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (unsignedp ? UDIV : DIV, compute_mode,
- op0, op1),
- REG_NOTES (insn));
- }
- break;
-
- case ROUND_DIV_EXPR:
- case ROUND_MOD_EXPR:
- if (unsignedp)
- {
- rtx tem;
- rtx label;
- label = gen_label_rtx ();
- quotient = gen_reg_rtx (compute_mode);
- remainder = gen_reg_rtx (compute_mode);
- if (expand_twoval_binop (udivmod_optab, op0, op1, quotient, remainder, 1) == 0)
- {
- rtx tem;
- quotient = expand_binop (compute_mode, udiv_optab, op0, op1,
- quotient, 1, OPTAB_LIB_WIDEN);
- tem = expand_mult (compute_mode, quotient, op1, NULL_RTX, 1);
- remainder = expand_binop (compute_mode, sub_optab, op0, tem,
- remainder, 1, OPTAB_LIB_WIDEN);
- }
- tem = plus_constant (op1, -1);
- tem = expand_shift (RSHIFT_EXPR, compute_mode, tem,
- build_int_2 (1, 0), NULL_RTX, 1);
- emit_cmp_insn (remainder, tem, LEU, NULL_RTX, compute_mode, 0, 0);
- emit_jump_insn (gen_bleu (label));
- expand_inc (quotient, const1_rtx);
- expand_dec (remainder, op1);
- emit_label (label);
- }
- else
- {
- rtx abs_rem, abs_op1, tem, mask;
- rtx label;
- label = gen_label_rtx ();
- quotient = gen_reg_rtx (compute_mode);
- remainder = gen_reg_rtx (compute_mode);
- if (expand_twoval_binop (sdivmod_optab, op0, op1, quotient, remainder, 0) == 0)
- {
- rtx tem;
- quotient = expand_binop (compute_mode, sdiv_optab, op0, op1,
- quotient, 0, OPTAB_LIB_WIDEN);
- tem = expand_mult (compute_mode, quotient, op1, NULL_RTX, 0);
- remainder = expand_binop (compute_mode, sub_optab, op0, tem,
- remainder, 0, OPTAB_LIB_WIDEN);
- }
- abs_rem = expand_abs (compute_mode, remainder, NULL_RTX, 0, 0);
- abs_op1 = expand_abs (compute_mode, op1, NULL_RTX, 0, 0);
- tem = expand_shift (LSHIFT_EXPR, compute_mode, abs_rem,
- build_int_2 (1, 0), NULL_RTX, 1);
- emit_cmp_insn (tem, abs_op1, LTU, NULL_RTX, compute_mode, 0, 0);
- emit_jump_insn (gen_bltu (label));
- tem = expand_binop (compute_mode, xor_optab, op0, op1,
- NULL_RTX, 0, OPTAB_WIDEN);
- mask = expand_shift (RSHIFT_EXPR, compute_mode, tem,
- build_int_2 (size - 1, 0), NULL_RTX, 0);
- tem = expand_binop (compute_mode, xor_optab, mask, const1_rtx,
- NULL_RTX, 0, OPTAB_WIDEN);
- tem = expand_binop (compute_mode, sub_optab, tem, mask,
- NULL_RTX, 0, OPTAB_WIDEN);
- expand_inc (quotient, tem);
- tem = expand_binop (compute_mode, xor_optab, mask, op1,
- NULL_RTX, 0, OPTAB_WIDEN);
- tem = expand_binop (compute_mode, sub_optab, tem, mask,
- NULL_RTX, 0, OPTAB_WIDEN);
- expand_dec (remainder, tem);
- emit_label (label);
- }
- return gen_lowpart (mode, rem_flag ? remainder : quotient);
- }
-
- if (quotient == 0)
- {
- if (target && GET_MODE (target) != compute_mode)
- target = 0;
-
- if (rem_flag)
- {
- /* Try to produce the remainder directly without a library call. */
- remainder = sign_expand_binop (compute_mode, umod_optab, smod_optab,
- op0, op1, target,
- unsignedp, OPTAB_WIDEN);
- if (remainder == 0)
- {
- /* No luck there. Can we do remainder and divide at once
- without a library call? */
- remainder = gen_reg_rtx (compute_mode);
- if (! expand_twoval_binop ((unsignedp
- ? udivmod_optab
- : sdivmod_optab),
- op0, op1,
- NULL_RTX, remainder, unsignedp))
- remainder = 0;
- }
-
- if (remainder)
- return gen_lowpart (mode, remainder);
- }
-
- /* Produce the quotient. Try a quotient insn, but not a library call.
- If we have a divmod in this mode, use it in preference to widening
- the div (for this test we assume it will not fail). Note that optab2
- is set to the one of the two optabs that the call below will use. */
- quotient
- = sign_expand_binop (compute_mode, udiv_optab, sdiv_optab,
- op0, op1, rem_flag ? NULL_RTX : target,
- unsignedp,
- ((optab2->handlers[(int) compute_mode].insn_code
- != CODE_FOR_nothing)
- ? OPTAB_DIRECT : OPTAB_WIDEN));
-
- if (quotient == 0)
- {
- /* No luck there. Try a quotient-and-remainder insn,
- keeping the quotient alone. */
- quotient = gen_reg_rtx (compute_mode);
- if (! expand_twoval_binop (unsignedp ? udivmod_optab : sdivmod_optab,
- op0, op1,
- quotient, NULL_RTX, unsignedp))
- {
- quotient = 0;
- if (! rem_flag)
- /* Still no luck. If we are not computing the remainder,
- use a library call for the quotient. */
- quotient = sign_expand_binop (compute_mode,
- udiv_optab, sdiv_optab,
- op0, op1, target,
- unsignedp, OPTAB_LIB_WIDEN);
- }
- }
- }
-
- if (rem_flag)
- {
- if (target && GET_MODE (target) != compute_mode)
- target = 0;
-
- if (quotient == 0)
- /* No divide instruction either. Use library for remainder. */
- remainder = sign_expand_binop (compute_mode, umod_optab, smod_optab,
- op0, op1, target,
- unsignedp, OPTAB_LIB_WIDEN);
- else
- {
- /* We divided. Now finish doing X - Y * (X / Y). */
- remainder = expand_mult (compute_mode, quotient, op1,
- NULL_RTX, unsignedp);
- remainder = expand_binop (compute_mode, sub_optab, op0,
- remainder, target, unsignedp,
- OPTAB_LIB_WIDEN);
- }
- }
-
- return gen_lowpart (mode, rem_flag ? remainder : quotient);
-}
-
-/* Return a tree node with data type TYPE, describing the value of X.
- Usually this is an RTL_EXPR, if there is no obvious better choice.
- X may be an expression, however we only support those expressions
- generated by loop.c. */
-
-tree
-make_tree (type, x)
- tree type;
- rtx x;
-{
- tree t;
-
- switch (GET_CODE (x))
- {
- case CONST_INT:
- t = build_int_2 (INTVAL (x),
- TREE_UNSIGNED (type) || INTVAL (x) >= 0 ? 0 : -1);
- TREE_TYPE (t) = type;
- return t;
-
- case CONST_DOUBLE:
- if (GET_MODE (x) == VOIDmode)
- {
- t = build_int_2 (CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x));
- TREE_TYPE (t) = type;
- }
- else
- {
- REAL_VALUE_TYPE d;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, x);
- t = build_real (type, d);
- }
-
- return t;
-
- case PLUS:
- return fold (build (PLUS_EXPR, type, make_tree (type, XEXP (x, 0)),
- make_tree (type, XEXP (x, 1))));
-
- case MINUS:
- return fold (build (MINUS_EXPR, type, make_tree (type, XEXP (x, 0)),
- make_tree (type, XEXP (x, 1))));
-
- case NEG:
- return fold (build1 (NEGATE_EXPR, type, make_tree (type, XEXP (x, 0))));
-
- case MULT:
- return fold (build (MULT_EXPR, type, make_tree (type, XEXP (x, 0)),
- make_tree (type, XEXP (x, 1))));
-
- case ASHIFT:
- return fold (build (LSHIFT_EXPR, type, make_tree (type, XEXP (x, 0)),
- make_tree (type, XEXP (x, 1))));
-
- case LSHIFTRT:
- return fold (convert (type,
- build (RSHIFT_EXPR, unsigned_type (type),
- make_tree (unsigned_type (type),
- XEXP (x, 0)),
- make_tree (type, XEXP (x, 1)))));
-
- case ASHIFTRT:
- return fold (convert (type,
- build (RSHIFT_EXPR, signed_type (type),
- make_tree (signed_type (type), XEXP (x, 0)),
- make_tree (type, XEXP (x, 1)))));
-
- case DIV:
- if (TREE_CODE (type) != REAL_TYPE)
- t = signed_type (type);
- else
- t = type;
-
- return fold (convert (type,
- build (TRUNC_DIV_EXPR, t,
- make_tree (t, XEXP (x, 0)),
- make_tree (t, XEXP (x, 1)))));
- case UDIV:
- t = unsigned_type (type);
- return fold (convert (type,
- build (TRUNC_DIV_EXPR, t,
- make_tree (t, XEXP (x, 0)),
- make_tree (t, XEXP (x, 1)))));
- default:
- t = make_node (RTL_EXPR);
- TREE_TYPE (t) = type;
- RTL_EXPR_RTL (t) = x;
- /* There are no insns to be output
- when this rtl_expr is used. */
- RTL_EXPR_SEQUENCE (t) = 0;
- return t;
- }
-}
-
-/* Return an rtx representing the value of X * MULT + ADD.
- TARGET is a suggestion for where to store the result (an rtx).
- MODE is the machine mode for the computation.
- X and MULT must have mode MODE. ADD may have a different mode.
- So can X (defaults to same as MODE).
- UNSIGNEDP is non-zero to do unsigned multiplication.
- This may emit insns. */
-
-rtx
-expand_mult_add (x, target, mult, add, mode, unsignedp)
- rtx x, target, mult, add;
- enum machine_mode mode;
- int unsignedp;
-{
- tree type = type_for_mode (mode, unsignedp);
- tree add_type = (GET_MODE (add) == VOIDmode
- ? type : type_for_mode (GET_MODE (add), unsignedp));
- tree result = fold (build (PLUS_EXPR, type,
- fold (build (MULT_EXPR, type,
- make_tree (type, x),
- make_tree (type, mult))),
- make_tree (add_type, add)));
-
- return expand_expr (result, target, VOIDmode, 0);
-}
-
-/* Compute the logical-and of OP0 and OP1, storing it in TARGET
- and returning TARGET.
-
- If TARGET is 0, a pseudo-register or constant is returned. */
-
-rtx
-expand_and (op0, op1, target)
- rtx op0, op1, target;
-{
- enum machine_mode mode = VOIDmode;
- rtx tem;
-
- if (GET_MODE (op0) != VOIDmode)
- mode = GET_MODE (op0);
- else if (GET_MODE (op1) != VOIDmode)
- mode = GET_MODE (op1);
-
- if (mode != VOIDmode)
- tem = expand_binop (mode, and_optab, op0, op1, target, 0, OPTAB_LIB_WIDEN);
- else if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT)
- tem = GEN_INT (INTVAL (op0) & INTVAL (op1));
- else
- abort ();
-
- if (target == 0)
- target = tem;
- else if (tem != target)
- emit_move_insn (target, tem);
- return target;
-}
-
-/* Emit a store-flags instruction for comparison CODE on OP0 and OP1
- and storing in TARGET. Normally return TARGET.
- Return 0 if that cannot be done.
-
- MODE is the mode to use for OP0 and OP1 should they be CONST_INTs. If
- it is VOIDmode, they cannot both be CONST_INT.
-
- UNSIGNEDP is for the case where we have to widen the operands
- to perform the operation. It says to use zero-extension.
-
- NORMALIZEP is 1 if we should convert the result to be either zero
- or one. Normalize is -1 if we should convert the result to be
- either zero or -1. If NORMALIZEP is zero, the result will be left
- "raw" out of the scc insn. */
-
-rtx
-emit_store_flag (target, code, op0, op1, mode, unsignedp, normalizep)
- rtx target;
- enum rtx_code code;
- rtx op0, op1;
- enum machine_mode mode;
- int unsignedp;
- int normalizep;
-{
- rtx subtarget;
- enum insn_code icode;
- enum machine_mode compare_mode;
- enum machine_mode target_mode = GET_MODE (target);
- rtx tem;
- rtx last = get_last_insn ();
- rtx pattern, comparison;
-
- /* If one operand is constant, make it the second one. Only do this
- if the other operand is not constant as well. */
-
- if ((CONSTANT_P (op0) && ! CONSTANT_P (op1))
- || (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
- {
- tem = op0;
- op0 = op1;
- op1 = tem;
- code = swap_condition (code);
- }
-
- if (mode == VOIDmode)
- mode = GET_MODE (op0);
-
- /* For some comparisons with 1 and -1, we can convert this to
- comparisons with zero. This will often produce more opportunities for
- store-flag insns. */
-
- switch (code)
- {
- case LT:
- if (op1 == const1_rtx)
- op1 = const0_rtx, code = LE;
- break;
- case LE:
- if (op1 == constm1_rtx)
- op1 = const0_rtx, code = LT;
- break;
- case GE:
- if (op1 == const1_rtx)
- op1 = const0_rtx, code = GT;
- break;
- case GT:
- if (op1 == constm1_rtx)
- op1 = const0_rtx, code = GE;
- break;
- case GEU:
- if (op1 == const1_rtx)
- op1 = const0_rtx, code = NE;
- break;
- case LTU:
- if (op1 == const1_rtx)
- op1 = const0_rtx, code = EQ;
- break;
- }
-
- /* From now on, we won't change CODE, so set ICODE now. */
- icode = setcc_gen_code[(int) code];
-
- /* If this is A < 0 or A >= 0, we can do this by taking the ones
- complement of A (for GE) and shifting the sign bit to the low bit. */
- if (op1 == const0_rtx && (code == LT || code == GE)
- && GET_MODE_CLASS (mode) == MODE_INT
- && (normalizep || STORE_FLAG_VALUE == 1
- || (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && ((STORE_FLAG_VALUE & GET_MODE_MASK (mode))
- == (HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (mode) - 1)))))
- {
- subtarget = target;
-
- /* If the result is to be wider than OP0, it is best to convert it
- first. If it is to be narrower, it is *incorrect* to convert it
- first. */
- if (GET_MODE_SIZE (target_mode) > GET_MODE_SIZE (mode))
- {
- op0 = protect_from_queue (op0, 0);
- op0 = convert_modes (target_mode, mode, op0, 0);
- mode = target_mode;
- }
-
- if (target_mode != mode)
- subtarget = 0;
-
- if (code == GE)
- op0 = expand_unop (mode, one_cmpl_optab, op0,
- ((STORE_FLAG_VALUE == 1 || normalizep)
- ? 0 : subtarget), 0);
-
- if (STORE_FLAG_VALUE == 1 || normalizep)
- /* If we are supposed to produce a 0/1 value, we want to do
- a logical shift from the sign bit to the low-order bit; for
- a -1/0 value, we do an arithmetic shift. */
- op0 = expand_shift (RSHIFT_EXPR, mode, op0,
- size_int (GET_MODE_BITSIZE (mode) - 1),
- subtarget, normalizep != -1);
-
- if (mode != target_mode)
- op0 = convert_modes (target_mode, mode, op0, 0);
-
- return op0;
- }
-
- if (icode != CODE_FOR_nothing)
- {
- /* We think we may be able to do this with a scc insn. Emit the
- comparison and then the scc insn.
-
- compare_from_rtx may call emit_queue, which would be deleted below
- if the scc insn fails. So call it ourselves before setting LAST. */
-
- emit_queue ();
- last = get_last_insn ();
-
- comparison
- = compare_from_rtx (op0, op1, code, unsignedp, mode, NULL_RTX, 0);
- if (GET_CODE (comparison) == CONST_INT)
- return (comparison == const0_rtx ? const0_rtx
- : normalizep == 1 ? const1_rtx
- : normalizep == -1 ? constm1_rtx
- : const_true_rtx);
-
- /* If the code of COMPARISON doesn't match CODE, something is
- wrong; we can no longer be sure that we have the operation.
- We could handle this case, but it should not happen. */
-
- if (GET_CODE (comparison) != code)
- abort ();
-
- /* Get a reference to the target in the proper mode for this insn. */
- compare_mode = insn_operand_mode[(int) icode][0];
- subtarget = target;
- if (preserve_subexpressions_p ()
- || ! (*insn_operand_predicate[(int) icode][0]) (subtarget, compare_mode))
- subtarget = gen_reg_rtx (compare_mode);
-
- pattern = GEN_FCN (icode) (subtarget);
- if (pattern)
- {
- emit_insn (pattern);
-
- /* If we are converting to a wider mode, first convert to
- TARGET_MODE, then normalize. This produces better combining
- opportunities on machines that have a SIGN_EXTRACT when we are
- testing a single bit. This mostly benefits the 68k.
-
- If STORE_FLAG_VALUE does not have the sign bit set when
- interpreted in COMPARE_MODE, we can do this conversion as
- unsigned, which is usually more efficient. */
- if (GET_MODE_SIZE (target_mode) > GET_MODE_SIZE (compare_mode))
- {
- convert_move (target, subtarget,
- (GET_MODE_BITSIZE (compare_mode)
- <= HOST_BITS_PER_WIDE_INT)
- && 0 == (STORE_FLAG_VALUE
- & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (compare_mode) -1))));
- op0 = target;
- compare_mode = target_mode;
- }
- else
- op0 = subtarget;
-
- /* If we want to keep subexpressions around, don't reuse our
- last target. */
-
- if (preserve_subexpressions_p ())
- subtarget = 0;
-
- /* Now normalize to the proper value in COMPARE_MODE. Sometimes
- we don't have to do anything. */
- if (normalizep == 0 || normalizep == STORE_FLAG_VALUE)
- ;
- else if (normalizep == - STORE_FLAG_VALUE)
- op0 = expand_unop (compare_mode, neg_optab, op0, subtarget, 0);
-
- /* We don't want to use STORE_FLAG_VALUE < 0 below since this
- makes it hard to use a value of just the sign bit due to
- ANSI integer constant typing rules. */
- else if (GET_MODE_BITSIZE (compare_mode) <= HOST_BITS_PER_WIDE_INT
- && (STORE_FLAG_VALUE
- & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (compare_mode) - 1))))
- op0 = expand_shift (RSHIFT_EXPR, compare_mode, op0,
- size_int (GET_MODE_BITSIZE (compare_mode) - 1),
- subtarget, normalizep == 1);
- else if (STORE_FLAG_VALUE & 1)
- {
- op0 = expand_and (op0, const1_rtx, subtarget);
- if (normalizep == -1)
- op0 = expand_unop (compare_mode, neg_optab, op0, op0, 0);
- }
- else
- abort ();
-
- /* If we were converting to a smaller mode, do the
- conversion now. */
- if (target_mode != compare_mode)
- {
- convert_move (target, op0, 0);
- return target;
- }
- else
- return op0;
- }
- }
-
- delete_insns_since (last);
-
- /* If expensive optimizations, use different pseudo registers for each
- insn, instead of reusing the same pseudo. This leads to better CSE,
- but slows down the compiler, since there are more pseudos */
- subtarget = (!flag_expensive_optimizations
- && (target_mode == mode)) ? target : NULL_RTX;
-
- /* If we reached here, we can't do this with a scc insn. However, there
- are some comparisons that can be done directly. For example, if
- this is an equality comparison of integers, we can try to exclusive-or
- (or subtract) the two operands and use a recursive call to try the
- comparison with zero. Don't do any of these cases if branches are
- very cheap. */
-
- if (BRANCH_COST > 0
- && GET_MODE_CLASS (mode) == MODE_INT && (code == EQ || code == NE)
- && op1 != const0_rtx)
- {
- tem = expand_binop (mode, xor_optab, op0, op1, subtarget, 1,
- OPTAB_WIDEN);
-
- if (tem == 0)
- tem = expand_binop (mode, sub_optab, op0, op1, subtarget, 1,
- OPTAB_WIDEN);
- if (tem != 0)
- tem = emit_store_flag (target, code, tem, const0_rtx,
- mode, unsignedp, normalizep);
- if (tem == 0)
- delete_insns_since (last);
- return tem;
- }
-
- /* Some other cases we can do are EQ, NE, LE, and GT comparisons with
- the constant zero. Reject all other comparisons at this point. Only
- do LE and GT if branches are expensive since they are expensive on
- 2-operand machines. */
-
- if (BRANCH_COST == 0
- || GET_MODE_CLASS (mode) != MODE_INT || op1 != const0_rtx
- || (code != EQ && code != NE
- && (BRANCH_COST <= 1 || (code != LE && code != GT))))
- return 0;
-
- /* See what we need to return. We can only return a 1, -1, or the
- sign bit. */
-
- if (normalizep == 0)
- {
- if (STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1)
- normalizep = STORE_FLAG_VALUE;
-
- else if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && ((STORE_FLAG_VALUE & GET_MODE_MASK (mode))
- == (HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (mode) - 1)))
- ;
- else
- return 0;
- }
-
- /* Try to put the result of the comparison in the sign bit. Assume we can't
- do the necessary operation below. */
-
- tem = 0;
-
- /* To see if A <= 0, compute (A | (A - 1)). A <= 0 iff that result has
- the sign bit set. */
-
- if (code == LE)
- {
- /* This is destructive, so SUBTARGET can't be OP0. */
- if (rtx_equal_p (subtarget, op0))
- subtarget = 0;
-
- tem = expand_binop (mode, sub_optab, op0, const1_rtx, subtarget, 0,
- OPTAB_WIDEN);
- if (tem)
- tem = expand_binop (mode, ior_optab, op0, tem, subtarget, 0,
- OPTAB_WIDEN);
- }
-
- /* To see if A > 0, compute (((signed) A) << BITS) - A, where BITS is the
- number of bits in the mode of OP0, minus one. */
-
- if (code == GT)
- {
- if (rtx_equal_p (subtarget, op0))
- subtarget = 0;
-
- tem = expand_shift (RSHIFT_EXPR, mode, op0,
- size_int (GET_MODE_BITSIZE (mode) - 1),
- subtarget, 0);
- tem = expand_binop (mode, sub_optab, tem, op0, subtarget, 0,
- OPTAB_WIDEN);
- }
-
- if (code == EQ || code == NE)
- {
- /* For EQ or NE, one way to do the comparison is to apply an operation
- that converts the operand into a positive number if it is non-zero
- or zero if it was originally zero. Then, for EQ, we subtract 1 and
- for NE we negate. This puts the result in the sign bit. Then we
- normalize with a shift, if needed.
-
- Two operations that can do the above actions are ABS and FFS, so try
- them. If that doesn't work, and MODE is smaller than a full word,
- we can use zero-extension to the wider mode (an unsigned conversion)
- as the operation. */
-
- if (abs_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- tem = expand_unop (mode, abs_optab, op0, subtarget, 1);
- else if (ffs_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- tem = expand_unop (mode, ffs_optab, op0, subtarget, 1);
- else if (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
- {
- op0 = protect_from_queue (op0, 0);
- tem = convert_modes (word_mode, mode, op0, 1);
- mode = word_mode;
- }
-
- if (tem != 0)
- {
- if (code == EQ)
- tem = expand_binop (mode, sub_optab, tem, const1_rtx, subtarget,
- 0, OPTAB_WIDEN);
- else
- tem = expand_unop (mode, neg_optab, tem, subtarget, 0);
- }
-
- /* If we couldn't do it that way, for NE we can "or" the two's complement
- of the value with itself. For EQ, we take the one's complement of
- that "or", which is an extra insn, so we only handle EQ if branches
- are expensive. */
-
- if (tem == 0 && (code == NE || BRANCH_COST > 1))
- {
- if (rtx_equal_p (subtarget, op0))
- subtarget = 0;
-
- tem = expand_unop (mode, neg_optab, op0, subtarget, 0);
- tem = expand_binop (mode, ior_optab, tem, op0, subtarget, 0,
- OPTAB_WIDEN);
-
- if (tem && code == EQ)
- tem = expand_unop (mode, one_cmpl_optab, tem, subtarget, 0);
- }
- }
-
- if (tem && normalizep)
- tem = expand_shift (RSHIFT_EXPR, mode, tem,
- size_int (GET_MODE_BITSIZE (mode) - 1),
- subtarget, normalizep == 1);
-
- if (tem)
- {
- if (GET_MODE (tem) != target_mode)
- {
- convert_move (target, tem, 0);
- tem = target;
- }
- else if (!subtarget)
- {
- emit_move_insn (target, tem);
- tem = target;
- }
- }
- else
- delete_insns_since (last);
-
- return tem;
-}
-
-/* Like emit_store_flag, but always succeeds. */
-
-rtx
-emit_store_flag_force (target, code, op0, op1, mode, unsignedp, normalizep)
- rtx target;
- enum rtx_code code;
- rtx op0, op1;
- enum machine_mode mode;
- int unsignedp;
- int normalizep;
-{
- rtx tem, label;
-
- /* First see if emit_store_flag can do the job. */
- tem = emit_store_flag (target, code, op0, op1, mode, unsignedp, normalizep);
- if (tem != 0)
- return tem;
-
- if (normalizep == 0)
- normalizep = 1;
-
- /* If this failed, we have to do this with set/compare/jump/set code. */
-
- if (GET_CODE (target) != REG
- || reg_mentioned_p (target, op0) || reg_mentioned_p (target, op1))
- target = gen_reg_rtx (GET_MODE (target));
-
- emit_move_insn (target, const1_rtx);
- tem = compare_from_rtx (op0, op1, code, unsignedp, mode, NULL_RTX, 0);
- if (GET_CODE (tem) == CONST_INT)
- return tem;
-
- label = gen_label_rtx ();
- if (bcc_gen_fctn[(int) code] == 0)
- abort ();
-
- emit_jump_insn ((*bcc_gen_fctn[(int) code]) (label));
- emit_move_insn (target, const0_rtx);
- emit_label (label);
-
- return target;
-}
diff --git a/gcc/expr.c b/gcc/expr.c
deleted file mode 100644
index 31e63a1fd8d..00000000000
--- a/gcc/expr.c
+++ /dev/null
@@ -1,12026 +0,0 @@
-/* Convert tree expression to rtl instructions, for GNU compiler.
- Copyright (C) 1988, 92, 93, 94, 95, 96, 1997 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. */
-
-
-#include "config.h"
-#include "machmode.h"
-#include "rtl.h"
-#include "tree.h"
-#include "obstack.h"
-#include "flags.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "except.h"
-#include "function.h"
-#include "insn-flags.h"
-#include "insn-codes.h"
-#include "expr.h"
-#include "insn-config.h"
-#include "recog.h"
-#include "output.h"
-#include "typeclass.h"
-
-#include "bytecode.h"
-#include "bc-opcode.h"
-#include "bc-typecd.h"
-#include "bc-optab.h"
-#include "bc-emit.h"
-
-
-#define CEIL(x,y) (((x) + (y) - 1) / (y))
-
-/* Decide whether a function's arguments should be processed
- from first to last or from last to first.
-
- They should if the stack and args grow in opposite directions, but
- only if we have push insns. */
-
-#ifdef PUSH_ROUNDING
-
-#if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD)
-#define PUSH_ARGS_REVERSED /* If it's last to first */
-#endif
-
-#endif
-
-#ifndef STACK_PUSH_CODE
-#ifdef STACK_GROWS_DOWNWARD
-#define STACK_PUSH_CODE PRE_DEC
-#else
-#define STACK_PUSH_CODE PRE_INC
-#endif
-#endif
-
-/* Like STACK_BOUNDARY but in units of bytes, not bits. */
-#define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
-
-/* If this is nonzero, we do not bother generating VOLATILE
- around volatile memory references, and we are willing to
- output indirect addresses. If cse is to follow, we reject
- indirect addresses so a useful potential cse is generated;
- if it is used only once, instruction combination will produce
- the same indirect address eventually. */
-int cse_not_expected;
-
-/* Nonzero to generate code for all the subroutines within an
- expression before generating the upper levels of the expression.
- Nowadays this is never zero. */
-int do_preexpand_calls = 1;
-
-/* Number of units that we should eventually pop off the stack.
- These are the arguments to function calls that have already returned. */
-int pending_stack_adjust;
-
-/* Nonzero means stack pops must not be deferred, and deferred stack
- pops must not be output. It is nonzero inside a function call,
- inside a conditional expression, inside a statement expression,
- and in other cases as well. */
-int inhibit_defer_pop;
-
-/* A list of all cleanups which belong to the arguments of
- function calls being expanded by expand_call. */
-tree cleanups_this_call;
-
-/* When temporaries are created by TARGET_EXPRs, they are created at
- this level of temp_slot_level, so that they can remain allocated
- until no longer needed. CLEANUP_POINT_EXPRs define the lifetime
- of TARGET_EXPRs. */
-int target_temp_slot_level;
-
-/* Nonzero means __builtin_saveregs has already been done in this function.
- The value is the pseudoreg containing the value __builtin_saveregs
- returned. */
-static rtx saveregs_value;
-
-/* Similarly for __builtin_apply_args. */
-static rtx apply_args_value;
-
-/* This structure is used by move_by_pieces to describe the move to
- be performed. */
-
-struct move_by_pieces
-{
- rtx to;
- rtx to_addr;
- int autinc_to;
- int explicit_inc_to;
- int to_struct;
- rtx from;
- rtx from_addr;
- int autinc_from;
- int explicit_inc_from;
- int from_struct;
- int len;
- int offset;
- int reverse;
-};
-
-/* This structure is used by clear_by_pieces to describe the clear to
- be performed. */
-
-struct clear_by_pieces
-{
- rtx to;
- rtx to_addr;
- int autinc_to;
- int explicit_inc_to;
- int to_struct;
- int len;
- int offset;
- int reverse;
-};
-
-/* Used to generate bytecodes: keep track of size of local variables,
- as well as depth of arithmetic stack. (Notice that variables are
- stored on the machine's stack, not the arithmetic stack.) */
-
-extern int local_vars_size;
-extern int stack_depth;
-extern int max_stack_depth;
-extern struct obstack permanent_obstack;
-extern rtx arg_pointer_save_area;
-
-static rtx enqueue_insn PROTO((rtx, rtx));
-static int queued_subexp_p PROTO((rtx));
-static void init_queue PROTO((void));
-static void move_by_pieces PROTO((rtx, rtx, int, int));
-static int move_by_pieces_ninsns PROTO((unsigned int, int));
-static void move_by_pieces_1 PROTO((rtx (*) (), enum machine_mode,
- struct move_by_pieces *));
-static void clear_by_pieces PROTO((rtx, int, int));
-static void clear_by_pieces_1 PROTO((rtx (*) (), enum machine_mode,
- struct clear_by_pieces *));
-static int is_zeros_p PROTO((tree));
-static int mostly_zeros_p PROTO((tree));
-static void store_constructor PROTO((tree, rtx, int));
-static rtx store_field PROTO((rtx, int, int, enum machine_mode, tree,
- enum machine_mode, int, int, int));
-static int get_inner_unaligned_p PROTO((tree));
-static tree save_noncopied_parts PROTO((tree, tree));
-static tree init_noncopied_parts PROTO((tree, tree));
-static int safe_from_p PROTO((rtx, tree));
-static int fixed_type_p PROTO((tree));
-static rtx var_rtx PROTO((tree));
-static int get_pointer_alignment PROTO((tree, unsigned));
-static tree string_constant PROTO((tree, tree *));
-static tree c_strlen PROTO((tree));
-static rtx expand_builtin PROTO((tree, rtx, rtx,
- enum machine_mode, int));
-static int apply_args_size PROTO((void));
-static int apply_result_size PROTO((void));
-static rtx result_vector PROTO((int, rtx));
-static rtx expand_builtin_apply_args PROTO((void));
-static rtx expand_builtin_apply PROTO((rtx, rtx, rtx));
-static void expand_builtin_return PROTO((rtx));
-static rtx expand_increment PROTO((tree, int, int));
-void bc_expand_increment PROTO((struct increment_operator *, tree));
-rtx bc_allocate_local PROTO((int, int));
-void bc_store_memory PROTO((tree, tree));
-tree bc_expand_component_address PROTO((tree));
-tree bc_expand_address PROTO((tree));
-void bc_expand_constructor PROTO((tree));
-void bc_adjust_stack PROTO((int));
-tree bc_canonicalize_array_ref PROTO((tree));
-void bc_load_memory PROTO((tree, tree));
-void bc_load_externaddr PROTO((rtx));
-void bc_load_externaddr_id PROTO((tree, int));
-void bc_load_localaddr PROTO((rtx));
-void bc_load_parmaddr PROTO((rtx));
-static void preexpand_calls PROTO((tree));
-static void do_jump_by_parts_greater PROTO((tree, int, rtx, rtx));
-void do_jump_by_parts_greater_rtx PROTO((enum machine_mode, int, rtx, rtx, rtx, rtx));
-static void do_jump_by_parts_equality PROTO((tree, rtx, rtx));
-static void do_jump_by_parts_equality_rtx PROTO((rtx, rtx, rtx));
-static void do_jump_for_compare PROTO((rtx, rtx, rtx));
-static rtx compare PROTO((tree, enum rtx_code, enum rtx_code));
-static rtx do_store_flag PROTO((tree, rtx, enum machine_mode, int));
-static tree defer_cleanups_to PROTO((tree));
-extern tree truthvalue_conversion PROTO((tree));
-
-/* Record for each mode whether we can move a register directly to or
- from an object of that mode in memory. If we can't, we won't try
- to use that mode directly when accessing a field of that mode. */
-
-static char direct_load[NUM_MACHINE_MODES];
-static char direct_store[NUM_MACHINE_MODES];
-
-/* MOVE_RATIO is the number of move instructions that is better than
- a block move. */
-
-#ifndef MOVE_RATIO
-#if defined (HAVE_movstrqi) || defined (HAVE_movstrhi) || defined (HAVE_movstrsi) || defined (HAVE_movstrdi) || defined (HAVE_movstrti)
-#define MOVE_RATIO 2
-#else
-/* A value of around 6 would minimize code size; infinity would minimize
- execution time. */
-#define MOVE_RATIO 15
-#endif
-#endif
-
-/* This array records the insn_code of insns to perform block moves. */
-enum insn_code movstr_optab[NUM_MACHINE_MODES];
-
-/* This array records the insn_code of insns to perform block clears. */
-enum insn_code clrstr_optab[NUM_MACHINE_MODES];
-
-/* SLOW_UNALIGNED_ACCESS is non-zero if unaligned accesses are very slow. */
-
-#ifndef SLOW_UNALIGNED_ACCESS
-#define SLOW_UNALIGNED_ACCESS STRICT_ALIGNMENT
-#endif
-
-/* Register mappings for target machines without register windows. */
-#ifndef INCOMING_REGNO
-#define INCOMING_REGNO(OUT) (OUT)
-#endif
-#ifndef OUTGOING_REGNO
-#define OUTGOING_REGNO(IN) (IN)
-#endif
-
-/* Maps used to convert modes to const, load, and store bytecodes. */
-enum bytecode_opcode mode_to_const_map[MAX_MACHINE_MODE];
-enum bytecode_opcode mode_to_load_map[MAX_MACHINE_MODE];
-enum bytecode_opcode mode_to_store_map[MAX_MACHINE_MODE];
-
-/* Initialize maps used to convert modes to const, load, and store
- bytecodes. */
-
-void
-bc_init_mode_to_opcode_maps ()
-{
- int mode;
-
- for (mode = 0; mode < (int) MAX_MACHINE_MODE; mode++)
- mode_to_const_map[mode] =
- mode_to_load_map[mode] =
- mode_to_store_map[mode] = neverneverland;
-
-#define DEF_MODEMAP(SYM, CODE, UCODE, CONST, LOAD, STORE) \
- mode_to_const_map[(int) SYM] = CONST; \
- mode_to_load_map[(int) SYM] = LOAD; \
- mode_to_store_map[(int) SYM] = STORE;
-
-#include "modemap.def"
-#undef DEF_MODEMAP
-}
-
-/* This is run once per compilation to set up which modes can be used
- directly in memory and to initialize the block move optab. */
-
-void
-init_expr_once ()
-{
- rtx insn, pat;
- enum machine_mode mode;
- /* Try indexing by frame ptr and try by stack ptr.
- It is known that on the Convex the stack ptr isn't a valid index.
- With luck, one or the other is valid on any machine. */
- rtx mem = gen_rtx (MEM, VOIDmode, stack_pointer_rtx);
- rtx mem1 = gen_rtx (MEM, VOIDmode, frame_pointer_rtx);
-
- start_sequence ();
- insn = emit_insn (gen_rtx (SET, 0, 0));
- pat = PATTERN (insn);
-
- for (mode = VOIDmode; (int) mode < NUM_MACHINE_MODES;
- mode = (enum machine_mode) ((int) mode + 1))
- {
- int regno;
- rtx reg;
- int num_clobbers;
-
- direct_load[(int) mode] = direct_store[(int) mode] = 0;
- PUT_MODE (mem, mode);
- PUT_MODE (mem1, mode);
-
- /* See if there is some register that can be used in this mode and
- directly loaded or stored from memory. */
-
- if (mode != VOIDmode && mode != BLKmode)
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER
- && (direct_load[(int) mode] == 0 || direct_store[(int) mode] == 0);
- regno++)
- {
- if (! HARD_REGNO_MODE_OK (regno, mode))
- continue;
-
- reg = gen_rtx (REG, mode, regno);
-
- SET_SRC (pat) = mem;
- SET_DEST (pat) = reg;
- if (recog (pat, insn, &num_clobbers) >= 0)
- direct_load[(int) mode] = 1;
-
- SET_SRC (pat) = mem1;
- SET_DEST (pat) = reg;
- if (recog (pat, insn, &num_clobbers) >= 0)
- direct_load[(int) mode] = 1;
-
- SET_SRC (pat) = reg;
- SET_DEST (pat) = mem;
- if (recog (pat, insn, &num_clobbers) >= 0)
- direct_store[(int) mode] = 1;
-
- SET_SRC (pat) = reg;
- SET_DEST (pat) = mem1;
- if (recog (pat, insn, &num_clobbers) >= 0)
- direct_store[(int) mode] = 1;
- }
- }
-
- end_sequence ();
-}
-
-/* This is run at the start of compiling a function. */
-
-void
-init_expr ()
-{
- init_queue ();
-
- pending_stack_adjust = 0;
- inhibit_defer_pop = 0;
- cleanups_this_call = 0;
- saveregs_value = 0;
- apply_args_value = 0;
- forced_labels = 0;
-}
-
-/* Save all variables describing the current status into the structure *P.
- This is used before starting a nested function. */
-
-void
-save_expr_status (p)
- struct function *p;
-{
- /* Instead of saving the postincrement queue, empty it. */
- emit_queue ();
-
- p->pending_stack_adjust = pending_stack_adjust;
- p->inhibit_defer_pop = inhibit_defer_pop;
- p->cleanups_this_call = cleanups_this_call;
- p->saveregs_value = saveregs_value;
- p->apply_args_value = apply_args_value;
- p->forced_labels = forced_labels;
-
- pending_stack_adjust = 0;
- inhibit_defer_pop = 0;
- cleanups_this_call = 0;
- saveregs_value = 0;
- apply_args_value = 0;
- forced_labels = 0;
-}
-
-/* Restore all variables describing the current status from the structure *P.
- This is used after a nested function. */
-
-void
-restore_expr_status (p)
- struct function *p;
-{
- pending_stack_adjust = p->pending_stack_adjust;
- inhibit_defer_pop = p->inhibit_defer_pop;
- cleanups_this_call = p->cleanups_this_call;
- saveregs_value = p->saveregs_value;
- apply_args_value = p->apply_args_value;
- forced_labels = p->forced_labels;
-}
-
-/* Manage the queue of increment instructions to be output
- for POSTINCREMENT_EXPR expressions, etc. */
-
-static rtx pending_chain;
-
-/* Queue up to increment (or change) VAR later. BODY says how:
- BODY should be the same thing you would pass to emit_insn
- to increment right away. It will go to emit_insn later on.
-
- The value is a QUEUED expression to be used in place of VAR
- where you want to guarantee the pre-incrementation value of VAR. */
-
-static rtx
-enqueue_insn (var, body)
- rtx var, body;
-{
- pending_chain = gen_rtx (QUEUED, GET_MODE (var),
- var, NULL_RTX, NULL_RTX, body, pending_chain);
- return pending_chain;
-}
-
-/* Use protect_from_queue to convert a QUEUED expression
- into something that you can put immediately into an instruction.
- If the queued incrementation has not happened yet,
- protect_from_queue returns the variable itself.
- If the incrementation has happened, protect_from_queue returns a temp
- that contains a copy of the old value of the variable.
-
- Any time an rtx which might possibly be a QUEUED is to be put
- into an instruction, it must be passed through protect_from_queue first.
- QUEUED expressions are not meaningful in instructions.
-
- Do not pass a value through protect_from_queue and then hold
- on to it for a while before putting it in an instruction!
- If the queue is flushed in between, incorrect code will result. */
-
-rtx
-protect_from_queue (x, modify)
- register rtx x;
- int modify;
-{
- register RTX_CODE code = GET_CODE (x);
-
-#if 0 /* A QUEUED can hang around after the queue is forced out. */
- /* Shortcut for most common case. */
- if (pending_chain == 0)
- return x;
-#endif
-
- if (code != QUEUED)
- {
- /* A special hack for read access to (MEM (QUEUED ...)) to facilitate
- use of autoincrement. Make a copy of the contents of the memory
- location rather than a copy of the address, but not if the value is
- of mode BLKmode. Don't modify X in place since it might be
- shared. */
- if (code == MEM && GET_MODE (x) != BLKmode
- && GET_CODE (XEXP (x, 0)) == QUEUED && !modify)
- {
- register rtx y = XEXP (x, 0);
- register rtx new = gen_rtx (MEM, GET_MODE (x), QUEUED_VAR (y));
-
- MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (x);
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (x);
- MEM_VOLATILE_P (new) = MEM_VOLATILE_P (x);
-
- if (QUEUED_INSN (y))
- {
- register rtx temp = gen_reg_rtx (GET_MODE (new));
- emit_insn_before (gen_move_insn (temp, new),
- QUEUED_INSN (y));
- return temp;
- }
- return new;
- }
- /* Otherwise, recursively protect the subexpressions of all
- the kinds of rtx's that can contain a QUEUED. */
- if (code == MEM)
- {
- rtx tem = protect_from_queue (XEXP (x, 0), 0);
- if (tem != XEXP (x, 0))
- {
- x = copy_rtx (x);
- XEXP (x, 0) = tem;
- }
- }
- else if (code == PLUS || code == MULT)
- {
- rtx new0 = protect_from_queue (XEXP (x, 0), 0);
- rtx new1 = protect_from_queue (XEXP (x, 1), 0);
- if (new0 != XEXP (x, 0) || new1 != XEXP (x, 1))
- {
- x = copy_rtx (x);
- XEXP (x, 0) = new0;
- XEXP (x, 1) = new1;
- }
- }
- return x;
- }
- /* If the increment has not happened, use the variable itself. */
- if (QUEUED_INSN (x) == 0)
- return QUEUED_VAR (x);
- /* If the increment has happened and a pre-increment copy exists,
- use that copy. */
- if (QUEUED_COPY (x) != 0)
- return QUEUED_COPY (x);
- /* The increment has happened but we haven't set up a pre-increment copy.
- Set one up now, and use it. */
- QUEUED_COPY (x) = gen_reg_rtx (GET_MODE (QUEUED_VAR (x)));
- emit_insn_before (gen_move_insn (QUEUED_COPY (x), QUEUED_VAR (x)),
- QUEUED_INSN (x));
- return QUEUED_COPY (x);
-}
-
-/* Return nonzero if X contains a QUEUED expression:
- if it contains anything that will be altered by a queued increment.
- We handle only combinations of MEM, PLUS, MINUS and MULT operators
- since memory addresses generally contain only those. */
-
-static int
-queued_subexp_p (x)
- rtx x;
-{
- register enum rtx_code code = GET_CODE (x);
- switch (code)
- {
- case QUEUED:
- return 1;
- case MEM:
- return queued_subexp_p (XEXP (x, 0));
- case MULT:
- case PLUS:
- case MINUS:
- return queued_subexp_p (XEXP (x, 0))
- || queued_subexp_p (XEXP (x, 1));
- }
- return 0;
-}
-
-/* Perform all the pending incrementations. */
-
-void
-emit_queue ()
-{
- register rtx p;
- while (p = pending_chain)
- {
- QUEUED_INSN (p) = emit_insn (QUEUED_BODY (p));
- pending_chain = QUEUED_NEXT (p);
- }
-}
-
-static void
-init_queue ()
-{
- if (pending_chain)
- abort ();
-}
-
-/* Copy data from FROM to TO, where the machine modes are not the same.
- Both modes may be integer, or both may be floating.
- UNSIGNEDP should be nonzero if FROM is an unsigned type.
- This causes zero-extension instead of sign-extension. */
-
-void
-convert_move (to, from, unsignedp)
- register rtx to, from;
- int unsignedp;
-{
- enum machine_mode to_mode = GET_MODE (to);
- enum machine_mode from_mode = GET_MODE (from);
- int to_real = GET_MODE_CLASS (to_mode) == MODE_FLOAT;
- int from_real = GET_MODE_CLASS (from_mode) == MODE_FLOAT;
- enum insn_code code;
- rtx libcall;
-
- /* rtx code for making an equivalent value. */
- enum rtx_code equiv_code = (unsignedp ? ZERO_EXTEND : SIGN_EXTEND);
-
- to = protect_from_queue (to, 1);
- from = protect_from_queue (from, 0);
-
- if (to_real != from_real)
- abort ();
-
- /* If FROM is a SUBREG that indicates that we have already done at least
- the required extension, strip it. We don't handle such SUBREGs as
- TO here. */
-
- if (GET_CODE (from) == SUBREG && SUBREG_PROMOTED_VAR_P (from)
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (from)))
- >= GET_MODE_SIZE (to_mode))
- && SUBREG_PROMOTED_UNSIGNED_P (from) == unsignedp)
- from = gen_lowpart (to_mode, from), from_mode = to_mode;
-
- if (GET_CODE (to) == SUBREG && SUBREG_PROMOTED_VAR_P (to))
- abort ();
-
- if (to_mode == from_mode
- || (from_mode == VOIDmode && CONSTANT_P (from)))
- {
- emit_move_insn (to, from);
- return;
- }
-
- if (to_real)
- {
- rtx value;
-
- if (GET_MODE_BITSIZE (from_mode) < GET_MODE_BITSIZE (to_mode))
- {
- /* Try converting directly if the insn is supported. */
- if ((code = can_extend_p (to_mode, from_mode, 0))
- != CODE_FOR_nothing)
- {
- emit_unop_insn (code, to, from, UNKNOWN);
- return;
- }
- }
-
-#ifdef HAVE_trunchfqf2
- if (HAVE_trunchfqf2 && from_mode == HFmode && to_mode == QFmode)
- {
- emit_unop_insn (CODE_FOR_trunchfqf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncsfqf2
- if (HAVE_truncsfqf2 && from_mode == SFmode && to_mode == QFmode)
- {
- emit_unop_insn (CODE_FOR_truncsfqf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncdfqf2
- if (HAVE_truncdfqf2 && from_mode == DFmode && to_mode == QFmode)
- {
- emit_unop_insn (CODE_FOR_truncdfqf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncxfqf2
- if (HAVE_truncxfqf2 && from_mode == XFmode && to_mode == QFmode)
- {
- emit_unop_insn (CODE_FOR_truncxfqf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_trunctfqf2
- if (HAVE_trunctfqf2 && from_mode == TFmode && to_mode == QFmode)
- {
- emit_unop_insn (CODE_FOR_trunctfqf2, to, from, UNKNOWN);
- return;
- }
-#endif
-
-#ifdef HAVE_trunctqfhf2
- if (HAVE_trunctqfhf2 && from_mode == TQFmode && to_mode == HFmode)
- {
- emit_unop_insn (CODE_FOR_trunctqfhf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncsfhf2
- if (HAVE_truncsfhf2 && from_mode == SFmode && to_mode == HFmode)
- {
- emit_unop_insn (CODE_FOR_truncsfhf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncdfhf2
- if (HAVE_truncdfhf2 && from_mode == DFmode && to_mode == HFmode)
- {
- emit_unop_insn (CODE_FOR_truncdfhf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncxfhf2
- if (HAVE_truncxfhf2 && from_mode == XFmode && to_mode == HFmode)
- {
- emit_unop_insn (CODE_FOR_truncxfhf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_trunctfhf2
- if (HAVE_trunctfhf2 && from_mode == TFmode && to_mode == HFmode)
- {
- emit_unop_insn (CODE_FOR_trunctfhf2, to, from, UNKNOWN);
- return;
- }
-#endif
-
-#ifdef HAVE_truncsftqf2
- if (HAVE_truncsftqf2 && from_mode == SFmode && to_mode == TQFmode)
- {
- emit_unop_insn (CODE_FOR_truncsftqf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncdftqf2
- if (HAVE_truncdftqf2 && from_mode == DFmode && to_mode == TQFmode)
- {
- emit_unop_insn (CODE_FOR_truncdftqf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncxftqf2
- if (HAVE_truncxftqf2 && from_mode == XFmode && to_mode == TQFmode)
- {
- emit_unop_insn (CODE_FOR_truncxftqf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_trunctftqf2
- if (HAVE_trunctftqf2 && from_mode == TFmode && to_mode == TQFmode)
- {
- emit_unop_insn (CODE_FOR_trunctftqf2, to, from, UNKNOWN);
- return;
- }
-#endif
-
-#ifdef HAVE_truncdfsf2
- if (HAVE_truncdfsf2 && from_mode == DFmode && to_mode == SFmode)
- {
- emit_unop_insn (CODE_FOR_truncdfsf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncxfsf2
- if (HAVE_truncxfsf2 && from_mode == XFmode && to_mode == SFmode)
- {
- emit_unop_insn (CODE_FOR_truncxfsf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_trunctfsf2
- if (HAVE_trunctfsf2 && from_mode == TFmode && to_mode == SFmode)
- {
- emit_unop_insn (CODE_FOR_trunctfsf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_truncxfdf2
- if (HAVE_truncxfdf2 && from_mode == XFmode && to_mode == DFmode)
- {
- emit_unop_insn (CODE_FOR_truncxfdf2, to, from, UNKNOWN);
- return;
- }
-#endif
-#ifdef HAVE_trunctfdf2
- if (HAVE_trunctfdf2 && from_mode == TFmode && to_mode == DFmode)
- {
- emit_unop_insn (CODE_FOR_trunctfdf2, to, from, UNKNOWN);
- return;
- }
-#endif
-
- libcall = (rtx) 0;
- switch (from_mode)
- {
- case SFmode:
- switch (to_mode)
- {
- case DFmode:
- libcall = extendsfdf2_libfunc;
- break;
-
- case XFmode:
- libcall = extendsfxf2_libfunc;
- break;
-
- case TFmode:
- libcall = extendsftf2_libfunc;
- break;
- }
- break;
-
- case DFmode:
- switch (to_mode)
- {
- case SFmode:
- libcall = truncdfsf2_libfunc;
- break;
-
- case XFmode:
- libcall = extenddfxf2_libfunc;
- break;
-
- case TFmode:
- libcall = extenddftf2_libfunc;
- break;
- }
- break;
-
- case XFmode:
- switch (to_mode)
- {
- case SFmode:
- libcall = truncxfsf2_libfunc;
- break;
-
- case DFmode:
- libcall = truncxfdf2_libfunc;
- break;
- }
- break;
-
- case TFmode:
- switch (to_mode)
- {
- case SFmode:
- libcall = trunctfsf2_libfunc;
- break;
-
- case DFmode:
- libcall = trunctfdf2_libfunc;
- break;
- }
- break;
- }
-
- if (libcall == (rtx) 0)
- /* This conversion is not implemented yet. */
- abort ();
-
- value = emit_library_call_value (libcall, NULL_RTX, 1, to_mode,
- 1, from, from_mode);
- emit_move_insn (to, value);
- return;
- }
-
- /* Now both modes are integers. */
-
- /* Handle expanding beyond a word. */
- if (GET_MODE_BITSIZE (from_mode) < GET_MODE_BITSIZE (to_mode)
- && GET_MODE_BITSIZE (to_mode) > BITS_PER_WORD)
- {
- rtx insns;
- rtx lowpart;
- rtx fill_value;
- rtx lowfrom;
- int i;
- enum machine_mode lowpart_mode;
- int nwords = CEIL (GET_MODE_SIZE (to_mode), UNITS_PER_WORD);
-
- /* Try converting directly if the insn is supported. */
- if ((code = can_extend_p (to_mode, from_mode, unsignedp))
- != CODE_FOR_nothing)
- {
- /* If FROM is a SUBREG, put it into a register. Do this
- so that we always generate the same set of insns for
- better cse'ing; if an intermediate assignment occurred,
- we won't be doing the operation directly on the SUBREG. */
- if (optimize > 0 && GET_CODE (from) == SUBREG)
- from = force_reg (from_mode, from);
- emit_unop_insn (code, to, from, equiv_code);
- return;
- }
- /* Next, try converting via full word. */
- else if (GET_MODE_BITSIZE (from_mode) < BITS_PER_WORD
- && ((code = can_extend_p (to_mode, word_mode, unsignedp))
- != CODE_FOR_nothing))
- {
- if (GET_CODE (to) == REG)
- emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
- convert_move (gen_lowpart (word_mode, to), from, unsignedp);
- emit_unop_insn (code, to,
- gen_lowpart (word_mode, to), equiv_code);
- return;
- }
-
- /* No special multiword conversion insn; do it by hand. */
- start_sequence ();
-
- /* Since we will turn this into a no conflict block, we must ensure
- that the source does not overlap the target. */
-
- if (reg_overlap_mentioned_p (to, from))
- from = force_reg (from_mode, from);
-
- /* Get a copy of FROM widened to a word, if necessary. */
- if (GET_MODE_BITSIZE (from_mode) < BITS_PER_WORD)
- lowpart_mode = word_mode;
- else
- lowpart_mode = from_mode;
-
- lowfrom = convert_to_mode (lowpart_mode, from, unsignedp);
-
- lowpart = gen_lowpart (lowpart_mode, to);
- emit_move_insn (lowpart, lowfrom);
-
- /* Compute the value to put in each remaining word. */
- if (unsignedp)
- fill_value = const0_rtx;
- else
- {
-#ifdef HAVE_slt
- if (HAVE_slt
- && insn_operand_mode[(int) CODE_FOR_slt][0] == word_mode
- && STORE_FLAG_VALUE == -1)
- {
- emit_cmp_insn (lowfrom, const0_rtx, NE, NULL_RTX,
- lowpart_mode, 0, 0);
- fill_value = gen_reg_rtx (word_mode);
- emit_insn (gen_slt (fill_value));
- }
- else
-#endif
- {
- fill_value
- = expand_shift (RSHIFT_EXPR, lowpart_mode, lowfrom,
- size_int (GET_MODE_BITSIZE (lowpart_mode) - 1),
- NULL_RTX, 0);
- fill_value = convert_to_mode (word_mode, fill_value, 1);
- }
- }
-
- /* Fill the remaining words. */
- for (i = GET_MODE_SIZE (lowpart_mode) / UNITS_PER_WORD; i < nwords; i++)
- {
- int index = (WORDS_BIG_ENDIAN ? nwords - i - 1 : i);
- rtx subword = operand_subword (to, index, 1, to_mode);
-
- if (subword == 0)
- abort ();
-
- if (fill_value != subword)
- emit_move_insn (subword, fill_value);
- }
-
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, to, from, NULL_RTX,
- gen_rtx (equiv_code, to_mode, copy_rtx (from)));
- return;
- }
-
- /* Truncating multi-word to a word or less. */
- if (GET_MODE_BITSIZE (from_mode) > BITS_PER_WORD
- && GET_MODE_BITSIZE (to_mode) <= BITS_PER_WORD)
- {
- if (!((GET_CODE (from) == MEM
- && ! MEM_VOLATILE_P (from)
- && direct_load[(int) to_mode]
- && ! mode_dependent_address_p (XEXP (from, 0)))
- || GET_CODE (from) == REG
- || GET_CODE (from) == SUBREG))
- from = force_reg (from_mode, from);
- convert_move (to, gen_lowpart (word_mode, from), 0);
- return;
- }
-
- /* Handle pointer conversion */ /* SPEE 900220 */
- if (to_mode == PSImode)
- {
- if (from_mode != SImode)
- from = convert_to_mode (SImode, from, unsignedp);
-
-#ifdef HAVE_truncsipsi2
- if (HAVE_truncsipsi2)
- {
- emit_unop_insn (CODE_FOR_truncsipsi2, to, from, UNKNOWN);
- return;
- }
-#endif /* HAVE_truncsipsi2 */
- abort ();
- }
-
- if (from_mode == PSImode)
- {
- if (to_mode != SImode)
- {
- from = convert_to_mode (SImode, from, unsignedp);
- from_mode = SImode;
- }
- else
- {
-#ifdef HAVE_extendpsisi2
- if (HAVE_extendpsisi2)
- {
- emit_unop_insn (CODE_FOR_extendpsisi2, to, from, UNKNOWN);
- return;
- }
-#endif /* HAVE_extendpsisi2 */
- abort ();
- }
- }
-
- if (to_mode == PDImode)
- {
- if (from_mode != DImode)
- from = convert_to_mode (DImode, from, unsignedp);
-
-#ifdef HAVE_truncdipdi2
- if (HAVE_truncdipdi2)
- {
- emit_unop_insn (CODE_FOR_truncdipdi2, to, from, UNKNOWN);
- return;
- }
-#endif /* HAVE_truncdipdi2 */
- abort ();
- }
-
- if (from_mode == PDImode)
- {
- if (to_mode != DImode)
- {
- from = convert_to_mode (DImode, from, unsignedp);
- from_mode = DImode;
- }
- else
- {
-#ifdef HAVE_extendpdidi2
- if (HAVE_extendpdidi2)
- {
- emit_unop_insn (CODE_FOR_extendpdidi2, to, from, UNKNOWN);
- return;
- }
-#endif /* HAVE_extendpdidi2 */
- abort ();
- }
- }
-
- /* Now follow all the conversions between integers
- no more than a word long. */
-
- /* For truncation, usually we can just refer to FROM in a narrower mode. */
- if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode)
- && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (to_mode),
- GET_MODE_BITSIZE (from_mode)))
- {
- if (!((GET_CODE (from) == MEM
- && ! MEM_VOLATILE_P (from)
- && direct_load[(int) to_mode]
- && ! mode_dependent_address_p (XEXP (from, 0)))
- || GET_CODE (from) == REG
- || GET_CODE (from) == SUBREG))
- from = force_reg (from_mode, from);
- if (GET_CODE (from) == REG && REGNO (from) < FIRST_PSEUDO_REGISTER
- && ! HARD_REGNO_MODE_OK (REGNO (from), to_mode))
- from = copy_to_reg (from);
- emit_move_insn (to, gen_lowpart (to_mode, from));
- return;
- }
-
- /* Handle extension. */
- if (GET_MODE_BITSIZE (to_mode) > GET_MODE_BITSIZE (from_mode))
- {
- /* Convert directly if that works. */
- if ((code = can_extend_p (to_mode, from_mode, unsignedp))
- != CODE_FOR_nothing)
- {
- emit_unop_insn (code, to, from, equiv_code);
- return;
- }
- else
- {
- enum machine_mode intermediate;
-
- /* Search for a mode to convert via. */
- for (intermediate = from_mode; intermediate != VOIDmode;
- intermediate = GET_MODE_WIDER_MODE (intermediate))
- if (((can_extend_p (to_mode, intermediate, unsignedp)
- != CODE_FOR_nothing)
- || (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (intermediate)
- && TRULY_NOOP_TRUNCATION (to_mode, intermediate)))
- && (can_extend_p (intermediate, from_mode, unsignedp)
- != CODE_FOR_nothing))
- {
- convert_move (to, convert_to_mode (intermediate, from,
- unsignedp), unsignedp);
- return;
- }
-
- /* No suitable intermediate mode. */
- abort ();
- }
- }
-
- /* Support special truncate insns for certain modes. */
-
- if (from_mode == DImode && to_mode == SImode)
- {
-#ifdef HAVE_truncdisi2
- if (HAVE_truncdisi2)
- {
- emit_unop_insn (CODE_FOR_truncdisi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- if (from_mode == DImode && to_mode == HImode)
- {
-#ifdef HAVE_truncdihi2
- if (HAVE_truncdihi2)
- {
- emit_unop_insn (CODE_FOR_truncdihi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- if (from_mode == DImode && to_mode == QImode)
- {
-#ifdef HAVE_truncdiqi2
- if (HAVE_truncdiqi2)
- {
- emit_unop_insn (CODE_FOR_truncdiqi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- if (from_mode == SImode && to_mode == HImode)
- {
-#ifdef HAVE_truncsihi2
- if (HAVE_truncsihi2)
- {
- emit_unop_insn (CODE_FOR_truncsihi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- if (from_mode == SImode && to_mode == QImode)
- {
-#ifdef HAVE_truncsiqi2
- if (HAVE_truncsiqi2)
- {
- emit_unop_insn (CODE_FOR_truncsiqi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- if (from_mode == HImode && to_mode == QImode)
- {
-#ifdef HAVE_trunchiqi2
- if (HAVE_trunchiqi2)
- {
- emit_unop_insn (CODE_FOR_trunchiqi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- if (from_mode == TImode && to_mode == DImode)
- {
-#ifdef HAVE_trunctidi2
- if (HAVE_trunctidi2)
- {
- emit_unop_insn (CODE_FOR_trunctidi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- if (from_mode == TImode && to_mode == SImode)
- {
-#ifdef HAVE_trunctisi2
- if (HAVE_trunctisi2)
- {
- emit_unop_insn (CODE_FOR_trunctisi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- if (from_mode == TImode && to_mode == HImode)
- {
-#ifdef HAVE_trunctihi2
- if (HAVE_trunctihi2)
- {
- emit_unop_insn (CODE_FOR_trunctihi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- if (from_mode == TImode && to_mode == QImode)
- {
-#ifdef HAVE_trunctiqi2
- if (HAVE_trunctiqi2)
- {
- emit_unop_insn (CODE_FOR_trunctiqi2, to, from, UNKNOWN);
- return;
- }
-#endif
- convert_move (to, force_reg (from_mode, from), unsignedp);
- return;
- }
-
- /* Handle truncation of volatile memrefs, and so on;
- the things that couldn't be truncated directly,
- and for which there was no special instruction. */
- if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode))
- {
- rtx temp = force_reg (to_mode, gen_lowpart (to_mode, from));
- emit_move_insn (to, temp);
- return;
- }
-
- /* Mode combination is not recognized. */
- abort ();
-}
-
-/* Return an rtx for a value that would result
- from converting X to mode MODE.
- Both X and MODE may be floating, or both integer.
- UNSIGNEDP is nonzero if X is an unsigned value.
- This can be done by referring to a part of X in place
- or by copying to a new temporary with conversion.
-
- This function *must not* call protect_from_queue
- except when putting X into an insn (in which case convert_move does it). */
-
-rtx
-convert_to_mode (mode, x, unsignedp)
- enum machine_mode mode;
- rtx x;
- int unsignedp;
-{
- return convert_modes (mode, VOIDmode, x, unsignedp);
-}
-
-/* Return an rtx for a value that would result
- from converting X from mode OLDMODE to mode MODE.
- Both modes may be floating, or both integer.
- UNSIGNEDP is nonzero if X is an unsigned value.
-
- This can be done by referring to a part of X in place
- or by copying to a new temporary with conversion.
-
- You can give VOIDmode for OLDMODE, if you are sure X has a nonvoid mode.
-
- This function *must not* call protect_from_queue
- except when putting X into an insn (in which case convert_move does it). */
-
-rtx
-convert_modes (mode, oldmode, x, unsignedp)
- enum machine_mode mode, oldmode;
- rtx x;
- int unsignedp;
-{
- register rtx temp;
-
- /* If FROM is a SUBREG that indicates that we have already done at least
- the required extension, strip it. */
-
- if (GET_CODE (x) == SUBREG && SUBREG_PROMOTED_VAR_P (x)
- && GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) >= GET_MODE_SIZE (mode)
- && SUBREG_PROMOTED_UNSIGNED_P (x) == unsignedp)
- x = gen_lowpart (mode, x);
-
- if (GET_MODE (x) != VOIDmode)
- oldmode = GET_MODE (x);
-
- if (mode == oldmode)
- return x;
-
- /* There is one case that we must handle specially: If we are converting
- a CONST_INT into a mode whose size is twice HOST_BITS_PER_WIDE_INT and
- we are to interpret the constant as unsigned, gen_lowpart will do
- the wrong if the constant appears negative. What we want to do is
- make the high-order word of the constant zero, not all ones. */
-
- if (unsignedp && GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_BITSIZE (mode) == 2 * HOST_BITS_PER_WIDE_INT
- && GET_CODE (x) == CONST_INT && INTVAL (x) < 0)
- {
- HOST_WIDE_INT val = INTVAL (x);
-
- if (oldmode != VOIDmode
- && HOST_BITS_PER_WIDE_INT > GET_MODE_BITSIZE (oldmode))
- {
- int width = GET_MODE_BITSIZE (oldmode);
-
- /* We need to zero extend VAL. */
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
- }
-
- return immed_double_const (val, (HOST_WIDE_INT) 0, mode);
- }
-
- /* We can do this with a gen_lowpart if both desired and current modes
- are integer, and this is either a constant integer, a register, or a
- non-volatile MEM. Except for the constant case where MODE is no
- wider than HOST_BITS_PER_WIDE_INT, we must be narrowing the operand. */
-
- if ((GET_CODE (x) == CONST_INT
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
- || (GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_CLASS (oldmode) == MODE_INT
- && (GET_CODE (x) == CONST_DOUBLE
- || (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (oldmode)
- && ((GET_CODE (x) == MEM && ! MEM_VOLATILE_P (x)
- && direct_load[(int) mode])
- || (GET_CODE (x) == REG
- && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
- GET_MODE_BITSIZE (GET_MODE (x)))))))))
- {
- /* ?? If we don't know OLDMODE, we have to assume here that
- X does not need sign- or zero-extension. This may not be
- the case, but it's the best we can do. */
- if (GET_CODE (x) == CONST_INT && oldmode != VOIDmode
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (oldmode))
- {
- HOST_WIDE_INT val = INTVAL (x);
- int width = GET_MODE_BITSIZE (oldmode);
-
- /* We must sign or zero-extend in this case. Start by
- zero-extending, then sign extend if we need to. */
- val &= ((HOST_WIDE_INT) 1 << width) - 1;
- if (! unsignedp
- && (val & ((HOST_WIDE_INT) 1 << (width - 1))))
- val |= (HOST_WIDE_INT) (-1) << width;
-
- return GEN_INT (val);
- }
-
- return gen_lowpart (mode, x);
- }
-
- temp = gen_reg_rtx (mode);
- convert_move (temp, x, unsignedp);
- return temp;
-}
-
-/* Generate several move instructions to copy LEN bytes
- from block FROM to block TO. (These are MEM rtx's with BLKmode).
- The caller must pass FROM and TO
- through protect_from_queue before calling.
- ALIGN (in bytes) is maximum alignment we can assume. */
-
-static void
-move_by_pieces (to, from, len, align)
- rtx to, from;
- int len, align;
-{
- struct move_by_pieces data;
- rtx to_addr = XEXP (to, 0), from_addr = XEXP (from, 0);
- int max_size = MOVE_MAX + 1;
-
- data.offset = 0;
- data.to_addr = to_addr;
- data.from_addr = from_addr;
- data.to = to;
- data.from = from;
- data.autinc_to
- = (GET_CODE (to_addr) == PRE_INC || GET_CODE (to_addr) == PRE_DEC
- || GET_CODE (to_addr) == POST_INC || GET_CODE (to_addr) == POST_DEC);
- data.autinc_from
- = (GET_CODE (from_addr) == PRE_INC || GET_CODE (from_addr) == PRE_DEC
- || GET_CODE (from_addr) == POST_INC
- || GET_CODE (from_addr) == POST_DEC);
-
- data.explicit_inc_from = 0;
- data.explicit_inc_to = 0;
- data.reverse
- = (GET_CODE (to_addr) == PRE_DEC || GET_CODE (to_addr) == POST_DEC);
- if (data.reverse) data.offset = len;
- data.len = len;
-
- data.to_struct = MEM_IN_STRUCT_P (to);
- data.from_struct = MEM_IN_STRUCT_P (from);
-
- /* If copying requires more than two move insns,
- copy addresses to registers (to make displacements shorter)
- and use post-increment if available. */
- if (!(data.autinc_from && data.autinc_to)
- && move_by_pieces_ninsns (len, align) > 2)
- {
-#ifdef HAVE_PRE_DECREMENT
- if (data.reverse && ! data.autinc_from)
- {
- data.from_addr = copy_addr_to_reg (plus_constant (from_addr, len));
- data.autinc_from = 1;
- data.explicit_inc_from = -1;
- }
-#endif
-#ifdef HAVE_POST_INCREMENT
- if (! data.autinc_from)
- {
- data.from_addr = copy_addr_to_reg (from_addr);
- data.autinc_from = 1;
- data.explicit_inc_from = 1;
- }
-#endif
- if (!data.autinc_from && CONSTANT_P (from_addr))
- data.from_addr = copy_addr_to_reg (from_addr);
-#ifdef HAVE_PRE_DECREMENT
- if (data.reverse && ! data.autinc_to)
- {
- data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
- data.autinc_to = 1;
- data.explicit_inc_to = -1;
- }
-#endif
-#ifdef HAVE_POST_INCREMENT
- if (! data.reverse && ! data.autinc_to)
- {
- data.to_addr = copy_addr_to_reg (to_addr);
- data.autinc_to = 1;
- data.explicit_inc_to = 1;
- }
-#endif
- if (!data.autinc_to && CONSTANT_P (to_addr))
- data.to_addr = copy_addr_to_reg (to_addr);
- }
-
- if (! SLOW_UNALIGNED_ACCESS
- || align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
- align = MOVE_MAX;
-
- /* First move what we can in the largest integer mode, then go to
- successively smaller modes. */
-
- while (max_size > 1)
- {
- enum machine_mode mode = VOIDmode, tmode;
- enum insn_code icode;
-
- for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- tmode != VOIDmode; tmode = GET_MODE_WIDER_MODE (tmode))
- if (GET_MODE_SIZE (tmode) < max_size)
- mode = tmode;
-
- if (mode == VOIDmode)
- break;
-
- icode = mov_optab->handlers[(int) mode].insn_code;
- if (icode != CODE_FOR_nothing
- && align >= MIN (BIGGEST_ALIGNMENT / BITS_PER_UNIT,
- GET_MODE_SIZE (mode)))
- move_by_pieces_1 (GEN_FCN (icode), mode, &data);
-
- max_size = GET_MODE_SIZE (mode);
- }
-
- /* The code above should have handled everything. */
- if (data.len > 0)
- abort ();
-}
-
-/* Return number of insns required to move L bytes by pieces.
- ALIGN (in bytes) is maximum alignment we can assume. */
-
-static int
-move_by_pieces_ninsns (l, align)
- unsigned int l;
- int align;
-{
- register int n_insns = 0;
- int max_size = MOVE_MAX + 1;
-
- if (! SLOW_UNALIGNED_ACCESS
- || align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
- align = MOVE_MAX;
-
- while (max_size > 1)
- {
- enum machine_mode mode = VOIDmode, tmode;
- enum insn_code icode;
-
- for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- tmode != VOIDmode; tmode = GET_MODE_WIDER_MODE (tmode))
- if (GET_MODE_SIZE (tmode) < max_size)
- mode = tmode;
-
- if (mode == VOIDmode)
- break;
-
- icode = mov_optab->handlers[(int) mode].insn_code;
- if (icode != CODE_FOR_nothing
- && align >= MIN (BIGGEST_ALIGNMENT / BITS_PER_UNIT,
- GET_MODE_SIZE (mode)))
- n_insns += l / GET_MODE_SIZE (mode), l %= GET_MODE_SIZE (mode);
-
- max_size = GET_MODE_SIZE (mode);
- }
-
- return n_insns;
-}
-
-/* Subroutine of move_by_pieces. Move as many bytes as appropriate
- with move instructions for mode MODE. GENFUN is the gen_... function
- to make a move insn for that mode. DATA has all the other info. */
-
-static void
-move_by_pieces_1 (genfun, mode, data)
- rtx (*genfun) ();
- enum machine_mode mode;
- struct move_by_pieces *data;
-{
- register int size = GET_MODE_SIZE (mode);
- register rtx to1, from1;
-
- while (data->len >= size)
- {
- if (data->reverse) data->offset -= size;
-
- to1 = (data->autinc_to
- ? gen_rtx (MEM, mode, data->to_addr)
- : change_address (data->to, mode,
- plus_constant (data->to_addr, data->offset)));
- MEM_IN_STRUCT_P (to1) = data->to_struct;
- from1 =
- (data->autinc_from
- ? gen_rtx (MEM, mode, data->from_addr)
- : change_address (data->from, mode,
- plus_constant (data->from_addr, data->offset)));
- MEM_IN_STRUCT_P (from1) = data->from_struct;
-
-#ifdef HAVE_PRE_DECREMENT
- if (data->explicit_inc_to < 0)
- emit_insn (gen_add2_insn (data->to_addr, GEN_INT (-size)));
- if (data->explicit_inc_from < 0)
- emit_insn (gen_add2_insn (data->from_addr, GEN_INT (-size)));
-#endif
-
- emit_insn ((*genfun) (to1, from1));
-#ifdef HAVE_POST_INCREMENT
- if (data->explicit_inc_to > 0)
- emit_insn (gen_add2_insn (data->to_addr, GEN_INT (size)));
- if (data->explicit_inc_from > 0)
- emit_insn (gen_add2_insn (data->from_addr, GEN_INT (size)));
-#endif
-
- if (! data->reverse) data->offset += size;
-
- data->len -= size;
- }
-}
-
-/* Emit code to move a block Y to a block X.
- This may be done with string-move instructions,
- with multiple scalar move instructions, or with a library call.
-
- Both X and Y must be MEM rtx's (perhaps inside VOLATILE)
- with mode BLKmode.
- SIZE is an rtx that says how long they are.
- ALIGN is the maximum alignment we can assume they have,
- measured in bytes. */
-
-void
-emit_block_move (x, y, size, align)
- rtx x, y;
- rtx size;
- int align;
-{
- if (GET_MODE (x) != BLKmode)
- abort ();
-
- if (GET_MODE (y) != BLKmode)
- abort ();
-
- x = protect_from_queue (x, 1);
- y = protect_from_queue (y, 0);
- size = protect_from_queue (size, 0);
-
- if (GET_CODE (x) != MEM)
- abort ();
- if (GET_CODE (y) != MEM)
- abort ();
- if (size == 0)
- abort ();
-
- if (GET_CODE (size) == CONST_INT
- && (move_by_pieces_ninsns (INTVAL (size), align) < MOVE_RATIO))
- move_by_pieces (x, y, INTVAL (size), align);
- else
- {
- /* Try the most limited insn first, because there's no point
- including more than one in the machine description unless
- the more limited one has some advantage. */
-
- rtx opalign = GEN_INT (align);
- enum machine_mode mode;
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- {
- enum insn_code code = movstr_optab[(int) mode];
-
- if (code != CODE_FOR_nothing
- /* We don't need MODE to be narrower than BITS_PER_HOST_WIDE_INT
- here because if SIZE is less than the mode mask, as it is
- returned by the macro, it will definitely be less than the
- actual mode mask. */
- && ((GET_CODE (size) == CONST_INT
- && ((unsigned HOST_WIDE_INT) INTVAL (size)
- <= GET_MODE_MASK (mode)))
- || GET_MODE_BITSIZE (mode) >= BITS_PER_WORD)
- && (insn_operand_predicate[(int) code][0] == 0
- || (*insn_operand_predicate[(int) code][0]) (x, BLKmode))
- && (insn_operand_predicate[(int) code][1] == 0
- || (*insn_operand_predicate[(int) code][1]) (y, BLKmode))
- && (insn_operand_predicate[(int) code][3] == 0
- || (*insn_operand_predicate[(int) code][3]) (opalign,
- VOIDmode)))
- {
- rtx op2;
- rtx last = get_last_insn ();
- rtx pat;
-
- op2 = convert_to_mode (mode, size, 1);
- if (insn_operand_predicate[(int) code][2] != 0
- && ! (*insn_operand_predicate[(int) code][2]) (op2, mode))
- op2 = copy_to_mode_reg (mode, op2);
-
- pat = GEN_FCN ((int) code) (x, y, op2, opalign);
- if (pat)
- {
- emit_insn (pat);
- return;
- }
- else
- delete_insns_since (last);
- }
- }
-
-#ifdef TARGET_MEM_FUNCTIONS
- emit_library_call (memcpy_libfunc, 0,
- VOIDmode, 3, XEXP (x, 0), Pmode,
- XEXP (y, 0), Pmode,
- convert_to_mode (TYPE_MODE (sizetype), size,
- TREE_UNSIGNED (sizetype)),
- TYPE_MODE (sizetype));
-#else
- emit_library_call (bcopy_libfunc, 0,
- VOIDmode, 3, XEXP (y, 0), Pmode,
- XEXP (x, 0), Pmode,
- convert_to_mode (TYPE_MODE (integer_type_node), size,
- TREE_UNSIGNED (integer_type_node)),
- TYPE_MODE (integer_type_node));
-#endif
- }
-}
-
-/* Copy all or part of a value X into registers starting at REGNO.
- The number of registers to be filled is NREGS. */
-
-void
-move_block_to_reg (regno, x, nregs, mode)
- int regno;
- rtx x;
- int nregs;
- enum machine_mode mode;
-{
- int i;
- rtx pat, last;
-
- if (nregs == 0)
- return;
-
- if (CONSTANT_P (x) && ! LEGITIMATE_CONSTANT_P (x))
- x = validize_mem (force_const_mem (mode, x));
-
- /* See if the machine can do this with a load multiple insn. */
-#ifdef HAVE_load_multiple
- if (HAVE_load_multiple)
- {
- last = get_last_insn ();
- pat = gen_load_multiple (gen_rtx (REG, word_mode, regno), x,
- GEN_INT (nregs));
- if (pat)
- {
- emit_insn (pat);
- return;
- }
- else
- delete_insns_since (last);
- }
-#endif
-
- for (i = 0; i < nregs; i++)
- emit_move_insn (gen_rtx (REG, word_mode, regno + i),
- operand_subword_force (x, i, mode));
-}
-
-/* Copy all or part of a BLKmode value X out of registers starting at REGNO.
- The number of registers to be filled is NREGS. SIZE indicates the number
- of bytes in the object X. */
-
-
-void
-move_block_from_reg (regno, x, nregs, size)
- int regno;
- rtx x;
- int nregs;
- int size;
-{
- int i;
- rtx pat, last;
-
- /* Blocks smaller than a word on a BYTES_BIG_ENDIAN machine must be aligned
- to the left before storing to memory. */
- if (size < UNITS_PER_WORD && BYTES_BIG_ENDIAN)
- {
- rtx tem = operand_subword (x, 0, 1, BLKmode);
- rtx shift;
-
- if (tem == 0)
- abort ();
-
- shift = expand_shift (LSHIFT_EXPR, word_mode,
- gen_rtx (REG, word_mode, regno),
- build_int_2 ((UNITS_PER_WORD - size)
- * BITS_PER_UNIT, 0), NULL_RTX, 0);
- emit_move_insn (tem, shift);
- return;
- }
-
- /* See if the machine can do this with a store multiple insn. */
-#ifdef HAVE_store_multiple
- if (HAVE_store_multiple)
- {
- last = get_last_insn ();
- pat = gen_store_multiple (x, gen_rtx (REG, word_mode, regno),
- GEN_INT (nregs));
- if (pat)
- {
- emit_insn (pat);
- return;
- }
- else
- delete_insns_since (last);
- }
-#endif
-
- for (i = 0; i < nregs; i++)
- {
- rtx tem = operand_subword (x, i, 1, BLKmode);
-
- if (tem == 0)
- abort ();
-
- emit_move_insn (tem, gen_rtx (REG, word_mode, regno + i));
- }
-}
-
-/* Emit code to move a block Y to a block X, where X is non-consecutive
- registers represented by a PARALLEL. */
-
-void
-emit_group_load (x, y)
- rtx x, y;
-{
- rtx target_reg, source;
- int i;
-
- if (GET_CODE (x) != PARALLEL)
- abort ();
-
- /* Check for a NULL entry, used to indicate that the parameter goes
- both on the stack and in registers. */
- if (XEXP (XVECEXP (x, 0, 0), 0))
- i = 0;
- else
- i = 1;
-
- for (; i < XVECLEN (x, 0); i++)
- {
- rtx element = XVECEXP (x, 0, i);
-
- target_reg = XEXP (element, 0);
-
- if (GET_CODE (y) == MEM)
- source = change_address (y, GET_MODE (target_reg),
- plus_constant (XEXP (y, 0),
- INTVAL (XEXP (element, 1))));
- else if (XEXP (element, 1) == const0_rtx)
- {
- if (GET_MODE (target_reg) == GET_MODE (y))
- source = y;
- /* Allow for the target_reg to be smaller than the input register
- to allow for AIX with 4 DF arguments after a single SI arg. The
- last DF argument will only load 1 word into the integer registers,
- but load a DF value into the float registers. */
- else if ((GET_MODE_SIZE (GET_MODE (target_reg))
- <= GET_MODE_SIZE (GET_MODE (y)))
- && GET_MODE (target_reg) == word_mode)
- /* This might be a const_double, so we can't just use SUBREG. */
- source = operand_subword (y, 0, 0, VOIDmode);
- else
- abort ();
- }
- else
- abort ();
-
- emit_move_insn (target_reg, source);
- }
-}
-
-/* Emit code to move a block Y to a block X, where Y is non-consecutive
- registers represented by a PARALLEL. */
-
-void
-emit_group_store (x, y)
- rtx x, y;
-{
- rtx source_reg, target;
- int i;
-
- if (GET_CODE (y) != PARALLEL)
- abort ();
-
- /* Check for a NULL entry, used to indicate that the parameter goes
- both on the stack and in registers. */
- if (XEXP (XVECEXP (y, 0, 0), 0))
- i = 0;
- else
- i = 1;
-
- for (; i < XVECLEN (y, 0); i++)
- {
- rtx element = XVECEXP (y, 0, i);
-
- source_reg = XEXP (element, 0);
-
- if (GET_CODE (x) == MEM)
- target = change_address (x, GET_MODE (source_reg),
- plus_constant (XEXP (x, 0),
- INTVAL (XEXP (element, 1))));
- else if (XEXP (element, 1) == const0_rtx)
- {
- target = x;
- if (GET_MODE (target) != GET_MODE (source_reg))
- target = gen_lowpart (GET_MODE (source_reg), target);
- }
- else
- abort ();
-
- emit_move_insn (target, source_reg);
- }
-}
-
-/* Add a USE expression for REG to the (possibly empty) list pointed
- to by CALL_FUSAGE. REG must denote a hard register. */
-
-void
-use_reg (call_fusage, reg)
- rtx *call_fusage, reg;
-{
- if (GET_CODE (reg) != REG
- || REGNO (reg) >= FIRST_PSEUDO_REGISTER)
- abort();
-
- *call_fusage
- = gen_rtx (EXPR_LIST, VOIDmode,
- gen_rtx (USE, VOIDmode, reg), *call_fusage);
-}
-
-/* Add USE expressions to *CALL_FUSAGE for each of NREGS consecutive regs,
- starting at REGNO. All of these registers must be hard registers. */
-
-void
-use_regs (call_fusage, regno, nregs)
- rtx *call_fusage;
- int regno;
- int nregs;
-{
- int i;
-
- if (regno + nregs > FIRST_PSEUDO_REGISTER)
- abort ();
-
- for (i = 0; i < nregs; i++)
- use_reg (call_fusage, gen_rtx (REG, reg_raw_mode[regno + i], regno + i));
-}
-
-/* Add USE expressions to *CALL_FUSAGE for each REG contained in the
- PARALLEL REGS. This is for calls that pass values in multiple
- non-contiguous locations. The Irix 6 ABI has examples of this. */
-
-void
-use_group_regs (call_fusage, regs)
- rtx *call_fusage;
- rtx regs;
-{
- int i;
-
- /* Check for a NULL entry, used to indicate that the parameter goes
- both on the stack and in registers. */
- if (XEXP (XVECEXP (regs, 0, 0), 0))
- i = 0;
- else
- i = 1;
-
- for (; i < XVECLEN (regs, 0); i++)
- use_reg (call_fusage, XEXP (XVECEXP (regs, 0, i), 0));
-}
-
-/* Generate several move instructions to clear LEN bytes of block TO.
- (A MEM rtx with BLKmode). The caller must pass TO through
- protect_from_queue before calling. ALIGN (in bytes) is maximum alignment
- we can assume. */
-
-static void
-clear_by_pieces (to, len, align)
- rtx to;
- int len, align;
-{
- struct clear_by_pieces data;
- rtx to_addr = XEXP (to, 0);
- int max_size = MOVE_MAX + 1;
-
- data.offset = 0;
- data.to_addr = to_addr;
- data.to = to;
- data.autinc_to
- = (GET_CODE (to_addr) == PRE_INC || GET_CODE (to_addr) == PRE_DEC
- || GET_CODE (to_addr) == POST_INC || GET_CODE (to_addr) == POST_DEC);
-
- data.explicit_inc_to = 0;
- data.reverse
- = (GET_CODE (to_addr) == PRE_DEC || GET_CODE (to_addr) == POST_DEC);
- if (data.reverse) data.offset = len;
- data.len = len;
-
- data.to_struct = MEM_IN_STRUCT_P (to);
-
- /* If copying requires more than two move insns,
- copy addresses to registers (to make displacements shorter)
- and use post-increment if available. */
- if (!data.autinc_to
- && move_by_pieces_ninsns (len, align) > 2)
- {
-#ifdef HAVE_PRE_DECREMENT
- if (data.reverse && ! data.autinc_to)
- {
- data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
- data.autinc_to = 1;
- data.explicit_inc_to = -1;
- }
-#endif
-#ifdef HAVE_POST_INCREMENT
- if (! data.reverse && ! data.autinc_to)
- {
- data.to_addr = copy_addr_to_reg (to_addr);
- data.autinc_to = 1;
- data.explicit_inc_to = 1;
- }
-#endif
- if (!data.autinc_to && CONSTANT_P (to_addr))
- data.to_addr = copy_addr_to_reg (to_addr);
- }
-
- if (! SLOW_UNALIGNED_ACCESS
- || align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
- align = MOVE_MAX;
-
- /* First move what we can in the largest integer mode, then go to
- successively smaller modes. */
-
- while (max_size > 1)
- {
- enum machine_mode mode = VOIDmode, tmode;
- enum insn_code icode;
-
- for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- tmode != VOIDmode; tmode = GET_MODE_WIDER_MODE (tmode))
- if (GET_MODE_SIZE (tmode) < max_size)
- mode = tmode;
-
- if (mode == VOIDmode)
- break;
-
- icode = mov_optab->handlers[(int) mode].insn_code;
- if (icode != CODE_FOR_nothing
- && align >= MIN (BIGGEST_ALIGNMENT / BITS_PER_UNIT,
- GET_MODE_SIZE (mode)))
- clear_by_pieces_1 (GEN_FCN (icode), mode, &data);
-
- max_size = GET_MODE_SIZE (mode);
- }
-
- /* The code above should have handled everything. */
- if (data.len != 0)
- abort ();
-}
-
-/* Subroutine of clear_by_pieces. Clear as many bytes as appropriate
- with move instructions for mode MODE. GENFUN is the gen_... function
- to make a move insn for that mode. DATA has all the other info. */
-
-static void
-clear_by_pieces_1 (genfun, mode, data)
- rtx (*genfun) ();
- enum machine_mode mode;
- struct clear_by_pieces *data;
-{
- register int size = GET_MODE_SIZE (mode);
- register rtx to1;
-
- while (data->len >= size)
- {
- if (data->reverse) data->offset -= size;
-
- to1 = (data->autinc_to
- ? gen_rtx (MEM, mode, data->to_addr)
- : change_address (data->to, mode,
- plus_constant (data->to_addr, data->offset)));
- MEM_IN_STRUCT_P (to1) = data->to_struct;
-
-#ifdef HAVE_PRE_DECREMENT
- if (data->explicit_inc_to < 0)
- emit_insn (gen_add2_insn (data->to_addr, GEN_INT (-size)));
-#endif
-
- emit_insn ((*genfun) (to1, const0_rtx));
-#ifdef HAVE_POST_INCREMENT
- if (data->explicit_inc_to > 0)
- emit_insn (gen_add2_insn (data->to_addr, GEN_INT (size)));
-#endif
-
- if (! data->reverse) data->offset += size;
-
- data->len -= size;
- }
-}
-
-/* Write zeros through the storage of OBJECT.
- If OBJECT has BLKmode, SIZE is its length in bytes and ALIGN is
- the maximum alignment we can is has, measured in bytes. */
-
-void
-clear_storage (object, size, align)
- rtx object;
- rtx size;
- int align;
-{
- if (GET_MODE (object) == BLKmode)
- {
- object = protect_from_queue (object, 1);
- size = protect_from_queue (size, 0);
-
- if (GET_CODE (size) == CONST_INT
- && (move_by_pieces_ninsns (INTVAL (size), align) < MOVE_RATIO))
- clear_by_pieces (object, INTVAL (size), align);
-
- else
- {
- /* Try the most limited insn first, because there's no point
- including more than one in the machine description unless
- the more limited one has some advantage. */
-
- rtx opalign = GEN_INT (align);
- enum machine_mode mode;
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- {
- enum insn_code code = clrstr_optab[(int) mode];
-
- if (code != CODE_FOR_nothing
- /* We don't need MODE to be narrower than
- BITS_PER_HOST_WIDE_INT here because if SIZE is less than
- the mode mask, as it is returned by the macro, it will
- definitely be less than the actual mode mask. */
- && ((GET_CODE (size) == CONST_INT
- && ((unsigned HOST_WIDE_INT) INTVAL (size)
- <= GET_MODE_MASK (mode)))
- || GET_MODE_BITSIZE (mode) >= BITS_PER_WORD)
- && (insn_operand_predicate[(int) code][0] == 0
- || (*insn_operand_predicate[(int) code][0]) (object,
- BLKmode))
- && (insn_operand_predicate[(int) code][2] == 0
- || (*insn_operand_predicate[(int) code][2]) (opalign,
- VOIDmode)))
- {
- rtx op1;
- rtx last = get_last_insn ();
- rtx pat;
-
- op1 = convert_to_mode (mode, size, 1);
- if (insn_operand_predicate[(int) code][1] != 0
- && ! (*insn_operand_predicate[(int) code][1]) (op1,
- mode))
- op1 = copy_to_mode_reg (mode, op1);
-
- pat = GEN_FCN ((int) code) (object, op1, opalign);
- if (pat)
- {
- emit_insn (pat);
- return;
- }
- else
- delete_insns_since (last);
- }
- }
-
-
-#ifdef TARGET_MEM_FUNCTIONS
- emit_library_call (memset_libfunc, 0,
- VOIDmode, 3,
- XEXP (object, 0), Pmode,
- const0_rtx, TYPE_MODE (integer_type_node),
- convert_to_mode (TYPE_MODE (sizetype),
- size, TREE_UNSIGNED (sizetype)),
- TYPE_MODE (sizetype));
-#else
- emit_library_call (bzero_libfunc, 0,
- VOIDmode, 2,
- XEXP (object, 0), Pmode,
- convert_to_mode (TYPE_MODE (integer_type_node),
- size,
- TREE_UNSIGNED (integer_type_node)),
- TYPE_MODE (integer_type_node));
-#endif
- }
- }
- else
- emit_move_insn (object, const0_rtx);
-}
-
-/* Generate code to copy Y into X.
- Both Y and X must have the same mode, except that
- Y can be a constant with VOIDmode.
- This mode cannot be BLKmode; use emit_block_move for that.
-
- Return the last instruction emitted. */
-
-rtx
-emit_move_insn (x, y)
- rtx x, y;
-{
- enum machine_mode mode = GET_MODE (x);
-
- x = protect_from_queue (x, 1);
- y = protect_from_queue (y, 0);
-
- if (mode == BLKmode || (GET_MODE (y) != mode && GET_MODE (y) != VOIDmode))
- abort ();
-
- if (CONSTANT_P (y) && ! LEGITIMATE_CONSTANT_P (y))
- y = force_const_mem (mode, y);
-
- /* If X or Y are memory references, verify that their addresses are valid
- for the machine. */
- if (GET_CODE (x) == MEM
- && ((! memory_address_p (GET_MODE (x), XEXP (x, 0))
- && ! push_operand (x, GET_MODE (x)))
- || (flag_force_addr
- && CONSTANT_ADDRESS_P (XEXP (x, 0)))))
- x = change_address (x, VOIDmode, XEXP (x, 0));
-
- if (GET_CODE (y) == MEM
- && (! memory_address_p (GET_MODE (y), XEXP (y, 0))
- || (flag_force_addr
- && CONSTANT_ADDRESS_P (XEXP (y, 0)))))
- y = change_address (y, VOIDmode, XEXP (y, 0));
-
- if (mode == BLKmode)
- abort ();
-
- return emit_move_insn_1 (x, y);
-}
-
-/* Low level part of emit_move_insn.
- Called just like emit_move_insn, but assumes X and Y
- are basically valid. */
-
-rtx
-emit_move_insn_1 (x, y)
- rtx x, y;
-{
- enum machine_mode mode = GET_MODE (x);
- enum machine_mode submode;
- enum mode_class class = GET_MODE_CLASS (mode);
- int i;
-
- if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- return
- emit_insn (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));
-
- /* Expand complex moves by moving real part and imag part, if possible. */
- else if ((class == MODE_COMPLEX_FLOAT || class == MODE_COMPLEX_INT)
- && BLKmode != (submode = mode_for_size ((GET_MODE_UNIT_SIZE (mode)
- * BITS_PER_UNIT),
- (class == MODE_COMPLEX_INT
- ? MODE_INT : MODE_FLOAT),
- 0))
- && (mov_optab->handlers[(int) submode].insn_code
- != CODE_FOR_nothing))
- {
- /* Don't split destination if it is a stack push. */
- int stack = push_operand (x, GET_MODE (x));
- rtx insns;
-
- /* If this is a stack, push the highpart first, so it
- will be in the argument order.
-
- In that case, change_address is used only to convert
- the mode, not to change the address. */
- if (stack)
- {
- /* Note that the real part always precedes the imag part in memory
- regardless of machine's endianness. */
-#ifdef STACK_GROWS_DOWNWARD
- emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
- (gen_rtx (MEM, submode, (XEXP (x, 0))),
- gen_imagpart (submode, y)));
- emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
- (gen_rtx (MEM, submode, (XEXP (x, 0))),
- gen_realpart (submode, y)));
-#else
- emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
- (gen_rtx (MEM, submode, (XEXP (x, 0))),
- gen_realpart (submode, y)));
- emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
- (gen_rtx (MEM, submode, (XEXP (x, 0))),
- gen_imagpart (submode, y)));
-#endif
- }
- else
- {
- emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
- (gen_realpart (submode, x), gen_realpart (submode, y)));
- emit_insn (GEN_FCN (mov_optab->handlers[(int) submode].insn_code)
- (gen_imagpart (submode, x), gen_imagpart (submode, y)));
- }
-
- return get_last_insn ();
- }
-
- /* This will handle any multi-word mode that lacks a move_insn pattern.
- However, you will get better code if you define such patterns,
- even if they must turn into multiple assembler instructions. */
- else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
- {
- rtx last_insn = 0;
- rtx insns;
-
-#ifdef PUSH_ROUNDING
-
- /* If X is a push on the stack, do the push now and replace
- X with a reference to the stack pointer. */
- if (push_operand (x, GET_MODE (x)))
- {
- anti_adjust_stack (GEN_INT (GET_MODE_SIZE (GET_MODE (x))));
- x = change_address (x, VOIDmode, stack_pointer_rtx);
- }
-#endif
-
- /* Show the output dies here. */
- if (x != y)
- emit_insn (gen_rtx (CLOBBER, VOIDmode, x));
-
- for (i = 0;
- i < (GET_MODE_SIZE (mode) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
- i++)
- {
- rtx xpart = operand_subword (x, i, 1, mode);
- rtx ypart = operand_subword (y, i, 1, mode);
-
- /* If we can't get a part of Y, put Y into memory if it is a
- constant. Otherwise, force it into a register. If we still
- can't get a part of Y, abort. */
- if (ypart == 0 && CONSTANT_P (y))
- {
- y = force_const_mem (mode, y);
- ypart = operand_subword (y, i, 1, mode);
- }
- else if (ypart == 0)
- ypart = operand_subword_force (y, i, mode);
-
- if (xpart == 0 || ypart == 0)
- abort ();
-
- last_insn = emit_move_insn (xpart, ypart);
- }
-
- return last_insn;
- }
- else
- abort ();
-}
-
-/* Pushing data onto the stack. */
-
-/* Push a block of length SIZE (perhaps variable)
- and return an rtx to address the beginning of the block.
- Note that it is not possible for the value returned to be a QUEUED.
- The value may be virtual_outgoing_args_rtx.
-
- EXTRA is the number of bytes of padding to push in addition to SIZE.
- BELOW nonzero means this padding comes at low addresses;
- otherwise, the padding comes at high addresses. */
-
-rtx
-push_block (size, extra, below)
- rtx size;
- int extra, below;
-{
- register rtx temp;
-
- size = convert_modes (Pmode, ptr_mode, size, 1);
- if (CONSTANT_P (size))
- anti_adjust_stack (plus_constant (size, extra));
- else if (GET_CODE (size) == REG && extra == 0)
- anti_adjust_stack (size);
- else
- {
- rtx temp = copy_to_mode_reg (Pmode, size);
- if (extra != 0)
- temp = expand_binop (Pmode, add_optab, temp, GEN_INT (extra),
- temp, 0, OPTAB_LIB_WIDEN);
- anti_adjust_stack (temp);
- }
-
-#ifdef STACK_GROWS_DOWNWARD
- temp = virtual_outgoing_args_rtx;
- if (extra != 0 && below)
- temp = plus_constant (temp, extra);
-#else
- if (GET_CODE (size) == CONST_INT)
- temp = plus_constant (virtual_outgoing_args_rtx,
- - INTVAL (size) - (below ? 0 : extra));
- else if (extra != 0 && !below)
- temp = gen_rtx (PLUS, Pmode, virtual_outgoing_args_rtx,
- negate_rtx (Pmode, plus_constant (size, extra)));
- else
- temp = gen_rtx (PLUS, Pmode, virtual_outgoing_args_rtx,
- negate_rtx (Pmode, size));
-#endif
-
- return memory_address (GET_CLASS_NARROWEST_MODE (MODE_INT), temp);
-}
-
-rtx
-gen_push_operand ()
-{
- return gen_rtx (STACK_PUSH_CODE, Pmode, stack_pointer_rtx);
-}
-
-/* Generate code to push X onto the stack, assuming it has mode MODE and
- type TYPE.
- MODE is redundant except when X is a CONST_INT (since they don't
- carry mode info).
- SIZE is an rtx for the size of data to be copied (in bytes),
- needed only if X is BLKmode.
-
- ALIGN (in bytes) is maximum alignment we can assume.
-
- If PARTIAL and REG are both nonzero, then copy that many of the first
- words of X into registers starting with REG, and push the rest of X.
- The amount of space pushed is decreased by PARTIAL words,
- rounded *down* to a multiple of PARM_BOUNDARY.
- REG must be a hard register in this case.
- If REG is zero but PARTIAL is not, take any all others actions for an
- argument partially in registers, but do not actually load any
- registers.
-
- EXTRA is the amount in bytes of extra space to leave next to this arg.
- This is ignored if an argument block has already been allocated.
-
- On a machine that lacks real push insns, ARGS_ADDR is the address of
- the bottom of the argument block for this call. We use indexing off there
- to store the arg. On machines with push insns, ARGS_ADDR is 0 when a
- argument block has not been preallocated.
-
- ARGS_SO_FAR is the size of args previously pushed for this call. */
-
-void
-emit_push_insn (x, mode, type, size, align, partial, reg, extra,
- args_addr, args_so_far)
- register rtx x;
- enum machine_mode mode;
- tree type;
- rtx size;
- int align;
- int partial;
- rtx reg;
- int extra;
- rtx args_addr;
- rtx args_so_far;
-{
- rtx xinner;
- enum direction stack_direction
-#ifdef STACK_GROWS_DOWNWARD
- = downward;
-#else
- = upward;
-#endif
-
- /* Decide where to pad the argument: `downward' for below,
- `upward' for above, or `none' for don't pad it.
- Default is below for small data on big-endian machines; else above. */
- enum direction where_pad = FUNCTION_ARG_PADDING (mode, type);
-
- /* Invert direction if stack is post-update. */
- if (STACK_PUSH_CODE == POST_INC || STACK_PUSH_CODE == POST_DEC)
- if (where_pad != none)
- where_pad = (where_pad == downward ? upward : downward);
-
- xinner = x = protect_from_queue (x, 0);
-
- if (mode == BLKmode)
- {
- /* Copy a block into the stack, entirely or partially. */
-
- register rtx temp;
- int used = partial * UNITS_PER_WORD;
- int offset = used % (PARM_BOUNDARY / BITS_PER_UNIT);
- int skip;
-
- if (size == 0)
- abort ();
-
- used -= offset;
-
- /* USED is now the # of bytes we need not copy to the stack
- because registers will take care of them. */
-
- if (partial != 0)
- xinner = change_address (xinner, BLKmode,
- plus_constant (XEXP (xinner, 0), used));
-
- /* If the partial register-part of the arg counts in its stack size,
- skip the part of stack space corresponding to the registers.
- Otherwise, start copying to the beginning of the stack space,
- by setting SKIP to 0. */
-#ifndef REG_PARM_STACK_SPACE
- skip = 0;
-#else
- skip = used;
-#endif
-
-#ifdef PUSH_ROUNDING
- /* Do it with several push insns if that doesn't take lots of insns
- and if there is no difficulty with push insns that skip bytes
- on the stack for alignment purposes. */
- if (args_addr == 0
- && GET_CODE (size) == CONST_INT
- && skip == 0
- && (move_by_pieces_ninsns ((unsigned) INTVAL (size) - used, align)
- < MOVE_RATIO)
- /* Here we avoid the case of a structure whose weak alignment
- forces many pushes of a small amount of data,
- and such small pushes do rounding that causes trouble. */
- && ((! SLOW_UNALIGNED_ACCESS)
- || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT
- || PUSH_ROUNDING (align) == align)
- && PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
- {
- /* Push padding now if padding above and stack grows down,
- or if padding below and stack grows up.
- But if space already allocated, this has already been done. */
- if (extra && args_addr == 0
- && where_pad != none && where_pad != stack_direction)
- anti_adjust_stack (GEN_INT (extra));
-
- move_by_pieces (gen_rtx (MEM, BLKmode, gen_push_operand ()), xinner,
- INTVAL (size) - used, align);
- }
- else
-#endif /* PUSH_ROUNDING */
- {
- /* Otherwise make space on the stack and copy the data
- to the address of that space. */
-
- /* Deduct words put into registers from the size we must copy. */
- if (partial != 0)
- {
- if (GET_CODE (size) == CONST_INT)
- size = GEN_INT (INTVAL (size) - used);
- else
- size = expand_binop (GET_MODE (size), sub_optab, size,
- GEN_INT (used), NULL_RTX, 0,
- OPTAB_LIB_WIDEN);
- }
-
- /* Get the address of the stack space.
- In this case, we do not deal with EXTRA separately.
- A single stack adjust will do. */
- if (! args_addr)
- {
- temp = push_block (size, extra, where_pad == downward);
- extra = 0;
- }
- else if (GET_CODE (args_so_far) == CONST_INT)
- temp = memory_address (BLKmode,
- plus_constant (args_addr,
- skip + INTVAL (args_so_far)));
- else
- temp = memory_address (BLKmode,
- plus_constant (gen_rtx (PLUS, Pmode,
- args_addr, args_so_far),
- skip));
-
- /* TEMP is the address of the block. Copy the data there. */
- if (GET_CODE (size) == CONST_INT
- && (move_by_pieces_ninsns ((unsigned) INTVAL (size), align)
- < MOVE_RATIO))
- {
- move_by_pieces (gen_rtx (MEM, BLKmode, temp), xinner,
- INTVAL (size), align);
- goto ret;
- }
- /* Try the most limited insn first, because there's no point
- including more than one in the machine description unless
- the more limited one has some advantage. */
-#ifdef HAVE_movstrqi
- if (HAVE_movstrqi
- && GET_CODE (size) == CONST_INT
- && ((unsigned) INTVAL (size)
- < (1 << (GET_MODE_BITSIZE (QImode) - 1))))
- {
- rtx pat = gen_movstrqi (gen_rtx (MEM, BLKmode, temp),
- xinner, size, GEN_INT (align));
- if (pat != 0)
- {
- emit_insn (pat);
- goto ret;
- }
- }
-#endif
-#ifdef HAVE_movstrhi
- if (HAVE_movstrhi
- && GET_CODE (size) == CONST_INT
- && ((unsigned) INTVAL (size)
- < (1 << (GET_MODE_BITSIZE (HImode) - 1))))
- {
- rtx pat = gen_movstrhi (gen_rtx (MEM, BLKmode, temp),
- xinner, size, GEN_INT (align));
- if (pat != 0)
- {
- emit_insn (pat);
- goto ret;
- }
- }
-#endif
-#ifdef HAVE_movstrsi
- if (HAVE_movstrsi)
- {
- rtx pat = gen_movstrsi (gen_rtx (MEM, BLKmode, temp),
- xinner, size, GEN_INT (align));
- if (pat != 0)
- {
- emit_insn (pat);
- goto ret;
- }
- }
-#endif
-#ifdef HAVE_movstrdi
- if (HAVE_movstrdi)
- {
- rtx pat = gen_movstrdi (gen_rtx (MEM, BLKmode, temp),
- xinner, size, GEN_INT (align));
- if (pat != 0)
- {
- emit_insn (pat);
- goto ret;
- }
- }
-#endif
-
-#ifndef ACCUMULATE_OUTGOING_ARGS
- /* If the source is referenced relative to the stack pointer,
- copy it to another register to stabilize it. We do not need
- to do this if we know that we won't be changing sp. */
-
- if (reg_mentioned_p (virtual_stack_dynamic_rtx, temp)
- || reg_mentioned_p (virtual_outgoing_args_rtx, temp))
- temp = copy_to_reg (temp);
-#endif
-
- /* Make inhibit_defer_pop nonzero around the library call
- to force it to pop the bcopy-arguments right away. */
- NO_DEFER_POP;
-#ifdef TARGET_MEM_FUNCTIONS
- emit_library_call (memcpy_libfunc, 0,
- VOIDmode, 3, temp, Pmode, XEXP (xinner, 0), Pmode,
- convert_to_mode (TYPE_MODE (sizetype),
- size, TREE_UNSIGNED (sizetype)),
- TYPE_MODE (sizetype));
-#else
- emit_library_call (bcopy_libfunc, 0,
- VOIDmode, 3, XEXP (xinner, 0), Pmode, temp, Pmode,
- convert_to_mode (TYPE_MODE (integer_type_node),
- size,
- TREE_UNSIGNED (integer_type_node)),
- TYPE_MODE (integer_type_node));
-#endif
- OK_DEFER_POP;
- }
- }
- else if (partial > 0)
- {
- /* Scalar partly in registers. */
-
- int size = GET_MODE_SIZE (mode) / UNITS_PER_WORD;
- int i;
- int not_stack;
- /* # words of start of argument
- that we must make space for but need not store. */
- int offset = partial % (PARM_BOUNDARY / BITS_PER_WORD);
- int args_offset = INTVAL (args_so_far);
- int skip;
-
- /* Push padding now if padding above and stack grows down,
- or if padding below and stack grows up.
- But if space already allocated, this has already been done. */
- if (extra && args_addr == 0
- && where_pad != none && where_pad != stack_direction)
- anti_adjust_stack (GEN_INT (extra));
-
- /* If we make space by pushing it, we might as well push
- the real data. Otherwise, we can leave OFFSET nonzero
- and leave the space uninitialized. */
- if (args_addr == 0)
- offset = 0;
-
- /* Now NOT_STACK gets the number of words that we don't need to
- allocate on the stack. */
- not_stack = partial - offset;
-
- /* If the partial register-part of the arg counts in its stack size,
- skip the part of stack space corresponding to the registers.
- Otherwise, start copying to the beginning of the stack space,
- by setting SKIP to 0. */
-#ifndef REG_PARM_STACK_SPACE
- skip = 0;
-#else
- skip = not_stack;
-#endif
-
- if (CONSTANT_P (x) && ! LEGITIMATE_CONSTANT_P (x))
- x = validize_mem (force_const_mem (mode, x));
-
- /* If X is a hard register in a non-integer mode, copy it into a pseudo;
- SUBREGs of such registers are not allowed. */
- if ((GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER
- && GET_MODE_CLASS (GET_MODE (x)) != MODE_INT))
- x = copy_to_reg (x);
-
- /* Loop over all the words allocated on the stack for this arg. */
- /* We can do it by words, because any scalar bigger than a word
- has a size a multiple of a word. */
-#ifndef PUSH_ARGS_REVERSED
- for (i = not_stack; i < size; i++)
-#else
- for (i = size - 1; i >= not_stack; i--)
-#endif
- if (i >= not_stack + offset)
- emit_push_insn (operand_subword_force (x, i, mode),
- word_mode, NULL_TREE, NULL_RTX, align, 0, NULL_RTX,
- 0, args_addr,
- GEN_INT (args_offset + ((i - not_stack + skip)
- * UNITS_PER_WORD)));
- }
- else
- {
- rtx addr;
-
- /* Push padding now if padding above and stack grows down,
- or if padding below and stack grows up.
- But if space already allocated, this has already been done. */
- if (extra && args_addr == 0
- && where_pad != none && where_pad != stack_direction)
- anti_adjust_stack (GEN_INT (extra));
-
-#ifdef PUSH_ROUNDING
- if (args_addr == 0)
- addr = gen_push_operand ();
- else
-#endif
- if (GET_CODE (args_so_far) == CONST_INT)
- addr
- = memory_address (mode,
- plus_constant (args_addr, INTVAL (args_so_far)));
- else
- addr = memory_address (mode, gen_rtx (PLUS, Pmode, args_addr,
- args_so_far));
-
- emit_move_insn (gen_rtx (MEM, mode, addr), x);
- }
-
- ret:
- /* If part should go in registers, copy that part
- into the appropriate registers. Do this now, at the end,
- since mem-to-mem copies above may do function calls. */
- if (partial > 0 && reg != 0)
- {
- /* Handle calls that pass values in multiple non-contiguous locations.
- The Irix 6 ABI has examples of this. */
- if (GET_CODE (reg) == PARALLEL)
- emit_group_load (reg, x);
- else
- move_block_to_reg (REGNO (reg), x, partial, mode);
- }
-
- if (extra && args_addr == 0 && where_pad == stack_direction)
- anti_adjust_stack (GEN_INT (extra));
-}
-
-/* Expand an assignment that stores the value of FROM into TO.
- If WANT_VALUE is nonzero, return an rtx for the value of TO.
- (This may contain a QUEUED rtx;
- if the value is constant, this rtx is a constant.)
- Otherwise, the returned value is NULL_RTX.
-
- SUGGEST_REG is no longer actually used.
- It used to mean, copy the value through a register
- and return that register, if that is possible.
- We now use WANT_VALUE to decide whether to do this. */
-
-rtx
-expand_assignment (to, from, want_value, suggest_reg)
- tree to, from;
- int want_value;
- int suggest_reg;
-{
- register rtx to_rtx = 0;
- rtx result;
-
- /* Don't crash if the lhs of the assignment was erroneous. */
-
- if (TREE_CODE (to) == ERROR_MARK)
- {
- result = expand_expr (from, NULL_RTX, VOIDmode, 0);
- return want_value ? result : NULL_RTX;
- }
-
- if (output_bytecode)
- {
- tree dest_innermost;
-
- bc_expand_expr (from);
- bc_emit_instruction (duplicate);
-
- dest_innermost = bc_expand_address (to);
-
- /* Can't deduce from TYPE that we're dealing with a bitfield, so
- take care of it here. */
-
- bc_store_memory (TREE_TYPE (to), dest_innermost);
- return NULL;
- }
-
- /* Assignment of a structure component needs special treatment
- if the structure component's rtx is not simply a MEM.
- Assignment of an array element at a constant index, and assignment of
- an array element in an unaligned packed structure field, has the same
- problem. */
-
- if (TREE_CODE (to) == COMPONENT_REF
- || TREE_CODE (to) == BIT_FIELD_REF
- || (TREE_CODE (to) == ARRAY_REF
- && ((TREE_CODE (TREE_OPERAND (to, 1)) == INTEGER_CST
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (to))) == INTEGER_CST)
- || (SLOW_UNALIGNED_ACCESS && get_inner_unaligned_p (to)))))
- {
- enum machine_mode mode1;
- int bitsize;
- int bitpos;
- tree offset;
- int unsignedp;
- int volatilep = 0;
- tree tem;
- int alignment;
-
- push_temp_slots ();
- tem = get_inner_reference (to, &bitsize, &bitpos, &offset, &mode1,
- &unsignedp, &volatilep, &alignment);
-
- /* If we are going to use store_bit_field and extract_bit_field,
- make sure to_rtx will be safe for multiple use. */
-
- if (mode1 == VOIDmode && want_value)
- tem = stabilize_reference (tem);
-
- to_rtx = expand_expr (tem, NULL_RTX, VOIDmode, 0);
- if (offset != 0)
- {
- rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
-
- if (GET_CODE (to_rtx) != MEM)
- abort ();
- to_rtx = change_address (to_rtx, VOIDmode,
- gen_rtx (PLUS, ptr_mode, XEXP (to_rtx, 0),
- force_reg (ptr_mode, offset_rtx)));
- }
- if (volatilep)
- {
- if (GET_CODE (to_rtx) == MEM)
- {
- /* When the offset is zero, to_rtx is the address of the
- structure we are storing into, and hence may be shared.
- We must make a new MEM before setting the volatile bit. */
- if (offset == 0)
- to_rtx = change_address (to_rtx, VOIDmode, XEXP (to_rtx, 0));
- MEM_VOLATILE_P (to_rtx) = 1;
- }
-#if 0 /* This was turned off because, when a field is volatile
- in an object which is not volatile, the object may be in a register,
- and then we would abort over here. */
- else
- abort ();
-#endif
- }
-
- result = store_field (to_rtx, bitsize, bitpos, mode1, from,
- (want_value
- /* Spurious cast makes HPUX compiler happy. */
- ? (enum machine_mode) TYPE_MODE (TREE_TYPE (to))
- : VOIDmode),
- unsignedp,
- /* Required alignment of containing datum. */
- alignment,
- int_size_in_bytes (TREE_TYPE (tem)));
- preserve_temp_slots (result);
- free_temp_slots ();
- pop_temp_slots ();
-
- /* If the value is meaningful, convert RESULT to the proper mode.
- Otherwise, return nothing. */
- return (want_value ? convert_modes (TYPE_MODE (TREE_TYPE (to)),
- TYPE_MODE (TREE_TYPE (from)),
- result,
- TREE_UNSIGNED (TREE_TYPE (to)))
- : NULL_RTX);
- }
-
- /* If the rhs is a function call and its value is not an aggregate,
- call the function before we start to compute the lhs.
- This is needed for correct code for cases such as
- val = setjmp (buf) on machines where reference to val
- requires loading up part of an address in a separate insn.
-
- Don't do this if TO is a VAR_DECL whose DECL_RTL is REG since it might be
- a promoted variable where the zero- or sign- extension needs to be done.
- Handling this in the normal way is safe because no computation is done
- before the call. */
- if (TREE_CODE (from) == CALL_EXPR && ! aggregate_value_p (from)
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (from))) == INTEGER_CST
- && ! (TREE_CODE (to) == VAR_DECL && GET_CODE (DECL_RTL (to)) == REG))
- {
- rtx value;
-
- push_temp_slots ();
- value = expand_expr (from, NULL_RTX, VOIDmode, 0);
- if (to_rtx == 0)
- to_rtx = expand_expr (to, NULL_RTX, VOIDmode, 0);
-
- /* Handle calls that return values in multiple non-contiguous locations.
- The Irix 6 ABI has examples of this. */
- if (GET_CODE (to_rtx) == PARALLEL)
- emit_group_load (to_rtx, value);
- else if (GET_MODE (to_rtx) == BLKmode)
- emit_block_move (to_rtx, value, expr_size (from),
- TYPE_ALIGN (TREE_TYPE (from)) / BITS_PER_UNIT);
- else
- emit_move_insn (to_rtx, value);
- preserve_temp_slots (to_rtx);
- free_temp_slots ();
- pop_temp_slots ();
- return want_value ? to_rtx : NULL_RTX;
- }
-
- /* Ordinary treatment. Expand TO to get a REG or MEM rtx.
- Don't re-expand if it was expanded already (in COMPONENT_REF case). */
-
- if (to_rtx == 0)
- to_rtx = expand_expr (to, NULL_RTX, VOIDmode, 0);
-
- /* Don't move directly into a return register. */
- if (TREE_CODE (to) == RESULT_DECL && GET_CODE (to_rtx) == REG)
- {
- rtx temp;
-
- push_temp_slots ();
- temp = expand_expr (from, 0, GET_MODE (to_rtx), 0);
- emit_move_insn (to_rtx, temp);
- preserve_temp_slots (to_rtx);
- free_temp_slots ();
- pop_temp_slots ();
- return want_value ? to_rtx : NULL_RTX;
- }
-
- /* In case we are returning the contents of an object which overlaps
- the place the value is being stored, use a safe function when copying
- a value through a pointer into a structure value return block. */
- if (TREE_CODE (to) == RESULT_DECL && TREE_CODE (from) == INDIRECT_REF
- && current_function_returns_struct
- && !current_function_returns_pcc_struct)
- {
- rtx from_rtx, size;
-
- push_temp_slots ();
- size = expr_size (from);
- from_rtx = expand_expr (from, NULL_RTX, VOIDmode, 0);
-
-#ifdef TARGET_MEM_FUNCTIONS
- emit_library_call (memcpy_libfunc, 0,
- VOIDmode, 3, XEXP (to_rtx, 0), Pmode,
- XEXP (from_rtx, 0), Pmode,
- convert_to_mode (TYPE_MODE (sizetype),
- size, TREE_UNSIGNED (sizetype)),
- TYPE_MODE (sizetype));
-#else
- emit_library_call (bcopy_libfunc, 0,
- VOIDmode, 3, XEXP (from_rtx, 0), Pmode,
- XEXP (to_rtx, 0), Pmode,
- convert_to_mode (TYPE_MODE (integer_type_node),
- size, TREE_UNSIGNED (integer_type_node)),
- TYPE_MODE (integer_type_node));
-#endif
-
- preserve_temp_slots (to_rtx);
- free_temp_slots ();
- pop_temp_slots ();
- return want_value ? to_rtx : NULL_RTX;
- }
-
- /* Compute FROM and store the value in the rtx we got. */
-
- push_temp_slots ();
- result = store_expr (from, to_rtx, want_value);
- preserve_temp_slots (result);
- free_temp_slots ();
- pop_temp_slots ();
- return want_value ? result : NULL_RTX;
-}
-
-/* Generate code for computing expression EXP,
- and storing the value into TARGET.
- TARGET may contain a QUEUED rtx.
-
- If WANT_VALUE is nonzero, return a copy of the value
- not in TARGET, so that we can be sure to use the proper
- value in a containing expression even if TARGET has something
- else stored in it. If possible, we copy the value through a pseudo
- and return that pseudo. Or, if the value is constant, we try to
- return the constant. In some cases, we return a pseudo
- copied *from* TARGET.
-
- If the mode is BLKmode then we may return TARGET itself.
- It turns out that in BLKmode it doesn't cause a problem.
- because C has no operators that could combine two different
- assignments into the same BLKmode object with different values
- with no sequence point. Will other languages need this to
- be more thorough?
-
- If WANT_VALUE is 0, we return NULL, to make sure
- to catch quickly any cases where the caller uses the value
- and fails to set WANT_VALUE. */
-
-rtx
-store_expr (exp, target, want_value)
- register tree exp;
- register rtx target;
- int want_value;
-{
- register rtx temp;
- int dont_return_target = 0;
-
- if (TREE_CODE (exp) == COMPOUND_EXPR)
- {
- /* Perform first part of compound expression, then assign from second
- part. */
- expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
- emit_queue ();
- return store_expr (TREE_OPERAND (exp, 1), target, want_value);
- }
- else if (TREE_CODE (exp) == COND_EXPR && GET_MODE (target) == BLKmode)
- {
- /* For conditional expression, get safe form of the target. Then
- test the condition, doing the appropriate assignment on either
- side. This avoids the creation of unnecessary temporaries.
- For non-BLKmode, it is more efficient not to do this. */
-
- rtx lab1 = gen_label_rtx (), lab2 = gen_label_rtx ();
- rtx flag = NULL_RTX;
- tree left_cleanups = NULL_TREE;
- tree right_cleanups = NULL_TREE;
- tree old_cleanups = cleanups_this_call;
-
- /* Used to save a pointer to the place to put the setting of
- the flag that indicates if this side of the conditional was
- taken. We backpatch the code, if we find out later that we
- have any conditional cleanups that need to be performed. */
- rtx dest_right_flag = NULL_RTX;
- rtx dest_left_flag = NULL_RTX;
-
- emit_queue ();
- target = protect_from_queue (target, 1);
-
- do_pending_stack_adjust ();
- NO_DEFER_POP;
- jumpifnot (TREE_OPERAND (exp, 0), lab1);
- store_expr (TREE_OPERAND (exp, 1), target, 0);
- dest_left_flag = get_last_insn ();
- /* Handle conditional cleanups, if any. */
- left_cleanups = defer_cleanups_to (old_cleanups);
- emit_queue ();
- emit_jump_insn (gen_jump (lab2));
- emit_barrier ();
- emit_label (lab1);
- store_expr (TREE_OPERAND (exp, 2), target, 0);
- dest_right_flag = get_last_insn ();
- /* Handle conditional cleanups, if any. */
- right_cleanups = defer_cleanups_to (old_cleanups);
- emit_queue ();
- emit_label (lab2);
- OK_DEFER_POP;
-
- /* Add back in any conditional cleanups. */
- if (left_cleanups || right_cleanups)
- {
- tree new_cleanups;
- tree cond;
- rtx last;
-
- /* Now that we know that a flag is needed, go back and add in the
- setting of the flag. */
-
- flag = gen_reg_rtx (word_mode);
-
- /* Do the left side flag. */
- last = get_last_insn ();
- /* Flag left cleanups as needed. */
- emit_move_insn (flag, const1_rtx);
- /* ??? deprecated, use sequences instead. */
- reorder_insns (NEXT_INSN (last), get_last_insn (), dest_left_flag);
-
- /* Do the right side flag. */
- last = get_last_insn ();
- /* Flag left cleanups as needed. */
- emit_move_insn (flag, const0_rtx);
- /* ??? deprecated, use sequences instead. */
- reorder_insns (NEXT_INSN (last), get_last_insn (), dest_right_flag);
-
- /* All cleanups must be on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
-
- /* convert flag, which is an rtx, into a tree. */
- cond = make_node (RTL_EXPR);
- TREE_TYPE (cond) = integer_type_node;
- RTL_EXPR_RTL (cond) = flag;
- RTL_EXPR_SEQUENCE (cond) = NULL_RTX;
- cond = save_expr (cond);
-
- if (! left_cleanups)
- left_cleanups = integer_zero_node;
- if (! right_cleanups)
- right_cleanups = integer_zero_node;
- new_cleanups = build (COND_EXPR, void_type_node,
- truthvalue_conversion (cond),
- left_cleanups, right_cleanups);
- new_cleanups = fold (new_cleanups);
-
- pop_obstacks ();
-
- /* Now add in the conditionalized cleanups. */
- cleanups_this_call
- = tree_cons (NULL_TREE, new_cleanups, cleanups_this_call);
- expand_eh_region_start ();
- }
- return want_value ? target : NULL_RTX;
- }
- else if (want_value && GET_CODE (target) == MEM && ! MEM_VOLATILE_P (target)
- && GET_MODE (target) != BLKmode)
- /* If target is in memory and caller wants value in a register instead,
- arrange that. Pass TARGET as target for expand_expr so that,
- if EXP is another assignment, WANT_VALUE will be nonzero for it.
- We know expand_expr will not use the target in that case.
- Don't do this if TARGET is volatile because we are supposed
- to write it and then read it. */
- {
- temp = expand_expr (exp, cse_not_expected ? NULL_RTX : target,
- GET_MODE (target), 0);
- if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
- temp = copy_to_reg (temp);
- dont_return_target = 1;
- }
- else if (queued_subexp_p (target))
- /* If target contains a postincrement, let's not risk
- using it as the place to generate the rhs. */
- {
- if (GET_MODE (target) != BLKmode && GET_MODE (target) != VOIDmode)
- {
- /* Expand EXP into a new pseudo. */
- temp = gen_reg_rtx (GET_MODE (target));
- temp = expand_expr (exp, temp, GET_MODE (target), 0);
- }
- else
- temp = expand_expr (exp, NULL_RTX, GET_MODE (target), 0);
-
- /* If target is volatile, ANSI requires accessing the value
- *from* the target, if it is accessed. So make that happen.
- In no case return the target itself. */
- if (! MEM_VOLATILE_P (target) && want_value)
- dont_return_target = 1;
- }
- else if (GET_CODE (target) == SUBREG && SUBREG_PROMOTED_VAR_P (target))
- /* If this is an scalar in a register that is stored in a wider mode
- than the declared mode, compute the result into its declared mode
- and then convert to the wider mode. Our value is the computed
- expression. */
- {
- /* If we don't want a value, we can do the conversion inside EXP,
- which will often result in some optimizations. Do the conversion
- in two steps: first change the signedness, if needed, then
- the extend. But don't do this if the type of EXP is a subtype
- of something else since then the conversion might involve
- more than just converting modes. */
- if (! want_value && INTEGRAL_TYPE_P (TREE_TYPE (exp))
- && TREE_TYPE (TREE_TYPE (exp)) == 0)
- {
- if (TREE_UNSIGNED (TREE_TYPE (exp))
- != SUBREG_PROMOTED_UNSIGNED_P (target))
- exp
- = convert
- (signed_or_unsigned_type (SUBREG_PROMOTED_UNSIGNED_P (target),
- TREE_TYPE (exp)),
- exp);
-
- exp = convert (type_for_mode (GET_MODE (SUBREG_REG (target)),
- SUBREG_PROMOTED_UNSIGNED_P (target)),
- exp);
- }
-
- temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
-
- /* If TEMP is a volatile MEM and we want a result value, make
- the access now so it gets done only once. Likewise if
- it contains TARGET. */
- if (GET_CODE (temp) == MEM && want_value
- && (MEM_VOLATILE_P (temp)
- || reg_mentioned_p (SUBREG_REG (target), XEXP (temp, 0))))
- temp = copy_to_reg (temp);
-
- /* If TEMP is a VOIDmode constant, use convert_modes to make
- sure that we properly convert it. */
- if (CONSTANT_P (temp) && GET_MODE (temp) == VOIDmode)
- temp = convert_modes (GET_MODE (SUBREG_REG (target)),
- TYPE_MODE (TREE_TYPE (exp)), temp,
- SUBREG_PROMOTED_UNSIGNED_P (target));
-
- convert_move (SUBREG_REG (target), temp,
- SUBREG_PROMOTED_UNSIGNED_P (target));
- return want_value ? temp : NULL_RTX;
- }
- else
- {
- temp = expand_expr (exp, target, GET_MODE (target), 0);
- /* Return TARGET if it's a specified hardware register.
- If TARGET is a volatile mem ref, either return TARGET
- or return a reg copied *from* TARGET; ANSI requires this.
-
- Otherwise, if TEMP is not TARGET, return TEMP
- if it is constant (for efficiency),
- or if we really want the correct value. */
- if (!(target && GET_CODE (target) == REG
- && REGNO (target) < FIRST_PSEUDO_REGISTER)
- && !(GET_CODE (target) == MEM && MEM_VOLATILE_P (target))
- && temp != target
- && (CONSTANT_P (temp) || want_value))
- dont_return_target = 1;
- }
-
- /* If TEMP is a VOIDmode constant and the mode of the type of EXP is not
- the same as that of TARGET, adjust the constant. This is needed, for
- example, in case it is a CONST_DOUBLE and we want only a word-sized
- value. */
- if (CONSTANT_P (temp) && GET_MODE (temp) == VOIDmode
- && TREE_CODE (exp) != ERROR_MARK
- && GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
- temp = convert_modes (GET_MODE (target), TYPE_MODE (TREE_TYPE (exp)),
- temp, TREE_UNSIGNED (TREE_TYPE (exp)));
-
- /* If value was not generated in the target, store it there.
- Convert the value to TARGET's type first if nec. */
-
- if (temp != target && TREE_CODE (exp) != ERROR_MARK)
- {
- target = protect_from_queue (target, 1);
- if (GET_MODE (temp) != GET_MODE (target)
- && GET_MODE (temp) != VOIDmode)
- {
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
- if (dont_return_target)
- {
- /* In this case, we will return TEMP,
- so make sure it has the proper mode.
- But don't forget to store the value into TARGET. */
- temp = convert_to_mode (GET_MODE (target), temp, unsignedp);
- emit_move_insn (target, temp);
- }
- else
- convert_move (target, temp, unsignedp);
- }
-
- else if (GET_MODE (temp) == BLKmode && TREE_CODE (exp) == STRING_CST)
- {
- /* Handle copying a string constant into an array.
- The string constant may be shorter than the array.
- So copy just the string's actual length, and clear the rest. */
- rtx size;
- rtx addr;
-
- /* Get the size of the data type of the string,
- which is actually the size of the target. */
- size = expr_size (exp);
- if (GET_CODE (size) == CONST_INT
- && INTVAL (size) < TREE_STRING_LENGTH (exp))
- emit_block_move (target, temp, size,
- TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
- else
- {
- /* Compute the size of the data to copy from the string. */
- tree copy_size
- = size_binop (MIN_EXPR,
- make_tree (sizetype, size),
- convert (sizetype,
- build_int_2 (TREE_STRING_LENGTH (exp), 0)));
- rtx copy_size_rtx = expand_expr (copy_size, NULL_RTX,
- VOIDmode, 0);
- rtx label = 0;
-
- /* Copy that much. */
- emit_block_move (target, temp, copy_size_rtx,
- TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
-
- /* Figure out how much is left in TARGET that we have to clear.
- Do all calculations in ptr_mode. */
-
- addr = XEXP (target, 0);
- addr = convert_modes (ptr_mode, Pmode, addr, 1);
-
- if (GET_CODE (copy_size_rtx) == CONST_INT)
- {
- addr = plus_constant (addr, TREE_STRING_LENGTH (exp));
- size = plus_constant (size, - TREE_STRING_LENGTH (exp));
- }
- else
- {
- addr = force_reg (ptr_mode, addr);
- addr = expand_binop (ptr_mode, add_optab, addr,
- copy_size_rtx, NULL_RTX, 0,
- OPTAB_LIB_WIDEN);
-
- size = expand_binop (ptr_mode, sub_optab, size,
- copy_size_rtx, NULL_RTX, 0,
- OPTAB_LIB_WIDEN);
-
- emit_cmp_insn (size, const0_rtx, LT, NULL_RTX,
- GET_MODE (size), 0, 0);
- label = gen_label_rtx ();
- emit_jump_insn (gen_blt (label));
- }
-
- if (size != const0_rtx)
- {
-#ifdef TARGET_MEM_FUNCTIONS
- emit_library_call (memset_libfunc, 0, VOIDmode, 3,
- addr, ptr_mode,
- const0_rtx, TYPE_MODE (integer_type_node),
- convert_to_mode (TYPE_MODE (sizetype),
- size,
- TREE_UNSIGNED (sizetype)),
- TYPE_MODE (sizetype));
-#else
- emit_library_call (bzero_libfunc, 0, VOIDmode, 2,
- addr, ptr_mode,
- convert_to_mode (TYPE_MODE (integer_type_node),
- size,
- TREE_UNSIGNED (integer_type_node)),
- TYPE_MODE (integer_type_node));
-#endif
- }
-
- if (label)
- emit_label (label);
- }
- }
- /* Handle calls that return values in multiple non-contiguous locations.
- The Irix 6 ABI has examples of this. */
- else if (GET_CODE (target) == PARALLEL)
- emit_group_load (target, temp);
- else if (GET_MODE (temp) == BLKmode)
- emit_block_move (target, temp, expr_size (exp),
- TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
- else
- emit_move_insn (target, temp);
- }
-
- /* If we don't want a value, return NULL_RTX. */
- if (! want_value)
- return NULL_RTX;
-
- /* If we are supposed to return TEMP, do so as long as it isn't a MEM.
- ??? The latter test doesn't seem to make sense. */
- else if (dont_return_target && GET_CODE (temp) != MEM)
- return temp;
-
- /* Return TARGET itself if it is a hard register. */
- else if (want_value && GET_MODE (target) != BLKmode
- && ! (GET_CODE (target) == REG
- && REGNO (target) < FIRST_PSEUDO_REGISTER))
- return copy_to_reg (target);
-
- else
- return target;
-}
-
-/* Return 1 if EXP just contains zeros. */
-
-static int
-is_zeros_p (exp)
- tree exp;
-{
- tree elt;
-
- switch (TREE_CODE (exp))
- {
- case CONVERT_EXPR:
- case NOP_EXPR:
- case NON_LVALUE_EXPR:
- return is_zeros_p (TREE_OPERAND (exp, 0));
-
- case INTEGER_CST:
- return TREE_INT_CST_LOW (exp) == 0 && TREE_INT_CST_HIGH (exp) == 0;
-
- case COMPLEX_CST:
- return
- is_zeros_p (TREE_REALPART (exp)) && is_zeros_p (TREE_IMAGPART (exp));
-
- case REAL_CST:
- return REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconst0);
-
- case CONSTRUCTOR:
- if (TREE_TYPE (exp) && TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
- return CONSTRUCTOR_ELTS (exp) == NULL_TREE;
- for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
- if (! is_zeros_p (TREE_VALUE (elt)))
- return 0;
-
- return 1;
- }
-
- return 0;
-}
-
-/* Return 1 if EXP contains mostly (3/4) zeros. */
-
-static int
-mostly_zeros_p (exp)
- tree exp;
-{
- if (TREE_CODE (exp) == CONSTRUCTOR)
- {
- int elts = 0, zeros = 0;
- tree elt = CONSTRUCTOR_ELTS (exp);
- if (TREE_TYPE (exp) && TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
- {
- /* If there are no ranges of true bits, it is all zero. */
- return elt == NULL_TREE;
- }
- for (; elt; elt = TREE_CHAIN (elt))
- {
- /* We do not handle the case where the index is a RANGE_EXPR,
- so the statistic will be somewhat inaccurate.
- We do make a more accurate count in store_constructor itself,
- so since this function is only used for nested array elements,
- this should be close enough. */
- if (mostly_zeros_p (TREE_VALUE (elt)))
- zeros++;
- elts++;
- }
-
- return 4 * zeros >= 3 * elts;
- }
-
- return is_zeros_p (exp);
-}
-
-/* Helper function for store_constructor.
- TARGET, BITSIZE, BITPOS, MODE, EXP are as for store_field.
- TYPE is the type of the CONSTRUCTOR, not the element type.
- CLEARED is as for store_constructor.
-
- This provides a recursive shortcut back to store_constructor when it isn't
- necessary to go through store_field. This is so that we can pass through
- the cleared field to let store_constructor know that we may not have to
- clear a substructure if the outer structure has already been cleared. */
-
-static void
-store_constructor_field (target, bitsize, bitpos,
- mode, exp, type, cleared)
- rtx target;
- int bitsize, bitpos;
- enum machine_mode mode;
- tree exp, type;
- int cleared;
-{
- if (TREE_CODE (exp) == CONSTRUCTOR
- && bitpos % BITS_PER_UNIT == 0
- /* If we have a non-zero bitpos for a register target, then we just
- let store_field do the bitfield handling. This is unlikely to
- generate unnecessary clear instructions anyways. */
- && (bitpos == 0 || GET_CODE (target) == MEM))
- {
- if (bitpos != 0)
- target = change_address (target, VOIDmode,
- plus_constant (XEXP (target, 0),
- bitpos / BITS_PER_UNIT));
- store_constructor (exp, target, cleared);
- }
- else
- store_field (target, bitsize, bitpos, mode, exp,
- VOIDmode, 0, TYPE_ALIGN (type) / BITS_PER_UNIT,
- int_size_in_bytes (type));
-}
-
-/* Store the value of constructor EXP into the rtx TARGET.
- TARGET is either a REG or a MEM.
- CLEARED is true if TARGET is known to have been zero'd. */
-
-static void
-store_constructor (exp, target, cleared)
- tree exp;
- rtx target;
- int cleared;
-{
- tree type = TREE_TYPE (exp);
-
- /* We know our target cannot conflict, since safe_from_p has been called. */
-#if 0
- /* Don't try copying piece by piece into a hard register
- since that is vulnerable to being clobbered by EXP.
- Instead, construct in a pseudo register and then copy it all. */
- if (GET_CODE (target) == REG && REGNO (target) < FIRST_PSEUDO_REGISTER)
- {
- rtx temp = gen_reg_rtx (GET_MODE (target));
- store_constructor (exp, temp, 0);
- emit_move_insn (target, temp);
- return;
- }
-#endif
-
- if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE
- || TREE_CODE (type) == QUAL_UNION_TYPE)
- {
- register tree elt;
-
- /* Inform later passes that the whole union value is dead. */
- if (TREE_CODE (type) == UNION_TYPE
- || TREE_CODE (type) == QUAL_UNION_TYPE)
- emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
-
- /* If we are building a static constructor into a register,
- set the initial value as zero so we can fold the value into
- a constant. But if more than one register is involved,
- this probably loses. */
- else if (GET_CODE (target) == REG && TREE_STATIC (exp)
- && GET_MODE_SIZE (GET_MODE (target)) <= UNITS_PER_WORD)
- {
- if (! cleared)
- emit_move_insn (target, const0_rtx);
-
- cleared = 1;
- }
-
- /* If the constructor has fewer fields than the structure
- or if we are initializing the structure to mostly zeros,
- clear the whole structure first. */
- else if ((list_length (CONSTRUCTOR_ELTS (exp))
- != list_length (TYPE_FIELDS (type)))
- || mostly_zeros_p (exp))
- {
- if (! cleared)
- clear_storage (target, expr_size (exp),
- TYPE_ALIGN (type) / BITS_PER_UNIT);
-
- cleared = 1;
- }
- else
- /* Inform later passes that the old value is dead. */
- emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
-
- /* Store each element of the constructor into
- the corresponding field of TARGET. */
-
- for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
- {
- register tree field = TREE_PURPOSE (elt);
- register enum machine_mode mode;
- int bitsize;
- int bitpos = 0;
- int unsignedp;
- tree pos, constant = 0, offset = 0;
- rtx to_rtx = target;
-
- /* Just ignore missing fields.
- We cleared the whole structure, above,
- if any fields are missing. */
- if (field == 0)
- continue;
-
- if (cleared && is_zeros_p (TREE_VALUE (elt)))
- continue;
-
- bitsize = TREE_INT_CST_LOW (DECL_SIZE (field));
- unsignedp = TREE_UNSIGNED (field);
- mode = DECL_MODE (field);
- if (DECL_BIT_FIELD (field))
- mode = VOIDmode;
-
- pos = DECL_FIELD_BITPOS (field);
- if (TREE_CODE (pos) == INTEGER_CST)
- constant = pos;
- else if (TREE_CODE (pos) == PLUS_EXPR
- && TREE_CODE (TREE_OPERAND (pos, 1)) == INTEGER_CST)
- constant = TREE_OPERAND (pos, 1), offset = TREE_OPERAND (pos, 0);
- else
- offset = pos;
-
- if (constant)
- bitpos = TREE_INT_CST_LOW (constant);
-
- if (offset)
- {
- rtx offset_rtx;
-
- if (contains_placeholder_p (offset))
- offset = build (WITH_RECORD_EXPR, sizetype,
- offset, exp);
-
- offset = size_binop (FLOOR_DIV_EXPR, offset,
- size_int (BITS_PER_UNIT));
-
- offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
- if (GET_CODE (to_rtx) != MEM)
- abort ();
-
- to_rtx
- = change_address (to_rtx, VOIDmode,
- gen_rtx (PLUS, ptr_mode, XEXP (to_rtx, 0),
- force_reg (ptr_mode, offset_rtx)));
- }
- if (TREE_READONLY (field))
- {
- if (GET_CODE (to_rtx) == MEM)
- to_rtx = change_address (to_rtx, GET_MODE (to_rtx),
- XEXP (to_rtx, 0));
- RTX_UNCHANGING_P (to_rtx) = 1;
- }
-
- store_constructor_field (to_rtx, bitsize, bitpos,
- mode, TREE_VALUE (elt), type, cleared);
- }
- }
- else if (TREE_CODE (type) == ARRAY_TYPE)
- {
- register tree elt;
- register int i;
- int need_to_clear;
- tree domain = TYPE_DOMAIN (type);
- HOST_WIDE_INT minelt = TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain));
- HOST_WIDE_INT maxelt = TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain));
- tree elttype = TREE_TYPE (type);
-
- /* If the constructor has fewer elements than the array,
- clear the whole array first. Similarly if this this is
- static constructor of a non-BLKmode object. */
- if (cleared || (GET_CODE (target) == REG && TREE_STATIC (exp)))
- need_to_clear = 1;
- else
- {
- HOST_WIDE_INT count = 0, zero_count = 0;
- need_to_clear = 0;
- /* This loop is a more accurate version of the loop in
- mostly_zeros_p (it handles RANGE_EXPR in an index).
- It is also needed to check for missing elements. */
- for (elt = CONSTRUCTOR_ELTS (exp);
- elt != NULL_TREE;
- elt = TREE_CHAIN (elt))
- {
- tree index = TREE_PURPOSE (elt);
- HOST_WIDE_INT this_node_count;
- if (index != NULL_TREE && TREE_CODE (index) == RANGE_EXPR)
- {
- tree lo_index = TREE_OPERAND (index, 0);
- tree hi_index = TREE_OPERAND (index, 1);
- if (TREE_CODE (lo_index) != INTEGER_CST
- || TREE_CODE (hi_index) != INTEGER_CST)
- {
- need_to_clear = 1;
- break;
- }
- this_node_count = TREE_INT_CST_LOW (hi_index)
- - TREE_INT_CST_LOW (lo_index) + 1;
- }
- else
- this_node_count = 1;
- count += this_node_count;
- if (mostly_zeros_p (TREE_VALUE (elt)))
- zero_count += this_node_count;
- }
- /* Clear the entire array first if there are any missing elements,
- or if the incidence of zero elements is >= 75%. */
- if (count < maxelt - minelt + 1
- || 4 * zero_count >= 3 * count)
- need_to_clear = 1;
- }
- if (need_to_clear)
- {
- if (! cleared)
- clear_storage (target, expr_size (exp),
- TYPE_ALIGN (type) / BITS_PER_UNIT);
- cleared = 1;
- }
- else
- /* Inform later passes that the old value is dead. */
- emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
-
- /* Store each element of the constructor into
- the corresponding element of TARGET, determined
- by counting the elements. */
- for (elt = CONSTRUCTOR_ELTS (exp), i = 0;
- elt;
- elt = TREE_CHAIN (elt), i++)
- {
- register enum machine_mode mode;
- int bitsize;
- int bitpos;
- int unsignedp;
- tree value = TREE_VALUE (elt);
- tree index = TREE_PURPOSE (elt);
- rtx xtarget = target;
-
- if (cleared && is_zeros_p (value))
- continue;
-
- mode = TYPE_MODE (elttype);
- bitsize = GET_MODE_BITSIZE (mode);
- unsignedp = TREE_UNSIGNED (elttype);
-
- if (index != NULL_TREE && TREE_CODE (index) == RANGE_EXPR)
- {
- tree lo_index = TREE_OPERAND (index, 0);
- tree hi_index = TREE_OPERAND (index, 1);
- rtx index_r, pos_rtx, addr, hi_r, loop_top, loop_end;
- struct nesting *loop;
- HOST_WIDE_INT lo, hi, count;
- tree position;
-
- /* If the range is constant and "small", unroll the loop. */
- if (TREE_CODE (lo_index) == INTEGER_CST
- && TREE_CODE (hi_index) == INTEGER_CST
- && (lo = TREE_INT_CST_LOW (lo_index),
- hi = TREE_INT_CST_LOW (hi_index),
- count = hi - lo + 1,
- (GET_CODE (target) != MEM
- || count <= 2
- || (TREE_CODE (TYPE_SIZE (elttype)) == INTEGER_CST
- && TREE_INT_CST_LOW (TYPE_SIZE (elttype)) * count
- <= 40 * 8))))
- {
- lo -= minelt; hi -= minelt;
- for (; lo <= hi; lo++)
- {
- bitpos = lo * TREE_INT_CST_LOW (TYPE_SIZE (elttype));
- store_constructor_field (target, bitsize, bitpos,
- mode, value, type, cleared);
- }
- }
- else
- {
- hi_r = expand_expr (hi_index, NULL_RTX, VOIDmode, 0);
- loop_top = gen_label_rtx ();
- loop_end = gen_label_rtx ();
-
- unsignedp = TREE_UNSIGNED (domain);
-
- index = build_decl (VAR_DECL, NULL_TREE, domain);
-
- DECL_RTL (index) = index_r
- = gen_reg_rtx (promote_mode (domain, DECL_MODE (index),
- &unsignedp, 0));
-
- if (TREE_CODE (value) == SAVE_EXPR
- && SAVE_EXPR_RTL (value) == 0)
- {
- /* Make sure value gets expanded once before the
- loop. */
- expand_expr (value, const0_rtx, VOIDmode, 0);
- emit_queue ();
- }
- store_expr (lo_index, index_r, 0);
- loop = expand_start_loop (0);
-
- /* Assign value to element index. */
- position = size_binop (EXACT_DIV_EXPR, TYPE_SIZE (elttype),
- size_int (BITS_PER_UNIT));
- position = size_binop (MULT_EXPR,
- size_binop (MINUS_EXPR, index,
- TYPE_MIN_VALUE (domain)),
- position);
- pos_rtx = expand_expr (position, 0, VOIDmode, 0);
- addr = gen_rtx (PLUS, Pmode, XEXP (target, 0), pos_rtx);
- xtarget = change_address (target, mode, addr);
- if (TREE_CODE (value) == CONSTRUCTOR)
- store_constructor (value, xtarget, cleared);
- else
- store_expr (value, xtarget, 0);
-
- expand_exit_loop_if_false (loop,
- build (LT_EXPR, integer_type_node,
- index, hi_index));
-
- expand_increment (build (PREINCREMENT_EXPR,
- TREE_TYPE (index),
- index, integer_one_node), 0, 0);
- expand_end_loop ();
- emit_label (loop_end);
-
- /* Needed by stupid register allocation. to extend the
- lifetime of pseudo-regs used by target past the end
- of the loop. */
- emit_insn (gen_rtx (USE, GET_MODE (target), target));
- }
- }
- else if ((index != 0 && TREE_CODE (index) != INTEGER_CST)
- || TREE_CODE (TYPE_SIZE (elttype)) != INTEGER_CST)
- {
- rtx pos_rtx, addr;
- tree position;
-
- if (index == 0)
- index = size_int (i);
-
- if (minelt)
- index = size_binop (MINUS_EXPR, index,
- TYPE_MIN_VALUE (domain));
- position = size_binop (EXACT_DIV_EXPR, TYPE_SIZE (elttype),
- size_int (BITS_PER_UNIT));
- position = size_binop (MULT_EXPR, index, position);
- pos_rtx = expand_expr (position, 0, VOIDmode, 0);
- addr = gen_rtx (PLUS, Pmode, XEXP (target, 0), pos_rtx);
- xtarget = change_address (target, mode, addr);
- store_expr (value, xtarget, 0);
- }
- else
- {
- if (index != 0)
- bitpos = ((TREE_INT_CST_LOW (index) - minelt)
- * TREE_INT_CST_LOW (TYPE_SIZE (elttype)));
- else
- bitpos = (i * TREE_INT_CST_LOW (TYPE_SIZE (elttype)));
- store_constructor_field (target, bitsize, bitpos,
- mode, value, type, cleared);
- }
- }
- }
- /* set constructor assignments */
- else if (TREE_CODE (type) == SET_TYPE)
- {
- tree elt = CONSTRUCTOR_ELTS (exp);
- rtx xtarget = XEXP (target, 0);
- int set_word_size = TYPE_ALIGN (type);
- int nbytes = int_size_in_bytes (type), nbits;
- tree domain = TYPE_DOMAIN (type);
- tree domain_min, domain_max, bitlength;
-
- /* The default implementation strategy is to extract the constant
- parts of the constructor, use that to initialize the target,
- and then "or" in whatever non-constant ranges we need in addition.
-
- If a large set is all zero or all ones, it is
- probably better to set it using memset (if available) or bzero.
- Also, if a large set has just a single range, it may also be
- better to first clear all the first clear the set (using
- bzero/memset), and set the bits we want. */
-
- /* Check for all zeros. */
- if (elt == NULL_TREE)
- {
- if (!cleared)
- clear_storage (target, expr_size (exp),
- TYPE_ALIGN (type) / BITS_PER_UNIT);
- return;
- }
-
- domain_min = convert (sizetype, TYPE_MIN_VALUE (domain));
- domain_max = convert (sizetype, TYPE_MAX_VALUE (domain));
- bitlength = size_binop (PLUS_EXPR,
- size_binop (MINUS_EXPR, domain_max, domain_min),
- size_one_node);
-
- if (nbytes < 0 || TREE_CODE (bitlength) != INTEGER_CST)
- abort ();
- nbits = TREE_INT_CST_LOW (bitlength);
-
- /* For "small" sets, or "medium-sized" (up to 32 bytes) sets that
- are "complicated" (more than one range), initialize (the
- constant parts) by copying from a constant. */
- if (GET_MODE (target) != BLKmode || nbits <= 2 * BITS_PER_WORD
- || (nbytes <= 32 && TREE_CHAIN (elt) != NULL_TREE))
- {
- int set_word_size = TYPE_ALIGN (TREE_TYPE (exp));
- enum machine_mode mode = mode_for_size (set_word_size, MODE_INT, 1);
- char *bit_buffer = (char *) alloca (nbits);
- HOST_WIDE_INT word = 0;
- int bit_pos = 0;
- int ibit = 0;
- int offset = 0; /* In bytes from beginning of set. */
- elt = get_set_constructor_bits (exp, bit_buffer, nbits);
- for (;;)
- {
- if (bit_buffer[ibit])
- {
- if (BYTES_BIG_ENDIAN)
- word |= (1 << (set_word_size - 1 - bit_pos));
- else
- word |= 1 << bit_pos;
- }
- bit_pos++; ibit++;
- if (bit_pos >= set_word_size || ibit == nbits)
- {
- if (word != 0 || ! cleared)
- {
- rtx datum = GEN_INT (word);
- rtx to_rtx;
- /* The assumption here is that it is safe to use
- XEXP if the set is multi-word, but not if
- it's single-word. */
- if (GET_CODE (target) == MEM)
- {
- to_rtx = plus_constant (XEXP (target, 0), offset);
- to_rtx = change_address (target, mode, to_rtx);
- }
- else if (offset == 0)
- to_rtx = target;
- else
- abort ();
- emit_move_insn (to_rtx, datum);
- }
- if (ibit == nbits)
- break;
- word = 0;
- bit_pos = 0;
- offset += set_word_size / BITS_PER_UNIT;
- }
- }
- }
- else if (!cleared)
- {
- /* Don't bother clearing storage if the set is all ones. */
- if (TREE_CHAIN (elt) != NULL_TREE
- || (TREE_PURPOSE (elt) == NULL_TREE
- ? nbits != 1
- : (TREE_CODE (TREE_VALUE (elt)) != INTEGER_CST
- || TREE_CODE (TREE_PURPOSE (elt)) != INTEGER_CST
- || (TREE_INT_CST_LOW (TREE_VALUE (elt))
- - TREE_INT_CST_LOW (TREE_PURPOSE (elt)) + 1
- != nbits))))
- clear_storage (target, expr_size (exp),
- TYPE_ALIGN (type) / BITS_PER_UNIT);
- }
-
- for (; elt != NULL_TREE; elt = TREE_CHAIN (elt))
- {
- /* start of range of element or NULL */
- tree startbit = TREE_PURPOSE (elt);
- /* end of range of element, or element value */
- tree endbit = TREE_VALUE (elt);
- HOST_WIDE_INT startb, endb;
- rtx bitlength_rtx, startbit_rtx, endbit_rtx, targetx;
-
- bitlength_rtx = expand_expr (bitlength,
- NULL_RTX, MEM, EXPAND_CONST_ADDRESS);
-
- /* handle non-range tuple element like [ expr ] */
- if (startbit == NULL_TREE)
- {
- startbit = save_expr (endbit);
- endbit = startbit;
- }
- startbit = convert (sizetype, startbit);
- endbit = convert (sizetype, endbit);
- if (! integer_zerop (domain_min))
- {
- startbit = size_binop (MINUS_EXPR, startbit, domain_min);
- endbit = size_binop (MINUS_EXPR, endbit, domain_min);
- }
- startbit_rtx = expand_expr (startbit, NULL_RTX, MEM,
- EXPAND_CONST_ADDRESS);
- endbit_rtx = expand_expr (endbit, NULL_RTX, MEM,
- EXPAND_CONST_ADDRESS);
-
- if (REG_P (target))
- {
- targetx = assign_stack_temp (GET_MODE (target),
- GET_MODE_SIZE (GET_MODE (target)),
- 0);
- emit_move_insn (targetx, target);
- }
- else if (GET_CODE (target) == MEM)
- targetx = target;
- else
- abort ();
-
-#ifdef TARGET_MEM_FUNCTIONS
- /* Optimization: If startbit and endbit are
- constants divisible by BITS_PER_UNIT,
- call memset instead. */
- if (TREE_CODE (startbit) == INTEGER_CST
- && TREE_CODE (endbit) == INTEGER_CST
- && (startb = TREE_INT_CST_LOW (startbit)) % BITS_PER_UNIT == 0
- && (endb = TREE_INT_CST_LOW (endbit) + 1) % BITS_PER_UNIT == 0)
- {
- emit_library_call (memset_libfunc, 0,
- VOIDmode, 3,
- plus_constant (XEXP (targetx, 0),
- startb / BITS_PER_UNIT),
- Pmode,
- constm1_rtx, TYPE_MODE (integer_type_node),
- GEN_INT ((endb - startb) / BITS_PER_UNIT),
- TYPE_MODE (sizetype));
- }
- else
-#endif
- {
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__setbits"),
- 0, VOIDmode, 4, XEXP (targetx, 0), Pmode,
- bitlength_rtx, TYPE_MODE (sizetype),
- startbit_rtx, TYPE_MODE (sizetype),
- endbit_rtx, TYPE_MODE (sizetype));
- }
- if (REG_P (target))
- emit_move_insn (target, targetx);
- }
- }
-
- else
- abort ();
-}
-
-/* Store the value of EXP (an expression tree)
- into a subfield of TARGET which has mode MODE and occupies
- BITSIZE bits, starting BITPOS bits from the start of TARGET.
- If MODE is VOIDmode, it means that we are storing into a bit-field.
-
- If VALUE_MODE is VOIDmode, return nothing in particular.
- UNSIGNEDP is not used in this case.
-
- Otherwise, return an rtx for the value stored. This rtx
- has mode VALUE_MODE if that is convenient to do.
- In this case, UNSIGNEDP must be nonzero if the value is an unsigned type.
-
- ALIGN is the alignment that TARGET is known to have, measured in bytes.
- TOTAL_SIZE is the size in bytes of the structure, or -1 if varying. */
-
-static rtx
-store_field (target, bitsize, bitpos, mode, exp, value_mode,
- unsignedp, align, total_size)
- rtx target;
- int bitsize, bitpos;
- enum machine_mode mode;
- tree exp;
- enum machine_mode value_mode;
- int unsignedp;
- int align;
- int total_size;
-{
- HOST_WIDE_INT width_mask = 0;
-
- if (bitsize < HOST_BITS_PER_WIDE_INT)
- width_mask = ((HOST_WIDE_INT) 1 << bitsize) - 1;
-
- /* If we are storing into an unaligned field of an aligned union that is
- in a register, we may have the mode of TARGET being an integer mode but
- MODE == BLKmode. In that case, get an aligned object whose size and
- alignment are the same as TARGET and store TARGET into it (we can avoid
- the store if the field being stored is the entire width of TARGET). Then
- call ourselves recursively to store the field into a BLKmode version of
- that object. Finally, load from the object into TARGET. This is not
- very efficient in general, but should only be slightly more expensive
- than the otherwise-required unaligned accesses. Perhaps this can be
- cleaned up later. */
-
- if (mode == BLKmode
- && (GET_CODE (target) == REG || GET_CODE (target) == SUBREG))
- {
- rtx object = assign_stack_temp (GET_MODE (target),
- GET_MODE_SIZE (GET_MODE (target)), 0);
- rtx blk_object = copy_rtx (object);
-
- MEM_IN_STRUCT_P (object) = 1;
- MEM_IN_STRUCT_P (blk_object) = 1;
- PUT_MODE (blk_object, BLKmode);
-
- if (bitsize != GET_MODE_BITSIZE (GET_MODE (target)))
- emit_move_insn (object, target);
-
- store_field (blk_object, bitsize, bitpos, mode, exp, VOIDmode, 0,
- align, total_size);
-
- /* Even though we aren't returning target, we need to
- give it the updated value. */
- emit_move_insn (target, object);
-
- return blk_object;
- }
-
- /* If the structure is in a register or if the component
- is a bit field, we cannot use addressing to access it.
- Use bit-field techniques or SUBREG to store in it. */
-
- if (mode == VOIDmode
- || (mode != BLKmode && ! direct_store[(int) mode])
- || GET_CODE (target) == REG
- || GET_CODE (target) == SUBREG
- /* If the field isn't aligned enough to store as an ordinary memref,
- store it as a bit field. */
- || (SLOW_UNALIGNED_ACCESS
- && align * BITS_PER_UNIT < GET_MODE_ALIGNMENT (mode))
- || (SLOW_UNALIGNED_ACCESS && bitpos % GET_MODE_ALIGNMENT (mode) != 0))
- {
- rtx temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
-
- /* If BITSIZE is narrower than the size of the type of EXP
- we will be narrowing TEMP. Normally, what's wanted are the
- low-order bits. However, if EXP's type is a record and this is
- big-endian machine, we want the upper BITSIZE bits. */
- if (BYTES_BIG_ENDIAN && GET_MODE_CLASS (GET_MODE (temp)) == MODE_INT
- && bitsize < GET_MODE_BITSIZE (GET_MODE (temp))
- && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
- temp = expand_shift (RSHIFT_EXPR, GET_MODE (temp), temp,
- size_int (GET_MODE_BITSIZE (GET_MODE (temp))
- - bitsize),
- temp, 1);
-
- /* Unless MODE is VOIDmode or BLKmode, convert TEMP to
- MODE. */
- if (mode != VOIDmode && mode != BLKmode
- && mode != TYPE_MODE (TREE_TYPE (exp)))
- temp = convert_modes (mode, TYPE_MODE (TREE_TYPE (exp)), temp, 1);
-
- /* If the modes of TARGET and TEMP are both BLKmode, both
- must be in memory and BITPOS must be aligned on a byte
- boundary. If so, we simply do a block copy. */
- if (GET_MODE (target) == BLKmode && GET_MODE (temp) == BLKmode)
- {
- if (GET_CODE (target) != MEM || GET_CODE (temp) != MEM
- || bitpos % BITS_PER_UNIT != 0)
- abort ();
-
- target = change_address (target, VOIDmode,
- plus_constant (XEXP (target, 0),
- bitpos / BITS_PER_UNIT));
-
- emit_block_move (target, temp,
- GEN_INT ((bitsize + BITS_PER_UNIT - 1)
- / BITS_PER_UNIT),
- 1);
-
- return value_mode == VOIDmode ? const0_rtx : target;
- }
-
- /* Store the value in the bitfield. */
- store_bit_field (target, bitsize, bitpos, mode, temp, align, total_size);
- if (value_mode != VOIDmode)
- {
- /* The caller wants an rtx for the value. */
- /* If possible, avoid refetching from the bitfield itself. */
- if (width_mask != 0
- && ! (GET_CODE (target) == MEM && MEM_VOLATILE_P (target)))
- {
- tree count;
- enum machine_mode tmode;
-
- if (unsignedp)
- return expand_and (temp, GEN_INT (width_mask), NULL_RTX);
- tmode = GET_MODE (temp);
- if (tmode == VOIDmode)
- tmode = value_mode;
- count = build_int_2 (GET_MODE_BITSIZE (tmode) - bitsize, 0);
- temp = expand_shift (LSHIFT_EXPR, tmode, temp, count, 0, 0);
- return expand_shift (RSHIFT_EXPR, tmode, temp, count, 0, 0);
- }
- return extract_bit_field (target, bitsize, bitpos, unsignedp,
- NULL_RTX, value_mode, 0, align,
- total_size);
- }
- return const0_rtx;
- }
- else
- {
- rtx addr = XEXP (target, 0);
- rtx to_rtx;
-
- /* If a value is wanted, it must be the lhs;
- so make the address stable for multiple use. */
-
- if (value_mode != VOIDmode && GET_CODE (addr) != REG
- && ! CONSTANT_ADDRESS_P (addr)
- /* A frame-pointer reference is already stable. */
- && ! (GET_CODE (addr) == PLUS
- && GET_CODE (XEXP (addr, 1)) == CONST_INT
- && (XEXP (addr, 0) == virtual_incoming_args_rtx
- || XEXP (addr, 0) == virtual_stack_vars_rtx)))
- addr = copy_to_reg (addr);
-
- /* Now build a reference to just the desired component. */
-
- to_rtx = change_address (target, mode,
- plus_constant (addr, (bitpos / BITS_PER_UNIT)));
- MEM_IN_STRUCT_P (to_rtx) = 1;
-
- return store_expr (exp, to_rtx, value_mode != VOIDmode);
- }
-}
-
-/* Return true if any object containing the innermost array is an unaligned
- packed structure field. */
-
-static int
-get_inner_unaligned_p (exp)
- tree exp;
-{
- int needed_alignment = TYPE_ALIGN (TREE_TYPE (exp));
-
- while (1)
- {
- if (TREE_CODE (exp) == COMPONENT_REF || TREE_CODE (exp) == BIT_FIELD_REF)
- {
- if (TYPE_ALIGN (TREE_TYPE (TREE_OPERAND (exp, 0)))
- < needed_alignment)
- return 1;
- }
- else if (TREE_CODE (exp) != ARRAY_REF
- && TREE_CODE (exp) != NON_LVALUE_EXPR
- && ! ((TREE_CODE (exp) == NOP_EXPR
- || TREE_CODE (exp) == CONVERT_EXPR)
- && (TYPE_MODE (TREE_TYPE (exp))
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))))
- break;
-
- exp = TREE_OPERAND (exp, 0);
- }
-
- return 0;
-}
-
-/* Given an expression EXP that may be a COMPONENT_REF, a BIT_FIELD_REF,
- or an ARRAY_REF, look for nested COMPONENT_REFs, BIT_FIELD_REFs, or
- ARRAY_REFs and find the ultimate containing object, which we return.
-
- We set *PBITSIZE to the size in bits that we want, *PBITPOS to the
- bit position, and *PUNSIGNEDP to the signedness of the field.
- If the position of the field is variable, we store a tree
- giving the variable offset (in units) in *POFFSET.
- This offset is in addition to the bit position.
- If the position is not variable, we store 0 in *POFFSET.
- We set *PALIGNMENT to the alignment in bytes of the address that will be
- computed. This is the alignment of the thing we return if *POFFSET
- is zero, but can be more less strictly aligned if *POFFSET is nonzero.
-
- If any of the extraction expressions is volatile,
- we store 1 in *PVOLATILEP. Otherwise we don't change that.
-
- If the field is a bit-field, *PMODE is set to VOIDmode. Otherwise, it
- is a mode that can be used to access the field. In that case, *PBITSIZE
- is redundant.
-
- If the field describes a variable-sized object, *PMODE is set to
- VOIDmode and *PBITSIZE is set to -1. An access cannot be made in
- this case, but the address of the object can be found. */
-
-tree
-get_inner_reference (exp, pbitsize, pbitpos, poffset, pmode,
- punsignedp, pvolatilep, palignment)
- tree exp;
- int *pbitsize;
- int *pbitpos;
- tree *poffset;
- enum machine_mode *pmode;
- int *punsignedp;
- int *pvolatilep;
- int *palignment;
-{
- tree orig_exp = exp;
- tree size_tree = 0;
- enum machine_mode mode = VOIDmode;
- tree offset = integer_zero_node;
- int alignment = BIGGEST_ALIGNMENT;
-
- if (TREE_CODE (exp) == COMPONENT_REF)
- {
- size_tree = DECL_SIZE (TREE_OPERAND (exp, 1));
- if (! DECL_BIT_FIELD (TREE_OPERAND (exp, 1)))
- mode = DECL_MODE (TREE_OPERAND (exp, 1));
- *punsignedp = TREE_UNSIGNED (TREE_OPERAND (exp, 1));
- }
- else if (TREE_CODE (exp) == BIT_FIELD_REF)
- {
- size_tree = TREE_OPERAND (exp, 1);
- *punsignedp = TREE_UNSIGNED (exp);
- }
- else
- {
- mode = TYPE_MODE (TREE_TYPE (exp));
- *pbitsize = GET_MODE_BITSIZE (mode);
- *punsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
- }
-
- if (size_tree)
- {
- if (TREE_CODE (size_tree) != INTEGER_CST)
- mode = BLKmode, *pbitsize = -1;
- else
- *pbitsize = TREE_INT_CST_LOW (size_tree);
- }
-
- /* Compute cumulative bit-offset for nested component-refs and array-refs,
- and find the ultimate containing object. */
-
- *pbitpos = 0;
-
- while (1)
- {
- if (TREE_CODE (exp) == COMPONENT_REF || TREE_CODE (exp) == BIT_FIELD_REF)
- {
- tree pos = (TREE_CODE (exp) == COMPONENT_REF
- ? DECL_FIELD_BITPOS (TREE_OPERAND (exp, 1))
- : TREE_OPERAND (exp, 2));
- tree constant = integer_zero_node, var = pos;
-
- /* If this field hasn't been filled in yet, don't go
- past it. This should only happen when folding expressions
- made during type construction. */
- if (pos == 0)
- break;
-
- /* Assume here that the offset is a multiple of a unit.
- If not, there should be an explicitly added constant. */
- if (TREE_CODE (pos) == PLUS_EXPR
- && TREE_CODE (TREE_OPERAND (pos, 1)) == INTEGER_CST)
- constant = TREE_OPERAND (pos, 1), var = TREE_OPERAND (pos, 0);
- else if (TREE_CODE (pos) == INTEGER_CST)
- constant = pos, var = integer_zero_node;
-
- *pbitpos += TREE_INT_CST_LOW (constant);
- offset = size_binop (PLUS_EXPR, offset,
- size_binop (EXACT_DIV_EXPR, var,
- size_int (BITS_PER_UNIT)));
- }
-
- else if (TREE_CODE (exp) == ARRAY_REF)
- {
- /* This code is based on the code in case ARRAY_REF in expand_expr
- below. We assume here that the size of an array element is
- always an integral multiple of BITS_PER_UNIT. */
-
- tree index = TREE_OPERAND (exp, 1);
- tree domain = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (exp, 0)));
- tree low_bound
- = domain ? TYPE_MIN_VALUE (domain) : integer_zero_node;
- tree index_type = TREE_TYPE (index);
-
- if (! integer_zerop (low_bound))
- index = fold (build (MINUS_EXPR, index_type, index, low_bound));
-
- if (TYPE_PRECISION (index_type) != TYPE_PRECISION (sizetype))
- {
- index = convert (type_for_size (TYPE_PRECISION (sizetype), 0),
- index);
- index_type = TREE_TYPE (index);
- }
-
- index = fold (build (MULT_EXPR, index_type, index,
- convert (index_type,
- TYPE_SIZE (TREE_TYPE (exp)))));
-
- if (TREE_CODE (index) == INTEGER_CST
- && TREE_INT_CST_HIGH (index) == 0)
- *pbitpos += TREE_INT_CST_LOW (index);
- else
- offset = size_binop (PLUS_EXPR, offset,
- size_binop (FLOOR_DIV_EXPR, index,
- size_int (BITS_PER_UNIT)));
- }
- else if (TREE_CODE (exp) != NON_LVALUE_EXPR
- && ! ((TREE_CODE (exp) == NOP_EXPR
- || TREE_CODE (exp) == CONVERT_EXPR)
- && ! (TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
- && (TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0)))
- != UNION_TYPE))
- && (TYPE_MODE (TREE_TYPE (exp))
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))))
- break;
-
- /* If any reference in the chain is volatile, the effect is volatile. */
- if (TREE_THIS_VOLATILE (exp))
- *pvolatilep = 1;
-
- /* If the offset is non-constant already, then we can't assume any
- alignment more than the alignment here. */
- if (! integer_zerop (offset))
- alignment = MIN (alignment, TYPE_ALIGN (TREE_TYPE (exp)));
-
- exp = TREE_OPERAND (exp, 0);
- }
-
- if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
- alignment = MIN (alignment, DECL_ALIGN (exp));
- else if (TREE_TYPE (exp) != 0)
- alignment = MIN (alignment, TYPE_ALIGN (TREE_TYPE (exp)));
-
- if (integer_zerop (offset))
- offset = 0;
-
- if (offset != 0 && contains_placeholder_p (offset))
- offset = build (WITH_RECORD_EXPR, sizetype, offset, orig_exp);
-
- *pmode = mode;
- *poffset = offset;
- *palignment = alignment / BITS_PER_UNIT;
- return exp;
-}
-
-/* Given an rtx VALUE that may contain additions and multiplications,
- return an equivalent value that just refers to a register or memory.
- This is done by generating instructions to perform the arithmetic
- and returning a pseudo-register containing the value.
-
- The returned value may be a REG, SUBREG, MEM or constant. */
-
-rtx
-force_operand (value, target)
- rtx value, target;
-{
- register optab binoptab = 0;
- /* Use a temporary to force order of execution of calls to
- `force_operand'. */
- rtx tmp;
- register rtx op2;
- /* Use subtarget as the target for operand 0 of a binary operation. */
- register rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
-
- if (GET_CODE (value) == PLUS)
- binoptab = add_optab;
- else if (GET_CODE (value) == MINUS)
- binoptab = sub_optab;
- else if (GET_CODE (value) == MULT)
- {
- op2 = XEXP (value, 1);
- if (!CONSTANT_P (op2)
- && !(GET_CODE (op2) == REG && op2 != subtarget))
- subtarget = 0;
- tmp = force_operand (XEXP (value, 0), subtarget);
- return expand_mult (GET_MODE (value), tmp,
- force_operand (op2, NULL_RTX),
- target, 0);
- }
-
- if (binoptab)
- {
- op2 = XEXP (value, 1);
- if (!CONSTANT_P (op2)
- && !(GET_CODE (op2) == REG && op2 != subtarget))
- subtarget = 0;
- if (binoptab == sub_optab && GET_CODE (op2) == CONST_INT)
- {
- binoptab = add_optab;
- op2 = negate_rtx (GET_MODE (value), op2);
- }
-
- /* Check for an addition with OP2 a constant integer and our first
- operand a PLUS of a virtual register and something else. In that
- case, we want to emit the sum of the virtual register and the
- constant first and then add the other value. This allows virtual
- register instantiation to simply modify the constant rather than
- creating another one around this addition. */
- if (binoptab == add_optab && GET_CODE (op2) == CONST_INT
- && GET_CODE (XEXP (value, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
- && REGNO (XEXP (XEXP (value, 0), 0)) >= FIRST_VIRTUAL_REGISTER
- && REGNO (XEXP (XEXP (value, 0), 0)) <= LAST_VIRTUAL_REGISTER)
- {
- rtx temp = expand_binop (GET_MODE (value), binoptab,
- XEXP (XEXP (value, 0), 0), op2,
- subtarget, 0, OPTAB_LIB_WIDEN);
- return expand_binop (GET_MODE (value), binoptab, temp,
- force_operand (XEXP (XEXP (value, 0), 1), 0),
- target, 0, OPTAB_LIB_WIDEN);
- }
-
- tmp = force_operand (XEXP (value, 0), subtarget);
- return expand_binop (GET_MODE (value), binoptab, tmp,
- force_operand (op2, NULL_RTX),
- target, 0, OPTAB_LIB_WIDEN);
- /* We give UNSIGNEDP = 0 to expand_binop
- because the only operations we are expanding here are signed ones. */
- }
- return value;
-}
-
-/* Subroutine of expand_expr:
- save the non-copied parts (LIST) of an expr (LHS), and return a list
- which can restore these values to their previous values,
- should something modify their storage. */
-
-static tree
-save_noncopied_parts (lhs, list)
- tree lhs;
- tree list;
-{
- tree tail;
- tree parts = 0;
-
- for (tail = list; tail; tail = TREE_CHAIN (tail))
- if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
- parts = chainon (parts, save_noncopied_parts (lhs, TREE_VALUE (tail)));
- else
- {
- tree part = TREE_VALUE (tail);
- tree part_type = TREE_TYPE (part);
- tree to_be_saved = build (COMPONENT_REF, part_type, lhs, part);
- rtx target = assign_temp (part_type, 0, 1, 1);
- if (! memory_address_p (TYPE_MODE (part_type), XEXP (target, 0)))
- target = change_address (target, TYPE_MODE (part_type), NULL_RTX);
- parts = tree_cons (to_be_saved,
- build (RTL_EXPR, part_type, NULL_TREE,
- (tree) target),
- parts);
- store_expr (TREE_PURPOSE (parts), RTL_EXPR_RTL (TREE_VALUE (parts)), 0);
- }
- return parts;
-}
-
-/* Subroutine of expand_expr:
- record the non-copied parts (LIST) of an expr (LHS), and return a list
- which specifies the initial values of these parts. */
-
-static tree
-init_noncopied_parts (lhs, list)
- tree lhs;
- tree list;
-{
- tree tail;
- tree parts = 0;
-
- for (tail = list; tail; tail = TREE_CHAIN (tail))
- if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
- parts = chainon (parts, init_noncopied_parts (lhs, TREE_VALUE (tail)));
- else
- {
- tree part = TREE_VALUE (tail);
- tree part_type = TREE_TYPE (part);
- tree to_be_initialized = build (COMPONENT_REF, part_type, lhs, part);
- parts = tree_cons (TREE_PURPOSE (tail), to_be_initialized, parts);
- }
- return parts;
-}
-
-/* Subroutine of expand_expr: return nonzero iff there is no way that
- EXP can reference X, which is being modified. */
-
-static int
-safe_from_p (x, exp)
- rtx x;
- tree exp;
-{
- rtx exp_rtl = 0;
- int i, nops;
-
- if (x == 0
- /* If EXP has varying size, we MUST use a target since we currently
- have no way of allocating temporaries of variable size
- (except for arrays that have TYPE_ARRAY_MAX_SIZE set).
- So we assume here that something at a higher level has prevented a
- clash. This is somewhat bogus, but the best we can do. Only
- do this when X is BLKmode. */
- || (TREE_TYPE (exp) != 0 && TYPE_SIZE (TREE_TYPE (exp)) != 0
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST
- && (TREE_CODE (TREE_TYPE (exp)) != ARRAY_TYPE
- || TYPE_ARRAY_MAX_SIZE (TREE_TYPE (exp)) == NULL_TREE
- || TREE_CODE (TYPE_ARRAY_MAX_SIZE (TREE_TYPE (exp)))
- != INTEGER_CST)
- && GET_MODE (x) == BLKmode))
- return 1;
-
- /* If this is a subreg of a hard register, declare it unsafe, otherwise,
- find the underlying pseudo. */
- if (GET_CODE (x) == SUBREG)
- {
- x = SUBREG_REG (x);
- if (GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
- return 0;
- }
-
- /* If X is a location in the outgoing argument area, it is always safe. */
- if (GET_CODE (x) == MEM
- && (XEXP (x, 0) == virtual_outgoing_args_rtx
- || (GET_CODE (XEXP (x, 0)) == PLUS
- && XEXP (XEXP (x, 0), 0) == virtual_outgoing_args_rtx)))
- return 1;
-
- switch (TREE_CODE_CLASS (TREE_CODE (exp)))
- {
- case 'd':
- exp_rtl = DECL_RTL (exp);
- break;
-
- case 'c':
- return 1;
-
- case 'x':
- if (TREE_CODE (exp) == TREE_LIST)
- return ((TREE_VALUE (exp) == 0
- || safe_from_p (x, TREE_VALUE (exp)))
- && (TREE_CHAIN (exp) == 0
- || safe_from_p (x, TREE_CHAIN (exp))));
- else
- return 0;
-
- case '1':
- return safe_from_p (x, TREE_OPERAND (exp, 0));
-
- case '2':
- case '<':
- return (safe_from_p (x, TREE_OPERAND (exp, 0))
- && safe_from_p (x, TREE_OPERAND (exp, 1)));
-
- case 'e':
- case 'r':
- /* Now do code-specific tests. EXP_RTL is set to any rtx we find in
- the expression. If it is set, we conflict iff we are that rtx or
- both are in memory. Otherwise, we check all operands of the
- expression recursively. */
-
- switch (TREE_CODE (exp))
- {
- case ADDR_EXPR:
- return (staticp (TREE_OPERAND (exp, 0))
- || safe_from_p (x, TREE_OPERAND (exp, 0)));
-
- case INDIRECT_REF:
- if (GET_CODE (x) == MEM)
- return 0;
- break;
-
- case CALL_EXPR:
- exp_rtl = CALL_EXPR_RTL (exp);
- if (exp_rtl == 0)
- {
- /* Assume that the call will clobber all hard registers and
- all of memory. */
- if ((GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
- || GET_CODE (x) == MEM)
- return 0;
- }
-
- break;
-
- case RTL_EXPR:
- /* If a sequence exists, we would have to scan every instruction
- in the sequence to see if it was safe. This is probably not
- worthwhile. */
- if (RTL_EXPR_SEQUENCE (exp))
- return 0;
-
- exp_rtl = RTL_EXPR_RTL (exp);
- break;
-
- case WITH_CLEANUP_EXPR:
- exp_rtl = RTL_EXPR_RTL (exp);
- break;
-
- case CLEANUP_POINT_EXPR:
- return safe_from_p (x, TREE_OPERAND (exp, 0));
-
- case SAVE_EXPR:
- exp_rtl = SAVE_EXPR_RTL (exp);
- break;
-
- case BIND_EXPR:
- /* The only operand we look at is operand 1. The rest aren't
- part of the expression. */
- return safe_from_p (x, TREE_OPERAND (exp, 1));
-
- case METHOD_CALL_EXPR:
- /* This takes a rtx argument, but shouldn't appear here. */
- abort ();
- }
-
- /* If we have an rtx, we do not need to scan our operands. */
- if (exp_rtl)
- break;
-
- nops = tree_code_length[(int) TREE_CODE (exp)];
- for (i = 0; i < nops; i++)
- if (TREE_OPERAND (exp, i) != 0
- && ! safe_from_p (x, TREE_OPERAND (exp, i)))
- return 0;
- }
-
- /* If we have an rtl, find any enclosed object. Then see if we conflict
- with it. */
- if (exp_rtl)
- {
- if (GET_CODE (exp_rtl) == SUBREG)
- {
- exp_rtl = SUBREG_REG (exp_rtl);
- if (GET_CODE (exp_rtl) == REG
- && REGNO (exp_rtl) < FIRST_PSEUDO_REGISTER)
- return 0;
- }
-
- /* If the rtl is X, then it is not safe. Otherwise, it is unless both
- are memory and EXP is not readonly. */
- return ! (rtx_equal_p (x, exp_rtl)
- || (GET_CODE (x) == MEM && GET_CODE (exp_rtl) == MEM
- && ! TREE_READONLY (exp)));
- }
-
- /* If we reach here, it is safe. */
- return 1;
-}
-
-/* Subroutine of expand_expr: return nonzero iff EXP is an
- expression whose type is statically determinable. */
-
-static int
-fixed_type_p (exp)
- tree exp;
-{
- if (TREE_CODE (exp) == PARM_DECL
- || TREE_CODE (exp) == VAR_DECL
- || TREE_CODE (exp) == CALL_EXPR || TREE_CODE (exp) == TARGET_EXPR
- || TREE_CODE (exp) == COMPONENT_REF
- || TREE_CODE (exp) == ARRAY_REF)
- return 1;
- return 0;
-}
-
-/* Subroutine of expand_expr: return rtx if EXP is a
- variable or parameter; else return 0. */
-
-static rtx
-var_rtx (exp)
- tree exp;
-{
- STRIP_NOPS (exp);
- switch (TREE_CODE (exp))
- {
- case PARM_DECL:
- case VAR_DECL:
- return DECL_RTL (exp);
- default:
- return 0;
- }
-}
-
-/* expand_expr: generate code for computing expression EXP.
- An rtx for the computed value is returned. The value is never null.
- In the case of a void EXP, const0_rtx is returned.
-
- The value may be stored in TARGET if TARGET is nonzero.
- TARGET is just a suggestion; callers must assume that
- the rtx returned may not be the same as TARGET.
-
- If TARGET is CONST0_RTX, it means that the value will be ignored.
-
- If TMODE is not VOIDmode, it suggests generating the
- result in mode TMODE. But this is done only when convenient.
- Otherwise, TMODE is ignored and the value generated in its natural mode.
- TMODE is just a suggestion; callers must assume that
- the rtx returned may not have mode TMODE.
-
- Note that TARGET may have neither TMODE nor MODE. In that case, it
- probably will not be used.
-
- If MODIFIER is EXPAND_SUM then when EXP is an addition
- we can return an rtx of the form (MULT (REG ...) (CONST_INT ...))
- or a nest of (PLUS ...) and (MINUS ...) where the terms are
- products as above, or REG or MEM, or constant.
- Ordinarily in such cases we would output mul or add instructions
- and then return a pseudo reg containing the sum.
-
- EXPAND_INITIALIZER is much like EXPAND_SUM except that
- it also marks a label as absolutely required (it can't be dead).
- It also makes a ZERO_EXTEND or SIGN_EXTEND instead of emitting extend insns.
- This is used for outputting expressions used in initializers.
-
- EXPAND_CONST_ADDRESS says that it is okay to return a MEM
- with a constant address even if that address is not normally legitimate.
- EXPAND_INITIALIZER and EXPAND_SUM also have this effect. */
-
-rtx
-expand_expr (exp, target, tmode, modifier)
- register tree exp;
- rtx target;
- enum machine_mode tmode;
- enum expand_modifier modifier;
-{
- /* Chain of pending expressions for PLACEHOLDER_EXPR to replace.
- This is static so it will be accessible to our recursive callees. */
- static tree placeholder_list = 0;
- register rtx op0, op1, temp;
- tree type = TREE_TYPE (exp);
- int unsignedp = TREE_UNSIGNED (type);
- register enum machine_mode mode = TYPE_MODE (type);
- register enum tree_code code = TREE_CODE (exp);
- optab this_optab;
- /* Use subtarget as the target for operand 0 of a binary operation. */
- rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
- rtx original_target = target;
- /* Maybe defer this until sure not doing bytecode? */
- int ignore = (target == const0_rtx
- || ((code == NON_LVALUE_EXPR || code == NOP_EXPR
- || code == CONVERT_EXPR || code == REFERENCE_EXPR
- || code == COND_EXPR)
- && TREE_CODE (type) == VOID_TYPE));
- tree context;
-
-
- if (output_bytecode && modifier != EXPAND_INITIALIZER)
- {
- bc_expand_expr (exp);
- return NULL;
- }
-
- /* Don't use hard regs as subtargets, because the combiner
- can only handle pseudo regs. */
- if (subtarget && REGNO (subtarget) < FIRST_PSEUDO_REGISTER)
- subtarget = 0;
- /* Avoid subtargets inside loops,
- since they hide some invariant expressions. */
- if (preserve_subexpressions_p ())
- subtarget = 0;
-
- /* If we are going to ignore this result, we need only do something
- if there is a side-effect somewhere in the expression. If there
- is, short-circuit the most common cases here. Note that we must
- not call expand_expr with anything but const0_rtx in case this
- is an initial expansion of a size that contains a PLACEHOLDER_EXPR. */
-
- if (ignore)
- {
- if (! TREE_SIDE_EFFECTS (exp))
- return const0_rtx;
-
- /* Ensure we reference a volatile object even if value is ignored. */
- if (TREE_THIS_VOLATILE (exp)
- && TREE_CODE (exp) != FUNCTION_DECL
- && mode != VOIDmode && mode != BLKmode)
- {
- temp = expand_expr (exp, NULL_RTX, VOIDmode, modifier);
- if (GET_CODE (temp) == MEM)
- temp = copy_to_reg (temp);
- return const0_rtx;
- }
-
- if (TREE_CODE_CLASS (code) == '1')
- return expand_expr (TREE_OPERAND (exp, 0), const0_rtx,
- VOIDmode, modifier);
- else if (TREE_CODE_CLASS (code) == '2'
- || TREE_CODE_CLASS (code) == '<')
- {
- expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);
- expand_expr (TREE_OPERAND (exp, 1), const0_rtx, VOIDmode, modifier);
- return const0_rtx;
- }
- else if ((code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR)
- && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
- /* If the second operand has no side effects, just evaluate
- the first. */
- return expand_expr (TREE_OPERAND (exp, 0), const0_rtx,
- VOIDmode, modifier);
-
- target = 0;
- }
-
- /* If will do cse, generate all results into pseudo registers
- since 1) that allows cse to find more things
- and 2) otherwise cse could produce an insn the machine
- cannot support. */
-
- if (! cse_not_expected && mode != BLKmode && target
- && (GET_CODE (target) != REG || REGNO (target) < FIRST_PSEUDO_REGISTER))
- target = subtarget;
-
- switch (code)
- {
- case LABEL_DECL:
- {
- tree function = decl_function_context (exp);
- /* Handle using a label in a containing function. */
- if (function != current_function_decl && function != 0)
- {
- struct function *p = find_function_data (function);
- /* Allocate in the memory associated with the function
- that the label is in. */
- push_obstacks (p->function_obstack,
- p->function_maybepermanent_obstack);
-
- p->forced_labels = gen_rtx (EXPR_LIST, VOIDmode,
- label_rtx (exp), p->forced_labels);
- pop_obstacks ();
- }
- else if (modifier == EXPAND_INITIALIZER)
- forced_labels = gen_rtx (EXPR_LIST, VOIDmode,
- label_rtx (exp), forced_labels);
- temp = gen_rtx (MEM, FUNCTION_MODE,
- gen_rtx (LABEL_REF, Pmode, label_rtx (exp)));
- if (function != current_function_decl && function != 0)
- LABEL_REF_NONLOCAL_P (XEXP (temp, 0)) = 1;
- return temp;
- }
-
- case PARM_DECL:
- if (DECL_RTL (exp) == 0)
- {
- error_with_decl (exp, "prior parameter's size depends on `%s'");
- return CONST0_RTX (mode);
- }
-
- /* ... fall through ... */
-
- case VAR_DECL:
- /* If a static var's type was incomplete when the decl was written,
- but the type is complete now, lay out the decl now. */
- if (DECL_SIZE (exp) == 0 && TYPE_SIZE (TREE_TYPE (exp)) != 0
- && (TREE_STATIC (exp) || DECL_EXTERNAL (exp)))
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- layout_decl (exp, 0);
- PUT_MODE (DECL_RTL (exp), DECL_MODE (exp));
- pop_obstacks ();
- }
-
- /* ... fall through ... */
-
- case FUNCTION_DECL:
- case RESULT_DECL:
- if (DECL_RTL (exp) == 0)
- abort ();
-
- /* Ensure variable marked as used even if it doesn't go through
- a parser. If it hasn't be used yet, write out an external
- definition. */
- if (! TREE_USED (exp))
- {
- assemble_external (exp);
- TREE_USED (exp) = 1;
- }
-
- /* Show we haven't gotten RTL for this yet. */
- temp = 0;
-
- /* Handle variables inherited from containing functions. */
- context = decl_function_context (exp);
-
- /* We treat inline_function_decl as an alias for the current function
- because that is the inline function whose vars, types, etc.
- are being merged into the current function.
- See expand_inline_function. */
-
- if (context != 0 && context != current_function_decl
- && context != inline_function_decl
- /* If var is static, we don't need a static chain to access it. */
- && ! (GET_CODE (DECL_RTL (exp)) == MEM
- && CONSTANT_P (XEXP (DECL_RTL (exp), 0))))
- {
- rtx addr;
-
- /* Mark as non-local and addressable. */
- DECL_NONLOCAL (exp) = 1;
- if (DECL_NO_STATIC_CHAIN (current_function_decl))
- abort ();
- mark_addressable (exp);
- if (GET_CODE (DECL_RTL (exp)) != MEM)
- abort ();
- addr = XEXP (DECL_RTL (exp), 0);
- if (GET_CODE (addr) == MEM)
- addr = gen_rtx (MEM, Pmode,
- fix_lexical_addr (XEXP (addr, 0), exp));
- else
- addr = fix_lexical_addr (addr, exp);
- temp = change_address (DECL_RTL (exp), mode, addr);
- }
-
- /* This is the case of an array whose size is to be determined
- from its initializer, while the initializer is still being parsed.
- See expand_decl. */
-
- else if (GET_CODE (DECL_RTL (exp)) == MEM
- && GET_CODE (XEXP (DECL_RTL (exp), 0)) == REG)
- temp = change_address (DECL_RTL (exp), GET_MODE (DECL_RTL (exp)),
- XEXP (DECL_RTL (exp), 0));
-
- /* If DECL_RTL is memory, we are in the normal case and either
- the address is not valid or it is not a register and -fforce-addr
- is specified, get the address into a register. */
-
- else if (GET_CODE (DECL_RTL (exp)) == MEM
- && modifier != EXPAND_CONST_ADDRESS
- && modifier != EXPAND_SUM
- && modifier != EXPAND_INITIALIZER
- && (! memory_address_p (DECL_MODE (exp),
- XEXP (DECL_RTL (exp), 0))
- || (flag_force_addr
- && GET_CODE (XEXP (DECL_RTL (exp), 0)) != REG)))
- temp = change_address (DECL_RTL (exp), VOIDmode,
- copy_rtx (XEXP (DECL_RTL (exp), 0)));
-
- /* If we got something, return it. But first, set the alignment
- the address is a register. */
- if (temp != 0)
- {
- if (GET_CODE (temp) == MEM && GET_CODE (XEXP (temp, 0)) == REG)
- mark_reg_pointer (XEXP (temp, 0),
- DECL_ALIGN (exp) / BITS_PER_UNIT);
-
- return temp;
- }
-
- /* If the mode of DECL_RTL does not match that of the decl, it
- must be a promoted value. We return a SUBREG of the wanted mode,
- but mark it so that we know that it was already extended. */
-
- if (GET_CODE (DECL_RTL (exp)) == REG
- && GET_MODE (DECL_RTL (exp)) != mode)
- {
- /* Get the signedness used for this variable. Ensure we get the
- same mode we got when the variable was declared. */
- if (GET_MODE (DECL_RTL (exp))
- != promote_mode (type, DECL_MODE (exp), &unsignedp, 0))
- abort ();
-
- temp = gen_rtx (SUBREG, mode, DECL_RTL (exp), 0);
- SUBREG_PROMOTED_VAR_P (temp) = 1;
- SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
- return temp;
- }
-
- return DECL_RTL (exp);
-
- case INTEGER_CST:
- return immed_double_const (TREE_INT_CST_LOW (exp),
- TREE_INT_CST_HIGH (exp),
- mode);
-
- case CONST_DECL:
- return expand_expr (DECL_INITIAL (exp), target, VOIDmode, 0);
-
- case REAL_CST:
- /* If optimized, generate immediate CONST_DOUBLE
- which will be turned into memory by reload if necessary.
-
- We used to force a register so that loop.c could see it. But
- this does not allow gen_* patterns to perform optimizations with
- the constants. It also produces two insns in cases like "x = 1.0;".
- On most machines, floating-point constants are not permitted in
- many insns, so we'd end up copying it to a register in any case.
-
- Now, we do the copying in expand_binop, if appropriate. */
- return immed_real_const (exp);
-
- case COMPLEX_CST:
- case STRING_CST:
- if (! TREE_CST_RTL (exp))
- output_constant_def (exp);
-
- /* TREE_CST_RTL probably contains a constant address.
- On RISC machines where a constant address isn't valid,
- make some insns to get that address into a register. */
- if (GET_CODE (TREE_CST_RTL (exp)) == MEM
- && modifier != EXPAND_CONST_ADDRESS
- && modifier != EXPAND_INITIALIZER
- && modifier != EXPAND_SUM
- && (! memory_address_p (mode, XEXP (TREE_CST_RTL (exp), 0))
- || (flag_force_addr
- && GET_CODE (XEXP (TREE_CST_RTL (exp), 0)) != REG)))
- return change_address (TREE_CST_RTL (exp), VOIDmode,
- copy_rtx (XEXP (TREE_CST_RTL (exp), 0)));
- return TREE_CST_RTL (exp);
-
- case SAVE_EXPR:
- context = decl_function_context (exp);
-
- /* We treat inline_function_decl as an alias for the current function
- because that is the inline function whose vars, types, etc.
- are being merged into the current function.
- See expand_inline_function. */
- if (context == current_function_decl || context == inline_function_decl)
- context = 0;
-
- /* If this is non-local, handle it. */
- if (context)
- {
- temp = SAVE_EXPR_RTL (exp);
- if (temp && GET_CODE (temp) == REG)
- {
- put_var_into_stack (exp);
- temp = SAVE_EXPR_RTL (exp);
- }
- if (temp == 0 || GET_CODE (temp) != MEM)
- abort ();
- return change_address (temp, mode,
- fix_lexical_addr (XEXP (temp, 0), exp));
- }
- if (SAVE_EXPR_RTL (exp) == 0)
- {
- if (mode == VOIDmode)
- temp = const0_rtx;
- else
- temp = assign_temp (type, 0, 0, 0);
-
- SAVE_EXPR_RTL (exp) = temp;
- if (!optimize && GET_CODE (temp) == REG)
- save_expr_regs = gen_rtx (EXPR_LIST, VOIDmode, temp,
- save_expr_regs);
-
- /* If the mode of TEMP does not match that of the expression, it
- must be a promoted value. We pass store_expr a SUBREG of the
- wanted mode but mark it so that we know that it was already
- extended. Note that `unsignedp' was modified above in
- this case. */
-
- if (GET_CODE (temp) == REG && GET_MODE (temp) != mode)
- {
- temp = gen_rtx (SUBREG, mode, SAVE_EXPR_RTL (exp), 0);
- SUBREG_PROMOTED_VAR_P (temp) = 1;
- SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
- }
-
- if (temp == const0_rtx)
- expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
- else
- store_expr (TREE_OPERAND (exp, 0), temp, 0);
- }
-
- /* If the mode of SAVE_EXPR_RTL does not match that of the expression, it
- must be a promoted value. We return a SUBREG of the wanted mode,
- but mark it so that we know that it was already extended. */
-
- if (GET_CODE (SAVE_EXPR_RTL (exp)) == REG
- && GET_MODE (SAVE_EXPR_RTL (exp)) != mode)
- {
- /* Compute the signedness and make the proper SUBREG. */
- promote_mode (type, mode, &unsignedp, 0);
- temp = gen_rtx (SUBREG, mode, SAVE_EXPR_RTL (exp), 0);
- SUBREG_PROMOTED_VAR_P (temp) = 1;
- SUBREG_PROMOTED_UNSIGNED_P (temp) = unsignedp;
- return temp;
- }
-
- return SAVE_EXPR_RTL (exp);
-
- case UNSAVE_EXPR:
- {
- rtx temp;
- temp = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
- TREE_OPERAND (exp, 0) = unsave_expr_now (TREE_OPERAND (exp, 0));
- return temp;
- }
-
- case PLACEHOLDER_EXPR:
- /* If there is an object on the head of the placeholder list,
- see if some object in it's references is of type TYPE. For
- further information, see tree.def. */
- if (placeholder_list)
- {
- tree need_type = TYPE_MAIN_VARIANT (type);
- tree object = 0;
- tree old_list = placeholder_list;
- tree elt;
-
- /* See if the object is the type that we want. Then see if
- the operand of any reference is the type we want. */
- if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_PURPOSE (placeholder_list)))
- == need_type))
- object = TREE_PURPOSE (placeholder_list);
-
- /* Find the innermost reference that is of the type we want. */
- for (elt = TREE_PURPOSE (placeholder_list);
- elt != 0
- && (TREE_CODE_CLASS (TREE_CODE (elt)) == 'r'
- || TREE_CODE_CLASS (TREE_CODE (elt)) == '1'
- || TREE_CODE_CLASS (TREE_CODE (elt)) == '2'
- || TREE_CODE_CLASS (TREE_CODE (elt)) == 'e');
- elt = ((TREE_CODE (elt) == COMPOUND_EXPR
- || TREE_CODE (elt) == COND_EXPR)
- ? TREE_OPERAND (elt, 1) : TREE_OPERAND (elt, 0)))
- if (TREE_CODE_CLASS (TREE_CODE (elt)) == 'r'
- && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (elt, 0)))
- == need_type))
- object = TREE_OPERAND (elt, 0);
-
- if (object != 0)
- {
- /* Expand this object skipping the list entries before
- it was found in case it is also a PLACEHOLDER_EXPR.
- In that case, we want to translate it using subsequent
- entries. */
- placeholder_list = TREE_CHAIN (placeholder_list);
- temp = expand_expr (object, original_target, tmode, modifier);
- placeholder_list = old_list;
- return temp;
- }
- }
-
- /* We can't find the object or there was a missing WITH_RECORD_EXPR. */
- abort ();
-
- case WITH_RECORD_EXPR:
- /* Put the object on the placeholder list, expand our first operand,
- and pop the list. */
- placeholder_list = tree_cons (TREE_OPERAND (exp, 1), NULL_TREE,
- placeholder_list);
- target = expand_expr (TREE_OPERAND (exp, 0), original_target,
- tmode, modifier);
- placeholder_list = TREE_CHAIN (placeholder_list);
- return target;
-
- case EXIT_EXPR:
- expand_exit_loop_if_false (NULL_PTR,
- invert_truthvalue (TREE_OPERAND (exp, 0)));
- return const0_rtx;
-
- case LOOP_EXPR:
- push_temp_slots ();
- expand_start_loop (1);
- expand_expr_stmt (TREE_OPERAND (exp, 0));
- expand_end_loop ();
- pop_temp_slots ();
-
- return const0_rtx;
-
- case BIND_EXPR:
- {
- tree vars = TREE_OPERAND (exp, 0);
- int vars_need_expansion = 0;
-
- /* Need to open a binding contour here because
- if there are any cleanups they most be contained here. */
- expand_start_bindings (0);
-
- /* Mark the corresponding BLOCK for output in its proper place. */
- if (TREE_OPERAND (exp, 2) != 0
- && ! TREE_USED (TREE_OPERAND (exp, 2)))
- insert_block (TREE_OPERAND (exp, 2));
-
- /* If VARS have not yet been expanded, expand them now. */
- while (vars)
- {
- if (DECL_RTL (vars) == 0)
- {
- vars_need_expansion = 1;
- expand_decl (vars);
- }
- expand_decl_init (vars);
- vars = TREE_CHAIN (vars);
- }
-
- temp = expand_expr (TREE_OPERAND (exp, 1), target, tmode, modifier);
-
- expand_end_bindings (TREE_OPERAND (exp, 0), 0, 0);
-
- return temp;
- }
-
- case RTL_EXPR:
- if (RTL_EXPR_SEQUENCE (exp) == const0_rtx)
- abort ();
- emit_insns (RTL_EXPR_SEQUENCE (exp));
- RTL_EXPR_SEQUENCE (exp) = const0_rtx;
- preserve_rtl_expr_result (RTL_EXPR_RTL (exp));
- free_temps_for_rtl_expr (exp);
- return RTL_EXPR_RTL (exp);
-
- case CONSTRUCTOR:
- /* If we don't need the result, just ensure we evaluate any
- subexpressions. */
- if (ignore)
- {
- tree elt;
- for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
- expand_expr (TREE_VALUE (elt), const0_rtx, VOIDmode, 0);
- return const0_rtx;
- }
-
- /* All elts simple constants => refer to a constant in memory. But
- if this is a non-BLKmode mode, let it store a field at a time
- since that should make a CONST_INT or CONST_DOUBLE when we
- fold. Likewise, if we have a target we can use, it is best to
- store directly into the target unless the type is large enough
- that memcpy will be used. If we are making an initializer and
- all operands are constant, put it in memory as well. */
- else if ((TREE_STATIC (exp)
- && ((mode == BLKmode
- && ! (target != 0 && safe_from_p (target, exp)))
- || TREE_ADDRESSABLE (exp)
- || (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && (move_by_pieces_ninsns
- (TREE_INT_CST_LOW (TYPE_SIZE (type))/BITS_PER_UNIT,
- TYPE_ALIGN (type) / BITS_PER_UNIT)
- > MOVE_RATIO)
- && ! mostly_zeros_p (exp))))
- || (modifier == EXPAND_INITIALIZER && TREE_CONSTANT (exp)))
- {
- rtx constructor = output_constant_def (exp);
- if (modifier != EXPAND_CONST_ADDRESS
- && modifier != EXPAND_INITIALIZER
- && modifier != EXPAND_SUM
- && (! memory_address_p (GET_MODE (constructor),
- XEXP (constructor, 0))
- || (flag_force_addr
- && GET_CODE (XEXP (constructor, 0)) != REG)))
- constructor = change_address (constructor, VOIDmode,
- XEXP (constructor, 0));
- return constructor;
- }
-
- else
- {
- /* Handle calls that pass values in multiple non-contiguous
- locations. The Irix 6 ABI has examples of this. */
- if (target == 0 || ! safe_from_p (target, exp)
- || GET_CODE (target) == PARALLEL)
- {
- if (mode != BLKmode && ! TREE_ADDRESSABLE (exp))
- target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
- else
- target = assign_temp (type, 0, 1, 1);
- }
-
- if (TREE_READONLY (exp))
- {
- if (GET_CODE (target) == MEM)
- target = change_address (target, GET_MODE (target),
- XEXP (target, 0));
- RTX_UNCHANGING_P (target) = 1;
- }
-
- store_constructor (exp, target, 0);
- return target;
- }
-
- case INDIRECT_REF:
- {
- tree exp1 = TREE_OPERAND (exp, 0);
- tree exp2;
-
- op0 = expand_expr (exp1, NULL_RTX, VOIDmode, EXPAND_SUM);
- op0 = memory_address (mode, op0);
-
- temp = gen_rtx (MEM, mode, op0);
- /* If address was computed by addition,
- mark this as an element of an aggregate. */
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
- || (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR
- && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR)
- || AGGREGATE_TYPE_P (TREE_TYPE (exp))
- || (TREE_CODE (exp1) == ADDR_EXPR
- && (exp2 = TREE_OPERAND (exp1, 0))
- && AGGREGATE_TYPE_P (TREE_TYPE (exp2))))
- MEM_IN_STRUCT_P (temp) = 1;
- MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) | flag_volatile;
-
- /* It is incorrect to set RTX_UNCHANGING_P from TREE_READONLY
- here, because, in C and C++, the fact that a location is accessed
- through a pointer to const does not mean that the value there can
- never change. Languages where it can never change should
- also set TREE_STATIC. */
- RTX_UNCHANGING_P (temp) = TREE_READONLY (exp) & TREE_STATIC (exp);
- return temp;
- }
-
- case ARRAY_REF:
- if (TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) != ARRAY_TYPE)
- abort ();
-
- {
- tree array = TREE_OPERAND (exp, 0);
- tree domain = TYPE_DOMAIN (TREE_TYPE (array));
- tree low_bound = domain ? TYPE_MIN_VALUE (domain) : integer_zero_node;
- tree index = TREE_OPERAND (exp, 1);
- tree index_type = TREE_TYPE (index);
- int i;
-
- if (TREE_CODE (low_bound) != INTEGER_CST
- && contains_placeholder_p (low_bound))
- low_bound = build (WITH_RECORD_EXPR, sizetype, low_bound, exp);
-
- /* Optimize the special-case of a zero lower bound.
-
- We convert the low_bound to sizetype to avoid some problems
- with constant folding. (E.g. suppose the lower bound is 1,
- and its mode is QI. Without the conversion, (ARRAY
- +(INDEX-(unsigned char)1)) becomes ((ARRAY+(-(unsigned char)1))
- +INDEX), which becomes (ARRAY+255+INDEX). Oops!)
-
- But sizetype isn't quite right either (especially if
- the lowbound is negative). FIXME */
-
- if (! integer_zerop (low_bound))
- index = fold (build (MINUS_EXPR, index_type, index,
- convert (sizetype, low_bound)));
-
- if ((TREE_CODE (index) != INTEGER_CST
- || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- && (! SLOW_UNALIGNED_ACCESS || ! get_inner_unaligned_p (exp)))
- {
- /* Nonconstant array index or nonconstant element size, and
- not an array in an unaligned (packed) structure field.
- Generate the tree for *(&array+index) and expand that,
- except do it in a language-independent way
- and don't complain about non-lvalue arrays.
- `mark_addressable' should already have been called
- for any array for which this case will be reached. */
-
- /* Don't forget the const or volatile flag from the array
- element. */
- tree variant_type = build_type_variant (type,
- TREE_READONLY (exp),
- TREE_THIS_VOLATILE (exp));
- tree array_adr = build1 (ADDR_EXPR,
- build_pointer_type (variant_type), array);
- tree elt;
- tree size = size_in_bytes (type);
-
- /* Convert the integer argument to a type the same size as sizetype
- so the multiply won't overflow spuriously. */
- if (TYPE_PRECISION (index_type) != TYPE_PRECISION (sizetype))
- index = convert (type_for_size (TYPE_PRECISION (sizetype), 0),
- index);
-
- if (TREE_CODE (size) != INTEGER_CST
- && contains_placeholder_p (size))
- size = build (WITH_RECORD_EXPR, sizetype, size, exp);
-
- /* Don't think the address has side effects
- just because the array does.
- (In some cases the address might have side effects,
- and we fail to record that fact here. However, it should not
- matter, since expand_expr should not care.) */
- TREE_SIDE_EFFECTS (array_adr) = 0;
-
- elt
- = build1
- (INDIRECT_REF, type,
- fold (build (PLUS_EXPR,
- TYPE_POINTER_TO (variant_type),
- array_adr,
- fold
- (build1
- (NOP_EXPR,
- TYPE_POINTER_TO (variant_type),
- fold (build (MULT_EXPR, TREE_TYPE (index),
- index,
- convert (TREE_TYPE (index),
- size))))))));;
-
- /* Volatility, etc., of new expression is same as old
- expression. */
- TREE_SIDE_EFFECTS (elt) = TREE_SIDE_EFFECTS (exp);
- TREE_THIS_VOLATILE (elt) = TREE_THIS_VOLATILE (exp);
- TREE_READONLY (elt) = TREE_READONLY (exp);
-
- return expand_expr (elt, target, tmode, modifier);
- }
-
- /* Fold an expression like: "foo"[2].
- This is not done in fold so it won't happen inside &.
- Don't fold if this is for wide characters since it's too
- difficult to do correctly and this is a very rare case. */
-
- if (TREE_CODE (array) == STRING_CST
- && TREE_CODE (index) == INTEGER_CST
- && !TREE_INT_CST_HIGH (index)
- && (i = TREE_INT_CST_LOW (index)) < TREE_STRING_LENGTH (array)
- && GET_MODE_CLASS (mode) == MODE_INT
- && GET_MODE_SIZE (mode) == 1)
- return GEN_INT (TREE_STRING_POINTER (array)[i]);
-
- /* If this is a constant index into a constant array,
- just get the value from the array. Handle both the cases when
- we have an explicit constructor and when our operand is a variable
- that was declared const. */
-
- if (TREE_CODE (array) == CONSTRUCTOR && ! TREE_SIDE_EFFECTS (array))
- {
- if (TREE_CODE (index) == INTEGER_CST
- && TREE_INT_CST_HIGH (index) == 0)
- {
- tree elem = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0));
-
- i = TREE_INT_CST_LOW (index);
- while (elem && i--)
- elem = TREE_CHAIN (elem);
- if (elem)
- return expand_expr (fold (TREE_VALUE (elem)), target,
- tmode, modifier);
- }
- }
-
- else if (optimize >= 1
- && TREE_READONLY (array) && ! TREE_SIDE_EFFECTS (array)
- && TREE_CODE (array) == VAR_DECL && DECL_INITIAL (array)
- && TREE_CODE (DECL_INITIAL (array)) != ERROR_MARK)
- {
- if (TREE_CODE (index) == INTEGER_CST
- && TREE_INT_CST_HIGH (index) == 0)
- {
- tree init = DECL_INITIAL (array);
-
- i = TREE_INT_CST_LOW (index);
- if (TREE_CODE (init) == CONSTRUCTOR)
- {
- tree elem = CONSTRUCTOR_ELTS (init);
-
- while (elem
- && !tree_int_cst_equal (TREE_PURPOSE (elem), index))
- elem = TREE_CHAIN (elem);
- if (elem)
- return expand_expr (fold (TREE_VALUE (elem)), target,
- tmode, modifier);
- }
- else if (TREE_CODE (init) == STRING_CST
- && i < TREE_STRING_LENGTH (init))
- return GEN_INT (TREE_STRING_POINTER (init)[i]);
- }
- }
- }
-
- /* Treat array-ref with constant index as a component-ref. */
-
- case COMPONENT_REF:
- case BIT_FIELD_REF:
- /* If the operand is a CONSTRUCTOR, we can just extract the
- appropriate field if it is present. Don't do this if we have
- already written the data since we want to refer to that copy
- and varasm.c assumes that's what we'll do. */
- if (code != ARRAY_REF
- && TREE_CODE (TREE_OPERAND (exp, 0)) == CONSTRUCTOR
- && TREE_CST_RTL (TREE_OPERAND (exp, 0)) == 0)
- {
- tree elt;
-
- for (elt = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0)); elt;
- elt = TREE_CHAIN (elt))
- if (TREE_PURPOSE (elt) == TREE_OPERAND (exp, 1)
- /* We can normally use the value of the field in the
- CONSTRUCTOR. However, if this is a bitfield in
- an integral mode that we can fit in a HOST_WIDE_INT,
- we must mask only the number of bits in the bitfield,
- since this is done implicitly by the constructor. If
- the bitfield does not meet either of those conditions,
- we can't do this optimization. */
- && (! DECL_BIT_FIELD (TREE_PURPOSE (elt))
- || ((GET_MODE_CLASS (DECL_MODE (TREE_PURPOSE (elt)))
- == MODE_INT)
- && (GET_MODE_BITSIZE (DECL_MODE (TREE_PURPOSE (elt)))
- <= HOST_BITS_PER_WIDE_INT))))
- {
- op0 = expand_expr (TREE_VALUE (elt), target, tmode, modifier);
- if (DECL_BIT_FIELD (TREE_PURPOSE (elt)))
- {
- int bitsize = DECL_FIELD_SIZE (TREE_PURPOSE (elt));
- enum machine_mode imode
- = TYPE_MODE (TREE_TYPE (TREE_PURPOSE (elt)));
-
- if (TREE_UNSIGNED (TREE_TYPE (TREE_PURPOSE (elt))))
- {
- op1 = GEN_INT (((HOST_WIDE_INT) 1 << bitsize) - 1);
- op0 = expand_and (op0, op1, target);
- }
- else
- {
- tree count
- = build_int_2 (imode - bitsize, 0);
-
- op0 = expand_shift (LSHIFT_EXPR, imode, op0, count,
- target, 0);
- op0 = expand_shift (RSHIFT_EXPR, imode, op0, count,
- target, 0);
- }
- }
-
- return op0;
- }
- }
-
- {
- enum machine_mode mode1;
- int bitsize;
- int bitpos;
- tree offset;
- int volatilep = 0;
- int alignment;
- tree tem = get_inner_reference (exp, &bitsize, &bitpos, &offset,
- &mode1, &unsignedp, &volatilep,
- &alignment);
-
- /* If we got back the original object, something is wrong. Perhaps
- we are evaluating an expression too early. In any event, don't
- infinitely recurse. */
- if (tem == exp)
- abort ();
-
- /* If TEM's type is a union of variable size, pass TARGET to the inner
- computation, since it will need a temporary and TARGET is known
- to have to do. This occurs in unchecked conversion in Ada. */
-
- op0 = expand_expr (tem,
- (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE
- && (TREE_CODE (TYPE_SIZE (TREE_TYPE (tem)))
- != INTEGER_CST)
- ? target : NULL_RTX),
- VOIDmode,
- modifier == EXPAND_INITIALIZER ? modifier : 0);
-
- /* If this is a constant, put it into a register if it is a
- legitimate constant and memory if it isn't. */
- if (CONSTANT_P (op0))
- {
- enum machine_mode mode = TYPE_MODE (TREE_TYPE (tem));
- if (mode != BLKmode && LEGITIMATE_CONSTANT_P (op0))
- op0 = force_reg (mode, op0);
- else
- op0 = validize_mem (force_const_mem (mode, op0));
- }
-
- if (offset != 0)
- {
- rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, 0);
-
- if (GET_CODE (op0) != MEM)
- abort ();
- op0 = change_address (op0, VOIDmode,
- gen_rtx (PLUS, ptr_mode, XEXP (op0, 0),
- force_reg (ptr_mode, offset_rtx)));
- }
-
- /* Don't forget about volatility even if this is a bitfield. */
- if (GET_CODE (op0) == MEM && volatilep && ! MEM_VOLATILE_P (op0))
- {
- op0 = copy_rtx (op0);
- MEM_VOLATILE_P (op0) = 1;
- }
-
- /* In cases where an aligned union has an unaligned object
- as a field, we might be extracting a BLKmode value from
- an integer-mode (e.g., SImode) object. Handle this case
- by doing the extract into an object as wide as the field
- (which we know to be the width of a basic mode), then
- storing into memory, and changing the mode to BLKmode.
- If we ultimately want the address (EXPAND_CONST_ADDRESS or
- EXPAND_INITIALIZER), then we must not copy to a temporary. */
- if (mode1 == VOIDmode
- || GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG
- || (modifier != EXPAND_CONST_ADDRESS
- && modifier != EXPAND_INITIALIZER
- && ((mode1 != BLKmode && ! direct_load[(int) mode1]
- && GET_MODE_CLASS (mode) != MODE_COMPLEX_INT
- && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)
- /* If the field isn't aligned enough to fetch as a memref,
- fetch it as a bit field. */
- || (SLOW_UNALIGNED_ACCESS
- && ((TYPE_ALIGN (TREE_TYPE (tem)) < GET_MODE_ALIGNMENT (mode))
- || (bitpos % GET_MODE_ALIGNMENT (mode) != 0))))))
- {
- enum machine_mode ext_mode = mode;
-
- if (ext_mode == BLKmode)
- ext_mode = mode_for_size (bitsize, MODE_INT, 1);
-
- if (ext_mode == BLKmode)
- {
- /* In this case, BITPOS must start at a byte boundary and
- TARGET, if specified, must be a MEM. */
- if (GET_CODE (op0) != MEM
- || (target != 0 && GET_CODE (target) != MEM)
- || bitpos % BITS_PER_UNIT != 0)
- abort ();
-
- op0 = change_address (op0, VOIDmode,
- plus_constant (XEXP (op0, 0),
- bitpos / BITS_PER_UNIT));
- if (target == 0)
- target = assign_temp (type, 0, 1, 1);
-
- emit_block_move (target, op0,
- GEN_INT ((bitsize + BITS_PER_UNIT - 1)
- / BITS_PER_UNIT),
- 1);
-
- return target;
- }
-
- op0 = validize_mem (op0);
-
- if (GET_CODE (op0) == MEM && GET_CODE (XEXP (op0, 0)) == REG)
- mark_reg_pointer (XEXP (op0, 0), alignment);
-
- op0 = extract_bit_field (op0, bitsize, bitpos,
- unsignedp, target, ext_mode, ext_mode,
- alignment,
- int_size_in_bytes (TREE_TYPE (tem)));
-
- /* If the result is a record type and BITSIZE is narrower than
- the mode of OP0, an integral mode, and this is a big endian
- machine, we must put the field into the high-order bits. */
- if (TREE_CODE (type) == RECORD_TYPE && BYTES_BIG_ENDIAN
- && GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT
- && bitsize < GET_MODE_BITSIZE (GET_MODE (op0)))
- op0 = expand_shift (LSHIFT_EXPR, GET_MODE (op0), op0,
- size_int (GET_MODE_BITSIZE (GET_MODE (op0))
- - bitsize),
- op0, 1);
-
- if (mode == BLKmode)
- {
- rtx new = assign_stack_temp (ext_mode,
- bitsize / BITS_PER_UNIT, 0);
-
- emit_move_insn (new, op0);
- op0 = copy_rtx (new);
- PUT_MODE (op0, BLKmode);
- MEM_IN_STRUCT_P (op0) = 1;
- }
-
- return op0;
- }
-
- /* If the result is BLKmode, use that to access the object
- now as well. */
- if (mode == BLKmode)
- mode1 = BLKmode;
-
- /* Get a reference to just this component. */
- if (modifier == EXPAND_CONST_ADDRESS
- || modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
- op0 = gen_rtx (MEM, mode1, plus_constant (XEXP (op0, 0),
- (bitpos / BITS_PER_UNIT)));
- else
- op0 = change_address (op0, mode1,
- plus_constant (XEXP (op0, 0),
- (bitpos / BITS_PER_UNIT)));
- if (GET_CODE (XEXP (op0, 0)) == REG)
- mark_reg_pointer (XEXP (op0, 0), alignment);
-
- MEM_IN_STRUCT_P (op0) = 1;
- MEM_VOLATILE_P (op0) |= volatilep;
- if (mode == mode1 || mode1 == BLKmode || mode1 == tmode
- || modifier == EXPAND_CONST_ADDRESS
- || modifier == EXPAND_INITIALIZER)
- return op0;
- else if (target == 0)
- target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
-
- convert_move (target, op0, unsignedp);
- return target;
- }
-
- /* Intended for a reference to a buffer of a file-object in Pascal.
- But it's not certain that a special tree code will really be
- necessary for these. INDIRECT_REF might work for them. */
- case BUFFER_REF:
- abort ();
-
- case IN_EXPR:
- {
- /* Pascal set IN expression.
-
- Algorithm:
- rlo = set_low - (set_low%bits_per_word);
- the_word = set [ (index - rlo)/bits_per_word ];
- bit_index = index % bits_per_word;
- bitmask = 1 << bit_index;
- return !!(the_word & bitmask); */
-
- tree set = TREE_OPERAND (exp, 0);
- tree index = TREE_OPERAND (exp, 1);
- int iunsignedp = TREE_UNSIGNED (TREE_TYPE (index));
- tree set_type = TREE_TYPE (set);
- tree set_low_bound = TYPE_MIN_VALUE (TYPE_DOMAIN (set_type));
- tree set_high_bound = TYPE_MAX_VALUE (TYPE_DOMAIN (set_type));
- rtx index_val = expand_expr (index, 0, VOIDmode, 0);
- rtx lo_r = expand_expr (set_low_bound, 0, VOIDmode, 0);
- rtx hi_r = expand_expr (set_high_bound, 0, VOIDmode, 0);
- rtx setval = expand_expr (set, 0, VOIDmode, 0);
- rtx setaddr = XEXP (setval, 0);
- enum machine_mode index_mode = TYPE_MODE (TREE_TYPE (index));
- rtx rlow;
- rtx diff, quo, rem, addr, bit, result;
-
- preexpand_calls (exp);
-
- /* If domain is empty, answer is no. Likewise if index is constant
- and out of bounds. */
- if ((TREE_CODE (set_high_bound) == INTEGER_CST
- && TREE_CODE (set_low_bound) == INTEGER_CST
- && tree_int_cst_lt (set_high_bound, set_low_bound)
- || (TREE_CODE (index) == INTEGER_CST
- && TREE_CODE (set_low_bound) == INTEGER_CST
- && tree_int_cst_lt (index, set_low_bound))
- || (TREE_CODE (set_high_bound) == INTEGER_CST
- && TREE_CODE (index) == INTEGER_CST
- && tree_int_cst_lt (set_high_bound, index))))
- return const0_rtx;
-
- if (target == 0)
- target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
-
- /* If we get here, we have to generate the code for both cases
- (in range and out of range). */
-
- op0 = gen_label_rtx ();
- op1 = gen_label_rtx ();
-
- if (! (GET_CODE (index_val) == CONST_INT
- && GET_CODE (lo_r) == CONST_INT))
- {
- emit_cmp_insn (index_val, lo_r, LT, NULL_RTX,
- GET_MODE (index_val), iunsignedp, 0);
- emit_jump_insn (gen_blt (op1));
- }
-
- if (! (GET_CODE (index_val) == CONST_INT
- && GET_CODE (hi_r) == CONST_INT))
- {
- emit_cmp_insn (index_val, hi_r, GT, NULL_RTX,
- GET_MODE (index_val), iunsignedp, 0);
- emit_jump_insn (gen_bgt (op1));
- }
-
- /* Calculate the element number of bit zero in the first word
- of the set. */
- if (GET_CODE (lo_r) == CONST_INT)
- rlow = GEN_INT (INTVAL (lo_r)
- & ~ ((HOST_WIDE_INT) 1 << BITS_PER_UNIT));
- else
- rlow = expand_binop (index_mode, and_optab, lo_r,
- GEN_INT (~((HOST_WIDE_INT) 1 << BITS_PER_UNIT)),
- NULL_RTX, iunsignedp, OPTAB_LIB_WIDEN);
-
- diff = expand_binop (index_mode, sub_optab, index_val, rlow,
- NULL_RTX, iunsignedp, OPTAB_LIB_WIDEN);
-
- quo = expand_divmod (0, TRUNC_DIV_EXPR, index_mode, diff,
- GEN_INT (BITS_PER_UNIT), NULL_RTX, iunsignedp);
- rem = expand_divmod (1, TRUNC_MOD_EXPR, index_mode, index_val,
- GEN_INT (BITS_PER_UNIT), NULL_RTX, iunsignedp);
-
- addr = memory_address (byte_mode,
- expand_binop (index_mode, add_optab, diff,
- setaddr, NULL_RTX, iunsignedp,
- OPTAB_LIB_WIDEN));
-
- /* Extract the bit we want to examine */
- bit = expand_shift (RSHIFT_EXPR, byte_mode,
- gen_rtx (MEM, byte_mode, addr),
- make_tree (TREE_TYPE (index), rem),
- NULL_RTX, 1);
- result = expand_binop (byte_mode, and_optab, bit, const1_rtx,
- GET_MODE (target) == byte_mode ? target : 0,
- 1, OPTAB_LIB_WIDEN);
-
- if (result != target)
- convert_move (target, result, 1);
-
- /* Output the code to handle the out-of-range case. */
- emit_jump (op0);
- emit_label (op1);
- emit_move_insn (target, const0_rtx);
- emit_label (op0);
- return target;
- }
-
- case WITH_CLEANUP_EXPR:
- if (RTL_EXPR_RTL (exp) == 0)
- {
- RTL_EXPR_RTL (exp)
- = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
- cleanups_this_call
- = tree_cons (NULL_TREE, TREE_OPERAND (exp, 2), cleanups_this_call);
- /* That's it for this cleanup. */
- TREE_OPERAND (exp, 2) = 0;
- expand_eh_region_start ();
- }
- return RTL_EXPR_RTL (exp);
-
- case CLEANUP_POINT_EXPR:
- {
- extern int temp_slot_level;
- tree old_cleanups = cleanups_this_call;
- int old_temp_level = target_temp_slot_level;
- push_temp_slots ();
- target_temp_slot_level = temp_slot_level;
- op0 = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
- /* If we're going to use this value, load it up now. */
- if (! ignore)
- op0 = force_not_mem (op0);
- expand_cleanups_to (old_cleanups);
- preserve_temp_slots (op0);
- free_temp_slots ();
- pop_temp_slots ();
- target_temp_slot_level = old_temp_level;
- }
- return op0;
-
- case CALL_EXPR:
- /* Check for a built-in function. */
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
- && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
- == FUNCTION_DECL)
- && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
- return expand_builtin (exp, target, subtarget, tmode, ignore);
-
- /* If this call was expanded already by preexpand_calls,
- just return the result we got. */
- if (CALL_EXPR_RTL (exp) != 0)
- return CALL_EXPR_RTL (exp);
-
- return expand_call (exp, target, ignore);
-
- case NON_LVALUE_EXPR:
- case NOP_EXPR:
- case CONVERT_EXPR:
- case REFERENCE_EXPR:
- if (TREE_CODE (type) == UNION_TYPE)
- {
- tree valtype = TREE_TYPE (TREE_OPERAND (exp, 0));
- if (target == 0)
- {
- if (mode != BLKmode)
- target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
- else
- target = assign_temp (type, 0, 1, 1);
- }
-
- if (GET_CODE (target) == MEM)
- /* Store data into beginning of memory target. */
- store_expr (TREE_OPERAND (exp, 0),
- change_address (target, TYPE_MODE (valtype), 0), 0);
-
- else if (GET_CODE (target) == REG)
- /* Store this field into a union of the proper type. */
- store_field (target, GET_MODE_BITSIZE (TYPE_MODE (valtype)), 0,
- TYPE_MODE (valtype), TREE_OPERAND (exp, 0),
- VOIDmode, 0, 1,
- int_size_in_bytes (TREE_TYPE (TREE_OPERAND (exp, 0))));
- else
- abort ();
-
- /* Return the entire union. */
- return target;
- }
-
- if (mode == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
- {
- op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode,
- modifier);
-
- /* If the signedness of the conversion differs and OP0 is
- a promoted SUBREG, clear that indication since we now
- have to do the proper extension. */
- if (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))) != unsignedp
- && GET_CODE (op0) == SUBREG)
- SUBREG_PROMOTED_VAR_P (op0) = 0;
-
- return op0;
- }
-
- op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, 0);
- if (GET_MODE (op0) == mode)
- return op0;
-
- /* If OP0 is a constant, just convert it into the proper mode. */
- if (CONSTANT_P (op0))
- return
- convert_modes (mode, TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
- op0, TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
-
- if (modifier == EXPAND_INITIALIZER)
- return gen_rtx (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, mode, op0);
-
- if (target == 0)
- return
- convert_to_mode (mode, op0,
- TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
- else
- convert_move (target, op0,
- TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
- return target;
-
- case PLUS_EXPR:
- /* We come here from MINUS_EXPR when the second operand is a
- constant. */
- plus_expr:
- this_optab = add_optab;
-
- /* If we are adding a constant, an RTL_EXPR that is sp, fp, or ap, and
- something else, make sure we add the register to the constant and
- then to the other thing. This case can occur during strength
- reduction and doing it this way will produce better code if the
- frame pointer or argument pointer is eliminated.
-
- fold-const.c will ensure that the constant is always in the inner
- PLUS_EXPR, so the only case we need to do anything about is if
- sp, ap, or fp is our second argument, in which case we must swap
- the innermost first argument and our second argument. */
-
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
- && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 1)) == INTEGER_CST
- && TREE_CODE (TREE_OPERAND (exp, 1)) == RTL_EXPR
- && (RTL_EXPR_RTL (TREE_OPERAND (exp, 1)) == frame_pointer_rtx
- || RTL_EXPR_RTL (TREE_OPERAND (exp, 1)) == stack_pointer_rtx
- || RTL_EXPR_RTL (TREE_OPERAND (exp, 1)) == arg_pointer_rtx))
- {
- tree t = TREE_OPERAND (exp, 1);
-
- TREE_OPERAND (exp, 1) = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
- TREE_OPERAND (TREE_OPERAND (exp, 0), 0) = t;
- }
-
- /* If the result is to be ptr_mode and we are adding an integer to
- something, we might be forming a constant. So try to use
- plus_constant. If it produces a sum and we can't accept it,
- use force_operand. This allows P = &ARR[const] to generate
- efficient code on machines where a SYMBOL_REF is not a valid
- address.
-
- If this is an EXPAND_SUM call, always return the sum. */
- if (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER
- || mode == ptr_mode)
- {
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
- && TREE_CONSTANT (TREE_OPERAND (exp, 1)))
- {
- op1 = expand_expr (TREE_OPERAND (exp, 1), subtarget, VOIDmode,
- EXPAND_SUM);
- op1 = plus_constant (op1, TREE_INT_CST_LOW (TREE_OPERAND (exp, 0)));
- if (modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
- op1 = force_operand (op1, target);
- return op1;
- }
-
- else if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_INT
- && TREE_CONSTANT (TREE_OPERAND (exp, 0)))
- {
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode,
- EXPAND_SUM);
- if (! CONSTANT_P (op0))
- {
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX,
- VOIDmode, modifier);
- /* Don't go to both_summands if modifier
- says it's not right to return a PLUS. */
- if (modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
- goto binop2;
- goto both_summands;
- }
- op0 = plus_constant (op0, TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)));
- if (modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
- op0 = force_operand (op0, target);
- return op0;
- }
- }
-
- /* No sense saving up arithmetic to be done
- if it's all in the wrong mode to form part of an address.
- And force_operand won't know whether to sign-extend or
- zero-extend. */
- if ((modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
- || mode != ptr_mode)
- goto binop;
-
- preexpand_calls (exp);
- if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
- subtarget = 0;
-
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, modifier);
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, modifier);
-
- both_summands:
- /* Make sure any term that's a sum with a constant comes last. */
- if (GET_CODE (op0) == PLUS
- && CONSTANT_P (XEXP (op0, 1)))
- {
- temp = op0;
- op0 = op1;
- op1 = temp;
- }
- /* If adding to a sum including a constant,
- associate it to put the constant outside. */
- if (GET_CODE (op1) == PLUS
- && CONSTANT_P (XEXP (op1, 1)))
- {
- rtx constant_term = const0_rtx;
-
- temp = simplify_binary_operation (PLUS, mode, XEXP (op1, 0), op0);
- if (temp != 0)
- op0 = temp;
- /* Ensure that MULT comes first if there is one. */
- else if (GET_CODE (op0) == MULT)
- op0 = gen_rtx (PLUS, mode, op0, XEXP (op1, 0));
- else
- op0 = gen_rtx (PLUS, mode, XEXP (op1, 0), op0);
-
- /* Let's also eliminate constants from op0 if possible. */
- op0 = eliminate_constant_term (op0, &constant_term);
-
- /* CONSTANT_TERM and XEXP (op1, 1) are known to be constant, so
- their sum should be a constant. Form it into OP1, since the
- result we want will then be OP0 + OP1. */
-
- temp = simplify_binary_operation (PLUS, mode, constant_term,
- XEXP (op1, 1));
- if (temp != 0)
- op1 = temp;
- else
- op1 = gen_rtx (PLUS, mode, constant_term, XEXP (op1, 1));
- }
-
- /* Put a constant term last and put a multiplication first. */
- if (CONSTANT_P (op0) || GET_CODE (op1) == MULT)
- temp = op1, op1 = op0, op0 = temp;
-
- temp = simplify_binary_operation (PLUS, mode, op0, op1);
- return temp ? temp : gen_rtx (PLUS, mode, op0, op1);
-
- case MINUS_EXPR:
- /* For initializers, we are allowed to return a MINUS of two
- symbolic constants. Here we handle all cases when both operands
- are constant. */
- /* Handle difference of two symbolic constants,
- for the sake of an initializer. */
- if ((modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
- && really_constant_p (TREE_OPERAND (exp, 0))
- && really_constant_p (TREE_OPERAND (exp, 1)))
- {
- rtx op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX,
- VOIDmode, modifier);
- rtx op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX,
- VOIDmode, modifier);
-
- /* If the last operand is a CONST_INT, use plus_constant of
- the negated constant. Else make the MINUS. */
- if (GET_CODE (op1) == CONST_INT)
- return plus_constant (op0, - INTVAL (op1));
- else
- return gen_rtx (MINUS, mode, op0, op1);
- }
- /* Convert A - const to A + (-const). */
- if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
- {
- tree negated = fold (build1 (NEGATE_EXPR, type,
- TREE_OPERAND (exp, 1)));
-
- /* Deal with the case where we can't negate the constant
- in TYPE. */
- if (TREE_UNSIGNED (type) || TREE_OVERFLOW (negated))
- {
- tree newtype = signed_type (type);
- tree newop0 = convert (newtype, TREE_OPERAND (exp, 0));
- tree newop1 = convert (newtype, TREE_OPERAND (exp, 1));
- tree newneg = fold (build1 (NEGATE_EXPR, newtype, newop1));
-
- if (! TREE_OVERFLOW (newneg))
- return expand_expr (convert (type,
- build (PLUS_EXPR, newtype,
- newop0, newneg)),
- target, tmode, modifier);
- }
- else
- {
- exp = build (PLUS_EXPR, type, TREE_OPERAND (exp, 0), negated);
- goto plus_expr;
- }
- }
- this_optab = sub_optab;
- goto binop;
-
- case MULT_EXPR:
- preexpand_calls (exp);
- /* If first operand is constant, swap them.
- Thus the following special case checks need only
- check the second operand. */
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST)
- {
- register tree t1 = TREE_OPERAND (exp, 0);
- TREE_OPERAND (exp, 0) = TREE_OPERAND (exp, 1);
- TREE_OPERAND (exp, 1) = t1;
- }
-
- /* Attempt to return something suitable for generating an
- indexed address, for machines that support that. */
-
- if (modifier == EXPAND_SUM && mode == ptr_mode
- && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
- {
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
-
- /* Apply distributive law if OP0 is x+c. */
- if (GET_CODE (op0) == PLUS
- && GET_CODE (XEXP (op0, 1)) == CONST_INT)
- return gen_rtx (PLUS, mode,
- gen_rtx (MULT, mode, XEXP (op0, 0),
- GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))),
- GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))
- * INTVAL (XEXP (op0, 1))));
-
- if (GET_CODE (op0) != REG)
- op0 = force_operand (op0, NULL_RTX);
- if (GET_CODE (op0) != REG)
- op0 = copy_to_mode_reg (mode, op0);
-
- return gen_rtx (MULT, mode, op0,
- GEN_INT (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))));
- }
-
- if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
- subtarget = 0;
-
- /* Check for multiplying things that have been extended
- from a narrower type. If this machine supports multiplying
- in that narrower type with a result in the desired type,
- do it that way, and avoid the explicit type-conversion. */
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == NOP_EXPR
- && TREE_CODE (type) == INTEGER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
- < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0))))
- && ((TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
- && int_fits_type_p (TREE_OPERAND (exp, 1),
- TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
- /* Don't use a widening multiply if a shift will do. */
- && ((GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1))))
- > HOST_BITS_PER_WIDE_INT)
- || exact_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))) < 0))
- ||
- (TREE_CODE (TREE_OPERAND (exp, 1)) == NOP_EXPR
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
- ==
- TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))))
- /* If both operands are extended, they must either both
- be zero-extended or both be sign-extended. */
- && (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
- ==
- TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))))))
- {
- enum machine_mode innermode
- = TYPE_MODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)));
- optab other_optab = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
- ? smul_widen_optab : umul_widen_optab);
- this_optab = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
- ? umul_widen_optab : smul_widen_optab);
- if (mode == GET_MODE_WIDER_MODE (innermode))
- {
- if (this_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- op0 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
- NULL_RTX, VOIDmode, 0);
- if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX,
- VOIDmode, 0);
- else
- op1 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 1), 0),
- NULL_RTX, VOIDmode, 0);
- goto binop2;
- }
- else if (other_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing
- && innermode == word_mode)
- {
- rtx htem;
- op0 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
- NULL_RTX, VOIDmode, 0);
- if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX,
- VOIDmode, 0);
- else
- op1 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 1), 0),
- NULL_RTX, VOIDmode, 0);
- temp = expand_binop (mode, other_optab, op0, op1, target,
- unsignedp, OPTAB_LIB_WIDEN);
- htem = expand_mult_highpart_adjust (innermode,
- gen_highpart (innermode, temp),
- op0, op1,
- gen_highpart (innermode, temp),
- unsignedp);
- emit_move_insn (gen_highpart (innermode, temp), htem);
- return temp;
- }
- }
- }
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
- return expand_mult (mode, op0, op1, target, unsignedp);
-
- case TRUNC_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case EXACT_DIV_EXPR:
- preexpand_calls (exp);
- if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
- subtarget = 0;
- /* Possible optimization: compute the dividend with EXPAND_SUM
- then if the divisor is constant can optimize the case
- where some terms of the dividend have coeffs divisible by it. */
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
- return expand_divmod (0, code, mode, op0, op1, target, unsignedp);
-
- case RDIV_EXPR:
- this_optab = flodiv_optab;
- goto binop;
-
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case CEIL_MOD_EXPR:
- case ROUND_MOD_EXPR:
- preexpand_calls (exp);
- if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
- subtarget = 0;
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
- return expand_divmod (1, code, mode, op0, op1, target, unsignedp);
-
- case FIX_ROUND_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_CEIL_EXPR:
- abort (); /* Not used for C. */
-
- case FIX_TRUNC_EXPR:
- op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
- if (target == 0)
- target = gen_reg_rtx (mode);
- expand_fix (target, op0, unsignedp);
- return target;
-
- case FLOAT_EXPR:
- op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
- if (target == 0)
- target = gen_reg_rtx (mode);
- /* expand_float can't figure out what to do if FROM has VOIDmode.
- So give it the correct mode. With -O, cse will optimize this. */
- if (GET_MODE (op0) == VOIDmode)
- op0 = copy_to_mode_reg (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
- op0);
- expand_float (target, op0,
- TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
- return target;
-
- case NEGATE_EXPR:
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
- temp = expand_unop (mode, neg_optab, op0, target, 0);
- if (temp == 0)
- abort ();
- return temp;
-
- case ABS_EXPR:
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
-
- /* Handle complex values specially. */
- if (GET_MODE_CLASS (mode) == MODE_COMPLEX_INT
- || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
- return expand_complex_abs (mode, op0, target, unsignedp);
-
- /* Unsigned abs is simply the operand. Testing here means we don't
- risk generating incorrect code below. */
- if (TREE_UNSIGNED (type))
- return op0;
-
- return expand_abs (mode, op0, target, unsignedp,
- safe_from_p (target, TREE_OPERAND (exp, 0)));
-
- case MAX_EXPR:
- case MIN_EXPR:
- target = original_target;
- if (target == 0 || ! safe_from_p (target, TREE_OPERAND (exp, 1))
- || (GET_CODE (target) == MEM && MEM_VOLATILE_P (target))
- || GET_MODE (target) != mode
- || (GET_CODE (target) == REG
- && REGNO (target) < FIRST_PSEUDO_REGISTER))
- target = gen_reg_rtx (mode);
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
- op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
-
- /* First try to do it with a special MIN or MAX instruction.
- If that does not win, use a conditional jump to select the proper
- value. */
- this_optab = (TREE_UNSIGNED (type)
- ? (code == MIN_EXPR ? umin_optab : umax_optab)
- : (code == MIN_EXPR ? smin_optab : smax_optab));
-
- temp = expand_binop (mode, this_optab, op0, op1, target, unsignedp,
- OPTAB_WIDEN);
- if (temp != 0)
- return temp;
-
- /* At this point, a MEM target is no longer useful; we will get better
- code without it. */
-
- if (GET_CODE (target) == MEM)
- target = gen_reg_rtx (mode);
-
- if (target != op0)
- emit_move_insn (target, op0);
-
- op0 = gen_label_rtx ();
-
- /* If this mode is an integer too wide to compare properly,
- compare word by word. Rely on cse to optimize constant cases. */
- if (GET_MODE_CLASS (mode) == MODE_INT && !can_compare_p (mode))
- {
- if (code == MAX_EXPR)
- do_jump_by_parts_greater_rtx (mode, TREE_UNSIGNED (type),
- target, op1, NULL_RTX, op0);
- else
- do_jump_by_parts_greater_rtx (mode, TREE_UNSIGNED (type),
- op1, target, NULL_RTX, op0);
- emit_move_insn (target, op1);
- }
- else
- {
- if (code == MAX_EXPR)
- temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
- ? compare_from_rtx (target, op1, GEU, 1, mode, NULL_RTX, 0)
- : compare_from_rtx (target, op1, GE, 0, mode, NULL_RTX, 0));
- else
- temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
- ? compare_from_rtx (target, op1, LEU, 1, mode, NULL_RTX, 0)
- : compare_from_rtx (target, op1, LE, 0, mode, NULL_RTX, 0));
- if (temp == const0_rtx)
- emit_move_insn (target, op1);
- else if (temp != const_true_rtx)
- {
- if (bcc_gen_fctn[(int) GET_CODE (temp)] != 0)
- emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (temp)]) (op0));
- else
- abort ();
- emit_move_insn (target, op1);
- }
- }
- emit_label (op0);
- return target;
-
- case BIT_NOT_EXPR:
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
- temp = expand_unop (mode, one_cmpl_optab, op0, target, 1);
- if (temp == 0)
- abort ();
- return temp;
-
- case FFS_EXPR:
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
- temp = expand_unop (mode, ffs_optab, op0, target, 1);
- if (temp == 0)
- abort ();
- return temp;
-
- /* ??? Can optimize bitwise operations with one arg constant.
- Can optimize (a bitwise1 n) bitwise2 (a bitwise3 b)
- and (a bitwise1 b) bitwise2 b (etc)
- but that is probably not worth while. */
-
- /* BIT_AND_EXPR is for bitwise anding. TRUTH_AND_EXPR is for anding two
- boolean values when we want in all cases to compute both of them. In
- general it is fastest to do TRUTH_AND_EXPR by computing both operands
- as actual zero-or-1 values and then bitwise anding. In cases where
- there cannot be any side effects, better code would be made by
- treating TRUTH_AND_EXPR like TRUTH_ANDIF_EXPR; but the question is
- how to recognize those cases. */
-
- case TRUTH_AND_EXPR:
- case BIT_AND_EXPR:
- this_optab = and_optab;
- goto binop;
-
- case TRUTH_OR_EXPR:
- case BIT_IOR_EXPR:
- this_optab = ior_optab;
- goto binop;
-
- case TRUTH_XOR_EXPR:
- case BIT_XOR_EXPR:
- this_optab = xor_optab;
- goto binop;
-
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case LROTATE_EXPR:
- case RROTATE_EXPR:
- preexpand_calls (exp);
- if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
- subtarget = 0;
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
- return expand_shift (code, mode, op0, TREE_OPERAND (exp, 1), target,
- unsignedp);
-
- /* Could determine the answer when only additive constants differ. Also,
- the addition of one can be handled by changing the condition. */
- case LT_EXPR:
- case LE_EXPR:
- case GT_EXPR:
- case GE_EXPR:
- case EQ_EXPR:
- case NE_EXPR:
- preexpand_calls (exp);
- temp = do_store_flag (exp, target, tmode != VOIDmode ? tmode : mode, 0);
- if (temp != 0)
- return temp;
-
- /* For foo != 0, load foo, and if it is nonzero load 1 instead. */
- if (code == NE_EXPR && integer_zerop (TREE_OPERAND (exp, 1))
- && original_target
- && GET_CODE (original_target) == REG
- && (GET_MODE (original_target)
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
- {
- temp = expand_expr (TREE_OPERAND (exp, 0), original_target,
- VOIDmode, 0);
-
- if (temp != original_target)
- temp = copy_to_reg (temp);
-
- op1 = gen_label_rtx ();
- emit_cmp_insn (temp, const0_rtx, EQ, NULL_RTX,
- GET_MODE (temp), unsignedp, 0);
- emit_jump_insn (gen_beq (op1));
- emit_move_insn (temp, const1_rtx);
- emit_label (op1);
- return temp;
- }
-
- /* If no set-flag instruction, must generate a conditional
- store into a temporary variable. Drop through
- and handle this like && and ||. */
-
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- if (! ignore
- && (target == 0 || ! safe_from_p (target, exp)
- /* Make sure we don't have a hard reg (such as function's return
- value) live across basic blocks, if not optimizing. */
- || (!optimize && GET_CODE (target) == REG
- && REGNO (target) < FIRST_PSEUDO_REGISTER)))
- target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
-
- if (target)
- emit_clr_insn (target);
-
- op1 = gen_label_rtx ();
- jumpifnot (exp, op1);
-
- if (target)
- emit_0_to_1_insn (target);
-
- emit_label (op1);
- return ignore ? const0_rtx : target;
-
- case TRUTH_NOT_EXPR:
- op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
- /* The parser is careful to generate TRUTH_NOT_EXPR
- only with operands that are always zero or one. */
- temp = expand_binop (mode, xor_optab, op0, const1_rtx,
- target, 1, OPTAB_LIB_WIDEN);
- if (temp == 0)
- abort ();
- return temp;
-
- case COMPOUND_EXPR:
- expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
- emit_queue ();
- return expand_expr (TREE_OPERAND (exp, 1),
- (ignore ? const0_rtx : target),
- VOIDmode, 0);
-
- case COND_EXPR:
- /* If we would have a "singleton" (see below) were it not for a
- conversion in each arm, bring that conversion back out. */
- if (TREE_CODE (TREE_OPERAND (exp, 1)) == NOP_EXPR
- && TREE_CODE (TREE_OPERAND (exp, 2)) == NOP_EXPR
- && (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0))
- == TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 2), 0))))
- {
- tree true = TREE_OPERAND (TREE_OPERAND (exp, 1), 0);
- tree false = TREE_OPERAND (TREE_OPERAND (exp, 2), 0);
-
- if ((TREE_CODE_CLASS (TREE_CODE (true)) == '2'
- && operand_equal_p (false, TREE_OPERAND (true, 0), 0))
- || (TREE_CODE_CLASS (TREE_CODE (false)) == '2'
- && operand_equal_p (true, TREE_OPERAND (false, 0), 0))
- || (TREE_CODE_CLASS (TREE_CODE (true)) == '1'
- && operand_equal_p (false, TREE_OPERAND (true, 0), 0))
- || (TREE_CODE_CLASS (TREE_CODE (false)) == '1'
- && operand_equal_p (true, TREE_OPERAND (false, 0), 0)))
- return expand_expr (build1 (NOP_EXPR, type,
- build (COND_EXPR, TREE_TYPE (true),
- TREE_OPERAND (exp, 0),
- true, false)),
- target, tmode, modifier);
- }
-
- {
- rtx flag = NULL_RTX;
- tree left_cleanups = NULL_TREE;
- tree right_cleanups = NULL_TREE;
-
- /* Used to save a pointer to the place to put the setting of
- the flag that indicates if this side of the conditional was
- taken. We backpatch the code, if we find out later that we
- have any conditional cleanups that need to be performed. */
- rtx dest_right_flag = NULL_RTX;
- rtx dest_left_flag = NULL_RTX;
-
- /* Note that COND_EXPRs whose type is a structure or union
- are required to be constructed to contain assignments of
- a temporary variable, so that we can evaluate them here
- for side effect only. If type is void, we must do likewise. */
-
- /* If an arm of the branch requires a cleanup,
- only that cleanup is performed. */
-
- tree singleton = 0;
- tree binary_op = 0, unary_op = 0;
- tree old_cleanups = cleanups_this_call;
-
- /* If this is (A ? 1 : 0) and A is a condition, just evaluate it and
- convert it to our mode, if necessary. */
- if (integer_onep (TREE_OPERAND (exp, 1))
- && integer_zerop (TREE_OPERAND (exp, 2))
- && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<')
- {
- if (ignore)
- {
- expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
- modifier);
- return const0_rtx;
- }
-
- op0 = expand_expr (TREE_OPERAND (exp, 0), target, mode, modifier);
- if (GET_MODE (op0) == mode)
- return op0;
-
- if (target == 0)
- target = gen_reg_rtx (mode);
- convert_move (target, op0, unsignedp);
- return target;
- }
-
- /* Check for X ? A + B : A. If we have this, we can copy A to the
- output and conditionally add B. Similarly for unary operations.
- Don't do this if X has side-effects because those side effects
- might affect A or B and the "?" operation is a sequence point in
- ANSI. (operand_equal_p tests for side effects.) */
-
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 1))) == '2'
- && operand_equal_p (TREE_OPERAND (exp, 2),
- TREE_OPERAND (TREE_OPERAND (exp, 1), 0), 0))
- singleton = TREE_OPERAND (exp, 2), binary_op = TREE_OPERAND (exp, 1);
- else if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 2))) == '2'
- && operand_equal_p (TREE_OPERAND (exp, 1),
- TREE_OPERAND (TREE_OPERAND (exp, 2), 0), 0))
- singleton = TREE_OPERAND (exp, 1), binary_op = TREE_OPERAND (exp, 2);
- else if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 1))) == '1'
- && operand_equal_p (TREE_OPERAND (exp, 2),
- TREE_OPERAND (TREE_OPERAND (exp, 1), 0), 0))
- singleton = TREE_OPERAND (exp, 2), unary_op = TREE_OPERAND (exp, 1);
- else if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 2))) == '1'
- && operand_equal_p (TREE_OPERAND (exp, 1),
- TREE_OPERAND (TREE_OPERAND (exp, 2), 0), 0))
- singleton = TREE_OPERAND (exp, 1), unary_op = TREE_OPERAND (exp, 2);
-
- /* If we are not to produce a result, we have no target. Otherwise,
- if a target was specified use it; it will not be used as an
- intermediate target unless it is safe. If no target, use a
- temporary. */
-
- if (ignore)
- temp = 0;
- else if (original_target
- && (safe_from_p (original_target, TREE_OPERAND (exp, 0))
- || (singleton && GET_CODE (original_target) == REG
- && REGNO (original_target) >= FIRST_PSEUDO_REGISTER
- && original_target == var_rtx (singleton)))
- && GET_MODE (original_target) == mode
- && ! (GET_CODE (original_target) == MEM
- && MEM_VOLATILE_P (original_target)))
- temp = original_target;
- else if (TREE_ADDRESSABLE (type))
- abort ();
- else
- temp = assign_temp (type, 0, 0, 1);
-
- /* If we had X ? A + C : A, with C a constant power of 2, and we can
- do the test of X as a store-flag operation, do this as
- A + ((X != 0) << log C). Similarly for other simple binary
- operators. Only do for C == 1 if BRANCH_COST is low. */
- if (temp && singleton && binary_op
- && (TREE_CODE (binary_op) == PLUS_EXPR
- || TREE_CODE (binary_op) == MINUS_EXPR
- || TREE_CODE (binary_op) == BIT_IOR_EXPR
- || TREE_CODE (binary_op) == BIT_XOR_EXPR)
- && (BRANCH_COST >= 3 ? integer_pow2p (TREE_OPERAND (binary_op, 1))
- : integer_onep (TREE_OPERAND (binary_op, 1)))
- && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<')
- {
- rtx result;
- optab boptab = (TREE_CODE (binary_op) == PLUS_EXPR ? add_optab
- : TREE_CODE (binary_op) == MINUS_EXPR ? sub_optab
- : TREE_CODE (binary_op) == BIT_IOR_EXPR ? ior_optab
- : xor_optab);
-
- /* If we had X ? A : A + 1, do this as A + (X == 0).
-
- We have to invert the truth value here and then put it
- back later if do_store_flag fails. We cannot simply copy
- TREE_OPERAND (exp, 0) to another variable and modify that
- because invert_truthvalue can modify the tree pointed to
- by its argument. */
- if (singleton == TREE_OPERAND (exp, 1))
- TREE_OPERAND (exp, 0)
- = invert_truthvalue (TREE_OPERAND (exp, 0));
-
- result = do_store_flag (TREE_OPERAND (exp, 0),
- (safe_from_p (temp, singleton)
- ? temp : NULL_RTX),
- mode, BRANCH_COST <= 1);
-
- if (result != 0 && ! integer_onep (TREE_OPERAND (binary_op, 1)))
- result = expand_shift (LSHIFT_EXPR, mode, result,
- build_int_2 (tree_log2
- (TREE_OPERAND
- (binary_op, 1)),
- 0),
- (safe_from_p (temp, singleton)
- ? temp : NULL_RTX), 0);
-
- if (result)
- {
- op1 = expand_expr (singleton, NULL_RTX, VOIDmode, 0);
- return expand_binop (mode, boptab, op1, result, temp,
- unsignedp, OPTAB_LIB_WIDEN);
- }
- else if (singleton == TREE_OPERAND (exp, 1))
- TREE_OPERAND (exp, 0)
- = invert_truthvalue (TREE_OPERAND (exp, 0));
- }
-
- do_pending_stack_adjust ();
- NO_DEFER_POP;
- op0 = gen_label_rtx ();
-
- flag = gen_reg_rtx (word_mode);
- if (singleton && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0)))
- {
- if (temp != 0)
- {
- /* If the target conflicts with the other operand of the
- binary op, we can't use it. Also, we can't use the target
- if it is a hard register, because evaluating the condition
- might clobber it. */
- if ((binary_op
- && ! safe_from_p (temp, TREE_OPERAND (binary_op, 1)))
- || (GET_CODE (temp) == REG
- && REGNO (temp) < FIRST_PSEUDO_REGISTER))
- temp = gen_reg_rtx (mode);
- store_expr (singleton, temp, 0);
- }
- else
- expand_expr (singleton,
- ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
- dest_left_flag = get_last_insn ();
- if (singleton == TREE_OPERAND (exp, 1))
- jumpif (TREE_OPERAND (exp, 0), op0);
- else
- jumpifnot (TREE_OPERAND (exp, 0), op0);
-
- /* Allows cleanups up to here. */
- old_cleanups = cleanups_this_call;
- if (binary_op && temp == 0)
- /* Just touch the other operand. */
- expand_expr (TREE_OPERAND (binary_op, 1),
- ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
- else if (binary_op)
- store_expr (build (TREE_CODE (binary_op), type,
- make_tree (type, temp),
- TREE_OPERAND (binary_op, 1)),
- temp, 0);
- else
- store_expr (build1 (TREE_CODE (unary_op), type,
- make_tree (type, temp)),
- temp, 0);
- op1 = op0;
- dest_right_flag = get_last_insn ();
- }
-#if 0
- /* This is now done in jump.c and is better done there because it
- produces shorter register lifetimes. */
-
- /* Check for both possibilities either constants or variables
- in registers (but not the same as the target!). If so, can
- save branches by assigning one, branching, and assigning the
- other. */
- else if (temp && GET_MODE (temp) != BLKmode
- && (TREE_CONSTANT (TREE_OPERAND (exp, 1))
- || ((TREE_CODE (TREE_OPERAND (exp, 1)) == PARM_DECL
- || TREE_CODE (TREE_OPERAND (exp, 1)) == VAR_DECL)
- && DECL_RTL (TREE_OPERAND (exp, 1))
- && GET_CODE (DECL_RTL (TREE_OPERAND (exp, 1))) == REG
- && DECL_RTL (TREE_OPERAND (exp, 1)) != temp))
- && (TREE_CONSTANT (TREE_OPERAND (exp, 2))
- || ((TREE_CODE (TREE_OPERAND (exp, 2)) == PARM_DECL
- || TREE_CODE (TREE_OPERAND (exp, 2)) == VAR_DECL)
- && DECL_RTL (TREE_OPERAND (exp, 2))
- && GET_CODE (DECL_RTL (TREE_OPERAND (exp, 2))) == REG
- && DECL_RTL (TREE_OPERAND (exp, 2)) != temp)))
- {
- if (GET_CODE (temp) == REG && REGNO (temp) < FIRST_PSEUDO_REGISTER)
- temp = gen_reg_rtx (mode);
- store_expr (TREE_OPERAND (exp, 2), temp, 0);
- dest_left_flag = get_last_insn ();
- jumpifnot (TREE_OPERAND (exp, 0), op0);
-
- /* Allows cleanups up to here. */
- old_cleanups = cleanups_this_call;
- store_expr (TREE_OPERAND (exp, 1), temp, 0);
- op1 = op0;
- dest_right_flag = get_last_insn ();
- }
-#endif
- /* Check for A op 0 ? A : FOO and A op 0 ? FOO : A where OP is any
- comparison operator. If we have one of these cases, set the
- output to A, branch on A (cse will merge these two references),
- then set the output to FOO. */
- else if (temp
- && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<'
- && integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 1))
- && operand_equal_p (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
- TREE_OPERAND (exp, 1), 0)
- && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
- && safe_from_p (temp, TREE_OPERAND (exp, 2)))
- {
- if (GET_CODE (temp) == REG && REGNO (temp) < FIRST_PSEUDO_REGISTER)
- temp = gen_reg_rtx (mode);
- store_expr (TREE_OPERAND (exp, 1), temp, 0);
- dest_left_flag = get_last_insn ();
- jumpif (TREE_OPERAND (exp, 0), op0);
-
- /* Allows cleanups up to here. */
- old_cleanups = cleanups_this_call;
- store_expr (TREE_OPERAND (exp, 2), temp, 0);
- op1 = op0;
- dest_right_flag = get_last_insn ();
- }
- else if (temp
- && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<'
- && integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 1))
- && operand_equal_p (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
- TREE_OPERAND (exp, 2), 0)
- && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 0))
- && safe_from_p (temp, TREE_OPERAND (exp, 1)))
- {
- if (GET_CODE (temp) == REG && REGNO (temp) < FIRST_PSEUDO_REGISTER)
- temp = gen_reg_rtx (mode);
- store_expr (TREE_OPERAND (exp, 2), temp, 0);
- dest_left_flag = get_last_insn ();
- jumpifnot (TREE_OPERAND (exp, 0), op0);
-
- /* Allows cleanups up to here. */
- old_cleanups = cleanups_this_call;
- store_expr (TREE_OPERAND (exp, 1), temp, 0);
- op1 = op0;
- dest_right_flag = get_last_insn ();
- }
- else
- {
- op1 = gen_label_rtx ();
- jumpifnot (TREE_OPERAND (exp, 0), op0);
-
- /* Allows cleanups up to here. */
- old_cleanups = cleanups_this_call;
- if (temp != 0)
- store_expr (TREE_OPERAND (exp, 1), temp, 0);
- else
- expand_expr (TREE_OPERAND (exp, 1),
- ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
- dest_left_flag = get_last_insn ();
-
- /* Handle conditional cleanups, if any. */
- left_cleanups = defer_cleanups_to (old_cleanups);
-
- emit_queue ();
- emit_jump_insn (gen_jump (op1));
- emit_barrier ();
- emit_label (op0);
- if (temp != 0)
- store_expr (TREE_OPERAND (exp, 2), temp, 0);
- else
- expand_expr (TREE_OPERAND (exp, 2),
- ignore ? const0_rtx : NULL_RTX, VOIDmode, 0);
- dest_right_flag = get_last_insn ();
- }
-
- /* Handle conditional cleanups, if any. */
- right_cleanups = defer_cleanups_to (old_cleanups);
-
- emit_queue ();
- emit_label (op1);
- OK_DEFER_POP;
-
- /* Add back in, any conditional cleanups. */
- if (left_cleanups || right_cleanups)
- {
- tree new_cleanups;
- tree cond;
- rtx last;
-
- /* Now that we know that a flag is needed, go back and add in the
- setting of the flag. */
-
- /* Do the left side flag. */
- last = get_last_insn ();
- /* Flag left cleanups as needed. */
- emit_move_insn (flag, const1_rtx);
- /* ??? deprecated, use sequences instead. */
- reorder_insns (NEXT_INSN (last), get_last_insn (), dest_left_flag);
-
- /* Do the right side flag. */
- last = get_last_insn ();
- /* Flag left cleanups as needed. */
- emit_move_insn (flag, const0_rtx);
- /* ??? deprecated, use sequences instead. */
- reorder_insns (NEXT_INSN (last), get_last_insn (), dest_right_flag);
-
- /* All cleanups must be on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
-
- /* convert flag, which is an rtx, into a tree. */
- cond = make_node (RTL_EXPR);
- TREE_TYPE (cond) = integer_type_node;
- RTL_EXPR_RTL (cond) = flag;
- RTL_EXPR_SEQUENCE (cond) = NULL_RTX;
- cond = save_expr (cond);
-
- if (! left_cleanups)
- left_cleanups = integer_zero_node;
- if (! right_cleanups)
- right_cleanups = integer_zero_node;
- new_cleanups = build (COND_EXPR, void_type_node,
- truthvalue_conversion (cond),
- left_cleanups, right_cleanups);
- new_cleanups = fold (new_cleanups);
-
- pop_obstacks ();
-
- /* Now add in the conditionalized cleanups. */
- cleanups_this_call
- = tree_cons (NULL_TREE, new_cleanups, cleanups_this_call);
- expand_eh_region_start ();
- }
- return temp;
- }
-
- case TARGET_EXPR:
- {
- /* Something needs to be initialized, but we didn't know
- where that thing was when building the tree. For example,
- it could be the return value of a function, or a parameter
- to a function which lays down in the stack, or a temporary
- variable which must be passed by reference.
-
- We guarantee that the expression will either be constructed
- or copied into our original target. */
-
- tree slot = TREE_OPERAND (exp, 0);
- tree cleanups = NULL_TREE;
- tree exp1;
- rtx temp;
-
- if (TREE_CODE (slot) != VAR_DECL)
- abort ();
-
- if (! ignore)
- target = original_target;
-
- if (target == 0)
- {
- if (DECL_RTL (slot) != 0)
- {
- target = DECL_RTL (slot);
- /* If we have already expanded the slot, so don't do
- it again. (mrs) */
- if (TREE_OPERAND (exp, 1) == NULL_TREE)
- return target;
- }
- else
- {
- target = assign_temp (type, 2, 1, 1);
- /* All temp slots at this level must not conflict. */
- preserve_temp_slots (target);
- DECL_RTL (slot) = target;
-
- /* Since SLOT is not known to the called function
- to belong to its stack frame, we must build an explicit
- cleanup. This case occurs when we must build up a reference
- to pass the reference as an argument. In this case,
- it is very likely that such a reference need not be
- built here. */
-
- if (TREE_OPERAND (exp, 2) == 0)
- TREE_OPERAND (exp, 2) = maybe_build_cleanup (slot);
- cleanups = TREE_OPERAND (exp, 2);
- }
- }
- else
- {
- /* This case does occur, when expanding a parameter which
- needs to be constructed on the stack. The target
- is the actual stack address that we want to initialize.
- The function we call will perform the cleanup in this case. */
-
- /* If we have already assigned it space, use that space,
- not target that we were passed in, as our target
- parameter is only a hint. */
- if (DECL_RTL (slot) != 0)
- {
- target = DECL_RTL (slot);
- /* If we have already expanded the slot, so don't do
- it again. (mrs) */
- if (TREE_OPERAND (exp, 1) == NULL_TREE)
- return target;
- }
-
- DECL_RTL (slot) = target;
- }
-
- exp1 = TREE_OPERAND (exp, 3) = TREE_OPERAND (exp, 1);
- /* Mark it as expanded. */
- TREE_OPERAND (exp, 1) = NULL_TREE;
-
- store_expr (exp1, target, 0);
-
- if (cleanups)
- {
- cleanups_this_call = tree_cons (NULL_TREE,
- cleanups,
- cleanups_this_call);
- expand_eh_region_start ();
- }
-
- return target;
- }
-
- case INIT_EXPR:
- {
- tree lhs = TREE_OPERAND (exp, 0);
- tree rhs = TREE_OPERAND (exp, 1);
- tree noncopied_parts = 0;
- tree lhs_type = TREE_TYPE (lhs);
-
- temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
- if (TYPE_NONCOPIED_PARTS (lhs_type) != 0 && !fixed_type_p (rhs))
- noncopied_parts = init_noncopied_parts (stabilize_reference (lhs),
- TYPE_NONCOPIED_PARTS (lhs_type));
- while (noncopied_parts != 0)
- {
- expand_assignment (TREE_VALUE (noncopied_parts),
- TREE_PURPOSE (noncopied_parts), 0, 0);
- noncopied_parts = TREE_CHAIN (noncopied_parts);
- }
- return temp;
- }
-
- case MODIFY_EXPR:
- {
- /* If lhs is complex, expand calls in rhs before computing it.
- That's so we don't compute a pointer and save it over a call.
- If lhs is simple, compute it first so we can give it as a
- target if the rhs is just a call. This avoids an extra temp and copy
- and that prevents a partial-subsumption which makes bad code.
- Actually we could treat component_ref's of vars like vars. */
-
- tree lhs = TREE_OPERAND (exp, 0);
- tree rhs = TREE_OPERAND (exp, 1);
- tree noncopied_parts = 0;
- tree lhs_type = TREE_TYPE (lhs);
-
- temp = 0;
-
- if (TREE_CODE (lhs) != VAR_DECL
- && TREE_CODE (lhs) != RESULT_DECL
- && TREE_CODE (lhs) != PARM_DECL)
- preexpand_calls (exp);
-
- /* Check for |= or &= of a bitfield of size one into another bitfield
- of size 1. In this case, (unless we need the result of the
- assignment) we can do this more efficiently with a
- test followed by an assignment, if necessary.
-
- ??? At this point, we can't get a BIT_FIELD_REF here. But if
- things change so we do, this code should be enhanced to
- support it. */
- if (ignore
- && TREE_CODE (lhs) == COMPONENT_REF
- && (TREE_CODE (rhs) == BIT_IOR_EXPR
- || TREE_CODE (rhs) == BIT_AND_EXPR)
- && TREE_OPERAND (rhs, 0) == lhs
- && TREE_CODE (TREE_OPERAND (rhs, 1)) == COMPONENT_REF
- && TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (lhs, 1))) == 1
- && TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (TREE_OPERAND (rhs, 1), 1))) == 1)
- {
- rtx label = gen_label_rtx ();
-
- do_jump (TREE_OPERAND (rhs, 1),
- TREE_CODE (rhs) == BIT_IOR_EXPR ? label : 0,
- TREE_CODE (rhs) == BIT_AND_EXPR ? label : 0);
- expand_assignment (lhs, convert (TREE_TYPE (rhs),
- (TREE_CODE (rhs) == BIT_IOR_EXPR
- ? integer_one_node
- : integer_zero_node)),
- 0, 0);
- do_pending_stack_adjust ();
- emit_label (label);
- return const0_rtx;
- }
-
- if (TYPE_NONCOPIED_PARTS (lhs_type) != 0
- && ! (fixed_type_p (lhs) && fixed_type_p (rhs)))
- noncopied_parts = save_noncopied_parts (stabilize_reference (lhs),
- TYPE_NONCOPIED_PARTS (lhs_type));
-
- temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
- while (noncopied_parts != 0)
- {
- expand_assignment (TREE_PURPOSE (noncopied_parts),
- TREE_VALUE (noncopied_parts), 0, 0);
- noncopied_parts = TREE_CHAIN (noncopied_parts);
- }
- return temp;
- }
-
- case PREINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- return expand_increment (exp, 0, ignore);
-
- case POSTINCREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- /* Faster to treat as pre-increment if result is not used. */
- return expand_increment (exp, ! ignore, ignore);
-
- case ADDR_EXPR:
- /* If nonzero, TEMP will be set to the address of something that might
- be a MEM corresponding to a stack slot. */
- temp = 0;
-
- /* Are we taking the address of a nested function? */
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == FUNCTION_DECL
- && decl_function_context (TREE_OPERAND (exp, 0)) != 0
- && ! DECL_NO_STATIC_CHAIN (TREE_OPERAND (exp, 0)))
- {
- op0 = trampoline_address (TREE_OPERAND (exp, 0));
- op0 = force_operand (op0, target);
- }
- /* If we are taking the address of something erroneous, just
- return a zero. */
- else if (TREE_CODE (TREE_OPERAND (exp, 0)) == ERROR_MARK)
- return const0_rtx;
- else
- {
- /* We make sure to pass const0_rtx down if we came in with
- ignore set, to avoid doing the cleanups twice for something. */
- op0 = expand_expr (TREE_OPERAND (exp, 0),
- ignore ? const0_rtx : NULL_RTX, VOIDmode,
- (modifier == EXPAND_INITIALIZER
- ? modifier : EXPAND_CONST_ADDRESS));
-
- /* If we are going to ignore the result, OP0 will have been set
- to const0_rtx, so just return it. Don't get confused and
- think we are taking the address of the constant. */
- if (ignore)
- return op0;
-
- op0 = protect_from_queue (op0, 0);
-
- /* We would like the object in memory. If it is a constant,
- we can have it be statically allocated into memory. For
- a non-constant (REG, SUBREG or CONCAT), we need to allocate some
- memory and store the value into it. */
-
- if (CONSTANT_P (op0))
- op0 = force_const_mem (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
- op0);
- else if (GET_CODE (op0) == MEM)
- {
- mark_temp_addr_taken (op0);
- temp = XEXP (op0, 0);
- }
-
- else if (GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG
- || GET_CODE (op0) == CONCAT)
- {
- /* If this object is in a register, it must be not
- be BLKmode. */
- tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
- rtx memloc = assign_temp (inner_type, 1, 1, 1);
-
- mark_temp_addr_taken (memloc);
- emit_move_insn (memloc, op0);
- op0 = memloc;
- }
-
- if (GET_CODE (op0) != MEM)
- abort ();
-
- if (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
- {
- temp = XEXP (op0, 0);
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (temp) == Pmode && GET_MODE (temp) != mode
- && mode == ptr_mode)
- temp = convert_memory_address (ptr_mode, temp);
-#endif
- return temp;
- }
-
- op0 = force_operand (XEXP (op0, 0), target);
- }
-
- if (flag_force_addr && GET_CODE (op0) != REG)
- op0 = force_reg (Pmode, op0);
-
- if (GET_CODE (op0) == REG
- && ! REG_USERVAR_P (op0))
- mark_reg_pointer (op0, TYPE_ALIGN (TREE_TYPE (type)) / BITS_PER_UNIT);
-
- /* If we might have had a temp slot, add an equivalent address
- for it. */
- if (temp != 0)
- update_temp_slot_address (temp, op0);
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (op0) == Pmode && GET_MODE (op0) != mode
- && mode == ptr_mode)
- op0 = convert_memory_address (ptr_mode, op0);
-#endif
-
- return op0;
-
- case ENTRY_VALUE_EXPR:
- abort ();
-
- /* COMPLEX type for Extended Pascal & Fortran */
- case COMPLEX_EXPR:
- {
- enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp)));
- rtx insns;
-
- /* Get the rtx code of the operands. */
- op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
- op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
-
- if (! target)
- target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
-
- start_sequence ();
-
- /* Move the real (op0) and imaginary (op1) parts to their location. */
- emit_move_insn (gen_realpart (mode, target), op0);
- emit_move_insn (gen_imagpart (mode, target), op1);
-
- insns = get_insns ();
- end_sequence ();
-
- /* Complex construction should appear as a single unit. */
- /* If TARGET is a CONCAT, we got insns like RD = RS, ID = IS,
- each with a separate pseudo as destination.
- It's not correct for flow to treat them as a unit. */
- if (GET_CODE (target) != CONCAT)
- emit_no_conflict_block (insns, target, op0, op1, NULL_RTX);
- else
- emit_insns (insns);
-
- return target;
- }
-
- case REALPART_EXPR:
- op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
- return gen_realpart (mode, op0);
-
- case IMAGPART_EXPR:
- op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
- return gen_imagpart (mode, op0);
-
- case CONJ_EXPR:
- {
- enum machine_mode partmode = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp)));
- rtx imag_t;
- rtx insns;
-
- op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
-
- if (! target)
- target = gen_reg_rtx (mode);
-
- start_sequence ();
-
- /* Store the realpart and the negated imagpart to target. */
- emit_move_insn (gen_realpart (partmode, target),
- gen_realpart (partmode, op0));
-
- imag_t = gen_imagpart (partmode, target);
- temp = expand_unop (partmode, neg_optab,
- gen_imagpart (partmode, op0), imag_t, 0);
- if (temp != imag_t)
- emit_move_insn (imag_t, temp);
-
- insns = get_insns ();
- end_sequence ();
-
- /* Conjugate should appear as a single unit
- If TARGET is a CONCAT, we got insns like RD = RS, ID = - IS,
- each with a separate pseudo as destination.
- It's not correct for flow to treat them as a unit. */
- if (GET_CODE (target) != CONCAT)
- emit_no_conflict_block (insns, target, op0, NULL_RTX, NULL_RTX);
- else
- emit_insns (insns);
-
- return target;
- }
-
- case ERROR_MARK:
- op0 = CONST0_RTX (tmode);
- if (op0 != 0)
- return op0;
- return const0_rtx;
-
- default:
- return (*lang_expand_expr) (exp, original_target, tmode, modifier);
- }
-
- /* Here to do an ordinary binary operator, generating an instruction
- from the optab already placed in `this_optab'. */
- binop:
- preexpand_calls (exp);
- if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1)))
- subtarget = 0;
- op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
- binop2:
- temp = expand_binop (mode, this_optab, op0, op1, target,
- unsignedp, OPTAB_LIB_WIDEN);
- if (temp == 0)
- abort ();
- return temp;
-}
-
-
-/* Emit bytecode to evaluate the given expression EXP to the stack. */
-
-void
-bc_expand_expr (exp)
- tree exp;
-{
- enum tree_code code;
- tree type, arg0;
- rtx r;
- struct binary_operator *binoptab;
- struct unary_operator *unoptab;
- struct increment_operator *incroptab;
- struct bc_label *lab, *lab1;
- enum bytecode_opcode opcode;
-
-
- code = TREE_CODE (exp);
-
- switch (code)
- {
- case PARM_DECL:
-
- if (DECL_RTL (exp) == 0)
- {
- error_with_decl (exp, "prior parameter's size depends on `%s'");
- return;
- }
-
- bc_load_parmaddr (DECL_RTL (exp));
- bc_load_memory (TREE_TYPE (exp), exp);
-
- return;
-
- case VAR_DECL:
-
- if (DECL_RTL (exp) == 0)
- abort ();
-
-#if 0
- if (BYTECODE_LABEL (DECL_RTL (exp)))
- bc_load_externaddr (DECL_RTL (exp));
- else
- bc_load_localaddr (DECL_RTL (exp));
-#endif
- if (TREE_PUBLIC (exp))
- bc_load_externaddr_id (DECL_ASSEMBLER_NAME (exp),
- BYTECODE_BC_LABEL (DECL_RTL (exp))->offset);
- else
- bc_load_localaddr (DECL_RTL (exp));
-
- bc_load_memory (TREE_TYPE (exp), exp);
- return;
-
- case INTEGER_CST:
-
-#ifdef DEBUG_PRINT_CODE
- fprintf (stderr, " [%x]\n", TREE_INT_CST_LOW (exp));
-#endif
- bc_emit_instruction (mode_to_const_map[(int) (DECL_BIT_FIELD (exp)
- ? SImode
- : TYPE_MODE (TREE_TYPE (exp)))],
- (HOST_WIDE_INT) TREE_INT_CST_LOW (exp));
- return;
-
- case REAL_CST:
-
-#if 0
-#ifdef DEBUG_PRINT_CODE
- fprintf (stderr, " [%g]\n", (double) TREE_INT_CST_LOW (exp));
-#endif
- /* FIX THIS: find a better way to pass real_cst's. -bson */
- bc_emit_instruction (mode_to_const_map[TYPE_MODE (TREE_TYPE (exp))],
- (double) TREE_REAL_CST (exp));
-#else
- abort ();
-#endif
-
- return;
-
- case CALL_EXPR:
-
- /* We build a call description vector describing the type of
- the return value and of the arguments; this call vector,
- together with a pointer to a location for the return value
- and the base of the argument list, is passed to the low
- level machine dependent call subroutine, which is responsible
- for putting the arguments wherever real functions expect
- them, as well as getting the return value back. */
- {
- tree calldesc = 0, arg;
- int nargs = 0, i;
- rtx retval;
-
- /* Push the evaluated args on the evaluation stack in reverse
- order. Also make an entry for each arg in the calldesc
- vector while we're at it. */
-
- TREE_OPERAND (exp, 1) = nreverse (TREE_OPERAND (exp, 1));
-
- for (arg = TREE_OPERAND (exp, 1); arg; arg = TREE_CHAIN (arg))
- {
- ++nargs;
- bc_expand_expr (TREE_VALUE (arg));
-
- calldesc = tree_cons ((tree) 0,
- size_in_bytes (TREE_TYPE (TREE_VALUE (arg))),
- calldesc);
- calldesc = tree_cons ((tree) 0,
- bc_runtime_type_code (TREE_TYPE (TREE_VALUE (arg))),
- calldesc);
- }
-
- TREE_OPERAND (exp, 1) = nreverse (TREE_OPERAND (exp, 1));
-
- /* Allocate a location for the return value and push its
- address on the evaluation stack. Also make an entry
- at the front of the calldesc for the return value type. */
-
- type = TREE_TYPE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))));
- retval = bc_allocate_local (int_size_in_bytes (type), TYPE_ALIGN (type));
- bc_load_localaddr (retval);
-
- calldesc = tree_cons ((tree) 0, size_in_bytes (type), calldesc);
- calldesc = tree_cons ((tree) 0, bc_runtime_type_code (type), calldesc);
-
- /* Prepend the argument count. */
- calldesc = tree_cons ((tree) 0,
- build_int_2 (nargs, 0),
- calldesc);
-
- /* Push the address of the call description vector on the stack. */
- calldesc = build_nt (CONSTRUCTOR, (tree) 0, calldesc);
- TREE_TYPE (calldesc) = build_array_type (integer_type_node,
- build_index_type (build_int_2 (nargs * 2, 0)));
- r = output_constant_def (calldesc);
- bc_load_externaddr (r);
-
- /* Push the address of the function to be called. */
- bc_expand_expr (TREE_OPERAND (exp, 0));
-
- /* Call the function, popping its address and the calldesc vector
- address off the evaluation stack in the process. */
- bc_emit_instruction (call);
-
- /* Pop the arguments off the stack. */
- bc_adjust_stack (nargs);
-
- /* Load the return value onto the stack. */
- bc_load_localaddr (retval);
- bc_load_memory (type, TREE_OPERAND (exp, 0));
- }
- return;
-
- case SAVE_EXPR:
-
- if (!SAVE_EXPR_RTL (exp))
- {
- /* First time around: copy to local variable */
- SAVE_EXPR_RTL (exp) = bc_allocate_local (int_size_in_bytes (TREE_TYPE (exp)),
- TYPE_ALIGN (TREE_TYPE(exp)));
- bc_expand_expr (TREE_OPERAND (exp, 0));
- bc_emit_instruction (duplicate);
-
- bc_load_localaddr (SAVE_EXPR_RTL (exp));
- bc_store_memory (TREE_TYPE (exp), TREE_OPERAND (exp, 0));
- }
- else
- {
- /* Consecutive reference: use saved copy */
- bc_load_localaddr (SAVE_EXPR_RTL (exp));
- bc_load_memory (TREE_TYPE (exp), TREE_OPERAND (exp, 0));
- }
- return;
-
-#if 0
- /* FIXME: the XXXX_STMT codes have been removed in GCC2, but
- how are they handled instead? */
- case LET_STMT:
-
- TREE_USED (exp) = 1;
- bc_expand_expr (STMT_BODY (exp));
- return;
-#endif
-
- case NOP_EXPR:
- case CONVERT_EXPR:
-
- bc_expand_expr (TREE_OPERAND (exp, 0));
- bc_expand_conversion (TREE_TYPE (TREE_OPERAND (exp, 0)), TREE_TYPE (exp));
- return;
-
- case MODIFY_EXPR:
-
- expand_assignment (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), 0, 0);
- return;
-
- case ADDR_EXPR:
-
- bc_expand_address (TREE_OPERAND (exp, 0));
- return;
-
- case INDIRECT_REF:
-
- bc_expand_expr (TREE_OPERAND (exp, 0));
- bc_load_memory (TREE_TYPE (exp), TREE_OPERAND (exp, 0));
- return;
-
- case ARRAY_REF:
-
- bc_expand_expr (bc_canonicalize_array_ref (exp));
- return;
-
- case COMPONENT_REF:
-
- bc_expand_component_address (exp);
-
- /* If we have a bitfield, generate a proper load */
- bc_load_memory (TREE_TYPE (TREE_OPERAND (exp, 1)), TREE_OPERAND (exp, 1));
- return;
-
- case COMPOUND_EXPR:
-
- bc_expand_expr (TREE_OPERAND (exp, 0));
- bc_emit_instruction (drop);
- bc_expand_expr (TREE_OPERAND (exp, 1));
- return;
-
- case COND_EXPR:
-
- bc_expand_expr (TREE_OPERAND (exp, 0));
- bc_expand_truth_conversion (TREE_TYPE (TREE_OPERAND (exp, 0)));
- lab = bc_get_bytecode_label ();
- bc_emit_bytecode (xjumpifnot);
- bc_emit_bytecode_labelref (lab);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
- bc_expand_expr (TREE_OPERAND (exp, 1));
- lab1 = bc_get_bytecode_label ();
- bc_emit_bytecode (jump);
- bc_emit_bytecode_labelref (lab1);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-
- bc_emit_bytecode_labeldef (lab);
- bc_expand_expr (TREE_OPERAND (exp, 2));
- bc_emit_bytecode_labeldef (lab1);
- return;
-
- case TRUTH_ANDIF_EXPR:
-
- opcode = xjumpifnot;
- goto andorif;
-
- case TRUTH_ORIF_EXPR:
-
- opcode = xjumpif;
- goto andorif;
-
- case PLUS_EXPR:
-
- binoptab = optab_plus_expr;
- goto binop;
-
- case MINUS_EXPR:
-
- binoptab = optab_minus_expr;
- goto binop;
-
- case MULT_EXPR:
-
- binoptab = optab_mult_expr;
- goto binop;
-
- case TRUNC_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case EXACT_DIV_EXPR:
-
- binoptab = optab_trunc_div_expr;
- goto binop;
-
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case CEIL_MOD_EXPR:
- case ROUND_MOD_EXPR:
-
- binoptab = optab_trunc_mod_expr;
- goto binop;
-
- case FIX_ROUND_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_CEIL_EXPR:
- abort (); /* Not used for C. */
-
- case FIX_TRUNC_EXPR:
- case FLOAT_EXPR:
- case MAX_EXPR:
- case MIN_EXPR:
- case FFS_EXPR:
- case LROTATE_EXPR:
- case RROTATE_EXPR:
- abort (); /* FIXME */
-
- case RDIV_EXPR:
-
- binoptab = optab_rdiv_expr;
- goto binop;
-
- case BIT_AND_EXPR:
-
- binoptab = optab_bit_and_expr;
- goto binop;
-
- case BIT_IOR_EXPR:
-
- binoptab = optab_bit_ior_expr;
- goto binop;
-
- case BIT_XOR_EXPR:
-
- binoptab = optab_bit_xor_expr;
- goto binop;
-
- case LSHIFT_EXPR:
-
- binoptab = optab_lshift_expr;
- goto binop;
-
- case RSHIFT_EXPR:
-
- binoptab = optab_rshift_expr;
- goto binop;
-
- case TRUTH_AND_EXPR:
-
- binoptab = optab_truth_and_expr;
- goto binop;
-
- case TRUTH_OR_EXPR:
-
- binoptab = optab_truth_or_expr;
- goto binop;
-
- case LT_EXPR:
-
- binoptab = optab_lt_expr;
- goto binop;
-
- case LE_EXPR:
-
- binoptab = optab_le_expr;
- goto binop;
-
- case GE_EXPR:
-
- binoptab = optab_ge_expr;
- goto binop;
-
- case GT_EXPR:
-
- binoptab = optab_gt_expr;
- goto binop;
-
- case EQ_EXPR:
-
- binoptab = optab_eq_expr;
- goto binop;
-
- case NE_EXPR:
-
- binoptab = optab_ne_expr;
- goto binop;
-
- case NEGATE_EXPR:
-
- unoptab = optab_negate_expr;
- goto unop;
-
- case BIT_NOT_EXPR:
-
- unoptab = optab_bit_not_expr;
- goto unop;
-
- case TRUTH_NOT_EXPR:
-
- unoptab = optab_truth_not_expr;
- goto unop;
-
- case PREDECREMENT_EXPR:
-
- incroptab = optab_predecrement_expr;
- goto increment;
-
- case PREINCREMENT_EXPR:
-
- incroptab = optab_preincrement_expr;
- goto increment;
-
- case POSTDECREMENT_EXPR:
-
- incroptab = optab_postdecrement_expr;
- goto increment;
-
- case POSTINCREMENT_EXPR:
-
- incroptab = optab_postincrement_expr;
- goto increment;
-
- case CONSTRUCTOR:
-
- bc_expand_constructor (exp);
- return;
-
- case ERROR_MARK:
- case RTL_EXPR:
-
- return;
-
- case BIND_EXPR:
- {
- tree vars = TREE_OPERAND (exp, 0);
- int vars_need_expansion = 0;
-
- /* Need to open a binding contour here because
- if there are any cleanups they most be contained here. */
- expand_start_bindings (0);
-
- /* Mark the corresponding BLOCK for output. */
- if (TREE_OPERAND (exp, 2) != 0)
- TREE_USED (TREE_OPERAND (exp, 2)) = 1;
-
- /* If VARS have not yet been expanded, expand them now. */
- while (vars)
- {
- if (DECL_RTL (vars) == 0)
- {
- vars_need_expansion = 1;
- expand_decl (vars);
- }
- expand_decl_init (vars);
- vars = TREE_CHAIN (vars);
- }
-
- bc_expand_expr (TREE_OPERAND (exp, 1));
-
- expand_end_bindings (TREE_OPERAND (exp, 0), 0, 0);
-
- return;
- }
- }
-
- abort ();
-
- binop:
-
- bc_expand_binary_operation (binoptab, TREE_TYPE (exp),
- TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1));
- return;
-
-
- unop:
-
- bc_expand_unary_operation (unoptab, TREE_TYPE (exp), TREE_OPERAND (exp, 0));
- return;
-
-
- andorif:
-
- bc_expand_expr (TREE_OPERAND (exp, 0));
- bc_expand_truth_conversion (TREE_TYPE (TREE_OPERAND (exp, 0)));
- lab = bc_get_bytecode_label ();
-
- bc_emit_instruction (duplicate);
- bc_emit_bytecode (opcode);
- bc_emit_bytecode_labelref (lab);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-
- bc_emit_instruction (drop);
-
- bc_expand_expr (TREE_OPERAND (exp, 1));
- bc_expand_truth_conversion (TREE_TYPE (TREE_OPERAND (exp, 1)));
- bc_emit_bytecode_labeldef (lab);
- return;
-
-
- increment:
-
- type = TREE_TYPE (TREE_OPERAND (exp, 0));
-
- /* Push the quantum. */
- bc_expand_expr (TREE_OPERAND (exp, 1));
-
- /* Convert it to the lvalue's type. */
- bc_expand_conversion (TREE_TYPE (TREE_OPERAND (exp, 1)), type);
-
- /* Push the address of the lvalue */
- bc_expand_expr (build1 (ADDR_EXPR, TYPE_POINTER_TO (type), TREE_OPERAND (exp, 0)));
-
- /* Perform actual increment */
- bc_expand_increment (incroptab, type);
- return;
-}
-
-/* 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
- EXP points to (if it is not a POINTER_TYPE, 0 is returned).
-
- Otherwise, look at the expression to see if we can do better, i.e., if the
- expression is actually pointing at an object whose alignment is tighter. */
-
-static int
-get_pointer_alignment (exp, max_align)
- tree exp;
- unsigned max_align;
-{
- unsigned align, inner;
-
- if (TREE_CODE (TREE_TYPE (exp)) != POINTER_TYPE)
- return 0;
-
- align = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)));
- align = MIN (align, max_align);
-
- while (1)
- {
- switch (TREE_CODE (exp))
- {
- case NOP_EXPR:
- case CONVERT_EXPR:
- case NON_LVALUE_EXPR:
- exp = TREE_OPERAND (exp, 0);
- if (TREE_CODE (TREE_TYPE (exp)) != POINTER_TYPE)
- return align;
- inner = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)));
- align = MIN (inner, max_align);
- break;
-
- case PLUS_EXPR:
- /* If sum of pointer + int, restrict our maximum alignment to that
- imposed by the integer. If not, we can't do any better than
- ALIGN. */
- if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST)
- return align;
-
- while (((TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)) * BITS_PER_UNIT)
- & (max_align - 1))
- != 0)
- max_align >>= 1;
-
- exp = TREE_OPERAND (exp, 0);
- break;
-
- case ADDR_EXPR:
- /* See what we are pointing at and look at its alignment. */
- exp = TREE_OPERAND (exp, 0);
- if (TREE_CODE (exp) == FUNCTION_DECL)
- align = FUNCTION_BOUNDARY;
- else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
- align = DECL_ALIGN (exp);
-#ifdef CONSTANT_ALIGNMENT
- else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c')
- align = CONSTANT_ALIGNMENT (exp, align);
-#endif
- return MIN (align, max_align);
-
- default:
- return align;
- }
- }
-}
-
-/* Return the tree node and offset if a given argument corresponds to
- a string constant. */
-
-static tree
-string_constant (arg, ptr_offset)
- tree arg;
- tree *ptr_offset;
-{
- STRIP_NOPS (arg);
-
- if (TREE_CODE (arg) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (arg, 0)) == STRING_CST)
- {
- *ptr_offset = integer_zero_node;
- return TREE_OPERAND (arg, 0);
- }
- else if (TREE_CODE (arg) == PLUS_EXPR)
- {
- tree arg0 = TREE_OPERAND (arg, 0);
- tree arg1 = TREE_OPERAND (arg, 1);
-
- STRIP_NOPS (arg0);
- STRIP_NOPS (arg1);
-
- if (TREE_CODE (arg0) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (arg0, 0)) == STRING_CST)
- {
- *ptr_offset = arg1;
- return TREE_OPERAND (arg0, 0);
- }
- else if (TREE_CODE (arg1) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (arg1, 0)) == STRING_CST)
- {
- *ptr_offset = arg0;
- return TREE_OPERAND (arg1, 0);
- }
- }
-
- return 0;
-}
-
-/* Compute the length of a C string. TREE_STRING_LENGTH is not the right
- way, because it could contain a zero byte in the middle.
- TREE_STRING_LENGTH is the size of the character array, not the string.
-
- Unfortunately, string_constant can't access the values of const char
- arrays with initializers, so neither can we do so here. */
-
-static tree
-c_strlen (src)
- tree src;
-{
- tree offset_node;
- int offset, max;
- char *ptr;
-
- src = string_constant (src, &offset_node);
- if (src == 0)
- return 0;
- max = TREE_STRING_LENGTH (src);
- ptr = TREE_STRING_POINTER (src);
- if (offset_node && TREE_CODE (offset_node) != INTEGER_CST)
- {
- /* If the string has an internal zero byte (e.g., "foo\0bar"), we can't
- compute the offset to the following null if we don't know where to
- start searching for it. */
- int i;
- for (i = 0; i < max; i++)
- if (ptr[i] == 0)
- return 0;
- /* We don't know the starting offset, but we do know that the string
- has no internal zero bytes. We can assume that the offset falls
- within the bounds of the string; otherwise, the programmer deserves
- what he gets. Subtract the offset from the length of the string,
- and return that. */
- /* This would perhaps not be valid if we were dealing with named
- arrays in addition to literal string constants. */
- return size_binop (MINUS_EXPR, size_int (max), offset_node);
- }
-
- /* We have a known offset into the string. Start searching there for
- a null character. */
- if (offset_node == 0)
- offset = 0;
- else
- {
- /* Did we get a long long offset? If so, punt. */
- if (TREE_INT_CST_HIGH (offset_node) != 0)
- return 0;
- offset = TREE_INT_CST_LOW (offset_node);
- }
- /* If the offset is known to be out of bounds, warn, and call strlen at
- runtime. */
- if (offset < 0 || offset > max)
- {
- warning ("offset outside bounds of constant string");
- return 0;
- }
- /* Use strlen to search for the first zero byte. Since any strings
- constructed with build_string will have nulls appended, we win even
- if we get handed something like (char[4])"abcd".
-
- Since OFFSET is our starting index into the string, no further
- calculation is needed. */
- return size_int (strlen (ptr + offset));
-}
-
-rtx
-expand_builtin_return_addr (fndecl_code, count, tem)
- enum built_in_function fndecl_code;
- int count;
- rtx tem;
-{
- int i;
-
- /* Some machines need special handling before we can access
- arbitrary frames. For example, on the sparc, we must first flush
- all register windows to the stack. */
-#ifdef SETUP_FRAME_ADDRESSES
- SETUP_FRAME_ADDRESSES ();
-#endif
-
- /* On the sparc, the return address is not in the frame, it is in a
- register. There is no way to access it off of the current frame
- pointer, but it can be accessed off the previous frame pointer by
- reading the value from the register window save area. */
-#ifdef RETURN_ADDR_IN_PREVIOUS_FRAME
- if (fndecl_code == BUILT_IN_RETURN_ADDRESS)
- count--;
-#endif
-
- /* Scan back COUNT frames to the specified frame. */
- for (i = 0; i < count; i++)
- {
- /* Assume the dynamic chain pointer is in the word that the
- frame address points to, unless otherwise specified. */
-#ifdef DYNAMIC_CHAIN_ADDRESS
- tem = DYNAMIC_CHAIN_ADDRESS (tem);
-#endif
- tem = memory_address (Pmode, tem);
- tem = copy_to_reg (gen_rtx (MEM, Pmode, tem));
- }
-
- /* For __builtin_frame_address, return what we've got. */
- if (fndecl_code == BUILT_IN_FRAME_ADDRESS)
- return tem;
-
- /* For __builtin_return_address, Get the return address from that
- frame. */
-#ifdef RETURN_ADDR_RTX
- tem = RETURN_ADDR_RTX (count, tem);
-#else
- tem = memory_address (Pmode,
- plus_constant (tem, GET_MODE_SIZE (Pmode)));
- tem = gen_rtx (MEM, Pmode, tem);
-#endif
- return tem;
-}
-
-/* Expand an expression EXP that calls a built-in function,
- with result going to TARGET if that's convenient
- (and in mode MODE if that's convenient).
- SUBTARGET may be used as the target for computing one of EXP's operands.
- IGNORE is nonzero if the value is to be ignored. */
-
-#define CALLED_AS_BUILT_IN(NODE) \
- (!strncmp (IDENTIFIER_POINTER (DECL_NAME (NODE)), "__builtin_", 10))
-
-static rtx
-expand_builtin (exp, target, subtarget, mode, ignore)
- tree exp;
- rtx target;
- rtx subtarget;
- enum machine_mode mode;
- int ignore;
-{
- tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
- tree arglist = TREE_OPERAND (exp, 1);
- rtx op0;
- rtx lab1, insns;
- enum machine_mode value_mode = TYPE_MODE (TREE_TYPE (exp));
- optab builtin_optab;
-
- switch (DECL_FUNCTION_CODE (fndecl))
- {
- case BUILT_IN_ABS:
- case BUILT_IN_LABS:
- case BUILT_IN_FABS:
- /* build_function_call changes these into ABS_EXPR. */
- abort ();
-
- case BUILT_IN_SIN:
- case BUILT_IN_COS:
- /* Treat these like sqrt, but only if the user asks for them. */
- if (! flag_fast_math)
- break;
- case BUILT_IN_FSQRT:
- /* If not optimizing, call the library function. */
- if (! optimize)
- break;
-
- if (arglist == 0
- /* Arg could be wrong type if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != REAL_TYPE)
- break;
-
- /* Stabilize and compute the argument. */
- if (TREE_CODE (TREE_VALUE (arglist)) != VAR_DECL
- && TREE_CODE (TREE_VALUE (arglist)) != PARM_DECL)
- {
- exp = copy_node (exp);
- arglist = copy_node (arglist);
- TREE_OPERAND (exp, 1) = arglist;
- TREE_VALUE (arglist) = save_expr (TREE_VALUE (arglist));
- }
- op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);
-
- /* Make a suitable register to place result in. */
- target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
-
- emit_queue ();
- start_sequence ();
-
- switch (DECL_FUNCTION_CODE (fndecl))
- {
- case BUILT_IN_SIN:
- builtin_optab = sin_optab; break;
- case BUILT_IN_COS:
- builtin_optab = cos_optab; break;
- case BUILT_IN_FSQRT:
- builtin_optab = sqrt_optab; break;
- default:
- abort ();
- }
-
- /* Compute into TARGET.
- Set TARGET to wherever the result comes back. */
- target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))),
- builtin_optab, op0, target, 0);
-
- /* If we were unable to expand via the builtin, stop the
- sequence (without outputting the insns) and break, causing
- a call the the library function. */
- if (target == 0)
- {
- end_sequence ();
- break;
- }
-
- /* Check the results by default. But if flag_fast_math is turned on,
- then assume sqrt will always be called with valid arguments. */
-
- if (! flag_fast_math)
- {
- /* Don't define the builtin FP instructions
- if your machine is not IEEE. */
- if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT)
- abort ();
-
- lab1 = gen_label_rtx ();
-
- /* Test the result; if it is NaN, set errno=EDOM because
- the argument was not in the domain. */
- emit_cmp_insn (target, target, EQ, 0, GET_MODE (target), 0, 0);
- emit_jump_insn (gen_beq (lab1));
-
-#ifdef TARGET_EDOM
- {
-#ifdef GEN_ERRNO_RTX
- rtx errno_rtx = GEN_ERRNO_RTX;
-#else
- rtx errno_rtx
- = gen_rtx (MEM, word_mode, gen_rtx (SYMBOL_REF, Pmode, "errno"));
-#endif
-
- emit_move_insn (errno_rtx, GEN_INT (TARGET_EDOM));
- }
-#else
- /* We can't set errno=EDOM directly; let the library call do it.
- Pop the arguments right away in case the call gets deleted. */
- NO_DEFER_POP;
- expand_call (exp, target, 0);
- OK_DEFER_POP;
-#endif
-
- emit_label (lab1);
- }
-
- /* Output the entire sequence. */
- insns = get_insns ();
- end_sequence ();
- emit_insns (insns);
-
- return target;
-
- /* __builtin_apply_args returns block of memory allocated on
- the stack into which is stored the arg pointer, structure
- value address, static chain, and all the registers that might
- possibly be used in performing a function call. The code is
- moved to the start of the function so the incoming values are
- saved. */
- case BUILT_IN_APPLY_ARGS:
- /* Don't do __builtin_apply_args more than once in a function.
- Save the result of the first call and reuse it. */
- if (apply_args_value != 0)
- return apply_args_value;
- {
- /* When this function is called, it means that registers must be
- saved on entry to this function. So we migrate the
- call to the first insn of this function. */
- rtx temp;
- rtx seq;
-
- start_sequence ();
- temp = expand_builtin_apply_args ();
- seq = get_insns ();
- end_sequence ();
-
- apply_args_value = temp;
-
- /* Put the sequence after the NOTE that starts the function.
- If this is inside a SEQUENCE, make the outer-level insn
- chain current, so the code is placed at the start of the
- function. */
- push_topmost_sequence ();
- emit_insns_before (seq, NEXT_INSN (get_insns ()));
- pop_topmost_sequence ();
- return temp;
- }
-
- /* __builtin_apply (FUNCTION, ARGUMENTS, ARGSIZE) invokes
- FUNCTION with a copy of the parameters described by
- ARGUMENTS, and ARGSIZE. It returns a block of memory
- allocated on the stack into which is stored all the registers
- that might possibly be used for returning the result of a
- function. ARGUMENTS is the value returned by
- __builtin_apply_args. ARGSIZE is the number of bytes of
- arguments that must be copied. ??? How should this value be
- computed? We'll also need a safe worst case value for varargs
- functions. */
- case BUILT_IN_APPLY:
- if (arglist == 0
- /* Arg could be non-pointer if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
- || TREE_CHAIN (arglist) == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE
- || TREE_CHAIN (TREE_CHAIN (arglist)) == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))) != INTEGER_TYPE)
- return const0_rtx;
- else
- {
- int i;
- tree t;
- rtx ops[3];
-
- for (t = arglist, i = 0; t; t = TREE_CHAIN (t), i++)
- ops[i] = expand_expr (TREE_VALUE (t), NULL_RTX, VOIDmode, 0);
-
- return expand_builtin_apply (ops[0], ops[1], ops[2]);
- }
-
- /* __builtin_return (RESULT) causes the function to return the
- value described by RESULT. RESULT is address of the block of
- memory returned by __builtin_apply. */
- case BUILT_IN_RETURN:
- if (arglist
- /* Arg could be non-pointer if user redeclared this fcn wrong. */
- && TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) == POINTER_TYPE)
- expand_builtin_return (expand_expr (TREE_VALUE (arglist),
- NULL_RTX, VOIDmode, 0));
- return const0_rtx;
-
- case BUILT_IN_SAVEREGS:
- /* Don't do __builtin_saveregs more than once in a function.
- Save the result of the first call and reuse it. */
- if (saveregs_value != 0)
- return saveregs_value;
- {
- /* When this function is called, it means that registers must be
- saved on entry to this function. So we migrate the
- call to the first insn of this function. */
- rtx temp;
- rtx seq;
-
- /* Now really call the function. `expand_call' does not call
- expand_builtin, so there is no danger of infinite recursion here. */
- start_sequence ();
-
-#ifdef EXPAND_BUILTIN_SAVEREGS
- /* Do whatever the machine needs done in this case. */
- temp = EXPAND_BUILTIN_SAVEREGS (arglist);
-#else
- /* The register where the function returns its value
- is likely to have something else in it, such as an argument.
- So preserve that register around the call. */
-
- if (value_mode != VOIDmode)
- {
- rtx valreg = hard_libcall_value (value_mode);
- rtx saved_valreg = gen_reg_rtx (value_mode);
-
- emit_move_insn (saved_valreg, valreg);
- temp = expand_call (exp, target, ignore);
- emit_move_insn (valreg, saved_valreg);
- }
- else
- /* Generate the call, putting the value in a pseudo. */
- temp = expand_call (exp, target, ignore);
-#endif
-
- seq = get_insns ();
- end_sequence ();
-
- saveregs_value = temp;
-
- /* Put the sequence after the NOTE that starts the function.
- If this is inside a SEQUENCE, make the outer-level insn
- chain current, so the code is placed at the start of the
- function. */
- push_topmost_sequence ();
- emit_insns_before (seq, NEXT_INSN (get_insns ()));
- pop_topmost_sequence ();
- return temp;
- }
-
- /* __builtin_args_info (N) returns word N of the arg space info
- for the current function. The number and meanings of words
- is controlled by the definition of CUMULATIVE_ARGS. */
- case BUILT_IN_ARGS_INFO:
- {
- int nwords = sizeof (CUMULATIVE_ARGS) / sizeof (int);
- int i;
- int *word_ptr = (int *) &current_function_args_info;
- tree type, elts, result;
-
- if (sizeof (CUMULATIVE_ARGS) % sizeof (int) != 0)
- fatal ("CUMULATIVE_ARGS type defined badly; see %s, line %d",
- __FILE__, __LINE__);
-
- if (arglist != 0)
- {
- tree arg = TREE_VALUE (arglist);
- if (TREE_CODE (arg) != INTEGER_CST)
- error ("argument of `__builtin_args_info' must be constant");
- else
- {
- int wordnum = TREE_INT_CST_LOW (arg);
-
- if (wordnum < 0 || wordnum >= nwords || TREE_INT_CST_HIGH (arg))
- error ("argument of `__builtin_args_info' out of range");
- else
- return GEN_INT (word_ptr[wordnum]);
- }
- }
- else
- error ("missing argument in `__builtin_args_info'");
-
- return const0_rtx;
-
-#if 0
- for (i = 0; i < nwords; i++)
- elts = tree_cons (NULL_TREE, build_int_2 (word_ptr[i], 0));
-
- type = build_array_type (integer_type_node,
- build_index_type (build_int_2 (nwords, 0)));
- result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (elts));
- TREE_CONSTANT (result) = 1;
- TREE_STATIC (result) = 1;
- result = build (INDIRECT_REF, build_pointer_type (type), result);
- TREE_CONSTANT (result) = 1;
- return expand_expr (result, NULL_RTX, VOIDmode, 0);
-#endif
- }
-
- /* Return the address of the first anonymous stack arg. */
- case BUILT_IN_NEXT_ARG:
- {
- tree fntype = TREE_TYPE (current_function_decl);
-
- if ((TYPE_ARG_TYPES (fntype) == 0
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
- == void_type_node))
- && ! current_function_varargs)
- {
- error ("`va_start' used in function with fixed args");
- return const0_rtx;
- }
-
- if (arglist)
- {
- tree last_parm = tree_last (DECL_ARGUMENTS (current_function_decl));
- tree arg = TREE_VALUE (arglist);
-
- /* Strip off all nops for the sake of the comparison. This
- is not quite the same as STRIP_NOPS. It does more.
- We must also strip off INDIRECT_EXPR for C++ reference
- parameters. */
- while (TREE_CODE (arg) == NOP_EXPR
- || TREE_CODE (arg) == CONVERT_EXPR
- || TREE_CODE (arg) == NON_LVALUE_EXPR
- || TREE_CODE (arg) == INDIRECT_REF)
- arg = TREE_OPERAND (arg, 0);
- if (arg != last_parm)
- warning ("second parameter of `va_start' not last named argument");
- }
- else if (! current_function_varargs)
- /* Evidently an out of date version of <stdarg.h>; can't validate
- va_start's second argument, but can still work as intended. */
- warning ("`__builtin_next_arg' called without an argument");
- }
-
- return expand_binop (Pmode, add_optab,
- current_function_internal_arg_pointer,
- current_function_arg_offset_rtx,
- NULL_RTX, 0, OPTAB_LIB_WIDEN);
-
- case BUILT_IN_CLASSIFY_TYPE:
- if (arglist != 0)
- {
- tree type = TREE_TYPE (TREE_VALUE (arglist));
- enum tree_code code = TREE_CODE (type);
- if (code == VOID_TYPE)
- return GEN_INT (void_type_class);
- if (code == INTEGER_TYPE)
- return GEN_INT (integer_type_class);
- if (code == CHAR_TYPE)
- return GEN_INT (char_type_class);
- if (code == ENUMERAL_TYPE)
- return GEN_INT (enumeral_type_class);
- if (code == BOOLEAN_TYPE)
- return GEN_INT (boolean_type_class);
- if (code == POINTER_TYPE)
- return GEN_INT (pointer_type_class);
- if (code == REFERENCE_TYPE)
- return GEN_INT (reference_type_class);
- if (code == OFFSET_TYPE)
- return GEN_INT (offset_type_class);
- if (code == REAL_TYPE)
- return GEN_INT (real_type_class);
- if (code == COMPLEX_TYPE)
- return GEN_INT (complex_type_class);
- if (code == FUNCTION_TYPE)
- return GEN_INT (function_type_class);
- if (code == METHOD_TYPE)
- return GEN_INT (method_type_class);
- if (code == RECORD_TYPE)
- return GEN_INT (record_type_class);
- if (code == UNION_TYPE || code == QUAL_UNION_TYPE)
- return GEN_INT (union_type_class);
- if (code == ARRAY_TYPE)
- {
- if (TYPE_STRING_FLAG (type))
- return GEN_INT (string_type_class);
- else
- return GEN_INT (array_type_class);
- }
- if (code == SET_TYPE)
- return GEN_INT (set_type_class);
- if (code == FILE_TYPE)
- return GEN_INT (file_type_class);
- if (code == LANG_TYPE)
- return GEN_INT (lang_type_class);
- }
- return GEN_INT (no_type_class);
-
- case BUILT_IN_CONSTANT_P:
- if (arglist == 0)
- return const0_rtx;
- else
- {
- tree arg = TREE_VALUE (arglist);
-
- STRIP_NOPS (arg);
- return (TREE_CODE_CLASS (TREE_CODE (arg)) == 'c'
- || (TREE_CODE (arg) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (arg, 0)) == STRING_CST)
- ? const1_rtx : const0_rtx);
- }
-
- case BUILT_IN_FRAME_ADDRESS:
- /* The argument must be a nonnegative integer constant.
- It counts the number of frames to scan up the stack.
- The value is the address of that frame. */
- case BUILT_IN_RETURN_ADDRESS:
- /* The argument must be a nonnegative integer constant.
- It counts the number of frames to scan up the stack.
- The value is the return address saved in that frame. */
- if (arglist == 0)
- /* Warning about missing arg was already issued. */
- return const0_rtx;
- else if (TREE_CODE (TREE_VALUE (arglist)) != INTEGER_CST)
- {
- error ("invalid arg to `__builtin_return_address'");
- return const0_rtx;
- }
- else if (tree_int_cst_sgn (TREE_VALUE (arglist)) < 0)
- {
- error ("invalid arg to `__builtin_return_address'");
- return const0_rtx;
- }
- else
- {
- rtx tem = expand_builtin_return_addr (DECL_FUNCTION_CODE (fndecl),
- TREE_INT_CST_LOW (TREE_VALUE (arglist)),
- hard_frame_pointer_rtx);
-
- /* For __builtin_frame_address, return what we've got. */
- if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_FRAME_ADDRESS)
- return tem;
-
- if (GET_CODE (tem) != REG)
- tem = copy_to_reg (tem);
- return tem;
- }
-
- case BUILT_IN_ALLOCA:
- if (arglist == 0
- /* Arg could be non-integer if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
- break;
-
- /* Compute the argument. */
- op0 = expand_expr (TREE_VALUE (arglist), NULL_RTX, VOIDmode, 0);
-
- /* Allocate the desired space. */
- return allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT);
-
- case BUILT_IN_FFS:
- /* If not optimizing, call the library function. */
- if (!optimize && ! CALLED_AS_BUILT_IN (fndecl))
- break;
-
- if (arglist == 0
- /* Arg could be non-integer if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
- break;
-
- /* Compute the argument. */
- op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);
- /* Compute ffs, into TARGET if possible.
- Set TARGET to wherever the result comes back. */
- target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))),
- ffs_optab, op0, target, 1);
- if (target == 0)
- abort ();
- return target;
-
- case BUILT_IN_STRLEN:
- /* If not optimizing, call the library function. */
- if (!optimize && ! CALLED_AS_BUILT_IN (fndecl))
- break;
-
- if (arglist == 0
- /* Arg could be non-pointer if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE)
- break;
- else
- {
- tree src = TREE_VALUE (arglist);
- tree len = c_strlen (src);
-
- int align
- = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
-
- rtx result, src_rtx, char_rtx;
- enum machine_mode insn_mode = value_mode, char_mode;
- enum insn_code icode;
-
- /* If the length is known, just return it. */
- if (len != 0)
- return expand_expr (len, target, mode, 0);
-
- /* If SRC is not a pointer type, don't do this operation inline. */
- if (align == 0)
- break;
-
- /* Call a function if we can't compute strlen in the right mode. */
-
- while (insn_mode != VOIDmode)
- {
- icode = strlen_optab->handlers[(int) insn_mode].insn_code;
- if (icode != CODE_FOR_nothing)
- break;
-
- insn_mode = GET_MODE_WIDER_MODE (insn_mode);
- }
- if (insn_mode == VOIDmode)
- break;
-
- /* Make a place to write the result of the instruction. */
- result = target;
- if (! (result != 0
- && GET_CODE (result) == REG
- && GET_MODE (result) == insn_mode
- && REGNO (result) >= FIRST_PSEUDO_REGISTER))
- result = gen_reg_rtx (insn_mode);
-
- /* Make sure the operands are acceptable to the predicates. */
-
- if (! (*insn_operand_predicate[(int)icode][0]) (result, insn_mode))
- result = gen_reg_rtx (insn_mode);
-
- src_rtx = memory_address (BLKmode,
- expand_expr (src, NULL_RTX, ptr_mode,
- EXPAND_NORMAL));
- if (! (*insn_operand_predicate[(int)icode][1]) (src_rtx, Pmode))
- src_rtx = copy_to_mode_reg (Pmode, src_rtx);
-
- char_rtx = const0_rtx;
- char_mode = insn_operand_mode[(int)icode][2];
- if (! (*insn_operand_predicate[(int)icode][2]) (char_rtx, char_mode))
- char_rtx = copy_to_mode_reg (char_mode, char_rtx);
-
- emit_insn (GEN_FCN (icode) (result,
- gen_rtx (MEM, BLKmode, src_rtx),
- char_rtx, GEN_INT (align)));
-
- /* Return the value in the proper mode for this function. */
- if (GET_MODE (result) == value_mode)
- return result;
- else if (target != 0)
- {
- convert_move (target, result, 0);
- return target;
- }
- else
- return convert_to_mode (value_mode, result, 0);
- }
-
- case BUILT_IN_STRCPY:
- /* If not optimizing, call the library function. */
- if (!optimize && ! CALLED_AS_BUILT_IN (fndecl))
- break;
-
- if (arglist == 0
- /* Arg could be non-pointer if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
- || TREE_CHAIN (arglist) == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE)
- break;
- else
- {
- tree len = c_strlen (TREE_VALUE (TREE_CHAIN (arglist)));
-
- if (len == 0)
- break;
-
- len = size_binop (PLUS_EXPR, len, integer_one_node);
-
- chainon (arglist, build_tree_list (NULL_TREE, len));
- }
-
- /* Drops in. */
- case BUILT_IN_MEMCPY:
- /* If not optimizing, call the library function. */
- if (!optimize && ! CALLED_AS_BUILT_IN (fndecl))
- break;
-
- if (arglist == 0
- /* Arg could be non-pointer if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
- || TREE_CHAIN (arglist) == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE
- || TREE_CHAIN (TREE_CHAIN (arglist)) == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))) != INTEGER_TYPE)
- break;
- else
- {
- tree dest = TREE_VALUE (arglist);
- tree src = TREE_VALUE (TREE_CHAIN (arglist));
- tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
- tree type;
-
- int src_align
- = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
- int dest_align
- = get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
- rtx dest_rtx, dest_mem, src_mem;
-
- /* If either SRC or DEST is not a pointer type, don't do
- this operation in-line. */
- if (src_align == 0 || dest_align == 0)
- {
- if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRCPY)
- TREE_CHAIN (TREE_CHAIN (arglist)) = 0;
- break;
- }
-
- dest_rtx = expand_expr (dest, NULL_RTX, ptr_mode, EXPAND_SUM);
- dest_mem = gen_rtx (MEM, BLKmode,
- memory_address (BLKmode, dest_rtx));
- /* There could be a void* cast on top of the object. */
- while (TREE_CODE (dest) == NOP_EXPR)
- dest = TREE_OPERAND (dest, 0);
- type = TREE_TYPE (TREE_TYPE (dest));
- MEM_IN_STRUCT_P (dest_mem) = AGGREGATE_TYPE_P (type);
- src_mem = gen_rtx (MEM, BLKmode,
- memory_address (BLKmode,
- expand_expr (src, NULL_RTX,
- ptr_mode,
- EXPAND_SUM)));
- /* There could be a void* cast on top of the object. */
- while (TREE_CODE (src) == NOP_EXPR)
- src = TREE_OPERAND (src, 0);
- type = TREE_TYPE (TREE_TYPE (src));
- MEM_IN_STRUCT_P (src_mem) = AGGREGATE_TYPE_P (type);
-
- /* Copy word part most expediently. */
- emit_block_move (dest_mem, src_mem,
- expand_expr (len, NULL_RTX, VOIDmode, 0),
- MIN (src_align, dest_align));
- return force_operand (dest_rtx, NULL_RTX);
- }
-
- case BUILT_IN_MEMSET:
- /* If not optimizing, call the library function. */
- if (!optimize && ! CALLED_AS_BUILT_IN (fndecl))
- break;
-
- if (arglist == 0
- /* Arg could be non-pointer if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
- || TREE_CHAIN (arglist) == 0
- || (TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist))))
- != INTEGER_TYPE)
- || TREE_CHAIN (TREE_CHAIN (arglist)) == 0
- || (INTEGER_CST
- != (TREE_CODE (TREE_TYPE
- (TREE_VALUE
- (TREE_CHAIN (TREE_CHAIN (arglist))))))))
- break;
- else
- {
- tree dest = TREE_VALUE (arglist);
- tree val = TREE_VALUE (TREE_CHAIN (arglist));
- tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
- tree type;
-
- int dest_align
- = get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
- rtx dest_rtx, dest_mem;
-
- /* If DEST is not a pointer type, don't do this
- operation in-line. */
- if (dest_align == 0)
- break;
-
- /* If VAL is not 0, don't do this operation in-line. */
- if (expand_expr (val, NULL_RTX, VOIDmode, 0) != const0_rtx)
- break;
-
- dest_rtx = expand_expr (dest, NULL_RTX, ptr_mode, EXPAND_SUM);
- dest_mem = gen_rtx (MEM, BLKmode,
- memory_address (BLKmode, dest_rtx));
- /* There could be a void* cast on top of the object. */
- while (TREE_CODE (dest) == NOP_EXPR)
- dest = TREE_OPERAND (dest, 0);
- type = TREE_TYPE (TREE_TYPE (dest));
- MEM_IN_STRUCT_P (dest_mem) = AGGREGATE_TYPE_P (type);
-
- clear_storage (dest_mem, expand_expr (len, NULL_RTX, VOIDmode, 0),
- dest_align);
-
- return force_operand (dest_rtx, NULL_RTX);
- }
-
-/* These comparison functions need an instruction that returns an actual
- index. An ordinary compare that just sets the condition codes
- is not enough. */
-#ifdef HAVE_cmpstrsi
- case BUILT_IN_STRCMP:
- /* If not optimizing, call the library function. */
- if (!optimize && ! CALLED_AS_BUILT_IN (fndecl))
- break;
-
- if (arglist == 0
- /* Arg could be non-pointer if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
- || TREE_CHAIN (arglist) == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE)
- break;
- else if (!HAVE_cmpstrsi)
- break;
- {
- tree arg1 = TREE_VALUE (arglist);
- tree arg2 = TREE_VALUE (TREE_CHAIN (arglist));
- tree offset;
- tree len, len2;
-
- len = c_strlen (arg1);
- if (len)
- len = size_binop (PLUS_EXPR, integer_one_node, len);
- len2 = c_strlen (arg2);
- if (len2)
- len2 = size_binop (PLUS_EXPR, integer_one_node, len2);
-
- /* If we don't have a constant length for the first, use the length
- of the second, if we know it. We don't require a constant for
- this case; some cost analysis could be done if both are available
- but neither is constant. For now, assume they're equally cheap.
-
- If both strings have constant lengths, use the smaller. This
- could arise if optimization results in strcpy being called with
- two fixed strings, or if the code was machine-generated. We should
- add some code to the `memcmp' handler below to deal with such
- situations, someday. */
- if (!len || TREE_CODE (len) != INTEGER_CST)
- {
- if (len2)
- len = len2;
- else if (len == 0)
- break;
- }
- else if (len2 && TREE_CODE (len2) == INTEGER_CST)
- {
- if (tree_int_cst_lt (len2, len))
- len = len2;
- }
-
- chainon (arglist, build_tree_list (NULL_TREE, len));
- }
-
- /* Drops in. */
- case BUILT_IN_MEMCMP:
- /* If not optimizing, call the library function. */
- if (!optimize && ! CALLED_AS_BUILT_IN (fndecl))
- break;
-
- if (arglist == 0
- /* Arg could be non-pointer if user redeclared this fcn wrong. */
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE
- || TREE_CHAIN (arglist) == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist)))) != POINTER_TYPE
- || TREE_CHAIN (TREE_CHAIN (arglist)) == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))) != INTEGER_TYPE)
- break;
- else if (!HAVE_cmpstrsi)
- break;
- {
- tree arg1 = TREE_VALUE (arglist);
- tree arg2 = TREE_VALUE (TREE_CHAIN (arglist));
- tree len = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
- rtx result;
-
- int arg1_align
- = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
- int arg2_align
- = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT;
- enum machine_mode insn_mode
- = insn_operand_mode[(int) CODE_FOR_cmpstrsi][0];
-
- /* If we don't have POINTER_TYPE, call the function. */
- if (arg1_align == 0 || arg2_align == 0)
- {
- if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRCMP)
- TREE_CHAIN (TREE_CHAIN (arglist)) = 0;
- break;
- }
-
- /* Make a place to write the result of the instruction. */
- result = target;
- if (! (result != 0
- && GET_CODE (result) == REG && GET_MODE (result) == insn_mode
- && REGNO (result) >= FIRST_PSEUDO_REGISTER))
- result = gen_reg_rtx (insn_mode);
-
- emit_insn (gen_cmpstrsi (result,
- gen_rtx (MEM, BLKmode,
- expand_expr (arg1, NULL_RTX,
- ptr_mode,
- EXPAND_NORMAL)),
- gen_rtx (MEM, BLKmode,
- expand_expr (arg2, NULL_RTX,
- ptr_mode,
- EXPAND_NORMAL)),
- expand_expr (len, NULL_RTX, VOIDmode, 0),
- GEN_INT (MIN (arg1_align, arg2_align))));
-
- /* Return the value in the proper mode for this function. */
- mode = TYPE_MODE (TREE_TYPE (exp));
- if (GET_MODE (result) == mode)
- return result;
- else if (target != 0)
- {
- convert_move (target, result, 0);
- return target;
- }
- else
- return convert_to_mode (mode, result, 0);
- }
-#else
- case BUILT_IN_STRCMP:
- case BUILT_IN_MEMCMP:
- break;
-#endif
-
- /* __builtin_setjmp is passed a pointer to an array of five words
- (not all will be used on all machines). It operates similarly to
- the C library function of the same name, but is more efficient.
- Much of the code below (and for longjmp) is copied from the handling
- of non-local gotos.
-
- NOTE: This is intended for use by GNAT and will only work in
- the method used by it. This code will likely NOT survive to
- the GCC 2.8.0 release. */
- case BUILT_IN_SETJMP:
- if (arglist == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE)
- break;
-
- {
- rtx buf_addr = expand_expr (TREE_VALUE (arglist), subtarget,
- VOIDmode, 0);
- rtx lab1 = gen_label_rtx (), lab2 = gen_label_rtx ();
- enum machine_mode sa_mode = Pmode;
- rtx stack_save;
- int old_inhibit_defer_pop = inhibit_defer_pop;
- int return_pops
- = RETURN_POPS_ARGS (get_identifier ("__dummy"),
- build_function_type (void_type_node, NULL_TREE),
- 0);
- rtx next_arg_reg;
- CUMULATIVE_ARGS args_so_far;
- int i;
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- buf_addr = convert_memory_address (Pmode, buf_addr);
-#endif
-
- buf_addr = force_reg (Pmode, buf_addr);
-
- if (target == 0 || GET_CODE (target) != REG
- || REGNO (target) < FIRST_PSEUDO_REGISTER)
- target = gen_reg_rtx (value_mode);
-
- emit_queue ();
-
- CONST_CALL_P (emit_note (NULL_PTR, NOTE_INSN_SETJMP)) = 1;
- current_function_calls_setjmp = 1;
-
- /* We store the frame pointer and the address of lab1 in the buffer
- and use the rest of it for the stack save area, which is
- machine-dependent. */
- emit_move_insn (gen_rtx (MEM, Pmode, buf_addr),
- virtual_stack_vars_rtx);
- emit_move_insn
- (validize_mem (gen_rtx (MEM, Pmode,
- plus_constant (buf_addr,
- GET_MODE_SIZE (Pmode)))),
- gen_rtx (LABEL_REF, Pmode, lab1));
-
-#ifdef HAVE_save_stack_nonlocal
- if (HAVE_save_stack_nonlocal)
- sa_mode = insn_operand_mode[(int) CODE_FOR_save_stack_nonlocal][0];
-#endif
-
- stack_save = gen_rtx (MEM, sa_mode,
- plus_constant (buf_addr,
- 2 * GET_MODE_SIZE (Pmode)));
- emit_stack_save (SAVE_NONLOCAL, &stack_save, NULL_RTX);
-
-#ifdef HAVE_setjmp
- if (HAVE_setjmp)
- emit_insn (gen_setjmp ());
-#endif
-
- /* Set TARGET to zero and branch around the other case. */
- emit_move_insn (target, const0_rtx);
- emit_jump_insn (gen_jump (lab2));
- emit_barrier ();
- emit_label (lab1);
-
- /* Note that setjmp clobbers FP when we get here, so we have to
- make sure it's marked as used by this function. */
- emit_insn (gen_rtx (USE, VOIDmode, hard_frame_pointer_rtx));
-
- /* Mark the static chain as clobbered here so life information
- doesn't get messed up for it. */
- emit_insn (gen_rtx (CLOBBER, VOIDmode, static_chain_rtx));
-
- /* Now put in the code to restore the frame pointer, and argument
- pointer, if needed. The code below is from expand_end_bindings
- in stmt.c; see detailed documentation there. */
-#ifdef HAVE_nonlocal_goto
- if (! HAVE_nonlocal_goto)
-#endif
- emit_move_insn (virtual_stack_vars_rtx, hard_frame_pointer_rtx);
-
- current_function_has_nonlocal_goto = 1;
-
-#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- if (fixed_regs[ARG_POINTER_REGNUM])
- {
-#ifdef ELIMINABLE_REGS
- static struct elims {int from, to;} elim_regs[] = ELIMINABLE_REGS;
-
- for (i = 0; i < sizeof elim_regs / sizeof elim_regs[0]; i++)
- if (elim_regs[i].from == ARG_POINTER_REGNUM
- && elim_regs[i].to == HARD_FRAME_POINTER_REGNUM)
- break;
-
- if (i == sizeof elim_regs / sizeof elim_regs [0])
-#endif
- {
- /* Now restore our arg pointer from the address at which it
- was saved in our stack frame.
- If there hasn't be space allocated for it yet, make
- some now. */
- if (arg_pointer_save_area == 0)
- arg_pointer_save_area
- = assign_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0);
- emit_move_insn (virtual_incoming_args_rtx,
- copy_to_reg (arg_pointer_save_area));
- }
- }
-#endif
-
-#ifdef HAVE_nonlocal_goto_receiver
- if (HAVE_nonlocal_goto_receiver)
- emit_insn (gen_nonlocal_goto_receiver ());
-#endif
- /* The static chain pointer contains the address of dummy function.
- We need to call it here to handle some PIC cases of restoring
- a global pointer. Then return 1. */
- op0 = copy_to_mode_reg (Pmode, static_chain_rtx);
-
- /* We can't actually call emit_library_call here, so do everything
- it does, which isn't much for a libfunc with no args. */
- op0 = memory_address (FUNCTION_MODE, op0);
-
- INIT_CUMULATIVE_ARGS (args_so_far, NULL_TREE,
- gen_rtx (SYMBOL_REF, Pmode, "__dummy"), 1);
- next_arg_reg = FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1);
-
-#ifndef ACCUMULATE_OUTGOING_ARGS
-#ifdef HAVE_call_pop
- if (HAVE_call_pop)
- emit_call_insn (gen_call_pop (gen_rtx (MEM, FUNCTION_MODE, op0),
- const0_rtx, next_arg_reg,
- GEN_INT (return_pops)));
- else
-#endif
-#endif
-
-#ifdef HAVE_call
- if (HAVE_call)
- emit_call_insn (gen_call (gen_rtx (MEM, FUNCTION_MODE, op0),
- const0_rtx, next_arg_reg, const0_rtx));
- else
-#endif
- abort ();
-
- emit_move_insn (target, const1_rtx);
- emit_label (lab2);
- return target;
- }
-
- /* __builtin_longjmp is passed a pointer to an array of five words
- and a value, which is a dummy. It's similar to the C library longjmp
- function but works with __builtin_setjmp above. */
- case BUILT_IN_LONGJMP:
- if (arglist == 0 || TREE_CHAIN (arglist) == 0
- || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != POINTER_TYPE)
- break;
-
- {
- tree dummy_id = get_identifier ("__dummy");
- tree dummy_type = build_function_type (void_type_node, NULL_TREE);
- tree dummy_decl = build_decl (FUNCTION_DECL, dummy_id, dummy_type);
-#ifdef POINTERS_EXTEND_UNSIGNED
- rtx buf_addr
- = force_reg (Pmode,
- convert_memory_address
- (Pmode,
- expand_expr (TREE_VALUE (arglist),
- NULL_RTX, VOIDmode, 0)));
-#else
- rtx buf_addr
- = force_reg (Pmode, expand_expr (TREE_VALUE (arglist),
- NULL_RTX,
- VOIDmode, 0));
-#endif
- rtx fp = gen_rtx (MEM, Pmode, buf_addr);
- rtx lab = gen_rtx (MEM, Pmode,
- plus_constant (buf_addr, GET_MODE_SIZE (Pmode)));
- enum machine_mode sa_mode
-#ifdef HAVE_save_stack_nonlocal
- = (HAVE_save_stack_nonlocal
- ? insn_operand_mode[(int) CODE_FOR_save_stack_nonlocal][0]
- : Pmode);
-#else
- = Pmode;
-#endif
- rtx stack = gen_rtx (MEM, sa_mode,
- plus_constant (buf_addr,
- 2 * GET_MODE_SIZE (Pmode)));
-
- DECL_EXTERNAL (dummy_decl) = 1;
- TREE_PUBLIC (dummy_decl) = 1;
- make_decl_rtl (dummy_decl, NULL_PTR, 1);
-
- /* Expand the second expression just for side-effects. */
- expand_expr (TREE_VALUE (TREE_CHAIN (arglist)),
- const0_rtx, VOIDmode, 0);
-
- assemble_external (dummy_decl);
-
- /* Pick up FP, label, and SP from the block and jump. This code is
- from expand_goto in stmt.c; see there for detailed comments. */
-#if HAVE_nonlocal_goto
- if (HAVE_nonlocal_goto)
- emit_insn (gen_nonlocal_goto (fp, lab, stack,
- XEXP (DECL_RTL (dummy_decl), 0)));
- else
-#endif
- {
- lab = copy_to_reg (lab);
- emit_move_insn (hard_frame_pointer_rtx, fp);
- emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
-
- /* Put in the static chain register the address of the dummy
- function. */
- emit_move_insn (static_chain_rtx, XEXP (DECL_RTL (dummy_decl), 0));
- emit_insn (gen_rtx (USE, VOIDmode, hard_frame_pointer_rtx));
- emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
- emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
- emit_indirect_jump (lab);
- }
-
- return const0_rtx;
- }
-
- default: /* just do library call, if unknown builtin */
- error ("built-in function `%s' not currently supported",
- IDENTIFIER_POINTER (DECL_NAME (fndecl)));
- }
-
- /* The switch statement above can drop through to cause the function
- to be called normally. */
-
- return expand_call (exp, target, ignore);
-}
-
-/* Built-in functions to perform an untyped call and return. */
-
-/* For each register that may be used for calling a function, this
- gives a mode used to copy the register's value. VOIDmode indicates
- the register is not used for calling a function. If the machine
- has register windows, this gives only the outbound registers.
- INCOMING_REGNO gives the corresponding inbound register. */
-static enum machine_mode apply_args_mode[FIRST_PSEUDO_REGISTER];
-
-/* For each register that may be used for returning values, this gives
- a mode used to copy the register's value. VOIDmode indicates the
- register is not used for returning values. If the machine has
- register windows, this gives only the outbound registers.
- INCOMING_REGNO gives the corresponding inbound register. */
-static enum machine_mode apply_result_mode[FIRST_PSEUDO_REGISTER];
-
-/* For each register that may be used for calling a function, this
- gives the offset of that register into the block returned by
- __builtin_apply_args. 0 indicates that the register is not
- used for calling a function. */
-static int apply_args_reg_offset[FIRST_PSEUDO_REGISTER];
-
-/* Return the offset of register REGNO into the block returned by
- __builtin_apply_args. This is not declared static, since it is
- needed in objc-act.c. */
-
-int
-apply_args_register_offset (regno)
- int regno;
-{
- apply_args_size ();
-
- /* Arguments are always put in outgoing registers (in the argument
- block) if such make sense. */
-#ifdef OUTGOING_REGNO
- regno = OUTGOING_REGNO(regno);
-#endif
- return apply_args_reg_offset[regno];
-}
-
-/* Return the size required for the block returned by __builtin_apply_args,
- and initialize apply_args_mode. */
-
-static int
-apply_args_size ()
-{
- static int size = -1;
- int align, regno;
- enum machine_mode mode;
-
- /* The values computed by this function never change. */
- if (size < 0)
- {
- /* The first value is the incoming arg-pointer. */
- size = GET_MODE_SIZE (Pmode);
-
- /* The second value is the structure value address unless this is
- passed as an "invisible" first argument. */
- if (struct_value_rtx)
- size += GET_MODE_SIZE (Pmode);
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (FUNCTION_ARG_REGNO_P (regno))
- {
- /* Search for the proper mode for copying this register's
- value. I'm not sure this is right, but it works so far. */
- enum machine_mode best_mode = VOIDmode;
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if (HARD_REGNO_MODE_OK (regno, mode)
- && HARD_REGNO_NREGS (regno, mode) == 1)
- best_mode = mode;
-
- if (best_mode == VOIDmode)
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if (HARD_REGNO_MODE_OK (regno, mode)
- && (mov_optab->handlers[(int) mode].insn_code
- != CODE_FOR_nothing))
- best_mode = mode;
-
- mode = best_mode;
- if (mode == VOIDmode)
- abort ();
-
- align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
- if (size % align != 0)
- size = CEIL (size, align) * align;
- apply_args_reg_offset[regno] = size;
- size += GET_MODE_SIZE (mode);
- apply_args_mode[regno] = mode;
- }
- else
- {
- apply_args_mode[regno] = VOIDmode;
- apply_args_reg_offset[regno] = 0;
- }
- }
- return size;
-}
-
-/* Return the size required for the block returned by __builtin_apply,
- and initialize apply_result_mode. */
-
-static int
-apply_result_size ()
-{
- static int size = -1;
- int align, regno;
- enum machine_mode mode;
-
- /* The values computed by this function never change. */
- if (size < 0)
- {
- size = 0;
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (FUNCTION_VALUE_REGNO_P (regno))
- {
- /* Search for the proper mode for copying this register's
- value. I'm not sure this is right, but it works so far. */
- enum machine_mode best_mode = VOIDmode;
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- mode != TImode;
- mode = GET_MODE_WIDER_MODE (mode))
- if (HARD_REGNO_MODE_OK (regno, mode))
- best_mode = mode;
-
- if (best_mode == VOIDmode)
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if (HARD_REGNO_MODE_OK (regno, mode)
- && (mov_optab->handlers[(int) mode].insn_code
- != CODE_FOR_nothing))
- best_mode = mode;
-
- mode = best_mode;
- if (mode == VOIDmode)
- abort ();
-
- align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
- if (size % align != 0)
- size = CEIL (size, align) * align;
- size += GET_MODE_SIZE (mode);
- apply_result_mode[regno] = mode;
- }
- else
- apply_result_mode[regno] = VOIDmode;
-
- /* Allow targets that use untyped_call and untyped_return to override
- the size so that machine-specific information can be stored here. */
-#ifdef APPLY_RESULT_SIZE
- size = APPLY_RESULT_SIZE;
-#endif
- }
- return size;
-}
-
-#if defined (HAVE_untyped_call) || defined (HAVE_untyped_return)
-/* Create a vector describing the result block RESULT. If SAVEP is true,
- the result block is used to save the values; otherwise it is used to
- restore the values. */
-
-static rtx
-result_vector (savep, result)
- int savep;
- rtx result;
-{
- int regno, size, align, nelts;
- enum machine_mode mode;
- rtx reg, mem;
- rtx *savevec = (rtx *) alloca (FIRST_PSEUDO_REGISTER * sizeof (rtx));
-
- size = nelts = 0;
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if ((mode = apply_result_mode[regno]) != VOIDmode)
- {
- align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
- if (size % align != 0)
- size = CEIL (size, align) * align;
- reg = gen_rtx (REG, mode, savep ? regno : INCOMING_REGNO (regno));
- mem = change_address (result, mode,
- plus_constant (XEXP (result, 0), size));
- savevec[nelts++] = (savep
- ? gen_rtx (SET, VOIDmode, mem, reg)
- : gen_rtx (SET, VOIDmode, reg, mem));
- size += GET_MODE_SIZE (mode);
- }
- return gen_rtx (PARALLEL, VOIDmode, gen_rtvec_v (nelts, savevec));
-}
-#endif /* HAVE_untyped_call or HAVE_untyped_return */
-
-/* Save the state required to perform an untyped call with the same
- arguments as were passed to the current function. */
-
-static rtx
-expand_builtin_apply_args ()
-{
- rtx registers;
- int size, align, regno;
- enum machine_mode mode;
-
- /* Create a block where the arg-pointer, structure value address,
- and argument registers can be saved. */
- registers = assign_stack_local (BLKmode, apply_args_size (), -1);
-
- /* Walk past the arg-pointer and structure value address. */
- size = GET_MODE_SIZE (Pmode);
- if (struct_value_rtx)
- size += GET_MODE_SIZE (Pmode);
-
- /* Save each register used in calling a function to the block. */
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if ((mode = apply_args_mode[regno]) != VOIDmode)
- {
- rtx tem;
-
- align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
- if (size % align != 0)
- size = CEIL (size, align) * align;
-
- tem = gen_rtx (REG, mode, INCOMING_REGNO (regno));
-
-#ifdef STACK_REGS
- /* For reg-stack.c's stack register household.
- Compare with a similar piece of code in function.c. */
-
- emit_insn (gen_rtx (USE, mode, tem));
-#endif
-
- emit_move_insn (change_address (registers, mode,
- plus_constant (XEXP (registers, 0),
- size)),
- tem);
- size += GET_MODE_SIZE (mode);
- }
-
- /* Save the arg pointer to the block. */
- emit_move_insn (change_address (registers, Pmode, XEXP (registers, 0)),
- copy_to_reg (virtual_incoming_args_rtx));
- size = GET_MODE_SIZE (Pmode);
-
- /* Save the structure value address unless this is passed as an
- "invisible" first argument. */
- if (struct_value_incoming_rtx)
- {
- emit_move_insn (change_address (registers, Pmode,
- plus_constant (XEXP (registers, 0),
- size)),
- copy_to_reg (struct_value_incoming_rtx));
- size += GET_MODE_SIZE (Pmode);
- }
-
- /* Return the address of the block. */
- return copy_addr_to_reg (XEXP (registers, 0));
-}
-
-/* Perform an untyped call and save the state required to perform an
- untyped return of whatever value was returned by the given function. */
-
-static rtx
-expand_builtin_apply (function, arguments, argsize)
- rtx function, arguments, argsize;
-{
- int size, align, regno;
- enum machine_mode mode;
- rtx incoming_args, result, reg, dest, call_insn;
- rtx old_stack_level = 0;
- rtx call_fusage = 0;
-
- /* Create a block where the return registers can be saved. */
- result = assign_stack_local (BLKmode, apply_result_size (), -1);
-
- /* ??? The argsize value should be adjusted here. */
-
- /* Fetch the arg pointer from the ARGUMENTS block. */
- incoming_args = gen_reg_rtx (Pmode);
- emit_move_insn (incoming_args,
- gen_rtx (MEM, Pmode, arguments));
-#ifndef STACK_GROWS_DOWNWARD
- incoming_args = expand_binop (Pmode, sub_optab, incoming_args, argsize,
- incoming_args, 0, OPTAB_LIB_WIDEN);
-#endif
-
- /* Perform postincrements before actually calling the function. */
- emit_queue ();
-
- /* Push a new argument block and copy the arguments. */
- do_pending_stack_adjust ();
- emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
-
- /* Push a block of memory onto the stack to store the memory arguments.
- Save the address in a register, and copy the memory arguments. ??? I
- haven't figured out how the calling convention macros effect this,
- but it's likely that the source and/or destination addresses in
- the block copy will need updating in machine specific ways. */
- dest = copy_addr_to_reg (push_block (argsize, 0, 0));
- emit_block_move (gen_rtx (MEM, BLKmode, dest),
- gen_rtx (MEM, BLKmode, incoming_args),
- argsize,
- PARM_BOUNDARY / BITS_PER_UNIT);
-
- /* Refer to the argument block. */
- apply_args_size ();
- arguments = gen_rtx (MEM, BLKmode, arguments);
-
- /* Walk past the arg-pointer and structure value address. */
- size = GET_MODE_SIZE (Pmode);
- if (struct_value_rtx)
- size += GET_MODE_SIZE (Pmode);
-
- /* Restore each of the registers previously saved. Make USE insns
- for each of these registers for use in making the call. */
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if ((mode = apply_args_mode[regno]) != VOIDmode)
- {
- align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
- if (size % align != 0)
- size = CEIL (size, align) * align;
- reg = gen_rtx (REG, mode, regno);
- emit_move_insn (reg,
- change_address (arguments, mode,
- plus_constant (XEXP (arguments, 0),
- size)));
-
- use_reg (&call_fusage, reg);
- size += GET_MODE_SIZE (mode);
- }
-
- /* Restore the structure value address unless this is passed as an
- "invisible" first argument. */
- size = GET_MODE_SIZE (Pmode);
- if (struct_value_rtx)
- {
- rtx value = gen_reg_rtx (Pmode);
- emit_move_insn (value,
- change_address (arguments, Pmode,
- plus_constant (XEXP (arguments, 0),
- size)));
- emit_move_insn (struct_value_rtx, value);
- if (GET_CODE (struct_value_rtx) == REG)
- use_reg (&call_fusage, struct_value_rtx);
- size += GET_MODE_SIZE (Pmode);
- }
-
- /* All arguments and registers used for the call are set up by now! */
- function = prepare_call_address (function, NULL_TREE, &call_fusage, 0);
-
- /* Ensure address is valid. SYMBOL_REF is already valid, so no need,
- 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 (function) != SYMBOL_REF)
- function = memory_address (FUNCTION_MODE, function);
-
- /* Generate the actual call instruction and save the return value. */
-#ifdef HAVE_untyped_call
- if (HAVE_untyped_call)
- emit_call_insn (gen_untyped_call (gen_rtx (MEM, FUNCTION_MODE, function),
- result, result_vector (1, result)));
- else
-#endif
-#ifdef HAVE_call_value
- if (HAVE_call_value)
- {
- rtx valreg = 0;
-
- /* Locate the unique return register. It is not possible to
- express a call that sets more than one return register using
- call_value; use untyped_call for that. In fact, untyped_call
- only needs to save the return registers in the given block. */
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if ((mode = apply_result_mode[regno]) != VOIDmode)
- {
- if (valreg)
- abort (); /* HAVE_untyped_call required. */
- valreg = gen_rtx (REG, mode, regno);
- }
-
- emit_call_insn (gen_call_value (valreg,
- gen_rtx (MEM, FUNCTION_MODE, function),
- const0_rtx, NULL_RTX, const0_rtx));
-
- emit_move_insn (change_address (result, GET_MODE (valreg),
- XEXP (result, 0)),
- valreg);
- }
- else
-#endif
- abort ();
-
- /* Find the CALL insn we just emitted. */
- for (call_insn = get_last_insn ();
- call_insn && GET_CODE (call_insn) != CALL_INSN;
- call_insn = PREV_INSN (call_insn))
- ;
-
- if (! call_insn)
- abort ();
-
- /* Put the register usage information on the CALL. If there is already
- some usage information, put ours at the end. */
- if (CALL_INSN_FUNCTION_USAGE (call_insn))
- {
- rtx link;
-
- for (link = CALL_INSN_FUNCTION_USAGE (call_insn); XEXP (link, 1) != 0;
- link = XEXP (link, 1))
- ;
-
- XEXP (link, 1) = call_fusage;
- }
- else
- CALL_INSN_FUNCTION_USAGE (call_insn) = call_fusage;
-
- /* Restore the stack. */
- emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
-
- /* Return the address of the result block. */
- return copy_addr_to_reg (XEXP (result, 0));
-}
-
-/* Perform an untyped return. */
-
-static void
-expand_builtin_return (result)
- rtx result;
-{
- int size, align, regno;
- enum machine_mode mode;
- rtx reg;
- rtx call_fusage = 0;
-
- apply_result_size ();
- result = gen_rtx (MEM, BLKmode, result);
-
-#ifdef HAVE_untyped_return
- if (HAVE_untyped_return)
- {
- emit_jump_insn (gen_untyped_return (result, result_vector (0, result)));
- emit_barrier ();
- return;
- }
-#endif
-
- /* Restore the return value and note that each value is used. */
- size = 0;
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if ((mode = apply_result_mode[regno]) != VOIDmode)
- {
- align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
- if (size % align != 0)
- size = CEIL (size, align) * align;
- reg = gen_rtx (REG, mode, INCOMING_REGNO (regno));
- emit_move_insn (reg,
- change_address (result, mode,
- plus_constant (XEXP (result, 0),
- size)));
-
- push_to_sequence (call_fusage);
- emit_insn (gen_rtx (USE, VOIDmode, reg));
- call_fusage = get_insns ();
- end_sequence ();
- size += GET_MODE_SIZE (mode);
- }
-
- /* Put the USE insns before the return. */
- emit_insns (call_fusage);
-
- /* Return whatever values was restored by jumping directly to the end
- of the function. */
- expand_null_return ();
-}
-
-/* Expand code for a post- or pre- increment or decrement
- and return the RTX for the result.
- POST is 1 for postinc/decrements and 0 for preinc/decrements. */
-
-static rtx
-expand_increment (exp, post, ignore)
- register tree exp;
- int post, ignore;
-{
- register rtx op0, op1;
- register rtx temp, value;
- register tree incremented = TREE_OPERAND (exp, 0);
- optab this_optab = add_optab;
- int icode;
- enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
- int op0_is_copy = 0;
- int single_insn = 0;
- /* 1 means we can't store into OP0 directly,
- because it is a subreg narrower than a word,
- and we don't dare clobber the rest of the word. */
- int bad_subreg = 0;
-
- if (output_bytecode)
- {
- bc_expand_expr (exp);
- return NULL_RTX;
- }
-
- /* Stabilize any component ref that might need to be
- evaluated more than once below. */
- if (!post
- || TREE_CODE (incremented) == BIT_FIELD_REF
- || (TREE_CODE (incremented) == COMPONENT_REF
- && (TREE_CODE (TREE_OPERAND (incremented, 0)) != INDIRECT_REF
- || DECL_BIT_FIELD (TREE_OPERAND (incremented, 1)))))
- incremented = stabilize_reference (incremented);
- /* Nested *INCREMENT_EXPRs can happen in C++. We must force innermost
- ones into save exprs so that they don't accidentally get evaluated
- more than once by the code below. */
- if (TREE_CODE (incremented) == PREINCREMENT_EXPR
- || TREE_CODE (incremented) == PREDECREMENT_EXPR)
- incremented = save_expr (incremented);
-
- /* Compute the operands as RTX.
- Note whether OP0 is the actual lvalue or a copy of it:
- I believe it is a copy iff it is a register or subreg
- and insns were generated in computing it. */
-
- temp = get_last_insn ();
- op0 = expand_expr (incremented, NULL_RTX, VOIDmode, 0);
-
- /* If OP0 is a SUBREG made for a promoted variable, we cannot increment
- in place but instead must do sign- or zero-extension during assignment,
- so we copy it into a new register and let the code below use it as
- a copy.
-
- Note that we can safely modify this SUBREG since it is know not to be
- shared (it was made by the expand_expr call above). */
-
- if (GET_CODE (op0) == SUBREG && SUBREG_PROMOTED_VAR_P (op0))
- {
- if (post)
- SUBREG_REG (op0) = copy_to_reg (SUBREG_REG (op0));
- else
- bad_subreg = 1;
- }
- else if (GET_CODE (op0) == SUBREG
- && GET_MODE_BITSIZE (GET_MODE (op0)) < BITS_PER_WORD)
- {
- /* We cannot increment this SUBREG in place. If we are
- post-incrementing, get a copy of the old value. Otherwise,
- just mark that we cannot increment in place. */
- if (post)
- op0 = copy_to_reg (op0);
- else
- bad_subreg = 1;
- }
-
- op0_is_copy = ((GET_CODE (op0) == SUBREG || GET_CODE (op0) == REG)
- && temp != get_last_insn ());
- op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
-
- /* Decide whether incrementing or decrementing. */
- if (TREE_CODE (exp) == POSTDECREMENT_EXPR
- || TREE_CODE (exp) == PREDECREMENT_EXPR)
- this_optab = sub_optab;
-
- /* Convert decrement by a constant into a negative increment. */
- if (this_optab == sub_optab
- && GET_CODE (op1) == CONST_INT)
- {
- op1 = GEN_INT (- INTVAL (op1));
- this_optab = add_optab;
- }
-
- /* For a preincrement, see if we can do this with a single instruction. */
- if (!post)
- {
- icode = (int) this_optab->handlers[(int) mode].insn_code;
- if (icode != (int) CODE_FOR_nothing
- /* Make sure that OP0 is valid for operands 0 and 1
- of the insn we want to queue. */
- && (*insn_operand_predicate[icode][0]) (op0, mode)
- && (*insn_operand_predicate[icode][1]) (op0, mode)
- && (*insn_operand_predicate[icode][2]) (op1, mode))
- single_insn = 1;
- }
-
- /* If OP0 is not the actual lvalue, but rather a copy in a register,
- then we cannot just increment OP0. We must therefore contrive to
- increment the original value. Then, for postincrement, we can return
- OP0 since it is a copy of the old value. For preincrement, expand here
- unless we can do it with a single insn.
-
- Likewise if storing directly into OP0 would clobber high bits
- we need to preserve (bad_subreg). */
- if (op0_is_copy || (!post && !single_insn) || bad_subreg)
- {
- /* This is the easiest way to increment the value wherever it is.
- Problems with multiple evaluation of INCREMENTED are prevented
- because either (1) it is a component_ref or preincrement,
- in which case it was stabilized above, or (2) it is an array_ref
- with constant index in an array in a register, which is
- safe to reevaluate. */
- tree newexp = build (((TREE_CODE (exp) == POSTDECREMENT_EXPR
- || TREE_CODE (exp) == PREDECREMENT_EXPR)
- ? MINUS_EXPR : PLUS_EXPR),
- TREE_TYPE (exp),
- incremented,
- TREE_OPERAND (exp, 1));
-
- while (TREE_CODE (incremented) == NOP_EXPR
- || TREE_CODE (incremented) == CONVERT_EXPR)
- {
- newexp = convert (TREE_TYPE (incremented), newexp);
- incremented = TREE_OPERAND (incremented, 0);
- }
-
- temp = expand_assignment (incremented, newexp, ! post && ! ignore , 0);
- return post ? op0 : temp;
- }
-
- if (post)
- {
- /* We have a true reference to the value in OP0.
- If there is an insn to add or subtract in this mode, queue it.
- Queueing the increment insn avoids the register shuffling
- that often results if we must increment now and first save
- the old value for subsequent use. */
-
-#if 0 /* Turned off to avoid making extra insn for indexed memref. */
- op0 = stabilize (op0);
-#endif
-
- icode = (int) this_optab->handlers[(int) mode].insn_code;
- if (icode != (int) CODE_FOR_nothing
- /* Make sure that OP0 is valid for operands 0 and 1
- of the insn we want to queue. */
- && (*insn_operand_predicate[icode][0]) (op0, mode)
- && (*insn_operand_predicate[icode][1]) (op0, mode))
- {
- if (! (*insn_operand_predicate[icode][2]) (op1, mode))
- op1 = force_reg (mode, op1);
-
- return enqueue_insn (op0, GEN_FCN (icode) (op0, op0, op1));
- }
- if (icode != (int) CODE_FOR_nothing && GET_CODE (op0) == MEM)
- {
- rtx addr = force_reg (Pmode, XEXP (op0, 0));
- rtx temp, result;
-
- op0 = change_address (op0, VOIDmode, addr);
- temp = force_reg (GET_MODE (op0), op0);
- if (! (*insn_operand_predicate[icode][2]) (op1, mode))
- op1 = force_reg (mode, op1);
-
- /* The increment queue is LIFO, thus we have to `queue'
- the instructions in reverse order. */
- enqueue_insn (op0, gen_move_insn (op0, temp));
- result = enqueue_insn (temp, GEN_FCN (icode) (temp, temp, op1));
- return result;
- }
- }
-
- /* Preincrement, or we can't increment with one simple insn. */
- if (post)
- /* Save a copy of the value before inc or dec, to return it later. */
- temp = value = copy_to_reg (op0);
- else
- /* Arrange to return the incremented value. */
- /* Copy the rtx because expand_binop will protect from the queue,
- and the results of that would be invalid for us to return
- if our caller does emit_queue before using our result. */
- temp = copy_rtx (value = op0);
-
- /* Increment however we can. */
- op1 = expand_binop (mode, this_optab, value, op1, op0,
- TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
- /* Make sure the value is stored into OP0. */
- if (op1 != op0)
- emit_move_insn (op0, op1);
-
- return temp;
-}
-
-/* Expand all function calls contained within EXP, innermost ones first.
- But don't look within expressions that have sequence points.
- For each CALL_EXPR, record the rtx for its value
- in the CALL_EXPR_RTL field. */
-
-static void
-preexpand_calls (exp)
- tree exp;
-{
- register int nops, i;
- int type = TREE_CODE_CLASS (TREE_CODE (exp));
-
- if (! do_preexpand_calls)
- return;
-
- /* Only expressions and references can contain calls. */
-
- if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r')
- return;
-
- switch (TREE_CODE (exp))
- {
- case CALL_EXPR:
- /* Do nothing if already expanded. */
- if (CALL_EXPR_RTL (exp) != 0
- /* Do nothing if the call returns a variable-sized object. */
- || TREE_CODE (TYPE_SIZE (TREE_TYPE(exp))) != INTEGER_CST
- /* Do nothing to built-in functions. */
- || (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
- && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
- == FUNCTION_DECL)
- && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))))
- return;
-
- CALL_EXPR_RTL (exp) = expand_call (exp, NULL_RTX, 0);
- return;
-
- case COMPOUND_EXPR:
- case COND_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- /* If we find one of these, then we can be sure
- the adjust will be done for it (since it makes jumps).
- Do it now, so that if this is inside an argument
- of a function, we don't get the stack adjustment
- after some other args have already been pushed. */
- do_pending_stack_adjust ();
- return;
-
- case BLOCK:
- case RTL_EXPR:
- case WITH_CLEANUP_EXPR:
- case CLEANUP_POINT_EXPR:
- return;
-
- case SAVE_EXPR:
- if (SAVE_EXPR_RTL (exp) != 0)
- return;
- }
-
- nops = tree_code_length[(int) TREE_CODE (exp)];
- for (i = 0; i < nops; i++)
- if (TREE_OPERAND (exp, i) != 0)
- {
- type = TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, i)));
- if (type == 'e' || type == '<' || type == '1' || type == '2'
- || type == 'r')
- preexpand_calls (TREE_OPERAND (exp, i));
- }
-}
-
-/* At the start of a function, record that we have no previously-pushed
- arguments waiting to be popped. */
-
-void
-init_pending_stack_adjust ()
-{
- pending_stack_adjust = 0;
-}
-
-/* When exiting from function, if safe, clear out any pending stack adjust
- so the adjustment won't get done. */
-
-void
-clear_pending_stack_adjust ()
-{
-#ifdef EXIT_IGNORE_STACK
- if (optimize > 0
- && ! flag_omit_frame_pointer && EXIT_IGNORE_STACK
- && ! (DECL_INLINE (current_function_decl) && ! flag_no_inline)
- && ! flag_inline_functions)
- pending_stack_adjust = 0;
-#endif
-}
-
-/* Pop any previously-pushed arguments that have not been popped yet. */
-
-void
-do_pending_stack_adjust ()
-{
- if (inhibit_defer_pop == 0)
- {
- if (pending_stack_adjust != 0)
- adjust_stack (GEN_INT (pending_stack_adjust));
- pending_stack_adjust = 0;
- }
-}
-
-/* Defer the expansion all cleanups up to OLD_CLEANUPS.
- Returns the cleanups to be performed. */
-
-static tree
-defer_cleanups_to (old_cleanups)
- tree old_cleanups;
-{
- tree new_cleanups = NULL_TREE;
- tree cleanups = cleanups_this_call;
- tree last = NULL_TREE;
-
- while (cleanups_this_call != old_cleanups)
- {
- expand_eh_region_end (TREE_VALUE (cleanups_this_call));
- last = cleanups_this_call;
- cleanups_this_call = TREE_CHAIN (cleanups_this_call);
- }
-
- if (last)
- {
- /* Remove the list from the chain of cleanups. */
- TREE_CHAIN (last) = NULL_TREE;
-
- /* reverse them so that we can build them in the right order. */
- cleanups = nreverse (cleanups);
-
- /* All cleanups must be on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
-
- while (cleanups)
- {
- if (new_cleanups)
- new_cleanups = build (COMPOUND_EXPR, TREE_TYPE (new_cleanups),
- TREE_VALUE (cleanups), new_cleanups);
- else
- new_cleanups = TREE_VALUE (cleanups);
-
- cleanups = TREE_CHAIN (cleanups);
- }
-
- pop_obstacks ();
- }
-
- return new_cleanups;
-}
-
-/* Expand all cleanups up to OLD_CLEANUPS.
- Needed here, and also for language-dependent calls. */
-
-void
-expand_cleanups_to (old_cleanups)
- tree old_cleanups;
-{
- while (cleanups_this_call != old_cleanups)
- {
- expand_eh_region_end (TREE_VALUE (cleanups_this_call));
- expand_expr (TREE_VALUE (cleanups_this_call), const0_rtx, VOIDmode, 0);
- cleanups_this_call = TREE_CHAIN (cleanups_this_call);
- }
-}
-
-/* Expand conditional expressions. */
-
-/* Generate code to evaluate EXP and jump to LABEL if the value is zero.
- LABEL is an rtx of code CODE_LABEL, in this function and all the
- functions here. */
-
-void
-jumpifnot (exp, label)
- tree exp;
- rtx label;
-{
- do_jump (exp, label, NULL_RTX);
-}
-
-/* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */
-
-void
-jumpif (exp, label)
- tree exp;
- rtx label;
-{
- do_jump (exp, NULL_RTX, label);
-}
-
-/* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if
- the result is zero, or IF_TRUE_LABEL if the result is one.
- Either of IF_FALSE_LABEL and IF_TRUE_LABEL may be zero,
- meaning fall through in that case.
-
- do_jump always does any pending stack adjust except when it does not
- actually perform a jump. An example where there is no jump
- is when EXP is `(foo (), 0)' and IF_FALSE_LABEL is null.
-
- This function is responsible for optimizing cases such as
- &&, || and comparison operators in EXP. */
-
-void
-do_jump (exp, if_false_label, if_true_label)
- tree exp;
- rtx if_false_label, if_true_label;
-{
- register enum tree_code code = TREE_CODE (exp);
- /* Some cases need to create a label to jump to
- in order to properly fall through.
- These cases set DROP_THROUGH_LABEL nonzero. */
- rtx drop_through_label = 0;
- rtx temp;
- rtx comparison = 0;
- int i;
- tree type;
- enum machine_mode mode;
-
- emit_queue ();
-
- switch (code)
- {
- case ERROR_MARK:
- break;
-
- case INTEGER_CST:
- temp = integer_zerop (exp) ? if_false_label : if_true_label;
- if (temp)
- emit_jump (temp);
- break;
-
-#if 0
- /* This is not true with #pragma weak */
- case ADDR_EXPR:
- /* The address of something can never be zero. */
- if (if_true_label)
- emit_jump (if_true_label);
- break;
-#endif
-
- case NOP_EXPR:
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == COMPONENT_REF
- || TREE_CODE (TREE_OPERAND (exp, 0)) == BIT_FIELD_REF
- || TREE_CODE (TREE_OPERAND (exp, 0)) == ARRAY_REF)
- goto normal;
- case CONVERT_EXPR:
- /* If we are narrowing the operand, we have to do the compare in the
- narrower mode. */
- if ((TYPE_PRECISION (TREE_TYPE (exp))
- < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0)))))
- goto normal;
- case NON_LVALUE_EXPR:
- case REFERENCE_EXPR:
- case ABS_EXPR:
- case NEGATE_EXPR:
- case LROTATE_EXPR:
- case RROTATE_EXPR:
- /* These cannot change zero->non-zero or vice versa. */
- do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
- break;
-
-#if 0
- /* This is never less insns than evaluating the PLUS_EXPR followed by
- a test and can be longer if the test is eliminated. */
- case PLUS_EXPR:
- /* Reduce to minus. */
- exp = build (MINUS_EXPR, TREE_TYPE (exp),
- TREE_OPERAND (exp, 0),
- fold (build1 (NEGATE_EXPR, TREE_TYPE (TREE_OPERAND (exp, 1)),
- TREE_OPERAND (exp, 1))));
- /* Process as MINUS. */
-#endif
-
- case MINUS_EXPR:
- /* Non-zero iff operands of minus differ. */
- comparison = compare (build (NE_EXPR, TREE_TYPE (exp),
- TREE_OPERAND (exp, 0),
- TREE_OPERAND (exp, 1)),
- NE, NE);
- break;
-
- case BIT_AND_EXPR:
- /* If we are AND'ing with a small constant, do this comparison in the
- smallest type that fits. If the machine doesn't have comparisons
- that small, it will be converted back to the wider comparison.
- This helps if we are testing the sign bit of a narrower object.
- combine can't do this for us because it can't know whether a
- ZERO_EXTRACT or a compare in a smaller mode exists, but we do. */
-
- if (! SLOW_BYTE_ACCESS
- && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
- && TYPE_PRECISION (TREE_TYPE (exp)) <= HOST_BITS_PER_WIDE_INT
- && (i = floor_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))) >= 0
- && (mode = mode_for_size (i + 1, MODE_INT, 0)) != BLKmode
- && (type = type_for_mode (mode, 1)) != 0
- && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
- && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
- != CODE_FOR_nothing))
- {
- do_jump (convert (type, exp), if_false_label, if_true_label);
- break;
- }
- goto normal;
-
- case TRUTH_NOT_EXPR:
- do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
- break;
-
- case TRUTH_ANDIF_EXPR:
- {
- rtx seq1, seq2;
- tree cleanups, old_cleanups;
-
- if (if_false_label == 0)
- if_false_label = drop_through_label = gen_label_rtx ();
- start_sequence ();
- do_jump (TREE_OPERAND (exp, 0), if_false_label, NULL_RTX);
- seq1 = get_insns ();
- end_sequence ();
-
- old_cleanups = cleanups_this_call;
- start_sequence ();
- do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
- seq2 = get_insns ();
- cleanups = defer_cleanups_to (old_cleanups);
- end_sequence ();
-
- if (cleanups)
- {
- rtx flag = gen_reg_rtx (word_mode);
- tree new_cleanups;
- tree cond;
-
- /* Flag cleanups as not needed. */
- emit_move_insn (flag, const0_rtx);
- emit_insns (seq1);
-
- /* Flag cleanups as needed. */
- emit_move_insn (flag, const1_rtx);
- emit_insns (seq2);
-
- /* All cleanups must be on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
-
- /* convert flag, which is an rtx, into a tree. */
- cond = make_node (RTL_EXPR);
- TREE_TYPE (cond) = integer_type_node;
- RTL_EXPR_RTL (cond) = flag;
- RTL_EXPR_SEQUENCE (cond) = NULL_RTX;
- cond = save_expr (cond);
-
- new_cleanups = build (COND_EXPR, void_type_node,
- truthvalue_conversion (cond),
- cleanups, integer_zero_node);
- new_cleanups = fold (new_cleanups);
-
- pop_obstacks ();
-
- /* Now add in the conditionalized cleanups. */
- cleanups_this_call
- = tree_cons (NULL_TREE, new_cleanups, cleanups_this_call);
- expand_eh_region_start ();
- }
- else
- {
- emit_insns (seq1);
- emit_insns (seq2);
- }
- }
- break;
-
- case TRUTH_ORIF_EXPR:
- {
- rtx seq1, seq2;
- tree cleanups, old_cleanups;
-
- if (if_true_label == 0)
- if_true_label = drop_through_label = gen_label_rtx ();
- start_sequence ();
- do_jump (TREE_OPERAND (exp, 0), NULL_RTX, if_true_label);
- seq1 = get_insns ();
- end_sequence ();
-
- old_cleanups = cleanups_this_call;
- start_sequence ();
- do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
- seq2 = get_insns ();
- cleanups = defer_cleanups_to (old_cleanups);
- end_sequence ();
-
- if (cleanups)
- {
- rtx flag = gen_reg_rtx (word_mode);
- tree new_cleanups;
- tree cond;
-
- /* Flag cleanups as not needed. */
- emit_move_insn (flag, const0_rtx);
- emit_insns (seq1);
-
- /* Flag cleanups as needed. */
- emit_move_insn (flag, const1_rtx);
- emit_insns (seq2);
-
- /* All cleanups must be on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
-
- /* convert flag, which is an rtx, into a tree. */
- cond = make_node (RTL_EXPR);
- TREE_TYPE (cond) = integer_type_node;
- RTL_EXPR_RTL (cond) = flag;
- RTL_EXPR_SEQUENCE (cond) = NULL_RTX;
- cond = save_expr (cond);
-
- new_cleanups = build (COND_EXPR, void_type_node,
- truthvalue_conversion (cond),
- cleanups, integer_zero_node);
- new_cleanups = fold (new_cleanups);
-
- pop_obstacks ();
-
- /* Now add in the conditionalized cleanups. */
- cleanups_this_call
- = tree_cons (NULL_TREE, new_cleanups, cleanups_this_call);
- expand_eh_region_start ();
- }
- else
- {
- emit_insns (seq1);
- emit_insns (seq2);
- }
- }
- break;
-
- case COMPOUND_EXPR:
- push_temp_slots ();
- expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
- preserve_temp_slots (NULL_RTX);
- free_temp_slots ();
- pop_temp_slots ();
- emit_queue ();
- do_pending_stack_adjust ();
- do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
- break;
-
- case COMPONENT_REF:
- case BIT_FIELD_REF:
- case ARRAY_REF:
- {
- int bitsize, bitpos, unsignedp;
- enum machine_mode mode;
- tree type;
- tree offset;
- int volatilep = 0;
- int alignment;
-
- /* Get description of this reference. We don't actually care
- about the underlying object here. */
- get_inner_reference (exp, &bitsize, &bitpos, &offset,
- &mode, &unsignedp, &volatilep,
- &alignment);
-
- type = type_for_size (bitsize, unsignedp);
- if (! SLOW_BYTE_ACCESS
- && type != 0 && bitsize >= 0
- && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
- && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
- != CODE_FOR_nothing))
- {
- do_jump (convert (type, exp), if_false_label, if_true_label);
- break;
- }
- goto normal;
- }
-
- case COND_EXPR:
- /* Do (a ? 1 : 0) and (a ? 0 : 1) as special cases. */
- if (integer_onep (TREE_OPERAND (exp, 1))
- && integer_zerop (TREE_OPERAND (exp, 2)))
- do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
-
- else if (integer_zerop (TREE_OPERAND (exp, 1))
- && integer_onep (TREE_OPERAND (exp, 2)))
- do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
-
- else
- {
- rtx seq1, seq2;
- tree cleanups_left_side, cleanups_right_side, old_cleanups;
-
- register rtx label1 = gen_label_rtx ();
- drop_through_label = gen_label_rtx ();
-
- do_jump (TREE_OPERAND (exp, 0), label1, NULL_RTX);
-
- /* We need to save the cleanups for the lhs and rhs separately.
- Keep track of the cleanups seen before the lhs. */
- old_cleanups = cleanups_this_call;
- start_sequence ();
- /* Now the THEN-expression. */
- do_jump (TREE_OPERAND (exp, 1),
- if_false_label ? if_false_label : drop_through_label,
- if_true_label ? if_true_label : drop_through_label);
- /* In case the do_jump just above never jumps. */
- do_pending_stack_adjust ();
- emit_label (label1);
- seq1 = get_insns ();
- /* Now grab the cleanups for the lhs. */
- cleanups_left_side = defer_cleanups_to (old_cleanups);
- end_sequence ();
-
- /* And keep track of where we start before the rhs. */
- old_cleanups = cleanups_this_call;
- start_sequence ();
- /* Now the ELSE-expression. */
- do_jump (TREE_OPERAND (exp, 2),
- if_false_label ? if_false_label : drop_through_label,
- if_true_label ? if_true_label : drop_through_label);
- seq2 = get_insns ();
- /* Grab the cleanups for the rhs. */
- cleanups_right_side = defer_cleanups_to (old_cleanups);
- end_sequence ();
-
- if (cleanups_left_side || cleanups_right_side)
- {
- /* Make the cleanups for the THEN and ELSE clauses
- conditional based on which half is executed. */
- rtx flag = gen_reg_rtx (word_mode);
- tree new_cleanups;
- tree cond;
-
- /* Set the flag to 0 so that we know we executed the lhs. */
- emit_move_insn (flag, const0_rtx);
- emit_insns (seq1);
-
- /* Set the flag to 1 so that we know we executed the rhs. */
- emit_move_insn (flag, const1_rtx);
- emit_insns (seq2);
-
- /* Make sure the cleanup lives on the function_obstack. */
- push_obstacks_nochange ();
- resume_temporary_allocation ();
-
- /* Now, build up a COND_EXPR that tests the value of the
- flag, and then either do the cleanups for the lhs or the
- rhs. */
- cond = make_node (RTL_EXPR);
- TREE_TYPE (cond) = integer_type_node;
- RTL_EXPR_RTL (cond) = flag;
- RTL_EXPR_SEQUENCE (cond) = NULL_RTX;
- cond = save_expr (cond);
-
- new_cleanups = build (COND_EXPR, void_type_node,
- truthvalue_conversion (cond),
- cleanups_right_side, cleanups_left_side);
- new_cleanups = fold (new_cleanups);
-
- pop_obstacks ();
-
- /* Now add in the conditionalized cleanups. */
- cleanups_this_call
- = tree_cons (NULL_TREE, new_cleanups, cleanups_this_call);
- expand_eh_region_start ();
- }
- else
- {
- /* No cleanups were needed, so emit the two sequences
- directly. */
- emit_insns (seq1);
- emit_insns (seq2);
- }
- }
- break;
-
- case EQ_EXPR:
- {
- tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
-
- if (integer_zerop (TREE_OPERAND (exp, 1)))
- do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
- else if (GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_COMPLEX_FLOAT
- || GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_COMPLEX_INT)
- do_jump
- (fold
- (build (TRUTH_ANDIF_EXPR, TREE_TYPE (exp),
- fold (build (EQ_EXPR, TREE_TYPE (exp),
- fold (build1 (REALPART_EXPR,
- TREE_TYPE (inner_type),
- TREE_OPERAND (exp, 0))),
- fold (build1 (REALPART_EXPR,
- TREE_TYPE (inner_type),
- TREE_OPERAND (exp, 1))))),
- fold (build (EQ_EXPR, TREE_TYPE (exp),
- fold (build1 (IMAGPART_EXPR,
- TREE_TYPE (inner_type),
- TREE_OPERAND (exp, 0))),
- fold (build1 (IMAGPART_EXPR,
- TREE_TYPE (inner_type),
- TREE_OPERAND (exp, 1))))))),
- if_false_label, if_true_label);
- else if (GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_INT
- && !can_compare_p (TYPE_MODE (inner_type)))
- do_jump_by_parts_equality (exp, if_false_label, if_true_label);
- else
- comparison = compare (exp, EQ, EQ);
- break;
- }
-
- case NE_EXPR:
- {
- tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
-
- if (integer_zerop (TREE_OPERAND (exp, 1)))
- do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
- else if (GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_COMPLEX_FLOAT
- || GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_COMPLEX_INT)
- do_jump
- (fold
- (build (TRUTH_ORIF_EXPR, TREE_TYPE (exp),
- fold (build (NE_EXPR, TREE_TYPE (exp),
- fold (build1 (REALPART_EXPR,
- TREE_TYPE (inner_type),
- TREE_OPERAND (exp, 0))),
- fold (build1 (REALPART_EXPR,
- TREE_TYPE (inner_type),
- TREE_OPERAND (exp, 1))))),
- fold (build (NE_EXPR, TREE_TYPE (exp),
- fold (build1 (IMAGPART_EXPR,
- TREE_TYPE (inner_type),
- TREE_OPERAND (exp, 0))),
- fold (build1 (IMAGPART_EXPR,
- TREE_TYPE (inner_type),
- TREE_OPERAND (exp, 1))))))),
- if_false_label, if_true_label);
- else if (GET_MODE_CLASS (TYPE_MODE (inner_type)) == MODE_INT
- && !can_compare_p (TYPE_MODE (inner_type)))
- do_jump_by_parts_equality (exp, if_true_label, if_false_label);
- else
- comparison = compare (exp, NE, NE);
- break;
- }
-
- case LT_EXPR:
- if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
- == MODE_INT)
- && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
- do_jump_by_parts_greater (exp, 1, if_false_label, if_true_label);
- else
- comparison = compare (exp, LT, LTU);
- break;
-
- case LE_EXPR:
- if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
- == MODE_INT)
- && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
- do_jump_by_parts_greater (exp, 0, if_true_label, if_false_label);
- else
- comparison = compare (exp, LE, LEU);
- break;
-
- case GT_EXPR:
- if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
- == MODE_INT)
- && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
- do_jump_by_parts_greater (exp, 0, if_false_label, if_true_label);
- else
- comparison = compare (exp, GT, GTU);
- break;
-
- case GE_EXPR:
- if ((GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
- == MODE_INT)
- && !can_compare_p (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
- do_jump_by_parts_greater (exp, 1, if_true_label, if_false_label);
- else
- comparison = compare (exp, GE, GEU);
- break;
-
- default:
- normal:
- temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
-#if 0
- /* This is not needed any more and causes poor code since it causes
- comparisons and tests from non-SI objects to have different code
- sequences. */
- /* Copy to register to avoid generating bad insns by cse
- from (set (mem ...) (arithop)) (set (cc0) (mem ...)). */
- if (!cse_not_expected && GET_CODE (temp) == MEM)
- temp = copy_to_reg (temp);
-#endif
- do_pending_stack_adjust ();
- if (GET_CODE (temp) == CONST_INT)
- comparison = (temp == const0_rtx ? const0_rtx : const_true_rtx);
- else if (GET_CODE (temp) == LABEL_REF)
- comparison = const_true_rtx;
- else if (GET_MODE_CLASS (GET_MODE (temp)) == MODE_INT
- && !can_compare_p (GET_MODE (temp)))
- /* Note swapping the labels gives us not-equal. */
- do_jump_by_parts_equality_rtx (temp, if_true_label, if_false_label);
- else if (GET_MODE (temp) != VOIDmode)
- comparison = compare_from_rtx (temp, CONST0_RTX (GET_MODE (temp)),
- NE, TREE_UNSIGNED (TREE_TYPE (exp)),
- GET_MODE (temp), NULL_RTX, 0);
- else
- abort ();
- }
-
- /* Do any postincrements in the expression that was tested. */
- emit_queue ();
-
- /* If COMPARISON is nonzero here, it is an rtx that can be substituted
- straight into a conditional jump instruction as the jump condition.
- Otherwise, all the work has been done already. */
-
- if (comparison == const_true_rtx)
- {
- if (if_true_label)
- emit_jump (if_true_label);
- }
- else if (comparison == const0_rtx)
- {
- if (if_false_label)
- emit_jump (if_false_label);
- }
- else if (comparison)
- do_jump_for_compare (comparison, if_false_label, if_true_label);
-
- if (drop_through_label)
- {
- /* If do_jump produces code that might be jumped around,
- do any stack adjusts from that code, before the place
- where control merges in. */
- do_pending_stack_adjust ();
- emit_label (drop_through_label);
- }
-}
-
-/* Given a comparison expression EXP for values too wide to be compared
- with one insn, test the comparison and jump to the appropriate label.
- The code of EXP is ignored; we always test GT if SWAP is 0,
- and LT if SWAP is 1. */
-
-static void
-do_jump_by_parts_greater (exp, swap, if_false_label, if_true_label)
- tree exp;
- int swap;
- rtx if_false_label, if_true_label;
-{
- rtx op0 = expand_expr (TREE_OPERAND (exp, swap), NULL_RTX, VOIDmode, 0);
- rtx op1 = expand_expr (TREE_OPERAND (exp, !swap), NULL_RTX, VOIDmode, 0);
- enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
- int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD);
- rtx drop_through_label = 0;
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)));
- int i;
-
- if (! if_true_label || ! if_false_label)
- drop_through_label = gen_label_rtx ();
- if (! if_true_label)
- if_true_label = drop_through_label;
- if (! if_false_label)
- if_false_label = drop_through_label;
-
- /* Compare a word at a time, high order first. */
- for (i = 0; i < nwords; i++)
- {
- rtx comp;
- rtx op0_word, op1_word;
-
- if (WORDS_BIG_ENDIAN)
- {
- op0_word = operand_subword_force (op0, i, mode);
- op1_word = operand_subword_force (op1, i, mode);
- }
- else
- {
- op0_word = operand_subword_force (op0, nwords - 1 - i, mode);
- op1_word = operand_subword_force (op1, nwords - 1 - i, mode);
- }
-
- /* All but high-order word must be compared as unsigned. */
- comp = compare_from_rtx (op0_word, op1_word,
- (unsignedp || i > 0) ? GTU : GT,
- unsignedp, word_mode, NULL_RTX, 0);
- if (comp == const_true_rtx)
- emit_jump (if_true_label);
- else if (comp != const0_rtx)
- do_jump_for_compare (comp, NULL_RTX, if_true_label);
-
- /* Consider lower words only if these are equal. */
- comp = compare_from_rtx (op0_word, op1_word, NE, unsignedp, word_mode,
- NULL_RTX, 0);
- if (comp == const_true_rtx)
- emit_jump (if_false_label);
- else if (comp != const0_rtx)
- do_jump_for_compare (comp, NULL_RTX, if_false_label);
- }
-
- if (if_false_label)
- emit_jump (if_false_label);
- if (drop_through_label)
- emit_label (drop_through_label);
-}
-
-/* Compare OP0 with OP1, word at a time, in mode MODE.
- UNSIGNEDP says to do unsigned comparison.
- Jump to IF_TRUE_LABEL if OP0 is greater, IF_FALSE_LABEL otherwise. */
-
-void
-do_jump_by_parts_greater_rtx (mode, unsignedp, op0, op1, if_false_label, if_true_label)
- enum machine_mode mode;
- int unsignedp;
- rtx op0, op1;
- rtx if_false_label, if_true_label;
-{
- int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD);
- rtx drop_through_label = 0;
- int i;
-
- if (! if_true_label || ! if_false_label)
- drop_through_label = gen_label_rtx ();
- if (! if_true_label)
- if_true_label = drop_through_label;
- if (! if_false_label)
- if_false_label = drop_through_label;
-
- /* Compare a word at a time, high order first. */
- for (i = 0; i < nwords; i++)
- {
- rtx comp;
- rtx op0_word, op1_word;
-
- if (WORDS_BIG_ENDIAN)
- {
- op0_word = operand_subword_force (op0, i, mode);
- op1_word = operand_subword_force (op1, i, mode);
- }
- else
- {
- op0_word = operand_subword_force (op0, nwords - 1 - i, mode);
- op1_word = operand_subword_force (op1, nwords - 1 - i, mode);
- }
-
- /* All but high-order word must be compared as unsigned. */
- comp = compare_from_rtx (op0_word, op1_word,
- (unsignedp || i > 0) ? GTU : GT,
- unsignedp, word_mode, NULL_RTX, 0);
- if (comp == const_true_rtx)
- emit_jump (if_true_label);
- else if (comp != const0_rtx)
- do_jump_for_compare (comp, NULL_RTX, if_true_label);
-
- /* Consider lower words only if these are equal. */
- comp = compare_from_rtx (op0_word, op1_word, NE, unsignedp, word_mode,
- NULL_RTX, 0);
- if (comp == const_true_rtx)
- emit_jump (if_false_label);
- else if (comp != const0_rtx)
- do_jump_for_compare (comp, NULL_RTX, if_false_label);
- }
-
- if (if_false_label)
- emit_jump (if_false_label);
- if (drop_through_label)
- emit_label (drop_through_label);
-}
-
-/* Given an EQ_EXPR expression EXP for values too wide to be compared
- with one insn, test the comparison and jump to the appropriate label. */
-
-static void
-do_jump_by_parts_equality (exp, if_false_label, if_true_label)
- tree exp;
- rtx if_false_label, if_true_label;
-{
- rtx op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
- rtx op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
- enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
- int nwords = (GET_MODE_SIZE (mode) / UNITS_PER_WORD);
- int i;
- rtx drop_through_label = 0;
-
- if (! if_false_label)
- drop_through_label = if_false_label = gen_label_rtx ();
-
- for (i = 0; i < nwords; i++)
- {
- rtx comp = compare_from_rtx (operand_subword_force (op0, i, mode),
- operand_subword_force (op1, i, mode),
- EQ, TREE_UNSIGNED (TREE_TYPE (exp)),
- word_mode, NULL_RTX, 0);
- if (comp == const_true_rtx)
- emit_jump (if_false_label);
- else if (comp != const0_rtx)
- do_jump_for_compare (comp, if_false_label, NULL_RTX);
- }
-
- if (if_true_label)
- emit_jump (if_true_label);
- if (drop_through_label)
- emit_label (drop_through_label);
-}
-
-/* Jump according to whether OP0 is 0.
- We assume that OP0 has an integer mode that is too wide
- for the available compare insns. */
-
-static void
-do_jump_by_parts_equality_rtx (op0, if_false_label, if_true_label)
- rtx op0;
- rtx if_false_label, if_true_label;
-{
- int nwords = GET_MODE_SIZE (GET_MODE (op0)) / UNITS_PER_WORD;
- int i;
- rtx drop_through_label = 0;
-
- if (! if_false_label)
- drop_through_label = if_false_label = gen_label_rtx ();
-
- for (i = 0; i < nwords; i++)
- {
- rtx comp = compare_from_rtx (operand_subword_force (op0, i,
- GET_MODE (op0)),
- const0_rtx, EQ, 1, word_mode, NULL_RTX, 0);
- if (comp == const_true_rtx)
- emit_jump (if_false_label);
- else if (comp != const0_rtx)
- do_jump_for_compare (comp, if_false_label, NULL_RTX);
- }
-
- if (if_true_label)
- emit_jump (if_true_label);
- if (drop_through_label)
- emit_label (drop_through_label);
-}
-
-/* Given a comparison expression in rtl form, output conditional branches to
- IF_TRUE_LABEL, IF_FALSE_LABEL, or both. */
-
-static void
-do_jump_for_compare (comparison, if_false_label, if_true_label)
- rtx comparison, if_false_label, if_true_label;
-{
- if (if_true_label)
- {
- if (bcc_gen_fctn[(int) GET_CODE (comparison)] != 0)
- emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_true_label));
- else
- abort ();
-
- if (if_false_label)
- emit_jump (if_false_label);
- }
- else if (if_false_label)
- {
- rtx insn;
- rtx prev = get_last_insn ();
- rtx branch = 0;
-
- /* Output the branch with the opposite condition. Then try to invert
- what is generated. If more than one insn is a branch, or if the
- branch is not the last insn written, abort. If we can't invert
- the branch, emit make a true label, redirect this jump to that,
- emit a jump to the false label and define the true label. */
-
- if (bcc_gen_fctn[(int) GET_CODE (comparison)] != 0)
- emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (comparison)])(if_false_label));
- else
- abort ();
-
- /* Here we get the first insn that was just emitted. It used to be the
- case that, on some machines, emitting the branch would discard
- the previous compare insn and emit a replacement. This isn't
- done anymore, but abort if we see that PREV is deleted. */
-
- if (prev == 0)
- insn = get_insns ();
- else if (INSN_DELETED_P (prev))
- abort ();
- else
- insn = NEXT_INSN (prev);
-
- for (; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == JUMP_INSN)
- {
- if (branch)
- abort ();
- branch = insn;
- }
-
- if (branch != get_last_insn ())
- abort ();
-
- JUMP_LABEL (branch) = if_false_label;
- if (! invert_jump (branch, if_false_label))
- {
- if_true_label = gen_label_rtx ();
- redirect_jump (branch, if_true_label);
- emit_jump (if_false_label);
- emit_label (if_true_label);
- }
- }
-}
-
-/* Generate code for a comparison expression EXP
- (including code to compute the values to be compared)
- and set (CC0) according to the result.
- SIGNED_CODE should be the rtx operation for this comparison for
- signed data; UNSIGNED_CODE, likewise for use if data is unsigned.
-
- We force a stack adjustment unless there are currently
- things pushed on the stack that aren't yet used. */
-
-static rtx
-compare (exp, signed_code, unsigned_code)
- register tree exp;
- enum rtx_code signed_code, unsigned_code;
-{
- register rtx op0
- = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0);
- register rtx op1
- = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
- register tree type = TREE_TYPE (TREE_OPERAND (exp, 0));
- register enum machine_mode mode = TYPE_MODE (type);
- int unsignedp = TREE_UNSIGNED (type);
- enum rtx_code code = unsignedp ? unsigned_code : signed_code;
-
-#ifdef HAVE_canonicalize_funcptr_for_compare
- /* If function pointers need to be "canonicalized" before they can
- be reliably compared, then canonicalize them. */
- if (HAVE_canonicalize_funcptr_for_compare
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))))
- == FUNCTION_TYPE))
- {
- rtx new_op0 = gen_reg_rtx (mode);
-
- emit_insn (gen_canonicalize_funcptr_for_compare (new_op0, op0));
- op0 = new_op0;
- }
-
- if (HAVE_canonicalize_funcptr_for_compare
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 1))) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 1))))
- == FUNCTION_TYPE))
- {
- rtx new_op1 = gen_reg_rtx (mode);
-
- emit_insn (gen_canonicalize_funcptr_for_compare (new_op1, op1));
- op1 = new_op1;
- }
-#endif
-
- return compare_from_rtx (op0, op1, code, unsignedp, mode,
- ((mode == BLKmode)
- ? expr_size (TREE_OPERAND (exp, 0)) : NULL_RTX),
- TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
-}
-
-/* Like compare but expects the values to compare as two rtx's.
- The decision as to signed or unsigned comparison must be made by the caller.
-
- If MODE is BLKmode, SIZE is an RTX giving the size of the objects being
- compared.
-
- If ALIGN is non-zero, it is the alignment of this type; if zero, the
- size of MODE should be used. */
-
-rtx
-compare_from_rtx (op0, op1, code, unsignedp, mode, size, align)
- register rtx op0, op1;
- enum rtx_code code;
- int unsignedp;
- enum machine_mode mode;
- rtx size;
- int align;
-{
- rtx tem;
-
- /* If one operand is constant, make it the second one. Only do this
- if the other operand is not constant as well. */
-
- if ((CONSTANT_P (op0) && ! CONSTANT_P (op1))
- || (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
- {
- tem = op0;
- op0 = op1;
- op1 = tem;
- code = swap_condition (code);
- }
-
- if (flag_force_mem)
- {
- op0 = force_not_mem (op0);
- op1 = force_not_mem (op1);
- }
-
- do_pending_stack_adjust ();
-
- if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT
- && (tem = simplify_relational_operation (code, mode, op0, op1)) != 0)
- return tem;
-
-#if 0
- /* There's no need to do this now that combine.c can eliminate lots of
- sign extensions. This can be less efficient in certain cases on other
- machines. */
-
- /* If this is a signed equality comparison, we can do it as an
- unsigned comparison since zero-extension is cheaper than sign
- extension and comparisons with zero are done as unsigned. This is
- the case even on machines that can do fast sign extension, since
- zero-extension is easier to combine with other operations than
- sign-extension is. If we are comparing against a constant, we must
- convert it to what it would look like unsigned. */
- if ((code == EQ || code == NE) && ! unsignedp
- && GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT)
- {
- if (GET_CODE (op1) == CONST_INT
- && (INTVAL (op1) & GET_MODE_MASK (GET_MODE (op0))) != INTVAL (op1))
- op1 = GEN_INT (INTVAL (op1) & GET_MODE_MASK (GET_MODE (op0)));
- unsignedp = 1;
- }
-#endif
-
- emit_cmp_insn (op0, op1, code, size, mode, unsignedp, align);
-
- return gen_rtx (code, VOIDmode, cc0_rtx, const0_rtx);
-}
-
-/* Generate code to calculate EXP using a store-flag instruction
- and return an rtx for the result. EXP is either a comparison
- or a TRUTH_NOT_EXPR whose operand is a comparison.
-
- If TARGET is nonzero, store the result there if convenient.
-
- If ONLY_CHEAP is non-zero, only do this if it is likely to be very
- cheap.
-
- Return zero if there is no suitable set-flag instruction
- available on this machine.
-
- Once expand_expr has been called on the arguments of the comparison,
- we are committed to doing the store flag, since it is not safe to
- re-evaluate the expression. We emit the store-flag insn by calling
- emit_store_flag, but only expand the arguments if we have a reason
- to believe that emit_store_flag will be successful. If we think that
- it will, but it isn't, we have to simulate the store-flag with a
- set/jump/set sequence. */
-
-static rtx
-do_store_flag (exp, target, mode, only_cheap)
- tree exp;
- rtx target;
- enum machine_mode mode;
- int only_cheap;
-{
- enum rtx_code code;
- tree arg0, arg1, type;
- tree tem;
- enum machine_mode operand_mode;
- int invert = 0;
- int unsignedp;
- rtx op0, op1;
- enum insn_code icode;
- rtx subtarget = target;
- rtx result, label, pattern, jump_pat;
-
- /* If this is a TRUTH_NOT_EXPR, set a flag indicating we must invert the
- result at the end. We can't simply invert the test since it would
- have already been inverted if it were valid. This case occurs for
- some floating-point comparisons. */
-
- if (TREE_CODE (exp) == TRUTH_NOT_EXPR)
- invert = 1, exp = TREE_OPERAND (exp, 0);
-
- arg0 = TREE_OPERAND (exp, 0);
- arg1 = TREE_OPERAND (exp, 1);
- type = TREE_TYPE (arg0);
- operand_mode = TYPE_MODE (type);
- unsignedp = TREE_UNSIGNED (type);
-
- /* We won't bother with BLKmode store-flag operations because it would mean
- passing a lot of information to emit_store_flag. */
- if (operand_mode == BLKmode)
- return 0;
-
- /* We won't bother with store-flag operations involving function pointers
- when function pointers must be canonicalized before comparisons. */
-#ifdef HAVE_canonicalize_funcptr_for_compare
- if (HAVE_canonicalize_funcptr_for_compare
- && ((TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))))
- == FUNCTION_TYPE))
- || (TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 1))) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 1))))
- == FUNCTION_TYPE))))
- return 0;
-#endif
-
- STRIP_NOPS (arg0);
- STRIP_NOPS (arg1);
-
- /* Get the rtx comparison code to use. We know that EXP is a comparison
- operation of some type. Some comparisons against 1 and -1 can be
- converted to comparisons with zero. Do so here so that the tests
- below will be aware that we have a comparison with zero. These
- tests will not catch constants in the first operand, but constants
- are rarely passed as the first operand. */
-
- switch (TREE_CODE (exp))
- {
- case EQ_EXPR:
- code = EQ;
- break;
- case NE_EXPR:
- code = NE;
- break;
- case LT_EXPR:
- if (integer_onep (arg1))
- arg1 = integer_zero_node, code = unsignedp ? LEU : LE;
- else
- code = unsignedp ? LTU : LT;
- break;
- case LE_EXPR:
- if (! unsignedp && integer_all_onesp (arg1))
- arg1 = integer_zero_node, code = LT;
- else
- code = unsignedp ? LEU : LE;
- break;
- case GT_EXPR:
- if (! unsignedp && integer_all_onesp (arg1))
- arg1 = integer_zero_node, code = GE;
- else
- code = unsignedp ? GTU : GT;
- break;
- case GE_EXPR:
- if (integer_onep (arg1))
- arg1 = integer_zero_node, code = unsignedp ? GTU : GT;
- else
- code = unsignedp ? GEU : GE;
- break;
- default:
- abort ();
- }
-
- /* Put a constant second. */
- if (TREE_CODE (arg0) == REAL_CST || TREE_CODE (arg0) == INTEGER_CST)
- {
- tem = arg0; arg0 = arg1; arg1 = tem;
- code = swap_condition (code);
- }
-
- /* If this is an equality or inequality test of a single bit, we can
- do this by shifting the bit being tested to the low-order bit and
- masking the result with the constant 1. If the condition was EQ,
- we xor it with 1. This does not require an scc insn and is faster
- than an scc insn even if we have it. */
-
- if ((code == NE || code == EQ)
- && TREE_CODE (arg0) == BIT_AND_EXPR && integer_zerop (arg1)
- && integer_pow2p (TREE_OPERAND (arg0, 1))
- && TYPE_PRECISION (type) <= HOST_BITS_PER_WIDE_INT)
- {
- tree inner = TREE_OPERAND (arg0, 0);
- HOST_WIDE_INT tem;
- int bitnum;
- int ops_unsignedp;
-
- tem = INTVAL (expand_expr (TREE_OPERAND (arg0, 1),
- NULL_RTX, VOIDmode, 0));
- /* In this case, immed_double_const will sign extend the value to make
- it look the same on the host and target. We must remove the
- sign-extension before calling exact_log2, since exact_log2 will
- fail for negative values. */
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT
- && BITS_PER_WORD == GET_MODE_BITSIZE (TYPE_MODE (type)))
- /* We don't use the obvious constant shift to generate the mask,
- because that generates compiler warnings when BITS_PER_WORD is
- greater than or equal to HOST_BITS_PER_WIDE_INT, even though this
- code is unreachable in that case. */
- tem = tem & GET_MODE_MASK (word_mode);
- bitnum = exact_log2 (tem);
-
- /* If INNER is a right shift of a constant and it plus BITNUM does
- not overflow, adjust BITNUM and INNER. */
-
- if (TREE_CODE (inner) == RSHIFT_EXPR
- && TREE_CODE (TREE_OPERAND (inner, 1)) == INTEGER_CST
- && TREE_INT_CST_HIGH (TREE_OPERAND (inner, 1)) == 0
- && (bitnum + TREE_INT_CST_LOW (TREE_OPERAND (inner, 1))
- < TYPE_PRECISION (type)))
- {
- bitnum +=TREE_INT_CST_LOW (TREE_OPERAND (inner, 1));
- inner = TREE_OPERAND (inner, 0);
- }
-
- /* If we are going to be able to omit the AND below, we must do our
- operations as unsigned. If we must use the AND, we have a choice.
- Normally unsigned is faster, but for some machines signed is. */
- ops_unsignedp = (bitnum == TYPE_PRECISION (type) - 1 ? 1
-#ifdef LOAD_EXTEND_OP
- : (LOAD_EXTEND_OP (operand_mode) == SIGN_EXTEND ? 0 : 1)
-#else
- : 1
-#endif
- );
-
- if (subtarget == 0 || GET_CODE (subtarget) != REG
- || GET_MODE (subtarget) != operand_mode
- || ! safe_from_p (subtarget, inner))
- subtarget = 0;
-
- op0 = expand_expr (inner, subtarget, VOIDmode, 0);
-
- if (bitnum != 0)
- op0 = expand_shift (RSHIFT_EXPR, GET_MODE (op0), op0,
- size_int (bitnum), subtarget, ops_unsignedp);
-
- if (GET_MODE (op0) != mode)
- op0 = convert_to_mode (mode, op0, ops_unsignedp);
-
- if ((code == EQ && ! invert) || (code == NE && invert))
- op0 = expand_binop (mode, xor_optab, op0, const1_rtx, subtarget,
- ops_unsignedp, OPTAB_LIB_WIDEN);
-
- /* Put the AND last so it can combine with more things. */
- if (bitnum != TYPE_PRECISION (type) - 1)
- op0 = expand_and (op0, const1_rtx, subtarget);
-
- return op0;
- }
-
- /* Now see if we are likely to be able to do this. Return if not. */
- if (! can_compare_p (operand_mode))
- return 0;
- icode = setcc_gen_code[(int) code];
- if (icode == CODE_FOR_nothing
- || (only_cheap && insn_operand_mode[(int) icode][0] != mode))
- {
- /* We can only do this if it is one of the special cases that
- can be handled without an scc insn. */
- if ((code == LT && integer_zerop (arg1))
- || (! only_cheap && code == GE && integer_zerop (arg1)))
- ;
- else if (BRANCH_COST >= 0
- && ! only_cheap && (code == NE || code == EQ)
- && TREE_CODE (type) != REAL_TYPE
- && ((abs_optab->handlers[(int) operand_mode].insn_code
- != CODE_FOR_nothing)
- || (ffs_optab->handlers[(int) operand_mode].insn_code
- != CODE_FOR_nothing)))
- ;
- else
- return 0;
- }
-
- preexpand_calls (exp);
- if (subtarget == 0 || GET_CODE (subtarget) != REG
- || GET_MODE (subtarget) != operand_mode
- || ! safe_from_p (subtarget, arg1))
- subtarget = 0;
-
- op0 = expand_expr (arg0, subtarget, VOIDmode, 0);
- op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
-
- if (target == 0)
- target = gen_reg_rtx (mode);
-
- /* Pass copies of OP0 and OP1 in case they contain a QUEUED. This is safe
- because, if the emit_store_flag does anything it will succeed and
- OP0 and OP1 will not be used subsequently. */
-
- result = emit_store_flag (target, code,
- queued_subexp_p (op0) ? copy_rtx (op0) : op0,
- queued_subexp_p (op1) ? copy_rtx (op1) : op1,
- operand_mode, unsignedp, 1);
-
- if (result)
- {
- if (invert)
- result = expand_binop (mode, xor_optab, result, const1_rtx,
- result, 0, OPTAB_LIB_WIDEN);
- return result;
- }
-
- /* If this failed, we have to do this with set/compare/jump/set code. */
- if (GET_CODE (target) != REG
- || reg_mentioned_p (target, op0) || reg_mentioned_p (target, op1))
- target = gen_reg_rtx (GET_MODE (target));
-
- emit_move_insn (target, invert ? const0_rtx : const1_rtx);
- result = compare_from_rtx (op0, op1, code, unsignedp,
- operand_mode, NULL_RTX, 0);
- if (GET_CODE (result) == CONST_INT)
- return (((result == const0_rtx && ! invert)
- || (result != const0_rtx && invert))
- ? const0_rtx : const1_rtx);
-
- label = gen_label_rtx ();
- if (bcc_gen_fctn[(int) code] == 0)
- abort ();
-
- emit_jump_insn ((*bcc_gen_fctn[(int) code]) (label));
- emit_move_insn (target, invert ? const1_rtx : const0_rtx);
- emit_label (label);
-
- return target;
-}
-
-/* Generate a tablejump instruction (used for switch statements). */
-
-#ifdef HAVE_tablejump
-
-/* INDEX is the value being switched on, with the lowest value
- in the table already subtracted.
- MODE is its expected mode (needed if INDEX is constant).
- RANGE is the length of the jump table.
- TABLE_LABEL is a CODE_LABEL rtx for the table itself.
-
- DEFAULT_LABEL is a CODE_LABEL rtx to jump to if the
- index value is out of range. */
-
-void
-do_tablejump (index, mode, range, table_label, default_label)
- rtx index, range, table_label, default_label;
- enum machine_mode mode;
-{
- register rtx temp, vector;
-
- /* Do an unsigned comparison (in the proper mode) between the index
- expression and the value which represents the length of the range.
- Since we just finished subtracting the lower bound of the range
- from the index expression, this comparison allows us to simultaneously
- check that the original index expression value is both greater than
- or equal to the minimum value of the range and less than or equal to
- the maximum value of the range. */
-
- emit_cmp_insn (index, range, GTU, NULL_RTX, mode, 1, 0);
- emit_jump_insn (gen_bgtu (default_label));
-
- /* If index is in range, it must fit in Pmode.
- Convert to Pmode so we can index with it. */
- if (mode != Pmode)
- index = convert_to_mode (Pmode, index, 1);
-
- /* Don't let a MEM slip thru, because then INDEX that comes
- out of PIC_CASE_VECTOR_ADDRESS won't be a valid address,
- and break_out_memory_refs will go to work on it and mess it up. */
-#ifdef PIC_CASE_VECTOR_ADDRESS
- if (flag_pic && GET_CODE (index) != REG)
- index = copy_to_mode_reg (Pmode, index);
-#endif
-
- /* If flag_force_addr were to affect this address
- it could interfere with the tricky assumptions made
- about addresses that contain label-refs,
- which may be valid only very near the tablejump itself. */
- /* ??? The only correct use of CASE_VECTOR_MODE is the one inside the
- GET_MODE_SIZE, because this indicates how large insns are. The other
- uses should all be Pmode, because they are addresses. This code
- could fail if addresses and insns are not the same size. */
- index = gen_rtx (PLUS, Pmode,
- gen_rtx (MULT, Pmode, index,
- GEN_INT (GET_MODE_SIZE (CASE_VECTOR_MODE))),
- gen_rtx (LABEL_REF, Pmode, table_label));
-#ifdef PIC_CASE_VECTOR_ADDRESS
- if (flag_pic)
- index = PIC_CASE_VECTOR_ADDRESS (index);
- else
-#endif
- index = memory_address_noforce (CASE_VECTOR_MODE, index);
- temp = gen_reg_rtx (CASE_VECTOR_MODE);
- vector = gen_rtx (MEM, CASE_VECTOR_MODE, index);
- RTX_UNCHANGING_P (vector) = 1;
- convert_move (temp, vector, 0);
-
- emit_jump_insn (gen_tablejump (temp, table_label));
-
-#ifndef CASE_VECTOR_PC_RELATIVE
- /* If we are generating PIC code or if the table is PC-relative, the
- table and JUMP_INSN must be adjacent, so don't output a BARRIER. */
- if (! flag_pic)
- emit_barrier ();
-#endif
-}
-
-#endif /* HAVE_tablejump */
-
-
-/* Emit a suitable bytecode to load a value from memory, assuming a pointer
- to that value is on the top of the stack. The resulting type is TYPE, and
- the source declaration is DECL. */
-
-void
-bc_load_memory (type, decl)
- tree type, decl;
-{
- enum bytecode_opcode opcode;
-
-
- /* Bit fields are special. We only know about signed and
- unsigned ints, and enums. The latter are treated as
- signed integers. */
-
- if (DECL_BIT_FIELD (decl))
- if (TREE_CODE (type) == ENUMERAL_TYPE
- || TREE_CODE (type) == INTEGER_TYPE)
- opcode = TREE_UNSIGNED (type) ? zxloadBI : sxloadBI;
- else
- abort ();
- else
- /* See corresponding comment in bc_store_memory(). */
- if (TYPE_MODE (type) == BLKmode
- || TYPE_MODE (type) == VOIDmode)
- return;
- else
- opcode = mode_to_load_map [(int) TYPE_MODE (type)];
-
- if (opcode == neverneverland)
- abort ();
-
- bc_emit_bytecode (opcode);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-}
-
-
-/* Store the contents of the second stack slot to the address in the
- top stack slot. DECL is the declaration of the destination and is used
- to determine whether we're dealing with a bitfield. */
-
-void
-bc_store_memory (type, decl)
- tree type, decl;
-{
- enum bytecode_opcode opcode;
-
-
- if (DECL_BIT_FIELD (decl))
- {
- if (TREE_CODE (type) == ENUMERAL_TYPE
- || TREE_CODE (type) == INTEGER_TYPE)
- opcode = sstoreBI;
- else
- abort ();
- }
- else
- if (TYPE_MODE (type) == BLKmode)
- {
- /* Copy structure. This expands to a block copy instruction, storeBLK.
- In addition to the arguments expected by the other store instructions,
- it also expects a type size (SImode) on top of the stack, which is the
- structure size in size units (usually bytes). The two first arguments
- are already on the stack; so we just put the size on level 1. For some
- other languages, the size may be variable, this is why we don't encode
- it as a storeBLK literal, but rather treat it as a full-fledged expression. */
-
- bc_expand_expr (TYPE_SIZE (type));
- opcode = storeBLK;
- }
- else
- opcode = mode_to_store_map [(int) TYPE_MODE (type)];
-
- if (opcode == neverneverland)
- abort ();
-
- bc_emit_bytecode (opcode);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-}
-
-
-/* Allocate local stack space sufficient to hold a value of the given
- SIZE at alignment boundary ALIGNMENT bits. ALIGNMENT must be an
- integral power of 2. A special case is locals of type VOID, which
- have size 0 and alignment 1 - any "voidish" SIZE or ALIGNMENT is
- remapped into the corresponding attribute of SI. */
-
-rtx
-bc_allocate_local (size, alignment)
- int size, alignment;
-{
- rtx retval;
- int byte_alignment;
-
- if (size < 0)
- abort ();
-
- /* Normalize size and alignment */
- if (!size)
- size = UNITS_PER_WORD;
-
- if (alignment < BITS_PER_UNIT)
- byte_alignment = 1 << (INT_ALIGN - 1);
- else
- /* Align */
- byte_alignment = alignment / BITS_PER_UNIT;
-
- if (local_vars_size & (byte_alignment - 1))
- local_vars_size += byte_alignment - (local_vars_size & (byte_alignment - 1));
-
- retval = bc_gen_rtx ((char *) 0, local_vars_size, (struct bc_label *) 0);
- local_vars_size += size;
-
- return retval;
-}
-
-
-/* Allocate variable-sized local array. Variable-sized arrays are
- actually pointers to the address in memory where they are stored. */
-
-rtx
-bc_allocate_variable_array (size)
- tree size;
-{
- rtx retval;
- const int ptralign = (1 << (PTR_ALIGN - 1));
-
- /* Align pointer */
- if (local_vars_size & ptralign)
- local_vars_size += ptralign - (local_vars_size & ptralign);
-
- /* Note down local space needed: pointer to block; also return
- dummy rtx */
-
- retval = bc_gen_rtx ((char *) 0, local_vars_size, (struct bc_label *) 0);
- local_vars_size += POINTER_SIZE / BITS_PER_UNIT;
- return retval;
-}
-
-
-/* Push the machine address for the given external variable offset. */
-
-void
-bc_load_externaddr (externaddr)
- rtx externaddr;
-{
- bc_emit_bytecode (constP);
- bc_emit_code_labelref (BYTECODE_LABEL (externaddr),
- BYTECODE_BC_LABEL (externaddr)->offset);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-}
-
-
-/* Like above, but expects an IDENTIFIER. */
-
-void
-bc_load_externaddr_id (id, offset)
- tree id;
- int offset;
-{
- if (!IDENTIFIER_POINTER (id))
- abort ();
-
- bc_emit_bytecode (constP);
- bc_emit_code_labelref (xstrdup (IDENTIFIER_POINTER (id)), offset);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-}
-
-
-/* Push the machine address for the given local variable offset. */
-
-void
-bc_load_localaddr (localaddr)
- rtx localaddr;
-{
- bc_emit_instruction (localP, (HOST_WIDE_INT) BYTECODE_BC_LABEL (localaddr)->offset);
-}
-
-
-/* Push the machine address for the given parameter offset.
- NOTE: offset is in bits. */
-
-void
-bc_load_parmaddr (parmaddr)
- rtx parmaddr;
-{
- bc_emit_instruction (argP, ((HOST_WIDE_INT) BYTECODE_BC_LABEL (parmaddr)->offset
- / BITS_PER_UNIT));
-}
-
-
-/* Convert a[i] into *(a + i). */
-
-tree
-bc_canonicalize_array_ref (exp)
- tree exp;
-{
- tree type = TREE_TYPE (exp);
- tree array_adr = build1 (ADDR_EXPR, TYPE_POINTER_TO (type),
- TREE_OPERAND (exp, 0));
- tree index = TREE_OPERAND (exp, 1);
-
-
- /* Convert the integer argument to a type the same size as a pointer
- so the multiply won't overflow spuriously. */
-
- if (TYPE_PRECISION (TREE_TYPE (index)) != POINTER_SIZE)
- index = convert (type_for_size (POINTER_SIZE, 0), index);
-
- /* The array address isn't volatile even if the array is.
- (Of course this isn't terribly relevant since the bytecode
- translator treats nearly everything as volatile anyway.) */
- TREE_THIS_VOLATILE (array_adr) = 0;
-
- return build1 (INDIRECT_REF, type,
- fold (build (PLUS_EXPR,
- TYPE_POINTER_TO (type),
- array_adr,
- fold (build (MULT_EXPR,
- TYPE_POINTER_TO (type),
- index,
- size_in_bytes (type))))));
-}
-
-
-/* Load the address of the component referenced by the given
- COMPONENT_REF expression.
-
- Returns innermost lvalue. */
-
-tree
-bc_expand_component_address (exp)
- tree exp;
-{
- tree tem, chain;
- enum machine_mode mode;
- int bitpos = 0;
- HOST_WIDE_INT SIval;
-
-
- tem = TREE_OPERAND (exp, 1);
- mode = DECL_MODE (tem);
-
-
- /* Compute cumulative bit offset for nested component refs
- and array refs, and find the ultimate containing object. */
-
- for (tem = exp;; tem = TREE_OPERAND (tem, 0))
- {
- if (TREE_CODE (tem) == COMPONENT_REF)
- bitpos += TREE_INT_CST_LOW (DECL_FIELD_BITPOS (TREE_OPERAND (tem, 1)));
- else
- if (TREE_CODE (tem) == ARRAY_REF
- && TREE_CODE (TREE_OPERAND (tem, 1)) == INTEGER_CST
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (tem))) == INTEGER_CST)
-
- bitpos += (TREE_INT_CST_LOW (TREE_OPERAND (tem, 1))
- * TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)))
- /* * TYPE_SIZE_UNIT (TREE_TYPE (tem)) */);
- else
- break;
- }
-
- bc_expand_expr (tem);
-
-
- /* For bitfields also push their offset and size */
- if (DECL_BIT_FIELD (TREE_OPERAND (exp, 1)))
- bc_push_offset_and_size (bitpos, /* DECL_SIZE_UNIT */ (TREE_OPERAND (exp, 1)));
- else
- if (SIval = bitpos / BITS_PER_UNIT)
- bc_emit_instruction (addconstPSI, SIval);
-
- return (TREE_OPERAND (exp, 1));
-}
-
-
-/* Emit code to push two SI constants */
-
-void
-bc_push_offset_and_size (offset, size)
- HOST_WIDE_INT offset, size;
-{
- bc_emit_instruction (constSI, offset);
- bc_emit_instruction (constSI, size);
-}
-
-
-/* Emit byte code to push the address of the given lvalue expression to
- the stack. If it's a bit field, we also push offset and size info.
-
- Returns innermost component, which allows us to determine not only
- its type, but also whether it's a bitfield. */
-
-tree
-bc_expand_address (exp)
- tree exp;
-{
- /* Safeguard */
- if (!exp || TREE_CODE (exp) == ERROR_MARK)
- return (exp);
-
-
- switch (TREE_CODE (exp))
- {
- case ARRAY_REF:
-
- return (bc_expand_address (bc_canonicalize_array_ref (exp)));
-
- case COMPONENT_REF:
-
- return (bc_expand_component_address (exp));
-
- case INDIRECT_REF:
-
- bc_expand_expr (TREE_OPERAND (exp, 0));
-
- /* For variable-sized types: retrieve pointer. Sometimes the
- TYPE_SIZE tree is NULL. Is this a bug or a feature? Let's
- also make sure we have an operand, just in case... */
-
- if (TREE_OPERAND (exp, 0)
- && TYPE_SIZE (TREE_TYPE (TREE_OPERAND (exp, 0)))
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_OPERAND (exp, 0)))) != INTEGER_CST)
- bc_emit_instruction (loadP);
-
- /* If packed, also return offset and size */
- if (DECL_BIT_FIELD (TREE_OPERAND (exp, 0)))
-
- bc_push_offset_and_size (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (TREE_OPERAND (exp, 0))),
- TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (exp, 0))));
-
- return (TREE_OPERAND (exp, 0));
-
- case FUNCTION_DECL:
-
- bc_load_externaddr_id (DECL_ASSEMBLER_NAME (exp),
- BYTECODE_BC_LABEL (DECL_RTL (exp))->offset);
- break;
-
- case PARM_DECL:
-
- bc_load_parmaddr (DECL_RTL (exp));
-
- /* For variable-sized types: retrieve pointer */
- if (TYPE_SIZE (TREE_TYPE (exp))
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST)
- bc_emit_instruction (loadP);
-
- /* If packed, also return offset and size */
- if (DECL_BIT_FIELD (exp))
- bc_push_offset_and_size (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (exp)),
- TREE_INT_CST_LOW (DECL_SIZE (exp)));
-
- break;
-
- case RESULT_DECL:
-
- bc_emit_instruction (returnP);
- break;
-
- case VAR_DECL:
-
-#if 0
- if (BYTECODE_LABEL (DECL_RTL (exp)))
- bc_load_externaddr (DECL_RTL (exp));
-#endif
-
- if (DECL_EXTERNAL (exp))
- bc_load_externaddr_id (DECL_ASSEMBLER_NAME (exp),
- (BYTECODE_BC_LABEL (DECL_RTL (exp)))->offset);
- else
- bc_load_localaddr (DECL_RTL (exp));
-
- /* For variable-sized types: retrieve pointer */
- if (TYPE_SIZE (TREE_TYPE (exp))
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST)
- bc_emit_instruction (loadP);
-
- /* If packed, also return offset and size */
- if (DECL_BIT_FIELD (exp))
- bc_push_offset_and_size (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (exp)),
- TREE_INT_CST_LOW (DECL_SIZE (exp)));
-
- break;
-
- case STRING_CST:
- {
- rtx r;
-
- bc_emit_bytecode (constP);
- r = output_constant_def (exp);
- bc_emit_code_labelref (BYTECODE_LABEL (r), BYTECODE_BC_LABEL (r)->offset);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
- }
- break;
-
- default:
-
- abort();
- break;
- }
-
- /* Most lvalues don't have components. */
- return (exp);
-}
-
-
-/* Emit a type code to be used by the runtime support in handling
- parameter passing. The type code consists of the machine mode
- plus the minimal alignment shifted left 8 bits. */
-
-tree
-bc_runtime_type_code (type)
- tree type;
-{
- int val;
-
- switch (TREE_CODE (type))
- {
- case VOID_TYPE:
- case INTEGER_TYPE:
- case REAL_TYPE:
- case COMPLEX_TYPE:
- case ENUMERAL_TYPE:
- case POINTER_TYPE:
- case RECORD_TYPE:
-
- val = (int) TYPE_MODE (type) | TYPE_ALIGN (type) << 8;
- break;
-
- case ERROR_MARK:
-
- val = 0;
- break;
-
- default:
-
- abort ();
- }
- return build_int_2 (val, 0);
-}
-
-
-/* Generate constructor label */
-
-char *
-bc_gen_constr_label ()
-{
- static int label_counter;
- static char label[20];
-
- sprintf (label, "*LR%d", label_counter++);
-
- return (obstack_copy0 (&permanent_obstack, label, strlen (label)));
-}
-
-
-/* Evaluate constructor CONSTR and return pointer to it on level one. We
- expand the constructor data as static data, and push a pointer to it.
- The pointer is put in the pointer table and is retrieved by a constP
- bytecode instruction. We then loop and store each constructor member in
- the corresponding component. Finally, we return the original pointer on
- the stack. */
-
-void
-bc_expand_constructor (constr)
- tree constr;
-{
- char *l;
- HOST_WIDE_INT ptroffs;
- rtx constr_rtx;
-
-
- /* Literal constructors are handled as constants, whereas
- non-literals are evaluated and stored element by element
- into the data segment. */
-
- /* Allocate space in proper segment and push pointer to space on stack.
- */
-
- l = bc_gen_constr_label ();
-
- if (TREE_CONSTANT (constr))
- {
- text_section ();
-
- bc_emit_const_labeldef (l);
- bc_output_constructor (constr, int_size_in_bytes (TREE_TYPE (constr)));
- }
- else
- {
- data_section ();
-
- bc_emit_data_labeldef (l);
- bc_output_data_constructor (constr);
- }
-
-
- /* Add reference to pointer table and recall pointer to stack;
- this code is common for both types of constructors: literals
- and non-literals. */
-
- ptroffs = bc_define_pointer (l);
- bc_emit_instruction (constP, ptroffs);
-
- /* This is all that has to be done if it's a literal. */
- if (TREE_CONSTANT (constr))
- return;
-
-
- /* At this point, we have the pointer to the structure on top of the stack.
- Generate sequences of store_memory calls for the constructor. */
-
- /* constructor type is structure */
- if (TREE_CODE (TREE_TYPE (constr)) == RECORD_TYPE)
- {
- register tree elt;
-
- /* If the constructor has fewer fields than the structure,
- clear the whole structure first. */
-
- if (list_length (CONSTRUCTOR_ELTS (constr))
- != list_length (TYPE_FIELDS (TREE_TYPE (constr))))
- {
- bc_emit_instruction (duplicate);
- bc_emit_instruction (constSI, (HOST_WIDE_INT) int_size_in_bytes (TREE_TYPE (constr)));
- bc_emit_instruction (clearBLK);
- }
-
- /* Store each element of the constructor into the corresponding
- field of TARGET. */
-
- for (elt = CONSTRUCTOR_ELTS (constr); elt; elt = TREE_CHAIN (elt))
- {
- register tree field = TREE_PURPOSE (elt);
- register enum machine_mode mode;
- int bitsize;
- int bitpos;
- int unsignedp;
-
- bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) /* * DECL_SIZE_UNIT (field) */;
- mode = DECL_MODE (field);
- unsignedp = TREE_UNSIGNED (field);
-
- bitpos = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field));
-
- bc_store_field (elt, bitsize, bitpos, mode, TREE_VALUE (elt), TREE_TYPE (TREE_VALUE (elt)),
- /* The alignment of TARGET is
- at least what its type requires. */
- VOIDmode, 0,
- TYPE_ALIGN (TREE_TYPE (constr)) / BITS_PER_UNIT,
- int_size_in_bytes (TREE_TYPE (constr)));
- }
- }
- else
-
- /* Constructor type is array */
- if (TREE_CODE (TREE_TYPE (constr)) == ARRAY_TYPE)
- {
- register tree elt;
- register int i;
- tree domain = TYPE_DOMAIN (TREE_TYPE (constr));
- int minelt = TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain));
- int maxelt = TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain));
- tree elttype = TREE_TYPE (TREE_TYPE (constr));
-
- /* If the constructor has fewer fields than the structure,
- clear the whole structure first. */
-
- if (list_length (CONSTRUCTOR_ELTS (constr)) < maxelt - minelt + 1)
- {
- bc_emit_instruction (duplicate);
- bc_emit_instruction (constSI, (HOST_WIDE_INT) int_size_in_bytes (TREE_TYPE (constr)));
- bc_emit_instruction (clearBLK);
- }
-
-
- /* Store each element of the constructor into the corresponding
- element of TARGET, determined by counting the elements. */
-
- for (elt = CONSTRUCTOR_ELTS (constr), i = 0;
- elt;
- elt = TREE_CHAIN (elt), i++)
- {
- register enum machine_mode mode;
- int bitsize;
- int bitpos;
- int unsignedp;
-
- mode = TYPE_MODE (elttype);
- bitsize = GET_MODE_BITSIZE (mode);
- unsignedp = TREE_UNSIGNED (elttype);
-
- bitpos = (i * TREE_INT_CST_LOW (TYPE_SIZE (elttype))
- /* * TYPE_SIZE_UNIT (elttype) */ );
-
- bc_store_field (elt, bitsize, bitpos, mode,
- TREE_VALUE (elt), TREE_TYPE (TREE_VALUE (elt)),
- /* The alignment of TARGET is
- at least what its type requires. */
- VOIDmode, 0,
- TYPE_ALIGN (TREE_TYPE (constr)) / BITS_PER_UNIT,
- int_size_in_bytes (TREE_TYPE (constr)));
- }
-
- }
-}
-
-
-/* Store the value of EXP (an expression tree) into member FIELD of
- structure at address on stack, which has type TYPE, mode MODE and
- occupies BITSIZE bits, starting BITPOS bits from the beginning of the
- structure.
-
- ALIGN is the alignment that TARGET is known to have, measured in bytes.
- TOTAL_SIZE is its size in bytes, or -1 if variable. */
-
-void
-bc_store_field (field, bitsize, bitpos, mode, exp, type,
- value_mode, unsignedp, align, total_size)
- int bitsize, bitpos;
- enum machine_mode mode;
- tree field, exp, type;
- enum machine_mode value_mode;
- int unsignedp;
- int align;
- int total_size;
-{
-
- /* Expand expression and copy pointer */
- bc_expand_expr (exp);
- bc_emit_instruction (over);
-
-
- /* If the component is a bit field, we cannot use addressing to access
- it. Use bit-field techniques to store in it. */
-
- if (DECL_BIT_FIELD (field))
- {
- bc_store_bit_field (bitpos, bitsize, unsignedp);
- return;
- }
- else
- /* Not bit field */
- {
- HOST_WIDE_INT offset = bitpos / BITS_PER_UNIT;
-
- /* Advance pointer to the desired member */
- if (offset)
- bc_emit_instruction (addconstPSI, offset);
-
- /* Store */
- bc_store_memory (type, field);
- }
-}
-
-
-/* Store SI/SU in bitfield */
-
-void
-bc_store_bit_field (offset, size, unsignedp)
- int offset, size, unsignedp;
-{
- /* Push bitfield offset and size */
- bc_push_offset_and_size (offset, size);
-
- /* Store */
- bc_emit_instruction (sstoreBI);
-}
-
-
-/* Load SI/SU from bitfield */
-
-void
-bc_load_bit_field (offset, size, unsignedp)
- int offset, size, unsignedp;
-{
- /* Push bitfield offset and size */
- bc_push_offset_and_size (offset, size);
-
- /* Load: sign-extend if signed, else zero-extend */
- bc_emit_instruction (unsignedp ? zxloadBI : sxloadBI);
-}
-
-
-/* Adjust interpreter stack by NLEVELS. Positive means drop NLEVELS
- (adjust stack pointer upwards), negative means add that number of
- levels (adjust the stack pointer downwards). Only positive values
- normally make sense. */
-
-void
-bc_adjust_stack (nlevels)
- int nlevels;
-{
- switch (nlevels)
- {
- case 0:
- break;
-
- case 2:
- bc_emit_instruction (drop);
-
- case 1:
- bc_emit_instruction (drop);
- break;
-
- default:
-
- bc_emit_instruction (adjstackSI, (HOST_WIDE_INT) nlevels);
- stack_depth -= nlevels;
- }
-
-#if defined (VALIDATE_STACK_FOR_BC)
- VALIDATE_STACK_FOR_BC ();
-#endif
-}
diff --git a/gcc/expr.h b/gcc/expr.h
deleted file mode 100644
index 573acdf7b0b..00000000000
--- a/gcc/expr.h
+++ /dev/null
@@ -1,874 +0,0 @@
-/* Definitions for code generation pass of GNU compiler.
- Copyright (C) 1987, 91-95, 1996 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. */
-
-/* The default branch cost is 1. */
-#ifndef BRANCH_COST
-#define BRANCH_COST 1
-#endif
-
-/* Macros to access the slots of a QUEUED rtx.
- Here rather than in rtl.h because only the expansion pass
- should ever encounter a QUEUED. */
-
-/* The variable for which an increment is queued. */
-#define QUEUED_VAR(P) XEXP (P, 0)
-/* If the increment has been emitted, this is the insn
- that does the increment. It is zero before the increment is emitted. */
-#define QUEUED_INSN(P) XEXP (P, 1)
-/* If a pre-increment copy has been generated, this is the copy
- (it is a temporary reg). Zero if no copy made yet. */
-#define QUEUED_COPY(P) XEXP (P, 2)
-/* This is the body to use for the insn to do the increment.
- It is used to emit the increment. */
-#define QUEUED_BODY(P) XEXP (P, 3)
-/* Next QUEUED in the queue. */
-#define QUEUED_NEXT(P) XEXP (P, 4)
-
-/* This is the 4th arg to `expand_expr'.
- EXPAND_SUM means it is ok to return a PLUS rtx or MULT rtx.
- EXPAND_INITIALIZER is similar but also record any labels on forced_labels.
- EXPAND_CONST_ADDRESS means it is ok to return a MEM whose address
- is a constant that is not a legitimate address. */
-enum expand_modifier {EXPAND_NORMAL, EXPAND_SUM,
- EXPAND_CONST_ADDRESS, EXPAND_INITIALIZER};
-
-/* List of labels that must never be deleted. */
-extern rtx forced_labels;
-
-/* List (chain of EXPR_LISTs) of pseudo-regs of SAVE_EXPRs.
- So we can mark them all live at the end of the function, if stupid. */
-extern rtx save_expr_regs;
-
-extern int current_function_calls_alloca;
-extern int current_function_outgoing_args_size;
-
-/* This is the offset from the arg pointer to the place where the first
- anonymous arg can be found, if there is one. */
-extern rtx current_function_arg_offset_rtx;
-
-/* This is nonzero if the current function uses the constant pool. */
-extern int current_function_uses_const_pool;
-
-/* This is nonzero if the current function uses pic_offset_table_rtx. */
-extern int current_function_uses_pic_offset_table;
-
-/* The arg pointer hard register, or the pseudo into which it was copied. */
-extern rtx current_function_internal_arg_pointer;
-
-/* Nonzero means stack pops must not be deferred, and deferred stack
- pops must not be output. It is nonzero inside a function call,
- inside a conditional expression, inside a statement expression,
- and in other cases as well. */
-extern int inhibit_defer_pop;
-
-/* Number of function calls seen so far in current function. */
-
-extern int function_call_count;
-
-/* RTX for stack slot that holds the current handler for nonlocal gotos.
- Zero when function does not have nonlocal labels. */
-
-extern rtx nonlocal_goto_handler_slot;
-
-/* RTX for stack slot that holds the stack pointer value to restore
- for a nonlocal goto.
- Zero when function does not have nonlocal labels. */
-
-extern rtx nonlocal_goto_stack_level;
-
-/* List (chain of TREE_LIST) of LABEL_DECLs for all nonlocal labels
- (labels to which there can be nonlocal gotos from nested functions)
- in this function. */
-
-#ifdef TREE_CODE /* Don't lose if tree.h not included. */
-extern tree nonlocal_labels;
-#endif
-
-#define NO_DEFER_POP (inhibit_defer_pop += 1)
-#define OK_DEFER_POP (inhibit_defer_pop -= 1)
-
-/* Number of units that we should eventually pop off the stack.
- These are the arguments to function calls that have already returned. */
-extern int pending_stack_adjust;
-
-/* A list of all cleanups which belong to the arguments of
- function calls being expanded by expand_call. */
-#ifdef TREE_CODE /* Don't lose if tree.h not included. */
-extern tree cleanups_this_call;
-#endif
-
-/* When temporaries are created by TARGET_EXPRs, they are created at
- this level of temp_slot_level, so that they can remain allocated
- until no longer needed. CLEANUP_POINT_EXPRs define the lifetime
- of TARGET_EXPRs. */
-extern int target_temp_slot_level;
-
-#ifdef TREE_CODE /* Don't lose if tree.h not included. */
-/* Structure to record the size of a sequence of arguments
- as the sum of a tree-expression and a constant. */
-
-struct args_size
-{
- int constant;
- tree var;
-};
-#endif
-
-/* Add the value of the tree INC to the `struct args_size' TO. */
-
-#define ADD_PARM_SIZE(TO, INC) \
-{ tree inc = (INC); \
- if (TREE_CODE (inc) == INTEGER_CST) \
- (TO).constant += TREE_INT_CST_LOW (inc); \
- else if ((TO).var == 0) \
- (TO).var = inc; \
- else \
- (TO).var = size_binop (PLUS_EXPR, (TO).var, inc); }
-
-#define SUB_PARM_SIZE(TO, DEC) \
-{ tree dec = (DEC); \
- if (TREE_CODE (dec) == INTEGER_CST) \
- (TO).constant -= TREE_INT_CST_LOW (dec); \
- else if ((TO).var == 0) \
- (TO).var = size_binop (MINUS_EXPR, integer_zero_node, dec); \
- else \
- (TO).var = size_binop (MINUS_EXPR, (TO).var, dec); }
-
-/* Convert the implicit sum in a `struct args_size' into an rtx. */
-#define ARGS_SIZE_RTX(SIZE) \
-((SIZE).var == 0 ? GEN_INT ((SIZE).constant) \
- : expand_expr (size_binop (PLUS_EXPR, (SIZE).var, \
- size_int ((SIZE).constant)), \
- NULL_RTX, VOIDmode, 0))
-
-/* Convert the implicit sum in a `struct args_size' into a tree. */
-#define ARGS_SIZE_TREE(SIZE) \
-((SIZE).var == 0 ? size_int ((SIZE).constant) \
- : size_binop (PLUS_EXPR, (SIZE).var, size_int ((SIZE).constant)))
-
-/* Supply a default definition for FUNCTION_ARG_PADDING:
- usually pad upward, but pad short args downward on
- big-endian machines. */
-
-enum direction {none, upward, downward}; /* Value has this type. */
-
-#ifndef FUNCTION_ARG_PADDING
-#define FUNCTION_ARG_PADDING(MODE, TYPE) \
- (! BYTES_BIG_ENDIAN \
- ? upward \
- : (((MODE) == BLKmode \
- ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT)) \
- : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
- ? downward : upward))
-#endif
-
-/* Supply a default definition for FUNCTION_ARG_BOUNDARY. Normally, we let
- FUNCTION_ARG_PADDING, which also pads the length, handle any needed
- alignment. */
-
-#ifndef FUNCTION_ARG_BOUNDARY
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) PARM_BOUNDARY
-#endif
-
-/* Nonzero if we do not know how to pass TYPE solely in registers.
- We cannot do so in the following cases:
-
- - if the type has variable size
- - if the type is marked as addressable (it is required to be constructed
- into the stack)
- - if the padding and mode of the type is such that a copy into a register
- would put it into the wrong part of the register.
-
- Which padding can't be supported depends on the byte endianness.
-
- A value in a register is implicitly padded at the most significant end.
- On a big-endian machine, that is the lower end in memory.
- So a value padded in memory at the upper end can't go in a register.
- For a little-endian machine, the reverse is true. */
-
-#define MUST_PASS_IN_STACK(MODE,TYPE) \
- ((TYPE) != 0 \
- && (TREE_CODE (TYPE_SIZE (TYPE)) != INTEGER_CST \
- || TREE_ADDRESSABLE (TYPE) \
- || ((MODE) == BLKmode \
- && ! ((TYPE) != 0 && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
- && 0 == (int_size_in_bytes (TYPE) \
- % (PARM_BOUNDARY / BITS_PER_UNIT))) \
- && (FUNCTION_ARG_PADDING (MODE, TYPE) \
- == (BYTES_BIG_ENDIAN ? upward : downward)))))
-
-/* Nonzero if type TYPE should be returned in memory.
- Most machines can use the following default definition. */
-
-#ifndef RETURN_IN_MEMORY
-#define RETURN_IN_MEMORY(TYPE) (TYPE_MODE (TYPE) == BLKmode)
-#endif
-
-/* Optabs are tables saying how to generate insn bodies
- for various machine modes and numbers of operands.
- Each optab applies to one operation.
- For example, add_optab applies to addition.
-
- The insn_code slot is the enum insn_code that says how to
- generate an insn for this operation on a particular machine mode.
- It is CODE_FOR_nothing if there is no such insn on the target machine.
-
- The `lib_call' slot is the name of the library function that
- can be used to perform the operation.
-
- A few optabs, such as move_optab and cmp_optab, are used
- by special code. */
-
-/* Everything that uses expr.h needs to define enum insn_code
- but we don't list it in the Makefile dependencies just for that. */
-#include "insn-codes.h"
-
-typedef struct optab
-{
- enum rtx_code code;
- struct {
- enum insn_code insn_code;
- rtx libfunc;
- } handlers [NUM_MACHINE_MODES];
-} * optab;
-
-/* Given an enum insn_code, access the function to construct
- the body of that kind of insn. */
-#ifdef FUNCTION_CONVERSION_BUG
-/* Some compilers fail to convert a function properly to a
- pointer-to-function when used as an argument.
- So produce the pointer-to-function directly.
- Luckily, these compilers seem to work properly when you
- call the pointer-to-function. */
-#define GEN_FCN(CODE) (insn_gen_function[(int) (CODE)])
-#else
-#define GEN_FCN(CODE) (*insn_gen_function[(int) (CODE)])
-#endif
-
-extern rtx (*const insn_gen_function[]) ();
-
-extern optab add_optab;
-extern optab sub_optab;
-extern optab smul_optab; /* Signed and floating-point multiply */
-extern optab smul_highpart_optab; /* Signed multiply, return high word */
-extern optab umul_highpart_optab;
-extern optab smul_widen_optab; /* Signed multiply with result
- one machine mode wider than args */
-extern optab umul_widen_optab;
-extern optab sdiv_optab; /* Signed divide */
-extern optab sdivmod_optab; /* Signed divide-and-remainder in one */
-extern optab udiv_optab;
-extern optab udivmod_optab;
-extern optab smod_optab; /* Signed remainder */
-extern optab umod_optab;
-extern optab flodiv_optab; /* Optab for floating divide. */
-extern optab ftrunc_optab; /* Convert float to integer in float fmt */
-extern optab and_optab; /* Logical and */
-extern optab ior_optab; /* Logical or */
-extern optab xor_optab; /* Logical xor */
-extern optab ashl_optab; /* Arithmetic shift left */
-extern optab ashr_optab; /* Arithmetic shift right */
-extern optab lshr_optab; /* Logical shift right */
-extern optab rotl_optab; /* Rotate left */
-extern optab rotr_optab; /* Rotate right */
-extern optab smin_optab; /* Signed and floating-point minimum value */
-extern optab smax_optab; /* Signed and floating-point maximum value */
-extern optab umin_optab; /* Unsigned minimum value */
-extern optab umax_optab; /* Unsigned maximum value */
-
-extern optab mov_optab; /* Move instruction. */
-extern optab movstrict_optab; /* Move, preserving high part of register. */
-
-extern optab cmp_optab; /* Compare insn; two operands. */
-extern optab tst_optab; /* tst insn; compare one operand against 0 */
-
-/* Unary operations */
-extern optab neg_optab; /* Negation */
-extern optab abs_optab; /* Abs value */
-extern optab one_cmpl_optab; /* Bitwise not */
-extern optab ffs_optab; /* Find first bit set */
-extern optab sqrt_optab; /* Square root */
-extern optab sin_optab; /* Sine */
-extern optab cos_optab; /* Cosine */
-extern optab strlen_optab; /* String length */
-
-/* Tables of patterns for extending one integer mode to another. */
-extern enum insn_code extendtab[MAX_MACHINE_MODE][MAX_MACHINE_MODE][2];
-
-/* Tables of patterns for converting between fixed and floating point. */
-extern enum insn_code fixtab[NUM_MACHINE_MODES][NUM_MACHINE_MODES][2];
-extern enum insn_code fixtrunctab[NUM_MACHINE_MODES][NUM_MACHINE_MODES][2];
-extern enum insn_code floattab[NUM_MACHINE_MODES][NUM_MACHINE_MODES][2];
-
-/* Contains the optab used for each rtx code. */
-extern optab code_to_optab[NUM_RTX_CODE + 1];
-
-/* Passed to expand_binop and expand_unop to say which options to try to use
- if the requested operation can't be open-coded on the requisite mode.
- Either OPTAB_LIB or OPTAB_LIB_WIDEN says try using a library call.
- Either OPTAB_WIDEN or OPTAB_LIB_WIDEN says try using a wider mode.
- OPTAB_MUST_WIDEN says try widening and don't try anything else. */
-
-enum optab_methods
-{
- OPTAB_DIRECT,
- OPTAB_LIB,
- OPTAB_WIDEN,
- OPTAB_LIB_WIDEN,
- OPTAB_MUST_WIDEN
-};
-
-/* SYMBOL_REF rtx's for the library functions that are called
- implicitly and not via optabs. */
-
-extern rtx extendsfdf2_libfunc;
-extern rtx extendsfxf2_libfunc;
-extern rtx extendsftf2_libfunc;
-extern rtx extenddfxf2_libfunc;
-extern rtx extenddftf2_libfunc;
-
-extern rtx truncdfsf2_libfunc;
-extern rtx truncxfsf2_libfunc;
-extern rtx trunctfsf2_libfunc;
-extern rtx truncxfdf2_libfunc;
-extern rtx trunctfdf2_libfunc;
-
-extern rtx memcpy_libfunc;
-extern rtx bcopy_libfunc;
-extern rtx memcmp_libfunc;
-extern rtx bcmp_libfunc;
-extern rtx memset_libfunc;
-extern rtx bzero_libfunc;
-
-extern rtx throw_libfunc;
-
-extern rtx eqhf2_libfunc;
-extern rtx nehf2_libfunc;
-extern rtx gthf2_libfunc;
-extern rtx gehf2_libfunc;
-extern rtx lthf2_libfunc;
-extern rtx lehf2_libfunc;
-
-extern rtx eqsf2_libfunc;
-extern rtx nesf2_libfunc;
-extern rtx gtsf2_libfunc;
-extern rtx gesf2_libfunc;
-extern rtx ltsf2_libfunc;
-extern rtx lesf2_libfunc;
-
-extern rtx eqdf2_libfunc;
-extern rtx nedf2_libfunc;
-extern rtx gtdf2_libfunc;
-extern rtx gedf2_libfunc;
-extern rtx ltdf2_libfunc;
-extern rtx ledf2_libfunc;
-
-extern rtx eqxf2_libfunc;
-extern rtx nexf2_libfunc;
-extern rtx gtxf2_libfunc;
-extern rtx gexf2_libfunc;
-extern rtx ltxf2_libfunc;
-extern rtx lexf2_libfunc;
-
-extern rtx eqtf2_libfunc;
-extern rtx netf2_libfunc;
-extern rtx gttf2_libfunc;
-extern rtx getf2_libfunc;
-extern rtx lttf2_libfunc;
-extern rtx letf2_libfunc;
-
-extern rtx floatsisf_libfunc;
-extern rtx floatdisf_libfunc;
-extern rtx floattisf_libfunc;
-
-extern rtx floatsidf_libfunc;
-extern rtx floatdidf_libfunc;
-extern rtx floattidf_libfunc;
-
-extern rtx floatsixf_libfunc;
-extern rtx floatdixf_libfunc;
-extern rtx floattixf_libfunc;
-
-extern rtx floatsitf_libfunc;
-extern rtx floatditf_libfunc;
-extern rtx floattitf_libfunc;
-
-extern rtx fixsfsi_libfunc;
-extern rtx fixsfdi_libfunc;
-extern rtx fixsfti_libfunc;
-
-extern rtx fixdfsi_libfunc;
-extern rtx fixdfdi_libfunc;
-extern rtx fixdfti_libfunc;
-
-extern rtx fixxfsi_libfunc;
-extern rtx fixxfdi_libfunc;
-extern rtx fixxfti_libfunc;
-
-extern rtx fixtfsi_libfunc;
-extern rtx fixtfdi_libfunc;
-extern rtx fixtfti_libfunc;
-
-extern rtx fixunssfsi_libfunc;
-extern rtx fixunssfdi_libfunc;
-extern rtx fixunssfti_libfunc;
-
-extern rtx fixunsdfsi_libfunc;
-extern rtx fixunsdfdi_libfunc;
-extern rtx fixunsdfti_libfunc;
-
-extern rtx fixunsxfsi_libfunc;
-extern rtx fixunsxfdi_libfunc;
-extern rtx fixunsxfti_libfunc;
-
-extern rtx fixunstfsi_libfunc;
-extern rtx fixunstfdi_libfunc;
-extern rtx fixunstfti_libfunc;
-
-typedef rtx (*rtxfun) ();
-
-/* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
- gives the gen_function to make a branch to test that condition. */
-
-extern rtxfun bcc_gen_fctn[NUM_RTX_CODE];
-
-/* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
- gives the insn code to make a store-condition insn
- to test that condition. */
-
-extern enum insn_code setcc_gen_code[NUM_RTX_CODE];
-
-#ifdef HAVE_conditional_move
-/* Indexed by the the machine mode, gives the insn code to make a conditional
- move insn. */
-
-extern enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
-#endif
-
-/* This array records the insn_code of insns to perform block moves. */
-extern enum insn_code movstr_optab[NUM_MACHINE_MODES];
-
-/* This array records the insn_code of insns to perform block clears. */
-extern enum insn_code clrstr_optab[NUM_MACHINE_MODES];
-
-/* Define functions given in optabs.c. */
-
-/* Expand a binary operation given optab and rtx operands. */
-extern rtx expand_binop PROTO((enum machine_mode, optab, rtx, rtx, rtx,
- int, enum optab_methods));
-
-/* Expand a binary operation with both signed and unsigned forms. */
-extern rtx sign_expand_binop PROTO((enum machine_mode, optab, optab, rtx,
- rtx, rtx, int, enum optab_methods));
-
-/* Generate code to perform an operation on two operands with two results. */
-extern int expand_twoval_binop PROTO((optab, rtx, rtx, rtx, rtx, int));
-
-/* Expand a unary arithmetic operation given optab rtx operand. */
-extern rtx expand_unop PROTO((enum machine_mode, optab, rtx, rtx, int));
-
-/* Expand the absolute value operation. */
-extern rtx expand_abs PROTO((enum machine_mode, rtx, rtx, int, int));
-
-/* Expand the complex absolute value operation. */
-extern rtx expand_complex_abs PROTO((enum machine_mode, rtx, rtx, int));
-
-/* Generate an instruction with a given INSN_CODE with an output and
- an input. */
-extern void emit_unop_insn PROTO((int, rtx, rtx, enum rtx_code));
-
-/* Emit code to perform a series of operations on a multi-word quantity, one
- word at a time. */
-extern rtx emit_no_conflict_block PROTO((rtx, rtx, rtx, rtx, rtx));
-
-/* Emit code to make a call to a constant function or a library call. */
-extern void emit_libcall_block PROTO((rtx, rtx, rtx, rtx));
-
-/* Emit one rtl instruction to store zero in specified rtx. */
-extern void emit_clr_insn PROTO((rtx));
-
-/* Emit one rtl insn to store 1 in specified rtx assuming it contains 0. */
-extern void emit_0_to_1_insn PROTO((rtx));
-
-/* Emit one rtl insn to compare two rtx's. */
-extern void emit_cmp_insn PROTO((rtx, rtx, enum rtx_code, rtx,
- enum machine_mode, int, int));
-
-/* Nonzero if a compare of mode MODE can be done straightforwardly
- (without splitting it into pieces). */
-extern int can_compare_p PROTO((enum machine_mode));
-
-/* Emit a library call comparison between floating point X and Y.
- COMPARISON is the rtl operator to compare with (EQ, NE, GT, etc.). */
-extern void emit_float_lib_cmp PROTO((rtx, rtx, enum rtx_code));
-
-/* Generate code to indirectly jump to a location given in the rtx LOC. */
-extern void emit_indirect_jump PROTO((rtx));
-
-#ifdef HAVE_conditional_move
-/* Emit a conditional move operation. */
-rtx emit_conditional_move PROTO((rtx, enum rtx_code, rtx, rtx,
- enum machine_mode, rtx, rtx,
- enum machine_mode, int));
-
-/* Return non-zero if the conditional move is supported. */
-int can_conditionally_move_p PROTO((enum machine_mode mode));
-#endif
-
-/* Create but don't emit one rtl instruction to add one rtx into another.
- Modes must match; operands must meet the operation's predicates.
- Likewise for subtraction and for just copying.
- These do not call protect_from_queue; caller must do so. */
-extern rtx gen_add2_insn PROTO((rtx, rtx));
-extern rtx gen_sub2_insn PROTO((rtx, rtx));
-extern rtx gen_move_insn PROTO((rtx, rtx));
-extern int have_add2_insn PROTO((enum machine_mode));
-extern int have_sub2_insn PROTO((enum machine_mode));
-
-/* Return the INSN_CODE to use for an extend operation. */
-extern enum insn_code can_extend_p PROTO((enum machine_mode,
- enum machine_mode, int));
-
-/* Generate the body of an insn to extend Y (with mode MFROM)
- into X (with mode MTO). Do zero-extension if UNSIGNEDP is nonzero. */
-extern rtx gen_extend_insn PROTO((rtx, rtx, enum machine_mode,
- enum machine_mode, int));
-
-/* Initialize the tables that control conversion between fixed and
- floating values. */
-extern void init_fixtab PROTO((void));
-extern void init_floattab PROTO((void));
-
-/* Generate code for a FLOAT_EXPR. */
-extern void expand_float PROTO((rtx, rtx, int));
-
-/* Generate code for a FIX_EXPR. */
-extern void expand_fix PROTO((rtx, rtx, int));
-
-/* Call this once to initialize the contents of the optabs
- appropriately for the current target machine. */
-extern void init_optabs PROTO((void));
-
-/* Functions from expmed.c: */
-
-/* Arguments MODE, RTX: return an rtx for the negation of that value.
- May emit insns. */
-extern rtx negate_rtx PROTO((enum machine_mode, rtx));
-
-/* Expand a logical AND operation. */
-extern rtx expand_and PROTO((rtx, rtx, rtx));
-
-/* Emit a store-flag operation. */
-extern rtx emit_store_flag PROTO((rtx, enum rtx_code, rtx, rtx,
- enum machine_mode, int, int));
-
-/* Like emit_store_flag, but always succeeds. */
-extern rtx emit_store_flag_force PROTO((rtx, enum rtx_code, rtx, rtx,
- enum machine_mode, int, int));
-
-/* Functions from loop.c: */
-
-/* Given a JUMP_INSN, return a description of the test being made. */
-extern rtx get_condition PROTO((rtx, rtx *));
-
-/* Functions from expr.c: */
-
-/* This is run once per compilation to set up which modes can be used
- directly in memory and to initialize the block move optab. */
-extern void init_expr_once PROTO((void));
-
-/* This is run at the start of compiling a function. */
-extern void init_expr PROTO((void));
-
-/* Use protect_from_queue to convert a QUEUED expression
- into something that you can put immediately into an instruction. */
-extern rtx protect_from_queue PROTO((rtx, int));
-
-/* Perform all the pending incrementations. */
-extern void emit_queue PROTO((void));
-
-/* Emit some rtl insns to move data between rtx's, converting machine modes.
- Both modes must be floating or both fixed. */
-extern void convert_move PROTO((rtx, rtx, int));
-
-/* Convert an rtx to specified machine mode and return the result. */
-extern rtx convert_to_mode PROTO((enum machine_mode, rtx, int));
-
-/* Convert an rtx to MODE from OLDMODE and return the result. */
-extern rtx convert_modes PROTO((enum machine_mode, enum machine_mode, rtx, int));
-
-/* Emit code to move a block Y to a block X. */
-extern void emit_block_move PROTO((rtx, rtx, rtx, int));
-
-/* Copy all or part of a value X into registers starting at REGNO.
- The number of registers to be filled is NREGS. */
-extern void move_block_to_reg PROTO((int, rtx, int, enum machine_mode));
-
-/* Copy all or part of a BLKmode value X out of registers starting at REGNO.
- The number of registers to be filled is NREGS. */
-extern void move_block_from_reg PROTO((int, rtx, int, int));
-
-/* Load a BLKmode value into non-consecutive registers represented by a
- PARALLEL. */
-extern void emit_group_load PROTO((rtx, rtx));
-/* Store a BLKmode value from non-consecutive registers represented by a
- PARALLEL. */
-extern void emit_group_store PROTO((rtx, rtx));
-
-/* Mark REG as holding a parameter for the next CALL_INSN. */
-extern void use_reg PROTO((rtx *, rtx));
-/* Mark NREGS consecutive regs, starting at REGNO, as holding parameters
- for the next CALL_INSN. */
-extern void use_regs PROTO((rtx *, int, int));
-/* Mark a PARALLEL as holding a parameter for the next CALL_INSN. */
-extern void use_group_regs PROTO((rtx *, rtx));
-
-/* Write zeros through the storage of OBJECT.
- If OBJECT has BLKmode, SIZE is its length in bytes and ALIGN is its
- alignment. */
-extern void clear_storage PROTO((rtx, rtx, int));
-
-/* Emit insns to set X from Y. */
-extern rtx emit_move_insn PROTO((rtx, rtx));
-
-/* Emit insns to set X from Y, with no frills. */
-extern rtx emit_move_insn_1 PROTO ((rtx, rtx));
-
-/* Push a block of length SIZE (perhaps variable)
- and return an rtx to address the beginning of the block. */
-extern rtx push_block PROTO((rtx, int, int));
-
-/* Make an operand to push something on the stack. */
-extern rtx gen_push_operand PROTO((void));
-
-#ifdef TREE_CODE
-/* Generate code to push something onto the stack, given its mode and type. */
-extern void emit_push_insn PROTO((rtx, enum machine_mode, tree, rtx, int,
- int, rtx, int, rtx, rtx));
-
-/* Emit library call. */
-extern void emit_library_call PVPROTO((rtx orgfun, int no_queue,
- enum machine_mode outmode, int nargs, ...));
-extern rtx emit_library_call_value PVPROTO((rtx orgfun, rtx value, int no_queue,
- enum machine_mode outmode, int nargs, ...));
-
-/* Expand an assignment that stores the value of FROM into TO. */
-extern rtx expand_assignment PROTO((tree, tree, int, int));
-
-/* Generate code for computing expression EXP,
- and storing the value into TARGET.
- If SUGGEST_REG is nonzero, copy the value through a register
- and return that register, if that is possible. */
-extern rtx store_expr PROTO((tree, rtx, int));
-#endif
-
-/* Given an rtx that may include add and multiply operations,
- generate them as insns and return a pseudo-reg containing the value.
- Useful after calling expand_expr with 1 as sum_ok. */
-extern rtx force_operand PROTO((rtx, rtx));
-
-#ifdef TREE_CODE
-/* Generate code for computing expression EXP.
- An rtx for the computed value is returned. The value is never null.
- In the case of a void EXP, const0_rtx is returned. */
-extern rtx expand_expr PROTO((tree, rtx, enum machine_mode,
- enum expand_modifier));
-#endif
-
-/* At the start of a function, record that we have no previously-pushed
- arguments waiting to be popped. */
-extern void init_pending_stack_adjust PROTO((void));
-
-/* When exiting from function, if safe, clear out any pending stack adjust
- so the adjustment won't get done. */
-extern void clear_pending_stack_adjust PROTO((void));
-
-/* Pop any previously-pushed arguments that have not been popped yet. */
-extern void do_pending_stack_adjust PROTO((void));
-
-#ifdef TREE_CODE
-/* Expand all cleanups up to OLD_CLEANUPS. */
-extern void expand_cleanups_to PROTO((tree));
-
-/* Generate code to evaluate EXP and jump to LABEL if the value is zero. */
-extern void jumpifnot PROTO((tree, rtx));
-
-/* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */
-extern void jumpif PROTO((tree, rtx));
-
-/* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if
- the result is zero, or IF_TRUE_LABEL if the result is one. */
-extern void do_jump PROTO((tree, rtx, rtx));
-#endif
-
-/* Generate rtl to compare two rtx's, will call emit_cmp_insn. */
-extern rtx compare_from_rtx PROTO((rtx, rtx, enum rtx_code, int,
- enum machine_mode, rtx, int));
-
-/* Generate a tablejump instruction (used for switch statements). */
-extern void do_tablejump PROTO((rtx, enum machine_mode, rtx, rtx, rtx));
-
-#ifdef TREE_CODE
-/* rtl.h and tree.h were included. */
-/* Return an rtx for the size in bytes of the value of an expr. */
-extern rtx expr_size PROTO((tree));
-
-extern rtx lookup_static_chain PROTO((tree));
-
-/* Convert a stack slot address ADDR valid in function FNDECL
- into an address valid in this function (using a static chain). */
-extern rtx fix_lexical_addr PROTO((rtx, tree));
-
-/* Return the address of the trampoline for entering nested fn FUNCTION. */
-extern rtx trampoline_address PROTO((tree));
-
-/* Return an rtx that refers to the value returned by a function
- in its original home. This becomes invalid if any more code is emitted. */
-extern rtx hard_function_value PROTO((tree, tree));
-
-extern rtx prepare_call_address PROTO((rtx, tree, rtx *, int));
-
-extern rtx expand_call PROTO((tree, rtx, int));
-
-extern rtx expand_shift PROTO((enum tree_code, enum machine_mode, rtx, tree, rtx, int));
-extern rtx expand_divmod PROTO((int, enum tree_code, enum machine_mode, rtx, rtx, rtx, int));
-extern void locate_and_pad_parm PROTO((enum machine_mode, tree, int, tree, struct args_size *, struct args_size *, struct args_size *));
-extern rtx expand_inline_function PROTO((tree, tree, rtx, int, tree, rtx));
-/* Return the CODE_LABEL rtx for a LABEL_DECL, creating it if necessary. */
-extern rtx label_rtx PROTO((tree));
-#endif
-
-/* Indicate how an input argument register was promoted. */
-extern rtx promoted_input_arg PROTO((int, enum machine_mode *, int *));
-
-/* Return an rtx like arg but sans any constant terms.
- Returns the original rtx if it has no constant terms.
- The constant terms are added and stored via a second arg. */
-extern rtx eliminate_constant_term PROTO((rtx, rtx *));
-
-/* Convert arg to a valid memory address for specified machine mode,
- by emitting insns to perform arithmetic if nec. */
-extern rtx memory_address PROTO((enum machine_mode, rtx));
-
-/* Like `memory_address' but pretent `flag_force_addr' is 0. */
-extern rtx memory_address_noforce PROTO((enum machine_mode, rtx));
-
-/* Return a memory reference like MEMREF, but with its mode changed
- to MODE and its address changed to ADDR.
- (VOIDmode means don't change the mode.
- NULL for ADDR means don't change the address.) */
-extern rtx change_address PROTO((rtx, enum machine_mode, rtx));
-
-/* Return a memory reference like MEMREF, but which is known to have a
- valid address. */
-
-extern rtx validize_mem PROTO((rtx));
-
-/* Assemble the static constant template for function entry trampolines. */
-extern rtx assemble_trampoline_template PROTO((void));
-
-/* Return 1 if two rtx's are equivalent in structure and elements. */
-extern int rtx_equal_p PROTO((rtx, rtx));
-
-/* Given rtx, return new rtx whose address won't be affected by
- any side effects. It has been copied to a new temporary reg. */
-extern rtx stabilize PROTO((rtx));
-
-/* Given an rtx, copy all regs it refers to into new temps
- and return a modified copy that refers to the new temps. */
-extern rtx copy_all_regs PROTO((rtx));
-
-/* Copy given rtx to a new temp reg and return that. */
-extern rtx copy_to_reg PROTO((rtx));
-
-/* Like copy_to_reg but always make the reg Pmode. */
-extern rtx copy_addr_to_reg PROTO((rtx));
-
-/* Like copy_to_reg but always make the reg the specified mode MODE. */
-extern rtx copy_to_mode_reg PROTO((enum machine_mode, rtx));
-
-/* Copy given rtx to given temp reg and return that. */
-extern rtx copy_to_suggested_reg PROTO((rtx, rtx, enum machine_mode));
-
-/* Copy a value to a register if it isn't already a register.
- Args are mode (in case value is a constant) and the value. */
-extern rtx force_reg PROTO((enum machine_mode, rtx));
-
-/* Return given rtx, copied into a new temp reg if it was in memory. */
-extern rtx force_not_mem PROTO((rtx));
-
-#ifdef TREE_CODE
-/* Return mode and signedness to use when object is promoted. */
-extern enum machine_mode promote_mode PROTO((tree, enum machine_mode,
- int *, int));
-#endif
-
-/* Remove some bytes from the stack. An rtx says how many. */
-extern void adjust_stack PROTO((rtx));
-
-/* Add some bytes to the stack. An rtx says how many. */
-extern void anti_adjust_stack PROTO((rtx));
-
-/* This enum is used for the following two functions. */
-enum save_level {SAVE_BLOCK, SAVE_FUNCTION, SAVE_NONLOCAL};
-
-/* Save the stack pointer at the specified level. */
-extern void emit_stack_save PROTO((enum save_level, rtx *, rtx));
-
-/* Restore the stack pointer from a save area of the specified level. */
-extern void emit_stack_restore PROTO((enum save_level, rtx, rtx));
-
-/* Allocate some space on the stack dynamically and return its address. An rtx
- says how many bytes. */
-extern rtx allocate_dynamic_stack_space PROTO((rtx, rtx, int));
-
-/* Return an rtx that refers to the value returned by a library call
- in its original home. This becomes invalid if any more code is emitted. */
-extern rtx hard_libcall_value PROTO((enum machine_mode));
-
-/* Given an rtx, return an rtx for a value rounded up to a multiple
- of STACK_BOUNDARY / BITS_PER_UNIT. */
-extern rtx round_push PROTO((rtx));
-
-extern void emit_block_move PROTO((rtx, rtx, rtx, int));
-
-extern rtx store_bit_field PROTO((rtx, int, int, enum machine_mode, rtx, int, int));
-extern rtx extract_bit_field PROTO((rtx, int, int, int, rtx, enum machine_mode, enum machine_mode, int, int));
-extern rtx expand_mult PROTO((enum machine_mode, rtx, rtx, rtx, int));
-extern rtx expand_mult_add PROTO((rtx, rtx, rtx, rtx,enum machine_mode, int));
-extern rtx expand_mult_highpart_adjust PROTO((enum machine_mode, rtx, rtx, rtx, rtx, int));
-
-extern rtx assemble_static_space PROTO((int));
-
-/* Hook called by expand_expr for language-specific tree codes.
- It is up to the language front end to install a hook
- if it has any such codes that expand_expr needs to know about. */
-extern rtx (*lang_expand_expr) ();
-
-#ifdef TREE_CODE
-/* Build bytecode call descriptor for function SUBR. */
-extern rtx bc_build_calldesc PROTO((tree));
-
-/* Emit a type code to be used by the runtime support in handling
- parameter passing. The type code consists of the machine mode
- plus the minimal alignment shifted left 8 bits. */
-extern tree bc_runtime_type_code PROTO((tree));
-#endif
diff --git a/gcc/extend.texi b/gcc/extend.texi
deleted file mode 100644
index 6942629bfcd..00000000000
--- a/gcc/extend.texi
+++ /dev/null
@@ -1,3445 +0,0 @@
-@c Copyright (C) 1988,89,92,93,94,96 Free Software Foundation, Inc.
-@c This is part of the GCC manual.
-@c For copying conditions, see the file gcc.texi.
-
-@node C Extensions
-@chapter Extensions to the C Language Family
-@cindex extensions, C language
-@cindex C language extensions
-
-GNU C provides several language features not found in ANSI standard C.
-(The @samp{-pedantic} option directs GNU CC to print a warning message if
-any of these features is used.) To test for the availability of these
-features in conditional compilation, check for a predefined macro
-@code{__GNUC__}, which is always defined under GNU CC.
-
-These extensions are available in C and Objective C. Most of them are
-also available in C++. @xref{C++ Extensions,,Extensions to the
-C++ Language}, for extensions that apply @emph{only} to C++.
-
-@c The only difference between the two versions of this menu is that the
-@c version for clear INTERNALS has an extra node, "Constraints" (which
-@c appears in a separate chapter in the other version of the manual).
-@ifset INTERNALS
-@menu
-* Statement Exprs:: Putting statements and declarations inside expressions.
-* Local Labels:: Labels local to a statement-expression.
-* Labels as Values:: Getting pointers to labels, and computed gotos.
-* Nested Functions:: As in Algol and Pascal, lexical scoping of functions.
-* Constructing Calls:: Dispatching a call to another function.
-* Naming Types:: Giving a name to the type of some expression.
-* Typeof:: @code{typeof}: referring to the type of an expression.
-* Lvalues:: Using @samp{?:}, @samp{,} and casts in lvalues.
-* Conditionals:: Omitting the middle operand of a @samp{?:} expression.
-* Long Long:: Double-word integers---@code{long long int}.
-* Complex:: Data types for complex numbers.
-* Zero Length:: Zero-length arrays.
-* Variable Length:: Arrays whose length is computed at run time.
-* Macro Varargs:: Macros with variable number of arguments.
-* Subscripting:: Any array can be subscripted, even if not an lvalue.
-* Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers.
-* Initializers:: Non-constant initializers.
-* Constructors:: Constructor expressions give structures, unions
- or arrays as values.
-* Labeled Elements:: Labeling elements of initializers.
-* Cast to Union:: Casting to union type from any member of the union.
-* Case Ranges:: `case 1 ... 9' and such.
-* Function Attributes:: Declaring that functions have no side effects,
- or that they can never return.
-* Function Prototypes:: Prototype declarations and old-style definitions.
-* C++ Comments:: C++ comments are recognized.
-* Dollar Signs:: Dollar sign is allowed in identifiers.
-* Character Escapes:: @samp{\e} stands for the character @key{ESC}.
-* Variable Attributes:: Specifying attributes of variables.
-* Type Attributes:: Specifying attributes of types.
-* Alignment:: Inquiring about the alignment of a type or variable.
-* Inline:: Defining inline functions (as fast as macros).
-* Extended Asm:: Assembler instructions with C expressions as operands.
- (With them you can define ``built-in'' functions.)
-* Asm Labels:: Specifying the assembler name to use for a C symbol.
-* Explicit Reg Vars:: Defining variables residing in specified registers.
-* Alternate Keywords:: @code{__const__}, @code{__asm__}, etc., for header files.
-* Incomplete Enums:: @code{enum foo;}, with details to follow.
-* Function Names:: Printable strings which are the name of the current
- function.
-* Return Address:: Getting the return or frame address of a function.
-@end menu
-@end ifset
-@ifclear INTERNALS
-@menu
-* Statement Exprs:: Putting statements and declarations inside expressions.
-* Local Labels:: Labels local to a statement-expression.
-* Labels as Values:: Getting pointers to labels, and computed gotos.
-* Nested Functions:: As in Algol and Pascal, lexical scoping of functions.
-* Constructing Calls:: Dispatching a call to another function.
-* Naming Types:: Giving a name to the type of some expression.
-* Typeof:: @code{typeof}: referring to the type of an expression.
-* Lvalues:: Using @samp{?:}, @samp{,} and casts in lvalues.
-* Conditionals:: Omitting the middle operand of a @samp{?:} expression.
-* Long Long:: Double-word integers---@code{long long int}.
-* Complex:: Data types for complex numbers.
-* Zero Length:: Zero-length arrays.
-* Variable Length:: Arrays whose length is computed at run time.
-* Macro Varargs:: Macros with variable number of arguments.
-* Subscripting:: Any array can be subscripted, even if not an lvalue.
-* Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers.
-* Initializers:: Non-constant initializers.
-* Constructors:: Constructor expressions give structures, unions
- or arrays as values.
-* Labeled Elements:: Labeling elements of initializers.
-* Cast to Union:: Casting to union type from any member of the union.
-* Case Ranges:: `case 1 ... 9' and such.
-* Function Attributes:: Declaring that functions have no side effects,
- or that they can never return.
-* Function Prototypes:: Prototype declarations and old-style definitions.
-* C++ Comments:: C++ comments are recognized.
-* Dollar Signs:: Dollar sign is allowed in identifiers.
-* Character Escapes:: @samp{\e} stands for the character @key{ESC}.
-* Variable Attributes:: Specifying attributes of variables.
-* Type Attributes:: Specifying attributes of types.
-* Alignment:: Inquiring about the alignment of a type or variable.
-* Inline:: Defining inline functions (as fast as macros).
-* Extended Asm:: Assembler instructions with C expressions as operands.
- (With them you can define ``built-in'' functions.)
-* Constraints:: Constraints for asm operands
-* Asm Labels:: Specifying the assembler name to use for a C symbol.
-* Explicit Reg Vars:: Defining variables residing in specified registers.
-* Alternate Keywords:: @code{__const__}, @code{__asm__}, etc., for header files.
-* Incomplete Enums:: @code{enum foo;}, with details to follow.
-* Function Names:: Printable strings which are the name of the current
- function.
-* Return Address:: Getting the return or frame address of a function.
-@end menu
-@end ifclear
-
-@node Statement Exprs
-@section Statements and Declarations in Expressions
-@cindex statements inside expressions
-@cindex declarations inside expressions
-@cindex expressions containing statements
-@cindex macros, statements in expressions
-
-@c the above section title wrapped and causes an underfull hbox.. i
-@c changed it from "within" to "in". --mew 4feb93
-
-A compound statement enclosed in parentheses may appear as an expression
-in GNU C. This allows you to use loops, switches, and local variables
-within an expression.
-
-Recall that a compound statement is a sequence of statements surrounded
-by braces; in this construct, parentheses go around the braces. For
-example:
-
-@example
-(@{ int y = foo (); int z;
- if (y > 0) z = y;
- else z = - y;
- z; @})
-@end example
-
-@noindent
-is a valid (though slightly more complex than necessary) expression
-for the absolute value of @code{foo ()}.
-
-The last thing in the compound statement should be an expression
-followed by a semicolon; the value of this subexpression serves as the
-value of the entire construct. (If you use some other kind of statement
-last within the braces, the construct has type @code{void}, and thus
-effectively no value.)
-
-This feature is especially useful in making macro definitions ``safe'' (so
-that they evaluate each operand exactly once). For example, the
-``maximum'' function is commonly defined as a macro in standard C as
-follows:
-
-@example
-#define max(a,b) ((a) > (b) ? (a) : (b))
-@end example
-
-@noindent
-@cindex side effects, macro argument
-But this definition computes either @var{a} or @var{b} twice, with bad
-results if the operand has side effects. In GNU C, if you know the
-type of the operands (here let's assume @code{int}), you can define
-the macro safely as follows:
-
-@example
-#define maxint(a,b) \
- (@{int _a = (a), _b = (b); _a > _b ? _a : _b; @})
-@end example
-
-Embedded statements are not allowed in constant expressions, such as
-the value of an enumeration constant, the width of a bit field, or
-the initial value of a static variable.
-
-If you don't know the type of the operand, you can still do this, but you
-must use @code{typeof} (@pxref{Typeof}) or type naming (@pxref{Naming
-Types}).
-
-@node Local Labels
-@section Locally Declared Labels
-@cindex local labels
-@cindex macros, local labels
-
-Each statement expression is a scope in which @dfn{local labels} can be
-declared. A local label is simply an identifier; you can jump to it
-with an ordinary @code{goto} statement, but only from within the
-statement expression it belongs to.
-
-A local label declaration looks like this:
-
-@example
-__label__ @var{label};
-@end example
-
-@noindent
-or
-
-@example
-__label__ @var{label1}, @var{label2}, @dots{};
-@end example
-
-Local label declarations must come at the beginning of the statement
-expression, right after the @samp{(@{}, before any ordinary
-declarations.
-
-The label declaration defines the label @emph{name}, but does not define
-the label itself. You must do this in the usual way, with
-@code{@var{label}:}, within the statements of the statement expression.
-
-The local label feature is useful because statement expressions are
-often used in macros. If the macro contains nested loops, a @code{goto}
-can be useful for breaking out of them. However, an ordinary label
-whose scope is the whole function cannot be used: if the macro can be
-expanded several times in one function, the label will be multiply
-defined in that function. A local label avoids this problem. For
-example:
-
-@example
-#define SEARCH(array, target) \
-(@{ \
- __label__ found; \
- typeof (target) _SEARCH_target = (target); \
- typeof (*(array)) *_SEARCH_array = (array); \
- int i, j; \
- int value; \
- for (i = 0; i < max; i++) \
- for (j = 0; j < max; j++) \
- if (_SEARCH_array[i][j] == _SEARCH_target) \
- @{ value = i; goto found; @} \
- value = -1; \
- found: \
- value; \
-@})
-@end example
-
-@node Labels as Values
-@section Labels as Values
-@cindex labels as values
-@cindex computed gotos
-@cindex goto with computed label
-@cindex address of a label
-
-You can get the address of a label defined in the current function
-(or a containing function) with the unary operator @samp{&&}. The
-value has type @code{void *}. This value is a constant and can be used
-wherever a constant of that type is valid. For example:
-
-@example
-void *ptr;
-@dots{}
-ptr = &&foo;
-@end example
-
-To use these values, you need to be able to jump to one. This is done
-with the computed goto statement@footnote{The analogous feature in
-Fortran is called an assigned goto, but that name seems inappropriate in
-C, where one can do more than simply store label addresses in label
-variables.}, @code{goto *@var{exp};}. For example,
-
-@example
-goto *ptr;
-@end example
-
-@noindent
-Any expression of type @code{void *} is allowed.
-
-One way of using these constants is in initializing a static array that
-will serve as a jump table:
-
-@example
-static void *array[] = @{ &&foo, &&bar, &&hack @};
-@end example
-
-Then you can select a label with indexing, like this:
-
-@example
-goto *array[i];
-@end example
-
-@noindent
-Note that this does not check whether the subscript is in bounds---array
-indexing in C never does that.
-
-Such an array of label values serves a purpose much like that of the
-@code{switch} statement. The @code{switch} statement is cleaner, so
-use that rather than an array unless the problem does not fit a
-@code{switch} statement very well.
-
-Another use of label values is in an interpreter for threaded code.
-The labels within the interpreter function can be stored in the
-threaded code for super-fast dispatching.
-
-You can use this mechanism to jump to code in a different function. If
-you do that, totally unpredictable things will happen. The best way to
-avoid this is to store the label address only in automatic variables and
-never pass it as an argument.
-
-@node Nested Functions
-@section Nested Functions
-@cindex nested functions
-@cindex downward funargs
-@cindex thunks
-
-A @dfn{nested function} is a function defined inside another function.
-(Nested functions are not supported for GNU C++.) The nested function's
-name is local to the block where it is defined. For example, here we
-define a nested function named @code{square}, and call it twice:
-
-@example
-@group
-foo (double a, double b)
-@{
- double square (double z) @{ return z * z; @}
-
- return square (a) + square (b);
-@}
-@end group
-@end example
-
-The nested function can access all the variables of the containing
-function that are visible at the point of its definition. This is
-called @dfn{lexical scoping}. For example, here we show a nested
-function which uses an inherited variable named @code{offset}:
-
-@example
-bar (int *array, int offset, int size)
-@{
- int access (int *array, int index)
- @{ return array[index + offset]; @}
- int i;
- @dots{}
- for (i = 0; i < size; i++)
- @dots{} access (array, i) @dots{}
-@}
-@end example
-
-Nested function definitions are permitted within functions in the places
-where variable definitions are allowed; that is, in any block, before
-the first statement in the block.
-
-It is possible to call the nested function from outside the scope of its
-name by storing its address or passing the address to another function:
-
-@example
-hack (int *array, int size)
-@{
- void store (int index, int value)
- @{ array[index] = value; @}
-
- intermediate (store, size);
-@}
-@end example
-
-Here, the function @code{intermediate} receives the address of
-@code{store} as an argument. If @code{intermediate} calls @code{store},
-the arguments given to @code{store} are used to store into @code{array}.
-But this technique works only so long as the containing function
-(@code{hack}, in this example) does not exit.
-
-If you try to call the nested function through its address after the
-containing function has exited, all hell will break loose. If you try
-to call it after a containing scope level has exited, and if it refers
-to some of the variables that are no longer in scope, you may be lucky,
-but it's not wise to take the risk. If, however, the nested function
-does not refer to anything that has gone out of scope, you should be
-safe.
-
-GNU CC implements taking the address of a nested function using a
-technique called @dfn{trampolines}. A paper describing them is
-available from @samp{maya.idiap.ch} in directory @file{pub/tmb},
-file @file{usenix88-lexic.ps.Z}.
-
-A nested function can jump to a label inherited from a containing
-function, provided the label was explicitly declared in the containing
-function (@pxref{Local Labels}). Such a jump returns instantly to the
-containing function, exiting the nested function which did the
-@code{goto} and any intermediate functions as well. Here is an example:
-
-@example
-@group
-bar (int *array, int offset, int size)
-@{
- __label__ failure;
- int access (int *array, int index)
- @{
- if (index > size)
- goto failure;
- return array[index + offset];
- @}
- int i;
- @dots{}
- for (i = 0; i < size; i++)
- @dots{} access (array, i) @dots{}
- @dots{}
- return 0;
-
- /* @r{Control comes here from @code{access}
- if it detects an error.} */
- failure:
- return -1;
-@}
-@end group
-@end example
-
-A nested function always has internal linkage. Declaring one with
-@code{extern} is erroneous. If you need to declare the nested function
-before its definition, use @code{auto} (which is otherwise meaningless
-for function declarations).
-
-@example
-bar (int *array, int offset, int size)
-@{
- __label__ failure;
- auto int access (int *, int);
- @dots{}
- int access (int *array, int index)
- @{
- if (index > size)
- goto failure;
- return array[index + offset];
- @}
- @dots{}
-@}
-@end example
-
-@node Constructing Calls
-@section Constructing Function Calls
-@cindex constructing calls
-@cindex forwarding calls
-
-Using the built-in functions described below, you can record
-the arguments a function received, and call another function
-with the same arguments, without knowing the number or types
-of the arguments.
-
-You can also record the return value of that function call,
-and later return that value, without knowing what data type
-the function tried to return (as long as your caller expects
-that data type).
-
-@table @code
-@findex __builtin_apply_args
-@item __builtin_apply_args ()
-This built-in function returns a pointer of type @code{void *} to data
-describing how to perform a call with the same arguments as were passed
-to the current function.
-
-The function saves the arg pointer register, structure value address,
-and all registers that might be used to pass arguments to a function
-into a block of memory allocated on the stack. Then it returns the
-address of that block.
-
-@findex __builtin_apply
-@item __builtin_apply (@var{function}, @var{arguments}, @var{size})
-This built-in function invokes @var{function} (type @code{void (*)()})
-with a copy of the parameters described by @var{arguments} (type
-@code{void *}) and @var{size} (type @code{int}).
-
-The value of @var{arguments} should be the value returned by
-@code{__builtin_apply_args}. The argument @var{size} specifies the size
-of the stack argument data, in bytes.
-
-This function returns a pointer of type @code{void *} to data describing
-how to return whatever value was returned by @var{function}. The data
-is saved in a block of memory allocated on the stack.
-
-It is not always simple to compute the proper value for @var{size}. The
-value is used by @code{__builtin_apply} to compute the amount of data
-that should be pushed on the stack and copied from the incoming argument
-area.
-
-@findex __builtin_return
-@item __builtin_return (@var{result})
-This built-in function returns the value described by @var{result} from
-the containing function. You should specify, for @var{result}, a value
-returned by @code{__builtin_apply}.
-@end table
-
-@node Naming Types
-@section Naming an Expression's Type
-@cindex naming types
-
-You can give a name to the type of an expression using a @code{typedef}
-declaration with an initializer. Here is how to define @var{name} as a
-type name for the type of @var{exp}:
-
-@example
-typedef @var{name} = @var{exp};
-@end example
-
-This is useful in conjunction with the statements-within-expressions
-feature. Here is how the two together can be used to define a safe
-``maximum'' macro that operates on any arithmetic type:
-
-@example
-#define max(a,b) \
- (@{typedef _ta = (a), _tb = (b); \
- _ta _a = (a); _tb _b = (b); \
- _a > _b ? _a : _b; @})
-@end example
-
-@cindex underscores in variables in macros
-@cindex @samp{_} in variables in macros
-@cindex local variables in macros
-@cindex variables, local, in macros
-@cindex macros, local variables in
-
-The reason for using names that start with underscores for the local
-variables is to avoid conflicts with variable names that occur within the
-expressions that are substituted for @code{a} and @code{b}. Eventually we
-hope to design a new form of declaration syntax that allows you to declare
-variables whose scopes start only after their initializers; this will be a
-more reliable way to prevent such conflicts.
-
-@node Typeof
-@section Referring to a Type with @code{typeof}
-@findex typeof
-@findex sizeof
-@cindex macros, types of arguments
-
-Another way to refer to the type of an expression is with @code{typeof}.
-The syntax of using of this keyword looks like @code{sizeof}, but the
-construct acts semantically like a type name defined with @code{typedef}.
-
-There are two ways of writing the argument to @code{typeof}: with an
-expression or with a type. Here is an example with an expression:
-
-@example
-typeof (x[0](1))
-@end example
-
-@noindent
-This assumes that @code{x} is an array of functions; the type described
-is that of the values of the functions.
-
-Here is an example with a typename as the argument:
-
-@example
-typeof (int *)
-@end example
-
-@noindent
-Here the type described is that of pointers to @code{int}.
-
-If you are writing a header file that must work when included in ANSI C
-programs, write @code{__typeof__} instead of @code{typeof}.
-@xref{Alternate Keywords}.
-
-A @code{typeof}-construct can be used anywhere a typedef name could be
-used. For example, you can use it in a declaration, in a cast, or inside
-of @code{sizeof} or @code{typeof}.
-
-@itemize @bullet
-@item
-This declares @code{y} with the type of what @code{x} points to.
-
-@example
-typeof (*x) y;
-@end example
-
-@item
-This declares @code{y} as an array of such values.
-
-@example
-typeof (*x) y[4];
-@end example
-
-@item
-This declares @code{y} as an array of pointers to characters:
-
-@example
-typeof (typeof (char *)[4]) y;
-@end example
-
-@noindent
-It is equivalent to the following traditional C declaration:
-
-@example
-char *y[4];
-@end example
-
-To see the meaning of the declaration using @code{typeof}, and why it
-might be a useful way to write, let's rewrite it with these macros:
-
-@example
-#define pointer(T) typeof(T *)
-#define array(T, N) typeof(T [N])
-@end example
-
-@noindent
-Now the declaration can be rewritten this way:
-
-@example
-array (pointer (char), 4) y;
-@end example
-
-@noindent
-Thus, @code{array (pointer (char), 4)} is the type of arrays of 4
-pointers to @code{char}.
-@end itemize
-
-@node Lvalues
-@section Generalized Lvalues
-@cindex compound expressions as lvalues
-@cindex expressions, compound, as lvalues
-@cindex conditional expressions as lvalues
-@cindex expressions, conditional, as lvalues
-@cindex casts as lvalues
-@cindex generalized lvalues
-@cindex lvalues, generalized
-@cindex extensions, @code{?:}
-@cindex @code{?:} extensions
-Compound expressions, conditional expressions and casts are allowed as
-lvalues provided their operands are lvalues. This means that you can take
-their addresses or store values into them.
-
-Standard C++ allows compound expressions and conditional expressions as
-lvalues, and permits casts to reference type, so use of this extension
-is deprecated for C++ code.
-
-For example, a compound expression can be assigned, provided the last
-expression in the sequence is an lvalue. These two expressions are
-equivalent:
-
-@example
-(a, b) += 5
-a, (b += 5)
-@end example
-
-Similarly, the address of the compound expression can be taken. These two
-expressions are equivalent:
-
-@example
-&(a, b)
-a, &b
-@end example
-
-A conditional expression is a valid lvalue if its type is not void and the
-true and false branches are both valid lvalues. For example, these two
-expressions are equivalent:
-
-@example
-(a ? b : c) = 5
-(a ? b = 5 : (c = 5))
-@end example
-
-A cast is a valid lvalue if its operand is an lvalue. A simple
-assignment whose left-hand side is a cast works by converting the
-right-hand side first to the specified type, then to the type of the
-inner left-hand side expression. After this is stored, the value is
-converted back to the specified type to become the value of the
-assignment. Thus, if @code{a} has type @code{char *}, the following two
-expressions are equivalent:
-
-@example
-(int)a = 5
-(int)(a = (char *)(int)5)
-@end example
-
-An assignment-with-arithmetic operation such as @samp{+=} applied to a cast
-performs the arithmetic using the type resulting from the cast, and then
-continues as in the previous case. Therefore, these two expressions are
-equivalent:
-
-@example
-(int)a += 5
-(int)(a = (char *)(int) ((int)a + 5))
-@end example
-
-You cannot take the address of an lvalue cast, because the use of its
-address would not work out coherently. Suppose that @code{&(int)f} were
-permitted, where @code{f} has type @code{float}. Then the following
-statement would try to store an integer bit-pattern where a floating
-point number belongs:
-
-@example
-*&(int)f = 1;
-@end example
-
-This is quite different from what @code{(int)f = 1} would do---that
-would convert 1 to floating point and store it. Rather than cause this
-inconsistency, we think it is better to prohibit use of @samp{&} on a cast.
-
-If you really do want an @code{int *} pointer with the address of
-@code{f}, you can simply write @code{(int *)&f}.
-
-@node Conditionals
-@section Conditionals with Omitted Operands
-@cindex conditional expressions, extensions
-@cindex omitted middle-operands
-@cindex middle-operands, omitted
-@cindex extensions, @code{?:}
-@cindex @code{?:} extensions
-
-The middle operand in a conditional expression may be omitted. Then
-if the first operand is nonzero, its value is the value of the conditional
-expression.
-
-Therefore, the expression
-
-@example
-x ? : y
-@end example
-
-@noindent
-has the value of @code{x} if that is nonzero; otherwise, the value of
-@code{y}.
-
-This example is perfectly equivalent to
-
-@example
-x ? x : y
-@end example
-
-@cindex side effect in ?:
-@cindex ?: side effect
-@noindent
-In this simple case, the ability to omit the middle operand is not
-especially useful. When it becomes useful is when the first operand does,
-or may (if it is a macro argument), contain a side effect. Then repeating
-the operand in the middle would perform the side effect twice. Omitting
-the middle operand uses the value already computed without the undesirable
-effects of recomputing it.
-
-@node Long Long
-@section Double-Word Integers
-@cindex @code{long long} data types
-@cindex double-word arithmetic
-@cindex multiprecision arithmetic
-
-GNU C supports data types for integers that are twice as long as
-@code{int}. Simply write @code{long long int} for a signed integer, or
-@code{unsigned long long int} for an unsigned integer. To make an
-integer constant of type @code{long long int}, add the suffix @code{LL}
-to the integer. To make an integer constant of type @code{unsigned long
-long int}, add the suffix @code{ULL} to the integer.
-
-You can use these types in arithmetic like any other integer types.
-Addition, subtraction, and bitwise boolean operations on these types
-are open-coded on all types of machines. Multiplication is open-coded
-if the machine supports fullword-to-doubleword a widening multiply
-instruction. Division and shifts are open-coded only on machines that
-provide special support. The operations that are not open-coded use
-special library routines that come with GNU CC.
-
-There may be pitfalls when you use @code{long long} types for function
-arguments, unless you declare function prototypes. If a function
-expects type @code{int} for its argument, and you pass a value of type
-@code{long long int}, confusion will result because the caller and the
-subroutine will disagree about the number of bytes for the argument.
-Likewise, if the function expects @code{long long int} and you pass
-@code{int}. The best way to avoid such problems is to use prototypes.
-
-@node Complex
-@section Complex Numbers
-@cindex complex numbers
-
-GNU C supports complex data types. You can declare both complex integer
-types and complex floating types, using the keyword @code{__complex__}.
-
-For example, @samp{__complex__ double x;} declares @code{x} as a
-variable whose real part and imaginary part are both of type
-@code{double}. @samp{__complex__ short int y;} declares @code{y} to
-have real and imaginary parts of type @code{short int}; this is not
-likely to be useful, but it shows that the set of complex types is
-complete.
-
-To write a constant with a complex data type, use the suffix @samp{i} or
-@samp{j} (either one; they are equivalent). For example, @code{2.5fi}
-has type @code{__complex__ float} and @code{3i} has type
-@code{__complex__ int}. Such a constant always has a pure imaginary
-value, but you can form any complex value you like by adding one to a
-real constant.
-
-To extract the real part of a complex-valued expression @var{exp}, write
-@code{__real__ @var{exp}}. Likewise, use @code{__imag__} to
-extract the imaginary part.
-
-The operator @samp{~} performs complex conjugation when used on a value
-with a complex type.
-
-GNU CC can allocate complex automatic variables in a noncontiguous
-fashion; it's even possible for the real part to be in a register while
-the imaginary part is on the stack (or vice-versa). None of the
-supported debugging info formats has a way to represent noncontiguous
-allocation like this, so GNU CC describes a noncontiguous complex
-variable as if it were two separate variables of noncomplex type.
-If the variable's actual name is @code{foo}, the two fictitious
-variables are named @code{foo$real} and @code{foo$imag}. You can
-examine and set these two fictitious variables with your debugger.
-
-A future version of GDB will know how to recognize such pairs and treat
-them as a single variable with a complex type.
-
-@node Zero Length
-@section Arrays of Length Zero
-@cindex arrays of length zero
-@cindex zero-length arrays
-@cindex length-zero arrays
-
-Zero-length arrays are allowed in GNU C. They are very useful as the last
-element of a structure which is really a header for a variable-length
-object:
-
-@example
-struct line @{
- int length;
- char contents[0];
-@};
-
-@{
- struct line *thisline = (struct line *)
- malloc (sizeof (struct line) + this_length);
- thisline->length = this_length;
-@}
-@end example
-
-In standard C, you would have to give @code{contents} a length of 1, which
-means either you waste space or complicate the argument to @code{malloc}.
-
-@node Variable Length
-@section Arrays of Variable Length
-@cindex variable-length arrays
-@cindex arrays of variable length
-
-Variable-length automatic arrays are allowed in GNU C. These arrays are
-declared like any other automatic arrays, but with a length that is not
-a constant expression. The storage is allocated at the point of
-declaration and deallocated when the brace-level is exited. For
-example:
-
-@example
-FILE *
-concat_fopen (char *s1, char *s2, char *mode)
-@{
- char str[strlen (s1) + strlen (s2) + 1];
- strcpy (str, s1);
- strcat (str, s2);
- return fopen (str, mode);
-@}
-@end example
-
-@cindex scope of a variable length array
-@cindex variable-length array scope
-@cindex deallocating variable length arrays
-Jumping or breaking out of the scope of the array name deallocates the
-storage. Jumping into the scope is not allowed; you get an error
-message for it.
-
-@cindex @code{alloca} vs variable-length arrays
-You can use the function @code{alloca} to get an effect much like
-variable-length arrays. The function @code{alloca} is available in
-many other C implementations (but not in all). On the other hand,
-variable-length arrays are more elegant.
-
-There are other differences between these two methods. Space allocated
-with @code{alloca} exists until the containing @emph{function} returns.
-The space for a variable-length array is deallocated as soon as the array
-name's scope ends. (If you use both variable-length arrays and
-@code{alloca} in the same function, deallocation of a variable-length array
-will also deallocate anything more recently allocated with @code{alloca}.)
-
-You can also use variable-length arrays as arguments to functions:
-
-@example
-struct entry
-tester (int len, char data[len][len])
-@{
- @dots{}
-@}
-@end example
-
-The length of an array is computed once when the storage is allocated
-and is remembered for the scope of the array in case you access it with
-@code{sizeof}.
-
-If you want to pass the array first and the length afterward, you can
-use a forward declaration in the parameter list---another GNU extension.
-
-@example
-struct entry
-tester (int len; char data[len][len], int len)
-@{
- @dots{}
-@}
-@end example
-
-@cindex parameter forward declaration
-The @samp{int len} before the semicolon is a @dfn{parameter forward
-declaration}, and it serves the purpose of making the name @code{len}
-known when the declaration of @code{data} is parsed.
-
-You can write any number of such parameter forward declarations in the
-parameter list. They can be separated by commas or semicolons, but the
-last one must end with a semicolon, which is followed by the ``real''
-parameter declarations. Each forward declaration must match a ``real''
-declaration in parameter name and data type.
-
-@node Macro Varargs
-@section Macros with Variable Numbers of Arguments
-@cindex variable number of arguments
-@cindex macro with variable arguments
-@cindex rest argument (in macro)
-
-In GNU C, a macro can accept a variable number of arguments, much as a
-function can. The syntax for defining the macro looks much like that
-used for a function. Here is an example:
-
-@example
-#define eprintf(format, args...) \
- fprintf (stderr, format , ## args)
-@end example
-
-Here @code{args} is a @dfn{rest argument}: it takes in zero or more
-arguments, as many as the call contains. All of them plus the commas
-between them form the value of @code{args}, which is substituted into
-the macro body where @code{args} is used. Thus, we have this expansion:
-
-@example
-eprintf ("%s:%d: ", input_file_name, line_number)
-@expansion{}
-fprintf (stderr, "%s:%d: " , input_file_name, line_number)
-@end example
-
-@noindent
-Note that the comma after the string constant comes from the definition
-of @code{eprintf}, whereas the last comma comes from the value of
-@code{args}.
-
-The reason for using @samp{##} is to handle the case when @code{args}
-matches no arguments at all. In this case, @code{args} has an empty
-value. In this case, the second comma in the definition becomes an
-embarrassment: if it got through to the expansion of the macro, we would
-get something like this:
-
-@example
-fprintf (stderr, "success!\n" , )
-@end example
-
-@noindent
-which is invalid C syntax. @samp{##} gets rid of the comma, so we get
-the following instead:
-
-@example
-fprintf (stderr, "success!\n")
-@end example
-
-This is a special feature of the GNU C preprocessor: @samp{##} before a
-rest argument that is empty discards the preceding sequence of
-non-whitespace characters from the macro definition. (If another macro
-argument precedes, none of it is discarded.)
-
-It might be better to discard the last preprocessor token instead of the
-last preceding sequence of non-whitespace characters; in fact, we may
-someday change this feature to do so. We advise you to write the macro
-definition so that the preceding sequence of non-whitespace characters
-is just a single token, so that the meaning will not change if we change
-the definition of this feature.
-
-@node Subscripting
-@section Non-Lvalue Arrays May Have Subscripts
-@cindex subscripting
-@cindex arrays, non-lvalue
-
-@cindex subscripting and function values
-Subscripting is allowed on arrays that are not lvalues, even though the
-unary @samp{&} operator is not. For example, this is valid in GNU C though
-not valid in other C dialects:
-
-@example
-@group
-struct foo @{int a[4];@};
-
-struct foo f();
-
-bar (int index)
-@{
- return f().a[index];
-@}
-@end group
-@end example
-
-@node Pointer Arith
-@section Arithmetic on @code{void}- and Function-Pointers
-@cindex void pointers, arithmetic
-@cindex void, size of pointer to
-@cindex function pointers, arithmetic
-@cindex function, size of pointer to
-
-In GNU C, addition and subtraction operations are supported on pointers to
-@code{void} and on pointers to functions. This is done by treating the
-size of a @code{void} or of a function as 1.
-
-A consequence of this is that @code{sizeof} is also allowed on @code{void}
-and on function types, and returns 1.
-
-The option @samp{-Wpointer-arith} requests a warning if these extensions
-are used.
-
-@node Initializers
-@section Non-Constant Initializers
-@cindex initializers, non-constant
-@cindex non-constant initializers
-
-As in standard C++, the elements of an aggregate initializer for an
-automatic variable are not required to be constant expressions in GNU C.
-Here is an example of an initializer with run-time varying elements:
-
-@example
-foo (float f, float g)
-@{
- float beat_freqs[2] = @{ f-g, f+g @};
- @dots{}
-@}
-@end example
-
-@node Constructors
-@section Constructor Expressions
-@cindex constructor expressions
-@cindex initializations in expressions
-@cindex structures, constructor expression
-@cindex expressions, constructor
-
-GNU C supports constructor expressions. A constructor looks like
-a cast containing an initializer. Its value is an object of the
-type specified in the cast, containing the elements specified in
-the initializer.
-
-Usually, the specified type is a structure. Assume that
-@code{struct foo} and @code{structure} are declared as shown:
-
-@example
-struct foo @{int a; char b[2];@} structure;
-@end example
-
-@noindent
-Here is an example of constructing a @code{struct foo} with a constructor:
-
-@example
-structure = ((struct foo) @{x + y, 'a', 0@});
-@end example
-
-@noindent
-This is equivalent to writing the following:
-
-@example
-@{
- struct foo temp = @{x + y, 'a', 0@};
- structure = temp;
-@}
-@end example
-
-You can also construct an array. If all the elements of the constructor
-are (made up of) simple constant expressions, suitable for use in
-initializers, then the constructor is an lvalue and can be coerced to a
-pointer to its first element, as shown here:
-
-@example
-char **foo = (char *[]) @{ "x", "y", "z" @};
-@end example
-
-Array constructors whose elements are not simple constants are
-not very useful, because the constructor is not an lvalue. There
-are only two valid ways to use it: to subscript it, or initialize
-an array variable with it. The former is probably slower than a
-@code{switch} statement, while the latter does the same thing an
-ordinary C initializer would do. Here is an example of
-subscripting an array constructor:
-
-@example
-output = ((int[]) @{ 2, x, 28 @}) [input];
-@end example
-
-Constructor expressions for scalar types and union types are is
-also allowed, but then the constructor expression is equivalent
-to a cast.
-
-@node Labeled Elements
-@section Labeled Elements in Initializers
-@cindex initializers with labeled elements
-@cindex labeled elements in initializers
-@cindex case labels in initializers
-
-Standard C requires the elements of an initializer to appear in a fixed
-order, the same as the order of the elements in the array or structure
-being initialized.
-
-In GNU C you can give the elements in any order, specifying the array
-indices or structure field names they apply to. This extension is not
-implemented in GNU C++.
-
-To specify an array index, write @samp{[@var{index}]} or
-@samp{[@var{index}] =} before the element value. For example,
-
-@example
-int a[6] = @{ [4] 29, [2] = 15 @};
-@end example
-
-@noindent
-is equivalent to
-
-@example
-int a[6] = @{ 0, 0, 15, 0, 29, 0 @};
-@end example
-
-@noindent
-The index values must be constant expressions, even if the array being
-initialized is automatic.
-
-To initialize a range of elements to the same value, write
-@samp{[@var{first} ... @var{last}] = @var{value}}. For example,
-
-@example
-int widths[] = @{ [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 @};
-@end example
-
-@noindent
-Note that the length of the array is the highest value specified
-plus one.
-
-In a structure initializer, specify the name of a field to initialize
-with @samp{@var{fieldname}:} before the element value. For example,
-given the following structure,
-
-@example
-struct point @{ int x, y; @};
-@end example
-
-@noindent
-the following initialization
-
-@example
-struct point p = @{ y: yvalue, x: xvalue @};
-@end example
-
-@noindent
-is equivalent to
-
-@example
-struct point p = @{ xvalue, yvalue @};
-@end example
-
-Another syntax which has the same meaning is @samp{.@var{fieldname} =}.,
-as shown here:
-
-@example
-struct point p = @{ .y = yvalue, .x = xvalue @};
-@end example
-
-You can also use an element label (with either the colon syntax or the
-period-equal syntax) when initializing a union, to specify which element
-of the union should be used. For example,
-
-@example
-union foo @{ int i; double d; @};
-
-union foo f = @{ d: 4 @};
-@end example
-
-@noindent
-will convert 4 to a @code{double} to store it in the union using
-the second element. By contrast, casting 4 to type @code{union foo}
-would store it into the union as the integer @code{i}, since it is
-an integer. (@xref{Cast to Union}.)
-
-You can combine this technique of naming elements with ordinary C
-initialization of successive elements. Each initializer element that
-does not have a label applies to the next consecutive element of the
-array or structure. For example,
-
-@example
-int a[6] = @{ [1] = v1, v2, [4] = v4 @};
-@end example
-
-@noindent
-is equivalent to
-
-@example
-int a[6] = @{ 0, v1, v2, 0, v4, 0 @};
-@end example
-
-Labeling the elements of an array initializer is especially useful
-when the indices are characters or belong to an @code{enum} type.
-For example:
-
-@example
-int whitespace[256]
- = @{ [' '] = 1, ['\t'] = 1, ['\h'] = 1,
- ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 @};
-@end example
-
-@node Case Ranges
-@section Case Ranges
-@cindex case ranges
-@cindex ranges in case statements
-
-You can specify a range of consecutive values in a single @code{case} label,
-like this:
-
-@example
-case @var{low} ... @var{high}:
-@end example
-
-@noindent
-This has the same effect as the proper number of individual @code{case}
-labels, one for each integer value from @var{low} to @var{high}, inclusive.
-
-This feature is especially useful for ranges of ASCII character codes:
-
-@example
-case 'A' ... 'Z':
-@end example
-
-@strong{Be careful:} Write spaces around the @code{...}, for otherwise
-it may be parsed wrong when you use it with integer values. For example,
-write this:
-
-@example
-case 1 ... 5:
-@end example
-
-@noindent
-rather than this:
-
-@example
-case 1...5:
-@end example
-
-@node Cast to Union
-@section Cast to a Union Type
-@cindex cast to a union
-@cindex union, casting to a
-
-A cast to union type is similar to other casts, except that the type
-specified is a union type. You can specify the type either with
-@code{union @var{tag}} or with a typedef name. A cast to union is actually
-a constructor though, not a cast, and hence does not yield an lvalue like
-normal casts. (@xref{Constructors}.)
-
-The types that may be cast to the union type are those of the members
-of the union. Thus, given the following union and variables:
-
-@example
-union foo @{ int i; double d; @};
-int x;
-double y;
-@end example
-
-@noindent
-both @code{x} and @code{y} can be cast to type @code{union} foo.
-
-Using the cast as the right-hand side of an assignment to a variable of
-union type is equivalent to storing in a member of the union:
-
-@example
-union foo u;
-@dots{}
-u = (union foo) x @equiv{} u.i = x
-u = (union foo) y @equiv{} u.d = y
-@end example
-
-You can also use the union cast as a function argument:
-
-@example
-void hack (union foo);
-@dots{}
-hack ((union foo) x);
-@end example
-
-@node Function Attributes
-@section Declaring Attributes of Functions
-@cindex function attributes
-@cindex declaring attributes of functions
-@cindex functions that never return
-@cindex functions that have no side effects
-@cindex functions in arbitrary sections
-@cindex @code{volatile} applied to function
-@cindex @code{const} applied to function
-@cindex functions with @code{printf} or @code{scanf} style arguments
-@cindex functions that are passed arguments in registers on the 386
-@cindex functions that pop the argument stack on the 386
-@cindex functions that do not pop the argument stack on the 386
-
-In GNU C, you declare certain things about functions called in your program
-which help the compiler optimize function calls and check your code more
-carefully.
-
-The keyword @code{__attribute__} allows you to specify special
-attributes when making a declaration. This keyword is followed by an
-attribute specification inside double parentheses. Eight attributes,
-@code{noreturn}, @code{const}, @code{format}, @code{section},
-@code{constructor}, @code{destructor}, @code{unused} and @code{weak} are
-currently defined for functions. Other attributes, including
-@code{section} are supported for variables declarations (@pxref{Variable
-Attributes}) and for types (@pxref{Type Attributes}).
-
-You may also specify attributes with @samp{__} preceding and following
-each keyword. This allows you to use them in header files without
-being concerned about a possible macro of the same name. For example,
-you may use @code{__noreturn__} instead of @code{noreturn}.
-
-@table @code
-@cindex @code{noreturn} function attribute
-@item noreturn
-A few standard library functions, such as @code{abort} and @code{exit},
-cannot return. GNU CC knows this automatically. Some programs define
-their own functions that never return. You can declare them
-@code{noreturn} to tell the compiler this fact. For example,
-
-@smallexample
-void fatal () __attribute__ ((noreturn));
-
-void
-fatal (@dots{})
-@{
- @dots{} /* @r{Print error message.} */ @dots{}
- exit (1);
-@}
-@end smallexample
-
-The @code{noreturn} keyword tells the compiler to assume that
-@code{fatal} cannot return. It can then optimize without regard to what
-would happen if @code{fatal} ever did return. This makes slightly
-better code. More importantly, it helps avoid spurious warnings of
-uninitialized variables.
-
-Do not assume that registers saved by the calling function are
-restored before calling the @code{noreturn} function.
-
-It does not make sense for a @code{noreturn} function to have a return
-type other than @code{void}.
-
-The attribute @code{noreturn} is not implemented in GNU C versions
-earlier than 2.5. An alternative way to declare that a function does
-not return, which works in the current version and in some older
-versions, is as follows:
-
-@smallexample
-typedef void voidfn ();
-
-volatile voidfn fatal;
-@end smallexample
-
-@cindex @code{const} function attribute
-@item const
-Many functions do not examine any values except their arguments, and
-have no effects except the return value. Such a function can be subject
-to common subexpression elimination and loop optimization just as an
-arithmetic operator would be. These functions should be declared
-with the attribute @code{const}. For example,
-
-@smallexample
-int square (int) __attribute__ ((const));
-@end smallexample
-
-@noindent
-says that the hypothetical function @code{square} is safe to call
-fewer times than the program says.
-
-The attribute @code{const} is not implemented in GNU C versions earlier
-than 2.5. An alternative way to declare that a function has no side
-effects, which works in the current version and in some older versions,
-is as follows:
-
-@smallexample
-typedef int intfn ();
-
-extern const intfn square;
-@end smallexample
-
-This approach does not work in GNU C++ from 2.6.0 on, since the language
-specifies that the @samp{const} must be attached to the return value.
-
-@cindex pointer arguments
-Note that a function that has pointer arguments and examines the data
-pointed to must @emph{not} be declared @code{const}. Likewise, a
-function that calls a non-@code{const} function usually must not be
-@code{const}. It does not make sense for a @code{const} function to
-return @code{void}.
-
-@item format (@var{archetype}, @var{string-index}, @var{first-to-check})
-@cindex @code{format} function attribute
-The @code{format} attribute specifies that a function takes @code{printf}
-or @code{scanf} style arguments which should be type-checked against a
-format string. For example, the declaration:
-
-@smallexample
-extern int
-my_printf (void *my_object, const char *my_format, ...)
- __attribute__ ((format (printf, 2, 3)));
-@end smallexample
-
-@noindent
-causes the compiler to check the arguments in calls to @code{my_printf}
-for consistency with the @code{printf} style format string argument
-@code{my_format}.
-
-The parameter @var{archetype} determines how the format string is
-interpreted, and should be either @code{printf} or @code{scanf}. The
-parameter @var{string-index} specifies which argument is the format
-string argument (starting from 1), while @var{first-to-check} is the
-number of the first argument to check against the format string. For
-functions where the arguments are not available to be checked (such as
-@code{vprintf}), specify the third parameter as zero. In this case the
-compiler only checks the format string for consistency.
-
-In the example above, the format string (@code{my_format}) is the second
-argument of the function @code{my_print}, and the arguments to check
-start with the third argument, so the correct parameters for the format
-attribute are 2 and 3.
-
-The @code{format} attribute allows you to identify your own functions
-which take format strings as arguments, so that GNU CC can check the
-calls to these functions for errors. The compiler always checks formats
-for the ANSI library functions @code{printf}, @code{fprintf},
-@code{sprintf}, @code{scanf}, @code{fscanf}, @code{sscanf},
-@code{vprintf}, @code{vfprintf} and @code{vsprintf} whenever such
-warnings are requested (using @samp{-Wformat}), so there is no need to
-modify the header file @file{stdio.h}.
-
-@item format_arg (@var{string-index})
-@cindex @code{format_arg} function attribute
-The @code{format_arg} attribute specifies that a function takes
-@code{printf} or @code{scanf} style arguments, modifies it (for example,
-to translate it into another language), and passes it to a @code{printf}
-or @code{scanf} style function. For example, the declaration:
-
-@smallexample
-extern char *
-my_dgettext (char *my_domain, const char *my_format)
- __attribute__ ((format_arg (2)));
-@end smallexample
-
-@noindent
-causes the compiler to check the arguments in calls to
-@code{my_dgettext} whose result is passed to a @code{printf} or
-@code{scanf} type function for consistency with the @code{printf} style
-format string argument @code{my_format}.
-
-The parameter @var{string-index} specifies which argument is the format
-string argument (starting from 1).
-
-The @code{format-arg} attribute allows you to identify your own
-functions which modify format strings, so that GNU CC can check the
-calls to @code{printf} and @code{scanf} function whose operands are a
-call to one of your own function. The compiler always treats
-@code{gettext}, @code{dgettext}, and @code{dcgettext} in this manner.
-
-@item section ("section-name")
-@cindex @code{section} function attribute
-Normally, the compiler places the code it generates in the @code{text} section.
-Sometimes, however, you need additional sections, or you need certain
-particular functions to appear in special sections. The @code{section}
-attribute specifies that a function lives in a particular section.
-For example, the declaration:
-
-@smallexample
-extern void foobar (void) __attribute__ ((section ("bar")));
-@end smallexample
-
-@noindent
-puts the function @code{foobar} in the @code{bar} section.
-
-Some file formats do not support arbitrary sections so the @code{section}
-attribute is not available on all platforms.
-If you need to map the entire contents of a module to a particular
-section, consider using the facilities of the linker instead.
-
-@item constructor
-@itemx destructor
-@cindex @code{constructor} function attribute
-@cindex @code{destructor} function attribute
-The @code{constructor} attribute causes the function to be called
-automatically before execution enters @code{main ()}. Similarly, the
-@code{destructor} attribute causes the function to be called
-automatically after @code{main ()} has completed or @code{exit ()} has
-been called. Functions with these attributes are useful for
-initializing data that will be used implicitly during the execution of
-the program.
-
-These attributes are not currently implemented for Objective C.
-
-@item unused
-This attribute, attached to a function, means that the function is meant
-to be possibly unused. GNU CC will not produce a warning for this
-function. GNU C++ does not currently support this attribute as
-definitions without parameters are valid in C++.
-
-@item weak
-@cindex @code{weak} attribute
-The @code{weak} attribute causes the declaration to be emitted as a weak
-symbol rather than a global. This is primarily useful in defining
-library functions which can be overridden in user code, though it can
-also be used with non-function declarations. Weak symbols are supported
-for ELF targets, and also for a.out targets when using the GNU assembler
-and linker.
-
-@item alias ("target")
-@cindex @code{alias} attribute
-The @code{alias} attribute causes the declaration to be emitted as an
-alias for another symbol, which must be specified. For instance,
-
-@smallexample
-void __f () @{ /* do something */; @}
-void f () __attribute__ ((weak, alias ("__f")));
-@end smallexample
-
-declares @samp{f} to be a weak alias for @samp{__f}. In C++, the
-mangled name for the target must be used.
-
-Not all target machines support this attribute.
-
-@item regparm (@var{number})
-@cindex functions that are passed arguments in registers on the 386
-On the Intel 386, the @code{regparm} attribute causes the compiler to
-pass up to @var{number} integer arguments in registers @var{EAX},
-@var{EDX}, and @var{ECX} instead of on the stack. Functions that take a
-variable number of arguments will continue to be passed all of their
-arguments on the stack.
-
-@item stdcall
-@cindex functions that pop the argument stack on the 386
-On the Intel 386, the @code{stdcall} attribute causes the compiler to
-assume that the called function will pop off the stack space used to
-pass arguments, unless it takes a variable number of arguments.
-
-The PowerPC compiler for Windows NT currently ignores the @code{stdcall}
-attribute.
-
-@item cdecl
-@cindex functions that do pop the argument stack on the 386
-On the Intel 386, the @code{cdecl} attribute causes the compiler to
-assume that the calling function will pop off the stack space used to
-pass arguments. This is
-useful to override the effects of the @samp{-mrtd} switch.
-
-The PowerPC compiler for Windows NT currently ignores the @code{cdecl}
-attribute.
-
-@item longcall
-@cindex functions called via pointer on the RS/6000 and PowerPC
-On the RS/6000 and PowerPC, the @code{longcall} attribute causes the
-compiler to always call the function via a pointer, so that functions
-which reside further than 64 megabytes (67,108,864 bytes) from the
-current location can be called.
-
-@item dllimport
-@cindex functions which are imported from a dll on PowerPC Windows NT
-On the PowerPC running Windows NT, the @code{dllimport} attribute causes
-the compiler to call the function via a global pointer to the function
-pointer that is set up by the Windows NT dll library. The pointer name
-is formed by combining @code{__imp_} and the function name.
-
-@item dllexport
-@cindex functions which are exported from a dll on PowerPC Windows NT
-On the PowerPC running Windows NT, the @code{dllexport} attribute causes
-the compiler to provide a global pointer to the function pointer, so
-that it can be called with the @code{dllimport} attribute. The pointer
-name is formed by combining @code{__imp_} and the function name.
-
-@item exception (@var{except-func} [, @var{except-arg}])
-@cindex functions which specify exception handling on PowerPC Windows NT
-On the PowerPC running Windows NT, the @code{exception} attribute causes
-the compiler to modify the structured exception table entry it emits for
-the declared function. The string or identifier @var{except-func} is
-placed in the third entry of the structured exception table. It
-represents a function, which is called by the exception handling
-mechanism if an exception occurs. If it was specified, the string or
-identifier @var{except-arg} is placed in the fourth entry of the
-structured exception table.
-
-@item function_vector
-@cindex calling functions through the function vector on the H8/300 processors
-Use this option on the H8/300 and H8/300H to indicate that the specified
-function should be called through the function vector. Calling a
-function through the function vector will reduce code size, however;
-the function vector has a limited size (maximum 128 entries on the H8/300
-and 64 entries on the H8/300H) and shares space with the interrupt vector.
-
-You must use GAS and GLD from GNU binutils version 2.7 or later for
-this option to work correctly.
-
-@item interrupt_handler
-@cindex interrupt handler functions on the H8/300 processors
-Use this option on the H8/300 and H8/300H to indicate that the specified
-function is an interrupt handler. The compiler will generate function
-entry and exit sequences suitable for use in an interrupt handler when this
-attribute is present.
-
-@item eightbit_data
-@cindex eight bit data on the H8/300 and H8/300H
-Use this option on the H8/300 and H8/300H to indicate that the specified
-variable should be placed into the eight bit data section.
-The compiler will generate more efficient code for certain operations
-on data in the eight bit data area. Note the eight bit data area is limited to
-256 bytes of data.
-
-You must use GAS and GLD from GNU binutils version 2.7 or later for
-this option to work correctly.
-
-@item tiny_data
-@cindex tiny data section on the H8/300H
-Use this option on the H8/300H to indicate that the specified
-variable should be placed into the tiny data section.
-The compiler will generate more efficient code for loads and stores
-on data in the tiny data section. Note the tiny data area is limited to
-slightly under 32kbytes of data.
-
-@item interrupt
-@cindex interrupt handlers on the M32R/D
-Use this option on the M32R/D to indicate that the specified
-function is an interrupt handler. The compiler will generate function
-entry and exit sequences suitable for use in an interrupt handler when this
-attribute is present.
-
-@item model (@var{model-name})
-@cindex function addressability on the M32R/D
-Use this attribute on the M32R/D to set the addressability of an object,
-and the code generated for a function.
-The identifier @var{model-name} is one of @code{small}, @code{medium},
-or @code{large}, representing each of the code models.
-
-Small model objects live in the lower 16MB of memory (so that their
-addresses can be loaded with the @code{ld24} instruction), and are
-callable with the @code{bl} instruction.
-
-Medium model objects may live anywhere in the 32 bit address space (the
-compiler will generate @code{seth/add3} instructions to load their addresses),
-and are callable with the @code{bl} instruction.
-
-Large model objects may live anywhere in the 32 bit address space (the
-compiler will generate @code{seth/add3} instructions to load their addresses),
-and may not be reachable with the @code{bl} instruction (the compiler will
-generate the much slower @code{seth/add3/jl} instruction sequence).
-
-@end table
-
-You can specify multiple attributes in a declaration by separating them
-by commas within the double parentheses or by immediately following an
-attribute declaration with another attribute declaration.
-
-@cindex @code{#pragma}, reason for not using
-@cindex pragma, reason for not using
-Some people object to the @code{__attribute__} feature, suggesting that ANSI C's
-@code{#pragma} should be used instead. There are two reasons for not
-doing this.
-
-@enumerate
-@item
-It is impossible to generate @code{#pragma} commands from a macro.
-
-@item
-There is no telling what the same @code{#pragma} might mean in another
-compiler.
-@end enumerate
-
-These two reasons apply to almost any application that might be proposed
-for @code{#pragma}. It is basically a mistake to use @code{#pragma} for
-@emph{anything}.
-
-@node Function Prototypes
-@section Prototypes and Old-Style Function Definitions
-@cindex function prototype declarations
-@cindex old-style function definitions
-@cindex promotion of formal parameters
-
-GNU C extends ANSI C to allow a function prototype to override a later
-old-style non-prototype definition. Consider the following example:
-
-@example
-/* @r{Use prototypes unless the compiler is old-fashioned.} */
-#if __STDC__
-#define P(x) x
-#else
-#define P(x) ()
-#endif
-
-/* @r{Prototype function declaration.} */
-int isroot P((uid_t));
-
-/* @r{Old-style function definition.} */
-int
-isroot (x) /* ??? lossage here ??? */
- uid_t x;
-@{
- return x == 0;
-@}
-@end example
-
-Suppose the type @code{uid_t} happens to be @code{short}. ANSI C does
-not allow this example, because subword arguments in old-style
-non-prototype definitions are promoted. Therefore in this example the
-function definition's argument is really an @code{int}, which does not
-match the prototype argument type of @code{short}.
-
-This restriction of ANSI C makes it hard to write code that is portable
-to traditional C compilers, because the programmer does not know
-whether the @code{uid_t} type is @code{short}, @code{int}, or
-@code{long}. Therefore, in cases like these GNU C allows a prototype
-to override a later old-style definition. More precisely, in GNU C, a
-function prototype argument type overrides the argument type specified
-by a later old-style definition if the former type is the same as the
-latter type before promotion. Thus in GNU C the above example is
-equivalent to the following:
-
-@example
-int isroot (uid_t);
-
-int
-isroot (uid_t x)
-@{
- return x == 0;
-@}
-@end example
-
-GNU C++ does not support old-style function definitions, so this
-extension is irrelevant.
-
-@node C++ Comments
-@section C++ Style Comments
-@cindex //
-@cindex C++ comments
-@cindex comments, C++ style
-
-In GNU C, you may use C++ style comments, which start with @samp{//} and
-continue until the end of the line. Many other C implementations allow
-such comments, and they are likely to be in a future C standard.
-However, C++ style comments are not recognized if you specify
-@w{@samp{-ansi}} or @w{@samp{-traditional}}, since they are incompatible
-with traditional constructs like @code{dividend//*comment*/divisor}.
-
-@node Dollar Signs
-@section Dollar Signs in Identifier Names
-@cindex $
-@cindex dollar signs in identifier names
-@cindex identifier names, dollar signs in
-
-In GNU C, you may normally use dollar signs in identifier names.
-This is because many traditional C implementations allow such identifiers.
-However, dollar signs in identifiers are not supported on a few target
-machines, typically because the target assembler does not allow them.
-
-@node Character Escapes
-@section The Character @key{ESC} in Constants
-
-You can use the sequence @samp{\e} in a string or character constant to
-stand for the ASCII character @key{ESC}.
-
-@node Alignment
-@section Inquiring on Alignment of Types or Variables
-@cindex alignment
-@cindex type alignment
-@cindex variable alignment
-
-The keyword @code{__alignof__} allows you to inquire about how an object
-is aligned, or the minimum alignment usually required by a type. Its
-syntax is just like @code{sizeof}.
-
-For example, if the target machine requires a @code{double} value to be
-aligned on an 8-byte boundary, then @code{__alignof__ (double)} is 8.
-This is true on many RISC machines. On more traditional machine
-designs, @code{__alignof__ (double)} is 4 or even 2.
-
-Some machines never actually require alignment; they allow reference to any
-data type even at an odd addresses. For these machines, @code{__alignof__}
-reports the @emph{recommended} alignment of a type.
-
-When the operand of @code{__alignof__} is an lvalue rather than a type, the
-value is the largest alignment that the lvalue is known to have. It may
-have this alignment as a result of its data type, or because it is part of
-a structure and inherits alignment from that structure. For example, after
-this declaration:
-
-@example
-struct foo @{ int x; char y; @} foo1;
-@end example
-
-@noindent
-the value of @code{__alignof__ (foo1.y)} is probably 2 or 4, the same as
-@code{__alignof__ (int)}, even though the data type of @code{foo1.y}
-does not itself demand any alignment.@refill
-
-A related feature which lets you specify the alignment of an object is
-@code{__attribute__ ((aligned (@var{alignment})))}; see the following
-section.
-
-@node Variable Attributes
-@section Specifying Attributes of Variables
-@cindex attribute of variables
-@cindex variable attributes
-
-The keyword @code{__attribute__} allows you to specify special
-attributes of variables or structure fields. This keyword is followed
-by an attribute specification inside double parentheses. Eight
-attributes are currently defined for variables: @code{aligned},
-@code{mode}, @code{nocommon}, @code{packed}, @code{section},
-@code{transparent_union}, @code{unused}, and @code{weak}. Other
-attributes are available for functions (@pxref{Function Attributes}) and
-for types (@pxref{Type Attributes}).
-
-You may also specify attributes with @samp{__} preceding and following
-each keyword. This allows you to use them in header files without
-being concerned about a possible macro of the same name. For example,
-you may use @code{__aligned__} instead of @code{aligned}.
-
-@table @code
-@cindex @code{aligned} attribute
-@item aligned (@var{alignment})
-This attribute specifies a minimum alignment for the variable or
-structure field, measured in bytes. For example, the declaration:
-
-@smallexample
-int x __attribute__ ((aligned (16))) = 0;
-@end smallexample
-
-@noindent
-causes the compiler to allocate the global variable @code{x} on a
-16-byte boundary. On a 68040, this could be used in conjunction with
-an @code{asm} expression to access the @code{move16} instruction which
-requires 16-byte aligned operands.
-
-You can also specify the alignment of structure fields. For example, to
-create a double-word aligned @code{int} pair, you could write:
-
-@smallexample
-struct foo @{ int x[2] __attribute__ ((aligned (8))); @};
-@end smallexample
-
-@noindent
-This is an alternative to creating a union with a @code{double} member
-that forces the union to be double-word aligned.
-
-It is not possible to specify the alignment of functions; the alignment
-of functions is determined by the machine's requirements and cannot be
-changed. You cannot specify alignment for a typedef name because such a
-name is just an alias, not a distinct type.
-
-As in the preceding examples, you can explicitly specify the alignment
-(in bytes) that you wish the compiler to use for a given variable or
-structure field. Alternatively, you can leave out the alignment factor
-and just ask the compiler to align a variable or field to the maximum
-useful alignment for the target machine you are compiling for. For
-example, you could write:
-
-@smallexample
-short array[3] __attribute__ ((aligned));
-@end smallexample
-
-Whenever you leave out the alignment factor in an @code{aligned} attribute
-specification, the compiler automatically sets the alignment for the declared
-variable or field to the largest alignment which is ever used for any data
-type on the target machine you are compiling for. Doing this can often make
-copy operations more efficient, because the compiler can use whatever
-instructions copy the biggest chunks of memory when performing copies to
-or from the variables or fields that you have aligned this way.
-
-The @code{aligned} attribute can only increase the alignment; but you
-can decrease it by specifying @code{packed} as well. See below.
-
-Note that the effectiveness of @code{aligned} attributes may be limited
-by inherent limitations in your linker. On many systems, the linker is
-only able to arrange for variables to be aligned up to a certain maximum
-alignment. (For some linkers, the maximum supported alignment may
-be very very small.) If your linker is only able to align variables
-up to a maximum of 8 byte alignment, then specifying @code{aligned(16)}
-in an @code{__attribute__} will still only provide you with 8 byte
-alignment. See your linker documentation for further information.
-
-@item mode (@var{mode})
-@cindex @code{mode} attribute
-This attribute specifies the data type for the declaration---whichever
-type corresponds to the mode @var{mode}. This in effect lets you
-request an integer or floating point type according to its width.
-
-You may also specify a mode of @samp{byte} or @samp{__byte__} to
-indicate the mode corresponding to a one-byte integer, @samp{word} or
-@samp{__word__} for the mode of a one-word integer, and @samp{pointer}
-or @samp{__pointer__} for the mode used to represent pointers.
-
-@item nocommon
-@cindex @code{nocommon} attribute
-This attribute specifies requests GNU CC not to place a variable
-``common'' but instead to allocate space for it directly. If you
-specify the @samp{-fno-common} flag, GNU CC will do this for all
-variables.
-
-Specifying the @code{nocommon} attribute for a variable provides an
-initialization of zeros. A variable may only be initialized in one
-source file.
-
-@item packed
-@cindex @code{packed} attribute
-The @code{packed} attribute specifies that a variable or structure field
-should have the smallest possible alignment---one byte for a variable,
-and one bit for a field, unless you specify a larger value with the
-@code{aligned} attribute.
-
-Here is a structure in which the field @code{x} is packed, so that it
-immediately follows @code{a}:
-
-@example
-struct foo
-@{
- char a;
- int x[2] __attribute__ ((packed));
-@};
-@end example
-
-@item section ("section-name")
-@cindex @code{section} variable attribute
-Normally, the compiler places the objects it generates in sections like
-@code{data} and @code{bss}. Sometimes, however, you need additional sections,
-or you need certain particular variables to appear in special sections,
-for example to map to special hardware. The @code{section}
-attribute specifies that a variable (or function) lives in a particular
-section. For example, this small program uses several specific section names:
-
-@smallexample
-struct duart a __attribute__ ((section ("DUART_A"))) = @{ 0 @};
-struct duart b __attribute__ ((section ("DUART_B"))) = @{ 0 @};
-char stack[10000] __attribute__ ((section ("STACK"))) = @{ 0 @};
-int init_data __attribute__ ((section ("INITDATA"))) = 0;
-
-main()
-@{
- /* Initialize stack pointer */
- init_sp (stack + sizeof (stack));
-
- /* Initialize initialized data */
- memcpy (&init_data, &data, &edata - &data);
-
- /* Turn on the serial ports */
- init_duart (&a);
- init_duart (&b);
-@}
-@end smallexample
-
-@noindent
-Use the @code{section} attribute with an @emph{initialized} definition
-of a @emph{global} variable, as shown in the example. GNU CC issues
-a warning and otherwise ignores the @code{section} attribute in
-uninitialized variable declarations.
-
-You may only use the @code{section} attribute with a fully initialized
-global definition because of the way linkers work. The linker requires
-each object be defined once, with the exception that uninitialized
-variables tentatively go in the @code{common} (or @code{bss}) section
-and can be multiply "defined". You can force a variable to be
-initialized with the @samp{-fno-common} flag or the @code{nocommon}
-attribute.
-
-Some file formats do not support arbitrary sections so the @code{section}
-attribute is not available on all platforms.
-If you need to map the entire contents of a module to a particular
-section, consider using the facilities of the linker instead.
-
-@item transparent_union
-This attribute, attached to a function parameter which is a union, means
-that the corresponding argument may have the type of any union member,
-but the argument is passed as if its type were that of the first union
-member. For more details see @xref{Type Attributes}. You can also use
-this attribute on a @code{typedef} for a union data type; then it
-applies to all function parameters with that type.
-
-@item unused
-This attribute, attached to a variable, means that the variable is meant
-to be possibly unused. GNU CC will not produce a warning for this
-variable.
-
-@item weak
-The @code{weak} attribute is described in @xref{Function Attributes}.
-
-@item model (@var{model-name})
-@cindex variable addressability on the M32R/D
-Use this attribute on the M32R/D to set the addressability of an object.
-The identifier @var{model-name} is one of @code{small}, @code{medium},
-or @code{large}, representing each of the code models.
-
-Small model objects live in the lower 16MB of memory (so that their
-addresses can be loaded with the @code{ld24} instruction).
-
-Medium and large model objects may live anywhere in the 32 bit address space
-(the compiler will generate @code{seth/add3} instructions to load their
-addresses).
-
-@end table
-
-To specify multiple attributes, separate them by commas within the
-double parentheses: for example, @samp{__attribute__ ((aligned (16),
-packed))}.
-
-@node Type Attributes
-@section Specifying Attributes of Types
-@cindex attribute of types
-@cindex type attributes
-
-The keyword @code{__attribute__} allows you to specify special
-attributes of @code{struct} and @code{union} types when you define such
-types. This keyword is followed by an attribute specification inside
-double parentheses. Three attributes are currently defined for types:
-@code{aligned}, @code{packed}, and @code{transparent_union}. Other
-attributes are defined for functions (@pxref{Function Attributes}) and
-for variables (@pxref{Variable Attributes}).
-
-You may also specify any one of these attributes with @samp{__}
-preceding and following its keyword. This allows you to use these
-attributes in header files without being concerned about a possible
-macro of the same name. For example, you may use @code{__aligned__}
-instead of @code{aligned}.
-
-You may specify the @code{aligned} and @code{transparent_union}
-attributes either in a @code{typedef} declaration or just past the
-closing curly brace of a complete enum, struct or union type
-@emph{definition} and the @code{packed} attribute only past the closing
-brace of a definition.
-
-@table @code
-@cindex @code{aligned} attribute
-@item aligned (@var{alignment})
-This attribute specifies a minimum alignment (in bytes) for variables
-of the specified type. For example, the declarations:
-
-@smallexample
-struct S @{ short f[3]; @} __attribute__ ((aligned (8));
-typedef int more_aligned_int __attribute__ ((aligned (8));
-@end smallexample
-
-@noindent
-force the compiler to insure (as fas as it can) that each variable whose
-type is @code{struct S} or @code{more_aligned_int} will be allocated and
-aligned @emph{at least} on a 8-byte boundary. On a Sparc, having all
-variables of type @code{struct S} aligned to 8-byte boundaries allows
-the compiler to use the @code{ldd} and @code{std} (doubleword load and
-store) instructions when copying one variable of type @code{struct S} to
-another, thus improving run-time efficiency.
-
-Note that the alignment of any given @code{struct} or @code{union} type
-is required by the ANSI C standard to be at least a perfect multiple of
-the lowest common multiple of the alignments of all of the members of
-the @code{struct} or @code{union} in question. This means that you @emph{can}
-effectively adjust the alignment of a @code{struct} or @code{union}
-type by attaching an @code{aligned} attribute to any one of the members
-of such a type, but the notation illustrated in the example above is a
-more obvious, intuitive, and readable way to request the compiler to
-adjust the alignment of an entire @code{struct} or @code{union} type.
-
-As in the preceding example, you can explicitly specify the alignment
-(in bytes) that you wish the compiler to use for a given @code{struct}
-or @code{union} type. Alternatively, you can leave out the alignment factor
-and just ask the compiler to align a type to the maximum
-useful alignment for the target machine you are compiling for. For
-example, you could write:
-
-@smallexample
-struct S @{ short f[3]; @} __attribute__ ((aligned));
-@end smallexample
-
-Whenever you leave out the alignment factor in an @code{aligned}
-attribute specification, the compiler automatically sets the alignment
-for the type to the largest alignment which is ever used for any data
-type on the target machine you are compiling for. Doing this can often
-make copy operations more efficient, because the compiler can use
-whatever instructions copy the biggest chunks of memory when performing
-copies to or from the variables which have types that you have aligned
-this way.
-
-In the example above, if the size of each @code{short} is 2 bytes, then
-the size of the entire @code{struct S} type is 6 bytes. The smallest
-power of two which is greater than or equal to that is 8, so the
-compiler sets the alignment for the entire @code{struct S} type to 8
-bytes.
-
-Note that although you can ask the compiler to select a time-efficient
-alignment for a given type and then declare only individual stand-alone
-objects of that type, the compiler's ability to select a time-efficient
-alignment is primarily useful only when you plan to create arrays of
-variables having the relevant (efficiently aligned) type. If you
-declare or use arrays of variables of an efficiently-aligned type, then
-it is likely that your program will also be doing pointer arithmetic (or
-subscripting, which amounts to the same thing) on pointers to the
-relevant type, and the code that the compiler generates for these
-pointer arithmetic operations will often be more efficient for
-efficiently-aligned types than for other types.
-
-The @code{aligned} attribute can only increase the alignment; but you
-can decrease it by specifying @code{packed} as well. See below.
-
-Note that the effectiveness of @code{aligned} attributes may be limited
-by inherent limitations in your linker. On many systems, the linker is
-only able to arrange for variables to be aligned up to a certain maximum
-alignment. (For some linkers, the maximum supported alignment may
-be very very small.) If your linker is only able to align variables
-up to a maximum of 8 byte alignment, then specifying @code{aligned(16)}
-in an @code{__attribute__} will still only provide you with 8 byte
-alignment. See your linker documentation for further information.
-
-@item packed
-This attribute, attached to an @code{enum}, @code{struct}, or
-@code{union} type definition, specified that the minimum required memory
-be used to represent the type.
-
-Specifying this attribute for @code{struct} and @code{union} types is
-equivalent to specifying the @code{packed} attribute on each of the
-structure or union members. Specifying the @samp{-fshort-enums}
-flag on the line is equivalent to specifying the @code{packed}
-attribute on all @code{enum} definitions.
-
-You may only specify this attribute after a closing curly brace on an
-@code{enum} definition, not in a @code{typedef} declaration, unless that
-declaration also contains the definition of the @code{enum}.
-
-@item transparent_union
-This attribute, attached to a @code{union} type definition, indicates
-that any function parameter having that union type causes calls to that
-function to be treated in a special way.
-
-First, the argument corresponding to a transparent union type can be of
-any type in the union; no cast is required. Also, if the union contains
-a pointer type, the corresponding argument can be a null pointer
-constant or a void pointer expression; and if the union contains a void
-pointer type, the corresponding argument can be any pointer expression.
-If the union member type is a pointer, qualifiers like @code{const} on
-the referenced type must be respected, just as with normal pointer
-conversions.
-
-Second, the argument is passed to the function using the calling
-conventions of first member of the transparent union, not the calling
-conventions of the union itself. All members of the union must have the
-same machine representation; this is necessary for this argument passing
-to work properly.
-
-Transparent unions are designed for library functions that have multiple
-interfaces for compatibility reasons. For example, suppose the
-@code{wait} function must accept either a value of type @code{int *} to
-comply with Posix, or a value of type @code{union wait *} to comply with
-the 4.1BSD interface. If @code{wait}'s parameter were @code{void *},
-@code{wait} would accept both kinds of arguments, but it would also
-accept any other pointer type and this would make argument type checking
-less useful. Instead, @code{<sys/wait.h>} might define the interface
-as follows:
-
-@smallexample
-typedef union
- @{
- int *__ip;
- union wait *__up;
- @} wait_status_ptr_t __attribute__ ((__transparent_union__));
-
-pid_t wait (wait_status_ptr_t);
-@end smallexample
-
-This interface allows either @code{int *} or @code{union wait *}
-arguments to be passed, using the @code{int *} calling convention.
-The program can call @code{wait} with arguments of either type:
-
-@example
-int w1 () @{ int w; return wait (&w); @}
-int w2 () @{ union wait w; return wait (&w); @}
-@end example
-
-With this interface, @code{wait}'s implementation might look like this:
-
-@example
-pid_t wait (wait_status_ptr_t p)
-@{
- return waitpid (-1, p.__ip, 0);
-@}
-@end example
-@end table
-
-To specify multiple attributes, separate them by commas within the
-double parentheses: for example, @samp{__attribute__ ((aligned (16),
-packed))}.
-
-@node Inline
-@section An Inline Function is As Fast As a Macro
-@cindex inline functions
-@cindex integrating function code
-@cindex open coding
-@cindex macros, inline alternative
-
-By declaring a function @code{inline}, you can direct GNU CC to
-integrate that function's code into the code for its callers. This
-makes execution faster by eliminating the function-call overhead; in
-addition, if any of the actual argument values are constant, their known
-values may permit simplifications at compile time so that not all of the
-inline function's code needs to be included. The effect on code size is
-less predictable; object code may be larger or smaller with function
-inlining, depending on the particular case. Inlining of functions is an
-optimization and it really ``works'' only in optimizing compilation. If
-you don't use @samp{-O}, no function is really inline.
-
-To declare a function inline, use the @code{inline} keyword in its
-declaration, like this:
-
-@example
-inline int
-inc (int *a)
-@{
- (*a)++;
-@}
-@end example
-
-(If you are writing a header file to be included in ANSI C programs, write
-@code{__inline__} instead of @code{inline}. @xref{Alternate Keywords}.)
-
-You can also make all ``simple enough'' functions inline with the option
-@samp{-finline-functions}. Note that certain usages in a function
-definition can make it unsuitable for inline substitution.
-
-Note that in C and Objective C, unlike C++, the @code{inline} keyword
-does not affect the linkage of the function.
-
-@cindex automatic @code{inline} for C++ member fns
-@cindex @code{inline} automatic for C++ member fns
-@cindex member fns, automatically @code{inline}
-@cindex C++ member fns, automatically @code{inline}
-GNU CC automatically inlines member functions defined within the class
-body of C++ programs even if they are not explicitly declared
-@code{inline}. (You can override this with @samp{-fno-default-inline};
-@pxref{C++ Dialect Options,,Options Controlling C++ Dialect}.)
-
-@cindex inline functions, omission of
-When a function is both inline and @code{static}, if all calls to the
-function are integrated into the caller, and the function's address is
-never used, then the function's own assembler code is never referenced.
-In this case, GNU CC does not actually output assembler code for the
-function, unless you specify the option @samp{-fkeep-inline-functions}.
-Some calls cannot be integrated for various reasons (in particular,
-calls that precede the function's definition cannot be integrated, and
-neither can recursive calls within the definition). If there is a
-nonintegrated call, then the function is compiled to assembler code as
-usual. The function must also be compiled as usual if the program
-refers to its address, because that can't be inlined.
-
-@cindex non-static inline function
-When an inline function is not @code{static}, then the compiler must assume
-that there may be calls from other source files; since a global symbol can
-be defined only once in any program, the function must not be defined in
-the other source files, so the calls therein cannot be integrated.
-Therefore, a non-@code{static} inline function is always compiled on its
-own in the usual fashion.
-
-If you specify both @code{inline} and @code{extern} in the function
-definition, then the definition is used only for inlining. In no case
-is the function compiled on its own, not even if you refer to its
-address explicitly. Such an address becomes an external reference, as
-if you had only declared the function, and had not defined it.
-
-This combination of @code{inline} and @code{extern} has almost the
-effect of a macro. The way to use it is to put a function definition in
-a header file with these keywords, and put another copy of the
-definition (lacking @code{inline} and @code{extern}) in a library file.
-The definition in the header file will cause most calls to the function
-to be inlined. If any uses of the function remain, they will refer to
-the single copy in the library.
-
-GNU C does not inline any functions when not optimizing. It is not
-clear whether it is better to inline or not, in this case, but we found
-that a correct implementation when not optimizing was difficult. So we
-did the easy thing, and turned it off.
-
-@node Extended Asm
-@section Assembler Instructions with C Expression Operands
-@cindex extended @code{asm}
-@cindex @code{asm} expressions
-@cindex assembler instructions
-@cindex registers
-
-In an assembler instruction using @code{asm}, you can now specify the
-operands of the instruction using C expressions. This means no more
-guessing which registers or memory locations will contain the data you want
-to use.
-
-You must specify an assembler instruction template much like what appears
-in a machine description, plus an operand constraint string for each
-operand.
-
-For example, here is how to use the 68881's @code{fsinx} instruction:
-
-@example
-asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
-@end example
-
-@noindent
-Here @code{angle} is the C expression for the input operand while
-@code{result} is that of the output operand. Each has @samp{"f"} as its
-operand constraint, saying that a floating point register is required. The
-@samp{=} in @samp{=f} indicates that the operand is an output; all output
-operands' constraints must use @samp{=}. The constraints use the same
-language used in the machine description (@pxref{Constraints}).
-
-Each operand is described by an operand-constraint string followed by the C
-expression in parentheses. A colon separates the assembler template from
-the first output operand, and another separates the last output operand
-from the first input, if any. Commas separate output operands and separate
-inputs. The total number of operands is limited to ten or to the maximum
-number of operands in any instruction pattern in the machine description,
-whichever is greater.
-
-If there are no output operands, and there are input operands, then there
-must be two consecutive colons surrounding the place where the output
-operands would go.
-
-Output operand expressions must be lvalues; the compiler can check this.
-The input operands need not be lvalues. The compiler cannot check whether
-the operands have data types that are reasonable for the instruction being
-executed. It does not parse the assembler instruction template and does
-not know what it means, or whether it is valid assembler input. The
-extended @code{asm} feature is most often used for machine instructions
-that the compiler itself does not know exist. If the output expression
-cannot be directly addressed (for example, it is a bit field), your
-constraint must allow a register. In that case, GNU CC will use
-the register as the output of the @code{asm}, and then store that
-register into the output.
-
-The ordinary output operands must be write-only; GNU CC will assume
-that the values in these operands before the instruction are dead and
-need not be generated. Extended asm supports input-output or
-read-write operands. Use the constraint character @samp{+} to indicate
-such an operand and list it with the output operands.
-
-When the constraints for the read-write operand
-(or the operand in which only some of the bits are to be changed)
-allows a register, you may, as an alternative, logically
-split its function into two separate operands, one input operand and one
-write-only output operand. The connection between them is expressed by
-constraints which say they need to be in the same location when the
-instruction executes. You can use the same C expression for both
-operands, or different expressions. For example, here we write the
-(fictitious) @samp{combine} instruction with @code{bar} as its read-only
-source operand and @code{foo} as its read-write destination:
-
-@example
-asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar));
-@end example
-
-@noindent
-The constraint @samp{"0"} for operand 1 says that it must occupy the same
-location as operand 0. A digit in constraint is allowed only in an input
-operand, and it must refer to an output operand.
-
-Only a digit in the constraint can guarantee that one operand will be in
-the same place as another. The mere fact that @code{foo} is the value of
-both operands is not enough to guarantee that they will be in the same
-place in the generated assembler code. The following would not work:
-
-@example
-asm ("combine %2,%0" : "=r" (foo) : "r" (foo), "g" (bar));
-@end example
-
-Various optimizations or reloading could cause operands 0 and 1 to be in
-different registers; GNU CC knows no reason not to do so. For example, the
-compiler might find a copy of the value of @code{foo} in one register and
-use it for operand 1, but generate the output operand 0 in a different
-register (copying it afterward to @code{foo}'s own address). Of course,
-since the register for operand 1 is not even mentioned in the assembler
-code, the result will not work, but GNU CC can't tell that.
-
-Some instructions clobber specific hard registers. To describe this, write
-a third colon after the input operands, followed by the names of the
-clobbered hard registers (given as strings). Here is a realistic example
-for the Vax:
-
-@example
-asm volatile ("movc3 %0,%1,%2"
- : /* no outputs */
- : "g" (from), "g" (to), "g" (count)
- : "r0", "r1", "r2", "r3", "r4", "r5");
-@end example
-
-If you refer to a particular hardware register from the assembler code,
-then you will probably have to list the register after the third colon
-to tell the compiler that the register's value is modified. In many
-assemblers, the register names begin with @samp{%}; to produce one
-@samp{%} in the assembler code, you must write @samp{%%} in the input.
-
-If your assembler instruction can alter the condition code register,
-add @samp{cc} to the list of clobbered registers. GNU CC on some
-machines represents the condition codes as a specific hardware
-register; @samp{cc} serves to name this register. On other machines,
-the condition code is handled differently, and specifying @samp{cc}
-has no effect. But it is valid no matter what the machine.
-
-If your assembler instruction modifies memory in an unpredictable
-fashion, add @samp{memory} to the list of clobbered registers.
-This will cause GNU CC to not keep memory values cached in
-registers across the assembler instruction.
-
-You can put multiple assembler instructions together in a single @code{asm}
-template, separated either with newlines (written as @samp{\n}) or with
-semicolons if the assembler allows such semicolons. The GNU assembler
-allows semicolons and all Unix assemblers seem to do so. The input
-operands are guaranteed not to use any of the clobbered registers, and
-neither will the output operands' addresses, so you can read and write the
-clobbered registers as many times as you like. Here is an example of
-multiple instructions in a template; it assumes that the subroutine
-@code{_foo} accepts arguments in registers 9 and 10:
-
-@example
-asm ("movl %0,r9;movl %1,r10;call _foo"
- : /* no outputs */
- : "g" (from), "g" (to)
- : "r9", "r10");
-@end example
-
-Unless an output operand has the @samp{&} constraint modifier, GNU CC may
-allocate it in the same register as an unrelated input operand, on the
-assumption that the inputs are consumed before the outputs are produced.
-This assumption may be false if the assembler code actually consists of
-more than one instruction. In such a case, use @samp{&} for each output
-operand that may not overlap an input.
-@xref{Modifiers}.
-
-If you want to test the condition code produced by an assembler instruction,
-you must include a branch and a label in the @code{asm} construct, as follows:
-
-@example
-asm ("clr %0;frob %1;beq 0f;mov #1,%0;0:"
- : "g" (result)
- : "g" (input));
-@end example
-
-@noindent
-This assumes your assembler supports local labels, as the GNU assembler
-and most Unix assemblers do.
-
-Speaking of labels, jumps from one @code{asm} to another are not
-supported. The compiler's optimizers do not know about these jumps,
-and therefore they cannot take account of them when deciding how to
-optimize.
-
-@cindex macros containing @code{asm}
-Usually the most convenient way to use these @code{asm} instructions is to
-encapsulate them in macros that look like functions. For example,
-
-@example
-#define sin(x) \
-(@{ double __value, __arg = (x); \
- asm ("fsinx %1,%0": "=f" (__value): "f" (__arg)); \
- __value; @})
-@end example
-
-@noindent
-Here the variable @code{__arg} is used to make sure that the instruction
-operates on a proper @code{double} value, and to accept only those
-arguments @code{x} which can convert automatically to a @code{double}.
-
-Another way to make sure the instruction operates on the correct data type
-is to use a cast in the @code{asm}. This is different from using a
-variable @code{__arg} in that it converts more different types. For
-example, if the desired type were @code{int}, casting the argument to
-@code{int} would accept a pointer with no complaint, while assigning the
-argument to an @code{int} variable named @code{__arg} would warn about
-using a pointer unless the caller explicitly casts it.
-
-If an @code{asm} has output operands, GNU CC assumes for optimization
-purposes that the instruction has no side effects except to change the
-output operands. This does not mean that instructions with a side effect
-cannot be used, but you must be careful, because the compiler may eliminate
-them if the output operands aren't used, or move them out of loops, or
-replace two with one if they constitute a common subexpression. Also, if
-your instruction does have a side effect on a variable that otherwise
-appears not to change, the old value of the variable may be reused later if
-it happens to be found in a register.
-
-You can prevent an @code{asm} instruction from being deleted, moved
-significantly, or combined, by writing the keyword @code{volatile} after
-the @code{asm}. For example:
-
-@example
-#define set_priority(x) \
-asm volatile ("set_priority %0": /* no outputs */ : "g" (x))
-@end example
-
-@noindent
-An instruction without output operands will not be deleted or moved
-significantly, regardless, unless it is unreachable.
-
-Note that even a volatile @code{asm} instruction can be moved in ways
-that appear insignificant to the compiler, such as across jump
-instructions. You can't expect a sequence of volatile @code{asm}
-instructions to remain perfectly consecutive. If you want consecutive
-output, use a single @code{asm}.
-
-It is a natural idea to look for a way to give access to the condition
-code left by the assembler instruction. However, when we attempted to
-implement this, we found no way to make it work reliably. The problem
-is that output operands might need reloading, which would result in
-additional following ``store'' instructions. On most machines, these
-instructions would alter the condition code before there was time to
-test it. This problem doesn't arise for ordinary ``test'' and
-``compare'' instructions because they don't have any output operands.
-
-If you are writing a header file that should be includable in ANSI C
-programs, write @code{__asm__} instead of @code{asm}. @xref{Alternate
-Keywords}.
-
-@ifclear INTERNALS
-@c Show the details on constraints if they do not appear elsewhere in
-@c the manual
-@include md.texi
-@end ifclear
-
-@node Asm Labels
-@section Controlling Names Used in Assembler Code
-@cindex assembler names for identifiers
-@cindex names used in assembler code
-@cindex identifiers, names in assembler code
-
-You can specify the name to be used in the assembler code for a C
-function or variable by writing the @code{asm} (or @code{__asm__})
-keyword after the declarator as follows:
-
-@example
-int foo asm ("myfoo") = 2;
-@end example
-
-@noindent
-This specifies that the name to be used for the variable @code{foo} in
-the assembler code should be @samp{myfoo} rather than the usual
-@samp{_foo}.
-
-On systems where an underscore is normally prepended to the name of a C
-function or variable, this feature allows you to define names for the
-linker that do not start with an underscore.
-
-You cannot use @code{asm} in this way in a function @emph{definition}; but
-you can get the same effect by writing a declaration for the function
-before its definition and putting @code{asm} there, like this:
-
-@example
-extern func () asm ("FUNC");
-
-func (x, y)
- int x, y;
-@dots{}
-@end example
-
-It is up to you to make sure that the assembler names you choose do not
-conflict with any other assembler symbols. Also, you must not use a
-register name; that would produce completely invalid assembler code. GNU
-CC does not as yet have the ability to store static variables in registers.
-Perhaps that will be added.
-
-@node Explicit Reg Vars
-@section Variables in Specified Registers
-@cindex explicit register variables
-@cindex variables in specified registers
-@cindex specified registers
-@cindex registers, global allocation
-
-GNU C allows you to put a few global variables into specified hardware
-registers. You can also specify the register in which an ordinary
-register variable should be allocated.
-
-@itemize @bullet
-@item
-Global register variables reserve registers throughout the program.
-This may be useful in programs such as programming language
-interpreters which have a couple of global variables that are accessed
-very often.
-
-@item
-Local register variables in specific registers do not reserve the
-registers. The compiler's data flow analysis is capable of determining
-where the specified registers contain live values, and where they are
-available for other uses.
-
-These local variables are sometimes convenient for use with the extended
-@code{asm} feature (@pxref{Extended Asm}), if you want to write one
-output of the assembler instruction directly into a particular register.
-(This will work provided the register you specify fits the constraints
-specified for that operand in the @code{asm}.)
-@end itemize
-
-@menu
-* Global Reg Vars::
-* Local Reg Vars::
-@end menu
-
-@node Global Reg Vars
-@subsection Defining Global Register Variables
-@cindex global register variables
-@cindex registers, global variables in
-
-You can define a global register variable in GNU C like this:
-
-@example
-register int *foo asm ("a5");
-@end example
-
-@noindent
-Here @code{a5} is the name of the register which should be used. Choose a
-register which is normally saved and restored by function calls on your
-machine, so that library routines will not clobber it.
-
-Naturally the register name is cpu-dependent, so you would need to
-conditionalize your program according to cpu type. The register
-@code{a5} would be a good choice on a 68000 for a variable of pointer
-type. On machines with register windows, be sure to choose a ``global''
-register that is not affected magically by the function call mechanism.
-
-In addition, operating systems on one type of cpu may differ in how they
-name the registers; then you would need additional conditionals. For
-example, some 68000 operating systems call this register @code{%a5}.
-
-Eventually there may be a way of asking the compiler to choose a register
-automatically, but first we need to figure out how it should choose and
-how to enable you to guide the choice. No solution is evident.
-
-Defining a global register variable in a certain register reserves that
-register entirely for this use, at least within the current compilation.
-The register will not be allocated for any other purpose in the functions
-in the current compilation. The register will not be saved and restored by
-these functions. Stores into this register are never deleted even if they
-would appear to be dead, but references may be deleted or moved or
-simplified.
-
-It is not safe to access the global register variables from signal
-handlers, or from more than one thread of control, because the system
-library routines may temporarily use the register for other things (unless
-you recompile them specially for the task at hand).
-
-@cindex @code{qsort}, and global register variables
-It is not safe for one function that uses a global register variable to
-call another such function @code{foo} by way of a third function
-@code{lose} that was compiled without knowledge of this variable (i.e. in a
-different source file in which the variable wasn't declared). This is
-because @code{lose} might save the register and put some other value there.
-For example, you can't expect a global register variable to be available in
-the comparison-function that you pass to @code{qsort}, since @code{qsort}
-might have put something else in that register. (If you are prepared to
-recompile @code{qsort} with the same global register variable, you can
-solve this problem.)
-
-If you want to recompile @code{qsort} or other source files which do not
-actually use your global register variable, so that they will not use that
-register for any other purpose, then it suffices to specify the compiler
-option @samp{-ffixed-@var{reg}}. You need not actually add a global
-register declaration to their source code.
-
-A function which can alter the value of a global register variable cannot
-safely be called from a function compiled without this variable, because it
-could clobber the value the caller expects to find there on return.
-Therefore, the function which is the entry point into the part of the
-program that uses the global register variable must explicitly save and
-restore the value which belongs to its caller.
-
-@cindex register variable after @code{longjmp}
-@cindex global register after @code{longjmp}
-@cindex value after @code{longjmp}
-@findex longjmp
-@findex setjmp
-On most machines, @code{longjmp} will restore to each global register
-variable the value it had at the time of the @code{setjmp}. On some
-machines, however, @code{longjmp} will not change the value of global
-register variables. To be portable, the function that called @code{setjmp}
-should make other arrangements to save the values of the global register
-variables, and to restore them in a @code{longjmp}. This way, the same
-thing will happen regardless of what @code{longjmp} does.
-
-All global register variable declarations must precede all function
-definitions. If such a declaration could appear after function
-definitions, the declaration would be too late to prevent the register from
-being used for other purposes in the preceding functions.
-
-Global register variables may not have initial values, because an
-executable file has no means to supply initial contents for a register.
-
-On the Sparc, there are reports that g3 @dots{} g7 are suitable
-registers, but certain library functions, such as @code{getwd}, as well
-as the subroutines for division and remainder, modify g3 and g4. g1 and
-g2 are local temporaries.
-
-On the 68000, a2 @dots{} a5 should be suitable, as should d2 @dots{} d7.
-Of course, it will not do to use more than a few of those.
-
-@node Local Reg Vars
-@subsection Specifying Registers for Local Variables
-@cindex local variables, specifying registers
-@cindex specifying registers for local variables
-@cindex registers for local variables
-
-You can define a local register variable with a specified register
-like this:
-
-@example
-register int *foo asm ("a5");
-@end example
-
-@noindent
-Here @code{a5} is the name of the register which should be used. Note
-that this is the same syntax used for defining global register
-variables, but for a local variable it would appear within a function.
-
-Naturally the register name is cpu-dependent, but this is not a
-problem, since specific registers are most often useful with explicit
-assembler instructions (@pxref{Extended Asm}). Both of these things
-generally require that you conditionalize your program according to
-cpu type.
-
-In addition, operating systems on one type of cpu may differ in how they
-name the registers; then you would need additional conditionals. For
-example, some 68000 operating systems call this register @code{%a5}.
-
-Eventually there may be a way of asking the compiler to choose a register
-automatically, but first we need to figure out how it should choose and
-how to enable you to guide the choice. No solution is evident.
-
-Defining such a register variable does not reserve the register; it
-remains available for other uses in places where flow control determines
-the variable's value is not live. However, these registers are made
-unavailable for use in the reload pass. I would not be surprised if
-excessive use of this feature leaves the compiler too few available
-registers to compile certain functions.
-
-@node Alternate Keywords
-@section Alternate Keywords
-@cindex alternate keywords
-@cindex keywords, alternate
-
-The option @samp{-traditional} disables certain keywords; @samp{-ansi}
-disables certain others. This causes trouble when you want to use GNU C
-extensions, or ANSI C features, in a general-purpose header file that
-should be usable by all programs, including ANSI C programs and traditional
-ones. The keywords @code{asm}, @code{typeof} and @code{inline} cannot be
-used since they won't work in a program compiled with @samp{-ansi}, while
-the keywords @code{const}, @code{volatile}, @code{signed}, @code{typeof}
-and @code{inline} won't work in a program compiled with
-@samp{-traditional}.@refill
-
-The way to solve these problems is to put @samp{__} at the beginning and
-end of each problematical keyword. For example, use @code{__asm__}
-instead of @code{asm}, @code{__const__} instead of @code{const}, and
-@code{__inline__} instead of @code{inline}.
-
-Other C compilers won't accept these alternative keywords; if you want to
-compile with another compiler, you can define the alternate keywords as
-macros to replace them with the customary keywords. It looks like this:
-
-@example
-#ifndef __GNUC__
-#define __asm__ asm
-#endif
-@end example
-
-@samp{-pedantic} causes warnings for many GNU C extensions. You can
-prevent such warnings within one expression by writing
-@code{__extension__} before the expression. @code{__extension__} has no
-effect aside from this.
-
-@node Incomplete Enums
-@section Incomplete @code{enum} Types
-
-You can define an @code{enum} tag without specifying its possible values.
-This results in an incomplete type, much like what you get if you write
-@code{struct foo} without describing the elements. A later declaration
-which does specify the possible values completes the type.
-
-You can't allocate variables or storage using the type while it is
-incomplete. However, you can work with pointers to that type.
-
-This extension may not be very useful, but it makes the handling of
-@code{enum} more consistent with the way @code{struct} and @code{union}
-are handled.
-
-This extension is not supported by GNU C++.
-
-@node Function Names
-@section Function Names as Strings
-
-GNU CC predefines two string variables to be the name of the current function.
-The variable @code{__FUNCTION__} is the name of the function as it appears
-in the source. The variable @code{__PRETTY_FUNCTION__} is the name of
-the function pretty printed in a language specific fashion.
-
-These names are always the same in a C function, but in a C++ function
-they may be different. For example, this program:
-
-@smallexample
-extern "C" @{
-extern int printf (char *, ...);
-@}
-
-class a @{
- public:
- sub (int i)
- @{
- printf ("__FUNCTION__ = %s\n", __FUNCTION__);
- printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__);
- @}
-@};
-
-int
-main (void)
-@{
- a ax;
- ax.sub (0);
- return 0;
-@}
-@end smallexample
-
-@noindent
-gives this output:
-
-@smallexample
-__FUNCTION__ = sub
-__PRETTY_FUNCTION__ = int a::sub (int)
-@end smallexample
-
-These names are not macros: they are predefined string variables.
-For example, @samp{#ifdef __FUNCTION__} does not have any special
-meaning inside a function, since the preprocessor does not do anything
-special with the identifier @code{__FUNCTION__}.
-
-@node Return Address
-@section Getting the Return or Frame Address of a Function
-
-These functions may be used to get information about the callers of a
-function.
-
-@table @code
-@item __builtin_return_address (@var{level})
-This function returns the return address of the current function, or of
-one of its callers. The @var{level} argument is number of frames to
-scan up the call stack. A value of @code{0} yields the return address
-of the current function, a value of @code{1} yields the return address
-of the caller of the current function, and so forth.
-
-The @var{level} argument must be a constant integer.
-
-On some machines it may be impossible to determine the return address of
-any function other than the current one; in such cases, or when the top
-of the stack has been reached, this function will return @code{0}.
-
-This function should only be used with a non-zero argument for debugging
-purposes.
-
-@item __builtin_frame_address (@var{level})
-This function is similar to @code{__builtin_return_address}, but it
-returns the address of the function frame rather than the return address
-of the function. Calling @code{__builtin_frame_address} with a value of
-@code{0} yields the frame address of the current function, a value of
-@code{1} yields the frame address of the caller of the current function,
-and so forth.
-
-The frame is the area on the stack which holds local variables and saved
-registers. The frame address is normally the address of the first word
-pushed on to the stack by the function. However, the exact definition
-depends upon the processor and the calling convention. If the processor
-has a dedicated frame pointer register, and the function has a frame,
-then @code{__builtin_frame_address} will return the value of the frame
-pointer register.
-
-The caveats that apply to @code{__builtin_return_address} apply to this
-function as well.
-@end table
-
-@node C++ Extensions
-@chapter Extensions to the C++ Language
-@cindex extensions, C++ language
-@cindex C++ language extensions
-
-The GNU compiler provides these extensions to the C++ language (and you
-can also use most of the C language extensions in your C++ programs). If you
-want to write code that checks whether these features are available, you can
-test for the GNU compiler the same way as for C programs: check for a
-predefined macro @code{__GNUC__}. You can also use @code{__GNUG__} to
-test specifically for GNU C++ (@pxref{Standard Predefined,,Standard
-Predefined Macros,cpp.info,The C Preprocessor}).
-
-@menu
-* Naming Results:: Giving a name to C++ function return values.
-* Min and Max:: C++ Minimum and maximum operators.
-* Destructors and Goto:: Goto is safe to use in C++ even when destructors
- are needed.
-* C++ Interface:: You can use a single C++ header file for both
- declarations and definitions.
-* Template Instantiation:: Methods for ensuring that exactly one copy of
- each needed template instantiation is emitted.
-* C++ Signatures:: You can specify abstract types to get subtype
- polymorphism independent from inheritance.
-@end menu
-
-@node Naming Results
-@section Named Return Values in C++
-
-@cindex @code{return}, in C++ function header
-@cindex return value, named, in C++
-@cindex named return value in C++
-@cindex C++ named return value
-GNU C++ extends the function-definition syntax to allow you to specify a
-name for the result of a function outside the body of the definition, in
-C++ programs:
-
-@example
-@group
-@var{type}
-@var{functionname} (@var{args}) return @var{resultname};
-@{
- @dots{}
- @var{body}
- @dots{}
-@}
-@end group
-@end example
-
-You can use this feature to avoid an extra constructor call when
-a function result has a class type. For example, consider a function
-@code{m}, declared as @w{@samp{X v = m ();}}, whose result is of class
-@code{X}:
-
-@example
-X
-m ()
-@{
- X b;
- b.a = 23;
- return b;
-@}
-@end example
-
-@cindex implicit argument: return value
-Although @code{m} appears to have no arguments, in fact it has one implicit
-argument: the address of the return value. At invocation, the address
-of enough space to hold @code{v} is sent in as the implicit argument.
-Then @code{b} is constructed and its @code{a} field is set to the value
-23. Finally, a copy constructor (a constructor of the form @samp{X(X&)})
-is applied to @code{b}, with the (implicit) return value location as the
-target, so that @code{v} is now bound to the return value.
-
-But this is wasteful. The local @code{b} is declared just to hold
-something that will be copied right out. While a compiler that
-combined an ``elision'' algorithm with interprocedural data flow
-analysis could conceivably eliminate all of this, it is much more
-practical to allow you to assist the compiler in generating
-efficient code by manipulating the return value explicitly,
-thus avoiding the local variable and copy constructor altogether.
-
-Using the extended GNU C++ function-definition syntax, you can avoid the
-temporary allocation and copying by naming @code{r} as your return value
-at the outset, and assigning to its @code{a} field directly:
-
-@example
-X
-m () return r;
-@{
- r.a = 23;
-@}
-@end example
-
-@noindent
-The declaration of @code{r} is a standard, proper declaration, whose effects
-are executed @strong{before} any of the body of @code{m}.
-
-Functions of this type impose no additional restrictions; in particular,
-you can execute @code{return} statements, or return implicitly by
-reaching the end of the function body (``falling off the edge'').
-Cases like
-
-@example
-X
-m () return r (23);
-@{
- return;
-@}
-@end example
-
-@noindent
-(or even @w{@samp{X m () return r (23); @{ @}}}) are unambiguous, since
-the return value @code{r} has been initialized in either case. The
-following code may be hard to read, but also works predictably:
-
-@example
-X
-m () return r;
-@{
- X b;
- return b;
-@}
-@end example
-
-The return value slot denoted by @code{r} is initialized at the outset,
-but the statement @samp{return b;} overrides this value. The compiler
-deals with this by destroying @code{r} (calling the destructor if there
-is one, or doing nothing if there is not), and then reinitializing
-@code{r} with @code{b}.
-
-This extension is provided primarily to help people who use overloaded
-operators, where there is a great need to control not just the
-arguments, but the return values of functions. For classes where the
-copy constructor incurs a heavy performance penalty (especially in the
-common case where there is a quick default constructor), this is a major
-savings. The disadvantage of this extension is that you do not control
-when the default constructor for the return value is called: it is
-always called at the beginning.
-
-@node Min and Max
-@section Minimum and Maximum Operators in C++
-
-It is very convenient to have operators which return the ``minimum'' or the
-``maximum'' of two arguments. In GNU C++ (but not in GNU C),
-
-@table @code
-@item @var{a} <? @var{b}
-@findex <?
-@cindex minimum operator
-is the @dfn{minimum}, returning the smaller of the numeric values
-@var{a} and @var{b};
-
-@item @var{a} >? @var{b}
-@findex >?
-@cindex maximum operator
-is the @dfn{maximum}, returning the larger of the numeric values @var{a}
-and @var{b}.
-@end table
-
-These operations are not primitive in ordinary C++, since you can
-use a macro to return the minimum of two things in C++, as in the
-following example.
-
-@example
-#define MIN(X,Y) ((X) < (Y) ? : (X) : (Y))
-@end example
-
-@noindent
-You might then use @w{@samp{int min = MIN (i, j);}} to set @var{min} to
-the minimum value of variables @var{i} and @var{j}.
-
-However, side effects in @code{X} or @code{Y} may cause unintended
-behavior. For example, @code{MIN (i++, j++)} will fail, incrementing
-the smaller counter twice. A GNU C extension allows you to write safe
-macros that avoid this kind of problem (@pxref{Naming Types,,Naming an
-Expression's Type}). However, writing @code{MIN} and @code{MAX} as
-macros also forces you to use function-call notation for a
-fundamental arithmetic operation. Using GNU C++ extensions, you can
-write @w{@samp{int min = i <? j;}} instead.
-
-Since @code{<?} and @code{>?} are built into the compiler, they properly
-handle expressions with side-effects; @w{@samp{int min = i++ <? j++;}}
-works correctly.
-
-@node Destructors and Goto
-@section @code{goto} and Destructors in GNU C++
-
-@cindex @code{goto} in C++
-@cindex destructors vs @code{goto}
-In C++ programs, you can safely use the @code{goto} statement. When you
-use it to exit a block which contains aggregates requiring destructors,
-the destructors will run before the @code{goto} transfers control.
-
-@cindex constructors vs @code{goto}
-The compiler still forbids using @code{goto} to @emph{enter} a scope
-that requires constructors.
-
-@node C++ Interface
-@section Declarations and Definitions in One Header
-
-@cindex interface and implementation headers, C++
-@cindex C++ interface and implementation headers
-C++ object definitions can be quite complex. In principle, your source
-code will need two kinds of things for each object that you use across
-more than one source file. First, you need an @dfn{interface}
-specification, describing its structure with type declarations and
-function prototypes. Second, you need the @dfn{implementation} itself.
-It can be tedious to maintain a separate interface description in a
-header file, in parallel to the actual implementation. It is also
-dangerous, since separate interface and implementation definitions may
-not remain parallel.
-
-@cindex pragmas, interface and implementation
-With GNU C++, you can use a single header file for both purposes.
-
-@quotation
-@emph{Warning:} The mechanism to specify this is in transition. For the
-nonce, you must use one of two @code{#pragma} commands; in a future
-release of GNU C++, an alternative mechanism will make these
-@code{#pragma} commands unnecessary.
-@end quotation
-
-The header file contains the full definitions, but is marked with
-@samp{#pragma interface} in the source code. This allows the compiler
-to use the header file only as an interface specification when ordinary
-source files incorporate it with @code{#include}. In the single source
-file where the full implementation belongs, you can use either a naming
-convention or @samp{#pragma implementation} to indicate this alternate
-use of the header file.
-
-@table @code
-@item #pragma interface
-@itemx #pragma interface "@var{subdir}/@var{objects}.h"
-@kindex #pragma interface
-Use this directive in @emph{header files} that define object classes, to save
-space in most of the object files that use those classes. Normally,
-local copies of certain information (backup copies of inline member
-functions, debugging information, and the internal tables that implement
-virtual functions) must be kept in each object file that includes class
-definitions. You can use this pragma to avoid such duplication. When a
-header file containing @samp{#pragma interface} is included in a
-compilation, this auxiliary information will not be generated (unless
-the main input source file itself uses @samp{#pragma implementation}).
-Instead, the object files will contain references to be resolved at link
-time.
-
-The second form of this directive is useful for the case where you have
-multiple headers with the same name in different directories. If you
-use this form, you must specify the same string to @samp{#pragma
-implementation}.
-
-@item #pragma implementation
-@itemx #pragma implementation "@var{objects}.h"
-@kindex #pragma implementation
-Use this pragma in a @emph{main input file}, when you want full output from
-included header files to be generated (and made globally visible). The
-included header file, in turn, should use @samp{#pragma interface}.
-Backup copies of inline member functions, debugging information, and the
-internal tables used to implement virtual functions are all generated in
-implementation files.
-
-@cindex implied @code{#pragma implementation}
-@cindex @code{#pragma implementation}, implied
-@cindex naming convention, implementation headers
-If you use @samp{#pragma implementation} with no argument, it applies to
-an include file with the same basename@footnote{A file's @dfn{basename}
-was the name stripped of all leading path information and of trailing
-suffixes, such as @samp{.h} or @samp{.C} or @samp{.cc}.} as your source
-file. For example, in @file{allclass.cc}, giving just
-@samp{#pragma implementation}
-by itself is equivalent to @samp{#pragma implementation "allclass.h"}.
-
-In versions of GNU C++ prior to 2.6.0 @file{allclass.h} was treated as
-an implementation file whenever you would include it from
-@file{allclass.cc} even if you never specified @samp{#pragma
-implementation}. This was deemed to be more trouble than it was worth,
-however, and disabled.
-
-If you use an explicit @samp{#pragma implementation}, it must appear in
-your source file @emph{before} you include the affected header files.
-
-Use the string argument if you want a single implementation file to
-include code from multiple header files. (You must also use
-@samp{#include} to include the header file; @samp{#pragma
-implementation} only specifies how to use the file---it doesn't actually
-include it.)
-
-There is no way to split up the contents of a single header file into
-multiple implementation files.
-@end table
-
-@cindex inlining and C++ pragmas
-@cindex C++ pragmas, effect on inlining
-@cindex pragmas in C++, effect on inlining
-@samp{#pragma implementation} and @samp{#pragma interface} also have an
-effect on function inlining.
-
-If you define a class in a header file marked with @samp{#pragma
-interface}, the effect on a function defined in that class is similar to
-an explicit @code{extern} declaration---the compiler emits no code at
-all to define an independent version of the function. Its definition
-is used only for inlining with its callers.
-
-Conversely, when you include the same header file in a main source file
-that declares it as @samp{#pragma implementation}, the compiler emits
-code for the function itself; this defines a version of the function
-that can be found via pointers (or by callers compiled without
-inlining). If all calls to the function can be inlined, you can avoid
-emitting the function by compiling with @samp{-fno-implement-inlines}.
-If any calls were not inlined, you will get linker errors.
-
-@node Template Instantiation
-@section Where's the Template?
-
-@cindex template instantiation
-
-C++ templates are the first language feature to require more
-intelligence from the environment than one usually finds on a UNIX
-system. Somehow the compiler and linker have to make sure that each
-template instance occurs exactly once in the executable if it is needed,
-and not at all otherwise. There are two basic approaches to this
-problem, which I will refer to as the Borland model and the Cfront model.
-
-@table @asis
-@item Borland model
-Borland C++ solved the template instantiation problem by adding the code
-equivalent of common blocks to their linker; template instances
-are emitted in each translation unit that uses them, and they are
-collapsed together at run time. The advantage of this model is that the
-linker only has to consider the object files themselves; there is no
-external complexity to worry about. This disadvantage is that
-compilation time is increased because the template code is being
-compiled repeatedly. Code written for this model tends to include
-definitions of all member templates in the header file, since they must
-be seen to be compiled.
-
-@item Cfront model
-The AT&T C++ translator, Cfront, solved the template instantiation
-problem by creating the notion of a template repository, an
-automatically maintained place where template instances are stored. As
-individual object files are built, notes are placed in the repository to
-record where templates and potential type arguments were seen so that
-the subsequent instantiation step knows where to find them. At link
-time, any needed instances are generated and linked in. The advantages
-of this model are more optimal compilation speed and the ability to use
-the system linker; to implement the Borland model a compiler vendor also
-needs to replace the linker. The disadvantages are vastly increased
-complexity, and thus potential for error; theoretically, this should be
-just as transparent, but in practice it has been very difficult to build
-multiple programs in one directory and one program in multiple
-directories using Cfront. Code written for this model tends to separate
-definitions of non-inline member templates into a separate file, which
-is magically found by the link preprocessor when a template needs to be
-instantiated.
-@end table
-
-Currently, g++ implements neither automatic model. In the mean time,
-you have three options for dealing with template instantiations:
-
-@enumerate
-@item
-Compile your code with @samp{-fno-implicit-templates} to disable the
-implicit generation of template instances, and explicitly instantiate
-all the ones you use. This approach requires more knowledge of exactly
-which instances you need than do the others, but it's less
-mysterious and allows greater control. You can scatter the explicit
-instantiations throughout your program, perhaps putting them in the
-translation units where the instances are used or the translation units
-that define the templates themselves; you can put all of the explicit
-instantiations you need into one big file; or you can create small files
-like
-
-@example
-#include "Foo.h"
-#include "Foo.cc"
-
-template class Foo<int>;
-template ostream& operator <<
- (ostream&, const Foo<int>&);
-@end example
-
-for each of the instances you need, and create a template instantiation
-library from those.
-
-If you are using Cfront-model code, you can probably get away with not
-using @samp{-fno-implicit-templates} when compiling files that don't
-@samp{#include} the member template definitions.
-
-If you use one big file to do the instantiations, you may want to
-compile it without @samp{-fno-implicit-templates} so you get all of the
-instances required by your explicit instantiations (but not by any
-other files) without having to specify them as well.
-
-g++ has extended the template instantiation syntax outlined in the
-Working Paper to allow forward declaration of explicit instantiations,
-explicit instantiation of members of template classes and instantiation
-of the compiler support data for a template class (i.e. the vtable)
-without instantiating any of its members:
-
-@example
-extern template int max (int, int);
-template void Foo<int>::f ();
-inline template class Foo<int>;
-@end example
-
-@item
-Do nothing. Pretend g++ does implement automatic instantiation
-management. Code written for the Borland model will work fine, but
-each translation unit will contain instances of each of the templates it
-uses. In a large program, this can lead to an unacceptable amount of code
-duplication.
-
-@item
-Add @samp{#pragma interface} to all files containing template
-definitions. For each of these files, add @samp{#pragma implementation
-"@var{filename}"} to the top of some @samp{.C} file which
-@samp{#include}s it. Then compile everything with
-@samp{-fexternal-templates}. The templates will then only be expanded
-in the translation unit which implements them (i.e. has a @samp{#pragma
-implementation} line for the file where they live); all other files will
-use external references. If you're lucky, everything should work
-properly. If you get undefined symbol errors, you need to make sure
-that each template instance which is used in the program is used in the
-file which implements that template. If you don't have any use for a
-particular instance in that file, you can just instantiate it
-explicitly, using the syntax from the latest C++ working paper:
-
-@example
-template class A<int>;
-template ostream& operator << (ostream&, const A<int>&);
-@end example
-
-This strategy will work with code written for either model. If you are
-using code written for the Cfront model, the file containing a class
-template and the file containing its member templates should be
-implemented in the same translation unit.
-
-A slight variation on this approach is to instead use the flag
-@samp{-falt-external-templates}; this flag causes template
-instances to be emitted in the translation unit that implements the
-header where they are first instantiated, rather than the one which
-implements the file where the templates are defined. This header must
-be the same in all translation units, or things are likely to break.
-
-@xref{C++ Interface,,Declarations and Definitions in One Header}, for
-more discussion of these pragmas.
-@end enumerate
-
-@node C++ Signatures
-@section Type Abstraction using Signatures
-
-@findex signature
-@cindex type abstraction, C++
-@cindex C++ type abstraction
-@cindex subtype polymorphism, C++
-@cindex C++ subtype polymorphism
-@cindex signatures, C++
-@cindex C++ signatures
-
-In GNU C++, you can use the keyword @code{signature} to define a
-completely abstract class interface as a datatype. You can connect this
-abstraction with actual classes using signature pointers. If you want
-to use signatures, run the GNU compiler with the
-@samp{-fhandle-signatures} command-line option. (With this option, the
-compiler reserves a second keyword @code{sigof} as well, for a future
-extension.)
-
-Roughly, signatures are type abstractions or interfaces of classes.
-Some other languages have similar facilities. C++ signatures are
-related to ML's signatures, Haskell's type classes, definition modules
-in Modula-2, interface modules in Modula-3, abstract types in Emerald,
-type modules in Trellis/Owl, categories in Scratchpad II, and types in
-POOL-I. For a more detailed discussion of signatures, see
-@cite{Signatures: A Language Extension for Improving Type Abstraction and
-Subtype Polymorphism in C++}
-by @w{Gerald} Baumgartner and Vincent F. Russo (Tech report
-CSD--TR--95--051, Dept. of Computer Sciences, Purdue University,
-August 1995, a slightly improved version appeared in
-@emph{Software---Practice & Experience}, @b{25}(8), pp. 863--889,
-August 1995). You can get the tech report by anonymous FTP from
-@code{ftp.cs.purdue.edu} in @file{pub/gb/Signature-design.ps.gz}.
-
-Syntactically, a signature declaration is a collection of
-member function declarations and nested type declarations.
-For example, this signature declaration defines a new abstract type
-@code{S} with member functions @samp{int foo ()} and @samp{int bar (int)}:
-
-@example
-signature S
-@{
- int foo ();
- int bar (int);
-@};
-@end example
-
-Since signature types do not include implementation definitions, you
-cannot write an instance of a signature directly. Instead, you can
-define a pointer to any class that contains the required interfaces as a
-@dfn{signature pointer}. Such a class @dfn{implements} the signature
-type.
-@c Eventually signature references should work too.
-
-To use a class as an implementation of @code{S}, you must ensure that
-the class has public member functions @samp{int foo ()} and @samp{int
-bar (int)}. The class can have other member functions as well, public
-or not; as long as it offers what's declared in the signature, it is
-suitable as an implementation of that signature type.
-
-For example, suppose that @code{C} is a class that meets the
-requirements of signature @code{S} (@code{C} @dfn{conforms to}
-@code{S}). Then
-
-@example
-C obj;
-S * p = &obj;
-@end example
-
-@noindent
-defines a signature pointer @code{p} and initializes it to point to an
-object of type @code{C}.
-The member function call @w{@samp{int i = p->foo ();}}
-executes @samp{obj.foo ()}.
-
-@cindex @code{signature} in C++, advantages
-Abstract virtual classes provide somewhat similar facilities in standard
-C++. There are two main advantages to using signatures instead:
-
-@enumerate
-@item
-Subtyping becomes independent from inheritance. A class or signature
-type @code{T} is a subtype of a signature type @code{S} independent of
-any inheritance hierarchy as long as all the member functions declared
-in @code{S} are also found in @code{T}. So you can define a subtype
-hierarchy that is completely independent from any inheritance
-(implementation) hierarchy, instead of being forced to use types that
-mirror the class inheritance hierarchy.
-
-@item
-Signatures allow you to work with existing class hierarchies as
-implementations of a signature type. If those class hierarchies are
-only available in compiled form, you're out of luck with abstract virtual
-classes, since an abstract virtual class cannot be retrofitted on top of
-existing class hierarchies. So you would be required to write interface
-classes as subtypes of the abstract virtual class.
-@end enumerate
-
-@cindex default implementation, signature member function
-@cindex signature member function default implementation
-There is one more detail about signatures. A signature declaration can
-contain member function @emph{definitions} as well as member function
-declarations. A signature member function with a full definition is
-called a @emph{default implementation}; classes need not contain that
-particular interface in order to conform. For example, a
-class @code{C} can conform to the signature
-
-@example
-signature T
-@{
- int f (int);
- int f0 () @{ return f (0); @};
-@};
-@end example
-
-@noindent
-whether or not @code{C} implements the member function @samp{int f0 ()}.
-If you define @code{C::f0}, that definition takes precedence;
-otherwise, the default implementation @code{S::f0} applies.
-
-@ignore
-There will be more support for signatures in the future.
-Add to this doc as the implementation grows.
-In particular, the following features are planned but not yet
-implemented:
-@itemize @bullet
-@item signature references,
-@item signature inheritance,
-@item the @code{sigof} construct for extracting the signature information
- of a class,
-@item views for renaming member functions when matching a class type
- with a signature type,
-@item specifying exceptions with signature member functions, and
-@item signature templates.
-@end itemize
-This list is roughly in the order in which we intend to implement
-them. Watch this space for updates.
-@end ignore
diff --git a/gcc/final.c b/gcc/final.c
deleted file mode 100644
index 47cc2cc6e16..00000000000
--- a/gcc/final.c
+++ /dev/null
@@ -1,3287 +0,0 @@
-/* Convert RTL to assembler code and output it, for GNU compiler.
- Copyright (C) 1987, 88, 89, 92-6, 1997 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 final pass of the compiler.
- It looks at the rtl code for a function and outputs assembler code.
-
- Call `final_start_function' to output the assembler code for function entry,
- `final' to output assembler code for some RTL code,
- `final_end_function' to output assembler code for function exit.
- If a function is compiled in several pieces, each piece is
- output separately with `final'.
-
- Some optimizations are also done at this level.
- Move instructions that were made unnecessary by good register allocation
- are detected and omitted from the output. (Though most of these
- are removed by the last jump pass.)
-
- Instructions to set the condition codes are omitted when it can be
- seen that the condition codes already had the desired values.
-
- In some cases it is sufficient if the inherited condition codes
- have related values, but this may require the following insn
- (the one that tests the condition codes) to be modified.
-
- The code for the function prologue and epilogue are generated
- directly as assembler code by the macros FUNCTION_PROLOGUE and
- FUNCTION_EPILOGUE. Those instructions never exist as rtl. */
-
-#include "config.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <stdio.h>
-#include <ctype.h>
-
-#include "tree.h"
-#include "rtl.h"
-#include "regs.h"
-#include "insn-config.h"
-#include "insn-flags.h"
-#include "insn-attr.h"
-#include "insn-codes.h"
-#include "recog.h"
-#include "conditions.h"
-#include "flags.h"
-#include "real.h"
-#include "hard-reg-set.h"
-#include "defaults.h"
-#include "output.h"
-#include "except.h"
-
-/* Get N_SLINE and N_SOL from stab.h if we can expect the file to exist. */
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
-#if defined (USG) || defined (NO_STAB_H)
-#include "gstab.h" /* If doing DBX on sysV, use our own stab.h. */
-#else
-#include <stab.h> /* On BSD, use the system's stab.h. */
-#endif /* not USG */
-#endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
-
-#ifdef XCOFF_DEBUGGING_INFO
-#include "xcoffout.h"
-#endif
-
-/* .stabd code for line number. */
-#ifndef N_SLINE
-#define N_SLINE 0x44
-#endif
-
-/* .stabs code for included file name. */
-#ifndef N_SOL
-#define N_SOL 0x84
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-/* If we aren't using cc0, CC_STATUS_INIT shouldn't exist. So define a
- null default for it to save conditionalization later. */
-#ifndef CC_STATUS_INIT
-#define CC_STATUS_INIT
-#endif
-
-/* How to start an assembler comment. */
-#ifndef ASM_COMMENT_START
-#define ASM_COMMENT_START ";#"
-#endif
-
-/* Is the given character a logical line separator for the assembler? */
-#ifndef IS_ASM_LOGICAL_LINE_SEPARATOR
-#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == ';')
-#endif
-
-/* Nonzero means this function is a leaf function, with no function calls.
- This variable exists to be examined in FUNCTION_PROLOGUE
- and FUNCTION_EPILOGUE. Always zero, unless set by some action. */
-int leaf_function;
-
-/* Last insn processed by final_scan_insn. */
-static rtx debug_insn = 0;
-
-/* Line number of last NOTE. */
-static int last_linenum;
-
-/* Highest line number in current block. */
-static int high_block_linenum;
-
-/* Likewise for function. */
-static int high_function_linenum;
-
-/* Filename of last NOTE. */
-static char *last_filename;
-
-/* Number of basic blocks seen so far;
- used if profile_block_flag is set. */
-static int count_basic_blocks;
-
-/* Number of instrumented arcs when profile_arc_flag is set. */
-extern int count_instrumented_arcs;
-
-/* Nonzero while outputting an `asm' with operands.
- This means that inconsistencies are the user's fault, so don't abort.
- The precise value is the insn being output, to pass to error_for_asm. */
-static rtx this_is_asm_operands;
-
-/* Number of operands of this insn, for an `asm' with operands. */
-static int insn_noperands;
-
-/* Compare optimization flag. */
-
-static rtx last_ignored_compare = 0;
-
-/* Flag indicating this insn is the start of a new basic block. */
-
-static int new_block = 1;
-
-/* All the symbol-blocks (levels of scoping) in the compilation
- are assigned sequence numbers in order of appearance of the
- beginnings of the symbol-blocks. Both final and dbxout do this,
- and assume that they will both give the same number to each block.
- Final uses these sequence numbers to generate assembler label names
- LBBnnn and LBEnnn for the beginning and end of the symbol-block.
- Dbxout uses the sequence numbers to generate references to the same labels
- from the dbx debugging information.
-
- Sdb records this level at the beginning of each function,
- in order to find the current level when recursing down declarations.
- It outputs the block beginning and endings
- at the point in the asm file where the blocks would begin and end. */
-
-int next_block_index;
-
-/* Assign a unique number to each insn that is output.
- This can be used to generate unique local labels. */
-
-static int insn_counter = 0;
-
-#ifdef HAVE_cc0
-/* This variable contains machine-dependent flags (defined in tm.h)
- set and examined by output routines
- that describe how to interpret the condition codes properly. */
-
-CC_STATUS cc_status;
-
-/* During output of an insn, this contains a copy of cc_status
- from before the insn. */
-
-CC_STATUS cc_prev_status;
-#endif
-
-/* Indexed by hardware reg number, is 1 if that register is ever
- used in the current function.
-
- In life_analysis, or in stupid_life_analysis, this is set
- up to record the hard regs used explicitly. Reload adds
- in the hard regs used for holding pseudo regs. Final uses
- it to generate the code in the function prologue and epilogue
- to save and restore registers as needed. */
-
-char regs_ever_live[FIRST_PSEUDO_REGISTER];
-
-/* Nonzero means current function must be given a frame pointer.
- Set in stmt.c if anything is allocated on the stack there.
- Set in reload1.c if anything is allocated on the stack there. */
-
-int frame_pointer_needed;
-
-/* Assign unique numbers to labels generated for profiling. */
-
-int profile_label_no;
-
-/* Length so far allocated in PENDING_BLOCKS. */
-
-static int max_block_depth;
-
-/* Stack of sequence numbers of symbol-blocks of which we have seen the
- beginning but not yet the end. Sequence numbers are assigned at
- the beginning; this stack allows us to find the sequence number
- of a block that is ending. */
-
-static int *pending_blocks;
-
-/* Number of elements currently in use in PENDING_BLOCKS. */
-
-static int block_depth;
-
-/* Nonzero if have enabled APP processing of our assembler output. */
-
-static int app_on;
-
-/* If we are outputting an insn sequence, this contains the sequence rtx.
- Zero otherwise. */
-
-rtx final_sequence;
-
-#ifdef ASSEMBLER_DIALECT
-
-/* Number of the assembler dialect to use, starting at 0. */
-static int dialect_number;
-#endif
-
-/* Indexed by line number, nonzero if there is a note for that line. */
-
-static char *line_note_exists;
-
-/* Linked list to hold line numbers for each basic block. */
-
-struct bb_list {
- struct bb_list *next; /* pointer to next basic block */
- int line_num; /* line number */
- int file_label_num; /* LPBC<n> label # for stored filename */
- int func_label_num; /* LPBC<n> label # for stored function name */
-};
-
-static struct bb_list *bb_head = 0; /* Head of basic block list */
-static struct bb_list **bb_tail = &bb_head; /* Ptr to store next bb ptr */
-static int bb_file_label_num = -1; /* Current label # for file */
-static int bb_func_label_num = -1; /* Current label # for func */
-
-/* Linked list to hold the strings for each file and function name output. */
-
-struct bb_str {
- struct bb_str *next; /* pointer to next string */
- char *string; /* string */
- int label_num; /* label number */
- int length; /* string length */
-};
-
-extern rtx peephole PROTO((rtx));
-
-static struct bb_str *sbb_head = 0; /* Head of string list. */
-static struct bb_str **sbb_tail = &sbb_head; /* Ptr to store next bb str */
-static int sbb_label_num = 0; /* Last label used */
-
-static int asm_insn_count PROTO((rtx));
-static void profile_function PROTO((FILE *));
-static void profile_after_prologue PROTO((FILE *));
-static void add_bb PROTO((FILE *));
-static int add_bb_string PROTO((char *, int));
-static void output_source_line PROTO((FILE *, rtx));
-static rtx walk_alter_subreg PROTO((rtx));
-static int alter_cond PROTO((rtx));
-static void output_asm_name PROTO((void));
-static void output_operand PROTO((rtx, int));
-static void leaf_renumber_regs PROTO((rtx));
-
-extern char *getpwd ();
-
-/* Initialize data in final at the beginning of a compilation. */
-
-void
-init_final (filename)
- char *filename;
-{
- next_block_index = 2;
- app_on = 0;
- max_block_depth = 20;
- pending_blocks = (int *) xmalloc (20 * sizeof *pending_blocks);
- final_sequence = 0;
-
-#ifdef ASSEMBLER_DIALECT
- dialect_number = ASSEMBLER_DIALECT;
-#endif
-}
-
-/* Called at end of source file,
- to output the block-profiling table for this entire compilation. */
-
-void
-end_final (filename)
- char *filename;
-{
- int i;
-
- if (profile_block_flag || profile_arc_flag)
- {
- char name[20];
- int align = exact_log2 (BIGGEST_ALIGNMENT / BITS_PER_UNIT);
- int size, rounded;
- struct bb_list *ptr;
- struct bb_str *sptr;
- int long_bytes = LONG_TYPE_SIZE / BITS_PER_UNIT;
- int pointer_bytes = POINTER_SIZE / BITS_PER_UNIT;
-
- if (profile_block_flag)
- size = long_bytes * count_basic_blocks;
- else
- size = long_bytes * count_instrumented_arcs;
- rounded = size;
-
- rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1;
- rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)
- * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
-
- data_section ();
-
- /* Output the main header, of 11 words:
- 0: 1 if this file is initialized, else 0.
- 1: address of file name (LPBX1).
- 2: address of table of counts (LPBX2).
- 3: number of counts in the table.
- 4: always 0, for compatibility with Sun.
-
- The following are GNU extensions:
-
- 5: address of table of start addrs of basic blocks (LPBX3).
- 6: Number of bytes in this header.
- 7: address of table of function names (LPBX4).
- 8: address of table of line numbers (LPBX5) or 0.
- 9: address of table of file names (LPBX6) or 0.
- 10: space reserved for basic block profiling. */
-
- ASM_OUTPUT_ALIGN (asm_out_file, align);
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 0);
- /* zero word */
- assemble_integer (const0_rtx, long_bytes, 1);
-
- /* address of filename */
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 1);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), pointer_bytes, 1);
-
- /* address of count table */
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 2);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), pointer_bytes, 1);
-
- /* count of the # of basic blocks or # of instrumented arcs */
- if (profile_block_flag)
- assemble_integer (GEN_INT (count_basic_blocks), long_bytes, 1);
- else
- assemble_integer (GEN_INT (count_instrumented_arcs), long_bytes,
- 1);
-
- /* zero word (link field) */
- assemble_integer (const0_rtx, pointer_bytes, 1);
-
- /* address of basic block start address table */
- if (profile_block_flag)
- {
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 3);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), pointer_bytes,
- 1);
- }
- else
- assemble_integer (const0_rtx, pointer_bytes, 1);
-
- /* byte count for extended structure. */
- assemble_integer (GEN_INT (10 * UNITS_PER_WORD), long_bytes, 1);
-
- /* address of function name table */
- if (profile_block_flag)
- {
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 4);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), pointer_bytes,
- 1);
- }
- else
- assemble_integer (const0_rtx, pointer_bytes, 1);
-
- /* address of line number and filename tables if debugging. */
- if (write_symbols != NO_DEBUG && profile_block_flag)
- {
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 5);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), pointer_bytes, 1);
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 6);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), pointer_bytes, 1);
- }
- else
- {
- assemble_integer (const0_rtx, pointer_bytes, 1);
- assemble_integer (const0_rtx, pointer_bytes, 1);
- }
-
- /* space for extension ptr (link field) */
- assemble_integer (const0_rtx, UNITS_PER_WORD, 1);
-
- /* Output the file name changing the suffix to .d for Sun tcov
- compatibility. */
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 1);
- {
- char *cwd = getpwd ();
- int len = strlen (filename) + strlen (cwd) + 1;
- char *data_file = (char *) alloca (len + 4);
-
- strcpy (data_file, cwd);
- strcat (data_file, "/");
- strcat (data_file, filename);
- strip_off_ending (data_file, len);
- if (profile_block_flag)
- strcat (data_file, ".d");
- else
- strcat (data_file, ".da");
- assemble_string (data_file, strlen (data_file) + 1);
- }
-
- /* Make space for the table of counts. */
- if (size == 0)
- {
- /* Realign data section. */
- ASM_OUTPUT_ALIGN (asm_out_file, align);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 2);
- if (size != 0)
- assemble_zeros (size);
- }
- else
- {
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 2);
-#ifdef ASM_OUTPUT_SHARED_LOCAL
- if (flag_shared_data)
- ASM_OUTPUT_SHARED_LOCAL (asm_out_file, name, size, rounded);
- else
-#endif
-#ifdef ASM_OUTPUT_ALIGNED_LOCAL
- ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size,
- BIGGEST_ALIGNMENT);
-#else
- ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
-#endif
- }
-
- /* Output any basic block strings */
- if (profile_block_flag)
- {
- readonly_data_section ();
- if (sbb_head)
- {
- ASM_OUTPUT_ALIGN (asm_out_file, align);
- for (sptr = sbb_head; sptr != 0; sptr = sptr->next)
- {
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBC",
- sptr->label_num);
- assemble_string (sptr->string, sptr->length);
- }
- }
- }
-
- /* Output the table of addresses. */
- if (profile_block_flag)
- {
- /* Realign in new section */
- ASM_OUTPUT_ALIGN (asm_out_file, align);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 3);
- for (i = 0; i < count_basic_blocks; i++)
- {
- ASM_GENERATE_INTERNAL_LABEL (name, "LPB", i);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name),
- pointer_bytes, 1);
- }
- }
-
- /* Output the table of function names. */
- if (profile_block_flag)
- {
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 4);
- for ((ptr = bb_head), (i = 0); ptr != 0; (ptr = ptr->next), i++)
- {
- if (ptr->func_label_num >= 0)
- {
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBC",
- ptr->func_label_num);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name),
- pointer_bytes, 1);
- }
- else
- assemble_integer (const0_rtx, pointer_bytes, 1);
- }
-
- for ( ; i < count_basic_blocks; i++)
- assemble_integer (const0_rtx, pointer_bytes, 1);
- }
-
- if (write_symbols != NO_DEBUG && profile_block_flag)
- {
- /* Output the table of line numbers. */
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 5);
- for ((ptr = bb_head), (i = 0); ptr != 0; (ptr = ptr->next), i++)
- assemble_integer (GEN_INT (ptr->line_num), long_bytes, 1);
-
- for ( ; i < count_basic_blocks; i++)
- assemble_integer (const0_rtx, long_bytes, 1);
-
- /* Output the table of file names. */
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 6);
- for ((ptr = bb_head), (i = 0); ptr != 0; (ptr = ptr->next), i++)
- {
- if (ptr->file_label_num >= 0)
- {
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBC",
- ptr->file_label_num);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name),
- pointer_bytes, 1);
- }
- else
- assemble_integer (const0_rtx, pointer_bytes, 1);
- }
-
- for ( ; i < count_basic_blocks; i++)
- assemble_integer (const0_rtx, pointer_bytes, 1);
- }
-
- /* End with the address of the table of addresses,
- so we can find it easily, as the last word in the file's text. */
- if (profile_block_flag)
- {
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 3);
- assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), pointer_bytes,
- 1);
- }
- }
-}
-
-/* Enable APP processing of subsequent output.
- Used before the output from an `asm' statement. */
-
-void
-app_enable ()
-{
- if (! app_on)
- {
- fprintf (asm_out_file, ASM_APP_ON);
- app_on = 1;
- }
-}
-
-/* Disable APP processing of subsequent output.
- Called from varasm.c before most kinds of output. */
-
-void
-app_disable ()
-{
- if (app_on)
- {
- fprintf (asm_out_file, ASM_APP_OFF);
- app_on = 0;
- }
-}
-
-/* Return the number of slots filled in the current
- delayed branch sequence (we don't count the insn needing the
- delay slot). Zero if not in a delayed branch sequence. */
-
-#ifdef DELAY_SLOTS
-int
-dbr_sequence_length ()
-{
- if (final_sequence != 0)
- return XVECLEN (final_sequence, 0) - 1;
- else
- return 0;
-}
-#endif
-
-/* The next two pages contain routines used to compute the length of an insn
- and to shorten branches. */
-
-/* Arrays for insn lengths, and addresses. The latter is referenced by
- `insn_current_length'. */
-
-static short *insn_lengths;
-int *insn_addresses;
-
-/* Address of insn being processed. Used by `insn_current_length'. */
-int insn_current_address;
-
-/* Indicate that branch shortening hasn't yet been done. */
-
-void
-init_insn_lengths ()
-{
- insn_lengths = 0;
-}
-
-/* Obtain the current length of an insn. If branch shortening has been done,
- get its actual length. Otherwise, get its maximum length. */
-
-int
-get_attr_length (insn)
- rtx insn;
-{
-#ifdef HAVE_ATTR_length
- rtx body;
- int i;
- int length = 0;
-
- if (insn_lengths)
- return insn_lengths[INSN_UID (insn)];
- else
- switch (GET_CODE (insn))
- {
- case NOTE:
- case BARRIER:
- case CODE_LABEL:
- return 0;
-
- case CALL_INSN:
- length = insn_default_length (insn);
- break;
-
- case JUMP_INSN:
- body = PATTERN (insn);
- if (GET_CODE (body) == ADDR_VEC || GET_CODE (body) == ADDR_DIFF_VEC)
- {
- /* This only takes room if jump tables go into the text section. */
-#if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
- length = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC)
- * GET_MODE_SIZE (GET_MODE (body)));
-
- /* Be pessimistic and assume worst-case alignment. */
- length += (GET_MODE_SIZE (GET_MODE (body)) - 1);
-#else
- return 0;
-#endif
- }
- else
- length = insn_default_length (insn);
- break;
-
- case INSN:
- body = PATTERN (insn);
- if (GET_CODE (body) == USE || GET_CODE (body) == CLOBBER)
- return 0;
-
- else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
- length = asm_insn_count (body) * insn_default_length (insn);
- else if (GET_CODE (body) == SEQUENCE)
- for (i = 0; i < XVECLEN (body, 0); i++)
- length += get_attr_length (XVECEXP (body, 0, i));
- else
- length = insn_default_length (insn);
- }
-
-#ifdef ADJUST_INSN_LENGTH
- ADJUST_INSN_LENGTH (insn, length);
-#endif
- return length;
-#else /* not HAVE_ATTR_length */
- return 0;
-#endif /* not HAVE_ATTR_length */
-}
-
-/* Make a pass over all insns and compute their actual lengths by shortening
- any branches of variable length if possible. */
-
-/* Give a default value for the lowest address in a function. */
-
-#ifndef FIRST_INSN_ADDRESS
-#define FIRST_INSN_ADDRESS 0
-#endif
-
-void
-shorten_branches (first)
- rtx first;
-{
-#ifdef HAVE_ATTR_length
- rtx insn;
- int something_changed = 1;
- int max_uid = 0;
- char *varying_length;
- rtx body;
- int uid;
-
- /* In order to make sure that all instructions have valid length info,
- we must split them before we compute the address/length info. */
-
- for (insn = NEXT_INSN (first); insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- insn = try_split (PATTERN (insn), insn, 1);
-
- /* Compute maximum UID and allocate arrays. */
- for (insn = first; insn; insn = NEXT_INSN (insn))
- if (INSN_UID (insn) > max_uid)
- max_uid = INSN_UID (insn);
-
- max_uid++;
- insn_lengths = (short *) oballoc (max_uid * sizeof (short));
- insn_addresses = (int *) oballoc (max_uid * sizeof (int));
- varying_length = (char *) oballoc (max_uid * sizeof (char));
-
- /* Compute initial lengths, addresses, and varying flags for each insn. */
- for (insn_current_address = FIRST_INSN_ADDRESS, insn = first;
- insn != 0;
- insn_current_address += insn_lengths[uid], insn = NEXT_INSN (insn))
- {
- uid = INSN_UID (insn);
- insn_addresses[uid] = insn_current_address;
- insn_lengths[uid] = 0;
- varying_length[uid] = 0;
-
- if (GET_CODE (insn) == NOTE || GET_CODE (insn) == BARRIER
- || GET_CODE (insn) == CODE_LABEL)
- continue;
-
- body = PATTERN (insn);
- if (GET_CODE (body) == ADDR_VEC || GET_CODE (body) == ADDR_DIFF_VEC)
- {
- /* This only takes room if read-only data goes into the text
- section. */
-#if !defined(READONLY_DATA_SECTION) || defined(JUMP_TABLES_IN_TEXT_SECTION)
- int unitsize = GET_MODE_SIZE (GET_MODE (body));
-
- insn_lengths[uid] = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC)
- * GET_MODE_SIZE (GET_MODE (body)));
-
- /* Account for possible alignment. */
- insn_lengths[uid]
- += unitsize - (insn_current_address & (unitsize - 1));
-#else
- ;
-#endif
- }
- else if (asm_noperands (body) >= 0)
- insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
- else if (GET_CODE (body) == SEQUENCE)
- {
- int i;
- int const_delay_slots;
-#ifdef DELAY_SLOTS
- const_delay_slots = const_num_delay_slots (XVECEXP (body, 0, 0));
-#else
- const_delay_slots = 0;
-#endif
- /* Inside a delay slot sequence, we do not do any branch shortening
- if the shortening could change the number of delay slots
- of the branch. */
- for (i = 0; i < XVECLEN (body, 0); i++)
- {
- rtx inner_insn = XVECEXP (body, 0, i);
- int inner_uid = INSN_UID (inner_insn);
- int inner_length;
-
- if (asm_noperands (PATTERN (XVECEXP (body, 0, i))) >= 0)
- inner_length = (asm_insn_count (PATTERN (inner_insn))
- * insn_default_length (inner_insn));
- else
- inner_length = insn_default_length (inner_insn);
-
- insn_lengths[inner_uid] = inner_length;
- if (const_delay_slots)
- {
- if ((varying_length[inner_uid]
- = insn_variable_length_p (inner_insn)) != 0)
- varying_length[uid] = 1;
- insn_addresses[inner_uid] = (insn_current_address +
- insn_lengths[uid]);
- }
- else
- varying_length[inner_uid] = 0;
- insn_lengths[uid] += inner_length;
- }
- }
- else if (GET_CODE (body) != USE && GET_CODE (body) != CLOBBER)
- {
- insn_lengths[uid] = insn_default_length (insn);
- varying_length[uid] = insn_variable_length_p (insn);
- }
-
- /* If needed, do any adjustment. */
-#ifdef ADJUST_INSN_LENGTH
- ADJUST_INSN_LENGTH (insn, insn_lengths[uid]);
-#endif
- }
-
- /* Now loop over all the insns finding varying length insns. For each,
- get the current insn length. If it has changed, reflect the change.
- When nothing changes for a full pass, we are done. */
-
- while (something_changed)
- {
- something_changed = 0;
- for (insn_current_address = FIRST_INSN_ADDRESS, insn = first;
- insn != 0;
- insn = NEXT_INSN (insn))
- {
- int new_length;
- int tmp_length;
-
- uid = INSN_UID (insn);
- insn_addresses[uid] = insn_current_address;
- if (! varying_length[uid])
- {
- insn_current_address += insn_lengths[uid];
- continue;
- }
- if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE)
- {
- int i;
-
- body = PATTERN (insn);
- new_length = 0;
- for (i = 0; i < XVECLEN (body, 0); i++)
- {
- rtx inner_insn = XVECEXP (body, 0, i);
- int inner_uid = INSN_UID (inner_insn);
- int inner_length;
-
- insn_addresses[inner_uid] = insn_current_address;
-
- /* insn_current_length returns 0 for insns with a
- non-varying length. */
- if (! varying_length[inner_uid])
- inner_length = insn_lengths[inner_uid];
- else
- inner_length = insn_current_length (inner_insn);
-
- if (inner_length != insn_lengths[inner_uid])
- {
- insn_lengths[inner_uid] = inner_length;
- something_changed = 1;
- }
- insn_current_address += insn_lengths[inner_uid];
- new_length += inner_length;
- }
- }
- else
- {
- new_length = insn_current_length (insn);
- insn_current_address += new_length;
- }
-
-#ifdef SHORTEN_WITH_ADJUST_INSN_LENGTH
-#ifdef ADJUST_INSN_LENGTH
- /* If needed, do any adjustment. */
- tmp_length = new_length;
- ADJUST_INSN_LENGTH (insn, new_length);
- insn_current_address += (new_length - tmp_length);
-#endif
-#endif
-
- if (new_length != insn_lengths[uid])
- {
- insn_lengths[uid] = new_length;
- something_changed = 1;
- }
- }
- /* For a non-optimizing compile, do only a single pass. */
- if (!optimize)
- break;
- }
-#endif /* HAVE_ATTR_length */
-}
-
-#ifdef HAVE_ATTR_length
-/* Given the body of an INSN known to be generated by an ASM statement, return
- the number of machine instructions likely to be generated for this insn.
- This is used to compute its length. */
-
-static int
-asm_insn_count (body)
- rtx body;
-{
- char *template;
- int count = 1;
-
- if (GET_CODE (body) == ASM_INPUT)
- template = XSTR (body, 0);
- else
- template = decode_asm_operands (body, NULL_PTR, NULL_PTR,
- NULL_PTR, NULL_PTR);
-
- for ( ; *template; template++)
- if (IS_ASM_LOGICAL_LINE_SEPARATOR(*template) || *template == '\n')
- count++;
-
- return count;
-}
-#endif
-
-/* Output assembler code for the start of a function,
- and initialize some of the variables in this file
- for the new function. The label for the function and associated
- assembler pseudo-ops have already been output in `assemble_start_function'.
-
- FIRST is the first insn of the rtl for the function being compiled.
- FILE is the file to write assembler code to.
- OPTIMIZE is nonzero if we should eliminate redundant
- test and compare insns. */
-
-void
-final_start_function (first, file, optimize)
- rtx first;
- FILE *file;
- int optimize;
-{
- block_depth = 0;
-
- this_is_asm_operands = 0;
-
-#ifdef NON_SAVING_SETJMP
- /* A function that calls setjmp should save and restore all the
- call-saved registers on a system where longjmp clobbers them. */
- if (NON_SAVING_SETJMP && current_function_calls_setjmp)
- {
- int i;
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (!call_used_regs[i] && !call_fixed_regs[i])
- regs_ever_live[i] = 1;
- }
-#endif
-
- /* Initial line number is supposed to be output
- before the function's prologue and label
- so that the function's address will not appear to be
- in the last statement of the preceding function. */
- if (NOTE_LINE_NUMBER (first) != NOTE_INSN_DELETED)
- last_linenum = high_block_linenum = high_function_linenum
- = NOTE_LINE_NUMBER (first);
-
-#ifdef DWARF2_DEBUGGING_INFO
- /* Output DWARF definition of the function. */
- if (write_symbols == DWARF2_DEBUG)
- dwarf2out_begin_prologue ();
-#endif
-
- /* For SDB and XCOFF, the function beginning must be marked between
- the function label and the prologue. We always need this, even when
- -g1 was used. Defer on MIPS systems so that parameter descriptions
- follow function entry. */
-#if defined(SDB_DEBUGGING_INFO) && !defined(MIPS_DEBUGGING_INFO)
- if (write_symbols == SDB_DEBUG)
- sdbout_begin_function (last_linenum);
- else
-#endif
-#ifdef XCOFF_DEBUGGING_INFO
- if (write_symbols == XCOFF_DEBUG)
- xcoffout_begin_function (file, last_linenum);
- else
-#endif
- /* But only output line number for other debug info types if -g2
- or better. */
- if (NOTE_LINE_NUMBER (first) != NOTE_INSN_DELETED)
- output_source_line (file, first);
-
-#ifdef LEAF_REG_REMAP
- if (leaf_function)
- leaf_renumber_regs (first);
-#endif
-
- /* The Sun386i and perhaps other machines don't work right
- if the profiling code comes after the prologue. */
-#ifdef PROFILE_BEFORE_PROLOGUE
- if (profile_flag)
- profile_function (file);
-#endif /* PROFILE_BEFORE_PROLOGUE */
-
-#ifdef FUNCTION_PROLOGUE
- /* First output the function prologue: code to set up the stack frame. */
- FUNCTION_PROLOGUE (file, get_frame_size ());
-#endif
-
-#if defined (SDB_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- if (write_symbols == SDB_DEBUG || write_symbols == XCOFF_DEBUG)
- next_block_index = 1;
-#endif
-
- /* If the machine represents the prologue as RTL, the profiling code must
- be emitted when NOTE_INSN_PROLOGUE_END is scanned. */
-#ifdef HAVE_prologue
- if (! HAVE_prologue)
-#endif
- profile_after_prologue (file);
-
- profile_label_no++;
-
- /* If we are doing basic block profiling, remember a printable version
- of the function name. */
- if (profile_block_flag)
- {
- bb_func_label_num =
- add_bb_string ((*decl_printable_name) (current_function_decl, 2), FALSE);
- }
-}
-
-static void
-profile_after_prologue (file)
- FILE *file;
-{
-#ifdef FUNCTION_BLOCK_PROFILER
- if (profile_block_flag)
- {
- FUNCTION_BLOCK_PROFILER (file, count_basic_blocks);
- }
-#endif /* FUNCTION_BLOCK_PROFILER */
-
-#ifndef PROFILE_BEFORE_PROLOGUE
- if (profile_flag)
- profile_function (file);
-#endif /* not PROFILE_BEFORE_PROLOGUE */
-}
-
-static void
-profile_function (file)
- FILE *file;
-{
- int align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE);
- int sval = current_function_returns_struct;
- int cxt = current_function_needs_context;
-
- data_section ();
- ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
- ASM_OUTPUT_INTERNAL_LABEL (file, "LP", profile_label_no);
- assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, 1);
-
- text_section ();
-
-#ifdef STRUCT_VALUE_INCOMING_REGNUM
- if (sval)
- ASM_OUTPUT_REG_PUSH (file, STRUCT_VALUE_INCOMING_REGNUM);
-#else
-#ifdef STRUCT_VALUE_REGNUM
- if (sval)
- ASM_OUTPUT_REG_PUSH (file, STRUCT_VALUE_REGNUM);
-#endif
-#endif
-
-#if 0
-#ifdef STATIC_CHAIN_INCOMING_REGNUM
- if (cxt)
- ASM_OUTPUT_REG_PUSH (file, STATIC_CHAIN_INCOMING_REGNUM);
-#else
-#ifdef STATIC_CHAIN_REGNUM
- if (cxt)
- ASM_OUTPUT_REG_PUSH (file, STATIC_CHAIN_REGNUM);
-#endif
-#endif
-#endif /* 0 */
-
- FUNCTION_PROFILER (file, profile_label_no);
-
-#if 0
-#ifdef STATIC_CHAIN_INCOMING_REGNUM
- if (cxt)
- ASM_OUTPUT_REG_POP (file, STATIC_CHAIN_INCOMING_REGNUM);
-#else
-#ifdef STATIC_CHAIN_REGNUM
- if (cxt)
- ASM_OUTPUT_REG_POP (file, STATIC_CHAIN_REGNUM);
-#endif
-#endif
-#endif /* 0 */
-
-#ifdef STRUCT_VALUE_INCOMING_REGNUM
- if (sval)
- ASM_OUTPUT_REG_POP (file, STRUCT_VALUE_INCOMING_REGNUM);
-#else
-#ifdef STRUCT_VALUE_REGNUM
- if (sval)
- ASM_OUTPUT_REG_POP (file, STRUCT_VALUE_REGNUM);
-#endif
-#endif
-}
-
-/* Output assembler code for the end of a function.
- For clarity, args are same as those of `final_start_function'
- even though not all of them are needed. */
-
-void
-final_end_function (first, file, optimize)
- rtx first;
- FILE *file;
- int optimize;
-{
- if (app_on)
- {
- fprintf (file, ASM_APP_OFF);
- app_on = 0;
- }
-
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- sdbout_end_function (high_function_linenum);
-#endif
-
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- dwarfout_end_function ();
-#endif
-
-#ifdef XCOFF_DEBUGGING_INFO
- if (write_symbols == XCOFF_DEBUG)
- xcoffout_end_function (file, high_function_linenum);
-#endif
-
-#ifdef FUNCTION_EPILOGUE
- /* Finally, output the function epilogue:
- code to restore the stack frame and return to the caller. */
- FUNCTION_EPILOGUE (file, get_frame_size ());
-#endif
-
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- sdbout_end_epilogue ();
-#endif
-
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- dwarfout_end_epilogue ();
-#endif
-
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- dwarf2out_end_epilogue ();
-#endif
-
-#ifdef XCOFF_DEBUGGING_INFO
- if (write_symbols == XCOFF_DEBUG)
- xcoffout_end_epilogue (file);
-#endif
-
- bb_func_label_num = -1; /* not in function, nuke label # */
-
- /* If FUNCTION_EPILOGUE is not defined, then the function body
- itself contains return instructions wherever needed. */
-}
-
-/* Add a block to the linked list that remembers the current line/file/function
- for basic block profiling. Emit the label in front of the basic block and
- the instructions that increment the count field. */
-
-static void
-add_bb (file)
- FILE *file;
-{
- struct bb_list *ptr = (struct bb_list *) permalloc (sizeof (struct bb_list));
-
- /* Add basic block to linked list. */
- ptr->next = 0;
- ptr->line_num = last_linenum;
- ptr->file_label_num = bb_file_label_num;
- ptr->func_label_num = bb_func_label_num;
- *bb_tail = ptr;
- bb_tail = &ptr->next;
-
- /* Enable the table of basic-block use counts
- to point at the code it applies to. */
- ASM_OUTPUT_INTERNAL_LABEL (file, "LPB", count_basic_blocks);
-
- /* Before first insn of this basic block, increment the
- count of times it was entered. */
-#ifdef BLOCK_PROFILER
- BLOCK_PROFILER (file, count_basic_blocks);
-#endif
-#ifdef HAVE_cc0
- CC_STATUS_INIT;
-#endif
-
- new_block = 0;
- count_basic_blocks++;
-}
-
-/* Add a string to be used for basic block profiling. */
-
-static int
-add_bb_string (string, perm_p)
- char *string;
- int perm_p;
-{
- int len;
- struct bb_str *ptr = 0;
-
- if (!string)
- {
- string = "<unknown>";
- perm_p = TRUE;
- }
-
- /* Allocate a new string if the current string isn't permanent. If
- the string is permanent search for the same string in other
- allocations. */
-
- len = strlen (string) + 1;
- if (!perm_p)
- {
- char *p = (char *) permalloc (len);
- bcopy (string, p, len);
- string = p;
- }
- else
- for (ptr = sbb_head; ptr != (struct bb_str *) 0; ptr = ptr->next)
- if (ptr->string == string)
- break;
-
- /* Allocate a new string block if we need to. */
- if (!ptr)
- {
- ptr = (struct bb_str *) permalloc (sizeof (*ptr));
- ptr->next = 0;
- ptr->length = len;
- ptr->label_num = sbb_label_num++;
- ptr->string = string;
- *sbb_tail = ptr;
- sbb_tail = &ptr->next;
- }
-
- return ptr->label_num;
-}
-
-
-/* Output assembler code for some insns: all or part of a function.
- For description of args, see `final_start_function', above.
-
- PRESCAN is 1 if we are not really outputting,
- just scanning as if we were outputting.
- Prescanning deletes and rearranges insns just like ordinary output.
- PRESCAN is -2 if we are outputting after having prescanned.
- In this case, don't try to delete or rearrange insns
- because that has already been done.
- Prescanning is done only on certain machines. */
-
-void
-final (first, file, optimize, prescan)
- rtx first;
- FILE *file;
- int optimize;
- int prescan;
-{
- register rtx insn;
- int max_line = 0;
-
- last_ignored_compare = 0;
- new_block = 1;
-
-#if defined (DWARF2_DEBUGGING_INFO) && defined (HAVE_prologue)
- dwarf2out_frame_debug (NULL_RTX);
-#endif
-
- check_exception_handler_labels ();
-
- /* Make a map indicating which line numbers appear in this function.
- When producing SDB debugging info, delete troublesome line number
- notes from inlined functions in other files as well as duplicate
- line number notes. */
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- {
- rtx last = 0;
- for (insn = first; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
- {
- if ((RTX_INTEGRATED_P (insn)
- && strcmp (NOTE_SOURCE_FILE (insn), main_input_filename) != 0)
- || (last != 0
- && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last)
- && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last)))
- {
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- continue;
- }
- last = insn;
- if (NOTE_LINE_NUMBER (insn) > max_line)
- max_line = NOTE_LINE_NUMBER (insn);
- }
- }
- else
-#endif
- {
- for (insn = first; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > max_line)
- max_line = NOTE_LINE_NUMBER (insn);
- }
-
- line_note_exists = (char *) oballoc (max_line + 1);
- bzero (line_note_exists, max_line + 1);
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
- line_note_exists[NOTE_LINE_NUMBER (insn)] = 1;
-
- init_recog ();
-
- CC_STATUS_INIT;
-
- /* Output the insns. */
- for (insn = NEXT_INSN (first); insn;)
- {
-#ifdef HAVE_ATTR_length
- insn_current_address = insn_addresses[INSN_UID (insn)];
-#endif
- insn = final_scan_insn (insn, file, optimize, prescan, 0);
- }
-
- /* Do basic-block profiling here
- if the last insn was a conditional branch. */
- if (profile_block_flag && new_block)
- add_bb (file);
-}
-
-/* The final scan for one insn, INSN.
- Args are same as in `final', except that INSN
- is the insn being scanned.
- Value returned is the next insn to be scanned.
-
- NOPEEPHOLES is the flag to disallow peephole processing (currently
- used for within delayed branch sequence output). */
-
-rtx
-final_scan_insn (insn, file, optimize, prescan, nopeepholes)
- rtx insn;
- FILE *file;
- int optimize;
- int prescan;
- int nopeepholes;
-{
- register int i;
- insn_counter++;
-
- /* Ignore deleted insns. These can occur when we split insns (due to a
- template of "#") while not optimizing. */
- if (INSN_DELETED_P (insn))
- return NEXT_INSN (insn);
-
- switch (GET_CODE (insn))
- {
- case NOTE:
- if (prescan > 0)
- break;
-
- /* Align the beginning of a loop, for higher speed
- on certain machines. */
-
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG && optimize > 0)
- {
-#ifdef ASM_OUTPUT_LOOP_ALIGN
- rtx next = next_nonnote_insn (insn);
- if (next && GET_CODE (next) == CODE_LABEL)
- {
- ASM_OUTPUT_LOOP_ALIGN (asm_out_file);
- }
-#endif
- break;
- }
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- break;
-
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
- {
- ASM_OUTPUT_INTERNAL_LABEL (file, "LEHB", NOTE_BLOCK_NUMBER (insn));
- add_eh_table_entry (NOTE_BLOCK_NUMBER (insn));
-#ifdef ASM_OUTPUT_EH_REGION_BEG
- ASM_OUTPUT_EH_REGION_BEG (file, NOTE_BLOCK_NUMBER (insn));
-#endif
- break;
- }
-
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END)
- {
- ASM_OUTPUT_INTERNAL_LABEL (file, "LEHE", NOTE_BLOCK_NUMBER (insn));
-#ifdef ASM_OUTPUT_EH_REGION_END
- ASM_OUTPUT_EH_REGION_END (file, NOTE_BLOCK_NUMBER (insn));
-#endif
- break;
- }
-
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_PROLOGUE_END)
- {
-#ifdef FUNCTION_END_PROLOGUE
- FUNCTION_END_PROLOGUE (file);
-#endif
- profile_after_prologue (file);
- break;
- }
-
-#ifdef FUNCTION_BEGIN_EPILOGUE
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EPILOGUE_BEG)
- {
- FUNCTION_BEGIN_EPILOGUE (file);
- break;
- }
-#endif
-
- if (write_symbols == NO_DEBUG)
- break;
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG)
- {
-#if defined(SDB_DEBUGGING_INFO) && defined(MIPS_DEBUGGING_INFO)
- /* MIPS stabs require the parameter descriptions to be after the
- function entry point rather than before. */
- if (write_symbols == SDB_DEBUG)
- sdbout_begin_function (last_linenum);
- else
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- /* This outputs a marker where the function body starts, so it
- must be after the prologue. */
- if (write_symbols == DWARF_DEBUG)
- dwarfout_begin_function ();
-#endif
- break;
- }
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
- break; /* An insn that was "deleted" */
- if (app_on)
- {
- fprintf (file, ASM_APP_OFF);
- app_on = 0;
- }
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
- && (debug_info_level == DINFO_LEVEL_NORMAL
- || debug_info_level == DINFO_LEVEL_VERBOSE
- || write_symbols == DWARF_DEBUG
- || write_symbols == DWARF2_DEBUG))
- {
- /* Beginning of a symbol-block. Assign it a sequence number
- and push the number onto the stack PENDING_BLOCKS. */
-
- if (block_depth == max_block_depth)
- {
- /* PENDING_BLOCKS is full; make it longer. */
- max_block_depth *= 2;
- pending_blocks
- = (int *) xrealloc (pending_blocks,
- max_block_depth * sizeof (int));
- }
- pending_blocks[block_depth++] = next_block_index;
-
- high_block_linenum = last_linenum;
-
- /* Output debugging info about the symbol-block beginning. */
-
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- sdbout_begin_block (file, last_linenum, next_block_index);
-#endif
-#ifdef XCOFF_DEBUGGING_INFO
- if (write_symbols == XCOFF_DEBUG)
- xcoffout_begin_block (file, last_linenum, next_block_index);
-#endif
-#ifdef DBX_DEBUGGING_INFO
- if (write_symbols == DBX_DEBUG)
- ASM_OUTPUT_INTERNAL_LABEL (file, "LBB", next_block_index);
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- dwarfout_begin_block (next_block_index);
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- dwarf2out_begin_block (next_block_index);
-#endif
-
- next_block_index++;
- }
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END
- && (debug_info_level == DINFO_LEVEL_NORMAL
- || debug_info_level == DINFO_LEVEL_VERBOSE
- || write_symbols == DWARF_DEBUG
- || write_symbols == DWARF2_DEBUG))
- {
- /* End of a symbol-block. Pop its sequence number off
- PENDING_BLOCKS and output debugging info based on that. */
-
- --block_depth;
-
-#ifdef XCOFF_DEBUGGING_INFO
- if (write_symbols == XCOFF_DEBUG && block_depth >= 0)
- xcoffout_end_block (file, high_block_linenum,
- pending_blocks[block_depth]);
-#endif
-#ifdef DBX_DEBUGGING_INFO
- if (write_symbols == DBX_DEBUG && block_depth >= 0)
- ASM_OUTPUT_INTERNAL_LABEL (file, "LBE",
- pending_blocks[block_depth]);
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG && block_depth >= 0)
- sdbout_end_block (file, high_block_linenum,
- pending_blocks[block_depth]);
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG && block_depth >= 0)
- dwarfout_end_block (pending_blocks[block_depth]);
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG && block_depth >= 0)
- dwarf2out_end_block (pending_blocks[block_depth]);
-#endif
- }
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL
- && (debug_info_level == DINFO_LEVEL_NORMAL
- || debug_info_level == DINFO_LEVEL_VERBOSE))
- {
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- dwarfout_label (insn);
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- dwarf2out_label (insn);
-#endif
- }
- else if (NOTE_LINE_NUMBER (insn) > 0)
- /* This note is a line-number. */
- {
- register rtx note;
-
-#if 0 /* This is what we used to do. */
- output_source_line (file, insn);
-#endif
- int note_after = 0;
-
- /* If there is anything real after this note,
- output it. If another line note follows, omit this one. */
- for (note = NEXT_INSN (insn); note; note = NEXT_INSN (note))
- {
- if (GET_CODE (note) != NOTE && GET_CODE (note) != CODE_LABEL)
- break;
- /* These types of notes can be significant
- so make sure the preceding line number stays. */
- else if (GET_CODE (note) == NOTE
- && (NOTE_LINE_NUMBER (note) == NOTE_INSN_BLOCK_BEG
- || NOTE_LINE_NUMBER (note) == NOTE_INSN_BLOCK_END
- || NOTE_LINE_NUMBER (note) == NOTE_INSN_FUNCTION_BEG))
- break;
- else if (GET_CODE (note) == NOTE && NOTE_LINE_NUMBER (note) > 0)
- {
- /* Another line note follows; we can delete this note
- if no intervening line numbers have notes elsewhere. */
- int num;
- for (num = NOTE_LINE_NUMBER (insn) + 1;
- num < NOTE_LINE_NUMBER (note);
- num++)
- if (line_note_exists[num])
- break;
-
- if (num >= NOTE_LINE_NUMBER (note))
- note_after = 1;
- break;
- }
- }
-
- /* Output this line note
- if it is the first or the last line note in a row. */
- if (!note_after)
- output_source_line (file, insn);
- }
- break;
-
- case BARRIER:
-#ifdef ASM_OUTPUT_ALIGN_CODE
- /* Don't litter the assembler output with needless alignments. A
- BARRIER will be placed at the end of every function if HAVE_epilogue
- is true. */
- if (NEXT_INSN (insn))
- ASM_OUTPUT_ALIGN_CODE (file);
-#endif
- break;
-
- case CODE_LABEL:
- CC_STATUS_INIT;
- if (prescan > 0)
- break;
- new_block = 1;
-
-#ifdef FINAL_PRESCAN_LABEL
- FINAL_PRESCAN_INSN (insn, NULL_PTR, 0);
-#endif
-
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG && LABEL_NAME (insn))
- sdbout_label (insn);
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG && LABEL_NAME (insn))
- dwarfout_label (insn);
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG && LABEL_NAME (insn))
- dwarf2out_label (insn);
-#endif
- if (app_on)
- {
- fprintf (file, ASM_APP_OFF);
- app_on = 0;
- }
- if (NEXT_INSN (insn) != 0
- && GET_CODE (NEXT_INSN (insn)) == JUMP_INSN)
- {
- rtx nextbody = PATTERN (NEXT_INSN (insn));
-
- /* If this label is followed by a jump-table,
- make sure we put the label in the read-only section. Also
- possibly write the label and jump table together. */
-
- if (GET_CODE (nextbody) == ADDR_VEC
- || GET_CODE (nextbody) == ADDR_DIFF_VEC)
- {
-#ifndef JUMP_TABLES_IN_TEXT_SECTION
- readonly_data_section ();
-#ifdef READONLY_DATA_SECTION
- ASM_OUTPUT_ALIGN (file,
- exact_log2 (BIGGEST_ALIGNMENT
- / BITS_PER_UNIT));
-#endif /* READONLY_DATA_SECTION */
-#else /* JUMP_TABLES_IN_TEXT_SECTION */
- function_section (current_function_decl);
-#endif /* JUMP_TABLES_IN_TEXT_SECTION */
-#ifdef ASM_OUTPUT_CASE_LABEL
- ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
- NEXT_INSN (insn));
-#else
- ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
-#endif
- break;
- }
- }
-
- ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (insn));
- break;
-
- default:
- {
- register rtx body = PATTERN (insn);
- int insn_code_number;
- char *template;
- rtx note;
-
- /* An INSN, JUMP_INSN or CALL_INSN.
- First check for special kinds that recog doesn't recognize. */
-
- if (GET_CODE (body) == USE /* These are just declarations */
- || GET_CODE (body) == CLOBBER)
- break;
-
-#ifdef HAVE_cc0
- /* If there is a REG_CC_SETTER note on this insn, it means that
- the setting of the condition code was done in the delay slot
- of the insn that branched here. So recover the cc status
- from the insn that set it. */
-
- note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
- if (note)
- {
- NOTICE_UPDATE_CC (PATTERN (XEXP (note, 0)), XEXP (note, 0));
- cc_prev_status = cc_status;
- }
-#endif
-
- /* Detect insns that are really jump-tables
- and output them as such. */
-
- if (GET_CODE (body) == ADDR_VEC || GET_CODE (body) == ADDR_DIFF_VEC)
- {
- register int vlen, idx;
-
- if (prescan > 0)
- break;
-
- if (app_on)
- {
- fprintf (file, ASM_APP_OFF);
- app_on = 0;
- }
-
- vlen = XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC);
- for (idx = 0; idx < vlen; idx++)
- {
- if (GET_CODE (body) == ADDR_VEC)
- {
-#ifdef ASM_OUTPUT_ADDR_VEC_ELT
- ASM_OUTPUT_ADDR_VEC_ELT
- (file, CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 0, idx), 0)));
-#else
- abort ();
-#endif
- }
- else
- {
-#ifdef ASM_OUTPUT_ADDR_DIFF_ELT
- ASM_OUTPUT_ADDR_DIFF_ELT
- (file,
- CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 1, idx), 0)),
- CODE_LABEL_NUMBER (XEXP (XEXP (body, 0), 0)));
-#else
- abort ();
-#endif
- }
- }
-#ifdef ASM_OUTPUT_CASE_END
- ASM_OUTPUT_CASE_END (file,
- CODE_LABEL_NUMBER (PREV_INSN (insn)),
- insn);
-#endif
-
- function_section (current_function_decl);
-
- break;
- }
-
- /* Do basic-block profiling when we reach a new block.
- Done here to avoid jump tables. */
- if (profile_block_flag && new_block)
- add_bb (file);
-
- if (GET_CODE (body) == ASM_INPUT)
- {
- /* There's no telling what that did to the condition codes. */
- CC_STATUS_INIT;
- if (prescan > 0)
- break;
- if (! app_on)
- {
- fprintf (file, ASM_APP_ON);
- app_on = 1;
- }
- fprintf (asm_out_file, "\t%s\n", XSTR (body, 0));
- break;
- }
-
- /* Detect `asm' construct with operands. */
- if (asm_noperands (body) >= 0)
- {
- int noperands = asm_noperands (body);
- rtx *ops = (rtx *) alloca (noperands * sizeof (rtx));
- char *string;
-
- /* There's no telling what that did to the condition codes. */
- CC_STATUS_INIT;
- if (prescan > 0)
- break;
-
- if (! app_on)
- {
- fprintf (file, ASM_APP_ON);
- app_on = 1;
- }
-
- /* Get out the operand values. */
- string = decode_asm_operands (body, ops, NULL_PTR,
- NULL_PTR, NULL_PTR);
- /* Inhibit aborts on what would otherwise be compiler bugs. */
- insn_noperands = noperands;
- this_is_asm_operands = insn;
-
- /* Output the insn using them. */
- output_asm_insn (string, ops);
- this_is_asm_operands = 0;
- break;
- }
-
- if (prescan <= 0 && app_on)
- {
- fprintf (file, ASM_APP_OFF);
- app_on = 0;
- }
-
- if (GET_CODE (body) == SEQUENCE)
- {
- /* A delayed-branch sequence */
- register int i;
- rtx next;
-
- if (prescan > 0)
- break;
- final_sequence = body;
-
- /* The first insn in this SEQUENCE might be a JUMP_INSN that will
- force the restoration of a comparison that was previously
- thought unnecessary. If that happens, cancel this sequence
- and cause that insn to be restored. */
-
- next = final_scan_insn (XVECEXP (body, 0, 0), file, 0, prescan, 1);
- if (next != XVECEXP (body, 0, 1))
- {
- final_sequence = 0;
- return next;
- }
-
- for (i = 1; i < XVECLEN (body, 0); i++)
- {
- rtx insn = XVECEXP (body, 0, i);
- rtx next = NEXT_INSN (insn);
- /* We loop in case any instruction in a delay slot gets
- split. */
- do
- insn = final_scan_insn (insn, file, 0, prescan, 1);
- while (insn != next);
- }
-#ifdef DBR_OUTPUT_SEQEND
- DBR_OUTPUT_SEQEND (file);
-#endif
- final_sequence = 0;
-
- /* If the insn requiring the delay slot was a CALL_INSN, the
- insns in the delay slot are actually executed before the
- called function. Hence we don't preserve any CC-setting
- actions in these insns and the CC must be marked as being
- clobbered by the function. */
- if (GET_CODE (XVECEXP (body, 0, 0)) == CALL_INSN)
- CC_STATUS_INIT;
-
- /* Following a conditional branch sequence, we have a new basic
- block. */
- if (profile_block_flag)
- {
- rtx insn = XVECEXP (body, 0, 0);
- rtx body = PATTERN (insn);
-
- if ((GET_CODE (insn) == JUMP_INSN && GET_CODE (body) == SET
- && GET_CODE (SET_SRC (body)) != LABEL_REF)
- || (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (body, 0, 0))) != LABEL_REF))
- new_block = 1;
- }
- break;
- }
-
- /* We have a real machine instruction as rtl. */
-
- body = PATTERN (insn);
-
-#ifdef HAVE_cc0
- /* Check for redundant test and compare instructions
- (when the condition codes are already set up as desired).
- This is done only when optimizing; if not optimizing,
- it should be possible for the user to alter a variable
- with the debugger in between statements
- and the next statement should reexamine the variable
- to compute the condition codes. */
-
- if (optimize)
- {
- rtx set = single_set(insn);
-
- if (set
- && GET_CODE (SET_DEST (set)) == CC0
- && insn != last_ignored_compare)
- {
- if (GET_CODE (SET_SRC (set)) == SUBREG)
- SET_SRC (set) = alter_subreg (SET_SRC (set));
- else if (GET_CODE (SET_SRC (set)) == COMPARE)
- {
- if (GET_CODE (XEXP (SET_SRC (set), 0)) == SUBREG)
- XEXP (SET_SRC (set), 0)
- = alter_subreg (XEXP (SET_SRC (set), 0));
- if (GET_CODE (XEXP (SET_SRC (set), 1)) == SUBREG)
- XEXP (SET_SRC (set), 1)
- = alter_subreg (XEXP (SET_SRC (set), 1));
- }
- if ((cc_status.value1 != 0
- && rtx_equal_p (SET_SRC (set), cc_status.value1))
- || (cc_status.value2 != 0
- && rtx_equal_p (SET_SRC (set), cc_status.value2)))
- {
- /* Don't delete insn if it has an addressing side-effect. */
- if (! FIND_REG_INC_NOTE (insn, 0)
- /* or if anything in it is volatile. */
- && ! volatile_refs_p (PATTERN (insn)))
- {
- /* We don't really delete the insn; just ignore it. */
- last_ignored_compare = insn;
- break;
- }
- }
- }
- }
-#endif
-
- /* Following a conditional branch, we have a new basic block.
- But if we are inside a sequence, the new block starts after the
- last insn of the sequence. */
- if (profile_block_flag && final_sequence == 0
- && ((GET_CODE (insn) == JUMP_INSN && GET_CODE (body) == SET
- && GET_CODE (SET_SRC (body)) != LABEL_REF)
- || (GET_CODE (insn) == JUMP_INSN && GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (body, 0, 0))) != LABEL_REF)))
- new_block = 1;
-
-#ifndef STACK_REGS
- /* Don't bother outputting obvious no-ops, even without -O.
- This optimization is fast and doesn't interfere with debugging.
- Don't do this if the insn is in a delay slot, since this
- will cause an improper number of delay insns to be written. */
- if (final_sequence == 0
- && prescan >= 0
- && GET_CODE (insn) == INSN && GET_CODE (body) == SET
- && GET_CODE (SET_SRC (body)) == REG
- && GET_CODE (SET_DEST (body)) == REG
- && REGNO (SET_SRC (body)) == REGNO (SET_DEST (body)))
- break;
-#endif
-
-#ifdef HAVE_cc0
- /* If this is a conditional branch, maybe modify it
- if the cc's are in a nonstandard state
- so that it accomplishes the same thing that it would
- do straightforwardly if the cc's were set up normally. */
-
- if (cc_status.flags != 0
- && GET_CODE (insn) == JUMP_INSN
- && GET_CODE (body) == SET
- && SET_DEST (body) == pc_rtx
- && GET_CODE (SET_SRC (body)) == IF_THEN_ELSE
- && GET_RTX_CLASS (GET_CODE (XEXP (SET_SRC (body), 0))) == '<'
- && XEXP (XEXP (SET_SRC (body), 0), 0) == cc0_rtx
- /* This is done during prescan; it is not done again
- in final scan when prescan has been done. */
- && prescan >= 0)
- {
- /* This function may alter the contents of its argument
- and clear some of the cc_status.flags bits.
- It may also return 1 meaning condition now always true
- or -1 meaning condition now always false
- or 2 meaning condition nontrivial but altered. */
- register int result = alter_cond (XEXP (SET_SRC (body), 0));
- /* If condition now has fixed value, replace the IF_THEN_ELSE
- with its then-operand or its else-operand. */
- if (result == 1)
- SET_SRC (body) = XEXP (SET_SRC (body), 1);
- if (result == -1)
- SET_SRC (body) = XEXP (SET_SRC (body), 2);
-
- /* The jump is now either unconditional or a no-op.
- If it has become a no-op, don't try to output it.
- (It would not be recognized.) */
- if (SET_SRC (body) == pc_rtx)
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- break;
- }
- else if (GET_CODE (SET_SRC (body)) == RETURN)
- /* Replace (set (pc) (return)) with (return). */
- PATTERN (insn) = body = SET_SRC (body);
-
- /* Rerecognize the instruction if it has changed. */
- if (result != 0)
- INSN_CODE (insn) = -1;
- }
-
- /* Make same adjustments to instructions that examine the
- condition codes without jumping and instructions that
- handle conditional moves (if this machine has either one). */
-
- if (cc_status.flags != 0
- && GET_CODE (body) == SET)
- {
- rtx cond_rtx, then_rtx, else_rtx;
-
- if (GET_CODE (insn) != JUMP_INSN
- && GET_CODE (SET_SRC (body)) == IF_THEN_ELSE)
- {
- cond_rtx = XEXP (SET_SRC (body), 0);
- then_rtx = XEXP (SET_SRC (body), 1);
- else_rtx = XEXP (SET_SRC (body), 2);
- }
- else
- {
- cond_rtx = SET_SRC (body);
- then_rtx = const_true_rtx;
- else_rtx = const0_rtx;
- }
-
- switch (GET_CODE (cond_rtx))
- {
- case GTU:
- case GT:
- case LTU:
- case LT:
- case GEU:
- case GE:
- case LEU:
- case LE:
- case EQ:
- case NE:
- {
- register int result;
- if (XEXP (cond_rtx, 0) != cc0_rtx)
- break;
- result = alter_cond (cond_rtx);
- if (result == 1)
- validate_change (insn, &SET_SRC (body), then_rtx, 0);
- else if (result == -1)
- validate_change (insn, &SET_SRC (body), else_rtx, 0);
- else if (result == 2)
- INSN_CODE (insn) = -1;
- if (SET_DEST (body) == SET_SRC (body))
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- break;
- }
- }
- }
- }
-
-#endif
-
- /* Do machine-specific peephole optimizations if desired. */
-
- if (optimize && !flag_no_peephole && !nopeepholes)
- {
- rtx next = peephole (insn);
- /* When peepholing, if there were notes within the peephole,
- emit them before the peephole. */
- if (next != 0 && next != NEXT_INSN (insn))
- {
- rtx prev = PREV_INSN (insn);
- rtx note;
-
- for (note = NEXT_INSN (insn); note != next;
- note = NEXT_INSN (note))
- final_scan_insn (note, file, optimize, prescan, nopeepholes);
-
- /* In case this is prescan, put the notes
- in proper position for later rescan. */
- note = NEXT_INSN (insn);
- PREV_INSN (note) = prev;
- NEXT_INSN (prev) = note;
- NEXT_INSN (PREV_INSN (next)) = insn;
- PREV_INSN (insn) = PREV_INSN (next);
- NEXT_INSN (insn) = next;
- PREV_INSN (next) = insn;
- }
-
- /* PEEPHOLE might have changed this. */
- body = PATTERN (insn);
- }
-
- /* Try to recognize the instruction.
- If successful, verify that the operands satisfy the
- constraints for the instruction. Crash if they don't,
- since `reload' should have changed them so that they do. */
-
- insn_code_number = recog_memoized (insn);
- insn_extract (insn);
- for (i = 0; i < insn_n_operands[insn_code_number]; i++)
- {
- if (GET_CODE (recog_operand[i]) == SUBREG)
- recog_operand[i] = alter_subreg (recog_operand[i]);
- else if (GET_CODE (recog_operand[i]) == PLUS
- || GET_CODE (recog_operand[i]) == MULT)
- recog_operand[i] = walk_alter_subreg (recog_operand[i]);
- }
-
- for (i = 0; i < insn_n_dups[insn_code_number]; i++)
- {
- if (GET_CODE (*recog_dup_loc[i]) == SUBREG)
- *recog_dup_loc[i] = alter_subreg (*recog_dup_loc[i]);
- else if (GET_CODE (*recog_dup_loc[i]) == PLUS
- || GET_CODE (*recog_dup_loc[i]) == MULT)
- *recog_dup_loc[i] = walk_alter_subreg (*recog_dup_loc[i]);
- }
-
-#ifdef REGISTER_CONSTRAINTS
- if (! constrain_operands (insn_code_number, 1))
- fatal_insn_not_found (insn);
-#endif
-
- /* Some target machines need to prescan each insn before
- it is output. */
-
-#ifdef FINAL_PRESCAN_INSN
- FINAL_PRESCAN_INSN (insn, recog_operand,
- insn_n_operands[insn_code_number]);
-#endif
-
-#ifdef HAVE_cc0
- cc_prev_status = cc_status;
-
- /* Update `cc_status' for this instruction.
- The instruction's output routine may change it further.
- If the output routine for a jump insn needs to depend
- on the cc status, it should look at cc_prev_status. */
-
- NOTICE_UPDATE_CC (body, insn);
-#endif
-
- debug_insn = insn;
-
- /* If the proper template needs to be chosen by some C code,
- run that code and get the real template. */
-
- template = insn_template[insn_code_number];
- if (template == 0)
- {
- template = (*insn_outfun[insn_code_number]) (recog_operand, insn);
-
- /* If the C code returns 0, it means that it is a jump insn
- which follows a deleted test insn, and that test insn
- needs to be reinserted. */
- if (template == 0)
- {
- if (prev_nonnote_insn (insn) != last_ignored_compare)
- abort ();
- new_block = 0;
- return prev_nonnote_insn (insn);
- }
- }
-
- /* If the template is the string "#", it means that this insn must
- be split. */
- if (template[0] == '#' && template[1] == '\0')
- {
- rtx new = try_split (body, insn, 0);
-
- /* If we didn't split the insn, go away. */
- if (new == insn && PATTERN (new) == body)
- abort ();
-
-#ifdef HAVE_ATTR_length
- /* This instruction should have been split in shorten_branches,
- to ensure that we would have valid length info for the
- splitees. */
- abort ();
-#endif
-
- new_block = 0;
- return new;
- }
-
- if (prescan > 0)
- break;
-
- /* Output assembler code from the template. */
-
- output_asm_insn (template, recog_operand);
-
-#if defined (DWARF2_DEBUGGING_INFO) && defined (HAVE_prologue)
- /* If this insn is part of the prologue, emit DWARF v2
- call frame info. */
- if (write_symbols == DWARF2_DEBUG && RTX_FRAME_RELATED_P (insn))
- dwarf2out_frame_debug (insn);
-#endif
-
-#if 0
- /* It's not at all clear why we did this and doing so interferes
- with tests we'd like to do to use REG_WAS_0 notes, so let's try
- with this out. */
-
- /* Mark this insn as having been output. */
- INSN_DELETED_P (insn) = 1;
-#endif
-
- debug_insn = 0;
- }
- }
- return NEXT_INSN (insn);
-}
-
-/* Output debugging info to the assembler file FILE
- based on the NOTE-insn INSN, assumed to be a line number. */
-
-static void
-output_source_line (file, insn)
- FILE *file;
- rtx insn;
-{
- register char *filename = NOTE_SOURCE_FILE (insn);
-
- /* Remember filename for basic block profiling.
- Filenames are allocated on the permanent obstack
- or are passed in ARGV, so we don't have to save
- the string. */
-
- if (profile_block_flag && last_filename != filename)
- bb_file_label_num = add_bb_string (filename, TRUE);
-
- last_filename = filename;
- last_linenum = NOTE_LINE_NUMBER (insn);
- high_block_linenum = MAX (last_linenum, high_block_linenum);
- high_function_linenum = MAX (last_linenum, high_function_linenum);
-
- if (write_symbols != NO_DEBUG)
- {
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG
-#if 0 /* People like having line numbers even in wrong file! */
- /* COFF can't handle multiple source files--lose, lose. */
- && !strcmp (filename, main_input_filename)
-#endif
- /* COFF relative line numbers must be positive. */
- && last_linenum > sdb_begin_function_line)
- {
-#ifdef ASM_OUTPUT_SOURCE_LINE
- ASM_OUTPUT_SOURCE_LINE (file, last_linenum);
-#else
- fprintf (file, "\t.ln\t%d\n",
- ((sdb_begin_function_line > -1)
- ? last_linenum - sdb_begin_function_line : 1));
-#endif
- }
-#endif
-
-#if defined (DBX_DEBUGGING_INFO)
- if (write_symbols == DBX_DEBUG)
- dbxout_source_line (file, filename, NOTE_LINE_NUMBER (insn));
-#endif
-
-#if defined (XCOFF_DEBUGGING_INFO)
- if (write_symbols == XCOFF_DEBUG)
- xcoffout_source_line (file, filename, insn);
-#endif
-
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- dwarfout_line (filename, NOTE_LINE_NUMBER (insn));
-#endif
-
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- dwarf2out_line (filename, NOTE_LINE_NUMBER (insn));
-#endif
- }
-}
-
-/* If X is a SUBREG, replace it with a REG or a MEM,
- based on the thing it is a subreg of. */
-
-rtx
-alter_subreg (x)
- register rtx x;
-{
- register rtx y = SUBREG_REG (x);
- if (GET_CODE (y) == SUBREG)
- y = alter_subreg (y);
-
- if (GET_CODE (y) == REG)
- {
- /* If the containing reg really gets a hard reg, so do we. */
- PUT_CODE (x, REG);
- REGNO (x) = REGNO (y) + SUBREG_WORD (x);
- }
- else if (GET_CODE (y) == MEM)
- {
- register int offset = SUBREG_WORD (x) * UNITS_PER_WORD;
- if (BYTES_BIG_ENDIAN)
- offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x)))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (y))));
- PUT_CODE (x, MEM);
- MEM_VOLATILE_P (x) = MEM_VOLATILE_P (y);
- XEXP (x, 0) = plus_constant (XEXP (y, 0), offset);
- }
-
- return x;
-}
-
-/* Do alter_subreg on all the SUBREGs contained in X. */
-
-static rtx
-walk_alter_subreg (x)
- rtx x;
-{
- switch (GET_CODE (x))
- {
- case PLUS:
- case MULT:
- XEXP (x, 0) = walk_alter_subreg (XEXP (x, 0));
- XEXP (x, 1) = walk_alter_subreg (XEXP (x, 1));
- break;
-
- case MEM:
- XEXP (x, 0) = walk_alter_subreg (XEXP (x, 0));
- break;
-
- case SUBREG:
- return alter_subreg (x);
- }
-
- return x;
-}
-
-#ifdef HAVE_cc0
-
-/* Given BODY, the body of a jump instruction, alter the jump condition
- as required by the bits that are set in cc_status.flags.
- Not all of the bits there can be handled at this level in all cases.
-
- The value is normally 0.
- 1 means that the condition has become always true.
- -1 means that the condition has become always false.
- 2 means that COND has been altered. */
-
-static int
-alter_cond (cond)
- register rtx cond;
-{
- int value = 0;
-
- if (cc_status.flags & CC_REVERSED)
- {
- value = 2;
- PUT_CODE (cond, swap_condition (GET_CODE (cond)));
- }
-
- if (cc_status.flags & CC_INVERTED)
- {
- value = 2;
- PUT_CODE (cond, reverse_condition (GET_CODE (cond)));
- }
-
- if (cc_status.flags & CC_NOT_POSITIVE)
- switch (GET_CODE (cond))
- {
- case LE:
- case LEU:
- case GEU:
- /* Jump becomes unconditional. */
- return 1;
-
- case GT:
- case GTU:
- case LTU:
- /* Jump becomes no-op. */
- return -1;
-
- case GE:
- PUT_CODE (cond, EQ);
- value = 2;
- break;
-
- case LT:
- PUT_CODE (cond, NE);
- value = 2;
- break;
- }
-
- if (cc_status.flags & CC_NOT_NEGATIVE)
- switch (GET_CODE (cond))
- {
- case GE:
- case GEU:
- /* Jump becomes unconditional. */
- return 1;
-
- case LT:
- case LTU:
- /* Jump becomes no-op. */
- return -1;
-
- case LE:
- case LEU:
- PUT_CODE (cond, EQ);
- value = 2;
- break;
-
- case GT:
- case GTU:
- PUT_CODE (cond, NE);
- value = 2;
- break;
- }
-
- if (cc_status.flags & CC_NO_OVERFLOW)
- switch (GET_CODE (cond))
- {
- case GEU:
- /* Jump becomes unconditional. */
- return 1;
-
- case LEU:
- PUT_CODE (cond, EQ);
- value = 2;
- break;
-
- case GTU:
- PUT_CODE (cond, NE);
- value = 2;
- break;
-
- case LTU:
- /* Jump becomes no-op. */
- return -1;
- }
-
- if (cc_status.flags & (CC_Z_IN_NOT_N | CC_Z_IN_N))
- switch (GET_CODE (cond))
- {
- case LE:
- case LEU:
- case GE:
- case GEU:
- case LT:
- case LTU:
- case GT:
- case GTU:
- abort ();
-
- case NE:
- PUT_CODE (cond, cc_status.flags & CC_Z_IN_N ? GE : LT);
- value = 2;
- break;
-
- case EQ:
- PUT_CODE (cond, cc_status.flags & CC_Z_IN_N ? LT : GE);
- value = 2;
- break;
- }
-
- if (cc_status.flags & CC_NOT_SIGNED)
- /* The flags are valid if signed condition operators are converted
- to unsigned. */
- switch (GET_CODE (cond))
- {
- case LE:
- PUT_CODE (cond, LEU);
- value = 2;
- break;
-
- case LT:
- PUT_CODE (cond, LTU);
- value = 2;
- break;
-
- case GT:
- PUT_CODE (cond, GTU);
- value = 2;
- break;
-
- case GE:
- PUT_CODE (cond, GEU);
- value = 2;
- break;
- }
-
- return value;
-}
-#endif
-
-/* Report inconsistency between the assembler template and the operands.
- In an `asm', it's the user's fault; otherwise, the compiler's fault. */
-
-void
-output_operand_lossage (str)
- char *str;
-{
- if (this_is_asm_operands)
- error_for_asm (this_is_asm_operands, "invalid `asm': %s", str);
- else
- abort ();
-}
-
-/* Output of assembler code from a template, and its subroutines. */
-
-/* Output text from TEMPLATE to the assembler output file,
- obeying %-directions to substitute operands taken from
- the vector OPERANDS.
-
- %N (for N a digit) means print operand N in usual manner.
- %lN means require operand N to be a CODE_LABEL or LABEL_REF
- and print the label name with no punctuation.
- %cN means require operand N to be a constant
- and print the constant expression with no punctuation.
- %aN means expect operand N to be a memory address
- (not a memory reference!) and print a reference
- to that address.
- %nN means expect operand N to be a constant
- and print a constant expression for minus the value
- of the operand, with no other punctuation. */
-
-static void
-output_asm_name ()
-{
- if (flag_print_asm_name)
- {
- /* Annotate the assembly with a comment describing the pattern and
- alternative used. */
- if (debug_insn)
- {
- register int num = INSN_CODE (debug_insn);
- fprintf (asm_out_file, " %s %d %s",
- ASM_COMMENT_START, INSN_UID (debug_insn), insn_name[num]);
- if (insn_n_alternatives[num] > 1)
- fprintf (asm_out_file, "/%d", which_alternative + 1);
-
- /* Clear this so only the first assembler insn
- of any rtl insn will get the special comment for -dp. */
- debug_insn = 0;
- }
- }
-}
-
-void
-output_asm_insn (template, operands)
- char *template;
- rtx *operands;
-{
- register char *p;
- register int c, i;
-
- /* An insn may return a null string template
- in a case where no assembler code is needed. */
- if (*template == 0)
- return;
-
- p = template;
- putc ('\t', asm_out_file);
-
-#ifdef ASM_OUTPUT_OPCODE
- ASM_OUTPUT_OPCODE (asm_out_file, p);
-#endif
-
- while (c = *p++)
- switch (c)
- {
- case '\n':
- output_asm_name ();
- putc (c, asm_out_file);
-#ifdef ASM_OUTPUT_OPCODE
- while ((c = *p) == '\t')
- {
- putc (c, asm_out_file);
- p++;
- }
- ASM_OUTPUT_OPCODE (asm_out_file, p);
-#endif
- break;
-
-#ifdef ASSEMBLER_DIALECT
- case '{':
- /* If we want the first dialect, do nothing. Otherwise, skip
- DIALECT_NUMBER of strings ending with '|'. */
- for (i = 0; i < dialect_number; i++)
- {
- while (*p && *p++ != '|')
- ;
-
- if (*p == '|')
- p++;
- }
- break;
-
- case '|':
- /* Skip to close brace. */
- while (*p && *p++ != '}')
- ;
- break;
-
- case '}':
- break;
-#endif
-
- case '%':
- /* %% outputs a single %. */
- if (*p == '%')
- {
- p++;
- putc (c, asm_out_file);
- }
- /* %= outputs a number which is unique to each insn in the entire
- compilation. This is useful for making local labels that are
- referred to more than once in a given insn. */
- else if (*p == '=')
- {
- p++;
- fprintf (asm_out_file, "%d", insn_counter);
- }
- /* % followed by a letter and some digits
- outputs an operand in a special way depending on the letter.
- Letters `acln' are implemented directly.
- Other letters are passed to `output_operand' so that
- the PRINT_OPERAND macro can define them. */
- else if ((*p >= 'a' && *p <= 'z')
- || (*p >= 'A' && *p <= 'Z'))
- {
- int letter = *p++;
- c = atoi (p);
-
- if (! (*p >= '0' && *p <= '9'))
- output_operand_lossage ("operand number missing after %-letter");
- else if (this_is_asm_operands && c >= (unsigned) insn_noperands)
- output_operand_lossage ("operand number out of range");
- else if (letter == 'l')
- output_asm_label (operands[c]);
- else if (letter == 'a')
- output_address (operands[c]);
- else if (letter == 'c')
- {
- if (CONSTANT_ADDRESS_P (operands[c]))
- output_addr_const (asm_out_file, operands[c]);
- else
- output_operand (operands[c], 'c');
- }
- else if (letter == 'n')
- {
- if (GET_CODE (operands[c]) == CONST_INT)
- fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC,
- - INTVAL (operands[c]));
- else
- {
- putc ('-', asm_out_file);
- output_addr_const (asm_out_file, operands[c]);
- }
- }
- else
- output_operand (operands[c], letter);
-
- while ((c = *p) >= '0' && c <= '9') p++;
- }
- /* % followed by a digit outputs an operand the default way. */
- else if (*p >= '0' && *p <= '9')
- {
- c = atoi (p);
- if (this_is_asm_operands && c >= (unsigned) insn_noperands)
- output_operand_lossage ("operand number out of range");
- else
- output_operand (operands[c], 0);
- while ((c = *p) >= '0' && c <= '9') p++;
- }
- /* % followed by punctuation: output something for that
- punctuation character alone, with no operand.
- The PRINT_OPERAND macro decides what is actually done. */
-#ifdef PRINT_OPERAND_PUNCT_VALID_P
- else if (PRINT_OPERAND_PUNCT_VALID_P (*p))
- output_operand (NULL_RTX, *p++);
-#endif
- else
- output_operand_lossage ("invalid %%-code");
- break;
-
- default:
- putc (c, asm_out_file);
- }
-
- output_asm_name ();
-
- putc ('\n', asm_out_file);
-}
-
-/* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */
-
-void
-output_asm_label (x)
- rtx x;
-{
- char buf[256];
-
- if (GET_CODE (x) == LABEL_REF)
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (XEXP (x, 0)));
- else if (GET_CODE (x) == CODE_LABEL)
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));
- else
- output_operand_lossage ("`%l' operand isn't a label");
-
- assemble_name (asm_out_file, buf);
-}
-
-/* Print operand X using machine-dependent assembler syntax.
- The macro PRINT_OPERAND is defined just to control this function.
- CODE is a non-digit that preceded the operand-number in the % spec,
- such as 'z' if the spec was `%z3'. CODE is 0 if there was no char
- between the % and the digits.
- When CODE is a non-letter, X is 0.
-
- The meanings of the letters are machine-dependent and controlled
- by PRINT_OPERAND. */
-
-static void
-output_operand (x, code)
- rtx x;
- int code;
-{
- if (x && GET_CODE (x) == SUBREG)
- x = alter_subreg (x);
-
- /* If X is a pseudo-register, abort now rather than writing trash to the
- assembler file. */
-
- if (x && GET_CODE (x) == REG && REGNO (x) >= FIRST_PSEUDO_REGISTER)
- abort ();
-
- PRINT_OPERAND (asm_out_file, x, code);
-}
-
-/* Print a memory reference operand for address X
- using machine-dependent assembler syntax.
- The macro PRINT_OPERAND_ADDRESS exists just to control this function. */
-
-void
-output_address (x)
- rtx x;
-{
- walk_alter_subreg (x);
- PRINT_OPERAND_ADDRESS (asm_out_file, x);
-}
-
-/* Print an integer constant expression in assembler syntax.
- Addition and subtraction are the only arithmetic
- that may appear in these expressions. */
-
-void
-output_addr_const (file, x)
- FILE *file;
- rtx x;
-{
- char buf[256];
-
- restart:
- switch (GET_CODE (x))
- {
- case PC:
- if (flag_pic)
- putc ('.', file);
- else
- abort ();
- break;
-
- case SYMBOL_REF:
- assemble_name (file, XSTR (x, 0));
- break;
-
- case LABEL_REF:
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (XEXP (x, 0)));
- assemble_name (file, buf);
- break;
-
- case CODE_LABEL:
- ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x));
- assemble_name (file, buf);
- break;
-
- case CONST_INT:
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
- break;
-
- case CONST:
- /* This used to output parentheses around the expression,
- but that does not work on the 386 (either ATT or BSD assembler). */
- output_addr_const (file, XEXP (x, 0));
- break;
-
- case CONST_DOUBLE:
- if (GET_MODE (x) == VOIDmode)
- {
- /* We can use %d if the number is one word and positive. */
- if (CONST_DOUBLE_HIGH (x))
- fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
- CONST_DOUBLE_HIGH (x), CONST_DOUBLE_LOW (x));
- else if (CONST_DOUBLE_LOW (x) < 0)
- fprintf (file, HOST_WIDE_INT_PRINT_HEX, CONST_DOUBLE_LOW (x));
- else
- fprintf (file, HOST_WIDE_INT_PRINT_DEC, CONST_DOUBLE_LOW (x));
- }
- else
- /* We can't handle floating point constants;
- PRINT_OPERAND must handle them. */
- output_operand_lossage ("floating constant misused");
- break;
-
- case PLUS:
- /* Some assemblers need integer constants to appear last (eg masm). */
- if (GET_CODE (XEXP (x, 0)) == CONST_INT)
- {
- output_addr_const (file, XEXP (x, 1));
- if (INTVAL (XEXP (x, 0)) >= 0)
- fprintf (file, "+");
- output_addr_const (file, XEXP (x, 0));
- }
- else
- {
- output_addr_const (file, XEXP (x, 0));
- if (INTVAL (XEXP (x, 1)) >= 0)
- fprintf (file, "+");
- output_addr_const (file, XEXP (x, 1));
- }
- break;
-
- case MINUS:
- /* Avoid outputting things like x-x or x+5-x,
- since some assemblers can't handle that. */
- x = simplify_subtraction (x);
- if (GET_CODE (x) != MINUS)
- goto restart;
-
- output_addr_const (file, XEXP (x, 0));
- fprintf (file, "-");
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) < 0)
- {
- fprintf (file, ASM_OPEN_PAREN);
- output_addr_const (file, XEXP (x, 1));
- fprintf (file, ASM_CLOSE_PAREN);
- }
- else
- output_addr_const (file, XEXP (x, 1));
- break;
-
- case ZERO_EXTEND:
- case SIGN_EXTEND:
- output_addr_const (file, XEXP (x, 0));
- break;
-
- default:
- output_operand_lossage ("invalid expression as operand");
- }
-}
-
-/* A poor man's fprintf, with the added features of %I, %R, %L, and %U.
- %R prints the value of REGISTER_PREFIX.
- %L prints the value of LOCAL_LABEL_PREFIX.
- %U prints the value of USER_LABEL_PREFIX.
- %I prints the value of IMMEDIATE_PREFIX.
- %O runs ASM_OUTPUT_OPCODE to transform what follows in the string.
- Also supported are %d, %x, %s, %e, %f, %g and %%.
-
- We handle alternate assembler dialects here, just like output_asm_insn. */
-
-void
-asm_fprintf VPROTO((FILE *file, char *p, ...))
-{
-#ifndef __STDC__
- FILE *file;
- char *p;
-#endif
- va_list argptr;
- char buf[10];
- char *q, c;
- int i;
-
- VA_START (argptr, p);
-
-#ifndef __STDC__
- file = va_arg (argptr, FILE *);
- p = va_arg (argptr, char *);
-#endif
-
- buf[0] = '%';
-
- while (c = *p++)
- switch (c)
- {
-#ifdef ASSEMBLER_DIALECT
- case '{':
- /* If we want the first dialect, do nothing. Otherwise, skip
- DIALECT_NUMBER of strings ending with '|'. */
- for (i = 0; i < dialect_number; i++)
- {
- while (*p && *p++ != '|')
- ;
-
- if (*p == '|')
- p++;
- }
- break;
-
- case '|':
- /* Skip to close brace. */
- while (*p && *p++ != '}')
- ;
- break;
-
- case '}':
- break;
-#endif
-
- case '%':
- c = *p++;
- q = &buf[1];
- while ((c >= '0' && c <= '9') || c == '.')
- {
- *q++ = c;
- c = *p++;
- }
- switch (c)
- {
- case '%':
- fprintf (file, "%%");
- break;
-
- case 'd': case 'i': case 'u':
- case 'x': case 'p': case 'X':
- case 'o':
- *q++ = c;
- *q = 0;
- fprintf (file, buf, va_arg (argptr, int));
- break;
-
- case 'w':
- /* This is a prefix to the 'd', 'i', 'u', 'x', 'p', and 'X' cases,
- but we do not check for those cases. It means that the value
- is a HOST_WIDE_INT, which may be either `int' or `long'. */
-
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
-#else
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
- *q++ = 'l';
-#else
- *q++ = 'l';
- *q++ = 'l';
-#endif
-#endif
-
- *q++ = *p++;
- *q = 0;
- fprintf (file, buf, va_arg (argptr, HOST_WIDE_INT));
- break;
-
- case 'l':
- *q++ = c;
- *q++ = *p++;
- *q = 0;
- fprintf (file, buf, va_arg (argptr, long));
- break;
-
- case 'e':
- case 'f':
- case 'g':
- *q++ = c;
- *q = 0;
- fprintf (file, buf, va_arg (argptr, double));
- break;
-
- case 's':
- *q++ = c;
- *q = 0;
- fprintf (file, buf, va_arg (argptr, char *));
- break;
-
- case 'O':
-#ifdef ASM_OUTPUT_OPCODE
- ASM_OUTPUT_OPCODE (asm_out_file, p);
-#endif
- break;
-
- case 'R':
-#ifdef REGISTER_PREFIX
- fprintf (file, "%s", REGISTER_PREFIX);
-#endif
- break;
-
- case 'I':
-#ifdef IMMEDIATE_PREFIX
- fprintf (file, "%s", IMMEDIATE_PREFIX);
-#endif
- break;
-
- case 'L':
-#ifdef LOCAL_LABEL_PREFIX
- fprintf (file, "%s", LOCAL_LABEL_PREFIX);
-#endif
- break;
-
- case 'U':
-#ifdef USER_LABEL_PREFIX
- fprintf (file, "%s", USER_LABEL_PREFIX);
-#endif
- break;
-
- default:
- abort ();
- }
- break;
-
- default:
- fputc (c, file);
- }
-}
-
-/* Split up a CONST_DOUBLE or integer constant rtx
- into two rtx's for single words,
- storing in *FIRST the word that comes first in memory in the target
- and in *SECOND the other. */
-
-void
-split_double (value, first, second)
- rtx value;
- rtx *first, *second;
-{
- if (GET_CODE (value) == CONST_INT)
- {
- if (HOST_BITS_PER_WIDE_INT >= (2 * BITS_PER_WORD))
- {
- /* In this case the CONST_INT holds both target words.
- Extract the bits from it into two word-sized pieces. */
- rtx low, high;
- HOST_WIDE_INT word_mask;
- /* Avoid warnings for shift count >= BITS_PER_WORD. */
- int shift_count = BITS_PER_WORD - 1;
-
- word_mask = (HOST_WIDE_INT) 1 << shift_count;
- word_mask |= word_mask - 1;
- low = GEN_INT (INTVAL (value) & word_mask);
- high = GEN_INT ((INTVAL (value) >> (shift_count + 1)) & word_mask);
- if (WORDS_BIG_ENDIAN)
- {
- *first = high;
- *second = low;
- }
- else
- {
- *first = low;
- *second = high;
- }
- }
- else
- {
- /* The rule for using CONST_INT for a wider mode
- is that we regard the value as signed.
- So sign-extend it. */
- rtx high = (INTVAL (value) < 0 ? constm1_rtx : const0_rtx);
- if (WORDS_BIG_ENDIAN)
- {
- *first = high;
- *second = value;
- }
- else
- {
- *first = value;
- *second = high;
- }
- }
- }
- else if (GET_CODE (value) != CONST_DOUBLE)
- {
- if (WORDS_BIG_ENDIAN)
- {
- *first = const0_rtx;
- *second = value;
- }
- else
- {
- *first = value;
- *second = const0_rtx;
- }
- }
- else if (GET_MODE (value) == VOIDmode
- /* This is the old way we did CONST_DOUBLE integers. */
- || GET_MODE_CLASS (GET_MODE (value)) == MODE_INT)
- {
- /* In an integer, the words are defined as most and least significant.
- So order them by the target's convention. */
- if (WORDS_BIG_ENDIAN)
- {
- *first = GEN_INT (CONST_DOUBLE_HIGH (value));
- *second = GEN_INT (CONST_DOUBLE_LOW (value));
- }
- else
- {
- *first = GEN_INT (CONST_DOUBLE_LOW (value));
- *second = GEN_INT (CONST_DOUBLE_HIGH (value));
- }
- }
- else
- {
-#ifdef REAL_ARITHMETIC
- REAL_VALUE_TYPE r; long l[2];
- REAL_VALUE_FROM_CONST_DOUBLE (r, value);
-
- /* Note, this converts the REAL_VALUE_TYPE to the target's
- format, splits up the floating point double and outputs
- exactly 32 bits of it into each of l[0] and l[1] --
- not necessarily BITS_PER_WORD bits. */
- REAL_VALUE_TO_TARGET_DOUBLE (r, l);
-
- *first = GEN_INT ((HOST_WIDE_INT) l[0]);
- *second = GEN_INT ((HOST_WIDE_INT) l[1]);
-#else
- if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
- || HOST_BITS_PER_WIDE_INT != BITS_PER_WORD)
- && ! flag_pretend_float)
- abort ();
-
- if (
-#ifdef HOST_WORDS_BIG_ENDIAN
- WORDS_BIG_ENDIAN
-#else
- ! WORDS_BIG_ENDIAN
-#endif
- )
- {
- /* Host and target agree => no need to swap. */
- *first = GEN_INT (CONST_DOUBLE_LOW (value));
- *second = GEN_INT (CONST_DOUBLE_HIGH (value));
- }
- else
- {
- *second = GEN_INT (CONST_DOUBLE_LOW (value));
- *first = GEN_INT (CONST_DOUBLE_HIGH (value));
- }
-#endif /* no REAL_ARITHMETIC */
- }
-}
-
-/* Return nonzero if this function has no function calls. */
-
-int
-leaf_function_p ()
-{
- rtx insn;
-
- if (profile_flag || profile_block_flag || profile_arc_flag)
- return 0;
-
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CALL_INSN)
- return 0;
- if (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SEQUENCE
- && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == CALL_INSN)
- return 0;
- }
- for (insn = current_function_epilogue_delay_list; insn; insn = XEXP (insn, 1))
- {
- if (GET_CODE (XEXP (insn, 0)) == CALL_INSN)
- return 0;
- if (GET_CODE (XEXP (insn, 0)) == INSN
- && GET_CODE (PATTERN (XEXP (insn, 0))) == SEQUENCE
- && GET_CODE (XVECEXP (PATTERN (XEXP (insn, 0)), 0, 0)) == CALL_INSN)
- return 0;
- }
-
- return 1;
-}
-
-/* On some machines, a function with no call insns
- can run faster if it doesn't create its own register window.
- When output, the leaf function should use only the "output"
- registers. Ordinarily, the function would be compiled to use
- the "input" registers to find its arguments; it is a candidate
- for leaf treatment if it uses only the "input" registers.
- Leaf function treatment means renumbering so the function
- uses the "output" registers instead. */
-
-#ifdef LEAF_REGISTERS
-
-static char permitted_reg_in_leaf_functions[] = LEAF_REGISTERS;
-
-/* Return 1 if this function uses only the registers that can be
- safely renumbered. */
-
-int
-only_leaf_regs_used ()
-{
- int i;
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if ((regs_ever_live[i] || global_regs[i])
- && ! permitted_reg_in_leaf_functions[i])
- return 0;
- }
- return 1;
-}
-
-/* Scan all instructions and renumber all registers into those
- available in leaf functions. */
-
-static void
-leaf_renumber_regs (first)
- rtx first;
-{
- rtx insn;
-
- /* Renumber only the actual patterns.
- The reg-notes can contain frame pointer refs,
- and renumbering them could crash, and should not be needed. */
- for (insn = first; insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- leaf_renumber_regs_insn (PATTERN (insn));
- for (insn = current_function_epilogue_delay_list; insn; insn = XEXP (insn, 1))
- if (GET_RTX_CLASS (GET_CODE (XEXP (insn, 0))) == 'i')
- leaf_renumber_regs_insn (PATTERN (XEXP (insn, 0)));
-}
-
-/* Scan IN_RTX and its subexpressions, and renumber all regs into those
- available in leaf functions. */
-
-void
-leaf_renumber_regs_insn (in_rtx)
- register rtx in_rtx;
-{
- register int i, j;
- register char *format_ptr;
-
- if (in_rtx == 0)
- return;
-
- /* Renumber all input-registers into output-registers.
- renumbered_regs would be 1 for an output-register;
- they */
-
- if (GET_CODE (in_rtx) == REG)
- {
- int newreg;
-
- /* Don't renumber the same reg twice. */
- if (in_rtx->used)
- return;
-
- newreg = REGNO (in_rtx);
- /* Don't try to renumber pseudo regs. It is possible for a pseudo reg
- to reach here as part of a REG_NOTE. */
- if (newreg >= FIRST_PSEUDO_REGISTER)
- {
- in_rtx->used = 1;
- return;
- }
- newreg = LEAF_REG_REMAP (newreg);
- if (newreg < 0)
- abort ();
- regs_ever_live[REGNO (in_rtx)] = 0;
- regs_ever_live[newreg] = 1;
- REGNO (in_rtx) = newreg;
- in_rtx->used = 1;
- }
-
- if (GET_RTX_CLASS (GET_CODE (in_rtx)) == 'i')
- {
- /* Inside a SEQUENCE, we find insns.
- Renumber just the patterns of these insns,
- just as we do for the top-level insns. */
- leaf_renumber_regs_insn (PATTERN (in_rtx));
- return;
- }
-
- format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (in_rtx)); i++)
- switch (*format_ptr++)
- {
- case 'e':
- leaf_renumber_regs_insn (XEXP (in_rtx, i));
- break;
-
- case 'E':
- if (NULL != XVEC (in_rtx, i))
- {
- for (j = 0; j < XVECLEN (in_rtx, i); j++)
- leaf_renumber_regs_insn (XVECEXP (in_rtx, i, j));
- }
- break;
-
- case 'S':
- case 's':
- case '0':
- case 'i':
- case 'w':
- case 'n':
- case 'u':
- break;
-
- default:
- abort ();
- }
-}
-#endif
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
deleted file mode 100644
index f059952587b..00000000000
--- a/gcc/fix-header.c
+++ /dev/null
@@ -1,1356 +0,0 @@
-/* fix-header.c - Make C header file suitable for C++.
- Copyright (C) 1993, 1994, 1995, 1996 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, 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 program massages a system include file (such as stdio.h),
- into a form more conforming with ANSI/POSIX, and more suitable for C++:
-
- * extern "C" { ... } braces are added (inside #ifndef __cplusplus),
- if they seem to be needed. These prevent C++ compilers from name
- mangling the functions inside the braces.
-
- * If an old-style incomplete function declaration is seen (without
- an argument list), and it is a "standard" function listed in
- the file sys-protos.h (and with a non-empty argument list), then
- the declaration is converted to a complete prototype by replacing
- the empty parameter list with the argument lust from sys-protos.h.
-
- * The program can be given a list of (names of) required standard
- functions (such as fclose for stdio.h). If a required function
- is not seen in the input, then a prototype for it will be
- written to the output.
-
- * If all of the non-comment code of the original file is protected
- against multiple inclusion:
- #ifndef FOO
- #define FOO
- <body of include file>
- #endif
- then extra matter added to the include file is placed inside the <body>.
-
- * If the input file is OK (nothing needs to be done);
- the output file is not written (nor removed if it exists).
-
- There are also some special actions that are done for certain
- well-known standard include files:
-
- * If argv[1] is "sys/stat.h", the Posix.1 macros
- S_ISBLK, S_ISCHR, S_ISDIR, S_ISFIFO, S_ISLNK, S_ISREG are added if
- they were missing, and the corresponding "traditional" S_IFxxx
- macros were defined.
-
- * If argv[1] is "errno.h", errno is declared if it was missing.
-
- * TODO: The input file should be read complete into memory, because:
- a) it needs to be scanned twice anyway, and
- b) it would be nice to allow update in place.
-
- Usage:
- fix-header FOO.H INFILE.H OUTFILE.H [OPTIONS]
- where:
- * FOO.H is the relative file name of the include file,
- as it would be #include'd by a C file. (E.g. stdio.h)
- * INFILE.H is a full pathname for the input file (e.g. /usr/include/stdio.h)
- * OUTFILE.H is the full pathname for where to write the output file,
- if anything needs to be done. (e.g. ./include/stdio.h)
- * OPTIONS are such as you would pass to cpp.
-
- Written by Per Bothner <bothner@cygnus.com>, July 1993. */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "hconfig.h"
-#include "obstack.h"
-#include "scan.h"
-#include "cpplib.h"
-#include "gansidecl.h"
-
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-
-extern void cpp_fatal ();
-
-#if !__STDC__ && !defined(const)
-#define const /* nothing */
-#endif
-
-sstring buf;
-
-int verbose = 0;
-int partial_count = 0;
-int warnings = 0;
-
-/* We no longer need to add extern "C", because cpp implicitly
- forces the standard include files to be treated as C. */
-/*#define ADD_MISSING_EXTERN_C 1 */
-
-#if ADD_MISSING_EXTERN_C
-int missing_extern_C_count = 0;
-#endif
-
-#include "xsys-protos.h"
-
-#ifdef FIXPROTO_IGNORE_LIST
-/* This is a currently unused feature. */
-
-/* List of files and directories to ignore.
- A directory name (ending in '/') means ignore anything in that
- directory. (It might be more efficient to do directory pruning
- earlier in fixproto, but this is simpler and easier to customize.) */
-
-static char *files_to_ignore[] = {
- "X11/",
- FIXPROTO_IGNORE_LIST
- 0
-};
-#endif
-
-char *inf_buffer;
-char *inf_limit;
-char *inf_ptr;
-
-/* Certain standard files get extra treatment */
-
-enum special_file
-{
- no_special,
- errno_h,
- stdio_h,
- stdlib_h,
- sys_stat_h
-};
-
-/* A NAMELIST is a sequence of names, separated by '\0', and terminated
- by an empty name (i.e. by "\0\0"). */
-
-typedef const char *namelist;
-
-/* The following macros provide the bits for symbol_flags. */
-typedef int symbol_flags;
-
-/* Used to mark names defined in the ANSI/ISO C standard. */
-#define ANSI_SYMBOL 1
-
-/* Used to mark names defined in the Posix.1 or Posix.2 standard. */
-#define POSIX1_SYMBOL 2
-#define POSIX2_SYMBOL 4
-
-/* Used to mark names defined in X/Open Portability Guide. */
-#define XOPEN_SYMBOL 8
-/* Used to mark names defined in X/Open UNIX Extensions. */
-#define XOPEN_EXTENDED_SYMBOL 16
-
-/* Used to indicate names that are not functions */
-#define MACRO_SYMBOL 512
-
-struct symbol_list {
- symbol_flags flags;
- namelist names;
-};
-
-#define SYMBOL_TABLE_SIZE 10
-struct symbol_list symbol_table[SYMBOL_TABLE_SIZE];
-int cur_symbol_table_size;
-
-void
-add_symbols (flags, names)
- symbol_flags flags;
- namelist names;
-{
- symbol_table[cur_symbol_table_size].flags = flags;
- symbol_table[cur_symbol_table_size].names = names;
- cur_symbol_table_size++;
- if (cur_symbol_table_size >= SYMBOL_TABLE_SIZE)
- fatal ("too many calls to add_symbols");
- symbol_table[cur_symbol_table_size].names = NULL; /* Termination. */
-}
-
-struct std_include_entry {
- const char *name;
- symbol_flags flags;
- namelist names;
-};
-
-const char NONE[] = ""; /* The empty namelist. */
-
-/* Special name to indicate a continuation line in std_include_table. */
-const char CONTINUED[] = "";
-
-struct std_include_entry *include_entry;
-
-struct std_include_entry std_include_table [] = {
- { "ctype.h", ANSI_SYMBOL,
- "isalnum\0isalpha\0iscntrl\0isdigit\0isgraph\0islower\0\
-isprint\0ispunct\0isspace\0isupper\0isxdigit\0tolower\0toupper\0" },
-
- { "dirent.h", POSIX1_SYMBOL, "closedir\0opendir\0readdir\0rewinddir\0"},
-
- { "errno.h", ANSI_SYMBOL|MACRO_SYMBOL, "errno\0" },
-
- /* ANSI_SYMBOL is wrong, but ... */
- { "curses.h", ANSI_SYMBOL, "box\0delwin\0endwin\0getcurx\0getcury\0initscr\0\
-mvcur\0mvwprintw\0mvwscanw\0newwin\0overlay\0overwrite\0\
-scroll\0subwin\0touchwin\0waddstr\0wclear\0wclrtobot\0wclrtoeol\0\
-waddch\0wdelch\0wdeleteln\0werase\0wgetch\0wgetstr\0winsch\0winsertln\0\
-wmove\0wprintw\0wrefresh\0wscanw\0wstandend\0wstandout\0" },
-
- { "fcntl.h", POSIX1_SYMBOL, "creat\0fcntl\0open\0" },
-
- /* Maybe also "getgrent fgetgrent setgrent endgrent" */
- { "grp.h", POSIX1_SYMBOL, "getgrgid\0getgrnam\0" },
-
-/*{ "limit.h", ... provided by gcc }, */
-
- { "locale.h", ANSI_SYMBOL, "localeconv\0setlocale\0" },
-
- { "math.h", ANSI_SYMBOL,
- "acos\0asin\0atan\0atan2\0ceil\0cos\0cosh\0exp\0\
-fabs\0floor\0fmod\0frexp\0ldexp\0log10\0log\0modf\0pow\0sin\0sinh\0sqrt\0\
-tan\0tanh\0" },
-
- { CONTINUED, ANSI_SYMBOL|MACRO_SYMBOL, "HUGE_VAL\0" },
-
- { "pwd.h", POSIX1_SYMBOL, "getpwnam\0getpwuid\0" },
-
- /* Left out siglongjmp sigsetjmp - these depend on sigjmp_buf. */
- { "setjmp.h", ANSI_SYMBOL, "longjmp\0setjmp\0" },
-
- /* Left out signal() - its prototype is too complex for us!
- Also left out "sigaction sigaddset sigdelset sigemptyset
- sigfillset sigismember sigpending sigprocmask sigsuspend"
- because these need sigset_t or struct sigaction.
- Most systems that provide them will also declare them. */
- { "signal.h", ANSI_SYMBOL, "kill\0raise\0" },
-
- { "stdio.h", ANSI_SYMBOL,
- "clearerr\0fclose\0feof\0ferror\0fflush\0fgetc\0fgetpos\0\
-fgets\0fopen\0fprintf\0fputc\0fputs\0fread\0freopen\0fscanf\0fseek\0\
-fsetpos\0ftell\0fwrite\0getc\0getchar\0gets\00perror\0popen\0\
-printf\0putc\0putchar\0puts\0remove\0rename\0rewind\0scanf\0setbuf\0\
-setvbuf\0sprintf\0sscanf\0vprintf\0vsprintf\0vfprintf\0tmpfile\0\
-tmpnam\0ungetc\0" },
- { CONTINUED, POSIX1_SYMBOL, "fdopen\0fileno\0" },
- { CONTINUED, POSIX2_SYMBOL, "pclose\0popen\0" }, /* I think ... */
-/* Should perhaps also handle NULL, EOF, ... ? */
-
- /* "div ldiv", - ignored because these depend on div_t, ldiv_t
- ignore these: "mblen mbstowcs mbstowc wcstombs wctomb"
- Left out getgroups, because SunOS4 has incompatible BSD and SVR4 versions.
- Should perhaps also add NULL */
- { "stdlib.h", ANSI_SYMBOL,
- "abort\0abs\0atexit\0atof\0atoi\0atol\0bsearch\0calloc\0\
-exit\0free\0getenv\0labs\0malloc\0putenv\0qsort\0rand\0realloc\0\
-srand\0strtod\0strtol\0strtoul\0system\0" },
- { CONTINUED, ANSI_SYMBOL|MACRO_SYMBOL, "EXIT_FAILURE\0EXIT_SUCCESS\0" },
-
- { "string.h", ANSI_SYMBOL, "memchr\0memcmp\0memcpy\0memmove\0memset\0\
-strcat\0strchr\0strcmp\0strcoll\0strcpy\0strcspn\0strerror\0\
-strlen\0strncat\0strncmp\0strncpy\0strpbrk\0strrchr\0strspn\0strstr\0\
-strtok\0strxfrm\0" },
-/* Should perhaps also add NULL and size_t */
-
- { "strings.h", XOPEN_EXTENDED_SYMBOL,
- "bcmp\0bcopy\0bzero\0ffs\0index\0rindex\0strcasecmp\0strncasecmp\0" },
-
- { "strops.h", XOPEN_EXTENDED_SYMBOL, "ioctl\0" },
-
- /* Actually, XPG4 does not seem to have <sys/ioctl.h>, but defines
- ioctl in <strops.h>. However, many systems have it is sys/ioctl.h,
- and many systems do have <sys/ioctl.h> but not <strops.h>. */
- { "sys/ioctl.h", XOPEN_EXTENDED_SYMBOL, "ioctl\0" },
-
- { "sys/socket.h", XOPEN_EXTENDED_SYMBOL, "socket\0" },
-
- { "sys/stat.h", POSIX1_SYMBOL,
- "chmod\0fstat\0mkdir\0mkfifo\0stat\0lstat\0umask\0" },
- { CONTINUED, POSIX1_SYMBOL|MACRO_SYMBOL,
- "S_ISDIR\0S_ISBLK\0S_ISCHR\0S_ISFIFO\0S_ISREG\0S_ISLNK\0S_IFDIR\0\
-S_IFBLK\0S_IFCHR\0S_IFIFO\0S_IFREG\0S_IFLNK\0" },
- { CONTINUED, XOPEN_EXTENDED_SYMBOL, "fchmod\0" },
-
-#if 0
-/* How do we handle fd_set? */
- { "sys/time.h", XOPEN_EXTENDED_SYMBOL, "select\0" },
- { "sys/select.h", XOPEN_EXTENDED_SYMBOL /* fake */, "select\0" },
-#endif
-
- { "sys/times.h", POSIX1_SYMBOL, "times\0" },
- /* "sys/types.h" add types (not in old g++-include) */
-
- { "sys/utsname.h", POSIX1_SYMBOL, "uname\0" },
-
- { "sys/wait.h", POSIX1_SYMBOL, "wait\0waitpid\0" },
- { CONTINUED, POSIX1_SYMBOL|MACRO_SYMBOL,
- "WEXITSTATUS\0WIFEXITED\0WIFSIGNALED\0WIFSTOPPED\0WSTOPSIG\0\
-WTERMSIG\0WNOHANG\0WNOTRACED\0" },
-
- { "tar.h", POSIX1_SYMBOL, NONE },
-
- { "termios.h", POSIX1_SYMBOL,
- "cfgetispeed\0cfgetospeed\0cfsetispeed\0cfsetospeed\0tcdrain\0tcflow\0tcflush\0tcgetattr\0tcsendbreak\0tcsetattr\0" },
-
- { "time.h", ANSI_SYMBOL,
- "asctime\0clock\0ctime\0difftime\0gmtime\0localtime\0mktime\0strftime\0time\0tzset\0" },
-
- { "unistd.h", POSIX1_SYMBOL,
- "_exit\0access\0alarm\0chdir\0chown\0close\0ctermid\0cuserid\0\
-dup\0dup2\0execl\0execle\0execlp\0execv\0execve\0execvp\0fork\0fpathconf\0\
-getcwd\0getegid\0geteuid\0getgid\0getlogin\0getpgrp\0getpid\0\
-getppid\0getuid\0isatty\0link\0lseek\0pathconf\0pause\0pipe\0read\0rmdir\0\
-setgid\0setpgid\0setsid\0setuid\0sleep\0sysconf\0tcgetpgrp\0tcsetpgrp\0\
-ttyname\0unlink\0write\0" },
- { CONTINUED, POSIX2_SYMBOL, "getopt\0" },
- { CONTINUED, XOPEN_EXTENDED_SYMBOL,
- "lockf\0gethostid\0gethostname\0readlink\0" },
-
- { "utime.h", POSIX1_SYMBOL, "utime\0" },
-
- { NULL, 0, NONE }
-};
-
-enum special_file special_file_handling = no_special;
-
-/* They are set if the corresponding macro has been seen. */
-/* The following are only used when handling sys/stat.h */
-int seen_S_IFBLK = 0, seen_S_ISBLK = 0;
-int seen_S_IFCHR = 0, seen_S_ISCHR = 0;
-int seen_S_IFDIR = 0, seen_S_ISDIR = 0;
-int seen_S_IFIFO = 0, seen_S_ISFIFO = 0;
-int seen_S_IFLNK = 0, seen_S_ISLNK = 0;
-int seen_S_IFREG = 0, seen_S_ISREG = 0;
-/* The following are only used when handling errno.h */
-int seen_errno = 0;
-/* The following are only used when handling stdlib.h */
-int seen_EXIT_FAILURE = 0, seen_EXIT_SUCCESS = 0;
-
-/* Wrapper around free, to avoid prototype clashes. */
-
-void
-xfree (ptr)
- char *ptr;
-{
- free (ptr);
-}
-
-/* Avoid error if config defines abort as fancy_abort.
- It's not worth "really" implementing this because ordinary
- compiler users never run fix-header. */
-
-void
-fancy_abort ()
-{
- abort ();
-}
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free xfree
-struct obstack scan_file_obstack;
-
-/* NOTE: If you edit this, also edit gen-protos.c !! */
-
-struct fn_decl *
-lookup_std_proto (name, name_length)
- const char *name;
- int name_length;
-{
- int i = hashf (name, name_length, HASH_SIZE);
- int i0 = i;
- for (;;)
- {
- struct fn_decl *fn;
- if (hash_tab[i] == 0)
- return NULL;
- fn = &std_protos[hash_tab[i]];
- if (strlen (fn->fname) == name_length
- && strncmp (fn->fname, name, name_length) == 0)
- return fn;
- i = (i+1) % HASH_SIZE;
- if (i == i0)
- abort ();
- }
-}
-
-char *inc_filename;
-int inc_filename_length;
-char *progname = "fix-header";
-FILE *outf;
-sstring line;
-
-int lbrac_line, rbrac_line;
-
-int required_unseen_count = 0;
-int required_other = 0;
-
-void
-write_lbrac ()
-{
-
-#if ADD_MISSING_EXTERN_C
- if (missing_extern_C_count + required_unseen_count > 0)
- fprintf (outf, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
-#endif
-
- if (partial_count)
- {
- fprintf (outf, "#ifndef _PARAMS\n");
- fprintf (outf, "#if defined(__STDC__) || defined(__cplusplus)\n");
- fprintf (outf, "#define _PARAMS(ARGS) ARGS\n");
- fprintf (outf, "#else\n");
- fprintf (outf, "#define _PARAMS(ARGS) ()\n");
- fprintf (outf, "#endif\n#endif /* _PARAMS */\n");
- }
-}
-
-struct partial_proto
-{
- struct partial_proto *next;
- char *fname; /* name of function */
- char *rtype; /* return type */
- struct fn_decl *fn;
- int line_seen;
-};
-
-struct partial_proto *partial_proto_list = NULL;
-
-struct partial_proto required_dummy_proto, seen_dummy_proto;
-#define REQUIRED(FN) ((FN)->partial == &required_dummy_proto)
-#define SET_REQUIRED(FN) ((FN)->partial = &required_dummy_proto)
-#define SET_SEEN(FN) ((FN)->partial = &seen_dummy_proto)
-#define SEEN(FN) ((FN)->partial == &seen_dummy_proto)
-
-void
-recognized_macro (fname)
- char *fname;
-{
- /* The original include file defines fname as a macro. */
- struct fn_decl *fn = lookup_std_proto (fname, strlen (fname));
-
- /* Since fname is a macro, don't require a prototype for it. */
- if (fn)
- {
- if (REQUIRED (fn))
- required_unseen_count--;
- SET_SEEN (fn);
- }
-
- switch (special_file_handling)
- {
- case errno_h:
- if (strcmp (fname, "errno") == 0 && !seen_errno)
- seen_errno = 1, required_other--;
- break;
- case stdlib_h:
- if (strcmp (fname, "EXIT_FAILURE") == 0 && !seen_EXIT_FAILURE)
- seen_EXIT_FAILURE = 1, required_other--;
- if (strcmp (fname, "EXIT_SUCCESS") == 0 && !seen_EXIT_SUCCESS)
- seen_EXIT_SUCCESS = 1, required_other--;
- break;
- case sys_stat_h:
- if (fname[0] == 'S' && fname[1] == '_')
- {
- if (strcmp (fname, "S_IFBLK") == 0) seen_S_IFBLK++;
- else if (strcmp (fname, "S_ISBLK") == 0) seen_S_ISBLK++;
- else if (strcmp (fname, "S_IFCHR") == 0) seen_S_IFCHR++;
- else if (strcmp (fname, "S_ISCHR") == 0) seen_S_ISCHR++;
- else if (strcmp (fname, "S_IFDIR") == 0) seen_S_IFDIR++;
- else if (strcmp (fname, "S_ISDIR") == 0) seen_S_ISDIR++;
- else if (strcmp (fname, "S_IFIFO") == 0) seen_S_IFIFO++;
- else if (strcmp (fname, "S_ISFIFO") == 0) seen_S_ISFIFO++;
- else if (strcmp (fname, "S_IFLNK") == 0) seen_S_IFLNK++;
- else if (strcmp (fname, "S_ISLNK") == 0) seen_S_ISLNK++;
- else if (strcmp (fname, "S_IFREG") == 0) seen_S_IFREG++;
- else if (strcmp (fname, "S_ISREG") == 0) seen_S_ISREG++;
- }
- }
-}
-
-void
-recognized_extern (name, name_length, type, type_length)
- char *name;
- char *type;
- int name_length, type_length;
-{
- switch (special_file_handling)
- {
- case errno_h:
- if (strcmp (name, "errno") == 0 && !seen_errno)
- seen_errno = 1, required_other--;
- break;
- }
-}
-
-/* Called by scan_decls if it saw a function definition for a function
- named FNAME, with return type RTYPE, and argument list ARGS,
- in source file FILE_SEEN on line LINE_SEEN.
- KIND is 'I' for an inline function;
- 'F' if a normal function declaration preceded by 'extern "C"'
- (or nested inside 'extern "C"' braces); or
- 'f' for other function declarations. */
-
-void
-recognized_function (fname, fname_length,
- kind, rtype, rtype_length,
- have_arg_list, file_seen, line_seen)
- char *fname;
- int fname_length;
- int kind; /* One of 'f' 'F' or 'I' */
- char *rtype;
- int rtype_length;
- int have_arg_list;
- char *file_seen;
- int line_seen;
-{
- struct partial_proto *partial;
- int i;
- struct fn_decl *fn;
-#if ADD_MISSING_EXTERN_C
- if (kind == 'f')
- missing_extern_C_count++;
-#endif
-
- fn = lookup_std_proto (fname, fname_length);
-
- /* Remove the function from the list of required function. */
- if (fn)
- {
- if (REQUIRED (fn))
- required_unseen_count--;
- SET_SEEN (fn);
- }
-
- /* If we have a full prototype, we're done. */
- if (have_arg_list)
- return;
-
- if (kind == 'I') /* don't edit inline function */
- return;
-
- /* If the partial prototype was included from some other file,
- we don't need to patch it up (in this run). */
- i = strlen (file_seen);
- if (i < inc_filename_length
- || strcmp (inc_filename, file_seen + (i - inc_filename_length)) != 0)
- return;
-
- if (fn == NULL)
- return;
- if (fn->params[0] == '\0' || strcmp (fn->params, "void") == 0)
- return;
-
- /* We only have a partial function declaration,
- so remember that we have to add a complete prototype. */
- partial_count++;
- partial = (struct partial_proto *)
- obstack_alloc (&scan_file_obstack, sizeof (struct partial_proto));
- partial->fname = obstack_alloc (&scan_file_obstack, fname_length + 1);
- bcopy (fname, partial->fname, fname_length);
- partial->fname[fname_length] = 0;
- partial->rtype = obstack_alloc (&scan_file_obstack, rtype_length + 1);
- sprintf (partial->rtype, "%.*s", rtype_length, rtype);
- partial->line_seen = line_seen;
- partial->fn = fn;
- fn->partial = partial;
- partial->next = partial_proto_list;
- partial_proto_list = partial;
- if (verbose)
- {
- fprintf (stderr, "(%s: %s non-prototype function declaration.)\n",
- inc_filename, partial->fname);
- }
-}
-
-/* For any name in NAMES that is defined as a macro,
- call recognized_macro on it. */
-
-void
-check_macro_names (pfile, names)
- cpp_reader *pfile;
- namelist names;
-{
- while (*names)
- {
- if (cpp_lookup (pfile, names, -1, -1))
- recognized_macro (names);
- names += strlen (names) + 1;
- }
-}
-
-void
-read_scan_file (in_fname, argc, argv)
- char *in_fname;
- int argc;
- char **argv;
-{
- cpp_reader scan_in;
- cpp_options scan_options;
- struct fn_decl *fn;
- int i;
- register struct symbol_list *cur_symbols;
-
- obstack_init (&scan_file_obstack);
-
- cpp_reader_init (&scan_in);
- scan_in.data = &scan_options;
- cpp_options_init (&scan_options);
- i = cpp_handle_options (&scan_in, argc, argv);
- if (i < argc && ! CPP_FATAL_ERRORS (&scan_in))
- cpp_fatal (&scan_in, "Invalid option `%s'", argv[i]);
- if (CPP_FATAL_ERRORS (&scan_in))
- exit (FATAL_EXIT_CODE);
-
- if (! cpp_start_read (&scan_in, in_fname))
- exit (FATAL_EXIT_CODE);
- CPP_OPTIONS (&scan_in)->no_line_commands = 1;
-
- scan_decls (&scan_in, argc, argv);
- for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)
- check_macro_names (&scan_in, cur_symbols->names);
-
- if (verbose && (scan_in.errors + warnings) > 0)
- fprintf (stderr, "(%s: %d errors and %d warnings from cpp)\n",
- inc_filename, scan_in.errors, warnings);
- if (scan_in.errors)
- exit (0);
-
- /* Traditionally, getc and putc are defined in terms of _filbuf and _flsbuf.
- If so, those functions are also required. */
- if (special_file_handling == stdio_h
- && (fn = lookup_std_proto ("_filbuf", 7)) != NULL)
- {
- static char getchar_call[] = "getchar();";
- cpp_buffer *buf =
- cpp_push_buffer (&scan_in, getchar_call, sizeof(getchar_call) - 1);
- int old_written = CPP_WRITTEN (&scan_in);
- int seen_filbuf = 0;
-
- /* Scan the macro expansion of "getchar();". */
- for (;;)
- {
- enum cpp_token token = cpp_get_token (&scan_in);
- int length = CPP_WRITTEN (&scan_in) - old_written;
- CPP_SET_WRITTEN (&scan_in, old_written);
- if (token == CPP_EOF) /* Should not happen ... */
- break;
- if (token == CPP_POP && CPP_BUFFER (&scan_in) == buf)
- {
- cpp_pop_buffer (&scan_in);
- break;
- }
- if (token == CPP_NAME && length == 7
- && strcmp ("_filbuf", scan_in.token_buffer + old_written) == 0)
- seen_filbuf++;
- }
- if (seen_filbuf)
- {
- int need_filbuf = !SEEN (fn) && !REQUIRED (fn);
- struct fn_decl *flsbuf_fn = lookup_std_proto ("_flsbuf", 7);
- int need_flsbuf
- = flsbuf_fn && !SEEN (flsbuf_fn) && !REQUIRED (flsbuf_fn);
-
- /* Append "_filbuf" and/or "_flsbuf" to the required functions. */
- if (need_filbuf + need_flsbuf)
- {
- char *new_list;
- if (need_filbuf)
- SET_REQUIRED (fn);
- if (need_flsbuf)
- SET_REQUIRED (flsbuf_fn);
- if (need_flsbuf + need_filbuf == 2)
- new_list = "_filbuf\0_flsbuf\0";
- else if (need_flsbuf)
- new_list = "_flsbuf\0";
- else /* if (need_flsbuf) */
- new_list = "_filbuf\0";
- add_symbols (ANSI_SYMBOL, new_list);
- required_unseen_count += need_filbuf + need_flsbuf;
- }
- }
- }
-
- if (required_unseen_count + partial_count + required_other
-#if ADD_MISSING_EXTERN_C
- + missing_extern_C_count
-#endif
- == 0)
- {
- if (verbose)
- fprintf (stderr, "%s: OK, nothing needs to be done.\n", inc_filename);
- exit (0);
- }
- if (!verbose)
- fprintf (stderr, "%s: fixing %s\n", progname, inc_filename);
- else
- {
- if (required_unseen_count)
- fprintf (stderr, "%s: %d missing function declarations.\n",
- inc_filename, required_unseen_count);
- if (partial_count)
- fprintf (stderr, "%s: %d non-prototype function declarations.\n",
- inc_filename, partial_count);
-#if ADD_MISSING_EXTERN_C
- if (missing_extern_C_count)
- fprintf (stderr,
- "%s: %d declarations not protected by extern \"C\".\n",
- inc_filename, missing_extern_C_count);
-#endif
- }
-}
-
-void
-write_rbrac ()
-{
- struct fn_decl *fn;
- const char *cptr;
- register struct symbol_list *cur_symbols;
-
- if (required_unseen_count)
- {
-#ifdef NO_IMPLICIT_EXTERN_C
- fprintf (outf, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
-#endif
- }
-
- /* Now we print out prototypes for those functions that we haven't seen. */
- for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)
- {
- int if_was_emitted = 0;
- int name_len;
- cptr = cur_symbols->names;
- for ( ; (name_len = strlen (cptr)) != 0; cptr+= name_len + 1)
- {
- int macro_protect = 0;
-
- if (cur_symbols->flags & MACRO_SYMBOL)
- continue;
-
- fn = lookup_std_proto (cptr, name_len);
- if (fn == NULL || !REQUIRED (fn))
- continue;
-
- if (!if_was_emitted)
- {
-/* what about curses. ??? or _flsbuf/_filbuf ??? */
- if (cur_symbols->flags & ANSI_SYMBOL)
- fprintf (outf,
- "#if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || defined (__STRICT_ANSI__)\n");
- else if (cur_symbols->flags & (POSIX1_SYMBOL|POSIX2_SYMBOL))
- fprintf (outf,
- "#if defined(__USE_FIXED_PROTOTYPES__) || (defined(__cplusplus) \\\n\
- ? (!defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)) \\\n\
- : (defined(__STRICT_ANSI__) && defined(_POSIX_SOURCE)))\n");
- else if (cur_symbols->flags & XOPEN_SYMBOL)
- {
- fprintf (outf,
- "#if defined(__USE_FIXED_PROTOTYPES__) \\\n\
- || (defined(__STRICT_ANSI__) && defined(_XOPEN_SOURCE))\n");
- }
- else if (cur_symbols->flags & XOPEN_EXTENDED_SYMBOL)
- {
- fprintf (outf,
- "#if defined(__USE_FIXED_PROTOTYPES__) \\\n\
- || (defined(__STRICT_ANSI__) && defined(_XOPEN_EXTENDED_SOURCE))\n");
- }
- else
- {
- fatal ("internal error for function %s", fn->fname);
- }
- if_was_emitted = 1;
- }
-
- /* In the case of memmove, protect in case the application
- defines it as a macro before including the header. */
- if (!strcmp (fn->fname, "memmove")
- || !strcmp (fn->fname, "vprintf")
- || !strcmp (fn->fname, "vfprintf")
- || !strcmp (fn->fname, "vsprintf")
- || !strcmp (fn->fname, "rewinddir"))
- macro_protect = 1;
-
- if (macro_protect)
- fprintf (outf, "#ifndef %s\n", fn->fname);
- fprintf (outf, "extern %s %s (%s);\n",
- fn->rtype, fn->fname, fn->params);
- if (macro_protect)
- fprintf (outf, "#endif\n");
- }
- if (if_was_emitted)
- fprintf (outf,
- "#endif /* defined(__USE_FIXED_PROTOTYPES__) || ... */\n");
- }
- if (required_unseen_count)
- {
-#ifdef NO_IMPLICIT_EXTERN_C
- fprintf (outf, "#ifdef __cplusplus\n}\n#endif\n");
-#endif
- }
-
- switch (special_file_handling)
- {
- case errno_h:
- if (!seen_errno)
- fprintf (outf, "extern int errno;\n");
- break;
- case stdlib_h:
- if (!seen_EXIT_FAILURE)
- fprintf (outf, "#define EXIT_FAILURE 1\n");
- if (!seen_EXIT_SUCCESS)
- fprintf (outf, "#define EXIT_SUCCESS 0\n");
- break;
- case sys_stat_h:
- if (!seen_S_ISBLK && seen_S_IFBLK)
- fprintf (outf,
- "#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)\n");
- if (!seen_S_ISCHR && seen_S_IFCHR)
- fprintf (outf,
- "#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)\n");
- if (!seen_S_ISDIR && seen_S_IFDIR)
- fprintf (outf,
- "#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)\n");
- if (!seen_S_ISFIFO && seen_S_IFIFO)
- fprintf (outf,
- "#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)\n");
- if (!seen_S_ISLNK && seen_S_IFLNK)
- fprintf (outf,
- "#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)\n");
- if (!seen_S_ISREG && seen_S_IFREG)
- fprintf (outf,
- "#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)\n");
- break;
- }
-
-
-#if ADD_MISSING_EXTERN_C
- if (missing_extern_C_count + required_unseen_count > 0)
- fprintf (outf, "#ifdef __cplusplus\n}\n#endif\n");
-#endif
-}
-
-char *
-xstrdup (str)
- char *str;
-{
- char *copy = (char *) xmalloc (strlen (str) + 1);
- strcpy (copy, str);
- return copy;
-}
-
-/* Returns 1 iff the file is properly protected from multiple inclusion:
- #ifndef PROTECT_NAME
- #define PROTECT_NAME
- #endif
-
- */
-
-#define INF_GET() (inf_ptr < inf_limit ? *(unsigned char *) inf_ptr++ : EOF)
-#define INF_UNGET(c) ((c)!=EOF && inf_ptr--)
-
-int
-inf_skip_spaces (c)
- int c;
-{
- for (;;)
- {
- if (c == ' ' || c == '\t')
- c = INF_GET ();
- else if (c == '/')
- {
- c = INF_GET ();
- if (c != '*')
- {
- INF_UNGET (c);
- return '/';
- }
- c = INF_GET ();
- for (;;)
- {
- if (c == EOF)
- return EOF;
- else if (c != '*')
- {
- if (c == '\n')
- source_lineno++, lineno++;
- c = INF_GET ();
- }
- else if ((c = INF_GET ()) == '/')
- return INF_GET ();
- }
- }
- else
- break;
- }
- return c;
-}
-
-/* Read into STR from inf_buffer upto DELIM. */
-
-int
-inf_read_upto (str, delim)
- sstring *str;
- int delim;
-{
- int ch;
- for (;;)
- {
- ch = INF_GET ();
- if (ch == EOF || ch == delim)
- break;
- SSTRING_PUT (str, ch);
- }
- MAKE_SSTRING_SPACE (str, 1);
- *str->ptr = 0;
- return ch;
-}
-
-int
-inf_scan_ident (s, c)
- register sstring *s;
- int c;
-{
- s->ptr = s->base;
- if (isalpha (c) || c == '_')
- {
- for (;;)
- {
- SSTRING_PUT (s, c);
- c = INF_GET ();
- if (c == EOF || !(isalnum (c) || c == '_'))
- break;
- }
- }
- MAKE_SSTRING_SPACE (s, 1);
- *s->ptr = 0;
- return c;
-}
-
-/* Returns 1 if the file is correctly protected against multiple
- inclusion, setting *ifndef_line to the line number of the initial #ifndef
- and setting *endif_line to the final #endif.
- Otherwise return 0. */
-
-int
-check_protection (ifndef_line, endif_line)
- int *ifndef_line, *endif_line;
-{
- int c;
- int if_nesting = 1; /* Level of nesting of #if's */
- char *protect_name = NULL; /* Identifier following initial #ifndef */
- int define_seen = 0;
-
- /* Skip initial white space (including comments). */
- for (;; lineno++)
- {
- c = inf_skip_spaces (' ');
- if (c == EOF)
- return 0;
- if (c != '\n')
- break;
- }
- if (c != '#')
- return 0;
- c = inf_scan_ident (&buf, inf_skip_spaces (' '));
- if (SSTRING_LENGTH (&buf) == 0 || strcmp (buf.base, "ifndef") != 0)
- return 0;
-
- /* So far so good: We've seen an initial #ifndef. */
- *ifndef_line = lineno;
- c = inf_scan_ident (&buf, inf_skip_spaces (c));
- if (SSTRING_LENGTH (&buf) == 0 || c == EOF)
- return 0;
- protect_name = xstrdup (buf.base);
-
- INF_UNGET (c);
- c = inf_read_upto (&buf, '\n');
- if (c == EOF)
- return 0;
- lineno++;
-
- for (;;)
- {
- c = inf_skip_spaces (' ');
- if (c == EOF)
- return 0;
- if (c == '\n')
- {
- lineno++;
- continue;
- }
- if (c != '#')
- goto skip_to_eol;
- c = inf_scan_ident (&buf, inf_skip_spaces (' '));
- if (SSTRING_LENGTH (&buf) == 0)
- ;
- else if (!strcmp (buf.base, "ifndef")
- || !strcmp (buf.base, "ifdef") || !strcmp (buf.base, "if"))
- {
- if_nesting++;
- }
- else if (!strcmp (buf.base, "endif"))
- {
- if_nesting--;
- if (if_nesting == 0)
- break;
- }
- else if (!strcmp (buf.base, "else"))
- {
- if (if_nesting == 1)
- return 0;
- }
- else if (!strcmp (buf.base, "define"))
- {
- if (if_nesting != 1)
- goto skip_to_eol;
- c = inf_skip_spaces (c);
- c = inf_scan_ident (&buf, c);
- if (buf.base[0] > 0 && strcmp (buf.base, protect_name) == 0)
- define_seen = 1;
- }
- skip_to_eol:
- for (;;)
- {
- if (c == '\n' || c == EOF)
- break;
- c = INF_GET ();
- }
- if (c == EOF)
- return 0;
- lineno++;
- }
-
- if (!define_seen)
- return 0;
- *endif_line = lineno;
- /* Skip final white space (including comments). */
- for (;;)
- {
- c = inf_skip_spaces (' ');
- if (c == EOF)
- break;
- if (c != '\n')
- return 0;
- }
-
- return 1;
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int inf_fd;
- struct stat sbuf;
- int c;
- int i, done;
- const char *cptr, **pptr;
- int ifndef_line;
- int endif_line;
- long to_read;
- long int inf_size;
- register struct symbol_list *cur_symbols;
-
- if (argv[0] && argv[0][0])
- {
- register char *p;
-
- progname = 0;
- for (p = argv[0]; *p; p++)
- if (*p == '/')
- progname = p;
- progname = progname ? progname+1 : argv[0];
- }
-
- if (argc < 4)
- {
- fprintf (stderr, "%s: Usage: foo.h infile.h outfile.h options\n",
- progname);
- exit (-1);
- }
-
- inc_filename = argv[1];
- inc_filename_length = strlen (inc_filename);
-
-#ifdef FIXPROTO_IGNORE_LIST
- for (i = 0; files_to_ignore[i] != NULL; i++)
- {
- char *ignore_name = files_to_ignore[i];
- int ignore_len = strlen (ignore_name);
- if (strncmp (inc_filename, ignore_name, ignore_len) == 0)
- {
- if (ignore_name[ignore_len-1] == '/'
- || inc_filename[ignore_len] == '\0')
- {
- if (verbose)
- fprintf (stderr, "%s: ignoring %s\n", progname, inc_filename);
- exit (0);
- }
- }
-
- }
-#endif
-
- if (strcmp (inc_filename, "sys/stat.h") == 0)
- special_file_handling = sys_stat_h;
- else if (strcmp (inc_filename, "errno.h") == 0)
- special_file_handling = errno_h, required_other++;
- else if (strcmp (inc_filename, "stdlib.h") == 0)
- special_file_handling = stdlib_h, required_other+=2;
- else if (strcmp (inc_filename, "stdio.h") == 0)
- special_file_handling = stdio_h;
- include_entry = std_include_table;
- while (include_entry->name != NULL
- && (include_entry->name == CONTINUED
- || strcmp (inc_filename, include_entry->name) != 0))
- include_entry++;
-
- if (include_entry->name != NULL)
- {
- struct std_include_entry *entry;
- cur_symbol_table_size = 0;
- for (entry = include_entry; ;)
- {
- add_symbols (entry->flags, entry->names);
- entry++;
- if (entry->name != CONTINUED)
- break;
- }
- }
- else
- symbol_table[0].names = NULL;
-
- /* Count and mark the prototypes required for this include file. */
- for (cur_symbols = &symbol_table[0]; cur_symbols->names; cur_symbols++)
- {
- int name_len;
- if (cur_symbols->flags & MACRO_SYMBOL)
- continue;
- cptr = cur_symbols->names;
- for ( ; (name_len = strlen (cptr)) != 0; cptr+= name_len + 1)
- {
- struct fn_decl *fn = lookup_std_proto (cptr, name_len);
- required_unseen_count++;
- if (fn == NULL)
- fprintf (stderr, "Internal error: No prototype for %s\n", cptr);
- else
- SET_REQUIRED (fn);
- }
- }
-
- read_scan_file (argv[2], argc - 4, argv + 4);
-
- inf_fd = open (argv[2], O_RDONLY, 0666);
- if (inf_fd < 0)
- {
- fprintf (stderr, "%s: Cannot open '%s' for reading -",
- progname, argv[2]);
- perror (NULL);
- exit (-1);
- }
- if (fstat (inf_fd, &sbuf) < 0)
- {
- fprintf (stderr, "%s: Cannot get size of '%s' -", progname, argv[2]);
- perror (NULL);
- exit (-1);
- }
- inf_size = sbuf.st_size;
- inf_buffer = (char *) xmalloc (inf_size + 2);
- inf_buffer[inf_size] = '\n';
- inf_buffer[inf_size + 1] = '\0';
- inf_limit = inf_buffer + inf_size;
- inf_ptr = inf_buffer;
-
- to_read = inf_size;
- while (to_read > 0)
- {
- long i = read (inf_fd, inf_buffer + inf_size - to_read, to_read);
- if (i < 0)
- {
- fprintf (stderr, "%s: Failed to read '%s' -", progname, argv[2]);
- perror (NULL);
- exit (-1);
- }
- if (i == 0)
- {
- inf_size -= to_read;
- break;
- }
- to_read -= i;
- }
-
- close (inf_fd);
-
- /* If file doesn't end with '\n', add one. */
- if (inf_limit > inf_buffer && inf_limit[-1] != '\n')
- inf_limit++;
-
- unlink (argv[3]);
- outf = fopen (argv[3], "w");
- if (outf == NULL)
- {
- fprintf (stderr, "%s: Cannot open '%s' for writing -",
- progname, argv[3]);
- perror (NULL);
- exit (-1);
- }
-
- lineno = 1;
-
- if (check_protection (&ifndef_line, &endif_line))
- {
- lbrac_line = ifndef_line+1;
- rbrac_line = endif_line;
- }
- else
- {
- lbrac_line = 1;
- rbrac_line = -1;
- }
-
- /* Reset input file. */
- inf_ptr = inf_buffer;
- lineno = 1;
-
- for (;;)
- {
- if (lineno == lbrac_line)
- write_lbrac ();
- if (lineno == rbrac_line)
- write_rbrac ();
- for (;;)
- {
- struct fn_decl *fn;
- c = INF_GET ();
- if (c == EOF)
- break;
- if (isalpha (c) || c == '_')
- {
- c = inf_scan_ident (&buf, c);
- INF_UNGET (c);
- fputs (buf.base, outf);
- fn = lookup_std_proto (buf.base, strlen (buf.base));
- /* We only want to edit the declaration matching the one
- seen by scan-decls, as there can be multiple
- declarations, selected by #ifdef __STDC__ or whatever. */
- if (fn && fn->partial && fn->partial->line_seen == lineno)
- {
- c = inf_skip_spaces (' ');
- if (c == EOF)
- break;
- if (c == '(')
- {
- c = inf_skip_spaces (' ');
- if (c == ')')
- {
- fprintf (outf, " _PARAMS((%s))", fn->params);
- }
- else
- {
- putc ('(', outf);
- INF_UNGET (c);
- }
- }
- else
- fprintf (outf, " %c", c);
- }
- }
- else
- {
- putc (c, outf);
- if (c == '\n')
- break;
- }
- }
- if (c == EOF)
- break;
- lineno++;
- }
- if (rbrac_line < 0)
- write_rbrac ();
-
- fclose (outf);
-
- return 0;
-}
-
-/* Stub error functions. These replace cpperror.c,
- because we want to suppress error messages. */
-
-void
-cpp_file_line_for_message (pfile, filename, line, column)
- cpp_reader *pfile;
- char *filename;
- int line, column;
-{
- if (!verbose)
- return;
- if (column > 0)
- fprintf (stderr, "%s:%d:%d: ", filename, line, column);
- else
- fprintf (stderr, "%s:%d: ", filename, line);
-}
-
-void
-cpp_print_containing_files (pfile)
- cpp_reader *pfile;
-{
-}
-
-/* IS_ERROR is 2 for fatal error, 1 for error, 0 for warning */
-
-void cpp_message (pfile, is_error, msg, arg1, arg2, arg3)
- int is_error;
- cpp_reader *pfile;
- char *msg;
- char *arg1, *arg2, *arg3;
-{
- if (is_error == 1)
- pfile->errors++;
- else if (is_error > 1)
- pfile->errors = CPP_FATAL_LIMIT;
- if (!verbose)
- return;
- if (!is_error)
- fprintf (stderr, "warning: ");
- fprintf (stderr, msg, arg1, arg2, arg3);
- fprintf (stderr, "\n");
-}
-
-void
-fatal (str, arg)
- char *str, *arg;
-{
- fprintf (stderr, "%s: %s: ", progname, inc_filename);
- fprintf (stderr, str, arg);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-void
-cpp_fatal (pfile, str, arg)
- cpp_reader *pfile;
- char *str, *arg;
-{
- fatal (str, arg);
-}
-
-void
-cpp_pfatal_with_name (pfile, name)
- cpp_reader *pfile;
- char *name;
-{
- cpp_perror_with_name (pfile, name);
- exit (FATAL_EXIT_CODE);
-}
diff --git a/gcc/fixcpp b/gcc/fixcpp
deleted file mode 100755
index 044353f3a43..00000000000
--- a/gcc/fixcpp
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/bin/sh
-#
-# NAME:
-# fixcpp - fix CPP errors
-#
-# SYNOPSIS:
-# fixcpp [-c][-p patch_file][-b bak_dir][-n new_dir] files(s)
-#
-# DESCRIPTION:
-# For each named file, use sed(1) to fixup any descriptive
-# text after #else or #endif or that is not properly
-# commented as this causes ANSI compilers to generate
-# unnecessary warnings.
-#
-# Naturally this script is not guaranteed to be bullet
-# proof, use of -n or -b is advisable!
-#
-# -c causes fixcpp to make sure that only files that
-# needed changing are affected by returning the original
-# file to its original location if no changes were needed.
-#
-# -p causes fixcpp to append to a patch file the context
-# diffs of the changes wrought.
-#
-# SEE ALSO:
-# sed(1)
-#
-# AMENDED:
-# 90/08/08 22:46:32 (sjg)
-#
-# RELEASED:
-# 90/08/08 22:46:34 v1.4
-#
-# SCCSID:
-# @(#)fixcpp.sh 1.4 90/08/08 22:46:32 (sjg)
-#
-# @(#)Copyright (c) 1990 Simon J. Gerraty
-#
-# This is free software. It comes with NO WARRANTY.
-# Everyone is granted permission to copy, modify and
-# redistribute this source code provided that all
-# recipients are given similar rights, and that the above
-# copyright notice and this notice are preserved in all
-# copies.
-
-TMPF=/tmp/fixcpp.$$
-NEWDIR=
-BAKDIR=
-PATCHF=
-CHECK=
-
-set -- `getopt "cp:b:n:" $*`
-if [ $? != 0 ]; then
- echo "$0 [-c][-p patch_file][-b bakup_dir][-n new_dir] file [file ...]" >&2
- exit 1
-fi
-for i in $*
-do
- case $i in
- -c) CHECK=yes; shift;;
- -p) PATCHF=$2; shift 2;;
- -b) BAKDIR=$2; shift 2;;
- -n) NEWDIR=$2; shift 2;;
- --) shift; break;;
- esac
-done
-NEWDIR=${NEWDIR:-.}
-if [ $BAKDIR ]; then
- if [ ! -d $BAKDIR ]; then
- echo "$0: no such directory -- $BAKDIR" >&2
- exit 1
- fi
-fi
-
-
-
-for i in $*
-do
- if [ $BAKDIR ]; then
- mv $i $BAKDIR
- infile=$BAKDIR/$i
- else
- if [ "$NEWDIR" = "." ]; then
- mv $i ${TMPF}
- infile=${TMPF}
- else
- infile=$i
- fi
- fi
- sed -e 's;^#\([ ]*e[nl][^ ]*[ ][ ]*\)\([^/ ][^\*].*\);#\1/* \2 */;' -e 's;^#\([ ]*e[nl][^ ]*[ ][ ]*\)\([^/ ]\)$;#\1/* \2 */;' $infile >${NEWDIR}/$i
- if [ "${CHECK}" = "yes" -o ${PATCHF} ]; then
- if cmp -s $infile ${NEWDIR}/$i ; then
- if [ "${CHECK}" = "yes" ]; then
- if [ $BAKDIR ]; then
- mv $infile ${NEWDIR}/$i
- else
- rm ${NEWDIR}/$i
- fi
- fi
- else
- if [ $PATCHF ]; then
- diff -c $infile ${NEWDIR}/$i >> ${PATCHF}
- fi
- fi
- fi
-
-done
-
-rm -f ${TMPF}
diff --git a/gcc/fixinc-nt.sed b/gcc/fixinc-nt.sed
deleted file mode 100644
index a8119b93030..00000000000
--- a/gcc/fixinc-nt.sed
+++ /dev/null
@@ -1,5 +0,0 @@
-s/!__STDC__/!defined (__STRICT_ANSI__)/g
-s/getcwd(char \*, int)/getcwd(char *, size_t)/
-s/Format\[\]/Format\[1\]/
-s/^#if !defined (__cplusplus)/#if 0/
-s/^#define DECLSPEC_IMPORT __declspec(dllimport)/#define DECLSPEC_IMPORT/
diff --git a/gcc/fixinc.dgux b/gcc/fixinc.dgux
deleted file mode 100755
index 422ba5f725f..00000000000
--- a/gcc/fixinc.dgux
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/bin/sh
-#
-# modified for dgux by hassey@dg-rtp.dg.com based on
-#
-# fixinc.svr4 written by Ron Guilmette (rfg@ncd.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.
-#
-#
-# See README-fixinc for more information.
-
-# Directory containing the original header files.
-INPUT=${2-${INPUT-/usr/include}}
-
-# Fail if no arg to specify a directory for the output.
-if [ x$1 = x ]
-then echo fixincludes: no output directory specified
-exit 1
-fi
-
-# Directory in which to store the results.
-LIB=${1?"fixincludes: output directory not specified"}
-
-# Make sure it exists.
-if [ ! -d $LIB ]; then
- mkdir $LIB || exit 1
-fi
-
-ORIG_DIR=`pwd`
-
-# Make LIB absolute if it is relative.
-# Don't do this if not necessary, since may screw up automounters.
-case $LIB in
-/*)
- ;;
-*)
- cd $LIB; LIB=`${PWDCMD-pwd}`
- ;;
-esac
-
-echo 'Building fixincludes in ' ${LIB}
-
-# Determine whether this filesystem has symbolic links.
-if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
- rm -f $LIB/ShouldNotExist
- LINKS=true
-else
- LINKS=false
-fi
-
-echo 'Making directories:'
-cd ${INPUT}
-if $LINKS; then
- files=`ls -LR | sed -n s/:$//p`
-else
- files=`find . -type d -print | sed '/^.$/d'`
-fi
-for file in $files; do
- rm -rf $LIB/$file
- if [ ! -d $LIB/$file ]
- then mkdir $LIB/$file
- fi
-done
-
-# treetops gets an alternating list
-# of old directories to copy
-# and the new directories to copy to.
-treetops="${INPUT} ${LIB}"
-
-if $LINKS; then
- echo 'Making internal symbolic directory links'
- for file in $files; do
- dest=`ls -ld $file | sed -n 's/.*-> //p'`
- if [ "$dest" ]; then
- cwd=`pwd`
- # In case $dest is relative, get to $file's dir first.
- cd ${INPUT}
- cd `echo ./$file | sed -n 's&[^/]*$&&p'`
- # Check that the target directory exists.
- # Redirections changed to avoid bug in sh on Ultrix.
- (cd $dest) > /dev/null 2>&1
- if [ $? = 0 ]; then
- cd $dest
- # X gets the dir that the link actually leads to.
- x=`pwd`
- # If link leads back into ${INPUT},
- # make a similar link here.
- if expr $x : "${INPUT}/.*" > /dev/null; then
- # Y gets the actual target dir name, relative to ${INPUT}.
- y=`echo $x | sed -n "s&${INPUT}/&&p"`
- # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
- dots=`echo "$file" |
- sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
- echo $file '->' $dots$y ': Making link'
- rm -fr ${LIB}/$file > /dev/null 2>&1
- ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
- else
- # If the link is to outside ${INPUT},
- # treat this directory as if it actually contained the files.
-# This line used to have $dest instead of $x.
-# $dest seemed to be wrong for links found in subdirectories
-# of ${INPUT}. Does this change break anything?
- treetops="$treetops $x ${LIB}/$file"
- fi
- fi
- cd $cwd
- fi
- done
-fi
-
-# Completely replace <_int_varargs.h> with a file that defines
-# va_list and gnuc_va_list
-
-file=_int_varargs.h
-if [ -r ${INPUT}/$file ]; then
- echo Replacing $file
- cat > ${LIB}/$file << EOF
-/* This file was generated by fixinc.dgux. */
-#ifndef __INT_VARARGS_H
-#define __INT_VARARGS_H
-
-#if defined(__m88k__) && defined (__DGUX__)
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-typedef struct
-{
- int __va_arg; /* argument number */
- int *__va_stk; /* start of args passed on stack */
- int *__va_reg; /* start of args passed in regs */
-} __gnuc_va_list;
-#endif /* not __GNUC_VA_LIST */
-#endif /* 88k && dgux */
-
-#ifndef _VA_LIST_
-#define _VA_LIST_
-typedef __gnuc_va_list va_list;
-#endif /* _VA_LIST_ */
-
-#endif /* __INT_VARARGS_H */
-
-EOF
- chmod a+r ${LIB}/$file
-fi
-
-echo 'Removing unneeded directories:'
-cd $LIB
-files=`find . -type d -print | sort -r`
-for file in $files; do
- rmdir $LIB/$file > /dev/null 2>&1
-done
-
-if $LINKS; then
- echo 'Making internal symbolic non-directory links'
- cd ${INPUT}
- files=`find . -type l -print`
- for file in $files; do
- dest=`ls -ld $file | sed -n 's/.*-> //p'`
- if expr "$dest" : '[^/].*' > /dev/null; then
- target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
- if [ -f $target ]; then
- ln -s $dest ${LIB}/$file >/dev/null 2>&1
- fi
- fi
- done
-fi
-
-cd ${ORIG_DIR}
-
-exit 0
-
diff --git a/gcc/fixinc.irix b/gcc/fixinc.irix
deleted file mode 100755
index 222097718fb..00000000000
--- a/gcc/fixinc.irix
+++ /dev/null
@@ -1,161 +0,0 @@
-#! /bin/sh
-# Install modified versions of certain problematic Irix include files.
-# Copyright (C) 1997 Free Software Foundation, Inc.
-# Contributed by Brendan Kehoe (brendan@cygnus.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.
-#
-# See README-fixinc for more information.
-
-# Directory containing the original header files.
-INPUT=${2-${INPUT-/usr/include}}
-
-# Fail if no arg to specify a directory for the output.
-if [ x$1 = x ]
-then echo fixincludes: no output directory specified
-exit 1
-fi
-
-# Directory in which to store the results.
-LIB=${1?"fixincludes: output directory not specified"}
-
-# Make sure it exists.
-if [ ! -d $LIB ]; then
- mkdir $LIB || exit 1
-fi
-
-ORIG_DIR=`pwd`
-
-# Make LIB absolute if it is relative.
-# Don't do this if not necessary, since may screw up automounters.
-case $LIB in
-/*)
- ;;
-*)
- LIB=$ORIG_DIR/$LIB
- ;;
-esac
-
-echo 'Building fixincludes in ' ${LIB}
-
-#
-# Note: For Irix, we deliberately don't try to create the directory trees,
-# since we only modify math.h and limits.h. If we ADD ANY OTHERS,
-# the "Making directories:" and symlinks code from fixinc.svr4 may
-# have to go back in.
-
-# The Irix math.h defines struct exception, which conflicts with
-# the class exception defined in the C++ file std/stdexcept.h. We
-# redefine it to __math_exception. This is not a great fix, but I
-# haven't been able to think of anything better.
-file=math.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '/struct exception/i\
-#ifdef __cplusplus\
-#define exception __math_exception\
-#endif'\
- -e '/struct exception/a\
-#ifdef __cplusplus\
-#undef exception\
-#endif' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# In limits.h, put #ifndefs around things that are supposed to be defined
-# in float.h to avoid redefinition errors if float.h is included first.
-
-file=limits.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '/[ ]FLT_MIN[ ]/i\
-#ifndef FLT_MIN
-'\
- -e '/[ ]FLT_MIN[ ]/a\
-#endif
-'\
- -e '/[ ]FLT_MAX[ ]/i\
-#ifndef FLT_MAX
-'\
- -e '/[ ]FLT_MAX[ ]/a\
-#endif
-'\
- -e '/[ ]FLT_DIG[ ]/i\
-#ifndef FLT_DIG
-'\
- -e '/[ ]FLT_DIG[ ]/a\
-#endif
-'\
- -e '/[ ]DBL_MIN[ ]/i\
-#ifndef DBL_MIN
-'\
- -e '/[ ]DBL_MIN[ ]/a\
-#endif
-'\
- -e '/[ ]DBL_MAX[ ]/i\
-#ifndef DBL_MAX
-'\
- -e '/[ ]DBL_MAX[ ]/a\
-#endif
-'\
- -e '/[ ]DBL_DIG[ ]/i\
-#ifndef DBL_DIG
-'\
- -e '/[ ]DBL_DIG[ ]/a\
-#endif
-' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-exit 0
diff --git a/gcc/fixinc.ptx b/gcc/fixinc.ptx
deleted file mode 100644
index 90e1b86ed42..00000000000
--- a/gcc/fixinc.ptx
+++ /dev/null
@@ -1,257 +0,0 @@
-#! /bin/sh
-# Install modified versions of certain ANSI-incompatible
-# native Sequent DYNIX/ptx System V Release 3.2 system include files.
-# Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
-# Contributed by Bill Burton <billb@progress.com>
-# Portions adapted from fixinc.svr4 and fixincludes.
-#
-# 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 script munges the native include files provided with DYNIX/ptx
-# so as to remove things which are violations of the ANSI C standard.
-# This is done by first running fixinc.svr4 which does most of the
-# work. A few includes have fixes made to them afterwards by this
-# script. Once munged, the resulting new system include files are
-# placed in a directory that GNU C will search *before* searching the
-# /usr/include directory. This script should work properly for most
-# DYNIX/ptx systems. For other types of systems, you should use the
-# `fixincludes' script instead.
-#
-# See README-fixinc for more information.
-
-# Directory containing the original header files.
-INPUT=${2-${INPUT-/usr/include}}
-
-# Fail if no arg to specify a directory for the output.
-if [ x$1 = x ]
-then echo fixincludes: no output directory specified
-exit 1
-fi
-
-# Directory in which to store the results.
-LIB=${1?"fixincludes: output directory not specified"}
-
-# Make sure it exists.
-if [ ! -d $LIB ]; then
- mkdir $LIB || exit 1
-fi
-
-ORIG_DIR=`pwd`
-
-# Make LIB absolute if it is relative.
-# Don't do this if not necessary, since may screw up automounters.
-case $LIB in
-/*)
- ;;
-*)
- LIB=$ORIG_DIR/$LIB
- ;;
-esac
-
-echo 'Running fixinc.svr4'
-# DYNIX/ptx has dirname so this is no problem
-`dirname $0`/fixinc.svr4 $*
-echo 'Finished fixinc.svr4'
-
-echo 'Building fixincludes in ' ${LIB}
-
-# Copied from fixincludes.
-# Don't use or define the name va_list in stdio.h.
-# This is for ANSI and also to interoperate properly with gcc's varargs.h.
-file=stdio.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, use of va_list
- # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
- (echo "#define __need___va_list"
- echo "#include <stdarg.h>") > ${LIB}/${file}.sed
- # Use __gnuc_va_list in arg types in place of va_list.
- # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
- # trailing parentheses and semicolon save all other systems from this.
- # Define __va_list__ (something harmless and unused) instead of va_list.
- # Don't claim to have defined va_list.
- sed -e 's@ va_list @ __gnuc_va_list @' \
- -e 's@ va_list)@ __gnuc_va_list)@' \
- -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
- -e 's@ va_list@ __va_list__@' \
- -e 's@\*va_list@*__va_list__@' \
- -e 's@ __va_list)@ __gnuc_va_list)@' \
- -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
- -e 's@VA_LIST@DUMMY_VA_LIST@' \
- -e 's@_NEED___Va_LIST@_NEED___VA_LIST@' \
- ${LIB}/$file >> ${LIB}/${file}.sed
-
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- fi
-fi
-
-# In pwd.h, PTX 1.x needs stdio.h included since FILE * was added in a
-# prototype later on in the file.
-file=pwd.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep stdio $file_to_fix > /dev/null; then
- true
- else
- sed -e '/#include <sys\/types\.h>/a\
-\
-#if defined(__STDC__) || defined(__cplusplus)\
-#include <stdio.h>\
-#endif /* __STDC__ */
-' \
- $file_to_fix > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- echo Fixed $file_to_fix
- fi
-fi
-
-# Copied from fixincludes.
-# math.h puts the declaration of matherr before the definition
-# of struct exception, so the prototype (added by fixproto) causes havoc.
-file=math.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, matherr declaration
- sed -e '/^struct exception/,$b' \
- -e '/matherr/i\
-struct exception;
-'\
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- fi
-fi
-
-# In netinet/in.h, the network byte swapping asm functions supported by the
-# native cc compiler on PTX 1.x and 2.x is not supported in gcc. Instead,
-# include <sys/byteorder.h> written out by the fixinc.svr4 script which has
-# these same routines written in an asm format supported by gcc.
-file=netinet/in.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep __GNUC__ $file_to_fix > /dev/null; then
- true
- else
- sed -e '/#define NETSWAP/a\
-\
-#if defined (__GNUC__) || defined (__GNUG__)\
-#include <sys/byteorder.h>\
-#else /* not __GNUC__ */
-' \
- -e '/#endif[ ]*\/\* NETSWAP \*\//i\
-#endif /* not __GNUC__ */
-' \
- $file_to_fix > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- echo Fixed $file_to_fix
- fi
-fi
-
-# /usr/include/sys/mc_param.h has an embedded asm for the cpuid intruction
-# on the P5. This is not used by anything else so we ifdef it out.
-file=sys/mc_param.h
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep __GNUC__ $file_to_fix > /dev/null; then
- true
- else
- sed -e '/__asm/,/}/{
-/__asm/i\
-#if !defined (__GNUC__) && !defined (__GNUG__)
-/}/a\
-#endif
-}' \
- $file_to_fix > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- echo Fixed $file_to_fix
- fi
-fi
-
-# /usr/include/sys/mc_param.h has an embedded asm for the cpuid intruction
-# on the P5. This is not used by anything else so we ifdef it out.
-file=sys/mc_param.h
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep __GNUC__ $file_to_fix > /dev/null; then
- true
- else
- sed -e '/__asm/,/}/{
-/__asm/i\
-#if !defined (__GNUC__) && !defined (__GNUG__)
-/}/a\
-#endif
-}' \
- $file_to_fix > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- echo Fixed $file_to_fix
- fi
-fi
-
-exit 0
-
diff --git a/gcc/fixinc.sco b/gcc/fixinc.sco
deleted file mode 100755
index b3301e19cba..00000000000
--- a/gcc/fixinc.sco
+++ /dev/null
@@ -1,315 +0,0 @@
-#! /bin/sh
-#
-# fixinc.sco -- Install modified versions of SCO system include
-# files.
-#
-# Based on fixinc.svr4 script by Ron Guilmette (rfg@ncd.com) (SCO
-# modifications by Ian Lance Taylor (ian@airs.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 script munges the native include files provided with SCO
-# 3.2v4 systems so as to provide a reasonable namespace when
-# compiling with gcc. The header files by default do not
-# provide many essential definitions and declarations if
-# __STDC__ is 1. This script modifies the header files to check
-# for __STRICT_ANSI__ being defined instead. Once munged, the
-# resulting new system include files are placed in a directory
-# that GNU C will search *before* searching the /usr/include
-# directory. This script should work properly for most SCO
-# 3.2v4 systems. For other types of systems, you should use the
-# `fixincludes' or the `fixinc.svr4' script instead.
-#
-# See README-fixinc for more information.
-
-# Directory containing the original header files.
-INPUT=${2-${INPUT-/usr/include}}
-
-# Fail if no arg to specify a directory for the output.
-if [ x$1 = x ]
-then echo fixincludes: no output directory specified
-exit 1
-fi
-
-# Directory in which to store the results.
-LIB=${1?"fixincludes: output directory not specified"}
-
-# Make sure it exists.
-if [ ! -d $LIB ]; then
- mkdir $LIB || exit 1
-fi
-
-ORIG_DIR=`pwd`
-
-# Make LIB absolute if it is relative.
-# Don't do this if not necessary, since may screw up automounters.
-case $LIB in
-/*)
- ;;
-*)
- cd $LIB; LIB=`${PWDCMD-pwd}`
- ;;
-esac
-
-echo 'Building fixincludes in ' ${LIB}
-
-# Determine whether this filesystem has symbolic links.
-if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
- rm -f $LIB/ShouldNotExist
- LINKS=true
-else
- LINKS=false
-fi
-
-echo 'Making directories:'
-cd ${INPUT}
-if $LINKS; then
- files=`ls -LR | sed -n s/:$//p`
-else
- files=`find . -type d -print | sed '/^.$/d'`
-fi
-for file in $files; do
- rm -rf $LIB/$file
- if [ ! -d $LIB/$file ]
- then mkdir $LIB/$file
- fi
-done
-
-# treetops gets an alternating list
-# of old directories to copy
-# and the new directories to copy to.
-treetops="${INPUT} ${LIB}"
-
-if $LINKS; then
- echo 'Making internal symbolic directory links'
- for file in $files; do
- dest=`ls -ld $file | sed -n 's/.*-> //p'`
- if [ "$dest" ]; then
- cwd=`pwd`
- # In case $dest is relative, get to $file's dir first.
- cd ${INPUT}
- cd `echo ./$file | sed -n 's&[^/]*$&&p'`
- # Check that the target directory exists.
- # Redirections changed to avoid bug in sh on Ultrix.
- (cd $dest) > /dev/null 2>&1
- if [ $? = 0 ]; then
- cd $dest
- # X gets the dir that the link actually leads to.
- x=`pwd`
- # If link leads back into ${INPUT},
- # make a similar link here.
- if expr $x : "${INPUT}/.*" > /dev/null; then
- # Y gets the actual target dir name, relative to ${INPUT}.
- y=`echo $x | sed -n "s&${INPUT}/&&p"`
- echo $file '->' $y ': Making link'
- rm -fr ${LIB}/$file > /dev/null 2>&1
- ln -s ${LIB}/$y ${LIB}/$file > /dev/null 2>&1
- else
- # If the link is to outside ${INPUT},
- # treat this directory as if it actually contained the files.
-# This line used to have $dest instead of $x.
-# $dest seemed to be wrong for links found in subdirectories
-# of ${INPUT}. Does this change break anything?
- treetops="$treetops $x ${LIB}/$file"
- fi
- fi
- cd $cwd
- fi
- done
-fi
-
-set - $treetops
-while [ $# != 0 ]; do
- # $1 is an old directory to copy, and $2 is the new directory to copy to.
- echo "Finding header files in $1:"
- cd ${INPUT}
- cd $1
- files=`find . -name '*.h' -type f -print`
- echo 'Checking header files:'
- for file in $files; do
- if egrep '!__STDC__' $file >/dev/null; then
- if [ -r $file ]; then
- cp $file $2/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w $2/$file
- chmod a+r $2/$file
-
-# The following have been removed from the sed command below
-# because it is more useful to leave these things in.
-# The only reason to remove them was for -pedantic,
-# which isn't much of a reason. -- rms.
-# /^[ ]*#[ ]*ident/d
-
- sed -e '
- s/!__STDC__/!defined (__STRICT_ANSI__)/g
- ' $2/$file > $2/$file.sed
- mv $2/$file.sed $2/$file
- if cmp $file $2/$file >/dev/null 2>&1; then
- rm $2/$file
- else
- echo Fixed $file
- fi
- fi
- fi
- done
- shift; shift
-done
-
-# Fix first broken decl of getcwd present on some svr4 systems.
-
-file=stdlib.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e 's/getcwd(char \{0,\}\*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Fix second broken decl of getcwd present on some svr4 systems. Also
-# fix the incorrect decl of profil present on some svr4 systems.
-
-file=unistd.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix \
- | sed -e 's/profil(unsigned short \*, unsigned int, unsigned int, unsigned int)/profil(unsigned short *, size_t, int, unsigned)/' > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Fix third broken decl of getcwd on SCO. Also fix incorrect decl of
-# link.
-file=prototypes.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix \
- | sed -e 's/const int link(const char \*, char \*)/extern int link(const char *, const char *)/' > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Fix an error in this file: the #if says _cplusplus, not the double
-# underscore __cplusplus that it should be
-file=tinfo.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/rpcsvc 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, __cplusplus macro
- sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- fi
-fi
-
-# Fix prototype declaration of utime in sys/times.h. In 3.2v4.0 the
-# const is missing.
-file=sys/times.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, utime prototype
- sed -e 's/(const char \*, struct utimbuf \*);/(const char *, const struct utimbuf *);/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- fi
-fi
-
-echo 'Removing unneeded directories:'
-cd $LIB
-files=`find . -type d -print | sort -r`
-for file in $files; do
- rmdir $LIB/$file > /dev/null 2>&1
-done
-
-if $LINKS; then
- echo 'Making internal symbolic non-directory links'
- cd ${INPUT}
- files=`find . -type l -print`
- for file in $files; do
- dest=`ls -ld $file | sed -n 's/.*-> //p'`
- if expr "$dest" : '[^/].*' > /dev/null; then
- target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
- if [ -f $target ]; then
- ln -s $dest ${LIB}/$file >/dev/null 2>&1
- fi
- fi
- done
-fi
-
-exit 0
diff --git a/gcc/fixinc.svr4 b/gcc/fixinc.svr4
deleted file mode 100755
index c0418b69d59..00000000000
--- a/gcc/fixinc.svr4
+++ /dev/null
@@ -1,1725 +0,0 @@
-#! /bin/sh
-# Install modified versions of certain ANSI-incompatible
-# native System V Release 4 system include files.
-# Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
-# Contributed by Ron Guilmette (rfg@monkeys.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 script munges the native include files provided with System V
-# Release 4 systems so as to remove things which are violations of the
-# ANSI C standard. Once munged, the resulting new system include files
-# are placed in a directory that GNU C will search *before* searching
-# the /usr/include directory. This script should work properly for most
-# System V Release 4 systems. For other types of systems, you should
-# use the `fixincludes' script instead.
-#
-# See README-fixinc for more information.
-
-# Directory containing the original header files.
-INPUT=${2-${INPUT-/usr/include}}
-
-# Fail if no arg to specify a directory for the output.
-if [ x$1 = x ]
-then echo fixincludes: no output directory specified
-exit 1
-fi
-
-# Directory in which to store the results.
-LIB=${1?"fixincludes: output directory not specified"}
-
-# Make sure it exists.
-if [ ! -d $LIB ]; then
- mkdir $LIB || exit 1
-fi
-
-ORIG_DIR=`pwd`
-
-# Make LIB absolute if it is relative.
-# Don't do this if not necessary, since may screw up automounters.
-case $LIB in
-/*)
- ;;
-*)
- LIB=$ORIG_DIR/$LIB
- ;;
-esac
-
-echo 'Building fixincludes in ' ${LIB}
-
-# Determine whether this filesystem has symbolic links.
-if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
- rm -f $LIB/ShouldNotExist
- LINKS=true
-else
- LINKS=false
-fi
-
-echo 'Making directories:'
-cd ${INPUT}
-if $LINKS; then
- files=`find . -follow -type d -print 2>/dev/null | sed '/^.$/d'`
-else
- files=`find . -type d -print | sed '/^.$/d'`
-fi
-for file in $files; do
- rm -rf $LIB/$file
- if [ ! -d $LIB/$file ]
- then mkdir $LIB/$file
- fi
-done
-
-# treetops gets an alternating list
-# of old directories to copy
-# and the new directories to copy to.
-treetops="${INPUT} ${LIB}"
-
-if $LINKS; then
- echo 'Making internal symbolic directory links'
- for file in $files; do
- dest=`ls -ld $file | sed -n 's/.*-> //p'`
- if [ "$dest" ]; then
- cwd=`pwd`
- # In case $dest is relative, get to $file's dir first.
- cd ${INPUT}
- cd `echo ./$file | sed -n 's&[^/]*$&&p'`
- rwd=`pwd`
- # Check that the target directory exists.
- # Redirections changed to avoid bug in sh on Ultrix.
- (cd $dest) > /dev/null 2>&1
- if [ $? = 0 ]; then
- cd $dest
- # X gets the dir that the link actually leads to.
- x=`pwd`
- # If link leads back into ${INPUT},
- # make a similar link here.
- if expr "$dest" : '[^/][^/]*' >/dev/null && [ ! -h $dest ]; then
- echo $file '->' $dest': Making link'
- rm -fr ${LIB}/$file > /dev/null 2>&1
- ln -s $dest ${LIB}/$file > /dev/null 2>&1
- elif expr $x : "${INPUT}/.*" > /dev/null; then
- # Y gets the actual target dir name, relative to ${INPUT}.
- y=`echo $x | sed -n "s&${INPUT}/&&p"`
- # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
- dots=`echo "$file" |
- sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
- echo $file '->' $dots$y ': Making link'
- rm -fr ${LIB}/$file > /dev/null 2>&1
- ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
- elif expr $x : "${rwd}/.*" > /dev/null; then
- # Y gets the actual target dir name, relative to the directory where the link is.
- y=`echo $x | sed -n "s&${rwd}/&&p"`
- # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
- dots=`echo "$file" |
- sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
- echo $file '->' $dots$y ': Making link'
- rm -fr ${LIB}/$file > /dev/null 2>&1
- ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
- else
- # If the link is to outside ${INPUT},
- # treat this directory as if it actually contained the files.
-# This line used to have $dest instead of $x.
-# $dest seemed to be wrong for links found in subdirectories
-# of ${INPUT}. Does this change break anything?
- treetops="$treetops $x ${LIB}/$file"
- fi
- fi
- cd $cwd
- fi
- done
-fi
-
-set - $treetops
-while [ $# != 0 ]; do
- # $1 is an old directory to copy, and $2 is the new directory to copy to.
- echo "Finding header files in $1:"
- cd ${INPUT}
- cd $1
- files=`find . -name '*.h' -type f -print`
- echo 'Checking header files:'
- for file in $files; do
- if [ -r $file ]; then
- cp $file $2/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w $2/$file
- chmod a+r $2/$file
-
-# The following have been removed from the sed command below
-# because it is more useful to leave these things in.
-# The only reason to remove them was for -pedantic,
-# which isn't much of a reason. -- rms.
-# /^[ ]*#[ ]*ident/d
-
-# This code makes Solaris SCSI fail, because it changes the
-# alignment within some critical structures. See <sys/scsi/impl/commands.h>.
-# s/u_char\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
-# Disable these also, since they probably aren't safe either.
-# s/u_short\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
-# s/ushort\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
-# s/evcm_t\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*[0-9][0-9]*\)/u_int\1/
-# s/Pbyte\([ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*[ ]*:[ ]*SEQSIZ\)/unsigned int\1/
-
-# The change of u_char, etc, to u_int
-# applies to bit fields.
- sed -e '
- s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
- s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
- s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
- s%^\([ ]*#[ ]*endif\)[ ]*[^/ ].*%\1%
- s/#lint(on)/defined(lint)/g
- s/#lint(off)/!defined(lint)/g
- s/#machine(\([^)]*\))/defined(__\1__)/g
- s/#system(\([^)]*\))/defined(__\1__)/g
- s/#cpu(\([^)]*\))/defined(__\1__)/g
- /#[a-z]*if.*[ (]m68k/ s/\([^_]\)m68k/\1__m68k__/g
- /#[a-z]*if.*[ (]__i386\([^_]\)/ s/__i386/__i386__/g
- /#[a-z]*if.*[ (]i386/ s/\([^_]\)i386/\1__i386__/g
- /#[a-z]*if.*[ (!]__i860\([^_]\)/ s/__i860/__i860__/g
- /#[a-z]*if.*[ (!]i860/ s/\([^_]\)i860/\1__i860__/g
- /#[a-z]*if.*[ (]sparc/ s/\([^_]\)sparc/\1__sparc__/g
- /#[a-z]*if.*[ (]mc68000/ s/\([^_]\)mc68000/\1__mc68000__/g
- /#[a-z]*if.*[ (]vax/ s/\([^_]\)vax/\1__vax__/g
- /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)\([^a-z0-9_]\)/\1__\2__\3/g
- /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)$/\1__\2__/g
- /#[a-z]*if.*[ (]ns32000/ s/\([^_]\)ns32000/\1__ns32000__/g
- /#[a-z]*if.*[ (]pyr/ s/\([^_]\)pyr/\1__pyr__/g
- /#[a-z]*if.*[ (]is68k/ s/\([^_]\)is68k/\1__is68k__/g
- s/__STDC__[ ][ ]*==[ ][ ]*0/!defined (__STRICT_ANSI__)/g
- s/__STDC__[ ][ ]*==[ ][ ]*1/defined (__STRICT_ANSI__)/g
- s/__STDC__[ ][ ]*!=[ ][ ]*0/defined (__STRICT_ANSI__)/g
- s/__STDC__[ ][ ]*!=[ ][ ]*1/!defined (__STRICT_ANSI__)/g
- s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
- /^typedef[ ][ ]*[unsigned ]*long[ ][ ]*[u_]*longlong_t;/s/long/long long/
- ' $2/$file > $2/$file.sed
- mv $2/$file.sed $2/$file
- if cmp $file $2/$file >/dev/null 2>&1; then
- rm $2/$file
- else
- echo Fixed $file
- fi
- fi
- done
- shift; shift
-done
-
-# Install the proper definition of the three standard types in header files
-# that they come from.
-for file in sys/types.h stdlib.h sys/stdtypes.h stddef.h memory.h unistd.h; do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- echo Fixing size_t, ptrdiff_t and wchar_t in $file
- sed \
- -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
-#ifndef __SIZE_TYPE__\
-#define __SIZE_TYPE__ long unsigned int\
-#endif
-' \
- -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
- -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
-#ifndef __PTRDIFF_TYPE__\
-#define __PTRDIFF_TYPE__ long int\
-#endif
-' \
- -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
- -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
-#ifndef __WCHAR_TYPE__\
-#define __WCHAR_TYPE__ int\
-#endif
-' \
- -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- fi
- fi
-done
-
-# Fix first broken decl of getcwd present on some svr4 systems.
-
-file=stdlib.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Fix second broken decl of getcwd present on some svr4 systems. Also
-# fix the incorrect decl of profil present on some svr4 systems.
-
-file=unistd.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix \
- | sed -e 's/profil(unsigned short \*, unsigned int, unsigned int, unsigned int)/profil(unsigned short *, size_t, int, unsigned)/' > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Fix the definition of NULL in <sys/param.h> so that it is conditional
-# and so that it is correct for both C and C++.
-
-file=sys/param.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- chmod a+r /tmp/$base
- sed -e '/^#define[ ]*NULL[ ]*0$/c\
-#ifndef NULL\
-#ifdef __cplusplus\
-#define __NULL_TYPE\
-#else /* !defined(__cplusplus) */\
-#define __NULL_TYPE (void *)\
-#endif /* !defined(__cplusplus) */\
-#define NULL (__NULL_TYPE 0)\
-#endif /* !defined(NULL) */' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Likewise fix the definition of NULL in <stdio.h> so that it is conditional
-# and so that it is correct for both C and C++.
-
-file=stdio.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/^#define[ ]*NULL[ ]*0$/c\
-#ifdef __cplusplus\
-#define __NULL_TYPE\
-#else /* !defined(__cplusplus) */\
-#define __NULL_TYPE (void *)\
-#endif /* !defined(__cplusplus) */\
-#define NULL (__NULL_TYPE 0)' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Likewise fix the definition of NULL in <dbm.h> so that it is conditional
-# and so that it is correct for both C and C++.
-
-file=dbm.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/^#define[ ]*NULL[ ]*((char \*) 0)$/c\
-#ifndef NULL\
-#ifdef __cplusplus\
-#define __NULL_TYPE\
-#else /* !defined(__cplusplus) */\
-#define __NULL_TYPE (void *)\
-#endif /* !defined(__cplusplus) */\
-#define NULL (__NULL_TYPE 0)\
-#endif /* !defined(NULL) */' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Add a prototyped declaration of mmap to <sys/mman.h>.
-
-file=sys/mman.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/^extern caddr_t mmap();$/c\
-#ifdef __STDC__\
-extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\
-#else /* !defined(__STDC__) */\
-extern caddr_t mmap ();\
-#endif /* !defined(__STDC__) */' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4 systems
-# the file <ftw.h> contains extern declarations of these functions followed
-# by explicitly `static' definitions of these functions... and that's not
-# allowed according to ANSI C. (Note however that on Solaris, this header
-# file glitch has been pre-fixed by Sun. In the Solaris version of <ftw.h>
-# there are no static definitions of any function so we don't need to do
-# any of this stuff when on Solaris.
-
-file=ftw.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if test -z "$file_to_fix" || grep 'define ftw' $file_to_fix > /dev/null; then
-# Either we have no <ftw.h> file at all, or else we have the pre-fixed Solaris
-# one. Either way, we don't have to do anything.
- true
-else
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/^extern int ftw(const/i\
-#if !defined(_STYPES)\
-static\
-#else\
-extern\
-#endif
-'\
- -e 's/extern \(int ftw(const.*\)$/\1/' \
- -e '/^extern int nftw/i\
-#if defined(_STYPES)\
-static\
-#else\
-extern\
-#endif
-'\
- -e 's/extern \(int nftw.*\)$/\1/' \
- -e '/^extern int ftw(),/c\
-#if !defined(_STYPES)\
-static\
-#else\
-extern\
-#endif\
- int ftw();\
-#if defined(_STYPES)\
-static\
-#else\
-extern\
-#endif\
- int nftw();' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Avoid the definition of the bool type in the Solaris 2.x curses.h when using
-# g++, since it's now an official type in the C++ language.
-file=curses.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e 's,^typedef[ ]char[ ]bool;$,#ifndef __cplusplus\
-typedef char bool;\
-#endif /* !defined __cplusplus */,' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Add a `static' declaration of `getrnge' into <regexp.h>.
-
-# Don't do this if there is already a `static void getrnge' declaration
-# present, since this would cause a redeclaration error. Solaris 2.x has
-# such a declaration.
-
-file=regexp.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep "static void getrnge" $file_to_fix > /dev/null; then
- true
- else
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/^static int[ ]*size;/c\
-static int size ;\
-\
-static int getrnge ();' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
-# that is visible to any ANSI compiler using this include. Simply
-# delete the lines that #define some string functions to internal forms.
-
-file=string.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/#define.*__std_hdr_/d' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
-# tend to conflict with the compiler's own definition of this symbol. (We
-# will use the compiler's definition.)
-# Likewise __sparc, for Solaris, and __i860, and a few others
-# (guessing it is necessary for all of them).
-
-file=ieeefp.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/#define[ ]*__i386 /d' -e '/#define[ ]*__sparc /d' \
- -e '/#define[ ]*__i860 /d' -e '/#define[ ]*__m88k /d' \
- -e '/#define[ ]*__mips /d' -e '/#define[ ]*__m68k /d' \
- /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Add a #define of _SIGACTION_ into <sys/signal.h>.
-# Also fix types of SIG_DFL, SIG_ERR, SIG_IGN, and SIG_HOLD.
-
-file=sys/signal.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/^struct sigaction {/c\
-#define _SIGACTION_\
-struct sigaction {' \
- -e '1,$s/(void *(\*)())/(void (*)(int))/' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
-
-file=sys/mkdev.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/^dev_t makedev(const/c\
-static dev_t makedev(const major_t, const minor_t);' \
- -e '/^dev_t makedev()/c\
-static dev_t makedev();' \
- -e '/^major_t major(const/c\
-static major_t major(const dev_t);' \
- -e '/^major_t major()/c\
-static major_t major();' \
- -e '/^minor_t minor(const/c\
-static minor_t minor(const dev_t);' \
- -e '/^minor_t minor()/c\
-static minor_t minor();' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Fix reference to NMSZ in <sys/adv.h>.
-
-file=sys/adv.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed 's/\[NMSZ\]/\[RFS_NMSZ\]/g' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Fix reference to NC_NPI_RAW in <sys/netcspace.h>. Also fix types of
-# array initializers.
-
-file=sys/netcspace.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed 's/NC_NPI_RAW/NC_TPI_RAW/g' $file_to_fix \
- | sed 's/NC_/(unsigned long) NC_/' > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Conditionalize all of <fs/rfs/rf_cache.h> on _KERNEL being defined.
-
-file=fs/rfs/rf_cache.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep _KERNEL $file_to_fix > /dev/null; then
- true
- else
- echo '#ifdef _KERNEL' > /tmp/$base
- cat $file_to_fix >> /tmp/$base
- echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- rm -f /tmp/$base
- fi
-fi
-
-# Conditionalize all of <sys/erec.h> on _KERNEL being defined.
-
-file=sys/erec.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep _KERNEL $file_to_fix > /dev/null; then
- true
- else
- echo '#ifdef _KERNEL' > /tmp/$base
- cat $file_to_fix >> /tmp/$base
- echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- rm -f /tmp/$base
- fi
-fi
-
-# Conditionalize all of <sys/err.h> on _KERNEL being defined.
-
-file=sys/err.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep _KERNEL $file_to_fix > /dev/null; then
- true
- else
- echo '#ifdef _KERNEL' > /tmp/$base
- cat $file_to_fix >> /tmp/$base
- echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- rm -f /tmp/$base
- fi
-fi
-
-# Conditionalize all of <sys/char.h> on _KERNEL being defined.
-
-file=sys/char.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep _KERNEL $file_to_fix > /dev/null; then
- true
- else
- echo '#ifdef _KERNEL' > /tmp/$base
- cat $file_to_fix >> /tmp/$base
- echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- rm -f /tmp/$base
- fi
-fi
-
-# Conditionalize all of <sys/getpages.h> on _KERNEL being defined.
-
-file=sys/getpages.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep _KERNEL $file_to_fix > /dev/null; then
- true
- else
- echo '#ifdef _KERNEL' > /tmp/$base
- cat $file_to_fix >> /tmp/$base
- echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- rm -f /tmp/$base
- fi
-fi
-
-# Conditionalize all of <sys/map.h> on _KERNEL being defined.
-
-file=sys/map.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep _KERNEL $file_to_fix > /dev/null; then
- true
- else
- echo '#ifdef _KERNEL' > /tmp/$base
- cat $file_to_fix >> /tmp/$base
- echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- rm -f /tmp/$base
- fi
-fi
-
-# Conditionalize all of <sys/cmn_err.h> on _KERNEL being defined.
-
-file=sys/cmn_err.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep _KERNEL $file_to_fix > /dev/null; then
- true
- else
- echo '#ifdef _KERNEL' > /tmp/$base
- cat $file_to_fix >> /tmp/$base
- echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- rm -f /tmp/$base
- fi
-fi
-
-# Conditionalize all of <sys/kdebugger.h> on _KERNEL being defined.
-
-file=sys/kdebugger.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep _KERNEL $file_to_fix > /dev/null; then
- true
- else
- echo '#ifdef _KERNEL' > /tmp/$base
- cat $file_to_fix >> /tmp/$base
- echo '#endif /* defined(_KERNEL) */' >> /tmp/$base
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- rm -f /tmp/$base
- fi
-fi
-
-# Conditionalize some of <netinet/in.h> on _KERNEL being defined.
-# This has been taken out because it breaks on some versions of
-# DYNIX/ptx, and it does not seem to do much good on any system.
-# file=netinet/in.h
-# base=`basename $file`
-# if [ -r ${LIB}/$file ]; then
-# file_to_fix=${LIB}/$file
-# else
-# if [ -r ${INPUT}/$file ]; then
-# file_to_fix=${INPUT}/$file
-# else
-# file_to_fix=""
-# fi
-# fi
-# if [ \! -z "$file_to_fix" ]; then
-# echo Checking $file_to_fix
-# if grep _KERNEL $file_to_fix > /dev/null; then
-# true
-# else
-# sed -e '/#ifdef INKERNEL/i\
-# #ifdef _KERNEL
-# ' \
-# -e '/#endif[ ]*\/\* INKERNEL \*\//a\
-# #endif /* _KERNEL */
-# ' \
-# $file_to_fix > ${LIB}/${file}.sed
-# rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
-# echo Fixed $file_to_fix
-# fi
-# fi
-
-# Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
-
-file=sys/endian.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- if grep __GNUC__ $file_to_fix > /dev/null; then
- true
- else
- sed -e '/# ifdef __STDC__/i\
-# if !defined (__GNUC__) && !defined (__GNUG__)
-' \
- -e '/# include <sys\/byteorder.h>/s/ / /'\
- -e '/# include <sys\/byteorder.h>/i\
-# endif /* !defined (__GNUC__) && !defined (__GNUG__) */
-'\
- $file_to_fix > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- echo Fixed $file_to_fix
- fi
-fi
-
-# Commented out because tmcconne@sedona.intel.com says we don't clearly need it
-# and the text in types.h is not erroneous.
-## In sys/types.h, don't name the enum for booleans.
-#
-#file=sys/types.h
-#base=`basename $file`
-#if [ -r ${LIB}/$file ]; then
-# file_to_fix=${LIB}/$file
-#else
-# if [ -r ${INPUT}/$file ]; then
-# file_to_fix=${INPUT}/$file
-# else
-# file_to_fix=""
-# fi
-#fi
-#if [ \! -z "$file_to_fix" ]; then
-# echo Checking $file_to_fix
-# if grep "enum boolean" $file_to_fix > /dev/null; then
-# sed -e 's/enum boolean/enum/' ${LIB}/$file > ${LIB}/${file}.sed
-# rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
-# echo Fixed $file_to_fix
-# else
-# true
-# fi
-#fi
-
-# Remove useless extern keyword from struct forward declarations in
-# <sys/stream.h> and <sys/strsubr.h>
-
-file=sys/stream.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '
- s/extern struct stdata;/struct stdata;/g
- s/extern struct strevent;/struct strevent;/g
- ' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-file=sys/strsubr.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '
- s/extern struct strbuf;/struct strbuf;/g
- s/extern struct uio;/struct uio;/g
- s/extern struct thread;/struct thread;/g
- s/extern struct proc;/struct proc;/g
- ' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Put storage class at start of decl, to avoid warning.
-file=rpc/types.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '
- s/const extern/extern const/g
- ' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Convert functions to prototype form, and fix arg names in <sys/stat.h>.
-
-file=sys/stat.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '/^stat([ ]*[^c]/{
-N
-N
-s/(.*)\n/( /
-s/;\n/, /
-s/;$/)/
-}' \
- -e '/^lstat([ ]*[^c]/{
-N
-N
-s/(.*)\n/( /
-s/;\n/, /
-s/;$/)/
-}' \
- -e '/^fstat([ ]*[^i]/{
-N
-N
-s/(.*)\n/( /
-s/;\n/, /
-s/;$/)/
-}' \
- -e '/^mknod([ ]*[^c]/{
-N
-N
-N
-s/(.*)\n/( /
-s/;\n/, /g
-s/;$/)/
-}' \
- -e '1,$s/\([^A-Za-z]\)path\([^A-Za-z]\)/\1__path\2/g' \
- -e '1,$s/\([^A-Za-z]\)buf\([^A-Za-z]\)/\1__buf\2/g' \
- -e '1,$s/\([^A-Za-z]\)fd\([^A-Za-z]\)/\1__fd\2/g' \
- -e '1,$s/ret\([^u]\)/__ret\1/g' \
- -e '1,$s/\([^_]\)mode\([^_]\)/\1__mode\2/g' \
- -e '1,$s/\([^_r]\)dev\([^_]\)/\1__dev\2/g' /tmp/$base > /tmp/$base.sed
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base.sed ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base /tmp/$base.sed
-fi
-
-# Sony NEWSOS 5.0 does not support the complete ANSI C standard.
-
-if [ -x /bin/sony ]; then
- if /bin/sony; then
-
- # Change <stdio.h> to not define __filbuf, __flsbuf, and __iob
-
- file=stdio.h
- base=`basename $file`
- if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
- else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
- fi
- if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '
- s/__filbuf/_filbuf/g
- s/__flsbuf/_flsbuf/g
- s/__iob/_iob/g
- ' /tmp/$base > /tmp/$base.sed
- mv /tmp/$base.sed /tmp/$base
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
- fi
-
- # Change <ctype.h> to not define __ctype
-
- file=ctype.h
- base=`basename $file`
- if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
- else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
- fi
- if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- cp $file_to_fix /tmp/$base
- chmod +w /tmp/$base
- sed -e '
- s/__ctype/_ctype/g
- ' /tmp/$base > /tmp/$base.sed
- mv /tmp/$base.sed /tmp/$base
- if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
- fi
- fi
-fi
-
-# In limits.h, put #ifndefs around things that are supposed to be defined
-# in float.h to avoid redefinition errors if float.h is included first.
-# Solaris 2.1 has this problem.
-
-file=limits.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '/[ ]FLT_MIN[ ]/i\
-#ifndef FLT_MIN
-'\
- -e '/[ ]FLT_MIN[ ]/a\
-#endif
-'\
- -e '/[ ]FLT_MAX[ ]/i\
-#ifndef FLT_MAX
-'\
- -e '/[ ]FLT_MAX[ ]/a\
-#endif
-'\
- -e '/[ ]FLT_DIG[ ]/i\
-#ifndef FLT_DIG
-'\
- -e '/[ ]FLT_DIG[ ]/a\
-#endif
-'\
- -e '/[ ]DBL_MIN[ ]/i\
-#ifndef DBL_MIN
-'\
- -e '/[ ]DBL_MIN[ ]/a\
-#endif
-'\
- -e '/[ ]DBL_MAX[ ]/i\
-#ifndef DBL_MAX
-'\
- -e '/[ ]DBL_MAX[ ]/a\
-#endif
-'\
- -e '/[ ]DBL_DIG[ ]/i\
-#ifndef DBL_DIG
-'\
- -e '/[ ]DBL_DIG[ ]/a\
-#endif
-' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Completely replace <sys/varargs.h> with a file that includes gcc's
-# stdarg.h or varargs.h files as appropriate.
-
-file=sys/varargs.h
-if [ -r ${INPUT}/$file ]; then
- echo Replacing $file
- cat > ${LIB}/$file << EOF
-/* This file was generated by fixincludes. */
-#ifndef _SYS_VARARGS_H
-#define _SYS_VARARGS_H
-
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#endif /* _SYS_VARARGS_H */
-EOF
- chmod a+r ${LIB}/$file
-fi
-
-# In math.h, put #ifndefs around things that might be defined in a gcc
-# specific math-*.h file.
-
-file=math.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '/define[ ]HUGE_VAL[ ]/i\
-#ifndef HUGE_VAL
-'\
- -e '/define[ ]HUGE_VAL[ ]/a\
-#endif
-' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-# Solaris math.h and floatingpoint.h define __P without protection,
-# which conflicts with the fixproto definition. The fixproto
-# definition and the Solaris definition are used the same way.
-for file in math.h floatingpoint.h; do
- base=`basename $file`
- if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
- else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
- fi
- if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '/^#define[ ]*__P/i\
-#ifndef __P
-'\
- -e '/^#define[ ]*__P/a\
-#endif
-' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
- fi
-done
-
-# The Solaris math.h defines struct exception, which conflicts with
-# the class exception defined in the C++ file std/stdexcept.h. We
-# redefine it to __math_exception. This is not a great fix, but I
-# haven't been able to think of anything better.
-file=math.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '/struct exception/i\
-#ifdef __cplusplus\
-#define exception __math_exception\
-#endif'\
- -e '/struct exception/a\
-#ifdef __cplusplus\
-#undef exception\
-#endif' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-echo 'Removing unneeded directories:'
-cd $LIB
-files=`find . -type d -print | sort -r`
-for file in $files; do
- rmdir $LIB/$file > /dev/null 2>&1
-done
-
-if $LINKS; then
- echo 'Making internal symbolic non-directory links'
- cd ${INPUT}
- files=`find . -type l -print`
- for file in $files; do
- dest=`ls -ld $file | sed -n 's/.*-> //p'`
- if expr "$dest" : '[^/].*' > /dev/null; then
- target=${LIB}/`echo $file | sed "s|[^/]*\$|$dest|"`
- if [ -f $target ]; then
- ln -s $dest ${LIB}/$file >/dev/null 2>&1
- fi
- fi
- done
-fi
-
-cd ${ORIG_DIR}
-
-echo 'Replacing <sys/byteorder.h>'
-if [ \! -d $LIB/sys ]; then
- mkdir $LIB/sys
-fi
-rm -f ${LIB}/sys/byteorder.h
-cat <<'__EOF__' >${LIB}/sys/byteorder.h
-#ifndef _SYS_BYTEORDER_H
-#define _SYS_BYTEORDER_H
-
-/* Functions to convert `short' and `long' quantities from host byte order
- to (internet) network byte order (i.e. big-endian).
-
- Written by Ron Guilmette (rfg@ncd.com).
-
- This isn't actually used by GCC. It is installed by fixinc.svr4.
-
- For big-endian machines these functions are essentially no-ops.
-
- For little-endian machines, we define the functions using specialized
- asm sequences in cases where doing so yields better code (e.g. i386). */
-
-#if !defined (__GNUC__) && !defined (__GNUG__)
-#error You lose! This file is only useful with GNU compilers.
-#endif
-
-#ifndef __BYTE_ORDER__
-/* Byte order defines. These are as defined on UnixWare 1.1, but with
- double underscores added at the front and back. */
-#define __LITTLE_ENDIAN__ 1234
-#define __BIG_ENDIAN__ 4321
-#define __PDP_ENDIAN__ 3412
-#endif
-
-#ifdef __STDC__
-static __inline__ unsigned long htonl (unsigned long);
-static __inline__ unsigned short htons (unsigned int);
-static __inline__ unsigned long ntohl (unsigned long);
-static __inline__ unsigned short ntohs (unsigned int);
-#endif /* defined (__STDC__) */
-
-#if defined (__i386__)
-
-#ifndef __BYTE_ORDER__
-#define __BYTE_ORDER__ __LITTLE_ENDIAN__
-#endif
-
-/* Convert a host long to a network long. */
-
-/* We must use a new-style function definition, so that this will also
- be valid for C++. */
-static __inline__ unsigned long
-htonl (unsigned long __arg)
-{
- register unsigned long __result;
-
- __asm__ ("xchg%B0 %b0,%h0\n\
- ror%L0 $16,%0\n\
- xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
- return __result;
-}
-
-/* Convert a host short to a network short. */
-
-static __inline__ unsigned short
-htons (unsigned int __arg)
-{
- register unsigned short __result;
-
- __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
- return __result;
-}
-
-#elif ((defined (__i860__) && !defined (__i860_big_endian__)) \
- || defined (__ns32k__) || defined (__vax__) \
- || defined (__spur__) || defined (__arm__))
-
-#ifndef __BYTE_ORDER__
-#define __BYTE_ORDER__ __LITTLE_ENDIAN__
-#endif
-
-/* For other little-endian machines, using C code is just as efficient as
- using assembly code. */
-
-/* Convert a host long to a network long. */
-
-static __inline__ unsigned long
-htonl (unsigned long __arg)
-{
- register unsigned long __result;
-
- __result = (__arg >> 24) & 0x000000ff;
- __result |= (__arg >> 8) & 0x0000ff00;
- __result |= (__arg << 8) & 0x00ff0000;
- __result |= (__arg << 24) & 0xff000000;
- return __result;
-}
-
-/* Convert a host short to a network short. */
-
-static __inline__ unsigned short
-htons (unsigned int __arg)
-{
- register unsigned short __result;
-
- __result = (__arg << 8) & 0xff00;
- __result |= (__arg >> 8) & 0x00ff;
- return __result;
-}
-
-#else /* must be a big-endian machine */
-
-#ifndef __BYTE_ORDER__
-#define __BYTE_ORDER__ __BIG_ENDIAN__
-#endif
-
-/* Convert a host long to a network long. */
-
-static __inline__ unsigned long
-htonl (unsigned long __arg)
-{
- return __arg;
-}
-
-/* Convert a host short to a network short. */
-
-static __inline__ unsigned short
-htons (unsigned int __arg)
-{
- return __arg;
-}
-
-#endif /* big-endian */
-
-/* Convert a network long to a host long. */
-
-static __inline__ unsigned long
-ntohl (unsigned long __arg)
-{
- return htonl (__arg);
-}
-
-/* Convert a network short to a host short. */
-
-static __inline__ unsigned short
-ntohs (unsigned int __arg)
-{
- return htons (__arg);
-}
-
-__EOF__
-
-if [ -r ${INPUT}/sys/byteorder.h ]; then
- if grep BYTE_ORDER ${INPUT}/sys/byteorder.h >/dev/null 2>/dev/null; then
- cat <<'__EOF__' >>${LIB}/sys/byteorder.h
-#ifndef BYTE_ORDER
-#define LITTLE_ENDIAN __LITTLE_ENDIAN__
-#define BIG_ENDIAN __BIG_ENDIAN__
-#define PDP_ENDIAN __PDP_ENDIAN__
-#define BYTE_ORDER __BYTE_ORDER__
-#endif
-
-__EOF__
- fi
-fi
-
-cat <<'__EOF__' >>${LIB}/sys/byteorder.h
-#endif /* !defined (_SYS_BYTEORDER_H) */
-__EOF__
-
-chmod a+r ${LIB}/sys/byteorder.h
-
-exit 0
-
diff --git a/gcc/fixinc.winnt b/gcc/fixinc.winnt
deleted file mode 100644
index 915ac723b85..00000000000
--- a/gcc/fixinc.winnt
+++ /dev/null
@@ -1,232 +0,0 @@
-#! sh
-#
-# fixinc.winnt -- Install modified versions of Windows NT system include
-# files.
-#
-# Based on fixinc.sco script by Ian Lance Taylor (ian@airs.com)).
-# Modifications by Douglas Rupp (drupp@cs.washington.edu)
-#
-# 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 script munges the native include files provided with Windows NT
-# 3.5 SDK systems so as to provide a reasonable namespace when
-# compiling with gcc. The header files by default do not
-# provide many essential definitions and declarations if
-# __STDC__ is 1. This script modifies the header files to check
-# for __STRICT_ANSI__ being defined instead. Once munged, the
-# resulting new system include files are placed in a directory
-# that GNU C will search *before* searching the Include
-# directory.
-#
-# See README-fixinc for more information.
-
-ORIG_DIR=`pwd`
-
-# Directory containing the original header files.
-cd $2; SEDFILE=`${PWDCMD-pwd}`/fixinc-nt.sed
-echo $SEDFILE
-if [ ! -f $SEDFILE ]
-then echo fixincludes: sed script 'fixinc-nt.sed' not found
-exit 1
-fi
-echo 'Using sed script: ' ${SEDFILE}
-
-cd $ORIG_DIR
-
-INPUT=${INCLUDE}
-echo 'Using the Include environment variable to find header files to fix'
-
-# Fail if no arg to specify a directory for the output.
-if [ x$1 = x ]
-then echo fixincludes: no output directory specified
-exit 1
-fi
-
-# Directory in which to store the results.
-LIB=${1?"fixincludes: output directory not specified"}
-
-# Make sure it exists.
-if [ ! -d $LIB ]; then
- mkdir $LIB || exit 1
-fi
-
-ORIG_DIR=`pwd`
-
-# Make LIB absolute if it is relative.
-# Don't do this if not necessary, since may screw up automounters.
-case $LIB in
-/*)
- ;;
-*)
- cd $LIB; LIB=`${PWDCMD-pwd}`
- ;;
-esac
-
-echo 'Building fixincludes in ' ${LIB}
-
-# Determine whether this filesystem has symbolic links.
-if ln -s X $LIB/ShouldNotExist 2>NUL; then
- rm -f $LIB/ShouldNotExist
- LINKS=true
-else
- LINKS=false
-fi
-
-echo 'Making directories:'
-cd ${INPUT}
-if $LINKS; then
- files=`ls -LR | sed -n s/:$//p`
-else
- files=`find . -type d -print | sed '/^.$/d'`
-fi
-for file in $files; do
- rm -rf $LIB/$file
- if [ ! -d $LIB/$file ]
- then mkdir $LIB/$file
- fi
-done
-
-# treetops gets an alternating list
-# of old directories to copy
-# and the new directories to copy to.
-treetops="${INPUT} ${LIB}"
-
-set - $treetops
-while [ $# != 0 ]; do
- # $1 is an old directory to copy, and $2 is the new directory to copy to.
- echo "Finding header files in $1:"
- cd ${INPUT}
- cd $1
- files=`find . -name '*.[hH]' -type f -print`
- echo 'Checking header files:'
- for file in $files; do
- echo $file
- if egrep "!__STDC__" $file >NUL; then
- if [ -r $file ]; then
- cp $file $2/$file >NUL 2>&1 || echo "Can't copy $file"
- chmod +w,a+r $2/$file
-
-# The following have been removed from the sed command below
-# because it is more useful to leave these things in.
-# The only reason to remove them was for -pedantic,
-# which isn't much of a reason. -- rms.
-# /^[ ]*#[ ]*ident/d
-
- sed -e '
- s/!__STDC__/!defined (__STRICT_ANSI__)/g
- ' $2/$file > $2/$file.sed
- mv $2/$file.sed $2/$file
- if cmp $file $2/$file >NUL 2>&1; then
- rm $2/$file
- else
- echo Fixed $file
- fi
- fi
- fi
- done
- shift; shift
-done
-
-# Fix first broken decl of getcwd present on some svr4 systems.
-
-file=direct.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e 's/getcwd(char \*, int)/getcwd(char *, size_t)/' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >NUL 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-file=rpcndr.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e 's/Format\[\]/Format\[1\]/' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >NUL 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-file=winnt.h
-base=`basename $file`
-if [ -r ${LIB}/$file ]; then
- file_to_fix=${LIB}/$file
-else
- if [ -r ${INPUT}/$file ]; then
- file_to_fix=${INPUT}/$file
- else
- file_to_fix=""
- fi
-fi
-if [ \! -z "$file_to_fix" ]; then
- echo Checking $file_to_fix
- sed -e '
- s/^#if !defined (__cplusplus)/#if 0/
- s/^#define DECLSPEC_IMPORT __declspec(dllimport)/#define DECLSPEC_IMPORT/
- ' $file_to_fix > /tmp/$base
- if cmp $file_to_fix /tmp/$base >NUL 2>&1; then \
- true
- else
- echo Fixed $file_to_fix
- rm -f ${LIB}/$file
- cp /tmp/$base ${LIB}/$file
- chmod a+r ${LIB}/$file
- fi
- rm -f /tmp/$base
-fi
-
-echo 'Removing unneeded directories:'
-cd $LIB
-files=`find . -type d -print | sort -r`
-for file in $files; do
- rmdir $LIB/$file > NUL 2>&1
-done
-
-exit 0
diff --git a/gcc/fixincludes b/gcc/fixincludes
deleted file mode 100755
index be267c9ebb2..00000000000
--- a/gcc/fixincludes
+++ /dev/null
@@ -1,2871 +0,0 @@
-#! /bin/sh
-# Install modified versions of certain ANSI-incompatible system header files
-# which are fixed to work correctly with ANSI C
-# and placed in a directory that GNU C will search.
-
-# See README-fixinc for more information.
-
-# Directory containing the original header files.
-# (This was named INCLUDES, but that conflicts with a name in Makefile.in.)
-INPUT=${2-${INPUT-/usr/include}}
-
-# Directory in which to store the results.
-LIB=${1?"fixincludes: output directory not specified"}
-
-# Define PWDCMD as a command to use to get the working dir
-# in the form that we want.
-PWDCMD=pwd
-case "`pwd`" in
-//*)
- # On an Apollo, discard everything before `/usr'.
- PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
- ;;
-esac
-
-# Original directory.
-ORIGDIR=`${PWDCMD}`
-
-# Make sure it exists.
-if [ ! -d $LIB ]; then
- mkdir $LIB || exit 1
-fi
-
-# Make LIB absolute only if needed to avoid problems with the amd.
-case $LIB in
-/*)
- ;;
-*)
- cd $LIB; LIB=`${PWDCMD}`
- ;;
-esac
-
-# Fail if no arg to specify a directory for the output.
-if [ x$1 = x ]
-then echo fixincludes: no output directory specified
-exit 1
-fi
-
-echo Building fixed headers in ${LIB}
-
-# Determine whether this system has symbolic links.
-if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
- rm -f $LIB/ShouldNotExist
- LINKS=true
-elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
- rm -f /tmp/ShouldNotExist
- LINKS=true
-else
- LINKS=false
-fi
-
-echo Finding directories and links to directories
-cd ${INPUT}
-# Find all directories and all symlinks that point to directories.
-# Put the list in $files.
-# Each time we find a symlink, add it to newdirs
-# so that we do another find within the dir the link points to.
-# Note that $files may have duplicates in it;
-# later parts of this file are supposed to ignore them.
-dirs="."
-levels=2
-while [ -n "$dirs" ] && [ $levels -gt 0 ]
-do
- levels=`expr $levels - 1`
- newdirs=
- for d in $dirs
- do
- echo " Searching $INPUT/$d"
-
- # Find all directories under $d, relative to $d, excluding $d itself.
- # (The /. is needed after $d in case $d is a symlink.)
- files="$files `find $d/. -type d -print | \
- sed -e '/\/\.$/d' -e 's@/./@/@g'`"
- # Find all links to directories.
- # Using `-exec test -d' in find fails on some systems,
- # and trying to run test via sh fails on others,
- # so this is the simplest alternative left.
- # First find all the links, then test each one.
- theselinks=
- $LINKS && \
- theselinks=`find $d/. -type l -print | sed -e 's@/./@/@g'`
- for d1 in $theselinks --dummy--
- do
- # If the link points to a directory,
- # add that dir to $newdirs
- if [ -d $d1 ]
- then
- files="$files $d1"
- if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
- then
- newdirs="$newdirs $d1"
- fi
- fi
- done
- done
-
- dirs="$newdirs"
-done
-
-dirs=
-echo "All directories (including links to directories):"
-echo $files
-
-for file in $files; do
- rm -rf $LIB/$file
- if [ ! -d $LIB/$file ]
- then mkdir $LIB/$file
- fi
-done
-mkdir $LIB/root
-
-# treetops gets an alternating list
-# of old directories to copy
-# and the new directories to copy to.
-treetops="${INPUT} ${LIB}"
-
-if $LINKS; then
- echo 'Making symbolic directory links'
- for file in $files; do
- dest=`ls -ld $file | sed -n 's/.*-> //p'`
- if [ "$dest" ]; then
- cwd=`${PWDCMD}`
- # In case $dest is relative, get to $file's dir first.
- cd ${INPUT}
- cd `echo ./$file | sed -n 's&[^/]*$&&p'`
- # Check that the target directory exists.
- # Redirections changed to avoid bug in sh on Ultrix.
- (cd $dest) > /dev/null 2>&1
- if [ $? = 0 ]; then
- cd $dest
- # X gets the dir that the link actually leads to.
- x=`${PWDCMD}`
- # Canonicalize ${INPUT} now to minimize the time an
- # automounter has to change the result of ${PWDCMD}.
- cinput=`cd ${INPUT}; ${PWDCMD}`
- # If a link points to ., make a similar link to .
- if [ $x = ${cinput} ]; then
- echo $file '->' . ': Making link'
- rm -fr ${LIB}/$file > /dev/null 2>&1
- ln -s . ${LIB}/$file > /dev/null 2>&1
- # If link leads back into ${INPUT},
- # make a similar link here.
- elif expr $x : "${cinput}/.*" > /dev/null; then
- # Y gets the actual target dir name, relative to ${INPUT}.
- y=`echo $x | sed -n "s&${cinput}/&&p"`
- # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
- dots=`echo "$file" |
- sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
- echo $file '->' $dots$y ': Making link'
- rm -fr ${LIB}/$file > /dev/null 2>&1
- ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
- else
- # If the link is to a dir $target outside ${INPUT},
- # repoint the link at ${INPUT}/root$target
- # and process $target into ${INPUT}/root$target
- # treat this directory as if it actually contained the files.
- echo $file '->' root$x ': Making link'
- if [ -d $LIB/root$x ]
- then true
- else
- dirname=root$x/
- dirmade=.
- cd $LIB
- while [ x$dirname != x ]; do
- component=`echo $dirname | sed -e 's|/.*$||'`
- mkdir $component >/dev/null 2>&1
- cd $component
- dirmade=$dirmade/$component
- dirname=`echo $dirname | sed -e 's|[^/]*/||'`
- done
- fi
- # Duplicate directory structure created in ${LIB}/$file in new
- # root area.
- for file2 in $files; do
- case $file2 in
- $file/*)
- dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"`
- echo "Duplicating ${file}'s ${dupdir}"
- if [ -d ${dupdir} ]
- then true
- else
- mkdir ${dupdir}
- fi
- ;;
- *)
- ;;
- esac
- done
- # Get the path from ${LIB} to $file, accounting for symlinks.
- parent=`echo "$file" | sed -e 's@/[^/]*$@@'`
- libabs=`cd ${LIB}; ${PWDCMD}`
- file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
- # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
- dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
- rm -fr ${LIB}/$file > /dev/null 2>&1
- ln -s ${dots}root$x ${LIB}/$file > /dev/null 2>&1
- treetops="$treetops $x ${LIB}/root$x"
- fi
- fi
- cd $cwd
- fi
- done
-fi
-
-required=
-set x $treetops
-shift
-while [ $# != 0 ]; do
- # $1 is an old directory to copy, and $2 is the new directory to copy to.
- cd ${INPUT}
- cd $1
-# The same dir can appear more than once in treetops.
-# There's no need to scan it more than once.
- if [ -f $2/DONE ]
- then
- files=
- else
- touch $2/DONE
- echo Fixing directory $1 into $2
-# Check .h files which are symlinks as well as those which are files.
-# A link to a header file will not be processed by anything but this.
- if $LINKS; then
- files=`find . -name '*.h' \( -type f -o -type l \) -print`
- else
- files=`find . -name '*.h' -type f -print`
- fi
- echo Checking header files
- fi
-# Note that BSD43_* are used on recent MIPS systems.
- for file in $files; do
-# This call to egrep is essential, since checking a file with egrep
-# is much faster than actually trying to fix it.
-# It is also essential that most files *not* match!
-# Thus, matching every #endif is unacceptable.
-# But the argument to egrep must be kept small, or many versions of egrep
-# won't be able to handle it.
-#
-# We use the pattern [!-.0-~] instead of [^/ ] to match a noncomment
-# following #else or #endif because some buggy egreps think [^/] matches
-# newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'.
-#
-# We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
-# following #if or #elif that is not surrounded by __. The `a-ce-km-z'
-# in this pattern lacks `d' and `l'; this means we don't worry about
-# identifiers starting with `d' or `l'. This is OK, since none of the
-# identifiers below start with `d' or `l'. It also greatly improves
-# performance, since many files contain lines of the form `#if ... defined ...'
-# or `#if lint'.
- if egrep '//|[ _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[ ]+[!-.0-~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-zA-Z][a-zA-Z0-9]' $file >/dev/null; then
- if [ -r $file ]; then
- cp $file $2/$file >/dev/null 2>&1 \
- || echo "Can't copy $file"
- chmod +w $2/$file
- chmod a+r $2/$file
- # The fixinc_eol stuff is to work around a bug in the sed
- # program on HP/UX 10.20.
- # Here is how the sed commands in braces work.
- # (It doesn't work to put the comments inside the sed commands.)
- # Surround each word with spaces, to simplify matching below.
- # ANSIfy each pre-ANSI machine-dependent symbol
- # by surrounding it with __ __.
- # Remove the spaces that we inserted around each word.
- sed -e '
- :loop
- /\\$/ N
- s/\\$/\\*fixinc_eol*/
- /\\$/ b loop
- s/\\\*fixinc_eol\*/\\/g
- s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
- s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
- s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
- s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
- s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%
- /\/\/[^*]/ s|//\(.*\)$|/*\1*/|
- /[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/
- /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
- /#define._IO/ s/'\''\([cgxtf]\)'\''/\1/g
- /#define.BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g
- /[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
- /[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
- /#define[ ]*[ ]CTRL/ s/'\''\([cgx]\)'\''/\1/g
- /#define[ ]*[ ]_CTRL/ s/'\''\([cgx]\)'\''/\1/g
- /#define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g
- /#[ ]*[el]*if/{
- s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
-
- s/ bsd4\([0-9]\) / __bsd4\1__ /g
- s/ _*host_mips / __host_mips__ /g
- s/ _*i386 / __i386__ /g
- s/ M32 / __M32__ /g
- s/ is68k / __is68k__ /g
- s/ m68k / __m68k__ /g
- s/ mc680\([0-9]\)0 / __mc680\10__ /g
- s/ m88k / __m88k__ /g
- s/ _*mips / __mips__ /g
- s/ news\([0-9]*\) / __news\1__ /g
- s/ ns32000 / __ns32000__ /g
- s/ pdp11 / __pdp11__ /g
- s/ pyr / __pyr__ /g
- s/ sel / __sel__ /g
- s/ sony_news / __sony_news__ /g
- s/ sparc / __sparc__ /g
- s/ sun\([a-z0-9]*\) / __sun\1__ /g
- s/ tahoe / __tahoe__ /g
- s/ tower\([_0-9]*\) / __tower\1__ /g
- s/ u370 / __u370__ /g
- s/ u3b\([0-9]*\) / __u3b\1__ /g
- s/ unix / __unix__ /g
- s/ vax / __vax__ /g
- s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
- s/ _*\([Rr][34]\)000 / __\1000__ /g
- s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
-
- s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
- }
- /^#define.NULL[ ]/ i\
- #undef NULL
- ' $2/$file > $2/$file.
- mv $2/$file. $2/$file
- if cmp $file $2/$file >/dev/null 2>&1 \
- || egrep 'This file is part of the GNU C Library' $2/$file >/dev/null 2>&1; then
- rm $2/$file
- else
- echo Fixed $file
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $2/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required $1 $dir/$include $2/$dir/$include"
- done
- fi
- fi
- fi
- done
- shift; shift
-done
-
-cd ${INPUT}
-
-# Install the proper definition of the three standard types in header files
-# that they come from.
-for file in sys/types.h stdlib.h sys/stdtypes.h stddef.h memory.h unistd.h; do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- echo Fixing size_t, ptrdiff_t and wchar_t in $file
- sed \
- -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
-#ifndef __SIZE_TYPE__\
-#define __SIZE_TYPE__ long unsigned int\
-#endif
-' \
- -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
- -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
-#ifndef __PTRDIFF_TYPE__\
-#define __PTRDIFF_TYPE__ long int\
-#endif
-' \
- -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
- -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
-#ifndef __WCHAR_TYPE__\
-#define __WCHAR_TYPE__ int\
-#endif\
-#ifndef __cplusplus
-' \
- -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\
-#endif
-' \
- -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# Fix one other error in this file: a mismatched quote not inside a C comment.
-file=sundev/vuid_event.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sundev 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file comment
- sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
-file=sunwindow/win_cursor.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
-# mkdir ${LIB}/sunwindow 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
-fi
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-file=sunwindow/win_lock.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
-# mkdir ${LIB}/sunwindow 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
-fi
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix this Sun file to avoid interfering with stddef.h.
-file=sys/stdtypes.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
-sed -e '/[ ]size_t.*;/i\
-#ifndef _GCC_SIZE_T\
-#define _GCC_SIZE_T
-' \
- -e '/[ ]size_t.*;/a\
-#endif
-' \
- -e '/[ ]ptrdiff_t.*;/i\
-#ifndef _GCC_PTRDIFF_T\
-#define _GCC_PTRDIFF_T
-' \
- -e '/[ ]ptrdiff_t.*;/a\
-#endif
-' \
- -e '/[ ]wchar_t.*;/i\
-#ifndef _GCC_WCHAR_T\
-#define _GCC_WCHAR_T
-' \
- -e '/[ ]wchar_t.*;/a\
-#endif
-' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t
-# in cc1plus.
-file=stdlib.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e "s/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
- -e "s/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix this ARM/RISCiX file where ___type is a Compiler hint that is specific to
-# the Norcroft compiler.
-file=X11/Intrinsic.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e "s/___type p_type/p_type/" \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix this file to avoid interfering with stddef.h, but don't mistakenly
-# match ssize_t present in AIX for the ps/2, or typedefs which use (but do not
-# set) size_t.
-file=sys/types.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
-sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
-#ifndef _GCC_SIZE_T\
-#define _GCC_SIZE_T
-' \
- -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
-#endif
-' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix HP's use of ../machine/inline.h to refer to
-# /usr/include/machine/inline.h
-file=sys/spinlock.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file
-fi
-if [ -r ${LIB}/$file ] ; then
- echo Fixing $file
- sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
- -e 's,"../machine/psl.h",<machine/psl.h>,' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix an error in this file: the #if says _cplusplus, not the double
-# underscore __cplusplus that it should be
-file=tinfo.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/rpcsvc 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, __cplusplus macro
- sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix an error in this file: a missing semi-colon at the end of the statsswtch
-# structure definition.
-file=rpcsvc/rstat.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/rpcsvc 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, definition of statsswtch
- sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix an error in this file: a missing semi-colon at the end of the nodeent
-# structure definition.
-file=netdnet/dnetdb.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/netdnet 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, definition of nodeent
- sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Check for bad #ifdef line (in Ultrix 4.1)
-file=sys/file.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, bad \#ifdef line
- sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Check for (...) in C++ code in HP/UX sys/file.h.
-file=sys/file.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if egrep HPUX_SOURCE ${LIB}/$file > /dev/null; then
- echo Fixing $file, use of '(...)'
- sed -e 's/(\.\.\.)/(struct file * ...)/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-fi
-
-# Check for superfluous `static' (in Ultrix 4.2)
-# On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
-file=machine/cpu.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/machine 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, superfluous static and broken includes of other files.
- sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
- -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
- -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
-# This file has an alternative name, mips/cpu.h. Fix that name, too.
- if cmp machine/cpu.h mips/cpu.h > /dev/null 2>&1; then
- mkdir ${LIB}/mips 2>&-
-# Don't remove the file first, they may be the same file!
- ln ${LIB}/$file ${LIB}/mips/cpu.h > /dev/null 2>&1
- fi
- fi
-fi
-
-# Incorrect sprintf declaration in X11/Xmu.h
-file=X11/Xmu.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/X11 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file sprintf declaration
- sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
-extern char * sprintf();\
-#endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Incorrect sprintf declaration in X11/Xmu/Xmu.h
-# (It's not clear whether the right file name is this or X11/Xmu.h.)
-file=X11/Xmu/Xmu.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/X11/Xmu 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file sprintf declaration
- sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
-extern char * sprintf();\
-#endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Check for missing ';' in struct
-file=netinet/ip.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/netinet 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix the CAT macro in SunOS memvar.h.
-file=pixrect/memvar.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/pixrect 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e '/^#define.CAT(a,b)/ i\
-#ifdef __STDC__ \
-#define CAT(a,b) a##b\
-#else
-/^#define.CAT(a,b)/ a\
-#endif
-' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Check for yet more missing ';' in struct (in SunOS 4.0.x)
-file=rpcsvc/rusers.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/rpcsvc 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
-# Also wrap protection around size_t for m88k-sysv3 systems.
-file=stdlib.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/int abort/void abort/g' \
- -e 's/int free/void free/g' \
- -e 's/char[ ]*\*[ ]*calloc/void \* calloc/g' \
- -e 's/char[ ]*\*[ ]*malloc/void \* malloc/g' \
- -e 's/char[ ]*\*[ ]*realloc/void \* realloc/g' \
- -e 's/int[ ][ ]*exit/void exit/g' \
- -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
-#ifndef _GCC_SIZE_T\
-#define _GCC_SIZE_T
-' \
- -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
-#endif
-' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
-# Also fix return type of {m,re}alloc in <malloc.h> on sysV68
-file=malloc.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
- -e 's/int[ ][ ]*free/void free/g' \
- -e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \
- -e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
-file=hsfs/hsfs_spec.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/hsfs 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
- ${LIB}/$file > ${LIB}/${file}.
- rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
-file=hsfs/hsnode.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/hsfs 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
-file=hsfs/iso_spec.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/hsfs 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Incorrect #include in Sony News-OS 3.2.
-file=machine/machparam.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/machine 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, incorrect \#include
- sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
- ${LIB}/$file > ${LIB}/${file}.
- rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Multiline comment after typedef on IRIX 4.0.1.
-file=sys/types.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, comment in the middle of \#ifdef
- sed -e 's@type of the result@type of the result */@' \
- -e 's@of the sizeof@/* of the sizeof@' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Turning // comments into /* */ comments trashes this IRIX 4.0.1
-# header file, which embeds // comments inside multi-line /* */
-# comments. If this looks like the IRIX header file, we refix it by
-# just throwing away the // comments.
-file=fam.h
-if [ -r ${LIB}/$file ]; then
- if egrep indigo.esd ${LIB}/$file > /dev/null; then
- echo Fixing $file, overeager sed script
- rm ${LIB}/$file
- sed -e 's|//.*$||g' $file > ${LIB}/$file
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-fi
-
-# There is a similar problem with the VxWorks drv/netif/if_med.h file.
-file=drv/netif/if_med.h
-if [ -r ${LIB}/$file ]; then
- if egrep 'Wind River' ${LIB}/$file > /dev/null; then
- echo Fixing $file, overeager sed script
- rm ${LIB}/$file
- sed -e 's|//.*$||g' $file > ${LIB}/$file
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-fi
-
-# Some IRIX header files contains the string "//"
-for file in elf_abi.h elf.h; do
- if [ -r ${LIB}/$file ]; then
- echo Fixing $file, overeager sed script
- sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr in prototype without
-# previous definition.
-file=rpc/auth.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/rpc 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, undefined type
- sed -e '/authdes_create.*struct sockaddr/i\
-struct sockaddr;
-' \
- ${LIB}/$file > ${LIB}/$file.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s in prototype without previous
-# definition.
-file=rpc/xdr.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/rpc 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, undefined type
- sed -e '/xdrstdio_create.*struct __file_s/i\
-struct __file_s;
-' \
- ${LIB}/$file > ${LIB}/$file.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Same problem with a file from SunOS 4.1.3 : a header file containing
-# the string "//" embedded in "/**/"
-file=sbusdev/audiovar.h
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, overeager sed script
- rm ${LIB}/$file
- sed -e 's|//.*$||g' $file > ${LIB}/$file
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-# Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
-# declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
-# many other systems have similar text but correct versions of the file.
-# To ensure only Sun's is fixed, we grep for a likely unique string.
-# Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t )
-file=memory.h
-if [ -r $file ] && egrep '/\* @\(#\)(head/memory.h 50.1 |memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 )\*/' $file > /dev/null; then
- if [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
- if [ -r ${LIB}/$file ]; then
- echo Replacing $file
- cat > ${LIB}/$file << EOF
-/* This file was generated by fixincludes */
-#ifndef __memory_h__
-#define __memory_h__
-
-#ifdef __STDC__
-extern void *memccpy();
-extern void *memchr();
-extern void *memcpy();
-extern void *memset();
-#else
-extern char *memccpy();
-extern char *memchr();
-extern char *memcpy();
-extern char *memset();
-#endif /* __STDC__ */
-
-extern int memcmp();
-
-#endif /* __memory_h__ */
-EOF
- fi
-fi
-
-# Fix return type of fread and fwrite on sysV68
-file=stdio.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, fread and fwrite return type
- sed -e 's/^\(extern int fclose(), fflush()\), \(fread(), fwrite()\)\(.*\)$/extern unsigned int \2;\
-\1\3/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# parameters not const on DECstation Ultrix V4.0 and OSF/1.
-file=stdio.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, non-const arg
- sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
- -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
- -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
- -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
- -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
- -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
- -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
- -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
- -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# parameters conflict with C++ new on rs/6000
-for file in stdio.h unistd.h ; do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- echo Fixing $file, parameter name conflicts
- sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# function class(double x) conflicts with C++ keyword on rs/6000
-file=math.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if grep '[^a-zA-Z_]class[(]' ${LIB}/$file >/dev/null; then
- echo Fixing $file
- sed -e '/class[(]/i\
-#ifndef __cplusplus
-' \
- -e '/class[(]/a\
-#endif
-' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-fi
-
-# Wrong fchmod prototype on RS/6000.
-file=sys/stat.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, fchmod prototype
- sed -e 's/fchmod(char \*/fchmod(int/' \
- ${LIB}/$file > ${LIB}/$file.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# There are several name conflicts with C++ reserved words in X11
-# header files. These are fixed in some versions, so don't do the
-# fixes if we find __cplusplus in the file. These were found on the
-# RS/6000.
-
-# class in X11/ShellP.h
-file=X11/ShellP.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
- true;
- else
- echo Fixing $file, field class
- sed -e '/char [*]class;/i\
-#ifdef __cplusplus\
- char *c_class;\
-#else
-' \
- -e '/char [*]class;/a\
-#endif
-' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-# new in Xm/Traversal.h
-file=Xm/Traversal.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
- true;
- else
- echo Fixing $file, uses of new
- sed -e '/Widget old, new;/i\
-#ifdef __cplusplus\
- Widget old, c_new;\
-#else
-' \
- -e '/Widget old, new;/a\
-#endif
-' \
- -e 's/Widget new,/Widget c_new,/g' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-# class in Xm/BaseClassI.h
-file=Xm/BaseClassI.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
- true;
- else
- echo Fixing $file, prototype parameter name
- sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# NeXT 3.2 adds const prefix to some math functions. These conflict
-# with the built-in functions.
-file=ansi/math.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
-fi
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \
- -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \
- -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
- -e '/^extern.*double.*__const__.*sin(/s/__const__//' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# NeXT 3.2 uses the word "template" as a parameter for some
-# functions. GCC reports an invalid use of a reserved key word
-# with the built-in functions. NeXT 3.2 includes the keyword
-# volatile in the prototype for abort(). This conflicts with
-# the built-in definition.
-file=bsd/libc.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
-fi
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e '/\(.*template\)/s/template//' \
- -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# NeXT 3.2 includes the keyword volatile in the abort() and
-# exit() function prototypes. That conflicts with the
-# built-in functions.
-file=ansi/stdlib.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
-fi
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
- -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
-# of struct rusage, so the prototype (added by fixproto) causes havoc.
-file=sys/wait.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ] \
- && grep 'bos325,' ${LIB}/$file >/dev/null; then
- echo Fixing $file, wait3 declaration
- sed -e '/^extern pid_t wait3();$/i\
-struct rusage;
-'\
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
-# Note that version 3 of the NeXT system has wait.h in a different directory,
-# so that this code won't do anything. But wait.h in version 3 has a
-# conditional, so it doesn't need this fix. So everything is okay.
-file=sys/wait.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ] \
- && grep 'wait[(]union wait' ${LIB}/$file >/dev/null; then
- echo Fixing $file, bad wait formal
- sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Don't use or define the name va_list in stdio.h.
-# This is for ANSI and also to interoperate properly with gcc's varargs.h.
-file=stdio.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, use of va_list
- # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
- if egrep "__need___va_list" ${LIB}/$file >/dev/null 2>&1; then
- touch ${LIB}/${file}.sed
- else
- (echo "#define __need___va_list"
- echo "#include <stdarg.h>") > ${LIB}/${file}.sed
- fi
- # Use __gnuc_va_list in arg types in place of va_list.
- # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
- # trailing parentheses and semicolon save all other systems from this.
- # Define __va_list__ (something harmless and unused) instead of va_list.
- # Don't claim to have defined va_list.
- sed -e 's@ va_list @ __gnuc_va_list @' \
- -e 's@ va_list)@ __gnuc_va_list)@' \
- -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
- -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
- -e 's@ va_list@ __va_list__@' \
- -e 's@\*va_list@*__va_list__@' \
- -e 's@ __va_list)@ __gnuc_va_list)@' \
- -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
- -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
- -e 's@VA_LIST@DUMMY_VA_LIST@' \
- -e 's@_Va_LIST@_VA_LIST@' \
- ${LIB}/$file >> ${LIB}/${file}.sed
-
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
-file=ansi_compat.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- if grep -s ULTRIX $file; then
- echo "/* This file intentionally left blank. */" > $LIB/$file
- fi
-fi
-
-# parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
-# also get rid of bogus inline definitions in HP-UX 8.0
-file=math.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, non-const arg
- sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \
- -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \
- -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
- -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
- -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# fix bogus recursive stdlib.h in NEWS-OS 4.0C
-file=stdlib.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, recursive inclusion
- sed -e '/^#include <stdlib.h>/i\
-#if 0
-' \
- -e '/^#include <stdlib.h>/a\
-#endif
-' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Avoid nested comments on Ultrix 4.3.
-file=rpc/svc.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/rpc 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, nested comment
- sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
- ${LIB}/$file > ${LIB}/$file.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# This file in RISC/os uses /**/ to concatenate two tokens.
-file=bsd43/bsd43_.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-if [ -r ${LIB}/$file ]; then
- sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-file=rpc/rpc.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/rpc 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, nested comment
- sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
- ${LIB}/$file > ${LIB}/$file.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C
-# is defined for the alpha. The problem is the declaration of malloc.
-file=rpc/types.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/rpc 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-if [ -r ${LIB}/$file ]; then
- if egrep '"C"' ${LIB}/$file >/dev/null 2>&1; then
- true
- else
- echo Fixing $file
- echo '#ifdef __cplusplus
-extern "C" {
-#endif' > ${LIB}/${file}.sed
- cat ${LIB}/${file} >> ${LIB}/${file}.sed
- echo '#ifdef __cplusplus
-}
-#endif' >> ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-fi
-
-# In limits.h, put #ifndefs around things that are supposed to be defined
-# in float.h to avoid redefinition errors if float.h is included first.
-# On HP/UX this patch does not work, because on HP/UX limits.h uses
-# multi line comments and the inserted #endif winds up inside the
-# comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
-# we find a #ifndef FLT_MIN we assume that all the required #ifndefs
-# are there, and we do not add them ourselves.
-for file in limits.h sys/limits.h; do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev/null; then
- true
- else
- echo Fixing $file
- sed -e '/[ ]FLT_MIN[ ]/i\
-#ifndef FLT_MIN
-'\
- -e '/[ ]FLT_MIN[ ]/a\
-#endif
-'\
- -e '/[ ]FLT_MAX[ ]/i\
-#ifndef FLT_MAX
-'\
- -e '/[ ]FLT_MAX[ ]/a\
-#endif
-'\
- -e '/[ ]FLT_DIG[ ]/i\
-#ifndef FLT_DIG
-'\
- -e '/[ ]FLT_DIG[ ]/a\
-#endif
-'\
- -e '/[ ]DBL_MIN[ ]/i\
-#ifndef DBL_MIN
-'\
- -e '/[ ]DBL_MIN[ ]/a\
-#endif
-'\
- -e '/[ ]DBL_MAX[ ]/i\
-#ifndef DBL_MAX
-'\
- -e '/[ ]DBL_MAX[ ]/a\
-#endif
-'\
- -e '/[ ]DBL_DIG[ ]/i\
-#ifndef DBL_DIG
-'\
- -e '/[ ]DBL_DIG[ ]/a\
-#endif
-'\
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- echo Deleting ${LIB}/$file\; no fixes were needed.
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# In math.h, put #ifndefs around things that might be defined in a gcc
-# specific math-*.h file.
-file=math.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e '/define[ ]HUGE_VAL[ ]/i\
-#ifndef HUGE_VAL
-'\
- -e '/define[ ]HUGE_VAL[ ]/a\
-#endif
-'\
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
-
- # In addition, copy the definition of DBL_MAX from float.h
- # if math.h requires one. The Lynx math.h requires it.
- if egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file >/dev/null 2>&1; then
- if egrep '#define[ ]+DBL_MAX[ ]+' $file >/dev/null 2>&1; then
- true;
- else
- dbl_max_def=`egrep 'define[ ]+DBL_MAX[ ]+.*' float.h 2>/dev/null`
- if [ "$dbl_max_def" != "" ]; then
- dbl_max_def=`echo $dbl_max_def | sed 's/.*define[ ]*DBL_MAX[ ]*//'`
- sed -e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/" \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- fi
- fi
-
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- echo Deleting ${LIB}/$file\; no fixes were needed.
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Remove erroneous parentheses in sym.h on Alpha OSF/1.
-file=sym.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
-# in string.h on sysV68
-# Correct the return type for strlen in string.h on Lynx.
-# Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
-# Add missing const for strdup on OSF/1 V3.0.
-file=string.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, mem{ccpy,chr,cpy,set} and str{len,spn,cspn} return value
- sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
- -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
- -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
- -e '/^extern char$/N' \
- -e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/'\
- -e '/^ strncmp(),$/N'\
- -e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\
-extern unsigned int\
-\2/'\
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Correct the return type for strlen in strings.h in SunOS 4.
-file=strings.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Delete the '#define void int' line from curses.h on Lynx
-file=curses.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix `typedef struct term;' on hppa1.1-hp-hpux9.
-file=curses.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# For C++, avoid any typedef or macro definition of bool, and use the
-# built in type instead.
-for files in curses.h; do
- if [ -r $file ] && egrep bool $file >/dev/null 2>&1; then
- if [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- echo Fixing $file
- sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
-#ifndef __cplusplus
-'\
- -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
-#endif
-'\
- -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\
-#ifndef __cplusplus
-'\
- -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\
-#endif
-'\
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# Fix incorrect S_IF* definitions on m88k-sysv3.
-file=sys/stat.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(S_IF[A-Z][A-Z][A-Z][A-Z]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
- -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
-for file in stdio.h stdlib.h; do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- echo Fixing $file, getopt declaration
- sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# Fix __page_size* declarations in pthread.h AIX 4.1.[34].
-# The original ones fail if uninitialized externs are not common.
-# This is the default for all ANSI standard C++ compilers.
-for file in pthread.h; do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- echo Fixing $file, __page_size* declarations
- sed -e 's/^int __page_size/extern int __page_size/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# Determine if we're on Interactive Unix 2.2 or later, in which case we
-# need to fix some additional files. This is the same test for ISC that
-# Autoconf uses.
-if test -d /etc/conf/kconfig.d \
- && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1; then
- echo "Fixing ISC __STDC__ goof in several files..."
- for name in stdio.h math.h ctype.h sys/limits.h sys/fcntl.h sys/dirent.h; do
- echo $name
- if test -r ${LIB}/$name; then
- file=${LIB}/$name
- else
- file=${INPUT}/$name
- fi
- # On Interactive 2.2, certain traditional Unix definitions
- # (notably getc and putc in stdio.h) are omitted if __STDC__ is
- # defined, not just if _POSIX_SOURCE is defined. This makes it
- # impossible to compile any nontrivial program except with -posix.
- sed \
-'s/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
- < $file > ${LIB}/$name.
- mv ${LIB}/$name. ${LIB}/$name
- done
-
- echo "Fixing ISC fmod declaration"
- # This one's already been fixed for other things.
- file=${LIB}/math.h
- sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
- mv $file. $file
-
- echo "Fixing nested comments in ISC <sys/limits.h>"
- file=sys/limits.h
- sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
- sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file. >${LIB}/$file
-fi
-
-# These files in Sun OS 4.x use /**/ to concatenate tokens.
-for file in sparc/asm_linkage.h sun3/asm_linkage.h sun3x/asm_linkage.h \
- sun4/asm_linkage.h sun4c/asm_linkage.h sun4m/asm_linkage.h \
- sun4c/debug/asm_linkage.h sun4m/debug/asm_linkage.h;
-do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# These files in ARM/RISCiX use /**/ to concatenate tokens.
-for file in arm/as_support.h arm/mc_type.h arm/xcb.h dev/chardefmac.h \
- dev/ps_irq.h dev/screen.h dev/scsi.h sys/tty.h Xm.acorn/XmP.h
-do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# math.h on SunOS 4 puts the declaration of matherr before the definition
-# of struct exception, so the prototype (added by fixproto) causes havoc.
-file=math.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, matherr declaration
- sed -e '/^struct exception/,$b' \
- -e '/matherr/i\
-struct exception;
-'\
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# assert.h and sys/mman.h on HP/UX are not C++ ready, even though
-# NO_IMPLICIT_EXTERN_C is defined on HP/UX.
-for file in assert.h sys/mman.h; do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- if egrep '"C"' ${LIB}/$file >/dev/null 2>&1 \
- || egrep '__BEGIN_DECLS' ${LIB}/$file >/dev/null 2>&1; then
- true
- else
- echo Fixing $file
- echo '#ifdef __cplusplus
-extern "C" {
-#endif' > ${LIB}/${file}.sed
- cat ${LIB}/${file} >> ${LIB}/${file}.sed
- echo '#ifdef __cplusplus
-}
-#endif' >> ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# check for broken assert.h that needs stdio.h or stdlib.h
-file=assert.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if grep 'stderr' ${LIB}/$file >/dev/null 2>/dev/null; then
- if grep 'include.*stdio.h' ${LIB}/$file >/dev/null 2>/dev/null; then
- true
- else
- echo "Fixing $file (needs stdio.h)"
- echo '#include <stdio.h>' >>${LIB}/$file
- fi
- fi
- if grep 'exit *(' ${LIB}/$file >/dev/null 2>/dev/null ||
- grep 'abort *(' ${LIB}/$file >/dev/null 2>/dev/null; then
- if grep 'include.*stdlib.h' ${LIB}/$file >/dev/null 2>/dev/null; then
- true
- else
- echo "Fixing $file (needs stdlib.h)"
- echo '#ifdef __cplusplus
-#include <stdlib.h>
-#endif' >>${LIB}/$file
- fi
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
-file=unistd.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, sbrk declaration
- sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# This file on SunOS 4 has a very large macro. When the sed loop
-# tries pull it in, it overflows the pattern space size of the SunOS
-# sed (GNU sed does not have this problem). Since the file does not
-# require fixing, we remove it from the fixed directory.
-file=sundev/ipi_error.h
-if [ -r ${LIB}/$file ]; then
- echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>"
- rm -f ${LIB}/$file
-fi
-
-# Put cpp wrappers around these include files to avoid redeclaration
-# errors during multiple inclusion on m88k-tektronix-sysv3.
-for file in time.h sys/time.h ; do
- if egrep '#ifndef' $file >/dev/null 2>&1; then
- true
- else
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- fi
- if [ -r ${LIB}/$file ]; then
- echo Fixing $file, to protect against multiple inclusion.
- cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
- (echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
- echo "#define __GCC_GOT_${cpp_wrapper}_"
- cat ${LIB}/${file}
- echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */') > ${LIB}/${file}.new
- rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file
- fi
- fi
-done
-
-# Fix fcntl prototype in fcntl.h on LynxOS.
-file=fcntl.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, fcntl declaration
- sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix definitions of macros used by va-i960.h in VxWorks header file.
-file=arch/i960/archI960.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/__vsiz/__vxvsiz/' -e 's/__vali/__vxvali/' \
- -e s'/__vpad/__vxvpad/' -e 's/__alignof__/__vxalignof__/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Make VxWorks header which is almost gcc ready fully gcc ready.
-file=types/vxTypesBase.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file
- sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \
- -e '/[ ]size_t/i\
-#ifndef _GCC_SIZE_T\
-#define _GCC_SIZE_T
-' \
- -e '/[ ]size_t/a\
-#endif
-' \
- -e '/[ ]ptrdiff_t/i\
-#ifndef _GCC_PTRDIFF_T\
-#define _GCC_PTRDIFF_T
-' \
- -e '/[ ]ptrdiff_t/a\
-#endif
-' \
- -e '/[ ]wchar_t/i\
-#ifndef _GCC_WCHAR_T\
-#define _GCC_WCHAR_T
-' \
- -e '/[ ]wchar_t/a\
-#endif
-' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
-file=sys/stat.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if egrep '#include' ${LIB}/$file >/dev/null 2>&1; then
- :
- else
- if egrep 'ULONG' ${LIB}/$file >/dev/null 2>&1 \
- && [ -r types/vxTypesOld.h ]; then
- echo Fixing $file
- sed -e '/#define[ ][ ]*__INCstath/a\
-#include <types/vxTypesOld.h>
-' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix VxWorks <time.h> to not require including <vxTypes.h>.
-file=time.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if egrep 'uint_t[ ][ ]*_clocks_per_sec' ${LIB}/$file >/dev/null 2>&1; then
- echo Fixing $file
- sed -e 's/uint_t/unsigned int/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
-file=sys/time.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if egrep '^extern struct sigevent;' ${LIB}/$file >/dev/null 2>&1; then
- echo Fixing $file
- sed -e 's/^extern struct sigevent;/struct sigevent;/' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Another bad dependency in VxWorks 5.2 <time.h>.
-file=time.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- mkdir ${LIB}/sys 2>/dev/null
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- if egrep VOIDFUNCPTR ${LIB}/$file >/dev/null 2>&1; then
- if [ -r vxWorks.h ]; then
- echo Fixing $file
- sed -e '/VOIDFUNCPTR/i\
-#ifndef __gcc_VOIDFUNCPTR_defined\
-#ifdef __cplusplus\
-typedef void (*__gcc_VOIDFUNCPTR) (...);\
-#else\
-typedef void (*__gcc_VOIDFUNCPTR) ();\
-#endif\
-#define __gcc_VOIDFUNCPTR_defined\
-#endif
-' \
- -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89; gcc
-# doesn't understand it.
-file=sys/param.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo "Fixing __asm directive in sys/param.h"
- sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# signal.h on SunOS defines signal using (), which causes trouble when
-# compiling with g++ -pedantic.
-for file in signal.h sys/signal.h; do
- if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
- fi
-
- if [ -r ${LIB}/$file ]; then
- echo "Checking for bad C++ prototype in $file"
- sed -e '/^void (\*signal())();$/i\
- #ifdef __cplusplus\
- void (*signal(...))(...);\
- #else
- ' \
- -e '/^void (\*signal())();$/a\
- #endif
- ' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
- fi
-done
-
-# sys/signal.h on some versions of AIX uses volatile in the typedef of
-# sig_atomic_t, which causes gcc to generate a warning about duplicate
-# volatile when a sig_atomic_t variable is declared volatile, as
-# required by ANSI C.
-file=sys/signal.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo "Checking for duplicate volatile in sys/signal.h"
- sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \
- ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# Some math.h files define struct exception, which conflicts with
-# the class exception defined in the C++ file std/stdexcept.h. We
-# redefine it to __math_exception. This is not a great fix, but I
-# haven't been able to think of anything better.
-file=math.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo Fixing $file, exception
- sed -e '/struct exception/i\
-#ifdef __cplusplus\
-#define exception __math_exception\
-#endif'\
- -e '/struct exception/a\
-#ifdef __cplusplus\
-#undef exception\
-#endif' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if egrep 'matherr()' ${LIB}/$file >/dev/null 2>&1; then
- sed -e '/matherr/i\
-#ifdef __cplusplus\
-#define exception __math_exception\
-#endif'\
- -e '/matherr/a\
-#ifdef __cplusplus\
-#undef exception\
-#endif' ${LIB}/$file > ${LIB}/${file}.sed
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- fi
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# rpc/xdr.h on SunOS needs prototypes for its XDR->xdr_ops function pointers.
-file=rpc/xdr.h
-if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
- cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
- chmod +w ${LIB}/$file 2>/dev/null
- chmod a+r ${LIB}/$file 2>/dev/null
-fi
-
-if [ -r ${LIB}/$file ]; then
- echo "Checking for needed C++ prototype in $file"
- sed -e 's/^\(.*\)\*\(x_.*\)();\(.*\)/\
-#ifdef __cplusplus\
-\1*\2(...);\3\
-#else\
-\1*\2();\3\
-#endif/g' \
- $LIB/$file > ${LIB}/${file}.sed
-
- rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
- if cmp $file ${LIB}/$file >/dev/null 2>&1; then
- rm -f ${LIB}/$file
- else
- # Find any include directives that use "file".
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $file | sed -e s'|/[^/]*$||'`
- required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
- done
- fi
-fi
-
-# This loop does not appear to do anything, because it uses file
-# rather than $file when setting target. It also appears to be
-# unnecessary, since the main loop processes symbolic links.
-#if $LINKS; then
-# echo 'Making internal symbolic non-directory links'
-# cd ${INPUT}
-# files=`find . -type l -print`
-# for file in $files; do
-# dest=`ls -ld $file | sed -n 's/.*-> //p'`
-# if expr "$dest" : '[^/].*' > /dev/null; then
-# target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
-# if [ -f $target ]; then
-# ln -s $dest ${LIB}/$file >/dev/null 2>&1
-# fi
-# fi
-# done
-#fi
-
-# Make sure that any include files referenced using double quotes
-# exist in the fixed directory. This comes last since otherwise
-# we might end up deleting some of these files "because they don't
-# need any change."
-set x $required
-shift
-while [ $# != 0 ]; do
- newreq=
- while [ $# != 0 ]; do
- # $1 is the directory to copy from, $2 is the unfixed file,
- # $3 is the fixed file name.
- cd ${INPUT}
- cd $1
- if [ -r $2 ] && [ ! -r $3 ]; then
- cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2"
- chmod +w $3 2>/dev/null
- chmod a+r $3 2>/dev/null
- echo Copied $2
- for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
- dir=`echo $2 | sed -e s'|/[^/]*$||'`
- dir2=`echo $3 | sed -e s'|/[^/]*$||'`
- newreq="$newreq $1 $dir/$include $dir2/$include"
- done
- fi
- shift; shift; shift
- done
- set x $newreq
- shift
-done
-
-echo 'Cleaning up DONE files.'
-cd $LIB
-find . -name DONE -exec rm -f '{}' ';'
-
-echo 'Removing unneeded directories:'
-cd $LIB
-files=`find . -type d -print | sort -r`
-for file in $files; do
- rmdir $LIB/$file > /dev/null 2>&1
-done
-
-exit 0
diff --git a/gcc/fixproto b/gcc/fixproto
deleted file mode 100755
index b7e85646470..00000000000
--- a/gcc/fixproto
+++ /dev/null
@@ -1,273 +0,0 @@
-#!/bin/sh
-#
-# SYNOPSIS
-# fixproto TARGET-DIR SOURCE-DIR-ALL SOURCE-DIR-STD
-#
-# COPYRIGHT
-# Copyright (C) 1993, 1994 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.
-#
-# DESCRIPTION
-# Adjunct script for GNU CC to populate a directory with ANSI,
-# Posix.1, and C++ compatible header files.
-#
-# Each file found under SOURCE-DIR-ALL is analyzed and "fixed."
-# Only standard ANSI/POSIX files found under SOURCE-DIR-STD
-# are analyzed and "fixed."
-# The SOURCE-DIRs are searched in order; a file found
-# under multiple SOURCE-DIRs is only handled for the first one.
-#
-# STRATEGY
-# Each include file is fed through cpp, and the scan-decls program
-# parses it, and emits any found function declarations.
-# The fix-header program analyzes the scan-decls output,
-# together with the original include file, and writes a "fixed"
-# include file, if needed.
-#
-# The comment at the beginning of fix-header.c lists specifically
-# what kind of changes are made.
-#
-# NOTE
-# Some file space will be wasted, because the original header
-# files are copied. An earlier version just included the original
-# by "reference", using GNU cpp's #include_next mechanism.
-# This is currently not done, partly because #include_next is
-# fragile (susceptible to version incompatibilities, and depends
-# and GCC-specific features), and partly for performance reasons.
-#
-# AUTHORS
-# Ron Guilmette (rfg@netcom.com) (original idea and code)
-# Per Bothner (bothner@cygnus.com) (major re-write)
-
-progname=$0
-progname=`basename $progname`
-original_dir=`pwd`
-FIX_HEADER=${FIX_HEADER-$original_dir/fix-header}
-DEFINES="-D__STDC__=0 -D__cplusplus ${FIXPROTO_DEFINES}"
-
-if [ `echo $1 | wc -w` = 0 ] ; then
- echo $progname\: usage\: $progname target-dir \[ source-dir \.\.\. \]
- exit 1
-fi
-
-std_files="ctype.h dirent.h errno.h curses.h fcntl.h grp.h locale.h math.h pwd.h setjmp.h signal.h stdio.h stdlib.h string.h sys/socket.h sys/stat.h sys/times.h sys/resource.h sys/utsname.h sys/wait.h tar.h termios.h time.h unistd.h utime.h"
-
-rel_target_dir=$1
-# All files in $src_dir_all (normally same as $rel_target_dir) are
-# processed.
-src_dir_all=$2
-# In $src_dir_std (normally same as /usr/include), only the
-# "standard" ANSI/POSIX files listed in $std_files are processed.
-src_dir_std=$3
-
-if [ `expr $rel_target_dir : '\(.\)'` != '/' ] ; then
- abs_target_dir=$original_dir/$rel_target_dir
-else
- abs_target_dir=$rel_target_dir
-fi
-
-# Determine whether this system has symbolic links.
-if ln -s X $rel_target_dir/ShouldNotExist 2>/dev/null; then
- rm -f $rel_target_dir/ShouldNotExist
- LINKS=true
-elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
- rm -f /tmp/ShouldNotExist
- LINKS=true
-else
- LINKS=false
-fi
-
-if [ \! -d $abs_target_dir ] ; then
- echo $progname\: creating directory $rel_target_dir
- mkdir $abs_target_dir
-fi
-
-echo $progname\: populating \`$rel_target_dir\'
-
-include_path=""
-
-if [ `echo $* | wc -w` != 0 ] ; then
- for rel_source_dir in $src_dir_all $src_dir_std; do
- if [ `expr $rel_source_dir : '\(.\)'` != '/' ] ; then
- abs_source_dir=$original_dir/$rel_source_dir
- else
- abs_source_dir=$rel_source_dir
- fi
- include_path="$include_path -I$abs_source_dir"
- done
-fi
-
-required_stdlib_h="abort abs atexit atof atoi atol bsearch calloc exit free getenv labs malloc putenv qsort rand realloc srand strtod strtol strtoul system"
-# "div ldiv", - ignored because these depend on div_t, ldiv_t
-# ignore these: "mblen mbstowcs mbstowc wcstombs wctomb"
-# Left out getgroups, because SunOS4 has incompatible BSD and SVR4 versions.
-# Should perhaps also add NULL
-required_unistd_h="_exit access alarm chdir chown close ctermid cuserid dup dup2 execl execle execlp execv execve execvp fork fpathconf getcwd getegid geteuid getgid getlogin getopt getpgrp getpid getppid getuid isatty link lseek pathconf pause pipe read rmdir setgid setpgid setsid setuid sleep sysconf tcgetpgrp tcsetpgrp ttyname unlink write"
-
-done_dirs=""
-echo "" >fixproto.list
-
-for code in ALL STD ; do
-
- subdirs="."
-
- case $code in
- ALL)
- rel_source_dir=$src_dir_all
-
- dirs="."
- levels=2
- while $LINKS && test -n "$dirs" -a $levels -gt 0
- do
- levels=`expr $levels - 1`
- newdirs=
- for d in $dirs ; do
- # Find all directories under $d, relative to $d, excluding $d itself.
- # Assume directory names ending in CC or containing ++ are
- # for C++, so skip those.
- subdirs="$subdirs "`cd $rel_source_dir/$d; find . -type d -print | \
- sed -e '/^\.$/d' -e "s|^\./|${d}/|" -e 's|^\./||' \
- -e '/CC$/d' -e '/[+][+]/d'`
- links=
- links=`cd $rel_source_dir; find $d/. -type l -print | \
- sed -e "s|$d/./|$d/|" -e 's|^\./||'`
- for link in $links --dummy-- ; do
- test -d $rel_source_dir/$link/. && newdirs="$newdirs $link"
- done
- done
- dirs="$newdirs"
- subdirs="$subdirs $newdirs"
- done
- ;;
- STD)
- rel_source_dir=$src_dir_std
- ;;
- esac
-
- if [ `expr $rel_source_dir : '\(.\)'` != '/' ] ; then
- abs_source_dir=$original_dir/$rel_source_dir
- else
- abs_source_dir=$rel_source_dir
- fi
-
- if [ \! -d $abs_source_dir ] ; then
- echo $progname\: warning\: no such directory\: \`$rel_source_dir\'
- continue
- fi
-
- for rel_source_subdir in $subdirs; do
-
- abs_target_subdir=${abs_target_dir}/${rel_source_subdir}
- if [ \! -d $abs_target_subdir ] ; then
- mkdir $abs_target_subdir
- fi
- # Append "/"; remove initial "./". Hence "." -> "" and "sys" -> "sys/".
- rel_source_prefix=`echo $rel_source_subdir | sed -e 's|$|/|' -e 's|^./||'`
-
- case $code in
- ALL)
- # The 'sed' is in case the *.h matches nothing, which yields "*.h"
- # which would then get re-globbed in the current directory. Sigh.
- rel_source_files=`cd ${abs_source_dir}/${rel_source_subdir}; echo *.h | sed -e 's|[*].h|NONE|'`
- ;;
-
- STD)
- files_to_check="$std_files"
- rel_source_files=""
-
- # Also process files #included by the $std_files.
- while [ -n "${files_to_check}" ]
- do
- new_files_to_check=""
- for file in $files_to_check ; do
- xxfile=`echo $file | sed -e 's|/\([^/\.][^/\.]*\)/\.\./|/|'`
- # Create the dir where this file will go when fixed.
- xxdir=`echo ./$file | sed -e 's|/[^/]*$||'`
- if [ \! -d $abs_target_subdir/$xxdir ] ; then
- mkdir $abs_target_subdir/$xxdir
- fi
- # Just in case we have edited out a symbolic link
- if [ -f $src_dir_std/$file -a -f $src_dir_std/$xxfile ] ; then
- file=$xxfile
- fi
- case " $rel_source_files " in
- *" ${file} "*)
- # Already seen $file; nothing to do
- ;;
- *)
- if test -f $src_dir_std/$file ; then
- rel_dir=`echo $file | sed -n -e 's|^\(.*/\)[^/]*$|\1|p'`
- # For #include "foo.h", that might be either "foo.h"
- # or "${rel_dir}foo.h (or something bogus).
- new_files_to_check="$new_files_to_check "`sed -n \
- -e 's@ @ @g' \
- -e 's@^ *# *include *<\([^>]*\)>.*$@\1@p' -e \
- 's@^ *# *include *\"\([^\"]*\)\".*$@\1 '$rel_dir'\1@p'\
- <$src_dir_std/$file`
- rel_source_files="$rel_source_files $file"
- fi
- ;;
- esac
- done
- files_to_check="$new_files_to_check"
- done
- rel_source_files="$rel_source_files"
- ;;
- esac
-
- for filename in $rel_source_files ; do
- rel_source_file=${rel_source_prefix}${filename}
- abs_source_file=$abs_source_dir/$rel_source_file
- abs_target_file=$abs_target_dir/$rel_source_file
-
- if test "$filename" = 'NONE' ; then
- echo "(No *.h files in $abs_source_dir/$rel_source_subdir)"
- # If target file exists, check if was written while processing one
- # of the earlier source directories; if so ignore it.
- elif test -f $abs_target_file -a -n "$done_dirs" \
- && grep "$rel_source_file" fixproto.list >/dev/null
- then true
- else
- $FIX_HEADER $rel_source_file $abs_source_file $abs_target_file ${DEFINES} $include_path
- echo "${rel_source_file}" >>fixproto.list
- fi
- done
- done
- done_dirs="$done_dir $rel_source_dir"
-done
-
-# This might be more cleanly moved into the main loop, by adding
-# a <dummy> source directory at the end. FIXME!
-for rel_source_file in unistd.h stdlib.h
-do
- if grep "$rel_source_file" fixproto.list >/dev/null
- then true
- else
- echo Adding missing $rel_source_file
- rel_source_ident=`echo $rel_source_file | tr ./ __`
- required_list=`eval echo '${required_'${rel_source_ident}'-}'`
- cat >tmp.h <<EOF
-#ifndef ${rel_source_ident}
-#define ${rel_source_ident}
-#endif
-EOF
- ${FIX_HEADER} $rel_source_file tmp.h $abs_target_dir/$rel_source_file ${DEFINES} $include_path
- rm tmp.h
- fi
-done
-exit 0
diff --git a/gcc/flags.h b/gcc/flags.h
deleted file mode 100644
index 82c10854fc8..00000000000
--- a/gcc/flags.h
+++ /dev/null
@@ -1,398 +0,0 @@
-/* Compilation switch flag definitions for GNU CC.
- Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997 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. */
-
-/* Name of the input .c file being compiled. */
-extern char *main_input_filename;
-
-enum debug_info_type
-{
- NO_DEBUG, /* Write no debug info. */
- DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */
- SDB_DEBUG, /* Write COFF for (old) SDB (using sdbout.c). */
- DWARF_DEBUG, /* Write Dwarf debug info (using dwarfout.c). */
- DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */
- XCOFF_DEBUG /* Write IBM/Xcoff debug info (using dbxout.c). */
-};
-
-/* Specify which kind of debugging info to generate. */
-extern enum debug_info_type write_symbols;
-
-enum debug_info_level
-{
- DINFO_LEVEL_NONE, /* Write no debugging info. */
- DINFO_LEVEL_TERSE, /* Write minimal info to support tracebacks only. */
- DINFO_LEVEL_NORMAL, /* Write info for all declarations (and line table). */
- DINFO_LEVEL_VERBOSE /* Write normal info plus #define/#undef info. */
-};
-
-/* Specify how much debugging info to generate. */
-extern enum debug_info_level debug_info_level;
-
-/* Nonzero means use GNU-only extensions in the generated symbolic
- debugging information. */
-extern int use_gnu_debug_info_extensions;
-
-/* Nonzero means do optimizations. -opt. */
-
-extern int optimize;
-
-/* Nonzero means do stupid register allocation. -noreg.
- Currently, this is 1 if `optimize' is 0. */
-
-extern int obey_regdecls;
-
-/* Don't print functions as they are compiled and don't print
- times taken by the various passes. -quiet. */
-
-extern int quiet_flag;
-
-/* Don't print warning messages. -w. */
-
-extern int inhibit_warnings;
-
-/* Do print extra warnings (such as for uninitialized variables). -W. */
-
-extern int extra_warnings;
-
-/* Nonzero to warn about unused local variables. */
-
-extern int warn_unused;
-
-/* Nonzero means warn if inline function is too large. */
-
-extern int warn_inline;
-
-/* Nonzero to warn about variables used before they are initialized. */
-
-extern int warn_uninitialized;
-
-/* Nonzero means warn about all declarations which shadow others. */
-
-extern int warn_shadow;
-
-/* Warn if a switch on an enum fails to have a case for every enum value. */
-
-extern int warn_switch;
-
-/* Nonzero means warn about function definitions that default the return type
- or that use a null return and have a return-type other than void. */
-
-extern int warn_return_type;
-
-/* Nonzero means warn about pointer casts that increase the required
- alignment of the target type (and might therefore lead to a crash
- due to a misaligned access). */
-
-extern int warn_cast_align;
-
-/* Nonzero means warn that dbx info for template class methods isn't fully
- supported yet. */
-
-extern int warn_template_debugging;
-
-/* Nonzero means warn about any identifiers that match in the first N
- characters. The value N is in `id_clash_len'. */
-
-extern int warn_id_clash;
-extern unsigned id_clash_len;
-
-/* Nonzero means warn about any objects definitions whose size is larger
- than N bytes. Also want about function definitions whose returned
- values are larger than N bytes. The value N is in `larger_than_size'. */
-
-extern int warn_larger_than;
-extern unsigned larger_than_size;
-
-/* Warn if a function returns an aggregate,
- since there are often incompatible calling conventions for doing this. */
-
-extern int warn_aggregate_return;
-
-/* Nonzero if generating code to do profiling. */
-
-extern int profile_flag;
-
-/* Nonzero if generating code to do profiling on the basis of basic blocks. */
-
-extern int profile_block_flag;
-
-/* Nonzero if generating code to profile program flow graph arcs. */
-
-extern int profile_arc_flag;
-
-/* Nonzero if generating info for gcov to calculate line test coverage. */
-
-extern int flag_test_coverage;
-
-/* Nonzero indicates that branch taken probabilities should be calculated. */
-
-extern int flag_branch_probabilities;
-
-/* Nonzero for -pedantic switch: warn about anything
- that standard C forbids. */
-
-extern int pedantic;
-
-/* Temporarily suppress certain warnings.
- This is set while reading code from a system header file. */
-
-extern int in_system_header;
-
-/* Nonzero for -dp: annotate the assembly with a comment describing the
- pattern and alternative used. */
-
-extern int flag_print_asm_name;
-
-/* Now the symbols that are set with `-f' switches. */
-
-/* Nonzero means `char' should be signed. */
-
-extern int flag_signed_char;
-
-/* Nonzero means give an enum type only as many bytes as it needs. */
-
-extern int flag_short_enums;
-
-/* 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. */
-
-extern int flag_caller_saves;
-
-/* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
-
-extern int flag_pcc_struct_return;
-
-/* Nonzero for -fforce-mem: load memory value into a register
- before arithmetic on it. This makes better cse but slower compilation. */
-
-extern int flag_force_mem;
-
-/* Nonzero for -fforce-addr: load memory address into a register before
- reference to memory. This makes better cse but slower compilation. */
-
-extern int flag_force_addr;
-
-/* Nonzero for -fdefer-pop: don't pop args after each function call;
- instead save them up to pop many calls' args with one insns. */
-
-extern int flag_defer_pop;
-
-/* Nonzero for -ffloat-store: don't allocate floats and doubles
- in extended-precision registers. */
-
-extern int flag_float_store;
-
-/* Nonzero enables strength-reduction in loop.c. */
-
-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_unroll_loops;
-
-/* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
- This is generally not a win. */
-
-extern int flag_unroll_all_loops;
-
-/* Nonzero for -fcse-follow-jumps:
- have cse follow jumps to do a more extensive job. */
-
-extern int flag_cse_follow_jumps;
-
-/* Nonzero for -fcse-skip-blocks:
- have cse follow a branch around a block. */
-
-extern int flag_cse_skip_blocks;
-
-/* Nonzero for -fexpensive-optimizations:
- perform miscellaneous relatively-expensive optimizations. */
-extern int flag_expensive_optimizations;
-
-/* Nonzero for -fwritable-strings:
- store string constants in data segment and don't uniquize them. */
-
-extern int flag_writable_strings;
-
-/* Nonzero means don't put addresses of constant functions in registers.
- Used for compiling the Unix kernel, where strange substitutions are
- done on the assembly output. */
-
-extern int flag_no_function_cse;
-
-/* Nonzero for -fomit-frame-pointer:
- don't make a frame pointer in simple functions that don't require one. */
-
-extern int flag_omit_frame_pointer;
-
-/* Nonzero to inhibit use of define_optimization peephole opts. */
-
-extern int flag_no_peephole;
-
-/* Nonzero means all references through pointers are volatile. */
-
-extern int flag_volatile;
-
-/* Nonzero means treat all global and extern variables as global. */
-
-extern int flag_volatile_global;
-
-/* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
- operations in the interest of optimization. For example it allows
- GCC to assume arguments to sqrt are nonnegative numbers, allowing
- faster code for sqrt to be generated. */
-
-extern int flag_fast_math;
-
-/* Nonzero means make functions that look like good inline candidates
- go inline. */
-
-extern int flag_inline_functions;
-
-/* Nonzero for -fkeep-inline-functions: even if we make a function
- go inline everywhere, keep its definition around for debugging
- purposes. */
-
-extern int flag_keep_inline_functions;
-
-/* Nonzero means that functions declared `inline' will be treated
- as `static'. Prevents generation of zillions of copies of unused
- static inline functions; instead, `inlines' are written out
- only when actually used. Used in conjunction with -g. Also
- does the right thing with #pragma interface. */
-
-extern int flag_no_inline;
-
-/* Nonzero if we are only using compiler to check syntax errors. */
-
-extern int flag_syntax_only;
-
-/* Nonzero means we should save auxiliary info into a .X file. */
-
-extern int flag_gen_aux_info;
-
-/* Nonzero means make the text shared if supported. */
-
-extern int flag_shared_data;
-
-/* flag_schedule_insns means schedule insns within basic blocks (before
- local_alloc).
- flag_schedule_insns_after_reload means schedule insns after
- global_alloc. */
-
-extern int flag_schedule_insns;
-extern int flag_schedule_insns_after_reload;
-
-/* Nonzero means put things in delayed-branch slots if supported. */
-
-extern int flag_delayed_branch;
-
-/* Nonzero means to run cleanups after CALL_EXPRs. */
-
-extern int flag_short_temps;
-
-/* Nonzero means pretend it is OK to examine bits of target floats,
- even if that isn't true. The resulting code will have incorrect constants,
- but the same series of instructions that the native compiler would make. */
-
-extern int flag_pretend_float;
-
-/* Nonzero means change certain warnings into errors.
- Usually these are warnings about failure to conform to some standard. */
-
-extern int flag_pedantic_errors;
-
-/* Nonzero means generate position-independent code.
- This is not fully implemented yet. */
-
-extern int flag_pic;
-
-/* Nonzero means generate extra code for exception handling and enable
- exception handling. */
-
-extern int flag_exceptions;
-
-/* Nonzero means don't place uninitialized global data in common storage
- by default. */
-
-extern int flag_no_common;
-
-/* -finhibit-size-directive inhibits output of .size for ELF.
- This is used only for compiling crtstuff.c,
- and it may be extended to other effects
- needed for crtstuff.c on other systems. */
-extern int flag_inhibit_size_directive;
-
-/* Nonzero means place each function into its own section on those platforms
- which support arbitrary section names and unlimited numbers of sections. */
-
-extern int flag_function_sections;
-
-/* -fverbose-asm causes extra commentary information to be produced 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).
- -fverbose-asm is the default. -fno-verbose-asm causes the extra information
- to not be added and is useful when comparing two assembler files. */
-
-extern int flag_verbose_asm;
-
-/* -dA causes debug information to be produced 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).
- Currently, this switch is only used by dwarfout.c; however, it is intended
- to be a catchall for printing debug information in the assembler file. */
-
-extern int flag_debug_asm;
-
-/* -fgnu-linker specifies use of the GNU linker for initializations.
- -fno-gnu-linker says that collect will be used. */
-extern int flag_gnu_linker;
-
-/* Tag all structures with __attribute__(packed) */
-extern int flag_pack_struct;
-
-/* Other basic status info about current function. */
-
-/* Nonzero means current function must be given a frame pointer.
- Set in stmt.c if anything is allocated on the stack there.
- Set in reload1.c if anything is allocated on the stack there. */
-
-extern int frame_pointer_needed;
-
-/* Set nonzero if jump_optimize finds that control falls through
- at the end of the function. */
-
-extern int can_reach_end;
-
-/* Nonzero if function being compiled receives nonlocal gotos
- from nested functions. */
-
-extern int current_function_has_nonlocal_label;
-
-/* Nonzero if function being compiled has nonlocal gotos to parent
- function. */
-
-extern int current_function_has_nonlocal_goto;
diff --git a/gcc/floatlib.c b/gcc/floatlib.c
deleted file mode 100644
index bdcdf57ddd0..00000000000
--- a/gcc/floatlib.c
+++ /dev/null
@@ -1,838 +0,0 @@
-/*
-** libgcc support for software floating point.
-** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved.
-** Permission is granted to do *anything* you want with this file,
-** commercial or otherwise, provided this message remains intact. So there!
-** I would appreciate receiving any updates/patches/changes that anyone
-** makes, and am willing to be the repository for said changes (am I
-** making a big mistake?).
-
-Warning! Only single-precision is actually implemented. This file
-won't really be much use until double-precision is supported.
-
-However, once that is done, this file might eventually become a
-replacement for libgcc1.c. It might also make possible
-cross-compilation for an IEEE target machine from a non-IEEE
-host such as a VAX.
-
-If you'd like to work on completing this, please talk to rms@gnu.ai.mit.edu.
-
-
-**
-** Pat Wood
-** Pipeline Associates, Inc.
-** pipeline!phw@motown.com or
-** sun!pipeline!phw or
-** uunet!motown!pipeline!phw
-**
-** 05/01/91 -- V1.0 -- first release to gcc mailing lists
-** 05/04/91 -- V1.1 -- added float and double prototypes and return values
-** -- fixed problems with adding and subtracting zero
-** -- fixed rounding in truncdfsf2
-** -- fixed SWAP define and tested on 386
-*/
-
-/*
-** The following are routines that replace the libgcc soft floating point
-** routines that are called automatically when -msoft-float is selected.
-** The support single and double precision IEEE format, with provisions
-** for byte-swapped machines (tested on 386). Some of the double-precision
-** routines work at full precision, but most of the hard ones simply punt
-** and call the single precision routines, producing a loss of accuracy.
-** long long support is not assumed or included.
-** Overall accuracy is close to IEEE (actually 68882) for single-precision
-** arithmetic. I think there may still be a 1 in 1000 chance of a bit
-** being rounded the wrong way during a multiply. I'm not fussy enough to
-** bother with it, but if anyone is, knock yourself out.
-**
-** Efficiency has only been addressed where it was obvious that something
-** would make a big difference. Anyone who wants to do this right for
-** best speed should go in and rewrite in assembler.
-**
-** I have tested this only on a 68030 workstation and 386/ix integrated
-** in with -msoft-float.
-*/
-
-/* the following deal with IEEE single-precision numbers */
-#define D_PHANTOM_BIT 0x00100000
-#define EXCESS 126
-#define SIGNBIT 0x80000000
-#define HIDDEN (1 << 23)
-#define SIGN(fp) ((fp) & SIGNBIT)
-#define EXP(fp) (((fp) >> 23) & 0xFF)
-#define MANT(fp) (((fp) & 0x7FFFFF) | HIDDEN)
-#define PACK(s,e,m) ((s) | ((e) << 23) | (m))
-
-/* the following deal with IEEE double-precision numbers */
-#define EXCESSD 1022
-#define HIDDEND (1 << 20)
-#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
-#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
-#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
- (fp.l.lower >> 22))
-
-/* define SWAP for 386/960 reverse-byte-order brain-damaged CPUs */
-union double_long
- {
- double d;
-#ifdef SWAP
- struct {
- unsigned long lower;
- long upper;
- } l;
-#else
- struct {
- long upper;
- unsigned long lower;
- } l;
-#endif
- };
-
-union float_long
- {
- float f;
- long l;
- };
-
- struct _ieee {
-#ifdef SWAP
- unsigned mantissa2 : 32;
- unsigned mantissa1 : 20;
- unsigned exponent : 11;
- unsigned sign : 1;
-#else
- unsigned exponent : 11;
- unsigned sign : 1;
- unsigned mantissa2 : 32;
- unsigned mantissa1 : 20;
-#endif
- };
-
- union _doubleu {
- double d;
- struct _ieee ieee;
-#ifdef SWAP
- struct {
- unsigned long lower;
- long upper;
- } l;
-#else
- struct {
- long upper;
- unsigned long lower;
- } l;
-#endif
- };
-
-/* add two floats */
-
-float
-__addsf3 (float a1, float a2)
-{
- register long mant1, mant2;
- register union float_long fl1, fl2;
- register int exp1, exp2;
- int sign = 0;
-
- fl1.f = a1;
- fl2.f = a2;
-
- /* check for zero args */
- if (!fl1.l)
- return (fl2.f);
- if (!fl2.l)
- return (fl1.f);
-
- exp1 = EXP (fl1.l);
- exp2 = EXP (fl2.l);
-
- if (exp1 > exp2 + 25)
- return (fl1.l);
- if (exp2 > exp1 + 25)
- return (fl2.l);
-
- /* do everything in excess precision so's we can round later */
- mant1 = MANT (fl1.l) << 6;
- mant2 = MANT (fl2.l) << 6;
-
- if (SIGN (fl1.l))
- mant1 = -mant1;
- if (SIGN (fl2.l))
- mant2 = -mant2;
-
- if (exp1 > exp2)
- {
- mant2 >>= exp1 - exp2;
- }
- else
- {
- mant1 >>= exp2 - exp1;
- exp1 = exp2;
- }
- mant1 += mant2;
-
- if (mant1 < 0)
- {
- mant1 = -mant1;
- sign = SIGNBIT;
- }
- else if (!mant1)
- return (0);
-
- /* normalize up */
- while (!(mant1 & 0xE0000000))
- {
- mant1 <<= 1;
- exp1--;
- }
-
- /* normalize down? */
- if (mant1 & (1 << 30))
- {
- mant1 >>= 1;
- exp1++;
- }
-
- /* round to even */
- mant1 += (mant1 & 0x40) ? 0x20 : 0x1F;
-
- /* normalize down? */
- if (mant1 & (1 << 30))
- {
- mant1 >>= 1;
- exp1++;
- }
-
- /* lose extra precision */
- mant1 >>= 6;
-
- /* turn off hidden bit */
- mant1 &= ~HIDDEN;
-
- /* pack up and go home */
- fl1.l = PACK (sign, exp1, mant1);
- return (fl1.f);
-}
-
-/* subtract two floats */
-
-float
-__subsf3 (float a1, float a2)
-{
- register union float_long fl1, fl2;
-
- fl1.f = a1;
- fl2.f = a2;
-
- /* check for zero args */
- if (!fl2.l)
- return (fl1.f);
- if (!fl1.l)
- return (-fl2.f);
-
- /* twiddle sign bit and add */
- fl2.l ^= SIGNBIT;
- return __addsf3 (a1, fl2.f);
-}
-
-/* compare two floats */
-
-long
-__cmpsf2 (float a1, float a2)
-{
- register union float_long fl1, fl2;
-
- fl1.f = a1;
- fl2.f = a2;
-
- if (SIGN (fl1.l) && SIGN (fl2.l))
- {
- fl1.l ^= SIGNBIT;
- fl2.l ^= SIGNBIT;
- }
- if (fl1.l < fl2.l)
- return (-1);
- if (fl1.l > fl2.l)
- return (1);
- return (0);
-}
-
-/* multiply two floats */
-
-float
-__mulsf3 (float a1, float a2)
-{
- register union float_long fl1, fl2;
- register unsigned long result;
- register int exp;
- int sign;
-
- fl1.f = a1;
- fl2.f = a2;
-
- if (!fl1.l || !fl2.l)
- return (0);
-
- /* compute sign and exponent */
- sign = SIGN (fl1.l) ^ SIGN (fl2.l);
- exp = EXP (fl1.l) - EXCESS;
- exp += EXP (fl2.l);
-
- fl1.l = MANT (fl1.l);
- fl2.l = MANT (fl2.l);
-
- /* the multiply is done as one 16x16 multiply and two 16x8 multiples */
- result = (fl1.l >> 8) * (fl2.l >> 8);
- result += ((fl1.l & 0xFF) * (fl2.l >> 8)) >> 8;
- result += ((fl2.l & 0xFF) * (fl1.l >> 8)) >> 8;
-
- if (result & 0x80000000)
- {
- /* round */
- result += 0x80;
- result >>= 8;
- }
- else
- {
- /* round */
- result += 0x40;
- result >>= 7;
- exp--;
- }
-
- result &= ~HIDDEN;
-
- /* pack up and go home */
- fl1.l = PACK (sign, exp, result);
- return (fl1.f);
-}
-
-/* divide two floats */
-
-float
-__divsf3 (float a1, float a2)
-{
- register union float_long fl1, fl2;
- register int result;
- register int mask;
- register int exp, sign;
-
- fl1.f = a1;
- fl2.f = a2;
-
- /* subtract exponents */
- exp = EXP (fl1.l) - EXP (fl2.l) + EXCESS;
-
- /* compute sign */
- sign = SIGN (fl1.l) ^ SIGN (fl2.l);
-
- /* divide by zero??? */
- if (!fl2.l)
- /* return NaN or -NaN */
- return (sign ? 0xFFFFFFFF : 0x7FFFFFFF);
-
- /* numerator zero??? */
- if (!fl1.l)
- return (0);
-
- /* now get mantissas */
- fl1.l = MANT (fl1.l);
- fl2.l = MANT (fl2.l);
-
- /* this assures we have 25 bits of precision in the end */
- if (fl1.l < fl2.l)
- {
- fl1.l <<= 1;
- exp--;
- }
-
- /* now we perform repeated subtraction of fl2.l from fl1.l */
- mask = 0x1000000;
- result = 0;
- while (mask)
- {
- if (fl1.l >= fl2.l)
- {
- result |= mask;
- fl1.l -= fl2.l;
- }
- fl1.l <<= 1;
- mask >>= 1;
- }
-
- /* round */
- result += 1;
-
- /* normalize down */
- exp++;
- result >>= 1;
-
- result &= ~HIDDEN;
-
- /* pack up and go home */
- fl1.l = PACK (sign, exp, result);
- return (fl1.f);
-}
-
-/* convert int to double */
-
-double
-__floatsidf (register long a1)
-{
- register int sign = 0, exp = 31 + EXCESSD;
- union double_long dl;
-
- if (!a1)
- {
- dl.l.upper = dl.l.lower = 0;
- return (dl.d);
- }
-
- if (a1 < 0)
- {
- sign = SIGNBIT;
- a1 = -a1;
- }
-
- while (a1 < 0x1000000)
- {
- a1 <<= 4;
- exp -= 4;
- }
-
- while (a1 < 0x40000000)
- {
- a1 <<= 1;
- exp--;
- }
-
- /* pack up and go home */
- dl.l.upper = sign;
- dl.l.upper |= exp << 20;
- dl.l.upper |= (a1 >> 10) & ~HIDDEND;
- dl.l.lower = a1 << 22;
-
- return (dl.d);
-}
-
-/* negate a float */
-
-float
-__negsf2 (float a1)
-{
- register union float_long fl1;
-
- fl1.f = a1;
- if (!fl1.l)
- return (0);
-
- fl1.l ^= SIGNBIT;
- return (fl1.f);
-}
-
-/* negate a double */
-
-double
-__negdf2 (double a1)
-{
- register union double_long dl1;
-
- dl1.d = a1;
-
- if (!dl1.l.upper && !dl1.l.lower)
- return (dl1.d);
-
- dl1.l.upper ^= SIGNBIT;
- return (dl1.d);
-}
-
-/* convert float to double */
-
-double
-__extendsfdf2 (float a1)
-{
- register union float_long fl1;
- register union double_long dl;
- register int exp;
-
- fl1.f = a1;
-
- if (!fl1.l)
- {
- dl.l.upper = dl.l.lower = 0;
- return (dl.d);
- }
-
- dl.l.upper = SIGN (fl1.l);
- exp = EXP (fl1.l) - EXCESS + EXCESSD;
- dl.l.upper |= exp << 20;
- dl.l.upper |= (MANT (fl1.l) & ~HIDDEN) >> 3;
- dl.l.lower = MANT (fl1.l) << 29;
-
- return (dl.d);
-}
-
-/* convert double to float */
-
-float
-__truncdfsf2 (double a1)
-{
- register int exp;
- register long mant;
- register union float_long fl;
- register union double_long dl1;
-
- dl1.d = a1;
-
- if (!dl1.l.upper && !dl1.l.lower)
- return (0);
-
- exp = EXPD (dl1) - EXCESSD + EXCESS;
-
- /* shift double mantissa 6 bits so we can round */
- mant = MANTD (dl1) >> 6;
-
- /* now round and shift down */
- mant += 1;
- mant >>= 1;
-
- /* did the round overflow? */
- if (mant & 0xFF000000)
- {
- mant >>= 1;
- exp++;
- }
-
- mant &= ~HIDDEN;
-
- /* pack up and go home */
- fl.l = PACK (SIGND (dl1), exp, mant);
- return (fl.f);
-}
-
-/* compare two doubles */
-
-long
-__cmpdf2 (double a1, double a2)
-{
- register union double_long dl1, dl2;
-
- dl1.d = a1;
- dl2.d = a2;
-
- if (SIGND (dl1) && SIGND (dl2))
- {
- dl1.l.upper ^= SIGNBIT;
- dl2.l.upper ^= SIGNBIT;
- }
- if (dl1.l.upper < dl2.l.upper)
- return (-1);
- if (dl1.l.upper > dl2.l.upper)
- return (1);
- if (dl1.l.lower < dl2.l.lower)
- return (-1);
- if (dl1.l.lower > dl2.l.lower)
- return (1);
- return (0);
-}
-
-/* convert double to int */
-
-long
-__fixdfsi (double a1)
-{
- register union double_long dl1;
- register int exp;
- register long l;
-
- dl1.d = a1;
-
- if (!dl1.l.upper && !dl1.l.lower)
- return (0);
-
- exp = EXPD (dl1) - EXCESSD - 31;
- l = MANTD (dl1);
-
- if (exp > 0)
- return (0x7FFFFFFF | SIGND (dl1)); /* largest integer */
-
- /* shift down until exp = 0 or l = 0 */
- if (exp < 0 && exp > -32 && l)
- l >>= -exp;
- else
- return (0);
-
- return (SIGND (dl1) ? -l : l);
-}
-
-/* convert double to unsigned int */
-
-unsigned
-long __fixunsdfsi (double a1)
-{
- register union double_long dl1;
- register int exp;
- register unsigned long l;
-
- dl1.d = a1;
-
- if (!dl1.l.upper && !dl1.l.lower)
- return (0);
-
- exp = EXPD (dl1) - EXCESSD - 32;
- l = (((((dl1.l.upper) & 0xFFFFF) | HIDDEND) << 11) | (dl1.l.lower >> 21));
-
- if (exp > 0)
- return (0xFFFFFFFF); /* largest integer */
-
- /* shift down until exp = 0 or l = 0 */
- if (exp < 0 && exp > -32 && l)
- l >>= -exp;
- else
- return (0);
-
- return (l);
-}
-
-/* For now, the hard double-precision routines simply
- punt and do it in single */
-/* addtwo doubles */
-
-double
-__adddf3 (double a1, double a2)
-{
- return ((float) a1 + (float) a2);
-}
-
-/* subtract two doubles */
-
-double
-__subdf3 (double a1, double a2)
-{
- return ((float) a1 - (float) a2);
-}
-
-/* multiply two doubles */
-
-double
-__muldf3 (double a1, double a2)
-{
- return ((float) a1 * (float) a2);
-}
-
-/*
- *
- * Name: Barrett Richardson
- * E-mail: barrett@iglou.com
- * When: Thu Dec 15 10:31:11 EST 1994
- *
- * callable function:
- *
- * double __divdf3(double a1, double a2);
- *
- * Does software divide of a1 / a2.
- *
- * Based largely on __divsf3() in floatlib.c in the gcc
- * distribution.
- *
- * Purpose: To be used in conjunction with the -msoft-float
- * option of gcc. You should be able to tack it to the
- * end of floatlib.c included in the gcc distribution,
- * and delete the __divdf3() already there which just
- * calls the single precision function (or may just
- * use the floating point processor with some configurations).
- *
- * You may use this code for whatever your heart desires.
- */
-
-
-
-
-/*
- * Compare the the mantissas of two doubles.
- * Each mantissa is in two longs.
- *
- * return 1 if x1's mantissa is greater than x2's
- * -1 if x1's mantissa is less than x2's
- * 0 if the two mantissa's are equal.
- *
- * The Mantissas won't fit into a 4 byte word, so they are
- * broken up into two parts.
- *
- * This function is used internally by __divdf3()
- */
-
-int
-__dcmp (long x1m1, long x1m2, long x2m1, long x2m2)
-{
- if (x1m1 > x2m1)
- return 1;
-
- if (x1m1 < x2m1)
- return -1;
-
- /* If the first word in the two mantissas were equal check the second word */
-
- if (x1m2 > x2m2)
- return 1;
-
- if (x1m2 < x2m2)
- return -1;
-
- return 0;
-}
-
-
-/* divide two doubles */
-
-double
-__divdf3 (double a1, double a2)
-{
-
- int sign,
- exponent,
- bit_bucket;
-
- register unsigned long mantissa1,
- mantissa2,
- x1m1,
- x1m2,
- x2m1,
- x2m2,
- mask;
-
- union _doubleu x1,
- x2,
- result;
-
-
- x1.d = a1;
- x2.d = a2;
-
- exponent = x1.ieee.exponent - x2.ieee.exponent + EXCESSD;
-
- sign = x1.ieee.sign ^ x2.ieee.sign;
-
- x2.ieee.sign = 0; /* don't want the sign bit to affect any zero */
- /* comparisons when checking for zero divide */
-
- if (!x2.l.lower && !x2.l.upper) { /* check for zero divide */
- result.l.lower = 0x0;
- if (sign)
- result.l.upper = 0xFFF00000; /* negative infinity */
- else
- result.l.upper = 0x7FF00000; /* positive infinity */
- return result.d;
- }
-
- if (!x1.l.upper && !x1.l.lower) /* check for 0.0 numerator */
- return (0.0);
-
- x1m1 = x1.ieee.mantissa1 | D_PHANTOM_BIT; /* turn on phantom bit */
- x1m2 = x1.ieee.mantissa2;
-
- x2m1 = x2.ieee.mantissa1 | D_PHANTOM_BIT; /* turn on phantom bit */
- x2m2 = x2.ieee.mantissa2;
-
- if (__dcmp(x1m1,x1m2,x2m1,x2m2) < 0) {
-
- /* if x1's mantissa is less than x2's shift it left one and decrement */
- /* the exponent to accomodate the change in the mantissa */
-
- x1m1 <<= 1; /* */
- bit_bucket = x1m2 >> 31; /* Shift mantissa left one */
- x1m1 |= bit_bucket; /* */
- x1m2 <<= 1; /* */
-
- exponent--;
- }
-
-
- mantissa1 = 0;
- mantissa2 = 0;
-
-
- /* Get the first part of the results mantissa using successive */
- /* subtraction. */
-
- mask = 0x00200000;
- while (mask) {
-
- if (__dcmp(x1m1,x1m2,x2m1,x2m2) >= 0) {
-
- /* subtract x2's mantissa from x1's */
-
- mantissa1 |= mask; /* turn on a bit in the result */
-
- if (x2m2 > x1m2)
- x1m1--;
- x1m2 -= x2m2;
- x1m1 -= x2m1;
- }
-
- x1m1 <<= 1; /* */
- bit_bucket = x1m2 >> 31; /* Shift mantissa left one */
- x1m1 |= bit_bucket; /* */
- x1m2 <<= 1; /* */
-
- mask >>= 1;
- }
-
- /* Get the second part of the results mantissa using successive */
- /* subtraction. */
-
- mask = 0x80000000;
- while (mask) {
-
- if (__dcmp(x1m1,x1m2,x2m1,x2m2) >= 0) {
-
- /* subtract x2's mantissa from x1's */
-
- mantissa2 |= mask; /* turn on a bit in the result */
-
- if (x2m2 > x1m2)
- x1m1--;
- x1m2 -= x2m2;
- x1m1 -= x2m1;
- }
- x1m1 <<= 1; /* */
- bit_bucket = x1m2 >> 31; /* Shift mantissa left one */
- x1m1 |= bit_bucket; /* */
- x1m2 <<= 1; /* */
-
- mask >>= 1;
- }
-
- /* round up by adding 1 to mantissa */
-
- if (mantissa2 == 0xFFFFFFFF) { /* check for over flow */
-
- /* spill if overflow */
-
- mantissa2 = 0;
- mantissa1++;
- }
- else
- mantissa2++;
-
- exponent++; /* increment exponent (mantissa must be shifted right */
- /* also) */
-
- /* shift mantissa right one and assume a phantom bit (which really gives */
- /* 53 bits of precision in the mantissa) */
-
- mantissa2 >>= 1;
- bit_bucket = mantissa1 & 1;
- mantissa2 |= (bit_bucket << 31);
- mantissa1 >>= 1;
-
- /* put all the info into the result */
-
- result.ieee.exponent = exponent;
- result.ieee.sign = sign;
- result.ieee.mantissa1 = mantissa1;
- result.ieee.mantissa2 = mantissa2;
-
-
- return result.d;
-}
diff --git a/gcc/flow.c b/gcc/flow.c
deleted file mode 100644
index 72b42ead9b3..00000000000
--- a/gcc/flow.c
+++ /dev/null
@@ -1,3018 +0,0 @@
-/* Data flow analysis for GNU compiler.
- Copyright (C) 1987, 88, 92-96, 1997 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 contains the data flow analysis pass of the compiler.
- It computes data flow information
- which tells combine_instructions which insns to consider combining
- and controls register allocation.
-
- Additional data flow information that is too bulky to record
- is generated during the analysis, and is used at that time to
- create autoincrement and autodecrement addressing.
-
- The first step is dividing the function into basic blocks.
- find_basic_blocks does this. Then life_analysis determines
- where each register is live and where it is dead.
-
- ** find_basic_blocks **
-
- find_basic_blocks divides the current function's rtl
- into basic blocks. It records the beginnings and ends of the
- basic blocks in the vectors basic_block_head and basic_block_end,
- and the number of blocks in n_basic_blocks.
-
- find_basic_blocks also finds any unreachable loops
- and deletes them.
-
- ** life_analysis **
-
- life_analysis is called immediately after find_basic_blocks.
- It uses the basic block information to determine where each
- hard or pseudo register is live.
-
- ** live-register info **
-
- The information about where each register is live is in two parts:
- the REG_NOTES of insns, and the vector basic_block_live_at_start.
-
- basic_block_live_at_start has an element for each basic block,
- and the element is a bit-vector with a bit for each hard or pseudo
- register. The bit is 1 if the register is live at the beginning
- of the basic block.
-
- Two types of elements can be added to an insn's REG_NOTES.
- A REG_DEAD note is added to an insn's REG_NOTES for any register
- that meets both of two conditions: The value in the register is not
- needed in subsequent insns and the insn does not replace the value in
- the register (in the case of multi-word hard registers, the value in
- each register must be replaced by the insn to avoid a REG_DEAD note).
-
- In the vast majority of cases, an object in a REG_DEAD note will be
- used somewhere in the insn. The (rare) exception to this is if an
- insn uses a multi-word hard register and only some of the registers are
- needed in subsequent insns. In that case, REG_DEAD notes will be
- provided for those hard registers that are not subsequently needed.
- Partial REG_DEAD notes of this type do not occur when an insn sets
- only some of the hard registers used in such a multi-word operand;
- omitting REG_DEAD notes for objects stored in an insn is optional and
- the desire to do so does not justify the complexity of the partial
- REG_DEAD notes.
-
- REG_UNUSED notes are added for each register that is set by the insn
- but is unused subsequently (if every register set by the insn is unused
- and the insn does not reference memory or have some other side-effect,
- the insn is deleted instead). If only part of a multi-word hard
- register is used in a subsequent insn, REG_UNUSED notes are made for
- the parts that will not be used.
-
- To determine which registers are live after any insn, one can
- start from the beginning of the basic block and scan insns, noting
- which registers are set by each insn and which die there.
-
- ** Other actions of life_analysis **
-
- life_analysis sets up the LOG_LINKS fields of insns because the
- information needed to do so is readily available.
-
- life_analysis deletes insns whose only effect is to store a value
- that is never used.
-
- life_analysis notices cases where a reference to a register as
- a memory address can be combined with a preceding or following
- incrementation or decrementation of the register. The separate
- instruction to increment or decrement is deleted and the address
- is changed to a POST_INC or similar rtx.
-
- Each time an incrementing or decrementing address is created,
- a REG_INC element is added to the insn's REG_NOTES list.
-
- life_analysis fills in certain vectors containing information about
- register usage: reg_n_refs, reg_n_deaths, reg_n_sets, reg_live_length,
- reg_n_calls_crosses and reg_basic_block. */
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "basic-block.h"
-#include "insn-config.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "flags.h"
-#include "output.h"
-#include "except.h"
-
-#include "obstack.h"
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-/* List of labels that must never be deleted. */
-extern rtx forced_labels;
-
-/* Get the basic block number of an insn.
- This info should not be expected to remain available
- after the end of life_analysis. */
-
-/* This is the limit of the allocated space in the following two arrays. */
-
-static int max_uid_for_flow;
-
-#define BLOCK_NUM(INSN) uid_block_number[INSN_UID (INSN)]
-
-/* This is where the BLOCK_NUM values are really stored.
- This is set up by find_basic_blocks and used there and in life_analysis,
- and then freed. */
-
-static int *uid_block_number;
-
-/* INSN_VOLATILE (insn) is 1 if the insn refers to anything volatile. */
-
-#define INSN_VOLATILE(INSN) uid_volatile[INSN_UID (INSN)]
-static char *uid_volatile;
-
-/* Number of basic blocks in the current function. */
-
-int n_basic_blocks;
-
-/* Maximum register number used in this function, plus one. */
-
-int max_regno;
-
-/* Maximum number of SCRATCH rtx's used in any basic block of this
- function. */
-
-int max_scratch;
-
-/* Number of SCRATCH rtx's in the current block. */
-
-static int num_scratch;
-
-/* Indexed by n, gives number of basic block that (REG n) is used in.
- If the value is REG_BLOCK_GLOBAL (-2),
- it means (REG n) is used in more than one basic block.
- REG_BLOCK_UNKNOWN (-1) means it hasn't been seen yet so we don't know.
- This information remains valid for the rest of the compilation
- of the current function; it is used to control register allocation. */
-
-int *reg_basic_block;
-
-/* Indexed by n, gives number of times (REG n) is used or set, each
- weighted by its loop-depth.
- This information remains valid for the rest of the compilation
- of the current function; it is used to control register allocation. */
-
-int *reg_n_refs;
-
-/* Indexed by N; says whether a pseudo register N was ever used
- within a SUBREG that changes the size of the reg. Some machines prohibit
- such objects to be in certain (usually floating-point) registers. */
-
-char *reg_changes_size;
-
-/* Indexed by N, gives number of places register N dies.
- This information remains valid for the rest of the compilation
- of the current function; it is used to control register allocation. */
-
-short *reg_n_deaths;
-
-/* Indexed by N, gives 1 if that reg is live across any CALL_INSNs.
- This information remains valid for the rest of the compilation
- of the current function; it is used to control register allocation. */
-
-int *reg_n_calls_crossed;
-
-/* Total number of instructions at which (REG n) is live.
- The larger this is, the less priority (REG n) gets for
- allocation in a real register.
- This information remains valid for the rest of the compilation
- of the current function; it is used to control register allocation.
-
- local-alloc.c may alter this number to change the priority.
-
- Negative values are special.
- -1 is used to mark a pseudo reg which has a constant or memory equivalent
- and is used infrequently enough that it should not get a hard register.
- -2 is used to mark a pseudo reg for a parameter, when a frame pointer
- is not required. global.c makes an allocno for this but does
- not try to assign a hard register to it. */
-
-int *reg_live_length;
-
-/* Element N is the next insn that uses (hard or pseudo) register number N
- within the current basic block; or zero, if there is no such insn.
- This is valid only during the final backward scan in propagate_block. */
-
-static rtx *reg_next_use;
-
-/* Size of a regset for the current function,
- in (1) bytes and (2) elements. */
-
-int regset_bytes;
-int regset_size;
-
-/* Element N is first insn in basic block N.
- This info lasts until we finish compiling the function. */
-
-rtx *basic_block_head;
-
-/* Element N is last insn in basic block N.
- This info lasts until we finish compiling the function. */
-
-rtx *basic_block_end;
-
-/* Element N is a regset describing the registers live
- at the start of basic block N.
- This info lasts until we finish compiling the function. */
-
-regset *basic_block_live_at_start;
-
-/* Regset of regs live when calls to `setjmp'-like functions happen. */
-
-regset regs_live_at_setjmp;
-
-/* List made of EXPR_LIST rtx's which gives pairs of pseudo registers
- that have to go in the same hard reg.
- The first two regs in the list are a pair, and the next two
- are another pair, etc. */
-rtx regs_may_share;
-
-/* Element N is nonzero if control can drop into basic block N
- from the preceding basic block. Freed after life_analysis. */
-
-static char *basic_block_drops_in;
-
-/* Element N is depth within loops of the last insn in basic block number N.
- Freed after life_analysis. */
-
-static short *basic_block_loop_depth;
-
-/* Element N nonzero if basic block N can actually be reached.
- Vector exists only during find_basic_blocks. */
-
-static char *block_live_static;
-
-/* Depth within loops of basic block being scanned for lifetime analysis,
- plus one. This is the weight attached to references to registers. */
-
-static int loop_depth;
-
-/* During propagate_block, this is non-zero if the value of CC0 is live. */
-
-static int cc0_live;
-
-/* During propagate_block, this contains the last MEM stored into. It
- is used to eliminate consecutive stores to the same location. */
-
-static rtx last_mem_set;
-
-/* Set of registers that may be eliminable. These are handled specially
- in updating regs_ever_live. */
-
-static HARD_REG_SET elim_reg_set;
-
-/* Forward declarations */
-static void find_basic_blocks PROTO((rtx, rtx));
-static int jmp_uses_reg_or_mem PROTO((rtx));
-static void mark_label_ref PROTO((rtx, rtx, int));
-static void life_analysis PROTO((rtx, int));
-void allocate_for_life_analysis PROTO((void));
-static void init_regset_vector PROTO((regset *, regset, int, int));
-static void propagate_block PROTO((regset, rtx, rtx, int,
- regset, int));
-static rtx flow_delete_insn PROTO((rtx));
-static int insn_dead_p PROTO((rtx, regset, int));
-static int libcall_dead_p PROTO((rtx, regset, rtx, rtx));
-static void mark_set_regs PROTO((regset, regset, rtx,
- rtx, regset));
-static void mark_set_1 PROTO((regset, regset, rtx,
- rtx, regset));
-static void find_auto_inc PROTO((regset, rtx, rtx));
-static void mark_used_regs PROTO((regset, regset, rtx, int, rtx));
-static int try_pre_increment_1 PROTO((rtx));
-static int try_pre_increment PROTO((rtx, rtx, HOST_WIDE_INT));
-static rtx find_use_as_address PROTO((rtx, rtx, HOST_WIDE_INT));
-void dump_flow_info PROTO((FILE *));
-
-/* Find basic blocks of the current function and perform data flow analysis.
- F is the first insn of the function and NREGS the number of register numbers
- in use. */
-
-void
-flow_analysis (f, nregs, file)
- rtx f;
- int nregs;
- FILE *file;
-{
- register rtx insn;
- register int i;
- rtx nonlocal_label_list = nonlocal_label_rtx_list ();
-
-#ifdef ELIMINABLE_REGS
- static struct {int from, to; } eliminables[] = ELIMINABLE_REGS;
-#endif
-
- /* Record which registers will be eliminated. We use this in
- mark_used_regs. */
-
- CLEAR_HARD_REG_SET (elim_reg_set);
-
-#ifdef ELIMINABLE_REGS
- for (i = 0; i < sizeof eliminables / sizeof eliminables[0]; i++)
- SET_HARD_REG_BIT (elim_reg_set, eliminables[i].from);
-#else
- SET_HARD_REG_BIT (elim_reg_set, FRAME_POINTER_REGNUM);
-#endif
-
- /* Count the basic blocks. Also find maximum insn uid value used. */
-
- {
- register RTX_CODE prev_code = JUMP_INSN;
- register RTX_CODE code;
-
- max_uid_for_flow = 0;
-
- for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
- {
- code = GET_CODE (insn);
- if (INSN_UID (insn) > max_uid_for_flow)
- max_uid_for_flow = INSN_UID (insn);
- if (code == CODE_LABEL
- || (GET_RTX_CLASS (code) == 'i'
- && (prev_code == JUMP_INSN
- || (prev_code == CALL_INSN
- && nonlocal_label_list != 0)
- || prev_code == BARRIER)))
- i++;
-
- if (code == CALL_INSN && find_reg_note (insn, REG_RETVAL, NULL_RTX))
- code = INSN;
-
- if (code != NOTE)
- prev_code = code;
- }
- }
-
-#ifdef AUTO_INC_DEC
- /* Leave space for insns we make in some cases for auto-inc. These cases
- are rare, so we don't need too much space. */
- max_uid_for_flow += max_uid_for_flow / 10;
-#endif
-
- /* Allocate some tables that last till end of compiling this function
- and some needed only in find_basic_blocks and life_analysis. */
-
- n_basic_blocks = i;
- basic_block_head = (rtx *) oballoc (n_basic_blocks * sizeof (rtx));
- basic_block_end = (rtx *) oballoc (n_basic_blocks * sizeof (rtx));
- basic_block_drops_in = (char *) alloca (n_basic_blocks);
- basic_block_loop_depth = (short *) alloca (n_basic_blocks * sizeof (short));
- uid_block_number
- = (int *) alloca ((max_uid_for_flow + 1) * sizeof (int));
- uid_volatile = (char *) alloca (max_uid_for_flow + 1);
- bzero (uid_volatile, max_uid_for_flow + 1);
-
- find_basic_blocks (f, nonlocal_label_list);
- life_analysis (f, nregs);
- if (file)
- dump_flow_info (file);
-
- basic_block_drops_in = 0;
- uid_block_number = 0;
- basic_block_loop_depth = 0;
-}
-
-/* Find all basic blocks of the function whose first insn is F.
- Store the correct data in the tables that describe the basic blocks,
- set up the chains of references for each CODE_LABEL, and
- delete any entire basic blocks that cannot be reached.
-
- NONLOCAL_LABEL_LIST is the same local variable from flow_analysis. */
-
-static void
-find_basic_blocks (f, nonlocal_label_list)
- rtx f, nonlocal_label_list;
-{
- register rtx insn;
- register int i;
- register char *block_live = (char *) alloca (n_basic_blocks);
- register char *block_marked = (char *) alloca (n_basic_blocks);
- /* List of label_refs to all labels whose addresses are taken
- and used as data. */
- rtx label_value_list;
- rtx x, note;
- enum rtx_code prev_code, code;
- int depth, pass;
-
- pass = 1;
- restart:
-
- label_value_list = 0;
- block_live_static = block_live;
- bzero (block_live, n_basic_blocks);
- bzero (block_marked, n_basic_blocks);
-
- /* Initialize with just block 0 reachable and no blocks marked. */
- if (n_basic_blocks > 0)
- block_live[0] = 1;
-
- /* Initialize the ref chain of each label to 0. Record where all the
- blocks start and end and their depth in loops. For each insn, record
- the block it is in. Also mark as reachable any blocks headed by labels
- that must not be deleted. */
-
- for (insn = f, i = -1, prev_code = JUMP_INSN, depth = 1;
- insn; insn = NEXT_INSN (insn))
- {
- code = GET_CODE (insn);
- if (code == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- depth++;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- depth--;
- }
-
- /* A basic block starts at label, or after something that can jump. */
- else if (code == CODE_LABEL
- || (GET_RTX_CLASS (code) == 'i'
- && (prev_code == JUMP_INSN
- || (prev_code == CALL_INSN
- && nonlocal_label_list != 0
- && ! find_reg_note (insn, REG_RETVAL, NULL_RTX))
- || prev_code == BARRIER)))
- {
- basic_block_head[++i] = insn;
- basic_block_end[i] = insn;
- basic_block_loop_depth[i] = depth;
-
- if (code == CODE_LABEL)
- {
- LABEL_REFS (insn) = insn;
- /* Any label that cannot be deleted
- is considered to start a reachable block. */
- if (LABEL_PRESERVE_P (insn))
- block_live[i] = 1;
- }
- }
-
- else if (GET_RTX_CLASS (code) == 'i')
- {
- basic_block_end[i] = insn;
- basic_block_loop_depth[i] = depth;
- }
-
- if (GET_RTX_CLASS (code) == 'i')
- {
- /* Make a list of all labels referred to other than by jumps. */
- for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_LABEL)
- label_value_list = gen_rtx (EXPR_LIST, VOIDmode, XEXP (note, 0),
- label_value_list);
- }
-
- BLOCK_NUM (insn) = i;
-
- if (code != NOTE)
- prev_code = code;
- }
-
- /* During the second pass, `n_basic_blocks' is only an upper bound.
- Only perform the sanity check for the first pass, and on the second
- pass ensure `n_basic_blocks' is set to the correct value. */
- if (pass == 1 && i + 1 != n_basic_blocks)
- abort ();
- n_basic_blocks = i + 1;
-
- /* Don't delete the labels (in this function)
- that are referenced by non-jump instructions. */
-
- for (x = label_value_list; x; x = XEXP (x, 1))
- if (! LABEL_REF_NONLOCAL_P (x))
- block_live[BLOCK_NUM (XEXP (x, 0))] = 1;
-
- for (x = forced_labels; x; x = XEXP (x, 1))
- if (! LABEL_REF_NONLOCAL_P (x))
- block_live[BLOCK_NUM (XEXP (x, 0))] = 1;
-
- for (x = exception_handler_labels; x; x = XEXP (x, 1))
- block_live[BLOCK_NUM (XEXP (x, 0))] = 1;
-
- /* Record which basic blocks control can drop in to. */
-
- for (i = 0; i < n_basic_blocks; i++)
- {
- for (insn = PREV_INSN (basic_block_head[i]);
- insn && GET_CODE (insn) == NOTE; insn = PREV_INSN (insn))
- ;
-
- basic_block_drops_in[i] = insn && GET_CODE (insn) != BARRIER;
- }
-
- /* Now find which basic blocks can actually be reached
- and put all jump insns' LABEL_REFS onto the ref-chains
- of their target labels. */
-
- if (n_basic_blocks > 0)
- {
- int something_marked = 1;
- int deleted;
-
- /* Find all indirect jump insns and mark them as possibly jumping to all
- the labels whose addresses are explicitly used. This is because,
- when there are computed gotos, we can't tell which labels they jump
- to, of all the possibilities.
-
- Tablejumps and casesi insns are OK and we can recognize them by
- a (use (label_ref)). */
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == JUMP_INSN)
- {
- rtx pat = PATTERN (insn);
- int computed_jump = 0;
-
- if (GET_CODE (pat) == PARALLEL)
- {
- int len = XVECLEN (pat, 0);
- int has_use_labelref = 0;
-
- for (i = len - 1; i >= 0; i--)
- if (GET_CODE (XVECEXP (pat, 0, i)) == USE
- && (GET_CODE (XEXP (XVECEXP (pat, 0, i), 0))
- == LABEL_REF))
- has_use_labelref = 1;
-
- if (! has_use_labelref)
- for (i = len - 1; i >= 0; i--)
- if (GET_CODE (XVECEXP (pat, 0, i)) == SET
- && SET_DEST (XVECEXP (pat, 0, i)) == pc_rtx
- && jmp_uses_reg_or_mem (SET_SRC (XVECEXP (pat, 0, i))))
- computed_jump = 1;
- }
- else if (GET_CODE (pat) == SET
- && SET_DEST (pat) == pc_rtx
- && jmp_uses_reg_or_mem (SET_SRC (pat)))
- computed_jump = 1;
-
- if (computed_jump)
- {
- for (x = label_value_list; x; x = XEXP (x, 1))
- mark_label_ref (gen_rtx (LABEL_REF, VOIDmode, XEXP (x, 0)),
- insn, 0);
-
- for (x = forced_labels; x; x = XEXP (x, 1))
- mark_label_ref (gen_rtx (LABEL_REF, VOIDmode, XEXP (x, 0)),
- insn, 0);
- }
- }
-
- /* Find all call insns and mark them as possibly jumping
- to all the nonlocal goto handler labels. */
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == CALL_INSN
- && ! find_reg_note (insn, REG_RETVAL, NULL_RTX))
- {
- for (x = nonlocal_label_list; x; x = XEXP (x, 1))
- mark_label_ref (gen_rtx (LABEL_REF, VOIDmode, XEXP (x, 0)),
- insn, 0);
-
- /* ??? This could be made smarter:
- in some cases it's possible to tell that certain
- calls will not do a nonlocal goto.
-
- For example, if the nested functions that do the
- nonlocal gotos do not have their addresses taken, then
- only calls to those functions or to other nested
- functions that use them could possibly do nonlocal
- gotos. */
- }
-
- /* Pass over all blocks, marking each block that is reachable
- and has not yet been marked.
- Keep doing this until, in one pass, no blocks have been marked.
- Then blocks_live and blocks_marked are identical and correct.
- In addition, all jumps actually reachable have been marked. */
-
- while (something_marked)
- {
- something_marked = 0;
- for (i = 0; i < n_basic_blocks; i++)
- if (block_live[i] && !block_marked[i])
- {
- block_marked[i] = 1;
- something_marked = 1;
- if (i + 1 < n_basic_blocks && basic_block_drops_in[i + 1])
- block_live[i + 1] = 1;
- insn = basic_block_end[i];
- if (GET_CODE (insn) == JUMP_INSN)
- mark_label_ref (PATTERN (insn), insn, 0);
- }
- }
-
- /* ??? See if we have a "live" basic block that is not reachable.
- This can happen if it is headed by a label that is preserved or
- in one of the label lists, but no call or computed jump is in
- the loop. It's not clear if we can delete the block or not,
- but don't for now. However, we will mess up register status if
- it remains unreachable, so add a fake reachability from the
- previous block. */
-
- for (i = 1; i < n_basic_blocks; i++)
- if (block_live[i] && ! basic_block_drops_in[i]
- && GET_CODE (basic_block_head[i]) == CODE_LABEL
- && LABEL_REFS (basic_block_head[i]) == basic_block_head[i])
- basic_block_drops_in[i] = 1;
-
- /* Now delete the code for any basic blocks that can't be reached.
- They can occur because jump_optimize does not recognize
- unreachable loops as unreachable. */
-
- deleted = 0;
- for (i = 0; i < n_basic_blocks; i++)
- if (!block_live[i])
- {
- deleted++;
-
- /* Delete the insns in a (non-live) block. We physically delete
- every non-note insn except the start and end (so
- basic_block_head/end needn't be updated), we turn the latter
- into NOTE_INSN_DELETED notes.
- We use to "delete" the insns by turning them into notes, but
- we may be deleting lots of insns that subsequent passes would
- otherwise have to process. Secondly, lots of deleted blocks in
- a row can really slow down propagate_block since it will
- otherwise process insn-turned-notes multiple times when it
- looks for loop begin/end notes. */
- if (basic_block_head[i] != basic_block_end[i])
- {
- /* It would be quicker to delete all of these with a single
- unchaining, rather than one at a time, but we need to keep
- the NOTE's. */
- insn = NEXT_INSN (basic_block_head[i]);
- while (insn != basic_block_end[i])
- {
- if (GET_CODE (insn) == BARRIER)
- abort ();
- else if (GET_CODE (insn) != NOTE)
- insn = flow_delete_insn (insn);
- else
- insn = NEXT_INSN (insn);
- }
- }
- insn = basic_block_head[i];
- if (GET_CODE (insn) != NOTE)
- {
- /* Turn the head into a deleted insn note. */
- if (GET_CODE (insn) == BARRIER)
- abort ();
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- }
- insn = basic_block_end[i];
- if (GET_CODE (insn) != NOTE)
- {
- /* Turn the tail into a deleted insn note. */
- if (GET_CODE (insn) == BARRIER)
- abort ();
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- }
- /* BARRIERs are between basic blocks, not part of one.
- Delete a BARRIER if the preceding jump is deleted.
- We cannot alter a BARRIER into a NOTE
- because it is too short; but we can really delete
- it because it is not part of a basic block. */
- if (NEXT_INSN (insn) != 0
- && GET_CODE (NEXT_INSN (insn)) == BARRIER)
- delete_insn (NEXT_INSN (insn));
-
- /* Each time we delete some basic blocks,
- see if there is a jump around them that is
- being turned into a no-op. If so, delete it. */
-
- if (block_live[i - 1])
- {
- register int j;
- for (j = i + 1; j < n_basic_blocks; j++)
- if (block_live[j])
- {
- rtx label;
- insn = basic_block_end[i - 1];
- if (GET_CODE (insn) == JUMP_INSN
- /* An unconditional jump is the only possibility
- we must check for, since a conditional one
- would make these blocks live. */
- && simplejump_p (insn)
- && (label = XEXP (SET_SRC (PATTERN (insn)), 0), 1)
- && INSN_UID (label) != 0
- && BLOCK_NUM (label) == j)
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- if (GET_CODE (NEXT_INSN (insn)) != BARRIER)
- abort ();
- delete_insn (NEXT_INSN (insn));
- }
- break;
- }
- }
- }
-
- /* There are pathological cases where one function calling hundreds of
- nested inline functions can generate lots and lots of unreachable
- blocks that jump can't delete. Since we don't use sparse matrices
- a lot of memory will be needed to compile such functions.
- Implementing sparse matrices is a fair bit of work and it is not
- clear that they win more than they lose (we don't want to
- unnecessarily slow down compilation of normal code). By making
- another pass for the pathological case, we can greatly speed up
- their compilation without hurting normal code. This works because
- all the insns in the unreachable blocks have either been deleted or
- turned into notes.
- Note that we're talking about reducing memory usage by 10's of
- megabytes and reducing compilation time by several minutes. */
- /* ??? The choice of when to make another pass is a bit arbitrary,
- and was derived from empirical data. */
- if (pass == 1
- && deleted > 200)
- {
- pass++;
- n_basic_blocks -= deleted;
- /* `n_basic_blocks' may not be correct at this point: two previously
- separate blocks may now be merged. That's ok though as we
- recalculate it during the second pass. It certainly can't be
- any larger than the current value. */
- goto restart;
- }
- }
-}
-
-/* Subroutines of find_basic_blocks. */
-
-/* Return 1 if X, the SRC_SRC of SET of (pc) contain a REG or MEM that is
- not in the constant pool and not in the condition of an IF_THEN_ELSE. */
-
-static int
-jmp_uses_reg_or_mem (x)
- rtx x;
-{
- enum rtx_code code = GET_CODE (x);
- int i, j;
- char *fmt;
-
- switch (code)
- {
- case CONST:
- case LABEL_REF:
- case PC:
- return 0;
-
- case REG:
- return 1;
-
- case MEM:
- return ! (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)));
-
- case IF_THEN_ELSE:
- return (jmp_uses_reg_or_mem (XEXP (x, 1))
- || jmp_uses_reg_or_mem (XEXP (x, 2)));
-
- case PLUS: case MINUS: case MULT:
- return (jmp_uses_reg_or_mem (XEXP (x, 0))
- || jmp_uses_reg_or_mem (XEXP (x, 1)));
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e'
- && jmp_uses_reg_or_mem (XEXP (x, i)))
- return 1;
-
- if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- if (jmp_uses_reg_or_mem (XVECEXP (x, i, j)))
- return 1;
- }
-
- return 0;
-}
-
-/* Check expression X for label references;
- if one is found, add INSN to the label's chain of references.
-
- CHECKDUP means check for and avoid creating duplicate references
- from the same insn. Such duplicates do no serious harm but
- can slow life analysis. CHECKDUP is set only when duplicates
- are likely. */
-
-static void
-mark_label_ref (x, insn, checkdup)
- rtx x, insn;
- int checkdup;
-{
- register RTX_CODE code;
- register int i;
- register char *fmt;
-
- /* We can be called with NULL when scanning label_value_list. */
- if (x == 0)
- return;
-
- code = GET_CODE (x);
- if (code == LABEL_REF)
- {
- register rtx label = XEXP (x, 0);
- register rtx y;
- if (GET_CODE (label) != CODE_LABEL)
- abort ();
- /* If the label was never emitted, this insn is junk,
- but avoid a crash trying to refer to BLOCK_NUM (label).
- This can happen as a result of a syntax error
- and a diagnostic has already been printed. */
- if (INSN_UID (label) == 0)
- return;
- CONTAINING_INSN (x) = insn;
- /* if CHECKDUP is set, check for duplicate ref from same insn
- and don't insert. */
- if (checkdup)
- for (y = LABEL_REFS (label); y != label; y = LABEL_NEXTREF (y))
- if (CONTAINING_INSN (y) == insn)
- return;
- LABEL_NEXTREF (x) = LABEL_REFS (label);
- LABEL_REFS (label) = x;
- block_live_static[BLOCK_NUM (label)] = 1;
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- mark_label_ref (XEXP (x, i), insn, 0);
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- mark_label_ref (XVECEXP (x, i, j), insn, 1);
- }
- }
-}
-
-/* Delete INSN by patching it out.
- Return the next insn. */
-
-static rtx
-flow_delete_insn (insn)
- rtx insn;
-{
- /* ??? For the moment we assume we don't have to watch for NULLs here
- since the start/end of basic blocks aren't deleted like this. */
- NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
- PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
- return NEXT_INSN (insn);
-}
-
-/* Determine which registers are live at the start of each
- basic block of the function whose first insn is F.
- NREGS is the number of registers used in F.
- We allocate the vector basic_block_live_at_start
- and the regsets that it points to, and fill them with the data.
- regset_size and regset_bytes are also set here. */
-
-static void
-life_analysis (f, nregs)
- rtx f;
- int nregs;
-{
- register regset tem;
- int first_pass;
- int changed;
- /* For each basic block, a bitmask of regs
- live on exit from the block. */
- regset *basic_block_live_at_end;
- /* For each basic block, a bitmask of regs
- live on entry to a successor-block of this block.
- If this does not match basic_block_live_at_end,
- that must be updated, and the block must be rescanned. */
- regset *basic_block_new_live_at_end;
- /* For each basic block, a bitmask of regs
- whose liveness at the end of the basic block
- can make a difference in which regs are live on entry to the block.
- These are the regs that are set within the basic block,
- possibly excluding those that are used after they are set. */
- regset *basic_block_significant;
- register int i;
- rtx insn;
-
- struct obstack flow_obstack;
-
- gcc_obstack_init (&flow_obstack);
-
- max_regno = nregs;
-
- bzero (regs_ever_live, sizeof regs_ever_live);
-
- /* Allocate and zero out many data structures
- that will record the data from lifetime analysis. */
-
- allocate_for_life_analysis ();
-
- reg_next_use = (rtx *) alloca (nregs * sizeof (rtx));
- bzero ((char *) reg_next_use, nregs * sizeof (rtx));
-
- /* Set up several regset-vectors used internally within this function.
- Their meanings are documented above, with their declarations. */
-
- basic_block_live_at_end
- = (regset *) alloca (n_basic_blocks * sizeof (regset));
-
- /* Don't use alloca since that leads to a crash rather than an error message
- if there isn't enough space.
- Don't use oballoc since we may need to allocate other things during
- this function on the temporary obstack. */
- tem = (regset) obstack_alloc (&flow_obstack, n_basic_blocks * regset_bytes);
- bzero ((char *) tem, n_basic_blocks * regset_bytes);
- init_regset_vector (basic_block_live_at_end, tem,
- n_basic_blocks, regset_bytes);
-
- basic_block_new_live_at_end
- = (regset *) alloca (n_basic_blocks * sizeof (regset));
- tem = (regset) obstack_alloc (&flow_obstack, n_basic_blocks * regset_bytes);
- bzero ((char *) tem, n_basic_blocks * regset_bytes);
- init_regset_vector (basic_block_new_live_at_end, tem,
- n_basic_blocks, regset_bytes);
-
- basic_block_significant
- = (regset *) alloca (n_basic_blocks * sizeof (regset));
- tem = (regset) obstack_alloc (&flow_obstack, n_basic_blocks * regset_bytes);
- bzero ((char *) tem, n_basic_blocks * regset_bytes);
- init_regset_vector (basic_block_significant, tem,
- n_basic_blocks, regset_bytes);
-
- /* Record which insns refer to any volatile memory
- or for any reason can't be deleted just because they are dead stores.
- Also, delete any insns that copy a register to itself. */
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- {
- enum rtx_code code1 = GET_CODE (insn);
- if (code1 == CALL_INSN)
- INSN_VOLATILE (insn) = 1;
- else if (code1 == INSN || code1 == JUMP_INSN)
- {
- /* Delete (in effect) any obvious no-op moves. */
- if (GET_CODE (PATTERN (insn)) == SET
- && GET_CODE (SET_DEST (PATTERN (insn))) == REG
- && GET_CODE (SET_SRC (PATTERN (insn))) == REG
- && REGNO (SET_DEST (PATTERN (insn))) ==
- REGNO (SET_SRC (PATTERN (insn)))
- /* Insns carrying these notes are useful later on. */
- && ! find_reg_note (insn, REG_EQUAL, NULL_RTX))
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- }
- /* Delete (in effect) any obvious no-op moves. */
- else if (GET_CODE (PATTERN (insn)) == SET
- && GET_CODE (SET_DEST (PATTERN (insn))) == SUBREG
- && GET_CODE (SUBREG_REG (SET_DEST (PATTERN (insn)))) == REG
- && GET_CODE (SET_SRC (PATTERN (insn))) == SUBREG
- && GET_CODE (SUBREG_REG (SET_SRC (PATTERN (insn)))) == REG
- && REGNO (SUBREG_REG (SET_DEST (PATTERN (insn)))) ==
- REGNO (SUBREG_REG (SET_SRC (PATTERN (insn))))
- && SUBREG_WORD (SET_DEST (PATTERN (insn))) ==
- SUBREG_WORD (SET_SRC (PATTERN (insn)))
- /* Insns carrying these notes are useful later on. */
- && ! find_reg_note (insn, REG_EQUAL, NULL_RTX))
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- }
- else if (GET_CODE (PATTERN (insn)) == PARALLEL)
- {
- /* If nothing but SETs of registers to themselves,
- this insn can also be deleted. */
- for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
- {
- rtx tem = XVECEXP (PATTERN (insn), 0, i);
-
- if (GET_CODE (tem) == USE
- || GET_CODE (tem) == CLOBBER)
- continue;
-
- if (GET_CODE (tem) != SET
- || GET_CODE (SET_DEST (tem)) != REG
- || GET_CODE (SET_SRC (tem)) != REG
- || REGNO (SET_DEST (tem)) != REGNO (SET_SRC (tem)))
- break;
- }
-
- if (i == XVECLEN (PATTERN (insn), 0)
- /* Insns carrying these notes are useful later on. */
- && ! find_reg_note (insn, REG_EQUAL, NULL_RTX))
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- }
- else
- INSN_VOLATILE (insn) = volatile_refs_p (PATTERN (insn));
- }
- else if (GET_CODE (PATTERN (insn)) != USE)
- INSN_VOLATILE (insn) = volatile_refs_p (PATTERN (insn));
- /* A SET that makes space on the stack cannot be dead.
- (Such SETs occur only for allocating variable-size data,
- so they will always have a PLUS or MINUS according to the
- direction of stack growth.)
- Even if this function never uses this stack pointer value,
- signal handlers do! */
- else if (code1 == INSN && GET_CODE (PATTERN (insn)) == SET
- && SET_DEST (PATTERN (insn)) == stack_pointer_rtx
-#ifdef STACK_GROWS_DOWNWARD
- && GET_CODE (SET_SRC (PATTERN (insn))) == MINUS
-#else
- && GET_CODE (SET_SRC (PATTERN (insn))) == PLUS
-#endif
- && XEXP (SET_SRC (PATTERN (insn)), 0) == stack_pointer_rtx)
- INSN_VOLATILE (insn) = 1;
- }
- }
-
- if (n_basic_blocks > 0)
-#ifdef EXIT_IGNORE_STACK
- if (! EXIT_IGNORE_STACK
- || (! FRAME_POINTER_REQUIRED && flag_omit_frame_pointer))
-#endif
- {
- /* If exiting needs the right stack value,
- consider the stack pointer live at the end of the function. */
- basic_block_live_at_end[n_basic_blocks - 1]
- [STACK_POINTER_REGNUM / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (STACK_POINTER_REGNUM % REGSET_ELT_BITS);
- basic_block_new_live_at_end[n_basic_blocks - 1]
- [STACK_POINTER_REGNUM / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (STACK_POINTER_REGNUM % REGSET_ELT_BITS);
- }
-
- /* Mark the frame pointer is needed at the end of the function. If
- we end up eliminating it, it will be removed from the live list
- of each basic block by reload. */
-
- if (n_basic_blocks > 0)
- {
- basic_block_live_at_end[n_basic_blocks - 1]
- [FRAME_POINTER_REGNUM / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (FRAME_POINTER_REGNUM % REGSET_ELT_BITS);
- basic_block_new_live_at_end[n_basic_blocks - 1]
- [FRAME_POINTER_REGNUM / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (FRAME_POINTER_REGNUM % REGSET_ELT_BITS);
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- /* If they are different, also mark the hard frame pointer as live */
- basic_block_live_at_end[n_basic_blocks - 1]
- [HARD_FRAME_POINTER_REGNUM / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (HARD_FRAME_POINTER_REGNUM
- % REGSET_ELT_BITS);
- basic_block_new_live_at_end[n_basic_blocks - 1]
- [HARD_FRAME_POINTER_REGNUM / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (HARD_FRAME_POINTER_REGNUM
- % REGSET_ELT_BITS);
-#endif
- }
-
- /* Mark all global registers and all registers used by the epilogue
- as being live at the end of the function since they may be
- referenced by our caller. */
-
- if (n_basic_blocks > 0)
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i]
-#ifdef EPILOGUE_USES
- || EPILOGUE_USES (i)
-#endif
- )
- {
- basic_block_live_at_end[n_basic_blocks - 1]
- [i / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS);
- basic_block_new_live_at_end[n_basic_blocks - 1]
- [i / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS);
- }
-
- /* Propagate life info through the basic blocks
- around the graph of basic blocks.
-
- This is a relaxation process: each time a new register
- is live at the end of the basic block, we must scan the block
- to determine which registers are, as a consequence, live at the beginning
- of that block. These registers must then be marked live at the ends
- of all the blocks that can transfer control to that block.
- The process continues until it reaches a fixed point. */
-
- first_pass = 1;
- changed = 1;
- while (changed)
- {
- changed = 0;
- for (i = n_basic_blocks - 1; i >= 0; i--)
- {
- int consider = first_pass;
- int must_rescan = first_pass;
- register int j;
-
- if (!first_pass)
- {
- /* Set CONSIDER if this block needs thinking about at all
- (that is, if the regs live now at the end of it
- are not the same as were live at the end of it when
- we last thought about it).
- Set must_rescan if it needs to be thought about
- instruction by instruction (that is, if any additional
- reg that is live at the end now but was not live there before
- is one of the significant regs of this basic block). */
-
- for (j = 0; j < regset_size; j++)
- {
- register REGSET_ELT_TYPE x
- = (basic_block_new_live_at_end[i][j]
- & ~basic_block_live_at_end[i][j]);
- if (x)
- consider = 1;
- if (x & basic_block_significant[i][j])
- {
- must_rescan = 1;
- consider = 1;
- break;
- }
- }
-
- if (! consider)
- continue;
- }
-
- /* The live_at_start of this block may be changing,
- so another pass will be required after this one. */
- changed = 1;
-
- if (! must_rescan)
- {
- /* No complete rescan needed;
- just record those variables newly known live at end
- as live at start as well. */
- for (j = 0; j < regset_size; j++)
- {
- register REGSET_ELT_TYPE x
- = (basic_block_new_live_at_end[i][j]
- & ~basic_block_live_at_end[i][j]);
- basic_block_live_at_start[i][j] |= x;
- basic_block_live_at_end[i][j] |= x;
- }
- }
- else
- {
- /* Update the basic_block_live_at_start
- by propagation backwards through the block. */
- bcopy ((char *) basic_block_new_live_at_end[i],
- (char *) basic_block_live_at_end[i], regset_bytes);
- bcopy ((char *) basic_block_live_at_end[i],
- (char *) basic_block_live_at_start[i], regset_bytes);
- propagate_block (basic_block_live_at_start[i],
- basic_block_head[i], basic_block_end[i], 0,
- first_pass ? basic_block_significant[i]
- : (regset) 0,
- i);
- }
-
- {
- register rtx jump, head;
-
- /* Update the basic_block_new_live_at_end's of the block
- that falls through into this one (if any). */
- head = basic_block_head[i];
- if (basic_block_drops_in[i])
- {
- register int j;
- for (j = 0; j < regset_size; j++)
- basic_block_new_live_at_end[i-1][j]
- |= basic_block_live_at_start[i][j];
- }
-
- /* Update the basic_block_new_live_at_end's of
- all the blocks that jump to this one. */
- if (GET_CODE (head) == CODE_LABEL)
- for (jump = LABEL_REFS (head);
- jump != head;
- jump = LABEL_NEXTREF (jump))
- {
- register int from_block = BLOCK_NUM (CONTAINING_INSN (jump));
- register int j;
- for (j = 0; j < regset_size; j++)
- basic_block_new_live_at_end[from_block][j]
- |= basic_block_live_at_start[i][j];
- }
- }
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
- }
- first_pass = 0;
- }
-
- /* The only pseudos that are live at the beginning of the function are
- those that were not set anywhere in the function. local-alloc doesn't
- know how to handle these correctly, so mark them as not local to any
- one basic block. */
-
- if (n_basic_blocks > 0)
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (basic_block_live_at_start[0][i / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS)))
- reg_basic_block[i] = REG_BLOCK_GLOBAL;
-
- /* Now the life information is accurate.
- Make one more pass over each basic block
- to delete dead stores, create autoincrement addressing
- and record how many times each register is used, is set, or dies.
-
- To save time, we operate directly in basic_block_live_at_end[i],
- thus destroying it (in fact, converting it into a copy of
- basic_block_live_at_start[i]). This is ok now because
- basic_block_live_at_end[i] is no longer used past this point. */
-
- max_scratch = 0;
-
- for (i = 0; i < n_basic_blocks; i++)
- {
- propagate_block (basic_block_live_at_end[i],
- basic_block_head[i], basic_block_end[i], 1,
- (regset) 0, i);
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
- }
-
-#if 0
- /* Something live during a setjmp should not be put in a register
- on certain machines which restore regs from stack frames
- rather than from the jmpbuf.
- But we don't need to do this for the user's variables, since
- ANSI says only volatile variables need this. */
-#ifdef LONGJMP_RESTORE_FROM_STACK
- for (i = FIRST_PSEUDO_REGISTER; i < nregs; i++)
- if (regs_live_at_setjmp[i / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS))
- && regno_reg_rtx[i] != 0 && ! REG_USERVAR_P (regno_reg_rtx[i]))
- {
- reg_live_length[i] = -1;
- reg_basic_block[i] = -1;
- }
-#endif
-#endif
-
- /* We have a problem with any pseudoreg that
- lives across the setjmp. ANSI says that if a
- user variable does not change in value
- between the setjmp and the longjmp, then the longjmp preserves it.
- This includes longjmp from a place where the pseudo appears dead.
- (In principle, the value still exists if it is in scope.)
- If the pseudo goes in a hard reg, some other value may occupy
- that hard reg where this pseudo is dead, thus clobbering the pseudo.
- Conclusion: such a pseudo must not go in a hard reg. */
- for (i = FIRST_PSEUDO_REGISTER; i < nregs; i++)
- if ((regs_live_at_setjmp[i / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS)))
- && regno_reg_rtx[i] != 0)
- {
- reg_live_length[i] = -1;
- reg_basic_block[i] = -1;
- }
-
- obstack_free (&flow_obstack, NULL_PTR);
-}
-
-/* Subroutines of life analysis. */
-
-/* Allocate the permanent data structures that represent the results
- of life analysis. Not static since used also for stupid life analysis. */
-
-void
-allocate_for_life_analysis ()
-{
- register int i;
- register regset tem;
-
- regset_size = ((max_regno + REGSET_ELT_BITS - 1) / REGSET_ELT_BITS);
- regset_bytes = regset_size * sizeof (*(regset) 0);
-
- reg_n_refs = (int *) oballoc (max_regno * sizeof (int));
- bzero ((char *) reg_n_refs, max_regno * sizeof (int));
-
- reg_n_sets = (short *) oballoc (max_regno * sizeof (short));
- bzero ((char *) reg_n_sets, max_regno * sizeof (short));
-
- reg_n_deaths = (short *) oballoc (max_regno * sizeof (short));
- bzero ((char *) reg_n_deaths, max_regno * sizeof (short));
-
- reg_changes_size = (char *) oballoc (max_regno * sizeof (char));
- bzero (reg_changes_size, max_regno * sizeof (char));;
-
- reg_live_length = (int *) oballoc (max_regno * sizeof (int));
- bzero ((char *) reg_live_length, max_regno * sizeof (int));
-
- reg_n_calls_crossed = (int *) oballoc (max_regno * sizeof (int));
- bzero ((char *) reg_n_calls_crossed, max_regno * sizeof (int));
-
- reg_basic_block = (int *) oballoc (max_regno * sizeof (int));
- for (i = 0; i < max_regno; i++)
- reg_basic_block[i] = REG_BLOCK_UNKNOWN;
-
- basic_block_live_at_start
- = (regset *) oballoc (n_basic_blocks * sizeof (regset));
- tem = (regset) oballoc (n_basic_blocks * regset_bytes);
- bzero ((char *) tem, n_basic_blocks * regset_bytes);
- init_regset_vector (basic_block_live_at_start, tem,
- n_basic_blocks, regset_bytes);
-
- regs_live_at_setjmp = (regset) oballoc (regset_bytes);
- bzero ((char *) regs_live_at_setjmp, regset_bytes);
-}
-
-/* Make each element of VECTOR point at a regset,
- taking the space for all those regsets from SPACE.
- SPACE is of type regset, but it is really as long as NELTS regsets.
- BYTES_PER_ELT is the number of bytes in one regset. */
-
-static void
-init_regset_vector (vector, space, nelts, bytes_per_elt)
- regset *vector;
- regset space;
- int nelts;
- int bytes_per_elt;
-{
- register int i;
- register regset p = space;
-
- for (i = 0; i < nelts; i++)
- {
- vector[i] = p;
- p += bytes_per_elt / sizeof (*p);
- }
-}
-
-/* Compute the registers live at the beginning of a basic block
- from those live at the end.
-
- When called, OLD contains those live at the end.
- On return, it contains those live at the beginning.
- FIRST and LAST are the first and last insns of the basic block.
-
- FINAL is nonzero if we are doing the final pass which is not
- for computing the life info (since that has already been done)
- but for acting on it. On this pass, we delete dead stores,
- set up the logical links and dead-variables lists of instructions,
- and merge instructions for autoincrement and autodecrement addresses.
-
- SIGNIFICANT is nonzero only the first time for each basic block.
- If it is nonzero, it points to a regset in which we store
- a 1 for each register that is set within the block.
-
- BNUM is the number of the basic block. */
-
-static void
-propagate_block (old, first, last, final, significant, bnum)
- register regset old;
- rtx first;
- rtx last;
- int final;
- regset significant;
- int bnum;
-{
- register rtx insn;
- rtx prev;
- regset live;
- regset dead;
-
- /* The following variables are used only if FINAL is nonzero. */
- /* This vector gets one element for each reg that has been live
- at any point in the basic block that has been scanned so far.
- SOMETIMES_MAX says how many elements are in use so far.
- In each element, OFFSET is the byte-number within a regset
- for the register described by the element, and BIT is a mask
- for that register's bit within the byte. */
- register struct sometimes { short offset; short bit; } *regs_sometimes_live;
- int sometimes_max = 0;
- /* This regset has 1 for each reg that we have seen live so far.
- It and REGS_SOMETIMES_LIVE are updated together. */
- regset maxlive;
-
- /* The loop depth may change in the middle of a basic block. Since we
- scan from end to beginning, we start with the depth at the end of the
- current basic block, and adjust as we pass ends and starts of loops. */
- loop_depth = basic_block_loop_depth[bnum];
-
- dead = (regset) alloca (regset_bytes);
- live = (regset) alloca (regset_bytes);
-
- cc0_live = 0;
- last_mem_set = 0;
-
- /* Include any notes at the end of the block in the scan.
- This is in case the block ends with a call to setjmp. */
-
- while (NEXT_INSN (last) != 0 && GET_CODE (NEXT_INSN (last)) == NOTE)
- {
- /* Look for loop boundaries, we are going forward here. */
- last = NEXT_INSN (last);
- if (NOTE_LINE_NUMBER (last) == NOTE_INSN_LOOP_BEG)
- loop_depth++;
- else if (NOTE_LINE_NUMBER (last) == NOTE_INSN_LOOP_END)
- loop_depth--;
- }
-
- if (final)
- {
- register int i, offset;
- REGSET_ELT_TYPE bit;
-
- num_scratch = 0;
- maxlive = (regset) alloca (regset_bytes);
- bcopy ((char *) old, (char *) maxlive, regset_bytes);
- regs_sometimes_live
- = (struct sometimes *) alloca (max_regno * sizeof (struct sometimes));
-
- /* Process the regs live at the end of the block.
- Enter them in MAXLIVE and REGS_SOMETIMES_LIVE.
- Also mark them as not local to any one basic block. */
-
- for (offset = 0, i = 0; offset < regset_size; offset++)
- for (bit = 1; bit; bit <<= 1, i++)
- {
- if (i == max_regno)
- break;
- if (old[offset] & bit)
- {
- reg_basic_block[i] = REG_BLOCK_GLOBAL;
- regs_sometimes_live[sometimes_max].offset = offset;
- regs_sometimes_live[sometimes_max].bit = i % REGSET_ELT_BITS;
- sometimes_max++;
- }
- }
- }
-
- /* Scan the block an insn at a time from end to beginning. */
-
- for (insn = last; ; insn = prev)
- {
- prev = PREV_INSN (insn);
-
- if (GET_CODE (insn) == NOTE)
- {
- /* Look for loop boundaries, remembering that we are going
- backwards. */
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- loop_depth++;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- loop_depth--;
-
- /* If we have LOOP_DEPTH == 0, there has been a bookkeeping error.
- Abort now rather than setting register status incorrectly. */
- if (loop_depth == 0)
- abort ();
-
- /* If this is a call to `setjmp' et al,
- warn if any non-volatile datum is live. */
-
- if (final && NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
- {
- int i;
- for (i = 0; i < regset_size; i++)
- regs_live_at_setjmp[i] |= old[i];
- }
- }
-
- /* Update the life-status of regs for this insn.
- First DEAD gets which regs are set in this insn
- then LIVE gets which regs are used in this insn.
- Then the regs live before the insn
- are those live after, with DEAD regs turned off,
- and then LIVE regs turned on. */
-
- else if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- register int i;
- rtx note = find_reg_note (insn, REG_RETVAL, NULL_RTX);
- int insn_is_dead
- = (insn_dead_p (PATTERN (insn), old, 0)
- /* Don't delete something that refers to volatile storage! */
- && ! INSN_VOLATILE (insn));
- int libcall_is_dead
- = (insn_is_dead && note != 0
- && libcall_dead_p (PATTERN (insn), old, note, insn));
-
- /* If an instruction consists of just dead store(s) on final pass,
- "delete" it by turning it into a NOTE of type NOTE_INSN_DELETED.
- We could really delete it with delete_insn, but that
- can cause trouble for first or last insn in a basic block. */
- if (final && insn_is_dead)
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
-
- /* CC0 is now known to be dead. Either this insn used it,
- in which case it doesn't anymore, or clobbered it,
- so the next insn can't use it. */
- cc0_live = 0;
-
- /* If this insn is copying the return value from a library call,
- delete the entire library call. */
- if (libcall_is_dead)
- {
- rtx first = XEXP (note, 0);
- rtx p = insn;
- while (INSN_DELETED_P (first))
- first = NEXT_INSN (first);
- while (p != first)
- {
- p = PREV_INSN (p);
- PUT_CODE (p, NOTE);
- NOTE_LINE_NUMBER (p) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (p) = 0;
- }
- }
- goto flushed;
- }
-
- for (i = 0; i < regset_size; i++)
- {
- dead[i] = 0; /* Faster than bzero here */
- live[i] = 0; /* since regset_size is usually small */
- }
-
- /* See if this is an increment or decrement that can be
- merged into a following memory address. */
-#ifdef AUTO_INC_DEC
- {
- register rtx x = PATTERN (insn);
- /* Does this instruction increment or decrement a register? */
- if (final && GET_CODE (x) == SET
- && GET_CODE (SET_DEST (x)) == REG
- && (GET_CODE (SET_SRC (x)) == PLUS
- || GET_CODE (SET_SRC (x)) == MINUS)
- && XEXP (SET_SRC (x), 0) == SET_DEST (x)
- && GET_CODE (XEXP (SET_SRC (x), 1)) == CONST_INT
- /* Ok, look for a following memory ref we can combine with.
- If one is found, change the memory ref to a PRE_INC
- or PRE_DEC, cancel this insn, and return 1.
- Return 0 if nothing has been done. */
- && try_pre_increment_1 (insn))
- goto flushed;
- }
-#endif /* AUTO_INC_DEC */
-
- /* If this is not the final pass, and this insn is copying the
- value of a library call and it's dead, don't scan the
- insns that perform the library call, so that the call's
- arguments are not marked live. */
- if (libcall_is_dead)
- {
- /* Mark the dest reg as `significant'. */
- mark_set_regs (old, dead, PATTERN (insn), NULL_RTX, significant);
-
- insn = XEXP (note, 0);
- prev = PREV_INSN (insn);
- }
- else if (GET_CODE (PATTERN (insn)) == SET
- && SET_DEST (PATTERN (insn)) == stack_pointer_rtx
- && GET_CODE (SET_SRC (PATTERN (insn))) == PLUS
- && XEXP (SET_SRC (PATTERN (insn)), 0) == stack_pointer_rtx
- && GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 1)) == CONST_INT)
- /* We have an insn to pop a constant amount off the stack.
- (Such insns use PLUS regardless of the direction of the stack,
- and any insn to adjust the stack by a constant is always a pop.)
- These insns, if not dead stores, have no effect on life. */
- ;
- else
- {
- /* LIVE gets the regs used in INSN;
- DEAD gets those set by it. Dead insns don't make anything
- live. */
-
- mark_set_regs (old, dead, PATTERN (insn),
- final ? insn : NULL_RTX, significant);
-
- /* If an insn doesn't use CC0, it becomes dead since we
- assume that every insn clobbers it. So show it dead here;
- mark_used_regs will set it live if it is referenced. */
- cc0_live = 0;
-
- if (! insn_is_dead)
- mark_used_regs (old, live, PATTERN (insn), final, insn);
-
- /* Sometimes we may have inserted something before INSN (such as
- a move) when we make an auto-inc. So ensure we will scan
- those insns. */
-#ifdef AUTO_INC_DEC
- prev = PREV_INSN (insn);
-#endif
-
- if (! insn_is_dead && GET_CODE (insn) == CALL_INSN)
- {
- register int i;
-
- rtx note;
-
- for (note = CALL_INSN_FUNCTION_USAGE (insn);
- note;
- note = XEXP (note, 1))
- if (GET_CODE (XEXP (note, 0)) == USE)
- mark_used_regs (old, live, SET_DEST (XEXP (note, 0)),
- final, insn);
-
- /* Each call clobbers all call-clobbered regs that are not
- global or fixed. Note that the function-value reg is a
- call-clobbered reg, and mark_set_regs has already had
- a chance to handle it. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i] && ! global_regs[i]
- && ! fixed_regs[i])
- dead[i / REGSET_ELT_BITS]
- |= ((REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS));
-
- /* The stack ptr is used (honorarily) by a CALL insn. */
- live[STACK_POINTER_REGNUM / REGSET_ELT_BITS]
- |= ((REGSET_ELT_TYPE) 1
- << (STACK_POINTER_REGNUM % REGSET_ELT_BITS));
-
- /* Calls may also reference any of the global registers,
- so they are made live. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i])
- mark_used_regs (old, live,
- gen_rtx (REG, reg_raw_mode[i], i),
- final, insn);
-
- /* Calls also clobber memory. */
- last_mem_set = 0;
- }
-
- /* Update OLD for the registers used or set. */
- for (i = 0; i < regset_size; i++)
- {
- old[i] &= ~dead[i];
- old[i] |= live[i];
- }
-
- if (GET_CODE (insn) == CALL_INSN && final)
- {
- /* Any regs live at the time of a call instruction
- must not go in a register clobbered by calls.
- Find all regs now live and record this for them. */
-
- register struct sometimes *p = regs_sometimes_live;
-
- for (i = 0; i < sometimes_max; i++, p++)
- if (old[p->offset] & ((REGSET_ELT_TYPE) 1 << p->bit))
- reg_n_calls_crossed[p->offset * REGSET_ELT_BITS + p->bit]+= 1;
- }
- }
-
- /* On final pass, add any additional sometimes-live regs
- into MAXLIVE and REGS_SOMETIMES_LIVE.
- Also update counts of how many insns each reg is live at. */
-
- if (final)
- {
- for (i = 0; i < regset_size; i++)
- {
- register REGSET_ELT_TYPE diff = live[i] & ~maxlive[i];
-
- if (diff)
- {
- register int regno;
- maxlive[i] |= diff;
- for (regno = 0; diff && regno < REGSET_ELT_BITS; regno++)
- if (diff & ((REGSET_ELT_TYPE) 1 << regno))
- {
- regs_sometimes_live[sometimes_max].offset = i;
- regs_sometimes_live[sometimes_max].bit = regno;
- diff &= ~ ((REGSET_ELT_TYPE) 1 << regno);
- sometimes_max++;
- }
- }
- }
-
- {
- register struct sometimes *p = regs_sometimes_live;
- for (i = 0; i < sometimes_max; i++, p++)
- {
- if (old[p->offset] & ((REGSET_ELT_TYPE) 1 << p->bit))
- reg_live_length[p->offset * REGSET_ELT_BITS + p->bit]++;
- }
- }
- }
- }
- flushed: ;
- if (insn == first)
- break;
- }
-
- if (num_scratch > max_scratch)
- max_scratch = num_scratch;
-}
-
-/* Return 1 if X (the body of an insn, or part of it) is just dead stores
- (SET expressions whose destinations are registers dead after the insn).
- NEEDED is the regset that says which regs are alive after the insn.
-
- Unless CALL_OK is non-zero, an insn is needed if it contains a CALL. */
-
-static int
-insn_dead_p (x, needed, call_ok)
- rtx x;
- regset needed;
- int call_ok;
-{
- register RTX_CODE code = GET_CODE (x);
- /* If setting something that's a reg or part of one,
- see if that register's altered value will be live. */
-
- if (code == SET)
- {
- register rtx r = SET_DEST (x);
- /* A SET that is a subroutine call cannot be dead. */
- if (! call_ok && GET_CODE (SET_SRC (x)) == CALL)
- return 0;
-
-#ifdef HAVE_cc0
- if (GET_CODE (r) == CC0)
- return ! cc0_live;
-#endif
-
- if (GET_CODE (r) == MEM && last_mem_set && ! MEM_VOLATILE_P (r)
- && rtx_equal_p (r, last_mem_set))
- return 1;
-
- while (GET_CODE (r) == SUBREG
- || GET_CODE (r) == STRICT_LOW_PART
- || GET_CODE (r) == ZERO_EXTRACT
- || GET_CODE (r) == SIGN_EXTRACT)
- r = SUBREG_REG (r);
-
- if (GET_CODE (r) == REG)
- {
- register int regno = REGNO (r);
- register int offset = regno / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
-
- /* Don't delete insns to set global regs. */
- if ((regno < FIRST_PSEUDO_REGISTER && global_regs[regno])
- /* Make sure insns to set frame pointer aren't deleted. */
- || regno == FRAME_POINTER_REGNUM
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- || regno == HARD_FRAME_POINTER_REGNUM
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- /* Make sure insns to set arg pointer are never deleted
- (if the arg pointer isn't fixed, there will be a USE for
- it, so we can treat it normally). */
- || (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
-#endif
- || (needed[offset] & bit) != 0)
- return 0;
-
- /* If this is a hard register, verify that subsequent words are
- not needed. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int n = HARD_REGNO_NREGS (regno, GET_MODE (r));
-
- while (--n > 0)
- if ((needed[(regno + n) / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1
- << ((regno + n) % REGSET_ELT_BITS))) != 0)
- return 0;
- }
-
- return 1;
- }
- }
- /* If performing several activities,
- insn is dead if each activity is individually dead.
- Also, CLOBBERs and USEs can be ignored; a CLOBBER or USE
- that's inside a PARALLEL doesn't make the insn worth keeping. */
- else if (code == PARALLEL)
- {
- register int i = XVECLEN (x, 0);
- for (i--; i >= 0; i--)
- {
- rtx elt = XVECEXP (x, 0, i);
- if (!insn_dead_p (elt, needed, call_ok)
- && GET_CODE (elt) != CLOBBER
- && GET_CODE (elt) != USE)
- return 0;
- }
- return 1;
- }
- /* We do not check CLOBBER or USE here.
- An insn consisting of just a CLOBBER or just a USE
- should not be deleted. */
- return 0;
-}
-
-/* If X is the pattern of the last insn in a libcall, and assuming X is dead,
- return 1 if the entire library call is dead.
- This is true if X copies a register (hard or pseudo)
- and if the hard return reg of the call insn is dead.
- (The caller should have tested the destination of X already for death.)
-
- If this insn doesn't just copy a register, then we don't
- have an ordinary libcall. In that case, cse could not have
- managed to substitute the source for the dest later on,
- so we can assume the libcall is dead.
-
- NEEDED is the bit vector of pseudoregs live before this insn.
- NOTE is the REG_RETVAL note of the insn. INSN is the insn itself. */
-
-static int
-libcall_dead_p (x, needed, note, insn)
- rtx x;
- regset needed;
- rtx note;
- rtx insn;
-{
- register RTX_CODE code = GET_CODE (x);
-
- if (code == SET)
- {
- register rtx r = SET_SRC (x);
- if (GET_CODE (r) == REG)
- {
- rtx call = XEXP (note, 0);
- register int i;
-
- /* Find the call insn. */
- while (call != insn && GET_CODE (call) != CALL_INSN)
- call = NEXT_INSN (call);
-
- /* If there is none, do nothing special,
- since ordinary death handling can understand these insns. */
- if (call == insn)
- return 0;
-
- /* See if the hard reg holding the value is dead.
- If this is a PARALLEL, find the call within it. */
- call = PATTERN (call);
- if (GET_CODE (call) == PARALLEL)
- {
- for (i = XVECLEN (call, 0) - 1; i >= 0; i--)
- if (GET_CODE (XVECEXP (call, 0, i)) == SET
- && GET_CODE (SET_SRC (XVECEXP (call, 0, i))) == CALL)
- break;
-
- /* This may be a library call that is returning a value
- via invisible pointer. Do nothing special, since
- ordinary death handling can understand these insns. */
- if (i < 0)
- return 0;
-
- call = XVECEXP (call, 0, i);
- }
-
- return insn_dead_p (call, needed, 1);
- }
- }
- return 1;
-}
-
-/* Return 1 if register REGNO was used before it was set.
- In other words, if it is live at function entry.
- Don't count global register variables or variables in registers
- that can be used for function arg passing, though. */
-
-int
-regno_uninitialized (regno)
- int regno;
-{
- if (n_basic_blocks == 0
- || (regno < FIRST_PSEUDO_REGISTER
- && (global_regs[regno] || FUNCTION_ARG_REGNO_P (regno))))
- return 0;
-
- return (basic_block_live_at_start[0][regno / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS)));
-}
-
-/* 1 if register REGNO was alive at a place where `setjmp' was called
- and was set more than once or is an argument.
- Such regs may be clobbered by `longjmp'. */
-
-int
-regno_clobbered_at_setjmp (regno)
- int regno;
-{
- if (n_basic_blocks == 0)
- return 0;
-
- return ((reg_n_sets[regno] > 1
- || (basic_block_live_at_start[0][regno / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS))))
- && (regs_live_at_setjmp[regno / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS))));
-}
-
-/* Process the registers that are set within X.
- Their bits are set to 1 in the regset DEAD,
- because they are dead prior to this insn.
-
- If INSN is nonzero, it is the insn being processed
- and the fact that it is nonzero implies this is the FINAL pass
- in propagate_block. In this case, various info about register
- usage is stored, LOG_LINKS fields of insns are set up. */
-
-static void
-mark_set_regs (needed, dead, x, insn, significant)
- regset needed;
- regset dead;
- rtx x;
- rtx insn;
- regset significant;
-{
- register RTX_CODE code = GET_CODE (x);
-
- if (code == SET || code == CLOBBER)
- mark_set_1 (needed, dead, x, insn, significant);
- else if (code == PARALLEL)
- {
- register int i;
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- {
- code = GET_CODE (XVECEXP (x, 0, i));
- if (code == SET || code == CLOBBER)
- mark_set_1 (needed, dead, XVECEXP (x, 0, i), insn, significant);
- }
- }
-}
-
-/* Process a single SET rtx, X. */
-
-static void
-mark_set_1 (needed, dead, x, insn, significant)
- regset needed;
- regset dead;
- rtx x;
- rtx insn;
- regset significant;
-{
- register int regno;
- register rtx reg = SET_DEST (x);
-
- /* Modifying just one hardware register of a multi-reg value
- or just a byte field of a register
- does not mean the value from before this insn is now dead.
- But it does mean liveness of that register at the end of the block
- is significant.
-
- Within mark_set_1, however, we treat it as if the register is
- indeed modified. mark_used_regs will, however, also treat this
- register as being used. Thus, we treat these insns as setting a
- new value for the register as a function of its old value. This
- cases LOG_LINKS to be made appropriately and this will help combine. */
-
- while (GET_CODE (reg) == SUBREG || GET_CODE (reg) == ZERO_EXTRACT
- || GET_CODE (reg) == SIGN_EXTRACT
- || GET_CODE (reg) == STRICT_LOW_PART)
- reg = XEXP (reg, 0);
-
- /* If we are writing into memory or into a register mentioned in the
- address of the last thing stored into memory, show we don't know
- what the last store was. If we are writing memory, save the address
- unless it is volatile. */
- if (GET_CODE (reg) == MEM
- || (GET_CODE (reg) == REG
- && last_mem_set != 0 && reg_overlap_mentioned_p (reg, last_mem_set)))
- last_mem_set = 0;
-
- if (GET_CODE (reg) == MEM && ! side_effects_p (reg)
- /* There are no REG_INC notes for SP, so we can't assume we'll see
- everything that invalidates it. To be safe, don't eliminate any
- stores though SP; none of them should be redundant anyway. */
- && ! reg_mentioned_p (stack_pointer_rtx, reg))
- last_mem_set = reg;
-
- if (GET_CODE (reg) == REG
- && (regno = REGNO (reg), regno != FRAME_POINTER_REGNUM)
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- && regno != HARD_FRAME_POINTER_REGNUM
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- && ! (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
-#endif
- && ! (regno < FIRST_PSEUDO_REGISTER && global_regs[regno]))
- /* && regno != STACK_POINTER_REGNUM) -- let's try without this. */
- {
- register int offset = regno / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
- REGSET_ELT_TYPE some_needed = (needed[offset] & bit);
- REGSET_ELT_TYPE some_not_needed = (~ needed[offset]) & bit;
-
- /* Mark it as a significant register for this basic block. */
- if (significant)
- significant[offset] |= bit;
-
- /* Mark it as as dead before this insn. */
- dead[offset] |= bit;
-
- /* A hard reg in a wide mode may really be multiple registers.
- If so, mark all of them just like the first. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int n;
-
- /* Nothing below is needed for the stack pointer; get out asap.
- Eg, log links aren't needed, since combine won't use them. */
- if (regno == STACK_POINTER_REGNUM)
- return;
-
- n = HARD_REGNO_NREGS (regno, GET_MODE (reg));
- while (--n > 0)
- {
- REGSET_ELT_TYPE n_bit
- = (REGSET_ELT_TYPE) 1 << ((regno + n) % REGSET_ELT_BITS);
-
- if (significant)
- significant[(regno + n) / REGSET_ELT_BITS] |= n_bit;
-
- dead[(regno + n) / REGSET_ELT_BITS] |= n_bit;
- some_needed
- |= (needed[(regno + n) / REGSET_ELT_BITS] & n_bit);
- some_not_needed
- |= ((~ needed[(regno + n) / REGSET_ELT_BITS]) & n_bit);
- }
- }
- /* Additional data to record if this is the final pass. */
- if (insn)
- {
- register rtx y = reg_next_use[regno];
- register int blocknum = BLOCK_NUM (insn);
-
- /* If this is a hard reg, record this function uses the reg. */
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- register int i;
- int endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (reg));
-
- for (i = regno; i < endregno; i++)
- {
- /* The next use is no longer "next", since a store
- intervenes. */
- reg_next_use[i] = 0;
-
- regs_ever_live[i] = 1;
- reg_n_sets[i]++;
- }
- }
- else
- {
- /* The next use is no longer "next", since a store
- intervenes. */
- reg_next_use[regno] = 0;
-
- /* Keep track of which basic blocks each reg appears in. */
-
- if (reg_basic_block[regno] == REG_BLOCK_UNKNOWN)
- reg_basic_block[regno] = blocknum;
- else if (reg_basic_block[regno] != blocknum)
- reg_basic_block[regno] = REG_BLOCK_GLOBAL;
-
- /* Count (weighted) references, stores, etc. This counts a
- register twice if it is modified, but that is correct. */
- reg_n_sets[regno]++;
-
- reg_n_refs[regno] += loop_depth;
-
- /* The insns where a reg is live are normally counted
- elsewhere, but we want the count to include the insn
- where the reg is set, and the normal counting mechanism
- would not count it. */
- reg_live_length[regno]++;
- }
-
- if (! some_not_needed)
- {
- /* Make a logical link from the next following insn
- that uses this register, back to this insn.
- The following insns have already been processed.
-
- We don't build a LOG_LINK for hard registers containing
- in ASM_OPERANDs. If these registers get replaced,
- we might wind up changing the semantics of the insn,
- even if reload can make what appear to be valid assignments
- later. */
- if (y && (BLOCK_NUM (y) == blocknum)
- && (regno >= FIRST_PSEUDO_REGISTER
- || asm_noperands (PATTERN (y)) < 0))
- LOG_LINKS (y)
- = gen_rtx (INSN_LIST, VOIDmode, insn, LOG_LINKS (y));
- }
- else if (! some_needed)
- {
- /* Note that dead stores have already been deleted when possible
- If we get here, we have found a dead store that cannot
- be eliminated (because the same insn does something useful).
- Indicate this by marking the reg being set as dying here. */
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_UNUSED, reg, REG_NOTES (insn));
- reg_n_deaths[REGNO (reg)]++;
- }
- else
- {
- /* This is a case where we have a multi-word hard register
- and some, but not all, of the words of the register are
- needed in subsequent insns. Write REG_UNUSED notes
- for those parts that were not needed. This case should
- be rare. */
-
- int i;
-
- for (i = HARD_REGNO_NREGS (regno, GET_MODE (reg)) - 1;
- i >= 0; i--)
- if ((needed[(regno + i) / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1
- << ((regno + i) % REGSET_ELT_BITS))) == 0)
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_UNUSED,
- gen_rtx (REG, reg_raw_mode[regno + i],
- regno + i),
- REG_NOTES (insn));
- }
- }
- }
- else if (GET_CODE (reg) == REG)
- reg_next_use[regno] = 0;
-
- /* If this is the last pass and this is a SCRATCH, show it will be dying
- here and count it. */
- else if (GET_CODE (reg) == SCRATCH && insn != 0)
- {
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_UNUSED, reg, REG_NOTES (insn));
- num_scratch++;
- }
-}
-
-#ifdef AUTO_INC_DEC
-
-/* X is a MEM found in INSN. See if we can convert it into an auto-increment
- reference. */
-
-static void
-find_auto_inc (needed, x, insn)
- regset needed;
- rtx x;
- rtx insn;
-{
- rtx addr = XEXP (x, 0);
- HOST_WIDE_INT offset = 0;
- rtx set;
-
- /* Here we detect use of an index register which might be good for
- postincrement, postdecrement, preincrement, or predecrement. */
-
- if (GET_CODE (addr) == PLUS && GET_CODE (XEXP (addr, 1)) == CONST_INT)
- offset = INTVAL (XEXP (addr, 1)), addr = XEXP (addr, 0);
-
- if (GET_CODE (addr) == REG)
- {
- register rtx y;
- register int size = GET_MODE_SIZE (GET_MODE (x));
- rtx use;
- rtx incr;
- int regno = REGNO (addr);
-
- /* Is the next use an increment that might make auto-increment? */
- if ((incr = reg_next_use[regno]) != 0
- && (set = single_set (incr)) != 0
- && GET_CODE (set) == SET
- && BLOCK_NUM (incr) == BLOCK_NUM (insn)
- /* Can't add side effects to jumps; if reg is spilled and
- reloaded, there's no way to store back the altered value. */
- && GET_CODE (insn) != JUMP_INSN
- && (y = SET_SRC (set), GET_CODE (y) == PLUS)
- && XEXP (y, 0) == addr
- && GET_CODE (XEXP (y, 1)) == CONST_INT
- && (0
-#ifdef HAVE_POST_INCREMENT
- || (INTVAL (XEXP (y, 1)) == size && offset == 0)
-#endif
-#ifdef HAVE_POST_DECREMENT
- || (INTVAL (XEXP (y, 1)) == - size && offset == 0)
-#endif
-#ifdef HAVE_PRE_INCREMENT
- || (INTVAL (XEXP (y, 1)) == size && offset == size)
-#endif
-#ifdef HAVE_PRE_DECREMENT
- || (INTVAL (XEXP (y, 1)) == - size && offset == - size)
-#endif
- )
- /* Make sure this reg appears only once in this insn. */
- && (use = find_use_as_address (PATTERN (insn), addr, offset),
- use != 0 && use != (rtx) 1))
- {
- rtx q = SET_DEST (set);
- enum rtx_code inc_code = (INTVAL (XEXP (y, 1)) == size
- ? (offset ? PRE_INC : POST_INC)
- : (offset ? PRE_DEC : POST_DEC));
-
- if (dead_or_set_p (incr, addr))
- {
- /* This is the simple case. Try to make the auto-inc. If
- we can't, we are done. Otherwise, we will do any
- needed updates below. */
- if (! validate_change (insn, &XEXP (x, 0),
- gen_rtx (inc_code, Pmode, addr),
- 0))
- return;
- }
- else if (GET_CODE (q) == REG
- /* PREV_INSN used here to check the semi-open interval
- [insn,incr). */
- && ! reg_used_between_p (q, PREV_INSN (insn), incr)
- /* We must also check for sets of q as q may be
- a call clobbered hard register and there may
- be a call between PREV_INSN (insn) and incr. */
- && ! reg_set_between_p (q, PREV_INSN (insn), incr))
- {
- /* We have *p followed sometime later by q = p+size.
- Both p and q must be live afterward,
- and q is not used between INSN and it's assignment.
- Change it to q = p, ...*q..., q = q+size.
- Then fall into the usual case. */
- rtx insns, temp;
-
- start_sequence ();
- emit_move_insn (q, addr);
- insns = get_insns ();
- end_sequence ();
-
- /* If anything in INSNS have UID's that don't fit within the
- extra space we allocate earlier, we can't make this auto-inc.
- This should never happen. */
- for (temp = insns; temp; temp = NEXT_INSN (temp))
- {
- if (INSN_UID (temp) > max_uid_for_flow)
- return;
- BLOCK_NUM (temp) = BLOCK_NUM (insn);
- }
-
- /* If we can't make the auto-inc, or can't make the
- replacement into Y, exit. There's no point in making
- the change below if we can't do the auto-inc and doing
- so is not correct in the pre-inc case. */
-
- validate_change (insn, &XEXP (x, 0),
- gen_rtx (inc_code, Pmode, q),
- 1);
- validate_change (incr, &XEXP (y, 0), q, 1);
- if (! apply_change_group ())
- return;
-
- /* We now know we'll be doing this change, so emit the
- new insn(s) and do the updates. */
- emit_insns_before (insns, insn);
-
- if (basic_block_head[BLOCK_NUM (insn)] == insn)
- basic_block_head[BLOCK_NUM (insn)] = insns;
-
- /* INCR will become a NOTE and INSN won't contain a
- use of ADDR. If a use of ADDR was just placed in
- the insn before INSN, make that the next use.
- Otherwise, invalidate it. */
- if (GET_CODE (PREV_INSN (insn)) == INSN
- && GET_CODE (PATTERN (PREV_INSN (insn))) == SET
- && SET_SRC (PATTERN (PREV_INSN (insn))) == addr)
- reg_next_use[regno] = PREV_INSN (insn);
- else
- reg_next_use[regno] = 0;
-
- addr = q;
- regno = REGNO (q);
-
- /* REGNO is now used in INCR which is below INSN, but
- it previously wasn't live here. If we don't mark
- it as needed, we'll put a REG_DEAD note for it
- on this insn, which is incorrect. */
- needed[regno / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
-
- /* If there are any calls between INSN and INCR, show
- that REGNO now crosses them. */
- for (temp = insn; temp != incr; temp = NEXT_INSN (temp))
- if (GET_CODE (temp) == CALL_INSN)
- reg_n_calls_crossed[regno]++;
- }
- else
- return;
-
- /* If we haven't returned, it means we were able to make the
- auto-inc, so update the status. First, record that this insn
- has an implicit side effect. */
-
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_INC, addr, REG_NOTES (insn));
-
- /* Modify the old increment-insn to simply copy
- the already-incremented value of our register. */
- if (! validate_change (incr, &SET_SRC (set), addr, 0))
- abort ();
-
- /* If that makes it a no-op (copying the register into itself) delete
- it so it won't appear to be a "use" and a "set" of this
- register. */
- if (SET_DEST (set) == addr)
- {
- PUT_CODE (incr, NOTE);
- NOTE_LINE_NUMBER (incr) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (incr) = 0;
- }
-
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- /* Count an extra reference to the reg. When a reg is
- incremented, spilling it is worse, so we want to make
- that less likely. */
- reg_n_refs[regno] += loop_depth;
-
- /* Count the increment as a setting of the register,
- even though it isn't a SET in rtl. */
- reg_n_sets[regno]++;
- }
- }
- }
-}
-#endif /* AUTO_INC_DEC */
-
-/* Scan expression X and store a 1-bit in LIVE for each reg it uses.
- This is done assuming the registers needed from X
- are those that have 1-bits in NEEDED.
-
- On the final pass, FINAL is 1. This means try for autoincrement
- and count the uses and deaths of each pseudo-reg.
-
- INSN is the containing instruction. If INSN is dead, this function is not
- called. */
-
-static void
-mark_used_regs (needed, live, x, final, insn)
- regset needed;
- regset live;
- rtx x;
- int final;
- rtx insn;
-{
- register RTX_CODE code;
- register int regno;
- int i;
-
- retry:
- code = GET_CODE (x);
- switch (code)
- {
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST_INT:
- case CONST:
- case CONST_DOUBLE:
- case PC:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case ASM_INPUT:
- return;
-
-#ifdef HAVE_cc0
- case CC0:
- cc0_live = 1;
- return;
-#endif
-
- case CLOBBER:
- /* If we are clobbering a MEM, mark any registers inside the address
- as being used. */
- if (GET_CODE (XEXP (x, 0)) == MEM)
- mark_used_regs (needed, live, XEXP (XEXP (x, 0), 0), final, insn);
- return;
-
- case MEM:
- /* Invalidate the data for the last MEM stored. We could do this only
- if the addresses conflict, but this doesn't seem worthwhile. */
- last_mem_set = 0;
-
-#ifdef AUTO_INC_DEC
- if (final)
- find_auto_inc (needed, x, insn);
-#endif
- break;
-
- case SUBREG:
- if (GET_CODE (SUBREG_REG (x)) == REG
- && REGNO (SUBREG_REG (x)) >= FIRST_PSEUDO_REGISTER
- && (GET_MODE_SIZE (GET_MODE (x))
- != GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))))
- reg_changes_size[REGNO (SUBREG_REG (x))] = 1;
-
- /* While we're here, optimize this case. */
- x = SUBREG_REG (x);
-
- /* In case the SUBREG is not of a register, don't optimize */
- if (GET_CODE (x) != REG)
- {
- mark_used_regs (needed, live, x, final, insn);
- return;
- }
-
- /* ... fall through ... */
-
- case REG:
- /* See a register other than being set
- => mark it as needed. */
-
- regno = REGNO (x);
- {
- register int offset = regno / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
- REGSET_ELT_TYPE some_needed = needed[offset] & bit;
- REGSET_ELT_TYPE some_not_needed = (~ needed[offset]) & bit;
-
- live[offset] |= bit;
-
- /* A hard reg in a wide mode may really be multiple registers.
- If so, mark all of them just like the first. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int n;
-
- /* For stack ptr or fixed arg pointer,
- nothing below can be necessary, so waste no more time. */
- if (regno == STACK_POINTER_REGNUM
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- || regno == HARD_FRAME_POINTER_REGNUM
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
-#endif
- || regno == FRAME_POINTER_REGNUM)
- {
- /* If this is a register we are going to try to eliminate,
- don't mark it live here. If we are successful in
- eliminating it, it need not be live unless it is used for
- pseudos, in which case it will have been set live when
- it was allocated to the pseudos. If the register will not
- be eliminated, reload will set it live at that point. */
-
- if (! TEST_HARD_REG_BIT (elim_reg_set, regno))
- regs_ever_live[regno] = 1;
- return;
- }
- /* No death notes for global register variables;
- their values are live after this function exits. */
- if (global_regs[regno])
- {
- if (final)
- reg_next_use[regno] = insn;
- return;
- }
-
- n = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (--n > 0)
- {
- REGSET_ELT_TYPE n_bit
- = (REGSET_ELT_TYPE) 1 << ((regno + n) % REGSET_ELT_BITS);
-
- live[(regno + n) / REGSET_ELT_BITS] |= n_bit;
- some_needed |= (needed[(regno + n) / REGSET_ELT_BITS] & n_bit);
- some_not_needed
- |= ((~ needed[(regno + n) / REGSET_ELT_BITS]) & n_bit);
- }
- }
- if (final)
- {
- /* Record where each reg is used, so when the reg
- is set we know the next insn that uses it. */
-
- reg_next_use[regno] = insn;
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- /* If a hard reg is being used,
- record that this function does use it. */
-
- i = HARD_REGNO_NREGS (regno, GET_MODE (x));
- if (i == 0)
- i = 1;
- do
- regs_ever_live[regno + --i] = 1;
- while (i > 0);
- }
- else
- {
- /* Keep track of which basic block each reg appears in. */
-
- register int blocknum = BLOCK_NUM (insn);
-
- if (reg_basic_block[regno] == REG_BLOCK_UNKNOWN)
- reg_basic_block[regno] = blocknum;
- else if (reg_basic_block[regno] != blocknum)
- reg_basic_block[regno] = REG_BLOCK_GLOBAL;
-
- /* Count (weighted) number of uses of each reg. */
-
- reg_n_refs[regno] += loop_depth;
- }
-
- /* Record and count the insns in which a reg dies.
- If it is used in this insn and was dead below the insn
- then it dies in this insn. If it was set in this insn,
- we do not make a REG_DEAD note; likewise if we already
- made such a note. */
-
- if (some_not_needed
- && ! dead_or_set_p (insn, x)
-#if 0
- && (regno >= FIRST_PSEUDO_REGISTER || ! fixed_regs[regno])
-#endif
- )
- {
- /* Check for the case where the register dying partially
- overlaps the register set by this insn. */
- if (regno < FIRST_PSEUDO_REGISTER
- && HARD_REGNO_NREGS (regno, GET_MODE (x)) > 1)
- {
- int n = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (--n >= 0)
- some_needed |= dead_or_set_regno_p (insn, regno + n);
- }
-
- /* If none of the words in X is needed, make a REG_DEAD
- note. Otherwise, we must make partial REG_DEAD notes. */
- if (! some_needed)
- {
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_DEAD, x, REG_NOTES (insn));
- reg_n_deaths[regno]++;
- }
- else
- {
- int i;
-
- /* Don't make a REG_DEAD note for a part of a register
- that is set in the insn. */
-
- for (i = HARD_REGNO_NREGS (regno, GET_MODE (x)) - 1;
- i >= 0; i--)
- if ((needed[(regno + i) / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1
- << ((regno + i) % REGSET_ELT_BITS))) == 0
- && ! dead_or_set_regno_p (insn, regno + i))
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_DEAD,
- gen_rtx (REG, reg_raw_mode[regno + i],
- regno + i),
- REG_NOTES (insn));
- }
- }
- }
- }
- return;
-
- case SET:
- {
- register rtx testreg = SET_DEST (x);
- int mark_dest = 0;
-
- /* If storing into MEM, don't show it as being used. But do
- show the address as being used. */
- if (GET_CODE (testreg) == MEM)
- {
-#ifdef AUTO_INC_DEC
- if (final)
- find_auto_inc (needed, testreg, insn);
-#endif
- mark_used_regs (needed, live, XEXP (testreg, 0), final, insn);
- mark_used_regs (needed, live, SET_SRC (x), final, insn);
- return;
- }
-
- /* Storing in STRICT_LOW_PART is like storing in a reg
- in that this SET might be dead, so ignore it in TESTREG.
- but in some other ways it is like using the reg.
-
- Storing in a SUBREG or a bit field is like storing the entire
- register in that if the register's value is not used
- then this SET is not needed. */
- while (GET_CODE (testreg) == STRICT_LOW_PART
- || GET_CODE (testreg) == ZERO_EXTRACT
- || GET_CODE (testreg) == SIGN_EXTRACT
- || GET_CODE (testreg) == SUBREG)
- {
- if (GET_CODE (testreg) == SUBREG
- && GET_CODE (SUBREG_REG (testreg)) == REG
- && REGNO (SUBREG_REG (testreg)) >= FIRST_PSEUDO_REGISTER
- && (GET_MODE_SIZE (GET_MODE (testreg))
- != GET_MODE_SIZE (GET_MODE (SUBREG_REG (testreg)))))
- reg_changes_size[REGNO (SUBREG_REG (testreg))] = 1;
-
- /* Modifying a single register in an alternate mode
- does not use any of the old value. But these other
- ways of storing in a register do use the old value. */
- if (GET_CODE (testreg) == SUBREG
- && !(REG_SIZE (SUBREG_REG (testreg)) > REG_SIZE (testreg)))
- ;
- else
- mark_dest = 1;
-
- testreg = XEXP (testreg, 0);
- }
-
- /* If this is a store into a register,
- recursively scan the value being stored. */
-
- if (GET_CODE (testreg) == REG
- && (regno = REGNO (testreg), regno != FRAME_POINTER_REGNUM)
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- && regno != HARD_FRAME_POINTER_REGNUM
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- && ! (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
-#endif
- )
- /* We used to exclude global_regs here, but that seems wrong.
- Storing in them is like storing in mem. */
- {
- mark_used_regs (needed, live, SET_SRC (x), final, insn);
- if (mark_dest)
- mark_used_regs (needed, live, SET_DEST (x), final, insn);
- return;
- }
- }
- break;
-
- case RETURN:
- /* If exiting needs the right stack value, consider this insn as
- using the stack pointer. In any event, consider it as using
- all global registers and all registers used by return. */
-
-#ifdef EXIT_IGNORE_STACK
- if (! EXIT_IGNORE_STACK
- || (! FRAME_POINTER_REQUIRED && flag_omit_frame_pointer))
-#endif
- live[STACK_POINTER_REGNUM / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (STACK_POINTER_REGNUM % REGSET_ELT_BITS);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i]
-#ifdef EPILOGUE_USES
- || EPILOGUE_USES (i)
-#endif
- )
- live[i / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS);
- break;
- }
-
- /* Recursively scan the operands of this expression. */
-
- {
- register char *fmt = GET_RTX_FORMAT (code);
- register int i;
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- /* Tail recursive case: save a function call level. */
- if (i == 0)
- {
- x = XEXP (x, 0);
- goto retry;
- }
- mark_used_regs (needed, live, XEXP (x, i), final, insn);
- }
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- mark_used_regs (needed, live, XVECEXP (x, i, j), final, insn);
- }
- }
- }
-}
-
-#ifdef AUTO_INC_DEC
-
-static int
-try_pre_increment_1 (insn)
- rtx insn;
-{
- /* Find the next use of this reg. If in same basic block,
- make it do pre-increment or pre-decrement if appropriate. */
- rtx x = PATTERN (insn);
- HOST_WIDE_INT amount = ((GET_CODE (SET_SRC (x)) == PLUS ? 1 : -1)
- * INTVAL (XEXP (SET_SRC (x), 1)));
- int regno = REGNO (SET_DEST (x));
- rtx y = reg_next_use[regno];
- if (y != 0
- && BLOCK_NUM (y) == BLOCK_NUM (insn)
- /* Don't do this if the reg dies, or gets set in y; a standard addressing
- mode would be better. */
- && ! dead_or_set_p (y, SET_DEST (x))
- && try_pre_increment (y, SET_DEST (PATTERN (insn)),
- amount))
- {
- /* We have found a suitable auto-increment
- and already changed insn Y to do it.
- So flush this increment-instruction. */
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- /* Count a reference to this reg for the increment
- insn we are deleting. When a reg is incremented.
- spilling it is worse, so we want to make that
- less likely. */
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- reg_n_refs[regno] += loop_depth;
- reg_n_sets[regno]++;
- }
- return 1;
- }
- return 0;
-}
-
-/* Try to change INSN so that it does pre-increment or pre-decrement
- addressing on register REG in order to add AMOUNT to REG.
- AMOUNT is negative for pre-decrement.
- Returns 1 if the change could be made.
- This checks all about the validity of the result of modifying INSN. */
-
-static int
-try_pre_increment (insn, reg, amount)
- rtx insn, reg;
- HOST_WIDE_INT amount;
-{
- register rtx use;
-
- /* Nonzero if we can try to make a pre-increment or pre-decrement.
- For example, addl $4,r1; movl (r1),... can become movl +(r1),... */
- int pre_ok = 0;
- /* Nonzero if we can try to make a post-increment or post-decrement.
- For example, addl $4,r1; movl -4(r1),... can become movl (r1)+,...
- It is possible for both PRE_OK and POST_OK to be nonzero if the machine
- supports both pre-inc and post-inc, or both pre-dec and post-dec. */
- int post_ok = 0;
-
- /* Nonzero if the opportunity actually requires post-inc or post-dec. */
- int do_post = 0;
-
- /* From the sign of increment, see which possibilities are conceivable
- on this target machine. */
-#ifdef HAVE_PRE_INCREMENT
- if (amount > 0)
- pre_ok = 1;
-#endif
-#ifdef HAVE_POST_INCREMENT
- if (amount > 0)
- post_ok = 1;
-#endif
-
-#ifdef HAVE_PRE_DECREMENT
- if (amount < 0)
- pre_ok = 1;
-#endif
-#ifdef HAVE_POST_DECREMENT
- if (amount < 0)
- post_ok = 1;
-#endif
-
- if (! (pre_ok || post_ok))
- return 0;
-
- /* It is not safe to add a side effect to a jump insn
- because if the incremented register is spilled and must be reloaded
- there would be no way to store the incremented value back in memory. */
-
- if (GET_CODE (insn) == JUMP_INSN)
- return 0;
-
- use = 0;
- if (pre_ok)
- use = find_use_as_address (PATTERN (insn), reg, 0);
- if (post_ok && (use == 0 || use == (rtx) 1))
- {
- use = find_use_as_address (PATTERN (insn), reg, -amount);
- do_post = 1;
- }
-
- if (use == 0 || use == (rtx) 1)
- return 0;
-
- if (GET_MODE_SIZE (GET_MODE (use)) != (amount > 0 ? amount : - amount))
- return 0;
-
- /* See if this combination of instruction and addressing mode exists. */
- if (! validate_change (insn, &XEXP (use, 0),
- gen_rtx (amount > 0
- ? (do_post ? POST_INC : PRE_INC)
- : (do_post ? POST_DEC : PRE_DEC),
- Pmode, reg), 0))
- return 0;
-
- /* Record that this insn now has an implicit side effect on X. */
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_INC, reg, REG_NOTES (insn));
- return 1;
-}
-
-#endif /* AUTO_INC_DEC */
-
-/* Find the place in the rtx X where REG is used as a memory address.
- Return the MEM rtx that so uses it.
- If PLUSCONST is nonzero, search instead for a memory address equivalent to
- (plus REG (const_int PLUSCONST)).
-
- If such an address does not appear, return 0.
- If REG appears more than once, or is used other than in such an address,
- return (rtx)1. */
-
-static rtx
-find_use_as_address (x, reg, plusconst)
- register rtx x;
- rtx reg;
- HOST_WIDE_INT plusconst;
-{
- enum rtx_code code = GET_CODE (x);
- char *fmt = GET_RTX_FORMAT (code);
- register int i;
- register rtx value = 0;
- register rtx tem;
-
- if (code == MEM && XEXP (x, 0) == reg && plusconst == 0)
- return x;
-
- if (code == MEM && GET_CODE (XEXP (x, 0)) == PLUS
- && XEXP (XEXP (x, 0), 0) == reg
- && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (x, 0), 1)) == plusconst)
- return x;
-
- if (code == SIGN_EXTRACT || code == ZERO_EXTRACT)
- {
- /* If REG occurs inside a MEM used in a bit-field reference,
- that is unacceptable. */
- if (find_use_as_address (XEXP (x, 0), reg, 0) != 0)
- return (rtx) (HOST_WIDE_INT) 1;
- }
-
- if (x == reg)
- return (rtx) (HOST_WIDE_INT) 1;
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- tem = find_use_as_address (XEXP (x, i), reg, plusconst);
- if (value == 0)
- value = tem;
- else if (tem != 0)
- return (rtx) (HOST_WIDE_INT) 1;
- }
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- {
- tem = find_use_as_address (XVECEXP (x, i, j), reg, plusconst);
- if (value == 0)
- value = tem;
- else if (tem != 0)
- return (rtx) (HOST_WIDE_INT) 1;
- }
- }
- }
-
- return value;
-}
-
-/* Write information about registers and basic blocks into FILE.
- This is part of making a debugging dump. */
-
-void
-dump_flow_info (file)
- FILE *file;
-{
- register int i;
- static char *reg_class_names[] = REG_CLASS_NAMES;
-
- fprintf (file, "%d registers.\n", max_regno);
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_n_refs[i])
- {
- enum reg_class class, altclass;
- fprintf (file, "\nRegister %d used %d times across %d insns",
- i, reg_n_refs[i], reg_live_length[i]);
- if (reg_basic_block[i] >= 0)
- fprintf (file, " in block %d", reg_basic_block[i]);
- if (reg_n_deaths[i] != 1)
- fprintf (file, "; dies in %d places", reg_n_deaths[i]);
- if (reg_n_calls_crossed[i] == 1)
- fprintf (file, "; crosses 1 call");
- else if (reg_n_calls_crossed[i])
- fprintf (file, "; crosses %d calls", reg_n_calls_crossed[i]);
- if (PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD)
- fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i));
- class = reg_preferred_class (i);
- altclass = reg_alternate_class (i);
- if (class != GENERAL_REGS || altclass != ALL_REGS)
- {
- if (altclass == ALL_REGS || class == ALL_REGS)
- fprintf (file, "; pref %s", reg_class_names[(int) class]);
- else if (altclass == NO_REGS)
- fprintf (file, "; %s or none", reg_class_names[(int) class]);
- else
- fprintf (file, "; pref %s, else %s",
- reg_class_names[(int) class],
- reg_class_names[(int) altclass]);
- }
- if (REGNO_POINTER_FLAG (i))
- fprintf (file, "; pointer");
- fprintf (file, ".\n");
- }
- fprintf (file, "\n%d basic blocks.\n", n_basic_blocks);
- for (i = 0; i < n_basic_blocks; i++)
- {
- register rtx head, jump;
- register int regno;
- fprintf (file, "\nBasic block %d: first insn %d, last %d.\n",
- i,
- INSN_UID (basic_block_head[i]),
- INSN_UID (basic_block_end[i]));
- /* The control flow graph's storage is freed
- now when flow_analysis returns.
- Don't try to print it if it is gone. */
- if (basic_block_drops_in)
- {
- fprintf (file, "Reached from blocks: ");
- head = basic_block_head[i];
- if (GET_CODE (head) == CODE_LABEL)
- for (jump = LABEL_REFS (head);
- jump != head;
- jump = LABEL_NEXTREF (jump))
- {
- register int from_block = BLOCK_NUM (CONTAINING_INSN (jump));
- fprintf (file, " %d", from_block);
- }
- if (basic_block_drops_in[i])
- fprintf (file, " previous");
- }
- fprintf (file, "\nRegisters live at start:");
- for (regno = 0; regno < max_regno; regno++)
- {
- register int offset = regno / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
- if (basic_block_live_at_start[i][offset] & bit)
- fprintf (file, " %d", regno);
- }
- fprintf (file, "\n");
- }
- fprintf (file, "\n");
-}
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
deleted file mode 100644
index f75d479637e..00000000000
--- a/gcc/fold-const.c
+++ /dev/null
@@ -1,5701 +0,0 @@
-/* Fold a constant sub-tree into a single node for C-compiler
- Copyright (C) 1987, 88, 92-96, 1997 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 should be rewritten to use an arbitrary precision
- @@ representation for "struct tree_int_cst" and "struct tree_real_cst".
- @@ Perhaps the routines could also be used for bc/dc, and made a lib.
- @@ The routines that translate from the ap rep should
- @@ warn if precision et. al. is lost.
- @@ This would also make life easier when this technology is used
- @@ for cross-compilers. */
-
-
-/* The entry points in this file are fold, size_int and size_binop.
-
- fold takes a tree as argument and returns a simplified tree.
-
- size_binop takes a tree code for an arithmetic operation
- and two operands that are trees, and produces a tree for the
- result, assuming the type comes from `sizetype'.
-
- size_int takes an integer value, and creates a tree constant
- with type from `sizetype'. */
-
-#include <stdio.h>
-#include <setjmp.h>
-#include "config.h"
-#include "flags.h"
-#include "tree.h"
-
-/* Handle floating overflow for `const_binop'. */
-static jmp_buf float_error;
-
-static void encode PROTO((HOST_WIDE_INT *,
- HOST_WIDE_INT, HOST_WIDE_INT));
-static void decode PROTO((HOST_WIDE_INT *,
- HOST_WIDE_INT *, HOST_WIDE_INT *));
-int div_and_round_double PROTO((enum tree_code, int, HOST_WIDE_INT,
- HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT, HOST_WIDE_INT *,
- HOST_WIDE_INT *, HOST_WIDE_INT *,
- HOST_WIDE_INT *));
-static int split_tree PROTO((tree, enum tree_code, tree *,
- tree *, int *));
-static tree const_binop PROTO((enum tree_code, tree, tree, int));
-static tree fold_convert PROTO((tree, tree));
-static enum tree_code invert_tree_comparison PROTO((enum tree_code));
-static enum tree_code swap_tree_comparison PROTO((enum tree_code));
-static int truth_value_p PROTO((enum tree_code));
-static int operand_equal_for_comparison_p PROTO((tree, tree, tree));
-static int twoval_comparison_p PROTO((tree, tree *, tree *, int *));
-static tree eval_subst PROTO((tree, tree, tree, tree, tree));
-static tree omit_one_operand PROTO((tree, tree, tree));
-static tree pedantic_omit_one_operand PROTO((tree, tree, tree));
-static tree distribute_bit_expr PROTO((enum tree_code, tree, tree, tree));
-static tree make_bit_field_ref PROTO((tree, tree, int, int, int));
-static tree optimize_bit_field_compare PROTO((enum tree_code, tree,
- tree, tree));
-static tree decode_field_reference PROTO((tree, int *, int *,
- enum machine_mode *, int *,
- int *, tree *, tree *));
-static int all_ones_mask_p PROTO((tree, int));
-static int simple_operand_p PROTO((tree));
-static tree range_binop PROTO((enum tree_code, tree, tree, int,
- tree, int));
-static tree make_range PROTO((tree, int *, tree *, tree *));
-static tree build_range_check PROTO((tree, tree, int, tree, tree));
-static int merge_ranges PROTO((int *, tree *, tree *, int, tree, tree,
- int, tree, tree));
-static tree fold_range_test PROTO((tree));
-static tree unextend PROTO((tree, int, int, tree));
-static tree fold_truthop PROTO((enum tree_code, tree, tree, tree));
-static tree strip_compound_expr PROTO((tree, tree));
-
-#ifndef BRANCH_COST
-#define BRANCH_COST 1
-#endif
-
-/* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow.
- Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1.
- Then this yields nonzero if overflow occurred during the addition.
- Overflow occurs if A and B have the same sign, but A and SUM differ in sign.
- Use `^' to test whether signs differ, and `< 0' to isolate the sign. */
-#define overflow_sum_sign(a, b, sum) ((~((a) ^ (b)) & ((a) ^ (sum))) < 0)
-
-/* To do constant folding on INTEGER_CST nodes requires two-word arithmetic.
- We do that by representing the two-word integer in 4 words, with only
- HOST_BITS_PER_WIDE_INT/2 bits stored in each word, as a positive number. */
-
-#define LOWPART(x) \
- ((x) & (((unsigned HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT/2)) - 1))
-#define HIGHPART(x) \
- ((unsigned HOST_WIDE_INT) (x) >> HOST_BITS_PER_WIDE_INT/2)
-#define BASE ((unsigned HOST_WIDE_INT) 1 << HOST_BITS_PER_WIDE_INT/2)
-
-/* Unpack a two-word integer into 4 words.
- LOW and HI are the integer, as two `HOST_WIDE_INT' pieces.
- WORDS points to the array of HOST_WIDE_INTs. */
-
-static void
-encode (words, low, hi)
- HOST_WIDE_INT *words;
- HOST_WIDE_INT low, hi;
-{
- words[0] = LOWPART (low);
- words[1] = HIGHPART (low);
- words[2] = LOWPART (hi);
- words[3] = HIGHPART (hi);
-}
-
-/* Pack an array of 4 words into a two-word integer.
- WORDS points to the array of words.
- The integer is stored into *LOW and *HI as two `HOST_WIDE_INT' pieces. */
-
-static void
-decode (words, low, hi)
- HOST_WIDE_INT *words;
- HOST_WIDE_INT *low, *hi;
-{
- *low = words[0] | words[1] * BASE;
- *hi = words[2] | words[3] * BASE;
-}
-
-/* Make the integer constant T valid for its type
- by setting to 0 or 1 all the bits in the constant
- that don't belong in the type.
- Yield 1 if a signed overflow occurs, 0 otherwise.
- If OVERFLOW is nonzero, a signed overflow has already occurred
- in calculating T, so propagate it.
-
- Make the real constant T valid for its type by calling CHECK_FLOAT_VALUE,
- if it exists. */
-
-int
-force_fit_type (t, overflow)
- tree t;
- int overflow;
-{
- HOST_WIDE_INT low, high;
- register int prec;
-
- if (TREE_CODE (t) == REAL_CST)
- {
-#ifdef CHECK_FLOAT_VALUE
- CHECK_FLOAT_VALUE (TYPE_MODE (TREE_TYPE (t)), TREE_REAL_CST (t),
- overflow);
-#endif
- return overflow;
- }
-
- else if (TREE_CODE (t) != INTEGER_CST)
- return overflow;
-
- low = TREE_INT_CST_LOW (t);
- high = TREE_INT_CST_HIGH (t);
-
- if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE)
- prec = POINTER_SIZE;
- else
- prec = TYPE_PRECISION (TREE_TYPE (t));
-
- /* First clear all bits that are beyond the type's precision. */
-
- if (prec == 2 * HOST_BITS_PER_WIDE_INT)
- ;
- else if (prec > HOST_BITS_PER_WIDE_INT)
- {
- TREE_INT_CST_HIGH (t)
- &= ~((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
- }
- else
- {
- TREE_INT_CST_HIGH (t) = 0;
- if (prec < HOST_BITS_PER_WIDE_INT)
- TREE_INT_CST_LOW (t) &= ~((HOST_WIDE_INT) (-1) << prec);
- }
-
- /* Unsigned types do not suffer sign extension or overflow. */
- if (TREE_UNSIGNED (TREE_TYPE (t)))
- return overflow;
-
- /* If the value's sign bit is set, extend the sign. */
- if (prec != 2 * HOST_BITS_PER_WIDE_INT
- && (prec > HOST_BITS_PER_WIDE_INT
- ? (TREE_INT_CST_HIGH (t)
- & ((HOST_WIDE_INT) 1 << (prec - HOST_BITS_PER_WIDE_INT - 1)))
- : TREE_INT_CST_LOW (t) & ((HOST_WIDE_INT) 1 << (prec - 1))))
- {
- /* Value is negative:
- set to 1 all the bits that are outside this type's precision. */
- if (prec > HOST_BITS_PER_WIDE_INT)
- {
- TREE_INT_CST_HIGH (t)
- |= ((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
- }
- else
- {
- TREE_INT_CST_HIGH (t) = -1;
- if (prec < HOST_BITS_PER_WIDE_INT)
- TREE_INT_CST_LOW (t) |= ((HOST_WIDE_INT) (-1) << prec);
- }
- }
-
- /* Yield nonzero if signed overflow occurred. */
- return
- ((overflow | (low ^ TREE_INT_CST_LOW (t)) | (high ^ TREE_INT_CST_HIGH (t)))
- != 0);
-}
-
-/* Add two doubleword integers with doubleword result.
- Each argument is given as two `HOST_WIDE_INT' pieces.
- One argument is L1 and H1; the other, L2 and H2.
- The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV. */
-
-int
-add_double (l1, h1, l2, h2, lv, hv)
- HOST_WIDE_INT l1, h1, l2, h2;
- HOST_WIDE_INT *lv, *hv;
-{
- HOST_WIDE_INT l, h;
-
- l = l1 + l2;
- h = h1 + h2 + ((unsigned HOST_WIDE_INT) l < l1);
-
- *lv = l;
- *hv = h;
- return overflow_sum_sign (h1, h2, h);
-}
-
-/* Negate a doubleword integer with doubleword result.
- Return nonzero if the operation overflows, assuming it's signed.
- The argument is given as two `HOST_WIDE_INT' pieces in L1 and H1.
- The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV. */
-
-int
-neg_double (l1, h1, lv, hv)
- HOST_WIDE_INT l1, h1;
- HOST_WIDE_INT *lv, *hv;
-{
- if (l1 == 0)
- {
- *lv = 0;
- *hv = - h1;
- return (*hv & h1) < 0;
- }
- else
- {
- *lv = - l1;
- *hv = ~ h1;
- return 0;
- }
-}
-
-/* Multiply two doubleword integers with doubleword result.
- Return nonzero if the operation overflows, assuming it's signed.
- Each argument is given as two `HOST_WIDE_INT' pieces.
- One argument is L1 and H1; the other, L2 and H2.
- The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV. */
-
-int
-mul_double (l1, h1, l2, h2, lv, hv)
- HOST_WIDE_INT l1, h1, l2, h2;
- HOST_WIDE_INT *lv, *hv;
-{
- HOST_WIDE_INT arg1[4];
- HOST_WIDE_INT arg2[4];
- HOST_WIDE_INT prod[4 * 2];
- register unsigned HOST_WIDE_INT carry;
- register int i, j, k;
- HOST_WIDE_INT toplow, tophigh, neglow, neghigh;
-
- encode (arg1, l1, h1);
- encode (arg2, l2, h2);
-
- bzero ((char *) prod, sizeof prod);
-
- for (i = 0; i < 4; i++)
- {
- carry = 0;
- for (j = 0; j < 4; j++)
- {
- k = i + j;
- /* This product is <= 0xFFFE0001, the sum <= 0xFFFF0000. */
- carry += arg1[i] * arg2[j];
- /* Since prod[p] < 0xFFFF, this sum <= 0xFFFFFFFF. */
- carry += prod[k];
- prod[k] = LOWPART (carry);
- carry = HIGHPART (carry);
- }
- prod[i + 4] = carry;
- }
-
- decode (prod, lv, hv); /* This ignores prod[4] through prod[4*2-1] */
-
- /* Check for overflow by calculating the top half of the answer in full;
- it should agree with the low half's sign bit. */
- decode (prod+4, &toplow, &tophigh);
- if (h1 < 0)
- {
- neg_double (l2, h2, &neglow, &neghigh);
- add_double (neglow, neghigh, toplow, tophigh, &toplow, &tophigh);
- }
- if (h2 < 0)
- {
- neg_double (l1, h1, &neglow, &neghigh);
- add_double (neglow, neghigh, toplow, tophigh, &toplow, &tophigh);
- }
- return (*hv < 0 ? ~(toplow & tophigh) : toplow | tophigh) != 0;
-}
-
-/* Shift the doubleword integer in L1, H1 left by COUNT places
- keeping only PREC bits of result.
- Shift right if COUNT is negative.
- ARITH nonzero specifies arithmetic shifting; otherwise use logical shift.
- Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
-
-void
-lshift_double (l1, h1, count, prec, lv, hv, arith)
- HOST_WIDE_INT l1, h1, count;
- int prec;
- HOST_WIDE_INT *lv, *hv;
- int arith;
-{
- if (count < 0)
- {
- rshift_double (l1, h1, - count, prec, lv, hv, arith);
- return;
- }
-
-#ifdef SHIFT_COUNT_TRUNCATED
- if (SHIFT_COUNT_TRUNCATED)
- count %= prec;
-#endif
-
- if (count >= HOST_BITS_PER_WIDE_INT)
- {
- *hv = (unsigned HOST_WIDE_INT) l1 << count - HOST_BITS_PER_WIDE_INT;
- *lv = 0;
- }
- else
- {
- *hv = (((unsigned HOST_WIDE_INT) h1 << count)
- | ((unsigned HOST_WIDE_INT) l1 >> HOST_BITS_PER_WIDE_INT - count - 1 >> 1));
- *lv = (unsigned HOST_WIDE_INT) l1 << count;
- }
-}
-
-/* Shift the doubleword integer in L1, H1 right by COUNT places
- keeping only PREC bits of result. COUNT must be positive.
- ARITH nonzero specifies arithmetic shifting; otherwise use logical shift.
- Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
-
-void
-rshift_double (l1, h1, count, prec, lv, hv, arith)
- HOST_WIDE_INT l1, h1, count;
- int prec;
- HOST_WIDE_INT *lv, *hv;
- int arith;
-{
- unsigned HOST_WIDE_INT signmask;
- signmask = (arith
- ? -((unsigned HOST_WIDE_INT) h1 >> (HOST_BITS_PER_WIDE_INT - 1))
- : 0);
-
-#ifdef SHIFT_COUNT_TRUNCATED
- if (SHIFT_COUNT_TRUNCATED)
- count %= prec;
-#endif
-
- if (count >= HOST_BITS_PER_WIDE_INT)
- {
- *hv = signmask;
- *lv = ((signmask << 2 * HOST_BITS_PER_WIDE_INT - count - 1 << 1)
- | ((unsigned HOST_WIDE_INT) h1 >> count - HOST_BITS_PER_WIDE_INT));
- }
- else
- {
- *lv = (((unsigned HOST_WIDE_INT) l1 >> count)
- | ((unsigned HOST_WIDE_INT) h1 << HOST_BITS_PER_WIDE_INT - count - 1 << 1));
- *hv = ((signmask << HOST_BITS_PER_WIDE_INT - count)
- | ((unsigned HOST_WIDE_INT) h1 >> count));
- }
-}
-
-/* Rotate the doubleword integer in L1, H1 left by COUNT places
- keeping only PREC bits of result.
- Rotate right if COUNT is negative.
- Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
-
-void
-lrotate_double (l1, h1, count, prec, lv, hv)
- HOST_WIDE_INT l1, h1, count;
- int prec;
- HOST_WIDE_INT *lv, *hv;
-{
- HOST_WIDE_INT s1l, s1h, s2l, s2h;
-
- count %= prec;
- if (count < 0)
- count += prec;
-
- lshift_double (l1, h1, count, prec, &s1l, &s1h, 0);
- rshift_double (l1, h1, prec - count, prec, &s2l, &s2h, 0);
- *lv = s1l | s2l;
- *hv = s1h | s2h;
-}
-
-/* Rotate the doubleword integer in L1, H1 left by COUNT places
- keeping only PREC bits of result. COUNT must be positive.
- Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
-
-void
-rrotate_double (l1, h1, count, prec, lv, hv)
- HOST_WIDE_INT l1, h1, count;
- int prec;
- HOST_WIDE_INT *lv, *hv;
-{
- HOST_WIDE_INT s1l, s1h, s2l, s2h;
-
- count %= prec;
- if (count < 0)
- count += prec;
-
- rshift_double (l1, h1, count, prec, &s1l, &s1h, 0);
- lshift_double (l1, h1, prec - count, prec, &s2l, &s2h, 0);
- *lv = s1l | s2l;
- *hv = s1h | s2h;
-}
-
-/* Divide doubleword integer LNUM, HNUM by doubleword integer LDEN, HDEN
- for a quotient (stored in *LQUO, *HQUO) and remainder (in *LREM, *HREM).
- CODE is a tree code for a kind of division, one of
- TRUNC_DIV_EXPR, FLOOR_DIV_EXPR, CEIL_DIV_EXPR, ROUND_DIV_EXPR
- or EXACT_DIV_EXPR
- It controls how the quotient is rounded to a integer.
- Return nonzero if the operation overflows.
- UNS nonzero says do unsigned division. */
-
-int
-div_and_round_double (code, uns,
- lnum_orig, hnum_orig, lden_orig, hden_orig,
- lquo, hquo, lrem, hrem)
- enum tree_code code;
- int uns;
- HOST_WIDE_INT lnum_orig, hnum_orig; /* num == numerator == dividend */
- HOST_WIDE_INT lden_orig, hden_orig; /* den == denominator == divisor */
- HOST_WIDE_INT *lquo, *hquo, *lrem, *hrem;
-{
- int quo_neg = 0;
- HOST_WIDE_INT num[4 + 1]; /* extra element for scaling. */
- HOST_WIDE_INT den[4], quo[4];
- register int i, j;
- unsigned HOST_WIDE_INT work;
- register unsigned HOST_WIDE_INT carry = 0;
- HOST_WIDE_INT lnum = lnum_orig;
- HOST_WIDE_INT hnum = hnum_orig;
- HOST_WIDE_INT lden = lden_orig;
- HOST_WIDE_INT hden = hden_orig;
- int overflow = 0;
-
- if ((hden == 0) && (lden == 0))
- abort ();
-
- /* calculate quotient sign and convert operands to unsigned. */
- if (!uns)
- {
- if (hnum < 0)
- {
- quo_neg = ~ quo_neg;
- /* (minimum integer) / (-1) is the only overflow case. */
- if (neg_double (lnum, hnum, &lnum, &hnum) && (lden & hden) == -1)
- overflow = 1;
- }
- if (hden < 0)
- {
- quo_neg = ~ quo_neg;
- neg_double (lden, hden, &lden, &hden);
- }
- }
-
- if (hnum == 0 && hden == 0)
- { /* single precision */
- *hquo = *hrem = 0;
- /* This unsigned division rounds toward zero. */
- *lquo = lnum / (unsigned HOST_WIDE_INT) lden;
- goto finish_up;
- }
-
- if (hnum == 0)
- { /* trivial case: dividend < divisor */
- /* hden != 0 already checked. */
- *hquo = *lquo = 0;
- *hrem = hnum;
- *lrem = lnum;
- goto finish_up;
- }
-
- bzero ((char *) quo, sizeof quo);
-
- bzero ((char *) num, sizeof num); /* to zero 9th element */
- bzero ((char *) den, sizeof den);
-
- encode (num, lnum, hnum);
- encode (den, lden, hden);
-
- /* Special code for when the divisor < BASE. */
- if (hden == 0 && lden < BASE)
- {
- /* hnum != 0 already checked. */
- for (i = 4 - 1; i >= 0; i--)
- {
- work = num[i] + carry * BASE;
- quo[i] = work / (unsigned HOST_WIDE_INT) lden;
- carry = work % (unsigned HOST_WIDE_INT) lden;
- }
- }
- else
- {
- /* Full double precision division,
- with thanks to Don Knuth's "Seminumerical Algorithms". */
- int num_hi_sig, den_hi_sig;
- unsigned HOST_WIDE_INT quo_est, scale;
-
- /* Find the highest non-zero divisor digit. */
- for (i = 4 - 1; ; i--)
- if (den[i] != 0) {
- den_hi_sig = i;
- break;
- }
-
- /* Insure that the first digit of the divisor is at least BASE/2.
- This is required by the quotient digit estimation algorithm. */
-
- scale = BASE / (den[den_hi_sig] + 1);
- if (scale > 1) { /* scale divisor and dividend */
- carry = 0;
- for (i = 0; i <= 4 - 1; i++) {
- work = (num[i] * scale) + carry;
- num[i] = LOWPART (work);
- carry = HIGHPART (work);
- } num[4] = carry;
- carry = 0;
- for (i = 0; i <= 4 - 1; i++) {
- work = (den[i] * scale) + carry;
- den[i] = LOWPART (work);
- carry = HIGHPART (work);
- if (den[i] != 0) den_hi_sig = i;
- }
- }
-
- num_hi_sig = 4;
-
- /* Main loop */
- for (i = num_hi_sig - den_hi_sig - 1; i >= 0; i--) {
- /* guess the next quotient digit, quo_est, by dividing the first
- two remaining dividend digits by the high order quotient digit.
- quo_est is never low and is at most 2 high. */
- unsigned HOST_WIDE_INT tmp;
-
- num_hi_sig = i + den_hi_sig + 1;
- work = num[num_hi_sig] * BASE + num[num_hi_sig - 1];
- if (num[num_hi_sig] != den[den_hi_sig])
- quo_est = work / den[den_hi_sig];
- else
- quo_est = BASE - 1;
-
- /* refine quo_est so it's usually correct, and at most one high. */
- tmp = work - quo_est * den[den_hi_sig];
- if (tmp < BASE
- && den[den_hi_sig - 1] * quo_est > (tmp * BASE + num[num_hi_sig - 2]))
- quo_est--;
-
- /* Try QUO_EST as the quotient digit, by multiplying the
- divisor by QUO_EST and subtracting from the remaining dividend.
- Keep in mind that QUO_EST is the I - 1st digit. */
-
- carry = 0;
- for (j = 0; j <= den_hi_sig; j++)
- {
- work = quo_est * den[j] + carry;
- carry = HIGHPART (work);
- work = num[i + j] - LOWPART (work);
- num[i + j] = LOWPART (work);
- carry += HIGHPART (work) != 0;
- }
-
- /* if quo_est was high by one, then num[i] went negative and
- we need to correct things. */
-
- if (num[num_hi_sig] < carry)
- {
- quo_est--;
- carry = 0; /* add divisor back in */
- for (j = 0; j <= den_hi_sig; j++)
- {
- work = num[i + j] + den[j] + carry;
- carry = HIGHPART (work);
- num[i + j] = LOWPART (work);
- }
- num [num_hi_sig] += carry;
- }
-
- /* store the quotient digit. */
- quo[i] = quo_est;
- }
- }
-
- decode (quo, lquo, hquo);
-
- finish_up:
- /* if result is negative, make it so. */
- if (quo_neg)
- neg_double (*lquo, *hquo, lquo, hquo);
-
- /* compute trial remainder: rem = num - (quo * den) */
- mul_double (*lquo, *hquo, lden_orig, hden_orig, lrem, hrem);
- neg_double (*lrem, *hrem, lrem, hrem);
- add_double (lnum_orig, hnum_orig, *lrem, *hrem, lrem, hrem);
-
- switch (code)
- {
- case TRUNC_DIV_EXPR:
- case TRUNC_MOD_EXPR: /* round toward zero */
- case EXACT_DIV_EXPR: /* for this one, it shouldn't matter */
- return overflow;
-
- case FLOOR_DIV_EXPR:
- case FLOOR_MOD_EXPR: /* round toward negative infinity */
- if (quo_neg && (*lrem != 0 || *hrem != 0)) /* ratio < 0 && rem != 0 */
- {
- /* quo = quo - 1; */
- add_double (*lquo, *hquo, (HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1,
- lquo, hquo);
- }
- else return overflow;
- break;
-
- case CEIL_DIV_EXPR:
- case CEIL_MOD_EXPR: /* round toward positive infinity */
- if (!quo_neg && (*lrem != 0 || *hrem != 0)) /* ratio > 0 && rem != 0 */
- {
- add_double (*lquo, *hquo, (HOST_WIDE_INT) 1, (HOST_WIDE_INT) 0,
- lquo, hquo);
- }
- else return overflow;
- break;
-
- case ROUND_DIV_EXPR:
- case ROUND_MOD_EXPR: /* round to closest integer */
- {
- HOST_WIDE_INT labs_rem = *lrem, habs_rem = *hrem;
- HOST_WIDE_INT labs_den = lden, habs_den = hden, ltwice, htwice;
-
- /* get absolute values */
- if (*hrem < 0) neg_double (*lrem, *hrem, &labs_rem, &habs_rem);
- if (hden < 0) neg_double (lden, hden, &labs_den, &habs_den);
-
- /* if (2 * abs (lrem) >= abs (lden)) */
- mul_double ((HOST_WIDE_INT) 2, (HOST_WIDE_INT) 0,
- labs_rem, habs_rem, &ltwice, &htwice);
- if (((unsigned HOST_WIDE_INT) habs_den
- < (unsigned HOST_WIDE_INT) htwice)
- || (((unsigned HOST_WIDE_INT) habs_den
- == (unsigned HOST_WIDE_INT) htwice)
- && ((HOST_WIDE_INT unsigned) labs_den
- < (unsigned HOST_WIDE_INT) ltwice)))
- {
- if (*hquo < 0)
- /* quo = quo - 1; */
- add_double (*lquo, *hquo,
- (HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1, lquo, hquo);
- else
- /* quo = quo + 1; */
- add_double (*lquo, *hquo, (HOST_WIDE_INT) 1, (HOST_WIDE_INT) 0,
- lquo, hquo);
- }
- else return overflow;
- }
- break;
-
- default:
- abort ();
- }
-
- /* compute true remainder: rem = num - (quo * den) */
- mul_double (*lquo, *hquo, lden_orig, hden_orig, lrem, hrem);
- neg_double (*lrem, *hrem, lrem, hrem);
- add_double (lnum_orig, hnum_orig, *lrem, *hrem, lrem, hrem);
- return overflow;
-}
-
-#ifndef REAL_ARITHMETIC
-/* Effectively truncate a real value to represent the nearest possible value
- in a narrower mode. The result is actually represented in the same data
- type as the argument, but its value is usually different.
-
- A trap may occur during the FP operations and it is the responsibility
- of the calling function to have a handler established. */
-
-REAL_VALUE_TYPE
-real_value_truncate (mode, arg)
- enum machine_mode mode;
- REAL_VALUE_TYPE arg;
-{
- return REAL_VALUE_TRUNCATE (mode, arg);
-}
-
-#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
-
-/* Check for infinity in an IEEE double precision number. */
-
-int
-target_isinf (x)
- REAL_VALUE_TYPE x;
-{
- /* The IEEE 64-bit double format. */
- union {
- REAL_VALUE_TYPE d;
- struct {
- unsigned sign : 1;
- unsigned exponent : 11;
- unsigned mantissa1 : 20;
- unsigned mantissa2;
- } little_endian;
- struct {
- unsigned mantissa2;
- unsigned mantissa1 : 20;
- unsigned exponent : 11;
- unsigned sign : 1;
- } big_endian;
- } u;
-
- u.d = dconstm1;
- if (u.big_endian.sign == 1)
- {
- u.d = x;
- return (u.big_endian.exponent == 2047
- && u.big_endian.mantissa1 == 0
- && u.big_endian.mantissa2 == 0);
- }
- else
- {
- u.d = x;
- return (u.little_endian.exponent == 2047
- && u.little_endian.mantissa1 == 0
- && u.little_endian.mantissa2 == 0);
- }
-}
-
-/* Check whether an IEEE double precision number is a NaN. */
-
-int
-target_isnan (x)
- REAL_VALUE_TYPE x;
-{
- /* The IEEE 64-bit double format. */
- union {
- REAL_VALUE_TYPE d;
- struct {
- unsigned sign : 1;
- unsigned exponent : 11;
- unsigned mantissa1 : 20;
- unsigned mantissa2;
- } little_endian;
- struct {
- unsigned mantissa2;
- unsigned mantissa1 : 20;
- unsigned exponent : 11;
- unsigned sign : 1;
- } big_endian;
- } u;
-
- u.d = dconstm1;
- if (u.big_endian.sign == 1)
- {
- u.d = x;
- return (u.big_endian.exponent == 2047
- && (u.big_endian.mantissa1 != 0
- || u.big_endian.mantissa2 != 0));
- }
- else
- {
- u.d = x;
- return (u.little_endian.exponent == 2047
- && (u.little_endian.mantissa1 != 0
- || u.little_endian.mantissa2 != 0));
- }
-}
-
-/* Check for a negative IEEE double precision number. */
-
-int
-target_negative (x)
- REAL_VALUE_TYPE x;
-{
- /* The IEEE 64-bit double format. */
- union {
- REAL_VALUE_TYPE d;
- struct {
- unsigned sign : 1;
- unsigned exponent : 11;
- unsigned mantissa1 : 20;
- unsigned mantissa2;
- } little_endian;
- struct {
- unsigned mantissa2;
- unsigned mantissa1 : 20;
- unsigned exponent : 11;
- unsigned sign : 1;
- } big_endian;
- } u;
-
- u.d = dconstm1;
- if (u.big_endian.sign == 1)
- {
- u.d = x;
- return u.big_endian.sign;
- }
- else
- {
- u.d = x;
- return u.little_endian.sign;
- }
-}
-#else /* Target not IEEE */
-
-/* Let's assume other float formats don't have infinity.
- (This can be overridden by redefining REAL_VALUE_ISINF.) */
-
-target_isinf (x)
- REAL_VALUE_TYPE x;
-{
- return 0;
-}
-
-/* Let's assume other float formats don't have NaNs.
- (This can be overridden by redefining REAL_VALUE_ISNAN.) */
-
-target_isnan (x)
- REAL_VALUE_TYPE x;
-{
- return 0;
-}
-
-/* Let's assume other float formats don't have minus zero.
- (This can be overridden by redefining REAL_VALUE_NEGATIVE.) */
-
-target_negative (x)
- REAL_VALUE_TYPE x;
-{
- return x < 0;
-}
-#endif /* Target not IEEE */
-
-/* Try to change R into its exact multiplicative inverse in machine mode
- MODE. Return nonzero function value if successful. */
-
-int
-exact_real_inverse (mode, r)
- enum machine_mode mode;
- REAL_VALUE_TYPE *r;
-{
- union
- {
- double d;
- unsigned short i[4];
- }x, t, y;
- int i;
-
- /* Usually disable if bounds checks are not reliable. */
- if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT) && !flag_pretend_float)
- return 0;
-
- /* Set array index to the less significant bits in the unions, depending
- on the endian-ness of the host doubles.
- Disable if insufficient information on the data structure. */
-#if HOST_FLOAT_FORMAT == UNKNOWN_FLOAT_FORMAT
- return 0;
-#else
-#if HOST_FLOAT_FORMAT == VAX_FLOAT_FORMAT
-#define K 2
-#else
-#if HOST_FLOAT_FORMAT == IBM_FLOAT_FORMAT
-#define K 2
-#else
-#define K (2 * HOST_FLOAT_WORDS_BIG_ENDIAN)
-#endif
-#endif
-#endif
-
- if (setjmp (float_error))
- {
- /* Don't do the optimization if there was an arithmetic error. */
-fail:
- set_float_handler (NULL_PTR);
- return 0;
- }
- set_float_handler (float_error);
-
- /* Domain check the argument. */
- x.d = *r;
- if (x.d == 0.0)
- goto fail;
-
-#ifdef REAL_INFINITY
- if (REAL_VALUE_ISINF (x.d) || REAL_VALUE_ISNAN (x.d))
- goto fail;
-#endif
-
- /* Compute the reciprocal and check for numerical exactness.
- It is unnecessary to check all the significand bits to determine
- whether X is a power of 2. If X is not, then it is impossible for
- the bottom half significand of both X and 1/X to be all zero bits.
- Hence we ignore the data structure of the top half and examine only
- the low order bits of the two significands. */
- t.d = 1.0 / x.d;
- if (x.i[K] != 0 || x.i[K + 1] != 0 || t.i[K] != 0 || t.i[K + 1] != 0)
- goto fail;
-
- /* Truncate to the required mode and range-check the result. */
- y.d = REAL_VALUE_TRUNCATE (mode, t.d);
-#ifdef CHECK_FLOAT_VALUE
- i = 0;
- if (CHECK_FLOAT_VALUE (mode, y.d, i))
- goto fail;
-#endif
-
- /* Fail if truncation changed the value. */
- if (y.d != t.d || y.d == 0.0)
- goto fail;
-
-#ifdef REAL_INFINITY
- if (REAL_VALUE_ISINF (y.d) || REAL_VALUE_ISNAN (y.d))
- goto fail;
-#endif
-
- /* Output the reciprocal and return success flag. */
- set_float_handler (NULL_PTR);
- *r = y.d;
- return 1;
-}
-#endif /* no REAL_ARITHMETIC */
-
-/* Split a tree IN into a constant and a variable part
- that could be combined with CODE to make IN.
- CODE must be a commutative arithmetic operation.
- Store the constant part into *CONP and the variable in &VARP.
- Return 1 if this was done; zero means the tree IN did not decompose
- this way.
-
- If CODE is PLUS_EXPR we also split trees that use MINUS_EXPR.
- Therefore, we must tell the caller whether the variable part
- was subtracted. We do this by storing 1 or -1 into *VARSIGNP.
- The value stored is the coefficient for the variable term.
- The constant term we return should always be added;
- we negate it if necessary. */
-
-static int
-split_tree (in, code, varp, conp, varsignp)
- tree in;
- enum tree_code code;
- tree *varp, *conp;
- int *varsignp;
-{
- register tree outtype = TREE_TYPE (in);
- *varp = 0;
- *conp = 0;
-
- /* Strip any conversions that don't change the machine mode. */
- while ((TREE_CODE (in) == NOP_EXPR
- || TREE_CODE (in) == CONVERT_EXPR)
- && (TYPE_MODE (TREE_TYPE (in))
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (in, 0)))))
- in = TREE_OPERAND (in, 0);
-
- if (TREE_CODE (in) == code
- || (! FLOAT_TYPE_P (TREE_TYPE (in))
- /* We can associate addition and subtraction together
- (even though the C standard doesn't say so)
- for integers because the value is not affected.
- For reals, the value might be affected, so we can't. */
- && ((code == PLUS_EXPR && TREE_CODE (in) == MINUS_EXPR)
- || (code == MINUS_EXPR && TREE_CODE (in) == PLUS_EXPR))))
- {
- enum tree_code code = TREE_CODE (TREE_OPERAND (in, 0));
- if (code == INTEGER_CST)
- {
- *conp = TREE_OPERAND (in, 0);
- *varp = TREE_OPERAND (in, 1);
- if (TYPE_MODE (TREE_TYPE (*varp)) != TYPE_MODE (outtype)
- && TREE_TYPE (*varp) != outtype)
- *varp = convert (outtype, *varp);
- *varsignp = (TREE_CODE (in) == MINUS_EXPR) ? -1 : 1;
- return 1;
- }
- if (TREE_CONSTANT (TREE_OPERAND (in, 1)))
- {
- *conp = TREE_OPERAND (in, 1);
- *varp = TREE_OPERAND (in, 0);
- *varsignp = 1;
- if (TYPE_MODE (TREE_TYPE (*varp)) != TYPE_MODE (outtype)
- && TREE_TYPE (*varp) != outtype)
- *varp = convert (outtype, *varp);
- if (TREE_CODE (in) == MINUS_EXPR)
- {
- /* If operation is subtraction and constant is second,
- must negate it to get an additive constant.
- And this cannot be done unless it is a manifest constant.
- It could also be the address of a static variable.
- We cannot negate that, so give up. */
- if (TREE_CODE (*conp) == INTEGER_CST)
- /* Subtracting from integer_zero_node loses for long long. */
- *conp = fold (build1 (NEGATE_EXPR, TREE_TYPE (*conp), *conp));
- else
- return 0;
- }
- return 1;
- }
- if (TREE_CONSTANT (TREE_OPERAND (in, 0)))
- {
- *conp = TREE_OPERAND (in, 0);
- *varp = TREE_OPERAND (in, 1);
- if (TYPE_MODE (TREE_TYPE (*varp)) != TYPE_MODE (outtype)
- && TREE_TYPE (*varp) != outtype)
- *varp = convert (outtype, *varp);
- *varsignp = (TREE_CODE (in) == MINUS_EXPR) ? -1 : 1;
- return 1;
- }
- }
- return 0;
-}
-
-/* Combine two constants ARG1 and ARG2 under operation CODE
- to produce a new constant.
- We assume ARG1 and ARG2 have the same data type,
- or at least are the same kind of constant and the same machine mode.
-
- If NOTRUNC is nonzero, do not truncate the result to fit the data type. */
-
-static tree
-const_binop (code, arg1, arg2, notrunc)
- enum tree_code code;
- register tree arg1, arg2;
- int notrunc;
-{
- STRIP_NOPS (arg1); STRIP_NOPS (arg2);
-
- if (TREE_CODE (arg1) == INTEGER_CST)
- {
- register HOST_WIDE_INT int1l = TREE_INT_CST_LOW (arg1);
- register HOST_WIDE_INT int1h = TREE_INT_CST_HIGH (arg1);
- HOST_WIDE_INT int2l = TREE_INT_CST_LOW (arg2);
- HOST_WIDE_INT int2h = TREE_INT_CST_HIGH (arg2);
- HOST_WIDE_INT low, hi;
- HOST_WIDE_INT garbagel, garbageh;
- register tree t;
- int uns = TREE_UNSIGNED (TREE_TYPE (arg1));
- int overflow = 0;
- int no_overflow = 0;
-
- switch (code)
- {
- case BIT_IOR_EXPR:
- low = int1l | int2l, hi = int1h | int2h;
- break;
-
- case BIT_XOR_EXPR:
- low = int1l ^ int2l, hi = int1h ^ int2h;
- break;
-
- case BIT_AND_EXPR:
- low = int1l & int2l, hi = int1h & int2h;
- break;
-
- case BIT_ANDTC_EXPR:
- low = int1l & ~int2l, hi = int1h & ~int2h;
- break;
-
- case RSHIFT_EXPR:
- int2l = - int2l;
- case LSHIFT_EXPR:
- /* It's unclear from the C standard whether shifts can overflow.
- The following code ignores overflow; perhaps a C standard
- interpretation ruling is needed. */
- lshift_double (int1l, int1h, int2l,
- TYPE_PRECISION (TREE_TYPE (arg1)),
- &low, &hi,
- !uns);
- no_overflow = 1;
- break;
-
- case RROTATE_EXPR:
- int2l = - int2l;
- case LROTATE_EXPR:
- lrotate_double (int1l, int1h, int2l,
- TYPE_PRECISION (TREE_TYPE (arg1)),
- &low, &hi);
- break;
-
- case PLUS_EXPR:
- overflow = add_double (int1l, int1h, int2l, int2h, &low, &hi);
- break;
-
- case MINUS_EXPR:
- neg_double (int2l, int2h, &low, &hi);
- add_double (int1l, int1h, low, hi, &low, &hi);
- overflow = overflow_sum_sign (hi, int2h, int1h);
- break;
-
- case MULT_EXPR:
- overflow = mul_double (int1l, int1h, int2l, int2h, &low, &hi);
- break;
-
- case TRUNC_DIV_EXPR:
- case FLOOR_DIV_EXPR: case CEIL_DIV_EXPR:
- case EXACT_DIV_EXPR:
- /* This is a shortcut for a common special case. */
- if (int2h == 0 && int2l > 0
- && ! TREE_CONSTANT_OVERFLOW (arg1)
- && ! TREE_CONSTANT_OVERFLOW (arg2)
- && int1h == 0 && int1l >= 0)
- {
- if (code == CEIL_DIV_EXPR)
- int1l += int2l - 1;
- low = int1l / int2l, hi = 0;
- break;
- }
-
- /* ... fall through ... */
-
- case ROUND_DIV_EXPR:
- if (int2h == 0 && int2l == 1)
- {
- low = int1l, hi = int1h;
- break;
- }
- if (int1l == int2l && int1h == int2h
- && ! (int1l == 0 && int1h == 0))
- {
- low = 1, hi = 0;
- break;
- }
- overflow = div_and_round_double (code, uns,
- int1l, int1h, int2l, int2h,
- &low, &hi, &garbagel, &garbageh);
- break;
-
- case TRUNC_MOD_EXPR:
- case FLOOR_MOD_EXPR: case CEIL_MOD_EXPR:
- /* This is a shortcut for a common special case. */
- if (int2h == 0 && int2l > 0
- && ! TREE_CONSTANT_OVERFLOW (arg1)
- && ! TREE_CONSTANT_OVERFLOW (arg2)
- && int1h == 0 && int1l >= 0)
- {
- if (code == CEIL_MOD_EXPR)
- int1l += int2l - 1;
- low = int1l % int2l, hi = 0;
- break;
- }
-
- /* ... fall through ... */
-
- case ROUND_MOD_EXPR:
- overflow = div_and_round_double (code, uns,
- int1l, int1h, int2l, int2h,
- &garbagel, &garbageh, &low, &hi);
- break;
-
- case MIN_EXPR:
- case MAX_EXPR:
- if (uns)
- {
- low = (((unsigned HOST_WIDE_INT) int1h
- < (unsigned HOST_WIDE_INT) int2h)
- || (((unsigned HOST_WIDE_INT) int1h
- == (unsigned HOST_WIDE_INT) int2h)
- && ((unsigned HOST_WIDE_INT) int1l
- < (unsigned HOST_WIDE_INT) int2l)));
- }
- else
- {
- low = ((int1h < int2h)
- || ((int1h == int2h)
- && ((unsigned HOST_WIDE_INT) int1l
- < (unsigned HOST_WIDE_INT) int2l)));
- }
- if (low == (code == MIN_EXPR))
- low = int1l, hi = int1h;
- else
- low = int2l, hi = int2h;
- break;
-
- default:
- abort ();
- }
- got_it:
- if (TREE_TYPE (arg1) == sizetype && hi == 0
- && low >= 0 && low <= TREE_INT_CST_LOW (TYPE_MAX_VALUE (sizetype))
- && ! overflow
- && ! TREE_OVERFLOW (arg1) && ! TREE_OVERFLOW (arg2))
- t = size_int (low);
- else
- {
- t = build_int_2 (low, hi);
- TREE_TYPE (t) = TREE_TYPE (arg1);
- }
-
- TREE_OVERFLOW (t)
- = ((notrunc ? !uns && overflow
- : force_fit_type (t, overflow && !uns) && ! no_overflow)
- | TREE_OVERFLOW (arg1)
- | TREE_OVERFLOW (arg2));
- TREE_CONSTANT_OVERFLOW (t) = (TREE_OVERFLOW (t)
- | TREE_CONSTANT_OVERFLOW (arg1)
- | TREE_CONSTANT_OVERFLOW (arg2));
- return t;
- }
-#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- if (TREE_CODE (arg1) == REAL_CST)
- {
- REAL_VALUE_TYPE d1;
- REAL_VALUE_TYPE d2;
- int overflow = 0;
- REAL_VALUE_TYPE value;
- tree t;
-
- d1 = TREE_REAL_CST (arg1);
- d2 = TREE_REAL_CST (arg2);
-
- /* If either operand is a NaN, just return it. Otherwise, set up
- for floating-point trap; we return an overflow. */
- if (REAL_VALUE_ISNAN (d1))
- return arg1;
- else if (REAL_VALUE_ISNAN (d2))
- return arg2;
- else if (setjmp (float_error))
- {
- t = copy_node (arg1);
- overflow = 1;
- goto got_float;
- }
-
- set_float_handler (float_error);
-
-#ifdef REAL_ARITHMETIC
- REAL_ARITHMETIC (value, code, d1, d2);
-#else
- switch (code)
- {
- case PLUS_EXPR:
- value = d1 + d2;
- break;
-
- case MINUS_EXPR:
- value = d1 - d2;
- break;
-
- case MULT_EXPR:
- value = d1 * d2;
- break;
-
- case RDIV_EXPR:
-#ifndef REAL_INFINITY
- if (d2 == 0)
- abort ();
-#endif
-
- value = d1 / d2;
- break;
-
- case MIN_EXPR:
- value = MIN (d1, d2);
- break;
-
- case MAX_EXPR:
- value = MAX (d1, d2);
- break;
-
- default:
- abort ();
- }
-#endif /* no REAL_ARITHMETIC */
- t = build_real (TREE_TYPE (arg1),
- real_value_truncate (TYPE_MODE (TREE_TYPE (arg1)), value));
- got_float:
- set_float_handler (NULL_PTR);
-
- TREE_OVERFLOW (t)
- = (force_fit_type (t, overflow)
- | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2));
- TREE_CONSTANT_OVERFLOW (t)
- = TREE_OVERFLOW (t)
- | TREE_CONSTANT_OVERFLOW (arg1)
- | TREE_CONSTANT_OVERFLOW (arg2);
- return t;
- }
-#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
- if (TREE_CODE (arg1) == COMPLEX_CST)
- {
- register tree type = TREE_TYPE (arg1);
- register tree r1 = TREE_REALPART (arg1);
- register tree i1 = TREE_IMAGPART (arg1);
- register tree r2 = TREE_REALPART (arg2);
- register tree i2 = TREE_IMAGPART (arg2);
- register tree t;
-
- switch (code)
- {
- case PLUS_EXPR:
- t = build_complex (type,
- const_binop (PLUS_EXPR, r1, r2, notrunc),
- const_binop (PLUS_EXPR, i1, i2, notrunc));
- break;
-
- case MINUS_EXPR:
- t = build_complex (type,
- const_binop (MINUS_EXPR, r1, r2, notrunc),
- const_binop (MINUS_EXPR, i1, i2, notrunc));
- break;
-
- case MULT_EXPR:
- t = build_complex (type,
- const_binop (MINUS_EXPR,
- const_binop (MULT_EXPR,
- r1, r2, notrunc),
- const_binop (MULT_EXPR,
- i1, i2, notrunc),
- notrunc),
- const_binop (PLUS_EXPR,
- const_binop (MULT_EXPR,
- r1, i2, notrunc),
- const_binop (MULT_EXPR,
- i1, r2, notrunc),
- notrunc));
- break;
-
- case RDIV_EXPR:
- {
- register tree magsquared
- = const_binop (PLUS_EXPR,
- const_binop (MULT_EXPR, r2, r2, notrunc),
- const_binop (MULT_EXPR, i2, i2, notrunc),
- notrunc);
-
- t = build_complex (type,
- const_binop
- (INTEGRAL_TYPE_P (TREE_TYPE (r1))
- ? TRUNC_DIV_EXPR : RDIV_EXPR,
- const_binop (PLUS_EXPR,
- const_binop (MULT_EXPR, r1, r2,
- notrunc),
- const_binop (MULT_EXPR, i1, i2,
- notrunc),
- notrunc),
- magsquared, notrunc),
- const_binop
- (INTEGRAL_TYPE_P (TREE_TYPE (r1))
- ? TRUNC_DIV_EXPR : RDIV_EXPR,
- const_binop (MINUS_EXPR,
- const_binop (MULT_EXPR, i1, r2,
- notrunc),
- const_binop (MULT_EXPR, r1, i2,
- notrunc),
- notrunc),
- magsquared, notrunc));
- }
- break;
-
- default:
- abort ();
- }
- return t;
- }
- return 0;
-}
-
-/* Return an INTEGER_CST with value V and type from `sizetype'. */
-
-tree
-size_int (number)
- unsigned HOST_WIDE_INT number;
-{
- register tree t;
- /* Type-size nodes already made for small sizes. */
- static tree size_table[2*HOST_BITS_PER_WIDE_INT + 1];
-
- if (number < 2*HOST_BITS_PER_WIDE_INT + 1
- && size_table[number] != 0)
- return size_table[number];
- if (number < 2*HOST_BITS_PER_WIDE_INT + 1)
- {
- push_obstacks_nochange ();
- /* Make this a permanent node. */
- end_temporary_allocation ();
- t = build_int_2 (number, 0);
- TREE_TYPE (t) = sizetype;
- size_table[number] = t;
- pop_obstacks ();
- }
- else
- {
- t = build_int_2 (number, 0);
- TREE_TYPE (t) = sizetype;
- TREE_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (t) = force_fit_type (t, 0);
- }
- return t;
-}
-
-/* Combine operands OP1 and OP2 with arithmetic operation CODE.
- CODE is a tree code. Data type is taken from `sizetype',
- If the operands are constant, so is the result. */
-
-tree
-size_binop (code, arg0, arg1)
- enum tree_code code;
- tree arg0, arg1;
-{
- /* Handle the special case of two integer constants faster. */
- if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
- {
- /* And some specific cases even faster than that. */
- if (code == PLUS_EXPR && integer_zerop (arg0))
- return arg1;
- else if ((code == MINUS_EXPR || code == PLUS_EXPR)
- && integer_zerop (arg1))
- return arg0;
- else if (code == MULT_EXPR && integer_onep (arg0))
- return arg1;
-
- /* Handle general case of two integer constants. */
- return const_binop (code, arg0, arg1, 0);
- }
-
- if (arg0 == error_mark_node || arg1 == error_mark_node)
- return error_mark_node;
-
- return fold (build (code, sizetype, arg0, arg1));
-}
-
-/* Given T, a tree representing type conversion of ARG1, a constant,
- return a constant tree representing the result of conversion. */
-
-static tree
-fold_convert (t, arg1)
- register tree t;
- register tree arg1;
-{
- register tree type = TREE_TYPE (t);
- int overflow = 0;
-
- if (TREE_CODE (type) == POINTER_TYPE || INTEGRAL_TYPE_P (type))
- {
- if (TREE_CODE (arg1) == INTEGER_CST)
- {
- /* If we would build a constant wider than GCC supports,
- leave the conversion unfolded. */
- if (TYPE_PRECISION (type) > 2 * HOST_BITS_PER_WIDE_INT)
- return t;
-
- /* Given an integer constant, make new constant with new type,
- appropriately sign-extended or truncated. */
- t = build_int_2 (TREE_INT_CST_LOW (arg1),
- TREE_INT_CST_HIGH (arg1));
- TREE_TYPE (t) = type;
- /* Indicate an overflow if (1) ARG1 already overflowed,
- or (2) force_fit_type indicates an overflow.
- Tell force_fit_type that an overflow has already occurred
- if ARG1 is a too-large unsigned value and T is signed. */
- TREE_OVERFLOW (t)
- = (TREE_OVERFLOW (arg1)
- | force_fit_type (t,
- (TREE_INT_CST_HIGH (arg1) < 0
- & (TREE_UNSIGNED (type)
- < TREE_UNSIGNED (TREE_TYPE (arg1))))));
- TREE_CONSTANT_OVERFLOW (t)
- = TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1);
- }
-#if !defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- else if (TREE_CODE (arg1) == REAL_CST)
- {
- /* Don't initialize these, use assignments.
- Initialized local aggregates don't work on old compilers. */
- REAL_VALUE_TYPE x;
- REAL_VALUE_TYPE l;
- REAL_VALUE_TYPE u;
- tree type1 = TREE_TYPE (arg1);
-
- x = TREE_REAL_CST (arg1);
- l = real_value_from_int_cst (type1, TYPE_MIN_VALUE (type));
- u = real_value_from_int_cst (type1, TYPE_MAX_VALUE (type));
- /* See if X will be in range after truncation towards 0.
- To compensate for truncation, move the bounds away from 0,
- but reject if X exactly equals the adjusted bounds. */
-#ifdef REAL_ARITHMETIC
- REAL_ARITHMETIC (l, MINUS_EXPR, l, dconst1);
- REAL_ARITHMETIC (u, PLUS_EXPR, u, dconst1);
-#else
- l--;
- u++;
-#endif
- /* If X is a NaN, use zero instead and show we have an overflow.
- Otherwise, range check. */
- if (REAL_VALUE_ISNAN (x))
- overflow = 1, x = dconst0;
- else if (! (REAL_VALUES_LESS (l, x) && REAL_VALUES_LESS (x, u)))
- overflow = 1;
-
-#ifndef REAL_ARITHMETIC
- {
- HOST_WIDE_INT low, high;
- HOST_WIDE_INT half_word
- = (HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2);
-
- if (x < 0)
- x = -x;
-
- high = (HOST_WIDE_INT) (x / half_word / half_word);
- x -= (REAL_VALUE_TYPE) high * half_word * half_word;
- if (x >= (REAL_VALUE_TYPE) half_word * half_word / 2)
- {
- low = x - (REAL_VALUE_TYPE) half_word * half_word / 2;
- low |= (HOST_WIDE_INT) -1 << (HOST_BITS_PER_WIDE_INT - 1);
- }
- else
- low = (HOST_WIDE_INT) x;
- if (TREE_REAL_CST (arg1) < 0)
- neg_double (low, high, &low, &high);
- t = build_int_2 (low, high);
- }
-#else
- {
- HOST_WIDE_INT low, high;
- REAL_VALUE_TO_INT (&low, &high, x);
- t = build_int_2 (low, high);
- }
-#endif
- TREE_TYPE (t) = type;
- TREE_OVERFLOW (t)
- = TREE_OVERFLOW (arg1) | force_fit_type (t, overflow);
- TREE_CONSTANT_OVERFLOW (t)
- = TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1);
- }
-#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
- TREE_TYPE (t) = type;
- }
- else if (TREE_CODE (type) == REAL_TYPE)
- {
-#if !defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- if (TREE_CODE (arg1) == INTEGER_CST)
- return build_real_from_int_cst (type, arg1);
-#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
- if (TREE_CODE (arg1) == REAL_CST)
- {
- if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1)))
- {
- t = arg1;
- TREE_TYPE (arg1) = type;
- return t;
- }
- else if (setjmp (float_error))
- {
- overflow = 1;
- t = copy_node (arg1);
- goto got_it;
- }
- set_float_handler (float_error);
-
- t = build_real (type, real_value_truncate (TYPE_MODE (type),
- TREE_REAL_CST (arg1)));
- set_float_handler (NULL_PTR);
-
- got_it:
- TREE_OVERFLOW (t)
- = TREE_OVERFLOW (arg1) | force_fit_type (t, overflow);
- TREE_CONSTANT_OVERFLOW (t)
- = TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1);
- return t;
- }
- }
- TREE_CONSTANT (t) = 1;
- return t;
-}
-
-/* Return an expr equal to X but certainly not valid as an lvalue.
- Also make sure it is not valid as an null pointer constant. */
-
-tree
-non_lvalue (x)
- tree x;
-{
- tree result;
-
- /* These things are certainly not lvalues. */
- if (TREE_CODE (x) == NON_LVALUE_EXPR
- || TREE_CODE (x) == INTEGER_CST
- || TREE_CODE (x) == REAL_CST
- || TREE_CODE (x) == STRING_CST
- || TREE_CODE (x) == ADDR_EXPR)
- {
- if (TREE_CODE (x) == INTEGER_CST && integer_zerop (x))
- {
- /* Use NOP_EXPR instead of NON_LVALUE_EXPR
- so convert_for_assignment won't strip it.
- This is so this 0 won't be treated as a null pointer constant. */
- result = build1 (NOP_EXPR, TREE_TYPE (x), x);
- TREE_CONSTANT (result) = TREE_CONSTANT (x);
- return result;
- }
- return x;
- }
-
- result = build1 (NON_LVALUE_EXPR, TREE_TYPE (x), x);
- TREE_CONSTANT (result) = TREE_CONSTANT (x);
- return result;
-}
-
-/* Nonzero means lvalues are limited to those valid in pedantic ANSI C.
- Zero means allow extended lvalues. */
-
-int pedantic_lvalues;
-
-/* When pedantic, return an expr equal to X but certainly not valid as a
- pedantic lvalue. Otherwise, return X. */
-
-tree
-pedantic_non_lvalue (x)
- tree x;
-{
- if (pedantic_lvalues)
- return non_lvalue (x);
- else
- return x;
-}
-
-/* Given a tree comparison code, return the code that is the logical inverse
- 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
-invert_tree_comparison (code)
- enum tree_code code;
-{
- switch (code)
- {
- case EQ_EXPR:
- return NE_EXPR;
- case NE_EXPR:
- return EQ_EXPR;
- case GT_EXPR:
- return LE_EXPR;
- case GE_EXPR:
- return LT_EXPR;
- case LT_EXPR:
- return GE_EXPR;
- case LE_EXPR:
- return GT_EXPR;
- default:
- abort ();
- }
-}
-
-/* Similar, but return the comparison that results if the operands are
- swapped. This is safe for floating-point. */
-
-static enum tree_code
-swap_tree_comparison (code)
- enum tree_code code;
-{
- switch (code)
- {
- case EQ_EXPR:
- case NE_EXPR:
- return code;
- case GT_EXPR:
- return LT_EXPR;
- case GE_EXPR:
- return LE_EXPR;
- case LT_EXPR:
- return GT_EXPR;
- case LE_EXPR:
- return GE_EXPR;
- default:
- abort ();
- }
-}
-
-/* Return nonzero if CODE is a tree code that represents a truth value. */
-
-static int
-truth_value_p (code)
- enum tree_code code;
-{
- return (TREE_CODE_CLASS (code) == '<'
- || code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR
- || code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR
- || code == TRUTH_XOR_EXPR || code == TRUTH_NOT_EXPR);
-}
-
-/* Return nonzero if two operands are necessarily equal.
- If ONLY_CONST is non-zero, only return non-zero for constants.
- This function tests whether the operands are indistinguishable;
- it does not test whether they are equal using C's == operation.
- The distinction is important for IEEE floating point, because
- (1) -0.0 and 0.0 are distinguishable, but -0.0==0.0, and
- (2) two NaNs may be indistinguishable, but NaN!=NaN. */
-
-int
-operand_equal_p (arg0, arg1, only_const)
- tree arg0, arg1;
- int only_const;
-{
- /* If both types don't have the same signedness, then we can't consider
- them equal. We must check this before the STRIP_NOPS calls
- because they may change the signedness of the arguments. */
- if (TREE_UNSIGNED (TREE_TYPE (arg0)) != TREE_UNSIGNED (TREE_TYPE (arg1)))
- return 0;
-
- STRIP_NOPS (arg0);
- STRIP_NOPS (arg1);
-
- if (TREE_CODE (arg0) != TREE_CODE (arg1)
- /* This is needed for conversions and for COMPONENT_REF.
- Might as well play it safe and always test this. */
- || TYPE_MODE (TREE_TYPE (arg0)) != TYPE_MODE (TREE_TYPE (arg1)))
- return 0;
-
- /* If ARG0 and ARG1 are the same SAVE_EXPR, they are necessarily equal.
- We don't care about side effects in that case because the SAVE_EXPR
- takes care of that for us. In all other cases, two expressions are
- equal if they have no side effects. If we have two identical
- expressions with side effects that should be treated the same due
- to the only side effects being identical SAVE_EXPR's, that will
- be detected in the recursive calls below. */
- if (arg0 == arg1 && ! only_const
- && (TREE_CODE (arg0) == SAVE_EXPR
- || (! TREE_SIDE_EFFECTS (arg0) && ! TREE_SIDE_EFFECTS (arg1))))
- return 1;
-
- /* Next handle constant cases, those for which we can return 1 even
- if ONLY_CONST is set. */
- if (TREE_CONSTANT (arg0) && TREE_CONSTANT (arg1))
- switch (TREE_CODE (arg0))
- {
- case INTEGER_CST:
- return (TREE_INT_CST_LOW (arg0) == TREE_INT_CST_LOW (arg1)
- && TREE_INT_CST_HIGH (arg0) == TREE_INT_CST_HIGH (arg1));
-
- case REAL_CST:
- return REAL_VALUES_EQUAL (TREE_REAL_CST (arg0), TREE_REAL_CST (arg1));
-
- case COMPLEX_CST:
- return (operand_equal_p (TREE_REALPART (arg0), TREE_REALPART (arg1),
- only_const)
- && operand_equal_p (TREE_IMAGPART (arg0), TREE_IMAGPART (arg1),
- only_const));
-
- case STRING_CST:
- return (TREE_STRING_LENGTH (arg0) == TREE_STRING_LENGTH (arg1)
- && ! strncmp (TREE_STRING_POINTER (arg0),
- TREE_STRING_POINTER (arg1),
- TREE_STRING_LENGTH (arg0)));
-
- case ADDR_EXPR:
- return operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 0),
- 0);
- }
-
- if (only_const)
- return 0;
-
- switch (TREE_CODE_CLASS (TREE_CODE (arg0)))
- {
- case '1':
- /* Two conversions are equal only if signedness and modes match. */
- if ((TREE_CODE (arg0) == NOP_EXPR || TREE_CODE (arg0) == CONVERT_EXPR)
- && (TREE_UNSIGNED (TREE_TYPE (arg0))
- != TREE_UNSIGNED (TREE_TYPE (arg1))))
- return 0;
-
- return operand_equal_p (TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg1, 0), 0);
-
- case '<':
- case '2':
- if (operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 0), 0)
- && operand_equal_p (TREE_OPERAND (arg0, 1), TREE_OPERAND (arg1, 1),
- 0))
- return 1;
-
- /* For commutative ops, allow the other order. */
- return ((TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MULT_EXPR
- || TREE_CODE (arg0) == MIN_EXPR || TREE_CODE (arg0) == MAX_EXPR
- || TREE_CODE (arg0) == BIT_IOR_EXPR
- || TREE_CODE (arg0) == BIT_XOR_EXPR
- || TREE_CODE (arg0) == BIT_AND_EXPR
- || TREE_CODE (arg0) == NE_EXPR || TREE_CODE (arg0) == EQ_EXPR)
- && operand_equal_p (TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg1, 1), 0)
- && operand_equal_p (TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg1, 0), 0));
-
- case 'r':
- switch (TREE_CODE (arg0))
- {
- case INDIRECT_REF:
- return operand_equal_p (TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg1, 0), 0);
-
- case COMPONENT_REF:
- case ARRAY_REF:
- return (operand_equal_p (TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg1, 0), 0)
- && operand_equal_p (TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg1, 1), 0));
-
- case BIT_FIELD_REF:
- return (operand_equal_p (TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg1, 0), 0)
- && operand_equal_p (TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg1, 1), 0)
- && operand_equal_p (TREE_OPERAND (arg0, 2),
- TREE_OPERAND (arg1, 2), 0));
- }
- break;
- }
-
- return 0;
-}
-
-/* Similar to operand_equal_p, but see if ARG0 might have been made by
- shorten_compare from ARG1 when ARG1 was being compared with OTHER.
-
- When in doubt, return 0. */
-
-static int
-operand_equal_for_comparison_p (arg0, arg1, other)
- tree arg0, arg1;
- tree other;
-{
- int unsignedp1, unsignedpo;
- tree primarg1, primother;
- unsigned correct_width;
-
- if (operand_equal_p (arg0, arg1, 0))
- return 1;
-
- if (! INTEGRAL_TYPE_P (TREE_TYPE (arg0))
- || ! INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
- return 0;
-
- /* Duplicate what shorten_compare does to ARG1 and see if that gives the
- actual comparison operand, ARG0.
-
- First throw away any conversions to wider types
- already present in the operands. */
-
- primarg1 = get_narrower (arg1, &unsignedp1);
- primother = get_narrower (other, &unsignedpo);
-
- correct_width = TYPE_PRECISION (TREE_TYPE (arg1));
- if (unsignedp1 == unsignedpo
- && TYPE_PRECISION (TREE_TYPE (primarg1)) < correct_width
- && TYPE_PRECISION (TREE_TYPE (primother)) < correct_width)
- {
- tree type = TREE_TYPE (arg0);
-
- /* Make sure shorter operand is extended the right way
- to match the longer operand. */
- primarg1 = convert (signed_or_unsigned_type (unsignedp1,
- TREE_TYPE (primarg1)),
- primarg1);
-
- if (operand_equal_p (arg0, convert (type, primarg1), 0))
- return 1;
- }
-
- return 0;
-}
-
-/* See if ARG is an expression that is either a comparison or is performing
- arithmetic on comparisons. The comparisons must only be comparing
- two different values, which will be stored in *CVAL1 and *CVAL2; if
- they are non-zero it means that some operands have already been found.
- No variables may be used anywhere else in the expression except in the
- comparisons. If SAVE_P is true it means we removed a SAVE_EXPR around
- the expression and save_expr needs to be called with CVAL1 and CVAL2.
-
- If this is true, return 1. Otherwise, return zero. */
-
-static int
-twoval_comparison_p (arg, cval1, cval2, save_p)
- tree arg;
- tree *cval1, *cval2;
- int *save_p;
-{
- enum tree_code code = TREE_CODE (arg);
- char class = TREE_CODE_CLASS (code);
-
- /* We can handle some of the 'e' cases here. */
- if (class == 'e' && code == TRUTH_NOT_EXPR)
- class = '1';
- else if (class == 'e'
- && (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR
- || code == COMPOUND_EXPR))
- class = '2';
-
- /* ??? Disable this since the SAVE_EXPR might already be in use outside
- the expression. There may be no way to make this work, but it needs
- to be looked at again for 2.6. */
-#if 0
- else if (class == 'e' && code == SAVE_EXPR && SAVE_EXPR_RTL (arg) == 0)
- {
- /* If we've already found a CVAL1 or CVAL2, this expression is
- two complex to handle. */
- if (*cval1 || *cval2)
- return 0;
-
- class = '1';
- *save_p = 1;
- }
-#endif
-
- switch (class)
- {
- case '1':
- return twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2, save_p);
-
- case '2':
- return (twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2, save_p)
- && twoval_comparison_p (TREE_OPERAND (arg, 1),
- cval1, cval2, save_p));
-
- case 'c':
- return 1;
-
- case 'e':
- if (code == COND_EXPR)
- return (twoval_comparison_p (TREE_OPERAND (arg, 0),
- cval1, cval2, save_p)
- && twoval_comparison_p (TREE_OPERAND (arg, 1),
- cval1, cval2, save_p)
- && twoval_comparison_p (TREE_OPERAND (arg, 2),
- cval1, cval2, save_p));
- return 0;
-
- case '<':
- /* First see if we can handle the first operand, then the second. For
- the second operand, we know *CVAL1 can't be zero. It must be that
- one side of the comparison is each of the values; test for the
- case where this isn't true by failing if the two operands
- are the same. */
-
- if (operand_equal_p (TREE_OPERAND (arg, 0),
- TREE_OPERAND (arg, 1), 0))
- return 0;
-
- if (*cval1 == 0)
- *cval1 = TREE_OPERAND (arg, 0);
- else if (operand_equal_p (*cval1, TREE_OPERAND (arg, 0), 0))
- ;
- else if (*cval2 == 0)
- *cval2 = TREE_OPERAND (arg, 0);
- else if (operand_equal_p (*cval2, TREE_OPERAND (arg, 0), 0))
- ;
- else
- return 0;
-
- if (operand_equal_p (*cval1, TREE_OPERAND (arg, 1), 0))
- ;
- else if (*cval2 == 0)
- *cval2 = TREE_OPERAND (arg, 1);
- else if (operand_equal_p (*cval2, TREE_OPERAND (arg, 1), 0))
- ;
- else
- return 0;
-
- return 1;
- }
-
- return 0;
-}
-
-/* ARG is a tree that is known to contain just arithmetic operations and
- comparisons. Evaluate the operations in the tree substituting NEW0 for
- any occurrence of OLD0 as an operand of a comparison and likewise for
- NEW1 and OLD1. */
-
-static tree
-eval_subst (arg, old0, new0, old1, new1)
- tree arg;
- tree old0, new0, old1, new1;
-{
- tree type = TREE_TYPE (arg);
- enum tree_code code = TREE_CODE (arg);
- char class = TREE_CODE_CLASS (code);
-
- /* We can handle some of the 'e' cases here. */
- if (class == 'e' && code == TRUTH_NOT_EXPR)
- class = '1';
- else if (class == 'e'
- && (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR))
- class = '2';
-
- switch (class)
- {
- case '1':
- return fold (build1 (code, type,
- eval_subst (TREE_OPERAND (arg, 0),
- old0, new0, old1, new1)));
-
- case '2':
- return fold (build (code, type,
- eval_subst (TREE_OPERAND (arg, 0),
- old0, new0, old1, new1),
- eval_subst (TREE_OPERAND (arg, 1),
- old0, new0, old1, new1)));
-
- case 'e':
- switch (code)
- {
- case SAVE_EXPR:
- return eval_subst (TREE_OPERAND (arg, 0), old0, new0, old1, new1);
-
- case COMPOUND_EXPR:
- return eval_subst (TREE_OPERAND (arg, 1), old0, new0, old1, new1);
-
- case COND_EXPR:
- return fold (build (code, type,
- eval_subst (TREE_OPERAND (arg, 0),
- old0, new0, old1, new1),
- eval_subst (TREE_OPERAND (arg, 1),
- old0, new0, old1, new1),
- eval_subst (TREE_OPERAND (arg, 2),
- old0, new0, old1, new1)));
- }
-
- case '<':
- {
- tree arg0 = TREE_OPERAND (arg, 0);
- tree arg1 = TREE_OPERAND (arg, 1);
-
- /* We need to check both for exact equality and tree equality. The
- former will be true if the operand has a side-effect. In that
- case, we know the operand occurred exactly once. */
-
- if (arg0 == old0 || operand_equal_p (arg0, old0, 0))
- arg0 = new0;
- else if (arg0 == old1 || operand_equal_p (arg0, old1, 0))
- arg0 = new1;
-
- if (arg1 == old0 || operand_equal_p (arg1, old0, 0))
- arg1 = new0;
- else if (arg1 == old1 || operand_equal_p (arg1, old1, 0))
- arg1 = new1;
-
- return fold (build (code, type, arg0, arg1));
- }
- }
-
- return arg;
-}
-
-/* Return a tree for the case when the result of an expression is RESULT
- converted to TYPE and OMITTED was previously an operand of the expression
- but is now not needed (e.g., we folded OMITTED * 0).
-
- If OMITTED has side effects, we must evaluate it. Otherwise, just do
- the conversion of RESULT to TYPE. */
-
-static tree
-omit_one_operand (type, result, omitted)
- tree type, result, omitted;
-{
- tree t = convert (type, result);
-
- if (TREE_SIDE_EFFECTS (omitted))
- return build (COMPOUND_EXPR, type, omitted, t);
-
- return non_lvalue (t);
-}
-
-/* Similar, but call pedantic_non_lvalue instead of non_lvalue. */
-
-static tree
-pedantic_omit_one_operand (type, result, omitted)
- tree type, result, omitted;
-{
- tree t = convert (type, result);
-
- if (TREE_SIDE_EFFECTS (omitted))
- return build (COMPOUND_EXPR, type, omitted, t);
-
- return pedantic_non_lvalue (t);
-}
-
-
-
-/* Return a simplified tree node for the truth-negation of ARG. This
- never alters ARG itself. We assume that ARG is an operation that
- returns a truth value (0 or 1). */
-
-tree
-invert_truthvalue (arg)
- tree arg;
-{
- tree type = TREE_TYPE (arg);
- enum tree_code code = TREE_CODE (arg);
-
- if (code == ERROR_MARK)
- return arg;
-
- /* If this is a comparison, we can simply invert it, except for
- floating-point non-equality comparisons, in which case we just
- enclose a TRUTH_NOT_EXPR around what we have. */
-
- if (TREE_CODE_CLASS (code) == '<')
- {
- if (FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (arg, 0)))
- && code != NE_EXPR && code != EQ_EXPR)
- return build1 (TRUTH_NOT_EXPR, type, arg);
- else
- return build (invert_tree_comparison (code), type,
- TREE_OPERAND (arg, 0), TREE_OPERAND (arg, 1));
- }
-
- switch (code)
- {
- case INTEGER_CST:
- return convert (type, build_int_2 (TREE_INT_CST_LOW (arg) == 0
- && TREE_INT_CST_HIGH (arg) == 0, 0));
-
- case TRUTH_AND_EXPR:
- return build (TRUTH_OR_EXPR, type,
- invert_truthvalue (TREE_OPERAND (arg, 0)),
- invert_truthvalue (TREE_OPERAND (arg, 1)));
-
- case TRUTH_OR_EXPR:
- return build (TRUTH_AND_EXPR, type,
- invert_truthvalue (TREE_OPERAND (arg, 0)),
- invert_truthvalue (TREE_OPERAND (arg, 1)));
-
- case TRUTH_XOR_EXPR:
- /* Here we can invert either operand. We invert the first operand
- unless the second operand is a TRUTH_NOT_EXPR in which case our
- result is the XOR of the first operand with the inside of the
- negation of the second operand. */
-
- if (TREE_CODE (TREE_OPERAND (arg, 1)) == TRUTH_NOT_EXPR)
- return build (TRUTH_XOR_EXPR, type, TREE_OPERAND (arg, 0),
- TREE_OPERAND (TREE_OPERAND (arg, 1), 0));
- else
- return build (TRUTH_XOR_EXPR, type,
- invert_truthvalue (TREE_OPERAND (arg, 0)),
- TREE_OPERAND (arg, 1));
-
- case TRUTH_ANDIF_EXPR:
- return build (TRUTH_ORIF_EXPR, type,
- invert_truthvalue (TREE_OPERAND (arg, 0)),
- invert_truthvalue (TREE_OPERAND (arg, 1)));
-
- case TRUTH_ORIF_EXPR:
- return build (TRUTH_ANDIF_EXPR, type,
- invert_truthvalue (TREE_OPERAND (arg, 0)),
- invert_truthvalue (TREE_OPERAND (arg, 1)));
-
- case TRUTH_NOT_EXPR:
- return TREE_OPERAND (arg, 0);
-
- case COND_EXPR:
- return build (COND_EXPR, type, TREE_OPERAND (arg, 0),
- invert_truthvalue (TREE_OPERAND (arg, 1)),
- invert_truthvalue (TREE_OPERAND (arg, 2)));
-
- case COMPOUND_EXPR:
- return build (COMPOUND_EXPR, type, TREE_OPERAND (arg, 0),
- invert_truthvalue (TREE_OPERAND (arg, 1)));
-
- case NON_LVALUE_EXPR:
- return invert_truthvalue (TREE_OPERAND (arg, 0));
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- return build1 (TREE_CODE (arg), type,
- invert_truthvalue (TREE_OPERAND (arg, 0)));
-
- case BIT_AND_EXPR:
- if (!integer_onep (TREE_OPERAND (arg, 1)))
- break;
- return build (EQ_EXPR, type, arg, convert (type, integer_zero_node));
-
- case SAVE_EXPR:
- return build1 (TRUTH_NOT_EXPR, type, arg);
-
- case CLEANUP_POINT_EXPR:
- return build1 (CLEANUP_POINT_EXPR, type,
- invert_truthvalue (TREE_OPERAND (arg, 0)));
- }
- if (TREE_CODE (TREE_TYPE (arg)) != BOOLEAN_TYPE)
- abort ();
- return build1 (TRUTH_NOT_EXPR, type, arg);
-}
-
-/* Given a bit-wise operation CODE applied to ARG0 and ARG1, see if both
- operands are another bit-wise operation with a common input. If so,
- distribute the bit operations to save an operation and possibly two if
- constants are involved. For example, convert
- (A | B) & (A | C) into A | (B & C)
- Further simplification will occur if B and C are constants.
-
- If this optimization cannot be done, 0 will be returned. */
-
-static tree
-distribute_bit_expr (code, type, arg0, arg1)
- enum tree_code code;
- tree type;
- tree arg0, arg1;
-{
- tree common;
- tree left, right;
-
- if (TREE_CODE (arg0) != TREE_CODE (arg1)
- || TREE_CODE (arg0) == code
- || (TREE_CODE (arg0) != BIT_AND_EXPR
- && TREE_CODE (arg0) != BIT_IOR_EXPR))
- return 0;
-
- if (operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 0), 0))
- {
- common = TREE_OPERAND (arg0, 0);
- left = TREE_OPERAND (arg0, 1);
- right = TREE_OPERAND (arg1, 1);
- }
- else if (operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1, 1), 0))
- {
- common = TREE_OPERAND (arg0, 0);
- left = TREE_OPERAND (arg0, 1);
- right = TREE_OPERAND (arg1, 0);
- }
- else if (operand_equal_p (TREE_OPERAND (arg0, 1), TREE_OPERAND (arg1, 0), 0))
- {
- common = TREE_OPERAND (arg0, 1);
- left = TREE_OPERAND (arg0, 0);
- right = TREE_OPERAND (arg1, 1);
- }
- else if (operand_equal_p (TREE_OPERAND (arg0, 1), TREE_OPERAND (arg1, 1), 0))
- {
- common = TREE_OPERAND (arg0, 1);
- left = TREE_OPERAND (arg0, 0);
- right = TREE_OPERAND (arg1, 0);
- }
- else
- return 0;
-
- return fold (build (TREE_CODE (arg0), type, common,
- fold (build (code, type, left, right))));
-}
-
-/* Return a BIT_FIELD_REF of type TYPE to refer to BITSIZE bits of INNER
- starting at BITPOS. The field is unsigned if UNSIGNEDP is non-zero. */
-
-static tree
-make_bit_field_ref (inner, type, bitsize, bitpos, unsignedp)
- tree inner;
- tree type;
- int bitsize, bitpos;
- int unsignedp;
-{
- tree result = build (BIT_FIELD_REF, type, inner,
- size_int (bitsize), size_int (bitpos));
-
- TREE_UNSIGNED (result) = unsignedp;
-
- return result;
-}
-
-/* Optimize a bit-field compare.
-
- There are two cases: First is a compare against a constant and the
- second is a comparison of two items where the fields are at the same
- bit position relative to the start of a chunk (byte, halfword, word)
- large enough to contain it. In these cases we can avoid the shift
- implicit in bitfield extractions.
-
- For constants, we emit a compare of the shifted constant with the
- BIT_AND_EXPR of a mask and a byte, halfword, or word of the operand being
- compared. For two fields at the same position, we do the ANDs with the
- similar mask and compare the result of the ANDs.
-
- CODE is the comparison code, known to be either NE_EXPR or EQ_EXPR.
- COMPARE_TYPE is the type of the comparison, and LHS and RHS
- are the left and right operands of the comparison, respectively.
-
- If the optimization described above can be done, we return the resulting
- tree. Otherwise we return zero. */
-
-static tree
-optimize_bit_field_compare (code, compare_type, lhs, rhs)
- enum tree_code code;
- tree compare_type;
- tree lhs, rhs;
-{
- int lbitpos, lbitsize, rbitpos, rbitsize;
- int lnbitpos, lnbitsize, rnbitpos, rnbitsize;
- tree type = TREE_TYPE (lhs);
- tree signed_type, unsigned_type;
- int const_p = TREE_CODE (rhs) == INTEGER_CST;
- enum machine_mode lmode, rmode, lnmode, rnmode;
- int lunsignedp, runsignedp;
- int lvolatilep = 0, rvolatilep = 0;
- int alignment;
- tree linner, rinner;
- tree mask;
- tree offset;
-
- /* Get all the information about the extractions being done. If the bit size
- if the same as the size of the underlying object, we aren't doing an
- extraction at all and so can do nothing. */
- linner = get_inner_reference (lhs, &lbitsize, &lbitpos, &offset, &lmode,
- &lunsignedp, &lvolatilep, &alignment);
- if (linner == lhs || lbitsize == GET_MODE_BITSIZE (lmode) || lbitsize < 0
- || offset != 0)
- return 0;
-
- if (!const_p)
- {
- /* If this is not a constant, we can only do something if bit positions,
- sizes, and signedness are the same. */
- rinner = get_inner_reference (rhs, &rbitsize, &rbitpos, &offset, &rmode,
- &runsignedp, &rvolatilep, &alignment);
-
- if (rinner == rhs || lbitpos != rbitpos || lbitsize != rbitsize
- || lunsignedp != runsignedp || offset != 0)
- return 0;
- }
-
- /* See if we can find a mode to refer to this field. We should be able to,
- but fail if we can't. */
- lnmode = get_best_mode (lbitsize, lbitpos,
- TYPE_ALIGN (TREE_TYPE (linner)), word_mode,
- lvolatilep);
- if (lnmode == VOIDmode)
- return 0;
-
- /* Set signed and unsigned types of the precision of this mode for the
- shifts below. */
- signed_type = type_for_mode (lnmode, 0);
- unsigned_type = type_for_mode (lnmode, 1);
-
- if (! const_p)
- {
- rnmode = get_best_mode (rbitsize, rbitpos,
- TYPE_ALIGN (TREE_TYPE (rinner)), word_mode,
- rvolatilep);
- if (rnmode == VOIDmode)
- return 0;
- }
-
- /* Compute the bit position and size for the new reference and our offset
- within it. If the new reference is the same size as the original, we
- won't optimize anything, so return zero. */
- lnbitsize = GET_MODE_BITSIZE (lnmode);
- lnbitpos = lbitpos & ~ (lnbitsize - 1);
- lbitpos -= lnbitpos;
- if (lnbitsize == lbitsize)
- return 0;
-
- if (! const_p)
- {
- rnbitsize = GET_MODE_BITSIZE (rnmode);
- rnbitpos = rbitpos & ~ (rnbitsize - 1);
- rbitpos -= rnbitpos;
- if (rnbitsize == rbitsize)
- return 0;
- }
-
- if (BYTES_BIG_ENDIAN)
- lbitpos = lnbitsize - lbitsize - lbitpos;
-
- /* Make the mask to be used against the extracted field. */
- mask = build_int_2 (~0, ~0);
- TREE_TYPE (mask) = unsigned_type;
- force_fit_type (mask, 0);
- mask = convert (unsigned_type, mask);
- mask = const_binop (LSHIFT_EXPR, mask, size_int (lnbitsize - lbitsize), 0);
- mask = const_binop (RSHIFT_EXPR, mask,
- size_int (lnbitsize - lbitsize - lbitpos), 0);
-
- if (! const_p)
- /* If not comparing with constant, just rework the comparison
- and return. */
- return build (code, compare_type,
- build (BIT_AND_EXPR, unsigned_type,
- make_bit_field_ref (linner, unsigned_type,
- lnbitsize, lnbitpos, 1),
- mask),
- build (BIT_AND_EXPR, unsigned_type,
- make_bit_field_ref (rinner, unsigned_type,
- rnbitsize, rnbitpos, 1),
- mask));
-
- /* Otherwise, we are handling the constant case. See if the constant is too
- big for the field. Warn and return a tree of for 0 (false) if so. We do
- this not only for its own sake, but to avoid having to test for this
- error case below. If we didn't, we might generate wrong code.
-
- For unsigned fields, the constant shifted right by the field length should
- be all zero. For signed fields, the high-order bits should agree with
- the sign bit. */
-
- if (lunsignedp)
- {
- if (! integer_zerop (const_binop (RSHIFT_EXPR,
- convert (unsigned_type, rhs),
- size_int (lbitsize), 0)))
- {
- warning ("comparison is always %s due to width of bitfield",
- code == NE_EXPR ? "one" : "zero");
- return convert (compare_type,
- (code == NE_EXPR
- ? integer_one_node : integer_zero_node));
- }
- }
- else
- {
- tree tem = const_binop (RSHIFT_EXPR, convert (signed_type, rhs),
- size_int (lbitsize - 1), 0);
- if (! integer_zerop (tem) && ! integer_all_onesp (tem))
- {
- warning ("comparison is always %s due to width of bitfield",
- code == NE_EXPR ? "one" : "zero");
- return convert (compare_type,
- (code == NE_EXPR
- ? integer_one_node : integer_zero_node));
- }
- }
-
- /* Single-bit compares should always be against zero. */
- if (lbitsize == 1 && ! integer_zerop (rhs))
- {
- code = code == EQ_EXPR ? NE_EXPR : EQ_EXPR;
- rhs = convert (type, integer_zero_node);
- }
-
- /* Make a new bitfield reference, shift the constant over the
- appropriate number of bits and mask it with the computed mask
- (in case this was a signed field). If we changed it, make a new one. */
- lhs = make_bit_field_ref (linner, unsigned_type, lnbitsize, lnbitpos, 1);
- if (lvolatilep)
- {
- TREE_SIDE_EFFECTS (lhs) = 1;
- TREE_THIS_VOLATILE (lhs) = 1;
- }
-
- rhs = fold (const_binop (BIT_AND_EXPR,
- const_binop (LSHIFT_EXPR,
- convert (unsigned_type, rhs),
- size_int (lbitpos), 0),
- mask, 0));
-
- return build (code, compare_type,
- build (BIT_AND_EXPR, unsigned_type, lhs, mask),
- rhs);
-}
-
-/* Subroutine for fold_truthop: decode a field reference.
-
- If EXP is a comparison reference, we return the innermost reference.
-
- *PBITSIZE is set to the number of bits in the reference, *PBITPOS is
- set to the starting bit number.
-
- If the innermost field can be completely contained in a mode-sized
- unit, *PMODE is set to that mode. Otherwise, it is set to VOIDmode.
-
- *PVOLATILEP is set to 1 if the any expression encountered is volatile;
- otherwise it is not changed.
-
- *PUNSIGNEDP is set to the signedness of the field.
-
- *PMASK is set to the mask used. This is either contained in a
- BIT_AND_EXPR or derived from the width of the field.
-
- *PAND_MASK is set the the mask found in a BIT_AND_EXPR, if any.
-
- Return 0 if this is not a component reference or is one that we can't
- do anything with. */
-
-static tree
-decode_field_reference (exp, pbitsize, pbitpos, pmode, punsignedp,
- pvolatilep, pmask, pand_mask)
- tree exp;
- int *pbitsize, *pbitpos;
- enum machine_mode *pmode;
- int *punsignedp, *pvolatilep;
- tree *pmask;
- tree *pand_mask;
-{
- tree and_mask = 0;
- tree mask, inner, offset;
- tree unsigned_type;
- int precision;
- int alignment;
-
- /* All the optimizations using this function assume integer fields.
- There are problems with FP fields since the type_for_size call
- below can fail for, e.g., XFmode. */
- if (! INTEGRAL_TYPE_P (TREE_TYPE (exp)))
- return 0;
-
- STRIP_NOPS (exp);
-
- if (TREE_CODE (exp) == BIT_AND_EXPR)
- {
- and_mask = TREE_OPERAND (exp, 1);
- exp = TREE_OPERAND (exp, 0);
- STRIP_NOPS (exp); STRIP_NOPS (and_mask);
- if (TREE_CODE (and_mask) != INTEGER_CST)
- return 0;
- }
-
-
- inner = get_inner_reference (exp, pbitsize, pbitpos, &offset, pmode,
- punsignedp, pvolatilep, &alignment);
- if ((inner == exp && and_mask == 0)
- || *pbitsize < 0 || offset != 0)
- return 0;
-
- /* Compute the mask to access the bitfield. */
- unsigned_type = type_for_size (*pbitsize, 1);
- precision = TYPE_PRECISION (unsigned_type);
-
- mask = build_int_2 (~0, ~0);
- TREE_TYPE (mask) = unsigned_type;
- force_fit_type (mask, 0);
- mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
- mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
-
- /* Merge it with the mask we found in the BIT_AND_EXPR, if any. */
- if (and_mask != 0)
- mask = fold (build (BIT_AND_EXPR, unsigned_type,
- convert (unsigned_type, and_mask), mask));
-
- *pmask = mask;
- *pand_mask = and_mask;
- return inner;
-}
-
-/* Return non-zero if MASK represents a mask of SIZE ones in the low-order
- bit positions. */
-
-static int
-all_ones_mask_p (mask, size)
- tree mask;
- int size;
-{
- tree type = TREE_TYPE (mask);
- int precision = TYPE_PRECISION (type);
- tree tmask;
-
- tmask = build_int_2 (~0, ~0);
- TREE_TYPE (tmask) = signed_type (type);
- force_fit_type (tmask, 0);
- return
- tree_int_cst_equal (mask,
- const_binop (RSHIFT_EXPR,
- const_binop (LSHIFT_EXPR, tmask,
- size_int (precision - size),
- 0),
- size_int (precision - size), 0));
-}
-
-/* Subroutine for fold_truthop: determine if an operand is simple enough
- to be evaluated unconditionally. */
-
-static int
-simple_operand_p (exp)
- tree exp;
-{
- /* Strip any conversions that don't change the machine mode. */
- while ((TREE_CODE (exp) == NOP_EXPR
- || TREE_CODE (exp) == CONVERT_EXPR)
- && (TYPE_MODE (TREE_TYPE (exp))
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
- exp = TREE_OPERAND (exp, 0);
-
- return (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c'
- || (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
- && ! TREE_ADDRESSABLE (exp)
- && ! TREE_THIS_VOLATILE (exp)
- && ! DECL_NONLOCAL (exp)
- /* Don't regard global variables as simple. They may be
- allocated in ways unknown to the compiler (shared memory,
- #pragma weak, etc). */
- && ! TREE_PUBLIC (exp)
- && ! DECL_EXTERNAL (exp)
- /* Loading a static variable is unduly expensive, but global
- registers aren't expensive. */
- && (! TREE_STATIC (exp) || DECL_REGISTER (exp))));
-}
-
-/* The following functions are subroutines to fold_range_test and allow it to
- try to change a logical combination of comparisons into a range test.
-
- For example, both
- X == 2 && X == 3 && X == 4 && X == 5
- and
- X >= 2 && X <= 5
- are converted to
- (unsigned) (X - 2) <= 3
-
- We decribe each set of comparisons as being either inside or outside
- a range, using a variable named like IN_P, and then describe the
- range with a lower and upper bound. If one of the bounds is omitted,
- it represents either the highest or lowest value of the type.
-
- In the comments below, we represent a range by two numbers in brackets
- preceeded by a "+" to designate being inside that range, or a "-" to
- designate being outside that range, so the condition can be inverted by
- flipping the prefix. An omitted bound is represented by a "-". For
- example, "- [-, 10]" means being outside the range starting at the lowest
- possible value and ending at 10, in other words, being greater than 10.
- The range "+ [-, -]" is always true and hence the range "- [-, -]" is
- always false.
-
- We set up things so that the missing bounds are handled in a consistent
- manner so neither a missing bound nor "true" and "false" need to be
- handled using a special case. */
-
-/* Return the result of applying CODE to ARG0 and ARG1, but handle the case
- of ARG0 and/or ARG1 being omitted, meaning an unlimited range. UPPER0_P
- and UPPER1_P are nonzero if the respective argument is an upper bound
- and zero for a lower. TYPE, if nonzero, is the type of the result; it
- must be specified for a comparison. ARG1 will be converted to ARG0's
- type if both are specified. */
-
-static tree
-range_binop (code, type, arg0, upper0_p, arg1, upper1_p)
- enum tree_code code;
- tree type;
- tree arg0, arg1;
- int upper0_p, upper1_p;
-{
- tree tem;
- int result;
- int sgn0, sgn1;
-
- /* If neither arg represents infinity, do the normal operation.
- Else, if not a comparison, return infinity. Else handle the special
- comparison rules. Note that most of the cases below won't occur, but
- are handled for consistency. */
-
- if (arg0 != 0 && arg1 != 0)
- {
- tem = fold (build (code, type != 0 ? type : TREE_TYPE (arg0),
- arg0, convert (TREE_TYPE (arg0), arg1)));
- STRIP_NOPS (tem);
- return TREE_CODE (tem) == INTEGER_CST ? tem : 0;
- }
-
- if (TREE_CODE_CLASS (code) != '<')
- return 0;
-
- /* Set SGN[01] to -1 if ARG[01] is a lower bound, 1 for upper, and 0
- for neither. Then compute our result treating them as never equal
- and comparing bounds to non-bounds as above. */
- sgn0 = arg0 != 0 ? 0 : (upper0_p ? 1 : -1);
- sgn1 = arg1 != 0 ? 0 : (upper1_p ? 1 : -1);
- switch (code)
- {
- case EQ_EXPR: case NE_EXPR:
- result = (code == NE_EXPR);
- break;
- case LT_EXPR: case LE_EXPR:
- result = sgn0 < sgn1;
- break;
- case GT_EXPR: case GE_EXPR:
- result = sgn0 > sgn1;
- break;
- }
-
- return convert (type, result ? integer_one_node : integer_zero_node);
-}
-
-/* Given EXP, a logical expression, set the range it is testing into
- variables denoted by PIN_P, PLOW, and PHIGH. Return the expression
- actually being tested. *PLOW and *PHIGH will have be made the same type
- as the returned expression. If EXP is not a comparison, we will most
- likely not be returning a useful value and range. */
-
-static tree
-make_range (exp, pin_p, plow, phigh)
- tree exp;
- int *pin_p;
- tree *plow, *phigh;
-{
- enum tree_code code;
- tree arg0, arg1, type;
- int in_p, n_in_p;
- tree low, high, n_low, n_high;
-
- /* Start with simply saying "EXP != 0" and then look at the code of EXP
- and see if we can refine the range. Some of the cases below may not
- happen, but it doesn't seem worth worrying about this. We "continue"
- the outer loop when we've changed something; otherwise we "break"
- the switch, which will "break" the while. */
-
- in_p = 0, low = high = convert (TREE_TYPE (exp), integer_zero_node);
-
- while (1)
- {
- code = TREE_CODE (exp);
- arg0 = TREE_OPERAND (exp, 0), arg1 = TREE_OPERAND (exp, 1);
- if (TREE_CODE_CLASS (code) == '<' || TREE_CODE_CLASS (code) == '1'
- || TREE_CODE_CLASS (code) == '2')
- type = TREE_TYPE (arg0);
-
- switch (code)
- {
- case TRUTH_NOT_EXPR:
- in_p = ! in_p, exp = arg0;
- continue;
-
- case EQ_EXPR: case NE_EXPR:
- case LT_EXPR: case LE_EXPR: case GE_EXPR: case GT_EXPR:
- /* We can only do something if the range is testing for zero
- and if the second operand is an integer constant. Note that
- saying something is "in" the range we make is done by
- complementing IN_P since it will set in the initial case of
- being not equal to zero; "out" is leaving it alone. */
- if (low == 0 || high == 0
- || ! integer_zerop (low) || ! integer_zerop (high)
- || TREE_CODE (arg1) != INTEGER_CST)
- break;
-
- switch (code)
- {
- case NE_EXPR: /* - [c, c] */
- low = high = arg1;
- break;
- case EQ_EXPR: /* + [c, c] */
- in_p = ! in_p, low = high = arg1;
- break;
- case GT_EXPR: /* - [-, c] */
- low = 0, high = arg1;
- break;
- case GE_EXPR: /* + [c, -] */
- in_p = ! in_p, low = arg1, high = 0;
- break;
- case LT_EXPR: /* - [c, -] */
- low = arg1, high = 0;
- break;
- case LE_EXPR: /* + [-, c] */
- in_p = ! in_p, low = 0, high = arg1;
- break;
- }
-
- exp = arg0;
-
- /* If this is an unsigned comparison, we also know that EXP is
- greater than or equal to zero. We base the range tests we make
- on that fact, so we record it here so we can parse existing
- range tests. */
- if (TREE_UNSIGNED (type) && (low == 0 || high == 0))
- {
- if (! merge_ranges (&n_in_p, &n_low, &n_high, in_p, low, high,
- 1, convert (type, integer_zero_node),
- NULL_TREE))
- break;
-
- in_p = n_in_p, low = n_low, high = n_high;
-
- /* If the high bound is missing, reverse the range so it
- goes from zero to the low bound minus 1. */
- if (high == 0)
- {
- in_p = ! in_p;
- high = range_binop (MINUS_EXPR, NULL_TREE, low, 0,
- integer_one_node, 0);
- low = convert (type, integer_zero_node);
- }
- }
- continue;
-
- case NEGATE_EXPR:
- /* (-x) IN [a,b] -> x in [-b, -a] */
- n_low = range_binop (MINUS_EXPR, type,
- convert (type, integer_zero_node), 0, high, 1);
- n_high = range_binop (MINUS_EXPR, type,
- convert (type, integer_zero_node), 0, low, 0);
- low = n_low, high = n_high;
- exp = arg0;
- continue;
-
- case BIT_NOT_EXPR:
- /* ~ X -> -X - 1 */
- exp = build (MINUS_EXPR, type, build1 (NEGATE_EXPR, type, arg0),
- convert (type, integer_one_node));
- continue;
-
- case PLUS_EXPR: case MINUS_EXPR:
- if (TREE_CODE (arg1) != INTEGER_CST)
- break;
-
- /* If EXP is signed, any overflow in the computation is undefined,
- so we don't worry about it so long as our computations on
- the bounds don't overflow. For unsigned, overflow is defined
- and this is exactly the right thing. */
- n_low = range_binop (code == MINUS_EXPR ? PLUS_EXPR : MINUS_EXPR,
- type, low, 0, arg1, 0);
- n_high = range_binop (code == MINUS_EXPR ? PLUS_EXPR : MINUS_EXPR,
- type, high, 1, arg1, 0);
- if ((n_low != 0 && TREE_OVERFLOW (n_low))
- || (n_high != 0 && TREE_OVERFLOW (n_high)))
- break;
-
- /* Check for an unsigned range which has wrapped around the maximum
- value thus making n_high < n_low, and normalize it. */
- if (n_low && n_high && tree_int_cst_lt (n_high, n_low))
- {
- low = range_binop (PLUS_EXPR, type, n_high, 0,
- integer_one_node, 0);
- high = range_binop (MINUS_EXPR, type, n_low, 0,
- integer_one_node, 0);
- in_p = ! in_p;
- }
- else
- low = n_low, high = n_high;
-
- exp = arg0;
- continue;
-
- case NOP_EXPR: case NON_LVALUE_EXPR: case CONVERT_EXPR:
- if (! INTEGRAL_TYPE_P (type)
- || (low != 0 && ! int_fits_type_p (low, type))
- || (high != 0 && ! int_fits_type_p (high, type)))
- break;
-
- if (low != 0)
- low = convert (type, low);
-
- if (high != 0)
- high = convert (type, high);
-
- exp = arg0;
- continue;
- }
-
- break;
- }
-
- /* If EXP is a constant, we can evaluate whether this is true or false. */
- if (TREE_CODE (exp) == INTEGER_CST)
- {
- in_p = in_p == (integer_onep (range_binop (GE_EXPR, integer_type_node,
- exp, 0, low, 0))
- && integer_onep (range_binop (LE_EXPR, integer_type_node,
- exp, 1, high, 1)));
- low = high = 0;
- exp = 0;
- }
-
- *pin_p = in_p, *plow = low, *phigh = high;
- return exp;
-}
-
-/* Given a range, LOW, HIGH, and IN_P, an expression, EXP, and a result
- type, TYPE, return an expression to test if EXP is in (or out of, depending
- on IN_P) the range. */
-
-static tree
-build_range_check (type, exp, in_p, low, high)
- tree type;
- tree exp;
- int in_p;
- tree low, high;
-{
- tree etype = TREE_TYPE (exp);
- tree utype, value;
-
- if (! in_p
- && (0 != (value = build_range_check (type, exp, 1, low, high))))
- return invert_truthvalue (value);
-
- else if (low == 0 && high == 0)
- return convert (type, integer_one_node);
-
- else if (low == 0)
- return fold (build (LE_EXPR, type, exp, high));
-
- else if (high == 0)
- return fold (build (GE_EXPR, type, exp, low));
-
- else if (operand_equal_p (low, high, 0))
- return fold (build (EQ_EXPR, type, exp, low));
-
- else if (TREE_UNSIGNED (etype) && integer_zerop (low))
- return build_range_check (type, exp, 1, 0, high);
-
- else if (integer_zerop (low))
- {
- utype = unsigned_type (etype);
- return build_range_check (type, convert (utype, exp), 1, 0,
- convert (utype, high));
- }
-
- else if (0 != (value = const_binop (MINUS_EXPR, high, low, 0))
- && ! TREE_OVERFLOW (value))
- return build_range_check (type,
- fold (build (MINUS_EXPR, etype, exp, low)),
- 1, convert (etype, integer_zero_node), value);
- else
- return 0;
-}
-
-/* Given two ranges, see if we can merge them into one. Return 1 if we
- can, 0 if we can't. Set the output range into the specified parameters. */
-
-static int
-merge_ranges (pin_p, plow, phigh, in0_p, low0, high0, in1_p, low1, high1)
- int *pin_p;
- tree *plow, *phigh;
- int in0_p, in1_p;
- tree low0, high0, low1, high1;
-{
- int no_overlap;
- int subset;
- int temp;
- tree tem;
- int in_p;
- tree low, high;
-
- /* Make range 0 be the range that starts first. Swap them if it isn't. */
- if (integer_onep (range_binop (GT_EXPR, integer_type_node,
- low0, 0, low1, 0))
- || (((low0 == 0 && low1 == 0)
- || integer_onep (range_binop (EQ_EXPR, integer_type_node,
- low0, 0, low1, 0)))
- && integer_onep (range_binop (GT_EXPR, integer_type_node,
- high0, 1, high1, 1))))
- {
- temp = in0_p, in0_p = in1_p, in1_p = temp;
- tem = low0, low0 = low1, low1 = tem;
- tem = high0, high0 = high1, high1 = tem;
- }
-
- /* Now flag two cases, whether the ranges are disjoint or whether the
- second range is totally subsumed in the first. Note that the tests
- below are simplified by the ones above. */
- no_overlap = integer_onep (range_binop (LT_EXPR, integer_type_node,
- high0, 1, low1, 0));
- subset = integer_onep (range_binop (LE_EXPR, integer_type_node,
- high1, 1, high0, 1));
-
- /* We now have four cases, depending on whether we are including or
- excluding the two ranges. */
- if (in0_p && in1_p)
- {
- /* If they don't overlap, the result is false. If the second range
- is a subset it is the result. Otherwise, the range is from the start
- of the second to the end of the first. */
- if (no_overlap)
- in_p = 0, low = high = 0;
- else if (subset)
- in_p = 1, low = low1, high = high1;
- else
- in_p = 1, low = low1, high = high0;
- }
-
- else if (in0_p && ! in1_p)
- {
- /* If they don't overlap, the result is the first range. If the
- second range is a subset of the first, we can't describe this as
- a single range unless both ranges end at the same place. If both
- ranges start in the same place, then the result is false.
- Otherwise, we go from the start of the first range to just before
- the start of the second. */
- if (no_overlap)
- in_p = 1, low = low0, high = high0;
- else if (subset
- && integer_zerop (range_binop (EQ_EXPR, integer_type_node,
- high0, 1, high1, 0)))
- return 0;
- else if (integer_onep (range_binop (EQ_EXPR, integer_type_node,
- low0, 0, low1, 0)))
- in_p = 0, low = high = 0;
- else
- {
- in_p = 1, low = low0;
- high = range_binop (MINUS_EXPR, NULL_TREE, low1, 0,
- integer_one_node, 0);
- }
- }
-
- else if (! in0_p && in1_p)
- {
- /* If they don't overlap, the result is the second range. If the second
- is a subset of the first, the result is false. Otherwise,
- the range starts just after the first range and ends at the
- end of the second. */
- if (no_overlap)
- in_p = 1, low = low1, high = high1;
- else if (subset)
- in_p = 0, low = high = 0;
- else
- {
- in_p = 1, high = high1;
- low = range_binop (PLUS_EXPR, NULL_TREE, high0, 1,
- integer_one_node, 0);
- }
- }
-
- else
- {
- /* The case where we are excluding both ranges. Here the complex case
- is if they don't overlap. In that case, the only time we have a
- range is if they are adjacent. If the second is a subset of the
- first, the result is the first. Otherwise, the range to exclude
- starts at the beginning of the first range and ends at the end of the
- second. */
- if (no_overlap)
- {
- if (integer_onep (range_binop (EQ_EXPR, integer_type_node,
- range_binop (PLUS_EXPR, NULL_TREE,
- high0, 1,
- integer_one_node, 1),
- 1, low1, 0)))
- in_p = 0, low = low0, high = high1;
- else
- return 0;
- }
- else if (subset)
- in_p = 0, low = low0, high = high0;
- else
- in_p = 0, low = low0, high = high1;
- }
-
- *pin_p = in_p, *plow = low, *phigh = high;
- return 1;
-}
-
-/* EXP is some logical combination of boolean tests. See if we can
- merge it into some range test. Return the new tree if so. */
-
-static tree
-fold_range_test (exp)
- tree exp;
-{
- int or_op = (TREE_CODE (exp) == TRUTH_ORIF_EXPR
- || TREE_CODE (exp) == TRUTH_OR_EXPR);
- int in0_p, in1_p, in_p;
- tree low0, low1, low, high0, high1, high;
- tree lhs = make_range (TREE_OPERAND (exp, 0), &in0_p, &low0, &high0);
- tree rhs = make_range (TREE_OPERAND (exp, 1), &in1_p, &low1, &high1);
- tree tem;
-
- /* If this is an OR operation, invert both sides; we will invert
- again at the end. */
- if (or_op)
- in0_p = ! in0_p, in1_p = ! in1_p;
-
- /* If both expressions are the same, if we can merge the ranges, and we
- can build the range test, return it or it inverted. If one of the
- ranges is always true or always false, consider it to be the same
- expression as the other. */
- if ((lhs == 0 || rhs == 0 || operand_equal_p (lhs, rhs, 0))
- && merge_ranges (&in_p, &low, &high, in0_p, low0, high0,
- in1_p, low1, high1)
- && 0 != (tem = (build_range_check (TREE_TYPE (exp),
- lhs != 0 ? lhs
- : rhs != 0 ? rhs : integer_zero_node,
- in_p, low, high))))
- return or_op ? invert_truthvalue (tem) : tem;
-
- /* On machines where the branch cost is expensive, if this is a
- short-circuited branch and the underlying object on both sides
- is the same, make a non-short-circuit operation. */
- else if (BRANCH_COST >= 2
- && (TREE_CODE (exp) == TRUTH_ANDIF_EXPR
- || TREE_CODE (exp) == TRUTH_ORIF_EXPR)
- && operand_equal_p (lhs, rhs, 0))
- {
- /* If simple enough, just rewrite. Otherwise, make a SAVE_EXPR. */
- if (simple_operand_p (lhs))
- return build (TREE_CODE (exp) == TRUTH_ANDIF_EXPR
- ? TRUTH_AND_EXPR : TRUTH_OR_EXPR,
- TREE_TYPE (exp), TREE_OPERAND (exp, 0),
- TREE_OPERAND (exp, 1));
- else
- {
- tree common = save_expr (lhs);
-
- if (0 != (lhs = build_range_check (TREE_TYPE (exp), common,
- or_op ? ! in0_p : in0_p,
- low0, high0))
- && (0 != (rhs = build_range_check (TREE_TYPE (exp), common,
- or_op ? ! in1_p : in1_p,
- low1, high1))))
- return build (TREE_CODE (exp) == TRUTH_ANDIF_EXPR
- ? TRUTH_AND_EXPR : TRUTH_OR_EXPR,
- TREE_TYPE (exp), lhs, rhs);
- }
- }
- else
- return 0;
-}
-
-/* Subroutine for fold_truthop: C is an INTEGER_CST interpreted as a P
- bit value. Arrange things so the extra bits will be set to zero if and
- only if C is signed-extended to its full width. If MASK is nonzero,
- it is an INTEGER_CST that should be AND'ed with the extra bits. */
-
-static tree
-unextend (c, p, unsignedp, mask)
- tree c;
- int p;
- int unsignedp;
- tree mask;
-{
- tree type = TREE_TYPE (c);
- int modesize = GET_MODE_BITSIZE (TYPE_MODE (type));
- tree temp;
-
- if (p == modesize || unsignedp)
- return c;
-
- /* We work by getting just the sign bit into the low-order bit, then
- into the high-order bit, then sign-extend. We then XOR that value
- with C. */
- temp = const_binop (RSHIFT_EXPR, c, size_int (p - 1), 0);
- temp = const_binop (BIT_AND_EXPR, temp, size_int (1), 0);
-
- /* We must use a signed type in order to get an arithmetic right shift.
- However, we must also avoid introducing accidental overflows, so that
- a subsequent call to integer_zerop will work. Hence we must
- do the type conversion here. At this point, the constant is either
- zero or one, and the conversion to a signed type can never overflow.
- We could get an overflow if this conversion is done anywhere else. */
- if (TREE_UNSIGNED (type))
- temp = convert (signed_type (type), temp);
-
- temp = const_binop (LSHIFT_EXPR, temp, size_int (modesize - 1), 0);
- temp = const_binop (RSHIFT_EXPR, temp, size_int (modesize - p - 1), 0);
- if (mask != 0)
- temp = const_binop (BIT_AND_EXPR, temp, convert (TREE_TYPE (c), mask), 0);
- /* If necessary, convert the type back to match the type of C. */
- if (TREE_UNSIGNED (type))
- temp = convert (type, temp);
-
- return convert (type, const_binop (BIT_XOR_EXPR, c, temp, 0));
-}
-
-/* Find ways of folding logical expressions of LHS and RHS:
- Try to merge two comparisons to the same innermost item.
- Look for range tests like "ch >= '0' && ch <= '9'".
- Look for combinations of simple terms on machines with expensive branches
- and evaluate the RHS unconditionally.
-
- For example, if we have p->a == 2 && p->b == 4 and we can make an
- object large enough to span both A and B, we can do this with a comparison
- against the object ANDed with the a mask.
-
- If we have p->a == q->a && p->b == q->b, we may be able to use bit masking
- operations to do this with one comparison.
-
- We check for both normal comparisons and the BIT_AND_EXPRs made this by
- function and the one above.
-
- CODE is the logical operation being done. It can be TRUTH_ANDIF_EXPR,
- TRUTH_AND_EXPR, TRUTH_ORIF_EXPR, or TRUTH_OR_EXPR.
-
- TRUTH_TYPE is the type of the logical operand and LHS and RHS are its
- two operands.
-
- We return the simplified tree or 0 if no optimization is possible. */
-
-static tree
-fold_truthop (code, truth_type, lhs, rhs)
- enum tree_code code;
- tree truth_type, lhs, rhs;
-{
- /* If this is the "or" of two comparisons, we can do something if we
- the comparisons are NE_EXPR. If this is the "and", we can do something
- if the comparisons are EQ_EXPR. I.e.,
- (a->b == 2 && a->c == 4) can become (a->new == NEW).
-
- WANTED_CODE is this operation code. For single bit fields, we can
- convert EQ_EXPR to NE_EXPR so we need not reject the "wrong"
- comparison for one-bit fields. */
-
- enum tree_code wanted_code;
- enum tree_code lcode, rcode;
- tree ll_arg, lr_arg, rl_arg, rr_arg;
- tree ll_inner, lr_inner, rl_inner, rr_inner;
- int ll_bitsize, ll_bitpos, lr_bitsize, lr_bitpos;
- int rl_bitsize, rl_bitpos, rr_bitsize, rr_bitpos;
- int xll_bitpos, xlr_bitpos, xrl_bitpos, xrr_bitpos;
- int lnbitsize, lnbitpos, rnbitsize, rnbitpos;
- int ll_unsignedp, lr_unsignedp, rl_unsignedp, rr_unsignedp;
- enum machine_mode ll_mode, lr_mode, rl_mode, rr_mode;
- enum machine_mode lnmode, rnmode;
- tree ll_mask, lr_mask, rl_mask, rr_mask;
- tree ll_and_mask, lr_and_mask, rl_and_mask, rr_and_mask;
- tree l_const, r_const;
- tree type, result;
- int first_bit, end_bit;
- int volatilep;
-
- /* Start by getting the comparison codes. Fail if anything is volatile.
- If one operand is a BIT_AND_EXPR with the constant one, treat it as if
- it were surrounded with a NE_EXPR. */
-
- if (TREE_SIDE_EFFECTS (lhs) || TREE_SIDE_EFFECTS (rhs))
- return 0;
-
- lcode = TREE_CODE (lhs);
- rcode = TREE_CODE (rhs);
-
- if (lcode == BIT_AND_EXPR && integer_onep (TREE_OPERAND (lhs, 1)))
- lcode = NE_EXPR, lhs = build (NE_EXPR, truth_type, lhs, integer_zero_node);
-
- if (rcode == BIT_AND_EXPR && integer_onep (TREE_OPERAND (rhs, 1)))
- rcode = NE_EXPR, rhs = build (NE_EXPR, truth_type, rhs, integer_zero_node);
-
- if (TREE_CODE_CLASS (lcode) != '<' || TREE_CODE_CLASS (rcode) != '<')
- return 0;
-
- code = ((code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR)
- ? TRUTH_AND_EXPR : TRUTH_OR_EXPR);
-
- ll_arg = TREE_OPERAND (lhs, 0);
- lr_arg = TREE_OPERAND (lhs, 1);
- rl_arg = TREE_OPERAND (rhs, 0);
- rr_arg = TREE_OPERAND (rhs, 1);
-
- /* If the RHS can be evaluated unconditionally and its operands are
- simple, it wins to evaluate the RHS unconditionally on machines
- with expensive branches. In this case, this isn't a comparison
- that can be merged. */
-
- /* @@ I'm not sure it wins on the m88110 to do this if the comparisons
- are with zero (tmw). */
-
- if (BRANCH_COST >= 2
- && INTEGRAL_TYPE_P (TREE_TYPE (rhs))
- && simple_operand_p (rl_arg)
- && simple_operand_p (rr_arg))
- return build (code, truth_type, lhs, rhs);
-
- /* See if the comparisons can be merged. Then get all the parameters for
- each side. */
-
- if ((lcode != EQ_EXPR && lcode != NE_EXPR)
- || (rcode != EQ_EXPR && rcode != NE_EXPR))
- return 0;
-
- volatilep = 0;
- ll_inner = decode_field_reference (ll_arg,
- &ll_bitsize, &ll_bitpos, &ll_mode,
- &ll_unsignedp, &volatilep, &ll_mask,
- &ll_and_mask);
- lr_inner = decode_field_reference (lr_arg,
- &lr_bitsize, &lr_bitpos, &lr_mode,
- &lr_unsignedp, &volatilep, &lr_mask,
- &lr_and_mask);
- rl_inner = decode_field_reference (rl_arg,
- &rl_bitsize, &rl_bitpos, &rl_mode,
- &rl_unsignedp, &volatilep, &rl_mask,
- &rl_and_mask);
- rr_inner = decode_field_reference (rr_arg,
- &rr_bitsize, &rr_bitpos, &rr_mode,
- &rr_unsignedp, &volatilep, &rr_mask,
- &rr_and_mask);
-
- /* It must be true that the inner operation on the lhs of each
- comparison must be the same if we are to be able to do anything.
- Then see if we have constants. If not, the same must be true for
- the rhs's. */
- if (volatilep || ll_inner == 0 || rl_inner == 0
- || ! operand_equal_p (ll_inner, rl_inner, 0))
- return 0;
-
- if (TREE_CODE (lr_arg) == INTEGER_CST
- && TREE_CODE (rr_arg) == INTEGER_CST)
- l_const = lr_arg, r_const = rr_arg;
- else if (lr_inner == 0 || rr_inner == 0
- || ! operand_equal_p (lr_inner, rr_inner, 0))
- return 0;
- else
- l_const = r_const = 0;
-
- /* If either comparison code is not correct for our logical operation,
- fail. However, we can convert a one-bit comparison against zero into
- the opposite comparison against that bit being set in the field. */
-
- wanted_code = (code == TRUTH_AND_EXPR ? EQ_EXPR : NE_EXPR);
- if (lcode != wanted_code)
- {
- if (l_const && integer_zerop (l_const) && integer_pow2p (ll_mask))
- l_const = ll_mask;
- else
- return 0;
- }
-
- if (rcode != wanted_code)
- {
- if (r_const && integer_zerop (r_const) && integer_pow2p (rl_mask))
- r_const = rl_mask;
- else
- return 0;
- }
-
- /* See if we can find a mode that contains both fields being compared on
- the left. If we can't, fail. Otherwise, update all constants and masks
- to be relative to a field of that size. */
- first_bit = MIN (ll_bitpos, rl_bitpos);
- end_bit = MAX (ll_bitpos + ll_bitsize, rl_bitpos + rl_bitsize);
- lnmode = get_best_mode (end_bit - first_bit, first_bit,
- TYPE_ALIGN (TREE_TYPE (ll_inner)), word_mode,
- volatilep);
- if (lnmode == VOIDmode)
- return 0;
-
- lnbitsize = GET_MODE_BITSIZE (lnmode);
- lnbitpos = first_bit & ~ (lnbitsize - 1);
- type = type_for_size (lnbitsize, 1);
- xll_bitpos = ll_bitpos - lnbitpos, xrl_bitpos = rl_bitpos - lnbitpos;
-
- if (BYTES_BIG_ENDIAN)
- {
- xll_bitpos = lnbitsize - xll_bitpos - ll_bitsize;
- xrl_bitpos = lnbitsize - xrl_bitpos - rl_bitsize;
- }
-
- ll_mask = const_binop (LSHIFT_EXPR, convert (type, ll_mask),
- size_int (xll_bitpos), 0);
- rl_mask = const_binop (LSHIFT_EXPR, convert (type, rl_mask),
- size_int (xrl_bitpos), 0);
-
- if (l_const)
- {
- l_const = convert (type, l_const);
- l_const = unextend (l_const, ll_bitsize, ll_unsignedp, ll_and_mask);
- l_const = const_binop (LSHIFT_EXPR, l_const, size_int (xll_bitpos), 0);
- if (! integer_zerop (const_binop (BIT_AND_EXPR, l_const,
- fold (build1 (BIT_NOT_EXPR,
- type, ll_mask)),
- 0)))
- {
- warning ("comparison is always %s",
- wanted_code == NE_EXPR ? "one" : "zero");
-
- return convert (truth_type,
- wanted_code == NE_EXPR
- ? integer_one_node : integer_zero_node);
- }
- }
- if (r_const)
- {
- r_const = convert (type, r_const);
- r_const = unextend (r_const, rl_bitsize, rl_unsignedp, rl_and_mask);
- r_const = const_binop (LSHIFT_EXPR, r_const, size_int (xrl_bitpos), 0);
- if (! integer_zerop (const_binop (BIT_AND_EXPR, r_const,
- fold (build1 (BIT_NOT_EXPR,
- type, rl_mask)),
- 0)))
- {
- warning ("comparison is always %s",
- wanted_code == NE_EXPR ? "one" : "zero");
-
- return convert (truth_type,
- wanted_code == NE_EXPR
- ? integer_one_node : integer_zero_node);
- }
- }
-
- /* If the right sides are not constant, do the same for it. Also,
- disallow this optimization if a size or signedness mismatch occurs
- between the left and right sides. */
- if (l_const == 0)
- {
- if (ll_bitsize != lr_bitsize || rl_bitsize != rr_bitsize
- || ll_unsignedp != lr_unsignedp || rl_unsignedp != rr_unsignedp
- /* Make sure the two fields on the right
- correspond to the left without being swapped. */
- || ll_bitpos - rl_bitpos != lr_bitpos - rr_bitpos)
- return 0;
-
- first_bit = MIN (lr_bitpos, rr_bitpos);
- end_bit = MAX (lr_bitpos + lr_bitsize, rr_bitpos + rr_bitsize);
- rnmode = get_best_mode (end_bit - first_bit, first_bit,
- TYPE_ALIGN (TREE_TYPE (lr_inner)), word_mode,
- volatilep);
- if (rnmode == VOIDmode)
- return 0;
-
- rnbitsize = GET_MODE_BITSIZE (rnmode);
- rnbitpos = first_bit & ~ (rnbitsize - 1);
- xlr_bitpos = lr_bitpos - rnbitpos, xrr_bitpos = rr_bitpos - rnbitpos;
-
- if (BYTES_BIG_ENDIAN)
- {
- xlr_bitpos = rnbitsize - xlr_bitpos - lr_bitsize;
- xrr_bitpos = rnbitsize - xrr_bitpos - rr_bitsize;
- }
-
- lr_mask = const_binop (LSHIFT_EXPR, convert (type, lr_mask),
- size_int (xlr_bitpos), 0);
- rr_mask = const_binop (LSHIFT_EXPR, convert (type, rr_mask),
- size_int (xrr_bitpos), 0);
-
- /* Make a mask that corresponds to both fields being compared.
- Do this for both items being compared. If the masks agree,
- we can do this by masking both and comparing the masked
- results. */
- ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask, 0);
- lr_mask = const_binop (BIT_IOR_EXPR, lr_mask, rr_mask, 0);
- if (operand_equal_p (ll_mask, lr_mask, 0) && lnbitsize == rnbitsize)
- {
- lhs = make_bit_field_ref (ll_inner, type, lnbitsize, lnbitpos,
- ll_unsignedp || rl_unsignedp);
- rhs = make_bit_field_ref (lr_inner, type, rnbitsize, rnbitpos,
- lr_unsignedp || rr_unsignedp);
- if (! all_ones_mask_p (ll_mask, lnbitsize))
- {
- lhs = build (BIT_AND_EXPR, type, lhs, ll_mask);
- rhs = build (BIT_AND_EXPR, type, rhs, ll_mask);
- }
- return build (wanted_code, truth_type, lhs, rhs);
- }
-
- /* There is still another way we can do something: If both pairs of
- fields being compared are adjacent, we may be able to make a wider
- field containing them both. */
- if ((ll_bitsize + ll_bitpos == rl_bitpos
- && lr_bitsize + lr_bitpos == rr_bitpos)
- || (ll_bitpos == rl_bitpos + rl_bitsize
- && lr_bitpos == rr_bitpos + rr_bitsize))
- return build (wanted_code, truth_type,
- make_bit_field_ref (ll_inner, type,
- ll_bitsize + rl_bitsize,
- MIN (ll_bitpos, rl_bitpos),
- ll_unsignedp),
- make_bit_field_ref (lr_inner, type,
- lr_bitsize + rr_bitsize,
- MIN (lr_bitpos, rr_bitpos),
- lr_unsignedp));
-
- return 0;
- }
-
- /* Handle the case of comparisons with constants. If there is something in
- common between the masks, those bits of the constants must be the same.
- If not, the condition is always false. Test for this to avoid generating
- incorrect code below. */
- result = const_binop (BIT_AND_EXPR, ll_mask, rl_mask, 0);
- if (! integer_zerop (result)
- && simple_cst_equal (const_binop (BIT_AND_EXPR, result, l_const, 0),
- const_binop (BIT_AND_EXPR, result, r_const, 0)) != 1)
- {
- if (wanted_code == NE_EXPR)
- {
- warning ("`or' of unmatched not-equal tests is always 1");
- return convert (truth_type, integer_one_node);
- }
- else
- {
- warning ("`and' of mutually exclusive equal-tests is always zero");
- return convert (truth_type, integer_zero_node);
- }
- }
-
- /* Construct the expression we will return. First get the component
- reference we will make. Unless the mask is all ones the width of
- that field, perform the mask operation. Then compare with the
- merged constant. */
- result = make_bit_field_ref (ll_inner, type, lnbitsize, lnbitpos,
- ll_unsignedp || rl_unsignedp);
-
- ll_mask = const_binop (BIT_IOR_EXPR, ll_mask, rl_mask, 0);
- if (! all_ones_mask_p (ll_mask, lnbitsize))
- result = build (BIT_AND_EXPR, type, result, ll_mask);
-
- return build (wanted_code, truth_type, result,
- const_binop (BIT_IOR_EXPR, l_const, r_const, 0));
-}
-
-/* If T contains a COMPOUND_EXPR which was inserted merely to evaluate
- S, a SAVE_EXPR, return the expression actually being evaluated. Note
- that we may sometimes modify the tree. */
-
-static tree
-strip_compound_expr (t, s)
- tree t;
- tree s;
-{
- tree type = TREE_TYPE (t);
- enum tree_code code = TREE_CODE (t);
-
- /* See if this is the COMPOUND_EXPR we want to eliminate. */
- if (code == COMPOUND_EXPR && TREE_CODE (TREE_OPERAND (t, 0)) == CONVERT_EXPR
- && TREE_OPERAND (TREE_OPERAND (t, 0), 0) == s)
- return TREE_OPERAND (t, 1);
-
- /* See if this is a COND_EXPR or a simple arithmetic operator. We
- don't bother handling any other types. */
- else if (code == COND_EXPR)
- {
- TREE_OPERAND (t, 0) = strip_compound_expr (TREE_OPERAND (t, 0), s);
- TREE_OPERAND (t, 1) = strip_compound_expr (TREE_OPERAND (t, 1), s);
- TREE_OPERAND (t, 2) = strip_compound_expr (TREE_OPERAND (t, 2), s);
- }
- else if (TREE_CODE_CLASS (code) == '1')
- TREE_OPERAND (t, 0) = strip_compound_expr (TREE_OPERAND (t, 0), s);
- else if (TREE_CODE_CLASS (code) == '<'
- || TREE_CODE_CLASS (code) == '2')
- {
- TREE_OPERAND (t, 0) = strip_compound_expr (TREE_OPERAND (t, 0), s);
- TREE_OPERAND (t, 1) = strip_compound_expr (TREE_OPERAND (t, 1), s);
- }
-
- return t;
-}
-
-/* Perform constant folding and related simplification of EXPR.
- The related simplifications include x*1 => x, x*0 => 0, etc.,
- and application of the associative law.
- NOP_EXPR conversions may be removed freely (as long as we
- are careful not to change the C type of the overall expression)
- We cannot simplify through a CONVERT_EXPR, FIX_EXPR or FLOAT_EXPR,
- but we can constant-fold them if they have constant operands. */
-
-tree
-fold (expr)
- tree expr;
-{
- register tree t = expr;
- tree t1 = NULL_TREE;
- tree tem;
- tree type = TREE_TYPE (expr);
- register tree arg0, arg1;
- register enum tree_code code = TREE_CODE (t);
- register int kind;
- int invert;
-
- /* WINS will be nonzero when the switch is done
- if all operands are constant. */
-
- int wins = 1;
-
- /* 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)
- return t;
-
- /* Return right away if already constant. */
- if (TREE_CONSTANT (t))
- {
- if (code == CONST_DECL)
- return DECL_INITIAL (t);
- return t;
- }
-
- kind = TREE_CODE_CLASS (code);
- if (code == NOP_EXPR || code == FLOAT_EXPR || code == CONVERT_EXPR)
- {
- tree subop;
-
- /* Special case for conversion ops that can have fixed point args. */
- arg0 = TREE_OPERAND (t, 0);
-
- /* Don't use STRIP_NOPS, because signedness of argument type matters. */
- if (arg0 != 0)
- STRIP_TYPE_NOPS (arg0);
-
- if (arg0 != 0 && TREE_CODE (arg0) == COMPLEX_CST)
- subop = TREE_REALPART (arg0);
- else
- subop = arg0;
-
- if (subop != 0 && TREE_CODE (subop) != INTEGER_CST
-#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- && TREE_CODE (subop) != REAL_CST
-#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
- )
- /* Note that TREE_CONSTANT isn't enough:
- static var addresses are constant but we can't
- do arithmetic on them. */
- wins = 0;
- }
- else if (kind == 'e' || kind == '<'
- || kind == '1' || kind == '2' || kind == 'r')
- {
- register int len = tree_code_length[(int) code];
- register int i;
- for (i = 0; i < len; i++)
- {
- tree op = TREE_OPERAND (t, i);
- tree subop;
-
- if (op == 0)
- continue; /* Valid for CALL_EXPR, at least. */
-
- if (kind == '<' || code == RSHIFT_EXPR)
- {
- /* Signedness matters here. Perhaps we can refine this
- later. */
- STRIP_TYPE_NOPS (op);
- }
- else
- {
- /* Strip any conversions that don't change the mode. */
- STRIP_NOPS (op);
- }
-
- if (TREE_CODE (op) == COMPLEX_CST)
- subop = TREE_REALPART (op);
- else
- subop = op;
-
- if (TREE_CODE (subop) != INTEGER_CST
-#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- && TREE_CODE (subop) != REAL_CST
-#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
- )
- /* Note that TREE_CONSTANT isn't enough:
- static var addresses are constant but we can't
- do arithmetic on them. */
- wins = 0;
-
- if (i == 0)
- arg0 = op;
- else if (i == 1)
- arg1 = op;
- }
- }
-
- /* If this is a commutative operation, and ARG0 is a constant, move it
- to ARG1 to reduce the number of tests below. */
- if ((code == PLUS_EXPR || code == MULT_EXPR || code == MIN_EXPR
- || code == MAX_EXPR || code == BIT_IOR_EXPR || code == BIT_XOR_EXPR
- || code == BIT_AND_EXPR)
- && (TREE_CODE (arg0) == INTEGER_CST || TREE_CODE (arg0) == REAL_CST))
- {
- tem = arg0; arg0 = arg1; arg1 = tem;
-
- tem = TREE_OPERAND (t, 0); TREE_OPERAND (t, 0) = TREE_OPERAND (t, 1);
- TREE_OPERAND (t, 1) = tem;
- }
-
- /* Now WINS is set as described above,
- ARG0 is the first operand of EXPR,
- and ARG1 is the second operand (if it has more than one operand).
-
- First check for cases where an arithmetic operation is applied to a
- compound, conditional, or comparison operation. Push the arithmetic
- operation inside the compound or conditional to see if any folding
- can then be done. Convert comparison to conditional for this purpose.
- The also optimizes non-constant cases that used to be done in
- expand_expr.
-
- Before we do that, see if this is a BIT_AND_EXPR or a BIT_OR_EXPR,
- one of the operands is a comparison and the other is a comparison, a
- BIT_AND_EXPR with the constant 1, or a truth value. In that case, the
- code below would make the expression more complex. Change it to a
- TRUTH_{AND,OR}_EXPR. Likewise, convert a similar NE_EXPR to
- TRUTH_XOR_EXPR and an EQ_EXPR to the inversion of a TRUTH_XOR_EXPR. */
-
- if ((code == BIT_AND_EXPR || code == BIT_IOR_EXPR
- || code == EQ_EXPR || code == NE_EXPR)
- && ((truth_value_p (TREE_CODE (arg0))
- && (truth_value_p (TREE_CODE (arg1))
- || (TREE_CODE (arg1) == BIT_AND_EXPR
- && integer_onep (TREE_OPERAND (arg1, 1)))))
- || (truth_value_p (TREE_CODE (arg1))
- && (truth_value_p (TREE_CODE (arg0))
- || (TREE_CODE (arg0) == BIT_AND_EXPR
- && integer_onep (TREE_OPERAND (arg0, 1)))))))
- {
- t = fold (build (code == BIT_AND_EXPR ? TRUTH_AND_EXPR
- : code == BIT_IOR_EXPR ? TRUTH_OR_EXPR
- : TRUTH_XOR_EXPR,
- type, arg0, arg1));
-
- if (code == EQ_EXPR)
- t = invert_truthvalue (t);
-
- return t;
- }
-
- if (TREE_CODE_CLASS (code) == '1')
- {
- if (TREE_CODE (arg0) == COMPOUND_EXPR)
- return build (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
- fold (build1 (code, type, TREE_OPERAND (arg0, 1))));
- else if (TREE_CODE (arg0) == COND_EXPR)
- {
- t = fold (build (COND_EXPR, type, TREE_OPERAND (arg0, 0),
- fold (build1 (code, type, TREE_OPERAND (arg0, 1))),
- fold (build1 (code, type, TREE_OPERAND (arg0, 2)))));
-
- /* If this was a conversion, and all we did was to move into
- inside the COND_EXPR, bring it back out. But leave it if
- it is a conversion from integer to integer and the
- result precision is no wider than a word since such a
- conversion is cheap and may be optimized away by combine,
- while it couldn't if it were outside the COND_EXPR. Then return
- so we don't get into an infinite recursion loop taking the
- conversion out and then back in. */
-
- if ((code == NOP_EXPR || code == CONVERT_EXPR
- || code == NON_LVALUE_EXPR)
- && TREE_CODE (t) == COND_EXPR
- && TREE_CODE (TREE_OPERAND (t, 1)) == code
- && TREE_CODE (TREE_OPERAND (t, 2)) == code
- && (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0))
- == TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 2), 0)))
- && ! (INTEGRAL_TYPE_P (TREE_TYPE (t))
- && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0)))
- && TYPE_PRECISION (TREE_TYPE (t)) <= BITS_PER_WORD))
- t = build1 (code, type,
- build (COND_EXPR,
- TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0)),
- TREE_OPERAND (t, 0),
- TREE_OPERAND (TREE_OPERAND (t, 1), 0),
- TREE_OPERAND (TREE_OPERAND (t, 2), 0)));
- return t;
- }
- else if (TREE_CODE_CLASS (TREE_CODE (arg0)) == '<')
- return fold (build (COND_EXPR, type, arg0,
- fold (build1 (code, type, integer_one_node)),
- fold (build1 (code, type, integer_zero_node))));
- }
- else if (TREE_CODE_CLASS (code) == '2'
- || TREE_CODE_CLASS (code) == '<')
- {
- if (TREE_CODE (arg1) == COMPOUND_EXPR)
- return build (COMPOUND_EXPR, type, TREE_OPERAND (arg1, 0),
- fold (build (code, type,
- arg0, TREE_OPERAND (arg1, 1))));
- else if (TREE_CODE (arg1) == COND_EXPR
- || (TREE_CODE_CLASS (TREE_CODE (arg1)) == '<'
- && TREE_CODE_CLASS (code) != '<'))
- {
- tree test, true_value, false_value;
-
- if (TREE_CODE (arg1) == COND_EXPR)
- {
- test = TREE_OPERAND (arg1, 0);
- true_value = TREE_OPERAND (arg1, 1);
- false_value = TREE_OPERAND (arg1, 2);
- }
- else
- {
- tree testtype = TREE_TYPE (arg1);
- test = arg1;
- true_value = convert (testtype, integer_one_node);
- false_value = convert (testtype, integer_zero_node);
- }
-
- /* If ARG0 is complex we want to make sure we only evaluate
- it once. Though this is only required if it is volatile, it
- might be more efficient even if it is not. However, if we
- succeed in folding one part to a constant, we do not need
- to make this SAVE_EXPR. Since we do this optimization
- primarily to see if we do end up with constant and this
- SAVE_EXPR interferes with later optimizations, suppressing
- it when we can is important. */
-
- if (TREE_CODE (arg0) != SAVE_EXPR
- && ((TREE_CODE (arg0) != VAR_DECL
- && TREE_CODE (arg0) != PARM_DECL)
- || TREE_SIDE_EFFECTS (arg0)))
- {
- tree lhs = fold (build (code, type, arg0, true_value));
- tree rhs = fold (build (code, type, arg0, false_value));
-
- if (TREE_CONSTANT (lhs) || TREE_CONSTANT (rhs))
- return fold (build (COND_EXPR, type, test, lhs, rhs));
-
- arg0 = save_expr (arg0);
- }
-
- test = fold (build (COND_EXPR, type, test,
- fold (build (code, type, arg0, true_value)),
- fold (build (code, type, arg0, false_value))));
- if (TREE_CODE (arg0) == SAVE_EXPR)
- return build (COMPOUND_EXPR, type,
- convert (void_type_node, arg0),
- strip_compound_expr (test, arg0));
- else
- return convert (type, test);
- }
-
- else if (TREE_CODE (arg0) == COMPOUND_EXPR)
- return build (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
- fold (build (code, type, TREE_OPERAND (arg0, 1), arg1)));
- else if (TREE_CODE (arg0) == COND_EXPR
- || (TREE_CODE_CLASS (TREE_CODE (arg0)) == '<'
- && TREE_CODE_CLASS (code) != '<'))
- {
- tree test, true_value, false_value;
-
- if (TREE_CODE (arg0) == COND_EXPR)
- {
- test = TREE_OPERAND (arg0, 0);
- true_value = TREE_OPERAND (arg0, 1);
- false_value = TREE_OPERAND (arg0, 2);
- }
- else
- {
- tree testtype = TREE_TYPE (arg0);
- test = arg0;
- true_value = convert (testtype, integer_one_node);
- false_value = convert (testtype, integer_zero_node);
- }
-
- if (TREE_CODE (arg1) != SAVE_EXPR
- && ((TREE_CODE (arg1) != VAR_DECL
- && TREE_CODE (arg1) != PARM_DECL)
- || TREE_SIDE_EFFECTS (arg1)))
- {
- tree lhs = fold (build (code, type, true_value, arg1));
- tree rhs = fold (build (code, type, false_value, arg1));
-
- if (TREE_CONSTANT (lhs) || TREE_CONSTANT (rhs)
- || TREE_CONSTANT (arg1))
- return fold (build (COND_EXPR, type, test, lhs, rhs));
-
- arg1 = save_expr (arg1);
- }
-
- test = fold (build (COND_EXPR, type, test,
- fold (build (code, type, true_value, arg1)),
- fold (build (code, type, false_value, arg1))));
- if (TREE_CODE (arg1) == SAVE_EXPR)
- return build (COMPOUND_EXPR, type,
- convert (void_type_node, arg1),
- strip_compound_expr (test, arg1));
- else
- return convert (type, test);
- }
- }
- else if (TREE_CODE_CLASS (code) == '<'
- && TREE_CODE (arg0) == COMPOUND_EXPR)
- return build (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
- fold (build (code, type, TREE_OPERAND (arg0, 1), arg1)));
- else if (TREE_CODE_CLASS (code) == '<'
- && TREE_CODE (arg1) == COMPOUND_EXPR)
- return build (COMPOUND_EXPR, type, TREE_OPERAND (arg1, 0),
- fold (build (code, type, arg0, TREE_OPERAND (arg1, 1))));
-
- switch (code)
- {
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- case COMPLEX_CST:
- case CONSTRUCTOR:
- return t;
-
- case CONST_DECL:
- return fold (DECL_INITIAL (t));
-
- case NOP_EXPR:
- case FLOAT_EXPR:
- case CONVERT_EXPR:
- case FIX_TRUNC_EXPR:
- /* Other kinds of FIX are not handled properly by fold_convert. */
-
- if (TREE_TYPE (TREE_OPERAND (t, 0)) == TREE_TYPE (t))
- return TREE_OPERAND (t, 0);
-
- /* Handle cases of two conversions in a row. */
- if (TREE_CODE (TREE_OPERAND (t, 0)) == NOP_EXPR
- || TREE_CODE (TREE_OPERAND (t, 0)) == CONVERT_EXPR)
- {
- tree inside_type = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 0), 0));
- tree inter_type = TREE_TYPE (TREE_OPERAND (t, 0));
- tree final_type = TREE_TYPE (t);
- int inside_int = INTEGRAL_TYPE_P (inside_type);
- int inside_ptr = POINTER_TYPE_P (inside_type);
- int inside_float = FLOAT_TYPE_P (inside_type);
- int inside_prec = TYPE_PRECISION (inside_type);
- int inside_unsignedp = TREE_UNSIGNED (inside_type);
- int inter_int = INTEGRAL_TYPE_P (inter_type);
- int inter_ptr = POINTER_TYPE_P (inter_type);
- int inter_float = FLOAT_TYPE_P (inter_type);
- int inter_prec = TYPE_PRECISION (inter_type);
- int inter_unsignedp = TREE_UNSIGNED (inter_type);
- int final_int = INTEGRAL_TYPE_P (final_type);
- int final_ptr = POINTER_TYPE_P (final_type);
- int final_float = FLOAT_TYPE_P (final_type);
- int final_prec = TYPE_PRECISION (final_type);
- int final_unsignedp = TREE_UNSIGNED (final_type);
-
- /* In addition to the cases of two conversions in a row
- handled below, if we are converting something to its own
- type via an object of identical or wider precision, neither
- conversion is needed. */
- if (inside_type == final_type
- && ((inter_int && final_int) || (inter_float && final_float))
- && inter_prec >= final_prec)
- return TREE_OPERAND (TREE_OPERAND (t, 0), 0);
-
- /* Likewise, if the intermediate and final types are either both
- float or both integer, we don't need the middle conversion if
- it is wider than the final type and doesn't change the signedness
- (for integers). Avoid this if the final type is a pointer
- since then we sometimes need the inner conversion. Likewise if
- the outer has a precision not equal to the size of its mode. */
- if ((((inter_int || inter_ptr) && (inside_int || inside_ptr))
- || (inter_float && inside_float))
- && inter_prec >= inside_prec
- && (inter_float || inter_unsignedp == inside_unsignedp)
- && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
- && TYPE_MODE (final_type) == TYPE_MODE (inter_type))
- && ! final_ptr)
- return convert (final_type, TREE_OPERAND (TREE_OPERAND (t, 0), 0));
-
- /* Two conversions in a row are not needed unless:
- - some conversion is floating-point (overstrict for now), or
- - the intermediate type is narrower than both initial and
- final, or
- - the intermediate type and innermost type differ in signedness,
- and the outermost type is wider than the intermediate, or
- - the initial type is a pointer type and the precisions of the
- intermediate and final types differ, or
- - the final type is a pointer type and the precisions of the
- initial and intermediate types differ. */
- if (! inside_float && ! inter_float && ! final_float
- && (inter_prec > inside_prec || inter_prec > final_prec)
- && ! (inside_int && inter_int
- && inter_unsignedp != inside_unsignedp
- && inter_prec < final_prec)
- && ((inter_unsignedp && inter_prec > inside_prec)
- == (final_unsignedp && final_prec > inter_prec))
- && ! (inside_ptr && inter_prec != final_prec)
- && ! (final_ptr && inside_prec != inter_prec)
- && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
- && TYPE_MODE (final_type) == TYPE_MODE (inter_type))
- && ! final_ptr)
- return convert (final_type, TREE_OPERAND (TREE_OPERAND (t, 0), 0));
- }
-
- if (TREE_CODE (TREE_OPERAND (t, 0)) == MODIFY_EXPR
- && TREE_CONSTANT (TREE_OPERAND (TREE_OPERAND (t, 0), 1))
- /* Detect assigning a bitfield. */
- && !(TREE_CODE (TREE_OPERAND (TREE_OPERAND (t, 0), 0)) == COMPONENT_REF
- && DECL_BIT_FIELD (TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (t, 0), 0), 1))))
- {
- /* Don't leave an assignment inside a conversion
- unless assigning a bitfield. */
- tree prev = TREE_OPERAND (t, 0);
- TREE_OPERAND (t, 0) = TREE_OPERAND (prev, 1);
- /* First do the assignment, then return converted constant. */
- t = build (COMPOUND_EXPR, TREE_TYPE (t), prev, fold (t));
- TREE_USED (t) = 1;
- return t;
- }
- if (!wins)
- {
- TREE_CONSTANT (t) = TREE_CONSTANT (arg0);
- return t;
- }
- return fold_convert (t, arg0);
-
-#if 0 /* This loses on &"foo"[0]. */
- case ARRAY_REF:
- {
- int i;
-
- /* Fold an expression like: "foo"[2] */
- if (TREE_CODE (arg0) == STRING_CST
- && TREE_CODE (arg1) == INTEGER_CST
- && !TREE_INT_CST_HIGH (arg1)
- && (i = TREE_INT_CST_LOW (arg1)) < TREE_STRING_LENGTH (arg0))
- {
- t = build_int_2 (TREE_STRING_POINTER (arg0)[i], 0);
- TREE_TYPE (t) = TREE_TYPE (TREE_TYPE (arg0));
- force_fit_type (t, 0);
- }
- }
- return t;
-#endif /* 0 */
-
- case COMPONENT_REF:
- if (TREE_CODE (arg0) == CONSTRUCTOR)
- {
- tree m = purpose_member (arg1, CONSTRUCTOR_ELTS (arg0));
- if (m)
- t = TREE_VALUE (m);
- }
- return t;
-
- case RANGE_EXPR:
- TREE_CONSTANT (t) = wins;
- return t;
-
- case NEGATE_EXPR:
- if (wins)
- {
- if (TREE_CODE (arg0) == INTEGER_CST)
- {
- HOST_WIDE_INT low, high;
- int overflow = neg_double (TREE_INT_CST_LOW (arg0),
- TREE_INT_CST_HIGH (arg0),
- &low, &high);
- t = build_int_2 (low, high);
- TREE_TYPE (t) = type;
- TREE_OVERFLOW (t)
- = (TREE_OVERFLOW (arg0)
- | force_fit_type (t, overflow && !TREE_UNSIGNED (type)));
- TREE_CONSTANT_OVERFLOW (t)
- = TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg0);
- }
- else if (TREE_CODE (arg0) == REAL_CST)
- t = build_real (type, REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
- }
- else if (TREE_CODE (arg0) == NEGATE_EXPR)
- return TREE_OPERAND (arg0, 0);
-
- /* Convert - (a - b) to (b - a) for non-floating-point. */
- else if (TREE_CODE (arg0) == MINUS_EXPR && ! FLOAT_TYPE_P (type))
- return build (MINUS_EXPR, type, TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg0, 0));
-
- return t;
-
- case ABS_EXPR:
- if (wins)
- {
- if (TREE_CODE (arg0) == INTEGER_CST)
- {
- if (! TREE_UNSIGNED (type)
- && TREE_INT_CST_HIGH (arg0) < 0)
- {
- HOST_WIDE_INT low, high;
- int overflow = neg_double (TREE_INT_CST_LOW (arg0),
- TREE_INT_CST_HIGH (arg0),
- &low, &high);
- t = build_int_2 (low, high);
- TREE_TYPE (t) = type;
- TREE_OVERFLOW (t)
- = (TREE_OVERFLOW (arg0)
- | force_fit_type (t, overflow));
- TREE_CONSTANT_OVERFLOW (t)
- = TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg0);
- }
- }
- else if (TREE_CODE (arg0) == REAL_CST)
- {
- if (REAL_VALUE_NEGATIVE (TREE_REAL_CST (arg0)))
- t = build_real (type,
- REAL_VALUE_NEGATE (TREE_REAL_CST (arg0)));
- }
- }
- else if (TREE_CODE (arg0) == ABS_EXPR || TREE_CODE (arg0) == NEGATE_EXPR)
- return build1 (ABS_EXPR, type, TREE_OPERAND (arg0, 0));
- return t;
-
- case CONJ_EXPR:
- if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE)
- return arg0;
- else if (TREE_CODE (arg0) == COMPLEX_EXPR)
- return build (COMPLEX_EXPR, TREE_TYPE (arg0),
- TREE_OPERAND (arg0, 0),
- fold (build1 (NEGATE_EXPR,
- TREE_TYPE (TREE_TYPE (arg0)),
- TREE_OPERAND (arg0, 1))));
- else if (TREE_CODE (arg0) == COMPLEX_CST)
- return build_complex (type, TREE_OPERAND (arg0, 0),
- fold (build1 (NEGATE_EXPR,
- TREE_TYPE (TREE_TYPE (arg0)),
- TREE_OPERAND (arg0, 1))));
- else if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
- return fold (build (TREE_CODE (arg0), type,
- fold (build1 (CONJ_EXPR, type,
- TREE_OPERAND (arg0, 0))),
- fold (build1 (CONJ_EXPR,
- type, TREE_OPERAND (arg0, 1)))));
- else if (TREE_CODE (arg0) == CONJ_EXPR)
- return TREE_OPERAND (arg0, 0);
- return t;
-
- case BIT_NOT_EXPR:
- if (wins)
- {
- t = build_int_2 (~ TREE_INT_CST_LOW (arg0),
- ~ TREE_INT_CST_HIGH (arg0));
- TREE_TYPE (t) = type;
- force_fit_type (t, 0);
- TREE_OVERFLOW (t) = TREE_OVERFLOW (arg0);
- TREE_CONSTANT_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (arg0);
- }
- else if (TREE_CODE (arg0) == BIT_NOT_EXPR)
- return TREE_OPERAND (arg0, 0);
- return t;
-
- case PLUS_EXPR:
- /* A + (-B) -> A - B */
- if (TREE_CODE (arg1) == NEGATE_EXPR)
- return fold (build (MINUS_EXPR, type, arg0, TREE_OPERAND (arg1, 0)));
- else if (! FLOAT_TYPE_P (type))
- {
- if (integer_zerop (arg1))
- return non_lvalue (convert (type, arg0));
-
- /* If we are adding two BIT_AND_EXPR's, both of which are and'ing
- with a constant, and the two constants have no bits in common,
- we should treat this as a BIT_IOR_EXPR since this may produce more
- simplifications. */
- if (TREE_CODE (arg0) == BIT_AND_EXPR
- && TREE_CODE (arg1) == BIT_AND_EXPR
- && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
- && TREE_CODE (TREE_OPERAND (arg1, 1)) == INTEGER_CST
- && integer_zerop (const_binop (BIT_AND_EXPR,
- TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg1, 1), 0)))
- {
- code = BIT_IOR_EXPR;
- goto bit_ior;
- }
-
- /* (A * C) + (B * C) -> (A+B) * C. Since we are most concerned
- about the case where C is a constant, just try one of the
- four possibilities. */
-
- if (TREE_CODE (arg0) == MULT_EXPR && TREE_CODE (arg1) == MULT_EXPR
- && operand_equal_p (TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg1, 1), 0))
- return fold (build (MULT_EXPR, type,
- fold (build (PLUS_EXPR, type,
- TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg1, 0))),
- TREE_OPERAND (arg0, 1)));
- }
- /* In IEEE floating point, x+0 may not equal x. */
- else if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || flag_fast_math)
- && real_zerop (arg1))
- return non_lvalue (convert (type, arg0));
- associate:
- /* In most languages, can't associate operations on floats
- through parentheses. Rather than remember where the parentheses
- were, we don't associate floats at all. It shouldn't matter much.
- However, associating multiplications is only very slightly
- inaccurate, so do that if -ffast-math is specified. */
- if (FLOAT_TYPE_P (type)
- && ! (flag_fast_math && code == MULT_EXPR))
- goto binary;
-
- /* The varsign == -1 cases happen only for addition and subtraction.
- It says that the arg that was split was really CON minus VAR.
- The rest of the code applies to all associative operations. */
- if (!wins)
- {
- tree var, con;
- int varsign;
-
- if (split_tree (arg0, code, &var, &con, &varsign))
- {
- if (varsign == -1)
- {
- /* EXPR is (CON-VAR) +- ARG1. */
- /* If it is + and VAR==ARG1, return just CONST. */
- if (code == PLUS_EXPR && operand_equal_p (var, arg1, 0))
- return convert (TREE_TYPE (t), con);
-
- /* If ARG0 is a constant, don't change things around;
- instead keep all the constant computations together. */
-
- if (TREE_CONSTANT (arg0))
- return t;
-
- /* Otherwise return (CON +- ARG1) - VAR. */
- t = build (MINUS_EXPR, type,
- fold (build (code, type, con, arg1)), var);
- }
- else
- {
- /* EXPR is (VAR+CON) +- ARG1. */
- /* If it is - and VAR==ARG1, return just CONST. */
- if (code == MINUS_EXPR && operand_equal_p (var, arg1, 0))
- return convert (TREE_TYPE (t), con);
-
- /* If ARG0 is a constant, don't change things around;
- instead keep all the constant computations together. */
-
- if (TREE_CONSTANT (arg0))
- return t;
-
- /* Otherwise return VAR +- (ARG1 +- CON). */
- tem = fold (build (code, type, arg1, con));
- t = build (code, type, var, tem);
-
- if (integer_zerop (tem)
- && (code == PLUS_EXPR || code == MINUS_EXPR))
- return convert (type, var);
- /* If we have x +/- (c - d) [c an explicit integer]
- change it to x -/+ (d - c) since if d is relocatable
- then the latter can be a single immediate insn
- and the former cannot. */
- if (TREE_CODE (tem) == MINUS_EXPR
- && TREE_CODE (TREE_OPERAND (tem, 0)) == INTEGER_CST)
- {
- tree tem1 = TREE_OPERAND (tem, 1);
- TREE_OPERAND (tem, 1) = TREE_OPERAND (tem, 0);
- TREE_OPERAND (tem, 0) = tem1;
- TREE_SET_CODE (t,
- (code == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR));
- }
- }
- return t;
- }
-
- if (split_tree (arg1, code, &var, &con, &varsign))
- {
- if (TREE_CONSTANT (arg1))
- return t;
-
- if (varsign == -1)
- TREE_SET_CODE (t,
- (code == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR));
-
- /* EXPR is ARG0 +- (CON +- VAR). */
- if (TREE_CODE (t) == MINUS_EXPR
- && operand_equal_p (var, arg0, 0))
- {
- /* If VAR and ARG0 cancel, return just CON or -CON. */
- if (code == PLUS_EXPR)
- return convert (TREE_TYPE (t), con);
- return fold (build1 (NEGATE_EXPR, TREE_TYPE (t),
- convert (TREE_TYPE (t), con)));
- }
-
- t = build (TREE_CODE (t), type,
- fold (build (code, TREE_TYPE (t), arg0, con)), var);
-
- if (integer_zerop (TREE_OPERAND (t, 0))
- && TREE_CODE (t) == PLUS_EXPR)
- return convert (TREE_TYPE (t), var);
- return t;
- }
- }
- binary:
-#if defined (REAL_IS_NOT_DOUBLE) && ! defined (REAL_ARITHMETIC)
- if (TREE_CODE (arg1) == REAL_CST)
- return t;
-#endif /* REAL_IS_NOT_DOUBLE, and no REAL_ARITHMETIC */
- if (wins)
- t1 = const_binop (code, arg0, arg1, 0);
- if (t1 != NULL_TREE)
- {
- /* The return value should always have
- the same type as the original expression. */
- if (TREE_TYPE (t1) != TREE_TYPE (t))
- t1 = convert (TREE_TYPE (t), t1);
-
- return t1;
- }
- return t;
-
- case MINUS_EXPR:
- if (! FLOAT_TYPE_P (type))
- {
- if (! wins && integer_zerop (arg0))
- return build1 (NEGATE_EXPR, type, arg1);
- if (integer_zerop (arg1))
- return non_lvalue (convert (type, arg0));
-
- /* (A * C) - (B * C) -> (A-B) * C. Since we are most concerned
- about the case where C is a constant, just try one of the
- four possibilities. */
-
- if (TREE_CODE (arg0) == MULT_EXPR && TREE_CODE (arg1) == MULT_EXPR
- && operand_equal_p (TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg1, 1), 0))
- return fold (build (MULT_EXPR, type,
- fold (build (MINUS_EXPR, type,
- TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg1, 0))),
- TREE_OPERAND (arg0, 1)));
- }
- /* Convert A - (-B) to A + B. */
- else if (TREE_CODE (arg1) == NEGATE_EXPR)
- return fold (build (PLUS_EXPR, type, arg0, TREE_OPERAND (arg1, 0)));
-
- else if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || flag_fast_math)
- {
- /* Except with IEEE floating point, 0-x equals -x. */
- if (! wins && real_zerop (arg0))
- return build1 (NEGATE_EXPR, type, arg1);
- /* Except with IEEE floating point, x-0 equals x. */
- if (real_zerop (arg1))
- return non_lvalue (convert (type, arg0));
- }
-
- /* Fold &x - &x. This can happen from &x.foo - &x.
- This is unsafe for certain floats even in non-IEEE formats.
- In IEEE, it is unsafe because it does wrong for NaNs.
- Also note that operand_equal_p is always false if an operand
- is volatile. */
-
- if ((! FLOAT_TYPE_P (type) || flag_fast_math)
- && operand_equal_p (arg0, arg1, 0))
- return convert (type, integer_zero_node);
-
- goto associate;
-
- case MULT_EXPR:
- if (! FLOAT_TYPE_P (type))
- {
- if (integer_zerop (arg1))
- return omit_one_operand (type, arg1, arg0);
- if (integer_onep (arg1))
- return non_lvalue (convert (type, arg0));
-
- /* ((A / C) * C) is A if the division is an
- EXACT_DIV_EXPR. Since C is normally a constant,
- just check for one of the four possibilities. */
-
- if (TREE_CODE (arg0) == EXACT_DIV_EXPR
- && operand_equal_p (TREE_OPERAND (arg0, 1), arg1, 0))
- return TREE_OPERAND (arg0, 0);
-
- /* (a * (1 << b)) is (a << b) */
- if (TREE_CODE (arg1) == LSHIFT_EXPR
- && integer_onep (TREE_OPERAND (arg1, 0)))
- return fold (build (LSHIFT_EXPR, type, arg0,
- TREE_OPERAND (arg1, 1)));
- if (TREE_CODE (arg0) == LSHIFT_EXPR
- && integer_onep (TREE_OPERAND (arg0, 0)))
- return fold (build (LSHIFT_EXPR, type, arg1,
- TREE_OPERAND (arg0, 1)));
- }
- else
- {
- /* x*0 is 0, except for IEEE floating point. */
- if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || flag_fast_math)
- && real_zerop (arg1))
- return omit_one_operand (type, arg1, arg0);
- /* In IEEE floating point, x*1 is not equivalent to x for snans.
- However, ANSI says we can drop signals,
- so we can do this anyway. */
- if (real_onep (arg1))
- return non_lvalue (convert (type, arg0));
- /* x*2 is x+x */
- if (! wins && real_twop (arg1))
- {
- tree arg = save_expr (arg0);
- return build (PLUS_EXPR, type, arg, arg);
- }
- }
- goto associate;
-
- case BIT_IOR_EXPR:
- bit_ior:
- {
- register enum tree_code code0, code1;
-
- if (integer_all_onesp (arg1))
- return omit_one_operand (type, arg1, arg0);
- if (integer_zerop (arg1))
- return non_lvalue (convert (type, arg0));
- t1 = distribute_bit_expr (code, type, arg0, arg1);
- if (t1 != NULL_TREE)
- return t1;
-
- /* (A << C1) | (A >> C2) if A is unsigned and C1+C2 is the size of A
- is a rotate of A by C1 bits. */
- /* (A << B) | (A >> (Z - B)) if A is unsigned and Z is the size of A
- is a rotate of A by B bits. */
-
- code0 = TREE_CODE (arg0);
- code1 = TREE_CODE (arg1);
- if (((code0 == RSHIFT_EXPR && code1 == LSHIFT_EXPR)
- || (code1 == RSHIFT_EXPR && code0 == LSHIFT_EXPR))
- && operand_equal_p (TREE_OPERAND (arg0, 0), TREE_OPERAND (arg1,0), 0)
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg0, 0))))
- {
- register tree tree01, tree11;
- register enum tree_code code01, code11;
-
- tree01 = TREE_OPERAND (arg0, 1);
- tree11 = TREE_OPERAND (arg1, 1);
- code01 = TREE_CODE (tree01);
- code11 = TREE_CODE (tree11);
- if (code01 == INTEGER_CST
- && code11 == INTEGER_CST
- && TREE_INT_CST_HIGH (tree01) == 0
- && TREE_INT_CST_HIGH (tree11) == 0
- && ((TREE_INT_CST_LOW (tree01) + TREE_INT_CST_LOW (tree11))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 0)))))
- return build (LROTATE_EXPR, type, TREE_OPERAND (arg0, 0),
- code0 == LSHIFT_EXPR ? tree01 : tree11);
- else if (code11 == MINUS_EXPR
- && TREE_CODE (TREE_OPERAND (tree11, 0)) == INTEGER_CST
- && TREE_INT_CST_HIGH (TREE_OPERAND (tree11, 0)) == 0
- && TREE_INT_CST_LOW (TREE_OPERAND (tree11, 0))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 0)))
- && operand_equal_p (tree01, TREE_OPERAND (tree11, 1), 0))
- return build (code0 == LSHIFT_EXPR ? LROTATE_EXPR : RROTATE_EXPR,
- type, TREE_OPERAND (arg0, 0), tree01);
- else if (code01 == MINUS_EXPR
- && TREE_CODE (TREE_OPERAND (tree01, 0)) == INTEGER_CST
- && TREE_INT_CST_HIGH (TREE_OPERAND (tree01, 0)) == 0
- && TREE_INT_CST_LOW (TREE_OPERAND (tree01, 0))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 0)))
- && operand_equal_p (tree11, TREE_OPERAND (tree01, 1), 0))
- return build (code0 != LSHIFT_EXPR ? LROTATE_EXPR : RROTATE_EXPR,
- type, TREE_OPERAND (arg0, 0), tree11);
- }
-
- goto associate;
- }
-
- case BIT_XOR_EXPR:
- if (integer_zerop (arg1))
- return non_lvalue (convert (type, arg0));
- if (integer_all_onesp (arg1))
- return fold (build1 (BIT_NOT_EXPR, type, arg0));
- goto associate;
-
- case BIT_AND_EXPR:
- bit_and:
- if (integer_all_onesp (arg1))
- return non_lvalue (convert (type, arg0));
- if (integer_zerop (arg1))
- return omit_one_operand (type, arg1, arg0);
- t1 = distribute_bit_expr (code, type, arg0, arg1);
- if (t1 != NULL_TREE)
- return t1;
- /* Simplify ((int)c & 0x377) into (int)c, if c is unsigned char. */
- if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == NOP_EXPR
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg1, 0))))
- {
- int prec = TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 0)));
- if (prec < BITS_PER_WORD && prec < HOST_BITS_PER_WIDE_INT
- && (~TREE_INT_CST_LOW (arg0)
- & (((HOST_WIDE_INT) 1 << prec) - 1)) == 0)
- return build1 (NOP_EXPR, type, TREE_OPERAND (arg1, 0));
- }
- if (TREE_CODE (arg1) == INTEGER_CST && TREE_CODE (arg0) == NOP_EXPR
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg0, 0))))
- {
- int prec = TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 0)));
- if (prec < BITS_PER_WORD && prec < HOST_BITS_PER_WIDE_INT
- && (~TREE_INT_CST_LOW (arg1)
- & (((HOST_WIDE_INT) 1 << prec) - 1)) == 0)
- return build1 (NOP_EXPR, type, TREE_OPERAND (arg0, 0));
- }
- goto associate;
-
- case BIT_ANDTC_EXPR:
- if (integer_all_onesp (arg0))
- return non_lvalue (convert (type, arg1));
- if (integer_zerop (arg0))
- return omit_one_operand (type, arg0, arg1);
- if (TREE_CODE (arg1) == INTEGER_CST)
- {
- arg1 = fold (build1 (BIT_NOT_EXPR, type, arg1));
- code = BIT_AND_EXPR;
- goto bit_and;
- }
- goto binary;
-
- case RDIV_EXPR:
- /* In most cases, do nothing with a divide by zero. */
-#if !defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
-#ifndef REAL_INFINITY
- if (TREE_CODE (arg1) == REAL_CST && real_zerop (arg1))
- return t;
-#endif
-#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
-
- /* In IEEE floating point, x/1 is not equivalent to x for snans.
- However, ANSI says we can drop signals, so we can do this anyway. */
- if (real_onep (arg1))
- return non_lvalue (convert (type, arg0));
-
- /* If ARG1 is a constant, we can convert this to a multiply by the
- reciprocal. This does not have the same rounding properties,
- so only do this if -ffast-math. We can actually always safely
- do it if ARG1 is a power of two, but it's hard to tell if it is
- or not in a portable manner. */
- if (TREE_CODE (arg1) == REAL_CST)
- {
- if (flag_fast_math
- && 0 != (tem = const_binop (code, build_real (type, dconst1),
- arg1, 0)))
- return fold (build (MULT_EXPR, type, arg0, tem));
- /* Find the reciprocal if optimizing and the result is exact. */
- else if (optimize)
- {
- REAL_VALUE_TYPE r;
- r = TREE_REAL_CST (arg1);
- if (exact_real_inverse (TYPE_MODE(TREE_TYPE(arg0)), &r))
- {
- tem = build_real (type, r);
- return fold (build (MULT_EXPR, type, arg0, tem));
- }
- }
- }
- goto binary;
-
- case TRUNC_DIV_EXPR:
- case ROUND_DIV_EXPR:
- case FLOOR_DIV_EXPR:
- case CEIL_DIV_EXPR:
- case EXACT_DIV_EXPR:
- if (integer_onep (arg1))
- return non_lvalue (convert (type, arg0));
- if (integer_zerop (arg1))
- return t;
-
- /* If we have ((a / C1) / C2) where both division are the same type, try
- to simplify. First see if C1 * C2 overflows or not. */
- if (TREE_CODE (arg0) == code && TREE_CODE (arg1) == INTEGER_CST
- && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
- {
- tree new_divisor;
-
- new_divisor = const_binop (MULT_EXPR, TREE_OPERAND (arg0, 1), arg1, 0);
- tem = const_binop (FLOOR_DIV_EXPR, new_divisor, arg1, 0);
-
- if (TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)) == TREE_INT_CST_LOW (tem)
- && TREE_INT_CST_HIGH (TREE_OPERAND (arg0, 1)) == TREE_INT_CST_HIGH (tem))
- {
- /* If no overflow, divide by C1*C2. */
- return fold (build (code, type, TREE_OPERAND (arg0, 0), new_divisor));
- }
- }
-
- /* Look for ((a * C1) / C3) or (((a * C1) + C2) / C3),
- where C1 % C3 == 0 or C3 % C1 == 0. We can simplify these
- expressions, which often appear in the offsets or sizes of
- objects with a varying size. Only deal with positive divisors
- and multiplicands. If C2 is negative, we must have C2 % C3 == 0.
-
- Look for NOPs and SAVE_EXPRs inside. */
-
- if (TREE_CODE (arg1) == INTEGER_CST
- && tree_int_cst_sgn (arg1) >= 0)
- {
- int have_save_expr = 0;
- tree c2 = integer_zero_node;
- tree xarg0 = arg0;
-
- if (TREE_CODE (xarg0) == SAVE_EXPR && SAVE_EXPR_RTL (xarg0) == 0)
- have_save_expr = 1, xarg0 = TREE_OPERAND (xarg0, 0);
-
- STRIP_NOPS (xarg0);
-
- if (TREE_CODE (xarg0) == PLUS_EXPR
- && TREE_CODE (TREE_OPERAND (xarg0, 1)) == INTEGER_CST)
- c2 = TREE_OPERAND (xarg0, 1), xarg0 = TREE_OPERAND (xarg0, 0);
- else if (TREE_CODE (xarg0) == MINUS_EXPR
- && TREE_CODE (TREE_OPERAND (xarg0, 1)) == INTEGER_CST
- /* If we are doing this computation unsigned, the negate
- is incorrect. */
- && ! TREE_UNSIGNED (type))
- {
- c2 = fold (build1 (NEGATE_EXPR, type, TREE_OPERAND (xarg0, 1)));
- xarg0 = TREE_OPERAND (xarg0, 0);
- }
-
- if (TREE_CODE (xarg0) == SAVE_EXPR && SAVE_EXPR_RTL (xarg0) == 0)
- have_save_expr = 1, xarg0 = TREE_OPERAND (xarg0, 0);
-
- STRIP_NOPS (xarg0);
-
- if (TREE_CODE (xarg0) == MULT_EXPR
- && TREE_CODE (TREE_OPERAND (xarg0, 1)) == INTEGER_CST
- && tree_int_cst_sgn (TREE_OPERAND (xarg0, 1)) >= 0
- && (integer_zerop (const_binop (TRUNC_MOD_EXPR,
- TREE_OPERAND (xarg0, 1), arg1, 1))
- || integer_zerop (const_binop (TRUNC_MOD_EXPR, arg1,
- TREE_OPERAND (xarg0, 1), 1)))
- && (tree_int_cst_sgn (c2) >= 0
- || integer_zerop (const_binop (TRUNC_MOD_EXPR, c2,
- arg1, 1))))
- {
- tree outer_div = integer_one_node;
- tree c1 = TREE_OPERAND (xarg0, 1);
- tree c3 = arg1;
-
- /* If C3 > C1, set them equal and do a divide by
- C3/C1 at the end of the operation. */
- if (tree_int_cst_lt (c1, c3))
- outer_div = const_binop (code, c3, c1, 0), c3 = c1;
-
- /* The result is A * (C1/C3) + (C2/C3). */
- t = fold (build (PLUS_EXPR, type,
- fold (build (MULT_EXPR, type,
- TREE_OPERAND (xarg0, 0),
- const_binop (code, c1, c3, 1))),
- const_binop (code, c2, c3, 1)));
-
- if (! integer_onep (outer_div))
- t = fold (build (code, type, t, convert (type, outer_div)));
-
- if (have_save_expr)
- t = save_expr (t);
-
- return t;
- }
- }
-
- goto binary;
-
- case CEIL_MOD_EXPR:
- case FLOOR_MOD_EXPR:
- case ROUND_MOD_EXPR:
- case TRUNC_MOD_EXPR:
- if (integer_onep (arg1))
- return omit_one_operand (type, integer_zero_node, arg0);
- if (integer_zerop (arg1))
- return t;
-
- /* Look for ((a * C1) % C3) or (((a * C1) + C2) % C3),
- where C1 % C3 == 0. Handle similarly to the division case,
- but don't bother with SAVE_EXPRs. */
-
- if (TREE_CODE (arg1) == INTEGER_CST
- && ! integer_zerop (arg1))
- {
- tree c2 = integer_zero_node;
- tree xarg0 = arg0;
-
- if (TREE_CODE (xarg0) == PLUS_EXPR
- && TREE_CODE (TREE_OPERAND (xarg0, 1)) == INTEGER_CST)
- c2 = TREE_OPERAND (xarg0, 1), xarg0 = TREE_OPERAND (xarg0, 0);
- else if (TREE_CODE (xarg0) == MINUS_EXPR
- && TREE_CODE (TREE_OPERAND (xarg0, 1)) == INTEGER_CST
- && ! TREE_UNSIGNED (type))
- {
- c2 = fold (build1 (NEGATE_EXPR, type, TREE_OPERAND (xarg0, 1)));
- xarg0 = TREE_OPERAND (xarg0, 0);
- }
-
- STRIP_NOPS (xarg0);
-
- if (TREE_CODE (xarg0) == MULT_EXPR
- && TREE_CODE (TREE_OPERAND (xarg0, 1)) == INTEGER_CST
- && integer_zerop (const_binop (TRUNC_MOD_EXPR,
- TREE_OPERAND (xarg0, 1),
- arg1, 1))
- && tree_int_cst_sgn (c2) >= 0)
- /* The result is (C2%C3). */
- return omit_one_operand (type, const_binop (code, c2, arg1, 1),
- TREE_OPERAND (xarg0, 0));
- }
-
- goto binary;
-
- case LSHIFT_EXPR:
- case RSHIFT_EXPR:
- case LROTATE_EXPR:
- case RROTATE_EXPR:
- if (integer_zerop (arg1))
- return non_lvalue (convert (type, arg0));
- /* Since negative shift count is not well-defined,
- don't try to compute it in the compiler. */
- if (TREE_CODE (arg1) == INTEGER_CST && tree_int_cst_sgn (arg1) < 0)
- return t;
- /* Rewrite an LROTATE_EXPR by a constant into an
- RROTATE_EXPR by a new constant. */
- if (code == LROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST)
- {
- TREE_SET_CODE (t, RROTATE_EXPR);
- code = RROTATE_EXPR;
- TREE_OPERAND (t, 1) = arg1
- = const_binop
- (MINUS_EXPR,
- convert (TREE_TYPE (arg1),
- build_int_2 (GET_MODE_BITSIZE (TYPE_MODE (type)), 0)),
- arg1, 0);
- if (tree_int_cst_sgn (arg1) < 0)
- return t;
- }
-
- /* If we have a rotate of a bit operation with the rotate count and
- the second operand of the bit operation both constant,
- permute the two operations. */
- if (code == RROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST
- && (TREE_CODE (arg0) == BIT_AND_EXPR
- || TREE_CODE (arg0) == BIT_ANDTC_EXPR
- || TREE_CODE (arg0) == BIT_IOR_EXPR
- || TREE_CODE (arg0) == BIT_XOR_EXPR)
- && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
- return fold (build (TREE_CODE (arg0), type,
- fold (build (code, type,
- TREE_OPERAND (arg0, 0), arg1)),
- fold (build (code, type,
- TREE_OPERAND (arg0, 1), arg1))));
-
- /* Two consecutive rotates adding up to the width of the mode can
- be ignored. */
- if (code == RROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST
- && TREE_CODE (arg0) == RROTATE_EXPR
- && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
- && TREE_INT_CST_HIGH (arg1) == 0
- && TREE_INT_CST_HIGH (TREE_OPERAND (arg0, 1)) == 0
- && ((TREE_INT_CST_LOW (arg1)
- + TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)))
- == GET_MODE_BITSIZE (TYPE_MODE (type))))
- return TREE_OPERAND (arg0, 0);
-
- goto binary;
-
- case MIN_EXPR:
- if (operand_equal_p (arg0, arg1, 0))
- return arg0;
- if (INTEGRAL_TYPE_P (type)
- && operand_equal_p (arg1, TYPE_MIN_VALUE (type), 1))
- return omit_one_operand (type, arg1, arg0);
- goto associate;
-
- case MAX_EXPR:
- if (operand_equal_p (arg0, arg1, 0))
- return arg0;
- if (INTEGRAL_TYPE_P (type)
- && operand_equal_p (arg1, TYPE_MAX_VALUE (type), 1))
- return omit_one_operand (type, arg1, arg0);
- goto associate;
-
- case TRUTH_NOT_EXPR:
- /* Note that the operand of this must be an int
- and its values must be 0 or 1.
- ("true" is a fixed value perhaps depending on the language,
- but we don't handle values other than 1 correctly yet.) */
- tem = invert_truthvalue (arg0);
- /* Avoid infinite recursion. */
- if (TREE_CODE (tem) == TRUTH_NOT_EXPR)
- return t;
- return convert (type, tem);
-
- case TRUTH_ANDIF_EXPR:
- /* Note that the operands of this must be ints
- and their values must be 0 or 1.
- ("true" is a fixed value perhaps depending on the language.) */
- /* If first arg is constant zero, return it. */
- if (integer_zerop (arg0))
- return arg0;
- case TRUTH_AND_EXPR:
- /* If either arg is constant true, drop it. */
- if (TREE_CODE (arg0) == INTEGER_CST && ! integer_zerop (arg0))
- return non_lvalue (arg1);
- if (TREE_CODE (arg1) == INTEGER_CST && ! integer_zerop (arg1))
- return non_lvalue (arg0);
- /* If second arg is constant zero, result is zero, but first arg
- must be evaluated. */
- if (integer_zerop (arg1))
- return omit_one_operand (type, arg1, arg0);
- /* Likewise for first arg, but note that only the TRUTH_AND_EXPR
- case will be handled here. */
- if (integer_zerop (arg0))
- return omit_one_operand (type, arg0, arg1);
-
- truth_andor:
- /* We only do these simplifications if we are optimizing. */
- if (!optimize)
- return t;
-
- /* Check for things like (A || B) && (A || C). We can convert this
- to A || (B && C). Note that either operator can be any of the four
- truth and/or operations and the transformation will still be
- valid. Also note that we only care about order for the
- ANDIF and ORIF operators. */
- if (TREE_CODE (arg0) == TREE_CODE (arg1)
- && (TREE_CODE (arg0) == TRUTH_ANDIF_EXPR
- || TREE_CODE (arg0) == TRUTH_ORIF_EXPR
- || TREE_CODE (arg0) == TRUTH_AND_EXPR
- || TREE_CODE (arg0) == TRUTH_OR_EXPR))
- {
- tree a00 = TREE_OPERAND (arg0, 0);
- tree a01 = TREE_OPERAND (arg0, 1);
- tree a10 = TREE_OPERAND (arg1, 0);
- tree a11 = TREE_OPERAND (arg1, 1);
- int commutative = ((TREE_CODE (arg0) == TRUTH_OR_EXPR
- || TREE_CODE (arg0) == TRUTH_AND_EXPR)
- && (code == TRUTH_AND_EXPR
- || code == TRUTH_OR_EXPR));
-
- if (operand_equal_p (a00, a10, 0))
- return fold (build (TREE_CODE (arg0), type, a00,
- fold (build (code, type, a01, a11))));
- else if (commutative && operand_equal_p (a00, a11, 0))
- return fold (build (TREE_CODE (arg0), type, a00,
- fold (build (code, type, a01, a10))));
- else if (commutative && operand_equal_p (a01, a10, 0))
- return fold (build (TREE_CODE (arg0), type, a01,
- fold (build (code, type, a00, a11))));
-
- /* This case if tricky because we must either have commutative
- operators or else A10 must not have side-effects. */
-
- else if ((commutative || ! TREE_SIDE_EFFECTS (a10))
- && operand_equal_p (a01, a11, 0))
- return fold (build (TREE_CODE (arg0), type,
- fold (build (code, type, a00, a10)),
- a01));
- }
-
- /* See if we can build a range comparison. */
- if (0 != (tem = fold_range_test (t)))
- return tem;
-
- /* Check for the possibility of merging component references. If our
- lhs is another similar operation, try to merge its rhs with our
- rhs. Then try to merge our lhs and rhs. */
- if (TREE_CODE (arg0) == code
- && 0 != (tem = fold_truthop (code, type,
- TREE_OPERAND (arg0, 1), arg1)))
- return fold (build (code, type, TREE_OPERAND (arg0, 0), tem));
-
- if ((tem = fold_truthop (code, type, arg0, arg1)) != 0)
- return tem;
-
- return t;
-
- case TRUTH_ORIF_EXPR:
- /* Note that the operands of this must be ints
- and their values must be 0 or true.
- ("true" is a fixed value perhaps depending on the language.) */
- /* If first arg is constant true, return it. */
- if (TREE_CODE (arg0) == INTEGER_CST && ! integer_zerop (arg0))
- return arg0;
- case TRUTH_OR_EXPR:
- /* If either arg is constant zero, drop it. */
- if (TREE_CODE (arg0) == INTEGER_CST && integer_zerop (arg0))
- return non_lvalue (arg1);
- if (TREE_CODE (arg1) == INTEGER_CST && integer_zerop (arg1))
- return non_lvalue (arg0);
- /* If second arg is constant true, result is true, but we must
- evaluate first arg. */
- if (TREE_CODE (arg1) == INTEGER_CST && ! integer_zerop (arg1))
- return omit_one_operand (type, arg1, arg0);
- /* Likewise for first arg, but note this only occurs here for
- TRUTH_OR_EXPR. */
- if (TREE_CODE (arg0) == INTEGER_CST && ! integer_zerop (arg0))
- return omit_one_operand (type, arg0, arg1);
- goto truth_andor;
-
- case TRUTH_XOR_EXPR:
- /* If either arg is constant zero, drop it. */
- if (integer_zerop (arg0))
- return non_lvalue (arg1);
- if (integer_zerop (arg1))
- return non_lvalue (arg0);
- /* If either arg is constant true, this is a logical inversion. */
- if (integer_onep (arg0))
- return non_lvalue (invert_truthvalue (arg1));
- if (integer_onep (arg1))
- return non_lvalue (invert_truthvalue (arg0));
- return t;
-
- case EQ_EXPR:
- case NE_EXPR:
- case LT_EXPR:
- case GT_EXPR:
- case LE_EXPR:
- case GE_EXPR:
- /* If one arg is a constant integer, put it last. */
- if (TREE_CODE (arg0) == INTEGER_CST
- && TREE_CODE (arg1) != INTEGER_CST)
- {
- TREE_OPERAND (t, 0) = arg1;
- TREE_OPERAND (t, 1) = arg0;
- arg0 = TREE_OPERAND (t, 0);
- arg1 = TREE_OPERAND (t, 1);
- code = swap_tree_comparison (code);
- TREE_SET_CODE (t, code);
- }
-
- /* Convert foo++ == CONST into ++foo == CONST + INCR.
- First, see if one arg is constant; find the constant arg
- and the other one. */
- {
- tree constop = 0, varop;
- int constopnum = -1;
-
- if (TREE_CONSTANT (arg1))
- constopnum = 1, constop = arg1, varop = arg0;
- if (TREE_CONSTANT (arg0))
- constopnum = 0, constop = arg0, varop = arg1;
-
- if (constop && TREE_CODE (varop) == POSTINCREMENT_EXPR)
- {
- /* This optimization is invalid for ordered comparisons
- if CONST+INCR overflows or if foo+incr might overflow.
- This optimization is invalid for floating point due to rounding.
- For pointer types we assume overflow doesn't happen. */
- if (TREE_CODE (TREE_TYPE (varop)) == POINTER_TYPE
- || (! FLOAT_TYPE_P (TREE_TYPE (varop))
- && (code == EQ_EXPR || code == NE_EXPR)))
- {
- tree newconst
- = fold (build (PLUS_EXPR, TREE_TYPE (varop),
- constop, TREE_OPERAND (varop, 1)));
- TREE_SET_CODE (varop, PREINCREMENT_EXPR);
-
- /* If VAROP is a reference to a bitfield, we must mask
- the constant by the width of the field. */
- if (TREE_CODE (TREE_OPERAND (varop, 0)) == COMPONENT_REF
- && DECL_BIT_FIELD(TREE_OPERAND
- (TREE_OPERAND (varop, 0), 1)))
- {
- int size
- = TREE_INT_CST_LOW (DECL_SIZE
- (TREE_OPERAND
- (TREE_OPERAND (varop, 0), 1)));
-
- newconst = fold (build (BIT_AND_EXPR,
- TREE_TYPE (varop), newconst,
- convert (TREE_TYPE (varop),
- build_int_2 (size, 0))));
- }
-
-
- t = build (code, type, TREE_OPERAND (t, 0),
- TREE_OPERAND (t, 1));
- TREE_OPERAND (t, constopnum) = newconst;
- return t;
- }
- }
- else if (constop && TREE_CODE (varop) == POSTDECREMENT_EXPR)
- {
- if (TREE_CODE (TREE_TYPE (varop)) == POINTER_TYPE
- || (! FLOAT_TYPE_P (TREE_TYPE (varop))
- && (code == EQ_EXPR || code == NE_EXPR)))
- {
- tree newconst
- = fold (build (MINUS_EXPR, TREE_TYPE (varop),
- constop, TREE_OPERAND (varop, 1)));
- TREE_SET_CODE (varop, PREDECREMENT_EXPR);
-
- if (TREE_CODE (TREE_OPERAND (varop, 0)) == COMPONENT_REF
- && DECL_BIT_FIELD(TREE_OPERAND
- (TREE_OPERAND (varop, 0), 1)))
- {
- int size
- = TREE_INT_CST_LOW (DECL_SIZE
- (TREE_OPERAND
- (TREE_OPERAND (varop, 0), 1)));
-
- newconst = fold (build (BIT_AND_EXPR,
- TREE_TYPE (varop), newconst,
- convert (TREE_TYPE (varop),
- build_int_2 (size, 0))));
- }
-
-
- t = build (code, type, TREE_OPERAND (t, 0),
- TREE_OPERAND (t, 1));
- TREE_OPERAND (t, constopnum) = newconst;
- return t;
- }
- }
- }
-
- /* Change X >= CST to X > (CST - 1) if CST is positive. */
- if (TREE_CODE (arg1) == INTEGER_CST
- && TREE_CODE (arg0) != INTEGER_CST
- && tree_int_cst_sgn (arg1) > 0)
- {
- switch (TREE_CODE (t))
- {
- case GE_EXPR:
- code = GT_EXPR;
- arg1 = const_binop (MINUS_EXPR, arg1, integer_one_node, 0);
- t = build (code, type, TREE_OPERAND (t, 0), arg1);
- break;
-
- case LT_EXPR:
- code = LE_EXPR;
- arg1 = const_binop (MINUS_EXPR, arg1, integer_one_node, 0);
- t = build (code, type, TREE_OPERAND (t, 0), arg1);
- break;
- }
- }
-
- /* If this is an EQ or NE comparison with zero and ARG0 is
- (1 << foo) & bar, convert it to (bar >> foo) & 1. Both require
- two operations, but the latter can be done in one less insn
- one machine that have only two-operand insns or on which a
- constant cannot be the first operand. */
- if (integer_zerop (arg1) && (code == EQ_EXPR || code == NE_EXPR)
- && TREE_CODE (arg0) == BIT_AND_EXPR)
- {
- if (TREE_CODE (TREE_OPERAND (arg0, 0)) == LSHIFT_EXPR
- && integer_onep (TREE_OPERAND (TREE_OPERAND (arg0, 0), 0)))
- return
- fold (build (code, type,
- build (BIT_AND_EXPR, TREE_TYPE (arg0),
- build (RSHIFT_EXPR,
- TREE_TYPE (TREE_OPERAND (arg0, 0)),
- TREE_OPERAND (arg0, 1),
- TREE_OPERAND (TREE_OPERAND (arg0, 0), 1)),
- convert (TREE_TYPE (arg0),
- integer_one_node)),
- arg1));
- else if (TREE_CODE (TREE_OPERAND (arg0, 1)) == LSHIFT_EXPR
- && integer_onep (TREE_OPERAND (TREE_OPERAND (arg0, 1), 0)))
- return
- fold (build (code, type,
- build (BIT_AND_EXPR, TREE_TYPE (arg0),
- build (RSHIFT_EXPR,
- TREE_TYPE (TREE_OPERAND (arg0, 1)),
- TREE_OPERAND (arg0, 0),
- TREE_OPERAND (TREE_OPERAND (arg0, 1), 1)),
- convert (TREE_TYPE (arg0),
- integer_one_node)),
- arg1));
- }
-
- /* If this is an NE or EQ comparison of zero against the result of a
- signed MOD operation whose second operand is a power of 2, make
- the MOD operation unsigned since it is simpler and equivalent. */
- if ((code == NE_EXPR || code == EQ_EXPR)
- && integer_zerop (arg1)
- && ! TREE_UNSIGNED (TREE_TYPE (arg0))
- && (TREE_CODE (arg0) == TRUNC_MOD_EXPR
- || TREE_CODE (arg0) == CEIL_MOD_EXPR
- || TREE_CODE (arg0) == FLOOR_MOD_EXPR
- || TREE_CODE (arg0) == ROUND_MOD_EXPR)
- && integer_pow2p (TREE_OPERAND (arg0, 1)))
- {
- tree newtype = unsigned_type (TREE_TYPE (arg0));
- tree newmod = build (TREE_CODE (arg0), newtype,
- convert (newtype, TREE_OPERAND (arg0, 0)),
- convert (newtype, TREE_OPERAND (arg0, 1)));
-
- return build (code, type, newmod, convert (newtype, arg1));
- }
-
- /* If this is an NE comparison of zero with an AND of one, remove the
- comparison since the AND will give the correct value. */
- if (code == NE_EXPR && integer_zerop (arg1)
- && TREE_CODE (arg0) == BIT_AND_EXPR
- && integer_onep (TREE_OPERAND (arg0, 1)))
- return convert (type, arg0);
-
- /* If we have (A & C) == C where C is a power of 2, convert this into
- (A & C) != 0. Similarly for NE_EXPR. */
- if ((code == EQ_EXPR || code == NE_EXPR)
- && TREE_CODE (arg0) == BIT_AND_EXPR
- && integer_pow2p (TREE_OPERAND (arg0, 1))
- && operand_equal_p (TREE_OPERAND (arg0, 1), arg1, 0))
- return build (code == EQ_EXPR ? NE_EXPR : EQ_EXPR, type,
- arg0, integer_zero_node);
-
- /* If X is unsigned, convert X < (1 << Y) into X >> Y == 0
- and similarly for >= into !=. */
- if ((code == LT_EXPR || code == GE_EXPR)
- && TREE_UNSIGNED (TREE_TYPE (arg0))
- && TREE_CODE (arg1) == LSHIFT_EXPR
- && integer_onep (TREE_OPERAND (arg1, 0)))
- return build (code == LT_EXPR ? EQ_EXPR : NE_EXPR, type,
- build (RSHIFT_EXPR, TREE_TYPE (arg0), arg0,
- TREE_OPERAND (arg1, 1)),
- convert (TREE_TYPE (arg0), integer_zero_node));
-
- else if ((code == LT_EXPR || code == GE_EXPR)
- && TREE_UNSIGNED (TREE_TYPE (arg0))
- && (TREE_CODE (arg1) == NOP_EXPR
- || TREE_CODE (arg1) == CONVERT_EXPR)
- && TREE_CODE (TREE_OPERAND (arg1, 0)) == LSHIFT_EXPR
- && integer_onep (TREE_OPERAND (TREE_OPERAND (arg1, 0), 0)))
- return
- build (code == LT_EXPR ? EQ_EXPR : NE_EXPR, type,
- convert (TREE_TYPE (arg0),
- build (RSHIFT_EXPR, TREE_TYPE (arg0), arg0,
- TREE_OPERAND (TREE_OPERAND (arg1, 0), 1))),
- convert (TREE_TYPE (arg0), integer_zero_node));
-
- /* Simplify comparison of something with itself. (For IEEE
- floating-point, we can only do some of these simplifications.) */
- if (operand_equal_p (arg0, arg1, 0))
- {
- switch (code)
- {
- case EQ_EXPR:
- case GE_EXPR:
- case LE_EXPR:
- if (INTEGRAL_TYPE_P (TREE_TYPE (arg0)))
- {
- if (type == integer_type_node)
- return integer_one_node;
-
- t = build_int_2 (1, 0);
- TREE_TYPE (t) = type;
- return t;
- }
- code = EQ_EXPR;
- TREE_SET_CODE (t, code);
- break;
-
- case NE_EXPR:
- /* For NE, we can only do this simplification if integer. */
- if (! INTEGRAL_TYPE_P (TREE_TYPE (arg0)))
- break;
- /* ... fall through ... */
- case GT_EXPR:
- case LT_EXPR:
- if (type == integer_type_node)
- return integer_zero_node;
-
- t = build_int_2 (0, 0);
- TREE_TYPE (t) = type;
- return t;
- }
- }
-
- /* An unsigned comparison against 0 can be simplified. */
- if (integer_zerop (arg1)
- && (INTEGRAL_TYPE_P (TREE_TYPE (arg1))
- || TREE_CODE (TREE_TYPE (arg1)) == POINTER_TYPE)
- && TREE_UNSIGNED (TREE_TYPE (arg1)))
- {
- switch (TREE_CODE (t))
- {
- case GT_EXPR:
- code = NE_EXPR;
- TREE_SET_CODE (t, NE_EXPR);
- break;
- case LE_EXPR:
- code = EQ_EXPR;
- TREE_SET_CODE (t, EQ_EXPR);
- break;
- case GE_EXPR:
- return omit_one_operand (type,
- convert (type, integer_one_node),
- arg0);
- case LT_EXPR:
- return omit_one_operand (type,
- convert (type, integer_zero_node),
- arg0);
- }
- }
-
- /* If we are comparing an expression that just has comparisons
- of two integer values, arithmetic expressions of those comparisons,
- and constants, we can simplify it. There are only three cases
- to check: the two values can either be equal, the first can be
- greater, or the second can be greater. Fold the expression for
- those three values. Since each value must be 0 or 1, we have
- eight possibilities, each of which corresponds to the constant 0
- or 1 or one of the six possible comparisons.
-
- This handles common cases like (a > b) == 0 but also handles
- expressions like ((x > y) - (y > x)) > 0, which supposedly
- occur in macroized code. */
-
- if (TREE_CODE (arg1) == INTEGER_CST && TREE_CODE (arg0) != INTEGER_CST)
- {
- tree cval1 = 0, cval2 = 0;
- int save_p = 0;
-
- if (twoval_comparison_p (arg0, &cval1, &cval2, &save_p)
- /* Don't handle degenerate cases here; they should already
- have been handled anyway. */
- && cval1 != 0 && cval2 != 0
- && ! (TREE_CONSTANT (cval1) && TREE_CONSTANT (cval2))
- && TREE_TYPE (cval1) == TREE_TYPE (cval2)
- && INTEGRAL_TYPE_P (TREE_TYPE (cval1))
- && ! operand_equal_p (TYPE_MIN_VALUE (TREE_TYPE (cval1)),
- TYPE_MAX_VALUE (TREE_TYPE (cval2)), 0))
- {
- tree maxval = TYPE_MAX_VALUE (TREE_TYPE (cval1));
- tree minval = TYPE_MIN_VALUE (TREE_TYPE (cval1));
-
- /* We can't just pass T to eval_subst in case cval1 or cval2
- was the same as ARG1. */
-
- tree high_result
- = fold (build (code, type,
- eval_subst (arg0, cval1, maxval, cval2, minval),
- arg1));
- tree equal_result
- = fold (build (code, type,
- eval_subst (arg0, cval1, maxval, cval2, maxval),
- arg1));
- tree low_result
- = fold (build (code, type,
- eval_subst (arg0, cval1, minval, cval2, maxval),
- arg1));
-
- /* All three of these results should be 0 or 1. Confirm they
- are. Then use those values to select the proper code
- to use. */
-
- if ((integer_zerop (high_result)
- || integer_onep (high_result))
- && (integer_zerop (equal_result)
- || integer_onep (equal_result))
- && (integer_zerop (low_result)
- || integer_onep (low_result)))
- {
- /* Make a 3-bit mask with the high-order bit being the
- value for `>', the next for '=', and the low for '<'. */
- switch ((integer_onep (high_result) * 4)
- + (integer_onep (equal_result) * 2)
- + integer_onep (low_result))
- {
- case 0:
- /* Always false. */
- return omit_one_operand (type, integer_zero_node, arg0);
- case 1:
- code = LT_EXPR;
- break;
- case 2:
- code = EQ_EXPR;
- break;
- case 3:
- code = LE_EXPR;
- break;
- case 4:
- code = GT_EXPR;
- break;
- case 5:
- code = NE_EXPR;
- break;
- case 6:
- code = GE_EXPR;
- break;
- case 7:
- /* Always true. */
- return omit_one_operand (type, integer_one_node, arg0);
- }
-
- t = build (code, type, cval1, cval2);
- if (save_p)
- return save_expr (t);
- else
- return fold (t);
- }
- }
- }
-
- /* If this is a comparison of a field, we may be able to simplify it. */
- if ((TREE_CODE (arg0) == COMPONENT_REF
- || TREE_CODE (arg0) == BIT_FIELD_REF)
- && (code == EQ_EXPR || code == NE_EXPR)
- /* Handle the constant case even without -O
- to make sure the warnings are given. */
- && (optimize || TREE_CODE (arg1) == INTEGER_CST))
- {
- t1 = optimize_bit_field_compare (code, type, arg0, arg1);
- return t1 ? t1 : t;
- }
-
- /* If this is a comparison of complex values and either or both
- sizes are a COMPLEX_EXPR, it is best to split up the comparisons
- and join them with a TRUTH_ANDIF_EXPR or TRUTH_ORIF_EXPR. This
- may prevent needless evaluations. */
- if ((code == EQ_EXPR || code == NE_EXPR)
- && TREE_CODE (TREE_TYPE (arg0)) == COMPLEX_TYPE
- && (TREE_CODE (arg0) == COMPLEX_EXPR
- || TREE_CODE (arg1) == COMPLEX_EXPR))
- {
- tree subtype = TREE_TYPE (TREE_TYPE (arg0));
- tree real0 = fold (build1 (REALPART_EXPR, subtype, arg0));
- tree imag0 = fold (build1 (IMAGPART_EXPR, subtype, arg0));
- tree real1 = fold (build1 (REALPART_EXPR, subtype, arg1));
- tree imag1 = fold (build1 (IMAGPART_EXPR, subtype, arg1));
-
- return fold (build ((code == EQ_EXPR ? TRUTH_ANDIF_EXPR
- : TRUTH_ORIF_EXPR),
- type,
- fold (build (code, type, real0, real1)),
- fold (build (code, type, imag0, imag1))));
- }
-
- /* From here on, the only cases we handle are when the result is
- known to be a constant.
-
- To compute GT, swap the arguments and do LT.
- To compute GE, do LT and invert the result.
- To compute LE, swap the arguments, do LT and invert the result.
- To compute NE, do EQ and invert the result.
-
- Therefore, the code below must handle only EQ and LT. */
-
- if (code == LE_EXPR || code == GT_EXPR)
- {
- tem = arg0, arg0 = arg1, arg1 = tem;
- code = swap_tree_comparison (code);
- }
-
- /* Note that it is safe to invert for real values here because we
- will check below in the one case that it matters. */
-
- invert = 0;
- if (code == NE_EXPR || code == GE_EXPR)
- {
- invert = 1;
- code = invert_tree_comparison (code);
- }
-
- /* Compute a result for LT or EQ if args permit;
- otherwise return T. */
- if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
- {
- if (code == EQ_EXPR)
- t1 = build_int_2 ((TREE_INT_CST_LOW (arg0)
- == TREE_INT_CST_LOW (arg1))
- && (TREE_INT_CST_HIGH (arg0)
- == TREE_INT_CST_HIGH (arg1)),
- 0);
- else
- t1 = build_int_2 ((TREE_UNSIGNED (TREE_TYPE (arg0))
- ? INT_CST_LT_UNSIGNED (arg0, arg1)
- : INT_CST_LT (arg0, arg1)),
- 0);
- }
-
-#if 0 /* This is no longer useful, but breaks some real code. */
- /* Assume a nonexplicit constant cannot equal an explicit one,
- since such code would be undefined anyway.
- Exception: on sysvr4, using #pragma weak,
- a label can come out as 0. */
- else if (TREE_CODE (arg1) == INTEGER_CST
- && !integer_zerop (arg1)
- && TREE_CONSTANT (arg0)
- && TREE_CODE (arg0) == ADDR_EXPR
- && code == EQ_EXPR)
- t1 = build_int_2 (0, 0);
-#endif
- /* Two real constants can be compared explicitly. */
- else if (TREE_CODE (arg0) == REAL_CST && TREE_CODE (arg1) == REAL_CST)
- {
- /* If either operand is a NaN, the result is false with two
- exceptions: First, an NE_EXPR is true on NaNs, but that case
- is already handled correctly since we will be inverting the
- result for NE_EXPR. Second, if we had inverted a LE_EXPR
- or a GE_EXPR into a LT_EXPR, we must return true so that it
- will be inverted into false. */
-
- if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg0))
- || REAL_VALUE_ISNAN (TREE_REAL_CST (arg1)))
- t1 = build_int_2 (invert && code == LT_EXPR, 0);
-
- else if (code == EQ_EXPR)
- t1 = build_int_2 (REAL_VALUES_EQUAL (TREE_REAL_CST (arg0),
- TREE_REAL_CST (arg1)),
- 0);
- else
- t1 = build_int_2 (REAL_VALUES_LESS (TREE_REAL_CST (arg0),
- TREE_REAL_CST (arg1)),
- 0);
- }
-
- if (t1 == NULL_TREE)
- return t;
-
- if (invert)
- TREE_INT_CST_LOW (t1) ^= 1;
-
- TREE_TYPE (t1) = type;
- return t1;
-
- case COND_EXPR:
- /* Pedantic ANSI C says that a conditional expression is never an lvalue,
- so all simple results must be passed through pedantic_non_lvalue. */
- if (TREE_CODE (arg0) == INTEGER_CST)
- return pedantic_non_lvalue
- (TREE_OPERAND (t, (integer_zerop (arg0) ? 2 : 1)));
- else if (operand_equal_p (arg1, TREE_OPERAND (expr, 2), 0))
- return pedantic_omit_one_operand (type, arg1, arg0);
-
- /* If the second operand is zero, invert the comparison and swap
- the second and third operands. Likewise if the second operand
- is constant and the third is not or if the third operand is
- equivalent to the first operand of the comparison. */
-
- if (integer_zerop (arg1)
- || (TREE_CONSTANT (arg1) && ! TREE_CONSTANT (TREE_OPERAND (t, 2)))
- || (TREE_CODE_CLASS (TREE_CODE (arg0)) == '<'
- && operand_equal_for_comparison_p (TREE_OPERAND (arg0, 0),
- TREE_OPERAND (t, 2),
- TREE_OPERAND (arg0, 1))))
- {
- /* See if this can be inverted. If it can't, possibly because
- it was a floating-point inequality comparison, don't do
- anything. */
- tem = invert_truthvalue (arg0);
-
- if (TREE_CODE (tem) != TRUTH_NOT_EXPR)
- {
- t = build (code, type, tem,
- TREE_OPERAND (t, 2), TREE_OPERAND (t, 1));
- arg0 = tem;
- arg1 = TREE_OPERAND (t, 2);
- STRIP_NOPS (arg1);
- }
- }
-
- /* If we have A op B ? A : C, we may be able to convert this to a
- simpler expression, depending on the operation and the values
- of B and C. IEEE floating point prevents this though,
- because A or B might be -0.0 or a NaN. */
-
- if (TREE_CODE_CLASS (TREE_CODE (arg0)) == '<'
- && (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || ! FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (arg0, 0)))
- || flag_fast_math)
- && operand_equal_for_comparison_p (TREE_OPERAND (arg0, 0),
- arg1, TREE_OPERAND (arg0, 1)))
- {
- tree arg2 = TREE_OPERAND (t, 2);
- enum tree_code comp_code = TREE_CODE (arg0);
-
- STRIP_NOPS (arg2);
-
- /* If we have A op 0 ? A : -A, this is A, -A, abs (A), or abs (-A),
- depending on the comparison operation. */
- if ((FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (arg0, 1)))
- ? real_zerop (TREE_OPERAND (arg0, 1))
- : integer_zerop (TREE_OPERAND (arg0, 1)))
- && TREE_CODE (arg2) == NEGATE_EXPR
- && operand_equal_p (TREE_OPERAND (arg2, 0), arg1, 0))
- switch (comp_code)
- {
- case EQ_EXPR:
- return pedantic_non_lvalue
- (fold (build1 (NEGATE_EXPR, type, arg1)));
- case NE_EXPR:
- return pedantic_non_lvalue (convert (type, arg1));
- case GE_EXPR:
- case GT_EXPR:
- return pedantic_non_lvalue
- (convert (type, fold (build1 (ABS_EXPR,
- TREE_TYPE (arg1), arg1))));
- case LE_EXPR:
- case LT_EXPR:
- return pedantic_non_lvalue
- (fold (build1 (NEGATE_EXPR, type,
- convert (type,
- fold (build1 (ABS_EXPR,
- TREE_TYPE (arg1),
- arg1))))));
- }
-
- /* If this is A != 0 ? A : 0, this is simply A. For ==, it is
- always zero. */
-
- if (integer_zerop (TREE_OPERAND (arg0, 1)) && integer_zerop (arg2))
- {
- if (comp_code == NE_EXPR)
- return pedantic_non_lvalue (convert (type, arg1));
- else if (comp_code == EQ_EXPR)
- return pedantic_non_lvalue (convert (type, integer_zero_node));
- }
-
- /* If this is A op B ? A : B, this is either A, B, min (A, B),
- or max (A, B), depending on the operation. */
-
- if (operand_equal_for_comparison_p (TREE_OPERAND (arg0, 1),
- arg2, TREE_OPERAND (arg0, 0)))
- {
- tree comp_op0 = TREE_OPERAND (arg0, 0);
- tree comp_op1 = TREE_OPERAND (arg0, 1);
- tree comp_type = TREE_TYPE (comp_op0);
-
- switch (comp_code)
- {
- case EQ_EXPR:
- return pedantic_non_lvalue (convert (type, arg2));
- case NE_EXPR:
- return pedantic_non_lvalue (convert (type, arg1));
- case LE_EXPR:
- case LT_EXPR:
- return pedantic_non_lvalue
- (convert (type, (fold (build (MIN_EXPR, comp_type,
- comp_op0, comp_op1)))));
- case GE_EXPR:
- case GT_EXPR:
- return pedantic_non_lvalue
- (convert (type, fold (build (MAX_EXPR, comp_type,
- comp_op0, comp_op1))));
- }
- }
-
- /* If this is A op C1 ? A : C2 with C1 and C2 constant integers,
- we might still be able to simplify this. For example,
- if C1 is one less or one more than C2, this might have started
- out as a MIN or MAX and been transformed by this function.
- Only good for INTEGER_TYPEs, because we need TYPE_MAX_VALUE. */
-
- if (INTEGRAL_TYPE_P (type)
- && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
- && TREE_CODE (arg2) == INTEGER_CST)
- switch (comp_code)
- {
- case EQ_EXPR:
- /* We can replace A with C1 in this case. */
- arg1 = convert (type, TREE_OPERAND (arg0, 1));
- t = build (code, type, TREE_OPERAND (t, 0), arg1,
- TREE_OPERAND (t, 2));
- break;
-
- case LT_EXPR:
- /* If C1 is C2 + 1, this is min(A, C2). */
- if (! operand_equal_p (arg2, TYPE_MAX_VALUE (type), 1)
- && operand_equal_p (TREE_OPERAND (arg0, 1),
- const_binop (PLUS_EXPR, arg2,
- integer_one_node, 0), 1))
- return pedantic_non_lvalue
- (fold (build (MIN_EXPR, type, arg1, arg2)));
- break;
-
- case LE_EXPR:
- /* If C1 is C2 - 1, this is min(A, C2). */
- if (! operand_equal_p (arg2, TYPE_MIN_VALUE (type), 1)
- && operand_equal_p (TREE_OPERAND (arg0, 1),
- const_binop (MINUS_EXPR, arg2,
- integer_one_node, 0), 1))
- return pedantic_non_lvalue
- (fold (build (MIN_EXPR, type, arg1, arg2)));
- break;
-
- case GT_EXPR:
- /* If C1 is C2 - 1, this is max(A, C2). */
- if (! operand_equal_p (arg2, TYPE_MIN_VALUE (type), 1)
- && operand_equal_p (TREE_OPERAND (arg0, 1),
- const_binop (MINUS_EXPR, arg2,
- integer_one_node, 0), 1))
- return pedantic_non_lvalue
- (fold (build (MAX_EXPR, type, arg1, arg2)));
- break;
-
- case GE_EXPR:
- /* If C1 is C2 + 1, this is max(A, C2). */
- if (! operand_equal_p (arg2, TYPE_MAX_VALUE (type), 1)
- && operand_equal_p (TREE_OPERAND (arg0, 1),
- const_binop (PLUS_EXPR, arg2,
- integer_one_node, 0), 1))
- return pedantic_non_lvalue
- (fold (build (MAX_EXPR, type, arg1, arg2)));
- break;
- }
- }
-
- /* If the second operand is simpler than the third, swap them
- since that produces better jump optimization results. */
- if ((TREE_CONSTANT (arg1) || TREE_CODE_CLASS (TREE_CODE (arg1)) == 'd'
- || TREE_CODE (arg1) == SAVE_EXPR)
- && ! (TREE_CONSTANT (TREE_OPERAND (t, 2))
- || TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 2))) == 'd'
- || TREE_CODE (TREE_OPERAND (t, 2)) == SAVE_EXPR))
- {
- /* See if this can be inverted. If it can't, possibly because
- it was a floating-point inequality comparison, don't do
- anything. */
- tem = invert_truthvalue (arg0);
-
- if (TREE_CODE (tem) != TRUTH_NOT_EXPR)
- {
- t = build (code, type, tem,
- TREE_OPERAND (t, 2), TREE_OPERAND (t, 1));
- arg0 = tem;
- arg1 = TREE_OPERAND (t, 2);
- STRIP_NOPS (arg1);
- }
- }
-
- /* Convert A ? 1 : 0 to simply A. */
- if (integer_onep (TREE_OPERAND (t, 1))
- && integer_zerop (TREE_OPERAND (t, 2))
- /* If we try to convert TREE_OPERAND (t, 0) to our type, the
- call to fold will try to move the conversion inside
- a COND, which will recurse. In that case, the COND_EXPR
- is probably the best choice, so leave it alone. */
- && type == TREE_TYPE (arg0))
- return pedantic_non_lvalue (arg0);
-
- /* Look for expressions of the form A & 2 ? 2 : 0. The result of this
- operation is simply A & 2. */
-
- if (integer_zerop (TREE_OPERAND (t, 2))
- && TREE_CODE (arg0) == NE_EXPR
- && integer_zerop (TREE_OPERAND (arg0, 1))
- && integer_pow2p (arg1)
- && TREE_CODE (TREE_OPERAND (arg0, 0)) == BIT_AND_EXPR
- && operand_equal_p (TREE_OPERAND (TREE_OPERAND (arg0, 0), 1),
- arg1, 1))
- return pedantic_non_lvalue (convert (type, TREE_OPERAND (arg0, 0)));
-
- return t;
-
- case COMPOUND_EXPR:
- /* When pedantic, a compound expression can be neither an lvalue
- nor an integer constant expression. */
- if (TREE_SIDE_EFFECTS (arg0) || pedantic)
- return t;
- /* Don't let (0, 0) be null pointer constant. */
- if (integer_zerop (arg1))
- return non_lvalue (arg1);
- return arg1;
-
- case COMPLEX_EXPR:
- if (wins)
- return build_complex (type, arg0, arg1);
- return t;
-
- case REALPART_EXPR:
- if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE)
- return t;
- else if (TREE_CODE (arg0) == COMPLEX_EXPR)
- return omit_one_operand (type, TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg0, 1));
- else if (TREE_CODE (arg0) == COMPLEX_CST)
- return TREE_REALPART (arg0);
- else if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
- return fold (build (TREE_CODE (arg0), type,
- fold (build1 (REALPART_EXPR, type,
- TREE_OPERAND (arg0, 0))),
- fold (build1 (REALPART_EXPR,
- type, TREE_OPERAND (arg0, 1)))));
- return t;
-
- case IMAGPART_EXPR:
- if (TREE_CODE (TREE_TYPE (arg0)) != COMPLEX_TYPE)
- return convert (type, integer_zero_node);
- else if (TREE_CODE (arg0) == COMPLEX_EXPR)
- return omit_one_operand (type, TREE_OPERAND (arg0, 1),
- TREE_OPERAND (arg0, 0));
- else if (TREE_CODE (arg0) == COMPLEX_CST)
- return TREE_IMAGPART (arg0);
- else if (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR)
- return fold (build (TREE_CODE (arg0), type,
- fold (build1 (IMAGPART_EXPR, type,
- TREE_OPERAND (arg0, 0))),
- fold (build1 (IMAGPART_EXPR, type,
- TREE_OPERAND (arg0, 1)))));
- return t;
-
- /* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where
- appropriate. */
- case CLEANUP_POINT_EXPR:
- if (! TREE_SIDE_EFFECTS (arg0))
- return TREE_OPERAND (t, 0);
-
- {
- enum tree_code code0 = TREE_CODE (arg0);
- int kind0 = TREE_CODE_CLASS (code0);
- tree arg00 = TREE_OPERAND (arg0, 0);
- tree arg01;
-
- if (kind0 == '1' || code0 == TRUTH_NOT_EXPR)
- return fold (build1 (code0, type,
- fold (build1 (CLEANUP_POINT_EXPR,
- TREE_TYPE (arg00), arg00))));
-
- if (kind0 == '<' || kind0 == '2'
- || code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR
- || code0 == TRUTH_AND_EXPR || code0 == TRUTH_OR_EXPR
- || code0 == TRUTH_XOR_EXPR)
- {
- arg01 = TREE_OPERAND (arg0, 1);
-
- if (! TREE_SIDE_EFFECTS (arg00))
- return fold (build (code0, type, arg00,
- fold (build1 (CLEANUP_POINT_EXPR,
- TREE_TYPE (arg01), arg01))));
-
- if (! TREE_SIDE_EFFECTS (arg01))
- return fold (build (code0, type,
- fold (build1 (CLEANUP_POINT_EXPR,
- TREE_TYPE (arg00), arg00)),
- arg01));
- }
-
- return t;
- }
-
- default:
- return t;
- } /* switch (code) */
-}
diff --git a/gcc/fp-test.c b/gcc/fp-test.c
deleted file mode 100644
index 667059c1dda..00000000000
--- a/gcc/fp-test.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* fp-test.c - Check that all floating-point operations are available.
- Copyright (C) 1995 Free Software Foundation, Inc.
- Contributed by Ronald F. Guilmette <rfg@monkeys.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 is a trivial test program which may be useful to people who are
- porting the GCC or G++ compilers to a new system. The intent here is
- merely to check that all floating-point operations have been provided
- by the port. (Note that I say ``provided'' rather than ``implemented''.)
-
- To use this file, simply compile it (with GCC or G++) and then try to
- link it in the normal way (also using GCC or G++ respectively). If
- all of the floating -point operations (including conversions) have
- been provided, then this file will link without incident. If however
- one or more of the primitive floating-point operations have not been
- properly provided, you will get link-time errors indicating which
- floating-point operations are unavailable.
-
- This file will typically be used when porting the GNU compilers to
- some system which lacks floating-point hardware, and for which
- software emulation routines (for FP ops) are needed in order to
- complete the port. */
-
-#if 0
-#include <math.h>
-#endif
-
-extern double acos (double);
-extern double asin (double);
-extern double atan (double);
-extern double atan2 (double, double);
-extern double cos (double);
-extern double sin (double);
-extern double tan (double);
-extern double cosh (double);
-extern double sinh (double);
-extern double tanh (double);
-extern double exp (double);
-extern double frexp (double, int *);
-extern double ldexp (double, int);
-extern double log (double);
-extern double log10 (double);
-extern double modf (double, double *);
-extern double pow (double, double);
-extern double sqrt (double);
-extern double ceil (double);
-extern double fabs (double);
-extern double floor (double);
-extern double fmod (double, double);
-
-int i1, i2 = 2;
-
-volatile signed char sc;
-volatile unsigned char uc;
-
-volatile signed short ss;
-volatile unsigned short us;
-
-volatile signed int si;
-volatile unsigned int ui;
-
-volatile signed long sl;
-volatile unsigned long ul;
-
-volatile float f1 = 1.0, f2 = 1.0, f3 = 1.0;
-volatile double d1 = 1.0, d2 = 1.0, d3 = 1.0;
-volatile long double D1 = 1.0, D2 = 1.0, D3 = 1.0;
-
-int
-main ()
-{
- /* TYPE: float */
-
- f1 = -f2;
- f1 = f2 + f3;
- f1 = f2 - f3;
- f1 = f2 * f3;
- f1 = f2 / f3;
- f1 += f2;
- f1 -= f2;
- f1 *= f2;
- f1 /= f2;
-
- si = f1 == f2;
- si = f1 != f2;
- si = f1 > f2;
- si = f1 < f2;
- si = f1 >= f2;
- si = f1 <= f2;
-
- sc = f1;
- uc = f1;
- ss = f1;
- us = f1;
- si = f1;
- ui = f1;
- sl = f1;
- ul = f1;
- d1 = f1;
- D1 = f1;
-
- f1 = sc;
- f1 = uc;
- f1 = ss;
- f1 = us;
- f1 = si;
- f1 = ui;
- f1 = sl;
- f1 = ul;
- f1 = d1;
- f1 = D1;
-
- d1 = -d2;
- d1 = d2 + d3;
- d1 = d2 - d3;
- d1 = d2 * d3;
- d1 = d2 / d3;
- d1 += d2;
- d1 -= d2;
- d1 *= d2;
- d1 /= d2;
-
- si = d1 == d2;
- si = d1 != d2;
- si = d1 > d2;
- si = d1 < d2;
- si = d1 >= d2;
- si = d1 <= d2;
-
- sc = d1;
- uc = d1;
- ss = d1;
- us = d1;
- si = d1;
- ui = d1;
- sl = d1;
- ul = d1;
- f1 = d1;
- D1 = d1;
-
- d1 = sc;
- d1 = uc;
- d1 = ss;
- d1 = us;
- d1 = si;
- d1 = ui;
- d1 = sl;
- d1 = ul;
- d1 = f1;
- d1 = D1;
-
- D1 = -D2;
- D1 = D2 + D3;
- D1 = D2 - D3;
- D1 = D2 * D3;
- D1 = D2 / D3;
- D1 += D2;
- D1 -= D2;
- D1 *= D2;
- D1 /= D2;
-
- si = D1 == D2;
- si = D1 != D2;
- si = D1 > D2;
- si = D1 < D2;
- si = D1 >= D2;
- si = D1 <= D2;
-
- sc = D1;
- uc = D1;
- ss = D1;
- us = D1;
- si = D1;
- ui = D1;
- sl = D1;
- ul = D1;
- f1 = D1;
- d1 = D1;
-
- D1 = sc;
- D1 = uc;
- D1 = ss;
- D1 = us;
- D1 = si;
- D1 = ui;
- D1 = sl;
- D1 = ul;
- D1 = f1;
- D1 = d1;
-
- d1 = acos (d2);
- d1 = asin (d2);
- d1 = atan (d2);
- d1 = atan2 (d2, d3);
- d1 = cos (d2);
- d1 = sin (d2);
- d1 = tan (d2);
- d1 = cosh (d2);
- d1 = sinh (d2);
- d1 = tanh (d2);
- d1 = exp (d2);
- d1 = frexp (d2, &i1);
- d1 = ldexp (d2, i2);
- d1 = log (d2);
- d1 = log10 (d2);
- d1 = modf (d2, &d3);
- d1 = pow (d2, d3);
- d1 = sqrt (d2);
- d1 = ceil (d2);
- d1 = fabs (d2);
- d1 = floor (d2);
- d1 = fmod (d2, d3);
-
- return 0;
-}
diff --git a/gcc/function.c b/gcc/function.c
deleted file mode 100644
index e9e99fe10e0..00000000000
--- a/gcc/function.c
+++ /dev/null
@@ -1,5909 +0,0 @@
-/* Expands front end tree to back end RTL for GNU C-Compiler
- Copyright (C) 1987, 88, 89, 91-96, 1997 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 handles the generation of rtl code from tree structure
- at the level of the function as a whole.
- It creates the rtl expressions for parameters and auto variables
- and has full responsibility for allocating stack slots.
-
- `expand_function_start' is called at the beginning of a function,
- before the function body is parsed, and `expand_function_end' is
- called after parsing the body.
-
- Call `assign_stack_local' to allocate a stack slot for a local variable.
- This is usually done during the RTL generation for the function body,
- but it can also be done in the reload pass when a pseudo-register does
- not get a hard register.
-
- Call `put_var_into_stack' when you learn, belatedly, that a variable
- previously given a pseudo-register must in fact go in the stack.
- This function changes the DECL_RTL to be a stack slot instead of a reg
- then scans all the RTL instructions so far generated to correct them. */
-
-#include "config.h"
-#include <stdio.h>
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "except.h"
-#include "function.h"
-#include "insn-flags.h"
-#include "expr.h"
-#include "insn-codes.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "insn-config.h"
-#include "recog.h"
-#include "output.h"
-#include "basic-block.h"
-#include "obstack.h"
-#include "bytecode.h"
-#include "bc-emit.h"
-
-#ifndef TRAMPOLINE_ALIGNMENT
-#define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
-#endif
-
-/* Some systems use __main in a way incompatible with its use in gcc, in these
- cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
- give the same symbol without quotes for an alternative entry point. You
- must define both, or neither. */
-#ifndef NAME__MAIN
-#define NAME__MAIN "__main"
-#define SYMBOL__MAIN __main
-#endif
-
-/* Round a value to the lowest integer less than it that is a multiple of
- the required alignment. Avoid using division in case the value is
- negative. Assume the alignment is a power of two. */
-#define FLOOR_ROUND(VALUE,ALIGN) ((VALUE) & ~((ALIGN) - 1))
-
-/* Similar, but round to the next highest integer that meets the
- alignment. */
-#define CEIL_ROUND(VALUE,ALIGN) (((VALUE) + (ALIGN) - 1) & ~((ALIGN)- 1))
-
-/* NEED_SEPARATE_AP means that we cannot derive ap from the value of fp
- during rtl generation. If they are different register numbers, this is
- always true. It may also be true if
- FIRST_PARM_OFFSET - STARTING_FRAME_OFFSET is not a constant during rtl
- generation. See fix_lexical_addr for details. */
-
-#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
-#define NEED_SEPARATE_AP
-#endif
-
-/* Number of bytes of args popped by function being compiled on its return.
- Zero if no bytes are to be popped.
- May affect compilation of return insn or of function epilogue. */
-
-int current_function_pops_args;
-
-/* Nonzero if function being compiled needs to be given an address
- where the value should be stored. */
-
-int current_function_returns_struct;
-
-/* Nonzero if function being compiled needs to
- return the address of where it has put a structure value. */
-
-int current_function_returns_pcc_struct;
-
-/* Nonzero if function being compiled needs to be passed a static chain. */
-
-int current_function_needs_context;
-
-/* Nonzero if function being compiled can call setjmp. */
-
-int current_function_calls_setjmp;
-
-/* Nonzero if function being compiled can call longjmp. */
-
-int current_function_calls_longjmp;
-
-/* Nonzero if function being compiled receives nonlocal gotos
- from nested functions. */
-
-int current_function_has_nonlocal_label;
-
-/* Nonzero if function being compiled has nonlocal gotos to parent
- function. */
-
-int current_function_has_nonlocal_goto;
-
-/* Nonzero if function being compiled contains nested functions. */
-
-int current_function_contains_functions;
-
-/* Nonzero if function being compiled can call alloca,
- either as a subroutine or builtin. */
-
-int current_function_calls_alloca;
-
-/* Nonzero if the current function returns a pointer type */
-
-int current_function_returns_pointer;
-
-/* If some insns can be deferred to the delay slots of the epilogue, the
- delay list for them is recorded here. */
-
-rtx current_function_epilogue_delay_list;
-
-/* If function's args have a fixed size, this is that size, in bytes.
- Otherwise, it is -1.
- May affect compilation of return insn or of function epilogue. */
-
-int current_function_args_size;
-
-/* # bytes the prologue should push and pretend that the caller pushed them.
- The prologue must do this, but only if parms can be passed in registers. */
-
-int current_function_pretend_args_size;
-
-/* # of bytes of outgoing arguments. If ACCUMULATE_OUTGOING_ARGS is
- defined, the needed space is pushed by the prologue. */
-
-int current_function_outgoing_args_size;
-
-/* This is the offset from the arg pointer to the place where the first
- anonymous arg can be found, if there is one. */
-
-rtx current_function_arg_offset_rtx;
-
-/* Nonzero if current function uses varargs.h or equivalent.
- Zero for functions that use stdarg.h. */
-
-int current_function_varargs;
-
-/* Nonzero if current function uses stdarg.h or equivalent.
- Zero for functions that use varargs.h. */
-
-int current_function_stdarg;
-
-/* Quantities of various kinds of registers
- used for the current function's args. */
-
-CUMULATIVE_ARGS current_function_args_info;
-
-/* Name of function now being compiled. */
-
-char *current_function_name;
-
-/* If non-zero, an RTL expression for that location at which the current
- function returns its result. Always equal to
- DECL_RTL (DECL_RESULT (current_function_decl)), but provided
- independently of the tree structures. */
-
-rtx current_function_return_rtx;
-
-/* Nonzero if the current function uses the constant pool. */
-
-int current_function_uses_const_pool;
-
-/* Nonzero if the current function uses pic_offset_table_rtx. */
-int current_function_uses_pic_offset_table;
-
-/* The arg pointer hard register, or the pseudo into which it was copied. */
-rtx current_function_internal_arg_pointer;
-
-/* The FUNCTION_DECL for an inline function currently being expanded. */
-tree inline_function_decl;
-
-/* Number of function calls seen so far in current function. */
-
-int function_call_count;
-
-/* List (chain of TREE_LIST) of LABEL_DECLs for all nonlocal labels
- (labels to which there can be nonlocal gotos from nested functions)
- in this function. */
-
-tree nonlocal_labels;
-
-/* RTX for stack slot that holds the current handler for nonlocal gotos.
- Zero when function does not have nonlocal labels. */
-
-rtx nonlocal_goto_handler_slot;
-
-/* RTX for stack slot that holds the stack pointer value to restore
- for a nonlocal goto.
- Zero when function does not have nonlocal labels. */
-
-rtx nonlocal_goto_stack_level;
-
-/* Label that will go on parm cleanup code, if any.
- Jumping to this label runs cleanup code for parameters, if
- such code must be run. Following this code is the logical return label. */
-
-rtx cleanup_label;
-
-/* Label that will go on function epilogue.
- Jumping to this label serves as a "return" instruction
- on machines which require execution of the epilogue on all returns. */
-
-rtx return_label;
-
-/* List (chain of EXPR_LISTs) of pseudo-regs of SAVE_EXPRs.
- So we can mark them all live at the end of the function, if nonopt. */
-rtx save_expr_regs;
-
-/* List (chain of EXPR_LISTs) of all stack slots in this function.
- Made for the sake of unshare_all_rtl. */
-rtx stack_slot_list;
-
-/* Chain of all RTL_EXPRs that have insns in them. */
-tree rtl_expr_chain;
-
-/* Label to jump back to for tail recursion, or 0 if we have
- not yet needed one for this function. */
-rtx tail_recursion_label;
-
-/* Place after which to insert the tail_recursion_label if we need one. */
-rtx tail_recursion_reentry;
-
-/* Location at which to save the argument pointer if it will need to be
- referenced. There are two cases where this is done: if nonlocal gotos
- exist, or if vars stored at an offset from the argument pointer will be
- needed by inner routines. */
-
-rtx arg_pointer_save_area;
-
-/* Offset to end of allocated area of stack frame.
- If stack grows down, this is the address of the last stack slot allocated.
- If stack grows up, this is the address for the next slot. */
-HOST_WIDE_INT frame_offset;
-
-/* List (chain of TREE_LISTs) of static chains for containing functions.
- Each link has a FUNCTION_DECL in the TREE_PURPOSE and a reg rtx
- in an RTL_EXPR in the TREE_VALUE. */
-static tree context_display;
-
-/* List (chain of TREE_LISTs) of trampolines for nested functions.
- The trampoline sets up the static chain and jumps to the function.
- We supply the trampoline's address when the function's address is requested.
-
- Each link has a FUNCTION_DECL in the TREE_PURPOSE and a reg rtx
- in an RTL_EXPR in the TREE_VALUE. */
-static tree trampoline_list;
-
-/* Insn after which register parms and SAVE_EXPRs are born, if nonopt. */
-static rtx parm_birth_insn;
-
-#if 0
-/* Nonzero if a stack slot has been generated whose address is not
- actually valid. It means that the generated rtl must all be scanned
- to detect and correct the invalid addresses where they occur. */
-static int invalid_stack_slot;
-#endif
-
-/* Last insn of those whose job was to put parms into their nominal homes. */
-static rtx last_parm_insn;
-
-/* 1 + last pseudo register number used for loading a copy
- of a parameter of this function. */
-static int max_parm_reg;
-
-/* Vector indexed by REGNO, containing location on stack in which
- to put the parm which is nominally in pseudo register REGNO,
- if we discover that that parm must go in the stack. */
-static rtx *parm_reg_stack_loc;
-
-/* Nonzero once virtual register instantiation has been done.
- assign_stack_local uses frame_pointer_rtx when this is nonzero. */
-static int virtuals_instantiated;
-
-/* These variables hold pointers to functions to
- save and restore machine-specific data,
- in push_function_context and pop_function_context. */
-void (*save_machine_status) PROTO((struct function *));
-void (*restore_machine_status) PROTO((struct function *));
-
-/* Nonzero if we need to distinguish between the return value of this function
- and the return value of a function called by this function. This helps
- integrate.c */
-
-extern int rtx_equal_function_value_matters;
-extern tree sequence_rtl_expr;
-
-/* In order to evaluate some expressions, such as function calls returning
- structures in memory, we need to temporarily allocate stack locations.
- We record each allocated temporary in the following structure.
-
- Associated with each temporary slot is a nesting level. When we pop up
- one level, all temporaries associated with the previous level are freed.
- Normally, all temporaries are freed after the execution of the statement
- in which they were created. However, if we are inside a ({...}) grouping,
- the result may be in a temporary and hence must be preserved. If the
- result could be in a temporary, we preserve it if we can determine which
- one it is in. If we cannot determine which temporary may contain the
- result, all temporaries are preserved. A temporary is preserved by
- pretending it was allocated at the previous nesting level.
-
- Automatic variables are also assigned temporary slots, at the nesting
- level where they are defined. They are marked a "kept" so that
- free_temp_slots will not free them. */
-
-struct temp_slot
-{
- /* Points to next temporary slot. */
- struct temp_slot *next;
- /* The rtx to used to reference the slot. */
- rtx slot;
- /* The rtx used to represent the address if not the address of the
- slot above. May be an EXPR_LIST if multiple addresses exist. */
- rtx address;
- /* The size, in units, of the slot. */
- int size;
- /* The value of `sequence_rtl_expr' when this temporary is allocated. */
- tree rtl_expr;
- /* Non-zero if this temporary is currently in use. */
- char in_use;
- /* Non-zero if this temporary has its address taken. */
- char addr_taken;
- /* Nesting level at which this slot is being used. */
- int level;
- /* Non-zero if this should survive a call to free_temp_slots. */
- int keep;
- /* The offset of the slot from the frame_pointer, including extra space
- for alignment. This info is for combine_temp_slots. */
- int base_offset;
- /* The size of the slot, including extra space for alignment. This
- info is for combine_temp_slots. */
- int full_size;
-};
-
-/* List of all temporaries allocated, both available and in use. */
-
-struct temp_slot *temp_slots;
-
-/* Current nesting level for temporaries. */
-
-int temp_slot_level;
-
-/* The FUNCTION_DECL node for the current function. */
-static tree this_function_decl;
-
-/* Callinfo pointer for the current function. */
-static rtx this_function_callinfo;
-
-/* The label in the bytecode file of this function's actual bytecode.
- Not an rtx. */
-static char *this_function_bytecode;
-
-/* The call description vector for the current function. */
-static rtx this_function_calldesc;
-
-/* Size of the local variables allocated for the current function. */
-int local_vars_size;
-
-/* Current depth of the bytecode evaluation stack. */
-int stack_depth;
-
-/* Maximum depth of the evaluation stack in this function. */
-int max_stack_depth;
-
-/* Current depth in statement expressions. */
-static int stmt_expr_depth;
-
-/* This structure is used to record MEMs or pseudos used to replace VAR, any
- SUBREGs of VAR, and any MEMs containing VAR as an address. We need to
- maintain this list in case two operands of an insn were required to match;
- in that case we must ensure we use the same replacement. */
-
-struct fixup_replacement
-{
- rtx old;
- rtx new;
- struct fixup_replacement *next;
-};
-
-/* Forward declarations. */
-
-static struct temp_slot *find_temp_slot_from_address PROTO((rtx));
-static void put_reg_into_stack PROTO((struct function *, rtx, tree,
- enum machine_mode, enum machine_mode,
- int));
-static void fixup_var_refs PROTO((rtx, enum machine_mode, int));
-static struct fixup_replacement
- *find_fixup_replacement PROTO((struct fixup_replacement **, rtx));
-static void fixup_var_refs_insns PROTO((rtx, enum machine_mode, int,
- rtx, int));
-static void fixup_var_refs_1 PROTO((rtx, enum machine_mode, rtx *, rtx,
- struct fixup_replacement **));
-static rtx fixup_memory_subreg PROTO((rtx, rtx, int));
-static rtx walk_fixup_memory_subreg PROTO((rtx, rtx, int));
-static rtx fixup_stack_1 PROTO((rtx, rtx));
-static void optimize_bit_field PROTO((rtx, rtx, rtx *));
-static void instantiate_decls PROTO((tree, int));
-static void instantiate_decls_1 PROTO((tree, int));
-static void instantiate_decl PROTO((rtx, int, int));
-static int instantiate_virtual_regs_1 PROTO((rtx *, rtx, int));
-static void delete_handlers PROTO((void));
-static void pad_to_arg_alignment PROTO((struct args_size *, int));
-static void pad_below PROTO((struct args_size *, enum machine_mode,
- tree));
-static tree round_down PROTO((tree, int));
-static rtx round_trampoline_addr PROTO((rtx));
-static tree blocks_nreverse PROTO((tree));
-static int all_blocks PROTO((tree, tree *));
-static int *record_insns PROTO((rtx));
-static int contains PROTO((rtx, int *));
-
-/* Pointer to chain of `struct function' for containing functions. */
-struct function *outer_function_chain;
-
-/* Given a function decl for a containing function,
- return the `struct function' for it. */
-
-struct function *
-find_function_data (decl)
- tree decl;
-{
- struct function *p;
- for (p = outer_function_chain; p; p = p->next)
- if (p->decl == decl)
- return p;
- abort ();
-}
-
-/* Save the current context for compilation of a nested function.
- This is called from language-specific code.
- The caller is responsible for saving any language-specific status,
- since this function knows only about language-independent variables. */
-
-void
-push_function_context_to (context)
- tree context;
-{
- struct function *p = (struct function *) xmalloc (sizeof (struct function));
-
- p->next = outer_function_chain;
- outer_function_chain = p;
-
- p->name = current_function_name;
- p->decl = current_function_decl;
- p->pops_args = current_function_pops_args;
- p->returns_struct = current_function_returns_struct;
- p->returns_pcc_struct = current_function_returns_pcc_struct;
- p->returns_pointer = current_function_returns_pointer;
- p->needs_context = current_function_needs_context;
- p->calls_setjmp = current_function_calls_setjmp;
- p->calls_longjmp = current_function_calls_longjmp;
- p->calls_alloca = current_function_calls_alloca;
- p->has_nonlocal_label = current_function_has_nonlocal_label;
- p->has_nonlocal_goto = current_function_has_nonlocal_goto;
- p->contains_functions = current_function_contains_functions;
- p->args_size = current_function_args_size;
- p->pretend_args_size = current_function_pretend_args_size;
- p->arg_offset_rtx = current_function_arg_offset_rtx;
- p->varargs = current_function_varargs;
- p->stdarg = current_function_stdarg;
- p->uses_const_pool = current_function_uses_const_pool;
- p->uses_pic_offset_table = current_function_uses_pic_offset_table;
- p->internal_arg_pointer = current_function_internal_arg_pointer;
- p->max_parm_reg = max_parm_reg;
- p->parm_reg_stack_loc = parm_reg_stack_loc;
- p->outgoing_args_size = current_function_outgoing_args_size;
- p->return_rtx = current_function_return_rtx;
- p->nonlocal_goto_handler_slot = nonlocal_goto_handler_slot;
- p->nonlocal_goto_stack_level = nonlocal_goto_stack_level;
- p->nonlocal_labels = nonlocal_labels;
- p->cleanup_label = cleanup_label;
- p->return_label = return_label;
- p->save_expr_regs = save_expr_regs;
- p->stack_slot_list = stack_slot_list;
- p->parm_birth_insn = parm_birth_insn;
- p->frame_offset = frame_offset;
- p->tail_recursion_label = tail_recursion_label;
- p->tail_recursion_reentry = tail_recursion_reentry;
- p->arg_pointer_save_area = arg_pointer_save_area;
- p->rtl_expr_chain = rtl_expr_chain;
- p->last_parm_insn = last_parm_insn;
- p->context_display = context_display;
- p->trampoline_list = trampoline_list;
- p->function_call_count = function_call_count;
- p->temp_slots = temp_slots;
- p->temp_slot_level = temp_slot_level;
- p->fixup_var_refs_queue = 0;
- p->epilogue_delay_list = current_function_epilogue_delay_list;
- p->args_info = current_function_args_info;
-
- save_tree_status (p, context);
- save_storage_status (p);
- save_emit_status (p);
- init_emit ();
- save_expr_status (p);
- save_stmt_status (p);
- save_varasm_status (p);
-
- if (save_machine_status)
- (*save_machine_status) (p);
-}
-
-void
-push_function_context ()
-{
- push_function_context_to (current_function_decl);
-}
-
-/* Restore the last saved context, at the end of a nested function.
- This function is called from language-specific code. */
-
-void
-pop_function_context_from (context)
- tree context;
-{
- struct function *p = outer_function_chain;
-
- outer_function_chain = p->next;
-
- current_function_contains_functions
- = p->contains_functions || p->inline_obstacks
- || context == current_function_decl;
- current_function_name = p->name;
- current_function_decl = p->decl;
- current_function_pops_args = p->pops_args;
- current_function_returns_struct = p->returns_struct;
- current_function_returns_pcc_struct = p->returns_pcc_struct;
- current_function_returns_pointer = p->returns_pointer;
- current_function_needs_context = p->needs_context;
- current_function_calls_setjmp = p->calls_setjmp;
- current_function_calls_longjmp = p->calls_longjmp;
- current_function_calls_alloca = p->calls_alloca;
- current_function_has_nonlocal_label = p->has_nonlocal_label;
- current_function_has_nonlocal_goto = p->has_nonlocal_goto;
- current_function_args_size = p->args_size;
- current_function_pretend_args_size = p->pretend_args_size;
- current_function_arg_offset_rtx = p->arg_offset_rtx;
- current_function_varargs = p->varargs;
- current_function_stdarg = p->stdarg;
- current_function_uses_const_pool = p->uses_const_pool;
- current_function_uses_pic_offset_table = p->uses_pic_offset_table;
- current_function_internal_arg_pointer = p->internal_arg_pointer;
- max_parm_reg = p->max_parm_reg;
- parm_reg_stack_loc = p->parm_reg_stack_loc;
- current_function_outgoing_args_size = p->outgoing_args_size;
- current_function_return_rtx = p->return_rtx;
- nonlocal_goto_handler_slot = p->nonlocal_goto_handler_slot;
- nonlocal_goto_stack_level = p->nonlocal_goto_stack_level;
- nonlocal_labels = p->nonlocal_labels;
- cleanup_label = p->cleanup_label;
- return_label = p->return_label;
- save_expr_regs = p->save_expr_regs;
- stack_slot_list = p->stack_slot_list;
- parm_birth_insn = p->parm_birth_insn;
- frame_offset = p->frame_offset;
- tail_recursion_label = p->tail_recursion_label;
- tail_recursion_reentry = p->tail_recursion_reentry;
- arg_pointer_save_area = p->arg_pointer_save_area;
- rtl_expr_chain = p->rtl_expr_chain;
- last_parm_insn = p->last_parm_insn;
- context_display = p->context_display;
- trampoline_list = p->trampoline_list;
- function_call_count = p->function_call_count;
- temp_slots = p->temp_slots;
- temp_slot_level = p->temp_slot_level;
- current_function_epilogue_delay_list = p->epilogue_delay_list;
- reg_renumber = 0;
- current_function_args_info = p->args_info;
-
- restore_tree_status (p);
- restore_storage_status (p);
- restore_expr_status (p);
- restore_emit_status (p);
- restore_stmt_status (p);
- restore_varasm_status (p);
-
- if (restore_machine_status)
- (*restore_machine_status) (p);
-
- /* Finish doing put_var_into_stack for any of our variables
- which became addressable during the nested function. */
- {
- struct var_refs_queue *queue = p->fixup_var_refs_queue;
- for (; queue; queue = queue->next)
- fixup_var_refs (queue->modified, queue->promoted_mode, queue->unsignedp);
- }
-
- free (p);
-
- /* Reset variables that have known state during rtx generation. */
- rtx_equal_function_value_matters = 1;
- virtuals_instantiated = 0;
-}
-
-void pop_function_context ()
-{
- pop_function_context_from (current_function_decl);
-}
-
-/* Allocate fixed slots in the stack frame of the current function. */
-
-/* Return size needed for stack frame based on slots so far allocated.
- This size counts from zero. It is not rounded to STACK_BOUNDARY;
- the caller may have to do that. */
-
-HOST_WIDE_INT
-get_frame_size ()
-{
-#ifdef FRAME_GROWS_DOWNWARD
- return -frame_offset;
-#else
- return frame_offset;
-#endif
-}
-
-/* Allocate a stack slot of SIZE bytes and return a MEM rtx for it
- with machine mode MODE.
-
- ALIGN controls the amount of alignment for the address of the slot:
- 0 means according to MODE,
- -1 means use BIGGEST_ALIGNMENT and round size to multiple of that,
- positive specifies alignment boundary in bits.
-
- We do not round to stack_boundary here. */
-
-rtx
-assign_stack_local (mode, size, align)
- enum machine_mode mode;
- int size;
- int align;
-{
- register rtx x, addr;
- int bigend_correction = 0;
- int alignment;
-
- if (align == 0)
- {
- alignment = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
- if (mode == BLKmode)
- alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- }
- else if (align == -1)
- {
- alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- size = CEIL_ROUND (size, alignment);
- }
- else
- alignment = align / BITS_PER_UNIT;
-
- /* Round frame offset to that alignment.
- We must be careful here, since FRAME_OFFSET might be negative and
- division with a negative dividend isn't as well defined as we might
- like. So we instead assume that ALIGNMENT is a power of two and
- use logical operations which are unambiguous. */
-#ifdef FRAME_GROWS_DOWNWARD
- frame_offset = FLOOR_ROUND (frame_offset, alignment);
-#else
- frame_offset = CEIL_ROUND (frame_offset, alignment);
-#endif
-
- /* On a big-endian machine, if we are allocating more space than we will use,
- use the least significant bytes of those that are allocated. */
- if (BYTES_BIG_ENDIAN && mode != BLKmode)
- bigend_correction = size - GET_MODE_SIZE (mode);
-
-#ifdef FRAME_GROWS_DOWNWARD
- frame_offset -= size;
-#endif
-
- /* If we have already instantiated virtual registers, return the actual
- address relative to the frame pointer. */
- if (virtuals_instantiated)
- addr = plus_constant (frame_pointer_rtx,
- (frame_offset + bigend_correction
- + STARTING_FRAME_OFFSET));
- else
- addr = plus_constant (virtual_stack_vars_rtx,
- frame_offset + bigend_correction);
-
-#ifndef FRAME_GROWS_DOWNWARD
- frame_offset += size;
-#endif
-
- x = gen_rtx (MEM, mode, addr);
-
- stack_slot_list = gen_rtx (EXPR_LIST, VOIDmode, x, stack_slot_list);
-
- return x;
-}
-
-/* Assign a stack slot in a containing function.
- First three arguments are same as in preceding function.
- The last argument specifies the function to allocate in. */
-
-rtx
-assign_outer_stack_local (mode, size, align, function)
- enum machine_mode mode;
- int size;
- int align;
- struct function *function;
-{
- register rtx x, addr;
- int bigend_correction = 0;
- int alignment;
-
- /* Allocate in the memory associated with the function in whose frame
- we are assigning. */
- push_obstacks (function->function_obstack,
- function->function_maybepermanent_obstack);
-
- if (align == 0)
- {
- alignment = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
- if (mode == BLKmode)
- alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- }
- else if (align == -1)
- {
- alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- size = CEIL_ROUND (size, alignment);
- }
- else
- alignment = align / BITS_PER_UNIT;
-
- /* Round frame offset to that alignment. */
-#ifdef FRAME_GROWS_DOWNWARD
- function->frame_offset = FLOOR_ROUND (function->frame_offset, alignment);
-#else
- function->frame_offset = CEIL_ROUND (function->frame_offset, alignment);
-#endif
-
- /* On a big-endian machine, if we are allocating more space than we will use,
- use the least significant bytes of those that are allocated. */
- if (BYTES_BIG_ENDIAN && mode != BLKmode)
- bigend_correction = size - GET_MODE_SIZE (mode);
-
-#ifdef FRAME_GROWS_DOWNWARD
- function->frame_offset -= size;
-#endif
- addr = plus_constant (virtual_stack_vars_rtx,
- function->frame_offset + bigend_correction);
-#ifndef FRAME_GROWS_DOWNWARD
- function->frame_offset += size;
-#endif
-
- x = gen_rtx (MEM, mode, addr);
-
- function->stack_slot_list
- = gen_rtx (EXPR_LIST, VOIDmode, x, function->stack_slot_list);
-
- pop_obstacks ();
-
- return x;
-}
-
-/* Allocate a temporary stack slot and record it for possible later
- reuse.
-
- MODE is the machine mode to be given to the returned rtx.
-
- SIZE is the size in units of the space required. We do no rounding here
- since assign_stack_local will do any required rounding.
-
- KEEP is 1 if this slot is to be retained after a call to
- free_temp_slots. Automatic variables for a block are allocated
- with this flag. KEEP is 2, if we allocate a longer term temporary,
- whose lifetime is controlled by CLEANUP_POINT_EXPRs. */
-
-rtx
-assign_stack_temp (mode, size, keep)
- enum machine_mode mode;
- int size;
- int keep;
-{
- struct temp_slot *p, *best_p = 0;
-
- /* If SIZE is -1 it means that somebody tried to allocate a temporary
- of a variable size. */
- if (size == -1)
- abort ();
-
- /* First try to find an available, already-allocated temporary that is the
- exact size we require. */
- for (p = temp_slots; p; p = p->next)
- if (p->size == size && GET_MODE (p->slot) == mode && ! p->in_use)
- break;
-
- /* If we didn't find, one, try one that is larger than what we want. We
- find the smallest such. */
- if (p == 0)
- for (p = temp_slots; p; p = p->next)
- if (p->size > size && GET_MODE (p->slot) == mode && ! p->in_use
- && (best_p == 0 || best_p->size > p->size))
- best_p = p;
-
- /* Make our best, if any, the one to use. */
- if (best_p)
- {
- /* If there are enough aligned bytes left over, make them into a new
- temp_slot so that the extra bytes don't get wasted. Do this only
- for BLKmode slots, so that we can be sure of the alignment. */
- if (GET_MODE (best_p->slot) == BLKmode)
- {
- int alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- int rounded_size = CEIL_ROUND (size, alignment);
-
- if (best_p->size - rounded_size >= alignment)
- {
- p = (struct temp_slot *) oballoc (sizeof (struct temp_slot));
- p->in_use = p->addr_taken = 0;
- p->size = best_p->size - rounded_size;
- p->base_offset = best_p->base_offset + rounded_size;
- p->full_size = best_p->full_size - rounded_size;
- p->slot = gen_rtx (MEM, BLKmode,
- plus_constant (XEXP (best_p->slot, 0),
- rounded_size));
- p->address = 0;
- p->rtl_expr = 0;
- p->next = temp_slots;
- temp_slots = p;
-
- stack_slot_list = gen_rtx (EXPR_LIST, VOIDmode, p->slot,
- stack_slot_list);
-
- best_p->size = rounded_size;
- best_p->full_size = rounded_size;
- }
- }
-
- p = best_p;
- }
-
- /* If we still didn't find one, make a new temporary. */
- if (p == 0)
- {
- int frame_offset_old = frame_offset;
- p = (struct temp_slot *) oballoc (sizeof (struct temp_slot));
- /* If the temp slot mode doesn't indicate the alignment,
- use the largest possible, so no one will be disappointed. */
- p->slot = assign_stack_local (mode, size, mode == BLKmode ? -1 : 0);
- /* The following slot size computation is necessary because we don't
- know the actual size of the temporary slot until assign_stack_local
- has performed all the frame alignment and size rounding for the
- requested temporary. Note that extra space added for alignment
- can be either above or below this stack slot depending on which
- way the frame grows. We include the extra space if and only if it
- is above this slot. */
-#ifdef FRAME_GROWS_DOWNWARD
- p->size = frame_offset_old - frame_offset;
-#else
- p->size = size;
-#endif
- /* Now define the fields used by combine_temp_slots. */
-#ifdef FRAME_GROWS_DOWNWARD
- p->base_offset = frame_offset;
- p->full_size = frame_offset_old - frame_offset;
-#else
- p->base_offset = frame_offset_old;
- p->full_size = frame_offset - frame_offset_old;
-#endif
- p->address = 0;
- p->next = temp_slots;
- temp_slots = p;
- }
-
- p->in_use = 1;
- p->addr_taken = 0;
- p->rtl_expr = sequence_rtl_expr;
-
- if (keep == 2)
- {
- p->level = target_temp_slot_level;
- p->keep = 0;
- }
- else
- {
- p->level = temp_slot_level;
- p->keep = keep;
- }
-
- /* We may be reusing an old slot, so clear any MEM flags that may have been
- set from before. */
- RTX_UNCHANGING_P (p->slot) = 0;
- MEM_IN_STRUCT_P (p->slot) = 0;
- return p->slot;
-}
-
-/* Assign a temporary of given TYPE.
- KEEP is as for assign_stack_temp.
- MEMORY_REQUIRED is 1 if the result must be addressable stack memory;
- it is 0 if a register is OK.
- DONT_PROMOTE is 1 if we should not promote values in register
- to wider modes. */
-
-rtx
-assign_temp (type, keep, memory_required, dont_promote)
- tree type;
- int keep;
- int memory_required;
- int dont_promote;
-{
- enum machine_mode mode = TYPE_MODE (type);
- int unsignedp = TREE_UNSIGNED (type);
-
- if (mode == BLKmode || memory_required)
- {
- int size = int_size_in_bytes (type);
- rtx tmp;
-
- /* Unfortunately, we don't yet know how to allocate variable-sized
- temporaries. However, sometimes we have a fixed upper limit on
- the size (which is stored in TYPE_ARRAY_MAX_SIZE) and can use that
- instead. This is the case for Chill variable-sized strings. */
- if (size == -1 && TREE_CODE (type) == ARRAY_TYPE
- && TYPE_ARRAY_MAX_SIZE (type) != NULL_TREE
- && TREE_CODE (TYPE_ARRAY_MAX_SIZE (type)) == INTEGER_CST)
- size = TREE_INT_CST_LOW (TYPE_ARRAY_MAX_SIZE (type));
-
- tmp = assign_stack_temp (mode, size, keep);
- MEM_IN_STRUCT_P (tmp) = AGGREGATE_TYPE_P (type);
- return tmp;
- }
-
-#ifndef PROMOTE_FOR_CALL_ONLY
- if (! dont_promote)
- mode = promote_mode (type, mode, &unsignedp, 0);
-#endif
-
- return gen_reg_rtx (mode);
-}
-
-/* Combine temporary stack slots which are adjacent on the stack.
-
- This allows for better use of already allocated stack space. This is only
- done for BLKmode slots because we can be sure that we won't have alignment
- problems in this case. */
-
-void
-combine_temp_slots ()
-{
- struct temp_slot *p, *q;
- struct temp_slot *prev_p, *prev_q;
- /* Determine where to free back to after this function. */
- rtx free_pointer = rtx_alloc (CONST_INT);
-
- for (p = temp_slots, prev_p = 0; p; p = prev_p ? prev_p->next : temp_slots)
- {
- int delete_p = 0;
- if (! p->in_use && GET_MODE (p->slot) == BLKmode)
- for (q = p->next, prev_q = p; q; q = prev_q->next)
- {
- int delete_q = 0;
- if (! q->in_use && GET_MODE (q->slot) == BLKmode)
- {
- if (p->base_offset + p->full_size == q->base_offset)
- {
- /* Q comes after P; combine Q into P. */
- p->size += q->size;
- p->full_size += q->full_size;
- delete_q = 1;
- }
- else if (q->base_offset + q->full_size == p->base_offset)
- {
- /* P comes after Q; combine P into Q. */
- q->size += p->size;
- q->full_size += p->full_size;
- delete_p = 1;
- break;
- }
- }
- /* Either delete Q or advance past it. */
- if (delete_q)
- prev_q->next = q->next;
- else
- prev_q = q;
- }
- /* Either delete P or advance past it. */
- if (delete_p)
- {
- if (prev_p)
- prev_p->next = p->next;
- else
- temp_slots = p->next;
- }
- else
- prev_p = p;
- }
-
- /* Free all the RTL made by plus_constant. */
- rtx_free (free_pointer);
-}
-
-/* Find the temp slot corresponding to the object at address X. */
-
-static struct temp_slot *
-find_temp_slot_from_address (x)
- rtx x;
-{
- struct temp_slot *p;
- rtx next;
-
- for (p = temp_slots; p; p = p->next)
- {
- if (! p->in_use)
- continue;
- else if (XEXP (p->slot, 0) == x
- || p->address == x
- || (GET_CODE (x) == PLUS
- && XEXP (x, 0) == virtual_stack_vars_rtx
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) >= p->base_offset
- && INTVAL (XEXP (x, 1)) < p->base_offset + p->full_size))
- return p;
-
- else if (p->address != 0 && GET_CODE (p->address) == EXPR_LIST)
- for (next = p->address; next; next = XEXP (next, 1))
- if (XEXP (next, 0) == x)
- return p;
- }
-
- return 0;
-}
-
-/* Indicate that NEW is an alternate way of referring to the temp slot
- that previous was known by OLD. */
-
-void
-update_temp_slot_address (old, new)
- rtx old, new;
-{
- struct temp_slot *p = find_temp_slot_from_address (old);
-
- /* If none, return. Else add NEW as an alias. */
- if (p == 0)
- return;
- else if (p->address == 0)
- p->address = new;
- else
- {
- if (GET_CODE (p->address) != EXPR_LIST)
- p->address = gen_rtx (EXPR_LIST, VOIDmode, p->address, NULL_RTX);
-
- p->address = gen_rtx (EXPR_LIST, VOIDmode, new, p->address);
- }
-}
-
-/* If X could be a reference to a temporary slot, mark the fact that its
- address was taken. */
-
-void
-mark_temp_addr_taken (x)
- rtx x;
-{
- struct temp_slot *p;
-
- if (x == 0)
- return;
-
- /* If X is not in memory or is at a constant address, it cannot be in
- a temporary slot. */
- if (GET_CODE (x) != MEM || CONSTANT_P (XEXP (x, 0)))
- return;
-
- p = find_temp_slot_from_address (XEXP (x, 0));
- if (p != 0)
- p->addr_taken = 1;
-}
-
-/* If X could be a reference to a temporary slot, mark that slot as
- belonging to the to one level higher than the current level. If X
- matched one of our slots, just mark that one. Otherwise, we can't
- easily predict which it is, so upgrade all of them. Kept slots
- need not be touched.
-
- This is called when an ({...}) construct occurs and a statement
- returns a value in memory. */
-
-void
-preserve_temp_slots (x)
- rtx x;
-{
- struct temp_slot *p = 0;
-
- /* If there is no result, we still might have some objects whose address
- were taken, so we need to make sure they stay around. */
- if (x == 0)
- {
- for (p = temp_slots; p; p = p->next)
- if (p->in_use && p->level == temp_slot_level && p->addr_taken)
- p->level--;
-
- return;
- }
-
- /* If X is a register that is being used as a pointer, see if we have
- a temporary slot we know it points to. To be consistent with
- the code below, we really should preserve all non-kept slots
- if we can't find a match, but that seems to be much too costly. */
- if (GET_CODE (x) == REG && REGNO_POINTER_FLAG (REGNO (x)))
- p = find_temp_slot_from_address (x);
-
- /* If X is not in memory or is at a constant address, it cannot be in
- a temporary slot, but it can contain something whose address was
- taken. */
- if (p == 0 && (GET_CODE (x) != MEM || CONSTANT_P (XEXP (x, 0))))
- {
- for (p = temp_slots; p; p = p->next)
- if (p->in_use && p->level == temp_slot_level && p->addr_taken)
- p->level--;
-
- return;
- }
-
- /* First see if we can find a match. */
- if (p == 0)
- p = find_temp_slot_from_address (XEXP (x, 0));
-
- if (p != 0)
- {
- /* Move everything at our level whose address was taken to our new
- level in case we used its address. */
- struct temp_slot *q;
-
- if (p->level == temp_slot_level)
- {
- for (q = temp_slots; q; q = q->next)
- if (q != p && q->addr_taken && q->level == p->level)
- q->level--;
-
- p->level--;
- p->addr_taken = 0;
- }
- return;
- }
-
- /* Otherwise, preserve all non-kept slots at this level. */
- for (p = temp_slots; p; p = p->next)
- if (p->in_use && p->level == temp_slot_level && ! p->keep)
- p->level--;
-}
-
-/* X is the result of an RTL_EXPR. If it is a temporary slot associated
- with that RTL_EXPR, promote it into a temporary slot at the present
- level so it will not be freed when we free slots made in the
- RTL_EXPR. */
-
-void
-preserve_rtl_expr_result (x)
- rtx x;
-{
- struct temp_slot *p;
-
- /* If X is not in memory or is at a constant address, it cannot be in
- a temporary slot. */
- if (x == 0 || GET_CODE (x) != MEM || CONSTANT_P (XEXP (x, 0)))
- return;
-
- /* If we can find a match, move it to our level unless it is already at
- an upper level. */
- p = find_temp_slot_from_address (XEXP (x, 0));
- if (p != 0)
- {
- p->level = MIN (p->level, temp_slot_level);
- p->rtl_expr = 0;
- }
-
- return;
-}
-
-/* Free all temporaries used so far. This is normally called at the end
- of generating code for a statement. Don't free any temporaries
- currently in use for an RTL_EXPR that hasn't yet been emitted.
- We could eventually do better than this since it can be reused while
- generating the same RTL_EXPR, but this is complex and probably not
- worthwhile. */
-
-void
-free_temp_slots ()
-{
- struct temp_slot *p;
-
- for (p = temp_slots; p; p = p->next)
- if (p->in_use && p->level == temp_slot_level && ! p->keep
- && p->rtl_expr == 0)
- p->in_use = 0;
-
- combine_temp_slots ();
-}
-
-/* Free all temporary slots used in T, an RTL_EXPR node. */
-
-void
-free_temps_for_rtl_expr (t)
- tree t;
-{
- struct temp_slot *p;
-
- for (p = temp_slots; p; p = p->next)
- if (p->rtl_expr == t)
- p->in_use = 0;
-
- combine_temp_slots ();
-}
-
-/* Mark all temporaries ever allocated in this functon as not suitable
- for reuse until the current level is exited. */
-
-void
-mark_all_temps_used ()
-{
- struct temp_slot *p;
-
- for (p = temp_slots; p; p = p->next)
- {
- p->in_use = p->keep = 1;
- p->level = MIN (p->level, temp_slot_level);
- }
-}
-
-/* Push deeper into the nesting level for stack temporaries. */
-
-void
-push_temp_slots ()
-{
- temp_slot_level++;
-}
-
-/* Pop a temporary nesting level. All slots in use in the current level
- are freed. */
-
-void
-pop_temp_slots ()
-{
- struct temp_slot *p;
-
- for (p = temp_slots; p; p = p->next)
- if (p->in_use && p->level == temp_slot_level && p->rtl_expr == 0)
- p->in_use = 0;
-
- combine_temp_slots ();
-
- temp_slot_level--;
-}
-
-/* Initialize temporary slots. */
-
-void
-init_temp_slots ()
-{
- /* We have not allocated any temporaries yet. */
- temp_slots = 0;
- temp_slot_level = 0;
- target_temp_slot_level = 0;
-}
-
-/* Retroactively move an auto variable from a register to a stack slot.
- This is done when an address-reference to the variable is seen. */
-
-void
-put_var_into_stack (decl)
- tree decl;
-{
- register rtx reg;
- enum machine_mode promoted_mode, decl_mode;
- struct function *function = 0;
- tree context;
-
- if (output_bytecode)
- return;
-
- context = decl_function_context (decl);
-
- /* Get the current rtl used for this object and it's original mode. */
- reg = TREE_CODE (decl) == SAVE_EXPR ? SAVE_EXPR_RTL (decl) : DECL_RTL (decl);
-
- /* No need to do anything if decl has no rtx yet
- since in that case caller is setting TREE_ADDRESSABLE
- and a stack slot will be assigned when the rtl is made. */
- if (reg == 0)
- return;
-
- /* Get the declared mode for this object. */
- decl_mode = (TREE_CODE (decl) == SAVE_EXPR ? TYPE_MODE (TREE_TYPE (decl))
- : DECL_MODE (decl));
- /* Get the mode it's actually stored in. */
- promoted_mode = GET_MODE (reg);
-
- /* If this variable comes from an outer function,
- find that function's saved context. */
- if (context != current_function_decl)
- for (function = outer_function_chain; function; function = function->next)
- if (function->decl == context)
- break;
-
- /* If this is a variable-size object with a pseudo to address it,
- put that pseudo into the stack, if the var is nonlocal. */
- if (DECL_NONLOCAL (decl)
- && GET_CODE (reg) == MEM
- && GET_CODE (XEXP (reg, 0)) == REG
- && REGNO (XEXP (reg, 0)) > LAST_VIRTUAL_REGISTER)
- {
- reg = XEXP (reg, 0);
- decl_mode = promoted_mode = GET_MODE (reg);
- }
-
- /* Now we should have a value that resides in one or more pseudo regs. */
-
- if (GET_CODE (reg) == REG)
- put_reg_into_stack (function, reg, TREE_TYPE (decl),
- promoted_mode, decl_mode, TREE_SIDE_EFFECTS (decl));
- else if (GET_CODE (reg) == CONCAT)
- {
- /* A CONCAT contains two pseudos; put them both in the stack.
- We do it so they end up consecutive. */
- enum machine_mode part_mode = GET_MODE (XEXP (reg, 0));
- tree part_type = TREE_TYPE (TREE_TYPE (decl));
-#ifdef FRAME_GROWS_DOWNWARD
- /* Since part 0 should have a lower address, do it second. */
- put_reg_into_stack (function, XEXP (reg, 1), part_type, part_mode,
- part_mode, TREE_SIDE_EFFECTS (decl));
- put_reg_into_stack (function, XEXP (reg, 0), part_type, part_mode,
- part_mode, TREE_SIDE_EFFECTS (decl));
-#else
- put_reg_into_stack (function, XEXP (reg, 0), part_type, part_mode,
- part_mode, TREE_SIDE_EFFECTS (decl));
- put_reg_into_stack (function, XEXP (reg, 1), part_type, part_mode,
- part_mode, TREE_SIDE_EFFECTS (decl));
-#endif
-
- /* Change the CONCAT into a combined MEM for both parts. */
- PUT_CODE (reg, MEM);
- MEM_VOLATILE_P (reg) = MEM_VOLATILE_P (XEXP (reg, 0));
-
- /* The two parts are in memory order already.
- Use the lower parts address as ours. */
- XEXP (reg, 0) = XEXP (XEXP (reg, 0), 0);
- /* Prevent sharing of rtl that might lose. */
- if (GET_CODE (XEXP (reg, 0)) == PLUS)
- XEXP (reg, 0) = copy_rtx (XEXP (reg, 0));
- }
-}
-
-/* Subroutine of put_var_into_stack. This puts a single pseudo reg REG
- into the stack frame of FUNCTION (0 means the current function).
- DECL_MODE is the machine mode of the user-level data type.
- PROMOTED_MODE is the machine mode of the register.
- VOLATILE_P is nonzero if this is for a "volatile" decl. */
-
-static void
-put_reg_into_stack (function, reg, type, promoted_mode, decl_mode, volatile_p)
- struct function *function;
- rtx reg;
- tree type;
- enum machine_mode promoted_mode, decl_mode;
- int volatile_p;
-{
- rtx new = 0;
-
- if (function)
- {
- if (REGNO (reg) < function->max_parm_reg)
- new = function->parm_reg_stack_loc[REGNO (reg)];
- if (new == 0)
- new = assign_outer_stack_local (decl_mode, GET_MODE_SIZE (decl_mode),
- 0, function);
- }
- else
- {
- if (REGNO (reg) < max_parm_reg)
- new = parm_reg_stack_loc[REGNO (reg)];
- if (new == 0)
- new = assign_stack_local (decl_mode, GET_MODE_SIZE (decl_mode), 0);
- }
-
- PUT_MODE (reg, decl_mode);
- XEXP (reg, 0) = XEXP (new, 0);
- /* `volatil' bit means one thing for MEMs, another entirely for REGs. */
- MEM_VOLATILE_P (reg) = volatile_p;
- PUT_CODE (reg, MEM);
-
- /* If this is a memory ref that contains aggregate components,
- mark it as such for cse and loop optimize. */
- MEM_IN_STRUCT_P (reg) = AGGREGATE_TYPE_P (type);
-
- /* Now make sure that all refs to the variable, previously made
- when it was a register, are fixed up to be valid again. */
- if (function)
- {
- struct var_refs_queue *temp;
-
- /* Variable is inherited; fix it up when we get back to its function. */
- push_obstacks (function->function_obstack,
- function->function_maybepermanent_obstack);
-
- /* See comment in restore_tree_status in tree.c for why this needs to be
- on saveable obstack. */
- temp
- = (struct var_refs_queue *) savealloc (sizeof (struct var_refs_queue));
- temp->modified = reg;
- temp->promoted_mode = promoted_mode;
- temp->unsignedp = TREE_UNSIGNED (type);
- temp->next = function->fixup_var_refs_queue;
- function->fixup_var_refs_queue = temp;
- pop_obstacks ();
- }
- else
- /* Variable is local; fix it up now. */
- fixup_var_refs (reg, promoted_mode, TREE_UNSIGNED (type));
-}
-
-static void
-fixup_var_refs (var, promoted_mode, unsignedp)
- rtx var;
- enum machine_mode promoted_mode;
- int unsignedp;
-{
- tree pending;
- rtx first_insn = get_insns ();
- struct sequence_stack *stack = sequence_stack;
- tree rtl_exps = rtl_expr_chain;
-
- /* Must scan all insns for stack-refs that exceed the limit. */
- fixup_var_refs_insns (var, promoted_mode, unsignedp, first_insn, stack == 0);
-
- /* Scan all pending sequences too. */
- for (; stack; stack = stack->next)
- {
- push_to_sequence (stack->first);
- fixup_var_refs_insns (var, promoted_mode, unsignedp,
- stack->first, stack->next != 0);
- /* Update remembered end of sequence
- in case we added an insn at the end. */
- stack->last = get_last_insn ();
- end_sequence ();
- }
-
- /* Scan all waiting RTL_EXPRs too. */
- for (pending = rtl_exps; pending; pending = TREE_CHAIN (pending))
- {
- rtx seq = RTL_EXPR_SEQUENCE (TREE_VALUE (pending));
- if (seq != const0_rtx && seq != 0)
- {
- push_to_sequence (seq);
- fixup_var_refs_insns (var, promoted_mode, unsignedp, seq, 0);
- end_sequence ();
- }
- }
-}
-
-/* REPLACEMENTS is a pointer to a list of the struct fixup_replacement and X is
- some part of an insn. Return a struct fixup_replacement whose OLD
- value is equal to X. Allocate a new structure if no such entry exists. */
-
-static struct fixup_replacement *
-find_fixup_replacement (replacements, x)
- struct fixup_replacement **replacements;
- rtx x;
-{
- struct fixup_replacement *p;
-
- /* See if we have already replaced this. */
- for (p = *replacements; p && p->old != x; p = p->next)
- ;
-
- if (p == 0)
- {
- p = (struct fixup_replacement *) oballoc (sizeof (struct fixup_replacement));
- p->old = x;
- p->new = 0;
- p->next = *replacements;
- *replacements = p;
- }
-
- return p;
-}
-
-/* Scan the insn-chain starting with INSN for refs to VAR
- and fix them up. TOPLEVEL is nonzero if this chain is the
- main chain of insns for the current function. */
-
-static void
-fixup_var_refs_insns (var, promoted_mode, unsignedp, insn, toplevel)
- rtx var;
- enum machine_mode promoted_mode;
- int unsignedp;
- rtx insn;
- int toplevel;
-{
- rtx call_dest = 0;
-
- while (insn)
- {
- rtx next = NEXT_INSN (insn);
- rtx note;
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- /* If this is a CLOBBER of VAR, delete it.
-
- If it has a REG_LIBCALL note, delete the REG_LIBCALL
- and REG_RETVAL notes too. */
- if (GET_CODE (PATTERN (insn)) == CLOBBER
- && XEXP (PATTERN (insn), 0) == var)
- {
- if ((note = find_reg_note (insn, REG_LIBCALL, NULL_RTX)) != 0)
- /* The REG_LIBCALL note will go away since we are going to
- turn INSN into a NOTE, so just delete the
- corresponding REG_RETVAL note. */
- remove_note (XEXP (note, 0),
- find_reg_note (XEXP (note, 0), REG_RETVAL,
- NULL_RTX));
-
- /* In unoptimized compilation, we shouldn't call delete_insn
- except in jump.c doing warnings. */
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- }
-
- /* The insn to load VAR from a home in the arglist
- is now a no-op. When we see it, just delete it. */
- else if (toplevel
- && GET_CODE (PATTERN (insn)) == SET
- && SET_DEST (PATTERN (insn)) == var
- /* If this represents the result of an insn group,
- don't delete the insn. */
- && find_reg_note (insn, REG_RETVAL, NULL_RTX) == 0
- && rtx_equal_p (SET_SRC (PATTERN (insn)), var))
- {
- /* In unoptimized compilation, we shouldn't call delete_insn
- except in jump.c doing warnings. */
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- if (insn == last_parm_insn)
- last_parm_insn = PREV_INSN (next);
- }
- else
- {
- struct fixup_replacement *replacements = 0;
- rtx next_insn = NEXT_INSN (insn);
-
-#ifdef SMALL_REGISTER_CLASSES
- /* If the insn that copies the results of a CALL_INSN
- into a pseudo now references VAR, we have to use an
- intermediate pseudo since we want the life of the
- return value register to be only a single insn.
-
- If we don't use an intermediate pseudo, such things as
- address computations to make the address of VAR valid
- if it is not can be placed between the CALL_INSN and INSN.
-
- To make sure this doesn't happen, we record the destination
- of the CALL_INSN and see if the next insn uses both that
- and VAR. */
-
- if (SMALL_REGISTER_CLASSES)
- {
- if (call_dest != 0 && GET_CODE (insn) == INSN
- && reg_mentioned_p (var, PATTERN (insn))
- && reg_mentioned_p (call_dest, PATTERN (insn)))
- {
- rtx temp = gen_reg_rtx (GET_MODE (call_dest));
-
- emit_insn_before (gen_move_insn (temp, call_dest), insn);
-
- PATTERN (insn) = replace_rtx (PATTERN (insn),
- call_dest, temp);
- }
-
- if (GET_CODE (insn) == CALL_INSN
- && GET_CODE (PATTERN (insn)) == SET)
- call_dest = SET_DEST (PATTERN (insn));
- else if (GET_CODE (insn) == CALL_INSN
- && GET_CODE (PATTERN (insn)) == PARALLEL
- && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET)
- call_dest = SET_DEST (XVECEXP (PATTERN (insn), 0, 0));
- else
- call_dest = 0;
- }
-#endif
-
- /* See if we have to do anything to INSN now that VAR is in
- memory. If it needs to be loaded into a pseudo, use a single
- pseudo for the entire insn in case there is a MATCH_DUP
- between two operands. We pass a pointer to the head of
- a list of struct fixup_replacements. If fixup_var_refs_1
- needs to allocate pseudos or replacement MEMs (for SUBREGs),
- it will record them in this list.
-
- If it allocated a pseudo for any replacement, we copy into
- it here. */
-
- fixup_var_refs_1 (var, promoted_mode, &PATTERN (insn), insn,
- &replacements);
-
- /* If this is last_parm_insn, and any instructions were output
- after it to fix it up, then we must set last_parm_insn to
- the last such instruction emitted. */
- if (insn == last_parm_insn)
- last_parm_insn = PREV_INSN (next_insn);
-
- while (replacements)
- {
- if (GET_CODE (replacements->new) == REG)
- {
- rtx insert_before;
- rtx seq;
-
- /* OLD might be a (subreg (mem)). */
- if (GET_CODE (replacements->old) == SUBREG)
- replacements->old
- = fixup_memory_subreg (replacements->old, insn, 0);
- else
- replacements->old
- = fixup_stack_1 (replacements->old, insn);
-
- insert_before = insn;
-
- /* If we are changing the mode, do a conversion.
- This might be wasteful, but combine.c will
- eliminate much of the waste. */
-
- if (GET_MODE (replacements->new)
- != GET_MODE (replacements->old))
- {
- start_sequence ();
- convert_move (replacements->new,
- replacements->old, unsignedp);
- seq = gen_sequence ();
- end_sequence ();
- }
- else
- seq = gen_move_insn (replacements->new,
- replacements->old);
-
- emit_insn_before (seq, insert_before);
- }
-
- replacements = replacements->next;
- }
- }
-
- /* Also fix up any invalid exprs in the REG_NOTES of this insn.
- But don't touch other insns referred to by reg-notes;
- we will get them elsewhere. */
- for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
- if (GET_CODE (note) != INSN_LIST)
- XEXP (note, 0)
- = walk_fixup_memory_subreg (XEXP (note, 0), insn, 1);
- }
- insn = next;
- }
-}
-
-/* VAR is a MEM that used to be a pseudo register with mode PROMOTED_MODE.
- See if the rtx expression at *LOC in INSN needs to be changed.
-
- REPLACEMENTS is a pointer to a list head that starts out zero, but may
- contain a list of original rtx's and replacements. If we find that we need
- to modify this insn by replacing a memory reference with a pseudo or by
- making a new MEM to implement a SUBREG, we consult that list to see if
- we have already chosen a replacement. If none has already been allocated,
- we allocate it and update the list. fixup_var_refs_insns will copy VAR
- or the SUBREG, as appropriate, to the pseudo. */
-
-static void
-fixup_var_refs_1 (var, promoted_mode, loc, insn, replacements)
- register rtx var;
- enum machine_mode promoted_mode;
- register rtx *loc;
- rtx insn;
- struct fixup_replacement **replacements;
-{
- register int i;
- register rtx x = *loc;
- RTX_CODE code = GET_CODE (x);
- register char *fmt;
- register rtx tem, tem1;
- struct fixup_replacement *replacement;
-
- switch (code)
- {
- case MEM:
- if (var == x)
- {
- /* If we already have a replacement, use it. Otherwise,
- try to fix up this address in case it is invalid. */
-
- replacement = find_fixup_replacement (replacements, var);
- if (replacement->new)
- {
- *loc = replacement->new;
- return;
- }
-
- *loc = replacement->new = x = fixup_stack_1 (x, insn);
-
- /* Unless we are forcing memory to register or we changed the mode,
- we can leave things the way they are if the insn is valid. */
-
- INSN_CODE (insn) = -1;
- if (! flag_force_mem && GET_MODE (x) == promoted_mode
- && recog_memoized (insn) >= 0)
- return;
-
- *loc = replacement->new = gen_reg_rtx (promoted_mode);
- return;
- }
-
- /* If X contains VAR, we need to unshare it here so that we update
- each occurrence separately. But all identical MEMs in one insn
- must be replaced with the same rtx because of the possibility of
- MATCH_DUPs. */
-
- if (reg_mentioned_p (var, x))
- {
- replacement = find_fixup_replacement (replacements, x);
- if (replacement->new == 0)
- replacement->new = copy_most_rtx (x, var);
-
- *loc = x = replacement->new;
- }
- break;
-
- case REG:
- case CC0:
- case PC:
- case CONST_INT:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST_DOUBLE:
- return;
-
- case SIGN_EXTRACT:
- case ZERO_EXTRACT:
- /* Note that in some cases those types of expressions are altered
- by optimize_bit_field, and do not survive to get here. */
- if (XEXP (x, 0) == var
- || (GET_CODE (XEXP (x, 0)) == SUBREG
- && SUBREG_REG (XEXP (x, 0)) == var))
- {
- /* Get TEM as a valid MEM in the mode presently in the insn.
-
- We don't worry about the possibility of MATCH_DUP here; it
- is highly unlikely and would be tricky to handle. */
-
- tem = XEXP (x, 0);
- if (GET_CODE (tem) == SUBREG)
- {
- if (GET_MODE_BITSIZE (GET_MODE (tem))
- > GET_MODE_BITSIZE (GET_MODE (var)))
- {
- replacement = find_fixup_replacement (replacements, var);
- if (replacement->new == 0)
- replacement->new = gen_reg_rtx (GET_MODE (var));
- SUBREG_REG (tem) = replacement->new;
- }
- else
- tem = fixup_memory_subreg (tem, insn, 0);
- }
- else
- tem = fixup_stack_1 (tem, insn);
-
- /* Unless we want to load from memory, get TEM into the proper mode
- for an extract from memory. This can only be done if the
- extract is at a constant position and length. */
-
- if (! flag_force_mem && GET_CODE (XEXP (x, 1)) == CONST_INT
- && GET_CODE (XEXP (x, 2)) == CONST_INT
- && ! mode_dependent_address_p (XEXP (tem, 0))
- && ! MEM_VOLATILE_P (tem))
- {
- enum machine_mode wanted_mode = VOIDmode;
- enum machine_mode is_mode = GET_MODE (tem);
- int width = INTVAL (XEXP (x, 1));
- int pos = INTVAL (XEXP (x, 2));
-
-#ifdef HAVE_extzv
- if (GET_CODE (x) == ZERO_EXTRACT)
- wanted_mode = insn_operand_mode[(int) CODE_FOR_extzv][1];
-#endif
-#ifdef HAVE_extv
- if (GET_CODE (x) == SIGN_EXTRACT)
- wanted_mode = insn_operand_mode[(int) CODE_FOR_extv][1];
-#endif
- /* If we have a narrower mode, we can do something. */
- if (wanted_mode != VOIDmode
- && GET_MODE_SIZE (wanted_mode) < GET_MODE_SIZE (is_mode))
- {
- int offset = pos / BITS_PER_UNIT;
- rtx old_pos = XEXP (x, 2);
- rtx newmem;
-
- /* If the bytes and bits are counted differently, we
- must adjust the offset. */
- if (BYTES_BIG_ENDIAN != BITS_BIG_ENDIAN)
- offset = (GET_MODE_SIZE (is_mode)
- - GET_MODE_SIZE (wanted_mode) - offset);
-
- pos %= GET_MODE_BITSIZE (wanted_mode);
-
- newmem = gen_rtx (MEM, wanted_mode,
- plus_constant (XEXP (tem, 0), offset));
- RTX_UNCHANGING_P (newmem) = RTX_UNCHANGING_P (tem);
- MEM_VOLATILE_P (newmem) = MEM_VOLATILE_P (tem);
- MEM_IN_STRUCT_P (newmem) = MEM_IN_STRUCT_P (tem);
-
- /* Make the change and see if the insn remains valid. */
- INSN_CODE (insn) = -1;
- XEXP (x, 0) = newmem;
- XEXP (x, 2) = GEN_INT (pos);
-
- if (recog_memoized (insn) >= 0)
- return;
-
- /* Otherwise, restore old position. XEXP (x, 0) will be
- restored later. */
- XEXP (x, 2) = old_pos;
- }
- }
-
- /* If we get here, the bitfield extract insn can't accept a memory
- reference. Copy the input into a register. */
-
- tem1 = gen_reg_rtx (GET_MODE (tem));
- emit_insn_before (gen_move_insn (tem1, tem), insn);
- XEXP (x, 0) = tem1;
- return;
- }
- break;
-
- case SUBREG:
- if (SUBREG_REG (x) == var)
- {
- /* If this is a special SUBREG made because VAR was promoted
- from a wider mode, replace it with VAR and call ourself
- recursively, this time saying that the object previously
- had its current mode (by virtue of the SUBREG). */
-
- if (SUBREG_PROMOTED_VAR_P (x))
- {
- *loc = var;
- fixup_var_refs_1 (var, GET_MODE (var), loc, insn, replacements);
- return;
- }
-
- /* If this SUBREG makes VAR wider, it has become a paradoxical
- SUBREG with VAR in memory, but these aren't allowed at this
- stage of the compilation. So load VAR into a pseudo and take
- a SUBREG of that pseudo. */
- if (GET_MODE_SIZE (GET_MODE (x)) > GET_MODE_SIZE (GET_MODE (var)))
- {
- replacement = find_fixup_replacement (replacements, var);
- if (replacement->new == 0)
- replacement->new = gen_reg_rtx (GET_MODE (var));
- SUBREG_REG (x) = replacement->new;
- return;
- }
-
- /* See if we have already found a replacement for this SUBREG.
- If so, use it. Otherwise, make a MEM and see if the insn
- is recognized. If not, or if we should force MEM into a register,
- make a pseudo for this SUBREG. */
- replacement = find_fixup_replacement (replacements, x);
- if (replacement->new)
- {
- *loc = replacement->new;
- return;
- }
-
- replacement->new = *loc = fixup_memory_subreg (x, insn, 0);
-
- INSN_CODE (insn) = -1;
- if (! flag_force_mem && recog_memoized (insn) >= 0)
- return;
-
- *loc = replacement->new = gen_reg_rtx (GET_MODE (x));
- return;
- }
- break;
-
- case SET:
- /* First do special simplification of bit-field references. */
- if (GET_CODE (SET_DEST (x)) == SIGN_EXTRACT
- || GET_CODE (SET_DEST (x)) == ZERO_EXTRACT)
- optimize_bit_field (x, insn, 0);
- if (GET_CODE (SET_SRC (x)) == SIGN_EXTRACT
- || GET_CODE (SET_SRC (x)) == ZERO_EXTRACT)
- optimize_bit_field (x, insn, NULL_PTR);
-
- /* For a paradoxical SUBREG inside a ZERO_EXTRACT, load the object
- into a register and then store it back out. */
- if (GET_CODE (SET_DEST (x)) == ZERO_EXTRACT
- && GET_CODE (XEXP (SET_DEST (x), 0)) == SUBREG
- && SUBREG_REG (XEXP (SET_DEST (x), 0)) == var
- && (GET_MODE_SIZE (GET_MODE (XEXP (SET_DEST (x), 0)))
- > GET_MODE_SIZE (GET_MODE (var))))
- {
- replacement = find_fixup_replacement (replacements, var);
- if (replacement->new == 0)
- replacement->new = gen_reg_rtx (GET_MODE (var));
-
- SUBREG_REG (XEXP (SET_DEST (x), 0)) = replacement->new;
- emit_insn_after (gen_move_insn (var, replacement->new), insn);
- }
-
- /* If SET_DEST is now a paradoxical SUBREG, put the result of this
- insn into a pseudo and store the low part of the pseudo into VAR. */
- if (GET_CODE (SET_DEST (x)) == SUBREG
- && SUBREG_REG (SET_DEST (x)) == var
- && (GET_MODE_SIZE (GET_MODE (SET_DEST (x)))
- > GET_MODE_SIZE (GET_MODE (var))))
- {
- SET_DEST (x) = tem = gen_reg_rtx (GET_MODE (SET_DEST (x)));
- emit_insn_after (gen_move_insn (var, gen_lowpart (GET_MODE (var),
- tem)),
- insn);
- break;
- }
-
- {
- rtx dest = SET_DEST (x);
- rtx src = SET_SRC (x);
- rtx outerdest = dest;
-
- while (GET_CODE (dest) == SUBREG || GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == ZERO_EXTRACT)
- dest = XEXP (dest, 0);
-
- if (GET_CODE (src) == SUBREG)
- src = XEXP (src, 0);
-
- /* If VAR does not appear at the top level of the SET
- just scan the lower levels of the tree. */
-
- if (src != var && dest != var)
- break;
-
- /* We will need to rerecognize this insn. */
- INSN_CODE (insn) = -1;
-
-#ifdef HAVE_insv
- if (GET_CODE (outerdest) == ZERO_EXTRACT && dest == var)
- {
- /* Since this case will return, ensure we fixup all the
- operands here. */
- fixup_var_refs_1 (var, promoted_mode, &XEXP (outerdest, 1),
- insn, replacements);
- fixup_var_refs_1 (var, promoted_mode, &XEXP (outerdest, 2),
- insn, replacements);
- fixup_var_refs_1 (var, promoted_mode, &SET_SRC (x),
- insn, replacements);
-
- tem = XEXP (outerdest, 0);
-
- /* Clean up (SUBREG:SI (MEM:mode ...) 0)
- that may appear inside a ZERO_EXTRACT.
- This was legitimate when the MEM was a REG. */
- if (GET_CODE (tem) == SUBREG
- && SUBREG_REG (tem) == var)
- tem = fixup_memory_subreg (tem, insn, 0);
- else
- tem = fixup_stack_1 (tem, insn);
-
- if (GET_CODE (XEXP (outerdest, 1)) == CONST_INT
- && GET_CODE (XEXP (outerdest, 2)) == CONST_INT
- && ! mode_dependent_address_p (XEXP (tem, 0))
- && ! MEM_VOLATILE_P (tem))
- {
- enum machine_mode wanted_mode
- = insn_operand_mode[(int) CODE_FOR_insv][0];
- enum machine_mode is_mode = GET_MODE (tem);
- int width = INTVAL (XEXP (outerdest, 1));
- int pos = INTVAL (XEXP (outerdest, 2));
-
- /* If we have a narrower mode, we can do something. */
- if (GET_MODE_SIZE (wanted_mode) < GET_MODE_SIZE (is_mode))
- {
- int offset = pos / BITS_PER_UNIT;
- rtx old_pos = XEXP (outerdest, 2);
- rtx newmem;
-
- if (BYTES_BIG_ENDIAN != BITS_BIG_ENDIAN)
- offset = (GET_MODE_SIZE (is_mode)
- - GET_MODE_SIZE (wanted_mode) - offset);
-
- pos %= GET_MODE_BITSIZE (wanted_mode);
-
- newmem = gen_rtx (MEM, wanted_mode,
- plus_constant (XEXP (tem, 0), offset));
- RTX_UNCHANGING_P (newmem) = RTX_UNCHANGING_P (tem);
- MEM_VOLATILE_P (newmem) = MEM_VOLATILE_P (tem);
- MEM_IN_STRUCT_P (newmem) = MEM_IN_STRUCT_P (tem);
-
- /* Make the change and see if the insn remains valid. */
- INSN_CODE (insn) = -1;
- XEXP (outerdest, 0) = newmem;
- XEXP (outerdest, 2) = GEN_INT (pos);
-
- if (recog_memoized (insn) >= 0)
- return;
-
- /* Otherwise, restore old position. XEXP (x, 0) will be
- restored later. */
- XEXP (outerdest, 2) = old_pos;
- }
- }
-
- /* If we get here, the bit-field store doesn't allow memory
- or isn't located at a constant position. Load the value into
- a register, do the store, and put it back into memory. */
-
- tem1 = gen_reg_rtx (GET_MODE (tem));
- emit_insn_before (gen_move_insn (tem1, tem), insn);
- emit_insn_after (gen_move_insn (tem, tem1), insn);
- XEXP (outerdest, 0) = tem1;
- return;
- }
-#endif
-
- /* STRICT_LOW_PART is a no-op on memory references
- and it can cause combinations to be unrecognizable,
- so eliminate it. */
-
- if (dest == var && GET_CODE (SET_DEST (x)) == STRICT_LOW_PART)
- SET_DEST (x) = XEXP (SET_DEST (x), 0);
-
- /* A valid insn to copy VAR into or out of a register
- must be left alone, to avoid an infinite loop here.
- If the reference to VAR is by a subreg, fix that up,
- since SUBREG is not valid for a memref.
- Also fix up the address of the stack slot.
-
- Note that we must not try to recognize the insn until
- after we know that we have valid addresses and no
- (subreg (mem ...) ...) constructs, since these interfere
- with determining the validity of the insn. */
-
- if ((SET_SRC (x) == var
- || (GET_CODE (SET_SRC (x)) == SUBREG
- && SUBREG_REG (SET_SRC (x)) == var))
- && (GET_CODE (SET_DEST (x)) == REG
- || (GET_CODE (SET_DEST (x)) == SUBREG
- && GET_CODE (SUBREG_REG (SET_DEST (x))) == REG))
- && GET_MODE (var) == promoted_mode
- && x == single_set (insn))
- {
- rtx pat;
-
- replacement = find_fixup_replacement (replacements, SET_SRC (x));
- if (replacement->new)
- SET_SRC (x) = replacement->new;
- else if (GET_CODE (SET_SRC (x)) == SUBREG)
- SET_SRC (x) = replacement->new
- = fixup_memory_subreg (SET_SRC (x), insn, 0);
- else
- SET_SRC (x) = replacement->new
- = fixup_stack_1 (SET_SRC (x), insn);
-
- if (recog_memoized (insn) >= 0)
- return;
-
- /* INSN is not valid, but we know that we want to
- copy SET_SRC (x) to SET_DEST (x) in some way. So
- we generate the move and see whether it requires more
- than one insn. If it does, we emit those insns and
- delete INSN. Otherwise, we an just replace the pattern
- of INSN; we have already verified above that INSN has
- no other function that to do X. */
-
- pat = gen_move_insn (SET_DEST (x), SET_SRC (x));
- if (GET_CODE (pat) == SEQUENCE)
- {
- emit_insn_after (pat, insn);
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- }
- else
- PATTERN (insn) = pat;
-
- return;
- }
-
- if ((SET_DEST (x) == var
- || (GET_CODE (SET_DEST (x)) == SUBREG
- && SUBREG_REG (SET_DEST (x)) == var))
- && (GET_CODE (SET_SRC (x)) == REG
- || (GET_CODE (SET_SRC (x)) == SUBREG
- && GET_CODE (SUBREG_REG (SET_SRC (x))) == REG))
- && GET_MODE (var) == promoted_mode
- && x == single_set (insn))
- {
- rtx pat;
-
- if (GET_CODE (SET_DEST (x)) == SUBREG)
- SET_DEST (x) = fixup_memory_subreg (SET_DEST (x), insn, 0);
- else
- SET_DEST (x) = fixup_stack_1 (SET_DEST (x), insn);
-
- if (recog_memoized (insn) >= 0)
- return;
-
- pat = gen_move_insn (SET_DEST (x), SET_SRC (x));
- if (GET_CODE (pat) == SEQUENCE)
- {
- emit_insn_after (pat, insn);
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- }
- else
- PATTERN (insn) = pat;
-
- return;
- }
-
- /* Otherwise, storing into VAR must be handled specially
- by storing into a temporary and copying that into VAR
- with a new insn after this one. Note that this case
- will be used when storing into a promoted scalar since
- the insn will now have different modes on the input
- and output and hence will be invalid (except for the case
- of setting it to a constant, which does not need any
- change if it is valid). We generate extra code in that case,
- but combine.c will eliminate it. */
-
- if (dest == var)
- {
- rtx temp;
- rtx fixeddest = SET_DEST (x);
-
- /* STRICT_LOW_PART can be discarded, around a MEM. */
- if (GET_CODE (fixeddest) == STRICT_LOW_PART)
- fixeddest = XEXP (fixeddest, 0);
- /* Convert (SUBREG (MEM)) to a MEM in a changed mode. */
- if (GET_CODE (fixeddest) == SUBREG)
- {
- fixeddest = fixup_memory_subreg (fixeddest, insn, 0);
- promoted_mode = GET_MODE (fixeddest);
- }
- else
- fixeddest = fixup_stack_1 (fixeddest, insn);
-
- temp = gen_reg_rtx (promoted_mode);
-
- emit_insn_after (gen_move_insn (fixeddest,
- gen_lowpart (GET_MODE (fixeddest),
- temp)),
- insn);
-
- SET_DEST (x) = temp;
- }
- }
- }
-
- /* Nothing special about this RTX; fix its operands. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- fixup_var_refs_1 (var, promoted_mode, &XEXP (x, i), insn, replacements);
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- fixup_var_refs_1 (var, promoted_mode, &XVECEXP (x, i, j),
- insn, replacements);
- }
- }
-}
-
-/* Given X, an rtx of the form (SUBREG:m1 (MEM:m2 addr)),
- return an rtx (MEM:m1 newaddr) which is equivalent.
- If any insns must be emitted to compute NEWADDR, put them before INSN.
-
- UNCRITICAL nonzero means accept paradoxical subregs.
- This is used for subregs found inside REG_NOTES. */
-
-static rtx
-fixup_memory_subreg (x, insn, uncritical)
- rtx x;
- rtx insn;
- int uncritical;
-{
- int offset = SUBREG_WORD (x) * UNITS_PER_WORD;
- rtx addr = XEXP (SUBREG_REG (x), 0);
- enum machine_mode mode = GET_MODE (x);
- rtx saved, result;
-
- /* Paradoxical SUBREGs are usually invalid during RTL generation. */
- if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))
- && ! uncritical)
- abort ();
-
- if (BYTES_BIG_ENDIAN)
- offset += (MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode)));
- addr = plus_constant (addr, offset);
- if (!flag_force_addr && memory_address_p (mode, addr))
- /* Shortcut if no insns need be emitted. */
- return change_address (SUBREG_REG (x), mode, addr);
- start_sequence ();
- result = change_address (SUBREG_REG (x), mode, addr);
- emit_insn_before (gen_sequence (), insn);
- end_sequence ();
- return result;
-}
-
-/* Do fixup_memory_subreg on all (SUBREG (MEM ...) ...) contained in X.
- Replace subexpressions of X in place.
- If X itself is a (SUBREG (MEM ...) ...), return the replacement expression.
- Otherwise return X, with its contents possibly altered.
-
- If any insns must be emitted to compute NEWADDR, put them before INSN.
-
- UNCRITICAL is as in fixup_memory_subreg. */
-
-static rtx
-walk_fixup_memory_subreg (x, insn, uncritical)
- register rtx x;
- rtx insn;
- int uncritical;
-{
- register enum rtx_code code;
- register char *fmt;
- register int i;
-
- if (x == 0)
- return 0;
-
- code = GET_CODE (x);
-
- if (code == SUBREG && GET_CODE (SUBREG_REG (x)) == MEM)
- return fixup_memory_subreg (x, insn, uncritical);
-
- /* Nothing special about this RTX; fix its operands. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- XEXP (x, i) = walk_fixup_memory_subreg (XEXP (x, i), insn, uncritical);
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- XVECEXP (x, i, j)
- = walk_fixup_memory_subreg (XVECEXP (x, i, j), insn, uncritical);
- }
- }
- return x;
-}
-
-/* For each memory ref within X, if it refers to a stack slot
- with an out of range displacement, put the address in a temp register
- (emitting new insns before INSN to load these registers)
- and alter the memory ref to use that register.
- Replace each such MEM rtx with a copy, to avoid clobberage. */
-
-static rtx
-fixup_stack_1 (x, insn)
- rtx x;
- rtx insn;
-{
- register int i;
- register RTX_CODE code = GET_CODE (x);
- register char *fmt;
-
- if (code == MEM)
- {
- register rtx ad = XEXP (x, 0);
- /* If we have address of a stack slot but it's not valid
- (displacement is too large), compute the sum in a register. */
- if (GET_CODE (ad) == PLUS
- && GET_CODE (XEXP (ad, 0)) == REG
- && ((REGNO (XEXP (ad, 0)) >= FIRST_VIRTUAL_REGISTER
- && REGNO (XEXP (ad, 0)) <= LAST_VIRTUAL_REGISTER)
- || XEXP (ad, 0) == current_function_internal_arg_pointer)
- && GET_CODE (XEXP (ad, 1)) == CONST_INT)
- {
- rtx temp, seq;
- if (memory_address_p (GET_MODE (x), ad))
- return x;
-
- start_sequence ();
- temp = copy_to_reg (ad);
- seq = gen_sequence ();
- end_sequence ();
- emit_insn_before (seq, insn);
- return change_address (x, VOIDmode, temp);
- }
- return x;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- XEXP (x, i) = fixup_stack_1 (XEXP (x, i), insn);
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- XVECEXP (x, i, j) = fixup_stack_1 (XVECEXP (x, i, j), insn);
- }
- }
- return x;
-}
-
-/* Optimization: a bit-field instruction whose field
- happens to be a byte or halfword in memory
- can be changed to a move instruction.
-
- We call here when INSN is an insn to examine or store into a bit-field.
- BODY is the SET-rtx to be altered.
-
- EQUIV_MEM is the table `reg_equiv_mem' if that is available; else 0.
- (Currently this is called only from function.c, and EQUIV_MEM
- is always 0.) */
-
-static void
-optimize_bit_field (body, insn, equiv_mem)
- rtx body;
- rtx insn;
- rtx *equiv_mem;
-{
- register rtx bitfield;
- int destflag;
- rtx seq = 0;
- enum machine_mode mode;
-
- if (GET_CODE (SET_DEST (body)) == SIGN_EXTRACT
- || GET_CODE (SET_DEST (body)) == ZERO_EXTRACT)
- bitfield = SET_DEST (body), destflag = 1;
- else
- bitfield = SET_SRC (body), destflag = 0;
-
- /* First check that the field being stored has constant size and position
- and is in fact a byte or halfword suitably aligned. */
-
- if (GET_CODE (XEXP (bitfield, 1)) == CONST_INT
- && GET_CODE (XEXP (bitfield, 2)) == CONST_INT
- && ((mode = mode_for_size (INTVAL (XEXP (bitfield, 1)), MODE_INT, 1))
- != BLKmode)
- && INTVAL (XEXP (bitfield, 2)) % INTVAL (XEXP (bitfield, 1)) == 0)
- {
- register rtx memref = 0;
-
- /* Now check that the containing word is memory, not a register,
- and that it is safe to change the machine mode. */
-
- if (GET_CODE (XEXP (bitfield, 0)) == MEM)
- memref = XEXP (bitfield, 0);
- else if (GET_CODE (XEXP (bitfield, 0)) == REG
- && equiv_mem != 0)
- memref = equiv_mem[REGNO (XEXP (bitfield, 0))];
- else if (GET_CODE (XEXP (bitfield, 0)) == SUBREG
- && GET_CODE (SUBREG_REG (XEXP (bitfield, 0))) == MEM)
- memref = SUBREG_REG (XEXP (bitfield, 0));
- else if (GET_CODE (XEXP (bitfield, 0)) == SUBREG
- && equiv_mem != 0
- && GET_CODE (SUBREG_REG (XEXP (bitfield, 0))) == REG)
- memref = equiv_mem[REGNO (SUBREG_REG (XEXP (bitfield, 0)))];
-
- if (memref
- && ! mode_dependent_address_p (XEXP (memref, 0))
- && ! MEM_VOLATILE_P (memref))
- {
- /* Now adjust the address, first for any subreg'ing
- that we are now getting rid of,
- and then for which byte of the word is wanted. */
-
- register int offset = INTVAL (XEXP (bitfield, 2));
- rtx insns;
-
- /* Adjust OFFSET to count bits from low-address byte. */
- if (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN)
- offset = (GET_MODE_BITSIZE (GET_MODE (XEXP (bitfield, 0)))
- - offset - INTVAL (XEXP (bitfield, 1)));
-
- /* Adjust OFFSET to count bytes from low-address byte. */
- offset /= BITS_PER_UNIT;
- if (GET_CODE (XEXP (bitfield, 0)) == SUBREG)
- {
- offset += SUBREG_WORD (XEXP (bitfield, 0)) * UNITS_PER_WORD;
- if (BYTES_BIG_ENDIAN)
- offset -= (MIN (UNITS_PER_WORD,
- GET_MODE_SIZE (GET_MODE (XEXP (bitfield, 0))))
- - MIN (UNITS_PER_WORD,
- GET_MODE_SIZE (GET_MODE (memref))));
- }
-
- start_sequence ();
- memref = change_address (memref, mode,
- plus_constant (XEXP (memref, 0), offset));
- insns = get_insns ();
- end_sequence ();
- emit_insns_before (insns, insn);
-
- /* Store this memory reference where
- we found the bit field reference. */
-
- if (destflag)
- {
- validate_change (insn, &SET_DEST (body), memref, 1);
- if (! CONSTANT_ADDRESS_P (SET_SRC (body)))
- {
- rtx src = SET_SRC (body);
- while (GET_CODE (src) == SUBREG
- && SUBREG_WORD (src) == 0)
- src = SUBREG_REG (src);
- if (GET_MODE (src) != GET_MODE (memref))
- src = gen_lowpart (GET_MODE (memref), SET_SRC (body));
- validate_change (insn, &SET_SRC (body), src, 1);
- }
- else if (GET_MODE (SET_SRC (body)) != VOIDmode
- && GET_MODE (SET_SRC (body)) != GET_MODE (memref))
- /* This shouldn't happen because anything that didn't have
- one of these modes should have got converted explicitly
- and then referenced through a subreg.
- This is so because the original bit-field was
- handled by agg_mode and so its tree structure had
- the same mode that memref now has. */
- abort ();
- }
- else
- {
- rtx dest = SET_DEST (body);
-
- while (GET_CODE (dest) == SUBREG
- && SUBREG_WORD (dest) == 0
- && (GET_MODE_CLASS (GET_MODE (dest))
- == GET_MODE_CLASS (GET_MODE (SUBREG_REG (dest)))))
- dest = SUBREG_REG (dest);
-
- validate_change (insn, &SET_DEST (body), dest, 1);
-
- if (GET_MODE (dest) == GET_MODE (memref))
- validate_change (insn, &SET_SRC (body), memref, 1);
- else
- {
- /* Convert the mem ref to the destination mode. */
- rtx newreg = gen_reg_rtx (GET_MODE (dest));
-
- start_sequence ();
- convert_move (newreg, memref,
- GET_CODE (SET_SRC (body)) == ZERO_EXTRACT);
- seq = get_insns ();
- end_sequence ();
-
- validate_change (insn, &SET_SRC (body), newreg, 1);
- }
- }
-
- /* See if we can convert this extraction or insertion into
- a simple move insn. We might not be able to do so if this
- was, for example, part of a PARALLEL.
-
- If we succeed, write out any needed conversions. If we fail,
- it is hard to guess why we failed, so don't do anything
- special; just let the optimization be suppressed. */
-
- if (apply_change_group () && seq)
- emit_insns_before (seq, insn);
- }
- }
-}
-
-/* These routines are responsible for converting virtual register references
- to the actual hard register references once RTL generation is complete.
-
- The following four variables are used for communication between the
- routines. They contain the offsets of the virtual registers from their
- respective hard registers. */
-
-static int in_arg_offset;
-static int var_offset;
-static int dynamic_offset;
-static int out_arg_offset;
-
-/* In most machines, the stack pointer register is equivalent to the bottom
- of the stack. */
-
-#ifndef STACK_POINTER_OFFSET
-#define STACK_POINTER_OFFSET 0
-#endif
-
-/* If not defined, pick an appropriate default for the offset of dynamically
- allocated memory depending on the value of ACCUMULATE_OUTGOING_ARGS,
- REG_PARM_STACK_SPACE, and OUTGOING_REG_PARM_STACK_SPACE. */
-
-#ifndef STACK_DYNAMIC_OFFSET
-
-#ifdef ACCUMULATE_OUTGOING_ARGS
-/* The bottom of the stack points to the actual arguments. If
- REG_PARM_STACK_SPACE is defined, this includes the space for the register
- parameters. However, if OUTGOING_REG_PARM_STACK space is not defined,
- stack space for register parameters is not pushed by the caller, but
- rather part of the fixed stack areas and hence not included in
- `current_function_outgoing_args_size'. Nevertheless, we must allow
- for it when allocating stack dynamic objects. */
-
-#if defined(REG_PARM_STACK_SPACE) && ! defined(OUTGOING_REG_PARM_STACK_SPACE)
-#define STACK_DYNAMIC_OFFSET(FNDECL) \
-(current_function_outgoing_args_size \
- + REG_PARM_STACK_SPACE (FNDECL) + (STACK_POINTER_OFFSET))
-
-#else
-#define STACK_DYNAMIC_OFFSET(FNDECL) \
-(current_function_outgoing_args_size + (STACK_POINTER_OFFSET))
-#endif
-
-#else
-#define STACK_DYNAMIC_OFFSET(FNDECL) STACK_POINTER_OFFSET
-#endif
-#endif
-
-/* Pass through the INSNS of function FNDECL and convert virtual register
- references to hard register references. */
-
-void
-instantiate_virtual_regs (fndecl, insns)
- tree fndecl;
- rtx insns;
-{
- rtx insn;
-
- /* Compute the offsets to use for this function. */
- in_arg_offset = FIRST_PARM_OFFSET (fndecl);
- var_offset = STARTING_FRAME_OFFSET;
- dynamic_offset = STACK_DYNAMIC_OFFSET (fndecl);
- out_arg_offset = STACK_POINTER_OFFSET;
-
- /* Scan all variables and parameters of this function. For each that is
- in memory, instantiate all virtual registers if the result is a valid
- address. If not, we do it later. That will handle most uses of virtual
- regs on many machines. */
- instantiate_decls (fndecl, 1);
-
- /* Initialize recognition, indicating that volatile is OK. */
- init_recog ();
-
- /* Scan through all the insns, instantiating every virtual register still
- present. */
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- {
- instantiate_virtual_regs_1 (&PATTERN (insn), insn, 1);
- instantiate_virtual_regs_1 (&REG_NOTES (insn), NULL_RTX, 0);
- }
-
- /* Now instantiate the remaining register equivalences for debugging info.
- These will not be valid addresses. */
- instantiate_decls (fndecl, 0);
-
- /* Indicate that, from now on, assign_stack_local should use
- frame_pointer_rtx. */
- virtuals_instantiated = 1;
-}
-
-/* Scan all decls in FNDECL (both variables and parameters) and instantiate
- all virtual registers in their DECL_RTL's.
-
- If VALID_ONLY, do this only if the resulting address is still valid.
- Otherwise, always do it. */
-
-static void
-instantiate_decls (fndecl, valid_only)
- tree fndecl;
- int valid_only;
-{
- tree decl;
-
- if (DECL_SAVED_INSNS (fndecl))
- /* When compiling an inline function, the obstack used for
- rtl allocation is the maybepermanent_obstack. Calling
- `resume_temporary_allocation' switches us back to that
- obstack while we process this function's parameters. */
- resume_temporary_allocation ();
-
- /* Process all parameters of the function. */
- for (decl = DECL_ARGUMENTS (fndecl); decl; decl = TREE_CHAIN (decl))
- {
- instantiate_decl (DECL_RTL (decl), int_size_in_bytes (TREE_TYPE (decl)),
- valid_only);
- instantiate_decl (DECL_INCOMING_RTL (decl),
- int_size_in_bytes (TREE_TYPE (decl)), valid_only);
- }
-
- /* Now process all variables defined in the function or its subblocks. */
- instantiate_decls_1 (DECL_INITIAL (fndecl), valid_only);
-
- if (DECL_INLINE (fndecl) || DECL_DEFER_OUTPUT (fndecl))
- {
- /* Save all rtl allocated for this function by raising the
- high-water mark on the maybepermanent_obstack. */
- preserve_data ();
- /* All further rtl allocation is now done in the current_obstack. */
- rtl_in_current_obstack ();
- }
-}
-
-/* Subroutine of instantiate_decls: Process all decls in the given
- BLOCK node and all its subblocks. */
-
-static void
-instantiate_decls_1 (let, valid_only)
- tree let;
- int valid_only;
-{
- tree t;
-
- for (t = BLOCK_VARS (let); t; t = TREE_CHAIN (t))
- instantiate_decl (DECL_RTL (t), int_size_in_bytes (TREE_TYPE (t)),
- valid_only);
-
- /* Process all subblocks. */
- for (t = BLOCK_SUBBLOCKS (let); t; t = TREE_CHAIN (t))
- instantiate_decls_1 (t, valid_only);
-}
-
-/* Subroutine of the preceding procedures: Given RTL representing a
- decl and the size of the object, do any instantiation required.
-
- If VALID_ONLY is non-zero, it means that the RTL should only be
- changed if the new address is valid. */
-
-static void
-instantiate_decl (x, size, valid_only)
- rtx x;
- int size;
- int valid_only;
-{
- enum machine_mode mode;
- rtx addr;
-
- /* If this is not a MEM, no need to do anything. Similarly if the
- address is a constant or a register that is not a virtual register. */
-
- if (x == 0 || GET_CODE (x) != MEM)
- return;
-
- addr = XEXP (x, 0);
- if (CONSTANT_P (addr)
- || (GET_CODE (addr) == REG
- && (REGNO (addr) < FIRST_VIRTUAL_REGISTER
- || REGNO (addr) > LAST_VIRTUAL_REGISTER)))
- return;
-
- /* If we should only do this if the address is valid, copy the address.
- We need to do this so we can undo any changes that might make the
- address invalid. This copy is unfortunate, but probably can't be
- avoided. */
-
- if (valid_only)
- addr = copy_rtx (addr);
-
- instantiate_virtual_regs_1 (&addr, NULL_RTX, 0);
-
- if (valid_only)
- {
- /* Now verify that the resulting address is valid for every integer or
- floating-point mode up to and including SIZE bytes long. We do this
- since the object might be accessed in any mode and frame addresses
- are shared. */
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- mode != VOIDmode && GET_MODE_SIZE (mode) <= size;
- mode = GET_MODE_WIDER_MODE (mode))
- if (! memory_address_p (mode, addr))
- return;
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
- mode != VOIDmode && GET_MODE_SIZE (mode) <= size;
- mode = GET_MODE_WIDER_MODE (mode))
- if (! memory_address_p (mode, addr))
- return;
- }
-
- /* Put back the address now that we have updated it and we either know
- it is valid or we don't care whether it is valid. */
-
- XEXP (x, 0) = addr;
-}
-
-/* Given a pointer to a piece of rtx and an optional pointer to the
- containing object, instantiate any virtual registers present in it.
-
- If EXTRA_INSNS, we always do the replacement and generate
- any extra insns before OBJECT. If it zero, we do nothing if replacement
- is not valid.
-
- Return 1 if we either had nothing to do or if we were able to do the
- needed replacement. Return 0 otherwise; we only return zero if
- EXTRA_INSNS is zero.
-
- We first try some simple transformations to avoid the creation of extra
- pseudos. */
-
-static int
-instantiate_virtual_regs_1 (loc, object, extra_insns)
- rtx *loc;
- rtx object;
- int extra_insns;
-{
- rtx x;
- RTX_CODE code;
- rtx new = 0;
- int offset;
- rtx temp;
- rtx seq;
- int i, j;
- char *fmt;
-
- /* Re-start here to avoid recursion in common cases. */
- restart:
-
- x = *loc;
- if (x == 0)
- return 1;
-
- code = GET_CODE (x);
-
- /* Check for some special cases. */
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case RETURN:
- return 1;
-
- case SET:
- /* We are allowed to set the virtual registers. This means that
- that the actual register should receive the source minus the
- appropriate offset. This is used, for example, in the handling
- of non-local gotos. */
- if (SET_DEST (x) == virtual_incoming_args_rtx)
- new = arg_pointer_rtx, offset = - in_arg_offset;
- else if (SET_DEST (x) == virtual_stack_vars_rtx)
- new = frame_pointer_rtx, offset = - var_offset;
- else if (SET_DEST (x) == virtual_stack_dynamic_rtx)
- new = stack_pointer_rtx, offset = - dynamic_offset;
- else if (SET_DEST (x) == virtual_outgoing_args_rtx)
- new = stack_pointer_rtx, offset = - out_arg_offset;
-
- if (new)
- {
- /* The only valid sources here are PLUS or REG. Just do
- the simplest possible thing to handle them. */
- if (GET_CODE (SET_SRC (x)) != REG
- && GET_CODE (SET_SRC (x)) != PLUS)
- abort ();
-
- start_sequence ();
- if (GET_CODE (SET_SRC (x)) != REG)
- temp = force_operand (SET_SRC (x), NULL_RTX);
- else
- temp = SET_SRC (x);
- temp = force_operand (plus_constant (temp, offset), NULL_RTX);
- seq = get_insns ();
- end_sequence ();
-
- emit_insns_before (seq, object);
- SET_DEST (x) = new;
-
- if (!validate_change (object, &SET_SRC (x), temp, 0)
- || ! extra_insns)
- abort ();
-
- return 1;
- }
-
- instantiate_virtual_regs_1 (&SET_DEST (x), object, extra_insns);
- loc = &SET_SRC (x);
- goto restart;
-
- case PLUS:
- /* Handle special case of virtual register plus constant. */
- if (CONSTANT_P (XEXP (x, 1)))
- {
- rtx old, new_offset;
-
- /* Check for (plus (plus VIRT foo) (const_int)) first. */
- if (GET_CODE (XEXP (x, 0)) == PLUS)
- {
- rtx inner = XEXP (XEXP (x, 0), 0);
-
- if (inner == virtual_incoming_args_rtx)
- new = arg_pointer_rtx, offset = in_arg_offset;
- else if (inner == virtual_stack_vars_rtx)
- new = frame_pointer_rtx, offset = var_offset;
- else if (inner == virtual_stack_dynamic_rtx)
- new = stack_pointer_rtx, offset = dynamic_offset;
- else if (inner == virtual_outgoing_args_rtx)
- new = stack_pointer_rtx, offset = out_arg_offset;
- else
- {
- loc = &XEXP (x, 0);
- goto restart;
- }
-
- instantiate_virtual_regs_1 (&XEXP (XEXP (x, 0), 1), object,
- extra_insns);
- new = gen_rtx (PLUS, Pmode, new, XEXP (XEXP (x, 0), 1));
- }
-
- else if (XEXP (x, 0) == virtual_incoming_args_rtx)
- new = arg_pointer_rtx, offset = in_arg_offset;
- else if (XEXP (x, 0) == virtual_stack_vars_rtx)
- new = frame_pointer_rtx, offset = var_offset;
- else if (XEXP (x, 0) == virtual_stack_dynamic_rtx)
- new = stack_pointer_rtx, offset = dynamic_offset;
- else if (XEXP (x, 0) == virtual_outgoing_args_rtx)
- new = stack_pointer_rtx, offset = out_arg_offset;
- else
- {
- /* We know the second operand is a constant. Unless the
- first operand is a REG (which has been already checked),
- it needs to be checked. */
- if (GET_CODE (XEXP (x, 0)) != REG)
- {
- loc = &XEXP (x, 0);
- goto restart;
- }
- return 1;
- }
-
- new_offset = plus_constant (XEXP (x, 1), offset);
-
- /* If the new constant is zero, try to replace the sum with just
- the register. */
- if (new_offset == const0_rtx
- && validate_change (object, loc, new, 0))
- return 1;
-
- /* Next try to replace the register and new offset.
- There are two changes to validate here and we can't assume that
- in the case of old offset equals new just changing the register
- will yield a valid insn. In the interests of a little efficiency,
- however, we only call validate change once (we don't queue up the
- changes and then call apply_change_group). */
-
- old = XEXP (x, 0);
- if (offset == 0
- ? ! validate_change (object, &XEXP (x, 0), new, 0)
- : (XEXP (x, 0) = new,
- ! validate_change (object, &XEXP (x, 1), new_offset, 0)))
- {
- if (! extra_insns)
- {
- XEXP (x, 0) = old;
- return 0;
- }
-
- /* Otherwise copy the new constant into a register and replace
- constant with that register. */
- temp = gen_reg_rtx (Pmode);
- XEXP (x, 0) = new;
- if (validate_change (object, &XEXP (x, 1), temp, 0))
- emit_insn_before (gen_move_insn (temp, new_offset), object);
- else
- {
- /* If that didn't work, replace this expression with a
- register containing the sum. */
-
- XEXP (x, 0) = old;
- new = gen_rtx (PLUS, Pmode, new, new_offset);
-
- start_sequence ();
- temp = force_operand (new, NULL_RTX);
- seq = get_insns ();
- end_sequence ();
-
- emit_insns_before (seq, object);
- if (! validate_change (object, loc, temp, 0)
- && ! validate_replace_rtx (x, temp, object))
- abort ();
- }
- }
-
- return 1;
- }
-
- /* Fall through to generic two-operand expression case. */
- case EXPR_LIST:
- case CALL:
- case COMPARE:
- case MINUS:
- case MULT:
- case DIV: case UDIV:
- case MOD: case UMOD:
- case AND: case IOR: case XOR:
- case ROTATERT: case ROTATE:
- case ASHIFTRT: case LSHIFTRT: case ASHIFT:
- case NE: case EQ:
- case GE: case GT: case GEU: case GTU:
- case LE: case LT: case LEU: case LTU:
- if (XEXP (x, 1) && ! CONSTANT_P (XEXP (x, 1)))
- instantiate_virtual_regs_1 (&XEXP (x, 1), object, extra_insns);
- loc = &XEXP (x, 0);
- goto restart;
-
- case MEM:
- /* Most cases of MEM that convert to valid addresses have already been
- handled by our scan of decls. The only special handling we
- need here is to make a copy of the rtx to ensure it isn't being
- shared if we have to change it to a pseudo.
-
- If the rtx is a simple reference to an address via a virtual register,
- it can potentially be shared. In such cases, first try to make it
- a valid address, which can also be shared. Otherwise, copy it and
- proceed normally.
-
- First check for common cases that need no processing. These are
- usually due to instantiation already being done on a previous instance
- of a shared rtx. */
-
- temp = XEXP (x, 0);
- if (CONSTANT_ADDRESS_P (temp)
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || temp == arg_pointer_rtx
-#endif
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- || temp == hard_frame_pointer_rtx
-#endif
- || temp == frame_pointer_rtx)
- return 1;
-
- if (GET_CODE (temp) == PLUS
- && CONSTANT_ADDRESS_P (XEXP (temp, 1))
- && (XEXP (temp, 0) == frame_pointer_rtx
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- || XEXP (temp, 0) == hard_frame_pointer_rtx
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || XEXP (temp, 0) == arg_pointer_rtx
-#endif
- ))
- return 1;
-
- if (temp == virtual_stack_vars_rtx
- || temp == virtual_incoming_args_rtx
- || (GET_CODE (temp) == PLUS
- && CONSTANT_ADDRESS_P (XEXP (temp, 1))
- && (XEXP (temp, 0) == virtual_stack_vars_rtx
- || XEXP (temp, 0) == virtual_incoming_args_rtx)))
- {
- /* This MEM may be shared. If the substitution can be done without
- the need to generate new pseudos, we want to do it in place
- so all copies of the shared rtx benefit. The call below will
- only make substitutions if the resulting address is still
- valid.
-
- Note that we cannot pass X as the object in the recursive call
- since the insn being processed may not allow all valid
- addresses. However, if we were not passed on object, we can
- only modify X without copying it if X will have a valid
- address.
-
- ??? Also note that this can still lose if OBJECT is an insn that
- has less restrictions on an address that some other insn.
- In that case, we will modify the shared address. This case
- doesn't seem very likely, though. One case where this could
- happen is in the case of a USE or CLOBBER reference, but we
- take care of that below. */
-
- if (instantiate_virtual_regs_1 (&XEXP (x, 0),
- object ? object : x, 0))
- return 1;
-
- /* Otherwise make a copy and process that copy. We copy the entire
- RTL expression since it might be a PLUS which could also be
- shared. */
- *loc = x = copy_rtx (x);
- }
-
- /* Fall through to generic unary operation case. */
- case SUBREG:
- case STRICT_LOW_PART:
- case NEG: case NOT:
- case PRE_DEC: case PRE_INC: case POST_DEC: case POST_INC:
- case SIGN_EXTEND: case ZERO_EXTEND:
- case TRUNCATE: case FLOAT_EXTEND: case FLOAT_TRUNCATE:
- case FLOAT: case FIX:
- case UNSIGNED_FIX: case UNSIGNED_FLOAT:
- case ABS:
- case SQRT:
- case FFS:
- /* These case either have just one operand or we know that we need not
- check the rest of the operands. */
- loc = &XEXP (x, 0);
- goto restart;
-
- case USE:
- case CLOBBER:
- /* If the operand is a MEM, see if the change is a valid MEM. If not,
- go ahead and make the invalid one, but do it to a copy. For a REG,
- just make the recursive call, since there's no chance of a problem. */
-
- if ((GET_CODE (XEXP (x, 0)) == MEM
- && instantiate_virtual_regs_1 (&XEXP (XEXP (x, 0), 0), XEXP (x, 0),
- 0))
- || (GET_CODE (XEXP (x, 0)) == REG
- && instantiate_virtual_regs_1 (&XEXP (x, 0), object, 0)))
- return 1;
-
- XEXP (x, 0) = copy_rtx (XEXP (x, 0));
- loc = &XEXP (x, 0);
- goto restart;
-
- case REG:
- /* Try to replace with a PLUS. If that doesn't work, compute the sum
- in front of this insn and substitute the temporary. */
- if (x == virtual_incoming_args_rtx)
- new = arg_pointer_rtx, offset = in_arg_offset;
- else if (x == virtual_stack_vars_rtx)
- new = frame_pointer_rtx, offset = var_offset;
- else if (x == virtual_stack_dynamic_rtx)
- new = stack_pointer_rtx, offset = dynamic_offset;
- else if (x == virtual_outgoing_args_rtx)
- new = stack_pointer_rtx, offset = out_arg_offset;
-
- if (new)
- {
- temp = plus_constant (new, offset);
- if (!validate_change (object, loc, temp, 0))
- {
- if (! extra_insns)
- return 0;
-
- start_sequence ();
- temp = force_operand (temp, NULL_RTX);
- seq = get_insns ();
- end_sequence ();
-
- emit_insns_before (seq, object);
- if (! validate_change (object, loc, temp, 0)
- && ! validate_replace_rtx (x, temp, object))
- abort ();
- }
- }
-
- return 1;
- }
-
- /* Scan all subexpressions. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
- if (*fmt == 'e')
- {
- if (!instantiate_virtual_regs_1 (&XEXP (x, i), object, extra_insns))
- return 0;
- }
- else if (*fmt == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- if (! instantiate_virtual_regs_1 (&XVECEXP (x, i, j), object,
- extra_insns))
- return 0;
-
- return 1;
-}
-
-/* Optimization: assuming this function does not receive nonlocal gotos,
- delete the handlers for such, as well as the insns to establish
- and disestablish them. */
-
-static void
-delete_handlers ()
-{
- rtx insn;
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- /* Delete the handler by turning off the flag that would
- prevent jump_optimize from deleting it.
- Also permit deletion of the nonlocal labels themselves
- if nothing local refers to them. */
- if (GET_CODE (insn) == CODE_LABEL)
- {
- tree t, last_t;
-
- LABEL_PRESERVE_P (insn) = 0;
-
- /* Remove it from the nonlocal_label list, to avoid confusing
- flow. */
- for (t = nonlocal_labels, last_t = 0; t;
- last_t = t, t = TREE_CHAIN (t))
- if (DECL_RTL (TREE_VALUE (t)) == insn)
- break;
- if (t)
- {
- if (! last_t)
- nonlocal_labels = TREE_CHAIN (nonlocal_labels);
- else
- TREE_CHAIN (last_t) = TREE_CHAIN (t);
- }
- }
- if (GET_CODE (insn) == INSN
- && ((nonlocal_goto_handler_slot != 0
- && reg_mentioned_p (nonlocal_goto_handler_slot, PATTERN (insn)))
- || (nonlocal_goto_stack_level != 0
- && reg_mentioned_p (nonlocal_goto_stack_level,
- PATTERN (insn)))))
- delete_insn (insn);
- }
-}
-
-/* Return a list (chain of EXPR_LIST nodes) for the nonlocal labels
- of the current function. */
-
-rtx
-nonlocal_label_rtx_list ()
-{
- tree t;
- rtx x = 0;
-
- for (t = nonlocal_labels; t; t = TREE_CHAIN (t))
- x = gen_rtx (EXPR_LIST, VOIDmode, label_rtx (TREE_VALUE (t)), x);
-
- return x;
-}
-
-/* Output a USE for any register use in RTL.
- This is used with -noreg to mark the extent of lifespan
- of any registers used in a user-visible variable's DECL_RTL. */
-
-void
-use_variable (rtl)
- rtx rtl;
-{
- if (GET_CODE (rtl) == REG)
- /* This is a register variable. */
- emit_insn (gen_rtx (USE, VOIDmode, rtl));
- else if (GET_CODE (rtl) == MEM
- && GET_CODE (XEXP (rtl, 0)) == REG
- && (REGNO (XEXP (rtl, 0)) < FIRST_VIRTUAL_REGISTER
- || REGNO (XEXP (rtl, 0)) > LAST_VIRTUAL_REGISTER)
- && XEXP (rtl, 0) != current_function_internal_arg_pointer)
- /* This is a variable-sized structure. */
- emit_insn (gen_rtx (USE, VOIDmode, XEXP (rtl, 0)));
-}
-
-/* Like use_variable except that it outputs the USEs after INSN
- instead of at the end of the insn-chain. */
-
-void
-use_variable_after (rtl, insn)
- rtx rtl, insn;
-{
- if (GET_CODE (rtl) == REG)
- /* This is a register variable. */
- emit_insn_after (gen_rtx (USE, VOIDmode, rtl), insn);
- else if (GET_CODE (rtl) == MEM
- && GET_CODE (XEXP (rtl, 0)) == REG
- && (REGNO (XEXP (rtl, 0)) < FIRST_VIRTUAL_REGISTER
- || REGNO (XEXP (rtl, 0)) > LAST_VIRTUAL_REGISTER)
- && XEXP (rtl, 0) != current_function_internal_arg_pointer)
- /* This is a variable-sized structure. */
- emit_insn_after (gen_rtx (USE, VOIDmode, XEXP (rtl, 0)), insn);
-}
-
-int
-max_parm_reg_num ()
-{
- return max_parm_reg;
-}
-
-/* Return the first insn following those generated by `assign_parms'. */
-
-rtx
-get_first_nonparm_insn ()
-{
- if (last_parm_insn)
- return NEXT_INSN (last_parm_insn);
- return get_insns ();
-}
-
-/* Return the first NOTE_INSN_BLOCK_BEG note in the function.
- Crash if there is none. */
-
-rtx
-get_first_block_beg ()
-{
- register rtx searcher;
- register rtx insn = get_first_nonparm_insn ();
-
- for (searcher = insn; searcher; searcher = NEXT_INSN (searcher))
- if (GET_CODE (searcher) == NOTE
- && NOTE_LINE_NUMBER (searcher) == NOTE_INSN_BLOCK_BEG)
- return searcher;
-
- abort (); /* Invalid call to this function. (See comments above.) */
- return NULL_RTX;
-}
-
-/* Return 1 if EXP is an aggregate type (or a value with aggregate type).
- This means a type for which function calls must pass an address to the
- function or get an address back from the function.
- EXP may be a type node or an expression (whose type is tested). */
-
-int
-aggregate_value_p (exp)
- tree exp;
-{
- int i, regno, nregs;
- rtx reg;
- tree type;
- if (TREE_CODE_CLASS (TREE_CODE (exp)) == 't')
- type = exp;
- else
- type = TREE_TYPE (exp);
-
- if (RETURN_IN_MEMORY (type))
- return 1;
- /* Types that are TREE_ADDRESSABLE must be contructed in memory,
- and thus can't be returned in registers. */
- if (TREE_ADDRESSABLE (type))
- return 1;
- if (flag_pcc_struct_return && AGGREGATE_TYPE_P (type))
- return 1;
- /* Make sure we have suitable call-clobbered regs to return
- the value in; if not, we must return it in memory. */
- reg = hard_function_value (type, 0);
-
- /* If we have something other than a REG (e.g. a PARALLEL), then assume
- it is OK. */
- if (GET_CODE (reg) != REG)
- return 0;
-
- regno = REGNO (reg);
- nregs = HARD_REGNO_NREGS (regno, TYPE_MODE (type));
- for (i = 0; i < nregs; i++)
- if (! call_used_regs[regno + i])
- return 1;
- return 0;
-}
-
-/* Assign RTL expressions to the function's parameters.
- This may involve copying them into registers and using
- those registers as the RTL for them.
-
- If SECOND_TIME is non-zero it means that this function is being
- called a second time. This is done by integrate.c when a function's
- compilation is deferred. We need to come back here in case the
- FUNCTION_ARG macro computes items needed for the rest of the compilation
- (such as changing which registers are fixed or caller-saved). But suppress
- writing any insns or setting DECL_RTL of anything in this case. */
-
-void
-assign_parms (fndecl, second_time)
- tree fndecl;
- int second_time;
-{
- register tree parm;
- register rtx entry_parm = 0;
- register rtx stack_parm = 0;
- CUMULATIVE_ARGS args_so_far;
- enum machine_mode promoted_mode, passed_mode;
- enum machine_mode nominal_mode, promoted_nominal_mode;
- int unsignedp;
- /* Total space needed so far for args on the stack,
- given as a constant and a tree-expression. */
- struct args_size stack_args_size;
- tree fntype = TREE_TYPE (fndecl);
- tree fnargs = DECL_ARGUMENTS (fndecl);
- /* This is used for the arg pointer when referring to stack args. */
- rtx internal_arg_pointer;
- /* This is a dummy PARM_DECL that we used for the function result if
- the function returns a structure. */
- tree function_result_decl = 0;
- int nparmregs = list_length (fnargs) + LAST_VIRTUAL_REGISTER + 1;
- int varargs_setup = 0;
- rtx conversion_insns = 0;
-
- /* Nonzero if the last arg is named `__builtin_va_alist',
- which is used on some machines for old-fashioned non-ANSI varargs.h;
- this should be stuck onto the stack as if it had arrived there. */
- int hide_last_arg
- = (current_function_varargs
- && fnargs
- && (parm = tree_last (fnargs)) != 0
- && DECL_NAME (parm)
- && (! strcmp (IDENTIFIER_POINTER (DECL_NAME (parm)),
- "__builtin_va_alist")));
-
- /* Nonzero if function takes extra anonymous args.
- This means the last named arg must be on the stack
- right before the anonymous ones. */
- int stdarg
- = (TYPE_ARG_TYPES (fntype) != 0
- && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
- != void_type_node));
-
- current_function_stdarg = stdarg;
-
- /* If the reg that the virtual arg pointer will be translated into is
- not a fixed reg or is the stack pointer, make a copy of the virtual
- arg pointer, and address parms via the copy. The frame pointer is
- considered fixed even though it is not marked as such.
-
- The second time through, simply use ap to avoid generating rtx. */
-
- if ((ARG_POINTER_REGNUM == STACK_POINTER_REGNUM
- || ! (fixed_regs[ARG_POINTER_REGNUM]
- || ARG_POINTER_REGNUM == FRAME_POINTER_REGNUM))
- && ! second_time)
- internal_arg_pointer = copy_to_reg (virtual_incoming_args_rtx);
- else
- internal_arg_pointer = virtual_incoming_args_rtx;
- current_function_internal_arg_pointer = internal_arg_pointer;
-
- stack_args_size.constant = 0;
- stack_args_size.var = 0;
-
- /* If struct value address is treated as the first argument, make it so. */
- if (aggregate_value_p (DECL_RESULT (fndecl))
- && ! current_function_returns_pcc_struct
- && struct_value_incoming_rtx == 0)
- {
- tree type = build_pointer_type (TREE_TYPE (fntype));
-
- function_result_decl = build_decl (PARM_DECL, NULL_TREE, type);
-
- DECL_ARG_TYPE (function_result_decl) = type;
- TREE_CHAIN (function_result_decl) = fnargs;
- fnargs = function_result_decl;
- }
-
- parm_reg_stack_loc = (rtx *) oballoc (nparmregs * sizeof (rtx));
- bzero ((char *) parm_reg_stack_loc, nparmregs * sizeof (rtx));
-
-#ifdef INIT_CUMULATIVE_INCOMING_ARGS
- INIT_CUMULATIVE_INCOMING_ARGS (args_so_far, fntype, NULL_RTX);
-#else
- INIT_CUMULATIVE_ARGS (args_so_far, fntype, NULL_RTX, 0);
-#endif
-
- /* We haven't yet found an argument that we must push and pretend the
- caller did. */
- current_function_pretend_args_size = 0;
-
- for (parm = fnargs; parm; parm = TREE_CHAIN (parm))
- {
- int aggregate = AGGREGATE_TYPE_P (TREE_TYPE (parm));
- struct args_size stack_offset;
- struct args_size arg_size;
- int passed_pointer = 0;
- int did_conversion = 0;
- tree passed_type = DECL_ARG_TYPE (parm);
- tree nominal_type = TREE_TYPE (parm);
-
- /* Set LAST_NAMED if this is last named arg before some
- anonymous args. We treat it as if it were anonymous too. */
- int last_named = ((TREE_CHAIN (parm) == 0
- || DECL_NAME (TREE_CHAIN (parm)) == 0)
- && (stdarg || current_function_varargs));
-
- if (TREE_TYPE (parm) == error_mark_node
- /* This can happen after weird syntax errors
- or if an enum type is defined among the parms. */
- || TREE_CODE (parm) != PARM_DECL
- || passed_type == NULL)
- {
- DECL_INCOMING_RTL (parm) = DECL_RTL (parm) = gen_rtx (MEM, BLKmode,
- const0_rtx);
- TREE_USED (parm) = 1;
- continue;
- }
-
- /* For varargs.h function, save info about regs and stack space
- used by the individual args, not including the va_alist arg. */
- if (hide_last_arg && last_named)
- current_function_args_info = args_so_far;
-
- /* Find mode of arg as it is passed, and mode of arg
- as it should be during execution of this function. */
- passed_mode = TYPE_MODE (passed_type);
- nominal_mode = TYPE_MODE (nominal_type);
-
- /* If the parm's mode is VOID, its value doesn't matter,
- and avoid the usual things like emit_move_insn that could crash. */
- if (nominal_mode == VOIDmode)
- {
- DECL_INCOMING_RTL (parm) = DECL_RTL (parm) = const0_rtx;
- continue;
- }
-
- /* 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. */
- if (DECL_TRANSPARENT_UNION (parm)
- || TYPE_TRANSPARENT_UNION (passed_type))
- passed_type = TREE_TYPE (TYPE_FIELDS (passed_type));
-
- /* See if this arg was passed by invisible reference. It is if
- it is an object whose size depends on the contents of the
- object itself or if the machine requires these objects be passed
- that way. */
-
- if ((TREE_CODE (TYPE_SIZE (passed_type)) != INTEGER_CST
- && contains_placeholder_p (TYPE_SIZE (passed_type)))
- || TREE_ADDRESSABLE (passed_type)
-#ifdef FUNCTION_ARG_PASS_BY_REFERENCE
- || FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, passed_mode,
- passed_type, ! last_named)
-#endif
- )
- {
- passed_type = nominal_type = build_pointer_type (passed_type);
- passed_pointer = 1;
- passed_mode = nominal_mode = Pmode;
- }
-
- promoted_mode = passed_mode;
-
-#ifdef PROMOTE_FUNCTION_ARGS
- /* Compute the mode in which the arg is actually extended to. */
- promoted_mode = promote_mode (passed_type, promoted_mode, &unsignedp, 1);
-#endif
-
- /* Let machine desc say which reg (if any) the parm arrives in.
- 0 means it arrives on the stack. */
-#ifdef FUNCTION_INCOMING_ARG
- entry_parm = FUNCTION_INCOMING_ARG (args_so_far, promoted_mode,
- passed_type, ! last_named);
-#else
- entry_parm = FUNCTION_ARG (args_so_far, promoted_mode,
- passed_type, ! last_named);
-#endif
-
- if (entry_parm == 0)
- promoted_mode = passed_mode;
-
-#ifdef SETUP_INCOMING_VARARGS
- /* If this is the last named parameter, do any required setup for
- varargs or stdargs. We need to know about the case of this being an
- addressable type, in which case we skip the registers it
- would have arrived in.
-
- For stdargs, LAST_NAMED will be set for two parameters, the one that
- is actually the last named, and the dummy parameter. We only
- want to do this action once.
-
- Also, indicate when RTL generation is to be suppressed. */
- if (last_named && !varargs_setup)
- {
- SETUP_INCOMING_VARARGS (args_so_far, promoted_mode, passed_type,
- current_function_pretend_args_size,
- second_time);
- varargs_setup = 1;
- }
-#endif
-
- /* Determine parm's home in the stack,
- in case it arrives in the stack or we should pretend it did.
-
- Compute the stack position and rtx where the argument arrives
- and its size.
-
- There is one complexity here: If this was a parameter that would
- have been passed in registers, but wasn't only because it is
- __builtin_va_alist, we want locate_and_pad_parm to treat it as if
- it came in a register so that REG_PARM_STACK_SPACE isn't skipped.
- In this case, we call FUNCTION_ARG with NAMED set to 1 instead of
- 0 as it was the previous time. */
-
- locate_and_pad_parm (promoted_mode, passed_type,
-#ifdef STACK_PARMS_IN_REG_PARM_AREA
- 1,
-#else
-#ifdef FUNCTION_INCOMING_ARG
- FUNCTION_INCOMING_ARG (args_so_far, promoted_mode,
- passed_type,
- (! last_named
- || varargs_setup)) != 0,
-#else
- FUNCTION_ARG (args_so_far, promoted_mode,
- passed_type,
- ! last_named || varargs_setup) != 0,
-#endif
-#endif
- fndecl, &stack_args_size, &stack_offset, &arg_size);
-
- if (! second_time)
- {
- rtx offset_rtx = ARGS_SIZE_RTX (stack_offset);
-
- if (offset_rtx == const0_rtx)
- stack_parm = gen_rtx (MEM, promoted_mode, internal_arg_pointer);
- else
- stack_parm = gen_rtx (MEM, promoted_mode,
- gen_rtx (PLUS, Pmode,
- internal_arg_pointer, offset_rtx));
-
- /* If this is a memory ref that contains aggregate components,
- mark it as such for cse and loop optimize. Likewise if it
- is readonly. */
- MEM_IN_STRUCT_P (stack_parm) = aggregate;
- RTX_UNCHANGING_P (stack_parm) = TREE_READONLY (parm);
- }
-
- /* If this parameter was passed both in registers and in the stack,
- use the copy on the stack. */
- if (MUST_PASS_IN_STACK (promoted_mode, passed_type))
- entry_parm = 0;
-
-#ifdef FUNCTION_ARG_PARTIAL_NREGS
- /* If this parm was passed part in regs and part in memory,
- pretend it arrived entirely in memory
- by pushing the register-part onto the stack.
-
- In the special case of a DImode or DFmode that is split,
- we could put it together in a pseudoreg directly,
- but for now that's not worth bothering with. */
-
- if (entry_parm)
- {
- int nregs = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, promoted_mode,
- passed_type, ! last_named);
-
- if (nregs > 0)
- {
- current_function_pretend_args_size
- = (((nregs * UNITS_PER_WORD) + (PARM_BOUNDARY / BITS_PER_UNIT) - 1)
- / (PARM_BOUNDARY / BITS_PER_UNIT)
- * (PARM_BOUNDARY / BITS_PER_UNIT));
-
- if (! second_time)
- {
- /* Handle calls that pass values in multiple non-contiguous
- locations. The Irix 6 ABI has examples of this. */
- if (GET_CODE (entry_parm) == PARALLEL)
- emit_group_store (validize_mem (stack_parm),
- entry_parm);
- else
- move_block_from_reg (REGNO (entry_parm),
- validize_mem (stack_parm), nregs,
- int_size_in_bytes (TREE_TYPE (parm)));
- }
- entry_parm = stack_parm;
- }
- }
-#endif
-
- /* If we didn't decide this parm came in a register,
- by default it came on the stack. */
- if (entry_parm == 0)
- entry_parm = stack_parm;
-
- /* Record permanently how this parm was passed. */
- if (! second_time)
- DECL_INCOMING_RTL (parm) = entry_parm;
-
- /* If there is actually space on the stack for this parm,
- count it in stack_args_size; otherwise set stack_parm to 0
- to indicate there is no preallocated stack slot for the parm. */
-
- if (entry_parm == stack_parm
-#if defined (REG_PARM_STACK_SPACE) && ! defined (MAYBE_REG_PARM_STACK_SPACE)
- /* On some machines, even if a parm value arrives in a register
- there is still an (uninitialized) stack slot allocated for it.
-
- ??? When MAYBE_REG_PARM_STACK_SPACE is defined, we can't tell
- whether this parameter already has a stack slot allocated,
- because an arg block exists only if current_function_args_size
- is larger than some threshold, and we haven't calculated that
- yet. So, for now, we just assume that stack slots never exist
- in this case. */
- || REG_PARM_STACK_SPACE (fndecl) > 0
-#endif
- )
- {
- stack_args_size.constant += arg_size.constant;
- if (arg_size.var)
- ADD_PARM_SIZE (stack_args_size, arg_size.var);
- }
- else
- /* No stack slot was pushed for this parm. */
- stack_parm = 0;
-
- /* Update info on where next arg arrives in registers. */
-
- FUNCTION_ARG_ADVANCE (args_so_far, promoted_mode,
- passed_type, ! last_named);
-
- /* If this is our second time through, we are done with this parm. */
- if (second_time)
- continue;
-
- /* If we can't trust the parm stack slot to be aligned enough
- for its ultimate type, don't use that slot after entry.
- We'll make another stack slot, if we need one. */
- {
- int thisparm_boundary
- = FUNCTION_ARG_BOUNDARY (promoted_mode, passed_type);
-
- if (GET_MODE_ALIGNMENT (nominal_mode) > thisparm_boundary)
- stack_parm = 0;
- }
-
- /* If parm was passed in memory, and we need to convert it on entry,
- don't store it back in that same slot. */
- if (entry_parm != 0
- && nominal_mode != BLKmode && nominal_mode != passed_mode)
- stack_parm = 0;
-
-#if 0
- /* Now adjust STACK_PARM to the mode and precise location
- where this parameter should live during execution,
- if we discover that it must live in the stack during execution.
- To make debuggers happier on big-endian machines, we store
- the value in the last bytes of the space available. */
-
- if (nominal_mode != BLKmode && nominal_mode != passed_mode
- && stack_parm != 0)
- {
- rtx offset_rtx;
-
- if (BYTES_BIG_ENDIAN
- && GET_MODE_SIZE (nominal_mode) < UNITS_PER_WORD)
- stack_offset.constant += (GET_MODE_SIZE (passed_mode)
- - GET_MODE_SIZE (nominal_mode));
-
- offset_rtx = ARGS_SIZE_RTX (stack_offset);
- if (offset_rtx == const0_rtx)
- stack_parm = gen_rtx (MEM, nominal_mode, internal_arg_pointer);
- else
- stack_parm = gen_rtx (MEM, nominal_mode,
- gen_rtx (PLUS, Pmode,
- internal_arg_pointer, offset_rtx));
-
- /* If this is a memory ref that contains aggregate components,
- mark it as such for cse and loop optimize. */
- MEM_IN_STRUCT_P (stack_parm) = aggregate;
- }
-#endif /* 0 */
-
-#ifdef STACK_REGS
- /* We need this "use" info, because the gcc-register->stack-register
- converter in reg-stack.c needs to know which registers are active
- at the start of the function call. The actual parameter loading
- instructions are not always available then anymore, since they might
- have been optimised away. */
-
- if (GET_CODE (entry_parm) == REG && !(hide_last_arg && last_named))
- emit_insn (gen_rtx (USE, GET_MODE (entry_parm), entry_parm));
-#endif
-
- /* ENTRY_PARM is an RTX for the parameter as it arrives,
- in the mode in which it arrives.
- STACK_PARM is an RTX for a stack slot where the parameter can live
- during the function (in case we want to put it there).
- STACK_PARM is 0 if no stack slot was pushed for it.
-
- Now output code if necessary to convert ENTRY_PARM to
- the type in which this function declares it,
- and store that result in an appropriate place,
- which may be a pseudo reg, may be STACK_PARM,
- or may be a local stack slot if STACK_PARM is 0.
-
- Set DECL_RTL to that place. */
-
- if (nominal_mode == BLKmode || GET_CODE (entry_parm) == PARALLEL)
- {
- /* If a BLKmode arrives in registers, copy it to a stack slot.
- Handle calls that pass values in multiple non-contiguous
- locations. The Irix 6 ABI has examples of this. */
- if (GET_CODE (entry_parm) == REG
- || GET_CODE (entry_parm) == PARALLEL)
- {
- int size_stored
- = CEIL_ROUND (int_size_in_bytes (TREE_TYPE (parm)),
- UNITS_PER_WORD);
-
- /* Note that we will be storing an integral number of words.
- So we have to be careful to ensure that we allocate an
- integral number of words. We do this below in the
- assign_stack_local if space was not allocated in the argument
- list. If it was, this will not work if PARM_BOUNDARY is not
- a multiple of BITS_PER_WORD. It isn't clear how to fix this
- if it becomes a problem. */
-
- if (stack_parm == 0)
- {
- stack_parm
- = assign_stack_local (GET_MODE (entry_parm),
- size_stored, 0);
-
- /* If this is a memory ref that contains aggregate
- components, mark it as such for cse and loop optimize. */
- MEM_IN_STRUCT_P (stack_parm) = aggregate;
- }
-
- else if (PARM_BOUNDARY % BITS_PER_WORD != 0)
- abort ();
-
- if (TREE_READONLY (parm))
- RTX_UNCHANGING_P (stack_parm) = 1;
-
- /* Handle calls that pass values in multiple non-contiguous
- locations. The Irix 6 ABI has examples of this. */
- if (GET_CODE (entry_parm) == PARALLEL)
- emit_group_store (validize_mem (stack_parm), entry_parm);
- else
- move_block_from_reg (REGNO (entry_parm),
- validize_mem (stack_parm),
- size_stored / UNITS_PER_WORD,
- int_size_in_bytes (TREE_TYPE (parm)));
- }
- DECL_RTL (parm) = stack_parm;
- }
- else if (! ((obey_regdecls && ! DECL_REGISTER (parm)
- && ! DECL_INLINE (fndecl))
- /* layout_decl may set this. */
- || TREE_ADDRESSABLE (parm)
- || TREE_SIDE_EFFECTS (parm)
- /* If -ffloat-store specified, don't put explicit
- float variables into registers. */
- || (flag_float_store
- && TREE_CODE (TREE_TYPE (parm)) == REAL_TYPE))
- /* Always assign pseudo to structure return or item passed
- by invisible reference. */
- || passed_pointer || parm == function_result_decl)
- {
- /* Store the parm in a pseudoregister during the function, but we
- may need to do it in a wider mode. */
-
- register rtx parmreg;
- int regno, regnoi, regnor;
-
- unsignedp = TREE_UNSIGNED (TREE_TYPE (parm));
-
- promoted_nominal_mode
- = promote_mode (TREE_TYPE (parm), nominal_mode, &unsignedp, 0);
-
- parmreg = gen_reg_rtx (promoted_nominal_mode);
- mark_user_reg (parmreg);
-
- /* If this was an item that we received a pointer to, set DECL_RTL
- appropriately. */
- if (passed_pointer)
- {
- DECL_RTL (parm)
- = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (passed_type)), parmreg);
- MEM_IN_STRUCT_P (DECL_RTL (parm)) = aggregate;
- }
- else
- DECL_RTL (parm) = parmreg;
-
- /* Copy the value into the register. */
- if (nominal_mode != passed_mode
- || promoted_nominal_mode != promoted_mode)
- {
- /* ENTRY_PARM has been converted to PROMOTED_MODE, its
- mode, by the caller. We now have to convert it to
- NOMINAL_MODE, if different. However, PARMREG may be in
- a diffent mode than NOMINAL_MODE if it is being stored
- promoted.
-
- If ENTRY_PARM is a hard register, it might be in a register
- not valid for operating in its mode (e.g., an odd-numbered
- register for a DFmode). In that case, moves are the only
- thing valid, so we can't do a convert from there. This
- occurs when the calling sequence allow such misaligned
- usages.
-
- In addition, the conversion may involve a call, which could
- clobber parameters which haven't been copied to pseudo
- registers yet. Therefore, we must first copy the parm to
- a pseudo reg here, and save the conversion until after all
- parameters have been moved. */
-
- rtx tempreg = gen_reg_rtx (GET_MODE (entry_parm));
-
- emit_move_insn (tempreg, validize_mem (entry_parm));
-
- push_to_sequence (conversion_insns);
- tempreg = convert_to_mode (nominal_mode, tempreg, unsignedp);
-
- expand_assignment (parm,
- make_tree (nominal_type, tempreg), 0, 0);
- conversion_insns = get_insns ();
- did_conversion = 1;
- end_sequence ();
- }
- else
- emit_move_insn (parmreg, validize_mem (entry_parm));
-
- /* If we were passed a pointer but the actual value
- can safely live in a register, put it in one. */
- if (passed_pointer && TYPE_MODE (TREE_TYPE (parm)) != BLKmode
- && ! ((obey_regdecls && ! DECL_REGISTER (parm)
- && ! DECL_INLINE (fndecl))
- /* layout_decl may set this. */
- || TREE_ADDRESSABLE (parm)
- || TREE_SIDE_EFFECTS (parm)
- /* If -ffloat-store specified, don't put explicit
- float variables into registers. */
- || (flag_float_store
- && TREE_CODE (TREE_TYPE (parm)) == REAL_TYPE)))
- {
- /* We can't use nominal_mode, because it will have been set to
- Pmode above. We must use the actual mode of the parm. */
- parmreg = gen_reg_rtx (TYPE_MODE (TREE_TYPE (parm)));
- mark_user_reg (parmreg);
- emit_move_insn (parmreg, DECL_RTL (parm));
- DECL_RTL (parm) = parmreg;
- /* STACK_PARM is the pointer, not the parm, and PARMREG is
- now the parm. */
- stack_parm = 0;
- }
-#ifdef FUNCTION_ARG_CALLEE_COPIES
- /* If we are passed an arg by reference and it is our responsibility
- to make a copy, do it now.
- PASSED_TYPE and PASSED mode now refer to the pointer, not the
- original argument, so we must recreate them in the call to
- FUNCTION_ARG_CALLEE_COPIES. */
- /* ??? Later add code to handle the case that if the argument isn't
- modified, don't do the copy. */
-
- else if (passed_pointer
- && FUNCTION_ARG_CALLEE_COPIES (args_so_far,
- TYPE_MODE (DECL_ARG_TYPE (parm)),
- DECL_ARG_TYPE (parm),
- ! last_named)
- && ! TREE_ADDRESSABLE (DECL_ARG_TYPE (parm)))
- {
- rtx copy;
- tree type = DECL_ARG_TYPE (parm);
-
- /* This sequence may involve a library call perhaps clobbering
- registers that haven't been copied to pseudos yet. */
-
- push_to_sequence (conversion_insns);
-
- if (TYPE_SIZE (type) == 0
- || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- /* This is a variable sized object. */
- copy = gen_rtx (MEM, BLKmode,
- allocate_dynamic_stack_space
- (expr_size (parm), NULL_RTX,
- TYPE_ALIGN (type)));
- else
- copy = assign_stack_temp (TYPE_MODE (type),
- int_size_in_bytes (type), 1);
- MEM_IN_STRUCT_P (copy) = AGGREGATE_TYPE_P (type);
-
- store_expr (parm, copy, 0);
- emit_move_insn (parmreg, XEXP (copy, 0));
- conversion_insns = get_insns ();
- did_conversion = 1;
- end_sequence ();
- }
-#endif /* FUNCTION_ARG_CALLEE_COPIES */
-
- /* In any case, record the parm's desired stack location
- in case we later discover it must live in the stack.
-
- If it is a COMPLEX value, store the stack location for both
- halves. */
-
- if (GET_CODE (parmreg) == CONCAT)
- regno = MAX (REGNO (XEXP (parmreg, 0)), REGNO (XEXP (parmreg, 1)));
- else
- regno = REGNO (parmreg);
-
- if (regno >= nparmregs)
- {
- rtx *new;
- int old_nparmregs = nparmregs;
-
- nparmregs = regno + 5;
- new = (rtx *) oballoc (nparmregs * sizeof (rtx));
- bcopy ((char *) parm_reg_stack_loc, (char *) new,
- old_nparmregs * sizeof (rtx));
- bzero ((char *) (new + old_nparmregs),
- (nparmregs - old_nparmregs) * sizeof (rtx));
- parm_reg_stack_loc = new;
- }
-
- if (GET_CODE (parmreg) == CONCAT)
- {
- enum machine_mode submode = GET_MODE (XEXP (parmreg, 0));
-
- regnor = REGNO (gen_realpart (submode, parmreg));
- regnoi = REGNO (gen_imagpart (submode, parmreg));
-
- if (stack_parm != 0)
- {
- parm_reg_stack_loc[regnor]
- = gen_realpart (submode, stack_parm);
- parm_reg_stack_loc[regnoi]
- = gen_imagpart (submode, stack_parm);
- }
- else
- {
- parm_reg_stack_loc[regnor] = 0;
- parm_reg_stack_loc[regnoi] = 0;
- }
- }
- else
- parm_reg_stack_loc[REGNO (parmreg)] = stack_parm;
-
- /* Mark the register as eliminable if we did no conversion
- and it was copied from memory at a fixed offset,
- and the arg pointer was not copied to a pseudo-reg.
- If the arg pointer is a pseudo reg or the offset formed
- an invalid address, such memory-equivalences
- as we make here would screw up life analysis for it. */
- if (nominal_mode == passed_mode
- && ! did_conversion
- && stack_parm != 0
- && GET_CODE (stack_parm) == MEM
- && stack_offset.var == 0
- && reg_mentioned_p (virtual_incoming_args_rtx,
- XEXP (stack_parm, 0)))
- {
- rtx linsn = get_last_insn ();
- rtx sinsn, set;
-
- /* Mark complex types separately. */
- if (GET_CODE (parmreg) == CONCAT)
- /* Scan backwards for the set of the real and
- imaginary parts. */
- for (sinsn = linsn; sinsn != 0;
- sinsn = prev_nonnote_insn (sinsn))
- {
- set = single_set (sinsn);
- if (set != 0
- && SET_DEST (set) == regno_reg_rtx [regnoi])
- REG_NOTES (sinsn)
- = gen_rtx (EXPR_LIST, REG_EQUIV,
- parm_reg_stack_loc[regnoi],
- REG_NOTES (sinsn));
- else if (set != 0
- && SET_DEST (set) == regno_reg_rtx [regnor])
- REG_NOTES (sinsn)
- = gen_rtx (EXPR_LIST, REG_EQUIV,
- parm_reg_stack_loc[regnor],
- REG_NOTES (sinsn));
- }
- else if ((set = single_set (linsn)) != 0
- && SET_DEST (set) == parmreg)
- REG_NOTES (linsn)
- = gen_rtx (EXPR_LIST, REG_EQUIV,
- stack_parm, REG_NOTES (linsn));
- }
-
- /* For pointer data type, suggest pointer register. */
- if (TREE_CODE (TREE_TYPE (parm)) == POINTER_TYPE)
- mark_reg_pointer (parmreg,
- (TYPE_ALIGN (TREE_TYPE (TREE_TYPE (parm)))
- / BITS_PER_UNIT));
- }
- else
- {
- /* Value must be stored in the stack slot STACK_PARM
- during function execution. */
-
- if (promoted_mode != nominal_mode)
- {
- /* Conversion is required. */
- rtx tempreg = gen_reg_rtx (GET_MODE (entry_parm));
-
- emit_move_insn (tempreg, validize_mem (entry_parm));
-
- push_to_sequence (conversion_insns);
- entry_parm = convert_to_mode (nominal_mode, tempreg,
- TREE_UNSIGNED (TREE_TYPE (parm)));
- conversion_insns = get_insns ();
- did_conversion = 1;
- end_sequence ();
- }
-
- if (entry_parm != stack_parm)
- {
- if (stack_parm == 0)
- {
- stack_parm
- = assign_stack_local (GET_MODE (entry_parm),
- GET_MODE_SIZE (GET_MODE (entry_parm)), 0);
- /* If this is a memory ref that contains aggregate components,
- mark it as such for cse and loop optimize. */
- MEM_IN_STRUCT_P (stack_parm) = aggregate;
- }
-
- if (promoted_mode != nominal_mode)
- {
- push_to_sequence (conversion_insns);
- emit_move_insn (validize_mem (stack_parm),
- validize_mem (entry_parm));
- conversion_insns = get_insns ();
- end_sequence ();
- }
- else
- emit_move_insn (validize_mem (stack_parm),
- validize_mem (entry_parm));
- }
-
- DECL_RTL (parm) = stack_parm;
- }
-
- /* If this "parameter" was the place where we are receiving the
- function's incoming structure pointer, set up the result. */
- if (parm == function_result_decl)
- {
- tree result = DECL_RESULT (fndecl);
- tree restype = TREE_TYPE (result);
-
- DECL_RTL (result)
- = gen_rtx (MEM, DECL_MODE (result), DECL_RTL (parm));
-
- MEM_IN_STRUCT_P (DECL_RTL (result)) = AGGREGATE_TYPE_P (restype);
- }
-
- if (TREE_THIS_VOLATILE (parm))
- MEM_VOLATILE_P (DECL_RTL (parm)) = 1;
- if (TREE_READONLY (parm))
- RTX_UNCHANGING_P (DECL_RTL (parm)) = 1;
- }
-
- /* Output all parameter conversion instructions (possibly including calls)
- now that all parameters have been copied out of hard registers. */
- emit_insns (conversion_insns);
-
- max_parm_reg = max_reg_num ();
- last_parm_insn = get_last_insn ();
-
- current_function_args_size = stack_args_size.constant;
-
- /* Adjust function incoming argument size for alignment and
- minimum length. */
-
-#ifdef REG_PARM_STACK_SPACE
-#ifndef MAYBE_REG_PARM_STACK_SPACE
- current_function_args_size = MAX (current_function_args_size,
- REG_PARM_STACK_SPACE (fndecl));
-#endif
-#endif
-
-#ifdef STACK_BOUNDARY
-#define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
-
- current_function_args_size
- = ((current_function_args_size + STACK_BYTES - 1)
- / STACK_BYTES) * STACK_BYTES;
-#endif
-
-#ifdef ARGS_GROW_DOWNWARD
- current_function_arg_offset_rtx
- = (stack_args_size.var == 0 ? GEN_INT (-stack_args_size.constant)
- : expand_expr (size_binop (MINUS_EXPR, stack_args_size.var,
- size_int (-stack_args_size.constant)),
- NULL_RTX, VOIDmode, 0));
-#else
- current_function_arg_offset_rtx = ARGS_SIZE_RTX (stack_args_size);
-#endif
-
- /* See how many bytes, if any, of its args a function should try to pop
- on return. */
-
- current_function_pops_args = RETURN_POPS_ARGS (fndecl, TREE_TYPE (fndecl),
- current_function_args_size);
-
- /* For stdarg.h function, save info about
- regs and stack space used by the named args. */
-
- if (!hide_last_arg)
- current_function_args_info = args_so_far;
-
- /* Set the rtx used for the function return value. Put this in its
- own variable so any optimizers that need this information don't have
- to include tree.h. Do this here so it gets done when an inlined
- function gets output. */
-
- current_function_return_rtx = DECL_RTL (DECL_RESULT (fndecl));
-}
-
-/* Indicate whether REGNO is an incoming argument to the current function
- that was promoted to a wider mode. If so, return the RTX for the
- register (to get its mode). PMODE and PUNSIGNEDP are set to the mode
- that REGNO is promoted from and whether the promotion was signed or
- unsigned. */
-
-#ifdef PROMOTE_FUNCTION_ARGS
-
-rtx
-promoted_input_arg (regno, pmode, punsignedp)
- int regno;
- enum machine_mode *pmode;
- int *punsignedp;
-{
- tree arg;
-
- for (arg = DECL_ARGUMENTS (current_function_decl); arg;
- arg = TREE_CHAIN (arg))
- if (GET_CODE (DECL_INCOMING_RTL (arg)) == REG
- && REGNO (DECL_INCOMING_RTL (arg)) == regno
- && TYPE_MODE (DECL_ARG_TYPE (arg)) == TYPE_MODE (TREE_TYPE (arg)))
- {
- enum machine_mode mode = TYPE_MODE (TREE_TYPE (arg));
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (arg));
-
- mode = promote_mode (TREE_TYPE (arg), mode, &unsignedp, 1);
- if (mode == GET_MODE (DECL_INCOMING_RTL (arg))
- && mode != DECL_MODE (arg))
- {
- *pmode = DECL_MODE (arg);
- *punsignedp = unsignedp;
- return DECL_INCOMING_RTL (arg);
- }
- }
-
- return 0;
-}
-
-#endif
-
-/* Compute the size and offset from the start of the stacked arguments for a
- parm passed in mode PASSED_MODE and with type TYPE.
-
- INITIAL_OFFSET_PTR points to the current offset into the stacked
- arguments.
-
- The starting offset and size for this parm are returned in *OFFSET_PTR
- and *ARG_SIZE_PTR, respectively.
-
- IN_REGS is non-zero if the argument will be passed in registers. It will
- never be set if REG_PARM_STACK_SPACE is not defined.
-
- FNDECL is the function in which the argument was defined.
-
- There are two types of rounding that are done. The first, controlled by
- FUNCTION_ARG_BOUNDARY, forces the offset from the start of the argument
- list to be aligned to the specific boundary (in bits). This rounding
- affects the initial and starting offsets, but not the argument size.
-
- The second, controlled by FUNCTION_ARG_PADDING and PARM_BOUNDARY,
- optionally rounds the size of the parm to PARM_BOUNDARY. The
- initial offset is not affected by this rounding, while the size always
- is and the starting offset may be. */
-
-/* offset_ptr will be negative for ARGS_GROW_DOWNWARD case;
- initial_offset_ptr is positive because locate_and_pad_parm's
- callers pass in the total size of args so far as
- initial_offset_ptr. arg_size_ptr is always positive.*/
-
-void
-locate_and_pad_parm (passed_mode, type, in_regs, fndecl,
- initial_offset_ptr, offset_ptr, arg_size_ptr)
- enum machine_mode passed_mode;
- tree type;
- int in_regs;
- tree fndecl;
- struct args_size *initial_offset_ptr;
- struct args_size *offset_ptr;
- struct args_size *arg_size_ptr;
-{
- tree sizetree
- = type ? size_in_bytes (type) : size_int (GET_MODE_SIZE (passed_mode));
- enum direction where_pad = FUNCTION_ARG_PADDING (passed_mode, type);
- int boundary = FUNCTION_ARG_BOUNDARY (passed_mode, type);
- int boundary_in_bytes = boundary / BITS_PER_UNIT;
- int reg_parm_stack_space = 0;
-
-#ifdef REG_PARM_STACK_SPACE
- /* If we have found a stack parm before we reach the end of the
- area reserved for registers, skip that area. */
- if (! in_regs)
- {
-#ifdef MAYBE_REG_PARM_STACK_SPACE
- reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE;
-#else
- reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
-#endif
- if (reg_parm_stack_space > 0)
- {
- if (initial_offset_ptr->var)
- {
- initial_offset_ptr->var
- = size_binop (MAX_EXPR, ARGS_SIZE_TREE (*initial_offset_ptr),
- size_int (reg_parm_stack_space));
- initial_offset_ptr->constant = 0;
- }
- else if (initial_offset_ptr->constant < reg_parm_stack_space)
- initial_offset_ptr->constant = reg_parm_stack_space;
- }
- }
-#endif /* REG_PARM_STACK_SPACE */
-
- arg_size_ptr->var = 0;
- arg_size_ptr->constant = 0;
-
-#ifdef ARGS_GROW_DOWNWARD
- if (initial_offset_ptr->var)
- {
- offset_ptr->constant = 0;
- offset_ptr->var = size_binop (MINUS_EXPR, integer_zero_node,
- initial_offset_ptr->var);
- }
- else
- {
- offset_ptr->constant = - initial_offset_ptr->constant;
- offset_ptr->var = 0;
- }
- if (where_pad != none
- && (TREE_CODE (sizetree) != INTEGER_CST
- || ((TREE_INT_CST_LOW (sizetree) * BITS_PER_UNIT) % PARM_BOUNDARY)))
- sizetree = round_up (sizetree, PARM_BOUNDARY / BITS_PER_UNIT);
- SUB_PARM_SIZE (*offset_ptr, sizetree);
- if (where_pad != downward)
- pad_to_arg_alignment (offset_ptr, boundary);
- if (initial_offset_ptr->var)
- {
- arg_size_ptr->var = size_binop (MINUS_EXPR,
- size_binop (MINUS_EXPR,
- integer_zero_node,
- initial_offset_ptr->var),
- offset_ptr->var);
- }
- else
- {
- arg_size_ptr->constant = (- initial_offset_ptr->constant -
- offset_ptr->constant);
- }
-#else /* !ARGS_GROW_DOWNWARD */
- pad_to_arg_alignment (initial_offset_ptr, boundary);
- *offset_ptr = *initial_offset_ptr;
-
-#ifdef PUSH_ROUNDING
- if (passed_mode != BLKmode)
- sizetree = size_int (PUSH_ROUNDING (TREE_INT_CST_LOW (sizetree)));
-#endif
-
- /* Pad_below needs the pre-rounded size to know how much to pad below
- so this must be done before rounding up. */
- if (where_pad == downward
- /* However, BLKmode args passed in regs have their padding done elsewhere.
- The stack slot must be able to hold the entire register. */
- && !(in_regs && passed_mode == BLKmode))
- pad_below (offset_ptr, passed_mode, sizetree);
-
- if (where_pad != none
- && (TREE_CODE (sizetree) != INTEGER_CST
- || ((TREE_INT_CST_LOW (sizetree) * BITS_PER_UNIT) % PARM_BOUNDARY)))
- sizetree = round_up (sizetree, PARM_BOUNDARY / BITS_PER_UNIT);
-
- ADD_PARM_SIZE (*arg_size_ptr, sizetree);
-#endif /* ARGS_GROW_DOWNWARD */
-}
-
-/* Round the stack offset in *OFFSET_PTR up to a multiple of BOUNDARY.
- BOUNDARY is measured in bits, but must be a multiple of a storage unit. */
-
-static void
-pad_to_arg_alignment (offset_ptr, boundary)
- struct args_size *offset_ptr;
- int boundary;
-{
- int boundary_in_bytes = boundary / BITS_PER_UNIT;
-
- if (boundary > BITS_PER_UNIT)
- {
- if (offset_ptr->var)
- {
- offset_ptr->var =
-#ifdef ARGS_GROW_DOWNWARD
- round_down
-#else
- round_up
-#endif
- (ARGS_SIZE_TREE (*offset_ptr),
- boundary / BITS_PER_UNIT);
- offset_ptr->constant = 0; /*?*/
- }
- else
- offset_ptr->constant =
-#ifdef ARGS_GROW_DOWNWARD
- FLOOR_ROUND (offset_ptr->constant, boundary_in_bytes);
-#else
- CEIL_ROUND (offset_ptr->constant, boundary_in_bytes);
-#endif
- }
-}
-
-static void
-pad_below (offset_ptr, passed_mode, sizetree)
- struct args_size *offset_ptr;
- enum machine_mode passed_mode;
- tree sizetree;
-{
- if (passed_mode != BLKmode)
- {
- if (GET_MODE_BITSIZE (passed_mode) % PARM_BOUNDARY)
- offset_ptr->constant
- += (((GET_MODE_BITSIZE (passed_mode) + PARM_BOUNDARY - 1)
- / PARM_BOUNDARY * PARM_BOUNDARY / BITS_PER_UNIT)
- - GET_MODE_SIZE (passed_mode));
- }
- else
- {
- if (TREE_CODE (sizetree) != INTEGER_CST
- || (TREE_INT_CST_LOW (sizetree) * BITS_PER_UNIT) % PARM_BOUNDARY)
- {
- /* Round the size up to multiple of PARM_BOUNDARY bits. */
- tree s2 = round_up (sizetree, PARM_BOUNDARY / BITS_PER_UNIT);
- /* Add it in. */
- ADD_PARM_SIZE (*offset_ptr, s2);
- SUB_PARM_SIZE (*offset_ptr, sizetree);
- }
- }
-}
-
-static tree
-round_down (value, divisor)
- tree value;
- int divisor;
-{
- return size_binop (MULT_EXPR,
- size_binop (FLOOR_DIV_EXPR, value, size_int (divisor)),
- size_int (divisor));
-}
-
-/* Walk the tree of blocks describing the binding levels within a function
- and warn about uninitialized variables.
- This is done after calling flow_analysis and before global_alloc
- clobbers the pseudo-regs to hard regs. */
-
-void
-uninitialized_vars_warning (block)
- tree block;
-{
- register tree decl, sub;
- for (decl = BLOCK_VARS (block); decl; decl = TREE_CHAIN (decl))
- {
- if (TREE_CODE (decl) == VAR_DECL
- /* These warnings are unreliable for and aggregates
- because assigning the fields one by one can fail to convince
- flow.c that the entire aggregate was initialized.
- Unions are troublesome because members may be shorter. */
- && ! AGGREGATE_TYPE_P (TREE_TYPE (decl))
- && DECL_RTL (decl) != 0
- && GET_CODE (DECL_RTL (decl)) == REG
- && regno_uninitialized (REGNO (DECL_RTL (decl))))
- warning_with_decl (decl,
- "`%s' might be used uninitialized in this function");
- if (TREE_CODE (decl) == VAR_DECL
- && DECL_RTL (decl) != 0
- && GET_CODE (DECL_RTL (decl)) == REG
- && regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
- warning_with_decl (decl,
- "variable `%s' might be clobbered by `longjmp' or `vfork'");
- }
- for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
- uninitialized_vars_warning (sub);
-}
-
-/* Do the appropriate part of uninitialized_vars_warning
- but for arguments instead of local variables. */
-
-void
-setjmp_args_warning ()
-{
- register tree decl;
- for (decl = DECL_ARGUMENTS (current_function_decl);
- decl; decl = TREE_CHAIN (decl))
- if (DECL_RTL (decl) != 0
- && GET_CODE (DECL_RTL (decl)) == REG
- && regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
- warning_with_decl (decl, "argument `%s' might be clobbered by `longjmp' or `vfork'");
-}
-
-/* If this function call setjmp, put all vars into the stack
- unless they were declared `register'. */
-
-void
-setjmp_protect (block)
- tree block;
-{
- register tree decl, sub;
- for (decl = BLOCK_VARS (block); decl; decl = TREE_CHAIN (decl))
- if ((TREE_CODE (decl) == VAR_DECL
- || TREE_CODE (decl) == PARM_DECL)
- && DECL_RTL (decl) != 0
- && GET_CODE (DECL_RTL (decl)) == REG
- /* If this variable came from an inline function, it must be
- that it's life doesn't overlap the setjmp. If there was a
- setjmp in the function, it would already be in memory. We
- must exclude such variable because their DECL_RTL might be
- set to strange things such as virtual_stack_vars_rtx. */
- && ! DECL_FROM_INLINE (decl)
- && (
-#ifdef NON_SAVING_SETJMP
- /* If longjmp doesn't restore the registers,
- don't put anything in them. */
- NON_SAVING_SETJMP
- ||
-#endif
- ! DECL_REGISTER (decl)))
- put_var_into_stack (decl);
- for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
- setjmp_protect (sub);
-}
-
-/* Like the previous function, but for args instead of local variables. */
-
-void
-setjmp_protect_args ()
-{
- register tree decl, sub;
- for (decl = DECL_ARGUMENTS (current_function_decl);
- decl; decl = TREE_CHAIN (decl))
- if ((TREE_CODE (decl) == VAR_DECL
- || TREE_CODE (decl) == PARM_DECL)
- && DECL_RTL (decl) != 0
- && GET_CODE (DECL_RTL (decl)) == REG
- && (
- /* If longjmp doesn't restore the registers,
- don't put anything in them. */
-#ifdef NON_SAVING_SETJMP
- NON_SAVING_SETJMP
- ||
-#endif
- ! DECL_REGISTER (decl)))
- put_var_into_stack (decl);
-}
-
-/* Return the context-pointer register corresponding to DECL,
- or 0 if it does not need one. */
-
-rtx
-lookup_static_chain (decl)
- tree decl;
-{
- tree context = decl_function_context (decl);
- tree link;
-
- if (context == 0
- || (TREE_CODE (decl) == FUNCTION_DECL && DECL_NO_STATIC_CHAIN (decl)))
- return 0;
-
- /* We treat inline_function_decl as an alias for the current function
- because that is the inline function whose vars, types, etc.
- are being merged into the current function.
- See expand_inline_function. */
- if (context == current_function_decl || context == inline_function_decl)
- return virtual_stack_vars_rtx;
-
- for (link = context_display; link; link = TREE_CHAIN (link))
- if (TREE_PURPOSE (link) == context)
- return RTL_EXPR_RTL (TREE_VALUE (link));
-
- abort ();
-}
-
-/* Convert a stack slot address ADDR for variable VAR
- (from a containing function)
- into an address valid in this function (using a static chain). */
-
-rtx
-fix_lexical_addr (addr, var)
- rtx addr;
- tree var;
-{
- rtx basereg;
- int displacement;
- tree context = decl_function_context (var);
- struct function *fp;
- rtx base = 0;
-
- /* If this is the present function, we need not do anything. */
- if (context == current_function_decl || context == inline_function_decl)
- return addr;
-
- for (fp = outer_function_chain; fp; fp = fp->next)
- if (fp->decl == context)
- break;
-
- if (fp == 0)
- abort ();
-
- /* Decode given address as base reg plus displacement. */
- if (GET_CODE (addr) == REG)
- basereg = addr, displacement = 0;
- else if (GET_CODE (addr) == PLUS && GET_CODE (XEXP (addr, 1)) == CONST_INT)
- basereg = XEXP (addr, 0), displacement = INTVAL (XEXP (addr, 1));
- else
- abort ();
-
- /* We accept vars reached via the containing function's
- incoming arg pointer and via its stack variables pointer. */
- if (basereg == fp->internal_arg_pointer)
- {
- /* If reached via arg pointer, get the arg pointer value
- out of that function's stack frame.
-
- There are two cases: If a separate ap is needed, allocate a
- slot in the outer function for it and dereference it that way.
- This is correct even if the real ap is actually a pseudo.
- Otherwise, just adjust the offset from the frame pointer to
- compensate. */
-
-#ifdef NEED_SEPARATE_AP
- rtx addr;
-
- if (fp->arg_pointer_save_area == 0)
- fp->arg_pointer_save_area
- = assign_outer_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0, fp);
-
- addr = fix_lexical_addr (XEXP (fp->arg_pointer_save_area, 0), var);
- addr = memory_address (Pmode, addr);
-
- base = copy_to_reg (gen_rtx (MEM, Pmode, addr));
-#else
- displacement += (FIRST_PARM_OFFSET (context) - STARTING_FRAME_OFFSET);
- base = lookup_static_chain (var);
-#endif
- }
-
- else if (basereg == virtual_stack_vars_rtx)
- {
- /* This is the same code as lookup_static_chain, duplicated here to
- avoid an extra call to decl_function_context. */
- tree link;
-
- for (link = context_display; link; link = TREE_CHAIN (link))
- if (TREE_PURPOSE (link) == context)
- {
- base = RTL_EXPR_RTL (TREE_VALUE (link));
- break;
- }
- }
-
- if (base == 0)
- abort ();
-
- /* Use same offset, relative to appropriate static chain or argument
- pointer. */
- return plus_constant (base, displacement);
-}
-
-/* Return the address of the trampoline for entering nested fn FUNCTION.
- If necessary, allocate a trampoline (in the stack frame)
- and emit rtl to initialize its contents (at entry to this function). */
-
-rtx
-trampoline_address (function)
- tree function;
-{
- tree link;
- tree rtlexp;
- rtx tramp;
- struct function *fp;
- tree fn_context;
-
- /* Find an existing trampoline and return it. */
- for (link = trampoline_list; link; link = TREE_CHAIN (link))
- if (TREE_PURPOSE (link) == function)
- return
- round_trampoline_addr (XEXP (RTL_EXPR_RTL (TREE_VALUE (link)), 0));
-
- for (fp = outer_function_chain; fp; fp = fp->next)
- for (link = fp->trampoline_list; link; link = TREE_CHAIN (link))
- if (TREE_PURPOSE (link) == function)
- {
- tramp = fix_lexical_addr (XEXP (RTL_EXPR_RTL (TREE_VALUE (link)), 0),
- function);
- return round_trampoline_addr (tramp);
- }
-
- /* None exists; we must make one. */
-
- /* Find the `struct function' for the function containing FUNCTION. */
- fp = 0;
- fn_context = decl_function_context (function);
- if (fn_context != current_function_decl)
- for (fp = outer_function_chain; fp; fp = fp->next)
- if (fp->decl == fn_context)
- break;
-
- /* Allocate run-time space for this trampoline
- (usually in the defining function's stack frame). */
-#ifdef ALLOCATE_TRAMPOLINE
- tramp = ALLOCATE_TRAMPOLINE (fp);
-#else
- /* If rounding needed, allocate extra space
- to ensure we have TRAMPOLINE_SIZE bytes left after rounding up. */
-#ifdef TRAMPOLINE_ALIGNMENT
-#define TRAMPOLINE_REAL_SIZE \
- (TRAMPOLINE_SIZE + (TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT) - 1)
-#else
-#define TRAMPOLINE_REAL_SIZE (TRAMPOLINE_SIZE)
-#endif
- if (fp != 0)
- tramp = assign_outer_stack_local (BLKmode, TRAMPOLINE_REAL_SIZE, 0, fp);
- else
- tramp = assign_stack_local (BLKmode, TRAMPOLINE_REAL_SIZE, 0);
-#endif
-
- /* Record the trampoline for reuse and note it for later initialization
- by expand_function_end. */
- if (fp != 0)
- {
- push_obstacks (fp->function_maybepermanent_obstack,
- fp->function_maybepermanent_obstack);
- rtlexp = make_node (RTL_EXPR);
- RTL_EXPR_RTL (rtlexp) = tramp;
- fp->trampoline_list = tree_cons (function, rtlexp, fp->trampoline_list);
- pop_obstacks ();
- }
- else
- {
- /* Make the RTL_EXPR node temporary, not momentary, so that the
- trampoline_list doesn't become garbage. */
- int momentary = suspend_momentary ();
- rtlexp = make_node (RTL_EXPR);
- resume_momentary (momentary);
-
- RTL_EXPR_RTL (rtlexp) = tramp;
- trampoline_list = tree_cons (function, rtlexp, trampoline_list);
- }
-
- tramp = fix_lexical_addr (XEXP (tramp, 0), function);
- return round_trampoline_addr (tramp);
-}
-
-/* Given a trampoline address,
- round it to multiple of TRAMPOLINE_ALIGNMENT. */
-
-static rtx
-round_trampoline_addr (tramp)
- rtx tramp;
-{
-#ifdef TRAMPOLINE_ALIGNMENT
- /* Round address up to desired boundary. */
- rtx temp = gen_reg_rtx (Pmode);
- temp = expand_binop (Pmode, add_optab, tramp,
- GEN_INT (TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT - 1),
- temp, 0, OPTAB_LIB_WIDEN);
- tramp = expand_binop (Pmode, and_optab, temp,
- GEN_INT (- TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT),
- temp, 0, OPTAB_LIB_WIDEN);
-#endif
- return tramp;
-}
-
-/* The functions identify_blocks and reorder_blocks provide a way to
- reorder the tree of BLOCK nodes, for optimizers that reshuffle or
- duplicate portions of the RTL code. Call identify_blocks before
- changing the RTL, and call reorder_blocks after. */
-
-/* Put all this function's BLOCK nodes including those that are chained
- onto the first block into a vector, and return it.
- Also store in each NOTE for the beginning or end of a block
- the index of that block in the vector.
- The arguments are BLOCK, the chain of top-level blocks of the function,
- and INSNS, the insn chain of the function. */
-
-tree *
-identify_blocks (block, insns)
- tree block;
- rtx insns;
-{
- int n_blocks;
- tree *block_vector;
- int *block_stack;
- int depth = 0;
- int next_block_number = 1;
- int current_block_number = 1;
- rtx insn;
-
- if (block == 0)
- return 0;
-
- n_blocks = all_blocks (block, 0);
- block_vector = (tree *) xmalloc (n_blocks * sizeof (tree));
- block_stack = (int *) alloca (n_blocks * sizeof (int));
-
- all_blocks (block, block_vector);
-
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
- {
- block_stack[depth++] = current_block_number;
- current_block_number = next_block_number;
- NOTE_BLOCK_NUMBER (insn) = next_block_number++;
- }
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END)
- {
- current_block_number = block_stack[--depth];
- NOTE_BLOCK_NUMBER (insn) = current_block_number;
- }
- }
-
- if (n_blocks != next_block_number)
- abort ();
-
- return block_vector;
-}
-
-/* Given BLOCK_VECTOR which was returned by identify_blocks,
- and a revised instruction chain, rebuild the tree structure
- of BLOCK nodes to correspond to the new order of RTL.
- The new block tree is inserted below TOP_BLOCK.
- Returns the current top-level block. */
-
-tree
-reorder_blocks (block_vector, block, insns)
- tree *block_vector;
- tree block;
- rtx insns;
-{
- tree current_block = block;
- rtx insn;
-
- if (block_vector == 0)
- return block;
-
- /* Prune the old trees away, so that it doesn't get in the way. */
- BLOCK_SUBBLOCKS (current_block) = 0;
- BLOCK_CHAIN (current_block) = 0;
-
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
- {
- tree block = block_vector[NOTE_BLOCK_NUMBER (insn)];
- /* If we have seen this block before, copy it. */
- if (TREE_ASM_WRITTEN (block))
- block = copy_node (block);
- BLOCK_SUBBLOCKS (block) = 0;
- TREE_ASM_WRITTEN (block) = 1;
- BLOCK_SUPERCONTEXT (block) = current_block;
- BLOCK_CHAIN (block) = BLOCK_SUBBLOCKS (current_block);
- BLOCK_SUBBLOCKS (current_block) = block;
- current_block = block;
- NOTE_SOURCE_FILE (insn) = 0;
- }
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END)
- {
- BLOCK_SUBBLOCKS (current_block)
- = blocks_nreverse (BLOCK_SUBBLOCKS (current_block));
- current_block = BLOCK_SUPERCONTEXT (current_block);
- NOTE_SOURCE_FILE (insn) = 0;
- }
- }
-
- BLOCK_SUBBLOCKS (current_block)
- = blocks_nreverse (BLOCK_SUBBLOCKS (current_block));
- return current_block;
-}
-
-/* Reverse the order of elements in the chain T of blocks,
- and return the new head of the chain (old last element). */
-
-static tree
-blocks_nreverse (t)
- tree t;
-{
- register tree prev = 0, decl, next;
- for (decl = t; decl; decl = next)
- {
- next = BLOCK_CHAIN (decl);
- BLOCK_CHAIN (decl) = prev;
- prev = decl;
- }
- return prev;
-}
-
-/* Count the subblocks of the list starting with BLOCK, and list them
- all into the vector VECTOR. Also clear TREE_ASM_WRITTEN in all
- blocks. */
-
-static int
-all_blocks (block, vector)
- tree block;
- tree *vector;
-{
- int n_blocks = 0;
-
- while (block)
- {
- TREE_ASM_WRITTEN (block) = 0;
-
- /* Record this block. */
- if (vector)
- vector[n_blocks] = block;
-
- ++n_blocks;
-
- /* Record the subblocks, and their subblocks... */
- n_blocks += all_blocks (BLOCK_SUBBLOCKS (block),
- vector ? vector + n_blocks : 0);
- block = BLOCK_CHAIN (block);
- }
-
- return n_blocks;
-}
-
-/* Build bytecode call descriptor for function SUBR. */
-
-rtx
-bc_build_calldesc (subr)
- tree subr;
-{
- tree calldesc = 0, arg;
- int nargs = 0;
-
- /* Build the argument description vector in reverse order. */
- DECL_ARGUMENTS (subr) = nreverse (DECL_ARGUMENTS (subr));
- nargs = 0;
-
- for (arg = DECL_ARGUMENTS (subr); arg; arg = TREE_CHAIN (arg))
- {
- ++nargs;
-
- calldesc = tree_cons ((tree) 0, size_in_bytes (TREE_TYPE (arg)), calldesc);
- calldesc = tree_cons ((tree) 0, bc_runtime_type_code (TREE_TYPE (arg)), calldesc);
- }
-
- DECL_ARGUMENTS (subr) = nreverse (DECL_ARGUMENTS (subr));
-
- /* Prepend the function's return type. */
- calldesc = tree_cons ((tree) 0,
- size_in_bytes (TREE_TYPE (TREE_TYPE (subr))),
- calldesc);
-
- calldesc = tree_cons ((tree) 0,
- bc_runtime_type_code (TREE_TYPE (TREE_TYPE (subr))),
- calldesc);
-
- /* Prepend the arg count. */
- calldesc = tree_cons ((tree) 0, build_int_2 (nargs, 0), calldesc);
-
- /* Output the call description vector and get its address. */
- calldesc = build_nt (CONSTRUCTOR, (tree) 0, calldesc);
- TREE_TYPE (calldesc) = build_array_type (integer_type_node,
- build_index_type (build_int_2 (nargs * 2, 0)));
-
- return output_constant_def (calldesc);
-}
-
-
-/* Generate RTL for the start of the function SUBR (a FUNCTION_DECL tree node)
- and initialize static variables for generating RTL for the statements
- of the function. */
-
-void
-init_function_start (subr, filename, line)
- tree subr;
- char *filename;
- int line;
-{
- if (output_bytecode)
- {
- this_function_decl = subr;
- this_function_calldesc = bc_build_calldesc (subr);
- local_vars_size = 0;
- stack_depth = 0;
- max_stack_depth = 0;
- stmt_expr_depth = 0;
- return;
- }
-
- init_stmt_for_function ();
-
- cse_not_expected = ! optimize;
-
- /* Caller save not needed yet. */
- caller_save_needed = 0;
-
- /* No stack slots have been made yet. */
- stack_slot_list = 0;
-
- /* There is no stack slot for handling nonlocal gotos. */
- nonlocal_goto_handler_slot = 0;
- nonlocal_goto_stack_level = 0;
-
- /* No labels have been declared for nonlocal use. */
- nonlocal_labels = 0;
-
- /* No function calls so far in this function. */
- function_call_count = 0;
-
- /* No parm regs have been allocated.
- (This is important for output_inline_function.) */
- max_parm_reg = LAST_VIRTUAL_REGISTER + 1;
-
- /* Initialize the RTL mechanism. */
- init_emit ();
-
- /* Initialize the queue of pending postincrement and postdecrements,
- and some other info in expr.c. */
- init_expr ();
-
- /* We haven't done register allocation yet. */
- reg_renumber = 0;
-
- init_const_rtx_hash_table ();
-
- current_function_name = (*decl_printable_name) (subr, 2);
-
- /* Nonzero if this is a nested function that uses a static chain. */
-
- current_function_needs_context
- = (decl_function_context (current_function_decl) != 0
- && ! DECL_NO_STATIC_CHAIN (current_function_decl));
-
- /* Set if a call to setjmp is seen. */
- current_function_calls_setjmp = 0;
-
- /* Set if a call to longjmp is seen. */
- current_function_calls_longjmp = 0;
-
- current_function_calls_alloca = 0;
- current_function_has_nonlocal_label = 0;
- current_function_has_nonlocal_goto = 0;
- current_function_contains_functions = 0;
-
- current_function_returns_pcc_struct = 0;
- current_function_returns_struct = 0;
- current_function_epilogue_delay_list = 0;
- current_function_uses_const_pool = 0;
- current_function_uses_pic_offset_table = 0;
-
- /* We have not yet needed to make a label to jump to for tail-recursion. */
- tail_recursion_label = 0;
-
- /* We haven't had a need to make a save area for ap yet. */
-
- arg_pointer_save_area = 0;
-
- /* No stack slots allocated yet. */
- frame_offset = 0;
-
- /* No SAVE_EXPRs in this function yet. */
- save_expr_regs = 0;
-
- /* No RTL_EXPRs in this function yet. */
- rtl_expr_chain = 0;
-
- /* Set up to allocate temporaries. */
- init_temp_slots ();
-
- /* Within function body, compute a type's size as soon it is laid out. */
- immediate_size_expand++;
-
- /* We haven't made any trampolines for this function yet. */
- trampoline_list = 0;
-
- init_pending_stack_adjust ();
- inhibit_defer_pop = 0;
-
- current_function_outgoing_args_size = 0;
-
- /* Prevent ever trying to delete the first instruction of a function.
- Also tell final how to output a linenum before the function prologue. */
- emit_line_note (filename, line);
-
- /* Make sure first insn is a note even if we don't want linenums.
- This makes sure the first insn will never be deleted.
- Also, final expects a note to appear there. */
- emit_note (NULL_PTR, NOTE_INSN_DELETED);
-
- /* Set flags used by final.c. */
- if (aggregate_value_p (DECL_RESULT (subr)))
- {
-#ifdef PCC_STATIC_STRUCT_RETURN
- current_function_returns_pcc_struct = 1;
-#endif
- current_function_returns_struct = 1;
- }
-
- /* Warn if this value is an aggregate type,
- regardless of which calling convention we are using for it. */
- if (warn_aggregate_return
- && AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr))))
- warning ("function returns an aggregate");
-
- current_function_returns_pointer
- = POINTER_TYPE_P (TREE_TYPE (DECL_RESULT (subr)));
-
- /* Indicate that we need to distinguish between the return value of the
- present function and the return value of a function being called. */
- rtx_equal_function_value_matters = 1;
-
- /* Indicate that we have not instantiated virtual registers yet. */
- virtuals_instantiated = 0;
-
- /* Indicate we have no need of a frame pointer yet. */
- frame_pointer_needed = 0;
-
- /* By default assume not varargs or stdarg. */
- current_function_varargs = 0;
- current_function_stdarg = 0;
-}
-
-/* Indicate that the current function uses extra args
- not explicitly mentioned in the argument list in any fashion. */
-
-void
-mark_varargs ()
-{
- current_function_varargs = 1;
-}
-
-/* Expand a call to __main at the beginning of a possible main function. */
-
-#if defined(INIT_SECTION_ASM_OP) && !defined(INVOKE__main)
-#undef HAS_INIT_SECTION
-#define HAS_INIT_SECTION
-#endif
-
-void
-expand_main_function ()
-{
- if (!output_bytecode)
- {
- /* The zero below avoids a possible parse error */
- 0;
-#if !defined (HAS_INIT_SECTION)
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0,
- VOIDmode, 0);
-#endif /* not HAS_INIT_SECTION */
- }
-}
-
-extern struct obstack permanent_obstack;
-
-/* Expand start of bytecode function. See comment at
- expand_function_start below for details. */
-
-void
-bc_expand_function_start (subr, parms_have_cleanups)
- tree subr;
- int parms_have_cleanups;
-{
- char label[20], *name;
- static int nlab;
- tree thisarg;
- int argsz;
-
- if (TREE_PUBLIC (subr))
- bc_globalize_label (IDENTIFIER_POINTER (DECL_NAME (subr)));
-
-#ifdef DEBUG_PRINT_CODE
- fprintf (stderr, "\n<func %s>\n", IDENTIFIER_POINTER (DECL_NAME (subr)));
-#endif
-
- for (argsz = 0, thisarg = DECL_ARGUMENTS (subr); thisarg; thisarg = TREE_CHAIN (thisarg))
- {
- if (DECL_RTL (thisarg))
- abort (); /* Should be NULL here I think. */
- else if (TREE_CONSTANT (DECL_SIZE (thisarg)))
- {
- DECL_RTL (thisarg) = bc_gen_rtx ((char *) 0, argsz, (struct bc_label *) 0);
- argsz += TREE_INT_CST_LOW (DECL_SIZE (thisarg));
- }
- else
- {
- /* Variable-sized objects are pointers to their storage. */
- DECL_RTL (thisarg) = bc_gen_rtx ((char *) 0, argsz, (struct bc_label *) 0);
- argsz += POINTER_SIZE;
- }
- }
-
- bc_begin_function (xstrdup (IDENTIFIER_POINTER (DECL_NAME (subr))));
-
- ASM_GENERATE_INTERNAL_LABEL (label, "LX", nlab);
-
- ++nlab;
- name = (char *) obstack_copy0 (&permanent_obstack, label, strlen (label));
- this_function_callinfo = bc_gen_rtx (name, 0, (struct bc_label *) 0);
- this_function_bytecode =
- bc_emit_trampoline (BYTECODE_LABEL (this_function_callinfo));
-}
-
-
-/* Expand end of bytecode function. See details the comment of
- expand_function_end(), below. */
-
-void
-bc_expand_function_end ()
-{
- char *ptrconsts;
-
- expand_null_return ();
-
- /* Emit any fixup code. This must be done before the call to
- to BC_END_FUNCTION (), since that will cause the bytecode
- segment to be finished off and closed. */
-
- expand_fixups (NULL_RTX);
-
- ptrconsts = bc_end_function ();
-
- bc_align_const (2 /* INT_ALIGN */);
-
- /* If this changes also make sure to change bc-interp.h! */
-
- bc_emit_const_labeldef (BYTECODE_LABEL (this_function_callinfo));
- bc_emit_const ((char *) &max_stack_depth, sizeof max_stack_depth);
- bc_emit_const ((char *) &local_vars_size, sizeof local_vars_size);
- bc_emit_const_labelref (this_function_bytecode, 0);
- bc_emit_const_labelref (ptrconsts, 0);
- bc_emit_const_labelref (BYTECODE_LABEL (this_function_calldesc), 0);
-}
-
-
-/* Start the RTL for a new function, and set variables used for
- emitting RTL.
- SUBR is the FUNCTION_DECL node.
- PARMS_HAVE_CLEANUPS is nonzero if there are cleanups associated with
- the function's parameters, which must be run at any return statement. */
-
-void
-expand_function_start (subr, parms_have_cleanups)
- tree subr;
- int parms_have_cleanups;
-{
- register int i;
- tree tem;
- rtx last_ptr;
-
- if (output_bytecode)
- {
- bc_expand_function_start (subr, parms_have_cleanups);
- return;
- }
-
- /* Make sure volatile mem refs aren't considered
- valid operands of arithmetic insns. */
- init_recog_no_volatile ();
-
- /* If function gets a static chain arg, store it in the stack frame.
- Do this first, so it gets the first stack slot offset. */
- if (current_function_needs_context)
- {
- last_ptr = assign_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0);
-
-#ifdef SMALL_REGISTER_CLASSES
- /* Delay copying static chain if it is not a register to avoid
- conflicts with regs used for parameters. */
- if (! SMALL_REGISTER_CLASSES
- || GET_CODE (static_chain_incoming_rtx) == REG)
-#endif
- emit_move_insn (last_ptr, static_chain_incoming_rtx);
- }
-
- /* If the parameters of this function need cleaning up, get a label
- for the beginning of the code which executes those cleanups. This must
- be done before doing anything with return_label. */
- if (parms_have_cleanups)
- cleanup_label = gen_label_rtx ();
- else
- cleanup_label = 0;
-
- /* Make the label for return statements to jump to, if this machine
- does not have a one-instruction return and uses an epilogue,
- or if it returns a structure, or if it has parm cleanups. */
-#ifdef HAVE_return
- if (cleanup_label == 0 && HAVE_return
- && ! current_function_returns_pcc_struct
- && ! (current_function_returns_struct && ! optimize))
- return_label = 0;
- else
- return_label = gen_label_rtx ();
-#else
- return_label = gen_label_rtx ();
-#endif
-
- /* Initialize rtx used to return the value. */
- /* Do this before assign_parms so that we copy the struct value address
- before any library calls that assign parms might generate. */
-
- /* Decide whether to return the value in memory or in a register. */
- if (aggregate_value_p (DECL_RESULT (subr)))
- {
- /* Returning something that won't go in a register. */
- register rtx value_address = 0;
-
-#ifdef PCC_STATIC_STRUCT_RETURN
- if (current_function_returns_pcc_struct)
- {
- int size = int_size_in_bytes (TREE_TYPE (DECL_RESULT (subr)));
- value_address = assemble_static_space (size);
- }
- else
-#endif
- {
- /* Expect to be passed the address of a place to store the value.
- If it is passed as an argument, assign_parms will take care of
- it. */
- if (struct_value_incoming_rtx)
- {
- value_address = gen_reg_rtx (Pmode);
- emit_move_insn (value_address, struct_value_incoming_rtx);
- }
- }
- if (value_address)
- {
- DECL_RTL (DECL_RESULT (subr))
- = gen_rtx (MEM, DECL_MODE (DECL_RESULT (subr)), value_address);
- MEM_IN_STRUCT_P (DECL_RTL (DECL_RESULT (subr)))
- = AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr)));
- }
- }
- else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode)
- /* If return mode is void, this decl rtl should not be used. */
- DECL_RTL (DECL_RESULT (subr)) = 0;
- else if (parms_have_cleanups)
- {
- /* If function will end with cleanup code for parms,
- compute the return values into a pseudo reg,
- which we will copy into the true return register
- after the cleanups are done. */
-
- enum machine_mode mode = DECL_MODE (DECL_RESULT (subr));
-
-#ifdef PROMOTE_FUNCTION_RETURN
- tree type = TREE_TYPE (DECL_RESULT (subr));
- int unsignedp = TREE_UNSIGNED (type);
-
- mode = promote_mode (type, mode, &unsignedp, 1);
-#endif
-
- DECL_RTL (DECL_RESULT (subr)) = gen_reg_rtx (mode);
- }
- else
- /* Scalar, returned in a register. */
- {
-#ifdef FUNCTION_OUTGOING_VALUE
- DECL_RTL (DECL_RESULT (subr))
- = FUNCTION_OUTGOING_VALUE (TREE_TYPE (DECL_RESULT (subr)), subr);
-#else
- DECL_RTL (DECL_RESULT (subr))
- = FUNCTION_VALUE (TREE_TYPE (DECL_RESULT (subr)), subr);
-#endif
-
- /* Mark this reg as the function's return value. */
- if (GET_CODE (DECL_RTL (DECL_RESULT (subr))) == REG)
- {
- REG_FUNCTION_VALUE_P (DECL_RTL (DECL_RESULT (subr))) = 1;
- /* Needed because we may need to move this to memory
- in case it's a named return value whose address is taken. */
- DECL_REGISTER (DECL_RESULT (subr)) = 1;
- }
- }
-
- /* Initialize rtx for parameters and local variables.
- In some cases this requires emitting insns. */
-
- assign_parms (subr, 0);
-
-#ifdef SMALL_REGISTER_CLASSES
- /* Copy the static chain now if it wasn't a register. The delay is to
- avoid conflicts with the parameter passing registers. */
-
- if (SMALL_REGISTER_CLASSES && current_function_needs_context)
- if (GET_CODE (static_chain_incoming_rtx) != REG)
- emit_move_insn (last_ptr, static_chain_incoming_rtx);
-#endif
-
- /* The following was moved from init_function_start.
- The move is supposed to make sdb output more accurate. */
- /* Indicate the beginning of the function body,
- as opposed to parm setup. */
- emit_note (NULL_PTR, NOTE_INSN_FUNCTION_BEG);
-
- /* If doing stupid allocation, mark parms as born here. */
-
- if (GET_CODE (get_last_insn ()) != NOTE)
- emit_note (NULL_PTR, NOTE_INSN_DELETED);
- parm_birth_insn = get_last_insn ();
-
- if (obey_regdecls)
- {
- for (i = LAST_VIRTUAL_REGISTER + 1; i < max_parm_reg; i++)
- use_variable (regno_reg_rtx[i]);
-
- if (current_function_internal_arg_pointer != virtual_incoming_args_rtx)
- use_variable (current_function_internal_arg_pointer);
- }
-
- context_display = 0;
- if (current_function_needs_context)
- {
- /* Fetch static chain values for containing functions. */
- tem = decl_function_context (current_function_decl);
- /* If not doing stupid register allocation copy the static chain
- pointer into a pseudo. If we have small register classes, copy
- the value from memory if static_chain_incoming_rtx is a REG. If
- we do stupid register allocation, we use the stack address
- generated above. */
- if (tem && ! obey_regdecls)
- {
-#ifdef SMALL_REGISTER_CLASSES
- /* If the static chain originally came in a register, put it back
- there, then move it out in the next insn. The reason for
- this peculiar code is to satisfy function integration. */
- if (SMALL_REGISTER_CLASSES
- && GET_CODE (static_chain_incoming_rtx) == REG)
- emit_move_insn (static_chain_incoming_rtx, last_ptr);
-#endif
-
- last_ptr = copy_to_reg (static_chain_incoming_rtx);
- }
-
- while (tem)
- {
- tree rtlexp = make_node (RTL_EXPR);
-
- RTL_EXPR_RTL (rtlexp) = last_ptr;
- context_display = tree_cons (tem, rtlexp, context_display);
- tem = decl_function_context (tem);
- if (tem == 0)
- break;
- /* Chain thru stack frames, assuming pointer to next lexical frame
- is found at the place we always store it. */
-#ifdef FRAME_GROWS_DOWNWARD
- last_ptr = plus_constant (last_ptr, - GET_MODE_SIZE (Pmode));
-#endif
- last_ptr = copy_to_reg (gen_rtx (MEM, Pmode,
- memory_address (Pmode, last_ptr)));
-
- /* If we are not optimizing, ensure that we know that this
- piece of context is live over the entire function. */
- if (! optimize)
- save_expr_regs = gen_rtx (EXPR_LIST, VOIDmode, last_ptr,
- save_expr_regs);
- }
- }
-
- /* After the display initializations is where the tail-recursion label
- should go, if we end up needing one. Ensure we have a NOTE here
- since some things (like trampolines) get placed before this. */
- tail_recursion_reentry = emit_note (NULL_PTR, NOTE_INSN_DELETED);
-
- /* Evaluate now the sizes of any types declared among the arguments. */
- for (tem = nreverse (get_pending_sizes ()); tem; tem = TREE_CHAIN (tem))
- {
- expand_expr (TREE_VALUE (tem), const0_rtx, VOIDmode, 0);
- /* Flush the queue in case this parameter declaration has
- side-effects. */
- emit_queue ();
- }
-
- /* Make sure there is a line number after the function entry setup code. */
- force_next_line_note ();
-}
-
-/* Generate RTL for the end of the current function.
- FILENAME and LINE are the current position in the source file.
-
- It is up to language-specific callers to do cleanups for parameters--
- or else, supply 1 for END_BINDINGS and we will call expand_end_bindings. */
-
-void
-expand_function_end (filename, line, end_bindings)
- char *filename;
- int line;
- int end_bindings;
-{
- register int i;
- tree link;
-
-#ifdef TRAMPOLINE_TEMPLATE
- static rtx initial_trampoline;
-#endif
-
- if (output_bytecode)
- {
- bc_expand_function_end ();
- return;
- }
-
-#ifdef NON_SAVING_SETJMP
- /* Don't put any variables in registers if we call setjmp
- on a machine that fails to restore the registers. */
- if (NON_SAVING_SETJMP && current_function_calls_setjmp)
- {
- if (DECL_INITIAL (current_function_decl) != error_mark_node)
- setjmp_protect (DECL_INITIAL (current_function_decl));
-
- setjmp_protect_args ();
- }
-#endif
-
- /* Save the argument pointer if a save area was made for it. */
- if (arg_pointer_save_area)
- {
- rtx x = gen_move_insn (arg_pointer_save_area, virtual_incoming_args_rtx);
- emit_insn_before (x, tail_recursion_reentry);
- }
-
- /* Initialize any trampolines required by this function. */
- for (link = trampoline_list; link; link = TREE_CHAIN (link))
- {
- tree function = TREE_PURPOSE (link);
- rtx context = lookup_static_chain (function);
- rtx tramp = RTL_EXPR_RTL (TREE_VALUE (link));
- rtx blktramp;
- rtx seq;
-
-#ifdef TRAMPOLINE_TEMPLATE
- /* First make sure this compilation has a template for
- initializing trampolines. */
- if (initial_trampoline == 0)
- {
- end_temporary_allocation ();
- initial_trampoline
- = gen_rtx (MEM, BLKmode, assemble_trampoline_template ());
- resume_temporary_allocation ();
- }
-#endif
-
- /* Generate insns to initialize the trampoline. */
- start_sequence ();
- tramp = round_trampoline_addr (XEXP (tramp, 0));
-#ifdef TRAMPOLINE_TEMPLATE
- blktramp = change_address (initial_trampoline, BLKmode, tramp);
- emit_block_move (blktramp, initial_trampoline,
- GEN_INT (TRAMPOLINE_SIZE),
- TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT);
-#endif
- INITIALIZE_TRAMPOLINE (tramp, XEXP (DECL_RTL (function), 0), context);
- seq = get_insns ();
- end_sequence ();
-
- /* Put those insns at entry to the containing function (this one). */
- emit_insns_before (seq, tail_recursion_reentry);
- }
-
- /* Warn about unused parms if extra warnings were specified. */
- if (warn_unused && extra_warnings)
- {
- tree decl;
-
- for (decl = DECL_ARGUMENTS (current_function_decl);
- decl; decl = TREE_CHAIN (decl))
- if (! TREE_USED (decl) && TREE_CODE (decl) == PARM_DECL
- && DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
- warning_with_decl (decl, "unused parameter `%s'");
- }
-
- /* Delete handlers for nonlocal gotos if nothing uses them. */
- if (nonlocal_goto_handler_slot != 0 && !current_function_has_nonlocal_label)
- delete_handlers ();
-
- /* End any sequences that failed to be closed due to syntax errors. */
- while (in_sequence_p ())
- end_sequence ();
-
- /* Outside function body, can't compute type's actual size
- until next function's body starts. */
- immediate_size_expand--;
-
- /* If doing stupid register allocation,
- mark register parms as dying here. */
-
- if (obey_regdecls)
- {
- rtx tem;
- for (i = LAST_VIRTUAL_REGISTER + 1; i < max_parm_reg; i++)
- use_variable (regno_reg_rtx[i]);
-
- /* Likewise for the regs of all the SAVE_EXPRs in the function. */
-
- for (tem = save_expr_regs; tem; tem = XEXP (tem, 1))
- {
- use_variable (XEXP (tem, 0));
- use_variable_after (XEXP (tem, 0), parm_birth_insn);
- }
-
- if (current_function_internal_arg_pointer != virtual_incoming_args_rtx)
- use_variable (current_function_internal_arg_pointer);
- }
-
- clear_pending_stack_adjust ();
- do_pending_stack_adjust ();
-
- /* Mark the end of the function body.
- If control reaches this insn, the function can drop through
- without returning a value. */
- emit_note (NULL_PTR, NOTE_INSN_FUNCTION_END);
-
- /* Must mark the last line number note in the function, so that the test
- coverage code can avoid counting the last line twice. This just tells
- the code to ignore the immediately following line note, since there
- already exists a copy of this note somewhere above. This line number
- note is still needed for debugging though, so we can't delete it. */
- if (flag_test_coverage)
- emit_note (NULL_PTR, NOTE_REPEATED_LINE_NUMBER);
-
- /* Output a linenumber for the end of the function.
- SDB depends on this. */
- emit_line_note_force (filename, line);
-
- /* Output the label for the actual return from the function,
- if one is expected. This happens either because a function epilogue
- is used instead of a return instruction, or because a return was done
- with a goto in order to run local cleanups, or because of pcc-style
- structure returning. */
-
- if (return_label)
- emit_label (return_label);
-
- /* C++ uses this. */
- if (end_bindings)
- expand_end_bindings (0, 0, 0);
-
- /* If we had calls to alloca, and this machine needs
- an accurate stack pointer to exit the function,
- insert some code to save and restore the stack pointer. */
-#ifdef EXIT_IGNORE_STACK
- if (! EXIT_IGNORE_STACK)
-#endif
- if (current_function_calls_alloca)
- {
- rtx tem = 0;
-
- emit_stack_save (SAVE_FUNCTION, &tem, parm_birth_insn);
- emit_stack_restore (SAVE_FUNCTION, tem, NULL_RTX);
- }
-
- /* If scalar return value was computed in a pseudo-reg,
- copy that to the hard return register. */
- if (DECL_RTL (DECL_RESULT (current_function_decl)) != 0
- && GET_CODE (DECL_RTL (DECL_RESULT (current_function_decl))) == REG
- && (REGNO (DECL_RTL (DECL_RESULT (current_function_decl)))
- >= FIRST_PSEUDO_REGISTER))
- {
- rtx real_decl_result;
-
-#ifdef FUNCTION_OUTGOING_VALUE
- real_decl_result
- = FUNCTION_OUTGOING_VALUE (TREE_TYPE (DECL_RESULT (current_function_decl)),
- current_function_decl);
-#else
- real_decl_result
- = FUNCTION_VALUE (TREE_TYPE (DECL_RESULT (current_function_decl)),
- current_function_decl);
-#endif
- REG_FUNCTION_VALUE_P (real_decl_result) = 1;
- /* If this is a BLKmode structure being returned in registers, then use
- the mode computed in expand_return. */
- if (GET_MODE (real_decl_result) == BLKmode)
- PUT_MODE (real_decl_result,
- GET_MODE (DECL_RTL (DECL_RESULT (current_function_decl))));
- emit_move_insn (real_decl_result,
- DECL_RTL (DECL_RESULT (current_function_decl)));
- emit_insn (gen_rtx (USE, VOIDmode, real_decl_result));
- }
-
- /* If returning a structure, arrange to return the address of the value
- in a place where debuggers expect to find it.
-
- If returning a structure PCC style,
- the caller also depends on this value.
- And current_function_returns_pcc_struct is not necessarily set. */
- if (current_function_returns_struct
- || current_function_returns_pcc_struct)
- {
- rtx value_address = XEXP (DECL_RTL (DECL_RESULT (current_function_decl)), 0);
- tree type = TREE_TYPE (DECL_RESULT (current_function_decl));
-#ifdef FUNCTION_OUTGOING_VALUE
- rtx outgoing
- = FUNCTION_OUTGOING_VALUE (build_pointer_type (type),
- current_function_decl);
-#else
- rtx outgoing
- = FUNCTION_VALUE (build_pointer_type (type),
- current_function_decl);
-#endif
-
- /* Mark this as a function return value so integrate will delete the
- assignment and USE below when inlining this function. */
- REG_FUNCTION_VALUE_P (outgoing) = 1;
-
- emit_move_insn (outgoing, value_address);
- use_variable (outgoing);
- }
-
- /* Output a return insn if we are using one.
- Otherwise, let the rtl chain end here, to drop through
- into the epilogue. */
-
-#ifdef HAVE_return
- if (HAVE_return)
- {
- emit_jump_insn (gen_return ());
- emit_barrier ();
- }
-#endif
-
- /* Fix up any gotos that jumped out to the outermost
- binding level of the function.
- Must follow emitting RETURN_LABEL. */
-
- /* If you have any cleanups to do at this point,
- and they need to create temporary variables,
- then you will lose. */
- expand_fixups (get_insns ());
-}
-
-/* These arrays record the INSN_UIDs of the prologue and epilogue insns. */
-
-static int *prologue;
-static int *epilogue;
-
-/* Create an array that records the INSN_UIDs of INSNS (either a sequence
- or a single insn). */
-
-static int *
-record_insns (insns)
- rtx insns;
-{
- int *vec;
-
- if (GET_CODE (insns) == SEQUENCE)
- {
- int len = XVECLEN (insns, 0);
- vec = (int *) oballoc ((len + 1) * sizeof (int));
- vec[len] = 0;
- while (--len >= 0)
- vec[len] = INSN_UID (XVECEXP (insns, 0, len));
- }
- else
- {
- vec = (int *) oballoc (2 * sizeof (int));
- vec[0] = INSN_UID (insns);
- vec[1] = 0;
- }
- return vec;
-}
-
-/* Determine how many INSN_UIDs in VEC are part of INSN. */
-
-static int
-contains (insn, vec)
- rtx insn;
- int *vec;
-{
- register int i, j;
-
- if (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SEQUENCE)
- {
- int count = 0;
- for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
- for (j = 0; vec[j]; j++)
- if (INSN_UID (XVECEXP (PATTERN (insn), 0, i)) == vec[j])
- count++;
- return count;
- }
- else
- {
- for (j = 0; vec[j]; j++)
- if (INSN_UID (insn) == vec[j])
- return 1;
- }
- return 0;
-}
-
-/* Generate the prologue and epilogue RTL if the machine supports it. Thread
- this into place with notes indicating where the prologue ends and where
- the epilogue begins. Update the basic block information when possible. */
-
-void
-thread_prologue_and_epilogue_insns (f)
- rtx f;
-{
-#ifdef HAVE_prologue
- if (HAVE_prologue)
- {
- rtx head, seq, insn;
-
- /* The first insn (a NOTE_INSN_DELETED) is followed by zero or more
- prologue insns and a NOTE_INSN_PROLOGUE_END. */
- emit_note_after (NOTE_INSN_PROLOGUE_END, f);
- seq = gen_prologue ();
- head = emit_insn_after (seq, f);
-
- /* Include the new prologue insns in the first block. Ignore them
- if they form a basic block unto themselves. */
- if (basic_block_head && n_basic_blocks
- && GET_CODE (basic_block_head[0]) != CODE_LABEL)
- basic_block_head[0] = NEXT_INSN (f);
-
- /* Retain a map of the prologue insns. */
- prologue = record_insns (GET_CODE (seq) == SEQUENCE ? seq : head);
- }
- else
-#endif
- prologue = 0;
-
-#ifdef HAVE_epilogue
- if (HAVE_epilogue)
- {
- rtx insn = get_last_insn ();
- rtx prev = prev_nonnote_insn (insn);
-
- /* If we end with a BARRIER, we don't need an epilogue. */
- if (! (prev && GET_CODE (prev) == BARRIER))
- {
- rtx tail, seq, tem;
- rtx first_use = 0;
- rtx last_use = 0;
-
- /* The last basic block ends with a NOTE_INSN_EPILOGUE_BEG, the
- epilogue insns, the USE insns at the end of a function,
- the jump insn that returns, and then a BARRIER. */
-
- /* Move the USE insns at the end of a function onto a list. */
- while (prev
- && GET_CODE (prev) == INSN
- && GET_CODE (PATTERN (prev)) == USE)
- {
- tem = prev;
- prev = prev_nonnote_insn (prev);
-
- NEXT_INSN (PREV_INSN (tem)) = NEXT_INSN (tem);
- PREV_INSN (NEXT_INSN (tem)) = PREV_INSN (tem);
- if (first_use)
- {
- NEXT_INSN (tem) = first_use;
- PREV_INSN (first_use) = tem;
- }
- first_use = tem;
- if (!last_use)
- last_use = tem;
- }
-
- emit_barrier_after (insn);
-
- seq = gen_epilogue ();
- tail = emit_jump_insn_after (seq, insn);
-
- /* Insert the USE insns immediately before the return insn, which
- must be the first instruction before the final barrier. */
- if (first_use)
- {
- tem = prev_nonnote_insn (get_last_insn ());
- NEXT_INSN (PREV_INSN (tem)) = first_use;
- PREV_INSN (first_use) = PREV_INSN (tem);
- PREV_INSN (tem) = last_use;
- NEXT_INSN (last_use) = tem;
- }
-
- emit_note_after (NOTE_INSN_EPILOGUE_BEG, insn);
-
- /* Include the new epilogue insns in the last block. Ignore
- them if they form a basic block unto themselves. */
- if (basic_block_end && n_basic_blocks
- && GET_CODE (basic_block_end[n_basic_blocks - 1]) != JUMP_INSN)
- basic_block_end[n_basic_blocks - 1] = tail;
-
- /* Retain a map of the epilogue insns. */
- epilogue = record_insns (GET_CODE (seq) == SEQUENCE ? seq : tail);
- return;
- }
- }
-#endif
- epilogue = 0;
-}
-
-/* Reposition the prologue-end and epilogue-begin notes after instruction
- scheduling and delayed branch scheduling. */
-
-void
-reposition_prologue_and_epilogue_notes (f)
- rtx f;
-{
-#if defined (HAVE_prologue) || defined (HAVE_epilogue)
- /* Reposition the prologue and epilogue notes. */
- if (n_basic_blocks)
- {
- rtx next, prev;
- int len;
-
- if (prologue)
- {
- register rtx insn, note = 0;
-
- /* Scan from the beginning until we reach the last prologue insn.
- We apparently can't depend on basic_block_{head,end} after
- reorg has run. */
- for (len = 0; prologue[len]; len++)
- ;
- for (insn = f; len && insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_PROLOGUE_END)
- note = insn;
- }
- else if ((len -= contains (insn, prologue)) == 0)
- {
- /* Find the prologue-end note if we haven't already, and
- move it to just after the last prologue insn. */
- if (note == 0)
- {
- for (note = insn; note = NEXT_INSN (note);)
- if (GET_CODE (note) == NOTE
- && NOTE_LINE_NUMBER (note) == NOTE_INSN_PROLOGUE_END)
- break;
- }
- next = NEXT_INSN (note);
- prev = PREV_INSN (note);
- if (prev)
- NEXT_INSN (prev) = next;
- if (next)
- PREV_INSN (next) = prev;
- add_insn_after (note, insn);
- }
- }
- }
-
- if (epilogue)
- {
- register rtx insn, note = 0;
-
- /* Scan from the end until we reach the first epilogue insn.
- We apparently can't depend on basic_block_{head,end} after
- reorg has run. */
- for (len = 0; epilogue[len]; len++)
- ;
- for (insn = get_last_insn (); len && insn; insn = PREV_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EPILOGUE_BEG)
- note = insn;
- }
- else if ((len -= contains (insn, epilogue)) == 0)
- {
- /* Find the epilogue-begin note if we haven't already, and
- move it to just before the first epilogue insn. */
- if (note == 0)
- {
- for (note = insn; note = PREV_INSN (note);)
- if (GET_CODE (note) == NOTE
- && NOTE_LINE_NUMBER (note) == NOTE_INSN_EPILOGUE_BEG)
- break;
- }
- next = NEXT_INSN (note);
- prev = PREV_INSN (note);
- if (prev)
- NEXT_INSN (prev) = next;
- if (next)
- PREV_INSN (next) = prev;
- add_insn_after (note, PREV_INSN (insn));
- }
- }
- }
- }
-#endif /* HAVE_prologue or HAVE_epilogue */
-}
diff --git a/gcc/function.h b/gcc/function.h
deleted file mode 100644
index 4bc8e3feba7..00000000000
--- a/gcc/function.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/* Structure for saving state for a nested function.
- Copyright (C) 1989, 92, 93, 94, 95, 96, 1997 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. */
-
-
-#ifndef NULL_TREE
-#define tree int *
-#endif
-#ifndef GET_CODE
-#define rtx int *
-#endif
-
-struct var_refs_queue
-{
- rtx modified;
- enum machine_mode promoted_mode;
- int unsignedp;
- struct var_refs_queue *next;
-};
-
-/* Stack of pending (incomplete) sequences saved by `start_sequence'.
- Each element describes one pending sequence.
- The main insn-chain is saved in the last element of the chain,
- unless the chain is empty. */
-
-struct sequence_stack
-{
- /* First and last insns in the chain of the saved sequence. */
- rtx first, last;
- tree sequence_rtl_expr;
- struct sequence_stack *next;
-};
-
-extern struct sequence_stack *sequence_stack;
-
-/* Stack of single obstacks. */
-
-struct simple_obstack_stack
-{
- struct obstack *obstack;
- struct simple_obstack_stack *next;
-};
-
-/* This structure can save all the important global and static variables
- describing the status of the current function. */
-
-struct function
-{
- struct function *next;
-
- /* For function.c. */
- char *name;
- tree decl;
- int pops_args;
- int returns_struct;
- int returns_pcc_struct;
- int returns_pointer;
- int needs_context;
- int calls_setjmp;
- int calls_longjmp;
- int calls_alloca;
- int has_nonlocal_label;
- int has_nonlocal_goto;
- int contains_functions;
- rtx nonlocal_goto_handler_slot;
- rtx nonlocal_goto_stack_level;
- tree nonlocal_labels;
- int args_size;
- int pretend_args_size;
- rtx arg_offset_rtx;
- int varargs;
- int stdarg;
- int max_parm_reg;
- rtx *parm_reg_stack_loc;
- int outgoing_args_size;
- rtx return_rtx;
- rtx cleanup_label;
- rtx return_label;
- rtx save_expr_regs;
- rtx stack_slot_list;
- rtx parm_birth_insn;
- HOST_WIDE_INT frame_offset;
- rtx tail_recursion_label;
- rtx tail_recursion_reentry;
- rtx internal_arg_pointer;
- rtx arg_pointer_save_area;
- tree rtl_expr_chain;
- rtx last_parm_insn;
- tree context_display;
- tree trampoline_list;
- int function_call_count;
- struct temp_slot *temp_slots;
- int temp_slot_level;
- /* This slot is initialized as 0 and is added to
- during the nested function. */
- struct var_refs_queue *fixup_var_refs_queue;
- CUMULATIVE_ARGS args_info;
-
- /* For stmt.c */
- struct nesting *block_stack;
- struct nesting *stack_block_stack;
- struct nesting *cond_stack;
- struct nesting *loop_stack;
- struct nesting *case_stack;
- struct nesting *nesting_stack;
- int nesting_depth;
- int block_start_count;
- tree last_expr_type;
- rtx last_expr_value;
- int expr_stmts_for_value;
- char *emit_filename;
- int emit_lineno;
- struct goto_fixup *goto_fixup_chain;
-
- /* For exception handling information. */
- struct eh_stack ehstack;
- struct eh_queue ehqueue;
- rtx catch_clauses;
- struct label_node *false_label_stack;
- struct label_node *caught_return_label_stack;
- tree protect_list;
-
- /* For expr.c. */
- int pending_stack_adjust;
- int inhibit_defer_pop;
- tree cleanups_this_call;
- rtx saveregs_value;
- rtx apply_args_value;
- rtx forced_labels;
-
- /* For emit-rtl.c. */
- int reg_rtx_no;
- int first_label_num;
- rtx first_insn;
- rtx last_insn;
- tree sequence_rtl_expr;
- struct sequence_stack *sequence_stack;
- int cur_insn_uid;
- int last_linenum;
- char *last_filename;
- char *regno_pointer_flag;
- char *regno_pointer_align;
- int regno_pointer_flag_length;
- rtx *regno_reg_rtx;
-
- /* For stor-layout.c. */
- tree permanent_type_chain;
- tree temporary_type_chain;
- tree permanent_type_end;
- tree temporary_type_end;
- tree pending_sizes;
- int immediate_size_expand;
-
- /* For tree.c. */
- int all_types_permanent;
- struct momentary_level *momentary_stack;
- char *maybepermanent_firstobj;
- char *temporary_firstobj;
- char *momentary_firstobj;
- char *momentary_function_firstobj;
- struct obstack *current_obstack;
- struct obstack *function_obstack;
- struct obstack *function_maybepermanent_obstack;
- struct obstack *expression_obstack;
- struct obstack *saveable_obstack;
- struct obstack *rtl_obstack;
- struct simple_obstack_stack *inline_obstacks;
-
- /* For integrate.c. */
- int uses_const_pool;
-
- /* For md files. */
- int uses_pic_offset_table;
- /* tm.h can use this to store whatever it likes. */
- struct machine_function *machine;
-
- /* For reorg. */
- rtx epilogue_delay_list;
-
- /* For varasm. */
- struct constant_descriptor **const_rtx_hash_table;
- struct pool_sym **const_rtx_sym_hash_table;
- struct pool_constant *first_pool, *last_pool;
- int pool_offset;
-};
-
-/* The FUNCTION_DECL for an inline function currently being expanded. */
-extern tree inline_function_decl;
-
-/* Label that will go on function epilogue.
- Jumping to this label serves as a "return" instruction
- on machines which require execution of the epilogue on all returns. */
-extern rtx return_label;
-
-/* List (chain of EXPR_LISTs) of all stack slots in this function.
- Made for the sake of unshare_all_rtl. */
-extern rtx stack_slot_list;
-
-/* Given a function decl for a containing function,
- return the `struct function' for it. */
-struct function *find_function_data PROTO((tree));
-
-/* Pointer to chain of `struct function' for containing functions. */
-extern struct function *outer_function_chain;
-
-/* Put all this function's BLOCK nodes into a vector and return it.
- Also store in each NOTE for the beginning or end of a block
- the index of that block in the vector. */
-extern tree *identify_blocks PROTO((tree, rtx));
-
-/* Return size needed for stack frame based on slots so far allocated.
- This size counts from zero. It is not rounded to STACK_BOUNDARY;
- the caller may have to do that. */
-extern HOST_WIDE_INT get_frame_size PROTO((void));
-
-/* These variables hold pointers to functions to
- save and restore machine-specific data,
- in push_function_context and pop_function_context. */
-extern void (*save_machine_status) ();
-extern void (*restore_machine_status) ();
-
-/* Save and restore varasm.c status for a nested function. */
-extern void save_varasm_status PROTO((struct function *));
-extern void restore_varasm_status PROTO((struct function *));
-
-#ifdef rtx
-#undef rtx
-#endif
-
-#ifdef tree
-#undef tree
-#endif
diff --git a/gcc/future.options b/gcc/future.options
deleted file mode 100644
index 214be803467..00000000000
--- a/gcc/future.options
+++ /dev/null
@@ -1,29 +0,0 @@
-From: friedman@gnu.ai.mit.edu (Noah Friedman)
-To: roland@gnu.ai.mit.edu (Roland McGrath),
- rms@gnu.ai.mit.edu (Richard Stallman),
- jimb@gnu.ai.mit.edu (Jim Blandy),
- mib@gnu.ai.mit.edu (Michael Bushnell)
-Cc: cgw@sol.acs.unt.edu (chris williams),
- clc@gnu.ai.mit.edu (Christian Longshore Claiborn)
-Subject: Some gcc options we'd like to see.
-Date: Mon, 28 Jun 93 00:45:09 EST
-Reply-To: friedman@gnu.ai.mit.edu
-
--Waggravate-return
--Wcast-spell
--Wcaste-align
--Win
--Wmissing-protons
--Wredundant-repetitions
--antsy
--fbungee-jump
--fexpensive-operations
--fextra-strength
--fjesus-saves
--fkeep-programmers-inline
--fno-peeping-toms
--fruit-roll-ups
--fshort-enough
--mno-dialogue
--pedophile
--vomit-frame-pointer
diff --git a/gcc/gansidecl.h b/gcc/gansidecl.h
deleted file mode 100644
index 1135db98756..00000000000
--- a/gcc/gansidecl.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ANSI and traditional C compatability macros.
- Copyright (C) 1996 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 mimics some of the support provided by include/ansidecl.h
- in binutils and gdb releases.
- ??? Over time the two should be merged into one. */
-
-#ifndef ANSIDECL_H
-#define ANSIDECL_H
-
-/* Add prototype support. */
-#ifndef PROTO
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#define PROTO(ARGS) ARGS
-#else
-#define PROTO(ARGS) ()
-#endif
-#endif
-
-#ifndef VPROTO
-#ifdef __STDC__
-#define PVPROTO(ARGS) ARGS
-#define VPROTO(ARGS) ARGS
-#define VA_START(va_list,var) va_start(va_list,var)
-#else
-#define PVPROTO(ARGS) ()
-#define VPROTO(ARGS) (va_alist) va_dcl
-#define VA_START(va_list,var) va_start(va_list)
-#endif
-#endif
-
-#ifndef STDIO_PROTO
-#ifdef BUFSIZ
-#define STDIO_PROTO(ARGS) PROTO(ARGS)
-#else
-#define STDIO_PROTO(ARGS) ()
-#endif
-#endif
-
-/* Define a generic NULL if one hasn't already been defined. */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef GENERIC_PTR
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#define GENERIC_PTR void *
-#else
-#define GENERIC_PTR char *
-#endif
-#endif
-
-#ifndef NULL_PTR
-#define NULL_PTR ((GENERIC_PTR) 0)
-#endif
-
-#ifdef __STDC__
-
-#define PTR void *
-
-#else
-
-#define PTR char *
-#ifndef const
-#define const
-#endif
-
-#endif /* ! __STDC__ */
-
-#endif /* ANSIDECL_H */
diff --git a/gcc/gbl-ctors.h b/gcc/gbl-ctors.h
deleted file mode 100644
index 6393a9045ab..00000000000
--- a/gcc/gbl-ctors.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Definitions relating to the special __do_global_init function used
- for getting g++ file-scope static objects constructed. This file
- will get included either by libgcc2.c (for systems that don't support
- a .init section) or by crtstuff.c (for those that do).
- Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Ron Guilmette (rfg@segfault.us.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 file contains definitions and declarations of things
- relating to the normal start-up-time invocation of C++
- file-scope static object constructors. These declarations
- and definitions are used by *both* libgcc2.c and by crtstuff.c.
-
- Note that this file should only be compiled with GCC.
-*/
-
-#ifdef NEED_ATEXIT
-#ifndef HAVE_ATEXIT
-#define HAVE_ATEXIT 1 /* Take it from libgcc2.c */
-#endif
-#endif
-
-#ifdef HAVE_ATEXIT
-#if defined (WINNT) || defined (NEED_ATEXIT)
-extern int atexit (void (*) (void));
-#else
-extern void atexit (void (*) (void));
-#endif
-#define ON_EXIT(FUNC,ARG) atexit ((FUNC))
-#else
-#ifdef sun
-extern int on_exit (void *, void *); /* The man page says it returns int. */
-#define ON_EXIT(FUNC,ARG) on_exit ((FUNC), (ARG))
-#endif
-#endif
-
-/* Declare a pointer to void function type. */
-
-typedef void (*func_ptr) (void);
-
-/* Declare the set of symbols use as begin and end markers for the lists
- of global object constructors and global object destructors. */
-
-extern func_ptr __CTOR_LIST__[];
-extern func_ptr __DTOR_LIST__[];
-
-/* Declare the routine which need to get invoked at program exit time. */
-
-extern void __do_global_dtors ();
-
-/* Define a macro with the code which needs to be executed at program
- start-up time. This macro is used in two places in crtstuff.c (for
- systems which support a .init section) and in one place in libgcc2.c
- (for those system which do *not* support a .init section). For all
- three places where this code might appear, it must be identical, so
- we define it once here as a macro to avoid various instances getting
- out-of-sync with one another. */
-
-/* Some systems place the number of pointers
- in the first word of the table.
- On other systems, that word is -1.
- In all cases, the table is null-terminated.
- If the length is not recorded, count up to the null. */
-
-/* Some systems use a different strategy for finding the ctors.
- For example, svr3. */
-#ifndef DO_GLOBAL_CTORS_BODY
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- unsigned long nptrs = (unsigned long) __CTOR_LIST__[0]; \
- unsigned i; \
- if (nptrs == -1) \
- for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++); \
- for (i = nptrs; i >= 1; i--) \
- __CTOR_LIST__[i] (); \
-} while (0)
-#endif
-
diff --git a/gcc/gcc.c b/gcc/gcc.c
deleted file mode 100644
index 8e50517f123..00000000000
--- a/gcc/gcc.c
+++ /dev/null
@@ -1,5418 +0,0 @@
-/* Compiler driver program that can handle many languages.
- Copyright (C) 1987, 89, 92-96, 1997 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 paragraph is here to try to keep Sun CC from dying.
-The number of chars here seems crucial!!!! */
-
-/* This program is the user interface to the C compiler and possibly to
-other compilers. It is used because compilation is a complicated procedure
-which involves running several programs and passing temporary files between
-them, forwarding the users switches to those programs selectively,
-and deleting the temporary files at the end.
-
-CC recognizes how to compile each input file by suffixes in the file names.
-Once it knows which kind of compilation to perform, the procedure for
-compilation is specified by a string called a "spec". */
-
-#include <sys/types.h>
-#include <ctype.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-#ifndef NO_SYS_FILE_H
-#include <sys/file.h> /* May get R_OK, etc. on some systems. */
-#endif
-
-#include "config.h"
-#include "obstack.h"
-#include "gansidecl.h"
-
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <stdio.h>
-
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#endif
-
-/* ??? Need to find a GCC header to put these in. */
-extern int pexecute PROTO ((const char *, char * const *, const char *,
- const char *, char **, char **, int));
-extern int pwait PROTO ((int, int *, int));
-/* Flag arguments to pexecute. */
-#define PEXECUTE_FIRST 1
-#define PEXECUTE_LAST 2
-#define PEXECUTE_SEARCH 4
-#define PEXECUTE_VERBOSE 8
-
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
-#endif
-#ifndef WTERMSIG
-#define WTERMSIG(S) ((S) & 0x7f)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(S) (((S) & 0xff) == 0)
-#endif
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
-#endif
-
-#ifdef VMS
-#define exit __posix_exit
-#endif
-
-/* Define O_RDONLY if the system hasn't defined it for us. */
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-
-#ifdef USG
-#define vfork fork
-#endif /* USG */
-
-/* Test if something is a normal file. */
-#ifndef S_ISREG
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-
-/* Test if something is a directory. */
-#ifndef S_ISDIR
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-
-/* By default there is no special suffix for executables. */
-#ifdef EXECUTABLE_SUFFIX
-#define HAVE_EXECUTABLE_SUFFIX
-#else
-#define EXECUTABLE_SUFFIX ""
-#endif
-
-/* By default, the suffix for object files is ".o". */
-#ifdef OBJECT_SUFFIX
-#define HAVE_OBJECT_SUFFIX
-#else
-#define OBJECT_SUFFIX ".o"
-#endif
-
-/* By default, colon separates directories in a path. */
-#ifndef PATH_SEPARATOR
-#define PATH_SEPARATOR ':'
-#endif
-
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-static char dir_separator_str[] = {DIR_SEPARATOR, 0};
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern char *getenv ();
-
-extern char *choose_temp_base PROTO((void));
-
-#ifndef errno
-extern int errno;
-#endif
-
-#ifndef HAVE_STRERROR
-extern int sys_nerr;
-#if defined(bsd4_4)
-extern const char *const sys_errlist[];
-#else
-extern char *sys_errlist[];
-#endif
-#else
-extern char *strerror();
-#endif
-
-/* If a stage of compilation returns an exit status >= 1,
- compilation of that file ceases. */
-
-#define MIN_FATAL_STATUS 1
-
-/* Flag saying to print the directories gcc will search through looking for
- programs, libraries, etc. */
-
-static int print_search_dirs;
-
-/* Flag saying to print the full filename of this file
- as found through our usual search mechanism. */
-
-static char *print_file_name = NULL;
-
-/* As print_file_name, but search for executable file. */
-
-static char *print_prog_name = NULL;
-
-/* Flag saying to print the relative path we'd use to
- find libgcc.a given the current compiler flags. */
-
-static int print_multi_directory;
-
-/* Flag saying to print the list of subdirectories and
- compiler flags used to select them in a standard form. */
-
-static int print_multi_lib;
-
-/* Flag indicating whether we should print the command and arguments */
-
-static int verbose_flag;
-
-/* Nonzero means write "temp" files in source directory
- and use the source file's name in them, and don't delete them. */
-
-static int save_temps_flag;
-
-/* The compiler version. */
-
-static char *compiler_version;
-
-/* The target version specified with -V */
-
-static char *spec_version = DEFAULT_TARGET_VERSION;
-
-/* The target machine specified with -b. */
-
-static char *spec_machine = DEFAULT_TARGET_MACHINE;
-
-/* Nonzero if cross-compiling.
- When -b is used, the value comes from the `specs' file. */
-
-#ifdef CROSS_COMPILE
-static char *cross_compile = "1";
-#else
-static char *cross_compile = "0";
-#endif
-
-/* The number of errors that have occurred; the link phase will not be
- run if this is non-zero. */
-static int error_count = 0;
-
-/* This is the obstack which we use to allocate many strings. */
-
-static struct obstack obstack;
-
-/* This is the obstack to build an environment variable to pass to
- collect2 that describes all of the relevant switches of what to
- pass the compiler in building the list of pointers to constructors
- and destructors. */
-
-static struct obstack collect_obstack;
-
-extern char *version_string;
-
-/* Forward declaration for prototypes. */
-struct path_prefix;
-
-static void init_spec PROTO((void));
-static void read_specs PROTO((char *, int));
-static void set_spec PROTO((char *, char *));
-static struct compiler *lookup_compiler PROTO((char *, int, char *));
-static char *build_search_list PROTO((struct path_prefix *, char *, int));
-static void putenv_from_prefixes PROTO((struct path_prefix *, char *));
-static char *find_a_file PROTO((struct path_prefix *, char *, int));
-static void add_prefix PROTO((struct path_prefix *, char *, int, int, int *));
-static char *skip_whitespace PROTO((char *));
-static void record_temp_file PROTO((char *, int, int));
-static void delete_if_ordinary PROTO((char *));
-static void delete_temp_files PROTO((void));
-static void delete_failure_queue PROTO((void));
-static void clear_failure_queue PROTO((void));
-static int check_live_switch PROTO((int, int));
-static char *handle_braces PROTO((char *));
-static char *save_string PROTO((char *, int));
-static char *concat PVPROTO((char *, ...));
-static int do_spec PROTO((char *));
-static int do_spec_1 PROTO((char *, int, char *));
-static char *find_file PROTO((char *));
-static int is_directory PROTO((char *, char *, int));
-static void validate_switches PROTO((char *));
-static void validate_all_switches PROTO((void));
-static void give_switch PROTO((int, int, int));
-static int used_arg PROTO((char *, int));
-static int default_arg PROTO((char *, int));
-static void set_multilib_dir PROTO((void));
-static void print_multilib_info PROTO((void));
-static void pfatal_with_name PROTO((char *));
-static void perror_with_name PROTO((char *));
-static void pfatal_pexecute PROTO((char *, char *));
-#ifdef HAVE_VPRINTF
-static void fatal PVPROTO((char *, ...));
-static void error PVPROTO((char *, ...));
-#else
-/* We must not provide any prototype here, even if ANSI C. */
-static void fatal PROTO(());
-static void error PROTO(());
-#endif
-
-void fancy_abort ();
-char *xmalloc ();
-char *xrealloc ();
-
-/* Specs are strings containing lines, each of which (if not blank)
-is made up of a program name, and arguments separated by spaces.
-The program name must be exact and start from root, since no path
-is searched and it is unreliable to depend on the current working directory.
-Redirection of input or output is not supported; the subprograms must
-accept filenames saying what files to read and write.
-
-In addition, the specs can contain %-sequences to substitute variable text
-or for conditional text. Here is a table of all defined %-sequences.
-Note that spaces are not generated automatically around the results of
-expanding these sequences; therefore, you can concatenate them together
-or with constant text in a single argument.
-
- %% substitute one % into the program name or argument.
- %i substitute the name of the input file being processed.
- %b substitute the basename of the input file being processed.
- This is the substring up to (and not including) the last period
- and not including the directory.
- %g substitute the temporary-file-name-base. This is a string chosen
- once per compilation. Different temporary file names are made by
- concatenation of constant strings on the end, as in `%g.s'.
- %g also has the same effect of %d.
- %u like %g, but make the temporary file name unique.
- %U returns the last file name generated with %u.
- %d marks the argument containing or following the %d as a
- temporary file name, so that that file will be deleted if CC exits
- successfully. Unlike %g, this contributes no text to the argument.
- %w marks the argument containing or following the %w as the
- "output file" of this compilation. This puts the argument
- into the sequence of arguments that %o will substitute later.
- %W{...}
- like %{...} but mark last argument supplied within
- as a file to be deleted on failure.
- %o substitutes the names of all the output files, with spaces
- automatically placed around them. You should write spaces
- around the %o as well or the results are undefined.
- %o is for use in the specs for running the linker.
- Input files whose names have no recognized suffix are not compiled
- at all, but they are included among the output files, so they will
- be linked.
- %O substitutes the suffix for object files.
- %p substitutes the standard macro predefinitions for the
- current target machine. Use this when running cpp.
- %P like %p, but puts `__' before and after the name of each macro.
- (Except macros that already have __.)
- This is for ANSI C.
- %I Substitute a -iprefix option made from GCC_EXEC_PREFIX.
- %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.
- %eSTR Print STR as an error message. STR is terminated by a newline.
- Use this when inconsistent options are detected.
- %x{OPTION} Accumulate an option for %X.
- %X Output the accumulated linker options specified by compilations.
- %Y Output the accumulated assembler options specified by compilations.
- %Z Output the accumulated preprocessor options specified by compilations.
- %v1 Substitute the major version number of GCC.
- (For version 2.5.n, this is 2.)
- %v2 Substitute the minor version number of GCC.
- (For version 2.5.n, this is 5.)
- %a process ASM_SPEC as a spec.
- This allows config.h to specify part of the spec for running as.
- %A process ASM_FINAL_SPEC as a spec. A capital A is actually
- used here. This can be used to run a post-processor after the
- assembler has done it's job.
- %D Dump out a -L option for each directory in startfile_prefixes.
- If multilib_dir is set, extra entries are generated with it affixed.
- %l process LINK_SPEC as a spec.
- %L process LIB_SPEC as a spec.
- %G process LIBGCC_SPEC as a spec.
- %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
- %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
- %c process SIGNED_CHAR_SPEC as a spec.
- %C process CPP_SPEC as a spec. A capital C is actually used here.
- %1 process CC1_SPEC as a spec.
- %2 process CC1PLUS_SPEC as a spec.
- %| output "-" if the input for the current command is coming from a pipe.
- %* substitute the variable part of a matched option. (See below.)
- Note that each comma in the substituted string is replaced by
- a single space.
- %{S} substitutes the -S switch, if that switch was given to CC.
- If that switch was not specified, this substitutes nothing.
- Here S is a metasyntactic variable.
- %{S*} substitutes all the switches specified to CC whose names start
- with -S. This is used for -o, -D, -I, etc; switches that take
- arguments. CC considers `-o foo' as being one switch whose
- name starts with `o'. %{o*} would substitute this text,
- including the space; thus, two arguments would be generated.
- %{^S*} likewise, but don't put a blank between a switch and any args.
- %{S*:X} substitutes X if one or more switches whose names start with -S are
- specified to CC. Note that the tail part of the -S option
- (i.e. the part matched by the `*') will be substituted for each
- occurrence of %* within X.
- %{S:X} substitutes X, but only if the -S switch was given to CC.
- %{!S:X} substitutes X, but only if the -S switch was NOT given to CC.
- %{|S:X} like %{S:X}, but if no S switch, substitute `-'.
- %{|!S:X} like %{!S:X}, but if there is an S switch, substitute `-'.
- %{.S:X} substitutes X, but only if processing a file with suffix S.
- %{!.S:X} substitutes X, but only if NOT processing a file with suffix S.
- %(Spec) processes a specification defined in a specs file as *Spec:
- %[Spec] as above, but put __ around -D arguments
-
-The conditional text X in a %{S:X} or %{!S:X} construct may contain
-other nested % constructs or spaces, or even newlines. They are
-processed as usual, as described above.
-
-The -O, -f, -m, and -W switches are handled specifically in these
-constructs. If another value of -O or the negated form of a -f, -m, or
--W switch is found later in the command line, the earlier switch
-value is ignored, except with {S*} where S is just one letter; this
-passes all matching options.
-
-The character | is used to indicate that a command should be piped to
-the following command, but only if -pipe is specified.
-
-Note that it is built into CC which switches take arguments and which
-do not. You might think it would be useful to generalize this to
-allow each compiler's spec to say which switches take arguments. But
-this cannot be done in a consistent fashion. CC cannot even decide
-which input files have been specified without knowing which switches
-take arguments, and it must know which input files to compile in order
-to tell which compilers to run.
-
-CC also knows implicitly that arguments starting in `-l' are to be
-treated as compiler output files, and passed to the linker in their
-proper position among the other output files. */
-
-/* Define the macros used for specs %a, %l, %L, %S, %c, %C, %1. */
-
-/* config.h can define ASM_SPEC to provide extra args to the assembler
- or extra switch-translations. */
-#ifndef ASM_SPEC
-#define ASM_SPEC ""
-#endif
-
-/* config.h can define ASM_FINAL_SPEC to run a post processor after
- the assembler has run. */
-#ifndef ASM_FINAL_SPEC
-#define ASM_FINAL_SPEC ""
-#endif
-
-/* config.h can define CPP_SPEC to provide extra args to the C preprocessor
- or extra switch-translations. */
-#ifndef CPP_SPEC
-#define CPP_SPEC ""
-#endif
-
-/* config.h can define CC1_SPEC to provide extra args to cc1 and cc1plus
- or extra switch-translations. */
-#ifndef CC1_SPEC
-#define CC1_SPEC ""
-#endif
-
-/* config.h can define CC1PLUS_SPEC to provide extra args to cc1plus
- or extra switch-translations. */
-#ifndef CC1PLUS_SPEC
-#define CC1PLUS_SPEC ""
-#endif
-
-/* config.h can define LINK_SPEC to provide extra args to the linker
- or extra switch-translations. */
-#ifndef LINK_SPEC
-#define LINK_SPEC ""
-#endif
-
-/* config.h can define LIB_SPEC to override the default libraries. */
-#ifndef LIB_SPEC
-#define LIB_SPEC "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"
-#endif
-
-/* config.h can define LIBGCC_SPEC to override how and when libgcc.a is
- included. */
-#ifndef LIBGCC_SPEC
-#if defined(LINK_LIBGCC_SPECIAL) || defined(LINK_LIBGCC_SPECIAL_1)
-/* Have gcc do the search for libgcc.a. */
-#define LIBGCC_SPEC "libgcc.a%s"
-#else
-#define LIBGCC_SPEC "-lgcc"
-#endif
-#endif
-
-/* config.h can define STARTFILE_SPEC to override the default crt0 files. */
-#ifndef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}"
-#endif
-
-/* config.h can define SWITCHES_NEED_SPACES to control which options
- require spaces between the option and the argument. */
-#ifndef SWITCHES_NEED_SPACES
-#define SWITCHES_NEED_SPACES ""
-#endif
-
-/* config.h can define ENDFILE_SPEC to override the default crtn files. */
-#ifndef ENDFILE_SPEC
-#define ENDFILE_SPEC ""
-#endif
-
-/* This spec is used for telling cpp whether char is signed or not. */
-#ifndef SIGNED_CHAR_SPEC
-/* Use #if rather than ?:
- because MIPS C compiler rejects like ?: in initializers. */
-#if DEFAULT_SIGNED_CHAR
-#define SIGNED_CHAR_SPEC "%{funsigned-char:-D__CHAR_UNSIGNED__}"
-#else
-#define SIGNED_CHAR_SPEC "%{!fsigned-char:-D__CHAR_UNSIGNED__}"
-#endif
-#endif
-
-static char *cpp_spec = CPP_SPEC;
-static char *cpp_predefines = CPP_PREDEFINES;
-static char *cc1_spec = CC1_SPEC;
-static char *cc1plus_spec = CC1PLUS_SPEC;
-static char *signed_char_spec = SIGNED_CHAR_SPEC;
-static char *asm_spec = ASM_SPEC;
-static char *asm_final_spec = ASM_FINAL_SPEC;
-static char *link_spec = LINK_SPEC;
-static char *lib_spec = LIB_SPEC;
-static char *libgcc_spec = LIBGCC_SPEC;
-static char *endfile_spec = ENDFILE_SPEC;
-static char *startfile_spec = STARTFILE_SPEC;
-static char *switches_need_spaces = SWITCHES_NEED_SPACES;
-
-/* Some compilers have limits on line lengths, and the multilib_select
- and/or multilib_matches strings can be very long, so we build them at
- run time. */
-static struct obstack multilib_obstack;
-static char *multilib_select;
-static char *multilib_matches;
-static char *multilib_defaults;
-#include "multilib.h"
-
-/* Check whether a particular argument is a default argument. */
-
-#ifndef MULTILIB_DEFAULTS
-#define MULTILIB_DEFAULTS { "" }
-#endif
-
-static char *multilib_defaults_raw[] = MULTILIB_DEFAULTS;
-
-struct user_specs {
- struct user_specs *next;
- char *filename;
-};
-
-static struct user_specs *user_specs_head, *user_specs_tail;
-
-/* This defines which switch letters take arguments. */
-
-#define DEFAULT_SWITCH_TAKES_ARG(CHAR) \
- ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
- || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
- || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \
- || (CHAR) == 'L' || (CHAR) == 'A')
-
-#ifndef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) DEFAULT_SWITCH_TAKES_ARG(CHAR)
-#endif
-
-/* This defines which multi-letter switches take arguments. */
-
-#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, "specs"))
-
-#ifndef WORD_SWITCH_TAKES_ARG
-#define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR)
-#endif
-
-/* Record the mapping from file suffixes for compilation specs. */
-
-struct compiler
-{
- char *suffix; /* Use this compiler for input files
- whose names end in this suffix. */
-
- char *spec[4]; /* To use this compiler, concatenate these
- specs and pass to do_spec. */
-};
-
-/* Pointer to a vector of `struct compiler' that gives the spec for
- compiling a file, based on its suffix.
- A file that does not end in any of these suffixes will be passed
- unchanged to the loader and nothing else will be done to it.
-
- An entry containing two 0s is used to terminate the vector.
-
- If multiple entries match a file, the last matching one is used. */
-
-static struct compiler *compilers;
-
-/* Number of entries in `compilers', not counting the null terminator. */
-
-static int n_compilers;
-
-/* The default list of file name suffixes and their compilation specs. */
-
-static struct compiler default_compilers[] =
-{
- /* Add lists of suffixes of known languages here. If those languages
- were no present when we built the driver, we will hit these copies
- and given a more meaningful error than "file not used since
- linking is not done". */
- {".cc", "#C++"}, {".cxx", "#C++"}, {".cpp", "#C++"}, {".c++", "#C++"},
- {".C", "#C++"}, {".ads", "#Ada"}, {".adb", "#Ada"}, {".ada", "#Ada"},
- {".f", "#Fortran"}, {".for", "#Fortran"}, {".F", "#Fortran"},
- {".fpp", "#Fortran"},
- /* Next come the entries for C. */
- {".c", "@c"},
- {"@c",
- "cpp -lang-c%{ansi:89} %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
- %{C:%{!E:%eGNU C does not support -C without using -E}}\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
- -undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
- %{ansi:-trigraphs -D__STRICT_ANSI__}\
- %{!undef:%{!ansi:%p} %P} %{trigraphs} \
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
- %{traditional-cpp:-traditional}\
- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
- %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
- "%{!M:%{!MM:%{!E:cc1 %{!pipe:%g.i} %1 \
- %{!Q:-quiet} -dumpbase %b.c %{d*} %{m*} %{a*}\
- %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \
- %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\
- %{aux-info*}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
- %{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}}}"},
- {"-",
- "%{E:cpp -lang-c%{ansi:89} %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
- %{C:%{!E:%eGNU C does not support -C without using -E}}\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
- -undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
- %{ansi:-trigraphs -D__STRICT_ANSI__}\
- %{!undef:%{!ansi:%p} %P} %{trigraphs}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
- %{traditional-cpp:-traditional}\
- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
- %i %W{o*}}\
- %{!E:%e-E required when input is from standard input}"},
- {".m", "@objective-c"},
- {"@objective-c",
- "cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
- %{C:%{!E:%eGNU C does not support -C without using -E}}\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
- -undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
- %{ansi:-trigraphs -D__STRICT_ANSI__}\
- %{!undef:%{!ansi:%p} %P} %{trigraphs}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
- %{traditional-cpp:-traditional}\
- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
- %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
- "%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.i} %1 \
- %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\
- %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \
- %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \
- -lang-objc %{gen-decls} \
- %{aux-info*}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
- %{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}}}"},
- {".h", "@c-header"},
- {"@c-header",
- "%{!E:%eCompilation of header file requested} \
- cpp %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
- %{C:%{!E:%eGNU C does not support -C without using -E}}\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\
- -undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
- %{ansi:-trigraphs -D__STRICT_ANSI__}\
- %{!undef:%{!ansi:%p} %P} %{trigraphs}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
- %{traditional-cpp:-traditional}\
- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
- %i %W{o*}"},
- {".i", "@cpp-output"},
- {"@cpp-output",
- "%{!M:%{!MM:%{!E:cc1 %i %1 %{!Q:-quiet} %{d*} %{m*} %{a*}\
- %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\
- %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\
- %{aux-info*}\
- %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
- %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
- %{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}}}"},
- {".s", "@assembler"},
- {"@assembler",
- "%{!M:%{!MM:%{!E:%{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %i %A\n }}}}"},
- {".S", "@assembler-with-cpp"},
- {"@assembler-with-cpp",
- "cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\
- %{C:%{!E:%eGNU C does not support -C without using -E}}\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{trigraphs}\
- -undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
- %{traditional-cpp:-traditional}\
- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
- %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
- "%{!M:%{!MM:%{!E:%{!S:as %a %Y\
- %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\
- %{!pipe:%g.s} %A\n }}}}"},
-#include "specs.h"
- /* Mark end of table */
- {0, 0}
-};
-
-/* Number of elements in default_compilers, not counting the terminator. */
-
-static int n_default_compilers
- = (sizeof default_compilers / sizeof (struct compiler)) - 1;
-
-/* Here is the spec for running the linker, after compiling all files. */
-
-/* -u* was put back because both BSD and SysV seem to support it. */
-/* %{static:} simply prevents an error message if the target machine
- doesn't handle -static. */
-/* We want %{T*} after %{L*} and %D so that it can be used to specify linker
- scripts which exist in user specified directories, or in standard
- directories. */
-#ifdef LINK_LIBGCC_SPECIAL
-/* Don't generate -L options. */
-static char *link_command_spec = "\
-%{!fsyntax-only: \
- %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
- %{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\
- %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
- %{static:} %{L*} %o\
- %{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
- %{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
- %{T*}\
- \n }}}}}}";
-#else
-/* Use -L. */
-static char *link_command_spec = "\
-%{!fsyntax-only: \
- %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
- %{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\
- %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
- %{static:} %{L*} %D %o\
- %{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
- %{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
- %{T*}\
- \n }}}}}}";
-#endif
-
-/* A vector of options to give to the linker.
- These options are accumulated by %x,
- and substituted into the linker command with %X. */
-static int n_linker_options;
-static char **linker_options;
-
-/* A vector of options to give to the assembler.
- These options are accumulated by -Wa,
- and substituted into the assembler command with %Y. */
-static int n_assembler_options;
-static char **assembler_options;
-
-/* A vector of options to give to the preprocessor.
- These options are accumulated by -Wp,
- and substituted into the preprocessor command with %Z. */
-static int n_preprocessor_options;
-static char **preprocessor_options;
-
-/* Define how to map long options into short ones. */
-
-/* This structure describes one mapping. */
-struct option_map
-{
- /* The long option's name. */
- char *name;
- /* The equivalent short option. */
- char *equivalent;
- /* Argument info. A string of flag chars; NULL equals no options.
- a => argument required.
- o => argument optional.
- j => join argument to equivalent, making one word.
- * => require other text after NAME as an argument. */
- char *arg_info;
-};
-
-/* This is the table of mappings. Mappings are tried sequentially
- for each option encountered; the first one that matches, wins. */
-
-struct option_map option_map[] =
- {
- {"--all-warnings", "-Wall", 0},
- {"--ansi", "-ansi", 0},
- {"--assemble", "-S", 0},
- {"--assert", "-A", "a"},
- {"--comments", "-C", 0},
- {"--compile", "-c", 0},
- {"--debug", "-g", "oj"},
- {"--define-macro", "-D", "aj"},
- {"--dependencies", "-M", 0},
- {"--dump", "-d", "a"},
- {"--dumpbase", "-dumpbase", "a"},
- {"--entry", "-e", 0},
- {"--extra-warnings", "-W", 0},
- {"--for-assembler", "-Wa", "a"},
- {"--for-linker", "-Xlinker", "a"},
- {"--force-link", "-u", "a"},
- {"--imacros", "-imacros", "a"},
- {"--include", "-include", "a"},
- {"--include-barrier", "-I-", 0},
- {"--include-directory", "-I", "aj"},
- {"--include-directory-after", "-idirafter", "a"},
- {"--include-prefix", "-iprefix", "a"},
- {"--include-with-prefix", "-iwithprefix", "a"},
- {"--include-with-prefix-before", "-iwithprefixbefore", "a"},
- {"--include-with-prefix-after", "-iwithprefix", "a"},
- {"--language", "-x", "a"},
- {"--library-directory", "-L", "a"},
- {"--machine", "-m", "aj"},
- {"--machine-", "-m", "*j"},
- {"--no-line-commands", "-P", 0},
- {"--no-precompiled-includes", "-noprecomp", 0},
- {"--no-standard-includes", "-nostdinc", 0},
- {"--no-standard-libraries", "-nostdlib", 0},
- {"--no-warnings", "-w", 0},
- {"--optimize", "-O", "oj"},
- {"--output", "-o", "a"},
- {"--pedantic", "-pedantic", 0},
- {"--pedantic-errors", "-pedantic-errors", 0},
- {"--pipe", "-pipe", 0},
- {"--prefix", "-B", "a"},
- {"--preprocess", "-E", 0},
- {"--print-search-dirs", "-print-search-dirs", 0},
- {"--print-file-name", "-print-file-name=", "aj"},
- {"--print-libgcc-file-name", "-print-libgcc-file-name", 0},
- {"--print-missing-file-dependencies", "-MG", 0},
- {"--print-multi-lib", "-print-multi-lib", 0},
- {"--print-multi-directory", "-print-multi-directory", 0},
- {"--print-prog-name", "-print-prog-name=", "aj"},
- {"--profile", "-p", 0},
- {"--profile-blocks", "-a", 0},
- {"--quiet", "-q", 0},
- {"--save-temps", "-save-temps", 0},
- {"--shared", "-shared", 0},
- {"--silent", "-q", 0},
- {"--specs", "-specs=", "aj"},
- {"--static", "-static", 0},
- {"--symbolic", "-symbolic", 0},
- {"--target", "-b", "a"},
- {"--trace-includes", "-H", 0},
- {"--traditional", "-traditional", 0},
- {"--traditional-cpp", "-traditional-cpp", 0},
- {"--trigraphs", "-trigraphs", 0},
- {"--undefine-macro", "-U", "aj"},
- {"--use-version", "-V", "a"},
- {"--user-dependencies", "-MM", 0},
- {"--verbose", "-v", 0},
- {"--version", "-dumpversion", 0},
- {"--warn-", "-W", "*j"},
- {"--write-dependencies", "-MD", 0},
- {"--write-user-dependencies", "-MMD", 0},
- {"--", "-f", "*j"}
- };
-
-/* Translate the options described by *ARGCP and *ARGVP.
- Make a new vector and store it back in *ARGVP,
- and store its length in *ARGVC. */
-
-static void
-translate_options (argcp, argvp)
- int *argcp;
- char ***argvp;
-{
- int i, j, k;
- int argc = *argcp;
- char **argv = *argvp;
- char **newv = (char **) xmalloc ((argc + 2) * 2 * sizeof (char *));
- int newindex = 0;
-
- i = 0;
- newv[newindex++] = argv[i++];
-
- while (i < argc)
- {
- /* Translate -- options. */
- if (argv[i][0] == '-' && argv[i][1] == '-')
- {
- /* Find a mapping that applies to this option. */
- for (j = 0; j < sizeof (option_map) / sizeof (option_map[0]); j++)
- {
- int optlen = strlen (option_map[j].name);
- int arglen = strlen (argv[i]);
- int complen = arglen > optlen ? optlen : arglen;
- char *arginfo = option_map[j].arg_info;
-
- if (arginfo == 0)
- arginfo = "";
-
- if (!strncmp (argv[i], option_map[j].name, complen))
- {
- char *arg = 0;
-
- if (arglen < optlen)
- {
- for (k = j + 1;
- k < sizeof (option_map) / sizeof (option_map[0]);
- k++)
- if (strlen (option_map[k].name) >= arglen
- && !strncmp (argv[i], option_map[k].name, arglen))
- {
- error ("Ambiguous abbreviation %s", argv[i]);
- break;
- }
-
- if (k != sizeof (option_map) / sizeof (option_map[0]))
- break;
- }
-
- if (arglen > optlen)
- {
- /* If the option has an argument, accept that. */
- if (argv[i][optlen] == '=')
- arg = argv[i] + optlen + 1;
-
- /* If this mapping requires extra text at end of name,
- accept that as "argument". */
- else if (index (arginfo, '*') != 0)
- arg = argv[i] + optlen;
-
- /* Otherwise, extra text at end means mismatch.
- Try other mappings. */
- else
- continue;
- }
-
- else if (index (arginfo, '*') != 0)
- {
- error ("Incomplete `%s' option", option_map[j].name);
- break;
- }
-
- /* Handle arguments. */
- if (index (arginfo, 'a') != 0)
- {
- if (arg == 0)
- {
- if (i + 1 == argc)
- {
- error ("Missing argument to `%s' option",
- option_map[j].name);
- break;
- }
-
- arg = argv[++i];
- }
- }
- else if (index (arginfo, '*') != 0)
- ;
- else if (index (arginfo, 'o') == 0)
- {
- if (arg != 0)
- error ("Extraneous argument to `%s' option",
- option_map[j].name);
- arg = 0;
- }
-
- /* Store the translation as one argv elt or as two. */
- if (arg != 0 && index (arginfo, 'j') != 0)
- newv[newindex++] = concat (option_map[j].equivalent, arg,
- NULL_PTR);
- else if (arg != 0)
- {
- newv[newindex++] = option_map[j].equivalent;
- newv[newindex++] = arg;
- }
- else
- newv[newindex++] = option_map[j].equivalent;
-
- break;
- }
- }
- i++;
- }
-
- /* Handle old-fashioned options--just copy them through,
- with their arguments. */
- else if (argv[i][0] == '-')
- {
- char *p = argv[i] + 1;
- int c = *p;
- int nskip = 1;
-
- if (SWITCH_TAKES_ARG (c) > (p[1] != 0))
- nskip += SWITCH_TAKES_ARG (c) - (p[1] != 0);
- else if (WORD_SWITCH_TAKES_ARG (p))
- nskip += WORD_SWITCH_TAKES_ARG (p);
- else if ((c == 'B' || c == 'b' || c == 'V' || c == 'x')
- && p[1] == 0)
- nskip += 1;
- else if (! strcmp (p, "Xlinker"))
- nskip += 1;
-
- /* Watch out for an option at the end of the command line that
- is missing arguments, and avoid skipping past the end of the
- command line. */
- if (nskip + i > argc)
- nskip = argc - i;
-
- while (nskip > 0)
- {
- newv[newindex++] = argv[i++];
- nskip--;
- }
- }
- else
- /* Ordinary operands, or +e options. */
- newv[newindex++] = argv[i++];
- }
-
- newv[newindex] = 0;
-
- *argvp = newv;
- *argcp = newindex;
-}
-
-char *
-my_strerror(e)
- int e;
-{
-#ifdef HAVE_STRERROR
-
- return strerror(e);
-
-#else
-
- static char buffer[30];
- if (!e)
- return "cannot access";
-
- if (e > 0 && e < sys_nerr)
- return sys_errlist[e];
-
- sprintf (buffer, "Unknown error %d", e);
- return buffer;
-#endif
-}
-
-static char *
-skip_whitespace (p)
- char *p;
-{
- while (1)
- {
- /* A fully-blank line is a delimiter in the SPEC file and shouldn't
- be considered whitespace. */
- if (p[0] == '\n' && p[1] == '\n' && p[2] == '\n')
- return p + 1;
- else if (*p == '\n' || *p == ' ' || *p == '\t')
- p++;
- else if (*p == '#')
- {
- while (*p != '\n') p++;
- p++;
- }
- else
- break;
- }
-
- return p;
-}
-
-/* Structure to keep track of the specs that have been defined so far.
- These are accessed using %(specname) or %[specname] in a compiler
- or link spec. */
-
-struct spec_list
-{
- /* The following 2 fields must be first */
- /* to allow EXTRA_SPECS to be initialized */
- char *name; /* name of the spec. */
- char *ptr; /* available ptr if no static pointer */
-
- /* The following fields are not initialized */
- /* by EXTRA_SPECS */
- char **ptr_spec; /* pointer to the spec itself. */
- struct spec_list *next; /* Next spec in linked list. */
- int name_len; /* length of the name */
- int alloc_p; /* whether string was allocated */
-};
-
-#define INIT_STATIC_SPEC(NAME,PTR) \
-{ NAME, NULL_PTR, PTR, (struct spec_list *)0, sizeof (NAME)-1, 0 }
-
-/* List of statically defined specs */
-static struct spec_list static_specs[] = {
- INIT_STATIC_SPEC ("asm", &asm_spec),
- INIT_STATIC_SPEC ("asm_final", &asm_final_spec),
- INIT_STATIC_SPEC ("cpp", &cpp_spec),
- INIT_STATIC_SPEC ("cc1", &cc1_spec),
- INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec),
- INIT_STATIC_SPEC ("endfile", &endfile_spec),
- INIT_STATIC_SPEC ("link", &link_spec),
- INIT_STATIC_SPEC ("lib", &lib_spec),
- INIT_STATIC_SPEC ("libgcc", &libgcc_spec),
- INIT_STATIC_SPEC ("startfile", &startfile_spec),
- INIT_STATIC_SPEC ("switches_need_spaces", &switches_need_spaces),
- INIT_STATIC_SPEC ("signed_char", &signed_char_spec),
- INIT_STATIC_SPEC ("predefines", &cpp_predefines),
- INIT_STATIC_SPEC ("cross_compile", &cross_compile),
- INIT_STATIC_SPEC ("version", &compiler_version),
- INIT_STATIC_SPEC ("multilib", &multilib_select),
- INIT_STATIC_SPEC ("multilib_defaults", &multilib_defaults),
- INIT_STATIC_SPEC ("multilib_extra", &multilib_extra),
- INIT_STATIC_SPEC ("multilib_matches", &multilib_matches),
-};
-
-#ifdef EXTRA_SPECS /* additional specs needed */
-static struct spec_list extra_specs[] = { EXTRA_SPECS };
-#endif
-
-/* List of dynamically allocates specs that have been defined so far. */
-
-static struct spec_list *specs = (struct spec_list *)0;
-
-
-/* Initialize the specs lookup routines. */
-
-static void
-init_spec ()
-{
- struct spec_list *next = (struct spec_list *)0;
- struct spec_list *sl = (struct spec_list *)0;
- int i;
-
- if (specs)
- return; /* already initialized */
-
- if (verbose_flag)
- fprintf (stderr, "Using builtin specs.\n");
-
-#ifdef EXTRA_SPECS
- for (i = (sizeof (extra_specs) / sizeof (extra_specs[0])) - 1; i >= 0; i--)
- {
- sl = &extra_specs[i];
- sl->next = next;
- sl->name_len = strlen (sl->name);
- sl->ptr_spec = &sl->ptr;
- next = sl;
- }
-#endif
-
- for (i = (sizeof (static_specs) / sizeof (static_specs[0])) - 1; i >= 0; i--)
- {
- sl = &static_specs[i];
- sl->next = next;
- next = sl;
- }
-
- specs = sl;
-}
-
-
-/* Change the value of spec NAME to SPEC. If SPEC is empty, then the spec is
- removed; If the spec starts with a + then SPEC is added to the end of the
- current spec. */
-
-static void
-set_spec (name, spec)
- char *name;
- char *spec;
-{
- struct spec_list *sl;
- char *old_spec;
- int name_len = strlen (name);
- int i;
-
- /* If this is the first call, initialize the statically allocated specs */
- if (!specs)
- {
- struct spec_list *next = (struct spec_list *)0;
- for (i = (sizeof (static_specs) / sizeof (static_specs[0])) - 1; i >= 0; i--)
- {
- sl = &static_specs[i];
- sl->next = next;
- next = sl;
- }
- specs = sl;
- }
-
- /* See if the spec already exists */
- for (sl = specs; sl; sl = sl->next)
- if (name_len == sl->name_len && !strcmp (sl->name, name))
- break;
-
- if (!sl)
- {
- /* Not found - make it */
- sl = (struct spec_list *) xmalloc (sizeof (struct spec_list));
- sl->name = save_string (name, strlen (name));
- sl->name_len = name_len;
- sl->ptr_spec = &sl->ptr;
- sl->alloc_p = 0;
- *(sl->ptr_spec) = "";
- sl->next = specs;
- specs = sl;
- }
-
- old_spec = *(sl->ptr_spec);
- *(sl->ptr_spec) = ((spec[0] == '+' && isspace (spec[1]))
- ? concat (old_spec, spec + 1, NULL_PTR)
- : save_string (spec, strlen (spec)));
-
-#ifdef DEBUG_SPECS
- if (verbose_flag)
- fprintf (stderr, "Setting spec %s to '%s'\n\n", name, *(sl->ptr_spec));
-#endif
-
- /* Free the old spec */
- if (old_spec && sl->alloc_p)
- free (old_spec);
-
- sl->alloc_p = 1;
-}
-
-/* Accumulate a command (program name and args), and run it. */
-
-/* Vector of pointers to arguments in the current line of specifications. */
-
-static char **argbuf;
-
-/* Number of elements allocated in argbuf. */
-
-static int argbuf_length;
-
-/* Number of elements in argbuf currently in use (containing args). */
-
-static int argbuf_index;
-
-/* This is the list of suffixes and codes (%g/%u/%U) and the associated
- temp file. Used only if MKTEMP_EACH_FILE. */
-
-static struct temp_name {
- char *suffix; /* suffix associated with the code. */
- int length; /* strlen (suffix). */
- int unique; /* Indicates whether %g or %u/%U was used. */
- char *filename; /* associated filename. */
- int filename_length; /* strlen (filename). */
- struct temp_name *next;
-} *temp_names;
-
-/* Number of commands executed so far. */
-
-static int execution_count;
-
-/* Number of commands that exited with a signal. */
-
-static int signal_count;
-
-/* Name with which this program was invoked. */
-
-static char *programname;
-
-/* Structures to keep track of prefixes to try when looking for files. */
-
-struct prefix_list
-{
- char *prefix; /* String to prepend to the path. */
- struct prefix_list *next; /* Next in linked list. */
- int require_machine_suffix; /* Don't use without machine_suffix. */
- /* 2 means try both machine_suffix and just_machine_suffix. */
- int *used_flag_ptr; /* 1 if a file was found with this prefix. */
-};
-
-struct path_prefix
-{
- struct prefix_list *plist; /* List of prefixes to try */
- int max_len; /* Max length of a prefix in PLIST */
- char *name; /* Name of this list (used in config stuff) */
-};
-
-/* List of prefixes to try when looking for executables. */
-
-static struct path_prefix exec_prefixes = { 0, 0, "exec" };
-
-/* List of prefixes to try when looking for startup (crt0) files. */
-
-static struct path_prefix startfile_prefixes = { 0, 0, "startfile" };
-
-/* List of prefixes to try when looking for include files. */
-
-static struct path_prefix include_prefixes = { 0, 0, "include" };
-
-/* Suffix to attach to directories searched for commands.
- This looks like `MACHINE/VERSION/'. */
-
-static char *machine_suffix = 0;
-
-/* Suffix to attach to directories searched for commands.
- This is just `MACHINE/'. */
-
-static char *just_machine_suffix = 0;
-
-/* Adjusted value of GCC_EXEC_PREFIX envvar. */
-
-static char *gcc_exec_prefix;
-
-/* Default prefixes to attach to command names. */
-
-#ifdef CROSS_COMPILE /* Don't use these prefixes for a cross compiler. */
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-#undef MD_STARTFILE_PREFIX_1
-#endif
-
-#ifndef STANDARD_EXEC_PREFIX
-#define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
-#endif /* !defined STANDARD_EXEC_PREFIX */
-
-static char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
-static char *standard_exec_prefix_1 = "/usr/lib/gcc/";
-#ifdef MD_EXEC_PREFIX
-static char *md_exec_prefix = MD_EXEC_PREFIX;
-#endif
-
-#ifndef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
-#endif /* !defined STANDARD_STARTFILE_PREFIX */
-
-#ifdef MD_STARTFILE_PREFIX
-static char *md_startfile_prefix = MD_STARTFILE_PREFIX;
-#endif
-#ifdef MD_STARTFILE_PREFIX_1
-static char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
-#endif
-static char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
-static char *standard_startfile_prefix_1 = "/lib/";
-static char *standard_startfile_prefix_2 = "/usr/lib/";
-
-#ifndef TOOLDIR_BASE_PREFIX
-#define TOOLDIR_BASE_PREFIX "/usr/local/"
-#endif
-static char *tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
-static char *tooldir_prefix;
-
-/* Subdirectory to use for locating libraries. Set by
- set_multilib_dir based on the compilation options. */
-
-static char *multilib_dir;
-
-/* Clear out the vector of arguments (after a command is executed). */
-
-static void
-clear_args ()
-{
- argbuf_index = 0;
-}
-
-/* Add one argument to the vector at the end.
- This is done when a space is seen or at the end of the line.
- If DELETE_ALWAYS is nonzero, the arg is a filename
- and the file should be deleted eventually.
- If DELETE_FAILURE is nonzero, the arg is a filename
- and the file should be deleted if this compilation fails. */
-
-static void
-store_arg (arg, delete_always, delete_failure)
- char *arg;
- int delete_always, delete_failure;
-{
- if (argbuf_index + 1 == argbuf_length)
- {
- argbuf = (char **) xrealloc (argbuf, (argbuf_length *= 2) * sizeof (char *));
- }
-
- argbuf[argbuf_index++] = arg;
- argbuf[argbuf_index] = 0;
-
- if (delete_always || delete_failure)
- record_temp_file (arg, delete_always, delete_failure);
-}
-
-/* Read compilation specs from a file named FILENAME,
- replacing the default ones.
-
- A suffix which starts with `*' is a definition for
- one of the machine-specific sub-specs. The "suffix" should be
- *asm, *cc1, *cpp, *link, *startfile, *signed_char, etc.
- The corresponding spec is stored in asm_spec, etc.,
- rather than in the `compilers' vector.
-
- Anything invalid in the file is a fatal error. */
-
-static void
-read_specs (filename, main_p)
- char *filename;
- int main_p;
-{
- int desc;
- int readlen;
- struct stat statbuf;
- char *buffer;
- register char *p;
-
- if (verbose_flag)
- fprintf (stderr, "Reading specs from %s\n", filename);
-
- /* Open and stat the file. */
- desc = open (filename, O_RDONLY, 0);
- if (desc < 0)
- pfatal_with_name (filename);
- if (stat (filename, &statbuf) < 0)
- pfatal_with_name (filename);
-
- /* Read contents of file into BUFFER. */
- buffer = xmalloc ((unsigned) statbuf.st_size + 1);
- readlen = read (desc, buffer, (unsigned) statbuf.st_size);
- if (readlen < 0)
- pfatal_with_name (filename);
- buffer[readlen] = 0;
- close (desc);
-
- /* Scan BUFFER for specs, putting them in the vector. */
- p = buffer;
- while (1)
- {
- char *suffix;
- char *spec;
- char *in, *out, *p1, *p2, *p3;
-
- /* Advance P in BUFFER to the next nonblank nocomment line. */
- p = skip_whitespace (p);
- if (*p == 0)
- break;
-
- /* Is this a special command that starts with '%'? */
- /* Don't allow this for the main specs file, since it would
- encourage people to overwrite it. */
- if (*p == '%' && !main_p)
- {
- p1 = p;
- while (*p && *p != '\n') p++;
- p++; /* skip \n */
-
- if (!strncmp (p1, "%include", sizeof ("%include")-1)
- && (p1[ sizeof ("%include")-1 ] == ' '
- || p1[ sizeof ("%include")-1 ] == '\t'))
- {
- char *new_filename;
-
- p1 += sizeof ("%include");
- while (*p1 == ' ' || *p1 == '\t') p1++;
-
- if (*p1++ != '<' || p[-2] != '>')
- fatal ("specs %%include syntax malformed after %d characters",
- p1 - buffer + 1);
-
- p[-2] = '\0';
- new_filename = find_a_file (&startfile_prefixes, p1, R_OK);
- read_specs (new_filename ? new_filename : p1, FALSE);
- continue;
- }
- else if (!strncmp (p1, "%include_noerr", sizeof ("%include_noerr")-1)
- && (p1[ sizeof ("%include_noerr")-1 ] == ' '
- || p1[ sizeof ("%include_noerr")-1 ] == '\t'))
- {
- char *new_filename;
-
- p1 += sizeof ("%include_noerr");
- while (*p1 == ' ' || *p1 == '\t') p1++;
-
- if (*p1++ != '<' || p[-2] != '>')
- fatal ("specs %%include syntax malformed after %d characters",
- p1 - buffer + 1);
-
- p[-2] = '\0';
- new_filename = find_a_file (&startfile_prefixes, p1, R_OK);
- if (new_filename)
- read_specs (new_filename, FALSE);
- else if (verbose_flag)
- fprintf (stderr, "Could not find specs file %s\n", p1);
- continue;
- }
- else if (!strncmp (p1, "%rename", sizeof ("%rename")-1)
- && (p1[ sizeof ("%rename")-1 ] == ' '
- || p1[ sizeof ("%rename")-1 ] == '\t'))
- {
- int name_len;
- struct spec_list *sl;
-
- /* Get original name */
- p1 += sizeof ("%rename");
- while (*p1 == ' ' || *p1 == '\t') p1++;
- if (!isalpha (*p1))
- fatal ("specs %%rename syntax malformed after %d characters",
- p1 - buffer);
-
- p2 = p1;
- while (*p2 && !isspace (*p2)) p2++;
- if (*p2 != ' ' && *p2 != '\t')
- fatal ("specs %%rename syntax malformed after %d characters",
- p2 - buffer);
-
- name_len = p2 - p1;
- *p2++ = '\0';
- while (*p2 == ' ' || *p2 == '\t') p2++;
- if (!isalpha (*p2))
- fatal ("specs %%rename syntax malformed after %d characters",
- p2 - buffer);
-
- /* Get new spec name */
- p3 = p2;
- while (*p3 && !isspace (*p3)) p3++;
- if (p3 != p-1)
- fatal ("specs %%rename syntax malformed after %d characters",
- p3 - buffer);
- *p3 = '\0';
-
- for (sl = specs; sl; sl = sl->next)
- if (name_len == sl->name_len && !strcmp (sl->name, p1))
- break;
-
- if (!sl)
- fatal ("specs %s spec was not found to be renamed", p1);
-
- if (!strcmp (p1, p2))
- continue;
-
- if (verbose_flag)
- {
- fprintf (stderr, "rename spec %s to %s\n", p1, p2);
-#ifdef DEBUG_SPECS
- fprintf (stderr, "spec is '%s'\n\n", *(sl->ptr_spec));
-#endif
- }
-
- set_spec (p2, *(sl->ptr_spec));
- if (sl->alloc_p)
- free (*(sl->ptr_spec));
-
- *(sl->ptr_spec) = "";
- sl->alloc_p = 0;
- continue;
- }
- else
- fatal ("specs unknown %% command after %d characters",
- p1 - buffer);
- }
-
- /* Find the colon that should end the suffix. */
- p1 = p;
- while (*p1 && *p1 != ':' && *p1 != '\n') p1++;
- /* The colon shouldn't be missing. */
- if (*p1 != ':')
- fatal ("specs file malformed after %d characters", p1 - buffer);
- /* Skip back over trailing whitespace. */
- p2 = p1;
- while (p2 > buffer && (p2[-1] == ' ' || p2[-1] == '\t')) p2--;
- /* Copy the suffix to a string. */
- suffix = save_string (p, p2 - p);
- /* Find the next line. */
- p = skip_whitespace (p1 + 1);
- if (p[1] == 0)
- fatal ("specs file malformed after %d characters", p - buffer);
- p1 = p;
- /* Find next blank line. */
- while (*p1 && !(*p1 == '\n' && p1[1] == '\n')) p1++;
- /* Specs end at the blank line and do not include the newline. */
- spec = save_string (p, p1 - p);
- p = p1;
-
- /* Delete backslash-newline sequences from the spec. */
- in = spec;
- out = spec;
- while (*in != 0)
- {
- if (in[0] == '\\' && in[1] == '\n')
- in += 2;
- else if (in[0] == '#')
- {
- while (*in && *in != '\n') in++;
- }
- else
- *out++ = *in++;
- }
- *out = 0;
-
- if (suffix[0] == '*')
- {
- if (! strcmp (suffix, "*link_command"))
- link_command_spec = spec;
- else
- set_spec (suffix + 1, spec);
- }
- else
- {
- /* Add this pair to the vector. */
- compilers
- = ((struct compiler *)
- xrealloc (compilers, (n_compilers + 2) * sizeof (struct compiler)));
- compilers[n_compilers].suffix = suffix;
- bzero ((char *) compilers[n_compilers].spec,
- sizeof compilers[n_compilers].spec);
- compilers[n_compilers].spec[0] = spec;
- n_compilers++;
- bzero ((char *) &compilers[n_compilers],
- sizeof compilers[n_compilers]);
- }
-
- if (*suffix == 0)
- link_command_spec = spec;
- }
-
- if (link_command_spec == 0)
- fatal ("spec file has no spec for linking");
-}
-
-/* Record the names of temporary files we tell compilers to write,
- and delete them at the end of the run. */
-
-/* This is the common prefix we use to make temp file names.
- It is chosen once for each run of this program.
- It is substituted into a spec by %g.
- Thus, all temp file names contain this prefix.
- In practice, all temp file names start with this prefix.
-
- This prefix comes from the envvar TMPDIR if it is defined;
- otherwise, from the P_tmpdir macro if that is defined;
- otherwise, in /usr/tmp or /tmp;
- or finally the current directory if all else fails. */
-
-static char *temp_filename;
-
-/* Length of the prefix. */
-
-static int temp_filename_length;
-
-/* Define the list of temporary files to delete. */
-
-struct temp_file
-{
- char *name;
- struct temp_file *next;
-};
-
-/* Queue of files to delete on success or failure of compilation. */
-static struct temp_file *always_delete_queue;
-/* Queue of files to delete on failure of compilation. */
-static struct temp_file *failure_delete_queue;
-
-/* Record FILENAME as a file to be deleted automatically.
- ALWAYS_DELETE nonzero means delete it if all compilation succeeds;
- otherwise delete it in any case.
- FAIL_DELETE nonzero means delete it if a compilation step fails;
- otherwise delete it in any case. */
-
-static void
-record_temp_file (filename, always_delete, fail_delete)
- char *filename;
- int always_delete;
- int fail_delete;
-{
- register char *name;
- name = xmalloc (strlen (filename) + 1);
- strcpy (name, filename);
-
- if (always_delete)
- {
- register struct temp_file *temp;
- for (temp = always_delete_queue; temp; temp = temp->next)
- if (! strcmp (name, temp->name))
- goto already1;
- temp = (struct temp_file *) xmalloc (sizeof (struct temp_file));
- temp->next = always_delete_queue;
- temp->name = name;
- always_delete_queue = temp;
- already1:;
- }
-
- if (fail_delete)
- {
- register struct temp_file *temp;
- for (temp = failure_delete_queue; temp; temp = temp->next)
- if (! strcmp (name, temp->name))
- goto already2;
- temp = (struct temp_file *) xmalloc (sizeof (struct temp_file));
- temp->next = failure_delete_queue;
- temp->name = name;
- failure_delete_queue = temp;
- already2:;
- }
-}
-
-/* Delete all the temporary files whose names we previously recorded. */
-
-static void
-delete_if_ordinary (name)
- char *name;
-{
- struct stat st;
-#ifdef DEBUG
- int i, c;
-
- printf ("Delete %s? (y or n) ", name);
- fflush (stdout);
- i = getchar ();
- if (i != '\n')
- while ((c = getchar ()) != '\n' && c != EOF) ;
- if (i == 'y' || i == 'Y')
-#endif /* DEBUG */
- if (stat (name, &st) >= 0 && S_ISREG (st.st_mode))
- if (unlink (name) < 0)
- if (verbose_flag)
- perror_with_name (name);
-}
-
-static void
-delete_temp_files ()
-{
- register struct temp_file *temp;
-
- for (temp = always_delete_queue; temp; temp = temp->next)
- delete_if_ordinary (temp->name);
- always_delete_queue = 0;
-}
-
-/* Delete all the files to be deleted on error. */
-
-static void
-delete_failure_queue ()
-{
- register struct temp_file *temp;
-
- for (temp = failure_delete_queue; temp; temp = temp->next)
- delete_if_ordinary (temp->name);
-}
-
-static void
-clear_failure_queue ()
-{
- failure_delete_queue = 0;
-}
-
-/* Routine to add variables to the environment. We do this to pass
- the pathname of the gcc driver, and the directories search to the
- collect2 program, which is being run as ld. This way, we can be
- sure of executing the right compiler when collect2 wants to build
- constructors and destructors. Since the environment variables we
- use come from an obstack, we don't have to worry about allocating
- space for them. */
-
-#ifndef HAVE_PUTENV
-
-void
-putenv (str)
- char *str;
-{
-#ifndef VMS /* nor about VMS */
-
- extern char **environ;
- char **old_environ = environ;
- char **envp;
- int num_envs = 0;
- int name_len = 1;
- int str_len = strlen (str);
- char *p = str;
- int ch;
-
- while ((ch = *p++) != '\0' && ch != '=')
- name_len++;
-
- if (!ch)
- abort ();
-
- /* Search for replacing an existing environment variable, and
- count the number of total environment variables. */
- for (envp = old_environ; *envp; envp++)
- {
- num_envs++;
- if (!strncmp (str, *envp, name_len))
- {
- *envp = str;
- return;
- }
- }
-
- /* Add a new environment variable */
- environ = (char **) xmalloc (sizeof (char *) * (num_envs+2));
- *environ = str;
- bcopy ((char *) old_environ, (char *) (environ + 1),
- sizeof (char *) * (num_envs+1));
-
-#endif /* VMS */
-}
-
-#endif /* HAVE_PUTENV */
-
-
-/* Build a list of search directories from PATHS.
- PREFIX is a string to prepend to the list.
- If CHECK_DIR_P is non-zero we ensure the directory exists.
- This is used mostly by putenv_from_prefixes so we use `collect_obstack'.
- It is also used by the --print-search-dirs flag. */
-
-static char *
-build_search_list (paths, prefix, check_dir_p)
- struct path_prefix *paths;
- char *prefix;
- int check_dir_p;
-{
- int suffix_len = (machine_suffix) ? strlen (machine_suffix) : 0;
- int just_suffix_len
- = (just_machine_suffix) ? strlen (just_machine_suffix) : 0;
- int first_time = TRUE;
- struct prefix_list *pprefix;
-
- obstack_grow (&collect_obstack, prefix, strlen (prefix));
-
- for (pprefix = paths->plist; pprefix != 0; pprefix = pprefix->next)
- {
- int len = strlen (pprefix->prefix);
-
- if (machine_suffix
- && (!check_dir_p
- || is_directory (pprefix->prefix, machine_suffix, 0)))
- {
- if (!first_time)
- obstack_1grow (&collect_obstack, PATH_SEPARATOR);
-
- first_time = FALSE;
- obstack_grow (&collect_obstack, pprefix->prefix, len);
- obstack_grow (&collect_obstack, machine_suffix, suffix_len);
- }
-
- if (just_machine_suffix
- && pprefix->require_machine_suffix == 2
- && (!check_dir_p
- || is_directory (pprefix->prefix, just_machine_suffix, 0)))
- {
- if (!first_time)
- obstack_1grow (&collect_obstack, PATH_SEPARATOR);
-
- first_time = FALSE;
- obstack_grow (&collect_obstack, pprefix->prefix, len);
- obstack_grow (&collect_obstack, just_machine_suffix,
- just_suffix_len);
- }
-
- if (!pprefix->require_machine_suffix)
- {
- if (!first_time)
- obstack_1grow (&collect_obstack, PATH_SEPARATOR);
-
- first_time = FALSE;
- obstack_grow (&collect_obstack, pprefix->prefix, len);
- }
- }
- obstack_1grow (&collect_obstack, '\0');
- return obstack_finish (&collect_obstack);
-}
-
-/* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
- for collect. */
-
-static void
-putenv_from_prefixes (paths, env_var)
- struct path_prefix *paths;
- char *env_var;
-{
- putenv (build_search_list (paths, env_var, 1));
-}
-
-/* Search for NAME using the prefix list PREFIXES. MODE is passed to
- access to check permissions.
- Return 0 if not found, otherwise return its name, allocated with malloc. */
-
-static char *
-find_a_file (pprefix, name, mode)
- struct path_prefix *pprefix;
- char *name;
- int mode;
-{
- char *temp;
- char *file_suffix = ((mode & X_OK) != 0 ? EXECUTABLE_SUFFIX : "");
- struct prefix_list *pl;
- int len = pprefix->max_len + strlen (name) + strlen (file_suffix) + 1;
-
- if (machine_suffix)
- len += strlen (machine_suffix);
-
- temp = xmalloc (len);
-
- /* Determine the filename to execute (special case for absolute paths). */
-
- if (*name == '/' || *name == DIR_SEPARATOR)
- {
- if (access (name, mode))
- {
- strcpy (temp, name);
- return temp;
- }
- }
- else
- for (pl = pprefix->plist; pl; pl = pl->next)
- {
- if (machine_suffix)
- {
- /* Some systems have a suffix for executable files.
- So try appending that first. */
- if (file_suffix[0] != 0)
- {
- strcpy (temp, pl->prefix);
- strcat (temp, machine_suffix);
- strcat (temp, name);
- strcat (temp, file_suffix);
- if (access (temp, mode) == 0)
- {
- if (pl->used_flag_ptr != 0)
- *pl->used_flag_ptr = 1;
- return temp;
- }
- }
-
- /* Now try just the name. */
- strcpy (temp, pl->prefix);
- strcat (temp, machine_suffix);
- strcat (temp, name);
- if (access (temp, mode) == 0)
- {
- if (pl->used_flag_ptr != 0)
- *pl->used_flag_ptr = 1;
- return temp;
- }
- }
-
- /* Certain prefixes are tried with just the machine type,
- not the version. This is used for finding as, ld, etc. */
- if (just_machine_suffix && pl->require_machine_suffix == 2)
- {
- /* Some systems have a suffix for executable files.
- So try appending that first. */
- if (file_suffix[0] != 0)
- {
- strcpy (temp, pl->prefix);
- strcat (temp, just_machine_suffix);
- strcat (temp, name);
- strcat (temp, file_suffix);
- if (access (temp, mode) == 0)
- {
- if (pl->used_flag_ptr != 0)
- *pl->used_flag_ptr = 1;
- return temp;
- }
- }
-
- strcpy (temp, pl->prefix);
- strcat (temp, just_machine_suffix);
- strcat (temp, name);
- if (access (temp, mode) == 0)
- {
- if (pl->used_flag_ptr != 0)
- *pl->used_flag_ptr = 1;
- return temp;
- }
- }
-
- /* Certain prefixes can't be used without the machine suffix
- when the machine or version is explicitly specified. */
- if (!pl->require_machine_suffix)
- {
- /* Some systems have a suffix for executable files.
- So try appending that first. */
- if (file_suffix[0] != 0)
- {
- strcpy (temp, pl->prefix);
- strcat (temp, name);
- strcat (temp, file_suffix);
- if (access (temp, mode) == 0)
- {
- if (pl->used_flag_ptr != 0)
- *pl->used_flag_ptr = 1;
- return temp;
- }
- }
-
- strcpy (temp, pl->prefix);
- strcat (temp, name);
- if (access (temp, mode) == 0)
- {
- if (pl->used_flag_ptr != 0)
- *pl->used_flag_ptr = 1;
- return temp;
- }
- }
- }
-
- free (temp);
- return 0;
-}
-
-/* Add an entry for PREFIX in PLIST. If FIRST is set, it goes
- at the start of the list, otherwise it goes at the end.
-
- If WARN is nonzero, we will warn if no file is found
- through this prefix. WARN should point to an int
- which will be set to 1 if this entry is used.
-
- REQUIRE_MACHINE_SUFFIX is 1 if this prefix can't be used without
- the complete value of machine_suffix.
- 2 means try both machine_suffix and just_machine_suffix. */
-
-static void
-add_prefix (pprefix, prefix, first, require_machine_suffix, warn)
- struct path_prefix *pprefix;
- char *prefix;
- int first;
- int require_machine_suffix;
- int *warn;
-{
- struct prefix_list *pl, **prev;
- int len;
-
- if (!first && pprefix->plist)
- {
- for (pl = pprefix->plist; pl->next; pl = pl->next)
- ;
- prev = &pl->next;
- }
- else
- prev = &pprefix->plist;
-
- /* Keep track of the longest prefix */
-
- len = strlen (prefix);
- if (len > pprefix->max_len)
- pprefix->max_len = len;
-
- pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list));
- pl->prefix = save_string (prefix, len);
- pl->require_machine_suffix = require_machine_suffix;
- pl->used_flag_ptr = warn;
- if (warn)
- *warn = 0;
-
- if (*prev)
- pl->next = *prev;
- else
- pl->next = (struct prefix_list *) 0;
- *prev = pl;
-}
-
-/* Print warnings for any prefixes in the list PPREFIX that were not used. */
-
-static void
-unused_prefix_warnings (pprefix)
- struct path_prefix *pprefix;
-{
- struct prefix_list *pl = pprefix->plist;
-
- while (pl)
- {
- if (pl->used_flag_ptr != 0 && !*pl->used_flag_ptr)
- {
- if (pl->require_machine_suffix && machine_suffix)
- error ("file path prefix `%s%s' never used", pl->prefix,
- machine_suffix);
- else
- error ("file path prefix `%s' never used", pl->prefix);
-
- /* Prevent duplicate warnings. */
- *pl->used_flag_ptr = 1;
- }
- pl = pl->next;
- }
-}
-
-/* Get rid of all prefixes built up so far in *PLISTP. */
-
-static void
-free_path_prefix (pprefix)
- struct path_prefix *pprefix;
-{
- struct prefix_list *pl = pprefix->plist;
- struct prefix_list *temp;
-
- while (pl)
- {
- temp = pl;
- pl = pl->next;
- free (temp->prefix);
- free ((char *) temp);
- }
- pprefix->plist = (struct prefix_list *) 0;
-}
-
-/* Execute the command specified by the arguments on the current line of spec.
- When using pipes, this includes several piped-together commands
- with `|' between them.
-
- Return 0 if successful, -1 if failed. */
-
-static int
-execute ()
-{
- int i;
- int n_commands; /* # of command. */
- char *string;
- struct command
- {
- char *prog; /* program name. */
- char **argv; /* vector of args. */
- int pid; /* pid of process for this command. */
- };
-
- struct command *commands; /* each command buffer with above info. */
-
- /* Count # of piped commands. */
- for (n_commands = 1, i = 0; i < argbuf_index; i++)
- if (strcmp (argbuf[i], "|") == 0)
- n_commands++;
-
- /* Get storage for each command. */
- commands
- = (struct command *) alloca (n_commands * sizeof (struct command));
-
- /* Split argbuf into its separate piped processes,
- and record info about each one.
- Also search for the programs that are to be run. */
-
- commands[0].prog = argbuf[0]; /* first command. */
- commands[0].argv = &argbuf[0];
- string = find_a_file (&exec_prefixes, commands[0].prog, X_OK);
- if (string)
- commands[0].argv[0] = string;
-
- for (n_commands = 1, i = 0; i < argbuf_index; i++)
- if (strcmp (argbuf[i], "|") == 0)
- { /* each command. */
-#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN32__)) || defined (OS2)
- fatal ("-pipe not supported");
-#endif
- argbuf[i] = 0; /* termination of command args. */
- commands[n_commands].prog = argbuf[i + 1];
- commands[n_commands].argv = &argbuf[i + 1];
- string = find_a_file (&exec_prefixes, commands[n_commands].prog, X_OK);
- if (string)
- commands[n_commands].argv[0] = string;
- n_commands++;
- }
-
- argbuf[argbuf_index] = 0;
-
- /* If -v, print what we are about to do, and maybe query. */
-
- if (verbose_flag)
- {
- /* Print each piped command as a separate line. */
- for (i = 0; i < n_commands ; i++)
- {
- char **j;
-
- for (j = commands[i].argv; *j; j++)
- fprintf (stderr, " %s", *j);
-
- /* Print a pipe symbol after all but the last command. */
- if (i + 1 != n_commands)
- fprintf (stderr, " |");
- fprintf (stderr, "\n");
- }
- fflush (stderr);
-#ifdef DEBUG
- fprintf (stderr, "\nGo ahead? (y or n) ");
- fflush (stderr);
- i = getchar ();
- if (i != '\n')
- while (getchar () != '\n') ;
- if (i != 'y' && i != 'Y')
- return 0;
-#endif /* DEBUG */
- }
-
- /* Run each piped subprocess. */
-
- for (i = 0; i < n_commands; i++)
- {
- char *errmsg_fmt, *errmsg_arg;
- char *string = commands[i].argv[0];
-
- commands[i].pid = pexecute (string, commands[i].argv,
- programname, temp_filename,
- &errmsg_fmt, &errmsg_arg,
- ((i == 0 ? PEXECUTE_FIRST : 0)
- | (i + 1 == n_commands ? PEXECUTE_LAST : 0)
- | (string == commands[i].prog
- ? PEXECUTE_SEARCH : 0)
- | (verbose_flag ? PEXECUTE_VERBOSE : 0)));
-
- if (commands[i].pid == -1)
- pfatal_pexecute (errmsg_fmt, errmsg_arg);
-
- if (string != commands[i].prog)
- free (string);
- }
-
- execution_count++;
-
- /* Wait for all the subprocesses to finish.
- We don't care what order they finish in;
- we know that N_COMMANDS waits will get them all.
- Ignore subprocesses that we don't know about,
- since they can be spawned by the process that exec'ed us. */
-
- {
- int ret_code = 0;
-
- for (i = 0; i < n_commands; )
- {
- int j;
- int status;
- int pid;
-
- pid = pwait (commands[i].pid, &status, 0);
- if (pid < 0)
- abort ();
-
- for (j = 0; j < n_commands; j++)
- if (commands[j].pid == pid)
- {
- i++;
- if (status != 0)
- {
- if (WIFSIGNALED (status))
- {
- fatal ("Internal compiler error: program %s got fatal signal %d",
- commands[j].prog, WTERMSIG (status));
- signal_count++;
- ret_code = -1;
- }
- else if (WIFEXITED (status)
- && WEXITSTATUS (status) >= MIN_FATAL_STATUS)
- ret_code = -1;
- }
- break;
- }
- }
- return ret_code;
- }
-}
-
-/* Find all the switches given to us
- and make a vector describing them.
- The elements of the vector are strings, one per switch given.
- If a switch uses following arguments, then the `part1' field
- is the switch itself and the `args' field
- is a null-terminated vector containing the following arguments.
- The `live_cond' field is 1 if the switch is true in a conditional spec,
- -1 if false (overridden by a later switch), and is initialized to zero.
- The `valid' field is nonzero if any spec has looked at this switch;
- if it remains zero at the end of the run, it must be meaningless. */
-
-struct switchstr
-{
- char *part1;
- char **args;
- int live_cond;
- int valid;
-};
-
-static struct switchstr *switches;
-
-static int n_switches;
-
-struct infile
-{
- char *name;
- char *language;
-};
-
-/* Also a vector of input files specified. */
-
-static struct infile *infiles;
-
-static int n_infiles;
-
-/* And a vector of corresponding output files is made up later. */
-
-static char **outfiles;
-
-/* Used to track if none of the -B paths are used. */
-static int warn_B;
-
-/* Used to track if standard path isn't used and -b or -V is specified. */
-static int warn_std;
-
-/* Gives value to pass as "warn" to add_prefix for standard prefixes. */
-static int *warn_std_ptr = 0;
-
-
-#if defined(HAVE_OBJECT_SUFFIX) || defined(HAVE_EXECUTABLE_SUFFIX)
-
-/* Convert NAME to a new name if it is the standard suffix. DO_EXE
- is true if we should look for an executable suffix as well. */
-
-static char *
-convert_filename (name, do_exe)
- char *name;
- int do_exe;
-{
- int i;
- int len = strlen (name);
-
-#ifdef HAVE_OBJECT_SUFFIX
- /* Convert x.o to x.obj if OBJECT_SUFFIX is ".obj". */
- if (len > 2
- && name[len - 2] == '.'
- && name[len - 1] == 'o')
- {
- obstack_grow (&obstack, name[i], len - 2);
- obstack_grow0 (&obstack, OBJECT_SUFFIX, strlen (OBJECT_SUFFIX));
- name = obstack_finish (&obstack);
- }
-#endif
-
-#ifdef HAVE_EXECUTABLE_SUFFIX
- /* If there is no filetype, make it the executable suffix (which includes
- the "."). But don't get confused if we have just "-o". */
- if (! do_exe || EXECUTABLE_SUFFIX[0] == 0 || (len == 2 && name[0] == '-'))
- return name;
-
- for (i = len - 1; i >= 0; i--)
- if (name[i] == '/' || name[i] == DIR_SEPARATOR)
- break;
-
- for (i++; i < len; i++)
- if (name[i] == '.')
- return name;
-
- obstack_grow (&obstack, name, len);
- obstack_grow0 (&obstack, EXECUTABLE_SUFFIX, strlen (EXECUTABLE_SUFFIX));
- name = obstack_finish (&obstack);
-#endif
-
- return name;
-}
-#endif
-
-/* Create the vector `switches' and its contents.
- Store its length in `n_switches'. */
-
-static void
-process_command (argc, argv)
- int argc;
- char **argv;
-{
- register int i;
- char *temp;
- char *spec_lang = 0;
- int last_language_n_infiles;
- int have_c = 0;
- int have_o = 0;
- int lang_n_infiles = 0;
-
- gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX");
-
- n_switches = 0;
- n_infiles = 0;
-
- /* Figure compiler version from version string. */
-
- compiler_version = save_string (version_string, strlen (version_string));
- for (temp = compiler_version; *temp; ++temp)
- {
- if (*temp == ' ')
- {
- *temp = '\0';
- break;
- }
- }
-
- /* Set up the default search paths. */
-
- if (gcc_exec_prefix)
- {
- add_prefix (&exec_prefixes, gcc_exec_prefix, 0, 0, NULL_PTR);
- add_prefix (&startfile_prefixes, gcc_exec_prefix, 0, 0, NULL_PTR);
- }
-
- /* COMPILER_PATH and LIBRARY_PATH have values
- that are lists of directory names with colons. */
-
- temp = getenv ("COMPILER_PATH");
- if (temp)
- {
- char *startp, *endp;
- char *nstore = (char *) alloca (strlen (temp) + 3);
-
- startp = endp = temp;
- while (1)
- {
- if (*endp == PATH_SEPARATOR || *endp == 0)
- {
- strncpy (nstore, startp, endp-startp);
- if (endp == startp)
- strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
- else if (endp[-1] != '/' && endp[-1] != DIR_SEPARATOR)
- {
- nstore[endp-startp] = DIR_SEPARATOR;
- nstore[endp-startp+1] = 0;
- }
- else
- nstore[endp-startp] = 0;
- add_prefix (&exec_prefixes, nstore, 0, 0, NULL_PTR);
- if (*endp == 0)
- break;
- endp = startp = endp + 1;
- }
- else
- endp++;
- }
- }
-
- temp = getenv ("LIBRARY_PATH");
- if (temp && *cross_compile == '0')
- {
- char *startp, *endp;
- char *nstore = (char *) alloca (strlen (temp) + 3);
-
- startp = endp = temp;
- while (1)
- {
- if (*endp == PATH_SEPARATOR || *endp == 0)
- {
- strncpy (nstore, startp, endp-startp);
- if (endp == startp)
- strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
- else if (endp[-1] != '/' && endp[-1] != DIR_SEPARATOR)
- {
- nstore[endp-startp] = DIR_SEPARATOR;
- nstore[endp-startp+1] = 0;
- }
- else
- nstore[endp-startp] = 0;
- add_prefix (&startfile_prefixes, nstore, 0, 0, NULL_PTR);
- if (*endp == 0)
- break;
- endp = startp = endp + 1;
- }
- else
- endp++;
- }
- }
-
- /* Use LPATH like LIBRARY_PATH (for the CMU build program). */
- temp = getenv ("LPATH");
- if (temp && *cross_compile == '0')
- {
- char *startp, *endp;
- char *nstore = (char *) alloca (strlen (temp) + 3);
-
- startp = endp = temp;
- while (1)
- {
- if (*endp == PATH_SEPARATOR || *endp == 0)
- {
- strncpy (nstore, startp, endp-startp);
- if (endp == startp)
- strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
- else if (endp[-1] != '/' && endp[-1] != DIR_SEPARATOR)
- {
- nstore[endp-startp] = DIR_SEPARATOR;
- nstore[endp-startp+1] = 0;
- }
- else
- nstore[endp-startp] = 0;
- add_prefix (&startfile_prefixes, nstore, 0, 0, NULL_PTR);
- if (*endp == 0)
- break;
- endp = startp = endp + 1;
- }
- else
- endp++;
- }
- }
-
- /* Convert new-style -- options to old-style. */
- translate_options (&argc, &argv);
-
-#ifdef LANG_SPECIFIC_DRIVER
- /* Do language-specific adjustment/addition of flags. */
- lang_specific_driver (&fatal, &argc, &argv);
-#endif
-
- /* Scan argv twice. Here, the first time, just count how many switches
- there will be in their vector, and how many input files in theirs.
- Here we also parse the switches that cc itself uses (e.g. -v). */
-
- for (i = 1; i < argc; i++)
- {
- if (! strcmp (argv[i], "-dumpspecs"))
- {
- struct spec_list *sl;
- init_spec ();
- for (sl = specs; sl; sl = sl->next)
- printf ("*%s:\n%s\n\n", sl->name, *(sl->ptr_spec));
- exit (0);
- }
- else if (! strcmp (argv[i], "-dumpversion"))
- {
- printf ("%s\n", version_string);
- exit (0);
- }
- else if (! strcmp (argv[i], "-dumpmachine"))
- {
- printf ("%s\n", spec_machine);
- exit (0);
- }
- else if (! strcmp (argv[i], "-print-search-dirs"))
- print_search_dirs = 1;
- else if (! strcmp (argv[i], "-print-libgcc-file-name"))
- print_file_name = "libgcc.a";
- else if (! strncmp (argv[i], "-print-file-name=", 17))
- print_file_name = argv[i] + 17;
- else if (! strncmp (argv[i], "-print-prog-name=", 17))
- print_prog_name = argv[i] + 17;
- else if (! strcmp (argv[i], "-print-multi-lib"))
- print_multi_lib = 1;
- else if (! strcmp (argv[i], "-print-multi-directory"))
- print_multi_directory = 1;
- else if (! strncmp (argv[i], "-Wa,", 4))
- {
- int prev, j;
- /* Pass the rest of this option to the assembler. */
-
- n_assembler_options++;
- if (!assembler_options)
- assembler_options
- = (char **) xmalloc (n_assembler_options * sizeof (char **));
- else
- assembler_options
- = (char **) xrealloc (assembler_options,
- n_assembler_options * sizeof (char **));
-
- /* Split the argument at commas. */
- prev = 4;
- for (j = 4; argv[i][j]; j++)
- if (argv[i][j] == ',')
- {
- assembler_options[n_assembler_options - 1]
- = save_string (argv[i] + prev, j - prev);
- n_assembler_options++;
- assembler_options
- = (char **) xrealloc (assembler_options,
- n_assembler_options * sizeof (char **));
- prev = j + 1;
- }
- /* Record the part after the last comma. */
- assembler_options[n_assembler_options - 1] = argv[i] + prev;
- }
- else if (! strncmp (argv[i], "-Wp,", 4))
- {
- int prev, j;
- /* Pass the rest of this option to the preprocessor. */
-
- n_preprocessor_options++;
- if (!preprocessor_options)
- preprocessor_options
- = (char **) xmalloc (n_preprocessor_options * sizeof (char **));
- else
- preprocessor_options
- = (char **) xrealloc (preprocessor_options,
- n_preprocessor_options * sizeof (char **));
-
- /* Split the argument at commas. */
- prev = 4;
- for (j = 4; argv[i][j]; j++)
- if (argv[i][j] == ',')
- {
- preprocessor_options[n_preprocessor_options - 1]
- = save_string (argv[i] + prev, j - prev);
- n_preprocessor_options++;
- preprocessor_options
- = (char **) xrealloc (preprocessor_options,
- n_preprocessor_options * sizeof (char **));
- prev = j + 1;
- }
- /* Record the part after the last comma. */
- preprocessor_options[n_preprocessor_options - 1] = argv[i] + prev;
- }
- else if (argv[i][0] == '+' && argv[i][1] == 'e')
- /* The +e options to the C++ front-end. */
- n_switches++;
- else if (strncmp (argv[i], "-Wl,", 4) == 0)
- {
- int j;
- /* Split the argument at commas. */
- for (j = 3; argv[i][j]; j++)
- n_infiles += (argv[i][j] == ',');
- }
- else if (strcmp (argv[i], "-Xlinker") == 0)
- {
- if (i + 1 == argc)
- fatal ("argument to `-Xlinker' is missing");
-
- n_infiles++;
- i++;
- }
- else if (strncmp (argv[i], "-l", 2) == 0)
- n_infiles++;
- else if (strcmp (argv[i], "-save-temps") == 0)
- {
- save_temps_flag = 1;
- n_switches++;
- }
- else if (strcmp (argv[i], "-specs") == 0)
- {
- struct user_specs *user = (struct user_specs *)
- xmalloc (sizeof (struct user_specs));
- if (++i >= argc)
- fatal ("argument to `-specs' is missing");
-
- user->next = (struct user_specs *)0;
- user->filename = argv[i];
- if (user_specs_tail)
- user_specs_tail->next = user;
- else
- user_specs_head = user;
- user_specs_tail = user;
- }
- else if (strncmp (argv[i], "-specs=", 7) == 0)
- {
- struct user_specs *user = (struct user_specs *)
- xmalloc (sizeof (struct user_specs));
- if (strlen (argv[i]) == 7)
- fatal ("argument to `-specs=' is missing");
-
- user->next = (struct user_specs *)0;
- user->filename = argv[i]+7;
- if (user_specs_tail)
- user_specs_tail->next = user;
- else
- user_specs_head = user;
- user_specs_tail = user;
- }
- else if (argv[i][0] == '-' && argv[i][1] != 0)
- {
- register char *p = &argv[i][1];
- register int c = *p;
-
- switch (c)
- {
- case 'b':
- if (p[1] == 0 && i + 1 == argc)
- fatal ("argument to `-b' is missing");
- if (p[1] == 0)
- spec_machine = argv[++i];
- else
- spec_machine = p + 1;
-
- warn_std_ptr = &warn_std;
- break;
-
- case 'B':
- {
- int *temp = (int *) xmalloc (sizeof (int));
- char *value;
- if (p[1] == 0 && i + 1 == argc)
- fatal ("argument to `-B' is missing");
- if (p[1] == 0)
- value = argv[++i];
- else
- value = p + 1;
- add_prefix (&exec_prefixes, value, 1, 0, &warn_B);
- add_prefix (&startfile_prefixes, value, 1, 0, &warn_B);
- add_prefix (&include_prefixes, concat (value, "include", NULL_PTR),
- 1, 0, NULL_PTR);
-
- /* As a kludge, if the arg is "[foo/]stageN/", just add
- "[foo/]include" to the include prefix. */
- {
- int len = strlen (value);
- if ((len == 7
- || (len > 7
- && (value[len - 8] == '/'
- || value[len - 8] == DIR_SEPARATOR)))
- && strncmp (value + len - 7, "stage", 5) == 0
- && isdigit (value[len - 2])
- && (value[len - 1] == '/'
- || value[len - 1] == DIR_SEPARATOR))
- {
- if (len == 7)
- add_prefix (&include_prefixes, "include",
- 1, 0, NULL_PTR);
- else
- {
- char *string = xmalloc (len + 1);
- strncpy (string, value, len-7);
- strcpy (string+len-7, "include");
- add_prefix (&include_prefixes, string,
- 1, 0, NULL_PTR);
- }
- }
- }
- }
- break;
-
- case 'v': /* Print our subcommands and print versions. */
- n_switches++;
- /* If they do anything other than exactly `-v', don't set
- verbose_flag; rather, continue on to give the error. */
- if (p[1] != 0)
- break;
- verbose_flag++;
- break;
-
- case 'V':
- if (p[1] == 0 && i + 1 == argc)
- fatal ("argument to `-V' is missing");
- if (p[1] == 0)
- spec_version = argv[++i];
- else
- spec_version = p + 1;
- compiler_version = spec_version;
- warn_std_ptr = &warn_std;
- break;
-
- case 'c':
- if (p[1] == 0)
- {
- have_c = 1;
- n_switches++;
- break;
- }
- goto normal_switch;
-
- case 'o':
- have_o = 1;
-#if defined(HAVE_EXECUTABLE_SUFFIX) || defined(HAVE_OBJECT_SUFFIX)
- argv[i] = convert_filename (argv[i], 1);
- if (p[1] == 0)
- argv[i+1] = convert_filename (argv[i+1], 1);
-#endif
- goto normal_switch;
-
- default:
- normal_switch:
- n_switches++;
-
- if (SWITCH_TAKES_ARG (c) > (p[1] != 0))
- i += SWITCH_TAKES_ARG (c) - (p[1] != 0);
- else if (WORD_SWITCH_TAKES_ARG (p))
- i += WORD_SWITCH_TAKES_ARG (p);
- }
- }
- else
- {
- n_infiles++;
- lang_n_infiles++;
- }
- }
-
- if (have_c && have_o && lang_n_infiles > 1)
- fatal ("cannot specify -o with -c and multiple compilations");
-
- /* Set up the search paths before we go looking for config files. */
-
- /* These come before the md prefixes so that we will find gcc's subcommands
- (such as cpp) rather than those of the host system. */
- /* Use 2 as fourth arg meaning try just the machine as a suffix,
- as well as trying the machine and the version. */
-#ifndef OS2
- add_prefix (&exec_prefixes, standard_exec_prefix, 0, 2, warn_std_ptr);
- add_prefix (&exec_prefixes, standard_exec_prefix_1, 0, 2, warn_std_ptr);
-#endif
-
- add_prefix (&startfile_prefixes, standard_exec_prefix, 0, 1, warn_std_ptr);
- add_prefix (&startfile_prefixes, standard_exec_prefix_1, 0, 1, warn_std_ptr);
-
- tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
- dir_separator_str, NULL_PTR);
-
- /* If tooldir is relative, base it on exec_prefixes. A relative
- tooldir lets us move the installed tree as a unit.
-
- If GCC_EXEC_PREFIX is defined, then we want to add two relative
- directories, so that we can search both the user specified directory
- and the standard place. */
-
- if (*tooldir_prefix != '/' && *tooldir_prefix != DIR_SEPARATOR)
- {
- if (gcc_exec_prefix)
- {
- char *gcc_exec_tooldir_prefix
- = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
- spec_version, dir_separator_str, tooldir_prefix, NULL_PTR);
-
- add_prefix (&exec_prefixes,
- concat (gcc_exec_tooldir_prefix, "bin",
- dir_separator_str, NULL_PTR),
- 0, 0, NULL_PTR);
- add_prefix (&startfile_prefixes,
- concat (gcc_exec_tooldir_prefix, "lib",
- dir_separator_str, NULL_PTR),
- 0, 0, NULL_PTR);
- }
-
- tooldir_prefix = concat (standard_exec_prefix, spec_machine,
- dir_separator_str, spec_version,
- dir_separator_str, tooldir_prefix, NULL_PTR);
- }
-
- add_prefix (&exec_prefixes,
- concat (tooldir_prefix, "bin", dir_separator_str, NULL_PTR),
- 0, 0, NULL_PTR);
- add_prefix (&startfile_prefixes,
- concat (tooldir_prefix, "lib", dir_separator_str, NULL_PTR),
- 0, 0, NULL_PTR);
-
- /* More prefixes are enabled in main, after we read the specs file
- and determine whether this is cross-compilation or not. */
-
-
- /* Then create the space for the vectors and scan again. */
-
- switches = ((struct switchstr *)
- xmalloc ((n_switches + 1) * sizeof (struct switchstr)));
- infiles = (struct infile *) xmalloc ((n_infiles + 1) * sizeof (struct infile));
- n_switches = 0;
- n_infiles = 0;
- last_language_n_infiles = -1;
-
- /* This, time, copy the text of each switch and store a pointer
- to the copy in the vector of switches.
- Store all the infiles in their vector. */
-
- for (i = 1; i < argc; i++)
- {
- /* Just skip the switches that were handled by the preceding loop. */
- if (! strncmp (argv[i], "-Wa,", 4))
- ;
- else if (! strncmp (argv[i], "-Wp,", 4))
- ;
- else if (! strcmp (argv[i], "-print-search-dirs"))
- ;
- else if (! strcmp (argv[i], "-print-libgcc-file-name"))
- ;
- else if (! strncmp (argv[i], "-print-file-name=", 17))
- ;
- else if (! strncmp (argv[i], "-print-prog-name=", 17))
- ;
- else if (! strcmp (argv[i], "-print-multi-lib"))
- ;
- else if (! strcmp (argv[i], "-print-multi-directory"))
- ;
- else if (argv[i][0] == '+' && argv[i][1] == 'e')
- {
- /* Compensate for the +e options to the C++ front-end;
- they're there simply for cfront call-compatibility. We do
- some magic in default_compilers to pass them down properly.
- Note we deliberately start at the `+' here, to avoid passing
- -e0 or -e1 down into the linker. */
- switches[n_switches].part1 = &argv[i][0];
- switches[n_switches].args = 0;
- switches[n_switches].live_cond = 0;
- switches[n_switches].valid = 0;
- n_switches++;
- }
- else if (strncmp (argv[i], "-Wl,", 4) == 0)
- {
- int prev, j;
- /* Split the argument at commas. */
- prev = 4;
- for (j = 4; argv[i][j]; j++)
- if (argv[i][j] == ',')
- {
- infiles[n_infiles].language = 0;
- infiles[n_infiles++].name
- = save_string (argv[i] + prev, j - prev);
- prev = j + 1;
- }
- /* Record the part after the last comma. */
- infiles[n_infiles].language = 0;
- infiles[n_infiles++].name = argv[i] + prev;
- }
- else if (strcmp (argv[i], "-Xlinker") == 0)
- {
- infiles[n_infiles].language = 0;
- infiles[n_infiles++].name = argv[++i];
- }
- else if (strncmp (argv[i], "-l", 2) == 0)
- {
- infiles[n_infiles].language = 0;
- infiles[n_infiles++].name = argv[i];
- }
- else if (strcmp (argv[i], "-specs") == 0)
- i++;
- else if (strncmp (argv[i], "-specs=", 7) == 0)
- ;
- else if (argv[i][0] == '-' && argv[i][1] != 0)
- {
- register char *p = &argv[i][1];
- register int c = *p;
-
- if (c == 'B' || c == 'b' || c == 'V')
- {
- /* Skip a separate arg, if any. */
- if (p[1] == 0)
- i++;
- continue;
- }
- if (c == 'x')
- {
- if (p[1] == 0 && i + 1 == argc)
- fatal ("argument to `-x' is missing");
- if (p[1] == 0)
- spec_lang = argv[++i];
- else
- spec_lang = p + 1;
- if (! strcmp (spec_lang, "none"))
- /* Suppress the warning if -xnone comes after the last input
- file, because alternate command interfaces like g++ might
- find it useful to place -xnone after each input file. */
- spec_lang = 0;
- else
- last_language_n_infiles = n_infiles;
- continue;
- }
- switches[n_switches].part1 = p;
- /* Deal with option arguments in separate argv elements. */
- 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);
- switches[n_switches].args
- = (char **) xmalloc ((n_args + 1) * sizeof (char *));
- while (j < n_args)
- switches[n_switches].args[j++] = argv[++i];
- /* Null-terminate the vector. */
- switches[n_switches].args[j] = 0;
- }
- else if (index (switches_need_spaces, c))
- {
- /* On some systems, ld cannot handle some options without
- a space. So split the option from its argument. */
- char *part1 = (char *) xmalloc (2);
- part1[0] = c;
- part1[1] = '\0';
-
- switches[n_switches].part1 = part1;
- switches[n_switches].args = (char **) xmalloc (2 * sizeof (char *));
- switches[n_switches].args[0] = xmalloc (strlen (p));
- strcpy (switches[n_switches].args[0], &p[1]);
- switches[n_switches].args[1] = 0;
- }
- else
- switches[n_switches].args = 0;
-
- switches[n_switches].live_cond = 0;
- switches[n_switches].valid = 0;
- /* This is always valid, since gcc.c itself understands it. */
- if (!strcmp (p, "save-temps"))
- switches[n_switches].valid = 1;
- n_switches++;
- }
- else
- {
-#ifdef HAVE_OBJECT_SUFFIX
- argv[i] = convert_filename (argv[i], 0);
-#endif
-
- if (strcmp (argv[i], "-") != 0 && access (argv[i], R_OK) < 0)
- {
- perror_with_name (argv[i]);
- error_count++;
- }
- else
- {
- infiles[n_infiles].language = spec_lang;
- infiles[n_infiles++].name = argv[i];
- }
- }
- }
-
- if (n_infiles == last_language_n_infiles && spec_lang != 0)
- error ("Warning: `-x %s' after last input file has no effect", spec_lang);
-
- switches[n_switches].part1 = 0;
- infiles[n_infiles].name = 0;
-}
-
-/* Process a spec string, accumulating and running commands. */
-
-/* These variables describe the input file name.
- input_file_number is the index on outfiles of this file,
- so that the output file name can be stored for later use by %o.
- input_basename is the start of the part of the input file
- sans all directory names, and basename_length is the number
- of characters starting there excluding the suffix .c or whatever. */
-
-static char *input_filename;
-static int input_file_number;
-static int input_filename_length;
-static int basename_length;
-static char *input_basename;
-static char *input_suffix;
-
-/* These are variables used within do_spec and do_spec_1. */
-
-/* Nonzero if an arg has been started and not yet terminated
- (with space, tab or newline). */
-static int arg_going;
-
-/* Nonzero means %d or %g has been seen; the next arg to be terminated
- is a temporary file name. */
-static int delete_this_arg;
-
-/* Nonzero means %w has been seen; the next arg to be terminated
- is the output file name of this compilation. */
-static int this_is_output_file;
-
-/* 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. */
-static int this_is_library_file;
-
-/* Nonzero means that the input of this command is coming from a pipe. */
-static int input_from_pipe;
-
-/* Process the spec SPEC and run the commands specified therein.
- Returns 0 if the spec is successfully processed; -1 if failed. */
-
-static int
-do_spec (spec)
- char *spec;
-{
- int value;
-
- clear_args ();
- arg_going = 0;
- delete_this_arg = 0;
- this_is_output_file = 0;
- this_is_library_file = 0;
- input_from_pipe = 0;
-
- value = do_spec_1 (spec, 0, NULL_PTR);
-
- /* Force out any unfinished command.
- If -pipe, this forces out the last command if it ended in `|'. */
- if (value == 0)
- {
- if (argbuf_index > 0 && !strcmp (argbuf[argbuf_index - 1], "|"))
- argbuf_index--;
-
- if (argbuf_index > 0)
- value = execute ();
- }
-
- return value;
-}
-
-/* Process the sub-spec SPEC as a portion of a larger spec.
- This is like processing a whole spec except that we do
- not initialize at the beginning and we do not supply a
- newline by default at the end.
- INSWITCH nonzero means don't process %-sequences in SPEC;
- in this case, % is treated as an ordinary character.
- This is used while substituting switches.
- INSWITCH nonzero also causes SPC not to terminate an argument.
-
- Value is zero unless a line was finished
- and the command on that line reported an error. */
-
-static int
-do_spec_1 (spec, inswitch, soft_matched_part)
- char *spec;
- int inswitch;
- char *soft_matched_part;
-{
- register char *p = spec;
- register int c;
- int i;
- char *string;
- int value;
-
- while (c = *p++)
- /* If substituting a switch, treat all chars like letters.
- Otherwise, NL, SPC, TAB and % are special. */
- switch (inswitch ? 'a' : c)
- {
- case '\n':
- /* End of line: finish any pending argument,
- then run the pending command if one has been started. */
- if (arg_going)
- {
- obstack_1grow (&obstack, 0);
- string = obstack_finish (&obstack);
- if (this_is_library_file)
- string = find_file (string);
- store_arg (string, delete_this_arg, this_is_output_file);
- if (this_is_output_file)
- outfiles[input_file_number] = string;
- }
- arg_going = 0;
-
- if (argbuf_index > 0 && !strcmp (argbuf[argbuf_index - 1], "|"))
- {
- for (i = 0; i < n_switches; i++)
- if (!strcmp (switches[i].part1, "pipe"))
- break;
-
- /* A `|' before the newline means use a pipe here,
- but only if -pipe was specified.
- Otherwise, execute now and don't pass the `|' as an arg. */
- if (i < n_switches)
- {
- input_from_pipe = 1;
- switches[i].valid = 1;
- break;
- }
- else
- argbuf_index--;
- }
-
- if (argbuf_index > 0)
- {
- value = execute ();
- if (value)
- return value;
- }
- /* Reinitialize for a new command, and for a new argument. */
- clear_args ();
- arg_going = 0;
- delete_this_arg = 0;
- this_is_output_file = 0;
- this_is_library_file = 0;
- input_from_pipe = 0;
- break;
-
- case '|':
- /* End any pending argument. */
- if (arg_going)
- {
- obstack_1grow (&obstack, 0);
- string = obstack_finish (&obstack);
- if (this_is_library_file)
- string = find_file (string);
- store_arg (string, delete_this_arg, this_is_output_file);
- if (this_is_output_file)
- outfiles[input_file_number] = string;
- }
-
- /* Use pipe */
- obstack_1grow (&obstack, c);
- arg_going = 1;
- break;
-
- case '\t':
- case ' ':
- /* Space or tab ends an argument if one is pending. */
- if (arg_going)
- {
- obstack_1grow (&obstack, 0);
- string = obstack_finish (&obstack);
- if (this_is_library_file)
- string = find_file (string);
- store_arg (string, delete_this_arg, this_is_output_file);
- if (this_is_output_file)
- outfiles[input_file_number] = string;
- }
- /* Reinitialize for a new argument. */
- arg_going = 0;
- delete_this_arg = 0;
- this_is_output_file = 0;
- this_is_library_file = 0;
- break;
-
- case '%':
- switch (c = *p++)
- {
- case 0:
- fatal ("Invalid specification! Bug in cc.");
-
- case 'b':
- obstack_grow (&obstack, input_basename, basename_length);
- arg_going = 1;
- break;
-
- case 'd':
- delete_this_arg = 2;
- break;
-
- /* Dump out the directories specified with LIBRARY_PATH,
- followed by the absolute directories
- that we search for startfiles. */
- case 'D':
- {
- struct prefix_list *pl = startfile_prefixes.plist;
- int bufsize = 100;
- char *buffer = (char *) xmalloc (bufsize);
- int idx;
-
- for (; pl; pl = pl->next)
- {
-#ifdef RELATIVE_PREFIX_NOT_LINKDIR
- /* Used on systems which record the specified -L dirs
- and use them to search for dynamic linking. */
- /* Relative directories always come from -B,
- and it is better not to use them for searching
- at run time. In particular, stage1 loses */
- if (pl->prefix[0] != '/' && pl->prefix[0] != DIR_SEPARATOR)
- continue;
-#endif
- /* Try subdirectory if there is one. */
- if (multilib_dir != NULL)
- {
- if (machine_suffix)
- {
- if (strlen (pl->prefix) + strlen (machine_suffix)
- >= bufsize)
- bufsize = (strlen (pl->prefix)
- + strlen (machine_suffix)) * 2 + 1;
- buffer = (char *) xrealloc (buffer, bufsize);
- strcpy (buffer, pl->prefix);
- strcat (buffer, machine_suffix);
- if (is_directory (buffer, multilib_dir, 1))
- {
- do_spec_1 ("-L", 0, NULL_PTR);
-#ifdef SPACE_AFTER_L_OPTION
- do_spec_1 (" ", 0, NULL_PTR);
-#endif
- do_spec_1 (buffer, 1, NULL_PTR);
- do_spec_1 (multilib_dir, 1, NULL_PTR);
- /* Make this a separate argument. */
- do_spec_1 (" ", 0, NULL_PTR);
- }
- }
- if (!pl->require_machine_suffix)
- {
- if (is_directory (pl->prefix, multilib_dir, 1))
- {
- do_spec_1 ("-L", 0, NULL_PTR);
-#ifdef SPACE_AFTER_L_OPTION
- do_spec_1 (" ", 0, NULL_PTR);
-#endif
- do_spec_1 (pl->prefix, 1, NULL_PTR);
- do_spec_1 (multilib_dir, 1, NULL_PTR);
- /* Make this a separate argument. */
- do_spec_1 (" ", 0, NULL_PTR);
- }
- }
- }
- if (machine_suffix)
- {
- if (is_directory (pl->prefix, machine_suffix, 1))
- {
- do_spec_1 ("-L", 0, NULL_PTR);
-#ifdef SPACE_AFTER_L_OPTION
- do_spec_1 (" ", 0, NULL_PTR);
-#endif
- do_spec_1 (pl->prefix, 1, NULL_PTR);
- /* Remove slash from machine_suffix. */
- if (strlen (machine_suffix) >= bufsize)
- bufsize = strlen (machine_suffix) * 2 + 1;
- buffer = (char *) xrealloc (buffer, bufsize);
- strcpy (buffer, machine_suffix);
- idx = strlen (buffer);
- if (buffer[idx - 1] == '/'
- || buffer[idx - 1] == DIR_SEPARATOR)
- buffer[idx - 1] = 0;
- do_spec_1 (buffer, 1, NULL_PTR);
- /* Make this a separate argument. */
- do_spec_1 (" ", 0, NULL_PTR);
- }
- }
- if (!pl->require_machine_suffix)
- {
- if (is_directory (pl->prefix, "", 1))
- {
- do_spec_1 ("-L", 0, NULL_PTR);
-#ifdef SPACE_AFTER_L_OPTION
- do_spec_1 (" ", 0, NULL_PTR);
-#endif
- /* Remove slash from pl->prefix. */
- if (strlen (pl->prefix) >= bufsize)
- bufsize = strlen (pl->prefix) * 2 + 1;
- buffer = (char *) xrealloc (buffer, bufsize);
- strcpy (buffer, pl->prefix);
- idx = strlen (buffer);
- if (buffer[idx - 1] == '/'
- || buffer[idx - 1] == DIR_SEPARATOR)
- buffer[idx - 1] = 0;
- do_spec_1 (buffer, 1, NULL_PTR);
- /* Make this a separate argument. */
- do_spec_1 (" ", 0, NULL_PTR);
- }
- }
- }
- free (buffer);
- }
- break;
-
- case 'e':
- /* {...:%efoo} means report an error with `foo' as error message
- and don't execute any more commands for this file. */
- {
- char *q = p;
- char *buf;
- while (*p != 0 && *p != '\n') p++;
- buf = (char *) alloca (p - q + 1);
- strncpy (buf, q, p - q);
- buf[p - q] = 0;
- error ("%s", buf);
- return -1;
- }
- break;
-
- case 'g':
- case 'u':
- case 'U':
- if (save_temps_flag)
- {
- obstack_grow (&obstack, input_basename, basename_length);
- delete_this_arg = 0;
- }
- else
- {
-#ifdef MKTEMP_EACH_FILE
- /* ??? This has a problem: the total number of
- values mktemp can return is limited.
- That matters for the names of object files.
- In 2.4, do something about that. */
- struct temp_name *t;
- char *suffix = p;
- while (*p == '.' || isalpha (*p)
- || (p[0] == '%' && p[1] == 'O'))
- p++;
-
- /* See if we already have an association of %g/%u/%U and
- suffix. */
- for (t = temp_names; t; t = t->next)
- if (t->length == p - suffix
- && strncmp (t->suffix, suffix, p - suffix) == 0
- && t->unique == (c != 'g'))
- break;
-
- /* Make a new association if needed. %u requires one. */
- if (t == 0 || c == 'u')
- {
- if (t == 0)
- {
- t = (struct temp_name *) xmalloc (sizeof (struct temp_name));
- t->next = temp_names;
- temp_names = t;
- }
- t->length = p - suffix;
- t->suffix = save_string (suffix, p - suffix);
- t->unique = (c != 'g');
- temp_filename = choose_temp_base ();
- temp_filename_length = strlen (temp_filename);
- t->filename = temp_filename;
- t->filename_length = temp_filename_length;
- }
-
- obstack_grow (&obstack, t->filename, t->filename_length);
- delete_this_arg = 1;
-#else
- obstack_grow (&obstack, temp_filename, temp_filename_length);
- if (c == 'u' || c == 'U')
- {
- static int unique;
- char buff[9];
- if (c == 'u')
- unique++;
- sprintf (buff, "%d", unique);
- obstack_grow (&obstack, buff, strlen (buff));
- }
-#endif
- delete_this_arg = 1;
- }
- arg_going = 1;
- break;
-
- case 'i':
- obstack_grow (&obstack, input_filename, input_filename_length);
- arg_going = 1;
- break;
-
- case 'I':
- {
- struct prefix_list *pl = include_prefixes.plist;
-
- if (gcc_exec_prefix)
- {
- do_spec_1 ("-iprefix", 1, NULL_PTR);
- /* Make this a separate argument. */
- do_spec_1 (" ", 0, NULL_PTR);
- do_spec_1 (gcc_exec_prefix, 1, NULL_PTR);
- do_spec_1 (" ", 0, NULL_PTR);
- }
-
- for (; pl; pl = pl->next)
- {
- do_spec_1 ("-isystem", 1, NULL_PTR);
- /* Make this a separate argument. */
- do_spec_1 (" ", 0, NULL_PTR);
- do_spec_1 (pl->prefix, 1, NULL_PTR);
- do_spec_1 (" ", 0, NULL_PTR);
- }
- }
- break;
-
- case 'o':
- for (i = 0; i < n_infiles; i++)
- store_arg (outfiles[i], 0, 0);
- break;
-
- case 'O':
- obstack_grow (&obstack, OBJECT_SUFFIX, strlen (OBJECT_SUFFIX));
- arg_going = 1;
- break;
-
- case 's':
- this_is_library_file = 1;
- break;
-
- case 'w':
- this_is_output_file = 1;
- break;
-
- case 'W':
- {
- int cur_index = argbuf_index;
- /* Handle the {...} following the %W. */
- if (*p != '{')
- abort ();
- p = handle_braces (p + 1);
- if (p == 0)
- return -1;
- /* If any args were output, mark the last one for deletion
- on failure. */
- if (argbuf_index != cur_index)
- record_temp_file (argbuf[argbuf_index - 1], 0, 1);
- break;
- }
-
- /* %x{OPTION} records OPTION for %X to output. */
- case 'x':
- {
- char *p1 = p;
- char *string;
-
- /* Skip past the option value and make a copy. */
- if (*p != '{')
- abort ();
- while (*p++ != '}')
- ;
- string = save_string (p1 + 1, p - p1 - 2);
-
- /* See if we already recorded this option. */
- for (i = 0; i < n_linker_options; i++)
- if (! strcmp (string, linker_options[i]))
- {
- free (string);
- return 0;
- }
-
- /* This option is new; add it. */
- n_linker_options++;
- if (!linker_options)
- linker_options
- = (char **) xmalloc (n_linker_options * sizeof (char **));
- else
- linker_options
- = (char **) xrealloc (linker_options,
- n_linker_options * sizeof (char **));
-
- linker_options[n_linker_options - 1] = string;
- }
- break;
-
- /* Dump out the options accumulated previously using %x. */
- case 'X':
- for (i = 0; i < n_linker_options; i++)
- {
- do_spec_1 (linker_options[i], 1, NULL_PTR);
- /* Make each accumulated option a separate argument. */
- do_spec_1 (" ", 0, NULL_PTR);
- }
- break;
-
- /* Dump out the options accumulated previously using -Wa,. */
- case 'Y':
- for (i = 0; i < n_assembler_options; i++)
- {
- do_spec_1 (assembler_options[i], 1, NULL_PTR);
- /* Make each accumulated option a separate argument. */
- do_spec_1 (" ", 0, NULL_PTR);
- }
- break;
-
- /* Dump out the options accumulated previously using -Wp,. */
- case 'Z':
- for (i = 0; i < n_preprocessor_options; i++)
- {
- do_spec_1 (preprocessor_options[i], 1, NULL_PTR);
- /* Make each accumulated option a separate argument. */
- do_spec_1 (" ", 0, NULL_PTR);
- }
- break;
-
- /* Here are digits and numbers that just process
- a certain constant string as a spec. */
-
- case '1':
- value = do_spec_1 (cc1_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case '2':
- value = do_spec_1 (cc1plus_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case 'a':
- value = do_spec_1 (asm_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case 'A':
- value = do_spec_1 (asm_final_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case 'c':
- value = do_spec_1 (signed_char_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case 'C':
- value = do_spec_1 (cpp_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case 'E':
- value = do_spec_1 (endfile_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case 'l':
- value = do_spec_1 (link_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case 'L':
- value = do_spec_1 (lib_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case 'G':
- value = do_spec_1 (libgcc_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- case 'p':
- {
- char *x = (char *) alloca (strlen (cpp_predefines) + 1);
- char *buf = x;
- char *y;
-
- /* Copy all of the -D options in CPP_PREDEFINES into BUF. */
- y = cpp_predefines;
- while (*y != 0)
- {
- if (! strncmp (y, "-D", 2))
- /* Copy the whole option. */
- while (*y && *y != ' ' && *y != '\t')
- *x++ = *y++;
- else if (*y == ' ' || *y == '\t')
- /* Copy whitespace to the result. */
- *x++ = *y++;
- /* Don't copy other options. */
- else
- y++;
- }
-
- *x = 0;
-
- value = do_spec_1 (buf, 0, NULL_PTR);
- if (value != 0)
- return value;
- }
- break;
-
- case 'P':
- {
- char *x = (char *) alloca (strlen (cpp_predefines) * 4 + 1);
- char *buf = x;
- char *y;
-
- /* Copy all of CPP_PREDEFINES into BUF,
- but put __ after every -D and at the end of each arg. */
- y = cpp_predefines;
- while (*y != 0)
- {
- if (! strncmp (y, "-D", 2))
- {
- int flag = 0;
-
- *x++ = *y++;
- *x++ = *y++;
-
- if (*y != '_'
- || (*(y+1) != '_' && ! isupper (*(y+1))))
- {
- /* Stick __ at front of macro name. */
- *x++ = '_';
- *x++ = '_';
- /* Arrange to stick __ at the end as well. */
- flag = 1;
- }
-
- /* Copy the macro name. */
- while (*y && *y != '=' && *y != ' ' && *y != '\t')
- *x++ = *y++;
-
- if (flag)
- {
- *x++ = '_';
- *x++ = '_';
- }
-
- /* Copy the value given, if any. */
- while (*y && *y != ' ' && *y != '\t')
- *x++ = *y++;
- }
- else if (*y == ' ' || *y == '\t')
- /* Copy whitespace to the result. */
- *x++ = *y++;
- /* Don't copy -A options */
- else
- y++;
- }
- *x++ = ' ';
-
- /* Copy all of CPP_PREDEFINES into BUF,
- but put __ after every -D. */
- y = cpp_predefines;
- while (*y != 0)
- {
- if (! strncmp (y, "-D", 2))
- {
- y += 2;
-
- if (*y != '_'
- || (*(y+1) != '_' && ! isupper (*(y+1))))
- {
- /* Stick -D__ at front of macro name. */
- *x++ = '-';
- *x++ = 'D';
- *x++ = '_';
- *x++ = '_';
-
- /* Copy the macro name. */
- while (*y && *y != '=' && *y != ' ' && *y != '\t')
- *x++ = *y++;
-
- /* Copy the value given, if any. */
- while (*y && *y != ' ' && *y != '\t')
- *x++ = *y++;
- }
- else
- {
- /* Do not copy this macro - we have just done it before */
- while (*y && *y != ' ' && *y != '\t')
- y++;
- }
- }
- else if (*y == ' ' || *y == '\t')
- /* Copy whitespace to the result. */
- *x++ = *y++;
- /* Don't copy -A options */
- else
- y++;
- }
- *x++ = ' ';
-
- /* Copy all of the -A options in CPP_PREDEFINES into BUF. */
- y = cpp_predefines;
- while (*y != 0)
- {
- if (! strncmp (y, "-A", 2))
- /* Copy the whole option. */
- while (*y && *y != ' ' && *y != '\t')
- *x++ = *y++;
- else if (*y == ' ' || *y == '\t')
- /* Copy whitespace to the result. */
- *x++ = *y++;
- /* Don't copy other options. */
- else
- y++;
- }
-
- *x = 0;
-
- value = do_spec_1 (buf, 0, NULL_PTR);
- if (value != 0)
- return value;
- }
- break;
-
- case 'S':
- value = do_spec_1 (startfile_spec, 0, NULL_PTR);
- if (value != 0)
- return value;
- break;
-
- /* Here we define characters other than letters and digits. */
-
- case '{':
- p = handle_braces (p);
- if (p == 0)
- return -1;
- break;
-
- case '%':
- obstack_1grow (&obstack, '%');
- break;
-
- case '*':
- do_spec_1 (soft_matched_part, 1, NULL_PTR);
- do_spec_1 (" ", 0, NULL_PTR);
- break;
-
- /* Process a string found as the value of a spec given by name.
- This feature allows individual machine descriptions
- to add and use their own specs.
- %[...] modifies -D options the way %P does;
- %(...) uses the spec unmodified. */
- case '(':
- case '[':
- {
- char *name = p;
- struct spec_list *sl;
- int len;
-
- /* The string after the S/P is the name of a spec that is to be
- processed. */
- while (*p && *p != ')' && *p != ']')
- p++;
-
- /* See if it's in the list */
- for (len = p - name, sl = specs; sl; sl = sl->next)
- if (sl->name_len == len && !strncmp (sl->name, name, len))
- {
- name = *(sl->ptr_spec);
-#ifdef DEBUG_SPECS
- fprintf (stderr, "Processing spec %c%s%c, which is '%s'\n",
- c, sl->name, (c == '(') ? ')' : ']', name);
-#endif
- break;
- }
-
- if (sl)
- {
- if (c == '(')
- {
- value = do_spec_1 (name, 0, NULL_PTR);
- if (value != 0)
- return value;
- }
- else
- {
- char *x = (char *) alloca (strlen (name) * 2 + 1);
- char *buf = x;
- char *y = name;
-
- /* Copy all of NAME into BUF, but put __ after
- every -D and at the end of each arg, */
- while (1)
- {
- int flag;
-
- if (! strncmp (y, "-D", 2))
- {
- *x++ = '-';
- *x++ = 'D';
- *x++ = '_';
- *x++ = '_';
- y += 2;
- flag = 1;
- continue;
- }
- else if (flag && (*y == ' ' || *y == '\t' || *y == '='
- || *y == '}' || *y == 0))
- {
- *x++ = '_';
- *x++ = '_';
- flag = 0;
- }
- if (*y == 0)
- break;
- else
- *x++ = *y++;
- }
- *x = 0;
-
- value = do_spec_1 (buf, 0, NULL_PTR);
- if (value != 0)
- return value;
- }
- }
-
- /* Discard the closing paren or bracket. */
- if (*p)
- p++;
- }
- break;
-
- case 'v':
- {
- int c1 = *p++; /* Select first or second version number. */
- char *v = compiler_version;
- char *q;
-
- /* The format of the version string is
- ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? */
-
- /* Ignore leading non-digits. i.e. "foo-" in "foo-2.7.2". */
- while (! isdigit (*v))
- v++;
- if (v > compiler_version && v[-1] != '-')
- abort ();
-
- /* If desired, advance to second version number. */
- if (c1 == '2')
- {
- /* Set V after the first period. */
- while (isdigit (*v))
- v++;
- if (*v != '.')
- abort ();
- v++;
- }
-
- /* Set Q at the next period or at the end. */
- q = v;
- while (isdigit (*q))
- q++;
- if (*q != 0 && *q != ' ' && *q != '.' && *q != '-')
- abort ();
-
- /* Put that part into the command. */
- obstack_grow (&obstack, v, q - v);
- arg_going = 1;
- }
- break;
-
- case '|':
- if (input_from_pipe)
- do_spec_1 ("-", 0, NULL_PTR);
- break;
-
- default:
- abort ();
- }
- break;
-
- case '\\':
- /* Backslash: treat next character as ordinary. */
- c = *p++;
-
- /* fall through */
- default:
- /* Ordinary character: put it into the current argument. */
- obstack_1grow (&obstack, c);
- arg_going = 1;
- }
-
- return 0; /* End of string */
-}
-
-/* Return 0 if we call do_spec_1 and that returns -1. */
-
-static char *
-handle_braces (p)
- register char *p;
-{
- register char *q;
- char *filter;
- int pipe_p = 0;
- int negate = 0;
- int suffix = 0;
- int include_blanks = 1;
-
- if (*p == '^')
- /* A '^' after the open-brace means to not give blanks before args. */
- include_blanks = 0, ++p;
-
- if (*p == '|')
- /* A `|' after the open-brace means,
- if the test fails, output a single minus sign rather than nothing.
- This is used in %{|!pipe:...}. */
- pipe_p = 1, ++p;
-
- if (*p == '!')
- /* A `!' after the open-brace negates the condition:
- succeed if the specified switch is not present. */
- negate = 1, ++p;
-
- if (*p == '.')
- /* A `.' after the open-brace means test against the current suffix. */
- {
- if (pipe_p)
- abort ();
-
- suffix = 1;
- ++p;
- }
-
- filter = p;
- while (*p != ':' && *p != '}') p++;
- if (*p != '}')
- {
- register int count = 1;
- q = p + 1;
- while (count > 0)
- {
- if (*q == '{')
- count++;
- else if (*q == '}')
- count--;
- else if (*q == 0)
- abort ();
- q++;
- }
- }
- else
- q = p + 1;
-
- if (suffix)
- {
- int found = (input_suffix != 0
- && strlen (input_suffix) == p - filter
- && strncmp (input_suffix, filter, p - filter) == 0);
-
- if (p[0] == '}')
- abort ();
-
- if (negate != found
- && do_spec_1 (save_string (p + 1, q - p - 2), 0, NULL_PTR) < 0)
- return 0;
-
- return q;
- }
- else if (p[-1] == '*' && p[0] == '}')
- {
- /* Substitute all matching switches as separate args. */
- register int i;
- --p;
- for (i = 0; i < n_switches; i++)
- if (!strncmp (switches[i].part1, filter, p - filter)
- && check_live_switch (i, p - filter))
- give_switch (i, 0, include_blanks);
- }
- else
- {
- /* Test for presence of the specified switch. */
- register int i;
- int present = 0;
-
- /* If name specified ends in *, as in {x*:...},
- check for %* and handle that case. */
- if (p[-1] == '*' && !negate)
- {
- int substitution;
- char *r = p;
-
- /* First see whether we have %*. */
- substitution = 0;
- while (r < q)
- {
- if (*r == '%' && r[1] == '*')
- substitution = 1;
- r++;
- }
- /* If we do, handle that case. */
- if (substitution)
- {
- /* Substitute all matching switches as separate args.
- But do this by substituting for %*
- in the text that follows the colon. */
-
- unsigned hard_match_len = p - filter - 1;
- char *string = save_string (p + 1, q - p - 2);
-
- for (i = 0; i < n_switches; i++)
- if (!strncmp (switches[i].part1, filter, hard_match_len)
- && check_live_switch (i, -1))
- {
- do_spec_1 (string, 0, &switches[i].part1[hard_match_len]);
- /* Pass any arguments this switch has. */
- give_switch (i, 1, 1);
- }
-
- return q;
- }
- }
-
- /* If name specified ends in *, as in {x*:...},
- check for presence of any switch name starting with x. */
- if (p[-1] == '*')
- {
- for (i = 0; i < n_switches; i++)
- {
- unsigned hard_match_len = p - filter - 1;
-
- if (!strncmp (switches[i].part1, filter, hard_match_len)
- && check_live_switch (i, hard_match_len))
- {
- present = 1;
- }
- }
- }
- /* Otherwise, check for presence of exact name specified. */
- else
- {
- for (i = 0; i < n_switches; i++)
- {
- if (!strncmp (switches[i].part1, filter, p - filter)
- && switches[i].part1[p - filter] == 0
- && check_live_switch (i, -1))
- {
- present = 1;
- break;
- }
- }
- }
-
- /* If it is as desired (present for %{s...}, absent for %{-s...})
- then substitute either the switch or the specified
- conditional text. */
- if (present != negate)
- {
- if (*p == '}')
- {
- give_switch (i, 0, include_blanks);
- }
- else
- {
- if (do_spec_1 (save_string (p + 1, q - p - 2), 0, NULL_PTR) < 0)
- return 0;
- }
- }
- else if (pipe_p)
- {
- /* Here if a %{|...} conditional fails: output a minus sign,
- which means "standard output" or "standard input". */
- do_spec_1 ("-", 0, NULL_PTR);
- }
- }
-
- return q;
-}
-
-/* Return 0 iff switch number SWITCHNUM is obsoleted by a later switch
- on the command line. PREFIX_LENGTH is the length of XXX in an {XXX*}
- spec, or -1 if either exact match or %* is used.
-
- A -O switch is obsoleted by a later -O switch. A -f, -m, or -W switch
- whose value does not begin with "no-" is obsoleted by the same value
- with the "no-", similarly for a switch with the "no-" prefix. */
-
-static int
-check_live_switch (switchnum, prefix_length)
- int switchnum;
- int prefix_length;
-{
- char *name = switches[switchnum].part1;
- int i;
-
- /* In the common case of {<at-most-one-letter>*}, a negating
- switch would always match, so ignore that case. We will just
- send the conflicting switches to the compiler phase. */
- if (prefix_length >= 0 && prefix_length <= 1)
- return 1;
-
- /* If we already processed this switch and determined if it was
- live or not, return our past determination. */
- if (switches[switchnum].live_cond != 0)
- return switches[switchnum].live_cond > 0;
-
- /* Now search for duplicate in a manner that depends on the name. */
- switch (*name)
- {
- case 'O':
- for (i = switchnum + 1; i < n_switches; i++)
- if (switches[i].part1[0] == 'O')
- {
- switches[switchnum].valid = 1;
- switches[switchnum].live_cond = -1;
- return 0;
- }
- break;
-
- case 'W': case 'f': case 'm':
- if (! strncmp (name + 1, "no-", 3))
- {
- /* We have Xno-YYY, search for XYYY. */
- for (i = switchnum + 1; i < n_switches; i++)
- if (switches[i].part1[0] == name[0]
- && ! strcmp (&switches[i].part1[1], &name[4]))
- {
- switches[switchnum].valid = 1;
- switches[switchnum].live_cond = -1;
- return 0;
- }
- }
- else
- {
- /* We have XYYY, search for Xno-YYY. */
- for (i = switchnum + 1; i < n_switches; i++)
- if (switches[i].part1[0] == name[0]
- && switches[i].part1[1] == 'n'
- && switches[i].part1[2] == 'o'
- && switches[i].part1[3] == '-'
- && !strcmp (&switches[i].part1[4], &name[1]))
- {
- switches[switchnum].valid = 1;
- switches[switchnum].live_cond = -1;
- return 0;
- }
- }
- break;
- }
-
- /* Otherwise the switch is live. */
- switches[switchnum].live_cond = 1;
- return 1;
-}
-
-/* Pass a switch to the current accumulating command
- in the same form that we received it.
- SWITCHNUM identifies the switch; it is an index into
- the vector of switches gcc received, which is `switches'.
- This cannot fail since it never finishes a command line.
-
- If OMIT_FIRST_WORD is nonzero, then we omit .part1 of the argument.
-
- If INCLUDE_BLANKS is nonzero, then we include blanks before each argument
- of the switch. */
-
-static void
-give_switch (switchnum, omit_first_word, include_blanks)
- int switchnum;
- int omit_first_word;
- int include_blanks;
-{
- if (!omit_first_word)
- {
- do_spec_1 ("-", 0, NULL_PTR);
- do_spec_1 (switches[switchnum].part1, 1, NULL_PTR);
- }
-
- if (switches[switchnum].args != 0)
- {
- char **p;
- for (p = switches[switchnum].args; *p; p++)
- {
- if (include_blanks)
- do_spec_1 (" ", 0, NULL_PTR);
- do_spec_1 (*p, 1, NULL_PTR);
- }
- }
-
- do_spec_1 (" ", 0, NULL_PTR);
- switches[switchnum].valid = 1;
-}
-
-/* Search for a file named NAME trying various prefixes including the
- user's -B prefix and some standard ones.
- Return the absolute file name found. If nothing is found, return NAME. */
-
-static char *
-find_file (name)
- char *name;
-{
- char *newname;
-
- /* Try multilib_dir if it is defined. */
- if (multilib_dir != NULL)
- {
- char *try;
-
- try = (char *) alloca (strlen (multilib_dir) + strlen (name) + 2);
- strcpy (try, multilib_dir);
- strcat (try, dir_separator_str);
- strcat (try, name);
-
- newname = find_a_file (&startfile_prefixes, try, R_OK);
-
- /* If we don't find it in the multi library dir, then fall
- through and look for it in the normal places. */
- if (newname != NULL)
- return newname;
- }
-
- newname = find_a_file (&startfile_prefixes, name, R_OK);
- return newname ? newname : name;
-}
-
-/* Determine whether a directory exists. If LINKER, return 0 for
- certain fixed names not needed by the linker. If not LINKER, it is
- only important to return 0 if the host machine has a small ARG_MAX
- limit. */
-
-static int
-is_directory (path1, path2, linker)
- char *path1;
- char *path2;
- int linker;
-{
- int len1 = strlen (path1);
- int len2 = strlen (path2);
- char *path = (char *) alloca (3 + len1 + len2);
- char *cp;
- struct stat st;
-
-#ifndef SMALL_ARG_MAX
- if (! linker)
- return 1;
-#endif
-
- /* Construct the path from the two parts. Ensure the string ends with "/.".
- The resulting path will be a directory even if the given path is a
- symbolic link. */
- bcopy (path1, path, len1);
- bcopy (path2, path + len1, len2);
- cp = path + len1 + len2;
- if (cp[-1] != '/' && cp[-1] != DIR_SEPARATOR)
- *cp++ = DIR_SEPARATOR;
- *cp++ = '.';
- *cp = '\0';
-
- /* Exclude directories that the linker is known to search. */
- if (linker
- && ((cp - path == 6
- && strcmp (path, concat (dir_separator_str, "lib",
- dir_separator_str, ".", NULL_PTR)) == 0)
- || (cp - path == 10
- && strcmp (path, concat (dir_separator_str, "usr",
- dir_separator_str, "lib",
- dir_separator_str, ".", NULL_PTR)) == 0)))
- return 0;
-
- return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
-}
-
-/* On fatal signals, delete all the temporary files. */
-
-static void
-fatal_error (signum)
- int signum;
-{
- signal (signum, SIG_DFL);
- delete_failure_queue ();
- delete_temp_files ();
- /* Get the same signal again, this time not handled,
- so its normal effect occurs. */
- kill (getpid (), signum);
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- register int i;
- int j;
- int value;
- int linker_was_run = 0;
- char *explicit_link_files;
- char *specs_file;
- char *p;
- struct user_specs *uptr;
-
- p = argv[0] + strlen (argv[0]);
- while (p != argv[0] && p[-1] != '/' && p[-1] != DIR_SEPARATOR) --p;
- programname = p;
-
- if (signal (SIGINT, SIG_IGN) != SIG_IGN)
- signal (SIGINT, fatal_error);
-#ifdef SIGHUP
- if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
- signal (SIGHUP, fatal_error);
-#endif
- if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
- signal (SIGTERM, fatal_error);
-#ifdef SIGPIPE
- if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
- signal (SIGPIPE, fatal_error);
-#endif
-
- argbuf_length = 10;
- argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
-
- obstack_init (&obstack);
-
- /* Build multilib_select, et. al from the separate lines that make up each
- multilib selection. */
- {
- char **q = multilib_raw;
- int need_space;
-
- obstack_init (&multilib_obstack);
- while ((p = *q++) != (char *) 0)
- obstack_grow (&multilib_obstack, p, strlen (p));
-
- obstack_1grow (&multilib_obstack, 0);
- multilib_select = obstack_finish (&multilib_obstack);
-
- q = multilib_matches_raw;
- while ((p = *q++) != (char *) 0)
- obstack_grow (&multilib_obstack, p, strlen (p));
-
- obstack_1grow (&multilib_obstack, 0);
- multilib_matches = obstack_finish (&multilib_obstack);
-
- need_space = FALSE;
- for (i = 0;
- i < sizeof (multilib_defaults_raw) / sizeof (multilib_defaults_raw[0]);
- i++)
- {
- if (need_space)
- obstack_1grow (&multilib_obstack, ' ');
- obstack_grow (&multilib_obstack,
- multilib_defaults_raw[i],
- strlen (multilib_defaults_raw[i]));
- need_space = TRUE;
- }
-
- obstack_1grow (&multilib_obstack, 0);
- multilib_defaults = obstack_finish (&multilib_obstack);
- }
-
- /* Set up to remember the pathname of gcc and any options
- needed for collect. We use argv[0] instead of programname because
- we need the complete pathname. */
- obstack_init (&collect_obstack);
- obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=")-1);
- obstack_grow (&collect_obstack, argv[0], strlen (argv[0])+1);
- putenv (obstack_finish (&collect_obstack));
-
-#ifdef INIT_ENVIRONMENT
- /* Set up any other necessary machine specific environment variables. */
- putenv (INIT_ENVIRONMENT);
-#endif
-
- /* Choose directory for temp files. */
-
- temp_filename = choose_temp_base ();
- temp_filename_length = strlen (temp_filename);
-
- /* Make a table of what switches there are (switches, n_switches).
- Make a table of specified input files (infiles, n_infiles).
- Decode switches that are handled locally. */
-
- process_command (argc, argv);
-
- /* Initialize the vector of specs to just the default.
- This means one element containing 0s, as a terminator. */
-
- compilers = (struct compiler *) xmalloc (sizeof default_compilers);
- bcopy ((char *) default_compilers, (char *) compilers,
- sizeof default_compilers);
- n_compilers = n_default_compilers;
-
- /* Read specs from a file if there is one. */
-
- machine_suffix = concat (spec_machine, dir_separator_str,
- spec_version, dir_separator_str, NULL_PTR);
- just_machine_suffix = concat (spec_machine, dir_separator_str, NULL_PTR);
-
- specs_file = find_a_file (&startfile_prefixes, "specs", R_OK);
- /* Read the specs file unless it is a default one. */
- if (specs_file != 0 && strcmp (specs_file, "specs"))
- read_specs (specs_file, TRUE);
- else
- init_spec ();
-
- /* Process any user specified specs in the order given on the command
- line. */
- for (uptr = user_specs_head; uptr; uptr = uptr->next)
- {
- char *filename = find_a_file (&startfile_prefixes, uptr->filename, R_OK);
- read_specs (filename ? filename : uptr->filename, FALSE);
- }
-
- /* If not cross-compiling, look for startfiles in the standard places. */
- /* The fact that these are done here, after reading the specs file,
- means that it cannot be found in these directories.
- But that's okay. It should never be there anyway. */
- if (*cross_compile == '0')
- {
-#ifdef MD_EXEC_PREFIX
- add_prefix (&exec_prefixes, md_exec_prefix, 0, 0, NULL_PTR);
- add_prefix (&startfile_prefixes, md_exec_prefix, 0, 0, NULL_PTR);
-#endif
-
-#ifdef MD_STARTFILE_PREFIX
- add_prefix (&startfile_prefixes, md_startfile_prefix, 0, 0, NULL_PTR);
-#endif
-
-#ifdef MD_STARTFILE_PREFIX_1
- add_prefix (&startfile_prefixes, md_startfile_prefix_1, 0, 0, NULL_PTR);
-#endif
-
- /* If standard_startfile_prefix is relative, base it on
- standard_exec_prefix. This lets us move the installed tree
- as a unit. If GCC_EXEC_PREFIX is defined, base
- standard_startfile_prefix on that as well. */
- if (*standard_startfile_prefix == '/'
- || *standard_startfile_prefix == DIR_SEPARATOR)
- add_prefix (&startfile_prefixes, standard_startfile_prefix, 0, 0,
- NULL_PTR);
- else
- {
- if (gcc_exec_prefix)
- add_prefix (&startfile_prefixes,
- concat (gcc_exec_prefix, machine_suffix,
- standard_startfile_prefix, NULL_PTR),
- 0, 0, NULL_PTR);
- add_prefix (&startfile_prefixes,
- concat (standard_exec_prefix,
- machine_suffix,
- standard_startfile_prefix, NULL_PTR),
- 0, 0, NULL_PTR);
- }
-
- add_prefix (&startfile_prefixes, standard_startfile_prefix_1, 0, 0,
- NULL_PTR);
- add_prefix (&startfile_prefixes, standard_startfile_prefix_2, 0, 0,
- NULL_PTR);
-#if 0 /* Can cause surprises, and one can use -B./ instead. */
- add_prefix (&startfile_prefixes, "./", 0, 1, NULL_PTR);
-#endif
- }
- else
- {
- if (*standard_startfile_prefix != DIR_SEPARATOR && gcc_exec_prefix)
- add_prefix (&startfile_prefixes,
- concat (gcc_exec_prefix, machine_suffix,
- standard_startfile_prefix, NULL_PTR),
- 0, 0, NULL_PTR);
- }
-
- /* If we have a GCC_EXEC_PREFIX envvar, modify it for cpp's sake. */
- if (gcc_exec_prefix)
- {
- char * temp = (char *) xmalloc (strlen (gcc_exec_prefix)
- + strlen (spec_version)
- + strlen (spec_machine) + 3);
- strcpy (temp, gcc_exec_prefix);
- strcat (temp, spec_machine);
- strcat (temp, dir_separator_str);
- strcat (temp, spec_version);
- strcat (temp, dir_separator_str);
- gcc_exec_prefix = temp;
- }
-
- /* Now we have the specs.
- Set the `valid' bits for switches that match anything in any spec. */
-
- validate_all_switches ();
-
- /* Now that we have the switches and the specs, set
- the subdirectory based on the options. */
- set_multilib_dir ();
-
- /* Warn about any switches that no pass was interested in. */
-
- for (i = 0; i < n_switches; i++)
- if (! switches[i].valid)
- error ("unrecognized option `-%s'", switches[i].part1);
-
- /* Obey some of the options. */
-
- if (print_search_dirs)
- {
- printf ("install: %s%s\n", standard_exec_prefix, machine_suffix);
- printf ("programs: %s\n", build_search_list (&exec_prefixes, "", 0));
- printf ("libraries: %s\n", build_search_list (&startfile_prefixes, "", 0));
- exit (0);
- }
-
- if (print_file_name)
- {
- printf ("%s\n", find_file (print_file_name));
- exit (0);
- }
-
- if (print_prog_name)
- {
- char *newname = find_a_file (&exec_prefixes, print_prog_name, X_OK);
- printf ("%s\n", (newname ? newname : print_prog_name));
- exit (0);
- }
-
- if (print_multi_lib)
- {
- print_multilib_info ();
- exit (0);
- }
-
- if (print_multi_directory)
- {
- if (multilib_dir == NULL)
- printf (".\n");
- else
- printf ("%s\n", multilib_dir);
- exit (0);
- }
-
- if (verbose_flag)
- {
- if (! strcmp (version_string, compiler_version))
- fprintf (stderr, "gcc version %s\n", version_string);
- else
- fprintf (stderr, "gcc driver version %s executing gcc version %s\n",
- version_string, compiler_version);
-
- if (n_infiles == 0)
- exit (0);
- }
-
- if (n_infiles == 0)
- fatal ("No input files");
-
- /* Make a place to record the compiler output file names
- that correspond to the input files. */
-
- outfiles = (char **) xmalloc (n_infiles * sizeof (char *));
- bzero ((char *) outfiles, n_infiles * sizeof (char *));
-
- /* Record which files were specified explicitly as link input. */
-
- explicit_link_files = xmalloc (n_infiles);
- bzero (explicit_link_files, n_infiles);
-
- for (i = 0; i < n_infiles; i++)
- {
- register struct compiler *cp = 0;
- int this_file_error = 0;
-
- /* Tell do_spec what to substitute for %i. */
-
- input_filename = infiles[i].name;
- input_filename_length = strlen (input_filename);
- input_file_number = i;
-
- /* Use the same thing in %o, unless cp->spec says otherwise. */
-
- outfiles[i] = input_filename;
-
- /* Figure out which compiler from the file's suffix. */
-
- cp = lookup_compiler (infiles[i].name, input_filename_length,
- infiles[i].language);
-
- if (cp)
- {
- /* Ok, we found an applicable compiler. Run its spec. */
- /* First say how much of input_filename to substitute for %b */
- register char *p;
- int len;
-
- if (cp->spec[0][0] == '#')
- error ("%s: %s compiler not installed on this system",
- input_filename, &cp->spec[0][1]);
-
- input_basename = input_filename;
- for (p = input_filename; *p; p++)
- if (*p == '/' || *p == DIR_SEPARATOR)
- input_basename = p + 1;
-
- /* Find a suffix starting with the last period,
- and set basename_length to exclude that suffix. */
- basename_length = strlen (input_basename);
- p = input_basename + basename_length;
- while (p != input_basename && *p != '.') --p;
- if (*p == '.' && p != input_basename)
- {
- basename_length = p - input_basename;
- input_suffix = p + 1;
- }
- else
- input_suffix = "";
-
- len = 0;
- for (j = 0; j < sizeof cp->spec / sizeof cp->spec[0]; j++)
- if (cp->spec[j])
- len += strlen (cp->spec[j]);
-
- p = (char *) xmalloc (len + 1);
-
- len = 0;
- for (j = 0; j < sizeof cp->spec / sizeof cp->spec[0]; j++)
- if (cp->spec[j])
- {
- strcpy (p + len, cp->spec[j]);
- len += strlen (cp->spec[j]);
- }
-
- value = do_spec (p);
- free (p);
- if (value < 0)
- this_file_error = 1;
- }
-
- /* If this file's name does not contain a recognized suffix,
- record it as explicit linker input. */
-
- else
- explicit_link_files[i] = 1;
-
- /* Clear the delete-on-failure queue, deleting the files in it
- if this compilation failed. */
-
- if (this_file_error)
- {
- delete_failure_queue ();
- error_count++;
- }
- /* If this compilation succeeded, don't delete those files later. */
- clear_failure_queue ();
- }
-
- /* Run ld to link all the compiler output files. */
-
- if (error_count == 0)
- {
- int tmp = execution_count;
- int i;
- int first_time;
-
- /* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
- for collect. */
- putenv_from_prefixes (&exec_prefixes, "COMPILER_PATH=");
- putenv_from_prefixes (&startfile_prefixes, "LIBRARY_PATH=");
-
- /* Build COLLECT_GCC_OPTIONS to have all of the options specified to
- the compiler. */
- obstack_grow (&collect_obstack, "COLLECT_GCC_OPTIONS=",
- sizeof ("COLLECT_GCC_OPTIONS=")-1);
-
- first_time = TRUE;
- for (i = 0; i < n_switches; i++)
- {
- char **args;
- if (!first_time)
- obstack_grow (&collect_obstack, " ", 1);
-
- first_time = FALSE;
- obstack_grow (&collect_obstack, "-", 1);
- obstack_grow (&collect_obstack, switches[i].part1,
- strlen (switches[i].part1));
-
- for (args = switches[i].args; args && *args; args++)
- {
- obstack_grow (&collect_obstack, " ", 1);
- obstack_grow (&collect_obstack, *args, strlen (*args));
- }
- }
- obstack_grow (&collect_obstack, "\0", 1);
- putenv (obstack_finish (&collect_obstack));
-
- value = do_spec (link_command_spec);
- if (value < 0)
- error_count = 1;
- linker_was_run = (tmp != execution_count);
- }
-
- /* Warn if a -B option was specified but the prefix was never used. */
- unused_prefix_warnings (&exec_prefixes);
- unused_prefix_warnings (&startfile_prefixes);
-
- /* If options said don't run linker,
- complain about input files to be given to the linker. */
-
- if (! linker_was_run && error_count == 0)
- for (i = 0; i < n_infiles; i++)
- if (explicit_link_files[i])
- error ("%s: linker input file unused since linking not done",
- outfiles[i]);
-
- /* Delete some or all of the temporary files we made. */
-
- if (error_count)
- delete_failure_queue ();
- delete_temp_files ();
-
- exit (error_count > 0 ? (signal_count ? 2 : 1) : 0);
- /* NOTREACHED */
- return 0;
-}
-
-/* Find the proper compilation spec for the file name NAME,
- whose length is LENGTH. LANGUAGE is the specified language,
- or 0 if none specified. */
-
-static struct compiler *
-lookup_compiler (name, length, language)
- char *name;
- int length;
- char *language;
-{
- struct compiler *cp;
-
- /* Look for the language, if one is spec'd. */
- if (language != 0)
- {
- for (cp = compilers + n_compilers - 1; cp >= compilers; cp--)
- {
- if (language != 0)
- {
- if (cp->suffix[0] == '@'
- && !strcmp (cp->suffix + 1, language))
- return cp;
- }
- }
- error ("language %s not recognized", language);
- }
-
- /* Look for a suffix. */
- for (cp = compilers + n_compilers - 1; cp >= compilers; cp--)
- {
- if (/* The suffix `-' matches only the file name `-'. */
- (!strcmp (cp->suffix, "-") && !strcmp (name, "-"))
- ||
- (strlen (cp->suffix) < length
- /* See if the suffix matches the end of NAME. */
-#ifdef OS2
- && (!strcmp (cp->suffix,
- name + length - strlen (cp->suffix))
- || !strpbrk (cp->suffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
- && !strcasecmp (cp->suffix,
- name + length - strlen (cp->suffix)))))
-#else
- && !strcmp (cp->suffix,
- name + length - strlen (cp->suffix))))
-#endif
- {
- if (cp->spec[0][0] == '@')
- {
- struct compiler *new;
- /* An alias entry maps a suffix to a language.
- Search for the language; pass 0 for NAME and LENGTH
- to avoid infinite recursion if language not found.
- Construct the new compiler spec. */
- language = cp->spec[0] + 1;
- new = (struct compiler *) xmalloc (sizeof (struct compiler));
- new->suffix = cp->suffix;
- bcopy ((char *) lookup_compiler (NULL_PTR, 0, language)->spec,
- (char *) new->spec, sizeof new->spec);
- return new;
- }
- /* A non-alias entry: return it. */
- return cp;
- }
- }
-
- return 0;
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *value = (char *) malloc (size);
- if (value == 0)
- fatal ("virtual memory exhausted");
- return value;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- register char *value = (char *) realloc (ptr, size);
- if (value == 0)
- fatal ("virtual memory exhausted");
- return value;
-}
-
-/* This function is based on the one in libiberty. */
-
-static char *
-concat VPROTO((char *first, ...))
-{
- register int length;
- register char *newstr;
- register char *end;
- register char *arg;
- va_list args;
-#ifndef __STDC__
- char *first;
-#endif
-
- /* First compute the size of the result and get sufficient memory. */
-
- VA_START (args, first);
-#ifndef __STDC__
- first = va_arg (args, char *);
-#endif
-
- arg = first;
- length = 0;
-
- while (arg != 0)
- {
- length += strlen (arg);
- arg = va_arg (args, char *);
- }
-
- newstr = (char *) xmalloc (length + 1);
- va_end (args);
-
- /* Now copy the individual pieces to the result string. */
-
- VA_START (args, first);
-#ifndef __STDC__
- first = va_arg (args, char *);
-#endif
-
- end = newstr;
- arg = first;
- while (arg != 0)
- {
- while (*arg)
- *end++ = *arg++;
- arg = va_arg (args, char *);
- }
- *end = '\000';
- va_end (args);
-
- return (newstr);
-}
-
-static char *
-save_string (s, len)
- char *s;
- int len;
-{
- register char *result = xmalloc (len + 1);
-
- bcopy (s, result, len);
- result[len] = 0;
- return result;
-}
-
-static void
-pfatal_with_name (name)
- char *name;
-{
- fatal ("%s: %s", name, my_strerror (errno));
-}
-
-static void
-perror_with_name (name)
- char *name;
-{
- error ("%s: %s", name, my_strerror (errno));
-}
-
-static void
-pfatal_pexecute (errmsg_fmt, errmsg_arg)
- char *errmsg_fmt;
- char *errmsg_arg;
-{
- if (errmsg_arg)
- {
- /* Space for trailing '\0' is in %s. */
- char *msg = xmalloc (strlen (errmsg_fmt) + strlen (errmsg_arg));
- sprintf (msg, errmsg_fmt, errmsg_arg);
- errmsg_fmt = msg;
- }
-
- fatal ("%s: %s", errmsg_fmt, my_strerror (errno));
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-#ifdef HAVE_VPRINTF
-
-/* Output an error message and exit */
-
-static void
-fatal VPROTO((char *format, ...))
-{
-#ifndef __STDC__
- char *format;
-#endif
- va_list ap;
-
- VA_START (ap, format);
-
-#ifndef __STDC__
- format = va_arg (ap, char *);
-#endif
-
- fprintf (stderr, "%s: ", programname);
- vfprintf (stderr, format, ap);
- va_end (ap);
- fprintf (stderr, "\n");
- delete_temp_files ();
- exit (1);
-}
-
-static void
-error VPROTO((char *format, ...))
-{
-#ifndef __STDC__
- char *format;
-#endif
- va_list ap;
-
- VA_START (ap, format);
-
-#ifndef __STDC__
- format = va_arg (ap, char *);
-#endif
-
- fprintf (stderr, "%s: ", programname);
- vfprintf (stderr, format, ap);
- va_end (ap);
-
- fprintf (stderr, "\n");
-}
-
-#else /* not HAVE_VPRINTF */
-
-static void
-fatal (msg, arg1, arg2)
- char *msg, *arg1, *arg2;
-{
- error (msg, arg1, arg2);
- delete_temp_files ();
- exit (1);
-}
-
-static void
-error (msg, arg1, arg2)
- char *msg, *arg1, *arg2;
-{
- fprintf (stderr, "%s: ", programname);
- fprintf (stderr, msg, arg1, arg2);
- fprintf (stderr, "\n");
-}
-
-#endif /* not HAVE_VPRINTF */
-
-
-static void
-validate_all_switches ()
-{
- struct compiler *comp;
- register char *p;
- register char c;
- struct spec_list *spec;
-
- for (comp = compilers; comp->spec[0]; comp++)
- {
- int i;
- for (i = 0; i < sizeof comp->spec / sizeof comp->spec[0] && comp->spec[i]; i++)
- {
- p = comp->spec[i];
- while (c = *p++)
- if (c == '%' && *p == '{')
- /* We have a switch spec. */
- validate_switches (p + 1);
- }
- }
-
- /* look through the linked list of specs read from the specs file */
- for (spec = specs; spec ; spec = spec->next)
- {
- p = *(spec->ptr_spec);
- while (c = *p++)
- if (c == '%' && *p == '{')
- /* We have a switch spec. */
- validate_switches (p + 1);
- }
-
- p = link_command_spec;
- while (c = *p++)
- if (c == '%' && *p == '{')
- /* We have a switch spec. */
- validate_switches (p + 1);
-}
-
-/* Look at the switch-name that comes after START
- and mark as valid all supplied switches that match it. */
-
-static void
-validate_switches (start)
- char *start;
-{
- register char *p = start;
- char *filter;
- register int i;
- int suffix = 0;
-
- if (*p == '|')
- ++p;
-
- if (*p == '!')
- ++p;
-
- if (*p == '.')
- suffix = 1, ++p;
-
- filter = p;
- while (*p != ':' && *p != '}') p++;
-
- if (suffix)
- ;
- else if (p[-1] == '*')
- {
- /* Mark all matching switches as valid. */
- --p;
- for (i = 0; i < n_switches; i++)
- if (!strncmp (switches[i].part1, filter, p - filter))
- switches[i].valid = 1;
- }
- else
- {
- /* Mark an exact matching switch as valid. */
- for (i = 0; i < n_switches; i++)
- {
- if (!strncmp (switches[i].part1, filter, p - filter)
- && switches[i].part1[p - filter] == 0)
- switches[i].valid = 1;
- }
- }
-}
-
-/* Check whether a particular argument was used. The first time we
- canonialize the switches to keep only the ones we care about. */
-
-static int
-used_arg (p, len)
- char *p;
- int len;
-{
- struct mswitchstr {
- char *str;
- char *replace;
- int len;
- int rep_len;
- };
-
- static struct mswitchstr *mswitches;
- static int n_mswitches;
- int i, j;
-
- if (!mswitches)
- {
- struct mswitchstr *matches;
- char *q;
- int cnt = 0;
-
- /* Break multilib_matches into the component strings of string and replacement
- string */
- for (q = multilib_matches; *q != '\0'; q++)
- if (*q == ';')
- cnt++;
-
- matches = (struct mswitchstr *) alloca ((sizeof (struct mswitchstr)) * cnt);
- i = 0;
- q = multilib_matches;
- while (*q != '\0')
- {
- matches[i].str = q;
- while (*q != ' ')
- {
- if (*q == '\0')
- abort ();
- q++;
- }
- *q = '\0';
- matches[i].len = q - matches[i].str;
-
- matches[i].replace = ++q;
- while (*q != ';' && *q != '\0')
- {
- if (*q == ' ')
- abort ();
- q++;
- }
- matches[i].rep_len = q - matches[i].replace;
- i++;
- if (*q == ';')
- *q++ = '\0';
- else
- break;
- }
-
- /* Now build a list of the replacement string for switches that we care
- about. Make sure we allocate at least one entry. This prevents
- xmalloc from calling fatal, and prevents us from re-executing this
- block of code. */
- mswitches
- = (struct mswitchstr *) xmalloc ((sizeof (struct mswitchstr))
- * (n_switches ? n_switches : 1));
- for (i = 0; i < n_switches; i++)
- {
- int xlen = strlen (switches[i].part1);
- for (j = 0; j < cnt; j++)
- if (xlen == matches[j].len && ! strcmp (switches[i].part1, matches[j].str))
- {
- mswitches[n_mswitches].str = matches[j].replace;
- mswitches[n_mswitches].len = matches[j].rep_len;
- mswitches[n_mswitches].replace = (char *)0;
- mswitches[n_mswitches].rep_len = 0;
- n_mswitches++;
- break;
- }
- }
- }
-
- for (i = 0; i < n_mswitches; i++)
- if (len == mswitches[i].len && ! strncmp (p, mswitches[i].str, len))
- return 1;
-
- return 0;
-}
-
-static int
-default_arg (p, len)
- char *p;
- int len;
-{
- char *start, *end;
- int i;
-
- for (start = multilib_defaults; *start != '\0'; start = end+1)
- {
- while (*start == ' ' || *start == '\t')
- start++;
-
- if (*start == '\0')
- break;
-
- for (end = start+1; *end != ' ' && *end != '\t' && *end != '\0'; end++)
- ;
-
- if ((end - start) == len && strncmp (p, start, len) == 0)
- return 1;
- }
-
- return 0;
-}
-
-/* Work out the subdirectory to use based on the
- options. The format of multilib_select is a list of elements.
- Each element is a subdirectory name followed by a list of options
- followed by a semicolon. gcc will consider each line in turn. If
- none of the options beginning with an exclamation point are
- present, and all of the other options are present, that
- subdirectory will be used. */
-
-static void
-set_multilib_dir ()
-{
- char *p = multilib_select;
- int this_path_len;
- char *this_path, *this_arg;
- int not_arg;
- int ok;
-
- while (*p != '\0')
- {
- /* Ignore newlines. */
- if (*p == '\n')
- {
- ++p;
- continue;
- }
-
- /* Get the initial path. */
- this_path = p;
- while (*p != ' ')
- {
- if (*p == '\0')
- abort ();
- ++p;
- }
- this_path_len = p - this_path;
-
- /* Check the arguments. */
- ok = 1;
- ++p;
- while (*p != ';')
- {
- if (*p == '\0')
- abort ();
-
- if (! ok)
- {
- ++p;
- continue;
- }
-
- this_arg = p;
- while (*p != ' ' && *p != ';')
- {
- if (*p == '\0')
- abort ();
- ++p;
- }
-
- if (*this_arg != '!')
- not_arg = 0;
- else
- {
- not_arg = 1;
- ++this_arg;
- }
-
- /* If this is a default argument, we can just ignore it.
- This is true even if this_arg begins with '!'. Beginning
- with '!' does not mean that this argument is necessarily
- inappropriate for this library: it merely means that
- there is a more specific library which uses this
- argument. If this argument is a default, we need not
- consider that more specific library. */
- if (! default_arg (this_arg, p - this_arg))
- {
- ok = used_arg (this_arg, p - this_arg);
- if (not_arg)
- ok = ! ok;
- }
-
- if (*p == ' ')
- ++p;
- }
-
- if (ok)
- {
- if (this_path_len != 1
- || this_path[0] != '.')
- {
- multilib_dir = xmalloc (this_path_len + 1);
- strncpy (multilib_dir, this_path, this_path_len);
- multilib_dir[this_path_len] = '\0';
- }
- break;
- }
-
- ++p;
- }
-}
-
-/* Print out the multiple library subdirectory selection
- information. This prints out a series of lines. Each line looks
- like SUBDIRECTORY;@OPTION@OPTION, with as many options as is
- required. Only the desired options are printed out, the negative
- matches. The options are print without a leading dash. There are
- no spaces to make it easy to use the information in the shell.
- Each subdirectory is printed only once. This assumes the ordering
- generated by the genmultilib script. */
-
-static void
-print_multilib_info ()
-{
- char *p = multilib_select;
- char *last_path = 0, *this_path;
- int skip;
- int last_path_len = 0;
-
- while (*p != '\0')
- {
- /* Ignore newlines. */
- if (*p == '\n')
- {
- ++p;
- continue;
- }
-
- /* Get the initial path. */
- this_path = p;
- while (*p != ' ')
- {
- if (*p == '\0')
- abort ();
- ++p;
- }
-
- /* If this is a duplicate, skip it. */
- skip = (last_path != 0 && p - this_path == last_path_len
- && ! strncmp (last_path, this_path, last_path_len));
-
- last_path = this_path;
- last_path_len = p - this_path;
-
- /* If this directory requires any default arguments, we can skip
- it. We will already have printed a directory identical to
- this one which does not require that default argument. */
- if (! skip)
- {
- char *q;
-
- q = p + 1;
- while (*q != ';')
- {
- char *arg;
-
- if (*q == '\0')
- abort ();
-
- if (*q == '!')
- arg = NULL;
- else
- arg = q;
-
- while (*q != ' ' && *q != ';')
- {
- if (*q == '\0')
- abort ();
- ++q;
- }
-
- if (arg != NULL
- && default_arg (arg, q - arg))
- {
- skip = 1;
- break;
- }
-
- if (*q == ' ')
- ++q;
- }
- }
-
- if (! skip)
- {
- char *p1;
-
- for (p1 = last_path; p1 < p; p1++)
- putchar (*p1);
- putchar (';');
- }
-
- ++p;
- while (*p != ';')
- {
- int use_arg;
-
- if (*p == '\0')
- abort ();
-
- if (skip)
- {
- ++p;
- continue;
- }
-
- use_arg = *p != '!';
-
- if (use_arg)
- putchar ('@');
-
- while (*p != ' ' && *p != ';')
- {
- if (*p == '\0')
- abort ();
- if (use_arg)
- putchar (*p);
- ++p;
- }
-
- if (*p == ' ')
- ++p;
- }
-
- if (! skip)
- {
- /* If there are extra options, print them now */
- if (multilib_extra && *multilib_extra)
- {
- int print_at = TRUE;
- char *q;
-
- for (q = multilib_extra; *q != '\0'; q++)
- {
- if (*q == ' ')
- print_at = TRUE;
- else
- {
- if (print_at)
- putchar ('@');
- putchar (*q);
- print_at = FALSE;
- }
- }
- }
- putchar ('\n');
- }
-
- ++p;
- }
-}
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
deleted file mode 100644
index 59d802ccaed..00000000000
--- a/gcc/gcov-io.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Machine-independent I/O routines for gcov.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Bob Manson <manson@cygnus.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 GCOV_IO_H
-#define GCOV_IO_H
-#include <stdio.h>
-
-/* These routines only work for signed values. */
-
-/* Store a portable representation of VALUE in DEST using BYTES*8-1 bits.
- Return a non-zero value if VALUE requires more than BYTES*8-1 bits
- to store. */
-
-static int
-__store_long (value, dest, bytes)
- long value;
- char *dest;
- int bytes;
-{
- int upper_bit = (value < 0 ? 128 : 0);
- int i;
-
- if (value < 0)
- {
- long oldvalue = value;
- value = -value;
- if (oldvalue != -value)
- return 1;
- }
-
- for(i = 0 ; i < (sizeof (value) < bytes ? sizeof (value) : bytes) ; i++) {
- dest[i] = value & (i == (bytes - 1) ? 127 : 255);
- value = value / 256;
- }
-
- if (value && value != -1)
- return 1;
-
- for(; i < bytes ; i++)
- dest[i] = 0;
- dest[bytes - 1] |= upper_bit;
- return 0;
-}
-
-/* Retrieve a quantity containing BYTES*8-1 bits from SOURCE and store
- the result in DEST. Returns a non-zero value if the value in SOURCE
- will not fit in DEST. */
-
-static int
-__fetch_long (dest, source, bytes)
- long *dest;
- char *source;
- int bytes;
-{
- long value = 0;
- int i;
-
- for (i = bytes - 1; i > (sizeof (*dest) - 1); i--)
- if (source[i] & (i == (bytes - 1) ? 127 : 255 ))
- return 1;
-
- for (; i >= 0; i--)
- value = value * 256 + (source[i] & (i == (bytes - 1) ? 127 : 255));
-
- if ((source[bytes - 1] & 128) && (value > 0))
- value = - value;
-
- *dest = value;
- return 0;
-}
-
-/* Write a BYTES*8-bit quantity to FILE, portably. Returns a non-zero
- value if the write fails, or if VALUE can't be stored in BYTES*8
- bits.
-
- Note that VALUE may not actually be large enough to hold BYTES*8
- bits, but BYTES characters will be written anyway.
-
- BYTES may be a maximum of 10. */
-
-static int
-__write_long (value, file, bytes)
- long value;
- FILE *file;
- int bytes;
-{
- char c[10];
-
- if (bytes > 10 || __store_long (value, c, bytes))
- return 1;
- else
- return fwrite(c, 1, bytes, file) != bytes;
-}
-
-/* Read a quantity containing BYTES bytes from FILE, portably. Return
- a non-zero value if the read fails or if the value will not fit
- in DEST.
-
- Note that DEST may not be large enough to hold all of the requested
- data, but the function will read BYTES characters anyway.
-
- BYTES may be a maximum of 10. */
-
-static int
-__read_long (dest, file, bytes)
- long *dest;
- FILE *file;
- int bytes;
-{
- char c[10];
-
- if (bytes > 10 || fread(c, 1, bytes, file) != bytes)
- return 1;
- else
- return __fetch_long (dest, c, bytes);
-}
-
-#endif
diff --git a/gcc/gcov.c b/gcc/gcov.c
deleted file mode 100644
index 26374c1df6d..00000000000
--- a/gcc/gcov.c
+++ /dev/null
@@ -1,1380 +0,0 @@
-/* Gcov.c: prepend line execution counts and branch probabilities to a
- source file.
- Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997 Free Software
- Foundation, Inc.
- Contributed by James E. Wilson of Cygnus Support.
- Mongled by Bob Manson of Cygnus Support.
-
-Gcov 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.
-
-Gcov 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 Gcov; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* ??? The code in final.c that produces the struct bb assumes that there is
- no padding between the fields. This is not necessary true. The current
- code can only be trusted if longs and pointers are the same size. */
-
-/* ??? No need to print an execution count on every line, could just print
- it on the first line of each block, and only print it on a subsequent
- line in the same block if the count changes. */
-
-/* ??? Print a list of the ten blocks with the highest execution counts,
- and list the line numbers corresponding to those blocks. Also, perhaps
- list the line numbers with the highest execution counts, only printing
- the first if there are several which are all listed in the same block. */
-
-/* ??? Should have an option to print the number of basic blocks, and the
- percent of them that are covered. */
-
-/* ??? Does not correctly handle the case where two .bb files refer to the
- same included source file. For example, if one has a short file containing
- only inline functions, which is then included in two other files, then
- there will be two .bb files which refer to the include file, but there
- is no way to get the total execution counts for the included file, can
- only get execution counts for one or the other of the including files. */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* The only need for this is so that we get macro definitions for rindex
- if necessary. */
-#include "config.h"
-
-#include "gcov-io.h"
-
-extern char * rindex ();
-
-/* The .bb file format consists of several lists of 4-byte integers
- which are the line numbers of each basic block in the file. Each
- list is terminated by a zero. These lists correspond to the basic
- blocks in the reconstructed program flow graph.
-
- A line number of -1 indicates that a source file name (padded to a
- long boundary) follows. The padded file name is followed by
- another -1 to make it easy to scan past file names. A -2 indicates
- that a function name (padded to a long boundary) follows; the name
- is followed by another -2 to make it easy to scan past the function
- name.
-
- The .bbg file contains enough info to enable gcov to reconstruct the
- program flow graph. The first word is the number of basic blocks,
- the second word is the number of arcs, followed by the list of arcs
- (source bb, dest bb pairs), then a -1, then the number of instrumented
- arcs followed by the instrumented arcs, followed by another -1. This
- is repeated for each function.
-
- The .da file contains the execution count for each instrumented branch.
-
- The .bb and .bbg files are created by giving GCC the -ftest-coverage option,
- and the .da files are created when an executable compiled with
- -fprofile-arcs is run. */
-
-/* The functions in this file for creating and solution program flow graphs
- are very similar to functions in the gcc source file profile.c. */
-
-char gcov_version_string[] = "GNU gcov version 1.5\n";
-
-/* This is the size of the buffer used to read in source file lines. */
-
-#define STRING_SIZE 200
-
-/* One copy of this structure is created for each source file mentioned in the
- .bb file. */
-
-struct sourcefile
-{
- char *name;
- int maxlineno;
- struct sourcefile *next;
-};
-
-/* This points to the head of the sourcefile structure list. */
-
-struct sourcefile *sources;
-
-/* One of these is dynamically created whenever we identify an arc in the
- function. */
-
-struct adj_list {
- int source;
- int target;
- int arc_count;
- unsigned int count_valid : 1;
- unsigned int on_tree : 1;
- unsigned int fake : 1;
- unsigned int fall_through : 1;
-#if 0
- /* Not needed for gcov, but defined in profile.c. */
- rtx branch_insn;
-#endif
- struct adj_list *pred_next;
- struct adj_list *succ_next;
-};
-
-/* Count the number of basic blocks, and create an array of these structures,
- one for each bb in the function. */
-
-struct bb_info {
- struct adj_list *succ;
- struct adj_list *pred;
- int succ_count;
- int pred_count;
- int exec_count;
- unsigned int count_valid : 1;
- unsigned int on_tree : 1;
-#if 0
- /* Not needed for gcov, but defined in profile.c. */
- rtx first_insn;
-#endif
-};
-
-/* When outputting branch probabilities, one of these structures is created
- for each branch/call. */
-
-struct arcdata
-{
- int prob;
- int call_insn;
- struct arcdata *next;
-};
-
-/* Used to save the list of bb_graphs, one per function. */
-
-struct bb_info_list {
- /* Indexed by block number, holds the basic block graph for one function. */
- struct bb_info *bb_graph;
- int num_blocks;
- struct bb_info_list *next;
-};
-
-/* Holds a list of function basic block graphs. */
-
-static struct bb_info_list *bb_graph_list = 0;
-
-/* Name and file pointer of the input file for the basic block graph. */
-
-static char *bbg_file_name;
-static FILE *bbg_file;
-
-/* Name and file pointer of the input file for the arc count data. */
-
-static char *da_file_name;
-static FILE *da_file;
-
-/* Name and file pointer of the input file for the basic block line counts. */
-
-static char *bb_file_name;
-static FILE *bb_file;
-
-/* Holds the entire contents of the bb_file read into memory. */
-
-static char *bb_data;
-
-/* Size of bb_data array in longs. */
-
-static long bb_data_size;
-
-/* Name and file pointer of the output file. */
-
-static char *gcov_file_name;
-static FILE *gcov_file;
-
-/* Name of the file mentioned on the command line. */
-
-static char *input_file_name = 0;
-
-/* Output branch probabilities if true. */
-
-static int output_branch_probs = 0;
-
-/* Output a gcov file if this is true. This is on by default, and can
- be turned off by the -n option. */
-
-static int output_gcov_file = 1;
-
-/* For included files, make the gcov output file name include the name of
- the input source file. For example, if x.h is included in a.c, then the
- output file name is a.c.x.h.gcov instead of x.h.gcov. This works only
- when a single source file is specified. */
-
-static int output_long_names = 0;
-
-/* Output summary info for each function. */
-
-static int output_function_summary = 0;
-
-/* Object directory file prefix. This is the directory where .bb and .bbg
- files are looked for, if non-zero. */
-
-static char *object_directory = 0;
-
-/* Forward declarations. */
-static void process_args ();
-static void open_files ();
-static void read_files ();
-static void scan_for_source_files ();
-static void output_data ();
-char * xmalloc ();
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- process_args (argc, argv);
-
- open_files ();
-
- read_files ();
-
- scan_for_source_files ();
-
- output_data ();
-
- return 0;
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *value = (char *) malloc (size);
- if (value == 0)
- {
- fprintf (stderr, "error: virtual memory exhausted");
- exit (1);
- }
- return value;
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fprintf (stderr, "Internal gcc abort.\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* Print a usage message and exit. */
-
-static void
-print_usage ()
-{
- fprintf (stderr, "gcov [-b] [-v] [-n] [-l] [-f] [-o OBJDIR] file\n");
- exit (1);
-}
-
-/* Parse the command line. */
-
-static void
-process_args (argc, argv)
- int argc;
- char **argv;
-{
- int i;
-
- for (i = 1; i < argc; i++)
- {
- if (argv[i][0] == '-')
- {
- if (argv[i][1] == 'b')
- output_branch_probs = 1;
- else if (argv[i][1] == 'v')
- fputs (gcov_version_string, stderr);
- else if (argv[i][1] == 'n')
- output_gcov_file = 0;
- else if (argv[i][1] == 'l')
- output_long_names = 1;
- else if (argv[i][1] == 'f')
- output_function_summary = 1;
- else if (argv[i][1] == 'o' && argv[i][2] == '\0')
- object_directory = argv[++i];
- else
- print_usage ();
- }
- else if (! input_file_name)
- input_file_name = argv[i];
- else
- print_usage ();
- }
-
- if (! input_file_name)
- print_usage ();
-}
-
-
-/* Find and open the .bb, .da, and .bbg files. */
-
-static void
-open_files ()
-{
- int count, objdir_count;
- char *cptr;
-
- /* Determine the names of the .bb, .bbg, and .da files. Strip off the
- extension, if any, and append the new extensions. */
- count = strlen (input_file_name);
- if (object_directory)
- objdir_count = strlen (object_directory);
- else
- objdir_count = 0;
-
- da_file_name = xmalloc (count + objdir_count + 4);
- bb_file_name = xmalloc (count + objdir_count + 4);
- bbg_file_name = xmalloc (count + objdir_count + 5);
-
- if (object_directory)
- {
- strcpy (da_file_name, object_directory);
- strcpy (bb_file_name, object_directory);
- strcpy (bbg_file_name, object_directory);
-
- if (object_directory[objdir_count - 1] != '/')
- {
- strcat (da_file_name, "/");
- strcat (bb_file_name, "/");
- strcat (bbg_file_name, "/");
- }
-
- cptr = rindex (input_file_name, '/');
- if (cptr)
- {
- strcat (da_file_name, cptr + 1);
- strcat (bb_file_name, cptr + 1);
- strcat (bbg_file_name, cptr + 1);
- }
- else
- {
- strcat (da_file_name, input_file_name);
- strcat (bb_file_name, input_file_name);
- strcat (bbg_file_name, input_file_name);
- }
- }
- else
- {
- strcpy (da_file_name, input_file_name);
- strcpy (bb_file_name, input_file_name);
- strcpy (bbg_file_name, input_file_name);
- }
-
- cptr = rindex (bb_file_name, '.');
- if (cptr)
- strcpy (cptr, ".bb");
- else
- strcat (bb_file_name, ".bb");
-
- cptr = rindex (da_file_name, '.');
- if (cptr)
- strcpy (cptr, ".da");
- else
- strcat (da_file_name, ".da");
-
- cptr = rindex (bbg_file_name, '.');
- if (cptr)
- strcpy (cptr, ".bbg");
- else
- strcat (bbg_file_name, ".bbg");
-
- bb_file = fopen (bb_file_name, "r");
- if (bb_file == NULL)
- {
- fprintf (stderr, "Could not open basic block file %s.\n", bb_file_name);
- exit (1);
- }
-
- /* If none of the functions in the file were executed, then there won't
- be a .da file. Just assume that all counts are zero in this case. */
- da_file = fopen (da_file_name, "r");
- if (da_file == NULL)
- {
- fprintf (stderr, "Could not open data file %s.\n", da_file_name);
- fprintf (stderr, "Assuming that all execution counts are zero.\n");
- }
-
- bbg_file = fopen (bbg_file_name, "r");
- if (bbg_file == NULL)
- {
- fprintf (stderr, "Could not open program flow graph file %s.\n",
- bbg_file_name);
- exit (1);
- }
-
- /* Check for empty .bbg file. This indicates that there is no executable
- code in this source file. */
- /* Set the EOF condition if at the end of file. */
- ungetc (getc (bbg_file), bbg_file);
- if (feof (bbg_file))
- {
- fprintf (stderr, "No executable code associated with file %s.\n",
- input_file_name);
- exit (2);
- }
-}
-
-/* Initialize a new arc. */
-
-static void
-init_arc (arcptr, source, target, bb_graph)
- struct adj_list *arcptr;
- int source, target;
- struct bb_info *bb_graph;
-{
- arcptr->target = target;
- arcptr->source = source;
-
- arcptr->arc_count = 0;
- arcptr->count_valid = 0;
- arcptr->on_tree = 0;
- arcptr->fake = 0;
- arcptr->fall_through = 0;
-
- arcptr->succ_next = bb_graph[source].succ;
- bb_graph[source].succ = arcptr;
- bb_graph[source].succ_count++;
-
- arcptr->pred_next = bb_graph[target].pred;
- bb_graph[target].pred = arcptr;
- bb_graph[target].pred_count++;
-}
-
-
-/* Reverse the arcs on a arc list. */
-
-static struct adj_list *
-reverse_arcs (arcptr)
- struct adj_list *arcptr;
-{
- struct adj_list *prev = 0;
- struct adj_list *next;
-
- for ( ; arcptr; arcptr = next)
- {
- next = arcptr->succ_next;
- arcptr->succ_next = prev;
- prev = arcptr;
- }
-
- return prev;
-}
-
-
-/* Construct the program flow graph from the .bbg file, and read in the data
- in the .da file. */
-
-static void
-create_program_flow_graph (bptr)
- struct bb_info_list *bptr;
-{
- long num_blocks, number_arcs, src, dest, flag_bits, num_arcs_per_block;
- int i;
- struct adj_list *arcptr;
- struct bb_info *bb_graph;
-
- /* Read the number of blocks. */
- __read_long (&num_blocks, bbg_file, 4);
-
- /* Create an array of size bb number of bb_info structs. Bzero it. */
- bb_graph = (struct bb_info *) xmalloc (num_blocks
- * sizeof (struct bb_info));
- bzero ((char *) bb_graph, sizeof (struct bb_info) * num_blocks);
-
- bptr->bb_graph = bb_graph;
- bptr->num_blocks = num_blocks;
-
- /* Read and create each arc from the .bbg file. */
- __read_long (&number_arcs, bbg_file, 4);
- for (i = 0; i < num_blocks; i++)
- {
- int j;
-
- __read_long (&num_arcs_per_block, bbg_file, 4);
- for (j = 0; j < num_arcs_per_block; j++)
- {
- if (number_arcs-- < 0)
- abort ();
-
- src = i;
- __read_long (&dest, bbg_file, 4);
-
- arcptr = (struct adj_list *) xmalloc (sizeof (struct adj_list));
- init_arc (arcptr, src, dest, bb_graph);
-
- __read_long (&flag_bits, bbg_file, 4);
- arcptr->on_tree = flag_bits & 0x1;
- arcptr->fake = !! (flag_bits & 0x2);
- arcptr->fall_through = !! (flag_bits & 0x4);
- }
- }
-
- if (number_arcs)
- abort ();
-
- /* Read and ignore the -1 separating the arc list from the arc list of the
- next function. */
- __read_long (&src, bbg_file, 4);
- if (src != -1)
- abort ();
-
- /* Must reverse the order of all succ arcs, to ensure that they match
- the order of the data in the .da file. */
-
- for (i = 0; i < num_blocks; i++)
- if (bb_graph[i].succ)
- bb_graph[i].succ = reverse_arcs (bb_graph[i].succ);
-
- /* For each arc not on the spanning tree, set its execution count from
- the .da file. */
-
- /* The first count in the .da file is the number of times that the function
- was entered. This is the exec_count for block zero. */
-
- /* This duplicates code in branch_prob in profile.c. */
-
- for (i = 0; i < num_blocks; i++)
- for (arcptr = bb_graph[i].succ; arcptr; arcptr = arcptr->succ_next)
- if (! arcptr->on_tree)
- {
- long tmp_count = 0;;
- if (da_file && __read_long (&tmp_count, da_file, 8))
- abort();
-
- arcptr->arc_count = tmp_count;
- arcptr->count_valid = 1;
- bb_graph[i].succ_count--;
- bb_graph[arcptr->target].pred_count--;
- }
-}
-
-static void
-solve_program_flow_graph (bptr)
- struct bb_info_list *bptr;
-{
- int passes, changes, total;
- int i;
- struct adj_list *arcptr;
- struct bb_info *bb_graph;
- int num_blocks;
-
- num_blocks = bptr->num_blocks;
- bb_graph = bptr->bb_graph;
-
- /* For every block in the file,
- - if every exit/entrance arc has a known count, then set the block count
- - if the block count is known, and every exit/entrance arc but one has
- a known execution count, then set the count of the remaining arc
-
- As arc counts are set, decrement the succ/pred count, but don't delete
- the arc, that way we can easily tell when all arcs are known, or only
- one arc is unknown. */
-
- /* The order that the basic blocks are iterated through is important.
- Since the code that finds spanning trees starts with block 0, low numbered
- arcs are put on the spanning tree in preference to high numbered arcs.
- Hence, most instrumented arcs are at the end. Graph solving works much
- faster if we propagate numbers from the end to the start.
-
- This takes an average of slightly more than 3 passes. */
-
- changes = 1;
- passes = 0;
- while (changes)
- {
- passes++;
- changes = 0;
-
- for (i = num_blocks - 1; i >= 0; i--)
- {
- if (! bb_graph[i].count_valid)
- {
- if (bb_graph[i].succ_count == 0)
- {
- total = 0;
- for (arcptr = bb_graph[i].succ; arcptr;
- arcptr = arcptr->succ_next)
- total += arcptr->arc_count;
- bb_graph[i].exec_count = total;
- bb_graph[i].count_valid = 1;
- changes = 1;
- }
- else if (bb_graph[i].pred_count == 0)
- {
- total = 0;
- for (arcptr = bb_graph[i].pred; arcptr;
- arcptr = arcptr->pred_next)
- total += arcptr->arc_count;
- bb_graph[i].exec_count = total;
- bb_graph[i].count_valid = 1;
- changes = 1;
- }
- }
- if (bb_graph[i].count_valid)
- {
- if (bb_graph[i].succ_count == 1)
- {
- total = 0;
- /* One of the counts will be invalid, but it is zero,
- so adding it in also doesn't hurt. */
- for (arcptr = bb_graph[i].succ; arcptr;
- arcptr = arcptr->succ_next)
- total += arcptr->arc_count;
- /* Calculate count for remaining arc by conservation. */
- total = bb_graph[i].exec_count - total;
- /* Search for the invalid arc, and set its count. */
- for (arcptr = bb_graph[i].succ; arcptr;
- arcptr = arcptr->succ_next)
- if (! arcptr->count_valid)
- break;
- if (! arcptr)
- abort ();
- arcptr->count_valid = 1;
- arcptr->arc_count = total;
- bb_graph[i].succ_count--;
-
- bb_graph[arcptr->target].pred_count--;
- changes = 1;
- }
- if (bb_graph[i].pred_count == 1)
- {
- total = 0;
- /* One of the counts will be invalid, but it is zero,
- so adding it in also doesn't hurt. */
- for (arcptr = bb_graph[i].pred; arcptr;
- arcptr = arcptr->pred_next)
- total += arcptr->arc_count;
- /* Calculate count for remaining arc by conservation. */
- total = bb_graph[i].exec_count - total;
- /* Search for the invalid arc, and set its count. */
- for (arcptr = bb_graph[i].pred; arcptr;
- arcptr = arcptr->pred_next)
- if (! arcptr->count_valid)
- break;
- if (! arcptr)
- abort ();
- arcptr->count_valid = 1;
- arcptr->arc_count = total;
- bb_graph[i].pred_count--;
-
- bb_graph[arcptr->source].succ_count--;
- changes = 1;
- }
- }
- }
- }
-
- /* If the graph has been correctly solved, every block will have a
- succ and pred count of zero. */
- for (i = 0; i < num_blocks; i++)
- if (bb_graph[i].succ_count || bb_graph[i].pred_count)
- abort ();
-}
-
-
-static void
-read_files ()
-{
- struct stat buf;
- struct bb_info_list *list_end = 0;
- struct bb_info_list *b_ptr;
- long total, first_time;
-
- /* Read and ignore the first word of the .da file, which is the count of
- how many numbers follow. */
- if (da_file && __read_long (&total, da_file, 8))
- abort();
-
- while (! feof (bbg_file))
- {
- b_ptr = (struct bb_info_list *) xmalloc (sizeof (struct bb_info_list));
-
- b_ptr->next = 0;
- if (list_end)
- list_end->next = b_ptr;
- else
- bb_graph_list = b_ptr;
- list_end = b_ptr;
-
- /* Read in the data in the .bbg file and reconstruct the program flow
- graph for one function. */
- create_program_flow_graph (b_ptr, first_time);
-
- /* Set the EOF condition if at the end of file. */
- ungetc (getc (bbg_file), bbg_file);
- }
-
- /* Check to make sure the .da file data is valid. */
-
- if (da_file)
- {
- if (feof (da_file))
- fprintf (stderr, ".da file contents exhausted too early\n");
- /* Should be at end of file now. */
- if (__read_long (&total, da_file, 8) == 0)
- fprintf (stderr, ".da file contents not exhausted\n");
- }
-
- /* Calculate all of the basic block execution counts and branch
- taken probabilities. */
-
- for (b_ptr = bb_graph_list; b_ptr; b_ptr = b_ptr->next)
- solve_program_flow_graph (b_ptr);
-
- /* Read in all of the data from the .bb file. This info will be accessed
- sequentially twice. */
- stat (bb_file_name, &buf);
- bb_data_size = buf.st_size / 4;
-
- bb_data = (char *) xmalloc (buf.st_size);
- fread (bb_data, sizeof (char), buf.st_size, bb_file);
-
- fclose (bb_file);
- if (da_file)
- fclose (da_file);
- fclose (bbg_file);
-}
-
-
-/* Scan the data in the .bb file to find all source files referenced,
- and the largest line number mentioned in each one. */
-
-static void
-scan_for_source_files ()
-{
- struct sourcefile *s_ptr;
- char *ptr;
- int count;
- long line_num;
-
- /* Search the bb_data to find:
- 1) The number of sources files contained herein, and
- 2) The largest line number for each source file. */
-
- ptr = bb_data;
- sources = 0;
- for (count = 0; count < bb_data_size; count++)
- {
- __fetch_long (&line_num, ptr, 4);
- ptr += 4;
- if (line_num == -1)
- {
- /* A source file name follows. Check to see if we already have
- a sourcefile structure for this file. */
- s_ptr = sources;
- while (s_ptr && strcmp (s_ptr->name, ptr))
- s_ptr = s_ptr->next;
-
- if (s_ptr == 0)
- {
- /* No sourcefile structure for this file name exists, create
- a new one, and append it to the front of the sources list. */
- s_ptr = (struct sourcefile *) xmalloc (sizeof(struct sourcefile));
- s_ptr->name = xmalloc (strlen ((char *) ptr) + 1);
- strcpy (s_ptr->name, (char *) ptr);
- s_ptr->maxlineno = 0;
- s_ptr->next = sources;
- sources = s_ptr;
- }
-
- /* Scan past the file name. */
- {
- long delim;
- do {
- count++;
- __fetch_long (&delim, ptr, 4);
- ptr += 4;
- } while (delim != line_num);
- }
- }
- else if (line_num == -2)
- {
- long delim;
-
- /* A function name follows. Ignore it. */
- do {
- count++;
- __fetch_long (&delim, ptr, 4);
- ptr += 4;
- } while (delim != line_num);
- }
- /* There will be a zero before the first file name, in which case s_ptr
- will still be uninitialized. So, only try to set the maxlineno
- field if line_num is non-zero. */
- else if (line_num > 0)
- {
- if (s_ptr->maxlineno <= line_num)
- s_ptr->maxlineno = line_num + 1;
- }
- else if (line_num < 0)
- {
- /* Don't know what this is, but it's garbage. */
- abort();
- }
- }
-}
-
-/* For calculating coverage at the function level. */
-
-static int function_source_lines;
-static int function_source_lines_executed;
-static int function_branches;
-static int function_branches_executed;
-static int function_branches_taken;
-static int function_calls;
-static int function_calls_executed;
-static char *function_name;
-
-/* Calculate the branch taken probabilities for all arcs branches at the
- end of this block. */
-
-static void
-calculate_branch_probs (current_graph, block_num, branch_probs, last_line_num)
- struct bb_info_list *current_graph;
- int block_num;
- struct arcdata **branch_probs;
- int last_line_num;
-{
- int total;
- struct adj_list *arcptr;
- struct arcdata *end_ptr, *a_ptr;
-
- total = current_graph->bb_graph[block_num].exec_count;
- for (arcptr = current_graph->bb_graph[block_num].succ; arcptr;
- arcptr = arcptr->succ_next)
- {
- /* Ignore fall through arcs as they aren't really branches. */
-
- if (arcptr->fall_through)
- continue;
-
- a_ptr = (struct arcdata *) xmalloc (sizeof (struct arcdata));
- if (total == 0)
- a_ptr->prob = -1;
- else
- a_ptr->prob = ((arcptr->arc_count * 100) + (total >> 1)) / total;
- a_ptr->call_insn = arcptr->fake;
-
- if (output_function_summary)
- {
- if (a_ptr->call_insn)
- {
- function_calls++;
- if (a_ptr->prob != -1)
- function_calls_executed++;
- }
- else
- {
- function_branches++;
- if (a_ptr->prob != -1)
- function_branches_executed++;
- if (a_ptr->prob > 0)
- function_branches_taken++;
- }
- }
-
- /* Append the new branch to the end of the list. */
- a_ptr->next = 0;
- if (! branch_probs[last_line_num])
- branch_probs[last_line_num] = a_ptr;
- else
- {
- end_ptr = branch_probs[last_line_num];
- while (end_ptr->next != 0)
- end_ptr = end_ptr->next;
- end_ptr->next = a_ptr;
- }
- }
-}
-
-/* Output summary info for a function. */
-
-static void
-function_summary ()
-{
- if (function_source_lines)
- fprintf (stdout, "%6.2lf%% of %d source lines executed in function %s\n",
- (((double) function_source_lines_executed / function_source_lines)
- * 100), function_source_lines, function_name);
- else
- fprintf (stdout, "No executable source lines in function %s\n",
- function_name);
-
- if (output_branch_probs)
- {
- if (function_branches)
- {
- fprintf (stdout, "%6.2lf%% of %d branches executed in funcion %s\n",
- (((double) function_branches_executed / function_branches)
- * 100), function_branches, function_name);
- fprintf (stdout,
- "%6.2lf%% of %d branches taken at least once in function %s\n",
- (((double) function_branches_taken / function_branches)
- * 100), function_branches, function_name);
- }
- else
- fprintf (stdout, "No branches in function %s\n", function_name);
- if (function_calls)
- fprintf (stdout, "%6.2lf%% of %d calls executed in function %s\n",
- (((double) function_calls_executed / function_calls)
- * 100), function_calls, function_name);
- else
- fprintf (stdout, "No calls in function %s\n", function_name);
- }
-}
-
-/* Calculate line execution counts, and output the data to a .tcov file. */
-
-static void
-output_data ()
-{
- /* When scanning data, this is true only if the data applies to the
- current source file. */
- int this_file;
- /* An array indexed by line number which indicates how many times that line
- was executed. */
- long *line_counts;
- /* An array indexed by line number which indicates whether the line was
- present in the bb file (i.e. whether it had code associate with it).
- Lines never executed are those which both exist, and have zero execution
- counts. */
- char *line_exists;
- /* An array indexed by line number, which contains a list of branch
- probabilities, one for each branch on that line. */
- struct arcdata **branch_probs;
- struct sourcefile *s_ptr;
- char *source_file_name;
- FILE *source_file;
- struct bb_info_list *current_graph;
- int count;
- char *cptr;
- long block_num;
- long line_num;
- long last_line_num;
- int i;
- struct arcdata *a_ptr;
- /* Buffer used for reading in lines from the source file. */
- char string[STRING_SIZE];
- /* For calculating coverage at the file level. */
- int total_source_lines;
- int total_source_lines_executed;
- int total_branches;
- int total_branches_executed;
- int total_branches_taken;
- int total_calls;
- int total_calls_executed;
-
- /* Now, for each source file, allocate an array big enough to hold a count
- for each line. Scan through the bb_data, and when the file name matches
- the current file name, then for each following line number, increment
- the line number execution count indicated by the execution count of
- the appropriate basic block. */
-
- for (s_ptr = sources; s_ptr; s_ptr = s_ptr->next)
- {
- /* If this is a relative file name, and an object directory has been
- specified, then make it relative to the object directory name. */
- if (*s_ptr->name != '/' && object_directory != 0
- && *object_directory != '\0')
- {
- int objdir_count = strlen (object_directory);
- source_file_name = xmalloc (objdir_count + strlen (s_ptr->name) + 2);
- strcpy (source_file_name, object_directory);
- if (object_directory[objdir_count - 1] != '/')
- source_file_name[objdir_count++] = '/';
- strcpy (source_file_name + objdir_count, s_ptr->name);
- }
- else
- source_file_name = s_ptr->name;
-
- line_counts = (long *) xmalloc (sizeof (long) * s_ptr->maxlineno);
- bzero ((char *) line_counts, sizeof (long) * s_ptr->maxlineno);
- line_exists = xmalloc (s_ptr->maxlineno);
- bzero (line_exists, s_ptr->maxlineno);
- if (output_branch_probs)
- {
- branch_probs = (struct arcdata **) xmalloc (sizeof (struct arcdata **)
- * s_ptr->maxlineno);
- bzero ((char *) branch_probs,
- sizeof (struct arcdata **) * s_ptr->maxlineno);
- }
-
- /* There will be a zero at the beginning of the bb info, before the
- first list of line numbers, so must initialize block_num to 0. */
- block_num = 0;
- this_file = 0;
- current_graph = 0;
- {
- /* Pointer into the bb_data, incremented while scanning the data. */
- char *ptr = bb_data;
- for (count = 0; count < bb_data_size; count++)
- {
- long delim;
-
- __fetch_long (&line_num, ptr, 4);
- ptr += 4;
- if (line_num == -1)
- {
- /* Marks the beginning of a file name. Check to see whether
- this is the filename we are currently collecting data for. */
-
- if (strcmp (s_ptr->name, ptr))
- this_file = 0;
- else
- this_file = 1;
-
- /* Scan past the file name. */
- do {
- count++;
- __fetch_long (&delim, ptr, 4);
- ptr += 4;
- } while (delim != line_num);
- }
- else if (line_num == -2)
- {
- /* Marks the start of a new function. Advance to the next
- program flow graph. */
-
- if (! current_graph)
- current_graph = bb_graph_list;
- else
- {
- if (block_num == current_graph->num_blocks - 1)
- /* Last block falls through to exit. */
- ;
- else if (block_num == current_graph->num_blocks - 2)
- {
- if (output_branch_probs && this_file)
- calculate_branch_probs (current_graph, block_num,
- branch_probs, last_line_num);
- }
- else
- {
- fprintf (stderr,
- "didn't use all bb entries of graph, function %s\n",
- function_name);
- fprintf (stderr, "block_num = %d, num_blocks = %d\n",
- block_num, current_graph->num_blocks);
- }
-
- current_graph = current_graph->next;
- block_num = 0;
-
- if (output_function_summary && this_file)
- function_summary ();
- }
-
- if (output_function_summary)
- {
- function_source_lines = 0;
- function_source_lines_executed = 0;
- function_branches = 0;
- function_branches_executed = 0;
- function_branches_taken = 0;
- function_calls = 0;
- function_calls_executed = 0;
- }
-
- /* Save the function name for later use. */
- function_name = ptr;
-
- /* Scan past the file name. */
- do {
- count++;
- __fetch_long (&delim, ptr, 4);
- ptr += 4;
- } while (delim != line_num);
- }
- else if (line_num == 0)
- {
- /* Marks the end of a block. */
-
- if (block_num >= current_graph->num_blocks)
- {
- fprintf (stderr, "ERROR: too many basic blocks in .bb file %s\n",
- function_name);
- abort ();
- }
-
- if (output_branch_probs && this_file)
- calculate_branch_probs (current_graph, block_num,
- branch_probs, last_line_num);
-
- block_num++;
- }
- else if (this_file)
- {
- if (output_function_summary)
- {
- if (line_exists[line_num] == 0)
- function_source_lines++;
- if (line_counts[line_num] == 0
- && current_graph->bb_graph[block_num].exec_count != 0)
- function_source_lines_executed++;
- }
-
- /* Accumulate execution data for this line number. */
-
- line_counts[line_num]
- += current_graph->bb_graph[block_num].exec_count;
- line_exists[line_num] = 1;
- last_line_num = line_num;
- }
- }
- }
-
- if (output_function_summary && this_file)
- function_summary ();
-
- /* Calculate summary test coverage statistics. */
-
- total_source_lines = 0;
- total_source_lines_executed = 0;
- total_branches = 0;
- total_branches_executed = 0;
- total_branches_taken = 0;
- total_calls = 0;
- total_calls_executed = 0;
-
- for (count = 1; count < s_ptr->maxlineno; count++)
- {
- if (line_exists[count])
- {
- total_source_lines++;
- if (line_counts[count])
- total_source_lines_executed++;
- }
- if (output_branch_probs)
- {
- for (a_ptr = branch_probs[count]; a_ptr; a_ptr = a_ptr->next)
- {
- if (a_ptr->call_insn)
- {
- total_calls++;
- if (a_ptr->prob != -1)
- total_calls_executed++;
- }
- else
- {
- total_branches++;
- if (a_ptr->prob != -1)
- total_branches_executed++;
- if (a_ptr->prob > 0)
- total_branches_taken++;
- }
- }
- }
- }
-
- if (total_source_lines)
- fprintf (stdout,
- "%6.2lf%% of %d source lines executed in file %s\n",
- (((double) total_source_lines_executed / total_source_lines)
- * 100), total_source_lines, source_file_name);
- else
- fprintf (stdout, "No executable source lines in file %s\n",
- source_file_name);
-
- if (output_branch_probs)
- {
- if (total_branches)
- {
- fprintf (stdout, "%6.2lf%% of %d branches executed in file %s\n",
- (((double) total_branches_executed / total_branches)
- * 100), total_branches, source_file_name);
- fprintf (stdout,
- "%6.2lf%% of %d branches taken at least once in file %s\n",
- (((double) total_branches_taken / total_branches)
- * 100), total_branches, source_file_name);
- }
- else
- fprintf (stdout, "No branches in file %s\n", source_file_name);
- if (total_calls)
- fprintf (stdout, "%6.2lf%% of %d calls executed in file %s\n",
- (((double) total_calls_executed / total_calls)
- * 100), total_calls, source_file_name);
- else
- fprintf (stdout, "No calls in file %s\n", source_file_name);
- }
-
- if (output_gcov_file)
- {
- /* Now the statistics are ready. Read in the source file one line
- at a time, and output that line to the gcov file preceeded by
- its execution count if non zero. */
-
- source_file = fopen (source_file_name, "r");
- if (source_file == NULL)
- {
- fprintf (stderr, "Could not open source file %s.\n",
- source_file_name);
- free (line_counts);
- free (line_exists);
- continue;
- }
-
- count = strlen (source_file_name);
- cptr = rindex (s_ptr->name, '/');
- if (cptr)
- cptr = cptr + 1;
- else
- cptr = s_ptr->name;
- if (output_long_names && strcmp (cptr, input_file_name))
- {
- gcov_file_name = xmalloc (count + 7 + strlen (input_file_name));
-
- cptr = rindex (input_file_name, '/');
- if (cptr)
- strcpy (gcov_file_name, cptr + 1);
- else
- strcpy (gcov_file_name, input_file_name);
-
- strcat (gcov_file_name, ".");
-
- cptr = rindex (source_file_name, '/');
- if (cptr)
- strcat (gcov_file_name, cptr + 1);
- else
- strcat (gcov_file_name, source_file_name);
- }
- else
- {
- gcov_file_name = xmalloc (count + 6);
- cptr = rindex (source_file_name, '/');
- if (cptr)
- strcpy (gcov_file_name, cptr + 1);
- else
- strcpy (gcov_file_name, source_file_name);
- }
-
- /* Don't strip off the ending for compatibility with tcov, since
- this results in confusion if there is more than one file with
- the same basename, e.g. tmp.c and tmp.h. */
- strcat (gcov_file_name, ".gcov");
-
- gcov_file = fopen (gcov_file_name, "w");
-
- if (gcov_file == NULL)
- {
- fprintf (stderr, "Could not open output file %s.\n",
- gcov_file_name);
- fclose (source_file);
- free (line_counts);
- free (line_exists);
- continue;
- }
-
- fprintf (stdout, "Creating %s.\n", gcov_file_name);
-
- for (count = 1; count < s_ptr->maxlineno; count++)
- {
- char *retval;
- int len;
-
- retval = fgets (string, STRING_SIZE, source_file);
-
- /* For lines which don't exist in the .bb file, print nothing
- before the source line. For lines which exist but were never
- executed, print ###### before the source line. Otherwise,
- print the execution count before the source line. */
- /* There are 16 spaces of identation added before the source line
- so that tabs won't be messed up. */
- if (line_exists[count])
- {
- if (line_counts[count])
- fprintf (gcov_file, "%12d %s", line_counts[count],
- string);
- else
- fprintf (gcov_file, " ###### %s", string);
- }
- else
- fprintf (gcov_file, "\t\t%s", string);
-
- /* In case the source file line is larger than our buffer, keep
- reading and outputing lines until we get a newline. */
- len = strlen (string);
- while ((len == 0 || string[strlen (string) - 1] != '\n') &&
- retval != NULL)
- {
- retval = fgets (string, STRING_SIZE, source_file);
- fputs (string, gcov_file);
- }
-
- if (output_branch_probs)
- {
- for (i = 0, a_ptr = branch_probs[count]; a_ptr;
- a_ptr = a_ptr->next, i++)
- {
- if (a_ptr->call_insn)
- {
- if (a_ptr->prob == -1)
- fprintf (gcov_file, "call %d never executed\n", i);
- else
- fprintf (gcov_file,
- "call %d returns = %d%%\n",
- i, 100 - a_ptr->prob);
- }
- else
- {
- if (a_ptr->prob == -1)
- fprintf (gcov_file, "branch %d never executed\n",
- i);
- else
- fprintf (gcov_file, "branch %d taken = %d%%\n", i,
- a_ptr->prob);
- }
- }
- }
-
- /* Gracefully handle errors while reading the source file. */
- if (retval == NULL)
- {
- fprintf (stderr,
- "Unexpected EOF while reading source file %s.\n",
- source_file_name);
- break;
- }
- }
-
- /* Handle all remaining source lines. There may be lines
- after the last line of code. */
-
- {
- char *retval = fgets (string, STRING_SIZE, source_file);
- while (retval != NULL)
- {
- int len;
-
- fprintf (gcov_file, "\t\t%s", string);
-
- /* In case the source file line is larger than our buffer, keep
- reading and outputing lines until we get a newline. */
- len = strlen (string);
- while ((len == 0 || string[strlen (string) - 1] != '\n') &&
- retval != NULL)
- {
- retval = fgets (string, STRING_SIZE, source_file);
- fputs (string, gcov_file);
- }
-
- retval = fgets (string, STRING_SIZE, source_file);
- }
- }
-
- fclose (source_file);
- fclose (gcov_file);
- }
-
- free (line_counts);
- free (line_exists);
- }
-}
diff --git a/gcc/gcov.texi b/gcc/gcov.texi
deleted file mode 100644
index 9c6d77da7d4..00000000000
--- a/gcc/gcov.texi
+++ /dev/null
@@ -1,344 +0,0 @@
-@c Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-@c This is part of the GCC manual.
-@c For copying conditions, see the file gcc.texi.
-
-@node Gcov
-@chapter @code{gcov}: a Test Coverage Program
-
-@code{gcov} is a tool you can use in conjunction with @sc{gnu} CC to
-test code coverage in your programs.
-
-This chapter describes version 1.5 of @code{gcov}.
-
-@menu
-* Gcov Intro:: Introduction to gcov.
-* Invoking Gcov:: How to use gcov.
-* Gcov and Optimization:: Using gcov with GCC optimization.
-* Gcov Data Files:: The files used by gcov.
-@end menu
-
-@node Gcov Intro
-@section Introduction to @code{gcov}
-
-@code{gcov} is a test coverage program. Use it in concert with @sc{gnu}
-CC to analyze your programs to help create more efficient, faster
-running code. You can use @code{gcov} as a profiling tool to help
-discover where your optimization efforts will best affect your code. You
-can also use @code{gcov} along with the other profiling tool,
-@code{gprof}, to assess which parts of your code use the greatest amount
-of computing time.
-
-Profiling tools help you analyze your code's performance. Using a
-profiler such as @code{gcov} or @code{gprof}, you can find out some
-basic performance statistics, such as:
-
-@itemize @bullet
-@item
-how often each line of code executes
-
-@item
-what lines of code are actually executed
-
-@item
-how much computing time each section of code uses
-@end itemize
-
-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.
-@code{gcov} helps you determine where to work on optimization.
-
-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.
-
-You should compile your code without optimization if you plan to use
-@code{gcov} 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 @code{gcov} 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.
-
-@code{gcov} creates a logfile called @file{@var{sourcefile}.gcov} which
-indicates how many times each line of a source file @file{@var{sourcefile}.c}
-has executed. You can use these logfiles along with @code{gprof} to aid
-in fine-tuning the performance of your programs. @code{gprof} gives
-timing information you can use along with the information you get from
-@code{gcov}.
-
-@code{gcov} works only on code compiled with @sc{gnu} CC. It is not
-compatible with any other profiling or test coverage mechanism.
-
-@node Invoking Gcov
-@section Invoking gcov
-
-@smallexample
-gcov [-b] [-v] [-n] [-l] [-f] [-o directory] @var{sourcefile}
-@end smallexample
-
-@table @code
-@item -b
-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.
-
-@item -v
-Display the @code{gcov} version number (on the standard error stream).
-
-@item -n
-Do not create the @code{gcov} output file.
-
-@item -l
-Create long file names for included source files. For example, if the
-header file @samp{x.h} contains code, and was included in the file
-@samp{a.c}, then running @code{gcov} on the file @samp{a.c} will produce
-an output file called @samp{a.c.x.h.gcov} instead of @samp{x.h.gcov}.
-This can be useful if @samp{x.h} is included in multiple source files.
-
-@item -f
-Output summaries for each function in addition to the file level summary.
-
-@item -o
-The directory where the object files live. Gcov will search for @code{.bb},
-@code{.bbg}, and @code{.da} files in this directory.
-@end table
-
-@need 3000
-When using @code{gcov}, you must first compile your program with two
-special @sc{gnu} CC options: @samp{-fprofile-arcs -ftest-coverage}.
-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.
-
-Running the program will cause profile output to be generated. For each
-source file compiled with -fprofile-arcs, an accompanying @code{.da}
-file will be placed in the source directory.
-
-Running @code{gcov} 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 @samp{tmp.c}, this
-is what you see when you use the basic @code{gcov} facility:
-
-@smallexample
-$ 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.
-@end smallexample
-
-The file @file{tmp.c.gcov} contains output from @code{gcov}.
-Here is a sample:
-
-@smallexample
- main()
- @{
- 1 int i, total;
-
- 1 total = 0;
-
- 11 for (i = 0; i < 10; i++)
- 10 total += i;
-
- 1 if (total != 45)
- ###### printf ("Failure\n");
- else
- 1 printf ("Success\n");
- 1 @}
-@end smallexample
-
-@need 450
-When you use the @samp{-b} option, your output looks like this:
-
-@smallexample
-$ 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.
-@end smallexample
-
-Here is a sample of a resulting @file{tmp.c.gcov} file:
-
-@smallexample
- main()
- @{
- 1 int i, total;
-
- 1 total = 0;
-
- 11 for (i = 0; i < 10; i++)
-branch 0 taken = 91%
-branch 1 taken = 100%
-branch 2 taken = 100%
- 10 total += i;
-
- 1 if (total != 45)
-branch 0 taken = 100%
- ###### printf ("Failure\n");
-call 0 never executed
-branch 1 never executed
- else
- 1 printf ("Success\n");
-call 0 returns = 100%
- 1 @}
-@end smallexample
-
-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.
-
-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.
-
-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 @code{exit} or @code{longjmp},
-and thus may not return everytime they are called.
-
-The execution counts are cumulative. If the example program were
-executed again without removing the @code{.da} file, the count for the
-number of times each line in the source was executed would be added to
-the results of the previous run(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.
-
-The data in the @code{.da} files is saved immediately before the program
-exits. For each source file compiled with -fprofile-arcs, the profiling
-code first attempts to read in an existing @code{.da} 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.
-
-@node Gcov and Optimization
-@section Using @code{gcov} with GCC Optimization
-
-If you plan to use @code{gcov} to help optimize your code, you must
-first compile your program with two special @sc{gnu} CC options:
-@samp{-fprofile-arcs -ftest-coverage}. Aside from that, you can use any
-other @sc{gnu} CC 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:
-
-@smallexample
-if (a != b)
- c = 1;
-else
- c = 0;
-@end smallexample
-
-@noindent
-can be compiled into one instruction on some machines. In this case,
-there is no way for @code{gcov} to calculate separate execution counts
-for each line because there isn't separate code for each line. Hence
-the @code{gcov} output looks like this if you compiled the program with
-optimization:
-
-@smallexample
- 100 if (a != b)
- 100 c = 1;
- 100 else
- 100 c = 0;
-@end smallexample
-
-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.
-
-@node Gcov Data Files
-@section Brief description of @code{gcov} data files
-
-@code{gcov} uses three files for doing profiling. The names of these
-files are derived from the original @emph{source} file by substituting
-the file suffix with either @code{.bb}, @code{.bbg}, or @code{.da}. All
-of these files are placed in the same directory as the source file, and
-contain data stored in a platform-independent method.
-
-The @code{.bb} and @code{.bbg} files are generated when the source file
-is compiled with the @sc{gnu} CC @samp{-ftest-coverage} option. The
-@code{.bb} file contains a list of source files (including headers),
-functions within those files, and line numbers corresponding to each
-basic block in the source file.
-
-The @code{.bb} file format consists of several lists of 4-byte integers
-which correspond to the line numbers of each basic block in the
-file. Each list is terminated by a line number of 0. A line number of -1
-is used to designate that the source file name (padded to a 4-byte
-boundary and followed by another -1) follows. In addition, a line number
-of -2 is used to designate that the name of a function (also padded to a
-4-byte boundary and followed by a -2) follows.
-
-The @code{.bbg} file is used to reconstruct the program flow graph for
-the source file. It contains a list of the program flow arcs (possible
-branches taken from one basic block to another) for each function which,
-in combination with the @code{.bb} file, enables gcov to reconstruct the
-program flow.
-
-In the @code{.bbg} file, the format is:
-@smallexample
- number of basic blocks for function #0 (4-byte number)
- total number of arcs for function #0 (4-byte number)
- count of arcs in basic block #0 (4-byte number)
- destination basic block of arc #0 (4-byte number)
- flag bits (4-byte number)
- destination basic block of arc #1 (4-byte number)
- flag bits (4-byte number)
- ...
- destination basic block of arc #N (4-byte number)
- flag bits (4-byte number)
- count of arcs in basic block #1 (4-byte number)
- destination basic block of arc #0 (4-byte number)
- flag bits (4-byte number)
- ...
-@end smallexample
-
-A -1 (stored as a 4-byte number) is used to separate each function's
-list of basic blocks, and to verify that the file has been read
-correctly.
-
-The @code{.da} file is generated when a program containing object files
-built with the @sc{gnu} CC @samp{-fprofile-arcs} option is executed. A
-separate @code{.da} file is created for each source file compiled with
-this option, and the name of the @code{.da} file is stored as an
-absolute pathname in the resulting object file. This path name is
-derived from the source file name by substituting a @code{.da} suffix.
-
-The format of the @code{.da} file is fairly simple. The first 8-byte
-number is the number of counts in the file, followed by the counts
-(stored as 8-byte numbers). Each count corresponds to the number of
-times each arc in the program is executed. The counts are cumulative;
-each time the program is executed, it attemps to combine the existing
-@code{.da} files with the new counts for this invocation of the
-program. It ignores the contents of any @code{.da} files whose number of
-arcs doesn't correspond to the current program, and merely overwrites
-them instead.
-
-All three of these files use the functions in @code{gcov-io.h} to store
-integers; the functions in this header provide a machine-independent
-mechanism for storing and retrieving data from a stream.
-
diff --git a/gcc/gen-protos.c b/gcc/gen-protos.c
deleted file mode 100644
index 0284c18ba4a..00000000000
--- a/gcc/gen-protos.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* gen-protos.c - massages a list of prototypes, for use by fixproto.
- Copyright (C) 1993, 1994, 1995, 1996 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, 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. */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "hconfig.h"
-#include "scan.h"
-#include "cpplib.h"
-#include "cpphash.h"
-
-int verbose = 0;
-char *progname;
-
-#define HASH_SIZE 2503 /* a prime */
-int hash_tab[HASH_SIZE];
-int next_index;
-
-static int
-hashf (name, len, hashsize)
- register U_CHAR *name;
- register int len;
- int hashsize;
-{
- register int r = 0;
-
- while (len--)
- r = HASHSTEP (r, *name++);
-
- return MAKE_POS (r) % hashsize;
-}
-
-static void
-add_hash (fname)
- char *fname;
-{
- int i, i0;
-
- /* NOTE: If you edit this, also edit lookup_std_proto in fix-header.c !! */
- i = hashf (fname, strlen (fname), HASH_SIZE);
- i0 = i;
- if (hash_tab[i] != 0)
- {
- for (;;)
- {
- i = (i+1) % HASH_SIZE;
- if (i == i0)
- abort ();
- if (hash_tab[i] == 0)
- break;
- }
- }
- hash_tab[i] = next_index;
-
- next_index++;
-}
-
-/* Given a function prototype, fill in the fields of FN.
- The result is a boolean indicating if a function prototype was found.
-
- The input string is modified (trailing NULs are inserted).
- The fields of FN point to the input string. */
-
-static int
-parse_fn_proto (start, end, fn)
- char *start, *end;
- struct fn_decl *fn;
-{
- register char *ptr;
- int param_nesting = 1;
- char *param_start, *param_end, *decl_start, *name_start, *name_end;
-
- ptr = end - 1;
- while (*ptr == ' ' || *ptr == '\t') ptr--;
- if (*ptr-- != ';')
- {
- fprintf (stderr, "Funny input line: %s\n", start);
- return 0;
- }
- while (*ptr == ' ' || *ptr == '\t') ptr--;
- if (*ptr != ')')
- {
- fprintf (stderr, "Funny input line: %s\n", start);
- return 0;
- }
- param_end = ptr;
- for (;;)
- {
- int c = *--ptr;
- if (c == '(' && --param_nesting == 0)
- break;
- else if (c == ')')
- param_nesting++;
- }
- param_start = ptr+1;
-
- ptr--;
- while (*ptr == ' ' || *ptr == '\t') ptr--;
-
- if (!isalnum (*ptr))
- {
- if (verbose)
- fprintf (stderr, "%s: Can't handle this complex prototype: %s\n",
- progname, start);
- return 0;
- }
- name_end = ptr+1;
-
- while (isalnum (*ptr) || *ptr == '_') --ptr;
- name_start = ptr+1;
- while (*ptr == ' ' || *ptr == '\t') ptr--;
- ptr[1] = 0;
- *param_end = 0;
- *name_end = 0;
-
- decl_start = start;
- if (strncmp (decl_start, "typedef ", 8) == 0)
- return 0;
- if (strncmp (decl_start, "extern ", 7) == 0)
- decl_start += 7;
-
- fn->fname = name_start;
- fn->rtype = decl_start;
- fn->params = param_start;
- return 1;
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- FILE *inf = stdin;
- FILE *outf = stdout;
- int i;
- sstring linebuf;
- char **optr;
- struct fn_decl fn_decl;
-
- i = strlen (argv[0]);
- while (i > 0 && argv[0][i-1] != '/') --i;
- progname = &argv[0][i];
-
- INIT_SSTRING (&linebuf);
-
- fprintf (outf, "struct fn_decl std_protos[] = {\n");
-
- /* A hash table entry of 0 means "unused" so reserve it. */
- fprintf (outf, " {\"\", \"\", \"\"},\n");
- next_index = 1;
-
- for (;;)
- {
- int c = skip_spaces (inf, ' ');
-
- if (c == EOF)
- break;
- linebuf.ptr = linebuf.base;
- ungetc (c, inf);
- c = read_upto (inf, &linebuf, '\n');
- if (linebuf.base[0] == '#') /* skip cpp command */
- continue;
- if (linebuf.base[0] == '\0') /* skip empty line */
- continue;
-
- if (! parse_fn_proto (linebuf.base, linebuf.ptr, &fn_decl))
- continue;
-
- add_hash (fn_decl.fname);
-
- fprintf (outf, " {\"%s\", \"%s\", \"%s\"},\n",
- fn_decl.fname, fn_decl.rtype, fn_decl.params);
-
- if (c == EOF)
- break;
- }
- fprintf (outf, " {0, 0, 0}\n};\n");
-
-
- fprintf (outf, "#define HASH_SIZE %d\n", HASH_SIZE);
- fprintf (outf, "short hash_tab[HASH_SIZE] = {\n");
- for (i = 0; i < HASH_SIZE; i++)
- fprintf (outf, " %d,\n", hash_tab[i]);
- fprintf (outf, "};\n");
-
- return 0;
-}
-
-/* Avoid error if config defines abort as fancy_abort.
- It's not worth "really" implementing this because ordinary
- compiler users never run fix-header. */
-
-void
-fancy_abort ()
-{
- abort ();
-}
-
-void
-fatal (s)
- char *s;
-{
- fprintf (stderr, "%s: %s\n", "gen-protos", s);
- exit (FATAL_EXIT_CODE);
-}
diff --git a/gcc/genattr.c b/gcc/genattr.c
deleted file mode 100644
index c351fc5ad5f..00000000000
--- a/gcc/genattr.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/* Generate attribute information (insn-attr.h) from machine description.
- Copyright (C) 1991, 1994, 1996 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-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 <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free PROTO((void *));
-extern rtx read_rtx PROTO((FILE *));
-
-char *xmalloc PROTO((unsigned));
-static void fatal ();
-void fancy_abort PROTO((void));
-
-/* A range of values. */
-
-struct range
-{
- int min;
- int max;
-};
-
-/* Record information about each function unit mentioned in a
- DEFINE_FUNCTION_UNIT. */
-
-struct function_unit
-{
- char *name; /* Function unit name. */
- struct function_unit *next; /* Next function unit. */
- int multiplicity; /* Number of units of this type. */
- int simultaneity; /* Maximum number of simultaneous insns
- on this function unit or 0 if unlimited. */
- struct range ready_cost; /* Range of ready cost values. */
- struct range issue_delay; /* Range of issue delay values. */
-};
-
-static void
-extend_range (range, min, max)
- struct range *range;
- int min;
- int max;
-{
- if (range->min > min) range->min = min;
- if (range->max < max) range->max = max;
-}
-
-static void
-init_range (range)
- struct range *range;
-{
- range->min = 100000;
- range->max = -1;
-}
-
-static void
-write_upcase (str)
- char *str;
-{
- for (; *str; str++)
- if (*str >= 'a' && *str <= 'z')
- printf ("%c", *str - 'a' + 'A');
- else
- printf ("%c", *str);
-}
-
-static void
-gen_attr (attr)
- rtx attr;
-{
- char *p;
-
- printf ("#define HAVE_ATTR_%s\n", XSTR (attr, 0));
-
- /* If numeric attribute, don't need to write an enum. */
- if (*XSTR (attr, 1) == '\0')
- printf ("extern int get_attr_%s ();\n", XSTR (attr, 0));
- else
- {
- printf ("enum attr_%s {", XSTR (attr, 0));
- write_upcase (XSTR (attr, 0));
- printf ("_");
-
- for (p = XSTR (attr, 1); *p != '\0'; p++)
- {
- if (*p == ',')
- {
- printf (", ");
- write_upcase (XSTR (attr, 0));
- printf ("_");
- }
- else if (*p >= 'a' && *p <= 'z')
- printf ("%c", *p - 'a' + 'A');
- else
- printf ("%c", *p);
- }
-
- printf ("};\n");
- printf ("extern enum attr_%s get_attr_%s ();\n\n",
- XSTR (attr, 0), XSTR (attr, 0));
- }
-
- /* If `length' attribute, write additional function definitions and define
- variables used by `insn_current_length'. */
- if (! strcmp (XSTR (attr, 0), "length"))
- {
- printf ("extern void init_lengths ();\n");
- printf ("extern void shorten_branches PROTO((rtx));\n");
- printf ("extern int insn_default_length PROTO((rtx));\n");
- printf ("extern int insn_variable_length_p PROTO((rtx));\n");
- printf ("extern int insn_current_length PROTO((rtx));\n\n");
- printf ("extern int *insn_addresses;\n");
- printf ("extern int insn_current_address;\n\n");
- }
-}
-
-static void
-write_units (num_units, multiplicity, simultaneity,
- ready_cost, issue_delay, blockage)
- int num_units;
- struct range *multiplicity;
- struct range *simultaneity;
- struct range *ready_cost;
- struct range *issue_delay;
- struct range *blockage;
-{
- int i, q_size;
-
- printf ("#define INSN_SCHEDULING\n\n");
- printf ("extern int result_ready_cost PROTO((rtx));\n");
- printf ("extern int function_units_used PROTO((rtx));\n\n");
- printf ("extern struct function_unit_desc\n");
- printf ("{\n");
- printf (" char *name;\n");
- printf (" int bitmask;\n");
- printf (" int multiplicity;\n");
- printf (" int simultaneity;\n");
- printf (" int default_cost;\n");
- printf (" int max_issue_delay;\n");
- printf (" int (*ready_cost_function) ();\n");
- printf (" int (*conflict_cost_function) ();\n");
- printf (" int max_blockage;\n");
- printf (" unsigned int (*blockage_range_function) ();\n");
- printf (" int (*blockage_function) ();\n");
- printf ("} function_units[];\n\n");
- printf ("#define FUNCTION_UNITS_SIZE %d\n", num_units);
- printf ("#define MIN_MULTIPLICITY %d\n", multiplicity->min);
- printf ("#define MAX_MULTIPLICITY %d\n", multiplicity->max);
- printf ("#define MIN_SIMULTANEITY %d\n", simultaneity->min);
- printf ("#define MAX_SIMULTANEITY %d\n", simultaneity->max);
- printf ("#define MIN_READY_COST %d\n", ready_cost->min);
- printf ("#define MAX_READY_COST %d\n", ready_cost->max);
- printf ("#define MIN_ISSUE_DELAY %d\n", issue_delay->min);
- printf ("#define MAX_ISSUE_DELAY %d\n", issue_delay->max);
- printf ("#define MIN_BLOCKAGE %d\n", blockage->min);
- printf ("#define MAX_BLOCKAGE %d\n", blockage->max);
- for (i = 0; (1 << i) < blockage->max; i++)
- ;
- printf ("#define BLOCKAGE_BITS %d\n", i + 1);
-
- /* INSN_QUEUE_SIZE is a power of two larger than MAX_BLOCKAGE and
- MAX_READY_COST. This is the longest time an isnsn may be queued. */
- i = MAX (blockage->max, ready_cost->max);
- for (q_size = 1; q_size <= i; q_size <<= 1)
- ;
- printf ("#define INSN_QUEUE_SIZE %d\n", q_size);
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
- return val;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char * result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-static void
-fatal (s, a1, a2)
- char *s;
-{
- fprintf (stderr, "genattr: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- FILE *infile;
- register int c;
- int have_delay = 0;
- int have_annul_true = 0;
- int have_annul_false = 0;
- int num_units = 0;
- struct range all_simultaneity, all_multiplicity;
- struct range all_ready_cost, all_issue_delay, all_blockage;
- struct function_unit *units = 0, *unit;
- int i;
-
- init_range (&all_multiplicity);
- init_range (&all_simultaneity);
- init_range (&all_ready_cost);
- init_range (&all_issue_delay);
- init_range (&all_blockage);
-
- obstack_init (rtl_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- printf ("/* Generated automatically by the program `genattr'\n\
-from the machine description file `md'. */\n\n");
-
- /* For compatibility, define the attribute `alternative', which is just
- a reference to the variable `which_alternative'. */
-
- printf ("#define HAVE_ATTR_alternative\n");
- printf ("#define get_attr_alternative(insn) which_alternative\n");
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_ATTR)
- gen_attr (desc);
-
- else if (GET_CODE (desc) == DEFINE_DELAY)
- {
- if (! have_delay)
- {
- printf ("#define DELAY_SLOTS\n");
- printf ("extern int num_delay_slots PROTO((rtx));\n");
- printf ("extern int eligible_for_delay PROTO((rtx, int, rtx, int));\n\n");
- printf ("extern int const_num_delay_slots PROTO((rtx));\n\n");
- have_delay = 1;
- }
-
- for (i = 0; i < XVECLEN (desc, 1); i += 3)
- {
- if (XVECEXP (desc, 1, i + 1) && ! have_annul_true)
- {
- printf ("#define ANNUL_IFTRUE_SLOTS\n");
- printf ("extern int eligible_for_annul_true ();\n");
- have_annul_true = 1;
- }
-
- if (XVECEXP (desc, 1, i + 2) && ! have_annul_false)
- {
- printf ("#define ANNUL_IFFALSE_SLOTS\n");
- printf ("extern int eligible_for_annul_false ();\n");
- have_annul_false = 1;
- }
- }
- }
-
- else if (GET_CODE (desc) == DEFINE_FUNCTION_UNIT)
- {
- char *name = XSTR (desc, 0);
- int multiplicity = XINT (desc, 1);
- int simultaneity = XINT (desc, 2);
- int ready_cost = MAX (XINT (desc, 4), 1);
- int issue_delay = MAX (XINT (desc, 5), 1);
- int issueexp_p = (XVEC (desc, 6) != 0);
-
- for (unit = units; unit; unit = unit->next)
- if (strcmp (unit->name, name) == 0)
- break;
-
- if (unit == 0)
- {
- int len = strlen (name) + 1;
- unit = (struct function_unit *)
- alloca (sizeof (struct function_unit));
- unit->name = (char *) alloca (len);
- bcopy (name, unit->name, len);
- unit->multiplicity = multiplicity;
- unit->simultaneity = simultaneity;
- unit->ready_cost.min = unit->ready_cost.max = ready_cost;
- unit->issue_delay.min = unit->issue_delay.max = issue_delay;
- unit->next = units;
- units = unit;
- num_units++;
-
- extend_range (&all_multiplicity, multiplicity, multiplicity);
- extend_range (&all_simultaneity, simultaneity, simultaneity);
- }
- else if (unit->multiplicity != multiplicity
- || unit->simultaneity != simultaneity)
- fatal ("Differing specifications given for `%s' function unit.",
- unit->name);
-
- extend_range (&unit->ready_cost, ready_cost, ready_cost);
- extend_range (&unit->issue_delay,
- issueexp_p ? 1 : issue_delay, issue_delay);
- extend_range (&all_ready_cost,
- unit->ready_cost.min, unit->ready_cost.max);
- extend_range (&all_issue_delay,
- unit->issue_delay.min, unit->issue_delay.max);
- }
- }
-
- if (num_units > 0)
- {
- /* Compute the range of blockage cost values. See genattrtab.c
- for the derivation. BLOCKAGE (E,C) when SIMULTANEITY is zero is
-
- MAX (ISSUE-DELAY (E,C),
- READY-COST (E) - (READY-COST (C) - 1))
-
- and otherwise
-
- MAX (ISSUE-DELAY (E,C),
- READY-COST (E) - (READY-COST (C) - 1),
- READY-COST (E) - FILL-TIME) */
-
- for (unit = units; unit; unit = unit->next)
- {
- struct range blockage;
-
- blockage = unit->issue_delay;
- blockage.max = MAX (unit->ready_cost.max
- - (unit->ready_cost.min - 1),
- blockage.max);
- blockage.min = MAX (1, blockage.min);
-
- if (unit->simultaneity != 0)
- {
- int fill_time = ((unit->simultaneity - 1)
- * unit->issue_delay.min);
- blockage.min = MAX (unit->ready_cost.min - fill_time,
- blockage.min);
- blockage.max = MAX (unit->ready_cost.max - fill_time,
- blockage.max);
- }
- extend_range (&all_blockage, blockage.min, blockage.max);
- }
-
- write_units (num_units, &all_multiplicity, &all_simultaneity,
- &all_ready_cost, &all_issue_delay, &all_blockage);
- }
-
- /* Output flag masks for use by reorg.
-
- Flags are used to hold branch direction and prediction information
- for use by eligible_for_... */
- printf("\n#define ATTR_FLAG_forward\t0x1\n");
- printf("#define ATTR_FLAG_backward\t0x2\n");
- printf("#define ATTR_FLAG_likely\t0x4\n");
- printf("#define ATTR_FLAG_very_likely\t0x8\n");
- printf("#define ATTR_FLAG_unlikely\t0x10\n");
- printf("#define ATTR_FLAG_very_unlikely\t0x20\n");
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
deleted file mode 100644
index 14ecac1f1e5..00000000000
--- a/gcc/genattrtab.c
+++ /dev/null
@@ -1,5716 +0,0 @@
-/* Generate code from machine description to compute values of attributes.
- Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
-
-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 program handles insn attributes and the DEFINE_DELAY and
- DEFINE_FUNCTION_UNIT definitions.
-
- It produces a series of functions named `get_attr_...', one for each insn
- attribute. Each of these is given the rtx for an insn and returns a member
- of the enum for the attribute.
-
- These subroutines have the form of a `switch' on the INSN_CODE (via
- `recog_memoized'). Each case either returns a constant attribute value
- or a value that depends on tests on other attributes, the form of
- operands, or some random C expression (encoded with a SYMBOL_REF
- expression).
-
- If the attribute `alternative', or a random C expression is present,
- `constrain_operands' is called. If either of these cases of a reference to
- an operand is found, `insn_extract' is called.
-
- The special attribute `length' is also recognized. For this operand,
- expressions involving the address of an operand or the current insn,
- (address (pc)), are valid. In this case, an initial pass is made to
- set all lengths that do not depend on address. Those that do are set to
- the maximum length. Then each insn that depends on an address is checked
- and possibly has its length changed. The process repeats until no further
- changed are made. The resulting lengths are saved for use by
- `get_attr_length'.
-
- A special form of DEFINE_ATTR, where the expression for default value is a
- CONST expression, indicates an attribute that is constant for a given run
- of the compiler. The subroutine generated for these attributes has no
- parameters as it does not depend on any particular insn. Constant
- attributes are typically used to specify which variety of processor is
- used.
-
- Internal attributes are defined to handle DEFINE_DELAY and
- DEFINE_FUNCTION_UNIT. Special routines are output for these cases.
-
- This program works by keeping a list of possible values for each attribute.
- These include the basic attribute choices, default values for attribute, and
- all derived quantities.
-
- As the description file is read, the definition for each insn is saved in a
- `struct insn_def'. When the file reading is complete, a `struct insn_ent'
- is created for each insn and chained to the corresponding attribute value,
- either that specified, or the default.
-
- An optimization phase is then run. This simplifies expressions for each
- insn. EQ_ATTR tests are resolved, whenever possible, to a test that
- indicates when the attribute has the specified value for the insn. This
- avoids recursive calls during compilation.
-
- The strategy used when processing DEFINE_DELAY and DEFINE_FUNCTION_UNIT
- definitions is to create arbitrarily complex expressions and have the
- optimization simplify them.
-
- Once optimization is complete, any required routines and definitions
- will be written.
-
- An optimization that is not yet implemented is to hoist the constant
- expressions entirely out of the routines and definitions that are written.
- A way to do this is to iterate over all possible combinations of values
- for constant attributes and generate a set of functions for that given
- combination. An initialization function would be written that evaluates
- the attributes and installs the corresponding set of routines and
- definitions (each would be accessed through a pointer).
-
- We use the flags in an RTX as follows:
- `unchanging' (RTX_UNCHANGING_P): This rtx is fully simplified
- independent of the insn code.
- `in_struct' (MEM_IN_STRUCT_P): This rtx is fully simplified
- for the insn code currently being processed (see optimize_attrs).
- `integrated' (RTX_INTEGRATED_P): This rtx is permanent and unique
- (see attr_rtx).
- `volatil' (MEM_VOLATILE_P): During simplify_by_exploding the value of an
- EQ_ATTR rtx is true if !volatil and false if volatil. */
-
-
-#include "hconfig.h"
-/* varargs must always be included after *config.h. */
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "rtl.h"
-#include "insn-config.h" /* For REGISTER_CONSTRAINTS */
-#include <stdio.h>
-
-#ifndef VMS
-#ifndef USG
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
-#endif
-
-/* We must include obstack.h after <sys/time.h>, to avoid lossage with
- /usr/include/sys/stdtypes.h on Sun OS 4.x. */
-#include "obstack.h"
-
-static struct obstack obstack, obstack1, obstack2;
-struct obstack *rtl_obstack = &obstack;
-struct obstack *hash_obstack = &obstack1;
-struct obstack *temp_obstack = &obstack2;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function. */
-char **insn_name_ptr = 0;
-
-extern void free ();
-extern rtx read_rtx ();
-
-static void fatal ();
-void fancy_abort ();
-
-/* enough space to reserve for printing out ints */
-#define MAX_DIGITS (HOST_BITS_PER_INT * 3 / 10 + 3)
-
-/* Define structures used to record attributes and values. */
-
-/* As each DEFINE_INSN, DEFINE_PEEPHOLE, or DEFINE_ASM_ATTRIBUTES is
- encountered, we store all the relevant information into a
- `struct insn_def'. This is done to allow attribute definitions to occur
- anywhere in the file. */
-
-struct insn_def
-{
- int insn_code; /* Instruction number. */
- int insn_index; /* Expression numer in file, for errors. */
- struct insn_def *next; /* Next insn in chain. */
- rtx def; /* The DEFINE_... */
- int num_alternatives; /* Number of alternatives. */
- int vec_idx; /* Index of attribute vector in `def'. */
-};
-
-/* Once everything has been read in, we store in each attribute value a list
- of insn codes that have that value. Here is the structure used for the
- list. */
-
-struct insn_ent
-{
- int insn_code; /* Instruction number. */
- int insn_index; /* Index of definition in file */
- struct insn_ent *next; /* Next in chain. */
-};
-
-/* Each value of an attribute (either constant or computed) is assigned a
- structure which is used as the listhead of the insns that have that
- value. */
-
-struct attr_value
-{
- rtx value; /* Value of attribute. */
- struct attr_value *next; /* Next attribute value in chain. */
- struct insn_ent *first_insn; /* First insn with this value. */
- int num_insns; /* Number of insns with this value. */
- int has_asm_insn; /* True if this value used for `asm' insns */
-};
-
-/* Structure for each attribute. */
-
-struct attr_desc
-{
- char *name; /* Name of attribute. */
- struct attr_desc *next; /* Next attribute. */
- int is_numeric; /* Values of this attribute are numeric. */
- int negative_ok; /* Allow negative numeric values. */
- int unsigned_p; /* Make the output function unsigned int. */
- int is_const; /* Attribute value constant for each run. */
- int is_special; /* Don't call `write_attr_set'. */
- struct attr_value *first_value; /* First value of this attribute. */
- struct attr_value *default_val; /* Default value for this attribute. */
-};
-
-#define NULL_ATTR (struct attr_desc *) NULL
-
-/* A range of values. */
-
-struct range
-{
- int min;
- int max;
-};
-
-/* Structure for each DEFINE_DELAY. */
-
-struct delay_desc
-{
- rtx def; /* DEFINE_DELAY expression. */
- struct delay_desc *next; /* Next DEFINE_DELAY. */
- int num; /* Number of DEFINE_DELAY, starting at 1. */
-};
-
-/* Record information about each DEFINE_FUNCTION_UNIT. */
-
-struct function_unit_op
-{
- rtx condexp; /* Expression TRUE for applicable insn. */
- struct function_unit_op *next; /* Next operation for this function unit. */
- int num; /* Ordinal for this operation type in unit. */
- int ready; /* Cost until data is ready. */
- int issue_delay; /* Cost until unit can accept another insn. */
- rtx conflict_exp; /* Expression TRUE for insns incurring issue delay. */
- rtx issue_exp; /* Expression computing issue delay. */
-};
-
-/* Record information about each function unit mentioned in a
- DEFINE_FUNCTION_UNIT. */
-
-struct function_unit
-{
- char *name; /* Function unit name. */
- struct function_unit *next; /* Next function unit. */
- int num; /* Ordinal of this unit type. */
- int multiplicity; /* Number of units of this type. */
- int simultaneity; /* Maximum number of simultaneous insns
- on this function unit or 0 if unlimited. */
- rtx condexp; /* Expression TRUE for insn needing unit. */
- int num_opclasses; /* Number of different operation types. */
- struct function_unit_op *ops; /* Pointer to first operation type. */
- int needs_conflict_function; /* Nonzero if a conflict function required. */
- int needs_blockage_function; /* Nonzero if a blockage function required. */
- int needs_range_function; /* Nonzero if blockage range function needed.*/
- rtx default_cost; /* Conflict cost, if constant. */
- struct range issue_delay; /* Range of issue delay values. */
- int max_blockage; /* Maximum time an insn blocks the unit. */
-};
-
-/* Listheads of above structures. */
-
-/* This one is indexed by the first character of the attribute name. */
-#define MAX_ATTRS_INDEX 256
-static struct attr_desc *attrs[MAX_ATTRS_INDEX];
-static struct insn_def *defs;
-static struct delay_desc *delays;
-static struct function_unit *units;
-
-/* An expression where all the unknown terms are EQ_ATTR tests can be
- rearranged into a COND provided we can enumerate all possible
- combinations of the unknown values. The set of combinations become the
- tests of the COND; the value of the expression given that combination is
- computed and becomes the corresponding value. To do this, we must be
- able to enumerate all values for each attribute used in the expression
- (currently, we give up if we find a numeric attribute).
-
- If the set of EQ_ATTR tests used in an expression tests the value of N
- different attributes, the list of all possible combinations can be made
- by walking the N-dimensional attribute space defined by those
- attributes. We record each of these as a struct dimension.
-
- The algorithm relies on sharing EQ_ATTR nodes: if two nodes in an
- expression are the same, the will also have the same address. We find
- all the EQ_ATTR nodes by marking them MEM_VOLATILE_P. This bit later
- represents the value of an EQ_ATTR node, so once all nodes are marked,
- they are also given an initial value of FALSE.
-
- We then separate the set of EQ_ATTR nodes into dimensions for each
- attribute and put them on the VALUES list. Terms are added as needed by
- `add_values_to_cover' so that all possible values of the attribute are
- tested.
-
- Each dimension also has a current value. This is the node that is
- currently considered to be TRUE. If this is one of the nodes added by
- `add_values_to_cover', all the EQ_ATTR tests in the original expression
- will be FALSE. Otherwise, only the CURRENT_VALUE will be true.
-
- NUM_VALUES is simply the length of the VALUES list and is there for
- convenience.
-
- Once the dimensions are created, the algorithm enumerates all possible
- values and computes the current value of the given expression. */
-
-struct dimension
-{
- struct attr_desc *attr; /* Attribute for this dimension. */
- rtx values; /* List of attribute values used. */
- rtx current_value; /* Position in the list for the TRUE value. */
- int num_values; /* Length of the values list. */
-};
-
-/* Other variables. */
-
-static int insn_code_number;
-static int insn_index_number;
-static int got_define_asm_attributes;
-static int must_extract;
-static int must_constrain;
-static int address_used;
-static int length_used;
-static int num_delays;
-static int have_annul_true, have_annul_false;
-static int num_units;
-static int num_insn_ents;
-
-/* Used as operand to `operate_exp': */
-
-enum operator {PLUS_OP, MINUS_OP, POS_MINUS_OP, EQ_OP, OR_OP, MAX_OP, MIN_OP, RANGE_OP};
-
-/* Stores, for each insn code, the number of constraint alternatives. */
-
-static int *insn_n_alternatives;
-
-/* Stores, for each insn code, a bitmap that has bits on for each possible
- alternative. */
-
-static int *insn_alternatives;
-
-/* If nonzero, assume that the `alternative' attr has this value.
- This is the hashed, unique string for the numeral
- whose value is chosen alternative. */
-
-static char *current_alternative_string;
-
-/* Used to simplify expressions. */
-
-static rtx true_rtx, false_rtx;
-
-/* Used to reduce calls to `strcmp' */
-
-static char *alternative_name;
-
-/* Simplify an expression. Only call the routine if there is something to
- simplify. */
-#define SIMPLIFY_TEST_EXP(EXP,INSN_CODE,INSN_INDEX) \
- (RTX_UNCHANGING_P (EXP) || MEM_IN_STRUCT_P (EXP) ? (EXP) \
- : simplify_test_exp (EXP, INSN_CODE, INSN_INDEX))
-
-/* Simplify (eq_attr ("alternative") ...)
- when we are working with a particular alternative. */
-#define SIMPLIFY_ALTERNATIVE(EXP) \
- if (current_alternative_string \
- && GET_CODE ((EXP)) == EQ_ATTR \
- && XSTR ((EXP), 0) == alternative_name) \
- (EXP) = (XSTR ((EXP), 1) == current_alternative_string \
- ? true_rtx : false_rtx);
-
-/* These are referenced by rtlanal.c and hence need to be defined somewhere.
- They won't actually be used. */
-
-rtx frame_pointer_rtx, hard_frame_pointer_rtx, stack_pointer_rtx;
-rtx arg_pointer_rtx;
-
-static rtx attr_rtx PVPROTO((enum rtx_code, ...));
-#ifdef HAVE_VPRINTF
-static char *attr_printf PVPROTO((int, char *, ...));
-#else
-static char *attr_printf ();
-#endif
-
-static char *attr_string PROTO((char *, int));
-static rtx check_attr_test PROTO((rtx, int));
-static rtx check_attr_value PROTO((rtx, struct attr_desc *));
-static rtx convert_set_attr_alternative PROTO((rtx, int, int, int));
-static rtx convert_set_attr PROTO((rtx, int, int, int));
-static void check_defs PROTO((void));
-static rtx convert_const_symbol_ref PROTO((rtx, struct attr_desc *));
-static rtx make_canonical PROTO((struct attr_desc *, rtx));
-static struct attr_value *get_attr_value PROTO((rtx, struct attr_desc *, int));
-static rtx copy_rtx_unchanging PROTO((rtx));
-static rtx copy_boolean PROTO((rtx));
-static void expand_delays PROTO((void));
-static rtx operate_exp PROTO((enum operator, rtx, rtx));
-static void expand_units PROTO((void));
-static rtx simplify_knowing PROTO((rtx, rtx));
-static rtx encode_units_mask PROTO((rtx));
-static void fill_attr PROTO((struct attr_desc *));
-/* dpx2 compiler chokes if we specify the arg types of the args. */
-static rtx substitute_address PROTO((rtx, rtx (*) (), rtx (*) ()));
-static void make_length_attrs PROTO((void));
-static rtx identity_fn PROTO((rtx));
-static rtx zero_fn PROTO((rtx));
-static rtx one_fn PROTO((rtx));
-static rtx max_fn PROTO((rtx));
-static rtx simplify_cond PROTO((rtx, int, int));
-static rtx simplify_by_alternatives PROTO((rtx, int, int));
-static rtx simplify_by_exploding PROTO((rtx));
-static int find_and_mark_used_attributes PROTO((rtx, rtx *, int *));
-static void unmark_used_attributes PROTO((rtx, struct dimension *, int));
-static int add_values_to_cover PROTO((struct dimension *));
-static int increment_current_value PROTO((struct dimension *, int));
-static rtx test_for_current_value PROTO((struct dimension *, int));
-static rtx simplify_with_current_value PROTO((rtx, struct dimension *, int));
-static rtx simplify_with_current_value_aux PROTO((rtx));
-static void clear_struct_flag PROTO((rtx));
-static int count_sub_rtxs PROTO((rtx, int));
-static void remove_insn_ent PROTO((struct attr_value *, struct insn_ent *));
-static void insert_insn_ent PROTO((struct attr_value *, struct insn_ent *));
-static rtx insert_right_side PROTO((enum rtx_code, rtx, rtx, int, int));
-static rtx make_alternative_compare PROTO((int));
-static int compute_alternative_mask PROTO((rtx, enum rtx_code));
-static rtx evaluate_eq_attr PROTO((rtx, rtx, int, int));
-static rtx simplify_and_tree PROTO((rtx, rtx *, int, int));
-static rtx simplify_or_tree PROTO((rtx, rtx *, int, int));
-static rtx simplify_test_exp PROTO((rtx, int, int));
-static void optimize_attrs PROTO((void));
-static void gen_attr PROTO((rtx));
-static int count_alternatives PROTO((rtx));
-static int compares_alternatives_p PROTO((rtx));
-static int contained_in_p PROTO((rtx, rtx));
-static void gen_insn PROTO((rtx));
-static void gen_delay PROTO((rtx));
-static void gen_unit PROTO((rtx));
-static void write_test_expr PROTO((rtx, int));
-static int max_attr_value PROTO((rtx));
-static void walk_attr_value PROTO((rtx));
-static void write_attr_get PROTO((struct attr_desc *));
-static rtx eliminate_known_true PROTO((rtx, rtx, int, int));
-static void write_attr_set PROTO((struct attr_desc *, int, rtx, char *,
- char *, rtx, int, int));
-static void write_attr_case PROTO((struct attr_desc *, struct attr_value *,
- int, char *, char *, int, rtx));
-static void write_attr_valueq PROTO((struct attr_desc *, char *));
-static void write_attr_value PROTO((struct attr_desc *, rtx));
-static void write_upcase PROTO((char *));
-static void write_indent PROTO((int));
-static void write_eligible_delay PROTO((char *));
-static void write_function_unit_info PROTO((void));
-static void write_complex_function PROTO((struct function_unit *, char *,
- char *));
-static int n_comma_elts PROTO((char *));
-static char *next_comma_elt PROTO((char **));
-static struct attr_desc *find_attr PROTO((char *, int));
-static void make_internal_attr PROTO((char *, rtx, int));
-static struct attr_value *find_most_used PROTO((struct attr_desc *));
-static rtx find_single_value PROTO((struct attr_desc *));
-static rtx make_numeric_value PROTO((int));
-static void extend_range PROTO((struct range *, int, int));
-char *xrealloc PROTO((char *, unsigned));
-char *xmalloc PROTO((unsigned));
-
-#define oballoc(size) obstack_alloc (hash_obstack, size)
-
-
-/* Hash table for sharing RTL and strings. */
-
-/* Each hash table slot is a bucket containing a chain of these structures.
- Strings are given negative hash codes; RTL expressions are given positive
- hash codes. */
-
-struct attr_hash
-{
- struct attr_hash *next; /* Next structure in the bucket. */
- int hashcode; /* Hash code of this rtx or string. */
- union
- {
- char *str; /* The string (negative hash codes) */
- rtx rtl; /* or the RTL recorded here. */
- } u;
-};
-
-/* Now here is the hash table. When recording an RTL, it is added to
- the slot whose index is the hash code mod the table size. Note
- that the hash table is used for several kinds of RTL (see attr_rtx)
- and for strings. While all these live in the same table, they are
- completely independent, and the hash code is computed differently
- for each. */
-
-#define RTL_HASH_SIZE 4093
-struct attr_hash *attr_hash_table[RTL_HASH_SIZE];
-
-/* Here is how primitive or already-shared RTL's hash
- codes are made. */
-#define RTL_HASH(RTL) ((HOST_WIDE_INT) (RTL) & 0777777)
-
-/* Add an entry to the hash table for RTL with hash code HASHCODE. */
-
-static void
-attr_hash_add_rtx (hashcode, rtl)
- int hashcode;
- rtx rtl;
-{
- register struct attr_hash *h;
-
- h = (struct attr_hash *) obstack_alloc (hash_obstack,
- sizeof (struct attr_hash));
- h->hashcode = hashcode;
- h->u.rtl = rtl;
- h->next = attr_hash_table[hashcode % RTL_HASH_SIZE];
- attr_hash_table[hashcode % RTL_HASH_SIZE] = h;
-}
-
-/* Add an entry to the hash table for STRING with hash code HASHCODE. */
-
-static void
-attr_hash_add_string (hashcode, str)
- int hashcode;
- char *str;
-{
- register struct attr_hash *h;
-
- h = (struct attr_hash *) obstack_alloc (hash_obstack,
- sizeof (struct attr_hash));
- h->hashcode = -hashcode;
- h->u.str = str;
- h->next = attr_hash_table[hashcode % RTL_HASH_SIZE];
- attr_hash_table[hashcode % RTL_HASH_SIZE] = h;
-}
-
-/* Generate an RTL expression, but avoid duplicates.
- Set the RTX_INTEGRATED_P flag for these permanent objects.
-
- In some cases we cannot uniquify; then we return an ordinary
- impermanent rtx with RTX_INTEGRATED_P clear.
-
- Args are like gen_rtx, but without the mode:
-
- rtx attr_rtx (code, [element1, ..., elementn]) */
-
-/*VARARGS1*/
-static rtx
-attr_rtx VPROTO((enum rtx_code code, ...))
-{
-#ifndef __STDC__
- enum rtx_code code;
-#endif
- va_list p;
- register int i; /* Array indices... */
- register char *fmt; /* Current rtx's format... */
- register rtx rt_val; /* RTX to return to caller... */
- int hashcode;
- register struct attr_hash *h;
- struct obstack *old_obstack = rtl_obstack;
-
- VA_START (p, code);
-
-#ifndef __STDC__
- code = va_arg (p, enum rtx_code);
-#endif
-
- /* For each of several cases, search the hash table for an existing entry.
- Use that entry if one is found; otherwise create a new RTL and add it
- to the table. */
-
- if (GET_RTX_CLASS (code) == '1')
- {
- rtx arg0 = va_arg (p, rtx);
-
- /* A permanent object cannot point to impermanent ones. */
- if (! RTX_INTEGRATED_P (arg0))
- {
- rt_val = rtx_alloc (code);
- XEXP (rt_val, 0) = arg0;
- va_end (p);
- return rt_val;
- }
-
- hashcode = ((HOST_WIDE_INT) code + RTL_HASH (arg0));
- for (h = attr_hash_table[hashcode % RTL_HASH_SIZE]; h; h = h->next)
- if (h->hashcode == hashcode
- && GET_CODE (h->u.rtl) == code
- && XEXP (h->u.rtl, 0) == arg0)
- goto found;
-
- if (h == 0)
- {
- rtl_obstack = hash_obstack;
- rt_val = rtx_alloc (code);
- XEXP (rt_val, 0) = arg0;
- }
- }
- else if (GET_RTX_CLASS (code) == 'c'
- || GET_RTX_CLASS (code) == '2'
- || GET_RTX_CLASS (code) == '<')
- {
- rtx arg0 = va_arg (p, rtx);
- rtx arg1 = va_arg (p, rtx);
-
- /* A permanent object cannot point to impermanent ones. */
- if (! RTX_INTEGRATED_P (arg0) || ! RTX_INTEGRATED_P (arg1))
- {
- rt_val = rtx_alloc (code);
- XEXP (rt_val, 0) = arg0;
- XEXP (rt_val, 1) = arg1;
- va_end (p);
- return rt_val;
- }
-
- hashcode = ((HOST_WIDE_INT) code + RTL_HASH (arg0) + RTL_HASH (arg1));
- for (h = attr_hash_table[hashcode % RTL_HASH_SIZE]; h; h = h->next)
- if (h->hashcode == hashcode
- && GET_CODE (h->u.rtl) == code
- && XEXP (h->u.rtl, 0) == arg0
- && XEXP (h->u.rtl, 1) == arg1)
- goto found;
-
- if (h == 0)
- {
- rtl_obstack = hash_obstack;
- rt_val = rtx_alloc (code);
- XEXP (rt_val, 0) = arg0;
- XEXP (rt_val, 1) = arg1;
- }
- }
- else if (GET_RTX_LENGTH (code) == 1
- && GET_RTX_FORMAT (code)[0] == 's')
- {
- char * arg0 = va_arg (p, char *);
-
- if (code == SYMBOL_REF)
- arg0 = attr_string (arg0, strlen (arg0));
-
- hashcode = ((HOST_WIDE_INT) code + RTL_HASH (arg0));
- for (h = attr_hash_table[hashcode % RTL_HASH_SIZE]; h; h = h->next)
- if (h->hashcode == hashcode
- && GET_CODE (h->u.rtl) == code
- && XSTR (h->u.rtl, 0) == arg0)
- goto found;
-
- if (h == 0)
- {
- rtl_obstack = hash_obstack;
- rt_val = rtx_alloc (code);
- XSTR (rt_val, 0) = arg0;
- }
- }
- else if (GET_RTX_LENGTH (code) == 2
- && GET_RTX_FORMAT (code)[0] == 's'
- && GET_RTX_FORMAT (code)[1] == 's')
- {
- char *arg0 = va_arg (p, char *);
- char *arg1 = va_arg (p, char *);
-
- hashcode = ((HOST_WIDE_INT) code + RTL_HASH (arg0) + RTL_HASH (arg1));
- for (h = attr_hash_table[hashcode % RTL_HASH_SIZE]; h; h = h->next)
- if (h->hashcode == hashcode
- && GET_CODE (h->u.rtl) == code
- && XSTR (h->u.rtl, 0) == arg0
- && XSTR (h->u.rtl, 1) == arg1)
- goto found;
-
- if (h == 0)
- {
- rtl_obstack = hash_obstack;
- rt_val = rtx_alloc (code);
- XSTR (rt_val, 0) = arg0;
- XSTR (rt_val, 1) = arg1;
- }
- }
- else if (code == CONST_INT)
- {
- HOST_WIDE_INT arg0 = va_arg (p, HOST_WIDE_INT);
- if (arg0 == 0)
- return false_rtx;
- if (arg0 == 1)
- return true_rtx;
- goto nohash;
- }
- else
- {
- nohash:
- rt_val = rtx_alloc (code); /* Allocate the storage space. */
-
- fmt = GET_RTX_FORMAT (code); /* Find the right format... */
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*fmt++)
- {
- case '0': /* Unused field. */
- break;
-
- case 'i': /* An integer? */
- XINT (rt_val, i) = va_arg (p, int);
- break;
-
- case 'w': /* A wide integer? */
- XWINT (rt_val, i) = va_arg (p, HOST_WIDE_INT);
- break;
-
- case 's': /* A string? */
- XSTR (rt_val, i) = va_arg (p, char *);
- break;
-
- case 'e': /* An expression? */
- case 'u': /* An insn? Same except when printing. */
- XEXP (rt_val, i) = va_arg (p, rtx);
- break;
-
- case 'E': /* An RTX vector? */
- XVEC (rt_val, i) = va_arg (p, rtvec);
- break;
-
- default:
- abort();
- }
- }
- va_end (p);
- return rt_val;
- }
-
- rtl_obstack = old_obstack;
- va_end (p);
- attr_hash_add_rtx (hashcode, rt_val);
- RTX_INTEGRATED_P (rt_val) = 1;
- return rt_val;
-
- found:
- va_end (p);
- return h->u.rtl;
-}
-
-/* Create a new string printed with the printf line arguments into a space
- of at most LEN bytes:
-
- rtx attr_printf (len, format, [arg1, ..., argn]) */
-
-#ifdef HAVE_VPRINTF
-
-/*VARARGS2*/
-static char *
-attr_printf VPROTO((register int len, char *fmt, ...))
-{
-#ifndef __STDC__
- register int len;
- char *fmt;
-#endif
- va_list p;
- register char *str;
-
- VA_START (p, fmt);
-
-#ifndef __STDC__
- len = va_arg (p, int);
- fmt = va_arg (p, char *);
-#endif
-
- /* Print the string into a temporary location. */
- str = (char *) alloca (len);
- vsprintf (str, fmt, p);
- va_end (p);
-
- return attr_string (str, strlen (str));
-}
-
-#else /* not HAVE_VPRINTF */
-
-static char *
-attr_printf (len, fmt, arg1, arg2, arg3)
- int len;
- char *fmt;
- char *arg1, *arg2, *arg3; /* also int */
-{
- register char *str;
-
- /* Print the string into a temporary location. */
- str = (char *) alloca (len);
- sprintf (str, fmt, arg1, arg2, arg3);
-
- return attr_string (str, strlen (str));
-}
-#endif /* not HAVE_VPRINTF */
-
-rtx
-attr_eq (name, value)
- char *name, *value;
-{
- return attr_rtx (EQ_ATTR, attr_string (name, strlen (name)),
- attr_string (value, strlen (value)));
-}
-
-char *
-attr_numeral (n)
- int n;
-{
- return XSTR (make_numeric_value (n), 0);
-}
-
-/* Return a permanent (possibly shared) copy of a string STR (not assumed
- to be null terminated) with LEN bytes. */
-
-static char *
-attr_string (str, len)
- char *str;
- int len;
-{
- register struct attr_hash *h;
- int hashcode;
- int i;
- register char *new_str;
-
- /* Compute the hash code. */
- hashcode = (len + 1) * 613 + (unsigned)str[0];
- for (i = 1; i <= len; i += 2)
- hashcode = ((hashcode * 613) + (unsigned)str[i]);
- if (hashcode < 0)
- hashcode = -hashcode;
-
- /* Search the table for the string. */
- for (h = attr_hash_table[hashcode % RTL_HASH_SIZE]; h; h = h->next)
- if (h->hashcode == -hashcode && h->u.str[0] == str[0]
- && !strncmp (h->u.str, str, len))
- return h->u.str; /* <-- return if found. */
-
- /* Not found; create a permanent copy and add it to the hash table. */
- new_str = (char *) obstack_alloc (hash_obstack, len + 1);
- bcopy (str, new_str, len);
- new_str[len] = '\0';
- attr_hash_add_string (hashcode, new_str);
-
- return new_str; /* Return the new string. */
-}
-
-/* Check two rtx's for equality of contents,
- taking advantage of the fact that if both are hashed
- then they can't be equal unless they are the same object. */
-
-int
-attr_equal_p (x, y)
- rtx x, y;
-{
- return (x == y || (! (RTX_INTEGRATED_P (x) && RTX_INTEGRATED_P (y))
- && rtx_equal_p (x, y)));
-}
-
-/* Copy an attribute value expression,
- descending to all depths, but not copying any
- permanent hashed subexpressions. */
-
-rtx
-attr_copy_rtx (orig)
- register rtx orig;
-{
- register rtx copy;
- register int i, j;
- register RTX_CODE code;
- register char *format_ptr;
-
- /* No need to copy a permanent object. */
- if (RTX_INTEGRATED_P (orig))
- return orig;
-
- code = GET_CODE (orig);
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- return orig;
- }
-
- copy = rtx_alloc (code);
- PUT_MODE (copy, GET_MODE (orig));
- copy->in_struct = orig->in_struct;
- copy->volatil = orig->volatil;
- copy->unchanging = orig->unchanging;
- copy->integrated = orig->integrated;
-
- format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- XEXP (copy, i) = XEXP (orig, i);
- if (XEXP (orig, i) != NULL)
- XEXP (copy, i) = attr_copy_rtx (XEXP (orig, i));
- break;
-
- case 'E':
- case 'V':
- XVEC (copy, i) = XVEC (orig, i);
- if (XVEC (orig, i) != NULL)
- {
- XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
- for (j = 0; j < XVECLEN (copy, i); j++)
- XVECEXP (copy, i, j) = attr_copy_rtx (XVECEXP (orig, i, j));
- }
- break;
-
- case 'n':
- case 'i':
- XINT (copy, i) = XINT (orig, i);
- break;
-
- case 'w':
- XWINT (copy, i) = XWINT (orig, i);
- break;
-
- case 's':
- case 'S':
- XSTR (copy, i) = XSTR (orig, i);
- break;
-
- default:
- abort ();
- }
- }
- return copy;
-}
-
-/* Given a test expression for an attribute, ensure it is validly formed.
- IS_CONST indicates whether the expression is constant for each compiler
- run (a constant expression may not test any particular insn).
-
- Convert (eq_attr "att" "a1,a2") to (ior (eq_attr ... ) (eq_attrq ..))
- and (eq_attr "att" "!a1") to (not (eq_attr "att" "a1")). Do the latter
- test first so that (eq_attr "att" "!a1,a2,a3") works as expected.
-
- Update the string address in EQ_ATTR expression to be the same used
- in the attribute (or `alternative_name') to speed up subsequent
- `find_attr' calls and eliminate most `strcmp' calls.
-
- Return the new expression, if any. */
-
-static rtx
-check_attr_test (exp, is_const)
- rtx exp;
- int is_const;
-{
- struct attr_desc *attr;
- struct attr_value *av;
- char *name_ptr, *p;
- rtx orexp, newexp;
-
- switch (GET_CODE (exp))
- {
- case EQ_ATTR:
- /* Handle negation test. */
- if (XSTR (exp, 1)[0] == '!')
- return check_attr_test (attr_rtx (NOT,
- attr_eq (XSTR (exp, 0),
- &XSTR (exp, 1)[1])),
- is_const);
-
- else if (n_comma_elts (XSTR (exp, 1)) == 1)
- {
- attr = find_attr (XSTR (exp, 0), 0);
- if (attr == NULL)
- {
- if (! strcmp (XSTR (exp, 0), "alternative"))
- {
- XSTR (exp, 0) = alternative_name;
- /* This can't be simplified any further. */
- RTX_UNCHANGING_P (exp) = 1;
- return exp;
- }
- else
- fatal ("Unknown attribute `%s' in EQ_ATTR", XEXP (exp, 0));
- }
-
- if (is_const && ! attr->is_const)
- fatal ("Constant expression uses insn attribute `%s' in EQ_ATTR",
- XEXP (exp, 0));
-
- /* Copy this just to make it permanent,
- so expressions using it can be permanent too. */
- exp = attr_eq (XSTR (exp, 0), XSTR (exp, 1));
-
- /* It shouldn't be possible to simplify the value given to a
- constant attribute, so don't expand this until it's time to
- write the test expression. */
- if (attr->is_const)
- RTX_UNCHANGING_P (exp) = 1;
-
- if (attr->is_numeric)
- {
- for (p = XSTR (exp, 1); *p; p++)
- if (*p < '0' || *p > '9')
- fatal ("Attribute `%s' takes only numeric values",
- XEXP (exp, 0));
- }
- else
- {
- for (av = attr->first_value; av; av = av->next)
- if (GET_CODE (av->value) == CONST_STRING
- && ! strcmp (XSTR (exp, 1), XSTR (av->value, 0)))
- break;
-
- if (av == NULL)
- fatal ("Unknown value `%s' for `%s' attribute",
- XEXP (exp, 1), XEXP (exp, 0));
- }
- }
- else
- {
- /* Make an IOR tree of the possible values. */
- orexp = false_rtx;
- name_ptr = XSTR (exp, 1);
- while ((p = next_comma_elt (&name_ptr)) != NULL)
- {
- newexp = attr_eq (XSTR (exp, 0), p);
- orexp = insert_right_side (IOR, orexp, newexp, -2, -2);
- }
-
- return check_attr_test (orexp, is_const);
- }
- break;
-
- case ATTR_FLAG:
- break;
-
- case CONST_INT:
- /* Either TRUE or FALSE. */
- if (XWINT (exp, 0))
- return true_rtx;
- else
- return false_rtx;
-
- case IOR:
- case AND:
- XEXP (exp, 0) = check_attr_test (XEXP (exp, 0), is_const);
- XEXP (exp, 1) = check_attr_test (XEXP (exp, 1), is_const);
- break;
-
- case NOT:
- XEXP (exp, 0) = check_attr_test (XEXP (exp, 0), is_const);
- break;
-
- case MATCH_OPERAND:
- if (is_const)
- fatal ("RTL operator \"%s\" not valid in constant attribute test",
- GET_RTX_NAME (MATCH_OPERAND));
- /* These cases can't be simplified. */
- RTX_UNCHANGING_P (exp) = 1;
- break;
-
- case LE: case LT: case GT: case GE:
- case LEU: case LTU: case GTU: case GEU:
- case NE: case EQ:
- if (GET_CODE (XEXP (exp, 0)) == SYMBOL_REF
- && GET_CODE (XEXP (exp, 1)) == SYMBOL_REF)
- exp = attr_rtx (GET_CODE (exp),
- attr_rtx (SYMBOL_REF, XSTR (XEXP (exp, 0), 0)),
- attr_rtx (SYMBOL_REF, XSTR (XEXP (exp, 1), 0)));
- /* These cases can't be simplified. */
- RTX_UNCHANGING_P (exp) = 1;
- break;
-
- case SYMBOL_REF:
- if (is_const)
- {
- /* These cases are valid for constant attributes, but can't be
- simplified. */
- exp = attr_rtx (SYMBOL_REF, XSTR (exp, 0));
- RTX_UNCHANGING_P (exp) = 1;
- break;
- }
- default:
- fatal ("RTL operator \"%s\" not valid in attribute test",
- GET_RTX_NAME (GET_CODE (exp)));
- }
-
- return exp;
-}
-
-/* Given an expression, ensure that it is validly formed and that all named
- attribute values are valid for the given attribute. Issue a fatal error
- if not. If no attribute is specified, assume a numeric attribute.
-
- Return a perhaps modified replacement expression for the value. */
-
-static rtx
-check_attr_value (exp, attr)
- rtx exp;
- struct attr_desc *attr;
-{
- struct attr_value *av;
- char *p;
- int i;
-
- switch (GET_CODE (exp))
- {
- case CONST_INT:
- if (attr && ! attr->is_numeric)
- fatal ("CONST_INT not valid for non-numeric `%s' attribute",
- attr->name);
-
- if (INTVAL (exp) < 0)
- fatal ("Negative numeric value specified for `%s' attribute",
- attr->name);
-
- break;
-
- case CONST_STRING:
- if (! strcmp (XSTR (exp, 0), "*"))
- break;
-
- if (attr == 0 || attr->is_numeric)
- {
- p = XSTR (exp, 0);
- if (attr && attr->negative_ok && *p == '-')
- p++;
- for (; *p; p++)
- if (*p > '9' || *p < '0')
- fatal ("Non-numeric value for numeric `%s' attribute",
- attr ? attr->name : "internal");
- break;
- }
-
- for (av = attr->first_value; av; av = av->next)
- if (GET_CODE (av->value) == CONST_STRING
- && ! strcmp (XSTR (av->value, 0), XSTR (exp, 0)))
- break;
-
- if (av == NULL)
- fatal ("Unknown value `%s' for `%s' attribute",
- XSTR (exp, 0), attr ? attr->name : "internal");
-
- break;
-
- case IF_THEN_ELSE:
- XEXP (exp, 0) = check_attr_test (XEXP (exp, 0),
- attr ? attr->is_const : 0);
- XEXP (exp, 1) = check_attr_value (XEXP (exp, 1), attr);
- XEXP (exp, 2) = check_attr_value (XEXP (exp, 2), attr);
- break;
-
- case COND:
- if (XVECLEN (exp, 0) % 2 != 0)
- fatal ("First operand of COND must have even length");
-
- for (i = 0; i < XVECLEN (exp, 0); i += 2)
- {
- XVECEXP (exp, 0, i) = check_attr_test (XVECEXP (exp, 0, i),
- attr ? attr->is_const : 0);
- XVECEXP (exp, 0, i + 1)
- = check_attr_value (XVECEXP (exp, 0, i + 1), attr);
- }
-
- XEXP (exp, 1) = check_attr_value (XEXP (exp, 1), attr);
- break;
-
- case SYMBOL_REF:
- if (attr && attr->is_const)
- /* A constant SYMBOL_REF is valid as a constant attribute test and
- is expanded later by make_canonical into a COND. */
- return attr_rtx (SYMBOL_REF, XSTR (exp, 0));
- /* Otherwise, fall through... */
-
- default:
- fatal ("Invalid operation `%s' for attribute value",
- GET_RTX_NAME (GET_CODE (exp)));
- }
-
- return exp;
-}
-
-/* Given an SET_ATTR_ALTERNATIVE expression, convert to the canonical SET.
- It becomes a COND with each test being (eq_attr "alternative "n") */
-
-static rtx
-convert_set_attr_alternative (exp, num_alt, insn_code, insn_index)
- rtx exp;
- int num_alt;
- int insn_code, insn_index;
-{
- rtx condexp;
- int i;
-
- if (XVECLEN (exp, 1) != num_alt)
- fatal ("Bad number of entries in SET_ATTR_ALTERNATIVE for insn %d",
- insn_index);
-
- /* Make a COND with all tests but the last. Select the last value via the
- default. */
- condexp = rtx_alloc (COND);
- XVEC (condexp, 0) = rtvec_alloc ((num_alt - 1) * 2);
-
- for (i = 0; i < num_alt - 1; i++)
- {
- char *p;
- p = attr_numeral (i);
-
- XVECEXP (condexp, 0, 2 * i) = attr_eq (alternative_name, p);
-#if 0
- /* Sharing this EQ_ATTR rtl causes trouble. */
- XVECEXP (condexp, 0, 2 * i) = rtx_alloc (EQ_ATTR);
- XSTR (XVECEXP (condexp, 0, 2 * i), 0) = alternative_name;
- XSTR (XVECEXP (condexp, 0, 2 * i), 1) = p;
-#endif
- XVECEXP (condexp, 0, 2 * i + 1) = XVECEXP (exp, 1, i);
- }
-
- XEXP (condexp, 1) = XVECEXP (exp, 1, i);
-
- return attr_rtx (SET, attr_rtx (ATTR, XSTR (exp, 0)), condexp);
-}
-
-/* Given a SET_ATTR, convert to the appropriate SET. If a comma-separated
- list of values is given, convert to SET_ATTR_ALTERNATIVE first. */
-
-static rtx
-convert_set_attr (exp, num_alt, insn_code, insn_index)
- rtx exp;
- int num_alt;
- int insn_code, insn_index;
-{
- rtx newexp;
- char *name_ptr;
- char *p;
- int n;
-
- /* See how many alternative specified. */
- n = n_comma_elts (XSTR (exp, 1));
- if (n == 1)
- return attr_rtx (SET,
- attr_rtx (ATTR, XSTR (exp, 0)),
- attr_rtx (CONST_STRING, XSTR (exp, 1)));
-
- newexp = rtx_alloc (SET_ATTR_ALTERNATIVE);
- XSTR (newexp, 0) = XSTR (exp, 0);
- XVEC (newexp, 1) = rtvec_alloc (n);
-
- /* Process each comma-separated name. */
- name_ptr = XSTR (exp, 1);
- n = 0;
- while ((p = next_comma_elt (&name_ptr)) != NULL)
- XVECEXP (newexp, 1, n++) = attr_rtx (CONST_STRING, p);
-
- return convert_set_attr_alternative (newexp, num_alt, insn_code, insn_index);
-}
-
-/* Scan all definitions, checking for validity. Also, convert any SET_ATTR
- and SET_ATTR_ALTERNATIVE expressions to the corresponding SET
- expressions. */
-
-static void
-check_defs ()
-{
- struct insn_def *id;
- struct attr_desc *attr;
- int i;
- rtx value;
-
- for (id = defs; id; id = id->next)
- {
- if (XVEC (id->def, id->vec_idx) == NULL)
- continue;
-
- for (i = 0; i < XVECLEN (id->def, id->vec_idx); i++)
- {
- value = XVECEXP (id->def, id->vec_idx, i);
- switch (GET_CODE (value))
- {
- case SET:
- if (GET_CODE (XEXP (value, 0)) != ATTR)
- fatal ("Bad attribute set in pattern %d", id->insn_index);
- break;
-
- case SET_ATTR_ALTERNATIVE:
- value = convert_set_attr_alternative (value,
- id->num_alternatives,
- id->insn_code,
- id->insn_index);
- break;
-
- case SET_ATTR:
- value = convert_set_attr (value, id->num_alternatives,
- id->insn_code, id->insn_index);
- break;
-
- default:
- fatal ("Invalid attribute code `%s' for pattern %d",
- GET_RTX_NAME (GET_CODE (value)), id->insn_index);
- }
-
- if ((attr = find_attr (XSTR (XEXP (value, 0), 0), 0)) == NULL)
- fatal ("Unknown attribute `%s' for pattern number %d",
- XSTR (XEXP (value, 0), 0), id->insn_index);
-
- XVECEXP (id->def, id->vec_idx, i) = value;
- XEXP (value, 1) = check_attr_value (XEXP (value, 1), attr);
- }
- }
-}
-
-/* Given a constant SYMBOL_REF expression, convert to a COND that
- explicitly tests each enumerated value. */
-
-static rtx
-convert_const_symbol_ref (exp, attr)
- rtx exp;
- struct attr_desc *attr;
-{
- rtx condexp;
- struct attr_value *av;
- int i;
- int num_alt = 0;
-
- for (av = attr->first_value; av; av = av->next)
- num_alt++;
-
- /* Make a COND with all tests but the last, and in the original order.
- Select the last value via the default. Note that the attr values
- are constructed in reverse order. */
-
- condexp = rtx_alloc (COND);
- XVEC (condexp, 0) = rtvec_alloc ((num_alt - 1) * 2);
- av = attr->first_value;
- XEXP (condexp, 1) = av->value;
-
- for (i = num_alt - 2; av = av->next, i >= 0; i--)
- {
- char *p, *string;
- rtx value;
-
- string = p = (char *) oballoc (2
- + strlen (attr->name)
- + strlen (XSTR (av->value, 0)));
- strcpy (p, attr->name);
- strcat (p, "_");
- strcat (p, XSTR (av->value, 0));
- for (; *p != '\0'; p++)
- if (*p >= 'a' && *p <= 'z')
- *p -= 'a' - 'A';
-
- value = attr_rtx (SYMBOL_REF, string);
- RTX_UNCHANGING_P (value) = 1;
-
- XVECEXP (condexp, 0, 2 * i) = attr_rtx (EQ, exp, value);
-
- XVECEXP (condexp, 0, 2 * i + 1) = av->value;
- }
-
- return condexp;
-}
-
-/* Given a valid expression for an attribute value, remove any IF_THEN_ELSE
- expressions by converting them into a COND. This removes cases from this
- program. Also, replace an attribute value of "*" with the default attribute
- value. */
-
-static rtx
-make_canonical (attr, exp)
- struct attr_desc *attr;
- rtx exp;
-{
- int i;
- rtx newexp;
-
- switch (GET_CODE (exp))
- {
- case CONST_INT:
- exp = make_numeric_value (INTVAL (exp));
- break;
-
- case CONST_STRING:
- if (! strcmp (XSTR (exp, 0), "*"))
- {
- if (attr == 0 || attr->default_val == 0)
- fatal ("(attr_value \"*\") used in invalid context.");
- exp = attr->default_val->value;
- }
-
- break;
-
- case SYMBOL_REF:
- if (!attr->is_const || RTX_UNCHANGING_P (exp))
- break;
- /* The SYMBOL_REF is constant for a given run, so mark it as unchanging.
- This makes the COND something that won't be considered an arbitrary
- expression by walk_attr_value. */
- RTX_UNCHANGING_P (exp) = 1;
- exp = convert_const_symbol_ref (exp, attr);
- RTX_UNCHANGING_P (exp) = 1;
- exp = check_attr_value (exp, attr);
- /* Goto COND case since this is now a COND. Note that while the
- new expression is rescanned, all symbol_ref notes are mared as
- unchanging. */
- goto cond;
-
- case IF_THEN_ELSE:
- newexp = rtx_alloc (COND);
- XVEC (newexp, 0) = rtvec_alloc (2);
- XVECEXP (newexp, 0, 0) = XEXP (exp, 0);
- XVECEXP (newexp, 0, 1) = XEXP (exp, 1);
-
- XEXP (newexp, 1) = XEXP (exp, 2);
-
- exp = newexp;
- /* Fall through to COND case since this is now a COND. */
-
- case COND:
- cond:
- {
- int allsame = 1;
- rtx defval;
-
- /* First, check for degenerate COND. */
- if (XVECLEN (exp, 0) == 0)
- return make_canonical (attr, XEXP (exp, 1));
- defval = XEXP (exp, 1) = make_canonical (attr, XEXP (exp, 1));
-
- for (i = 0; i < XVECLEN (exp, 0); i += 2)
- {
- XVECEXP (exp, 0, i) = copy_boolean (XVECEXP (exp, 0, i));
- XVECEXP (exp, 0, i + 1)
- = make_canonical (attr, XVECEXP (exp, 0, i + 1));
- if (! rtx_equal_p (XVECEXP (exp, 0, i + 1), defval))
- allsame = 0;
- }
- if (allsame)
- return defval;
- break;
- }
- }
-
- return exp;
-}
-
-static rtx
-copy_boolean (exp)
- rtx exp;
-{
- if (GET_CODE (exp) == AND || GET_CODE (exp) == IOR)
- return attr_rtx (GET_CODE (exp), copy_boolean (XEXP (exp, 0)),
- copy_boolean (XEXP (exp, 1)));
- return exp;
-}
-
-/* Given a value and an attribute description, return a `struct attr_value *'
- that represents that value. This is either an existing structure, if the
- value has been previously encountered, or a newly-created structure.
-
- `insn_code' is the code of an insn whose attribute has the specified
- value (-2 if not processing an insn). We ensure that all insns for
- a given value have the same number of alternatives if the value checks
- alternatives. */
-
-static struct attr_value *
-get_attr_value (value, attr, insn_code)
- rtx value;
- struct attr_desc *attr;
- int insn_code;
-{
- struct attr_value *av;
- int num_alt = 0;
-
- value = make_canonical (attr, value);
- if (compares_alternatives_p (value))
- {
- if (insn_code < 0 || insn_alternatives == NULL)
- fatal ("(eq_attr \"alternatives\" ...) used in non-insn context");
- else
- num_alt = insn_alternatives[insn_code];
- }
-
- for (av = attr->first_value; av; av = av->next)
- if (rtx_equal_p (value, av->value)
- && (num_alt == 0 || av->first_insn == NULL
- || insn_alternatives[av->first_insn->insn_code]))
- return av;
-
- av = (struct attr_value *) oballoc (sizeof (struct attr_value));
- av->value = value;
- av->next = attr->first_value;
- attr->first_value = av;
- av->first_insn = NULL;
- av->num_insns = 0;
- av->has_asm_insn = 0;
-
- return av;
-}
-
-/* After all DEFINE_DELAYs have been read in, create internal attributes
- to generate the required routines.
-
- First, we compute the number of delay slots for each insn (as a COND of
- each of the test expressions in DEFINE_DELAYs). Then, if more than one
- delay type is specified, we compute a similar function giving the
- DEFINE_DELAY ordinal for each insn.
-
- Finally, for each [DEFINE_DELAY, slot #] pair, we compute an attribute that
- tells whether a given insn can be in that delay slot.
-
- Normal attribute filling and optimization expands these to contain the
- information needed to handle delay slots. */
-
-static void
-expand_delays ()
-{
- struct delay_desc *delay;
- rtx condexp;
- rtx newexp;
- int i;
- char *p;
-
- /* First, generate data for `num_delay_slots' function. */
-
- condexp = rtx_alloc (COND);
- XVEC (condexp, 0) = rtvec_alloc (num_delays * 2);
- XEXP (condexp, 1) = make_numeric_value (0);
-
- for (i = 0, delay = delays; delay; i += 2, delay = delay->next)
- {
- XVECEXP (condexp, 0, i) = XEXP (delay->def, 0);
- XVECEXP (condexp, 0, i + 1)
- = make_numeric_value (XVECLEN (delay->def, 1) / 3);
- }
-
- make_internal_attr ("*num_delay_slots", condexp, 0);
-
- /* If more than one delay type, do the same for computing the delay type. */
- if (num_delays > 1)
- {
- condexp = rtx_alloc (COND);
- XVEC (condexp, 0) = rtvec_alloc (num_delays * 2);
- XEXP (condexp, 1) = make_numeric_value (0);
-
- for (i = 0, delay = delays; delay; i += 2, delay = delay->next)
- {
- XVECEXP (condexp, 0, i) = XEXP (delay->def, 0);
- XVECEXP (condexp, 0, i + 1) = make_numeric_value (delay->num);
- }
-
- make_internal_attr ("*delay_type", condexp, 1);
- }
-
- /* For each delay possibility and delay slot, compute an eligibility
- attribute for non-annulled insns and for each type of annulled (annul
- if true and annul if false). */
- for (delay = delays; delay; delay = delay->next)
- {
- for (i = 0; i < XVECLEN (delay->def, 1); i += 3)
- {
- condexp = XVECEXP (delay->def, 1, i);
- if (condexp == 0) condexp = false_rtx;
- newexp = attr_rtx (IF_THEN_ELSE, condexp,
- make_numeric_value (1), make_numeric_value (0));
-
- p = attr_printf (sizeof ("*delay__") + MAX_DIGITS*2, "*delay_%d_%d",
- delay->num, i / 3);
- make_internal_attr (p, newexp, 1);
-
- if (have_annul_true)
- {
- condexp = XVECEXP (delay->def, 1, i + 1);
- if (condexp == 0) condexp = false_rtx;
- newexp = attr_rtx (IF_THEN_ELSE, condexp,
- make_numeric_value (1),
- make_numeric_value (0));
- p = attr_printf (sizeof ("*annul_true__") + MAX_DIGITS*2,
- "*annul_true_%d_%d", delay->num, i / 3);
- make_internal_attr (p, newexp, 1);
- }
-
- if (have_annul_false)
- {
- condexp = XVECEXP (delay->def, 1, i + 2);
- if (condexp == 0) condexp = false_rtx;
- newexp = attr_rtx (IF_THEN_ELSE, condexp,
- make_numeric_value (1),
- make_numeric_value (0));
- p = attr_printf (sizeof ("*annul_false__") + MAX_DIGITS*2,
- "*annul_false_%d_%d", delay->num, i / 3);
- make_internal_attr (p, newexp, 1);
- }
- }
- }
-}
-
-/* This function is given a left and right side expression and an operator.
- Each side is a conditional expression, each alternative of which has a
- numerical value. The function returns another conditional expression
- which, for every possible set of condition values, returns a value that is
- the operator applied to the values of the two sides.
-
- Since this is called early, it must also support IF_THEN_ELSE. */
-
-static rtx
-operate_exp (op, left, right)
- enum operator op;
- rtx left, right;
-{
- int left_value, right_value;
- rtx newexp;
- int i;
-
- /* If left is a string, apply operator to it and the right side. */
- if (GET_CODE (left) == CONST_STRING)
- {
- /* If right is also a string, just perform the operation. */
- if (GET_CODE (right) == CONST_STRING)
- {
- left_value = atoi (XSTR (left, 0));
- right_value = atoi (XSTR (right, 0));
- switch (op)
- {
- case PLUS_OP:
- i = left_value + right_value;
- break;
-
- case MINUS_OP:
- i = left_value - right_value;
- break;
-
- case POS_MINUS_OP: /* The positive part of LEFT - RIGHT. */
- if (left_value > right_value)
- i = left_value - right_value;
- else
- i = 0;
- break;
-
- case OR_OP:
- i = left_value | right_value;
- break;
-
- case EQ_OP:
- i = left_value == right_value;
- break;
-
- case RANGE_OP:
- i = (left_value << (HOST_BITS_PER_INT / 2)) | right_value;
- break;
-
- case MAX_OP:
- if (left_value > right_value)
- i = left_value;
- else
- i = right_value;
- break;
-
- case MIN_OP:
- if (left_value < right_value)
- i = left_value;
- else
- i = right_value;
- break;
-
- default:
- abort ();
- }
-
- return make_numeric_value (i);
- }
- else if (GET_CODE (right) == IF_THEN_ELSE)
- {
- /* Apply recursively to all values within. */
- rtx newleft = operate_exp (op, left, XEXP (right, 1));
- rtx newright = operate_exp (op, left, XEXP (right, 2));
- if (rtx_equal_p (newleft, newright))
- return newleft;
- return attr_rtx (IF_THEN_ELSE, XEXP (right, 0), newleft, newright);
- }
- else if (GET_CODE (right) == COND)
- {
- int allsame = 1;
- rtx defval;
-
- newexp = rtx_alloc (COND);
- XVEC (newexp, 0) = rtvec_alloc (XVECLEN (right, 0));
- defval = XEXP (newexp, 1) = operate_exp (op, left, XEXP (right, 1));
-
- for (i = 0; i < XVECLEN (right, 0); i += 2)
- {
- XVECEXP (newexp, 0, i) = XVECEXP (right, 0, i);
- XVECEXP (newexp, 0, i + 1)
- = operate_exp (op, left, XVECEXP (right, 0, i + 1));
- if (! rtx_equal_p (XVECEXP (newexp, 0, i + 1),
- defval))
- allsame = 0;
- }
-
- /* If the resulting cond is trivial (all alternatives
- give the same value), optimize it away. */
- if (allsame)
- {
- obstack_free (rtl_obstack, newexp);
- return operate_exp (op, left, XEXP (right, 1));
- }
-
- /* If the result is the same as the RIGHT operand,
- just use that. */
- if (rtx_equal_p (newexp, right))
- {
- obstack_free (rtl_obstack, newexp);
- return right;
- }
-
- return newexp;
- }
- else
- fatal ("Badly formed attribute value");
- }
-
- /* Otherwise, do recursion the other way. */
- else if (GET_CODE (left) == IF_THEN_ELSE)
- {
- rtx newleft = operate_exp (op, XEXP (left, 1), right);
- rtx newright = operate_exp (op, XEXP (left, 2), right);
- if (rtx_equal_p (newleft, newright))
- return newleft;
- return attr_rtx (IF_THEN_ELSE, XEXP (left, 0), newleft, newright);
- }
- else if (GET_CODE (left) == COND)
- {
- int allsame = 1;
- rtx defval;
-
- newexp = rtx_alloc (COND);
- XVEC (newexp, 0) = rtvec_alloc (XVECLEN (left, 0));
- defval = XEXP (newexp, 1) = operate_exp (op, XEXP (left, 1), right);
-
- for (i = 0; i < XVECLEN (left, 0); i += 2)
- {
- XVECEXP (newexp, 0, i) = XVECEXP (left, 0, i);
- XVECEXP (newexp, 0, i + 1)
- = operate_exp (op, XVECEXP (left, 0, i + 1), right);
- if (! rtx_equal_p (XVECEXP (newexp, 0, i + 1),
- defval))
- allsame = 0;
- }
-
- /* If the cond is trivial (all alternatives give the same value),
- optimize it away. */
- if (allsame)
- {
- obstack_free (rtl_obstack, newexp);
- return operate_exp (op, XEXP (left, 1), right);
- }
-
- /* If the result is the same as the LEFT operand,
- just use that. */
- if (rtx_equal_p (newexp, left))
- {
- obstack_free (rtl_obstack, newexp);
- return left;
- }
-
- return newexp;
- }
-
- else
- fatal ("Badly formed attribute value.");
- /* NOTREACHED */
- return NULL;
-}
-
-/* Once all attributes and DEFINE_FUNCTION_UNITs have been read, we
- construct a number of attributes.
-
- The first produces a function `function_units_used' which is given an
- insn and produces an encoding showing which function units are required
- for the execution of that insn. If the value is non-negative, the insn
- uses that unit; otherwise, the value is a one's compliment mask of units
- used.
-
- The second produces a function `result_ready_cost' which is used to
- determine the time that the result of an insn will be ready and hence
- a worst-case schedule.
-
- Both of these produce quite complex expressions which are then set as the
- default value of internal attributes. Normal attribute simplification
- should produce reasonable expressions.
-
- For each unit, a `<name>_unit_ready_cost' function will take an
- insn and give the delay until that unit will be ready with the result
- and a `<name>_unit_conflict_cost' function is given an insn already
- executing on the unit and a candidate to execute and will give the
- cost from the time the executing insn started until the candidate
- can start (ignore limitations on the number of simultaneous insns).
-
- For each unit, a `<name>_unit_blockage' function is given an insn
- already executing on the unit and a candidate to execute and will
- give the delay incurred due to function unit conflicts. The range of
- blockage cost values for a given executing insn is given by the
- `<name>_unit_blockage_range' function. These values are encoded in
- an int where the upper half gives the minimum value and the lower
- half gives the maximum value. */
-
-static void
-expand_units ()
-{
- struct function_unit *unit, **unit_num;
- struct function_unit_op *op, **op_array, ***unit_ops;
- rtx unitsmask;
- rtx readycost;
- rtx newexp;
- char *str;
- int i, j, u, num, nvalues;
-
- /* Rebuild the condition for the unit to share the RTL expressions.
- Sharing is required by simplify_by_exploding. Build the issue delay
- expressions. Validate the expressions we were given for the conditions
- and conflict vector. Then make attributes for use in the conflict
- function. */
-
- for (unit = units; unit; unit = unit->next)
- {
- unit->condexp = check_attr_test (unit->condexp, 0);
-
- for (op = unit->ops; op; op = op->next)
- {
- rtx issue_delay = make_numeric_value (op->issue_delay);
- rtx issue_exp = issue_delay;
-
- /* Build, validate, and simplify the issue delay expression. */
- if (op->conflict_exp != true_rtx)
- issue_exp = attr_rtx (IF_THEN_ELSE, op->conflict_exp,
- issue_exp, make_numeric_value (0));
- issue_exp = check_attr_value (make_canonical (NULL_ATTR,
- issue_exp),
- NULL_ATTR);
- issue_exp = simplify_knowing (issue_exp, unit->condexp);
- op->issue_exp = issue_exp;
-
- /* Make an attribute for use in the conflict function if needed. */
- unit->needs_conflict_function = (unit->issue_delay.min
- != unit->issue_delay.max);
- if (unit->needs_conflict_function)
- {
- str = attr_printf (strlen (unit->name) + sizeof ("*_cost_") + MAX_DIGITS,
- "*%s_cost_%d", unit->name, op->num);
- make_internal_attr (str, issue_exp, 1);
- }
-
- /* Validate the condition. */
- op->condexp = check_attr_test (op->condexp, 0);
- }
- }
-
- /* Compute the mask of function units used. Initially, the unitsmask is
- zero. Set up a conditional to compute each unit's contribution. */
- unitsmask = make_numeric_value (0);
- newexp = rtx_alloc (IF_THEN_ELSE);
- XEXP (newexp, 2) = make_numeric_value (0);
-
- /* Merge each function unit into the unit mask attributes. */
- for (unit = units; unit; unit = unit->next)
- {
- XEXP (newexp, 0) = unit->condexp;
- XEXP (newexp, 1) = make_numeric_value (1 << unit->num);
- unitsmask = operate_exp (OR_OP, unitsmask, newexp);
- }
-
- /* Simplify the unit mask expression, encode it, and make an attribute
- for the function_units_used function. */
- unitsmask = simplify_by_exploding (unitsmask);
- unitsmask = encode_units_mask (unitsmask);
- make_internal_attr ("*function_units_used", unitsmask, 2);
-
- /* Create an array of ops for each unit. Add an extra unit for the
- result_ready_cost function that has the ops of all other units. */
- unit_ops = (struct function_unit_op ***)
- alloca ((num_units + 1) * sizeof (struct function_unit_op **));
- unit_num = (struct function_unit **)
- alloca ((num_units + 1) * sizeof (struct function_unit *));
-
- unit_num[num_units] = unit = (struct function_unit *)
- alloca (sizeof (struct function_unit));
- unit->num = num_units;
- unit->num_opclasses = 0;
-
- for (unit = units; unit; unit = unit->next)
- {
- unit_num[num_units]->num_opclasses += unit->num_opclasses;
- unit_num[unit->num] = unit;
- unit_ops[unit->num] = op_array = (struct function_unit_op **)
- alloca (unit->num_opclasses * sizeof (struct function_unit_op *));
-
- for (op = unit->ops; op; op = op->next)
- op_array[op->num] = op;
- }
-
- /* Compose the array of ops for the extra unit. */
- unit_ops[num_units] = op_array = (struct function_unit_op **)
- alloca (unit_num[num_units]->num_opclasses
- * sizeof (struct function_unit_op *));
-
- for (unit = units, i = 0; unit; i += unit->num_opclasses, unit = unit->next)
- bcopy ((char *) unit_ops[unit->num], (char *) &op_array[i],
- unit->num_opclasses * sizeof (struct function_unit_op *));
-
- /* Compute the ready cost function for each unit by computing the
- condition for each non-default value. */
- for (u = 0; u <= num_units; u++)
- {
- rtx orexp;
- int value;
-
- unit = unit_num[u];
- op_array = unit_ops[unit->num];
- num = unit->num_opclasses;
-
- /* Sort the array of ops into increasing ready cost order. */
- for (i = 0; i < num; i++)
- for (j = num - 1; j > i; j--)
- if (op_array[j-1]->ready < op_array[j]->ready)
- {
- op = op_array[j];
- op_array[j] = op_array[j-1];
- op_array[j-1] = op;
- }
-
- /* Determine how many distinct non-default ready cost values there
- are. We use a default ready cost value of 1. */
- nvalues = 0; value = 1;
- for (i = num - 1; i >= 0; i--)
- if (op_array[i]->ready > value)
- {
- value = op_array[i]->ready;
- nvalues++;
- }
-
- if (nvalues == 0)
- readycost = make_numeric_value (1);
- else
- {
- /* Construct the ready cost expression as a COND of each value from
- the largest to the smallest. */
- readycost = rtx_alloc (COND);
- XVEC (readycost, 0) = rtvec_alloc (nvalues * 2);
- XEXP (readycost, 1) = make_numeric_value (1);
-
- nvalues = 0; orexp = false_rtx; value = op_array[0]->ready;
- for (i = 0; i < num; i++)
- {
- op = op_array[i];
- if (op->ready <= 1)
- break;
- else if (op->ready == value)
- orexp = insert_right_side (IOR, orexp, op->condexp, -2, -2);
- else
- {
- XVECEXP (readycost, 0, nvalues * 2) = orexp;
- XVECEXP (readycost, 0, nvalues * 2 + 1)
- = make_numeric_value (value);
- nvalues++;
- value = op->ready;
- orexp = op->condexp;
- }
- }
- XVECEXP (readycost, 0, nvalues * 2) = orexp;
- XVECEXP (readycost, 0, nvalues * 2 + 1) = make_numeric_value (value);
- }
-
- if (u < num_units)
- {
- rtx max_blockage = 0, min_blockage = 0;
-
- /* Simplify the readycost expression by only considering insns
- that use the unit. */
- readycost = simplify_knowing (readycost, unit->condexp);
-
- /* Determine the blockage cost the executing insn (E) given
- the candidate insn (C). This is the maximum of the issue
- delay, the pipeline delay, and the simultaneity constraint.
- Each function_unit_op represents the characteristics of the
- candidate insn, so in the expressions below, C is a known
- term and E is an unknown term.
-
- We compute the blockage cost for each E for every possible C.
- Thus OP represents E, and READYCOST is a list of values for
- every possible C.
-
- The issue delay function for C is op->issue_exp and is used to
- write the `<name>_unit_conflict_cost' function. Symbolicly
- this is "ISSUE-DELAY (E,C)".
-
- The pipeline delay results form the FIFO constraint on the
- function unit and is "READY-COST (E) + 1 - READY-COST (C)".
-
- The simultaneity constraint is based on how long it takes to
- fill the unit given the minimum issue delay. FILL-TIME is the
- constant "MIN (ISSUE-DELAY (*,*)) * (SIMULTANEITY - 1)", and
- the simultaneity constraint is "READY-COST (E) - FILL-TIME"
- if SIMULTANEITY is non-zero and zero otherwise.
-
- Thus, BLOCKAGE (E,C) when SIMULTANEITY is zero is
-
- MAX (ISSUE-DELAY (E,C),
- READY-COST (E) - (READY-COST (C) - 1))
-
- and otherwise
-
- MAX (ISSUE-DELAY (E,C),
- READY-COST (E) - (READY-COST (C) - 1),
- READY-COST (E) - FILL-TIME)
-
- The `<name>_unit_blockage' function is computed by determining
- this value for each candidate insn. As these values are
- computed, we also compute the upper and lower bounds for
- BLOCKAGE (E,*). These are combined to form the function
- `<name>_unit_blockage_range'. Finally, the maximum blockage
- cost, MAX (BLOCKAGE (*,*)), is computed. */
-
- for (op = unit->ops; op; op = op->next)
- {
- rtx blockage = operate_exp (POS_MINUS_OP, readycost,
- make_numeric_value (1));
-
- if (unit->simultaneity != 0)
- {
- rtx filltime = make_numeric_value ((unit->simultaneity - 1)
- * unit->issue_delay.min);
- blockage = operate_exp (MIN_OP, blockage, filltime);
- }
-
- blockage = operate_exp (POS_MINUS_OP,
- make_numeric_value (op->ready),
- blockage);
-
- blockage = operate_exp (MAX_OP, blockage, op->issue_exp);
- blockage = simplify_knowing (blockage, unit->condexp);
-
- /* Add this op's contribution to MAX (BLOCKAGE (E,*)) and
- MIN (BLOCKAGE (E,*)). */
- if (max_blockage == 0)
- max_blockage = min_blockage = blockage;
- else
- {
- max_blockage
- = simplify_knowing (operate_exp (MAX_OP, max_blockage,
- blockage),
- unit->condexp);
- min_blockage
- = simplify_knowing (operate_exp (MIN_OP, min_blockage,
- blockage),
- unit->condexp);
- }
-
- /* Make an attribute for use in the blockage function. */
- str = attr_printf (strlen (unit->name) + sizeof ("*_block_") + MAX_DIGITS,
- "*%s_block_%d", unit->name, op->num);
- make_internal_attr (str, blockage, 1);
- }
-
- /* Record MAX (BLOCKAGE (*,*)). */
- unit->max_blockage = max_attr_value (max_blockage);
-
- /* See if the upper and lower bounds of BLOCKAGE (E,*) are the
- same. If so, the blockage function carries no additional
- information and is not written. */
- newexp = operate_exp (EQ_OP, max_blockage, min_blockage);
- newexp = simplify_knowing (newexp, unit->condexp);
- unit->needs_blockage_function
- = (GET_CODE (newexp) != CONST_STRING
- || atoi (XSTR (newexp, 0)) != 1);
-
- /* If the all values of BLOCKAGE (E,C) have the same value,
- neither blockage function is written. */
- unit->needs_range_function
- = (unit->needs_blockage_function
- || GET_CODE (max_blockage) != CONST_STRING);
-
- if (unit->needs_range_function)
- {
- /* Compute the blockage range function and make an attribute
- for writing it's value. */
- newexp = operate_exp (RANGE_OP, min_blockage, max_blockage);
- newexp = simplify_knowing (newexp, unit->condexp);
-
- str = attr_printf (strlen (unit->name) + sizeof ("*_unit_blockage_range"),
- "*%s_unit_blockage_range", unit->name);
- make_internal_attr (str, newexp, 4);
- }
-
- str = attr_printf (strlen (unit->name) + sizeof ("*_unit_ready_cost"),
- "*%s_unit_ready_cost", unit->name);
- }
- else
- str = "*result_ready_cost";
-
- /* Make an attribute for the ready_cost function. Simplifying
- further with simplify_by_exploding doesn't win. */
- make_internal_attr (str, readycost, 0);
- }
-
- /* For each unit that requires a conflict cost function, make an attribute
- that maps insns to the operation number. */
- for (unit = units; unit; unit = unit->next)
- {
- rtx caseexp;
-
- if (! unit->needs_conflict_function
- && ! unit->needs_blockage_function)
- continue;
-
- caseexp = rtx_alloc (COND);
- XVEC (caseexp, 0) = rtvec_alloc ((unit->num_opclasses - 1) * 2);
-
- for (op = unit->ops; op; op = op->next)
- {
- /* Make our adjustment to the COND being computed. If we are the
- last operation class, place our values into the default of the
- COND. */
- if (op->num == unit->num_opclasses - 1)
- {
- XEXP (caseexp, 1) = make_numeric_value (op->num);
- }
- else
- {
- XVECEXP (caseexp, 0, op->num * 2) = op->condexp;
- XVECEXP (caseexp, 0, op->num * 2 + 1)
- = make_numeric_value (op->num);
- }
- }
-
- /* Simplifying caseexp with simplify_by_exploding doesn't win. */
- str = attr_printf (strlen (unit->name) + sizeof ("*_cases"),
- "*%s_cases", unit->name);
- make_internal_attr (str, caseexp, 1);
- }
-}
-
-/* Simplify EXP given KNOWN_TRUE. */
-
-static rtx
-simplify_knowing (exp, known_true)
- rtx exp, known_true;
-{
- if (GET_CODE (exp) != CONST_STRING)
- {
- exp = attr_rtx (IF_THEN_ELSE, known_true, exp,
- make_numeric_value (max_attr_value (exp)));
- exp = simplify_by_exploding (exp);
- }
- return exp;
-}
-
-/* Translate the CONST_STRING expressions in X to change the encoding of
- value. On input, the value is a bitmask with a one bit for each unit
- used; on output, the value is the unit number (zero based) if one
- and only one unit is used or the one's compliment of the bitmask. */
-
-static rtx
-encode_units_mask (x)
- rtx x;
-{
- register int i;
- register int j;
- register enum rtx_code code;
- register char *fmt;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_STRING:
- i = atoi (XSTR (x, 0));
- if (i < 0)
- abort (); /* The sign bit encodes a one's compliment mask. */
- else if (i != 0 && i == (i & -i))
- /* Only one bit is set, so yield that unit number. */
- for (j = 0; (i >>= 1) != 0; j++)
- ;
- else
- j = ~i;
- return attr_rtx (CONST_STRING, attr_printf (MAX_DIGITS, "%d", j));
-
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case EQ_ATTR:
- return x;
- }
-
- /* Compare the elements. If any pair of corresponding elements
- fail to match, return 0 for the whole things. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- switch (fmt[i])
- {
- case 'V':
- case 'E':
- for (j = 0; j < XVECLEN (x, i); j++)
- XVECEXP (x, i, j) = encode_units_mask (XVECEXP (x, i, j));
- break;
-
- case 'e':
- XEXP (x, i) = encode_units_mask (XEXP (x, i));
- break;
- }
- }
- return x;
-}
-
-/* Once all attributes and insns have been read and checked, we construct for
- each attribute value a list of all the insns that have that value for
- the attribute. */
-
-static void
-fill_attr (attr)
- struct attr_desc *attr;
-{
- struct attr_value *av;
- struct insn_ent *ie;
- struct insn_def *id;
- int i;
- rtx value;
-
- /* Don't fill constant attributes. The value is independent of
- any particular insn. */
- if (attr->is_const)
- return;
-
- for (id = defs; id; id = id->next)
- {
- /* If no value is specified for this insn for this attribute, use the
- default. */
- value = NULL;
- if (XVEC (id->def, id->vec_idx))
- for (i = 0; i < XVECLEN (id->def, id->vec_idx); i++)
- if (! strcmp (XSTR (XEXP (XVECEXP (id->def, id->vec_idx, i), 0), 0),
- attr->name))
- value = XEXP (XVECEXP (id->def, id->vec_idx, i), 1);
-
- if (value == NULL)
- av = attr->default_val;
- else
- av = get_attr_value (value, attr, id->insn_code);
-
- ie = (struct insn_ent *) oballoc (sizeof (struct insn_ent));
- ie->insn_code = id->insn_code;
- ie->insn_index = id->insn_code;
- insert_insn_ent (av, ie);
- }
-}
-
-/* Given an expression EXP, see if it is a COND or IF_THEN_ELSE that has a
- test that checks relative positions of insns (uses MATCH_DUP or PC).
- If so, replace it with what is obtained by passing the expression to
- ADDRESS_FN. If not but it is a COND or IF_THEN_ELSE, call this routine
- recursively on each value (including the default value). Otherwise,
- return the value returned by NO_ADDRESS_FN applied to EXP. */
-
-static rtx
-substitute_address (exp, no_address_fn, address_fn)
- rtx exp;
- rtx (*no_address_fn) ();
- rtx (*address_fn) ();
-{
- int i;
- rtx newexp;
-
- if (GET_CODE (exp) == COND)
- {
- /* See if any tests use addresses. */
- address_used = 0;
- for (i = 0; i < XVECLEN (exp, 0); i += 2)
- walk_attr_value (XVECEXP (exp, 0, i));
-
- if (address_used)
- return (*address_fn) (exp);
-
- /* Make a new copy of this COND, replacing each element. */
- newexp = rtx_alloc (COND);
- XVEC (newexp, 0) = rtvec_alloc (XVECLEN (exp, 0));
- for (i = 0; i < XVECLEN (exp, 0); i += 2)
- {
- XVECEXP (newexp, 0, i) = XVECEXP (exp, 0, i);
- XVECEXP (newexp, 0, i + 1)
- = substitute_address (XVECEXP (exp, 0, i + 1),
- no_address_fn, address_fn);
- }
-
- XEXP (newexp, 1) = substitute_address (XEXP (exp, 1),
- no_address_fn, address_fn);
-
- return newexp;
- }
-
- else if (GET_CODE (exp) == IF_THEN_ELSE)
- {
- address_used = 0;
- walk_attr_value (XEXP (exp, 0));
- if (address_used)
- return (*address_fn) (exp);
-
- return attr_rtx (IF_THEN_ELSE,
- substitute_address (XEXP (exp, 0),
- no_address_fn, address_fn),
- substitute_address (XEXP (exp, 1),
- no_address_fn, address_fn),
- substitute_address (XEXP (exp, 2),
- no_address_fn, address_fn));
- }
-
- return (*no_address_fn) (exp);
-}
-
-/* Make new attributes from the `length' attribute. The following are made,
- each corresponding to a function called from `shorten_branches' or
- `get_attr_length':
-
- *insn_default_length This is the length of the insn to be returned
- by `get_attr_length' before `shorten_branches'
- has been called. In each case where the length
- depends on relative addresses, the largest
- possible is used. This routine is also used
- to compute the initial size of the insn.
-
- *insn_variable_length_p This returns 1 if the insn's length depends
- on relative addresses, zero otherwise.
-
- *insn_current_length This is only called when it is known that the
- insn has a variable length and returns the
- current length, based on relative addresses.
- */
-
-static void
-make_length_attrs ()
-{
- static char *new_names[] = {"*insn_default_length",
- "*insn_variable_length_p",
- "*insn_current_length"};
- static rtx (*no_address_fn[]) PROTO((rtx)) = {identity_fn, zero_fn, zero_fn};
- static rtx (*address_fn[]) PROTO((rtx)) = {max_fn, one_fn, identity_fn};
- int i;
- struct attr_desc *length_attr, *new_attr;
- struct attr_value *av, *new_av;
- struct insn_ent *ie, *new_ie;
-
- /* See if length attribute is defined. If so, it must be numeric. Make
- it special so we don't output anything for it. */
- length_attr = find_attr ("length", 0);
- if (length_attr == 0)
- return;
-
- if (! length_attr->is_numeric)
- fatal ("length attribute must be numeric.");
-
- length_attr->is_const = 0;
- length_attr->is_special = 1;
-
- /* Make each new attribute, in turn. */
- for (i = 0; i < sizeof new_names / sizeof new_names[0]; i++)
- {
- make_internal_attr (new_names[i],
- substitute_address (length_attr->default_val->value,
- no_address_fn[i], address_fn[i]),
- 0);
- new_attr = find_attr (new_names[i], 0);
- for (av = length_attr->first_value; av; av = av->next)
- for (ie = av->first_insn; ie; ie = ie->next)
- {
- new_av = get_attr_value (substitute_address (av->value,
- no_address_fn[i],
- address_fn[i]),
- new_attr, ie->insn_code);
- new_ie = (struct insn_ent *) oballoc (sizeof (struct insn_ent));
- new_ie->insn_code = ie->insn_code;
- new_ie->insn_index = ie->insn_index;
- insert_insn_ent (new_av, new_ie);
- }
- }
-}
-
-/* Utility functions called from above routine. */
-
-static rtx
-identity_fn (exp)
- rtx exp;
-{
- return exp;
-}
-
-static rtx
-zero_fn (exp)
- rtx exp;
-{
- return make_numeric_value (0);
-}
-
-static rtx
-one_fn (exp)
- rtx exp;
-{
- return make_numeric_value (1);
-}
-
-static rtx
-max_fn (exp)
- rtx exp;
-{
- return make_numeric_value (max_attr_value (exp));
-}
-
-/* Take a COND expression and see if any of the conditions in it can be
- simplified. If any are known true or known false for the particular insn
- code, the COND can be further simplified.
-
- Also call ourselves on any COND operations that are values of this COND.
-
- We do not modify EXP; rather, we make and return a new rtx. */
-
-static rtx
-simplify_cond (exp, insn_code, insn_index)
- rtx exp;
- int insn_code, insn_index;
-{
- int i, j;
- /* We store the desired contents here,
- then build a new expression if they don't match EXP. */
- rtx defval = XEXP (exp, 1);
- rtx new_defval = XEXP (exp, 1);
- int len = XVECLEN (exp, 0);
- rtunion *tests = (rtunion *) alloca (len * sizeof (rtunion));
- int allsame = 1;
- char *first_spacer;
-
- /* This lets us free all storage allocated below, if appropriate. */
- first_spacer = (char *) obstack_finish (rtl_obstack);
-
- bcopy ((char *) XVEC (exp, 0)->elem, (char *) tests, len * sizeof (rtunion));
-
- /* See if default value needs simplification. */
- if (GET_CODE (defval) == COND)
- new_defval = simplify_cond (defval, insn_code, insn_index);
-
- /* Simplify the subexpressions, and see what tests we can get rid of. */
-
- for (i = 0; i < len; i += 2)
- {
- rtx newtest, newval;
-
- /* Simplify this test. */
- newtest = SIMPLIFY_TEST_EXP (tests[i].rtx, insn_code, insn_index);
- tests[i].rtx = newtest;
-
- newval = tests[i + 1].rtx;
- /* See if this value may need simplification. */
- if (GET_CODE (newval) == COND)
- newval = simplify_cond (newval, insn_code, insn_index);
-
- /* Look for ways to delete or combine this test. */
- if (newtest == true_rtx)
- {
- /* If test is true, make this value the default
- and discard this + any following tests. */
- len = i;
- defval = tests[i + 1].rtx;
- new_defval = newval;
- }
-
- else if (newtest == false_rtx)
- {
- /* If test is false, discard it and its value. */
- for (j = i; j < len - 2; j++)
- tests[j].rtx = tests[j + 2].rtx;
- len -= 2;
- }
-
- else if (i > 0 && attr_equal_p (newval, tests[i - 1].rtx))
- {
- /* If this value and the value for the prev test are the same,
- merge the tests. */
-
- tests[i - 2].rtx
- = insert_right_side (IOR, tests[i - 2].rtx, newtest,
- insn_code, insn_index);
-
- /* Delete this test/value. */
- for (j = i; j < len - 2; j++)
- tests[j].rtx = tests[j + 2].rtx;
- len -= 2;
- }
-
- else
- tests[i + 1].rtx = newval;
- }
-
- /* If the last test in a COND has the same value
- as the default value, that test isn't needed. */
-
- while (len > 0 && attr_equal_p (tests[len - 1].rtx, new_defval))
- len -= 2;
-
- /* See if we changed anything. */
- if (len != XVECLEN (exp, 0) || new_defval != XEXP (exp, 1))
- allsame = 0;
- else
- for (i = 0; i < len; i++)
- if (! attr_equal_p (tests[i].rtx, XVECEXP (exp, 0, i)))
- {
- allsame = 0;
- break;
- }
-
- if (len == 0)
- {
- obstack_free (rtl_obstack, first_spacer);
- if (GET_CODE (defval) == COND)
- return simplify_cond (defval, insn_code, insn_index);
- return defval;
- }
- else if (allsame)
- {
- obstack_free (rtl_obstack, first_spacer);
- return exp;
- }
- else
- {
- rtx newexp = rtx_alloc (COND);
-
- XVEC (newexp, 0) = rtvec_alloc (len);
- bcopy ((char *) tests, (char *) XVEC (newexp, 0)->elem,
- len * sizeof (rtunion));
- XEXP (newexp, 1) = new_defval;
- return newexp;
- }
-}
-
-/* Remove an insn entry from an attribute value. */
-
-static void
-remove_insn_ent (av, ie)
- struct attr_value *av;
- struct insn_ent *ie;
-{
- struct insn_ent *previe;
-
- if (av->first_insn == ie)
- av->first_insn = ie->next;
- else
- {
- for (previe = av->first_insn; previe->next != ie; previe = previe->next)
- ;
- previe->next = ie->next;
- }
-
- av->num_insns--;
- if (ie->insn_code == -1)
- av->has_asm_insn = 0;
-
- num_insn_ents--;
-}
-
-/* Insert an insn entry in an attribute value list. */
-
-static void
-insert_insn_ent (av, ie)
- struct attr_value *av;
- struct insn_ent *ie;
-{
- ie->next = av->first_insn;
- av->first_insn = ie;
- av->num_insns++;
- if (ie->insn_code == -1)
- av->has_asm_insn = 1;
-
- num_insn_ents++;
-}
-
-/* This is a utility routine to take an expression that is a tree of either
- AND or IOR expressions and insert a new term. The new term will be
- inserted at the right side of the first node whose code does not match
- the root. A new node will be created with the root's code. Its left
- side will be the old right side and its right side will be the new
- term.
-
- If the `term' is itself a tree, all its leaves will be inserted. */
-
-static rtx
-insert_right_side (code, exp, term, insn_code, insn_index)
- enum rtx_code code;
- rtx exp;
- rtx term;
- int insn_code, insn_index;
-{
- rtx newexp;
-
- /* Avoid consing in some special cases. */
- if (code == AND && term == true_rtx)
- return exp;
- if (code == AND && term == false_rtx)
- return false_rtx;
- if (code == AND && exp == true_rtx)
- return term;
- if (code == AND && exp == false_rtx)
- return false_rtx;
- if (code == IOR && term == true_rtx)
- return true_rtx;
- if (code == IOR && term == false_rtx)
- return exp;
- if (code == IOR && exp == true_rtx)
- return true_rtx;
- if (code == IOR && exp == false_rtx)
- return term;
- if (attr_equal_p (exp, term))
- return exp;
-
- if (GET_CODE (term) == code)
- {
- exp = insert_right_side (code, exp, XEXP (term, 0),
- insn_code, insn_index);
- exp = insert_right_side (code, exp, XEXP (term, 1),
- insn_code, insn_index);
-
- return exp;
- }
-
- if (GET_CODE (exp) == code)
- {
- rtx new = insert_right_side (code, XEXP (exp, 1),
- term, insn_code, insn_index);
- if (new != XEXP (exp, 1))
- /* Make a copy of this expression and call recursively. */
- newexp = attr_rtx (code, XEXP (exp, 0), new);
- else
- newexp = exp;
- }
- else
- {
- /* Insert the new term. */
- newexp = attr_rtx (code, exp, term);
- }
-
- return SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
-}
-
-/* If we have an expression which AND's a bunch of
- (not (eq_attrq "alternative" "n"))
- terms, we may have covered all or all but one of the possible alternatives.
- If so, we can optimize. Similarly for IOR's of EQ_ATTR.
-
- This routine is passed an expression and either AND or IOR. It returns a
- bitmask indicating which alternatives are mentioned within EXP. */
-
-static int
-compute_alternative_mask (exp, code)
- rtx exp;
- enum rtx_code code;
-{
- char *string;
- if (GET_CODE (exp) == code)
- return compute_alternative_mask (XEXP (exp, 0), code)
- | compute_alternative_mask (XEXP (exp, 1), code);
-
- else if (code == AND && GET_CODE (exp) == NOT
- && GET_CODE (XEXP (exp, 0)) == EQ_ATTR
- && XSTR (XEXP (exp, 0), 0) == alternative_name)
- string = XSTR (XEXP (exp, 0), 1);
-
- else if (code == IOR && GET_CODE (exp) == EQ_ATTR
- && XSTR (exp, 0) == alternative_name)
- string = XSTR (exp, 1);
-
- else
- return 0;
-
- if (string[1] == 0)
- return 1 << (string[0] - '0');
- return 1 << atoi (string);
-}
-
-/* Given I, a single-bit mask, return RTX to compare the `alternative'
- attribute with the value represented by that bit. */
-
-static rtx
-make_alternative_compare (mask)
- int mask;
-{
- rtx newexp;
- int i;
-
- /* Find the bit. */
- for (i = 0; (mask & (1 << i)) == 0; i++)
- ;
-
- newexp = attr_rtx (EQ_ATTR, alternative_name, attr_numeral (i));
- RTX_UNCHANGING_P (newexp) = 1;
-
- return newexp;
-}
-
-/* If we are processing an (eq_attr "attr" "value") test, we find the value
- of "attr" for this insn code. From that value, we can compute a test
- showing when the EQ_ATTR will be true. This routine performs that
- computation. If a test condition involves an address, we leave the EQ_ATTR
- intact because addresses are only valid for the `length' attribute.
-
- EXP is the EQ_ATTR expression and VALUE is the value of that attribute
- for the insn corresponding to INSN_CODE and INSN_INDEX. */
-
-static rtx
-evaluate_eq_attr (exp, value, insn_code, insn_index)
- rtx exp;
- rtx value;
- int insn_code, insn_index;
-{
- rtx orexp, andexp;
- rtx right;
- rtx newexp;
- int i;
-
- if (GET_CODE (value) == CONST_STRING)
- {
- if (! strcmp (XSTR (value, 0), XSTR (exp, 1)))
- newexp = true_rtx;
- else
- newexp = false_rtx;
- }
- else if (GET_CODE (value) == COND)
- {
- /* We construct an IOR of all the cases for which the requested attribute
- value is present. Since we start with FALSE, if it is not present,
- FALSE will be returned.
-
- Each case is the AND of the NOT's of the previous conditions with the
- current condition; in the default case the current condition is TRUE.
-
- For each possible COND value, call ourselves recursively.
-
- The extra TRUE and FALSE expressions will be eliminated by another
- call to the simplification routine. */
-
- orexp = false_rtx;
- andexp = true_rtx;
-
- if (current_alternative_string)
- clear_struct_flag (value);
-
- for (i = 0; i < XVECLEN (value, 0); i += 2)
- {
- rtx this = SIMPLIFY_TEST_EXP (XVECEXP (value, 0, i),
- insn_code, insn_index);
-
- SIMPLIFY_ALTERNATIVE (this);
-
- right = insert_right_side (AND, andexp, this,
- insn_code, insn_index);
- right = insert_right_side (AND, right,
- evaluate_eq_attr (exp,
- XVECEXP (value, 0,
- i + 1),
- insn_code, insn_index),
- insn_code, insn_index);
- orexp = insert_right_side (IOR, orexp, right,
- insn_code, insn_index);
-
- /* Add this condition into the AND expression. */
- newexp = attr_rtx (NOT, this);
- andexp = insert_right_side (AND, andexp, newexp,
- insn_code, insn_index);
- }
-
- /* Handle the default case. */
- right = insert_right_side (AND, andexp,
- evaluate_eq_attr (exp, XEXP (value, 1),
- insn_code, insn_index),
- insn_code, insn_index);
- newexp = insert_right_side (IOR, orexp, right, insn_code, insn_index);
- }
- else
- abort ();
-
- /* If uses an address, must return original expression. But set the
- RTX_UNCHANGING_P bit so we don't try to simplify it again. */
-
- address_used = 0;
- walk_attr_value (newexp);
-
- if (address_used)
- {
- /* This had `&& current_alternative_string', which seems to be wrong. */
- if (! RTX_UNCHANGING_P (exp))
- return copy_rtx_unchanging (exp);
- return exp;
- }
- else
- return newexp;
-}
-
-/* This routine is called when an AND of a term with a tree of AND's is
- encountered. If the term or its complement is present in the tree, it
- can be replaced with TRUE or FALSE, respectively.
-
- Note that (eq_attr "att" "v1") and (eq_attr "att" "v2") cannot both
- be true and hence are complementary.
-
- There is one special case: If we see
- (and (not (eq_attr "att" "v1"))
- (eq_attr "att" "v2"))
- this can be replaced by (eq_attr "att" "v2"). To do this we need to
- replace the term, not anything in the AND tree. So we pass a pointer to
- the term. */
-
-static rtx
-simplify_and_tree (exp, pterm, insn_code, insn_index)
- rtx exp;
- rtx *pterm;
- int insn_code, insn_index;
-{
- rtx left, right;
- rtx newexp;
- rtx temp;
- int left_eliminates_term, right_eliminates_term;
-
- if (GET_CODE (exp) == AND)
- {
- left = simplify_and_tree (XEXP (exp, 0), pterm, insn_code, insn_index);
- right = simplify_and_tree (XEXP (exp, 1), pterm, insn_code, insn_index);
- if (left != XEXP (exp, 0) || right != XEXP (exp, 1))
- {
- newexp = attr_rtx (GET_CODE (exp), left, right);
-
- exp = SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- }
-
- else if (GET_CODE (exp) == IOR)
- {
- /* For the IOR case, we do the same as above, except that we can
- only eliminate `term' if both sides of the IOR would do so. */
- temp = *pterm;
- left = simplify_and_tree (XEXP (exp, 0), &temp, insn_code, insn_index);
- left_eliminates_term = (temp == true_rtx);
-
- temp = *pterm;
- right = simplify_and_tree (XEXP (exp, 1), &temp, insn_code, insn_index);
- right_eliminates_term = (temp == true_rtx);
-
- if (left_eliminates_term && right_eliminates_term)
- *pterm = true_rtx;
-
- if (left != XEXP (exp, 0) || right != XEXP (exp, 1))
- {
- newexp = attr_rtx (GET_CODE (exp), left, right);
-
- exp = SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- }
-
- /* Check for simplifications. Do some extra checking here since this
- routine is called so many times. */
-
- if (exp == *pterm)
- return true_rtx;
-
- else if (GET_CODE (exp) == NOT && XEXP (exp, 0) == *pterm)
- return false_rtx;
-
- else if (GET_CODE (*pterm) == NOT && exp == XEXP (*pterm, 0))
- return false_rtx;
-
- else if (GET_CODE (exp) == EQ_ATTR && GET_CODE (*pterm) == EQ_ATTR)
- {
- if (XSTR (exp, 0) != XSTR (*pterm, 0))
- return exp;
-
- if (! strcmp (XSTR (exp, 1), XSTR (*pterm, 1)))
- return true_rtx;
- else
- return false_rtx;
- }
-
- else if (GET_CODE (*pterm) == EQ_ATTR && GET_CODE (exp) == NOT
- && GET_CODE (XEXP (exp, 0)) == EQ_ATTR)
- {
- if (XSTR (*pterm, 0) != XSTR (XEXP (exp, 0), 0))
- return exp;
-
- if (! strcmp (XSTR (*pterm, 1), XSTR (XEXP (exp, 0), 1)))
- return false_rtx;
- else
- return true_rtx;
- }
-
- else if (GET_CODE (exp) == EQ_ATTR && GET_CODE (*pterm) == NOT
- && GET_CODE (XEXP (*pterm, 0)) == EQ_ATTR)
- {
- if (XSTR (exp, 0) != XSTR (XEXP (*pterm, 0), 0))
- return exp;
-
- if (! strcmp (XSTR (exp, 1), XSTR (XEXP (*pterm, 0), 1)))
- return false_rtx;
- else
- *pterm = true_rtx;
- }
-
- else if (GET_CODE (exp) == NOT && GET_CODE (*pterm) == NOT)
- {
- if (attr_equal_p (XEXP (exp, 0), XEXP (*pterm, 0)))
- return true_rtx;
- }
-
- else if (GET_CODE (exp) == NOT)
- {
- if (attr_equal_p (XEXP (exp, 0), *pterm))
- return false_rtx;
- }
-
- else if (GET_CODE (*pterm) == NOT)
- {
- if (attr_equal_p (XEXP (*pterm, 0), exp))
- return false_rtx;
- }
-
- else if (attr_equal_p (exp, *pterm))
- return true_rtx;
-
- return exp;
-}
-
-/* Similar to `simplify_and_tree', but for IOR trees. */
-
-static rtx
-simplify_or_tree (exp, pterm, insn_code, insn_index)
- rtx exp;
- rtx *pterm;
- int insn_code, insn_index;
-{
- rtx left, right;
- rtx newexp;
- rtx temp;
- int left_eliminates_term, right_eliminates_term;
-
- if (GET_CODE (exp) == IOR)
- {
- left = simplify_or_tree (XEXP (exp, 0), pterm, insn_code, insn_index);
- right = simplify_or_tree (XEXP (exp, 1), pterm, insn_code, insn_index);
- if (left != XEXP (exp, 0) || right != XEXP (exp, 1))
- {
- newexp = attr_rtx (GET_CODE (exp), left, right);
-
- exp = SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- }
-
- else if (GET_CODE (exp) == AND)
- {
- /* For the AND case, we do the same as above, except that we can
- only eliminate `term' if both sides of the AND would do so. */
- temp = *pterm;
- left = simplify_or_tree (XEXP (exp, 0), &temp, insn_code, insn_index);
- left_eliminates_term = (temp == false_rtx);
-
- temp = *pterm;
- right = simplify_or_tree (XEXP (exp, 1), &temp, insn_code, insn_index);
- right_eliminates_term = (temp == false_rtx);
-
- if (left_eliminates_term && right_eliminates_term)
- *pterm = false_rtx;
-
- if (left != XEXP (exp, 0) || right != XEXP (exp, 1))
- {
- newexp = attr_rtx (GET_CODE (exp), left, right);
-
- exp = SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- }
-
- if (attr_equal_p (exp, *pterm))
- return false_rtx;
-
- else if (GET_CODE (exp) == NOT && attr_equal_p (XEXP (exp, 0), *pterm))
- return true_rtx;
-
- else if (GET_CODE (*pterm) == NOT && attr_equal_p (XEXP (*pterm, 0), exp))
- return true_rtx;
-
- else if (GET_CODE (*pterm) == EQ_ATTR && GET_CODE (exp) == NOT
- && GET_CODE (XEXP (exp, 0)) == EQ_ATTR
- && XSTR (*pterm, 0) == XSTR (XEXP (exp, 0), 0))
- *pterm = false_rtx;
-
- else if (GET_CODE (exp) == EQ_ATTR && GET_CODE (*pterm) == NOT
- && GET_CODE (XEXP (*pterm, 0)) == EQ_ATTR
- && XSTR (exp, 0) == XSTR (XEXP (*pterm, 0), 0))
- return false_rtx;
-
- return exp;
-}
-
-/* Given an expression, see if it can be simplified for a particular insn
- code based on the values of other attributes being tested. This can
- eliminate nested get_attr_... calls.
-
- Note that if an endless recursion is specified in the patterns, the
- optimization will loop. However, it will do so in precisely the cases where
- an infinite recursion loop could occur during compilation. It's better that
- it occurs here! */
-
-static rtx
-simplify_test_exp (exp, insn_code, insn_index)
- rtx exp;
- int insn_code, insn_index;
-{
- rtx left, right;
- struct attr_desc *attr;
- struct attr_value *av;
- struct insn_ent *ie;
- int i;
- rtx newexp = exp;
- char *spacer = (char *) obstack_finish (rtl_obstack);
-
- /* Don't re-simplify something we already simplified. */
- if (RTX_UNCHANGING_P (exp) || MEM_IN_STRUCT_P (exp))
- return exp;
-
- switch (GET_CODE (exp))
- {
- case AND:
- left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index);
- SIMPLIFY_ALTERNATIVE (left);
- if (left == false_rtx)
- {
- obstack_free (rtl_obstack, spacer);
- return false_rtx;
- }
- right = SIMPLIFY_TEST_EXP (XEXP (exp, 1), insn_code, insn_index);
- SIMPLIFY_ALTERNATIVE (right);
- if (left == false_rtx)
- {
- obstack_free (rtl_obstack, spacer);
- return false_rtx;
- }
-
- /* If either side is an IOR and we have (eq_attr "alternative" ..")
- present on both sides, apply the distributive law since this will
- yield simplifications. */
- if ((GET_CODE (left) == IOR || GET_CODE (right) == IOR)
- && compute_alternative_mask (left, IOR)
- && compute_alternative_mask (right, IOR))
- {
- if (GET_CODE (left) == IOR)
- {
- rtx tem = left;
- left = right;
- right = tem;
- }
-
- newexp = attr_rtx (IOR,
- attr_rtx (AND, left, XEXP (right, 0)),
- attr_rtx (AND, left, XEXP (right, 1)));
-
- return SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
-
- /* Try with the term on both sides. */
- right = simplify_and_tree (right, &left, insn_code, insn_index);
- if (left == XEXP (exp, 0) && right == XEXP (exp, 1))
- left = simplify_and_tree (left, &right, insn_code, insn_index);
-
- if (left == false_rtx || right == false_rtx)
- {
- obstack_free (rtl_obstack, spacer);
- return false_rtx;
- }
- else if (left == true_rtx)
- {
- return right;
- }
- else if (right == true_rtx)
- {
- return left;
- }
- /* See if all or all but one of the insn's alternatives are specified
- in this tree. Optimize if so. */
-
- else if (insn_code >= 0
- && (GET_CODE (left) == AND
- || (GET_CODE (left) == NOT
- && GET_CODE (XEXP (left, 0)) == EQ_ATTR
- && XSTR (XEXP (left, 0), 0) == alternative_name)
- || GET_CODE (right) == AND
- || (GET_CODE (right) == NOT
- && GET_CODE (XEXP (right, 0)) == EQ_ATTR
- && XSTR (XEXP (right, 0), 0) == alternative_name)))
- {
- i = compute_alternative_mask (exp, AND);
- if (i & ~insn_alternatives[insn_code])
- fatal ("Invalid alternative specified for pattern number %d",
- insn_index);
-
- /* If all alternatives are excluded, this is false. */
- i ^= insn_alternatives[insn_code];
- if (i == 0)
- return false_rtx;
- else if ((i & (i - 1)) == 0 && insn_alternatives[insn_code] > 1)
- {
- /* If just one excluded, AND a comparison with that one to the
- front of the tree. The others will be eliminated by
- optimization. We do not want to do this if the insn has one
- alternative and we have tested none of them! */
- left = make_alternative_compare (i);
- right = simplify_and_tree (exp, &left, insn_code, insn_index);
- newexp = attr_rtx (AND, left, right);
-
- return SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- }
-
- if (left != XEXP (exp, 0) || right != XEXP (exp, 1))
- {
- newexp = attr_rtx (AND, left, right);
- return SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- break;
-
- case IOR:
- left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index);
- SIMPLIFY_ALTERNATIVE (left);
- if (left == true_rtx)
- {
- obstack_free (rtl_obstack, spacer);
- return true_rtx;
- }
- right = SIMPLIFY_TEST_EXP (XEXP (exp, 1), insn_code, insn_index);
- SIMPLIFY_ALTERNATIVE (right);
- if (right == true_rtx)
- {
- obstack_free (rtl_obstack, spacer);
- return true_rtx;
- }
-
- right = simplify_or_tree (right, &left, insn_code, insn_index);
- if (left == XEXP (exp, 0) && right == XEXP (exp, 1))
- left = simplify_or_tree (left, &right, insn_code, insn_index);
-
- if (right == true_rtx || left == true_rtx)
- {
- obstack_free (rtl_obstack, spacer);
- return true_rtx;
- }
- else if (left == false_rtx)
- {
- return right;
- }
- else if (right == false_rtx)
- {
- return left;
- }
-
- /* Test for simple cases where the distributive law is useful. I.e.,
- convert (ior (and (x) (y))
- (and (x) (z)))
- to (and (x)
- (ior (y) (z)))
- */
-
- else if (GET_CODE (left) == AND && GET_CODE (right) == AND
- && attr_equal_p (XEXP (left, 0), XEXP (right, 0)))
- {
- newexp = attr_rtx (IOR, XEXP (left, 1), XEXP (right, 1));
-
- left = XEXP (left, 0);
- right = newexp;
- newexp = attr_rtx (AND, left, right);
- return SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
-
- /* See if all or all but one of the insn's alternatives are specified
- in this tree. Optimize if so. */
-
- else if (insn_code >= 0
- && (GET_CODE (left) == IOR
- || (GET_CODE (left) == EQ_ATTR
- && XSTR (left, 0) == alternative_name)
- || GET_CODE (right) == IOR
- || (GET_CODE (right) == EQ_ATTR
- && XSTR (right, 0) == alternative_name)))
- {
- i = compute_alternative_mask (exp, IOR);
- if (i & ~insn_alternatives[insn_code])
- fatal ("Invalid alternative specified for pattern number %d",
- insn_index);
-
- /* If all alternatives are included, this is true. */
- i ^= insn_alternatives[insn_code];
- if (i == 0)
- return true_rtx;
- else if ((i & (i - 1)) == 0 && insn_alternatives[insn_code] > 1)
- {
- /* If just one excluded, IOR a comparison with that one to the
- front of the tree. The others will be eliminated by
- optimization. We do not want to do this if the insn has one
- alternative and we have tested none of them! */
- left = make_alternative_compare (i);
- right = simplify_and_tree (exp, &left, insn_code, insn_index);
- newexp = attr_rtx (IOR, attr_rtx (NOT, left), right);
-
- return SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- }
-
- if (left != XEXP (exp, 0) || right != XEXP (exp, 1))
- {
- newexp = attr_rtx (IOR, left, right);
- return SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- break;
-
- case NOT:
- if (GET_CODE (XEXP (exp, 0)) == NOT)
- {
- left = SIMPLIFY_TEST_EXP (XEXP (XEXP (exp, 0), 0),
- insn_code, insn_index);
- SIMPLIFY_ALTERNATIVE (left);
- return left;
- }
-
- left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index);
- SIMPLIFY_ALTERNATIVE (left);
- if (GET_CODE (left) == NOT)
- return XEXP (left, 0);
-
- if (left == false_rtx)
- {
- obstack_free (rtl_obstack, spacer);
- return true_rtx;
- }
- else if (left == true_rtx)
- {
- obstack_free (rtl_obstack, spacer);
- return false_rtx;
- }
-
- /* Try to apply De`Morgan's laws. */
- else if (GET_CODE (left) == IOR)
- {
- newexp = attr_rtx (AND,
- attr_rtx (NOT, XEXP (left, 0)),
- attr_rtx (NOT, XEXP (left, 1)));
-
- newexp = SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- else if (GET_CODE (left) == AND)
- {
- newexp = attr_rtx (IOR,
- attr_rtx (NOT, XEXP (left, 0)),
- attr_rtx (NOT, XEXP (left, 1)));
-
- newexp = SIMPLIFY_TEST_EXP (newexp, insn_code, insn_index);
- }
- else if (left != XEXP (exp, 0))
- {
- newexp = attr_rtx (NOT, left);
- }
- break;
-
- case EQ_ATTR:
- if (current_alternative_string && XSTR (exp, 0) == alternative_name)
- return (XSTR (exp, 1) == current_alternative_string
- ? true_rtx : false_rtx);
-
- /* Look at the value for this insn code in the specified attribute.
- We normally can replace this comparison with the condition that
- would give this insn the values being tested for. */
- if (XSTR (exp, 0) != alternative_name
- && (attr = find_attr (XSTR (exp, 0), 0)) != NULL)
- for (av = attr->first_value; av; av = av->next)
- for (ie = av->first_insn; ie; ie = ie->next)
- if (ie->insn_code == insn_code)
- return evaluate_eq_attr (exp, av->value, insn_code, insn_index);
- }
-
- /* We have already simplified this expression. Simplifying it again
- won't buy anything unless we weren't given a valid insn code
- to process (i.e., we are canonicalizing something.). */
- if (insn_code != -2 /* Seems wrong: && current_alternative_string. */
- && ! RTX_UNCHANGING_P (newexp))
- return copy_rtx_unchanging (newexp);
-
- return newexp;
-}
-
-/* Optimize the attribute lists by seeing if we can determine conditional
- values from the known values of other attributes. This will save subroutine
- calls during the compilation. */
-
-static void
-optimize_attrs ()
-{
- struct attr_desc *attr;
- struct attr_value *av;
- struct insn_ent *ie;
- rtx newexp;
- int something_changed = 1;
- int i;
- struct attr_value_list { struct attr_value *av;
- struct insn_ent *ie;
- struct attr_desc * attr;
- struct attr_value_list *next; };
- struct attr_value_list **insn_code_values;
- struct attr_value_list *ivbuf;
- struct attr_value_list *iv;
-
- /* For each insn code, make a list of all the insn_ent's for it,
- for all values for all attributes. */
-
- if (num_insn_ents == 0)
- return;
-
- /* Make 2 extra elements, for "code" values -2 and -1. */
- insn_code_values
- = (struct attr_value_list **) alloca ((insn_code_number + 2)
- * sizeof (struct attr_value_list *));
- bzero ((char *) insn_code_values,
- (insn_code_number + 2) * sizeof (struct attr_value_list *));
-
- /* Offset the table address so we can index by -2 or -1. */
- insn_code_values += 2;
-
- /* Allocate the attr_value_list structures using xmalloc rather than
- alloca, because using alloca can overflow the maximum permitted
- stack limit on SPARC Lynx. */
- iv = ivbuf = ((struct attr_value_list *)
- xmalloc (num_insn_ents * sizeof (struct attr_value_list)));
-
- for (i = 0; i < MAX_ATTRS_INDEX; i++)
- for (attr = attrs[i]; attr; attr = attr->next)
- for (av = attr->first_value; av; av = av->next)
- for (ie = av->first_insn; ie; ie = ie->next)
- {
- iv->attr = attr;
- iv->av = av;
- iv->ie = ie;
- iv->next = insn_code_values[ie->insn_code];
- insn_code_values[ie->insn_code] = iv;
- iv++;
- }
-
- /* Sanity check on num_insn_ents. */
- if (iv != ivbuf + num_insn_ents)
- abort ();
-
- /* Process one insn code at a time. */
- for (i = -2; i < insn_code_number; i++)
- {
- /* Clear the MEM_IN_STRUCT_P flag everywhere relevant.
- We use it to mean "already simplified for this insn". */
- for (iv = insn_code_values[i]; iv; iv = iv->next)
- clear_struct_flag (iv->av->value);
-
- /* Loop until nothing changes for one iteration. */
- something_changed = 1;
- while (something_changed)
- {
- something_changed = 0;
- for (iv = insn_code_values[i]; iv; iv = iv->next)
- {
- struct obstack *old = rtl_obstack;
- char *spacer = (char *) obstack_finish (temp_obstack);
-
- attr = iv->attr;
- av = iv->av;
- ie = iv->ie;
- if (GET_CODE (av->value) != COND)
- continue;
-
- rtl_obstack = temp_obstack;
-#if 0 /* This was intended as a speed up, but it was slower. */
- if (insn_n_alternatives[ie->insn_code] > 6
- && count_sub_rtxs (av->value, 200) >= 200)
- newexp = simplify_by_alternatives (av->value, ie->insn_code,
- ie->insn_index);
- else
-#endif
- newexp = simplify_cond (av->value, ie->insn_code,
- ie->insn_index);
-
- rtl_obstack = old;
- if (newexp != av->value)
- {
- newexp = attr_copy_rtx (newexp);
- remove_insn_ent (av, ie);
- av = get_attr_value (newexp, attr, ie->insn_code);
- iv->av = av;
- insert_insn_ent (av, ie);
- something_changed = 1;
- }
- obstack_free (temp_obstack, spacer);
- }
- }
- }
-
- free (ivbuf);
-}
-
-#if 0
-static rtx
-simplify_by_alternatives (exp, insn_code, insn_index)
- rtx exp;
- int insn_code, insn_index;
-{
- int i;
- int len = insn_n_alternatives[insn_code];
- rtx newexp = rtx_alloc (COND);
- rtx ultimate;
-
-
- XVEC (newexp, 0) = rtvec_alloc (len * 2);
-
- /* It will not matter what value we use as the default value
- of the new COND, since that default will never be used.
- Choose something of the right type. */
- for (ultimate = exp; GET_CODE (ultimate) == COND;)
- ultimate = XEXP (ultimate, 1);
- XEXP (newexp, 1) = ultimate;
-
- for (i = 0; i < insn_n_alternatives[insn_code]; i++)
- {
- current_alternative_string = attr_numeral (i);
- XVECEXP (newexp, 0, i * 2) = make_alternative_compare (1 << i);
- XVECEXP (newexp, 0, i * 2 + 1)
- = simplify_cond (exp, insn_code, insn_index);
- }
-
- current_alternative_string = 0;
- return simplify_cond (newexp, insn_code, insn_index);
-}
-#endif
-
-/* If EXP is a suitable expression, reorganize it by constructing an
- equivalent expression that is a COND with the tests being all combinations
- of attribute values and the values being simple constants. */
-
-static rtx
-simplify_by_exploding (exp)
- rtx exp;
-{
- rtx list = 0, link, condexp, defval;
- struct dimension *space;
- rtx *condtest, *condval;
- int i, j, total, ndim = 0;
- int most_tests, num_marks, new_marks;
-
- /* Locate all the EQ_ATTR expressions. */
- if (! find_and_mark_used_attributes (exp, &list, &ndim) || ndim == 0)
- {
- unmark_used_attributes (list, 0, 0);
- return exp;
- }
-
- /* Create an attribute space from the list of used attributes. For each
- dimension in the attribute space, record the attribute, list of values
- used, and number of values used. Add members to the list of values to
- cover the domain of the attribute. This makes the expanded COND form
- order independent. */
-
- space = (struct dimension *) alloca (ndim * sizeof (struct dimension));
-
- total = 1;
- for (ndim = 0; list; ndim++)
- {
- /* Pull the first attribute value from the list and record that
- attribute as another dimension in the attribute space. */
- char *name = XSTR (XEXP (list, 0), 0);
- rtx *prev;
-
- if ((space[ndim].attr = find_attr (name, 0)) == 0
- || space[ndim].attr->is_numeric)
- {
- unmark_used_attributes (list, space, ndim);
- return exp;
- }
-
- /* Add all remaining attribute values that refer to this attribute. */
- space[ndim].num_values = 0;
- space[ndim].values = 0;
- prev = &list;
- for (link = list; link; link = *prev)
- if (! strcmp (XSTR (XEXP (link, 0), 0), name))
- {
- space[ndim].num_values++;
- *prev = XEXP (link, 1);
- XEXP (link, 1) = space[ndim].values;
- space[ndim].values = link;
- }
- else
- prev = &XEXP (link, 1);
-
- /* Add sufficient members to the list of values to make the list
- mutually exclusive and record the total size of the attribute
- space. */
- total *= add_values_to_cover (&space[ndim]);
- }
-
- /* Sort the attribute space so that the attributes go from non-constant
- to constant and from most values to least values. */
- for (i = 0; i < ndim; i++)
- for (j = ndim - 1; j > i; j--)
- if ((space[j-1].attr->is_const && !space[j].attr->is_const)
- || space[j-1].num_values < space[j].num_values)
- {
- struct dimension tmp;
- tmp = space[j];
- space[j] = space[j-1];
- space[j-1] = tmp;
- }
-
- /* Establish the initial current value. */
- for (i = 0; i < ndim; i++)
- space[i].current_value = space[i].values;
-
- condtest = (rtx *) alloca (total * sizeof (rtx));
- condval = (rtx *) alloca (total * sizeof (rtx));
-
- /* Expand the tests and values by iterating over all values in the
- attribute space. */
- for (i = 0;; i++)
- {
- condtest[i] = test_for_current_value (space, ndim);
- condval[i] = simplify_with_current_value (exp, space, ndim);
- if (! increment_current_value (space, ndim))
- break;
- }
- if (i != total - 1)
- abort ();
-
- /* We are now finished with the original expression. */
- unmark_used_attributes (0, space, ndim);
-
- /* Find the most used constant value and make that the default. */
- most_tests = -1;
- for (i = num_marks = 0; i < total; i++)
- if (GET_CODE (condval[i]) == CONST_STRING
- && ! MEM_VOLATILE_P (condval[i]))
- {
- /* Mark the unmarked constant value and count how many are marked. */
- MEM_VOLATILE_P (condval[i]) = 1;
- for (j = new_marks = 0; j < total; j++)
- if (GET_CODE (condval[j]) == CONST_STRING
- && MEM_VOLATILE_P (condval[j]))
- new_marks++;
- if (new_marks - num_marks > most_tests)
- {
- most_tests = new_marks - num_marks;
- defval = condval[i];
- }
- num_marks = new_marks;
- }
- /* Clear all the marks. */
- for (i = 0; i < total; i++)
- MEM_VOLATILE_P (condval[i]) = 0;
-
- /* Give up if nothing is constant. */
- if (num_marks == 0)
- return exp;
-
- /* If all values are the default, use that. */
- if (total == most_tests)
- return defval;
-
- /* Make a COND with the most common constant value the default. (A more
- complex method where tests with the same value were combined didn't
- seem to improve things.) */
- condexp = rtx_alloc (COND);
- XVEC (condexp, 0) = rtvec_alloc ((total - most_tests) * 2);
- XEXP (condexp, 1) = defval;
- for (i = j = 0; i < total; i++)
- if (condval[i] != defval)
- {
- XVECEXP (condexp, 0, 2 * j) = condtest[i];
- XVECEXP (condexp, 0, 2 * j + 1) = condval[i];
- j++;
- }
-
- return condexp;
-}
-
-/* Set the MEM_VOLATILE_P flag for all EQ_ATTR expressions in EXP and
- verify that EXP can be simplified to a constant term if all the EQ_ATTR
- tests have known value. */
-
-static int
-find_and_mark_used_attributes (exp, terms, nterms)
- rtx exp, *terms;
- int *nterms;
-{
- int i;
-
- switch (GET_CODE (exp))
- {
- case EQ_ATTR:
- if (! MEM_VOLATILE_P (exp))
- {
- rtx link = rtx_alloc (EXPR_LIST);
- XEXP (link, 0) = exp;
- XEXP (link, 1) = *terms;
- *terms = link;
- *nterms += 1;
- MEM_VOLATILE_P (exp) = 1;
- }
- case CONST_STRING:
- return 1;
-
- case IF_THEN_ELSE:
- if (! find_and_mark_used_attributes (XEXP (exp, 2), terms, nterms))
- return 0;
- case IOR:
- case AND:
- if (! find_and_mark_used_attributes (XEXP (exp, 1), terms, nterms))
- return 0;
- case NOT:
- if (! find_and_mark_used_attributes (XEXP (exp, 0), terms, nterms))
- return 0;
- return 1;
-
- case COND:
- for (i = 0; i < XVECLEN (exp, 0); i++)
- if (! find_and_mark_used_attributes (XVECEXP (exp, 0, i), terms, nterms))
- return 0;
- if (! find_and_mark_used_attributes (XEXP (exp, 1), terms, nterms))
- return 0;
- return 1;
- }
-
- return 0;
-}
-
-/* Clear the MEM_VOLATILE_P flag in all EQ_ATTR expressions on LIST and
- in the values of the NDIM-dimensional attribute space SPACE. */
-
-static void
-unmark_used_attributes (list, space, ndim)
- rtx list;
- struct dimension *space;
- int ndim;
-{
- rtx link, exp;
- int i;
-
- for (i = 0; i < ndim; i++)
- unmark_used_attributes (space[i].values, 0, 0);
-
- for (link = list; link; link = XEXP (link, 1))
- {
- exp = XEXP (link, 0);
- if (GET_CODE (exp) == EQ_ATTR)
- MEM_VOLATILE_P (exp) = 0;
- }
-}
-
-/* Update the attribute dimension DIM so that all values of the attribute
- are tested. Return the updated number of values. */
-
-static int
-add_values_to_cover (dim)
- struct dimension *dim;
-{
- struct attr_value *av;
- rtx exp, link, *prev;
- int nalt = 0;
-
- for (av = dim->attr->first_value; av; av = av->next)
- if (GET_CODE (av->value) == CONST_STRING)
- nalt++;
-
- if (nalt < dim->num_values)
- abort ();
- else if (nalt == dim->num_values)
- ; /* Ok. */
- else if (nalt * 2 < dim->num_values * 3)
- {
- /* Most all the values of the attribute are used, so add all the unused
- values. */
- prev = &dim->values;
- for (link = dim->values; link; link = *prev)
- prev = &XEXP (link, 1);
-
- for (av = dim->attr->first_value; av; av = av->next)
- if (GET_CODE (av->value) == CONST_STRING)
- {
- exp = attr_eq (dim->attr->name, XSTR (av->value, 0));
- if (MEM_VOLATILE_P (exp))
- continue;
-
- link = rtx_alloc (EXPR_LIST);
- XEXP (link, 0) = exp;
- XEXP (link, 1) = 0;
- *prev = link;
- prev = &XEXP (link, 1);
- }
- dim->num_values = nalt;
- }
- else
- {
- rtx orexp = false_rtx;
-
- /* Very few values are used, so compute a mutually exclusive
- expression. (We could do this for numeric values if that becomes
- important.) */
- prev = &dim->values;
- for (link = dim->values; link; link = *prev)
- {
- orexp = insert_right_side (IOR, orexp, XEXP (link, 0), -2, -2);
- prev = &XEXP (link, 1);
- }
- link = rtx_alloc (EXPR_LIST);
- XEXP (link, 0) = attr_rtx (NOT, orexp);
- XEXP (link, 1) = 0;
- *prev = link;
- dim->num_values++;
- }
- return dim->num_values;
-}
-
-/* Increment the current value for the NDIM-dimensional attribute space SPACE
- and return FALSE if the increment overflowed. */
-
-static int
-increment_current_value (space, ndim)
- struct dimension *space;
- int ndim;
-{
- int i;
-
- for (i = ndim - 1; i >= 0; i--)
- {
- if ((space[i].current_value = XEXP (space[i].current_value, 1)) == 0)
- space[i].current_value = space[i].values;
- else
- return 1;
- }
- return 0;
-}
-
-/* Construct an expression corresponding to the current value for the
- NDIM-dimensional attribute space SPACE. */
-
-static rtx
-test_for_current_value (space, ndim)
- struct dimension *space;
- int ndim;
-{
- int i;
- rtx exp = true_rtx;
-
- for (i = 0; i < ndim; i++)
- exp = insert_right_side (AND, exp, XEXP (space[i].current_value, 0),
- -2, -2);
-
- return exp;
-}
-
-/* Given the current value of the NDIM-dimensional attribute space SPACE,
- set the corresponding EQ_ATTR expressions to that value and reduce
- the expression EXP as much as possible. On input [and output], all
- known EQ_ATTR expressions are set to FALSE. */
-
-static rtx
-simplify_with_current_value (exp, space, ndim)
- rtx exp;
- struct dimension *space;
- int ndim;
-{
- int i;
- rtx x;
-
- /* Mark each current value as TRUE. */
- for (i = 0; i < ndim; i++)
- {
- x = XEXP (space[i].current_value, 0);
- if (GET_CODE (x) == EQ_ATTR)
- MEM_VOLATILE_P (x) = 0;
- }
-
- exp = simplify_with_current_value_aux (exp);
-
- /* Change each current value back to FALSE. */
- for (i = 0; i < ndim; i++)
- {
- x = XEXP (space[i].current_value, 0);
- if (GET_CODE (x) == EQ_ATTR)
- MEM_VOLATILE_P (x) = 1;
- }
-
- return exp;
-}
-
-/* Reduce the expression EXP based on the MEM_VOLATILE_P settings of
- all EQ_ATTR expressions. */
-
-static rtx
-simplify_with_current_value_aux (exp)
- rtx exp;
-{
- register int i;
- rtx cond;
-
- switch (GET_CODE (exp))
- {
- case EQ_ATTR:
- if (MEM_VOLATILE_P (exp))
- return false_rtx;
- else
- return true_rtx;
- case CONST_STRING:
- return exp;
-
- case IF_THEN_ELSE:
- cond = simplify_with_current_value_aux (XEXP (exp, 0));
- if (cond == true_rtx)
- return simplify_with_current_value_aux (XEXP (exp, 1));
- else if (cond == false_rtx)
- return simplify_with_current_value_aux (XEXP (exp, 2));
- else
- return attr_rtx (IF_THEN_ELSE, cond,
- simplify_with_current_value_aux (XEXP (exp, 1)),
- simplify_with_current_value_aux (XEXP (exp, 2)));
-
- case IOR:
- cond = simplify_with_current_value_aux (XEXP (exp, 1));
- if (cond == true_rtx)
- return cond;
- else if (cond == false_rtx)
- return simplify_with_current_value_aux (XEXP (exp, 0));
- else
- return attr_rtx (IOR, cond,
- simplify_with_current_value_aux (XEXP (exp, 0)));
-
- case AND:
- cond = simplify_with_current_value_aux (XEXP (exp, 1));
- if (cond == true_rtx)
- return simplify_with_current_value_aux (XEXP (exp, 0));
- else if (cond == false_rtx)
- return cond;
- else
- return attr_rtx (AND, cond,
- simplify_with_current_value_aux (XEXP (exp, 0)));
-
- case NOT:
- cond = simplify_with_current_value_aux (XEXP (exp, 0));
- if (cond == true_rtx)
- return false_rtx;
- else if (cond == false_rtx)
- return true_rtx;
- else
- return attr_rtx (NOT, cond);
-
- case COND:
- for (i = 0; i < XVECLEN (exp, 0); i += 2)
- {
- cond = simplify_with_current_value_aux (XVECEXP (exp, 0, i));
- if (cond == true_rtx)
- return simplify_with_current_value_aux (XVECEXP (exp, 0, i + 1));
- else if (cond == false_rtx)
- continue;
- else
- abort (); /* With all EQ_ATTR's of known value, a case should
- have been selected. */
- }
- return simplify_with_current_value_aux (XEXP (exp, 1));
- }
- abort ();
-}
-
-/* Clear the MEM_IN_STRUCT_P flag in EXP and its subexpressions. */
-
-static void
-clear_struct_flag (x)
- rtx x;
-{
- register int i;
- register int j;
- register enum rtx_code code;
- register char *fmt;
-
- MEM_IN_STRUCT_P (x) = 0;
- if (RTX_UNCHANGING_P (x))
- return;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case EQ_ATTR:
- case ATTR_FLAG:
- return;
- }
-
- /* Compare the elements. If any pair of corresponding elements
- fail to match, return 0 for the whole things. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- switch (fmt[i])
- {
- case 'V':
- case 'E':
- for (j = 0; j < XVECLEN (x, i); j++)
- clear_struct_flag (XVECEXP (x, i, j));
- break;
-
- case 'e':
- clear_struct_flag (XEXP (x, i));
- break;
- }
- }
-}
-
-/* Return the number of RTX objects making up the expression X.
- But if we count more more than MAX objects, stop counting. */
-
-static int
-count_sub_rtxs (x, max)
- rtx x;
- int max;
-{
- register int i;
- register int j;
- register enum rtx_code code;
- register char *fmt;
- int total = 0;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case EQ_ATTR:
- case ATTR_FLAG:
- return 1;
- }
-
- /* Compare the elements. If any pair of corresponding elements
- fail to match, return 0 for the whole things. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (total >= max)
- return total;
-
- switch (fmt[i])
- {
- case 'V':
- case 'E':
- for (j = 0; j < XVECLEN (x, i); j++)
- total += count_sub_rtxs (XVECEXP (x, i, j), max);
- break;
-
- case 'e':
- total += count_sub_rtxs (XEXP (x, i), max);
- break;
- }
- }
- return total;
-
-}
-
-/* Create table entries for DEFINE_ATTR. */
-
-static void
-gen_attr (exp)
- rtx exp;
-{
- struct attr_desc *attr;
- struct attr_value *av;
- char *name_ptr;
- char *p;
-
- /* Make a new attribute structure. Check for duplicate by looking at
- attr->default_val, since it is initialized by this routine. */
- attr = find_attr (XSTR (exp, 0), 1);
- if (attr->default_val)
- fatal ("Duplicate definition for `%s' attribute", attr->name);
-
- if (*XSTR (exp, 1) == '\0')
- attr->is_numeric = 1;
- else
- {
- name_ptr = XSTR (exp, 1);
- while ((p = next_comma_elt (&name_ptr)) != NULL)
- {
- av = (struct attr_value *) oballoc (sizeof (struct attr_value));
- av->value = attr_rtx (CONST_STRING, p);
- av->next = attr->first_value;
- attr->first_value = av;
- av->first_insn = NULL;
- av->num_insns = 0;
- av->has_asm_insn = 0;
- }
- }
-
- if (GET_CODE (XEXP (exp, 2)) == CONST)
- {
- attr->is_const = 1;
- if (attr->is_numeric)
- fatal ("Constant attributes may not take numeric values");
- /* Get rid of the CONST node. It is allowed only at top-level. */
- XEXP (exp, 2) = XEXP (XEXP (exp, 2), 0);
- }
-
- if (! strcmp (attr->name, "length") && ! attr->is_numeric)
- fatal ("`length' attribute must take numeric values");
-
- /* Set up the default value. */
- XEXP (exp, 2) = check_attr_value (XEXP (exp, 2), attr);
- attr->default_val = get_attr_value (XEXP (exp, 2), attr, -2);
-}
-
-/* Given a pattern for DEFINE_PEEPHOLE or DEFINE_INSN, return the number of
- alternatives in the constraints. Assume all MATCH_OPERANDs have the same
- number of alternatives as this should be checked elsewhere. */
-
-static int
-count_alternatives (exp)
- rtx exp;
-{
- int i, j, n;
- char *fmt;
-
- if (GET_CODE (exp) == MATCH_OPERAND)
- return n_comma_elts (XSTR (exp, 2));
-
- for (i = 0, fmt = GET_RTX_FORMAT (GET_CODE (exp));
- i < GET_RTX_LENGTH (GET_CODE (exp)); i++)
- switch (*fmt++)
- {
- case 'e':
- case 'u':
- n = count_alternatives (XEXP (exp, i));
- if (n)
- return n;
- break;
-
- case 'E':
- case 'V':
- if (XVEC (exp, i) != NULL)
- for (j = 0; j < XVECLEN (exp, i); j++)
- {
- n = count_alternatives (XVECEXP (exp, i, j));
- if (n)
- return n;
- }
- }
-
- return 0;
-}
-
-/* Returns non-zero if the given expression contains an EQ_ATTR with the
- `alternative' attribute. */
-
-static int
-compares_alternatives_p (exp)
- rtx exp;
-{
- int i, j;
- char *fmt;
-
- if (GET_CODE (exp) == EQ_ATTR && XSTR (exp, 0) == alternative_name)
- return 1;
-
- for (i = 0, fmt = GET_RTX_FORMAT (GET_CODE (exp));
- i < GET_RTX_LENGTH (GET_CODE (exp)); i++)
- switch (*fmt++)
- {
- case 'e':
- case 'u':
- if (compares_alternatives_p (XEXP (exp, i)))
- return 1;
- break;
-
- case 'E':
- for (j = 0; j < XVECLEN (exp, i); j++)
- if (compares_alternatives_p (XVECEXP (exp, i, j)))
- return 1;
- break;
- }
-
- return 0;
-}
-
-/* Returns non-zero is INNER is contained in EXP. */
-
-static int
-contained_in_p (inner, exp)
- rtx inner;
- rtx exp;
-{
- int i, j;
- char *fmt;
-
- if (rtx_equal_p (inner, exp))
- return 1;
-
- for (i = 0, fmt = GET_RTX_FORMAT (GET_CODE (exp));
- i < GET_RTX_LENGTH (GET_CODE (exp)); i++)
- switch (*fmt++)
- {
- case 'e':
- case 'u':
- if (contained_in_p (inner, XEXP (exp, i)))
- return 1;
- break;
-
- case 'E':
- for (j = 0; j < XVECLEN (exp, i); j++)
- if (contained_in_p (inner, XVECEXP (exp, i, j)))
- return 1;
- break;
- }
-
- return 0;
-}
-
-/* Process DEFINE_PEEPHOLE, DEFINE_INSN, and DEFINE_ASM_ATTRIBUTES. */
-
-static void
-gen_insn (exp)
- rtx exp;
-{
- struct insn_def *id;
-
- id = (struct insn_def *) oballoc (sizeof (struct insn_def));
- id->next = defs;
- defs = id;
- id->def = exp;
-
- switch (GET_CODE (exp))
- {
- case DEFINE_INSN:
- id->insn_code = insn_code_number++;
- id->insn_index = insn_index_number++;
- id->num_alternatives = count_alternatives (exp);
- if (id->num_alternatives == 0)
- id->num_alternatives = 1;
- id->vec_idx = 4;
- break;
-
- case DEFINE_PEEPHOLE:
- id->insn_code = insn_code_number++;
- id->insn_index = insn_index_number++;
- id->num_alternatives = count_alternatives (exp);
- if (id->num_alternatives == 0)
- id->num_alternatives = 1;
- id->vec_idx = 3;
- break;
-
- case DEFINE_ASM_ATTRIBUTES:
- id->insn_code = -1;
- id->insn_index = -1;
- id->num_alternatives = 1;
- id->vec_idx = 0;
- got_define_asm_attributes = 1;
- break;
- }
-}
-
-/* Process a DEFINE_DELAY. Validate the vector length, check if annul
- true or annul false is specified, and make a `struct delay_desc'. */
-
-static void
-gen_delay (def)
- rtx def;
-{
- struct delay_desc *delay;
- int i;
-
- if (XVECLEN (def, 1) % 3 != 0)
- fatal ("Number of elements in DEFINE_DELAY must be multiple of three.");
-
- for (i = 0; i < XVECLEN (def, 1); i += 3)
- {
- if (XVECEXP (def, 1, i + 1))
- have_annul_true = 1;
- if (XVECEXP (def, 1, i + 2))
- have_annul_false = 1;
- }
-
- delay = (struct delay_desc *) oballoc (sizeof (struct delay_desc));
- delay->def = def;
- delay->num = ++num_delays;
- delay->next = delays;
- delays = delay;
-}
-
-/* Process a DEFINE_FUNCTION_UNIT.
-
- This gives information about a function unit contained in the CPU.
- We fill in a `struct function_unit_op' and a `struct function_unit'
- with information used later by `expand_unit'. */
-
-static void
-gen_unit (def)
- rtx def;
-{
- struct function_unit *unit;
- struct function_unit_op *op;
- char *name = XSTR (def, 0);
- int multiplicity = XINT (def, 1);
- int simultaneity = XINT (def, 2);
- rtx condexp = XEXP (def, 3);
- int ready_cost = MAX (XINT (def, 4), 1);
- int issue_delay = MAX (XINT (def, 5), 1);
-
- /* See if we have already seen this function unit. If so, check that
- the multiplicity and simultaneity values are the same. If not, make
- a structure for this function unit. */
- for (unit = units; unit; unit = unit->next)
- if (! strcmp (unit->name, name))
- {
- if (unit->multiplicity != multiplicity
- || unit->simultaneity != simultaneity)
- fatal ("Differing specifications given for `%s' function unit.",
- unit->name);
- break;
- }
-
- if (unit == 0)
- {
- unit = (struct function_unit *) oballoc (sizeof (struct function_unit));
- unit->name = name;
- unit->multiplicity = multiplicity;
- unit->simultaneity = simultaneity;
- unit->issue_delay.min = unit->issue_delay.max = issue_delay;
- unit->num = num_units++;
- unit->num_opclasses = 0;
- unit->condexp = false_rtx;
- unit->ops = 0;
- unit->next = units;
- units = unit;
- }
-
- /* Make a new operation class structure entry and initialize it. */
- op = (struct function_unit_op *) oballoc (sizeof (struct function_unit_op));
- op->condexp = condexp;
- op->num = unit->num_opclasses++;
- op->ready = ready_cost;
- op->issue_delay = issue_delay;
- op->next = unit->ops;
- unit->ops = op;
-
- /* Set our issue expression based on whether or not an optional conflict
- vector was specified. */
- if (XVEC (def, 6))
- {
- /* Compute the IOR of all the specified expressions. */
- rtx orexp = false_rtx;
- int i;
-
- for (i = 0; i < XVECLEN (def, 6); i++)
- orexp = insert_right_side (IOR, orexp, XVECEXP (def, 6, i), -2, -2);
-
- op->conflict_exp = orexp;
- extend_range (&unit->issue_delay, 1, issue_delay);
- }
- else
- {
- op->conflict_exp = true_rtx;
- extend_range (&unit->issue_delay, issue_delay, issue_delay);
- }
-
- /* Merge our conditional into that of the function unit so we can determine
- which insns are used by the function unit. */
- unit->condexp = insert_right_side (IOR, unit->condexp, op->condexp, -2, -2);
-}
-
-/* Given a piece of RTX, print a C expression to test it's truth value.
- We use AND and IOR both for logical and bit-wise operations, so
- interpret them as logical unless they are inside a comparison expression.
- The second operand of this function will be non-zero in that case. */
-
-static void
-write_test_expr (exp, in_comparison)
- rtx exp;
- int in_comparison;
-{
- int comparison_operator = 0;
- RTX_CODE code;
- struct attr_desc *attr;
-
- /* In order not to worry about operator precedence, surround our part of
- the expression with parentheses. */
-
- printf ("(");
- code = GET_CODE (exp);
- switch (code)
- {
- /* Binary operators. */
- case EQ: case NE:
- case GE: case GT: case GEU: case GTU:
- case LE: case LT: case LEU: case LTU:
- comparison_operator = 1;
-
- case PLUS: case MINUS: case MULT: case DIV: case MOD:
- case AND: case IOR: case XOR:
- case ASHIFT: case LSHIFTRT: case ASHIFTRT:
- write_test_expr (XEXP (exp, 0), in_comparison || comparison_operator);
- switch (code)
- {
- case EQ:
- printf (" == ");
- break;
- case NE:
- printf (" != ");
- break;
- case GE:
- printf (" >= ");
- break;
- case GT:
- printf (" > ");
- break;
- case GEU:
- printf (" >= (unsigned) ");
- break;
- case GTU:
- printf (" > (unsigned) ");
- break;
- case LE:
- printf (" <= ");
- break;
- case LT:
- printf (" < ");
- break;
- case LEU:
- printf (" <= (unsigned) ");
- break;
- case LTU:
- printf (" < (unsigned) ");
- break;
- case PLUS:
- printf (" + ");
- break;
- case MINUS:
- printf (" - ");
- break;
- case MULT:
- printf (" * ");
- break;
- case DIV:
- printf (" / ");
- break;
- case MOD:
- printf (" %% ");
- break;
- case AND:
- if (in_comparison)
- printf (" & ");
- else
- printf (" && ");
- break;
- case IOR:
- if (in_comparison)
- printf (" | ");
- else
- printf (" || ");
- break;
- case XOR:
- printf (" ^ ");
- break;
- case ASHIFT:
- printf (" << ");
- break;
- case LSHIFTRT:
- case ASHIFTRT:
- printf (" >> ");
- break;
- }
-
- write_test_expr (XEXP (exp, 1), in_comparison || comparison_operator);
- break;
-
- case NOT:
- /* Special-case (not (eq_attrq "alternative" "x")) */
- if (! in_comparison && GET_CODE (XEXP (exp, 0)) == EQ_ATTR
- && XSTR (XEXP (exp, 0), 0) == alternative_name)
- {
- printf ("which_alternative != %s", XSTR (XEXP (exp, 0), 1));
- break;
- }
-
- /* Otherwise, fall through to normal unary operator. */
-
- /* Unary operators. */
- case ABS: case NEG:
- switch (code)
- {
- case NOT:
- if (in_comparison)
- printf ("~ ");
- else
- printf ("! ");
- break;
- case ABS:
- printf ("abs ");
- break;
- case NEG:
- printf ("-");
- break;
- }
-
- write_test_expr (XEXP (exp, 0), in_comparison);
- break;
-
- /* Comparison test of an attribute with a value. Most of these will
- have been removed by optimization. Handle "alternative"
- specially and give error if EQ_ATTR present inside a comparison. */
- case EQ_ATTR:
- if (in_comparison)
- fatal ("EQ_ATTR not valid inside comparison");
-
- if (XSTR (exp, 0) == alternative_name)
- {
- printf ("which_alternative == %s", XSTR (exp, 1));
- break;
- }
-
- attr = find_attr (XSTR (exp, 0), 0);
- if (! attr) abort ();
-
- /* Now is the time to expand the value of a constant attribute. */
- if (attr->is_const)
- {
- write_test_expr (evaluate_eq_attr (exp, attr->default_val->value,
- -2, -2),
- in_comparison);
- }
- else
- {
- printf ("get_attr_%s (insn) == ", attr->name);
- write_attr_valueq (attr, XSTR (exp, 1));
- }
- break;
-
- /* Comparison test of flags for define_delays. */
- case ATTR_FLAG:
- if (in_comparison)
- fatal ("ATTR_FLAG not valid inside comparison");
- printf ("(flags & ATTR_FLAG_%s) != 0", XSTR (exp, 0));
- break;
-
- /* See if an operand matches a predicate. */
- case MATCH_OPERAND:
- /* If only a mode is given, just ensure the mode matches the operand.
- If neither a mode nor predicate is given, error. */
- if (XSTR (exp, 1) == NULL || *XSTR (exp, 1) == '\0')
- {
- if (GET_MODE (exp) == VOIDmode)
- fatal ("Null MATCH_OPERAND specified as test");
- else
- printf ("GET_MODE (operands[%d]) == %smode",
- XINT (exp, 0), GET_MODE_NAME (GET_MODE (exp)));
- }
- else
- printf ("%s (operands[%d], %smode)",
- XSTR (exp, 1), XINT (exp, 0), GET_MODE_NAME (GET_MODE (exp)));
- break;
-
- /* Constant integer. */
- case CONST_INT:
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- printf ("%d", XWINT (exp, 0));
-#else
- printf ("%ld", XWINT (exp, 0));
-#endif
- break;
-
- /* A random C expression. */
- case SYMBOL_REF:
- printf ("%s", XSTR (exp, 0));
- break;
-
- /* The address of the branch target. */
- case MATCH_DUP:
- printf ("insn_addresses[INSN_UID (GET_CODE (operands[%d]) == LABEL_REF ? XEXP (operands[%d], 0) : operands[%d])]",
- XINT (exp, 0), XINT (exp, 0), XINT (exp, 0));
- break;
-
- /* The address of the current insn. It would be more consistent with
- other usage to make this the address of the NEXT insn, but this gets
- too confusing because of the ambiguity regarding the length of the
- current insn. */
- case PC:
- printf ("insn_current_address");
- break;
-
- default:
- fatal ("bad RTX code `%s' in attribute calculation\n",
- GET_RTX_NAME (code));
- }
-
- printf (")");
-}
-
-/* Given an attribute value, return the maximum CONST_STRING argument
- encountered. It is assumed that they are all numeric. */
-
-static int
-max_attr_value (exp)
- rtx exp;
-{
- int current_max = 0;
- int n;
- int i;
-
- if (GET_CODE (exp) == CONST_STRING)
- return atoi (XSTR (exp, 0));
-
- else if (GET_CODE (exp) == COND)
- {
- for (i = 0; i < XVECLEN (exp, 0); i += 2)
- {
- n = max_attr_value (XVECEXP (exp, 0, i + 1));
- if (n > current_max)
- current_max = n;
- }
-
- n = max_attr_value (XEXP (exp, 1));
- if (n > current_max)
- current_max = n;
- }
-
- else if (GET_CODE (exp) == IF_THEN_ELSE)
- {
- current_max = max_attr_value (XEXP (exp, 1));
- n = max_attr_value (XEXP (exp, 2));
- if (n > current_max)
- current_max = n;
- }
-
- else
- abort ();
-
- return current_max;
-}
-
-/* Scan an attribute value, possibly a conditional, and record what actions
- will be required to do any conditional tests in it.
-
- Specifically, set
- `must_extract' if we need to extract the insn operands
- `must_constrain' if we must compute `which_alternative'
- `address_used' if an address expression was used
- `length_used' if an (eq_attr "length" ...) was used
- */
-
-static void
-walk_attr_value (exp)
- rtx exp;
-{
- register int i, j;
- register char *fmt;
- RTX_CODE code;
-
- if (exp == NULL)
- return;
-
- code = GET_CODE (exp);
- switch (code)
- {
- case SYMBOL_REF:
- if (! RTX_UNCHANGING_P (exp))
- /* Since this is an arbitrary expression, it can look at anything.
- However, constant expressions do not depend on any particular
- insn. */
- must_extract = must_constrain = 1;
- return;
-
- case MATCH_OPERAND:
- must_extract = 1;
- return;
-
- case EQ_ATTR:
- if (XSTR (exp, 0) == alternative_name)
- must_extract = must_constrain = 1;
- else if (strcmp (XSTR (exp, 0), "length") == 0)
- length_used = 1;
- return;
-
- case MATCH_DUP:
- must_extract = 1;
- address_used = 1;
- return;
-
- case PC:
- address_used = 1;
- return;
-
- case ATTR_FLAG:
- return;
- }
-
- for (i = 0, fmt = GET_RTX_FORMAT (code); i < GET_RTX_LENGTH (code); i++)
- switch (*fmt++)
- {
- case 'e':
- case 'u':
- walk_attr_value (XEXP (exp, i));
- break;
-
- case 'E':
- if (XVEC (exp, i) != NULL)
- for (j = 0; j < XVECLEN (exp, i); j++)
- walk_attr_value (XVECEXP (exp, i, j));
- break;
- }
-}
-
-/* Write out a function to obtain the attribute for a given INSN. */
-
-static void
-write_attr_get (attr)
- struct attr_desc *attr;
-{
- struct attr_value *av, *common_av;
-
- /* Find the most used attribute value. Handle that as the `default' of the
- switch we will generate. */
- common_av = find_most_used (attr);
-
- /* Write out start of function, then all values with explicit `case' lines,
- then a `default', then the value with the most uses. */
- if (!attr->is_numeric)
- printf ("enum attr_%s\n", attr->name);
- else if (attr->unsigned_p)
- printf ("unsigned int\n");
- else
- printf ("int\n");
-
- /* If the attribute name starts with a star, the remainder is the name of
- the subroutine to use, instead of `get_attr_...'. */
- if (attr->name[0] == '*')
- printf ("%s (insn)\n", &attr->name[1]);
- else if (attr->is_const == 0)
- printf ("get_attr_%s (insn)\n", attr->name);
- else
- {
- printf ("get_attr_%s ()\n", attr->name);
- printf ("{\n");
-
- for (av = attr->first_value; av; av = av->next)
- if (av->num_insns != 0)
- write_attr_set (attr, 2, av->value, "return", ";",
- true_rtx, av->first_insn->insn_code,
- av->first_insn->insn_index);
-
- printf ("}\n\n");
- return;
- }
- printf (" rtx insn;\n");
- printf ("{\n");
- printf (" switch (recog_memoized (insn))\n");
- printf (" {\n");
-
- for (av = attr->first_value; av; av = av->next)
- if (av != common_av)
- write_attr_case (attr, av, 1, "return", ";", 4, true_rtx);
-
- write_attr_case (attr, common_av, 0, "return", ";", 4, true_rtx);
- printf (" }\n}\n\n");
-}
-
-/* Given an AND tree of known true terms (because we are inside an `if' with
- that as the condition or are in an `else' clause) and an expression,
- replace any known true terms with TRUE. Use `simplify_and_tree' to do
- the bulk of the work. */
-
-static rtx
-eliminate_known_true (known_true, exp, insn_code, insn_index)
- rtx known_true;
- rtx exp;
- int insn_code, insn_index;
-{
- rtx term;
-
- known_true = SIMPLIFY_TEST_EXP (known_true, insn_code, insn_index);
-
- if (GET_CODE (known_true) == AND)
- {
- exp = eliminate_known_true (XEXP (known_true, 0), exp,
- insn_code, insn_index);
- exp = eliminate_known_true (XEXP (known_true, 1), exp,
- insn_code, insn_index);
- }
- else
- {
- term = known_true;
- exp = simplify_and_tree (exp, &term, insn_code, insn_index);
- }
-
- return exp;
-}
-
-/* Write out a series of tests and assignment statements to perform tests and
- sets of an attribute value. We are passed an indentation amount and prefix
- and suffix strings to write around each attribute value (e.g., "return"
- and ";"). */
-
-static void
-write_attr_set (attr, indent, value, prefix, suffix, known_true,
- insn_code, insn_index)
- struct attr_desc *attr;
- int indent;
- rtx value;
- char *prefix;
- char *suffix;
- rtx known_true;
- int insn_code, insn_index;
-{
- if (GET_CODE (value) == CONST_STRING)
- {
- write_indent (indent);
- printf ("%s ", prefix);
- write_attr_value (attr, value);
- printf ("%s\n", suffix);
- }
- else if (GET_CODE (value) == COND)
- {
- /* Assume the default value will be the default of the COND unless we
- find an always true expression. */
- rtx default_val = XEXP (value, 1);
- rtx our_known_true = known_true;
- rtx newexp;
- int first_if = 1;
- int i;
-
- for (i = 0; i < XVECLEN (value, 0); i += 2)
- {
- rtx testexp;
- rtx inner_true;
-
- testexp = eliminate_known_true (our_known_true,
- XVECEXP (value, 0, i),
- insn_code, insn_index);
- newexp = attr_rtx (NOT, testexp);
- newexp = insert_right_side (AND, our_known_true, newexp,
- insn_code, insn_index);
-
- /* If the test expression is always true or if the next `known_true'
- expression is always false, this is the last case, so break
- out and let this value be the `else' case. */
- if (testexp == true_rtx || newexp == false_rtx)
- {
- default_val = XVECEXP (value, 0, i + 1);
- break;
- }
-
- /* Compute the expression to pass to our recursive call as being
- known true. */
- inner_true = insert_right_side (AND, our_known_true,
- testexp, insn_code, insn_index);
-
- /* If this is always false, skip it. */
- if (inner_true == false_rtx)
- continue;
-
- write_indent (indent);
- printf ("%sif ", first_if ? "" : "else ");
- first_if = 0;
- write_test_expr (testexp, 0);
- printf ("\n");
- write_indent (indent + 2);
- printf ("{\n");
-
- write_attr_set (attr, indent + 4,
- XVECEXP (value, 0, i + 1), prefix, suffix,
- inner_true, insn_code, insn_index);
- write_indent (indent + 2);
- printf ("}\n");
- our_known_true = newexp;
- }
-
- if (! first_if)
- {
- write_indent (indent);
- printf ("else\n");
- write_indent (indent + 2);
- printf ("{\n");
- }
-
- write_attr_set (attr, first_if ? indent : indent + 4, default_val,
- prefix, suffix, our_known_true, insn_code, insn_index);
-
- if (! first_if)
- {
- write_indent (indent + 2);
- printf ("}\n");
- }
- }
- else
- abort ();
-}
-
-/* Write out the computation for one attribute value. */
-
-static void
-write_attr_case (attr, av, write_case_lines, prefix, suffix, indent,
- known_true)
- struct attr_desc *attr;
- struct attr_value *av;
- int write_case_lines;
- char *prefix, *suffix;
- int indent;
- rtx known_true;
-{
- struct insn_ent *ie;
-
- if (av->num_insns == 0)
- return;
-
- if (av->has_asm_insn)
- {
- write_indent (indent);
- printf ("case -1:\n");
- write_indent (indent + 2);
- printf ("if (GET_CODE (PATTERN (insn)) != ASM_INPUT\n");
- write_indent (indent + 2);
- printf (" && asm_noperands (PATTERN (insn)) < 0)\n");
- write_indent (indent + 2);
- printf (" fatal_insn_not_found (insn);\n");
- }
-
- if (write_case_lines)
- {
- for (ie = av->first_insn; ie; ie = ie->next)
- if (ie->insn_code != -1)
- {
- write_indent (indent);
- printf ("case %d:\n", ie->insn_code);
- }
- }
- else
- {
- write_indent (indent);
- printf ("default:\n");
- }
-
- /* See what we have to do to output this value. */
- must_extract = must_constrain = address_used = 0;
- walk_attr_value (av->value);
-
- if (must_extract)
- {
- write_indent (indent + 2);
- printf ("insn_extract (insn);\n");
- }
-
- if (must_constrain)
- {
-#ifdef REGISTER_CONSTRAINTS
- write_indent (indent + 2);
- printf ("if (! constrain_operands (INSN_CODE (insn), reload_completed))\n");
- write_indent (indent + 2);
- printf (" fatal_insn_not_found (insn);\n");
-#endif
- }
-
- write_attr_set (attr, indent + 2, av->value, prefix, suffix,
- known_true, av->first_insn->insn_code,
- av->first_insn->insn_index);
-
- if (strncmp (prefix, "return", 6))
- {
- write_indent (indent + 2);
- printf ("break;\n");
- }
- printf ("\n");
-}
-
-/* Utilities to write names in various forms. */
-
-static void
-write_attr_valueq (attr, s)
- struct attr_desc *attr;
- char *s;
-{
- if (attr->is_numeric)
- {
- printf ("%s", s);
- /* Make the blockage range values easier to read. */
- if (strlen (s) > 1)
- printf (" /* 0x%x */", atoi (s));
- }
- else
- {
- write_upcase (attr->name);
- printf ("_");
- write_upcase (s);
- }
-}
-
-static void
-write_attr_value (attr, value)
- struct attr_desc *attr;
- rtx value;
-{
- if (GET_CODE (value) != CONST_STRING)
- abort ();
-
- write_attr_valueq (attr, XSTR (value, 0));
-}
-
-static void
-write_upcase (str)
- char *str;
-{
- while (*str)
- if (*str < 'a' || *str > 'z')
- printf ("%c", *str++);
- else
- printf ("%c", *str++ - 'a' + 'A');
-}
-
-static void
-write_indent (indent)
- int indent;
-{
- for (; indent > 8; indent -= 8)
- printf ("\t");
-
- for (; indent; indent--)
- printf (" ");
-}
-
-/* Write a subroutine that is given an insn that requires a delay slot, a
- delay slot ordinal, and a candidate insn. It returns non-zero if the
- candidate can be placed in the specified delay slot of the insn.
-
- We can write as many as three subroutines. `eligible_for_delay'
- handles normal delay slots, `eligible_for_annul_true' indicates that
- the specified insn can be annulled if the branch is true, and likewise
- for `eligible_for_annul_false'.
-
- KIND is a string distinguishing these three cases ("delay", "annul_true",
- or "annul_false"). */
-
-static void
-write_eligible_delay (kind)
- char *kind;
-{
- struct delay_desc *delay;
- int max_slots;
- char str[50];
- struct attr_desc *attr;
- struct attr_value *av, *common_av;
- int i;
-
- /* Compute the maximum number of delay slots required. We use the delay
- ordinal times this number plus one, plus the slot number as an index into
- the appropriate predicate to test. */
-
- for (delay = delays, max_slots = 0; delay; delay = delay->next)
- if (XVECLEN (delay->def, 1) / 3 > max_slots)
- max_slots = XVECLEN (delay->def, 1) / 3;
-
- /* Write function prelude. */
-
- printf ("int\n");
- printf ("eligible_for_%s (delay_insn, slot, candidate_insn, flags)\n",
- kind);
- printf (" rtx delay_insn;\n");
- printf (" int slot;\n");
- printf (" rtx candidate_insn;\n");
- printf (" int flags;\n");
- printf ("{\n");
- printf (" rtx insn;\n");
- printf ("\n");
- printf (" if (slot >= %d)\n", max_slots);
- printf (" abort ();\n");
- printf ("\n");
-
- /* If more than one delay type, find out which type the delay insn is. */
-
- if (num_delays > 1)
- {
- attr = find_attr ("*delay_type", 0);
- if (! attr) abort ();
- common_av = find_most_used (attr);
-
- printf (" insn = delay_insn;\n");
- printf (" switch (recog_memoized (insn))\n");
- printf (" {\n");
-
- sprintf (str, " * %d;\n break;", max_slots);
- for (av = attr->first_value; av; av = av->next)
- if (av != common_av)
- write_attr_case (attr, av, 1, "slot +=", str, 4, true_rtx);
-
- write_attr_case (attr, common_av, 0, "slot +=", str, 4, true_rtx);
- printf (" }\n\n");
-
- /* Ensure matched. Otherwise, shouldn't have been called. */
- printf (" if (slot < %d)\n", max_slots);
- printf (" abort ();\n\n");
- }
-
- /* If just one type of delay slot, write simple switch. */
- if (num_delays == 1 && max_slots == 1)
- {
- printf (" insn = candidate_insn;\n");
- printf (" switch (recog_memoized (insn))\n");
- printf (" {\n");
-
- attr = find_attr ("*delay_1_0", 0);
- if (! attr) abort ();
- common_av = find_most_used (attr);
-
- for (av = attr->first_value; av; av = av->next)
- if (av != common_av)
- write_attr_case (attr, av, 1, "return", ";", 4, true_rtx);
-
- write_attr_case (attr, common_av, 0, "return", ";", 4, true_rtx);
- printf (" }\n");
- }
-
- else
- {
- /* Write a nested CASE. The first indicates which condition we need to
- test, and the inner CASE tests the condition. */
- printf (" insn = candidate_insn;\n");
- printf (" switch (slot)\n");
- printf (" {\n");
-
- for (delay = delays; delay; delay = delay->next)
- for (i = 0; i < XVECLEN (delay->def, 1); i += 3)
- {
- printf (" case %d:\n",
- (i / 3) + (num_delays == 1 ? 0 : delay->num * max_slots));
- printf (" switch (recog_memoized (insn))\n");
- printf ("\t{\n");
-
- sprintf (str, "*%s_%d_%d", kind, delay->num, i / 3);
- attr = find_attr (str, 0);
- if (! attr) abort ();
- common_av = find_most_used (attr);
-
- for (av = attr->first_value; av; av = av->next)
- if (av != common_av)
- write_attr_case (attr, av, 1, "return", ";", 8, true_rtx);
-
- write_attr_case (attr, common_av, 0, "return", ";", 8, true_rtx);
- printf (" }\n");
- }
-
- printf (" default:\n");
- printf (" abort ();\n");
- printf (" }\n");
- }
-
- printf ("}\n\n");
-}
-
-/* Write routines to compute conflict cost for function units. Then write a
- table describing the available function units. */
-
-static void
-write_function_unit_info ()
-{
- struct function_unit *unit;
- int i;
-
- /* Write out conflict routines for function units. Don't bother writing
- one if there is only one issue delay value. */
-
- for (unit = units; unit; unit = unit->next)
- {
- if (unit->needs_blockage_function)
- write_complex_function (unit, "blockage", "block");
-
- /* If the minimum and maximum conflict costs are the same, there
- is only one value, so we don't need a function. */
- if (! unit->needs_conflict_function)
- {
- unit->default_cost = make_numeric_value (unit->issue_delay.max);
- continue;
- }
-
- /* The function first computes the case from the candidate insn. */
- unit->default_cost = make_numeric_value (0);
- write_complex_function (unit, "conflict_cost", "cost");
- }
-
- /* Now that all functions have been written, write the table describing
- the function units. The name is included for documentation purposes
- only. */
-
- printf ("struct function_unit_desc function_units[] = {\n");
-
- /* Write out the descriptions in numeric order, but don't force that order
- on the list. Doing so increases the runtime of genattrtab.c. */
- for (i = 0; i < num_units; i++)
- {
- for (unit = units; unit; unit = unit->next)
- if (unit->num == i)
- break;
-
- printf (" {\"%s\", %d, %d, %d, %s, %d, %s_unit_ready_cost, ",
- unit->name, 1 << unit->num, unit->multiplicity,
- unit->simultaneity, XSTR (unit->default_cost, 0),
- unit->issue_delay.max, unit->name);
-
- if (unit->needs_conflict_function)
- printf ("%s_unit_conflict_cost, ", unit->name);
- else
- printf ("0, ");
-
- printf ("%d, ", unit->max_blockage);
-
- if (unit->needs_range_function)
- printf ("%s_unit_blockage_range, ", unit->name);
- else
- printf ("0, ");
-
- if (unit->needs_blockage_function)
- printf ("%s_unit_blockage", unit->name);
- else
- printf ("0");
-
- printf ("}, \n");
- }
-
- printf ("};\n\n");
-}
-
-static void
-write_complex_function (unit, name, connection)
- struct function_unit *unit;
- char *name, *connection;
-{
- struct attr_desc *case_attr, *attr;
- struct attr_value *av, *common_av;
- rtx value;
- char *str;
- int using_case;
- int i;
-
- printf ("static int\n");
- printf ("%s_unit_%s (executing_insn, candidate_insn)\n",
- unit->name, name);
- printf (" rtx executing_insn;\n");
- printf (" rtx candidate_insn;\n");
- printf ("{\n");
- printf (" rtx insn;\n");
- printf (" int casenum;\n\n");
- printf (" insn = executing_insn;\n");
- printf (" switch (recog_memoized (insn))\n");
- printf (" {\n");
-
- /* Write the `switch' statement to get the case value. */
- str = (char *) alloca (strlen (unit->name) + strlen (name) + strlen (connection) + 10);
- sprintf (str, "*%s_cases", unit->name);
- case_attr = find_attr (str, 0);
- if (! case_attr) abort ();
- common_av = find_most_used (case_attr);
-
- for (av = case_attr->first_value; av; av = av->next)
- if (av != common_av)
- write_attr_case (case_attr, av, 1,
- "casenum =", ";", 4, unit->condexp);
-
- write_attr_case (case_attr, common_av, 0,
- "casenum =", ";", 4, unit->condexp);
- printf (" }\n\n");
-
- /* Now write an outer switch statement on each case. Then write
- the tests on the executing function within each. */
- printf (" insn = candidate_insn;\n");
- printf (" switch (casenum)\n");
- printf (" {\n");
-
- for (i = 0; i < unit->num_opclasses; i++)
- {
- /* Ensure using this case. */
- using_case = 0;
- for (av = case_attr->first_value; av; av = av->next)
- if (av->num_insns
- && contained_in_p (make_numeric_value (i), av->value))
- using_case = 1;
-
- if (! using_case)
- continue;
-
- printf (" case %d:\n", i);
- sprintf (str, "*%s_%s_%d", unit->name, connection, i);
- attr = find_attr (str, 0);
- if (! attr) abort ();
-
- /* If single value, just write it. */
- value = find_single_value (attr);
- if (value)
- write_attr_set (attr, 6, value, "return", ";\n", true_rtx, -2, -2);
- else
- {
- common_av = find_most_used (attr);
- printf (" switch (recog_memoized (insn))\n");
- printf ("\t{\n");
-
- for (av = attr->first_value; av; av = av->next)
- if (av != common_av)
- write_attr_case (attr, av, 1,
- "return", ";", 8, unit->condexp);
-
- write_attr_case (attr, common_av, 0,
- "return", ";", 8, unit->condexp);
- printf (" }\n\n");
- }
- }
-
- printf (" }\n}\n\n");
-}
-
-/* This page contains miscellaneous utility routines. */
-
-/* Given a string, return the number of comma-separated elements in it.
- Return 0 for the null string. */
-
-static int
-n_comma_elts (s)
- char *s;
-{
- int n;
-
- if (*s == '\0')
- return 0;
-
- for (n = 1; *s; s++)
- if (*s == ',')
- n++;
-
- return n;
-}
-
-/* Given a pointer to a (char *), return a malloc'ed string containing the
- next comma-separated element. Advance the pointer to after the string
- scanned, or the end-of-string. Return NULL if at end of string. */
-
-static char *
-next_comma_elt (pstr)
- char **pstr;
-{
- char *out_str;
- char *p;
-
- if (**pstr == '\0')
- return NULL;
-
- /* Find end of string to compute length. */
- for (p = *pstr; *p != ',' && *p != '\0'; p++)
- ;
-
- out_str = attr_string (*pstr, p - *pstr);
- *pstr = p;
-
- if (**pstr == ',')
- (*pstr)++;
-
- return out_str;
-}
-
-/* Return a `struct attr_desc' pointer for a given named attribute. If CREATE
- is non-zero, build a new attribute, if one does not exist. */
-
-static struct attr_desc *
-find_attr (name, create)
- char *name;
- int create;
-{
- struct attr_desc *attr;
- int index;
-
- /* Before we resort to using `strcmp', see if the string address matches
- anywhere. In most cases, it should have been canonicalized to do so. */
- if (name == alternative_name)
- return NULL;
-
- index = name[0] & (MAX_ATTRS_INDEX - 1);
- for (attr = attrs[index]; attr; attr = attr->next)
- if (name == attr->name)
- return attr;
-
- /* Otherwise, do it the slow way. */
- for (attr = attrs[index]; attr; attr = attr->next)
- if (name[0] == attr->name[0] && ! strcmp (name, attr->name))
- return attr;
-
- if (! create)
- return NULL;
-
- attr = (struct attr_desc *) oballoc (sizeof (struct attr_desc));
- attr->name = attr_string (name, strlen (name));
- attr->first_value = attr->default_val = NULL;
- attr->is_numeric = attr->negative_ok = attr->is_const = attr->is_special = 0;
- attr->next = attrs[index];
- attrs[index] = attr;
-
- return attr;
-}
-
-/* Create internal attribute with the given default value. */
-
-static void
-make_internal_attr (name, value, special)
- char *name;
- rtx value;
- int special;
-{
- struct attr_desc *attr;
-
- attr = find_attr (name, 1);
- if (attr->default_val)
- abort ();
-
- attr->is_numeric = 1;
- attr->is_const = 0;
- attr->is_special = (special & 1) != 0;
- attr->negative_ok = (special & 2) != 0;
- attr->unsigned_p = (special & 4) != 0;
- attr->default_val = get_attr_value (value, attr, -2);
-}
-
-/* Find the most used value of an attribute. */
-
-static struct attr_value *
-find_most_used (attr)
- struct attr_desc *attr;
-{
- struct attr_value *av;
- struct attr_value *most_used;
- int nuses;
-
- most_used = NULL;
- nuses = -1;
-
- for (av = attr->first_value; av; av = av->next)
- if (av->num_insns > nuses)
- nuses = av->num_insns, most_used = av;
-
- return most_used;
-}
-
-/* If an attribute only has a single value used, return it. Otherwise
- return NULL. */
-
-static rtx
-find_single_value (attr)
- struct attr_desc *attr;
-{
- struct attr_value *av;
- rtx unique_value;
-
- unique_value = NULL;
- for (av = attr->first_value; av; av = av->next)
- if (av->num_insns)
- {
- if (unique_value)
- return NULL;
- else
- unique_value = av->value;
- }
-
- return unique_value;
-}
-
-/* Return (attr_value "n") */
-
-static rtx
-make_numeric_value (n)
- int n;
-{
- static rtx int_values[20];
- rtx exp;
- char *p;
-
- if (n < 0)
- abort ();
-
- if (n < 20 && int_values[n])
- return int_values[n];
-
- p = attr_printf (MAX_DIGITS, "%d", n);
- exp = attr_rtx (CONST_STRING, p);
-
- if (n < 20)
- int_values[n] = exp;
-
- return exp;
-}
-
-static void
-extend_range (range, min, max)
- struct range *range;
- int min;
- int max;
-{
- if (range->min > min) range->min = min;
- if (range->max < max) range->max = max;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
- return val;
-}
-
-static rtx
-copy_rtx_unchanging (orig)
- register rtx orig;
-{
-#if 0
- register rtx copy;
- register RTX_CODE code;
-#endif
-
- if (RTX_UNCHANGING_P (orig) || MEM_IN_STRUCT_P (orig))
- return orig;
-
- MEM_IN_STRUCT_P (orig) = 1;
- return orig;
-
-#if 0
- code = GET_CODE (orig);
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- return orig;
- }
-
- copy = rtx_alloc (code);
- PUT_MODE (copy, GET_MODE (orig));
- RTX_UNCHANGING_P (copy) = 1;
-
- bcopy ((char *) &XEXP (orig, 0), (char *) &XEXP (copy, 0),
- GET_RTX_LENGTH (GET_CODE (copy)) * sizeof (rtx));
- return copy;
-#endif
-}
-
-static void
-fatal (s, a1, a2)
- char *s;
- char *a1, *a2;
-{
- fprintf (stderr, "genattrtab: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-/* Determine if an insn has a constant number of delay slots, i.e., the
- number of delay slots is not a function of the length of the insn. */
-
-void
-write_const_num_delay_slots ()
-{
- struct attr_desc *attr = find_attr ("*num_delay_slots", 0);
- struct attr_value *av;
- struct insn_ent *ie;
- int i;
-
- if (attr)
- {
- printf ("int\nconst_num_delay_slots (insn)\n");
- printf (" rtx insn;\n");
- printf ("{\n");
- printf (" switch (recog_memoized (insn))\n");
- printf (" {\n");
-
- for (av = attr->first_value; av; av = av->next)
- {
- length_used = 0;
- walk_attr_value (av->value);
- if (length_used)
- {
- for (ie = av->first_insn; ie; ie = ie->next)
- if (ie->insn_code != -1)
- printf (" case %d:\n", ie->insn_code);
- printf (" return 0;\n");
- }
- }
-
- printf (" default:\n");
- printf (" return 1;\n");
- printf (" }\n}\n");
- }
-}
-
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- FILE *infile;
- register int c;
- struct attr_desc *attr;
- struct insn_def *id;
- rtx tem;
- int i;
-
-#ifdef RLIMIT_STACK
- /* Get rid of any avoidable limit on stack size. */
- {
- struct rlimit rlim;
-
- /* Set the stack limit huge so that alloca does not fail. */
- getrlimit (RLIMIT_STACK, &rlim);
- rlim.rlim_cur = rlim.rlim_max;
- setrlimit (RLIMIT_STACK, &rlim);
- }
-#endif /* RLIMIT_STACK defined */
-
- obstack_init (rtl_obstack);
- obstack_init (hash_obstack);
- obstack_init (temp_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- /* Set up true and false rtx's */
- true_rtx = rtx_alloc (CONST_INT);
- XWINT (true_rtx, 0) = 1;
- false_rtx = rtx_alloc (CONST_INT);
- XWINT (false_rtx, 0) = 0;
- RTX_UNCHANGING_P (true_rtx) = RTX_UNCHANGING_P (false_rtx) = 1;
- RTX_INTEGRATED_P (true_rtx) = RTX_INTEGRATED_P (false_rtx) = 1;
-
- alternative_name = attr_string ("alternative", strlen ("alternative"));
-
- printf ("/* Generated automatically by the program `genattrtab'\n\
-from the machine description file `md'. */\n\n");
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN
- || GET_CODE (desc) == DEFINE_PEEPHOLE
- || GET_CODE (desc) == DEFINE_ASM_ATTRIBUTES)
- gen_insn (desc);
-
- else if (GET_CODE (desc) == DEFINE_EXPAND)
- insn_code_number++, insn_index_number++;
-
- else if (GET_CODE (desc) == DEFINE_SPLIT)
- insn_code_number++, insn_index_number++;
-
- else if (GET_CODE (desc) == DEFINE_ATTR)
- {
- gen_attr (desc);
- insn_index_number++;
- }
-
- else if (GET_CODE (desc) == DEFINE_DELAY)
- {
- gen_delay (desc);
- insn_index_number++;
- }
-
- else if (GET_CODE (desc) == DEFINE_FUNCTION_UNIT)
- {
- gen_unit (desc);
- insn_index_number++;
- }
- }
-
- /* If we didn't have a DEFINE_ASM_ATTRIBUTES, make a null one. */
- if (! got_define_asm_attributes)
- {
- tem = rtx_alloc (DEFINE_ASM_ATTRIBUTES);
- XVEC (tem, 0) = rtvec_alloc (0);
- gen_insn (tem);
- }
-
- /* Expand DEFINE_DELAY information into new attribute. */
- if (num_delays)
- expand_delays ();
-
- /* Expand DEFINE_FUNCTION_UNIT information into new attributes. */
- if (num_units)
- expand_units ();
-
- printf ("#include \"config.h\"\n");
- printf ("#include \"rtl.h\"\n");
- printf ("#include \"insn-config.h\"\n");
- printf ("#include \"recog.h\"\n");
- printf ("#include \"regs.h\"\n");
- printf ("#include \"real.h\"\n");
- printf ("#include \"output.h\"\n");
- printf ("#include \"insn-attr.h\"\n");
- printf ("\n");
- printf ("#define operands recog_operand\n\n");
-
- /* Make `insn_alternatives'. */
- insn_alternatives = (int *) oballoc (insn_code_number * sizeof (int));
- for (id = defs; id; id = id->next)
- if (id->insn_code >= 0)
- insn_alternatives[id->insn_code] = (1 << id->num_alternatives) - 1;
-
- /* Make `insn_n_alternatives'. */
- insn_n_alternatives = (int *) oballoc (insn_code_number * sizeof (int));
- for (id = defs; id; id = id->next)
- if (id->insn_code >= 0)
- insn_n_alternatives[id->insn_code] = id->num_alternatives;
-
- /* Prepare to write out attribute subroutines by checking everything stored
- away and building the attribute cases. */
-
- check_defs ();
- for (i = 0; i < MAX_ATTRS_INDEX; i++)
- for (attr = attrs[i]; attr; attr = attr->next)
- {
- attr->default_val->value
- = check_attr_value (attr->default_val->value, attr);
- fill_attr (attr);
- }
-
- /* Construct extra attributes for `length'. */
- make_length_attrs ();
-
- /* Perform any possible optimizations to speed up compilation. */
- optimize_attrs ();
-
- /* Now write out all the `gen_attr_...' routines. Do these before the
- special routines (specifically before write_function_unit_info), so
- that they get defined before they are used. */
-
- for (i = 0; i < MAX_ATTRS_INDEX; i++)
- for (attr = attrs[i]; attr; attr = attr->next)
- {
- if (! attr->is_special)
- write_attr_get (attr);
- }
-
- /* Write out delay eligibility information, if DEFINE_DELAY present.
- (The function to compute the number of delay slots will be written
- below.) */
- if (num_delays)
- {
- write_eligible_delay ("delay");
- if (have_annul_true)
- write_eligible_delay ("annul_true");
- if (have_annul_false)
- write_eligible_delay ("annul_false");
- }
-
- /* Write out information about function units. */
- if (num_units)
- write_function_unit_info ();
-
- /* Write out constant delay slot info */
- write_const_num_delay_slots ();
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/gencodes.c b/gcc/gencodes.c
deleted file mode 100644
index 8baf3b83e0b..00000000000
--- a/gcc/gencodes.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Generate from machine description:
-
- - some macros CODE_FOR_... giving the insn_code_number value
- for each of the defined standard insn names.
- Copyright (C) 1987, 1991, 1995 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. */
-
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern rtx read_rtx ();
-
-char *xmalloc ();
-static void fatal ();
-void fancy_abort ();
-
-static int insn_code_number;
-
-static void
-gen_insn (insn)
- rtx insn;
-{
- /* Don't mention instructions whose names are the null string
- or begin with '*'. They are in the machine description just
- to be recognized. */
- if (XSTR (insn, 0)[0] != 0 && XSTR (insn, 0)[0] != '*')
- printf (" CODE_FOR_%s = %d,\n", XSTR (insn, 0),
- insn_code_number);
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
- return val;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-static void
-fatal (s, a1, a2)
- char *s;
-{
- fprintf (stderr, "gencodes: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- FILE *infile;
- register int c;
-
- obstack_init (rtl_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- printf ("/* Generated automatically by the program `gencodes'\n\
-from the machine description file `md'. */\n\n");
-
- printf ("#ifndef MAX_INSN_CODE\n\n");
-
- /* Read the machine description. */
-
- insn_code_number = 0;
- printf ("enum insn_code {\n");
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND)
- {
- gen_insn (desc);
- insn_code_number++;
- }
- if (GET_CODE (desc) == DEFINE_PEEPHOLE
- || GET_CODE (desc) == DEFINE_SPLIT)
- {
- insn_code_number++;
- }
- }
-
- printf (" CODE_FOR_nothing };\n");
-
- printf ("\n#define MAX_INSN_CODE ((int) CODE_FOR_nothing)\n");
-
- printf ("#endif /* MAX_INSN_CODE */\n");
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
deleted file mode 100644
index 404534e120c..00000000000
--- a/gcc/genconfig.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/* Generate from machine description:
-
- - some #define configuration flags.
- Copyright (C) 1987, 1991 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. */
-
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern rtx read_rtx ();
-
-/* flags to determine output of machine description dependent #define's. */
-static int max_recog_operands; /* Largest operand number seen. */
-static int max_dup_operands; /* Largest number of match_dup in any insn. */
-static int max_clobbers_per_insn;
-static int register_constraint_flag;
-static int have_cc0_flag;
-static int have_cmove_flag;
-static int have_lo_sum_flag;
-
-/* Maximum number of insns seen in a split. */
-static int max_insns_per_split = 1;
-
-static int clobbers_seen_this_insn;
-static int dup_operands_seen_this_insn;
-
-char *xmalloc ();
-static void fatal ();
-void fancy_abort ();
-
-/* RECOG_P will be non-zero if this pattern was seen in a context where it will
- be used to recognize, rather than just generate an insn.
-
- NON_PC_SET_SRC will be non-zero if this pattern was seen in a SET_SRC
- of a SET whose destination is not (pc). */
-
-static void
-walk_insn_part (part, recog_p, non_pc_set_src)
- rtx part;
- int recog_p;
- int non_pc_set_src;
-{
- register int i, j;
- register RTX_CODE code;
- register char *format_ptr;
-
- if (part == 0)
- return;
-
- code = GET_CODE (part);
- switch (code)
- {
- case CLOBBER:
- clobbers_seen_this_insn++;
- break;
-
- case MATCH_OPERAND:
- if (XINT (part, 0) > max_recog_operands)
- max_recog_operands = XINT (part, 0);
- if (XSTR (part, 2) && *XSTR (part, 2))
- register_constraint_flag = 1;
- return;
-
- case MATCH_OP_DUP:
- case MATCH_PAR_DUP:
- ++dup_operands_seen_this_insn;
- case MATCH_SCRATCH:
- case MATCH_PARALLEL:
- case MATCH_OPERATOR:
- if (XINT (part, 0) > max_recog_operands)
- max_recog_operands = XINT (part, 0);
- /* Now scan the rtl's in the vector inside the MATCH_OPERATOR or
- MATCH_PARALLEL. */
- break;
-
- case LABEL_REF:
- if (GET_CODE (XEXP (part, 0)) == MATCH_OPERAND)
- break;
- return;
-
- case MATCH_DUP:
- ++dup_operands_seen_this_insn;
- if (XINT (part, 0) > max_recog_operands)
- max_recog_operands = XINT (part, 0);
- return;
-
- case CC0:
- if (recog_p)
- have_cc0_flag = 1;
- return;
-
- case LO_SUM:
- if (recog_p)
- have_lo_sum_flag = 1;
- return;
-
- case SET:
- walk_insn_part (SET_DEST (part), 0, recog_p);
- walk_insn_part (SET_SRC (part), recog_p,
- GET_CODE (SET_DEST (part)) != PC);
- return;
-
- case IF_THEN_ELSE:
- /* Only consider this machine as having a conditional move if the
- two arms of the IF_THEN_ELSE are both MATCH_OPERAND. Otherwise,
- we have some specific IF_THEN_ELSE construct (like the doz
- instruction on the RS/6000) that can't be used in the general
- context we want it for. */
-
- if (recog_p && non_pc_set_src
- && GET_CODE (XEXP (part, 1)) == MATCH_OPERAND
- && GET_CODE (XEXP (part, 2)) == MATCH_OPERAND)
- have_cmove_flag = 1;
- break;
-
- case REG: case CONST_INT: case SYMBOL_REF:
- case PC:
- return;
- }
-
- format_ptr = GET_RTX_FORMAT (GET_CODE (part));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (part)); i++)
- switch (*format_ptr++)
- {
- case 'e':
- case 'u':
- walk_insn_part (XEXP (part, i), recog_p, non_pc_set_src);
- break;
- case 'E':
- if (XVEC (part, i) != NULL)
- for (j = 0; j < XVECLEN (part, i); j++)
- walk_insn_part (XVECEXP (part, i, j), recog_p, non_pc_set_src);
- break;
- }
-}
-
-static void
-gen_insn (insn)
- rtx insn;
-{
- int i;
-
- /* Walk the insn pattern to gather the #define's status. */
- clobbers_seen_this_insn = 0;
- dup_operands_seen_this_insn = 0;
- if (XVEC (insn, 1) != 0)
- for (i = 0; i < XVECLEN (insn, 1); i++)
- walk_insn_part (XVECEXP (insn, 1, i), 1, 0);
-
- if (clobbers_seen_this_insn > max_clobbers_per_insn)
- max_clobbers_per_insn = clobbers_seen_this_insn;
- if (dup_operands_seen_this_insn > max_dup_operands)
- max_dup_operands = dup_operands_seen_this_insn;
-}
-
-/* Similar but scan a define_expand. */
-
-static void
-gen_expand (insn)
- rtx insn;
-{
- int i;
-
- /* Walk the insn pattern to gather the #define's status. */
-
- /* Note that we don't bother recording the number of MATCH_DUPs
- that occur in a gen_expand, because only reload cares about that. */
- if (XVEC (insn, 1) != 0)
- for (i = 0; i < XVECLEN (insn, 1); i++)
- {
- /* Compute the maximum SETs and CLOBBERS
- in any one of the sub-insns;
- don't sum across all of them. */
- clobbers_seen_this_insn = 0;
-
- walk_insn_part (XVECEXP (insn, 1, i), 0, 0);
-
- if (clobbers_seen_this_insn > max_clobbers_per_insn)
- max_clobbers_per_insn = clobbers_seen_this_insn;
- }
-}
-
-/* Similar but scan a define_split. */
-
-static void
-gen_split (split)
- rtx split;
-{
- int i;
-
- /* Look through the patterns that are matched
- to compute the maximum operand number. */
- for (i = 0; i < XVECLEN (split, 0); i++)
- walk_insn_part (XVECEXP (split, 0, i), 1, 0);
- /* Look at the number of insns this insn could split into. */
- if (XVECLEN (split, 2) > max_insns_per_split)
- max_insns_per_split = XVECLEN (split, 2);
-}
-
-static void
-gen_peephole (peep)
- rtx peep;
-{
- int i;
-
- /* Look through the patterns that are matched
- to compute the maximum operand number. */
- for (i = 0; i < XVECLEN (peep, 0); i++)
- walk_insn_part (XVECEXP (peep, 0, i), 1, 0);
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
-
- return val;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-static void
-fatal (s, a1, a2)
- char *s;
-{
- fprintf (stderr, "genconfig: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- FILE *infile;
- register int c;
-
- obstack_init (rtl_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- printf ("/* Generated automatically by the program `genconfig'\n\
-from the machine description file `md'. */\n\n");
-
- /* Allow at least 10 operands for the sake of asm constructs. */
- max_recog_operands = 9; /* We will add 1 later. */
- max_dup_operands = 1;
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN)
- gen_insn (desc);
- if (GET_CODE (desc) == DEFINE_EXPAND)
- gen_expand (desc);
- if (GET_CODE (desc) == DEFINE_SPLIT)
- gen_split (desc);
- if (GET_CODE (desc) == DEFINE_PEEPHOLE)
- gen_peephole (desc);
- }
-
- printf ("\n#define MAX_RECOG_OPERANDS %d\n", max_recog_operands + 1);
-
- printf ("\n#define MAX_DUP_OPERANDS %d\n", max_dup_operands);
-
- /* This is conditionally defined, in case the user writes code which emits
- more splits than we can readily see (and knows s/he does it). */
- printf ("#ifndef MAX_INSNS_PER_SPLIT\n#define MAX_INSNS_PER_SPLIT %d\n#endif\n",
- max_insns_per_split);
-
- if (register_constraint_flag)
- printf ("#define REGISTER_CONSTRAINTS\n");
-
- if (have_cc0_flag)
- printf ("#define HAVE_cc0\n");
-
- if (have_cmove_flag)
- printf ("#define HAVE_conditional_move\n");
-
- if (have_lo_sum_flag)
- printf ("#define HAVE_lo_sum\n");
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/genemit.c b/gcc/genemit.c
deleted file mode 100644
index e80e4c71668..00000000000
--- a/gcc/genemit.c
+++ /dev/null
@@ -1,801 +0,0 @@
-/* Generate code from machine description to emit insns as rtl.
- Copyright (C) 1987, 1988, 1991, 1994, 1995 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. */
-
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern rtx read_rtx ();
-
-char *xmalloc ();
-static void fatal ();
-void fancy_abort ();
-
-static int max_opno;
-static int max_dup_opno;
-static int register_constraints;
-static int insn_code_number;
-static int insn_index_number;
-
-/* Data structure for recording the patterns of insns that have CLOBBERs.
- We use this to output a function that adds these CLOBBERs to a
- previously-allocated PARALLEL expression. */
-
-struct clobber_pat
-{
- struct clobber_ent *insns;
- rtx pattern;
- int first_clobber;
- struct clobber_pat *next;
-} *clobber_list;
-
-/* Records one insn that uses the clobber list. */
-
-struct clobber_ent
-{
- int code_number; /* Counts only insns. */
- struct clobber_ent *next;
-};
-
-static void
-max_operand_1 (x)
- rtx x;
-{
- register RTX_CODE code;
- register int i;
- register int len;
- register char *fmt;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- if (code == MATCH_OPERAND && XSTR (x, 2) != 0 && *XSTR (x, 2) != '\0')
- register_constraints = 1;
- if (code == MATCH_SCRATCH && XSTR (x, 1) != 0 && *XSTR (x, 1) != '\0')
- register_constraints = 1;
- if (code == MATCH_OPERAND || code == MATCH_OPERATOR
- || code == MATCH_PARALLEL)
- max_opno = MAX (max_opno, XINT (x, 0));
- if (code == MATCH_DUP || code == MATCH_OP_DUP || code == MATCH_PAR_DUP)
- max_dup_opno = MAX (max_dup_opno, XINT (x, 0));
-
- fmt = GET_RTX_FORMAT (code);
- len = GET_RTX_LENGTH (code);
- for (i = 0; i < len; i++)
- {
- if (fmt[i] == 'e' || fmt[i] == 'u')
- max_operand_1 (XEXP (x, i));
- else if (fmt[i] == 'E')
- {
- int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- max_operand_1 (XVECEXP (x, i, j));
- }
- }
-}
-
-static int
-max_operand_vec (insn, arg)
- rtx insn;
- int arg;
-{
- register int len = XVECLEN (insn, arg);
- register int i;
-
- max_opno = -1;
- max_dup_opno = -1;
-
- for (i = 0; i < len; i++)
- max_operand_1 (XVECEXP (insn, arg, i));
-
- return max_opno + 1;
-}
-
-static void
-print_code (code)
- RTX_CODE code;
-{
- register char *p1;
- for (p1 = GET_RTX_NAME (code); *p1; p1++)
- {
- if (*p1 >= 'a' && *p1 <= 'z')
- putchar (*p1 + 'A' - 'a');
- else
- putchar (*p1);
- }
-}
-
-/* Print a C expression to construct an RTX just like X,
- substituting any operand references appearing within. */
-
-static void
-gen_exp (x)
- rtx x;
-{
- register RTX_CODE code;
- register int i;
- register int len;
- register char *fmt;
-
- if (x == 0)
- {
- printf ("NULL_RTX");
- return;
- }
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case MATCH_OPERAND:
- case MATCH_DUP:
- printf ("operand%d", XINT (x, 0));
- return;
-
- case MATCH_OP_DUP:
- printf ("gen_rtx (GET_CODE (operand%d), GET_MODE (operand%d)",
- XINT (x, 0), XINT (x, 0));
- for (i = 0; i < XVECLEN (x, 1); i++)
- {
- printf (",\n\t\t");
- gen_exp (XVECEXP (x, 1, i));
- }
- printf (")");
- return;
-
- case MATCH_OPERATOR:
- printf ("gen_rtx (GET_CODE (operand%d)", XINT (x, 0));
- printf (", %smode", GET_MODE_NAME (GET_MODE (x)));
- for (i = 0; i < XVECLEN (x, 2); i++)
- {
- printf (",\n\t\t");
- gen_exp (XVECEXP (x, 2, i));
- }
- printf (")");
- return;
-
- case MATCH_PARALLEL:
- case MATCH_PAR_DUP:
- printf ("operand%d", XINT (x, 0));
- return;
-
- case MATCH_SCRATCH:
- printf ("gen_rtx (SCRATCH, %smode, 0)", GET_MODE_NAME (GET_MODE (x)));
- return;
-
- case ADDRESS:
- fatal ("ADDRESS expression code used in named instruction pattern");
-
- case PC:
- printf ("pc_rtx");
- return;
-
- case CC0:
- printf ("cc0_rtx");
- return;
-
- case CONST_INT:
- if (INTVAL (x) == 0)
- printf ("const0_rtx");
- else if (INTVAL (x) == 1)
- printf ("const1_rtx");
- else if (INTVAL (x) == -1)
- printf ("constm1_rtx");
- else if (INTVAL (x) == STORE_FLAG_VALUE)
- printf ("const_true_rtx");
- else
- printf (
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- "GEN_INT (%d)",
-#else
- "GEN_INT (%ld)",
-#endif
- INTVAL (x));
- return;
-
- case CONST_DOUBLE:
- /* These shouldn't be written in MD files. Instead, the appropriate
- routines in varasm.c should be called. */
- abort ();
- }
-
- printf ("gen_rtx (");
- print_code (code);
- printf (", %smode", GET_MODE_NAME (GET_MODE (x)));
-
- fmt = GET_RTX_FORMAT (code);
- len = GET_RTX_LENGTH (code);
- for (i = 0; i < len; i++)
- {
- if (fmt[i] == '0')
- break;
- printf (",\n\t");
- if (fmt[i] == 'e' || fmt[i] == 'u')
- gen_exp (XEXP (x, i));
- else if (fmt[i] == 'i')
- printf ("%u", XINT (x, i));
- else if (fmt[i] == 's')
- printf ("\"%s\"", XSTR (x, i));
- else if (fmt[i] == 'E')
- {
- int j;
- printf ("gen_rtvec (%d", XVECLEN (x, i));
- for (j = 0; j < XVECLEN (x, i); j++)
- {
- printf (",\n\t\t");
- gen_exp (XVECEXP (x, i, j));
- }
- printf (")");
- }
- else
- abort ();
- }
- printf (")");
-}
-
-/* Generate the `gen_...' function for a DEFINE_INSN. */
-
-static void
-gen_insn (insn)
- rtx insn;
-{
- int operands;
- register int i;
-
- /* See if the pattern for this insn ends with a group of CLOBBERs of (hard)
- registers or MATCH_SCRATCHes. If so, store away the information for
- later. */
-
- if (XVEC (insn, 1))
- {
- for (i = XVECLEN (insn, 1) - 1; i > 0; i--)
- if (GET_CODE (XVECEXP (insn, 1, i)) != CLOBBER
- || (GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) != REG
- && GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) != MATCH_SCRATCH))
- break;
-
- if (i != XVECLEN (insn, 1) - 1)
- {
- register struct clobber_pat *p;
- register struct clobber_ent *link
- = (struct clobber_ent *) xmalloc (sizeof (struct clobber_ent));
- register int j;
-
- link->code_number = insn_code_number;
-
- /* See if any previous CLOBBER_LIST entry is the same as this
- one. */
-
- for (p = clobber_list; p; p = p->next)
- {
- if (p->first_clobber != i + 1
- || XVECLEN (p->pattern, 1) != XVECLEN (insn, 1))
- continue;
-
- for (j = i + 1; j < XVECLEN (insn, 1); j++)
- {
- rtx old = XEXP (XVECEXP (p->pattern, 1, j), 0);
- rtx new = XEXP (XVECEXP (insn, 1, j), 0);
-
- /* OLD and NEW are the same if both are to be a SCRATCH
- of the same mode,
- or if both are registers of the same mode and number. */
- if (! (GET_MODE (old) == GET_MODE (new)
- && ((GET_CODE (old) == MATCH_SCRATCH
- && GET_CODE (new) == MATCH_SCRATCH)
- || (GET_CODE (old) == REG && GET_CODE (new) == REG
- && REGNO (old) == REGNO (new)))))
- break;
- }
-
- if (j == XVECLEN (insn, 1))
- break;
- }
-
- if (p == 0)
- {
- p = (struct clobber_pat *) xmalloc (sizeof (struct clobber_pat));
-
- p->insns = 0;
- p->pattern = insn;
- p->first_clobber = i + 1;
- p->next = clobber_list;
- clobber_list = p;
- }
-
- link->next = p->insns;
- p->insns = link;
- }
- }
-
- /* Don't mention instructions whose names are the null string
- or begin with '*'. They are in the machine description just
- to be recognized. */
- if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
- return;
-
- /* Find out how many operands this function has,
- and also whether any of them have register constraints. */
- register_constraints = 0;
- operands = max_operand_vec (insn, 1);
- if (max_dup_opno >= operands)
- fatal ("match_dup operand number has no match_operand");
-
- /* Output the function name and argument declarations. */
- printf ("rtx\ngen_%s (", XSTR (insn, 0));
- for (i = 0; i < operands; i++)
- printf (i ? ", operand%d" : "operand%d", i);
- printf (")\n");
- for (i = 0; i < operands; i++)
- printf (" rtx operand%d;\n", i);
- printf ("{\n");
-
- /* Output code to construct and return the rtl for the instruction body */
-
- if (XVECLEN (insn, 1) == 1)
- {
- printf (" return ");
- gen_exp (XVECEXP (insn, 1, 0));
- printf (";\n}\n\n");
- }
- else
- {
- printf (" return gen_rtx (PARALLEL, VOIDmode, gen_rtvec (%d", XVECLEN (insn, 1));
- for (i = 0; i < XVECLEN (insn, 1); i++)
- {
- printf (",\n\t\t");
- gen_exp (XVECEXP (insn, 1, i));
- }
- printf ("));\n}\n\n");
- }
-}
-
-/* Generate the `gen_...' function for a DEFINE_EXPAND. */
-
-static void
-gen_expand (expand)
- rtx expand;
-{
- int operands;
- register int i;
-
- if (strlen (XSTR (expand, 0)) == 0)
- fatal ("define_expand lacks a name");
- if (XVEC (expand, 1) == 0)
- fatal ("define_expand for %s lacks a pattern", XSTR (expand, 0));
-
- /* Find out how many operands this function has,
- and also whether any of them have register constraints. */
- register_constraints = 0;
-
- operands = max_operand_vec (expand, 1);
-
- /* Output the function name and argument declarations. */
- printf ("rtx\ngen_%s (", XSTR (expand, 0));
- for (i = 0; i < operands; i++)
- printf (i ? ", operand%d" : "operand%d", i);
- printf (")\n");
- for (i = 0; i < operands; i++)
- printf (" rtx operand%d;\n", i);
- printf ("{\n");
-
- /* If we don't have any C code to write, only one insn is being written,
- and no MATCH_DUPs are present, we can just return the desired insn
- like we do for a DEFINE_INSN. This saves memory. */
- if ((XSTR (expand, 3) == 0 || *XSTR (expand, 3) == '\0')
- && operands > max_dup_opno
- && XVECLEN (expand, 1) == 1)
- {
- printf (" return ");
- gen_exp (XVECEXP (expand, 1, 0));
- printf (";\n}\n\n");
- return;
- }
-
- /* For each operand referred to only with MATCH_DUPs,
- make a local variable. */
- for (i = operands; i <= max_dup_opno; i++)
- printf (" rtx operand%d;\n", i);
- if (operands > 0 || max_dup_opno >= 0)
- printf (" rtx operands[%d];\n", MAX (operands, max_dup_opno + 1));
- printf (" rtx _val = 0;\n");
- printf (" start_sequence ();\n");
-
- /* The fourth operand of DEFINE_EXPAND is some code to be executed
- before the actual construction.
- This code expects to refer to `operands'
- just as the output-code in a DEFINE_INSN does,
- but here `operands' is an automatic array.
- So copy the operand values there before executing it. */
- if (XSTR (expand, 3) && *XSTR (expand, 3))
- {
- /* Output code to copy the arguments into `operands'. */
- for (i = 0; i < operands; i++)
- printf (" operands[%d] = operand%d;\n", i, i);
-
- /* Output the special code to be executed before the sequence
- is generated. */
- printf ("%s\n", XSTR (expand, 3));
-
- /* Output code to copy the arguments back out of `operands'
- (unless we aren't going to use them at all). */
- if (XVEC (expand, 1) != 0)
- {
- for (i = 0; i < operands; i++)
- printf (" operand%d = operands[%d];\n", i, i);
- for (; i <= max_dup_opno; i++)
- printf (" operand%d = operands[%d];\n", i, i);
- }
- }
-
- /* Output code to construct the rtl for the instruction bodies.
- Use emit_insn to add them to the sequence being accumulated.
- But don't do this if the user's code has set `no_more' nonzero. */
-
- for (i = 0; i < XVECLEN (expand, 1); i++)
- {
- rtx next = XVECEXP (expand, 1, i);
- if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == SET
- && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
- || GET_CODE (next) == RETURN)
- printf (" emit_jump_insn (");
- else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)
- || GET_CODE (next) == CALL
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (next, 0, 0))) == CALL)
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == CALL))
- printf (" emit_call_insn (");
- else if (GET_CODE (next) == CODE_LABEL)
- printf (" emit_label (");
- else if (GET_CODE (next) == MATCH_OPERAND
- || GET_CODE (next) == MATCH_OPERATOR
- || GET_CODE (next) == MATCH_PARALLEL
- || GET_CODE (next) == MATCH_OP_DUP
- || GET_CODE (next) == MATCH_DUP
- || GET_CODE (next) == PARALLEL)
- printf (" emit (");
- else
- printf (" emit_insn (");
- gen_exp (next);
- printf (");\n");
- if (GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC
- && GET_CODE (SET_SRC (next)) == LABEL_REF)
- printf (" emit_barrier ();");
- }
-
- /* Call `gen_sequence' to make a SEQUENCE out of all the
- insns emitted within this gen_... function. */
-
- printf (" _done:\n");
- printf (" _val = gen_sequence ();\n");
- printf (" _fail:\n");
- printf (" end_sequence ();\n");
- printf (" return _val;\n}\n\n");
-}
-
-/* Like gen_expand, but generates a SEQUENCE. */
-
-static void
-gen_split (split)
- rtx split;
-{
- register int i;
- int operands;
-
- if (XVEC (split, 0) == 0)
- fatal ("define_split (definition %d) lacks a pattern", insn_index_number);
- else if (XVEC (split, 2) == 0)
- fatal ("define_split (definition %d) lacks a replacement pattern",
- insn_index_number);
-
- /* Find out how many operands this function has. */
-
- max_operand_vec (split, 2);
- operands = MAX (max_opno, max_dup_opno) + 1;
-
- /* Output the function name and argument declarations. */
- printf ("rtx\ngen_split_%d (operands)\n rtx *operands;\n",
- insn_code_number);
- printf ("{\n");
-
- /* Declare all local variables. */
- for (i = 0; i < operands; i++)
- printf (" rtx operand%d;\n", i);
- printf (" rtx _val = 0;\n");
- printf (" start_sequence ();\n");
-
- /* The fourth operand of DEFINE_SPLIT is some code to be executed
- before the actual construction. */
-
- if (XSTR (split, 3))
- printf ("%s\n", XSTR (split, 3));
-
- /* Output code to copy the arguments back out of `operands' */
- for (i = 0; i < operands; i++)
- printf (" operand%d = operands[%d];\n", i, i);
-
- /* Output code to construct the rtl for the instruction bodies.
- Use emit_insn to add them to the sequence being accumulated.
- But don't do this if the user's code has set `no_more' nonzero. */
-
- for (i = 0; i < XVECLEN (split, 2); i++)
- {
- rtx next = XVECEXP (split, 2, i);
- if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == SET
- && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
- || GET_CODE (next) == RETURN)
- printf (" emit_jump_insn (");
- else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)
- || GET_CODE (next) == CALL
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (next, 0, 0))) == CALL)
- || (GET_CODE (next) == PARALLEL
- && GET_CODE (XVECEXP (next, 0, 0)) == CALL))
- printf (" emit_call_insn (");
- else if (GET_CODE (next) == CODE_LABEL)
- printf (" emit_label (");
- else if (GET_CODE (next) == MATCH_OPERAND
- || GET_CODE (next) == MATCH_OPERATOR
- || GET_CODE (next) == MATCH_PARALLEL
- || GET_CODE (next) == MATCH_OP_DUP
- || GET_CODE (next) == MATCH_DUP
- || GET_CODE (next) == PARALLEL)
- printf (" emit (");
- else
- printf (" emit_insn (");
- gen_exp (next);
- printf (");\n");
- if (GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC
- && GET_CODE (SET_SRC (next)) == LABEL_REF)
- printf (" emit_barrier ();");
- }
-
- /* Call `gen_sequence' to make a SEQUENCE out of all the
- insns emitted within this gen_... function. */
-
- printf (" _done:\n");
- printf (" _val = gen_sequence ();\n");
- printf (" _fail:\n");
- printf (" end_sequence ();\n");
- printf (" return _val;\n}\n\n");
-}
-
-/* Write a function, `add_clobbers', that is given a PARALLEL of sufficient
- size for the insn and an INSN_CODE, and inserts the required CLOBBERs at
- the end of the vector. */
-
-static void
-output_add_clobbers ()
-{
- struct clobber_pat *clobber;
- struct clobber_ent *ent;
- int i;
-
- printf ("\n\nvoid\nadd_clobbers (pattern, insn_code_number)\n");
- printf (" rtx pattern;\n int insn_code_number;\n");
- printf ("{\n");
- printf (" int i;\n\n");
- printf (" switch (insn_code_number)\n");
- printf (" {\n");
-
- for (clobber = clobber_list; clobber; clobber = clobber->next)
- {
- for (ent = clobber->insns; ent; ent = ent->next)
- printf (" case %d:\n", ent->code_number);
-
- for (i = clobber->first_clobber; i < XVECLEN (clobber->pattern, 1); i++)
- {
- printf (" XVECEXP (pattern, 0, %d) = ", i);
- gen_exp (XVECEXP (clobber->pattern, 1, i));
- printf (";\n");
- }
-
- printf (" break;\n\n");
- }
-
- printf (" default:\n");
- printf (" abort ();\n");
- printf (" }\n");
- printf ("}\n");
-}
-
-/* Write a function, init_mov_optab, that is called to set up entries
- in mov_optab for EXTRA_CC_MODES. */
-
-static void
-output_init_mov_optab ()
-{
-#ifdef EXTRA_CC_NAMES
- static char *cc_names[] = { EXTRA_CC_NAMES };
- char *p;
- int i;
-
- printf ("\nvoid\ninit_mov_optab ()\n{\n");
-
- for (i = 0; i < sizeof cc_names / sizeof cc_names[0]; i++)
- {
- printf ("#ifdef HAVE_mov");
- for (p = cc_names[i]; *p; p++)
- printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
- printf ("\n");
- printf (" if (HAVE_mov");
- for (p = cc_names[i]; *p; p++)
- printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
- printf (")\n");
- printf (" mov_optab->handlers[(int) %smode].insn_code = CODE_FOR_mov",
- cc_names[i]);
- for (p = cc_names[i]; *p; p++)
- printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
- printf (";\n#endif\n");
- }
-
- printf ("}\n");
-#endif
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
-
- return val;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-static void
-fatal (s, a1, a2)
- char *s;
-{
- fprintf (stderr, "genemit: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- FILE *infile;
- register int c;
-
- obstack_init (rtl_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- /* Assign sequential codes to all entries in the machine description
- in parallel with the tables in insn-output.c. */
-
- insn_code_number = 0;
- insn_index_number = 0;
-
- printf ("/* Generated automatically by the program `genemit'\n\
-from the machine description file `md'. */\n\n");
-
- printf ("#include \"config.h\"\n");
- printf ("#include \"rtl.h\"\n");
- printf ("#include \"expr.h\"\n");
- printf ("#include \"real.h\"\n");
- printf ("#include \"output.h\"\n");
- printf ("#include \"insn-config.h\"\n\n");
- printf ("#include \"insn-flags.h\"\n\n");
- printf ("#include \"insn-codes.h\"\n\n");
- printf ("extern char *insn_operand_constraint[][MAX_RECOG_OPERANDS];\n\n");
- printf ("extern rtx recog_operand[];\n");
- printf ("#define operands emit_operand\n\n");
- printf ("#define FAIL goto _fail\n\n");
- printf ("#define DONE goto _done\n\n");
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN)
- {
- gen_insn (desc);
- ++insn_code_number;
- }
- if (GET_CODE (desc) == DEFINE_EXPAND)
- {
- gen_expand (desc);
- ++insn_code_number;
- }
- if (GET_CODE (desc) == DEFINE_SPLIT)
- {
- gen_split (desc);
- ++insn_code_number;
- }
- if (GET_CODE (desc) == DEFINE_PEEPHOLE)
- {
- ++insn_code_number;
- }
- ++insn_index_number;
- }
-
- /* Write out the routine to add CLOBBERs to a pattern. */
- output_add_clobbers ();
-
- /* Write the routine to initialize mov_optab for the EXTRA_CC_MODES. */
- output_init_mov_optab ();
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/genextract.c b/gcc/genextract.c
deleted file mode 100644
index f222de1f335..00000000000
--- a/gcc/genextract.c
+++ /dev/null
@@ -1,554 +0,0 @@
-/* Generate code from machine description to extract operands from insn as rtl.
- Copyright (C) 1987, 1991, 1992, 1993 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. */
-
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-#include "insn-config.h"
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern rtx read_rtx ();
-
-/* Names for patterns. Need to allow linking with print-rtl. */
-char **insn_name_ptr;
-
-/* This structure contains all the information needed to describe one
- set of extractions methods. Each method may be used by more than
- one pattern if the operands are in the same place.
-
- The string for each operand describes that path to the operand and
- contains `0' through `9' when going into an expression and `a' through
- `z' when going into a vector. We assume here that only the first operand
- of an rtl expression is a vector. genrecog.c makes the same assumption
- (and uses the same representation) and it is currently true. */
-
-struct extraction
-{
- int op_count;
- char *oplocs[MAX_RECOG_OPERANDS];
- int dup_count;
- char *duplocs[MAX_DUP_OPERANDS];
- int dupnums[MAX_DUP_OPERANDS];
- struct code_ptr *insns;
- struct extraction *next;
-};
-
-/* Holds a single insn code that use an extraction method. */
-
-struct code_ptr
-{
- int insn_code;
- struct code_ptr *next;
-};
-
-static struct extraction *extractions;
-
-/* Number instruction patterns handled, starting at 0 for first one. */
-
-static int insn_code_number;
-
-/* Records the large operand number in this insn. */
-
-static int op_count;
-
-/* Records the location of any operands using the string format described
- above. */
-
-static char *oplocs[MAX_RECOG_OPERANDS];
-
-/* Number the occurrences of MATCH_DUP in each instruction,
- starting at 0 for the first occurrence. */
-
-static int dup_count;
-
-/* Records the location of any MATCH_DUP operands. */
-
-static char *duplocs[MAX_DUP_OPERANDS];
-
-/* Record the operand number of any MATCH_DUPs. */
-
-static int dupnums[MAX_DUP_OPERANDS];
-
-/* Record the list of insn_codes for peepholes. */
-
-static struct code_ptr *peepholes;
-
-static void walk_rtx ();
-static void print_path ();
-char *xmalloc ();
-char *xrealloc ();
-static void fatal ();
-static char *copystr ();
-static void mybzero ();
-void fancy_abort ();
-
-static void
-gen_insn (insn)
- rtx insn;
-{
- register int i;
- register struct extraction *p;
- register struct code_ptr *link;
-
- op_count = 0;
- dup_count = 0;
-
- /* No operands seen so far in this pattern. */
- mybzero (oplocs, sizeof oplocs);
-
- /* Walk the insn's pattern, remembering at all times the path
- down to the walking point. */
-
- if (XVECLEN (insn, 1) == 1)
- walk_rtx (XVECEXP (insn, 1, 0), "");
- else
- for (i = XVECLEN (insn, 1) - 1; i >= 0; i--)
- {
- char *path = (char *) alloca (2);
-
- path[0] = 'a' + i;
- path[1] = 0;
-
- walk_rtx (XVECEXP (insn, 1, i), path);
- }
-
- link = (struct code_ptr *) xmalloc (sizeof (struct code_ptr));
- link->insn_code = insn_code_number;
-
- /* See if we find something that already had this extraction method. */
-
- for (p = extractions; p; p = p->next)
- {
- if (p->op_count != op_count || p->dup_count != dup_count)
- continue;
-
- for (i = 0; i < op_count; i++)
- if (p->oplocs[i] != oplocs[i]
- && ! (p->oplocs[i] != 0 && oplocs[i] != 0
- && ! strcmp (p->oplocs[i], oplocs[i])))
- break;
-
- if (i != op_count)
- continue;
-
- for (i = 0; i < dup_count; i++)
- if (p->dupnums[i] != dupnums[i]
- || strcmp (p->duplocs[i], duplocs[i]))
- break;
-
- if (i != dup_count)
- continue;
-
- /* This extraction is the same as ours. Just link us in. */
- link->next = p->insns;
- p->insns = link;
- return;
- }
-
- /* Otherwise, make a new extraction method. */
-
- p = (struct extraction *) xmalloc (sizeof (struct extraction));
- p->op_count = op_count;
- p->dup_count = dup_count;
- p->next = extractions;
- extractions = p;
- p->insns = link;
- link->next = 0;
-
- for (i = 0; i < op_count; i++)
- p->oplocs[i] = oplocs[i];
-
- for (i = 0; i < dup_count; i++)
- p->dupnums[i] = dupnums[i], p->duplocs[i] = duplocs[i];
-}
-
-static void
-walk_rtx (x, path)
- rtx x;
- char *path;
-{
- register RTX_CODE code;
- register int i;
- register int len;
- register char *fmt;
- register struct code_ptr *link;
- int depth = strlen (path);
- char *newpath;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case PC:
- case CC0:
- case CONST_INT:
- case SYMBOL_REF:
- return;
-
- case MATCH_OPERAND:
- case MATCH_SCRATCH:
- oplocs[XINT (x, 0)] = copystr (path);
- op_count = MAX (op_count, XINT (x, 0) + 1);
- break;
-
- case MATCH_DUP:
- case MATCH_PAR_DUP:
- duplocs[dup_count] = copystr (path);
- dupnums[dup_count] = XINT (x, 0);
- dup_count++;
- break;
-
- case MATCH_OP_DUP:
- duplocs[dup_count] = copystr (path);
- dupnums[dup_count] = XINT (x, 0);
- dup_count++;
-
- newpath = (char *) alloca (depth + 2);
- strcpy (newpath, path);
- newpath[depth + 1] = 0;
-
- for (i = XVECLEN (x, 1) - 1; i >= 0; i--)
- {
- newpath[depth] = '0' + i;
- walk_rtx (XVECEXP (x, 1, i), newpath);
- }
- return;
-
- case MATCH_OPERATOR:
- oplocs[XINT (x, 0)] = copystr (path);
- op_count = MAX (op_count, XINT (x, 0) + 1);
-
- newpath = (char *) alloca (depth + 2);
- strcpy (newpath, path);
- newpath[depth + 1] = 0;
-
- for (i = XVECLEN (x, 2) - 1; i >= 0; i--)
- {
- newpath[depth] = '0' + i;
- walk_rtx (XVECEXP (x, 2, i), newpath);
- }
- return;
-
- case MATCH_PARALLEL:
- oplocs[XINT (x, 0)] = copystr (path);
- op_count = MAX (op_count, XINT (x, 0) + 1);
-
- newpath = (char *) alloca (depth + 2);
- strcpy (newpath, path);
- newpath[depth + 1] = 0;
-
- for (i = XVECLEN (x, 2) - 1; i >= 0; i--)
- {
- newpath[depth] = 'a' + i;
- walk_rtx (XVECEXP (x, 2, i), newpath);
- }
- return;
-
- case ADDRESS:
- walk_rtx (XEXP (x, 0), path);
- return;
- }
-
- newpath = (char *) alloca (depth + 2);
- strcpy (newpath, path);
- newpath[depth + 1] = 0;
-
- fmt = GET_RTX_FORMAT (code);
- len = GET_RTX_LENGTH (code);
- for (i = 0; i < len; i++)
- {
- if (fmt[i] == 'e' || fmt[i] == 'u')
- {
- newpath[depth] = '0' + i;
- walk_rtx (XEXP (x, i), newpath);
- }
- else if (fmt[i] == 'E')
- {
- int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- {
- newpath[depth] = 'a' + j;
- walk_rtx (XVECEXP (x, i, j), newpath);
- }
- }
- }
-}
-
-/* Given a PATH, representing a path down the instruction's
- pattern from the root to a certain point, output code to
- evaluate to the rtx at that point. */
-
-static void
-print_path (path)
- char *path;
-{
- register int len = strlen (path);
- register int i;
-
- /* We first write out the operations (XEXP or XVECEXP) in reverse
- order, then write "insn", then the indices in forward order. */
-
- for (i = len - 1; i >=0 ; i--)
- {
- if (path[i] >= 'a' && path[i] <= 'z')
- printf ("XVECEXP (");
- else if (path[i] >= '0' && path[i] <= '9')
- printf ("XEXP (");
- else
- abort ();
- }
-
- printf ("pat");
-
- for (i = 0; i < len; i++)
- {
- if (path[i] >= 'a' && path[i] <= 'z')
- printf (", 0, %d)", path[i] - 'a');
- else if (path[i] >= '0' && path[i] <= '9')
- printf (", %d)", path[i] - '0');
- else
- abort ();
- }
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
- return val;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-static void
-fatal (s, a1, a2)
- char *s;
-{
- fprintf (stderr, "genextract: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-static char *
-copystr (s1)
- char *s1;
-{
- register char *tem;
-
- if (s1 == 0)
- return 0;
-
- tem = (char *) xmalloc (strlen (s1) + 1);
- strcpy (tem, s1);
-
- return tem;
-}
-
-static void
-mybzero (b, length)
- register char *b;
- register unsigned length;
-{
- while (length-- > 0)
- *b++ = 0;
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- FILE *infile;
- register int c, i;
- struct extraction *p;
- struct code_ptr *link;
-
- obstack_init (rtl_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- /* Assign sequential codes to all entries in the machine description
- in parallel with the tables in insn-output.c. */
-
- insn_code_number = 0;
-
- printf ("/* Generated automatically by the program `genextract'\n\
-from the machine description file `md'. */\n\n");
-
- printf ("#include \"config.h\"\n");
- printf ("#include \"rtl.h\"\n\n");
-
- /* This variable exists only so it can be the "location"
- of any missing operand whose numbers are skipped by a given pattern. */
- printf ("static rtx junk;\n");
-
- printf ("extern rtx recog_operand[];\n");
- printf ("extern rtx *recog_operand_loc[];\n");
- printf ("extern rtx *recog_dup_loc[];\n");
- printf ("extern char recog_dup_num[];\n");
-
- printf ("void\ninsn_extract (insn)\n");
- printf (" rtx insn;\n");
- printf ("{\n");
- printf (" register rtx *ro = recog_operand;\n");
- printf (" register rtx **ro_loc = recog_operand_loc;\n");
- printf (" rtx pat = PATTERN (insn);\n");
- printf (" int i;\n\n");
- printf (" switch (INSN_CODE (insn))\n");
- printf (" {\n");
- printf (" case -1:\n");
- printf (" fatal_insn_not_found (insn);\n\n");
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN)
- {
- gen_insn (desc);
- ++insn_code_number;
- }
-
- else if (GET_CODE (desc) == DEFINE_PEEPHOLE)
- {
- struct code_ptr *link
- = (struct code_ptr *) xmalloc (sizeof (struct code_ptr));
-
- link->insn_code = insn_code_number;
- link->next = peepholes;
- peepholes = link;
- ++insn_code_number;
- }
-
- else if (GET_CODE (desc) == DEFINE_EXPAND
- || GET_CODE (desc) == DEFINE_SPLIT)
- ++insn_code_number;
- }
-
- /* Write out code to handle peepholes and the insn_codes that it should
- be called for. */
- if (peepholes)
- {
- for (link = peepholes; link; link = link->next)
- printf (" case %d:\n", link->insn_code);
-
- /* The vector in the insn says how many operands it has.
- And all it contains are operands. In fact, the vector was
- created just for the sake of this function. */
- printf (" for (i = XVECLEN (pat, 0); i >= 0; i--)\n");
- printf (" ro[i] = XVECEXP (pat, 0, i);\n");
- printf (" break;\n\n");
- }
-
- /* Write out all the ways to extract insn operands. */
- for (p = extractions; p; p = p->next)
- {
- for (link = p->insns; link; link = link->next)
- printf (" case %d:\n", link->insn_code);
-
- for (i = 0; i < p->op_count; i++)
- {
- if (p->oplocs[i] == 0)
- {
- printf (" ro[%d] = const0_rtx;\n", i);
- printf (" ro_loc[%d] = &junk;\n", i);
- }
- else
- {
- printf (" ro[%d] = *(ro_loc[%d] = &", i, i);
- print_path (p->oplocs[i]);
- printf (");\n");
- }
- }
-
- for (i = 0; i < p->dup_count; i++)
- {
- printf (" recog_dup_loc[%d] = &", i);
- print_path (p->duplocs[i]);
- printf (";\n");
- printf (" recog_dup_num[%d] = %d;\n", i, p->dupnums[i]);
- }
-
- printf (" break;\n\n");
- }
-
- /* This should never be reached. Note that we would also reach this abort
- if we tried to extract something whose INSN_CODE was a DEFINE_EXPAND or
- DEFINE_SPLIT, but that is correct. */
- printf (" default:\n abort ();\n");
-
- printf (" }\n}\n");
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/genflags.c b/gcc/genflags.c
deleted file mode 100644
index f8b39833f65..00000000000
--- a/gcc/genflags.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/* Generate from machine description:
-
- - some flags HAVE_... saying which simple standard instructions are
- available for this machine.
- Copyright (C) 1987, 1991, 1995 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. */
-
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern rtx read_rtx ();
-
-char *xmalloc ();
-static void fatal ();
-void fancy_abort ();
-
-/* Names for patterns. Need to allow linking with print-rtl. */
-char **insn_name_ptr;
-
-/* Obstacks to remember normal, and call insns. */
-static struct obstack call_obstack, normal_obstack;
-
-/* Max size of names encountered. */
-static int max_id_len;
-
-/* Count the number of match_operand's found. */
-
-static int
-num_operands (x)
- rtx x;
-{
- int count = 0;
- int i, j;
- enum rtx_code code = GET_CODE (x);
- char *format_ptr = GET_RTX_FORMAT (code);
-
- if (code == MATCH_OPERAND)
- return 1;
-
- if (code == MATCH_OPERATOR || code == MATCH_PARALLEL)
- count++;
-
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*format_ptr++)
- {
- case 'u':
- case 'e':
- count += num_operands (XEXP (x, i));
- break;
-
- case 'E':
- if (XVEC (x, i) != NULL)
- for (j = 0; j < XVECLEN (x, i); j++)
- count += num_operands (XVECEXP (x, i, j));
-
- break;
- }
- }
-
- return count;
-}
-
-/* Print out prototype information for a function. */
-
-static void
-gen_proto (insn)
- rtx insn;
-{
- int num = num_operands (insn);
- printf ("extern rtx gen_%-*s PROTO((", max_id_len, XSTR (insn, 0));
-
- if (num == 0)
- printf ("void");
- else
- {
- while (num-- > 1)
- printf ("rtx, ");
-
- printf ("rtx");
- }
-
- printf ("));\n");
-}
-
-/* Print out a function declaration without a prototype. */
-
-static void
-gen_nonproto (insn)
- rtx insn;
-{
- printf ("extern rtx gen_%s ();\n", XSTR (insn, 0));
-}
-
-static void
-gen_insn (insn)
- rtx insn;
-{
- char *name = XSTR (insn, 0);
- char *p;
- struct obstack *obstack_ptr;
- int len;
-
- /* Don't mention instructions whose names are the null string
- or begin with '*'. They are in the machine description just
- to be recognized. */
- if (name[0] == 0 || name[0] == '*')
- return;
-
- len = strlen (name);
-
- if (len > max_id_len)
- max_id_len = len;
-
- printf ("#define HAVE_%s ", name);
- if (strlen (XSTR (insn, 2)) == 0)
- printf ("1\n");
- else
- {
- /* Write the macro definition, putting \'s at the end of each line,
- if more than one. */
- printf ("(");
- for (p = XSTR (insn, 2); *p; p++)
- {
- if (*p == '\n')
- printf (" \\\n");
- else
- printf ("%c", *p);
- }
- printf (")\n");
- }
-
- /* Save the current insn, so that we can later put out appropriate
- prototypes. At present, most md files have the wrong number of
- arguments for the call insns (call, call_value, call_pop,
- call_value_pop) ignoring the extra arguments that are passed for
- some machines, so by default, turn off the prototype. */
-
- obstack_ptr = (name[0] == 'c'
- && (!strcmp (name, "call")
- || !strcmp (name, "call_value")
- || !strcmp (name, "call_pop")
- || !strcmp (name, "call_value_pop")))
- ? &call_obstack : &normal_obstack;
-
- obstack_grow (obstack_ptr, &insn, sizeof (rtx));
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
-
- return val;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-static void
-fatal (s, a1, a2)
- char *s;
-{
- fprintf (stderr, "genflags: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- rtx dummy;
- rtx *call_insns;
- rtx *normal_insns;
- rtx *insn_ptr;
- FILE *infile;
- register int c;
-
- obstack_init (rtl_obstack);
- obstack_init (&call_obstack);
- obstack_init (&normal_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- printf ("/* Generated automatically by the program `genflags'\n\
-from the machine description file `md'. */\n\n");
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND)
- gen_insn (desc);
- }
-
- /* Print out the prototypes now. */
- dummy = (rtx) 0;
- obstack_grow (&call_obstack, &dummy, sizeof (rtx));
- call_insns = (rtx *) obstack_finish (&call_obstack);
-
- obstack_grow (&normal_obstack, &dummy, sizeof (rtx));
- normal_insns = (rtx *) obstack_finish (&normal_obstack);
-
- printf ("\n#ifndef NO_MD_PROTOTYPES\n");
- for (insn_ptr = normal_insns; *insn_ptr; insn_ptr++)
- gen_proto (*insn_ptr);
-
- printf ("\n#ifdef MD_CALL_PROTOTYPES\n");
- for (insn_ptr = call_insns; *insn_ptr; insn_ptr++)
- gen_proto (*insn_ptr);
-
- printf ("\n#else /* !MD_CALL_PROTOTYPES */\n");
- for (insn_ptr = call_insns; *insn_ptr; insn_ptr++)
- gen_nonproto (*insn_ptr);
-
- printf ("#endif /* !MD_CALL_PROTOTYPES */\n");
- printf ("\n#else /* NO_MD_PROTOTYPES */\n");
- for (insn_ptr = normal_insns; *insn_ptr; insn_ptr++)
- gen_nonproto (*insn_ptr);
-
- for (insn_ptr = call_insns; *insn_ptr; insn_ptr++)
- gen_nonproto (*insn_ptr);
-
- printf ("#endif /* NO_MD_PROTOTYPES */\n");
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/genmultilib b/gcc/genmultilib
deleted file mode 100644
index 1ae690b697f..00000000000
--- a/gcc/genmultilib
+++ /dev/null
@@ -1,269 +0,0 @@
-#!/bin/sh
-# Generates multilib.h.
-# Copyright (C) 1994, 1995, 1996 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 shell script produces a header file which the gcc driver
-# program uses to pick which library to use based on the machine
-# specific options that it is given.
-
-# The first argument is a list of sets of options. The elements in
-# the list are separated by spaces. Within an element, the options
-# are separated by slashes. No leading dash is used on the options.
-# Each option in a set is mutually incompatible with all other options
-# in the set.
-
-# The optional second argument is a list of subdirectory names. If
-# the second argument is non-empty, there must be as many elements in
-# the second argument as there are options in the first argument. The
-# elements in the second list are separated by spaces. If the second
-# argument is empty, the option names will be used as the directory
-# names.
-
-# The optional third argument is a list of options which are
-# identical. The elements in the list are separated by spaces. Each
-# element must be of the form OPTION=OPTION. The first OPTION should
-# appear in the first argument, and the second should be a synonym for
-# it. Question marks are replaced with equal signs in both options.
-
-# The optional fourth argument is a list of multilib directory
-# combinations that should not be built.
-
-# The optional fifth argument is a list of options that should be
-# used whenever building multilib libraries.
-
-# The output looks like
-# #define MULTILIB_MATCHES "\
-# SUBDIRECTORY OPTIONS;\
-# ...
-# "
-# The SUBDIRECTORY is the subdirectory to use. The OPTIONS are
-# multiple options separated by spaces. Each option may start with an
-# exclamation point. gcc will consider each line in turn. If none of
-# the options beginning with an exclamation point are present, and all
-# of the other options are present, that subdirectory will be used.
-# The order of the subdirectories is such that they can be created in
-# order; that is, a subdirectory is preceded by all its parents.
-
-# Here is a example (this is simplified from the actual 680x0 case):
-# genmultilib "m68000/m68020 msoft-float" "m68000 m68020 msoft-float"
-# "m68000=mc68000"
-# This produces:
-# ". !m68000 !mc68000 !m68020 !msoft-float;",
-# "m68000 m68000 !m68020 !msoft-float;",
-# "m68000 mc60000 !m68020 !msoft-float;",
-# "m68020 !m68000 !mc68000 m68020 !msoft-float;",
-# "msoft-float !m68000 !mc68000 !m68020 msoft-float;",
-# "m68000/msoft-float m68000 !m68020 msoft-float;",
-# "m68000/msoft-float mc68000 !m68020 msoft-float;",
-# "m68020/msoft-float !m68000 !mc68000 m68020 msoft-float;",
-#
-# The effect is that `gcc -msoft-float' (for example) will append
-# msoft-float to the directory name when searching for libraries or
-# startup files, and `gcc -m68000 -msoft-float' (for example) will
-# append m68000/msoft-float.
-
-# Copy the positional parameters into variables.
-options=$1
-dirnames=$2
-matches=$3
-exceptions=$4
-extra=$5
-
-echo "static char *multilib_raw[] = {"
-
-# What we want to do is select all combinations of the sets in
-# options. Each combination which includes a set of mutually
-# exclusive options must then be output multiple times, once for each
-# item in the set. Selecting combinations is a recursive process.
-# Since not all versions of sh support functions, we achieve recursion
-# by creating a temporary shell script which invokes itself.
-rm -f tmpmultilib
-cat >tmpmultilib <<\EOF
-#!/bin/sh
-# This recursive script basically outputs all combinations of its
-# input arguments, handling mutually exclusive sets of options by
-# repetition. When the script is called, ${initial} is the list of
-# options which should appear before all combinations this will
-# output. The output looks like a list of subdirectory names with
-# leading and trailing slashes.
-if [ "$#" != "0" ]; then
- first=$1
- shift
- for opt in `echo $first | sed -e 's|/| |'g`; do
- echo ${initial}${opt}/
- done
- ./tmpmultilib $@
- for opt in `echo $first | sed -e 's|/| |'g`; do
- initial="${initial}${opt}/" ./tmpmultilib $@
- done
-fi
-EOF
-chmod +x tmpmultilib
-
-combinations=`initial=/ ./tmpmultilib ${options}`
-
-rm -f tmpmultilib
-
-# If there exceptions, weed them out now
-if [ -n "${exceptions}" ]; then
- rm -f tmpmultilib2
- cat >tmpmultilib2 <<\EOF
-#!/bin/sh
-# This recursive script weeds out any combination of multilib
-# switches that should not be generated. The output looks like
-# a list of subdirectory names with leading and trailing slashes.
-
- for opt in $@; do
- case "$opt" in
-EOF
-
- for except in ${exceptions}; do
- echo " /${except}/) : ;;" >> tmpmultilib2
- done
-
-cat >>tmpmultilib2 <<\EOF
- *) echo ${opt};;
- esac
- done
-EOF
- chmod +x tmpmultilib2
- combinations=`./tmpmultilib2 ${combinations}`
- rm -f ./tmpmultilib2
-fi
-
-# Construct a sed pattern which will convert option names to directory
-# names.
-todirnames=
-if [ -n "${dirnames}" ]; then
- set x ${dirnames}
- shift
- for set in ${options}; do
- for opt in `echo ${set} | sed -e 's|/| |'g`; do
- if [ "$1" != "${opt}" ]; then
- todirnames="${todirnames} -e s|/${opt}/|/${1}/|g"
- fi
- shift
- done
- done
-fi
-
-# We need another recursive shell script to correctly handle positive
-# matches. If we are invoked as
-# genmultilib "opt1 opt2" "" "opt1=nopt1 opt2=nopt2"
-# we must output
-# opt1/opt2 opt1 opt2
-# opt1/opt2 nopt1 opt2
-# opt1/opt2 opt1 nopt2
-# opt1/opt2 nopt1 nopt2
-# In other words, we must output all combinations of matches.
-rm -f tmpmultilib2
-cat >tmpmultilib2 <<\EOF
-#!/bin/sh
-# The positional parameters are a list of matches to consider.
-# ${dirout} is the directory name and ${optout} is the current list of
-# options.
-if [ "$#" = "0" ]; then
- echo "\"${dirout} ${optout};\","
-else
- first=$1
- shift
- dirout="${dirout}" optout="${optout}" ./tmpmultilib2 $@
- l=`echo ${first} | sed -e 's/=.*$//' -e 's/?/=/g'`
- r=`echo ${first} | sed -e 's/^.*=//' -e 's/?/=/g'`
- if expr " ${optout} " : ".* ${l} .*" > /dev/null; then
- newopt=`echo " ${optout} " | sed -e "s/ ${l} / ${r} /" -e 's/^ //' -e 's/ $//'`
- dirout="${dirout}" optout="${newopt}" ./tmpmultilib2 $@
- fi
-fi
-EOF
-chmod +x tmpmultilib2
-
-# Start with the current directory, which includes only negations.
-optout=
-for set in ${options}; do
- for opt in `echo ${set} | sed -e 's|/| |'g`; do
- optout="${optout} !${opt}"
- done
-done
-optout=`echo ${optout} | sed -e 's/^ //'`
-echo "\". ${optout};\","
-
-# Work over the list of combinations. We have to translate each one
-# to use the directory names rather than the option names, we have to
-# include the information in matches, and we have to generate the
-# correct list of options and negations.
-for combo in ${combinations}; do
- # Use the directory names rather than the option names.
- if [ -n "${todirnames}" ]; then
- dirout=`echo ${combo} | sed ${todirnames}`
- else
- dirout=${combo}
- fi
- # Remove the leading and trailing slashes.
- dirout=`echo ${dirout} | sed -e 's|^/||' -e 's|/$||g'`
-
- # Look through the options. We must output each option that is
- # present, and negate each option that is not present.
- optout=
- for set in ${options}; do
- setopts=`echo ${set} | sed -e 's|/| |g'`
- for opt in ${setopts}; do
- if expr "${combo} " : ".*/${opt}/.*" > /dev/null; then
- optout="${optout} ${opt}"
- else
- optout="${optout} !${opt}"
- fi
- done
- done
- optout=`echo ${optout} | sed -e 's/^ //'`
-
- # Output the line with all appropriate matches.
- dirout="${dirout}" optout="${optout}" ./tmpmultilib2
-done
-
-# Terminate the list of string.
-echo "NULL"
-echo "};"
-
-# Output all of the matches now as option and that is the same as that, with
-# a semicolan trailer. Include all of the normal options as well.
-# Note, the format of the matches is reversed compared
-# to what we want, so switch them around.
-echo ""
-echo "static char *multilib_matches_raw[] = {"
-for match in ${matches}; do
- l=`echo ${match} | sed -e 's/=.*$//' -e 's/?/=/g'`
- r=`echo ${match} | sed -e 's/^.*=//' -e 's/?/=/g'`
- echo "\"${r} ${l};\","
-done
-for set in ${options}; do
- for opt in `echo ${set} | sed -e 's|/| |'g`; do
- echo "\"${opt} ${opt};\","
- done
-done
-echo "NULL"
-echo "};"
-
-# Output the default options now
-echo ""
-echo "static char *multilib_extra = \"${extra}\";"
-rm -f tmpmultilib2
-
-exit 0
diff --git a/gcc/genopinit.c b/gcc/genopinit.c
deleted file mode 100644
index 3087e381c99..00000000000
--- a/gcc/genopinit.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/* Generate code to initialize optabs from machine description.
- Copyright (C) 1993, 1994, 1995, 1996 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. */
-
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-#include <ctype.h>
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern rtx read_rtx ();
-
-char *xmalloc ();
-static void fatal ();
-void fancy_abort ();
-
-/* Many parts of GCC use arrays that are indexed by machine mode and
- contain the insn codes for pattern in the MD file that perform a given
- operation on operands of that mode.
-
- These patterns are present in the MD file with names that contain
- the mode(s) used and the name of the operation. This program
- writes a function `init_all_optabs' that initializes the optabs with
- all the insn codes of the relevant patterns present in the MD file.
-
- This array contains a list of optabs that need to be initialized. Within
- each string, the name of the pattern to be matched against is delimited
- with %( and %). In the string, %a and %b are used to match a short mode
- name (the part of the mode name not including `mode' and converted to
- lower-case). When writing out the initializer, the entire string is
- used. %A and %B are replaced with the full name of the mode; %a and %b
- are replaced with the short form of the name, as above.
-
- If %N is present in the pattern, it means the two modes must be consecutive
- widths in the same mode class (e.g, QImode and HImode). %I means that
- only integer modes should be considered for the next mode, and %F means
- that only float modes should be considered.
-
- For some optabs, we store the operation by RTL codes. These are only
- used for comparisons. In that case, %c and %C are the lower-case and
- upper-case forms of the comparison, respectively. */
-
-/* The reason we use \% is to avoid sequences of the form %-capletter-%
- which SCCS treats as magic. This gets warnings which you should ignore. */
-
-char *optabs[] =
-{ "extendtab[(int) %B][(int) %A][0] = CODE_FOR_%(extend%a\%b2%)",
- "extendtab[(int) %B][(int) %A][1] = CODE_FOR_%(zero_extend%a\%b2%)",
- "fixtab[(int) %A][(int) %B][0] = CODE_FOR_%(fix%F\%a%I\%b2%)",
- "fixtab[(int) %A][(int) %B][1] = CODE_FOR_%(fixuns%F\%a%b2%)",
- "fixtrunctab[(int) %A][(int) %B][0] = CODE_FOR_%(fix_trunc%F\%a%I\%b2%)",
- "fixtrunctab[(int) %A][(int) %B][1] = CODE_FOR_%(fixuns_trunc%F\%a%I\%b2%)",
- "floattab[(int) %B][(int) %A][0] = CODE_FOR_%(float%I\%a%F\%b2%)",
- "floattab[(int) %B][(int) %A][1] = CODE_FOR_%(floatuns%I\%a%F\%b2%)",
- "add_optab->handlers[(int) %A].insn_code = CODE_FOR_%(add%a3%)",
- "sub_optab->handlers[(int) %A].insn_code = CODE_FOR_%(sub%a3%)",
- "smul_optab->handlers[(int) %A].insn_code = CODE_FOR_%(mul%a3%)",
- "umul_highpart_optab->handlers[(int) %A].insn_code = CODE_FOR_%(umul%a3_highpart%)",
- "smul_highpart_optab->handlers[(int) %A].insn_code = CODE_FOR_%(smul%a3_highpart%)",
- "smul_widen_optab->handlers[(int) %B].insn_code = CODE_FOR_%(mul%a%b3%)%N",
- "umul_widen_optab->handlers[(int) %B].insn_code = CODE_FOR_%(umul%a%b3%)%N",
- "sdiv_optab->handlers[(int) %A].insn_code = CODE_FOR_%(div%I\%a3%)",
- "udiv_optab->handlers[(int) %A].insn_code = CODE_FOR_%(udiv%I\%a3%)",
- "sdivmod_optab->handlers[(int) %A].insn_code = CODE_FOR_%(divmod%a4%)",
- "udivmod_optab->handlers[(int) %A].insn_code = CODE_FOR_%(udivmod%a4%)",
- "smod_optab->handlers[(int) %A].insn_code = CODE_FOR_%(mod%a3%)",
- "umod_optab->handlers[(int) %A].insn_code = CODE_FOR_%(umod%a3%)",
- "flodiv_optab->handlers[(int) %A].insn_code = CODE_FOR_%(div%F\%a3%)",
- "ftrunc_optab->handlers[(int) %A].insn_code = CODE_FOR_%(ftrunc%F\%a2%)",
- "and_optab->handlers[(int) %A].insn_code = CODE_FOR_%(and%a3%)",
- "ior_optab->handlers[(int) %A].insn_code = CODE_FOR_%(ior%a3%)",
- "xor_optab->handlers[(int) %A].insn_code = CODE_FOR_%(xor%a3%)",
- "ashl_optab->handlers[(int) %A].insn_code = CODE_FOR_%(ashl%a3%)",
- "ashr_optab->handlers[(int) %A].insn_code = CODE_FOR_%(ashr%a3%)",
- "lshr_optab->handlers[(int) %A].insn_code = CODE_FOR_%(lshr%a3%)",
- "rotl_optab->handlers[(int) %A].insn_code = CODE_FOR_%(rotl%a3%)",
- "rotr_optab->handlers[(int) %A].insn_code = CODE_FOR_%(rotr%a3%)",
- "smin_optab->handlers[(int) %A].insn_code = CODE_FOR_%(smin%I\%a3%)",
- "smin_optab->handlers[(int) %A].insn_code = CODE_FOR_%(min%F\%a3%)",
- "smax_optab->handlers[(int) %A].insn_code = CODE_FOR_%(smax%I\%a3%)",
- "smax_optab->handlers[(int) %A].insn_code = CODE_FOR_%(max%F\%a3%)",
- "umin_optab->handlers[(int) %A].insn_code = CODE_FOR_%(umin%I\%a3%)",
- "umax_optab->handlers[(int) %A].insn_code = CODE_FOR_%(umax%I\%a3%)",
- "neg_optab->handlers[(int) %A].insn_code = CODE_FOR_%(neg%a2%)",
- "abs_optab->handlers[(int) %A].insn_code = CODE_FOR_%(abs%a2%)",
- "sqrt_optab->handlers[(int) %A].insn_code = CODE_FOR_%(sqrt%a2%)",
- "sin_optab->handlers[(int) %A].insn_code = CODE_FOR_%(sin%a2%)",
- "cos_optab->handlers[(int) %A].insn_code = CODE_FOR_%(cos%a2%)",
- "strlen_optab->handlers[(int) %A].insn_code = CODE_FOR_%(strlen%a%)",
- "one_cmpl_optab->handlers[(int) %A].insn_code = CODE_FOR_%(one_cmpl%a2%)",
- "ffs_optab->handlers[(int) %A].insn_code = CODE_FOR_%(ffs%a2%)",
- "mov_optab->handlers[(int) %A].insn_code = CODE_FOR_%(mov%a%)",
- "movstrict_optab->handlers[(int) %A].insn_code = CODE_FOR_%(movstrict%a%)",
- "cmp_optab->handlers[(int) %A].insn_code = CODE_FOR_%(cmp%a%)",
- "tst_optab->handlers[(int) %A].insn_code = CODE_FOR_%(tst%a%)",
- "bcc_gen_fctn[(int) %C] = gen_%(b%c%)",
- "setcc_gen_code[(int) %C] = CODE_FOR_%(s%c%)",
- "movcc_gen_code[(int) %A] = CODE_FOR_%(mov%acc%)",
- "reload_in_optab[(int) %A] = CODE_FOR_%(reload_in%a%)",
- "reload_out_optab[(int) %A] = CODE_FOR_%(reload_out%a%)",
- "movstr_optab[(int) %A] = CODE_FOR_%(movstr%a%)",
- "clrstr_optab[(int) %A] = CODE_FOR_%(clrstr%a%)" };
-
-/* Allow linking with print-rtl.c. */
-char **insn_name_ptr;
-
-static void
-gen_insn (insn)
- rtx insn;
-{
- char *name = XSTR (insn, 0);
- int m1, m2, op;
- int pindex;
- int i;
- char *np, *pp, *p, *q;
- struct obstack *obstack_ptr;
-
- /* Don't mention instructions whose names are the null string.
- They are in the machine description just to be recognized. */
- if (*name == 0)
- return;
-
- /* See if NAME matches one of the patterns we have for the optabs we know
- about. */
-
- for (pindex = 0; pindex < sizeof optabs / sizeof optabs[0]; pindex++)
- {
- int force_float = 0, force_int = 0;
- int force_consec = 0;
- int matches = 1;
-
- for (pp = optabs[pindex]; pp[0] != '%' || pp[1] != '('; pp++)
- ;
-
- for (pp += 2, np = name; matches && ! (pp[0] == '%' && pp[1] == ')');
- pp++)
- {
- if (*pp != '%')
- {
- if (*pp != *np++)
- break;
- }
- else
- switch (*++pp)
- {
- case 'N':
- force_consec = 1;
- break;
- case 'I':
- force_int = 1;
- break;
- case 'F':
- force_float = 1;
- break;
- case 'c':
- for (op = 0; op < NUM_RTX_CODE; op++)
- {
- for (p = rtx_name[op], q = np; *p; p++, q++)
- if (*p != *q)
- break;
-
- /* We have to be concerned about matching "gt" and
- missing "gtu", e.g., so verify we have reached the
- end of thing we are to match. */
- if (*p == 0 && *q == 0 && rtx_class[op] == '<')
- break;
- }
-
- if (op == NUM_RTX_CODE)
- matches = 0;
- else
- np += strlen (rtx_name[op]);
- break;
- case 'a':
- case 'b':
- /* This loop will stop at the first prefix match, so
- look through the modes in reverse order, in case
- EXTRA_CC_MODES was used and CC is a prefix of the
- CC modes (as it should be). */
- for (i = ((int) MAX_MACHINE_MODE) - 1; i >= 0; i--)
- {
- for (p = mode_name[i], q = np; *p; p++, q++)
- if (tolower (*p) != *q)
- break;
-
- if (*p == 0
- && (! force_int || mode_class[i] == MODE_INT)
- && (! force_float || mode_class[i] == MODE_FLOAT))
- break;
- }
-
- if (i < 0)
- matches = 0;
- else if (*pp == 'a')
- m1 = i, np += strlen (mode_name[i]);
- else
- m2 = i, np += strlen (mode_name[i]);
-
- force_int = force_float = 0;
- break;
-
- default:
- abort ();
- }
- }
-
- if (matches && pp[0] == '%' && pp[1] == ')'
- && *np == 0
- && (! force_consec || (int) GET_MODE_WIDER_MODE(m1) == m2))
- break;
- }
-
- if (pindex == sizeof optabs / sizeof optabs[0])
- return;
-
- /* We found a match. If this pattern is only conditionally present,
- write out the "if" and two extra blanks. */
-
- if (*XSTR (insn, 2) != 0)
- printf (" if (HAVE_%s)\n ", name);
-
- printf (" ");
-
- /* Now write out the initialization, making all required substitutions. */
- for (pp = optabs[pindex]; *pp; pp++)
- {
- if (*pp != '%')
- printf ("%c", *pp);
- else
- switch (*++pp)
- {
- case '(': case ')':
- case 'I': case 'F': case 'N':
- break;
- case 'a':
- for (np = mode_name[m1]; *np; np++)
- printf ("%c", tolower (*np));
- break;
- case 'b':
- for (np = mode_name[m2]; *np; np++)
- printf ("%c", tolower (*np));
- break;
- case 'A':
- printf ("%smode", mode_name[m1]);
- break;
- case 'B':
- printf ("%smode", mode_name[m2]);
- break;
- case 'c':
- printf ("%s", rtx_name[op]);
- break;
- case 'C':
- for (np = rtx_name[op]; *np; np++)
- printf ("%c", toupper (*np));
- break;
- }
- }
-
- printf (";\n");
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
-
- return val;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-static void
-fatal (s, a1, a2)
- char *s;
-{
- fprintf (stderr, "genopinit: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- rtx dummy;
- rtx *insn_ptr;
- FILE *infile;
- register int c;
-
- obstack_init (rtl_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- printf ("/* Generated automatically by the program `genopinit'\n\
-from the machine description file `md'. */\n\n");
-
- printf ("#include \"config.h\"\n");
- printf ("#include \"rtl.h\"\n");
- printf ("#include \"flags.h\"\n");
- printf ("#include \"insn-flags.h\"\n");
- printf ("#include \"insn-codes.h\"\n");
- printf ("#include \"insn-config.h\"\n");
- printf ("#include \"recog.h\"\n");
- printf ("#include \"expr.h\"\n");
- printf ("#include \"reload.h\"\n\n");
-
- printf ("void\ninit_all_optabs ()\n{\n");
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND)
- gen_insn (desc);
- }
-
- printf ("}\n");
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
deleted file mode 100644
index bbf620068b9..00000000000
--- a/gcc/genoutput.c
+++ /dev/null
@@ -1,1000 +0,0 @@
-/* Generate code from to output assembler insns as recognized from rtl.
- Copyright (C) 1987, 1988, 1992, 1994, 1995 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 program reads the machine description for the compiler target machine
- and produces a file containing these things:
-
- 1. An array of strings `insn_template' which is indexed by insn code number
- and contains the template for output of that insn,
-
- 2. An array of functions `insn_outfun' which, indexed by the insn code
- number, gives the function that returns a template to use for output of
- that insn. This is used only in the cases where the template is not
- constant. These cases are specified by a * or @ at the beginning of the
- template string in the machine description. They are identified for the
- sake of other parts of the compiler by a zero element in `insn_template'.
-
- 3. An array of functions `insn_gen_function' which, indexed
- by insn code number, gives the function to generate a body
- for that pattern, given operands as arguments.
-
- 4. An array of strings `insn_name' which, indexed by insn code number,
- gives the name for that pattern. Nameless patterns are given a name.
-
- 5. An array of ints `insn_n_operands' which is indexed by insn code number
- and contains the number of distinct operands in the pattern for that insn,
-
- 6. An array of ints `insn_n_dups' which is indexed by insn code number
- and contains the number of match_dup's that appear in the insn's pattern.
- This says how many elements of `recog_dup_loc' are significant
- after an insn has been recognized.
-
- 7. An array of arrays of operand constraint strings,
- `insn_operand_constraint',
- indexed first by insn code number and second by operand number,
- containing the constraint for that operand.
-
- This array is generated only if register constraints appear in
- match_operand rtx's.
-
- 8. An array of arrays of chars which indicate which operands of
- which insn patterns appear within ADDRESS rtx's. This array is
- called `insn_operand_address_p' and is generated only if there
- are *no* register constraints in the match_operand rtx's.
-
- 9. An array of arrays of machine modes, `insn_operand_mode',
- indexed first by insn code number and second by operand number,
- containing the machine mode that that operand is supposed to have.
- Also `insn_operand_strict_low', which is nonzero for operands
- contained in a STRICT_LOW_PART.
-
- 10. An array of arrays of int-valued functions, `insn_operand_predicate',
- indexed first by insn code number and second by operand number,
- containing the match_operand predicate for this operand.
-
- 11. An array of ints, `insn_n_alternatives', that gives the number
- of alternatives in the constraints of each pattern.
-
-The code number of an insn is simply its position in the machine description;
-code numbers are assigned sequentially to entries in the description,
-starting with code number 0.
-
-Thus, the following entry in the machine description
-
- (define_insn "clrdf"
- [(set (match_operand:DF 0 "general_operand" "")
- (const_int 0))]
- ""
- "clrd %0")
-
-assuming it is the 25th entry present, would cause
-insn_template[24] to be "clrd %0", and insn_n_operands[24] to be 1.
-It would not make an case in output_insn_hairy because the template
-given in the entry is a constant (it does not start with `*'). */
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-
-/* No instruction can have more operands than this.
- Sorry for this arbitrary limit, but what machine will
- have an instruction with this many operands? */
-
-#define MAX_MAX_OPERANDS 40
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern rtx read_rtx ();
-
-char *xmalloc ();
-static void fatal ();
-void fancy_abort ();
-static void error ();
-static void mybcopy ();
-static void mybzero ();
-static int n_occurrences ();
-
-/* insns in the machine description are assigned sequential code numbers
- that are used by insn-recog.c (produced by genrecog) to communicate
- to insn-output.c (produced by this program). */
-
-static int next_code_number;
-
-/* This counts all definitions in the md file,
- for the sake of error messages. */
-
-static int next_index_number;
-
-/* Record in this chain all information that we will output,
- associated with the code number of the insn. */
-
-struct data
-{
- int code_number;
- int index_number;
- char *name;
- char *template; /* string such as "movl %1,%0" */
- int n_operands; /* Number of operands this insn recognizes */
- int n_dups; /* Number times match_dup appears in pattern */
- int n_alternatives; /* Number of alternatives in each constraint */
- struct data *next;
- char *constraints[MAX_MAX_OPERANDS];
- /* Number of alternatives in constraints of operand N. */
- int op_n_alternatives[MAX_MAX_OPERANDS];
- char *predicates[MAX_MAX_OPERANDS];
- char address_p[MAX_MAX_OPERANDS];
- enum machine_mode modes[MAX_MAX_OPERANDS];
- char strict_low[MAX_MAX_OPERANDS];
- char outfun; /* Nonzero means this has an output function */
-};
-
-/* This variable points to the first link in the chain. */
-
-struct data *insn_data;
-
-/* Pointer to the last link in the chain, so new elements
- can be added at the end. */
-
-struct data *end_of_insn_data;
-
-/* Nonzero if any match_operand has a constraint string;
- implies that REGISTER_CONSTRAINTS will be defined
- for this machine description. */
-
-int have_constraints;
-
-/* Nonzero if some error has occurred. We will make all errors fatal, but
- might as well continue until we see all of them. */
-
-static int have_error;
-
-static void
-output_prologue ()
-{
-
- printf ("/* Generated automatically by the program `genoutput'\n\
-from the machine description file `md'. */\n\n");
-
- printf ("#include \"config.h\"\n");
- printf ("#include \"rtl.h\"\n");
- printf ("#include \"regs.h\"\n");
- printf ("#include \"hard-reg-set.h\"\n");
- printf ("#include \"real.h\"\n");
- printf ("#include \"insn-config.h\"\n\n");
- printf ("#include \"conditions.h\"\n");
- printf ("#include \"insn-flags.h\"\n");
- printf ("#include \"insn-attr.h\"\n\n");
- printf ("#include \"insn-codes.h\"\n\n");
- printf ("#include \"recog.h\"\n\n");
-
- printf ("#include <stdio.h>\n");
- printf ("#include \"output.h\"\n");
-}
-
-static void
-output_epilogue ()
-{
- register struct data *d;
-
- printf ("\nchar * const insn_template[] =\n {\n");
- for (d = insn_data; d; d = d->next)
- {
- if (d->template)
- printf (" \"%s\",\n", d->template);
- else
- printf (" 0,\n");
- }
- printf (" };\n");
-
- printf ("\nchar *(*const insn_outfun[])() =\n {\n");
- for (d = insn_data; d; d = d->next)
- {
- if (d->outfun)
- printf (" output_%d,\n", d->code_number);
- else
- printf (" 0,\n");
- }
- printf (" };\n");
-
- printf ("\nrtx (*const insn_gen_function[]) () =\n {\n");
- for (d = insn_data; d; d = d->next)
- {
- if (d->name && d->name[0] != '*')
- printf (" gen_%s,\n", d->name);
- else
- printf (" 0,\n");
- }
- printf (" };\n");
-
- printf ("\nchar *insn_name[] =\n {\n");
- {
- int offset = 0;
- int next;
- char * last_name = 0;
- char * next_name;
- register struct data *n;
-
- for (n = insn_data, next = 1; n; n = n->next, next++)
- if (n->name)
- {
- next_name = n->name;
- break;
- }
-
- for (d = insn_data; d; d = d->next)
- {
- if (d->name)
- {
- printf (" \"%s\",\n", d->name);
- offset = 0;
- last_name = d->name;
- next_name = 0;
- for (n = d->next, next = 1; n; n = n->next, next++)
- if (n->name)
- {
- next_name = n->name;
- break;
- }
- }
- else
- {
- offset++;
- if (next_name && (last_name == 0 || offset > next / 2))
- printf (" \"%s-%d\",\n", next_name, next - offset);
- else
- printf (" \"%s+%d\",\n", last_name, offset);
- }
- }
- }
- printf (" };\n");
- printf ("char **insn_name_ptr = insn_name;\n");
-
- printf ("\nconst int insn_n_operands[] =\n {\n");
- for (d = insn_data; d; d = d->next)
- printf (" %d,\n", d->n_operands);
- printf (" };\n");
-
- printf ("\nconst int insn_n_dups[] =\n {\n");
- for (d = insn_data; d; d = d->next)
- printf (" %d,\n", d->n_dups);
- printf (" };\n");
-
- if (have_constraints)
- {
- printf ("\nchar *const insn_operand_constraint[][MAX_RECOG_OPERANDS] =\n {\n");
- for (d = insn_data; d; d = d->next)
- {
- register int i;
- printf (" {");
- for (i = 0; i < d->n_operands; i++)
- {
- if (d->constraints[i] == 0)
- printf (" \"\",");
- else
- printf (" \"%s\",", d->constraints[i]);
- }
- if (d->n_operands == 0)
- printf (" 0");
- printf (" },\n");
- }
- printf (" };\n");
- }
- else
- {
- printf ("\nconst char insn_operand_address_p[][MAX_RECOG_OPERANDS] =\n {\n");
- for (d = insn_data; d; d = d->next)
- {
- register int i;
- printf (" {");
- for (i = 0; i < d->n_operands; i++)
- printf (" %d,", d->address_p[i]);
- if (d->n_operands == 0)
- printf (" 0");
- printf (" },\n");
- }
- printf (" };\n");
- }
-
- printf ("\nconst enum machine_mode insn_operand_mode[][MAX_RECOG_OPERANDS] =\n {\n");
- for (d = insn_data; d; d = d->next)
- {
- register int i;
- printf (" {");
- for (i = 0; i < d->n_operands; i++)
- printf (" %smode,", GET_MODE_NAME (d->modes[i]));
- if (d->n_operands == 0)
- printf (" VOIDmode");
- printf (" },\n");
- }
- printf (" };\n");
-
- printf ("\nconst char insn_operand_strict_low[][MAX_RECOG_OPERANDS] =\n {\n");
- for (d = insn_data; d; d = d->next)
- {
- register int i;
- printf (" {");
- for (i = 0; i < d->n_operands; i++)
- printf (" %d,", d->strict_low[i]);
- if (d->n_operands == 0)
- printf (" 0");
- printf (" },\n");
- }
- printf (" };\n");
-
- {
- /* We need to define all predicates used. Keep a list of those we
- have defined so far. There normally aren't very many predicates used,
- so a linked list should be fast enough. */
- struct predicate { char *name; struct predicate *next; } *predicates = 0;
- struct predicate *p;
- int i;
-
- printf ("\n");
- for (d = insn_data; d; d = d->next)
- for (i = 0; i < d->n_operands; i++)
- if (d->predicates[i] && d->predicates[i][0])
- {
- for (p = predicates; p; p = p->next)
- if (! strcmp (p->name, d->predicates[i]))
- break;
-
- if (p == 0)
- {
- printf ("extern int %s ();\n", d->predicates[i]);
- p = (struct predicate *) alloca (sizeof (struct predicate));
- p->name = d->predicates[i];
- p->next = predicates;
- predicates = p;
- }
- }
-
- printf ("\nint (*const insn_operand_predicate[][MAX_RECOG_OPERANDS])() =\n {\n");
- for (d = insn_data; d; d = d->next)
- {
- printf (" {");
- for (i = 0; i < d->n_operands; i++)
- printf (" %s,", ((d->predicates[i] && d->predicates[i][0])
- ? d->predicates[i] : "0"));
- if (d->n_operands == 0)
- printf (" 0");
- printf (" },\n");
- }
- printf (" };\n");
- }
-
- printf ("\nconst int insn_n_alternatives[] =\n {\n");
- for (d = insn_data; d; d = d->next)
- printf (" %d,\n", d->n_alternatives);
- printf(" };\n");
-}
-
-/* scan_operands (X) stores in max_opno the largest operand
- number present in X, if that is larger than the previous
- value of max_opno. It stores all the constraints in `constraints'
- and all the machine modes in `modes'.
-
- THIS_ADDRESS_P is nonzero if the containing rtx was an ADDRESS.
- THIS_STRICT_LOW is nonzero if the containing rtx was a STRICT_LOW_PART. */
-
-static int max_opno;
-static int num_dups;
-static char *constraints[MAX_MAX_OPERANDS];
-static int op_n_alternatives[MAX_MAX_OPERANDS];
-static char *predicates[MAX_MAX_OPERANDS];
-static char address_p[MAX_MAX_OPERANDS];
-static enum machine_mode modes[MAX_MAX_OPERANDS];
-static char strict_low[MAX_MAX_OPERANDS];
-static char seen[MAX_MAX_OPERANDS];
-
-static void
-scan_operands (part, this_address_p, this_strict_low)
- rtx part;
- int this_address_p;
- int this_strict_low;
-{
- register int i, j;
- register char *format_ptr;
- int opno;
-
- if (part == 0)
- return;
-
- switch (GET_CODE (part))
- {
- case MATCH_OPERAND:
- opno = XINT (part, 0);
- if (opno > max_opno)
- max_opno = opno;
- if (max_opno >= MAX_MAX_OPERANDS)
- {
- error ("Too many operands (%d) in definition %d.\n",
- max_opno + 1, next_index_number);
- return;
- }
- if (seen[opno])
- error ("Definition %d specified operand number %d more than once.\n",
- next_index_number, opno);
- seen[opno] = 1;
- modes[opno] = GET_MODE (part);
- strict_low[opno] = this_strict_low;
- predicates[opno] = XSTR (part, 1);
- constraints[opno] = XSTR (part, 2);
- if (XSTR (part, 2) != 0 && *XSTR (part, 2) != 0)
- {
- op_n_alternatives[opno] = n_occurrences (',', XSTR (part, 2)) + 1;
- have_constraints = 1;
- }
- address_p[opno] = this_address_p;
- return;
-
- case MATCH_SCRATCH:
- opno = XINT (part, 0);
- if (opno > max_opno)
- max_opno = opno;
- if (max_opno >= MAX_MAX_OPERANDS)
- {
- error ("Too many operands (%d) in definition %d.\n",
- max_opno + 1, next_index_number);
- return;
- }
- if (seen[opno])
- error ("Definition %d specified operand number %d more than once.\n",
- next_index_number, opno);
- seen[opno] = 1;
- modes[opno] = GET_MODE (part);
- strict_low[opno] = 0;
- predicates[opno] = "scratch_operand";
- constraints[opno] = XSTR (part, 1);
- if (XSTR (part, 1) != 0 && *XSTR (part, 1) != 0)
- {
- op_n_alternatives[opno] = n_occurrences (',', XSTR (part, 1)) + 1;
- have_constraints = 1;
- }
- address_p[opno] = 0;
- return;
-
- case MATCH_OPERATOR:
- case MATCH_PARALLEL:
- opno = XINT (part, 0);
- if (opno > max_opno)
- max_opno = opno;
- if (max_opno >= MAX_MAX_OPERANDS)
- {
- error ("Too many operands (%d) in definition %d.\n",
- max_opno + 1, next_index_number);
- return;
- }
- if (seen[opno])
- error ("Definition %d specified operand number %d more than once.\n",
- next_index_number, opno);
- seen[opno] = 1;
- modes[opno] = GET_MODE (part);
- strict_low[opno] = 0;
- predicates[opno] = XSTR (part, 1);
- constraints[opno] = 0;
- address_p[opno] = 0;
- for (i = 0; i < XVECLEN (part, 2); i++)
- scan_operands (XVECEXP (part, 2, i), 0, 0);
- return;
-
- case MATCH_DUP:
- case MATCH_OP_DUP:
- case MATCH_PAR_DUP:
- ++num_dups;
- return;
-
- case ADDRESS:
- scan_operands (XEXP (part, 0), 1, 0);
- return;
-
- case STRICT_LOW_PART:
- scan_operands (XEXP (part, 0), 0, 1);
- return;
- }
-
- format_ptr = GET_RTX_FORMAT (GET_CODE (part));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (part)); i++)
- switch (*format_ptr++)
- {
- case 'e':
- scan_operands (XEXP (part, i), 0, 0);
- break;
- case 'E':
- if (XVEC (part, i) != NULL)
- for (j = 0; j < XVECLEN (part, i); j++)
- scan_operands (XVECEXP (part, i, j), 0, 0);
- break;
- }
-}
-
-/* Process an assembler template from a define_insn or a define_peephole.
- It is either the assembler code template, a list of assembler code
- templates, or C code to generate the assembler code template. */
-
-static void
-process_template (d, template)
- struct data *d;
- char *template;
-{
- register char *cp;
- register int i;
-
- /* We need to consider only the instructions whose assembler code template
- starts with a * or @. These are the ones where C code is run to decide
- on a template to use. So for all others just return now. */
-
- if (template[0] != '*' && template[0] != '@')
- {
- d->template = template;
- d->outfun = 0;
- return;
- }
-
- d->template = 0;
- d->outfun = 1;
-
- printf ("\nstatic char *\n");
- printf ("output_%d (operands, insn)\n", d->code_number);
- printf (" rtx *operands;\n");
- printf (" rtx insn;\n");
- printf ("{\n");
-
- /* If the assembler code template starts with a @ it is a newline-separated
- list of assembler code templates, one for each alternative. So produce
- a routine to select the correct one. */
-
- if (template[0] == '@')
- {
-
- printf (" static /*const*/ char *const strings_%d[] = {\n",
- d->code_number);
-
- for (i = 0, cp = &template[1]; *cp; )
- {
- while (*cp == '\n' || *cp == ' ' || *cp== '\t')
- cp++;
-
- printf (" \"");
- while (*cp != '\n' && *cp != '\0')
- putchar (*cp++);
-
- printf ("\",\n");
- i++;
- }
-
- printf (" };\n");
- printf (" return strings_%d[which_alternative];\n", d->code_number);
-
- if (i != d->n_alternatives)
- fatal ("Insn pattern %d has %d alternatives but %d assembler choices",
- d->index_number, d->n_alternatives, i);
-
- }
- else
- {
- /* The following is done in a funny way to get around problems in
- VAX-11 "C" on VMS. It is the equivalent of:
- printf ("%s\n", &template[1])); */
- cp = &template[1];
- while (*cp) putchar (*cp++);
- putchar ('\n');
- }
-
- printf ("}\n");
-}
-
-/* Check insn D for consistency in number of constraint alternatives. */
-
-static void
-validate_insn_alternatives (d)
- struct data *d;
-{
- register int n = 0, start;
- /* Make sure all the operands have the same number of
- alternatives in their constraints.
- Let N be that number. */
- for (start = 0; start < d->n_operands; start++)
- if (d->op_n_alternatives[start] > 0)
- {
- if (n == 0)
- n = d->op_n_alternatives[start];
- else if (n != d->op_n_alternatives[start])
- error ("wrong number of alternatives in operand %d of insn number %d",
- start, d->index_number);
- }
- /* Record the insn's overall number of alternatives. */
- d->n_alternatives = n;
-}
-
-/* Look at a define_insn just read. Assign its code number.
- Record on insn_data the template and the number of arguments.
- If the insn has a hairy output action, output a function for now. */
-
-static void
-gen_insn (insn)
- rtx insn;
-{
- register struct data *d = (struct data *) xmalloc (sizeof (struct data));
- register int i;
-
- d->code_number = next_code_number++;
- d->index_number = next_index_number;
- if (XSTR (insn, 0)[0])
- d->name = XSTR (insn, 0);
- else
- d->name = 0;
-
- /* Build up the list in the same order as the insns are seen
- in the machine description. */
- d->next = 0;
- if (end_of_insn_data)
- end_of_insn_data->next = d;
- else
- insn_data = d;
-
- end_of_insn_data = d;
-
- max_opno = -1;
- num_dups = 0;
-
- mybzero (constraints, sizeof constraints);
- mybzero (op_n_alternatives, sizeof op_n_alternatives);
- mybzero (predicates, sizeof predicates);
- mybzero (address_p, sizeof address_p);
- mybzero (modes, sizeof modes);
- mybzero (strict_low, sizeof strict_low);
- mybzero (seen, sizeof seen);
-
- for (i = 0; i < XVECLEN (insn, 1); i++)
- scan_operands (XVECEXP (insn, 1, i), 0, 0);
-
- d->n_operands = max_opno + 1;
- d->n_dups = num_dups;
-
- mybcopy (constraints, d->constraints, sizeof constraints);
- mybcopy (op_n_alternatives, d->op_n_alternatives, sizeof op_n_alternatives);
- mybcopy (predicates, d->predicates, sizeof predicates);
- mybcopy (address_p, d->address_p, sizeof address_p);
- mybcopy (modes, d->modes, sizeof modes);
- mybcopy (strict_low, d->strict_low, sizeof strict_low);
-
- validate_insn_alternatives (d);
- process_template (d, XSTR (insn, 3));
-}
-
-/* Look at a define_peephole just read. Assign its code number.
- Record on insn_data the template and the number of arguments.
- If the insn has a hairy output action, output it now. */
-
-static void
-gen_peephole (peep)
- rtx peep;
-{
- register struct data *d = (struct data *) xmalloc (sizeof (struct data));
- register int i;
-
- d->code_number = next_code_number++;
- d->index_number = next_index_number;
- d->name = 0;
-
- /* Build up the list in the same order as the insns are seen
- in the machine description. */
- d->next = 0;
- if (end_of_insn_data)
- end_of_insn_data->next = d;
- else
- insn_data = d;
-
- end_of_insn_data = d;
-
- max_opno = -1;
- mybzero (constraints, sizeof constraints);
- mybzero (op_n_alternatives, sizeof op_n_alternatives);
- mybzero (predicates, sizeof predicates);
- mybzero (address_p, sizeof address_p);
- mybzero (modes, sizeof modes);
- mybzero (strict_low, sizeof strict_low);
- mybzero (seen, sizeof seen);
-
- /* Get the number of operands by scanning all the
- patterns of the peephole optimizer.
- But ignore all the rest of the information thus obtained. */
- for (i = 0; i < XVECLEN (peep, 0); i++)
- scan_operands (XVECEXP (peep, 0, i), 0, 0);
-
- d->n_operands = max_opno + 1;
- d->n_dups = 0;
-
- mybcopy (constraints, d->constraints, sizeof constraints);
- mybcopy (op_n_alternatives, d->op_n_alternatives, sizeof op_n_alternatives);
- mybzero (d->predicates, sizeof predicates);
- mybzero (d->address_p, sizeof address_p);
- mybzero (d->modes, sizeof modes);
- mybzero (d->strict_low, sizeof strict_low);
-
- validate_insn_alternatives (d);
- process_template (d, XSTR (peep, 2));
-}
-
-/* Process a define_expand just read. Assign its code number,
- only for the purposes of `insn_gen_function'. */
-
-static void
-gen_expand (insn)
- rtx insn;
-{
- register struct data *d = (struct data *) xmalloc (sizeof (struct data));
- register int i;
-
- d->code_number = next_code_number++;
- d->index_number = next_index_number;
- if (XSTR (insn, 0)[0])
- d->name = XSTR (insn, 0);
- else
- d->name = 0;
-
- /* Build up the list in the same order as the insns are seen
- in the machine description. */
- d->next = 0;
- if (end_of_insn_data)
- end_of_insn_data->next = d;
- else
- insn_data = d;
-
- end_of_insn_data = d;
-
- max_opno = -1;
- num_dups = 0;
-
- /* Scan the operands to get the specified predicates and modes,
- since expand_binop needs to know them. */
-
- mybzero (constraints, sizeof constraints);
- mybzero (op_n_alternatives, sizeof op_n_alternatives);
- mybzero (predicates, sizeof predicates);
- mybzero (address_p, sizeof address_p);
- mybzero (modes, sizeof modes);
- mybzero (strict_low, sizeof strict_low);
- mybzero (seen, sizeof seen);
-
- if (XVEC (insn, 1))
- for (i = 0; i < XVECLEN (insn, 1); i++)
- scan_operands (XVECEXP (insn, 1, i), 0, 0);
-
- d->n_operands = max_opno + 1;
- d->n_dups = num_dups;
-
- mybcopy (constraints, d->constraints, sizeof constraints);
- mybcopy (op_n_alternatives, d->op_n_alternatives, sizeof op_n_alternatives);
- mybcopy (predicates, d->predicates, sizeof predicates);
- mybcopy (address_p, d->address_p, sizeof address_p);
- mybcopy (modes, d->modes, sizeof modes);
- mybcopy (strict_low, d->strict_low, sizeof strict_low);
-
- d->template = 0;
- d->outfun = 0;
- validate_insn_alternatives (d);
-}
-
-/* Process a define_split just read. Assign its code number,
- only for reasons of consistency and to simplify genrecog. */
-
-
-static void
-gen_split (split)
- rtx split;
-{
- register struct data *d = (struct data *) xmalloc (sizeof (struct data));
- register int i;
-
- d->code_number = next_code_number++;
- d->index_number = next_index_number;
- d->name = 0;
-
- /* Build up the list in the same order as the insns are seen
- in the machine description. */
- d->next = 0;
- if (end_of_insn_data)
- end_of_insn_data->next = d;
- else
- insn_data = d;
-
- end_of_insn_data = d;
-
- max_opno = -1;
- num_dups = 0;
-
- mybzero (constraints, sizeof constraints);
- mybzero (op_n_alternatives, sizeof op_n_alternatives);
- mybzero (predicates, sizeof predicates);
- mybzero (address_p, sizeof address_p);
- mybzero (modes, sizeof modes);
- mybzero (strict_low, sizeof strict_low);
- mybzero (seen, sizeof seen);
-
- /* Get the number of operands by scanning all the
- patterns of the split patterns.
- But ignore all the rest of the information thus obtained. */
- for (i = 0; i < XVECLEN (split, 0); i++)
- scan_operands (XVECEXP (split, 0, i), 0, 0);
-
- d->n_operands = max_opno + 1;
-
- mybzero (d->constraints, sizeof constraints);
- mybzero (d->op_n_alternatives, sizeof op_n_alternatives);
- mybzero (d->predicates, sizeof predicates);
- mybzero (d->address_p, sizeof address_p);
- mybzero (d->modes, sizeof modes);
- mybzero (d->strict_low, sizeof strict_low);
-
- d->n_dups = 0;
- d->n_alternatives = 0;
- d->template = 0;
- d->outfun = 0;
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
- return val;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-static void
-mybzero (b, length)
- register char *b;
- register unsigned length;
-{
- while (length-- > 0)
- *b++ = 0;
-}
-
-static void
-mybcopy (b1, b2, length)
- register char *b1;
- register char *b2;
- register unsigned length;
-{
- while (length-- > 0)
- *b2++ = *b1++;
-}
-
-static void
-fatal (s, a1, a2, a3, a4)
- char *s;
-{
- fprintf (stderr, "genoutput: ");
- fprintf (stderr, s, a1, a2, a3, a4);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-static void
-error (s, a1, a2)
- char *s;
-{
- fprintf (stderr, "genoutput: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
-
- have_error = 1;
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- FILE *infile;
- register int c;
-
- obstack_init (rtl_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- output_prologue ();
- next_code_number = 0;
- next_index_number = 0;
- have_constraints = 0;
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN)
- gen_insn (desc);
- if (GET_CODE (desc) == DEFINE_PEEPHOLE)
- gen_peephole (desc);
- if (GET_CODE (desc) == DEFINE_EXPAND)
- gen_expand (desc);
- if (GET_CODE (desc) == DEFINE_SPLIT)
- gen_split (desc);
- next_index_number++;
- }
-
- output_epilogue ();
-
- fflush (stdout);
- exit (ferror (stdout) != 0 || have_error
- ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
-
- /* NOTREACHED */
- return 0;
-}
-
-static int
-n_occurrences (c, s)
- int c;
- char *s;
-{
- int n = 0;
- while (*s)
- n += (*s++ == c);
- return n;
-}
diff --git a/gcc/genpeep.c b/gcc/genpeep.c
deleted file mode 100644
index ba2328d1f3e..00000000000
--- a/gcc/genpeep.c
+++ /dev/null
@@ -1,509 +0,0 @@
-/* Generate code from machine description to perform peephole optimizations.
- Copyright (C) 1987, 1989, 1992 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. */
-
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern rtx read_rtx ();
-
-/* While tree-walking an instruction pattern, we keep a chain
- of these `struct link's to record how to get down to the
- current position. In each one, POS is the operand number,
- and if the operand is a vector VEC is the element number.
- VEC is -1 if the operand is not a vector. */
-
-struct link
-{
- struct link *next;
- int pos;
- int vecelt;
-};
-
-char *xmalloc ();
-static void match_rtx ();
-static void gen_exp ();
-static void fatal ();
-void fancy_abort ();
-
-static int max_opno;
-
-/* Number of operands used in current peephole definition. */
-
-static int n_operands;
-
-/* Peephole optimizations get insn codes just like insn patterns.
- Count them so we know the code of the define_peephole we are handling. */
-
-static int insn_code_number = 0;
-
-static void print_path ();
-static void print_code ();
-
-static void
-gen_peephole (peep)
- rtx peep;
-{
- int ninsns = XVECLEN (peep, 0);
- int i;
-
- n_operands = 0;
-
- printf (" insn = ins1;\n");
-#if 0
- printf (" want_jump = 0;\n");
-#endif
-
- for (i = 0; i < ninsns; i++)
- {
- if (i > 0)
- {
- printf (" do { insn = NEXT_INSN (insn);\n");
- printf (" if (insn == 0) goto L%d; }\n",
- insn_code_number);
- printf (" while (GET_CODE (insn) == NOTE\n");
- printf ("\t || (GET_CODE (insn) == INSN\n");
- printf ("\t && (GET_CODE (PATTERN (insn)) == USE\n");
- printf ("\t\t || GET_CODE (PATTERN (insn)) == CLOBBER)));\n");
-
- printf (" if (GET_CODE (insn) == CODE_LABEL\n\
- || GET_CODE (insn) == BARRIER)\n goto L%d;\n",
- insn_code_number);
- }
-
-#if 0
- printf (" if (GET_CODE (insn) == JUMP_INSN)\n");
- printf (" want_jump = JUMP_LABEL (insn);\n");
-#endif
-
- printf (" pat = PATTERN (insn);\n");
-
- /* Walk the insn's pattern, remembering at all times the path
- down to the walking point. */
-
- match_rtx (XVECEXP (peep, 0, i), NULL_PTR, insn_code_number);
- }
-
- /* We get this far if the pattern matches.
- Now test the extra condition. */
-
- if (XSTR (peep, 1) && XSTR (peep, 1)[0])
- printf (" if (! (%s)) goto L%d;\n",
- XSTR (peep, 1), insn_code_number);
-
- /* If that matches, construct new pattern and put it in the first insn.
- This new pattern will never be matched.
- It exists only so that insn-extract can get the operands back.
- So use a simple regular form: a PARALLEL containing a vector
- of all the operands. */
-
- printf (" PATTERN (ins1) = gen_rtx (PARALLEL, VOIDmode, gen_rtvec_v (%d, operands));\n", n_operands);
-
-#if 0
- printf (" if (want_jump && GET_CODE (ins1) != JUMP_INSN)\n");
- printf (" {\n");
- printf (" rtx insn2 = emit_jump_insn_before (PATTERN (ins1), ins1);\n");
- printf (" delete_insn (ins1);\n");
- printf (" ins1 = ins2;\n");
- printf (" }\n");
-#endif
-
- /* Record this define_peephole's insn code in the insn,
- as if it had been recognized to match this. */
- printf (" INSN_CODE (ins1) = %d;\n",
- insn_code_number);
-
- /* Delete the remaining insns. */
- if (ninsns > 1)
- printf (" delete_for_peephole (NEXT_INSN (ins1), insn);\n");
-
- /* See reload1.c for insertion of NOTE which guarantees that this
- cannot be zero. */
- printf (" return NEXT_INSN (insn);\n");
-
- printf (" L%d:\n\n", insn_code_number);
-}
-
-static void
-match_rtx (x, path, fail_label)
- rtx x;
- struct link *path;
- int fail_label;
-{
- register RTX_CODE code;
- register int i;
- register int len;
- register char *fmt;
- struct link link;
-
- if (x == 0)
- return;
-
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case MATCH_OPERAND:
- if (XINT (x, 0) > max_opno)
- max_opno = XINT (x, 0);
- if (XINT (x, 0) >= n_operands)
- n_operands = 1 + XINT (x, 0);
-
- printf (" x = ");
- print_path (path);
- printf (";\n");
-
- printf (" operands[%d] = x;\n", XINT (x, 0));
- if (XSTR (x, 1) && XSTR (x, 1)[0])
- printf (" if (! %s (x, %smode)) goto L%d;\n",
- XSTR (x, 1), GET_MODE_NAME (GET_MODE (x)), fail_label);
- return;
-
- case MATCH_DUP:
- case MATCH_PAR_DUP:
- printf (" x = ");
- print_path (path);
- printf (";\n");
-
- printf (" if (!rtx_equal_p (operands[%d], x)) goto L%d;\n",
- XINT (x, 0), fail_label);
- return;
-
- case MATCH_OP_DUP:
- printf (" x = ");
- print_path (path);
- printf (";\n");
-
- printf (" if (GET_CODE (operands[%d]) != GET_CODE (x)\n", XINT (x, 0));
- printf (" || GET_MODE (operands[%d]) != GET_MODE (x)) goto L%d;\n",
- XINT (x, 0), fail_label);
- printf (" operands[%d] = x;\n", XINT (x, 0));
- link.next = path;
- link.vecelt = -1;
- for (i = 0; i < XVECLEN (x, 1); i++)
- {
- link.pos = i;
- match_rtx (XVECEXP (x, 1, i), &link, fail_label);
- }
- return;
-
- case MATCH_OPERATOR:
- if (XINT (x, 0) > max_opno)
- max_opno = XINT (x, 0);
- if (XINT (x, 0) >= n_operands)
- n_operands = 1 + XINT (x, 0);
-
- printf (" x = ");
- print_path (path);
- printf (";\n");
-
- printf (" operands[%d] = x;\n", XINT (x, 0));
- if (XSTR (x, 1) && XSTR (x, 1)[0])
- printf (" if (! %s (x, %smode)) goto L%d;\n",
- XSTR (x, 1), GET_MODE_NAME (GET_MODE (x)), fail_label);
- link.next = path;
- link.vecelt = -1;
- for (i = 0; i < XVECLEN (x, 2); i++)
- {
- link.pos = i;
- match_rtx (XVECEXP (x, 2, i), &link, fail_label);
- }
- return;
-
- case MATCH_PARALLEL:
- if (XINT (x, 0) > max_opno)
- max_opno = XINT (x, 0);
- if (XINT (x, 0) >= n_operands)
- n_operands = 1 + XINT (x, 0);
-
- printf (" x = ");
- print_path (path);
- printf (";\n");
-
- printf (" if (GET_CODE (x) != PARALLEL) goto L%d;\n", fail_label);
- printf (" operands[%d] = x;\n", XINT (x, 0));
- if (XSTR (x, 1) && XSTR (x, 1)[0])
- printf (" if (! %s (x, %smode)) goto L%d;\n",
- XSTR (x, 1), GET_MODE_NAME (GET_MODE (x)), fail_label);
- link.next = path;
- link.pos = 0;
- for (i = 0; i < XVECLEN (x, 2); i++)
- {
- link.vecelt = i;
- match_rtx (XVECEXP (x, 2, i), &link, fail_label);
- }
- return;
-
- case ADDRESS:
- match_rtx (XEXP (x, 0), path, fail_label);
- return;
- }
-
- printf (" x = ");
- print_path (path);
- printf (";\n");
-
- printf (" if (GET_CODE (x) != ");
- print_code (code);
- printf (") goto L%d;\n", fail_label);
-
- if (GET_MODE (x) != VOIDmode)
- {
- printf (" if (GET_MODE (x) != %smode) goto L%d;\n",
- GET_MODE_NAME (GET_MODE (x)), fail_label);
- }
-
- link.next = path;
- link.vecelt = -1;
- fmt = GET_RTX_FORMAT (code);
- len = GET_RTX_LENGTH (code);
- for (i = 0; i < len; i++)
- {
- link.pos = i;
- if (fmt[i] == 'e' || fmt[i] == 'u')
- match_rtx (XEXP (x, i), &link, fail_label);
- else if (fmt[i] == 'E')
- {
- int j;
- printf (" if (XVECLEN (x, %d) != %d) goto L%d;\n",
- i, XVECLEN (x, i), fail_label);
- for (j = 0; j < XVECLEN (x, i); j++)
- {
- link.vecelt = j;
- match_rtx (XVECEXP (x, i, j), &link, fail_label);
- }
- }
- else if (fmt[i] == 'i')
- {
- /* Make sure that at run time `x' is the RTX we want to test. */
- if (i != 0)
- {
- printf (" x = ");
- print_path (path);
- printf (";\n");
- }
-
- printf (" if (XINT (x, %d) != %d) goto L%d;\n",
- i, XINT (x, i), fail_label);
- }
- else if (fmt[i] == 'w')
- {
- /* Make sure that at run time `x' is the RTX we want to test. */
- if (i != 0)
- {
- printf (" x = ");
- print_path (path);
- printf (";\n");
- }
-
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- printf (" if (XWINT (x, %d) != %d) goto L%d;\n",
- i, XWINT (x, i), fail_label);
-#else
- printf (" if (XWINT (x, %d) != %ld) goto L%d;\n",
- i, XWINT (x, i), fail_label);
-#endif
- }
- else if (fmt[i] == 's')
- {
- /* Make sure that at run time `x' is the RTX we want to test. */
- if (i != 0)
- {
- printf (" x = ");
- print_path (path);
- printf (";\n");
- }
-
- printf (" if (strcmp (XSTR (x, %d), \"%s\")) goto L%d;\n",
- i, XSTR (x, i), fail_label);
- }
- }
-}
-
-/* Given a PATH, representing a path down the instruction's
- pattern from the root to a certain point, output code to
- evaluate to the rtx at that point. */
-
-static void
-print_path (path)
- struct link *path;
-{
- if (path == 0)
- printf ("pat");
- else if (path->vecelt >= 0)
- {
- printf ("XVECEXP (");
- print_path (path->next);
- printf (", %d, %d)", path->pos, path->vecelt);
- }
- else
- {
- printf ("XEXP (");
- print_path (path->next);
- printf (", %d)", path->pos);
- }
-}
-
-static void
-print_code (code)
- RTX_CODE code;
-{
- register char *p1;
- for (p1 = GET_RTX_NAME (code); *p1; p1++)
- {
- if (*p1 >= 'a' && *p1 <= 'z')
- putchar (*p1 + 'A' - 'a');
- else
- putchar (*p1);
- }
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
- return val;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-static void
-fatal (s, a1, a2)
- char *s;
-{
- fprintf (stderr, "genpeep: ");
- fprintf (stderr, s, a1, a2);
- fprintf (stderr, "\n");
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- FILE *infile;
- register int c;
-
- max_opno = -1;
-
- obstack_init (rtl_obstack);
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
-
- printf ("/* Generated automatically by the program `genpeep'\n\
-from the machine description file `md'. */\n\n");
-
- printf ("#include \"config.h\"\n");
- printf ("#include \"rtl.h\"\n");
- printf ("#include \"regs.h\"\n");
- printf ("#include \"output.h\"\n");
- printf ("#include \"real.h\"\n\n");
-
- printf ("extern rtx peep_operand[];\n\n");
- printf ("#define operands peep_operand\n\n");
-
- printf ("rtx\npeephole (ins1)\n rtx ins1;\n{\n");
- printf (" rtx insn, x, pat;\n");
- printf (" int i;\n\n");
-
- /* Early out: no peepholes for insns followed by barriers. */
- printf (" if (NEXT_INSN (ins1)\n");
- printf (" && GET_CODE (NEXT_INSN (ins1)) == BARRIER)\n");
- printf (" return 0;\n\n");
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_PEEPHOLE)
- {
- gen_peephole (desc);
- insn_code_number++;
- }
- if (GET_CODE (desc) == DEFINE_INSN
- || GET_CODE (desc) == DEFINE_EXPAND
- || GET_CODE (desc) == DEFINE_SPLIT)
- {
- insn_code_number++;
- }
- }
-
- printf (" return 0;\n}\n\n");
-
- if (max_opno == -1)
- max_opno = 1;
-
- printf ("rtx peep_operand[%d];\n", max_opno + 1);
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
deleted file mode 100644
index b07c70fc46f..00000000000
--- a/gcc/genrecog.c
+++ /dev/null
@@ -1,1814 +0,0 @@
-/* Generate code from machine description to recognize rtl as insns.
- Copyright (C) 1987, 88, 92, 93, 94, 1995 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 program is used to produce insn-recog.c, which contains
- a function called `recog' plus its subroutines.
- These functions contain a decision tree
- that recognizes whether an rtx, the argument given to recog,
- is a valid instruction.
-
- recog returns -1 if the rtx is not valid.
- If the rtx is valid, recog returns a nonnegative number
- which is the insn code number for the pattern that matched.
- This is the same as the order in the machine description of the
- entry that matched. This number can be used as an index into various
- insn_* tables, such as insn_template, insn_outfun, and insn_n_operands
- (found in insn-output.c).
-
- The third argument to recog is an optional pointer to an int.
- If present, recog will accept a pattern if it matches except for
- missing CLOBBER expressions at the end. In that case, the value
- pointed to by the optional pointer will be set to the number of
- CLOBBERs that need to be added (it should be initialized to zero by
- the caller). If it is set nonzero, the caller should allocate a
- PARALLEL of the appropriate size, copy the initial entries, and call
- add_clobbers (found in insn-emit.c) to fill in the CLOBBERs.
-
- This program also generates the function `split_insns',
- which returns 0 if the rtl could not be split, or
- it returns the split rtl in a SEQUENCE. */
-
-#include <stdio.h>
-#include "hconfig.h"
-#include "rtl.h"
-#include "obstack.h"
-
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern void free ();
-extern rtx read_rtx ();
-
-/* Data structure for a listhead of decision trees. The alternatives
- to a node are kept in a doublely-linked list so we can easily add nodes
- to the proper place when merging. */
-
-struct decision_head { struct decision *first, *last; };
-
-/* Data structure for decision tree for recognizing
- legitimate instructions. */
-
-struct decision
-{
- int number; /* Node number, used for labels */
- char *position; /* String denoting position in pattern */
- RTX_CODE code; /* Code to test for or UNKNOWN to suppress */
- char ignore_code; /* If non-zero, need not test code */
- char ignore_mode; /* If non-zero, need not test mode */
- int veclen; /* Length of vector, if nonzero */
- enum machine_mode mode; /* Machine mode of node */
- char enforce_mode; /* If non-zero, test `mode' */
- char retest_code, retest_mode; /* See write_tree_1 */
- int test_elt_zero_int; /* Nonzero if should test XINT (rtl, 0) */
- int elt_zero_int; /* Required value for XINT (rtl, 0) */
- int test_elt_one_int; /* Nonzero if should test XINT (rtl, 1) */
- int elt_one_int; /* Required value for XINT (rtl, 1) */
- int test_elt_zero_wide; /* Nonzero if should test XWINT (rtl, 0) */
- HOST_WIDE_INT elt_zero_wide; /* Required value for XWINT (rtl, 0) */
- char *tests; /* If nonzero predicate to call */
- int pred; /* `preds' index of predicate or -1 */
- char *c_test; /* Additional test to perform */
- struct decision_head success; /* Nodes to test on success */
- int insn_code_number; /* Insn number matched, if success */
- int num_clobbers_to_add; /* Number of CLOBBERs to be added to pattern */
- struct decision *next; /* Node to test on failure */
- struct decision *prev; /* Node whose failure tests us */
- struct decision *afterward; /* Node to test on success, but failure of
- successor nodes */
- int opno; /* Operand number, if >= 0 */
- int dupno; /* Number of operand to compare against */
- int label_needed; /* Nonzero if label needed when writing tree */
- int subroutine_number; /* Number of subroutine this node starts */
-};
-
-#define SUBROUTINE_THRESHOLD 50
-
-static int next_subroutine_number;
-
-/* We can write two types of subroutines: One for insn recognition and
- one to split insns. This defines which type is being written. */
-
-enum routine_type {RECOG, SPLIT};
-
-/* Next available node number for tree nodes. */
-
-static int next_number;
-
-/* Next number to use as an insn_code. */
-
-static int next_insn_code;
-
-/* Similar, but counts all expressions in the MD file; used for
- error messages. */
-
-static int next_index;
-
-/* Record the highest depth we ever have so we know how many variables to
- allocate in each subroutine we make. */
-
-static int max_depth;
-
-/* This table contains a list of the rtl codes that can possibly match a
- predicate defined in recog.c. The function `not_both_true' uses it to
- deduce that there are no expressions that can be matches by certain pairs
- of tree nodes. Also, if a predicate can match only one code, we can
- hardwire that code into the node testing the predicate. */
-
-static struct pred_table
-{
- char *name;
- RTX_CODE codes[NUM_RTX_CODE];
-} preds[]
- = {{"general_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF,
- LABEL_REF, SUBREG, REG, MEM}},
-#ifdef PREDICATE_CODES
- PREDICATE_CODES
-#endif
- {"address_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF,
- LABEL_REF, SUBREG, REG, MEM, PLUS, MINUS, MULT}},
- {"register_operand", {SUBREG, REG}},
- {"scratch_operand", {SCRATCH, REG}},
- {"immediate_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF,
- LABEL_REF}},
- {"const_int_operand", {CONST_INT}},
- {"const_double_operand", {CONST_INT, CONST_DOUBLE}},
- {"nonimmediate_operand", {SUBREG, REG, MEM}},
- {"nonmemory_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF,
- LABEL_REF, SUBREG, REG}},
- {"push_operand", {MEM}},
- {"memory_operand", {SUBREG, MEM}},
- {"indirect_operand", {SUBREG, MEM}},
- {"comparison_operator", {EQ, NE, LE, LT, GE, GT, LEU, LTU, GEU, GTU}},
- {"mode_independent_operand", {CONST_INT, CONST_DOUBLE, CONST, SYMBOL_REF,
- LABEL_REF, SUBREG, REG, MEM}}};
-
-#define NUM_KNOWN_PREDS (sizeof preds / sizeof preds[0])
-
-static struct decision_head make_insn_sequence PROTO((rtx, enum routine_type));
-static struct decision *add_to_sequence PROTO((rtx, struct decision_head *,
- char *));
-static int not_both_true PROTO((struct decision *, struct decision *,
- int));
-static int position_merit PROTO((struct decision *, enum machine_mode,
- enum rtx_code));
-static struct decision_head merge_trees PROTO((struct decision_head,
- struct decision_head));
-static int break_out_subroutines PROTO((struct decision_head,
- enum routine_type, int));
-static void write_subroutine PROTO((struct decision *, enum routine_type));
-static void write_tree_1 PROTO((struct decision *, char *,
- struct decision *, enum routine_type));
-static void print_code PROTO((enum rtx_code));
-static int same_codes PROTO((struct decision *, enum rtx_code));
-static void clear_codes PROTO((struct decision *));
-static int same_modes PROTO((struct decision *, enum machine_mode));
-static void clear_modes PROTO((struct decision *));
-static void write_tree PROTO((struct decision *, char *,
- struct decision *, int,
- enum routine_type));
-static void change_state PROTO((char *, char *, int));
-static char *copystr PROTO((char *));
-static void mybzero PROTO((char *, unsigned));
-static void mybcopy PROTO((char *, char *, unsigned));
-static char *concat PROTO((char *, char *));
-static void fatal PROTO((char *));
-char *xrealloc PROTO((char *, unsigned));
-char *xmalloc PROTO((unsigned));
-void fancy_abort PROTO((void));
-
-/* Construct and return a sequence of decisions
- that will recognize INSN.
-
- TYPE says what type of routine we are recognizing (RECOG or SPLIT). */
-
-static struct decision_head
-make_insn_sequence (insn, type)
- rtx insn;
- enum routine_type type;
-{
- rtx x;
- char *c_test = XSTR (insn, type == RECOG ? 2 : 1);
- struct decision *last;
- struct decision_head head;
-
- if (XVECLEN (insn, type == RECOG) == 1)
- x = XVECEXP (insn, type == RECOG, 0);
- else
- {
- x = rtx_alloc (PARALLEL);
- XVEC (x, 0) = XVEC (insn, type == RECOG);
- PUT_MODE (x, VOIDmode);
- }
-
- last = add_to_sequence (x, &head, "");
-
- if (c_test[0])
- last->c_test = c_test;
- last->insn_code_number = next_insn_code;
- last->num_clobbers_to_add = 0;
-
- /* If this is not a DEFINE_SPLIT and X is a PARALLEL, see if it ends with a
- group of CLOBBERs of (hard) registers or MATCH_SCRATCHes. If so, set up
- to recognize the pattern without these CLOBBERs. */
-
- if (type == RECOG && GET_CODE (x) == PARALLEL)
- {
- int i;
-
- for (i = XVECLEN (x, 0); i > 0; i--)
- if (GET_CODE (XVECEXP (x, 0, i - 1)) != CLOBBER
- || (GET_CODE (XEXP (XVECEXP (x, 0, i - 1), 0)) != REG
- && GET_CODE (XEXP (XVECEXP (x, 0, i - 1), 0)) != MATCH_SCRATCH))
- break;
-
- if (i != XVECLEN (x, 0))
- {
- rtx new;
- struct decision_head clobber_head;
-
- if (i == 1)
- new = XVECEXP (x, 0, 0);
- else
- {
- int j;
-
- new = rtx_alloc (PARALLEL);
- XVEC (new, 0) = rtvec_alloc (i);
- for (j = i - 1; j >= 0; j--)
- XVECEXP (new, 0, j) = XVECEXP (x, 0, j);
- }
-
- last = add_to_sequence (new, &clobber_head, "");
-
- if (c_test[0])
- last->c_test = c_test;
- last->insn_code_number = next_insn_code;
- last->num_clobbers_to_add = XVECLEN (x, 0) - i;
-
- head = merge_trees (head, clobber_head);
- }
- }
-
- next_insn_code++;
-
- if (type == SPLIT)
- /* Define the subroutine we will call below and emit in genemit. */
- printf ("extern rtx gen_split_%d ();\n", last->insn_code_number);
-
- return head;
-}
-
-/* Create a chain of nodes to verify that an rtl expression matches
- PATTERN.
-
- LAST is a pointer to the listhead in the previous node in the chain (or
- in the calling function, for the first node).
-
- POSITION is the string representing the current position in the insn.
-
- A pointer to the final node in the chain is returned. */
-
-static struct decision *
-add_to_sequence (pattern, last, position)
- rtx pattern;
- struct decision_head *last;
- char *position;
-{
- register RTX_CODE code;
- register struct decision *new
- = (struct decision *) xmalloc (sizeof (struct decision));
- struct decision *this;
- char *newpos;
- register char *fmt;
- register int i;
- int depth = strlen (position);
- int len;
-
- if (depth > max_depth)
- max_depth = depth;
-
- new->number = next_number++;
- new->position = copystr (position);
- new->ignore_code = 0;
- new->ignore_mode = 0;
- new->enforce_mode = 1;
- new->retest_code = new->retest_mode = 0;
- new->veclen = 0;
- new->test_elt_zero_int = 0;
- new->test_elt_one_int = 0;
- new->test_elt_zero_wide = 0;
- new->elt_zero_int = 0;
- new->elt_one_int = 0;
- new->elt_zero_wide = 0;
- new->tests = 0;
- new->pred = -1;
- new->c_test = 0;
- new->success.first = new->success.last = 0;
- new->insn_code_number = -1;
- new->num_clobbers_to_add = 0;
- new->next = 0;
- new->prev = 0;
- new->afterward = 0;
- new->opno = -1;
- new->dupno = -1;
- new->label_needed = 0;
- new->subroutine_number = 0;
-
- this = new;
-
- last->first = last->last = new;
-
- newpos = (char *) alloca (depth + 2);
- strcpy (newpos, position);
- newpos[depth + 1] = 0;
-
- restart:
-
- new->mode = GET_MODE (pattern);
- new->code = code = GET_CODE (pattern);
-
- switch (code)
- {
- case MATCH_OPERAND:
- case MATCH_SCRATCH:
- case MATCH_OPERATOR:
- case MATCH_PARALLEL:
- new->opno = XINT (pattern, 0);
- new->code = (code == MATCH_PARALLEL ? PARALLEL : UNKNOWN);
- new->enforce_mode = 0;
-
- if (code == MATCH_SCRATCH)
- new->tests = "scratch_operand";
- else
- new->tests = XSTR (pattern, 1);
-
- if (*new->tests == 0)
- new->tests = 0;
-
- /* See if we know about this predicate and save its number. If we do,
- and it only accepts one code, note that fact. The predicate
- `const_int_operand' only tests for a CONST_INT, so if we do so we
- can avoid calling it at all.
-
- Finally, if we know that the predicate does not allow CONST_INT, we
- know that the only way the predicate can match is if the modes match
- (here we use the kludge of relying on the fact that "address_operand"
- accepts CONST_INT; otherwise, it would have to be a special case),
- so we can test the mode (but we need not). This fact should
- considerably simplify the generated code. */
-
- if (new->tests)
- {
- for (i = 0; i < NUM_KNOWN_PREDS; i++)
- if (! strcmp (preds[i].name, new->tests))
- {
- int j;
- int allows_const_int = 0;
-
- new->pred = i;
-
- if (preds[i].codes[1] == 0 && new->code == UNKNOWN)
- {
- new->code = preds[i].codes[0];
- if (! strcmp ("const_int_operand", new->tests))
- new->tests = 0, new->pred = -1;
- }
-
- for (j = 0; j < NUM_RTX_CODE && preds[i].codes[j] != 0; j++)
- if (preds[i].codes[j] == CONST_INT)
- allows_const_int = 1;
-
- if (! allows_const_int)
- new->enforce_mode = new->ignore_mode= 1;
-
- break;
- }
-
-#ifdef PREDICATE_CODES
- /* If the port has a list of the predicates it uses but omits
- one, warn. */
- if (i == NUM_KNOWN_PREDS)
- fprintf (stderr, "Warning: `%s' not in PREDICATE_CODES\n",
- new->tests);
-#endif
- }
-
- if (code == MATCH_OPERATOR || code == MATCH_PARALLEL)
- {
- for (i = 0; i < XVECLEN (pattern, 2); i++)
- {
- newpos[depth] = i + (code == MATCH_OPERATOR ? '0': 'a');
- new = add_to_sequence (XVECEXP (pattern, 2, i),
- &new->success, newpos);
- }
- }
-
- return new;
-
- case MATCH_OP_DUP:
- new->opno = XINT (pattern, 0);
- new->dupno = XINT (pattern, 0);
- new->code = UNKNOWN;
- new->tests = 0;
- for (i = 0; i < XVECLEN (pattern, 1); i++)
- {
- newpos[depth] = i + '0';
- new = add_to_sequence (XVECEXP (pattern, 1, i),
- &new->success, newpos);
- }
- return new;
-
- case MATCH_DUP:
- case MATCH_PAR_DUP:
- new->dupno = XINT (pattern, 0);
- new->code = UNKNOWN;
- new->enforce_mode = 0;
- return new;
-
- case ADDRESS:
- pattern = XEXP (pattern, 0);
- goto restart;
-
- case SET:
- newpos[depth] = '0';
- new = add_to_sequence (SET_DEST (pattern), &new->success, newpos);
- this->success.first->enforce_mode = 1;
- newpos[depth] = '1';
- new = add_to_sequence (SET_SRC (pattern), &new->success, newpos);
-
- /* If set are setting CC0 from anything other than a COMPARE, we
- must enforce the mode so that we do not produce ambiguous insns. */
- if (GET_CODE (SET_DEST (pattern)) == CC0
- && GET_CODE (SET_SRC (pattern)) != COMPARE)
- this->success.first->enforce_mode = 1;
- return new;
-
- case SIGN_EXTEND:
- case ZERO_EXTEND:
- case STRICT_LOW_PART:
- newpos[depth] = '0';
- new = add_to_sequence (XEXP (pattern, 0), &new->success, newpos);
- this->success.first->enforce_mode = 1;
- return new;
-
- case SUBREG:
- this->test_elt_one_int = 1;
- this->elt_one_int = XINT (pattern, 1);
- newpos[depth] = '0';
- new = add_to_sequence (XEXP (pattern, 0), &new->success, newpos);
- this->success.first->enforce_mode = 1;
- return new;
-
- case ZERO_EXTRACT:
- case SIGN_EXTRACT:
- newpos[depth] = '0';
- new = add_to_sequence (XEXP (pattern, 0), &new->success, newpos);
- this->success.first->enforce_mode = 1;
- newpos[depth] = '1';
- new = add_to_sequence (XEXP (pattern, 1), &new->success, newpos);
- newpos[depth] = '2';
- new = add_to_sequence (XEXP (pattern, 2), &new->success, newpos);
- return new;
-
- case EQ: case NE: case LE: case LT: case GE: case GT:
- case LEU: case LTU: case GEU: case GTU:
- /* If the first operand is (cc0), we don't have to do anything
- special. */
- if (GET_CODE (XEXP (pattern, 0)) == CC0)
- break;
-
- /* ... fall through ... */
-
- case COMPARE:
- /* Enforce the mode on the first operand to avoid ambiguous insns. */
- newpos[depth] = '0';
- new = add_to_sequence (XEXP (pattern, 0), &new->success, newpos);
- this->success.first->enforce_mode = 1;
- newpos[depth] = '1';
- new = add_to_sequence (XEXP (pattern, 1), &new->success, newpos);
- return new;
- }
-
- fmt = GET_RTX_FORMAT (code);
- len = GET_RTX_LENGTH (code);
- for (i = 0; i < len; i++)
- {
- newpos[depth] = '0' + i;
- if (fmt[i] == 'e' || fmt[i] == 'u')
- new = add_to_sequence (XEXP (pattern, i), &new->success, newpos);
- else if (fmt[i] == 'i' && i == 0)
- {
- this->test_elt_zero_int = 1;
- this->elt_zero_int = XINT (pattern, i);
- }
- else if (fmt[i] == 'i' && i == 1)
- {
- this->test_elt_one_int = 1;
- this->elt_one_int = XINT (pattern, i);
- }
- else if (fmt[i] == 'w' && i == 0)
- {
- this->test_elt_zero_wide = 1;
- this->elt_zero_wide = XWINT (pattern, i);
- }
- else if (fmt[i] == 'E')
- {
- register int j;
- /* We do not handle a vector appearing as other than
- the first item, just because nothing uses them
- and by handling only the special case
- we can use one element in newpos for either
- the item number of a subexpression
- or the element number in a vector. */
- if (i != 0)
- abort ();
- this->veclen = XVECLEN (pattern, i);
- for (j = 0; j < XVECLEN (pattern, i); j++)
- {
- newpos[depth] = 'a' + j;
- new = add_to_sequence (XVECEXP (pattern, i, j),
- &new->success, newpos);
- }
- }
- else if (fmt[i] != '0')
- abort ();
- }
- return new;
-}
-
-/* Return 1 if we can prove that there is no RTL that can match both
- D1 and D2. Otherwise, return 0 (it may be that there is an RTL that
- can match both or just that we couldn't prove there wasn't such an RTL).
-
- TOPLEVEL is non-zero if we are to only look at the top level and not
- recursively descend. */
-
-static int
-not_both_true (d1, d2, toplevel)
- struct decision *d1, *d2;
- int toplevel;
-{
- struct decision *p1, *p2;
-
- /* If they are both to test modes and the modes are different, they aren't
- both true. Similarly for codes, integer elements, and vector lengths. */
-
- if ((d1->enforce_mode && d2->enforce_mode
- && d1->mode != VOIDmode && d2->mode != VOIDmode && d1->mode != d2->mode)
- || (d1->code != UNKNOWN && d2->code != UNKNOWN && d1->code != d2->code)
- || (d1->test_elt_zero_int && d2->test_elt_zero_int
- && d1->elt_zero_int != d2->elt_zero_int)
- || (d1->test_elt_one_int && d2->test_elt_one_int
- && d1->elt_one_int != d2->elt_one_int)
- || (d1->test_elt_zero_wide && d2->test_elt_zero_wide
- && d1->elt_zero_wide != d2->elt_zero_wide)
- || (d1->veclen && d2->veclen && d1->veclen != d2->veclen))
- return 1;
-
- /* If either is a wild-card MATCH_OPERAND without a predicate, it can match
- absolutely anything, so we can't say that no intersection is possible.
- This case is detected by having a zero TESTS field with a code of
- UNKNOWN. */
-
- if ((d1->tests == 0 && d1->code == UNKNOWN)
- || (d2->tests == 0 && d2->code == UNKNOWN))
- return 0;
-
- /* If either has a predicate that we know something about, set things up so
- that D1 is the one that always has a known predicate. Then see if they
- have any codes in common. */
-
- if (d1->pred >= 0 || d2->pred >= 0)
- {
- int i, j;
-
- if (d2->pred >= 0)
- p1 = d1, d1 = d2, d2 = p1;
-
- /* If D2 tests an explicit code, see if it is in the list of valid codes
- for D1's predicate. */
- if (d2->code != UNKNOWN)
- {
- for (i = 0; i < NUM_RTX_CODE && preds[d1->pred].codes[i] != 0; i++)
- if (preds[d1->pred].codes[i] == d2->code)
- break;
-
- if (preds[d1->pred].codes[i] == 0)
- return 1;
- }
-
- /* Otherwise see if the predicates have any codes in common. */
-
- else if (d2->pred >= 0)
- {
- for (i = 0; i < NUM_RTX_CODE && preds[d1->pred].codes[i] != 0; i++)
- {
- for (j = 0; j < NUM_RTX_CODE; j++)
- if (preds[d2->pred].codes[j] == 0
- || preds[d2->pred].codes[j] == preds[d1->pred].codes[i])
- break;
-
- if (preds[d2->pred].codes[j] != 0)
- break;
- }
-
- if (preds[d1->pred].codes[i] == 0)
- return 1;
- }
- }
-
- /* If we got here, we can't prove that D1 and D2 cannot both be true.
- If we are only to check the top level, return 0. Otherwise, see if
- we can prove that all choices in both successors are mutually
- exclusive. If either does not have any successors, we can't prove
- they can't both be true. */
-
- if (toplevel || d1->success.first == 0 || d2->success.first == 0)
- return 0;
-
- for (p1 = d1->success.first; p1; p1 = p1->next)
- for (p2 = d2->success.first; p2; p2 = p2->next)
- if (! not_both_true (p1, p2, 0))
- return 0;
-
- return 1;
-}
-
-/* Assuming that we can reorder all the alternatives at a specific point in
- the tree (see discussion in merge_trees), we would prefer an ordering of
- nodes where groups of consecutive nodes test the same mode and, within each
- mode, groups of nodes test the same code. With this order, we can
- construct nested switch statements, the inner one to test the code and
- the outer one to test the mode.
-
- We would like to list nodes testing for specific codes before those
- that test predicates to avoid unnecessary function calls. Similarly,
- tests for specific modes should precede nodes that allow any mode.
-
- This function returns the merit (with 0 being the best) of inserting
- a test involving the specified MODE and CODE after node P. If P is
- zero, we are to determine the merit of inserting the test at the front
- of the list. */
-
-static int
-position_merit (p, mode, code)
- struct decision *p;
- enum machine_mode mode;
- enum rtx_code code;
-{
- enum machine_mode p_mode;
-
- /* The only time the front of the list is anything other than the worst
- position is if we are testing a mode that isn't VOIDmode. */
- if (p == 0)
- return mode == VOIDmode ? 3 : 2;
-
- p_mode = p->enforce_mode ? p->mode : VOIDmode;
-
- /* The best case is if the codes and modes both match. */
- if (p_mode == mode && p->code== code)
- return 0;
-
- /* If the codes don't match, the next best case is if the modes match.
- In that case, the best position for this node depends on whether
- we are testing for a specific code or not. If we are, the best place
- is after some other test for an explicit code and our mode or after
- the last test in the previous mode if every test in our mode is for
- an unknown code.
-
- If we are testing for UNKNOWN, then the next best case is at the end of
- our mode. */
-
- if ((code != UNKNOWN
- && ((p_mode == mode && p->code != UNKNOWN)
- || (p_mode != mode && p->next
- && (p->next->enforce_mode ? p->next->mode : VOIDmode) == mode
- && (p->next->code == UNKNOWN))))
- || (code == UNKNOWN && p_mode == mode
- && (p->next == 0
- || (p->next->enforce_mode ? p->next->mode : VOIDmode) != mode)))
- return 1;
-
- /* The third best case occurs when nothing is testing MODE. If MODE
- is not VOIDmode, then the third best case is after something of any
- mode that is not VOIDmode. If we are testing VOIDmode, the third best
- place is the end of the list. */
-
- if (p_mode != mode
- && ((mode != VOIDmode && p_mode != VOIDmode)
- || (mode == VOIDmode && p->next == 0)))
- return 2;
-
- /* Otherwise, we have the worst case. */
- return 3;
-}
-
-/* Merge two decision tree listheads OLDH and ADDH,
- modifying OLDH destructively, and return the merged tree. */
-
-static struct decision_head
-merge_trees (oldh, addh)
- register struct decision_head oldh, addh;
-{
- struct decision *add, *next;
-
- if (oldh.first == 0)
- return addh;
-
- if (addh.first == 0)
- return oldh;
-
- /* If we are adding things at different positions, something is wrong. */
- if (strcmp (oldh.first->position, addh.first->position))
- abort ();
-
- for (add = addh.first; add; add = next)
- {
- enum machine_mode add_mode = add->enforce_mode ? add->mode : VOIDmode;
- struct decision *best_position = 0;
- int best_merit = 4;
- struct decision *old;
-
- next = add->next;
-
- /* The semantics of pattern matching state that the tests are done in
- the order given in the MD file so that if an insn matches two
- patterns, the first one will be used. However, in practice, most,
- if not all, patterns are unambiguous so that their order is
- independent. In that case, we can merge identical tests and
- group all similar modes and codes together.
-
- Scan starting from the end of OLDH until we reach a point
- where we reach the head of the list or where we pass a pattern
- that could also be true if NEW is true. If we find an identical
- pattern, we can merge them. Also, record the last node that tests
- the same code and mode and the last one that tests just the same mode.
-
- If we have no match, place NEW after the closest match we found. */
-
- for (old = oldh.last; old; old = old->prev)
- {
- int our_merit;
-
- /* If we don't have anything to test except an additional test,
- do not consider the two nodes equal. If we did, the test below
- would cause an infinite recursion. */
- if (old->tests == 0 && old->test_elt_zero_int == 0
- && old->test_elt_one_int == 0 && old->veclen == 0
- && old->test_elt_zero_wide == 0
- && old->dupno == -1 && old->mode == VOIDmode
- && old->code == UNKNOWN
- && (old->c_test != 0 || add->c_test != 0))
- ;
-
- else if ((old->tests == add->tests
- || (old->pred >= 0 && old->pred == add->pred)
- || (old->tests && add->tests
- && !strcmp (old->tests, add->tests)))
- && old->test_elt_zero_int == add->test_elt_zero_int
- && old->elt_zero_int == add->elt_zero_int
- && old->test_elt_one_int == add->test_elt_one_int
- && old->elt_one_int == add->elt_one_int
- && old->test_elt_zero_wide == add->test_elt_zero_wide
- && old->elt_zero_wide == add->elt_zero_wide
- && old->veclen == add->veclen
- && old->dupno == add->dupno
- && old->opno == add->opno
- && old->code == add->code
- && old->enforce_mode == add->enforce_mode
- && old->mode == add->mode)
- {
- /* If the additional test is not the same, split both nodes
- into nodes that just contain all things tested before the
- additional test and nodes that contain the additional test
- and actions when it is true. This optimization is important
- because of the case where we have almost identical patterns
- with different tests on target flags. */
-
- if (old->c_test != add->c_test
- && ! (old->c_test && add->c_test
- && !strcmp (old->c_test, add->c_test)))
- {
- if (old->insn_code_number >= 0 || old->opno >= 0)
- {
- struct decision *split
- = (struct decision *) xmalloc (sizeof (struct decision));
-
- mybcopy ((char *) old, (char *) split,
- sizeof (struct decision));
-
- old->success.first = old->success.last = split;
- old->c_test = 0;
- old->opno = -1;
- old->insn_code_number = -1;
- old->num_clobbers_to_add = 0;
-
- split->number = next_number++;
- split->next = split->prev = 0;
- split->mode = VOIDmode;
- split->code = UNKNOWN;
- split->veclen = 0;
- split->test_elt_zero_int = 0;
- split->test_elt_one_int = 0;
- split->test_elt_zero_wide = 0;
- split->tests = 0;
- split->pred = -1;
- split->dupno = -1;
- }
-
- if (add->insn_code_number >= 0 || add->opno >= 0)
- {
- struct decision *split
- = (struct decision *) xmalloc (sizeof (struct decision));
-
- mybcopy ((char *) add, (char *) split,
- sizeof (struct decision));
-
- add->success.first = add->success.last = split;
- add->c_test = 0;
- add->opno = -1;
- add->insn_code_number = -1;
- add->num_clobbers_to_add = 0;
-
- split->number = next_number++;
- split->next = split->prev = 0;
- split->mode = VOIDmode;
- split->code = UNKNOWN;
- split->veclen = 0;
- split->test_elt_zero_int = 0;
- split->test_elt_one_int = 0;
- split->test_elt_zero_wide = 0;
- split->tests = 0;
- split->pred = -1;
- split->dupno = -1;
- }
- }
-
- if (old->insn_code_number >= 0 && add->insn_code_number >= 0)
- {
- /* If one node is for a normal insn and the second is
- for the base insn with clobbers stripped off, the
- second node should be ignored. */
-
- if (old->num_clobbers_to_add == 0
- && add->num_clobbers_to_add > 0)
- /* Nothing to do here. */
- ;
- else if (old->num_clobbers_to_add > 0
- && add->num_clobbers_to_add == 0)
- {
- /* In this case, replace OLD with ADD. */
- old->insn_code_number = add->insn_code_number;
- old->num_clobbers_to_add = 0;
- }
- else
- fatal ("Two actions at one point in tree");
- }
-
- if (old->insn_code_number == -1)
- old->insn_code_number = add->insn_code_number;
- old->success = merge_trees (old->success, add->success);
- add = 0;
- break;
- }
-
- /* Unless we have already found the best possible insert point,
- see if this position is better. If so, record it. */
-
- if (best_merit != 0
- && ((our_merit = position_merit (old, add_mode, add->code))
- < best_merit))
- best_merit = our_merit, best_position = old;
-
- if (! not_both_true (old, add, 0))
- break;
- }
-
- /* If ADD was duplicate, we are done. */
- if (add == 0)
- continue;
-
- /* Otherwise, find the best place to insert ADD. Normally this is
- BEST_POSITION. However, if we went all the way to the top of
- the list, it might be better to insert at the top. */
-
- if (best_position == 0)
- abort ();
-
- if (old == 0
- && position_merit (NULL_PTR, add_mode, add->code) < best_merit)
- {
- add->prev = 0;
- add->next = oldh.first;
- oldh.first->prev = add;
- oldh.first = add;
- }
-
- else
- {
- add->prev = best_position;
- add->next = best_position->next;
- best_position->next = add;
- if (best_position == oldh.last)
- oldh.last = add;
- else
- add->next->prev = add;
- }
- }
-
- return oldh;
-}
-
-/* Count the number of subnodes of HEAD. If the number is high enough,
- make the first node in HEAD start a separate subroutine in the C code
- that is generated.
-
- TYPE gives the type of routine we are writing.
-
- INITIAL is non-zero if this is the highest-level node. We never write
- it out here. */
-
-static int
-break_out_subroutines (head, type, initial)
- struct decision_head head;
- enum routine_type type;
- int initial;
-{
- int size = 0;
- struct decision *sub;
-
- for (sub = head.first; sub; sub = sub->next)
- size += 1 + break_out_subroutines (sub->success, type, 0);
-
- if (size > SUBROUTINE_THRESHOLD && ! initial)
- {
- head.first->subroutine_number = ++next_subroutine_number;
- write_subroutine (head.first, type);
- size = 1;
- }
- return size;
-}
-
-/* Write out a subroutine of type TYPE to do comparisons starting at node
- TREE. */
-
-static void
-write_subroutine (tree, type)
- struct decision *tree;
- enum routine_type type;
-{
- int i;
-
- if (type == SPLIT)
- printf ("rtx\nsplit");
- else
- printf ("int\nrecog");
-
- if (tree != 0 && tree->subroutine_number > 0)
- printf ("_%d", tree->subroutine_number);
- else if (type == SPLIT)
- printf ("_insns");
-
- printf (" (x0, insn");
- if (type == RECOG)
- printf (", pnum_clobbers");
-
- printf (")\n");
- printf (" register rtx x0;\n rtx insn;\n");
- if (type == RECOG)
- printf (" int *pnum_clobbers;\n");
-
- printf ("{\n");
- printf (" register rtx *ro = &recog_operand[0];\n");
-
- printf (" register rtx ");
- for (i = 1; i < max_depth; i++)
- printf ("x%d, ", i);
-
- printf ("x%d;\n", max_depth);
- printf (" %s tem;\n", type == SPLIT ? "rtx" : "int");
- write_tree (tree, "", NULL_PTR, 1, type);
- printf (" ret0: return %d;\n}\n\n", type == SPLIT ? 0 : -1);
-}
-
-/* This table is used to indent the recog_* functions when we are inside
- conditions or switch statements. We only support small indentations
- and always indent at least two spaces. */
-
-static char *indents[]
- = {" ", " ", " ", " ", " ", " ", " ", " ",
- "\t", "\t ", "\t ", "\t ", "\t ", "\t ", "\t ",
- "\t\t", "\t\t ", "\t\t ", "\t\t ", "\t\t ", "\t\t "};
-
-/* Write out C code to perform the decisions in TREE for a subroutine of
- type TYPE. If all of the choices fail, branch to node AFTERWARD, if
- non-zero, otherwise return. PREVPOS is the position of the node that
- branched to this test.
-
- When we merged all alternatives, we tried to set up a convenient order.
- Specifically, tests involving the same mode are all grouped together,
- followed by a group that does not contain a mode test. Within each group
- of the same mode, we also group tests with the same code, followed by a
- group that does not test a code.
-
- Occasionally, we cannot arbitrarily reorder the tests so that multiple
- sequence of groups as described above are present.
-
- We generate two nested switch statements, the outer statement for
- testing modes, and the inner switch for testing RTX codes. It is
- not worth optimizing cases when only a small number of modes or
- codes is tested, since the compiler can do that when compiling the
- resulting function. We do check for when every test is the same mode
- or code. */
-
-static void
-write_tree_1 (tree, prevpos, afterward, type)
- struct decision *tree;
- char *prevpos;
- struct decision *afterward;
- enum routine_type type;
-{
- register struct decision *p, *p1;
- register int depth = tree ? strlen (tree->position) : 0;
- enum machine_mode switch_mode = VOIDmode;
- RTX_CODE switch_code = UNKNOWN;
- int uncond = 0;
- char modemap[NUM_MACHINE_MODES];
- char codemap[NUM_RTX_CODE];
- int indent = 2;
- int i;
-
- /* One tricky area is what is the exact state when we branch to a
- node's label. There are two cases where we branch: when looking at
- successors to a node, or when a set of tests fails.
-
- In the former case, we are always branching to the first node in a
- decision list and we want all required tests to be performed. We
- put the labels for such nodes in front of any switch or test statements.
- These branches are done without updating the position to that of the
- target node.
-
- In the latter case, we are branching to a node that is not the first
- node in a decision list. We have already checked that it is possible
- for both the node we originally tested at this level and the node we
- are branching to to be both match some pattern. That means that they
- usually will be testing the same mode and code. So it is normally safe
- for such labels to be inside switch statements, since the tests done
- by virtue of arriving at that label will usually already have been
- done. The exception is a branch from a node that does not test a
- mode or code to one that does. In such cases, we set the `retest_mode'
- or `retest_code' flags. That will ensure that we start a new switch
- at that position and put the label before the switch.
-
- The branches in the latter case must set the position to that of the
- target node. */
-
-
- printf ("\n");
- if (tree && tree->subroutine_number == 0)
- {
- printf (" L%d:\n", tree->number);
- tree->label_needed = 0;
- }
-
- if (tree)
- {
- change_state (prevpos, tree->position, 2);
- prevpos = tree->position;
- }
-
- for (p = tree; p; p = p->next)
- {
- enum machine_mode mode = p->enforce_mode ? p->mode : VOIDmode;
- int need_bracket;
- int wrote_bracket = 0;
- int inner_indent;
-
- if (p->success.first == 0 && p->insn_code_number < 0)
- abort ();
-
- /* Find the next alternative to p that might be true when p is true.
- Test that one next if p's successors fail. */
-
- for (p1 = p->next; p1 && not_both_true (p, p1, 1); p1 = p1->next)
- ;
- p->afterward = p1;
-
- if (p1)
- {
- if (mode == VOIDmode && p1->enforce_mode && p1->mode != VOIDmode)
- p1->retest_mode = 1;
- if (p->code == UNKNOWN && p1->code != UNKNOWN)
- p1->retest_code = 1;
- p1->label_needed = 1;
- }
-
- /* If we have a different code or mode than the last node and
- are in a switch on codes, we must either end the switch or
- go to another case. We must also end the switch if this
- node needs a label and to retest either the mode or code. */
-
- if (switch_code != UNKNOWN
- && (switch_code != p->code || switch_mode != mode
- || (p->label_needed && (p->retest_mode || p->retest_code))))
- {
- enum rtx_code code = p->code;
-
- /* If P is testing a predicate that we know about and we haven't
- seen any of the codes that are valid for the predicate, we
- can write a series of "case" statement, one for each possible
- code. Since we are already in a switch, these redundant tests
- are very cheap and will reduce the number of predicate called. */
-
- if (p->pred >= 0)
- {
- for (i = 0; i < NUM_RTX_CODE && preds[p->pred].codes[i] != 0; i++)
- if (codemap[(int) preds[p->pred].codes[i]])
- break;
-
- if (preds[p->pred].codes[i] == 0)
- code = MATCH_OPERAND;
- }
-
- if (code == UNKNOWN || codemap[(int) code]
- || switch_mode != mode
- || (p->label_needed && (p->retest_mode || p->retest_code)))
- {
- printf ("%s}\n", indents[indent - 2]);
- switch_code = UNKNOWN;
- indent -= 4;
- }
- else
- {
- if (! uncond)
- printf ("%sbreak;\n", indents[indent]);
-
- if (code == MATCH_OPERAND)
- {
- for (i = 0; i < NUM_RTX_CODE && preds[p->pred].codes[i] != 0; i++)
- {
- printf ("%scase ", indents[indent - 2]);
- print_code (preds[p->pred].codes[i]);
- printf (":\n");
- codemap[(int) preds[p->pred].codes[i]] = 1;
- }
- }
- else
- {
- printf ("%scase ", indents[indent - 2]);
- print_code (code);
- printf (":\n");
- codemap[(int) p->code] = 1;
- }
-
- switch_code = code;
- }
-
- uncond = 0;
- }
-
- /* If we were previously in a switch on modes and now have a different
- mode, end at least the case, and maybe end the switch if we are
- not testing a mode or testing a mode whose case we already saw. */
-
- if (switch_mode != VOIDmode
- && (switch_mode != mode || (p->label_needed && p->retest_mode)))
- {
- if (mode == VOIDmode || modemap[(int) mode]
- || (p->label_needed && p->retest_mode))
- {
- printf ("%s}\n", indents[indent - 2]);
- switch_mode = VOIDmode;
- indent -= 4;
- }
- else
- {
- if (! uncond)
- printf (" break;\n");
- printf (" case %smode:\n", GET_MODE_NAME (mode));
- switch_mode = mode;
- modemap[(int) mode] = 1;
- }
-
- uncond = 0;
- }
-
- /* If we are about to write dead code, something went wrong. */
- if (! p->label_needed && uncond)
- abort ();
-
- /* If we need a label and we will want to retest the mode or code at
- that label, write the label now. We have already ensured that
- things will be valid for the test. */
-
- if (p->label_needed && (p->retest_mode || p->retest_code))
- {
- printf ("%sL%d:\n", indents[indent - 2], p->number);
- p->label_needed = 0;
- }
-
- uncond = 0;
-
- /* If we are not in any switches, see if we can shortcut things
- by checking for identical modes and codes. */
-
- if (switch_mode == VOIDmode && switch_code == UNKNOWN)
- {
- /* If p and its alternatives all want the same mode,
- reject all others at once, first, then ignore the mode. */
-
- if (mode != VOIDmode && p->next && same_modes (p, mode))
- {
- printf (" if (GET_MODE (x%d) != %smode)\n",
- depth, GET_MODE_NAME (p->mode));
- if (afterward)
- {
- printf (" {\n");
- change_state (p->position, afterward->position, 6);
- printf (" goto L%d;\n }\n", afterward->number);
- }
- else
- printf (" goto ret0;\n");
- clear_modes (p);
- mode = VOIDmode;
- }
-
- /* If p and its alternatives all want the same code,
- reject all others at once, first, then ignore the code. */
-
- if (p->code != UNKNOWN && p->next && same_codes (p, p->code))
- {
- printf (" if (GET_CODE (x%d) != ", depth);
- print_code (p->code);
- printf (")\n");
- if (afterward)
- {
- printf (" {\n");
- change_state (p->position, afterward->position, indent + 4);
- printf (" goto L%d;\n }\n", afterward->number);
- }
- else
- printf (" goto ret0;\n");
- clear_codes (p);
- }
- }
-
- /* If we are not in a mode switch and we are testing for a specific
- mode, start a mode switch unless we have just one node or the next
- node is not testing a mode (we have already tested for the case of
- more than one mode, but all of the same mode). */
-
- if (switch_mode == VOIDmode && mode != VOIDmode && p->next != 0
- && p->next->enforce_mode && p->next->mode != VOIDmode)
- {
- mybzero (modemap, sizeof modemap);
- printf ("%sswitch (GET_MODE (x%d))\n", indents[indent], depth);
- printf ("%s{\n", indents[indent + 2]);
- indent += 4;
- printf ("%scase %smode:\n", indents[indent - 2],
- GET_MODE_NAME (mode));
- modemap[(int) mode] = 1;
- switch_mode = mode;
- }
-
- /* Similarly for testing codes. */
-
- if (switch_code == UNKNOWN && p->code != UNKNOWN && ! p->ignore_code
- && p->next != 0 && p->next->code != UNKNOWN)
- {
- mybzero (codemap, sizeof codemap);
- printf ("%sswitch (GET_CODE (x%d))\n", indents[indent], depth);
- printf ("%s{\n", indents[indent + 2]);
- indent += 4;
- printf ("%scase ", indents[indent - 2]);
- print_code (p->code);
- printf (":\n");
- codemap[(int) p->code] = 1;
- switch_code = p->code;
- }
-
- /* Now that most mode and code tests have been done, we can write out
- a label for an inner node, if we haven't already. */
- if (p->label_needed)
- printf ("%sL%d:\n", indents[indent - 2], p->number);
-
- inner_indent = indent;
-
- /* The only way we can have to do a mode or code test here is if
- this node needs such a test but is the only node to be tested.
- In that case, we won't have started a switch. Note that this is
- the only way the switch and test modes can disagree. */
-
- if ((mode != switch_mode && ! p->ignore_mode)
- || (p->code != switch_code && p->code != UNKNOWN && ! p->ignore_code)
- || p->test_elt_zero_int || p->test_elt_one_int
- || p->test_elt_zero_wide || p->veclen
- || p->dupno >= 0 || p->tests || p->num_clobbers_to_add)
- {
- printf ("%sif (", indents[indent]);
-
- if (mode != switch_mode && ! p->ignore_mode)
- printf ("GET_MODE (x%d) == %smode && ",
- depth, GET_MODE_NAME (mode));
- if (p->code != switch_code && p->code != UNKNOWN && ! p->ignore_code)
- {
- printf ("GET_CODE (x%d) == ", depth);
- print_code (p->code);
- printf (" && ");
- }
-
- if (p->test_elt_zero_int)
- printf ("XINT (x%d, 0) == %d && ", depth, p->elt_zero_int);
- if (p->test_elt_one_int)
- printf ("XINT (x%d, 1) == %d && ", depth, p->elt_one_int);
- if (p->test_elt_zero_wide)
- {
- /* Set offset to 1 iff the number might get propagated to
- unsigned long by ANSI C rules, else 0.
- Prospective hosts are required to have at least 32 bit
- ints, and integer constants in machine descriptions
- must fit in 32 bit, thus it suffices to check only
- for 1 << 31 . */
- HOST_WIDE_INT offset = p->elt_zero_wide == -2147483647 - 1;
- printf (
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- "XWINT (x%d, 0) == %d%s && ",
-#else
- "XWINT (x%d, 0) == %ld%s && ",
-#endif
- depth, p->elt_zero_wide + offset, offset ? "-1" : "");
- }
- if (p->veclen)
- printf ("XVECLEN (x%d, 0) == %d && ", depth, p->veclen);
- if (p->dupno >= 0)
- printf ("rtx_equal_p (x%d, ro[%d]) && ", depth, p->dupno);
- if (p->num_clobbers_to_add)
- printf ("pnum_clobbers != 0 && ");
- if (p->tests)
- printf ("%s (x%d, %smode)", p->tests, depth,
- GET_MODE_NAME (p->mode));
- else
- printf ("1");
-
- printf (")\n");
- inner_indent += 2;
- }
- else
- uncond = 1;
-
- need_bracket = ! uncond;
-
- if (p->opno >= 0)
- {
- if (need_bracket)
- {
- printf ("%s{\n", indents[inner_indent]);
- inner_indent += 2;
- wrote_bracket = 1;
- need_bracket = 0;
- }
-
- printf ("%sro[%d] = x%d;\n", indents[inner_indent], p->opno, depth);
- }
-
- if (p->c_test)
- {
- printf ("%sif (%s)\n", indents[inner_indent], p->c_test);
- inner_indent += 2;
- uncond = 0;
- need_bracket = 1;
- }
-
- if (p->insn_code_number >= 0)
- {
- if (type == SPLIT)
- printf ("%sreturn gen_split_%d (operands);\n",
- indents[inner_indent], p->insn_code_number);
- else
- {
- if (p->num_clobbers_to_add)
- {
- if (need_bracket)
- {
- printf ("%s{\n", indents[inner_indent]);
- inner_indent += 2;
- }
-
- printf ("%s*pnum_clobbers = %d;\n",
- indents[inner_indent], p->num_clobbers_to_add);
- printf ("%sreturn %d;\n",
- indents[inner_indent], p->insn_code_number);
-
- if (need_bracket)
- {
- inner_indent -= 2;
- printf ("%s}\n", indents[inner_indent]);
- }
- }
- else
- printf ("%sreturn %d;\n",
- indents[inner_indent], p->insn_code_number);
- }
- }
- else
- printf ("%sgoto L%d;\n", indents[inner_indent],
- p->success.first->number);
-
- if (wrote_bracket)
- printf ("%s}\n", indents[inner_indent - 2]);
- }
-
- /* We have now tested all alternatives. End any switches we have open
- and branch to the alternative node unless we know that we can't fall
- through to the branch. */
-
- if (switch_code != UNKNOWN)
- {
- printf ("%s}\n", indents[indent - 2]);
- indent -= 4;
- uncond = 0;
- }
-
- if (switch_mode != VOIDmode)
- {
- printf ("%s}\n", indents[indent - 2]);
- indent -= 4;
- uncond = 0;
- }
-
- if (indent != 2)
- abort ();
-
- if (uncond)
- return;
-
- if (afterward)
- {
- change_state (prevpos, afterward->position, 2);
- printf (" goto L%d;\n", afterward->number);
- }
- else
- printf (" goto ret0;\n");
-}
-
-static void
-print_code (code)
- enum rtx_code code;
-{
- register char *p1;
- for (p1 = GET_RTX_NAME (code); *p1; p1++)
- {
- if (*p1 >= 'a' && *p1 <= 'z')
- putchar (*p1 + 'A' - 'a');
- else
- putchar (*p1);
- }
-}
-
-static int
-same_codes (p, code)
- register struct decision *p;
- register enum rtx_code code;
-{
- for (; p; p = p->next)
- if (p->code != code)
- return 0;
-
- return 1;
-}
-
-static void
-clear_codes (p)
- register struct decision *p;
-{
- for (; p; p = p->next)
- p->ignore_code = 1;
-}
-
-static int
-same_modes (p, mode)
- register struct decision *p;
- register enum machine_mode mode;
-{
- for (; p; p = p->next)
- if ((p->enforce_mode ? p->mode : VOIDmode) != mode)
- return 0;
-
- return 1;
-}
-
-static void
-clear_modes (p)
- register struct decision *p;
-{
- for (; p; p = p->next)
- p->enforce_mode = 0;
-}
-
-/* Write out the decision tree starting at TREE for a subroutine of type TYPE.
-
- PREVPOS is the position at the node that branched to this node.
-
- INITIAL is nonzero if this is the first node we are writing in a subroutine.
-
- If all nodes are false, branch to the node AFTERWARD. */
-
-static void
-write_tree (tree, prevpos, afterward, initial, type)
- struct decision *tree;
- char *prevpos;
- struct decision *afterward;
- int initial;
- enum routine_type type;
-{
- register struct decision *p;
- char *name_prefix = (type == SPLIT ? "split" : "recog");
- char *call_suffix = (type == SPLIT ? "" : ", pnum_clobbers");
-
- if (! initial && tree->subroutine_number > 0)
- {
- printf (" L%d:\n", tree->number);
-
- if (afterward)
- {
- printf (" tem = %s_%d (x0, insn%s);\n",
- name_prefix, tree->subroutine_number, call_suffix);
- if (type == SPLIT)
- printf (" if (tem != 0) return tem;\n");
- else
- printf (" if (tem >= 0) return tem;\n");
- change_state (tree->position, afterward->position, 2);
- printf (" goto L%d;\n", afterward->number);
- }
- else
- printf (" return %s_%d (x0, insn%s);\n",
- name_prefix, tree->subroutine_number, call_suffix);
- return;
- }
-
- write_tree_1 (tree, prevpos, afterward, type);
-
- for (p = tree; p; p = p->next)
- if (p->success.first)
- write_tree (p->success.first, p->position,
- p->afterward ? p->afterward : afterward, 0, type);
-}
-
-
-/* Assuming that the state of argument is denoted by OLDPOS, take whatever
- actions are necessary to move to NEWPOS.
-
- INDENT says how many blanks to place at the front of lines. */
-
-static void
-change_state (oldpos, newpos, indent)
- char *oldpos;
- char *newpos;
- int indent;
-{
- int odepth = strlen (oldpos);
- int depth = odepth;
- int ndepth = strlen (newpos);
-
- /* Pop up as many levels as necessary. */
-
- while (strncmp (oldpos, newpos, depth))
- --depth;
-
- /* Go down to desired level. */
-
- while (depth < ndepth)
- {
- if (newpos[depth] >= 'a' && newpos[depth] <= 'z')
- printf ("%sx%d = XVECEXP (x%d, 0, %d);\n",
- indents[indent], depth + 1, depth, newpos[depth] - 'a');
- else
- printf ("%sx%d = XEXP (x%d, %c);\n",
- indents[indent], depth + 1, depth, newpos[depth]);
- ++depth;
- }
-}
-
-static char *
-copystr (s1)
- char *s1;
-{
- register char *tem;
-
- if (s1 == 0)
- return 0;
-
- tem = (char *) xmalloc (strlen (s1) + 1);
- strcpy (tem, s1);
-
- return tem;
-}
-
-static void
-mybzero (b, length)
- register char *b;
- register unsigned length;
-{
- while (length-- > 0)
- *b++ = 0;
-}
-
-static void
-mybcopy (in, out, length)
- register char *in, *out;
- register unsigned length;
-{
- while (length-- > 0)
- *out++ = *in++;
-}
-
-static char *
-concat (s1, s2)
- char *s1, *s2;
-{
- register char *tem;
-
- if (s1 == 0)
- return s2;
- if (s2 == 0)
- return s1;
-
- tem = (char *) xmalloc (strlen (s1) + strlen (s2) + 2);
- strcpy (tem, s1);
- strcat (tem, " ");
- strcat (tem, s2);
-
- return tem;
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- unsigned size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *val = (char *) malloc (size);
-
- if (val == 0)
- fatal ("virtual memory exhausted");
- return val;
-}
-
-static void
-fatal (s)
- char *s;
-{
- fprintf (stderr, "genrecog: ");
- fprintf (stderr, s);
- fprintf (stderr, "\n");
- fprintf (stderr, "after %d definitions\n", next_index);
- exit (FATAL_EXIT_CODE);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal gcc abort.");
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- rtx desc;
- struct decision_head recog_tree;
- struct decision_head split_tree;
- FILE *infile;
- register int c;
-
- obstack_init (rtl_obstack);
- recog_tree.first = recog_tree.last = split_tree.first = split_tree.last = 0;
-
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- exit (FATAL_EXIT_CODE);
- }
-
- init_rtl ();
- next_insn_code = 0;
- next_index = 0;
-
- printf ("/* Generated automatically by the program `genrecog'\n\
-from the machine description file `md'. */\n\n");
-
- printf ("#include \"config.h\"\n");
- printf ("#include \"rtl.h\"\n");
- printf ("#include \"insn-config.h\"\n");
- printf ("#include \"recog.h\"\n");
- printf ("#include \"real.h\"\n");
- printf ("#include \"output.h\"\n");
- printf ("#include \"flags.h\"\n");
- printf ("\n");
-
- /* Read the machine description. */
-
- while (1)
- {
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN)
- recog_tree = merge_trees (recog_tree,
- make_insn_sequence (desc, RECOG));
- else if (GET_CODE (desc) == DEFINE_SPLIT)
- split_tree = merge_trees (split_tree,
- make_insn_sequence (desc, SPLIT));
- if (GET_CODE (desc) == DEFINE_PEEPHOLE
- || GET_CODE (desc) == DEFINE_EXPAND)
- next_insn_code++;
- next_index++;
- }
-
- printf ("\n\
-/* `recog' contains a decision tree\n\
- that recognizes whether the rtx X0 is a valid instruction.\n\
-\n\
- recog returns -1 if the rtx is not valid.\n\
- If the rtx is valid, recog returns a nonnegative number\n\
- which is the insn code number for the pattern that matched.\n");
- printf (" This is the same as the order in the machine description of\n\
- the entry that matched. This number can be used as an index into\n\
- entry that matched. This number can be used as an index into various\n\
- insn_* tables, such as insn_templates, insn_outfun, and insn_n_operands\n\
- (found in insn-output.c).\n\n");
- printf (" The third argument to recog is an optional pointer to an int.\n\
- If present, recog will accept a pattern if it matches except for\n\
- missing CLOBBER expressions at the end. In that case, the value\n\
- pointed to by the optional pointer will be set to the number of\n\
- CLOBBERs that need to be added (it should be initialized to zero by\n\
- the caller). If it is set nonzero, the caller should allocate a\n\
- PARALLEL of the appropriate size, copy the initial entries, and call\n\
- add_clobbers (found in insn-emit.c) to fill in the CLOBBERs.");
-
- if (split_tree.first)
- printf ("\n\n The function split_insns returns 0 if the rtl could not\n\
- be split or the split rtl in a SEQUENCE if it can be.");
-
- printf ("*/\n\n");
-
- printf ("rtx recog_operand[MAX_RECOG_OPERANDS];\n\n");
- printf ("rtx *recog_operand_loc[MAX_RECOG_OPERANDS];\n\n");
- printf ("rtx *recog_dup_loc[MAX_DUP_OPERANDS];\n\n");
- printf ("char recog_dup_num[MAX_DUP_OPERANDS];\n\n");
- printf ("#define operands recog_operand\n\n");
-
- next_subroutine_number = 0;
- break_out_subroutines (recog_tree, RECOG, 1);
- write_subroutine (recog_tree.first, RECOG);
-
- next_subroutine_number = 0;
- break_out_subroutines (split_tree, SPLIT, 1);
- write_subroutine (split_tree.first, SPLIT);
-
- fflush (stdout);
- exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
- /* NOTREACHED */
- return 0;
-}
diff --git a/gcc/getopt.h b/gcc/getopt.h
deleted file mode 100644
index c4549243230..00000000000
--- a/gcc/getopt.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Declarations for getopt.
- Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
-
- the C library, however. The master source lives in /gd/gnu/lib.
-
-NOTE: The canonical source of this file is maintained with the GNU C Library.
-Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-
-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, 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. */
-
-#ifndef _GETOPT_H
-#define _GETOPT_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-extern char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns -1, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-extern int optind;
-
-/* Callers store zero here to inhibit the error message `getopt' prints
- for unrecognized options. */
-
-extern int opterr;
-
-/* Set to an option character which was unrecognized. */
-
-extern int optopt;
-
-/* Describe the long-named options requested by the application.
- The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
- of `struct option' terminated by an element containing a name which is
- zero.
-
- The field `has_arg' is:
- no_argument (or 0) if the option does not take an argument,
- required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
-
- If the field `flag' is not NULL, it points to a variable that is set
- to the value given in the field `val' when the option is found, but
- left unchanged if the option is not found.
-
- To have a long-named option do something other than set an `int' to
- a compiled-in constant, such as set a value from `optarg', set the
- option's `flag' field to zero and its `val' field to a nonzero
- value (the equivalent single-letter option character, if there is
- one). For long options that have a zero `flag' field, `getopt'
- returns the contents of the `val' field. */
-
-struct option
-{
-#if defined (__STDC__) && __STDC__
- const char *name;
-#else
- char *name;
-#endif
- /* has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
-};
-
-/* Names for the values of the `has_arg' field of `struct option'. */
-
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
-
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
-/* Many other libraries have conflicting prototypes for getopt, with
- differences in the consts, in stdlib.h. To avoid compilation
- errors, only prototype getopt for the GNU C library. */
-extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
-#endif /* __GNU_LIBRARY__ */
-extern int getopt_long (int argc, char *const *argv, const char *shortopts,
- const struct option *longopts, int *longind);
-extern int getopt_long_only (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind);
-
-/* Internal only. Users should not call this directly. */
-extern int _getopt_internal (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind,
- int long_only);
-#else /* not __STDC__ */
-extern int getopt ();
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
-#endif /* __STDC__ */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GETOPT_H */
diff --git a/gcc/getopt1.c b/gcc/getopt1.c
deleted file mode 100644
index b51be7f1bc3..00000000000
--- a/gcc/getopt1.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
-
- the C library, however. The master source lives in /gd/gnu/lib.
-
-NOTE: The canonical source of this file is maintained with the GNU C Library.
-Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-
-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, 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. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "getopt.h"
-
-#if !defined (__STDC__) || !__STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#define GETOPT_INTERFACE_VERSION 2
-#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
-#include <gnu-versions.h>
-#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-#define ELIDE_CODE
-#endif
-#endif
-
-#ifndef ELIDE_CODE
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-#include <stdlib.h>
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-int
-getopt_long (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
-}
-
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
- If an option that starts with '-' (not '--') doesn't match a long option,
- but does match a short option, it is parsed as a short option
- instead. */
-
-int
-getopt_long_only (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
-}
-
-
-#endif /* Not ELIDE_CODE. */
-
-#ifdef TEST
-
-#include <stdio.h>
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
- int option_index = 0;
- static struct option long_options[] =
- {
- {"add", 1, 0, 0},
- {"append", 0, 0, 0},
- {"delete", 1, 0, 0},
- {"verbose", 0, 0, 0},
- {"create", 0, 0, 0},
- {"file", 1, 0, 0},
- {0, 0, 0, 0}
- };
-
- c = getopt_long (argc, argv, "abc:d:0123456789",
- long_options, &option_index);
- if (c == -1)
- break;
-
- switch (c)
- {
- case 0:
- printf ("option %s", long_options[option_index].name);
- if (optarg)
- printf (" with arg %s", optarg);
- printf ("\n");
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case 'd':
- printf ("option d with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/gcc/getpwd.c b/gcc/getpwd.c
deleted file mode 100644
index e48b277b95a..00000000000
--- a/gcc/getpwd.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* getpwd.c - get the working directory */
-
-#include "config.h"
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef errno
-extern int errno;
-#endif
-
-/* Virtually every UN*X system now in common use (except for pre-4.3-tahoe
- BSD systems) now provides getcwd as called for by POSIX. Allow for
- the few exceptions to the general rule here. */
-
-#if !(defined (POSIX) || defined (USG) || defined (VMS)) || defined (HAVE_GETWD)
-#include <sys/param.h>
-extern char *getwd ();
-#define getcwd(buf,len) getwd(buf)
-#ifdef MAXPATHLEN
-#define GUESSPATHLEN (MAXPATHLEN + 1)
-#else
-#define GUESSPATHLEN 100
-#endif
-#else /* (defined (USG) || defined (VMS)) */
-extern char *getcwd ();
-/* We actually use this as a starting point, not a limit. */
-#define GUESSPATHLEN 100
-#endif /* (defined (USG) || defined (VMS)) */
-
-char *getenv ();
-char *xmalloc ();
-
-#ifndef VMS
-
-/* Get the working directory. Use the PWD environment variable if it's
- set correctly, since this is faster and gives more uniform answers
- to the user. Yield the working directory if successful; otherwise,
- yield 0 and set errno. */
-
-char *
-getpwd ()
-{
- static char *pwd;
- static int failure_errno;
-
- char *p = pwd;
- size_t s;
- struct stat dotstat, pwdstat;
-
- if (!p && !(errno = failure_errno))
- {
- if (! ((p = getenv ("PWD")) != 0
- && *p == '/'
- && stat (p, &pwdstat) == 0
- && stat (".", &dotstat) == 0
- && dotstat.st_ino == pwdstat.st_ino
- && dotstat.st_dev == pwdstat.st_dev))
-
- /* The shortcut didn't work. Try the slow, ``sure'' way. */
- for (s = GUESSPATHLEN; ! getcwd (p = xmalloc (s), s); s *= 2)
- {
- int e = errno;
- free (p);
-#ifdef ERANGE
- if (e != ERANGE)
-#endif
- {
- errno = failure_errno = e;
- p = 0;
- break;
- }
- }
-
- /* Cache the result. This assumes that the program does
- not invoke chdir between calls to getpwd. */
- pwd = p;
- }
- return p;
-}
-
-#else /* VMS */
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 255
-#endif
-
-char *
-getpwd ()
-{
- static char *pwd = 0;
-
- if (!pwd) pwd = getcwd (xmalloc (MAXPATHLEN+1), MAXPATHLEN+1);
- return pwd;
-}
-
-#endif /* VMS */
diff --git a/gcc/ginclude/iso646.h b/gcc/ginclude/iso646.h
deleted file mode 100644
index 77ebdd30c4d..00000000000
--- a/gcc/ginclude/iso646.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Macros for C programs written in national variants of ISO 646. */
-
-#ifndef __cplusplus
-#define and &&
-#define and_eq &=
-#define bitand &
-#define bitor |
-#define compl ~
-#define not !
-#define not_eq !=
-#define or ||
-#define or_eq |=
-#define xor ^
-#define xor_eq ^=
-#endif
diff --git a/gcc/ginclude/math-3300.h b/gcc/ginclude/math-3300.h
deleted file mode 100644
index 4e701257995..00000000000
--- a/gcc/ginclude/math-3300.h
+++ /dev/null
@@ -1,461 +0,0 @@
-/******************************************************************\
-* *
-* <math-68881.h> last modified: 18 May 1989. *
-* *
-* Copyright (C) 1989 by Matthew Self. *
-* You may freely distribute verbatim copies of this software *
-* provided that this copyright notice is retained in all copies. *
-* You may distribute modifications to this software under the *
-* conditions above if you also clearly note such modifications *
-* with their author and date. *
-* *
-* Note: errno is not set to EDOM when domain errors occur for *
-* most of these functions. Rather, it is assumed that the *
-* 68881's OPERR exception will be enabled and handled *
-* appropriately by the operating system. Similarly, overflow *
-* and underflow do not set errno to ERANGE. *
-* *
-* Send bugs to Matthew Self (self@bayes.arc.nasa.gov). *
-* *
-\******************************************************************/
-
-#include <errno.h>
-
-#undef HUGE_VAL
-#define HUGE_VAL \
-({ \
- double huge_val; \
- \
- __asm ("fmove%.d %#0x7ff0000000000000,%0" /* Infinity */ \
- : "=f" (huge_val) \
- : /* no inputs */); \
- huge_val; \
-})
-
-__inline static const double sin (double x)
-{
- double value;
-
- __asm ("fsin%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double cos (double x)
-{
- double value;
-
- __asm ("fcos%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double tan (double x)
-{
- double value;
-
- __asm ("ftan%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double asin (double x)
-{
- double value;
-
- __asm ("fasin%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double acos (double x)
-{
- double value;
-
- __asm ("facos%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double atan (double x)
-{
- double value;
-
- __asm ("fatan%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double atan2 (double y, double x)
-{
- double pi, pi_over_2;
-
- __asm ("fmovecr%.x %#0,%0" /* extended precision pi */
- : "=f" (pi)
- : /* no inputs */ );
- __asm ("fscale%.b %#-1,%0" /* no loss of accuracy */
- : "=f" (pi_over_2)
- : "0" (pi));
- if (x > 0)
- {
- if (y > 0)
- {
- if (x > y)
- return atan (y / x);
- else
- return pi_over_2 - atan (x / y);
- }
- else
- {
- if (x > -y)
- return atan (y / x);
- else
- return - pi_over_2 - atan (x / y);
- }
- }
- else
- {
- if (y > 0)
- {
- if (-x > y)
- return pi + atan (y / x);
- else
- return pi_over_2 - atan (x / y);
- }
- else
- {
- if (-x > -y)
- return - pi + atan (y / x);
- else if (y < 0)
- return - pi_over_2 - atan (x / y);
- else
- {
- double value;
-
- errno = EDOM;
- __asm ("fmove%.d %#0x7fffffffffffffff,%0" /* quiet NaN */
- : "=f" (value)
- : /* no inputs */);
- return value;
- }
- }
- }
-}
-
-__inline static const double sinh (double x)
-{
- double value;
-
- __asm ("fsinh%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double cosh (double x)
-{
- double value;
-
- __asm ("fcosh%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double tanh (double x)
-{
- double value;
-
- __asm ("ftanh%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double atanh (double x)
-{
- double value;
-
- __asm ("fatanh%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double exp (double x)
-{
- double value;
-
- __asm ("fetox%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double expm1 (double x)
-{
- double value;
-
- __asm ("fetoxm1%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double log (double x)
-{
- double value;
-
- __asm ("flogn%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double log1p (double x)
-{
- double value;
-
- __asm ("flognp1%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double log10 (double x)
-{
- double value;
-
- __asm ("flog10%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double sqrt (double x)
-{
- double value;
-
- __asm ("fsqrt%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double pow (const double x, const double y)
-{
- if (x > 0)
- return exp (y * log (x));
- else if (x == 0)
- {
- if (y > 0)
- return 0.0;
- else
- {
- double value;
-
- errno = EDOM;
- __asm ("fmove%.d %#0x7fffffffffffffff,%0" /* quiet NaN */
- : "=f" (value)
- : /* no inputs */);
- return value;
- }
- }
- else
- {
- double temp;
-
- __asm ("fintrz%.x %1,%0"
- : "=f" (temp) /* integer-valued float */
- : "f" (y));
- if (y == temp)
- {
- int i = (int) y;
-
- if (i & 1 == 0) /* even */
- return exp (y * log (x));
- else
- return - exp (y * log (x));
- }
- else
- {
- double value;
-
- errno = EDOM;
- __asm ("fmove%.d %#0x7fffffffffffffff,%0" /* quiet NaN */
- : "=f" (value)
- : /* no inputs */);
- return value;
- }
- }
-}
-
-__inline static const double fabs (double x)
-{
- double value;
-
- __asm ("fabs%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline static const double ceil (double x)
-{
- int rounding_mode, round_up;
- double value;
-
- __asm volatile ("fmove%.l %%fpcr,%0"
- : "=dm" (rounding_mode)
- : /* no inputs */ );
- round_up = rounding_mode | 0x30;
- __asm volatile ("fmove%.l %0,%%fpcr"
- : /* no outputs */
- : "dmi" (round_up));
- __asm volatile ("fint%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- __asm volatile ("fmove%.l %0,%%fpcr"
- : /* no outputs */
- : "dmi" (rounding_mode));
- return value;
-}
-
-__inline static const double floor (double x)
-{
- int rounding_mode, round_down;
- double value;
-
- __asm volatile ("fmove%.l %%fpcr,%0"
- : "=dm" (rounding_mode)
- : /* no inputs */ );
- round_down = (rounding_mode & ~0x10)
- | 0x20;
- __asm volatile ("fmove%.l %0,%%fpcr"
- : /* no outputs */
- : "dmi" (round_down));
- __asm volatile ("fint%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- __asm volatile ("fmove%.l %0,%%fpcr"
- : /* no outputs */
- : "dmi" (rounding_mode));
- return value;
-}
-
-__inline static const double rint (double x)
-{
- int rounding_mode, round_nearest;
- double value;
-
- __asm volatile ("fmove%.l %%fpcr,%0"
- : "=dm" (rounding_mode)
- : /* no inputs */ );
- round_nearest = rounding_mode & ~0x30;
- __asm volatile ("fmove%.l %0,%%fpcr"
- : /* no outputs */
- : "dmi" (round_nearest));
- __asm volatile ("fint%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- __asm volatile ("fmove%.l %0,%%fpcr"
- : /* no outputs */
- : "dmi" (rounding_mode));
- return value;
-}
-
-__inline static const double fmod (double x, double y)
-{
- double value;
-
- __asm ("fmod%.x %2,%0"
- : "=f" (value)
- : "0" (x),
- "f" (y));
- return value;
-}
-
-__inline static const double drem (double x, double y)
-{
- double value;
-
- __asm ("frem%.x %2,%0"
- : "=f" (value)
- : "0" (x),
- "f" (y));
- return value;
-}
-
-__inline static const double scalb (double x, int n)
-{
- double value;
-
- __asm ("fscale%.l %2,%0"
- : "=f" (value)
- : "0" (x),
- "dmi" (n));
- return value;
-}
-
-__inline static double logb (double x)
-{
- double exponent;
-
- __asm ("fgetexp%.x %1,%0"
- : "=f" (exponent)
- : "f" (x));
- return exponent;
-}
-
-__inline static const double ldexp (double x, int n)
-{
- double value;
-
- __asm ("fscale%.l %2,%0"
- : "=f" (value)
- : "0" (x),
- "dmi" (n));
- return value;
-}
-
-__inline static double frexp (double x, int *exp)
-{
- double float_exponent;
- int int_exponent;
- double mantissa;
-
- __asm ("fgetexp%.x %1,%0"
- : "=f" (float_exponent) /* integer-valued float */
- : "f" (x));
- int_exponent = (int) float_exponent;
- __asm ("fgetman%.x %1,%0"
- : "=f" (mantissa) /* 1.0 <= mantissa < 2.0 */
- : "f" (x));
- if (mantissa != 0)
- {
- __asm ("fscale%.b %#-1,%0"
- : "=f" (mantissa) /* mantissa /= 2.0 */
- : "0" (mantissa));
- int_exponent += 1;
- }
- *exp = int_exponent;
- return mantissa;
-}
-
-__inline static double modf (double x, double *ip)
-{
- double temp;
-
- __asm ("fintrz%.x %1,%0"
- : "=f" (temp) /* integer-valued float */
- : "f" (x));
- *ip = temp;
- return x - temp;
-}
-
diff --git a/gcc/ginclude/math-68881.h b/gcc/ginclude/math-68881.h
deleted file mode 100644
index 7b91bc56a5d..00000000000
--- a/gcc/ginclude/math-68881.h
+++ /dev/null
@@ -1,529 +0,0 @@
-/******************************************************************\
-* *
-* <math-68881.h> last modified: 23 May 1992. *
-* *
-* Copyright (C) 1989 by Matthew Self. *
-* You may freely distribute verbatim copies of this software *
-* provided that this copyright notice is retained in all copies. *
-* You may distribute modifications to this software under the *
-* conditions above if you also clearly note such modifications *
-* with their author and date. *
-* *
-* Note: errno is not set to EDOM when domain errors occur for *
-* most of these functions. Rather, it is assumed that the *
-* 68881's OPERR exception will be enabled and handled *
-* appropriately by the operating system. Similarly, overflow *
-* and underflow do not set errno to ERANGE. *
-* *
-* Send bugs to Matthew Self (self@bayes.arc.nasa.gov). *
-* *
-\******************************************************************/
-
-/* This file is NOT a part of GCC, just distributed with it. */
-
-/* If you find this in GCC,
- please send bug reports to bug-gcc@prep.ai.mit.edu. */
-
-/* Changed by Richard Stallman:
- May 1993, add conditional to prevent multiple inclusion.
- % inserted before a #.
- New function `hypot' added.
- Nans written in hex to avoid 0rnan.
- May 1992, use %! for fpcr register. Break lines before function names.
- December 1989, add parens around `&' in pow.
- November 1990, added alternate definition of HUGE_VAL for Sun. */
-
-/* Changed by Jim Wilson:
- September 1993, Use #undef before HUGE_VAL instead of #ifdef/#endif. */
-
-/* Changed by Ian Lance Taylor:
- September 1994, use extern inline instead of static inline. */
-
-#ifndef __math_68881
-#define __math_68881
-
-#include <errno.h>
-
-#undef HUGE_VAL
-#ifdef __sun__
-/* The Sun assembler fails to handle the hex constant in the usual defn. */
-#define HUGE_VAL \
-({ \
- static union { int i[2]; double d; } u = { {0x7ff00000, 0} }; \
- u.d; \
-})
-#else
-#define HUGE_VAL \
-({ \
- double huge_val; \
- \
- __asm ("fmove%.d %#0x7ff0000000000000,%0" /* Infinity */ \
- : "=f" (huge_val) \
- : /* no inputs */); \
- huge_val; \
-})
-#endif
-
-__inline extern double
-sin (double x)
-{
- double value;
-
- __asm ("fsin%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-cos (double x)
-{
- double value;
-
- __asm ("fcos%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-tan (double x)
-{
- double value;
-
- __asm ("ftan%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-asin (double x)
-{
- double value;
-
- __asm ("fasin%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-acos (double x)
-{
- double value;
-
- __asm ("facos%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-atan (double x)
-{
- double value;
-
- __asm ("fatan%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-atan2 (double y, double x)
-{
- double pi, pi_over_2;
-
- __asm ("fmovecr%.x %#0,%0" /* extended precision pi */
- : "=f" (pi)
- : /* no inputs */ );
- __asm ("fscale%.b %#-1,%0" /* no loss of accuracy */
- : "=f" (pi_over_2)
- : "0" (pi));
- if (x > 0)
- {
- if (y > 0)
- {
- if (x > y)
- return atan (y / x);
- else
- return pi_over_2 - atan (x / y);
- }
- else
- {
- if (x > -y)
- return atan (y / x);
- else
- return - pi_over_2 - atan (x / y);
- }
- }
- else
- {
- if (y < 0)
- {
- if (-x > -y)
- return - pi + atan (y / x);
- else
- return - pi_over_2 - atan (x / y);
- }
- else
- {
- if (-x > y)
- return pi + atan (y / x);
- else if (y > 0)
- return pi_over_2 - atan (x / y);
- else
- {
- double value;
-
- errno = EDOM;
- __asm ("fmove%.d %#0x7fffffffffffffff,%0" /* quiet NaN */
- : "=f" (value)
- : /* no inputs */);
- return value;
- }
- }
- }
-}
-
-__inline extern double
-sinh (double x)
-{
- double value;
-
- __asm ("fsinh%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-cosh (double x)
-{
- double value;
-
- __asm ("fcosh%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-tanh (double x)
-{
- double value;
-
- __asm ("ftanh%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-atanh (double x)
-{
- double value;
-
- __asm ("fatanh%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-exp (double x)
-{
- double value;
-
- __asm ("fetox%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-expm1 (double x)
-{
- double value;
-
- __asm ("fetoxm1%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-log (double x)
-{
- double value;
-
- __asm ("flogn%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-log1p (double x)
-{
- double value;
-
- __asm ("flognp1%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-log10 (double x)
-{
- double value;
-
- __asm ("flog10%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-sqrt (double x)
-{
- double value;
-
- __asm ("fsqrt%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-hypot (double x, double y)
-{
- return sqrt (x*x + y*y);
-}
-
-__inline extern double
-pow (double x, double y)
-{
- if (x > 0)
- return exp (y * log (x));
- else if (x == 0)
- {
- if (y > 0)
- return 0.0;
- else
- {
- double value;
-
- errno = EDOM;
- __asm ("fmove%.d %#0x7fffffffffffffff,%0" /* quiet NaN */
- : "=f" (value)
- : /* no inputs */);
- return value;
- }
- }
- else
- {
- double temp;
-
- __asm ("fintrz%.x %1,%0"
- : "=f" (temp) /* integer-valued float */
- : "f" (y));
- if (y == temp)
- {
- int i = (int) y;
-
- if ((i & 1) == 0) /* even */
- return exp (y * log (-x));
- else
- return - exp (y * log (-x));
- }
- else
- {
- double value;
-
- errno = EDOM;
- __asm ("fmove%.d %#0x7fffffffffffffff,%0" /* quiet NaN */
- : "=f" (value)
- : /* no inputs */);
- return value;
- }
- }
-}
-
-__inline extern double
-fabs (double x)
-{
- double value;
-
- __asm ("fabs%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- return value;
-}
-
-__inline extern double
-ceil (double x)
-{
- int rounding_mode, round_up;
- double value;
-
- __asm volatile ("fmove%.l %!,%0"
- : "=dm" (rounding_mode)
- : /* no inputs */ );
- round_up = rounding_mode | 0x30;
- __asm volatile ("fmove%.l %0,%!"
- : /* no outputs */
- : "dmi" (round_up));
- __asm volatile ("fint%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- __asm volatile ("fmove%.l %0,%!"
- : /* no outputs */
- : "dmi" (rounding_mode));
- return value;
-}
-
-__inline extern double
-floor (double x)
-{
- int rounding_mode, round_down;
- double value;
-
- __asm volatile ("fmove%.l %!,%0"
- : "=dm" (rounding_mode)
- : /* no inputs */ );
- round_down = (rounding_mode & ~0x10)
- | 0x20;
- __asm volatile ("fmove%.l %0,%!"
- : /* no outputs */
- : "dmi" (round_down));
- __asm volatile ("fint%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- __asm volatile ("fmove%.l %0,%!"
- : /* no outputs */
- : "dmi" (rounding_mode));
- return value;
-}
-
-__inline extern double
-rint (double x)
-{
- int rounding_mode, round_nearest;
- double value;
-
- __asm volatile ("fmove%.l %!,%0"
- : "=dm" (rounding_mode)
- : /* no inputs */ );
- round_nearest = rounding_mode & ~0x30;
- __asm volatile ("fmove%.l %0,%!"
- : /* no outputs */
- : "dmi" (round_nearest));
- __asm volatile ("fint%.x %1,%0"
- : "=f" (value)
- : "f" (x));
- __asm volatile ("fmove%.l %0,%!"
- : /* no outputs */
- : "dmi" (rounding_mode));
- return value;
-}
-
-__inline extern double
-fmod (double x, double y)
-{
- double value;
-
- __asm ("fmod%.x %2,%0"
- : "=f" (value)
- : "0" (x),
- "f" (y));
- return value;
-}
-
-__inline extern double
-drem (double x, double y)
-{
- double value;
-
- __asm ("frem%.x %2,%0"
- : "=f" (value)
- : "0" (x),
- "f" (y));
- return value;
-}
-
-__inline extern double
-scalb (double x, int n)
-{
- double value;
-
- __asm ("fscale%.l %2,%0"
- : "=f" (value)
- : "0" (x),
- "dmi" (n));
- return value;
-}
-
-__inline extern double
-logb (double x)
-{
- double exponent;
-
- __asm ("fgetexp%.x %1,%0"
- : "=f" (exponent)
- : "f" (x));
- return exponent;
-}
-
-__inline extern double
-ldexp (double x, int n)
-{
- double value;
-
- __asm ("fscale%.l %2,%0"
- : "=f" (value)
- : "0" (x),
- "dmi" (n));
- return value;
-}
-
-__inline extern double
-frexp (double x, int *exp)
-{
- double float_exponent;
- int int_exponent;
- double mantissa;
-
- __asm ("fgetexp%.x %1,%0"
- : "=f" (float_exponent) /* integer-valued float */
- : "f" (x));
- int_exponent = (int) float_exponent;
- __asm ("fgetman%.x %1,%0"
- : "=f" (mantissa) /* 1.0 <= mantissa < 2.0 */
- : "f" (x));
- if (mantissa != 0)
- {
- __asm ("fscale%.b %#-1,%0"
- : "=f" (mantissa) /* mantissa /= 2.0 */
- : "0" (mantissa));
- int_exponent += 1;
- }
- *exp = int_exponent;
- return mantissa;
-}
-
-__inline extern double
-modf (double x, double *ip)
-{
- double temp;
-
- __asm ("fintrz%.x %1,%0"
- : "=f" (temp) /* integer-valued float */
- : "f" (x));
- *ip = temp;
- return x - temp;
-}
-
-#endif /* not __math_68881 */
diff --git a/gcc/ginclude/ppc-asm.h b/gcc/ginclude/ppc-asm.h
deleted file mode 100644
index 9e830dcc6eb..00000000000
--- a/gcc/ginclude/ppc-asm.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* PowerPC asm definitions for GNU C. */
-/* Under winnt, 1) gas suppports the following as names and 2) in particular
- defining "toc" breaks the FUNC_START macro as ".toc" becomes ".2" */
-
-#if !defined(__WINNT__)
-#define r0 0
-#define sp 1
-#define toc 2
-#define r3 3
-#define r4 4
-#define r5 5
-#define r6 6
-#define r7 7
-#define r8 8
-#define r9 9
-#define r10 10
-#define r11 11
-#define r12 12
-#define r13 13
-#define r14 14
-#define r15 15
-#define r16 16
-#define r17 17
-#define r18 18
-#define r19 19
-#define r20 20
-#define r21 21
-#define r22 22
-#define r23 23
-#define r24 24
-#define r25 25
-#define r26 26
-#define r27 27
-#define r28 28
-#define r29 29
-#define r30 30
-#define r31 31
-
-#define cr0 0
-#define cr1 1
-#define cr2 2
-#define cr3 3
-#define cr4 4
-#define cr5 5
-#define cr6 6
-#define cr7 7
-
-#define f0 0
-#define f1 1
-#define f2 2
-#define f3 3
-#define f4 4
-#define f5 5
-#define f6 6
-#define f7 7
-#define f8 8
-#define f9 9
-#define f10 10
-#define f11 11
-#define f12 12
-#define f13 13
-#define f14 14
-#define f15 15
-#define f16 16
-#define f17 17
-#define f18 18
-#define f19 19
-#define f20 20
-#define f21 21
-#define f22 22
-#define f23 23
-#define f24 24
-#define f25 25
-#define f26 26
-#define f27 27
-#define f28 28
-#define f29 29
-#define f30 30
-#define f31 31
-#endif
-
-/*
- * Macros to glue together two tokens.
- */
-
-#ifdef __STDC__
-#define XGLUE(a,b) a##b
-#else
-#define XGLUE(a,b) a/**/b
-#endif
-
-#define GLUE(a,b) XGLUE(a,b)
-
-/*
- * Macros to begin and end a function written in assembler. If -mcall-aixdesc
- * or -mcall-nt, create a function descriptor with the given name, and create
- * the real function with one or two leading periods respectively.
- */
-
-#ifdef _RELOCATABLE
-#define DESC_SECTION ".got2"
-#else
-#define DESC_SECTION ".got1"
-#endif
-
-#if defined(_CALL_AIXDESC)
-#define FUNC_NAME(name) GLUE(.,name)
-#define FUNC_START(name) \
- .section DESC_SECTION,"aw"; \
-name: \
- .long GLUE(.,name); \
- .long _GLOBAL_OFFSET_TABLE_; \
- .long 0; \
- .previous; \
- .type GLUE(.,name),@function; \
- .globl name; \
- .globl GLUE(.,name); \
-GLUE(.,name):
-
-#define FUNC_END(name) \
-GLUE(.L,name): \
- .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name)
-
-#elif defined(__WINNT__)
-#define FUNC_NAME(name) GLUE(..,name)
-#define FUNC_START(name) \
- .pdata; \
- .align 2; \
- .ualong GLUE(..,name),GLUE(name,.e),0,0,GLUE(..,name); \
- .reldata; \
-name: \
- .ualong GLUE(..,name),.toc; \
- .section .text; \
- .globl name; \
- .globl GLUE(..,name); \
-GLUE(..,name):
-
-#define FUNC_END(name) \
-GLUE(name,.e): ; \
-GLUE(FE_MOT_RESVD..,name):
-
-#elif defined(_CALL_NT)
-#define FUNC_NAME(name) GLUE(..,name)
-#define FUNC_START(name) \
- .section DESC_SECTION,"aw"; \
-name: \
- .long GLUE(..,name); \
- .long _GLOBAL_OFFSET_TABLE_; \
- .previous; \
- .type GLUE(..,name),@function; \
- .globl name; \
- .globl GLUE(..,name); \
-GLUE(..,name):
-
-#define FUNC_END(name) \
-GLUE(.L,name): \
- .size GLUE(..,name),GLUE(.L,name)-GLUE(..,name)
-
-#else
-#define FUNC_NAME(name) name
-#define FUNC_START(name) \
- .type name,@function; \
- .globl name; \
-name:
-
-#define FUNC_END(name) \
-GLUE(.L,name): \
- .size name,GLUE(.L,name)-name
-#endif
-
diff --git a/gcc/ginclude/proto.h b/gcc/ginclude/proto.h
deleted file mode 100644
index cc48915d842..00000000000
--- a/gcc/ginclude/proto.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* This header file is to avoid trouble with semi-ANSI header files
- on the Convex in system version 8.0. */
-
-#define _PROTO(list) ()
diff --git a/gcc/ginclude/stdarg.h b/gcc/ginclude/stdarg.h
deleted file mode 100644
index adb22fb9ee5..00000000000
--- a/gcc/ginclude/stdarg.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/* stdarg.h for GNU.
- Note that the type used in va_arg is supposed to match the
- actual type **after default promotions**.
- Thus, va_arg (..., short) is not valid. */
-
-#ifndef _STDARG_H
-#ifndef _ANSI_STDARG_H_
-#ifndef __need___va_list
-#define _STDARG_H
-#define _ANSI_STDARG_H_
-#endif /* not __need___va_list */
-#undef __need___va_list
-
-#ifdef __clipper__
-#include "va-clipper.h"
-#else
-#ifdef __m88k__
-#include "va-m88k.h"
-#else
-#ifdef __i860__
-#include "va-i860.h"
-#else
-#ifdef __hppa__
-#include "va-pa.h"
-#else
-#ifdef __mips__
-#include "va-mips.h"
-#else
-#ifdef __sparc__
-#include "va-sparc.h"
-#else
-#ifdef __i960__
-#include "va-i960.h"
-#else
-#ifdef __alpha__
-#include "va-alpha.h"
-#else
-#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
-#include "va-h8300.h"
-#else
-#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
-#include "va-ppc.h"
-#else
-#ifdef __M32R__
-#include "va-m32r.h"
-#else
-#ifdef __sh__
-#include "va-sh.h"
-#else
-#ifdef __mn10300__
-#include "va-mn10300.h"
-#else
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
-typedef char *__gnuc_va_list;
-#else
-typedef void *__gnuc_va_list;
-#endif
-#endif
-
-/* Define the standard macros for the user,
- if this invocation was from the user program. */
-#ifdef _STDARG_H
-
-/* Amount of space required in an argument list for an arg of type TYPE.
- TYPE may alternatively be an expression whose type is used. */
-
-#if defined(sysV68)
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
-#else
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-#endif
-
-#define va_start(AP, LASTARG) \
- (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
-
-#undef va_end
-void va_end (__gnuc_va_list); /* Defined in libgcc.a */
-#define va_end(AP) ((void)0)
-
-/* We cast to void * and then to TYPE * because this avoids
- a warning about increasing the alignment requirement. */
-
-#if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
-/* This is for little-endian machines; small args are padded upward. */
-#define va_arg(AP, TYPE) \
- (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
- *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
-#else /* big-endian */
-/* This is for big-endian machines; small args are padded downward. */
-#define va_arg(AP, TYPE) \
- (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
- *((TYPE *) (void *) ((char *) (AP) \
- - ((sizeof (TYPE) < __va_rounded_size (char) \
- ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
-#endif /* big-endian */
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* _STDARG_H */
-
-#endif /* not mn10300 */
-#endif /* not sh */
-#endif /* not m32r */
-#endif /* not powerpc with V.4 calling sequence */
-#endif /* not h8300 */
-#endif /* not alpha */
-#endif /* not i960 */
-#endif /* not sparc */
-#endif /* not mips */
-#endif /* not hppa */
-#endif /* not i860 */
-#endif /* not m88k */
-#endif /* not clipper */
-
-#ifdef _STDARG_H
-/* Define va_list, if desired, from __gnuc_va_list. */
-/* We deliberately do not define va_list when called from
- stdio.h, because ANSI C says that stdio.h is not supposed to define
- va_list. stdio.h needs to have access to that data type,
- but must not use that name. It should use the name __gnuc_va_list,
- which is safe because it is reserved for the implementation. */
-
-#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
-#undef _VA_LIST
-#endif
-
-#ifdef _BSD_VA_LIST
-#undef _BSD_VA_LIST
-#endif
-
-#if defined(__svr4__) || defined(_SCO_DS)
-/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
- so we must avoid testing it and setting it here.
- SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
- have no conflict with that. */
-#ifndef _VA_LIST_
-#define _VA_LIST_
-#ifdef __i860__
-#ifndef _VA_LIST
-#define _VA_LIST va_list
-#endif
-#endif /* __i860__ */
-typedef __gnuc_va_list va_list;
-#endif /* _VA_LIST_ */
-#else /* not __svr4__ || _SCO_DS */
-
-/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
- But on BSD NET2 we must not test or define or undef it.
- (Note that the comments in NET 2's ansi.h
- are incorrect for _VA_LIST_--see stdio.h!) */
-#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
-/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
-#ifndef _VA_LIST_DEFINED
-/* The macro _VA_LIST is used in SCO Unix 3.2. */
-#ifndef _VA_LIST
-/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
-#ifndef _VA_LIST_T_H
-typedef __gnuc_va_list va_list;
-#endif /* not _VA_LIST_T_H */
-#endif /* not _VA_LIST */
-#endif /* not _VA_LIST_DEFINED */
-#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
-#define _VA_LIST_
-#endif
-#ifndef _VA_LIST
-#define _VA_LIST
-#endif
-#ifndef _VA_LIST_DEFINED
-#define _VA_LIST_DEFINED
-#endif
-#ifndef _VA_LIST_T_H
-#define _VA_LIST_T_H
-#endif
-
-#endif /* not _VA_LIST_, except on certain systems */
-
-#endif /* not __svr4__ */
-
-#endif /* _STDARG_H */
-
-#endif /* not _ANSI_STDARG_H_ */
-#endif /* not _STDARG_H */
diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
deleted file mode 100644
index 23d8455c649..00000000000
--- a/gcc/ginclude/stddef.h
+++ /dev/null
@@ -1,327 +0,0 @@
-#if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \
- && !defined(__STDDEF_H__)) \
- || defined(__need_wchar_t) || defined(__need_size_t) \
- || defined(__need_ptrdiff_t) || defined(__need_NULL) \
- || defined(__need_wint_t)
-
-/* Any one of these symbols __need_* means that GNU libc
- wants us just to define one data type. So don't define
- the symbols that indicate this file's entire job has been done. */
-#if (!defined(__need_wchar_t) && !defined(__need_size_t) \
- && !defined(__need_ptrdiff_t) && !defined(__need_NULL) \
- && !defined(__need_wint_t))
-#define _STDDEF_H
-#define _STDDEF_H_
-/* snaroff@next.com says the NeXT needs this. */
-#define _ANSI_STDDEF_H
-/* Irix 5.1 needs this. */
-#define __STDDEF_H__
-#endif
-
-#ifndef __sys_stdtypes_h
-/* This avoids lossage on SunOS but only if stdtypes.h comes first.
- There's no way to win with the other order! Sun lossage. */
-
-/* On 4.3bsd-net2, make sure ansi.h is included, so we have
- one less case to deal with in the following. */
-#if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
-#include <machine/ansi.h>
-#endif
-
-/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
- defined if the corresponding type is *not* defined.
- FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
-#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
-#if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
-#define _SIZE_T
-#endif
-#if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
-#define _PTRDIFF_T
-#endif
-/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
- instead of _WCHAR_T_. */
-#if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
-#ifndef _BSD_WCHAR_T_
-#define _WCHAR_T
-#endif
-#endif
-/* Undef _FOO_T_ if we are supposed to define foo_t. */
-#if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
-#undef _PTRDIFF_T_
-#undef _BSD_PTRDIFF_T_
-#endif
-#if defined (__need_size_t) || defined (_STDDEF_H_)
-#undef _SIZE_T_
-#undef _BSD_SIZE_T_
-#endif
-#if defined (__need_wchar_t) || defined (_STDDEF_H_)
-#undef _WCHAR_T_
-#undef _BSD_WCHAR_T_
-#endif
-#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
-
-/* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
- Just ignore it. */
-#if defined (__sequent__) && defined (_PTRDIFF_T_)
-#undef _PTRDIFF_T_
-#endif
-
-/* On VxWorks, <type/vxTypesBase.h> may have defined macros like
- _TYPE_size_t which will typedef size_t. fixincludes patched the
- vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
- not defined, and so that defining this macro defines _GCC_SIZE_T.
- If we find that the macros are still defined at this point, we must
- invoke them so that the type is defined as expected. */
-#if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
-_TYPE_ptrdiff_t;
-#undef _TYPE_ptrdiff_t
-#endif
-#if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
-_TYPE_size_t;
-#undef _TYPE_size_t
-#endif
-#if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
-_TYPE_wchar_t;
-#undef _TYPE_wchar_t
-#endif
-
-/* In case nobody has defined these types, but we aren't running under
- GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
- __WCHAR_TYPE__ have reasonable values. This can happen if the
- parts of GCC is compiled by an older compiler, that actually
- include gstddef.h, such as collect2. */
-
-/* Signed type of difference of two pointers. */
-
-/* Define this type if we are doing the whole job,
- or if we want this type in particular. */
-#if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
-#ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */
-#ifndef _T_PTRDIFF_
-#ifndef _T_PTRDIFF
-#ifndef __PTRDIFF_T
-#ifndef _PTRDIFF_T_
-#ifndef _BSD_PTRDIFF_T_
-#ifndef ___int_ptrdiff_t_h
-#ifndef _GCC_PTRDIFF_T
-#define _PTRDIFF_T
-#define _T_PTRDIFF_
-#define _T_PTRDIFF
-#define __PTRDIFF_T
-#define _PTRDIFF_T_
-#define _BSD_PTRDIFF_T_
-#define ___int_ptrdiff_t_h
-#define _GCC_PTRDIFF_T
-#ifndef __PTRDIFF_TYPE__
-#define __PTRDIFF_TYPE__ long int
-#endif
-typedef __PTRDIFF_TYPE__ ptrdiff_t;
-#endif /* _GCC_PTRDIFF_T */
-#endif /* ___int_ptrdiff_t_h */
-#endif /* _BSD_PTRDIFF_T_ */
-#endif /* _PTRDIFF_T_ */
-#endif /* __PTRDIFF_T */
-#endif /* _T_PTRDIFF */
-#endif /* _T_PTRDIFF_ */
-#endif /* _PTRDIFF_T */
-
-/* If this symbol has done its job, get rid of it. */
-#undef __need_ptrdiff_t
-
-#endif /* _STDDEF_H or __need_ptrdiff_t. */
-
-/* Unsigned type of `sizeof' something. */
-
-/* Define this type if we are doing the whole job,
- or if we want this type in particular. */
-#if defined (_STDDEF_H) || defined (__need_size_t)
-#ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
-#ifndef _SYS_SIZE_T_H
-#ifndef _T_SIZE_
-#ifndef _T_SIZE
-#ifndef __SIZE_T
-#ifndef _SIZE_T_
-#ifndef _BSD_SIZE_T_
-#ifndef _SIZE_T_DEFINED_
-#ifndef _SIZE_T_DEFINED
-#ifndef ___int_size_t_h
-#ifndef _GCC_SIZE_T
-#ifndef _SIZET_
-#ifndef __size_t
-#define _SIZE_T
-#define _SYS_SIZE_T_H
-#define _T_SIZE_
-#define _T_SIZE
-#define __SIZE_T
-#define _SIZE_T_
-#define _BSD_SIZE_T_
-#define _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED
-#define ___int_size_t_h
-#define _GCC_SIZE_T
-#define _SIZET_
-#define __size_t
-#ifndef __SIZE_TYPE__
-#define __SIZE_TYPE__ long unsigned int
-#endif
-#if !(defined (__GNUG__) && defined (size_t))
-typedef __SIZE_TYPE__ size_t;
-#endif /* !(defined (__GNUG__) && defined (size_t)) */
-#endif /* __size_t */
-#endif /* _SIZET_ */
-#endif /* _GCC_SIZE_T */
-#endif /* ___int_size_t_h */
-#endif /* _SIZE_T_DEFINED */
-#endif /* _SIZE_T_DEFINED_ */
-#endif /* _BSD_SIZE_T_ */
-#endif /* _SIZE_T_ */
-#endif /* __SIZE_T */
-#endif /* _T_SIZE */
-#endif /* _T_SIZE_ */
-#endif /* _SYS_SIZE_T_H */
-#endif /* _SIZE_T */
-#undef __need_size_t
-#endif /* _STDDEF_H or __need_size_t. */
-
-
-/* Wide character type.
- Locale-writers should change this as necessary to
- be big enough to hold unique values not between 0 and 127,
- and not (wchar_t) -1, for each defined multibyte character. */
-
-/* Define this type if we are doing the whole job,
- or if we want this type in particular. */
-#if defined (_STDDEF_H) || defined (__need_wchar_t)
-#ifndef _WCHAR_T
-#ifndef _T_WCHAR_
-#ifndef _T_WCHAR
-#ifndef __WCHAR_T
-#ifndef _WCHAR_T_
-#ifndef _BSD_WCHAR_T_
-#ifndef _WCHAR_T_DEFINED_
-#ifndef _WCHAR_T_DEFINED
-#ifndef _WCHAR_T_H
-#ifndef ___int_wchar_t_h
-#ifndef __INT_WCHAR_T_H
-#ifndef _GCC_WCHAR_T
-#define _WCHAR_T
-#define _T_WCHAR_
-#define _T_WCHAR
-#define __WCHAR_T
-#define _WCHAR_T_
-#define _BSD_WCHAR_T_
-#define _WCHAR_T_DEFINED_
-#define _WCHAR_T_DEFINED
-#define _WCHAR_T_H
-#define ___int_wchar_t_h
-#define __INT_WCHAR_T_H
-#define _GCC_WCHAR_T
-
-/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
- instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
- symbols in the _FOO_T_ family, stays defined even after its
- corresponding type is defined). If we define wchar_t, then we
- must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
- we undef _WCHAR_T_, then we must also define rune_t, since
- headers like runetype.h assume that if machine/ansi.h is included,
- and _BSD_WCHAR_T_ is not defined, then rune_t is available.
- machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
- the same type." */
-#ifdef _BSD_WCHAR_T_
-#undef _BSD_WCHAR_T_
-#ifdef _BSD_RUNE_T_
-#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
-typedef _BSD_RUNE_T_ rune_t;
-#endif
-#endif
-#endif
-
-#ifndef __WCHAR_TYPE__
-#define __WCHAR_TYPE__ int
-#endif
-#ifndef __cplusplus
-typedef __WCHAR_TYPE__ wchar_t;
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-#undef __need_wchar_t
-#endif /* _STDDEF_H or __need_wchar_t. */
-
-#if defined (_STDDEF_H) || defined (__need_wint_t)
-#ifndef _WINT_T
-#define _WINT_T
-
-#ifndef __WINT_TYPE__
-#define __WINT_TYPE__ unsigned int
-#endif
-typedef __WINT_TYPE__ wint_t;
-#endif
-#undef __need_wint_t
-#endif
-
-/* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
- are already defined. */
-#ifdef _ANSI_H_
-/* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
- are probably typos and should be removed before 2.8 is released. */
-#ifdef _GCC_PTRDIFF_T_
-#undef _PTRDIFF_T_
-#undef _BSD_PTRDIFF_T_
-#endif
-#ifdef _GCC_SIZE_T_
-#undef _SIZE_T_
-#undef _BSD_SIZE_T_
-#endif
-#ifdef _GCC_WCHAR_T_
-#undef _WCHAR_T_
-#undef _BSD_WCHAR_T_
-#endif
-/* The following ones are the real ones. */
-#ifdef _GCC_PTRDIFF_T
-#undef _PTRDIFF_T_
-#undef _BSD_PTRDIFF_T_
-#endif
-#ifdef _GCC_SIZE_T
-#undef _SIZE_T_
-#undef _BSD_SIZE_T_
-#endif
-#ifdef _GCC_WCHAR_T
-#undef _WCHAR_T_
-#undef _BSD_WCHAR_T_
-#endif
-#endif /* _ANSI_H_ */
-
-#endif /* __sys_stdtypes_h */
-
-/* A null pointer constant. */
-
-#if defined (_STDDEF_H) || defined (__need_NULL)
-#undef NULL /* in case <stdio.h> has defined it. */
-#ifdef __GNUG__
-#define NULL __null
-#else /* G++ */
-#define NULL ((void *)0)
-#endif /* G++ */
-#endif /* NULL not defined and <stddef.h> or need NULL. */
-#undef __need_NULL
-
-#ifdef _STDDEF_H
-
-/* Offset of member MEMBER in a struct of type TYPE. */
-
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-
-#endif /* _STDDEF_H was defined this time */
-
-#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
- || __need_XXX was not defined before */
diff --git a/gcc/ginclude/va-alpha.h b/gcc/ginclude/va-alpha.h
deleted file mode 100644
index 2a4ba60b532..00000000000
--- a/gcc/ginclude/va-alpha.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* GNU C varargs and stdargs support for the DEC Alpha. */
-
-/* Note: We must use the name __builtin_savregs. GCC attaches special
- significance to that name. In particular, regardless of where in a
- function __builtin_saveregs is called, GCC moves the call up to the
- very start of the function. */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-
-
-/* In VMS, __gnuc_va_list is simply char *; on OSF, it's a structure. */
-
-#ifdef __VMS__
-typedef char *__gnuc_va_list;
-#else
-
-typedef struct {
- char *__base; /* Pointer to first integer register. */
- int __offset; /* Byte offset of args so far. */
-} __gnuc_va_list;
-#endif
-
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-#define va_list __gnuc_va_list
-#define _VA_LIST
-#define _VA_LIST_
-
-#if !defined(_STDARG_H)
-
-/* varargs support */
-#define va_alist __builtin_va_alist
-#define va_dcl int __builtin_va_alist;...
-#ifdef __VMS__
-#define va_start(pvar) ((pvar) = __builtin_saveregs ())
-#else
-#define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ())
-#endif
-
-#else /* STDARG.H */
-
-/* ANSI alternative. */
-
-/* Call __builtin_next_arg even though we aren't using its value, so that
- we can verify that firstarg is correct. */
-
-#ifdef __VMS__
-#define va_start(pvar, firstarg) \
- (__builtin_next_arg (firstarg), \
- (pvar) = __builtin_saveregs ())
-#else
-#define va_start(pvar, firstarg) \
- (__builtin_next_arg (firstarg), \
- (pvar) = *(__gnuc_va_list *) __builtin_saveregs ())
-#endif
-
-#endif /* _STDARG_H */
-
-#ifndef va_end
-
-#define va_end(__va) ((void) 0)
-
-/* Values returned by __builtin_classify_type. */
-
-enum {
- __no_type_class = -1,
- __void_type_class,
- __integer_type_class,
- __char_type_class,
- __enumeral_type_class,
- __boolean_type_class,
- __pointer_type_class,
- __reference_type_class,
- __offset_type_class,
- __real_type_class,
- __complex_type_class,
- __function_type_class,
- __method_type_class,
- __record_type_class,
- __union_type_class,
- __array_type_class,
- __string_type_class,
- __set_type_class,
- __file_type_class,
- __lang_type_class
-};
-
-#endif
-
-/* Note that parameters are always aligned at least to a word boundary
- (when passed) regardless of what GCC's __alignof__ operator says. */
-
-/* Avoid errors if compiling GCC v2 with GCC v1. */
-#if __GNUC__ == 1
-#define __extension__
-#endif
-
-/* Get the size of a type in bytes, rounded up to an integral number
- of words. */
-
-#define __va_tsize(__type) \
- (((sizeof (__type) + __extension__ sizeof (long long) - 1) \
- / __extension__ sizeof (long long)) * __extension__ sizeof (long long))
-
-#ifdef __VMS__
-#define va_arg(__va, __type) \
-(*(((__va) += __va_tsize (__type)), \
- (__type *)(void *)((__va) - __va_tsize (__type))))
-
-#else
-
-#define va_arg(__va, __type) \
-(*(((__va).__offset += __va_tsize (__type)), \
- (__type *)(void *)((__va).__base + (__va).__offset \
- - (((__builtin_classify_type (* (__type *) 0) \
- == __real_type_class) && (__va).__offset <= (6 * 8)) \
- ? (6 * 8) + 8 : __va_tsize (__type)))))
-#endif
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
-
diff --git a/gcc/ginclude/va-clipper.h b/gcc/ginclude/va-clipper.h
deleted file mode 100644
index 38cc77f9c1a..00000000000
--- a/gcc/ginclude/va-clipper.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* GNU C varargs and stdargs support for Clipper. */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-
-typedef struct
-{
- int __va_ap; /* pointer to stack args */
- void *__va_reg[4]; /* pointer to r0,f0,r1,f1 */
- int __va_num; /* number of args processed */
-} __gnuc_va_list;
-#endif /* not __GNUC_VA_LIST */
-
-
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-#define va_list __gnuc_va_list
-#define __va_list __gnuc_va_list /* acc compatibility */
-
-#define _VA_LIST
-#define _VA_LIST_
-#define _SYS_INT_STDARG_H /* acc compatibility */
-
-/* Call __builtin_next_arg even though we aren't using its value, so that
- we can verify that LASTARG is correct. */
-#ifdef _STDARG_H
-#define va_start(AP,LASTARG) \
- (__builtin_next_arg (LASTARG), \
- (AP) = *(va_list *)__builtin_saveregs(), \
- (AP).__va_num = __builtin_args_info (0), \
- (AP).__va_ap += __builtin_args_info (1))
-#else
-#define va_alist __builtin_va_alist
-/* The ... causes current_function_varargs to be set in cc1. */
-#define va_dcl va_list __builtin_va_alist; ...
-#define va_start(AP) \
- ((AP) = *(va_list *)__builtin_saveregs(), \
- (AP).__va_num = __builtin_args_info (0))
-#endif /* _STDARG_H */
-
-/* round to alignment of `type' but keep a least integer alignment */
-#define __va_round(AP,TYPE) \
- ((AP).__va_ap = ((AP).__va_ap + __alignof__ (TYPE) - 1 ) & \
- ~(__alignof__ (TYPE) - 1), \
- ((AP).__va_ap = ((AP).__va_ap + sizeof (int) - 1) & ~(sizeof (int) - 1)))
-
-#define va_arg(AP, TYPE) \
- (*((AP).__va_num < 2 && __builtin_classify_type (* (TYPE *)0) < 12 \
- ? (__builtin_classify_type (* (TYPE *)0) == 8 \
- ? ((TYPE *)(AP).__va_reg[2 * (AP).__va_num++ + 1]) \
- : ((TYPE *)(AP).__va_reg[2 * (AP).__va_num++ ])) \
- : ((AP).__va_num++, __va_round (AP,TYPE), ((TYPE *)((AP).__va_ap))++)))
-
-#define va_end(AP) ((void) 0)
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
diff --git a/gcc/ginclude/va-h8300.h b/gcc/ginclude/va-h8300.h
deleted file mode 100644
index 9565696e9ad..00000000000
--- a/gcc/ginclude/va-h8300.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* stdarg/vararg support for the Hitachi h8/300 and h8/300h */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-typedef void *__gnuc_va_list;
-#endif
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-/* In GCC version 2, we want an ellipsis at the end of the declaration
- of the argument list. GCC version 1 can't parse it. */
-
-#if __GNUC__ > 1
-#define __va_ellipsis ...
-#else
-#define __va_ellipsis
-#endif
-
-#ifdef __H8300__
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-#else
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
-#endif
-
-#ifdef _STDARG_H
-
-#define va_start(AP,LASTARG) \
- (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
-
-#else /* _VARARGS_H */
-
-#define va_alist __builtin_va_alist
-/* The ... causes current_function_varargs to be set in cc1. */
-#define va_dcl int __builtin_va_alist; __va_ellipsis
-#define va_start(AP) AP = (void *) &__builtin_va_alist
-
-#endif /* _VARARGS_H */
-
-#define va_arg(AP, TYPE) \
- (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
- *((TYPE *) (void *) ((char *) (AP) \
- - ((sizeof (TYPE) < __va_rounded_size (int) \
- ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
-
-#define va_end(AP) ((void) 0)
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
diff --git a/gcc/ginclude/va-i860.h b/gcc/ginclude/va-i860.h
deleted file mode 100644
index 56d2c7fe1d3..00000000000
--- a/gcc/ginclude/va-i860.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Note: We must use the name __builtin_savregs. GCC attaches special
- significance to that name. In particular, regardless of where in a
- function __builtin_saveregs is called, GCC moves the call up to the
- very start of the function. */
-
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-
-typedef union {
- float __freg[8];
- double __dreg[4];
-} __f_regs;
-
-typedef struct {
-#if defined (__SVR4__) || defined (__svr4__) || defined (__alliant__) || defined (__PARAGON__)
- __f_regs __float_regs; long __ireg[12];
-#else /* pre-SVR4 */
- long __ireg[12]; __f_regs __float_regs;
-#endif
-} __va_saved_regs;
-
-typedef struct {
-#if defined(__SVR4__) || defined(__svr4__) || defined(__alliant__) || defined (__PARAGON__)
- unsigned __ireg_used; /* How many int regs consumed 'til now? */
- unsigned __freg_used; /* How many flt regs consumed 'til now? */
- long *__reg_base; /* Address of where we stored the regs. */
- long * __mem_ptr; /* Address of memory overflow args area. */
-#else /* pre-SVR4 */
- long *__reg_base; /* Address of where we stored the regs. */
- long * __mem_ptr; /* Address of memory overflow args area. */
- unsigned __ireg_used; /* How many int regs consumed 'til now? */
- unsigned __freg_used; /* How many flt regs consumed 'til now? */
-#endif
-} __gnuc_va_list;
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-#if !defined(_STDARG_H)
-
-/* varargs support */
-#define va_alist __builtin_va_alist
-#if defined (__PARAGON__)
-#define va_dcl int va_alist;
-#else /* __PARAGON__ */
-#define va_dcl
-#endif /* __PARAGON__ */
-#define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ())
-
-#else /* STDARG.H */
-
-/* ANSI alternative. */
-/* Note that CUMULATIVE_ARGS elements are measured in bytes on the i860,
- so we divide by 4 to get # of registers. */
-#define va_start(pvar, firstarg) \
- ((pvar) = *(__gnuc_va_list *) __builtin_saveregs (), \
- (pvar).__ireg_used = __builtin_args_info (0) / 4, \
- (pvar).__freg_used = __builtin_args_info (1) / 4, \
- (pvar).__mem_ptr = __builtin_next_arg (firstarg))
-
-#endif /* _STDARG_H */
-
-/* Values returned by __builtin_classify_type. */
-
-#ifndef va_end
-enum {
- __no_type_class = -1,
- __void_type_class,
- __integer_type_class,
- __char_type_class,
- __enumeral_type_class,
- __boolean_type_class,
- __pointer_type_class,
- __reference_type_class,
- __offset_type_class,
- __real_type_class,
- __complex_type_class,
- __function_type_class,
- __method_type_class,
- __record_type_class,
- __union_type_class,
- __array_type_class,
- __string_type_class,
- __set_type_class,
- __file_type_class,
- __lang_type_class
-};
-
-void va_end (__gnuc_va_list); /* Defined in libgcc.a */
-#endif
-#define va_end(__va) ((void) 0)
-
-#define __NUM_PARM_FREGS 8
-#define __NUM_PARM_IREGS 12
-
-#define __savereg(__va) ((__va_saved_regs *) ((__va).__reg_base))
-
-/* This macro works both for SVR4 and pre-SVR4 environments. */
-
-/* Note that parameters are always aligned at least to a word boundary
- (when passed) regardless of what GCC's __alignof__ operator says. */
-
-/* Make allowances here for adding 128-bit (long double) floats someday. */
-
-#if 0 /* What was this for? */
-#ifndef __GNU_VA_LIST
-#define __ireg_used ireg_used
-#define __freg_used freg_used
-#define __mem_ptr mem_ptr
-#define __reg_base reg_base
-#endif
-#endif /* 0 */
-
-/* Avoid errors if compiling GCC v2 with GCC v1. */
-#if __GNUC__ == 1
-#define __extension__
-#endif
-
-#define va_arg(__va, __type) \
-__extension__ \
-(* (__type *) \
-({ \
- register void *__rv; /* result value */ \
- register unsigned __align; \
- switch (__builtin_classify_type (* (__type *) 0)) \
- { \
- case __real_type_class: \
- switch (sizeof (__type)) \
- { \
- case sizeof (float): \
- case sizeof (double): \
- if ((__va).__freg_used < __NUM_PARM_FREGS - 1) \
- { \
- if (((__va).__freg_used & 1) != 0) \
- (__va).__freg_used++; /* skip odd */ \
- __rv = &__savereg((__va))->__float_regs.__freg[(__va).__freg_used];\
- (__va).__freg_used += 2; \
- } \
- else \
- { \
- if ((((unsigned) (__va).__mem_ptr) & (sizeof(double)-1)) != 0) \
- (__va).__mem_ptr++; /* skip odd */ \
- __rv = (__va).__mem_ptr; \
- (__va).__mem_ptr += 2; \
- } \
- if (sizeof (__type) == sizeof (float)) \
- { \
- *((float *) __rv) = *((double *) __rv); \
- *(((long *) __rv) + 1) = 0xfff00001; \
- } \
- break; \
- default: \
- abort (); \
- } \
- break; \
- case __void_type_class: \
- case __integer_type_class: \
- case __char_type_class: \
- case __enumeral_type_class: \
- case __boolean_type_class: \
- case __pointer_type_class: \
- case __reference_type_class: \
- case __offset_type_class: \
- if (sizeof (__type) <= 4) \
- { \
- __rv = ((__va).__ireg_used < __NUM_PARM_IREGS \
- ? (&__savereg((__va))->__ireg[(__va).__ireg_used++]) \
- : (__va).__mem_ptr++); \
- break; \
- } \
- else if ((__va).__ireg_used + sizeof (__type) / 4 <= __NUM_PARM_IREGS) \
- { \
- __rv = &__savereg((__va))->__ireg[(__va).__ireg_used]; \
- (__va).__ireg_used += sizeof (__type) / 4; \
- break; \
- } \
- /* Fall through to fetch from memory. */ \
- case __record_type_class: \
- case __union_type_class: \
- __align = (__alignof__ (__type) < sizeof (long) \
- ? sizeof (long) \
- : __alignof__ (__type)); \
- (__va).__mem_ptr \
- = (long *) \
- ((((unsigned) (__va).__mem_ptr) + (__align-1)) & ~(__align-1)); \
- __rv = (__va).__mem_ptr; \
- (__va).__mem_ptr \
- += ((sizeof (__type) + sizeof (long) - 1) / sizeof (long)); \
- break; \
- case __complex_type_class: \
- case __function_type_class: \
- case __method_type_class: \
- case __array_type_class: \
- case __string_type_class: \
- case __set_type_class: \
- case __file_type_class: \
- case __lang_type_class: \
- case __no_type_class: \
- default: \
- abort (); \
- } \
- __rv; \
-}))
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
-
diff --git a/gcc/ginclude/va-i960.h b/gcc/ginclude/va-i960.h
deleted file mode 100644
index ba0d08ba893..00000000000
--- a/gcc/ginclude/va-i960.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* GNU C varargs support for the Intel 80960. */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-/* The first element is the address of the first argument.
- The second element is the number of bytes skipped past so far. */
-typedef unsigned __gnuc_va_list[2];
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-/* In GCC version 2, we want an ellipsis at the end of the declaration
- of the argument list. GCC version 1 can't parse it. */
-
-#if __GNUC__ > 1
-#define __va_ellipsis ...
-#else
-#define __va_ellipsis
-#endif
-
-/* The stack size of the type t. */
-#define __vsiz(T) (((sizeof (T) + 3) / 4) * 4)
-/* The stack alignment of the type t. */
-#define __vali(T) (__alignof__ (T) >= 4 ? __alignof__ (T) : 4)
-/* The offset of the next stack argument after one of type t at offset i. */
-#define __vpad(I, T) ((((I) + __vali (T) - 1) / __vali (T)) \
- * __vali (T) + __vsiz (T))
-
-/* Avoid errors if compiling GCC v2 with GCC v1. */
-#if __GNUC__ == 1
-#define __extension__
-#endif
-
-#ifdef _STDARG_H
-/* Call __builtin_next_arg even though we aren't using its value, so that
- we can verify that firstarg is correct. */
-#define va_start(AP, LASTARG) \
-__extension__ \
-({ __builtin_next_arg (LASTARG); \
- __asm__ ("st g14,%0" : "=m" (*(AP))); \
- (AP)[1] = (__builtin_args_info (0) + __builtin_args_info (1)) * 4; })
-
-#else
-
-#define va_alist __builtin_va_alist
-#define va_dcl char *__builtin_va_alist; __va_ellipsis
-#define va_start(AP) \
-__extension__ \
-({ __asm__ ("st g14,%0" : "=m" (*(AP))); \
- (AP)[1] = (__builtin_args_info (0) + __builtin_args_info (1)) * 4; })
-#endif
-
-/* We cast to void * and then to TYPE * because this avoids
- a warning about increasing the alignment requirement. */
-#define va_arg(AP, T) \
-( \
- ( \
- ((AP)[1] <= 48 && (__vpad ((AP)[1], T) > 48 || __vsiz (T) > 16)) \
- ? ((AP)[1] = 48 + __vsiz (T)) \
- : ((AP)[1] = __vpad ((AP)[1], T)) \
- ), \
- \
- *((T *) (void *) ((char *) *(AP) + (AP)[1] - __vsiz (T))) \
-)
-
-#ifndef va_end
-void va_end (__gnuc_va_list); /* Defined in libgcc.a */
-#endif
-#define va_end(AP) ((void *)0)
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
-
diff --git a/gcc/ginclude/va-m32r.h b/gcc/ginclude/va-m32r.h
deleted file mode 100644
index 4ef0ad8267a..00000000000
--- a/gcc/ginclude/va-m32r.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* GNU C stdarg/varargs support for the M32R */
-
-/* Define __gnuc_va_list. */
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-typedef void *__gnuc_va_list;
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-/* Common code for va_start for both varargs and stdarg. */
-
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-
-#ifdef _STDARG_H /* stdarg.h support */
-
-/* Calling __builtin_next_arg gives the proper error message if LASTARG is
- not indeed the last argument. */
-#define va_start(AP, LASTARG) \
- (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
-
-#else /* varargs.h support */
-
-#define va_alist __builtin_va_alist
-/* The ... causes current_function_varargs to be set in cc1. */
-#define va_dcl int __builtin_va_alist; ...
-#define va_start(AP) AP=(char *) &__builtin_va_alist
-
-#endif /* _STDARG_H */
-
-/* Nothing needs to be done to end varargs/stdarg processing */
-#define va_end(AP) ((void) 0)
-
-/* Values returned by __builtin_classify_type. */
-enum __type_class
-{
- __no_type_class = -1,
- __void_type_class,
- __integer_type_class,
- __char_type_class,
- __enumeral_type_class,
- __boolean_type_class,
- __pointer_type_class,
- __reference_type_class,
- __offset_type_class,
- __real_type_class,
- __complex_type_class,
- __function_type_class,
- __method_type_class,
- __record_type_class,
- __union_type_class,
- __array_type_class,
- __string_type_class,
- __set_type_class,
- __file_type_class,
- __lang_type_class
-};
-
-/* Return whether a type is passed by reference. */
-#define __va_by_reference_p(TYPE) (sizeof (TYPE) > 8)
-
-#define va_arg(AP,TYPE) \
-__extension__ (*({ \
- register TYPE *__ptr; \
- \
- if (__va_by_reference_p (TYPE)) \
- { \
- __ptr = *(TYPE **)(void *) (AP); \
- (AP) = (__gnuc_va_list) ((char *) (AP) + sizeof (void *)); \
- } \
- else \
- { \
- __ptr = (TYPE *)(void *) \
- ((char *) (AP) + (sizeof (TYPE) < __va_rounded_size (char) \
- ? __va_rounded_size (TYPE) - sizeof (TYPE) \
- : 0)); \
- (AP) = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)); \
- } \
- \
- __ptr; \
-}))
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
diff --git a/gcc/ginclude/va-m88k.h b/gcc/ginclude/va-m88k.h
deleted file mode 100644
index 0a20d84501c..00000000000
--- a/gcc/ginclude/va-m88k.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* GNU C varargs support for the Motorola 88100 */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-
-typedef struct
-{
- int __va_arg; /* argument number */
- int *__va_stk; /* start of args passed on stack */
- int *__va_reg; /* start of args passed in regs */
-} __gnuc_va_list;
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-#ifdef _STDARG_H /* stdarg.h support */
-
-/* Call __builtin_next_arg even though we aren't using its value, so that
- we can verify that LASTARG is correct. */
-#if __GNUC__ > 1 /* GCC 2.0 and beyond */
-#define va_start(AP,LASTARG) \
- (__builtin_next_arg (LASTARG), \
- (AP) = *(__gnuc_va_list *)__builtin_saveregs())
-#else
-#define va_start(AP,LASTARG) \
- ( (AP).__va_reg = (int *) __builtin_saveregs2(0), \
- (AP).__va_stk = (int *) __builtin_argptr(), \
- (AP).__va_arg = (int) (__builtin_argsize() + 3) / 4 )
-#endif
-
-#else /* varargs.h support */
-
-#if __GNUC__ > 1 /* GCC 2.0 and beyond */
-#define va_start(AP) ((AP) = *(__gnuc_va_list *)__builtin_saveregs())
-#else
-#define va_start(AP) \
- ( (AP).__va_reg = (int *) __builtin_saveregs2(1), \
- (AP).__va_stk = (int *) __builtin_argptr(), \
- (AP).__va_arg = (int) (__builtin_argsize() - 4 + 3) / 4 )
-#endif
-#define va_alist __va_1st_arg
-#define va_dcl register int va_alist;...
-
-#endif /* _STDARG_H */
-
-/* Avoid trouble between this file and _int_varargs.h under DG/UX. This file
- can be included by <stdio.h> and others and provides definitions of
- __va_size and __va_reg_p and a va_list typedef. Avoid defining va_list
- again with _VA_LIST. */
-#ifdef __INT_VARARGS_H
-#undef __va_size
-#undef __va_reg_p
-#define __gnuc_va_list va_list
-#define _VA_LIST
-#define _VA_LIST_
-#else
-/* Similarly, if this gets included first, do nothing in _int_varargs.h. */
-#define __INT_VARARGS_H
-#endif
-
-#define __va_reg_p(TYPE) \
- (__builtin_classify_type(*(TYPE *)0) < 12 \
- ? sizeof(TYPE) <= 8 : sizeof(TYPE) == 4 && __alignof__(TYPE) == 4)
-
-#define __va_size(TYPE) ((sizeof(TYPE) + 3) >> 2)
-
-/* We cast to void * and then to TYPE * because this avoids
- a warning about increasing the alignment requirement. */
-#define va_arg(AP,TYPE) \
- ( (AP).__va_arg = (((AP).__va_arg + (1 << (__alignof__(TYPE) >> 3)) - 1) \
- & ~((1 << (__alignof__(TYPE) >> 3)) - 1)) \
- + __va_size(TYPE), \
- *((TYPE *) (void *) ((__va_reg_p(TYPE) \
- && (AP).__va_arg < 8 + __va_size(TYPE) \
- ? (AP).__va_reg : (AP).__va_stk) \
- + ((AP).__va_arg - __va_size(TYPE)))))
-
-#define va_end(AP) ((void)0)
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
diff --git a/gcc/ginclude/va-mips.h b/gcc/ginclude/va-mips.h
deleted file mode 100644
index af1e1f461b6..00000000000
--- a/gcc/ginclude/va-mips.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/* ---------------------------------------- */
-/* VARARGS for MIPS/GNU CC */
-/* */
-/* */
-/* */
-/* */
-/* ---------------------------------------- */
-
-
-/* These macros implement varargs for GNU C--either traditional or ANSI. */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-#if defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)
-
-typedef struct {
- /* Pointer to FP regs. */
- char *__fp_regs;
- /* Number of FP regs remaining. */
- int __fp_left;
- /* Pointer to GP regs followed by stack parameters. */
- char *__gp_regs;
-} __gnuc_va_list;
-
-#else /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
-
-typedef char * __gnuc_va_list;
-
-#endif /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-enum {
- __no_type_class = -1,
- __void_type_class,
- __integer_type_class,
- __char_type_class,
- __enumeral_type_class,
- __boolean_type_class,
- __pointer_type_class,
- __reference_type_class,
- __offset_type_class,
- __real_type_class,
- __complex_type_class,
- __function_type_class,
- __method_type_class,
- __record_type_class,
- __union_type_class,
- __array_type_class,
- __string_type_class,
- __set_type_class,
- __file_type_class,
- __lang_type_class
-};
-
-/* In GCC version 2, we want an ellipsis at the end of the declaration
- of the argument list. GCC version 1 can't parse it. */
-
-#if __GNUC__ > 1
-#define __va_ellipsis ...
-#else
-#define __va_ellipsis
-#endif
-
-#ifdef __mips64
-#define __va_rounded_size(__TYPE) \
- (((sizeof (__TYPE) + 8 - 1) / 8) * 8)
-#else
-#define __va_rounded_size(__TYPE) \
- (((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-#endif
-
-#ifdef __mips64
-#define __va_reg_size 8
-#else
-#define __va_reg_size 4
-#endif
-
-/* Get definitions for _MIPS_SIM_ABI64 etc. */
-#ifdef _MIPS_SIM
-#include <sgidefs.h>
-#endif
-
-#ifdef _STDARG_H
-#if defined (__mips_eabi)
-#if ! defined (__mips_soft_float) && ! defined (__mips_single_float)
-#ifdef __mips64
-#define va_start(__AP, __LASTARG) \
- (__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \
- - (__builtin_args_info (2) < 8 \
- ? (8 - __builtin_args_info (2)) * __va_reg_size \
- : 0)), \
- __AP.__fp_left = 8 - __builtin_args_info (3), \
- __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size)
-#else /* ! defined (__mips64) */
-#define va_start(__AP, __LASTARG) \
- (__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \
- - (__builtin_args_info (2) < 8 \
- ? (8 - __builtin_args_info (2)) * __va_reg_size \
- : 0)), \
- __AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \
- __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \
- __AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8))
-#endif /* ! defined (__mips64) */
-#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */
-#define va_start(__AP, __LASTARG) \
- (__AP = ((__gnuc_va_list) __builtin_next_arg (__LASTARG) \
- - (__builtin_args_info (2) >= 8 ? 0 \
- : (8 - __builtin_args_info (2)) * __va_reg_size)))
-#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */
-#else /* ! defined (__mips_eabi) */
-#define va_start(__AP, __LASTARG) \
- (__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG))
-#endif /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
-#else /* ! _STDARG_H */
-#define va_alist __builtin_va_alist
-#ifdef __mips64
-/* This assumes that `long long int' is always a 64 bit type. */
-#define va_dcl long long int __builtin_va_alist; __va_ellipsis
-#else
-#define va_dcl int __builtin_va_alist; __va_ellipsis
-#endif
-#if defined (__mips_eabi)
-#if ! defined (__mips_soft_float) && ! defined (__mips_single_float)
-#ifdef __mips64
-#define va_start(__AP) \
- (__AP.__gp_regs = ((char *) __builtin_next_arg () \
- - (__builtin_args_info (2) < 8 \
- ? (8 - __builtin_args_info (2)) * __va_reg_size \
- : __va_reg_size)), \
- __AP.__fp_left = 8 - __builtin_args_info (3), \
- __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size)
-#else /* ! defined (__mips64) */
-#define va_start(__AP) \
- (__AP.__gp_regs = ((char *) __builtin_next_arg () \
- - (__builtin_args_info (2) < 8 \
- ? (8 - __builtin_args_info (2)) * __va_reg_size \
- : __va_reg_size)), \
- __AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \
- __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \
- __AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8))
-#endif /* ! defined (__mips64) */
-#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
-#define va_start(__AP) \
- (__AP = ((__gnuc_va_list) __builtin_next_arg () \
- - (__builtin_args_info (2) >= 8 ? __va_reg_size \
- : (8 - __builtin_args_info (2)) * __va_reg_size)))
-#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
-/* Need alternate code for _MIPS_SIM_ABI64. */
-#elif defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32)
-#define va_start(__AP) \
- (__AP = (__gnuc_va_list) __builtin_next_arg () \
- + (__builtin_args_info (2) >= 8 ? -8 : 0))
-#else
-#define va_start(__AP) __AP = (char *) &__builtin_va_alist
-#endif
-#endif /* ! _STDARG_H */
-
-#ifndef va_end
-void va_end (__gnuc_va_list); /* Defined in libgcc.a */
-#endif
-#define va_end(__AP) ((void)0)
-
-#if defined (__mips_eabi)
-
-#if ! defined (__mips_soft_float) && ! defined (__mips_single_float)
-#ifdef __mips64
-#define __va_next_addr(__AP, __type) \
- ((__builtin_classify_type (*(__type *) 0) == __real_type_class \
- && __AP.__fp_left > 0) \
- ? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \
- : (__AP.__gp_regs += __va_reg_size) - __va_reg_size)
-#else
-#define __va_next_addr(__AP, __type) \
- ((__builtin_classify_type (*(__type *) 0) == __real_type_class \
- && __AP.__fp_left > 0) \
- ? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \
- : (((__builtin_classify_type (* (__type *) 0) < __record_type_class \
- && __alignof__ (__type) > 4) \
- ? __AP.__gp_regs = (char *) (((int) __AP.__gp_regs + 8 - 1) & -8) \
- : (char *) 0), \
- (__builtin_classify_type (* (__type *) 0) >= __record_type_class \
- ? (__AP.__gp_regs += __va_reg_size) - __va_reg_size \
- : ((__AP.__gp_regs += __va_rounded_size (__type)) \
- - __va_rounded_size (__type)))))
-#endif
-#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
-#ifdef __mips64
-#define __va_next_addr(__AP, __type) \
- ((__AP += __va_reg_size) - __va_reg_size)
-#else
-#define __va_next_addr(__AP, __type) \
- (((__builtin_classify_type (* (__type *) 0) < __record_type_class \
- && __alignof__ (__type) > 4) \
- ? __AP = (char *) (((int) __AP + 8 - 1) & -8) \
- : (char *) 0), \
- (__builtin_classify_type (* (__type *) 0) >= __record_type_class \
- ? (__AP += __va_reg_size) - __va_reg_size \
- : ((__AP += __va_rounded_size (__type)) \
- - __va_rounded_size (__type))))
-#endif
-#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */
-
-#ifdef __MIPSEB__
-#define va_arg(__AP, __type) \
- ((__va_rounded_size (__type) <= __va_reg_size) \
- ? *(__type *) (void *) (__va_next_addr (__AP, __type) \
- + __va_reg_size \
- - sizeof (__type)) \
- : (__builtin_classify_type (*(__type *) 0) >= __record_type_class \
- ? **(__type **) (void *) (__va_next_addr (__AP, __type) \
- + __va_reg_size \
- - sizeof (char *)) \
- : *(__type *) (void *) __va_next_addr (__AP, __type)))
-#else
-#define va_arg(__AP, __type) \
- ((__va_rounded_size (__type) <= __va_reg_size) \
- ? *(__type *) (void *) __va_next_addr (__AP, __type) \
- : (__builtin_classify_type (* (__type *) 0) >= __record_type_class \
- ? **(__type **) (void *) __va_next_addr (__AP, __type) \
- : *(__type *) (void *) __va_next_addr (__AP, __type)))
-#endif
-
-#else /* ! defined (__mips_eabi) */
-
-/* We cast to void * and then to TYPE * because this avoids
- a warning about increasing the alignment requirement. */
-/* The __mips64 cases are reversed from the 32 bit cases, because the standard
- 32 bit calling convention left-aligns all parameters smaller than a word,
- whereas the __mips64 calling convention does not (and hence they are
- right aligned). */
-#ifdef __mips64
-#ifdef __MIPSEB__
-#define va_arg(__AP, __type) \
- ((__type *) (void *) (__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
- + __va_rounded_size (__type))))[-1]
-#else
-#define va_arg(__AP, __type) \
- ((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
- + __va_rounded_size (__type))), \
- *(__type *) (void *) (__AP - __va_rounded_size (__type)))
-#endif
-
-#else /* not __mips64 */
-
-#ifdef __MIPSEB__
-/* For big-endian machines. */
-#define va_arg(__AP, __type) \
- ((__AP = (char *) ((__alignof__ (__type) > 4 \
- ? ((int)__AP + 8 - 1) & -8 \
- : ((int)__AP + 4 - 1) & -4) \
- + __va_rounded_size (__type))), \
- *(__type *) (void *) (__AP - __va_rounded_size (__type)))
-#else
-/* For little-endian machines. */
-#define va_arg(__AP, __type) \
- ((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
- ? ((int)__AP + 8 - 1) & -8 \
- : ((int)__AP + 4 - 1) & -4) \
- + __va_rounded_size(__type))))[-1]
-#endif
-#endif
-#endif /* ! defined (__mips_eabi) */
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
diff --git a/gcc/ginclude/va-mn10300.h b/gcc/ginclude/va-mn10300.h
deleted file mode 100644
index e156ccf5939..00000000000
--- a/gcc/ginclude/va-mn10300.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-typedef void *__gnuc_va_list;
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-#define __gnuc_va_start(AP) (AP = (__gnuc_va_list)__builtin_saveregs())
-#define __va_ellipsis ...
-
-#ifdef _STDARG_H
-#define va_start(AP, LASTARG) \
- (__builtin_next_arg (LASTARG), __gnuc_va_start (AP))
-#else
-#define va_alist __builtin_va_alist
-#define va_dcl int __builtin_va_alist; __va_ellipsis
-#define va_start(AP) AP=(char *) &__builtin_va_alist
-#endif
-
-/* Now stuff common to both varargs & stdarg implementations. */
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-#undef va_end
-void va_end (__gnuc_va_list);
-#define va_end(AP) ((void)0)
-#define va_arg(AP, TYPE) \
- (sizeof (TYPE) > 8 \
- ? (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (char *)),\
- **((TYPE **) (void *) ((char *) (AP) - __va_rounded_size (char *))))\
- : (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
- *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))))
-#endif
diff --git a/gcc/ginclude/va-pa.h b/gcc/ginclude/va-pa.h
deleted file mode 100644
index 4865f6bfac0..00000000000
--- a/gcc/ginclude/va-pa.h
+++ /dev/null
@@ -1,52 +0,0 @@
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-
-typedef void *__gnuc_va_list;
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-#if __GNUC__ > 1
-#define __va_ellipsis ...
-#define __gnuc_va_start(AP) ((AP) = (va_list)__builtin_saveregs())
-#else
-#define va_alist __va_a__, __va_b__, __va_c__, __va_d__
-#define __va_ellipsis
-#define __gnuc_va_start(AP)\
- (AP) = (double *) &__va_a__, &__va_b__, &__va_c__, &__va_d__, \
- (AP) = (double *)((char *)(AP) + 4)
-#endif /* __GNUC__ > 1 */
-
-/* Call __builtin_next_arg even though we aren't using its value, so that
- we can verify that LASTARG is correct. */
-#ifdef _STDARG_H
-#define va_start(AP,LASTARG) \
- (__builtin_next_arg (LASTARG), __gnuc_va_start (AP))
-#else
-/* The ... causes current_function_varargs to be set in cc1. */
-#define va_dcl long va_alist; __va_ellipsis
-#define va_start(AP) __gnuc_va_start (AP)
-#endif
-
-#define va_arg(AP,TYPE) \
- (*(sizeof(TYPE) > 8 ? \
- ((AP = (__gnuc_va_list) ((char *)AP - sizeof (int))), \
- (((TYPE *) (void *) (*((int *) (AP)))))) \
- :((AP = \
- (__gnuc_va_list) ((long)((char *)AP - sizeof (TYPE)) \
- & (sizeof(TYPE) > 4 ? ~0x7 : ~0x3))), \
- (((TYPE *) (void *) ((char *)AP + ((8 - sizeof(TYPE)) % 4)))))))
-
-#ifndef va_end
-void va_end (__gnuc_va_list); /* Defined in libgcc.a */
-#endif
-#define va_end(AP) ((void)0)
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
diff --git a/gcc/ginclude/va-ppc.h b/gcc/ginclude/va-ppc.h
deleted file mode 100644
index 3d9d3f04228..00000000000
--- a/gcc/ginclude/va-ppc.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/* GNU C varargs support for the PowerPC with either the V.4 or Windows NT calling sequences */
-
-#ifndef _WIN32
-/* System V.4 support */
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-
-#ifndef _SYS_VA_LIST_H
-#define _SYS_VA_LIST_H /* Solaris sys/va_list.h */
-
-/* Solaris decided to rename overflow_arg_area to input_arg_area,
- so handle it via a macro. */
-#define __va_overflow(AP) (AP)->overflow_arg_area
-
-/* Note that the names in this structure are in the user's namespace, but
- that the V.4 abi explicitly states that these names should be used. */
-typedef struct __va_list_tag {
- char gpr; /* index into the array of 8 GPRs stored in the
- register save area gpr=0 corresponds to r3,
- gpr=1 to r4, etc. */
- char fpr; /* index into the array of 8 FPRs stored in the
- register save area fpr=0 corresponds to f1,
- fpr=1 to f2, etc. */
- char *overflow_arg_area; /* location on stack that holds the next
- overflow argument */
- char *reg_save_area; /* where r3:r10 and f1:f8, if saved are stored */
-} __va_list[1], __gnuc_va_list[1];
-
-#else /* _SYS_VA_LIST */
-
-typedef __va_list __gnuc_va_list;
-#define __va_overflow(AP) (AP)->input_arg_area
-
-#endif /* not _SYS_VA_LIST */
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-/* Register save area located below the frame pointer */
-#ifndef __VA_PPC_H__
-#define __VA_PPC_H__
-typedef struct {
- long __gp_save[8]; /* save area for GP registers */
- double __fp_save[8]; /* save area for FP registers */
-} __va_regsave_t;
-
-/* Macros to access the register save area */
-/* We cast to void * and then to TYPE * because this avoids
- a warning about increasing the alignment requirement. */
-#define __VA_FP_REGSAVE(AP,TYPE) \
- ((TYPE *) (void *) (&(((__va_regsave_t *) \
- (AP)->reg_save_area)->__fp_save[(int)(AP)->fpr])))
-
-#define __VA_GP_REGSAVE(AP,TYPE) \
- ((TYPE *) (void *) (&(((__va_regsave_t *) \
- (AP)->reg_save_area)->__gp_save[(int)(AP)->gpr])))
-
-/* Common code for va_start for both varargs and stdarg. This depends
- on the format of rs6000_args in rs6000.h. The fields used are:
-
- #0 WORDS # words used for GP regs/stack values
- #1 FREGNO next available FP register
- #2 NARGS_PROTOTYPE # args left in the current prototype
- #3 ORIG_NARGS original value of NARGS_PROTOTYPE
- #4 VARARGS_OFFSET offset from frame pointer of varargs area */
-
-#define __va_words __builtin_args_info (0)
-#define __va_fregno __builtin_args_info (1)
-#define __va_nargs __builtin_args_info (2)
-#define __va_orig_nargs __builtin_args_info (3)
-#define __va_varargs_offset __builtin_args_info (4)
-
-#define __va_start_common(AP, FAKE) \
-__extension__ ({ \
- register int __words = __va_words - FAKE; \
- \
- (AP)->gpr = (__words < 8) ? __words : 8; \
- (AP)->fpr = __va_fregno - 33; \
- (AP)->reg_save_area = (((char *) __builtin_frame_address (0)) \
- + __va_varargs_offset); \
- __va_overflow(AP) = ((char *)__builtin_saveregs () \
- + (((__words >= 8) ? __words - 8 : 0) \
- * sizeof (long))); \
- (void)0; \
-})
-
-#ifdef _STDARG_H /* stdarg.h support */
-
-/* Calling __builtin_next_arg gives the proper error message if LASTARG is
- not indeed the last argument. */
-#define va_start(AP,LASTARG) \
- (__builtin_next_arg (LASTARG), __va_start_common (AP, 0))
-
-#else /* varargs.h support */
-
-#define va_start(AP) __va_start_common (AP, 1)
-#define va_alist __va_1st_arg
-#define va_dcl register int va_alist; ...
-
-#endif /* _STDARG_H */
-
-#ifdef _SOFT_FLOAT
-#define __va_float_p(TYPE) 0
-#else
-#define __va_float_p(TYPE) (__builtin_classify_type(*(TYPE *)0) == 8)
-#endif
-
-#define __va_longlong_p(TYPE) \
- ((__builtin_classify_type(*(TYPE *)0) == 1) && (sizeof(TYPE) == 8))
-
-#define __va_aggregate_p(TYPE) (__builtin_classify_type(*(TYPE *)0) >= 12)
-#define __va_size(TYPE) ((sizeof(TYPE) + sizeof (long) - 1) / sizeof (long))
-
-#define va_arg(AP,TYPE) \
-__extension__ (*({ \
- register TYPE *__ptr; \
- \
- if (__va_float_p (TYPE) && (AP)->fpr < 8) \
- { \
- __ptr = __VA_FP_REGSAVE (AP, TYPE); \
- (AP)->fpr++; \
- } \
- \
- else if (__va_aggregate_p (TYPE) && (AP)->gpr < 8) \
- { \
- __ptr = * __VA_GP_REGSAVE (AP, TYPE *); \
- (AP)->gpr++; \
- } \
- \
- else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \
- && (AP)->gpr + __va_size(TYPE) <= 8 \
- && (!__va_longlong_p(TYPE) \
- || (AP)->gpr + __va_size(TYPE) <= 7)) \
- { \
- if (__va_longlong_p(TYPE) && ((AP)->gpr & 1) != 0) \
- (AP)->gpr++; \
- \
- __ptr = __VA_GP_REGSAVE (AP, TYPE); \
- (AP)->gpr += __va_size (TYPE); \
- } \
- \
- else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \
- && (AP)->gpr < 8) \
- { \
- (AP)->gpr = 8; \
- __ptr = (TYPE *) (void *) (__va_overflow(AP)); \
- __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \
- } \
- \
- else if (__va_aggregate_p (TYPE)) \
- { \
- __ptr = * (TYPE **) (void *) (__va_overflow(AP)); \
- __va_overflow(AP) += sizeof (TYPE *); \
- } \
- else \
- { \
- if (__va_longlong_p(TYPE) && ((long)__va_overflow(AP) & 4) != 0) \
- __va_overflow(AP) += 4; \
- \
- __ptr = (TYPE *) (void *) (__va_overflow(AP)); \
- __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \
- } \
- \
- __ptr; \
-}))
-
-#define va_end(AP) ((void)0)
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) *(dest) = *(src)
-
-#endif /* __VA_PPC_H__ */
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
-
-
-#else
-/* Windows NT */
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-typedef char *__gnuc_va_list;
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-#define __va_start_common(AP, LASTARG, FAKE) \
- ((__builtin_saveregs ()), ((AP) = ((char *) &LASTARG) + __va_rounded_size (AP)), 0)
-
-#ifdef _STDARG_H /* stdarg.h support */
-
-/* Calling __builtin_next_arg gives the proper error message if LASTARG is
- not indeed the last argument. */
-#define va_start(AP,LASTARG) \
- (__builtin_saveregs (), \
- (AP) = __builtin_next_arg (LASTARG), \
- 0)
-
-#else /* varargs.h support */
-
-#define va_start(AP) \
- (__builtin_saveregs (), \
- (AP) = __builtin_next_arg (__va_1st_arg) - sizeof (int), \
- 0)
-
-#define va_alist __va_1st_arg
-#define va_dcl register int __va_1st_arg; ...
-
-#endif /* _STDARG_H */
-
-#define __va_rounded_size(TYPE) ((sizeof (TYPE) + 3) & ~3)
-#define __va_align(AP, TYPE) \
- ((((unsigned long)(AP)) + ((sizeof (TYPE) >= 8) ? 7 : 3)) \
- & ~((sizeof (TYPE) >= 8) ? 7 : 3))
-
-#define va_arg(AP,TYPE) \
-( *(TYPE *)((AP = (char *) (__va_align(AP, TYPE) \
- + __va_rounded_size(TYPE))) \
- - __va_rounded_size(TYPE)))
-
-#define va_end(AP) ((void)0)
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
-#endif /* Windows NT */
diff --git a/gcc/ginclude/va-pyr.h b/gcc/ginclude/va-pyr.h
deleted file mode 100644
index 5ad4ba9d763..00000000000
--- a/gcc/ginclude/va-pyr.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- *
- * Varargs for PYR/GNU CC
- *
- * WARNING -- WARNING -- DANGER
- *
- * The code in this file implements varargs for gcc on a pyr in
- * a way that is compatible with code compiled by the Pyramid Technology
- * C compiler.
- * As such, it depends strongly on the Pyramid conventions for
- * parameter passing.ct and independent implementation.
- * These (somewhat bizarre) parameter-passing conventions are described
- * in the ``OSx Operating System Porting Guide''.
- *
- * A quick summary is useful:
- * 12 of the 48 register-windowed regs available for
- * parameter passing. Parameters of a function call that are eligible
- * to be passed in registers are assigned registers from TR0/PR0 onwards;
- * all other arguments are passed on the stack.
- * Structure and union parameters are *never* passed in registers,
- * even if they are small enough to fit. They are always passed on
- * the stack.
- *
- * Double-sized parameters cannot be passed in TR11, because
- * TR12 is not used for passing parameters. If, in the absence of this
- * rule, a double-sized param would have been passed in TR11,
- * that parameter is passed on the stack and no parameters are
- * passed in TR11.
- *
- * It is only known to work for passing 32-bit integer quantities
- * (ie chars, shorts, ints/enums, longs), doubles, or pointers.
- * Passing structures on a Pyramid via varargs is a loser.
- * Passing an object larger than 8 bytes on a pyramid via varargs may
- * also be a loser.
- *
- */
-
-
-/*
- * pointer to next stack parameter in __va_buf[0]
- * pointer to next parameter register in __va_buf[1]
- * Count of registers seen at __va_buf[2]
- * saved pr0..pr11 in __va_buf[3..14]
- * # of calls to va_arg (debugging) at __va_buf[15]
- */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-
-typedef void *__voidptr;
-#if 1
-
-typedef struct __va_regs {
- __voidptr __stackp,__regp,__count;
- __voidptr __pr0,__pr1,__pr2,__pr3,__pr4,__pr5,__pr6,__pr7,__pr8,__pr9,__pr10,__pr11;
- } __va_regs;
-
-typedef __va_regs __va_buf;
-#else
-
-/* __va_buf[0] = address of next arg passed on the stack
- __va_buf[1] = address of next arg passed in a register
- __va_buf[2] = register-# of next arg passed in a register
- */
-typedef __voidptr(*__va_buf);
-
-#endif
-
-typedef __va_buf __gnuc_va_list;
-
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-/* In GCC version 2, we want an ellipsis at the end of the declaration
- of the argument list. GCC version 1 can't parse it. */
-
-#if __GNUC__ > 1
-#define __va_ellipsis ...
-#else
-#define __va_ellipsis
-#endif
-
-#define va_alist \
- __va0,__va1,__va2,__va3,__va4,__va5,__va6,__va7,__va8,__va9,__va10,__va11, \
- __builtin_va_alist
-
-/* The ... causes current_function_varargs to be set in cc1. */
-#define va_dcl __voidptr va_alist; __va_ellipsis
-
-
-/* __asm ("rcsp %0" : "=r" ( _AP [0]));*/
-
-#define va_start(_AP) \
- _AP = ((struct __va_regs) { \
- &(_AP.__pr0), (void*)&__builtin_va_alist, (void*)0, \
- __va0,__va1,__va2,__va3,__va4,__va5, \
- __va6,__va7,__va8,__va9,__va10,__va11})
-
-
-/* Avoid errors if compiling GCC v2 with GCC v1. */
-#if __GNUC__ == 1
-#define __extension__
-#endif
-
-/* We cast to void * and then to TYPE * because this avoids
- a warning about increasing the alignment requirement. */
-#define va_arg(_AP, _MODE) \
-__extension__ \
-(*({__voidptr *__ap = (__voidptr*)&_AP; \
- register int __size = sizeof (_MODE); \
- register int __onstack = \
- (__size > 8 || ( (int)(__ap[2]) > 11) || \
- (__size==8 && (int)(__ap[2])==11)); \
- register int* __param_addr = ((int*)((__ap) [__onstack])); \
- \
- ((void *)__ap[__onstack])+=__size; \
- if (__onstack==0 || (int)(__ap[2])==11) \
- __ap[2]+= (__size >> 2); \
- (( _MODE *) (void *) __param_addr); \
-}))
-
-void va_end (__gnuc_va_list); /* Defined in libgcc.a */
-#define va_end(_X) ((void)0)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
diff --git a/gcc/ginclude/va-sh.h b/gcc/ginclude/va-sh.h
deleted file mode 100644
index 4bae1e0dcd2..00000000000
--- a/gcc/ginclude/va-sh.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/* This is just like the default gvarargs.h
- except for differences described below. */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-
-#ifdef __SH3E__
-
-typedef long __va_greg;
-typedef double __va_freg;
-
-typedef struct {
- __va_greg * __va_next_o; /* next available register */
- __va_greg * __va_next_o_limit; /* past last available register */
- __va_freg * __va_next_fp; /* next available fp register */
- __va_freg * __va_next_fp_limit; /* last available fp register */
- __va_greg * __va_next_stack; /* next extended word on stack */
-} __gnuc_va_list;
-
-#else /* ! SH3E */
-
-typedef void *__gnuc_va_list;
-
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-
-#endif /* ! SH3E */
-
-#endif /* __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-#ifdef _STDARG_H
-
-#ifdef __SH3E__
-
-#define va_start(AP, LASTARG) \
-__extension__ \
- ({ \
- AP.__va_next_fp = (__va_freg *) __builtin_saveregs (); \
- AP.__va_next_fp_limit = (AP.__va_next_fp + \
- (__builtin_args_info (1) < 8 ? 8 - __builtin_args_info (1) : 0)); \
- AP.__va_next_o = (__va_greg *) AP.__va_next_fp_limit; \
- AP.__va_next_o_limit = (AP.__va_next_o + \
- (__builtin_args_info (0) < 4 ? 4 - __builtin_args_info (0) : 0)); \
- AP.__va_next_stack = (__va_greg *) __builtin_next_arg (LASTARG); \
- })
-
-#else /* ! SH3E */
-
-#define va_start(AP, LASTARG) \
- (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
-
-#endif /* ! SH3E */
-
-#else /* _VARARGS_H */
-
-#define va_alist __builtin_va_alist
-#define va_dcl int __builtin_va_alist;...
-
-#ifdef __SH3E__
-
-#define va_start(AP) \
-__extension__ \
- ({ \
- AP.__va_next_fp = (__va_freg *) __builtin_saveregs (); \
- AP.__va_next_fp_limit = (AP.__va_next_fp + \
- (__builtin_args_info (1) < 8 ? 8 - __builtin_args_info (1) : 0)); \
- AP.__va_next_o = (__va_greg *) AP.__va_next_fp_limit; \
- AP.__va_next_o_limit = (AP.__va_next_o + \
- (__builtin_args_info (0) < 4 ? 4 - __builtin_args_info (0) : 0)); \
- AP.__va_next_stack = (__va_greg *) __builtin_next_arg (__builtin_va_alist) \
- - (__builtin_args_info (0) >= 4 || __builtin_args_info (1) >= 8 ? 1 : 0); \
- })
-
-#else /* ! SH3E */
-
-#define va_start(AP) AP=(char *) &__builtin_va_alist
-
-#endif /* ! SH3E */
-
-#endif /* _STDARG */
-
-#ifndef va_end
-void va_end (__gnuc_va_list); /* Defined in libgcc.a */
-
-/* Values returned by __builtin_classify_type. */
-
-enum __va_type_classes {
- __no_type_class = -1,
- __void_type_class,
- __integer_type_class,
- __char_type_class,
- __enumeral_type_class,
- __boolean_type_class,
- __pointer_type_class,
- __reference_type_class,
- __offset_type_class,
- __real_type_class,
- __complex_type_class,
- __function_type_class,
- __method_type_class,
- __record_type_class,
- __union_type_class,
- __array_type_class,
- __string_type_class,
- __set_type_class,
- __file_type_class,
- __lang_type_class
-};
-
-#endif
-#define va_end(pvar) ((void)0)
-
-/* RECORD_TYPE args passed using the C calling convention are
- passed by invisible reference. ??? RECORD_TYPE args passed
- in the stack are made to be word-aligned; for an aggregate that is
- not word-aligned, we advance the pointer to the first non-reg slot. */
-
-#ifdef __SH3E__
-
-#ifdef __LITTLE_ENDIAN__
-
-#define va_arg(pvar,TYPE) \
-__extension__ \
-(*({int __type = __builtin_classify_type (* (TYPE *) 0); \
- void * __result; \
- if (__type == __real_type_class && sizeof(TYPE) == 4) \
- /* float? */ \
- { \
- __va_freg *__r; \
- if (pvar.__va_next_fp < pvar.__va_next_fp_limit) \
- __r = (__va_freg *) pvar.__va_next_fp++; \
- else \
- __r = (__va_freg *) pvar.__va_next_stack++; \
- __result = (char *) __r; \
- } \
- else \
- { \
- __va_greg *_r; \
- if (pvar.__va_next_o + ((sizeof (TYPE) + 3) / 4) \
- <= pvar.__va_next_o_limit) \
- { \
- _r = pvar.__va_next_o; \
- pvar.__va_next_o += (sizeof (TYPE) + 3) / 4; \
- } \
- else \
- { \
- _r = pvar.__va_next_stack; \
- pvar.__va_next_stack += (sizeof (TYPE) + 3) / 4; \
- } \
- __result = (char *) _r; \
- } \
- (TYPE *) __result;}))
-
-#else /* ! __LITTLE_ENDIAN__ */
-
-#define va_arg(pvar,TYPE) \
-__extension__ \
-(*({int __type = __builtin_classify_type (* (TYPE *) 0); \
- void * __result; \
- if (__type == __real_type_class && sizeof(TYPE) == 4) \
- /* float? */ \
- { \
- __va_freg *__r; \
- if (pvar.__va_next_fp < pvar.__va_next_fp_limit) \
- __r = (__va_freg *) pvar.__va_next_fp++; \
- else \
- __r = (__va_freg *) pvar.__va_next_stack++; \
- __result = (char *) __r; \
- } \
- else \
- { \
- __va_greg *_r; \
- if (pvar.__va_next_o + ((sizeof (TYPE) + 3) / 4) \
- <= pvar.__va_next_o_limit) \
- { \
- pvar.__va_next_o += (sizeof (TYPE) + 3) / 4; \
- _r = pvar.__va_next_o; \
- } \
- else \
- { \
- pvar.__va_next_stack += (sizeof (TYPE) + 3) / 4; \
- _r = pvar.__va_next_stack; \
- } \
- __result = ((char *) _r \
- - (sizeof (TYPE) < 4 ? sizeof (TYPE) \
- : ((sizeof (TYPE) + 3) / 4) * 4)); \
- } \
- (TYPE *) __result;}))
-
-#endif /* __LITTLE_ENDIAN__ */
-
-#else /* ! SH3E */
-
-#ifdef __LITTLE_ENDIAN__
-
-/* This is for little-endian machines; small args are padded upward. */
-#define va_arg(AP, TYPE) \
- (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
- *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
-
-#else /* ! __LITTLE_ENDIAN__ */
-
-/* This is for big-endian machines; small args are padded downward. */
-#define va_arg(AP, TYPE) \
- (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
- *((TYPE *) (void *) ((char *) (AP) \
- - ((sizeof (TYPE) < __va_rounded_size (char) \
- ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
-
-#endif /* __LITTLE_ENDIAN__ */
-
-#endif /* SH3E */
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
diff --git a/gcc/ginclude/va-sparc.h b/gcc/ginclude/va-sparc.h
deleted file mode 100644
index d95c38c9e48..00000000000
--- a/gcc/ginclude/va-sparc.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* This is just like the default gvarargs.h
- except for differences described below. */
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-
-#ifdef __arch64__
-typedef long long __va_greg;
-typedef double __va_freg;
-typedef struct {
- __va_greg * __va_next_o; /* next available %o* register */
- __va_greg * __va_next_o_limit; /* past last available %o* register */
- __va_freg * __va_next_fp; /* next available %f* register */
- __va_freg * __va_next_fp_limit; /* last available %f* register */
- __va_greg * __va_next_stack; /* next extended word on stack */
-} __gnuc_va_list;
-#else
-#if ! defined (__svr4__) && ! defined (__linux__)
-/* This has to be a char * to be compatible with Sun.
- i.e., we have to pass a `va_list' to vsprintf. */
-typedef char * __gnuc_va_list;
-#else
-/* This has to be a void * to be compatible with Sun svr4.
- i.e., we have to pass a `va_list' to vsprintf. */
-typedef void * __gnuc_va_list;
-#endif
-#endif /* not __arch64__ */
-#endif /* not __GNUC_VA_LIST */
-
-/* If this is for internal libc use, don't define anything but
- __gnuc_va_list. */
-#if defined (_STDARG_H) || defined (_VARARGS_H)
-
-#ifdef _STDARG_H
-
-#ifdef __arch64__
-#define va_start(AP, LASTARG) \
-__extension__ \
- ({ \
- AP.__va_next_o = (__va_greg *) __builtin_saveregs (); \
- AP.__va_next_o_limit = (AP.__va_next_o + \
- (__builtin_args_info (0) < 6 ? 6 - __builtin_args_info (0) : 0)); \
- AP.__va_next_fp = (__va_freg *) AP.__va_next_o_limit; \
- AP.__va_next_fp_limit = (AP.__va_next_fp + \
- (__builtin_args_info (1) < 16 ? (16 - __builtin_args_info (1) + 1) / 2 : 0)); \
- AP.__va_next_stack = (__va_greg *) __builtin_next_arg (LASTARG); \
- })
-#else
-/* Call __builtin_next_arg even though we aren't using its value, so that
- we can verify that LASTARG is correct. */
-#ifdef __GCC_NEW_VARARGS__
-#define va_start(AP, LASTARG) \
- (__builtin_next_arg (LASTARG), AP = (char *) __builtin_saveregs ())
-#else
-#define va_start(AP, LASTARG) \
- (__builtin_saveregs (), AP = ((char *) __builtin_next_arg (LASTARG)))
-#endif
-#endif /* not __arch64__ */
-
-#else
-
-#define va_alist __builtin_va_alist
-#define va_dcl int __builtin_va_alist;...
-
-#ifdef __arch64__
-#define va_start(AP) \
-__extension__ \
- ({ \
- AP.__va_next_o = (__va_greg *) __builtin_saveregs (); \
- AP.__va_next_o_limit = (AP.__va_next_o + \
- (__builtin_args_info (0) < 6 ? 6 - __builtin_args_info (0) : 0)); \
- AP.__va_next_fp = (__va_freg *) AP.__va_next_o_limit; \
- AP.__va_next_fp_limit = (AP.__va_next_fp + \
- (__builtin_args_info (1) < 16 ? (16 - __builtin_args_info (1) + 1) / 2 : 0)); \
- AP.__va_next_stack = (__va_greg *) __builtin_next_arg (__builtin_va_alist) \
- - (__builtin_args_info (0) >= 6 || __builtin_args_info (1) >= 16 ? 1 : 0); \
- })
-#else
-#ifdef __GCC_NEW_VARARGS__
-#define va_start(AP) ((AP) = (char *) __builtin_saveregs ())
-#else
-#define va_start(AP) \
- (__builtin_saveregs (), (AP) = ((char *) &__builtin_va_alist))
-#endif
-#endif /* not __arch64__ */
-
-#endif
-
-#ifndef va_end
-void va_end (__gnuc_va_list); /* Defined in libgcc.a */
-
-/* Values returned by __builtin_classify_type. */
-
-enum __va_type_classes {
- __no_type_class = -1,
- __void_type_class,
- __integer_type_class,
- __char_type_class,
- __enumeral_type_class,
- __boolean_type_class,
- __pointer_type_class,
- __reference_type_class,
- __offset_type_class,
- __real_type_class,
- __complex_type_class,
- __function_type_class,
- __method_type_class,
- __record_type_class,
- __union_type_class,
- __array_type_class,
- __string_type_class,
- __set_type_class,
- __file_type_class,
- __lang_type_class
-};
-
-#endif
-#define va_end(pvar) ((void)0)
-
-/* Avoid errors if compiling GCC v2 with GCC v1. */
-#if __GNUC__ == 1
-#define __extension__
-#endif
-
-/* RECORD_TYPE args passed using the C calling convention are
- passed by invisible reference. ??? RECORD_TYPE args passed
- in the stack are made to be word-aligned; for an aggregate that is
- not word-aligned, we advance the pointer to the first non-reg slot. */
-
-#ifdef __arch64__
-
-#define va_arg(pvar,TYPE) \
-__extension__ \
-(*({int __type = __builtin_classify_type (* (TYPE *) 0); \
- void * __result; \
- if (__type == __real_type_class) /* float? */ \
- { \
- __va_freg *__r; \
- /* see PASS_IN_REG_P in gcc's sparc.h */ \
- if (pvar.__va_next_fp < pvar.__va_next_fp_limit \
- && ((__r = (__va_freg *) (((__va_greg) pvar.__va_next_fp + sizeof (TYPE) - 1) & ~(__va_greg) (sizeof (TYPE) - 1))) \
- < pvar.__va_next_fp_limit)) \
- { \
- pvar.__va_next_fp = __r + (sizeof (TYPE) + 7) / 8; \
- } \
- else \
- { \
- __r = (__va_freg *) pvar.__va_next_stack; \
- pvar.__va_next_stack += (sizeof (TYPE) + 7) / 8; \
- } \
- __result = __r; \
- } \
- else if (__type < __record_type_class) /* integer? */ \
- { \
- __va_greg *__r; \
- if (pvar.__va_next_o < pvar.__va_next_o_limit) \
- __r = pvar.__va_next_o++; \
- else \
- __r = pvar.__va_next_stack++; \
- /* adjust for 4 byte ints */ \
- __result = (char *) __r + 8 - sizeof (TYPE); \
- } \
- else /* aggregate object */ \
- { \
- void **__r; \
- if (pvar.__va_next_o < pvar.__va_next_o_limit) \
- __r = (void **) pvar.__va_next_o++; \
- else \
- __r = (void **) pvar.__va_next_stack++; \
- __result = *__r; \
- } \
- (TYPE *) __result;}))
-
-#else /* not __arch64__ */
-
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-
-/* We don't declare the union member `d' to have type TYPE
- because that would lose in C++ if TYPE has a constructor. */
-/* We cast to void * and then to TYPE * because this avoids
- a warning about increasing the alignment requirement.
- The casts to char * avoid warnings about invalid pointer arithmetic. */
-#define va_arg(pvar,TYPE) \
-__extension__ \
-(*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \
- || (__builtin_classify_type (*(TYPE*) 0) == __real_type_class \
- && sizeof (TYPE) == 16)) \
- ? ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE *), \
- *(TYPE **) (void *) ((char *)(pvar) - __va_rounded_size (TYPE *))) \
- : __va_rounded_size (TYPE) == 8 \
- ? ({ union {char __d[sizeof (TYPE)]; int __i[2];} __u; \
- __u.__i[0] = ((int *) (void *) (pvar))[0]; \
- __u.__i[1] = ((int *) (void *) (pvar))[1]; \
- (pvar) = (char *)(pvar) + 8; \
- (TYPE *) (void *) __u.__d; }) \
- : ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE), \
- ((TYPE *) (void *) ((char *)(pvar) - __va_rounded_size (TYPE)))));}))
-#endif /* not __arch64__ */
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
diff --git a/gcc/ginclude/va-spur.h b/gcc/ginclude/va-spur.h
deleted file mode 100644
index 7457ceb9fcd..00000000000
--- a/gcc/ginclude/va-spur.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* varargs.h for SPUR */
-
-/* NB. This is NOT the definition needed for the new ANSI proposed
- standard */
-
-
-struct __va_struct { char __regs[20]; };
-
-#define va_alist __va_regs, __va_stack
-
-/* In GCC version 2, we want an ellipsis at the end of the declaration
- of the argument list. GCC version 1 can't parse it. */
-
-#if __GNUC__ > 1
-#define __va_ellipsis ...
-#else
-#define __va_ellipsis
-#endif
-
-/* The ... causes current_function_varargs to be set in cc1. */
-#define va_dcl struct __va_struct __va_regs; int __va_stack;
-
-typedef struct {
- int __pnt;
- char *__regs;
- char *__stack;
-} va_list;
-
-#define va_start(pvar) \
- ((pvar).__pnt = 0, (pvar).__regs = __va_regs.__regs, \
- (pvar).__stack = (char *) &__va_stack)
-#define va_end(pvar) ((void)0)
-
-/* Avoid errors if compiling GCC v2 with GCC v1. */
-#if __GNUC__ == 1
-#define __extension__
-#endif
-
-#define va_arg(pvar,type) \
-__extension__ \
- (*({ type *__va_result; \
- if ((pvar).__pnt >= 20) { \
- __va_result = ( (type *) ((pvar).__stack + (pvar).__pnt - 20)); \
- (pvar).__pnt += (sizeof(type) + 7) & ~7; \
- } \
- else if ((pvar).__pnt + sizeof(type) > 20) { \
- __va_result = (type *) (pvar).__stack; \
- (pvar).__pnt = 20 + ( (sizeof(type) + 7) & ~7); \
- } \
- else if (sizeof(type) == 8) { \
- union {double d; int i[2];} __u; \
- __u.i[0] = *(int *) ((pvar).__regs + (pvar).__pnt); \
- __u.i[1] = *(int *) ((pvar).__regs + (pvar).__pnt + 4); \
- __va_result = (type *) &__u; \
- (pvar).__pnt += 8; \
- } \
- else { \
- __va_result = (type *) ((pvar).__regs + (pvar).__pnt); \
- (pvar).__pnt += (sizeof(type) + 3) & ~3; \
- } \
- __va_result; }))
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
diff --git a/gcc/ginclude/varargs.h b/gcc/ginclude/varargs.h
deleted file mode 100644
index 3630cc007c2..00000000000
--- a/gcc/ginclude/varargs.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/* Record that this is varargs.h; this turns off stdarg.h. */
-
-#ifndef _VARARGS_H
-#define _VARARGS_H
-
-#ifdef __sparc__
-#include "va-sparc.h"
-#else
-#ifdef __spur__
-#include "va-spur.h"
-#else
-#ifdef __mips__
-#include "va-mips.h"
-#else
-#ifdef __i860__
-#include "va-i860.h"
-#else
-#ifdef __pyr__
-#include "va-pyr.h"
-#else
-#ifdef __clipper__
-#include "va-clipper.h"
-#else
-#ifdef __m88k__
-#include "va-m88k.h"
-#else
-#if defined(__hppa__) || defined(hp800)
-#include "va-pa.h"
-#else
-#ifdef __i960__
-#include "va-i960.h"
-#else
-#ifdef __alpha__
-#include "va-alpha.h"
-#else
-#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
-#include "va-h8300.h"
-#else
-#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
-#include "va-ppc.h"
-#else
-#ifdef __M32R__
-#include "va-m32r.h"
-#else
-#ifdef __sh__
-#include "va-sh.h"
-#else
-#ifdef __mn10300__
-#include "va-mn10300.h"
-#else
-
-#ifdef __NeXT__
-
-/* On Next, erase any vestiges of stdarg.h. */
-
-#ifdef _ANSI_STDARG_H_
-#define _VA_LIST_
-#endif
-#define _ANSI_STDARG_H_
-
-#undef va_alist
-#undef va_dcl
-#undef va_list
-#undef va_start
-#undef va_end
-#undef __va_rounded_size
-#undef va_arg
-#endif /* __NeXT__ */
-
-/* In GCC version 2, we want an ellipsis at the end of the declaration
- of the argument list. GCC version 1 can't parse it. */
-
-#if __GNUC__ > 1
-#define __va_ellipsis ...
-#else
-#define __va_ellipsis
-#endif
-
-/* These macros implement traditional (non-ANSI) varargs
- for GNU C. */
-
-#define va_alist __builtin_va_alist
-/* The ... causes current_function_varargs to be set in cc1. */
-#define va_dcl int __builtin_va_alist; __va_ellipsis
-
-/* Define __gnuc_va_list, just as in gstdarg.h. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX)
-typedef char *__gnuc_va_list;
-#else
-typedef void *__gnuc_va_list;
-#endif
-#endif
-
-#define va_start(AP) AP=(char *) &__builtin_va_alist
-
-#define va_end(AP) ((void)0)
-
-#if defined(sysV68)
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
-#else
-#define __va_rounded_size(TYPE) \
- (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-#endif
-
-#if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
-/* This is for little-endian machines; small args are padded upward. */
-#define va_arg(AP, TYPE) \
- (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
- *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
-#else /* big-endian */
-/* This is for big-endian machines; small args are padded downward. */
-#define va_arg(AP, TYPE) \
- (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
- *((TYPE *) (void *) ((char *) (AP) \
- - ((sizeof (TYPE) < __va_rounded_size (char) \
- ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
-#endif /* big-endian */
-
-/* Copy __gnuc_va_list into another variable of this type. */
-#define __va_copy(dest, src) (dest) = (src)
-
-#endif /* not mn10300 */
-#endif /* not sh */
-#endif /* not m32r */
-#endif /* not powerpc with V.4 calling sequence */
-#endif /* not h8300 */
-#endif /* not alpha */
-#endif /* not i960 */
-#endif /* not hppa */
-#endif /* not m88k */
-#endif /* not clipper */
-#endif /* not pyr */
-#endif /* not i860 */
-#endif /* not mips */
-#endif /* not spur */
-#endif /* not sparc */
-#endif /* not _VARARGS_H */
-
-/* Define va_list from __gnuc_va_list. */
-
-#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
-#undef _VA_LIST
-#endif
-
-#if defined(__svr4__) || defined(_SCO_DS)
-/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
- so we must avoid testing it and setting it here.
- SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
- have no conflict with that. */
-#ifndef _VA_LIST_
-#define _VA_LIST_
-#ifdef __i860__
-#ifndef _VA_LIST
-#define _VA_LIST va_list
-#endif
-#endif /* __i860__ */
-typedef __gnuc_va_list va_list;
-#endif /* _VA_LIST_ */
-
-#else /* not __svr4__ || _SCO_DS */
-
-/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
- But on BSD NET2 we must not test or define or undef it.
- (Note that the comments in NET 2's ansi.h
- are incorrect for _VA_LIST_--see stdio.h!) */
-/* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993:
- Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
- use for va_list (``typedef _VA_LIST_ va_list'') */
-#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
-/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
-#ifndef _VA_LIST_DEFINED
-/* The macro _VA_LIST is used in SCO Unix 3.2. */
-#ifndef _VA_LIST
-/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
-#ifndef _VA_LIST_T_H
-typedef __gnuc_va_list va_list;
-#endif /* not _VA_LIST_T_H */
-#endif /* not _VA_LIST */
-#endif /* not _VA_LIST_DEFINED */
-#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
-#define _VA_LIST_
-#endif
-#ifndef _VA_LIST
-#define _VA_LIST
-#endif
-#ifndef _VA_LIST_DEFINED
-#define _VA_LIST_DEFINED
-#endif
-#ifndef _VA_LIST_T_H
-#define _VA_LIST_T_H
-#endif
-
-#endif /* not _VA_LIST_, except on certain systems */
-
-#endif /* not __svr4__ */
-
-/* The next BSD release (if there is one) wants this symbol to be
- undefined instead of _VA_LIST_. */
-#ifdef _BSD_VA_LIST
-#undef _BSD_VA_LIST
-#endif
diff --git a/gcc/glimits.h b/gcc/glimits.h
deleted file mode 100644
index d413427c7d6..00000000000
--- a/gcc/glimits.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef _LIMITS_H___
-#ifndef _MACH_MACHLIMITS_H_
-
-/* _MACH_MACHLIMITS_H_ is used on OSF/1. */
-#define _LIMITS_H___
-#define _MACH_MACHLIMITS_H_
-
-/* Number of bits in a `char'. */
-#undef CHAR_BIT
-#define CHAR_BIT 8
-
-/* Maximum length of a multibyte character. */
-#ifndef MB_LEN_MAX
-#define MB_LEN_MAX 1
-#endif
-
-/* Minimum and maximum values a `signed char' can hold. */
-#undef SCHAR_MIN
-#define SCHAR_MIN (-128)
-#undef SCHAR_MAX
-#define SCHAR_MAX 127
-
-/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
-#undef UCHAR_MAX
-#define UCHAR_MAX 255
-
-/* Minimum and maximum values a `char' can hold. */
-#ifdef __CHAR_UNSIGNED__
-#undef CHAR_MIN
-#define CHAR_MIN 0
-#undef CHAR_MAX
-#define CHAR_MAX 255
-#else
-#undef CHAR_MIN
-#define CHAR_MIN (-128)
-#undef CHAR_MAX
-#define CHAR_MAX 127
-#endif
-
-/* Minimum and maximum values a `signed short int' can hold. */
-#undef SHRT_MIN
-#define SHRT_MIN (-32768)
-#undef SHRT_MAX
-#define SHRT_MAX 32767
-
-/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
-#undef USHRT_MAX
-#define USHRT_MAX 65535
-
-/* Minimum and maximum values a `signed int' can hold. */
-#ifndef __INT_MAX__
-#define __INT_MAX__ 2147483647
-#endif
-#undef INT_MIN
-#define INT_MIN (-INT_MAX-1)
-#undef INT_MAX
-#define INT_MAX __INT_MAX__
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
-#undef UINT_MAX
-#define UINT_MAX (INT_MAX * 2U + 1)
-
-/* Minimum and maximum values a `signed long int' can hold.
- (Same as `int'). */
-#ifndef __LONG_MAX__
-#ifndef __alpha__
-#define __LONG_MAX__ 2147483647L
-#else
-#define __LONG_MAX__ 9223372036854775807L
-# endif /* __alpha__ */
-#endif
-#undef LONG_MIN
-#define LONG_MIN (-LONG_MAX-1)
-#undef LONG_MAX
-#define LONG_MAX __LONG_MAX__
-
-/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
-#undef ULONG_MAX
-#define ULONG_MAX (LONG_MAX * 2UL + 1)
-
-#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
-/* Minimum and maximum values a `signed long long int' can hold. */
-#ifndef __LONG_LONG_MAX__
-#define __LONG_LONG_MAX__ 9223372036854775807LL
-#endif
-#undef LONG_LONG_MIN
-#define LONG_LONG_MIN (-LONG_LONG_MAX-1)
-#undef LONG_LONG_MAX
-#define LONG_LONG_MAX __LONG_LONG_MAX__
-
-/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
-#undef ULONG_LONG_MAX
-#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
-#endif
-
-#endif /* _MACH_MACHLIMITS_H_ */
-#endif /* _LIMITS_H___ */
diff --git a/gcc/global.c b/gcc/global.c
deleted file mode 100644
index a4f5ab18f3b..00000000000
--- a/gcc/global.c
+++ /dev/null
@@ -1,1724 +0,0 @@
-/* Allocate registers for pseudo-registers that span basic blocks.
- Copyright (C) 1987, 1988, 1991, 1994, 1996 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. */
-
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "flags.h"
-#include "basic-block.h"
-#include "hard-reg-set.h"
-#include "regs.h"
-#include "insn-config.h"
-#include "output.h"
-
-/* 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
- in the vector reg_renumber, not by changing the rtl code.
- (Such changes are made by final). The entry point is
- the function global_alloc.
-
- After allocation is complete, the reload pass is run as a subroutine
- of this pass, so that when a pseudo reg loses its hard reg due to
- spilling it is possible to make a second attempt to find a hard
- reg for it. The reload pass is independent in other respects
- and it is run even when stupid register allocation is in use.
-
- 1. count the pseudo-registers still needing allocation
- and assign allocation-numbers (allocnos) to them.
- Set up tables reg_allocno and allocno_reg to map
- reg numbers to allocnos and vice versa.
- max_allocno gets the number of allocnos in use.
-
- 2. Allocate a max_allocno by max_allocno conflict bit matrix and clear it.
- Allocate a max_allocno by FIRST_PSEUDO_REGISTER conflict matrix
- for conflicts between allocnos and explicit hard register use
- (which includes use of pseudo-registers allocated by local_alloc).
-
- 3. for each basic block
- walk forward through the block, recording which
- unallocated registers and which hardware registers are live.
- Build the conflict matrix between the unallocated registers
- and another of unallocated registers versus hardware registers.
- Also record the preferred hardware registers
- for each unallocated one.
-
- 4. Sort a table of the allocnos into order of
- desirability of the variables.
-
- 5. Allocate the variables in that order; each if possible into
- a preferred register, else into another register. */
-
-/* Number of pseudo-registers still requiring allocation
- (not allocated by local_allocate). */
-
-static int max_allocno;
-
-/* Indexed by (pseudo) reg number, gives the allocno, or -1
- for pseudo registers already allocated by local_allocate. */
-
-int *reg_allocno;
-
-/* Indexed by allocno, gives the reg number. */
-
-static int *allocno_reg;
-
-/* A vector of the integers from 0 to max_allocno-1,
- sorted in the order of first-to-be-allocated first. */
-
-static int *allocno_order;
-
-/* Indexed by an allocno, gives the number of consecutive
- hard registers needed by that pseudo reg. */
-
-static int *allocno_size;
-
-/* Indexed by (pseudo) reg number, gives the number of another
- lower-numbered pseudo reg which can share a hard reg with this pseudo
- *even if the two pseudos would otherwise appear to conflict*. */
-
-static int *reg_may_share;
-
-/* Define the number of bits in each element of `conflicts' and what
- type that element has. We use the largest integer format on the
- host machine. */
-
-#define INT_BITS HOST_BITS_PER_WIDE_INT
-#define INT_TYPE HOST_WIDE_INT
-
-/* max_allocno by max_allocno array of bits,
- recording whether two allocno's conflict (can't go in the same
- hardware register).
-
- `conflicts' is not symmetric; a conflict between allocno's i and j
- is recorded either in element i,j or in element j,i. */
-
-static INT_TYPE *conflicts;
-
-/* Number of ints require to hold max_allocno bits.
- This is the length of a row in `conflicts'. */
-
-static int allocno_row_words;
-
-/* Two macros to test or store 1 in an element of `conflicts'. */
-
-#define CONFLICTP(I, J) \
- (conflicts[(I) * allocno_row_words + (J) / INT_BITS] \
- & ((INT_TYPE) 1 << ((J) % INT_BITS)))
-
-#define SET_CONFLICT(I, J) \
- (conflicts[(I) * allocno_row_words + (J) / INT_BITS] \
- |= ((INT_TYPE) 1 << ((J) % INT_BITS)))
-
-/* Set of hard regs currently live (during scan of all insns). */
-
-static HARD_REG_SET hard_regs_live;
-
-/* Indexed by N, set of hard regs conflicting with allocno N. */
-
-static HARD_REG_SET *hard_reg_conflicts;
-
-/* Indexed by N, set of hard regs preferred by allocno N.
- This is used to make allocnos go into regs that are copied to or from them,
- when possible, to reduce register shuffling. */
-
-static HARD_REG_SET *hard_reg_preferences;
-
-/* Similar, but just counts register preferences made in simple copy
- operations, rather than arithmetic. These are given priority because
- we can always eliminate an insn by using these, but using a register
- in the above list won't always eliminate an insn. */
-
-static HARD_REG_SET *hard_reg_copy_preferences;
-
-/* Similar to hard_reg_preferences, but includes bits for subsequent
- registers when an allocno is multi-word. The above variable is used for
- allocation while this is used to build reg_someone_prefers, below. */
-
-static HARD_REG_SET *hard_reg_full_preferences;
-
-/* Indexed by N, set of hard registers that some later allocno has a
- preference for. */
-
-static HARD_REG_SET *regs_someone_prefers;
-
-/* Set of registers that global-alloc isn't supposed to use. */
-
-static HARD_REG_SET no_global_alloc_regs;
-
-/* Set of registers used so far. */
-
-static HARD_REG_SET regs_used_so_far;
-
-/* Number of calls crossed by each allocno. */
-
-static int *allocno_calls_crossed;
-
-/* Number of refs (weighted) to each allocno. */
-
-static int *allocno_n_refs;
-
-/* Guess at live length of each allocno.
- This is actually the max of the live lengths of the regs. */
-
-static int *allocno_live_length;
-
-/* Number of refs (weighted) to each hard reg, as used by local alloc.
- It is zero for a reg that contains global pseudos or is explicitly used. */
-
-static int local_reg_n_refs[FIRST_PSEUDO_REGISTER];
-
-/* Guess at live length of each hard reg, as used by local alloc.
- This is actually the sum of the live lengths of the specific regs. */
-
-static int local_reg_live_length[FIRST_PSEUDO_REGISTER];
-
-/* Test a bit in TABLE, a vector of HARD_REG_SETs,
- for vector element I, and hard register number J. */
-
-#define REGBITP(TABLE, I, J) TEST_HARD_REG_BIT (TABLE[I], J)
-
-/* Set to 1 a bit in a vector of HARD_REG_SETs. Works like REGBITP. */
-
-#define SET_REGBIT(TABLE, I, J) SET_HARD_REG_BIT (TABLE[I], J)
-
-/* Bit mask for allocnos live at current point in the scan. */
-
-static INT_TYPE *allocnos_live;
-
-/* Test, set or clear bit number I in allocnos_live,
- a bit vector indexed by allocno. */
-
-#define ALLOCNO_LIVE_P(I) \
- (allocnos_live[(I) / INT_BITS] & ((INT_TYPE) 1 << ((I) % INT_BITS)))
-
-#define SET_ALLOCNO_LIVE(I) \
- (allocnos_live[(I) / INT_BITS] |= ((INT_TYPE) 1 << ((I) % INT_BITS)))
-
-#define CLEAR_ALLOCNO_LIVE(I) \
- (allocnos_live[(I) / INT_BITS] &= ~((INT_TYPE) 1 << ((I) % INT_BITS)))
-
-/* This is turned off because it doesn't work right for DImode.
- (And it is only used for DImode, so the other cases are worthless.)
- The problem is that it isn't true that there is NO possibility of conflict;
- only that there is no conflict if the two pseudos get the exact same regs.
- If they were allocated with a partial overlap, there would be a conflict.
- We can't safely turn off the conflict unless we have another way to
- prevent the partial overlap.
-
- Idea: change hard_reg_conflicts so that instead of recording which
- hard regs the allocno may not overlap, it records where the allocno
- may not start. Change both where it is used and where it is updated.
- Then there is a way to record that (reg:DI 108) may start at 10
- but not at 9 or 11. There is still the question of how to record
- this semi-conflict between two pseudos. */
-#if 0
-/* Reg pairs for which conflict after the current insn
- is inhibited by a REG_NO_CONFLICT note.
- If the table gets full, we ignore any other notes--that is conservative. */
-#define NUM_NO_CONFLICT_PAIRS 4
-/* Number of pairs in use in this insn. */
-int n_no_conflict_pairs;
-static struct { int allocno1, allocno2;}
- no_conflict_pairs[NUM_NO_CONFLICT_PAIRS];
-#endif /* 0 */
-
-/* Record all regs that are set in any one insn.
- Communication from mark_reg_{store,clobber} and global_conflicts. */
-
-static rtx *regs_set;
-static int n_regs_set;
-
-/* All registers that can be eliminated. */
-
-static HARD_REG_SET eliminable_regset;
-
-static int allocno_compare PROTO((const GENERIC_PTR, const GENERIC_PTR));
-static void global_conflicts PROTO((void));
-static void expand_preferences PROTO((void));
-static void prune_preferences PROTO((void));
-static void find_reg PROTO((int, HARD_REG_SET, int, int, int));
-static void record_one_conflict PROTO((int));
-static void record_conflicts PROTO((short *, int));
-static void mark_reg_store PROTO((rtx, rtx));
-static void mark_reg_clobber PROTO((rtx, rtx));
-static void mark_reg_conflicts PROTO((rtx));
-static void mark_reg_death PROTO((rtx));
-static void mark_reg_live_nc PROTO((int, enum machine_mode));
-static void set_preference PROTO((rtx, rtx));
-static void dump_conflicts PROTO((FILE *));
-
-/* Perform allocation of pseudo-registers not allocated by local_alloc.
- FILE is a file to output debugging information on,
- or zero if such output is not desired.
-
- Return value is nonzero if reload failed
- and we must not do any more for this function. */
-
-int
-global_alloc (file)
- FILE *file;
-{
-#ifdef ELIMINABLE_REGS
- static struct {int from, to; } eliminables[] = ELIMINABLE_REGS;
-#endif
- int need_fp
- = (! flag_omit_frame_pointer
-#ifdef EXIT_IGNORE_STACK
- || (current_function_calls_alloca && EXIT_IGNORE_STACK)
-#endif
- || FRAME_POINTER_REQUIRED);
-
- register int i;
- rtx x;
-
- max_allocno = 0;
-
- /* A machine may have certain hard registers that
- are safe to use only within a basic block. */
-
- CLEAR_HARD_REG_SET (no_global_alloc_regs);
-#ifdef OVERLAPPING_REGNO_P
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (OVERLAPPING_REGNO_P (i))
- SET_HARD_REG_BIT (no_global_alloc_regs, i);
-#endif
-
- /* Build the regset of all eliminable registers and show we can't use those
- that we already know won't be eliminated. */
-#ifdef ELIMINABLE_REGS
- for (i = 0; i < sizeof eliminables / sizeof eliminables[0]; i++)
- {
- SET_HARD_REG_BIT (eliminable_regset, eliminables[i].from);
-
- if (! CAN_ELIMINATE (eliminables[i].from, eliminables[i].to)
- || (eliminables[i].to == STACK_POINTER_REGNUM && need_fp))
- SET_HARD_REG_BIT (no_global_alloc_regs, eliminables[i].from);
- }
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM);
- if (need_fp)
- SET_HARD_REG_BIT (no_global_alloc_regs, HARD_FRAME_POINTER_REGNUM);
-#endif
-
-#else
- SET_HARD_REG_BIT (eliminable_regset, FRAME_POINTER_REGNUM);
- if (need_fp)
- SET_HARD_REG_BIT (no_global_alloc_regs, FRAME_POINTER_REGNUM);
-#endif
-
- /* Track which registers have already been used. Start with registers
- explicitly in the rtl, then registers allocated by local register
- allocation. */
-
- CLEAR_HARD_REG_SET (regs_used_so_far);
-#ifdef LEAF_REGISTERS
- /* If we are doing the leaf function optimization, and this is a leaf
- function, it means that the registers that take work to save are those
- that need a register window. So prefer the ones that can be used in
- a leaf function. */
- {
- char *cheap_regs;
- static char leaf_regs[] = LEAF_REGISTERS;
-
- if (only_leaf_regs_used () && leaf_function_p ())
- cheap_regs = leaf_regs;
- else
- cheap_regs = call_used_regs;
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (regs_ever_live[i] || cheap_regs[i])
- SET_HARD_REG_BIT (regs_used_so_far, i);
- }
-#else
- /* We consider registers that do not have to be saved over calls as if
- they were already used since there is no cost in using them. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (regs_ever_live[i] || call_used_regs[i])
- SET_HARD_REG_BIT (regs_used_so_far, i);
-#endif
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_renumber[i] >= 0)
- SET_HARD_REG_BIT (regs_used_so_far, reg_renumber[i]);
-
- /* Establish mappings from register number to allocation number
- and vice versa. In the process, count the allocnos. */
-
- reg_allocno = (int *) alloca (max_regno * sizeof (int));
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- reg_allocno[i] = -1;
-
- /* Initialize the shared-hard-reg mapping
- from the list of pairs that may share. */
- reg_may_share = (int *) alloca (max_regno * sizeof (int));
- bzero ((char *) reg_may_share, max_regno * sizeof (int));
- for (x = regs_may_share; x; x = XEXP (XEXP (x, 1), 1))
- {
- int r1 = REGNO (XEXP (x, 0));
- int r2 = REGNO (XEXP (XEXP (x, 1), 0));
- if (r1 > r2)
- reg_may_share[r1] = r2;
- else
- reg_may_share[r2] = r1;
- }
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- /* Note that reg_live_length[i] < 0 indicates a "constant" reg
- that we are supposed to refrain from putting in a hard reg.
- -2 means do make an allocno but don't allocate it. */
- if (reg_n_refs[i] != 0 && reg_renumber[i] < 0 && reg_live_length[i] != -1
- /* Don't allocate pseudos that cross calls,
- if this function receives a nonlocal goto. */
- && (! current_function_has_nonlocal_label
- || reg_n_calls_crossed[i] == 0))
- {
- if (reg_may_share[i] && reg_allocno[reg_may_share[i]] >= 0)
- reg_allocno[i] = reg_allocno[reg_may_share[i]];
- else
- reg_allocno[i] = max_allocno++;
- if (reg_live_length[i] == 0)
- abort ();
- }
- else
- reg_allocno[i] = -1;
-
- allocno_reg = (int *) alloca (max_allocno * sizeof (int));
- allocno_size = (int *) alloca (max_allocno * sizeof (int));
- allocno_calls_crossed = (int *) alloca (max_allocno * sizeof (int));
- allocno_n_refs = (int *) alloca (max_allocno * sizeof (int));
- allocno_live_length = (int *) alloca (max_allocno * sizeof (int));
- bzero ((char *) allocno_size, max_allocno * sizeof (int));
- bzero ((char *) allocno_calls_crossed, max_allocno * sizeof (int));
- bzero ((char *) allocno_n_refs, max_allocno * sizeof (int));
- bzero ((char *) allocno_live_length, max_allocno * sizeof (int));
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_allocno[i] >= 0)
- {
- int allocno = reg_allocno[i];
- allocno_reg[allocno] = i;
- allocno_size[allocno] = PSEUDO_REGNO_SIZE (i);
- allocno_calls_crossed[allocno] += reg_n_calls_crossed[i];
- allocno_n_refs[allocno] += reg_n_refs[i];
- if (allocno_live_length[allocno] < reg_live_length[i])
- allocno_live_length[allocno] = reg_live_length[i];
- }
-
- /* Calculate amount of usage of each hard reg by pseudos
- allocated by local-alloc. This is to see if we want to
- override it. */
- bzero ((char *) local_reg_live_length, sizeof local_reg_live_length);
- bzero ((char *) local_reg_n_refs, sizeof local_reg_n_refs);
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_allocno[i] < 0 && reg_renumber[i] >= 0)
- {
- int regno = reg_renumber[i];
- int endregno = regno + HARD_REGNO_NREGS (regno, PSEUDO_REGNO_MODE (i));
- int j;
-
- for (j = regno; j < endregno; j++)
- {
- local_reg_n_refs[j] += reg_n_refs[i];
- local_reg_live_length[j] += reg_live_length[i];
- }
- }
-
- /* 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])
- local_reg_n_refs[i] = 0;
-
- /* Likewise for regs used in a SCRATCH. */
- for (i = 0; i < scratch_list_length; i++)
- if (scratch_list[i])
- {
- int regno = REGNO (scratch_list[i]);
- int lim = regno + HARD_REGNO_NREGS (regno, GET_MODE (scratch_list[i]));
- int j;
-
- for (j = regno; j < lim; j++)
- local_reg_n_refs[j] = 0;
- }
-
- /* Allocate the space for the conflict and preference tables and
- initialize them. */
-
- hard_reg_conflicts
- = (HARD_REG_SET *) alloca (max_allocno * sizeof (HARD_REG_SET));
- bzero ((char *) hard_reg_conflicts, max_allocno * sizeof (HARD_REG_SET));
-
- hard_reg_preferences
- = (HARD_REG_SET *) alloca (max_allocno * sizeof (HARD_REG_SET));
- bzero ((char *) hard_reg_preferences, max_allocno * sizeof (HARD_REG_SET));
-
- hard_reg_copy_preferences
- = (HARD_REG_SET *) alloca (max_allocno * sizeof (HARD_REG_SET));
- bzero ((char *) hard_reg_copy_preferences,
- max_allocno * sizeof (HARD_REG_SET));
-
- hard_reg_full_preferences
- = (HARD_REG_SET *) alloca (max_allocno * sizeof (HARD_REG_SET));
- bzero ((char *) hard_reg_full_preferences,
- max_allocno * sizeof (HARD_REG_SET));
-
- regs_someone_prefers
- = (HARD_REG_SET *) alloca (max_allocno * sizeof (HARD_REG_SET));
- bzero ((char *) regs_someone_prefers, max_allocno * sizeof (HARD_REG_SET));
-
- allocno_row_words = (max_allocno + INT_BITS - 1) / INT_BITS;
-
- conflicts = (INT_TYPE *) alloca (max_allocno * allocno_row_words
- * sizeof (INT_TYPE));
- bzero ((char *) conflicts,
- max_allocno * allocno_row_words * sizeof (INT_TYPE));
-
- allocnos_live = (INT_TYPE *) alloca (allocno_row_words * sizeof (INT_TYPE));
-
- /* If there is work to be done (at least one reg to allocate),
- perform global conflict analysis and allocate the regs. */
-
- if (max_allocno > 0)
- {
- /* Scan all the insns and compute the conflicts among allocnos
- and between allocnos and hard regs. */
-
- global_conflicts ();
-
- /* Eliminate conflicts between pseudos and eliminable registers. If
- the register is not eliminated, the pseudo won't really be able to
- live in the eliminable register, so the conflict doesn't matter.
- If we do eliminate the register, the conflict will no longer exist.
- So in either case, we can ignore the conflict. Likewise for
- preferences. */
-
- for (i = 0; i < max_allocno; i++)
- {
- AND_COMPL_HARD_REG_SET (hard_reg_conflicts[i], eliminable_regset);
- AND_COMPL_HARD_REG_SET (hard_reg_copy_preferences[i],
- eliminable_regset);
- AND_COMPL_HARD_REG_SET (hard_reg_preferences[i], eliminable_regset);
- }
-
- /* Try to expand the preferences by merging them between allocnos. */
-
- expand_preferences ();
-
- /* Determine the order to allocate the remaining pseudo registers. */
-
- allocno_order = (int *) alloca (max_allocno * sizeof (int));
- for (i = 0; i < max_allocno; i++)
- allocno_order[i] = i;
-
- /* Default the size to 1, since allocno_compare uses it to divide by.
- Also convert allocno_live_length of zero to -1. A length of zero
- can occur when all the registers for that allocno have reg_live_length
- equal to -2. In this case, we want to make an allocno, but not
- allocate it. So avoid the divide-by-zero and set it to a low
- priority. */
-
- for (i = 0; i < max_allocno; i++)
- {
- if (allocno_size[i] == 0)
- allocno_size[i] = 1;
- if (allocno_live_length[i] == 0)
- allocno_live_length[i] = -1;
- }
-
- qsort (allocno_order, max_allocno, sizeof (int), allocno_compare);
-
- prune_preferences ();
-
- if (file)
- dump_conflicts (file);
-
- /* Try allocating them, one by one, in that order,
- except for parameters marked with reg_live_length[regno] == -2. */
-
- for (i = 0; i < max_allocno; i++)
- if (reg_live_length[allocno_reg[allocno_order[i]]] >= 0)
- {
- /* If we have more than one register class,
- first try allocating in the class that is cheapest
- for this pseudo-reg. If that fails, try any reg. */
- if (N_REG_CLASSES > 1)
- {
- find_reg (allocno_order[i], HARD_CONST (0), 0, 0, 0);
- if (reg_renumber[allocno_reg[allocno_order[i]]] >= 0)
- continue;
- }
- if (reg_alternate_class (allocno_reg[allocno_order[i]]) != NO_REGS)
- find_reg (allocno_order[i], HARD_CONST (0), 1, 0, 0);
- }
- }
-
- /* Do the reloads now while the allocno data still exist, so that we can
- try to assign new hard regs to any pseudo regs that are spilled. */
-
-#if 0 /* We need to eliminate regs even if there is no rtl code,
- for the sake of debugging information. */
- if (n_basic_blocks > 0)
-#endif
- return reload (get_insns (), 1, file);
-}
-
-/* Sort predicate for ordering the allocnos.
- Returns -1 (1) if *v1 should be allocated before (after) *v2. */
-
-static int
-allocno_compare (v1p, v2p)
- const GENERIC_PTR v1p;
- const GENERIC_PTR v2p;
-{
- int v1 = *(int *)v1p, v2 = *(int *)v2p;
- /* Note that the quotient will never be bigger than
- the value of floor_log2 times the maximum number of
- times a register can occur in one insn (surely less than 100).
- Multiplying this by 10000 can't overflow. */
- register int pri1
- = (((double) (floor_log2 (allocno_n_refs[v1]) * allocno_n_refs[v1])
- / allocno_live_length[v1])
- * 10000 * allocno_size[v1]);
- register int pri2
- = (((double) (floor_log2 (allocno_n_refs[v2]) * allocno_n_refs[v2])
- / allocno_live_length[v2])
- * 10000 * allocno_size[v2]);
- if (pri2 - pri1)
- return pri2 - pri1;
-
- /* If regs are equally good, sort by allocno,
- so that the results of qsort leave nothing to chance. */
- return v1 - v2;
-}
-
-/* Scan the rtl code and record all conflicts and register preferences in the
- conflict matrices and preference tables. */
-
-static void
-global_conflicts ()
-{
- register int b, i;
- register rtx insn;
- short *block_start_allocnos;
-
- /* Make a vector that mark_reg_{store,clobber} will store in. */
- regs_set = (rtx *) alloca (max_parallel * sizeof (rtx) * 2);
-
- block_start_allocnos = (short *) alloca (max_allocno * sizeof (short));
-
- for (b = 0; b < n_basic_blocks; b++)
- {
- bzero ((char *) allocnos_live, allocno_row_words * sizeof (INT_TYPE));
-
- /* Initialize table of registers currently live
- to the state at the beginning of this basic block.
- This also marks the conflicts among them.
-
- For pseudo-regs, there is only one bit for each one
- no matter how many hard regs it occupies.
- This is ok; we know the size from PSEUDO_REGNO_SIZE.
- For explicit hard regs, we cannot know the size that way
- since one hard reg can be used with various sizes.
- Therefore, we must require that all the hard regs
- implicitly live as part of a multi-word hard reg
- are explicitly marked in basic_block_live_at_start. */
-
- {
- register int offset;
- REGSET_ELT_TYPE bit;
- register regset old = basic_block_live_at_start[b];
- int ax = 0;
-
-#ifdef HARD_REG_SET
- hard_regs_live = old[0];
-#else
- COPY_HARD_REG_SET (hard_regs_live, old);
-#endif
- for (offset = 0, i = 0; offset < regset_size; offset++)
- if (old[offset] == 0)
- i += REGSET_ELT_BITS;
- else
- for (bit = 1; bit; bit <<= 1, i++)
- {
- if (i >= max_regno)
- break;
- if (old[offset] & bit)
- {
- register int a = reg_allocno[i];
- if (a >= 0)
- {
- SET_ALLOCNO_LIVE (a);
- block_start_allocnos[ax++] = a;
- }
- else if ((a = reg_renumber[i]) >= 0)
- mark_reg_live_nc (a, PSEUDO_REGNO_MODE (i));
- }
- }
-
- /* Record that each allocno now live conflicts with each other
- allocno now live, and with each hard reg now live. */
-
- record_conflicts (block_start_allocnos, ax);
- }
-
- insn = basic_block_head[b];
-
- /* Scan the code of this basic block, noting which allocnos
- and hard regs are born or die. When one is born,
- record a conflict with all others currently live. */
-
- while (1)
- {
- register RTX_CODE code = GET_CODE (insn);
- register rtx link;
-
- /* Make regs_set an empty set. */
-
- n_regs_set = 0;
-
- if (code == INSN || code == CALL_INSN || code == JUMP_INSN)
- {
-
-#if 0
- int i = 0;
- for (link = REG_NOTES (insn);
- link && i < NUM_NO_CONFLICT_PAIRS;
- link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_NO_CONFLICT)
- {
- no_conflict_pairs[i].allocno1
- = reg_allocno[REGNO (SET_DEST (PATTERN (insn)))];
- no_conflict_pairs[i].allocno2
- = reg_allocno[REGNO (XEXP (link, 0))];
- i++;
- }
-#endif /* 0 */
-
- /* Mark any registers clobbered by INSN as live,
- so they conflict with the inputs. */
-
- note_stores (PATTERN (insn), mark_reg_clobber);
-
- /* Mark any registers dead after INSN as dead now. */
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_DEAD)
- mark_reg_death (XEXP (link, 0));
-
- /* Mark any registers set in INSN as live,
- and mark them as conflicting with all other live regs.
- Clobbers are processed again, so they conflict with
- the registers that are set. */
-
- note_stores (PATTERN (insn), mark_reg_store);
-
-#ifdef AUTO_INC_DEC
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC)
- mark_reg_store (XEXP (link, 0), NULL_RTX);
-#endif
-
- /* If INSN has multiple outputs, then any reg that dies here
- and is used inside of an output
- must conflict with the other outputs. */
-
- if (GET_CODE (PATTERN (insn)) == PARALLEL && !single_set (insn))
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_DEAD)
- {
- int used_in_output = 0;
- int i;
- rtx reg = XEXP (link, 0);
-
- for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
- {
- rtx set = XVECEXP (PATTERN (insn), 0, i);
- if (GET_CODE (set) == SET
- && GET_CODE (SET_DEST (set)) != REG
- && !rtx_equal_p (reg, SET_DEST (set))
- && reg_overlap_mentioned_p (reg, SET_DEST (set)))
- used_in_output = 1;
- }
- if (used_in_output)
- mark_reg_conflicts (reg);
- }
-
- /* Mark any registers set in INSN and then never used. */
-
- while (n_regs_set > 0)
- if (find_regno_note (insn, REG_UNUSED,
- REGNO (regs_set[--n_regs_set])))
- mark_reg_death (regs_set[n_regs_set]);
- }
-
- if (insn == basic_block_end[b])
- break;
- insn = NEXT_INSN (insn);
- }
- }
-}
-/* Expand the preference information by looking for cases where one allocno
- dies in an insn that sets an allocno. If those two allocnos don't conflict,
- merge any preferences between those allocnos. */
-
-static void
-expand_preferences ()
-{
- rtx insn;
- rtx link;
- rtx set;
-
- /* We only try to handle the most common cases here. Most of the cases
- where this wins are reg-reg copies. */
-
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && (set = single_set (insn)) != 0
- && GET_CODE (SET_DEST (set)) == REG
- && reg_allocno[REGNO (SET_DEST (set))] >= 0)
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_DEAD
- && GET_CODE (XEXP (link, 0)) == REG
- && reg_allocno[REGNO (XEXP (link, 0))] >= 0
- && ! CONFLICTP (reg_allocno[REGNO (SET_DEST (set))],
- reg_allocno[REGNO (XEXP (link, 0))])
- && ! CONFLICTP (reg_allocno[REGNO (XEXP (link, 0))],
- reg_allocno[REGNO (SET_DEST (set))]))
- {
- int a1 = reg_allocno[REGNO (SET_DEST (set))];
- int a2 = reg_allocno[REGNO (XEXP (link, 0))];
-
- if (XEXP (link, 0) == SET_SRC (set))
- {
- IOR_HARD_REG_SET (hard_reg_copy_preferences[a1],
- hard_reg_copy_preferences[a2]);
- IOR_HARD_REG_SET (hard_reg_copy_preferences[a2],
- hard_reg_copy_preferences[a1]);
- }
-
- IOR_HARD_REG_SET (hard_reg_preferences[a1],
- hard_reg_preferences[a2]);
- IOR_HARD_REG_SET (hard_reg_preferences[a2],
- hard_reg_preferences[a1]);
- IOR_HARD_REG_SET (hard_reg_full_preferences[a1],
- hard_reg_full_preferences[a2]);
- IOR_HARD_REG_SET (hard_reg_full_preferences[a2],
- hard_reg_full_preferences[a1]);
- }
-}
-
-/* Prune the preferences for global registers to exclude registers that cannot
- be used.
-
- Compute `regs_someone_prefers', which is a bitmask of the hard registers
- that are preferred by conflicting registers of lower priority. If possible,
- we will avoid using these registers. */
-
-static void
-prune_preferences ()
-{
- int i, j;
- int allocno;
-
- /* Scan least most important to most important.
- For each allocno, remove from preferences registers that cannot be used,
- either because of conflicts or register type. Then compute all registers
- preferred by each lower-priority register that conflicts. */
-
- for (i = max_allocno - 1; i >= 0; i--)
- {
- HARD_REG_SET temp;
-
- allocno = allocno_order[i];
- COPY_HARD_REG_SET (temp, hard_reg_conflicts[allocno]);
-
- if (allocno_calls_crossed[allocno] == 0)
- IOR_HARD_REG_SET (temp, fixed_reg_set);
- else
- IOR_HARD_REG_SET (temp, call_used_reg_set);
-
- IOR_COMPL_HARD_REG_SET
- (temp,
- reg_class_contents[(int) reg_preferred_class (allocno_reg[allocno])]);
-
- AND_COMPL_HARD_REG_SET (hard_reg_preferences[allocno], temp);
- AND_COMPL_HARD_REG_SET (hard_reg_copy_preferences[allocno], temp);
- AND_COMPL_HARD_REG_SET (hard_reg_full_preferences[allocno], temp);
-
- CLEAR_HARD_REG_SET (regs_someone_prefers[allocno]);
-
- /* Merge in the preferences of lower-priority registers (they have
- already been pruned). If we also prefer some of those registers,
- don't exclude them unless we are of a smaller size (in which case
- we want to give the lower-priority allocno the first chance for
- these registers). */
- for (j = i + 1; j < max_allocno; j++)
- if (CONFLICTP (allocno, allocno_order[j])
- || CONFLICTP (allocno_order[j], allocno))
- {
- COPY_HARD_REG_SET (temp,
- hard_reg_full_preferences[allocno_order[j]]);
- if (allocno_size[allocno_order[j]] <= allocno_size[allocno])
- AND_COMPL_HARD_REG_SET (temp,
- hard_reg_full_preferences[allocno]);
-
- IOR_HARD_REG_SET (regs_someone_prefers[allocno], temp);
- }
- }
-}
-
-/* Assign a hard register to ALLOCNO; look for one that is the beginning
- of a long enough stretch of hard regs none of which conflicts with ALLOCNO.
- The registers marked in PREFREGS are tried first.
-
- LOSERS, if non-zero, is a HARD_REG_SET indicating registers that cannot
- be used for this allocation.
-
- If ALT_REGS_P is zero, consider only the preferred class of ALLOCNO's reg.
- Otherwise ignore that preferred class and use the alternate class.
-
- If ACCEPT_CALL_CLOBBERED is nonzero, accept a call-clobbered hard reg that
- will have to be saved and restored at calls.
-
- RETRYING is nonzero if this is called from retry_global_alloc.
-
- If we find one, record it in reg_renumber.
- If not, do nothing. */
-
-static void
-find_reg (allocno, losers, alt_regs_p, accept_call_clobbered, retrying)
- int allocno;
- HARD_REG_SET losers;
- int alt_regs_p;
- int accept_call_clobbered;
- int retrying;
-{
- register int i, best_reg, pass;
-#ifdef HARD_REG_SET
- register /* Declare it register if it's a scalar. */
-#endif
- HARD_REG_SET used, used1, used2;
-
- enum reg_class class = (alt_regs_p
- ? reg_alternate_class (allocno_reg[allocno])
- : reg_preferred_class (allocno_reg[allocno]));
- enum machine_mode mode = PSEUDO_REGNO_MODE (allocno_reg[allocno]);
-
- if (accept_call_clobbered)
- COPY_HARD_REG_SET (used1, call_fixed_reg_set);
- else if (allocno_calls_crossed[allocno] == 0)
- COPY_HARD_REG_SET (used1, fixed_reg_set);
- else
- COPY_HARD_REG_SET (used1, call_used_reg_set);
-
- /* Some registers should not be allocated in global-alloc. */
- IOR_HARD_REG_SET (used1, no_global_alloc_regs);
- if (losers)
- IOR_HARD_REG_SET (used1, losers);
-
- IOR_COMPL_HARD_REG_SET (used1, reg_class_contents[(int) class]);
- COPY_HARD_REG_SET (used2, used1);
-
- IOR_HARD_REG_SET (used1, hard_reg_conflicts[allocno]);
-
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- if (reg_changes_size[allocno_reg[allocno]])
- IOR_HARD_REG_SET (used1,
- reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE]);
-#endif
-
- /* Try each hard reg to see if it fits. Do this in two passes.
- In the first pass, skip registers that are preferred by some other pseudo
- to give it a better chance of getting one of those registers. Only if
- we can't get a register when excluding those do we take one of them.
- However, we never allocate a register for the first time in pass 0. */
-
- COPY_HARD_REG_SET (used, used1);
- IOR_COMPL_HARD_REG_SET (used, regs_used_so_far);
- IOR_HARD_REG_SET (used, regs_someone_prefers[allocno]);
-
- best_reg = -1;
- for (i = FIRST_PSEUDO_REGISTER, pass = 0;
- pass <= 1 && i >= FIRST_PSEUDO_REGISTER;
- pass++)
- {
- if (pass == 1)
- COPY_HARD_REG_SET (used, used1);
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
-#ifdef REG_ALLOC_ORDER
- int regno = reg_alloc_order[i];
-#else
- int regno = i;
-#endif
- if (! TEST_HARD_REG_BIT (used, regno)
- && HARD_REGNO_MODE_OK (regno, mode))
- {
- register int j;
- register int lim = regno + HARD_REGNO_NREGS (regno, mode);
- for (j = regno + 1;
- (j < lim
- && ! TEST_HARD_REG_BIT (used, j));
- j++);
- if (j == lim)
- {
- best_reg = regno;
- break;
- }
-#ifndef REG_ALLOC_ORDER
- i = j; /* Skip starting points we know will lose */
-#endif
- }
- }
- }
-
- /* See if there is a preferred register with the same class as the register
- we allocated above. Making this restriction prevents register
- preferencing from creating worse register allocation.
-
- Remove from the preferred registers and conflicting registers. Note that
- additional conflicts may have been added after `prune_preferences' was
- called.
-
- First do this for those register with copy preferences, then all
- preferred registers. */
-
- AND_COMPL_HARD_REG_SET (hard_reg_copy_preferences[allocno], used);
- GO_IF_HARD_REG_SUBSET (hard_reg_copy_preferences[allocno],
- reg_class_contents[(int) NO_REGS], no_copy_prefs);
-
- if (best_reg >= 0)
- {
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (TEST_HARD_REG_BIT (hard_reg_copy_preferences[allocno], i)
- && HARD_REGNO_MODE_OK (i, mode)
- && (REGNO_REG_CLASS (i) == REGNO_REG_CLASS (best_reg)
- || reg_class_subset_p (REGNO_REG_CLASS (i),
- REGNO_REG_CLASS (best_reg))
- || reg_class_subset_p (REGNO_REG_CLASS (best_reg),
- REGNO_REG_CLASS (i))))
- {
- register int j;
- register int lim = i + HARD_REGNO_NREGS (i, mode);
- for (j = i + 1;
- (j < lim
- && ! TEST_HARD_REG_BIT (used, j)
- && (REGNO_REG_CLASS (j)
- == REGNO_REG_CLASS (best_reg + (j - i))
- || reg_class_subset_p (REGNO_REG_CLASS (j),
- REGNO_REG_CLASS (best_reg + (j - i)))
- || reg_class_subset_p (REGNO_REG_CLASS (best_reg + (j - i)),
- REGNO_REG_CLASS (j))));
- j++);
- if (j == lim)
- {
- best_reg = i;
- goto no_prefs;
- }
- }
- }
- no_copy_prefs:
-
- AND_COMPL_HARD_REG_SET (hard_reg_preferences[allocno], used);
- GO_IF_HARD_REG_SUBSET (hard_reg_preferences[allocno],
- reg_class_contents[(int) NO_REGS], no_prefs);
-
- if (best_reg >= 0)
- {
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (TEST_HARD_REG_BIT (hard_reg_preferences[allocno], i)
- && HARD_REGNO_MODE_OK (i, mode)
- && (REGNO_REG_CLASS (i) == REGNO_REG_CLASS (best_reg)
- || reg_class_subset_p (REGNO_REG_CLASS (i),
- REGNO_REG_CLASS (best_reg))
- || reg_class_subset_p (REGNO_REG_CLASS (best_reg),
- REGNO_REG_CLASS (i))))
- {
- register int j;
- register int lim = i + HARD_REGNO_NREGS (i, mode);
- for (j = i + 1;
- (j < lim
- && ! TEST_HARD_REG_BIT (used, j)
- && (REGNO_REG_CLASS (j)
- == REGNO_REG_CLASS (best_reg + (j - i))
- || reg_class_subset_p (REGNO_REG_CLASS (j),
- REGNO_REG_CLASS (best_reg + (j - i)))
- || reg_class_subset_p (REGNO_REG_CLASS (best_reg + (j - i)),
- REGNO_REG_CLASS (j))));
- j++);
- if (j == lim)
- {
- best_reg = i;
- break;
- }
- }
- }
- no_prefs:
-
- /* If we haven't succeeded yet, try with caller-saves.
- We need not check to see if the current function has nonlocal
- labels because we don't put any pseudos that are live over calls in
- registers in that case. */
-
- if (flag_caller_saves && best_reg < 0)
- {
- /* Did not find a register. If it would be profitable to
- allocate a call-clobbered register and save and restore it
- around calls, do that. */
- if (! accept_call_clobbered
- && allocno_calls_crossed[allocno] != 0
- && CALLER_SAVE_PROFITABLE (allocno_n_refs[allocno],
- allocno_calls_crossed[allocno]))
- {
- HARD_REG_SET new_losers;
- if (! losers)
- CLEAR_HARD_REG_SET (new_losers);
- else
- COPY_HARD_REG_SET (new_losers, losers);
-
- IOR_HARD_REG_SET(new_losers, losing_caller_save_reg_set);
- find_reg (allocno, new_losers, alt_regs_p, 1, retrying);
- if (reg_renumber[allocno_reg[allocno]] >= 0)
- {
- caller_save_needed = 1;
- return;
- }
- }
- }
-
- /* If we haven't succeeded yet,
- see if some hard reg that conflicts with us
- was utilized poorly by local-alloc.
- If so, kick out the regs that were put there by local-alloc
- so we can use it instead. */
- if (best_reg < 0 && !retrying
- /* Let's not bother with multi-reg allocnos. */
- && allocno_size[allocno] == 1)
- {
- /* Count from the end, to find the least-used ones first. */
- for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--)
- {
-#ifdef REG_ALLOC_ORDER
- int regno = reg_alloc_order[i];
-#else
- int regno = i;
-#endif
-
- if (local_reg_n_refs[regno] != 0
- /* Don't use a reg no good for this pseudo. */
- && ! TEST_HARD_REG_BIT (used2, regno)
- && HARD_REGNO_MODE_OK (regno, mode)
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- && ! (reg_changes_size[allocno_reg[allocno]]
- && (TEST_HARD_REG_BIT
- (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE],
- regno)))
-#endif
- )
- {
- /* We explicitly evaluate the divide results into temporary
- variables so as to avoid excess precision problems that occur
- on a i386-unknown-sysv4.2 (unixware) host. */
-
- double tmp1 = ((double) local_reg_n_refs[regno]
- / local_reg_live_length[regno]);
- double tmp2 = ((double) allocno_n_refs[allocno]
- / allocno_live_length[allocno]);
-
- if (tmp1 < tmp2)
- {
- /* Hard reg REGNO was used less in total by local regs
- than it would be used by this one allocno! */
- int k;
- for (k = 0; k < max_regno; k++)
- if (reg_renumber[k] >= 0)
- {
- int r = reg_renumber[k];
- int endregno
- = r + HARD_REGNO_NREGS (r, PSEUDO_REGNO_MODE (k));
-
- if (regno >= r && regno < endregno)
- reg_renumber[k] = -1;
- }
-
- best_reg = regno;
- break;
- }
- }
- }
- }
-
- /* Did we find a register? */
-
- if (best_reg >= 0)
- {
- register int lim, j;
- HARD_REG_SET this_reg;
-
- /* Yes. Record it as the hard register of this pseudo-reg. */
- reg_renumber[allocno_reg[allocno]] = best_reg;
- /* Also of any pseudo-regs that share with it. */
- if (reg_may_share[allocno_reg[allocno]])
- for (j = FIRST_PSEUDO_REGISTER; j < max_regno; j++)
- if (reg_allocno[j] == allocno)
- reg_renumber[j] = best_reg;
-
- /* Make a set of the hard regs being allocated. */
- CLEAR_HARD_REG_SET (this_reg);
- lim = best_reg + HARD_REGNO_NREGS (best_reg, mode);
- for (j = best_reg; j < lim; j++)
- {
- SET_HARD_REG_BIT (this_reg, j);
- 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;
- }
- /* For each other pseudo-reg conflicting with this one,
- mark it as conflicting with the hard regs this one occupies. */
- lim = allocno;
- for (j = 0; j < max_allocno; j++)
- if (CONFLICTP (lim, j) || CONFLICTP (j, lim))
- {
- IOR_HARD_REG_SET (hard_reg_conflicts[j], this_reg);
- }
- }
-}
-
-/* Called from `reload' to look for a hard reg to put pseudo reg REGNO in.
- Perhaps it had previously seemed not worth a hard reg,
- or perhaps its old hard reg has been commandeered for reloads.
- FORBIDDEN_REGS indicates certain hard regs that may not be used, even if
- they do not appear to be allocated.
- If FORBIDDEN_REGS is zero, no regs are forbidden. */
-
-void
-retry_global_alloc (regno, forbidden_regs)
- int regno;
- HARD_REG_SET forbidden_regs;
-{
- int allocno = reg_allocno[regno];
- if (allocno >= 0)
- {
- /* If we have more than one register class,
- first try allocating in the class that is cheapest
- for this pseudo-reg. If that fails, try any reg. */
- if (N_REG_CLASSES > 1)
- find_reg (allocno, forbidden_regs, 0, 0, 1);
- if (reg_renumber[regno] < 0
- && reg_alternate_class (regno) != NO_REGS)
- find_reg (allocno, forbidden_regs, 1, 0, 1);
-
- /* If we found a register, modify the RTL for the register to
- show the hard register, and mark that register live. */
- if (reg_renumber[regno] >= 0)
- {
- REGNO (regno_reg_rtx[regno]) = reg_renumber[regno];
- mark_home_live (regno);
- }
- }
-}
-
-/* Record a conflict between register REGNO
- and everything currently live.
- REGNO must not be a pseudo reg that was allocated
- by local_alloc; such numbers must be translated through
- reg_renumber before calling here. */
-
-static void
-record_one_conflict (regno)
- int regno;
-{
- register int j;
-
- if (regno < FIRST_PSEUDO_REGISTER)
- /* When a hard register becomes live,
- record conflicts with live pseudo regs. */
- for (j = 0; j < max_allocno; j++)
- {
- if (ALLOCNO_LIVE_P (j))
- SET_HARD_REG_BIT (hard_reg_conflicts[j], regno);
- }
- else
- /* When a pseudo-register becomes live,
- record conflicts first with hard regs,
- then with other pseudo regs. */
- {
- register int ialloc = reg_allocno[regno];
- register int ialloc_prod = ialloc * allocno_row_words;
- IOR_HARD_REG_SET (hard_reg_conflicts[ialloc], hard_regs_live);
- for (j = allocno_row_words - 1; j >= 0; j--)
- {
-#if 0
- int k;
- for (k = 0; k < n_no_conflict_pairs; k++)
- if (! ((j == no_conflict_pairs[k].allocno1
- && ialloc == no_conflict_pairs[k].allocno2)
- ||
- (j == no_conflict_pairs[k].allocno2
- && ialloc == no_conflict_pairs[k].allocno1)))
-#endif /* 0 */
- conflicts[ialloc_prod + j] |= allocnos_live[j];
- }
- }
-}
-
-/* Record all allocnos currently live as conflicting
- with each other and with all hard regs currently live.
- ALLOCNO_VEC is a vector of LEN allocnos, all allocnos that
- are currently live. Their bits are also flagged in allocnos_live. */
-
-static void
-record_conflicts (allocno_vec, len)
- register short *allocno_vec;
- register int len;
-{
- register int allocno;
- register int j;
- register int ialloc_prod;
-
- while (--len >= 0)
- {
- allocno = allocno_vec[len];
- ialloc_prod = allocno * allocno_row_words;
- IOR_HARD_REG_SET (hard_reg_conflicts[allocno], hard_regs_live);
- for (j = allocno_row_words - 1; j >= 0; j--)
- conflicts[ialloc_prod + j] |= allocnos_live[j];
- }
-}
-
-/* Handle the case where REG is set by the insn being scanned,
- during the forward scan to accumulate conflicts.
- Store a 1 in regs_live or allocnos_live for this register, record how many
- consecutive hardware registers it actually needs,
- and record a conflict with all other registers already live.
-
- Note that even if REG does not remain alive after this insn,
- we must mark it here as live, to ensure a conflict between
- REG and any other regs set in this insn that really do live.
- This is because those other regs could be considered after this.
-
- REG might actually be something other than a register;
- if so, we do nothing.
-
- SETTER is 0 if this register was modified by an auto-increment (i.e.,
- a REG_INC note was found for it).
-
- CLOBBERs are processed here by calling mark_reg_clobber. */
-
-static void
-mark_reg_store (orig_reg, setter)
- rtx orig_reg, setter;
-{
- register int regno;
- register rtx reg = orig_reg;
-
- /* WORD is which word of a multi-register group is being stored.
- For the case where the store is actually into a SUBREG of REG.
- Except we don't use it; I believe the entire REG needs to be
- made live. */
- int word = 0;
-
- if (GET_CODE (reg) == SUBREG)
- {
- word = SUBREG_WORD (reg);
- reg = SUBREG_REG (reg);
- }
-
- if (GET_CODE (reg) != REG)
- return;
-
- if (setter && GET_CODE (setter) == CLOBBER)
- {
- /* A clobber of a register should be processed here too. */
- mark_reg_clobber (orig_reg, setter);
- return;
- }
-
- regs_set[n_regs_set++] = reg;
-
- if (setter)
- set_preference (reg, SET_SRC (setter));
-
- regno = REGNO (reg);
-
- if (reg_renumber[regno] >= 0)
- regno = reg_renumber[regno] /* + word */;
-
- /* Either this is one of the max_allocno pseudo regs not allocated,
- or it is or has a hardware reg. First handle the pseudo-regs. */
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- if (reg_allocno[regno] >= 0)
- {
- SET_ALLOCNO_LIVE (reg_allocno[regno]);
- record_one_conflict (regno);
- }
- }
- /* Handle hardware regs (and pseudos allocated to hard regs). */
- else if (! fixed_regs[regno])
- {
- register int last = regno + HARD_REGNO_NREGS (regno, GET_MODE (reg));
- while (regno < last)
- {
- record_one_conflict (regno);
- SET_HARD_REG_BIT (hard_regs_live, regno);
- regno++;
- }
- }
-}
-
-/* Like mark_reg_set except notice just CLOBBERs; ignore SETs. */
-
-static void
-mark_reg_clobber (reg, setter)
- rtx reg, setter;
-{
- register int regno;
-
- /* WORD is which word of a multi-register group is being stored.
- For the case where the store is actually into a SUBREG of REG.
- Except we don't use it; I believe the entire REG needs to be
- made live. */
- int word = 0;
-
- if (GET_CODE (setter) != CLOBBER)
- return;
-
- if (GET_CODE (reg) == SUBREG)
- {
- word = SUBREG_WORD (reg);
- reg = SUBREG_REG (reg);
- }
-
- if (GET_CODE (reg) != REG)
- return;
-
- regs_set[n_regs_set++] = reg;
-
- regno = REGNO (reg);
-
- if (reg_renumber[regno] >= 0)
- regno = reg_renumber[regno] /* + word */;
-
- /* Either this is one of the max_allocno pseudo regs not allocated,
- or it is or has a hardware reg. First handle the pseudo-regs. */
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- if (reg_allocno[regno] >= 0)
- {
- SET_ALLOCNO_LIVE (reg_allocno[regno]);
- record_one_conflict (regno);
- }
- }
- /* Handle hardware regs (and pseudos allocated to hard regs). */
- else if (! fixed_regs[regno])
- {
- register int last = regno + HARD_REGNO_NREGS (regno, GET_MODE (reg));
- while (regno < last)
- {
- record_one_conflict (regno);
- SET_HARD_REG_BIT (hard_regs_live, regno);
- regno++;
- }
- }
-}
-
-/* Record that REG has conflicts with all the regs currently live.
- Do not mark REG itself as live. */
-
-static void
-mark_reg_conflicts (reg)
- rtx reg;
-{
- register int regno;
-
- if (GET_CODE (reg) == SUBREG)
- reg = SUBREG_REG (reg);
-
- if (GET_CODE (reg) != REG)
- return;
-
- regno = REGNO (reg);
-
- if (reg_renumber[regno] >= 0)
- regno = reg_renumber[regno];
-
- /* Either this is one of the max_allocno pseudo regs not allocated,
- or it is or has a hardware reg. First handle the pseudo-regs. */
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- if (reg_allocno[regno] >= 0)
- record_one_conflict (regno);
- }
- /* Handle hardware regs (and pseudos allocated to hard regs). */
- else if (! fixed_regs[regno])
- {
- register int last = regno + HARD_REGNO_NREGS (regno, GET_MODE (reg));
- while (regno < last)
- {
- record_one_conflict (regno);
- regno++;
- }
- }
-}
-
-/* Mark REG as being dead (following the insn being scanned now).
- Store a 0 in regs_live or allocnos_live for this register. */
-
-static void
-mark_reg_death (reg)
- rtx reg;
-{
- register int regno = REGNO (reg);
-
- /* For pseudo reg, see if it has been assigned a hardware reg. */
- if (reg_renumber[regno] >= 0)
- regno = reg_renumber[regno];
-
- /* Either this is one of the max_allocno pseudo regs not allocated,
- or it is a hardware reg. First handle the pseudo-regs. */
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- if (reg_allocno[regno] >= 0)
- CLEAR_ALLOCNO_LIVE (reg_allocno[regno]);
- }
- /* Handle hardware regs (and pseudos allocated to hard regs). */
- else if (! fixed_regs[regno])
- {
- /* Pseudo regs already assigned hardware regs are treated
- almost the same as explicit hardware regs. */
- register int last = regno + HARD_REGNO_NREGS (regno, GET_MODE (reg));
- while (regno < last)
- {
- CLEAR_HARD_REG_BIT (hard_regs_live, regno);
- regno++;
- }
- }
-}
-
-/* Mark hard reg REGNO as currently live, assuming machine mode MODE
- for the value stored in it. MODE determines how many consecutive
- registers are actually in use. Do not record conflicts;
- it is assumed that the caller will do that. */
-
-static void
-mark_reg_live_nc (regno, mode)
- register int regno;
- enum machine_mode mode;
-{
- register int last = regno + HARD_REGNO_NREGS (regno, mode);
- while (regno < last)
- {
- SET_HARD_REG_BIT (hard_regs_live, regno);
- regno++;
- }
-}
-
-/* Try to set a preference for an allocno to a hard register.
- We are passed DEST and SRC which are the operands of a SET. It is known
- that SRC is a register. If SRC or the first operand of SRC is a register,
- try to set a preference. If one of the two is a hard register and the other
- is a pseudo-register, mark the preference.
-
- Note that we are not as aggressive as local-alloc in trying to tie a
- pseudo-register to a hard register. */
-
-static void
-set_preference (dest, src)
- rtx dest, src;
-{
- int src_regno, dest_regno;
- /* Amount to add to the hard regno for SRC, or subtract from that for DEST,
- to compensate for subregs in SRC or DEST. */
- int offset = 0;
- int i;
- int copy = 1;
-
- if (GET_RTX_FORMAT (GET_CODE (src))[0] == 'e')
- src = XEXP (src, 0), copy = 0;
-
- /* Get the reg number for both SRC and DEST.
- If neither is a reg, give up. */
-
- if (GET_CODE (src) == REG)
- src_regno = REGNO (src);
- else if (GET_CODE (src) == SUBREG && GET_CODE (SUBREG_REG (src)) == REG)
- {
- src_regno = REGNO (SUBREG_REG (src));
- offset += SUBREG_WORD (src);
- }
- else
- return;
-
- if (GET_CODE (dest) == REG)
- dest_regno = REGNO (dest);
- else if (GET_CODE (dest) == SUBREG && GET_CODE (SUBREG_REG (dest)) == REG)
- {
- dest_regno = REGNO (SUBREG_REG (dest));
- offset -= SUBREG_WORD (dest);
- }
- else
- return;
-
- /* Convert either or both to hard reg numbers. */
-
- if (reg_renumber[src_regno] >= 0)
- src_regno = reg_renumber[src_regno];
-
- if (reg_renumber[dest_regno] >= 0)
- dest_regno = reg_renumber[dest_regno];
-
- /* Now if one is a hard reg and the other is a global pseudo
- then give the other a preference. */
-
- if (dest_regno < FIRST_PSEUDO_REGISTER && src_regno >= FIRST_PSEUDO_REGISTER
- && reg_allocno[src_regno] >= 0)
- {
- dest_regno -= offset;
- if (dest_regno >= 0 && dest_regno < FIRST_PSEUDO_REGISTER)
- {
- if (copy)
- SET_REGBIT (hard_reg_copy_preferences,
- reg_allocno[src_regno], dest_regno);
-
- SET_REGBIT (hard_reg_preferences,
- reg_allocno[src_regno], dest_regno);
- for (i = dest_regno;
- i < dest_regno + HARD_REGNO_NREGS (dest_regno, GET_MODE (dest));
- i++)
- SET_REGBIT (hard_reg_full_preferences, reg_allocno[src_regno], i);
- }
- }
-
- if (src_regno < FIRST_PSEUDO_REGISTER && dest_regno >= FIRST_PSEUDO_REGISTER
- && reg_allocno[dest_regno] >= 0)
- {
- src_regno += offset;
- if (src_regno >= 0 && src_regno < FIRST_PSEUDO_REGISTER)
- {
- if (copy)
- SET_REGBIT (hard_reg_copy_preferences,
- reg_allocno[dest_regno], src_regno);
-
- SET_REGBIT (hard_reg_preferences,
- reg_allocno[dest_regno], src_regno);
- for (i = src_regno;
- i < src_regno + HARD_REGNO_NREGS (src_regno, GET_MODE (src));
- i++)
- SET_REGBIT (hard_reg_full_preferences, reg_allocno[dest_regno], i);
- }
- }
-}
-
-/* Indicate that hard register number FROM was eliminated and replaced with
- an offset from hard register number TO. The status of hard registers live
- at the start of a basic block is updated by replacing a use of FROM with
- a use of TO. */
-
-void
-mark_elimination (from, to)
- int from, to;
-{
- int i;
-
- for (i = 0; i < n_basic_blocks; i++)
- if ((basic_block_live_at_start[i][from / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1 << (from % REGSET_ELT_BITS))) != 0)
- {
- basic_block_live_at_start[i][from / REGSET_ELT_BITS]
- &= ~ ((REGSET_ELT_TYPE) 1 << (from % REGSET_ELT_BITS));
- basic_block_live_at_start[i][to / REGSET_ELT_BITS]
- |= ((REGSET_ELT_TYPE) 1 << (to % REGSET_ELT_BITS));
- }
-}
-
-/* Print debugging trace information if -greg switch is given,
- showing the information on which the allocation decisions are based. */
-
-static void
-dump_conflicts (file)
- FILE *file;
-{
- register int i;
- register int has_preferences;
- fprintf (file, ";; %d regs to allocate:", max_allocno);
- for (i = 0; i < max_allocno; i++)
- {
- int j;
- fprintf (file, " %d", allocno_reg[allocno_order[i]]);
- for (j = 0; j < max_regno; j++)
- if (reg_allocno[j] == allocno_order[i]
- && j != allocno_reg[allocno_order[i]])
- fprintf (file, "+%d", j);
- if (allocno_size[allocno_order[i]] != 1)
- fprintf (file, " (%d)", allocno_size[allocno_order[i]]);
- }
- fprintf (file, "\n");
-
- for (i = 0; i < max_allocno; i++)
- {
- register int j;
- fprintf (file, ";; %d conflicts:", allocno_reg[i]);
- for (j = 0; j < max_allocno; j++)
- if (CONFLICTP (i, j) || CONFLICTP (j, i))
- fprintf (file, " %d", allocno_reg[j]);
- for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
- if (TEST_HARD_REG_BIT (hard_reg_conflicts[i], j))
- fprintf (file, " %d", j);
- fprintf (file, "\n");
-
- has_preferences = 0;
- for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
- if (TEST_HARD_REG_BIT (hard_reg_preferences[i], j))
- has_preferences = 1;
-
- if (! has_preferences)
- continue;
- fprintf (file, ";; %d preferences:", allocno_reg[i]);
- for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
- if (TEST_HARD_REG_BIT (hard_reg_preferences[i], j))
- fprintf (file, " %d", j);
- fprintf (file, "\n");
- }
- fprintf (file, "\n");
-}
-
-void
-dump_global_regs (file)
- FILE *file;
-{
- register int i, j;
-
- fprintf (file, ";; Register dispositions:\n");
- for (i = FIRST_PSEUDO_REGISTER, j = 0; i < max_regno; i++)
- if (reg_renumber[i] >= 0)
- {
- fprintf (file, "%d in %d ", i, reg_renumber[i]);
- if (++j % 6 == 0)
- fprintf (file, "\n");
- }
-
- fprintf (file, "\n\n;; Hard regs used: ");
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (regs_ever_live[i])
- fprintf (file, " %d", i);
- fprintf (file, "\n\n");
-}
diff --git a/gcc/gmon.c b/gcc/gmon.c
deleted file mode 100644
index 6cebb382b69..00000000000
--- a/gcc/gmon.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91";
-#endif /* not lint */
-
-#if 0
-#include <unistd.h>
-
-#endif
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-#include "gmon.h"
-
-extern mcount() asm ("mcount");
-extern char *minbrk asm ("minbrk");
-
-#ifdef __alpha
-extern char *sbrk ();
-#endif
-
- /*
- * froms is actually a bunch of unsigned shorts indexing tos
- */
-static int profiling = 3;
-static unsigned short *froms;
-static struct tostruct *tos = 0;
-static long tolimit = 0;
-static char *s_lowpc = 0;
-static char *s_highpc = 0;
-static unsigned long s_textsize = 0;
-
-static int ssiz;
-static char *sbuf;
-static int s_scale;
- /* see profil(2) where this is describe (incorrectly) */
-#define SCALE_1_TO_1 0x10000L
-
-#define MSG "No space for profiling buffer(s)\n"
-
-monstartup(lowpc, highpc)
- char *lowpc;
- char *highpc;
-{
- int monsize;
- char *buffer;
- register int o;
-
- /*
- * round lowpc and highpc to multiples of the density we're using
- * so the rest of the scaling (here and in gprof) stays in ints.
- */
- lowpc = (char *)
- ROUNDDOWN((unsigned) lowpc, HISTFRACTION*sizeof(HISTCOUNTER));
- s_lowpc = lowpc;
- highpc = (char *)
- ROUNDUP((unsigned) highpc, HISTFRACTION*sizeof(HISTCOUNTER));
- s_highpc = highpc;
- s_textsize = highpc - lowpc;
- monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr);
- buffer = sbrk( monsize );
- if ( buffer == (char *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- return;
- }
- froms = (unsigned short *) sbrk( s_textsize / HASHFRACTION );
- if ( froms == (unsigned short *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- froms = 0;
- return;
- }
- tolimit = s_textsize * ARCDENSITY / 100;
- if ( tolimit < MINARCS ) {
- tolimit = MINARCS;
- } else if ( tolimit > 65534 ) {
- tolimit = 65534;
- }
- tos = (struct tostruct *) sbrk( tolimit * sizeof( struct tostruct ) );
- if ( tos == (struct tostruct *) -1 ) {
- write( 2 , MSG , sizeof(MSG) );
- froms = 0;
- tos = 0;
- return;
- }
- minbrk = sbrk(0);
- tos[0].link = 0;
- sbuf = buffer;
- ssiz = monsize;
- ( (struct phdr *) buffer ) -> lpc = lowpc;
- ( (struct phdr *) buffer ) -> hpc = highpc;
- ( (struct phdr *) buffer ) -> ncnt = ssiz;
- monsize -= sizeof(struct phdr);
- if ( monsize <= 0 )
- return;
- o = highpc - lowpc;
- if( monsize < o )
-#ifndef hp300
- s_scale = ( (float) monsize / o ) * SCALE_1_TO_1;
-#else /* avoid floating point */
- {
- int quot = o / monsize;
-
- if (quot >= 0x10000)
- s_scale = 1;
- else if (quot >= 0x100)
- s_scale = 0x10000 / quot;
- else if (o >= 0x800000)
- s_scale = 0x1000000 / (o / (monsize >> 8));
- else
- s_scale = 0x1000000 / ((o << 8) / monsize);
- }
-#endif
- else
- s_scale = SCALE_1_TO_1;
- moncontrol(1);
-}
-
-_mcleanup()
-{
- int fd;
- int fromindex;
- int endfrom;
- char *frompc;
- int toindex;
- struct rawarc rawarc;
-
- moncontrol(0);
- fd = creat( "gmon.out" , 0666 );
- if ( fd < 0 ) {
- perror( "mcount: gmon.out" );
- return;
- }
-# ifdef DEBUG
- fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
-# endif DEBUG
- write( fd , sbuf , ssiz );
- endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
- for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) {
- if ( froms[fromindex] == 0 ) {
- continue;
- }
- frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms));
- for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) {
-# ifdef DEBUG
- fprintf( stderr ,
- "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
- frompc , tos[toindex].selfpc , tos[toindex].count );
-# endif DEBUG
- rawarc.raw_frompc = (unsigned long) frompc;
- rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
- rawarc.raw_count = tos[toindex].count;
- write( fd , &rawarc , sizeof rawarc );
- }
- }
- close( fd );
-}
-
-mcount()
-{
- register char *selfpc;
- register unsigned short *frompcindex;
- register struct tostruct *top;
- register struct tostruct *prevtop;
- register long toindex;
-
- /*
- * find the return address for mcount,
- * and the return address for mcount's caller.
- */
-
- /* selfpc = pc pushed by mcount call.
- This identifies the function that was just entered. */
- selfpc = (void *) __builtin_return_address (0);
- /* frompcindex = pc in preceding frame.
- This identifies the caller of the function just entered. */
- frompcindex = (void *) __builtin_return_address (1);
- /*
- * check that we are profiling
- * and that we aren't recursively invoked.
- */
- if (profiling) {
- goto out;
- }
- profiling++;
- /*
- * check that frompcindex is a reasonable pc value.
- * for example: signal catchers get called from the stack,
- * not from text space. too bad.
- */
- frompcindex = (unsigned short *) ((long) frompcindex - (long) s_lowpc);
- if ((unsigned long) frompcindex > s_textsize) {
- goto done;
- }
- frompcindex =
- &froms[((long) frompcindex) / (HASHFRACTION * sizeof(*froms))];
- toindex = *frompcindex;
- if (toindex == 0) {
- /*
- * first time traversing this arc
- */
- toindex = ++tos[0].link;
- if (toindex >= tolimit) {
- goto overflow;
- }
- *frompcindex = toindex;
- top = &tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = 0;
- goto done;
- }
- top = &tos[toindex];
- if (top->selfpc == selfpc) {
- /*
- * arc at front of chain; usual case.
- */
- top->count++;
- goto done;
- }
- /*
- * have to go looking down chain for it.
- * top points to what we are looking at,
- * prevtop points to previous top.
- * we know it is not at the head of the chain.
- */
- for (; /* goto done */; ) {
- if (top->link == 0) {
- /*
- * top is end of the chain and none of the chain
- * had top->selfpc == selfpc.
- * so we allocate a new tostruct
- * and link it to the head of the chain.
- */
- toindex = ++tos[0].link;
- if (toindex >= tolimit) {
- goto overflow;
- }
- top = &tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
- /*
- * otherwise, check the next arc on the chain.
- */
- prevtop = top;
- top = &tos[top->link];
- if (top->selfpc == selfpc) {
- /*
- * there it is.
- * increment its count
- * move it to the head of the chain.
- */
- top->count++;
- toindex = prevtop->link;
- prevtop->link = top->link;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
-
- }
-done:
- profiling--;
- /* and fall through */
-out:
- return; /* normal return restores saved registers */
-
-overflow:
- profiling++; /* halt further profiling */
-# define TOLIMIT "mcount: tos overflow\n"
- write(2, TOLIMIT, sizeof(TOLIMIT));
- goto out;
-}
-
-/* Control profiling
- profiling is what mcount checks to see if
- all the data structures are ready. */
-
-moncontrol(mode)
- int mode;
-{
- if (mode) {
- /* start */
- profil(sbuf + sizeof(struct phdr), ssiz - sizeof(struct phdr),
- (int)s_lowpc, s_scale);
- profiling = 0;
- } else {
- /* stop */
- profil((char *) 0, 0, 0, 0);
- profiling = 3;
- }
-}
-
diff --git a/gcc/gsyms.h b/gcc/gsyms.h
deleted file mode 100644
index 03bde938604..00000000000
--- a/gcc/gsyms.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* For cross compilation, use the portable definitions from the COFF
- documentation. */
-
-#define __GNU_SYMS__
-
-enum sdb_storage_class
-{
- C_EFCN = -1,
- C_NULL = 0,
- C_AUTO = 1,
- C_EXT = 2,
- C_STAT = 3,
- C_REG = 4,
- C_EXTDEF = 5,
- C_LABEL = 6,
- C_ULABEL = 7,
- C_MOS = 8,
- C_ARG = 9,
- C_STRTAG = 10,
- C_MOU = 11,
- C_UNTAG = 12,
- C_TPDEF = 13,
- C_USTATIC = 14,
- C_ENTAG = 15,
- C_MOE = 16,
- C_REGPARM = 17,
- C_FIELD = 18,
-
- C_BLOCK = 100,
- C_FCN = 101,
- C_EOS = 102,
- C_FILE = 103,
- C_LINE = 104,
- C_ALIAS = 105,
- C_HIDDEN = 106
-};
-
-enum sdb_type
-{
- T_NULL = 0,
- T_ARG = 1,
- T_VOID = 1,
- T_CHAR = 2,
- T_SHORT = 3,
- T_INT = 4,
- T_LONG = 5,
- T_FLOAT = 6,
- T_DOUBLE = 7,
- T_STRUCT = 8,
- T_UNION = 9,
- T_ENUM = 10,
- T_MOE = 11,
- T_UCHAR = 12,
- T_USHORT = 13,
- T_UINT = 14,
- T_ULONG = 15
-#ifdef EXTENDED_SDB_BASIC_TYPES
- , T_LNGDBL = 16
-#endif
-};
-
-enum sdb_type_class
-{
- DT_NON = 0,
- DT_PTR = 1,
- DT_FCN = 2,
- DT_ARY = 3
-};
-
-enum sdb_masks
-{
-#ifdef EXTENDED_SDB_BASIC_TYPES
- N_BTMASK = 0x1f,
- N_TMASK = 0x60,
- N_TMASK1 = 0x300,
- N_TMASK2 = 0x360,
- N_BTSHFT = 5,
-#else
- N_BTMASK = 017,
- N_TMASK = 060,
- N_TMASK1 = 0300,
- N_TMASK2 = 0360,
- N_BTSHFT = 4,
-#endif
- N_TSHIFT = 2
-};
diff --git a/gcc/gsyslimits.h b/gcc/gsyslimits.h
deleted file mode 100644
index a3628025e8a..00000000000
--- a/gcc/gsyslimits.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* syslimits.h stands for the system's own limits.h file.
- If we can use it ok unmodified, then we install this text.
- If fixincludes fixes it, then the fixed version is installed
- instead of this text. */
-
-#define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */
-#include_next <limits.h>
-#undef _GCC_NEXT_LIMITS_H
diff --git a/gcc/halfpic.c b/gcc/halfpic.c
deleted file mode 100644
index 3e0ae2135e0..00000000000
--- a/gcc/halfpic.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/* OSF/rose half-pic support functions.
- Copyright (C) 1992 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. */
-
-/* The OSF/rose half-pic model assumes that the non-library code does
- not need to have full PIC (position independent code), but rather,
- that pointers to external references are put into the data section
- and dereferenced as normal pointers. References to static data does
- not need to be PIC-ized.
-
- Another optimization is to have the compiler know what symbols are
- in the shared libraries, and to only lay down the pointers to
- things which in the library proper. */
-
-#include "config.h"
-
-#ifdef HALF_PIC_INIT
-
-#include "tree.h"
-#include "rtl.h"
-#include <stdio.h>
-#include "obstack.h"
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern char *xmalloc ();
-extern void free ();
-extern rtx eliminate_constant_term ();
-extern void assemble_name ();
-extern void output_addr_const ();
-
-int flag_half_pic = 0; /* Global half-pic flag. */
-int half_pic_number_ptrs = 0; /* # distinct pointers found */
-int half_pic_number_refs = 0; /* # half-pic references */
-int (*ptr_half_pic_address_p)() = half_pic_address_p;
-
-/* Obstack to hold generated pic names. */
-static struct obstack half_pic_obstack;
-
-/* List of pointers created to pic references. */
-
-struct all_refs {
- struct all_refs *hash_next; /* next name in hash chain */
- struct all_refs *next; /* next name created */
- int external_p; /* name is an external reference */
- int pointer_p; /* pointer created. */
- char *ref_name; /* reference name to ptr to real_name */
- int ref_len; /* reference name length */
- char *real_name; /* real function/data name */
- int real_len; /* strlen (real_name) */
-};
-
-static struct all_refs *half_pic_names;
-
-static char *half_pic_prefix;
-static int half_pic_prefix_len;
-
-
-/* Return the hash bucket of a name or NULL. The hash chain is
- organized as a self reorganizing circularly linked chain. It is
- assumed that any name passed to use will never be reallocated. For
- names in SYMBOL_REF's this is true, because the names are allocated
- on the permanent obstack. */
-
-#ifndef MAX_HASH_TABLE
-#define MAX_HASH_TABLE 1009
-#endif
-
-#define HASHBITS 30
-
-static struct all_refs *
-half_pic_hash (name, len, create_p)
- char *name; /* name to hash */
- int len; /* length of the name (or 0 to call strlen) */
- int create_p; /* != 0 to create new hash bucket if new */
-{
- static struct all_refs *hash_table[MAX_HASH_TABLE];
- static struct all_refs zero_all_refs;
-
- unsigned char *uname;
- int hash;
- int i;
- int ch;
- struct all_refs *first;
- struct all_refs *ptr;
-
- if (len == 0)
- len = strlen (name);
-
- /* Compute hash code */
- uname = (unsigned char *)name;
- ch = uname[0];
- hash = len * 613 + ch;
- for (i = 1; i < len; i += 2)
- hash = (hash * 613) + uname[i];
-
- hash &= (1 << HASHBITS) - 1;
- hash %= MAX_HASH_TABLE;
-
- /* See if the name is in the hash table. */
- ptr = first = hash_table[hash];
- if (ptr)
- {
- do
- {
- if (len == ptr->real_len
- && ch == *(ptr->real_name)
- && !strcmp (name, ptr->real_name))
- {
- hash_table[hash] = ptr;
- return ptr;
- }
-
- ptr = ptr->hash_next;
- }
- while (ptr != first);
- }
-
- /* name not in hash table. */
- if (!create_p)
- return (struct all_refs *) 0;
-
- ptr = (struct all_refs *) obstack_alloc (&half_pic_obstack, sizeof (struct all_refs));
- *ptr = zero_all_refs;
-
- ptr->real_name = name;
- ptr->real_len = len;
-
- /* Update circular links. */
- if (first == (struct all_refs *) 0)
- ptr->hash_next = ptr;
-
- else
- {
- ptr->hash_next = first->hash_next;
- first->hash_next = ptr;
- }
-
- hash_table[hash] = ptr;
- return ptr;
-}
-
-
-/* Do any half-pic initializations. */
-
-void
-half_pic_init ()
-{
- flag_half_pic = TRUE;
- half_pic_prefix = HALF_PIC_PREFIX;
- half_pic_prefix_len = strlen (half_pic_prefix);
- obstack_init (&half_pic_obstack);
-}
-
-
-/* Write out all pointers to pic references. */
-
-void
-half_pic_finish (stream)
- FILE *stream;
-{
- struct all_refs *p = half_pic_names;
-
- if (!p)
- return;
-
- data_section ();
- for (; p != 0; p = p->next)
- {
- /* Emit the pointer if used. */
- if (p->pointer_p)
- {
- ASM_OUTPUT_LABEL (stream, p->ref_name);
- ASM_OUTPUT_INT (stream, gen_rtx (SYMBOL_REF, Pmode, p->real_name));
- }
- }
-}
-
-
-/* Encode in a declaration whether or not it is half-pic. */
-
-void
-half_pic_encode (decl)
- tree decl;
-{
- enum tree_code code = TREE_CODE (decl);
- tree asm_name;
- struct all_refs *ptr;
-
- if (!flag_half_pic)
- return;
-
- if (code != VAR_DECL && code != FUNCTION_DECL)
- return;
-
- asm_name = DECL_ASSEMBLER_NAME (decl);
-
- if (!asm_name)
- return;
-
-#ifdef HALF_PIC_DEBUG
- if (HALF_PIC_DEBUG)
- {
- if (HALF_PIC_DEBUG)
- fprintf (stderr, "\n========== Half_pic_encode %.*s\n",
- IDENTIFIER_LENGTH (asm_name),
- IDENTIFIER_POINTER (asm_name));
- debug_tree (decl);
- }
-#endif
-
- /* If this is not an external reference, it can't be half-pic. */
- if (!DECL_EXTERNAL (decl) && (code != VAR_DECL || !TREE_PUBLIC (decl)))
- return;
-
- ptr = half_pic_hash (IDENTIFIER_POINTER (asm_name),
- IDENTIFIER_LENGTH (asm_name),
- TRUE);
-
- ptr->external_p = TRUE;
-
-#ifdef HALF_PIC_DEBUG
- if (HALF_PIC_DEBUG)
- fprintf (stderr, "\n%.*s is half-pic\n",
- IDENTIFIER_LENGTH (asm_name),
- IDENTIFIER_POINTER (asm_name));
-#endif
-}
-
-
-/* Mark that an object is now local, and no longer needs half-pic. */
-
-void
-half_pic_declare (name)
- char *name;
-{
- struct all_refs *ptr;
-
- if (!flag_half_pic)
- return;
-
- ptr = half_pic_hash (name, 0, FALSE);
- if (!ptr)
- return;
-
- ptr->external_p = FALSE;
-
-#ifdef HALF_PIC_DEBUG
- if (HALF_PIC_DEBUG)
- fprintf (stderr, "\n========== Half_pic_declare %s\n", name);
-#endif
-}
-
-
-/* Mark that an object is explicitly external. */
-
-void
-half_pic_external (name)
- char *name;
-{
- struct all_refs *ptr;
-
- if (!flag_half_pic)
- return;
-
- ptr = half_pic_hash (name, 0, TRUE);
- if (!ptr)
- return;
-
- ptr->external_p = TRUE;
-
-#ifdef HALF_PIC_DEBUG
- if (HALF_PIC_DEBUG)
- fprintf (stderr, "\n========== Half_pic_external %s\n", name);
-#endif
-}
-
-
-/* Return whether an address is half-pic. */
-
-int
-half_pic_address_p (addr)
- rtx addr;
-{
- char *name;
- int len;
- struct all_refs *ptr;
-
- if (!flag_half_pic)
- return FALSE;
-
- switch (GET_CODE (addr))
- {
- default:
- break;
-
- case CONST:
- {
- rtx offset = const0_rtx;
- addr = eliminate_constant_term (XEXP (addr, 0), &offset);
- if (GET_CODE (addr) != SYMBOL_REF)
- return FALSE;
- }
- /* fall through */
-
- case SYMBOL_REF:
- name = XSTR (addr, 0);
-
-#ifdef HALF_PIC_DEBUG
- if (HALF_PIC_DEBUG)
- fprintf (stderr, "\n========== Half_pic_address_p %s\n", name);
-#endif
-
- /* If this is a label, it will have a '*' in front of it. */
- if (name[0] == '*')
- return FALSE;
-
- /* If this is a reference to the actual half-pic pointer, it
- is obviously not half-pic. */
-
- len = strlen (name);
- if (len > half_pic_prefix_len
- && half_pic_prefix[0] == name[0]
- && !strncmp (name, half_pic_prefix, half_pic_prefix_len))
- return FALSE;
-
- ptr = half_pic_hash (name, len, FALSE);
- if (ptr == (struct all_refs *) 0)
- return FALSE;
-
- if (ptr->external_p)
- {
-#ifdef HALF_PIC_DEBUG
- if (HALF_PIC_DEBUG)
- fprintf (stderr, "%s is half-pic\n", name);
-#endif
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-/* Return the name of the pointer to the PIC function, allocating
- it if need be. */
-
-struct rtx_def *
-half_pic_ptr (operand)
- rtx operand;
-{
- char *name;
- struct all_refs *p;
- int len;
-
- if (GET_CODE (operand) != SYMBOL_REF)
- return operand;
-
- name = XSTR (operand, 0);
- len = strlen (name);
- p = half_pic_hash (name, len, FALSE);
- if (p == (struct all_refs *) 0 || !p->external_p)
- return operand;
-
- if (!p->pointer_p)
- { /* first time, create pointer */
- obstack_grow (&half_pic_obstack, half_pic_prefix, half_pic_prefix_len);
- obstack_grow (&half_pic_obstack, name, len+1);
-
- p->next = half_pic_names;
- p->ref_name = (char *) obstack_finish (&half_pic_obstack);
- p->ref_len = len + half_pic_prefix_len;
- p->pointer_p = TRUE;
-
- half_pic_names = p;
- half_pic_number_ptrs++;
- }
-
- half_pic_number_refs++;
- return gen_rtx (SYMBOL_REF, Pmode, p->ref_name);
-}
-
-#endif /* HALF_PIC_INIT */
diff --git a/gcc/halfpic.h b/gcc/halfpic.h
deleted file mode 100644
index b02b81ee563..00000000000
--- a/gcc/halfpic.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* OSF/rose half-pic support definitions.
- Copyright (C) 1992, 1996 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. */
-
-#ifndef NO_HALF_PIC
-
-/* Add prototype support. */
-/* ??? It would be nice to use gansidecl.h here but there's an extra
- complication with NO_STDIO_H that must be dealt with. */
-#ifndef PROTO
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#define PROTO(ARGS) ARGS
-#else
-#define PROTO(ARGS) ()
-#endif
-#endif
-
-#if !defined(STDIO_PROTO) && !defined(NO_STDIO_H)
-#ifndef BUFSIZ
-#include <stdio.h>
-#endif
-
-#define STDIO_PROTO(ARGS) PROTO(ARGS)
-#endif
-
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-union tree_node; /* forward reference */
-struct rtx_def;
-#endif
-
-/* Declare the variable flag_half_pic as 'int' instead of 'extern
- int', so that BSS variables are created (even though this is not
- strict ANSI). This is because rtl.c now refers to the
- CONSTANT_ADDRESS_P macro, which in turn refers to flag_half_pic,
- and wants to call half_pic_address_p, whose address we also store
- in in a BSS variable. This way, the gen* programs won't get
- unknown symbol errors when being linked (flag_half_pic will never
- be true in the gen* programs). */
-
-int flag_half_pic; /* Global half-pic flag. */
-int (*ptr_half_pic_address_p) (); /* ptr to half_pic_address_p () */
-
-extern int half_pic_number_ptrs; /* # distinct pointers found */
-extern int half_pic_number_refs; /* # half-pic references */
-extern void half_pic_encode PROTO((union tree_node *)); /* encode whether half-pic */
-extern void half_pic_declare PROTO((char *)); /* declare object local */
-extern void half_pic_external PROTO((char *)); /* declare object external */
-extern void half_pic_init PROTO((void)); /* half_pic initialization */
-extern int half_pic_address_p PROTO((struct rtx_def *)); /* true if an address is half-pic */
-extern struct rtx_def *half_pic_ptr PROTO((struct rtx_def *)); /* return RTX for half-pic pointer */
-#ifdef STDIO_PROTO
-extern void half_pic_finish STDIO_PROTO((FILE *)); /* half_pic termination */
-#endif
-
-/* Macros to provide access to the half-pic stuff (so they can easily
- be stubbed out. */
-
-#define HALF_PIC_P() (flag_half_pic)
-#define HALF_PIC_NUMBER_PTRS (half_pic_number_ptrs)
-#define HALF_PIC_NUMBER_REFS (half_pic_number_refs)
-
-#define HALF_PIC_ENCODE(DECL) half_pic_encode (DECL)
-#define HALF_PIC_DECLARE(NAME) half_pic_declare (NAME)
-#define HALF_PIC_EXTERNAL(NAME) half_pic_external (NAME)
-#define HALF_PIC_INIT() half_pic_init ()
-#define HALF_PIC_FINISH(STREAM) half_pic_finish (STREAM)
-#define HALF_PIC_ADDRESS_P(X) ((*ptr_half_pic_address_p) (X))
-#define HALF_PIC_PTR(X) half_pic_ptr (X)
-
-/* Prefix for half-pic names */
-#ifndef HALF_PIC_PREFIX
-#define HALF_PIC_PREFIX "__pic_"
-#endif
-
-#endif /* NO_HALF_PIC */
diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h
deleted file mode 100644
index 5064dbcc041..00000000000
--- a/gcc/hard-reg-set.h
+++ /dev/null
@@ -1,470 +0,0 @@
-/* Sets (bit vectors) of hard registers, and operations on them.
- Copyright (C) 1987, 1992, 1994 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. */
-
-
-/* Define the type of a set of hard registers. */
-
-/* HARD_REG_ELT_TYPE is a typedef of the unsigned integral type which
- will be used for hard reg sets, either alone or in an array.
-
- If HARD_REG_SET is a macro, its definition is HARD_REG_ELT_TYPE,
- and it has enough bits to represent all the target machine's hard
- registers. Otherwise, it is a typedef for a suitably sized array
- of HARD_REG_ELT_TYPEs. HARD_REG_SET_LONGS is defined as how many.
-
- Note that lots of code assumes that the first part of a regset is
- the same format as a HARD_REG_SET. To help make sure this is true,
- we only try the widest integer mode (HOST_WIDE_INT) instead of all the
- smaller types. This approach loses only if there are a very few
- registers and then only in the few cases where we have an array of
- HARD_REG_SETs, so it needn't be as complex as it used to be. */
-
-typedef unsigned HOST_WIDE_INT HARD_REG_ELT_TYPE;
-
-#if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDE_INT
-
-#define HARD_REG_SET HARD_REG_ELT_TYPE
-
-#else
-
-#define HARD_REG_SET_LONGS \
- ((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_WIDE_INT - 1) \
- / HOST_BITS_PER_WIDE_INT)
-typedef HARD_REG_ELT_TYPE HARD_REG_SET[HARD_REG_SET_LONGS];
-
-#endif
-
-/* HARD_CONST is used to cast a constant to the appropriate type
- for use with a HARD_REG_SET. */
-
-#define HARD_CONST(X) ((HARD_REG_ELT_TYPE) (X))
-
-/* Define macros SET_HARD_REG_BIT, CLEAR_HARD_REG_BIT and TEST_HARD_REG_BIT
- to set, clear or test one bit in a hard reg set of type HARD_REG_SET.
- All three take two arguments: the set and the register number.
-
- In the case where sets are arrays of longs, the first argument
- is actually a pointer to a long.
-
- Define two macros for initializing a set:
- CLEAR_HARD_REG_SET and SET_HARD_REG_SET.
- These take just one argument.
-
- Also define macros for copying hard reg sets:
- COPY_HARD_REG_SET and COMPL_HARD_REG_SET.
- These take two arguments TO and FROM; they read from FROM
- and store into TO. COMPL_HARD_REG_SET complements each bit.
-
- Also define macros for combining hard reg sets:
- IOR_HARD_REG_SET and AND_HARD_REG_SET.
- These take two arguments TO and FROM; they read from FROM
- and combine bitwise into TO. Define also two variants
- IOR_COMPL_HARD_REG_SET and AND_COMPL_HARD_REG_SET
- which use the complement of the set FROM.
-
- Also define GO_IF_HARD_REG_SUBSET (X, Y, TO):
- if X is a subset of Y, go to TO.
-*/
-
-#ifdef HARD_REG_SET
-
-#define SET_HARD_REG_BIT(SET, BIT) \
- ((SET) |= HARD_CONST (1) << (BIT))
-#define CLEAR_HARD_REG_BIT(SET, BIT) \
- ((SET) &= ~(HARD_CONST (1) << (BIT)))
-#define TEST_HARD_REG_BIT(SET, BIT) \
- ((SET) & (HARD_CONST (1) << (BIT)))
-
-#define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0))
-#define SET_HARD_REG_SET(TO) ((TO) = ~ HARD_CONST (0))
-
-#define COPY_HARD_REG_SET(TO, FROM) ((TO) = (FROM))
-#define COMPL_HARD_REG_SET(TO, FROM) ((TO) = ~(FROM))
-
-#define IOR_HARD_REG_SET(TO, FROM) ((TO) |= (FROM))
-#define IOR_COMPL_HARD_REG_SET(TO, FROM) ((TO) |= ~ (FROM))
-#define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM))
-#define AND_COMPL_HARD_REG_SET(TO, FROM) ((TO) &= ~ (FROM))
-
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) if (HARD_CONST (0) == ((X) & ~(Y))) goto TO
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) if ((X) == (Y)) goto TO
-
-#else
-
-#define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDE_INT)
-
-#define SET_HARD_REG_BIT(SET, BIT) \
- ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
- |= HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))
-
-#define CLEAR_HARD_REG_BIT(SET, BIT) \
- ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
- &= ~(HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)))
-
-#define TEST_HARD_REG_BIT(SET, BIT) \
- ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \
- & (HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)))
-
-#if FIRST_PSEUDO_REGISTER <= 2*HOST_BITS_PER_WIDE_INT
-#define CLEAR_HARD_REG_SET(TO) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
- scan_tp_[0] = 0; \
- scan_tp_[1] = 0; } while (0)
-
-#define SET_HARD_REG_SET(TO) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
- scan_tp_[0] = -1; \
- scan_tp_[1] = -1; } while (0)
-
-#define COPY_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] = scan_fp_[0]; \
- scan_tp_[1] = scan_fp_[1]; } while (0)
-
-#define COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] = ~ scan_fp_[0]; \
- scan_tp_[1] = ~ scan_fp_[1]; } while (0)
-
-#define AND_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] &= scan_fp_[0]; \
- scan_tp_[1] &= scan_fp_[1]; } while (0)
-
-#define AND_COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] &= ~ scan_fp_[0]; \
- scan_tp_[1] &= ~ scan_fp_[1]; } while (0)
-
-#define IOR_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] |= scan_fp_[0]; \
- scan_tp_[1] |= scan_fp_[1]; } while (0)
-
-#define IOR_COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] |= ~ scan_fp_[0]; \
- scan_tp_[1] |= ~ scan_fp_[1]; } while (0)
-
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
-do { register HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((0 == (scan_xp_[0] & ~ scan_yp_[0])) \
- && (0 == (scan_xp_[1] & ~ scan_yp_[1]))) \
- goto TO; } while (0)
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
-do { register HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((scan_xp_[0] == scan_yp_[0]) \
- && (scan_xp_[1] == scan_yp_[1])) \
- goto TO; } while (0)
-
-#else
-#if FIRST_PSEUDO_REGISTER <= 3*HOST_BITS_PER_WIDE_INT
-#define CLEAR_HARD_REG_SET(TO) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
- scan_tp_[0] = 0; \
- scan_tp_[1] = 0; \
- scan_tp_[2] = 0; } while (0)
-
-#define SET_HARD_REG_SET(TO) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
- scan_tp_[0] = -1; \
- scan_tp_[1] = -1; \
- scan_tp_[2] = -1; } while (0)
-
-#define COPY_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] = scan_fp_[0]; \
- scan_tp_[1] = scan_fp_[1]; \
- scan_tp_[2] = scan_fp_[2]; } while (0)
-
-#define COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] = ~ scan_fp_[0]; \
- scan_tp_[1] = ~ scan_fp_[1]; \
- scan_tp_[2] = ~ scan_fp_[2]; } while (0)
-
-#define AND_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] &= scan_fp_[0]; \
- scan_tp_[1] &= scan_fp_[1]; \
- scan_tp_[2] &= scan_fp_[2]; } while (0)
-
-#define AND_COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] &= ~ scan_fp_[0]; \
- scan_tp_[1] &= ~ scan_fp_[1]; \
- scan_tp_[2] &= ~ scan_fp_[2]; } while (0)
-
-#define IOR_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] |= scan_fp_[0]; \
- scan_tp_[1] |= scan_fp_[1]; \
- scan_tp_[2] |= scan_fp_[2]; } while (0)
-
-#define IOR_COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] |= ~ scan_fp_[0]; \
- scan_tp_[1] |= ~ scan_fp_[1]; \
- scan_tp_[2] |= ~ scan_fp_[2]; } while (0)
-
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
-do { register HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((0 == (scan_xp_[0] & ~ scan_yp_[0])) \
- && (0 == (scan_xp_[1] & ~ scan_yp_[1])) \
- && (0 == (scan_xp_[2] & ~ scan_yp_[2]))) \
- goto TO; } while (0)
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
-do { register HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((scan_xp_[0] == scan_yp_[0]) \
- && (scan_xp_[1] == scan_yp_[1]) \
- && (scan_xp_[2] == scan_yp_[2])) \
- goto TO; } while (0)
-
-#else
-#if FIRST_PSEUDO_REGISTER <= 4*HOST_BITS_PER_WIDE_INT
-#define CLEAR_HARD_REG_SET(TO) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
- scan_tp_[0] = 0; \
- scan_tp_[1] = 0; \
- scan_tp_[2] = 0; \
- scan_tp_[3] = 0; } while (0)
-
-#define SET_HARD_REG_SET(TO) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
- scan_tp_[0] = -1; \
- scan_tp_[1] = -1; \
- scan_tp_[2] = -1; \
- scan_tp_[3] = -1; } while (0)
-
-#define COPY_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] = scan_fp_[0]; \
- scan_tp_[1] = scan_fp_[1]; \
- scan_tp_[2] = scan_fp_[2]; \
- scan_tp_[3] = scan_fp_[3]; } while (0)
-
-#define COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] = ~ scan_fp_[0]; \
- scan_tp_[1] = ~ scan_fp_[1]; \
- scan_tp_[2] = ~ scan_fp_[2]; \
- scan_tp_[3] = ~ scan_fp_[3]; } while (0)
-
-#define AND_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] &= scan_fp_[0]; \
- scan_tp_[1] &= scan_fp_[1]; \
- scan_tp_[2] &= scan_fp_[2]; \
- scan_tp_[3] &= scan_fp_[3]; } while (0)
-
-#define AND_COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] &= ~ scan_fp_[0]; \
- scan_tp_[1] &= ~ scan_fp_[1]; \
- scan_tp_[2] &= ~ scan_fp_[2]; \
- scan_tp_[3] &= ~ scan_fp_[3]; } while (0)
-
-#define IOR_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] |= scan_fp_[0]; \
- scan_tp_[1] |= scan_fp_[1]; \
- scan_tp_[2] |= scan_fp_[2]; \
- scan_tp_[3] |= scan_fp_[3]; } while (0)
-
-#define IOR_COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- scan_tp_[0] |= ~ scan_fp_[0]; \
- scan_tp_[1] |= ~ scan_fp_[1]; \
- scan_tp_[2] |= ~ scan_fp_[2]; \
- scan_tp_[3] |= ~ scan_fp_[3]; } while (0)
-
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
-do { register HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((0 == (scan_xp_[0] & ~ scan_yp_[0])) \
- && (0 == (scan_xp_[1] & ~ scan_yp_[1])) \
- && (0 == (scan_xp_[2] & ~ scan_yp_[2])) \
- && (0 == (scan_xp_[3] & ~ scan_yp_[3]))) \
- goto TO; } while (0)
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
-do { register HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((scan_xp_[0] == scan_yp_[0]) \
- && (scan_xp_[1] == scan_yp_[1]) \
- && (scan_xp_[2] == scan_yp_[2]) \
- && (scan_xp_[3] == scan_yp_[3])) \
- goto TO; } while (0)
-
-#else /* FIRST_PSEUDO_REGISTER > 3*HOST_BITS_PER_WIDE_INT */
-
-#define CLEAR_HARD_REG_SET(TO) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- *scan_tp_++ = 0; } while (0)
-
-#define SET_HARD_REG_SET(TO) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- *scan_tp_++ = -1; } while (0)
-
-#define COPY_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- *scan_tp_++ = *scan_fp_++; } while (0)
-
-#define COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- *scan_tp_++ = ~ *scan_fp_++; } while (0)
-
-#define AND_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- *scan_tp_++ &= *scan_fp_++; } while (0)
-
-#define AND_COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- *scan_tp_++ &= ~ *scan_fp_++; } while (0)
-
-#define IOR_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- *scan_tp_++ |= *scan_fp_++; } while (0)
-
-#define IOR_COMPL_HARD_REG_SET(TO, FROM) \
-do { register HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- *scan_tp_++ |= ~ *scan_fp_++; } while (0)
-
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
-do { register HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- if (0 != (*scan_xp_++ & ~ *scan_yp_++)) break; \
- if (i == HARD_REG_SET_LONGS) goto TO; } while (0)
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
-do { register HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- register int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- if (*scan_xp_++ != *scan_yp_++) break; \
- if (i == HARD_REG_SET_LONGS) goto TO; } while (0)
-
-#endif
-#endif
-#endif
-#endif
-
-/* Define some standard sets of registers. */
-
-/* Indexed by hard register number, contains 1 for registers
- that are fixed use (stack pointer, pc, frame pointer, etc.).
- These are the registers that cannot be used to allocate
- a pseudo reg whose life does not cross calls. */
-
-extern char fixed_regs[FIRST_PSEUDO_REGISTER];
-
-/* The same info as a HARD_REG_SET. */
-
-extern HARD_REG_SET fixed_reg_set;
-
-/* Indexed by hard register number, contains 1 for registers
- that are fixed use or are clobbered by function calls.
- These are the registers that cannot be used to allocate
- a pseudo reg whose life crosses calls. */
-
-extern char call_used_regs[FIRST_PSEUDO_REGISTER];
-
-/* The same info as a HARD_REG_SET. */
-
-extern HARD_REG_SET call_used_reg_set;
-
-/* Registers that we don't want to caller save. */
-extern HARD_REG_SET losing_caller_save_reg_set;
-
-/* Indexed by hard register number, contains 1 for registers that are
- fixed use -- i.e. in fixed_regs -- or a function value return register
- or STRUCT_VALUE_REGNUM or STATIC_CHAIN_REGNUM. These are the
- registers that cannot hold quantities across calls even if we are
- willing to save and restore them. */
-
-extern char call_fixed_regs[FIRST_PSEUDO_REGISTER];
-
-/* The same info as a HARD_REG_SET. */
-
-extern HARD_REG_SET call_fixed_reg_set;
-
-/* Indexed by hard register number, contains 1 for registers
- that are being used for global register decls.
- These must be exempt from ordinary flow analysis
- and are also considered fixed. */
-
-extern char global_regs[FIRST_PSEUDO_REGISTER];
-
-/* Table of register numbers in the order in which to try to use them. */
-
-#ifdef REG_ALLOC_ORDER /* Avoid undef symbol in certain broken linkers. */
-extern int reg_alloc_order[FIRST_PSEUDO_REGISTER];
-#endif
-
-/* For each reg class, a HARD_REG_SET saying which registers are in it. */
-
-extern HARD_REG_SET reg_class_contents[];
-
-/* For each reg class, number of regs it contains. */
-
-extern int reg_class_size[N_REG_CLASSES];
-
-/* For each reg class, table listing all the containing classes. */
-
-extern enum reg_class reg_class_superclasses[N_REG_CLASSES][N_REG_CLASSES];
-
-/* For each reg class, table listing all the classes contained in it. */
-
-extern enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
-
-/* For each pair of reg classes,
- a largest reg class contained in their union. */
-
-extern enum reg_class reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES];
-
-/* For each pair of reg classes,
- the smallest reg class that contains their union. */
-
-extern enum reg_class reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES];
-
-/* Number of non-fixed registers. */
-
-extern int n_non_fixed_regs;
-
-/* Vector indexed by hardware reg giving its name. */
-
-extern char *reg_names[FIRST_PSEUDO_REGISTER];
diff --git a/gcc/input.h b/gcc/input.h
deleted file mode 100644
index 7c71c24d46b..00000000000
--- a/gcc/input.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Declarations for variables relating to reading the source file.
- Used by parsers, lexical analyzers, and error message routines.
-
- Copyright (C) 1993 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. */
-
-/* Source file current line is coming from. */
-extern char *input_filename;
-
-/* Top-level source file. */
-extern char *main_input_filename;
-
-/* Line number in current source file. */
-extern int lineno;
-
-/* Stream for reading from input file. */
-extern FILE *finput;
-
-struct file_stack
- {
- char *name;
- struct file_stack *next;
- int line;
- };
-
-/* Stack of currently pending input files.
- The line member is not accurate for the innermost file on the stack. */
-extern struct file_stack *input_file_stack;
-
-/* Incremented on each change to input_file_stack. */
-extern int input_file_stack_tick;
diff --git a/gcc/install.sh b/gcc/install.sh
deleted file mode 100755
index 58719246f04..00000000000
--- a/gcc/install.sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/gcc/integrate.c b/gcc/integrate.c
deleted file mode 100644
index 831a6959997..00000000000
--- a/gcc/integrate.c
+++ /dev/null
@@ -1,3251 +0,0 @@
-/* Procedure integration for GNU CC.
- Copyright (C) 1988, 91, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.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 <stdio.h>
-
-#include "config.h"
-#include "rtl.h"
-#include "tree.h"
-#include "regs.h"
-#include "flags.h"
-#include "insn-config.h"
-#include "insn-flags.h"
-#include "expr.h"
-#include "output.h"
-#include "integrate.h"
-#include "real.h"
-#include "except.h"
-#include "function.h"
-#include "bytecode.h"
-
-#include "obstack.h"
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern struct obstack *function_maybepermanent_obstack;
-
-extern tree pushdecl ();
-extern tree poplevel ();
-
-/* Similar, but round to the next highest integer that meets the
- alignment. */
-#define CEIL_ROUND(VALUE,ALIGN) (((VALUE) + (ALIGN) - 1) & ~((ALIGN)- 1))
-
-/* Default max number of insns a function can have and still be inline.
- This is overridden on RISC machines. */
-#ifndef INTEGRATE_THRESHOLD
-#define INTEGRATE_THRESHOLD(DECL) \
- (8 * (8 + list_length (DECL_ARGUMENTS (DECL))))
-#endif
-
-static rtx initialize_for_inline PROTO((tree, int, int, int, int));
-static void finish_inline PROTO((tree, rtx));
-static void adjust_copied_decl_tree PROTO((tree));
-static tree copy_decl_list PROTO((tree));
-static tree copy_decl_tree PROTO((tree));
-static void copy_decl_rtls PROTO((tree));
-static void save_constants PROTO((rtx *));
-static void note_modified_parmregs PROTO((rtx, rtx));
-static rtx copy_for_inline PROTO((rtx));
-static void integrate_parm_decls PROTO((tree, struct inline_remap *, rtvec));
-static void integrate_decl_tree PROTO((tree, int, struct inline_remap *));
-static void save_constants_in_decl_trees PROTO ((tree));
-static void subst_constants PROTO((rtx *, rtx, struct inline_remap *));
-static void restore_constants PROTO((rtx *));
-static void set_block_origin_self PROTO((tree));
-static void set_decl_origin_self PROTO((tree));
-static void set_block_abstract_flags PROTO((tree, int));
-
-void set_decl_abstract_flags PROTO((tree, int));
-
-/* Zero if the current function (whose FUNCTION_DECL is FNDECL)
- is safe and reasonable to integrate into other functions.
- Nonzero means value is a warning message with a single %s
- for the function's name. */
-
-char *
-function_cannot_inline_p (fndecl)
- register tree fndecl;
-{
- register rtx insn;
- tree last = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
- int max_insns = INTEGRATE_THRESHOLD (fndecl);
- register int ninsns = 0;
- register tree parms;
- rtx result;
-
- /* No inlines with varargs. `grokdeclarator' gives a warning
- message about that if `inline' is specified. This code
- it put in to catch the volunteers. */
- if ((last && TREE_VALUE (last) != void_type_node)
- || current_function_varargs)
- return "varargs function cannot be inline";
-
- if (current_function_calls_alloca)
- return "function using alloca cannot be inline";
-
- if (current_function_contains_functions)
- return "function with nested functions cannot be inline";
-
- /* If its not even close, don't even look. */
- if (!DECL_INLINE (fndecl) && get_max_uid () > 3 * max_insns)
- return "function too large to be inline";
-
-#if 0
- /* Don't inline functions which do not specify a function prototype and
- have BLKmode argument or take the address of a parameter. */
- for (parms = DECL_ARGUMENTS (fndecl); parms; parms = TREE_CHAIN (parms))
- {
- if (TYPE_MODE (TREE_TYPE (parms)) == BLKmode)
- TREE_ADDRESSABLE (parms) = 1;
- if (last == NULL_TREE && TREE_ADDRESSABLE (parms))
- return "no prototype, and parameter address used; cannot be inline";
- }
-#endif
-
- /* We can't inline functions that return structures
- the old-fashioned PCC way, copying into a static block. */
- if (current_function_returns_pcc_struct)
- return "inline functions not supported for this return value type";
-
- /* We can't inline functions that return BLKmode structures in registers. */
- if (TYPE_MODE (TREE_TYPE (TREE_TYPE (fndecl))) == BLKmode
- && ! aggregate_value_p (TREE_TYPE (TREE_TYPE (fndecl))))
- return "inline functions not supported for this return value type";
-
- /* We can't inline functions that return structures of varying size. */
- if (int_size_in_bytes (TREE_TYPE (TREE_TYPE (fndecl))) < 0)
- return "function with varying-size return value cannot be inline";
-
- /* Cannot inline a function with a varying size argument or one that
- receives a transparent union. */
- for (parms = DECL_ARGUMENTS (fndecl); parms; parms = TREE_CHAIN (parms))
- {
- if (int_size_in_bytes (TREE_TYPE (parms)) < 0)
- return "function with varying-size parameter cannot be inline";
- else if (TYPE_TRANSPARENT_UNION (TREE_TYPE (parms)))
- return "function with transparent unit parameter cannot be inline";
- }
-
- if (!DECL_INLINE (fndecl) && get_max_uid () > max_insns)
- {
- for (ninsns = 0, insn = get_first_nonparm_insn ();
- insn && ninsns < max_insns;
- insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- ninsns++;
-
- if (ninsns >= max_insns)
- return "function too large to be inline";
- }
-
- /* We cannot inline this function if forced_labels is non-zero. This
- implies that a label in this function was used as an initializer.
- Because labels can not be duplicated, all labels in the function
- will be renamed when it is inlined. However, there is no way to find
- and fix all variables initialized with addresses of labels in this
- function, hence inlining is impossible. */
-
- if (forced_labels)
- return "function with label addresses used in initializers cannot inline";
-
- /* We cannot inline a nested function that jumps to a nonlocal label. */
- if (current_function_has_nonlocal_goto)
- return "function with nonlocal goto cannot be inline";
-
- /* This is a hack, until the inliner is taught about eh regions at
- the start of the function. */
- for (insn = get_insns ();
- insn &&
- ! (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG);
- insn = NEXT_INSN (insn))
- {
- if (insn && GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
- return "function with complex parameters cannot be inline";
- }
-
- /* We can't inline functions that return a PARALLEL rtx. */
- result = DECL_RTL (DECL_RESULT (fndecl));
- if (result && GET_CODE (result) == PARALLEL)
- return "inline functions not supported for this return value type";
-
- return 0;
-}
-
-/* Variables used within save_for_inline. */
-
-/* Mapping from old pseudo-register to new pseudo-registers.
- The first element of this map is reg_map[FIRST_PSEUDO_REGISTER].
- It is allocated in `save_for_inline' and `expand_inline_function',
- and deallocated on exit from each of those routines. */
-static rtx *reg_map;
-
-/* Mapping from old code-labels to new code-labels.
- The first element of this map is label_map[min_labelno].
- It is allocated in `save_for_inline' and `expand_inline_function',
- and deallocated on exit from each of those routines. */
-static rtx *label_map;
-
-/* Mapping from old insn uid's to copied insns.
- It is allocated in `save_for_inline' and `expand_inline_function',
- and deallocated on exit from each of those routines. */
-static rtx *insn_map;
-
-/* Map pseudo reg number into the PARM_DECL for the parm living in the reg.
- Zero for a reg that isn't a parm's home.
- Only reg numbers less than max_parm_reg are mapped here. */
-static tree *parmdecl_map;
-
-/* Keep track of first pseudo-register beyond those that are parms. */
-static int max_parm_reg;
-
-/* When an insn is being copied by copy_for_inline,
- this is nonzero if we have copied an ASM_OPERANDS.
- In that case, it is the original input-operand vector. */
-static rtvec orig_asm_operands_vector;
-
-/* When an insn is being copied by copy_for_inline,
- this is nonzero if we have copied an ASM_OPERANDS.
- In that case, it is the copied input-operand vector. */
-static rtvec copy_asm_operands_vector;
-
-/* Likewise, this is the copied constraints vector. */
-static rtvec copy_asm_constraints_vector;
-
-/* In save_for_inline, nonzero if past the parm-initialization insns. */
-static int in_nonparm_insns;
-
-/* Subroutine for `save_for_inline{copying,nocopy}'. Performs initialization
- needed to save FNDECL's insns and info for future inline expansion. */
-
-static rtx
-initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, copy)
- tree fndecl;
- int min_labelno;
- int max_labelno;
- int max_reg;
- int copy;
-{
- int function_flags, i;
- rtvec arg_vector;
- tree parms;
-
- /* Compute the values of any flags we must restore when inlining this. */
-
- function_flags
- = (current_function_calls_alloca * FUNCTION_FLAGS_CALLS_ALLOCA
- + current_function_calls_setjmp * FUNCTION_FLAGS_CALLS_SETJMP
- + current_function_calls_longjmp * FUNCTION_FLAGS_CALLS_LONGJMP
- + current_function_returns_struct * FUNCTION_FLAGS_RETURNS_STRUCT
- + current_function_returns_pcc_struct * FUNCTION_FLAGS_RETURNS_PCC_STRUCT
- + current_function_needs_context * FUNCTION_FLAGS_NEEDS_CONTEXT
- + current_function_has_nonlocal_label * FUNCTION_FLAGS_HAS_NONLOCAL_LABEL
- + current_function_returns_pointer * FUNCTION_FLAGS_RETURNS_POINTER
- + current_function_uses_const_pool * FUNCTION_FLAGS_USES_CONST_POOL
- + current_function_uses_pic_offset_table * FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE);
-
- /* Clear out PARMDECL_MAP. It was allocated in the caller's frame. */
- bzero ((char *) parmdecl_map, max_parm_reg * sizeof (tree));
- arg_vector = rtvec_alloc (list_length (DECL_ARGUMENTS (fndecl)));
-
- for (parms = DECL_ARGUMENTS (fndecl), i = 0;
- parms;
- parms = TREE_CHAIN (parms), i++)
- {
- rtx p = DECL_RTL (parms);
-
- if (GET_CODE (p) == MEM && copy)
- {
- /* Copy the rtl so that modifications of the addresses
- later in compilation won't affect this arg_vector.
- Virtual register instantiation can screw the address
- of the rtl. */
- rtx new = copy_rtx (p);
-
- /* Don't leave the old copy anywhere in this decl. */
- if (DECL_RTL (parms) == DECL_INCOMING_RTL (parms)
- || (GET_CODE (DECL_RTL (parms)) == MEM
- && GET_CODE (DECL_INCOMING_RTL (parms)) == MEM
- && (XEXP (DECL_RTL (parms), 0)
- == XEXP (DECL_INCOMING_RTL (parms), 0))))
- DECL_INCOMING_RTL (parms) = new;
- DECL_RTL (parms) = new;
- }
-
- RTVEC_ELT (arg_vector, i) = p;
-
- if (GET_CODE (p) == REG)
- parmdecl_map[REGNO (p)] = parms;
- else if (GET_CODE (p) == CONCAT)
- {
- rtx preal = gen_realpart (GET_MODE (XEXP (p, 0)), p);
- rtx pimag = gen_imagpart (GET_MODE (preal), p);
-
- if (GET_CODE (preal) == REG)
- parmdecl_map[REGNO (preal)] = parms;
- if (GET_CODE (pimag) == REG)
- parmdecl_map[REGNO (pimag)] = parms;
- }
-
- /* This flag is cleared later
- if the function ever modifies the value of the parm. */
- TREE_READONLY (parms) = 1;
- }
-
- /* Assume we start out in the insns that set up the parameters. */
- in_nonparm_insns = 0;
-
- /* The list of DECL_SAVED_INSNS, starts off with a header which
- contains the following information:
-
- the first insn of the function (not including the insns that copy
- parameters into registers).
- the first parameter insn of the function,
- the first label used by that function,
- the last label used by that function,
- the highest register number used for parameters,
- the total number of registers used,
- the size of the incoming stack area for parameters,
- the number of bytes popped on return,
- the stack slot list,
- the labels that are forced to exist,
- some flags that are used to restore compiler globals,
- the value of current_function_outgoing_args_size,
- the original argument vector,
- the original DECL_INITIAL,
- and pointers to the table of psuedo regs, pointer flags, and alignment. */
-
- return gen_inline_header_rtx (NULL_RTX, NULL_RTX, min_labelno, max_labelno,
- max_parm_reg, max_reg,
- current_function_args_size,
- current_function_pops_args,
- stack_slot_list, forced_labels, function_flags,
- current_function_outgoing_args_size,
- arg_vector, (rtx) DECL_INITIAL (fndecl),
- (rtvec) regno_reg_rtx, regno_pointer_flag,
- regno_pointer_align);
-}
-
-/* Subroutine for `save_for_inline{copying,nocopy}'. Finishes up the
- things that must be done to make FNDECL expandable as an inline function.
- HEAD contains the chain of insns to which FNDECL will expand. */
-
-static void
-finish_inline (fndecl, head)
- tree fndecl;
- rtx head;
-{
- FIRST_FUNCTION_INSN (head) = get_first_nonparm_insn ();
- FIRST_PARM_INSN (head) = get_insns ();
- DECL_SAVED_INSNS (fndecl) = head;
- DECL_FRAME_SIZE (fndecl) = get_frame_size ();
-}
-
-/* Adjust the BLOCK_END_NOTE pointers in a given copied DECL tree so that
- they all point to the new (copied) rtxs. */
-
-static void
-adjust_copied_decl_tree (block)
- register tree block;
-{
- register tree subblock;
- register rtx original_end;
-
- original_end = BLOCK_END_NOTE (block);
- if (original_end)
- {
- BLOCK_END_NOTE (block) = (rtx) NOTE_SOURCE_FILE (original_end);
- NOTE_SOURCE_FILE (original_end) = 0;
- }
-
- /* Process all subblocks. */
- for (subblock = BLOCK_SUBBLOCKS (block);
- subblock;
- subblock = TREE_CHAIN (subblock))
- adjust_copied_decl_tree (subblock);
-}
-
-/* Make the insns and PARM_DECLs of the current function permanent
- and record other information in DECL_SAVED_INSNS to allow inlining
- of this function in subsequent calls.
-
- This function is called when we are going to immediately compile
- the insns for FNDECL. The insns in maybepermanent_obstack cannot be
- modified by the compilation process, so we copy all of them to
- new storage and consider the new insns to be the insn chain to be
- compiled. Our caller (rest_of_compilation) saves the original
- DECL_INITIAL and DECL_ARGUMENTS; here we copy them. */
-
-/* ??? The nonlocal_label list should be adjusted also. However, since
- a function that contains a nested function never gets inlined currently,
- the nonlocal_label list will always be empty, so we don't worry about
- it for now. */
-
-void
-save_for_inline_copying (fndecl)
- tree fndecl;
-{
- rtx first_insn, last_insn, insn;
- rtx head, copy;
- int max_labelno, min_labelno, i, len;
- int max_reg;
- int max_uid;
- rtx first_nonparm_insn;
- char *new, *new1;
-
- /* Make and emit a return-label if we have not already done so.
- Do this before recording the bounds on label numbers. */
-
- if (return_label == 0)
- {
- return_label = gen_label_rtx ();
- emit_label (return_label);
- }
-
- /* Get some bounds on the labels and registers used. */
-
- max_labelno = max_label_num ();
- min_labelno = get_first_label_num ();
- max_reg = max_reg_num ();
-
- /* Set up PARMDECL_MAP which maps pseudo-reg number to its PARM_DECL.
- Later we set TREE_READONLY to 0 if the parm is modified inside the fn.
- Also set up ARG_VECTOR, which holds the unmodified DECL_RTX values
- for the parms, prior to elimination of virtual registers.
- These values are needed for substituting parms properly. */
-
- max_parm_reg = max_parm_reg_num ();
- parmdecl_map = (tree *) alloca (max_parm_reg * sizeof (tree));
-
- head = initialize_for_inline (fndecl, min_labelno, max_labelno, max_reg, 1);
-
- if (current_function_uses_const_pool)
- {
- /* Replace any constant pool references with the actual constant. We
- will put the constants back in the copy made below. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- save_constants (&PATTERN (insn));
- if (REG_NOTES (insn))
- save_constants (&REG_NOTES (insn));
- }
-
- /* Also scan all decls, and replace any constant pool references with the
- actual constant. */
- save_constants_in_decl_trees (DECL_INITIAL (fndecl));
-
- /* Clear out the constant pool so that we can recreate it with the
- copied constants below. */
- init_const_rtx_hash_table ();
- clear_const_double_mem ();
- }
-
- max_uid = INSN_UID (head);
-
- /* We have now allocated all that needs to be allocated permanently
- on the rtx obstack. Set our high-water mark, so that we
- can free the rest of this when the time comes. */
-
- preserve_data ();
-
- /* Copy the chain insns of this function.
- Install the copied chain as the insns of this function,
- for continued compilation;
- the original chain is recorded as the DECL_SAVED_INSNS
- for inlining future calls. */
-
- /* If there are insns that copy parms from the stack into pseudo registers,
- those insns are not copied. `expand_inline_function' must
- emit the correct code to handle such things. */
-
- insn = get_insns ();
- if (GET_CODE (insn) != NOTE)
- abort ();
- first_insn = rtx_alloc (NOTE);
- NOTE_SOURCE_FILE (first_insn) = NOTE_SOURCE_FILE (insn);
- NOTE_LINE_NUMBER (first_insn) = NOTE_LINE_NUMBER (insn);
- INSN_UID (first_insn) = INSN_UID (insn);
- PREV_INSN (first_insn) = NULL;
- NEXT_INSN (first_insn) = NULL;
- last_insn = first_insn;
-
- /* Each pseudo-reg in the old insn chain must have a unique rtx in the copy.
- Make these new rtx's now, and install them in regno_reg_rtx, so they
- will be the official pseudo-reg rtx's for the rest of compilation. */
-
- reg_map = (rtx *) savealloc (regno_pointer_flag_length * sizeof (rtx));
-
- len = sizeof (struct rtx_def) + (GET_RTX_LENGTH (REG) - 1) * sizeof (rtunion);
- for (i = max_reg - 1; i > LAST_VIRTUAL_REGISTER; i--)
- reg_map[i] = (rtx)obstack_copy (function_maybepermanent_obstack,
- regno_reg_rtx[i], len);
-
- regno_reg_rtx = reg_map;
-
- /* Put copies of all the virtual register rtx into the new regno_reg_rtx. */
- regno_reg_rtx[VIRTUAL_INCOMING_ARGS_REGNUM] = virtual_incoming_args_rtx;
- regno_reg_rtx[VIRTUAL_STACK_VARS_REGNUM] = virtual_stack_vars_rtx;
- regno_reg_rtx[VIRTUAL_STACK_DYNAMIC_REGNUM] = virtual_stack_dynamic_rtx;
- regno_reg_rtx[VIRTUAL_OUTGOING_ARGS_REGNUM] = virtual_outgoing_args_rtx;
-
- /* Likewise each label rtx must have a unique rtx as its copy. */
-
- label_map = (rtx *)alloca ((max_labelno - min_labelno) * sizeof (rtx));
- label_map -= min_labelno;
-
- for (i = min_labelno; i < max_labelno; i++)
- label_map[i] = gen_label_rtx ();
-
- /* Record the mapping of old insns to copied insns. */
-
- insn_map = (rtx *) alloca (max_uid * sizeof (rtx));
- bzero ((char *) insn_map, max_uid * sizeof (rtx));
-
- /* Get the insn which signals the end of parameter setup code. */
- first_nonparm_insn = get_first_nonparm_insn ();
-
- /* Copy any entries in regno_reg_rtx or DECL_RTLs that reference MEM
- (the former occurs when a variable has its address taken)
- since these may be shared and can be changed by virtual
- register instantiation. DECL_RTL values for our arguments
- have already been copied by initialize_for_inline. */
- for (i = LAST_VIRTUAL_REGISTER + 1; i < max_reg; i++)
- if (GET_CODE (regno_reg_rtx[i]) == MEM)
- XEXP (regno_reg_rtx[i], 0)
- = copy_for_inline (XEXP (regno_reg_rtx[i], 0));
-
- /* Copy the tree of subblocks of the function, and the decls in them.
- We will use the copy for compiling this function, then restore the original
- subblocks and decls for use when inlining this function.
-
- Several parts of the compiler modify BLOCK trees. In particular,
- instantiate_virtual_regs will instantiate any virtual regs
- mentioned in the DECL_RTLs of the decls, and loop
- unrolling will replicate any BLOCK trees inside an unrolled loop.
-
- The modified subblocks or DECL_RTLs would be incorrect for the original rtl
- which we will use for inlining. The rtl might even contain pseudoregs
- whose space has been freed. */
-
- DECL_INITIAL (fndecl) = copy_decl_tree (DECL_INITIAL (fndecl));
- DECL_ARGUMENTS (fndecl) = copy_decl_list (DECL_ARGUMENTS (fndecl));
-
- /* Now copy each DECL_RTL which is a MEM,
- so it is safe to modify their addresses. */
- copy_decl_rtls (DECL_INITIAL (fndecl));
-
- /* The fndecl node acts as its own progenitor, so mark it as such. */
- DECL_ABSTRACT_ORIGIN (fndecl) = fndecl;
-
- /* Now copy the chain of insns. Do this twice. The first copy the insn
- itself and its body. The second time copy of REG_NOTES. This is because
- a REG_NOTE may have a forward pointer to another insn. */
-
- for (insn = NEXT_INSN (insn); insn; insn = NEXT_INSN (insn))
- {
- orig_asm_operands_vector = 0;
-
- if (insn == first_nonparm_insn)
- in_nonparm_insns = 1;
-
- switch (GET_CODE (insn))
- {
- case NOTE:
- /* No need to keep these. */
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
- continue;
-
- copy = rtx_alloc (NOTE);
- NOTE_LINE_NUMBER (copy) = NOTE_LINE_NUMBER (insn);
- if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_END)
- NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn);
- else
- {
- NOTE_SOURCE_FILE (insn) = (char *) copy;
- NOTE_SOURCE_FILE (copy) = 0;
- }
- if (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_BEG
- || NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_END)
- {
- /* We have to forward these both to match the new exception
- region. */
- NOTE_BLOCK_NUMBER (copy)
- = CODE_LABEL_NUMBER (label_map[NOTE_BLOCK_NUMBER (copy)]);
-
- }
- RTX_INTEGRATED_P (copy) = RTX_INTEGRATED_P (insn);
- break;
-
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- copy = rtx_alloc (GET_CODE (insn));
-
- if (GET_CODE (insn) == CALL_INSN)
- CALL_INSN_FUNCTION_USAGE (copy) =
- copy_for_inline (CALL_INSN_FUNCTION_USAGE (insn));
-
- PATTERN (copy) = copy_for_inline (PATTERN (insn));
- INSN_CODE (copy) = -1;
- LOG_LINKS (copy) = NULL_RTX;
- RTX_INTEGRATED_P (copy) = RTX_INTEGRATED_P (insn);
- break;
-
- case CODE_LABEL:
- copy = label_map[CODE_LABEL_NUMBER (insn)];
- LABEL_NAME (copy) = LABEL_NAME (insn);
- break;
-
- case BARRIER:
- copy = rtx_alloc (BARRIER);
- break;
-
- default:
- abort ();
- }
- INSN_UID (copy) = INSN_UID (insn);
- insn_map[INSN_UID (insn)] = copy;
- NEXT_INSN (last_insn) = copy;
- PREV_INSN (copy) = last_insn;
- last_insn = copy;
- }
-
- adjust_copied_decl_tree (DECL_INITIAL (fndecl));
-
- /* Now copy the REG_NOTES. */
- for (insn = NEXT_INSN (get_insns ()); insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && insn_map[INSN_UID(insn)])
- REG_NOTES (insn_map[INSN_UID (insn)])
- = copy_for_inline (REG_NOTES (insn));
-
- NEXT_INSN (last_insn) = NULL;
-
- finish_inline (fndecl, head);
-
- /* Make new versions of the register tables. */
- new = (char *) savealloc (regno_pointer_flag_length);
- bcopy (regno_pointer_flag, new, regno_pointer_flag_length);
- new1 = (char *) savealloc (regno_pointer_flag_length);
- bcopy (regno_pointer_align, new1, regno_pointer_flag_length);
-
- regno_pointer_flag = new;
- regno_pointer_align = new1;
-
- set_new_first_and_last_insn (first_insn, last_insn);
-}
-
-/* Return a copy of a chain of nodes, chained through the TREE_CHAIN field.
- For example, this can copy a list made of TREE_LIST nodes. While copying,
- for each node copied which doesn't already have is DECL_ABSTRACT_ORIGIN
- set to some non-zero value, set the DECL_ABSTRACT_ORIGIN of the copy to
- point to the corresponding (abstract) original node. */
-
-static tree
-copy_decl_list (list)
- tree list;
-{
- tree head;
- register tree prev, next;
-
- if (list == 0)
- return 0;
-
- head = prev = copy_node (list);
- if (DECL_ABSTRACT_ORIGIN (head) == NULL_TREE)
- DECL_ABSTRACT_ORIGIN (head) = list;
- next = TREE_CHAIN (list);
- while (next)
- {
- register tree copy;
-
- copy = copy_node (next);
- if (DECL_ABSTRACT_ORIGIN (copy) == NULL_TREE)
- DECL_ABSTRACT_ORIGIN (copy) = next;
- TREE_CHAIN (prev) = copy;
- prev = copy;
- next = TREE_CHAIN (next);
- }
- return head;
-}
-
-/* Make a copy of the entire tree of blocks BLOCK, and return it. */
-
-static tree
-copy_decl_tree (block)
- tree block;
-{
- tree t, vars, subblocks;
-
- vars = copy_decl_list (BLOCK_VARS (block));
- subblocks = 0;
-
- /* Process all subblocks. */
- for (t = BLOCK_SUBBLOCKS (block); t; t = TREE_CHAIN (t))
- {
- tree copy = copy_decl_tree (t);
- TREE_CHAIN (copy) = subblocks;
- subblocks = copy;
- }
-
- t = copy_node (block);
- BLOCK_VARS (t) = vars;
- BLOCK_SUBBLOCKS (t) = nreverse (subblocks);
- /* If the BLOCK being cloned is already marked as having been instantiated
- from something else, then leave that `origin' marking alone. Otherwise,
- mark the clone as having originated from the BLOCK we are cloning. */
- if (BLOCK_ABSTRACT_ORIGIN (t) == NULL_TREE)
- BLOCK_ABSTRACT_ORIGIN (t) = block;
- return t;
-}
-
-/* Copy DECL_RTLs in all decls in the given BLOCK node. */
-
-static void
-copy_decl_rtls (block)
- tree block;
-{
- tree t;
-
- for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
- if (DECL_RTL (t) && GET_CODE (DECL_RTL (t)) == MEM)
- DECL_RTL (t) = copy_for_inline (DECL_RTL (t));
-
- /* Process all subblocks. */
- for (t = BLOCK_SUBBLOCKS (block); t; t = TREE_CHAIN (t))
- copy_decl_rtls (t);
-}
-
-/* Make the insns and PARM_DECLs of the current function permanent
- and record other information in DECL_SAVED_INSNS to allow inlining
- of this function in subsequent calls.
-
- This routine need not copy any insns because we are not going
- to immediately compile the insns in the insn chain. There
- are two cases when we would compile the insns for FNDECL:
- (1) when FNDECL is expanded inline, and (2) when FNDECL needs to
- be output at the end of other compilation, because somebody took
- its address. In the first case, the insns of FNDECL are copied
- as it is expanded inline, so FNDECL's saved insns are not
- modified. In the second case, FNDECL is used for the last time,
- so modifying the rtl is not a problem.
-
- We don't have to worry about FNDECL being inline expanded by
- other functions which are written at the end of compilation
- because flag_no_inline is turned on when we begin writing
- functions at the end of compilation. */
-
-void
-save_for_inline_nocopy (fndecl)
- tree fndecl;
-{
- rtx insn;
- rtx head;
- rtx first_nonparm_insn;
-
- /* Set up PARMDECL_MAP which maps pseudo-reg number to its PARM_DECL.
- Later we set TREE_READONLY to 0 if the parm is modified inside the fn.
- Also set up ARG_VECTOR, which holds the unmodified DECL_RTX values
- for the parms, prior to elimination of virtual registers.
- These values are needed for substituting parms properly. */
-
- max_parm_reg = max_parm_reg_num ();
- parmdecl_map = (tree *) alloca (max_parm_reg * sizeof (tree));
-
- /* Make and emit a return-label if we have not already done so. */
-
- if (return_label == 0)
- {
- return_label = gen_label_rtx ();
- emit_label (return_label);
- }
-
- head = initialize_for_inline (fndecl, get_first_label_num (),
- max_label_num (), max_reg_num (), 0);
-
- /* If there are insns that copy parms from the stack into pseudo registers,
- those insns are not copied. `expand_inline_function' must
- emit the correct code to handle such things. */
-
- insn = get_insns ();
- if (GET_CODE (insn) != NOTE)
- abort ();
-
- /* Get the insn which signals the end of parameter setup code. */
- first_nonparm_insn = get_first_nonparm_insn ();
-
- /* Now just scan the chain of insns to see what happens to our
- PARM_DECLs. If a PARM_DECL is used but never modified, we
- can substitute its rtl directly when expanding inline (and
- perform constant folding when its incoming value is constant).
- Otherwise, we have to copy its value into a new register and track
- the new register's life. */
-
- for (insn = NEXT_INSN (insn); insn; insn = NEXT_INSN (insn))
- {
- if (insn == first_nonparm_insn)
- in_nonparm_insns = 1;
-
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- if (current_function_uses_const_pool)
- {
- /* Replace any constant pool references with the actual constant.
- We will put the constant back if we need to write the
- function out after all. */
- save_constants (&PATTERN (insn));
- if (REG_NOTES (insn))
- save_constants (&REG_NOTES (insn));
- }
-
- /* Record what interesting things happen to our parameters. */
- note_stores (PATTERN (insn), note_modified_parmregs);
- }
- }
-
- /* Also scan all decls, and replace any constant pool references with the
- actual constant. */
- save_constants_in_decl_trees (DECL_INITIAL (fndecl));
-
- /* We have now allocated all that needs to be allocated permanently
- on the rtx obstack. Set our high-water mark, so that we
- can free the rest of this when the time comes. */
-
- preserve_data ();
-
- finish_inline (fndecl, head);
-}
-
-/* Given PX, a pointer into an insn, search for references to the constant
- pool. Replace each with a CONST that has the mode of the original
- constant, contains the constant, and has RTX_INTEGRATED_P set.
- Similarly, constant pool addresses not enclosed in a MEM are replaced
- with an ADDRESS and CONST rtx which also gives the constant, its
- mode, the mode of the address, and has RTX_INTEGRATED_P set. */
-
-static void
-save_constants (px)
- rtx *px;
-{
- rtx x;
- int i, j;
-
- again:
- x = *px;
-
- /* If this is a CONST_DOUBLE, don't try to fix things up in
- CONST_DOUBLE_MEM, because this is an infinite recursion. */
- if (GET_CODE (x) == CONST_DOUBLE)
- return;
- else if (GET_CODE (x) == MEM && GET_CODE (XEXP (x, 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (x,0)))
- {
- enum machine_mode const_mode = get_pool_mode (XEXP (x, 0));
- rtx new = gen_rtx (CONST, const_mode, get_pool_constant (XEXP (x, 0)));
- RTX_INTEGRATED_P (new) = 1;
-
- /* If the MEM was in a different mode than the constant (perhaps we
- were only looking at the low-order part), surround it with a
- SUBREG so we can save both modes. */
-
- if (GET_MODE (x) != const_mode)
- {
- new = gen_rtx (SUBREG, GET_MODE (x), new, 0);
- RTX_INTEGRATED_P (new) = 1;
- }
-
- *px = new;
- save_constants (&XEXP (*px, 0));
- }
- else if (GET_CODE (x) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (x))
- {
- *px = gen_rtx (ADDRESS, GET_MODE (x),
- gen_rtx (CONST, get_pool_mode (x),
- get_pool_constant (x)));
- save_constants (&XEXP (*px, 0));
- RTX_INTEGRATED_P (*px) = 1;
- }
-
- else
- {
- char *fmt = GET_RTX_FORMAT (GET_CODE (x));
- int len = GET_RTX_LENGTH (GET_CODE (x));
-
- for (i = len-1; i >= 0; i--)
- {
- switch (fmt[i])
- {
- case 'E':
- for (j = 0; j < XVECLEN (x, i); j++)
- save_constants (&XVECEXP (x, i, j));
- break;
-
- case 'e':
- if (XEXP (x, i) == 0)
- continue;
- if (i == 0)
- {
- /* Hack tail-recursion here. */
- px = &XEXP (x, 0);
- goto again;
- }
- save_constants (&XEXP (x, i));
- break;
- }
- }
- }
-}
-
-/* Note whether a parameter is modified or not. */
-
-static void
-note_modified_parmregs (reg, x)
- rtx reg;
- rtx x;
-{
- if (GET_CODE (reg) == REG && in_nonparm_insns
- && REGNO (reg) < max_parm_reg
- && REGNO (reg) >= FIRST_PSEUDO_REGISTER
- && parmdecl_map[REGNO (reg)] != 0)
- TREE_READONLY (parmdecl_map[REGNO (reg)]) = 0;
-}
-
-/* Copy the rtx ORIG recursively, replacing pseudo-regs and labels
- according to `reg_map' and `label_map'. The original rtl insns
- will be saved for inlining; this is used to make a copy
- which is used to finish compiling the inline function itself.
-
- If we find a "saved" constant pool entry, one which was replaced with
- the value of the constant, convert it back to a constant pool entry.
- Since the pool wasn't touched, this should simply restore the old
- address.
-
- All other kinds of rtx are copied except those that can never be
- changed during compilation. */
-
-static rtx
-copy_for_inline (orig)
- rtx orig;
-{
- register rtx x = orig;
- register rtx new;
- register int i;
- register enum rtx_code code;
- register char *format_ptr;
-
- if (x == 0)
- return x;
-
- code = GET_CODE (x);
-
- /* These types may be freely shared. */
-
- switch (code)
- {
- case QUEUED:
- case CONST_INT:
- case SYMBOL_REF:
- case PC:
- case CC0:
- return x;
-
- case CONST_DOUBLE:
- /* We have to make a new CONST_DOUBLE to ensure that we account for
- it correctly. Using the old CONST_DOUBLE_MEM data is wrong. */
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- {
- REAL_VALUE_TYPE d;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, x);
- return CONST_DOUBLE_FROM_REAL_VALUE (d, GET_MODE (x));
- }
- else
- return immed_double_const (CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x),
- VOIDmode);
-
- case CONST:
- /* Get constant pool entry for constant in the pool. */
- if (RTX_INTEGRATED_P (x))
- return validize_mem (force_const_mem (GET_MODE (x),
- copy_for_inline (XEXP (x, 0))));
- break;
-
- case SUBREG:
- /* Get constant pool entry, but access in different mode. */
- if (RTX_INTEGRATED_P (x))
- {
- new = force_const_mem (GET_MODE (SUBREG_REG (x)),
- copy_for_inline (XEXP (SUBREG_REG (x), 0)));
-
- PUT_MODE (new, GET_MODE (x));
- return validize_mem (new);
- }
- break;
-
- case ADDRESS:
- /* If not special for constant pool error. Else get constant pool
- address. */
- if (! RTX_INTEGRATED_P (x))
- abort ();
-
- new = force_const_mem (GET_MODE (XEXP (x, 0)),
- copy_for_inline (XEXP (XEXP (x, 0), 0)));
- new = XEXP (new, 0);
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (new) != GET_MODE (x))
- new = convert_memory_address (GET_MODE (x), new);
-#endif
-
- return new;
-
- case ASM_OPERANDS:
- /* If a single asm insn contains multiple output operands
- then it contains multiple ASM_OPERANDS rtx's that share operand 3.
- We must make sure that the copied insn continues to share it. */
- if (orig_asm_operands_vector == XVEC (orig, 3))
- {
- x = rtx_alloc (ASM_OPERANDS);
- x->volatil = orig->volatil;
- XSTR (x, 0) = XSTR (orig, 0);
- XSTR (x, 1) = XSTR (orig, 1);
- XINT (x, 2) = XINT (orig, 2);
- XVEC (x, 3) = copy_asm_operands_vector;
- XVEC (x, 4) = copy_asm_constraints_vector;
- XSTR (x, 5) = XSTR (orig, 5);
- XINT (x, 6) = XINT (orig, 6);
- return x;
- }
- break;
-
- case MEM:
- /* A MEM is usually allowed to be shared if its address is constant
- or is a constant plus one of the special registers.
-
- We do not allow sharing of addresses that are either a special
- register or the sum of a constant and a special register because
- it is possible for unshare_all_rtl to copy the address, into memory
- that won't be saved. Although the MEM can safely be shared, and
- won't be copied there, the address itself cannot be shared, and may
- need to be copied.
-
- There are also two exceptions with constants: The first is if the
- constant is a LABEL_REF or the sum of the LABEL_REF
- and an integer. This case can happen if we have an inline
- function that supplies a constant operand to the call of another
- inline function that uses it in a switch statement. In this case,
- we will be replacing the LABEL_REF, so we have to replace this MEM
- as well.
-
- The second case is if we have a (const (plus (address ..) ...)).
- In that case we need to put back the address of the constant pool
- entry. */
-
- if (CONSTANT_ADDRESS_P (XEXP (x, 0))
- && GET_CODE (XEXP (x, 0)) != LABEL_REF
- && ! (GET_CODE (XEXP (x, 0)) == CONST
- && (GET_CODE (XEXP (XEXP (x, 0), 0)) == PLUS
- && ((GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0))
- == LABEL_REF)
- || (GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0))
- == ADDRESS)))))
- return x;
- break;
-
- case LABEL_REF:
- /* If this is a non-local label, just make a new LABEL_REF.
- Otherwise, use the new label as well. */
- x = gen_rtx (LABEL_REF, GET_MODE (orig),
- LABEL_REF_NONLOCAL_P (orig) ? XEXP (orig, 0)
- : label_map[CODE_LABEL_NUMBER (XEXP (orig, 0))]);
- LABEL_REF_NONLOCAL_P (x) = LABEL_REF_NONLOCAL_P (orig);
- LABEL_OUTSIDE_LOOP_P (x) = LABEL_OUTSIDE_LOOP_P (orig);
- return x;
-
- case REG:
- if (REGNO (x) > LAST_VIRTUAL_REGISTER)
- return reg_map [REGNO (x)];
- else
- return x;
-
- case SET:
- /* If a parm that gets modified lives in a pseudo-reg,
- clear its TREE_READONLY to prevent certain optimizations. */
- {
- rtx dest = SET_DEST (x);
-
- while (GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SUBREG)
- dest = XEXP (dest, 0);
-
- if (GET_CODE (dest) == REG
- && REGNO (dest) < max_parm_reg
- && REGNO (dest) >= FIRST_PSEUDO_REGISTER
- && parmdecl_map[REGNO (dest)] != 0
- /* The insn to load an arg pseudo from a stack slot
- does not count as modifying it. */
- && in_nonparm_insns)
- TREE_READONLY (parmdecl_map[REGNO (dest)]) = 0;
- }
- break;
-
-#if 0 /* This is a good idea, but here is the wrong place for it. */
- /* Arrange that CONST_INTs always appear as the second operand
- if they appear, and that `frame_pointer_rtx' or `arg_pointer_rtx'
- always appear as the first. */
- case PLUS:
- if (GET_CODE (XEXP (x, 0)) == CONST_INT
- || (XEXP (x, 1) == frame_pointer_rtx
- || (ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && XEXP (x, 1) == arg_pointer_rtx)))
- {
- rtx t = XEXP (x, 0);
- XEXP (x, 0) = XEXP (x, 1);
- XEXP (x, 1) = t;
- }
- break;
-#endif
- }
-
- /* Replace this rtx with a copy of itself. */
-
- x = rtx_alloc (code);
- bcopy ((char *) orig, (char *) x,
- (sizeof (*x) - sizeof (x->fld)
- + sizeof (x->fld[0]) * GET_RTX_LENGTH (code)));
-
- /* Now scan the subexpressions recursively.
- We can store any replaced subexpressions directly into X
- since we know X is not shared! Any vectors in X
- must be copied if X was copied. */
-
- format_ptr = GET_RTX_FORMAT (code);
-
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- XEXP (x, i) = copy_for_inline (XEXP (x, i));
- break;
-
- case 'u':
- /* Change any references to old-insns to point to the
- corresponding copied insns. */
- XEXP (x, i) = insn_map[INSN_UID (XEXP (x, i))];
- break;
-
- case 'E':
- if (XVEC (x, i) != NULL && XVECLEN (x, i) != 0)
- {
- register int j;
-
- XVEC (x, i) = gen_rtvec_vv (XVECLEN (x, i), XVEC (x, i)->elem);
- for (j = 0; j < XVECLEN (x, i); j++)
- XVECEXP (x, i, j)
- = copy_for_inline (XVECEXP (x, i, j));
- }
- break;
- }
- }
-
- if (code == ASM_OPERANDS && orig_asm_operands_vector == 0)
- {
- orig_asm_operands_vector = XVEC (orig, 3);
- copy_asm_operands_vector = XVEC (x, 3);
- copy_asm_constraints_vector = XVEC (x, 4);
- }
-
- return x;
-}
-
-/* Unfortunately, we need a global copy of const_equiv map for communication
- with a function called from note_stores. Be *very* careful that this
- is used properly in the presence of recursion. */
-
-rtx *global_const_equiv_map;
-int global_const_equiv_map_size;
-
-#define FIXED_BASE_PLUS_P(X) \
- (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \
- && GET_CODE (XEXP (X, 0)) == REG \
- && REGNO (XEXP (X, 0)) >= FIRST_VIRTUAL_REGISTER \
- && REGNO (XEXP (X, 0)) <= LAST_VIRTUAL_REGISTER)
-
-/* Integrate the procedure defined by FNDECL. Note that this function
- may wind up calling itself. Since the static variables are not
- reentrant, we do not assign them until after the possibility
- of recursion is eliminated.
-
- If IGNORE is nonzero, do not produce a value.
- Otherwise store the value in TARGET if it is nonzero and that is convenient.
-
- Value is:
- (rtx)-1 if we could not substitute the function
- 0 if we substituted it and it does not produce a value
- else an rtx for where the value is stored. */
-
-rtx
-expand_inline_function (fndecl, parms, target, ignore, type,
- structure_value_addr)
- tree fndecl, parms;
- rtx target;
- int ignore;
- tree type;
- rtx structure_value_addr;
-{
- tree formal, actual, block;
- rtx header = DECL_SAVED_INSNS (fndecl);
- rtx insns = FIRST_FUNCTION_INSN (header);
- rtx parm_insns = FIRST_PARM_INSN (header);
- tree *arg_trees;
- rtx *arg_vals;
- rtx insn;
- int max_regno;
- register int i;
- int min_labelno = FIRST_LABELNO (header);
- int max_labelno = LAST_LABELNO (header);
- int nargs;
- rtx local_return_label = 0;
- rtx loc;
- rtx stack_save = 0;
- rtx temp;
- struct inline_remap *map;
- rtx cc0_insn = 0;
- rtvec arg_vector = ORIGINAL_ARG_VECTOR (header);
- rtx static_chain_value = 0;
-
- /* Allow for equivalences of the pseudos we make for virtual fp and ap. */
- max_regno = MAX_REGNUM (header) + 3;
- if (max_regno < FIRST_PSEUDO_REGISTER)
- abort ();
-
- nargs = list_length (DECL_ARGUMENTS (fndecl));
-
- /* Check that the parms type match and that sufficient arguments were
- passed. Since the appropriate conversions or default promotions have
- already been applied, the machine modes should match exactly. */
-
- for (formal = DECL_ARGUMENTS (fndecl), actual = parms;
- formal;
- formal = TREE_CHAIN (formal), actual = TREE_CHAIN (actual))
- {
- tree arg;
- enum machine_mode mode;
-
- if (actual == 0)
- return (rtx) (HOST_WIDE_INT) -1;
-
- arg = TREE_VALUE (actual);
- mode = TYPE_MODE (DECL_ARG_TYPE (formal));
-
- if (mode != TYPE_MODE (TREE_TYPE (arg))
- /* If they are block mode, the types should match exactly.
- They don't match exactly if TREE_TYPE (FORMAL) == ERROR_MARK_NODE,
- which could happen if the parameter has incomplete type. */
- || (mode == BLKmode
- && (TYPE_MAIN_VARIANT (TREE_TYPE (arg))
- != TYPE_MAIN_VARIANT (TREE_TYPE (formal)))))
- return (rtx) (HOST_WIDE_INT) -1;
- }
-
- /* Extra arguments are valid, but will be ignored below, so we must
- evaluate them here for side-effects. */
- for (; actual; actual = TREE_CHAIN (actual))
- expand_expr (TREE_VALUE (actual), const0_rtx,
- TYPE_MODE (TREE_TYPE (TREE_VALUE (actual))), 0);
-
- /* Make a binding contour to keep inline cleanups called at
- outer function-scope level from looking like they are shadowing
- parameter declarations. */
- pushlevel (0);
-
- /* Make a fresh binding contour that we can easily remove. */
- pushlevel (0);
- expand_start_bindings (0);
-
- /* Expand the function arguments. Do this first so that any
- new registers get created before we allocate the maps. */
-
- arg_vals = (rtx *) alloca (nargs * sizeof (rtx));
- arg_trees = (tree *) alloca (nargs * sizeof (tree));
-
- for (formal = DECL_ARGUMENTS (fndecl), actual = parms, i = 0;
- formal;
- formal = TREE_CHAIN (formal), actual = TREE_CHAIN (actual), i++)
- {
- /* Actual parameter, converted to the type of the argument within the
- function. */
- tree arg = convert (TREE_TYPE (formal), TREE_VALUE (actual));
- /* Mode of the variable used within the function. */
- enum machine_mode mode = TYPE_MODE (TREE_TYPE (formal));
- int invisiref = 0;
-
- arg_trees[i] = arg;
- loc = RTVEC_ELT (arg_vector, i);
-
- /* If this is an object passed by invisible reference, we copy the
- object into a stack slot and save its address. If this will go
- into memory, we do nothing now. Otherwise, we just expand the
- argument. */
- if (GET_CODE (loc) == MEM && GET_CODE (XEXP (loc, 0)) == REG
- && REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER)
- {
- rtx stack_slot
- = assign_stack_temp (TYPE_MODE (TREE_TYPE (arg)),
- int_size_in_bytes (TREE_TYPE (arg)), 1);
- MEM_IN_STRUCT_P (stack_slot) = AGGREGATE_TYPE_P (TREE_TYPE (arg));
-
- store_expr (arg, stack_slot, 0);
-
- arg_vals[i] = XEXP (stack_slot, 0);
- invisiref = 1;
- }
- else if (GET_CODE (loc) != MEM)
- {
- if (GET_MODE (loc) != TYPE_MODE (TREE_TYPE (arg)))
- /* The mode if LOC and ARG can differ if LOC was a variable
- that had its mode promoted via PROMOTED_MODE. */
- arg_vals[i] = convert_modes (GET_MODE (loc),
- TYPE_MODE (TREE_TYPE (arg)),
- expand_expr (arg, NULL_RTX, mode,
- EXPAND_SUM),
- TREE_UNSIGNED (TREE_TYPE (formal)));
- else
- arg_vals[i] = expand_expr (arg, NULL_RTX, mode, EXPAND_SUM);
- }
- else
- arg_vals[i] = 0;
-
- if (arg_vals[i] != 0
- && (! TREE_READONLY (formal)
- /* If the parameter is not read-only, copy our argument through
- a register. Also, we cannot use ARG_VALS[I] if it overlaps
- TARGET in any way. In the inline function, they will likely
- be two different pseudos, and `safe_from_p' will make all
- sorts of smart assumptions about their not conflicting.
- But if ARG_VALS[I] overlaps TARGET, these assumptions are
- wrong, so put ARG_VALS[I] into a fresh register.
- Don't worry about invisible references, since their stack
- temps will never overlap the target. */
- || (target != 0
- && ! invisiref
- && (GET_CODE (arg_vals[i]) == REG
- || GET_CODE (arg_vals[i]) == SUBREG
- || GET_CODE (arg_vals[i]) == MEM)
- && reg_overlap_mentioned_p (arg_vals[i], target))
- /* ??? We must always copy a SUBREG into a REG, because it might
- get substituted into an address, and not all ports correctly
- handle SUBREGs in addresses. */
- || (GET_CODE (arg_vals[i]) == SUBREG)))
- arg_vals[i] = copy_to_mode_reg (GET_MODE (loc), arg_vals[i]);
-
- if (arg_vals[i] != 0 && GET_CODE (arg_vals[i]) == REG
- && TREE_CODE (TREE_TYPE (formal)) == POINTER_TYPE)
- mark_reg_pointer (arg_vals[i],
- (TYPE_ALIGN (TREE_TYPE (TREE_TYPE (formal)))
- / BITS_PER_UNIT));
- }
-
- /* Allocate the structures we use to remap things. */
-
- map = (struct inline_remap *) alloca (sizeof (struct inline_remap));
- map->fndecl = fndecl;
-
- map->reg_map = (rtx *) alloca (max_regno * sizeof (rtx));
- bzero ((char *) map->reg_map, max_regno * sizeof (rtx));
-
- map->label_map = (rtx *)alloca ((max_labelno - min_labelno) * sizeof (rtx));
- map->label_map -= min_labelno;
-
- map->insn_map = (rtx *) alloca (INSN_UID (header) * sizeof (rtx));
- bzero ((char *) map->insn_map, INSN_UID (header) * sizeof (rtx));
- map->min_insnno = 0;
- map->max_insnno = INSN_UID (header);
-
- map->integrating = 1;
-
- /* const_equiv_map maps pseudos in our routine to constants, so it needs to
- be large enough for all our pseudos. This is the number we are currently
- using plus the number in the called routine, plus 15 for each arg,
- five to compute the virtual frame pointer, and five for the return value.
- This should be enough for most cases. We do not reference entries
- outside the range of the map.
-
- ??? These numbers are quite arbitrary and were obtained by
- experimentation. At some point, we should try to allocate the
- table after all the parameters are set up so we an more accurately
- estimate the number of pseudos we will need. */
-
- map->const_equiv_map_size
- = max_reg_num () + (max_regno - FIRST_PSEUDO_REGISTER) + 15 * nargs + 10;
-
- map->const_equiv_map
- = (rtx *)alloca (map->const_equiv_map_size * sizeof (rtx));
- bzero ((char *) map->const_equiv_map,
- map->const_equiv_map_size * sizeof (rtx));
-
- map->const_age_map
- = (unsigned *)alloca (map->const_equiv_map_size * sizeof (unsigned));
- bzero ((char *) map->const_age_map,
- map->const_equiv_map_size * sizeof (unsigned));
- map->const_age = 0;
-
- /* Record the current insn in case we have to set up pointers to frame
- and argument memory blocks. */
- map->insns_at_start = get_last_insn ();
-
- map->regno_pointer_flag = INLINE_REGNO_POINTER_FLAG (header);
- map->regno_pointer_align = INLINE_REGNO_POINTER_ALIGN (header);
-
- /* Update the outgoing argument size to allow for those in the inlined
- function. */
- if (OUTGOING_ARGS_SIZE (header) > current_function_outgoing_args_size)
- current_function_outgoing_args_size = OUTGOING_ARGS_SIZE (header);
-
- /* If the inline function needs to make PIC references, that means
- that this function's PIC offset table must be used. */
- if (FUNCTION_FLAGS (header) & FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE)
- current_function_uses_pic_offset_table = 1;
-
- /* If this function needs a context, set it up. */
- if (FUNCTION_FLAGS (header) & FUNCTION_FLAGS_NEEDS_CONTEXT)
- static_chain_value = lookup_static_chain (fndecl);
-
- if (GET_CODE (parm_insns) == NOTE
- && NOTE_LINE_NUMBER (parm_insns) > 0)
- {
- rtx note = emit_note (NOTE_SOURCE_FILE (parm_insns),
- NOTE_LINE_NUMBER (parm_insns));
- if (note)
- RTX_INTEGRATED_P (note) = 1;
- }
-
- /* Process each argument. For each, set up things so that the function's
- reference to the argument will refer to the argument being passed.
- We only replace REG with REG here. Any simplifications are done
- via const_equiv_map.
-
- We make two passes: In the first, we deal with parameters that will
- be placed into registers, since we need to ensure that the allocated
- register number fits in const_equiv_map. Then we store all non-register
- parameters into their memory location. */
-
- /* Don't try to free temp stack slots here, because we may put one of the
- parameters into a temp stack slot. */
-
- for (i = 0; i < nargs; i++)
- {
- rtx copy = arg_vals[i];
-
- loc = RTVEC_ELT (arg_vector, i);
-
- /* There are three cases, each handled separately. */
- if (GET_CODE (loc) == MEM && GET_CODE (XEXP (loc, 0)) == REG
- && REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER)
- {
- /* This must be an object passed by invisible reference (it could
- also be a variable-sized object, but we forbid inlining functions
- with variable-sized arguments). COPY is the address of the
- actual value (this computation will cause it to be copied). We
- map that address for the register, noting the actual address as
- an equivalent in case it can be substituted into the insns. */
-
- if (GET_CODE (copy) != REG)
- {
- temp = copy_addr_to_reg (copy);
- if ((CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
- && REGNO (temp) < map->const_equiv_map_size)
- {
- map->const_equiv_map[REGNO (temp)] = copy;
- map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
- }
- copy = temp;
- }
- map->reg_map[REGNO (XEXP (loc, 0))] = copy;
- }
- else if (GET_CODE (loc) == MEM)
- {
- /* This is the case of a parameter that lives in memory.
- It will live in the block we allocate in the called routine's
- frame that simulates the incoming argument area. Do nothing
- now; we will call store_expr later. */
- ;
- }
- else if (GET_CODE (loc) == REG)
- {
- /* This is the good case where the parameter is in a register.
- If it is read-only and our argument is a constant, set up the
- constant equivalence.
-
- If LOC is REG_USERVAR_P, the usual case, COPY must also have
- that flag set if it is a register.
-
- Also, don't allow hard registers here; they might not be valid
- when substituted into insns. */
-
- if ((GET_CODE (copy) != REG && GET_CODE (copy) != SUBREG)
- || (GET_CODE (copy) == REG && REG_USERVAR_P (loc)
- && ! REG_USERVAR_P (copy))
- || (GET_CODE (copy) == REG
- && REGNO (copy) < FIRST_PSEUDO_REGISTER))
- {
- temp = copy_to_mode_reg (GET_MODE (loc), copy);
- REG_USERVAR_P (temp) = REG_USERVAR_P (loc);
- if ((CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
- && REGNO (temp) < map->const_equiv_map_size)
- {
- map->const_equiv_map[REGNO (temp)] = copy;
- map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
- }
- copy = temp;
- }
- map->reg_map[REGNO (loc)] = copy;
- }
- else if (GET_CODE (loc) == CONCAT)
- {
- /* This is the good case where the parameter is in a
- pair of separate pseudos.
- If it is read-only and our argument is a constant, set up the
- constant equivalence.
-
- If LOC is REG_USERVAR_P, the usual case, COPY must also have
- that flag set if it is a register.
-
- Also, don't allow hard registers here; they might not be valid
- when substituted into insns. */
- rtx locreal = gen_realpart (GET_MODE (XEXP (loc, 0)), loc);
- rtx locimag = gen_imagpart (GET_MODE (XEXP (loc, 0)), loc);
- rtx copyreal = gen_realpart (GET_MODE (locreal), copy);
- rtx copyimag = gen_imagpart (GET_MODE (locimag), copy);
-
- if ((GET_CODE (copyreal) != REG && GET_CODE (copyreal) != SUBREG)
- || (GET_CODE (copyreal) == REG && REG_USERVAR_P (locreal)
- && ! REG_USERVAR_P (copyreal))
- || (GET_CODE (copyreal) == REG
- && REGNO (copyreal) < FIRST_PSEUDO_REGISTER))
- {
- temp = copy_to_mode_reg (GET_MODE (locreal), copyreal);
- REG_USERVAR_P (temp) = REG_USERVAR_P (locreal);
- if ((CONSTANT_P (copyreal) || FIXED_BASE_PLUS_P (copyreal))
- && REGNO (temp) < map->const_equiv_map_size)
- {
- map->const_equiv_map[REGNO (temp)] = copyreal;
- map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
- }
- copyreal = temp;
- }
- map->reg_map[REGNO (locreal)] = copyreal;
-
- if ((GET_CODE (copyimag) != REG && GET_CODE (copyimag) != SUBREG)
- || (GET_CODE (copyimag) == REG && REG_USERVAR_P (locimag)
- && ! REG_USERVAR_P (copyimag))
- || (GET_CODE (copyimag) == REG
- && REGNO (copyimag) < FIRST_PSEUDO_REGISTER))
- {
- temp = copy_to_mode_reg (GET_MODE (locimag), copyimag);
- REG_USERVAR_P (temp) = REG_USERVAR_P (locimag);
- if ((CONSTANT_P (copyimag) || FIXED_BASE_PLUS_P (copyimag))
- && REGNO (temp) < map->const_equiv_map_size)
- {
- map->const_equiv_map[REGNO (temp)] = copyimag;
- map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
- }
- copyimag = temp;
- }
- map->reg_map[REGNO (locimag)] = copyimag;
- }
- else
- abort ();
- }
-
- /* Now do the parameters that will be placed in memory. */
-
- for (formal = DECL_ARGUMENTS (fndecl), i = 0;
- formal; formal = TREE_CHAIN (formal), i++)
- {
- loc = RTVEC_ELT (arg_vector, i);
-
- if (GET_CODE (loc) == MEM
- /* Exclude case handled above. */
- && ! (GET_CODE (XEXP (loc, 0)) == REG
- && REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER))
- {
- rtx note = emit_note (DECL_SOURCE_FILE (formal),
- DECL_SOURCE_LINE (formal));
- if (note)
- RTX_INTEGRATED_P (note) = 1;
-
- /* Compute the address in the area we reserved and store the
- value there. */
- temp = copy_rtx_and_substitute (loc, map);
- subst_constants (&temp, NULL_RTX, map);
- apply_change_group ();
- if (! memory_address_p (GET_MODE (temp), XEXP (temp, 0)))
- temp = change_address (temp, VOIDmode, XEXP (temp, 0));
- store_expr (arg_trees[i], temp, 0);
- }
- }
-
- /* Deal with the places that the function puts its result.
- We are driven by what is placed into DECL_RESULT.
-
- Initially, we assume that we don't have anything special handling for
- REG_FUNCTION_RETURN_VALUE_P. */
-
- map->inline_target = 0;
- loc = DECL_RTL (DECL_RESULT (fndecl));
- if (TYPE_MODE (type) == VOIDmode)
- /* There is no return value to worry about. */
- ;
- else if (GET_CODE (loc) == MEM)
- {
- if (! structure_value_addr || ! aggregate_value_p (DECL_RESULT (fndecl)))
- abort ();
-
- /* Pass the function the address in which to return a structure value.
- Note that a constructor can cause someone to call us with
- STRUCTURE_VALUE_ADDR, but the initialization takes place
- via the first parameter, rather than the struct return address.
-
- We have two cases: If the address is a simple register indirect,
- use the mapping mechanism to point that register to our structure
- return address. Otherwise, store the structure return value into
- the place that it will be referenced from. */
-
- if (GET_CODE (XEXP (loc, 0)) == REG)
- {
- temp = force_reg (Pmode,
- force_operand (structure_value_addr, NULL_RTX));
- map->reg_map[REGNO (XEXP (loc, 0))] = temp;
- if ((CONSTANT_P (structure_value_addr)
- || (GET_CODE (structure_value_addr) == PLUS
- && XEXP (structure_value_addr, 0) == virtual_stack_vars_rtx
- && GET_CODE (XEXP (structure_value_addr, 1)) == CONST_INT))
- && REGNO (temp) < map->const_equiv_map_size)
- {
- map->const_equiv_map[REGNO (temp)] = structure_value_addr;
- map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
- }
- }
- else
- {
- temp = copy_rtx_and_substitute (loc, map);
- subst_constants (&temp, NULL_RTX, map);
- apply_change_group ();
- emit_move_insn (temp, structure_value_addr);
- }
- }
- else if (ignore)
- /* We will ignore the result value, so don't look at its structure.
- Note that preparations for an aggregate return value
- do need to be made (above) even if it will be ignored. */
- ;
- else if (GET_CODE (loc) == REG)
- {
- /* The function returns an object in a register and we use the return
- value. Set up our target for remapping. */
-
- /* Machine mode function was declared to return. */
- enum machine_mode departing_mode = TYPE_MODE (type);
- /* (Possibly wider) machine mode it actually computes
- (for the sake of callers that fail to declare it right). */
- enum machine_mode arriving_mode
- = TYPE_MODE (TREE_TYPE (DECL_RESULT (fndecl)));
- rtx reg_to_map;
-
- /* Don't use MEMs as direct targets because on some machines
- substituting a MEM for a REG makes invalid insns.
- Let the combiner substitute the MEM if that is valid. */
- if (target == 0 || GET_CODE (target) != REG
- || GET_MODE (target) != departing_mode)
- target = gen_reg_rtx (departing_mode);
-
- /* If function's value was promoted before return,
- avoid machine mode mismatch when we substitute INLINE_TARGET.
- But TARGET is what we will return to the caller. */
- if (arriving_mode != departing_mode)
- {
- /* Avoid creating a paradoxical subreg wider than
- BITS_PER_WORD, since that is illegal. */
- if (GET_MODE_BITSIZE (arriving_mode) > BITS_PER_WORD)
- {
- if (!TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (departing_mode),
- GET_MODE_BITSIZE (arriving_mode)))
- /* Maybe could be handled by using convert_move () ? */
- abort ();
- reg_to_map = gen_reg_rtx (arriving_mode);
- target = gen_lowpart (departing_mode, reg_to_map);
- }
- else
- reg_to_map = gen_rtx (SUBREG, arriving_mode, target, 0);
- }
- else
- reg_to_map = target;
-
- /* Usually, the result value is the machine's return register.
- Sometimes it may be a pseudo. Handle both cases. */
- if (REG_FUNCTION_VALUE_P (loc))
- map->inline_target = reg_to_map;
- else
- map->reg_map[REGNO (loc)] = reg_to_map;
- }
- else
- abort ();
-
- /* Make new label equivalences for the labels in the called function. */
- for (i = min_labelno; i < max_labelno; i++)
- map->label_map[i] = gen_label_rtx ();
-
- /* Perform postincrements before actually calling the function. */
- emit_queue ();
-
- /* Clean up stack so that variables might have smaller offsets. */
- do_pending_stack_adjust ();
-
- /* Save a copy of the location of const_equiv_map for mark_stores, called
- via note_stores. */
- global_const_equiv_map = map->const_equiv_map;
- global_const_equiv_map_size = map->const_equiv_map_size;
-
- /* If the called function does an alloca, save and restore the
- stack pointer around the call. This saves stack space, but
- also is required if this inline is being done between two
- pushes. */
- if (FUNCTION_FLAGS (header) & FUNCTION_FLAGS_CALLS_ALLOCA)
- emit_stack_save (SAVE_BLOCK, &stack_save, NULL_RTX);
-
- /* Now copy the insns one by one. Do this in two passes, first the insns and
- then their REG_NOTES, just like save_for_inline. */
-
- /* This loop is very similar to the loop in copy_loop_body in unroll.c. */
-
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- {
- rtx copy, pattern, set;
-
- map->orig_asm_operands_vector = 0;
-
- switch (GET_CODE (insn))
- {
- case INSN:
- pattern = PATTERN (insn);
- set = single_set (insn);
- copy = 0;
- if (GET_CODE (pattern) == USE
- && GET_CODE (XEXP (pattern, 0)) == REG
- && REG_FUNCTION_VALUE_P (XEXP (pattern, 0)))
- /* The (USE (REG n)) at return from the function should
- be ignored since we are changing (REG n) into
- inline_target. */
- break;
-
- /* Ignore setting a function value that we don't want to use. */
- if (map->inline_target == 0
- && set != 0
- && GET_CODE (SET_DEST (set)) == REG
- && REG_FUNCTION_VALUE_P (SET_DEST (set)))
- {
- if (volatile_refs_p (SET_SRC (set)))
- {
- rtx new_set;
-
- /* If we must not delete the source,
- load it into a new temporary. */
- copy = emit_insn (copy_rtx_and_substitute (pattern, map));
-
- new_set = single_set (copy);
- if (new_set == 0)
- abort ();
-
- SET_DEST (new_set)
- = gen_reg_rtx (GET_MODE (SET_DEST (new_set)));
- }
- /* If the source and destination are the same and it
- has a note on it, keep the insn. */
- else if (rtx_equal_p (SET_DEST (set), SET_SRC (set))
- && REG_NOTES (insn) != 0)
- copy = emit_insn (copy_rtx_and_substitute (pattern, map));
- else
- break;
- }
-
- /* If this is setting the static chain rtx, omit it. */
- else if (static_chain_value != 0
- && set != 0
- && GET_CODE (SET_DEST (set)) == REG
- && rtx_equal_p (SET_DEST (set),
- static_chain_incoming_rtx))
- break;
-
- /* If this is setting the static chain pseudo, set it from
- the value we want to give it instead. */
- else if (static_chain_value != 0
- && set != 0
- && rtx_equal_p (SET_SRC (set),
- static_chain_incoming_rtx))
- {
- rtx newdest = copy_rtx_and_substitute (SET_DEST (set), map);
-
- copy = emit_move_insn (newdest, static_chain_value);
- static_chain_value = 0;
- }
- else
- copy = emit_insn (copy_rtx_and_substitute (pattern, map));
- /* REG_NOTES will be copied later. */
-
-#ifdef HAVE_cc0
- /* If this insn is setting CC0, it may need to look at
- the insn that uses CC0 to see what type of insn it is.
- In that case, the call to recog via validate_change will
- fail. So don't substitute constants here. Instead,
- do it when we emit the following insn.
-
- For example, see the pyr.md file. That machine has signed and
- unsigned compares. The compare patterns must check the
- following branch insn to see which what kind of compare to
- emit.
-
- If the previous insn set CC0, substitute constants on it as
- well. */
- if (sets_cc0_p (PATTERN (copy)) != 0)
- cc0_insn = copy;
- else
- {
- if (cc0_insn)
- try_constants (cc0_insn, map);
- cc0_insn = 0;
- try_constants (copy, map);
- }
-#else
- try_constants (copy, map);
-#endif
- break;
-
- case JUMP_INSN:
- if (GET_CODE (PATTERN (insn)) == RETURN
- || (GET_CODE (PATTERN (insn)) == PARALLEL
- && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == RETURN))
- {
- if (local_return_label == 0)
- local_return_label = gen_label_rtx ();
- pattern = gen_jump (local_return_label);
- }
- else
- pattern = copy_rtx_and_substitute (PATTERN (insn), map);
-
- copy = emit_jump_insn (pattern);
-
-#ifdef HAVE_cc0
- if (cc0_insn)
- try_constants (cc0_insn, map);
- cc0_insn = 0;
-#endif
- try_constants (copy, map);
-
- /* If this used to be a conditional jump insn but whose branch
- direction is now know, we must do something special. */
- if (condjump_p (insn) && ! simplejump_p (insn) && map->last_pc_value)
- {
-#ifdef HAVE_cc0
- /* The previous insn set cc0 for us. So delete it. */
- delete_insn (PREV_INSN (copy));
-#endif
-
- /* If this is now a no-op, delete it. */
- if (map->last_pc_value == pc_rtx)
- {
- delete_insn (copy);
- copy = 0;
- }
- else
- /* Otherwise, this is unconditional jump so we must put a
- BARRIER after it. We could do some dead code elimination
- here, but jump.c will do it just as well. */
- emit_barrier ();
- }
- break;
-
- case CALL_INSN:
- pattern = copy_rtx_and_substitute (PATTERN (insn), map);
- copy = emit_call_insn (pattern);
-
- /* Because the USAGE information potentially contains objects other
- than hard registers, we need to copy it. */
- CALL_INSN_FUNCTION_USAGE (copy) =
- copy_rtx_and_substitute (CALL_INSN_FUNCTION_USAGE (insn), map);
-
-#ifdef HAVE_cc0
- if (cc0_insn)
- try_constants (cc0_insn, map);
- cc0_insn = 0;
-#endif
- try_constants (copy, map);
-
- /* Be lazy and assume CALL_INSNs clobber all hard registers. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- map->const_equiv_map[i] = 0;
- break;
-
- case CODE_LABEL:
- copy = emit_label (map->label_map[CODE_LABEL_NUMBER (insn)]);
- LABEL_NAME (copy) = LABEL_NAME (insn);
- map->const_age++;
- break;
-
- case BARRIER:
- copy = emit_barrier ();
- break;
-
- case NOTE:
- /* It is important to discard function-end and function-beg notes,
- so we have only one of each in the current function.
- Also, NOTE_INSN_DELETED notes aren't useful (save_for_inline
- deleted these in the copy used for continuing compilation,
- not the copy used for inlining). */
- if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_BEG
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED)
- {
- copy = emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn));
- if (copy && (NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_BEG
- || NOTE_LINE_NUMBER (copy) == NOTE_INSN_EH_REGION_END))
- {
- rtx label = map->label_map[NOTE_BLOCK_NUMBER (copy)];
-
- /* We have to forward these both to match the new exception
- region. */
- NOTE_BLOCK_NUMBER (copy) = CODE_LABEL_NUMBER (label);
- }
- }
- else
- copy = 0;
- break;
-
- default:
- abort ();
- break;
- }
-
- if (copy)
- RTX_INTEGRATED_P (copy) = 1;
-
- map->insn_map[INSN_UID (insn)] = copy;
- }
-
- /* Now copy the REG_NOTES. Increment const_age, so that only constants
- from parameters can be substituted in. These are the only ones that
- are valid across the entire function. */
- map->const_age++;
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && map->insn_map[INSN_UID (insn)]
- && REG_NOTES (insn))
- {
- rtx tem = copy_rtx_and_substitute (REG_NOTES (insn), map);
- /* We must also do subst_constants, in case one of our parameters
- has const type and constant value. */
- subst_constants (&tem, NULL_RTX, map);
- apply_change_group ();
- REG_NOTES (map->insn_map[INSN_UID (insn)]) = tem;
- }
-
- if (local_return_label)
- emit_label (local_return_label);
-
- /* Restore the stack pointer if we saved it above. */
- if (FUNCTION_FLAGS (header) & FUNCTION_FLAGS_CALLS_ALLOCA)
- emit_stack_restore (SAVE_BLOCK, stack_save, NULL_RTX);
-
- /* Make copies of the decls of the symbols in the inline function, so that
- the copies of the variables get declared in the current function. Set
- up things so that lookup_static_chain knows that to interpret registers
- in SAVE_EXPRs for TYPE_SIZEs as local. */
-
- inline_function_decl = fndecl;
- integrate_parm_decls (DECL_ARGUMENTS (fndecl), map, arg_vector);
- integrate_decl_tree ((tree) ORIGINAL_DECL_INITIAL (header), 0, map);
- inline_function_decl = 0;
-
- /* End the scope containing the copied formal parameter variables
- and copied LABEL_DECLs. */
-
- expand_end_bindings (getdecls (), 1, 1);
- block = poplevel (1, 1, 0);
- BLOCK_ABSTRACT_ORIGIN (block) = (DECL_ABSTRACT_ORIGIN (fndecl) == NULL
- ? fndecl : DECL_ABSTRACT_ORIGIN (fndecl));
- poplevel (0, 0, 0);
-
- /* Must mark the line number note after inlined functions as a repeat, so
- that the test coverage code can avoid counting the call twice. This
- just tells the code to ignore the immediately following line note, since
- there already exists a copy of this note before the expanded inline call.
- This line number note is still needed for debugging though, so we can't
- delete it. */
- if (flag_test_coverage)
- emit_note (0, NOTE_REPEATED_LINE_NUMBER);
-
- emit_line_note (input_filename, lineno);
-
- if (structure_value_addr)
- {
- target = gen_rtx (MEM, TYPE_MODE (type),
- memory_address (TYPE_MODE (type), structure_value_addr));
- MEM_IN_STRUCT_P (target) = 1;
- }
- return target;
-}
-
-/* Given a chain of PARM_DECLs, ARGS, copy each decl into a VAR_DECL,
- push all of those decls and give each one the corresponding home. */
-
-static void
-integrate_parm_decls (args, map, arg_vector)
- tree args;
- struct inline_remap *map;
- rtvec arg_vector;
-{
- register tree tail;
- register int i;
-
- for (tail = args, i = 0; tail; tail = TREE_CHAIN (tail), i++)
- {
- register tree decl = build_decl (VAR_DECL, DECL_NAME (tail),
- TREE_TYPE (tail));
- rtx new_decl_rtl
- = copy_rtx_and_substitute (RTVEC_ELT (arg_vector, i), map);
-
- DECL_ARG_TYPE (decl) = DECL_ARG_TYPE (tail);
- /* We really should be setting DECL_INCOMING_RTL to something reasonable
- here, but that's going to require some more work. */
- /* DECL_INCOMING_RTL (decl) = ?; */
- /* These args would always appear unused, if not for this. */
- TREE_USED (decl) = 1;
- /* Prevent warning for shadowing with these. */
- DECL_ABSTRACT_ORIGIN (decl) = tail;
- pushdecl (decl);
- /* Fully instantiate the address with the equivalent form so that the
- debugging information contains the actual register, instead of the
- virtual register. Do this by not passing an insn to
- subst_constants. */
- subst_constants (&new_decl_rtl, NULL_RTX, map);
- apply_change_group ();
- DECL_RTL (decl) = new_decl_rtl;
- }
-}
-
-/* Given a BLOCK node LET, push decls and levels so as to construct in the
- current function a tree of contexts isomorphic to the one that is given.
-
- LEVEL indicates how far down into the BLOCK tree is the node we are
- currently traversing. It is always zero except for recursive calls.
-
- MAP, if nonzero, is a pointer to an inline_remap map which indicates how
- registers used in the DECL_RTL field should be remapped. If it is zero,
- no mapping is necessary. */
-
-static void
-integrate_decl_tree (let, level, map)
- tree let;
- int level;
- struct inline_remap *map;
-{
- tree t, node;
-
- if (level > 0)
- pushlevel (0);
-
- for (t = BLOCK_VARS (let); t; t = TREE_CHAIN (t))
- {
- tree d;
-
- push_obstacks_nochange ();
- saveable_allocation ();
- d = copy_node (t);
- pop_obstacks ();
-
- if (DECL_RTL (t) != 0)
- {
- DECL_RTL (d) = copy_rtx_and_substitute (DECL_RTL (t), map);
- /* Fully instantiate the address with the equivalent form so that the
- debugging information contains the actual register, instead of the
- virtual register. Do this by not passing an insn to
- subst_constants. */
- subst_constants (&DECL_RTL (d), NULL_RTX, map);
- apply_change_group ();
- }
- /* These args would always appear unused, if not for this. */
- TREE_USED (d) = 1;
- /* Prevent warning for shadowing with these. */
- DECL_ABSTRACT_ORIGIN (d) = t;
-
- if (DECL_LANG_SPECIFIC (d))
- copy_lang_decl (d);
-
- pushdecl (d);
- }
-
- for (t = BLOCK_SUBBLOCKS (let); t; t = TREE_CHAIN (t))
- integrate_decl_tree (t, level + 1, map);
-
- if (level > 0)
- {
- node = poplevel (1, 0, 0);
- if (node)
- {
- TREE_USED (node) = TREE_USED (let);
- BLOCK_ABSTRACT_ORIGIN (node) = let;
- }
- }
-}
-
-/* Given a BLOCK node LET, search for all DECL_RTL fields, and pass them
- through save_constants. */
-
-static void
-save_constants_in_decl_trees (let)
- tree let;
-{
- tree t;
-
- for (t = BLOCK_VARS (let); t; t = TREE_CHAIN (t))
- if (DECL_RTL (t) != 0)
- save_constants (&DECL_RTL (t));
-
- for (t = BLOCK_SUBBLOCKS (let); t; t = TREE_CHAIN (t))
- save_constants_in_decl_trees (t);
-}
-
-/* Create a new copy of an rtx.
- Recursively copies the operands of the rtx,
- except for those few rtx codes that are sharable.
-
- We always return an rtx that is similar to that incoming rtx, with the
- exception of possibly changing a REG to a SUBREG or vice versa. No
- rtl is ever emitted.
-
- Handle constants that need to be placed in the constant pool by
- calling `force_const_mem'. */
-
-rtx
-copy_rtx_and_substitute (orig, map)
- register rtx orig;
- struct inline_remap *map;
-{
- register rtx copy, temp;
- register int i, j;
- register RTX_CODE code;
- register enum machine_mode mode;
- register char *format_ptr;
- int regno;
-
- if (orig == 0)
- return 0;
-
- code = GET_CODE (orig);
- mode = GET_MODE (orig);
-
- switch (code)
- {
- case REG:
- /* If the stack pointer register shows up, it must be part of
- stack-adjustments (*not* because we eliminated the frame pointer!).
- Small hard registers are returned as-is. Pseudo-registers
- go through their `reg_map'. */
- regno = REGNO (orig);
- if (regno <= LAST_VIRTUAL_REGISTER)
- {
- /* Some hard registers are also mapped,
- but others are not translated. */
- if (map->reg_map[regno] != 0)
- return map->reg_map[regno];
-
- /* If this is the virtual frame pointer, make space in current
- function's stack frame for the stack frame of the inline function.
-
- Copy the address of this area into a pseudo. Map
- virtual_stack_vars_rtx to this pseudo and set up a constant
- equivalence for it to be the address. This will substitute the
- address into insns where it can be substituted and use the new
- pseudo where it can't. */
- if (regno == VIRTUAL_STACK_VARS_REGNUM)
- {
- rtx loc, seq;
- int size = DECL_FRAME_SIZE (map->fndecl);
- int rounded;
-
- start_sequence ();
- loc = assign_stack_temp (BLKmode, size, 1);
- loc = XEXP (loc, 0);
-#ifdef FRAME_GROWS_DOWNWARD
- /* In this case, virtual_stack_vars_rtx points to one byte
- higher than the top of the frame area. So compute the offset
- to one byte higher than our substitute frame.
- Keep the fake frame pointer aligned like a real one. */
- rounded = CEIL_ROUND (size, BIGGEST_ALIGNMENT / BITS_PER_UNIT);
- loc = plus_constant (loc, rounded);
-#endif
- map->reg_map[regno] = temp
- = force_reg (Pmode, force_operand (loc, NULL_RTX));
-
-#ifdef STACK_BOUNDARY
- mark_reg_pointer (map->reg_map[regno],
- STACK_BOUNDARY / BITS_PER_UNIT);
-#endif
-
- if (REGNO (temp) < map->const_equiv_map_size)
- {
- map->const_equiv_map[REGNO (temp)] = loc;
- map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
- }
-
- seq = gen_sequence ();
- end_sequence ();
- emit_insn_after (seq, map->insns_at_start);
- return temp;
- }
- else if (regno == VIRTUAL_INCOMING_ARGS_REGNUM)
- {
- /* Do the same for a block to contain any arguments referenced
- in memory. */
- rtx loc, seq;
- int size = FUNCTION_ARGS_SIZE (DECL_SAVED_INSNS (map->fndecl));
-
- start_sequence ();
- loc = assign_stack_temp (BLKmode, size, 1);
- loc = XEXP (loc, 0);
- /* When arguments grow downward, the virtual incoming
- args pointer points to the top of the argument block,
- so the remapped location better do the same. */
-#ifdef ARGS_GROW_DOWNWARD
- loc = plus_constant (loc, size);
-#endif
- map->reg_map[regno] = temp
- = force_reg (Pmode, force_operand (loc, NULL_RTX));
-
-#ifdef STACK_BOUNDARY
- mark_reg_pointer (map->reg_map[regno],
- STACK_BOUNDARY / BITS_PER_UNIT);
-#endif
-
- if (REGNO (temp) < map->const_equiv_map_size)
- {
- map->const_equiv_map[REGNO (temp)] = loc;
- map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
- }
-
- seq = gen_sequence ();
- end_sequence ();
- emit_insn_after (seq, map->insns_at_start);
- return temp;
- }
- else if (REG_FUNCTION_VALUE_P (orig))
- {
- /* This is a reference to the function return value. If
- the function doesn't have a return value, error. If the
- mode doesn't agree, make a SUBREG. */
- if (map->inline_target == 0)
- /* Must be unrolling loops or replicating code if we
- reach here, so return the register unchanged. */
- return orig;
- else if (mode != GET_MODE (map->inline_target))
- return gen_lowpart (mode, map->inline_target);
- else
- return map->inline_target;
- }
- return orig;
- }
- if (map->reg_map[regno] == NULL)
- {
- map->reg_map[regno] = gen_reg_rtx (mode);
- REG_USERVAR_P (map->reg_map[regno]) = REG_USERVAR_P (orig);
- REG_LOOP_TEST_P (map->reg_map[regno]) = REG_LOOP_TEST_P (orig);
- RTX_UNCHANGING_P (map->reg_map[regno]) = RTX_UNCHANGING_P (orig);
- /* A reg with REG_FUNCTION_VALUE_P true will never reach here. */
-
- if (map->regno_pointer_flag[regno])
- mark_reg_pointer (map->reg_map[regno],
- map->regno_pointer_align[regno]);
- }
- return map->reg_map[regno];
-
- case SUBREG:
- copy = copy_rtx_and_substitute (SUBREG_REG (orig), map);
- /* SUBREG is ordinary, but don't make nested SUBREGs. */
- if (GET_CODE (copy) == SUBREG)
- return gen_rtx (SUBREG, GET_MODE (orig), SUBREG_REG (copy),
- SUBREG_WORD (orig) + SUBREG_WORD (copy));
- else if (GET_CODE (copy) == CONCAT)
- return (subreg_realpart_p (orig) ? XEXP (copy, 0) : XEXP (copy, 1));
- else
- return gen_rtx (SUBREG, GET_MODE (orig), copy,
- SUBREG_WORD (orig));
-
- case USE:
- case CLOBBER:
- /* USE and CLOBBER are ordinary, but we convert (use (subreg foo))
- to (use foo) if the original insn didn't have a subreg.
- Removing the subreg distorts the VAX movstrhi pattern
- by changing the mode of an operand. */
- copy = copy_rtx_and_substitute (XEXP (orig, 0), map);
- if (GET_CODE (copy) == SUBREG && GET_CODE (XEXP (orig, 0)) != SUBREG)
- copy = SUBREG_REG (copy);
- return gen_rtx (code, VOIDmode, copy);
-
- case CODE_LABEL:
- LABEL_PRESERVE_P (map->label_map[CODE_LABEL_NUMBER (orig)])
- = LABEL_PRESERVE_P (orig);
- return map->label_map[CODE_LABEL_NUMBER (orig)];
-
- case LABEL_REF:
- copy = gen_rtx (LABEL_REF, mode,
- LABEL_REF_NONLOCAL_P (orig) ? XEXP (orig, 0)
- : map->label_map[CODE_LABEL_NUMBER (XEXP (orig, 0))]);
- LABEL_OUTSIDE_LOOP_P (copy) = LABEL_OUTSIDE_LOOP_P (orig);
-
- /* The fact that this label was previously nonlocal does not mean
- it still is, so we must check if it is within the range of
- this function's labels. */
- LABEL_REF_NONLOCAL_P (copy)
- = (LABEL_REF_NONLOCAL_P (orig)
- && ! (CODE_LABEL_NUMBER (XEXP (copy, 0)) >= get_first_label_num ()
- && CODE_LABEL_NUMBER (XEXP (copy, 0)) < max_label_num ()));
-
- /* If we have made a nonlocal label local, it means that this
- inlined call will be referring to our nonlocal goto handler.
- So make sure we create one for this block; we normally would
- not since this is not otherwise considered a "call". */
- if (LABEL_REF_NONLOCAL_P (orig) && ! LABEL_REF_NONLOCAL_P (copy))
- function_call_count++;
-
- return copy;
-
- case PC:
- case CC0:
- case CONST_INT:
- return orig;
-
- case SYMBOL_REF:
- /* Symbols which represent the address of a label stored in the constant
- pool must be modified to point to a constant pool entry for the
- remapped label. Otherwise, symbols are returned unchanged. */
- if (CONSTANT_POOL_ADDRESS_P (orig))
- {
- rtx constant = get_pool_constant (orig);
- if (GET_CODE (constant) == LABEL_REF)
- return XEXP (force_const_mem (GET_MODE (orig),
- copy_rtx_and_substitute (constant,
- map)),
- 0);
- }
-
- return orig;
-
- case CONST_DOUBLE:
- /* We have to make a new copy of this CONST_DOUBLE because don't want
- to use the old value of CONST_DOUBLE_MEM. Also, this may be a
- duplicate of a CONST_DOUBLE we have already seen. */
- if (GET_MODE_CLASS (GET_MODE (orig)) == MODE_FLOAT)
- {
- REAL_VALUE_TYPE d;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, orig);
- return CONST_DOUBLE_FROM_REAL_VALUE (d, GET_MODE (orig));
- }
- else
- return immed_double_const (CONST_DOUBLE_LOW (orig),
- CONST_DOUBLE_HIGH (orig), VOIDmode);
-
- case CONST:
- /* Make new constant pool entry for a constant
- that was in the pool of the inline function. */
- if (RTX_INTEGRATED_P (orig))
- {
- /* If this was an address of a constant pool entry that itself
- had to be placed in the constant pool, it might not be a
- valid address. So the recursive call below might turn it
- into a register. In that case, it isn't a constant any
- more, so return it. This has the potential of changing a
- MEM into a REG, but we'll assume that it safe. */
- temp = copy_rtx_and_substitute (XEXP (orig, 0), map);
- if (! CONSTANT_P (temp))
- return temp;
- return validize_mem (force_const_mem (GET_MODE (orig), temp));
- }
- break;
-
- case ADDRESS:
- /* If from constant pool address, make new constant pool entry and
- return its address. */
- if (! RTX_INTEGRATED_P (orig))
- abort ();
-
- temp
- = force_const_mem (GET_MODE (XEXP (orig, 0)),
- copy_rtx_and_substitute (XEXP (XEXP (orig, 0), 0),
- map));
-
-#if 0
- /* Legitimizing the address here is incorrect.
-
- The only ADDRESS rtx's that can reach here are ones created by
- save_constants. Hence the operand of the ADDRESS is always valid
- in this position of the instruction, since the original rtx without
- the ADDRESS was valid.
-
- The reason we don't legitimize the address here is that on the
- Sparc, the caller may have a (high ...) surrounding this ADDRESS.
- This code forces the operand of the address to a register, which
- fails because we can not take the HIGH part of a register.
-
- Also, change_address may create new registers. These registers
- will not have valid reg_map entries. This can cause try_constants()
- to fail because assumes that all registers in the rtx have valid
- reg_map entries, and it may end up replacing one of these new
- registers with junk. */
-
- if (! memory_address_p (GET_MODE (temp), XEXP (temp, 0)))
- temp = change_address (temp, GET_MODE (temp), XEXP (temp, 0));
-#endif
-
- temp = XEXP (temp, 0);
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (temp) != GET_MODE (orig))
- temp = convert_memory_address (GET_MODE (orig), temp);
-#endif
-
- return temp;
-
- case ASM_OPERANDS:
- /* If a single asm insn contains multiple output operands
- then it contains multiple ASM_OPERANDS rtx's that share operand 3.
- We must make sure that the copied insn continues to share it. */
- if (map->orig_asm_operands_vector == XVEC (orig, 3))
- {
- copy = rtx_alloc (ASM_OPERANDS);
- copy->volatil = orig->volatil;
- XSTR (copy, 0) = XSTR (orig, 0);
- XSTR (copy, 1) = XSTR (orig, 1);
- XINT (copy, 2) = XINT (orig, 2);
- XVEC (copy, 3) = map->copy_asm_operands_vector;
- XVEC (copy, 4) = map->copy_asm_constraints_vector;
- XSTR (copy, 5) = XSTR (orig, 5);
- XINT (copy, 6) = XINT (orig, 6);
- return copy;
- }
- break;
-
- case CALL:
- /* This is given special treatment because the first
- operand of a CALL is a (MEM ...) which may get
- forced into a register for cse. This is undesirable
- if function-address cse isn't wanted or if we won't do cse. */
-#ifndef NO_FUNCTION_CSE
- if (! (optimize && ! flag_no_function_cse))
-#endif
- return gen_rtx (CALL, GET_MODE (orig),
- gen_rtx (MEM, GET_MODE (XEXP (orig, 0)),
- copy_rtx_and_substitute (XEXP (XEXP (orig, 0), 0), map)),
- copy_rtx_and_substitute (XEXP (orig, 1), map));
- break;
-
-#if 0
- /* Must be ifdefed out for loop unrolling to work. */
- case RETURN:
- abort ();
-#endif
-
- case SET:
- /* If this is setting fp or ap, it means that we have a nonlocal goto.
- Don't alter that.
- If the nonlocal goto is into the current function,
- this will result in unnecessarily bad code, but should work. */
- if (SET_DEST (orig) == virtual_stack_vars_rtx
- || SET_DEST (orig) == virtual_incoming_args_rtx)
- return gen_rtx (SET, VOIDmode, SET_DEST (orig),
- copy_rtx_and_substitute (SET_SRC (orig), map));
- break;
-
- case MEM:
- copy = rtx_alloc (MEM);
- PUT_MODE (copy, mode);
- XEXP (copy, 0) = copy_rtx_and_substitute (XEXP (orig, 0), map);
- MEM_IN_STRUCT_P (copy) = MEM_IN_STRUCT_P (orig);
- MEM_VOLATILE_P (copy) = MEM_VOLATILE_P (orig);
-
- /* If doing function inlining, this MEM might not be const in the
- function that it is being inlined into, and thus may not be
- unchanging after function inlining. Constant pool references are
- handled elsewhere, so this doesn't lose RTX_UNCHANGING_P bits
- for them. */
- if (! map->integrating)
- RTX_UNCHANGING_P (copy) = RTX_UNCHANGING_P (orig);
-
- return copy;
- }
-
- copy = rtx_alloc (code);
- PUT_MODE (copy, mode);
- copy->in_struct = orig->in_struct;
- copy->volatil = orig->volatil;
- copy->unchanging = orig->unchanging;
-
- format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
- {
- switch (*format_ptr++)
- {
- case '0':
- break;
-
- case 'e':
- XEXP (copy, i) = copy_rtx_and_substitute (XEXP (orig, i), map);
- break;
-
- case 'u':
- /* Change any references to old-insns to point to the
- corresponding copied insns. */
- XEXP (copy, i) = map->insn_map[INSN_UID (XEXP (orig, i))];
- break;
-
- case 'E':
- XVEC (copy, i) = XVEC (orig, i);
- if (XVEC (orig, i) != NULL && XVECLEN (orig, i) != 0)
- {
- XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
- for (j = 0; j < XVECLEN (copy, i); j++)
- XVECEXP (copy, i, j)
- = copy_rtx_and_substitute (XVECEXP (orig, i, j), map);
- }
- break;
-
- case 'w':
- XWINT (copy, i) = XWINT (orig, i);
- break;
-
- case 'i':
- XINT (copy, i) = XINT (orig, i);
- break;
-
- case 's':
- XSTR (copy, i) = XSTR (orig, i);
- break;
-
- default:
- abort ();
- }
- }
-
- if (code == ASM_OPERANDS && map->orig_asm_operands_vector == 0)
- {
- map->orig_asm_operands_vector = XVEC (orig, 3);
- map->copy_asm_operands_vector = XVEC (copy, 3);
- map->copy_asm_constraints_vector = XVEC (copy, 4);
- }
-
- return copy;
-}
-
-/* Substitute known constant values into INSN, if that is valid. */
-
-void
-try_constants (insn, map)
- rtx insn;
- struct inline_remap *map;
-{
- int i;
-
- map->num_sets = 0;
- subst_constants (&PATTERN (insn), insn, map);
-
- /* Apply the changes if they are valid; otherwise discard them. */
- apply_change_group ();
-
- /* Show we don't know the value of anything stored or clobbered. */
- note_stores (PATTERN (insn), mark_stores);
- map->last_pc_value = 0;
-#ifdef HAVE_cc0
- map->last_cc0_value = 0;
-#endif
-
- /* Set up any constant equivalences made in this insn. */
- for (i = 0; i < map->num_sets; i++)
- {
- if (GET_CODE (map->equiv_sets[i].dest) == REG)
- {
- int regno = REGNO (map->equiv_sets[i].dest);
-
- if (regno < map->const_equiv_map_size
- && (map->const_equiv_map[regno] == 0
- /* Following clause is a hack to make case work where GNU C++
- reassigns a variable to make cse work right. */
- || ! rtx_equal_p (map->const_equiv_map[regno],
- map->equiv_sets[i].equiv)))
- {
- map->const_equiv_map[regno] = map->equiv_sets[i].equiv;
- map->const_age_map[regno] = map->const_age;
- }
- }
- else if (map->equiv_sets[i].dest == pc_rtx)
- map->last_pc_value = map->equiv_sets[i].equiv;
-#ifdef HAVE_cc0
- else if (map->equiv_sets[i].dest == cc0_rtx)
- map->last_cc0_value = map->equiv_sets[i].equiv;
-#endif
- }
-}
-
-/* Substitute known constants for pseudo regs in the contents of LOC,
- which are part of INSN.
- If INSN is zero, the substitution should always be done (this is used to
- update DECL_RTL).
- These changes are taken out by try_constants if the result is not valid.
-
- Note that we are more concerned with determining when the result of a SET
- is a constant, for further propagation, than actually inserting constants
- into insns; cse will do the latter task better.
-
- This function is also used to adjust address of items previously addressed
- via the virtual stack variable or virtual incoming arguments registers. */
-
-static void
-subst_constants (loc, insn, map)
- rtx *loc;
- rtx insn;
- struct inline_remap *map;
-{
- rtx x = *loc;
- register int i;
- register enum rtx_code code;
- register char *format_ptr;
- int num_changes = num_validated_changes ();
- rtx new = 0;
- enum machine_mode op0_mode;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case PC:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CONST:
- case LABEL_REF:
- case ADDRESS:
- return;
-
-#ifdef HAVE_cc0
- case CC0:
- validate_change (insn, loc, map->last_cc0_value, 1);
- return;
-#endif
-
- case USE:
- case CLOBBER:
- /* The only thing we can do with a USE or CLOBBER is possibly do
- some substitutions in a MEM within it. */
- if (GET_CODE (XEXP (x, 0)) == MEM)
- subst_constants (&XEXP (XEXP (x, 0), 0), insn, map);
- return;
-
- case REG:
- /* Substitute for parms and known constants. Don't replace
- hard regs used as user variables with constants. */
- {
- int regno = REGNO (x);
-
- if (! (regno < FIRST_PSEUDO_REGISTER && REG_USERVAR_P (x))
- && regno < map->const_equiv_map_size
- && map->const_equiv_map[regno] != 0
- && map->const_age_map[regno] >= map->const_age)
- validate_change (insn, loc, map->const_equiv_map[regno], 1);
- return;
- }
-
- case SUBREG:
- /* SUBREG applied to something other than a reg
- should be treated as ordinary, since that must
- be a special hack and we don't know how to treat it specially.
- Consider for example mulsidi3 in m68k.md.
- Ordinary SUBREG of a REG needs this special treatment. */
- if (GET_CODE (SUBREG_REG (x)) == REG)
- {
- rtx inner = SUBREG_REG (x);
- rtx new = 0;
-
- /* We can't call subst_constants on &SUBREG_REG (x) because any
- constant or SUBREG wouldn't be valid inside our SUBEG. Instead,
- see what is inside, try to form the new SUBREG and see if that is
- valid. We handle two cases: extracting a full word in an
- integral mode and extracting the low part. */
- subst_constants (&inner, NULL_RTX, map);
-
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT
- && GET_MODE_SIZE (GET_MODE (x)) == UNITS_PER_WORD
- && GET_MODE (SUBREG_REG (x)) != VOIDmode)
- new = operand_subword (inner, SUBREG_WORD (x), 0,
- GET_MODE (SUBREG_REG (x)));
-
- if (new == 0 && subreg_lowpart_p (x))
- new = gen_lowpart_common (GET_MODE (x), inner);
-
- if (new)
- validate_change (insn, loc, new, 1);
-
- return;
- }
- break;
-
- case MEM:
- subst_constants (&XEXP (x, 0), insn, map);
-
- /* If a memory address got spoiled, change it back. */
- if (insn != 0 && num_validated_changes () != num_changes
- && !memory_address_p (GET_MODE (x), XEXP (x, 0)))
- cancel_changes (num_changes);
- return;
-
- case SET:
- {
- /* Substitute constants in our source, and in any arguments to a
- complex (e..g, ZERO_EXTRACT) destination, but not in the destination
- itself. */
- rtx *dest_loc = &SET_DEST (x);
- rtx dest = *dest_loc;
- rtx src, tem;
-
- subst_constants (&SET_SRC (x), insn, map);
- src = SET_SRC (x);
-
- while (GET_CODE (*dest_loc) == ZERO_EXTRACT
- || GET_CODE (*dest_loc) == SUBREG
- || GET_CODE (*dest_loc) == STRICT_LOW_PART)
- {
- if (GET_CODE (*dest_loc) == ZERO_EXTRACT)
- {
- subst_constants (&XEXP (*dest_loc, 1), insn, map);
- subst_constants (&XEXP (*dest_loc, 2), insn, map);
- }
- dest_loc = &XEXP (*dest_loc, 0);
- }
-
- /* Do substitute in the address of a destination in memory. */
- if (GET_CODE (*dest_loc) == MEM)
- subst_constants (&XEXP (*dest_loc, 0), insn, map);
-
- /* Check for the case of DEST a SUBREG, both it and the underlying
- register are less than one word, and the SUBREG has the wider mode.
- In the case, we are really setting the underlying register to the
- source converted to the mode of DEST. So indicate that. */
- if (GET_CODE (dest) == SUBREG
- && GET_MODE_SIZE (GET_MODE (dest)) <= UNITS_PER_WORD
- && GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))) <= UNITS_PER_WORD
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest)))
- <= GET_MODE_SIZE (GET_MODE (dest)))
- && (tem = gen_lowpart_if_possible (GET_MODE (SUBREG_REG (dest)),
- src)))
- src = tem, dest = SUBREG_REG (dest);
-
- /* If storing a recognizable value save it for later recording. */
- if ((map->num_sets < MAX_RECOG_OPERANDS)
- && (CONSTANT_P (src)
- || (GET_CODE (src) == REG
- && (REGNO (src) == VIRTUAL_INCOMING_ARGS_REGNUM
- || REGNO (src) == VIRTUAL_STACK_VARS_REGNUM))
- || (GET_CODE (src) == PLUS
- && GET_CODE (XEXP (src, 0)) == REG
- && (REGNO (XEXP (src, 0)) == VIRTUAL_INCOMING_ARGS_REGNUM
- || REGNO (XEXP (src, 0)) == VIRTUAL_STACK_VARS_REGNUM)
- && CONSTANT_P (XEXP (src, 1)))
- || GET_CODE (src) == COMPARE
-#ifdef HAVE_cc0
- || dest == cc0_rtx
-#endif
- || (dest == pc_rtx
- && (src == pc_rtx || GET_CODE (src) == RETURN
- || GET_CODE (src) == LABEL_REF))))
- {
- /* Normally, this copy won't do anything. But, if SRC is a COMPARE
- it will cause us to save the COMPARE with any constants
- substituted, which is what we want for later. */
- map->equiv_sets[map->num_sets].equiv = copy_rtx (src);
- map->equiv_sets[map->num_sets++].dest = dest;
- }
-
- return;
- }
- }
-
- format_ptr = GET_RTX_FORMAT (code);
-
- /* If the first operand is an expression, save its mode for later. */
- if (*format_ptr == 'e')
- op0_mode = GET_MODE (XEXP (x, 0));
-
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*format_ptr++)
- {
- case '0':
- break;
-
- case 'e':
- if (XEXP (x, i))
- subst_constants (&XEXP (x, i), insn, map);
- break;
-
- case 'u':
- case 'i':
- case 's':
- case 'w':
- break;
-
- case 'E':
- if (XVEC (x, i) != NULL && XVECLEN (x, i) != 0)
- {
- int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- subst_constants (&XVECEXP (x, i, j), insn, map);
- }
- break;
-
- default:
- abort ();
- }
- }
-
- /* If this is a commutative operation, move a constant to the second
- operand unless the second operand is already a CONST_INT. */
- if ((GET_RTX_CLASS (code) == 'c' || code == NE || code == EQ)
- && CONSTANT_P (XEXP (x, 0)) && GET_CODE (XEXP (x, 1)) != CONST_INT)
- {
- rtx tem = XEXP (x, 0);
- validate_change (insn, &XEXP (x, 0), XEXP (x, 1), 1);
- validate_change (insn, &XEXP (x, 1), tem, 1);
- }
-
- /* Simplify the expression in case we put in some constants. */
- switch (GET_RTX_CLASS (code))
- {
- case '1':
- new = simplify_unary_operation (code, GET_MODE (x),
- XEXP (x, 0), op0_mode);
- break;
-
- case '<':
- {
- enum machine_mode op_mode = GET_MODE (XEXP (x, 0));
- if (op_mode == VOIDmode)
- op_mode = GET_MODE (XEXP (x, 1));
- new = simplify_relational_operation (code, op_mode,
- XEXP (x, 0), XEXP (x, 1));
-#ifdef FLOAT_STORE_FLAG_VALUE
- if (new != 0 && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- new = ((new == const0_rtx) ? CONST0_RTX (GET_MODE (x))
- : CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE,
- GET_MODE (x)));
-#endif
- break;
- }
-
- case '2':
- case 'c':
- new = simplify_binary_operation (code, GET_MODE (x),
- XEXP (x, 0), XEXP (x, 1));
- break;
-
- case 'b':
- case '3':
- new = simplify_ternary_operation (code, GET_MODE (x), op0_mode,
- XEXP (x, 0), XEXP (x, 1), XEXP (x, 2));
- break;
- }
-
- if (new)
- validate_change (insn, loc, new, 1);
-}
-
-/* Show that register modified no longer contain known constants. We are
- called from note_stores with parts of the new insn. */
-
-void
-mark_stores (dest, x)
- rtx dest;
- rtx x;
-{
- int regno = -1;
- enum machine_mode mode;
-
- /* DEST is always the innermost thing set, except in the case of
- SUBREGs of hard registers. */
-
- if (GET_CODE (dest) == REG)
- regno = REGNO (dest), mode = GET_MODE (dest);
- else if (GET_CODE (dest) == SUBREG && GET_CODE (SUBREG_REG (dest)) == REG)
- {
- regno = REGNO (SUBREG_REG (dest)) + SUBREG_WORD (dest);
- mode = GET_MODE (SUBREG_REG (dest));
- }
-
- if (regno >= 0)
- {
- int last_reg = (regno >= FIRST_PSEUDO_REGISTER ? regno
- : regno + HARD_REGNO_NREGS (regno, mode) - 1);
- int i;
-
- for (i = regno; i <= last_reg; i++)
- if (i < global_const_equiv_map_size)
- global_const_equiv_map[i] = 0;
- }
-}
-
-/* If any CONST expressions with RTX_INTEGRATED_P are present in the rtx
- pointed to by PX, they represent constants in the constant pool.
- Replace these with a new memory reference obtained from force_const_mem.
- Similarly, ADDRESS expressions with RTX_INTEGRATED_P represent the
- address of a constant pool entry. Replace them with the address of
- a new constant pool entry obtained from force_const_mem. */
-
-static void
-restore_constants (px)
- rtx *px;
-{
- rtx x = *px;
- int i, j;
- char *fmt;
-
- if (x == 0)
- return;
-
- if (GET_CODE (x) == CONST_DOUBLE)
- {
- /* We have to make a new CONST_DOUBLE to ensure that we account for
- it correctly. Using the old CONST_DOUBLE_MEM data is wrong. */
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- {
- REAL_VALUE_TYPE d;
-
- REAL_VALUE_FROM_CONST_DOUBLE (d, x);
- *px = CONST_DOUBLE_FROM_REAL_VALUE (d, GET_MODE (x));
- }
- else
- *px = immed_double_const (CONST_DOUBLE_LOW (x), CONST_DOUBLE_HIGH (x),
- VOIDmode);
- }
-
- else if (RTX_INTEGRATED_P (x) && GET_CODE (x) == CONST)
- {
- restore_constants (&XEXP (x, 0));
- *px = validize_mem (force_const_mem (GET_MODE (x), XEXP (x, 0)));
- }
- else if (RTX_INTEGRATED_P (x) && GET_CODE (x) == SUBREG)
- {
- /* This must be (subreg/i:M1 (const/i:M2 ...) 0). */
- rtx new = XEXP (SUBREG_REG (x), 0);
-
- restore_constants (&new);
- new = force_const_mem (GET_MODE (SUBREG_REG (x)), new);
- PUT_MODE (new, GET_MODE (x));
- *px = validize_mem (new);
- }
- else if (RTX_INTEGRATED_P (x) && GET_CODE (x) == ADDRESS)
- {
- rtx new = XEXP (force_const_mem (GET_MODE (XEXP (x, 0)),
- XEXP (XEXP (x, 0), 0)),
- 0);
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- if (GET_MODE (new) != GET_MODE (x))
- new = convert_memory_address (GET_MODE (x), new);
-#endif
-
- *px = new;
- }
- else
- {
- fmt = GET_RTX_FORMAT (GET_CODE (x));
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (x)); i++)
- {
- switch (*fmt++)
- {
- case 'E':
- for (j = 0; j < XVECLEN (x, i); j++)
- restore_constants (&XVECEXP (x, i, j));
- break;
-
- case 'e':
- restore_constants (&XEXP (x, i));
- break;
- }
- }
- }
-}
-
-/* Given a pointer to some BLOCK node, if the BLOCK_ABSTRACT_ORIGIN for the
- given BLOCK node is NULL, set the BLOCK_ABSTRACT_ORIGIN for the node so
- that it points to the node itself, thus indicating that the node is its
- own (abstract) origin. Additionally, if the BLOCK_ABSTRACT_ORIGIN for
- the given node is NULL, recursively descend the decl/block tree which
- it is the root of, and for each other ..._DECL or BLOCK node contained
- therein whose DECL_ABSTRACT_ORIGINs or BLOCK_ABSTRACT_ORIGINs are also
- still NULL, set *their* DECL_ABSTRACT_ORIGIN or BLOCK_ABSTRACT_ORIGIN
- values to point to themselves. */
-
-static void
-set_block_origin_self (stmt)
- register tree stmt;
-{
- if (BLOCK_ABSTRACT_ORIGIN (stmt) == NULL_TREE)
- {
- BLOCK_ABSTRACT_ORIGIN (stmt) = stmt;
-
- {
- register tree local_decl;
-
- for (local_decl = BLOCK_VARS (stmt);
- local_decl != NULL_TREE;
- local_decl = TREE_CHAIN (local_decl))
- set_decl_origin_self (local_decl); /* Potential recursion. */
- }
-
- {
- register tree subblock;
-
- for (subblock = BLOCK_SUBBLOCKS (stmt);
- subblock != NULL_TREE;
- subblock = BLOCK_CHAIN (subblock))
- set_block_origin_self (subblock); /* Recurse. */
- }
- }
-}
-
-/* Given a pointer to some ..._DECL node, if the DECL_ABSTRACT_ORIGIN for
- the given ..._DECL node is NULL, set the DECL_ABSTRACT_ORIGIN for the
- node to so that it points to the node itself, thus indicating that the
- node represents its own (abstract) origin. Additionally, if the
- DECL_ABSTRACT_ORIGIN for the given node is NULL, recursively descend
- the decl/block tree of which the given node is the root of, and for
- each other ..._DECL or BLOCK node contained therein whose
- DECL_ABSTRACT_ORIGINs or BLOCK_ABSTRACT_ORIGINs are also still NULL,
- set *their* DECL_ABSTRACT_ORIGIN or BLOCK_ABSTRACT_ORIGIN values to
- point to themselves. */
-
-static void
-set_decl_origin_self (decl)
- register tree decl;
-{
- if (DECL_ABSTRACT_ORIGIN (decl) == NULL_TREE)
- {
- DECL_ABSTRACT_ORIGIN (decl) = decl;
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- register tree arg;
-
- for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
- DECL_ABSTRACT_ORIGIN (arg) = arg;
- if (DECL_INITIAL (decl) != NULL_TREE
- && DECL_INITIAL (decl) != error_mark_node)
- set_block_origin_self (DECL_INITIAL (decl));
- }
- }
-}
-
-/* Given a pointer to some BLOCK node, and a boolean value to set the
- "abstract" flags to, set that value into the BLOCK_ABSTRACT flag for
- the given block, and for all local decls and all local sub-blocks
- (recursively) which are contained therein. */
-
-static void
-set_block_abstract_flags (stmt, setting)
- register tree stmt;
- register int setting;
-{
- register tree local_decl;
- register tree subblock;
-
- BLOCK_ABSTRACT (stmt) = setting;
-
- for (local_decl = BLOCK_VARS (stmt);
- local_decl != NULL_TREE;
- local_decl = TREE_CHAIN (local_decl))
- set_decl_abstract_flags (local_decl, setting);
-
- for (subblock = BLOCK_SUBBLOCKS (stmt);
- subblock != NULL_TREE;
- subblock = BLOCK_CHAIN (subblock))
- set_block_abstract_flags (subblock, setting);
-}
-
-/* Given a pointer to some ..._DECL node, and a boolean value to set the
- "abstract" flags to, set that value into the DECL_ABSTRACT flag for the
- given decl, and (in the case where the decl is a FUNCTION_DECL) also
- set the abstract flags for all of the parameters, local vars, local
- blocks and sub-blocks (recursively) to the same setting. */
-
-void
-set_decl_abstract_flags (decl, setting)
- register tree decl;
- register int setting;
-{
- DECL_ABSTRACT (decl) = setting;
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- register tree arg;
-
- for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
- DECL_ABSTRACT (arg) = setting;
- if (DECL_INITIAL (decl) != NULL_TREE
- && DECL_INITIAL (decl) != error_mark_node)
- set_block_abstract_flags (DECL_INITIAL (decl), setting);
- }
-}
-
-/* Output the assembly language code for the function FNDECL
- from its DECL_SAVED_INSNS. Used for inline functions that are output
- at end of compilation instead of where they came in the source. */
-
-void
-output_inline_function (fndecl)
- tree fndecl;
-{
- rtx head;
- rtx last;
- int save_flag_no_inline = flag_no_inline;
-
- if (output_bytecode)
- {
- warning ("`inline' ignored for bytecode output");
- return;
- }
-
- /* Things we allocate from here on are part of this function, not
- permanent. */
- temporary_allocation ();
-
- head = DECL_SAVED_INSNS (fndecl);
- current_function_decl = fndecl;
-
- /* This call is only used to initialize global variables. */
- init_function_start (fndecl, "lossage", 1);
-
- /* Redo parameter determinations in case the FUNCTION_...
- macros took machine-specific actions that need to be redone. */
- assign_parms (fndecl, 1);
-
- /* Set stack frame size. */
- assign_stack_local (BLKmode, DECL_FRAME_SIZE (fndecl), 0);
-
- /* The first is a bit of a lie (the array may be larger), but doesn't
- matter too much and it isn't worth saving the actual bound. */
- reg_rtx_no = regno_pointer_flag_length = MAX_REGNUM (head);
- regno_reg_rtx = (rtx *) INLINE_REGNO_REG_RTX (head);
- regno_pointer_flag = INLINE_REGNO_POINTER_FLAG (head);
- regno_pointer_align = INLINE_REGNO_POINTER_ALIGN (head);
-
- stack_slot_list = STACK_SLOT_LIST (head);
- forced_labels = FORCED_LABELS (head);
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_CALLS_ALLOCA)
- current_function_calls_alloca = 1;
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_CALLS_SETJMP)
- current_function_calls_setjmp = 1;
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_CALLS_LONGJMP)
- current_function_calls_longjmp = 1;
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_RETURNS_STRUCT)
- current_function_returns_struct = 1;
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_RETURNS_PCC_STRUCT)
- current_function_returns_pcc_struct = 1;
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_NEEDS_CONTEXT)
- current_function_needs_context = 1;
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_HAS_NONLOCAL_LABEL)
- current_function_has_nonlocal_label = 1;
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_RETURNS_POINTER)
- current_function_returns_pointer = 1;
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_USES_CONST_POOL)
- current_function_uses_const_pool = 1;
-
- if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE)
- current_function_uses_pic_offset_table = 1;
-
- current_function_outgoing_args_size = OUTGOING_ARGS_SIZE (head);
- current_function_pops_args = POPS_ARGS (head);
-
- /* This is the only thing the expand_function_end call that uses to be here
- actually does and that call can cause problems. */
- immediate_size_expand--;
-
- /* Find last insn and rebuild the constant pool. */
- for (last = FIRST_PARM_INSN (head);
- NEXT_INSN (last); last = NEXT_INSN (last))
- {
- if (GET_RTX_CLASS (GET_CODE (last)) == 'i')
- {
- restore_constants (&PATTERN (last));
- restore_constants (&REG_NOTES (last));
- }
- }
-
- set_new_first_and_last_insn (FIRST_PARM_INSN (head), last);
- set_new_first_and_last_label_num (FIRST_LABELNO (head), LAST_LABELNO (head));
-
- /* We must have already output DWARF debugging information for the
- original (abstract) inline function declaration/definition, so
- we want to make sure that the debugging information we generate
- for this special instance of the inline function refers back to
- the information we already generated. To make sure that happens,
- we simply have to set the DECL_ABSTRACT_ORIGIN for the function
- node (and for all of the local ..._DECL nodes which are its children)
- so that they all point to themselves. */
-
- set_decl_origin_self (fndecl);
-
- /* We're not deferring this any longer. */
- DECL_DEFER_OUTPUT (fndecl) = 0;
-
- /* Integrating function calls isn't safe anymore, so turn on
- flag_no_inline. */
- flag_no_inline = 1;
-
- /* Compile this function all the way down to assembly code. */
- rest_of_compilation (fndecl);
-
- /* Reset flag_no_inline to its original value. */
- flag_no_inline = save_flag_no_inline;
-
- current_function_decl = 0;
-}
diff --git a/gcc/integrate.h b/gcc/integrate.h
deleted file mode 100644
index b2acf5e5c1d..00000000000
--- a/gcc/integrate.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Function integration definitions for GNU C-Compiler
- Copyright (C) 1990, 1995 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 structure is used to remap objects in the function being inlined to
- those belonging to the calling function. It is passed by
- expand_inline_function to its children.
-
- This structure is also used when unrolling loops and otherwise
- replicating code, although not all fields are needed in this case;
- only those fields needed by copy_rtx_and_substitute() and its children
- are used.
-
- This structure is used instead of static variables because
- expand_inline_function may be called recursively via expand_expr. */
-
-struct inline_remap
-{
- /* True if we are doing function integration, false otherwise.
- Used to control whether RTX_UNCHANGING bits are copied by
- copy_rtx_and_substitute. */
- int integrating;
- /* Definition of function be inlined. */
- union tree_node *fndecl;
- /* Place to put insns needed at start of function. */
- rtx insns_at_start;
- /* Mapping from old registers to new registers.
- It is allocated and deallocated in `expand_inline_function' */
- rtx *reg_map;
- /* Mapping from old code-labels to new code-labels.
- The first element of this map is label_map[min_labelno]. */
- rtx *label_map;
- /* Mapping from old insn uid's to copied insns. The first element
- of this map is insn_map[min_insnno]; the last element is
- insn_map[max_insnno]. We keep the bounds here for when the map
- only covers a partial range of insns (such as loop unrolling or
- code replication). */
- rtx *insn_map;
- int min_insnno, max_insnno;
-
- /* Map pseudo reg number in calling function to equivalent constant. We
- cannot in general substitute constants into parameter pseudo registers,
- since some machine descriptions (many RISCs) won't always handle
- the resulting insns. So if an incoming parameter has a constant
- equivalent, we record it here, and if the resulting insn is
- recognizable, we go with it.
-
- We also use this mechanism to convert references to incoming arguments
- and stacked variables. copy_rtx_and_substitute will replace the virtual
- incoming argument and virtual stacked variables registers with new
- pseudos that contain pointers into the replacement area allocated for
- this inline instance. These pseudos are then marked as being equivalent
- to the appropriate address and substituted if valid. */
- rtx *const_equiv_map;
- /* Number of entries in const_equiv_map and const_arg_map. */
- int const_equiv_map_size;
- /* This is incremented for each new basic block.
- It is used to store in const_age_map to record the domain of validity
- of each entry in const_equiv_map.
- A value of -1 indicates an entry for a reg which is a parm.
- All other values are "positive". */
-#define CONST_AGE_PARM (-1)
- unsigned int const_age;
- /* In parallel with const_equiv_map, record the valid age for each entry.
- The entry is invalid if its age is less than const_age. */
- unsigned int *const_age_map;
- /* Target of the inline function being expanded, or NULL if none. */
- rtx inline_target;
- /* When an insn is being copied by copy_rtx_and_substitute,
- this is nonzero if we have copied an ASM_OPERANDS.
- In that case, it is the original input-operand vector. */
- rtvec orig_asm_operands_vector;
- /* When an insn is being copied by copy_rtx_and_substitute,
- this is nonzero if we have copied an ASM_OPERANDS.
- In that case, it is the copied input-operand vector. */
- rtvec copy_asm_operands_vector;
- /* Likewise, this is the copied constraints vector. */
- rtvec copy_asm_constraints_vector;
-
- /* Indications for regs being pointers and their alignment. */
- char *regno_pointer_flag;
- char *regno_pointer_align;
-
- /* The next few fields are used for subst_constants to record the SETs
- that it saw. */
- int num_sets;
- struct equiv_table
- {
- rtx dest;
- rtx equiv;
- } equiv_sets[MAX_RECOG_OPERANDS];
- /* Record the last thing assigned to pc. This is used for folded
- conditional branch insns. */
- rtx last_pc_value;
-#ifdef HAVE_cc0
- /* Record the last thing assigned to cc0. */
- rtx last_cc0_value;
-#endif
-};
-
-/* Return a copy of an rtx (as needed), substituting pseudo-register,
- labels, and frame-pointer offsets as necessary. */
-extern rtx copy_rtx_and_substitute PROTO((rtx, struct inline_remap *));
-
-extern void try_constants PROTO((rtx, struct inline_remap *));
-
-extern void mark_stores PROTO((rtx, rtx));
-
-/* Unfortunately, we need a global copy of const_equiv map for communication
- with a function called from note_stores. Be *very* careful that this
- is used properly in the presence of recursion. */
-
-extern rtx *global_const_equiv_map;
-extern int global_const_equiv_map_size;
diff --git a/gcc/intl/intl-compat.c b/gcc/intl/intl-compat.c
deleted file mode 100644
index 503efa0fa9c..00000000000
--- a/gcc/intl/intl-compat.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
- Library.
- Copyright (C) 1995 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, 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. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "libgettext.h"
-
-/* @@ end of prolog @@ */
-
-
-#undef gettext
-#undef dgettext
-#undef dcgettext
-#undef textdomain
-#undef bindtextdomain
-
-
-char *
-bindtextdomain (domainname, dirname)
- const char *domainname;
- const char *dirname;
-{
- return bindtextdomain__ (domainname, dirname);
-}
-
-
-char *
-dcgettext (domainname, msgid, category)
- const char *domainname;
- const char *msgid;
- int category;
-{
- return dcgettext__ (domainname, msgid, category);
-}
-
-
-char *
-dgettext (domainname, msgid)
- const char *domainname;
- const char *msgid;
-{
- return dgettext__ (domainname, msgid);
-}
-
-
-char *
-gettext (msgid)
- const char *msgid;
-{
- return gettext__ (msgid);
-}
-
-
-char *
-textdomain (domainname)
- const char *domainname;
-{
- return textdomain__ (domainname);
-}
diff --git a/gcc/intl/linux-msg.sed b/gcc/intl/linux-msg.sed
deleted file mode 100755
index 5918e720a9a..00000000000
--- a/gcc/intl/linux-msg.sed
+++ /dev/null
@@ -1,100 +0,0 @@
-# po2msg.sed - Convert Uniforum style .po file to Linux style .msg file
-# Copyright (C) 1995 Free Software Foundation, Inc.
-# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
-#
-# 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, 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.
-#
-#
-# The first directive in the .msg should be the definition of the
-# message set number. We use always set number 1.
-#
-1 {
- i\
-$set 1 # Automatically created by po2msg.sed
- h
- s/.*/0/
- x
-}
-#
-# Mitch's old catalog format does not allow comments.
-#
-# We copy the original message as a comment into the .msg file.
-#
-/^msgid/ {
- s/msgid[ ]*"//
-#
-# This does not work now with the new format.
-# /"$/! {
-# s/\\$//
-# s/$/ ... (more lines following)"/
-# }
- x
-# The following nice solution is by
-# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
- td
-# Increment a decimal number in pattern space.
-# First hide trailing `9' digits.
- :d
- s/9\(_*\)$/_\1/
- td
-# Assure at least one digit is available.
- s/^\(_*\)$/0\1/
-# Increment the last digit.
- s/8\(_*\)$/9\1/
- s/7\(_*\)$/8\1/
- s/6\(_*\)$/7\1/
- s/5\(_*\)$/6\1/
- s/4\(_*\)$/5\1/
- s/3\(_*\)$/4\1/
- s/2\(_*\)$/3\1/
- s/1\(_*\)$/2\1/
- s/0\(_*\)$/1\1/
-# Convert the hidden `9' digits to `0's.
- s/_/0/g
- x
- G
- s/\(.*\)"\n\([0-9]*\)/$ #\2 Original Message:(\1)/p
-}
-#
-# The .msg file contains, other then the .po file, only the translations
-# but each given a unique ID. Starting from 1 and incrementing by 1 for
-# each message we assign them to the messages.
-# It is important that the .po file used to generate the cat-id-tbl.c file
-# (with po-to-tbl) is the same as the one used here. (At least the order
-# of declarations must not be changed.)
-#
-/^msgstr/ {
- s/msgstr[ ]*"\(.*\)"/# \1/
-# Clear substitution flag.
- tb
-# Append the next line.
- :b
- N
-# Look whether second part is continuation line.
- s/\(.*\n\)"\(.*\)"/\1\2/
-# Yes, then branch.
- ta
- P
- D
-# Note that D includes a jump to the start!!
-# We found a continuation line. But before printing insert '\'.
- :a
- s/\(.*\)\(\n.*\)/\1\\\2/
- P
-# We cannot use D here.
- s/.*\n\(.*\)/\1/
- tb
-}
-d
diff --git a/gcc/intl/po2tbl.sed.in b/gcc/intl/po2tbl.sed.in
deleted file mode 100755
index b3bcca4d730..00000000000
--- a/gcc/intl/po2tbl.sed.in
+++ /dev/null
@@ -1,102 +0,0 @@
-# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets
-# Copyright (C) 1995 Free Software Foundation, Inc.
-# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
-#
-# 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, 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.
-#
-1 {
- i\
-/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot. */\
-\
-#if HAVE_CONFIG_H\
-# include <config.h>\
-#endif\
-\
-#include "libgettext.h"\
-\
-const struct _msg_ent _msg_tbl[] = {
- h
- s/.*/0/
- x
-}
-#
-# Write msgid entries in C array form.
-#
-/^msgid/ {
- s/msgid[ ]*\(".*"\)/ {\1/
- tb
-# Append the next line
- :b
- N
-# Look whether second part is continuation line.
- s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/
-# Yes, then branch.
- ta
-# Because we assume that the input file correctly formed the line
-# just read cannot be again be a msgid line. So it's safe to ignore
-# it.
- s/\(.*\)\n.*/\1/
- bc
-# We found a continuation line. But before printing insert '\'.
- :a
- s/\(.*\)\(\n.*\)/\1\\\2/
- P
-# We cannot use D here.
- s/.*\n\(.*\)/\1/
-# Some buggy seds do not clear the `successful substitution since last ``t'''
-# flag on `N', so we do a `t' here to clear it.
- tb
-# Not reached
- :c
- x
-# The following nice solution is by
-# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
- td
-# Increment a decimal number in pattern space.
-# First hide trailing `9' digits.
- :d
- s/9\(_*\)$/_\1/
- td
-# Assure at least one digit is available.
- s/^\(_*\)$/0\1/
-# Increment the last digit.
- s/8\(_*\)$/9\1/
- s/7\(_*\)$/8\1/
- s/6\(_*\)$/7\1/
- s/5\(_*\)$/6\1/
- s/4\(_*\)$/5\1/
- s/3\(_*\)$/4\1/
- s/2\(_*\)$/3\1/
- s/1\(_*\)$/2\1/
- s/0\(_*\)$/1\1/
-# Convert the hidden `9' digits to `0's.
- s/_/0/g
- x
- G
- s/\(.*\)\n\([0-9]*\)/\1, \2},/
- s/\(.*\)"$/\1/
- p
-}
-#
-# Last line.
-#
-$ {
- i\
-};\
-
- g
- s/0*\(.*\)/int _msg_tbl_length = \1;/p
-}
-d
diff --git a/gcc/intl/xopen-msg.sed b/gcc/intl/xopen-msg.sed
deleted file mode 100755
index b19c0bbd0ec..00000000000
--- a/gcc/intl/xopen-msg.sed
+++ /dev/null
@@ -1,104 +0,0 @@
-# po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file
-# Copyright (C) 1995 Free Software Foundation, Inc.
-# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
-#
-# 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, 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.
-#
-#
-# The first directive in the .msg should be the definition of the
-# message set number. We use always set number 1.
-#
-1 {
- i\
-$set 1 # Automatically created by po2msg.sed
- h
- s/.*/0/
- x
-}
-#
-# We copy all comments into the .msg file. Perhaps they can help.
-#
-/^#/ s/^#[ ]*/$ /p
-#
-# We copy the original message as a comment into the .msg file.
-#
-/^msgid/ {
-# Does not work now
-# /"$/! {
-# s/\\$//
-# s/$/ ... (more lines following)"/
-# }
- s/^msgid[ ]*"\(.*\)"$/$ Original Message: \1/
- p
-}
-#
-# The .msg file contains, other then the .po file, only the translations
-# but each given a unique ID. Starting from 1 and incrementing by 1 for
-# each message we assign them to the messages.
-# It is important that the .po file used to generate the cat-id-tbl.c file
-# (with po-to-tbl) is the same as the one used here. (At least the order
-# of declarations must not be changed.)
-#
-/^msgstr/ {
- s/msgstr[ ]*"\(.*\)"/\1/
- x
-# The following nice solution is by
-# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
- td
-# Increment a decimal number in pattern space.
-# First hide trailing `9' digits.
- :d
- s/9\(_*\)$/_\1/
- td
-# Assure at least one digit is available.
- s/^\(_*\)$/0\1/
-# Increment the last digit.
- s/8\(_*\)$/9\1/
- s/7\(_*\)$/8\1/
- s/6\(_*\)$/7\1/
- s/5\(_*\)$/6\1/
- s/4\(_*\)$/5\1/
- s/3\(_*\)$/4\1/
- s/2\(_*\)$/3\1/
- s/1\(_*\)$/2\1/
- s/0\(_*\)$/1\1/
-# Convert the hidden `9' digits to `0's.
- s/_/0/g
- x
-# Bring the line in the format `<number> <message>'
- G
- s/^[^\n]*$/& /
- s/\(.*\)\n\([0-9]*\)/\2 \1/
-# Clear flag from last substitution.
- tb
-# Append the next line.
- :b
- N
-# Look whether second part is a continuation line.
- s/\(.*\n\)"\(.*\)"/\1\2/
-# Yes, then branch.
- ta
- P
- D
-# Note that `D' includes a jump to the start!!
-# We found a continuation line. But before printing insert '\'.
- :a
- s/\(.*\)\(\n.*\)/\1\\\2/
- P
-# We cannot use the sed command `D' here
- s/.*\n\(.*\)/\1/
- tb
-}
-d
diff --git a/gcc/invoke.texi b/gcc/invoke.texi
deleted file mode 100644
index c975c357266..00000000000
--- a/gcc/invoke.texi
+++ /dev/null
@@ -1,5086 +0,0 @@
-@c Copyright (C) 1988, 89, 92, 93, 94, 1995, 1996 Free Software Foundation, Inc.
-@c This is part of the GCC manual.
-@c For copying conditions, see the file gcc.texi.
-
-@node Invoking GCC
-@chapter GNU CC Command Options
-@cindex GNU CC command options
-@cindex command options
-@cindex options, GNU CC command
-
-When you invoke GNU CC, it normally does preprocessing, compilation,
-assembly and linking. The ``overall options'' allow you to stop this
-process at an intermediate stage. For example, the @samp{-c} option
-says not to run the linker. Then the output consists of object files
-output by the assembler.
-
-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.
-
-@cindex C compilation options
-Most of the command line options that you can use with GNU CC 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.
-
-@cindex C++ compilation options
-@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
-options for compiling C++ programs.
-
-@cindex grouping options
-@cindex options, grouping
-The @code{gcc} program accepts options and file names as operands. Many
-options have multiletter names; therefore multiple single-letter options
-may @emph{not} be grouped: @samp{-dr} is very different from @w{@samp{-d
--r}}.
-
-@cindex order of options
-@cindex options, order
-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 @samp{-L} more than once,
-the directories are searched in the order specified.
-
-Many options have long names starting with @samp{-f} or with
-@samp{-W}---for example, @samp{-fforce-mem},
-@samp{-fstrength-reduce}, @samp{-Wformat} and so on. Most of
-these have both positive and negative forms; the negative form of
-@samp{-ffoo} would be @samp{-fno-foo}. This manual documents
-only one of these two forms, whichever one is not the default.
-
-@menu
-* Option Summary:: Brief list of all options, without explanations.
-* Overall Options:: Controlling the kind of output:
- an executable, object files, assembler files,
- or preprocessed source.
-* Invoking G++:: Compiling C++ programs.
-* C Dialect Options:: Controlling the variant of C language compiled.
-* C++ Dialect Options:: Variations on C++.
-* Warning Options:: How picky should the compiler be?
-* Debugging Options:: Symbol tables, measurements, and debugging dumps.
-* Optimize Options:: How much optimization?
-* Preprocessor Options:: Controlling header files and macro definitions.
- Also, getting dependency information for Make.
-* Assembler Options:: Passing options to the assembler.
-* Link Options:: Specifying libraries and so on.
-* Directory Options:: Where to find header files and libraries.
- Where to find the compiler executable files.
-* Target Options:: Running a cross-compiler, or an old version of GNU CC.
-* Submodel Options:: Specifying minor hardware or convention variations,
- such as 68010 vs 68020.
-* Code Gen Options:: Specifying conventions for function calls, data layout
- and register usage.
-* Environment Variables:: Env vars that affect GNU CC.
-* Running Protoize:: Automatically adding or removing function prototypes.
-@end menu
-
-@node Option Summary
-@section Option Summary
-
-Here is a summary of all the options, grouped by type. Explanations are
-in the following sections.
-
-@table @emph
-@item Overall Options
-@xref{Overall Options,,Options Controlling the Kind of Output}.
-@smallexample
--c -S -E -o @var{file} -pipe -v -x @var{language}
-@end smallexample
-
-@item C Language Options
-@xref{C Dialect Options,,Options Controlling C Dialect}.
-@smallexample
--ansi -fallow-single-precision -fcond-mismatch -fno-asm
--fno-builtin -fsigned-bitfields -fsigned-char
--funsigned-bitfields -funsigned-char -fwritable-strings
--traditional -traditional-cpp -trigraphs
-@end smallexample
-
-@item C++ Language Options
-@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
-@smallexample
--fall-virtual -fdollars-in-identifiers -felide-constructors
--fenum-int-equiv -fexternal-templates -ffor-scope -fno-for-scope
--fhandle-signatures -fmemoize-lookups -fno-default-inline -fno-gnu-keywords
--fnonnull-objects -foperator-names -fstrict-prototype
--fthis-is-variable -nostdinc++ -traditional +e@var{n}
-@end smallexample
-
-@item Warning Options
-@xref{Warning Options,,Options to Request or Suppress Warnings}.
-@smallexample
--fsyntax-only -pedantic -pedantic-errors
--w -W -Wall -Waggregate-return -Wbad-function-cast
--Wcast-align -Wcast-qual -Wchar-subscript -Wcomment
--Wconversion -Werror -Wformat
--Wid-clash-@var{len} -Wimplicit -Wimport -Winline
--Wlarger-than-@var{len} -Wmissing-declarations
--Wmissing-prototypes -Wnested-externs
--Wno-import -Woverloaded-virtual -Wparentheses
--Wpointer-arith -Wredundant-decls -Wreorder -Wreturn-type -Wshadow
--Wsign-compare -Wstrict-prototypes -Wswitch -Wsynth
--Wtemplate-debugging -Wtraditional -Wtrigraphs
--Wuninitialized -Wunused -Wwrite-strings
-@end smallexample
-
-@item Debugging Options
-@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
-@smallexample
--a -ax -d@var{letters} -fpretend-float
--g -g@var{level} -gcoff -gdwarf -gdwarf+
--ggdb -gstabs -gstabs+ -gxcoff -gxcoff+
--p -pg -print-file-name=@var{library} -print-libgcc-file-name
--print-prog-name=@var{program} -print-search-dirs -save-temps
-@end smallexample
-
-@item Optimization Options
-@xref{Optimize Options,,Options that Control Optimization}.
-@smallexample
--fcaller-saves -fcse-follow-jumps -fcse-skip-blocks
--fdelayed-branch -fexpensive-optimizations
--ffast-math -ffloat-store -fforce-addr -fforce-mem
--ffunction-sections -finline-functions
--fkeep-inline-functions -fno-default-inline
--fno-defer-pop -fno-function-cse
--fno-inline -fno-peephole -fomit-frame-pointer
--frerun-cse-after-loop -fschedule-insns
--fschedule-insns2 -fstrength-reduce -fthread-jumps
--funroll-all-loops -funroll-loops
--O -O0 -O1 -O2 -O3
-@end smallexample
-
-@item Preprocessor Options
-@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
-@smallexample
--A@var{question}(@var{answer}) -C -dD -dM -dN
--D@var{macro}@r{[}=@var{defn}@r{]} -E -H
--idirafter @var{dir}
--include @var{file} -imacros @var{file}
--iprefix @var{file} -iwithprefix @var{dir}
--iwithprefixbefore @var{dir} -isystem @var{dir}
--M -MD -MM -MMD -MG -nostdinc -P -trigraphs
--undef -U@var{macro} -Wp,@var{option}
-@end smallexample
-
-@item Assembler Option
-@xref{Assembler Options,,Passing Options to the Assembler}.
-@smallexample
--Wa,@var{option}
-@end smallexample
-
-@item Linker Options
-@xref{Link Options,,Options for Linking}.
-@smallexample
-@var{object-file-name} -l@var{library}
--nostartfiles -nodefaultlibs -nostdlib
--s -static -shared -symbolic
--Wl,@var{option} -Xlinker @var{option}
--u @var{symbol}
-@end smallexample
-
-@item Directory Options
-@xref{Directory Options,,Options for Directory Search}.
-@smallexample
--B@var{prefix} -I@var{dir} -I- -L@var{dir}
-@end smallexample
-
-@item Target Options
-@c I wrote this xref this way to avoid overfull hbox. -- rms
-@xref{Target Options}.
-@smallexample
--b @var{machine} -V @var{version}
-@end smallexample
-
-@item Machine Dependent Options
-@xref{Submodel Options,,Hardware Models and Configurations}.
-@smallexample
-@emph{M680x0 Options}
--m68000 -m68020 -m68020-40 -m68030 -m68040 -m68060
--m5200 -m68881 -mbitfield -mc68000 -mc68020 -mfpa
--mnobitfield -mrtd -mshort -msoft-float
-
-@emph{VAX Options}
--mg -mgnu -munix
-
-@emph{SPARC Options}
--mcpu=@var{cpu type}
--mtune=@var{cpu type}
--mapp-regs -mbroken-saverestore -mcypress -mepilogue
--mflat -mfpu -mfullany -mhard-float -mhard-quad-float
--mimpure-text -mint32 -mint64 -mlive-g0
--mlong32 -mlong64 -mmedlow -mmedany
--mno-app-regs -mno-epilogue
--mno-flat -mno-fpu -mno-impure-text
--mno-stack-bias -mno-unaligned-doubles
--msoft-float -msoft-quad-float -msparclite -mstack-bias
--msupersparc -munaligned-doubles -mv8
-
-@emph{Convex Options}
--mc1 -mc2 -mc32 -mc34 -mc38
--margcount -mnoargcount
--mlong32 -mlong64
--mvolatile-cache -mvolatile-nocache
-
-@emph{AMD29K Options}
--m29000 -m29050 -mbw -mnbw -mdw -mndw
--mlarge -mnormal -msmall
--mkernel-registers -mno-reuse-arg-regs
--mno-stack-check -mno-storem-bug
--mreuse-arg-regs -msoft-float -mstack-check
--mstorem-bug -muser-registers
-
-@emph{ARM Options}
--mapcs-frame -mapcs-26 -mapcs-32
--mlittle-endian -mbig-endian -mwords-little-endian
--mshort-load-bytes -mno-short-load-bytes
--msoft-float -mhard-float
--mbsd -mxopen -mno-symrename
-
-@emph{M88K Options}
--m88000 -m88100 -m88110 -mbig-pic
--mcheck-zero-division -mhandle-large-shift
--midentify-revision -mno-check-zero-division
--mno-ocs-debug-info -mno-ocs-frame-position
--mno-optimize-arg-area -mno-serialize-volatile
--mno-underscores -mocs-debug-info
--mocs-frame-position -moptimize-arg-area
--mserialize-volatile -mshort-data-@var{num} -msvr3
--msvr4 -mtrap-large-shift -muse-div-instruction
--mversion-03.00 -mwarn-passed-structs
-
-@emph{RS/6000 and PowerPC Options}
--mcpu=@var{cpu type}
--mtune=@var{cpu type}
--mpower -mno-power -mpower2 -mno-power2
--mpowerpc -mno-powerpc
--mpowerpc-gpopt -mno-powerpc-gpopt
--mpowerpc-gfxopt -mno-powerpc-gfxopt
--mnew-mnemonics -mno-new-mnemonics
--mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc
--mxl-call -mno-xl-call
--msoft-float -mhard-float -mmultiple -mno-multiple
--mstring -mno-string -mbit-align -mno-bit-align
--mstrict-align -mno-strict-align -mrelocatable
--mno-relocatable -mrelocatable-lib -mno-relocatable-lib
--mtoc -mno-toc -mtraceback -mno-traceback
--mlittle -mlittle-endian -mbig -mbig-endian
--mcall-aix -mcall-sysv -mprototype -mno-prototype
--msim -mmvme -memb -msdata -msdata=@var{opt} -G @var{num}
-
-@emph{RT Options}
--mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs
--mfull-fp-blocks -mhc-struct-return -min-line-mul
--mminimum-fp-blocks -mnohc-struct-return
-
-@emph{MIPS Options}
--mabicalls -mcpu=@var{cpu type} -membedded-data
--membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64
--mgpopt -mhalf-pic -mhard-float -mint64 -mips1
--mips2 -mips3 -mlong64 -mlong-calls -mmemcpy
--mmips-as -mmips-tfile -mno-abicalls
--mno-embedded-data -mno-embedded-pic
--mno-gpopt -mno-long-calls
--mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats
--mrnames -msoft-float
--m4650 -msingle-float -mmad
--mstats -EL -EB -G @var{num} -nocpp
-
-@emph{i386 Options}
--m486 -m386 -mieee-fp -mno-fancy-math-387
--mno-fp-ret-in-387 -msoft-float -msvr3-shlib
--mno-wide-multiply -mrtd -malign-double
--mreg-alloc=@var{list} -mregparm=@var{num}
--malign-jumps=@var{num} -malign-loops=@var{num}
--malign-functions=@var{num}
-
-@emph{HPPA Options}
--mdisable-fpregs -mdisable-indexing -mfast-indirect-calls
--mgas -mjump-in-delay -mlong-load-store -mno-disable-fpregs
--mno-disable-indexing -mno-fast-indirect-calls -mno-gas
--mno-jump-in-delay
--mno-long-load-store
--mno-portable-runtime -mno-soft-float -mno-space -mno-space-regs -msoft-float
--mpa-risc-1-0 -mpa-risc-1-1 -mportable-runtime
--mschedule=@var{list} -mspace -mspace-regs
-
-@emph{Intel 960 Options}
--m@var{cpu type} -masm-compat -mclean-linkage
--mcode-align -mcomplex-addr -mleaf-procedures
--mic-compat -mic2.0-compat -mic3.0-compat
--mintel-asm -mno-clean-linkage -mno-code-align
--mno-complex-addr -mno-leaf-procedures
--mno-old-align -mno-strict-align -mno-tail-call
--mnumerics -mold-align -msoft-float -mstrict-align
--mtail-call
-
-@emph{DEC Alpha Options}
--mfp-regs -mno-fp-regs
--mno-soft-float -msoft-float
--mieee -mieee-with-inexact -mieee-conformant
--mfp-trap-mode -mfp-rounding-mode -mtrap-precision
--mbuild-constants
-
-@emph{Clipper Options}
--mc300 -mc400
-
-@emph{H8/300 Options}
--mrelax -mh -mint32 -malign-300
-
-@emph{SH Options}
--m1 -m2 -m3 -m3e -mb -ml -mrelax
-
-@emph{System V Options}
--Qy -Qn -YP,@var{paths} -Ym,@var{dir}
-@end smallexample
-
-@item Code Generation Options
-@xref{Code Gen Options,,Options for Code Generation Conventions}.
-@smallexample
--fcall-saved-@var{reg} -fcall-used-@var{reg}
--ffixed-@var{reg} -finhibit-size-directive
--fno-common -fno-ident -fno-gnu-linker
--fpcc-struct-return -fpic -fPIC
--freg-struct-return -fshared-data -fshort-enums
--fshort-double -fvolatile -fvolatile-global
--fverbose-asm -fpack-struct +e0 +e1
-@end smallexample
-@end table
-
-@menu
-* Overall Options:: Controlling the kind of output:
- an executable, object files, assembler files,
- or preprocessed source.
-* C Dialect Options:: Controlling the variant of C language compiled.
-* C++ Dialect Options:: Variations on C++.
-* Warning Options:: How picky should the compiler be?
-* Debugging Options:: Symbol tables, measurements, and debugging dumps.
-* Optimize Options:: How much optimization?
-* Preprocessor Options:: Controlling header files and macro definitions.
- Also, getting dependency information for Make.
-* Assembler Options:: Passing options to the assembler.
-* Link Options:: Specifying libraries and so on.
-* Directory Options:: Where to find header files and libraries.
- Where to find the compiler executable files.
-* Target Options:: Running a cross-compiler, or an old version of GNU CC.
-@end menu
-
-@node Overall Options
-@section 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.
-
-@cindex file name suffix
-For any given input file, the file name suffix determines what kind of
-compilation is done:
-
-@table @code
-@item @var{file}.c
-C source code which must be preprocessed.
-
-@item @var{file}.i
-C source code which should not be preprocessed.
-
-@item @var{file}.ii
-C++ source code which should not be preprocessed.
-
-@item @var{file}.m
-Objective-C source code. Note that you must link with the library
-@file{libobjc.a} to make an Objective-C program work.
-
-@item @var{file}.h
-C header file (not to be compiled or linked).
-
-@item @var{file}.cc
-@itemx @var{file}.cxx
-@itemx @var{file}.cpp
-@itemx @var{file}.C
-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.
-
-@item @var{file}.s
-Assembler code.
-
-@item @var{file}.S
-Assembler code which must be preprocessed.
-
-@item @var{other}
-An object file to be fed straight into linking.
-Any file name with no recognized suffix is treated this way.
-@end table
-
-You can specify the input language explicitly with the @samp{-x} option:
-
-@table @code
-@item -x @var{language}
-Specify explicitly the @var{language} 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 @samp{-x} option. Possible values for @var{language} are:
-@example
-c objective-c c++
-c-header cpp-output c++-cpp-output
-assembler assembler-with-cpp
-@end example
-
-@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 @samp{-x}
-has not been used at all).
-@end table
-
-If you only want some of the stages of compilation, you can use
-@samp{-x} (or filename suffixes) to tell @code{gcc} where to start, and
-one of the options @samp{-c}, @samp{-S}, or @samp{-E} to say where
-@code{gcc} is to stop. Note that some combinations (for example,
-@samp{-x cpp-output -E} instruct @code{gcc} to do nothing at all.
-
-@table @code
-@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.
-
-By default, the object file name for a source file is made by replacing
-the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
-
-Unrecognized input files, not requiring compilation or assembly, are
-ignored.
-
-@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.
-
-By default, the assembler file name for a source file is made by
-replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
-
-Input files that don't require compilation are ignored.
-
-@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.
-
-Input files which don't require preprocessing are ignored.
-
-@cindex output file option
-@item -o @var{file}
-Place output in file @var{file}. 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.
-
-Since only one output file can be specified, it does not make sense to
-use @samp{-o} when compiling more than one input file, unless you are
-producing an executable file as output.
-
-If @samp{-o} is not specified, the default is to put an executable file
-in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
-@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
-all preprocessed C source on standard output.@refill
-
-@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.
-
-@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 GNU assembler has
-no trouble.
-@end table
-
-@node Invoking G++
-@section Compiling C++ Programs
-
-@cindex suffixes for C++ source
-@cindex C++ source file suffixes
-C++ source files conventionally use one of the suffixes @samp{.C},
-@samp{.cc}, @samp{cpp}, or @samp{.cxx}; preprocessed C++ files use the
-suffix @samp{.ii}. GNU CC 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 @code{gcc}).
-
-@findex g++
-@findex c++
-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.
-@code{g++} is a program that calls GNU CC with the default language
-set to C++, and automatically specifies linking against the GNU class
-library libg++.
-@cindex @code{g++ 1.@var{xx}}
-@cindex @code{g++}, separate compiler
-@cindex @code{g++} older version
-@footnote{Prior to release 2 of the compiler,
-there was a separate @code{g++} compiler. That version was based on GNU
-CC, but not integrated with it. Versions of @code{g++} with a
-@samp{1.@var{xx}} version number---for example, @code{g++} version 1.37
-or 1.42---are much less reliable than the versions integrated with GCC
-2. Moreover, combining G++ @samp{1.@var{xx}} with a version 2 GCC will
-simply not work.} On many systems, the script @code{g++} is also
-installed with the name @code{c++}.
-
-@cindex invoking @code{g++}
-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.
-@xref{C Dialect Options,,Options Controlling C Dialect}, for
-explanations of options for languages related to C.
-@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
-explanations of options that are meaningful only for C++ programs.
-
-@node C Dialect Options
-@section Options Controlling C Dialect
-@cindex dialect options
-@cindex language dialect options
-@cindex options, dialect
-
-The following options control the dialect of C (or languages derived
-from C, such as C++ and Objective C) that the compiler accepts:
-
-@table @code
-@cindex ANSI support
-@item -ansi
-Support all ANSI standard C programs.
-
-This turns off certain features of GNU C that are incompatible with ANSI
-C, such as the @code{asm}, @code{inline} and @code{typeof} keywords, and
-predefined macros such as @code{unix} and @code{vax} that identify the
-type of system you are using. It also enables the undesirable and
-rarely used ANSI trigraph feature, disallows @samp{$} as part of
-identifiers, and disables recognition of C++ style @samp{//} comments.
-
-The alternate keywords @code{__asm__}, @code{__extension__},
-@code{__inline__} and @code{__typeof__} continue to work despite
-@samp{-ansi}. You would not want to use them in an ANSI C program, of
-course, but it is useful to put them in header files that might be included
-in compilations done with @samp{-ansi}. Alternate predefined macros
-such as @code{__unix__} and @code{__vax__} are also available, with or
-without @samp{-ansi}.
-
-The @samp{-ansi} option does not cause non-ANSI programs to be
-rejected gratuitously. For that, @samp{-pedantic} is required in
-addition to @samp{-ansi}. @xref{Warning Options}.
-
-The macro @code{__STRICT_ANSI__} is predefined when the @samp{-ansi}
-option is used. Some header files may notice this macro and refrain
-from declaring certain functions or defining certain macros that the
-ANSI standard doesn't call for; this is to avoid interfering with any
-programs that might use these names for other things.
-
-The functions @code{alloca}, @code{abort}, @code{exit}, and
-@code{_exit} are not builtin functions when @samp{-ansi} is used.
-
-@item -fno-asm
-Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
-keyword, so that code can use these words as identifiers. You can use
-the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
-instead. @samp{-ansi} implies @samp{-fno-asm}.
-
-In C++, this switch only affects the @code{typeof} keyword, since
-@code{asm} and @code{inline} are standard keywords. You may want to
-use the @samp{-fno-gnu-keywords} flag instead, as it also disables the
-other, C++-specific, extension keywords such as @code{headof}.
-
-@item -fno-builtin
-@cindex builtin functions
-@findex abort
-@findex abs
-@findex alloca
-@findex cos
-@findex exit
-@findex fabs
-@findex ffs
-@findex labs
-@findex memcmp
-@findex memcpy
-@findex sin
-@findex sqrt
-@findex strcmp
-@findex strcpy
-@findex strlen
-Don't recognize builtin functions that do not begin with two leading
-underscores. Currently, the functions affected include @code{abort},
-@code{abs}, @code{alloca}, @code{cos}, @code{exit}, @code{fabs},
-@code{ffs}, @code{labs}, @code{memcmp}, @code{memcpy}, @code{sin},
-@code{sqrt}, @code{strcmp}, @code{strcpy}, and @code{strlen}.
-
-GCC normally generates special code to handle certain builtin functions
-more efficiently; for instance, calls to @code{alloca} may become single
-instructions that adjust the stack directly, and calls to @code{memcpy}
-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.
-
-The @samp{-ansi} option prevents @code{alloca} and @code{ffs} from being
-builtin functions, since these functions do not have an ANSI standard
-meaning.
-
-@item -trigraphs
-Support ANSI C trigraphs. You don't want to know about this
-brain-damage. The @samp{-ansi} option implies @samp{-trigraphs}.
-
-@cindex traditional C language
-@cindex C language, traditional
-@item -traditional
-Attempt to support some aspects of traditional C compilers.
-Specifically:
-
-@itemize @bullet
-@item
-All @code{extern} declarations take effect globally even if they
-are written inside of a function definition. This includes implicit
-declarations of functions.
-
-@item
-The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
-and @code{volatile} are not recognized. (You can still use the
-alternative keywords such as @code{__typeof__}, @code{__inline__}, and
-so on.)
-
-@item
-Comparisons between pointers and integers are always allowed.
-
-@item
-Integer types @code{unsigned short} and @code{unsigned char} promote
-to @code{unsigned int}.
-
-@item
-Out-of-range floating point literals are not an error.
-
-@item
-Certain constructs which ANSI regards as a single invalid preprocessing
-number, such as @samp{0xe-0xd}, are treated as expressions instead.
-
-@item
-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
-@samp{-fwritable-strings}.)
-
-@cindex @code{longjmp} and automatic variables
-@item
-All automatic variables not declared @code{register} are preserved by
-@code{longjmp}. Ordinarily, GNU C follows ANSI C: automatic variables
-not declared @code{volatile} may be clobbered.
-
-@item
-@kindex \x
-@kindex \a
-@cindex escape sequences, traditional
-The character escape sequences @samp{\x} and @samp{\a} evaluate as the
-literal characters @samp{x} and @samp{a} respectively. Without
-@w{@samp{-traditional}}, @samp{\x} is a prefix for the hexadecimal
-representation of a character, and @samp{\a} produces a bell.
-
-@item
-In C++ programs, assignment to @code{this} is permitted with
-@samp{-traditional}. (The option @samp{-fthis-is-variable} also has
-this effect.)
-@end itemize
-
-You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
-if your program uses names that are normally GNU C builtin functions for
-other purposes of its own.
-
-You cannot use @samp{-traditional} if you include any header files that
-rely on ANSI C features. Some vendors are starting to ship systems with
-ANSI C header files and you cannot use @samp{-traditional} on such
-systems to compile files that include any system headers.
-
-The @samp{-traditional} option also enables the @samp{-traditional-cpp}
-option, which is described next.
-
-@item -traditional-cpp
-Attempt to support some aspects of traditional C preprocessors.
-Specifically:
-
-@itemize @bullet
-@item
-Comments convert to nothing at all, rather than to a space. This allows
-traditional token concatenation.
-
-@item
-In a preprocessing directive, the @samp{#} symbol must appear as the first
-character of a line.
-
-@item
-Macro arguments are recognized within string constants in a macro
-definition (and their values are stringified, though without additional
-quote marks, when they appear in such a context). The preprocessor
-always considers a string constant to end at a newline.
-
-@item
-@cindex detecting @w{@samp{-traditional}}
-The predefined macro @code{__STDC__} is not defined when you use
-@samp{-traditional}, but @code{__GNUC__} is (since the GNU extensions
-which @code{__GNUC__} indicates are not affected by
-@samp{-traditional}). If you need to write header files that work
-differently depending on whether @samp{-traditional} is in use, by
-testing both of these predefined macros you can distinguish four
-situations: GNU C, traditional GNU C, other ANSI C compilers, and other
-old C compilers. The predefined macro @code{__STDC_VERSION__} is also
-not defined when you use @samp{-traditional}. @xref{Standard
-Predefined,,Standard Predefined Macros,cpp.info,The C Preprocessor},
-for more discussion of these and other predefined macros.
-
-@item
-@cindex string constants vs newline
-@cindex newline vs string constants
-The preprocessor considers a string constant to end at a newline (unless
-the newline is escaped with @samp{\}). (Without @w{@samp{-traditional}},
-string constants can contain the newline character as typed.)
-@end itemize
-
-@item -fcond-mismatch
-Allow conditional expressions with mismatched types in the second and
-third arguments. The value of such an expression is void.
-
-@item -funsigned-char
-Let the type @code{char} be unsigned, like @code{unsigned char}.
-
-Each kind of machine has a default for what @code{char} should
-be. It is either like @code{unsigned char} by default or like
-@code{signed char} by default.
-
-Ideally, a portable program should always use @code{signed char} or
-@code{unsigned char} when it depends on the signedness of an object.
-But many programs have been written to use plain @code{char} 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.
-
-The type @code{char} is always a distinct type from each of
-@code{signed char} or @code{unsigned char}, even though its behavior
-is always just like one of those two.
-
-@item -fsigned-char
-Let the type @code{char} be signed, like @code{signed char}.
-
-Note that this is equivalent to @samp{-fno-unsigned-char}, which is
-the negative form of @samp{-funsigned-char}. Likewise, the option
-@samp{-fno-signed-char} is equivalent to @samp{-funsigned-char}.
-
-You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
-if your program uses names that are normally GNU C builtin functions for
-other purposes of its own.
-
-You cannot use @samp{-traditional} if you include any header files that
-rely on ANSI C features. Some vendors are starting to ship systems with
-ANSI C header files and you cannot use @samp{-traditional} on such
-systems to compile files that include any system headers.
-
-@item -fsigned-bitfields
-@itemx -funsigned-bitfields
-@itemx -fno-signed-bitfields
-@itemx -fno-unsigned-bitfields
-These options control whether a bitfield is signed or unsigned, when the
-declaration does not use either @code{signed} or @code{unsigned}. By
-default, such a bitfield is signed, because this is consistent: the
-basic integer types such as @code{int} are signed types.
-
-However, when @samp{-traditional} is used, bitfields are all unsigned
-no matter what.
-
-@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 @samp{-traditional} also has
-this effect.
-
-Writing into string constants is a very bad idea; ``constants'' should
-be constant.
-
-@item -fallow-single-precision
-Do not promote single precision math operations to double precision,
-even when compiling with @samp{-traditional}.
-
-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 @samp{-traditional}, but want
-to use single precision operations when the operands are single
-precision, use this option. This option has no effect when compiling
-with ANSI or GNU C conventions (the default).
-
-@end table
-
-@node C++ Dialect Options
-@section Options Controlling C++ Dialect
-
-@cindex compiler options, C++
-@cindex C++ options, command line
-@cindex options, C++
-This section describes the command-line options that are only meaningful
-for C++ programs; but you can also use most of the GNU compiler options
-regardless of what language your program is in. For example, you
-might compile a file @code{firstClass.C} like this:
-
-@example
-g++ -g -felide-constructors -O -c firstClass.C
-@end example
-
-@noindent
-In this example, only @samp{-felide-constructors} is an option meant
-only for C++ programs; you can use the other options with any
-language supported by GNU CC.
-
-Here is a list of options that are @emph{only} for compiling C++ programs:
-
-@table @code
-@item -fno-access-control
-Turn off all access checking. This switch is mainly useful for working
-around bugs in the access control code.
-
-@item -fall-virtual
-Treat all possible member functions as virtual, implicitly.
-All member functions (except for constructor functions and @code{new} or
-@code{delete} member operators) are treated as virtual functions of the
-class where they appear.
-
-This does not mean that all calls to these member functions will be made
-through the internal table of virtual functions. Under some
-circumstances, the compiler can determine that a call to a given virtual
-function can be made directly; in these cases the calls are direct in
-any case.
-
-@item -fcheck-new
-Check that the pointer returned by @code{operator new} is non-null
-before attempting to modify the storage allocated. The current Working
-Paper requires that @code{operator new} never return a null pointer, so
-this check is normally unnecessary.
-
-@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 @code{main()} has
-completed, you may have an object that is being destroyed twice because
-two definitions were merged.
-
-@item -fdollars-in-identifiers
-Accept @samp{$} in identifiers. You can also explicitly prohibit use of
-@samp{$} with the option @samp{-fno-dollars-in-identifiers}. (GNU C allows
-@samp{$} by default on most target systems, but there are a few exceptions.)
-Traditional C allowed the character @samp{$} to form part of
-identifiers. However, ANSI C and C++ forbid @samp{$} in identifiers.
-
-@item -fenum-int-equiv
-Anachronistically permit implicit conversion of @code{int} to
-enumeration types. Current C++ allows conversion of @code{enum} to
-@code{int}, but not the other way around.
-
-@item -fexternal-templates
-Cause template instantiations to obey @samp{#pragma interface} and
-@samp{implementation}; template instances are emitted or not according
-to the location of the template definition. @xref{Template
-Instantiation}, for more information.
-
-@item -falt-external-templates
-Similar to -fexternal-templates, but template instances are emitted or
-not according to the place where they are first instantiated.
-@xref{Template Instantiation}, for more information.
-
-@item -ffor-scope
-@item -fno-for-scope
-If -ffor-scope is specified, the scope of variables declared in
-a @i{for-init-statement} is limited to the @samp{for} loop itself,
-as specified by the draft C++ standard.
-If -fno-for-scope is specified, the scope of variables declared in
-a @i{for-init-statement} extends to the end of the enclosing scope,
-as was the case in old versions of gcc, and other (traditional)
-implementations of C++.
-
-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.
-
-@item -fno-gnu-keywords
-Do not recognize @code{classof}, @code{headof}, @code{signature},
-@code{sigof} or @code{typeof} as a keyword, so that code can use these
-words as identifiers. You can use the keywords @code{__classof__},
-@code{__headof__}, @code{__signature__}, @code{__sigof__}, and
-@code{__typeof__} instead. @samp{-ansi} implies
-@samp{-fno-gnu-keywords}.
-
-@item -fno-implicit-templates
-Never emit code for templates which are instantiated implicitly (i.e. by
-use); only emit code for explicit instantiations. @xref{Template
-Instantiation}, for more information.
-
-@item -fhandle-signatures
-Recognize the @code{signature} and @code{sigof} keywords for specifying
-abstract types. The default (@samp{-fno-handle-signatures}) is not to
-recognize them. @xref{C++ Signatures, Type Abstraction using
-Signatures}.
-
-@item -fhuge-objects
-Support virtual function calls for objects that exceed the size
-representable by a @samp{short int}. Users should not use this flag by
-default; if you need to use it, the compiler will tell you so. If you
-compile any of your code with this flag, you must compile @emph{all} of
-your code with this flag (including libg++, if you use it).
-
-This flag is not useful when compiling with -fvtable-thunks.
-
-@item -fno-implement-inlines
-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.
-
-@item -fmemoize-lookups
-@itemx -fsave-memoized
-Use heuristics to compile faster. These heuristics are not enabled by
-default, since they are only effective for certain input files. Other
-input files compile more slowly.
-
-The first time the compiler must build a call to a member function (or
-reference to a data member), it must (1) determine whether the class
-implements member functions of that name; (2) resolve which member
-function to call (which involves figuring out what sorts of type
-conversions need to be made); and (3) check the visibility of the member
-function to the caller. All of this adds up to slower compilation.
-Normally, the second time a call is made to that member function (or
-reference to that data member), it must go through the same lengthy
-process again. This means that code like this:
-
-@smallexample
-cout << "This " << p << " has " << n << " legs.\n";
-@end smallexample
-
-@noindent
-makes six passes through all three steps. By using a software cache, a
-``hit'' significantly reduces this cost. Unfortunately, using the cache
-introduces another layer of mechanisms which must be implemented, and so
-incurs its own overhead. @samp{-fmemoize-lookups} enables the software
-cache.
-
-Because access privileges (visibility) to members and member functions
-may differ from one function context to the next, G++ may need to flush
-the cache. With the @samp{-fmemoize-lookups} flag, the cache is flushed
-after every function that is compiled. The @samp{-fsave-memoized} flag
-enables the same software cache, but when the compiler determines that
-the context of the last function compiled would yield the same access
-privileges of the next function to compile, it preserves the cache.
-This is most helpful when defining many member functions for the same
-class: with the exception of member functions which are friends of other
-classes, each member function has exactly the same access privileges as
-every other, and the cache need not be flushed.
-
-The code that implements these flags has rotted; you should probably
-avoid using them.
-
-@item -fstrict-prototype
-Within an @samp{extern "C"} linkage specification, treat a function
-declaration with no arguments, such as @samp{int foo ();}, as declaring
-the function to take no arguments. Normally, such a declaration means
-that the function @code{foo} can take any combination of arguments, as
-in C. @samp{-pedantic} implies @samp{-fstrict-prototype} unless
-overridden with @samp{-fno-strict-prototype}.
-
-This flag no longer affects declarations with C++ linkage.
-
-@item -fno-nonnull-objects
-Don't assume that a reference is initialized to refer to a valid object.
-Although the current C++ Working Paper prohibits null references, some
-old code may rely on them, and you can use @samp{-fno-nonnull-objects}
-to turn on checking.
-
-At the moment, the compiler only does this checking for conversions to
-virtual base classes.
-
-@item -foperator-names
-Recognize the operator name keywords @code{and}, @code{bitand},
-@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
-synonyms for the symbols they refer to. @samp{-ansi} implies
-@samp{-foperator-names}.
-
-@item -fthis-is-variable
-Permit assignment to @code{this}. The incorporation of user-defined
-free store management into C++ has made assignment to @samp{this} an
-anachronism. Therefore, by default it is invalid to assign to
-@code{this} within a class member function; that is, GNU C++ treats
-@samp{this} in a member function of class @code{X} as a non-lvalue of
-type @samp{X *}. However, for backwards compatibility, you can make it
-valid with @samp{-fthis-is-variable}.
-
-@item -fvtable-thunks
-Use @samp{thunks} to implement the virtual function dispatch table
-(@samp{vtable}). The traditional (cfront-style) approach to
-implementing vtables was to store a pointer to the function and two
-offsets for adjusting the @samp{this} pointer at the call site. Newer
-implementations store a single pointer to a @samp{thunk} function which
-does any necessary adjustment and then calls the target function.
-
-This option also enables a heuristic for controlling emission of
-vtables; if a class has any non-inline virtual functions, the vtable
-will be emitted in the translation unit containing the first one of
-those.
-
-@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 libg++.)
-
-@item -traditional
-For C++ programs (in addition to the effects that apply to both C and
-C++), this has the same effect as @samp{-fthis-is-variable}.
-@xref{C Dialect Options,, Options Controlling C Dialect}.
-@end table
-
-In addition, these optimization, warning, and code generation options
-have meanings only for C++ programs:
-
-@table @code
-@item -fno-default-inline
-Do not assume @samp{inline} for functions defined inside a class scope.
-@xref{Optimize Options,,Options That Control Optimization}.
-
-@item -Woverloaded-virtual
-@itemx -Wtemplate-debugging
-Warnings that apply only to C++ programs. @xref{Warning
-Options,,Options to Request or Suppress Warnings}.
-
-@item +e@var{n}
-Control how virtual function definitions are used, in a fashion
-compatible with @code{cfront} 1.x. @xref{Code Gen Options,,Options for
-Code Generation Conventions}.
-@end table
-
-@node Warning Options
-@section Options to Request or Suppress Warnings
-@cindex options to control warnings
-@cindex warning messages
-@cindex messages, warning
-@cindex suppressing 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.
-
-You can request many specific warnings with options beginning @samp{-W},
-for example @samp{-Wimplicit} to request warnings on implicit
-declarations. Each of these specific warning options also has a
-negative form beginning @samp{-Wno-} to turn off warnings;
-for example, @samp{-Wno-implicit}. This manual lists only one of the
-two forms, whichever is not the default.
-
-These options control the amount and kinds of warnings produced by GNU
-CC:
-
-@table @code
-@cindex syntax checking
-@item -fsyntax-only
-Check the code for syntax errors, but don't do anything beyond that.
-
-@item -pedantic
-Issue all the warnings demanded by strict ANSI standard C; reject
-all programs that use forbidden extensions.
-
-Valid ANSI standard C programs should compile properly with or without
-this option (though a rare few will require @samp{-ansi}). However,
-without this option, certain GNU extensions and traditional C features
-are supported as well. With this option, they are rejected.
-
-@samp{-pedantic} does not cause warning messages for use of the
-alternate keywords whose names begin and end with @samp{__}. Pedantic
-warnings are also disabled in the expression that follows
-@code{__extension__}. However, only system header files should use
-these escape routes; application programs should avoid them.
-@xref{Alternate Keywords}.
-
-This option is not intended to be @i{useful}; it exists only to satisfy
-pedants who would otherwise claim that GNU CC fails to support the ANSI
-standard.
-
-Some users try to use @samp{-pedantic} to check programs for strict ANSI
-C conformance. They soon find that it does not do quite what they want:
-it finds some non-ANSI practices, but not all---only those for which
-ANSI C @emph{requires} a diagnostic.
-
-A feature to report any failure to conform to ANSI C might be useful in
-some instances, but would require considerable additional work and would
-be quite different from @samp{-pedantic}. We recommend, rather, that
-users take advantage of the extensions of GNU C and disregard the
-limitations of other compilers. Aside from certain supercomputers and
-obsolete small machines, there is less and less reason ever to use any
-other C compiler other than for bootstrapping GNU CC.
-
-@item -pedantic-errors
-Like @samp{-pedantic}, except that errors are produced rather than
-warnings.
-
-@item -w
-Inhibit all warning messages.
-
-@item -Wno-import
-Inhibit warning messages about the use of @samp{#import}.
-
-@item -Wchar-subscripts
-Warn if an array subscript has type @code{char}. This is a common cause
-of error, as programmers often forget that this type is signed on some
-machines.
-
-@item -Wcomment
-Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
-comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
-
-@item -Wformat
-Check calls to @code{printf} and @code{scanf}, etc., to make sure that
-the arguments supplied have types appropriate to the format string
-specified.
-
-@item -Wimplicit
-Warn whenever a function or parameter is implicitly declared.
-
-@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.
-
-@item -Wreturn-type
-Warn whenever a function is defined with a return-type that defaults
-to @code{int}. Also warn about any @code{return} statement with no
-return-value in a function whose return-type is not @code{void}.
-
-@item -Wswitch
-Warn whenever a @code{switch} statement has an index of enumeral type
-and lacks a @code{case} for one or more of the named codes of that
-enumeration. (The presence of a @code{default} label prevents this
-warning.) @code{case} labels outside the enumeration range also
-provoke warnings when this option is used.
-
-@item -Wtrigraphs
-Warn if any trigraphs are encountered (assuming they are enabled).
-
-@item -Wunused
-Warn whenever a variable is unused aside from its declaration,
-whenever a function is declared static but never defined, whenever a
-label is declared but not used, and whenever a statement computes a
-result that is explicitly not used.
-
-To suppress this warning for an expression, simply cast it to void. For
-unused variables and parameters, use the @samp{unused} attribute
-(@pxref{Variable Attributes}).
-
-@item -Wuninitialized
-An automatic variable is used without first being initialized.
-
-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 @samp{-O}, you simply won't
-get these warnings.
-
-These warnings occur only for variables that are candidates for
-register allocation. Therefore, they do not occur for a variable that
-is declared @code{volatile}, 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.
-
-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.
-
-These warnings are made optional because GNU CC 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:
-
-@smallexample
-@{
- int x;
- switch (y)
- @{
- case 1: x = 1;
- break;
- case 2: x = 4;
- break;
- case 3: x = 5;
- @}
- foo (x);
-@}
-@end smallexample
-
-@noindent
-If the value of @code{y} is always 1, 2 or 3, then @code{x} is
-always initialized, but GNU CC doesn't know this. Here is
-another common case:
-
-@smallexample
-@{
- int save_y;
- if (change_y) save_y = y, y = new_y;
- @dots{}
- if (change_y) y = save_y;
-@}
-@end smallexample
-
-@noindent
-This has no bug because @code{save_y} is used only if it is set.
-
-Some spurious warnings can be avoided if you declare all the functions
-you use that never return as @code{noreturn}. @xref{Function
-Attributes}.
-
-@item -Wreorder (C++ only)
-@cindex reordering, warning
-@cindex warning for reordering of member initializers
-Warn when the order of member initializers given in the code does not
-match the order in which they must be executed. For instance:
-
-@smallexample
-struct A @{
- int i;
- int j;
- A(): j (0), i (1) @{ @}
-@};
-@end smallexample
-
-Here the compiler will warn that the member initializers for @samp{i}
-and @samp{j} will be rearranged to match the declaration order of the
-members.
-
-@item -Wsign-compare
-@cindex warning for comparison of signed and unsigned values
-@cindex comparison of signed and unsigned values, warning
-@cindex signed and unsigned values, comparison warning
-Warn when a comparison between signed and unsigned values could produce
-an incorrect result when the signed value is converted to unsigned.
-
-@item -Wtemplate-debugging
-@cindex template debugging
-When using templates in a C++ program, warn if debugging is not yet
-fully available (C++ only).
-
-@item -Wall
-All of the above @samp{-W} 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.
-@end table
-
-The following @samp{-W@dots{}} options are not implied by @samp{-Wall}.
-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.
-
-@table @code
-@item -W
-Print extra warning messages for these events:
-
-@itemize @bullet
-@cindex @code{longjmp} warnings
-@item
-A nonvolatile automatic variable might be changed by a call to
-@code{longjmp}. These warnings as well are possible only in
-optimizing compilation.
-
-The compiler sees only the calls to @code{setjmp}. It cannot know
-where @code{longjmp} 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 @code{longjmp} cannot
-in fact be called at the place which would cause a problem.
-
-@item
-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:
-
-@smallexample
-@group
-foo (a)
-@{
- if (a > 0)
- return a;
-@}
-@end group
-@end smallexample
-
-@item
-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 @samp{x[i,j]} will cause a warning,
-but @samp{x[(void)i,j]} will not.
-
-@item
-An unsigned value is compared against zero with @samp{<} or @samp{<=}.
-
-@item
-A comparison like @samp{x<=y<=z} appears; this is equivalent to
-@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
-that of ordinary mathematical notation.
-
-@item
-Storage-class specifiers like @code{static} are not the first things in
-a declaration. According to the C Standard, this usage is obsolescent.
-
-@item
-If @samp{-Wall} or @samp{-Wunused} is also specified, warn about unused
-arguments.
-
-@item
-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 @code{x.h}:
-
-@smallexample
-struct s @{ int f, g; @};
-struct t @{ struct s h; int i; @};
-struct t x = @{ 1, 2, 3 @};
-@end smallexample
-@end itemize
-
-@item -Wtraditional
-Warn about certain constructs that behave differently in traditional and
-ANSI C.
-
-@itemize @bullet
-@item
-Macro arguments occurring within string constants in the macro body.
-These would substitute the argument in traditional C, but are part of
-the constant in ANSI C.
-
-@item
-A function declared external in one block and then used after the end of
-the block.
-
-@item
-A @code{switch} statement has an operand of type @code{long}.
-@end itemize
-
-@item -Wshadow
-Warn whenever a local variable shadows another local variable.
-
-@item -Wid-clash-@var{len}
-Warn whenever two distinct identifiers match in the first @var{len}
-characters. This may help you prepare a program that will compile
-with certain obsolete, brain-damaged compilers.
-
-@item -Wlarger-than-@var{len}
-Warn whenever an object of larger than @var{len} bytes is defined.
-
-@item -Wpointer-arith
-Warn about anything that depends on the ``size of'' a function type or
-of @code{void}. GNU C assigns these types a size of 1, for
-convenience in calculations with @code{void *} pointers and pointers
-to functions.
-
-@item -Wbad-function-cast
-Warn whenever a function call is cast to a non-matching type.
-For example, warn if @code{int malloc()} is cast to @code{anything *}.
-
-@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 @code{const char *} is cast
-to an ordinary @code{char *}.
-
-@item -Wcast-align
-Warn whenever a pointer is cast such that the required alignment of the
-target is increased. For example, warn if a @code{char *} is cast to
-an @code{int *} on machines where integers can only be accessed at
-two- or four-byte boundaries.
-
-@item -Wwrite-strings
-Give string constants the type @code{const char[@var{length}]} so that
-copying the address of one into a non-@code{const} @code{char *}
-pointer will get a warning. 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 @code{const} in
-declarations and prototypes. Otherwise, it will just be a nuisance;
-this is why we did not make @samp{-Wall} request these warnings.
-
-@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.
-
-Also, warn if a negative integer constant expression is implicitly
-converted to an unsigned type. For example, warn about the assignment
-@code{x = -1} if @code{x} is unsigned. But do not warn about explicit
-casts like @code{(unsigned) -1}.
-
-@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.)
-
-@item -Wstrict-prototypes
-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.)
-
-@item -Wmissing-prototypes
-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.
-
-@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.
-
-@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.
-
-@item -Wnested-externs
-Warn if an @code{extern} declaration is encountered within an function.
-
-@item -Winline
-Warn if a function can not be inlined, and either it was declared as inline,
-or else the @samp{-finline-functions} option was given.
-
-@item -Woverloaded-virtual
-@cindex overloaded virtual fn, warning
-@cindex warning for overloaded virtual fn
-Warn when a derived class function declaration may be an error in
-defining a virtual function (C++ only). In a derived class, the
-definitions of virtual functions must match the type signature of a
-virtual function declared in the base class. With this option, the
-compiler warns when you define a function with the same name as a
-virtual function, but with a type signature that does not match any
-declarations from the base class.
-
-@item -Wsynth (C++ only)
-@cindex warning for synthesized methods
-@cindex synthesized methods, warning
-Warn when g++'s synthesis behavior does not match that of cfront. For
-instance:
-
-@smallexample
-struct A @{
- operator int ();
- A& operator = (int);
-@};
-
-main ()
-@{
- A a,b;
- a = b;
-@}
-@end smallexample
-
-In this example, g++ will synthesize a default @samp{A& operator =
-(const A&);}, while cfront will use the user-defined @samp{operator =}.
-
-@item -Werror
-Make all warnings into errors.
-@end table
-
-@node Debugging Options
-@section Options for Debugging Your Program or GNU CC
-@cindex options, debugging
-@cindex debugging information options
-
-GNU CC has various special options that are used for debugging
-either your program or GCC:
-
-@table @code
-@item -g
-Produce debugging information in the operating system's native format
-(stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging
-information.
-
-On most systems that use stabs format, @samp{-g} enables use of extra
-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 @samp{-gstabs+}, @samp{-gstabs},
-@samp{-gxcoff+}, @samp{-gxcoff}, @samp{-gdwarf+}, or @samp{-gdwarf}
-(see below).
-
-Unlike most other C compilers, GNU CC allows you to use @samp{-g} with
-@samp{-O}. 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.
-
-Nevertheless it proves possible to debug optimized output. This makes
-it reasonable to use the optimizer for programs that might have bugs.
-
-The following options are useful when GNU CC is generated with the
-capability for more than one debugging format.
-
-@item -ggdb
-Produce debugging information in the native format (if that is supported),
-including GDB extensions if at all possible.
-
-@item -gstabs
-Produce debugging information in stabs format (if that is supported),
-without GDB extensions. This is the format used by DBX on most BSD
-systems. On MIPS, Alpha and System V Release 4 systems this option
-produces stabs debugging output which is not understood by DBX or SDB.
-On System V Release 4 systems this option requires the GNU assembler.
-
-@item -gstabs+
-Produce debugging information in stabs format (if that is supported),
-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.
-
-@item -gcoff
-Produce debugging information in COFF format (if that is supported).
-This is the format used by SDB on most System V systems prior to
-System V Release 4.
-
-@item -gxcoff
-Produce debugging information in XCOFF format (if that is supported).
-This is the format used by the DBX debugger on IBM RS/6000 systems.
-
-@item -gxcoff+
-Produce debugging information in XCOFF format (if that is supported),
-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, and may cause assemblers other than the GNU
-assembler (GAS) to fail with an error.
-
-@item -gdwarf
-Produce debugging information in DWARF format (if that is supported).
-This is the format used by SDB on most System V Release 4 systems.
-
-@item -gdwarf+
-Produce debugging information in DWARF format (if that is supported),
-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.
-
-@item -g@var{level}
-@itemx -ggdb@var{level}
-@itemx -gstabs@var{level}
-@itemx -gcoff@var{level}
-@itemx -gxcoff@var{level}
-@itemx -gdwarf@var{level}
-Request debugging information and also use @var{level} to specify how
-much information. The default level is 2.
-
-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.
-
-Level 3 includes extra information, such as all the macro definitions
-present in the program. Some debuggers support macro expansion when
-you use @samp{-g3}.
-
-@cindex @code{prof}
-@item -p
-Generate extra code to write profile information suitable for the
-analysis program @code{prof}. You must use this option when compiling
-the source files you want data about, and you must also use it when
-linking.
-
-@cindex @code{gprof}
-@item -pg
-Generate extra code to write profile information suitable for the
-analysis program @code{gprof}. You must use this option when compiling
-the source files you want data about, and you must also use it when
-linking.
-
-@cindex @code{tcov}
-@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 @samp{-g} 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 @file{bb.out}.
-
-This data could be analyzed by a program like @code{tcov}. Note,
-however, that the format of the data is not what @code{tcov} expects.
-Eventually GNU @code{gprof} should be extended to process this data.
-
-@item -ax
-Generate extra code to profile basic blocks. Your executable will
-produce output that is a superset of that produced when @samp{-a} is
-used. Additional output is the source and target address of the basic
-blocks where a jump takes place, the number of times a jump is executed,
-and (optionally) the complete sequence of basic blocks being executed.
-The output is appended to file @file{bb.out}.
-
-You can examine different profiling aspects without recompilation. Your
-execuable will read a list of function names from file @file{bb.in}.
-Profiling starts when a function on the list is entered and stops when
-that invocation is exited. To exclude a function from profiling, prefix
-its name with `-'. If a function name is not unique, you can
-disambiguate it by writing it in the form
-@samp{/path/filename.d:functionname}. Your executable will write the
-available paths and filenames in file @file{bb.out}.
-
-Several function names have a special meaning:
-@table @code
-@item __bb_jumps__
-Write source, target and frequency of jumps to file @file{bb.out}.
-@item __bb_hidecall__
-Exclude function calls from frequency count.
-@item __bb_showret__
-Include function returns in frequency count.
-@item __bb_trace__
-Write the sequence of basic blocks executed to file @file{bbtrace.gz}.
-The file will be compressed using the program @samp{gzip}, which must
-exist in your @code{PATH}. On systems without the @samp{popen}
-function, the file will be named @file{bbtrace} and will not be
-compressed. @strong{Profiling for even a few seconds on these systems
-will produce a very large file.} Note: @code{__bb_hidecall__} and
-@code{__bb_showret__} will not affect the sequence written to
-@file{bbtrace.gz}.
-@end table
-
-Here's a short example using different profiling parameters
-in file @file{bb.in}. Assume function @code{foo} consists of basic blocks
-1 and 2 and is called twice from block 3 of function @code{main}. After
-the calls, block 3 transfers control to block 4 of @code{main}.
-
-With @code{__bb_trace__} and @code{main} contained in file @file{bb.in},
-the following sequence of blocks is written to file @file{bbtrace.gz}:
-0 3 1 2 1 2 4. The return from block 2 to block 3 is not shown, because
-the return is to a point inside the block and not to the top. The
-block address 0 always indicates, that control is transferred
-to the trace from somewhere outside the observed functions. With
-@samp{-foo} added to @file{bb.in}, the blocks of function
-@code{foo} are removed from the trace, so only 0 3 4 remains.
-
-With @code{__bb_jumps__} and @code{main} contained in file @file{bb.in},
-jump frequencies will be written to file @file{bb.out}. The
-frequencies are obtained by constructing a trace of blocks
-and incrementing a counter for every neighbouring pair of blocks
-in the trace. The trace 0 3 1 2 1 2 4 displays the following
-frequencies:
-
-@example
-Jump from block 0x0 to block 0x3 executed 1 time(s)
-Jump from block 0x3 to block 0x1 executed 1 time(s)
-Jump from block 0x1 to block 0x2 executed 2 time(s)
-Jump from block 0x2 to block 0x1 executed 1 time(s)
-Jump from block 0x2 to block 0x4 executed 1 time(s)
-@end example
-
-With @code{__bb_hidecall__}, control transfer due to call instructions
-is removed from the trace, that is the trace is cut into three parts: 0
-3 4, 0 1 2 and 0 1 2. With @code{__bb_showret__}, control transfer due
-to return instructions is added to the trace. The trace becomes: 0 3 1
-2 3 1 2 3 4. Note, that this trace is not the same, as the sequence
-written to @file{bbtrace.gz}. It is solely used for counting jump
-frequencies.
-
-@item -d@var{letters}
-Says to make debugging dumps during compilation at times specified by
-@var{letters}. This is used for debugging the compiler. The file names
-for most of the dumps are made by appending a word to the source file
-name (e.g. @file{foo.c.rtl} or @file{foo.c.jump}). Here are the
-possible letters for use in @var{letters}, and their meanings:
-
-@table @samp
-@item M
-Dump all macro definitions, at the end of preprocessing, and write no
-output.
-@item N
-Dump all macro names, at the end of preprocessing.
-@item D
-Dump all macro definitions, at the end of preprocessing, in addition to
-normal output.
-@item y
-Dump debugging information during parsing, to standard error.
-@item r
-Dump after RTL generation, to @file{@var{file}.rtl}.
-@item x
-Just generate RTL for a function instead of compiling it. Usually used
-with @samp{r}.
-@item j
-Dump after first jump optimization, to @file{@var{file}.jump}.
-@item s
-Dump after CSE (including the jump optimization that sometimes
-follows CSE), to @file{@var{file}.cse}.
-@item L
-Dump after loop optimization, to @file{@var{file}.loop}.
-@item t
-Dump after the second CSE pass (including the jump optimization that
-sometimes follows CSE), to @file{@var{file}.cse2}.
-@item f
-Dump after flow analysis, to @file{@var{file}.flow}.
-@item c
-Dump after instruction combination, to the file
-@file{@var{file}.combine}.
-@item S
-Dump after the first instruction scheduling pass, to
-@file{@var{file}.sched}.
-@item l
-Dump after local register allocation, to
-@file{@var{file}.lreg}.
-@item g
-Dump after global register allocation, to
-@file{@var{file}.greg}.
-@item R
-Dump after the second instruction scheduling pass, to
-@file{@var{file}.sched2}.
-@item J
-Dump after last jump optimization, to @file{@var{file}.jump2}.
-@item d
-Dump after delayed branch scheduling, to @file{@var{file}.dbr}.
-@item k
-Dump after conversion from registers to stack, to @file{@var{file}.stack}.
-@item a
-Produce all the dumps listed above.
-@item m
-Print statistics on memory usage, at the end of the run, to
-standard error.
-@item p
-Annotate the assembler output with a comment indicating which
-pattern and alternative was used.
-@item A
-Annotate the assembler output with miscellaneous debugging information.
-@end table
-
-@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 GNU CC would make when running on
-the target machine.
-
-@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 @file{foo.c} with @samp{-c -save-temps} would produce files
-@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.
-
-@item -print-file-name=@var{library}
-Print the full absolute name of the library file @var{library} that
-would be used when linking---and don't do anything else. With this
-option, GNU CC does not compile or link anything; it just prints the
-file name.
-
-@item -print-prog-name=@var{program}
-Like @samp{-print-file-name}, but searches for a program such as @samp{cpp}.
-
-@item -print-libgcc-file-name
-Same as @samp{-print-file-name=libgcc.a}.
-
-This is useful when you use @samp{-nostdlib} or @samp{-nodefaultlibs}
-but you do want to link with @file{libgcc.a}. You can do
-
-@example
-gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
-@end example
-
-@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.
-
-This is useful when gcc prints the error message
-@samp{installation problem, cannot exec cpp: No such file or directory}.
-To resolve this you either need to put @file{cpp} and the other compiler
-components where gcc expects to find them, or you can set the environment
-variable @code{GCC_EXEC_PREFIX} to the directory where you installed them.
-Don't forget the trailing '/'.
-@xref{Environment Variables}.
-@end table
-
-@node Optimize Options
-@section Options That Control Optimization
-@cindex optimize options
-@cindex options, optimization
-
-These options control various sorts of optimizations:
-
-@table @code
-@item -O
-@itemx -O1
-Optimize. Optimizing compilation takes somewhat more time, and a lot
-more memory for a large function.
-
-Without @samp{-O}, 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.
-
-Without @samp{-O}, the compiler only allocates variables declared
-@code{register} in registers. The resulting compiled code is a little
-worse than produced by PCC without @samp{-O}.
-
-With @samp{-O}, the compiler tries to reduce code size and execution
-time.
-
-When you specify @samp{-O}, the compiler turns on @samp{-fthread-jumps}
-and @samp{-fdefer-pop} on all machines. The compiler turns on
-@samp{-fdelayed-branch} on machines that have delay slots, and
-@samp{-fomit-frame-pointer} on machines that can support debugging even
-without a frame pointer. On some machines the compiler also turns
-on other flags.@refill
-
-@item -O2
-Optimize even more. GNU CC 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 @samp{-O2}.
-As compared to @samp{-O}, this option increases both compilation time
-and the performance of the generated code.
-
-@samp{-O2} turns on all optional optimizations except for loop unrolling
-and function inlining. It also turns on the @samp{-fforce-mem} option
-on all machines and frame pointer elimination on machines where doing so
-does not interfere with debugging.
-
-@item -O3
-Optimize yet more. @samp{-O3} turns on all optimizations specified by
-@samp{-O2} and also turns on the @samp{inline-functions} option.
-
-@item -O0
-Do not optimize.
-
-If you use multiple @samp{-O} options, with or without level numbers,
-the last such option is the one that is effective.
-@end table
-
-Options of the form @samp{-f@var{flag}} specify machine-independent
-flags. Most flags have both positive and negative forms; the negative
-form of @samp{-ffoo} would be @samp{-fno-foo}. 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 @samp{no-} or
-adding it.
-
-@table @code
-@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.
-
-@cindex floating point precision
-This option prevents undesirable excess precision on machines such as
-the 68000 where the floating registers (of the 68881) keep more
-precision than a @code{double} 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 IEEE floating
-point. Use @samp{-ffloat-store} for such programs.
-
-@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
-@w{@samp{-O}}, member functions defined inside class scope are compiled
-inline by default; i.e., you don't need to add @samp{inline} in front of
-the member function name.
-
-@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.
-
-@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 @samp{-O2} option turns on this option.
-
-@item -fforce-addr
-Force memory address constants to be copied into registers before
-doing arithmetic on them. This may produce better code just as
-@samp{-fforce-mem} may.
-
-@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. @strong{It also makes debugging impossible on
-some machines.}
-
-@ifset INTERNALS
-On some machines, such as the Vax, 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 @code{FRAME_POINTER_REQUIRED} controls
-whether a target machine supports this flag. @xref{Registers}.@refill
-@end ifset
-@ifclear INTERNALS
-On some machines, such as the Vax, 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 @code{FRAME_POINTER_REQUIRED} controls
-whether a target machine supports this flag. @xref{Registers,,Register
-Usage, gcc.info, Using and Porting GCC}.@refill
-@end ifclear
-
-@item -fno-inline
-Don't pay attention to the @code{inline} 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.
-
-@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.
-
-If all calls to a given function are integrated, and the function is
-declared @code{static}, then the function is normally not output as
-assembler code in its own right.
-
-@item -fkeep-inline-functions
-Even if all calls to a given function are integrated, and the function
-is declared @code{static}, nevertheless output a separate run-time
-callable version of the function. This switch does not affect
-@code{extern inline} functions.
-
-@item -fkeep-static-consts
-Emit variables declared @code{static const} when optimization isn't turned
-on, even if the variables aren't referenced.
-
-GNU CC 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 @samp{-fno-keep-static-consts} option.
-
-@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.
-
-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.
-
-@item -ffast-math
-This option allows GCC to violate some ANSI or IEEE rules and/or
-specifications in the interest of optimizing code for speed. For
-example, it allows the compiler to assume arguments to the @code{sqrt}
-function are non-negative numbers and that no floating-point values
-are NaNs.
-
-This option should never be turned on by any @samp{-O} option since
-it can result in incorrect output for programs which depend on
-an exact implementation of IEEE or ANSI rules/specifications for
-math functions.
-@end table
-
-@c following causes underfulls.. they don't look great, but we deal.
-@c --mew 26jan93
-The following options control specific optimizations. The @samp{-O2}
-option turns on all of these optimizations except @samp{-funroll-loops}
-and @samp{-funroll-all-loops}. On most machines, the @samp{-O} option
-turns on the @samp{-fthread-jumps} and @samp{-fdelayed-branch} options,
-but specific machines may handle it differently.
-
-You can use the following flags in the rare cases when ``fine-tuning''
-of optimizations to be performed is desired.
-
-@table @code
-@item -fstrength-reduce
-Perform the optimizations of loop strength reduction and
-elimination of iteration variables.
-
-@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.
-
-@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 CSE encounters an @code{if} statement with an
-@code{else} clause, CSE will follow the jump when the condition
-tested is false.
-
-@item -fcse-skip-blocks
-This is similar to @samp{-fcse-follow-jumps}, but causes CSE to
-follow jumps which conditionally skip over blocks. When CSE
-encounters a simple @code{if} statement with no else clause,
-@samp{-fcse-skip-blocks} causes CSE to follow the jump around the
-body of the @code{if}.
-
-@item -frerun-cse-after-loop
-Re-run common subexpression elimination after loop optimizations has been
-performed.
-
-@item -fexpensive-optimizations
-Perform a number of minor optimizations that are relatively expensive.
-
-@item -fdelayed-branch
-If supported for the target machine, attempt to reorder instructions
-to exploit instruction slots available after delayed branch
-instructions.
-
-@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.
-
-@item -fschedule-insns2
-Similar to @samp{-fschedule-insns}, 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.
-
-@item -ffunction-sections
-Place each function into its own section in the output file if the
-target supports arbitrary sections. The function's name determines
-the section's name in the output file.
-
-Use this option on systems where the linker can perform optimizations
-to improve locality of reference in the instruction space. HPPA
-processors running HP-UX and Sparc processors running Solaris 2 have
-linkers with such optimizations. Other systems using the ELF object format
-as well as AIX may have these optimizations in the future.
-
-Only use this option when there are significant benefits from doing
-so. When you specify this option, the assembler and linker will
-create larger object and executable files and will also be slower.
-You will not be able to use @code{gprof} on all systems if you
-specify this option and you may have problems with debugging if
-you specify both this option and @samp{-g}.
-
-@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.
-
-This option is enabled by default on certain machines, usually those
-which have no call-preserved registers to use instead.
-
-@item -funroll-loops
-Perform the optimization of loop unrolling. This is only done for loops
-whose number of iterations can be determined at compile time or run time.
-@samp{-funroll-loop} implies both @samp{-fstrength-reduce} and
-@samp{-frerun-cse-after-loop}.
-
-@item -funroll-all-loops
-Perform the optimization of loop unrolling. This is done for all loops
-and usually makes programs run more slowly. @samp{-funroll-all-loops}
-implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}.
-
-@item -fno-peephole
-Disable any machine-specific peephole optimizations.
-@end table
-
-@node Preprocessor Options
-@section Options Controlling the Preprocessor
-@cindex preprocessor options
-@cindex options, preprocessor
-
-These options control the C preprocessor, which is run on each C source
-file before actual compilation.
-
-If you use the @samp{-E} option, nothing is done except preprocessing.
-Some of these options make sense only together with @samp{-E} because
-they cause the preprocessor output to be unsuitable for actual
-compilation.
-
-@table @code
-@item -include @var{file}
-Process @var{file} as input before processing the regular input file.
-In effect, the contents of @var{file} are compiled first. Any @samp{-D}
-and @samp{-U} options on the command line are always processed before
-@samp{-include @var{file}}, regardless of the order in which they are
-written. All the @samp{-include} and @samp{-imacros} options are
-processed in the order in which they are written.
-
-@item -imacros @var{file}
-Process @var{file} as input, discarding the resulting output, before
-processing the regular input file. Because the output generated from
-@var{file} is discarded, the only effect of @samp{-imacros @var{file}}
-is to make the macros defined in @var{file} available for use in the
-main input.
-
-Any @samp{-D} and @samp{-U} options on the command line are always
-processed before @samp{-imacros @var{file}}, regardless of the order in
-which they are written. All the @samp{-include} and @samp{-imacros}
-options are processed in the order in which they are written.
-
-@item -idirafter @var{dir}
-@cindex second include path
-Add the directory @var{dir} to the second include path. The directories
-on the second include path are searched when a header file is not found
-in any of the directories in the main include path (the one that
-@samp{-I} adds to).
-
-@item -iprefix @var{prefix}
-Specify @var{prefix} as the prefix for subsequent @samp{-iwithprefix}
-options.
-
-@item -iwithprefix @var{dir}
-Add a directory to the second include path. The directory's name is
-made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was
-specified previously with @samp{-iprefix}. If you have not specified a
-prefix yet, the directory containing the installed passes of the
-compiler is used as the default.
-
-@item -iwithprefixbefore @var{dir}
-Add a directory to the main include path. The directory's name is made
-by concatenating @var{prefix} and @var{dir}, as in the case of
-@samp{-iwithprefix}.
-
-@item -isystem @var{dir}
-Add a directory to the beginning of the second include path, marking it
-as a system directory, so that it gets the same special treatment as
-is applied to the standard system directories.
-
-@item -nostdinc
-Do not search the standard system directories for header files. Only
-the directories you have specified with @samp{-I} options (and the
-current directory, if appropriate) are searched. @xref{Directory
-Options}, for information on @samp{-I}.
-
-By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
-search path to only those directories you specify explicitly.
-
-@item -undef
-Do not predefine any nonstandard macros. (Including architecture flags).
-
-@item -E
-Run only the C preprocessor. Preprocess all the C source files
-specified and output the results to standard output or to the
-specified output file.
-
-@item -C
-Tell the preprocessor not to discard comments. Used with the
-@samp{-E} option.
-
-@item -P
-Tell the preprocessor not to generate @samp{#line} directives.
-Used with the @samp{-E} option.
-
-@cindex make
-@cindex dependencies, make
-@item -M
-Tell the preprocessor to output a rule suitable for @code{make}
-describing the dependencies of each object file. For each source file,
-the preprocessor outputs one @code{make}-rule whose target is the object
-file name for that source file and whose dependencies are all the
-@code{#include} header files it uses. This rule may be a single line or
-may be continued with @samp{\}-newline if it is long. The list of rules
-is printed on standard output instead of the preprocessed C program.
-
-@samp{-M} implies @samp{-E}.
-
-Another way to specify output of a @code{make} rule is by setting
-the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment
-Variables}).
-
-@item -MM
-Like @samp{-M} but the output mentions only the user header files
-included with @samp{#include "@var{file}"}. System header files
-included with @samp{#include <@var{file}>} are omitted.
-
-@item -MD
-Like @samp{-M} but the dependency information is written to a file made by
-replacing ".c" with ".d" at the end of the input file names.
-This is in addition to compiling the file as specified---@samp{-MD} does
-not inhibit ordinary compilation the way @samp{-M} does.
-
-In Mach, you can use the utility @code{md} to merge multiple dependency
-files into a single dependency file suitable for using with the @samp{make}
-command.
-
-@item -MMD
-Like @samp{-MD} except mention only user header files, not system
-header files.
-
-@item -MG
-Treat missing header files as generated files and assume they live in the
-same directory as the source file. If you specify @samp{-MG}, you
-must also specify either @samp{-M} or @samp{-MM}. @samp{-MG} is not
-supported with @samp{-MD} or @samp{-MMD}.
-
-@item -H
-Print the name of each header file used, in addition to other normal
-activities.
-
-@item -A@var{question}(@var{answer})
-Assert the answer @var{answer} for @var{question}, in case it is tested
-with a preprocessing conditional such as @samp{#if
-#@var{question}(@var{answer})}. @samp{-A-} disables the standard
-assertions that normally describe the target machine.
-
-@item -D@var{macro}
-Define macro @var{macro} with the string @samp{1} as its definition.
-
-@item -D@var{macro}=@var{defn}
-Define macro @var{macro} as @var{defn}. All instances of @samp{-D} on
-the command line are processed before any @samp{-U} options.
-
-@item -U@var{macro}
-Undefine macro @var{macro}. @samp{-U} options are evaluated after all
-@samp{-D} options, but before any @samp{-include} and @samp{-imacros}
-options.
-
-@item -dM
-Tell the preprocessor to output only a list of the macro definitions
-that are in effect at the end of preprocessing. Used with the @samp{-E}
-option.
-
-@item -dD
-Tell the preprocessing to pass all macro definitions into the output, in
-their proper sequence in the rest of the output.
-
-@item -dN
-Like @samp{-dD} except that the macro arguments and contents are omitted.
-Only @samp{#define @var{name}} is included in the output.
-
-@item -trigraphs
-Support ANSI C trigraphs. The @samp{-ansi} option also has this effect.
-
-@item -Wp,@var{option}
-Pass @var{option} as an option to the preprocessor. If @var{option}
-contains commas, it is split into multiple options at the commas.
-@end table
-
-@node Assembler Options
-@section Passing Options to the Assembler
-
-@c prevent bad page break with this line
-You can pass options to the assembler.
-
-@table @code
-@item -Wa,@var{option}
-Pass @var{option} as an option to the assembler. If @var{option}
-contains commas, it is split into multiple options at the commas.
-@end table
-
-@node Link Options
-@section Options for Linking
-@cindex link options
-@cindex options, 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.
-
-@table @code
-@cindex file names
-@item @var{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.
-
-@item -c
-@itemx -S
-@itemx -E
-If any of these options is used, then the linker is not run, and
-object file names should not be used as arguments. @xref{Overall
-Options}.
-
-@cindex Libraries
-@item -l@var{library}
-Search the library named @var{library} when linking.
-
-It makes a difference where in the command you write this option; the
-linker searches processes libraries and object files in the order they
-are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
-after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
-to functions in @samp{z}, those functions may not be loaded.
-
-The linker searches a standard list of directories for the library,
-which is actually a file named @file{lib@var{library}.a}. The linker
-then uses this file as if it had been specified precisely by name.
-
-The directories searched include several standard system directories
-plus any that you specify with @samp{-L}.
-
-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 @samp{-l} option and specifying a file name
-is that @samp{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
-and searches several directories.
-
-@item -lobjc
-You need this special case of the @samp{-l} option in order to
-link an Objective C program.
-
-@item -nostartfiles
-Do not use the standard system startup files when linking.
-The standard system libraries are used normally, unless @code{-nostdlib}
-or @code{-nodefaultlibs} is used.
-
-@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 @code{-nostartfiles}
-is used.
-
-@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.
-
-@cindex @code{-lgcc}, use with @code{-nostdlib}
-@cindex @code{-nostdlib} and unresolved references
-@cindex unresolved references and @code{-nostdlib}
-@cindex @code{-lgcc}, use with @code{-nodefaultlibs}
-@cindex @code{-nodefaultlibs} and unresolved references
-@cindex unresolved references and @code{-nodefaultlibs}
-One of the standard libraries bypassed by @samp{-nostdlib} and
-@samp{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
-that GNU CC uses to overcome shortcomings of particular machines, or special
-needs for some languages.
-@ifset INTERNALS
-(@xref{Interface,,Interfacing to GNU CC Output}, for more discussion of
-@file{libgcc.a}.)
-@end ifset
-@ifclear INTERNALS
-(@xref{Interface,,Interfacing to GNU CC Output,gcc.info,Porting GNU CC},
-for more discussion of @file{libgcc.a}.)
-@end ifclear
-In most cases, you need @file{libgcc.a} even when you want to avoid
-other standard libraries. In other words, when you specify @samp{-nostdlib}
-or @samp{-nodefaultlibs} you should usually specify @samp{-lgcc} as well.
-This ensures that you have no unresolved references to internal GNU CC
-library subroutines. (For example, @samp{__main}, used to ensure C++
-constructors will be called; @pxref{Collect2,,@code{collect2}}.)
-
-@item -s
-Remove all symbol table and relocation information from the executable.
-
-@item -static
-On systems that support dynamic linking, this prevents linking with the shared
-libraries. On other systems, this option has no effect.
-
-@item -shared
-Produce a shared object which can then be linked with other objects to
-form an executable. Not all systems support this option. You must
-also specify @samp{-fpic} or @samp{-fPIC} on some systems when
-you specify this option.
-
-@item -symbolic
-Bind references to global symbols when building a shared object. Warn
-about any unresolved references (unless overridden by the link editor
-option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
-this option.
-
-@item -Xlinker @var{option}
-Pass @var{option} as an option to the linker. You can use this to
-supply system-specific linker options which GNU CC does not know how to
-recognize.
-
-If you want to pass an option that takes an argument, you must use
-@samp{-Xlinker} twice, once for the option and once for the argument.
-For example, to pass @samp{-assert definitions}, you must write
-@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
-@samp{-Xlinker "-assert definitions"}, because this passes the entire
-string as a single argument, which is not what the linker expects.
-
-@item -Wl,@var{option}
-Pass @var{option} as an option to the linker. If @var{option} contains
-commas, it is split into multiple options at the commas.
-
-@item -u @var{symbol}
-Pretend the symbol @var{symbol} is undefined, to force linking of
-library modules to define it. You can use @samp{-u} multiple times with
-different symbols to force loading of additional library modules.
-@end table
-
-@node Directory Options
-@section Options for Directory Search
-@cindex directory options
-@cindex options, directory search
-@cindex search path
-
-These options specify directories to search for header files, for
-libraries and for parts of the compiler:
-
-@table @code
-@item -I@var{dir}
-Add the directory @var{directory} 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. If you use more
-than one @samp{-I} option, the directories are scanned in left-to-right
-order; the standard system directories come after.
-
-@item -I-
-Any directories you specify with @samp{-I} options before the @samp{-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 @samp{-I} options after
-the @samp{-I-}, these directories are searched for all @samp{#include}
-directives. (Ordinarily @emph{all} @samp{-I} directories are used
-this way.)
-
-In addition, the @samp{-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 @samp{-I-}. With @samp{-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.
-
-@samp{-I-} does not inhibit the use of the standard system directories
-for header files. Thus, @samp{-I-} and @samp{-nostdinc} are
-independent.
-
-@item -L@var{dir}
-Add directory @var{dir} to the list of directories to be searched
-for @samp{-l}.
-
-@item -B@var{prefix}
-This option specifies where to find the executables, libraries,
-include files, and data files of the compiler itself.
-
-The compiler driver program runs one or more of the subprograms
-@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
-@var{prefix} as a prefix for each program it tries to run, both with and
-without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
-
-For each subprogram to be run, the compiler driver first tries the
-@samp{-B} prefix, if any. If that name is not found, or if @samp{-B}
-was not specified, the driver tries two standard prefixes, which are
-@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. 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
-@samp{PATH} environment variable.
-
-@samp{-B} prefixes that effectively specify directory names also apply
-to libraries in the linker, because the compiler translates these
-options into @samp{-L} options for the linker. They also apply to
-includes files in the preprocessor, because the compiler translates these
-options into @samp{-isystem} options for the preprocessor. In this case,
-the compiler appends @samp{include} to the prefix.
-
-The run-time support file @file{libgcc.a} can also be searched for using
-the @samp{-B} 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.
-
-Another way to specify a prefix much like the @samp{-B} prefix is to use
-the environment variable @code{GCC_EXEC_PREFIX}. @xref{Environment
-Variables}.
-@end table
-
-@node Target Options
-@section Specifying Target Machine and Compiler Version
-@cindex target options
-@cindex cross compiling
-@cindex specifying machine version
-@cindex specifying compiler version and target machine
-@cindex compiler version, specifying
-@cindex target machine, specifying
-
-By default, GNU CC 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 GNU CC, for different target machines, can be
-installed side by side. Then you specify which one to use with the
-@samp{-b} option.
-
-In addition, older and newer versions of GNU CC can be installed side
-by side. One of them (probably the newest) will be the default, but
-you may sometimes wish to use another.
-
-@table @code
-@item -b @var{machine}
-The argument @var{machine} specifies the target machine for compilation.
-This is useful when you have installed GNU CC as a cross-compiler.
-
-The value to use for @var{machine} is the same as was specified as the
-machine type when configuring GNU CC as a cross-compiler. For
-example, if a cross-compiler was configured with @samp{configure
-i386v}, meaning to compile for an 80386 running System V, then you
-would specify @samp{-b i386v} to run that cross compiler.
-
-When you do not specify @samp{-b}, it normally means to compile for
-the same type of machine that you are using.
-
-@item -V @var{version}
-The argument @var{version} specifies which version of GNU CC to run.
-This is useful when multiple versions are installed. For example,
-@var{version} might be @samp{2.0}, meaning to run GNU CC version 2.0.
-
-The default version, when you do not specify @samp{-V}, is the last
-version of GNU CC that you installed.
-@end table
-
-The @samp{-b} and @samp{-V} options actually work by controlling part of
-the file name used for the executable files and libraries used for
-compilation. A given version of GNU CC, for a given target machine, is
-normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.@refill
-
-Thus, sites can customize the effect of @samp{-b} or @samp{-V} either by
-changing the names of these directories or adding alternate names (or
-symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the
-file @file{80386} is a link to the file @file{i386v}, then @samp{-b
-80386} becomes an alias for @samp{-b i386v}.
-
-In one respect, the @samp{-b} or @samp{-V} do not completely change
-to a different compiler: the top-level driver program @code{gcc}
-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 and version.
-
-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 compiler version.
-
-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.
-
-For example, if the driver for version 2.0 is installed as @code{ogcc}
-and that for version 2.1 is installed as @code{gcc}, then the command
-@code{gcc} will use version 2.1 by default, while @code{ogcc} will use
-2.0 by default. However, you can choose either version with either
-command with the @samp{-V} option.
-
-@node Submodel Options
-@section Hardware Models and Configurations
-@cindex submodel options
-@cindex specifying hardware config
-@cindex hardware models and configurations, specifying
-@cindex machine dependent options
-
-Earlier we discussed the standard option @samp{-b} which chooses among
-different installed compilers for completely different target
-machines, such as Vax vs. 68000 vs. 80386.
-
-In addition, each of these target machine types can have its own
-special options, starting with @samp{-m}, 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.
-
-Some configurations of the compiler also support additional special
-options, usually for compatibility with other compilers on the same
-platform.
-
-@ifset INTERNALS
-These options are defined by the macro @code{TARGET_SWITCHES} in the
-machine description. The default for the options is also defined by
-that macro, which enables you to change the defaults.
-@end ifset
-
-@menu
-* M680x0 Options::
-* VAX Options::
-* SPARC Options::
-* Convex Options::
-* AMD29K Options::
-* ARM Options::
-* M88K Options::
-* RS/6000 and PowerPC Options::
-* RT Options::
-* MIPS Options::
-* i386 Options::
-* HPPA Options::
-* Intel 960 Options::
-* DEC Alpha Options::
-* Clipper Options::
-* H8/300 Options::
-* SH Options::
-* System V Options::
-@end menu
-
-@node M680x0 Options
-@subsection M680x0 Options
-@cindex M680x0 options
-
-These are the @samp{-m} options defined for the 68000 series. The default
-values for these options depends on which style of 68000 was selected when
-the compiler was configured; the defaults for the most common choices are
-given below.
-
-@table @code
-@item -m68000
-@itemx -mc68000
-Generate output for a 68000. This is the default
-when the compiler is configured for 68000-based systems.
-
-@item -m68020
-@itemx -mc68020
-Generate output for a 68020. This is the default
-when the compiler is configured for 68020-based systems.
-
-@item -m68881
-Generate output containing 68881 instructions for floating point.
-This is the default for most 68020 systems unless @samp{-nfp} was
-specified when the compiler was configured.
-
-@item -m68030
-Generate output for a 68030. This is the default when the compiler is
-configured for 68030-based systems.
-
-@item -m68040
-Generate output for a 68040. This is the default when the compiler is
-configured for 68040-based systems.
-
-This option inhibits the use of 68881/68882 instructions that have to be
-emulated by software on the 68040. If your 68040 does not have code to
-emulate those instructions, use @samp{-m68040}.
-
-@item -m68060
-Generate output for a 68060. This is the default when the compiler is
-configured for 68060-based systems.
-
-This option inhibits the use of 68020 and 68881/68882 instructions that
-have to be emulated by software on the 68060. If your 68060 does not
-have code to emulate those instructions, use @samp{-m68060}.
-
-@item -m5200
-Generate output for a 520X "coldfire" family cpu. This is the default
-when the compiler is configured for 520X-based systems.
-
-
-@item -m68020-40
-Generate output for a 68040, without using any of the new instructions.
-This results in code which can run relatively efficiently on either a
-68020/68881 or a 68030 or a 68040. The generated code does use the
-68881 instructions that are emulated on the 68040.
-
-@item -mfpa
-Generate output containing Sun FPA instructions for floating point.
-
-@item -msoft-float
-Generate output containing library calls for floating point.
-@strong{Warning:} the requisite libraries are not available for all m68k
-targets. 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. The embedded targets @samp{m68k-*-aout} and
-@samp{m68k-*-coff} do provide software floating point support.
-
-@item -mshort
-Consider type @code{int} to be 16 bits wide, like @code{short int}.
-
-@item -mnobitfield
-Do not use the bit-field instructions. The @samp{-m68000} option
-implies @w{@samp{-mnobitfield}}.
-
-@item -mbitfield
-Do use the bit-field instructions. The @samp{-m68020} option implies
-@samp{-mbitfield}. This is the default if you use a configuration
-designed for a 68020.
-
-@item -mrtd
-Use a different function-calling convention, in which functions
-that take a fixed number of arguments return with the @code{rtd}
-instruction, which pops their arguments while returning. This
-saves one instruction in the caller since there is no need to pop
-the arguments there.
-
-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.
-
-Also, you must provide function prototypes for all functions that
-take variable numbers of arguments (including @code{printf});
-otherwise incorrect code will be generated for calls to those
-functions.
-
-In addition, seriously incorrect code will result if you call a
-function with too many arguments. (Normally, extra arguments are
-harmlessly ignored.)
-
-The @code{rtd} instruction is supported by the 68010, 68020, 68030,
-68040, and 68060 processors, but not by the 68000 or 5200.
-@end table
-
-@node VAX Options
-@subsection VAX Options
-@cindex VAX options
-
-These @samp{-m} options are defined for the Vax:
-
-@table @code
-@item -munix
-Do not output certain jump instructions (@code{aobleq} and so on)
-that the Unix assembler for the Vax cannot handle across long
-ranges.
-
-@item -mgnu
-Do output those jump instructions, on the assumption that you
-will assemble with the GNU assembler.
-
-@item -mg
-Output code for g-format floating point numbers instead of d-format.
-@end table
-
-@node SPARC Options
-@subsection SPARC Options
-@cindex SPARC options
-
-These @samp{-m} switches are supported on the SPARC:
-
-@table @code
-@item -mno-app-regs
-@itemx -mapp-regs
-Specify @samp{-mapp-regs} to generate output using the global registers
-2 through 4, which the SPARC SVR4 ABI reserves for applications. This
-is the default.
-
-To be fully SVR4 ABI compliant at the cost of some performance loss,
-specify @samp{-mno-app-regs}. You should compile libraries and system
-software with this option.
-
-@item -mfpu
-@itemx -mhard-float
-Generate output containing floating point instructions. This is the
-default.
-
-@item -mno-fpu
-@itemx -msoft-float
-Generate output containing library calls for floating point.
-@strong{Warning:} the requisite libraries are not available for all SPARC
-targets. Normally the facilities of the machine's usual C compiler are
-used, but this cannot be done directly in cross-compilation. You must make
-your own arrangements to provide suitable library functions for
-cross-compilation. The embedded targets @samp{sparc-*-aout} and
-@samp{sparclite-*-*} do provide software floating point support.
-
-@samp{-msoft-float} changes the calling convention in the output file;
-therefore, it is only useful if you compile @emph{all} of a program with
-this option. In particular, you need to compile @file{libgcc.a}, the
-library that comes with GNU CC, with @samp{-msoft-float} in order for
-this to work.
-
-@item -mhard-quad-float
-Generate output containing quad-word (long double) floating point
-instructions.
-
-@item -msoft-quad-float
-Generate output containing library calls for quad-word (long double)
-floating point instructions. The functions called are those specified
-in the SPARC ABI. This is the default.
-
-As of this writing, there are no sparc implementations that have hardware
-support for the quad-word floating point instructions. They all invoke
-a trap handler for one of these instructions, and then the trap handler
-emulates the effect of the instruction. Because of the trap handler overhead,
-this is much slower than calling the ABI library routines. Thus the
-@samp{-msoft-quad-float} option is the default.
-
-@item -mno-epilogue
-@itemx -mepilogue
-With @samp{-mepilogue} (the default), the compiler always emits code for
-function exit at the end of each function. Any function exit in
-the middle of the function (such as a return statement in C) will
-generate a jump to the exit code at the end of the function.
-
-With @samp{-mno-epilogue}, the compiler tries to emit exit code inline
-at every function exit.
-
-@item -mno-flat
-@itemx -mflat
-With @samp{-mflat}, the compiler does not generate save/restore instructions
-and will use a "flat" or single register window calling convention.
-This model uses %i7 as the frame pointer and is compatible with the normal
-register window model. Code from either may be intermixed.
-The local registers and the input registers (0-5) are still treated as
-"call saved" registers and will be saved on the stack as necessary.
-
-With @samp{-mno-flat} (the default), the compiler emits save/restore
-instructions (except for leaf functions) and is the normal mode of operation.
-
-@item -mno-unaligned-doubles
-@itemx -munaligned-doubles
-Assume that doubles have 8 byte alignment. This is the default.
-
-With @samp{-munaligned-doubles}, GNU CC assumes that doubles have 8 byte
-alignment only if they are contained in another type, or if they have an
-absolute address. Otherwise, it assumes they have 4 byte alignment.
-Specifying this option avoids some rare compatibility problems with code
-generated by other compilers. It is not the default because it results
-in a performance loss, especially for floating point code.
-
-@item -mv8
-@itemx -msparclite
-These two options select variations on the SPARC architecture.
-
-By default (unless specifically configured for the Fujitsu SPARClite),
-GCC generates code for the v7 variant of the SPARC architecture.
-
-@samp{-mv8} will give you SPARC v8 code. The only difference from v7
-code is that the compiler emits the integer multiply and integer
-divide instructions which exist in SPARC v8 but not in SPARC v7.
-
-@samp{-msparclite} will give you SPARClite code. This adds the integer
-multiply, integer divide step and scan (@code{ffs}) instructions which
-exist in SPARClite but not in SPARC v7.
-
-These options are deprecated and will be deleted in GNU CC 2.9.
-They have been replaced with @samp{-mcpu=xxx}.
-
-@item -mcypress
-@itemx -msupersparc
-These two options select the processor for which the code is optimised.
-
-With @samp{-mcypress} (the default), the compiler optimizes code for the
-Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series.
-This is also appropriate for the older SparcStation 1, 2, IPX etc.
-
-With @samp{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as
-used in the SparcStation 10, 1000 and 2000 series. This flag also enables use
-of the full SPARC v8 instruction set.
-
-These options are deprecated and will be deleted in GNU CC 2.9.
-They have been replaced with @samp{-mcpu=xxx}.
-
-@item -mcpu=@var{cpu_type}
-Set architecture type and instruction scheduling parameters for machine
-type @var{cpu_type}. Supported values for @var{cpu_type} are
-@samp{common}, @samp{cypress}, @samp{v8}, @samp{supersparc},
-@samp{sparclite}, @samp{f930}, @samp{f934},
-@samp{sparclet}, @samp{90c701}, @samp{v8plus}, @samp{v9},
-and @samp{ultrasparc}. Specifying @samp{v9} is only supported on true
-64 bit targets.
-
-@item -mtune=@var{cpu_type}
-Set the instruction scheduling parameters for machine type
-@var{cpu_type}, but do not set the architecture type as the option
-@samp{-mcpu=}@var{cpu_type} would. The same values for
-@samp{-mcpu=}@var{cpu_type} are used for @samp{-tune=}@var{cpu_type}.
-
-@end table
-
-These @samp{-m} switches are supported in addition to the above
-on the SPARCLET processor.
-
-@table @code
-@item -mlittle-endian
-Generate code for a processor running in little-endian mode.
-
-@item -mlive-g0
-Treat register @code{%g0} as a normal register.
-GCC will continue to clobber it as necessary but will not assume
-it always reads as 0.
-
-@item -mbroken-saverestore
-Generate code that does not use non-trivial forms of the @code{save} and
-@code{restore} instructions. Early versions of the SPARCLET processor do
-not correctly handle @code{save} and @code{restore} instructions used with
-arguments. They correctly handle them used without arguments. A @code{save}
-instruction used without arguments increments the current window pointer
-but does not allocate a new stack frame. It is assumed that the window
-overflow trap handler will properly handle this case as will interrupt
-handlers.
-@end table
-
-These @samp{-m} switches are supported in addition to the above
-on SPARC V9 processors in 64 bit environments.
-
-@table @code
-@item -mlittle-endian
-Generate code for a processor running in little-endian mode.
-
-@item -mmedlow
-Generate code for the Medium/Low code model: assume a 32 bit address space.
-Programs are statically linked, PIC is not supported. Pointers are still
-64 bits.
-
-It is very likely that a future version of GCC will rename this option.
-
-@item -mmedany
-Generate code for the Medium/Anywhere code model: assume a 32 bit text
-and a 32 bit data segment, both starting anywhere (determined at link time).
-Programs are statically linked, PIC is not supported. Pointers are still
-64 bits.
-
-It is very likely that a future version of GCC will rename this option.
-
-@item -mfullany
-Generate code for the Full/Anywhere code model: assume a full 64 bit
-address space. PIC is not supported.
-
-It is very likely that a future version of GCC will rename this option.
-
-@item -mint64
-Types long and int are 64 bits.
-
-@item -mlong32
-Types long and int are 32 bits.
-
-@item -mlong64
-@itemx -mint32
-Type long is 64 bits, and type int is 32 bits.
-
-@item -mstack-bias
-@itemx -mno-stack-bias
-With @samp{-mstack-bias}, GNU CC assumes that the stack pointer, and
-frame pointer if present, are offset by -2047 which must be added back
-when making stack frame references.
-Otherwise, assume no such offset is present.
-@end table
-
-@node Convex Options
-@subsection Convex Options
-@cindex Convex options
-
-These @samp{-m} options are defined for Convex:
-
-@table @code
-@item -mc1
-Generate output for C1. The code will run on any Convex machine.
-The preprocessor symbol @code{__convex__c1__} is defined.
-
-@item -mc2
-Generate output for C2. Uses instructions not available on C1.
-Scheduling and other optimizations are chosen for max performance on C2.
-The preprocessor symbol @code{__convex_c2__} is defined.
-
-@item -mc32
-Generate output for C32xx. Uses instructions not available on C1.
-Scheduling and other optimizations are chosen for max performance on C32.
-The preprocessor symbol @code{__convex_c32__} is defined.
-
-@item -mc34
-Generate output for C34xx. Uses instructions not available on C1.
-Scheduling and other optimizations are chosen for max performance on C34.
-The preprocessor symbol @code{__convex_c34__} is defined.
-
-@item -mc38
-Generate output for C38xx. Uses instructions not available on C1.
-Scheduling and other optimizations are chosen for max performance on C38.
-The preprocessor symbol @code{__convex_c38__} is defined.
-
-@item -margcount
-Generate code which puts an argument count in the word preceding each
-argument list. This is compatible with regular CC, and a few programs
-may need the argument count word. GDB and other source-level debuggers
-do not need it; this info is in the symbol table.
-
-@item -mnoargcount
-Omit the argument count word. This is the default.
-
-@item -mvolatile-cache
-Allow volatile references to be cached. This is the default.
-
-@item -mvolatile-nocache
-Volatile references bypass the data cache, going all the way to memory.
-This is only needed for multi-processor code that does not use standard
-synchronization instructions. Making non-volatile references to volatile
-locations will not necessarily work.
-
-@item -mlong32
-Type long is 32 bits, the same as type int. This is the default.
-
-@item -mlong64
-Type long is 64 bits, the same as type long long. This option is useless,
-because no library support exists for it.
-@end table
-
-@node AMD29K Options
-@subsection AMD29K Options
-@cindex AMD29K options
-
-These @samp{-m} options are defined for the AMD Am29000:
-
-@table @code
-@item -mdw
-@kindex -mdw
-@cindex DW bit (29k)
-Generate code that assumes the @code{DW} bit is set, i.e., that byte and
-halfword operations are directly supported by the hardware. This is the
-default.
-
-@item -mndw
-@kindex -mndw
-Generate code that assumes the @code{DW} bit is not set.
-
-@item -mbw
-@kindex -mbw
-@cindex byte writes (29k)
-Generate code that assumes the system supports byte and halfword write
-operations. This is the default.
-
-@item -mnbw
-@kindex -mnbw
-Generate code that assumes the systems does not support byte and
-halfword write operations. @samp{-mnbw} implies @samp{-mndw}.
-
-@item -msmall
-@kindex -msmall
-@cindex memory model (29k)
-Use a small memory model that assumes that all function addresses are
-either within a single 256 KB segment or at an absolute address of less
-than 256k. This allows the @code{call} instruction to be used instead
-of a @code{const}, @code{consth}, @code{calli} sequence.
-
-@item -mnormal
-@kindex -mnormal
-Use the normal memory model: Generate @code{call} instructions only when
-calling functions in the same file and @code{calli} instructions
-otherwise. This works if each file occupies less than 256 KB but allows
-the entire executable to be larger than 256 KB. This is the default.
-
-@item -mlarge
-Always use @code{calli} instructions. Specify this option if you expect
-a single file to compile into more than 256 KB of code.
-
-@item -m29050
-@kindex -m29050
-@cindex processor selection (29k)
-Generate code for the Am29050.
-
-@item -m29000
-@kindex -m29000
-Generate code for the Am29000. This is the default.
-
-@item -mkernel-registers
-@kindex -mkernel-registers
-@cindex kernel and user registers (29k)
-Generate references to registers @code{gr64-gr95} instead of to
-registers @code{gr96-gr127}. This option can be used when compiling
-kernel code that wants a set of global registers disjoint from that used
-by user-mode code.
-
-Note that when this option is used, register names in @samp{-f} flags
-must use the normal, user-mode, names.
-
-@item -muser-registers
-@kindex -muser-registers
-Use the normal set of global registers, @code{gr96-gr127}. This is the
-default.
-
-@item -mstack-check
-@itemx -mno-stack-check
-@kindex -mstack-check
-@cindex stack checks (29k)
-Insert (or do not insert) a call to @code{__msp_check} after each stack
-adjustment. This is often used for kernel code.
-
-@item -mstorem-bug
-@itemx -mno-storem-bug
-@kindex -mstorem-bug
-@cindex storem bug (29k)
-@samp{-mstorem-bug} handles 29k processors which cannot handle the
-separation of a mtsrim insn and a storem instruction (most 29000 chips
-to date, but not the 29050).
-
-@item -mno-reuse-arg-regs
-@itemx -mreuse-arg-regs
-@kindex -mreuse-arg-regs
-@samp{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
-registers for copying out arguments. This helps detect calling a function
-with fewer arguments than it was declared with.
-
-@item -msoft-float
-@kindex -msoft-float
-Generate output containing library calls for floating point.
-@strong{Warning:} the requisite libraries are not part of GNU CC.
-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.
-@end table
-
-@node ARM Options
-@subsection ARM Options
-@cindex ARM options
-
-These @samp{-m} options are defined for Advanced RISC Machines (ARM)
-architectures:
-
-@table @code
-@item -mapcs-frame
-@kindex -mapcs-frame
-Generate a stack frame that is compliant with the ARM Procedure Call
-Standard for all functions, even if this is not strictly necessary for
-correct execution of the code.
-
-@item -mapcs-26
-@kindex -mapcs-26
-Generate code for a processor running with a 26-bit program counter,
-and conforming to the function calling standards for the APCS 26-bit
-option. This option replaces the @samp{-m2} and @samp{-m3} options
-of previous releases of the compiler.
-
-@item -mapcs-32
-@kindex -mapcs-32
-Generate code for a processor running with a 32-bit program counter,
-and conforming to the function calling standards for the APCS 32-bit
-option. This option replaces the @samp{-m6} option of previous releases
-of the compiler.
-
-@item -mhard-float
-Generate output containing floating point instructions. This is the
-default.
-
-@item -msoft-float
-Generate output containing library calls for floating point.
-@strong{Warning:} the requisite libraries are not available for all ARM
-targets. Normally the facilities of the machine's usual C compiler are
-used, but this cannot be done directly in cross-compilation. You must make
-your own arrangements to provide suitable library functions for
-cross-compilation.
-
-@samp{-msoft-float} changes the calling convention in the output file;
-therefore, it is only useful if you compile @emph{all} of a program with
-this option. In particular, you need to compile @file{libgcc.a}, the
-library that comes with GNU CC, with @samp{-msoft-float} in order for
-this to work.
-
-@item -mlittle-endian
-Generate code for a processor running in little-endian mode. This is
-the default for all standard configurations.
-
-@item -mbig-endian
-Generate code for a processor running in big-endian mode; the default is
-to compile code for a little-endian processor.
-
-@item -mwords-little-endian
-This option only applies when generating code for big-endian processors.
-Generate code for a little-endian word order but a big-endian byte
-order. That is, a byte order of the form @samp{32107654}. Note: this
-option should only be used if you require compatibility with code for
-big-endian ARM processors generated by versions of the compiler prior to
-2.8.
-
-@item -mshort-load-bytes
-@kindex -mshort-load-bytes
-Do not try to load half-words (eg @samp{short}s) by loading a word from
-an unaligned address. For some targets the MMU is configured to trap
-unaligned loads; use this option to generate code that is safe in these
-environments.
-
-@item -mno-short-load-bytes
-@kindex -mno-short-load-bytes
-Use unaligned word loads to load half-words (eg @samp{short}s). This
-option produces more efficient code, but the MMU is sometimes configured
-to trap these instructions.
-
-@item -mbsd
-@kindex -mbsd
-This option only applies to RISC iX. Emulate the native BSD-mode
-compiler. This is the default if @samp{-ansi} is not specified.
-
-@item -mxopen
-@kindex -mxopen
-This option only applies to RISC iX. Emulate the native X/Open-mode
-compiler.
-
-@item -mno-symrename
-@kindex -mno-symrename
-This option only applies to RISC iX. Do not run the assembler
-post-processor, @samp{symrename}, after code has been assembled.
-Normally it is necessary to modify some of the standard symbols in
-preparation for linking with the RISC iX C library; this option
-suppresses this pass. The post-processor is never run when the
-compiler is built for cross-compilation.
-@end table
-
-@node M88K Options
-@subsection M88K Options
-@cindex M88k options
-
-These @samp{-m} options are defined for Motorola 88k architectures:
-
-@table @code
-@item -m88000
-@kindex -m88000
-Generate code that works well on both the m88100 and the
-m88110.
-
-@item -m88100
-@kindex -m88100
-Generate code that works best for the m88100, but that also
-runs on the m88110.
-
-@item -m88110
-@kindex -m88110
-Generate code that works best for the m88110, and may not run
-on the m88100.
-
-@item -mbig-pic
-@kindex -mbig-pic
-Obsolete option to be removed from the next revision.
-Use @samp{-fPIC}.
-
-@item -midentify-revision
-@kindex -midentify-revision
-@kindex ident
-@cindex identifying source, compiler (88k)
-Include an @code{ident} directive in the assembler output recording the
-source file name, compiler name and version, timestamp, and compilation
-flags used.
-
-@item -mno-underscores
-@kindex -mno-underscores
-@cindex underscores, avoiding (88k)
-In assembler output, emit symbol names without adding an underscore
-character at the beginning of each name. The default is to use an
-underscore as prefix on each name.
-
-@item -mocs-debug-info
-@itemx -mno-ocs-debug-info
-@kindex -mocs-debug-info
-@kindex -mno-ocs-debug-info
-@cindex OCS (88k)
-@cindex debugging, 88k OCS
-Include (or omit) additional debugging information (about registers used
-in each stack frame) as specified in the 88open Object Compatibility
-Standard, ``OCS''. This extra information allows debugging of code that
-has had the frame pointer eliminated. The default for DG/UX, SVr4, and
-Delta 88 SVr3.2 is to include this information; other 88k configurations
-omit this information by default.
-
-@item -mocs-frame-position
-@kindex -mocs-frame-position
-@cindex register positions in frame (88k)
-When emitting COFF debugging information for automatic variables and
-parameters stored on the stack, use the offset from the canonical frame
-address, which is the stack pointer (register 31) on entry to the
-function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
-@samp{-mocs-frame-position}; other 88k configurations have the default
-@samp{-mno-ocs-frame-position}.
-
-@item -mno-ocs-frame-position
-@kindex -mno-ocs-frame-position
-@cindex register positions in frame (88k)
-When emitting COFF debugging information for automatic variables and
-parameters stored on the stack, use the offset from the frame pointer
-register (register 30). When this option is in effect, the frame
-pointer is not eliminated when debugging information is selected by the
--g switch.
-
-@item -moptimize-arg-area
-@itemx -mno-optimize-arg-area
-@kindex -moptimize-arg-area
-@kindex -mno-optimize-arg-area
-@cindex arguments in frame (88k)
-Control how function arguments are stored in stack frames.
-@samp{-moptimize-arg-area} saves space by optimizing them, but this
-conflicts with the 88open specifications. The opposite alternative,
-@samp{-mno-optimize-arg-area}, agrees with 88open standards. By default
-GNU CC does not optimize the argument area.
-
-@item -mshort-data-@var{num}
-@kindex -mshort-data-@var{num}
-@cindex smaller data references (88k)
-@cindex r0-relative references (88k)
-Generate smaller data references by making them relative to @code{r0},
-which allows loading a value using a single instruction (rather than the
-usual two). You control which data references are affected by
-specifying @var{num} with this option. For example, if you specify
-@samp{-mshort-data-512}, then the data references affected are those
-involving displacements of less than 512 bytes.
-@samp{-mshort-data-@var{num}} is not effective for @var{num} greater
-than 64k.
-
-@item -mserialize-volatile
-@kindex -mserialize-volatile
-@itemx -mno-serialize-volatile
-@kindex -mno-serialize-volatile
-@cindex sequential consistency on 88k
-Do, or don't, generate code to guarantee sequential consistency
-of volatile memory references. By default, consistency is
-guaranteed.
-
-The order of memory references made by the MC88110 processor does
-not always match the order of the instructions requesting those
-references. In particular, a load instruction may execute before
-a preceding store instruction. Such reordering violates
-sequential consistency of volatile memory references, when there
-are multiple processors. When consistency must be guaranteed,
-GNU C generates special instructions, as needed, to force
-execution in the proper order.
-
-The MC88100 processor does not reorder memory references and so
-always provides sequential consistency. However, by default, GNU
-C generates the special instructions to guarantee consistency
-even when you use @samp{-m88100}, so that the code may be run on an
-MC88110 processor. If you intend to run your code only on the
-MC88100 processor, you may use @samp{-mno-serialize-volatile}.
-
-The extra code generated to guarantee consistency may affect the
-performance of your application. If you know that you can safely
-forgo this guarantee, you may use @samp{-mno-serialize-volatile}.
-
-@item -msvr4
-@itemx -msvr3
-@kindex -msvr4
-@kindex -msvr3
-@cindex assembler syntax, 88k
-@cindex SVr4
-Turn on (@samp{-msvr4}) or off (@samp{-msvr3}) compiler extensions
-related to System V release 4 (SVr4). This controls the following:
-
-@enumerate
-@item
-Which variant of the assembler syntax to emit.
-@item
-@samp{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
-that is used on System V release 4.
-@item
-@samp{-msvr4} makes GNU CC issue additional declaration directives used in
-SVr4.
-@end enumerate
-
-@samp{-msvr4} is the default for the m88k-motorola-sysv4 and
-m88k-dg-dgux m88k configurations. @samp{-msvr3} is the default for all
-other m88k configurations.
-
-@item -mversion-03.00
-@kindex -mversion-03.00
-This option is obsolete, and is ignored.
-@c ??? which asm syntax better for GAS? option there too?
-
-@item -mno-check-zero-division
-@itemx -mcheck-zero-division
-@kindex -mno-check-zero-division
-@kindex -mcheck-zero-division
-@cindex zero division on 88k
-Do, or don't, generate code to guarantee that integer division by
-zero will be detected. By default, detection is guaranteed.
-
-Some models of the MC88100 processor fail to trap upon integer
-division by zero under certain conditions. By default, when
-compiling code that might be run on such a processor, GNU C
-generates code that explicitly checks for zero-valued divisors
-and traps with exception number 503 when one is detected. Use of
-mno-check-zero-division suppresses such checking for code
-generated to run on an MC88100 processor.
-
-GNU C assumes that the MC88110 processor correctly detects all
-instances of integer division by zero. When @samp{-m88110} is
-specified, both @samp{-mcheck-zero-division} and
-@samp{-mno-check-zero-division} are ignored, and no explicit checks for
-zero-valued divisors are generated.
-
-@item -muse-div-instruction
-@kindex -muse-div-instruction
-@cindex divide instruction, 88k
-Use the div instruction for signed integer division on the
-MC88100 processor. By default, the div instruction is not used.
-
-On the MC88100 processor the signed integer division instruction
-div) traps to the operating system on a negative operand. The
-operating system transparently completes the operation, but at a
-large cost in execution time. By default, when compiling code
-that might be run on an MC88100 processor, GNU C emulates signed
-integer division using the unsigned integer division instruction
-divu), thereby avoiding the large penalty of a trap to the
-operating system. Such emulation has its own, smaller, execution
-cost in both time and space. To the extent that your code's
-important signed integer division operations are performed on two
-nonnegative operands, it may be desirable to use the div
-instruction directly.
-
-On the MC88110 processor the div instruction (also known as the
-divs instruction) processes negative operands without trapping to
-the operating system. When @samp{-m88110} is specified,
-@samp{-muse-div-instruction} is ignored, and the div instruction is used
-for signed integer division.
-
-Note that the result of dividing INT_MIN by -1 is undefined. In
-particular, the behavior of such a division with and without
-@samp{-muse-div-instruction} may differ.
-
-@item -mtrap-large-shift
-@itemx -mhandle-large-shift
-@kindex -mtrap-large-shift
-@kindex -mhandle-large-shift
-@cindex bit shift overflow (88k)
-@cindex large bit shifts (88k)
-Include code to detect bit-shifts of more than 31 bits; respectively,
-trap such shifts or emit code to handle them properly. By default GNU CC
-makes no special provision for large bit shifts.
-
-@item -mwarn-passed-structs
-@kindex -mwarn-passed-structs
-@cindex structure passing (88k)
-Warn when a function passes a struct as an argument or result.
-Structure-passing conventions have changed during the evolution of the C
-language, and are often the source of portability problems. By default,
-GNU CC issues no such warning.
-@end table
-
-@node RS/6000 and PowerPC Options
-@subsection IBM RS/6000 and PowerPC Options
-@cindex RS/6000 and PowerPC Options
-@cindex IBM RS/6000 and PowerPC Options
-
-These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
-@table @code
-@item -mpower
-@itemx -mno-power
-@itemx -mpower2
-@itemx -mno-power2
-@itemx -mpowerpc
-@itemx -mno-powerpc
-@itemx -mpowerpc-gpopt
-@itemx -mno-powerpc-gpopt
-@itemx -mpowerpc-gfxopt
-@itemx -mno-powerpc-gfxopt
-@kindex -mpower
-@kindex -mpower2
-@kindex -mpowerpc
-@kindex -mpowerpc-gpopt
-@kindex -mpowerpc-gfxopt
-GNU CC supports two related instruction set architectures for the
-RS/6000 and PowerPC. The @dfn{POWER} instruction set are those
-instructions supported by the @samp{rios} chip set used in the original
-RS/6000 systems and the @dfn{PowerPC} instruction set is the
-architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
-the IBM 40x microprocessors. The PowerPC architecture defines 64-bit
-instructions, but they are not supported by any current processors.
-
-Neither architecture is a subset of the other. However there is a
-large common subset of instructions supported by both. An MQ
-register is included in processors supporting the POWER architecture.
-
-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 GNU CC. Specifying the
-@samp{-mcpu=@var{cpu_type}} overrides the specification of these
-options. We recommend you use the @samp{-mcpu=@var{cpu_type}} option
-rather than the options listed above.
-
-The @samp{-mpower} option allows GNU CC to generate instructions that
-are found only in the POWER architecture and to use the MQ register.
-Specifying @samp{-mpower2} implies @samp{-power} and also allows GNU CC
-to generate instructions that are present in the POWER2 architecture but
-not the original POWER architecture.
-
-The @samp{-mpowerpc} option allows GNU CC to generate instructions that
-are found only in the 32-bit subset of the PowerPC architecture.
-Specifying @samp{-mpowerpc-gpopt} implies @samp{-mpowerpc} and also allows
-GNU CC to use the optional PowerPC architecture instructions in the
-General Purpose group, including floating-point square root. Specifying
-@samp{-mpowerpc-gfxopt} implies @samp{-mpowerpc} and also allows GNU CC to
-use the optional PowerPC architecture instructions in the Graphics
-group, including floating-point select.
-
-If you specify both @samp{-mno-power} and @samp{-mno-powerpc}, GNU CC
-will use only the instructions in the common subset of both
-architectures plus some special AIX common-mode calls, and will not use
-the MQ register. Specifying both @samp{-mpower} and @samp{-mpowerpc}
-permits GNU CC to use any instruction from either architecture and to
-allow use of the MQ register; specify this for the Motorola MPC601.
-
-@item -mnew-mnemonics
-@itemx -mold-mnemonics
-@kindex -mnew-mnemonics
-@kindex -mold-mnemonics
-Select which mnemonics to use in the generated assembler code.
-@samp{-mnew-mnemonics} requests output that uses the assembler mnemonics
-defined for the PowerPC architecture, while @samp{-mold-mnemonics}
-requests the assembler mnemonics defined for the POWER architecture.
-Instructions defined in only one architecture have only one mnemonic;
-GNU CC uses that mnemonic irrespective of which of these options is
-specified.
-
-PowerPC assemblers support both the old and new mnemonics, as will later
-POWER assemblers. Current POWER assemblers only support the old
-mnemonics. Specify @samp{-mnew-mnemonics} if you have an assembler that
-supports them, otherwise specify @samp{-mold-mnemonics}.
-
-The default value of these options depends on how GNU CC was configured.
-Specifying @samp{-mcpu=@var{cpu_type}} sometimes overrides the value of
-these option. Unless you are building a cross-compiler, you should
-normally not specify either @samp{-mnew-mnemonics} or
-@samp{-mold-mnemonics}, but should instead accept the default.
-
-@item -mcpu=@var{cpu_type}
-Set architecture type, register usage, choice of mnemonics, and
-instruction scheduling parameters for machine type @var{cpu_type}.
-Supported values for @var{cpu_type} are @samp{rs6000}, @samp{rios1},
-@samp{rios2}, @samp{rsc}, @samp{601}, @samp{602}, @samp{603},
-@samp{603e}, @samp{604}, @samp{620}, @samp{power}, @samp{power2},
-@samp{powerpc}, @samp{403}, @samp{505}, @samp{821}, and @samp{860} and
-@samp{common}. @samp{-mcpu=power}, @samp{-mcpu=power2}, and
-@samp{-mcpu=powerpc} specify generic POWER, POWER2 and pure PowerPC
-(i.e., not MPC601) architecture machine types, with an appropriate,
-generic processor model assumed for scheduling purposes.@refill
-
-@c overfull hbox here --bob 22 jul96
-@c original text between ignore ... end ignore
-@ignore
-Specifying any of the @samp{-mcpu=rios1}, @samp{-mcpu=rios2}, @samp{-mcpu=rsc},
-@samp{-mcpu=power}, or @samp{-mcpu=power2} options enables the @samp{-mpower}
-option and disables the @samp{-mpowerpc} option; @samp{-mcpu=601}
-enables both the @samp{-mpower} and @samp{-mpowerpc} options;
-all of @samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e}, @samp{-mcpu=604},
-@samp{-mcpu=620}, @samp{-mcpu=403}, @samp{-mcpu=505}, @samp{-mcpu=821},
-@samp{-mcpu=860} and @samp{-mcpu=powerpc} enable the @samp{-mpowerpc}
-option and disable the @samp{-mpower} option; @samp{-mcpu=common}
-disables both the @samp{-mpower} and @samp{-mpowerpc} options.@refill
-@end ignore
-@c changed paragraph
-Specifying any of the following options:
-@samp{-mcpu=rios1}, @samp{-mcpu=rios2}, @samp{-mcpu=rsc},
-@samp{-mcpu=power}, or @samp{-mcpu=power2}
-enables the @samp{-mpower} option and disables the @samp{-mpowerpc} option;
-@samp{-mcpu=601} enables both the @samp{-mpower} and @samp{-mpowerpc} options.
-All of @samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e},
-@samp{-mcpu=604}, @samp{-mcpu=620},
-enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.
-Exactly similarly, all of @samp{-mcpu=403},
-@samp{-mcpu=505}, @samp{-mcpu=821}, @samp{-mcpu=860} and @samp{-mcpu=powerpc}
-enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.
-@samp{-mcpu=common} disables both the
-@samp{-mpower} and @samp{-mpowerpc} options.@refill
-@c end changes to prevent overfull hboxes
-
-AIX versions 4 or greater selects @samp{-mcpu=common} by default, so
-that code will operate on all members of the RS/6000 and PowerPC
-families. In that case, GNU CC will use only the instructions in the
-common subset of both architectures plus some special AIX common-mode
-calls, and will not use the MQ register. GNU CC assumes a generic
-processor model for scheduling purposes.
-
-Specifying any of the options @samp{-mcpu=rios1}, @samp{-mcpu=rios2},
-@samp{-mcpu=rsc}, @samp{-mcpu=power}, or @samp{-mcpu=power2} also
-disables the @samp{new-mnemonics} option. Specifying @samp{-mcpu=601},
-@samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e}, @samp{-mcpu=604},
-@samp{620}, @samp{403}, or @samp{-mcpu=powerpc} also enables the
-@samp{new-mnemonics} option.@refill
-
-Specifying @samp{-mcpu=403}, @samp{-mcpu=821}, or @samp{-mcpu=860} also
-enables the @samp{-msoft-float} option.
-
-@item -mtune=@var{cpu_type}
-Set the instruction scheduling parameters for machine type
-@var{cpu_type}, but do not set the architecture type, register usage,
-choice of mnemonics like @samp{-mcpu=}@var{cpu_type} would. The same
-values for @var{cpu_type} are used for @samp{-mtune=}@var{cpu_type} as
-for @samp{-mcpu=}@var{cpu_type}. The @samp{-mtune=}@var{cpu_type}
-option overrides the @samp{-mcpu=}@var{cpu_type} option in terms of
-instruction scheduling parameters.
-
-@item -mfull-toc
-@itemx -mno-fp-in-toc
-@itemx -mno-sum-in-toc
-@itemx -mminimal-toc
-Modify generation of the TOC (Table Of Contents), which is created for
-every executable file. The @samp{-mfull-toc} option is selected by
-default. In that case, GNU CC will allocate at least one TOC entry for
-each unique non-automatic variable reference in your program. GNU CC
-will also place floating-point constants in the TOC. However, only
-16,384 entries are available in the TOC.
-
-If you receive a linker error message that saying you have overflowed
-the available TOC space, you can reduce the amount of TOC space used
-with the @samp{-mno-fp-in-toc} and @samp{-mno-sum-in-toc} options.
-@samp{-mno-fp-in-toc} prevents GNU CC from putting floating-point
-constants in the TOC and @samp{-mno-sum-in-toc} forces GNU CC to
-generate code to calculate the sum of an address and a constant at
-run-time instead of putting that sum into the TOC. You may specify one
-or both of these options. Each causes GNU CC to produce very slightly
-slower and larger code at the expense of conserving TOC space.
-
-If you still run out of space in the TOC even when you specify both of
-these options, specify @samp{-mminimal-toc} instead. This option causes
-GNU CC to make only one TOC entry for every file. When you specify this
-option, GNU CC will produce code that is slower and larger but which
-uses extremely little TOC space. You may wish to use this option
-only on files that contain less frequently executed code. @refill
-
-@item -mxl-call
-@itemx -mno-xl-call
-On AIX, pass floating-point arguments to prototyped functions beyond the
-register save area (RSA) on the stack in addition to argument FPRs. The
-AIX 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. AIX XL
-compilers assume that floating point arguments which do not fit in the
-RSA are on the stack when they compile a subroutine 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 AIX
-XL compilers without optimization.
-
-@item -msoft-float
-@itemx -mhard-float
-Generate code that does not use (uses) the floating-point register set.
-Software floating point emulation is provided if you use the
-@samp{-msoft-float} option, and pass the option to GNU CC when linking.
-
-@item -mmultiple
-@itemx -mno-multiple
-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 POWER systems, and not
-generated on PowerPC systems. Do not use @samp{-mmultiple} on little
-endian PowerPC systems, since those instructions do not work when the
-processor is in little endian mode.
-
-@item -mstring
-@itemx -mno-string
-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 POWER systems, anod not
-generated on PowerPC systems. Do not use @samp{-mstring} on little endian
-PowerPC systems, since those instructions do not work when the processor is in
-little endian mode.
-
-@item -mno-bit-align
-@itemx -mbit-align
-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.
-
-For example, by default a structure containing nothing but 8
-@code{unsigned} bitfields of length 1 would be aligned to a 4 byte
-boundary and have a size of 4 bytes. By using @samp{-mno-bit-align},
-the structure would be aligned to a 1 byte boundary and be one byte in
-size.
-
-@item -mno-strict-align
-@itemx -mstrict-align
-On System V.4 and embedded PowerPC systems do not (do) assume that
-unaligned memory references will be handled by the system.
-
-@item -mrelocatable
-@itemx -mno-relocatable
-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 @samp{-mrelocatable} on any module, all objects linked together must
-be compiled with @samp{-mrelocatable} or @samp{-mrelocatable-lib}.
-
-@item -mrelocatable-lib
-@itemx -mno-relocatable-lib
-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 @samp{-mreloctable-lib} can be linked with either modules
-compiled without @samp{-mrelocatable} and @samp{-mrelocatable-lib} or
-with modules compiled with the @samp{-mrelocatable} options.
-
-@item -mno-toc
-@itemx -mtoc
-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.
-
-@item -mno-traceback
-@itemx -mtraceback
-On embedded PowerPC systems do not (do) generate a traceback tag before
-the start of the function. This tag can be used by the debugger to
-identify where the start of a function is.
-
-@item -mlittle
-@itemx -mlittle-endian
-On System V.4 and embedded PowerPC systems compile code for the
-processor in little endian mode. The @samp{-mlittle-endian} option is
-the same as @samp{-mlittle}.
-
-@item -mbig
-@itemx -mbig-endian
-On System V.4 and embedded PowerPC systems compile code for the
-processor in big endian mode. The @samp{-mbig-endian} option is
-the same as @samp{-mbig}.
-
-@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 GCC using @samp{powerpc-*-eabiaix}.
-
-@item -mcall-sysv-eabi
-Specify both @samp{-mcall-sysv} and @samp{-meabi} options.
-
-@item -mcall-sysv-noeabi
-Specify both @samp{-mcall-sysv} and @samp{-mno-eabi} options.
-
-@item -mcall-aix
-On System V.4 and embedded PowerPC systems compile code using calling
-conventions that are similar to those used on AIX. This is the
-default if you configured GCC using @samp{powerpc-*-eabiaix}.
-
-@item -mcall-solaris
-On System V.4 and embedded PowerPC systems compile code for the Solaris
-operating system.
-
-@item -mcall-linux
-On System V.4 and embedded PowerPC systems compile code for the Linux
-operating system.
-
-@item -mprototype
-@item -mno-prototype
-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 (@var{CR}) to
-indicate whether floating point values were passed in the floating point
-registers in case the function takes a variable arguments. With
-@samp{-mprototype}, only calls to prototyped variable argument functions
-will set or clear the bit.
-
-@item -msim
-On embedded PowerPC systems, assume that the startup module is called
-@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
-@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
-configurations.
-
-@item -mmvme
-On embedded PowerPC systems, assume that the startup module is called
-@file{mvme-crt0.o} and the standard C libraries are @file{libmvme.a} and
-@file{libc.a}.
-
-@item -memb
-On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
-header to indicate that @samp{eabi} extended relocations are used.
-
-@item -meabi
-@itemx -mno-eabi
-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 @code{-meabi}
-means that the stack is aligned to an 8 byte boundary, a function
-@code{__eabi} is called to from @code{main} to set up the eabi
-environment, and the @samp{-msdata} option can use both @code{r2} and
-@code{r13} to point to two separate small data areas. Selecting
-@code{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
-do not call an initialization function from @code{main}, and the
-@samp{-msdata} option will only use @code{r13} to point to a single
-small data area. The @samp{-meabi} option is on by default if you
-configured GCC using one of the @samp{powerpc*-*-eabi*} options.
-
-@item -msdata=eabi
-On System V.4 and embedded PowerPC systems, put small initialized
-@code{const} global and static data in the @samp{.sdata2} section, which
-is pointed to by register @code{r2}. Put small initialized
-non-@code{const} global and static data in the @samp{.sdata} section,
-which is pointed to by register @code{r13}. Put small uninitialized
-global and static data in the @samp{.sbss} section, which is adjacent to
-the @samp{.sdata} section. The @samp{-msdata=eabi} option is
-incompatible with the @samp{-mrelocatable} option. The
-@samp{-msdata=eabi} option also sets the @samp{-memb} option.
-
-@item -msdata=sysv
-On System V.4 and embedded PowerPC systems, put small global and static
-data in the @samp{.sdata} section, which is pointed to by register
-@code{r13}. Put small uninitialized global and static data in the
-@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
-The @samp{-msdata=sysv} option is incompatible with the
-@samp{-mrelocatable} option.
-
-@item -msdata=default
-@itemx -msdata
-On System V.4 and embedded PowerPC systems, if @samp{-meabi} is used,
-compile code the same as @samp{-msdata=eabi}, otherwise compile code the
-same as @samp{-msdata=sysv}.
-
-@item -msdata-data
-On System V.4 and embedded PowerPC systems, put small global and static
-data in the @samp{.sdata} section. Put small uninitialized global and
-static data in the @samp{.sbss} section. Do not use register @code{r13}
-to address small data however. This is the default behavior unless
-other @samp{-msdata} options are used.
-
-@item -msdata=none
-@itemx -mno-sdata
-On embedded PowerPC systems, put all initialized global and static data
-in the @samp{.data} section, and all uninitialized data in the
-@samp{.bss} section.
-
-@item -G @var{num}
-@cindex smaller data references (PowerPC)
-@cindex .sdata/.sdata2 references (PowerPC)
-On embbeded PowerPC systems, put global and static items less than or
-equal to @var{num} bytes into the small data or bss sections instead of
-the normal data or bss section. By default, @var{num} is 8. The
-@samp{-G @var{num}} switch is also passed to the linker.
-All modules should be compiled with the same @samp{-G @var{num}} value.
-
-@item -mregnames
-@itemx -mno-regnames
-On System V.4 and embedded PowerPC systems do (do not) emit register
-names in the assembly language output using symbolic forms.
-@end table
-@node RT Options
-@subsection IBM RT Options
-@cindex RT options
-@cindex IBM RT options
-
-These @samp{-m} options are defined for the IBM RT PC:
-
-@table @code
-@item -min-line-mul
-Use an in-line code sequence for integer multiplies. This is the
-default.
-
-@item -mcall-lib-mul
-Call @code{lmul$$} for integer multiples.
-
-@item -mfull-fp-blocks
-Generate full-size floating point data blocks, including the minimum
-amount of scratch space recommended by IBM. This is the default.
-
-@item -mminimum-fp-blocks
-Do not include extra scratch space in floating point data blocks. This
-results in smaller code, but slower execution, since scratch space must
-be allocated dynamically.
-
-@cindex @file{varargs.h} and RT PC
-@cindex @file{stdarg.h} and RT PC
-@item -mfp-arg-in-fpregs
-Use a calling sequence incompatible with the IBM calling convention in
-which floating point arguments are passed in floating point registers.
-Note that @code{varargs.h} and @code{stdargs.h} will not work with
-floating point operands if this option is specified.
-
-@item -mfp-arg-in-gregs
-Use the normal calling convention for floating point arguments. This is
-the default.
-
-@item -mhc-struct-return
-Return structures of more than one word in memory, rather than in a
-register. This provides compatibility with the MetaWare HighC (hc)
-compiler. Use the option @samp{-fpcc-struct-return} for compatibility
-with the Portable C Compiler (pcc).
-
-@item -mnohc-struct-return
-Return some structures of more than one word in registers, when
-convenient. This is the default. For compatibility with the
-IBM-supplied compilers, use the option @samp{-fpcc-struct-return} or the
-option @samp{-mhc-struct-return}.
-@end table
-
-@node MIPS Options
-@subsection MIPS Options
-@cindex MIPS options
-
-These @samp{-m} options are defined for the MIPS family of computers:
-
-@table @code
-@item -mcpu=@var{cpu type}
-Assume the defaults for the machine type @var{cpu type} when scheduling
-instructions. The choices for @var{cpu type} are @samp{r2000}, @samp{r3000},
-@samp{r4000}, @samp{r4400}, @samp{r4600}, and @samp{r6000}. While picking a
-specific @var{cpu type} will schedule things appropriately for that
-particular chip, the compiler will not generate any code that does not
-meet level 1 of the MIPS ISA (instruction set architecture) without
-the @samp{-mips2} or @samp{-mips3} switches being used.
-
-@item -mips1
-Issue instructions from level 1 of the MIPS ISA. This is the default.
-@samp{r3000} is the default @var{cpu type} at this ISA level.
-
-@item -mips2
-Issue instructions from level 2 of the MIPS ISA (branch likely, square
-root instructions). @samp{r6000} is the default @var{cpu type} at this
-ISA level.
-
-@item -mips3
-Issue instructions from level 3 of the MIPS ISA (64 bit instructions).
-@samp{r4000} is the default @var{cpu type} at this ISA level.
-This option does not change the sizes of any of the C data types.
-
-@item -mfp32
-Assume that 32 32-bit floating point registers are available. This is
-the default.
-
-@item -mfp64
-Assume that 32 64-bit floating point registers are available. This is
-the default when the @samp{-mips3} option is used.
-
-@item -mgp32
-Assume that 32 32-bit general purpose registers are available. This is
-the default.
-
-@item -mgp64
-Assume that 32 64-bit general purpose registers are available. This is
-the default when the @samp{-mips3} option is used.
-
-@item -mint64
-Types long, int, and pointer are 64 bits. This works only if @samp{-mips3}
-is also specified.
-
-@item -mlong64
-Types long and pointer are 64 bits, and type int is 32 bits.
-This works only if @samp{-mips3} is also specified.
-
-@item -mmips-as
-Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
-add normal debug information. This is the default for all
-platforms except for the OSF/1 reference platform, using the OSF/rose
-object format. If the either of the @samp{-gstabs} or @samp{-gstabs+}
-switches are used, the @file{mips-tfile} program will encapsulate the
-stabs within MIPS ECOFF.
-
-@item -mgas
-Generate code for the GNU assembler. This is the default on the OSF/1
-reference platform, using the OSF/rose object format.
-
-@item -mrnames
-@itemx -mno-rnames
-The @samp{-mrnames} switch says to output code using the MIPS software
-names for the registers, instead of the hardware names (ie, @var{a0}
-instead of @var{$4}). The only known assembler that supports this option
-is the Algorithmics assembler.
-
-@item -mgpopt
-@itemx -mno-gpopt
-The @samp{-mgpopt} switch says to write all of the data declarations
-before the instructions in the text section, this allows the MIPS
-assembler to generate one word memory references instead of using two
-words for short global or static data items. This is on by default if
-optimization is selected.
-
-@item -mstats
-@itemx -mno-stats
-For each non-inline function processed, the @samp{-mstats} switch
-causes the compiler to emit one line to the standard error file to
-print statistics about the program (number of registers saved, stack
-size, etc.).
-
-@item -mmemcpy
-@itemx -mno-memcpy
-The @samp{-mmemcpy} switch makes all block moves call the appropriate
-string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
-generating inline code.
-
-@item -mmips-tfile
-@itemx -mno-mips-tfile
-The @samp{-mno-mips-tfile} switch causes the compiler not
-postprocess the object file with the @file{mips-tfile} program,
-after the MIPS assembler has generated it to add debug support. If
-@file{mips-tfile} is not run, then no local variables will be
-available to the debugger. In addition, @file{stage2} and
-@file{stage3} objects will have the temporary file names passed to the
-assembler embedded in the object file, which means the objects will
-not compare the same. The @samp{-mno-mips-tfile} switch should only
-be used when there are bugs in the @file{mips-tfile} program that
-prevents compilation.
-
-@item -msoft-float
-Generate output containing library calls for floating point.
-@strong{Warning:} the requisite libraries are not part of GNU CC.
-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.
-
-@item -mhard-float
-Generate output containing floating point instructions. This is the
-default if you use the unmodified sources.
-
-@item -mabicalls
-@itemx -mno-abicalls
-Emit (or do not emit) the pseudo operations @samp{.abicalls},
-@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
-position independent code.
-
-@item -mlong-calls
-@itemx -mno-long-calls
-Do all calls with the @samp{JALR} instruction, which requires
-loading up a function's address into a register before the call.
-You need to use this switch, if you call outside of the current
-512 megabyte segment to functions that are not through pointers.
-
-@item -mhalf-pic
-@itemx -mno-half-pic
-Put pointers to extern references into the data section and load them
-up, rather than put the references in the text section.
-
-@item -membedded-pic
-@itemx -mno-embedded-pic
-Generate PIC code suitable for some embedded systems. All calls are made
-using PC relative address, and all data is addressed using the $gp register.
-This requires GNU as and GNU ld which do most of the work.
-
-@item -membedded-data
-@itemx -mno-embedded-data
-Allocate variables to the read-only data section first if possible, then
-next in the small data section if possible, otherwise in data. This gives
-slightly slower code than the default, but reduces the amount of RAM required
-when executing, and thus may be preferred for some embedded systems.
-
-@item -msingle-float
-@itemx -mdouble-float
-The @samp{-msingle-float} switch tells gcc to assume that the floating
-point coprocessor only supports single precision operations, as on the
-@samp{r4650} chip. The @samp{-mdouble-float} switch permits gcc to use
-double precision operations. This is the default.
-
-@item -mmad
-@itemx -mno-mad
-Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
-as on the @samp{r4650} chip.
-
-@item -m4650
-Turns on @samp{-msingle-float}, @samp{-mmad}, and, at least for now,
-@samp{-mcpu=r4650}.
-
-@item -EL
-Compile code for the processor in little endian mode.
-The requisite libraries are assumed to exist.
-
-@item -EB
-Compile code for the processor in big endian mode.
-The requisite libraries are assumed to exist.
-
-@item -G @var{num}
-@cindex smaller data references (MIPS)
-@cindex gp-relative references (MIPS)
-Put global and static items less than or equal to @var{num} bytes into
-the small data or bss sections instead of the normal data or bss
-section. This allows the assembler to emit one word memory reference
-instructions based on the global pointer (@var{gp} or @var{$28}),
-instead of the normal two words used. By default, @var{num} is 8 when
-the MIPS assembler is used, and 0 when the GNU assembler is used. The
-@samp{-G @var{num}} switch is also passed to the assembler and linker.
-All modules should be compiled with the same @samp{-G @var{num}}
-value.
-
-@item -nocpp
-Tell the MIPS assembler to not run it's preprocessor over user
-assembler files (with a @samp{.s} suffix) when assembling them.
-@end table
-
-@ifset INTERNALS
-These options are defined by the macro
-@code{TARGET_SWITCHES} in the machine description. The default for the
-options is also defined by that macro, which enables you to change the
-defaults.
-@end ifset
-
-@node i386 Options
-@subsection Intel 386 Options
-@cindex i386 Options
-@cindex Intel 386 Options
-
-These @samp{-m} options are defined for the i386 family of computers:
-
-@table @code
-@item -m486
-@itemx -m386
-Control whether or not code is optimized for a 486 instead of an
-386. Code generated for an 486 will run on a 386 and vice versa.
-
-@item -mieee-fp
-@itemx -mno-ieee-fp
-Control whether or not the compiler uses IEEE floating point
-comparisons. These handle correctly the case where the result of a
-comparison is unordered.
-
-@item -msoft-float
-Generate output containing library calls for floating point.
-@strong{Warning:} the requisite libraries are not part of GNU CC.
-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.
-
-On machines where a function returns floating point results in the 80387
-register stack, some floating point opcodes may be emitted even if
-@samp{-msoft-float} is used.
-
-@item -mno-fp-ret-in-387
-Do not use the FPU registers for return values of functions.
-
-The usual calling convention has functions return values of types
-@code{float} and @code{double} in an FPU register, even if there
-is no FPU. The idea is that the operating system should emulate
-an FPU.
-
-The option @samp{-mno-fp-ret-in-387} causes such values to be returned
-in ordinary CPU registers instead.
-
-@item -mno-fancy-math-387
-Some 387 emulators do not support the @code{sin}, @code{cos} and
-@code{sqrt} instructions for the 387. Specify this option to avoid
-generating those instructions. This option is the default on FreeBSD.
-As of revision 2.6.1, these instructions are not generated unless you
-also use the @samp{-ffast-math} switch.
-
-@item -malign-double
-@itemx -mno-align-double
-Control whether GNU CC aligns @code{double}, @code{long double}, and
-@code{long long} variables on a two word boundary or a one word
-boundary. Aligning @code{double} variables on a two word boundary will
-produce code that runs somewhat faster on a @samp{Pentium} at the
-expense of more memory.
-
-@strong{Warning:} if you use the @samp{-malign-double} switch,
-structures containing the above types will be aligned differently than
-the published application binary interface specifications for the 386.
-
-@item -msvr3-shlib
-@itemx -mno-svr3-shlib
-Control whether GNU CC places uninitialized locals into @code{bss} or
-@code{data}. @samp{-msvr3-shlib} places these locals into @code{bss}.
-These options are meaningful only on System V Release 3.
-
-@item -mno-wide-multiply
-@itemx -mwide-multiply
-Control whether GNU CC uses the @code{mul} and @code{imul} that produce
-64 bit results in @code{eax:edx} from 32 bit operands to do @code{long
-long} multiplies and 32-bit division by constants.
-
-@item -mrtd
-Use a different function-calling convention, in which functions that
-take a fixed number of arguments return with the @code{ret} @var{num}
-instruction, which pops their arguments while returning. This saves one
-instruction in the caller since there is no need to pop the arguments
-there.
-
-You can specify that an individual function is called with this calling
-sequence with the function attribute @samp{stdcall}. You can also
-override the @samp{-mrtd} option by using the function attribute
-@samp{cdecl}. @xref{Function Attributes}
-
-@strong{Warning:} 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.
-
-Also, you must provide function prototypes for all functions that
-take variable numbers of arguments (including @code{printf});
-otherwise incorrect code will be generated for calls to those
-functions.
-
-In addition, seriously incorrect code will result if you call a
-function with too many arguments. (Normally, extra arguments are
-harmlessly ignored.)
-
-@item -mreg-alloc=@var{regs}
-Control the default allocation order of integer registers. The
-string @var{regs} is a series of letters specifying a register. The
-supported letters are: @code{a} allocate EAX; @code{b} allocate EBX;
-@code{c} allocate ECX; @code{d} allocate EDX; @code{S} allocate ESI;
-@code{D} allocate EDI; @code{B} allocate EBP.
-
-@item -mregparm=@var{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 @samp{regparm}. @xref{Function Attributes}
-
-@strong{Warning:} if you use this switch, and
-@var{num} is nonzero, then you must build all modules with the same
-value, including any libraries. This includes the system libraries and
-startup modules.
-
-@item -malign-loops=@var{num}
-Align loops to a 2 raised to a @var{num} byte boundary. If
-@samp{-malign-loops} is not specified, the default is 2.
-
-@item -malign-jumps=@var{num}
-Align instructions that are only jumped to to a 2 raised to a @var{num}
-byte boundary. If @samp{-malign-jumps} is not specified, the default is
-2 if optimizing for a 386, and 4 if optimizing for a 486.
-
-@item -malign-functions=@var{num}
-Align the start of functions to a 2 raised to @var{num} byte boundary.
-If @samp{-malign-jumps} is not specified, the default is 2 if optimizing
-for a 386, and 4 if optimizing for a 486.
-@end table
-
-@node HPPA Options
-@subsection HPPA Options
-@cindex HPPA Options
-
-These @samp{-m} options are defined for the HPPA family of computers:
-
-@table @code
-@item -mpa-risc-1-0
-Generate code for a PA 1.0 processor.
-
-@item -mpa-risc-1-1
-Generate code for a PA 1.1 processor.
-
-@item -mjump-in-delay
-Fill delay slots of function calls with unconditional jump instructions
-by modifying the return pointer for the function call to be the target
-of the conditional jump.
-
-@item -mdisable-fpregs
-Prevent floating point registers from being used in any manner. This is
-necessary for compiling kernels which perform lazy context switching of
-floating point registers. If you use this option and attempt to perform
-floating point operations, the compiler will abort.
-
-@item -mdisable-indexing
-Prevent the compiler from using indexing address modes. This avoids some
-rather obscure problems when compiling MIG generated code under MACH.
-
-@item -mno-space-regs
-Generate code that assumes the target has no space registers. This allows
-GCC to generate faster indirect calls and use unscaled index address modes.
-
-Such code is suitable for level 0 PA systems and kernels.
-
-@item -mfast-indirect-calls
-Generate code that assumes calls never cross space boundaries. This
-allows GCC to emit code which performs faster indirect calls.
-
-This option will not work in the presense of shared libraries or nested
-functions.
-
-@item -mspace
-Optimize for space rather than execution time. Currently this only
-enables out of line function prologues and epilogues. This option is
-incompatable with PIC code generation and profiling.
-
-@item -mlong-load-store
-Generate 3-instruction load and store sequences as sometimes required by
-the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
-the HP compilers.
-
-@item -mportable-runtime
-Use the portable calling conventions proposed by HP for ELF systems.
-
-@item -mgas
-Enable the use of assembler directives only GAS understands.
-
-@item -mschedule=@var{cpu type}
-Schedule code according to the constraints for the machine type
-@var{cpu type}. The choices for @var{cpu type} are @samp{700} for
-7@var{n}0 machines, @samp{7100} for 7@var{n}5 machines, and @samp{7100}
-for 7@var{n}2 machines. @samp{7100} is the default for @var{cpu type}.
-
-Note the @samp{7100LC} scheduling information is incomplete and using
-@samp{7100LC} often leads to bad schedules. For now it's probably best
-to use @samp{7100} instead of @samp{7100LC} for the 7@var{n}2 machines.
-
-@item -mlinker-opt
-Enable the optimization pass in the HPUX linker. Note this makes symbolic
-debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers
-in which they give bogus error messages when linking some programs.
-
-@item -msoft-float
-Generate output containing library calls for floating point.
-@strong{Warning:} the requisite libraries are not available for all HPPA
-targets. Normally the facilities of the machine's usual C compiler are
-used, but this cannot be done directly in cross-compilation. You must make
-your own arrangements to provide suitable library functions for
-cross-compilation. The embedded target @samp{hppa1.1-*-pro}
-does provide software floating point support.
-
-@samp{-msoft-float} changes the calling convention in the output file;
-therefore, it is only useful if you compile @emph{all} of a program with
-this option. In particular, you need to compile @file{libgcc.a}, the
-library that comes with GNU CC, with @samp{-msoft-float} in order for
-this to work.
-@end table
-
-@node Intel 960 Options
-@subsection Intel 960 Options
-
-These @samp{-m} options are defined for the Intel 960 implementations:
-
-@table @code
-@item -m@var{cpu type}
-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
-The @samp{-mnumerics} option indicates that the processor does support
-floating-point instructions. The @samp{-msoft-float} option indicates
-that floating-point support should not be assumed.
-
-@item -mleaf-procedures
-@itemx -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
-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
-@samp{-mno-tail-call}.
-
-@item -mcomplex-addr
-@itemx -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 @samp{-mcomplex-addr} for all processors except
-the CB and CC.
-
-@item -mcode-align
-@itemx -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.
-
-@ignore
-@item -mclean-linkage
-@itemx -mno-clean-linkage
-These options are not fully implemented.
-@end ignore
-
-@item -mic-compat
-@itemx -mic2.0-compat
-@itemx -mic3.0-compat
-Enable compatibility with iC960 v2.0 or v3.0.
-
-@item -masm-compat
-@itemx -mintel-asm
-Enable compatibility with the iC960 assembler.
-
-@item -mstrict-align
-@itemx -mno-strict-align
-Do not permit (do permit) unaligned accesses.
-
-@item -mold-align
-Enable structure-alignment compatibility with Intel's gcc release version
-1.3 (based on gcc 1.37). Currently this is buggy in that @samp{#pragma
-align 1} is always assumed as well, and cannot be turned off.
-@end table
-
-@node DEC Alpha Options
-@subsection DEC Alpha Options
-
-These @samp{-m} options are defined for the DEC Alpha implementations:
-
-@table @code
-@item -mno-soft-float
-@itemx -msoft-float
-Use (do not use) the hardware floating-point instructions for
-floating-point operations. When @code{-msoft-float} is specified,
-functions in @file{libgcc1.c} will be used to perform floating-point
-operations. Unless they are replaced by routines that emulate the
-floating-point operations, or compiled in such a way as to call such
-emulations routines, these routines will issue floating-point
-operations. If you are compiling for an Alpha without floating-point
-operations, you must ensure that the library is built so as not to call
-them.
-
-Note that Alpha implementations without floating-point operations are
-required to have floating-point registers.
-
-@item -mfp-reg
-@itemx -mno-fp-regs
-Generate code that uses (does not use) the floating-point register set.
-@code{-mno-fp-regs} implies @code{-msoft-float}. If the floating-point
-register set is not used, floating point operands are passed in integer
-registers as if they were integers and floating-point results are passed
-in $0 instead of $f0. This is a non-standard calling sequence, so any
-function with a floating-point argument or return value called by code
-compiled with @code{-mno-fp-regs} must also be compiled with that
-option.
-
-A typical use of this option is building a kernel that does not use,
-and hence need not save and restore, any floating-point registers.
-
-@item -mieee
-The Alpha architecture implements floating-point hardware optimized for
-maximum performance. It is mostly compliant with the IEEE floating
-point standard. However, for full compliance, software assistance is
-required. This option generates code fully IEEE compliant code
-@emph{except} that the @var{inexact flag} is not maintained (see below).
-If this option is turned on, the CPP macro @code{_IEEE_FP} is defined
-during compilation. The option is a shorthand for: @samp{-D_IEEE_FP
--mfp-trap-mode=su -mtrap-precision=i -mieee-conformant}. The resulting
-code is less efficient but is able to correctly support denormalized
-numbers and exceptional IEEE values such as not-a-number and plus/minus
-infinity. Other Alpha compilers call this option
-@code{-ieee_with_no_inexact}.
-
-@item -mieee-with-inexact
-@c overfull hbox here --bob 22 jul96
-@c original text between ignore ... end ignore
-@ignore
-This is like @samp{-mieee} except the generated code also maintains the
-IEEE @var{inexact flag}. Turning on this option causes the generated
-code to implement fully-compliant IEEE math. The option is a shorthand
-for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus @samp{-mieee-conformant},
-@samp{-mfp-trap-mode=sui}, and @samp{-mtrap-precision=i}. On some Alpha
-implementations the resulting code may execute significantly slower than
-the code generated by default. Since there is very little code that
-depends on the @var{inexact flag}, you should normally not specify this
-option. Other Alpha compilers call this option
-@samp{-ieee_with_inexact}.
-@end ignore
-@c changed paragraph
-This is like @samp{-mieee} except the generated code also maintains the
-IEEE @var{inexact flag}. Turning on this option causes the generated
-code to implement fully-compliant IEEE math. The option is a shorthand
-for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus the three following:
-@samp{-mieee-conformant},
-@samp{-mfp-trap-mode=sui},
-and @samp{-mtrap-precision=i}.
-On some Alpha implementations the resulting code may execute
-significantly slower than the code generated by default. Since there
-is very little code that depends on the @var{inexact flag}, you should
-normally not specify this option. Other Alpha compilers call this
-option @samp{-ieee_with_inexact}.
-@c end changes to prevent overfull hboxes
-
-@item -mfp-trap-mode=@var{trap mode}
-This option controls what floating-point related traps are enabled.
-Other Alpha compilers call this option @samp{-fptm }@var{trap mode}.
-The trap mode can be set to one of four values:
-
-@table @samp
-@item n
-This is the default (normal) setting. The only traps that are enabled
-are the ones that cannot be disabled in software (e.g., division by zero
-trap).
-
-@item u
-In addition to the traps enabled by @samp{n}, underflow traps are enabled
-as well.
-
-@item su
-Like @samp{su}, but the instructions are marked to be safe for software
-completion (see Alpha architecture manual for details).
-
-@item sui
-Like @samp{su}, but inexact traps are enabled as well.
-@end table
-
-@item -mfp-rounding-mode=@var{rounding mode}
-Selects the IEEE rounding mode. Other Alpha compilers call this option
-@samp{-fprm }@var{rounding mode}. The @var{rounding mode} can be one
-of:
-
-@table @samp
-@item n
-Normal IEEE rounding mode. Floating point numbers are rounded towards
-the nearest machine number or towards the even machine number in case
-of a tie.
-
-@item m
-Round towards minus infinity.
-
-@item c
-Chopped rounding mode. Floating point numbers are rounded towards zero.
-
-@item d
-Dynamic rounding mode. A field in the floating point control register
-(@var{fpcr}, see Alpha architecture reference manual) controls the
-rounding mode in effect. The C library initializes this register for
-rounding towards plus infinity. Thus, unless your program modifies the
-@var{fpcr}, @samp{d} corresponds to round towards plus infinity.@end table
-
-@item -mtrap-precision=@var{trap precision}
-In the Alpha architecture, floating point traps are imprecise. This
-means without software assistance it is impossible to recover from a
-floating trap and program execution normally needs to be terminated.
-GNU CC can generate code that can assist operating system trap handlers
-in determining the exact location that caused a floating point trap.
-Depending on the requirements of an application, different levels of
-precisions can be selected:
-
-@table @samp
-@item p
-Program precision. This option is the default and means a trap handler
-can only identify which program caused a floating point exception.
-
-@item f
-Function precision. The trap handler can determine the function that
-caused a floating point exception.
-
-@item i
-Instruction precision. The trap handler can determine the exact
-instruction that caused a floating point exception.
-@end table
-
-Other Alpha compilers provide the equivalent options called
-@samp{-scope_safe} and @samp{-resumption_safe}.
-
-@item -mieee-conformant
-This option marks the generated code as IEEE conformant. You must not
-use this option unless you also specify @samp{-mtrap-precision=i} and either
-@samp{-mfp-trap-mode=su} or @samp{-mfp-trap-mode=sui}. Its only effect
-is to emit the line @samp{.eflag 48} in the function prologue of the
-generated assembly file. Under DEC Unix, this has the effect that
-IEEE-conformant math library routines will be linked in.
-
-@item -mbuild-constants
-Normally GNU CC examines a 32- or 64-bit integer constant to
-see if it can construct it from smaller constants in two or three
-instructions. If it cannot, it will output the constant as a literal and
-generate code to load it from the data segement at runtime.
-
-Use this option to require GNU CC to construct @emph{all} integer constants
-using code, even if it takes more instructions (the maximum is six).
-
-You would typically use this option to build a shared library dynamic
-loader. Itself a shared library, it must relocate itself in memory
-before it can find the variables and constants in its own data segment.
-@end table
-
-@node Clipper Options
-@subsection Clipper Options
-
-These @samp{-m} options are defined for the Clipper implementations:
-
-@table @code
-@item -mc300
-Produce code for a C300 Clipper processor. This is the default.
-
-@itemx -mc400
-Produce code for a C400 Clipper processor i.e. use floating point
-registers f8..f15.
-@end table
-
-@node H8/300 Options
-@subsection H8/300 Options
-
-These @samp{-m} options are defined for the H8/300 implementations:
-
-@table @code
-@item -mrelax
-Shorten some address references at link time, when possible; uses the
-linker option @samp{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
-ld.info, Using ld}, for a fuller description.
-
-@item -mh
-Generate code for the H8/300H.
-
-@item -mint32
-Make @code{int} data 32 bits by default.
-
-@item -malign-300
-On the h8/300h, use the same alignment rules as for the h8/300.
-The default for the h8/300h is to align longs and floats on 4 byte boundaries.
-@samp{-malign-300} causes them to be aligned on 2 byte boundaries.
-This option has no effect on the h8/300.
-@end table
-
-@node SH Options
-@subsection SH Options
-
-These @samp{-m} options are defined for the SH implementations:
-
-@table @code
-@item -m1
-Generate code for the SH1.
-
-@item -m2
-Generate code for the SH2.
-
-@item -m3
-Generate code for the SH3.
-
-@item -m3e
-Generate code for the SH3e.
-
-@item -mb
-Compile code for the processor in big endian mode.
-
-@item -ml
-Compile code for the processor in little endian mode.
-
-@item -mrelax
-Shorten some address references at link time, when possible; uses the
-linker option @samp{-relax}.
-@end table
-
-@node System V Options
-@subsection Options for System V
-
-These additional options are available on System V Release 4 for
-compatibility with other compilers on those systems:
-
-@table @code
-@item -G
-Create a shared object.
-It is recommended that @samp{-symbolic} or @samp{-shared} be used instead.
-
-@item -Qy
-Identify the versions of each tool used by the compiler, in a
-@code{.ident} assembler directive in the output.
-
-@item -Qn
-Refrain from adding @code{.ident} directives to the output file (this is
-the default).
-
-@item -YP,@var{dirs}
-Search the directories @var{dirs}, and no others, for libraries
-specified with @samp{-l}.
-
-@item -Ym,@var{dir}
-Look in the directory @var{dir} to find the M4 preprocessor.
-The assembler uses this option.
-@c This is supposed to go with a -Yd for predefined M4 macro files, but
-@c the generic assembler that comes with Solaris takes just -Ym.
-@end table
-
-@node Code Gen Options
-@section Options for Code Generation Conventions
-@cindex code generation conventions
-@cindex options, code generation
-@cindex run-time options
-
-These machine-independent options control the interface conventions
-used in code generation.
-
-Most of them have both positive and negative forms; the negative form
-of @samp{-ffoo} would be @samp{-fno-foo}. 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 @samp{no-} or adding
-it.
-
-@table @code
-@item -fpcc-struct-return
-Return ``short'' @code{struct} and @code{union} values in memory like
-longer ones, rather than in registers. This convention is less
-efficient, but it has the advantage of allowing intercallability between
-GNU CC-compiled files and files compiled with other compilers.
-
-The precise convention for returning structures in memory depends
-on the target configuration macros.
-
-Short structures and unions are those whose size and alignment match
-that of some integer type.
-
-@item -freg-struct-return
-Use the convention that @code{struct} and @code{union} values are
-returned in registers when possible. This is more efficient for small
-structures than @samp{-fpcc-struct-return}.
-
-If you specify neither @samp{-fpcc-struct-return} nor its contrary
-@samp{-freg-struct-return}, GNU CC defaults to whichever convention is
-standard for the target. If there is no standard convention, GNU CC
-defaults to @samp{-fpcc-struct-return}, except on targets where GNU CC
-is the principal compiler. In those cases, we can choose the standard,
-and we chose the more efficient register return alternative.
-
-@item -fshort-enums
-Allocate to an @code{enum} type only as many bytes as it needs for the
-declared range of possible values. Specifically, the @code{enum} type
-will be equivalent to the smallest integer type which has enough room.
-
-@item -fshort-double
-Use the same size for @code{double} as for @code{float}.
-
-@item -fshared-data
-Requests that the data and non-@code{const} 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.
-
-@item -fno-common
-Allocate even uninitialized global variables in the bss section of the
-object file, rather than generating them as common blocks. This has the
-effect that if the same variable is declared (without @code{extern}) 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.
-
-@item -fno-ident
-Ignore the @samp{#ident} directive.
-
-@item -fno-gnu-linker
-Do not output global initializations (such as C++ constructors and
-destructors) in the form used by the GNU linker (on systems where the GNU
-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
-@code{collect2} program to make sure the system linker includes
-constructors and destructors. (@code{collect2} is included in the GNU CC
-distribution.) For systems which @emph{must} use @code{collect2}, the
-compiler driver @code{gcc} is configured to do this automatically.
-
-@item -finhibit-size-directive
-Don't output a @code{.size} 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 @file{crtstuff.c}; you should not need to use it
-for anything else.
-
-@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).
-
-@samp{-fverbose-asm} is the default. @samp{-fno-verbose-asm} causes the
-extra information to be omitted and is useful when comparing two assembler
-files.
-
-@item -fvolatile
-Consider all memory references through pointers to be volatile.
-
-@item -fvolatile-global
-Consider all memory references to extern and global data items to
-be volatile.
-
-@item -fpic
-@cindex global offset table
-@cindex PIC
-Generate position-independent code (PIC) suitable for use in a shared
-library, if supported for the target machine. Such code accesses all
-constant addresses through a global offset table (GOT). If the GOT size
-for the linked executable exceeds a machine-specific maximum size, you
-get an error message from the linker indicating that @samp{-fpic} does
-not work; in that case, recompile with @samp{-fPIC} instead. (These
-maximums are 16k on the m88k, 8k on the Sparc, and 32k on the m68k and
-RS/6000. The 386 has no such limit.)
-
-Position-independent code requires special support, and therefore works
-only on certain machines. For the 386, GNU CC supports PIC for System V
-but not for the Sun 386i. Code generated for the IBM RS/6000 is always
-position-independent.
-
-The GNU assembler does not fully support PIC. Currently, you must use
-some other assembler in order for PIC to work. We would welcome
-volunteers to upgrade GAS to handle this; the first part of the job is
-to figure out what the assembler must do differently.
-
-@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.
-
-Position-independent code requires special support, and therefore works
-only on certain machines.
-
-@item -ffixed-@var{reg}
-Treat the register named @var{reg} 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).
-
-@var{reg} must be the name of a register. The register names accepted
-are machine-specific and are defined in the @code{REGISTER_NAMES}
-macro in the machine description macro file.
-
-This flag does not have a negative form, because it specifies a
-three-way choice.
-
-@item -fcall-used-@var{reg}
-Treat the register named @var{reg} as an allocatable 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 @var{reg}.
-
-Use of this flag for a register that has a fixed pervasive role in the
-machine's execution model, such as the stack pointer or frame pointer,
-will produce disastrous results.
-
-This flag does not have a negative form, because it specifies a
-three-way choice.
-
-@item -fcall-saved-@var{reg}
-Treat the register named @var{reg} as an allocatable 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 @var{reg} if they use it.
-
-Use of this flag for a register that has a fixed pervasive role in the
-machine's execution model, such as the stack pointer or frame pointer,
-will produce disastrous results.
-
-A different sort of disaster will result from the use of this flag for
-a register in which function values may be returned.
-
-This flag does not have a negative form, because it specifies a
-three-way choice.
-
-@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.
-
-@item +e0
-@itemx +e1
-Control whether virtual function definitions in classes are used to
-generate code, or only to define interfaces for their callers. (C++
-only).
-
-These options are provided for compatibility with @code{cfront} 1.x
-usage; the recommended alternative GNU C++ usage is in flux. @xref{C++
-Interface,,Declarations and Definitions in One Header}.
-
-With @samp{+e0}, virtual function definitions in classes are declared
-@code{extern}; the declaration is used only as an interface
-specification, not to generate code for the virtual functions (in this
-compilation).
-
-With @samp{+e1}, G++ actually generates the code implementing virtual
-functions defined in the code, and makes them publicly visible.
-@end table
-
-@node Environment Variables
-@section Environment Variables Affecting GNU CC
-@cindex environment variables
-
-This section describes several environment variables that affect how GNU
-CC operates. They work by specifying directories or prefixes to use
-when searching for various kinds of files.
-
-@ifclear INTERNALS
-Note that you can also specify places to search using options such as
-@samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}). These
-take precedence over places specified using environment variables, which
-in turn take precedence over those specified by the configuration of GNU
-CC.
-@end ifclear
-@ifset INTERNALS
-Note that you can also specify places to search using options such as
-@samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}). These
-take precedence over places specified using environment variables, which
-in turn take precedence over those specified by the configuration of GNU
-CC. @xref{Driver}.
-@end ifset
-
-@table @code
-@item TMPDIR
-@findex TMPDIR
-If @code{TMPDIR} is set, it specifies the directory to use for temporary
-files. GNU CC 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.
-
-@item GCC_EXEC_PREFIX
-@findex GCC_EXEC_PREFIX
-If @code{GCC_EXEC_PREFIX} 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.
-
-If GNU CC cannot find the subprogram using the specified prefix, it
-tries looking in the usual places for the subprogram.
-
-The default value of @code{GCC_EXEC_PREFIX} is
-@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
-of @code{prefix} when you ran the @file{configure} script.
-
-Other prefixes specified with @samp{-B} take precedence over this prefix.
-
-This prefix is also used for finding files such as @file{crt0.o} that are
-used for linking.
-
-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 @samp{/usr/local/lib/gcc-lib}
-(more precisely, with the value of @code{GCC_INCLUDE_DIR}), GNU CC tries
-replacing that beginning with the specified prefix to produce an
-alternate directory name. Thus, with @samp{-Bfoo/}, GNU CC will search
-@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
-These alternate directories are searched first; the standard directories
-come next.
-
-@item COMPILER_PATH
-@findex COMPILER_PATH
-The value of @code{COMPILER_PATH} is a colon-separated list of
-directories, much like @code{PATH}. GNU CC tries the directories thus
-specified when searching for subprograms, if it can't find the
-subprograms using @code{GCC_EXEC_PREFIX}.
-
-@item LIBRARY_PATH
-@findex LIBRARY_PATH
-The value of @code{LIBRARY_PATH} is a colon-separated list of
-directories, much like @code{PATH}. When configured as a native compiler,
-GNU CC tries the directories thus specified when searching for special
-linker files, if it can't find them using @code{GCC_EXEC_PREFIX}. Linking
-using GNU CC also uses these directories when searching for ordinary
-libraries for the @samp{-l} option (but directories specified with
-@samp{-L} come first).
-
-@item C_INCLUDE_PATH
-@itemx CPLUS_INCLUDE_PATH
-@itemx OBJC_INCLUDE_PATH
-@findex C_INCLUDE_PATH
-@findex CPLUS_INCLUDE_PATH
-@findex OBJC_INCLUDE_PATH
-@c @itemx OBJCPLUS_INCLUDE_PATH
-These environment variables pertain to particular languages. Each
-variable's value is a colon-separated list of directories, much like
-@code{PATH}. When GNU CC searches for header files, it tries the
-directories listed in the variable for the language you are using, after
-the directories specified with @samp{-I} but before the standard header
-file directories.
-
-@item DEPENDENCIES_OUTPUT
-@findex DEPENDENCIES_OUTPUT
-@cindex dependencies for make as output
-If this variable is set, its value specifies how to output dependencies
-for Make based on the header files processed by the compiler. This
-output looks much like the output from the @samp{-M} option
-(@pxref{Preprocessor Options}), but it goes to a separate file, and is
-in addition to the usual results of compilation.
-
-The value of @code{DEPENDENCIES_OUTPUT} 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
-@samp{@var{file} @var{target}}, in which case the rules are written to
-file @var{file} using @var{target} as the target name.
-@end table
-
-@node Running Protoize
-@section Running Protoize
-
-The program @code{protoize} is an optional part of GNU C. You can use
-it to add prototypes to a program, thus converting the program to ANSI
-C in one respect. The companion program @code{unprotoize} does the
-reverse: it removes argument types from any prototypes that are found.
-
-When you run these programs, you must specify a set of source files as
-command line arguments. The conversion programs start out by compiling
-these files to see what functions they define. The information gathered
-about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
-
-After scanning comes actual conversion. The specified files are all
-eligible to be converted; any files they include (whether sources or
-just headers) are eligible as well.
-
-But not all the eligible files are converted. By default,
-@code{protoize} and @code{unprotoize} convert only source and header
-files in the current directory. You can specify additional directories
-whose files should be converted with the @samp{-d @var{directory}}
-option. You can also specify particular files to exclude with the
-@samp{-x @var{file}} option. A file is converted if it is eligible, its
-directory name matches one of the specified directory names, and its
-name within the directory has not been excluded.
-
-Basic conversion with @code{protoize} consists of rewriting most
-function definitions and function declarations to specify the types of
-the arguments. The only ones not rewritten are those for varargs
-functions.
-
-@code{protoize} optionally inserts prototype declarations at the
-beginning of the source file, to make them available for any calls that
-precede the function's definition. Or it can insert prototype
-declarations with block scope in the blocks where undeclared functions
-are called.
-
-Basic conversion with @code{unprotoize} consists of rewriting most
-function declarations to remove any argument types, and rewriting
-function definitions to the old-style pre-ANSI form.
-
-Both conversion programs print a warning for any function declaration or
-definition that they can't convert. You can suppress these warnings
-with @samp{-q}.
-
-The output from @code{protoize} or @code{unprotoize} replaces the
-original source file. The original file is renamed to a name ending
-with @samp{.save}. If the @samp{.save} file already exists, then
-the source file is simply discarded.
-
-@code{protoize} and @code{unprotoize} both depend on GNU CC itself to
-scan the program and collect information about the functions it uses.
-So neither of these programs will work until GNU CC is installed.
-
-Here is a table of the options you can use with @code{protoize} and
-@code{unprotoize}. Each option works with both programs unless
-otherwise stated.
-
-@table @code
-@item -B @var{directory}
-Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
-usual directory (normally @file{/usr/local/lib}). This file contains
-prototype information about standard system functions. This option
-applies only to @code{protoize}.
-
-@item -c @var{compilation-options}
-Use @var{compilation-options} as the options when running @code{gcc} to
-produce the @samp{.X} files. The special option @samp{-aux-info} is
-always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
-
-Note that the compilation options must be given as a single argument to
-@code{protoize} or @code{unprotoize}. If you want to specify several
-@code{gcc} options, you must quote the entire set of compilation options
-to make them a single word in the shell.
-
-There are certain @code{gcc} arguments that you cannot use, because they
-would produce the wrong kind of output. These include @samp{-g},
-@samp{-O}, @samp{-c}, @samp{-S}, and @samp{-o} If you include these in
-the @var{compilation-options}, they are ignored.
-
-@item -C
-Rename files to end in @samp{.C} instead of @samp{.c}.
-This is convenient if you are converting a C program to C++.
-This option applies only to @code{protoize}.
-
-@item -g
-Add explicit global declarations. This means inserting explicit
-declarations at the beginning of each source file for each function
-that is called in the file and was not declared. These declarations
-precede the first function definition that contains a call to an
-undeclared function. This option applies only to @code{protoize}.
-
-@item -i @var{string}
-Indent old-style parameter declarations with the string @var{string}.
-This option applies only to @code{protoize}.
-
-@code{unprotoize} converts prototyped function definitions to old-style
-function definitions, where the arguments are declared between the
-argument list and the initial @samp{@{}. By default, @code{unprotoize}
-uses five spaces as the indentation. If you want to indent with just
-one space instead, use @samp{-i " "}.
-
-@item -k
-Keep the @samp{.X} files. Normally, they are deleted after conversion
-is finished.
-
-@item -l
-Add explicit local declarations. @code{protoize} with @samp{-l} inserts
-a prototype declaration for each function in each block which calls the
-function without any declaration. This option applies only to
-@code{protoize}.
-
-@item -n
-Make no real changes. This mode just prints information about the conversions
-that would have been done without @samp{-n}.
-
-@item -N
-Make no @samp{.save} files. The original files are simply deleted.
-Use this option with caution.
-
-@item -p @var{program}
-Use the program @var{program} as the compiler. Normally, the name
-@file{gcc} is used.
-
-@item -q
-Work quietly. Most warnings are suppressed.
-
-@item -v
-Print the version number, just like @samp{-v} for @code{gcc}.
-@end table
-
-If you need special compiler options to compile one of your program's
-source files, then you should generate that file's @samp{.X} file
-specially, by running @code{gcc} on that source file with the
-appropriate options and the option @samp{-aux-info}. Then run
-@code{protoize} on the entire set of files. @code{protoize} will use
-the existing @samp{.X} file because it is newer than the source file.
-For example:
-
-@example
-gcc -Dfoo=bar file1.c -aux-info
-protoize *.c
-@end example
-
-@noindent
-You need to include the special files along with the rest in the
-@code{protoize} command, even though their @samp{.X} files already
-exist, because otherwise they won't get converted.
-
-@xref{Protoize Caveats}, for more information on how to use
-@code{protoize} successfully.
-
diff --git a/gcc/jump.c b/gcc/jump.c
deleted file mode 100644
index 2253f7b04ef..00000000000
--- a/gcc/jump.c
+++ /dev/null
@@ -1,4704 +0,0 @@
-/* Optimize jump instructions, for GNU compiler.
- Copyright (C) 1987, 88, 89, 91-96, 1997 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 jump-optimization pass of the compiler.
- It is run two or three times: once before cse, sometimes once after cse,
- and once after reload (before final).
-
- jump_optimize deletes unreachable code and labels that are not used.
- It also deletes jumps that jump to the following insn,
- and simplifies jumps around unconditional jumps and jumps
- to unconditional jumps.
-
- Each CODE_LABEL has a count of the times it is used
- stored in the LABEL_NUSES internal field, and each JUMP_INSN
- has one label that it refers to stored in the
- JUMP_LABEL internal field. With this we can detect labels that
- become unused because of the deletion of all the jumps that
- formerly used them. The JUMP_LABEL info is sometimes looked
- at by later passes.
-
- Optionally, cross-jumping can be done. Currently it is done
- only the last time (when after reload and before final).
- In fact, the code for cross-jumping now assumes that register
- allocation has been done, since it uses `rtx_renumbered_equal_p'.
-
- Jump optimization is done after cse when cse's constant-propagation
- causes jumps to become unconditional or to be deleted.
-
- Unreachable loops are not detected here, because the labels
- have references and the insns appear reachable from the labels.
- find_basic_blocks in flow.c finds and deletes such loops.
-
- The subroutines delete_insn, redirect_jump, and invert_jump are used
- from other passes as well. */
-
-#include "config.h"
-#include "rtl.h"
-#include "flags.h"
-#include "hard-reg-set.h"
-#include "regs.h"
-#include "insn-config.h"
-#include "insn-flags.h"
-#include "expr.h"
-#include "real.h"
-#include "except.h"
-
-/* ??? Eventually must record somehow the labels used by jumps
- from nested functions. */
-/* Pre-record the next or previous real insn for each label?
- No, this pass is very fast anyway. */
-/* Condense consecutive labels?
- This would make life analysis faster, maybe. */
-/* Optimize jump y; x: ... y: jumpif... x?
- Don't know if it is worth bothering with. */
-/* Optimize two cases of conditional jump to conditional jump?
- This can never delete any instruction or make anything dead,
- or even change what is live at any point.
- So perhaps let combiner do it. */
-
-/* Vector indexed by uid.
- For each CODE_LABEL, index by its uid to get first unconditional jump
- that jumps to the label.
- For each JUMP_INSN, index by its uid to get the next unconditional jump
- that jumps to the same label.
- Element 0 is the start of a chain of all return insns.
- (It is safe to use element 0 because insn uid 0 is not used. */
-
-static rtx *jump_chain;
-
-/* List of labels referred to from initializers.
- These can never be deleted. */
-rtx forced_labels;
-
-/* Maximum index in jump_chain. */
-
-static int max_jump_chain;
-
-/* Set nonzero by jump_optimize if control can fall through
- to the end of the function. */
-int can_reach_end;
-
-/* Indicates whether death notes are significant in cross jump analysis.
- Normally they are not significant, because of A and B jump to C,
- and R dies in A, it must die in B. But this might not be true after
- stack register conversion, and we must compare death notes in that
- case. */
-
-static int cross_jump_death_matters = 0;
-
-static int duplicate_loop_exit_test PROTO((rtx));
-static void find_cross_jump PROTO((rtx, rtx, int, rtx *, rtx *));
-static void do_cross_jump PROTO((rtx, rtx, rtx));
-static int jump_back_p PROTO((rtx, rtx));
-static int tension_vector_labels PROTO((rtx, int));
-static void mark_jump_label PROTO((rtx, rtx, int));
-static void delete_computation PROTO((rtx));
-static void delete_from_jump_chain PROTO((rtx));
-static int delete_labelref_insn PROTO((rtx, rtx, int));
-static void redirect_tablejump PROTO((rtx, rtx));
-
-/* Delete no-op jumps and optimize jumps to jumps
- and jumps around jumps.
- Delete unused labels and unreachable code.
-
- If CROSS_JUMP is 1, detect matching code
- before a jump and its destination and unify them.
- If CROSS_JUMP is 2, do cross-jumping, but pay attention to death notes.
-
- If NOOP_MOVES is nonzero, delete no-op move insns.
-
- If AFTER_REGSCAN is nonzero, then this jump pass is being run immediately
- after regscan, and it is safe to use regno_first_uid and regno_last_uid.
-
- If `optimize' is zero, don't change any code,
- just determine whether control drops off the end of the function.
- This case occurs when we have -W and not -O.
- It works because `delete_insn' checks the value of `optimize'
- and refrains from actually deleting when that is 0. */
-
-void
-jump_optimize (f, cross_jump, noop_moves, after_regscan)
- rtx f;
- int cross_jump;
- int noop_moves;
- int after_regscan;
-{
- register rtx insn, next, note;
- int changed;
- int first = 1;
- int max_uid = 0;
- rtx last_insn;
-
- cross_jump_death_matters = (cross_jump == 2);
-
- /* Initialize LABEL_NUSES and JUMP_LABEL fields. Delete any REG_LABEL
- notes whose labels don't occur in the insn any more. */
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL)
- LABEL_NUSES (insn) = (LABEL_PRESERVE_P (insn) != 0);
- else if (GET_CODE (insn) == JUMP_INSN)
- JUMP_LABEL (insn) = 0;
- else if (GET_CODE (insn) == INSN || GET_CODE (insn) == CALL_INSN)
- for (note = REG_NOTES (insn); note; note = next)
- {
- next = XEXP (note, 1);
- if (REG_NOTE_KIND (note) == REG_LABEL
- && ! reg_mentioned_p (XEXP (note, 0), PATTERN (insn)))
- remove_note (insn, note);
- }
-
- if (INSN_UID (insn) > max_uid)
- max_uid = INSN_UID (insn);
- }
-
- max_uid++;
-
- /* Delete insns following barriers, up to next label. */
-
- for (insn = f; insn;)
- {
- if (GET_CODE (insn) == BARRIER)
- {
- insn = NEXT_INSN (insn);
- while (insn != 0 && GET_CODE (insn) != CODE_LABEL)
- {
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END)
- insn = NEXT_INSN (insn);
- else
- insn = delete_insn (insn);
- }
- /* INSN is now the code_label. */
- }
- else
- insn = NEXT_INSN (insn);
- }
-
- /* Leave some extra room for labels and duplicate exit test insns
- we make. */
- max_jump_chain = max_uid * 14 / 10;
- jump_chain = (rtx *) alloca (max_jump_chain * sizeof (rtx));
- bzero ((char *) jump_chain, max_jump_chain * sizeof (rtx));
-
- /* Mark the label each jump jumps to.
- Combine consecutive labels, and count uses of labels.
-
- For each label, make a chain (using `jump_chain')
- of all the *unconditional* jumps that jump to it;
- also make a chain of all returns. */
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && ! INSN_DELETED_P (insn))
- {
- mark_jump_label (PATTERN (insn), insn, cross_jump);
- if (GET_CODE (insn) == JUMP_INSN)
- {
- if (JUMP_LABEL (insn) != 0 && simplejump_p (insn))
- {
- jump_chain[INSN_UID (insn)]
- = jump_chain[INSN_UID (JUMP_LABEL (insn))];
- jump_chain[INSN_UID (JUMP_LABEL (insn))] = insn;
- }
- if (GET_CODE (PATTERN (insn)) == RETURN)
- {
- jump_chain[INSN_UID (insn)] = jump_chain[0];
- jump_chain[0] = insn;
- }
- }
- }
-
- /* Keep track of labels used from static data;
- they cannot ever be deleted. */
-
- for (insn = forced_labels; insn; insn = XEXP (insn, 1))
- LABEL_NUSES (XEXP (insn, 0))++;
-
- check_exception_handler_labels ();
-
- /* Keep track of labels used for marking handlers for exception
- regions; they cannot usually be deleted. */
-
- for (insn = exception_handler_labels; insn; insn = XEXP (insn, 1))
- LABEL_NUSES (XEXP (insn, 0))++;
-
- exception_optimize ();
-
- /* Delete all labels already not referenced.
- Also find the last insn. */
-
- last_insn = 0;
- for (insn = f; insn; )
- {
- if (GET_CODE (insn) == CODE_LABEL && LABEL_NUSES (insn) == 0)
- insn = delete_insn (insn);
- else
- {
- last_insn = insn;
- insn = NEXT_INSN (insn);
- }
- }
-
- if (!optimize)
- {
- /* See if there is still a NOTE_INSN_FUNCTION_END in this function.
- If so record that this function can drop off the end. */
-
- insn = last_insn;
- {
- int n_labels = 1;
- while (insn
- /* One label can follow the end-note: the return label. */
- && ((GET_CODE (insn) == CODE_LABEL && n_labels-- > 0)
- /* Ordinary insns can follow it if returning a structure. */
- || GET_CODE (insn) == INSN
- /* If machine uses explicit RETURN insns, no epilogue,
- then one of them follows the note. */
- || (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) == RETURN)
- /* A barrier can follow the return insn. */
- || GET_CODE (insn) == BARRIER
- /* Other kinds of notes can follow also. */
- || (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END)))
- insn = PREV_INSN (insn);
- }
-
- /* Report if control can fall through at the end of the function. */
- if (insn && GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_END
- && ! INSN_DELETED_P (insn))
- can_reach_end = 1;
-
- /* Zero the "deleted" flag of all the "deleted" insns. */
- for (insn = f; insn; insn = NEXT_INSN (insn))
- INSN_DELETED_P (insn) = 0;
- return;
- }
-
-#ifdef HAVE_return
- if (HAVE_return)
- {
- /* If we fall through to the epilogue, see if we can insert a RETURN insn
- in front of it. If the machine allows it at this point (we might be
- after reload for a leaf routine), it will improve optimization for it
- to be there. */
- insn = get_last_insn ();
- while (insn && GET_CODE (insn) == NOTE)
- insn = PREV_INSN (insn);
-
- if (insn && GET_CODE (insn) != BARRIER)
- {
- emit_jump_insn (gen_return ());
- emit_barrier ();
- }
- }
-#endif
-
- if (noop_moves)
- for (insn = f; insn; )
- {
- next = NEXT_INSN (insn);
-
- if (GET_CODE (insn) == INSN)
- {
- register rtx body = PATTERN (insn);
-
-/* Combine stack_adjusts with following push_insns. */
-#ifdef PUSH_ROUNDING
- if (GET_CODE (body) == SET
- && SET_DEST (body) == stack_pointer_rtx
- && GET_CODE (SET_SRC (body)) == PLUS
- && XEXP (SET_SRC (body), 0) == stack_pointer_rtx
- && GET_CODE (XEXP (SET_SRC (body), 1)) == CONST_INT
- && INTVAL (XEXP (SET_SRC (body), 1)) > 0)
- {
- rtx p;
- rtx stack_adjust_insn = insn;
- int stack_adjust_amount = INTVAL (XEXP (SET_SRC (body), 1));
- int total_pushed = 0;
- int pushes = 0;
-
- /* Find all successive push insns. */
- p = insn;
- /* Don't convert more than three pushes;
- that starts adding too many displaced addresses
- and the whole thing starts becoming a losing
- proposition. */
- while (pushes < 3)
- {
- rtx pbody, dest;
- p = next_nonnote_insn (p);
- if (p == 0 || GET_CODE (p) != INSN)
- break;
- pbody = PATTERN (p);
- if (GET_CODE (pbody) != SET)
- break;
- dest = SET_DEST (pbody);
- /* Allow a no-op move between the adjust and the push. */
- if (GET_CODE (dest) == REG
- && GET_CODE (SET_SRC (pbody)) == REG
- && REGNO (dest) == REGNO (SET_SRC (pbody)))
- continue;
- if (! (GET_CODE (dest) == MEM
- && GET_CODE (XEXP (dest, 0)) == POST_INC
- && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx))
- break;
- pushes++;
- if (total_pushed + GET_MODE_SIZE (GET_MODE (SET_DEST (pbody)))
- > stack_adjust_amount)
- break;
- total_pushed += GET_MODE_SIZE (GET_MODE (SET_DEST (pbody)));
- }
-
- /* Discard the amount pushed from the stack adjust;
- maybe eliminate it entirely. */
- if (total_pushed >= stack_adjust_amount)
- {
- delete_computation (stack_adjust_insn);
- total_pushed = stack_adjust_amount;
- }
- else
- XEXP (SET_SRC (PATTERN (stack_adjust_insn)), 1)
- = GEN_INT (stack_adjust_amount - total_pushed);
-
- /* Change the appropriate push insns to ordinary stores. */
- p = insn;
- while (total_pushed > 0)
- {
- rtx pbody, dest;
- p = next_nonnote_insn (p);
- if (GET_CODE (p) != INSN)
- break;
- pbody = PATTERN (p);
- if (GET_CODE (pbody) == SET)
- break;
- dest = SET_DEST (pbody);
- if (! (GET_CODE (dest) == MEM
- && GET_CODE (XEXP (dest, 0)) == POST_INC
- && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx))
- break;
- total_pushed -= GET_MODE_SIZE (GET_MODE (SET_DEST (pbody)));
- /* If this push doesn't fully fit in the space
- of the stack adjust that we deleted,
- make another stack adjust here for what we
- didn't use up. There should be peepholes
- to recognize the resulting sequence of insns. */
- if (total_pushed < 0)
- {
- emit_insn_before (gen_add2_insn (stack_pointer_rtx,
- GEN_INT (- total_pushed)),
- p);
- break;
- }
- XEXP (dest, 0)
- = plus_constant (stack_pointer_rtx, total_pushed);
- }
- }
-#endif
-
- /* Detect and delete no-op move instructions
- resulting from not allocating a parameter in a register. */
-
- if (GET_CODE (body) == SET
- && (SET_DEST (body) == SET_SRC (body)
- || (GET_CODE (SET_DEST (body)) == MEM
- && GET_CODE (SET_SRC (body)) == MEM
- && rtx_equal_p (SET_SRC (body), SET_DEST (body))))
- && ! (GET_CODE (SET_DEST (body)) == MEM
- && MEM_VOLATILE_P (SET_DEST (body)))
- && ! (GET_CODE (SET_SRC (body)) == MEM
- && MEM_VOLATILE_P (SET_SRC (body))))
- delete_computation (insn);
-
- /* Detect and ignore no-op move instructions
- resulting from smart or fortuitous register allocation. */
-
- else if (GET_CODE (body) == SET)
- {
- int sreg = true_regnum (SET_SRC (body));
- int dreg = true_regnum (SET_DEST (body));
-
- if (sreg == dreg && sreg >= 0)
- delete_insn (insn);
- else if (sreg >= 0 && dreg >= 0)
- {
- rtx trial;
- rtx tem = find_equiv_reg (NULL_RTX, insn, 0,
- sreg, NULL_PTR, dreg,
- GET_MODE (SET_SRC (body)));
-
- if (tem != 0 &&
- GET_MODE (tem) == GET_MODE (SET_DEST (body)))
- {
- /* DREG may have been the target of a REG_DEAD note in
- the insn which makes INSN redundant. If so, reorg
- would still think it is dead. So search for such a
- note and delete it if we find it. */
- if (! find_regno_note (insn, REG_UNUSED, dreg))
- for (trial = prev_nonnote_insn (insn);
- trial && GET_CODE (trial) != CODE_LABEL;
- trial = prev_nonnote_insn (trial))
- if (find_regno_note (trial, REG_DEAD, dreg))
- {
- remove_death (dreg, trial);
- break;
- }
-#ifdef PRESERVE_DEATH_INFO_REGNO_P
- /* Deleting insn could lose a death-note for SREG
- so don't do it if final needs accurate
- death-notes. */
- if (PRESERVE_DEATH_INFO_REGNO_P (sreg)
- && (trial = find_regno_note (insn, REG_DEAD, sreg)))
- {
- /* Change this into a USE so that we won't emit
- code for it, but still can keep the note. */
- PATTERN (insn)
- = gen_rtx (USE, VOIDmode, XEXP (trial, 0));
- INSN_CODE (insn) = -1;
- /* Remove all reg notes but the REG_DEAD one. */
- REG_NOTES (insn) = trial;
- XEXP (trial, 1) = NULL_RTX;
- }
- else
-#endif
- delete_insn (insn);
- }
- }
- else if (dreg >= 0 && CONSTANT_P (SET_SRC (body))
- && find_equiv_reg (SET_SRC (body), insn, 0, dreg,
- NULL_PTR, 0,
- GET_MODE (SET_DEST (body))))
- {
- /* This handles the case where we have two consecutive
- assignments of the same constant to pseudos that didn't
- get a hard reg. Each SET from the constant will be
- converted into a SET of the spill register and an
- output reload will be made following it. This produces
- two loads of the same constant into the same spill
- register. */
-
- rtx in_insn = insn;
-
- /* Look back for a death note for the first reg.
- If there is one, it is no longer accurate. */
- while (in_insn && GET_CODE (in_insn) != CODE_LABEL)
- {
- if ((GET_CODE (in_insn) == INSN
- || GET_CODE (in_insn) == JUMP_INSN)
- && find_regno_note (in_insn, REG_DEAD, dreg))
- {
- remove_death (dreg, in_insn);
- break;
- }
- in_insn = PREV_INSN (in_insn);
- }
-
- /* Delete the second load of the value. */
- delete_insn (insn);
- }
- }
- else if (GET_CODE (body) == PARALLEL)
- {
- /* If each part is a set between two identical registers or
- a USE or CLOBBER, delete the insn. */
- int i, sreg, dreg;
- rtx tem;
-
- for (i = XVECLEN (body, 0) - 1; i >= 0; i--)
- {
- tem = XVECEXP (body, 0, i);
- if (GET_CODE (tem) == USE || GET_CODE (tem) == CLOBBER)
- continue;
-
- if (GET_CODE (tem) != SET
- || (sreg = true_regnum (SET_SRC (tem))) < 0
- || (dreg = true_regnum (SET_DEST (tem))) < 0
- || dreg != sreg)
- break;
- }
-
- if (i < 0)
- delete_insn (insn);
- }
- /* Also delete insns to store bit fields if they are no-ops. */
- /* Not worth the hair to detect this in the big-endian case. */
- else if (! BYTES_BIG_ENDIAN
- && GET_CODE (body) == SET
- && GET_CODE (SET_DEST (body)) == ZERO_EXTRACT
- && XEXP (SET_DEST (body), 2) == const0_rtx
- && XEXP (SET_DEST (body), 0) == SET_SRC (body)
- && ! (GET_CODE (SET_SRC (body)) == MEM
- && MEM_VOLATILE_P (SET_SRC (body))))
- delete_insn (insn);
- }
- insn = next;
- }
-
- /* If we haven't yet gotten to reload and we have just run regscan,
- delete any insn that sets a register that isn't used elsewhere.
- This helps some of the optimizations below by having less insns
- being jumped around. */
-
- if (! reload_completed && after_regscan)
- for (insn = f; insn; insn = next)
- {
- rtx set = single_set (insn);
-
- next = NEXT_INSN (insn);
-
- if (set && GET_CODE (SET_DEST (set)) == REG
- && REGNO (SET_DEST (set)) >= FIRST_PSEUDO_REGISTER
- && regno_first_uid[REGNO (SET_DEST (set))] == INSN_UID (insn)
- /* We use regno_last_note_uid so as not to delete the setting
- of a reg that's used in notes. A subsequent optimization
- might arrange to use that reg for real. */
- && regno_last_note_uid[REGNO (SET_DEST (set))] == INSN_UID (insn)
- && ! side_effects_p (SET_SRC (set))
- && ! find_reg_note (insn, REG_RETVAL, 0))
- delete_insn (insn);
- }
-
- /* Now iterate optimizing jumps until nothing changes over one pass. */
- changed = 1;
- while (changed)
- {
- changed = 0;
-
- for (insn = f; insn; insn = next)
- {
- rtx reallabelprev;
- rtx temp, temp1, temp2, temp3, temp4, temp5, temp6;
- rtx nlabel;
- int this_is_simplejump, this_is_condjump, reversep;
- int this_is_condjump_in_parallel;
-#if 0
- /* If NOT the first iteration, if this is the last jump pass
- (just before final), do the special peephole optimizations.
- Avoiding the first iteration gives ordinary jump opts
- a chance to work before peephole opts. */
-
- if (reload_completed && !first && !flag_no_peephole)
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN)
- peephole (insn);
-#endif
-
- /* That could have deleted some insns after INSN, so check now
- what the following insn is. */
-
- next = NEXT_INSN (insn);
-
- /* See if this is a NOTE_INSN_LOOP_BEG followed by an unconditional
- jump. Try to optimize by duplicating the loop exit test if so.
- This is only safe immediately after regscan, because it uses
- the values of regno_first_uid and regno_last_uid. */
- if (after_regscan && GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
- && (temp1 = next_nonnote_insn (insn)) != 0
- && simplejump_p (temp1))
- {
- temp = PREV_INSN (insn);
- if (duplicate_loop_exit_test (insn))
- {
- changed = 1;
- next = NEXT_INSN (temp);
- continue;
- }
- }
-
- if (GET_CODE (insn) != JUMP_INSN)
- continue;
-
- this_is_simplejump = simplejump_p (insn);
- this_is_condjump = condjump_p (insn);
- this_is_condjump_in_parallel = condjump_in_parallel_p (insn);
-
- /* Tension the labels in dispatch tables. */
-
- if (GET_CODE (PATTERN (insn)) == ADDR_VEC)
- changed |= tension_vector_labels (PATTERN (insn), 0);
- if (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
- changed |= tension_vector_labels (PATTERN (insn), 1);
-
- /* If a dispatch table always goes to the same place,
- get rid of it and replace the insn that uses it. */
-
- if (GET_CODE (PATTERN (insn)) == ADDR_VEC
- || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
- {
- int i;
- rtx pat = PATTERN (insn);
- int diff_vec_p = GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC;
- int len = XVECLEN (pat, diff_vec_p);
- rtx dispatch = prev_real_insn (insn);
-
- for (i = 0; i < len; i++)
- if (XEXP (XVECEXP (pat, diff_vec_p, i), 0)
- != XEXP (XVECEXP (pat, diff_vec_p, 0), 0))
- break;
- if (i == len
- && dispatch != 0
- && GET_CODE (dispatch) == JUMP_INSN
- && JUMP_LABEL (dispatch) != 0
- /* Don't mess with a casesi insn. */
- && !(GET_CODE (PATTERN (dispatch)) == SET
- && (GET_CODE (SET_SRC (PATTERN (dispatch)))
- == IF_THEN_ELSE))
- && next_real_insn (JUMP_LABEL (dispatch)) == insn)
- {
- redirect_tablejump (dispatch,
- XEXP (XVECEXP (pat, diff_vec_p, 0), 0));
- changed = 1;
- }
- }
-
- reallabelprev = prev_active_insn (JUMP_LABEL (insn));
-
- /* If a jump references the end of the function, try to turn
- it into a RETURN insn, possibly a conditional one. */
- if (JUMP_LABEL (insn)
- && (next_active_insn (JUMP_LABEL (insn)) == 0
- || GET_CODE (PATTERN (next_active_insn (JUMP_LABEL (insn))))
- == RETURN))
- changed |= redirect_jump (insn, NULL_RTX);
-
- /* Detect jump to following insn. */
- if (reallabelprev == insn && condjump_p (insn))
- {
- next = next_real_insn (JUMP_LABEL (insn));
- delete_jump (insn);
- changed = 1;
- continue;
- }
-
- /* If we have an unconditional jump preceded by a USE, try to put
- the USE before the target and jump there. This simplifies many
- of the optimizations below since we don't have to worry about
- dealing with these USE insns. We only do this if the label
- being branch to already has the identical USE or if code
- never falls through to that label. */
-
- if (this_is_simplejump
- && (temp = prev_nonnote_insn (insn)) != 0
- && GET_CODE (temp) == INSN && GET_CODE (PATTERN (temp)) == USE
- && (temp1 = prev_nonnote_insn (JUMP_LABEL (insn))) != 0
- && (GET_CODE (temp1) == BARRIER
- || (GET_CODE (temp1) == INSN
- && rtx_equal_p (PATTERN (temp), PATTERN (temp1))))
- /* Don't do this optimization if we have a loop containing only
- the USE instruction, and the loop start label has a usage
- count of 1. This is because we will redo this optimization
- everytime through the outer loop, and jump opt will never
- exit. */
- && ! ((temp2 = prev_nonnote_insn (temp)) != 0
- && temp2 == JUMP_LABEL (insn)
- && LABEL_NUSES (temp2) == 1))
- {
- if (GET_CODE (temp1) == BARRIER)
- {
- emit_insn_after (PATTERN (temp), temp1);
- temp1 = NEXT_INSN (temp1);
- }
-
- delete_insn (temp);
- redirect_jump (insn, get_label_before (temp1));
- reallabelprev = prev_real_insn (temp1);
- changed = 1;
- }
-
- /* Simplify if (...) x = a; else x = b; by converting it
- to x = b; if (...) x = a;
- if B is sufficiently simple, the test doesn't involve X,
- and nothing in the test modifies B or X.
-
- If we have small register classes, we also can't do this if X
- is a hard register.
-
- If the "x = b;" insn has any REG_NOTES, we don't do this because
- of the possibility that we are running after CSE and there is a
- REG_EQUAL note that is only valid if the branch has already been
- taken. If we move the insn with the REG_EQUAL note, we may
- fold the comparison to always be false in a later CSE pass.
- (We could also delete the REG_NOTES when moving the insn, but it
- seems simpler to not move it.) An exception is that we can move
- the insn if the only note is a REG_EQUAL or REG_EQUIV whose
- value is the same as "b".
-
- INSN is the branch over the `else' part.
-
- We set:
-
- TEMP to the jump insn preceding "x = a;"
- TEMP1 to X
- TEMP2 to the insn that sets "x = b;"
- TEMP3 to the insn that sets "x = a;"
- TEMP4 to the set of "x = b"; */
-
- if (this_is_simplejump
- && (temp3 = prev_active_insn (insn)) != 0
- && GET_CODE (temp3) == INSN
- && (temp4 = single_set (temp3)) != 0
- && GET_CODE (temp1 = SET_DEST (temp4)) == REG
-#ifdef SMALL_REGISTER_CLASSES
- && (! SMALL_REGISTER_CLASSES
- || REGNO (temp1) >= FIRST_PSEUDO_REGISTER)
-#endif
- && (temp2 = next_active_insn (insn)) != 0
- && GET_CODE (temp2) == INSN
- && (temp4 = single_set (temp2)) != 0
- && rtx_equal_p (SET_DEST (temp4), temp1)
- && (GET_CODE (SET_SRC (temp4)) == REG
- || GET_CODE (SET_SRC (temp4)) == SUBREG
- || CONSTANT_P (SET_SRC (temp4)))
- && (REG_NOTES (temp2) == 0
- || ((REG_NOTE_KIND (REG_NOTES (temp2)) == REG_EQUAL
- || REG_NOTE_KIND (REG_NOTES (temp2)) == REG_EQUIV)
- && XEXP (REG_NOTES (temp2), 1) == 0
- && rtx_equal_p (XEXP (REG_NOTES (temp2), 0),
- SET_SRC (temp4))))
- && (temp = prev_active_insn (temp3)) != 0
- && condjump_p (temp) && ! simplejump_p (temp)
- /* TEMP must skip over the "x = a;" insn */
- && prev_real_insn (JUMP_LABEL (temp)) == insn
- && no_labels_between_p (insn, JUMP_LABEL (temp))
- /* There must be no other entries to the "x = b;" insn. */
- && no_labels_between_p (JUMP_LABEL (temp), temp2)
- /* INSN must either branch to the insn after TEMP2 or the insn
- after TEMP2 must branch to the same place as INSN. */
- && (reallabelprev == temp2
- || ((temp5 = next_active_insn (temp2)) != 0
- && simplejump_p (temp5)
- && JUMP_LABEL (temp5) == JUMP_LABEL (insn))))
- {
- /* The test expression, X, may be a complicated test with
- multiple branches. See if we can find all the uses of
- the label that TEMP branches to without hitting a CALL_INSN
- or a jump to somewhere else. */
- rtx target = JUMP_LABEL (temp);
- int nuses = LABEL_NUSES (target);
- rtx p, q;
-
- /* Set P to the first jump insn that goes around "x = a;". */
- for (p = temp; nuses && p; p = prev_nonnote_insn (p))
- {
- if (GET_CODE (p) == JUMP_INSN)
- {
- if (condjump_p (p) && ! simplejump_p (p)
- && JUMP_LABEL (p) == target)
- {
- nuses--;
- if (nuses == 0)
- break;
- }
- else
- break;
- }
- else if (GET_CODE (p) == CALL_INSN)
- break;
- }
-
-#ifdef HAVE_cc0
- /* We cannot insert anything between a set of cc and its use
- so if P uses cc0, we must back up to the previous insn. */
- q = prev_nonnote_insn (p);
- if (q && GET_RTX_CLASS (GET_CODE (q)) == 'i'
- && sets_cc0_p (PATTERN (q)))
- p = q;
-#endif
-
- if (p)
- p = PREV_INSN (p);
-
- /* If we found all the uses and there was no data conflict, we
- can move the assignment unless we can branch into the middle
- from somewhere. */
- if (nuses == 0 && p
- && no_labels_between_p (p, insn)
- && ! reg_referenced_between_p (temp1, p, NEXT_INSN (temp3))
- && ! reg_set_between_p (temp1, p, temp3)
- && (GET_CODE (SET_SRC (temp4)) == CONST_INT
- || ! reg_set_between_p (SET_SRC (temp4), p, temp2)))
- {
- emit_insn_after_with_line_notes (PATTERN (temp2), p, temp2);
- delete_insn (temp2);
-
- /* Set NEXT to an insn that we know won't go away. */
- next = next_active_insn (insn);
-
- /* Delete the jump around the set. Note that we must do
- this before we redirect the test jumps so that it won't
- delete the code immediately following the assignment
- we moved (which might be a jump). */
-
- delete_insn (insn);
-
- /* We either have two consecutive labels or a jump to
- a jump, so adjust all the JUMP_INSNs to branch to where
- INSN branches to. */
- for (p = NEXT_INSN (p); p != next; p = NEXT_INSN (p))
- if (GET_CODE (p) == JUMP_INSN)
- redirect_jump (p, target);
-
- changed = 1;
- continue;
- }
- }
-
- /* Simplify if (...) { x = a; goto l; } x = b; by converting it
- to x = a; if (...) goto l; x = b;
- if A is sufficiently simple, the test doesn't involve X,
- and nothing in the test modifies A or X.
-
- If we have small register classes, we also can't do this if X
- is a hard register.
-
- If the "x = a;" insn has any REG_NOTES, we don't do this because
- of the possibility that we are running after CSE and there is a
- REG_EQUAL note that is only valid if the branch has already been
- taken. If we move the insn with the REG_EQUAL note, we may
- fold the comparison to always be false in a later CSE pass.
- (We could also delete the REG_NOTES when moving the insn, but it
- seems simpler to not move it.) An exception is that we can move
- the insn if the only note is a REG_EQUAL or REG_EQUIV whose
- value is the same as "a".
-
- INSN is the goto.
-
- We set:
-
- TEMP to the jump insn preceding "x = a;"
- TEMP1 to X
- TEMP2 to the insn that sets "x = b;"
- TEMP3 to the insn that sets "x = a;"
- TEMP4 to the set of "x = a"; */
-
- if (this_is_simplejump
- && (temp2 = next_active_insn (insn)) != 0
- && GET_CODE (temp2) == INSN
- && (temp4 = single_set (temp2)) != 0
- && GET_CODE (temp1 = SET_DEST (temp4)) == REG
-#ifdef SMALL_REGISTER_CLASSES
- && (! SMALL_REGISTER_CLASSES
- || REGNO (temp1) >= FIRST_PSEUDO_REGISTER)
-#endif
-
- && (temp3 = prev_active_insn (insn)) != 0
- && GET_CODE (temp3) == INSN
- && (temp4 = single_set (temp3)) != 0
- && rtx_equal_p (SET_DEST (temp4), temp1)
- && (GET_CODE (SET_SRC (temp4)) == REG
- || GET_CODE (SET_SRC (temp4)) == SUBREG
- || CONSTANT_P (SET_SRC (temp4)))
- && (REG_NOTES (temp3) == 0
- || ((REG_NOTE_KIND (REG_NOTES (temp3)) == REG_EQUAL
- || REG_NOTE_KIND (REG_NOTES (temp3)) == REG_EQUIV)
- && XEXP (REG_NOTES (temp3), 1) == 0
- && rtx_equal_p (XEXP (REG_NOTES (temp3), 0),
- SET_SRC (temp4))))
- && (temp = prev_active_insn (temp3)) != 0
- && condjump_p (temp) && ! simplejump_p (temp)
- /* TEMP must skip over the "x = a;" insn */
- && prev_real_insn (JUMP_LABEL (temp)) == insn
- && no_labels_between_p (temp, insn))
- {
- rtx prev_label = JUMP_LABEL (temp);
- rtx insert_after = prev_nonnote_insn (temp);
-
-#ifdef HAVE_cc0
- /* We cannot insert anything between a set of cc and its use. */
- if (insert_after && GET_RTX_CLASS (GET_CODE (insert_after)) == 'i'
- && sets_cc0_p (PATTERN (insert_after)))
- insert_after = prev_nonnote_insn (insert_after);
-#endif
- ++LABEL_NUSES (prev_label);
-
- if (insert_after
- && no_labels_between_p (insert_after, temp)
- && ! reg_referenced_between_p (temp1, insert_after, temp3)
- && ! reg_referenced_between_p (temp1, temp3,
- NEXT_INSN (temp2))
- && ! reg_set_between_p (temp1, insert_after, temp)
- && (GET_CODE (SET_SRC (temp4)) == CONST_INT
- || ! reg_set_between_p (SET_SRC (temp4),
- insert_after, temp))
- && invert_jump (temp, JUMP_LABEL (insn)))
- {
- emit_insn_after_with_line_notes (PATTERN (temp3),
- insert_after, temp3);
- delete_insn (temp3);
- delete_insn (insn);
- /* Set NEXT to an insn that we know won't go away. */
- next = temp2;
- changed = 1;
- }
- if (prev_label && --LABEL_NUSES (prev_label) == 0)
- delete_insn (prev_label);
- if (changed)
- continue;
- }
-
-#ifndef HAVE_cc0
- /* If we have if (...) x = exp; and branches are expensive,
- EXP is a single insn, does not have any side effects, cannot
- trap, and is not too costly, convert this to
- t = exp; if (...) x = t;
-
- Don't do this when we have CC0 because it is unlikely to help
- and we'd need to worry about where to place the new insn and
- the potential for conflicts. We also can't do this when we have
- notes on the insn for the same reason as above.
-
- We set:
-
- TEMP to the "x = exp;" insn.
- TEMP1 to the single set in the "x = exp; insn.
- TEMP2 to "x". */
-
- if (! reload_completed
- && this_is_condjump && ! this_is_simplejump
- && BRANCH_COST >= 3
- && (temp = next_nonnote_insn (insn)) != 0
- && GET_CODE (temp) == INSN
- && REG_NOTES (temp) == 0
- && (reallabelprev == temp
- || ((temp2 = next_active_insn (temp)) != 0
- && simplejump_p (temp2)
- && JUMP_LABEL (temp2) == JUMP_LABEL (insn)))
- && (temp1 = single_set (temp)) != 0
- && (temp2 = SET_DEST (temp1), GET_CODE (temp2) == REG)
- && GET_MODE_CLASS (GET_MODE (temp2)) == MODE_INT
-#ifdef SMALL_REGISTER_CLASSES
- && (! SMALL_REGISTER_CLASSES
- || REGNO (temp2) >= FIRST_PSEUDO_REGISTER)
-#endif
- && GET_CODE (SET_SRC (temp1)) != REG
- && GET_CODE (SET_SRC (temp1)) != SUBREG
- && GET_CODE (SET_SRC (temp1)) != CONST_INT
- && ! side_effects_p (SET_SRC (temp1))
- && ! may_trap_p (SET_SRC (temp1))
- && rtx_cost (SET_SRC (temp1), SET) < 10)
- {
- rtx new = gen_reg_rtx (GET_MODE (temp2));
-
- if (validate_change (temp, &SET_DEST (temp1), new, 0))
- {
- next = emit_insn_after (gen_move_insn (temp2, new), insn);
- emit_insn_after_with_line_notes (PATTERN (temp),
- PREV_INSN (insn), temp);
- delete_insn (temp);
- reallabelprev = prev_active_insn (JUMP_LABEL (insn));
- }
- }
-
- /* Similarly, if it takes two insns to compute EXP but they
- have the same destination. Here TEMP3 will be the second
- insn and TEMP4 the SET from that insn. */
-
- if (! reload_completed
- && this_is_condjump && ! this_is_simplejump
- && BRANCH_COST >= 4
- && (temp = next_nonnote_insn (insn)) != 0
- && GET_CODE (temp) == INSN
- && REG_NOTES (temp) == 0
- && (temp3 = next_nonnote_insn (temp)) != 0
- && GET_CODE (temp3) == INSN
- && REG_NOTES (temp3) == 0
- && (reallabelprev == temp3
- || ((temp2 = next_active_insn (temp3)) != 0
- && simplejump_p (temp2)
- && JUMP_LABEL (temp2) == JUMP_LABEL (insn)))
- && (temp1 = single_set (temp)) != 0
- && (temp2 = SET_DEST (temp1), GET_CODE (temp2) == REG)
- && GET_MODE_CLASS (GET_MODE (temp2)) == MODE_INT
-#ifdef SMALL_REGISTER_CLASSES
- && (! SMALL_REGISTER_CLASSES
- || REGNO (temp2) >= FIRST_PSEUDO_REGISTER)
-#endif
- && ! side_effects_p (SET_SRC (temp1))
- && ! may_trap_p (SET_SRC (temp1))
- && rtx_cost (SET_SRC (temp1), SET) < 10
- && (temp4 = single_set (temp3)) != 0
- && rtx_equal_p (SET_DEST (temp4), temp2)
- && ! side_effects_p (SET_SRC (temp4))
- && ! may_trap_p (SET_SRC (temp4))
- && rtx_cost (SET_SRC (temp4), SET) < 10)
- {
- rtx new = gen_reg_rtx (GET_MODE (temp2));
-
- if (validate_change (temp, &SET_DEST (temp1), new, 0))
- {
- next = emit_insn_after (gen_move_insn (temp2, new), insn);
- emit_insn_after_with_line_notes (PATTERN (temp),
- PREV_INSN (insn), temp);
- emit_insn_after_with_line_notes
- (replace_rtx (PATTERN (temp3), temp2, new),
- PREV_INSN (insn), temp3);
- delete_insn (temp);
- delete_insn (temp3);
- reallabelprev = prev_active_insn (JUMP_LABEL (insn));
- }
- }
-
- /* Finally, handle the case where two insns are used to
- compute EXP but a temporary register is used. Here we must
- ensure that the temporary register is not used anywhere else. */
-
- if (! reload_completed
- && after_regscan
- && this_is_condjump && ! this_is_simplejump
- && BRANCH_COST >= 4
- && (temp = next_nonnote_insn (insn)) != 0
- && GET_CODE (temp) == INSN
- && REG_NOTES (temp) == 0
- && (temp3 = next_nonnote_insn (temp)) != 0
- && GET_CODE (temp3) == INSN
- && REG_NOTES (temp3) == 0
- && (reallabelprev == temp3
- || ((temp2 = next_active_insn (temp3)) != 0
- && simplejump_p (temp2)
- && JUMP_LABEL (temp2) == JUMP_LABEL (insn)))
- && (temp1 = single_set (temp)) != 0
- && (temp5 = SET_DEST (temp1),
- (GET_CODE (temp5) == REG
- || (GET_CODE (temp5) == SUBREG
- && (temp5 = SUBREG_REG (temp5),
- GET_CODE (temp5) == REG))))
- && REGNO (temp5) >= FIRST_PSEUDO_REGISTER
- && regno_first_uid[REGNO (temp5)] == INSN_UID (temp)
- && regno_last_uid[REGNO (temp5)] == INSN_UID (temp3)
- && ! side_effects_p (SET_SRC (temp1))
- && ! may_trap_p (SET_SRC (temp1))
- && rtx_cost (SET_SRC (temp1), SET) < 10
- && (temp4 = single_set (temp3)) != 0
- && (temp2 = SET_DEST (temp4), GET_CODE (temp2) == REG)
- && GET_MODE_CLASS (GET_MODE (temp2)) == MODE_INT
-#ifdef SMALL_REGISTER_CLASSES
- && (! SMALL_REGISTER_CLASSES
- || REGNO (temp2) >= FIRST_PSEUDO_REGISTER)
-#endif
- && rtx_equal_p (SET_DEST (temp4), temp2)
- && ! side_effects_p (SET_SRC (temp4))
- && ! may_trap_p (SET_SRC (temp4))
- && rtx_cost (SET_SRC (temp4), SET) < 10)
- {
- rtx new = gen_reg_rtx (GET_MODE (temp2));
-
- if (validate_change (temp3, &SET_DEST (temp4), new, 0))
- {
- next = emit_insn_after (gen_move_insn (temp2, new), insn);
- emit_insn_after_with_line_notes (PATTERN (temp),
- PREV_INSN (insn), temp);
- emit_insn_after_with_line_notes (PATTERN (temp3),
- PREV_INSN (insn), temp3);
- delete_insn (temp);
- delete_insn (temp3);
- reallabelprev = prev_active_insn (JUMP_LABEL (insn));
- }
- }
-#endif /* HAVE_cc0 */
-
- /* Try to use a conditional move (if the target has them), or a
- store-flag insn. The general case is:
-
- 1) x = a; if (...) x = b; and
- 2) if (...) x = b;
-
- If the jump would be faster, the machine should not have defined
- the movcc or scc insns!. These cases are often made by the
- previous optimization.
-
- The second case is treated as x = x; if (...) x = b;.
-
- INSN here is the jump around the store. We set:
-
- TEMP to the "x = b;" insn.
- TEMP1 to X.
- TEMP2 to B.
- TEMP3 to A (X in the second case).
- TEMP4 to the condition being tested.
- TEMP5 to the earliest insn used to find the condition. */
-
- if (/* We can't do this after reload has completed. */
- ! reload_completed
- && this_is_condjump && ! this_is_simplejump
- /* Set TEMP to the "x = b;" insn. */
- && (temp = next_nonnote_insn (insn)) != 0
- && GET_CODE (temp) == INSN
- && GET_CODE (PATTERN (temp)) == SET
- && GET_CODE (temp1 = SET_DEST (PATTERN (temp))) == REG
-#ifdef SMALL_REGISTER_CLASSES
- && (! SMALL_REGISTER_CLASSES
- || REGNO (temp1) >= FIRST_PSEUDO_REGISTER)
-#endif
- && (GET_CODE (temp2 = SET_SRC (PATTERN (temp))) == REG
- || GET_CODE (temp2) == SUBREG
- /* ??? How about floating point constants? */
- || GET_CODE (temp2) == CONST_INT)
- /* Allow either form, but prefer the former if both apply.
- There is no point in using the old value of TEMP1 if
- it is a register, since cse will alias them. It can
- lose if the old value were a hard register since CSE
- won't replace hard registers. */
- && (((temp3 = reg_set_last (temp1, insn)) != 0)
- /* Make the latter case look like x = x; if (...) x = b; */
- || (temp3 = temp1, 1))
- /* INSN must either branch to the insn after TEMP or the insn
- after TEMP must branch to the same place as INSN. */
- && (reallabelprev == temp
- || ((temp4 = next_active_insn (temp)) != 0
- && simplejump_p (temp4)
- && JUMP_LABEL (temp4) == JUMP_LABEL (insn)))
- && (temp4 = get_condition (insn, &temp5)) != 0
- /* We must be comparing objects whose modes imply the size.
- We could handle BLKmode if (1) emit_store_flag could
- and (2) we could find the size reliably. */
- && GET_MODE (XEXP (temp4, 0)) != BLKmode
- /* Even if branches are cheap, the store_flag optimization
- can win when the operation to be performed can be
- expressed directly. */
-#ifdef HAVE_cc0
- /* If the previous insn sets CC0 and something else, we can't
- do this since we are going to delete that insn. */
-
- && ! ((temp6 = prev_nonnote_insn (insn)) != 0
- && GET_CODE (temp6) == INSN
- && (sets_cc0_p (PATTERN (temp6)) == -1
- || (sets_cc0_p (PATTERN (temp6)) == 1
- && FIND_REG_INC_NOTE (temp6, NULL_RTX))))
-#endif
- )
- {
-#ifdef HAVE_conditional_move
- /* First try a conditional move. */
- {
- enum rtx_code code = GET_CODE (temp4);
- rtx var = temp1;
- rtx cond0, cond1, aval, bval;
- rtx target;
-
- /* Copy the compared variables into cond0 and cond1, so that
- any side effects performed in or after the old comparison,
- will not affect our compare which will come later. */
- /* ??? Is it possible to just use the comparison in the jump
- insn? After all, we're going to delete it. We'd have
- to modify emit_conditional_move to take a comparison rtx
- instead or write a new function. */
- cond0 = gen_reg_rtx (GET_MODE (XEXP (temp4, 0)));
- /* We want the target to be able to simplify comparisons with
- zero (and maybe other constants as well), so don't create
- pseudos for them. There's no need to either. */
- if (GET_CODE (XEXP (temp4, 1)) == CONST_INT
- || GET_CODE (XEXP (temp4, 1)) == CONST_DOUBLE)
- cond1 = XEXP (temp4, 1);
- else
- cond1 = gen_reg_rtx (GET_MODE (XEXP (temp4, 1)));
-
- aval = temp3;
- bval = temp2;
-
- start_sequence ();
- target = emit_conditional_move (var, code,
- cond0, cond1, VOIDmode,
- aval, bval, GET_MODE (var),
- (code == LTU || code == GEU
- || code == LEU || code == GTU));
-
- if (target)
- {
- rtx seq1,seq2;
-
- /* Save the conditional move sequence but don't emit it
- yet. On some machines, like the alpha, it is possible
- that temp5 == insn, so next generate the sequence that
- saves the compared values and then emit both
- sequences ensuring seq1 occurs before seq2. */
- seq2 = get_insns ();
- end_sequence ();
-
- /* Now that we can't fail, generate the copy insns that
- preserve the compared values. */
- start_sequence ();
- emit_move_insn (cond0, XEXP (temp4, 0));
- if (cond1 != XEXP (temp4, 1))
- emit_move_insn (cond1, XEXP (temp4, 1));
- seq1 = get_insns ();
- end_sequence ();
-
- emit_insns_before (seq1, temp5);
- /* Insert conditional move after insn, to be sure that
- the jump and a possible compare won't be separated */
- emit_insns_after (seq2, insn);
-
- /* ??? We can also delete the insn that sets X to A.
- Flow will do it too though. */
- delete_insn (temp);
- next = NEXT_INSN (insn);
- delete_jump (insn);
- changed = 1;
- continue;
- }
- else
- end_sequence ();
- }
-#endif
-
- /* That didn't work, try a store-flag insn.
-
- We further divide the cases into:
-
- 1) x = a; if (...) x = b; and either A or B is zero,
- 2) if (...) x = 0; and jumps are expensive,
- 3) x = a; if (...) x = b; and A and B are constants where all
- the set bits in A are also set in B and jumps are expensive,
- 4) x = a; if (...) x = b; and A and B non-zero, and jumps are
- more expensive, and
- 5) if (...) x = b; if jumps are even more expensive. */
-
- if (GET_MODE_CLASS (GET_MODE (temp1)) == MODE_INT
- && ((GET_CODE (temp3) == CONST_INT)
- /* Make the latter case look like
- x = x; if (...) x = 0; */
- || (temp3 = temp1,
- ((BRANCH_COST >= 2
- && temp2 == const0_rtx)
- || BRANCH_COST >= 3)))
- /* If B is zero, OK; if A is zero, can only do (1) if we
- can reverse the condition. See if (3) applies possibly
- by reversing the condition. Prefer reversing to (4) when
- branches are very expensive. */
- && (((BRANCH_COST >= 2
- || STORE_FLAG_VALUE == -1
- || (STORE_FLAG_VALUE == 1
- /* Check that the mask is a power of two,
- so that it can probably be generated
- with a shift. */
- && exact_log2 (INTVAL (temp3)) >= 0))
- && (reversep = 0, temp2 == const0_rtx))
- || ((BRANCH_COST >= 2
- || STORE_FLAG_VALUE == -1
- || (STORE_FLAG_VALUE == 1
- && exact_log2 (INTVAL (temp2)) >= 0))
- && temp3 == const0_rtx
- && (reversep = can_reverse_comparison_p (temp4, insn)))
- || (BRANCH_COST >= 2
- && GET_CODE (temp2) == CONST_INT
- && GET_CODE (temp3) == CONST_INT
- && ((INTVAL (temp2) & INTVAL (temp3)) == INTVAL (temp2)
- || ((INTVAL (temp2) & INTVAL (temp3)) == INTVAL (temp3)
- && (reversep = can_reverse_comparison_p (temp4,
- insn)))))
- || BRANCH_COST >= 3)
- )
- {
- enum rtx_code code = GET_CODE (temp4);
- rtx uval, cval, var = temp1;
- int normalizep;
- rtx target;
-
- /* If necessary, reverse the condition. */
- if (reversep)
- code = reverse_condition (code), uval = temp2, cval = temp3;
- else
- uval = temp3, cval = temp2;
-
- /* If CVAL is non-zero, normalize to -1. Otherwise, if UVAL
- is the constant 1, it is best to just compute the result
- directly. If UVAL is constant and STORE_FLAG_VALUE
- includes all of its bits, it is best to compute the flag
- value unnormalized and `and' it with UVAL. Otherwise,
- normalize to -1 and `and' with UVAL. */
- normalizep = (cval != const0_rtx ? -1
- : (uval == const1_rtx ? 1
- : (GET_CODE (uval) == CONST_INT
- && (INTVAL (uval) & ~STORE_FLAG_VALUE) == 0)
- ? 0 : -1));
-
- /* We will be putting the store-flag insn immediately in
- front of the comparison that was originally being done,
- so we know all the variables in TEMP4 will be valid.
- However, this might be in front of the assignment of
- A to VAR. If it is, it would clobber the store-flag
- we will be emitting.
-
- Therefore, emit into a temporary which will be copied to
- VAR immediately after TEMP. */
-
- start_sequence ();
- target = emit_store_flag (gen_reg_rtx (GET_MODE (var)), code,
- XEXP (temp4, 0), XEXP (temp4, 1),
- VOIDmode,
- (code == LTU || code == LEU
- || code == GEU || code == GTU),
- normalizep);
- if (target)
- {
- rtx seq;
- rtx before = insn;
-
- seq = get_insns ();
- end_sequence ();
-
- /* Put the store-flag insns in front of the first insn
- used to compute the condition to ensure that we
- use the same values of them as the current
- comparison. However, the remainder of the insns we
- generate will be placed directly in front of the
- jump insn, in case any of the pseudos we use
- are modified earlier. */
-
- emit_insns_before (seq, temp5);
-
- start_sequence ();
-
- /* Both CVAL and UVAL are non-zero. */
- if (cval != const0_rtx && uval != const0_rtx)
- {
- rtx tem1, tem2;
-
- tem1 = expand_and (uval, target, NULL_RTX);
- if (GET_CODE (cval) == CONST_INT
- && GET_CODE (uval) == CONST_INT
- && (INTVAL (cval) & INTVAL (uval)) == INTVAL (cval))
- tem2 = cval;
- else
- {
- tem2 = expand_unop (GET_MODE (var), one_cmpl_optab,
- target, NULL_RTX, 0);
- tem2 = expand_and (cval, tem2,
- (GET_CODE (tem2) == REG
- ? tem2 : 0));
- }
-
- /* If we usually make new pseudos, do so here. This
- turns out to help machines that have conditional
- move insns. */
- /* ??? Conditional moves have already been handled.
- This may be obsolete. */
-
- if (flag_expensive_optimizations)
- target = 0;
-
- target = expand_binop (GET_MODE (var), ior_optab,
- tem1, tem2, target,
- 1, OPTAB_WIDEN);
- }
- else if (normalizep != 1)
- {
- /* We know that either CVAL or UVAL is zero. If
- UVAL is zero, negate TARGET and `and' with CVAL.
- Otherwise, `and' with UVAL. */
- if (uval == const0_rtx)
- {
- target = expand_unop (GET_MODE (var), one_cmpl_optab,
- target, NULL_RTX, 0);
- uval = cval;
- }
-
- target = expand_and (uval, target,
- (GET_CODE (target) == REG
- && ! preserve_subexpressions_p ()
- ? target : NULL_RTX));
- }
-
- emit_move_insn (var, target);
- seq = get_insns ();
- end_sequence ();
-#ifdef HAVE_cc0
- /* If INSN uses CC0, we must not separate it from the
- insn that sets cc0. */
- if (reg_mentioned_p (cc0_rtx, PATTERN (before)))
- before = prev_nonnote_insn (before);
-#endif
- emit_insns_before (seq, before);
-
- delete_insn (temp);
- next = NEXT_INSN (insn);
- delete_jump (insn);
- changed = 1;
- continue;
- }
- else
- end_sequence ();
- }
- }
-
- /* If branches are expensive, convert
- if (foo) bar++; to bar += (foo != 0);
- and similarly for "bar--;"
-
- INSN is the conditional branch around the arithmetic. We set:
-
- TEMP is the arithmetic insn.
- TEMP1 is the SET doing the arithmetic.
- TEMP2 is the operand being incremented or decremented.
- TEMP3 to the condition being tested.
- TEMP4 to the earliest insn used to find the condition. */
-
- if ((BRANCH_COST >= 2
-#ifdef HAVE_incscc
- || HAVE_incscc
-#endif
-#ifdef HAVE_decscc
- || HAVE_decscc
-#endif
- )
- && ! reload_completed
- && this_is_condjump && ! this_is_simplejump
- && (temp = next_nonnote_insn (insn)) != 0
- && (temp1 = single_set (temp)) != 0
- && (temp2 = SET_DEST (temp1),
- GET_MODE_CLASS (GET_MODE (temp2)) == MODE_INT)
- && GET_CODE (SET_SRC (temp1)) == PLUS
- && (XEXP (SET_SRC (temp1), 1) == const1_rtx
- || XEXP (SET_SRC (temp1), 1) == constm1_rtx)
- && rtx_equal_p (temp2, XEXP (SET_SRC (temp1), 0))
- && ! side_effects_p (temp2)
- && ! may_trap_p (temp2)
- /* INSN must either branch to the insn after TEMP or the insn
- after TEMP must branch to the same place as INSN. */
- && (reallabelprev == temp
- || ((temp3 = next_active_insn (temp)) != 0
- && simplejump_p (temp3)
- && JUMP_LABEL (temp3) == JUMP_LABEL (insn)))
- && (temp3 = get_condition (insn, &temp4)) != 0
- /* We must be comparing objects whose modes imply the size.
- We could handle BLKmode if (1) emit_store_flag could
- and (2) we could find the size reliably. */
- && GET_MODE (XEXP (temp3, 0)) != BLKmode
- && can_reverse_comparison_p (temp3, insn))
- {
- rtx temp6, target = 0, seq, init_insn = 0, init = temp2;
- enum rtx_code code = reverse_condition (GET_CODE (temp3));
-
- start_sequence ();
-
- /* It must be the case that TEMP2 is not modified in the range
- [TEMP4, INSN). The one exception we make is if the insn
- before INSN sets TEMP2 to something which is also unchanged
- in that range. In that case, we can move the initialization
- into our sequence. */
-
- if ((temp5 = prev_active_insn (insn)) != 0
- && no_labels_between_p (temp5, insn)
- && GET_CODE (temp5) == INSN
- && (temp6 = single_set (temp5)) != 0
- && rtx_equal_p (temp2, SET_DEST (temp6))
- && (CONSTANT_P (SET_SRC (temp6))
- || GET_CODE (SET_SRC (temp6)) == REG
- || GET_CODE (SET_SRC (temp6)) == SUBREG))
- {
- emit_insn (PATTERN (temp5));
- init_insn = temp5;
- init = SET_SRC (temp6);
- }
-
- if (CONSTANT_P (init)
- || ! reg_set_between_p (init, PREV_INSN (temp4), insn))
- target = emit_store_flag (gen_reg_rtx (GET_MODE (temp2)), code,
- XEXP (temp3, 0), XEXP (temp3, 1),
- VOIDmode,
- (code == LTU || code == LEU
- || code == GTU || code == GEU), 1);
-
- /* If we can do the store-flag, do the addition or
- subtraction. */
-
- if (target)
- target = expand_binop (GET_MODE (temp2),
- (XEXP (SET_SRC (temp1), 1) == const1_rtx
- ? add_optab : sub_optab),
- temp2, target, temp2, 0, OPTAB_WIDEN);
-
- if (target != 0)
- {
- /* Put the result back in temp2 in case it isn't already.
- Then replace the jump, possible a CC0-setting insn in
- front of the jump, and TEMP, with the sequence we have
- made. */
-
- if (target != temp2)
- emit_move_insn (temp2, target);
-
- seq = get_insns ();
- end_sequence ();
-
- emit_insns_before (seq, temp4);
- delete_insn (temp);
-
- if (init_insn)
- delete_insn (init_insn);
-
- next = NEXT_INSN (insn);
-#ifdef HAVE_cc0
- delete_insn (prev_nonnote_insn (insn));
-#endif
- delete_insn (insn);
- changed = 1;
- continue;
- }
- else
- end_sequence ();
- }
-
- /* Simplify if (...) x = 1; else {...} if (x) ...
- We recognize this case scanning backwards as well.
-
- TEMP is the assignment to x;
- TEMP1 is the label at the head of the second if. */
- /* ?? This should call get_condition to find the values being
- compared, instead of looking for a COMPARE insn when HAVE_cc0
- is not defined. This would allow it to work on the m88k. */
- /* ?? This optimization is only safe before cse is run if HAVE_cc0
- is not defined and the condition is tested by a separate compare
- insn. This is because the code below assumes that the result
- of the compare dies in the following branch.
-
- Not only that, but there might be other insns between the
- compare and branch whose results are live. Those insns need
- to be executed.
-
- A way to fix this is to move the insns at JUMP_LABEL (insn)
- to before INSN. If we are running before flow, they will
- be deleted if they aren't needed. But this doesn't work
- well after flow.
-
- This is really a special-case of jump threading, anyway. The
- right thing to do is to replace this and jump threading with
- much simpler code in cse.
-
- This code has been turned off in the non-cc0 case in the
- meantime. */
-
-#ifdef HAVE_cc0
- else if (this_is_simplejump
- /* Safe to skip USE and CLOBBER insns here
- since they will not be deleted. */
- && (temp = prev_active_insn (insn))
- && no_labels_between_p (temp, insn)
- && GET_CODE (temp) == INSN
- && GET_CODE (PATTERN (temp)) == SET
- && GET_CODE (SET_DEST (PATTERN (temp))) == REG
- && CONSTANT_P (SET_SRC (PATTERN (temp)))
- && (temp1 = next_active_insn (JUMP_LABEL (insn)))
- /* If we find that the next value tested is `x'
- (TEMP1 is the insn where this happens), win. */
- && GET_CODE (temp1) == INSN
- && GET_CODE (PATTERN (temp1)) == SET
-#ifdef HAVE_cc0
- /* Does temp1 `tst' the value of x? */
- && SET_SRC (PATTERN (temp1)) == SET_DEST (PATTERN (temp))
- && SET_DEST (PATTERN (temp1)) == cc0_rtx
- && (temp1 = next_nonnote_insn (temp1))
-#else
- /* Does temp1 compare the value of x against zero? */
- && GET_CODE (SET_SRC (PATTERN (temp1))) == COMPARE
- && XEXP (SET_SRC (PATTERN (temp1)), 1) == const0_rtx
- && (XEXP (SET_SRC (PATTERN (temp1)), 0)
- == SET_DEST (PATTERN (temp)))
- && GET_CODE (SET_DEST (PATTERN (temp1))) == REG
- && (temp1 = find_next_ref (SET_DEST (PATTERN (temp1)), temp1))
-#endif
- && condjump_p (temp1))
- {
- /* Get the if_then_else from the condjump. */
- rtx choice = SET_SRC (PATTERN (temp1));
- if (GET_CODE (choice) == IF_THEN_ELSE)
- {
- enum rtx_code code = GET_CODE (XEXP (choice, 0));
- rtx val = SET_SRC (PATTERN (temp));
- rtx cond
- = simplify_relational_operation (code, GET_MODE (SET_DEST (PATTERN (temp))),
- val, const0_rtx);
- rtx ultimate;
-
- if (cond == const_true_rtx)
- ultimate = XEXP (choice, 1);
- else if (cond == const0_rtx)
- ultimate = XEXP (choice, 2);
- else
- ultimate = 0;
-
- if (ultimate == pc_rtx)
- ultimate = get_label_after (temp1);
- else if (ultimate && GET_CODE (ultimate) != RETURN)
- ultimate = XEXP (ultimate, 0);
-
- if (ultimate && JUMP_LABEL(insn) != ultimate)
- changed |= redirect_jump (insn, ultimate);
- }
- }
-#endif
-
-#if 0
- /* @@ This needs a bit of work before it will be right.
-
- Any type of comparison can be accepted for the first and
- second compare. When rewriting the first jump, we must
- compute the what conditions can reach label3, and use the
- appropriate code. We can not simply reverse/swap the code
- of the first jump. In some cases, the second jump must be
- rewritten also.
-
- For example,
- < == converts to > ==
- < != converts to == >
- etc.
-
- If the code is written to only accept an '==' test for the second
- compare, then all that needs to be done is to swap the condition
- of the first branch.
-
- It is questionable whether we want this optimization anyways,
- since if the user wrote code like this because he/she knew that
- the jump to label1 is taken most of the time, then rewriting
- this gives slower code. */
- /* @@ This should call get_condition to find the values being
- compared, instead of looking for a COMPARE insn when HAVE_cc0
- is not defined. This would allow it to work on the m88k. */
- /* @@ This optimization is only safe before cse is run if HAVE_cc0
- is not defined and the condition is tested by a separate compare
- insn. This is because the code below assumes that the result
- of the compare dies in the following branch. */
-
- /* Simplify test a ~= b
- condjump label1;
- test a == b
- condjump label2;
- jump label3;
- label1:
-
- rewriting as
- test a ~~= b
- condjump label3
- test a == b
- condjump label2
- label1:
-
- where ~= is an inequality, e.g. >, and ~~= is the swapped
- inequality, e.g. <.
-
- We recognize this case scanning backwards.
-
- TEMP is the conditional jump to `label2';
- TEMP1 is the test for `a == b';
- TEMP2 is the conditional jump to `label1';
- TEMP3 is the test for `a ~= b'. */
- else if (this_is_simplejump
- && (temp = prev_active_insn (insn))
- && no_labels_between_p (temp, insn)
- && condjump_p (temp)
- && (temp1 = prev_active_insn (temp))
- && no_labels_between_p (temp1, temp)
- && GET_CODE (temp1) == INSN
- && GET_CODE (PATTERN (temp1)) == SET
-#ifdef HAVE_cc0
- && sets_cc0_p (PATTERN (temp1)) == 1
-#else
- && GET_CODE (SET_SRC (PATTERN (temp1))) == COMPARE
- && GET_CODE (SET_DEST (PATTERN (temp1))) == REG
- && (temp == find_next_ref (SET_DEST (PATTERN (temp1)), temp1))
-#endif
- && (temp2 = prev_active_insn (temp1))
- && no_labels_between_p (temp2, temp1)
- && condjump_p (temp2)
- && JUMP_LABEL (temp2) == next_nonnote_insn (NEXT_INSN (insn))
- && (temp3 = prev_active_insn (temp2))
- && no_labels_between_p (temp3, temp2)
- && GET_CODE (PATTERN (temp3)) == SET
- && rtx_equal_p (SET_DEST (PATTERN (temp3)),
- SET_DEST (PATTERN (temp1)))
- && rtx_equal_p (SET_SRC (PATTERN (temp1)),
- SET_SRC (PATTERN (temp3)))
- && ! inequality_comparisons_p (PATTERN (temp))
- && inequality_comparisons_p (PATTERN (temp2)))
- {
- rtx fallthrough_label = JUMP_LABEL (temp2);
-
- ++LABEL_NUSES (fallthrough_label);
- if (swap_jump (temp2, JUMP_LABEL (insn)))
- {
- delete_insn (insn);
- changed = 1;
- }
-
- if (--LABEL_NUSES (fallthrough_label) == 0)
- delete_insn (fallthrough_label);
- }
-#endif
- /* Simplify if (...) {... x = 1;} if (x) ...
-
- We recognize this case backwards.
-
- TEMP is the test of `x';
- TEMP1 is the assignment to `x' at the end of the
- previous statement. */
- /* @@ This should call get_condition to find the values being
- compared, instead of looking for a COMPARE insn when HAVE_cc0
- is not defined. This would allow it to work on the m88k. */
- /* @@ This optimization is only safe before cse is run if HAVE_cc0
- is not defined and the condition is tested by a separate compare
- insn. This is because the code below assumes that the result
- of the compare dies in the following branch. */
-
- /* ??? This has to be turned off. The problem is that the
- unconditional jump might indirectly end up branching to the
- label between TEMP1 and TEMP. We can't detect this, in general,
- since it may become a jump to there after further optimizations.
- If that jump is done, it will be deleted, so we will retry
- this optimization in the next pass, thus an infinite loop.
-
- The present code prevents this by putting the jump after the
- label, but this is not logically correct. */
-#if 0
- else if (this_is_condjump
- /* Safe to skip USE and CLOBBER insns here
- since they will not be deleted. */
- && (temp = prev_active_insn (insn))
- && no_labels_between_p (temp, insn)
- && GET_CODE (temp) == INSN
- && GET_CODE (PATTERN (temp)) == SET
-#ifdef HAVE_cc0
- && sets_cc0_p (PATTERN (temp)) == 1
- && GET_CODE (SET_SRC (PATTERN (temp))) == REG
-#else
- /* Temp must be a compare insn, we can not accept a register
- to register move here, since it may not be simply a
- tst insn. */
- && GET_CODE (SET_SRC (PATTERN (temp))) == COMPARE
- && XEXP (SET_SRC (PATTERN (temp)), 1) == const0_rtx
- && GET_CODE (XEXP (SET_SRC (PATTERN (temp)), 0)) == REG
- && GET_CODE (SET_DEST (PATTERN (temp))) == REG
- && insn == find_next_ref (SET_DEST (PATTERN (temp)), temp)
-#endif
- /* May skip USE or CLOBBER insns here
- for checking for opportunity, since we
- take care of them later. */
- && (temp1 = prev_active_insn (temp))
- && GET_CODE (temp1) == INSN
- && GET_CODE (PATTERN (temp1)) == SET
-#ifdef HAVE_cc0
- && SET_SRC (PATTERN (temp)) == SET_DEST (PATTERN (temp1))
-#else
- && (XEXP (SET_SRC (PATTERN (temp)), 0)
- == SET_DEST (PATTERN (temp1)))
-#endif
- && CONSTANT_P (SET_SRC (PATTERN (temp1)))
- /* If this isn't true, cse will do the job. */
- && ! no_labels_between_p (temp1, temp))
- {
- /* Get the if_then_else from the condjump. */
- rtx choice = SET_SRC (PATTERN (insn));
- if (GET_CODE (choice) == IF_THEN_ELSE
- && (GET_CODE (XEXP (choice, 0)) == EQ
- || GET_CODE (XEXP (choice, 0)) == NE))
- {
- int want_nonzero = (GET_CODE (XEXP (choice, 0)) == NE);
- rtx last_insn;
- rtx ultimate;
- rtx p;
-
- /* Get the place that condjump will jump to
- if it is reached from here. */
- if ((SET_SRC (PATTERN (temp1)) != const0_rtx)
- == want_nonzero)
- ultimate = XEXP (choice, 1);
- else
- ultimate = XEXP (choice, 2);
- /* Get it as a CODE_LABEL. */
- if (ultimate == pc_rtx)
- ultimate = get_label_after (insn);
- else
- /* Get the label out of the LABEL_REF. */
- ultimate = XEXP (ultimate, 0);
-
- /* Insert the jump immediately before TEMP, specifically
- after the label that is between TEMP1 and TEMP. */
- last_insn = PREV_INSN (temp);
-
- /* If we would be branching to the next insn, the jump
- would immediately be deleted and the re-inserted in
- a subsequent pass over the code. So don't do anything
- in that case. */
- if (next_active_insn (last_insn)
- != next_active_insn (ultimate))
- {
- emit_barrier_after (last_insn);
- p = emit_jump_insn_after (gen_jump (ultimate),
- last_insn);
- JUMP_LABEL (p) = ultimate;
- ++LABEL_NUSES (ultimate);
- if (INSN_UID (ultimate) < max_jump_chain
- && INSN_CODE (p) < max_jump_chain)
- {
- jump_chain[INSN_UID (p)]
- = jump_chain[INSN_UID (ultimate)];
- jump_chain[INSN_UID (ultimate)] = p;
- }
- changed = 1;
- continue;
- }
- }
- }
-#endif
- /* Detect a conditional jump going to the same place
- as an immediately following unconditional jump. */
- else if (this_is_condjump
- && (temp = next_active_insn (insn)) != 0
- && simplejump_p (temp)
- && (next_active_insn (JUMP_LABEL (insn))
- == next_active_insn (JUMP_LABEL (temp))))
- {
- rtx tem = temp;
-
- /* ??? Optional. Disables some optimizations, but makes
- gcov output more accurate with -O. */
- if (flag_test_coverage && !reload_completed)
- for (tem = insn; tem != temp; tem = NEXT_INSN (tem))
- if (GET_CODE (tem) == NOTE && NOTE_LINE_NUMBER (tem) > 0)
- break;
-
- if (tem == temp)
- {
- delete_jump (insn);
- changed = 1;
- continue;
- }
- }
- /* Detect a conditional jump jumping over an unconditional jump. */
-
- else if ((this_is_condjump || this_is_condjump_in_parallel)
- && ! this_is_simplejump
- && reallabelprev != 0
- && GET_CODE (reallabelprev) == JUMP_INSN
- && prev_active_insn (reallabelprev) == insn
- && no_labels_between_p (insn, reallabelprev)
- && simplejump_p (reallabelprev))
- {
- /* When we invert the unconditional jump, we will be
- decrementing the usage count of its old label.
- Make sure that we don't delete it now because that
- might cause the following code to be deleted. */
- rtx prev_uses = prev_nonnote_insn (reallabelprev);
- rtx prev_label = JUMP_LABEL (insn);
-
- if (prev_label)
- ++LABEL_NUSES (prev_label);
-
- if (invert_jump (insn, JUMP_LABEL (reallabelprev)))
- {
- /* It is very likely that if there are USE insns before
- this jump, they hold REG_DEAD notes. These REG_DEAD
- notes are no longer valid due to this optimization,
- and will cause the life-analysis that following passes
- (notably delayed-branch scheduling) to think that
- these registers are dead when they are not.
-
- To prevent this trouble, we just remove the USE insns
- from the insn chain. */
-
- while (prev_uses && GET_CODE (prev_uses) == INSN
- && GET_CODE (PATTERN (prev_uses)) == USE)
- {
- rtx useless = prev_uses;
- prev_uses = prev_nonnote_insn (prev_uses);
- delete_insn (useless);
- }
-
- delete_insn (reallabelprev);
- next = insn;
- changed = 1;
- }
-
- /* We can now safely delete the label if it is unreferenced
- since the delete_insn above has deleted the BARRIER. */
- if (prev_label && --LABEL_NUSES (prev_label) == 0)
- delete_insn (prev_label);
- continue;
- }
- else
- {
- /* Detect a jump to a jump. */
-
- nlabel = follow_jumps (JUMP_LABEL (insn));
- if (nlabel != JUMP_LABEL (insn)
- && redirect_jump (insn, nlabel))
- {
- changed = 1;
- next = insn;
- }
-
- /* Look for if (foo) bar; else break; */
- /* The insns look like this:
- insn = condjump label1;
- ...range1 (some insns)...
- jump label2;
- label1:
- ...range2 (some insns)...
- jump somewhere unconditionally
- label2: */
- {
- rtx label1 = next_label (insn);
- rtx range1end = label1 ? prev_active_insn (label1) : 0;
- /* Don't do this optimization on the first round, so that
- jump-around-a-jump gets simplified before we ask here
- whether a jump is unconditional.
-
- Also don't do it when we are called after reload since
- it will confuse reorg. */
- if (! first
- && (reload_completed ? ! flag_delayed_branch : 1)
- /* Make sure INSN is something we can invert. */
- && condjump_p (insn)
- && label1 != 0
- && JUMP_LABEL (insn) == label1
- && LABEL_NUSES (label1) == 1
- && GET_CODE (range1end) == JUMP_INSN
- && simplejump_p (range1end))
- {
- rtx label2 = next_label (label1);
- rtx range2end = label2 ? prev_active_insn (label2) : 0;
- if (range1end != range2end
- && JUMP_LABEL (range1end) == label2
- && GET_CODE (range2end) == JUMP_INSN
- && GET_CODE (NEXT_INSN (range2end)) == BARRIER
- /* Invert the jump condition, so we
- still execute the same insns in each case. */
- && invert_jump (insn, label1))
- {
- rtx range1beg = next_active_insn (insn);
- rtx range2beg = next_active_insn (label1);
- rtx range1after, range2after;
- rtx range1before, range2before;
- rtx rangenext;
-
- /* Include in each range any notes before it, to be
- sure that we get the line number note if any, even
- if there are other notes here. */
- while (PREV_INSN (range1beg)
- && GET_CODE (PREV_INSN (range1beg)) == NOTE)
- range1beg = PREV_INSN (range1beg);
-
- while (PREV_INSN (range2beg)
- && GET_CODE (PREV_INSN (range2beg)) == NOTE)
- range2beg = PREV_INSN (range2beg);
-
- /* Don't move NOTEs for blocks or loops; shift them
- outside the ranges, where they'll stay put. */
- range1beg = squeeze_notes (range1beg, range1end);
- range2beg = squeeze_notes (range2beg, range2end);
-
- /* Get current surrounds of the 2 ranges. */
- range1before = PREV_INSN (range1beg);
- range2before = PREV_INSN (range2beg);
- range1after = NEXT_INSN (range1end);
- range2after = NEXT_INSN (range2end);
-
- /* Splice range2 where range1 was. */
- NEXT_INSN (range1before) = range2beg;
- PREV_INSN (range2beg) = range1before;
- NEXT_INSN (range2end) = range1after;
- PREV_INSN (range1after) = range2end;
- /* Splice range1 where range2 was. */
- NEXT_INSN (range2before) = range1beg;
- PREV_INSN (range1beg) = range2before;
- NEXT_INSN (range1end) = range2after;
- PREV_INSN (range2after) = range1end;
-
- /* Check for a loop end note between the end of
- range2, and the next code label. If there is one,
- then what we have really seen is
- if (foo) break; end_of_loop;
- and moved the break sequence outside the loop.
- We must move the LOOP_END note to where the
- loop really ends now, or we will confuse loop
- optimization. Stop if we find a LOOP_BEG note
- first, since we don't want to move the LOOP_END
- note in that case. */
- for (;range2after != label2; range2after = rangenext)
- {
- rangenext = NEXT_INSN (range2after);
- if (GET_CODE (range2after) == NOTE)
- {
- if (NOTE_LINE_NUMBER (range2after)
- == NOTE_INSN_LOOP_END)
- {
- NEXT_INSN (PREV_INSN (range2after))
- = rangenext;
- PREV_INSN (rangenext)
- = PREV_INSN (range2after);
- PREV_INSN (range2after)
- = PREV_INSN (range1beg);
- NEXT_INSN (range2after) = range1beg;
- NEXT_INSN (PREV_INSN (range1beg))
- = range2after;
- PREV_INSN (range1beg) = range2after;
- }
- else if (NOTE_LINE_NUMBER (range2after)
- == NOTE_INSN_LOOP_BEG)
- break;
- }
- }
- changed = 1;
- continue;
- }
- }
- }
-
- /* Now that the jump has been tensioned,
- try cross jumping: check for identical code
- before the jump and before its target label. */
-
- /* First, cross jumping of conditional jumps: */
-
- if (cross_jump && condjump_p (insn))
- {
- rtx newjpos, newlpos;
- rtx x = prev_real_insn (JUMP_LABEL (insn));
-
- /* A conditional jump may be crossjumped
- only if the place it jumps to follows
- an opposing jump that comes back here. */
-
- if (x != 0 && ! jump_back_p (x, insn))
- /* We have no opposing jump;
- cannot cross jump this insn. */
- x = 0;
-
- newjpos = 0;
- /* TARGET is nonzero if it is ok to cross jump
- to code before TARGET. If so, see if matches. */
- if (x != 0)
- find_cross_jump (insn, x, 2,
- &newjpos, &newlpos);
-
- if (newjpos != 0)
- {
- do_cross_jump (insn, newjpos, newlpos);
- /* Make the old conditional jump
- into an unconditional one. */
- SET_SRC (PATTERN (insn))
- = gen_rtx (LABEL_REF, VOIDmode, JUMP_LABEL (insn));
- INSN_CODE (insn) = -1;
- emit_barrier_after (insn);
- /* Add to jump_chain unless this is a new label
- whose UID is too large. */
- if (INSN_UID (JUMP_LABEL (insn)) < max_jump_chain)
- {
- jump_chain[INSN_UID (insn)]
- = jump_chain[INSN_UID (JUMP_LABEL (insn))];
- jump_chain[INSN_UID (JUMP_LABEL (insn))] = insn;
- }
- changed = 1;
- next = insn;
- }
- }
-
- /* Cross jumping of unconditional jumps:
- a few differences. */
-
- if (cross_jump && simplejump_p (insn))
- {
- rtx newjpos, newlpos;
- rtx target;
-
- newjpos = 0;
-
- /* TARGET is nonzero if it is ok to cross jump
- to code before TARGET. If so, see if matches. */
- find_cross_jump (insn, JUMP_LABEL (insn), 1,
- &newjpos, &newlpos);
-
- /* If cannot cross jump to code before the label,
- see if we can cross jump to another jump to
- the same label. */
- /* Try each other jump to this label. */
- if (INSN_UID (JUMP_LABEL (insn)) < max_uid)
- for (target = jump_chain[INSN_UID (JUMP_LABEL (insn))];
- target != 0 && newjpos == 0;
- target = jump_chain[INSN_UID (target)])
- if (target != insn
- && JUMP_LABEL (target) == JUMP_LABEL (insn)
- /* Ignore TARGET if it's deleted. */
- && ! INSN_DELETED_P (target))
- find_cross_jump (insn, target, 2,
- &newjpos, &newlpos);
-
- if (newjpos != 0)
- {
- do_cross_jump (insn, newjpos, newlpos);
- changed = 1;
- next = insn;
- }
- }
-
- /* This code was dead in the previous jump.c! */
- if (cross_jump && GET_CODE (PATTERN (insn)) == RETURN)
- {
- /* Return insns all "jump to the same place"
- so we can cross-jump between any two of them. */
-
- rtx newjpos, newlpos, target;
-
- newjpos = 0;
-
- /* If cannot cross jump to code before the label,
- see if we can cross jump to another jump to
- the same label. */
- /* Try each other jump to this label. */
- for (target = jump_chain[0];
- target != 0 && newjpos == 0;
- target = jump_chain[INSN_UID (target)])
- if (target != insn
- && ! INSN_DELETED_P (target)
- && GET_CODE (PATTERN (target)) == RETURN)
- find_cross_jump (insn, target, 2,
- &newjpos, &newlpos);
-
- if (newjpos != 0)
- {
- do_cross_jump (insn, newjpos, newlpos);
- changed = 1;
- next = insn;
- }
- }
- }
- }
-
- first = 0;
- }
-
- /* Delete extraneous line number notes.
- Note that two consecutive notes for different lines are not really
- extraneous. There should be some indication where that line belonged,
- even if it became empty. */
-
- {
- rtx last_note = 0;
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) >= 0)
- {
- /* Delete this note if it is identical to previous note. */
- if (last_note
- && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last_note)
- && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last_note))
- {
- delete_insn (insn);
- continue;
- }
-
- last_note = insn;
- }
- }
-
-#ifdef HAVE_return
- if (HAVE_return)
- {
- /* If we fall through to the epilogue, see if we can insert a RETURN insn
- in front of it. If the machine allows it at this point (we might be
- after reload for a leaf routine), it will improve optimization for it
- to be there. We do this both here and at the start of this pass since
- the RETURN might have been deleted by some of our optimizations. */
- insn = get_last_insn ();
- while (insn && GET_CODE (insn) == NOTE)
- insn = PREV_INSN (insn);
-
- if (insn && GET_CODE (insn) != BARRIER)
- {
- emit_jump_insn (gen_return ());
- emit_barrier ();
- }
- }
-#endif
-
- /* See if there is still a NOTE_INSN_FUNCTION_END in this function.
- If so, delete it, and record that this function can drop off the end. */
-
- insn = last_insn;
- {
- int n_labels = 1;
- while (insn
- /* One label can follow the end-note: the return label. */
- && ((GET_CODE (insn) == CODE_LABEL && n_labels-- > 0)
- /* Ordinary insns can follow it if returning a structure. */
- || GET_CODE (insn) == INSN
- /* If machine uses explicit RETURN insns, no epilogue,
- then one of them follows the note. */
- || (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) == RETURN)
- /* A barrier can follow the return insn. */
- || GET_CODE (insn) == BARRIER
- /* Other kinds of notes can follow also. */
- || (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END)))
- insn = PREV_INSN (insn);
- }
-
- /* Report if control can fall through at the end of the function. */
- if (insn && GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_END)
- {
- can_reach_end = 1;
- delete_insn (insn);
- }
-
- /* Show JUMP_CHAIN no longer valid. */
- jump_chain = 0;
-}
-
-/* LOOP_START is a NOTE_INSN_LOOP_BEG note that is followed by an unconditional
- jump. Assume that this unconditional jump is to the exit test code. If
- the code is sufficiently simple, make a copy of it before INSN,
- followed by a jump to the exit of the loop. Then delete the unconditional
- jump after INSN.
-
- Return 1 if we made the change, else 0.
-
- This is only safe immediately after a regscan pass because it uses the
- values of regno_first_uid and regno_last_uid. */
-
-static int
-duplicate_loop_exit_test (loop_start)
- rtx loop_start;
-{
- rtx insn, set, reg, p, link;
- rtx copy = 0;
- int num_insns = 0;
- rtx exitcode = NEXT_INSN (JUMP_LABEL (next_nonnote_insn (loop_start)));
- rtx lastexit;
- int max_reg = max_reg_num ();
- rtx *reg_map = 0;
-
- /* Scan the exit code. We do not perform this optimization if any insn:
-
- is a CALL_INSN
- is a CODE_LABEL
- has a REG_RETVAL or REG_LIBCALL note (hard to adjust)
- is a NOTE_INSN_LOOP_BEG because this means we have a nested loop
- is a NOTE_INSN_BLOCK_{BEG,END} because duplicating these notes
- are not valid
-
- Also, don't do this if the exit code is more than 20 insns. */
-
- for (insn = exitcode;
- insn
- && ! (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END);
- insn = NEXT_INSN (insn))
- {
- switch (GET_CODE (insn))
- {
- case CODE_LABEL:
- case CALL_INSN:
- return 0;
- case NOTE:
- /* We could be in front of the wrong NOTE_INSN_LOOP_END if there is
- a jump immediately after the loop start that branches outside
- the loop but within an outer loop, near the exit test.
- If we copied this exit test and created a phony
- NOTE_INSN_LOOP_VTOP, this could make instructions immediately
- before the exit test look like these could be safely moved
- out of the loop even if they actually may be never executed.
- This can be avoided by checking here for NOTE_INSN_LOOP_CONT. */
-
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_CONT)
- return 0;
- break;
- case JUMP_INSN:
- case INSN:
- if (++num_insns > 20
- || find_reg_note (insn, REG_RETVAL, NULL_RTX)
- || find_reg_note (insn, REG_LIBCALL, NULL_RTX))
- return 0;
- break;
- }
- }
-
- /* Unless INSN is zero, we can do the optimization. */
- if (insn == 0)
- return 0;
-
- lastexit = insn;
-
- /* See if any insn sets a register only used in the loop exit code and
- not a user variable. If so, replace it with a new register. */
- for (insn = exitcode; insn != lastexit; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN
- && (set = single_set (insn)) != 0
- && ((reg = SET_DEST (set), GET_CODE (reg) == REG)
- || (GET_CODE (reg) == SUBREG
- && (reg = SUBREG_REG (reg), GET_CODE (reg) == REG)))
- && REGNO (reg) >= FIRST_PSEUDO_REGISTER
- && regno_first_uid[REGNO (reg)] == INSN_UID (insn))
- {
- for (p = NEXT_INSN (insn); p != lastexit; p = NEXT_INSN (p))
- if (regno_last_uid[REGNO (reg)] == INSN_UID (p))
- break;
-
- if (p != lastexit)
- {
- /* We can do the replacement. Allocate reg_map if this is the
- first replacement we found. */
- if (reg_map == 0)
- {
- reg_map = (rtx *) alloca (max_reg * sizeof (rtx));
- bzero ((char *) reg_map, max_reg * sizeof (rtx));
- }
-
- REG_LOOP_TEST_P (reg) = 1;
-
- reg_map[REGNO (reg)] = gen_reg_rtx (GET_MODE (reg));
- }
- }
-
- /* Now copy each insn. */
- for (insn = exitcode; insn != lastexit; insn = NEXT_INSN (insn))
- switch (GET_CODE (insn))
- {
- case BARRIER:
- copy = emit_barrier_before (loop_start);
- break;
- case NOTE:
- /* Only copy line-number notes. */
- if (NOTE_LINE_NUMBER (insn) >= 0)
- {
- copy = emit_note_before (NOTE_LINE_NUMBER (insn), loop_start);
- NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn);
- }
- break;
-
- case INSN:
- copy = emit_insn_before (copy_rtx (PATTERN (insn)), loop_start);
- if (reg_map)
- replace_regs (PATTERN (copy), reg_map, max_reg, 1);
-
- mark_jump_label (PATTERN (copy), copy, 0);
-
- /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will
- make them. */
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) != REG_LABEL)
- REG_NOTES (copy)
- = copy_rtx (gen_rtx (EXPR_LIST, REG_NOTE_KIND (link),
- XEXP (link, 0), REG_NOTES (copy)));
- if (reg_map && REG_NOTES (copy))
- replace_regs (REG_NOTES (copy), reg_map, max_reg, 1);
- break;
-
- case JUMP_INSN:
- copy = emit_jump_insn_before (copy_rtx (PATTERN (insn)), loop_start);
- if (reg_map)
- replace_regs (PATTERN (copy), reg_map, max_reg, 1);
- mark_jump_label (PATTERN (copy), copy, 0);
- if (REG_NOTES (insn))
- {
- REG_NOTES (copy) = copy_rtx (REG_NOTES (insn));
- if (reg_map)
- replace_regs (REG_NOTES (copy), reg_map, max_reg, 1);
- }
-
- /* If this is a simple jump, add it to the jump chain. */
-
- if (INSN_UID (copy) < max_jump_chain && JUMP_LABEL (copy)
- && simplejump_p (copy))
- {
- jump_chain[INSN_UID (copy)]
- = jump_chain[INSN_UID (JUMP_LABEL (copy))];
- jump_chain[INSN_UID (JUMP_LABEL (copy))] = copy;
- }
- break;
-
- default:
- abort ();
- }
-
- /* Now clean up by emitting a jump to the end label and deleting the jump
- at the start of the loop. */
- if (! copy || GET_CODE (copy) != BARRIER)
- {
- copy = emit_jump_insn_before (gen_jump (get_label_after (insn)),
- loop_start);
- mark_jump_label (PATTERN (copy), copy, 0);
- if (INSN_UID (copy) < max_jump_chain
- && INSN_UID (JUMP_LABEL (copy)) < max_jump_chain)
- {
- jump_chain[INSN_UID (copy)]
- = jump_chain[INSN_UID (JUMP_LABEL (copy))];
- jump_chain[INSN_UID (JUMP_LABEL (copy))] = copy;
- }
- emit_barrier_before (loop_start);
- }
-
- /* Mark the exit code as the virtual top of the converted loop. */
- emit_note_before (NOTE_INSN_LOOP_VTOP, exitcode);
-
- delete_insn (next_nonnote_insn (loop_start));
-
- return 1;
-}
-
-/* Move all block-beg, block-end, loop-beg, loop-cont, loop-vtop, and
- loop-end notes between START and END out before START. Assume that
- END is not such a note. START may be such a note. Returns the value
- of the new starting insn, which may be different if the original start
- was such a note. */
-
-rtx
-squeeze_notes (start, end)
- rtx start, end;
-{
- rtx insn;
- rtx next;
-
- for (insn = start; insn != end; insn = next)
- {
- next = NEXT_INSN (insn);
- if (GET_CODE (insn) == NOTE
- && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_CONT
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_VTOP))
- {
- if (insn == start)
- start = next;
- else
- {
- rtx prev = PREV_INSN (insn);
- PREV_INSN (insn) = PREV_INSN (start);
- NEXT_INSN (insn) = start;
- NEXT_INSN (PREV_INSN (insn)) = insn;
- PREV_INSN (NEXT_INSN (insn)) = insn;
- NEXT_INSN (prev) = next;
- PREV_INSN (next) = prev;
- }
- }
- }
-
- return start;
-}
-
-/* Compare the instructions before insn E1 with those before E2
- to find an opportunity for cross jumping.
- (This means detecting identical sequences of insns followed by
- jumps to the same place, or followed by a label and a jump
- to that label, and replacing one with a jump to the other.)
-
- Assume E1 is a jump that jumps to label E2
- (that is not always true but it might as well be).
- Find the longest possible equivalent sequences
- and store the first insns of those sequences into *F1 and *F2.
- Store zero there if no equivalent preceding instructions are found.
-
- We give up if we find a label in stream 1.
- Actually we could transfer that label into stream 2. */
-
-static void
-find_cross_jump (e1, e2, minimum, f1, f2)
- rtx e1, e2;
- int minimum;
- rtx *f1, *f2;
-{
- register rtx i1 = e1, i2 = e2;
- register rtx p1, p2;
- int lose = 0;
-
- rtx last1 = 0, last2 = 0;
- rtx afterlast1 = 0, afterlast2 = 0;
- rtx prev1;
-
- *f1 = 0;
- *f2 = 0;
-
- while (1)
- {
- i1 = prev_nonnote_insn (i1);
-
- i2 = PREV_INSN (i2);
- while (i2 && (GET_CODE (i2) == NOTE || GET_CODE (i2) == CODE_LABEL))
- i2 = PREV_INSN (i2);
-
- if (i1 == 0)
- break;
-
- /* Don't allow the range of insns preceding E1 or E2
- to include the other (E2 or E1). */
- if (i2 == e1 || i1 == e2)
- break;
-
- /* If we will get to this code by jumping, those jumps will be
- tensioned to go directly to the new label (before I2),
- so this cross-jumping won't cost extra. So reduce the minimum. */
- if (GET_CODE (i1) == CODE_LABEL)
- {
- --minimum;
- break;
- }
-
- if (i2 == 0 || GET_CODE (i1) != GET_CODE (i2))
- break;
-
- p1 = PATTERN (i1);
- p2 = PATTERN (i2);
-
- /* If this is a CALL_INSN, compare register usage information.
- If we don't check this on stack register machines, the two
- CALL_INSNs might be merged leaving reg-stack.c with mismatching
- numbers of stack registers in the same basic block.
- If we don't check this on machines with delay slots, a delay slot may
- be filled that clobbers a parameter expected by the subroutine.
-
- ??? We take the simple route for now and assume that if they're
- equal, they were constructed identically. */
-
- if (GET_CODE (i1) == CALL_INSN
- && ! rtx_equal_p (CALL_INSN_FUNCTION_USAGE (i1),
- CALL_INSN_FUNCTION_USAGE (i2)))
- lose = 1;
-
-#ifdef STACK_REGS
- /* If cross_jump_death_matters is not 0, the insn's mode
- indicates whether or not the insn contains any stack-like
- regs. */
-
- if (!lose && cross_jump_death_matters && GET_MODE (i1) == QImode)
- {
- /* If register stack conversion has already been done, then
- death notes must also be compared before it is certain that
- the two instruction streams match. */
-
- rtx note;
- HARD_REG_SET i1_regset, i2_regset;
-
- CLEAR_HARD_REG_SET (i1_regset);
- CLEAR_HARD_REG_SET (i2_regset);
-
- for (note = REG_NOTES (i1); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_DEAD
- && STACK_REG_P (XEXP (note, 0)))
- SET_HARD_REG_BIT (i1_regset, REGNO (XEXP (note, 0)));
-
- for (note = REG_NOTES (i2); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_DEAD
- && STACK_REG_P (XEXP (note, 0)))
- SET_HARD_REG_BIT (i2_regset, REGNO (XEXP (note, 0)));
-
- GO_IF_HARD_REG_EQUAL (i1_regset, i2_regset, done);
-
- lose = 1;
-
- done:
- ;
- }
-#endif
-
- /* Don't allow old-style asm or volatile extended asms to be accepted
- for cross jumping purposes. It is conceptually correct to allow
- them, since cross-jumping preserves the dynamic instruction order
- even though it is changing the static instruction order. However,
- if an asm is being used to emit an assembler pseudo-op, such as
- the MIPS `.set reorder' pseudo-op, then the static instruction order
- matters and it must be preserved. */
- if (GET_CODE (p1) == ASM_INPUT || GET_CODE (p2) == ASM_INPUT
- || (GET_CODE (p1) == ASM_OPERANDS && MEM_VOLATILE_P (p1))
- || (GET_CODE (p2) == ASM_OPERANDS && MEM_VOLATILE_P (p2)))
- lose = 1;
-
- if (lose || GET_CODE (p1) != GET_CODE (p2)
- || ! rtx_renumbered_equal_p (p1, p2))
- {
- /* The following code helps take care of G++ cleanups. */
- rtx equiv1;
- rtx equiv2;
-
- if (!lose && GET_CODE (p1) == GET_CODE (p2)
- && ((equiv1 = find_reg_note (i1, REG_EQUAL, NULL_RTX)) != 0
- || (equiv1 = find_reg_note (i1, REG_EQUIV, NULL_RTX)) != 0)
- && ((equiv2 = find_reg_note (i2, REG_EQUAL, NULL_RTX)) != 0
- || (equiv2 = find_reg_note (i2, REG_EQUIV, NULL_RTX)) != 0)
- /* If the equivalences are not to a constant, they may
- reference pseudos that no longer exist, so we can't
- use them. */
- && CONSTANT_P (XEXP (equiv1, 0))
- && rtx_equal_p (XEXP (equiv1, 0), XEXP (equiv2, 0)))
- {
- rtx s1 = single_set (i1);
- rtx s2 = single_set (i2);
- if (s1 != 0 && s2 != 0
- && rtx_renumbered_equal_p (SET_DEST (s1), SET_DEST (s2)))
- {
- validate_change (i1, &SET_SRC (s1), XEXP (equiv1, 0), 1);
- validate_change (i2, &SET_SRC (s2), XEXP (equiv2, 0), 1);
- if (! rtx_renumbered_equal_p (p1, p2))
- cancel_changes (0);
- else if (apply_change_group ())
- goto win;
- }
- }
-
- /* Insns fail to match; cross jumping is limited to the following
- insns. */
-
-#ifdef HAVE_cc0
- /* Don't allow the insn after a compare to be shared by
- cross-jumping unless the compare is also shared.
- Here, if either of these non-matching insns is a compare,
- exclude the following insn from possible cross-jumping. */
- if (sets_cc0_p (p1) || sets_cc0_p (p2))
- last1 = afterlast1, last2 = afterlast2, ++minimum;
-#endif
-
- /* If cross-jumping here will feed a jump-around-jump
- optimization, this jump won't cost extra, so reduce
- the minimum. */
- if (GET_CODE (i1) == JUMP_INSN
- && JUMP_LABEL (i1)
- && prev_real_insn (JUMP_LABEL (i1)) == e1)
- --minimum;
- break;
- }
-
- win:
- if (GET_CODE (p1) != USE && GET_CODE (p1) != CLOBBER)
- {
- /* Ok, this insn is potentially includable in a cross-jump here. */
- afterlast1 = last1, afterlast2 = last2;
- last1 = i1, last2 = i2, --minimum;
- }
- }
-
- if (minimum <= 0 && last1 != 0 && last1 != e1)
- *f1 = last1, *f2 = last2;
-}
-
-static void
-do_cross_jump (insn, newjpos, newlpos)
- rtx insn, newjpos, newlpos;
-{
- /* Find an existing label at this point
- or make a new one if there is none. */
- register rtx label = get_label_before (newlpos);
-
- /* Make the same jump insn jump to the new point. */
- if (GET_CODE (PATTERN (insn)) == RETURN)
- {
- /* Remove from jump chain of returns. */
- delete_from_jump_chain (insn);
- /* Change the insn. */
- PATTERN (insn) = gen_jump (label);
- INSN_CODE (insn) = -1;
- JUMP_LABEL (insn) = label;
- LABEL_NUSES (label)++;
- /* Add to new the jump chain. */
- if (INSN_UID (label) < max_jump_chain
- && INSN_UID (insn) < max_jump_chain)
- {
- jump_chain[INSN_UID (insn)] = jump_chain[INSN_UID (label)];
- jump_chain[INSN_UID (label)] = insn;
- }
- }
- else
- redirect_jump (insn, label);
-
- /* Delete the matching insns before the jump. Also, remove any REG_EQUAL
- or REG_EQUIV note in the NEWLPOS stream that isn't also present in
- the NEWJPOS stream. */
-
- while (newjpos != insn)
- {
- rtx lnote;
-
- for (lnote = REG_NOTES (newlpos); lnote; lnote = XEXP (lnote, 1))
- if ((REG_NOTE_KIND (lnote) == REG_EQUAL
- || REG_NOTE_KIND (lnote) == REG_EQUIV)
- && ! find_reg_note (newjpos, REG_EQUAL, XEXP (lnote, 0))
- && ! find_reg_note (newjpos, REG_EQUIV, XEXP (lnote, 0)))
- remove_note (newlpos, lnote);
-
- delete_insn (newjpos);
- newjpos = next_real_insn (newjpos);
- newlpos = next_real_insn (newlpos);
- }
-}
-
-/* Return the label before INSN, or put a new label there. */
-
-rtx
-get_label_before (insn)
- rtx insn;
-{
- rtx label;
-
- /* Find an existing label at this point
- or make a new one if there is none. */
- label = prev_nonnote_insn (insn);
-
- if (label == 0 || GET_CODE (label) != CODE_LABEL)
- {
- rtx prev = PREV_INSN (insn);
-
- label = gen_label_rtx ();
- emit_label_after (label, prev);
- LABEL_NUSES (label) = 0;
- }
- return label;
-}
-
-/* Return the label after INSN, or put a new label there. */
-
-rtx
-get_label_after (insn)
- rtx insn;
-{
- rtx label;
-
- /* Find an existing label at this point
- or make a new one if there is none. */
- label = next_nonnote_insn (insn);
-
- if (label == 0 || GET_CODE (label) != CODE_LABEL)
- {
- label = gen_label_rtx ();
- emit_label_after (label, insn);
- LABEL_NUSES (label) = 0;
- }
- return label;
-}
-
-/* Return 1 if INSN is a jump that jumps to right after TARGET
- only on the condition that TARGET itself would drop through.
- Assumes that TARGET is a conditional jump. */
-
-static int
-jump_back_p (insn, target)
- rtx insn, target;
-{
- rtx cinsn, ctarget;
- enum rtx_code codei, codet;
-
- if (simplejump_p (insn) || ! condjump_p (insn)
- || simplejump_p (target)
- || target != prev_real_insn (JUMP_LABEL (insn)))
- return 0;
-
- cinsn = XEXP (SET_SRC (PATTERN (insn)), 0);
- ctarget = XEXP (SET_SRC (PATTERN (target)), 0);
-
- codei = GET_CODE (cinsn);
- codet = GET_CODE (ctarget);
-
- if (XEXP (SET_SRC (PATTERN (insn)), 1) == pc_rtx)
- {
- if (! can_reverse_comparison_p (cinsn, insn))
- return 0;
- codei = reverse_condition (codei);
- }
-
- if (XEXP (SET_SRC (PATTERN (target)), 2) == pc_rtx)
- {
- if (! can_reverse_comparison_p (ctarget, target))
- return 0;
- codet = reverse_condition (codet);
- }
-
- return (codei == codet
- && rtx_renumbered_equal_p (XEXP (cinsn, 0), XEXP (ctarget, 0))
- && rtx_renumbered_equal_p (XEXP (cinsn, 1), XEXP (ctarget, 1)));
-}
-
-/* Given a comparison, COMPARISON, inside a conditional jump insn, INSN,
- return non-zero if it is safe to reverse this comparison. It is if our
- floating-point is not IEEE, if this is an NE or EQ comparison, or if
- this is known to be an integer comparison. */
-
-int
-can_reverse_comparison_p (comparison, insn)
- rtx comparison;
- rtx insn;
-{
- rtx arg0;
-
- /* If this is not actually a comparison, we can't reverse it. */
- if (GET_RTX_CLASS (GET_CODE (comparison)) != '<')
- return 0;
-
- if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- /* If this is an NE comparison, it is safe to reverse it to an EQ
- comparison and vice versa, even for floating point. If no operands
- are NaNs, the reversal is valid. If some operand is a NaN, EQ is
- always false and NE is always true, so the reversal is also valid. */
- || flag_fast_math
- || GET_CODE (comparison) == NE
- || GET_CODE (comparison) == EQ)
- return 1;
-
- arg0 = XEXP (comparison, 0);
-
- /* Make sure ARG0 is one of the actual objects being compared. If we
- can't do this, we can't be sure the comparison can be reversed.
-
- Handle cc0 and a MODE_CC register. */
- if ((GET_CODE (arg0) == REG && GET_MODE_CLASS (GET_MODE (arg0)) == MODE_CC)
-#ifdef HAVE_cc0
- || arg0 == cc0_rtx
-#endif
- )
- {
- rtx prev = prev_nonnote_insn (insn);
- rtx set = single_set (prev);
-
- if (set == 0 || SET_DEST (set) != arg0)
- return 0;
-
- arg0 = SET_SRC (set);
-
- if (GET_CODE (arg0) == COMPARE)
- arg0 = XEXP (arg0, 0);
- }
-
- /* We can reverse this if ARG0 is a CONST_INT or if its mode is
- not VOIDmode and neither a MODE_CC nor MODE_FLOAT type. */
- return (GET_CODE (arg0) == CONST_INT
- || (GET_MODE (arg0) != VOIDmode
- && GET_MODE_CLASS (GET_MODE (arg0)) != MODE_CC
- && GET_MODE_CLASS (GET_MODE (arg0)) != MODE_FLOAT));
-}
-
-/* Given an rtx-code for a comparison, return the code
- for the negated comparison.
- WATCH OUT! reverse_condition is not safe to use on a jump
- that might be acting on the results of an IEEE floating point comparison,
- because of the special treatment of non-signaling nans in comparisons.
- Use can_reverse_comparison_p to be sure. */
-
-enum rtx_code
-reverse_condition (code)
- enum rtx_code code;
-{
- switch (code)
- {
- case EQ:
- return NE;
-
- case NE:
- return EQ;
-
- case GT:
- return LE;
-
- case GE:
- return LT;
-
- case LT:
- return GE;
-
- case LE:
- return GT;
-
- case GTU:
- return LEU;
-
- case GEU:
- return LTU;
-
- case LTU:
- return GEU;
-
- case LEU:
- return GTU;
-
- default:
- abort ();
- return UNKNOWN;
- }
-}
-
-/* Similar, but return the code when two operands of a comparison are swapped.
- This IS safe for IEEE floating-point. */
-
-enum rtx_code
-swap_condition (code)
- enum rtx_code code;
-{
- switch (code)
- {
- case EQ:
- case NE:
- return code;
-
- case GT:
- return LT;
-
- case GE:
- return LE;
-
- case LT:
- return GT;
-
- case LE:
- return GE;
-
- case GTU:
- return LTU;
-
- case GEU:
- return LEU;
-
- case LTU:
- return GTU;
-
- case LEU:
- return GEU;
-
- default:
- abort ();
- return UNKNOWN;
- }
-}
-
-/* Given a comparison CODE, return the corresponding unsigned comparison.
- If CODE is an equality comparison or already an unsigned comparison,
- CODE is returned. */
-
-enum rtx_code
-unsigned_condition (code)
- enum rtx_code code;
-{
- switch (code)
- {
- case EQ:
- case NE:
- case GTU:
- case GEU:
- case LTU:
- case LEU:
- return code;
-
- case GT:
- return GTU;
-
- case GE:
- return GEU;
-
- case LT:
- return LTU;
-
- case LE:
- return LEU;
-
- default:
- abort ();
- }
-}
-
-/* Similarly, return the signed version of a comparison. */
-
-enum rtx_code
-signed_condition (code)
- enum rtx_code code;
-{
- switch (code)
- {
- case EQ:
- case NE:
- case GT:
- case GE:
- case LT:
- case LE:
- return code;
-
- case GTU:
- return GT;
-
- case GEU:
- return GE;
-
- case LTU:
- return LT;
-
- case LEU:
- return LE;
-
- default:
- abort ();
- }
-}
-
-/* Return non-zero if CODE1 is more strict than CODE2, i.e., if the
- truth of CODE1 implies the truth of CODE2. */
-
-int
-comparison_dominates_p (code1, code2)
- enum rtx_code code1, code2;
-{
- if (code1 == code2)
- return 1;
-
- switch (code1)
- {
- case EQ:
- if (code2 == LE || code2 == LEU || code2 == GE || code2 == GEU)
- return 1;
- break;
-
- case LT:
- if (code2 == LE || code2 == NE)
- return 1;
- break;
-
- case GT:
- if (code2 == GE || code2 == NE)
- return 1;
- break;
-
- case LTU:
- if (code2 == LEU || code2 == NE)
- return 1;
- break;
-
- case GTU:
- if (code2 == GEU || code2 == NE)
- return 1;
- break;
- }
-
- return 0;
-}
-
-/* Return 1 if INSN is an unconditional jump and nothing else. */
-
-int
-simplejump_p (insn)
- rtx insn;
-{
- return (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) == SET
- && GET_CODE (SET_DEST (PATTERN (insn))) == PC
- && GET_CODE (SET_SRC (PATTERN (insn))) == LABEL_REF);
-}
-
-/* Return nonzero if INSN is a (possibly) conditional jump
- and nothing more. */
-
-int
-condjump_p (insn)
- rtx insn;
-{
- register rtx x = PATTERN (insn);
- if (GET_CODE (x) != SET)
- return 0;
- if (GET_CODE (SET_DEST (x)) != PC)
- return 0;
- if (GET_CODE (SET_SRC (x)) == LABEL_REF)
- return 1;
- if (GET_CODE (SET_SRC (x)) != IF_THEN_ELSE)
- return 0;
- if (XEXP (SET_SRC (x), 2) == pc_rtx
- && (GET_CODE (XEXP (SET_SRC (x), 1)) == LABEL_REF
- || GET_CODE (XEXP (SET_SRC (x), 1)) == RETURN))
- return 1;
- if (XEXP (SET_SRC (x), 1) == pc_rtx
- && (GET_CODE (XEXP (SET_SRC (x), 2)) == LABEL_REF
- || GET_CODE (XEXP (SET_SRC (x), 2)) == RETURN))
- return 1;
- return 0;
-}
-
-/* Return nonzero if INSN is a (possibly) conditional jump
- and nothing more. */
-
-int
-condjump_in_parallel_p (insn)
- rtx insn;
-{
- register rtx x = PATTERN (insn);
-
- if (GET_CODE (x) != PARALLEL)
- return 0;
- else
- x = XVECEXP (x, 0, 0);
-
- if (GET_CODE (x) != SET)
- return 0;
- if (GET_CODE (SET_DEST (x)) != PC)
- return 0;
- if (GET_CODE (SET_SRC (x)) == LABEL_REF)
- return 1;
- if (GET_CODE (SET_SRC (x)) != IF_THEN_ELSE)
- return 0;
- if (XEXP (SET_SRC (x), 2) == pc_rtx
- && (GET_CODE (XEXP (SET_SRC (x), 1)) == LABEL_REF
- || GET_CODE (XEXP (SET_SRC (x), 1)) == RETURN))
- return 1;
- if (XEXP (SET_SRC (x), 1) == pc_rtx
- && (GET_CODE (XEXP (SET_SRC (x), 2)) == LABEL_REF
- || GET_CODE (XEXP (SET_SRC (x), 2)) == RETURN))
- return 1;
- return 0;
-}
-
-/* Return 1 if X is an RTX that does nothing but set the condition codes
- and CLOBBER or USE registers.
- Return -1 if X does explicitly set the condition codes,
- but also does other things. */
-
-int
-sets_cc0_p (x)
- rtx x;
-{
-#ifdef HAVE_cc0
- if (GET_CODE (x) == SET && SET_DEST (x) == cc0_rtx)
- return 1;
- if (GET_CODE (x) == PARALLEL)
- {
- int i;
- int sets_cc0 = 0;
- int other_things = 0;
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- {
- if (GET_CODE (XVECEXP (x, 0, i)) == SET
- && SET_DEST (XVECEXP (x, 0, i)) == cc0_rtx)
- sets_cc0 = 1;
- else if (GET_CODE (XVECEXP (x, 0, i)) == SET)
- other_things = 1;
- }
- return ! sets_cc0 ? 0 : other_things ? -1 : 1;
- }
- return 0;
-#else
- abort ();
-#endif
-}
-
-/* Follow any unconditional jump at LABEL;
- return the ultimate label reached by any such chain of jumps.
- If LABEL is not followed by a jump, return LABEL.
- If the chain loops or we can't find end, return LABEL,
- since that tells caller to avoid changing the insn.
-
- If RELOAD_COMPLETED is 0, we do not chain across a NOTE_INSN_LOOP_BEG or
- a USE or CLOBBER. */
-
-rtx
-follow_jumps (label)
- rtx label;
-{
- register rtx insn;
- register rtx next;
- register rtx value = label;
- register int depth;
-
- for (depth = 0;
- (depth < 10
- && (insn = next_active_insn (value)) != 0
- && GET_CODE (insn) == JUMP_INSN
- && ((JUMP_LABEL (insn) != 0 && simplejump_p (insn))
- || GET_CODE (PATTERN (insn)) == RETURN)
- && (next = NEXT_INSN (insn))
- && GET_CODE (next) == BARRIER);
- depth++)
- {
- /* Don't chain through the insn that jumps into a loop
- from outside the loop,
- since that would create multiple loop entry jumps
- and prevent loop optimization. */
- rtx tem;
- if (!reload_completed)
- for (tem = value; tem != insn; tem = NEXT_INSN (tem))
- if (GET_CODE (tem) == NOTE
- && (NOTE_LINE_NUMBER (tem) == NOTE_INSN_LOOP_BEG
- /* ??? Optional. Disables some optimizations, but makes
- gcov output more accurate with -O. */
- || (flag_test_coverage && NOTE_LINE_NUMBER (tem) > 0)))
- return value;
-
- /* If we have found a cycle, make the insn jump to itself. */
- if (JUMP_LABEL (insn) == label)
- return label;
-
- tem = next_active_insn (JUMP_LABEL (insn));
- if (tem && (GET_CODE (PATTERN (tem)) == ADDR_VEC
- || GET_CODE (PATTERN (tem)) == ADDR_DIFF_VEC))
- break;
-
- value = JUMP_LABEL (insn);
- }
- if (depth == 10)
- return label;
- return value;
-}
-
-/* Assuming that field IDX of X is a vector of label_refs,
- replace each of them by the ultimate label reached by it.
- Return nonzero if a change is made.
- If IGNORE_LOOPS is 0, we do not chain across a NOTE_INSN_LOOP_BEG. */
-
-static int
-tension_vector_labels (x, idx)
- register rtx x;
- register int idx;
-{
- int changed = 0;
- register int i;
- for (i = XVECLEN (x, idx) - 1; i >= 0; i--)
- {
- register rtx olabel = XEXP (XVECEXP (x, idx, i), 0);
- register rtx nlabel = follow_jumps (olabel);
- if (nlabel && nlabel != olabel)
- {
- XEXP (XVECEXP (x, idx, i), 0) = nlabel;
- ++LABEL_NUSES (nlabel);
- if (--LABEL_NUSES (olabel) == 0)
- delete_insn (olabel);
- changed = 1;
- }
- }
- return changed;
-}
-
-/* Find all CODE_LABELs referred to in X, and increment their use counts.
- If INSN is a JUMP_INSN and there is at least one CODE_LABEL referenced
- in INSN, then store one of them in JUMP_LABEL (INSN).
- If INSN is an INSN or a CALL_INSN and there is at least one CODE_LABEL
- referenced in INSN, add a REG_LABEL note containing that label to INSN.
- Also, when there are consecutive labels, canonicalize on the last of them.
-
- Note that two labels separated by a loop-beginning note
- must be kept distinct if we have not yet done loop-optimization,
- because the gap between them is where loop-optimize
- will want to move invariant code to. CROSS_JUMP tells us
- that loop-optimization is done with.
-
- Once reload has completed (CROSS_JUMP non-zero), we need not consider
- two labels distinct if they are separated by only USE or CLOBBER insns. */
-
-static void
-mark_jump_label (x, insn, cross_jump)
- register rtx x;
- rtx insn;
- int cross_jump;
-{
- register RTX_CODE code = GET_CODE (x);
- register int i;
- register char *fmt;
-
- switch (code)
- {
- case PC:
- case CC0:
- case REG:
- case SUBREG:
- case CONST_INT:
- case SYMBOL_REF:
- case CONST_DOUBLE:
- case CLOBBER:
- case CALL:
- return;
-
- case MEM:
- /* If this is a constant-pool reference, see if it is a label. */
- if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)))
- mark_jump_label (get_pool_constant (XEXP (x, 0)), insn, cross_jump);
- break;
-
- case LABEL_REF:
- {
- rtx label = XEXP (x, 0);
- rtx olabel = label;
- rtx note;
- rtx next;
-
- if (GET_CODE (label) != CODE_LABEL)
- abort ();
-
- /* Ignore references to labels of containing functions. */
- if (LABEL_REF_NONLOCAL_P (x))
- break;
-
- /* If there are other labels following this one,
- replace it with the last of the consecutive labels. */
- for (next = NEXT_INSN (label); next; next = NEXT_INSN (next))
- {
- if (GET_CODE (next) == CODE_LABEL)
- label = next;
- else if (cross_jump && GET_CODE (next) == INSN
- && (GET_CODE (PATTERN (next)) == USE
- || GET_CODE (PATTERN (next)) == CLOBBER))
- continue;
- else if (GET_CODE (next) != NOTE)
- break;
- else if (! cross_jump
- && (NOTE_LINE_NUMBER (next) == NOTE_INSN_LOOP_BEG
- || NOTE_LINE_NUMBER (next) == NOTE_INSN_FUNCTION_END
- /* ??? Optional. Disables some optimizations, but
- makes gcov output more accurate with -O. */
- || (flag_test_coverage && NOTE_LINE_NUMBER (next) > 0)))
- break;
- }
-
- XEXP (x, 0) = label;
- ++LABEL_NUSES (label);
-
- if (insn)
- {
- if (GET_CODE (insn) == JUMP_INSN)
- JUMP_LABEL (insn) = label;
-
- /* If we've changed OLABEL and we had a REG_LABEL note
- for it, update it as well. */
- else if (label != olabel
- && (note = find_reg_note (insn, REG_LABEL, olabel)) != 0)
- XEXP (note, 0) = label;
-
- /* Otherwise, add a REG_LABEL note for LABEL unless there already
- is one. */
- else if (! find_reg_note (insn, REG_LABEL, label))
- {
- rtx next = next_real_insn (label);
- /* Don't record labels that refer to dispatch tables.
- This is not necessary, since the tablejump
- references the same label.
- And if we did record them, flow.c would make worse code. */
- if (next == 0
- || ! (GET_CODE (next) == JUMP_INSN
- && (GET_CODE (PATTERN (next)) == ADDR_VEC
- || GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC)))
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_LABEL, label,
- REG_NOTES (insn));
- }
- }
- return;
- }
-
- /* Do walk the labels in a vector, but not the first operand of an
- ADDR_DIFF_VEC. Don't set the JUMP_LABEL of a vector. */
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- {
- int eltnum = code == ADDR_DIFF_VEC ? 1 : 0;
-
- for (i = 0; i < XVECLEN (x, eltnum); i++)
- mark_jump_label (XVECEXP (x, eltnum, i), NULL_RTX, cross_jump);
- return;
- }
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- mark_jump_label (XEXP (x, i), insn, cross_jump);
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- mark_jump_label (XVECEXP (x, i, j), insn, cross_jump);
- }
- }
-}
-
-/* If all INSN does is set the pc, delete it,
- and delete the insn that set the condition codes for it
- if that's what the previous thing was. */
-
-void
-delete_jump (insn)
- rtx insn;
-{
- register rtx set = single_set (insn);
-
- if (set && GET_CODE (SET_DEST (set)) == PC)
- delete_computation (insn);
-}
-
-/* Delete INSN and recursively delete insns that compute values used only
- by INSN. This uses the REG_DEAD notes computed during flow analysis.
- If we are running before flow.c, we need do nothing since flow.c will
- delete dead code. We also can't know if the registers being used are
- dead or not at this point.
-
- Otherwise, look at all our REG_DEAD notes. If a previous insn does
- nothing other than set a register that dies in this insn, we can delete
- that insn as well.
-
- On machines with CC0, if CC0 is used in this insn, we may be able to
- delete the insn that set it. */
-
-static void
-delete_computation (insn)
- rtx insn;
-{
- rtx note, next;
-
-#ifdef HAVE_cc0
- if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
- {
- rtx prev = prev_nonnote_insn (insn);
- /* We assume that at this stage
- CC's are always set explicitly
- and always immediately before the jump that
- will use them. So if the previous insn
- exists to set the CC's, delete it
- (unless it performs auto-increments, etc.). */
- if (prev && GET_CODE (prev) == INSN
- && sets_cc0_p (PATTERN (prev)))
- {
- if (sets_cc0_p (PATTERN (prev)) > 0
- && !FIND_REG_INC_NOTE (prev, NULL_RTX))
- delete_computation (prev);
- else
- /* Otherwise, show that cc0 won't be used. */
- REG_NOTES (prev) = gen_rtx (EXPR_LIST, REG_UNUSED,
- cc0_rtx, REG_NOTES (prev));
- }
- }
-#endif
-
- for (note = REG_NOTES (insn); note; note = next)
- {
- rtx our_prev;
-
- next = XEXP (note, 1);
-
- if (REG_NOTE_KIND (note) != REG_DEAD
- /* Verify that the REG_NOTE is legitimate. */
- || GET_CODE (XEXP (note, 0)) != REG)
- continue;
-
- for (our_prev = prev_nonnote_insn (insn);
- our_prev && GET_CODE (our_prev) == INSN;
- our_prev = prev_nonnote_insn (our_prev))
- {
- /* If we reach a SEQUENCE, it is too complex to try to
- do anything with it, so give up. */
- if (GET_CODE (PATTERN (our_prev)) == SEQUENCE)
- break;
-
- if (GET_CODE (PATTERN (our_prev)) == USE
- && GET_CODE (XEXP (PATTERN (our_prev), 0)) == INSN)
- /* reorg creates USEs that look like this. We leave them
- alone because reorg needs them for its own purposes. */
- break;
-
- if (reg_set_p (XEXP (note, 0), PATTERN (our_prev)))
- {
- if (FIND_REG_INC_NOTE (our_prev, NULL_RTX))
- break;
-
- if (GET_CODE (PATTERN (our_prev)) == PARALLEL)
- {
- /* If we find a SET of something else, we can't
- delete the insn. */
-
- int i;
-
- for (i = 0; i < XVECLEN (PATTERN (our_prev), 0); i++)
- {
- rtx part = XVECEXP (PATTERN (our_prev), 0, i);
-
- if (GET_CODE (part) == SET
- && SET_DEST (part) != XEXP (note, 0))
- break;
- }
-
- if (i == XVECLEN (PATTERN (our_prev), 0))
- delete_computation (our_prev);
- }
- else if (GET_CODE (PATTERN (our_prev)) == SET
- && SET_DEST (PATTERN (our_prev)) == XEXP (note, 0))
- delete_computation (our_prev);
-
- break;
- }
-
- /* If OUR_PREV references the register that dies here, it is an
- additional use. Hence any prior SET isn't dead. However, this
- insn becomes the new place for the REG_DEAD note. */
- if (reg_overlap_mentioned_p (XEXP (note, 0),
- PATTERN (our_prev)))
- {
- XEXP (note, 1) = REG_NOTES (our_prev);
- REG_NOTES (our_prev) = note;
- break;
- }
- }
- }
-
- delete_insn (insn);
-}
-
-/* Delete insn INSN from the chain of insns and update label ref counts.
- May delete some following insns as a consequence; may even delete
- a label elsewhere and insns that follow it.
-
- Returns the first insn after INSN that was not deleted. */
-
-rtx
-delete_insn (insn)
- register rtx insn;
-{
- register rtx next = NEXT_INSN (insn);
- register rtx prev = PREV_INSN (insn);
- register int was_code_label = (GET_CODE (insn) == CODE_LABEL);
- register int dont_really_delete = 0;
-
- while (next && INSN_DELETED_P (next))
- next = NEXT_INSN (next);
-
- /* This insn is already deleted => return first following nondeleted. */
- if (INSN_DELETED_P (insn))
- return next;
-
- /* Don't delete user-declared labels. Convert them to special NOTEs
- instead. */
- if (was_code_label && LABEL_NAME (insn) != 0
- && optimize && ! dont_really_delete)
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED_LABEL;
- NOTE_SOURCE_FILE (insn) = 0;
- dont_really_delete = 1;
- }
- else
- /* Mark this insn as deleted. */
- INSN_DELETED_P (insn) = 1;
-
- /* If this is an unconditional jump, delete it from the jump chain. */
- if (simplejump_p (insn))
- delete_from_jump_chain (insn);
-
- /* If instruction is followed by a barrier,
- delete the barrier too. */
-
- if (next != 0 && GET_CODE (next) == BARRIER)
- {
- INSN_DELETED_P (next) = 1;
- next = NEXT_INSN (next);
- }
-
- /* Patch out INSN (and the barrier if any) */
-
- if (optimize && ! dont_really_delete)
- {
- if (prev)
- {
- NEXT_INSN (prev) = next;
- if (GET_CODE (prev) == INSN && GET_CODE (PATTERN (prev)) == SEQUENCE)
- NEXT_INSN (XVECEXP (PATTERN (prev), 0,
- XVECLEN (PATTERN (prev), 0) - 1)) = next;
- }
-
- if (next)
- {
- PREV_INSN (next) = prev;
- if (GET_CODE (next) == INSN && GET_CODE (PATTERN (next)) == SEQUENCE)
- PREV_INSN (XVECEXP (PATTERN (next), 0, 0)) = prev;
- }
-
- if (prev && NEXT_INSN (prev) == 0)
- set_last_insn (prev);
- }
-
- /* If deleting a jump, decrement the count of the label,
- and delete the label if it is now unused. */
-
- if (GET_CODE (insn) == JUMP_INSN && JUMP_LABEL (insn))
- if (--LABEL_NUSES (JUMP_LABEL (insn)) == 0)
- {
- /* This can delete NEXT or PREV,
- either directly if NEXT is JUMP_LABEL (INSN),
- or indirectly through more levels of jumps. */
- delete_insn (JUMP_LABEL (insn));
- /* I feel a little doubtful about this loop,
- but I see no clean and sure alternative way
- to find the first insn after INSN that is not now deleted.
- I hope this works. */
- while (next && INSN_DELETED_P (next))
- next = NEXT_INSN (next);
- return next;
- }
-
- /* Likewise if we're deleting a dispatch table. */
-
- if (GET_CODE (insn) == JUMP_INSN
- && (GET_CODE (PATTERN (insn)) == ADDR_VEC
- || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC))
- {
- rtx pat = PATTERN (insn);
- int i, diff_vec_p = GET_CODE (pat) == ADDR_DIFF_VEC;
- int len = XVECLEN (pat, diff_vec_p);
-
- for (i = 0; i < len; i++)
- if (--LABEL_NUSES (XEXP (XVECEXP (pat, diff_vec_p, i), 0)) == 0)
- delete_insn (XEXP (XVECEXP (pat, diff_vec_p, i), 0));
- while (next && INSN_DELETED_P (next))
- next = NEXT_INSN (next);
- return next;
- }
-
- while (prev && (INSN_DELETED_P (prev) || GET_CODE (prev) == NOTE))
- prev = PREV_INSN (prev);
-
- /* If INSN was a label and a dispatch table follows it,
- delete the dispatch table. The tablejump must have gone already.
- It isn't useful to fall through into a table. */
-
- if (was_code_label
- && NEXT_INSN (insn) != 0
- && GET_CODE (NEXT_INSN (insn)) == JUMP_INSN
- && (GET_CODE (PATTERN (NEXT_INSN (insn))) == ADDR_VEC
- || GET_CODE (PATTERN (NEXT_INSN (insn))) == ADDR_DIFF_VEC))
- next = delete_insn (NEXT_INSN (insn));
-
- /* If INSN was a label, delete insns following it if now unreachable. */
-
- if (was_code_label && prev && GET_CODE (prev) == BARRIER)
- {
- register RTX_CODE code;
- while (next != 0
- && (GET_RTX_CLASS (code = GET_CODE (next)) == 'i'
- || code == NOTE || code == BARRIER
- || (code == CODE_LABEL && INSN_DELETED_P (next))))
- {
- if (code == NOTE
- && NOTE_LINE_NUMBER (next) != NOTE_INSN_FUNCTION_END)
- next = NEXT_INSN (next);
- /* Keep going past other deleted labels to delete what follows. */
- else if (code == CODE_LABEL && INSN_DELETED_P (next))
- next = NEXT_INSN (next);
- else
- /* Note: if this deletes a jump, it can cause more
- deletion of unreachable code, after a different label.
- As long as the value from this recursive call is correct,
- this invocation functions correctly. */
- next = delete_insn (next);
- }
- }
-
- return next;
-}
-
-/* Advance from INSN till reaching something not deleted
- then return that. May return INSN itself. */
-
-rtx
-next_nondeleted_insn (insn)
- rtx insn;
-{
- while (INSN_DELETED_P (insn))
- insn = NEXT_INSN (insn);
- return insn;
-}
-
-/* Delete a range of insns from FROM to TO, inclusive.
- This is for the sake of peephole optimization, so assume
- that whatever these insns do will still be done by a new
- peephole insn that will replace them. */
-
-void
-delete_for_peephole (from, to)
- register rtx from, to;
-{
- register rtx insn = from;
-
- while (1)
- {
- register rtx next = NEXT_INSN (insn);
- register rtx prev = PREV_INSN (insn);
-
- if (GET_CODE (insn) != NOTE)
- {
- INSN_DELETED_P (insn) = 1;
-
- /* Patch this insn out of the chain. */
- /* We don't do this all at once, because we
- must preserve all NOTEs. */
- if (prev)
- NEXT_INSN (prev) = next;
-
- if (next)
- PREV_INSN (next) = prev;
- }
-
- if (insn == to)
- break;
- insn = next;
- }
-
- /* Note that if TO is an unconditional jump
- we *do not* delete the BARRIER that follows,
- since the peephole that replaces this sequence
- is also an unconditional jump in that case. */
-}
-
-/* Invert the condition of the jump JUMP, and make it jump
- to label NLABEL instead of where it jumps now. */
-
-int
-invert_jump (jump, nlabel)
- rtx jump, nlabel;
-{
- /* We have to either invert the condition and change the label or
- do neither. Either operation could fail. We first try to invert
- the jump. If that succeeds, we try changing the label. If that fails,
- we invert the jump back to what it was. */
-
- if (! invert_exp (PATTERN (jump), jump))
- return 0;
-
- if (redirect_jump (jump, nlabel))
- {
- if (flag_branch_probabilities)
- {
- rtx note = find_reg_note (jump, REG_BR_PROB, 0);
-
- /* An inverted jump means that a probability taken becomes a
- probability not taken. Subtract the branch probability from the
- probability base to convert it back to a taken probability.
- (We don't flip the probability on a branch that's never taken. */
- if (note && XINT (XEXP (note, 0), 0) >= 0)
- XINT (XEXP (note, 0), 0) = REG_BR_PROB_BASE - XINT (XEXP (note, 0), 0);
- }
-
- return 1;
- }
-
- if (! invert_exp (PATTERN (jump), jump))
- /* This should just be putting it back the way it was. */
- abort ();
-
- return 0;
-}
-
-/* Invert the jump condition of rtx X contained in jump insn, INSN.
-
- Return 1 if we can do so, 0 if we cannot find a way to do so that
- matches a pattern. */
-
-int
-invert_exp (x, insn)
- rtx x;
- rtx insn;
-{
- register RTX_CODE code;
- register int i;
- register char *fmt;
-
- code = GET_CODE (x);
-
- if (code == IF_THEN_ELSE)
- {
- register rtx comp = XEXP (x, 0);
- register rtx tem;
-
- /* We can do this in two ways: The preferable way, which can only
- be done if this is not an integer comparison, is to reverse
- the comparison code. Otherwise, swap the THEN-part and ELSE-part
- of the IF_THEN_ELSE. If we can't do either, fail. */
-
- if (can_reverse_comparison_p (comp, insn)
- && validate_change (insn, &XEXP (x, 0),
- gen_rtx (reverse_condition (GET_CODE (comp)),
- GET_MODE (comp), XEXP (comp, 0),
- XEXP (comp, 1)), 0))
- return 1;
-
- tem = XEXP (x, 1);
- validate_change (insn, &XEXP (x, 1), XEXP (x, 2), 1);
- validate_change (insn, &XEXP (x, 2), tem, 1);
- return apply_change_group ();
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- if (! invert_exp (XEXP (x, i), insn))
- return 0;
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (!invert_exp (XVECEXP (x, i, j), insn))
- return 0;
- }
- }
-
- return 1;
-}
-
-/* Make jump JUMP jump to label NLABEL instead of where it jumps now.
- If the old jump target label is unused as a result,
- it and the code following it may be deleted.
-
- If NLABEL is zero, we are to turn the jump into a (possibly conditional)
- RETURN insn.
-
- The return value will be 1 if the change was made, 0 if it wasn't (this
- can only occur for NLABEL == 0). */
-
-int
-redirect_jump (jump, nlabel)
- rtx jump, nlabel;
-{
- register rtx olabel = JUMP_LABEL (jump);
-
- if (nlabel == olabel)
- return 1;
-
- if (! redirect_exp (&PATTERN (jump), olabel, nlabel, jump))
- return 0;
-
- /* If this is an unconditional branch, delete it from the jump_chain of
- OLABEL and add it to the jump_chain of NLABEL (assuming both labels
- have UID's in range and JUMP_CHAIN is valid). */
- if (jump_chain && (simplejump_p (jump)
- || GET_CODE (PATTERN (jump)) == RETURN))
- {
- int label_index = nlabel ? INSN_UID (nlabel) : 0;
-
- delete_from_jump_chain (jump);
- if (label_index < max_jump_chain
- && INSN_UID (jump) < max_jump_chain)
- {
- jump_chain[INSN_UID (jump)] = jump_chain[label_index];
- jump_chain[label_index] = jump;
- }
- }
-
- JUMP_LABEL (jump) = nlabel;
- if (nlabel)
- ++LABEL_NUSES (nlabel);
-
- if (olabel && --LABEL_NUSES (olabel) == 0)
- delete_insn (olabel);
-
- return 1;
-}
-
-/* Delete the instruction JUMP from any jump chain it might be on. */
-
-static void
-delete_from_jump_chain (jump)
- rtx jump;
-{
- int index;
- rtx olabel = JUMP_LABEL (jump);
-
- /* Handle unconditional jumps. */
- if (jump_chain && olabel != 0
- && INSN_UID (olabel) < max_jump_chain
- && simplejump_p (jump))
- index = INSN_UID (olabel);
- /* Handle return insns. */
- else if (jump_chain && GET_CODE (PATTERN (jump)) == RETURN)
- index = 0;
- else return;
-
- if (jump_chain[index] == jump)
- jump_chain[index] = jump_chain[INSN_UID (jump)];
- else
- {
- rtx insn;
-
- for (insn = jump_chain[index];
- insn != 0;
- insn = jump_chain[INSN_UID (insn)])
- if (jump_chain[INSN_UID (insn)] == jump)
- {
- jump_chain[INSN_UID (insn)] = jump_chain[INSN_UID (jump)];
- break;
- }
- }
-}
-
-/* If NLABEL is nonzero, throughout the rtx at LOC,
- alter (LABEL_REF OLABEL) to (LABEL_REF NLABEL). If OLABEL is
- zero, alter (RETURN) to (LABEL_REF NLABEL).
-
- If NLABEL is zero, alter (LABEL_REF OLABEL) to (RETURN) and check
- validity with validate_change. Convert (set (pc) (label_ref olabel))
- to (return).
-
- Return 0 if we found a change we would like to make but it is invalid.
- Otherwise, return 1. */
-
-int
-redirect_exp (loc, olabel, nlabel, insn)
- rtx *loc;
- rtx olabel, nlabel;
- rtx insn;
-{
- register rtx x = *loc;
- register RTX_CODE code = GET_CODE (x);
- register int i;
- register char *fmt;
-
- if (code == LABEL_REF)
- {
- if (XEXP (x, 0) == olabel)
- {
- if (nlabel)
- XEXP (x, 0) = nlabel;
- else
- return validate_change (insn, loc, gen_rtx (RETURN, VOIDmode), 0);
- return 1;
- }
- }
- else if (code == RETURN && olabel == 0)
- {
- x = gen_rtx (LABEL_REF, VOIDmode, nlabel);
- if (loc == &PATTERN (insn))
- x = gen_rtx (SET, VOIDmode, pc_rtx, x);
- return validate_change (insn, loc, x, 0);
- }
-
- if (code == SET && nlabel == 0 && SET_DEST (x) == pc_rtx
- && GET_CODE (SET_SRC (x)) == LABEL_REF
- && XEXP (SET_SRC (x), 0) == olabel)
- return validate_change (insn, loc, gen_rtx (RETURN, VOIDmode), 0);
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- if (! redirect_exp (&XEXP (x, i), olabel, nlabel, insn))
- return 0;
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (! redirect_exp (&XVECEXP (x, i, j), olabel, nlabel, insn))
- return 0;
- }
- }
-
- return 1;
-}
-
-/* Make jump JUMP jump to label NLABEL, assuming it used to be a tablejump.
-
- If the old jump target label (before the dispatch table) becomes unused,
- it and the dispatch table may be deleted. In that case, find the insn
- before the jump references that label and delete it and logical successors
- too. */
-
-static void
-redirect_tablejump (jump, nlabel)
- rtx jump, nlabel;
-{
- register rtx olabel = JUMP_LABEL (jump);
-
- /* Add this jump to the jump_chain of NLABEL. */
- if (jump_chain && INSN_UID (nlabel) < max_jump_chain
- && INSN_UID (jump) < max_jump_chain)
- {
- jump_chain[INSN_UID (jump)] = jump_chain[INSN_UID (nlabel)];
- jump_chain[INSN_UID (nlabel)] = jump;
- }
-
- PATTERN (jump) = gen_jump (nlabel);
- JUMP_LABEL (jump) = nlabel;
- ++LABEL_NUSES (nlabel);
- INSN_CODE (jump) = -1;
-
- if (--LABEL_NUSES (olabel) == 0)
- {
- delete_labelref_insn (jump, olabel, 0);
- delete_insn (olabel);
- }
-}
-
-/* Find the insn referencing LABEL that is a logical predecessor of INSN.
- If we found one, delete it and then delete this insn if DELETE_THIS is
- non-zero. Return non-zero if INSN or a predecessor references LABEL. */
-
-static int
-delete_labelref_insn (insn, label, delete_this)
- rtx insn, label;
- int delete_this;
-{
- int deleted = 0;
- rtx link;
-
- if (GET_CODE (insn) != NOTE
- && reg_mentioned_p (label, PATTERN (insn)))
- {
- if (delete_this)
- {
- delete_insn (insn);
- deleted = 1;
- }
- else
- return 1;
- }
-
- for (link = LOG_LINKS (insn); link; link = XEXP (link, 1))
- if (delete_labelref_insn (XEXP (link, 0), label, 1))
- {
- if (delete_this)
- {
- delete_insn (insn);
- deleted = 1;
- }
- else
- return 1;
- }
-
- return deleted;
-}
-
-/* Like rtx_equal_p except that it considers two REGs as equal
- if they renumber to the same value and considers two commutative
- operations to be the same if the order of the operands has been
- reversed. */
-
-int
-rtx_renumbered_equal_p (x, y)
- rtx x, y;
-{
- register int i;
- register RTX_CODE code = GET_CODE (x);
- register char *fmt;
-
- if (x == y)
- return 1;
-
- if ((code == REG || (code == SUBREG && GET_CODE (SUBREG_REG (x)) == REG))
- && (GET_CODE (y) == REG || (GET_CODE (y) == SUBREG
- && GET_CODE (SUBREG_REG (y)) == REG)))
- {
- int reg_x = -1, reg_y = -1;
- int word_x = 0, word_y = 0;
-
- if (GET_MODE (x) != GET_MODE (y))
- return 0;
-
- /* If we haven't done any renumbering, don't
- make any assumptions. */
- if (reg_renumber == 0)
- return rtx_equal_p (x, y);
-
- if (code == SUBREG)
- {
- reg_x = REGNO (SUBREG_REG (x));
- word_x = SUBREG_WORD (x);
-
- if (reg_renumber[reg_x] >= 0)
- {
- reg_x = reg_renumber[reg_x] + word_x;
- word_x = 0;
- }
- }
-
- else
- {
- reg_x = REGNO (x);
- if (reg_renumber[reg_x] >= 0)
- reg_x = reg_renumber[reg_x];
- }
-
- if (GET_CODE (y) == SUBREG)
- {
- reg_y = REGNO (SUBREG_REG (y));
- word_y = SUBREG_WORD (y);
-
- if (reg_renumber[reg_y] >= 0)
- {
- reg_y = reg_renumber[reg_y];
- word_y = 0;
- }
- }
-
- else
- {
- reg_y = REGNO (y);
- if (reg_renumber[reg_y] >= 0)
- reg_y = reg_renumber[reg_y];
- }
-
- return reg_x >= 0 && reg_x == reg_y && word_x == word_y;
- }
-
- /* Now we have disposed of all the cases
- in which different rtx codes can match. */
- if (code != GET_CODE (y))
- return 0;
-
- switch (code)
- {
- case PC:
- case CC0:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- return 0;
-
- case CONST_INT:
- return INTVAL (x) == INTVAL (y);
-
- case LABEL_REF:
- /* We can't assume nonlocal labels have their following insns yet. */
- if (LABEL_REF_NONLOCAL_P (x) || LABEL_REF_NONLOCAL_P (y))
- return XEXP (x, 0) == XEXP (y, 0);
-
- /* Two label-refs are equivalent if they point at labels
- in the same position in the instruction stream. */
- return (next_real_insn (XEXP (x, 0))
- == next_real_insn (XEXP (y, 0)));
-
- case SYMBOL_REF:
- return XSTR (x, 0) == XSTR (y, 0);
- }
-
- /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent. */
-
- if (GET_MODE (x) != GET_MODE (y))
- return 0;
-
- /* For commutative operations, the RTX match if the operand match in any
- order. Also handle the simple binary and unary cases without a loop. */
- if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c')
- return ((rtx_renumbered_equal_p (XEXP (x, 0), XEXP (y, 0))
- && rtx_renumbered_equal_p (XEXP (x, 1), XEXP (y, 1)))
- || (rtx_renumbered_equal_p (XEXP (x, 0), XEXP (y, 1))
- && rtx_renumbered_equal_p (XEXP (x, 1), XEXP (y, 0))));
- else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == '2')
- return (rtx_renumbered_equal_p (XEXP (x, 0), XEXP (y, 0))
- && rtx_renumbered_equal_p (XEXP (x, 1), XEXP (y, 1)));
- else if (GET_RTX_CLASS (code) == '1')
- return rtx_renumbered_equal_p (XEXP (x, 0), XEXP (y, 0));
-
- /* Compare the elements. If any pair of corresponding elements
- fail to match, return 0 for the whole things. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- register int j;
- switch (fmt[i])
- {
- case 'w':
- if (XWINT (x, i) != XWINT (y, i))
- return 0;
- break;
-
- case 'i':
- if (XINT (x, i) != XINT (y, i))
- return 0;
- break;
-
- case 's':
- if (strcmp (XSTR (x, i), XSTR (y, i)))
- return 0;
- break;
-
- case 'e':
- if (! rtx_renumbered_equal_p (XEXP (x, i), XEXP (y, i)))
- return 0;
- break;
-
- case 'u':
- if (XEXP (x, i) != XEXP (y, i))
- return 0;
- /* fall through. */
- case '0':
- break;
-
- case 'E':
- if (XVECLEN (x, i) != XVECLEN (y, i))
- return 0;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (!rtx_renumbered_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)))
- return 0;
- break;
-
- default:
- abort ();
- }
- }
- return 1;
-}
-
-/* If X is a hard register or equivalent to one or a subregister of one,
- return the hard register number. If X is a pseudo register that was not
- assigned a hard register, return the pseudo register number. Otherwise,
- return -1. Any rtx is valid for X. */
-
-int
-true_regnum (x)
- rtx x;
-{
- if (GET_CODE (x) == REG)
- {
- if (REGNO (x) >= FIRST_PSEUDO_REGISTER && reg_renumber[REGNO (x)] >= 0)
- return reg_renumber[REGNO (x)];
- return REGNO (x);
- }
- if (GET_CODE (x) == SUBREG)
- {
- int base = true_regnum (SUBREG_REG (x));
- if (base >= 0 && base < FIRST_PSEUDO_REGISTER)
- return SUBREG_WORD (x) + base;
- }
- return -1;
-}
-
-/* Optimize code of the form:
-
- for (x = a[i]; x; ...)
- ...
- for (x = a[i]; x; ...)
- ...
- foo:
-
- Loop optimize will change the above code into
-
- if (x = a[i])
- for (;;)
- { ...; if (! (x = ...)) break; }
- if (x = a[i])
- for (;;)
- { ...; if (! (x = ...)) break; }
- foo:
-
- In general, if the first test fails, the program can branch
- directly to `foo' and skip the second try which is doomed to fail.
- We run this after loop optimization and before flow analysis. */
-
-/* When comparing the insn patterns, we track the fact that different
- pseudo-register numbers may have been used in each computation.
- The following array stores an equivalence -- same_regs[I] == J means
- that pseudo register I was used in the first set of tests in a context
- where J was used in the second set. We also count the number of such
- pending equivalences. If nonzero, the expressions really aren't the
- same. */
-
-static int *same_regs;
-
-static int num_same_regs;
-
-/* Track any registers modified between the target of the first jump and
- the second jump. They never compare equal. */
-
-static char *modified_regs;
-
-/* Record if memory was modified. */
-
-static int modified_mem;
-
-/* Called via note_stores on each insn between the target of the first
- branch and the second branch. It marks any changed registers. */
-
-static void
-mark_modified_reg (dest, x)
- rtx dest;
- rtx x;
-{
- int regno, i;
-
- if (GET_CODE (dest) == SUBREG)
- dest = SUBREG_REG (dest);
-
- if (GET_CODE (dest) == MEM)
- modified_mem = 1;
-
- if (GET_CODE (dest) != REG)
- return;
-
- regno = REGNO (dest);
- if (regno >= FIRST_PSEUDO_REGISTER)
- modified_regs[regno] = 1;
- else
- for (i = 0; i < HARD_REGNO_NREGS (regno, GET_MODE (dest)); i++)
- modified_regs[regno + i] = 1;
-}
-
-/* F is the first insn in the chain of insns. */
-
-void
-thread_jumps (f, max_reg, flag_before_loop)
- rtx f;
- int max_reg;
- int flag_before_loop;
-{
- /* Basic algorithm is to find a conditional branch,
- the label it may branch to, and the branch after
- that label. If the two branches test the same condition,
- walk back from both branch paths until the insn patterns
- differ, or code labels are hit. If we make it back to
- the target of the first branch, then we know that the first branch
- will either always succeed or always fail depending on the relative
- senses of the two branches. So adjust the first branch accordingly
- in this case. */
-
- rtx label, b1, b2, t1, t2;
- enum rtx_code code1, code2;
- rtx b1op0, b1op1, b2op0, b2op1;
- int changed = 1;
- int i;
- int *all_reset;
-
- /* Allocate register tables and quick-reset table. */
- modified_regs = (char *) alloca (max_reg * sizeof (char));
- same_regs = (int *) alloca (max_reg * sizeof (int));
- all_reset = (int *) alloca (max_reg * sizeof (int));
- for (i = 0; i < max_reg; i++)
- all_reset[i] = -1;
-
- while (changed)
- {
- changed = 0;
-
- for (b1 = f; b1; b1 = NEXT_INSN (b1))
- {
- /* Get to a candidate branch insn. */
- if (GET_CODE (b1) != JUMP_INSN
- || ! condjump_p (b1) || simplejump_p (b1)
- || JUMP_LABEL (b1) == 0)
- continue;
-
- bzero (modified_regs, max_reg * sizeof (char));
- modified_mem = 0;
-
- bcopy ((char *) all_reset, (char *) same_regs,
- max_reg * sizeof (int));
- num_same_regs = 0;
-
- label = JUMP_LABEL (b1);
-
- /* Look for a branch after the target. Record any registers and
- memory modified between the target and the branch. Stop when we
- get to a label since we can't know what was changed there. */
- for (b2 = NEXT_INSN (label); b2; b2 = NEXT_INSN (b2))
- {
- if (GET_CODE (b2) == CODE_LABEL)
- break;
-
- else if (GET_CODE (b2) == JUMP_INSN)
- {
- /* If this is an unconditional jump and is the only use of
- its target label, we can follow it. */
- if (simplejump_p (b2)
- && JUMP_LABEL (b2) != 0
- && LABEL_NUSES (JUMP_LABEL (b2)) == 1)
- {
- b2 = JUMP_LABEL (b2);
- continue;
- }
- else
- break;
- }
-
- if (GET_CODE (b2) != CALL_INSN && GET_CODE (b2) != INSN)
- continue;
-
- if (GET_CODE (b2) == CALL_INSN)
- {
- modified_mem = 1;
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i] && ! fixed_regs[i]
- && i != STACK_POINTER_REGNUM
- && i != FRAME_POINTER_REGNUM
- && i != HARD_FRAME_POINTER_REGNUM
- && i != ARG_POINTER_REGNUM)
- modified_regs[i] = 1;
- }
-
- note_stores (PATTERN (b2), mark_modified_reg);
- }
-
- /* Check the next candidate branch insn from the label
- of the first. */
- if (b2 == 0
- || GET_CODE (b2) != JUMP_INSN
- || b2 == b1
- || ! condjump_p (b2)
- || simplejump_p (b2))
- continue;
-
- /* Get the comparison codes and operands, reversing the
- codes if appropriate. If we don't have comparison codes,
- we can't do anything. */
- b1op0 = XEXP (XEXP (SET_SRC (PATTERN (b1)), 0), 0);
- b1op1 = XEXP (XEXP (SET_SRC (PATTERN (b1)), 0), 1);
- code1 = GET_CODE (XEXP (SET_SRC (PATTERN (b1)), 0));
- if (XEXP (SET_SRC (PATTERN (b1)), 1) == pc_rtx)
- code1 = reverse_condition (code1);
-
- b2op0 = XEXP (XEXP (SET_SRC (PATTERN (b2)), 0), 0);
- b2op1 = XEXP (XEXP (SET_SRC (PATTERN (b2)), 0), 1);
- code2 = GET_CODE (XEXP (SET_SRC (PATTERN (b2)), 0));
- if (XEXP (SET_SRC (PATTERN (b2)), 1) == pc_rtx)
- code2 = reverse_condition (code2);
-
- /* If they test the same things and knowing that B1 branches
- tells us whether or not B2 branches, check if we
- can thread the branch. */
- if (rtx_equal_for_thread_p (b1op0, b2op0, b2)
- && rtx_equal_for_thread_p (b1op1, b2op1, b2)
- && (comparison_dominates_p (code1, code2)
- || comparison_dominates_p (code1, reverse_condition (code2))))
- {
- t1 = prev_nonnote_insn (b1);
- t2 = prev_nonnote_insn (b2);
-
- while (t1 != 0 && t2 != 0)
- {
- if (t2 == label)
- {
- /* We have reached the target of the first branch.
- If there are no pending register equivalents,
- we know that this branch will either always
- succeed (if the senses of the two branches are
- the same) or always fail (if not). */
- rtx new_label;
-
- if (num_same_regs != 0)
- break;
-
- if (comparison_dominates_p (code1, code2))
- new_label = JUMP_LABEL (b2);
- else
- new_label = get_label_after (b2);
-
- if (JUMP_LABEL (b1) != new_label)
- {
- rtx prev = PREV_INSN (new_label);
-
- if (flag_before_loop
- && NOTE_LINE_NUMBER (prev) == NOTE_INSN_LOOP_BEG)
- {
- /* Don't thread to the loop label. If a loop
- label is reused, loop optimization will
- be disabled for that loop. */
- new_label = gen_label_rtx ();
- emit_label_after (new_label, PREV_INSN (prev));
- }
- changed |= redirect_jump (b1, new_label);
- }
- break;
- }
-
- /* If either of these is not a normal insn (it might be
- a JUMP_INSN, CALL_INSN, or CODE_LABEL) we fail. (NOTEs
- have already been skipped above.) Similarly, fail
- if the insns are different. */
- if (GET_CODE (t1) != INSN || GET_CODE (t2) != INSN
- || recog_memoized (t1) != recog_memoized (t2)
- || ! rtx_equal_for_thread_p (PATTERN (t1),
- PATTERN (t2), t2))
- break;
-
- t1 = prev_nonnote_insn (t1);
- t2 = prev_nonnote_insn (t2);
- }
- }
- }
- }
-}
-
-/* This is like RTX_EQUAL_P except that it knows about our handling of
- possibly equivalent registers and knows to consider volatile and
- modified objects as not equal.
-
- YINSN is the insn containing Y. */
-
-int
-rtx_equal_for_thread_p (x, y, yinsn)
- rtx x, y;
- rtx yinsn;
-{
- register int i;
- register int j;
- register enum rtx_code code;
- register char *fmt;
-
- code = GET_CODE (x);
- /* Rtx's of different codes cannot be equal. */
- if (code != GET_CODE (y))
- return 0;
-
- /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
- (REG:SI x) and (REG:HI x) are NOT equivalent. */
-
- if (GET_MODE (x) != GET_MODE (y))
- return 0;
-
- /* For floating-point, consider everything unequal. This is a bit
- pessimistic, but this pass would only rarely do anything for FP
- anyway. */
- if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
- && FLOAT_MODE_P (GET_MODE (x)) && ! flag_fast_math)
- return 0;
-
- /* For commutative operations, the RTX match if the operand match in any
- order. Also handle the simple binary and unary cases without a loop. */
- if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c')
- return ((rtx_equal_for_thread_p (XEXP (x, 0), XEXP (y, 0), yinsn)
- && rtx_equal_for_thread_p (XEXP (x, 1), XEXP (y, 1), yinsn))
- || (rtx_equal_for_thread_p (XEXP (x, 0), XEXP (y, 1), yinsn)
- && rtx_equal_for_thread_p (XEXP (x, 1), XEXP (y, 0), yinsn)));
- else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == '2')
- return (rtx_equal_for_thread_p (XEXP (x, 0), XEXP (y, 0), yinsn)
- && rtx_equal_for_thread_p (XEXP (x, 1), XEXP (y, 1), yinsn));
- else if (GET_RTX_CLASS (code) == '1')
- return rtx_equal_for_thread_p (XEXP (x, 0), XEXP (y, 0), yinsn);
-
- /* Handle special-cases first. */
- switch (code)
- {
- case REG:
- if (REGNO (x) == REGNO (y) && ! modified_regs[REGNO (x)])
- return 1;
-
- /* If neither is user variable or hard register, check for possible
- equivalence. */
- if (REG_USERVAR_P (x) || REG_USERVAR_P (y)
- || REGNO (x) < FIRST_PSEUDO_REGISTER
- || REGNO (y) < FIRST_PSEUDO_REGISTER)
- return 0;
-
- if (same_regs[REGNO (x)] == -1)
- {
- same_regs[REGNO (x)] = REGNO (y);
- num_same_regs++;
-
- /* If this is the first time we are seeing a register on the `Y'
- side, see if it is the last use. If not, we can't thread the
- jump, so mark it as not equivalent. */
- if (regno_last_uid[REGNO (y)] != INSN_UID (yinsn))
- return 0;
-
- return 1;
- }
- else
- return (same_regs[REGNO (x)] == REGNO (y));
-
- break;
-
- case MEM:
- /* If memory modified or either volatile, not equivalent.
- Else, check address. */
- if (modified_mem || MEM_VOLATILE_P (x) || MEM_VOLATILE_P (y))
- return 0;
-
- return rtx_equal_for_thread_p (XEXP (x, 0), XEXP (y, 0), yinsn);
-
- case ASM_INPUT:
- if (MEM_VOLATILE_P (x) || MEM_VOLATILE_P (y))
- return 0;
-
- break;
-
- case SET:
- /* Cancel a pending `same_regs' if setting equivalenced registers.
- Then process source. */
- if (GET_CODE (SET_DEST (x)) == REG
- && GET_CODE (SET_DEST (y)) == REG)
- {
- if (same_regs[REGNO (SET_DEST (x))] == REGNO (SET_DEST (y)))
- {
- same_regs[REGNO (SET_DEST (x))] = -1;
- num_same_regs--;
- }
- else if (REGNO (SET_DEST (x)) != REGNO (SET_DEST (y)))
- return 0;
- }
- else
- if (rtx_equal_for_thread_p (SET_DEST (x), SET_DEST (y), yinsn) == 0)
- return 0;
-
- return rtx_equal_for_thread_p (SET_SRC (x), SET_SRC (y), yinsn);
-
- case LABEL_REF:
- return XEXP (x, 0) == XEXP (y, 0);
-
- case SYMBOL_REF:
- return XSTR (x, 0) == XSTR (y, 0);
- }
-
- if (x == y)
- return 1;
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- switch (fmt[i])
- {
- case 'w':
- if (XWINT (x, i) != XWINT (y, i))
- return 0;
- break;
-
- case 'n':
- case 'i':
- if (XINT (x, i) != XINT (y, i))
- return 0;
- break;
-
- case 'V':
- case 'E':
- /* Two vectors must have the same length. */
- if (XVECLEN (x, i) != XVECLEN (y, i))
- return 0;
-
- /* And the corresponding elements must match. */
- for (j = 0; j < XVECLEN (x, i); j++)
- if (rtx_equal_for_thread_p (XVECEXP (x, i, j),
- XVECEXP (y, i, j), yinsn) == 0)
- return 0;
- break;
-
- case 'e':
- if (rtx_equal_for_thread_p (XEXP (x, i), XEXP (y, i), yinsn) == 0)
- return 0;
- break;
-
- case 'S':
- case 's':
- if (strcmp (XSTR (x, i), XSTR (y, i)))
- return 0;
- break;
-
- case 'u':
- /* These are just backpointers, so they don't matter. */
- break;
-
- case '0':
- break;
-
- /* It is believed that rtx's at this level will never
- contain anything but integers and other rtx's,
- except for within LABEL_REFs and SYMBOL_REFs. */
- default:
- abort ();
- }
- }
- return 1;
-}
diff --git a/gcc/just-fixinc b/gcc/just-fixinc
deleted file mode 100755
index e5ceaec7377..00000000000
--- a/gcc/just-fixinc
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# $Id$
-# This script exists for use after installing
-# the GCC binaries from a distribution tape/CD-ROM.
-# Use it *after* copying the directory of binaries
-# to the proper installed location.
-# It runs fixincludes (or fixinc.svr4, if appropriate) to correct bugs in
-# the system header files.
-# This script needs to be customized for each type of installation so that
-# others may run it after the installation-sans-fixincludes is completed.
-
-# The corrected header files go in the GCC installation directory
-# so that only GCC sees them.
-# This script does not modify the original header files in /usr/include.
-# It only modifies copies in the GCC installation directory.
-
-installed=/opt/gnu/lib/gcc-lib/sparc-sun-solaris2/2.6.0
-cd $installed/include
-
-rmdir tmpfoo > /dev/null 2>&1
-mkdir tmpfoo
-mv va-sparc.h varargs.h stdarg.h stddef.h limits.h float.h proto.h tmpfoo
-
-$installed/fixinc.svr4 $installed/include /usr/include $installed
-
-# Make sure fixed native limits.h gets renamed to syslimits.h before gcc's
-# limits.h from tmpfoo is moved back.
-rm -f syslimits.h
-if test -f limits.h ; then
- mv limits.h syslimits.h
-else
- cp $installed/gsyslimits.h syslimits.h
-fi
-chmod a+r syslimits.h
-
-mv tmpfoo/* .
-rmdir tmpfoo
-
-# eof
diff --git a/gcc/libgcc1-test.c b/gcc/libgcc1-test.c
deleted file mode 100644
index 977b9c76188..00000000000
--- a/gcc/libgcc1-test.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* This small function uses all the arithmetic operators that
- libgcc1.c can handle. If you can link it, then
- you have provided replacements for all the libgcc1.c functions that
- your target machine needs. */
-
-int foo ();
-double dfoo ();
-
-/* We don't want __main here because that can drag in atexit (among other
- things) which won't necessarily exist yet. */
-
-main_without__main ()
-{
- int a = foo (), b = foo ();
- unsigned int au = foo (), bu = foo ();
- float af = dfoo (), bf = dfoo ();
- double ad = dfoo (), bd = dfoo ();
-
- discard (a * b);
- discard (a / b);
- discard (a % b);
-
- discard (au / bu);
- discard (au % bu);
-
- discard (a >> b);
- discard (a << b);
-
- discard (au >> bu);
- discard (au << bu);
-
- ddiscard (ad + bd);
- ddiscard (ad - bd);
- ddiscard (ad * bd);
- ddiscard (ad / bd);
- ddiscard (-ad);
-
- ddiscard (af + bf);
- ddiscard (af - bf);
- ddiscard (af * bf);
- ddiscard (af / bf);
- ddiscard (-af);
-
- discard ((int) ad);
- discard ((int) af);
-
- ddiscard ((double) a);
- ddiscard ((float) a);
- ddiscard ((float) ad);
-
- discard (ad == bd);
- discard (ad < bd);
- discard (ad > bd);
- discard (ad != bd);
- discard (ad <= bd);
- discard (ad >= bd);
-
- discard (af == bf);
- discard (af < bf);
- discard (af > bf);
- discard (af != bf);
- discard (af <= bf);
- discard (af >= bf);
-
- return 0;
-}
-
-discard (x)
- int x;
-{}
-
-ddiscard (x)
- double x;
-{}
-
-foo ()
-{
- static int table[] = {20, 69, 4, 12};
- static int idx;
-
- return table[idx++];
-}
-
-double
-dfoo ()
-{
- static double table[] = {20.4, 69.96, 4.4, 202.202};
- static int idx;
-
- return table[idx++];
-}
-
-/* Provide functions that some versions of the linker use to default
- the start address if -e symbol is not used, to avoid the warning
- message saying the start address is defaulted. */
-extern void start() __asm__("start");
-extern void _start() __asm__("_start");
-extern void __start() __asm__("__start");
-
-void start() {}
-void _start() {}
-void __start() {}
-void mainCRTStartup() {}
diff --git a/gcc/libgcc1.c b/gcc/libgcc1.c
deleted file mode 100644
index bece5003422..00000000000
--- a/gcc/libgcc1.c
+++ /dev/null
@@ -1,596 +0,0 @@
-/* Subroutines needed by GCC output code on some machines. */
-/* Compile this file with the Unix C compiler! */
-/* Copyright (C) 1987, 1988, 1992, 1994, 1995 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, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file. (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file 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; 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 link this library with other files,
- some of which are compiled with GCC, to produce an executable,
- this library 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. */
-
-#include "config.h"
-
-/* Don't use `fancy_abort' here even if config.h says to use it. */
-#ifdef abort
-#undef abort
-#endif
-
-/* On some machines, cc is really GCC. For these machines, we can't
- expect these functions to be properly compiled unless GCC open codes
- the operation (which is precisely when the function won't be used).
- So allow tm.h to specify ways of accomplishing the operations
- by defining the macros perform_*.
-
- On a machine where cc is some other compiler, there is usually no
- reason to define perform_*. The other compiler normally has other ways
- of implementing all of these operations.
-
- In some cases a certain machine may come with GCC installed as cc
- or may have some other compiler. Then it may make sense for tm.h
- to define perform_* only if __GNUC__ is defined. */
-
-#ifndef perform_mulsi3
-#define perform_mulsi3(a, b) return a * b
-#endif
-
-#ifndef perform_divsi3
-#define perform_divsi3(a, b) return a / b
-#endif
-
-#ifndef perform_udivsi3
-#define perform_udivsi3(a, b) return a / b
-#endif
-
-#ifndef perform_modsi3
-#define perform_modsi3(a, b) return a % b
-#endif
-
-#ifndef perform_umodsi3
-#define perform_umodsi3(a, b) return a % b
-#endif
-
-#ifndef perform_lshrsi3
-#define perform_lshrsi3(a, b) return a >> b
-#endif
-
-#ifndef perform_ashrsi3
-#define perform_ashrsi3(a, b) return a >> b
-#endif
-
-#ifndef perform_ashlsi3
-#define perform_ashlsi3(a, b) return a << b
-#endif
-
-#ifndef perform_adddf3
-#define perform_adddf3(a, b) return a + b
-#endif
-
-#ifndef perform_subdf3
-#define perform_subdf3(a, b) return a - b
-#endif
-
-#ifndef perform_muldf3
-#define perform_muldf3(a, b) return a * b
-#endif
-
-#ifndef perform_divdf3
-#define perform_divdf3(a, b) return a / b
-#endif
-
-#ifndef perform_addsf3
-#define perform_addsf3(a, b) return INTIFY (a + b)
-#endif
-
-#ifndef perform_subsf3
-#define perform_subsf3(a, b) return INTIFY (a - b)
-#endif
-
-#ifndef perform_mulsf3
-#define perform_mulsf3(a, b) return INTIFY (a * b)
-#endif
-
-#ifndef perform_divsf3
-#define perform_divsf3(a, b) return INTIFY (a / b)
-#endif
-
-#ifndef perform_negdf2
-#define perform_negdf2(a) return -a
-#endif
-
-#ifndef perform_negsf2
-#define perform_negsf2(a) return INTIFY (-a)
-#endif
-
-#ifndef perform_fixdfsi
-#define perform_fixdfsi(a) return (nongcc_SI_type) a;
-#endif
-
-#ifndef perform_fixsfsi
-#define perform_fixsfsi(a) return (nongcc_SI_type) a
-#endif
-
-#ifndef perform_floatsidf
-#define perform_floatsidf(a) return (double) a
-#endif
-
-#ifndef perform_floatsisf
-#define perform_floatsisf(a) return INTIFY ((float) a)
-#endif
-
-#ifndef perform_extendsfdf2
-#define perform_extendsfdf2(a) return a
-#endif
-
-#ifndef perform_truncdfsf2
-#define perform_truncdfsf2(a) return INTIFY (a)
-#endif
-
-/* Note that eqdf2 returns a value for "true" that is == 0,
- nedf2 returns a value for "true" that is != 0,
- gtdf2 returns a value for "true" that is > 0,
- and so on. */
-
-#ifndef perform_eqdf2
-#define perform_eqdf2(a, b) return !(a == b)
-#endif
-
-#ifndef perform_nedf2
-#define perform_nedf2(a, b) return a != b
-#endif
-
-#ifndef perform_gtdf2
-#define perform_gtdf2(a, b) return a > b
-#endif
-
-#ifndef perform_gedf2
-#define perform_gedf2(a, b) return (a >= b) - 1
-#endif
-
-#ifndef perform_ltdf2
-#define perform_ltdf2(a, b) return -(a < b)
-#endif
-
-#ifndef perform_ledf2
-#define perform_ledf2(a, b) return 1 - (a <= b)
-#endif
-
-#ifndef perform_eqsf2
-#define perform_eqsf2(a, b) return !(a == b)
-#endif
-
-#ifndef perform_nesf2
-#define perform_nesf2(a, b) return a != b
-#endif
-
-#ifndef perform_gtsf2
-#define perform_gtsf2(a, b) return a > b
-#endif
-
-#ifndef perform_gesf2
-#define perform_gesf2(a, b) return (a >= b) - 1
-#endif
-
-#ifndef perform_ltsf2
-#define perform_ltsf2(a, b) return -(a < b)
-#endif
-
-#ifndef perform_lesf2
-#define perform_lesf2(a, b) return 1 - (a <= b);
-#endif
-
-/* Define the C data type to use for an SImode value. */
-
-#ifndef nongcc_SI_type
-#define nongcc_SI_type long int
-#endif
-
-/* Define the C data type to use for a value of word size */
-#ifndef nongcc_word_type
-#define nongcc_word_type nongcc_SI_type
-#endif
-
-/* Define the type to be used for returning an SF mode value
- and the method for turning a float into that type.
- These definitions work for machines where an SF value is
- returned in the same register as an int. */
-
-#ifndef FLOAT_VALUE_TYPE
-#define FLOAT_VALUE_TYPE int
-#endif
-
-#ifndef INTIFY
-#define INTIFY(FLOATVAL) (intify.f = (FLOATVAL), intify.i)
-#endif
-
-#ifndef FLOATIFY
-#define FLOATIFY(INTVAL) ((INTVAL).f)
-#endif
-
-#ifndef FLOAT_ARG_TYPE
-#define FLOAT_ARG_TYPE union flt_or_int
-#endif
-
-union flt_or_value { FLOAT_VALUE_TYPE i; float f; };
-
-union flt_or_int { int i; float f; };
-
-
-#ifdef L_mulsi3
-nongcc_SI_type
-__mulsi3 (a, b)
- nongcc_SI_type a, b;
-{
- perform_mulsi3 (a, b);
-}
-#endif
-
-#ifdef L_udivsi3
-nongcc_SI_type
-__udivsi3 (a, b)
- unsigned nongcc_SI_type a, b;
-{
- perform_udivsi3 (a, b);
-}
-#endif
-
-#ifdef L_divsi3
-nongcc_SI_type
-__divsi3 (a, b)
- nongcc_SI_type a, b;
-{
- perform_divsi3 (a, b);
-}
-#endif
-
-#ifdef L_umodsi3
-nongcc_SI_type
-__umodsi3 (a, b)
- unsigned nongcc_SI_type a, b;
-{
- perform_umodsi3 (a, b);
-}
-#endif
-
-#ifdef L_modsi3
-nongcc_SI_type
-__modsi3 (a, b)
- nongcc_SI_type a, b;
-{
- perform_modsi3 (a, b);
-}
-#endif
-
-#ifdef L_lshrsi3
-nongcc_SI_type
-__lshrsi3 (a, b)
- unsigned nongcc_SI_type a, b;
-{
- perform_lshrsi3 (a, b);
-}
-#endif
-
-#ifdef L_ashrsi3
-nongcc_SI_type
-__ashrsi3 (a, b)
- nongcc_SI_type a, b;
-{
- perform_ashrsi3 (a, b);
-}
-#endif
-
-#ifdef L_ashlsi3
-nongcc_SI_type
-__ashlsi3 (a, b)
- nongcc_SI_type a, b;
-{
- perform_ashlsi3 (a, b);
-}
-#endif
-
-#ifdef L_divdf3
-double
-__divdf3 (a, b)
- double a, b;
-{
- perform_divdf3 (a, b);
-}
-#endif
-
-#ifdef L_muldf3
-double
-__muldf3 (a, b)
- double a, b;
-{
- perform_muldf3 (a, b);
-}
-#endif
-
-#ifdef L_negdf2
-double
-__negdf2 (a)
- double a;
-{
- perform_negdf2 (a);
-}
-#endif
-
-#ifdef L_adddf3
-double
-__adddf3 (a, b)
- double a, b;
-{
- perform_adddf3 (a, b);
-}
-#endif
-
-#ifdef L_subdf3
-double
-__subdf3 (a, b)
- double a, b;
-{
- perform_subdf3 (a, b);
-}
-#endif
-
-/* Note that eqdf2 returns a value for "true" that is == 0,
- nedf2 returns a value for "true" that is != 0,
- gtdf2 returns a value for "true" that is > 0,
- and so on. */
-
-#ifdef L_eqdf2
-nongcc_word_type
-__eqdf2 (a, b)
- double a, b;
-{
- /* Value == 0 iff a == b. */
- perform_eqdf2 (a, b);
-}
-#endif
-
-#ifdef L_nedf2
-nongcc_word_type
-__nedf2 (a, b)
- double a, b;
-{
- /* Value != 0 iff a != b. */
- perform_nedf2 (a, b);
-}
-#endif
-
-#ifdef L_gtdf2
-nongcc_word_type
-__gtdf2 (a, b)
- double a, b;
-{
- /* Value > 0 iff a > b. */
- perform_gtdf2 (a, b);
-}
-#endif
-
-#ifdef L_gedf2
-nongcc_word_type
-__gedf2 (a, b)
- double a, b;
-{
- /* Value >= 0 iff a >= b. */
- perform_gedf2 (a, b);
-}
-#endif
-
-#ifdef L_ltdf2
-nongcc_word_type
-__ltdf2 (a, b)
- double a, b;
-{
- /* Value < 0 iff a < b. */
- perform_ltdf2 (a, b);
-}
-#endif
-
-#ifdef L_ledf2
-nongcc_word_type
-__ledf2 (a, b)
- double a, b;
-{
- /* Value <= 0 iff a <= b. */
- perform_ledf2 (a, b);
-}
-#endif
-
-#ifdef L_fixdfsi
-nongcc_SI_type
-__fixdfsi (a)
- double a;
-{
- perform_fixdfsi (a);
-}
-#endif
-
-#ifdef L_fixsfsi
-nongcc_SI_type
-__fixsfsi (a)
- FLOAT_ARG_TYPE a;
-{
- union flt_or_value intify;
- perform_fixsfsi (FLOATIFY (a));
-}
-#endif
-
-#ifdef L_floatsidf
-double
-__floatsidf (a)
- nongcc_SI_type a;
-{
- perform_floatsidf (a);
-}
-#endif
-
-#ifdef L_floatsisf
-FLOAT_VALUE_TYPE
-__floatsisf (a)
- nongcc_SI_type a;
-{
- union flt_or_value intify;
- perform_floatsisf (a);
-}
-#endif
-
-#ifdef L_addsf3
-FLOAT_VALUE_TYPE
-__addsf3 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_value intify;
- perform_addsf3 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_negsf2
-FLOAT_VALUE_TYPE
-__negsf2 (a)
- FLOAT_ARG_TYPE a;
-{
- union flt_or_value intify;
- perform_negsf2 (FLOATIFY (a));
-}
-#endif
-
-#ifdef L_subsf3
-FLOAT_VALUE_TYPE
-__subsf3 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_value intify;
- perform_subsf3 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_eqsf2
-nongcc_word_type
-__eqsf2 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_int intify;
- /* Value == 0 iff a == b. */
- perform_eqsf2 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_nesf2
-nongcc_word_type
-__nesf2 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_int intify;
- /* Value != 0 iff a != b. */
- perform_nesf2 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_gtsf2
-nongcc_word_type
-__gtsf2 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_int intify;
- /* Value > 0 iff a > b. */
- perform_gtsf2 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_gesf2
-nongcc_word_type
-__gesf2 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_int intify;
- /* Value >= 0 iff a >= b. */
- perform_gesf2 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_ltsf2
-nongcc_word_type
-__ltsf2 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_int intify;
- /* Value < 0 iff a < b. */
- perform_ltsf2 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_lesf2
-nongcc_word_type
-__lesf2 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_int intify;
- /* Value <= 0 iff a <= b. */
- perform_lesf2 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_mulsf3
-FLOAT_VALUE_TYPE
-__mulsf3 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_value intify;
- perform_mulsf3 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_divsf3
-FLOAT_VALUE_TYPE
-__divsf3 (a, b)
- FLOAT_ARG_TYPE a, b;
-{
- union flt_or_value intify;
- perform_divsf3 (FLOATIFY (a), FLOATIFY (b));
-}
-#endif
-
-#ifdef L_truncdfsf2
-FLOAT_VALUE_TYPE
-__truncdfsf2 (a)
- double a;
-{
- union flt_or_value intify;
- perform_truncdfsf2 (a);
-}
-#endif
-
-#ifdef L_extendsfdf2
-double
-__extendsfdf2 (a)
- FLOAT_ARG_TYPE a;
-{
- union flt_or_value intify;
- perform_extendsfdf2 (FLOATIFY (a));
-}
-#endif
diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c
deleted file mode 100644
index 9fcd17eb58e..00000000000
--- a/gcc/libgcc2.c
+++ /dev/null
@@ -1,3372 +0,0 @@
-/* More subroutines needed by GCC output code on some machines. */
-/* Compile this one with gcc. */
-/* Copyright (C) 1989, 92, 93, 94, 95, 96, 1997 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. */
-
-/* As a special exception, if you link this library with other files,
- some of which are compiled with GCC, to produce an executable,
- this library 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. */
-
-/* It is incorrect to include config.h here, because this file is being
- compiled for the target, and hence definitions concerning only the host
- do not apply. */
-
-#include "tconfig.h"
-#include "machmode.h"
-#include "defaults.h"
-#ifndef L_trampoline
-#include <stddef.h>
-#endif
-
-/* Don't use `fancy_abort' here even if config.h says to use it. */
-#ifdef abort
-#undef abort
-#endif
-
-#if (SUPPORTS_WEAK == 1) && (defined (ASM_OUTPUT_DEF) || defined (ASM_OUTPUT_WEAK_ALIAS))
-#define WEAK_ALIAS
-#endif
-
-/* Permit the tm.h file to select the endianness to use just for this
- file. This is used when the endianness is determined when the
- compiler is run. */
-
-#ifndef LIBGCC2_WORDS_BIG_ENDIAN
-#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
-#endif
-
-/* In the first part of this file, we are interfacing to calls generated
- by the compiler itself. These calls pass values into these routines
- which have very specific modes (rather than very specific types), and
- these compiler-generated calls also expect any return values to have
- very specific modes (rather than very specific types). Thus, we need
- to avoid using regular C language type names in this part of the file
- because the sizes for those types can be configured to be anything.
- Instead we use the following special type names. */
-
-typedef unsigned int UQItype __attribute__ ((mode (QI)));
-typedef int SItype __attribute__ ((mode (SI)));
-typedef unsigned int USItype __attribute__ ((mode (SI)));
-typedef int DItype __attribute__ ((mode (DI)));
-typedef unsigned int UDItype __attribute__ ((mode (DI)));
-
-typedef float SFtype __attribute__ ((mode (SF)));
-typedef float DFtype __attribute__ ((mode (DF)));
-
-#if LONG_DOUBLE_TYPE_SIZE == 96
-typedef float XFtype __attribute__ ((mode (XF)));
-#endif
-#if LONG_DOUBLE_TYPE_SIZE == 128
-typedef float TFtype __attribute__ ((mode (TF)));
-#endif
-
-typedef int word_type __attribute__ ((mode (__word__)));
-
-/* Make sure that we don't accidentally use any normal C language built-in
- type names in the first part of this file. Instead we want to use *only*
- the type names defined above. The following macro definitions insure
- that if we *do* accidentally use some normal C language built-in type name,
- we will get a syntax error. */
-
-#define char bogus_type
-#define short bogus_type
-#define int bogus_type
-#define long bogus_type
-#define unsigned bogus_type
-#define float bogus_type
-#define double bogus_type
-
-#define SI_TYPE_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-
-/* DIstructs are pairs of SItype values in the order determined by
- LIBGCC2_WORDS_BIG_ENDIAN. */
-
-#if LIBGCC2_WORDS_BIG_ENDIAN
- struct DIstruct {SItype high, low;};
-#else
- struct DIstruct {SItype low, high;};
-#endif
-
-/* We need this union to unpack/pack DImode values, since we don't have
- any arithmetic yet. Incoming DImode parameters are stored into the
- `ll' field, and the unpacked result is read from the struct `s'. */
-
-typedef union
-{
- struct DIstruct s;
- DItype ll;
-} DIunion;
-
-#if (defined (L_udivmoddi4) || defined (L_muldi3) || defined (L_udiv_w_sdiv)\
- || defined (L_divdi3) || defined (L_udivdi3) \
- || defined (L_moddi3) || defined (L_umoddi3))
-
-#include "longlong.h"
-
-#endif /* udiv or mul */
-
-extern DItype __fixunssfdi (SFtype a);
-extern DItype __fixunsdfdi (DFtype a);
-#if LONG_DOUBLE_TYPE_SIZE == 96
-extern DItype __fixunsxfdi (XFtype a);
-#endif
-#if LONG_DOUBLE_TYPE_SIZE == 128
-extern DItype __fixunstfdi (TFtype a);
-#endif
-
-#if defined (L_negdi2) || defined (L_divdi3) || defined (L_moddi3)
-#if defined (L_divdi3) || defined (L_moddi3)
-static inline
-#endif
-DItype
-__negdi2 (DItype u)
-{
- DIunion w;
- DIunion uu;
-
- uu.ll = u;
-
- w.s.low = -uu.s.low;
- w.s.high = -uu.s.high - ((USItype) w.s.low > 0);
-
- return w.ll;
-}
-#endif
-
-/* Unless shift functions are defined whith full ANSI prototypes,
- parameter b will be promoted to int if word_type is smaller than an int. */
-#ifdef L_lshrdi3
-DItype
-__lshrdi3 (DItype u, word_type b)
-{
- DIunion w;
- word_type bm;
- DIunion uu;
-
- if (b == 0)
- return u;
-
- uu.ll = u;
-
- bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
- if (bm <= 0)
- {
- w.s.high = 0;
- w.s.low = (USItype)uu.s.high >> -bm;
- }
- else
- {
- USItype carries = (USItype)uu.s.high << bm;
- w.s.high = (USItype)uu.s.high >> b;
- w.s.low = ((USItype)uu.s.low >> b) | carries;
- }
-
- return w.ll;
-}
-#endif
-
-#ifdef L_ashldi3
-DItype
-__ashldi3 (DItype u, word_type b)
-{
- DIunion w;
- word_type bm;
- DIunion uu;
-
- if (b == 0)
- return u;
-
- uu.ll = u;
-
- bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
- if (bm <= 0)
- {
- w.s.low = 0;
- w.s.high = (USItype)uu.s.low << -bm;
- }
- else
- {
- USItype carries = (USItype)uu.s.low >> bm;
- w.s.low = (USItype)uu.s.low << b;
- w.s.high = ((USItype)uu.s.high << b) | carries;
- }
-
- return w.ll;
-}
-#endif
-
-#ifdef L_ashrdi3
-DItype
-__ashrdi3 (DItype u, word_type b)
-{
- DIunion w;
- word_type bm;
- DIunion uu;
-
- if (b == 0)
- return u;
-
- uu.ll = u;
-
- bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
- if (bm <= 0)
- {
- /* w.s.high = 1..1 or 0..0 */
- w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
- w.s.low = uu.s.high >> -bm;
- }
- else
- {
- USItype carries = (USItype)uu.s.high << bm;
- w.s.high = uu.s.high >> b;
- w.s.low = ((USItype)uu.s.low >> b) | carries;
- }
-
- return w.ll;
-}
-#endif
-
-#ifdef L_ffsdi2
-DItype
-__ffsdi2 (DItype u)
-{
- DIunion uu, w;
- uu.ll = u;
- w.s.high = 0;
- w.s.low = ffs (uu.s.low);
- if (w.s.low != 0)
- return w.ll;
- w.s.low = ffs (uu.s.high);
- if (w.s.low != 0)
- {
- w.s.low += BITS_PER_UNIT * sizeof (SItype);
- return w.ll;
- }
- return w.ll;
-}
-#endif
-
-#ifdef L_muldi3
-DItype
-__muldi3 (DItype u, DItype v)
-{
- DIunion w;
- DIunion uu, vv;
-
- uu.ll = u,
- vv.ll = v;
-
- w.ll = __umulsidi3 (uu.s.low, vv.s.low);
- w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
- + (USItype) uu.s.high * (USItype) vv.s.low);
-
- return w.ll;
-}
-#endif
-
-#ifdef L_udiv_w_sdiv
-#if defined (sdiv_qrnnd)
-USItype
-__udiv_w_sdiv (USItype *rp, USItype a1, USItype a0, USItype d)
-{
- USItype q, r;
- USItype c0, c1, b1;
-
- if ((SItype) d >= 0)
- {
- if (a1 < d - a1 - (a0 >> (SI_TYPE_SIZE - 1)))
- {
- /* dividend, divisor, and quotient are nonnegative */
- sdiv_qrnnd (q, r, a1, a0, d);
- }
- else
- {
- /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */
- sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (SI_TYPE_SIZE - 1));
- /* Divide (c1*2^32 + c0) by d */
- sdiv_qrnnd (q, r, c1, c0, d);
- /* Add 2^31 to quotient */
- q += (USItype) 1 << (SI_TYPE_SIZE - 1);
- }
- }
- else
- {
- b1 = d >> 1; /* d/2, between 2^30 and 2^31 - 1 */
- c1 = a1 >> 1; /* A/2 */
- c0 = (a1 << (SI_TYPE_SIZE - 1)) + (a0 >> 1);
-
- if (a1 < b1) /* A < 2^32*b1, so A/2 < 2^31*b1 */
- {
- sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */
-
- r = 2*r + (a0 & 1); /* Remainder from A/(2*b1) */
- if ((d & 1) != 0)
- {
- if (r >= q)
- r = r - q;
- else if (q - r <= d)
- {
- r = r - q + d;
- q--;
- }
- else
- {
- r = r - q + 2*d;
- q -= 2;
- }
- }
- }
- else if (c1 < b1) /* So 2^31 <= (A/2)/b1 < 2^32 */
- {
- c1 = (b1 - 1) - c1;
- c0 = ~c0; /* logical NOT */
-
- sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */
-
- q = ~q; /* (A/2)/b1 */
- r = (b1 - 1) - r;
-
- r = 2*r + (a0 & 1); /* A/(2*b1) */
-
- if ((d & 1) != 0)
- {
- if (r >= q)
- r = r - q;
- else if (q - r <= d)
- {
- r = r - q + d;
- q--;
- }
- else
- {
- r = r - q + 2*d;
- q -= 2;
- }
- }
- }
- else /* Implies c1 = b1 */
- { /* Hence a1 = d - 1 = 2*b1 - 1 */
- if (a0 >= -d)
- {
- q = -1;
- r = a0 + d;
- }
- else
- {
- q = -2;
- r = a0 + 2*d;
- }
- }
- }
-
- *rp = r;
- return q;
-}
-#else
-/* If sdiv_qrnnd doesn't exist, define dummy __udiv_w_sdiv. */
-USItype
-__udiv_w_sdiv (USItype *rp, USItype a1, USItype a0, USItype d)
-{}
-#endif
-#endif
-
-#if (defined (L_udivdi3) || defined (L_divdi3) || \
- defined (L_umoddi3) || defined (L_moddi3))
-#define L_udivmoddi4
-#endif
-
-#ifdef L_udivmoddi4
-static const UQItype __clz_tab[] =
-{
- 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-};
-
-#if (defined (L_udivdi3) || defined (L_divdi3) || \
- defined (L_umoddi3) || defined (L_moddi3))
-static inline
-#endif
-UDItype
-__udivmoddi4 (UDItype n, UDItype d, UDItype *rp)
-{
- DIunion ww;
- DIunion nn, dd;
- DIunion rr;
- USItype d0, d1, n0, n1, n2;
- USItype q0, q1;
- USItype b, bm;
-
- nn.ll = n;
- dd.ll = d;
-
- d0 = dd.s.low;
- d1 = dd.s.high;
- n0 = nn.s.low;
- n1 = nn.s.high;
-
-#if !UDIV_NEEDS_NORMALIZATION
- if (d1 == 0)
- {
- if (d0 > n1)
- {
- /* 0q = nn / 0D */
-
- udiv_qrnnd (q0, n0, n1, n0, d0);
- q1 = 0;
-
- /* Remainder in n0. */
- }
- else
- {
- /* qq = NN / 0d */
-
- if (d0 == 0)
- d0 = 1 / d0; /* Divide intentionally by zero. */
-
- udiv_qrnnd (q1, n1, 0, n1, d0);
- udiv_qrnnd (q0, n0, n1, n0, d0);
-
- /* Remainder in n0. */
- }
-
- if (rp != 0)
- {
- rr.s.low = n0;
- rr.s.high = 0;
- *rp = rr.ll;
- }
- }
-
-#else /* UDIV_NEEDS_NORMALIZATION */
-
- if (d1 == 0)
- {
- if (d0 > n1)
- {
- /* 0q = nn / 0D */
-
- count_leading_zeros (bm, d0);
-
- if (bm != 0)
- {
- /* Normalize, i.e. make the most significant bit of the
- denominator set. */
-
- d0 = d0 << bm;
- n1 = (n1 << bm) | (n0 >> (SI_TYPE_SIZE - bm));
- n0 = n0 << bm;
- }
-
- udiv_qrnnd (q0, n0, n1, n0, d0);
- q1 = 0;
-
- /* Remainder in n0 >> bm. */
- }
- else
- {
- /* qq = NN / 0d */
-
- if (d0 == 0)
- d0 = 1 / d0; /* Divide intentionally by zero. */
-
- count_leading_zeros (bm, d0);
-
- if (bm == 0)
- {
- /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
- conclude (the most significant bit of n1 is set) /\ (the
- leading quotient digit q1 = 1).
-
- This special case is necessary, not an optimization.
- (Shifts counts of SI_TYPE_SIZE are undefined.) */
-
- n1 -= d0;
- q1 = 1;
- }
- else
- {
- /* Normalize. */
-
- b = SI_TYPE_SIZE - bm;
-
- d0 = d0 << bm;
- n2 = n1 >> b;
- n1 = (n1 << bm) | (n0 >> b);
- n0 = n0 << bm;
-
- udiv_qrnnd (q1, n1, n2, n1, d0);
- }
-
- /* n1 != d0... */
-
- udiv_qrnnd (q0, n0, n1, n0, d0);
-
- /* Remainder in n0 >> bm. */
- }
-
- if (rp != 0)
- {
- rr.s.low = n0 >> bm;
- rr.s.high = 0;
- *rp = rr.ll;
- }
- }
-#endif /* UDIV_NEEDS_NORMALIZATION */
-
- else
- {
- if (d1 > n1)
- {
- /* 00 = nn / DD */
-
- q0 = 0;
- q1 = 0;
-
- /* Remainder in n1n0. */
- if (rp != 0)
- {
- rr.s.low = n0;
- rr.s.high = n1;
- *rp = rr.ll;
- }
- }
- else
- {
- /* 0q = NN / dd */
-
- count_leading_zeros (bm, d1);
- if (bm == 0)
- {
- /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
- conclude (the most significant bit of n1 is set) /\ (the
- quotient digit q0 = 0 or 1).
-
- This special case is necessary, not an optimization. */
-
- /* The condition on the next line takes advantage of that
- n1 >= d1 (true due to program flow). */
- if (n1 > d1 || n0 >= d0)
- {
- q0 = 1;
- sub_ddmmss (n1, n0, n1, n0, d1, d0);
- }
- else
- q0 = 0;
-
- q1 = 0;
-
- if (rp != 0)
- {
- rr.s.low = n0;
- rr.s.high = n1;
- *rp = rr.ll;
- }
- }
- else
- {
- USItype m1, m0;
- /* Normalize. */
-
- b = SI_TYPE_SIZE - bm;
-
- d1 = (d1 << bm) | (d0 >> b);
- d0 = d0 << bm;
- n2 = n1 >> b;
- n1 = (n1 << bm) | (n0 >> b);
- n0 = n0 << bm;
-
- udiv_qrnnd (q0, n1, n2, n1, d1);
- umul_ppmm (m1, m0, q0, d0);
-
- if (m1 > n1 || (m1 == n1 && m0 > n0))
- {
- q0--;
- sub_ddmmss (m1, m0, m1, m0, d1, d0);
- }
-
- q1 = 0;
-
- /* Remainder in (n1n0 - m1m0) >> bm. */
- if (rp != 0)
- {
- sub_ddmmss (n1, n0, n1, n0, m1, m0);
- rr.s.low = (n1 << b) | (n0 >> bm);
- rr.s.high = n1 >> bm;
- *rp = rr.ll;
- }
- }
- }
- }
-
- ww.s.low = q0;
- ww.s.high = q1;
- return ww.ll;
-}
-#endif
-
-#ifdef L_divdi3
-UDItype __udivmoddi4 ();
-
-DItype
-__divdi3 (DItype u, DItype v)
-{
- word_type c = 0;
- DIunion uu, vv;
- DItype w;
-
- uu.ll = u;
- vv.ll = v;
-
- if (uu.s.high < 0)
- c = ~c,
- uu.ll = __negdi2 (uu.ll);
- if (vv.s.high < 0)
- c = ~c,
- vv.ll = __negdi2 (vv.ll);
-
- w = __udivmoddi4 (uu.ll, vv.ll, (UDItype *) 0);
- if (c)
- w = __negdi2 (w);
-
- return w;
-}
-#endif
-
-#ifdef L_moddi3
-UDItype __udivmoddi4 ();
-DItype
-__moddi3 (DItype u, DItype v)
-{
- word_type c = 0;
- DIunion uu, vv;
- DItype w;
-
- uu.ll = u;
- vv.ll = v;
-
- if (uu.s.high < 0)
- c = ~c,
- uu.ll = __negdi2 (uu.ll);
- if (vv.s.high < 0)
- vv.ll = __negdi2 (vv.ll);
-
- (void) __udivmoddi4 (uu.ll, vv.ll, &w);
- if (c)
- w = __negdi2 (w);
-
- return w;
-}
-#endif
-
-#ifdef L_umoddi3
-UDItype __udivmoddi4 ();
-UDItype
-__umoddi3 (UDItype u, UDItype v)
-{
- UDItype w;
-
- (void) __udivmoddi4 (u, v, &w);
-
- return w;
-}
-#endif
-
-#ifdef L_udivdi3
-UDItype __udivmoddi4 ();
-UDItype
-__udivdi3 (UDItype n, UDItype d)
-{
- return __udivmoddi4 (n, d, (UDItype *) 0);
-}
-#endif
-
-#ifdef L_cmpdi2
-word_type
-__cmpdi2 (DItype a, DItype b)
-{
- DIunion au, bu;
-
- au.ll = a, bu.ll = b;
-
- if (au.s.high < bu.s.high)
- return 0;
- else if (au.s.high > bu.s.high)
- return 2;
- if ((USItype) au.s.low < (USItype) bu.s.low)
- return 0;
- else if ((USItype) au.s.low > (USItype) bu.s.low)
- return 2;
- return 1;
-}
-#endif
-
-#ifdef L_ucmpdi2
-word_type
-__ucmpdi2 (DItype a, DItype b)
-{
- DIunion au, bu;
-
- au.ll = a, bu.ll = b;
-
- if ((USItype) au.s.high < (USItype) bu.s.high)
- return 0;
- else if ((USItype) au.s.high > (USItype) bu.s.high)
- return 2;
- if ((USItype) au.s.low < (USItype) bu.s.low)
- return 0;
- else if ((USItype) au.s.low > (USItype) bu.s.low)
- return 2;
- return 1;
-}
-#endif
-
-#if defined(L_fixunstfdi) && (LONG_DOUBLE_TYPE_SIZE == 128)
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
-
-DItype
-__fixunstfdi (TFtype a)
-{
- TFtype b;
- UDItype v;
-
- if (a < 0)
- return 0;
-
- /* Compute high word of result, as a flonum. */
- b = (a / HIGH_WORD_COEFF);
- /* Convert that to fixed (but not to DItype!),
- and shift it into the high word. */
- v = (USItype) b;
- v <<= WORD_SIZE;
- /* Remove high part from the TFtype, leaving the low part as flonum. */
- a -= (TFtype)v;
- /* Convert that to fixed (but not to DItype!) and add it in.
- Sometimes A comes out negative. This is significant, since
- A has more bits than a long int does. */
- if (a < 0)
- v -= (USItype) (- a);
- else
- v += (USItype) a;
- return v;
-}
-#endif
-
-#if defined(L_fixtfdi) && (LONG_DOUBLE_TYPE_SIZE == 128)
-DItype
-__fixtfdi (TFtype a)
-{
- if (a < 0)
- return - __fixunstfdi (-a);
- return __fixunstfdi (a);
-}
-#endif
-
-#if defined(L_fixunsxfdi) && (LONG_DOUBLE_TYPE_SIZE == 96)
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
-
-DItype
-__fixunsxfdi (XFtype a)
-{
- XFtype b;
- UDItype v;
-
- if (a < 0)
- return 0;
-
- /* Compute high word of result, as a flonum. */
- b = (a / HIGH_WORD_COEFF);
- /* Convert that to fixed (but not to DItype!),
- and shift it into the high word. */
- v = (USItype) b;
- v <<= WORD_SIZE;
- /* Remove high part from the XFtype, leaving the low part as flonum. */
- a -= (XFtype)v;
- /* Convert that to fixed (but not to DItype!) and add it in.
- Sometimes A comes out negative. This is significant, since
- A has more bits than a long int does. */
- if (a < 0)
- v -= (USItype) (- a);
- else
- v += (USItype) a;
- return v;
-}
-#endif
-
-#if defined(L_fixxfdi) && (LONG_DOUBLE_TYPE_SIZE == 96)
-DItype
-__fixxfdi (XFtype a)
-{
- if (a < 0)
- return - __fixunsxfdi (-a);
- return __fixunsxfdi (a);
-}
-#endif
-
-#ifdef L_fixunsdfdi
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
-
-DItype
-__fixunsdfdi (DFtype a)
-{
- DFtype b;
- UDItype v;
-
- if (a < 0)
- return 0;
-
- /* Compute high word of result, as a flonum. */
- b = (a / HIGH_WORD_COEFF);
- /* Convert that to fixed (but not to DItype!),
- and shift it into the high word. */
- v = (USItype) b;
- v <<= WORD_SIZE;
- /* Remove high part from the DFtype, leaving the low part as flonum. */
- a -= (DFtype)v;
- /* Convert that to fixed (but not to DItype!) and add it in.
- Sometimes A comes out negative. This is significant, since
- A has more bits than a long int does. */
- if (a < 0)
- v -= (USItype) (- a);
- else
- v += (USItype) a;
- return v;
-}
-#endif
-
-#ifdef L_fixdfdi
-DItype
-__fixdfdi (DFtype a)
-{
- if (a < 0)
- return - __fixunsdfdi (-a);
- return __fixunsdfdi (a);
-}
-#endif
-
-#ifdef L_fixunssfdi
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
-
-DItype
-__fixunssfdi (SFtype original_a)
-{
- /* Convert the SFtype to a DFtype, because that is surely not going
- to lose any bits. Some day someone else can write a faster version
- that avoids converting to DFtype, and verify it really works right. */
- DFtype a = original_a;
- DFtype b;
- UDItype v;
-
- if (a < 0)
- return 0;
-
- /* Compute high word of result, as a flonum. */
- b = (a / HIGH_WORD_COEFF);
- /* Convert that to fixed (but not to DItype!),
- and shift it into the high word. */
- v = (USItype) b;
- v <<= WORD_SIZE;
- /* Remove high part from the DFtype, leaving the low part as flonum. */
- a -= (DFtype)v;
- /* Convert that to fixed (but not to DItype!) and add it in.
- Sometimes A comes out negative. This is significant, since
- A has more bits than a long int does. */
- if (a < 0)
- v -= (USItype) (- a);
- else
- v += (USItype) a;
- return v;
-}
-#endif
-
-#ifdef L_fixsfdi
-DItype
-__fixsfdi (SFtype a)
-{
- if (a < 0)
- return - __fixunssfdi (-a);
- return __fixunssfdi (a);
-}
-#endif
-
-#if defined(L_floatdixf) && (LONG_DOUBLE_TYPE_SIZE == 96)
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-#define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
-#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
-
-XFtype
-__floatdixf (DItype u)
-{
- XFtype d;
- SItype negate = 0;
-
- if (u < 0)
- u = -u, negate = 1;
-
- d = (USItype) (u >> WORD_SIZE);
- d *= HIGH_HALFWORD_COEFF;
- d *= HIGH_HALFWORD_COEFF;
- d += (USItype) (u & (HIGH_WORD_COEFF - 1));
-
- return (negate ? -d : d);
-}
-#endif
-
-#if defined(L_floatditf) && (LONG_DOUBLE_TYPE_SIZE == 128)
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-#define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
-#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
-
-TFtype
-__floatditf (DItype u)
-{
- TFtype d;
- SItype negate = 0;
-
- if (u < 0)
- u = -u, negate = 1;
-
- d = (USItype) (u >> WORD_SIZE);
- d *= HIGH_HALFWORD_COEFF;
- d *= HIGH_HALFWORD_COEFF;
- d += (USItype) (u & (HIGH_WORD_COEFF - 1));
-
- return (negate ? -d : d);
-}
-#endif
-
-#ifdef L_floatdidf
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-#define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
-#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
-
-DFtype
-__floatdidf (DItype u)
-{
- DFtype d;
- SItype negate = 0;
-
- if (u < 0)
- u = -u, negate = 1;
-
- d = (USItype) (u >> WORD_SIZE);
- d *= HIGH_HALFWORD_COEFF;
- d *= HIGH_HALFWORD_COEFF;
- d += (USItype) (u & (HIGH_WORD_COEFF - 1));
-
- return (negate ? -d : d);
-}
-#endif
-
-#ifdef L_floatdisf
-#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-#define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
-#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
-#define DI_SIZE (sizeof (DItype) * BITS_PER_UNIT)
-
-/* Define codes for all the float formats that we know of. Note
- that this is copied from real.h. */
-
-#define UNKNOWN_FLOAT_FORMAT 0
-#define IEEE_FLOAT_FORMAT 1
-#define VAX_FLOAT_FORMAT 2
-#define IBM_FLOAT_FORMAT 3
-
-/* Default to IEEE float if not specified. Nearly all machines use it. */
-#ifndef HOST_FLOAT_FORMAT
-#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-#endif
-
-#if HOST_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
-#define DF_SIZE 53
-#define SF_SIZE 24
-#endif
-
-#if HOST_FLOAT_FORMAT == IBM_FLOAT_FORMAT
-#define DF_SIZE 56
-#define SF_SIZE 24
-#endif
-
-#if HOST_FLOAT_FORMAT == VAX_FLOAT_FORMAT
-#define DF_SIZE 56
-#define SF_SIZE 24
-#endif
-
-SFtype
-__floatdisf (DItype u)
-{
- /* Do the calculation in DFmode
- so that we don't lose any of the precision of the high word
- while multiplying it. */
- DFtype f;
- SItype negate = 0;
-
- if (u < 0)
- u = -u, negate = 1;
-
- /* Protect against double-rounding error.
- Represent any low-order bits, that might be truncated in DFmode,
- by a bit that won't be lost. The bit can go in anywhere below the
- rounding position of the SFmode. A fixed mask and bit position
- handles all usual configurations. It doesn't handle the case
- of 128-bit DImode, however. */
- if (DF_SIZE < DI_SIZE
- && DF_SIZE > (DI_SIZE - DF_SIZE + SF_SIZE))
- {
-#define REP_BIT ((USItype) 1 << (DI_SIZE - DF_SIZE))
- if (u >= ((UDItype) 1 << DF_SIZE))
- {
- if ((USItype) u & (REP_BIT - 1))
- u |= REP_BIT;
- }
- }
- f = (USItype) (u >> WORD_SIZE);
- f *= HIGH_HALFWORD_COEFF;
- f *= HIGH_HALFWORD_COEFF;
- f += (USItype) (u & (HIGH_WORD_COEFF - 1));
-
- return (SFtype) (negate ? -f : f);
-}
-#endif
-
-#if defined(L_fixunsxfsi) && LONG_DOUBLE_TYPE_SIZE == 96
-/* Reenable the normal types, in case limits.h needs them. */
-#undef char
-#undef short
-#undef int
-#undef long
-#undef unsigned
-#undef float
-#undef double
-#undef MIN
-#undef MAX
-#include <limits.h>
-
-USItype
-__fixunsxfsi (XFtype a)
-{
- if (a >= - (DFtype) LONG_MIN)
- return (SItype) (a + LONG_MIN) - LONG_MIN;
- return (SItype) a;
-}
-#endif
-
-#ifdef L_fixunsdfsi
-/* Reenable the normal types, in case limits.h needs them. */
-#undef char
-#undef short
-#undef int
-#undef long
-#undef unsigned
-#undef float
-#undef double
-#undef MIN
-#undef MAX
-#include <limits.h>
-
-USItype
-__fixunsdfsi (DFtype a)
-{
- if (a >= - (DFtype) LONG_MIN)
- return (SItype) (a + LONG_MIN) - LONG_MIN;
- return (SItype) a;
-}
-#endif
-
-#ifdef L_fixunssfsi
-/* Reenable the normal types, in case limits.h needs them. */
-#undef char
-#undef short
-#undef int
-#undef long
-#undef unsigned
-#undef float
-#undef double
-#undef MIN
-#undef MAX
-#include <limits.h>
-
-USItype
-__fixunssfsi (SFtype a)
-{
- if (a >= - (SFtype) LONG_MIN)
- return (SItype) (a + LONG_MIN) - LONG_MIN;
- return (SItype) a;
-}
-#endif
-
-/* From here on down, the routines use normal data types. */
-
-#define SItype bogus_type
-#define USItype bogus_type
-#define DItype bogus_type
-#define UDItype bogus_type
-#define SFtype bogus_type
-#define DFtype bogus_type
-
-#undef char
-#undef short
-#undef int
-#undef long
-#undef unsigned
-#undef float
-#undef double
-
-#ifdef L__gcc_bcmp
-
-/* Like bcmp except the sign is meaningful.
- Result is negative if S1 is less than S2,
- positive if S1 is greater, 0 if S1 and S2 are equal. */
-
-int
-__gcc_bcmp (unsigned char *s1, unsigned char *s2, size_t size)
-{
- while (size > 0)
- {
- unsigned char c1 = *s1++, c2 = *s2++;
- if (c1 != c2)
- return c1 - c2;
- size--;
- }
- return 0;
-}
-
-#endif
-
-#ifdef L__dummy
-void
-__dummy () {}
-#endif
-
-#ifdef L_varargs
-#ifdef __i860__
-#if defined(__svr4__) || defined(__alliant__)
- asm (" .text");
- asm (" .align 4");
-
-/* The Alliant needs the added underscore. */
- asm (".globl __builtin_saveregs");
-asm ("__builtin_saveregs:");
- asm (".globl ___builtin_saveregs");
-asm ("___builtin_saveregs:");
-
- asm (" andnot 0x0f,%sp,%sp"); /* round down to 16-byte boundary */
- asm (" adds -96,%sp,%sp"); /* allocate stack space for reg save
- area and also for a new va_list
- structure */
- /* Save all argument registers in the arg reg save area. The
- arg reg save area must have the following layout (according
- to the svr4 ABI):
-
- struct {
- union {
- float freg[8];
- double dreg[4];
- } float_regs;
- long ireg[12];
- };
- */
-
- asm (" fst.q %f8, 0(%sp)"); /* save floating regs (f8-f15) */
- asm (" fst.q %f12,16(%sp)");
-
- asm (" st.l %r16,32(%sp)"); /* save integer regs (r16-r27) */
- asm (" st.l %r17,36(%sp)");
- asm (" st.l %r18,40(%sp)");
- asm (" st.l %r19,44(%sp)");
- asm (" st.l %r20,48(%sp)");
- asm (" st.l %r21,52(%sp)");
- asm (" st.l %r22,56(%sp)");
- asm (" st.l %r23,60(%sp)");
- asm (" st.l %r24,64(%sp)");
- asm (" st.l %r25,68(%sp)");
- asm (" st.l %r26,72(%sp)");
- asm (" st.l %r27,76(%sp)");
-
- asm (" adds 80,%sp,%r16"); /* compute the address of the new
- va_list structure. Put in into
- r16 so that it will be returned
- to the caller. */
-
- /* Initialize all fields of the new va_list structure. This
- structure looks like:
-
- typedef struct {
- unsigned long ireg_used;
- unsigned long freg_used;
- long *reg_base;
- long *mem_ptr;
- } va_list;
- */
-
- asm (" st.l %r0, 0(%r16)"); /* nfixed */
- asm (" st.l %r0, 4(%r16)"); /* nfloating */
- asm (" st.l %sp, 8(%r16)"); /* __va_ctl points to __va_struct. */
- asm (" bri %r1"); /* delayed return */
- asm (" st.l %r28,12(%r16)"); /* pointer to overflow args */
-
-#else /* not __svr4__ */
-#if defined(__PARAGON__)
- /*
- * we'll use SVR4-ish varargs but need SVR3.2 assembler syntax,
- * and we stand a better chance of hooking into libraries
- * compiled by PGI. [andyp@ssd.intel.com]
- */
- asm (" .text");
- asm (" .align 4");
- asm (".globl __builtin_saveregs");
-asm ("__builtin_saveregs:");
- asm (".globl ___builtin_saveregs");
-asm ("___builtin_saveregs:");
-
- asm (" andnot 0x0f,sp,sp"); /* round down to 16-byte boundary */
- asm (" adds -96,sp,sp"); /* allocate stack space for reg save
- area and also for a new va_list
- structure */
- /* Save all argument registers in the arg reg save area. The
- arg reg save area must have the following layout (according
- to the svr4 ABI):
-
- struct {
- union {
- float freg[8];
- double dreg[4];
- } float_regs;
- long ireg[12];
- };
- */
-
- asm (" fst.q f8, 0(sp)");
- asm (" fst.q f12,16(sp)");
- asm (" st.l r16,32(sp)");
- asm (" st.l r17,36(sp)");
- asm (" st.l r18,40(sp)");
- asm (" st.l r19,44(sp)");
- asm (" st.l r20,48(sp)");
- asm (" st.l r21,52(sp)");
- asm (" st.l r22,56(sp)");
- asm (" st.l r23,60(sp)");
- asm (" st.l r24,64(sp)");
- asm (" st.l r25,68(sp)");
- asm (" st.l r26,72(sp)");
- asm (" st.l r27,76(sp)");
-
- asm (" adds 80,sp,r16"); /* compute the address of the new
- va_list structure. Put in into
- r16 so that it will be returned
- to the caller. */
-
- /* Initialize all fields of the new va_list structure. This
- structure looks like:
-
- typedef struct {
- unsigned long ireg_used;
- unsigned long freg_used;
- long *reg_base;
- long *mem_ptr;
- } va_list;
- */
-
- asm (" st.l r0, 0(r16)"); /* nfixed */
- asm (" st.l r0, 4(r16)"); /* nfloating */
- asm (" st.l sp, 8(r16)"); /* __va_ctl points to __va_struct. */
- asm (" bri r1"); /* delayed return */
- asm (" st.l r28,12(r16)"); /* pointer to overflow args */
-#else /* not __PARAGON__ */
- asm (" .text");
- asm (" .align 4");
-
- asm (".globl ___builtin_saveregs");
- asm ("___builtin_saveregs:");
- asm (" mov sp,r30");
- asm (" andnot 0x0f,sp,sp");
- asm (" adds -96,sp,sp"); /* allocate sufficient space on the stack */
-
-/* Fill in the __va_struct. */
- asm (" st.l r16, 0(sp)"); /* save integer regs (r16-r27) */
- asm (" st.l r17, 4(sp)"); /* int fixed[12] */
- asm (" st.l r18, 8(sp)");
- asm (" st.l r19,12(sp)");
- asm (" st.l r20,16(sp)");
- asm (" st.l r21,20(sp)");
- asm (" st.l r22,24(sp)");
- asm (" st.l r23,28(sp)");
- asm (" st.l r24,32(sp)");
- asm (" st.l r25,36(sp)");
- asm (" st.l r26,40(sp)");
- asm (" st.l r27,44(sp)");
-
- asm (" fst.q f8, 48(sp)"); /* save floating regs (f8-f15) */
- asm (" fst.q f12,64(sp)"); /* int floating[8] */
-
-/* Fill in the __va_ctl. */
- asm (" st.l sp, 80(sp)"); /* __va_ctl points to __va_struct. */
- asm (" st.l r28,84(sp)"); /* pointer to more args */
- asm (" st.l r0, 88(sp)"); /* nfixed */
- asm (" st.l r0, 92(sp)"); /* nfloating */
-
- asm (" adds 80,sp,r16"); /* return address of the __va_ctl. */
- asm (" bri r1");
- asm (" mov r30,sp");
- /* recover stack and pass address to start
- of data. */
-#endif /* not __PARAGON__ */
-#endif /* not __svr4__ */
-#else /* not __i860__ */
-#ifdef __sparc__
- asm (".global __builtin_saveregs");
- asm ("__builtin_saveregs:");
- asm (".global ___builtin_saveregs");
- asm ("___builtin_saveregs:");
-#ifdef NEED_PROC_COMMAND
- asm (".proc 020");
-#endif
- asm ("st %i0,[%fp+68]");
- asm ("st %i1,[%fp+72]");
- asm ("st %i2,[%fp+76]");
- asm ("st %i3,[%fp+80]");
- asm ("st %i4,[%fp+84]");
- asm ("retl");
- asm ("st %i5,[%fp+88]");
-#ifdef NEED_TYPE_COMMAND
- asm (".type __builtin_saveregs,#function");
- asm (".size __builtin_saveregs,.-__builtin_saveregs");
-#endif
-#else /* not __sparc__ */
-#if defined(__MIPSEL__) | defined(__R3000__) | defined(__R2000__) | defined(__mips__)
-
- asm (" .text");
- asm (" .ent __builtin_saveregs");
- asm (" .globl __builtin_saveregs");
- asm ("__builtin_saveregs:");
- asm (" sw $4,0($30)");
- asm (" sw $5,4($30)");
- asm (" sw $6,8($30)");
- asm (" sw $7,12($30)");
- asm (" j $31");
- asm (" .end __builtin_saveregs");
-#else /* not __mips__, etc. */
-
-void *
-__builtin_saveregs ()
-{
- abort ();
-}
-
-#endif /* not __mips__ */
-#endif /* not __sparc__ */
-#endif /* not __i860__ */
-#endif
-
-#ifdef L_eprintf
-#ifndef inhibit_libc
-
-#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */
-#include <stdio.h>
-/* This is used by the `assert' macro. */
-void
-__eprintf (const char *string, const char *expression,
- int line, const char *filename)
-{
- fprintf (stderr, string, expression, line, filename);
- fflush (stderr);
- abort ();
-}
-
-#endif
-#endif
-
-#ifdef L_bb
-
-/* Structure emitted by -a */
-struct bb
-{
- long zero_word;
- const char *filename;
- long *counts;
- long ncounts;
- struct bb *next;
- const unsigned long *addresses;
-
- /* Older GCC's did not emit these fields. */
- long nwords;
- const char **functions;
- const long *line_nums;
- const char **filenames;
- char *flags;
-};
-
-#ifdef BLOCK_PROFILER_CODE
-BLOCK_PROFILER_CODE
-#else
-#ifndef inhibit_libc
-
-/* Simple minded basic block profiling output dumper for
- systems that don't provide tcov support. At present,
- it requires atexit and stdio. */
-
-#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */
-#include <stdio.h>
-char *ctime ();
-
-#include "gbl-ctors.h"
-#include "gcov-io.h"
-
-static struct bb *bb_head;
-
-/* Return the number of digits needed to print a value */
-/* __inline__ */ static int num_digits (long value, int base)
-{
- int minus = (value < 0 && base != 16);
- unsigned long v = (minus) ? -value : value;
- int ret = minus;
-
- do
- {
- v /= base;
- ret++;
- }
- while (v);
-
- return ret;
-}
-
-void
-__bb_exit_func (void)
-{
- FILE *da_file, *file;
- long time_value;
- int i;
-
- if (bb_head == 0)
- return;
-
- i = strlen (bb_head->filename) - 3;
-
- if (!strcmp (bb_head->filename+i, ".da"))
- {
- /* Must be -fprofile-arcs not -a.
- Dump data in a form that gcov expects. */
-
- struct bb *ptr;
-
- for (ptr = bb_head; ptr != (struct bb *) 0; ptr = ptr->next)
- {
- /* If the file exists, and the number of counts in it is the same,
- then merge them in. */
-
- if ((da_file = fopen (ptr->filename, "r")) != NULL)
- {
- long n_counts = 0;
- unsigned char tmp;
- int i;
- int ret = 0;
-
-
- if (__read_long (&n_counts, da_file, 8) != 0)
- {
- fprintf (stderr, "arc profiling: Can't read output file %s.\n",
- ptr->filename);
- continue;
- }
-
- if (n_counts == ptr->ncounts)
- {
- int i;
-
- for (i = 0; i < n_counts; i++)
- {
- long v = 0;
- unsigned char tmp;
- int j;
- int ret = 0;
-
- if (__read_long (&v, da_file, 8) != 0)
- {
- fprintf (stderr, "arc profiling: Can't read output file %s.\n",
- ptr->filename);
- break;
- }
- ptr->counts[i] += v;
- }
- }
-
- if (fclose (da_file) == EOF)
- fprintf (stderr, "arc profiling: Error closing output file %s.\n",
- ptr->filename);
- }
- if ((da_file = fopen (ptr->filename, "w")) < 0)
- {
- fprintf (stderr, "arc profiling: Can't open output file %s.\n",
- ptr->filename);
- continue;
- }
-
- /* ??? Should first write a header to the file. Perferably, a 4 byte
- magic number, 4 bytes containing the time the program was
- compiled, 4 bytes containing the last modification time of the
- source file, and 4 bytes indicating the compiler options used.
-
- That way we can easily verify that the proper source/executable/
- data file combination is being used from gcov. */
-
- if (__write_long (ptr->ncounts, da_file, 8) != 0)
- {
-
- fprintf (stderr, "arc profiling: Error writing output file %s.\n",
- ptr->filename);
- }
- else
- {
- int j;
- long *count_ptr = ptr->counts;
- int ret = 0;
- for (j = ptr->ncounts; j > 0; j--)
- {
- if (__write_long (*count_ptr, da_file, 8) != 0)
- {
- ret=1;
- break;
- }
- count_ptr++;
- }
- if (ret)
- fprintf (stderr, "arc profiling: Error writing output file %s.\n",
- ptr->filename);
- }
-
- if (fclose (da_file) == EOF)
- fprintf (stderr, "arc profiling: Error closing output file %s.\n",
- ptr->filename);
- }
-
- return;
- }
-
- /* Must be basic block profiling. Emit a human readable output file. */
-
- file = fopen ("bb.out", "a");
-
- if (!file)
- perror ("bb.out");
-
- else
- {
- struct bb *ptr;
-
- /* This is somewhat type incorrect, but it avoids worrying about
- exactly where time.h is included from. It should be ok unless
- a void * differs from other pointer formats, or if sizeof (long)
- is < sizeof (time_t). It would be nice if we could assume the
- use of rationale standards here. */
-
- time ((void *) &time_value);
- fprintf (file, "Basic block profiling finished on %s\n", ctime ((void *) &time_value));
-
- /* We check the length field explicitly in order to allow compatibility
- with older GCC's which did not provide it. */
-
- for (ptr = bb_head; ptr != (struct bb *) 0; ptr = ptr->next)
- {
- int i;
- int func_p = (ptr->nwords >= sizeof (struct bb)
- && ptr->nwords <= 1000
- && ptr->functions);
- int line_p = (func_p && ptr->line_nums);
- int file_p = (func_p && ptr->filenames);
- int addr_p = (ptr->addresses != 0);
- long ncounts = ptr->ncounts;
- long cnt_max = 0;
- long line_max = 0;
- long addr_max = 0;
- int file_len = 0;
- int func_len = 0;
- int blk_len = num_digits (ncounts, 10);
- int cnt_len;
- int line_len;
- int addr_len;
-
- fprintf (file, "File %s, %ld basic blocks \n\n",
- ptr->filename, ncounts);
-
- /* Get max values for each field. */
- for (i = 0; i < ncounts; i++)
- {
- const char *p;
- int len;
-
- if (cnt_max < ptr->counts[i])
- cnt_max = ptr->counts[i];
-
- if (addr_p && addr_max < ptr->addresses[i])
- addr_max = ptr->addresses[i];
-
- if (line_p && line_max < ptr->line_nums[i])
- line_max = ptr->line_nums[i];
-
- if (func_p)
- {
- p = (ptr->functions[i]) ? (ptr->functions[i]) : "<none>";
- len = strlen (p);
- if (func_len < len)
- func_len = len;
- }
-
- if (file_p)
- {
- p = (ptr->filenames[i]) ? (ptr->filenames[i]) : "<none>";
- len = strlen (p);
- if (file_len < len)
- file_len = len;
- }
- }
-
- addr_len = num_digits (addr_max, 16);
- cnt_len = num_digits (cnt_max, 10);
- line_len = num_digits (line_max, 10);
-
- /* Now print out the basic block information. */
- for (i = 0; i < ncounts; i++)
- {
- fprintf (file,
- " Block #%*d: executed %*ld time(s)",
- blk_len, i+1,
- cnt_len, ptr->counts[i]);
-
- if (addr_p)
- fprintf (file, " address= 0x%.*lx", addr_len,
- ptr->addresses[i]);
-
- if (func_p)
- fprintf (file, " function= %-*s", func_len,
- (ptr->functions[i]) ? ptr->functions[i] : "<none>");
-
- if (line_p)
- fprintf (file, " line= %*ld", line_len, ptr->line_nums[i]);
-
- if (file_p)
- fprintf (file, " file= %s",
- (ptr->filenames[i]) ? ptr->filenames[i] : "<none>");
-
- fprintf (file, "\n");
- }
-
- fprintf (file, "\n");
- fflush (file);
- }
-
- fprintf (file, "\n\n");
- fclose (file);
- }
-}
-
-void
-__bb_init_func (struct bb *blocks)
-{
- /* User is supposed to check whether the first word is non-0,
- but just in case.... */
-
- if (blocks->zero_word)
- return;
-
-#ifdef ON_EXIT
- /* Initialize destructor. */
- if (!bb_head)
- ON_EXIT (__bb_exit_func, 0);
-#endif
-
- /* Set up linked list. */
- blocks->zero_word = 1;
- blocks->next = bb_head;
- bb_head = blocks;
-}
-
-#ifndef MACHINE_STATE_SAVE
-#define MACHINE_STATE_SAVE(ID)
-#endif
-#ifndef MACHINE_STATE_RESTORE
-#define MACHINE_STATE_RESTORE(ID)
-#endif
-
-#include <string.h>
-
-/* Number of buckets in hashtable of basic block addresses. */
-
-#define BB_BUCKETS 311
-
-/* Maximum length of string in file bb.in. */
-
-#define BBINBUFSIZE 500
-
-/* BBINBUFSIZE-1 with double quotes. We could use #BBINBUFSIZE or
- "BBINBUFSIZE" but want to avoid trouble with preprocessors. */
-
-#define BBINBUFSIZESTR "499"
-
-struct bb_edge
-{
- struct bb_edge *next;
- unsigned long src_addr;
- unsigned long dst_addr;
- unsigned long count;
-};
-
-enum bb_func_mode
-{
- TRACE_KEEP = 0, TRACE_ON = 1, TRACE_OFF = 2
-};
-
-struct bb_func
-{
- struct bb_func *next;
- char *funcname;
- char *filename;
- enum bb_func_mode mode;
-};
-
-/* This is the connection to the outside world.
- The BLOCK_PROFILER macro must set __bb.blocks
- and __bb.blockno. */
-
-struct {
- unsigned long blockno;
- struct bb *blocks;
-} __bb;
-
-/* Vars to store addrs of source and destination basic blocks
- of a jump. */
-
-static unsigned long bb_src = 0;
-static unsigned long bb_dst = 0;
-
-static FILE *bb_tracefile = (FILE *) 0;
-static struct bb_edge **bb_hashbuckets = (struct bb_edge **) 0;
-static struct bb_func *bb_func_head = (struct bb_func *) 0;
-static unsigned long bb_callcount = 0;
-static int bb_mode = 0;
-
-static unsigned long *bb_stack = (unsigned long *) 0;
-static size_t bb_stacksize = 0;
-
-static int reported = 0;
-
-/* Trace modes:
-Always : Print execution frequencies of basic blocks
- to file bb.out.
-bb_mode & 1 != 0 : Dump trace of basic blocks to file bbtrace[.gz]
-bb_mode & 2 != 0 : Print jump frequencies to file bb.out.
-bb_mode & 4 != 0 : Cut call instructions from basic block flow.
-bb_mode & 8 != 0 : Insert return instructions in basic block flow.
-*/
-
-#ifdef HAVE_POPEN
-
-/*#include <sys/types.h>*/
-#include <sys/stat.h>
-/*#include <malloc.h>*/
-
-/* Commands executed by gopen. */
-
-#define GOPENDECOMPRESS "gzip -cd "
-#define GOPENCOMPRESS "gzip -c >"
-
-/* Like fopen but pipes through gzip. mode may only be "r" or "w".
- If it does not compile, simply replace gopen by fopen and delete
- '.gz' from any first parameter to gopen. */
-
-static FILE *
-gopen (char *fn, char *mode)
-{
- int use_gzip;
- char *p;
-
- if (mode[1])
- return (FILE *) 0;
-
- if (mode[0] != 'r' && mode[0] != 'w')
- return (FILE *) 0;
-
- p = fn + strlen (fn)-1;
- use_gzip = ((p[-1] == '.' && (p[0] == 'Z' || p[0] == 'z')) ||
- (p[-2] == '.' && p[-1] == 'g' && p[0] == 'z'));
-
- if (use_gzip)
- {
- if (mode[0]=='r')
- {
- FILE *f;
- char *s = (char *) malloc (sizeof (char) * strlen (fn)
- + sizeof (GOPENDECOMPRESS));
- strcpy (s, GOPENDECOMPRESS);
- strcpy (s + (sizeof (GOPENDECOMPRESS)-1), fn);
- f = popen (s, mode);
- free (s);
- return f;
- }
-
- else
- {
- FILE *f;
- char *s = (char *) malloc (sizeof (char) * strlen (fn)
- + sizeof (GOPENCOMPRESS));
- strcpy (s, GOPENCOMPRESS);
- strcpy (s + (sizeof (GOPENCOMPRESS)-1), fn);
- if (!(f = popen (s, mode)))
- f = fopen (s, mode);
- free (s);
- return f;
- }
- }
-
- else
- return fopen (fn, mode);
-}
-
-static int
-gclose (FILE *f)
-{
- struct stat buf;
-
- if (f != NULL)
- {
- if (!fstat (fileno (f), &buf) && S_ISFIFO (buf.st_mode))
- return pclose (f);
-
- return fclose (f);
- }
- return 0;
-}
-
-#endif /* HAVE_POPEN */
-
-/* Called once per program. */
-
-static void
-__bb_exit_trace_func ()
-{
- FILE *file = fopen ("bb.out", "a");
- struct bb_func *f;
- struct bb_edge *e;
- struct bb *b;
-
- if (!file)
- perror ("bb.out");
-
- if (bb_mode & 1)
- {
- if (!bb_tracefile)
- perror ("bbtrace");
- else
-#ifdef HAVE_POPEN
- gclose (bb_tracefile);
-#else
- fclose (bb_tracefile);
-#endif /* HAVE_POPEN */
- }
-
- /* Check functions in `bb.in'. */
-
- if (file)
- {
- long time_value;
- const struct bb_func *p;
- int printed_something = 0;
- struct bb *ptr;
- long blk;
-
- /* This is somewhat type incorrect. */
- time ((void *) &time_value);
-
- for (p = bb_func_head; p != (struct bb_func *) 0; p = p->next)
- {
- for (ptr = bb_head; ptr != (struct bb *) 0; ptr = ptr->next)
- {
- if (!ptr->filename || p->filename != (char *) 0 && strcmp (p->filename, ptr->filename))
- continue;
- for (blk = 0; blk < ptr->ncounts; blk++)
- {
- if (!strcmp (p->funcname, ptr->functions[blk]))
- goto found;
- }
- }
-
- if (!printed_something)
- {
- fprintf (file, "Functions in `bb.in' not executed during basic block profiling on %s\n", ctime ((void *) &time_value));
- printed_something = 1;
- }
-
- fprintf (file, "\tFunction %s", p->funcname);
- if (p->filename)
- fprintf (file, " of file %s", p->filename);
- fprintf (file, "\n" );
-
-found: ;
- }
-
- if (printed_something)
- fprintf (file, "\n");
-
- }
-
- if (bb_mode & 2)
- {
- if (!bb_hashbuckets)
- {
- if (!reported)
- {
- fprintf (stderr, "Profiler: out of memory\n");
- reported = 1;
- }
- return;
- }
-
- else if (file)
- {
- long time_value;
- int i;
- unsigned long addr_max = 0;
- unsigned long cnt_max = 0;
- int cnt_len;
- int addr_len;
-
- /* This is somewhat type incorrect, but it avoids worrying about
- exactly where time.h is included from. It should be ok unless
- a void * differs from other pointer formats, or if sizeof (long)
- is < sizeof (time_t). It would be nice if we could assume the
- use of rationale standards here. */
-
- time ((void *) &time_value);
- fprintf (file, "Basic block jump tracing");
-
- switch (bb_mode & 12)
- {
- case 0:
- fprintf (file, " (with call)");
- break;
-
- case 4:
- /* Print nothing. */
- break;
-
- case 8:
- fprintf (file, " (with call & ret)");
- break;
-
- case 12:
- fprintf (file, " (with ret)");
- break;
- }
-
- fprintf (file, " finished on %s\n", ctime ((void *) &time_value));
-
- for (i = 0; i < BB_BUCKETS; i++)
- {
- struct bb_edge *bucket = bb_hashbuckets[i];
- for ( ; bucket; bucket = bucket->next )
- {
- if (addr_max < bucket->src_addr)
- addr_max = bucket->src_addr;
- if (addr_max < bucket->dst_addr)
- addr_max = bucket->dst_addr;
- if (cnt_max < bucket->count)
- cnt_max = bucket->count;
- }
- }
- addr_len = num_digits (addr_max, 16);
- cnt_len = num_digits (cnt_max, 10);
-
- for ( i = 0; i < BB_BUCKETS; i++)
- {
- struct bb_edge *bucket = bb_hashbuckets[i];
- for ( ; bucket; bucket = bucket->next )
- {
- fprintf (file, "Jump from block 0x%.*lx to "
- "block 0x%.*lx executed %*d time(s)\n",
- addr_len, bucket->src_addr,
- addr_len, bucket->dst_addr,
- cnt_len, bucket->count);
- }
- }
-
- fprintf (file, "\n");
-
- }
- }
-
- if (file)
- fclose (file);
-
- /* Free allocated memory. */
-
- f = bb_func_head;
- while (f)
- {
- struct bb_func *old = f;
-
- f = f->next;
- if (old->funcname) free (old->funcname);
- if (old->filename) free (old->filename);
- free (old);
- }
-
- if (bb_stack)
- free (bb_stack);
-
- if (bb_hashbuckets)
- {
- int i;
-
- for (i = 0; i < BB_BUCKETS; i++)
- {
- struct bb_edge *old, *bucket = bb_hashbuckets[i];
-
- while (bucket)
- {
- old = bucket;
- bucket = bucket->next;
- free (old);
- }
- }
- free (bb_hashbuckets);
- }
-
- for (b = bb_head; b; b = b->next)
- if (b->flags) free (b->flags);
-}
-
-/* Called once per program. */
-
-static void
-__bb_init_prg ()
-{
-
- FILE *file;
- char buf[BBINBUFSIZE];
- const char *p;
- const char *pos;
- enum bb_func_mode m;
-
-#ifdef ON_EXIT
- /* Initialize destructor. */
- ON_EXIT (__bb_exit_func, 0);
-#endif
-
- if (!(file = fopen ("bb.in", "r")))
- return;
-
- while(fscanf (file, " %" BBINBUFSIZESTR "s ", buf) != EOF)
- {
- p = buf;
- if (*p == '-')
- {
- m = TRACE_OFF;
- p++;
- }
- else
- {
- m = TRACE_ON;
- }
- if (!strcmp (p, "__bb_trace__"))
- bb_mode |= 1;
- else if (!strcmp (p, "__bb_jumps__"))
- bb_mode |= 2;
- else if (!strcmp (p, "__bb_hidecall__"))
- bb_mode |= 4;
- else if (!strcmp (p, "__bb_showret__"))
- bb_mode |= 8;
- else
- {
- struct bb_func *f = (struct bb_func *) malloc (sizeof (struct bb_func));
- if (f)
- {
- unsigned long l;
- f->next = bb_func_head;
- if (pos = strchr (p, ':'))
- {
- if (!(f->funcname = (char *) malloc (strlen (pos+1)+1)))
- continue;
- strcpy (f->funcname, pos+1);
- l = pos-p;
- if ((f->filename = (char *) malloc (l+1)))
- {
- strncpy (f->filename, p, l);
- f->filename[l] = '\0';
- }
- else
- f->filename = (char *) 0;
- }
- else
- {
- if (!(f->funcname = (char *) malloc (strlen (p)+1)))
- continue;
- strcpy (f->funcname, p);
- f->filename = (char *) 0;
- }
- f->mode = m;
- bb_func_head = f;
- }
- }
- }
- fclose (file);
-
-#ifdef HAVE_POPEN
-
- if (bb_mode & 1)
- bb_tracefile = gopen ("bbtrace.gz", "w");
-
-#else
-
- if (bb_mode & 1)
- bb_tracefile = fopen ("bbtrace", "w");
-
-#endif /* HAVE_POPEN */
-
- if (bb_mode & 2)
- {
- bb_hashbuckets = (struct bb_edge **)
- malloc (BB_BUCKETS * sizeof (struct bb_edge *));
- if (bb_hashbuckets)
- bzero ((char *) bb_hashbuckets, BB_BUCKETS);
- }
-
- if (bb_mode & 12)
- {
- bb_stacksize = 10;
- bb_stack = (unsigned long *) malloc (bb_stacksize * sizeof (*bb_stack));
- }
-
-#ifdef ON_EXIT
- /* Initialize destructor. */
- ON_EXIT (__bb_exit_trace_func, 0);
-#endif
-
-}
-
-/* Called upon entering a basic block. */
-
-void
-__bb_trace_func ()
-{
- struct bb_edge *bucket;
-
- MACHINE_STATE_SAVE("1")
-
- if (!bb_callcount || (__bb.blocks->flags && (__bb.blocks->flags[__bb.blockno] & TRACE_OFF)))
- goto skip;
-
- bb_dst = __bb.blocks->addresses[__bb.blockno];
- __bb.blocks->counts[__bb.blockno]++;
-
- if (bb_tracefile)
- {
- fwrite (&bb_dst, sizeof (unsigned long), 1, bb_tracefile);
- }
-
- if (bb_hashbuckets)
- {
- struct bb_edge **startbucket, **oldnext;
-
- oldnext = startbucket =
- & bb_hashbuckets[ (((int) bb_src*8) ^ (int) bb_dst) % BB_BUCKETS ];
- bucket = *startbucket;
-
- for (bucket = *startbucket; bucket;
- oldnext = &(bucket->next), bucket = *oldnext)
- {
- if ( bucket->src_addr == bb_src &&
- bucket->dst_addr == bb_dst )
- {
- bucket->count++;
- *oldnext = bucket->next;
- bucket->next = *startbucket;
- *startbucket = bucket;
- goto ret;
- }
- }
-
- bucket = (struct bb_edge *) malloc (sizeof (struct bb_edge));
-
- if (!bucket)
- {
- if (!reported)
- {
- fprintf (stderr, "Profiler: out of memory\n");
- reported = 1;
- }
- }
-
- else
- {
- bucket->src_addr = bb_src;
- bucket->dst_addr = bb_dst;
- bucket->next = *startbucket;
- *startbucket = bucket;
- bucket->count = 1;
- }
- }
-
-ret:
- bb_src = bb_dst;
-
-skip:
- ;
-
- MACHINE_STATE_RESTORE("1")
-
-}
-
-/* Called when returning from a function and `__bb_showret__' is set. */
-
-static void
-__bb_trace_func_ret ()
-{
- struct bb_edge *bucket;
-
- if (!bb_callcount || (__bb.blocks->flags && (__bb.blocks->flags[__bb.blockno] & TRACE_OFF)))
- goto skip;
-
- if (bb_hashbuckets)
- {
- struct bb_edge **startbucket, **oldnext;
-
- oldnext = startbucket =
- & bb_hashbuckets[ (((int) bb_dst * 8) ^ (int) bb_src) % BB_BUCKETS ];
- bucket = *startbucket;
-
- for (bucket = *startbucket; bucket;
- oldnext = &(bucket->next), bucket = *oldnext)
- {
- if ( bucket->src_addr == bb_dst &&
- bucket->dst_addr == bb_src )
- {
- bucket->count++;
- *oldnext = bucket->next;
- bucket->next = *startbucket;
- *startbucket = bucket;
- goto ret;
- }
- }
-
- bucket = (struct bb_edge *) malloc (sizeof (struct bb_edge));
-
- if (!bucket)
- {
- if (!reported)
- {
- fprintf (stderr, "Profiler: out of memory\n");
- reported = 1;
- }
- }
-
- else
- {
- bucket->src_addr = bb_dst;
- bucket->dst_addr = bb_src;
- bucket->next = *startbucket;
- *startbucket = bucket;
- bucket->count = 1;
- }
- }
-
-ret:
- bb_dst = bb_src;
-
-skip:
- ;
-
-}
-
-/* Called upon entering the first function of a file. */
-
-static void
-__bb_init_file (struct bb *blocks)
-{
-
- const struct bb_func *p;
- long blk, ncounts = blocks->ncounts;
- const char **functions = blocks->functions;
-
- /* Set up linked list. */
- blocks->zero_word = 1;
- blocks->next = bb_head;
- bb_head = blocks;
-
- blocks->flags = 0;
- if (!bb_func_head ||
- !(blocks->flags = (char *) malloc (sizeof (char) * blocks->ncounts)))
- return;
-
- for (blk = 0; blk < ncounts; blk++)
- blocks->flags[blk] = 0;
-
- for (blk = 0; blk < ncounts; blk++)
- {
- for (p = bb_func_head; p; p = p->next)
- {
- if (!strcmp (p->funcname, functions[blk]) &&
- (!p->filename || !strcmp (p->filename, blocks->filename)))
- {
- blocks->flags[blk] |= p->mode;
- }
- }
- }
-
-}
-
-/* Called when exiting from a function. */
-
-void
-__bb_trace_ret ()
-{
-
- MACHINE_STATE_SAVE("2")
-
- if (bb_callcount)
- {
- if ((bb_mode & 12) && bb_stacksize > bb_callcount)
- {
- bb_src = bb_stack[bb_callcount];
- if (bb_mode & 8)
- __bb_trace_func_ret ();
- }
-
- bb_callcount -= 1;
- }
-
- MACHINE_STATE_RESTORE("2")
-
-}
-
-/* Called when entering a function. */
-
-void
-__bb_init_trace_func (struct bb *blocks, unsigned long blockno)
-{
- static int trace_init = 0;
-
- MACHINE_STATE_SAVE("3")
-
- if (!blocks->zero_word)
- {
- if (!trace_init)
- {
- trace_init = 1;
- __bb_init_prg ();
- }
- __bb_init_file (blocks);
- }
-
- if (bb_callcount)
- {
-
- bb_callcount += 1;
-
- if (bb_mode & 12)
- {
- if (bb_callcount >= bb_stacksize)
- {
- size_t newsize = bb_callcount + 100;
-
- bb_stack = (unsigned long *) realloc (bb_stack, newsize);
- if (! bb_stack)
- {
- if (!reported)
- {
- fprintf (stderr, "Profiler: out of memory\n");
- reported = 1;
- }
- bb_stacksize = 0;
- goto stack_overflow;
- }
- bb_stacksize = newsize;
- }
- bb_stack[bb_callcount] = bb_src;
-
- if (bb_mode & 4)
- bb_src = 0;
-
- }
-
-stack_overflow:;
-
- }
-
- else if (blocks->flags && (blocks->flags[blockno] & TRACE_ON))
- {
- bb_callcount = 1;
- bb_src = 0;
-
- if (bb_stack)
- bb_stack[bb_callcount] = bb_src;
- }
-
- MACHINE_STATE_RESTORE("3")
-}
-
-#endif /* not inhibit_libc */
-#endif /* not BLOCK_PROFILER_CODE */
-#endif /* L_bb */
-
-/* Default free-store management functions for C++, per sections 12.5 and
- 17.3.3 of the Working Paper. */
-
-#ifdef L_op_new
-/* operator new (size_t), described in 17.3.3.5. This function is used by
- C++ programs to allocate a block of memory to hold a single object. */
-
-typedef void (*vfp)(void);
-extern vfp __new_handler;
-extern void __default_new_handler (void);
-
-#ifdef WEAK_ALIAS
-void * __builtin_new (size_t sz)
- __attribute__ ((weak, alias ("___builtin_new")));
-void *
-___builtin_new (size_t sz)
-#else
-void *
-__builtin_new (size_t sz)
-#endif
-{
- void *p;
- vfp handler = (__new_handler) ? __new_handler : __default_new_handler;
-
- /* malloc (0) is unpredictable; avoid it. */
- if (sz == 0)
- sz = 1;
- p = (void *) malloc (sz);
- while (p == 0)
- {
- (*handler) ();
- p = (void *) malloc (sz);
- }
-
- return p;
-}
-#endif /* L_op_new */
-
-#ifdef L_op_vnew
-/* void * operator new [] (size_t), described in 17.3.3.6. This function
- is used by C++ programs to allocate a block of memory for an array. */
-
-extern void * __builtin_new (size_t);
-
-#ifdef WEAK_ALIAS
-void * __builtin_vec_new (size_t sz)
- __attribute__ ((weak, alias ("___builtin_vec_new")));
-void *
-___builtin_vec_new (size_t sz)
-#else
-void *
-__builtin_vec_new (size_t sz)
-#endif
-{
- return __builtin_new (sz);
-}
-#endif /* L_op_vnew */
-
-#ifdef L_new_handler
-/* set_new_handler (fvoid_t *) and the default new handler, described in
- 17.3.3.2 and 17.3.3.5. These functions define the result of a failure
- to allocate the amount of memory requested from operator new or new []. */
-
-#ifndef inhibit_libc
-/* This gets us __GNU_LIBRARY__. */
-#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */
-#include <stdio.h>
-
-#ifdef __GNU_LIBRARY__
- /* Avoid forcing the library's meaning of `write' on the user program
- by using the "internal" name (for use within the library) */
-#define write(fd, buf, n) __write((fd), (buf), (n))
-#endif
-#endif /* inhibit_libc */
-
-typedef void (*vfp)(void);
-void __default_new_handler (void);
-
-vfp __new_handler = (vfp) 0;
-
-vfp
-set_new_handler (vfp handler)
-{
- vfp prev_handler;
-
- prev_handler = __new_handler;
- if (handler == 0) handler = __default_new_handler;
- __new_handler = handler;
- return prev_handler;
-}
-
-#define MESSAGE "Virtual memory exceeded in `new'\n"
-
-void
-__default_new_handler ()
-{
-#ifndef inhibit_libc
- /* don't use fprintf (stderr, ...) because it may need to call malloc. */
- /* This should really print the name of the program, but that is hard to
- do. We need a standard, clean way to get at the name. */
- write (2, MESSAGE, sizeof (MESSAGE));
-#endif
- /* don't call exit () because that may call global destructors which
- may cause a loop. */
- _exit (-1);
-}
-#endif
-
-#ifdef L_op_delete
-/* operator delete (void *), described in 17.3.3.3. This function is used
- by C++ programs to return to the free store a block of memory allocated
- as a single object. */
-
-#ifdef WEAK_ALIAS
-void __builtin_delete (void *ptr)
- __attribute__ ((weak, alias ("___builtin_delete")));
-void
-___builtin_delete (void *ptr)
-#else
-void
-__builtin_delete (void *ptr)
-#endif
-{
- if (ptr)
- free (ptr);
-}
-#endif
-
-#ifdef L_op_vdel
-/* operator delete [] (void *), described in 17.3.3.4. This function is
- used by C++ programs to return to the free store a block of memory
- allocated as an array. */
-
-extern void __builtin_delete (void *);
-
-#ifdef WEAK_ALIAS
-void __builtin_vec_delete (void *ptr)
- __attribute__ ((weak, alias ("___builtin_vec_delete")));
-void
-___builtin_vec_delete (void *ptr)
-#else
-void
-__builtin_vec_delete (void *ptr)
-#endif
-{
- __builtin_delete (ptr);
-}
-#endif
-
-/* End of C++ free-store management functions */
-
-#ifdef L_shtab
-unsigned int __shtab[] = {
- 0x00000001, 0x00000002, 0x00000004, 0x00000008,
- 0x00000010, 0x00000020, 0x00000040, 0x00000080,
- 0x00000100, 0x00000200, 0x00000400, 0x00000800,
- 0x00001000, 0x00002000, 0x00004000, 0x00008000,
- 0x00010000, 0x00020000, 0x00040000, 0x00080000,
- 0x00100000, 0x00200000, 0x00400000, 0x00800000,
- 0x01000000, 0x02000000, 0x04000000, 0x08000000,
- 0x10000000, 0x20000000, 0x40000000, 0x80000000
- };
-#endif
-
-#ifdef L_clear_cache
-/* Clear part of an instruction cache. */
-
-#define INSN_CACHE_PLANE_SIZE (INSN_CACHE_SIZE / INSN_CACHE_DEPTH)
-
-void
-__clear_cache (char *beg, char *end)
-{
-#ifdef CLEAR_INSN_CACHE
- CLEAR_INSN_CACHE (beg, end);
-#else
-#ifdef INSN_CACHE_SIZE
- static char array[INSN_CACHE_SIZE + INSN_CACHE_PLANE_SIZE + INSN_CACHE_LINE_WIDTH];
- static int initialized;
- int offset;
- void *start_addr
- void *end_addr;
- typedef (*function_ptr) ();
-
-#if (INSN_CACHE_SIZE / INSN_CACHE_LINE_WIDTH) < 16
- /* It's cheaper to clear the whole cache.
- Put in a series of jump instructions so that calling the beginning
- of the cache will clear the whole thing. */
-
- if (! initialized)
- {
- int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1)
- & -INSN_CACHE_LINE_WIDTH);
- int end_ptr = ptr + INSN_CACHE_SIZE;
-
- while (ptr < end_ptr)
- {
- *(INSTRUCTION_TYPE *)ptr
- = JUMP_AHEAD_INSTRUCTION + INSN_CACHE_LINE_WIDTH;
- ptr += INSN_CACHE_LINE_WIDTH;
- }
- *(INSTRUCTION_TYPE *) (ptr - INSN_CACHE_LINE_WIDTH) = RETURN_INSTRUCTION;
-
- initialized = 1;
- }
-
- /* Call the beginning of the sequence. */
- (((function_ptr) (((int) array + INSN_CACHE_LINE_WIDTH - 1)
- & -INSN_CACHE_LINE_WIDTH))
- ());
-
-#else /* Cache is large. */
-
- if (! initialized)
- {
- int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1)
- & -INSN_CACHE_LINE_WIDTH);
-
- while (ptr < (int) array + sizeof array)
- {
- *(INSTRUCTION_TYPE *)ptr = RETURN_INSTRUCTION;
- ptr += INSN_CACHE_LINE_WIDTH;
- }
-
- initialized = 1;
- }
-
- /* Find the location in array that occupies the same cache line as BEG. */
-
- offset = ((int) beg & -INSN_CACHE_LINE_WIDTH) & (INSN_CACHE_PLANE_SIZE - 1);
- start_addr = (((int) (array + INSN_CACHE_PLANE_SIZE - 1)
- & -INSN_CACHE_PLANE_SIZE)
- + offset);
-
- /* Compute the cache alignment of the place to stop clearing. */
-#if 0 /* This is not needed for gcc's purposes. */
- /* If the block to clear is bigger than a cache plane,
- we clear the entire cache, and OFFSET is already correct. */
- if (end < beg + INSN_CACHE_PLANE_SIZE)
-#endif
- offset = (((int) (end + INSN_CACHE_LINE_WIDTH - 1)
- & -INSN_CACHE_LINE_WIDTH)
- & (INSN_CACHE_PLANE_SIZE - 1));
-
-#if INSN_CACHE_DEPTH > 1
- end_addr = (start_addr & -INSN_CACHE_PLANE_SIZE) + offset;
- if (end_addr <= start_addr)
- end_addr += INSN_CACHE_PLANE_SIZE;
-
- for (plane = 0; plane < INSN_CACHE_DEPTH; plane++)
- {
- int addr = start_addr + plane * INSN_CACHE_PLANE_SIZE;
- int stop = end_addr + plane * INSN_CACHE_PLANE_SIZE;
-
- while (addr != stop)
- {
- /* Call the return instruction at ADDR. */
- ((function_ptr) addr) ();
-
- addr += INSN_CACHE_LINE_WIDTH;
- }
- }
-#else /* just one plane */
- do
- {
- /* Call the return instruction at START_ADDR. */
- ((function_ptr) start_addr) ();
-
- start_addr += INSN_CACHE_LINE_WIDTH;
- }
- while ((start_addr % INSN_CACHE_SIZE) != offset);
-#endif /* just one plane */
-#endif /* Cache is large */
-#endif /* Cache exists */
-#endif /* CLEAR_INSN_CACHE */
-}
-
-#endif /* L_clear_cache */
-
-#ifdef L_trampoline
-
-/* Jump to a trampoline, loading the static chain address. */
-
-#ifdef WINNT
-
-long getpagesize()
-{
-#ifdef _ALPHA_
- return 8192;
-#else
- return 4096;
-#endif
-}
-
-int mprotect(char *addr, int len, int prot)
-{
- int np, op;
-
- if (prot == 7) np = 0x40;
- else if (prot == 5) np = 0x20;
- else if (prot == 4) np = 0x10;
- else if (prot == 3) np = 0x04;
- else if (prot == 1) np = 0x02;
- else if (prot == 0) np = 0x01;
-
- if (VirtualProtect (addr, len, np, &op))
- return 0;
- else
- return -1;
-
-}
-
-#endif
-
-#ifdef TRANSFER_FROM_TRAMPOLINE
-TRANSFER_FROM_TRAMPOLINE
-#endif
-
-#if defined (NeXT) && defined (__MACH__)
-
-/* Make stack executable so we can call trampolines on stack.
- This is called from INITIALIZE_TRAMPOLINE in next.h. */
-#ifdef NeXTStep21
- #include <mach.h>
-#else
- #include <mach/mach.h>
-#endif
-
-void
-__enable_execute_stack (char *addr)
-{
- kern_return_t r;
- char *eaddr = addr + TRAMPOLINE_SIZE;
- vm_address_t a = (vm_address_t) addr;
-
- /* turn on execute access on stack */
- r = vm_protect (task_self (), a, TRAMPOLINE_SIZE, FALSE, VM_PROT_ALL);
- if (r != KERN_SUCCESS)
- {
- mach_error("vm_protect VM_PROT_ALL", r);
- exit(1);
- }
-
- /* We inline the i-cache invalidation for speed */
-
-#ifdef CLEAR_INSN_CACHE
- CLEAR_INSN_CACHE (addr, eaddr);
-#else
- __clear_cache ((int) addr, (int) eaddr);
-#endif
-}
-
-#endif /* defined (NeXT) && defined (__MACH__) */
-
-#ifdef __convex__
-
-/* Make stack executable so we can call trampolines on stack.
- This is called from INITIALIZE_TRAMPOLINE in convex.h. */
-
-#include <sys/mman.h>
-#include <sys/vmparam.h>
-#include <machine/machparam.h>
-
-void
-__enable_execute_stack ()
-{
- int fp;
- static unsigned lowest = USRSTACK;
- unsigned current = (unsigned) &fp & -NBPG;
-
- if (lowest > current)
- {
- unsigned len = lowest - current;
- mremap (current, &len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE);
- lowest = current;
- }
-
- /* Clear instruction cache in case an old trampoline is in it. */
- asm ("pich");
-}
-#endif /* __convex__ */
-
-#ifdef __DOLPHIN__
-
-/* Modified from the convex -code above. */
-
-#include <sys/param.h>
-#include <errno.h>
-#include <sys/m88kbcs.h>
-
-void
-__enable_execute_stack ()
-{
- int save_errno;
- static unsigned long lowest = USRSTACK;
- unsigned long current = (unsigned long) &save_errno & -NBPC;
-
- /* Ignore errno being set. memctl sets errno to EINVAL whenever the
- address is seen as 'negative'. That is the case with the stack. */
-
- save_errno=errno;
- if (lowest > current)
- {
- unsigned len=lowest-current;
- memctl(current,len,MCT_TEXT);
- lowest = current;
- }
- else
- memctl(current,NBPC,MCT_TEXT);
- errno=save_errno;
-}
-
-#endif /* __DOLPHIN__ */
-
-#ifdef __pyr__
-
-#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */
-#include <stdio.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/vmmac.h>
-
-/* Modified from the convex -code above.
- mremap promises to clear the i-cache. */
-
-void
-__enable_execute_stack ()
-{
- int fp;
- if (mprotect (((unsigned int)&fp/PAGSIZ)*PAGSIZ, PAGSIZ,
- PROT_READ|PROT_WRITE|PROT_EXEC))
- {
- perror ("mprotect in __enable_execute_stack");
- fflush (stderr);
- abort ();
- }
-}
-#endif /* __pyr__ */
-
-#if defined (sony_news) && defined (SYSTYPE_BSD)
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <syscall.h>
-#include <machine/sysnews.h>
-
-/* cacheflush function for NEWS-OS 4.2.
- This function is called from trampoline-initialize code
- defined in config/mips/mips.h. */
-
-void
-cacheflush (char *beg, int size, int flag)
-{
- if (syscall (SYS_sysnews, NEWS_CACHEFLUSH, beg, size, FLUSH_BCACHE))
- {
- perror ("cache_flush");
- fflush (stderr);
- abort ();
- }
-}
-
-#endif /* sony_news */
-#endif /* L_trampoline */
-
-#ifdef L__main
-
-#include "gbl-ctors.h"
-/* Some systems use __main in a way incompatible with its use in gcc, in these
- cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
- give the same symbol without quotes for an alternative entry point. You
- must define both, or neither. */
-#ifndef NAME__MAIN
-#define NAME__MAIN "__main"
-#define SYMBOL__MAIN __main
-#endif
-
-#ifdef INIT_SECTION_ASM_OP
-#undef HAS_INIT_SECTION
-#define HAS_INIT_SECTION
-#endif
-
-#if !defined (HAS_INIT_SECTION) || !defined (OBJECT_FORMAT_ELF)
-/* Run all the global destructors on exit from the program. */
-
-void
-__do_global_dtors ()
-{
-#ifdef DO_GLOBAL_DTORS_BODY
- DO_GLOBAL_DTORS_BODY;
-#else
- static func_ptr *p = __DTOR_LIST__ + 1;
- while (*p)
- {
- p++;
- (*(p-1)) ();
- }
-#endif
-}
-#endif
-
-#ifndef HAS_INIT_SECTION
-/* Run all the global constructors on entry to the program. */
-
-#ifndef ON_EXIT
-#define ON_EXIT(a, b)
-#else
-/* Make sure the exit routine is pulled in to define the globals as
- bss symbols, just in case the linker does not automatically pull
- bss definitions from the library. */
-
-extern int _exit_dummy_decl;
-int *_exit_dummy_ref = &_exit_dummy_decl;
-#endif /* ON_EXIT */
-
-void
-__do_global_ctors ()
-{
- DO_GLOBAL_CTORS_BODY;
- ON_EXIT (__do_global_dtors, 0);
-}
-#endif /* no HAS_INIT_SECTION */
-
-#if !defined (HAS_INIT_SECTION) || defined (INVOKE__main)
-/* Subroutine called automatically by `main'.
- Compiling a global function named `main'
- produces an automatic call to this function at the beginning.
-
- For many systems, this routine calls __do_global_ctors.
- For systems which support a .init section we use the .init section
- to run __do_global_ctors, so we need not do anything here. */
-
-void
-SYMBOL__MAIN ()
-{
- /* Support recursive calls to `main': run initializers just once. */
- static int initialized;
- if (! initialized)
- {
- initialized = 1;
- __do_global_ctors ();
- }
-}
-#endif /* no HAS_INIT_SECTION or INVOKE__main */
-
-#endif /* L__main */
-
-#ifdef L_ctors
-
-#include "gbl-ctors.h"
-
-/* Provide default definitions for the lists of constructors and
- destructors, so that we don't get linker errors. These symbols are
- intentionally bss symbols, so that gld and/or collect will provide
- the right values. */
-
-/* We declare the lists here with two elements each,
- so that they are valid empty lists if no other definition is loaded. */
-#if !defined(INIT_SECTION_ASM_OP) && !defined(CTOR_LISTS_DEFINED_EXTERNALLY)
-#if defined(__NeXT__) || defined(_AIX)
-/* After 2.3, try this definition on all systems. */
-func_ptr __CTOR_LIST__[2] = {0, 0};
-func_ptr __DTOR_LIST__[2] = {0, 0};
-#else
-func_ptr __CTOR_LIST__[2];
-func_ptr __DTOR_LIST__[2];
-#endif
-#endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
-#endif /* L_ctors */
-
-#ifdef L_exit
-
-#include "gbl-ctors.h"
-
-#ifdef NEED_ATEXIT
-# ifdef ON_EXIT
-# undef ON_EXIT
-# endif
-int _exit_dummy_decl = 0; /* prevent compiler & linker warnings */
-#endif
-
-#ifndef ON_EXIT
-
-#ifdef NEED_ATEXIT
-# include <errno.h>
-
-static func_ptr *atexit_chain = NULL;
-static long atexit_chain_length = 0;
-static volatile long last_atexit_chain_slot = -1;
-
-int atexit (func_ptr func)
-{
- if (++last_atexit_chain_slot == atexit_chain_length)
- {
- atexit_chain_length += 32;
- if (atexit_chain)
- atexit_chain = realloc (atexit_chain,
- atexit_chain_length * sizeof (func_ptr));
- else
- atexit_chain = malloc (atexit_chain_length * sizeof (func_ptr));
- if (! atexit_chain)
- {
- atexit_chain_length = 0;
- last_atexit_chain_slot = -1;
- errno = ENOMEM;
- return (-1);
- }
- }
- atexit_chain[last_atexit_chain_slot] = func;
- return (0);
-}
-#endif /* NEED_ATEXIT */
-
-/* If we have no known way of registering our own __do_global_dtors
- routine so that it will be invoked at program exit time, then we
- have to define our own exit routine which will get this to happen. */
-
-extern void __do_global_dtors ();
-extern void __bb_exit_func ();
-extern void _cleanup ();
-extern void _exit () __attribute__ ((noreturn));
-
-void
-exit (int status)
-{
-#if !defined (INIT_SECTION_ASM_OP) || !defined (OBJECT_FORMAT_ELF)
-#ifdef NEED_ATEXIT
- if (atexit_chain)
- {
- for ( ; last_atexit_chain_slot-- >= 0; )
- {
- (*atexit_chain[last_atexit_chain_slot + 1]) ();
- atexit_chain[last_atexit_chain_slot + 1] = NULL;
- }
- free (atexit_chain);
- atexit_chain = NULL;
- }
-#else /* No NEED_ATEXIT */
- __do_global_dtors ();
-#endif /* No NEED_ATEXIT */
-#endif
-#ifndef inhibit_libc
- __bb_exit_func ();
-#endif
-#ifdef EXIT_BODY
- EXIT_BODY;
-#else
- _cleanup ();
-#endif
- _exit (status);
-}
-
-#else
-int _exit_dummy_decl = 0; /* prevent compiler & linker warnings */
-#endif
-
-#endif /* L_exit */
-
-#ifdef L_eh
-
-#ifdef EH_TABLE_LOOKUP
-
-EH_TABLE_LOOKUP
-
-#else
-
-typedef struct {
- void *start;
- void *end;
- void *exception_handler;
-} exception_table;
-
-struct exception_table_node {
- exception_table *table;
- void *start;
- void *end;
- struct exception_table_node *next;
-};
-
-static struct exception_table_node *exception_table_list;
-
-/* this routine takes a pc, and the address of the exception handler associated
- with the closest exception table handler entry associated with that PC,
- or 0 if there are no table entries the PC fits in. The algorithm works
- something like this:
-
- while(current_entry exists) {
- if(current_entry.start < pc )
- current_entry = next_entry;
- else {
- if(prev_entry.start <= pc && prev_entry.end > pc) {
- save pointer to prev_entry;
- return prev_entry.exception_handler;
- }
- else return 0;
- }
- }
- return 0;
-
- Assuming a correctly sorted table (ascending order) this routine should
- return the tightest match...
-
- In the advent of a tie, we have to give the last entry, as it represents
- an inner block. */
-
-void *
-__find_first_exception_table_match (void *pc)
-{
- register struct exception_table_node *tnp;
- register exception_table *table;
- int pos;
- int best;
-
-#if 0
- printf ("find_first_exception_table_match (): pc = %x!\n", pc);
-#endif
-
- for (tnp = exception_table_list; tnp != 0; tnp = tnp->next)
- {
- if (tnp->start > pc || tnp->end <= pc)
- continue;
-
- table = tnp->table;
-
- pos = 0;
- best = 0;
-#if 0
- /* We can't do this yet, as we don't know that the table is sorted. */
- do {
- ++pos;
- if (table[pos].start > pc)
- /* found the first table[pos].start > pc, so the previous
- entry better be the one we want! */
- break;
- } while (table[pos].exception_handler != (void *) -1);
-
- --pos;
- if (table[pos].start <= pc && table[pos].end > pc)
- {
-#if 0
- printf ("find_first_eh_table_match (): found match: %x\n", table[pos].exception_handler);
-#endif
- return table[pos].exception_handler;
- }
-#else
- while (table[++pos].exception_handler != (void *) -1) {
- if (table[pos].start <= pc && table[pos].end > pc)
- {
- /* This can apply. Make sure it is better or as good as
- the previous best. */
- /* The best one ends first. */
- if (best == 0 || (table[pos].end <= table[best].end
- /* The best one starts last. */
- && table[pos].start >= table[best].start))
- best = pos;
- }
- }
- if (best != 0)
- return table[best].exception_handler;
-#endif
- }
-
-#if 0
- printf ("find_first_eh_table_match (): else: returning NULL!\n");
-#endif
- return (void *) 0;
-}
-
-void
-__register_exceptions (exception_table *table)
-{
- struct exception_table_node *node;
- exception_table *range = table + 1;
-
- if (range->start == (void *) -1)
- return;
-
- node = (struct exception_table_node *)
- malloc (sizeof (struct exception_table_node));
- node->table = table;
-
- /* This look can be optimized away either if the table
- is sorted, or if we pass in extra parameters. */
- node->start = range->start;
- node->end = range->end;
- for (range++ ; range->start != (void *) (-1); range++)
- {
- if (range->start < node->start)
- node->start = range->start;
- if (range->end > node->end)
- node->end = range->end;
- }
-
- node->next = exception_table_list;
- exception_table_list = node;
-}
-#endif
-
-void *
-__throw_type_match (void *catch_type, void *throw_type, void *obj)
-{
-#if 0
- printf ("__throw_type_match (): catch_type = %s, throw_type = %s\n",
- catch_type, throw_type);
-#endif
- if (strcmp ((const char *)catch_type, (const char *)throw_type) == 0)
- return obj;
- return 0;
-}
-
-/* Throw stub routine.
-
- This is work in progress, but not completed yet. */
-
-void
-__throw ()
-{
- abort ();
-}
-
-/* This value identifies the place from which an exception is being
- thrown. */
-
-void *__eh_pc;
-
-void
-__empty ()
-{
-}
-
-#if #machine(i386)
-void
-__unwind_function(void *ptr)
-{
- asm("movl 8(%esp),%ecx");
- /* Undo current frame */
- asm("movl %ebp,%esp");
- asm("popl %ebp");
- /* like ret, but stay here */
- asm("addl $4,%esp");
-
- /* Now, undo previous frame. */
- /* This is a test routine, as we have to dynamically probe to find out
- what to pop for certain, this is just a guess. */
- asm("leal -16(%ebp),%esp");
- asm("pop %ebx");
- asm("pop %esi");
- asm("pop %edi");
- asm("movl %ebp,%esp");
- asm("popl %ebp");
-
- asm("movl %ecx,0(%esp)");
- asm("ret");
-}
-#elif #machine(rs6000) && !defined _ARCH_PPC
-__unwind_function(void *ptr)
-{
- asm("mr 31,1");
- asm("l 1,0(1)");
- asm("l 31,-4(1)");
- asm("# br");
-
- asm("mr 31,1");
- asm("l 1,0(1)");
- /* use 31 as a scratch register to restore the link register. */
- asm("l 31, 8(1);mtlr 31 # l lr,8(1)");
- asm("l 31,-4(1)");
- asm("# br");
- asm("mtctr 3;bctr # b 3");
-}
-#elif (#machine(rs6000) || #machine(powerpc)) && defined _ARCH_PPC
-__unwind_function(void *ptr)
-{
- asm("mr 31,1");
- asm("lwz 1,0(1)");
- asm("lwz 31,-4(1)");
- asm("# br");
-
- asm("mr 31,1");
- asm("lwz 1,0(1)");
- /* use 31 as a scratch register to restore the link register. */
- asm("lwz 31, 8(1);mtlr 31 # l lr,8(1)");
- asm("lwz 31,-4(1)");
- asm("# br");
- asm("mtctr 3;bctr # b 3");
-}
-#elif #machine(vax)
-__unwind_function(void *ptr)
-{
- __label__ return_again;
-
- /* Replace our frame's return address with the label below.
- During execution, we will first return here instead of to
- caller, then second return takes caller's frame off the stack.
- Two returns matches two actual calls, so is less likely to
- confuse debuggers. `16' corresponds to RETURN_ADDRESS_OFFSET. */
- __asm ("movl %0,16(fp)" : : "p" (&& return_again));
- return;
-
- return_again:
- return;
-}
-#else
-__unwind_function(void *ptr)
-{
- abort ();
-}
-#endif /* powerpc */
-#endif /* L_eh */
-
-#ifdef L_pure
-#ifndef inhibit_libc
-/* This gets us __GNU_LIBRARY__. */
-#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */
-#include <stdio.h>
-
-#ifdef __GNU_LIBRARY__
- /* Avoid forcing the library's meaning of `write' on the user program
- by using the "internal" name (for use within the library) */
-#define write(fd, buf, n) __write((fd), (buf), (n))
-#endif
-#endif /* inhibit_libc */
-
-#define MESSAGE "pure virtual method called\n"
-
-void
-__pure_virtual ()
-{
-#ifndef inhibit_libc
- write (2, MESSAGE, sizeof (MESSAGE) - 1);
-#endif
- _exit (-1);
-}
-#endif
diff --git a/gcc/limitx.h b/gcc/limitx.h
deleted file mode 100644
index 529d9c5f9cf..00000000000
--- a/gcc/limitx.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This administrivia gets added to the beginning of limits.h
- if the system has its own version of limits.h. */
-
-/* We use _GCC_LIMITS_H_ because we want this not to match
- any macros that the system's limits.h uses for its own purposes. */
-#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */
-#define _GCC_LIMITS_H_
-
-#ifndef _LIBC_LIMITS_H_
-/* Use "..." so that we find syslimits.h only in this same directory. */
-#include "syslimits.h"
-#endif
diff --git a/gcc/limity.h b/gcc/limity.h
deleted file mode 100644
index 8bb398f6786..00000000000
--- a/gcc/limity.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* This administrivia gets added to the end of limits.h
- if the system has its own version of limits.h. */
-
-#else /* not _GCC_LIMITS_H_ */
-
-#ifdef _GCC_NEXT_LIMITS_H
-#include_next <limits.h> /* recurse down to the real one */
-#endif
-
-#endif /* not _GCC_LIMITS_H_ */
diff --git a/gcc/listing b/gcc/listing
deleted file mode 100755
index 08abb1db4ce..00000000000
--- a/gcc/listing
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/bin/sh -f
-# Generate a source code listing for C or C++ code with assembler code. The
-# listing is always written to stdout.
-# Author: Igor Metz <metz@iam.unibe.ch>
-
-# Revision 1.4 94/08/26 13:58:27 coxs <coxs@dg-rtp.dg.com>
-# lister now guesses how to should be configured. Added elf and coff support.
-#
-# Revision 1.3 89/12/18 13:58:27 metz
-# lister must now be configured before it can be used. This is done in the
-# /bin/sh part of the code.
-#
-#
-# Revision 1.2 89/08/16 17:35:02 metz
-# Support for SPARC added.
-#
-# Revision 1.1 89/08/16 16:49:22 metz
-# Initial revision
-#
-
-# Requires: gawk (may be it works also with nawk)
-
-# usage: lister filename [compiler-options]
-
-# Method:
-# compile the source with -g option to assembler code, then merge the
-# generated assembler code with the source code. Compiler options
-# can be supplied on the command line (for example -O)
-
-# To install lister, assign one of the supported values to the variable MYSYS:
-# mc68020 for Motorola 68020 (Sun-3, ..)
-# mc68030 for Motorola 68030 (Sun-3, ..)
-# sparc for SPARC (SUN-4, ..)
-# i386 for i386 (Sun i386, ...)
-# i386-linux for i386 (Linux, ...)
-
-# Guess what kind of objects we are creating and thus what type of assembler
-# symbols to look for
-
-ex /tmp/$$.c <<END >/dev/null
-a
-main (){}
-.
-w
-q
-END
-WD=`pwd`
-cd /tmp
-gcc -c $$.c
-case "`file $$.o`" in
-*ELF*) MYSYS=elf ;;
-*COFF*|*BCS*) MYSYS=coff ;;
-*mc68k*|*M68000*) MYSYS=mc68030 ;;
-*SPARC*) MYSYS=sparc ;;
-*386*) MYSYS=i386 ;;
-esac
-rm $$.c $$.o
-cd $WD
-
-# uncomment the line you need if the above guesses incorrectly:
-# MYSYS=mc68020
-# MYSYS=mc68030
-# MYSYS=sparc
-# MYSYS=i386
-# MYSYS=i386-linux
-# MYSYS=`mach` # this will work on Suns with SunOS > 4.0.0
-# MYSYS=elf
-# MYSYS=coff
-
-WHOAMI=$0
-if [ $# -gt 0 ] ; then
-FILENAME=$1
-shift
-fi
-
-exec gawk -v whoami=$WHOAMI -vsys=$MYSYS -voptions="$*" '
-# commandline arguments:
-# ARGV[0] = "gawk"
-# ARGV[1] = processid
-# ARGV[2] = filename
-BEGIN {
- if (ARGC != 3) {
- usage()
- exit 1
- }
-
- # Declaration of global variables
- c_filename = ""
- asm_filename = ""
- cmdline = ""
- asm_code = ""
- c_code = ""
- c_lineno = 0
- oldlineno = 0
- newlineno = 0
- ignore_stabd = 0
- num_of_fields = 0
-
- # check processor architecture and set sourcecode line_hint accordingly
- if (sys == "sparc" || sys == "i386") {
- line_hint = "^[ \t]*\.stabn.*"
- line_field = 3;
- line_delimiter = ",";
- line_offset = 0;
- }
- else if (sys == "mc68020" || sys == "mc68030" || sys == "i386-linux") {
- line_hint = "^[ \t]*\.stabd.*"
- line_field = 3;
- line_delimiter = ",";
- line_offset = 0;
- }
- else if (sys == "elf") {
- line_hint = "section.*\.line"
- line_field = 3;
- line_delimiter = "\t";
- line_offset = 0;
- }
- else if (sys == "coff") {
- line_hint = "^[ \t]*ln"
- line_field = 3;
- line_delimiter = "\t";
- }
- else {
- error("Processor type " sys " is not supported yet, sorry")
- }
-
- parse_cmdline()
-
- printf("compiling %s to asm code\n", c_filename ) > "/dev/stderr"
-
- if (system(cmdline) != 0 ) {
- error("Compilation of " c_filename " failed")
- }
-
- printf("generating listing\n") > "/dev/stderr"
-
-
- while ( getline asm_code < asm_filename > 0 ) {
- if ( (ignore_stabd==0) && (asm_code ~ line_hint)) {
- while ( sys == "elf" && (asm_code !~ "word" && asm_code !~ "byte") &&
- getline asm_code < asm_filename > 0);
- # source line hint found. Split the line into fields separated by commas.
- # num_of_fields is 4 for sparc, 3 for m68k
- num_of_fields = split(asm_code, fields, line_delimiter)
- newlineno = fields[line_field] + line_offset;
-
- if (newlineno > oldlineno) {
- while ( newlineno > c_lineno && getline c_code < c_filename > 0) {
- c_lineno++
- printf("%4d %s\n", c_lineno, c_code)
- }
- oldlineno = newlineno
- }
- }
- else if ( asm_code ~ ".*Ltext[ \t]*$" ) {
- # filename hint found
- if ( match(asm_code, c_filename)) {
- ignore_stabd = 0
- }
- else {
- ignore_stabd = 1
- }
- }
- else if ( sys == "elf" && asm_code ~ "section.*\.debug" ) {
- while ( asm_code !~ "^[ \t]*[.]*previous" &&
- asm_code !~ "\.popsection" &&
- getline asm_code < asm_filename > 0 );
- if ( ! (getline asm_code < asm_filename > 0)) break;
- }
- else if ( sys == "coff" && asm_code ~ "^[ \t]*sdef" ) {
- if ( asm_code ~ "\.bf" ) {
- while ( asm_code !~ "^[ \t]*line" &&
- getline asm_code < asm_filename > 0 ) {
- num_of_fields = split(asm_code, fields, "\t")
- line_offset = fields[line_field] - 1;
- }
- }
- while ( asm_code !~ "^[ \t]*endef" &&
- getline asm_code < asm_filename > 0 ) {
- }
- if ( ! (getline asm_code < asm_filename > 0)) break;
- }
- printf("\t\t\t%s\n", asm_code)
- }
-
- # general cleanup
- system("/bin/rm " asm_filename)
-}
-
-function usage() {
- printf("usage: %s filename compiler-options\n", whoami) > "/dev/stderr"
-}
-
-function error(s) {
- printf("error: %s\n", s) > "/dev/stderr"
- exit 1
-}
-
-function parse_cmdline( i) {
- # construct filenames to use
- asm_filename = "/tmp/lister" ARGV[1] ".s"
- ARGV[1] = ""
- c_filename = ARGV[2]
- ARGV[2] = ""
-
- # construct commandline to use
- if ( match(c_filename, ".C") || match(c_filename, ".cc") ) {
- cmdline = "g++"
- }
- else if (match(c_filename, ".c") || match(c_filename, ".i")) {
- cmdline = "gcc"
- }
- else {
- error("unknown extension for file " c_filename)
- }
-
- cmdline = cmdline " -g -S -o " asm_filename
-
- # now we append the compiler options specified by the user
- cmdline = cmdline " " options
-
- # last but not least: the name of the file to compile
- cmdline = cmdline " " c_filename
-}
-
-' $$ $FILENAME
-
diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c
deleted file mode 100644
index 8e75aa80488..00000000000
--- a/gcc/local-alloc.c
+++ /dev/null
@@ -1,2446 +0,0 @@
-/* Allocate registers within a basic block, for GNU compiler.
- Copyright (C) 1987, 88, 91, 93-6, 1997 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. */
-
-
-/* Allocation of hard register numbers to pseudo registers is done in
- two passes. In this pass we consider only regs that are born and
- die once within one basic block. We do this one basic block at a
- time. Then the next pass allocates the registers that remain.
- Two passes are used because this pass uses methods that work only
- on linear code, but that do a better job than the general methods
- used in global_alloc, and more quickly too.
-
- The assignments made are recorded in the vector reg_renumber
- whose space is allocated here. The rtl code itself is not altered.
-
- We assign each instruction in the basic block a number
- which is its order from the beginning of the block.
- Then we can represent the lifetime of a pseudo register with
- a pair of numbers, and check for conflicts easily.
- We can record the availability of hard registers with a
- HARD_REG_SET for each instruction. The HARD_REG_SET
- contains 0 or 1 for each hard reg.
-
- To avoid register shuffling, we tie registers together when one
- dies by being copied into another, or dies in an instruction that
- does arithmetic to produce another. The tied registers are
- allocated as one. Registers with different reg class preferences
- can never be tied unless the class preferred by one is a subclass
- of the one preferred by the other.
-
- Tying is represented with "quantity numbers".
- A non-tied register is given a new quantity number.
- Tied registers have the same quantity number.
-
- We have provision to exempt registers, even when they are contained
- within the block, that can be tied to others that are not contained in it.
- This is so that global_alloc could process them both and tie them then.
- But this is currently disabled since tying in global_alloc is not
- yet implemented. */
-
-/* Pseudos allocated here cannot be reallocated by global.c if the hard
- register is used as a spill register. So we don't allocate such pseudos
- here if their preferred class is likely to be used by spills. */
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "flags.h"
-#include "basic-block.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "insn-config.h"
-#include "recog.h"
-#include "output.h"
-
-/* Next quantity number available for allocation. */
-
-static int next_qty;
-
-/* In all the following vectors indexed by quantity number. */
-
-/* Element Q is the hard reg number chosen for quantity Q,
- or -1 if none was found. */
-
-static short *qty_phys_reg;
-
-/* We maintain two hard register sets that indicate suggested hard registers
- for each quantity. The first, qty_phys_copy_sugg, contains hard registers
- that are tied to the quantity by a simple copy. The second contains all
- hard registers that are tied to the quantity via an arithmetic operation.
-
- The former register set is given priority for allocation. This tends to
- eliminate copy insns. */
-
-/* Element Q is a set of hard registers that are suggested for quantity Q by
- copy insns. */
-
-static HARD_REG_SET *qty_phys_copy_sugg;
-
-/* Element Q is a set of hard registers that are suggested for quantity Q by
- arithmetic insns. */
-
-static HARD_REG_SET *qty_phys_sugg;
-
-/* Element Q is the number of suggested registers in qty_phys_copy_sugg. */
-
-static short *qty_phys_num_copy_sugg;
-
-/* Element Q is the number of suggested registers in qty_phys_sugg. */
-
-static short *qty_phys_num_sugg;
-
-/* Element Q is the number of refs to quantity Q. */
-
-static int *qty_n_refs;
-
-/* Element Q is a reg class contained in (smaller than) the
- preferred classes of all the pseudo regs that are tied in quantity Q.
- This is the preferred class for allocating that quantity. */
-
-static enum reg_class *qty_min_class;
-
-/* Insn number (counting from head of basic block)
- where quantity Q was born. -1 if birth has not been recorded. */
-
-static int *qty_birth;
-
-/* Insn number (counting from head of basic block)
- where quantity Q died. Due to the way tying is done,
- and the fact that we consider in this pass only regs that die but once,
- a quantity can die only once. Each quantity's life span
- is a set of consecutive insns. -1 if death has not been recorded. */
-
-static int *qty_death;
-
-/* Number of words needed to hold the data in quantity Q.
- This depends on its machine mode. It is used for these purposes:
- 1. It is used in computing the relative importances of qtys,
- which determines the order in which we look for regs for them.
- 2. It is used in rules that prevent tying several registers of
- different sizes in a way that is geometrically impossible
- (see combine_regs). */
-
-static int *qty_size;
-
-/* This holds the mode of the registers that are tied to qty Q,
- or VOIDmode if registers with differing modes are tied together. */
-
-static enum machine_mode *qty_mode;
-
-/* Number of times a reg tied to qty Q lives across a CALL_INSN. */
-
-static int *qty_n_calls_crossed;
-
-/* Register class within which we allocate qty Q if we can't get
- its preferred class. */
-
-static enum reg_class *qty_alternate_class;
-
-/* Element Q is the SCRATCH expression for which this quantity is being
- allocated or 0 if this quantity is allocating registers. */
-
-static rtx *qty_scratch_rtx;
-
-/* Element Q is nonzero if this quantity has been used in a SUBREG
- that changes its size. */
-
-static char *qty_changes_size;
-
-/* Element Q is the register number of one pseudo register whose
- reg_qty value is Q, or -1 is this quantity is for a SCRATCH. This
- register should be the head of the chain maintained in reg_next_in_qty. */
-
-static int *qty_first_reg;
-
-/* If (REG N) has been assigned a quantity number, is a register number
- of another register assigned the same quantity number, or -1 for the
- end of the chain. qty_first_reg point to the head of this chain. */
-
-static int *reg_next_in_qty;
-
-/* reg_qty[N] (where N is a pseudo reg number) is the qty number of that reg
- if it is >= 0,
- of -1 if this register cannot be allocated by local-alloc,
- or -2 if not known yet.
-
- Note that if we see a use or death of pseudo register N with
- reg_qty[N] == -2, register N must be local to the current block. If
- it were used in more than one block, we would have reg_qty[N] == -1.
- This relies on the fact that if reg_basic_block[N] is >= 0, register N
- will not appear in any other block. We save a considerable number of
- tests by exploiting this.
-
- If N is < FIRST_PSEUDO_REGISTER, reg_qty[N] is undefined and should not
- be referenced. */
-
-static int *reg_qty;
-
-/* The offset (in words) of register N within its quantity.
- This can be nonzero if register N is SImode, and has been tied
- to a subreg of a DImode register. */
-
-static char *reg_offset;
-
-/* Vector of substitutions of register numbers,
- used to map pseudo regs into hardware regs.
- This is set up as a result of register allocation.
- Element N is the hard reg assigned to pseudo reg N,
- or is -1 if no hard reg was assigned.
- If N is a hard reg number, element N is N. */
-
-short *reg_renumber;
-
-/* Set of hard registers live at the current point in the scan
- of the instructions in a basic block. */
-
-static HARD_REG_SET regs_live;
-
-/* Each set of hard registers indicates registers live at a particular
- point in the basic block. For N even, regs_live_at[N] says which
- hard registers are needed *after* insn N/2 (i.e., they may not
- conflict with the outputs of insn N/2 or the inputs of insn N/2 + 1.
-
- If an object is to conflict with the inputs of insn J but not the
- outputs of insn J + 1, we say it is born at index J*2 - 1. Similarly,
- if it is to conflict with the outputs of insn J but not the inputs of
- insn J + 1, it is said to die at index J*2 + 1. */
-
-static HARD_REG_SET *regs_live_at;
-
-int *scratch_block;
-rtx *scratch_list;
-int scratch_list_length;
-static int scratch_index;
-
-/* Communicate local vars `insn_number' and `insn'
- from `block_alloc' to `reg_is_set', `wipe_dead_reg', and `alloc_qty'. */
-static int this_insn_number;
-static rtx this_insn;
-
-/* Used to communicate changes made by update_equiv_regs to
- memref_referenced_p. reg_equiv_replacement is set for any REG_EQUIV note
- found or created, so that we can keep track of what memory accesses might
- be created later, e.g. by reload. */
-
-static rtx *reg_equiv_replacement;
-
-static void alloc_qty PROTO((int, enum machine_mode, int, int));
-static void alloc_qty_for_scratch PROTO((rtx, int, rtx, int, int));
-static void validate_equiv_mem_from_store PROTO((rtx, rtx));
-static int validate_equiv_mem PROTO((rtx, rtx, rtx));
-static int memref_referenced_p PROTO((rtx, rtx));
-static int memref_used_between_p PROTO((rtx, rtx, rtx));
-static void optimize_reg_copy_1 PROTO((rtx, rtx, rtx));
-static void optimize_reg_copy_2 PROTO((rtx, rtx, rtx));
-static void update_equiv_regs PROTO((void));
-static void block_alloc PROTO((int));
-static int qty_sugg_compare PROTO((int, int));
-static int qty_sugg_compare_1 PROTO((const GENERIC_PTR, const GENERIC_PTR));
-static int qty_compare PROTO((int, int));
-static int qty_compare_1 PROTO((const GENERIC_PTR, const GENERIC_PTR));
-static int combine_regs PROTO((rtx, rtx, int, int, rtx, int));
-static int reg_meets_class_p PROTO((int, enum reg_class));
-static int reg_classes_overlap_p PROTO((enum reg_class, enum reg_class,
- int));
-static void update_qty_class PROTO((int, int));
-static void reg_is_set PROTO((rtx, rtx));
-static void reg_is_born PROTO((rtx, int));
-static void wipe_dead_reg PROTO((rtx, int));
-static int find_free_reg PROTO((enum reg_class, enum machine_mode,
- int, int, int, int, int));
-static void mark_life PROTO((int, enum machine_mode, int));
-static void post_mark_life PROTO((int, enum machine_mode, int, int, int));
-static int no_conflict_p PROTO((rtx, rtx, rtx));
-static int requires_inout PROTO((char *));
-
-/* Allocate a new quantity (new within current basic block)
- for register number REGNO which is born at index BIRTH
- within the block. MODE and SIZE are info on reg REGNO. */
-
-static void
-alloc_qty (regno, mode, size, birth)
- int regno;
- enum machine_mode mode;
- int size, birth;
-{
- register int qty = next_qty++;
-
- reg_qty[regno] = qty;
- reg_offset[regno] = 0;
- reg_next_in_qty[regno] = -1;
-
- qty_first_reg[qty] = regno;
- qty_size[qty] = size;
- qty_mode[qty] = mode;
- qty_birth[qty] = birth;
- qty_n_calls_crossed[qty] = reg_n_calls_crossed[regno];
- qty_min_class[qty] = reg_preferred_class (regno);
- qty_alternate_class[qty] = reg_alternate_class (regno);
- qty_n_refs[qty] = reg_n_refs[regno];
- qty_changes_size[qty] = reg_changes_size[regno];
-}
-
-/* Similar to `alloc_qty', but allocates a quantity for a SCRATCH rtx
- used as operand N in INSN. We assume here that the SCRATCH is used in
- a CLOBBER. */
-
-static void
-alloc_qty_for_scratch (scratch, n, insn, insn_code_num, insn_number)
- rtx scratch;
- int n;
- rtx insn;
- int insn_code_num, insn_number;
-{
- register int qty;
- enum reg_class class;
- char *p, c;
- int i;
-
-#ifdef REGISTER_CONSTRAINTS
- /* If we haven't yet computed which alternative will be used, do so now.
- Then set P to the constraints for that alternative. */
- if (which_alternative == -1)
- if (! constrain_operands (insn_code_num, 0))
- return;
-
- for (p = insn_operand_constraint[insn_code_num][n], i = 0;
- *p && i < which_alternative; p++)
- if (*p == ',')
- i++;
-
- /* Compute the class required for this SCRATCH. If we don't need a
- register, the class will remain NO_REGS. If we guessed the alternative
- number incorrectly, reload will fix things up for us. */
-
- class = NO_REGS;
- while ((c = *p++) != '\0' && c != ',')
- switch (c)
- {
- case '=': case '+': case '?':
- case '#': case '&': case '!':
- case '*': case '%':
- case '0': case '1': case '2': case '3': case '4':
- case 'm': case '<': case '>': case 'V': case 'o':
- case 'E': case 'F': case 'G': case 'H':
- case 's': case 'i': case 'n':
- case 'I': case 'J': case 'K': case 'L':
- case 'M': case 'N': case 'O': case 'P':
-#ifdef EXTRA_CONSTRAINT
- case 'Q': case 'R': case 'S': case 'T': case 'U':
-#endif
- case 'p':
- /* These don't say anything we care about. */
- break;
-
- case 'X':
- /* We don't need to allocate this SCRATCH. */
- return;
-
- case 'g': case 'r':
- class = reg_class_subunion[(int) class][(int) GENERAL_REGS];
- break;
-
- default:
- class
- = reg_class_subunion[(int) class][(int) REG_CLASS_FROM_LETTER (c)];
- break;
- }
-
- if (class == NO_REGS)
- return;
-
-#else /* REGISTER_CONSTRAINTS */
-
- class = GENERAL_REGS;
-#endif
-
-
- qty = next_qty++;
-
- qty_first_reg[qty] = -1;
- qty_scratch_rtx[qty] = scratch;
- qty_size[qty] = GET_MODE_SIZE (GET_MODE (scratch));
- qty_mode[qty] = GET_MODE (scratch);
- qty_birth[qty] = 2 * insn_number - 1;
- qty_death[qty] = 2 * insn_number + 1;
- qty_n_calls_crossed[qty] = 0;
- qty_min_class[qty] = class;
- qty_alternate_class[qty] = NO_REGS;
- qty_n_refs[qty] = 1;
- qty_changes_size[qty] = 0;
-}
-
-/* Main entry point of this file. */
-
-void
-local_alloc ()
-{
- register int b, i;
- int max_qty;
-
- /* Leaf functions and non-leaf functions have different needs.
- If defined, let the machine say what kind of ordering we
- should use. */
-#ifdef ORDER_REGS_FOR_LOCAL_ALLOC
- ORDER_REGS_FOR_LOCAL_ALLOC;
-#endif
-
- /* Promote REG_EQUAL notes to REG_EQUIV notes and adjust status of affected
- registers. */
- update_equiv_regs ();
-
- /* This sets the maximum number of quantities we can have. Quantity
- numbers start at zero and we can have one for each pseudo plus the
- number of SCRATCHes in the largest block, in the worst case. */
- max_qty = (max_regno - FIRST_PSEUDO_REGISTER) + max_scratch;
-
- /* Allocate vectors of temporary data.
- See the declarations of these variables, above,
- for what they mean. */
-
- /* There can be up to MAX_SCRATCH * N_BASIC_BLOCKS SCRATCHes to allocate.
- Instead of allocating this much memory from now until the end of
- reload, only allocate space for MAX_QTY SCRATCHes. If there are more
- reload will allocate them. */
-
- scratch_list_length = max_qty;
- scratch_list = (rtx *) xmalloc (scratch_list_length * sizeof (rtx));
- bzero ((char *) scratch_list, scratch_list_length * sizeof (rtx));
- scratch_block = (int *) xmalloc (scratch_list_length * sizeof (int));
- bzero ((char *) scratch_block, scratch_list_length * sizeof (int));
- scratch_index = 0;
-
- qty_phys_reg = (short *) alloca (max_qty * sizeof (short));
- qty_phys_copy_sugg
- = (HARD_REG_SET *) alloca (max_qty * sizeof (HARD_REG_SET));
- qty_phys_num_copy_sugg = (short *) alloca (max_qty * sizeof (short));
- qty_phys_sugg = (HARD_REG_SET *) alloca (max_qty * sizeof (HARD_REG_SET));
- qty_phys_num_sugg = (short *) alloca (max_qty * sizeof (short));
- qty_birth = (int *) alloca (max_qty * sizeof (int));
- qty_death = (int *) alloca (max_qty * sizeof (int));
- qty_scratch_rtx = (rtx *) alloca (max_qty * sizeof (rtx));
- qty_first_reg = (int *) alloca (max_qty * sizeof (int));
- qty_size = (int *) alloca (max_qty * sizeof (int));
- qty_mode
- = (enum machine_mode *) alloca (max_qty * sizeof (enum machine_mode));
- qty_n_calls_crossed = (int *) alloca (max_qty * sizeof (int));
- qty_min_class
- = (enum reg_class *) alloca (max_qty * sizeof (enum reg_class));
- qty_alternate_class
- = (enum reg_class *) alloca (max_qty * sizeof (enum reg_class));
- qty_n_refs = (int *) alloca (max_qty * sizeof (int));
- qty_changes_size = (char *) alloca (max_qty * sizeof (char));
-
- reg_qty = (int *) alloca (max_regno * sizeof (int));
- reg_offset = (char *) alloca (max_regno * sizeof (char));
- reg_next_in_qty = (int *) alloca (max_regno * sizeof (int));
-
- reg_renumber = (short *) oballoc (max_regno * sizeof (short));
- for (i = 0; i < max_regno; i++)
- reg_renumber[i] = -1;
-
- /* Determine which pseudo-registers can be allocated by local-alloc.
- In general, these are the registers used only in a single block and
- which only die once. However, if a register's preferred class has only
- a few entries, don't allocate this register here unless it is preferred
- or nothing since retry_global_alloc won't be able to move it to
- GENERAL_REGS if a reload register of this class is needed.
-
- We need not be concerned with which block actually uses the register
- since we will never see it outside that block. */
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- {
- if (reg_basic_block[i] >= 0 && reg_n_deaths[i] == 1
- && (reg_alternate_class (i) == NO_REGS
- || ! CLASS_LIKELY_SPILLED_P (reg_preferred_class (i))))
- reg_qty[i] = -2;
- else
- reg_qty[i] = -1;
- }
-
- /* Force loop below to initialize entire quantity array. */
- next_qty = max_qty;
-
- /* Allocate each block's local registers, block by block. */
-
- for (b = 0; b < n_basic_blocks; b++)
- {
- /* NEXT_QTY indicates which elements of the `qty_...'
- vectors might need to be initialized because they were used
- for the previous block; it is set to the entire array before
- block 0. Initialize those, with explicit loop if there are few,
- else with bzero and bcopy. Do not initialize vectors that are
- explicit set by `alloc_qty'. */
-
- if (next_qty < 6)
- {
- for (i = 0; i < next_qty; i++)
- {
- qty_scratch_rtx[i] = 0;
- CLEAR_HARD_REG_SET (qty_phys_copy_sugg[i]);
- qty_phys_num_copy_sugg[i] = 0;
- CLEAR_HARD_REG_SET (qty_phys_sugg[i]);
- qty_phys_num_sugg[i] = 0;
- }
- }
- else
- {
-#define CLEAR(vector) \
- bzero ((char *) (vector), (sizeof (*(vector))) * next_qty);
-
- CLEAR (qty_scratch_rtx);
- CLEAR (qty_phys_copy_sugg);
- CLEAR (qty_phys_num_copy_sugg);
- CLEAR (qty_phys_sugg);
- CLEAR (qty_phys_num_sugg);
- }
-
- next_qty = 0;
-
- block_alloc (b);
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
- }
-}
-
-/* Depth of loops we are in while in update_equiv_regs. */
-static int loop_depth;
-
-/* Used for communication between the following two functions: contains
- a MEM that we wish to ensure remains unchanged. */
-static rtx equiv_mem;
-
-/* Set nonzero if EQUIV_MEM is modified. */
-static int equiv_mem_modified;
-
-/* If EQUIV_MEM is modified by modifying DEST, indicate that it is modified.
- Called via note_stores. */
-
-static void
-validate_equiv_mem_from_store (dest, set)
- rtx dest;
- rtx set;
-{
- if ((GET_CODE (dest) == REG
- && reg_overlap_mentioned_p (dest, equiv_mem))
- || (GET_CODE (dest) == MEM
- && true_dependence (dest, equiv_mem)))
- equiv_mem_modified = 1;
-}
-
-/* Verify that no store between START and the death of REG invalidates
- MEMREF. MEMREF is invalidated by modifying a register used in MEMREF,
- by storing into an overlapping memory location, or with a non-const
- CALL_INSN.
-
- Return 1 if MEMREF remains valid. */
-
-static int
-validate_equiv_mem (start, reg, memref)
- rtx start;
- rtx reg;
- rtx memref;
-{
- rtx insn;
- rtx note;
-
- equiv_mem = memref;
- equiv_mem_modified = 0;
-
- /* If the memory reference has side effects or is volatile, it isn't a
- valid equivalence. */
- if (side_effects_p (memref))
- return 0;
-
- for (insn = start; insn && ! equiv_mem_modified; insn = NEXT_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
- continue;
-
- if (find_reg_note (insn, REG_DEAD, reg))
- return 1;
-
- if (GET_CODE (insn) == CALL_INSN && ! RTX_UNCHANGING_P (memref)
- && ! CONST_CALL_P (insn))
- return 0;
-
- note_stores (PATTERN (insn), validate_equiv_mem_from_store);
-
- /* If a register mentioned in MEMREF is modified via an
- auto-increment, we lose the equivalence. Do the same if one
- dies; although we could extend the life, it doesn't seem worth
- the trouble. */
-
- for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
- if ((REG_NOTE_KIND (note) == REG_INC
- || REG_NOTE_KIND (note) == REG_DEAD)
- && GET_CODE (XEXP (note, 0)) == REG
- && reg_overlap_mentioned_p (XEXP (note, 0), memref))
- return 0;
- }
-
- return 0;
-}
-
-/* TRUE if X references a memory location that would be affected by a store
- to MEMREF. */
-
-static int
-memref_referenced_p (memref, x)
- rtx x;
- rtx memref;
-{
- int i, j;
- char *fmt;
- enum rtx_code code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_INT:
- case CONST:
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST_DOUBLE:
- case PC:
- case CC0:
- case HIGH:
- case LO_SUM:
- return 0;
-
- case REG:
- return (reg_equiv_replacement[REGNO (x)]
- && memref_referenced_p (memref,
- reg_equiv_replacement[REGNO (x)]));
-
- case MEM:
- if (true_dependence (memref, x))
- return 1;
- break;
-
- case SET:
- /* If we are setting a MEM, it doesn't count (its address does), but any
- other SET_DEST that has a MEM in it is referencing the MEM. */
- if (GET_CODE (SET_DEST (x)) == MEM)
- {
- if (memref_referenced_p (memref, XEXP (SET_DEST (x), 0)))
- return 1;
- }
- else if (memref_referenced_p (memref, SET_DEST (x)))
- return 1;
-
- return memref_referenced_p (memref, SET_SRC (x));
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- switch (fmt[i])
- {
- case 'e':
- if (memref_referenced_p (memref, XEXP (x, i)))
- return 1;
- break;
- case 'E':
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (memref_referenced_p (memref, XVECEXP (x, i, j)))
- return 1;
- break;
- }
-
- return 0;
-}
-
-/* TRUE if some insn in the range (START, END] references a memory location
- that would be affected by a store to MEMREF. */
-
-static int
-memref_used_between_p (memref, start, end)
- rtx memref;
- rtx start;
- rtx end;
-{
- rtx insn;
-
- for (insn = NEXT_INSN (start); insn != NEXT_INSN (end);
- insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && memref_referenced_p (memref, PATTERN (insn)))
- return 1;
-
- return 0;
-}
-
-/* INSN is a copy from SRC to DEST, both registers, and SRC does not die
- in INSN.
-
- Search forward to see if SRC dies before either it or DEST is modified,
- but don't scan past the end of a basic block. If so, we can replace SRC
- with DEST and let SRC die in INSN.
-
- This will reduce the number of registers live in that range and may enable
- DEST to be tied to SRC, thus often saving one register in addition to a
- register-register copy. */
-
-static void
-optimize_reg_copy_1 (insn, dest, src)
- rtx insn;
- rtx dest;
- rtx src;
-{
- rtx p, q;
- rtx note;
- rtx dest_death = 0;
- int sregno = REGNO (src);
- int dregno = REGNO (dest);
-
- if (sregno == dregno
-#ifdef SMALL_REGISTER_CLASSES
- /* We don't want to mess with hard regs if register classes are small. */
- || (SMALL_REGISTER_CLASSES
- && (sregno < FIRST_PSEUDO_REGISTER
- || dregno < FIRST_PSEUDO_REGISTER))
-#endif
- /* We don't see all updates to SP if they are in an auto-inc memory
- reference, so we must disallow this optimization on them. */
- || sregno == STACK_POINTER_REGNUM || dregno == STACK_POINTER_REGNUM)
- return;
-
- for (p = NEXT_INSN (insn); p; p = NEXT_INSN (p))
- {
- if (GET_CODE (p) == CODE_LABEL || GET_CODE (p) == JUMP_INSN
- || (GET_CODE (p) == NOTE
- && (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_BEG
- || NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_END)))
- break;
-
- if (GET_RTX_CLASS (GET_CODE (p)) != 'i')
- continue;
-
- if (reg_set_p (src, p) || reg_set_p (dest, p)
- /* Don't change a USE of a register. */
- || (GET_CODE (PATTERN (p)) == USE
- && reg_overlap_mentioned_p (src, XEXP (PATTERN (p), 0))))
- break;
-
- /* See if all of SRC dies in P. This test is slightly more
- conservative than it needs to be. */
- if ((note = find_regno_note (p, REG_DEAD, sregno)) != 0
- && GET_MODE (XEXP (note, 0)) == GET_MODE (src))
- {
- int failed = 0;
- int length = 0;
- int d_length = 0;
- int n_calls = 0;
- int d_n_calls = 0;
-
- /* We can do the optimization. Scan forward from INSN again,
- replacing regs as we go. Set FAILED if a replacement can't
- be done. In that case, we can't move the death note for SRC.
- This should be rare. */
-
- /* Set to stop at next insn. */
- for (q = next_real_insn (insn);
- q != next_real_insn (p);
- q = next_real_insn (q))
- {
- if (reg_overlap_mentioned_p (src, PATTERN (q)))
- {
- /* If SRC is a hard register, we might miss some
- overlapping registers with validate_replace_rtx,
- so we would have to undo it. We can't if DEST is
- present in the insn, so fail in that combination
- of cases. */
- if (sregno < FIRST_PSEUDO_REGISTER
- && reg_mentioned_p (dest, PATTERN (q)))
- failed = 1;
-
- /* Replace all uses and make sure that the register
- isn't still present. */
- else if (validate_replace_rtx (src, dest, q)
- && (sregno >= FIRST_PSEUDO_REGISTER
- || ! reg_overlap_mentioned_p (src,
- PATTERN (q))))
- {
- /* We assume that a register is used exactly once per
- insn in the updates below. If this is not correct,
- no great harm is done. */
- if (sregno >= FIRST_PSEUDO_REGISTER)
- reg_n_refs[sregno] -= loop_depth;
- if (dregno >= FIRST_PSEUDO_REGISTER)
- reg_n_refs[dregno] += loop_depth;
- }
- else
- {
- validate_replace_rtx (dest, src, q);
- failed = 1;
- }
- }
-
- /* Count the insns and CALL_INSNs passed. If we passed the
- death note of DEST, show increased live length. */
- length++;
- if (dest_death)
- d_length++;
-
- /* If the insn in which SRC dies is a CALL_INSN, don't count it
- as a call that has been crossed. Otherwise, count it. */
- if (q != p && GET_CODE (q) == CALL_INSN)
- {
- n_calls++;
- if (dest_death)
- d_n_calls++;
- }
-
- /* If DEST dies here, remove the death note and save it for
- later. Make sure ALL of DEST dies here; again, this is
- overly conservative. */
- if (dest_death == 0
- && (dest_death = find_regno_note (q, REG_DEAD, dregno)) != 0
- && GET_MODE (XEXP (dest_death, 0)) == GET_MODE (dest))
- remove_note (q, dest_death);
- }
-
- if (! failed)
- {
- if (sregno >= FIRST_PSEUDO_REGISTER)
- {
- if (reg_live_length[sregno] >= 0)
- {
- reg_live_length[sregno] -= length;
- /* reg_live_length is only an approximation after
- combine if sched is not run, so make sure that we
- still have a reasonable value. */
- if (reg_live_length[sregno] < 2)
- reg_live_length[sregno] = 2;
- }
-
- reg_n_calls_crossed[sregno] -= n_calls;
- }
-
- if (dregno >= FIRST_PSEUDO_REGISTER)
- {
- if (reg_live_length[dregno] >= 0)
- reg_live_length[dregno] += d_length;
-
- reg_n_calls_crossed[dregno] += d_n_calls;
- }
-
- /* Move death note of SRC from P to INSN. */
- remove_note (p, note);
- XEXP (note, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = note;
- }
-
- /* Put death note of DEST on P if we saw it die. */
- if (dest_death)
- {
- XEXP (dest_death, 1) = REG_NOTES (p);
- REG_NOTES (p) = dest_death;
- }
-
- return;
- }
-
- /* If SRC is a hard register which is set or killed in some other
- way, we can't do this optimization. */
- else if (sregno < FIRST_PSEUDO_REGISTER
- && dead_or_set_p (p, src))
- break;
- }
-}
-
-/* INSN is a copy of SRC to DEST, in which SRC dies. See if we now have
- a sequence of insns that modify DEST followed by an insn that sets
- SRC to DEST in which DEST dies, with no prior modification of DEST.
- (There is no need to check if the insns in between actually modify
- DEST. We should not have cases where DEST is not modified, but
- the optimization is safe if no such modification is detected.)
- In that case, we can replace all uses of DEST, starting with INSN and
- ending with the set of SRC to DEST, with SRC. We do not do this
- optimization if a CALL_INSN is crossed unless SRC already crosses a
- call or if DEST dies before the copy back to SRC.
-
- It is assumed that DEST and SRC are pseudos; it is too complicated to do
- this for hard registers since the substitutions we may make might fail. */
-
-static void
-optimize_reg_copy_2 (insn, dest, src)
- rtx insn;
- rtx dest;
- rtx src;
-{
- rtx p, q;
- rtx set;
- int sregno = REGNO (src);
- int dregno = REGNO (dest);
-
- for (p = NEXT_INSN (insn); p; p = NEXT_INSN (p))
- {
- if (GET_CODE (p) == CODE_LABEL || GET_CODE (p) == JUMP_INSN
- || (GET_CODE (p) == NOTE
- && (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_BEG
- || NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_END)))
- break;
-
- if (GET_RTX_CLASS (GET_CODE (p)) != 'i')
- continue;
-
- set = single_set (p);
- if (set && SET_SRC (set) == dest && SET_DEST (set) == src
- && find_reg_note (p, REG_DEAD, dest))
- {
- /* We can do the optimization. Scan forward from INSN again,
- replacing regs as we go. */
-
- /* Set to stop at next insn. */
- for (q = insn; q != NEXT_INSN (p); q = NEXT_INSN (q))
- if (GET_RTX_CLASS (GET_CODE (q)) == 'i')
- {
- if (reg_mentioned_p (dest, PATTERN (q)))
- {
- PATTERN (q) = replace_rtx (PATTERN (q), dest, src);
-
- /* We assume that a register is used exactly once per
- insn in the updates below. If this is not correct,
- no great harm is done. */
- reg_n_refs[dregno] -= loop_depth;
- reg_n_refs[sregno] += loop_depth;
- }
-
-
- if (GET_CODE (q) == CALL_INSN)
- {
- reg_n_calls_crossed[dregno]--;
- reg_n_calls_crossed[sregno]++;
- }
- }
-
- remove_note (p, find_reg_note (p, REG_DEAD, dest));
- reg_n_deaths[dregno]--;
- remove_note (insn, find_reg_note (insn, REG_DEAD, src));
- reg_n_deaths[sregno]--;
- return;
- }
-
- if (reg_set_p (src, p)
- || find_reg_note (p, REG_DEAD, dest)
- || (GET_CODE (p) == CALL_INSN && reg_n_calls_crossed[sregno] == 0))
- break;
- }
-}
-
-/* Find registers that are equivalent to a single value throughout the
- compilation (either because they can be referenced in memory or are set once
- from a single constant). Lower their priority for a register.
-
- If such a register is only referenced once, try substituting its value
- into the using insn. If it succeeds, we can eliminate the register
- completely. */
-
-static void
-update_equiv_regs ()
-{
- rtx *reg_equiv_init_insn = (rtx *) alloca (max_regno * sizeof (rtx *));
- /* Set when an attempt should be made to replace a register with the
- associated reg_equiv_replacement entry at the end of this function. */
- char *reg_equiv_replace
- = (char *) alloca (max_regno * sizeof *reg_equiv_replace);
- rtx insn;
- int block, depth;
-
- reg_equiv_replacement = (rtx *) alloca (max_regno * sizeof (rtx *));
-
- bzero ((char *) reg_equiv_init_insn, max_regno * sizeof (rtx *));
- bzero ((char *) reg_equiv_replacement, max_regno * sizeof (rtx *));
- bzero ((char *) reg_equiv_replace, max_regno * sizeof *reg_equiv_replace);
-
- init_alias_analysis ();
-
- loop_depth = 1;
-
- /* Scan the insns and find which registers have equivalences. Do this
- in a separate scan of the insns because (due to -fcse-follow-jumps)
- a register can be set below its use. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- rtx note;
- rtx set = single_set (insn);
- rtx dest, src;
- int regno;
-
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- loop_depth++;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- loop_depth--;
- }
-
- /* If this insn contains more (or less) than a single SET, ignore it. */
- if (set == 0)
- continue;
-
- dest = SET_DEST (set);
- src = SET_SRC (set);
-
- /* If this sets a MEM to the contents of a REG that is only used
- in a single basic block, see if the register is always equivalent
- to that memory location and if moving the store from INSN to the
- insn that set REG is safe. If so, put a REG_EQUIV note on the
- initializing insn. */
-
- if (GET_CODE (dest) == MEM && GET_CODE (SET_SRC (set)) == REG
- && (regno = REGNO (SET_SRC (set))) >= FIRST_PSEUDO_REGISTER
- && reg_basic_block[regno] >= 0
- && reg_equiv_init_insn[regno] != 0
- && validate_equiv_mem (reg_equiv_init_insn[regno], SET_SRC (set),
- dest)
- && ! memref_used_between_p (SET_DEST (set),
- reg_equiv_init_insn[regno], insn))
- REG_NOTES (reg_equiv_init_insn[regno])
- = gen_rtx (EXPR_LIST, REG_EQUIV, dest,
- REG_NOTES (reg_equiv_init_insn[regno]));
-
- /* If this is a register-register copy where SRC is not dead, see if we
- can optimize it. */
- if (flag_expensive_optimizations && GET_CODE (dest) == REG
- && GET_CODE (SET_SRC (set)) == REG
- && ! find_reg_note (insn, REG_DEAD, SET_SRC (set)))
- optimize_reg_copy_1 (insn, dest, SET_SRC (set));
-
- /* Similarly for a pseudo-pseudo copy when SRC is dead. */
- else if (flag_expensive_optimizations && GET_CODE (dest) == REG
- && REGNO (dest) >= FIRST_PSEUDO_REGISTER
- && GET_CODE (SET_SRC (set)) == REG
- && REGNO (SET_SRC (set)) >= FIRST_PSEUDO_REGISTER
- && find_reg_note (insn, REG_DEAD, SET_SRC (set)))
- optimize_reg_copy_2 (insn, dest, SET_SRC (set));
-
- /* Otherwise, we only handle the case of a pseudo register being set
- once and only if neither the source nor the destination are
- in a register class that's likely to be spilled. */
- if (GET_CODE (dest) != REG
- || (regno = REGNO (dest)) < FIRST_PSEUDO_REGISTER
- || reg_n_sets[regno] != 1
- || CLASS_LIKELY_SPILLED_P (reg_preferred_class (REGNO (dest)))
- || (GET_CODE (src) == REG
- && REGNO (src) >= FIRST_PSEUDO_REGISTER
- && CLASS_LIKELY_SPILLED_P (reg_preferred_class (REGNO (src)))))
- continue;
-
- note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
- /* Record this insn as initializing this register. */
- reg_equiv_init_insn[regno] = insn;
-
- /* If this register is known to be equal to a constant, record that
- it is always equivalent to the constant. */
- if (note && CONSTANT_P (XEXP (note, 0)))
- PUT_MODE (note, (enum machine_mode) REG_EQUIV);
-
- /* If this insn introduces a "constant" register, decrease the priority
- of that register. Record this insn if the register is only used once
- more and the equivalence value is the same as our source.
-
- The latter condition is checked for two reasons: First, it is an
- indication that it may be more efficient to actually emit the insn
- as written (if no registers are available, reload will substitute
- the equivalence). Secondly, it avoids problems with any registers
- dying in this insn whose death notes would be missed.
-
- If we don't have a REG_EQUIV note, see if this insn is loading
- a register used only in one basic block from a MEM. If so, and the
- MEM remains unchanged for the life of the register, add a REG_EQUIV
- note. */
-
- note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
-
- if (note == 0 && reg_basic_block[regno] >= 0
- && GET_CODE (SET_SRC (set)) == MEM
- && validate_equiv_mem (insn, dest, SET_SRC (set)))
- REG_NOTES (insn) = note = gen_rtx (EXPR_LIST, REG_EQUIV, SET_SRC (set),
- REG_NOTES (insn));
-
- if (note)
- {
- int regno = REGNO (dest);
-
- reg_equiv_replacement[regno] = XEXP (note, 0);
-
- /* Don't mess with things live during setjmp. */
- if (reg_live_length[regno] >= 0)
- {
- /* Note that the statement below does not affect the priority
- in local-alloc! */
- reg_live_length[regno] *= 2;
-
-
- /* If the register is referenced exactly twice, meaning it is
- set once and used once, indicate that the reference may be
- replaced by the equivalence we computed above. If the
- register is only used in one basic block, this can't succeed
- or combine would have done it.
-
- It would be nice to use "loop_depth * 2" in the compare
- below. Unfortunately, LOOP_DEPTH need not be constant within
- a basic block so this would be too complicated.
-
- This case normally occurs when a parameter is read from
- memory and then used exactly once, not in a loop. */
-
- if (reg_n_refs[regno] == 2
- && reg_basic_block[regno] < 0
- && rtx_equal_p (XEXP (note, 0), SET_SRC (set)))
- reg_equiv_replace[regno] = 1;
- }
- }
- }
-
- /* Now scan all regs killed in an insn to see if any of them are
- registers only used that once. If so, see if we can replace the
- reference with the equivalent from. If we can, delete the
- initializing reference and this register will go away. If we
- can't replace the reference, and the instruction is not in a
- loop, then move the register initialization just before the use,
- so that they are in the same basic block. */
- block = -1;
- depth = 0;
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- rtx link;
-
- /* Keep track of which basic block we are in. */
- if (block + 1 < n_basic_blocks
- && basic_block_head[block + 1] == insn)
- ++block;
-
- if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
- {
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- ++depth;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- {
- --depth;
- if (depth < 0)
- abort ();
- }
- }
-
- continue;
- }
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- {
- if (REG_NOTE_KIND (link) == REG_DEAD
- /* Make sure this insn still refers to the register. */
- && reg_mentioned_p (XEXP (link, 0), PATTERN (insn)))
- {
- int regno = REGNO (XEXP (link, 0));
- rtx equiv_insn;
-
- if (! reg_equiv_replace[regno])
- continue;
-
- equiv_insn = reg_equiv_init_insn[regno];
-
- if (validate_replace_rtx (regno_reg_rtx[regno],
- reg_equiv_replacement[regno], insn))
- {
- remove_death (regno, insn);
- reg_n_refs[regno] = 0;
- PUT_CODE (equiv_insn, NOTE);
- NOTE_LINE_NUMBER (equiv_insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (equiv_insn) = 0;
- }
- /* If we aren't in a loop, and there are no calls in
- INSN or in the initialization of the register, then
- move the initialization of the register to just
- before INSN. Update the flow information. */
- else if (depth == 0
- && GET_CODE (equiv_insn) == INSN
- && GET_CODE (insn) == INSN
- && reg_basic_block[regno] < 0)
- {
- int l, offset;
- REGSET_ELT_TYPE bit;
-
- emit_insn_before (copy_rtx (PATTERN (equiv_insn)), insn);
- REG_NOTES (PREV_INSN (insn)) = REG_NOTES (equiv_insn);
-
- PUT_CODE (equiv_insn, NOTE);
- NOTE_LINE_NUMBER (equiv_insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (equiv_insn) = 0;
- REG_NOTES (equiv_insn) = 0;
-
- if (block < 0)
- reg_basic_block[regno] = 0;
- else
- reg_basic_block[regno] = block;
- reg_n_calls_crossed[regno] = 0;
- reg_live_length[regno] = 2;
-
- if (block >= 0 && insn == basic_block_head[block])
- basic_block_head[block] = PREV_INSN (insn);
-
- offset = regno / REGSET_ELT_BITS;
- bit = ((REGSET_ELT_TYPE) 1
- << (regno % REGSET_ELT_BITS));
- for (l = 0; l < n_basic_blocks; l++)
- basic_block_live_at_start[l][offset] &= ~ bit;
- }
- }
- }
- }
-}
-
-/* Allocate hard regs to the pseudo regs used only within block number B.
- Only the pseudos that die but once can be handled. */
-
-static void
-block_alloc (b)
- int b;
-{
- register int i, q;
- register rtx insn;
- rtx note;
- int insn_number = 0;
- int insn_count = 0;
- int max_uid = get_max_uid ();
- int *qty_order;
- int no_conflict_combined_regno = -1;
- /* Counter to prevent allocating more SCRATCHes than can be stored
- in SCRATCH_LIST. */
- int scratches_allocated = scratch_index;
-
- /* Count the instructions in the basic block. */
-
- insn = basic_block_end[b];
- while (1)
- {
- if (GET_CODE (insn) != NOTE)
- if (++insn_count > max_uid)
- abort ();
- if (insn == basic_block_head[b])
- break;
- insn = PREV_INSN (insn);
- }
-
- /* +2 to leave room for a post_mark_life at the last insn and for
- the birth of a CLOBBER in the first insn. */
- regs_live_at = (HARD_REG_SET *) alloca ((2 * insn_count + 2)
- * sizeof (HARD_REG_SET));
- bzero ((char *) regs_live_at, (2 * insn_count + 2) * sizeof (HARD_REG_SET));
-
- /* Initialize table of hardware registers currently live. */
-
-#ifdef HARD_REG_SET
- regs_live = *basic_block_live_at_start[b];
-#else
- COPY_HARD_REG_SET (regs_live, basic_block_live_at_start[b]);
-#endif
-
- /* This loop scans the instructions of the basic block
- and assigns quantities to registers.
- It computes which registers to tie. */
-
- insn = basic_block_head[b];
- while (1)
- {
- register rtx body = PATTERN (insn);
-
- if (GET_CODE (insn) != NOTE)
- insn_number++;
-
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- register rtx link, set;
- register int win = 0;
- register rtx r0, r1;
- int combined_regno = -1;
- int i;
- int insn_code_number = recog_memoized (insn);
-
- this_insn_number = insn_number;
- this_insn = insn;
-
- if (insn_code_number >= 0)
- insn_extract (insn);
- which_alternative = -1;
-
- /* Is this insn suitable for tying two registers?
- If so, try doing that.
- Suitable insns are those with at least two operands and where
- operand 0 is an output that is a register that is not
- earlyclobber.
-
- We can tie operand 0 with some operand that dies in this insn.
- First look for operands that are required to be in the same
- register as operand 0. If we find such, only try tying that
- operand or one that can be put into that operand if the
- operation is commutative. If we don't find an operand
- that is required to be in the same register as operand 0,
- we can tie with any operand.
-
- Subregs in place of regs are also ok.
-
- If tying is done, WIN is set nonzero. */
-
- if (insn_code_number >= 0
-#ifdef REGISTER_CONSTRAINTS
- && insn_n_operands[insn_code_number] > 1
- && insn_operand_constraint[insn_code_number][0][0] == '='
- && insn_operand_constraint[insn_code_number][0][1] != '&'
-#else
- && GET_CODE (PATTERN (insn)) == SET
- && rtx_equal_p (SET_DEST (PATTERN (insn)), recog_operand[0])
-#endif
- )
- {
-#ifdef REGISTER_CONSTRAINTS
- /* If non-negative, is an operand that must match operand 0. */
- int must_match_0 = -1;
- /* Counts number of alternatives that require a match with
- operand 0. */
- int n_matching_alts = 0;
-
- for (i = 1; i < insn_n_operands[insn_code_number]; i++)
- {
- char *p = insn_operand_constraint[insn_code_number][i];
- int this_match = (requires_inout (p));
-
- n_matching_alts += this_match;
- if (this_match == insn_n_alternatives[insn_code_number])
- must_match_0 = i;
- }
-#endif
-
- r0 = recog_operand[0];
- for (i = 1; i < insn_n_operands[insn_code_number]; i++)
- {
-#ifdef REGISTER_CONSTRAINTS
- /* Skip this operand if we found an operand that
- must match operand 0 and this operand isn't it
- and can't be made to be it by commutativity. */
-
- if (must_match_0 >= 0 && i != must_match_0
- && ! (i == must_match_0 + 1
- && insn_operand_constraint[insn_code_number][i-1][0] == '%')
- && ! (i == must_match_0 - 1
- && insn_operand_constraint[insn_code_number][i][0] == '%'))
- continue;
-
- /* Likewise if each alternative has some operand that
- must match operand zero. In that case, skip any
- operand that doesn't list operand 0 since we know that
- the operand always conflicts with operand 0. We
- ignore commutatity in this case to keep things simple. */
- if (n_matching_alts == insn_n_alternatives[insn_code_number]
- && (0 == requires_inout
- (insn_operand_constraint[insn_code_number][i])))
- continue;
-#endif
-
- r1 = recog_operand[i];
-
- /* If the operand is an address, find a register in it.
- There may be more than one register, but we only try one
- of them. */
- if (
-#ifdef REGISTER_CONSTRAINTS
- insn_operand_constraint[insn_code_number][i][0] == 'p'
-#else
- insn_operand_address_p[insn_code_number][i]
-#endif
- )
- while (GET_CODE (r1) == PLUS || GET_CODE (r1) == MULT)
- r1 = XEXP (r1, 0);
-
- if (GET_CODE (r0) == REG || GET_CODE (r0) == SUBREG)
- {
- /* We have two priorities for hard register preferences.
- If we have a move insn or an insn whose first input
- can only be in the same register as the output, give
- priority to an equivalence found from that insn. */
- int may_save_copy
- = ((SET_DEST (body) == r0 && SET_SRC (body) == r1)
-#ifdef REGISTER_CONSTRAINTS
- || (r1 == recog_operand[i] && must_match_0 >= 0)
-#endif
- );
-
- if (GET_CODE (r1) == REG || GET_CODE (r1) == SUBREG)
- win = combine_regs (r1, r0, may_save_copy,
- insn_number, insn, 0);
- }
- if (win)
- break;
- }
- }
-
- /* Recognize an insn sequence with an ultimate result
- which can safely overlap one of the inputs.
- The sequence begins with a CLOBBER of its result,
- and ends with an insn that copies the result to itself
- and has a REG_EQUAL note for an equivalent formula.
- That note indicates what the inputs are.
- The result and the input can overlap if each insn in
- the sequence either doesn't mention the input
- or has a REG_NO_CONFLICT note to inhibit the conflict.
-
- We do the combining test at the CLOBBER so that the
- destination register won't have had a quantity number
- assigned, since that would prevent combining. */
-
- if (GET_CODE (PATTERN (insn)) == CLOBBER
- && (r0 = XEXP (PATTERN (insn), 0),
- GET_CODE (r0) == REG)
- && (link = find_reg_note (insn, REG_LIBCALL, NULL_RTX)) != 0
- && XEXP (link, 0) != 0
- && GET_CODE (XEXP (link, 0)) == INSN
- && (set = single_set (XEXP (link, 0))) != 0
- && SET_DEST (set) == r0 && SET_SRC (set) == r0
- && (note = find_reg_note (XEXP (link, 0), REG_EQUAL,
- NULL_RTX)) != 0)
- {
- if (r1 = XEXP (note, 0), GET_CODE (r1) == REG
- /* Check that we have such a sequence. */
- && no_conflict_p (insn, r0, r1))
- win = combine_regs (r1, r0, 1, insn_number, insn, 1);
- else if (GET_RTX_FORMAT (GET_CODE (XEXP (note, 0)))[0] == 'e'
- && (r1 = XEXP (XEXP (note, 0), 0),
- GET_CODE (r1) == REG || GET_CODE (r1) == SUBREG)
- && no_conflict_p (insn, r0, r1))
- win = combine_regs (r1, r0, 0, insn_number, insn, 1);
-
- /* Here we care if the operation to be computed is
- commutative. */
- else if ((GET_CODE (XEXP (note, 0)) == EQ
- || GET_CODE (XEXP (note, 0)) == NE
- || GET_RTX_CLASS (GET_CODE (XEXP (note, 0))) == 'c')
- && (r1 = XEXP (XEXP (note, 0), 1),
- (GET_CODE (r1) == REG || GET_CODE (r1) == SUBREG))
- && no_conflict_p (insn, r0, r1))
- win = combine_regs (r1, r0, 0, insn_number, insn, 1);
-
- /* If we did combine something, show the register number
- in question so that we know to ignore its death. */
- if (win)
- no_conflict_combined_regno = REGNO (r1);
- }
-
- /* If registers were just tied, set COMBINED_REGNO
- to the number of the register used in this insn
- that was tied to the register set in this insn.
- This register's qty should not be "killed". */
-
- if (win)
- {
- while (GET_CODE (r1) == SUBREG)
- r1 = SUBREG_REG (r1);
- combined_regno = REGNO (r1);
- }
-
- /* Mark the death of everything that dies in this instruction,
- except for anything that was just combined. */
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_DEAD
- && GET_CODE (XEXP (link, 0)) == REG
- && combined_regno != REGNO (XEXP (link, 0))
- && (no_conflict_combined_regno != REGNO (XEXP (link, 0))
- || ! find_reg_note (insn, REG_NO_CONFLICT, XEXP (link, 0))))
- wipe_dead_reg (XEXP (link, 0), 0);
-
- /* Allocate qty numbers for all registers local to this block
- that are born (set) in this instruction.
- A pseudo that already has a qty is not changed. */
-
- note_stores (PATTERN (insn), reg_is_set);
-
- /* If anything is set in this insn and then unused, mark it as dying
- after this insn, so it will conflict with our outputs. This
- can't match with something that combined, and it doesn't matter
- if it did. Do this after the calls to reg_is_set since these
- die after, not during, the current insn. */
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_UNUSED
- && GET_CODE (XEXP (link, 0)) == REG)
- wipe_dead_reg (XEXP (link, 0), 1);
-
- /* Allocate quantities for any SCRATCH operands of this insn. */
-
- if (insn_code_number >= 0)
- for (i = 0; i < insn_n_operands[insn_code_number]; i++)
- if (GET_CODE (recog_operand[i]) == SCRATCH
- && scratches_allocated++ < scratch_list_length)
- alloc_qty_for_scratch (recog_operand[i], i, insn,
- insn_code_number, insn_number);
-
- /* If this is an insn that has a REG_RETVAL note pointing at a
- CLOBBER insn, we have reached the end of a REG_NO_CONFLICT
- block, so clear any register number that combined within it. */
- if ((note = find_reg_note (insn, REG_RETVAL, NULL_RTX)) != 0
- && GET_CODE (XEXP (note, 0)) == INSN
- && GET_CODE (PATTERN (XEXP (note, 0))) == CLOBBER)
- no_conflict_combined_regno = -1;
- }
-
- /* Set the registers live after INSN_NUMBER. Note that we never
- record the registers live before the block's first insn, since no
- pseudos we care about are live before that insn. */
-
- IOR_HARD_REG_SET (regs_live_at[2 * insn_number], regs_live);
- IOR_HARD_REG_SET (regs_live_at[2 * insn_number + 1], regs_live);
-
- if (insn == basic_block_end[b])
- break;
-
- insn = NEXT_INSN (insn);
- }
-
- /* Now every register that is local to this basic block
- should have been given a quantity, or else -1 meaning ignore it.
- Every quantity should have a known birth and death.
-
- Order the qtys so we assign them registers in order of the
- number of suggested registers they need so we allocate those with
- the most restrictive needs first. */
-
- qty_order = (int *) alloca (next_qty * sizeof (int));
- for (i = 0; i < next_qty; i++)
- qty_order[i] = i;
-
-#define EXCHANGE(I1, I2) \
- { i = qty_order[I1]; qty_order[I1] = qty_order[I2]; qty_order[I2] = i; }
-
- switch (next_qty)
- {
- case 3:
- /* Make qty_order[2] be the one to allocate last. */
- if (qty_sugg_compare (0, 1) > 0)
- EXCHANGE (0, 1);
- if (qty_sugg_compare (1, 2) > 0)
- EXCHANGE (2, 1);
-
- /* ... Fall through ... */
- case 2:
- /* Put the best one to allocate in qty_order[0]. */
- if (qty_sugg_compare (0, 1) > 0)
- EXCHANGE (0, 1);
-
- /* ... Fall through ... */
-
- case 1:
- case 0:
- /* Nothing to do here. */
- break;
-
- default:
- qsort (qty_order, next_qty, sizeof (int), qty_sugg_compare_1);
- }
-
- /* Try to put each quantity in a suggested physical register, if it has one.
- This may cause registers to be allocated that otherwise wouldn't be, but
- this seems acceptable in local allocation (unlike global allocation). */
- for (i = 0; i < next_qty; i++)
- {
- q = qty_order[i];
- if (qty_phys_num_sugg[q] != 0 || qty_phys_num_copy_sugg[q] != 0)
- qty_phys_reg[q] = find_free_reg (qty_min_class[q], qty_mode[q], q,
- 0, 1, qty_birth[q], qty_death[q]);
- else
- qty_phys_reg[q] = -1;
- }
-
- /* Order the qtys so we assign them registers in order of
- decreasing length of life. Normally call qsort, but if we
- have only a very small number of quantities, sort them ourselves. */
-
- for (i = 0; i < next_qty; i++)
- qty_order[i] = i;
-
-#define EXCHANGE(I1, I2) \
- { i = qty_order[I1]; qty_order[I1] = qty_order[I2]; qty_order[I2] = i; }
-
- switch (next_qty)
- {
- case 3:
- /* Make qty_order[2] be the one to allocate last. */
- if (qty_compare (0, 1) > 0)
- EXCHANGE (0, 1);
- if (qty_compare (1, 2) > 0)
- EXCHANGE (2, 1);
-
- /* ... Fall through ... */
- case 2:
- /* Put the best one to allocate in qty_order[0]. */
- if (qty_compare (0, 1) > 0)
- EXCHANGE (0, 1);
-
- /* ... Fall through ... */
-
- case 1:
- case 0:
- /* Nothing to do here. */
- break;
-
- default:
- qsort (qty_order, next_qty, sizeof (int), qty_compare_1);
- }
-
- /* Now for each qty that is not a hardware register,
- look for a hardware register to put it in.
- First try the register class that is cheapest for this qty,
- if there is more than one class. */
-
- for (i = 0; i < next_qty; i++)
- {
- q = qty_order[i];
- if (qty_phys_reg[q] < 0)
- {
- if (N_REG_CLASSES > 1)
- {
- qty_phys_reg[q] = find_free_reg (qty_min_class[q],
- qty_mode[q], q, 0, 0,
- qty_birth[q], qty_death[q]);
- if (qty_phys_reg[q] >= 0)
- continue;
- }
-
- if (qty_alternate_class[q] != NO_REGS)
- qty_phys_reg[q] = find_free_reg (qty_alternate_class[q],
- qty_mode[q], q, 0, 0,
- qty_birth[q], qty_death[q]);
- }
- }
-
- /* Now propagate the register assignments
- to the pseudo regs belonging to the qtys. */
-
- for (q = 0; q < next_qty; q++)
- if (qty_phys_reg[q] >= 0)
- {
- for (i = qty_first_reg[q]; i >= 0; i = reg_next_in_qty[i])
- reg_renumber[i] = qty_phys_reg[q] + reg_offset[i];
- if (qty_scratch_rtx[q])
- {
- if (GET_CODE (qty_scratch_rtx[q]) == REG)
- abort ();
- PUT_CODE (qty_scratch_rtx[q], REG);
- REGNO (qty_scratch_rtx[q]) = qty_phys_reg[q];
-
- scratch_block[scratch_index] = b;
- scratch_list[scratch_index++] = qty_scratch_rtx[q];
-
- /* Must clear the USED field, because it will have been set by
- copy_rtx_if_shared, but the leaf_register code expects that
- it is zero in all REG rtx. copy_rtx_if_shared does not set the
- used bit for REGs, but does for SCRATCHes. */
- qty_scratch_rtx[q]->used = 0;
- }
- }
-}
-
-/* Compare two quantities' priority for getting real registers.
- We give shorter-lived quantities higher priority.
- Quantities with more references are also preferred, as are quantities that
- require multiple registers. This is the identical prioritization as
- done by global-alloc.
-
- We used to give preference to registers with *longer* lives, but using
- the same algorithm in both local- and global-alloc can speed up execution
- of some programs by as much as a factor of three! */
-
-/* Note that the quotient will never be bigger than
- the value of floor_log2 times the maximum number of
- times a register can occur in one insn (surely less than 100).
- Multiplying this by 10000 can't overflow.
- QTY_CMP_PRI is also used by qty_sugg_compare. */
-
-#define QTY_CMP_PRI(q) \
- ((int) (((double) (floor_log2 (qty_n_refs[q]) * qty_n_refs[q] * qty_size[q]) \
- / (qty_death[q] - qty_birth[q])) * 10000))
-
-static int
-qty_compare (q1, q2)
- int q1, q2;
-{
- return QTY_CMP_PRI (q2) - QTY_CMP_PRI (q1);
-}
-
-static int
-qty_compare_1 (q1p, q2p)
- const GENERIC_PTR q1p;
- const GENERIC_PTR q2p;
-{
- register int q1 = *(int *)q1p, q2 = *(int *)q2p;
- register int tem = QTY_CMP_PRI (q2) - QTY_CMP_PRI (q1);
-
- if (tem != 0)
- return tem;
-
- /* If qtys are equally good, sort by qty number,
- so that the results of qsort leave nothing to chance. */
- return q1 - q2;
-}
-
-/* Compare two quantities' priority for getting real registers. This version
- is called for quantities that have suggested hard registers. First priority
- goes to quantities that have copy preferences, then to those that have
- normal preferences. Within those groups, quantities with the lower
- number of preferences have the highest priority. Of those, we use the same
- algorithm as above. */
-
-#define QTY_CMP_SUGG(q) \
- (qty_phys_num_copy_sugg[q] \
- ? qty_phys_num_copy_sugg[q] \
- : qty_phys_num_sugg[q] * FIRST_PSEUDO_REGISTER)
-
-static int
-qty_sugg_compare (q1, q2)
- int q1, q2;
-{
- register int tem = QTY_CMP_SUGG (q1) - QTY_CMP_SUGG (q2);
-
- if (tem != 0)
- return tem;
-
- return QTY_CMP_PRI (q2) - QTY_CMP_PRI (q1);
-}
-
-static int
-qty_sugg_compare_1 (q1p, q2p)
- const GENERIC_PTR q1p;
- const GENERIC_PTR q2p;
-{
- register int q1 = *(int *)q1p, q2 = *(int *)q2p;
- register int tem = QTY_CMP_SUGG (q1) - QTY_CMP_SUGG (q2);
-
- if (tem != 0)
- return tem;
-
- tem = QTY_CMP_PRI (q2) - QTY_CMP_PRI (q1);
- if (tem != 0)
- return tem;
-
- /* If qtys are equally good, sort by qty number,
- so that the results of qsort leave nothing to chance. */
- return q1 - q2;
-}
-
-#undef QTY_CMP_SUGG
-#undef QTY_CMP_PRI
-
-/* Attempt to combine the two registers (rtx's) USEDREG and SETREG.
- Returns 1 if have done so, or 0 if cannot.
-
- Combining registers means marking them as having the same quantity
- and adjusting the offsets within the quantity if either of
- them is a SUBREG).
-
- We don't actually combine a hard reg with a pseudo; instead
- we just record the hard reg as the suggestion for the pseudo's quantity.
- If we really combined them, we could lose if the pseudo lives
- across an insn that clobbers the hard reg (eg, movstr).
-
- ALREADY_DEAD is non-zero if USEDREG is known to be dead even though
- there is no REG_DEAD note on INSN. This occurs during the processing
- of REG_NO_CONFLICT blocks.
-
- MAY_SAVE_COPYCOPY is non-zero if this insn is simply copying USEDREG to
- SETREG or if the input and output must share a register.
- In that case, we record a hard reg suggestion in QTY_PHYS_COPY_SUGG.
-
- There are elaborate checks for the validity of combining. */
-
-
-static int
-combine_regs (usedreg, setreg, may_save_copy, insn_number, insn, already_dead)
- rtx usedreg, setreg;
- int may_save_copy;
- int insn_number;
- rtx insn;
- int already_dead;
-{
- register int ureg, sreg;
- register int offset = 0;
- int usize, ssize;
- register int sqty;
-
- /* Determine the numbers and sizes of registers being used. If a subreg
- is present that does not change the entire register, don't consider
- this a copy insn. */
-
- while (GET_CODE (usedreg) == SUBREG)
- {
- if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (usedreg))) > UNITS_PER_WORD)
- may_save_copy = 0;
- offset += SUBREG_WORD (usedreg);
- usedreg = SUBREG_REG (usedreg);
- }
- if (GET_CODE (usedreg) != REG)
- return 0;
- ureg = REGNO (usedreg);
- usize = REG_SIZE (usedreg);
-
- while (GET_CODE (setreg) == SUBREG)
- {
- if (GET_MODE_SIZE (GET_MODE (SUBREG_REG (setreg))) > UNITS_PER_WORD)
- may_save_copy = 0;
- offset -= SUBREG_WORD (setreg);
- setreg = SUBREG_REG (setreg);
- }
- if (GET_CODE (setreg) != REG)
- return 0;
- sreg = REGNO (setreg);
- ssize = REG_SIZE (setreg);
-
- /* If UREG is a pseudo-register that hasn't already been assigned a
- quantity number, it means that it is not local to this block or dies
- more than once. In either event, we can't do anything with it. */
- if ((ureg >= FIRST_PSEUDO_REGISTER && reg_qty[ureg] < 0)
- /* Do not combine registers unless one fits within the other. */
- || (offset > 0 && usize + offset > ssize)
- || (offset < 0 && usize + offset < ssize)
- /* Do not combine with a smaller already-assigned object
- if that smaller object is already combined with something bigger. */
- || (ssize > usize && ureg >= FIRST_PSEUDO_REGISTER
- && usize < qty_size[reg_qty[ureg]])
- /* Can't combine if SREG is not a register we can allocate. */
- || (sreg >= FIRST_PSEUDO_REGISTER && reg_qty[sreg] == -1)
- /* Don't combine with a pseudo mentioned in a REG_NO_CONFLICT note.
- These have already been taken care of. This probably wouldn't
- combine anyway, but don't take any chances. */
- || (ureg >= FIRST_PSEUDO_REGISTER
- && find_reg_note (insn, REG_NO_CONFLICT, usedreg))
- /* Don't tie something to itself. In most cases it would make no
- difference, but it would screw up if the reg being tied to itself
- also dies in this insn. */
- || ureg == sreg
- /* Don't try to connect two different hardware registers. */
- || (ureg < FIRST_PSEUDO_REGISTER && sreg < FIRST_PSEUDO_REGISTER)
- /* Don't connect two different machine modes if they have different
- implications as to which registers may be used. */
- || !MODES_TIEABLE_P (GET_MODE (usedreg), GET_MODE (setreg)))
- return 0;
-
- /* Now, if UREG is a hard reg and SREG is a pseudo, record the hard reg in
- qty_phys_sugg for the pseudo instead of tying them.
-
- Return "failure" so that the lifespan of UREG is terminated here;
- that way the two lifespans will be disjoint and nothing will prevent
- the pseudo reg from being given this hard reg. */
-
- if (ureg < FIRST_PSEUDO_REGISTER)
- {
- /* Allocate a quantity number so we have a place to put our
- suggestions. */
- if (reg_qty[sreg] == -2)
- reg_is_born (setreg, 2 * insn_number);
-
- if (reg_qty[sreg] >= 0)
- {
- if (may_save_copy
- && ! TEST_HARD_REG_BIT (qty_phys_copy_sugg[reg_qty[sreg]], ureg))
- {
- SET_HARD_REG_BIT (qty_phys_copy_sugg[reg_qty[sreg]], ureg);
- qty_phys_num_copy_sugg[reg_qty[sreg]]++;
- }
- else if (! TEST_HARD_REG_BIT (qty_phys_sugg[reg_qty[sreg]], ureg))
- {
- SET_HARD_REG_BIT (qty_phys_sugg[reg_qty[sreg]], ureg);
- qty_phys_num_sugg[reg_qty[sreg]]++;
- }
- }
- return 0;
- }
-
- /* Similarly for SREG a hard register and UREG a pseudo register. */
-
- if (sreg < FIRST_PSEUDO_REGISTER)
- {
- if (may_save_copy
- && ! TEST_HARD_REG_BIT (qty_phys_copy_sugg[reg_qty[ureg]], sreg))
- {
- SET_HARD_REG_BIT (qty_phys_copy_sugg[reg_qty[ureg]], sreg);
- qty_phys_num_copy_sugg[reg_qty[ureg]]++;
- }
- else if (! TEST_HARD_REG_BIT (qty_phys_sugg[reg_qty[ureg]], sreg))
- {
- SET_HARD_REG_BIT (qty_phys_sugg[reg_qty[ureg]], sreg);
- qty_phys_num_sugg[reg_qty[ureg]]++;
- }
- return 0;
- }
-
- /* At this point we know that SREG and UREG are both pseudos.
- Do nothing if SREG already has a quantity or is a register that we
- don't allocate. */
- if (reg_qty[sreg] >= -1
- /* If we are not going to let any regs live across calls,
- don't tie a call-crossing reg to a non-call-crossing reg. */
- || (current_function_has_nonlocal_label
- && ((reg_n_calls_crossed[ureg] > 0)
- != (reg_n_calls_crossed[sreg] > 0))))
- return 0;
-
- /* We don't already know about SREG, so tie it to UREG
- if this is the last use of UREG, provided the classes they want
- are compatible. */
-
- if ((already_dead || find_regno_note (insn, REG_DEAD, ureg))
- && reg_meets_class_p (sreg, qty_min_class[reg_qty[ureg]]))
- {
- /* Add SREG to UREG's quantity. */
- sqty = reg_qty[ureg];
- reg_qty[sreg] = sqty;
- reg_offset[sreg] = reg_offset[ureg] + offset;
- reg_next_in_qty[sreg] = qty_first_reg[sqty];
- qty_first_reg[sqty] = sreg;
-
- /* If SREG's reg class is smaller, set qty_min_class[SQTY]. */
- update_qty_class (sqty, sreg);
-
- /* Update info about quantity SQTY. */
- qty_n_calls_crossed[sqty] += reg_n_calls_crossed[sreg];
- qty_n_refs[sqty] += reg_n_refs[sreg];
- if (usize < ssize)
- {
- register int i;
-
- for (i = qty_first_reg[sqty]; i >= 0; i = reg_next_in_qty[i])
- reg_offset[i] -= offset;
-
- qty_size[sqty] = ssize;
- qty_mode[sqty] = GET_MODE (setreg);
- }
- }
- else
- return 0;
-
- return 1;
-}
-
-/* Return 1 if the preferred class of REG allows it to be tied
- to a quantity or register whose class is CLASS.
- True if REG's reg class either contains or is contained in CLASS. */
-
-static int
-reg_meets_class_p (reg, class)
- int reg;
- enum reg_class class;
-{
- register enum reg_class rclass = reg_preferred_class (reg);
- return (reg_class_subset_p (rclass, class)
- || reg_class_subset_p (class, rclass));
-}
-
-/* Return 1 if the two specified classes have registers in common.
- If CALL_SAVED, then consider only call-saved registers. */
-
-static int
-reg_classes_overlap_p (c1, c2, call_saved)
- register enum reg_class c1;
- register enum reg_class c2;
- int call_saved;
-{
- HARD_REG_SET c;
- int i;
-
- COPY_HARD_REG_SET (c, reg_class_contents[(int) c1]);
- AND_HARD_REG_SET (c, reg_class_contents[(int) c2]);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (TEST_HARD_REG_BIT (c, i)
- && (! call_saved || ! call_used_regs[i]))
- return 1;
-
- return 0;
-}
-
-/* Update the class of QTY assuming that REG is being tied to it. */
-
-static void
-update_qty_class (qty, reg)
- int qty;
- int reg;
-{
- enum reg_class rclass = reg_preferred_class (reg);
- if (reg_class_subset_p (rclass, qty_min_class[qty]))
- qty_min_class[qty] = rclass;
-
- rclass = reg_alternate_class (reg);
- if (reg_class_subset_p (rclass, qty_alternate_class[qty]))
- qty_alternate_class[qty] = rclass;
-
- if (reg_changes_size[reg])
- qty_changes_size[qty] = 1;
-}
-
-/* Handle something which alters the value of an rtx REG.
-
- REG is whatever is set or clobbered. SETTER is the rtx that
- is modifying the register.
-
- If it is not really a register, we do nothing.
- The file-global variables `this_insn' and `this_insn_number'
- carry info from `block_alloc'. */
-
-static void
-reg_is_set (reg, setter)
- rtx reg;
- rtx setter;
-{
- /* Note that note_stores will only pass us a SUBREG if it is a SUBREG of
- a hard register. These may actually not exist any more. */
-
- if (GET_CODE (reg) != SUBREG
- && GET_CODE (reg) != REG)
- return;
-
- /* Mark this register as being born. If it is used in a CLOBBER, mark
- it as being born halfway between the previous insn and this insn so that
- it conflicts with our inputs but not the outputs of the previous insn. */
-
- reg_is_born (reg, 2 * this_insn_number - (GET_CODE (setter) == CLOBBER));
-}
-
-/* Handle beginning of the life of register REG.
- BIRTH is the index at which this is happening. */
-
-static void
-reg_is_born (reg, birth)
- rtx reg;
- int birth;
-{
- register int regno;
-
- if (GET_CODE (reg) == SUBREG)
- regno = REGNO (SUBREG_REG (reg)) + SUBREG_WORD (reg);
- else
- regno = REGNO (reg);
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- mark_life (regno, GET_MODE (reg), 1);
-
- /* If the register was to have been born earlier that the present
- insn, mark it as live where it is actually born. */
- if (birth < 2 * this_insn_number)
- post_mark_life (regno, GET_MODE (reg), 1, birth, 2 * this_insn_number);
- }
- else
- {
- if (reg_qty[regno] == -2)
- alloc_qty (regno, GET_MODE (reg), PSEUDO_REGNO_SIZE (regno), birth);
-
- /* If this register has a quantity number, show that it isn't dead. */
- if (reg_qty[regno] >= 0)
- qty_death[reg_qty[regno]] = -1;
- }
-}
-
-/* Record the death of REG in the current insn. If OUTPUT_P is non-zero,
- REG is an output that is dying (i.e., it is never used), otherwise it
- is an input (the normal case).
- If OUTPUT_P is 1, then we extend the life past the end of this insn. */
-
-static void
-wipe_dead_reg (reg, output_p)
- register rtx reg;
- int output_p;
-{
- register int regno = REGNO (reg);
-
- /* If this insn has multiple results,
- and the dead reg is used in one of the results,
- extend its life to after this insn,
- so it won't get allocated together with any other result of this insn. */
- if (GET_CODE (PATTERN (this_insn)) == PARALLEL
- && !single_set (this_insn))
- {
- int i;
- for (i = XVECLEN (PATTERN (this_insn), 0) - 1; i >= 0; i--)
- {
- rtx set = XVECEXP (PATTERN (this_insn), 0, i);
- if (GET_CODE (set) == SET
- && GET_CODE (SET_DEST (set)) != REG
- && !rtx_equal_p (reg, SET_DEST (set))
- && reg_overlap_mentioned_p (reg, SET_DEST (set)))
- output_p = 1;
- }
- }
-
- /* If this register is used in an auto-increment address, then extend its
- life to after this insn, so that it won't get allocated together with
- the result of this insn. */
- if (! output_p && find_regno_note (this_insn, REG_INC, regno))
- output_p = 1;
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- mark_life (regno, GET_MODE (reg), 0);
-
- /* If a hard register is dying as an output, mark it as in use at
- the beginning of this insn (the above statement would cause this
- not to happen). */
- if (output_p)
- post_mark_life (regno, GET_MODE (reg), 1,
- 2 * this_insn_number, 2 * this_insn_number+ 1);
- }
-
- else if (reg_qty[regno] >= 0)
- qty_death[reg_qty[regno]] = 2 * this_insn_number + output_p;
-}
-
-/* Find a block of SIZE words of hard regs in reg_class CLASS
- that can hold something of machine-mode MODE
- (but actually we test only the first of the block for holding MODE)
- and still free between insn BORN_INDEX and insn DEAD_INDEX,
- and return the number of the first of them.
- Return -1 if such a block cannot be found.
- If QTY crosses calls, insist on a register preserved by calls,
- unless ACCEPT_CALL_CLOBBERED is nonzero.
-
- If JUST_TRY_SUGGESTED is non-zero, only try to see if the suggested
- register is available. If not, return -1. */
-
-static int
-find_free_reg (class, mode, qty, accept_call_clobbered, just_try_suggested,
- born_index, dead_index)
- enum reg_class class;
- enum machine_mode mode;
- int qty;
- int accept_call_clobbered;
- int just_try_suggested;
- int born_index, dead_index;
-{
- register int i, ins;
-#ifdef HARD_REG_SET
- register /* Declare it register if it's a scalar. */
-#endif
- HARD_REG_SET used, first_used;
-#ifdef ELIMINABLE_REGS
- static struct {int from, to; } eliminables[] = ELIMINABLE_REGS;
-#endif
-
- /* Validate our parameters. */
- if (born_index < 0 || born_index > dead_index)
- abort ();
-
- /* Don't let a pseudo live in a reg across a function call
- if we might get a nonlocal goto. */
- if (current_function_has_nonlocal_label
- && qty_n_calls_crossed[qty] > 0)
- return -1;
-
- if (accept_call_clobbered)
- COPY_HARD_REG_SET (used, call_fixed_reg_set);
- else if (qty_n_calls_crossed[qty] == 0)
- COPY_HARD_REG_SET (used, fixed_reg_set);
- else
- COPY_HARD_REG_SET (used, call_used_reg_set);
-
- if (accept_call_clobbered)
- IOR_HARD_REG_SET (used, losing_caller_save_reg_set);
-
- for (ins = born_index; ins < dead_index; ins++)
- IOR_HARD_REG_SET (used, regs_live_at[ins]);
-
- IOR_COMPL_HARD_REG_SET (used, reg_class_contents[(int) class]);
-
- /* Don't use the frame pointer reg in local-alloc even if
- we may omit the frame pointer, because if we do that and then we
- need a frame pointer, reload won't know how to move the pseudo
- to another hard reg. It can move only regs made by global-alloc.
-
- This is true of any register that can be eliminated. */
-#ifdef ELIMINABLE_REGS
- for (i = 0; i < sizeof eliminables / sizeof eliminables[0]; i++)
- SET_HARD_REG_BIT (used, eliminables[i].from);
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- /* If FRAME_POINTER_REGNUM is not a real register, then protect the one
- that it might be eliminated into. */
- SET_HARD_REG_BIT (used, HARD_FRAME_POINTER_REGNUM);
-#endif
-#else
- SET_HARD_REG_BIT (used, FRAME_POINTER_REGNUM);
-#endif
-
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- if (qty_changes_size[qty])
- IOR_HARD_REG_SET (used,
- reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE]);
-#endif
-
- /* Normally, the registers that can be used for the first register in
- a multi-register quantity are the same as those that can be used for
- subsequent registers. However, if just trying suggested registers,
- restrict our consideration to them. If there are copy-suggested
- register, try them. Otherwise, try the arithmetic-suggested
- registers. */
- COPY_HARD_REG_SET (first_used, used);
-
- if (just_try_suggested)
- {
- if (qty_phys_num_copy_sugg[qty] != 0)
- IOR_COMPL_HARD_REG_SET (first_used, qty_phys_copy_sugg[qty]);
- else
- IOR_COMPL_HARD_REG_SET (first_used, qty_phys_sugg[qty]);
- }
-
- /* If all registers are excluded, we can't do anything. */
- GO_IF_HARD_REG_SUBSET (reg_class_contents[(int) ALL_REGS], first_used, fail);
-
- /* If at least one would be suitable, test each hard reg. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
-#ifdef REG_ALLOC_ORDER
- int regno = reg_alloc_order[i];
-#else
- int regno = i;
-#endif
- if (! TEST_HARD_REG_BIT (first_used, regno)
- && HARD_REGNO_MODE_OK (regno, mode))
- {
- register int j;
- register int size1 = HARD_REGNO_NREGS (regno, mode);
- for (j = 1; j < size1 && ! TEST_HARD_REG_BIT (used, regno + j); j++);
- if (j == size1)
- {
- /* Mark that this register is in use between its birth and death
- insns. */
- post_mark_life (regno, mode, 1, born_index, dead_index);
- return regno;
- }
-#ifndef REG_ALLOC_ORDER
- i += j; /* Skip starting points we know will lose */
-#endif
- }
- }
-
- fail:
-
- /* If we are just trying suggested register, we have just tried copy-
- suggested registers, and there are arithmetic-suggested registers,
- try them. */
-
- /* If it would be profitable to allocate a call-clobbered register
- and save and restore it around calls, do that. */
- if (just_try_suggested && qty_phys_num_copy_sugg[qty] != 0
- && qty_phys_num_sugg[qty] != 0)
- {
- /* Don't try the copy-suggested regs again. */
- qty_phys_num_copy_sugg[qty] = 0;
- return find_free_reg (class, mode, qty, accept_call_clobbered, 1,
- born_index, dead_index);
- }
-
- /* We need not check to see if the current function has nonlocal
- labels because we don't put any pseudos that are live over calls in
- registers in that case. */
-
- if (! accept_call_clobbered
- && flag_caller_saves
- && ! just_try_suggested
- && qty_n_calls_crossed[qty] != 0
- && CALLER_SAVE_PROFITABLE (qty_n_refs[qty], qty_n_calls_crossed[qty]))
- {
- i = find_free_reg (class, mode, qty, 1, 0, born_index, dead_index);
- if (i >= 0)
- caller_save_needed = 1;
- return i;
- }
- return -1;
-}
-
-/* Mark that REGNO with machine-mode MODE is live starting from the current
- insn (if LIFE is non-zero) or dead starting at the current insn (if LIFE
- is zero). */
-
-static void
-mark_life (regno, mode, life)
- register int regno;
- enum machine_mode mode;
- int life;
-{
- register int j = HARD_REGNO_NREGS (regno, mode);
- if (life)
- while (--j >= 0)
- SET_HARD_REG_BIT (regs_live, regno + j);
- else
- while (--j >= 0)
- CLEAR_HARD_REG_BIT (regs_live, regno + j);
-}
-
-/* Mark register number REGNO (with machine-mode MODE) as live (if LIFE
- is non-zero) or dead (if LIFE is zero) from insn number BIRTH (inclusive)
- to insn number DEATH (exclusive). */
-
-static void
-post_mark_life (regno, mode, life, birth, death)
- int regno;
- enum machine_mode mode;
- int life, birth, death;
-{
- register int j = HARD_REGNO_NREGS (regno, mode);
-#ifdef HARD_REG_SET
- register /* Declare it register if it's a scalar. */
-#endif
- HARD_REG_SET this_reg;
-
- CLEAR_HARD_REG_SET (this_reg);
- while (--j >= 0)
- SET_HARD_REG_BIT (this_reg, regno + j);
-
- if (life)
- while (birth < death)
- {
- IOR_HARD_REG_SET (regs_live_at[birth], this_reg);
- birth++;
- }
- else
- while (birth < death)
- {
- AND_COMPL_HARD_REG_SET (regs_live_at[birth], this_reg);
- birth++;
- }
-}
-
-/* INSN is the CLOBBER insn that starts a REG_NO_NOCONFLICT block, R0
- is the register being clobbered, and R1 is a register being used in
- the equivalent expression.
-
- If R1 dies in the block and has a REG_NO_CONFLICT note on every insn
- in which it is used, return 1.
-
- Otherwise, return 0. */
-
-static int
-no_conflict_p (insn, r0, r1)
- rtx insn, r0, r1;
-{
- int ok = 0;
- rtx note = find_reg_note (insn, REG_LIBCALL, NULL_RTX);
- rtx p, last;
-
- /* If R1 is a hard register, return 0 since we handle this case
- when we scan the insns that actually use it. */
-
- if (note == 0
- || (GET_CODE (r1) == REG && REGNO (r1) < FIRST_PSEUDO_REGISTER)
- || (GET_CODE (r1) == SUBREG && GET_CODE (SUBREG_REG (r1)) == REG
- && REGNO (SUBREG_REG (r1)) < FIRST_PSEUDO_REGISTER))
- return 0;
-
- last = XEXP (note, 0);
-
- for (p = NEXT_INSN (insn); p && p != last; p = NEXT_INSN (p))
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i')
- {
- if (find_reg_note (p, REG_DEAD, r1))
- ok = 1;
-
- /* There must be a REG_NO_CONFLICT note on every insn, otherwise
- some earlier optimization pass has inserted instructions into
- the sequence, and it is not safe to perform this optimization.
- Note that emit_no_conflict_block always ensures that this is
- true when these sequences are created. */
- if (! find_reg_note (p, REG_NO_CONFLICT, r1))
- return 0;
- }
-
- return ok;
-}
-
-#ifdef REGISTER_CONSTRAINTS
-
-/* Return the number of alternatives for which the constraint string P
- indicates that the operand must be equal to operand 0 and that no register
- is acceptable. */
-
-static int
-requires_inout (p)
- char *p;
-{
- char c;
- int found_zero = 0;
- int reg_allowed = 0;
- int num_matching_alts = 0;
-
- while (c = *p++)
- switch (c)
- {
- case '=': case '+': case '?':
- case '#': case '&': case '!':
- case '*': case '%':
- case '1': case '2': case '3': case '4':
- case 'm': case '<': case '>': case 'V': case 'o':
- case 'E': case 'F': case 'G': case 'H':
- case 's': case 'i': case 'n':
- case 'I': case 'J': case 'K': case 'L':
- case 'M': case 'N': case 'O': case 'P':
-#ifdef EXTRA_CONSTRAINT
- case 'Q': case 'R': case 'S': case 'T': case 'U':
-#endif
- case 'X':
- /* These don't say anything we care about. */
- break;
-
- case ',':
- if (found_zero && ! reg_allowed)
- num_matching_alts++;
-
- found_zero = reg_allowed = 0;
- break;
-
- case '0':
- found_zero = 1;
- break;
-
- case 'p':
- case 'g': case 'r':
- default:
- reg_allowed = 1;
- break;
- }
-
- if (found_zero && ! reg_allowed)
- num_matching_alts++;
-
- return num_matching_alts;
-}
-#endif /* REGISTER_CONSTRAINTS */
-
-void
-dump_local_alloc (file)
- FILE *file;
-{
- register int i;
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_renumber[i] != -1)
- fprintf (file, ";; Register %d in %d.\n", i, reg_renumber[i]);
-}
diff --git a/gcc/longlong.h b/gcc/longlong.h
deleted file mode 100644
index e6071547ad7..00000000000
--- a/gcc/longlong.h
+++ /dev/null
@@ -1,1225 +0,0 @@
-/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
- Copyright (C) 1991, 92, 94, 95, 96, 1997 Free Software Foundation, Inc.
-
- This definition 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, or (at your option) any later version.
-
- This definition file 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. */
-
-#ifndef SI_TYPE_SIZE
-#define SI_TYPE_SIZE 32
-#endif
-
-#define __BITS4 (SI_TYPE_SIZE / 4)
-#define __ll_B (1L << (SI_TYPE_SIZE / 2))
-#define __ll_lowpart(t) ((USItype) (t) % __ll_B)
-#define __ll_highpart(t) ((USItype) (t) / __ll_B)
-
-/* Define auxiliary asm macros.
-
- 1) umul_ppmm(high_prod, low_prod, multipler, multiplicand)
- multiplies two USItype integers MULTIPLER and MULTIPLICAND,
- and generates a two-part USItype product in HIGH_PROD and
- LOW_PROD.
-
- 2) __umulsidi3(a,b) multiplies two USItype integers A and B,
- and returns a UDItype product. This is just a variant of umul_ppmm.
-
- 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
- denominator) divides a two-word unsigned integer, composed by the
- integers HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and
- places the quotient in QUOTIENT and the remainder in REMAINDER.
- HIGH_NUMERATOR must be less than DENOMINATOR for correct operation.
- If, in addition, the most significant bit of DENOMINATOR must be 1,
- then the pre-processor symbol UDIV_NEEDS_NORMALIZATION is defined to 1.
-
- 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
- denominator). Like udiv_qrnnd but the numbers are signed. The
- quotient is rounded towards 0.
-
- 5) count_leading_zeros(count, x) counts the number of zero-bits from
- the msb to the first non-zero bit. This is the number of steps X
- needs to be shifted left to set the msb. Undefined for X == 0.
-
- 6) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1,
- high_addend_2, low_addend_2) adds two two-word unsigned integers,
- composed by HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and
- LOW_ADDEND_2 respectively. The result is placed in HIGH_SUM and
- LOW_SUM. Overflow (i.e. carry out) is not stored anywhere, and is
- lost.
-
- 7) sub_ddmmss(high_difference, low_difference, high_minuend,
- low_minuend, high_subtrahend, low_subtrahend) subtracts two
- two-word unsigned integers, composed by HIGH_MINUEND_1 and
- LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and LOW_SUBTRAHEND_2
- respectively. The result is placed in HIGH_DIFFERENCE and
- LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere,
- and is lost.
-
- If any of these macros are left undefined for a particular CPU,
- C macros are used. */
-
-/* The CPUs come in alphabetical order below.
-
- Please add support for more CPUs here, or improve the current support
- for the CPUs below!
- (E.g. WE32100, IBM360.) */
-
-#if defined (__GNUC__) && !defined (NO_ASM)
-
-/* We sometimes need to clobber "cc" with gcc2, but that would not be
- understood by gcc1. Use cpp to avoid major code duplication. */
-#if __GNUC__ < 2
-#define __CLOBBER_CC
-#define __AND_CLOBBER_CC
-#else /* __GNUC__ >= 2 */
-#define __CLOBBER_CC : "cc"
-#define __AND_CLOBBER_CC , "cc"
-#endif /* __GNUC__ < 2 */
-
-#if defined (__a29k__) || defined (_AM29K)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add %1,%4,%5
- addc %0,%2,%3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%r" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "%r" ((USItype) (al)), \
- "rI" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub %1,%4,%5
- subc %0,%2,%3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "r" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "r" ((USItype) (al)), \
- "rI" ((USItype) (bl)))
-#define umul_ppmm(xh, xl, m0, m1) \
- do { \
- USItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("multiplu %0,%1,%2" \
- : "=r" ((USItype) (xl)) \
- : "r" (__m0), \
- "r" (__m1)); \
- __asm__ ("multmu %0,%1,%2" \
- : "=r" ((USItype) (xh)) \
- : "r" (__m0), \
- "r" (__m1)); \
- } while (0)
-#define udiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("dividu %0,%3,%4" \
- : "=r" ((USItype) (q)), \
- "=q" ((USItype) (r)) \
- : "1" ((USItype) (n1)), \
- "r" ((USItype) (n0)), \
- "r" ((USItype) (d)))
-#define count_leading_zeros(count, x) \
- __asm__ ("clz %0,%1" \
- : "=r" ((USItype) (count)) \
- : "r" ((USItype) (x)))
-#endif /* __a29k__ */
-
-#if defined (__arm__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("adds %1, %4, %5
- adc %0, %2, %3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%r" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "%r" ((USItype) (al)), \
- "rI" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subs %1, %4, %5
- sbc %0, %2, %3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "r" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "r" ((USItype) (al)), \
- "rI" ((USItype) (bl)))
-#define umul_ppmm(xh, xl, a, b) \
-{register USItype __t0, __t1, __t2; \
- __asm__ ("%@ Inlined umul_ppmm
- mov %2, %5, lsr #16
- mov %0, %6, lsr #16
- bic %3, %5, %2, lsl #16
- bic %4, %6, %0, lsl #16
- mul %1, %3, %4
- mul %4, %2, %4
- mul %3, %0, %3
- mul %0, %2, %0
- adds %3, %4, %3
- addcs %0, %0, #65536
- adds %1, %1, %3, lsl #16
- adc %0, %0, %3, lsr #16" \
- : "=&r" ((USItype) (xh)), \
- "=r" ((USItype) (xl)), \
- "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \
- : "r" ((USItype) (a)), \
- "r" ((USItype) (b)));}
-#define UMUL_TIME 20
-#define UDIV_TIME 100
-#endif /* __arm__ */
-
-#if defined (__clipper__)
-#define umul_ppmm(w1, w0, u, v) \
- ({union {UDItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __xx; \
- __asm__ ("mulwux %2,%0" \
- : "=r" (__xx.__ll) \
- : "%0" ((USItype) (u)), \
- "r" ((USItype) (v))); \
- (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})
-#define smul_ppmm(w1, w0, u, v) \
- ({union {DItype __ll; \
- struct {SItype __l, __h;} __i; \
- } __xx; \
- __asm__ ("mulwx %2,%0" \
- : "=r" (__xx.__ll) \
- : "%0" ((SItype) (u)), \
- "r" ((SItype) (v))); \
- (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})
-#define __umulsidi3(u, v) \
- ({UDItype __w; \
- __asm__ ("mulwux %2,%0" \
- : "=r" (__w) \
- : "%0" ((USItype) (u)), \
- "r" ((USItype) (v))); \
- __w; })
-#endif /* __clipper__ */
-
-#if defined (__gmicro__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add.w %5,%1
- addx %3,%0" \
- : "=g" ((USItype) (sh)), \
- "=&g" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub.w %5,%1
- subx %3,%0" \
- : "=g" ((USItype) (sh)), \
- "=&g" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define umul_ppmm(ph, pl, m0, m1) \
- __asm__ ("mulx %3,%0,%1" \
- : "=g" ((USItype) (ph)), \
- "=r" ((USItype) (pl)) \
- : "%0" ((USItype) (m0)), \
- "g" ((USItype) (m1)))
-#define udiv_qrnnd(q, r, nh, nl, d) \
- __asm__ ("divx %4,%0,%1" \
- : "=g" ((USItype) (q)), \
- "=r" ((USItype) (r)) \
- : "1" ((USItype) (nh)), \
- "0" ((USItype) (nl)), \
- "g" ((USItype) (d)))
-#define count_leading_zeros(count, x) \
- __asm__ ("bsch/1 %1,%0" \
- : "=g" (count) \
- : "g" ((USItype) (x)), \
- "0" ((USItype) 0))
-#endif
-
-#if defined (__hppa)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add %4,%5,%1
- addc %2,%3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%rM" ((USItype) (ah)), \
- "rM" ((USItype) (bh)), \
- "%rM" ((USItype) (al)), \
- "rM" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub %4,%5,%1
- subb %2,%3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "rM" ((USItype) (ah)), \
- "rM" ((USItype) (bh)), \
- "rM" ((USItype) (al)), \
- "rM" ((USItype) (bl)))
-#if defined (_PA_RISC1_1)
-#define umul_ppmm(w1, w0, u, v) \
- do { \
- union \
- { \
- UDItype __f; \
- struct {USItype __w1, __w0;} __w1w0; \
- } __t; \
- __asm__ ("xmpyu %1,%2,%0" \
- : "=x" (__t.__f) \
- : "x" ((USItype) (u)), \
- "x" ((USItype) (v))); \
- (w1) = __t.__w1w0.__w1; \
- (w0) = __t.__w1w0.__w0; \
- } while (0)
-#define UMUL_TIME 8
-#else
-#define UMUL_TIME 30
-#endif
-#define UDIV_TIME 40
-#define count_leading_zeros(count, x) \
- do { \
- USItype __tmp; \
- __asm__ ( \
- "ldi 1,%0
- extru,= %1,15,16,%%r0 ; Bits 31..16 zero?
- extru,tr %1,15,16,%1 ; No. Shift down, skip add.
- ldo 16(%0),%0 ; Yes. Perform add.
- extru,= %1,23,8,%%r0 ; Bits 15..8 zero?
- extru,tr %1,23,8,%1 ; No. Shift down, skip add.
- ldo 8(%0),%0 ; Yes. Perform add.
- extru,= %1,27,4,%%r0 ; Bits 7..4 zero?
- extru,tr %1,27,4,%1 ; No. Shift down, skip add.
- ldo 4(%0),%0 ; Yes. Perform add.
- extru,= %1,29,2,%%r0 ; Bits 3..2 zero?
- extru,tr %1,29,2,%1 ; No. Shift down, skip add.
- ldo 2(%0),%0 ; Yes. Perform add.
- extru %1,30,1,%1 ; Extract bit 1.
- sub %0,%1,%0 ; Subtract it.
- " : "=r" (count), "=r" (__tmp) : "1" (x)); \
- } while (0)
-#endif
-
-#if defined (__i386__) || defined (__i486__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addl %5,%1
- adcl %3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subl %5,%1
- sbbl %3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("mull %3" \
- : "=a" ((USItype) (w0)), \
- "=d" ((USItype) (w1)) \
- : "%0" ((USItype) (u)), \
- "rm" ((USItype) (v)))
-#define udiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("divl %4" \
- : "=a" ((USItype) (q)), \
- "=d" ((USItype) (r)) \
- : "0" ((USItype) (n0)), \
- "1" ((USItype) (n1)), \
- "rm" ((USItype) (d)))
-#define count_leading_zeros(count, x) \
- do { \
- USItype __cbtmp; \
- __asm__ ("bsrl %1,%0" \
- : "=r" (__cbtmp) : "rm" ((USItype) (x))); \
- (count) = __cbtmp ^ 31; \
- } while (0)
-#define UMUL_TIME 40
-#define UDIV_TIME 40
-#endif /* 80x86 */
-
-#if defined (__i860__)
-#if 0
-/* Make sure these patterns really improve the code before
- switching them on. */
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
- union \
- { \
- DItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __a, __b, __s; \
- __a.__i.__l = (al); \
- __a.__i.__h = (ah); \
- __b.__i.__l = (bl); \
- __b.__i.__h = (bh); \
- __asm__ ("fiadd.dd %1,%2,%0" \
- : "=f" (__s.__ll) \
- : "%f" (__a.__ll), "f" (__b.__ll)); \
- (sh) = __s.__i.__h; \
- (sl) = __s.__i.__l; \
- } while (0)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- union \
- { \
- DItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __a, __b, __s; \
- __a.__i.__l = (al); \
- __a.__i.__h = (ah); \
- __b.__i.__l = (bl); \
- __b.__i.__h = (bh); \
- __asm__ ("fisub.dd %1,%2,%0" \
- : "=f" (__s.__ll) \
- : "%f" (__a.__ll), "f" (__b.__ll)); \
- (sh) = __s.__i.__h; \
- (sl) = __s.__i.__l; \
- } while (0)
-#endif
-#endif /* __i860__ */
-
-#if defined (__i960__)
-#define umul_ppmm(w1, w0, u, v) \
- ({union {UDItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __xx; \
- __asm__ ("emul %2,%1,%0" \
- : "=d" (__xx.__ll) \
- : "%dI" ((USItype) (u)), \
- "dI" ((USItype) (v))); \
- (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})
-#define __umulsidi3(u, v) \
- ({UDItype __w; \
- __asm__ ("emul %2,%1,%0" \
- : "=d" (__w) \
- : "%dI" ((USItype) (u)), \
- "dI" ((USItype) (v))); \
- __w; })
-#endif /* __i960__ */
-
-#if defined (__M32R__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- /* The cmp clears the condition bit. */ \
- __asm__ ("cmp %0,%0
- addx %%5,%1
- addx %%3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "r" ((USItype) (bl)) \
- : "cbit")
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- /* The cmp clears the condition bit. */ \
- __asm__ ("cmp %0,%0
- subx %5,%1
- subx %3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "r" ((USItype) (bl)) \
- : "cbit")
-#endif /* __M32R__ */
-
-#if defined (__mc68000__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("add%.l %5,%1
- addx%.l %3,%0" \
- : "=d" ((USItype) (sh)), \
- "=&d" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "d" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("sub%.l %5,%1
- subx%.l %3,%0" \
- : "=d" ((USItype) (sh)), \
- "=&d" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "d" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-
-/* The '020, '030, '040 and CPU32 have 32x32->64 and 64/32->32q-32r. */
-#if defined (__mc68020__) || defined(mc68020) \
- || defined(__mc68030__) || defined(mc68030) \
- || defined(__mc68040__) || defined(mc68040) \
- || defined(__mc68332__) || defined(mc68332) \
- || defined(__NeXT__)
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("mulu%.l %3,%1:%0" \
- : "=d" ((USItype) (w0)), \
- "=d" ((USItype) (w1)) \
- : "%0" ((USItype) (u)), \
- "dmi" ((USItype) (v)))
-#define UMUL_TIME 45
-#define udiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("divu%.l %4,%1:%0" \
- : "=d" ((USItype) (q)), \
- "=d" ((USItype) (r)) \
- : "0" ((USItype) (n0)), \
- "1" ((USItype) (n1)), \
- "dmi" ((USItype) (d)))
-#define UDIV_TIME 90
-#define sdiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("divs%.l %4,%1:%0" \
- : "=d" ((USItype) (q)), \
- "=d" ((USItype) (r)) \
- : "0" ((USItype) (n0)), \
- "1" ((USItype) (n1)), \
- "dmi" ((USItype) (d)))
-
-#else /* not mc68020 */
-#if !defined(__mcf5200__)
-/* %/ inserts REGISTER_PREFIX, %# inserts IMMEDIATE_PREFIX. */
-#define umul_ppmm(xh, xl, a, b) \
- __asm__ ("| Inlined umul_ppmm
- move%.l %2,%/d0
- move%.l %3,%/d1
- move%.l %/d0,%/d2
- swap %/d0
- move%.l %/d1,%/d3
- swap %/d1
- move%.w %/d2,%/d4
- mulu %/d3,%/d4
- mulu %/d1,%/d2
- mulu %/d0,%/d3
- mulu %/d0,%/d1
- move%.l %/d4,%/d0
- eor%.w %/d0,%/d0
- swap %/d0
- add%.l %/d0,%/d2
- add%.l %/d3,%/d2
- jcc 1f
- add%.l %#65536,%/d1
-1: swap %/d2
- moveq %#0,%/d0
- move%.w %/d2,%/d0
- move%.w %/d4,%/d2
- move%.l %/d2,%1
- add%.l %/d1,%/d0
- move%.l %/d0,%0" \
- : "=g" ((USItype) (xh)), \
- "=g" ((USItype) (xl)) \
- : "g" ((USItype) (a)), \
- "g" ((USItype) (b)) \
- : "d0", "d1", "d2", "d3", "d4")
-#define UMUL_TIME 100
-#define UDIV_TIME 400
-#endif /* not mcf5200 */
-#endif /* not mc68020 */
-
-/* The '020, '030, '040 and '060 have bitfield insns. */
-#if defined (__mc68020__) || defined(mc68020) \
- || defined(__mc68030__) || defined(mc68030) \
- || defined(__mc68040__) || defined(mc68040) \
- || defined(__mc68060__) || defined(mc68060) \
- || defined(__NeXT__)
-#define count_leading_zeros(count, x) \
- __asm__ ("bfffo %1{%b2:%b2},%0" \
- : "=d" ((USItype) (count)) \
- : "od" ((USItype) (x)), "n" (0))
-#endif
-#endif /* mc68000 */
-
-#if defined (__m88000__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addu.co %1,%r4,%r5
- addu.ci %0,%r2,%r3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%rJ" ((USItype) (ah)), \
- "rJ" ((USItype) (bh)), \
- "%rJ" ((USItype) (al)), \
- "rJ" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subu.co %1,%r4,%r5
- subu.ci %0,%r2,%r3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "rJ" ((USItype) (ah)), \
- "rJ" ((USItype) (bh)), \
- "rJ" ((USItype) (al)), \
- "rJ" ((USItype) (bl)))
-#define count_leading_zeros(count, x) \
- do { \
- USItype __cbtmp; \
- __asm__ ("ff1 %0,%1" \
- : "=r" (__cbtmp) \
- : "r" ((USItype) (x))); \
- (count) = __cbtmp ^ 31; \
- } while (0)
-#if defined (__mc88110__)
-#define umul_ppmm(wh, wl, u, v) \
- do { \
- union {UDItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __xx; \
- __asm__ ("mulu.d %0,%1,%2" \
- : "=r" (__xx.__ll) \
- : "r" ((USItype) (u)), \
- "r" ((USItype) (v))); \
- (wh) = __xx.__i.__h; \
- (wl) = __xx.__i.__l; \
- } while (0)
-#define udiv_qrnnd(q, r, n1, n0, d) \
- ({union {UDItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __xx; \
- USItype __q; \
- __xx.__i.__h = (n1); __xx.__i.__l = (n0); \
- __asm__ ("divu.d %0,%1,%2" \
- : "=r" (__q) \
- : "r" (__xx.__ll), \
- "r" ((USItype) (d))); \
- (r) = (n0) - __q * (d); (q) = __q; })
-#define UMUL_TIME 5
-#define UDIV_TIME 25
-#else
-#define UMUL_TIME 17
-#define UDIV_TIME 150
-#endif /* __mc88110__ */
-#endif /* __m88000__ */
-
-#if defined (__mips__)
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("multu %2,%3" \
- : "=l" ((USItype) (w0)), \
- "=h" ((USItype) (w1)) \
- : "d" ((USItype) (u)), \
- "d" ((USItype) (v)))
-#define UMUL_TIME 10
-#define UDIV_TIME 100
-#endif /* __mips__ */
-
-#if defined (__ns32000__)
-#define umul_ppmm(w1, w0, u, v) \
- ({union {UDItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __xx; \
- __asm__ ("meid %2,%0" \
- : "=g" (__xx.__ll) \
- : "%0" ((USItype) (u)), \
- "g" ((USItype) (v))); \
- (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})
-#define __umulsidi3(u, v) \
- ({UDItype __w; \
- __asm__ ("meid %2,%0" \
- : "=g" (__w) \
- : "%0" ((USItype) (u)), \
- "g" ((USItype) (v))); \
- __w; })
-#define udiv_qrnnd(q, r, n1, n0, d) \
- ({union {UDItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __xx; \
- __xx.__i.__h = (n1); __xx.__i.__l = (n0); \
- __asm__ ("deid %2,%0" \
- : "=g" (__xx.__ll) \
- : "0" (__xx.__ll), \
- "g" ((USItype) (d))); \
- (r) = __xx.__i.__l; (q) = __xx.__i.__h; })
-#endif /* __ns32000__ */
-
-#if (defined (_ARCH_PPC) || defined (_IBMR2)) && W_TYPE_SIZE == 32
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
- if (__builtin_constant_p (bh) && (bh) == 0) \
- __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%r" ((USItype) (ah)), \
- "%r" ((USItype) (al)), \
- "rI" ((USItype) (bl))); \
- else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \
- __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%r" ((USItype) (ah)), \
- "%r" ((USItype) (al)), \
- "rI" ((USItype) (bl))); \
- else \
- __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%r" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "%r" ((USItype) (al)), \
- "rI" ((USItype) (bl))); \
- } while (0)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- if (__builtin_constant_p (ah) && (ah) == 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "r" ((USItype) (bh)), \
- "rI" ((USItype) (al)), \
- "r" ((USItype) (bl))); \
- else if (__builtin_constant_p (ah) && (ah) ==~(USItype) 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "r" ((USItype) (bh)), \
- "rI" ((USItype) (al)), \
- "r" ((USItype) (bl))); \
- else if (__builtin_constant_p (bh) && (bh) == 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "r" ((USItype) (ah)), \
- "rI" ((USItype) (al)), \
- "r" ((USItype) (bl))); \
- else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \
- __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "r" ((USItype) (ah)), \
- "rI" ((USItype) (al)), \
- "r" ((USItype) (bl))); \
- else \
- __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "r" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "rI" ((USItype) (al)), \
- "r" ((USItype) (bl))); \
- } while (0)
-#define count_leading_zeros(count, x) \
- __asm__ ("{cntlz|cntlzw} %0,%1" \
- : "=r" ((USItype) (count)) \
- : "r" ((USItype) (x)))
-#if defined (_ARCH_PPC)
-#define umul_ppmm(ph, pl, m0, m1) \
- do { \
- USItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("mulhwu %0,%1,%2" \
- : "=r" ((USItype) ph) \
- : "%r" (__m0), \
- "r" (__m1)); \
- (pl) = __m0 * __m1; \
- } while (0)
-#define UMUL_TIME 15
-#define smul_ppmm(ph, pl, m0, m1) \
- do { \
- SItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("mulhw %0,%1,%2" \
- : "=r" ((SItype) ph) \
- : "%r" (__m0), \
- "r" (__m1)); \
- (pl) = __m0 * __m1; \
- } while (0)
-#define SMUL_TIME 14
-#define UDIV_TIME 120
-#else
-#define umul_ppmm(xh, xl, m0, m1) \
- do { \
- USItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("mul %0,%2,%3" \
- : "=r" ((USItype) (xh)), \
- "=q" ((USItype) (xl)) \
- : "r" (__m0), \
- "r" (__m1)); \
- (xh) += ((((SItype) __m0 >> 31) & __m1) \
- + (((SItype) __m1 >> 31) & __m0)); \
- } while (0)
-#define UMUL_TIME 8
-#define smul_ppmm(xh, xl, m0, m1) \
- __asm__ ("mul %0,%2,%3" \
- : "=r" ((SItype) (xh)), \
- "=q" ((SItype) (xl)) \
- : "r" (m0), \
- "r" (m1))
-#define SMUL_TIME 4
-#define sdiv_qrnnd(q, r, nh, nl, d) \
- __asm__ ("div %0,%2,%4" \
- : "=r" ((SItype) (q)), "=q" ((SItype) (r)) \
- : "r" ((SItype) (nh)), "1" ((SItype) (nl)), "r" ((SItype) (d)))
-#define UDIV_TIME 100
-#endif
-#endif /* Power architecture variants. */
-
-#if defined (__pyr__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addw %5,%1
- addwc %3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subw %5,%1
- subwb %3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-/* This insn works on Pyramids with AP, XP, or MI CPUs, but not with SP. */
-#define umul_ppmm(w1, w0, u, v) \
- ({union {UDItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __xx; \
- __asm__ ("movw %1,%R0
- uemul %2,%0" \
- : "=&r" (__xx.__ll) \
- : "g" ((USItype) (u)), \
- "g" ((USItype) (v))); \
- (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})
-#endif /* __pyr__ */
-
-#if defined (__ibm032__) /* RT/ROMP */
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("a %1,%5
- ae %0,%3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "r" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("s %1,%5
- se %0,%3" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "r" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "r" ((USItype) (bl)))
-#define umul_ppmm(ph, pl, m0, m1) \
- do { \
- USItype __m0 = (m0), __m1 = (m1); \
- __asm__ ( \
- "s r2,r2
- mts r10,%2
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- m r2,%3
- cas %0,r2,r0
- mfs r10,%1" \
- : "=r" ((USItype) (ph)), \
- "=r" ((USItype) (pl)) \
- : "%r" (__m0), \
- "r" (__m1) \
- : "r2"); \
- (ph) += ((((SItype) __m0 >> 31) & __m1) \
- + (((SItype) __m1 >> 31) & __m0)); \
- } while (0)
-#define UMUL_TIME 20
-#define UDIV_TIME 200
-#define count_leading_zeros(count, x) \
- do { \
- if ((x) >= 0x10000) \
- __asm__ ("clz %0,%1" \
- : "=r" ((USItype) (count)) \
- : "r" ((USItype) (x) >> 16)); \
- else \
- { \
- __asm__ ("clz %0,%1" \
- : "=r" ((USItype) (count)) \
- : "r" ((USItype) (x))); \
- (count) += 16; \
- } \
- } while (0)
-#endif
-
-#if defined (__sparc__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addcc %r4,%5,%1
- addx %r2,%3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "%rJ" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "%rJ" ((USItype) (al)), \
- "rI" ((USItype) (bl)) \
- __CLOBBER_CC)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subcc %r4,%5,%1
- subx %r2,%3,%0" \
- : "=r" ((USItype) (sh)), \
- "=&r" ((USItype) (sl)) \
- : "rJ" ((USItype) (ah)), \
- "rI" ((USItype) (bh)), \
- "rJ" ((USItype) (al)), \
- "rI" ((USItype) (bl)) \
- __CLOBBER_CC)
-#if defined (__sparc_v8__)
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("umul %2,%3,%1;rd %%y,%0" \
- : "=r" ((USItype) (w1)), \
- "=r" ((USItype) (w0)) \
- : "r" ((USItype) (u)), \
- "r" ((USItype) (v)))
-#define udiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("mov %2,%%y;nop;nop;nop;udiv %3,%4,%0;umul %0,%4,%1;sub %3,%1,%1"\
- : "=&r" ((USItype) (q)), \
- "=&r" ((USItype) (r)) \
- : "r" ((USItype) (n1)), \
- "r" ((USItype) (n0)), \
- "r" ((USItype) (d)))
-#else
-#if defined (__sparclite__)
-/* This has hardware multiply but not divide. It also has two additional
- instructions scan (ffs from high bit) and divscc. */
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("umul %2,%3,%1;rd %%y,%0" \
- : "=r" ((USItype) (w1)), \
- "=r" ((USItype) (w0)) \
- : "r" ((USItype) (u)), \
- "r" ((USItype) (v)))
-#define udiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("! Inlined udiv_qrnnd
- wr %%g0,%2,%%y ! Not a delayed write for sparclite
- tst %%g0
- divscc %3,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%%g1
- divscc %%g1,%4,%0
- rd %%y,%1
- bl,a 1f
- add %1,%4,%1
-1: ! End of inline udiv_qrnnd" \
- : "=r" ((USItype) (q)), \
- "=r" ((USItype) (r)) \
- : "r" ((USItype) (n1)), \
- "r" ((USItype) (n0)), \
- "rI" ((USItype) (d)) \
- : "%g1" __AND_CLOBBER_CC)
-#define UDIV_TIME 37
-#define count_leading_zeros(count, x) \
- __asm__ ("scan %1,0,%0" \
- : "=r" ((USItype) (x)) \
- : "r" ((USItype) (count)))
-#else
-/* SPARC without integer multiplication and divide instructions.
- (i.e. at least Sun4/20,40,60,65,75,110,260,280,330,360,380,470,490) */
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("! Inlined umul_ppmm
- wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr
- sra %3,31,%%g2 ! Don't move this insn
- and %2,%%g2,%%g2 ! Don't move this insn
- andcc %%g0,0,%%g1 ! Don't move this insn
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,%3,%%g1
- mulscc %%g1,0,%%g1
- add %%g1,%%g2,%0
- rd %%y,%1" \
- : "=r" ((USItype) (w1)), \
- "=r" ((USItype) (w0)) \
- : "%rI" ((USItype) (u)), \
- "r" ((USItype) (v)) \
- : "%g1", "%g2" __AND_CLOBBER_CC)
-#define UMUL_TIME 39 /* 39 instructions */
-/* It's quite necessary to add this much assembler for the sparc.
- The default udiv_qrnnd (in C) is more than 10 times slower! */
-#define udiv_qrnnd(q, r, n1, n0, d) \
- __asm__ ("! Inlined udiv_qrnnd
- mov 32,%%g1
- subcc %1,%2,%%g0
-1: bcs 5f
- addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb
- sub %1,%2,%1 ! this kills msb of n
- addx %1,%1,%1 ! so this can't give carry
- subcc %%g1,1,%%g1
-2: bne 1b
- subcc %1,%2,%%g0
- bcs 3f
- addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb
- b 3f
- sub %1,%2,%1 ! this kills msb of n
-4: sub %1,%2,%1
-5: addxcc %1,%1,%1
- bcc 2b
- subcc %%g1,1,%%g1
-! Got carry from n. Subtract next step to cancel this carry.
- bne 4b
- addcc %0,%0,%0 ! shift n1n0 and a 0-bit in lsb
- sub %1,%2,%1
-3: xnor %0,0,%0
- ! End of inline udiv_qrnnd" \
- : "=&r" ((USItype) (q)), \
- "=&r" ((USItype) (r)) \
- : "r" ((USItype) (d)), \
- "1" ((USItype) (n1)), \
- "0" ((USItype) (n0)) : "%g1" __AND_CLOBBER_CC)
-#define UDIV_TIME (3+7*32) /* 7 instructions/iteration. 32 iterations. */
-#endif /* __sparclite__ */
-#endif /* __sparc_v8__ */
-#endif /* __sparc__ */
-
-#if defined (__vax__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addl2 %5,%1
- adwc %3,%0" \
- : "=g" ((USItype) (sh)), \
- "=&g" ((USItype) (sl)) \
- : "%0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "%1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subl2 %5,%1
- sbwc %3,%0" \
- : "=g" ((USItype) (sh)), \
- "=&g" ((USItype) (sl)) \
- : "0" ((USItype) (ah)), \
- "g" ((USItype) (bh)), \
- "1" ((USItype) (al)), \
- "g" ((USItype) (bl)))
-#define umul_ppmm(xh, xl, m0, m1) \
- do { \
- union { \
- UDItype __ll; \
- struct {USItype __l, __h;} __i; \
- } __xx; \
- USItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("emul %1,%2,$0,%0" \
- : "=r" (__xx.__ll) \
- : "g" (__m0), \
- "g" (__m1)); \
- (xh) = __xx.__i.__h; \
- (xl) = __xx.__i.__l; \
- (xh) += ((((SItype) __m0 >> 31) & __m1) \
- + (((SItype) __m1 >> 31) & __m0)); \
- } while (0)
-#define sdiv_qrnnd(q, r, n1, n0, d) \
- do { \
- union {DItype __ll; \
- struct {SItype __l, __h;} __i; \
- } __xx; \
- __xx.__i.__h = n1; __xx.__i.__l = n0; \
- __asm__ ("ediv %3,%2,%0,%1" \
- : "=g" (q), "=g" (r) \
- : "g" (__xx.__ll), "g" (d)); \
- } while (0)
-#endif /* __vax__ */
-
-#endif /* __GNUC__ */
-
-/* If this machine has no inline assembler, use C macros. */
-
-#if !defined (add_ssaaaa)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
- USItype __x; \
- __x = (al) + (bl); \
- (sh) = (ah) + (bh) + (__x < (al)); \
- (sl) = __x; \
- } while (0)
-#endif
-
-#if !defined (sub_ddmmss)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- USItype __x; \
- __x = (al) - (bl); \
- (sh) = (ah) - (bh) - (__x > (al)); \
- (sl) = __x; \
- } while (0)
-#endif
-
-#if !defined (umul_ppmm)
-#define umul_ppmm(w1, w0, u, v) \
- do { \
- USItype __x0, __x1, __x2, __x3; \
- USItype __ul, __vl, __uh, __vh; \
- \
- __ul = __ll_lowpart (u); \
- __uh = __ll_highpart (u); \
- __vl = __ll_lowpart (v); \
- __vh = __ll_highpart (v); \
- \
- __x0 = (USItype) __ul * __vl; \
- __x1 = (USItype) __ul * __vh; \
- __x2 = (USItype) __uh * __vl; \
- __x3 = (USItype) __uh * __vh; \
- \
- __x1 += __ll_highpart (__x0);/* this can't give carry */ \
- __x1 += __x2; /* but this indeed can */ \
- if (__x1 < __x2) /* did we get it? */ \
- __x3 += __ll_B; /* yes, add it in the proper pos. */ \
- \
- (w1) = __x3 + __ll_highpart (__x1); \
- (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \
- } while (0)
-#endif
-
-#if !defined (__umulsidi3)
-#define __umulsidi3(u, v) \
- ({DIunion __w; \
- umul_ppmm (__w.s.high, __w.s.low, u, v); \
- __w.ll; })
-#endif
-
-/* Define this unconditionally, so it can be used for debugging. */
-#define __udiv_qrnnd_c(q, r, n1, n0, d) \
- do { \
- USItype __d1, __d0, __q1, __q0; \
- USItype __r1, __r0, __m; \
- __d1 = __ll_highpart (d); \
- __d0 = __ll_lowpart (d); \
- \
- __r1 = (n1) % __d1; \
- __q1 = (n1) / __d1; \
- __m = (USItype) __q1 * __d0; \
- __r1 = __r1 * __ll_B | __ll_highpart (n0); \
- if (__r1 < __m) \
- { \
- __q1--, __r1 += (d); \
- if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\
- if (__r1 < __m) \
- __q1--, __r1 += (d); \
- } \
- __r1 -= __m; \
- \
- __r0 = __r1 % __d1; \
- __q0 = __r1 / __d1; \
- __m = (USItype) __q0 * __d0; \
- __r0 = __r0 * __ll_B | __ll_lowpart (n0); \
- if (__r0 < __m) \
- { \
- __q0--, __r0 += (d); \
- if (__r0 >= (d)) \
- if (__r0 < __m) \
- __q0--, __r0 += (d); \
- } \
- __r0 -= __m; \
- \
- (q) = (USItype) __q1 * __ll_B | __q0; \
- (r) = __r0; \
- } while (0)
-
-/* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through
- __udiv_w_sdiv (defined in libgcc or elsewhere). */
-#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd)
-#define udiv_qrnnd(q, r, nh, nl, d) \
- do { \
- USItype __r; \
- (q) = __udiv_w_sdiv (&__r, nh, nl, d); \
- (r) = __r; \
- } while (0)
-#endif
-
-/* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */
-#if !defined (udiv_qrnnd)
-#define UDIV_NEEDS_NORMALIZATION 1
-#define udiv_qrnnd __udiv_qrnnd_c
-#endif
-
-#if !defined (count_leading_zeros)
-extern const UQItype __clz_tab[];
-#define count_leading_zeros(count, x) \
- do { \
- USItype __xr = (x); \
- USItype __a; \
- \
- if (SI_TYPE_SIZE <= 32) \
- { \
- __a = __xr < (1<<2*__BITS4) \
- ? (__xr < (1<<__BITS4) ? 0 : __BITS4) \
- : (__xr < (1<<3*__BITS4) ? 2*__BITS4 : 3*__BITS4); \
- } \
- else \
- { \
- for (__a = SI_TYPE_SIZE - 8; __a > 0; __a -= 8) \
- if (((__xr >> __a) & 0xff) != 0) \
- break; \
- } \
- \
- (count) = SI_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a); \
- } while (0)
-#endif
-
-#ifndef UDIV_NEEDS_NORMALIZATION
-#define UDIV_NEEDS_NORMALIZATION 0
-#endif
diff --git a/gcc/loop.c b/gcc/loop.c
deleted file mode 100644
index 3e7bb58e3e3..00000000000
--- a/gcc/loop.c
+++ /dev/null
@@ -1,6923 +0,0 @@
-/* Perform various loop optimizations, including strength reduction.
- Copyright (C) 1987, 88, 89, 91-6, 1997 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 loop optimization pass of the compiler.
- It finds invariant computations within loops and moves them
- to the beginning of the loop. Then it identifies basic and
- general induction variables. Strength reduction is applied to the general
- induction variables, and induction variable elimination is applied to
- the basic induction variables.
-
- It also finds cases where
- a register is set within the loop by zero-extending a narrower value
- and changes these to zero the entire register once before the loop
- and merely copy the low part within the loop.
-
- Most of the complexity is in heuristics to decide when it is worth
- while to do these things. */
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "obstack.h"
-#include "expr.h"
-#include "insn-config.h"
-#include "insn-flags.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "recog.h"
-#include "flags.h"
-#include "real.h"
-#include "loop.h"
-#include "except.h"
-
-/* Vector mapping INSN_UIDs to luids.
- The luids are like uids but increase monotonically always.
- We use them to see whether a jump comes from outside a given loop. */
-
-int *uid_luid;
-
-/* Indexed by INSN_UID, contains the ordinal giving the (innermost) loop
- number the insn is contained in. */
-
-int *uid_loop_num;
-
-/* 1 + largest uid of any insn. */
-
-int max_uid_for_loop;
-
-/* 1 + luid of last insn. */
-
-static int max_luid;
-
-/* Number of loops detected in current function. Used as index to the
- next few tables. */
-
-static int max_loop_num;
-
-/* Indexed by loop number, contains the first and last insn of each loop. */
-
-static rtx *loop_number_loop_starts, *loop_number_loop_ends;
-
-/* For each loop, gives the containing loop number, -1 if none. */
-
-int *loop_outer_loop;
-
-/* Indexed by loop number, contains a nonzero value if the "loop" isn't
- really a loop (an insn outside the loop branches into it). */
-
-static char *loop_invalid;
-
-/* Indexed by loop number, links together all LABEL_REFs which refer to
- code labels outside the loop. Used by routines that need to know all
- loop exits, such as final_biv_value and final_giv_value.
-
- This does not include loop exits due to return instructions. This is
- because all bivs and givs are pseudos, and hence must be dead after a
- return, so the presense of a return does not affect any of the
- optimizations that use this info. It is simpler to just not include return
- instructions on this list. */
-
-rtx *loop_number_exit_labels;
-
-/* Indexed by loop number, counts the number of LABEL_REFs on
- loop_number_exit_labels for this loop and all loops nested inside it. */
-
-int *loop_number_exit_count;
-
-/* Holds the number of loop iterations. It is zero if the number could not be
- calculated. Must be unsigned since the number of iterations can
- be as high as 2^wordsize-1. For loops with a wider iterator, this number
- will will be zero if the number of loop iterations is too large for an
- unsigned integer to hold. */
-
-unsigned HOST_WIDE_INT loop_n_iterations;
-
-/* Nonzero if there is a subroutine call in the current loop.
- (unknown_address_altered is also nonzero in this case.) */
-
-static int loop_has_call;
-
-/* Nonzero if there is a volatile memory reference in the current
- loop. */
-
-static int loop_has_volatile;
-
-/* Added loop_continue which is the NOTE_INSN_LOOP_CONT of the
- current loop. A continue statement will generate a branch to
- NEXT_INSN (loop_continue). */
-
-static rtx loop_continue;
-
-/* Indexed by register number, contains the number of times the reg
- is set during the loop being scanned.
- During code motion, a negative value indicates a reg that has been
- made a candidate; in particular -2 means that it is an candidate that
- we know is equal to a constant and -1 means that it is an candidate
- not known equal to a constant.
- After code motion, regs moved have 0 (which is accurate now)
- while the failed candidates have the original number of times set.
-
- Therefore, at all times, == 0 indicates an invariant register;
- < 0 a conditionally invariant one. */
-
-static short *n_times_set;
-
-/* Original value of n_times_set; same except that this value
- is not set negative for a reg whose sets have been made candidates
- and not set to 0 for a reg that is moved. */
-
-static short *n_times_used;
-
-/* Index by register number, 1 indicates that the register
- cannot be moved or strength reduced. */
-
-static char *may_not_optimize;
-
-/* Nonzero means reg N has already been moved out of one loop.
- This reduces the desire to move it out of another. */
-
-static char *moved_once;
-
-/* Array of MEMs that are stored in this loop. If there are too many to fit
- here, we just turn on unknown_address_altered. */
-
-#define NUM_STORES 20
-static rtx loop_store_mems[NUM_STORES];
-
-/* Index of first available slot in above array. */
-static int loop_store_mems_idx;
-
-/* Nonzero if we don't know what MEMs were changed in the current loop.
- This happens if the loop contains a call (in which case `loop_has_call'
- will also be set) or if we store into more than NUM_STORES MEMs. */
-
-static int unknown_address_altered;
-
-/* Count of movable (i.e. invariant) instructions discovered in the loop. */
-static int num_movables;
-
-/* Count of memory write instructions discovered in the loop. */
-static int num_mem_sets;
-
-/* Number of loops contained within the current one, including itself. */
-static int loops_enclosed;
-
-/* Bound on pseudo register number before loop optimization.
- A pseudo has valid regscan info if its number is < max_reg_before_loop. */
-int max_reg_before_loop;
-
-/* This obstack is used in product_cheap_p to allocate its rtl. It
- may call gen_reg_rtx which, in turn, may reallocate regno_reg_rtx.
- If we used the same obstack that it did, we would be deallocating
- that array. */
-
-static struct obstack temp_obstack;
-
-/* This is where the pointer to the obstack being used for RTL is stored. */
-
-extern struct obstack *rtl_obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-extern char *oballoc ();
-
-/* During the analysis of a loop, a chain of `struct movable's
- is made to record all the movable insns found.
- Then the entire chain can be scanned to decide which to move. */
-
-struct movable
-{
- rtx insn; /* A movable insn */
- rtx set_src; /* The expression this reg is set from. */
- rtx set_dest; /* The destination of this SET. */
- rtx dependencies; /* When INSN is libcall, this is an EXPR_LIST
- of any registers used within the LIBCALL. */
- int consec; /* Number of consecutive following insns
- that must be moved with this one. */
- int regno; /* The register it sets */
- short lifetime; /* lifetime of that register;
- may be adjusted when matching movables
- that load the same value are found. */
- short savings; /* Number of insns we can move for this reg,
- including other movables that force this
- or match this one. */
- unsigned int cond : 1; /* 1 if only conditionally movable */
- unsigned int force : 1; /* 1 means MUST move this insn */
- unsigned int global : 1; /* 1 means reg is live outside this loop */
- /* If PARTIAL is 1, GLOBAL means something different:
- that the reg is live outside the range from where it is set
- to the following label. */
- unsigned int done : 1; /* 1 inhibits further processing of this */
-
- unsigned int partial : 1; /* 1 means this reg is used for zero-extending.
- In particular, moving it does not make it
- invariant. */
- unsigned int move_insn : 1; /* 1 means that we call emit_move_insn to
- load SRC, rather than copying INSN. */
- unsigned int is_equiv : 1; /* 1 means a REG_EQUIV is present on INSN. */
- enum machine_mode savemode; /* Nonzero means it is a mode for a low part
- that we should avoid changing when clearing
- the rest of the reg. */
- struct movable *match; /* First entry for same value */
- struct movable *forces; /* An insn that must be moved if this is */
- struct movable *next;
-};
-
-FILE *loop_dump_stream;
-
-/* Forward declarations. */
-
-static void find_and_verify_loops ();
-static void mark_loop_jump ();
-static void prescan_loop ();
-static int reg_in_basic_block_p ();
-static int consec_sets_invariant_p ();
-static rtx libcall_other_reg ();
-static int labels_in_range_p ();
-static void count_loop_regs_set ();
-static void note_addr_stored ();
-static int loop_reg_used_before_p ();
-static void scan_loop ();
-static void replace_call_address ();
-static rtx skip_consec_insns ();
-static int libcall_benefit ();
-static void ignore_some_movables ();
-static void force_movables ();
-static void combine_movables ();
-static int rtx_equal_for_loop_p ();
-static void move_movables ();
-static void strength_reduce ();
-static int valid_initial_value_p ();
-static void find_mem_givs ();
-static void record_biv ();
-static void check_final_value ();
-static void record_giv ();
-static void update_giv_derive ();
-static int basic_induction_var ();
-static rtx simplify_giv_expr ();
-static int general_induction_var ();
-static int consec_sets_giv ();
-static int check_dbra_loop ();
-static rtx express_from ();
-static int combine_givs_p ();
-static void combine_givs ();
-static int product_cheap_p ();
-static int maybe_eliminate_biv ();
-static int maybe_eliminate_biv_1 ();
-static int last_use_this_basic_block ();
-static void record_initial ();
-static void update_reg_last_use ();
-
-/* Relative gain of eliminating various kinds of operations. */
-int add_cost;
-#if 0
-int shift_cost;
-int mult_cost;
-#endif
-
-/* Benefit penalty, if a giv is not replaceable, i.e. must emit an insn to
- copy the value of the strength reduced giv to its original register. */
-int copy_cost;
-
-void
-init_loop ()
-{
- char *free_point = (char *) oballoc (1);
- rtx reg = gen_rtx (REG, word_mode, LAST_VIRTUAL_REGISTER + 1);
-
- add_cost = rtx_cost (gen_rtx (PLUS, word_mode, reg, reg), SET);
-
- /* We multiply by 2 to reconcile the difference in scale between
- these two ways of computing costs. Otherwise the cost of a copy
- will be far less than the cost of an add. */
-
- copy_cost = 2 * 2;
-
- /* Free the objects we just allocated. */
- obfree (free_point);
-
- /* Initialize the obstack used for rtl in product_cheap_p. */
- gcc_obstack_init (&temp_obstack);
-}
-
-/* Entry point of this file. Perform loop optimization
- on the current function. F is the first insn of the function
- and DUMPFILE is a stream for output of a trace of actions taken
- (or 0 if none should be output). */
-
-void
-loop_optimize (f, dumpfile)
- /* f is the first instruction of a chain of insns for one function */
- rtx f;
- FILE *dumpfile;
-{
- register rtx insn;
- register int i;
- rtx last_insn;
-
- loop_dump_stream = dumpfile;
-
- init_recog_no_volatile ();
- init_alias_analysis ();
-
- max_reg_before_loop = max_reg_num ();
-
- moved_once = (char *) alloca (max_reg_before_loop);
- bzero (moved_once, max_reg_before_loop);
-
- regs_may_share = 0;
-
- /* Count the number of loops. */
-
- max_loop_num = 0;
- for (insn = f; insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- max_loop_num++;
- }
-
- /* Don't waste time if no loops. */
- if (max_loop_num == 0)
- return;
-
- /* Get size to use for tables indexed by uids.
- Leave some space for labels allocated by find_and_verify_loops. */
- max_uid_for_loop = get_max_uid () + 1 + max_loop_num * 32;
-
- uid_luid = (int *) alloca (max_uid_for_loop * sizeof (int));
- uid_loop_num = (int *) alloca (max_uid_for_loop * sizeof (int));
-
- bzero ((char *) uid_luid, max_uid_for_loop * sizeof (int));
- bzero ((char *) uid_loop_num, max_uid_for_loop * sizeof (int));
-
- /* Allocate tables for recording each loop. We set each entry, so they need
- not be zeroed. */
- loop_number_loop_starts = (rtx *) alloca (max_loop_num * sizeof (rtx));
- loop_number_loop_ends = (rtx *) alloca (max_loop_num * sizeof (rtx));
- loop_outer_loop = (int *) alloca (max_loop_num * sizeof (int));
- loop_invalid = (char *) alloca (max_loop_num * sizeof (char));
- loop_number_exit_labels = (rtx *) alloca (max_loop_num * sizeof (rtx));
- loop_number_exit_count = (int *) alloca (max_loop_num * sizeof (int));
-
- /* Find and process each loop.
- First, find them, and record them in order of their beginnings. */
- find_and_verify_loops (f);
-
- /* Now find all register lifetimes. This must be done after
- find_and_verify_loops, because it might reorder the insns in the
- function. */
- reg_scan (f, max_reg_num (), 1);
-
- /* See if we went too far. */
- if (get_max_uid () > max_uid_for_loop)
- abort ();
-
- /* Compute the mapping from uids to luids.
- LUIDs are numbers assigned to insns, like uids,
- except that luids increase monotonically through the code.
- Don't assign luids to line-number NOTEs, so that the distance in luids
- between two insns is not affected by -g. */
-
- for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
- {
- last_insn = insn;
- if (GET_CODE (insn) != NOTE
- || NOTE_LINE_NUMBER (insn) <= 0)
- uid_luid[INSN_UID (insn)] = ++i;
- else
- /* Give a line number note the same luid as preceding insn. */
- uid_luid[INSN_UID (insn)] = i;
- }
-
- max_luid = i + 1;
-
- /* Don't leave gaps in uid_luid for insns that have been
- deleted. It is possible that the first or last insn
- using some register has been deleted by cross-jumping.
- Make sure that uid_luid for that former insn's uid
- points to the general area where that insn used to be. */
- for (i = 0; i < max_uid_for_loop; i++)
- {
- uid_luid[0] = uid_luid[i];
- if (uid_luid[0] != 0)
- break;
- }
- for (i = 0; i < max_uid_for_loop; i++)
- if (uid_luid[i] == 0)
- uid_luid[i] = uid_luid[i - 1];
-
- /* Create a mapping from loops to BLOCK tree nodes. */
- if (flag_unroll_loops && write_symbols != NO_DEBUG)
- find_loop_tree_blocks ();
-
- /* Now scan the loops, last ones first, since this means inner ones are done
- before outer ones. */
- for (i = max_loop_num-1; i >= 0; i--)
- if (! loop_invalid[i] && loop_number_loop_ends[i])
- scan_loop (loop_number_loop_starts[i], loop_number_loop_ends[i],
- max_reg_num ());
-
- /* If debugging and unrolling loops, we must replicate the tree nodes
- corresponding to the blocks inside the loop, so that the original one
- to one mapping will remain. */
- if (flag_unroll_loops && write_symbols != NO_DEBUG)
- unroll_block_trees ();
-}
-
-/* Optimize one loop whose start is LOOP_START and end is END.
- LOOP_START is the NOTE_INSN_LOOP_BEG and END is the matching
- NOTE_INSN_LOOP_END. */
-
-/* ??? Could also move memory writes out of loops if the destination address
- is invariant, the source is invariant, the memory write is not volatile,
- and if we can prove that no read inside the loop can read this address
- before the write occurs. If there is a read of this address after the
- write, then we can also mark the memory read as invariant. */
-
-static void
-scan_loop (loop_start, end, nregs)
- rtx loop_start, end;
- int nregs;
-{
- register int i;
- register rtx p;
- /* 1 if we are scanning insns that could be executed zero times. */
- int maybe_never = 0;
- /* 1 if we are scanning insns that might never be executed
- due to a subroutine call which might exit before they are reached. */
- int call_passed = 0;
- /* For a rotated loop that is entered near the bottom,
- this is the label at the top. Otherwise it is zero. */
- rtx loop_top = 0;
- /* Jump insn that enters the loop, or 0 if control drops in. */
- rtx loop_entry_jump = 0;
- /* Place in the loop where control enters. */
- rtx scan_start;
- /* Number of insns in the loop. */
- int insn_count;
- int in_libcall = 0;
- int tem;
- rtx temp;
- /* The SET from an insn, if it is the only SET in the insn. */
- rtx set, set1;
- /* Chain describing insns movable in current loop. */
- struct movable *movables = 0;
- /* Last element in `movables' -- so we can add elements at the end. */
- struct movable *last_movable = 0;
- /* Ratio of extra register life span we can justify
- for saving an instruction. More if loop doesn't call subroutines
- since in that case saving an insn makes more difference
- and more registers are available. */
- int threshold;
- /* If we have calls, contains the insn in which a register was used
- if it was used exactly once; contains const0_rtx if it was used more
- than once. */
- rtx *reg_single_usage = 0;
- /* Nonzero if we are scanning instructions in a sub-loop. */
- int loop_depth = 0;
-
- n_times_set = (short *) alloca (nregs * sizeof (short));
- n_times_used = (short *) alloca (nregs * sizeof (short));
- may_not_optimize = (char *) alloca (nregs);
-
- /* Determine whether this loop starts with a jump down to a test at
- the end. This will occur for a small number of loops with a test
- that is too complex to duplicate in front of the loop.
-
- We search for the first insn or label in the loop, skipping NOTEs.
- However, we must be careful not to skip past a NOTE_INSN_LOOP_BEG
- (because we might have a loop executed only once that contains a
- loop which starts with a jump to its exit test) or a NOTE_INSN_LOOP_END
- (in case we have a degenerate loop).
-
- Note that if we mistakenly think that a loop is entered at the top
- when, in fact, it is entered at the exit test, the only effect will be
- slightly poorer optimization. Making the opposite error can generate
- incorrect code. Since very few loops now start with a jump to the
- exit test, the code here to detect that case is very conservative. */
-
- for (p = NEXT_INSN (loop_start);
- p != end
- && GET_CODE (p) != CODE_LABEL && GET_RTX_CLASS (GET_CODE (p)) != 'i'
- && (GET_CODE (p) != NOTE
- || (NOTE_LINE_NUMBER (p) != NOTE_INSN_LOOP_BEG
- && NOTE_LINE_NUMBER (p) != NOTE_INSN_LOOP_END));
- p = NEXT_INSN (p))
- ;
-
- scan_start = p;
-
- /* Set up variables describing this loop. */
- prescan_loop (loop_start, end);
- threshold = (loop_has_call ? 1 : 2) * (1 + n_non_fixed_regs);
-
- /* If loop has a jump before the first label,
- the true entry is the target of that jump.
- Start scan from there.
- But record in LOOP_TOP the place where the end-test jumps
- back to so we can scan that after the end of the loop. */
- if (GET_CODE (p) == JUMP_INSN)
- {
- loop_entry_jump = p;
-
- /* Loop entry must be unconditional jump (and not a RETURN) */
- if (simplejump_p (p)
- && JUMP_LABEL (p) != 0
- /* Check to see whether the jump actually
- jumps out of the loop (meaning it's no loop).
- This case can happen for things like
- do {..} while (0). If this label was generated previously
- by loop, we can't tell anything about it and have to reject
- the loop. */
- && INSN_UID (JUMP_LABEL (p)) < max_uid_for_loop
- && INSN_LUID (JUMP_LABEL (p)) >= INSN_LUID (loop_start)
- && INSN_LUID (JUMP_LABEL (p)) < INSN_LUID (end))
- {
- loop_top = next_label (scan_start);
- scan_start = JUMP_LABEL (p);
- }
- }
-
- /* If SCAN_START was an insn created by loop, we don't know its luid
- as required by loop_reg_used_before_p. So skip such loops. (This
- test may never be true, but it's best to play it safe.)
-
- Also, skip loops where we do not start scanning at a label. This
- test also rejects loops starting with a JUMP_INSN that failed the
- test above. */
-
- if (INSN_UID (scan_start) >= max_uid_for_loop
- || GET_CODE (scan_start) != CODE_LABEL)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "\nLoop from %d to %d is phony.\n\n",
- INSN_UID (loop_start), INSN_UID (end));
- return;
- }
-
- /* Count number of times each reg is set during this loop.
- Set may_not_optimize[I] if it is not safe to move out
- the setting of register I. If this loop has calls, set
- reg_single_usage[I]. */
-
- bzero ((char *) n_times_set, nregs * sizeof (short));
- bzero (may_not_optimize, nregs);
-
- if (loop_has_call)
- {
- reg_single_usage = (rtx *) alloca (nregs * sizeof (rtx));
- bzero ((char *) reg_single_usage, nregs * sizeof (rtx));
- }
-
- count_loop_regs_set (loop_top ? loop_top : loop_start, end,
- may_not_optimize, reg_single_usage, &insn_count, nregs);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- may_not_optimize[i] = 1, n_times_set[i] = 1;
- bcopy ((char *) n_times_set, (char *) n_times_used, nregs * sizeof (short));
-
- if (loop_dump_stream)
- {
- fprintf (loop_dump_stream, "\nLoop from %d to %d: %d real insns.\n",
- INSN_UID (loop_start), INSN_UID (end), insn_count);
- if (loop_continue)
- fprintf (loop_dump_stream, "Continue at insn %d.\n",
- INSN_UID (loop_continue));
- }
-
- /* Scan through the loop finding insns that are safe to move.
- Set n_times_set negative for the reg being set, so that
- this reg will be considered invariant for subsequent insns.
- We consider whether subsequent insns use the reg
- in deciding whether it is worth actually moving.
-
- MAYBE_NEVER is nonzero if we have passed a conditional jump insn
- and therefore it is possible that the insns we are scanning
- would never be executed. At such times, we must make sure
- that it is safe to execute the insn once instead of zero times.
- When MAYBE_NEVER is 0, all insns will be executed at least once
- so that is not a problem. */
-
- p = scan_start;
- while (1)
- {
- p = NEXT_INSN (p);
- /* At end of a straight-in loop, we are done.
- At end of a loop entered at the bottom, scan the top. */
- if (p == scan_start)
- break;
- if (p == end)
- {
- if (loop_top != 0)
- p = loop_top;
- else
- break;
- if (p == scan_start)
- break;
- }
-
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
- && find_reg_note (p, REG_LIBCALL, NULL_RTX))
- in_libcall = 1;
- else if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
- && find_reg_note (p, REG_RETVAL, NULL_RTX))
- in_libcall = 0;
-
- if (GET_CODE (p) == INSN
- && (set = single_set (p))
- && GET_CODE (SET_DEST (set)) == REG
- && ! may_not_optimize[REGNO (SET_DEST (set))])
- {
- int tem1 = 0;
- int tem2 = 0;
- int move_insn = 0;
- rtx src = SET_SRC (set);
- rtx dependencies = 0;
-
- /* Figure out what to use as a source of this insn. If a REG_EQUIV
- note is given or if a REG_EQUAL note with a constant operand is
- specified, use it as the source and mark that we should move
- this insn by calling emit_move_insn rather that duplicating the
- insn.
-
- Otherwise, only use the REG_EQUAL contents if a REG_RETVAL note
- is present. */
- temp = find_reg_note (p, REG_EQUIV, NULL_RTX);
- if (temp)
- src = XEXP (temp, 0), move_insn = 1;
- else
- {
- temp = find_reg_note (p, REG_EQUAL, NULL_RTX);
- if (temp && CONSTANT_P (XEXP (temp, 0)))
- src = XEXP (temp, 0), move_insn = 1;
- if (temp && find_reg_note (p, REG_RETVAL, NULL_RTX))
- {
- src = XEXP (temp, 0);
- /* A libcall block can use regs that don't appear in
- the equivalent expression. To move the libcall,
- we must move those regs too. */
- dependencies = libcall_other_reg (p, src);
- }
- }
-
- /* Don't try to optimize a register that was made
- by loop-optimization for an inner loop.
- We don't know its life-span, so we can't compute the benefit. */
- if (REGNO (SET_DEST (set)) >= max_reg_before_loop)
- ;
- /* In order to move a register, we need to have one of three cases:
- (1) it is used only in the same basic block as the set
- (2) it is not a user variable and it is not used in the
- exit test (this can cause the variable to be used
- before it is set just like a user-variable).
- (3) the set is guaranteed to be executed once the loop starts,
- and the reg is not used until after that. */
- else if (! ((! maybe_never
- && ! loop_reg_used_before_p (set, p, loop_start,
- scan_start, end))
- || (! REG_USERVAR_P (SET_DEST (set))
- && ! REG_LOOP_TEST_P (SET_DEST (set)))
- || reg_in_basic_block_p (p, SET_DEST (set))))
- ;
- else if ((tem = invariant_p (src))
- && (dependencies == 0
- || (tem2 = invariant_p (dependencies)) != 0)
- && (n_times_set[REGNO (SET_DEST (set))] == 1
- || (tem1
- = consec_sets_invariant_p (SET_DEST (set),
- n_times_set[REGNO (SET_DEST (set))],
- p)))
- /* If the insn can cause a trap (such as divide by zero),
- can't move it unless it's guaranteed to be executed
- once loop is entered. Even a function call might
- prevent the trap insn from being reached
- (since it might exit!) */
- && ! ((maybe_never || call_passed)
- && may_trap_p (src)))
- {
- register struct movable *m;
- register int regno = REGNO (SET_DEST (set));
-
- /* A potential lossage is where we have a case where two insns
- can be combined as long as they are both in the loop, but
- we move one of them outside the loop. For large loops,
- this can lose. The most common case of this is the address
- of a function being called.
-
- Therefore, if this register is marked as being used exactly
- once if we are in a loop with calls (a "large loop"), see if
- we can replace the usage of this register with the source
- of this SET. If we can, delete this insn.
-
- Don't do this if P has a REG_RETVAL note or if we have
- SMALL_REGISTER_CLASSES and SET_SRC is a hard register. */
-
- if (reg_single_usage && reg_single_usage[regno] != 0
- && reg_single_usage[regno] != const0_rtx
- && regno_first_uid[regno] == INSN_UID (p)
- && (regno_last_uid[regno]
- == INSN_UID (reg_single_usage[regno]))
- && n_times_set[REGNO (SET_DEST (set))] == 1
- && ! side_effects_p (SET_SRC (set))
- && ! find_reg_note (p, REG_RETVAL, NULL_RTX)
-#ifdef SMALL_REGISTER_CLASSES
- && ! (SMALL_REGISTER_CLASSES
- && GET_CODE (SET_SRC (set)) == REG
- && REGNO (SET_SRC (set)) < FIRST_PSEUDO_REGISTER)
-#endif
- /* This test is not redundant; SET_SRC (set) might be
- a call-clobbered register and the life of REGNO
- might span a call. */
- && ! modified_between_p (SET_SRC (set), p,
- reg_single_usage[regno])
- && no_labels_between_p (p, reg_single_usage[regno])
- && validate_replace_rtx (SET_DEST (set), SET_SRC (set),
- reg_single_usage[regno]))
- {
- /* Replace any usage in a REG_EQUAL note. Must copy the
- new source, so that we don't get rtx sharing between the
- SET_SOURCE and REG_NOTES of insn p. */
- REG_NOTES (reg_single_usage[regno])
- = replace_rtx (REG_NOTES (reg_single_usage[regno]),
- SET_DEST (set), copy_rtx (SET_SRC (set)));
-
- PUT_CODE (p, NOTE);
- NOTE_LINE_NUMBER (p) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (p) = 0;
- n_times_set[regno] = 0;
- continue;
- }
-
- m = (struct movable *) alloca (sizeof (struct movable));
- m->next = 0;
- m->insn = p;
- m->set_src = src;
- m->dependencies = dependencies;
- m->set_dest = SET_DEST (set);
- m->force = 0;
- m->consec = n_times_set[REGNO (SET_DEST (set))] - 1;
- m->done = 0;
- m->forces = 0;
- m->partial = 0;
- m->move_insn = move_insn;
- m->is_equiv = (find_reg_note (p, REG_EQUIV, NULL_RTX) != 0);
- m->savemode = VOIDmode;
- m->regno = regno;
- /* Set M->cond if either invariant_p or consec_sets_invariant_p
- returned 2 (only conditionally invariant). */
- m->cond = ((tem | tem1 | tem2) > 1);
- m->global = (uid_luid[regno_last_uid[regno]] > INSN_LUID (end)
- || uid_luid[regno_first_uid[regno]] < INSN_LUID (loop_start));
- m->match = 0;
- m->lifetime = (uid_luid[regno_last_uid[regno]]
- - uid_luid[regno_first_uid[regno]]);
- m->savings = n_times_used[regno];
- if (find_reg_note (p, REG_RETVAL, NULL_RTX))
- m->savings += libcall_benefit (p);
- n_times_set[regno] = move_insn ? -2 : -1;
- /* Add M to the end of the chain MOVABLES. */
- if (movables == 0)
- movables = m;
- else
- last_movable->next = m;
- last_movable = m;
-
- if (m->consec > 0)
- {
- /* Skip this insn, not checking REG_LIBCALL notes. */
- p = next_nonnote_insn (p);
- /* Skip the consecutive insns, if there are any. */
- p = skip_consec_insns (p, m->consec);
- /* Back up to the last insn of the consecutive group. */
- p = prev_nonnote_insn (p);
-
- /* We must now reset m->move_insn, m->is_equiv, and possibly
- m->set_src to correspond to the effects of all the
- insns. */
- temp = find_reg_note (p, REG_EQUIV, NULL_RTX);
- if (temp)
- m->set_src = XEXP (temp, 0), m->move_insn = 1;
- else
- {
- temp = find_reg_note (p, REG_EQUAL, NULL_RTX);
- if (temp && CONSTANT_P (XEXP (temp, 0)))
- m->set_src = XEXP (temp, 0), m->move_insn = 1;
- else
- m->move_insn = 0;
-
- }
- m->is_equiv = (find_reg_note (p, REG_EQUIV, NULL_RTX) != 0);
- }
- }
- /* If this register is always set within a STRICT_LOW_PART
- or set to zero, then its high bytes are constant.
- So clear them outside the loop and within the loop
- just load the low bytes.
- We must check that the machine has an instruction to do so.
- Also, if the value loaded into the register
- depends on the same register, this cannot be done. */
- else if (SET_SRC (set) == const0_rtx
- && GET_CODE (NEXT_INSN (p)) == INSN
- && (set1 = single_set (NEXT_INSN (p)))
- && GET_CODE (set1) == SET
- && (GET_CODE (SET_DEST (set1)) == STRICT_LOW_PART)
- && (GET_CODE (XEXP (SET_DEST (set1), 0)) == SUBREG)
- && (SUBREG_REG (XEXP (SET_DEST (set1), 0))
- == SET_DEST (set))
- && !reg_mentioned_p (SET_DEST (set), SET_SRC (set1)))
- {
- register int regno = REGNO (SET_DEST (set));
- if (n_times_set[regno] == 2)
- {
- register struct movable *m;
- m = (struct movable *) alloca (sizeof (struct movable));
- m->next = 0;
- m->insn = p;
- m->set_dest = SET_DEST (set);
- m->dependencies = 0;
- m->force = 0;
- m->consec = 0;
- m->done = 0;
- m->forces = 0;
- m->move_insn = 0;
- m->partial = 1;
- /* If the insn may not be executed on some cycles,
- we can't clear the whole reg; clear just high part.
- Not even if the reg is used only within this loop.
- Consider this:
- while (1)
- while (s != t) {
- if (foo ()) x = *s;
- use (x);
- }
- Clearing x before the inner loop could clobber a value
- being saved from the last time around the outer loop.
- However, if the reg is not used outside this loop
- and all uses of the register are in the same
- basic block as the store, there is no problem.
-
- If this insn was made by loop, we don't know its
- INSN_LUID and hence must make a conservative
- assumption. */
- m->global = (INSN_UID (p) >= max_uid_for_loop
- || (uid_luid[regno_last_uid[regno]]
- > INSN_LUID (end))
- || (uid_luid[regno_first_uid[regno]]
- < INSN_LUID (p))
- || (labels_in_range_p
- (p, uid_luid[regno_first_uid[regno]])));
- if (maybe_never && m->global)
- m->savemode = GET_MODE (SET_SRC (set1));
- else
- m->savemode = VOIDmode;
- m->regno = regno;
- m->cond = 0;
- m->match = 0;
- m->lifetime = (uid_luid[regno_last_uid[regno]]
- - uid_luid[regno_first_uid[regno]]);
- m->savings = 1;
- n_times_set[regno] = -1;
- /* Add M to the end of the chain MOVABLES. */
- if (movables == 0)
- movables = m;
- else
- last_movable->next = m;
- last_movable = m;
- }
- }
- }
- /* Past a call insn, we get to insns which might not be executed
- because the call might exit. This matters for insns that trap.
- Call insns inside a REG_LIBCALL/REG_RETVAL block always return,
- so they don't count. */
- else if (GET_CODE (p) == CALL_INSN && ! in_libcall)
- call_passed = 1;
- /* Past a label or a jump, we get to insns for which we
- can't count on whether or how many times they will be
- executed during each iteration. Therefore, we can
- only move out sets of trivial variables
- (those not used after the loop). */
- /* Similar code appears twice in strength_reduce. */
- else if ((GET_CODE (p) == CODE_LABEL || GET_CODE (p) == JUMP_INSN)
- /* If we enter the loop in the middle, and scan around to the
- beginning, don't set maybe_never for that. This must be an
- unconditional jump, otherwise the code at the top of the
- loop might never be executed. Unconditional jumps are
- followed a by barrier then loop end. */
- && ! (GET_CODE (p) == JUMP_INSN && JUMP_LABEL (p) == loop_top
- && NEXT_INSN (NEXT_INSN (p)) == end
- && simplejump_p (p)))
- maybe_never = 1;
- else if (GET_CODE (p) == NOTE)
- {
- /* At the virtual top of a converted loop, insns are again known to
- be executed: logically, the loop begins here even though the exit
- code has been duplicated. */
- if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_VTOP && loop_depth == 0)
- maybe_never = call_passed = 0;
- else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_BEG)
- loop_depth++;
- else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_END)
- loop_depth--;
- }
- }
-
- /* If one movable subsumes another, ignore that other. */
-
- ignore_some_movables (movables);
-
- /* For each movable insn, see if the reg that it loads
- leads when it dies right into another conditionally movable insn.
- If so, record that the second insn "forces" the first one,
- since the second can be moved only if the first is. */
-
- force_movables (movables);
-
- /* See if there are multiple movable insns that load the same value.
- If there are, make all but the first point at the first one
- through the `match' field, and add the priorities of them
- all together as the priority of the first. */
-
- combine_movables (movables, nregs);
-
- /* Now consider each movable insn to decide whether it is worth moving.
- Store 0 in n_times_set for each reg that is moved. */
-
- move_movables (movables, threshold,
- insn_count, loop_start, end, nregs);
-
- /* Now candidates that still are negative are those not moved.
- Change n_times_set to indicate that those are not actually invariant. */
- for (i = 0; i < nregs; i++)
- if (n_times_set[i] < 0)
- n_times_set[i] = n_times_used[i];
-
- if (flag_strength_reduce)
- strength_reduce (scan_start, end, loop_top,
- insn_count, loop_start, end);
-}
-
-/* Add elements to *OUTPUT to record all the pseudo-regs
- mentioned in IN_THIS but not mentioned in NOT_IN_THIS. */
-
-void
-record_excess_regs (in_this, not_in_this, output)
- rtx in_this, not_in_this;
- rtx *output;
-{
- enum rtx_code code;
- char *fmt;
- int i;
-
- code = GET_CODE (in_this);
-
- switch (code)
- {
- case PC:
- case CC0:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- return;
-
- case REG:
- if (REGNO (in_this) >= FIRST_PSEUDO_REGISTER
- && ! reg_mentioned_p (in_this, not_in_this))
- *output = gen_rtx (EXPR_LIST, VOIDmode, in_this, *output);
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- int j;
-
- switch (fmt[i])
- {
- case 'E':
- for (j = 0; j < XVECLEN (in_this, i); j++)
- record_excess_regs (XVECEXP (in_this, i, j), not_in_this, output);
- break;
-
- case 'e':
- record_excess_regs (XEXP (in_this, i), not_in_this, output);
- break;
- }
- }
-}
-
-/* Check what regs are referred to in the libcall block ending with INSN,
- aside from those mentioned in the equivalent value.
- If there are none, return 0.
- If there are one or more, return an EXPR_LIST containing all of them. */
-
-static rtx
-libcall_other_reg (insn, equiv)
- rtx insn, equiv;
-{
- rtx note = find_reg_note (insn, REG_RETVAL, NULL_RTX);
- rtx p = XEXP (note, 0);
- rtx output = 0;
-
- /* First, find all the regs used in the libcall block
- that are not mentioned as inputs to the result. */
-
- while (p != insn)
- {
- if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN
- || GET_CODE (p) == CALL_INSN)
- record_excess_regs (PATTERN (p), equiv, &output);
- p = NEXT_INSN (p);
- }
-
- return output;
-}
-
-/* Return 1 if all uses of REG
- are between INSN and the end of the basic block. */
-
-static int
-reg_in_basic_block_p (insn, reg)
- rtx insn, reg;
-{
- int regno = REGNO (reg);
- rtx p;
-
- if (regno_first_uid[regno] != INSN_UID (insn))
- return 0;
-
- /* Search this basic block for the already recorded last use of the reg. */
- for (p = insn; p; p = NEXT_INSN (p))
- {
- switch (GET_CODE (p))
- {
- case NOTE:
- break;
-
- case INSN:
- case CALL_INSN:
- /* Ordinary insn: if this is the last use, we win. */
- if (regno_last_uid[regno] == INSN_UID (p))
- return 1;
- break;
-
- case JUMP_INSN:
- /* Jump insn: if this is the last use, we win. */
- if (regno_last_uid[regno] == INSN_UID (p))
- return 1;
- /* Otherwise, it's the end of the basic block, so we lose. */
- return 0;
-
- case CODE_LABEL:
- case BARRIER:
- /* It's the end of the basic block, so we lose. */
- return 0;
- }
- }
-
- /* The "last use" doesn't follow the "first use"?? */
- abort ();
-}
-
-/* Compute the benefit of eliminating the insns in the block whose
- last insn is LAST. This may be a group of insns used to compute a
- value directly or can contain a library call. */
-
-static int
-libcall_benefit (last)
- rtx last;
-{
- rtx insn;
- int benefit = 0;
-
- for (insn = XEXP (find_reg_note (last, REG_RETVAL, NULL_RTX), 0);
- insn != last; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CALL_INSN)
- benefit += 10; /* Assume at least this many insns in a library
- routine. */
- else if (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) != USE
- && GET_CODE (PATTERN (insn)) != CLOBBER)
- benefit++;
- }
-
- return benefit;
-}
-
-/* Skip COUNT insns from INSN, counting library calls as 1 insn. */
-
-static rtx
-skip_consec_insns (insn, count)
- rtx insn;
- int count;
-{
- for (; count > 0; count--)
- {
- rtx temp;
-
- /* If first insn of libcall sequence, skip to end. */
- /* Do this at start of loop, since INSN is guaranteed to
- be an insn here. */
- if (GET_CODE (insn) != NOTE
- && (temp = find_reg_note (insn, REG_LIBCALL, NULL_RTX)))
- insn = XEXP (temp, 0);
-
- do insn = NEXT_INSN (insn);
- while (GET_CODE (insn) == NOTE);
- }
-
- return insn;
-}
-
-/* Ignore any movable whose insn falls within a libcall
- which is part of another movable.
- We make use of the fact that the movable for the libcall value
- was made later and so appears later on the chain. */
-
-static void
-ignore_some_movables (movables)
- struct movable *movables;
-{
- register struct movable *m, *m1;
-
- for (m = movables; m; m = m->next)
- {
- /* Is this a movable for the value of a libcall? */
- rtx note = find_reg_note (m->insn, REG_RETVAL, NULL_RTX);
- if (note)
- {
- rtx insn;
- /* Check for earlier movables inside that range,
- and mark them invalid. We cannot use LUIDs here because
- insns created by loop.c for prior loops don't have LUIDs.
- Rather than reject all such insns from movables, we just
- explicitly check each insn in the libcall (since invariant
- libcalls aren't that common). */
- for (insn = XEXP (note, 0); insn != m->insn; insn = NEXT_INSN (insn))
- for (m1 = movables; m1 != m; m1 = m1->next)
- if (m1->insn == insn)
- m1->done = 1;
- }
- }
-}
-
-/* For each movable insn, see if the reg that it loads
- leads when it dies right into another conditionally movable insn.
- If so, record that the second insn "forces" the first one,
- since the second can be moved only if the first is. */
-
-static void
-force_movables (movables)
- struct movable *movables;
-{
- register struct movable *m, *m1;
- for (m1 = movables; m1; m1 = m1->next)
- /* Omit this if moving just the (SET (REG) 0) of a zero-extend. */
- if (!m1->partial && !m1->done)
- {
- int regno = m1->regno;
- for (m = m1->next; m; m = m->next)
- /* ??? Could this be a bug? What if CSE caused the
- register of M1 to be used after this insn?
- Since CSE does not update regno_last_uid,
- this insn M->insn might not be where it dies.
- But very likely this doesn't matter; what matters is
- that M's reg is computed from M1's reg. */
- if (INSN_UID (m->insn) == regno_last_uid[regno]
- && !m->done)
- break;
- if (m != 0 && m->set_src == m1->set_dest
- /* If m->consec, m->set_src isn't valid. */
- && m->consec == 0)
- m = 0;
-
- /* Increase the priority of the moving the first insn
- since it permits the second to be moved as well. */
- if (m != 0)
- {
- m->forces = m1;
- m1->lifetime += m->lifetime;
- m1->savings += m1->savings;
- }
- }
-}
-
-/* Find invariant expressions that are equal and can be combined into
- one register. */
-
-static void
-combine_movables (movables, nregs)
- struct movable *movables;
- int nregs;
-{
- register struct movable *m;
- char *matched_regs = (char *) alloca (nregs);
- enum machine_mode mode;
-
- /* Regs that are set more than once are not allowed to match
- or be matched. I'm no longer sure why not. */
- /* Perhaps testing m->consec_sets would be more appropriate here? */
-
- for (m = movables; m; m = m->next)
- if (m->match == 0 && n_times_used[m->regno] == 1 && !m->partial)
- {
- register struct movable *m1;
- int regno = m->regno;
-
- bzero (matched_regs, nregs);
- matched_regs[regno] = 1;
-
- for (m1 = movables; m1; m1 = m1->next)
- if (m != m1 && m1->match == 0 && n_times_used[m1->regno] == 1
- /* A reg used outside the loop mustn't be eliminated. */
- && !m1->global
- /* A reg used for zero-extending mustn't be eliminated. */
- && !m1->partial
- && (matched_regs[m1->regno]
- ||
- (
- /* Can combine regs with different modes loaded from the
- same constant only if the modes are the same or
- if both are integer modes with M wider or the same
- width as M1. The check for integer is redundant, but
- safe, since the only case of differing destination
- modes with equal sources is when both sources are
- VOIDmode, i.e., CONST_INT. */
- (GET_MODE (m->set_dest) == GET_MODE (m1->set_dest)
- || (GET_MODE_CLASS (GET_MODE (m->set_dest)) == MODE_INT
- && 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)))))
- /* See if the source of M1 says it matches M. */
- && ((GET_CODE (m1->set_src) == REG
- && matched_regs[REGNO (m1->set_src)])
- || rtx_equal_for_loop_p (m->set_src, m1->set_src,
- movables))))
- && ((m->dependencies == m1->dependencies)
- || rtx_equal_p (m->dependencies, m1->dependencies)))
- {
- m->lifetime += m1->lifetime;
- m->savings += m1->savings;
- m1->done = 1;
- m1->match = m;
- matched_regs[m1->regno] = 1;
- }
- }
-
- /* Now combine the regs used for zero-extension.
- This can be done for those not marked `global'
- provided their lives don't overlap. */
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- {
- register struct movable *m0 = 0;
-
- /* Combine all the registers for extension from mode MODE.
- Don't combine any that are used outside this loop. */
- for (m = movables; m; m = m->next)
- if (m->partial && ! m->global
- && mode == GET_MODE (SET_SRC (PATTERN (NEXT_INSN (m->insn)))))
- {
- register struct movable *m1;
- int first = uid_luid[regno_first_uid[m->regno]];
- int last = uid_luid[regno_last_uid[m->regno]];
-
- if (m0 == 0)
- {
- /* First one: don't check for overlap, just record it. */
- m0 = m;
- continue;
- }
-
- /* Make sure they extend to the same mode.
- (Almost always true.) */
- if (GET_MODE (m->set_dest) != GET_MODE (m0->set_dest))
- continue;
-
- /* We already have one: check for overlap with those
- already combined together. */
- for (m1 = movables; m1 != m; m1 = m1->next)
- if (m1 == m0 || (m1->partial && m1->match == m0))
- if (! (uid_luid[regno_first_uid[m1->regno]] > last
- || uid_luid[regno_last_uid[m1->regno]] < first))
- goto overlap;
-
- /* No overlap: we can combine this with the others. */
- m0->lifetime += m->lifetime;
- m0->savings += m->savings;
- m->done = 1;
- m->match = m0;
-
- overlap: ;
- }
- }
-}
-
-/* Return 1 if regs X and Y will become the same if moved. */
-
-static int
-regs_match_p (x, y, movables)
- rtx x, y;
- struct movable *movables;
-{
- int xn = REGNO (x);
- int yn = REGNO (y);
- struct movable *mx, *my;
-
- for (mx = movables; mx; mx = mx->next)
- if (mx->regno == xn)
- break;
-
- for (my = movables; my; my = my->next)
- if (my->regno == yn)
- break;
-
- return (mx && my
- && ((mx->match == my->match && mx->match != 0)
- || mx->match == my
- || mx == my->match));
-}
-
-/* Return 1 if X and Y are identical-looking rtx's.
- This is the Lisp function EQUAL for rtx arguments.
-
- If two registers are matching movables or a movable register and an
- equivalent constant, consider them equal. */
-
-static int
-rtx_equal_for_loop_p (x, y, movables)
- rtx x, y;
- struct movable *movables;
-{
- register int i;
- register int j;
- register struct movable *m;
- register enum rtx_code code;
- register char *fmt;
-
- if (x == y)
- return 1;
- if (x == 0 || y == 0)
- return 0;
-
- code = GET_CODE (x);
-
- /* If we have a register and a constant, they may sometimes be
- equal. */
- if (GET_CODE (x) == REG && n_times_set[REGNO (x)] == -2
- && CONSTANT_P (y))
- for (m = movables; m; m = m->next)
- if (m->move_insn && m->regno == REGNO (x)
- && rtx_equal_p (m->set_src, y))
- return 1;
-
- else if (GET_CODE (y) == REG && n_times_set[REGNO (y)] == -2
- && CONSTANT_P (x))
- for (m = movables; m; m = m->next)
- if (m->move_insn && m->regno == REGNO (y)
- && rtx_equal_p (m->set_src, x))
- return 1;
-
- /* Otherwise, rtx's of different codes cannot be equal. */
- if (code != GET_CODE (y))
- return 0;
-
- /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
- (REG:SI x) and (REG:HI x) are NOT equivalent. */
-
- if (GET_MODE (x) != GET_MODE (y))
- return 0;
-
- /* These three types of rtx's can be compared nonrecursively. */
- if (code == REG)
- return (REGNO (x) == REGNO (y) || regs_match_p (x, y, movables));
-
- if (code == LABEL_REF)
- return XEXP (x, 0) == XEXP (y, 0);
- if (code == SYMBOL_REF)
- return XSTR (x, 0) == XSTR (y, 0);
-
- /* Compare the elements. If any pair of corresponding elements
- fail to match, return 0 for the whole things. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- switch (fmt[i])
- {
- case 'w':
- if (XWINT (x, i) != XWINT (y, i))
- return 0;
- break;
-
- case 'i':
- if (XINT (x, i) != XINT (y, i))
- return 0;
- break;
-
- case 'E':
- /* Two vectors must have the same length. */
- if (XVECLEN (x, i) != XVECLEN (y, i))
- return 0;
-
- /* And the corresponding elements must match. */
- for (j = 0; j < XVECLEN (x, i); j++)
- if (rtx_equal_for_loop_p (XVECEXP (x, i, j), XVECEXP (y, i, j), movables) == 0)
- return 0;
- break;
-
- case 'e':
- if (rtx_equal_for_loop_p (XEXP (x, i), XEXP (y, i), movables) == 0)
- return 0;
- break;
-
- case 's':
- if (strcmp (XSTR (x, i), XSTR (y, i)))
- return 0;
- break;
-
- case 'u':
- /* These are just backpointers, so they don't matter. */
- break;
-
- case '0':
- break;
-
- /* It is believed that rtx's at this level will never
- contain anything but integers and other rtx's,
- except for within LABEL_REFs and SYMBOL_REFs. */
- default:
- abort ();
- }
- }
- return 1;
-}
-
-/* If X contains any LABEL_REF's, add REG_LABEL notes for them to all
- insns in INSNS which use thet reference. */
-
-static void
-add_label_notes (x, insns)
- rtx x;
- rtx insns;
-{
- enum rtx_code code = GET_CODE (x);
- int i, j;
- char *fmt;
- rtx insn;
-
- if (code == LABEL_REF && !LABEL_REF_NONLOCAL_P (x))
- {
- rtx next = next_real_insn (XEXP (x, 0));
-
- /* Don't record labels that refer to dispatch tables.
- This is not necessary, since the tablejump references the same label.
- And if we did record them, flow.c would make worse code. */
- if (next == 0
- || ! (GET_CODE (next) == JUMP_INSN
- && (GET_CODE (PATTERN (next)) == ADDR_VEC
- || GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC)))
- {
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- if (reg_mentioned_p (XEXP (x, 0), insn))
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_LABEL, XEXP (x, 0),
- REG_NOTES (insn));
- }
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- add_label_notes (XEXP (x, i), insns);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- add_label_notes (XVECEXP (x, i, j), insns);
- }
-}
-
-/* Scan MOVABLES, and move the insns that deserve to be moved.
- If two matching movables are combined, replace one reg with the
- other throughout. */
-
-static void
-move_movables (movables, threshold, insn_count, loop_start, end, nregs)
- struct movable *movables;
- int threshold;
- int insn_count;
- rtx loop_start;
- rtx end;
- int nregs;
-{
- rtx new_start = 0;
- register struct movable *m;
- register rtx p;
- /* Map of pseudo-register replacements to handle combining
- when we move several insns that load the same value
- into different pseudo-registers. */
- rtx *reg_map = (rtx *) alloca (nregs * sizeof (rtx));
- char *already_moved = (char *) alloca (nregs);
-
- bzero (already_moved, nregs);
- bzero ((char *) reg_map, nregs * sizeof (rtx));
-
- num_movables = 0;
-
- for (m = movables; m; m = m->next)
- {
- /* Describe this movable insn. */
-
- if (loop_dump_stream)
- {
- fprintf (loop_dump_stream, "Insn %d: regno %d (life %d), ",
- INSN_UID (m->insn), m->regno, m->lifetime);
- if (m->consec > 0)
- fprintf (loop_dump_stream, "consec %d, ", m->consec);
- if (m->cond)
- fprintf (loop_dump_stream, "cond ");
- if (m->force)
- fprintf (loop_dump_stream, "force ");
- if (m->global)
- fprintf (loop_dump_stream, "global ");
- if (m->done)
- fprintf (loop_dump_stream, "done ");
- if (m->move_insn)
- fprintf (loop_dump_stream, "move-insn ");
- if (m->match)
- fprintf (loop_dump_stream, "matches %d ",
- INSN_UID (m->match->insn));
- if (m->forces)
- fprintf (loop_dump_stream, "forces %d ",
- INSN_UID (m->forces->insn));
- }
-
- /* Count movables. Value used in heuristics in strength_reduce. */
- num_movables++;
-
- /* Ignore the insn if it's already done (it matched something else).
- Otherwise, see if it is now safe to move. */
-
- if (!m->done
- && (! m->cond
- || (1 == invariant_p (m->set_src)
- && (m->dependencies == 0
- || 1 == invariant_p (m->dependencies))
- && (m->consec == 0
- || 1 == consec_sets_invariant_p (m->set_dest,
- m->consec + 1,
- m->insn))))
- && (! m->forces || m->forces->done))
- {
- register int regno;
- register rtx p;
- int savings = m->savings;
-
- /* We have an insn that is safe to move.
- Compute its desirability. */
-
- p = m->insn;
- regno = m->regno;
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "savings %d ", savings);
-
- if (moved_once[regno])
- {
- insn_count *= 2;
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "halved since already moved ");
- }
-
- /* An insn MUST be moved if we already moved something else
- which is safe only if this one is moved too: that is,
- if already_moved[REGNO] is nonzero. */
-
- /* An insn is desirable to move if the new lifetime of the
- register is no more than THRESHOLD times the old lifetime.
- If it's not desirable, it means the loop is so big
- that moving won't speed things up much,
- and it is liable to make register usage worse. */
-
- /* It is also desirable to move if it can be moved at no
- extra cost because something else was already moved. */
-
- if (already_moved[regno]
- || (threshold * savings * m->lifetime) >= insn_count
- || (m->forces && m->forces->done
- && n_times_used[m->forces->regno] == 1))
- {
- int count;
- register struct movable *m1;
- rtx first;
-
- /* Now move the insns that set the reg. */
-
- if (m->partial && m->match)
- {
- rtx newpat, i1;
- rtx r1, r2;
- /* Find the end of this chain of matching regs.
- Thus, we load each reg in the chain from that one reg.
- And that reg is loaded with 0 directly,
- since it has ->match == 0. */
- for (m1 = m; m1->match; m1 = m1->match);
- newpat = gen_move_insn (SET_DEST (PATTERN (m->insn)),
- SET_DEST (PATTERN (m1->insn)));
- i1 = emit_insn_before (newpat, loop_start);
-
- /* Mark the moved, invariant reg as being allowed to
- share a hard reg with the other matching invariant. */
- REG_NOTES (i1) = REG_NOTES (m->insn);
- r1 = SET_DEST (PATTERN (m->insn));
- r2 = SET_DEST (PATTERN (m1->insn));
- regs_may_share = gen_rtx (EXPR_LIST, VOIDmode, r1,
- gen_rtx (EXPR_LIST, VOIDmode, r2,
- regs_may_share));
- delete_insn (m->insn);
-
- if (new_start == 0)
- new_start = i1;
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, " moved to %d", INSN_UID (i1));
- }
- /* If we are to re-generate the item being moved with a
- new move insn, first delete what we have and then emit
- the move insn before the loop. */
- else if (m->move_insn)
- {
- rtx i1, temp;
-
- for (count = m->consec; count >= 0; count--)
- {
- /* If this is the first insn of a library call sequence,
- skip to the end. */
- if (GET_CODE (p) != NOTE
- && (temp = find_reg_note (p, REG_LIBCALL, NULL_RTX)))
- p = XEXP (temp, 0);
-
- /* If this is the last insn of a libcall sequence, then
- delete every insn in the sequence except the last.
- The last insn is handled in the normal manner. */
- if (GET_CODE (p) != NOTE
- && (temp = find_reg_note (p, REG_RETVAL, NULL_RTX)))
- {
- temp = XEXP (temp, 0);
- while (temp != p)
- temp = delete_insn (temp);
- }
-
- p = delete_insn (p);
- while (p && GET_CODE (p) == NOTE)
- p = NEXT_INSN (p);
- }
-
- start_sequence ();
- emit_move_insn (m->set_dest, m->set_src);
- temp = get_insns ();
- end_sequence ();
-
- add_label_notes (m->set_src, temp);
-
- i1 = emit_insns_before (temp, loop_start);
- if (! find_reg_note (i1, REG_EQUAL, NULL_RTX))
- REG_NOTES (i1)
- = gen_rtx (EXPR_LIST,
- m->is_equiv ? REG_EQUIV : REG_EQUAL,
- m->set_src, REG_NOTES (i1));
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, " moved to %d", INSN_UID (i1));
-
- /* The more regs we move, the less we like moving them. */
- threshold -= 3;
- }
- else
- {
- for (count = m->consec; count >= 0; count--)
- {
- rtx i1, temp;
-
- /* If first insn of libcall sequence, skip to end. */
- /* Do this at start of loop, since p is guaranteed to
- be an insn here. */
- if (GET_CODE (p) != NOTE
- && (temp = find_reg_note (p, REG_LIBCALL, NULL_RTX)))
- p = XEXP (temp, 0);
-
- /* If last insn of libcall sequence, move all
- insns except the last before the loop. The last
- insn is handled in the normal manner. */
- if (GET_CODE (p) != NOTE
- && (temp = find_reg_note (p, REG_RETVAL, NULL_RTX)))
- {
- rtx fn_address = 0;
- rtx fn_reg = 0;
- rtx fn_address_insn = 0;
-
- first = 0;
- for (temp = XEXP (temp, 0); temp != p;
- temp = NEXT_INSN (temp))
- {
- rtx body;
- rtx n;
- rtx next;
-
- if (GET_CODE (temp) == NOTE)
- continue;
-
- body = PATTERN (temp);
-
- /* Find the next insn after TEMP,
- not counting USE or NOTE insns. */
- for (next = NEXT_INSN (temp); next != p;
- next = NEXT_INSN (next))
- if (! (GET_CODE (next) == INSN
- && GET_CODE (PATTERN (next)) == USE)
- && GET_CODE (next) != NOTE)
- break;
-
- /* If that is the call, this may be the insn
- that loads the function address.
-
- Extract the function address from the insn
- that loads it into a register.
- If this insn was cse'd, we get incorrect code.
-
- So emit a new move insn that copies the
- function address into the register that the
- call insn will use. flow.c will delete any
- redundant stores that we have created. */
- if (GET_CODE (next) == CALL_INSN
- && GET_CODE (body) == SET
- && GET_CODE (SET_DEST (body)) == REG
- && (n = find_reg_note (temp, REG_EQUAL,
- NULL_RTX)))
- {
- fn_reg = SET_SRC (body);
- if (GET_CODE (fn_reg) != REG)
- fn_reg = SET_DEST (body);
- fn_address = XEXP (n, 0);
- fn_address_insn = temp;
- }
- /* We have the call insn.
- If it uses the register we suspect it might,
- load it with the correct address directly. */
- if (GET_CODE (temp) == CALL_INSN
- && fn_address != 0
- && reg_referenced_p (fn_reg, body))
- emit_insn_after (gen_move_insn (fn_reg,
- fn_address),
- fn_address_insn);
-
- if (GET_CODE (temp) == CALL_INSN)
- {
- i1 = emit_call_insn_before (body, loop_start);
- /* Because the USAGE information potentially
- contains objects other than hard registers
- we need to copy it. */
- if (CALL_INSN_FUNCTION_USAGE (temp))
- CALL_INSN_FUNCTION_USAGE (i1) =
- copy_rtx (CALL_INSN_FUNCTION_USAGE (temp));
- }
- else
- i1 = emit_insn_before (body, loop_start);
- if (first == 0)
- first = i1;
- if (temp == fn_address_insn)
- fn_address_insn = i1;
- REG_NOTES (i1) = REG_NOTES (temp);
- delete_insn (temp);
- }
- }
- if (m->savemode != VOIDmode)
- {
- /* P sets REG to zero; but we should clear only
- the bits that are not covered by the mode
- m->savemode. */
- rtx reg = m->set_dest;
- rtx sequence;
- rtx tem;
-
- start_sequence ();
- tem = expand_binop
- (GET_MODE (reg), and_optab, reg,
- GEN_INT ((((HOST_WIDE_INT) 1
- << GET_MODE_BITSIZE (m->savemode)))
- - 1),
- reg, 1, OPTAB_LIB_WIDEN);
- if (tem == 0)
- abort ();
- if (tem != reg)
- emit_move_insn (reg, tem);
- sequence = gen_sequence ();
- end_sequence ();
- i1 = emit_insn_before (sequence, loop_start);
- }
- else if (GET_CODE (p) == CALL_INSN)
- {
- i1 = emit_call_insn_before (PATTERN (p), loop_start);
- /* Because the USAGE information potentially
- contains objects other than hard registers
- we need to copy it. */
- if (CALL_INSN_FUNCTION_USAGE (p))
- CALL_INSN_FUNCTION_USAGE (i1) =
- copy_rtx (CALL_INSN_FUNCTION_USAGE (p));
- }
- else
- i1 = emit_insn_before (PATTERN (p), loop_start);
-
- REG_NOTES (i1) = REG_NOTES (p);
-
- /* If there is a REG_EQUAL note present whose value is
- not loop invariant, then delete it, since it may
- cause problems with later optimization passes.
- It is possible for cse to create such notes
- like this as a result of record_jump_cond. */
-
- if ((temp = find_reg_note (i1, REG_EQUAL, NULL_RTX))
- && ! invariant_p (XEXP (temp, 0)))
- remove_note (i1, temp);
-
- if (new_start == 0)
- new_start = i1;
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, " moved to %d",
- INSN_UID (i1));
-
-#if 0
- /* This isn't needed because REG_NOTES is copied
- below and is wrong since P might be a PARALLEL. */
- if (REG_NOTES (i1) == 0
- && ! m->partial /* But not if it's a zero-extend clr. */
- && ! m->global /* and not if used outside the loop
- (since it might get set outside). */
- && CONSTANT_P (SET_SRC (PATTERN (p))))
- REG_NOTES (i1)
- = gen_rtx (EXPR_LIST, REG_EQUAL,
- SET_SRC (PATTERN (p)), REG_NOTES (i1));
-#endif
-
- /* If library call, now fix the REG_NOTES that contain
- insn pointers, namely REG_LIBCALL on FIRST
- and REG_RETVAL on I1. */
- if (temp = find_reg_note (i1, REG_RETVAL, NULL_RTX))
- {
- XEXP (temp, 0) = first;
- temp = find_reg_note (first, REG_LIBCALL, NULL_RTX);
- XEXP (temp, 0) = i1;
- }
-
- delete_insn (p);
- do p = NEXT_INSN (p);
- while (p && GET_CODE (p) == NOTE);
- }
-
- /* The more regs we move, the less we like moving them. */
- threshold -= 3;
- }
-
- /* Any other movable that loads the same register
- MUST be moved. */
- already_moved[regno] = 1;
-
- /* This reg has been moved out of one loop. */
- moved_once[regno] = 1;
-
- /* The reg set here is now invariant. */
- if (! m->partial)
- n_times_set[regno] = 0;
-
- m->done = 1;
-
- /* Change the length-of-life info for the register
- to say it lives at least the full length of this loop.
- This will help guide optimizations in outer loops. */
-
- if (uid_luid[regno_first_uid[regno]] > INSN_LUID (loop_start))
- /* This is the old insn before all the moved insns.
- We can't use the moved insn because it is out of range
- in uid_luid. Only the old insns have luids. */
- regno_first_uid[regno] = INSN_UID (loop_start);
- if (uid_luid[regno_last_uid[regno]] < INSN_LUID (end))
- regno_last_uid[regno] = INSN_UID (end);
-
- /* Combine with this moved insn any other matching movables. */
-
- if (! m->partial)
- for (m1 = movables; m1; m1 = m1->next)
- if (m1->match == m)
- {
- rtx temp;
-
- /* Schedule the reg loaded by M1
- for replacement so that shares the reg of M.
- If the modes differ (only possible in restricted
- circumstances, make a SUBREG. */
- if (GET_MODE (m->set_dest) == GET_MODE (m1->set_dest))
- reg_map[m1->regno] = m->set_dest;
- else
- reg_map[m1->regno]
- = gen_lowpart_common (GET_MODE (m1->set_dest),
- m->set_dest);
-
- /* Get rid of the matching insn
- and prevent further processing of it. */
- m1->done = 1;
-
- /* if library call, delete all insn except last, which
- is deleted below */
- if (temp = find_reg_note (m1->insn, REG_RETVAL,
- NULL_RTX))
- {
- for (temp = XEXP (temp, 0); temp != m1->insn;
- temp = NEXT_INSN (temp))
- delete_insn (temp);
- }
- delete_insn (m1->insn);
-
- /* Any other movable that loads the same register
- MUST be moved. */
- already_moved[m1->regno] = 1;
-
- /* The reg merged here is now invariant,
- if the reg it matches is invariant. */
- if (! m->partial)
- n_times_set[m1->regno] = 0;
- }
- }
- else if (loop_dump_stream)
- fprintf (loop_dump_stream, "not desirable");
- }
- else if (loop_dump_stream && !m->match)
- fprintf (loop_dump_stream, "not safe");
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "\n");
- }
-
- if (new_start == 0)
- new_start = loop_start;
-
- /* Go through all the instructions in the loop, making
- all the register substitutions scheduled in REG_MAP. */
- for (p = new_start; p != end; p = NEXT_INSN (p))
- if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN
- || GET_CODE (p) == CALL_INSN)
- {
- replace_regs (PATTERN (p), reg_map, nregs, 0);
- replace_regs (REG_NOTES (p), reg_map, nregs, 0);
- INSN_CODE (p) = -1;
- }
-}
-
-#if 0
-/* Scan X and replace the address of any MEM in it with ADDR.
- REG is the address that MEM should have before the replacement. */
-
-static void
-replace_call_address (x, reg, addr)
- rtx x, reg, addr;
-{
- register enum rtx_code code;
- register int i;
- register char *fmt;
-
- if (x == 0)
- return;
- code = GET_CODE (x);
- switch (code)
- {
- case PC:
- case CC0:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- case REG:
- return;
-
- case SET:
- /* Short cut for very common case. */
- replace_call_address (XEXP (x, 1), reg, addr);
- return;
-
- case CALL:
- /* Short cut for very common case. */
- replace_call_address (XEXP (x, 0), reg, addr);
- return;
-
- case MEM:
- /* If this MEM uses a reg other than the one we expected,
- something is wrong. */
- if (XEXP (x, 0) != reg)
- abort ();
- XEXP (x, 0) = addr;
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- replace_call_address (XEXP (x, i), reg, addr);
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- replace_call_address (XVECEXP (x, i, j), reg, addr);
- }
- }
-}
-#endif
-
-/* Return the number of memory refs to addresses that vary
- in the rtx X. */
-
-static int
-count_nonfixed_reads (x)
- rtx x;
-{
- register enum rtx_code code;
- register int i;
- register char *fmt;
- int value;
-
- if (x == 0)
- return 0;
-
- code = GET_CODE (x);
- switch (code)
- {
- case PC:
- case CC0:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- case REG:
- return 0;
-
- case MEM:
- return ((invariant_p (XEXP (x, 0)) != 1)
- + count_nonfixed_reads (XEXP (x, 0)));
- }
-
- value = 0;
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- value += count_nonfixed_reads (XEXP (x, i));
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- value += count_nonfixed_reads (XVECEXP (x, i, j));
- }
- }
- return value;
-}
-
-
-#if 0
-/* P is an instruction that sets a register to the result of a ZERO_EXTEND.
- Replace it with an instruction to load just the low bytes
- if the machine supports such an instruction,
- and insert above LOOP_START an instruction to clear the register. */
-
-static void
-constant_high_bytes (p, loop_start)
- rtx p, loop_start;
-{
- register rtx new;
- register int insn_code_number;
-
- /* Try to change (SET (REG ...) (ZERO_EXTEND (..:B ...)))
- to (SET (STRICT_LOW_PART (SUBREG:B (REG...))) ...). */
-
- new = gen_rtx (SET, VOIDmode,
- gen_rtx (STRICT_LOW_PART, VOIDmode,
- gen_rtx (SUBREG, GET_MODE (XEXP (SET_SRC (PATTERN (p)), 0)),
- SET_DEST (PATTERN (p)),
- 0)),
- XEXP (SET_SRC (PATTERN (p)), 0));
- insn_code_number = recog (new, p);
-
- if (insn_code_number)
- {
- register int i;
-
- /* Clear destination register before the loop. */
- emit_insn_before (gen_rtx (SET, VOIDmode,
- SET_DEST (PATTERN (p)),
- const0_rtx),
- loop_start);
-
- /* Inside the loop, just load the low part. */
- PATTERN (p) = new;
- }
-}
-#endif
-
-/* Scan a loop setting the variables `unknown_address_altered',
- `num_mem_sets', `loop_continue', loops_enclosed', `loop_has_call',
- and `loop_has_volatile'.
- Also, fill in the array `loop_store_mems'. */
-
-static void
-prescan_loop (start, end)
- rtx start, end;
-{
- register int level = 1;
- register rtx insn;
-
- unknown_address_altered = 0;
- loop_has_call = 0;
- loop_has_volatile = 0;
- loop_store_mems_idx = 0;
-
- num_mem_sets = 0;
- loops_enclosed = 1;
- loop_continue = 0;
-
- for (insn = NEXT_INSN (start); insn != NEXT_INSN (end);
- insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- {
- ++level;
- /* Count number of loops contained in this one. */
- loops_enclosed++;
- }
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- {
- --level;
- if (level == 0)
- {
- end = insn;
- break;
- }
- }
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_CONT)
- {
- if (level == 1)
- loop_continue = insn;
- }
- }
- else if (GET_CODE (insn) == CALL_INSN)
- {
- unknown_address_altered = 1;
- loop_has_call = 1;
- }
- else
- {
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN)
- {
- if (volatile_refs_p (PATTERN (insn)))
- loop_has_volatile = 1;
-
- note_stores (PATTERN (insn), note_addr_stored);
- }
- }
- }
-}
-
-/* Scan the function looking for loops. Record the start and end of each loop.
- Also mark as invalid loops any loops that contain a setjmp or are branched
- to from outside the loop. */
-
-static void
-find_and_verify_loops (f)
- rtx f;
-{
- rtx insn, label;
- int current_loop = -1;
- int next_loop = -1;
- int loop;
-
- /* If there are jumps to undefined labels,
- treat them as jumps out of any/all loops.
- This also avoids writing past end of tables when there are no loops. */
- uid_loop_num[0] = -1;
-
- /* Find boundaries of loops, mark which loops are contained within
- loops, and invalidate loops that have setjmp. */
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE)
- switch (NOTE_LINE_NUMBER (insn))
- {
- case NOTE_INSN_LOOP_BEG:
- loop_number_loop_starts[++next_loop] = insn;
- loop_number_loop_ends[next_loop] = 0;
- loop_outer_loop[next_loop] = current_loop;
- loop_invalid[next_loop] = 0;
- loop_number_exit_labels[next_loop] = 0;
- loop_number_exit_count[next_loop] = 0;
- current_loop = next_loop;
- break;
-
- case NOTE_INSN_SETJMP:
- /* In this case, we must invalidate our current loop and any
- enclosing loop. */
- for (loop = current_loop; loop != -1; loop = loop_outer_loop[loop])
- {
- loop_invalid[loop] = 1;
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "\nLoop at %d ignored due to setjmp.\n",
- INSN_UID (loop_number_loop_starts[loop]));
- }
- break;
-
- case NOTE_INSN_LOOP_END:
- if (current_loop == -1)
- abort ();
-
- loop_number_loop_ends[current_loop] = insn;
- current_loop = loop_outer_loop[current_loop];
- break;
-
- }
-
- /* Note that this will mark the NOTE_INSN_LOOP_END note as being in the
- enclosing loop, but this doesn't matter. */
- uid_loop_num[INSN_UID (insn)] = current_loop;
- }
-
- /* Any loop containing a label used in an initializer must be invalidated,
- because it can be jumped into from anywhere. */
-
- for (label = forced_labels; label; label = XEXP (label, 1))
- {
- int loop_num;
-
- for (loop_num = uid_loop_num[INSN_UID (XEXP (label, 0))];
- loop_num != -1;
- loop_num = loop_outer_loop[loop_num])
- loop_invalid[loop_num] = 1;
- }
-
- /* Any loop containing a label used for an exception handler must be
- invalidated, because it can be jumped into from anywhere. */
-
- for (label = exception_handler_labels; label; label = XEXP (label, 1))
- {
- int loop_num;
-
- for (loop_num = uid_loop_num[INSN_UID (XEXP (label, 0))];
- loop_num != -1;
- loop_num = loop_outer_loop[loop_num])
- loop_invalid[loop_num] = 1;
- }
-
- /* Now scan all insn's in the function. If any JUMP_INSN branches into a
- loop that it is not contained within, that loop is marked invalid.
- If any INSN or CALL_INSN uses a label's address, then the loop containing
- that label is marked invalid, because it could be jumped into from
- anywhere.
-
- Also look for blocks of code ending in an unconditional branch that
- exits the loop. If such a block is surrounded by a conditional
- branch around the block, move the block elsewhere (see below) and
- invert the jump to point to the code block. This may eliminate a
- label in our loop and will simplify processing by both us and a
- possible second cse pass. */
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- int this_loop_num = uid_loop_num[INSN_UID (insn)];
-
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == CALL_INSN)
- {
- rtx note = find_reg_note (insn, REG_LABEL, NULL_RTX);
- if (note)
- {
- int loop_num;
-
- for (loop_num = uid_loop_num[INSN_UID (XEXP (note, 0))];
- loop_num != -1;
- loop_num = loop_outer_loop[loop_num])
- loop_invalid[loop_num] = 1;
- }
- }
-
- if (GET_CODE (insn) != JUMP_INSN)
- continue;
-
- mark_loop_jump (PATTERN (insn), this_loop_num);
-
- /* See if this is an unconditional branch outside the loop. */
- if (this_loop_num != -1
- && (GET_CODE (PATTERN (insn)) == RETURN
- || (simplejump_p (insn)
- && (uid_loop_num[INSN_UID (JUMP_LABEL (insn))]
- != this_loop_num)))
- && get_max_uid () < max_uid_for_loop)
- {
- rtx p;
- rtx our_next = next_real_insn (insn);
- int dest_loop;
- int outer_loop = -1;
-
- /* Go backwards until we reach the start of the loop, a label,
- or a JUMP_INSN. */
- for (p = PREV_INSN (insn);
- GET_CODE (p) != CODE_LABEL
- && ! (GET_CODE (p) == NOTE
- && NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_BEG)
- && GET_CODE (p) != JUMP_INSN;
- p = PREV_INSN (p))
- ;
-
- /* Check for the case where we have a jump to an inner nested
- loop, and do not perform the optimization in that case. */
-
- if (JUMP_LABEL (insn))
- {
- dest_loop = uid_loop_num[INSN_UID (JUMP_LABEL (insn))];
- if (dest_loop != -1)
- {
- for (outer_loop = dest_loop; outer_loop != -1;
- outer_loop = loop_outer_loop[outer_loop])
- if (outer_loop == this_loop_num)
- break;
- }
- }
-
- /* Make sure that the target of P is within the current loop. */
-
- if (GET_CODE (p) == JUMP_INSN && JUMP_LABEL (p)
- && uid_loop_num[INSN_UID (JUMP_LABEL (p))] != this_loop_num)
- outer_loop = this_loop_num;
-
- /* If we stopped on a JUMP_INSN to the next insn after INSN,
- we have a block of code to try to move.
-
- We look backward and then forward from the target of INSN
- to find a BARRIER at the same loop depth as the target.
- If we find such a BARRIER, we make a new label for the start
- of the block, invert the jump in P and point it to that label,
- and move the block of code to the spot we found. */
-
- if (outer_loop == -1
- && GET_CODE (p) == JUMP_INSN
- && JUMP_LABEL (p) != 0
- /* Just ignore jumps to labels that were never emitted.
- These always indicate compilation errors. */
- && INSN_UID (JUMP_LABEL (p)) != 0
- && condjump_p (p)
- && ! simplejump_p (p)
- && next_real_insn (JUMP_LABEL (p)) == our_next)
- {
- rtx target
- = JUMP_LABEL (insn) ? JUMP_LABEL (insn) : get_last_insn ();
- int target_loop_num = uid_loop_num[INSN_UID (target)];
- rtx loc;
-
- for (loc = target; loc; loc = PREV_INSN (loc))
- if (GET_CODE (loc) == BARRIER
- && uid_loop_num[INSN_UID (loc)] == target_loop_num)
- break;
-
- if (loc == 0)
- for (loc = target; loc; loc = NEXT_INSN (loc))
- if (GET_CODE (loc) == BARRIER
- && uid_loop_num[INSN_UID (loc)] == target_loop_num)
- break;
-
- if (loc)
- {
- rtx cond_label = JUMP_LABEL (p);
- rtx new_label = get_label_after (p);
-
- /* Ensure our label doesn't go away. */
- LABEL_NUSES (cond_label)++;
-
- /* Verify that uid_loop_num is large enough and that
- we can invert P. */
- if (invert_jump (p, new_label))
- {
- rtx q, r;
-
- /* Include the BARRIER after INSN and copy the
- block after LOC. */
- new_label = squeeze_notes (new_label, NEXT_INSN (insn));
- reorder_insns (new_label, NEXT_INSN (insn), loc);
-
- /* All those insns are now in TARGET_LOOP_NUM. */
- for (q = new_label; q != NEXT_INSN (NEXT_INSN (insn));
- q = NEXT_INSN (q))
- uid_loop_num[INSN_UID (q)] = target_loop_num;
-
- /* The label jumped to by INSN is no longer a loop exit.
- Unless INSN does not have a label (e.g., it is a
- RETURN insn), search loop_number_exit_labels to find
- its label_ref, and remove it. Also turn off
- LABEL_OUTSIDE_LOOP_P bit. */
- if (JUMP_LABEL (insn))
- {
- int loop_num;
-
- for (q = 0,
- r = loop_number_exit_labels[this_loop_num];
- r; q = r, r = LABEL_NEXTREF (r))
- if (XEXP (r, 0) == JUMP_LABEL (insn))
- {
- LABEL_OUTSIDE_LOOP_P (r) = 0;
- if (q)
- LABEL_NEXTREF (q) = LABEL_NEXTREF (r);
- else
- loop_number_exit_labels[this_loop_num]
- = LABEL_NEXTREF (r);
- break;
- }
-
- for (loop_num = this_loop_num;
- loop_num != -1 && loop_num != target_loop_num;
- loop_num = loop_outer_loop[loop_num])
- loop_number_exit_count[loop_num]--;
-
- /* If we didn't find it, then something is wrong. */
- if (! r)
- abort ();
- }
-
- /* P is now a jump outside the loop, so it must be put
- in loop_number_exit_labels, and marked as such.
- The easiest way to do this is to just call
- mark_loop_jump again for P. */
- mark_loop_jump (PATTERN (p), this_loop_num);
-
- /* If INSN now jumps to the insn after it,
- delete INSN. */
- if (JUMP_LABEL (insn) != 0
- && (next_real_insn (JUMP_LABEL (insn))
- == next_real_insn (insn)))
- delete_insn (insn);
- }
-
- /* Continue the loop after where the conditional
- branch used to jump, since the only branch insn
- in the block (if it still remains) is an inter-loop
- branch and hence needs no processing. */
- insn = NEXT_INSN (cond_label);
-
- if (--LABEL_NUSES (cond_label) == 0)
- delete_insn (cond_label);
-
- /* This loop will be continued with NEXT_INSN (insn). */
- insn = PREV_INSN (insn);
- }
- }
- }
- }
-}
-
-/* If any label in X jumps to a loop different from LOOP_NUM and any of the
- loops it is contained in, mark the target loop invalid.
-
- For speed, we assume that X is part of a pattern of a JUMP_INSN. */
-
-static void
-mark_loop_jump (x, loop_num)
- rtx x;
- int loop_num;
-{
- int dest_loop;
- int outer_loop;
- int i;
-
- switch (GET_CODE (x))
- {
- case PC:
- case USE:
- case CLOBBER:
- case REG:
- case MEM:
- case CONST_INT:
- case CONST_DOUBLE:
- case RETURN:
- return;
-
- case CONST:
- /* There could be a label reference in here. */
- mark_loop_jump (XEXP (x, 0), loop_num);
- return;
-
- case PLUS:
- case MINUS:
- case MULT:
- mark_loop_jump (XEXP (x, 0), loop_num);
- mark_loop_jump (XEXP (x, 1), loop_num);
- return;
-
- case SIGN_EXTEND:
- case ZERO_EXTEND:
- mark_loop_jump (XEXP (x, 0), loop_num);
- return;
-
- case LABEL_REF:
- dest_loop = uid_loop_num[INSN_UID (XEXP (x, 0))];
-
- /* Link together all labels that branch outside the loop. This
- is used by final_[bg]iv_value and the loop unrolling code. Also
- mark this LABEL_REF so we know that this branch should predict
- false. */
-
- /* A check to make sure the label is not in an inner nested loop,
- since this does not count as a loop exit. */
- if (dest_loop != -1)
- {
- for (outer_loop = dest_loop; outer_loop != -1;
- outer_loop = loop_outer_loop[outer_loop])
- if (outer_loop == loop_num)
- break;
- }
- else
- outer_loop = -1;
-
- if (loop_num != -1 && outer_loop == -1)
- {
- LABEL_OUTSIDE_LOOP_P (x) = 1;
- LABEL_NEXTREF (x) = loop_number_exit_labels[loop_num];
- loop_number_exit_labels[loop_num] = x;
-
- for (outer_loop = loop_num;
- outer_loop != -1 && outer_loop != dest_loop;
- outer_loop = loop_outer_loop[outer_loop])
- loop_number_exit_count[outer_loop]++;
- }
-
- /* If this is inside a loop, but not in the current loop or one enclosed
- by it, it invalidates at least one loop. */
-
- if (dest_loop == -1)
- return;
-
- /* We must invalidate every nested loop containing the target of this
- label, except those that also contain the jump insn. */
-
- for (; dest_loop != -1; dest_loop = loop_outer_loop[dest_loop])
- {
- /* Stop when we reach a loop that also contains the jump insn. */
- for (outer_loop = loop_num; outer_loop != -1;
- outer_loop = loop_outer_loop[outer_loop])
- if (dest_loop == outer_loop)
- return;
-
- /* If we get here, we know we need to invalidate a loop. */
- if (loop_dump_stream && ! loop_invalid[dest_loop])
- fprintf (loop_dump_stream,
- "\nLoop at %d ignored due to multiple entry points.\n",
- INSN_UID (loop_number_loop_starts[dest_loop]));
-
- loop_invalid[dest_loop] = 1;
- }
- return;
-
- case SET:
- /* If this is not setting pc, ignore. */
- if (SET_DEST (x) == pc_rtx)
- mark_loop_jump (SET_SRC (x), loop_num);
- return;
-
- case IF_THEN_ELSE:
- mark_loop_jump (XEXP (x, 1), loop_num);
- mark_loop_jump (XEXP (x, 2), loop_num);
- return;
-
- case PARALLEL:
- case ADDR_VEC:
- for (i = 0; i < XVECLEN (x, 0); i++)
- mark_loop_jump (XVECEXP (x, 0, i), loop_num);
- return;
-
- case ADDR_DIFF_VEC:
- for (i = 0; i < XVECLEN (x, 1); i++)
- mark_loop_jump (XVECEXP (x, 1, i), loop_num);
- return;
-
- default:
- /* Treat anything else (such as a symbol_ref)
- as a branch out of this loop, but not into any loop. */
-
- if (loop_num != -1)
- {
- loop_number_exit_labels[loop_num] = x;
-
- for (outer_loop = loop_num; outer_loop != -1;
- outer_loop = loop_outer_loop[outer_loop])
- loop_number_exit_count[outer_loop]++;
- }
- return;
- }
-}
-
-/* Return nonzero if there is a label in the range from
- insn INSN to and including the insn whose luid is END
- INSN must have an assigned luid (i.e., it must not have
- been previously created by loop.c). */
-
-static int
-labels_in_range_p (insn, end)
- rtx insn;
- int end;
-{
- while (insn && INSN_LUID (insn) <= end)
- {
- if (GET_CODE (insn) == CODE_LABEL)
- return 1;
- insn = NEXT_INSN (insn);
- }
-
- return 0;
-}
-
-/* Record that a memory reference X is being set. */
-
-static void
-note_addr_stored (x)
- rtx x;
-{
- register int i;
-
- if (x == 0 || GET_CODE (x) != MEM)
- return;
-
- /* Count number of memory writes.
- This affects heuristics in strength_reduce. */
- num_mem_sets++;
-
- /* BLKmode MEM means all memory is clobbered. */
- if (GET_MODE (x) == BLKmode)
- unknown_address_altered = 1;
-
- if (unknown_address_altered)
- return;
-
- for (i = 0; i < loop_store_mems_idx; i++)
- if (rtx_equal_p (XEXP (loop_store_mems[i], 0), XEXP (x, 0))
- && MEM_IN_STRUCT_P (x) == MEM_IN_STRUCT_P (loop_store_mems[i]))
- {
- /* We are storing at the same address as previously noted. Save the
- wider reference. */
- if (GET_MODE_SIZE (GET_MODE (x))
- > GET_MODE_SIZE (GET_MODE (loop_store_mems[i])))
- loop_store_mems[i] = x;
- break;
- }
-
- if (i == NUM_STORES)
- unknown_address_altered = 1;
-
- else if (i == loop_store_mems_idx)
- loop_store_mems[loop_store_mems_idx++] = x;
-}
-
-/* Return nonzero if the rtx X is invariant over the current loop.
-
- The value is 2 if we refer to something only conditionally invariant.
-
- If `unknown_address_altered' is nonzero, no memory ref is invariant.
- Otherwise, a memory ref is invariant if it does not conflict with
- anything stored in `loop_store_mems'. */
-
-int
-invariant_p (x)
- register rtx x;
-{
- register int i;
- register enum rtx_code code;
- register char *fmt;
- int conditional = 0;
-
- if (x == 0)
- return 1;
- code = GET_CODE (x);
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CONST:
- return 1;
-
- case LABEL_REF:
- /* A LABEL_REF is normally invariant, however, if we are unrolling
- loops, and this label is inside the loop, then it isn't invariant.
- This is because each unrolled copy of the loop body will have
- a copy of this label. If this was invariant, then an insn loading
- the address of this label into a register might get moved outside
- the loop, and then each loop body would end up using the same label.
-
- We don't know the loop bounds here though, so just fail for all
- labels. */
- if (flag_unroll_loops)
- return 0;
- else
- return 1;
-
- case PC:
- case CC0:
- case UNSPEC_VOLATILE:
- return 0;
-
- case REG:
- /* We used to check RTX_UNCHANGING_P (x) here, but that is invalid
- since the reg might be set by initialization within the loop. */
- if (x == frame_pointer_rtx || x == hard_frame_pointer_rtx
- || x == arg_pointer_rtx)
- return 1;
- if (loop_has_call
- && REGNO (x) < FIRST_PSEUDO_REGISTER && call_used_regs[REGNO (x)])
- return 0;
- if (n_times_set[REGNO (x)] < 0)
- return 2;
- return n_times_set[REGNO (x)] == 0;
-
- case MEM:
- /* Volatile memory references must be rejected. Do this before
- checking for read-only items, so that volatile read-only items
- will be rejected also. */
- if (MEM_VOLATILE_P (x))
- return 0;
-
- /* Read-only items (such as constants in a constant pool) are
- invariant if their address is. */
- if (RTX_UNCHANGING_P (x))
- break;
-
- /* If we filled the table (or had a subroutine call), any location
- in memory could have been clobbered. */
- if (unknown_address_altered)
- return 0;
-
- /* See if there is any dependence between a store and this load. */
- for (i = loop_store_mems_idx - 1; i >= 0; i--)
- if (true_dependence (loop_store_mems[i], x))
- return 0;
-
- /* It's not invalidated by a store in memory
- but we must still verify the address is invariant. */
- break;
-
- case ASM_OPERANDS:
- /* Don't mess with insns declared volatile. */
- if (MEM_VOLATILE_P (x))
- return 0;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- int tem = invariant_p (XEXP (x, i));
- if (tem == 0)
- return 0;
- if (tem == 2)
- conditional = 1;
- }
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- {
- int tem = invariant_p (XVECEXP (x, i, j));
- if (tem == 0)
- return 0;
- if (tem == 2)
- conditional = 1;
- }
-
- }
- }
-
- return 1 + conditional;
-}
-
-
-/* Return nonzero if all the insns in the loop that set REG
- are INSN and the immediately following insns,
- and if each of those insns sets REG in an invariant way
- (not counting uses of REG in them).
-
- The value is 2 if some of these insns are only conditionally invariant.
-
- We assume that INSN itself is the first set of REG
- and that its source is invariant. */
-
-static int
-consec_sets_invariant_p (reg, n_sets, insn)
- int n_sets;
- rtx reg, insn;
-{
- register rtx p = insn;
- register int regno = REGNO (reg);
- rtx temp;
- /* Number of sets we have to insist on finding after INSN. */
- int count = n_sets - 1;
- int old = n_times_set[regno];
- int value = 0;
- int this;
-
- /* If N_SETS hit the limit, we can't rely on its value. */
- if (n_sets == 127)
- return 0;
-
- n_times_set[regno] = 0;
-
- while (count > 0)
- {
- register enum rtx_code code;
- rtx set;
-
- p = NEXT_INSN (p);
- code = GET_CODE (p);
-
- /* If library call, skip to end of of it. */
- if (code == INSN && (temp = find_reg_note (p, REG_LIBCALL, NULL_RTX)))
- p = XEXP (temp, 0);
-
- this = 0;
- if (code == INSN
- && (set = single_set (p))
- && GET_CODE (SET_DEST (set)) == REG
- && REGNO (SET_DEST (set)) == regno)
- {
- this = invariant_p (SET_SRC (set));
- if (this != 0)
- value |= this;
- else if (temp = find_reg_note (p, REG_EQUAL, NULL_RTX))
- {
- /* If this is a libcall, then any invariant REG_EQUAL note is OK.
- If this is an ordinary insn, then only CONSTANT_P REG_EQUAL
- notes are OK. */
- this = (CONSTANT_P (XEXP (temp, 0))
- || (find_reg_note (p, REG_RETVAL, NULL_RTX)
- && invariant_p (XEXP (temp, 0))));
- if (this != 0)
- value |= this;
- }
- }
- if (this != 0)
- count--;
- else if (code != NOTE)
- {
- n_times_set[regno] = old;
- return 0;
- }
- }
-
- n_times_set[regno] = old;
- /* If invariant_p ever returned 2, we return 2. */
- return 1 + (value & 2);
-}
-
-#if 0
-/* I don't think this condition is sufficient to allow INSN
- to be moved, so we no longer test it. */
-
-/* Return 1 if all insns in the basic block of INSN and following INSN
- that set REG are invariant according to TABLE. */
-
-static int
-all_sets_invariant_p (reg, insn, table)
- rtx reg, insn;
- short *table;
-{
- register rtx p = insn;
- register int regno = REGNO (reg);
-
- while (1)
- {
- register enum rtx_code code;
- p = NEXT_INSN (p);
- code = GET_CODE (p);
- if (code == CODE_LABEL || code == JUMP_INSN)
- return 1;
- if (code == INSN && GET_CODE (PATTERN (p)) == SET
- && GET_CODE (SET_DEST (PATTERN (p))) == REG
- && REGNO (SET_DEST (PATTERN (p))) == regno)
- {
- if (!invariant_p (SET_SRC (PATTERN (p)), table))
- return 0;
- }
- }
-}
-#endif /* 0 */
-
-/* Look at all uses (not sets) of registers in X. For each, if it is
- the single use, set USAGE[REGNO] to INSN; if there was a previous use in
- a different insn, set USAGE[REGNO] to const0_rtx. */
-
-static void
-find_single_use_in_loop (insn, x, usage)
- rtx insn;
- rtx x;
- rtx *usage;
-{
- enum rtx_code code = GET_CODE (x);
- char *fmt = GET_RTX_FORMAT (code);
- int i, j;
-
- if (code == REG)
- usage[REGNO (x)]
- = (usage[REGNO (x)] != 0 && usage[REGNO (x)] != insn)
- ? const0_rtx : insn;
-
- else if (code == SET)
- {
- /* Don't count SET_DEST if it is a REG; otherwise count things
- in SET_DEST because if a register is partially modified, it won't
- show up as a potential movable so we don't care how USAGE is set
- for it. */
- if (GET_CODE (SET_DEST (x)) != REG)
- find_single_use_in_loop (insn, SET_DEST (x), usage);
- find_single_use_in_loop (insn, SET_SRC (x), usage);
- }
- else
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e' && XEXP (x, i) != 0)
- find_single_use_in_loop (insn, XEXP (x, i), usage);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- find_single_use_in_loop (insn, XVECEXP (x, i, j), usage);
- }
-}
-
-/* Increment N_TIMES_SET at the index of each register
- that is modified by an insn between FROM and TO.
- If the value of an element of N_TIMES_SET becomes 127 or more,
- stop incrementing it, to avoid overflow.
-
- Store in SINGLE_USAGE[I] the single insn in which register I is
- used, if it is only used once. Otherwise, it is set to 0 (for no
- uses) or const0_rtx for more than one use. This parameter may be zero,
- in which case this processing is not done.
-
- Store in *COUNT_PTR the number of actual instruction
- in the loop. We use this to decide what is worth moving out. */
-
-/* last_set[n] is nonzero iff reg n has been set in the current basic block.
- In that case, it is the insn that last set reg n. */
-
-static void
-count_loop_regs_set (from, to, may_not_move, single_usage, count_ptr, nregs)
- register rtx from, to;
- char *may_not_move;
- rtx *single_usage;
- int *count_ptr;
- int nregs;
-{
- register rtx *last_set = (rtx *) alloca (nregs * sizeof (rtx));
- register rtx insn;
- register int count = 0;
- register rtx dest;
-
- bzero ((char *) last_set, nregs * sizeof (rtx));
- for (insn = from; insn != to; insn = NEXT_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- ++count;
-
- /* If requested, record registers that have exactly one use. */
- if (single_usage)
- {
- find_single_use_in_loop (insn, PATTERN (insn), single_usage);
-
- /* Include uses in REG_EQUAL notes. */
- if (REG_NOTES (insn))
- find_single_use_in_loop (insn, REG_NOTES (insn), single_usage);
- }
-
- if (GET_CODE (PATTERN (insn)) == CLOBBER
- && GET_CODE (XEXP (PATTERN (insn), 0)) == REG)
- /* Don't move a reg that has an explicit clobber.
- We might do so sometimes, but it's not worth the pain. */
- may_not_move[REGNO (XEXP (PATTERN (insn), 0))] = 1;
-
- if (GET_CODE (PATTERN (insn)) == SET
- || GET_CODE (PATTERN (insn)) == CLOBBER)
- {
- dest = SET_DEST (PATTERN (insn));
- while (GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == STRICT_LOW_PART)
- dest = XEXP (dest, 0);
- if (GET_CODE (dest) == REG)
- {
- register int regno = REGNO (dest);
- /* If this is the first setting of this reg
- in current basic block, and it was set before,
- it must be set in two basic blocks, so it cannot
- be moved out of the loop. */
- if (n_times_set[regno] > 0 && last_set[regno] == 0)
- may_not_move[regno] = 1;
- /* If this is not first setting in current basic block,
- see if reg was used in between previous one and this.
- If so, neither one can be moved. */
- if (last_set[regno] != 0
- && reg_used_between_p (dest, last_set[regno], insn))
- may_not_move[regno] = 1;
- if (n_times_set[regno] < 127)
- ++n_times_set[regno];
- last_set[regno] = insn;
- }
- }
- else if (GET_CODE (PATTERN (insn)) == PARALLEL)
- {
- register int i;
- for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
- {
- register rtx x = XVECEXP (PATTERN (insn), 0, i);
- if (GET_CODE (x) == CLOBBER && GET_CODE (XEXP (x, 0)) == REG)
- /* Don't move a reg that has an explicit clobber.
- It's not worth the pain to try to do it correctly. */
- may_not_move[REGNO (XEXP (x, 0))] = 1;
-
- if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER)
- {
- dest = SET_DEST (x);
- while (GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == STRICT_LOW_PART)
- dest = XEXP (dest, 0);
- if (GET_CODE (dest) == REG)
- {
- register int regno = REGNO (dest);
- if (n_times_set[regno] > 0 && last_set[regno] == 0)
- may_not_move[regno] = 1;
- if (last_set[regno] != 0
- && reg_used_between_p (dest, last_set[regno], insn))
- may_not_move[regno] = 1;
- if (n_times_set[regno] < 127)
- ++n_times_set[regno];
- last_set[regno] = insn;
- }
- }
- }
- }
- }
-
- if (GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == JUMP_INSN)
- bzero ((char *) last_set, nregs * sizeof (rtx));
- }
- *count_ptr = count;
-}
-
-/* Given a loop that is bounded by LOOP_START and LOOP_END
- and that is entered at SCAN_START,
- return 1 if the register set in SET contained in insn INSN is used by
- any insn that precedes INSN in cyclic order starting
- from the loop entry point.
-
- We don't want to use INSN_LUID here because if we restrict INSN to those
- that have a valid INSN_LUID, it means we cannot move an invariant out
- from an inner loop past two loops. */
-
-static int
-loop_reg_used_before_p (set, insn, loop_start, scan_start, loop_end)
- rtx set, insn, loop_start, scan_start, loop_end;
-{
- rtx reg = SET_DEST (set);
- rtx p;
-
- /* Scan forward checking for register usage. If we hit INSN, we
- are done. Otherwise, if we hit LOOP_END, wrap around to LOOP_START. */
- for (p = scan_start; p != insn; p = NEXT_INSN (p))
- {
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
- && reg_overlap_mentioned_p (reg, PATTERN (p)))
- return 1;
-
- if (p == loop_end)
- p = loop_start;
- }
-
- return 0;
-}
-
-/* A "basic induction variable" or biv is a pseudo reg that is set
- (within this loop) only by incrementing or decrementing it. */
-/* A "general induction variable" or giv is a pseudo reg whose
- value is a linear function of a biv. */
-
-/* Bivs are recognized by `basic_induction_var';
- Givs by `general_induct_var'. */
-
-/* Indexed by register number, indicates whether or not register is an
- induction variable, and if so what type. */
-
-enum iv_mode *reg_iv_type;
-
-/* Indexed by register number, contains pointer to `struct induction'
- if register is an induction variable. This holds general info for
- all induction variables. */
-
-struct induction **reg_iv_info;
-
-/* Indexed by register number, contains pointer to `struct iv_class'
- if register is a basic induction variable. This holds info describing
- the class (a related group) of induction variables that the biv belongs
- to. */
-
-struct iv_class **reg_biv_class;
-
-/* The head of a list which links together (via the next field)
- every iv class for the current loop. */
-
-struct iv_class *loop_iv_list;
-
-/* Communication with routines called via `note_stores'. */
-
-static rtx note_insn;
-
-/* Dummy register to have non-zero DEST_REG for DEST_ADDR type givs. */
-
-static rtx addr_placeholder;
-
-/* ??? Unfinished optimizations, and possible future optimizations,
- for the strength reduction code. */
-
-/* ??? There is one more optimization you might be interested in doing: to
- allocate pseudo registers for frequently-accessed memory locations.
- If the same memory location is referenced each time around, it might
- be possible to copy it into a register before and out after.
- This is especially useful when the memory location is a variable which
- is in a stack slot because somewhere its address is taken. If the
- loop doesn't contain a function call and the variable isn't volatile,
- it is safe to keep the value in a register for the duration of the
- loop. One tricky thing is that the copying of the value back from the
- register has to be done on all exits from the loop. You need to check that
- all the exits from the loop go to the same place. */
-
-/* ??? The interaction of biv elimination, and recognition of 'constant'
- bivs, may cause problems. */
-
-/* ??? Add heuristics so that DEST_ADDR strength reduction does not cause
- performance problems.
-
- Perhaps don't eliminate things that can be combined with an addressing
- mode. Find all givs that have the same biv, mult_val, and add_val;
- then for each giv, check to see if its only use dies in a following
- memory address. If so, generate a new memory address and check to see
- if it is valid. If it is valid, then store the modified memory address,
- otherwise, mark the giv as not done so that it will get its own iv. */
-
-/* ??? Could try to optimize branches when it is known that a biv is always
- positive. */
-
-/* ??? When replace a biv in a compare insn, we should replace with closest
- giv so that an optimized branch can still be recognized by the combiner,
- e.g. the VAX acb insn. */
-
-/* ??? Many of the checks involving uid_luid could be simplified if regscan
- was rerun in loop_optimize whenever a register was added or moved.
- Also, some of the optimizations could be a little less conservative. */
-
-/* Perform strength reduction and induction variable elimination. */
-
-/* Pseudo registers created during this function will be beyond the last
- valid index in several tables including n_times_set and regno_last_uid.
- This does not cause a problem here, because the added registers cannot be
- givs outside of their loop, and hence will never be reconsidered.
- But scan_loop must check regnos to make sure they are in bounds. */
-
-static void
-strength_reduce (scan_start, end, loop_top, insn_count,
- loop_start, loop_end)
- rtx scan_start;
- rtx end;
- rtx loop_top;
- int insn_count;
- rtx loop_start;
- rtx loop_end;
-{
- rtx p;
- rtx set;
- rtx inc_val;
- rtx mult_val;
- rtx dest_reg;
- /* This is 1 if current insn is not executed at least once for every loop
- iteration. */
- int not_every_iteration = 0;
- /* This is 1 if current insn may be executed more than once for every
- loop iteration. */
- int maybe_multiple = 0;
- /* Temporary list pointers for traversing loop_iv_list. */
- struct iv_class *bl, **backbl;
- /* Ratio of extra register life span we can justify
- for saving an instruction. More if loop doesn't call subroutines
- since in that case saving an insn makes more difference
- and more registers are available. */
- /* ??? could set this to last value of threshold in move_movables */
- int threshold = (loop_has_call ? 1 : 2) * (3 + n_non_fixed_regs);
- /* Map of pseudo-register replacements. */
- rtx *reg_map;
- int call_seen;
- rtx test;
- rtx end_insert_before;
- int loop_depth = 0;
-
- reg_iv_type = (enum iv_mode *) alloca (max_reg_before_loop
- * sizeof (enum iv_mode *));
- bzero ((char *) reg_iv_type, max_reg_before_loop * sizeof (enum iv_mode *));
- reg_iv_info = (struct induction **)
- alloca (max_reg_before_loop * sizeof (struct induction *));
- bzero ((char *) reg_iv_info, (max_reg_before_loop
- * sizeof (struct induction *)));
- reg_biv_class = (struct iv_class **)
- alloca (max_reg_before_loop * sizeof (struct iv_class *));
- bzero ((char *) reg_biv_class, (max_reg_before_loop
- * sizeof (struct iv_class *)));
-
- loop_iv_list = 0;
- addr_placeholder = gen_reg_rtx (Pmode);
-
- /* Save insn immediately after the loop_end. Insns inserted after loop_end
- must be put before this insn, so that they will appear in the right
- order (i.e. loop order).
-
- If loop_end is the end of the current function, then emit a
- NOTE_INSN_DELETED after loop_end and set end_insert_before to the
- dummy note insn. */
- if (NEXT_INSN (loop_end) != 0)
- end_insert_before = NEXT_INSN (loop_end);
- else
- end_insert_before = emit_note_after (NOTE_INSN_DELETED, loop_end);
-
- /* Scan through loop to find all possible bivs. */
-
- p = scan_start;
- while (1)
- {
- p = NEXT_INSN (p);
- /* At end of a straight-in loop, we are done.
- At end of a loop entered at the bottom, scan the top. */
- if (p == scan_start)
- break;
- if (p == end)
- {
- if (loop_top != 0)
- p = loop_top;
- else
- break;
- if (p == scan_start)
- break;
- }
-
- if (GET_CODE (p) == INSN
- && (set = single_set (p))
- && GET_CODE (SET_DEST (set)) == REG)
- {
- dest_reg = SET_DEST (set);
- if (REGNO (dest_reg) < max_reg_before_loop
- && REGNO (dest_reg) >= FIRST_PSEUDO_REGISTER
- && reg_iv_type[REGNO (dest_reg)] != NOT_BASIC_INDUCT)
- {
- if (basic_induction_var (SET_SRC (set), GET_MODE (SET_SRC (set)),
- dest_reg, p, &inc_val, &mult_val))
- {
- /* It is a possible basic induction variable.
- Create and initialize an induction structure for it. */
-
- struct induction *v
- = (struct induction *) alloca (sizeof (struct induction));
-
- record_biv (v, p, dest_reg, inc_val, mult_val,
- not_every_iteration, maybe_multiple);
- reg_iv_type[REGNO (dest_reg)] = BASIC_INDUCT;
- }
- else if (REGNO (dest_reg) < max_reg_before_loop)
- reg_iv_type[REGNO (dest_reg)] = NOT_BASIC_INDUCT;
- }
- }
-
- /* Past CODE_LABEL, we get to insns that may be executed multiple
- times. The only way we can be sure that they can't is if every
- every jump insn between here and the end of the loop either
- returns, exits the loop, is a forward jump, or is a jump
- to the loop start. */
-
- if (GET_CODE (p) == CODE_LABEL)
- {
- rtx insn = p;
-
- maybe_multiple = 0;
-
- while (1)
- {
- insn = NEXT_INSN (insn);
- if (insn == scan_start)
- break;
- if (insn == end)
- {
- if (loop_top != 0)
- insn = loop_top;
- else
- break;
- if (insn == scan_start)
- break;
- }
-
- if (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) != RETURN
- && (! condjump_p (insn)
- || (JUMP_LABEL (insn) != 0
- && JUMP_LABEL (insn) != scan_start
- && (INSN_UID (JUMP_LABEL (insn)) >= max_uid_for_loop
- || INSN_UID (insn) >= max_uid_for_loop
- || (INSN_LUID (JUMP_LABEL (insn))
- < INSN_LUID (insn))))))
- {
- maybe_multiple = 1;
- break;
- }
- }
- }
-
- /* Past a jump, we get to insns for which we can't count
- on whether they will be executed during each iteration. */
- /* This code appears twice in strength_reduce. There is also similar
- code in scan_loop. */
- if (GET_CODE (p) == JUMP_INSN
- /* If we enter the loop in the middle, and scan around to the
- beginning, don't set not_every_iteration for that.
- This can be any kind of jump, since we want to know if insns
- will be executed if the loop is executed. */
- && ! (JUMP_LABEL (p) == loop_top
- && ((NEXT_INSN (NEXT_INSN (p)) == loop_end && simplejump_p (p))
- || (NEXT_INSN (p) == loop_end && condjump_p (p)))))
- {
- rtx label = 0;
-
- /* If this is a jump outside the loop, then it also doesn't
- matter. Check to see if the target of this branch is on the
- loop_number_exits_labels list. */
-
- for (label = loop_number_exit_labels[uid_loop_num[INSN_UID (loop_start)]];
- label;
- label = LABEL_NEXTREF (label))
- if (XEXP (label, 0) == JUMP_LABEL (p))
- break;
-
- if (! label)
- not_every_iteration = 1;
- }
-
- else if (GET_CODE (p) == NOTE)
- {
- /* At the virtual top of a converted loop, insns are again known to
- be executed each iteration: logically, the loop begins here
- even though the exit code has been duplicated. */
- if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_VTOP && loop_depth == 0)
- not_every_iteration = 0;
- else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_BEG)
- loop_depth++;
- else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_END)
- loop_depth--;
- }
-
- /* Unlike in the code motion pass where MAYBE_NEVER indicates that
- an insn may never be executed, NOT_EVERY_ITERATION indicates whether
- or not an insn is known to be executed each iteration of the
- loop, whether or not any iterations are known to occur.
-
- Therefore, if we have just passed a label and have no more labels
- between here and the test insn of the loop, we know these insns
- will be executed each iteration. */
-
- if (not_every_iteration && GET_CODE (p) == CODE_LABEL
- && no_labels_between_p (p, loop_end))
- not_every_iteration = 0;
- }
-
- /* Scan loop_iv_list to remove all regs that proved not to be bivs.
- Make a sanity check against n_times_set. */
- for (backbl = &loop_iv_list, bl = *backbl; bl; bl = bl->next)
- {
- if (reg_iv_type[bl->regno] != BASIC_INDUCT
- /* Above happens if register modified by subreg, etc. */
- /* Make sure it is not recognized as a basic induction var: */
- || n_times_set[bl->regno] != bl->biv_count
- /* If never incremented, it is invariant that we decided not to
- move. So leave it alone. */
- || ! bl->incremented)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Reg %d: biv discarded, %s\n",
- bl->regno,
- (reg_iv_type[bl->regno] != BASIC_INDUCT
- ? "not induction variable"
- : (! bl->incremented ? "never incremented"
- : "count error")));
-
- reg_iv_type[bl->regno] = NOT_BASIC_INDUCT;
- *backbl = bl->next;
- }
- else
- {
- backbl = &bl->next;
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Reg %d: biv verified\n", bl->regno);
- }
- }
-
- /* Exit if there are no bivs. */
- if (! loop_iv_list)
- {
- /* Can still unroll the loop anyways, but indicate that there is no
- strength reduction info available. */
- if (flag_unroll_loops)
- unroll_loop (loop_end, insn_count, loop_start, end_insert_before, 0);
-
- return;
- }
-
- /* Find initial value for each biv by searching backwards from loop_start,
- halting at first label. Also record any test condition. */
-
- call_seen = 0;
- for (p = loop_start; p && GET_CODE (p) != CODE_LABEL; p = PREV_INSN (p))
- {
- note_insn = p;
-
- if (GET_CODE (p) == CALL_INSN)
- call_seen = 1;
-
- if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN
- || GET_CODE (p) == CALL_INSN)
- note_stores (PATTERN (p), record_initial);
-
- /* Record any test of a biv that branches around the loop if no store
- between it and the start of loop. We only care about tests with
- constants and registers and only certain of those. */
- if (GET_CODE (p) == JUMP_INSN
- && JUMP_LABEL (p) != 0
- && next_real_insn (JUMP_LABEL (p)) == next_real_insn (loop_end)
- && (test = get_condition_for_loop (p)) != 0
- && GET_CODE (XEXP (test, 0)) == REG
- && REGNO (XEXP (test, 0)) < max_reg_before_loop
- && (bl = reg_biv_class[REGNO (XEXP (test, 0))]) != 0
- && valid_initial_value_p (XEXP (test, 1), p, call_seen, loop_start)
- && bl->init_insn == 0)
- {
- /* If an NE test, we have an initial value! */
- if (GET_CODE (test) == NE)
- {
- bl->init_insn = p;
- bl->init_set = gen_rtx (SET, VOIDmode,
- XEXP (test, 0), XEXP (test, 1));
- }
- else
- bl->initial_test = test;
- }
- }
-
- /* Look at the each biv and see if we can say anything better about its
- initial value from any initializing insns set up above. (This is done
- in two passes to avoid missing SETs in a PARALLEL.) */
- for (bl = loop_iv_list; bl; bl = bl->next)
- {
- rtx src;
-
- if (! bl->init_insn)
- continue;
-
- src = SET_SRC (bl->init_set);
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Biv %d initialized at insn %d: initial value ",
- bl->regno, INSN_UID (bl->init_insn));
-
- if ((GET_MODE (src) == GET_MODE (regno_reg_rtx[bl->regno])
- || GET_MODE (src) == VOIDmode)
- && valid_initial_value_p (src, bl->init_insn, call_seen, loop_start))
- {
- bl->initial_value = src;
-
- if (loop_dump_stream)
- {
- if (GET_CODE (src) == CONST_INT)
- fprintf (loop_dump_stream, "%d\n", INTVAL (src));
- else
- {
- print_rtl (loop_dump_stream, src);
- fprintf (loop_dump_stream, "\n");
- }
- }
- }
- else
- {
- /* Biv initial value is not simple move,
- so let it keep initial value of "itself". */
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "is complex\n");
- }
- }
-
- /* Search the loop for general induction variables. */
-
- /* A register is a giv if: it is only set once, it is a function of a
- biv and a constant (or invariant), and it is not a biv. */
-
- not_every_iteration = 0;
- loop_depth = 0;
- p = scan_start;
- while (1)
- {
- p = NEXT_INSN (p);
- /* At end of a straight-in loop, we are done.
- At end of a loop entered at the bottom, scan the top. */
- if (p == scan_start)
- break;
- if (p == end)
- {
- if (loop_top != 0)
- p = loop_top;
- else
- break;
- if (p == scan_start)
- break;
- }
-
- /* Look for a general induction variable in a register. */
- if (GET_CODE (p) == INSN
- && (set = single_set (p))
- && GET_CODE (SET_DEST (set)) == REG
- && ! may_not_optimize[REGNO (SET_DEST (set))])
- {
- rtx src_reg;
- rtx add_val;
- rtx mult_val;
- int benefit;
- rtx regnote = 0;
-
- dest_reg = SET_DEST (set);
- if (REGNO (dest_reg) < FIRST_PSEUDO_REGISTER)
- continue;
-
- if (/* SET_SRC is a giv. */
- ((benefit = general_induction_var (SET_SRC (set),
- &src_reg, &add_val,
- &mult_val))
- /* Equivalent expression is a giv. */
- || ((regnote = find_reg_note (p, REG_EQUAL, NULL_RTX))
- && (benefit = general_induction_var (XEXP (regnote, 0),
- &src_reg,
- &add_val, &mult_val))))
- /* Don't try to handle any regs made by loop optimization.
- We have nothing on them in regno_first_uid, etc. */
- && REGNO (dest_reg) < max_reg_before_loop
- /* Don't recognize a BASIC_INDUCT_VAR here. */
- && dest_reg != src_reg
- /* This must be the only place where the register is set. */
- && (n_times_set[REGNO (dest_reg)] == 1
- /* or all sets must be consecutive and make a giv. */
- || (benefit = consec_sets_giv (benefit, p,
- src_reg, dest_reg,
- &add_val, &mult_val))))
- {
- int count;
- struct induction *v
- = (struct induction *) alloca (sizeof (struct induction));
- rtx temp;
-
- /* If this is a library call, increase benefit. */
- if (find_reg_note (p, REG_RETVAL, NULL_RTX))
- benefit += libcall_benefit (p);
-
- /* Skip the consecutive insns, if there are any. */
- for (count = n_times_set[REGNO (dest_reg)] - 1;
- count > 0; count--)
- {
- /* If first insn of libcall sequence, skip to end.
- Do this at start of loop, since INSN is guaranteed to
- be an insn here. */
- if (GET_CODE (p) != NOTE
- && (temp = find_reg_note (p, REG_LIBCALL, NULL_RTX)))
- p = XEXP (temp, 0);
-
- do p = NEXT_INSN (p);
- while (GET_CODE (p) == NOTE);
- }
-
- record_giv (v, p, src_reg, dest_reg, mult_val, add_val, benefit,
- DEST_REG, not_every_iteration, NULL_PTR, loop_start,
- loop_end);
-
- }
- }
-
-#ifndef DONT_REDUCE_ADDR
- /* Look for givs which are memory addresses. */
- /* This resulted in worse code on a VAX 8600. I wonder if it
- still does. */
- if (GET_CODE (p) == INSN)
- find_mem_givs (PATTERN (p), p, not_every_iteration, loop_start,
- loop_end);
-#endif
-
- /* Update the status of whether giv can derive other givs. This can
- change when we pass a label or an insn that updates a biv. */
- if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN
- || GET_CODE (p) == CODE_LABEL)
- update_giv_derive (p);
-
- /* Past a jump, we get to insns for which we can't count
- on whether they will be executed during each iteration. */
- /* This code appears twice in strength_reduce. There is also similar
- code in scan_loop. */
- if (GET_CODE (p) == JUMP_INSN
- /* If we enter the loop in the middle, and scan around to the
- beginning, don't set not_every_iteration for that.
- This can be any kind of jump, since we want to know if insns
- will be executed if the loop is executed. */
- && ! (JUMP_LABEL (p) == loop_top
- && ((NEXT_INSN (NEXT_INSN (p)) == loop_end && simplejump_p (p))
- || (NEXT_INSN (p) == loop_end && condjump_p (p)))))
- {
- rtx label = 0;
-
- /* If this is a jump outside the loop, then it also doesn't
- matter. Check to see if the target of this branch is on the
- loop_number_exits_labels list. */
-
- for (label = loop_number_exit_labels[uid_loop_num[INSN_UID (loop_start)]];
- label;
- label = LABEL_NEXTREF (label))
- if (XEXP (label, 0) == JUMP_LABEL (p))
- break;
-
- if (! label)
- not_every_iteration = 1;
- }
-
- else if (GET_CODE (p) == NOTE)
- {
- /* At the virtual top of a converted loop, insns are again known to
- be executed each iteration: logically, the loop begins here
- even though the exit code has been duplicated. */
- if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_VTOP && loop_depth == 0)
- not_every_iteration = 0;
- else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_BEG)
- loop_depth++;
- else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_END)
- loop_depth--;
- }
-
- /* Unlike in the code motion pass where MAYBE_NEVER indicates that
- an insn may never be executed, NOT_EVERY_ITERATION indicates whether
- or not an insn is known to be executed each iteration of the
- loop, whether or not any iterations are known to occur.
-
- Therefore, if we have just passed a label and have no more labels
- between here and the test insn of the loop, we know these insns
- will be executed each iteration. */
-
- if (not_every_iteration && GET_CODE (p) == CODE_LABEL
- && no_labels_between_p (p, loop_end))
- not_every_iteration = 0;
- }
-
- /* Try to calculate and save the number of loop iterations. This is
- set to zero if the actual number can not be calculated. This must
- be called after all giv's have been identified, since otherwise it may
- fail if the iteration variable is a giv. */
-
- loop_n_iterations = loop_iterations (loop_start, loop_end);
-
- /* Now for each giv for which we still don't know whether or not it is
- replaceable, check to see if it is replaceable because its final value
- can be calculated. This must be done after loop_iterations is called,
- so that final_giv_value will work correctly. */
-
- for (bl = loop_iv_list; bl; bl = bl->next)
- {
- struct induction *v;
-
- for (v = bl->giv; v; v = v->next_iv)
- if (! v->replaceable && ! v->not_replaceable)
- check_final_value (v, loop_start, loop_end);
- }
-
- /* Try to prove that the loop counter variable (if any) is always
- nonnegative; if so, record that fact with a REG_NONNEG note
- so that "decrement and branch until zero" insn can be used. */
- check_dbra_loop (loop_end, insn_count, loop_start);
-
- /* Create reg_map to hold substitutions for replaceable giv regs. */
- reg_map = (rtx *) alloca (max_reg_before_loop * sizeof (rtx));
- bzero ((char *) reg_map, max_reg_before_loop * sizeof (rtx));
-
- /* Examine each iv class for feasibility of strength reduction/induction
- variable elimination. */
-
- for (bl = loop_iv_list; bl; bl = bl->next)
- {
- struct induction *v;
- int benefit;
- int all_reduced;
- rtx final_value = 0;
-
- /* Test whether it will be possible to eliminate this biv
- provided all givs are reduced. This is possible if either
- the reg is not used outside the loop, or we can compute
- what its final value will be.
-
- For architectures with a decrement_and_branch_until_zero insn,
- don't do this if we put a REG_NONNEG note on the endtest for
- this biv. */
-
- /* Compare against bl->init_insn rather than loop_start.
- We aren't concerned with any uses of the biv between
- init_insn and loop_start since these won't be affected
- by the value of the biv elsewhere in the function, so
- long as init_insn doesn't use the biv itself.
- March 14, 1989 -- self@bayes.arc.nasa.gov */
-
- if ((uid_luid[regno_last_uid[bl->regno]] < INSN_LUID (loop_end)
- && bl->init_insn
- && INSN_UID (bl->init_insn) < max_uid_for_loop
- && uid_luid[regno_first_uid[bl->regno]] >= INSN_LUID (bl->init_insn)
-#ifdef HAVE_decrement_and_branch_until_zero
- && ! bl->nonneg
-#endif
- && ! reg_mentioned_p (bl->biv->dest_reg, SET_SRC (bl->init_set)))
- || ((final_value = final_biv_value (bl, loop_start, loop_end))
-#ifdef HAVE_decrement_and_branch_until_zero
- && ! bl->nonneg
-#endif
- ))
- bl->eliminable = maybe_eliminate_biv (bl, loop_start, end, 0,
- threshold, insn_count);
- else
- {
- if (loop_dump_stream)
- {
- fprintf (loop_dump_stream,
- "Cannot eliminate biv %d.\n",
- bl->regno);
- fprintf (loop_dump_stream,
- "First use: insn %d, last use: insn %d.\n",
- regno_first_uid[bl->regno],
- regno_last_uid[bl->regno]);
- }
- }
-
- /* Combine all giv's for this iv_class. */
- combine_givs (bl);
-
- /* This will be true at the end, if all givs which depend on this
- biv have been strength reduced.
- We can't (currently) eliminate the biv unless this is so. */
- all_reduced = 1;
-
- /* Check each giv in this class to see if we will benefit by reducing
- it. Skip giv's combined with others. */
- for (v = bl->giv; v; v = v->next_iv)
- {
- struct induction *tv;
-
- if (v->ignore || v->same)
- continue;
-
- benefit = v->benefit;
-
- /* Reduce benefit if not replaceable, since we will insert
- a move-insn to replace the insn that calculates this giv.
- Don't do this unless the giv is a user variable, since it
- will often be marked non-replaceable because of the duplication
- of the exit code outside the loop. In such a case, the copies
- we insert are dead and will be deleted. So they don't have
- a cost. Similar situations exist. */
- /* ??? The new final_[bg]iv_value code does a much better job
- of finding replaceable giv's, and hence this code may no longer
- be necessary. */
- if (! v->replaceable && ! bl->eliminable
- && REG_USERVAR_P (v->dest_reg))
- benefit -= copy_cost;
-
- /* Decrease the benefit to count the add-insns that we will
- insert to increment the reduced reg for the giv. */
- benefit -= add_cost * bl->biv_count;
-
- /* 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. */
-
-#ifdef AUTO_INC_DEC
- /* Attempt to guess whether autoincrement will handle some of the
- new add insns; if so, increase BENEFIT (undo the subtraction of
- add_cost that was done above). */
- if (v->giv_type == DEST_ADDR
- && GET_CODE (v->mult_val) == CONST_INT)
- {
-#if defined (HAVE_POST_INCREMENT) || defined (HAVE_PRE_INCREMENT)
- if (INTVAL (v->mult_val) == GET_MODE_SIZE (v->mem_mode))
- benefit += add_cost * bl->biv_count;
-#endif
-#if defined (HAVE_POST_DECREMENT) || defined (HAVE_PRE_DECREMENT)
- if (-INTVAL (v->mult_val) == GET_MODE_SIZE (v->mem_mode))
- benefit += add_cost * bl->biv_count;
-#endif
- }
-#endif
-
- /* If an insn is not to be strength reduced, then set its ignore
- flag, and clear all_reduced. */
-
- /* A giv that depends on a reversed biv must be reduced if it is
- used after the loop exit, otherwise, it would have the wrong
- value after the loop exit. To make it simple, just reduce all
- of such giv's whether or not we know they are used after the loop
- exit. */
-
- if (v->lifetime * threshold * benefit < insn_count
- && ! bl->reversed)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "giv of insn %d not worth while, %d vs %d.\n",
- INSN_UID (v->insn),
- v->lifetime * threshold * benefit, insn_count);
- v->ignore = 1;
- all_reduced = 0;
- }
- else
- {
- /* Check that we can increment the reduced giv without a
- multiply insn. If not, reject it. */
-
- for (tv = bl->biv; tv; tv = tv->next_iv)
- if (tv->mult_val == const1_rtx
- && ! product_cheap_p (tv->add_val, v->mult_val))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "giv of insn %d: would need a multiply.\n",
- INSN_UID (v->insn));
- v->ignore = 1;
- all_reduced = 0;
- break;
- }
- }
- }
-
- /* Reduce each giv that we decided to reduce. */
-
- for (v = bl->giv; v; v = v->next_iv)
- {
- struct induction *tv;
- if (! v->ignore && v->same == 0)
- {
- int auto_inc_opt = 0;
-
- v->new_reg = gen_reg_rtx (v->mode);
-
-#ifdef AUTO_INC_DEC
- /* If the target has auto-increment addressing modes, and
- 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. */
- 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)
- {
- /* If other giv's have been combined with this one, then
- this will work only if all uses of the other giv's occur
- before this giv's insn. This is difficult to check.
-
- We simplify this by looking for the common case where
- there is one DEST_REG giv, and this giv's insn is the
- last use of the dest_reg of that DEST_REG giv. If the
- the increment occurs after the address giv, then we can
- perform the optimization. (Otherwise, the increment
- would have to go before other_giv, and we would not be
- able to combine it with the address giv to get an
- auto-inc address.) */
- if (v->combined_with)
- {
- struct induction *other_giv = 0;
-
- for (tv = bl->giv; tv; tv = tv->next_iv)
- if (tv->same == v)
- {
- if (other_giv)
- break;
- else
- other_giv = tv;
- }
- if (! tv && other_giv
- && (regno_last_uid[REGNO (other_giv->dest_reg)]
- == INSN_UID (v->insn))
- && INSN_LUID (v->insn) < INSN_LUID (bl->biv->insn))
- auto_inc_opt = 1;
- }
- /* Check for case where increment is before the the address
- giv. */
- else if (INSN_LUID (v->insn) > INSN_LUID (bl->biv->insn))
- auto_inc_opt = -1;
- else
- auto_inc_opt = 1;
-
-#ifdef HAVE_cc0
- {
- rtx prev;
-
- /* We can't put an insn immediately after one setting
- cc0, or immediately before one using cc0. */
- if ((auto_inc_opt == 1 && sets_cc0_p (PATTERN (v->insn)))
- || (auto_inc_opt == -1
- && (prev = prev_nonnote_insn (v->insn)) != 0
- && GET_RTX_CLASS (GET_CODE (prev)) == 'i'
- && sets_cc0_p (PATTERN (prev))))
- auto_inc_opt = 0;
- }
-#endif
-
- if (auto_inc_opt)
- v->auto_inc_opt = 1;
- }
-#endif
-
- /* For each place where the biv is incremented, add an insn
- to increment the new, reduced reg for the giv. */
- for (tv = bl->biv; tv; tv = tv->next_iv)
- {
- rtx insert_before;
-
- if (! auto_inc_opt)
- insert_before = tv->insn;
- else if (auto_inc_opt == 1)
- insert_before = NEXT_INSN (v->insn);
- else
- insert_before = v->insn;
-
- if (tv->mult_val == const1_rtx)
- emit_iv_add_mult (tv->add_val, v->mult_val,
- v->new_reg, v->new_reg, insert_before);
- else /* tv->mult_val == const0_rtx */
- /* A multiply is acceptable here
- since this is presumed to be seldom executed. */
- emit_iv_add_mult (tv->add_val, v->mult_val,
- v->add_val, v->new_reg, insert_before);
- }
-
- /* Add code at loop start to initialize giv's reduced reg. */
-
- emit_iv_add_mult (bl->initial_value, v->mult_val,
- v->add_val, v->new_reg, loop_start);
- }
- }
-
- /* Rescan all givs. If a giv is the same as a giv not reduced, mark it
- as not reduced.
-
- For each giv register that can be reduced now: if replaceable,
- substitute reduced reg wherever the old giv occurs;
- else add new move insn "giv_reg = reduced_reg".
-
- Also check for givs whose first use is their definition and whose
- last use is the definition of another giv. If so, it is likely
- dead and should not be used to eliminate a biv. */
- for (v = bl->giv; v; v = v->next_iv)
- {
- if (v->same && v->same->ignore)
- v->ignore = 1;
-
- if (v->ignore)
- continue;
-
- if (v->giv_type == DEST_REG
- && regno_first_uid[REGNO (v->dest_reg)] == INSN_UID (v->insn))
- {
- struct induction *v1;
-
- for (v1 = bl->giv; v1; v1 = v1->next_iv)
- if (regno_last_uid[REGNO (v->dest_reg)] == INSN_UID (v1->insn))
- v->maybe_dead = 1;
- }
-
- /* Update expression if this was combined, in case other giv was
- replaced. */
- if (v->same)
- v->new_reg = replace_rtx (v->new_reg,
- v->same->dest_reg, v->same->new_reg);
-
- if (v->giv_type == DEST_ADDR)
- /* Store reduced reg as the address in the memref where we found
- this giv. */
- validate_change (v->insn, v->location, v->new_reg, 0);
- else if (v->replaceable)
- {
- reg_map[REGNO (v->dest_reg)] = v->new_reg;
-
-#if 0
- /* I can no longer duplicate the original problem. Perhaps
- this is unnecessary now? */
-
- /* Replaceable; it isn't strictly necessary to delete the old
- insn and emit a new one, because v->dest_reg is now dead.
-
- However, especially when unrolling loops, the special
- handling for (set REG0 REG1) in the second cse pass may
- make v->dest_reg live again. To avoid this problem, emit
- an insn to set the original giv reg from the reduced giv.
- We can not delete the original insn, since it may be part
- of a LIBCALL, and the code in flow that eliminates dead
- libcalls will fail if it is deleted. */
- emit_insn_after (gen_move_insn (v->dest_reg, v->new_reg),
- v->insn);
-#endif
- }
- else
- {
- /* Not replaceable; emit an insn to set the original giv reg from
- the reduced giv, same as above. */
- emit_insn_after (gen_move_insn (v->dest_reg, v->new_reg),
- v->insn);
- }
-
- /* When a loop is reversed, givs which depend on the reversed
- biv, and which are live outside the loop, must be set to their
- correct final value. This insn is only needed if the giv is
- not replaceable. The correct final value is the same as the
- value that the giv starts the reversed loop with. */
- if (bl->reversed && ! v->replaceable)
- emit_iv_add_mult (bl->initial_value, v->mult_val,
- v->add_val, v->dest_reg, end_insert_before);
- else if (v->final_value)
- {
- rtx insert_before;
-
- /* If the loop has multiple exits, emit the insn before the
- loop to ensure that it will always be executed no matter
- how the loop exits. Otherwise, emit the insn after the loop,
- since this is slightly more efficient. */
- if (loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]])
- insert_before = loop_start;
- else
- insert_before = end_insert_before;
- emit_insn_before (gen_move_insn (v->dest_reg, v->final_value),
- insert_before);
-
-#if 0
- /* If the insn to set the final value of the giv was emitted
- before the loop, then we must delete the insn inside the loop
- that sets it. If this is a LIBCALL, then we must delete
- every insn in the libcall. Note, however, that
- final_giv_value will only succeed when there are multiple
- exits if the giv is dead at each exit, hence it does not
- matter that the original insn remains because it is dead
- anyways. */
- /* Delete the insn inside the loop that sets the giv since
- the giv is now set before (or after) the loop. */
- delete_insn (v->insn);
-#endif
- }
-
- if (loop_dump_stream)
- {
- fprintf (loop_dump_stream, "giv at %d reduced to ",
- INSN_UID (v->insn));
- print_rtl (loop_dump_stream, v->new_reg);
- fprintf (loop_dump_stream, "\n");
- }
- }
-
- /* All the givs based on the biv bl have been reduced if they
- merit it. */
-
- /* For each giv not marked as maybe dead that has been combined with a
- second giv, clear any "maybe dead" mark on that second giv.
- v->new_reg will either be or refer to the register of the giv it
- combined with.
-
- Doing this clearing avoids problems in biv elimination where a
- giv's new_reg is a complex value that can't be put in the insn but
- the giv combined with (with a reg as new_reg) is marked maybe_dead.
- Since the register will be used in either case, we'd prefer it be
- used from the simpler giv. */
-
- for (v = bl->giv; v; v = v->next_iv)
- if (! v->maybe_dead && v->same)
- v->same->maybe_dead = 0;
-
- /* Try to eliminate the biv, if it is a candidate.
- This won't work if ! all_reduced,
- since the givs we planned to use might not have been reduced.
-
- We have to be careful that we didn't initially think we could eliminate
- this biv because of a giv that we now think may be dead and shouldn't
- be used as a biv replacement.
-
- Also, there is the possibility that we may have a giv that looks
- like it can be used to eliminate a biv, but the resulting insn
- isn't valid. This can happen, for example, on the 88k, where a
- JUMP_INSN can compare a register only with zero. Attempts to
- replace it with a compare with a constant will fail.
-
- Note that in cases where this call fails, we may have replaced some
- of the occurrences of the biv with a giv, but no harm was done in
- doing so in the rare cases where it can occur. */
-
- if (all_reduced == 1 && bl->eliminable
- && maybe_eliminate_biv (bl, loop_start, end, 1,
- threshold, insn_count))
-
- {
- /* ?? If we created a new test to bypass the loop entirely,
- or otherwise drop straight in, based on this test, then
- we might want to rewrite it also. This way some later
- pass has more hope of removing the initialization of this
- biv entirely. */
-
- /* If final_value != 0, then the biv may be used after loop end
- and we must emit an insn to set it just in case.
-
- Reversed bivs already have an insn after the loop setting their
- value, so we don't need another one. We can't calculate the
- proper final value for such a biv here anyways. */
- if (final_value != 0 && ! bl->reversed)
- {
- rtx insert_before;
-
- /* If the loop has multiple exits, emit the insn before the
- loop to ensure that it will always be executed no matter
- how the loop exits. Otherwise, emit the insn after the
- loop, since this is slightly more efficient. */
- if (loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]])
- insert_before = loop_start;
- else
- insert_before = end_insert_before;
-
- emit_insn_before (gen_move_insn (bl->biv->dest_reg, final_value),
- end_insert_before);
- }
-
-#if 0
- /* Delete all of the instructions inside the loop which set
- the biv, as they are all dead. If is safe to delete them,
- because an insn setting a biv will never be part of a libcall. */
- /* However, deleting them will invalidate the regno_last_uid info,
- so keeping them around is more convenient. Final_biv_value
- will only succeed when there are multiple exits if the biv
- is dead at each exit, hence it does not matter that the original
- insn remains, because it is dead anyways. */
- for (v = bl->biv; v; v = v->next_iv)
- delete_insn (v->insn);
-#endif
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Reg %d: biv eliminated\n",
- bl->regno);
- }
- }
-
- /* Go through all the instructions in the loop, making all the
- register substitutions scheduled in REG_MAP. */
-
- for (p = loop_start; p != end; p = NEXT_INSN (p))
- if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN
- || GET_CODE (p) == CALL_INSN)
- {
- replace_regs (PATTERN (p), reg_map, max_reg_before_loop, 0);
- replace_regs (REG_NOTES (p), reg_map, max_reg_before_loop, 0);
- INSN_CODE (p) = -1;
- }
-
- /* Unroll loops from within strength reduction so that we can use the
- induction variable information that strength_reduce has already
- collected. */
-
- if (flag_unroll_loops)
- unroll_loop (loop_end, insn_count, loop_start, end_insert_before, 1);
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "\n");
-}
-
-/* Return 1 if X is a valid source for an initial value (or as value being
- compared against in an initial test).
-
- X must be either a register or constant and must not be clobbered between
- the current insn and the start of the loop.
-
- INSN is the insn containing X. */
-
-static int
-valid_initial_value_p (x, insn, call_seen, loop_start)
- rtx x;
- rtx insn;
- int call_seen;
- rtx loop_start;
-{
- if (CONSTANT_P (x))
- return 1;
-
- /* Only consider pseudos we know about initialized in insns whose luids
- we know. */
- if (GET_CODE (x) != REG
- || REGNO (x) >= max_reg_before_loop)
- return 0;
-
- /* Don't use call-clobbered registers across a call which clobbers it. On
- some machines, don't use any hard registers at all. */
- if (REGNO (x) < FIRST_PSEUDO_REGISTER
- && (
-#ifdef SMALL_REGISTER_CLASSES
- SMALL_REGISTER_CLASSES
-#else
- 0
-#endif
- || (call_used_regs[REGNO (x)] && call_seen))
- )
- return 0;
-
- /* Don't use registers that have been clobbered before the start of the
- loop. */
- if (reg_set_between_p (x, insn, loop_start))
- return 0;
-
- return 1;
-}
-
-/* Scan X for memory refs and check each memory address
- as a possible giv. INSN is the insn whose pattern X comes from.
- NOT_EVERY_ITERATION is 1 if the insn might not be executed during
- every loop iteration. */
-
-static void
-find_mem_givs (x, insn, not_every_iteration, loop_start, loop_end)
- rtx x;
- rtx insn;
- int not_every_iteration;
- rtx loop_start, loop_end;
-{
- register int i, j;
- register enum rtx_code code;
- register char *fmt;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
- switch (code)
- {
- case REG:
- case CONST_INT:
- case CONST:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- case PC:
- case CC0:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case USE:
- case CLOBBER:
- return;
-
- case MEM:
- {
- rtx src_reg;
- rtx add_val;
- rtx mult_val;
- int benefit;
-
- benefit = general_induction_var (XEXP (x, 0),
- &src_reg, &add_val, &mult_val);
-
- /* Don't make a DEST_ADDR giv with mult_val == 1 && add_val == 0.
- Such a giv isn't useful. */
- if (benefit > 0 && (mult_val != const1_rtx || add_val != const0_rtx))
- {
- /* Found one; record it. */
- struct induction *v
- = (struct induction *) oballoc (sizeof (struct induction));
-
- record_giv (v, insn, src_reg, addr_placeholder, mult_val,
- add_val, benefit, DEST_ADDR, not_every_iteration,
- &XEXP (x, 0), loop_start, loop_end);
-
- v->mem_mode = GET_MODE (x);
- }
- return;
- }
- }
-
- /* Recursively scan the subexpressions for other mem refs. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- find_mem_givs (XEXP (x, i), insn, not_every_iteration, loop_start,
- loop_end);
- else if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- find_mem_givs (XVECEXP (x, i, j), insn, not_every_iteration,
- loop_start, loop_end);
-}
-
-/* Fill in the data about one biv update.
- V is the `struct induction' in which we record the biv. (It is
- allocated by the caller, with alloca.)
- INSN is the insn that sets it.
- DEST_REG is the biv's reg.
-
- MULT_VAL is const1_rtx if the biv is being incremented here, in which case
- INC_VAL is the increment. Otherwise, MULT_VAL is const0_rtx and the biv is
- being set to INC_VAL.
-
- NOT_EVERY_ITERATION is nonzero if this biv update is not know to be
- executed every iteration; MAYBE_MULTIPLE is nonzero if this biv update
- can be executed more than once per iteration. If MAYBE_MULTIPLE
- and NOT_EVERY_ITERATION are both zero, we know that the biv update is
- executed exactly once per iteration. */
-
-static void
-record_biv (v, insn, dest_reg, inc_val, mult_val,
- not_every_iteration, maybe_multiple)
- struct induction *v;
- rtx insn;
- rtx dest_reg;
- rtx inc_val;
- rtx mult_val;
- int not_every_iteration;
- int maybe_multiple;
-{
- struct iv_class *bl;
-
- v->insn = insn;
- v->src_reg = dest_reg;
- v->dest_reg = dest_reg;
- v->mult_val = mult_val;
- v->add_val = inc_val;
- v->mode = GET_MODE (dest_reg);
- v->always_computable = ! not_every_iteration;
- v->always_executed = ! not_every_iteration;
- v->maybe_multiple = maybe_multiple;
-
- /* Add this to the reg's iv_class, creating a class
- if this is the first incrementation of the reg. */
-
- bl = reg_biv_class[REGNO (dest_reg)];
- if (bl == 0)
- {
- /* Create and initialize new iv_class. */
-
- bl = (struct iv_class *) oballoc (sizeof (struct iv_class));
-
- bl->regno = REGNO (dest_reg);
- bl->biv = 0;
- bl->giv = 0;
- bl->biv_count = 0;
- bl->giv_count = 0;
-
- /* Set initial value to the reg itself. */
- bl->initial_value = dest_reg;
- /* We haven't seen the initializing insn yet */
- bl->init_insn = 0;
- bl->init_set = 0;
- bl->initial_test = 0;
- bl->incremented = 0;
- bl->eliminable = 0;
- bl->nonneg = 0;
- bl->reversed = 0;
- bl->total_benefit = 0;
-
- /* Add this class to loop_iv_list. */
- bl->next = loop_iv_list;
- loop_iv_list = bl;
-
- /* Put it in the array of biv register classes. */
- reg_biv_class[REGNO (dest_reg)] = bl;
- }
-
- /* Update IV_CLASS entry for this biv. */
- v->next_iv = bl->biv;
- bl->biv = v;
- bl->biv_count++;
- if (mult_val == const1_rtx)
- bl->incremented = 1;
-
- if (loop_dump_stream)
- {
- fprintf (loop_dump_stream,
- "Insn %d: possible biv, reg %d,",
- INSN_UID (insn), REGNO (dest_reg));
- if (GET_CODE (inc_val) == CONST_INT)
- fprintf (loop_dump_stream, " const = %d\n",
- INTVAL (inc_val));
- else
- {
- fprintf (loop_dump_stream, " const = ");
- print_rtl (loop_dump_stream, inc_val);
- fprintf (loop_dump_stream, "\n");
- }
- }
-}
-
-/* Fill in the data about one giv.
- V is the `struct induction' in which we record the giv. (It is
- allocated by the caller, with alloca.)
- INSN is the insn that sets it.
- BENEFIT estimates the savings from deleting this insn.
- TYPE is DEST_REG or DEST_ADDR; it says whether the giv is computed
- into a register or is used as a memory address.
-
- SRC_REG is the biv reg which the giv is computed from.
- DEST_REG is the giv's reg (if the giv is stored in a reg).
- MULT_VAL and ADD_VAL are the coefficients used to compute the giv.
- LOCATION points to the place where this giv's value appears in INSN. */
-
-static void
-record_giv (v, insn, src_reg, dest_reg, mult_val, add_val, benefit,
- type, not_every_iteration, location, loop_start, loop_end)
- struct induction *v;
- rtx insn;
- rtx src_reg;
- rtx dest_reg;
- rtx mult_val, add_val;
- int benefit;
- enum g_types type;
- int not_every_iteration;
- rtx *location;
- rtx loop_start, loop_end;
-{
- struct induction *b;
- struct iv_class *bl;
- rtx set = single_set (insn);
- rtx p;
-
- v->insn = insn;
- v->src_reg = src_reg;
- v->giv_type = type;
- v->dest_reg = dest_reg;
- v->mult_val = mult_val;
- v->add_val = add_val;
- v->benefit = benefit;
- v->location = location;
- v->cant_derive = 0;
- v->combined_with = 0;
- v->maybe_multiple = 0;
- v->maybe_dead = 0;
- v->derive_adjustment = 0;
- v->same = 0;
- v->ignore = 0;
- v->new_reg = 0;
- v->final_value = 0;
- v->same_insn = 0;
- v->auto_inc_opt = 0;
-
- /* The v->always_computable field is used in update_giv_derive, to
- determine whether a giv can be used to derive another giv. For a
- DEST_REG giv, INSN computes a new value for the giv, so its value
- isn't computable if INSN insn't executed every iteration.
- However, for a DEST_ADDR giv, INSN merely uses the value of the giv;
- it does not compute a new value. Hence the value is always computable
- regardless of whether INSN is executed each iteration. */
-
- if (type == DEST_ADDR)
- v->always_computable = 1;
- else
- v->always_computable = ! not_every_iteration;
-
- v->always_executed = ! not_every_iteration;
-
- if (type == DEST_ADDR)
- {
- v->mode = GET_MODE (*location);
- v->lifetime = 1;
- v->times_used = 1;
- }
- else /* type == DEST_REG */
- {
- v->mode = GET_MODE (SET_DEST (set));
-
- v->lifetime = (uid_luid[regno_last_uid[REGNO (dest_reg)]]
- - uid_luid[regno_first_uid[REGNO (dest_reg)]]);
-
- v->times_used = n_times_used[REGNO (dest_reg)];
-
- /* If the lifetime is zero, it means that this register is
- really a dead store. So mark this as a giv that can be
- ignored. This will not prevent the biv from being eliminated. */
- if (v->lifetime == 0)
- v->ignore = 1;
-
- reg_iv_type[REGNO (dest_reg)] = GENERAL_INDUCT;
- reg_iv_info[REGNO (dest_reg)] = v;
- }
-
- /* Add the giv to the class of givs computed from one biv. */
-
- bl = reg_biv_class[REGNO (src_reg)];
- if (bl)
- {
- v->next_iv = bl->giv;
- bl->giv = v;
- /* Don't count DEST_ADDR. This is supposed to count the number of
- insns that calculate givs. */
- if (type == DEST_REG)
- bl->giv_count++;
- bl->total_benefit += benefit;
- }
- else
- /* Fatal error, biv missing for this giv? */
- abort ();
-
- if (type == DEST_ADDR)
- v->replaceable = 1;
- else
- {
- /* The giv can be replaced outright by the reduced register only if all
- of the following conditions are true:
- - the insn that sets the giv is always executed on any iteration
- on which the giv is used at all
- (there are two ways to deduce this:
- either the insn is executed on every iteration,
- or all uses follow that insn in the same basic block),
- - the giv is not used outside the loop
- - no assignments to the biv occur during the giv's lifetime. */
-
- if (regno_first_uid[REGNO (dest_reg)] == INSN_UID (insn)
- /* Previous line always fails if INSN was moved by loop opt. */
- && uid_luid[regno_last_uid[REGNO (dest_reg)]] < INSN_LUID (loop_end)
- && (! not_every_iteration
- || last_use_this_basic_block (dest_reg, insn)))
- {
- /* Now check that there are no assignments to the biv within the
- giv's lifetime. This requires two separate checks. */
-
- /* Check each biv update, and fail if any are between the first
- and last use of the giv.
-
- If this loop contains an inner loop that was unrolled, then
- the insn modifying the biv may have been emitted by the loop
- unrolling code, and hence does not have a valid luid. Just
- mark the biv as not replaceable in this case. It is not very
- useful as a biv, because it is used in two different loops.
- It is very unlikely that we would be able to optimize the giv
- using this biv anyways. */
-
- v->replaceable = 1;
- for (b = bl->biv; b; b = b->next_iv)
- {
- if (INSN_UID (b->insn) >= max_uid_for_loop
- || ((uid_luid[INSN_UID (b->insn)]
- >= uid_luid[regno_first_uid[REGNO (dest_reg)]])
- && (uid_luid[INSN_UID (b->insn)]
- <= uid_luid[regno_last_uid[REGNO (dest_reg)]])))
- {
- v->replaceable = 0;
- v->not_replaceable = 1;
- break;
- }
- }
-
- /* If there are any backwards branches that go from after the
- biv update to before it, then this giv is not replaceable. */
- if (v->replaceable)
- for (b = bl->biv; b; b = b->next_iv)
- if (back_branch_in_range_p (b->insn, loop_start, loop_end))
- {
- v->replaceable = 0;
- v->not_replaceable = 1;
- break;
- }
- }
- else
- {
- /* May still be replaceable, we don't have enough info here to
- decide. */
- v->replaceable = 0;
- v->not_replaceable = 0;
- }
- }
-
- if (loop_dump_stream)
- {
- if (type == DEST_REG)
- fprintf (loop_dump_stream, "Insn %d: giv reg %d",
- INSN_UID (insn), REGNO (dest_reg));
- else
- fprintf (loop_dump_stream, "Insn %d: dest address",
- INSN_UID (insn));
-
- fprintf (loop_dump_stream, " src reg %d benefit %d",
- REGNO (src_reg), v->benefit);
- fprintf (loop_dump_stream, " used %d lifetime %d",
- v->times_used, v->lifetime);
-
- if (v->replaceable)
- fprintf (loop_dump_stream, " replaceable");
-
- if (GET_CODE (mult_val) == CONST_INT)
- fprintf (loop_dump_stream, " mult %d",
- INTVAL (mult_val));
- else
- {
- fprintf (loop_dump_stream, " mult ");
- print_rtl (loop_dump_stream, mult_val);
- }
-
- if (GET_CODE (add_val) == CONST_INT)
- fprintf (loop_dump_stream, " add %d",
- INTVAL (add_val));
- else
- {
- fprintf (loop_dump_stream, " add ");
- print_rtl (loop_dump_stream, add_val);
- }
- }
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "\n");
-
-}
-
-
-/* All this does is determine whether a giv can be made replaceable because
- its final value can be calculated. This code can not be part of record_giv
- above, because final_giv_value requires that the number of loop iterations
- be known, and that can not be accurately calculated until after all givs
- have been identified. */
-
-static void
-check_final_value (v, loop_start, loop_end)
- struct induction *v;
- rtx loop_start, loop_end;
-{
- struct iv_class *bl;
- rtx final_value = 0;
-
- bl = reg_biv_class[REGNO (v->src_reg)];
-
- /* DEST_ADDR givs will never reach here, because they are always marked
- replaceable above in record_giv. */
-
- /* The giv can be replaced outright by the reduced register only if all
- of the following conditions are true:
- - the insn that sets the giv is always executed on any iteration
- on which the giv is used at all
- (there are two ways to deduce this:
- either the insn is executed on every iteration,
- or all uses follow that insn in the same basic block),
- - its final value can be calculated (this condition is different
- than the one above in record_giv)
- - no assignments to the biv occur during the giv's lifetime. */
-
-#if 0
- /* This is only called now when replaceable is known to be false. */
- /* Clear replaceable, so that it won't confuse final_giv_value. */
- v->replaceable = 0;
-#endif
-
- if ((final_value = final_giv_value (v, loop_start, loop_end))
- && (v->always_computable || last_use_this_basic_block (v->dest_reg, v->insn)))
- {
- int biv_increment_seen = 0;
- rtx p = v->insn;
- rtx last_giv_use;
-
- v->replaceable = 1;
-
- /* When trying to determine whether or not a biv increment occurs
- during the lifetime of the giv, we can ignore uses of the variable
- outside the loop because final_value is true. Hence we can not
- use regno_last_uid and regno_first_uid as above in record_giv. */
-
- /* Search the loop to determine whether any assignments to the
- biv occur during the giv's lifetime. Start with the insn
- that sets the giv, and search around the loop until we come
- back to that insn again.
-
- Also fail if there is a jump within the giv's lifetime that jumps
- to somewhere outside the lifetime but still within the loop. This
- catches spaghetti code where the execution order is not linear, and
- hence the above test fails. Here we assume that the giv lifetime
- does not extend from one iteration of the loop to the next, so as
- to make the test easier. Since the lifetime isn't known yet,
- this requires two loops. See also record_giv above. */
-
- last_giv_use = v->insn;
-
- while (1)
- {
- p = NEXT_INSN (p);
- if (p == loop_end)
- p = NEXT_INSN (loop_start);
- if (p == v->insn)
- break;
-
- if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN
- || GET_CODE (p) == CALL_INSN)
- {
- if (biv_increment_seen)
- {
- if (reg_mentioned_p (v->dest_reg, PATTERN (p)))
- {
- v->replaceable = 0;
- v->not_replaceable = 1;
- break;
- }
- }
- else if (GET_CODE (PATTERN (p)) == SET
- && SET_DEST (PATTERN (p)) == v->src_reg)
- biv_increment_seen = 1;
- else if (reg_mentioned_p (v->dest_reg, PATTERN (p)))
- last_giv_use = p;
- }
- }
-
- /* Now that the lifetime of the giv is known, check for branches
- from within the lifetime to outside the lifetime if it is still
- replaceable. */
-
- if (v->replaceable)
- {
- p = v->insn;
- while (1)
- {
- p = NEXT_INSN (p);
- if (p == loop_end)
- p = NEXT_INSN (loop_start);
- if (p == last_giv_use)
- break;
-
- if (GET_CODE (p) == JUMP_INSN && JUMP_LABEL (p)
- && LABEL_NAME (JUMP_LABEL (p))
- && ((INSN_UID (JUMP_LABEL (p)) >= max_uid_for_loop)
- || (INSN_UID (v->insn) >= max_uid_for_loop)
- || (INSN_UID (last_giv_use) >= max_uid_for_loop)
- || (INSN_LUID (JUMP_LABEL (p)) < INSN_LUID (v->insn)
- && INSN_LUID (JUMP_LABEL (p)) > INSN_LUID (loop_start))
- || (INSN_LUID (JUMP_LABEL (p)) > INSN_LUID (last_giv_use)
- && INSN_LUID (JUMP_LABEL (p)) < INSN_LUID (loop_end))))
- {
- v->replaceable = 0;
- v->not_replaceable = 1;
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Found branch outside giv lifetime.\n");
-
- break;
- }
- }
- }
-
- /* If it is replaceable, then save the final value. */
- if (v->replaceable)
- v->final_value = final_value;
- }
-
- if (loop_dump_stream && v->replaceable)
- fprintf (loop_dump_stream, "Insn %d: giv reg %d final_value replaceable\n",
- INSN_UID (v->insn), REGNO (v->dest_reg));
-}
-
-/* Update the status of whether a giv can derive other givs.
-
- We need to do something special if there is or may be an update to the biv
- between the time the giv is defined and the time it is used to derive
- another giv.
-
- In addition, a giv that is only conditionally set is not allowed to
- derive another giv once a label has been passed.
-
- The cases we look at are when a label or an update to a biv is passed. */
-
-static void
-update_giv_derive (p)
- rtx p;
-{
- struct iv_class *bl;
- struct induction *biv, *giv;
- rtx tem;
- int dummy;
-
- /* Search all IV classes, then all bivs, and finally all givs.
-
- There are three cases we are concerned with. First we have the situation
- of a giv that is only updated conditionally. In that case, it may not
- derive any givs after a label is passed.
-
- The second case is when a biv update occurs, or may occur, after the
- definition of a giv. For certain biv updates (see below) that are
- known to occur between the giv definition and use, we can adjust the
- giv definition. For others, or when the biv update is conditional,
- we must prevent the giv from deriving any other givs. There are two
- sub-cases within this case.
-
- If this is a label, we are concerned with any biv update that is done
- conditionally, since it may be done after the giv is defined followed by
- a branch here (actually, we need to pass both a jump and a label, but
- this extra tracking doesn't seem worth it).
-
- If this is a jump, we are concerned about any biv update that may be
- executed multiple times. We are actually only concerned about
- backward jumps, but it is probably not worth performing the test
- on the jump again here.
-
- If this is a biv update, we must adjust the giv status to show that a
- subsequent biv update was performed. If this adjustment cannot be done,
- the giv cannot derive further givs. */
-
- for (bl = loop_iv_list; bl; bl = bl->next)
- for (biv = bl->biv; biv; biv = biv->next_iv)
- if (GET_CODE (p) == CODE_LABEL || GET_CODE (p) == JUMP_INSN
- || biv->insn == p)
- {
- for (giv = bl->giv; giv; giv = giv->next_iv)
- {
- /* If cant_derive is already true, there is no point in
- checking all of these conditions again. */
- if (giv->cant_derive)
- continue;
-
- /* If this giv is conditionally set and we have passed a label,
- it cannot derive anything. */
- if (GET_CODE (p) == CODE_LABEL && ! giv->always_computable)
- giv->cant_derive = 1;
-
- /* Skip givs that have mult_val == 0, since
- they are really invariants. Also skip those that are
- replaceable, since we know their lifetime doesn't contain
- any biv update. */
- else if (giv->mult_val == const0_rtx || giv->replaceable)
- continue;
-
- /* The only way we can allow this giv to derive another
- is if this is a biv increment and we can form the product
- of biv->add_val and giv->mult_val. In this case, we will
- be able to compute a compensation. */
- else if (biv->insn == p)
- {
- tem = 0;
-
- if (biv->mult_val == const1_rtx)
- tem = simplify_giv_expr (gen_rtx (MULT, giv->mode,
- biv->add_val,
- giv->mult_val),
- &dummy);
-
- if (tem && giv->derive_adjustment)
- tem = simplify_giv_expr (gen_rtx (PLUS, giv->mode, tem,
- giv->derive_adjustment),
- &dummy);
- if (tem)
- giv->derive_adjustment = tem;
- else
- giv->cant_derive = 1;
- }
- else if ((GET_CODE (p) == CODE_LABEL && ! biv->always_computable)
- || (GET_CODE (p) == JUMP_INSN && biv->maybe_multiple))
- giv->cant_derive = 1;
- }
- }
-}
-
-/* Check whether an insn is an increment legitimate for a basic induction var.
- X is the source of insn P, or a part of it.
- MODE is the mode in which X should be interpreted.
-
- DEST_REG is the putative biv, also the destination of the insn.
- We accept patterns of these forms:
- REG = REG + INVARIANT (includes REG = REG - CONSTANT)
- REG = INVARIANT + REG
-
- If X is suitable, we return 1, set *MULT_VAL to CONST1_RTX,
- and store the additive term into *INC_VAL.
-
- If X is an assignment of an invariant into DEST_REG, we set
- *MULT_VAL to CONST0_RTX, and store the invariant into *INC_VAL.
-
- We also want to detect a BIV when it corresponds to a variable
- whose mode was promoted via PROMOTED_MODE. In that case, an increment
- of the variable may be a PLUS that adds a SUBREG of that variable to
- an invariant and then sign- or zero-extends the result of the PLUS
- into the variable.
-
- Most GIVs in such cases will be in the promoted mode, since that is the
- probably the natural computation mode (and almost certainly the mode
- used for addresses) on the machine. So we view the pseudo-reg containing
- the variable as the BIV, as if it were simply incremented.
-
- Note that treating the entire pseudo as a BIV will result in making
- simple increments to any GIVs based on it. However, if the variable
- overflows in its declared mode but not its promoted mode, the result will
- be incorrect. This is acceptable if the variable is signed, since
- overflows in such cases are undefined, but not if it is unsigned, since
- those overflows are defined. So we only check for SIGN_EXTEND and
- not ZERO_EXTEND.
-
- If we cannot find a biv, we return 0. */
-
-static int
-basic_induction_var (x, mode, dest_reg, p, inc_val, mult_val)
- register rtx x;
- enum machine_mode mode;
- rtx p;
- rtx dest_reg;
- rtx *inc_val;
- rtx *mult_val;
-{
- register enum rtx_code code;
- rtx arg;
- rtx insn, set = 0;
-
- code = GET_CODE (x);
- switch (code)
- {
- case PLUS:
- if (XEXP (x, 0) == dest_reg
- || (GET_CODE (XEXP (x, 0)) == SUBREG
- && SUBREG_PROMOTED_VAR_P (XEXP (x, 0))
- && SUBREG_REG (XEXP (x, 0)) == dest_reg))
- arg = XEXP (x, 1);
- else if (XEXP (x, 1) == dest_reg
- || (GET_CODE (XEXP (x, 1)) == SUBREG
- && SUBREG_PROMOTED_VAR_P (XEXP (x, 1))
- && SUBREG_REG (XEXP (x, 1)) == dest_reg))
- arg = XEXP (x, 0);
- else
- return 0;
-
- if (invariant_p (arg) != 1)
- return 0;
-
- *inc_val = convert_modes (GET_MODE (dest_reg), GET_MODE (x), arg, 0);
- *mult_val = const1_rtx;
- return 1;
-
- case SUBREG:
- /* If this is a SUBREG for a promoted variable, check the inner
- value. */
- if (SUBREG_PROMOTED_VAR_P (x))
- return basic_induction_var (SUBREG_REG (x), GET_MODE (SUBREG_REG (x)),
- dest_reg, p, inc_val, mult_val);
- return 0;
-
- case REG:
- /* If this register is assigned in the previous insn, look at its
- source, but don't go outside the loop or past a label. */
-
- for (insn = PREV_INSN (p);
- (insn && GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_BEG);
- insn = PREV_INSN (insn))
- ;
-
- if (insn)
- set = single_set (insn);
-
- if (set != 0
- && (SET_DEST (set) == x
- || (GET_CODE (SET_DEST (set)) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (SET_DEST (set)))
- <= UNITS_PER_WORD)
- && SUBREG_REG (SET_DEST (set)) == x)))
- return basic_induction_var (SET_SRC (set),
- (GET_MODE (SET_SRC (set)) == VOIDmode
- ? GET_MODE (x)
- : GET_MODE (SET_SRC (set))),
- dest_reg, insn,
- inc_val, mult_val);
- /* ... fall through ... */
-
- /* Can accept constant setting of biv only when inside inner most loop.
- Otherwise, a biv of an inner loop may be incorrectly recognized
- as a biv of the outer loop,
- causing code to be moved INTO the inner loop. */
- case MEM:
- if (invariant_p (x) != 1)
- return 0;
- case CONST_INT:
- case SYMBOL_REF:
- case CONST:
- if (loops_enclosed == 1)
- {
- /* Possible bug here? Perhaps we don't know the mode of X. */
- *inc_val = convert_modes (GET_MODE (dest_reg), mode, x, 0);
- *mult_val = const0_rtx;
- return 1;
- }
- else
- return 0;
-
- case SIGN_EXTEND:
- return basic_induction_var (XEXP (x, 0), GET_MODE (XEXP (x, 0)),
- dest_reg, p, inc_val, mult_val);
- case ASHIFTRT:
- /* Similar, since this can be a sign extension. */
- for (insn = PREV_INSN (p);
- (insn && GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_BEG);
- insn = PREV_INSN (insn))
- ;
-
- if (insn)
- set = single_set (insn);
-
- if (set && SET_DEST (set) == XEXP (x, 0)
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) >= 0
- && GET_CODE (SET_SRC (set)) == ASHIFT
- && XEXP (x, 1) == XEXP (SET_SRC (set), 1))
- return basic_induction_var (XEXP (SET_SRC (set), 0),
- GET_MODE (XEXP (x, 0)),
- dest_reg, insn, inc_val, mult_val);
- return 0;
-
- default:
- return 0;
- }
-}
-
-/* A general induction variable (giv) is any quantity that is a linear
- function of a basic induction variable,
- i.e. giv = biv * mult_val + add_val.
- The coefficients can be any loop invariant quantity.
- A giv need not be computed directly from the biv;
- it can be computed by way of other givs. */
-
-/* Determine whether X computes a giv.
- If it does, return a nonzero value
- which is the benefit from eliminating the computation of X;
- set *SRC_REG to the register of the biv that it is computed from;
- set *ADD_VAL and *MULT_VAL to the coefficients,
- such that the value of X is biv * mult + add; */
-
-static int
-general_induction_var (x, src_reg, add_val, mult_val)
- rtx x;
- rtx *src_reg;
- rtx *add_val;
- rtx *mult_val;
-{
- rtx orig_x = x;
- int benefit = 0;
- char *storage;
-
- /* If this is an invariant, forget it, it isn't a giv. */
- if (invariant_p (x) == 1)
- return 0;
-
- /* See if the expression could be a giv and get its form.
- Mark our place on the obstack in case we don't find a giv. */
- storage = (char *) oballoc (0);
- x = simplify_giv_expr (x, &benefit);
- if (x == 0)
- {
- obfree (storage);
- return 0;
- }
-
- switch (GET_CODE (x))
- {
- case USE:
- case CONST_INT:
- /* Since this is now an invariant and wasn't before, it must be a giv
- with MULT_VAL == 0. It doesn't matter which BIV we associate this
- with. */
- *src_reg = loop_iv_list->biv->dest_reg;
- *mult_val = const0_rtx;
- *add_val = x;
- break;
-
- case REG:
- /* This is equivalent to a BIV. */
- *src_reg = x;
- *mult_val = const1_rtx;
- *add_val = const0_rtx;
- break;
-
- case PLUS:
- /* Either (plus (biv) (invar)) or
- (plus (mult (biv) (invar_1)) (invar_2)). */
- if (GET_CODE (XEXP (x, 0)) == MULT)
- {
- *src_reg = XEXP (XEXP (x, 0), 0);
- *mult_val = XEXP (XEXP (x, 0), 1);
- }
- else
- {
- *src_reg = XEXP (x, 0);
- *mult_val = const1_rtx;
- }
- *add_val = XEXP (x, 1);
- break;
-
- case MULT:
- /* ADD_VAL is zero. */
- *src_reg = XEXP (x, 0);
- *mult_val = XEXP (x, 1);
- *add_val = const0_rtx;
- break;
-
- default:
- abort ();
- }
-
- /* Remove any enclosing USE from ADD_VAL and MULT_VAL (there will be
- unless they are CONST_INT). */
- if (GET_CODE (*add_val) == USE)
- *add_val = XEXP (*add_val, 0);
- if (GET_CODE (*mult_val) == USE)
- *mult_val = XEXP (*mult_val, 0);
-
- benefit += rtx_cost (orig_x, SET);
-
- /* Always return some benefit if this is a giv so it will be detected
- as such. This allows elimination of bivs that might otherwise
- not be eliminated. */
- return benefit == 0 ? 1 : benefit;
-}
-
-/* Given an expression, X, try to form it as a linear function of a biv.
- We will canonicalize it to be of the form
- (plus (mult (BIV) (invar_1))
- (invar_2))
- with possible degeneracies.
-
- The invariant expressions must each be of a form that can be used as a
- machine operand. We surround then with a USE rtx (a hack, but localized
- and certainly unambiguous!) if not a CONST_INT for simplicity in this
- routine; it is the caller's responsibility to strip them.
-
- If no such canonicalization is possible (i.e., two biv's are used or an
- expression that is neither invariant nor a biv or giv), this routine
- returns 0.
-
- For a non-zero return, the result will have a code of CONST_INT, USE,
- REG (for a BIV), PLUS, or MULT. No other codes will occur.
-
- *BENEFIT will be incremented by the benefit of any sub-giv encountered. */
-
-static rtx
-simplify_giv_expr (x, benefit)
- rtx x;
- int *benefit;
-{
- enum machine_mode mode = GET_MODE (x);
- rtx arg0, arg1;
- rtx tem;
-
- /* If this is not an integer mode, or if we cannot do arithmetic in this
- mode, this can't be a giv. */
- if (mode != VOIDmode
- && (GET_MODE_CLASS (mode) != MODE_INT
- || GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT))
- return 0;
-
- switch (GET_CODE (x))
- {
- case PLUS:
- arg0 = simplify_giv_expr (XEXP (x, 0), benefit);
- arg1 = simplify_giv_expr (XEXP (x, 1), benefit);
- if (arg0 == 0 || arg1 == 0)
- return 0;
-
- /* Put constant last, CONST_INT last if both constant. */
- if ((GET_CODE (arg0) == USE
- || GET_CODE (arg0) == CONST_INT)
- && GET_CODE (arg1) != CONST_INT)
- tem = arg0, arg0 = arg1, arg1 = tem;
-
- /* Handle addition of zero, then addition of an invariant. */
- if (arg1 == const0_rtx)
- return arg0;
- else if (GET_CODE (arg1) == CONST_INT || GET_CODE (arg1) == USE)
- switch (GET_CODE (arg0))
- {
- case CONST_INT:
- case USE:
- /* Both invariant. Only valid if sum is machine operand.
- First strip off possible USE on first operand. */
- if (GET_CODE (arg0) == USE)
- arg0 = XEXP (arg0, 0);
-
- tem = 0;
- if (CONSTANT_P (arg0) && GET_CODE (arg1) == CONST_INT)
- {
- tem = plus_constant (arg0, INTVAL (arg1));
- if (GET_CODE (tem) != CONST_INT)
- tem = gen_rtx (USE, mode, tem);
- }
-
- return tem;
-
- case REG:
- case MULT:
- /* biv + invar or mult + invar. Return sum. */
- return gen_rtx (PLUS, mode, arg0, arg1);
-
- case PLUS:
- /* (a + invar_1) + invar_2. Associate. */
- return simplify_giv_expr (gen_rtx (PLUS, mode,
- XEXP (arg0, 0),
- gen_rtx (PLUS, mode,
- XEXP (arg0, 1), arg1)),
- benefit);
-
- default:
- abort ();
- }
-
- /* Each argument must be either REG, PLUS, or MULT. Convert REG to
- MULT to reduce cases. */
- if (GET_CODE (arg0) == REG)
- arg0 = gen_rtx (MULT, mode, arg0, const1_rtx);
- if (GET_CODE (arg1) == REG)
- arg1 = gen_rtx (MULT, mode, arg1, const1_rtx);
-
- /* Now have PLUS + PLUS, PLUS + MULT, MULT + PLUS, or MULT + MULT.
- Put a MULT first, leaving PLUS + PLUS, MULT + PLUS, or MULT + MULT.
- Recurse to associate the second PLUS. */
- if (GET_CODE (arg1) == MULT)
- tem = arg0, arg0 = arg1, arg1 = tem;
-
- if (GET_CODE (arg1) == PLUS)
- return simplify_giv_expr (gen_rtx (PLUS, mode,
- gen_rtx (PLUS, mode,
- arg0, XEXP (arg1, 0)),
- XEXP (arg1, 1)),
- benefit);
-
- /* Now must have MULT + MULT. Distribute if same biv, else not giv. */
- if (GET_CODE (arg0) != MULT || GET_CODE (arg1) != MULT)
- abort ();
-
- if (XEXP (arg0, 0) != XEXP (arg1, 0))
- return 0;
-
- return simplify_giv_expr (gen_rtx (MULT, mode,
- XEXP (arg0, 0),
- gen_rtx (PLUS, mode,
- XEXP (arg0, 1),
- XEXP (arg1, 1))),
- benefit);
-
- case MINUS:
- /* Handle "a - b" as "a + b * (-1)". */
- return simplify_giv_expr (gen_rtx (PLUS, mode,
- XEXP (x, 0),
- gen_rtx (MULT, mode,
- XEXP (x, 1), constm1_rtx)),
- benefit);
-
- case MULT:
- arg0 = simplify_giv_expr (XEXP (x, 0), benefit);
- arg1 = simplify_giv_expr (XEXP (x, 1), benefit);
- if (arg0 == 0 || arg1 == 0)
- return 0;
-
- /* Put constant last, CONST_INT last if both constant. */
- if ((GET_CODE (arg0) == USE || GET_CODE (arg0) == CONST_INT)
- && GET_CODE (arg1) != CONST_INT)
- tem = arg0, arg0 = arg1, arg1 = tem;
-
- /* If second argument is not now constant, not giv. */
- if (GET_CODE (arg1) != USE && GET_CODE (arg1) != CONST_INT)
- return 0;
-
- /* Handle multiply by 0 or 1. */
- if (arg1 == const0_rtx)
- return const0_rtx;
-
- else if (arg1 == const1_rtx)
- return arg0;
-
- switch (GET_CODE (arg0))
- {
- case REG:
- /* biv * invar. Done. */
- return gen_rtx (MULT, mode, arg0, arg1);
-
- case CONST_INT:
- /* Product of two constants. */
- return GEN_INT (INTVAL (arg0) * INTVAL (arg1));
-
- case USE:
- /* invar * invar. Not giv. */
- return 0;
-
- case MULT:
- /* (a * invar_1) * invar_2. Associate. */
- return simplify_giv_expr (gen_rtx (MULT, mode,
- XEXP (arg0, 0),
- gen_rtx (MULT, mode,
- XEXP (arg0, 1), arg1)),
- benefit);
-
- case PLUS:
- /* (a + invar_1) * invar_2. Distribute. */
- return simplify_giv_expr (gen_rtx (PLUS, mode,
- gen_rtx (MULT, mode,
- XEXP (arg0, 0), arg1),
- gen_rtx (MULT, mode,
- XEXP (arg0, 1), arg1)),
- benefit);
-
- default:
- abort ();
- }
-
- case ASHIFT:
- /* Shift by constant is multiply by power of two. */
- if (GET_CODE (XEXP (x, 1)) != CONST_INT)
- return 0;
-
- return simplify_giv_expr (gen_rtx (MULT, mode,
- XEXP (x, 0),
- GEN_INT ((HOST_WIDE_INT) 1
- << INTVAL (XEXP (x, 1)))),
- benefit);
-
- case NEG:
- /* "-a" is "a * (-1)" */
- return simplify_giv_expr (gen_rtx (MULT, mode, XEXP (x, 0), constm1_rtx),
- benefit);
-
- case NOT:
- /* "~a" is "-a - 1". Silly, but easy. */
- return simplify_giv_expr (gen_rtx (MINUS, mode,
- gen_rtx (NEG, mode, XEXP (x, 0)),
- const1_rtx),
- benefit);
-
- case USE:
- /* Already in proper form for invariant. */
- return x;
-
- case REG:
- /* If this is a new register, we can't deal with it. */
- if (REGNO (x) >= max_reg_before_loop)
- return 0;
-
- /* Check for biv or giv. */
- switch (reg_iv_type[REGNO (x)])
- {
- case BASIC_INDUCT:
- return x;
- case GENERAL_INDUCT:
- {
- struct induction *v = reg_iv_info[REGNO (x)];
-
- /* Form expression from giv and add benefit. Ensure this giv
- can derive another and subtract any needed adjustment if so. */
- *benefit += v->benefit;
- if (v->cant_derive)
- return 0;
-
- tem = gen_rtx (PLUS, mode, gen_rtx (MULT, mode,
- v->src_reg, v->mult_val),
- v->add_val);
- if (v->derive_adjustment)
- tem = gen_rtx (MINUS, mode, tem, v->derive_adjustment);
- return simplify_giv_expr (tem, benefit);
- }
- }
-
- /* Fall through to general case. */
- default:
- /* If invariant, return as USE (unless CONST_INT).
- Otherwise, not giv. */
- if (GET_CODE (x) == USE)
- x = XEXP (x, 0);
-
- if (invariant_p (x) == 1)
- {
- if (GET_CODE (x) == CONST_INT)
- return x;
- else
- return gen_rtx (USE, mode, x);
- }
- else
- return 0;
- }
-}
-
-/* Help detect a giv that is calculated by several consecutive insns;
- for example,
- giv = biv * M
- giv = giv + A
- The caller has already identified the first insn P as having a giv as dest;
- we check that all other insns that set the same register follow
- immediately after P, that they alter nothing else,
- and that the result of the last is still a giv.
-
- The value is 0 if the reg set in P is not really a giv.
- Otherwise, the value is the amount gained by eliminating
- all the consecutive insns that compute the value.
-
- FIRST_BENEFIT is the amount gained by eliminating the first insn, P.
- SRC_REG is the reg of the biv; DEST_REG is the reg of the giv.
-
- The coefficients of the ultimate giv value are stored in
- *MULT_VAL and *ADD_VAL. */
-
-static int
-consec_sets_giv (first_benefit, p, src_reg, dest_reg,
- add_val, mult_val)
- int first_benefit;
- rtx p;
- rtx src_reg;
- rtx dest_reg;
- rtx *add_val;
- rtx *mult_val;
-{
- int count;
- enum rtx_code code;
- int benefit;
- rtx temp;
- rtx set;
-
- /* Indicate that this is a giv so that we can update the value produced in
- each insn of the multi-insn sequence.
-
- This induction structure will be used only by the call to
- general_induction_var below, so we can allocate it on our stack.
- If this is a giv, our caller will replace the induct var entry with
- a new induction structure. */
- struct induction *v
- = (struct induction *) alloca (sizeof (struct induction));
- v->src_reg = src_reg;
- v->mult_val = *mult_val;
- v->add_val = *add_val;
- v->benefit = first_benefit;
- v->cant_derive = 0;
- v->derive_adjustment = 0;
-
- reg_iv_type[REGNO (dest_reg)] = GENERAL_INDUCT;
- reg_iv_info[REGNO (dest_reg)] = v;
-
- count = n_times_set[REGNO (dest_reg)] - 1;
-
- while (count > 0)
- {
- p = NEXT_INSN (p);
- code = GET_CODE (p);
-
- /* If libcall, skip to end of call sequence. */
- if (code == INSN && (temp = find_reg_note (p, REG_LIBCALL, NULL_RTX)))
- p = XEXP (temp, 0);
-
- if (code == INSN
- && (set = single_set (p))
- && GET_CODE (SET_DEST (set)) == REG
- && SET_DEST (set) == dest_reg
- && ((benefit = general_induction_var (SET_SRC (set), &src_reg,
- add_val, mult_val))
- /* Giv created by equivalent expression. */
- || ((temp = find_reg_note (p, REG_EQUAL, NULL_RTX))
- && (benefit = general_induction_var (XEXP (temp, 0), &src_reg,
- add_val, mult_val))))
- && src_reg == v->src_reg)
- {
- if (find_reg_note (p, REG_RETVAL, NULL_RTX))
- benefit += libcall_benefit (p);
-
- count--;
- v->mult_val = *mult_val;
- v->add_val = *add_val;
- v->benefit = benefit;
- }
- else if (code != NOTE)
- {
- /* Allow insns that set something other than this giv to a
- constant. Such insns are needed on machines which cannot
- include long constants and should not disqualify a giv. */
- if (code == INSN
- && (set = single_set (p))
- && SET_DEST (set) != dest_reg
- && CONSTANT_P (SET_SRC (set)))
- continue;
-
- reg_iv_type[REGNO (dest_reg)] = UNKNOWN_INDUCT;
- return 0;
- }
- }
-
- return v->benefit;
-}
-
-/* Return an rtx, if any, that expresses giv G2 as a function of the register
- represented by G1. If no such expression can be found, or it is clear that
- it cannot possibly be a valid address, 0 is returned.
-
- To perform the computation, we note that
- G1 = a * v + b and
- G2 = c * v + d
- where `v' is the biv.
-
- So G2 = (c/a) * G1 + (d - b*c/a) */
-
-#ifdef ADDRESS_COST
-static rtx
-express_from (g1, g2)
- struct induction *g1, *g2;
-{
- rtx mult, add;
-
- /* The value that G1 will be multiplied by must be a constant integer. Also,
- the only chance we have of getting a valid address is if b*c/a (see above
- for notation) is also an integer. */
- if (GET_CODE (g1->mult_val) != CONST_INT
- || GET_CODE (g2->mult_val) != CONST_INT
- || GET_CODE (g1->add_val) != CONST_INT
- || g1->mult_val == const0_rtx
- || INTVAL (g2->mult_val) % INTVAL (g1->mult_val) != 0)
- return 0;
-
- mult = GEN_INT (INTVAL (g2->mult_val) / INTVAL (g1->mult_val));
- add = plus_constant (g2->add_val, - INTVAL (g1->add_val) * INTVAL (mult));
-
- /* Form simplified final result. */
- if (mult == const0_rtx)
- return add;
- else if (mult == const1_rtx)
- mult = g1->dest_reg;
- else
- mult = gen_rtx (MULT, g2->mode, g1->dest_reg, mult);
-
- if (add == const0_rtx)
- return mult;
- else
- return gen_rtx (PLUS, g2->mode, mult, add);
-}
-#endif
-
-/* Return 1 if giv G2 can be combined with G1. This means that G2 can use
- (either directly or via an address expression) a register used to represent
- G1. Set g2->new_reg to a represtation of G1 (normally just
- g1->dest_reg). */
-
-static int
-combine_givs_p (g1, g2)
- struct induction *g1, *g2;
-{
- rtx tem;
-
- /* If these givs are identical, they can be combined. */
- if (rtx_equal_p (g1->mult_val, g2->mult_val)
- && rtx_equal_p (g1->add_val, g2->add_val))
- {
- g2->new_reg = g1->dest_reg;
- return 1;
- }
-
-#ifdef ADDRESS_COST
- /* If G2 can be expressed as a function of G1 and that function is valid
- as an address and no more expensive than using a register for G2,
- the expression of G2 in terms of G1 can be used. */
- if (g2->giv_type == DEST_ADDR
- && (tem = express_from (g1, g2)) != 0
- && memory_address_p (g2->mem_mode, tem)
- && ADDRESS_COST (tem) <= ADDRESS_COST (*g2->location))
- {
- g2->new_reg = tem;
- return 1;
- }
-#endif
-
- return 0;
-}
-
-#ifdef GIV_SORT_CRITERION
-/* Compare two givs and sort the most desirable one for combinations first.
- This is used only in one qsort call below. */
-
-static int
-giv_sort (x, y)
- struct induction **x, **y;
-{
- GIV_SORT_CRITERION (*x, *y);
-
- return 0;
-}
-#endif
-
-/* Check all pairs of givs for iv_class BL and see if any can be combined with
- any other. If so, point SAME to the giv combined with and set NEW_REG to
- be an expression (in terms of the other giv's DEST_REG) equivalent to the
- giv. Also, update BENEFIT and related fields for cost/benefit analysis. */
-
-static void
-combine_givs (bl)
- struct iv_class *bl;
-{
- struct induction *g1, *g2, **giv_array, *temp_iv;
- int i, j, giv_count, pass;
-
- /* Count givs, because bl->giv_count is incorrect here. */
- giv_count = 0;
- for (g1 = bl->giv; g1; g1 = g1->next_iv)
- giv_count++;
-
- giv_array
- = (struct induction **) alloca (giv_count * sizeof (struct induction *));
- i = 0;
- for (g1 = bl->giv; g1; g1 = g1->next_iv)
- giv_array[i++] = g1;
-
-#ifdef GIV_SORT_CRITERION
- /* Sort the givs if GIV_SORT_CRITERION is defined.
- This is usually defined for processors which lack
- negative register offsets so more givs may be combined. */
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "%d givs counted, sorting...\n", giv_count);
-
- qsort (giv_array, giv_count, sizeof (struct induction *), giv_sort);
-#endif
-
- for (i = 0; i < giv_count; i++)
- {
- g1 = giv_array[i];
- for (pass = 0; pass <= 1; pass++)
- for (j = 0; j < giv_count; j++)
- {
- g2 = giv_array[j];
- if (g1 != g2
- /* First try to combine with replaceable givs, then all givs. */
- && (g1->replaceable || pass == 1)
- /* If either has already been combined or is to be ignored, can't
- combine. */
- && ! g1->ignore && ! g2->ignore && ! g1->same && ! g2->same
- /* If something has been based on G2, G2 cannot itself be based
- on something else. */
- && ! g2->combined_with
- && combine_givs_p (g1, g2))
- {
- /* g2->new_reg set by `combine_givs_p' */
- g2->same = g1;
- g1->combined_with = 1;
-
- /* If one of these givs is a DEST_REG that was only used
- once, by the other giv, this is actually a single use.
- The DEST_REG has the correct cost, while the other giv
- counts the REG use too often. */
- if (g2->giv_type == DEST_REG
- && n_times_used[REGNO (g2->dest_reg)] == 1
- && reg_mentioned_p (g2->dest_reg, PATTERN (g1->insn)))
- g1->benefit = g2->benefit;
- else if (g1->giv_type != DEST_REG
- || n_times_used[REGNO (g1->dest_reg)] != 1
- || ! reg_mentioned_p (g1->dest_reg,
- PATTERN (g2->insn)))
- {
- g1->benefit += g2->benefit;
- g1->times_used += g2->times_used;
- }
- /* ??? The new final_[bg]iv_value code does a much better job
- of finding replaceable giv's, and hence this code may no
- longer be necessary. */
- if (! g2->replaceable && REG_USERVAR_P (g2->dest_reg))
- g1->benefit -= copy_cost;
- g1->lifetime += g2->lifetime;
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "giv at %d combined with giv at %d\n",
- INSN_UID (g2->insn), INSN_UID (g1->insn));
- }
- }
- }
-}
-
-/* EMIT code before INSERT_BEFORE to set REG = B * M + A. */
-
-void
-emit_iv_add_mult (b, m, a, reg, insert_before)
- rtx b; /* initial value of basic induction variable */
- rtx m; /* multiplicative constant */
- rtx a; /* additive constant */
- rtx reg; /* destination register */
- rtx insert_before;
-{
- rtx seq;
- rtx result;
-
- /* Prevent unexpected sharing of these rtx. */
- a = copy_rtx (a);
- b = copy_rtx (b);
-
- /* Increase the lifetime of any invariants moved further in code. */
- update_reg_last_use (a, insert_before);
- update_reg_last_use (b, insert_before);
- update_reg_last_use (m, insert_before);
-
- start_sequence ();
- result = expand_mult_add (b, reg, m, a, GET_MODE (reg), 0);
- if (reg != result)
- emit_move_insn (reg, result);
- seq = gen_sequence ();
- end_sequence ();
-
- emit_insn_before (seq, insert_before);
-}
-
-/* Test whether A * B can be computed without
- an actual multiply insn. Value is 1 if so. */
-
-static int
-product_cheap_p (a, b)
- rtx a;
- rtx b;
-{
- int i;
- rtx tmp;
- struct obstack *old_rtl_obstack = rtl_obstack;
- char *storage = (char *) obstack_alloc (&temp_obstack, 0);
- int win = 1;
-
- /* If only one is constant, make it B. */
- if (GET_CODE (a) == CONST_INT)
- tmp = a, a = b, b = tmp;
-
- /* If first constant, both constant, so don't need multiply. */
- if (GET_CODE (a) == CONST_INT)
- return 1;
-
- /* If second not constant, neither is constant, so would need multiply. */
- if (GET_CODE (b) != CONST_INT)
- return 0;
-
- /* One operand is constant, so might not need multiply insn. Generate the
- code for the multiply and see if a call or multiply, or long sequence
- of insns is generated. */
-
- rtl_obstack = &temp_obstack;
- start_sequence ();
- expand_mult (GET_MODE (a), a, b, NULL_RTX, 0);
- tmp = gen_sequence ();
- end_sequence ();
-
- if (GET_CODE (tmp) == SEQUENCE)
- {
- if (XVEC (tmp, 0) == 0)
- win = 1;
- else if (XVECLEN (tmp, 0) > 3)
- win = 0;
- else
- for (i = 0; i < XVECLEN (tmp, 0); i++)
- {
- rtx insn = XVECEXP (tmp, 0, i);
-
- if (GET_CODE (insn) != INSN
- || (GET_CODE (PATTERN (insn)) == SET
- && GET_CODE (SET_SRC (PATTERN (insn))) == MULT)
- || (GET_CODE (PATTERN (insn)) == PARALLEL
- && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (PATTERN (insn), 0, 0))) == MULT))
- {
- win = 0;
- break;
- }
- }
- }
- else if (GET_CODE (tmp) == SET
- && GET_CODE (SET_SRC (tmp)) == MULT)
- win = 0;
- else if (GET_CODE (tmp) == PARALLEL
- && GET_CODE (XVECEXP (tmp, 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (tmp, 0, 0))) == MULT)
- win = 0;
-
- /* Free any storage we obtained in generating this multiply and restore rtl
- allocation to its normal obstack. */
- obstack_free (&temp_obstack, storage);
- rtl_obstack = old_rtl_obstack;
-
- return win;
-}
-
-/* Check to see if loop can be terminated by a "decrement and branch until
- zero" instruction. If so, add a REG_NONNEG note to the branch insn if so.
- Also try reversing an increment loop to a decrement loop
- to see if the optimization can be performed.
- Value is nonzero if optimization was performed. */
-
-/* This is useful even if the architecture doesn't have such an insn,
- because it might change a loops which increments from 0 to n to a loop
- which decrements from n to 0. A loop that decrements to zero is usually
- faster than one that increments from zero. */
-
-/* ??? This could be rewritten to use some of the loop unrolling procedures,
- such as approx_final_value, biv_total_increment, loop_iterations, and
- final_[bg]iv_value. */
-
-static int
-check_dbra_loop (loop_end, insn_count, loop_start)
- rtx loop_end;
- int insn_count;
- rtx loop_start;
-{
- struct iv_class *bl;
- rtx reg;
- rtx jump_label;
- rtx final_value;
- rtx start_value;
- rtx new_add_val;
- rtx comparison;
- rtx before_comparison;
- rtx p;
-
- /* If last insn is a conditional branch, and the insn before tests a
- register value, try to optimize it. Otherwise, we can't do anything. */
-
- comparison = get_condition_for_loop (PREV_INSN (loop_end));
- if (comparison == 0)
- return 0;
-
- /* Check all of the bivs to see if the compare uses one of them.
- Skip biv's set more than once because we can't guarantee that
- it will be zero on the last iteration. Also skip if the biv is
- used between its update and the test insn. */
-
- for (bl = loop_iv_list; bl; bl = bl->next)
- {
- if (bl->biv_count == 1
- && bl->biv->dest_reg == XEXP (comparison, 0)
- && ! reg_used_between_p (regno_reg_rtx[bl->regno], bl->biv->insn,
- PREV_INSN (PREV_INSN (loop_end))))
- break;
- }
-
- if (! bl)
- return 0;
-
- /* Look for the case where the basic induction variable is always
- nonnegative, and equals zero on the last iteration.
- In this case, add a reg_note REG_NONNEG, which allows the
- m68k DBRA instruction to be used. */
-
- if (((GET_CODE (comparison) == GT
- && GET_CODE (XEXP (comparison, 1)) == CONST_INT
- && INTVAL (XEXP (comparison, 1)) == -1)
- || (GET_CODE (comparison) == NE && XEXP (comparison, 1) == const0_rtx))
- && GET_CODE (bl->biv->add_val) == CONST_INT
- && INTVAL (bl->biv->add_val) < 0)
- {
- /* Initial value must be greater than 0,
- init_val % -dec_value == 0 to ensure that it equals zero on
- the last iteration */
-
- if (GET_CODE (bl->initial_value) == CONST_INT
- && INTVAL (bl->initial_value) > 0
- && (INTVAL (bl->initial_value) %
- (-INTVAL (bl->biv->add_val))) == 0)
- {
- /* register always nonnegative, add REG_NOTE to branch */
- REG_NOTES (PREV_INSN (loop_end))
- = gen_rtx (EXPR_LIST, REG_NONNEG, NULL_RTX,
- REG_NOTES (PREV_INSN (loop_end)));
- bl->nonneg = 1;
-
- return 1;
- }
-
- /* If the decrement is 1 and the value was tested as >= 0 before
- the loop, then we can safely optimize. */
- for (p = loop_start; p; p = PREV_INSN (p))
- {
- if (GET_CODE (p) == CODE_LABEL)
- break;
- if (GET_CODE (p) != JUMP_INSN)
- continue;
-
- before_comparison = get_condition_for_loop (p);
- if (before_comparison
- && XEXP (before_comparison, 0) == bl->biv->dest_reg
- && GET_CODE (before_comparison) == LT
- && XEXP (before_comparison, 1) == const0_rtx
- && ! reg_set_between_p (bl->biv->dest_reg, p, loop_start)
- && INTVAL (bl->biv->add_val) == -1)
- {
- REG_NOTES (PREV_INSN (loop_end))
- = gen_rtx (EXPR_LIST, REG_NONNEG, NULL_RTX,
- REG_NOTES (PREV_INSN (loop_end)));
- bl->nonneg = 1;
-
- return 1;
- }
- }
- }
- else if (num_mem_sets <= 1)
- {
- /* Try to change inc to dec, so can apply above optimization. */
- /* Can do this if:
- all registers modified are induction variables or invariant,
- all memory references have non-overlapping addresses
- (obviously true if only one write)
- allow 2 insns for the compare/jump at the end of the loop. */
- /* Also, we must avoid any instructions which use both the reversed
- biv and another biv. Such instructions will fail if the loop is
- reversed. We meet this condition by requiring that either
- no_use_except_counting is true, or else that there is only
- one biv. */
- int num_nonfixed_reads = 0;
- /* 1 if the iteration var is used only to count iterations. */
- int no_use_except_counting = 0;
- /* 1 if the loop has no memory store, or it has a single memory store
- which is reversible. */
- int reversible_mem_store = 1;
-
- for (p = loop_start; p != loop_end; p = NEXT_INSN (p))
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i')
- num_nonfixed_reads += count_nonfixed_reads (PATTERN (p));
-
- if (bl->giv_count == 0
- && ! loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]])
- {
- rtx bivreg = regno_reg_rtx[bl->regno];
-
- /* If there are no givs for this biv, and the only exit is the
- fall through at the end of the the loop, then
- see if perhaps there are no uses except to count. */
- no_use_except_counting = 1;
- for (p = loop_start; p != loop_end; p = NEXT_INSN (p))
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i')
- {
- rtx set = single_set (p);
-
- if (set && GET_CODE (SET_DEST (set)) == REG
- && REGNO (SET_DEST (set)) == bl->regno)
- /* An insn that sets the biv is okay. */
- ;
- else if (p == prev_nonnote_insn (prev_nonnote_insn (loop_end))
- || p == prev_nonnote_insn (loop_end))
- /* Don't bother about the end test. */
- ;
- else if (reg_mentioned_p (bivreg, PATTERN (p)))
- /* Any other use of the biv is no good. */
- {
- no_use_except_counting = 0;
- break;
- }
- }
- }
-
- /* If the loop has a single store, and the destination address is
- invariant, then we can't reverse the loop, because this address
- might then have the wrong value at loop exit.
- This would work if the source was invariant also, however, in that
- case, the insn should have been moved out of the loop. */
-
- if (num_mem_sets == 1)
- reversible_mem_store
- = (! unknown_address_altered
- && ! invariant_p (XEXP (loop_store_mems[0], 0)));
-
- /* This code only acts for innermost loops. Also it simplifies
- the memory address check by only reversing loops with
- zero or one memory access.
- Two memory accesses could involve parts of the same array,
- and that can't be reversed. */
-
- if (num_nonfixed_reads <= 1
- && !loop_has_call
- && !loop_has_volatile
- && reversible_mem_store
- && (no_use_except_counting
- || ((bl->giv_count + bl->biv_count + num_mem_sets
- + num_movables + 2 == insn_count)
- && (bl == loop_iv_list && bl->next == 0))))
- {
- rtx tem;
-
- /* Loop can be reversed. */
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Can reverse loop\n");
-
- /* Now check other conditions:
- initial_value must be zero,
- final_value % add_val == 0, so that when reversed, the
- biv will be zero on the last iteration.
-
- This test can probably be improved since +/- 1 in the constant
- can be obtained by changing LT to LE and vice versa; this is
- confusing. */
-
- if (comparison && bl->initial_value == const0_rtx
- && GET_CODE (XEXP (comparison, 1)) == CONST_INT
- /* LE gets turned into LT */
- && GET_CODE (comparison) == LT
- && (INTVAL (XEXP (comparison, 1))
- % INTVAL (bl->biv->add_val)) == 0)
- {
- /* Register will always be nonnegative, with value
- 0 on last iteration if loop reversed */
-
- /* Save some info needed to produce the new insns. */
- reg = bl->biv->dest_reg;
- jump_label = XEXP (SET_SRC (PATTERN (PREV_INSN (loop_end))), 1);
- if (jump_label == pc_rtx)
- jump_label = XEXP (SET_SRC (PATTERN (PREV_INSN (loop_end))), 2);
- new_add_val = GEN_INT (- INTVAL (bl->biv->add_val));
-
- final_value = XEXP (comparison, 1);
- start_value = GEN_INT (INTVAL (XEXP (comparison, 1))
- - INTVAL (bl->biv->add_val));
-
- /* Initialize biv to start_value before loop start.
- The old initializing insn will be deleted as a
- dead store by flow.c. */
- emit_insn_before (gen_move_insn (reg, start_value), loop_start);
-
- /* Add insn to decrement register, and delete insn
- that incremented the register. */
- p = emit_insn_before (gen_add2_insn (reg, new_add_val),
- bl->biv->insn);
- delete_insn (bl->biv->insn);
-
- /* Update biv info to reflect its new status. */
- bl->biv->insn = p;
- bl->initial_value = start_value;
- bl->biv->add_val = new_add_val;
-
- /* Inc LABEL_NUSES so that delete_insn will
- not delete the label. */
- LABEL_NUSES (XEXP (jump_label, 0)) ++;
-
- /* Emit an insn after the end of the loop to set the biv's
- proper exit value if it is used anywhere outside the loop. */
- if ((regno_last_uid[bl->regno]
- != INSN_UID (PREV_INSN (PREV_INSN (loop_end))))
- || ! bl->init_insn
- || regno_first_uid[bl->regno] != INSN_UID (bl->init_insn))
- emit_insn_after (gen_move_insn (reg, final_value),
- loop_end);
-
- /* Delete compare/branch at end of loop. */
- delete_insn (PREV_INSN (loop_end));
- delete_insn (PREV_INSN (loop_end));
-
- /* Add new compare/branch insn at end of loop. */
- start_sequence ();
- emit_cmp_insn (reg, const0_rtx, GE, NULL_RTX,
- GET_MODE (reg), 0, 0);
- emit_jump_insn (gen_bge (XEXP (jump_label, 0)));
- tem = gen_sequence ();
- end_sequence ();
- emit_jump_insn_before (tem, loop_end);
-
- for (tem = PREV_INSN (loop_end);
- tem && GET_CODE (tem) != JUMP_INSN; tem = PREV_INSN (tem))
- ;
- if (tem)
- {
- JUMP_LABEL (tem) = XEXP (jump_label, 0);
-
- /* Increment of LABEL_NUSES done above. */
- /* Register is now always nonnegative,
- so add REG_NONNEG note to the branch. */
- REG_NOTES (tem) = gen_rtx (EXPR_LIST, REG_NONNEG, NULL_RTX,
- REG_NOTES (tem));
- }
-
- bl->nonneg = 1;
-
- /* Mark that this biv has been reversed. Each giv which depends
- on this biv, and which is also live past the end of the loop
- will have to be fixed up. */
-
- bl->reversed = 1;
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Reversed loop and added reg_nonneg\n");
-
- return 1;
- }
- }
- }
-
- return 0;
-}
-
-/* Verify whether the biv BL appears to be eliminable,
- based on the insns in the loop that refer to it.
- LOOP_START is the first insn of the loop, and END is the end insn.
-
- If ELIMINATE_P is non-zero, actually do the elimination.
-
- THRESHOLD and INSN_COUNT are from loop_optimize and are used to
- determine whether invariant insns should be placed inside or at the
- start of the loop. */
-
-static int
-maybe_eliminate_biv (bl, loop_start, end, eliminate_p, threshold, insn_count)
- struct iv_class *bl;
- rtx loop_start;
- rtx end;
- int eliminate_p;
- int threshold, insn_count;
-{
- rtx reg = bl->biv->dest_reg;
- rtx p;
-
- /* Scan all insns in the loop, stopping if we find one that uses the
- biv in a way that we cannot eliminate. */
-
- for (p = loop_start; p != end; p = NEXT_INSN (p))
- {
- enum rtx_code code = GET_CODE (p);
- rtx where = threshold >= insn_count ? loop_start : p;
-
- if ((code == INSN || code == JUMP_INSN || code == CALL_INSN)
- && reg_mentioned_p (reg, PATTERN (p))
- && ! maybe_eliminate_biv_1 (PATTERN (p), p, bl, eliminate_p, where))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Cannot eliminate biv %d: biv used in insn %d.\n",
- bl->regno, INSN_UID (p));
- break;
- }
- }
-
- if (p == end)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "biv %d %s eliminated.\n",
- bl->regno, eliminate_p ? "was" : "can be");
- return 1;
- }
-
- return 0;
-}
-
-/* If BL appears in X (part of the pattern of INSN), see if we can
- eliminate its use. If so, return 1. If not, return 0.
-
- If BIV does not appear in X, return 1.
-
- If ELIMINATE_P is non-zero, actually do the elimination. WHERE indicates
- where extra insns should be added. Depending on how many items have been
- moved out of the loop, it will either be before INSN or at the start of
- the loop. */
-
-static int
-maybe_eliminate_biv_1 (x, insn, bl, eliminate_p, where)
- rtx x, insn;
- struct iv_class *bl;
- int eliminate_p;
- rtx where;
-{
- enum rtx_code code = GET_CODE (x);
- rtx reg = bl->biv->dest_reg;
- enum machine_mode mode = GET_MODE (reg);
- struct induction *v;
- rtx arg, new, tem;
- int arg_operand;
- char *fmt;
- int i, j;
-
- switch (code)
- {
- case REG:
- /* If we haven't already been able to do something with this BIV,
- we can't eliminate it. */
- if (x == reg)
- return 0;
- return 1;
-
- case SET:
- /* If this sets the BIV, it is not a problem. */
- if (SET_DEST (x) == reg)
- return 1;
-
- /* If this is an insn that defines a giv, it is also ok because
- it will go away when the giv is reduced. */
- for (v = bl->giv; v; v = v->next_iv)
- if (v->giv_type == DEST_REG && SET_DEST (x) == v->dest_reg)
- return 1;
-
-#ifdef HAVE_cc0
- if (SET_DEST (x) == cc0_rtx && SET_SRC (x) == reg)
- {
- /* Can replace with any giv that was reduced and
- that has (MULT_VAL != 0) and (ADD_VAL == 0).
- Require a constant for MULT_VAL, so we know it's nonzero.
- ??? We disable this optimization to avoid potential
- overflows. */
-
- for (v = bl->giv; v; v = v->next_iv)
- if (CONSTANT_P (v->mult_val) && v->mult_val != const0_rtx
- && v->add_val == const0_rtx
- && ! v->ignore && ! v->maybe_dead && v->always_computable
- && v->mode == mode
- && 0)
- {
- /* If the giv V had the auto-inc address optimization applied
- to it, and INSN occurs between the giv insn and the biv
- insn, then we must adjust the value used here.
- This is rare, so we don't bother to do so. */
- if (v->auto_inc_opt
- && ((INSN_LUID (v->insn) < INSN_LUID (insn)
- && INSN_LUID (insn) < INSN_LUID (bl->biv->insn))
- || (INSN_LUID (v->insn) > INSN_LUID (insn)
- && INSN_LUID (insn) > INSN_LUID (bl->biv->insn))))
- continue;
-
- if (! eliminate_p)
- return 1;
-
- /* If the giv has the opposite direction of change,
- then reverse the comparison. */
- if (INTVAL (v->mult_val) < 0)
- new = gen_rtx (COMPARE, GET_MODE (v->new_reg),
- const0_rtx, v->new_reg);
- else
- new = v->new_reg;
-
- /* We can probably test that giv's reduced reg. */
- if (validate_change (insn, &SET_SRC (x), new, 0))
- return 1;
- }
-
- /* Look for a giv with (MULT_VAL != 0) and (ADD_VAL != 0);
- replace test insn with a compare insn (cmp REDUCED_GIV ADD_VAL).
- Require a constant for MULT_VAL, so we know it's nonzero.
- ??? Do this only if ADD_VAL is a pointer to avoid a potential
- overflow problem. */
-
- for (v = bl->giv; v; v = v->next_iv)
- if (CONSTANT_P (v->mult_val) && v->mult_val != const0_rtx
- && ! v->ignore && ! v->maybe_dead && v->always_computable
- && v->mode == mode
- && (GET_CODE (v->add_val) == SYMBOL_REF
- || GET_CODE (v->add_val) == LABEL_REF
- || GET_CODE (v->add_val) == CONST
- || (GET_CODE (v->add_val) == REG
- && REGNO_POINTER_FLAG (REGNO (v->add_val)))))
- {
- /* If the giv V had the auto-inc address optimization applied
- to it, and INSN occurs between the giv insn and the biv
- insn, then we must adjust the value used here.
- This is rare, so we don't bother to do so. */
- if (v->auto_inc_opt
- && ((INSN_LUID (v->insn) < INSN_LUID (insn)
- && INSN_LUID (insn) < INSN_LUID (bl->biv->insn))
- || (INSN_LUID (v->insn) > INSN_LUID (insn)
- && INSN_LUID (insn) > INSN_LUID (bl->biv->insn))))
- continue;
-
- if (! eliminate_p)
- return 1;
-
- /* If the giv has the opposite direction of change,
- then reverse the comparison. */
- if (INTVAL (v->mult_val) < 0)
- new = gen_rtx (COMPARE, VOIDmode, copy_rtx (v->add_val),
- v->new_reg);
- else
- new = gen_rtx (COMPARE, VOIDmode, v->new_reg,
- copy_rtx (v->add_val));
-
- /* Replace biv with the giv's reduced register. */
- update_reg_last_use (v->add_val, insn);
- if (validate_change (insn, &SET_SRC (PATTERN (insn)), new, 0))
- return 1;
-
- /* Insn doesn't support that constant or invariant. Copy it
- into a register (it will be a loop invariant.) */
- tem = gen_reg_rtx (GET_MODE (v->new_reg));
-
- emit_insn_before (gen_move_insn (tem, copy_rtx (v->add_val)),
- where);
-
- if (validate_change (insn, &SET_SRC (PATTERN (insn)),
- gen_rtx (COMPARE, VOIDmode,
- v->new_reg, tem), 0))
- return 1;
- }
- }
-#endif
- break;
-
- case COMPARE:
- case EQ: case NE:
- case GT: case GE: case GTU: case GEU:
- case LT: case LE: case LTU: case LEU:
- /* See if either argument is the biv. */
- if (XEXP (x, 0) == reg)
- arg = XEXP (x, 1), arg_operand = 1;
- else if (XEXP (x, 1) == reg)
- arg = XEXP (x, 0), arg_operand = 0;
- else
- break;
-
- if (CONSTANT_P (arg))
- {
- /* First try to replace with any giv that has constant positive
- mult_val and constant add_val. We might be able to support
- negative mult_val, but it seems complex to do it in general. */
-
- for (v = bl->giv; v; v = v->next_iv)
- if (CONSTANT_P (v->mult_val) && INTVAL (v->mult_val) > 0
- && (GET_CODE (v->add_val) == SYMBOL_REF
- || GET_CODE (v->add_val) == LABEL_REF
- || GET_CODE (v->add_val) == CONST
- || (GET_CODE (v->add_val) == REG
- && REGNO_POINTER_FLAG (REGNO (v->add_val))))
- && ! v->ignore && ! v->maybe_dead && v->always_computable
- && v->mode == mode)
- {
- /* If the giv V had the auto-inc address optimization applied
- to it, and INSN occurs between the giv insn and the biv
- insn, then we must adjust the value used here.
- This is rare, so we don't bother to do so. */
- if (v->auto_inc_opt
- && ((INSN_LUID (v->insn) < INSN_LUID (insn)
- && INSN_LUID (insn) < INSN_LUID (bl->biv->insn))
- || (INSN_LUID (v->insn) > INSN_LUID (insn)
- && INSN_LUID (insn) > INSN_LUID (bl->biv->insn))))
- continue;
-
- if (! eliminate_p)
- return 1;
-
- /* Replace biv with the giv's reduced reg. */
- XEXP (x, 1-arg_operand) = v->new_reg;
-
- /* If all constants are actually constant integers and
- the derived constant can be directly placed in the COMPARE,
- do so. */
- if (GET_CODE (arg) == CONST_INT
- && GET_CODE (v->mult_val) == CONST_INT
- && GET_CODE (v->add_val) == CONST_INT
- && validate_change (insn, &XEXP (x, arg_operand),
- GEN_INT (INTVAL (arg)
- * INTVAL (v->mult_val)
- + INTVAL (v->add_val)), 0))
- return 1;
-
- /* Otherwise, load it into a register. */
- tem = gen_reg_rtx (mode);
- emit_iv_add_mult (arg, v->mult_val, v->add_val, tem, where);
- if (validate_change (insn, &XEXP (x, arg_operand), tem, 0))
- return 1;
-
- /* If that failed, put back the change we made above. */
- XEXP (x, 1-arg_operand) = reg;
- }
-
- /* Look for giv with positive constant mult_val and nonconst add_val.
- Insert insns to calculate new compare value.
- ??? Turn this off due to possible overflow. */
-
- for (v = bl->giv; v; v = v->next_iv)
- if (CONSTANT_P (v->mult_val) && INTVAL (v->mult_val) > 0
- && ! v->ignore && ! v->maybe_dead && v->always_computable
- && v->mode == mode
- && 0)
- {
- rtx tem;
-
- /* If the giv V had the auto-inc address optimization applied
- to it, and INSN occurs between the giv insn and the biv
- insn, then we must adjust the value used here.
- This is rare, so we don't bother to do so. */
- if (v->auto_inc_opt
- && ((INSN_LUID (v->insn) < INSN_LUID (insn)
- && INSN_LUID (insn) < INSN_LUID (bl->biv->insn))
- || (INSN_LUID (v->insn) > INSN_LUID (insn)
- && INSN_LUID (insn) > INSN_LUID (bl->biv->insn))))
- continue;
-
- if (! eliminate_p)
- return 1;
-
- tem = gen_reg_rtx (mode);
-
- /* Replace biv with giv's reduced register. */
- validate_change (insn, &XEXP (x, 1 - arg_operand),
- v->new_reg, 1);
-
- /* Compute value to compare against. */
- emit_iv_add_mult (arg, v->mult_val, v->add_val, tem, where);
- /* Use it in this insn. */
- validate_change (insn, &XEXP (x, arg_operand), tem, 1);
- if (apply_change_group ())
- return 1;
- }
- }
- else if (GET_CODE (arg) == REG || GET_CODE (arg) == MEM)
- {
- if (invariant_p (arg) == 1)
- {
- /* Look for giv with constant positive mult_val and nonconst
- add_val. Insert insns to compute new compare value.
- ??? Turn this off due to possible overflow. */
-
- for (v = bl->giv; v; v = v->next_iv)
- if (CONSTANT_P (v->mult_val) && INTVAL (v->mult_val) > 0
- && ! v->ignore && ! v->maybe_dead && v->always_computable
- && v->mode == mode
- && 0)
- {
- rtx tem;
-
- /* If the giv V had the auto-inc address optimization applied
- to it, and INSN occurs between the giv insn and the biv
- insn, then we must adjust the value used here.
- This is rare, so we don't bother to do so. */
- if (v->auto_inc_opt
- && ((INSN_LUID (v->insn) < INSN_LUID (insn)
- && INSN_LUID (insn) < INSN_LUID (bl->biv->insn))
- || (INSN_LUID (v->insn) > INSN_LUID (insn)
- && INSN_LUID (insn) > INSN_LUID (bl->biv->insn))))
- continue;
-
- if (! eliminate_p)
- return 1;
-
- tem = gen_reg_rtx (mode);
-
- /* Replace biv with giv's reduced register. */
- validate_change (insn, &XEXP (x, 1 - arg_operand),
- v->new_reg, 1);
-
- /* Compute value to compare against. */
- emit_iv_add_mult (arg, v->mult_val, v->add_val,
- tem, where);
- validate_change (insn, &XEXP (x, arg_operand), tem, 1);
- if (apply_change_group ())
- return 1;
- }
- }
-
- /* This code has problems. Basically, you can't know when
- seeing if we will eliminate BL, whether a particular giv
- of ARG will be reduced. If it isn't going to be reduced,
- we can't eliminate BL. We can try forcing it to be reduced,
- but that can generate poor code.
-
- The problem is that the benefit of reducing TV, below should
- be increased if BL can actually be eliminated, but this means
- we might have to do a topological sort of the order in which
- we try to process biv. It doesn't seem worthwhile to do
- this sort of thing now. */
-
-#if 0
- /* Otherwise the reg compared with had better be a biv. */
- if (GET_CODE (arg) != REG
- || reg_iv_type[REGNO (arg)] != BASIC_INDUCT)
- return 0;
-
- /* Look for a pair of givs, one for each biv,
- with identical coefficients. */
- for (v = bl->giv; v; v = v->next_iv)
- {
- struct induction *tv;
-
- if (v->ignore || v->maybe_dead || v->mode != mode)
- continue;
-
- for (tv = reg_biv_class[REGNO (arg)]->giv; tv; tv = tv->next_iv)
- if (! tv->ignore && ! tv->maybe_dead
- && rtx_equal_p (tv->mult_val, v->mult_val)
- && rtx_equal_p (tv->add_val, v->add_val)
- && tv->mode == mode)
- {
- /* If the giv V had the auto-inc address optimization applied
- to it, and INSN occurs between the giv insn and the biv
- insn, then we must adjust the value used here.
- This is rare, so we don't bother to do so. */
- if (v->auto_inc_opt
- && ((INSN_LUID (v->insn) < INSN_LUID (insn)
- && INSN_LUID (insn) < INSN_LUID (bl->biv->insn))
- || (INSN_LUID (v->insn) > INSN_LUID (insn)
- && INSN_LUID (insn) > INSN_LUID (bl->biv->insn))))
- continue;
-
- if (! eliminate_p)
- return 1;
-
- /* Replace biv with its giv's reduced reg. */
- XEXP (x, 1-arg_operand) = v->new_reg;
- /* Replace other operand with the other giv's
- reduced reg. */
- XEXP (x, arg_operand) = tv->new_reg;
- return 1;
- }
- }
-#endif
- }
-
- /* If we get here, the biv can't be eliminated. */
- return 0;
-
- case MEM:
- /* If this address is a DEST_ADDR giv, it doesn't matter if the
- biv is used in it, since it will be replaced. */
- for (v = bl->giv; v; v = v->next_iv)
- if (v->giv_type == DEST_ADDR && v->location == &XEXP (x, 0))
- return 1;
- break;
- }
-
- /* See if any subexpression fails elimination. */
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- switch (fmt[i])
- {
- case 'e':
- if (! maybe_eliminate_biv_1 (XEXP (x, i), insn, bl,
- eliminate_p, where))
- return 0;
- break;
-
- case 'E':
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (! maybe_eliminate_biv_1 (XVECEXP (x, i, j), insn, bl,
- eliminate_p, where))
- return 0;
- break;
- }
- }
-
- return 1;
-}
-
-/* Return nonzero if the last use of REG
- is in an insn following INSN in the same basic block. */
-
-static int
-last_use_this_basic_block (reg, insn)
- rtx reg;
- rtx insn;
-{
- rtx n;
- for (n = insn;
- n && GET_CODE (n) != CODE_LABEL && GET_CODE (n) != JUMP_INSN;
- n = NEXT_INSN (n))
- {
- if (regno_last_uid[REGNO (reg)] == INSN_UID (n))
- return 1;
- }
- return 0;
-}
-
-/* Called via `note_stores' to record the initial value of a biv. Here we
- just record the location of the set and process it later. */
-
-static void
-record_initial (dest, set)
- rtx dest;
- rtx set;
-{
- struct iv_class *bl;
-
- if (GET_CODE (dest) != REG
- || REGNO (dest) >= max_reg_before_loop
- || reg_iv_type[REGNO (dest)] != BASIC_INDUCT)
- return;
-
- bl = reg_biv_class[REGNO (dest)];
-
- /* If this is the first set found, record it. */
- if (bl->init_insn == 0)
- {
- bl->init_insn = note_insn;
- bl->init_set = set;
- }
-}
-
-/* If any of the registers in X are "old" and currently have a last use earlier
- than INSN, update them to have a last use of INSN. Their actual last use
- will be the previous insn but it will not have a valid uid_luid so we can't
- use it. */
-
-static void
-update_reg_last_use (x, insn)
- rtx x;
- rtx insn;
-{
- /* Check for the case where INSN does not have a valid luid. In this case,
- there is no need to modify the regno_last_uid, as this can only happen
- when code is inserted after the loop_end to set a pseudo's final value,
- and hence this insn will never be the last use of x. */
- if (GET_CODE (x) == REG && REGNO (x) < max_reg_before_loop
- && INSN_UID (insn) < max_uid_for_loop
- && uid_luid[regno_last_uid[REGNO (x)]] < uid_luid[INSN_UID (insn)])
- regno_last_uid[REGNO (x)] = INSN_UID (insn);
- else
- {
- register int i, j;
- register char *fmt = GET_RTX_FORMAT (GET_CODE (x));
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- update_reg_last_use (XEXP (x, i), insn);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- update_reg_last_use (XVECEXP (x, i, j), insn);
- }
- }
-}
-
-/* Given a jump insn JUMP, return the condition that will cause it to branch
- to its JUMP_LABEL. If the condition cannot be understood, or is an
- inequality floating-point comparison which needs to be reversed, 0 will
- be returned.
-
- If EARLIEST is non-zero, it is a pointer to a place where the earliest
- insn used in locating the condition was found. If a replacement test
- of the condition is desired, it should be placed in front of that
- insn and we will be sure that the inputs are still valid.
-
- The condition will be returned in a canonical form to simplify testing by
- callers. Specifically:
-
- (1) The code will always be a comparison operation (EQ, NE, GT, etc.).
- (2) Both operands will be machine operands; (cc0) will have been replaced.
- (3) If an operand is a constant, it will be the second operand.
- (4) (LE x const) will be replaced with (LT x <const+1>) and similarly
- for GE, GEU, and LEU. */
-
-rtx
-get_condition (jump, earliest)
- rtx jump;
- rtx *earliest;
-{
- enum rtx_code code;
- rtx prev = jump;
- rtx set;
- rtx tem;
- rtx op0, op1;
- int reverse_code = 0;
- int did_reverse_condition = 0;
-
- /* If this is not a standard conditional jump, we can't parse it. */
- if (GET_CODE (jump) != JUMP_INSN
- || ! condjump_p (jump) || simplejump_p (jump))
- return 0;
-
- code = GET_CODE (XEXP (SET_SRC (PATTERN (jump)), 0));
- op0 = XEXP (XEXP (SET_SRC (PATTERN (jump)), 0), 0);
- op1 = XEXP (XEXP (SET_SRC (PATTERN (jump)), 0), 1);
-
- if (earliest)
- *earliest = jump;
-
- /* If this branches to JUMP_LABEL when the condition is false, reverse
- the condition. */
- if (GET_CODE (XEXP (SET_SRC (PATTERN (jump)), 2)) == LABEL_REF
- && XEXP (XEXP (SET_SRC (PATTERN (jump)), 2), 0) == JUMP_LABEL (jump))
- code = reverse_condition (code), did_reverse_condition ^= 1;
-
- /* If we are comparing a register with zero, see if the register is set
- in the previous insn to a COMPARE or a comparison operation. Perform
- the same tests as a function of STORE_FLAG_VALUE as find_comparison_args
- in cse.c */
-
- while (GET_RTX_CLASS (code) == '<' && op1 == CONST0_RTX (GET_MODE (op0)))
- {
- /* Set non-zero when we find something of interest. */
- rtx x = 0;
-
-#ifdef HAVE_cc0
- /* If comparison with cc0, import actual comparison from compare
- insn. */
- if (op0 == cc0_rtx)
- {
- if ((prev = prev_nonnote_insn (prev)) == 0
- || GET_CODE (prev) != INSN
- || (set = single_set (prev)) == 0
- || SET_DEST (set) != cc0_rtx)
- return 0;
-
- op0 = SET_SRC (set);
- op1 = CONST0_RTX (GET_MODE (op0));
- if (earliest)
- *earliest = prev;
- }
-#endif
-
- /* If this is a COMPARE, pick up the two things being compared. */
- if (GET_CODE (op0) == COMPARE)
- {
- op1 = XEXP (op0, 1);
- op0 = XEXP (op0, 0);
- continue;
- }
- else if (GET_CODE (op0) != REG)
- break;
-
- /* Go back to the previous insn. Stop if it is not an INSN. We also
- stop if it isn't a single set or if it has a REG_INC note because
- we don't want to bother dealing with it. */
-
- if ((prev = prev_nonnote_insn (prev)) == 0
- || GET_CODE (prev) != INSN
- || FIND_REG_INC_NOTE (prev, 0)
- || (set = single_set (prev)) == 0)
- break;
-
- /* If this is setting OP0, get what it sets it to if it looks
- relevant. */
- if (rtx_equal_p (SET_DEST (set), op0))
- {
- enum machine_mode inner_mode = GET_MODE (SET_SRC (set));
-
- if ((GET_CODE (SET_SRC (set)) == COMPARE
- || (((code == NE
- || (code == LT
- && GET_MODE_CLASS (inner_mode) == MODE_INT
- && (GET_MODE_BITSIZE (inner_mode)
- <= HOST_BITS_PER_WIDE_INT)
- && (STORE_FLAG_VALUE
- & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (inner_mode) - 1))))
-#ifdef FLOAT_STORE_FLAG_VALUE
- || (code == LT
- && GET_MODE_CLASS (inner_mode) == MODE_FLOAT
- && FLOAT_STORE_FLAG_VALUE < 0)
-#endif
- ))
- && GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == '<')))
- x = SET_SRC (set);
- else if (((code == EQ
- || (code == GE
- && (GET_MODE_BITSIZE (inner_mode)
- <= HOST_BITS_PER_WIDE_INT)
- && GET_MODE_CLASS (inner_mode) == MODE_INT
- && (STORE_FLAG_VALUE
- & ((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (inner_mode) - 1))))
-#ifdef FLOAT_STORE_FLAG_VALUE
- || (code == GE
- && GET_MODE_CLASS (inner_mode) == MODE_FLOAT
- && FLOAT_STORE_FLAG_VALUE < 0)
-#endif
- ))
- && GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == '<')
- {
- /* We might have reversed a LT to get a GE here. But this wasn't
- actually the comparison of data, so we don't flag that we
- have had to reverse the condition. */
- did_reverse_condition ^= 1;
- reverse_code = 1;
- x = SET_SRC (set);
- }
- else
- break;
- }
-
- else if (reg_set_p (op0, prev))
- /* If this sets OP0, but not directly, we have to give up. */
- break;
-
- if (x)
- {
- if (GET_RTX_CLASS (GET_CODE (x)) == '<')
- code = GET_CODE (x);
- if (reverse_code)
- {
- code = reverse_condition (code);
- did_reverse_condition ^= 1;
- reverse_code = 0;
- }
-
- op0 = XEXP (x, 0), op1 = XEXP (x, 1);
- if (earliest)
- *earliest = prev;
- }
- }
-
- /* If constant is first, put it last. */
- if (CONSTANT_P (op0))
- code = swap_condition (code), tem = op0, op0 = op1, op1 = tem;
-
- /* If OP0 is the result of a comparison, we weren't able to find what
- was really being compared, so fail. */
- if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC)
- return 0;
-
- /* Canonicalize any ordered comparison with integers involving equality
- if we can do computations in the relevant mode and we do not
- overflow. */
-
- if (GET_CODE (op1) == CONST_INT
- && GET_MODE (op0) != VOIDmode
- && GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT)
- {
- HOST_WIDE_INT const_val = INTVAL (op1);
- unsigned HOST_WIDE_INT uconst_val = const_val;
- unsigned HOST_WIDE_INT max_val
- = (unsigned HOST_WIDE_INT) GET_MODE_MASK (GET_MODE (op0));
-
- switch (code)
- {
- case LE:
- if (const_val != max_val >> 1)
- code = LT, op1 = GEN_INT (const_val + 1);
- break;
-
- case GE:
- if (const_val
- != (((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (op0)) - 1))))
- code = GT, op1 = GEN_INT (const_val - 1);
- break;
-
- case LEU:
- if (uconst_val != max_val)
- code = LTU, op1 = GEN_INT (uconst_val + 1);
- break;
-
- case GEU:
- if (uconst_val != 0)
- code = GTU, op1 = GEN_INT (uconst_val - 1);
- break;
- }
- }
-
- /* If this was floating-point and we reversed anything other than an
- EQ or NE, return zero. */
- if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
- && did_reverse_condition && code != NE && code != EQ
- && ! flag_fast_math
- && GET_MODE_CLASS (GET_MODE (op0)) == MODE_FLOAT)
- return 0;
-
-#ifdef HAVE_cc0
- /* Never return CC0; return zero instead. */
- if (op0 == cc0_rtx)
- return 0;
-#endif
-
- return gen_rtx (code, VOIDmode, op0, op1);
-}
-
-/* Similar to above routine, except that we also put an invariant last
- unless both operands are invariants. */
-
-rtx
-get_condition_for_loop (x)
- rtx x;
-{
- rtx comparison = get_condition (x, NULL_PTR);
-
- if (comparison == 0
- || ! invariant_p (XEXP (comparison, 0))
- || invariant_p (XEXP (comparison, 1)))
- return comparison;
-
- return gen_rtx (swap_condition (GET_CODE (comparison)), VOIDmode,
- XEXP (comparison, 1), XEXP (comparison, 0));
-}
diff --git a/gcc/loop.h b/gcc/loop.h
deleted file mode 100644
index fdb2f1fe32e..00000000000
--- a/gcc/loop.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Loop optimization definitions for GNU C-Compiler
- Copyright (C) 1991, 1995 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. */
-
-/* Get the luid of an insn. Catch the error of trying to reference the LUID
- of an insn added during loop, since these don't have LUIDs. */
-
-#define INSN_LUID(INSN) \
- (INSN_UID (INSN) < max_uid_for_loop ? uid_luid[INSN_UID (INSN)] \
- : (abort (), -1))
-
-/* A "basic induction variable" or biv is a pseudo reg that is set
- (within this loop) only by incrementing or decrementing it. */
-/* A "general induction variable" or giv is a pseudo reg whose
- value is a linear function of a biv. */
-
-/* Bivs are recognized by `basic_induction_var';
- Givs by `general_induct_var'. */
-
-/* An enum for the two different types of givs, those that are used
- as memory addresses and those that are calculated into registers. */
-enum g_types { DEST_ADDR, DEST_REG };
-
-/* A `struct induction' is created for every instruction that sets
- an induction variable (either a biv or a giv). */
-
-struct induction
-{
- rtx insn; /* The insn that sets a biv or giv */
- rtx new_reg; /* New register, containing strength reduced
- version of this giv. */
- rtx src_reg; /* Biv from which this giv is computed.
- (If this is a biv, then this is the biv.) */
- enum g_types giv_type; /* Indicate whether DEST_ADDR or DEST_REG */
- rtx dest_reg; /* Destination register for insn: this is the
- register which was the biv or giv.
- For a biv, this equals src_reg.
- For a DEST_ADDR type giv, this is 0. */
- rtx *location; /* Place in the insn where this giv occurs.
- If GIV_TYPE is DEST_REG, this is 0. */
- enum machine_mode mode; /* The mode of this biv or giv */
- enum machine_mode mem_mode; /* For DEST_ADDR, mode of the memory object. */
- rtx mult_val; /* Multiplicative factor for src_reg. */
- rtx add_val; /* Additive constant for that product. */
- int benefit; /* Gain from eliminating this insn. */
- rtx final_value; /* If the giv is used outside the loop, and its
- final value could be calculated, it is put
- here, and the giv is made replaceable. Set
- the giv to this value before the loop. */
- unsigned replaceable : 1; /* 1 if we can substitute the strength-reduced
- variable for the original variable.
- 0 means they must be kept separate and the
- new one must be copied into the old pseudo
- reg each time the old one is set. */
- unsigned not_replaceable : 1; /* Used to prevent duplicating work. This is
- 1 if we know that the giv definitely can
- not be made replaceable, in which case we
- don't bother checking the variable again
- even if further info is available.
- Both this and the above can be zero. */
- unsigned ignore : 1; /* 1 prohibits further processing of giv */
- unsigned always_computable : 1;/* 1 if this value is computable every
- iteration. */
- unsigned always_executed : 1; /* 1 if this set occurs each iteration. */
- unsigned maybe_multiple : 1; /* Only used for a biv and 1 if this biv
- update may be done multiple times per
- iteration. */
- unsigned cant_derive : 1; /* For giv's, 1 if this giv cannot derive
- another giv. This occurs in many cases
- where a giv's lifetime spans an update to
- a biv. */
- unsigned combined_with : 1; /* 1 if this giv has been combined with. It
- then cannot combine with any other giv. */
- unsigned maybe_dead : 1; /* 1 if this giv might be dead. In that case,
- we won't use it to eliminate a biv, it
- would probably lose. */
- unsigned auto_inc_opt : 1; /* 1 if this giv had its increment output next
- to it to try to form an auto-inc address. */
- int lifetime; /* Length of life of this giv */
- int times_used; /* # times this giv is used. */
- rtx derive_adjustment; /* If nonzero, is an adjustment to be
- subtracted from add_val when this giv
- derives another. This occurs when the
- giv spans a biv update by incrementation. */
- struct induction *next_iv; /* For givs, links together all givs that are
- based on the same biv. For bivs, links
- together all biv entries that refer to the
- same biv register. */
- struct induction *same; /* If this giv has been combined with another
- giv, this points to the base giv. The base
- giv will have COMBINED_WITH non-zero. */
- HOST_WIDE_INT const_adjust; /* Used by loop unrolling, when an address giv
- is split, and a constant is eliminated from
- the address, the -constant is stored here
- for later use. */
- struct induction *same_insn; /* If there are multiple identical givs in
- the same insn, then all but one have this
- field set, and they all point to the giv
- that doesn't have this field set. */
-};
-
-/* A `struct iv_class' is created for each biv. */
-
-struct iv_class {
- int regno; /* Pseudo reg which is the biv. */
- int biv_count; /* Number of insns setting this reg. */
- struct induction *biv; /* List of all insns that set this reg. */
- int giv_count; /* Number of DEST_REG givs computed from this
- biv. The resulting count is only used in
- check_dbra_loop. */
- struct induction *giv; /* List of all insns that compute a giv
- from this reg. */
- int total_benefit; /* Sum of BENEFITs of all those givs */
- rtx initial_value; /* Value of reg at loop start */
- rtx initial_test; /* Test performed on BIV before loop */
- struct iv_class *next; /* Links all class structures together */
- rtx init_insn; /* insn which initializes biv, 0 if none. */
- rtx init_set; /* SET of INIT_INSN, if any. */
- unsigned incremented : 1; /* 1 if somewhere incremented/decremented */
- unsigned eliminable : 1; /* 1 if plausible candidate for elimination. */
- unsigned nonneg : 1; /* 1 if we added a REG_NONNEG note for this. */
- unsigned reversed : 1; /* 1 if we reversed the loop that this
- biv controls. */
-};
-
-/* Definitions used by the basic induction variable discovery code. */
-enum iv_mode { UNKNOWN_INDUCT, BASIC_INDUCT, NOT_BASIC_INDUCT,
- GENERAL_INDUCT };
-
-/* Variables declared in loop.c, but also needed in unroll.c. */
-
-extern int *uid_luid;
-extern int max_uid_for_loop;
-extern int *uid_loop_num;
-extern int *loop_outer_loop;
-extern rtx *loop_number_exit_labels;
-extern int *loop_number_exit_count;
-extern unsigned HOST_WIDE_INT loop_n_iterations;
-extern int max_reg_before_loop;
-
-extern FILE *loop_dump_stream;
-
-extern enum iv_mode *reg_iv_type;
-extern struct induction **reg_iv_info;
-extern struct iv_class **reg_biv_class;
-extern struct iv_class *loop_iv_list;
-
-/* Forward declarations for non-static functions declared in loop.c and
- unroll.c. */
-int invariant_p PROTO((rtx));
-rtx get_condition_for_loop PROTO((rtx));
-void emit_iv_add_mult PROTO((rtx, rtx, rtx, rtx, rtx));
-
-/* Forward declarations for non-static functions declared in stmt.c. */
-void find_loop_tree_blocks PROTO((void));
-void unroll_block_trees PROTO((void));
-
-void unroll_loop PROTO((rtx, int, rtx, rtx, int));
-rtx biv_total_increment PROTO((struct iv_class *, rtx, rtx));
-unsigned HOST_WIDE_INT loop_iterations PROTO((rtx, rtx));
-rtx final_biv_value PROTO((struct iv_class *, rtx, rtx));
-rtx final_giv_value PROTO((struct induction *, rtx, rtx));
-void emit_unrolled_add PROTO((rtx, rtx, rtx));
-int back_branch_in_range_p PROTO((rtx, rtx, rtx));
diff --git a/gcc/machmode.def b/gcc/machmode.def
deleted file mode 100644
index 625586cd96f..00000000000
--- a/gcc/machmode.def
+++ /dev/null
@@ -1,119 +0,0 @@
-/* This file contains the definitions and documentation for the
- machine modes used in the the GNU compiler.
- Copyright (C) 1987, 1992, 1994 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 defines all the MACHINE MODES used by GNU CC.
-
- A machine mode specifies a size and format of data
- at the machine level.
-
- Each RTL expression has a machine mode.
-
- At the syntax tree level, each ..._TYPE and each ..._DECL node
- has a machine mode which describes data of that type or the
- data of the variable declared. */
-
-/* The first argument is the internal name of the machine mode
- used in the C source.
- By convention these are in UPPER_CASE, except for the word "mode".
-
- The second argument is the name of the machine mode in the
- external ASCII format used for reading and printing RTL and trees.
- By convention these names in UPPER_CASE.
-
- Third argument states the kind of representation:
- MODE_INT - integer
- MODE_FLOAT - floating
- MODE_PARTIAL_INT - PSImode and PDImode
- MODE_CC - modes used for representing the condition code in a register
- MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT - complex number
- MODE_RANDOM - anything else
-
- Fourth argument is the relative size of the object, in bytes.
- It is zero when the size is meaningless or not determined.
- A byte's size is determined by BITS_PER_UNIT in tm.h.
-
-
- Fifth arg is the relative size of subunits of the object.
- It is same as the fourth argument except for complexes,
- since they are really made of two equal size subunits.
-
- Sixth arg is next wider natural mode of the same class.
- 0 if there is none. */
-
-/* VOIDmode is used when no mode needs to be specified,
- as for example on CONST_INT RTL expressions. */
-DEF_MACHMODE (VOIDmode, "VOID", MODE_RANDOM, 0, 0, VOIDmode)
-
-DEF_MACHMODE (QImode, "QI", MODE_INT, 1, 1, HImode) /* int types */
-DEF_MACHMODE (HImode, "HI", MODE_INT, 2, 2, SImode)
-/* Pointers on some machines use this type to distinguish them from ints.
- Useful if a pointer is 4 bytes but has some bits that are not significant,
- so it is really not quite as wide as an integer. */
-DEF_MACHMODE (PSImode, "PSI", MODE_PARTIAL_INT, 4, 4, PDImode)
-DEF_MACHMODE (SImode, "SI", MODE_INT, 4, 4, DImode)
-DEF_MACHMODE (PDImode, "PDI", MODE_PARTIAL_INT, 8, 8, VOIDmode)
-DEF_MACHMODE (DImode, "DI", MODE_INT, 8, 8, TImode)
-DEF_MACHMODE (TImode, "TI", MODE_INT, 16, 16, OImode)
-DEF_MACHMODE (OImode, "OI", MODE_INT, 32, 32, VOIDmode)
-
-DEF_MACHMODE (QFmode, "QF", MODE_FLOAT, 1, 1, HFmode)
-DEF_MACHMODE (HFmode, "HF", MODE_FLOAT, 2, 2, TQFmode)
-DEF_MACHMODE (TQFmode, "TQF", MODE_FLOAT, 3, 3, SFmode) /* MIL-STD-1750A */
-DEF_MACHMODE (SFmode, "SF", MODE_FLOAT, 4, 4, DFmode)
-DEF_MACHMODE (DFmode, "DF", MODE_FLOAT, 8, 8, XFmode)
-DEF_MACHMODE (XFmode, "XF", MODE_FLOAT, 12, 12, TFmode) /* IEEE extended */
-DEF_MACHMODE (TFmode, "TF", MODE_FLOAT, 16, 16, VOIDmode)
-
-/* Complex modes. */
-DEF_MACHMODE (SCmode, "SC", MODE_COMPLEX_FLOAT, 8, 4, DCmode)
-DEF_MACHMODE (DCmode, "DC", MODE_COMPLEX_FLOAT, 16, 8, XCmode)
-DEF_MACHMODE (XCmode, "XC", MODE_COMPLEX_FLOAT, 24, 12, TCmode)
-DEF_MACHMODE (TCmode, "TC", MODE_COMPLEX_FLOAT, 32, 16, VOIDmode)
-
-DEF_MACHMODE (CQImode, "CQI", MODE_COMPLEX_INT, 2, 1, CHImode)
-DEF_MACHMODE (CHImode, "CHI", MODE_COMPLEX_INT, 4, 2, CSImode)
-DEF_MACHMODE (CSImode, "CSI", MODE_COMPLEX_INT, 8, 4, CDImode)
-DEF_MACHMODE (CDImode, "CDI", MODE_COMPLEX_INT, 16, 8, CTImode)
-DEF_MACHMODE (CTImode, "CTI", MODE_COMPLEX_INT, 32, 16, COImode)
-DEF_MACHMODE (COImode, "COI", MODE_COMPLEX_INT, 64, 32, VOIDmode)
-
-/* BLKmode is used for structures, arrays, etc.
- that fit no more specific mode. */
-DEF_MACHMODE (BLKmode, "BLK", MODE_RANDOM, 0, 0, VOIDmode)
-
-/* The modes for representing the condition codes come last. CCmode is
- always defined. Additional modes for the condition code can be specified
- in the EXTRA_CC_MODES macro. Everything but the names of the modes
- are copied from CCmode. For these modes, GET_MODE_WIDER_MODE points
- to the next defined CC mode, if any. */
-
-DEF_MACHMODE (CCmode, "CC", MODE_CC, 4, 4, VOIDmode)
-
-/* The symbol Pmode stands for one of the above machine modes (usually SImode).
- The tm file specifies which one. It is not a distinct mode. */
-
-/*
-Local variables:
-mode:c
-version-control: t
-End:
-*/
diff --git a/gcc/machmode.h b/gcc/machmode.h
deleted file mode 100644
index f1f146f2ecf..00000000000
--- a/gcc/machmode.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Machine mode definitions for GNU C-Compiler; included by rtl.h and tree.h.
- Copyright (C) 1991, 1993, 1994, 1996 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. */
-
-#ifndef HAVE_MACHINE_MODES
-#define HAVE_MACHINE_MODES
-
-#include "gansidecl.h"
-
-/* Strictly speaking, this isn't the proper place to include these definitions,
- but this file is included by every GCC file.
-
- Some systems define these in, e.g., param.h. We undefine these names
- here to avoid the warnings. We prefer to use our definitions since we
- know they are correct. */
-
-#undef MIN
-#undef MAX
-
-#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
-#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
-
-/* Find the largest host integer type and set its size and type. */
-
-#ifndef HOST_BITS_PER_WIDE_INT
-
-#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
-#define HOST_WIDE_INT long
-#else
-#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
-#define HOST_WIDE_INT int
-#endif
-
-#endif
-
-/* Provide a default way to print an address in hex via printf. */
-
-#ifndef HOST_PTR_PRINTF
-#define HOST_PTR_PRINTF \
- (sizeof (int) == sizeof (char *) ? "%x" \
- : sizeof (long) == sizeof (char *) ? "%lx" : "%llx")
-#endif
-
-/* Provide defaults for the way to print a HOST_WIDE_INT
- in various manners. */
-
-#ifndef HOST_WIDE_INT_PRINT_DEC
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
-#define HOST_WIDE_INT_PRINT_DEC "%d"
-#else
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
-#define HOST_WIDE_INT_PRINT_DEC "%ld"
-#else
-#define HOST_WIDE_INT_PRINT_DEC "%lld"
-#endif
-#endif
-#endif
-
-#ifndef HOST_WIDE_INT_PRINT_UNSIGNED
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
-#define HOST_WIDE_INT_PRINT_UNSIGNED "%u"
-#else
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
-#define HOST_WIDE_INT_PRINT_UNSIGNED "%lu"
-#else
-#define HOST_WIDE_INT_PRINT_UNSIGNED "%llu"
-#endif
-#endif
-#endif
-
-#ifndef HOST_WIDE_INT_PRINT_HEX
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
-#define HOST_WIDE_INT_PRINT_HEX "0x%x"
-#else
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
-#define HOST_WIDE_INT_PRINT_HEX "0x%lx"
-#else
-#define HOST_WIDE_INT_PRINT_HEX "0x%llx"
-#endif
-#endif
-#endif
-
-#ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX
-#if HOST_BITS_PER_WIDE_INT == 64
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
-#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x"
-#else
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
-#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
-#else
-#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
-#endif
-#endif
-#else
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
-#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x"
-#else
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
-#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
-#else
-#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx"
-#endif
-#endif
-#endif
-#endif
-
-/* Make an enum class that gives all the machine modes. */
-
-#define DEF_MACHMODE(SYM, NAME, TYPE, SIZE, UNIT, WIDER) SYM,
-
-enum machine_mode {
-#include "machmode.def"
-
-#ifdef EXTRA_CC_MODES
- EXTRA_CC_MODES,
-#endif
-MAX_MACHINE_MODE };
-
-#undef DEF_MACHMODE
-
-#ifndef NUM_MACHINE_MODES
-#define NUM_MACHINE_MODES (int) MAX_MACHINE_MODE
-#endif
-
-/* Get the name of mode MODE as a string. */
-
-extern char *mode_name[];
-#define GET_MODE_NAME(MODE) (mode_name[(int) (MODE)])
-
-enum mode_class { MODE_RANDOM, MODE_INT, MODE_FLOAT, MODE_PARTIAL_INT, MODE_CC,
- MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT, MAX_MODE_CLASS};
-
-/* Get the general kind of object that mode MODE represents
- (integer, floating, complex, etc.) */
-
-extern enum mode_class mode_class[];
-#define GET_MODE_CLASS(MODE) (mode_class[(int) (MODE)])
-
-/* Nonzero if MODE is an integral mode. */
-#define INTEGRAL_MODE_P(MODE) \
- (GET_MODE_CLASS (MODE) == MODE_INT \
- || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT)
-
-/* Nonzero if MODE is a floating-point mode. */
-#define FLOAT_MODE_P(MODE) \
- (GET_MODE_CLASS (MODE) == MODE_FLOAT \
- || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
-
-/* Get the size in bytes of an object of mode MODE. */
-
-extern int mode_size[];
-#define GET_MODE_SIZE(MODE) (mode_size[(int) (MODE)])
-
-/* Get the size in bytes of the basic parts of an object of mode MODE. */
-
-extern int mode_unit_size[];
-#define GET_MODE_UNIT_SIZE(MODE) (mode_unit_size[(int) (MODE)])
-
-/* Get the number of units in the object. */
-
-#define GET_MODE_NUNITS(MODE) \
- ((GET_MODE_UNIT_SIZE ((MODE)) == 0) ? 0 \
- : (GET_MODE_SIZE ((MODE)) / GET_MODE_UNIT_SIZE ((MODE))))
-
-/* Get the size in bits of an object of mode MODE. */
-
-#define GET_MODE_BITSIZE(MODE) (BITS_PER_UNIT * mode_size[(int) (MODE)])
-
-/* Get a bitmask containing 1 for all bits in a word
- that fit within mode MODE. */
-
-#define GET_MODE_MASK(MODE) \
- ((GET_MODE_BITSIZE (MODE) >= HOST_BITS_PER_WIDE_INT) \
- ?(HOST_WIDE_INT) ~0 : (((HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (MODE)) - 1))
-
-/* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */
-
-extern enum machine_mode mode_wider_mode[];
-#define GET_MODE_WIDER_MODE(MODE) (mode_wider_mode[(int) (MODE)])
-
-/* Return the mode for data of a given size SIZE and mode class CLASS.
- If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE.
- The value is BLKmode if no other mode is found. */
-
-extern enum machine_mode mode_for_size PROTO((unsigned int, enum mode_class, int));
-
-/* Find the best mode to use to access a bit field. */
-
-extern enum machine_mode get_best_mode PROTO((int, int, int, enum machine_mode, int));
-
-/* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT. */
-
-#define GET_MODE_ALIGNMENT(MODE) \
- MIN (BIGGEST_ALIGNMENT, \
- MAX (1, (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT)))
-
-/* For each class, get the narrowest mode in that class. */
-
-extern enum machine_mode class_narrowest_mode[];
-#define GET_CLASS_NARROWEST_MODE(CLASS) class_narrowest_mode[(int) (CLASS)]
-
-/* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD
- and the mode whose class is Pmode and whose size is POINTER_SIZE. */
-
-extern enum machine_mode byte_mode;
-extern enum machine_mode word_mode;
-extern enum machine_mode ptr_mode;
-
-#endif /* not HAVE_MACHINE_MODES */
diff --git a/gcc/make-cc1.com b/gcc/make-cc1.com
deleted file mode 100644
index 9f816b78d74..00000000000
--- a/gcc/make-cc1.com
+++ /dev/null
@@ -1,544 +0,0 @@
-$v='f$verify(0) !make-cc1.com
-$!
-$! Build the GNU C compiler on VMS.
-$!
-$! Usage:
-$! $ @make-cc1.com [host-compiler] [various]
-$!
-$! where [host-compiler] is one of "GNUC", "VAXC", "DECC";
-$! default when none specified is "GNUC",
-$! and where [various] is one or more of "CC1", "CC1PLUS",
-$! "CC1OBJ", "OBJCLIB", "INDEPENDENT", "BC", "ALL", "LINK", "DEBUG".
-$! "CC1" (C compiler) is the default; of the others, only
-$! "CC1PLUS" (C++ compiler), "CC1OBJ" (Objective-C compiler),
-$! and "OBJCLIB" (Objective-C run-time library) are of interest
-$! for normal installation.
-$! If both [host-compiler] and other option(s) are specified,
-$! the host compiler argument must come first.
-$!
-$ if f$type(gcc_debug).eqs."INTEGER" then if gcc_debug.and.1 then set verify
-$
-$ p1 = f$edit(p1,"UPCASE,TRIM")
-$ if p1.eqs."" then p1 = "GNUC"
-$!
-$! Compiler-specific setup (assume GNU C, then override as necessary):
-$!
-$ CC = "gcc"
-$ CFLAGS = "/Debug/noVerbos/CC1=""-mpcc-alignment"""
-$ LIBS = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr"
-$ if p1.eqs."GNUC"
-$ then
-$ p1 = ""
-$ else
-$ CC = "cc"
-$ CFLAGS = "/noOpt" !disable optimizer when bootstrapping with native cc
-$ if p2.eqs."DEBUG" .or. p3.eqs."DEBUG" then CFLAGS = CFLAGS + "/Debug"
-$ if p1.eqs."VAXC"
-$ then
-$ p1 = ""
-$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/VAXC"
-$ LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr"
-$ define/noLog SYS SYS$LIBRARY:
-$ else
-$ if p1.eqs."DECC"
-$ then
-$ p1 = ""
-$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/DECC"
-$ CC = CC + "/Prefix=All/Warn=Disabl=(ImplicitFunc)"
-$ LIBS = "alloca.obj" !DECC$SHR will be found implicitly by linker
-$ define/noLog SYS DECC$LIBRARY_INCLUDE:
-$ endif !DECC
-$ endif !VAXC
-$ endif !GNUC
-$
-$!
-$! Other setup:
-$!
-$ LDFLAGS = "/noMap"
-$ PARSER = "bison"
-$ PARSER_FLAGS= "/Define/Verbose"
-$ RENAME = "rename/New_Version"
-$ LINK = "link"
-$ EDIT = "edit"
-$ SEARCH = "search"
-$ ABORT = "exit %x002C"
-$ echo = "write sys$output"
-$!
-$! Stage[123] options
-$!
-$ CINCL1 = "/Incl=[]" !stage 1 -I flags
-$ CINCL2 = "/Incl=([],[.ginclude])" !stage 2,3,... flags
-$ CINCL_SUB = "/Incl=([],[-],[-.ginclude])" ![.cp] flags
-$
-$!!!!!!!
-$! Nothing beyond this point should need any local configuration changes.
-$!!!!!!!
-$
-$! Set the default directory to the same place as this command procedure.
-$ flnm = f$enviroment("PROCEDURE") !get current procedure name
-$ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
-$
-$!
-$! First we figure out what needs to be done. This is sort of like a limited
-$! make facility - the command line options specify exactly what components
-$! we want to build. The following options are understood:
-$!
-$! LINK: Assume that the object modules for the selected compiler(s)
-$! have already been compiled, perform link phase only.
-$!
-$! CC1: Compile and link "C" compiler.
-$!
-$! CC1PLUS:Compile and link "C++" compiler.
-$!
-$! CC1OBJ: Compile and link objective C compiler.
-$!
-$! ALL: Compile and link all of the CC1 passes.
-$!
-$! INDEPENDENT:
-$! Compile language independent source modules. (On by default).
-$!
-$! BC:
-$! Compile byte compiler source modules. (On by default).
-$!
-$! OBJCLIB:
-$! Compile Objective-C run-time library.
-$!
-$! DEBUG: Link images with /debug.
-$!
-$! If you want to list more than one option, you should use a spaces to
-$! separate them.
-$!
-$! Any one of the above options can be prefaced with a "NO". For example,
-$! if you had already built GCC, and you wanted to build G++, you could use the
-$! "CC1PLUS NOINDEPENDENT" options, which would only compile the C++ language
-$! specific source files, and then link the C++ compiler.
-$!
-$! If you do not specify which compiler you want to build, it is assumed that
-$! you want to build GNU-C ("CC1").
-$!
-$! Now figure out what we have been requested to do.
-$p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7+" "+p8
-$p1 = f$edit(p1,"COMPRESS,TRIM")
-$i=0
-$DO_ALL = 0
-$DO_LINK = 0
-$DO_DEBUG = 0
-$DO_CC1PLUS = 0
-$DO_CC1OBJ = 0
-$DO_OBJCLIB = 0
-$if f$trnlnm("cfile$").nes."" then close/noLog cfile$
-$open cfile$ compilers.list
-$cinit:read cfile$ compilername/end=cinit_done
-$DO_'compilername'=0
-$goto cinit
-$cinit_done: close cfile$
-$DO_INDEPENDENT = 1
-$DO_DEFAULT = 1
-$DO_BC = 1
-$loop:
-$string = f$element(i," ",p1)
-$if string.eqs." " then goto done
-$flag = 1
-$if string.eqs."CC1PLUS" then DO_DEFAULT = 0
-$if string.eqs."CC1OBJ" then DO_DEFAULT = 0
-$if string.eqs."OBJCLIB"
-$then DO_DEFAULT = 0
-$ DO_INDEPENDENT = DO_CC1OBJ
-$ DO_BC = DO_CC1OBJ
-$endif
-$if f$extract(0,2,string).nes."NO" then goto parse_option
-$ string=f$extract(2,f$length(string)-2,string)
-$ flag = 0
-$parse_option:
-$DO_'string' = flag
-$i=i+1
-$goto loop
-$!
-$done:
-$if DO_DEFAULT.eq.1 then DO_CC1 = 1
-$echo "This command file will now perform the following actions:
-$if DO_LINK.eq.1 then goto link_only
-$if DO_ALL.eq.1 then echo " Compile all language specific object modules."
-$if DO_CC1.eq.1 then echo " Compile C specific object modules."
-$if DO_CC1PLUS.eq.1 then echo " Compile C++ specific object modules."
-$if DO_CC1OBJ.eq.1 then echo " Compile obj-C specific object modules."
-$if DO_INDEPENDENT.eq.1 then echo " Compile language independent object modules."
-$if DO_BC.eq.1 then echo " Compile byte compiler object modules."
-$if DO_OBJCLIB.eq.1 then echo " Create Objective-C run-time library."
-$link_only:
-$if DO_CC1.eq.1 then echo " Link C compiler (gcc-cc1.exe)."
-$if DO_CC1PLUS.eq.1 then echo " Link C++ compiler (gcc-cc1plus.exe)."
-$if DO_CC1OBJ.eq.1 then echo " Link objective-C compiler (gcc-cc1obj.exe)."
-$if DO_DEBUG.eq.1 then echo " Link images to run under debugger."
-$!
-$! Update CFLAGS with appropriate CINCLx value.
-$!
-$if f$edit(f$extract(0,3,CC),"LOWERCASE").nes."gcc" then goto stage1
-$if f$search("gcc-cc1.exe").eqs."" then goto stage1
-$if f$file_attr("gnu_cc:[000000]gcc-cc1.exe","FID").nes.-
- f$file_attr("gcc-cc1.exe","FID") then goto stage1
-$ CFLAGS = CFLAGS + CINCL2
-$ goto cinclX
-$stage1:
-$ CFLAGS = CFLAGS + CINCL1
-$cinclX:
-$!
-$! Test and see if we need these messages or not. The -1 switch gives it away.
-$!
-$gas := $gnu_cc:[000000]gcc-as.exe
-$if f$search(gas-"$").eqs."" then goto gas_missing_message !must be VAXC
-$define/user sys$error sys$scratch:gas_test.tmp
-$gas -1 nla0: -o nla0:
-$size=f$file_attributes("sys$scratch:gas_test.tmp","ALQ")
-$delete/nolog sys$scratch:gas_test.tmp;*
-$if size.eq.0 then goto skip_gas_message
-$type sys$input: !an old version of gas was found
-
------
- Note: you appear to have an old version of gas, the GNU assembler.
-GCC 2.x treats external variables differently than GCC 1.x does. Before
-you use GCC 2.x, you should obtain a version of the assembler which works
-with GCC 2.x (gas-1.38 and earlier did not have the necessary support;
-gas-2.0 through gas-2.3 did not work reliably for vax/vms configuration).
-The assembler in gcc-vms-1.42 contained patches to provide the proper
-support, and more recent versions have an up to date version of gas which
-provides the support. gas from binutils-2.5 or later is recommended.
-
- If you do not update the assembler, the compiler will still work,
-but `extern const' variables will be treated as `extern'. This will result
-in linker warning messages about mismatched psect attributes, and these
-variables will be placed in read/write storage.
------
-
-$goto skip_gas_message
-$gas_missing_message:
-$type sys$input: !no version of gas was found
-
------
- Note: you appear to be missing gas, the GNU assembler. Since
-GCC produces assembly code as output from compilation, you need the
-assembler to make full use of the compiler. It should be put in place
-as GNU_CC:[000000]GCC-AS.EXE.
-
- A prebuilt copy of gas is available from the "gcc-vms" distribution,
-and the gas source code is included in the GNU "binutils" distribution.
-Version 2.5.2 or later is recommended.
------
-
-$skip_gas_message:
-$!
-$!
-$ if DO_DEBUG.eq.1 then LDFLAGS = LDFLAGS + "/Debug"
-$!
-$if DO_LINK.eq.1 then goto no_yfiles !compile_cc1
-$!
-$! Build alloca if necessary (in 'LIBS for use with VAXC)
-$!
-$ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).ge.f$length(LIBS) then -
- goto skip_alloca
-$ if f$search("alloca.obj").nes."" then - !does .obj exist? is it up to date?
- if f$cvtime(f$file_attributes("alloca.obj","RDT")).gts.-
- f$cvtime(f$file_attributes("alloca.c","RDT")) then goto skip_alloca
-$set verify
-$ 'CC''CFLAGS'/Defi=("HAVE_CONFIG_H","STACK_DIRECTION=(-1)") alloca.c
-$!'f$verify(0)
-$skip_alloca:
-$!
-$if DO_BC.eq.1
-$ then
-$ call compile bi_all.opt ""
-$ if f$trnlnm("ifile$").nes."" then close/noLog ifile$
-$ open ifile$ bc_all.list
-$ read ifile$ bc_line
-$ close ifile$
-$ bc_index = 0
-$bc_loop:
-$ tfile = f$element(bc_index, ",", bc_line)
-$ if tfile.eqs."," then goto bc_done
-$ call bc_generate 'tfile' "bi_all.opt/opt,"
-$ bc_index = bc_index + 1
-$ goto bc_loop
-$bc_done:
-$ endif
-$!
-$!
-$if DO_INDEPENDENT.eq.1
-$ then
-$!
-$! First build a couple of header files from the machine description
-$! These are used by many of the source modules, so we build them now.
-$!
-$set verify
-$ 'CC''CFLAGS' rtl.c
-$ 'CC''CFLAGS' obstack.c
-$!'f$verify(0)
-$! Generate insn-attr.h
-$ call generate insn-attr.h
-$ call generate insn-flags.h
-$ call generate insn-codes.h
-$ call generate insn-config.h
-$!
-$call compile independent.opt "rtl,obstack,insn-attrtab"
-$!
-$ call generate insn-attrtab.c "rtlanal.obj,"
-$set verify
-$ 'CC''CFLAGS' insn-attrtab.c
-$ 'CC''CFLAGS' bc-emit.c
-$ 'CC''CFLAGS' bc-optab.c
-$!'f$verify(0)
-$ endif
-$!
-$compile_cc1:
-$if (DO_CC1 + DO_CC1OBJ) .ne.0
-$ then
-$if (f$search("C-PARSE.Y") .eqs. "") then goto yes_yfiles
-$if (f$cvtime(f$file_attributes("C-PARSE.IN","RDT")).gts. -
- f$cvtime(f$file_attributes("C-PARSE.Y","RDT"))) -
- then goto yes_yfiles
-$if (f$search("OBJC-PARSE.Y") .eqs. "") then goto yes_yfiles
-$if (f$cvtime(f$file_attributes("C-PARSE.IN","RDT")).gts. -
- f$cvtime(f$file_attributes("OBJC-PARSE.Y","RDT"))) -
- then goto yes_yfiles
-$GOTO no_yfiles
-$yes_yfiles:
-$echo "Now processing c-parse.in to generate c-parse.y and objc-parse.y."
-$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input
-!
-! Read c-parse.in, write c-parse.y and objc-parse.y, depending on
-! paired lines of "ifc" & "end ifc" and "ifobjc" & "end ifobjc" to
-! control what goes into each file. Most lines will be common to
-! both (hence not bracketed by either control pair). Mismatched
-! pairs aren't detected--garbage in, garbage out...
-!
-
- PROCEDURE do_output()
- IF NOT objc_only THEN POSITION(END_OF(c)); COPY_TEXT(input_line); ENDIF;
- IF NOT c_only THEN POSITION(END_OF(objc)); COPY_TEXT(input_line); ENDIF;
- POSITION(input_file); !reset
- ENDPROCEDURE;
-
- input_file := CREATE_BUFFER("input", "c-parse.in"); !load data
- SET(NO_WRITE, input_file);
- c := CREATE_BUFFER("c_output"); !1st output file
- objc := CREATE_BUFFER("objc_output"); !2nd output file
-
- POSITION(BEGINNING_OF(input_file));
- c_only := 0;
- objc_only := 0;
-
- LOOP
- EXITIF MARK(NONE) = END_OF(input_file); !are we done yet?
-
- input_line := CURRENT_LINE; !access current_line just once
- CASE EDIT(input_line, TRIM_TRAILING, OFF, NOT_IN_PLACE)
- ["ifc"] : c_only := 1;
- ["end ifc"] : c_only := 0;
- ["ifobjc"] : objc_only := 1;
- ["end ifobjc"] : objc_only := 0;
-! default -- add non-control line to either or both output files
- [INRANGE] : do_output(); !between "end" and "if"
- [OUTRANGE] : do_output(); !before "end" or after "if"
- ENDCASE;
-
- MOVE_VERTICAL(1); !go to next line
- ENDLOOP;
-
- WRITE_FILE(c, "c-parse.y");
- WRITE_FILE(objc, "objc-parse.y");
- QUIT
-$ endif
-$no_yfiles:
-$!
-$open cfile$ compilers.list
-$cloop:read cfile$ compilername/end=cdone
-$! language specific modules
-$!
-$if (DO_ALL + DO_'compilername').eq.0 then goto cloop
-$if DO_LINK.eq.0 then -
- call compile 'compilername'-objs.opt "obstack,bc-emit,bc-optab"
-$!
-$! CAUTION: If you want to link gcc-cc1* to the sharable image library
-$! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first.
-$!
-$set verify
-$ 'LINK''LDFLAGS'/Exe=gcc-'compilername'.exe version.opt/Opt,-
- 'compilername'-objs.opt/Opt,independent.opt/Opt,-
- 'LIBS'
-$!'f$verify(0)
-$goto cloop
-$!
-$!
-$cdone: close cfile$
-$!
-$ if DO_OBJCLIB
-$ then set default [.objc] !push
-$ save_cflags = CFLAGS
-$ CFLAGS = CFLAGS - CINCL1 - CINCL2 + CINCL_SUB
-$ MFLAGS = "/Lang=ObjC" + CFLAGS
-$ library/Obj [-]objclib.olb/Create
-$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$
-$ open/Read ifile$ [-]objc-objs.opt
-$ocl1: read/End=ocl3 ifile$ line
-$ i = 0
-$ocl2: o = f$element(i,",",line)
-$ if o.eqs."," then goto ocl1
-$ n = o - ".o"
-$ if f$search(n + ".m").nes.""
-$ then f = n + ".m"
-$ flags = MFLAGS
-$ else f = n + ".c"
-$ flags = CFLAGS
-$ endif
-$ set verify
-$ 'CC' 'flags' 'f'
-$!'f$verify(0)'
-$ library/Obj [-]objclib.olb 'n'.obj/Insert
-$ delete/noConfirm/noLog 'n'.obj;*
-$ i = i + 1
-$ goto ocl2
-$ocl3: close ifile$
-$ CFLAGS = save_cflags
-$ set default [-] !pop
-$ endif !DO_OBJCLIB
-$!
-$! Done
-$!
-$! 'f$verify(v)
-$exit
-$!
-$! Various DCL subroutines follow...
-$!
-$! This routine takes parameter p1 to be a linker options file with a list
-$! of object files that are needed. It extracts the names, and compiles
-$! each source module, one by one. File names that begin with an
-$! "INSN-" are assumed to be generated by a GEN*.C program.
-$!
-$! Parameter P2 is a list of files which will appear in the options file
-$! that should not be compiled. This allows us to handle special cases.
-$!
-$compile:
-$subroutine
-$on error then goto c_err
-$on control_y then goto c_err
-$open ifile$ 'p1'
-$loop: read ifile$ line/end=c_done
-$!
-$i=0
-$loop1:
-$flnm=f$element(i,",",line)
-$i=i+1
-$if flnm.eqs."" then goto loop
-$if flnm.eqs."," then goto loop
-$if f$locate(flnm,p2).lt.f$length(p2) then goto loop1
-$! check for front-end subdirectory: "[.prfx]flnm"
-$prfx = ""
-$k = f$locate("]",flnm)
-$if k.eq.1 ![]c-common for [.cp]
-$then
-$ if f$search(f$parse(".obj",flnm)).nes."" then goto loop1
-$ flnm = f$extract(2,999,flnm)
-$else if k.lt.f$length(flnm)
-$ then prfx = f$extract(2,k-2,flnm)
-$ flnm = f$extract(k+1,99,flnm)
-$ endif
-$endif
-$ if prfx.nes.""
-$ then set default [.'prfx'] !push
-$ save_cflags = CFLAGS
-$ CFLAGS = CFLAGS - CINCL1 - CINCL2 + CINCL_SUB
-$ endif
-$!
-$ if f$locate("parse",flnm).nes.f$length(flnm)
-$ then
-$ if f$search("''flnm'.c").nes."" then -
- if f$cvtime(f$file_attributes("''flnm'.c","RDT")).ges. -
- f$cvtime(f$file_attributes("''flnm'.y","RDT")) then goto skip_yacc
-$ set verify
-$ 'PARSER' 'PARSER_FLAGS' 'flnm'.y
-$ 'RENAME' 'flnm'_tab.c 'flnm'.c
-$ 'RENAME' 'flnm'_tab.h 'flnm'.h
-$!'f$verify(0)
-$ if flnm.eqs."cp-parse" .or. (prfx.eqs."cp" .and. flnm.eqs."parse")
-$ then ! fgrep '#define YYEMPTY' cp-parse.c >>cp-parse.h
-$ if f$trnlnm("JFILE$").nes."" then close/noLog jfile$
-$ open/Append jfile$ 'flnm'.h
-$ 'SEARCH'/Exact/Output=jfile$ 'flnm'.c "#define YYEMPTY"
-$ close jfile$
-$ endif
-$skip_yacc:
-$ echo " (Ignore any warning about not finding file ""bison.simple"".)"
-$ endif
-$!
-$if f$extract(0,5,flnm).eqs."insn-" then call generate 'flnm'.c
-$!
-$set verify
-$ 'CC''CFLAGS' 'flnm'.c
-$!'f$verify(0)
-$ if prfx.nes.""
-$ then set default [-] !pop
-$ CFLAGS = save_CFLAGS
-$ endif
-$
-$goto loop1
-$!
-$!
-$! In case of error or abort, go here (In order to close file).
-$!
-$c_err: !'f$verify(0)
-$close ifile$
-$ABORT
-$!
-$c_done:
-$close ifile$
-$endsubroutine
-$!
-$! This subroutine generates the insn-* files. The first argument is the
-$! name of the insn-* file to generate. The second argument contains a
-$! list of any other object modules which must be linked to the gen*.c
-$! program.
-$!
-$generate:
-$subroutine
-$if f$extract(0,5,p1).nes."INSN-"
-$ then
-$ write sys$error "Unknown file passed to generate."
-$ ABORT
-$ endif
-$root1=f$parse(f$extract(5,255,p1),,,"NAME")
-$ set verify
-$ 'CC''CFLAGS' GEN'root1'.C
-$ 'LINK''f$string(LDFLAGS - "/Debug")' GEN'root1'.OBJ,rtl.obj,obstack.obj,'p2' -
- 'LIBS'
-$! 'f$verify(0)
-$!
-$set verify
-$ assign/user 'p1' sys$output:
-$ mcr sys$disk:[]GEN'root1' vax.md
-$!'f$verify(0)
-$endsubroutine
-$!
-$! This subroutine generates the bc-* files. The first argument is the
-$! name of the bc-* file to generate. The second argument contains a
-$! list of any other object modules which must be linked to the bi*.c
-$! program.
-$!
-$bc_generate:
-$subroutine
-$if f$extract(0,3,p1).nes."BC-"
-$ then
-$ write sys$error "Unknown file passed to bc_generate."
-$ ABORT
-$ endif
-$root1=f$parse(f$extract(3,255,p1),,,"NAME")
-$ set verify
-$ 'CC''CFLAGS' BI-'root1'.C
-$ 'LINK''f$string(LDFLAGS - "/Debug")' BI-'root1'.OBJ,'p2' -
- 'LIBS'
-$! 'f$verify(0)
-$!
-$set verify
-$ assign/user bytecode.def sys$input:
-$ assign/user 'p1' sys$output:
-$ mcr sys$disk:[]BI-'root1'
-$!'f$verify(0)
-$endsubroutine
diff --git a/gcc/make-cccp.com b/gcc/make-cccp.com
deleted file mode 100644
index e383f310df2..00000000000
--- a/gcc/make-cccp.com
+++ /dev/null
@@ -1,117 +0,0 @@
-$v='f$verify(0) !make-cccp.com
-$!
-$! Build the GNU C preprocessor on VMS.
-$!
-$! Usage:
-$! $ @make-cccp.com [compiler] [link-only]
-$!
-$! where [compiler] is one of "GNUC", "VAXC", "DECC";
-$! default when none specified is "GNUC",
-$! and where [link-only] is "LINK" or omitted.
-$! If both options are specified, the compiler must come first.
-$!
-$ if f$type(gcc_debug).eqs."INTEGER" then if gcc_debug.and.1 then set verify
-$
-$ p1 = f$edit(p1,"UPCASE,TRIM")
-$ if p1.eqs."" then p1 = "GNUC"
-$!
-$! Compiler-specific setup (assume GNU C, then override as necessary):
-$!
-$ CC = "gcc"
-$ CFLAGS = "/Debug/noVerbos"
-$ LIBS = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr"
-$ if p1.nes."GNUC"
-$ then
-$ CC = "cc"
-$ CFLAGS = "/noOpt" !disable optimizer when bootstrapping with native cc
-$ if p1.eqs."VAXC"
-$ then
-$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/VAXC"
-$ LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr"
-$ define/noLog SYS SYS$LIBRARY:
-$ else
-$ if p1.eqs."DECC"
-$ then
-$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/DECC"
-$ LIBS = "alloca.obj" !DECC$SHR will be found implicitly by linker
-$ define/noLog SYS DECC$LIBRARY_INCLUDE:
-$ else
-$ if p1.nes."LINK"
-$ then
-$ type sys$input: /Output=sys$error:
-$DECK
-[compiler] argument should be one of "GNUC", "VAXC", or "DECC".
-
-Usage:
-$ @make-cccp.com [compiler] [link-only]
-
-$EOD
-$ exit %x1000002C + 0*f$verify(v) !%SYSTEM-F-ABORT
-$ endif !!LINK
-$ endif !DECC
-$ endif !VAXC
-$ endif !!GNUC
-$
-$!
-$! Other setup:
-$!
-$ LDFLAGS = "/noMap"
-$ PARSER = "bison"
-$ RENAME = "rename/New_Version"
-$ LINK = "link"
-$ echo = "write sys$output"
-$
-$!!!!!!!
-$! Nothing beyond this point should need any local configuration changes.
-$!!!!!!!
-$
-$! Set the default directory to the same place as this command procedure.
-$ flnm = f$enviroment("PROCEDURE") !get current procedure name
-$ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
-$
-$ if p1.eqs."LINK" .or. p2.eqs."LINK" then goto Link
-$ echo " Building the preprocessor."
-$
-$! Compile the simplest file first, to catch problem with compiler setup early.
-$ set verify
-$ 'CC''CFLAGS' version.c
-$!'f$verify(0)
-$
-$ set verify
-$ 'CC''CFLAGS' cccp.c
-$!'f$verify(0)
-$
-$! Compile preprocessor's parser, possibly making it with yacc first.
-$ if f$search("CEXP.C").nes."" then -
- if f$cvtime(f$file_attributes("CEXP.C","RDT")).ges.-
- f$cvtime(f$file_attributes("CEXP.Y","RDT")) then goto skip_yacc
-$ set verify
-$ 'PARSER' cexp.y
-$ 'RENAME' cexp_tab.c cexp.c
-$!'f$verify(0)
-$skip_yacc:
-$ echo " (Ignore any warning about not finding file ""bison.simple"".)"
-$ set verify
-$ 'CC''CFLAGS' cexp.c
-$!'f$verify(0)
-$
-$! In case there's no builtin alloca support, use the C simulation.
-$ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).lt.f$length(LIBS)
-$ then
-$ set verify
-$ 'CC''CFLAGS'/Incl=[]/Defi=("HAVE_CONFIG_H","STACK_DIRECTION=(-1)") alloca.c
-$!'f$verify(0)
-$ endif
-$!
-$
-$Link:
-$ echo " Linking the preprocessor."
-$ set verify
-$ 'LINK''LDFLAGS'/Exe=gcc-cpp.exe -
- cccp.obj,cexp.obj,version.obj,version.opt/Opt,-
- 'LIBS'
-$!'f$verify(0)
-$!
-$! Done
-$!
-$ exit 1+0*f$verify(v)
diff --git a/gcc/make-gcc.com b/gcc/make-gcc.com
deleted file mode 100644
index 03235eecd14..00000000000
--- a/gcc/make-gcc.com
+++ /dev/null
@@ -1,32 +0,0 @@
-$!
-$! Build GCC
-$!
-$! Set the def dir to proper place for use in batch. Works for interactive too.
-$flnm = f$enviroment("PROCEDURE") ! get current procedure name
-$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
-$!
-$!
-$! First, build the preprocessor.
-$!
-$ @make-cccp.com 'p1' 'p2'
-$!
-$! To build the GNU C++ compiler in addition to the GNU CC compiler, comment
-$! out the `@make-cc1' line, and uncomment the `@make-cc1 cc1 cc1plus' line.
-$! To also build Objective-C, add "cc1obj" to the list.
-$!
-$! See the file make-cc1.com for a complete list of options.
-$!
-$ @make-cc1.com 'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'
-$! @make-cc1 cc1 cc1plus
-$!
-$!
-$! Now build the library routines that are required. These will be placed in
-$! libgcc2.olb. To install, extract all of the modules from libgcc2.olb and
-$! add them to gnu_cc:[000000]gcclib.olb. You may have to delete the eprintf
-$! and new modules from the gnu_cc:[000000]gcclib.olb, since libgcc2 supplies
-$! these same routines with different module names.
-$!
-$! Now build gcclib2.olb
-$!
-$ @make-l2.com
-$!
diff --git a/gcc/make-l2.com b/gcc/make-l2.com
deleted file mode 100644
index d22ad9b0f85..00000000000
--- a/gcc/make-l2.com
+++ /dev/null
@@ -1,94 +0,0 @@
-$! Set the def dir to proper place for use in batch. Works for interactive too.
-$flnm = f$enviroment("PROCEDURE") ! get current procedure name
-$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
-$!
-$! Command file to build libgcc2.olb. You should only run this once you
-$! have the current compiler installed, otherwise some of the builtins will
-$! not be recognized. Once you have built libgcc2.olb, you can merge this
-$! with gnu_cc:[000000]gcclib.olb
-$!
-$! All of the source code is assumed to be in libgcc2.c, and a list of the
-$! modules that we need from there is in libgcc2.list (which is generated
-$! when config-gcc.com is run).
-$!
-$if f$search("gcc-cc1.exe").eqs.""
-$ then
-$ gcc_cc1:=$gnu_cc:[000000]gcc-cc1
-$ if f$extract(0,1,f$trnlnm("GNU_CC_VERSION")).eqs."1" then goto nocompile
-$ else
-$ gcc_cc1:=$sys$disk:[]gcc-cc1
-$ endif
-$!
-$if f$search("gcc-cpp.exe").eqs.""
-$ then
-$ gcc_cpp:=$gnu_cc:[000000]gcc-cpp
-$ if f$extract(0,1,f$trnlnm("GNU_CC_VERSION")).eqs."1" then goto nocompile
-$ Version:='f$trnlnm("GNU_CC_VERSION")'
-$ else
-$ gcc_cpp:=$sys$disk:[]gcc-cpp
-$ open ifile$ version.opt
-$ read ifile$ line
-$ close ifile$
-$ Version=line-"ident="""-"""
-$ endif
-$!
-$gcc_as:=$gnu_cc:[000000]gcc-as
-$cpp_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.cpp
-$s_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.s
-$!
-$set symbol/scope=(nolocal,noglobal)
-$!
-$goto compile
-$!
-$nocompile:
-$write sys$error "You must have gcc version 2 in order to build libgcc2."
-$exit 0
-$!
-$compile:
-$lib/create libgcc2.olb
-$on error then goto c_err
-$on control_y then goto c_err
-$open ifile$ libgcc2.list
-$loop: read ifile$ line/end=c_done
-$!
-$i=0
-$loop1:
-$flnm=f$element(i," ",line)
-$i=i+1
-$if flnm.eqs."" then goto loop
-$if flnm.eqs." " then goto loop
-$!
-$flnm = "L"+flnm
-$if flnm.eqs."L_exit" then goto loop1
-$write sys$output "$ gcc/debug/define=""''flnm'"" LIBGCC2.C"
-$!
-$objname = flnm
-$if flnm.eqs."L_builtin_New" then objname = "L_builtin_nnew"
-$!
-$! We do this by hand, since the VMS compiler driver does not have a way
-$! of specifying an alternate location for the compiler executables.
-$!
-$ gcc_cpp "-I[]" "-I[.ginclude]" "-D''flnm'" libgcc2.c 'cpp_file'
-$ gcc_cc1 'cpp_file' -dumpbase 'objname' -
- -quiet -mgnu -g "-O1" -mvaxc-alignment -o 's_file'
-$ delete/nolog 'cpp_file';
-$ gcc_as "-vGNU CC V''Version'" 's_file' -o 'objname'.OBJ
-$! Assemble again, preserving lowercase symbol names this time.
-$ gcc_as "-vGNU CC V''Version'" -h3 's_file' -o 'objname'-c.OBJ
-$ delete/nolog 's_file';
-$!
-$ library libgcc2.olb 'objname'.obj,'objname'-c.obj
-$ delete/nolog 'objname'.obj;,'objname'-c.obj;
-$!
-$goto loop1
-$!
-$goto loop
-$!
-$! In case of error or abort, go here (In order to close file).
-$!
-$c_err: !'f$verify(0)
-$close ifile$
-$ exit %x2c
-$!
-$c_done:
-$close ifile$
diff --git a/gcc/md.texi b/gcc/md.texi
deleted file mode 100644
index 4fe759a114a..00000000000
--- a/gcc/md.texi
+++ /dev/null
@@ -1,4096 +0,0 @@
-@c Copyright (C) 1988,89,92,93,94,96 Free Software Foundation, Inc.
-@c This is part of the GCC manual.
-@c For copying conditions, see the file gcc.texi.
-
-@ifset INTERNALS
-@node Machine Desc
-@chapter Machine Descriptions
-@cindex machine descriptions
-
-A machine description has two parts: a file of instruction patterns
-(@file{.md} file) and a C header file of macro definitions.
-
-The @file{.md} file for a target machine contains a pattern for each
-instruction that the target machine supports (or at least each instruction
-that is worth telling the compiler about). It may also contain comments.
-A semicolon causes the rest of the line to be a comment, unless the semicolon
-is inside a quoted string.
-
-See the next chapter for information on the C header file.
-
-@menu
-* Patterns:: How to write instruction patterns.
-* Example:: An explained example of a @code{define_insn} pattern.
-* RTL Template:: The RTL template defines what insns match a pattern.
-* Output Template:: The output template says how to make assembler code
- from such an insn.
-* Output Statement:: For more generality, write C code to output
- the assembler code.
-* Constraints:: When not all operands are general operands.
-* Standard Names:: Names mark patterns to use for code generation.
-* Pattern Ordering:: When the order of patterns makes a difference.
-* Dependent Patterns:: Having one pattern may make you need another.
-* Jump Patterns:: Special considerations for patterns for jump insns.
-* Insn Canonicalizations::Canonicalization of Instructions
-* Peephole Definitions::Defining machine-specific peephole optimizations.
-* Expander Definitions::Generating a sequence of several RTL insns
- for a standard operation.
-* Insn Splitting:: Splitting Instructions into Multiple Instructions
-* Insn Attributes:: Specifying the value of attributes for generated insns.
-@end menu
-
-@node Patterns
-@section Everything about Instruction Patterns
-@cindex patterns
-@cindex instruction patterns
-
-@findex define_insn
-Each instruction pattern contains an incomplete RTL expression, with pieces
-to be filled in later, operand constraints that restrict how the pieces can
-be filled in, and an output pattern or C code to generate the assembler
-output, all wrapped up in a @code{define_insn} expression.
-
-A @code{define_insn} is an RTL expression containing four or five operands:
-
-@enumerate
-@item
-An optional name. The presence of a name indicate that this instruction
-pattern can perform a certain standard job for the RTL-generation
-pass of the compiler. This pass knows certain names and will use
-the instruction patterns with those names, if the names are defined
-in the machine description.
-
-The absence of a name is indicated by writing an empty string
-where the name should go. Nameless instruction patterns are never
-used for generating RTL code, but they may permit several simpler insns
-to be combined later on.
-
-Names that are not thus known and used in RTL-generation have no
-effect; they are equivalent to no name at all.
-
-@item
-The @dfn{RTL template} (@pxref{RTL Template}) is a vector of incomplete
-RTL expressions which show what the instruction should look like. It is
-incomplete because it may contain @code{match_operand},
-@code{match_operator}, and @code{match_dup} expressions that stand for
-operands of the instruction.
-
-If the vector has only one element, that element is the template for the
-instruction pattern. If the vector has multiple elements, then the
-instruction pattern is a @code{parallel} expression containing the
-elements described.
-
-@item
-@cindex pattern conditions
-@cindex conditions, in patterns
-A condition. This is a string which contains a C expression that is
-the final test to decide whether an insn body matches this pattern.
-
-@cindex named patterns and conditions
-For a named pattern, the condition (if present) may not depend on
-the data in the insn being matched, but only the target-machine-type
-flags. The compiler needs to test these conditions during
-initialization in order to learn exactly which named instructions are
-available in a particular run.
-
-@findex operands
-For nameless patterns, the condition is applied only when matching an
-individual insn, and only after the insn has matched the pattern's
-recognition template. The insn's operands may be found in the vector
-@code{operands}.
-
-@item
-The @dfn{output template}: a string that says how to output matching
-insns as assembler code. @samp{%} in this string specifies where
-to substitute the value of an operand. @xref{Output Template}.
-
-When simple substitution isn't general enough, you can specify a piece
-of C code to compute the output. @xref{Output Statement}.
-
-@item
-Optionally, a vector containing the values of attributes for insns matching
-this pattern. @xref{Insn Attributes}.
-@end enumerate
-
-@node Example
-@section Example of @code{define_insn}
-@cindex @code{define_insn} example
-
-Here is an actual example of an instruction pattern, for the 68000/68020.
-
-@example
-(define_insn "tstsi"
- [(set (cc0)
- (match_operand:SI 0 "general_operand" "rm"))]
- ""
- "*
-@{ if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
- return \"tstl %0\";
- return \"cmpl #0,%0\"; @}")
-@end example
-
-This is an instruction that sets the condition codes based on the value of
-a general operand. It has no condition, so any insn whose RTL description
-has the form shown may be handled according to this pattern. The name
-@samp{tstsi} means ``test a @code{SImode} value'' and tells the RTL generation
-pass that, when it is necessary to test such a value, an insn to do so
-can be constructed using this pattern.
-
-The output control string is a piece of C code which chooses which
-output template to return based on the kind of operand and the specific
-type of CPU for which code is being generated.
-
-@samp{"rm"} is an operand constraint. Its meaning is explained below.
-
-@node RTL Template
-@section RTL Template
-@cindex RTL insn template
-@cindex generating insns
-@cindex insns, generating
-@cindex recognizing insns
-@cindex insns, recognizing
-
-The RTL template is used to define which insns match the particular pattern
-and how to find their operands. For named patterns, the RTL template also
-says how to construct an insn from specified operands.
-
-Construction involves substituting specified operands into a copy of the
-template. Matching involves determining the values that serve as the
-operands in the insn being matched. Both of these activities are
-controlled by special expression types that direct matching and
-substitution of the operands.
-
-@table @code
-@findex match_operand
-@item (match_operand:@var{m} @var{n} @var{predicate} @var{constraint})
-This expression is a placeholder for operand number @var{n} of
-the insn. When constructing an insn, operand number @var{n}
-will be substituted at this point. When matching an insn, whatever
-appears at this position in the insn will be taken as operand
-number @var{n}; but it must satisfy @var{predicate} or this instruction
-pattern will not match at all.
-
-Operand numbers must be chosen consecutively counting from zero in
-each instruction pattern. There may be only one @code{match_operand}
-expression in the pattern for each operand number. Usually operands
-are numbered in the order of appearance in @code{match_operand}
-expressions.
-
-@var{predicate} is a string that is the name of a C function that accepts two
-arguments, an expression and a machine mode. During matching, the
-function will be called with the putative operand as the expression and
-@var{m} as the mode argument (if @var{m} is not specified,
-@code{VOIDmode} will be used, which normally causes @var{predicate} to accept
-any mode). If it returns zero, this instruction pattern fails to match.
-@var{predicate} may be an empty string; then it means no test is to be done
-on the operand, so anything which occurs in this position is valid.
-
-Most of the time, @var{predicate} will reject modes other than @var{m}---but
-not always. For example, the predicate @code{address_operand} uses
-@var{m} as the mode of memory ref that the address should be valid for.
-Many predicates accept @code{const_int} nodes even though their mode is
-@code{VOIDmode}.
-
-@var{constraint} controls reloading and the choice of the best register
-class to use for a value, as explained later (@pxref{Constraints}).
-
-People are often unclear on the difference between the constraint and the
-predicate. The predicate helps decide whether a given insn matches the
-pattern. The constraint plays no role in this decision; instead, it
-controls various decisions in the case of an insn which does match.
-
-@findex general_operand
-On CISC machines, the most common @var{predicate} is
-@code{"general_operand"}. This function checks that the putative
-operand is either a constant, a register or a memory reference, and that
-it is valid for mode @var{m}.
-
-@findex register_operand
-For an operand that must be a register, @var{predicate} should be
-@code{"register_operand"}. Using @code{"general_operand"} would be
-valid, since the reload pass would copy any non-register operands
-through registers, but this would make GNU CC do extra work, it would
-prevent invariant operands (such as constant) from being removed from
-loops, and it would prevent the register allocator from doing the best
-possible job. On RISC machines, it is usually most efficient to allow
-@var{predicate} to accept only objects that the constraints allow.
-
-@findex immediate_operand
-For an operand that must be a constant, you must be sure to either use
-@code{"immediate_operand"} for @var{predicate}, or make the instruction
-pattern's extra condition require a constant, or both. You cannot
-expect the constraints to do this work! If the constraints allow only
-constants, but the predicate allows something else, the compiler will
-crash when that case arises.
-
-@findex match_scratch
-@item (match_scratch:@var{m} @var{n} @var{constraint})
-This expression is also a placeholder for operand number @var{n}
-and indicates that operand must be a @code{scratch} or @code{reg}
-expression.
-
-When matching patterns, this is equivalent to
-
-@smallexample
-(match_operand:@var{m} @var{n} "scratch_operand" @var{pred})
-@end smallexample
-
-but, when generating RTL, it produces a (@code{scratch}:@var{m})
-expression.
-
-If the last few expressions in a @code{parallel} are @code{clobber}
-expressions whose operands are either a hard register or
-@code{match_scratch}, the combiner can add or delete them when
-necessary. @xref{Side Effects}.
-
-@findex match_dup
-@item (match_dup @var{n})
-This expression is also a placeholder for operand number @var{n}.
-It is used when the operand needs to appear more than once in the
-insn.
-
-In construction, @code{match_dup} acts just like @code{match_operand}:
-the operand is substituted into the insn being constructed. But in
-matching, @code{match_dup} behaves differently. It assumes that operand
-number @var{n} has already been determined by a @code{match_operand}
-appearing earlier in the recognition template, and it matches only an
-identical-looking expression.
-
-@findex match_operator
-@item (match_operator:@var{m} @var{n} @var{predicate} [@var{operands}@dots{}])
-This pattern is a kind of placeholder for a variable RTL expression
-code.
-
-When constructing an insn, it stands for an RTL expression whose
-expression code is taken from that of operand @var{n}, and whose
-operands are constructed from the patterns @var{operands}.
-
-When matching an expression, it matches an expression if the function
-@var{predicate} returns nonzero on that expression @emph{and} the
-patterns @var{operands} match the operands of the expression.
-
-Suppose that the function @code{commutative_operator} is defined as
-follows, to match any expression whose operator is one of the
-commutative arithmetic operators of RTL and whose mode is @var{mode}:
-
-@smallexample
-int
-commutative_operator (x, mode)
- rtx x;
- enum machine_mode mode;
-@{
- enum rtx_code code = GET_CODE (x);
- if (GET_MODE (x) != mode)
- return 0;
- return (GET_RTX_CLASS (code) == 'c'
- || code == EQ || code == NE);
-@}
-@end smallexample
-
-Then the following pattern will match any RTL expression consisting
-of a commutative operator applied to two general operands:
-
-@smallexample
-(match_operator:SI 3 "commutative_operator"
- [(match_operand:SI 1 "general_operand" "g")
- (match_operand:SI 2 "general_operand" "g")])
-@end smallexample
-
-Here the vector @code{[@var{operands}@dots{}]} contains two patterns
-because the expressions to be matched all contain two operands.
-
-When this pattern does match, the two operands of the commutative
-operator are recorded as operands 1 and 2 of the insn. (This is done
-by the two instances of @code{match_operand}.) Operand 3 of the insn
-will be the entire commutative expression: use @code{GET_CODE
-(operands[3])} to see which commutative operator was used.
-
-The machine mode @var{m} of @code{match_operator} works like that of
-@code{match_operand}: it is passed as the second argument to the
-predicate function, and that function is solely responsible for
-deciding whether the expression to be matched ``has'' that mode.
-
-When constructing an insn, argument 3 of the gen-function will specify
-the operation (i.e. the expression code) for the expression to be
-made. It should be an RTL expression, whose expression code is copied
-into a new expression whose operands are arguments 1 and 2 of the
-gen-function. The subexpressions of argument 3 are not used;
-only its expression code matters.
-
-When @code{match_operator} is used in a pattern for matching an insn,
-it usually best if the operand number of the @code{match_operator}
-is higher than that of the actual operands of the insn. This improves
-register allocation because the register allocator often looks at
-operands 1 and 2 of insns to see if it can do register tying.
-
-There is no way to specify constraints in @code{match_operator}. The
-operand of the insn which corresponds to the @code{match_operator}
-never has any constraints because it is never reloaded as a whole.
-However, if parts of its @var{operands} are matched by
-@code{match_operand} patterns, those parts may have constraints of
-their own.
-
-@findex match_op_dup
-@item (match_op_dup:@var{m} @var{n}[@var{operands}@dots{}])
-Like @code{match_dup}, except that it applies to operators instead of
-operands. When constructing an insn, operand number @var{n} will be
-substituted at this point. But in matching, @code{match_op_dup} behaves
-differently. It assumes that operand number @var{n} has already been
-determined by a @code{match_operator} appearing earlier in the
-recognition template, and it matches only an identical-looking
-expression.
-
-@findex match_parallel
-@item (match_parallel @var{n} @var{predicate} [@var{subpat}@dots{}])
-This pattern is a placeholder for an insn that consists of a
-@code{parallel} expression with a variable number of elements. This
-expression should only appear at the top level of an insn pattern.
-
-When constructing an insn, operand number @var{n} will be substituted at
-this point. When matching an insn, it matches if the body of the insn
-is a @code{parallel} expression with at least as many elements as the
-vector of @var{subpat} expressions in the @code{match_parallel}, if each
-@var{subpat} matches the corresponding element of the @code{parallel},
-@emph{and} the function @var{predicate} returns nonzero on the
-@code{parallel} that is the body of the insn. It is the responsibility
-of the predicate to validate elements of the @code{parallel} beyond
-those listed in the @code{match_parallel}.@refill
-
-A typical use of @code{match_parallel} is to match load and store
-multiple expressions, which can contain a variable number of elements
-in a @code{parallel}. For example,
-@c the following is *still* going over. need to change the code.
-@c also need to work on grouping of this example. --mew 1feb93
-
-@smallexample
-(define_insn ""
- [(match_parallel 0 "load_multiple_operation"
- [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
- (match_operand:SI 2 "memory_operand" "m"))
- (use (reg:SI 179))
- (clobber (reg:SI 179))])]
- ""
- "loadm 0,0,%1,%2")
-@end smallexample
-
-This example comes from @file{a29k.md}. The function
-@code{load_multiple_operations} is defined in @file{a29k.c} and checks
-that subsequent elements in the @code{parallel} are the same as the
-@code{set} in the pattern, except that they are referencing subsequent
-registers and memory locations.
-
-An insn that matches this pattern might look like:
-
-@smallexample
-(parallel
- [(set (reg:SI 20) (mem:SI (reg:SI 100)))
- (use (reg:SI 179))
- (clobber (reg:SI 179))
- (set (reg:SI 21)
- (mem:SI (plus:SI (reg:SI 100)
- (const_int 4))))
- (set (reg:SI 22)
- (mem:SI (plus:SI (reg:SI 100)
- (const_int 8))))])
-@end smallexample
-
-@findex match_par_dup
-@item (match_par_dup @var{n} [@var{subpat}@dots{}])
-Like @code{match_op_dup}, but for @code{match_parallel} instead of
-@code{match_operator}.
-
-@findex address
-@item (address (match_operand:@var{m} @var{n} "address_operand" ""))
-This complex of expressions is a placeholder for an operand number
-@var{n} in a ``load address'' instruction: an operand which specifies
-a memory location in the usual way, but for which the actual operand
-value used is the address of the location, not the contents of the
-location.
-
-@code{address} expressions never appear in RTL code, only in machine
-descriptions. And they are used only in machine descriptions that do
-not use the operand constraint feature. When operand constraints are
-in use, the letter @samp{p} in the constraint serves this purpose.
-
-@var{m} is the machine mode of the @emph{memory location being
-addressed}, not the machine mode of the address itself. That mode is
-always the same on a given target machine (it is @code{Pmode}, which
-normally is @code{SImode}), so there is no point in mentioning it;
-thus, no machine mode is written in the @code{address} expression. If
-some day support is added for machines in which addresses of different
-kinds of objects appear differently or are used differently (such as
-the PDP-10), different formats would perhaps need different machine
-modes and these modes might be written in the @code{address}
-expression.
-@end table
-
-@node Output Template
-@section Output Templates and Operand Substitution
-@cindex output templates
-@cindex operand substitution
-
-@cindex @samp{%} in template
-@cindex percent sign
-The @dfn{output template} is a string which specifies how to output the
-assembler code for an instruction pattern. Most of the template is a
-fixed string which is output literally. The character @samp{%} is used
-to specify where to substitute an operand; it can also be used to
-identify places where different variants of the assembler require
-different syntax.
-
-In the simplest case, a @samp{%} followed by a digit @var{n} says to output
-operand @var{n} at that point in the string.
-
-@samp{%} followed by a letter and a digit says to output an operand in an
-alternate fashion. Four letters have standard, built-in meanings described
-below. The machine description macro @code{PRINT_OPERAND} can define
-additional letters with nonstandard meanings.
-
-@samp{%c@var{digit}} can be used to substitute an operand that is a
-constant value without the syntax that normally indicates an immediate
-operand.
-
-@samp{%n@var{digit}} is like @samp{%c@var{digit}} except that the value of
-the constant is negated before printing.
-
-@samp{%a@var{digit}} can be used to substitute an operand as if it were a
-memory reference, with the actual operand treated as the address. This may
-be useful when outputting a ``load address'' instruction, because often the
-assembler syntax for such an instruction requires you to write the operand
-as if it were a memory reference.
-
-@samp{%l@var{digit}} is used to substitute a @code{label_ref} into a jump
-instruction.
-
-@samp{%=} outputs a number which is unique to each instruction in the
-entire compilation. This is useful for making local labels to be
-referred to more than once in a single template that generates multiple
-assembler instructions.
-
-@samp{%} followed by a punctuation character specifies a substitution that
-does not use an operand. Only one case is standard: @samp{%%} outputs a
-@samp{%} into the assembler code. Other nonstandard cases can be
-defined in the @code{PRINT_OPERAND} macro. You must also define
-which punctuation characters are valid with the
-@code{PRINT_OPERAND_PUNCT_VALID_P} macro.
-
-@cindex \
-@cindex backslash
-The template may generate multiple assembler instructions. Write the text
-for the instructions, with @samp{\;} between them.
-
-@cindex matching operands
-When the RTL contains two operands which are required by constraint to match
-each other, the output template must refer only to the lower-numbered operand.
-Matching operands are not always identical, and the rest of the compiler
-arranges to put the proper RTL expression for printing into the lower-numbered
-operand.
-
-One use of nonstandard letters or punctuation following @samp{%} is to
-distinguish between different assembler languages for the same machine; for
-example, Motorola syntax versus MIT syntax for the 68000. Motorola syntax
-requires periods in most opcode names, while MIT syntax does not. For
-example, the opcode @samp{movel} in MIT syntax is @samp{move.l} in Motorola
-syntax. The same file of patterns is used for both kinds of output syntax,
-but the character sequence @samp{%.} is used in each place where Motorola
-syntax wants a period. The @code{PRINT_OPERAND} macro for Motorola syntax
-defines the sequence to output a period; the macro for MIT syntax defines
-it to do nothing.
-
-@cindex @code{#} in template
-As a special case, a template consisting of the single character @code{#}
-instructs the compiler to first split the insn, and then output the
-resulting instructions separately. This helps eliminate redundancy in the
-output templates. If you have a @code{define_insn} that needs to emit
-multiple assembler instructions, and there is an matching @code{define_split}
-already defined, then you can simply use @code{#} as the output template
-instead of writing an output template that emits the multiple assembler
-instructions.
-
-If the macro @code{ASSEMBLER_DIALECT} is defined, you can use construct
-of the form @samp{@{option0|option1|option2@}} in the templates. These
-describe multiple variants of assembler language syntax.
-@xref{Instruction Output}.
-
-@node Output Statement
-@section C Statements for Assembler Output
-@cindex output statements
-@cindex C statements for assembler output
-@cindex generating assembler output
-
-Often a single fixed template string cannot produce correct and efficient
-assembler code for all the cases that are recognized by a single
-instruction pattern. For example, the opcodes may depend on the kinds of
-operands; or some unfortunate combinations of operands may require extra
-machine instructions.
-
-If the output control string starts with a @samp{@@}, then it is actually
-a series of templates, each on a separate line. (Blank lines and
-leading spaces and tabs are ignored.) The templates correspond to the
-pattern's constraint alternatives (@pxref{Multi-Alternative}). For example,
-if a target machine has a two-address add instruction @samp{addr} to add
-into a register and another @samp{addm} to add a register to memory, you
-might write this pattern:
-
-@smallexample
-(define_insn "addsi3"
- [(set (match_operand:SI 0 "general_operand" "=r,m")
- (plus:SI (match_operand:SI 1 "general_operand" "0,0")
- (match_operand:SI 2 "general_operand" "g,r")))]
- ""
- "@@
- addr %2,%0
- addm %2,%0")
-@end smallexample
-
-@cindex @code{*} in template
-@cindex asterisk in template
-If the output control string starts with a @samp{*}, then it is not an
-output template but rather a piece of C program that should compute a
-template. It should execute a @code{return} statement to return the
-template-string you want. Most such templates use C string literals, which
-require doublequote characters to delimit them. To include these
-doublequote characters in the string, prefix each one with @samp{\}.
-
-The operands may be found in the array @code{operands}, whose C data type
-is @code{rtx []}.
-
-It is very common to select different ways of generating assembler code
-based on whether an immediate operand is within a certain range. Be
-careful when doing this, because the result of @code{INTVAL} is an
-integer on the host machine. If the host machine has more bits in an
-@code{int} than the target machine has in the mode in which the constant
-will be used, then some of the bits you get from @code{INTVAL} will be
-superfluous. For proper results, you must carefully disregard the
-values of those bits.
-
-@findex output_asm_insn
-It is possible to output an assembler instruction and then go on to output
-or compute more of them, using the subroutine @code{output_asm_insn}. This
-receives two arguments: a template-string and a vector of operands. The
-vector may be @code{operands}, or it may be another array of @code{rtx}
-that you declare locally and initialize yourself.
-
-@findex which_alternative
-When an insn pattern has multiple alternatives in its constraints, often
-the appearance of the assembler code is determined mostly by which alternative
-was matched. When this is so, the C code can test the variable
-@code{which_alternative}, which is the ordinal number of the alternative
-that was actually satisfied (0 for the first, 1 for the second alternative,
-etc.).
-
-For example, suppose there are two opcodes for storing zero, @samp{clrreg}
-for registers and @samp{clrmem} for memory locations. Here is how
-a pattern could use @code{which_alternative} to choose between them:
-
-@smallexample
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r,m")
- (const_int 0))]
- ""
- "*
- return (which_alternative == 0
- ? \"clrreg %0\" : \"clrmem %0\");
- ")
-@end smallexample
-
-The example above, where the assembler code to generate was
-@emph{solely} determined by the alternative, could also have been specified
-as follows, having the output control string start with a @samp{@@}:
-
-@smallexample
-@group
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r,m")
- (const_int 0))]
- ""
- "@@
- clrreg %0
- clrmem %0")
-@end group
-@end smallexample
-@end ifset
-
-@c Most of this node appears by itself (in a different place) even
-@c when the INTERNALS flag is clear. Passages that require the full
-@c manual's context are conditionalized to appear only in the full manual.
-@ifset INTERNALS
-@node Constraints
-@section Operand Constraints
-@cindex operand constraints
-@cindex constraints
-
-Each @code{match_operand} in an instruction pattern can specify a
-constraint for the type of operands allowed.
-@end ifset
-@ifclear INTERNALS
-@node Constraints
-@section Constraints for @code{asm} Operands
-@cindex operand constraints, @code{asm}
-@cindex constraints, @code{asm}
-@cindex @code{asm} constraints
-
-Here are specific details on what constraint letters you can use with
-@code{asm} operands.
-@end ifclear
-Constraints can say whether
-an operand may be in a register, and which kinds of register; whether the
-operand can be a memory reference, and which kinds of address; whether the
-operand may be an immediate constant, and which possible values it may
-have. Constraints can also require two operands to match.
-
-@ifset INTERNALS
-@menu
-* Simple Constraints:: Basic use of constraints.
-* Multi-Alternative:: When an insn has two alternative constraint-patterns.
-* Class Preferences:: Constraints guide which hard register to put things in.
-* Modifiers:: More precise control over effects of constraints.
-* Machine Constraints:: Existing constraints for some particular machines.
-* No Constraints:: Describing a clean machine without constraints.
-@end menu
-@end ifset
-
-@ifclear INTERNALS
-@menu
-* Simple Constraints:: Basic use of constraints.
-* Multi-Alternative:: When an insn has two alternative constraint-patterns.
-* Modifiers:: More precise control over effects of constraints.
-* Machine Constraints:: Special constraints for some particular machines.
-@end menu
-@end ifclear
-
-@node Simple Constraints
-@subsection Simple Constraints
-@cindex simple constraints
-
-The simplest kind of constraint is a string full of letters, each of
-which describes one kind of operand that is permitted. Here are
-the letters that are allowed:
-
-@table @asis
-@cindex @samp{m} in constraint
-@cindex memory references in constraints
-@item @samp{m}
-A memory operand is allowed, with any kind of address that the machine
-supports in general.
-
-@cindex offsettable address
-@cindex @samp{o} in constraint
-@item @samp{o}
-A memory operand is allowed, but only if the address is
-@dfn{offsettable}. This means that adding a small integer (actually,
-the width in bytes of the operand, as determined by its machine mode)
-may be added to the address and the result is also a valid memory
-address.
-
-@cindex autoincrement/decrement addressing
-For example, an address which is constant is offsettable; so is an
-address that is the sum of a register and a constant (as long as a
-slightly larger constant is also within the range of address-offsets
-supported by the machine); but an autoincrement or autodecrement
-address is not offsettable. More complicated indirect/indexed
-addresses may or may not be offsettable depending on the other
-addressing modes that the machine supports.
-
-Note that in an output operand which can be matched by another
-operand, the constraint letter @samp{o} is valid only when accompanied
-by both @samp{<} (if the target machine has predecrement addressing)
-and @samp{>} (if the target machine has preincrement addressing).
-
-@cindex @samp{V} in constraint
-@item @samp{V}
-A memory operand that is not offsettable. In other words, anything that
-would fit the @samp{m} constraint but not the @samp{o} constraint.
-
-@cindex @samp{<} in constraint
-@item @samp{<}
-A memory operand with autodecrement addressing (either predecrement or
-postdecrement) is allowed.
-
-@cindex @samp{>} in constraint
-@item @samp{>}
-A memory operand with autoincrement addressing (either preincrement or
-postincrement) is allowed.
-
-@cindex @samp{r} in constraint
-@cindex registers in constraints
-@item @samp{r}
-A register operand is allowed provided that it is in a general
-register.
-
-@cindex @samp{d} in constraint
-@item @samp{d}, @samp{a}, @samp{f}, @dots{}
-Other letters can be defined in machine-dependent fashion to stand for
-particular classes of registers. @samp{d}, @samp{a} and @samp{f} are
-defined on the 68000/68020 to stand for data, address and floating
-point registers.
-
-@cindex constants in constraints
-@cindex @samp{i} in constraint
-@item @samp{i}
-An immediate integer operand (one with constant value) is allowed.
-This includes symbolic constants whose values will be known only at
-assembly time.
-
-@cindex @samp{n} in constraint
-@item @samp{n}
-An immediate integer operand with a known numeric value is allowed.
-Many systems cannot support assembly-time constants for operands less
-than a word wide. Constraints for these operands should use @samp{n}
-rather than @samp{i}.
-
-@cindex @samp{I} in constraint
-@item @samp{I}, @samp{J}, @samp{K}, @dots{} @samp{P}
-Other letters in the range @samp{I} through @samp{P} may be defined in
-a machine-dependent fashion to permit immediate integer operands with
-explicit integer values in specified ranges. For example, on the
-68000, @samp{I} is defined to stand for the range of values 1 to 8.
-This is the range permitted as a shift count in the shift
-instructions.
-
-@cindex @samp{E} in constraint
-@item @samp{E}
-An immediate floating operand (expression code @code{const_double}) is
-allowed, but only if the target floating point format is the same as
-that of the host machine (on which the compiler is running).
-
-@cindex @samp{F} in constraint
-@item @samp{F}
-An immediate floating operand (expression code @code{const_double}) is
-allowed.
-
-@cindex @samp{G} in constraint
-@cindex @samp{H} in constraint
-@item @samp{G}, @samp{H}
-@samp{G} and @samp{H} may be defined in a machine-dependent fashion to
-permit immediate floating operands in particular ranges of values.
-
-@cindex @samp{s} in constraint
-@item @samp{s}
-An immediate integer operand whose value is not an explicit integer is
-allowed.
-
-This might appear strange; if an insn allows a constant operand with a
-value not known at compile time, it certainly must allow any known
-value. So why use @samp{s} instead of @samp{i}? Sometimes it allows
-better code to be generated.
-
-For example, on the 68000 in a fullword instruction it is possible to
-use an immediate operand; but if the immediate value is between -128
-and 127, better code results from loading the value into a register and
-using the register. This is because the load into the register can be
-done with a @samp{moveq} instruction. We arrange for this to happen
-by defining the letter @samp{K} to mean ``any integer outside the
-range -128 to 127'', and then specifying @samp{Ks} in the operand
-constraints.
-
-@cindex @samp{g} in constraint
-@item @samp{g}
-Any register, memory or immediate integer operand is allowed, except for
-registers that are not general registers.
-
-@cindex @samp{X} in constraint
-@item @samp{X}
-@ifset INTERNALS
-Any operand whatsoever is allowed, even if it does not satisfy
-@code{general_operand}. This is normally used in the constraint of
-a @code{match_scratch} when certain alternatives will not actually
-require a scratch register.
-@end ifset
-@ifclear INTERNALS
-Any operand whatsoever is allowed.
-@end ifclear
-
-@cindex @samp{0} in constraint
-@cindex digits in constraint
-@item @samp{0}, @samp{1}, @samp{2}, @dots{} @samp{9}
-An operand that matches the specified operand number is allowed. If a
-digit is used together with letters within the same alternative, the
-digit should come last.
-
-@cindex matching constraint
-@cindex constraint, matching
-This is called a @dfn{matching constraint} and what it really means is
-that the assembler has only a single operand that fills two roles
-@ifset INTERNALS
-considered separate in the RTL insn. For example, an add insn has two
-input operands and one output operand in the RTL, but on most CISC
-@end ifset
-@ifclear INTERNALS
-which @code{asm} distinguishes. For example, an add instruction uses
-two input operands and an output operand, but on most CISC
-@end ifclear
-machines an add instruction really has only two operands, one of them an
-input-output operand:
-
-@smallexample
-addl #35,r12
-@end smallexample
-
-Matching constraints are used in these circumstances.
-More precisely, the two operands that match must include one input-only
-operand and one output-only operand. Moreover, the digit must be a
-smaller number than the number of the operand that uses it in the
-constraint.
-
-@ifset INTERNALS
-For operands to match in a particular case usually means that they
-are identical-looking RTL expressions. But in a few special cases
-specific kinds of dissimilarity are allowed. For example, @code{*x}
-as an input operand will match @code{*x++} as an output operand.
-For proper results in such cases, the output template should always
-use the output-operand's number when printing the operand.
-@end ifset
-
-@cindex load address instruction
-@cindex push address instruction
-@cindex address constraints
-@cindex @samp{p} in constraint
-@item @samp{p}
-An operand that is a valid memory address is allowed. This is
-for ``load address'' and ``push address'' instructions.
-
-@findex address_operand
-@samp{p} in the constraint must be accompanied by @code{address_operand}
-as the predicate in the @code{match_operand}. This predicate interprets
-the mode specified in the @code{match_operand} as the mode of the memory
-reference for which the address would be valid.
-
-@cindex extensible constraints
-@cindex @samp{Q}, in constraint
-@item @samp{Q}, @samp{R}, @samp{S}, @dots{} @samp{U}
-Letters in the range @samp{Q} through @samp{U} may be defined in a
-machine-dependent fashion to stand for arbitrary operand types.
-@ifset INTERNALS
-The machine description macro @code{EXTRA_CONSTRAINT} is passed the
-operand as its first argument and the constraint letter as its
-second operand.
-
-A typical use for this would be to distinguish certain types of
-memory references that affect other insn operands.
-
-Do not define these constraint letters to accept register references
-(@code{reg}); the reload pass does not expect this and would not handle
-it properly.
-@end ifset
-@end table
-
-@ifset INTERNALS
-In order to have valid assembler code, each operand must satisfy
-its constraint. But a failure to do so does not prevent the pattern
-from applying to an insn. Instead, it directs the compiler to modify
-the code so that the constraint will be satisfied. Usually this is
-done by copying an operand into a register.
-
-Contrast, therefore, the two instruction patterns that follow:
-
-@smallexample
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (plus:SI (match_dup 0)
- (match_operand:SI 1 "general_operand" "r")))]
- ""
- "@dots{}")
-@end smallexample
-
-@noindent
-which has two operands, one of which must appear in two places, and
-
-@smallexample
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r")
- (plus:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "r")))]
- ""
- "@dots{}")
-@end smallexample
-
-@noindent
-which has three operands, two of which are required by a constraint to be
-identical. If we are considering an insn of the form
-
-@smallexample
-(insn @var{n} @var{prev} @var{next}
- (set (reg:SI 3)
- (plus:SI (reg:SI 6) (reg:SI 109)))
- @dots{})
-@end smallexample
-
-@noindent
-the first pattern would not apply at all, because this insn does not
-contain two identical subexpressions in the right place. The pattern would
-say, ``That does not look like an add instruction; try other patterns.''
-The second pattern would say, ``Yes, that's an add instruction, but there
-is something wrong with it.'' It would direct the reload pass of the
-compiler to generate additional insns to make the constraint true. The
-results might look like this:
-
-@smallexample
-(insn @var{n2} @var{prev} @var{n}
- (set (reg:SI 3) (reg:SI 6))
- @dots{})
-
-(insn @var{n} @var{n2} @var{next}
- (set (reg:SI 3)
- (plus:SI (reg:SI 3) (reg:SI 109)))
- @dots{})
-@end smallexample
-
-It is up to you to make sure that each operand, in each pattern, has
-constraints that can handle any RTL expression that could be present for
-that operand. (When multiple alternatives are in use, each pattern must,
-for each possible combination of operand expressions, have at least one
-alternative which can handle that combination of operands.) The
-constraints don't need to @emph{allow} any possible operand---when this is
-the case, they do not constrain---but they must at least point the way to
-reloading any possible operand so that it will fit.
-
-@itemize @bullet
-@item
-If the constraint accepts whatever operands the predicate permits,
-there is no problem: reloading is never necessary for this operand.
-
-For example, an operand whose constraints permit everything except
-registers is safe provided its predicate rejects registers.
-
-An operand whose predicate accepts only constant values is safe
-provided its constraints include the letter @samp{i}. If any possible
-constant value is accepted, then nothing less than @samp{i} will do;
-if the predicate is more selective, then the constraints may also be
-more selective.
-
-@item
-Any operand expression can be reloaded by copying it into a register.
-So if an operand's constraints allow some kind of register, it is
-certain to be safe. It need not permit all classes of registers; the
-compiler knows how to copy a register into another register of the
-proper class in order to make an instruction valid.
-
-@cindex nonoffsettable memory reference
-@cindex memory reference, nonoffsettable
-@item
-A nonoffsettable memory reference can be reloaded by copying the
-address into a register. So if the constraint uses the letter
-@samp{o}, all memory references are taken care of.
-
-@item
-A constant operand can be reloaded by allocating space in memory to
-hold it as preinitialized data. Then the memory reference can be used
-in place of the constant. So if the constraint uses the letters
-@samp{o} or @samp{m}, constant operands are not a problem.
-
-@item
-If the constraint permits a constant and a pseudo register used in an insn
-was not allocated to a hard register and is equivalent to a constant,
-the register will be replaced with the constant. If the predicate does
-not permit a constant and the insn is re-recognized for some reason, the
-compiler will crash. Thus the predicate must always recognize any
-objects allowed by the constraint.
-@end itemize
-
-If the operand's predicate can recognize registers, but the constraint does
-not permit them, it can make the compiler crash. When this operand happens
-to be a register, the reload pass will be stymied, because it does not know
-how to copy a register temporarily into memory.
-
-If the predicate accepts a unary operator, the constraint applies to the
-operand. For example, the MIPS processor at ISA level 3 supports an
-instruction which adds two registers in @code{SImode} to produce a
-@code{DImode} result, but only if the registers are correctly sign
-extended. This predicate for the input operands accepts a
-@code{sign_extend} of an @code{SImode} register. Write the constraint
-to indicate the type of register that is required for the operand of the
-@code{sign_extend}.
-@end ifset
-
-@node Multi-Alternative
-@subsection Multiple Alternative Constraints
-@cindex multiple alternative constraints
-
-Sometimes a single instruction has multiple alternative sets of possible
-operands. For example, on the 68000, a logical-or instruction can combine
-register or an immediate value into memory, or it can combine any kind of
-operand into a register; but it cannot combine one memory location into
-another.
-
-These constraints are represented as multiple alternatives. An alternative
-can be described by a series of letters for each operand. The overall
-constraint for an operand is made from the letters for this operand
-from the first alternative, a comma, the letters for this operand from
-the second alternative, a comma, and so on until the last alternative.
-@ifset INTERNALS
-Here is how it is done for fullword logical-or on the 68000:
-
-@smallexample
-(define_insn "iorsi3"
- [(set (match_operand:SI 0 "general_operand" "=m,d")
- (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
- (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
- @dots{})
-@end smallexample
-
-The first alternative has @samp{m} (memory) for operand 0, @samp{0} for
-operand 1 (meaning it must match operand 0), and @samp{dKs} for operand
-2. The second alternative has @samp{d} (data register) for operand 0,
-@samp{0} for operand 1, and @samp{dmKs} for operand 2. The @samp{=} and
-@samp{%} in the constraints apply to all the alternatives; their
-meaning is explained in the next section (@pxref{Class Preferences}).
-@end ifset
-
-@c FIXME Is this ? and ! stuff of use in asm()? If not, hide unless INTERNAL
-If all the operands fit any one alternative, the instruction is valid.
-Otherwise, for each alternative, the compiler counts how many instructions
-must be added to copy the operands so that that alternative applies.
-The alternative requiring the least copying is chosen. If two alternatives
-need the same amount of copying, the one that comes first is chosen.
-These choices can be altered with the @samp{?} and @samp{!} characters:
-
-@table @code
-@cindex @samp{?} in constraint
-@cindex question mark
-@item ?
-Disparage slightly the alternative that the @samp{?} appears in,
-as a choice when no alternative applies exactly. The compiler regards
-this alternative as one unit more costly for each @samp{?} that appears
-in it.
-
-@cindex @samp{!} in constraint
-@cindex exclamation point
-@item !
-Disparage severely the alternative that the @samp{!} appears in.
-This alternative can still be used if it fits without reloading,
-but if reloading is needed, some other alternative will be used.
-@end table
-
-@ifset INTERNALS
-When an insn pattern has multiple alternatives in its constraints, often
-the appearance of the assembler code is determined mostly by which
-alternative was matched. When this is so, the C code for writing the
-assembler code can use the variable @code{which_alternative}, which is
-the ordinal number of the alternative that was actually satisfied (0 for
-the first, 1 for the second alternative, etc.). @xref{Output Statement}.
-@end ifset
-
-@ifset INTERNALS
-@node Class Preferences
-@subsection Register Class Preferences
-@cindex class preference constraints
-@cindex register class preference constraints
-
-@cindex voting between constraint alternatives
-The operand constraints have another function: they enable the compiler
-to decide which kind of hardware register a pseudo register is best
-allocated to. The compiler examines the constraints that apply to the
-insns that use the pseudo register, looking for the machine-dependent
-letters such as @samp{d} and @samp{a} that specify classes of registers.
-The pseudo register is put in whichever class gets the most ``votes''.
-The constraint letters @samp{g} and @samp{r} also vote: they vote in
-favor of a general register. The machine description says which registers
-are considered general.
-
-Of course, on some machines all registers are equivalent, and no register
-classes are defined. Then none of this complexity is relevant.
-@end ifset
-
-@node Modifiers
-@subsection Constraint Modifier Characters
-@cindex modifiers in constraints
-@cindex constraint modifier characters
-
-@c prevent bad page break with this line
-Here are constraint modifier characters.
-
-@table @samp
-@cindex @samp{=} in constraint
-@item =
-Means that this operand is write-only for this instruction: the previous
-value is discarded and replaced by output data.
-
-@cindex @samp{+} in constraint
-@item +
-Means that this operand is both read and written by the instruction.
-
-When the compiler fixes up the operands to satisfy the constraints,
-it needs to know which operands are inputs to the instruction and
-which are outputs from it. @samp{=} identifies an output; @samp{+}
-identifies an operand that is both input and output; all other operands
-are assumed to be input only.
-
-@cindex @samp{&} in constraint
-@cindex earlyclobber operand
-@item &
-Means (in a particular alternative) that this operand is an
-@dfn{earlyclobber} operand, which is modified before the instruction is
-finished using the input operands. Therefore, this operand may not lie
-in a register that is used as an input operand or as part of any memory
-address.
-
-@samp{&} applies only to the alternative in which it is written. In
-constraints with multiple alternatives, sometimes one alternative
-requires @samp{&} while others do not. See, for example, the
-@samp{movdf} insn of the 68000.
-
-An input operand can be tied to an earlyclobber operand if its only
-use as an input occurs before the early result is written. Adding
-alternatives of this form often allows GCC to produce better code
-when only some of the inputs can be affected by the earlyclobber.
-See, for example, the @samp{mulsi3} insn of the ARM.
-
-@samp{&} does not obviate the need to write @samp{=}.
-
-@cindex @samp{%} in constraint
-@item %
-Declares the instruction to be commutative for this operand and the
-following operand. This means that the compiler may interchange the
-two operands if that is the cheapest way to make all operands fit the
-constraints.
-@ifset INTERNALS
-This is often used in patterns for addition instructions
-that really have only two operands: the result must go in one of the
-arguments. Here for example, is how the 68000 halfword-add
-instruction is defined:
-
-@smallexample
-(define_insn "addhi3"
- [(set (match_operand:HI 0 "general_operand" "=m,r")
- (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
- (match_operand:HI 2 "general_operand" "di,g")))]
- @dots{})
-@end smallexample
-@end ifset
-
-@cindex @samp{#} in constraint
-@item #
-Says that all following characters, up to the next comma, are to be
-ignored as a constraint. They are significant only for choosing
-register preferences.
-
-@ifset INTERNALS
-@cindex @samp{*} in constraint
-@item *
-Says that the following character should be ignored when choosing
-register preferences. @samp{*} has no effect on the meaning of the
-constraint as a constraint, and no effect on reloading.
-
-Here is an example: the 68000 has an instruction to sign-extend a
-halfword in a data register, and can also sign-extend a value by
-copying it into an address register. While either kind of register is
-acceptable, the constraints on an address-register destination are
-less strict, so it is best if register allocation makes an address
-register its goal. Therefore, @samp{*} is used so that the @samp{d}
-constraint letter (for data register) is ignored when computing
-register preferences.
-
-@smallexample
-(define_insn "extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "=*d,a")
- (sign_extend:SI
- (match_operand:HI 1 "general_operand" "0,g")))]
- @dots{})
-@end smallexample
-@end ifset
-@end table
-
-@node Machine Constraints
-@subsection Constraints for Particular Machines
-@cindex machine specific constraints
-@cindex constraints, machine specific
-
-Whenever possible, you should use the general-purpose constraint letters
-in @code{asm} arguments, since they will convey meaning more readily to
-people reading your code. Failing that, use the constraint letters
-that usually have very similar meanings across architectures. The most
-commonly used constraints are @samp{m} and @samp{r} (for memory and
-general-purpose registers respectively; @pxref{Simple Constraints}), and
-@samp{I}, usually the letter indicating the most common
-immediate-constant format.
-
-For each machine architecture, the @file{config/@var{machine}.h} file
-defines additional constraints. These constraints are used by the
-compiler itself for instruction generation, as well as for @code{asm}
-statements; therefore, some of the constraints are not particularly
-interesting for @code{asm}. The constraints are defined through these
-macros:
-
-@table @code
-@item REG_CLASS_FROM_LETTER
-Register class constraints (usually lower case).
-
-@item CONST_OK_FOR_LETTER_P
-Immediate constant constraints, for non-floating point constants of
-word size or smaller precision (usually upper case).
-
-@item CONST_DOUBLE_OK_FOR_LETTER_P
-Immediate constant constraints, for all floating point constants and for
-constants of greater than word size precision (usually upper case).
-
-@item EXTRA_CONSTRAINT
-Special cases of registers or memory. This macro is not required, and
-is only defined for some machines.
-@end table
-
-Inspecting these macro definitions in the compiler source for your
-machine is the best way to be certain you have the right constraints.
-However, here is a summary of the machine-dependent constraints
-available on some particular machines.
-
-@table @emph
-@item ARM family---@file{arm.h}
-@table @code
-@item f
-Floating-point register
-
-@item F
-One of the floating-point constants 0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0
-or 10.0
-
-@item G
-Floating-point constant that would satisfy the constraint @samp{F} if it
-were negated
-
-@item I
-Integer that is valid as an immediate operand in a data processing
-instruction. That is, an integer in the range 0 to 255 rotated by a
-multiple of 2
-
-@item J
-Integer in the range -4095 to 4095
-
-@item K
-Integer that satisfies constraint @samp{I} when inverted (ones complement)
-
-@item L
-Integer that satisfies constraint @samp{I} when negated (twos complement)
-
-@item M
-Integer in the range 0 to 32
-
-@item Q
-A memory reference where the exact address is in a single register
-(`@samp{m}' is preferable for @code{asm} statements)
-
-@item R
-An item in the constant pool
-
-@item S
-A symbol in the text segment of the current file
-@end table
-
-@item AMD 29000 family---@file{a29k.h}
-@table @code
-@item l
-Local register 0
-
-@item b
-Byte Pointer (@samp{BP}) register
-
-@item q
-@samp{Q} register
-
-@item h
-Special purpose register
-
-@item A
-First accumulator register
-
-@item a
-Other accumulator register
-
-@item f
-Floating point register
-
-@item I
-Constant greater than 0, less than 0x100
-
-@item J
-Constant greater than 0, less than 0x10000
-
-@item K
-Constant whose high 24 bits are on (1)
-
-@item L
-16 bit constant whose high 8 bits are on (1)
-
-@item M
-32 bit constant whose high 16 bits are on (1)
-
-@item N
-32 bit negative constant that fits in 8 bits
-
-@item O
-The constant 0x80000000 or, on the 29050, any 32 bit constant
-whose low 16 bits are 0.
-
-@item P
-16 bit negative constant that fits in 8 bits
-
-@item G
-@itemx H
-A floating point constant (in @code{asm} statements, use the machine
-independent @samp{E} or @samp{F} instead)
-@end table
-
-@item IBM RS6000---@file{rs6000.h}
-@table @code
-@item b
-Address base register
-
-@item f
-Floating point register
-
-@item h
-@samp{MQ}, @samp{CTR}, or @samp{LINK} register
-
-@item q
-@samp{MQ} register
-
-@item c
-@samp{CTR} register
-
-@item l
-@samp{LINK} register
-
-@item x
-@samp{CR} register (condition register) number 0
-
-@item y
-@samp{CR} register (condition register)
-
-@item I
-Signed 16 bit constant
-
-@item J
-Constant whose low 16 bits are 0
-
-@item K
-Constant whose high 16 bits are 0
-
-@item L
-Constant suitable as a mask operand
-
-@item M
-Constant larger than 31
-
-@item N
-Exact power of 2
-
-@item O
-Zero
-
-@item P
-Constant whose negation is a signed 16 bit constant
-
-@item G
-Floating point constant that can be loaded into a register with one
-instruction per word
-
-@item Q
-Memory operand that is an offset from a register (@samp{m} is preferable
-for @code{asm} statements)
-
-@item R
-AIX TOC entry
-
-@item S
-Windows NT SYMBOL_REF
-
-@item T
-Windows NT LABEL_REF
-
-@item U
-System V Release 4 small data area reference
-@end table
-
-@item Intel 386---@file{i386.h}
-@table @code
-@item q
-@samp{a}, @code{b}, @code{c}, or @code{d} register
-
-@item A
-@samp{a}, or @code{d} register (for 64-bit ints)
-
-@item f
-Floating point register
-
-@item t
-First (top of stack) floating point register
-
-@item u
-Second floating point register
-
-@item a
-@samp{a} register
-
-@item b
-@samp{b} register
-
-@item c
-@samp{c} register
-
-@item d
-@samp{d} register
-
-@item D
-@samp{di} register
-
-@item S
-@samp{si} register
-
-@item I
-Constant in range 0 to 31 (for 32 bit shifts)
-
-@item J
-Constant in range 0 to 63 (for 64 bit shifts)
-
-@item K
-@samp{0xff}
-
-@item L
-@samp{0xffff}
-
-@item M
-0, 1, 2, or 3 (shifts for @code{lea} instruction)
-
-@item N
-Constant in range 0 to 255 (for @code{out} instruction)
-
-@item G
-Standard 80387 floating point constant
-@end table
-
-@item Intel 960---@file{i960.h}
-@table @code
-@item f
-Floating point register (@code{fp0} to @code{fp3})
-
-@item l
-Local register (@code{r0} to @code{r15})
-
-@item b
-Global register (@code{g0} to @code{g15})
-
-@item d
-Any local or global register
-
-@item I
-Integers from 0 to 31
-
-@item J
-0
-
-@item K
-Integers from -31 to 0
-
-@item G
-Floating point 0
-
-@item H
-Floating point 1
-@end table
-
-@item MIPS---@file{mips.h}
-@table @code
-@item d
-General-purpose integer register
-
-@item f
-Floating-point register (if available)
-
-@item h
-@samp{Hi} register
-
-@item l
-@samp{Lo} register
-
-@item x
-@samp{Hi} or @samp{Lo} register
-
-@item y
-General-purpose integer register
-
-@item z
-Floating-point status register
-
-@item I
-Signed 16 bit constant (for arithmetic instructions)
-
-@item J
-Zero
-
-@item K
-Zero-extended 16-bit constant (for logic instructions)
-
-@item L
-Constant with low 16 bits zero (can be loaded with @code{lui})
-
-@item M
-32 bit constant which requires two instructions to load (a constant
-which is not @samp{I}, @samp{K}, or @samp{L})
-
-@item N
-Negative 16 bit constant
-
-@item O
-Exact power of two
-
-@item P
-Positive 16 bit constant
-
-@item G
-Floating point zero
-
-@item Q
-Memory reference that can be loaded with more than one instruction
-(@samp{m} is preferable for @code{asm} statements)
-
-@item R
-Memory reference that can be loaded with one instruction
-(@samp{m} is preferable for @code{asm} statements)
-
-@item S
-Memory reference in external OSF/rose PIC format
-(@samp{m} is preferable for @code{asm} statements)
-@end table
-
-@item Motorola 680x0---@file{m68k.h}
-@table @code
-@item a
-Address register
-
-@item d
-Data register
-
-@item f
-68881 floating-point register, if available
-
-@item x
-Sun FPA (floating-point) register, if available
-
-@item y
-First 16 Sun FPA registers, if available
-
-@item I
-Integer in the range 1 to 8
-
-@item J
-16 bit signed number
-
-@item K
-Signed number whose magnitude is greater than 0x80
-
-@item L
-Integer in the range -8 to -1
-
-@item M
-Signed number whose magnitude is greater than 0x100
-
-@item G
-Floating point constant that is not a 68881 constant
-
-@item H
-Floating point constant that can be used by Sun FPA
-@end table
-
-@need 1000
-@item SPARC---@file{sparc.h}
-@table @code
-@item f
-Floating-point register that can hold 32 or 64 bit values.
-
-@item e
-Floating-point register that can hold 64 or 128 bit values.
-
-@item I
-Signed 13 bit constant
-
-@item J
-Zero
-
-@item K
-32 bit constant with the low 12 bits clear (a constant that can be
-loaded with the @code{sethi} instruction)
-
-@item G
-Floating-point zero
-
-@item H
-Signed 13 bit constant, sign-extended to 32 or 64 bits
-
-@item Q
-Memory reference that can be loaded with one instruction (@samp{m} is
-more appropriate for @code{asm} statements)
-
-@item S
-Constant, or memory address
-
-@item T
-Memory address aligned to an 8-byte boundary
-
-@item U
-Even register
-@end table
-@end table
-
-@ifset INTERNALS
-@node No Constraints
-@subsection Not Using Constraints
-@cindex no constraints
-@cindex not using constraints
-
-Some machines are so clean that operand constraints are not required. For
-example, on the Vax, an operand valid in one context is valid in any other
-context. On such a machine, every operand constraint would be @samp{g},
-excepting only operands of ``load address'' instructions which are
-written as if they referred to a memory location's contents but actual
-refer to its address. They would have constraint @samp{p}.
-
-@cindex empty constraints
-For such machines, instead of writing @samp{g} and @samp{p} for all
-the constraints, you can choose to write a description with empty constraints.
-Then you write @samp{""} for the constraint in every @code{match_operand}.
-Address operands are identified by writing an @code{address} expression
-around the @code{match_operand}, not by their constraints.
-
-When the machine description has just empty constraints, certain parts
-of compilation are skipped, making the compiler faster. However,
-few machines actually do not need constraints; all machine descriptions
-now in existence use constraints.
-@end ifset
-
-@ifset INTERNALS
-@node Standard Names
-@section Standard Pattern Names For Generation
-@cindex standard pattern names
-@cindex pattern names
-@cindex names, pattern
-
-Here is a table of the instruction names that are meaningful in the RTL
-generation pass of the compiler. Giving one of these names to an
-instruction pattern tells the RTL generation pass that it can use the
-pattern in to accomplish a certain task.
-
-@table @asis
-@cindex @code{mov@var{m}} instruction pattern
-@item @samp{mov@var{m}}
-Here @var{m} stands for a two-letter machine mode name, in lower case.
-This instruction pattern moves data with that machine mode from operand
-1 to operand 0. For example, @samp{movsi} moves full-word data.
-
-If operand 0 is a @code{subreg} with mode @var{m} of a register whose
-own mode is wider than @var{m}, the effect of this instruction is
-to store the specified value in the part of the register that corresponds
-to mode @var{m}. The effect on the rest of the register is undefined.
-
-This class of patterns is special in several ways. First of all, each
-of these names @emph{must} be defined, because there is no other way
-to copy a datum from one place to another.
-
-Second, these patterns are not used solely in the RTL generation pass.
-Even the reload pass can generate move insns to copy values from stack
-slots into temporary registers. When it does so, one of the operands is
-a hard register and the other is an operand that can need to be reloaded
-into a register.
-
-@findex force_reg
-Therefore, when given such a pair of operands, the pattern must generate
-RTL which needs no reloading and needs no temporary registers---no
-registers other than the operands. For example, if you support the
-pattern with a @code{define_expand}, then in such a case the
-@code{define_expand} mustn't call @code{force_reg} or any other such
-function which might generate new pseudo registers.
-
-This requirement exists even for subword modes on a RISC machine where
-fetching those modes from memory normally requires several insns and
-some temporary registers. Look in @file{spur.md} to see how the
-requirement can be satisfied.
-
-@findex change_address
-During reload a memory reference with an invalid address may be passed
-as an operand. Such an address will be replaced with a valid address
-later in the reload pass. In this case, nothing may be done with the
-address except to use it as it stands. If it is copied, it will not be
-replaced with a valid address. No attempt should be made to make such
-an address into a valid address and no routine (such as
-@code{change_address}) that will do so may be called. Note that
-@code{general_operand} will fail when applied to such an address.
-
-@findex reload_in_progress
-The global variable @code{reload_in_progress} (which must be explicitly
-declared if required) can be used to determine whether such special
-handling is required.
-
-The variety of operands that have reloads depends on the rest of the
-machine description, but typically on a RISC machine these can only be
-pseudo registers that did not get hard registers, while on other
-machines explicit memory references will get optional reloads.
-
-If a scratch register is required to move an object to or from memory,
-it can be allocated using @code{gen_reg_rtx} prior to reload. But this
-is impossible during and after reload. If there are cases needing
-scratch registers after reload, you must define
-@code{SECONDARY_INPUT_RELOAD_CLASS} and perhaps also
-@code{SECONDARY_OUTPUT_RELOAD_CLASS} to detect them, and provide
-patterns @samp{reload_in@var{m}} or @samp{reload_out@var{m}} to handle
-them. @xref{Register Classes}.
-
-The constraints on a @samp{move@var{m}} must permit moving any hard
-register to any other hard register provided that
-@code{HARD_REGNO_MODE_OK} permits mode @var{m} in both registers and
-@code{REGISTER_MOVE_COST} applied to their classes returns a value of 2.
-
-It is obligatory to support floating point @samp{move@var{m}}
-instructions into and out of any registers that can hold fixed point
-values, because unions and structures (which have modes @code{SImode} or
-@code{DImode}) can be in those registers and they may have floating
-point members.
-
-There may also be a need to support fixed point @samp{move@var{m}}
-instructions in and out of floating point registers. Unfortunately, I
-have forgotten why this was so, and I don't know whether it is still
-true. If @code{HARD_REGNO_MODE_OK} rejects fixed point values in
-floating point registers, then the constraints of the fixed point
-@samp{move@var{m}} instructions must be designed to avoid ever trying to
-reload into a floating point register.
-
-@cindex @code{reload_in} instruction pattern
-@cindex @code{reload_out} instruction pattern
-@item @samp{reload_in@var{m}}
-@itemx @samp{reload_out@var{m}}
-Like @samp{mov@var{m}}, but used when a scratch register is required to
-move between operand 0 and operand 1. Operand 2 describes the scratch
-register. See the discussion of the @code{SECONDARY_RELOAD_CLASS}
-macro in @pxref{Register Classes}.
-
-@cindex @code{movstrict@var{m}} instruction pattern
-@item @samp{movstrict@var{m}}
-Like @samp{mov@var{m}} except that if operand 0 is a @code{subreg}
-with mode @var{m} of a register whose natural mode is wider,
-the @samp{movstrict@var{m}} instruction is guaranteed not to alter
-any of the register except the part which belongs to mode @var{m}.
-
-@cindex @code{load_multiple} instruction pattern
-@item @samp{load_multiple}
-Load several consecutive memory locations into consecutive registers.
-Operand 0 is the first of the consecutive registers, operand 1
-is the first memory location, and operand 2 is a constant: the
-number of consecutive registers.
-
-Define this only if the target machine really has such an instruction;
-do not define this if the most efficient way of loading consecutive
-registers from memory is to do them one at a time.
-
-On some machines, there are restrictions as to which consecutive
-registers can be stored into memory, such as particular starting or
-ending register numbers or only a range of valid counts. For those
-machines, use a @code{define_expand} (@pxref{Expander Definitions})
-and make the pattern fail if the restrictions are not met.
-
-Write the generated insn as a @code{parallel} with elements being a
-@code{set} of one register from the appropriate memory location (you may
-also need @code{use} or @code{clobber} elements). Use a
-@code{match_parallel} (@pxref{RTL Template}) to recognize the insn. See
-@file{a29k.md} and @file{rs6000.md} for examples of the use of this insn
-pattern.
-
-@cindex @samp{store_multiple} instruction pattern
-@item @samp{store_multiple}
-Similar to @samp{load_multiple}, but store several consecutive registers
-into consecutive memory locations. Operand 0 is the first of the
-consecutive memory locations, operand 1 is the first register, and
-operand 2 is a constant: the number of consecutive registers.
-
-@cindex @code{add@var{m}3} instruction pattern
-@item @samp{add@var{m}3}
-Add operand 2 and operand 1, storing the result in operand 0. All operands
-must have mode @var{m}. This can be used even on two-address machines, by
-means of constraints requiring operands 1 and 0 to be the same location.
-
-@cindex @code{sub@var{m}3} instruction pattern
-@cindex @code{mul@var{m}3} instruction pattern
-@cindex @code{div@var{m}3} instruction pattern
-@cindex @code{udiv@var{m}3} instruction pattern
-@cindex @code{mod@var{m}3} instruction pattern
-@cindex @code{umod@var{m}3} instruction pattern
-@cindex @code{smin@var{m}3} instruction pattern
-@cindex @code{smax@var{m}3} instruction pattern
-@cindex @code{umin@var{m}3} instruction pattern
-@cindex @code{umax@var{m}3} instruction pattern
-@cindex @code{and@var{m}3} instruction pattern
-@cindex @code{ior@var{m}3} instruction pattern
-@cindex @code{xor@var{m}3} instruction pattern
-@item @samp{sub@var{m}3}, @samp{mul@var{m}3}
-@itemx @samp{div@var{m}3}, @samp{udiv@var{m}3}, @samp{mod@var{m}3}, @samp{umod@var{m}3}
-@itemx @samp{smin@var{m}3}, @samp{smax@var{m}3}, @samp{umin@var{m}3}, @samp{umax@var{m}3}
-@itemx @samp{and@var{m}3}, @samp{ior@var{m}3}, @samp{xor@var{m}3}
-Similar, for other arithmetic operations.
-
-@cindex @code{mulhisi3} instruction pattern
-@item @samp{mulhisi3}
-Multiply operands 1 and 2, which have mode @code{HImode}, and store
-a @code{SImode} product in operand 0.
-
-@cindex @code{mulqihi3} instruction pattern
-@cindex @code{mulsidi3} instruction pattern
-@item @samp{mulqihi3}, @samp{mulsidi3}
-Similar widening-multiplication instructions of other widths.
-
-@cindex @code{umulqihi3} instruction pattern
-@cindex @code{umulhisi3} instruction pattern
-@cindex @code{umulsidi3} instruction pattern
-@item @samp{umulqihi3}, @samp{umulhisi3}, @samp{umulsidi3}
-Similar widening-multiplication instructions that do unsigned
-multiplication.
-
-@cindex @code{smul@var{m}3_highpart} instruction pattern
-@item @samp{mul@var{m}3_highpart}
-Perform a signed multiplication of operands 1 and 2, which have mode
-@var{m}, and store the most significant half of the product in operand 0.
-The least significant half of the product is discarded.
-
-@cindex @code{umul@var{m}3_highpart} instruction pattern
-@item @samp{umul@var{m}3_highpart}
-Similar, but the multiplication is unsigned.
-
-@cindex @code{divmod@var{m}4} instruction pattern
-@item @samp{divmod@var{m}4}
-Signed division that produces both a quotient and a remainder.
-Operand 1 is divided by operand 2 to produce a quotient stored
-in operand 0 and a remainder stored in operand 3.
-
-For machines with an instruction that produces both a quotient and a
-remainder, provide a pattern for @samp{divmod@var{m}4} but do not
-provide patterns for @samp{div@var{m}3} and @samp{mod@var{m}3}. This
-allows optimization in the relatively common case when both the quotient
-and remainder are computed.
-
-If an instruction that just produces a quotient or just a remainder
-exists and is more efficient than the instruction that produces both,
-write the output routine of @samp{divmod@var{m}4} to call
-@code{find_reg_note} and look for a @code{REG_UNUSED} note on the
-quotient or remainder and generate the appropriate instruction.
-
-@cindex @code{udivmod@var{m}4} instruction pattern
-@item @samp{udivmod@var{m}4}
-Similar, but does unsigned division.
-
-@cindex @code{ashl@var{m}3} instruction pattern
-@item @samp{ashl@var{m}3}
-Arithmetic-shift operand 1 left by a number of bits specified by operand
-2, and store the result in operand 0. Here @var{m} is the mode of
-operand 0 and operand 1; operand 2's mode is specified by the
-instruction pattern, and the compiler will convert the operand to that
-mode before generating the instruction.
-
-@cindex @code{ashr@var{m}3} instruction pattern
-@cindex @code{lshr@var{m}3} instruction pattern
-@cindex @code{rotl@var{m}3} instruction pattern
-@cindex @code{rotr@var{m}3} instruction pattern
-@item @samp{ashr@var{m}3}, @samp{lshr@var{m}3}, @samp{rotl@var{m}3}, @samp{rotr@var{m}3}
-Other shift and rotate instructions, analogous to the
-@code{ashl@var{m}3} instructions.
-
-@cindex @code{neg@var{m}2} instruction pattern
-@item @samp{neg@var{m}2}
-Negate operand 1 and store the result in operand 0.
-
-@cindex @code{abs@var{m}2} instruction pattern
-@item @samp{abs@var{m}2}
-Store the absolute value of operand 1 into operand 0.
-
-@cindex @code{sqrt@var{m}2} instruction pattern
-@item @samp{sqrt@var{m}2}
-Store the square root of operand 1 into operand 0.
-
-The @code{sqrt} built-in function of C always uses the mode which
-corresponds to the C data type @code{double}.
-
-@cindex @code{ffs@var{m}2} instruction pattern
-@item @samp{ffs@var{m}2}
-Store into operand 0 one plus the index of the least significant 1-bit
-of operand 1. If operand 1 is zero, store zero. @var{m} is the mode
-of operand 0; operand 1's mode is specified by the instruction
-pattern, and the compiler will convert the operand to that mode before
-generating the instruction.
-
-The @code{ffs} built-in function of C always uses the mode which
-corresponds to the C data type @code{int}.
-
-@cindex @code{one_cmpl@var{m}2} instruction pattern
-@item @samp{one_cmpl@var{m}2}
-Store the bitwise-complement of operand 1 into operand 0.
-
-@cindex @code{cmp@var{m}} instruction pattern
-@item @samp{cmp@var{m}}
-Compare operand 0 and operand 1, and set the condition codes.
-The RTL pattern should look like this:
-
-@smallexample
-(set (cc0) (compare (match_operand:@var{m} 0 @dots{})
- (match_operand:@var{m} 1 @dots{})))
-@end smallexample
-
-@cindex @code{tst@var{m}} instruction pattern
-@item @samp{tst@var{m}}
-Compare operand 0 against zero, and set the condition codes.
-The RTL pattern should look like this:
-
-@smallexample
-(set (cc0) (match_operand:@var{m} 0 @dots{}))
-@end smallexample
-
-@samp{tst@var{m}} patterns should not be defined for machines that do
-not use @code{(cc0)}. Doing so would confuse the optimizer since it
-would no longer be clear which @code{set} operations were comparisons.
-The @samp{cmp@var{m}} patterns should be used instead.
-
-@cindex @code{movstr@var{m}} instruction pattern
-@item @samp{movstr@var{m}}
-Block move instruction. The addresses of the destination and source
-strings are the first two operands, and both are in mode @code{Pmode}.
-The number of bytes to move is the third operand, in mode @var{m}.
-
-The fourth operand is the known shared alignment of the source and
-destination, in the form of a @code{const_int} rtx. Thus, if the
-compiler knows that both source and destination are word-aligned,
-it may provide the value 4 for this operand.
-
-These patterns need not give special consideration to the possibility
-that the source and destination strings might overlap.
-
-@cindex @code{clrstr@var{m}} instruction pattern
-@item @samp{clrstr@var{m}}
-Block clear instruction. The addresses of the destination string is the
-first operand, in mode @code{Pmode}. The number of bytes to clear is
-the second operand, in mode @var{m}.
-
-The third operand is the known alignment of the destination, in the form
-of a @code{const_int} rtx. Thus, if the compiler knows that the
-destination is word-aligned, it may provide the value 4 for this
-operand.
-
-@cindex @code{cmpstr@var{m}} instruction pattern
-@item @samp{cmpstr@var{m}}
-Block compare instruction, with five operands. Operand 0 is the output;
-it has mode @var{m}. The remaining four operands are like the operands
-of @samp{movstr@var{m}}. The two memory blocks specified are compared
-byte by byte in lexicographic order. The effect of the instruction is
-to store a value in operand 0 whose sign indicates the result of the
-comparison.
-
-@cindex @code{strlen@var{m}} instruction pattern
-@item @samp{strlen@var{m}}
-Compute the length of a string, with three operands.
-Operand 0 is the result (of mode @var{m}), operand 1 is
-a @code{mem} referring to the first character of the string,
-operand 2 is the character to search for (normally zero),
-and operand 3 is a constant describing the known alignment
-of the beginning of the string.
-
-@cindex @code{float@var{mn}2} instruction pattern
-@item @samp{float@var{m}@var{n}2}
-Convert signed integer operand 1 (valid for fixed point mode @var{m}) to
-floating point mode @var{n} and store in operand 0 (which has mode
-@var{n}).
-
-@cindex @code{floatuns@var{mn}2} instruction pattern
-@item @samp{floatuns@var{m}@var{n}2}
-Convert unsigned integer operand 1 (valid for fixed point mode @var{m})
-to floating point mode @var{n} and store in operand 0 (which has mode
-@var{n}).
-
-@cindex @code{fix@var{mn}2} instruction pattern
-@item @samp{fix@var{m}@var{n}2}
-Convert operand 1 (valid for floating point mode @var{m}) to fixed
-point mode @var{n} as a signed number and store in operand 0 (which
-has mode @var{n}). This instruction's result is defined only when
-the value of operand 1 is an integer.
-
-@cindex @code{fixuns@var{mn}2} instruction pattern
-@item @samp{fixuns@var{m}@var{n}2}
-Convert operand 1 (valid for floating point mode @var{m}) to fixed
-point mode @var{n} as an unsigned number and store in operand 0 (which
-has mode @var{n}). This instruction's result is defined only when the
-value of operand 1 is an integer.
-
-@cindex @code{ftrunc@var{m}2} instruction pattern
-@item @samp{ftrunc@var{m}2}
-Convert operand 1 (valid for floating point mode @var{m}) to an
-integer value, still represented in floating point mode @var{m}, and
-store it in operand 0 (valid for floating point mode @var{m}).
-
-@cindex @code{fix_trunc@var{mn}2} instruction pattern
-@item @samp{fix_trunc@var{m}@var{n}2}
-Like @samp{fix@var{m}@var{n}2} but works for any floating point value
-of mode @var{m} by converting the value to an integer.
-
-@cindex @code{fixuns_trunc@var{mn}2} instruction pattern
-@item @samp{fixuns_trunc@var{m}@var{n}2}
-Like @samp{fixuns@var{m}@var{n}2} but works for any floating point
-value of mode @var{m} by converting the value to an integer.
-
-@cindex @code{trunc@var{mn}2} instruction pattern
-@item @samp{trunc@var{m}@var{n}2}
-Truncate operand 1 (valid for mode @var{m}) to mode @var{n} and
-store in operand 0 (which has mode @var{n}). Both modes must be fixed
-point or both floating point.
-
-@cindex @code{extend@var{mn}2} instruction pattern
-@item @samp{extend@var{m}@var{n}2}
-Sign-extend operand 1 (valid for mode @var{m}) to mode @var{n} and
-store in operand 0 (which has mode @var{n}). Both modes must be fixed
-point or both floating point.
-
-@cindex @code{zero_extend@var{mn}2} instruction pattern
-@item @samp{zero_extend@var{m}@var{n}2}
-Zero-extend operand 1 (valid for mode @var{m}) to mode @var{n} and
-store in operand 0 (which has mode @var{n}). Both modes must be fixed
-point.
-
-@cindex @code{extv} instruction pattern
-@item @samp{extv}
-Extract a bit field from operand 1 (a register or memory operand), where
-operand 2 specifies the width in bits and operand 3 the starting bit,
-and store it in operand 0. Operand 0 must have mode @code{word_mode}.
-Operand 1 may have mode @code{byte_mode} or @code{word_mode}; often
-@code{word_mode} is allowed only for registers. Operands 2 and 3 must
-be valid for @code{word_mode}.
-
-The RTL generation pass generates this instruction only with constants
-for operands 2 and 3.
-
-The bit-field value is sign-extended to a full word integer
-before it is stored in operand 0.
-
-@cindex @code{extzv} instruction pattern
-@item @samp{extzv}
-Like @samp{extv} except that the bit-field value is zero-extended.
-
-@cindex @code{insv} instruction pattern
-@item @samp{insv}
-Store operand 3 (which must be valid for @code{word_mode}) into a bit
-field in operand 0, where operand 1 specifies the width in bits and
-operand 2 the starting bit. Operand 0 may have mode @code{byte_mode} or
-@code{word_mode}; often @code{word_mode} is allowed only for registers.
-Operands 1 and 2 must be valid for @code{word_mode}.
-
-The RTL generation pass generates this instruction only with constants
-for operands 1 and 2.
-
-@cindex @code{mov@var{mode}cc} instruction pattern
-@item @samp{mov@var{mode}cc}
-Conditionally move operand 2 or operand 3 into operand 0 according to the
-comparison in operand 1. If the comparison is true, operand 2 is moved
-into operand 0, otherwise operand 3 is moved.
-
-The mode of the operands being compared need not be the same as the operands
-being moved. Some machines, sparc64 for example, have instructions that
-conditionally move an integer value based on the floating point condition
-codes and vice versa.
-
-If the machine does not have conditional move instructions, do not
-define these patterns.
-
-@cindex @code{s@var{cond}} instruction pattern
-@item @samp{s@var{cond}}
-Store zero or nonzero in the operand according to the condition codes.
-Value stored is nonzero iff the condition @var{cond} is true.
-@var{cond} is the name of a comparison operation expression code, such
-as @code{eq}, @code{lt} or @code{leu}.
-
-You specify the mode that the operand must have when you write the
-@code{match_operand} expression. The compiler automatically sees
-which mode you have used and supplies an operand of that mode.
-
-The value stored for a true condition must have 1 as its low bit, or
-else must be negative. Otherwise the instruction is not suitable and
-you should omit it from the machine description. You describe to the
-compiler exactly which value is stored by defining the macro
-@code{STORE_FLAG_VALUE} (@pxref{Misc}). If a description cannot be
-found that can be used for all the @samp{s@var{cond}} patterns, you
-should omit those operations from the machine description.
-
-These operations may fail, but should do so only in relatively
-uncommon cases; if they would fail for common cases involving
-integer comparisons, it is best to omit these patterns.
-
-If these operations are omitted, the compiler will usually generate code
-that copies the constant one to the target and branches around an
-assignment of zero to the target. If this code is more efficient than
-the potential instructions used for the @samp{s@var{cond}} pattern
-followed by those required to convert the result into a 1 or a zero in
-@code{SImode}, you should omit the @samp{s@var{cond}} operations from
-the machine description.
-
-@cindex @code{b@var{cond}} instruction pattern
-@item @samp{b@var{cond}}
-Conditional branch instruction. Operand 0 is a @code{label_ref} that
-refers to the label to jump to. Jump if the condition codes meet
-condition @var{cond}.
-
-Some machines do not follow the model assumed here where a comparison
-instruction is followed by a conditional branch instruction. In that
-case, the @samp{cmp@var{m}} (and @samp{tst@var{m}}) patterns should
-simply store the operands away and generate all the required insns in a
-@code{define_expand} (@pxref{Expander Definitions}) for the conditional
-branch operations. All calls to expand @samp{b@var{cond}} patterns are
-immediately preceded by calls to expand either a @samp{cmp@var{m}}
-pattern or a @samp{tst@var{m}} pattern.
-
-Machines that use a pseudo register for the condition code value, or
-where the mode used for the comparison depends on the condition being
-tested, should also use the above mechanism. @xref{Jump Patterns}
-
-The above discussion also applies to the @samp{mov@var{mode}cc} and
-@samp{s@var{cond}} patterns.
-
-@cindex @code{call} instruction pattern
-@item @samp{call}
-Subroutine call instruction returning no value. Operand 0 is the
-function to call; operand 1 is the number of bytes of arguments pushed
-(in mode @code{SImode}, except it is normally a @code{const_int});
-operand 2 is the number of registers used as operands.
-
-On most machines, operand 2 is not actually stored into the RTL
-pattern. It is supplied for the sake of some RISC machines which need
-to put this information into the assembler code; they can put it in
-the RTL instead of operand 1.
-
-Operand 0 should be a @code{mem} RTX whose address is the address of the
-function. Note, however, that this address can be a @code{symbol_ref}
-expression even if it would not be a legitimate memory address on the
-target machine. If it is also not a valid argument for a call
-instruction, the pattern for this operation should be a
-@code{define_expand} (@pxref{Expander Definitions}) that places the
-address into a register and uses that register in the call instruction.
-
-@cindex @code{call_value} instruction pattern
-@item @samp{call_value}
-Subroutine call instruction returning a value. Operand 0 is the hard
-register in which the value is returned. There are three more
-operands, the same as the three operands of the @samp{call}
-instruction (but with numbers increased by one).
-
-Subroutines that return @code{BLKmode} objects use the @samp{call}
-insn.
-
-@cindex @code{call_pop} instruction pattern
-@cindex @code{call_value_pop} instruction pattern
-@item @samp{call_pop}, @samp{call_value_pop}
-Similar to @samp{call} and @samp{call_value}, except used if defined and
-if @code{RETURN_POPS_ARGS} is non-zero. They should emit a @code{parallel}
-that contains both the function call and a @code{set} to indicate the
-adjustment made to the frame pointer.
-
-For machines where @code{RETURN_POPS_ARGS} can be non-zero, the use of these
-patterns increases the number of functions for which the frame pointer
-can be eliminated, if desired.
-
-@cindex @code{untyped_call} instruction pattern
-@item @samp{untyped_call}
-Subroutine call instruction returning a value of any type. Operand 0 is
-the function to call; operand 1 is a memory location where the result of
-calling the function is to be stored; operand 2 is a @code{parallel}
-expression where each element is a @code{set} expression that indicates
-the saving of a function return value into the result block.
-
-This instruction pattern should be defined to support
-@code{__builtin_apply} on machines where special instructions are needed
-to call a subroutine with arbitrary arguments or to save the value
-returned. This instruction pattern is required on machines that have
-multiple registers that can hold a return value (i.e.
-@code{FUNCTION_VALUE_REGNO_P} is true for more than one register).
-
-@cindex @code{return} instruction pattern
-@item @samp{return}
-Subroutine return instruction. This instruction pattern name should be
-defined only if a single instruction can do all the work of returning
-from a function.
-
-Like the @samp{mov@var{m}} patterns, this pattern is also used after the
-RTL generation phase. In this case it is to support machines where
-multiple instructions are usually needed to return from a function, but
-some class of functions only requires one instruction to implement a
-return. Normally, the applicable functions are those which do not need
-to save any registers or allocate stack space.
-
-@findex reload_completed
-@findex leaf_function_p
-For such machines, the condition specified in this pattern should only
-be true when @code{reload_completed} is non-zero and the function's
-epilogue would only be a single instruction. For machines with register
-windows, the routine @code{leaf_function_p} may be used to determine if
-a register window push is required.
-
-Machines that have conditional return instructions should define patterns
-such as
-
-@smallexample
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator
- 0 "comparison_operator"
- [(cc0) (const_int 0)])
- (return)
- (pc)))]
- "@var{condition}"
- "@dots{}")
-@end smallexample
-
-where @var{condition} would normally be the same condition specified on the
-named @samp{return} pattern.
-
-@cindex @code{untyped_return} instruction pattern
-@item @samp{untyped_return}
-Untyped subroutine return instruction. This instruction pattern should
-be defined to support @code{__builtin_return} on machines where special
-instructions are needed to return a value of any type.
-
-Operand 0 is a memory location where the result of calling a function
-with @code{__builtin_apply} is stored; operand 1 is a @code{parallel}
-expression where each element is a @code{set} expression that indicates
-the restoring of a function return value from the result block.
-
-@cindex @code{nop} instruction pattern
-@item @samp{nop}
-No-op instruction. This instruction pattern name should always be defined
-to output a no-op in assembler code. @code{(const_int 0)} will do as an
-RTL pattern.
-
-@cindex @code{indirect_jump} instruction pattern
-@item @samp{indirect_jump}
-An instruction to jump to an address which is operand zero.
-This pattern name is mandatory on all machines.
-
-@cindex @code{casesi} instruction pattern
-@item @samp{casesi}
-Instruction to jump through a dispatch table, including bounds checking.
-This instruction takes five operands:
-
-@enumerate
-@item
-The index to dispatch on, which has mode @code{SImode}.
-
-@item
-The lower bound for indices in the table, an integer constant.
-
-@item
-The total range of indices in the table---the largest index
-minus the smallest one (both inclusive).
-
-@item
-A label that precedes the table itself.
-
-@item
-A label to jump to if the index has a value outside the bounds.
-(If the machine-description macro @code{CASE_DROPS_THROUGH} is defined,
-then an out-of-bounds index drops through to the code following
-the jump table instead of jumping to this label. In that case,
-this label is not actually used by the @samp{casesi} instruction,
-but it is always provided as an operand.)
-@end enumerate
-
-The table is a @code{addr_vec} or @code{addr_diff_vec} inside of a
-@code{jump_insn}. The number of elements in the table is one plus the
-difference between the upper bound and the lower bound.
-
-@cindex @code{tablejump} instruction pattern
-@item @samp{tablejump}
-Instruction to jump to a variable address. This is a low-level
-capability which can be used to implement a dispatch table when there
-is no @samp{casesi} pattern.
-
-This pattern requires two operands: the address or offset, and a label
-which should immediately precede the jump table. If the macro
-@code{CASE_VECTOR_PC_RELATIVE} is defined then the first operand is an
-offset which counts from the address of the table; otherwise, it is an
-absolute address to jump to. In either case, the first operand has
-mode @code{Pmode}.
-
-The @samp{tablejump} insn is always the last insn before the jump
-table it uses. Its assembler code normally has no need to use the
-second operand, but you should incorporate it in the RTL pattern so
-that the jump optimizer will not delete the table as unreachable code.
-
-@cindex @code{canonicalize_funcptr_for_compare} instruction pattern
-@item @samp{canonicalize_funcptr_for_compare}
-Canonicalize the function pointer in operand 1 and store the result
-into operand 0.
-
-Operand 0 is always a @code{reg} and has mode @code{Pmode}; operand 1
-may be a @code{reg}, @code{mem}, @code{symbol_ref}, @code{const_int}, etc
-and also has mode @code{Pmode}.
-
-Canonicalization of a function pointer usually involves computing
-the address of the function which would be called if the function
-pointer were used in an indirect call.
-
-Only define this pattern if function pointers on the target machine
-can have different values but still call the same function when
-used in an indirect call.
-
-@cindex @code{save_stack_block} instruction pattern
-@cindex @code{save_stack_function} instruction pattern
-@cindex @code{save_stack_nonlocal} instruction pattern
-@cindex @code{restore_stack_block} instruction pattern
-@cindex @code{restore_stack_function} instruction pattern
-@cindex @code{restore_stack_nonlocal} instruction pattern
-@item @samp{save_stack_block}
-@itemx @samp{save_stack_function}
-@itemx @samp{save_stack_nonlocal}
-@itemx @samp{restore_stack_block}
-@itemx @samp{restore_stack_function}
-@itemx @samp{restore_stack_nonlocal}
-Most machines save and restore the stack pointer by copying it to or
-from an object of mode @code{Pmode}. Do not define these patterns on
-such machines.
-
-Some machines require special handling for stack pointer saves and
-restores. On those machines, define the patterns corresponding to the
-non-standard cases by using a @code{define_expand} (@pxref{Expander
-Definitions}) that produces the required insns. The three types of
-saves and restores are:
-
-@enumerate
-@item
-@samp{save_stack_block} saves the stack pointer at the start of a block
-that allocates a variable-sized object, and @samp{restore_stack_block}
-restores the stack pointer when the block is exited.
-
-@item
-@samp{save_stack_function} and @samp{restore_stack_function} do a
-similar job for the outermost block of a function and are used when the
-function allocates variable-sized objects or calls @code{alloca}. Only
-the epilogue uses the restored stack pointer, allowing a simpler save or
-restore sequence on some machines.
-
-@item
-@samp{save_stack_nonlocal} is used in functions that contain labels
-branched to by nested functions. It saves the stack pointer in such a
-way that the inner function can use @samp{restore_stack_nonlocal} to
-restore the stack pointer. The compiler generates code to restore the
-frame and argument pointer registers, but some machines require saving
-and restoring additional data such as register window information or
-stack backchains. Place insns in these patterns to save and restore any
-such required data.
-@end enumerate
-
-When saving the stack pointer, operand 0 is the save area and operand 1
-is the stack pointer. The mode used to allocate the save area is the
-mode of operand 0. You must specify an integral mode, or
-@code{VOIDmode} if no save area is needed for a particular type of save
-(either because no save is needed or because a machine-specific save
-area can be used). Operand 0 is the stack pointer and operand 1 is the
-save area for restore operations. If @samp{save_stack_block} is
-defined, operand 0 must not be @code{VOIDmode} since these saves can be
-arbitrarily nested.
-
-A save area is a @code{mem} that is at a constant offset from
-@code{virtual_stack_vars_rtx} when the stack pointer is saved for use by
-nonlocal gotos and a @code{reg} in the other two cases.
-
-@cindex @code{allocate_stack} instruction pattern
-@item @samp{allocate_stack}
-Subtract (or add if @code{STACK_GROWS_DOWNWARD} is undefined) operand 0 from
-the stack pointer to create space for dynamically allocated data.
-
-Do not define this pattern if all that must be done is the subtraction.
-Some machines require other operations such as stack probes or
-maintaining the back chain. Define this pattern to emit those
-operations in addition to updating the stack pointer.
-
-@cindex @code{probe} instruction pattern
-@item @samp{probe}
-Some machines require instructions to be executed after space is
-allocated from the stack, for example to generate a reference at
-the bottom of the stack.
-
-If you need to emit instructions before the stack has been adjusted,
-put them into the @samp{allocate_stack} pattern. Otherwise, define
-this pattern to emit the required instructions.
-
-No operands are provided.
-
-@cindex @code{nonlocal_goto} instruction pattern
-@item @samp{nonlocal_goto}
-Emit code to generate a non-local goto, e.g., a jump from one function
-to a label in an outer function. This pattern has four arguments,
-each representing a value to be used in the jump. The first
-argument is to be loadedd into the frame pointer, the second is
-the address to branch to (code to dispatch to the actual label),
-the third is the address of a location where the stack is saved,
-and the last is the address of the label, to be placed in the
-location for the incoming static chain.
-
-On most machines you need not define this pattern, since GNU CC will
-already generate the correct code, which is to load the frame pointer
-and static chain, restore the stack (using the
-@samp{restore_stack_nonlocal} pattern, if defined), and jump indirectly
-to the dispatcher. You need only define this pattern if this code will
-not work on your machine.
-
-@cindex @code{nonlocal_goto_receiver} instruction pattern
-@item @samp{nonlocal_goto_receiver}
-This pattern, if defined, contains code needed at the target of a
-nonlocal goto after the code already generated by GNU CC. You will not
-normally need to define this pattern. A typical reason why you might
-need this pattern is if some value, such as a pointer to a global table,
-must be restored when the frame pointer is restored. There are no
-arguments.
-@end table
-
-@node Pattern Ordering
-@section When the Order of Patterns Matters
-@cindex Pattern Ordering
-@cindex Ordering of Patterns
-
-Sometimes an insn can match more than one instruction pattern. Then the
-pattern that appears first in the machine description is the one used.
-Therefore, more specific patterns (patterns that will match fewer things)
-and faster instructions (those that will produce better code when they
-do match) should usually go first in the description.
-
-In some cases the effect of ordering the patterns can be used to hide
-a pattern when it is not valid. For example, the 68000 has an
-instruction for converting a fullword to floating point and another
-for converting a byte to floating point. An instruction converting
-an integer to floating point could match either one. We put the
-pattern to convert the fullword first to make sure that one will
-be used rather than the other. (Otherwise a large integer might
-be generated as a single-byte immediate quantity, which would not work.)
-Instead of using this pattern ordering it would be possible to make the
-pattern for convert-a-byte smart enough to deal properly with any
-constant value.
-
-@node Dependent Patterns
-@section Interdependence of Patterns
-@cindex Dependent Patterns
-@cindex Interdependence of Patterns
-
-Every machine description must have a named pattern for each of the
-conditional branch names @samp{b@var{cond}}. The recognition template
-must always have the form
-
-@example
-(set (pc)
- (if_then_else (@var{cond} (cc0) (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))
-@end example
-
-@noindent
-In addition, every machine description must have an anonymous pattern
-for each of the possible reverse-conditional branches. Their templates
-look like
-
-@example
-(set (pc)
- (if_then_else (@var{cond} (cc0) (const_int 0))
- (pc)
- (label_ref (match_operand 0 "" ""))))
-@end example
-
-@noindent
-They are necessary because jump optimization can turn direct-conditional
-branches into reverse-conditional branches.
-
-It is often convenient to use the @code{match_operator} construct to
-reduce the number of patterns that must be specified for branches. For
-example,
-
-@example
-(define_insn ""
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(cc0) (const_int 0)])
- (pc)
- (label_ref (match_operand 1 "" ""))))]
- "@var{condition}"
- "@dots{}")
-@end example
-
-In some cases machines support instructions identical except for the
-machine mode of one or more operands. For example, there may be
-``sign-extend halfword'' and ``sign-extend byte'' instructions whose
-patterns are
-
-@example
-(set (match_operand:SI 0 @dots{})
- (extend:SI (match_operand:HI 1 @dots{})))
-
-(set (match_operand:SI 0 @dots{})
- (extend:SI (match_operand:QI 1 @dots{})))
-@end example
-
-@noindent
-Constant integers do not specify a machine mode, so an instruction to
-extend a constant value could match either pattern. The pattern it
-actually will match is the one that appears first in the file. For correct
-results, this must be the one for the widest possible mode (@code{HImode},
-here). If the pattern matches the @code{QImode} instruction, the results
-will be incorrect if the constant value does not actually fit that mode.
-
-Such instructions to extend constants are rarely generated because they are
-optimized away, but they do occasionally happen in nonoptimized
-compilations.
-
-If a constraint in a pattern allows a constant, the reload pass may
-replace a register with a constant permitted by the constraint in some
-cases. Similarly for memory references. Because of this substitution,
-you should not provide separate patterns for increment and decrement
-instructions. Instead, they should be generated from the same pattern
-that supports register-register add insns by examining the operands and
-generating the appropriate machine instruction.
-
-@node Jump Patterns
-@section Defining Jump Instruction Patterns
-@cindex jump instruction patterns
-@cindex defining jump instruction patterns
-
-For most machines, GNU CC assumes that the machine has a condition code.
-A comparison insn sets the condition code, recording the results of both
-signed and unsigned comparison of the given operands. A separate branch
-insn tests the condition code and branches or not according its value.
-The branch insns come in distinct signed and unsigned flavors. Many
-common machines, such as the Vax, the 68000 and the 32000, work this
-way.
-
-Some machines have distinct signed and unsigned compare instructions, and
-only one set of conditional branch instructions. The easiest way to handle
-these machines is to treat them just like the others until the final stage
-where assembly code is written. At this time, when outputting code for the
-compare instruction, peek ahead at the following branch using
-@code{next_cc0_user (insn)}. (The variable @code{insn} refers to the insn
-being output, in the output-writing code in an instruction pattern.) If
-the RTL says that is an unsigned branch, output an unsigned compare;
-otherwise output a signed compare. When the branch itself is output, you
-can treat signed and unsigned branches identically.
-
-The reason you can do this is that GNU CC always generates a pair of
-consecutive RTL insns, possibly separated by @code{note} insns, one to
-set the condition code and one to test it, and keeps the pair inviolate
-until the end.
-
-To go with this technique, you must define the machine-description macro
-@code{NOTICE_UPDATE_CC} to do @code{CC_STATUS_INIT}; in other words, no
-compare instruction is superfluous.
-
-Some machines have compare-and-branch instructions and no condition code.
-A similar technique works for them. When it is time to ``output'' a
-compare instruction, record its operands in two static variables. When
-outputting the branch-on-condition-code instruction that follows, actually
-output a compare-and-branch instruction that uses the remembered operands.
-
-It also works to define patterns for compare-and-branch instructions.
-In optimizing compilation, the pair of compare and branch instructions
-will be combined according to these patterns. But this does not happen
-if optimization is not requested. So you must use one of the solutions
-above in addition to any special patterns you define.
-
-In many RISC machines, most instructions do not affect the condition
-code and there may not even be a separate condition code register. On
-these machines, the restriction that the definition and use of the
-condition code be adjacent insns is not necessary and can prevent
-important optimizations. For example, on the IBM RS/6000, there is a
-delay for taken branches unless the condition code register is set three
-instructions earlier than the conditional branch. The instruction
-scheduler cannot perform this optimization if it is not permitted to
-separate the definition and use of the condition code register.
-
-On these machines, do not use @code{(cc0)}, but instead use a register
-to represent the condition code. If there is a specific condition code
-register in the machine, use a hard register. If the condition code or
-comparison result can be placed in any general register, or if there are
-multiple condition registers, use a pseudo register.
-
-@findex prev_cc0_setter
-@findex next_cc0_user
-On some machines, the type of branch instruction generated may depend on
-the way the condition code was produced; for example, on the 68k and
-Sparc, setting the condition code directly from an add or subtract
-instruction does not clear the overflow bit the way that a test
-instruction does, so a different branch instruction must be used for
-some conditional branches. For machines that use @code{(cc0)}, the set
-and use of the condition code must be adjacent (separated only by
-@code{note} insns) allowing flags in @code{cc_status} to be used.
-(@xref{Condition Code}.) Also, the comparison and branch insns can be
-located from each other by using the functions @code{prev_cc0_setter}
-and @code{next_cc0_user}.
-
-However, this is not true on machines that do not use @code{(cc0)}. On
-those machines, no assumptions can be made about the adjacency of the
-compare and branch insns and the above methods cannot be used. Instead,
-we use the machine mode of the condition code register to record
-different formats of the condition code register.
-
-Registers used to store the condition code value should have a mode that
-is in class @code{MODE_CC}. Normally, it will be @code{CCmode}. If
-additional modes are required (as for the add example mentioned above in
-the Sparc), define the macro @code{EXTRA_CC_MODES} to list the
-additional modes required (@pxref{Condition Code}). Also define
-@code{EXTRA_CC_NAMES} to list the names of those modes and
-@code{SELECT_CC_MODE} to choose a mode given an operand of a compare.
-
-If it is known during RTL generation that a different mode will be
-required (for example, if the machine has separate compare instructions
-for signed and unsigned quantities, like most IBM processors), they can
-be specified at that time.
-
-If the cases that require different modes would be made by instruction
-combination, the macro @code{SELECT_CC_MODE} determines which machine
-mode should be used for the comparison result. The patterns should be
-written using that mode. To support the case of the add on the Sparc
-discussed above, we have the pattern
-
-@smallexample
-(define_insn ""
- [(set (reg:CC_NOOV 0)
- (compare:CC_NOOV
- (plus:SI (match_operand:SI 0 "register_operand" "%r")
- (match_operand:SI 1 "arith_operand" "rI"))
- (const_int 0)))]
- ""
- "@dots{}")
-@end smallexample
-
-The @code{SELECT_CC_MODE} macro on the Sparc returns @code{CC_NOOVmode}
-for comparisons whose argument is a @code{plus}.
-
-@node Insn Canonicalizations
-@section Canonicalization of Instructions
-@cindex canonicalization of instructions
-@cindex insn canonicalization
-
-There are often cases where multiple RTL expressions could represent an
-operation performed by a single machine instruction. This situation is
-most commonly encountered with logical, branch, and multiply-accumulate
-instructions. In such cases, the compiler attempts to convert these
-multiple RTL expressions into a single canonical form to reduce the
-number of insn patterns required.
-
-In addition to algebraic simplifications, following canonicalizations
-are performed:
-
-@itemize @bullet
-@item
-For commutative and comparison operators, a constant is always made the
-second operand. If a machine only supports a constant as the second
-operand, only patterns that match a constant in the second operand need
-be supplied.
-
-@cindex @code{neg}, canonicalization of
-@cindex @code{not}, canonicalization of
-@cindex @code{mult}, canonicalization of
-@cindex @code{plus}, canonicalization of
-@cindex @code{minus}, canonicalization of
-For these operators, if only one operand is a @code{neg}, @code{not},
-@code{mult}, @code{plus}, or @code{minus} expression, it will be the
-first operand.
-
-@cindex @code{compare}, canonicalization of
-@item
-For the @code{compare} operator, a constant is always the second operand
-on machines where @code{cc0} is used (@pxref{Jump Patterns}). On other
-machines, there are rare cases where the compiler might want to construct
-a @code{compare} with a constant as the first operand. However, these
-cases are not common enough for it to be worthwhile to provide a pattern
-matching a constant as the first operand unless the machine actually has
-such an instruction.
-
-An operand of @code{neg}, @code{not}, @code{mult}, @code{plus}, or
-@code{minus} is made the first operand under the same conditions as
-above.
-
-@item
-@code{(minus @var{x} (const_int @var{n}))} is converted to
-@code{(plus @var{x} (const_int @var{-n}))}.
-
-@item
-Within address computations (i.e., inside @code{mem}), a left shift is
-converted into the appropriate multiplication by a power of two.
-
-@cindex @code{ior}, canonicalization of
-@cindex @code{and}, canonicalization of
-@cindex De Morgan's law
-De`Morgan's Law is used to move bitwise negation inside a bitwise
-logical-and or logical-or operation. If this results in only one
-operand being a @code{not} expression, it will be the first one.
-
-A machine that has an instruction that performs a bitwise logical-and of one
-operand with the bitwise negation of the other should specify the pattern
-for that instruction as
-
-@example
-(define_insn ""
- [(set (match_operand:@var{m} 0 @dots{})
- (and:@var{m} (not:@var{m} (match_operand:@var{m} 1 @dots{}))
- (match_operand:@var{m} 2 @dots{})))]
- "@dots{}"
- "@dots{}")
-@end example
-
-@noindent
-Similarly, a pattern for a ``NAND'' instruction should be written
-
-@example
-(define_insn ""
- [(set (match_operand:@var{m} 0 @dots{})
- (ior:@var{m} (not:@var{m} (match_operand:@var{m} 1 @dots{}))
- (not:@var{m} (match_operand:@var{m} 2 @dots{}))))]
- "@dots{}"
- "@dots{}")
-@end example
-
-In both cases, it is not necessary to include patterns for the many
-logically equivalent RTL expressions.
-
-@cindex @code{xor}, canonicalization of
-@item
-The only possible RTL expressions involving both bitwise exclusive-or
-and bitwise negation are @code{(xor:@var{m} @var{x} @var{y})}
-and @code{(not:@var{m} (xor:@var{m} @var{x} @var{y}))}.@refill
-
-@item
-The sum of three items, one of which is a constant, will only appear in
-the form
-
-@example
-(plus:@var{m} (plus:@var{m} @var{x} @var{y}) @var{constant})
-@end example
-
-@item
-On machines that do not use @code{cc0},
-@code{(compare @var{x} (const_int 0))} will be converted to
-@var{x}.@refill
-
-@cindex @code{zero_extract}, canonicalization of
-@cindex @code{sign_extract}, canonicalization of
-@item
-Equality comparisons of a group of bits (usually a single bit) with zero
-will be written using @code{zero_extract} rather than the equivalent
-@code{and} or @code{sign_extract} operations.
-
-@end itemize
-
-@node Peephole Definitions
-@section Machine-Specific Peephole Optimizers
-@cindex peephole optimizer definitions
-@cindex defining peephole optimizers
-
-In addition to instruction patterns the @file{md} file may contain
-definitions of machine-specific peephole optimizations.
-
-The combiner does not notice certain peephole optimizations when the data
-flow in the program does not suggest that it should try them. For example,
-sometimes two consecutive insns related in purpose can be combined even
-though the second one does not appear to use a register computed in the
-first one. A machine-specific peephole optimizer can detect such
-opportunities.
-
-@need 1000
-A definition looks like this:
-
-@smallexample
-(define_peephole
- [@var{insn-pattern-1}
- @var{insn-pattern-2}
- @dots{}]
- "@var{condition}"
- "@var{template}"
- "@var{optional insn-attributes}")
-@end smallexample
-
-@noindent
-The last string operand may be omitted if you are not using any
-machine-specific information in this machine description. If present,
-it must obey the same rules as in a @code{define_insn}.
-
-In this skeleton, @var{insn-pattern-1} and so on are patterns to match
-consecutive insns. The optimization applies to a sequence of insns when
-@var{insn-pattern-1} matches the first one, @var{insn-pattern-2} matches
-the next, and so on.@refill
-
-Each of the insns matched by a peephole must also match a
-@code{define_insn}. Peepholes are checked only at the last stage just
-before code generation, and only optionally. Therefore, any insn which
-would match a peephole but no @code{define_insn} will cause a crash in code
-generation in an unoptimized compilation, or at various optimization
-stages.
-
-The operands of the insns are matched with @code{match_operands},
-@code{match_operator}, and @code{match_dup}, as usual. What is not
-usual is that the operand numbers apply to all the insn patterns in the
-definition. So, you can check for identical operands in two insns by
-using @code{match_operand} in one insn and @code{match_dup} in the
-other.
-
-The operand constraints used in @code{match_operand} patterns do not have
-any direct effect on the applicability of the peephole, but they will
-be validated afterward, so make sure your constraints are general enough
-to apply whenever the peephole matches. If the peephole matches
-but the constraints are not satisfied, the compiler will crash.
-
-It is safe to omit constraints in all the operands of the peephole; or
-you can write constraints which serve as a double-check on the criteria
-previously tested.
-
-Once a sequence of insns matches the patterns, the @var{condition} is
-checked. This is a C expression which makes the final decision whether to
-perform the optimization (we do so if the expression is nonzero). If
-@var{condition} is omitted (in other words, the string is empty) then the
-optimization is applied to every sequence of insns that matches the
-patterns.
-
-The defined peephole optimizations are applied after register allocation
-is complete. Therefore, the peephole definition can check which
-operands have ended up in which kinds of registers, just by looking at
-the operands.
-
-@findex prev_active_insn
-The way to refer to the operands in @var{condition} is to write
-@code{operands[@var{i}]} for operand number @var{i} (as matched by
-@code{(match_operand @var{i} @dots{})}). Use the variable @code{insn}
-to refer to the last of the insns being matched; use
-@code{prev_active_insn} to find the preceding insns.
-
-@findex dead_or_set_p
-When optimizing computations with intermediate results, you can use
-@var{condition} to match only when the intermediate results are not used
-elsewhere. Use the C expression @code{dead_or_set_p (@var{insn},
-@var{op})}, where @var{insn} is the insn in which you expect the value
-to be used for the last time (from the value of @code{insn}, together
-with use of @code{prev_nonnote_insn}), and @var{op} is the intermediate
-value (from @code{operands[@var{i}]}).@refill
-
-Applying the optimization means replacing the sequence of insns with one
-new insn. The @var{template} controls ultimate output of assembler code
-for this combined insn. It works exactly like the template of a
-@code{define_insn}. Operand numbers in this template are the same ones
-used in matching the original sequence of insns.
-
-The result of a defined peephole optimizer does not need to match any of
-the insn patterns in the machine description; it does not even have an
-opportunity to match them. The peephole optimizer definition itself serves
-as the insn pattern to control how the insn is output.
-
-Defined peephole optimizers are run as assembler code is being output,
-so the insns they produce are never combined or rearranged in any way.
-
-Here is an example, taken from the 68000 machine description:
-
-@smallexample
-(define_peephole
- [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
- (set (match_operand:DF 0 "register_operand" "=f")
- (match_operand:DF 1 "register_operand" "ad"))]
- "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
- "*
-@{
- rtx xoperands[2];
- xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
-#ifdef MOTOROLA
- output_asm_insn (\"move.l %1,(sp)\", xoperands);
- output_asm_insn (\"move.l %1,-(sp)\", operands);
- return \"fmove.d (sp)+,%0\";
-#else
- output_asm_insn (\"movel %1,sp@@\", xoperands);
- output_asm_insn (\"movel %1,sp@@-\", operands);
- return \"fmoved sp@@+,%0\";
-#endif
-@}
-")
-@end smallexample
-
-@need 1000
-The effect of this optimization is to change
-
-@smallexample
-@group
-jbsr _foobar
-addql #4,sp
-movel d1,sp@@-
-movel d0,sp@@-
-fmoved sp@@+,fp0
-@end group
-@end smallexample
-
-@noindent
-into
-
-@smallexample
-@group
-jbsr _foobar
-movel d1,sp@@
-movel d0,sp@@-
-fmoved sp@@+,fp0
-@end group
-@end smallexample
-
-@ignore
-@findex CC_REVERSED
-If a peephole matches a sequence including one or more jump insns, you must
-take account of the flags such as @code{CC_REVERSED} which specify that the
-condition codes are represented in an unusual manner. The compiler
-automatically alters any ordinary conditional jumps which occur in such
-situations, but the compiler cannot alter jumps which have been replaced by
-peephole optimizations. So it is up to you to alter the assembler code
-that the peephole produces. Supply C code to write the assembler output,
-and in this C code check the condition code status flags and change the
-assembler code as appropriate.
-@end ignore
-
-@var{insn-pattern-1} and so on look @emph{almost} like the second
-operand of @code{define_insn}. There is one important difference: the
-second operand of @code{define_insn} consists of one or more RTX's
-enclosed in square brackets. Usually, there is only one: then the same
-action can be written as an element of a @code{define_peephole}. But
-when there are multiple actions in a @code{define_insn}, they are
-implicitly enclosed in a @code{parallel}. Then you must explicitly
-write the @code{parallel}, and the square brackets within it, in the
-@code{define_peephole}. Thus, if an insn pattern looks like this,
-
-@smallexample
-(define_insn "divmodsi4"
- [(set (match_operand:SI 0 "general_operand" "=d")
- (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dmsK")))
- (set (match_operand:SI 3 "general_operand" "=d")
- (mod:SI (match_dup 1) (match_dup 2)))]
- "TARGET_68020"
- "divsl%.l %2,%3:%0")
-@end smallexample
-
-@noindent
-then the way to mention this insn in a peephole is as follows:
-
-@smallexample
-(define_peephole
- [@dots{}
- (parallel
- [(set (match_operand:SI 0 "general_operand" "=d")
- (div:SI (match_operand:SI 1 "general_operand" "0")
- (match_operand:SI 2 "general_operand" "dmsK")))
- (set (match_operand:SI 3 "general_operand" "=d")
- (mod:SI (match_dup 1) (match_dup 2)))])
- @dots{}]
- @dots{})
-@end smallexample
-
-@node Expander Definitions
-@section Defining RTL Sequences for Code Generation
-@cindex expander definitions
-@cindex code generation RTL sequences
-@cindex defining RTL sequences for code generation
-
-On some target machines, some standard pattern names for RTL generation
-cannot be handled with single insn, but a sequence of RTL insns can
-represent them. For these target machines, you can write a
-@code{define_expand} to specify how to generate the sequence of RTL.
-
-@findex define_expand
-A @code{define_expand} is an RTL expression that looks almost like a
-@code{define_insn}; but, unlike the latter, a @code{define_expand} is used
-only for RTL generation and it can produce more than one RTL insn.
-
-A @code{define_expand} RTX has four operands:
-
-@itemize @bullet
-@item
-The name. Each @code{define_expand} must have a name, since the only
-use for it is to refer to it by name.
-
-@findex define_peephole
-@item
-The RTL template. This is just like the RTL template for a
-@code{define_peephole} in that it is a vector of RTL expressions
-each being one insn.
-
-@item
-The condition, a string containing a C expression. This expression is
-used to express how the availability of this pattern depends on
-subclasses of target machine, selected by command-line options when GNU
-CC is run. This is just like the condition of a @code{define_insn} that
-has a standard name. Therefore, the condition (if present) may not
-depend on the data in the insn being matched, but only the
-target-machine-type flags. The compiler needs to test these conditions
-during initialization in order to learn exactly which named instructions
-are available in a particular run.
-
-@item
-The preparation statements, a string containing zero or more C
-statements which are to be executed before RTL code is generated from
-the RTL template.
-
-Usually these statements prepare temporary registers for use as
-internal operands in the RTL template, but they can also generate RTL
-insns directly by calling routines such as @code{emit_insn}, etc.
-Any such insns precede the ones that come from the RTL template.
-@end itemize
-
-Every RTL insn emitted by a @code{define_expand} must match some
-@code{define_insn} in the machine description. Otherwise, the compiler
-will crash when trying to generate code for the insn or trying to optimize
-it.
-
-The RTL template, in addition to controlling generation of RTL insns,
-also describes the operands that need to be specified when this pattern
-is used. In particular, it gives a predicate for each operand.
-
-A true operand, which needs to be specified in order to generate RTL from
-the pattern, should be described with a @code{match_operand} in its first
-occurrence in the RTL template. This enters information on the operand's
-predicate into the tables that record such things. GNU CC uses the
-information to preload the operand into a register if that is required for
-valid RTL code. If the operand is referred to more than once, subsequent
-references should use @code{match_dup}.
-
-The RTL template may also refer to internal ``operands'' which are
-temporary registers or labels used only within the sequence made by the
-@code{define_expand}. Internal operands are substituted into the RTL
-template with @code{match_dup}, never with @code{match_operand}. The
-values of the internal operands are not passed in as arguments by the
-compiler when it requests use of this pattern. Instead, they are computed
-within the pattern, in the preparation statements. These statements
-compute the values and store them into the appropriate elements of
-@code{operands} so that @code{match_dup} can find them.
-
-There are two special macros defined for use in the preparation statements:
-@code{DONE} and @code{FAIL}. Use them with a following semicolon,
-as a statement.
-
-@table @code
-
-@findex DONE
-@item DONE
-Use the @code{DONE} macro to end RTL generation for the pattern. The
-only RTL insns resulting from the pattern on this occasion will be
-those already emitted by explicit calls to @code{emit_insn} within the
-preparation statements; the RTL template will not be generated.
-
-@findex FAIL
-@item FAIL
-Make the pattern fail on this occasion. When a pattern fails, it means
-that the pattern was not truly available. The calling routines in the
-compiler will try other strategies for code generation using other patterns.
-
-Failure is currently supported only for binary (addition, multiplication,
-shifting, etc.) and bitfield (@code{extv}, @code{extzv}, and @code{insv})
-operations.
-@end table
-
-Here is an example, the definition of left-shift for the SPUR chip:
-
-@smallexample
-@group
-(define_expand "ashlsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (ashift:SI
-@end group
-@group
- (match_operand:SI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))]
- ""
- "
-@end group
-@end smallexample
-
-@smallexample
-@group
-@{
- if (GET_CODE (operands[2]) != CONST_INT
- || (unsigned) INTVAL (operands[2]) > 3)
- FAIL;
-@}")
-@end group
-@end smallexample
-
-@noindent
-This example uses @code{define_expand} so that it can generate an RTL insn
-for shifting when the shift-count is in the supported range of 0 to 3 but
-fail in other cases where machine insns aren't available. When it fails,
-the compiler tries another strategy using different patterns (such as, a
-library call).
-
-If the compiler were able to handle nontrivial condition-strings in
-patterns with names, then it would be possible to use a
-@code{define_insn} in that case. Here is another case (zero-extension
-on the 68000) which makes more use of the power of @code{define_expand}:
-
-@smallexample
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "general_operand" "")
- (const_int 0))
- (set (strict_low_part
- (subreg:HI
- (match_dup 0)
- 0))
- (match_operand:HI 1 "general_operand" ""))]
- ""
- "operands[1] = make_safe_from (operands[1], operands[0]);")
-@end smallexample
-
-@noindent
-@findex make_safe_from
-Here two RTL insns are generated, one to clear the entire output operand
-and the other to copy the input operand into its low half. This sequence
-is incorrect if the input operand refers to [the old value of] the output
-operand, so the preparation statement makes sure this isn't so. The
-function @code{make_safe_from} copies the @code{operands[1]} into a
-temporary register if it refers to @code{operands[0]}. It does this
-by emitting another RTL insn.
-
-Finally, a third example shows the use of an internal operand.
-Zero-extension on the SPUR chip is done by @code{and}-ing the result
-against a halfword mask. But this mask cannot be represented by a
-@code{const_int} because the constant value is too large to be legitimate
-on this machine. So it must be copied into a register with
-@code{force_reg} and then the register used in the @code{and}.
-
-@smallexample
-(define_expand "zero_extendhisi2"
- [(set (match_operand:SI 0 "register_operand" "")
- (and:SI (subreg:SI
- (match_operand:HI 1 "register_operand" "")
- 0)
- (match_dup 2)))]
- ""
- "operands[2]
- = force_reg (SImode, gen_rtx (CONST_INT,
- VOIDmode, 65535)); ")
-@end smallexample
-
-@strong{Note:} If the @code{define_expand} is used to serve a
-standard binary or unary arithmetic operation or a bitfield operation,
-then the last insn it generates must not be a @code{code_label},
-@code{barrier} or @code{note}. It must be an @code{insn},
-@code{jump_insn} or @code{call_insn}. If you don't need a real insn
-at the end, emit an insn to copy the result of the operation into
-itself. Such an insn will generate no code, but it can avoid problems
-in the compiler.@refill
-
-@node Insn Splitting
-@section Defining How to Split Instructions
-@cindex insn splitting
-@cindex instruction splitting
-@cindex splitting instructions
-
-There are two cases where you should specify how to split a pattern into
-multiple insns. On machines that have instructions requiring delay
-slots (@pxref{Delay Slots}) or that have instructions whose output is
-not available for multiple cycles (@pxref{Function Units}), the compiler
-phases that optimize these cases need to be able to move insns into
-one-instruction delay slots. However, some insns may generate more than one
-machine instruction. These insns cannot be placed into a delay slot.
-
-Often you can rewrite the single insn as a list of individual insns,
-each corresponding to one machine instruction. The disadvantage of
-doing so is that it will cause the compilation to be slower and require
-more space. If the resulting insns are too complex, it may also
-suppress some optimizations. The compiler splits the insn if there is a
-reason to believe that it might improve instruction or delay slot
-scheduling.
-
-The insn combiner phase also splits putative insns. If three insns are
-merged into one insn with a complex expression that cannot be matched by
-some @code{define_insn} pattern, the combiner phase attempts to split
-the complex pattern into two insns that are recognized. Usually it can
-break the complex pattern into two patterns by splitting out some
-subexpression. However, in some other cases, such as performing an
-addition of a large constant in two insns on a RISC machine, the way to
-split the addition into two insns is machine-dependent.
-
-@cindex define_split
-The @code{define_split} definition tells the compiler how to split a
-complex insn into several simpler insns. It looks like this:
-
-@smallexample
-(define_split
- [@var{insn-pattern}]
- "@var{condition}"
- [@var{new-insn-pattern-1}
- @var{new-insn-pattern-2}
- @dots{}]
- "@var{preparation statements}")
-@end smallexample
-
-@var{insn-pattern} is a pattern that needs to be split and
-@var{condition} is the final condition to be tested, as in a
-@code{define_insn}. When an insn matching @var{insn-pattern} and
-satisfying @var{condition} is found, it is replaced in the insn list
-with the insns given by @var{new-insn-pattern-1},
-@var{new-insn-pattern-2}, etc.
-
-The @var{preparation statements} are similar to those statements that
-are specified for @code{define_expand} (@pxref{Expander Definitions})
-and are executed before the new RTL is generated to prepare for the
-generated code or emit some insns whose pattern is not fixed. Unlike
-those in @code{define_expand}, however, these statements must not
-generate any new pseudo-registers. Once reload has completed, they also
-must not allocate any space in the stack frame.
-
-Patterns are matched against @var{insn-pattern} in two different
-circumstances. If an insn needs to be split for delay slot scheduling
-or insn scheduling, the insn is already known to be valid, which means
-that it must have been matched by some @code{define_insn} and, if
-@code{reload_completed} is non-zero, is known to satisfy the constraints
-of that @code{define_insn}. In that case, the new insn patterns must
-also be insns that are matched by some @code{define_insn} and, if
-@code{reload_completed} is non-zero, must also satisfy the constraints
-of those definitions.
-
-As an example of this usage of @code{define_split}, consider the following
-example from @file{a29k.md}, which splits a @code{sign_extend} from
-@code{HImode} to @code{SImode} into a pair of shift insns:
-
-@smallexample
-(define_split
- [(set (match_operand:SI 0 "gen_reg_operand" "")
- (sign_extend:SI (match_operand:HI 1 "gen_reg_operand" "")))]
- ""
- [(set (match_dup 0)
- (ashift:SI (match_dup 1)
- (const_int 16)))
- (set (match_dup 0)
- (ashiftrt:SI (match_dup 0)
- (const_int 16)))]
- "
-@{ operands[1] = gen_lowpart (SImode, operands[1]); @}")
-@end smallexample
-
-When the combiner phase tries to split an insn pattern, it is always the
-case that the pattern is @emph{not} matched by any @code{define_insn}.
-The combiner pass first tries to split a single @code{set} expression
-and then the same @code{set} expression inside a @code{parallel}, but
-followed by a @code{clobber} of a pseudo-reg to use as a scratch
-register. In these cases, the combiner expects exactly two new insn
-patterns to be generated. It will verify that these patterns match some
-@code{define_insn} definitions, so you need not do this test in the
-@code{define_split} (of course, there is no point in writing a
-@code{define_split} that will never produce insns that match).
-
-Here is an example of this use of @code{define_split}, taken from
-@file{rs6000.md}:
-
-@smallexample
-(define_split
- [(set (match_operand:SI 0 "gen_reg_operand" "")
- (plus:SI (match_operand:SI 1 "gen_reg_operand" "")
- (match_operand:SI 2 "non_add_cint_operand" "")))]
- ""
- [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
- (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
-"
-@{
- int low = INTVAL (operands[2]) & 0xffff;
- int high = (unsigned) INTVAL (operands[2]) >> 16;
-
- if (low & 0x8000)
- high++, low |= 0xffff0000;
-
- operands[3] = gen_rtx (CONST_INT, VOIDmode, high << 16);
- operands[4] = gen_rtx (CONST_INT, VOIDmode, low);
-@}")
-@end smallexample
-
-Here the predicate @code{non_add_cint_operand} matches any
-@code{const_int} that is @emph{not} a valid operand of a single add
-insn. The add with the smaller displacement is written so that it
-can be substituted into the address of a subsequent operation.
-
-An example that uses a scratch register, from the same file, generates
-an equality comparison of a register and a large constant:
-
-@smallexample
-(define_split
- [(set (match_operand:CC 0 "cc_reg_operand" "")
- (compare:CC (match_operand:SI 1 "gen_reg_operand" "")
- (match_operand:SI 2 "non_short_cint_operand" "")))
- (clobber (match_operand:SI 3 "gen_reg_operand" ""))]
- "find_single_use (operands[0], insn, 0)
- && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
- || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
- [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
- (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
- "
-@{
- /* Get the constant we are comparing against, C, and see what it
- looks like sign-extended to 16 bits. Then see what constant
- could be XOR'ed with C to get the sign-extended value. */
-
- int c = INTVAL (operands[2]);
- int sextc = (c << 16) >> 16;
- int xorv = c ^ sextc;
-
- operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
- operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
-@}")
-@end smallexample
-
-To avoid confusion, don't write a single @code{define_split} that
-accepts some insns that match some @code{define_insn} as well as some
-insns that don't. Instead, write two separate @code{define_split}
-definitions, one for the insns that are valid and one for the insns that
-are not valid.
-
-@node Insn Attributes
-@section Instruction Attributes
-@cindex insn attributes
-@cindex instruction attributes
-
-In addition to describing the instruction supported by the target machine,
-the @file{md} file also defines a group of @dfn{attributes} and a set of
-values for each. Every generated insn is assigned a value for each attribute.
-One possible attribute would be the effect that the insn has on the machine's
-condition code. This attribute can then be used by @code{NOTICE_UPDATE_CC}
-to track the condition codes.
-
-@menu
-* Defining Attributes:: Specifying attributes and their values.
-* Expressions:: Valid expressions for attribute values.
-* Tagging Insns:: Assigning attribute values to insns.
-* Attr Example:: An example of assigning attributes.
-* Insn Lengths:: Computing the length of insns.
-* Constant Attributes:: Defining attributes that are constant.
-* Delay Slots:: Defining delay slots required for a machine.
-* Function Units:: Specifying information for insn scheduling.
-@end menu
-
-@node Defining Attributes
-@subsection Defining Attributes and their Values
-@cindex defining attributes and their values
-@cindex attributes, defining
-
-@findex define_attr
-The @code{define_attr} expression is used to define each attribute required
-by the target machine. It looks like:
-
-@smallexample
-(define_attr @var{name} @var{list-of-values} @var{default})
-@end smallexample
-
-@var{name} is a string specifying the name of the attribute being defined.
-
-@var{list-of-values} is either a string that specifies a comma-separated
-list of values that can be assigned to the attribute, or a null string to
-indicate that the attribute takes numeric values.
-
-@var{default} is an attribute expression that gives the value of this
-attribute for insns that match patterns whose definition does not include
-an explicit value for this attribute. @xref{Attr Example}, for more
-information on the handling of defaults. @xref{Constant Attributes},
-for information on attributes that do not depend on any particular insn.
-
-@findex insn-attr.h
-For each defined attribute, a number of definitions are written to the
-@file{insn-attr.h} file. For cases where an explicit set of values is
-specified for an attribute, the following are defined:
-
-@itemize @bullet
-@item
-A @samp{#define} is written for the symbol @samp{HAVE_ATTR_@var{name}}.
-
-@item
-An enumeral class is defined for @samp{attr_@var{name}} with
-elements of the form @samp{@var{upper-name}_@var{upper-value}} where
-the attribute name and value are first converted to upper case.
-
-@item
-A function @samp{get_attr_@var{name}} is defined that is passed an insn and
-returns the attribute value for that insn.
-@end itemize
-
-For example, if the following is present in the @file{md} file:
-
-@smallexample
-(define_attr "type" "branch,fp,load,store,arith" @dots{})
-@end smallexample
-
-@noindent
-the following lines will be written to the file @file{insn-attr.h}.
-
-@smallexample
-#define HAVE_ATTR_type
-enum attr_type @{TYPE_BRANCH, TYPE_FP, TYPE_LOAD,
- TYPE_STORE, TYPE_ARITH@};
-extern enum attr_type get_attr_type ();
-@end smallexample
-
-If the attribute takes numeric values, no @code{enum} type will be
-defined and the function to obtain the attribute's value will return
-@code{int}.
-
-@node Expressions
-@subsection Attribute Expressions
-@cindex attribute expressions
-
-RTL expressions used to define attributes use the codes described above
-plus a few specific to attribute definitions, to be discussed below.
-Attribute value expressions must have one of the following forms:
-
-@table @code
-@cindex @code{const_int} and attributes
-@item (const_int @var{i})
-The integer @var{i} specifies the value of a numeric attribute. @var{i}
-must be non-negative.
-
-The value of a numeric attribute can be specified either with a
-@code{const_int} or as an integer represented as a string in
-@code{const_string}, @code{eq_attr} (see below), and @code{set_attr}
-(@pxref{Tagging Insns}) expressions.
-
-@cindex @code{const_string} and attributes
-@item (const_string @var{value})
-The string @var{value} specifies a constant attribute value.
-If @var{value} is specified as @samp{"*"}, it means that the default value of
-the attribute is to be used for the insn containing this expression.
-@samp{"*"} obviously cannot be used in the @var{default} expression
-of a @code{define_attr}.@refill
-
-If the attribute whose value is being specified is numeric, @var{value}
-must be a string containing a non-negative integer (normally
-@code{const_int} would be used in this case). Otherwise, it must
-contain one of the valid values for the attribute.
-
-@cindex @code{if_then_else} and attributes
-@item (if_then_else @var{test} @var{true-value} @var{false-value})
-@var{test} specifies an attribute test, whose format is defined below.
-The value of this expression is @var{true-value} if @var{test} is true,
-otherwise it is @var{false-value}.
-
-@cindex @code{cond} and attributes
-@item (cond [@var{test1} @var{value1} @dots{}] @var{default})
-The first operand of this expression is a vector containing an even
-number of expressions and consisting of pairs of @var{test} and @var{value}
-expressions. The value of the @code{cond} expression is that of the
-@var{value} corresponding to the first true @var{test} expression. If
-none of the @var{test} expressions are true, the value of the @code{cond}
-expression is that of the @var{default} expression.
-@end table
-
-@var{test} expressions can have one of the following forms:
-
-@table @code
-@cindex @code{const_int} and attribute tests
-@item (const_int @var{i})
-This test is true if @var{i} is non-zero and false otherwise.
-
-@cindex @code{not} and attributes
-@cindex @code{ior} and attributes
-@cindex @code{and} and attributes
-@item (not @var{test})
-@itemx (ior @var{test1} @var{test2})
-@itemx (and @var{test1} @var{test2})
-These tests are true if the indicated logical function is true.
-
-@cindex @code{match_operand} and attributes
-@item (match_operand:@var{m} @var{n} @var{pred} @var{constraints})
-This test is true if operand @var{n} of the insn whose attribute value
-is being determined has mode @var{m} (this part of the test is ignored
-if @var{m} is @code{VOIDmode}) and the function specified by the string
-@var{pred} returns a non-zero value when passed operand @var{n} and mode
-@var{m} (this part of the test is ignored if @var{pred} is the null
-string).
-
-The @var{constraints} operand is ignored and should be the null string.
-
-@cindex @code{le} and attributes
-@cindex @code{leu} and attributes
-@cindex @code{lt} and attributes
-@cindex @code{gt} and attributes
-@cindex @code{gtu} and attributes
-@cindex @code{ge} and attributes
-@cindex @code{geu} and attributes
-@cindex @code{ne} and attributes
-@cindex @code{eq} and attributes
-@cindex @code{plus} and attributes
-@cindex @code{minus} and attributes
-@cindex @code{mult} and attributes
-@cindex @code{div} and attributes
-@cindex @code{mod} and attributes
-@cindex @code{abs} and attributes
-@cindex @code{neg} and attributes
-@cindex @code{ashift} and attributes
-@cindex @code{lshiftrt} and attributes
-@cindex @code{ashiftrt} and attributes
-@item (le @var{arith1} @var{arith2})
-@itemx (leu @var{arith1} @var{arith2})
-@itemx (lt @var{arith1} @var{arith2})
-@itemx (ltu @var{arith1} @var{arith2})
-@itemx (gt @var{arith1} @var{arith2})
-@itemx (gtu @var{arith1} @var{arith2})
-@itemx (ge @var{arith1} @var{arith2})
-@itemx (geu @var{arith1} @var{arith2})
-@itemx (ne @var{arith1} @var{arith2})
-@itemx (eq @var{arith1} @var{arith2})
-These tests are true if the indicated comparison of the two arithmetic
-expressions is true. Arithmetic expressions are formed with
-@code{plus}, @code{minus}, @code{mult}, @code{div}, @code{mod},
-@code{abs}, @code{neg}, @code{and}, @code{ior}, @code{xor}, @code{not},
-@code{ashift}, @code{lshiftrt}, and @code{ashiftrt} expressions.@refill
-
-@findex get_attr
-@code{const_int} and @code{symbol_ref} are always valid terms (@pxref{Insn
-Lengths},for additional forms). @code{symbol_ref} is a string
-denoting a C expression that yields an @code{int} when evaluated by the
-@samp{get_attr_@dots{}} routine. It should normally be a global
-variable.@refill
-
-@findex eq_attr
-@item (eq_attr @var{name} @var{value})
-@var{name} is a string specifying the name of an attribute.
-
-@var{value} is a string that is either a valid value for attribute
-@var{name}, a comma-separated list of values, or @samp{!} followed by a
-value or list. If @var{value} does not begin with a @samp{!}, this
-test is true if the value of the @var{name} attribute of the current
-insn is in the list specified by @var{value}. If @var{value} begins
-with a @samp{!}, this test is true if the attribute's value is
-@emph{not} in the specified list.
-
-For example,
-
-@smallexample
-(eq_attr "type" "load,store")
-@end smallexample
-
-@noindent
-is equivalent to
-
-@smallexample
-(ior (eq_attr "type" "load") (eq_attr "type" "store"))
-@end smallexample
-
-If @var{name} specifies an attribute of @samp{alternative}, it refers to the
-value of the compiler variable @code{which_alternative}
-(@pxref{Output Statement}) and the values must be small integers. For
-example,@refill
-
-@smallexample
-(eq_attr "alternative" "2,3")
-@end smallexample
-
-@noindent
-is equivalent to
-
-@smallexample
-(ior (eq (symbol_ref "which_alternative") (const_int 2))
- (eq (symbol_ref "which_alternative") (const_int 3)))
-@end smallexample
-
-Note that, for most attributes, an @code{eq_attr} test is simplified in cases
-where the value of the attribute being tested is known for all insns matching
-a particular pattern. This is by far the most common case.@refill
-
-@findex attr_flag
-@item (attr_flag @var{name})
-The value of an @code{attr_flag} expression is true if the flag
-specified by @var{name} is true for the @code{insn} currently being
-scheduled.
-
-@var{name} is a string specifying one of a fixed set of flags to test.
-Test the flags @code{forward} and @code{backward} to determine the
-direction of a conditional branch. Test the flags @code{very_likely},
-@code{likely}, @code{very_unlikely}, and @code{unlikely} to determine
-if a conditional branch is expected to be taken.
-
-If the @code{very_likely} flag is true, then the @code{likely} flag is also
-true. Likewise for the @code{very_unlikely} and @code{unlikely} flags.
-
-This example describes a conditional branch delay slot which
-can be nullified for forward branches that are taken (annul-true) or
-for backward branches which are not taken (annul-false).
-
-@smallexample
-(define_delay (eq_attr "type" "cbranch")
- [(eq_attr "in_branch_delay" "true")
- (and (eq_attr "in_branch_delay" "true")
- (attr_flag "forward"))
- (and (eq_attr "in_branch_delay" "true")
- (attr_flag "backward"))])
-@end smallexample
-
-The @code{forward} and @code{backward} flags are false if the current
-@code{insn} being scheduled is not a conditional branch.
-
-The @code{very_likely} and @code{likely} flags are true if the
-@code{insn} being scheduled is not a conditional branch.
-The @code{very_unlikely} and @code{unlikely} flags are false if the
-@code{insn} being scheduled is not a conditional branch.
-
-@code{attr_flag} is only used during delay slot scheduling and has no
-meaning to other passes of the compiler.
-@end table
-
-@node Tagging Insns
-@subsection Assigning Attribute Values to Insns
-@cindex tagging insns
-@cindex assigning attribute values to insns
-
-The value assigned to an attribute of an insn is primarily determined by
-which pattern is matched by that insn (or which @code{define_peephole}
-generated it). Every @code{define_insn} and @code{define_peephole} can
-have an optional last argument to specify the values of attributes for
-matching insns. The value of any attribute not specified in a particular
-insn is set to the default value for that attribute, as specified in its
-@code{define_attr}. Extensive use of default values for attributes
-permits the specification of the values for only one or two attributes
-in the definition of most insn patterns, as seen in the example in the
-next section.@refill
-
-The optional last argument of @code{define_insn} and
-@code{define_peephole} is a vector of expressions, each of which defines
-the value for a single attribute. The most general way of assigning an
-attribute's value is to use a @code{set} expression whose first operand is an
-@code{attr} expression giving the name of the attribute being set. The
-second operand of the @code{set} is an attribute expression
-(@pxref{Expressions}) giving the value of the attribute.@refill
-
-When the attribute value depends on the @samp{alternative} attribute
-(i.e., which is the applicable alternative in the constraint of the
-insn), the @code{set_attr_alternative} expression can be used. It
-allows the specification of a vector of attribute expressions, one for
-each alternative.
-
-@findex set_attr
-When the generality of arbitrary attribute expressions is not required,
-the simpler @code{set_attr} expression can be used, which allows
-specifying a string giving either a single attribute value or a list
-of attribute values, one for each alternative.
-
-The form of each of the above specifications is shown below. In each case,
-@var{name} is a string specifying the attribute to be set.
-
-@table @code
-@item (set_attr @var{name} @var{value-string})
-@var{value-string} is either a string giving the desired attribute value,
-or a string containing a comma-separated list giving the values for
-succeeding alternatives. The number of elements must match the number
-of alternatives in the constraint of the insn pattern.
-
-Note that it may be useful to specify @samp{*} for some alternative, in
-which case the attribute will assume its default value for insns matching
-that alternative.
-
-@findex set_attr_alternative
-@item (set_attr_alternative @var{name} [@var{value1} @var{value2} @dots{}])
-Depending on the alternative of the insn, the value will be one of the
-specified values. This is a shorthand for using a @code{cond} with
-tests on the @samp{alternative} attribute.
-
-@findex attr
-@item (set (attr @var{name}) @var{value})
-The first operand of this @code{set} must be the special RTL expression
-@code{attr}, whose sole operand is a string giving the name of the
-attribute being set. @var{value} is the value of the attribute.
-@end table
-
-The following shows three different ways of representing the same
-attribute value specification:
-
-@smallexample
-(set_attr "type" "load,store,arith")
-
-(set_attr_alternative "type"
- [(const_string "load") (const_string "store")
- (const_string "arith")])
-
-(set (attr "type")
- (cond [(eq_attr "alternative" "1") (const_string "load")
- (eq_attr "alternative" "2") (const_string "store")]
- (const_string "arith")))
-@end smallexample
-
-@need 1000
-@findex define_asm_attributes
-The @code{define_asm_attributes} expression provides a mechanism to
-specify the attributes assigned to insns produced from an @code{asm}
-statement. It has the form:
-
-@smallexample
-(define_asm_attributes [@var{attr-sets}])
-@end smallexample
-
-@noindent
-where @var{attr-sets} is specified the same as for both the
-@code{define_insn} and the @code{define_peephole} expressions.
-
-These values will typically be the ``worst case'' attribute values. For
-example, they might indicate that the condition code will be clobbered.
-
-A specification for a @code{length} attribute is handled specially. The
-way to compute the length of an @code{asm} insn is to multiply the
-length specified in the expression @code{define_asm_attributes} by the
-number of machine instructions specified in the @code{asm} statement,
-determined by counting the number of semicolons and newlines in the
-string. Therefore, the value of the @code{length} attribute specified
-in a @code{define_asm_attributes} should be the maximum possible length
-of a single machine instruction.
-
-@node Attr Example
-@subsection Example of Attribute Specifications
-@cindex attribute specifications example
-@cindex attribute specifications
-
-The judicious use of defaulting is important in the efficient use of
-insn attributes. Typically, insns are divided into @dfn{types} and an
-attribute, customarily called @code{type}, is used to represent this
-value. This attribute is normally used only to define the default value
-for other attributes. An example will clarify this usage.
-
-Assume we have a RISC machine with a condition code and in which only
-full-word operations are performed in registers. Let us assume that we
-can divide all insns into loads, stores, (integer) arithmetic
-operations, floating point operations, and branches.
-
-Here we will concern ourselves with determining the effect of an insn on
-the condition code and will limit ourselves to the following possible
-effects: The condition code can be set unpredictably (clobbered), not
-be changed, be set to agree with the results of the operation, or only
-changed if the item previously set into the condition code has been
-modified.
-
-Here is part of a sample @file{md} file for such a machine:
-
-@smallexample
-(define_attr "type" "load,store,arith,fp,branch" (const_string "arith"))
-
-(define_attr "cc" "clobber,unchanged,set,change0"
- (cond [(eq_attr "type" "load")
- (const_string "change0")
- (eq_attr "type" "store,branch")
- (const_string "unchanged")
- (eq_attr "type" "arith")
- (if_then_else (match_operand:SI 0 "" "")
- (const_string "set")
- (const_string "clobber"))]
- (const_string "clobber")))
-
-(define_insn ""
- [(set (match_operand:SI 0 "general_operand" "=r,r,m")
- (match_operand:SI 1 "general_operand" "r,m,r"))]
- ""
- "@@
- move %0,%1
- load %0,%1
- store %0,%1"
- [(set_attr "type" "arith,load,store")])
-@end smallexample
-
-Note that we assume in the above example that arithmetic operations
-performed on quantities smaller than a machine word clobber the condition
-code since they will set the condition code to a value corresponding to the
-full-word result.
-
-@node Insn Lengths
-@subsection Computing the Length of an Insn
-@cindex insn lengths, computing
-@cindex computing the length of an insn
-
-For many machines, multiple types of branch instructions are provided, each
-for different length branch displacements. In most cases, the assembler
-will choose the correct instruction to use. However, when the assembler
-cannot do so, GCC can when a special attribute, the @samp{length}
-attribute, is defined. This attribute must be defined to have numeric
-values by specifying a null string in its @code{define_attr}.
-
-In the case of the @samp{length} attribute, two additional forms of
-arithmetic terms are allowed in test expressions:
-
-@table @code
-@cindex @code{match_dup} and attributes
-@item (match_dup @var{n})
-This refers to the address of operand @var{n} of the current insn, which
-must be a @code{label_ref}.
-
-@cindex @code{pc} and attributes
-@item (pc)
-This refers to the address of the @emph{current} insn. It might have
-been more consistent with other usage to make this the address of the
-@emph{next} insn but this would be confusing because the length of the
-current insn is to be computed.
-@end table
-
-@cindex @code{addr_vec}, length of
-@cindex @code{addr_diff_vec}, length of
-For normal insns, the length will be determined by value of the
-@samp{length} attribute. In the case of @code{addr_vec} and
-@code{addr_diff_vec} insn patterns, the length is computed as
-the number of vectors multiplied by the size of each vector.
-
-Lengths are measured in addressable storage units (bytes).
-
-The following macros can be used to refine the length computation:
-
-@table @code
-@findex FIRST_INSN_ADDRESS
-@item FIRST_INSN_ADDRESS
-When the @code{length} insn attribute is used, this macro specifies the
-value to be assigned to the address of the first insn in a function. If
-not specified, 0 is used.
-
-@findex ADJUST_INSN_LENGTH
-@item ADJUST_INSN_LENGTH (@var{insn}, @var{length})
-If defined, modifies the length assigned to instruction @var{insn} as a
-function of the context in which it is used. @var{length} is an lvalue
-that contains the initially computed length of the insn and should be
-updated with the correct length of the insn. If updating is required,
-@var{insn} must not be a varying-length insn.
-
-This macro will normally not be required. A case in which it is
-required is the ROMP. On this machine, the size of an @code{addr_vec}
-insn must be increased by two to compensate for the fact that alignment
-may be required.
-@end table
-
-@findex get_attr_length
-The routine that returns @code{get_attr_length} (the value of the
-@code{length} attribute) can be used by the output routine to
-determine the form of the branch instruction to be written, as the
-example below illustrates.
-
-As an example of the specification of variable-length branches, consider
-the IBM 360. If we adopt the convention that a register will be set to
-the starting address of a function, we can jump to labels within 4k of
-the start using a four-byte instruction. Otherwise, we need a six-byte
-sequence to load the address from memory and then branch to it.
-
-On such a machine, a pattern for a branch instruction might be specified
-as follows:
-
-@smallexample
-(define_insn "jump"
- [(set (pc)
- (label_ref (match_operand 0 "" "")))]
- ""
- "*
-@{
- return (get_attr_length (insn) == 4
- ? \"b %l0\" : \"l r15,=a(%l0); br r15\");
-@}"
- [(set (attr "length") (if_then_else (lt (match_dup 0) (const_int 4096))
- (const_int 4)
- (const_int 6)))])
-@end smallexample
-
-@node Constant Attributes
-@subsection Constant Attributes
-@cindex constant attributes
-
-A special form of @code{define_attr}, where the expression for the
-default value is a @code{const} expression, indicates an attribute that
-is constant for a given run of the compiler. Constant attributes may be
-used to specify which variety of processor is used. For example,
-
-@smallexample
-(define_attr "cpu" "m88100,m88110,m88000"
- (const
- (cond [(symbol_ref "TARGET_88100") (const_string "m88100")
- (symbol_ref "TARGET_88110") (const_string "m88110")]
- (const_string "m88000"))))
-
-(define_attr "memory" "fast,slow"
- (const
- (if_then_else (symbol_ref "TARGET_FAST_MEM")
- (const_string "fast")
- (const_string "slow"))))
-@end smallexample
-
-The routine generated for constant attributes has no parameters as it
-does not depend on any particular insn. RTL expressions used to define
-the value of a constant attribute may use the @code{symbol_ref} form,
-but may not use either the @code{match_operand} form or @code{eq_attr}
-forms involving insn attributes.
-
-@node Delay Slots
-@subsection Delay Slot Scheduling
-@cindex delay slots, defining
-
-The insn attribute mechanism can be used to specify the requirements for
-delay slots, if any, on a target machine. An instruction is said to
-require a @dfn{delay slot} if some instructions that are physically
-after the instruction are executed as if they were located before it.
-Classic examples are branch and call instructions, which often execute
-the following instruction before the branch or call is performed.
-
-On some machines, conditional branch instructions can optionally
-@dfn{annul} instructions in the delay slot. This means that the
-instruction will not be executed for certain branch outcomes. Both
-instructions that annul if the branch is true and instructions that
-annul if the branch is false are supported.
-
-Delay slot scheduling differs from instruction scheduling in that
-determining whether an instruction needs a delay slot is dependent only
-on the type of instruction being generated, not on data flow between the
-instructions. See the next section for a discussion of data-dependent
-instruction scheduling.
-
-@findex define_delay
-The requirement of an insn needing one or more delay slots is indicated
-via the @code{define_delay} expression. It has the following form:
-
-@smallexample
-(define_delay @var{test}
- [@var{delay-1} @var{annul-true-1} @var{annul-false-1}
- @var{delay-2} @var{annul-true-2} @var{annul-false-2}
- @dots{}])
-@end smallexample
-
-@var{test} is an attribute test that indicates whether this
-@code{define_delay} applies to a particular insn. If so, the number of
-required delay slots is determined by the length of the vector specified
-as the second argument. An insn placed in delay slot @var{n} must
-satisfy attribute test @var{delay-n}. @var{annul-true-n} is an
-attribute test that specifies which insns may be annulled if the branch
-is true. Similarly, @var{annul-false-n} specifies which insns in the
-delay slot may be annulled if the branch is false. If annulling is not
-supported for that delay slot, @code{(nil)} should be coded.@refill
-
-For example, in the common case where branch and call insns require
-a single delay slot, which may contain any insn other than a branch or
-call, the following would be placed in the @file{md} file:
-
-@smallexample
-(define_delay (eq_attr "type" "branch,call")
- [(eq_attr "type" "!branch,call") (nil) (nil)])
-@end smallexample
-
-Multiple @code{define_delay} expressions may be specified. In this
-case, each such expression specifies different delay slot requirements
-and there must be no insn for which tests in two @code{define_delay}
-expressions are both true.
-
-For example, if we have a machine that requires one delay slot for branches
-but two for calls, no delay slot can contain a branch or call insn,
-and any valid insn in the delay slot for the branch can be annulled if the
-branch is true, we might represent this as follows:
-
-@smallexample
-(define_delay (eq_attr "type" "branch")
- [(eq_attr "type" "!branch,call")
- (eq_attr "type" "!branch,call")
- (nil)])
-
-(define_delay (eq_attr "type" "call")
- [(eq_attr "type" "!branch,call") (nil) (nil)
- (eq_attr "type" "!branch,call") (nil) (nil)])
-@end smallexample
-@c the above is *still* too long. --mew 4feb93
-
-@node Function Units
-@subsection Specifying Function Units
-@cindex function units, for scheduling
-
-On most RISC machines, there are instructions whose results are not
-available for a specific number of cycles. Common cases are instructions
-that load data from memory. On many machines, a pipeline stall will result
-if the data is referenced too soon after the load instruction.
-
-In addition, many newer microprocessors have multiple function units, usually
-one for integer and one for floating point, and often will incur pipeline
-stalls when a result that is needed is not yet ready.
-
-The descriptions in this section allow the specification of how much
-time must elapse between the execution of an instruction and the time
-when its result is used. It also allows specification of when the
-execution of an instruction will delay execution of similar instructions
-due to function unit conflicts.
-
-For the purposes of the specifications in this section, a machine is
-divided into @dfn{function units}, each of which execute a specific
-class of instructions in first-in-first-out order. Function units that
-accept one instruction each cycle and allow a result to be used in the
-succeeding instruction (usually via forwarding) need not be specified.
-Classic RISC microprocessors will normally have a single function unit,
-which we can call @samp{memory}. The newer ``superscalar'' processors
-will often have function units for floating point operations, usually at
-least a floating point adder and multiplier.
-
-@findex define_function_unit
-Each usage of a function units by a class of insns is specified with a
-@code{define_function_unit} expression, which looks like this:
-
-@smallexample
-(define_function_unit @var{name} @var{multiplicity} @var{simultaneity}
- @var{test} @var{ready-delay} @var{issue-delay}
- [@var{conflict-list}])
-@end smallexample
-
-@var{name} is a string giving the name of the function unit.
-
-@var{multiplicity} is an integer specifying the number of identical
-units in the processor. If more than one unit is specified, they will
-be scheduled independently. Only truly independent units should be
-counted; a pipelined unit should be specified as a single unit. (The
-only common example of a machine that has multiple function units for a
-single instruction class that are truly independent and not pipelined
-are the two multiply and two increment units of the CDC 6600.)
-
-@var{simultaneity} specifies the maximum number of insns that can be
-executing in each instance of the function unit simultaneously or zero
-if the unit is pipelined and has no limit.
-
-All @code{define_function_unit} definitions referring to function unit
-@var{name} must have the same name and values for @var{multiplicity} and
-@var{simultaneity}.
-
-@var{test} is an attribute test that selects the insns we are describing
-in this definition. Note that an insn may use more than one function
-unit and a function unit may be specified in more than one
-@code{define_function_unit}.
-
-@var{ready-delay} is an integer that specifies the number of cycles
-after which the result of the instruction can be used without
-introducing any stalls.
-
-@var{issue-delay} is an integer that specifies the number of cycles
-after the instruction matching the @var{test} expression begins using
-this unit until a subsequent instruction can begin. A cost of @var{N}
-indicates an @var{N-1} cycle delay. A subsequent instruction may also
-be delayed if an earlier instruction has a longer @var{ready-delay}
-value. This blocking effect is computed using the @var{simultaneity},
-@var{ready-delay}, @var{issue-delay}, and @var{conflict-list} terms.
-For a normal non-pipelined function unit, @var{simultaneity} is one, the
-unit is taken to block for the @var{ready-delay} cycles of the executing
-insn, and smaller values of @var{issue-delay} are ignored.
-
-@var{conflict-list} is an optional list giving detailed conflict costs
-for this unit. If specified, it is a list of condition test expressions
-to be applied to insns chosen to execute in @var{name} following the
-particular insn matching @var{test} that is already executing in
-@var{name}. For each insn in the list, @var{issue-delay} specifies the
-conflict cost; for insns not in the list, the cost is zero. If not
-specified, @var{conflict-list} defaults to all instructions that use the
-function unit.
-
-Typical uses of this vector are where a floating point function unit can
-pipeline either single- or double-precision operations, but not both, or
-where a memory unit can pipeline loads, but not stores, etc.
-
-As an example, consider a classic RISC machine where the result of a
-load instruction is not available for two cycles (a single ``delay''
-instruction is required) and where only one load instruction can be executed
-simultaneously. This would be specified as:
-
-@smallexample
-(define_function_unit "memory" 1 1 (eq_attr "type" "load") 2 0)
-@end smallexample
-
-For the case of a floating point function unit that can pipeline either
-single or double precision, but not both, the following could be specified:
-
-@smallexample
-(define_function_unit
- "fp" 1 0 (eq_attr "type" "sp_fp") 4 4 [(eq_attr "type" "dp_fp")])
-(define_function_unit
- "fp" 1 0 (eq_attr "type" "dp_fp") 4 4 [(eq_attr "type" "sp_fp")])
-@end smallexample
-
-@strong{Note:} The scheduler attempts to avoid function unit conflicts
-and uses all the specifications in the @code{define_function_unit}
-expression. It has recently come to our attention that these
-specifications may not allow modeling of some of the newer
-``superscalar'' processors that have insns using multiple pipelined
-units. These insns will cause a potential conflict for the second unit
-used during their execution and there is no way of representing that
-conflict. We welcome any examples of how function unit conflicts work
-in such processors and suggestions for their representation.
-@end ifset
diff --git a/gcc/mips-tdump.c b/gcc/mips-tdump.c
deleted file mode 100644
index 6890fc73e22..00000000000
--- a/gcc/mips-tdump.c
+++ /dev/null
@@ -1,1617 +0,0 @@
-/* Read and manage MIPS symbol tables from object modules.
- Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc.
- Contributed by hartzell@boulder.colorado.edu,
- Rewritten by meissner@osf.org.
-
-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 <stdio.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <time.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "config.h"
-
-#ifdef index
-#undef index
-#undef rindex
-#endif
-#ifndef CROSS_COMPILE
-#include <a.out.h>
-#else
-#include "mips/a.out.h"
-#endif /* CROSS_COMPILE */
-
-#ifndef MIPS_IS_STAB
-/* Macros for mips-tfile.c to encapsulate stabs in ECOFF, and for
- and mips-tdump.c to print them out. This is used on the Alpha,
- which does not include mips.h.
-
- These must match the corresponding definitions in gdb/mipsread.c.
- Unfortunately, gcc and gdb do not currently share any directories. */
-
-#define CODE_MASK 0x8F300
-#define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
-#define MIPS_MARK_STAB(code) ((code)+CODE_MASK)
-#define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
-#endif
-
-#ifdef __STDC__
-typedef void *PTR_T;
-typedef const void *CPTR_T;
-#define __proto(x) x
-#else
-
-#if defined(_STDIO_H_) || defined(__STDIO_H__) /* Ultrix 4.0, SGI */
-typedef void *PTR_T;
-typedef void *CPTR_T;
-
-#else
-typedef char *PTR_T; /* Ultrix 3.1 */
-typedef char *CPTR_T;
-#endif
-
-#define __proto(x) ()
-#define const
-#endif
-
-#define uchar unsigned char
-#define ushort unsigned short
-#define uint unsigned int
-#define ulong unsigned long
-
-
-/* Do to size_t being defined in sys/types.h and different
- in stddef.h, we have to do this by hand..... Note, these
- types are correct for MIPS based systems, and may not be
- correct for other systems. */
-
-#define size_t uint
-#define ptrdiff_t int
-
-
-/* Redefinition of of storage classes as an enumeration for better
- debugging. */
-
-#ifndef stStaParam
-#define stStaParam 16 /* Fortran static parameters */
-#endif
-
-#ifndef btVoid
-#define btVoid 26 /* void basic type */
-#endif
-
-typedef enum sc {
- sc_Nil = scNil, /* no storage class */
- sc_Text = scText, /* text symbol */
- sc_Data = scData, /* initialized data symbol */
- sc_Bss = scBss, /* un-initialized data symbol */
- sc_Register = scRegister, /* value of symbol is register number */
- sc_Abs = scAbs, /* value of symbol is absolute */
- sc_Undefined = scUndefined, /* who knows? */
- sc_CdbLocal = scCdbLocal, /* variable's value is IN se->va.?? */
- sc_Bits = scBits, /* this is a bit field */
- sc_CdbSystem = scCdbSystem, /* var's value is IN CDB's address space */
- sc_RegImage = scRegImage, /* register value saved on stack */
- sc_Info = scInfo, /* symbol contains debugger information */
- sc_UserStruct = scUserStruct, /* addr in struct user for current process */
- sc_SData = scSData, /* load time only small data */
- sc_SBss = scSBss, /* load time only small common */
- sc_RData = scRData, /* load time only read only data */
- sc_Var = scVar, /* Var parameter (fortran,pascal) */
- sc_Common = scCommon, /* common variable */
- sc_SCommon = scSCommon, /* small common */
- sc_VarRegister = scVarRegister, /* Var parameter in a register */
- sc_Variant = scVariant, /* Variant record */
- sc_SUndefined = scSUndefined, /* small undefined(external) data */
- sc_Init = scInit, /* .init section symbol */
- sc_Max = scMax /* Max storage class+1 */
-} sc_t;
-
-/* Redefinition of symbol type. */
-
-typedef enum st {
- st_Nil = stNil, /* Nuthin' special */
- st_Global = stGlobal, /* external symbol */
- st_Static = stStatic, /* static */
- st_Param = stParam, /* procedure argument */
- st_Local = stLocal, /* local variable */
- st_Label = stLabel, /* label */
- st_Proc = stProc, /* " " Procedure */
- st_Block = stBlock, /* beginning of block */
- st_End = stEnd, /* end (of anything) */
- st_Member = stMember, /* member (of anything - struct/union/enum */
- st_Typedef = stTypedef, /* type definition */
- st_File = stFile, /* file name */
- st_RegReloc = stRegReloc, /* register relocation */
- st_Forward = stForward, /* forwarding address */
- st_StaticProc = stStaticProc, /* load time only static procs */
- st_StaParam = stStaParam, /* Fortran static parameters */
- st_Constant = stConstant, /* const */
-#ifdef stStruct
- st_Struct = stStruct, /* struct */
- st_Union = stUnion, /* union */
- st_Enum = stEnum, /* enum */
-#endif
- st_Str = stStr, /* string */
- st_Number = stNumber, /* pure number (ie. 4 NOR 2+2) */
- st_Expr = stExpr, /* 2+2 vs. 4 */
- st_Type = stType, /* post-coercion SER */
- st_Max = stMax /* max type+1 */
-} st_t;
-
-/* Redefinition of type qualifiers. */
-
-typedef enum tq {
- tq_Nil = tqNil, /* bt is what you see */
- tq_Ptr = tqPtr, /* pointer */
- tq_Proc = tqProc, /* procedure */
- tq_Array = tqArray, /* duh */
- tq_Far = tqFar, /* longer addressing - 8086/8 land */
- tq_Vol = tqVol, /* volatile */
- tq_Max = tqMax /* Max type qualifier+1 */
-} tq_t;
-
-/* Redefinition of basic types. */
-
-typedef enum bt {
- bt_Nil = btNil, /* undefined */
- bt_Adr = btAdr, /* address - integer same size as pointer */
- bt_Char = btChar, /* character */
- bt_UChar = btUChar, /* unsigned character */
- bt_Short = btShort, /* short */
- bt_UShort = btUShort, /* unsigned short */
- bt_Int = btInt, /* int */
- bt_UInt = btUInt, /* unsigned int */
- bt_Long = btLong, /* long */
- bt_ULong = btULong, /* unsigned long */
- bt_Float = btFloat, /* float (real) */
- bt_Double = btDouble, /* Double (real) */
- bt_Struct = btStruct, /* Structure (Record) */
- bt_Union = btUnion, /* Union (variant) */
- bt_Enum = btEnum, /* Enumerated */
- bt_Typedef = btTypedef, /* defined via a typedef, isymRef points */
- bt_Range = btRange, /* subrange of int */
- bt_Set = btSet, /* pascal sets */
- bt_Complex = btComplex, /* fortran complex */
- bt_DComplex = btDComplex, /* fortran double complex */
- bt_Indirect = btIndirect, /* forward or unnamed typedef */
- bt_FixedDec = btFixedDec, /* Fixed Decimal */
- bt_FloatDec = btFloatDec, /* Float Decimal */
- bt_String = btString, /* Varying Length Character String */
- bt_Bit = btBit, /* Aligned Bit String */
- bt_Picture = btPicture, /* Picture */
- bt_Void = btVoid, /* void */
- bt_Max = btMax /* Max basic type+1 */
-} bt_t;
-
-/* Redefinition of the language codes. */
-
-typedef enum lang {
- lang_C = langC,
- lang_Pascal = langPascal,
- lang_Fortran = langFortran,
- lang_Assembler = langAssembler,
- lang_Machine = langMachine,
- lang_Nil = langNil,
- lang_Ada = langAda,
- lang_Pl1 = langPl1,
- lang_Cobol = langCobol
-} lang_t;
-
-/* Redefinition of the debug level codes. */
-
-typedef enum glevel {
- glevel_0 = GLEVEL_0,
- glevel_1 = GLEVEL_1,
- glevel_2 = GLEVEL_2,
- glevel_3 = GLEVEL_3
-} glevel_t;
-
-
-/* Keep track of the active scopes. */
-typedef struct scope {
- struct scope *prev; /* previous scope */
- ulong open_sym; /* symbol opening scope */
- sc_t sc; /* storage class */
- st_t st; /* symbol type */
-} scope_t;
-
-struct filehdr global_hdr; /* a.out header */
-
-int errors = 0; /* # of errors */
-int want_aux = 0; /* print aux table */
-int want_line = 0; /* print line numbers */
-int want_rfd = 0; /* print relative file desc's */
-int want_scope = 0; /* print scopes for every symbol */
-int tfile = 0; /* no global header file */
-int tfile_fd; /* file descriptor of .T file */
-off_t tfile_offset; /* current offset in .T file */
-scope_t *cur_scope = 0; /* list of active scopes */
-scope_t *free_scope = 0; /* list of freed scopes */
-HDRR sym_hdr; /* symbolic header */
-char *l_strings; /* local strings */
-char *e_strings; /* external strings */
-SYMR *l_symbols; /* local symbols */
-EXTR *e_symbols; /* external symbols */
-LINER *lines; /* line numbers */
-DNR *dense_nums; /* dense numbers */
-OPTR *opt_symbols; /* optimization symbols */
-AUXU *aux_symbols; /* Auxiliary symbols */
-char *aux_used; /* map of which aux syms are used */
-FDR *file_desc; /* file tables */
-ulong *rfile_desc; /* relative file tables */
-PDR *proc_desc; /* procedure tables */
-
-/* Forward reference for functions. */
-PTR_T read_seek __proto((PTR_T, size_t, off_t, const char *));
-void read_tfile __proto((void));
-void print_global_hdr __proto((struct filehdr *));
-void print_sym_hdr __proto((HDRR *));
-void print_file_desc __proto((FDR *, int));
-void print_symbol __proto((SYMR *, int, char *, AUXU *, int, FDR *));
-void print_aux __proto((AUXU, int, int));
-void emit_aggregate __proto((char *, AUXU, AUXU, const char *, FDR *));
-char *st_to_string __proto((st_t));
-char *sc_to_string __proto((sc_t));
-char *glevel_to_string __proto((glevel_t));
-char *lang_to_string __proto((lang_t));
-char *type_to_string __proto((AUXU *, int, FDR *));
-
-#ifndef __alpha
-extern PTR_T malloc __proto((size_t));
-extern PTR_T calloc __proto((size_t, size_t));
-extern PTR_T realloc __proto((PTR_T, size_t));
-extern void free __proto((PTR_T));
-#endif
-
-extern char *optarg;
-extern int optind;
-extern int opterr;
-
-/* Create a table of debugging stab-codes and corresponding names. */
-
-#define __define_stab(NAME, CODE, STRING) {(int)CODE, STRING},
-struct {short code; char string[10];} stab_names[] = {
-#include "stab.def"
-#undef __define_stab
-};
-
-
-/* Read some bytes at a specified location, and return a pointer. */
-
-PTR_T
-read_seek (ptr, size, offset, context)
- PTR_T ptr; /* pointer to buffer or NULL */
- size_t size; /* # bytes to read */
- off_t offset; /* offset to read at */
- const char *context; /* context for error message */
-{
- long read_size = 0;
-
- if (size == 0) /* nothing to read */
- return ptr;
-
- if ((ptr == (PTR_T) 0 && (ptr = malloc (size)) == (PTR_T) 0)
- || (tfile_offset != offset && lseek (tfile_fd, offset, 0) == -1)
- || (read_size = read (tfile_fd, ptr, size)) < 0)
- {
- perror (context);
- exit (1);
- }
-
- if (read_size != size)
- {
- fprintf (stderr, "%s: read %ld bytes, expected %ld bytes\n",
- context, read_size, (long) size);
- exit (1);
- }
-
- tfile_offset = offset + size;
- return ptr;
-}
-
-
-/* Convert language code to string format. */
-
-char *
-lang_to_string (lang)
- lang_t lang;
-{
- switch (lang)
- {
- case langC: return "C";
- case langPascal: return "Pascal";
- case langFortran: return "Fortran";
- case langAssembler: return "Assembler";
- case langMachine: return "Machine";
- case langNil: return "Nil";
- case langAda: return "Ada";
- case langPl1: return "Pl1";
- case langCobol: return "Cobol";
- }
-
- return "Unknown language";
-}
-
-
-/* Convert storage class to string. */
-
-char *
-sc_to_string(storage_class)
- sc_t storage_class;
-{
- switch(storage_class)
- {
- case sc_Nil: return "Nil";
- case sc_Text: return "Text";
- case sc_Data: return "Data";
- case sc_Bss: return "Bss";
- case sc_Register: return "Register";
- case sc_Abs: return "Abs";
- case sc_Undefined: return "Undefined";
- case sc_CdbLocal: return "CdbLocal";
- case sc_Bits: return "Bits";
- case sc_CdbSystem: return "CdbSystem";
- case sc_RegImage: return "RegImage";
- case sc_Info: return "Info";
- case sc_UserStruct: return "UserStruct";
- case sc_SData: return "SData";
- case sc_SBss: return "SBss";
- case sc_RData: return "RData";
- case sc_Var: return "Var";
- case sc_Common: return "Common";
- case sc_SCommon: return "SCommon";
- case sc_VarRegister: return "VarRegister";
- case sc_Variant: return "Variant";
- case sc_SUndefined: return "SUndefined";
- case sc_Init: return "Init";
- case sc_Max: return "Max";
- }
-
- return "???";
-}
-
-
-/* Convert symbol type to string. */
-
-char *
-st_to_string(symbol_type)
- st_t symbol_type;
-{
- switch(symbol_type)
- {
- case st_Nil: return "Nil";
- case st_Global: return "Global";
- case st_Static: return "Static";
- case st_Param: return "Param";
- case st_Local: return "Local";
- case st_Label: return "Label";
- case st_Proc: return "Proc";
- case st_Block: return "Block";
- case st_End: return "End";
- case st_Member: return "Member";
- case st_Typedef: return "Typedef";
- case st_File: return "File";
- case st_RegReloc: return "RegReloc";
- case st_Forward: return "Forward";
- case st_StaticProc: return "StaticProc";
- case st_Constant: return "Constant";
- case st_StaParam: return "StaticParam";
-#ifdef stStruct
- case st_Struct: return "Struct";
- case st_Union: return "Union";
- case st_Enum: return "Enum";
-#endif
- case st_Str: return "String";
- case st_Number: return "Number";
- case st_Expr: return "Expr";
- case st_Type: return "Type";
- case st_Max: return "Max";
- }
-
- return "???";
-}
-
-
-/* Convert debug level to string. */
-
-char *
-glevel_to_string (g_level)
- glevel_t g_level;
-{
- switch(g_level)
- {
- case GLEVEL_0: return "G0";
- case GLEVEL_1: return "G1";
- case GLEVEL_2: return "G2";
- case GLEVEL_3: return "G3";
- }
-
- return "??";
-}
-
-
-/* Convert the type information to string format. */
-
-char *
-type_to_string (aux_ptr, index, fdp)
- AUXU *aux_ptr;
- int index;
- FDR *fdp;
-{
- AUXU u;
- struct qual {
- tq_t type;
- int low_bound;
- int high_bound;
- int stride;
- } qualifiers[7];
-
- bt_t basic_type;
- int i;
- static char buffer1[1024];
- static char buffer2[1024];
- char *p1 = buffer1;
- char *p2 = buffer2;
- char *used_ptr = aux_used + (aux_ptr - aux_symbols);
-
- for (i = 0; i < 7; i++)
- {
- qualifiers[i].low_bound = 0;
- qualifiers[i].high_bound = 0;
- qualifiers[i].stride = 0;
- }
-
- used_ptr[index] = 1;
- u = aux_ptr[index++];
- if (u.isym == -1)
- return "-1 (no type)";
-
- basic_type = (bt_t) u.ti.bt;
- qualifiers[0].type = (tq_t) u.ti.tq0;
- qualifiers[1].type = (tq_t) u.ti.tq1;
- qualifiers[2].type = (tq_t) u.ti.tq2;
- qualifiers[3].type = (tq_t) u.ti.tq3;
- qualifiers[4].type = (tq_t) u.ti.tq4;
- qualifiers[5].type = (tq_t) u.ti.tq5;
- qualifiers[6].type = tq_Nil;
-
- /*
- * Go get the basic type.
- */
- switch (basic_type)
- {
- case bt_Nil: /* undefined */
- strcpy (p1, "nil");
- break;
-
- case bt_Adr: /* address - integer same size as pointer */
- strcpy (p1, "address");
- break;
-
- case bt_Char: /* character */
- strcpy (p1, "char");
- break;
-
- case bt_UChar: /* unsigned character */
- strcpy (p1, "unsigned char");
- break;
-
- case bt_Short: /* short */
- strcpy (p1, "short");
- break;
-
- case bt_UShort: /* unsigned short */
- strcpy (p1, "unsigned short");
- break;
-
- case bt_Int: /* int */
- strcpy (p1, "int");
- break;
-
- case bt_UInt: /* unsigned int */
- strcpy (p1, "unsigned int");
- break;
-
- case bt_Long: /* long */
- strcpy (p1, "long");
- break;
-
- case bt_ULong: /* unsigned long */
- strcpy (p1, "unsigned long");
- break;
-
- case bt_Float: /* float (real) */
- strcpy (p1, "float");
- break;
-
- case bt_Double: /* Double (real) */
- strcpy (p1, "double");
- break;
-
- /* Structures add 1-2 aux words:
- 1st word is [ST_RFDESCAPE, offset] pointer to struct def;
- 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */
-
- case bt_Struct: /* Structure (Record) */
- emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "struct", fdp);
- used_ptr[index] = 1;
- if (aux_ptr[index].rndx.rfd == ST_RFDESCAPE)
- used_ptr[++index] = 1;
-
- index++; /* skip aux words */
- break;
-
- /* Unions add 1-2 aux words:
- 1st word is [ST_RFDESCAPE, offset] pointer to union def;
- 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */
-
- case bt_Union: /* Union */
- emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "union", fdp);
- used_ptr[index] = 1;
- if (aux_ptr[index].rndx.rfd == ST_RFDESCAPE)
- used_ptr[++index] = 1;
-
- index++; /* skip aux words */
- break;
-
- /* Enumerations add 1-2 aux words:
- 1st word is [ST_RFDESCAPE, offset] pointer to enum def;
- 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */
-
- case bt_Enum: /* Enumeration */
- emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "enum", fdp);
- used_ptr[index] = 1;
- if (aux_ptr[index].rndx.rfd == ST_RFDESCAPE)
- used_ptr[++index] = 1;
-
- index++; /* skip aux words */
- break;
-
- case bt_Typedef: /* defined via a typedef, isymRef points */
- strcpy (p1, "typedef");
- break;
-
- case bt_Range: /* subrange of int */
- strcpy (p1, "subrange");
- break;
-
- case bt_Set: /* pascal sets */
- strcpy (p1, "set");
- break;
-
- case bt_Complex: /* fortran complex */
- strcpy (p1, "complex");
- break;
-
- case bt_DComplex: /* fortran double complex */
- strcpy (p1, "double complex");
- break;
-
- case bt_Indirect: /* forward or unnamed typedef */
- strcpy (p1, "forward/unnamed typedef");
- break;
-
- case bt_FixedDec: /* Fixed Decimal */
- strcpy (p1, "fixed decimal");
- break;
-
- case bt_FloatDec: /* Float Decimal */
- strcpy (p1, "float decimal");
- break;
-
- case bt_String: /* Varying Length Character String */
- strcpy (p1, "string");
- break;
-
- case bt_Bit: /* Aligned Bit String */
- strcpy (p1, "bit");
- break;
-
- case bt_Picture: /* Picture */
- strcpy (p1, "picture");
- break;
-
- case bt_Void: /* Void */
- strcpy (p1, "void");
- break;
-
- default:
- sprintf (p1, "Unknown basic type %d", (int) basic_type);
- break;
- }
-
- p1 += strlen (buffer1);
-
- /*
- * If this is a bitfield, get the bitsize.
- */
- if (u.ti.fBitfield)
- {
- int bitsize;
-
- used_ptr[index] = 1;
- bitsize = aux_ptr[index++].width;
- sprintf (p1, " : %d", bitsize);
- p1 += strlen (buffer1);
- }
-
-
- /*
- * Deal with any qualifiers.
- */
- if (qualifiers[0].type != tq_Nil)
- {
- /*
- * Snarf up any array bounds in the correct order. Arrays
- * store 5 successive words in the aux. table:
- * word 0 RNDXR to type of the bounds (ie, int)
- * word 1 Current file descriptor index
- * word 2 low bound
- * word 3 high bound (or -1 if [])
- * word 4 stride size in bits
- */
- for (i = 0; i < 7; i++)
- {
- if (qualifiers[i].type == tq_Array)
- {
- qualifiers[i].low_bound = aux_ptr[index+2].dnLow;
- qualifiers[i].high_bound = aux_ptr[index+3].dnHigh;
- qualifiers[i].stride = aux_ptr[index+4].width;
- used_ptr[index] = 1;
- used_ptr[index+1] = 1;
- used_ptr[index+2] = 1;
- used_ptr[index+3] = 1;
- used_ptr[index+4] = 1;
- index += 5;
- }
- }
-
- /*
- * Now print out the qualifiers.
- */
- for (i = 0; i < 6; i++)
- {
- switch (qualifiers[i].type)
- {
- case tq_Nil:
- case tq_Max:
- break;
-
- case tq_Ptr:
- strcpy (p2, "ptr to ");
- p2 += sizeof ("ptr to ")-1;
- break;
-
- case tq_Vol:
- strcpy (p2, "volatile ");
- p2 += sizeof ("volatile ")-1;
- break;
-
- case tq_Far:
- strcpy (p2, "far ");
- p2 += sizeof ("far ")-1;
- break;
-
- case tq_Proc:
- strcpy (p2, "func. ret. ");
- p2 += sizeof ("func. ret. ");
- break;
-
- case tq_Array:
- {
- int first_array = i;
- int j;
-
- /* Print array bounds reversed (ie, in the order the C
- programmer writes them). C is such a fun language.... */
-
- while (i < 5 && qualifiers[i+1].type == tq_Array)
- i++;
-
- for (j = i; j >= first_array; j--)
- {
- strcpy (p2, "array [");
- p2 += sizeof ("array [")-1;
- if (qualifiers[j].low_bound != 0)
- sprintf (p2,
- "%ld:%ld {%ld bits}",
- (long) qualifiers[j].low_bound,
- (long) qualifiers[j].high_bound,
- (long) qualifiers[j].stride);
-
- else if (qualifiers[j].high_bound != -1)
- sprintf (p2,
- "%ld {%ld bits}",
- (long) (qualifiers[j].high_bound + 1),
- (long) (qualifiers[j].stride));
-
- else
- sprintf (p2, " {%ld bits}", (long) (qualifiers[j].stride));
-
- p2 += strlen (p2);
- strcpy (p2, "] of ");
- p2 += sizeof ("] of ")-1;
- }
- }
- break;
- }
- }
- }
-
- strcpy (p2, buffer1);
- return buffer2;
-}
-
-
-/* Print out the global file header for object files. */
-
-void
-print_global_hdr (ptr)
- struct filehdr *ptr;
-{
- char *time = ctime ((time_t *)&ptr->f_timdat);
- ushort flags = ptr->f_flags;
-
- printf("Global file header:\n");
- printf(" %-*s 0x%x\n", 24, "magic number", (ushort) ptr->f_magic);
- printf(" %-*s %d\n", 24, "# sections", (int) ptr->f_nscns);
- printf(" %-*s %ld, %s", 24, "timestamp", (long) ptr->f_timdat, time);
- printf(" %-*s %ld\n", 24, "symbolic header offset", (long) ptr->f_symptr);
- printf(" %-*s %ld\n", 24, "symbolic header size", (long) ptr->f_nsyms);
- printf(" %-*s %ld\n", 24, "optional header", (long) ptr->f_opthdr);
- printf(" %-*s 0x%x", 24, "flags", (ushort) flags);
-
- if ((flags & F_RELFLG) != 0)
- printf (", F_RELFLG");
-
- if ((flags & F_EXEC) != 0)
- printf (", F_EXEC");
-
- if ((flags & F_LNNO) != 0)
- printf (", F_LNNO");
-
- if ((flags & F_LSYMS) != 0)
- printf (", F_LSYMS");
-
- if ((flags & F_MINMAL) != 0)
- printf (", F_MINMAL");
-
- if ((flags & F_UPDATE) != 0)
- printf (", F_UPDATE");
-
- if ((flags & F_SWABD) != 0)
- printf (", F_SWABD");
-
- if ((flags & F_AR16WR) != 0)
- printf (", F_AR16WR");
-
- if ((flags & F_AR32WR) != 0)
- printf (", F_AR32WR");
-
- if ((flags & F_AR32W) != 0)
- printf (", F_AR32W");
-
- if ((flags & F_PATCH) != 0)
- printf (", F_PATCH/F_NODF");
-
- printf ("\n\n");
-}
-
-
-/* Print out the symbolic header. */
-
-void
-print_sym_hdr (sym_ptr)
- HDRR *sym_ptr;
-{
- int width = 20;
-
- printf("Symbolic header, magic number = 0x%04x, vstamp = %d.%d:\n\n",
- sym_ptr->magic & 0xffff,
- (sym_ptr->vstamp & 0xffff) >> 8,
- sym_ptr->vstamp & 0xff);
-
- printf(" %-*s %11s %11s %11s\n", width, "Info", "Offset", "Number", "Bytes");
- printf(" %-*s %11s %11s %11s\n", width, "====", "======", "======", "=====\n");
-
- printf(" %-*s %11ld %11ld %11ld [%d]\n", width, "Line numbers",
- (long) sym_ptr->cbLineOffset,
- (long) sym_ptr->cbLine,
- (long) sym_ptr->cbLine,
- (int) sym_ptr->ilineMax);
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "Dense numbers",
- (long) sym_ptr->cbDnOffset,
- (long) sym_ptr->idnMax,
- (long) (sym_ptr->idnMax * sizeof (DNR)));
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "Procedures Tables",
- (long) sym_ptr->cbPdOffset,
- (long) sym_ptr->ipdMax,
- (long) (sym_ptr->ipdMax * sizeof (PDR)));
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "Local Symbols",
- (long) sym_ptr->cbSymOffset,
- (long) sym_ptr->isymMax,
- (long) (sym_ptr->isymMax * sizeof (SYMR)));
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "Optimization Symbols",
- (long) sym_ptr->cbOptOffset,
- (long) sym_ptr->ioptMax,
- (long) (sym_ptr->ioptMax * sizeof (OPTR)));
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "Auxiliary Symbols",
- (long) sym_ptr->cbAuxOffset,
- (long) sym_ptr->iauxMax,
- (long) (sym_ptr->iauxMax * sizeof (AUXU)));
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "Local Strings",
- (long) sym_ptr->cbSsOffset,
- (long) sym_ptr->issMax,
- (long) sym_ptr->issMax);
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "External Strings",
- (long) sym_ptr->cbSsExtOffset,
- (long) sym_ptr->issExtMax,
- (long) sym_ptr->issExtMax);
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "File Tables",
- (long) sym_ptr->cbFdOffset,
- (long) sym_ptr->ifdMax,
- (long) (sym_ptr->ifdMax * sizeof (FDR)));
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "Relative Files",
- (long) sym_ptr->cbRfdOffset,
- (long) sym_ptr->crfd,
- (long) (sym_ptr->crfd * sizeof (ulong)));
-
- printf(" %-*s %11ld %11ld %11ld\n", width, "External Symbols",
- (long) sym_ptr->cbExtOffset,
- (long) sym_ptr->iextMax,
- (long) (sym_ptr->iextMax * sizeof (EXTR)));
-}
-
-
-/* Print out a symbol. */
-
-void
-print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
- SYMR *sym_ptr;
- int number;
- char *strbase;
- AUXU *aux_base;
- int ifd;
- FDR *fdp;
-{
- sc_t storage_class = (sc_t) sym_ptr->sc;
- st_t symbol_type = (st_t) sym_ptr->st;
- ulong index = sym_ptr->index;
- char *used_ptr = aux_used + (aux_base - aux_symbols);
- scope_t *scope_ptr;
-
- printf ("\n Symbol# %d: \"%s\"\n", number, sym_ptr->iss + strbase);
-
- if (aux_base != (AUXU *) 0 && index != indexNil)
- switch (symbol_type)
- {
- case st_Nil:
- case st_Label:
- break;
-
- case st_File:
- case st_Block:
- printf (" End+1 symbol: %ld\n", index);
- if (want_scope)
- {
- if (free_scope == (scope_t *) 0)
- scope_ptr = (scope_t *) malloc (sizeof (scope_t));
- else
- {
- scope_ptr = free_scope;
- free_scope = scope_ptr->prev;
- }
- scope_ptr->open_sym = number;
- scope_ptr->st = symbol_type;
- scope_ptr->sc = storage_class;
- scope_ptr->prev = cur_scope;
- cur_scope = scope_ptr;
- }
- break;
-
- case st_End:
- if (storage_class == sc_Text || storage_class == sc_Info)
- printf (" First symbol: %ld\n", index);
- else
- {
- used_ptr[index] = 1;
- printf (" First symbol: %ld\n", aux_base[index].isym);
- }
-
- if (want_scope)
- {
- if (cur_scope == (scope_t *) 0)
- printf (" Can't pop end scope\n");
- else
- {
- scope_ptr = cur_scope;
- cur_scope = scope_ptr->prev;
- scope_ptr->prev = free_scope;
- free_scope = scope_ptr;
- }
- }
- break;
-
- case st_Proc:
- case st_StaticProc:
- if (MIPS_IS_STAB(sym_ptr))
- ;
- else if (ifd == -1) /* local symbol */
- {
- used_ptr[index] = used_ptr[index+1] = 1;
- printf (" End+1 symbol: %-7ld Type: %s\n",
- aux_base[index].isym,
- type_to_string (aux_base, index+1, fdp));
- }
- else /* global symbol */
- printf (" Local symbol: %ld\n", index);
-
- if (want_scope)
- {
- if (free_scope == (scope_t *) 0)
- scope_ptr = (scope_t *) malloc (sizeof (scope_t));
- else
- {
- scope_ptr = free_scope;
- free_scope = scope_ptr->prev;
- }
- scope_ptr->open_sym = number;
- scope_ptr->st = symbol_type;
- scope_ptr->sc = storage_class;
- scope_ptr->prev = cur_scope;
- cur_scope = scope_ptr;
- }
- break;
-
-#ifdef stStruct
- case st_Struct:
- case st_Union:
- case st_Enum:
- printf (" End+1 symbol: %lu\n", index);
- break;
-#endif
-
- default:
- if (!MIPS_IS_STAB (sym_ptr))
- {
- used_ptr[index] = 1;
- printf (" Type: %s\n",
- type_to_string (aux_base, index, fdp));
- }
- break;
- }
-
- if (want_scope)
- {
- printf (" Scopes: ");
- if (cur_scope == (scope_t *) 0)
- printf (" none\n");
- else
- {
- for (scope_ptr = cur_scope;
- scope_ptr != (scope_t *) 0;
- scope_ptr = scope_ptr->prev)
- {
- char *class;
- if (scope_ptr->st == st_Proc || scope_ptr->st == st_StaticProc)
- class = "func.";
- else if (scope_ptr->st == st_File)
- class = "file";
- else if (scope_ptr->st == st_Block && scope_ptr->sc == sc_Text)
- class = "block";
- else if (scope_ptr->st == st_Block && scope_ptr->sc == sc_Info)
- class = "type";
- else
- class = "???";
-
- printf (" %ld [%s]", scope_ptr->open_sym, class);
- }
- printf ("\n");
- }
- }
-
- printf (" Value: %-13ld ",
- (long)sym_ptr->value);
- if (ifd == -1)
- printf ("String index: %ld\n", (long)sym_ptr->iss);
- else
- printf ("String index: %-11ld Ifd: %d\n",
- (long)sym_ptr->iss, ifd);
-
- printf (" Symbol type: %-11sStorage class: %-11s",
- st_to_string (symbol_type), sc_to_string (storage_class));
-
- if (MIPS_IS_STAB(sym_ptr))
- {
- register int i = sizeof(stab_names) / sizeof(stab_names[0]);
- char *stab_name = "stab";
- short code = MIPS_UNMARK_STAB(sym_ptr->index);
- while (--i >= 0)
- if (stab_names[i].code == code)
- {
- stab_name = stab_names[i].string;
- break;
- }
- printf ("Index: 0x%lx (%s)\n", (long)sym_ptr->index, stab_name);
- }
- else if (sym_ptr->st == stLabel && sym_ptr->index != indexNil)
- printf ("Index: %ld (line#)\n", (long)sym_ptr->index);
- else
- printf ("Index: %ld\n", (long)sym_ptr->index);
-
-}
-
-
-/* Print out a word from the aux. table in various formats. */
-
-void
-print_aux (u, auxi, used)
- AUXU u;
- int auxi;
- int used;
-{
- printf ("\t%s#%-5d %11ld, [%4ld/%7ld], [%2d %1d:%1d %1x:%1x:%1x:%1x:%1x:%1x]\n",
- (used) ? " " : "* ",
- auxi,
- (long) u.isym,
- (long) u.rndx.rfd,
- (long) u.rndx.index,
- u.ti.bt,
- u.ti.fBitfield,
- u.ti.continued,
- u.ti.tq0,
- u.ti.tq1,
- u.ti.tq2,
- u.ti.tq3,
- u.ti.tq4,
- u.ti.tq5);
-}
-
-
-/* Write aggregate information to a string. */
-
-void
-emit_aggregate (string, u, u2, which, fdp)
- char *string;
- AUXU u;
- AUXU u2;
- const char *which;
- FDR *fdp;
-{
- unsigned int ifd = u.rndx.rfd;
- unsigned int index = u.rndx.index;
- const char *name;
-
- if (ifd == ST_RFDESCAPE)
- ifd = u2.isym;
-
- /* An ifd of -1 is an opaque type. An escaped index of 0 is a
- struct return type of a procedure compiled without -g. */
- if (ifd == 0xffffffff
- || (u.rndx.rfd == ST_RFDESCAPE && index == 0))
- name = "<undefined>";
- else if (index == indexNil)
- name = "<no name>";
- else
- {
- if (fdp == 0 || sym_hdr.crfd == 0)
- fdp = &file_desc[ifd];
- else
- fdp = &file_desc[rfile_desc[fdp->rfdBase + ifd]];
- name = &l_strings[fdp->issBase + l_symbols[index + fdp->isymBase].iss];
- }
-
- sprintf (string,
- "%s %s { ifd = %u, index = %u }",
- which, name, ifd, index);
-}
-
-
-/* Print out information about a file descriptor, and the symbols,
- procedures, and line numbers within it. */
-
-void
-print_file_desc (fdp, number)
- FDR *fdp;
- int number;
-{
- char *str_base;
- AUXU *aux_base;
- int symi, pdi;
- int width = 20;
- char *used_base;
-
- str_base = l_strings + fdp->issBase;
- aux_base = aux_symbols + fdp->iauxBase;
- used_base = aux_used + (aux_base - aux_symbols);
-
- printf ("\nFile #%d, \"%s\"\n\n", number, str_base + fdp->rss);
-
- printf (" Name index = %-10ld Readin = %s\n",
- (long) fdp->rss, (fdp->fReadin) ? "Yes" : "No");
-
- printf (" Merge = %-10s Endian = %s\n",
- (fdp->fMerge) ? "Yes" : "No",
- (fdp->fBigendian) ? "BIG" : "LITTLE");
-
- printf (" Debug level = %-10s Language = %s\n",
- glevel_to_string (fdp->glevel),
- lang_to_string((lang_t) fdp->lang));
-
- printf (" Adr = 0x%08lx\n\n", (long) fdp->adr);
-
- printf(" %-*s %11s %11s %11s %11s\n", width, "Info", "Start", "Number", "Size", "Offset");
- printf(" %-*s %11s %11s %11s %11s\n", width, "====", "=====", "======", "====", "======");
-
- printf(" %-*s %11lu %11lu %11lu %11lu\n",
- width, "Local strings",
- (ulong) fdp->issBase,
- (ulong) fdp->cbSs,
- (ulong) fdp->cbSs,
- (ulong) (fdp->issBase + sym_hdr.cbSsOffset));
-
- printf(" %-*s %11lu %11lu %11lu %11lu\n",
- width, "Local symbols",
- (ulong) fdp->isymBase,
- (ulong) fdp->csym,
- (ulong) (fdp->csym * sizeof (SYMR)),
- (ulong) (fdp->isymBase * sizeof (SYMR) + sym_hdr.cbSymOffset));
-
- printf(" %-*s %11lu %11lu %11lu %11lu\n",
- width, "Line numbers",
- (ulong) fdp->cbLineOffset,
- (ulong) fdp->cline,
- (ulong) fdp->cbLine,
- (ulong) (fdp->cbLineOffset + sym_hdr.cbLineOffset));
-
- printf(" %-*s %11lu %11lu %11lu %11lu\n",
- width, "Optimization symbols",
- (ulong) fdp->ioptBase,
- (ulong) fdp->copt,
- (ulong) (fdp->copt * sizeof (OPTR)),
- (ulong) (fdp->ioptBase * sizeof (OPTR) + sym_hdr.cbOptOffset));
-
- printf(" %-*s %11lu %11lu %11lu %11lu\n",
- width, "Procedures",
- (ulong) fdp->ipdFirst,
- (ulong) fdp->cpd,
- (ulong) (fdp->cpd * sizeof (PDR)),
- (ulong) (fdp->ipdFirst * sizeof (PDR) + sym_hdr.cbPdOffset));
-
- printf(" %-*s %11lu %11lu %11lu %11lu\n",
- width, "Auxiliary symbols",
- (ulong) fdp->iauxBase,
- (ulong) fdp->caux,
- (ulong) (fdp->caux * sizeof (AUXU)),
- (ulong) (fdp->iauxBase * sizeof(AUXU) + sym_hdr.cbAuxOffset));
-
- printf(" %-*s %11lu %11lu %11lu %11lu\n",
- width, "Relative Files",
- (ulong) fdp->rfdBase,
- (ulong) fdp->crfd,
- (ulong) (fdp->crfd * sizeof (ulong)),
- (ulong) (fdp->rfdBase * sizeof(ulong) + sym_hdr.cbRfdOffset));
-
-
- if (want_scope && cur_scope != (scope_t *) 0)
- printf ("\n Warning scope does not start at 0!\n");
-
- /*
- * print the info about the symbol table.
- */
- printf ("\n There are %lu local symbols, starting at %lu\n",
- (ulong) fdp->csym,
- (ulong) (fdp->isymBase + sym_hdr.cbSymOffset));
-
- for(symi = fdp->isymBase; symi < (fdp->csym + fdp->isymBase); symi++)
- print_symbol (&l_symbols[symi],
- symi - fdp->isymBase,
- str_base,
- aux_base,
- -1,
- fdp);
-
- if (want_scope && cur_scope != (scope_t *) 0)
- printf ("\n Warning scope does not end at 0!\n");
-
- /*
- * print the aux. table if desired.
- */
-
- if (want_aux && fdp->caux != 0)
- {
- int auxi;
-
- printf ("\n There are %lu auxiliary table entries, starting at %lu.\n\n",
- (ulong) fdp->caux,
- (ulong) (fdp->iauxBase + sym_hdr.cbAuxOffset));
-
- for (auxi = fdp->iauxBase; auxi < (fdp->caux + fdp->iauxBase); auxi++)
- print_aux (aux_base[auxi], auxi, used_base[auxi]);
- }
-
- /*
- * print the relative file descriptors.
- */
- if (want_rfd && fdp->crfd != 0)
- {
- ulong *rfd_ptr, i;
-
- printf ("\n There are %lu relative file descriptors, starting at %lu.\n",
- (ulong) fdp->crfd,
- (ulong) fdp->rfdBase);
-
- rfd_ptr = rfile_desc + fdp->rfdBase;
- for (i = 0; i < fdp->crfd; i++)
- {
- printf ("\t#%-5ld %11ld, 0x%08lx\n", i, *rfd_ptr, *rfd_ptr);
- rfd_ptr++;
- }
- }
-
- /*
- * do the procedure descriptors.
- */
- printf ("\n There are %lu procedure descriptor entries, ", (ulong) fdp->cpd);
- printf ("starting at %lu.\n", (ulong) fdp->ipdFirst);
-
- for (pdi = fdp->ipdFirst; pdi < (fdp->cpd + fdp->ipdFirst); pdi++)
- {
- PDR *proc_ptr = &proc_desc[pdi];
- printf ("\n\tProcedure descriptor %d:\n", (pdi - fdp->ipdFirst));
-
- printf ("\t Name index = %-11ld Name = \"%s\"\n",
- (long) l_symbols[proc_ptr->isym + fdp->isymBase].iss,
- l_symbols[proc_ptr->isym + fdp->isymBase].iss + str_base);
-
- printf ("\t .mask 0x%08lx,%-9ld .fmask 0x%08lx,%ld\n",
- (long) proc_ptr->regmask,
- (long) proc_ptr->regoffset,
- (long) proc_ptr->fregmask,
- (long) proc_ptr->fregoffset);
-
- printf ("\t .frame $%d,%ld,$%d\n",
- (int) proc_ptr->framereg,
- (long) proc_ptr->frameoffset,
- (int) proc_ptr->pcreg);
-
- printf ("\t Opt. start = %-11ld Symbols start = %ld\n",
- (long) proc_ptr->iopt,
- (long) proc_ptr->isym);
-
- printf ("\t First line # = %-11ld Last line # = %ld\n",
- (long) proc_ptr->lnLow,
- (long) proc_ptr->lnHigh);
-
- printf ("\t Line Offset = %-11ld Address = 0x%08lx\n",
- (long) proc_ptr->cbLineOffset,
- (long) proc_ptr->adr);
-
- /*
- * print the line number entries.
- */
-
- if (want_line && fdp->cline != 0)
- {
- int delta, count;
- long cur_line = proc_ptr->lnLow;
- uchar *line_ptr = (((uchar *)lines) + proc_ptr->cbLineOffset
- + fdp->cbLineOffset);
- uchar *line_end;
-
- if (pdi == fdp->cpd + fdp->ipdFirst - 1) /* last procedure */
- line_end = ((uchar *)lines) + fdp->cbLine + fdp->cbLineOffset;
- else /* not last proc. */
- line_end = (((uchar *)lines) + proc_desc[pdi+1].cbLineOffset
- + fdp->cbLineOffset);
-
- printf ("\n\tThere are %lu bytes holding line numbers, starting at %lu.\n",
- (ulong) (line_end - line_ptr),
- (ulong) (fdp->ilineBase + sym_hdr.cbLineOffset));
-
- while (line_ptr < line_end)
- { /* sign extend nibble */
- delta = ((*line_ptr >> 4) ^ 0x8) - 0x8;
- count = (*line_ptr & 0xf) + 1;
- if (delta != -8)
- line_ptr++;
- else
- {
- delta = (((line_ptr[1]) & 0xff) << 8) + ((line_ptr[2]) & 0xff);
- delta = (delta ^ 0x8000) - 0x8000;
- line_ptr += 3;
- }
-
- cur_line += delta;
- printf ("\t Line %11ld, delta %5d, count %2d\n",
- cur_line,
- delta,
- count);
- }
- }
- }
-}
-
-
-/* Read in the portions of the .T file that we will print out. */
-
-void
-read_tfile __proto((void))
-{
- short magic;
- off_t sym_hdr_offset = 0;
-
- (void) read_seek ((PTR_T) &magic, sizeof (magic), (off_t) 0, "Magic number");
- if (!tfile)
- {
- /* Print out the global header, since this is not a T-file. */
-
- (void) read_seek ((PTR_T) &global_hdr, sizeof (global_hdr), (off_t) 0,
- "Global file header");
-
- print_global_hdr (&global_hdr);
-
- if (global_hdr.f_symptr == 0)
- {
- printf ("No symbolic header, Goodbye!\n");
- exit (1);
- }
-
- sym_hdr_offset = global_hdr.f_symptr;
- }
-
- (void) read_seek ((PTR_T) &sym_hdr,
- sizeof (sym_hdr),
- sym_hdr_offset,
- "Symbolic header");
-
- print_sym_hdr (&sym_hdr);
-
- lines = (LINER *) read_seek ((PTR_T) 0,
- sym_hdr.cbLine,
- sym_hdr.cbLineOffset,
- "Line numbers");
-
- dense_nums = (DNR *) read_seek ((PTR_T) 0,
- sym_hdr.idnMax * sizeof (DNR),
- sym_hdr.cbDnOffset,
- "Dense numbers");
-
- proc_desc = (PDR *) read_seek ((PTR_T) 0,
- sym_hdr.ipdMax * sizeof (PDR),
- sym_hdr.cbPdOffset,
- "Procedure tables");
-
- l_symbols = (SYMR *) read_seek ((PTR_T) 0,
- sym_hdr.isymMax * sizeof (SYMR),
- sym_hdr.cbSymOffset,
- "Local symbols");
-
- opt_symbols = (OPTR *) read_seek ((PTR_T) 0,
- sym_hdr.ioptMax * sizeof (OPTR),
- sym_hdr.cbOptOffset,
- "Optimization symbols");
-
- aux_symbols = (AUXU *) read_seek ((PTR_T) 0,
- sym_hdr.iauxMax * sizeof (AUXU),
- sym_hdr.cbAuxOffset,
- "Auxiliary symbols");
-
- if (sym_hdr.iauxMax > 0)
- {
- aux_used = calloc (sym_hdr.iauxMax, 1);
- if (aux_used == (char *) 0)
- {
- perror ("calloc");
- exit (1);
- }
- }
-
- l_strings = (char *) read_seek ((PTR_T) 0,
- sym_hdr.issMax,
- sym_hdr.cbSsOffset,
- "Local string table");
-
- e_strings = (char *) read_seek ((PTR_T) 0,
- sym_hdr.issExtMax,
- sym_hdr.cbSsExtOffset,
- "External string table");
-
- file_desc = (FDR *) read_seek ((PTR_T) 0,
- sym_hdr.ifdMax * sizeof (FDR),
- sym_hdr.cbFdOffset,
- "File tables");
-
- rfile_desc = (ulong *) read_seek ((PTR_T) 0,
- sym_hdr.crfd * sizeof (ulong),
- sym_hdr.cbRfdOffset,
- "Relative file tables");
-
- e_symbols = (EXTR *) read_seek ((PTR_T) 0,
- sym_hdr.iextMax * sizeof (EXTR),
- sym_hdr.cbExtOffset,
- "External symbols");
-}
-
-
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int i, opt;
-
- /*
- * Process arguments
- */
- while ((opt = getopt (argc, argv, "alrst")) != EOF)
- switch (opt)
- {
- default: errors++; break;
- case 'a': want_aux++; break; /* print aux table */
- case 'l': want_line++; break; /* print line numbers */
- case 'r': want_rfd++; break; /* print relative fd's */
- case 's': want_scope++; break; /* print scope info */
- case 't': tfile++; break; /* this is a tfile (without header), and not a .o */
- }
-
- if (errors || optind != argc - 1)
- {
- fprintf (stderr, "Calling Sequence:\n");
- fprintf (stderr, "\t%s [-alrst] <object-or-T-file>\n", argv[0]);
- fprintf (stderr, "\n");
- fprintf (stderr, "switches:\n");
- fprintf (stderr, "\t-a Print out auxiliary table.\n");
- fprintf (stderr, "\t-l Print out line numbers.\n");
- fprintf (stderr, "\t-r Print out relative file descriptors.\n");
- fprintf (stderr, "\t-s Print out the current scopes for an item.\n");
- fprintf (stderr, "\t-t Assume there is no global header (ie, a T-file).\n");
- return 1;
- }
-
- /*
- * Open and process the input file.
- */
- tfile_fd = open (argv[optind], O_RDONLY);
- if (tfile_fd < 0)
- {
- perror (argv[optind]);
- return 1;
- }
-
- read_tfile ();
-
- /*
- * Print any global aux words if any.
- */
- if (want_aux)
- {
- long last_aux_in_use;
-
- if (sym_hdr.ifdMax != 0 && file_desc[0].iauxBase != 0)
- {
- printf ("\nGlobal auxiliary entries before first file:\n");
- for (i = 0; i < file_desc[0].iauxBase; i++)
- print_aux (aux_symbols[i], 0, aux_used[i]);
- }
-
- if (sym_hdr.ifdMax == 0)
- last_aux_in_use = 0;
- else
- last_aux_in_use =
- file_desc[sym_hdr.ifdMax-1].iauxBase +
- file_desc[sym_hdr.ifdMax-1].caux - 1;
-
- if (last_aux_in_use < sym_hdr.iauxMax-1)
- {
- printf ("\nGlobal auxiliary entries after last file:\n");
- for (i = last_aux_in_use; i < sym_hdr.iauxMax; i++)
- print_aux (aux_symbols[i], i - last_aux_in_use, aux_used[i]);
- }
- }
-
- /*
- * Print the information for each file.
- */
- for (i = 0; i < sym_hdr.ifdMax; i++)
- print_file_desc (&file_desc[i], i);
-
- /*
- * Print the external symbols.
- */
- want_scope = 0; /* scope info is meaning for extern symbols */
- printf ("\nThere are %lu external symbols, starting at %lu\n",
- (ulong) sym_hdr.iextMax,
- (ulong) sym_hdr.cbExtOffset);
-
- for(i = 0; i < sym_hdr.iextMax; i++)
- print_symbol (&e_symbols[i].asym, i, e_strings,
- aux_symbols + file_desc[e_symbols[i].ifd].iauxBase,
- e_symbols[i].ifd,
- &file_desc[e_symbols[i].ifd]);
-
- /*
- * Print unused aux symbols now.
- */
-
- if (want_aux)
- {
- int first_time = 1;
-
- for (i = 0; i < sym_hdr.iauxMax; i++)
- {
- if (! aux_used[i])
- {
- if (first_time)
- {
- printf ("\nThe following auxiliary table entries were unused:\n\n");
- first_time = 0;
- }
-
- printf (" #%-5d %11ld 0x%08lx %s\n",
- i,
- (long) aux_symbols[i].isym,
- (long) aux_symbols[i].isym,
- type_to_string (aux_symbols, i, (FDR *) 0));
- }
- }
- }
-
- return 0;
-}
-
-
-void
-fancy_abort ()
-{
- fprintf (stderr, "mips-tdump internal error");
- exit (1);
-}
-
-void
-fatal(s)
-char *s;
-{
- fprintf(stderr, "%s\n", s);
- exit(1);
-}
-
-/* Same as `malloc' but report error if no memory available. */
-
-PTR_T
-xmalloc (size)
- unsigned size;
-{
- register PTR_T value = malloc (size);
- if (value == 0)
- fatal ("Virtual memory exhausted.");
- return value;
-}
diff --git a/gcc/mips-tfile.c b/gcc/mips-tfile.c
deleted file mode 100644
index 61bbbc9c9a1..00000000000
--- a/gcc/mips-tfile.c
+++ /dev/null
@@ -1,5803 +0,0 @@
-/* Update the symbol table (the .T file) in a MIPS object to
- contain debugging information specified by the GNU compiler
- in the form of comments (the mips assembler does not support
- assembly access to debug information).
- Copyright (C) 1991, 1993, 1994. 1995 Free Software Foundation, Inc.
- Contributed by Michael Meissner, meissner@osf.org
-
-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. */
-
-
-/* Here is a brief description of the MIPS ECOFF symbol table. The
- MIPS symbol table has the following pieces:
-
- Symbolic Header
- |
- +-- Auxiliary Symbols
- |
- +-- Dense number table
- |
- +-- Optimizer Symbols
- |
- +-- External Strings
- |
- +-- External Symbols
- |
- +-- Relative file descriptors
- |
- +-- File table
- |
- +-- Procedure table
- |
- +-- Line number table
- |
- +-- Local Strings
- |
- +-- Local Symbols
-
- The symbolic header points to each of the other tables, and also
- contains the number of entries. It also contains a magic number
- and MIPS compiler version number, such as 2.0.
-
- The auxiliary table is a series of 32 bit integers, that are
- referenced as needed from the local symbol table. Unlike standard
- COFF, the aux. information does not follow the symbol that uses
- it, but rather is a separate table. In theory, this would allow
- the MIPS compilers to collapse duplicate aux. entries, but I've not
- noticed this happening with the 1.31 compiler suite. The different
- types of aux. entries are:
-
- 1) dnLow: Low bound on array dimension.
-
- 2) dnHigh: High bound on array dimension.
-
- 3) isym: Index to the local symbol which is the start of the
- function for the end of function first aux. entry.
-
- 4) width: Width of structures and bitfields.
-
- 5) count: Count of ranges for variant part.
-
- 6) rndx: A relative index into the symbol table. The relative
- index field has two parts: rfd which is a pointer into the
- relative file index table or ST_RFDESCAPE which says the next
- aux. entry is the file number, and index: which is the pointer
- into the local symbol within a given file table. This is for
- things like references to types defined in another file.
-
- 7) Type information: This is like the COFF type bits, except it
- is 32 bits instead of 16; they still have room to add new
- basic types; and they can handle more than 6 levels of array,
- pointer, function, etc. Each type information field contains
- the following structure members:
-
- a) fBitfield: a bit that says this is a bitfield, and the
- size in bits follows as the next aux. entry.
-
- b) continued: a bit that says the next aux. entry is a
- continuation of the current type information (in case
- there are more than 6 levels of array/ptr/function).
-
- c) bt: an integer containing the base type before adding
- array, pointer, function, etc. qualifiers. The
- current base types that I have documentation for are:
-
- btNil -- undefined
- btAdr -- address - integer same size as ptr
- btChar -- character
- btUChar -- unsigned character
- btShort -- short
- btUShort -- unsigned short
- btInt -- int
- btUInt -- unsigned int
- btLong -- long
- btULong -- unsigned long
- btFloat -- float (real)
- btDouble -- Double (real)
- btStruct -- Structure (Record)
- btUnion -- Union (variant)
- btEnum -- Enumerated
- btTypedef -- defined via a typedef isymRef
- btRange -- subrange of int
- btSet -- pascal sets
- btComplex -- fortran complex
- btDComplex -- fortran double complex
- btIndirect -- forward or unnamed typedef
- btFixedDec -- Fixed Decimal
- btFloatDec -- Float Decimal
- btString -- Varying Length Character String
- btBit -- Aligned Bit String
- btPicture -- Picture
- btVoid -- Void (MIPS cc revision >= 2.00)
-
- d) tq0 - tq5: type qualifier fields as needed. The
- current type qualifier fields I have documentation for
- are:
-
- tqNil -- no more qualifiers
- tqPtr -- pointer
- tqProc -- procedure
- tqArray -- array
- tqFar -- 8086 far pointers
- tqVol -- volatile
-
-
- The dense number table is used in the front ends, and disappears by
- the time the .o is created.
-
- With the 1.31 compiler suite, the optimization symbols don't seem
- to be used as far as I can tell.
-
- The linker is the first entity that creates the relative file
- descriptor table, and I believe it is used so that the individual
- file table pointers don't have to be rewritten when the objects are
- merged together into the program file.
-
- Unlike COFF, the basic symbol & string tables are split into
- external and local symbols/strings. The relocation information
- only goes off of the external symbol table, and the debug
- information only goes off of the internal symbol table. The
- external symbols can have links to an appropriate file index and
- symbol within the file to give it the appropriate type information.
- Because of this, the external symbols are actually larger than the
- internal symbols (to contain the link information), and contain the
- local symbol structure as a member, though this member is not the
- first member of the external symbol structure (!). I suspect this
- split is to make strip easier to deal with.
-
- Each file table has offsets for where the line numbers, local
- strings, local symbols, and procedure table starts from within the
- global tables, and the indexs are reset to 0 for each of those
- tables for the file.
-
- The procedure table contains the binary equivalents of the .ent
- (start of the function address), .frame (what register is the
- virtual frame pointer, constant offset from the register to obtain
- the VFP, and what register holds the return address), .mask/.fmask
- (bitmask of saved registers, and where the first register is stored
- relative to the VFP) assembler directives. It also contains the
- low and high bounds of the line numbers if debugging is turned on.
-
- The line number table is a compressed form of the normal COFF line
- table. Each line number entry is either 1 or 3 bytes long, and
- contains a signed delta from the previous line, and an unsigned
- count of the number of instructions this statement takes.
-
- The local symbol table contains the following fields:
-
- 1) iss: index to the local string table giving the name of the
- symbol.
-
- 2) value: value of the symbol (address, register number, etc.).
-
- 3) st: symbol type. The current symbol types are:
-
- stNil -- Nuthin' special
- stGlobal -- external symbol
- stStatic -- static
- stParam -- procedure argument
- stLocal -- local variable
- stLabel -- label
- stProc -- External Procedure
- stBlock -- beginning of block
- stEnd -- end (of anything)
- stMember -- member (of anything)
- stTypedef -- type definition
- stFile -- file name
- stRegReloc -- register relocation
- stForward -- forwarding address
- stStaticProc -- Static procedure
- stConstant -- const
-
- 4) sc: storage class. The current storage classes are:
-
- scText -- text symbol
- scData -- initialized data symbol
- scBss -- un-initialized data symbol
- scRegister -- value of symbol is register number
- scAbs -- value of symbol is absolute
- scUndefined -- who knows?
- scCdbLocal -- variable's value is IN se->va.??
- scBits -- this is a bit field
- scCdbSystem -- value is IN debugger's address space
- scRegImage -- register value saved on stack
- scInfo -- symbol contains debugger information
- scUserStruct -- addr in struct user for current process
- scSData -- load time only small data
- scSBss -- load time only small common
- scRData -- load time only read only data
- scVar -- Var parameter (fortranpascal)
- scCommon -- common variable
- scSCommon -- small common
- scVarRegister -- Var parameter in a register
- scVariant -- Variant record
- scSUndefined -- small undefined(external) data
- scInit -- .init section symbol
-
- 5) index: pointer to a local symbol or aux. entry.
-
-
-
- For the following program:
-
- #include <stdio.h>
-
- main(){
- printf("Hello World!\n");
- return 0;
- }
-
- Mips-tdump produces the following information:
-
- Global file header:
- magic number 0x162
- # sections 2
- timestamp 645311799, Wed Jun 13 17:16:39 1990
- symbolic header offset 284
- symbolic header size 96
- optional header 56
- flags 0x0
-
- Symbolic header, magic number = 0x7009, vstamp = 1.31:
-
- Info Offset Number Bytes
- ==== ====== ====== =====
-
- Line numbers 380 4 4 [13]
- Dense numbers 0 0 0
- Procedures Tables 384 1 52
- Local Symbols 436 16 192
- Optimization Symbols 0 0 0
- Auxiliary Symbols 628 39 156
- Local Strings 784 80 80
- External Strings 864 144 144
- File Tables 1008 2 144
- Relative Files 0 0 0
- External Symbols 1152 20 320
-
- File #0, "hello2.c"
-
- Name index = 1 Readin = No
- Merge = No Endian = LITTLE
- Debug level = G2 Language = C
- Adr = 0x00000000
-
- Info Start Number Size Offset
- ==== ===== ====== ==== ======
- Local strings 0 15 15 784
- Local symbols 0 6 72 436
- Line numbers 0 13 13 380
- Optimization symbols 0 0 0 0
- Procedures 0 1 52 384
- Auxiliary symbols 0 14 56 628
- Relative Files 0 0 0 0
-
- There are 6 local symbols, starting at 436
-
- Symbol# 0: "hello2.c"
- End+1 symbol = 6
- String index = 1
- Storage class = Text Index = 6
- Symbol type = File Value = 0
-
- Symbol# 1: "main"
- End+1 symbol = 5
- Type = int
- String index = 10
- Storage class = Text Index = 12
- Symbol type = Proc Value = 0
-
- Symbol# 2: ""
- End+1 symbol = 4
- String index = 0
- Storage class = Text Index = 4
- Symbol type = Block Value = 8
-
- Symbol# 3: ""
- First symbol = 2
- String index = 0
- Storage class = Text Index = 2
- Symbol type = End Value = 28
-
- Symbol# 4: "main"
- First symbol = 1
- String index = 10
- Storage class = Text Index = 1
- Symbol type = End Value = 52
-
- Symbol# 5: "hello2.c"
- First symbol = 0
- String index = 1
- Storage class = Text Index = 0
- Symbol type = End Value = 0
-
- There are 14 auxiliary table entries, starting at 628.
-
- * #0 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #1 24, [ 24/ 0], [ 6 0:0 0:0:0:0:0:0]
- * #2 8, [ 8/ 0], [ 2 0:0 0:0:0:0:0:0]
- * #3 16, [ 16/ 0], [ 4 0:0 0:0:0:0:0:0]
- * #4 24, [ 24/ 0], [ 6 0:0 0:0:0:0:0:0]
- * #5 32, [ 32/ 0], [ 8 0:0 0:0:0:0:0:0]
- * #6 40, [ 40/ 0], [10 0:0 0:0:0:0:0:0]
- * #7 44, [ 44/ 0], [11 0:0 0:0:0:0:0:0]
- * #8 12, [ 12/ 0], [ 3 0:0 0:0:0:0:0:0]
- * #9 20, [ 20/ 0], [ 5 0:0 0:0:0:0:0:0]
- * #10 28, [ 28/ 0], [ 7 0:0 0:0:0:0:0:0]
- * #11 36, [ 36/ 0], [ 9 0:0 0:0:0:0:0:0]
- #12 5, [ 5/ 0], [ 1 1:0 0:0:0:0:0:0]
- #13 24, [ 24/ 0], [ 6 0:0 0:0:0:0:0:0]
-
- There are 1 procedure descriptor entries, starting at 0.
-
- Procedure descriptor 0:
- Name index = 10 Name = "main"
- .mask 0x80000000,-4 .fmask 0x00000000,0
- .frame $29,24,$31
- Opt. start = -1 Symbols start = 1
- First line # = 3 Last line # = 6
- Line Offset = 0 Address = 0x00000000
-
- There are 4 bytes holding line numbers, starting at 380.
- Line 3, delta 0, count 2
- Line 4, delta 1, count 3
- Line 5, delta 1, count 2
- Line 6, delta 1, count 6
-
- File #1, "/usr/include/stdio.h"
-
- Name index = 1 Readin = No
- Merge = Yes Endian = LITTLE
- Debug level = G2 Language = C
- Adr = 0x00000000
-
- Info Start Number Size Offset
- ==== ===== ====== ==== ======
- Local strings 15 65 65 799
- Local symbols 6 10 120 508
- Line numbers 0 0 0 380
- Optimization symbols 0 0 0 0
- Procedures 1 0 0 436
- Auxiliary symbols 14 25 100 684
- Relative Files 0 0 0 0
-
- There are 10 local symbols, starting at 442
-
- Symbol# 0: "/usr/include/stdio.h"
- End+1 symbol = 10
- String index = 1
- Storage class = Text Index = 10
- Symbol type = File Value = 0
-
- Symbol# 1: "_iobuf"
- End+1 symbol = 9
- String index = 22
- Storage class = Info Index = 9
- Symbol type = Block Value = 20
-
- Symbol# 2: "_cnt"
- Type = int
- String index = 29
- Storage class = Info Index = 4
- Symbol type = Member Value = 0
-
- Symbol# 3: "_ptr"
- Type = ptr to char
- String index = 34
- Storage class = Info Index = 15
- Symbol type = Member Value = 32
-
- Symbol# 4: "_base"
- Type = ptr to char
- String index = 39
- Storage class = Info Index = 16
- Symbol type = Member Value = 64
-
- Symbol# 5: "_bufsiz"
- Type = int
- String index = 45
- Storage class = Info Index = 4
- Symbol type = Member Value = 96
-
- Symbol# 6: "_flag"
- Type = short
- String index = 53
- Storage class = Info Index = 3
- Symbol type = Member Value = 128
-
- Symbol# 7: "_file"
- Type = char
- String index = 59
- Storage class = Info Index = 2
- Symbol type = Member Value = 144
-
- Symbol# 8: ""
- First symbol = 1
- String index = 0
- Storage class = Info Index = 1
- Symbol type = End Value = 0
-
- Symbol# 9: "/usr/include/stdio.h"
- First symbol = 0
- String index = 1
- Storage class = Text Index = 0
- Symbol type = End Value = 0
-
- There are 25 auxiliary table entries, starting at 642.
-
- * #14 -1, [4095/1048575], [63 1:1 f:f:f:f:f:f]
- #15 65544, [ 8/ 16], [ 2 0:0 1:0:0:0:0:0]
- #16 65544, [ 8/ 16], [ 2 0:0 1:0:0:0:0:0]
- * #17 196656, [ 48/ 48], [12 0:0 3:0:0:0:0:0]
- * #18 8191, [4095/ 1], [63 1:1 0:0:0:0:f:1]
- * #19 1, [ 1/ 0], [ 0 1:0 0:0:0:0:0:0]
- * #20 20479, [4095/ 4], [63 1:1 0:0:0:0:f:4]
- * #21 1, [ 1/ 0], [ 0 1:0 0:0:0:0:0:0]
- * #22 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #23 2, [ 2/ 0], [ 0 0:1 0:0:0:0:0:0]
- * #24 160, [ 160/ 0], [40 0:0 0:0:0:0:0:0]
- * #25 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #26 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #27 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #28 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #29 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #30 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #31 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #32 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #33 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #34 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #35 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #36 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #37 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
- * #38 0, [ 0/ 0], [ 0 0:0 0:0:0:0:0:0]
-
- There are 0 procedure descriptor entries, starting at 1.
-
- There are 20 external symbols, starting at 1152
-
- Symbol# 0: "_iob"
- Type = array [3 {160}] of struct _iobuf { ifd = 1, index = 1 }
- String index = 0 Ifd = 1
- Storage class = Nil Index = 17
- Symbol type = Global Value = 60
-
- Symbol# 1: "fopen"
- String index = 5 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 2: "fdopen"
- String index = 11 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 3: "freopen"
- String index = 18 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 4: "popen"
- String index = 26 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 5: "tmpfile"
- String index = 32 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 6: "ftell"
- String index = 40 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 7: "rewind"
- String index = 46 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 8: "setbuf"
- String index = 53 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 9: "setbuffer"
- String index = 60 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 10: "setlinebuf"
- String index = 70 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 11: "fgets"
- String index = 81 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 12: "gets"
- String index = 87 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 13: "ctermid"
- String index = 92 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 14: "cuserid"
- String index = 100 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 15: "tempnam"
- String index = 108 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 16: "tmpnam"
- String index = 116 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 17: "sprintf"
- String index = 123 Ifd = 1
- Storage class = Nil Index = 1048575
- Symbol type = Proc Value = 0
-
- Symbol# 18: "main"
- Type = int
- String index = 131 Ifd = 0
- Storage class = Text Index = 1
- Symbol type = Proc Value = 0
-
- Symbol# 19: "printf"
- String index = 136 Ifd = 0
- Storage class = Undefined Index = 1048575
- Symbol type = Proc Value = 0
-
- The following auxiliary table entries were unused:
-
- #0 0 0x00000000 void
- #2 8 0x00000008 char
- #3 16 0x00000010 short
- #4 24 0x00000018 int
- #5 32 0x00000020 long
- #6 40 0x00000028 float
- #7 44 0x0000002c double
- #8 12 0x0000000c unsigned char
- #9 20 0x00000014 unsigned short
- #10 28 0x0000001c unsigned int
- #11 36 0x00000024 unsigned long
- #14 0 0x00000000 void
- #15 24 0x00000018 int
- #19 32 0x00000020 long
- #20 40 0x00000028 float
- #21 44 0x0000002c double
- #22 12 0x0000000c unsigned char
- #23 20 0x00000014 unsigned short
- #24 28 0x0000001c unsigned int
- #25 36 0x00000024 unsigned long
- #26 48 0x00000030 struct no name { ifd = -1, index = 1048575 }
-
-*/
-
-
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "config.h"
-#include <stdio.h>
-
-#ifndef __SABER__
-#define saber_stop()
-#endif
-
-#ifndef __LINE__
-#define __LINE__ 0
-#endif
-
-#ifdef __STDC__
-typedef void *PTR_T;
-typedef const void *CPTR_T;
-#define __proto(x) x
-#ifndef VPROTO
-#define PVPROTO(ARGS) ARGS
-#define VPROTO(ARGS) ARGS
-#define VA_START(va_list,var) va_start(va_list,var)
-#endif
-#else
-
-#if defined(_STDIO_H_) || defined(__STDIO_H__) /* Ultrix 4.0, SGI */
-typedef void *PTR_T;
-typedef void *CPTR_T;
-
-#else
-typedef char *PTR_T; /* Ultrix 3.1 */
-typedef char *CPTR_T;
-#endif
-
-#define __proto(x) ()
-#define const
-#ifndef VPROTO
-#define PVPROTO(ARGS) ()
-#define VPROTO(ARGS) (va_alist) va_dcl
-#define VA_START(va_list,var) va_start(va_list)
-#endif
-#endif
-
-/* Do to size_t being defined in sys/types.h and different
- in stddef.h, we have to do this by hand..... Note, these
- types are correct for MIPS based systems, and may not be
- correct for other systems. Ultrix 4.0 and Silicon Graphics
- have this fixed, but since the following is correct, and
- the fact that including stddef.h gets you GCC's version
- instead of the standard one it's not worth it to fix it. */
-
-#if defined(__OSF1__) || defined(__OSF__) || defined(__osf__)
-#define Size_t long unsigned int
-#else
-#define Size_t unsigned int
-#endif
-#define Ptrdiff_t long
-
-/* The following might be called from obstack or malloc,
- so they can't be static. */
-
-extern void pfatal_with_name
- __proto((char *));
-extern void fancy_abort __proto((void));
- void botch __proto((const char *));
-extern PTR_T xmalloc __proto((Size_t));
-extern PTR_T xcalloc __proto((Size_t, Size_t));
-extern PTR_T xrealloc __proto((PTR_T, Size_t));
-extern void xfree __proto((PTR_T));
-
-#ifdef HAVE_VPRINTF
-extern void fatal PVPROTO((const char *format, ...));
-extern void error PVPROTO((const char *format, ...));
-#else
-/* We must not provide any prototype here, even if ANSI C. */
-extern void fatal __proto(());
-extern void error __proto(());
-#endif
-
-
-#ifndef MIPS_DEBUGGING_INFO
-
-static int line_number;
-static int cur_line_start;
-static int debug;
-static int had_errors;
-static char *progname;
-static char *input_name;
-
-int
-main ()
-{
- fprintf (stderr, "Mips-tfile should only be run on a MIPS computer!\n");
- exit (1);
-}
-
-#else /* MIPS_DEBUGGING defined */
-
-/* The local and global symbols have a field index, so undo any defines
- of index -> strchr and rindex -> strrchr. */
-
-#undef rindex
-#undef index
-
-#include <sys/types.h>
-#include <string.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/stat.h>
-
-#ifndef CROSS_COMPILE
-#include <a.out.h>
-#else
-#include "mips/a.out.h"
-#endif /* CROSS_COMPILE */
-
-#if defined (USG) || defined (NO_STAB_H)
-#include "gstab.h" /* If doing DBX on sysV, use our own stab.h. */
-#else
-#include <stab.h> /* On BSD, use the system's stab.h. */
-#endif /* not USG */
-
-#ifdef __GNU_STAB__
-#define STAB_CODE_TYPE enum __stab_debug_code
-#else
-#define STAB_CODE_TYPE int
-#endif
-
-#ifdef _OSF_SOURCE
-#define HAS_STDLIB_H
-#define HAS_UNISTD_H
-#endif
-
-#ifdef HAS_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef HAS_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifndef errno
-extern int errno; /* MIPS errno.h doesn't declare this */
-#endif
-
-#ifndef MALLOC_CHECK
-#ifdef __SABER__
-#define MALLOC_CHECK
-#endif
-#endif
-
-#define IS_ASM_IDENT(ch) \
- (isalnum (ch) || (ch) == '_' || (ch) == '.' || (ch) == '$')
-
-
-/* Redefinition of of storage classes as an enumeration for better
- debugging. */
-
-typedef enum sc {
- sc_Nil = scNil, /* no storage class */
- sc_Text = scText, /* text symbol */
- sc_Data = scData, /* initialized data symbol */
- sc_Bss = scBss, /* un-initialized data symbol */
- sc_Register = scRegister, /* value of symbol is register number */
- sc_Abs = scAbs, /* value of symbol is absolute */
- sc_Undefined = scUndefined, /* who knows? */
- sc_CdbLocal = scCdbLocal, /* variable's value is IN se->va.?? */
- sc_Bits = scBits, /* this is a bit field */
- sc_CdbSystem = scCdbSystem, /* value is IN CDB's address space */
- sc_RegImage = scRegImage, /* register value saved on stack */
- sc_Info = scInfo, /* symbol contains debugger information */
- sc_UserStruct = scUserStruct, /* addr in struct user for current process */
- sc_SData = scSData, /* load time only small data */
- sc_SBss = scSBss, /* load time only small common */
- sc_RData = scRData, /* load time only read only data */
- sc_Var = scVar, /* Var parameter (fortran,pascal) */
- sc_Common = scCommon, /* common variable */
- sc_SCommon = scSCommon, /* small common */
- sc_VarRegister = scVarRegister, /* Var parameter in a register */
- sc_Variant = scVariant, /* Variant record */
- sc_SUndefined = scSUndefined, /* small undefined(external) data */
- sc_Init = scInit, /* .init section symbol */
- sc_Max = scMax /* Max storage class+1 */
-} sc_t;
-
-/* Redefinition of symbol type. */
-
-typedef enum st {
- st_Nil = stNil, /* Nuthin' special */
- st_Global = stGlobal, /* external symbol */
- st_Static = stStatic, /* static */
- st_Param = stParam, /* procedure argument */
- st_Local = stLocal, /* local variable */
- st_Label = stLabel, /* label */
- st_Proc = stProc, /* " " Procedure */
- st_Block = stBlock, /* beginning of block */
- st_End = stEnd, /* end (of anything) */
- st_Member = stMember, /* member (of anything - struct/union/enum */
- st_Typedef = stTypedef, /* type definition */
- st_File = stFile, /* file name */
- st_RegReloc = stRegReloc, /* register relocation */
- st_Forward = stForward, /* forwarding address */
- st_StaticProc = stStaticProc, /* load time only static procs */
- st_Constant = stConstant, /* const */
- st_Str = stStr, /* string */
- st_Number = stNumber, /* pure number (ie. 4 NOR 2+2) */
- st_Expr = stExpr, /* 2+2 vs. 4 */
- st_Type = stType, /* post-coercion SER */
- st_Max = stMax /* max type+1 */
-} st_t;
-
-/* Redefinition of type qualifiers. */
-
-typedef enum tq {
- tq_Nil = tqNil, /* bt is what you see */
- tq_Ptr = tqPtr, /* pointer */
- tq_Proc = tqProc, /* procedure */
- tq_Array = tqArray, /* duh */
- tq_Far = tqFar, /* longer addressing - 8086/8 land */
- tq_Vol = tqVol, /* volatile */
- tq_Max = tqMax /* Max type qualifier+1 */
-} tq_t;
-
-/* Redefinition of basic types. */
-
-typedef enum bt {
- bt_Nil = btNil, /* undefined */
- bt_Adr = btAdr, /* address - integer same size as pointer */
- bt_Char = btChar, /* character */
- bt_UChar = btUChar, /* unsigned character */
- bt_Short = btShort, /* short */
- bt_UShort = btUShort, /* unsigned short */
- bt_Int = btInt, /* int */
- bt_UInt = btUInt, /* unsigned int */
- bt_Long = btLong, /* long */
- bt_ULong = btULong, /* unsigned long */
- bt_Float = btFloat, /* float (real) */
- bt_Double = btDouble, /* Double (real) */
- bt_Struct = btStruct, /* Structure (Record) */
- bt_Union = btUnion, /* Union (variant) */
- bt_Enum = btEnum, /* Enumerated */
- bt_Typedef = btTypedef, /* defined via a typedef, isymRef points */
- bt_Range = btRange, /* subrange of int */
- bt_Set = btSet, /* pascal sets */
- bt_Complex = btComplex, /* fortran complex */
- bt_DComplex = btDComplex, /* fortran double complex */
- bt_Indirect = btIndirect, /* forward or unnamed typedef */
- bt_FixedDec = btFixedDec, /* Fixed Decimal */
- bt_FloatDec = btFloatDec, /* Float Decimal */
- bt_String = btString, /* Varying Length Character String */
- bt_Bit = btBit, /* Aligned Bit String */
- bt_Picture = btPicture, /* Picture */
-
-#ifdef btVoid
- bt_Void = btVoid, /* Void */
-#else
-#define bt_Void bt_Nil
-#endif
-
- bt_Max = btMax /* Max basic type+1 */
-} bt_t;
-
-
-
-/* Basic COFF storage classes. */
-enum coff_storage {
- C_EFCN = -1,
- C_NULL = 0,
- C_AUTO = 1,
- C_EXT = 2,
- C_STAT = 3,
- C_REG = 4,
- C_EXTDEF = 5,
- C_LABEL = 6,
- C_ULABEL = 7,
- C_MOS = 8,
- C_ARG = 9,
- C_STRTAG = 10,
- C_MOU = 11,
- C_UNTAG = 12,
- C_TPDEF = 13,
- C_USTATIC = 14,
- C_ENTAG = 15,
- C_MOE = 16,
- C_REGPARM = 17,
- C_FIELD = 18,
- C_BLOCK = 100,
- C_FCN = 101,
- C_EOS = 102,
- C_FILE = 103,
- C_LINE = 104,
- C_ALIAS = 105,
- C_HIDDEN = 106,
- C_MAX = 107
-} coff_storage_t;
-
-/* Regular COFF fundamental type. */
-typedef enum coff_type {
- T_NULL = 0,
- T_ARG = 1,
- T_CHAR = 2,
- T_SHORT = 3,
- T_INT = 4,
- T_LONG = 5,
- T_FLOAT = 6,
- T_DOUBLE = 7,
- T_STRUCT = 8,
- T_UNION = 9,
- T_ENUM = 10,
- T_MOE = 11,
- T_UCHAR = 12,
- T_USHORT = 13,
- T_UINT = 14,
- T_ULONG = 15,
- T_MAX = 16
-} coff_type_t;
-
-/* Regular COFF derived types. */
-typedef enum coff_dt {
- DT_NON = 0,
- DT_PTR = 1,
- DT_FCN = 2,
- DT_ARY = 3,
- DT_MAX = 4
-} coff_dt_t;
-
-#define N_BTMASK 017 /* bitmask to isolate basic type */
-#define N_TMASK 003 /* bitmask to isolate derived type */
-#define N_BT_SHIFT 4 /* # bits to shift past basic type */
-#define N_TQ_SHIFT 2 /* # bits to shift derived types */
-#define N_TQ 6 /* # of type qualifiers */
-
-/* States for whether to hash type or not. */
-typedef enum hash_state {
- hash_no = 0, /* don't hash type */
- hash_yes = 1, /* ok to hash type, or use previous hash */
- hash_record = 2 /* ok to record hash, but don't use prev. */
-} hash_state_t;
-
-
-/* Types of different sized allocation requests. */
-enum alloc_type {
- alloc_type_none, /* dummy value */
- alloc_type_scope, /* nested scopes linked list */
- alloc_type_vlinks, /* glue linking pages in varray */
- alloc_type_shash, /* string hash element */
- alloc_type_thash, /* type hash element */
- alloc_type_tag, /* struct/union/tag element */
- alloc_type_forward, /* element to hold unknown tag */
- alloc_type_thead, /* head of type hash list */
- alloc_type_varray, /* general varray allocation */
- alloc_type_last /* last+1 element for array bounds */
-};
-
-
-#define WORD_ALIGN(x) (((x) + (sizeof (long) - 1)) & ~ (sizeof (long) - 1))
-#define DWORD_ALIGN(x) (((x) + 7) & ~7)
-
-
-/* Structures to provide n-number of virtual arrays, each of which can
- grow linearly, and which are written in the object file as sequential
- pages. On systems with a BSD malloc that define USE_MALLOC, the
- MAX_CLUSTER_PAGES should be 1 less than a power of two, since malloc
- adds it's overhead, and rounds up to the next power of 2. Pages are
- linked together via a linked list.
-
- If PAGE_SIZE is > 4096, the string length in the shash_t structure
- can't be represented (assuming there are strings > 4096 bytes). */
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096 /* size of varray pages */
-#endif
-
-#define PAGE_USIZE ((Size_t)PAGE_SIZE)
-
-
-#ifndef MAX_CLUSTER_PAGES /* # pages to get from system */
-#ifndef USE_MALLOC /* in one memory request */
-#define MAX_CLUSTER_PAGES 64
-#else
-#define MAX_CLUSTER_PAGES 63
-#endif
-#endif
-
-
-/* Linked list connecting separate page allocations. */
-typedef struct vlinks {
- struct vlinks *prev; /* previous set of pages */
- struct vlinks *next; /* next set of pages */
- union page *datum; /* start of page */
- unsigned long start_index; /* starting index # of page */
-} vlinks_t;
-
-
-/* Virtual array header. */
-typedef struct varray {
- vlinks_t *first; /* first page link */
- vlinks_t *last; /* last page link */
- unsigned long num_allocated; /* # objects allocated */
- unsigned short object_size; /* size in bytes of each object */
- unsigned short objects_per_page; /* # objects that can fit on a page */
- unsigned short objects_last_page; /* # objects allocated on last page */
-} varray_t;
-
-#ifndef MALLOC_CHECK
-#define OBJECTS_PER_PAGE(type) (PAGE_SIZE / sizeof (type))
-#else
-#define OBJECTS_PER_PAGE(type) ((sizeof (type) > 1) ? 1 : PAGE_SIZE)
-#endif
-
-#define INIT_VARRAY(type) { /* macro to initialize a varray */ \
- (vlinks_t *) 0, /* first */ \
- (vlinks_t *) 0, /* last */ \
- 0, /* num_allocated */ \
- sizeof (type), /* object_size */ \
- OBJECTS_PER_PAGE (type), /* objects_per_page */ \
- OBJECTS_PER_PAGE (type), /* objects_last_page */ \
-}
-
-/* Master type for indexes within the symbol table. */
-typedef unsigned long symint_t;
-
-
-/* Linked list support for nested scopes (file, block, structure, etc.). */
-typedef struct scope {
- struct scope *prev; /* previous scope level */
- struct scope *free; /* free list pointer */
- SYMR *lsym; /* pointer to local symbol node */
- symint_t lnumber; /* lsym index */
- st_t type; /* type of the node */
-} scope_t;
-
-
-/* Forward reference list for tags referenced, but not yet defined. */
-typedef struct forward {
- struct forward *next; /* next forward reference */
- struct forward *free; /* free list pointer */
- AUXU *ifd_ptr; /* pointer to store file index */
- AUXU *index_ptr; /* pointer to store symbol index */
- AUXU *type_ptr; /* pointer to munge type info */
-} forward_t;
-
-
-/* Linked list support for tags. The first tag in the list is always
- the current tag for that block. */
-typedef struct tag {
- struct tag *free; /* free list pointer */
- struct shash *hash_ptr; /* pointer to the hash table head */
- struct tag *same_name; /* tag with same name in outer scope */
- struct tag *same_block; /* next tag defined in the same block. */
- struct forward *forward_ref; /* list of forward references */
- bt_t basic_type; /* bt_Struct, bt_Union, or bt_Enum */
- symint_t ifd; /* file # tag defined in */
- symint_t indx; /* index within file's local symbols */
-} tag_t;
-
-
-/* Head of a block's linked list of tags. */
-typedef struct thead {
- struct thead *prev; /* previous block */
- struct thead *free; /* free list pointer */
- struct tag *first_tag; /* first tag in block defined */
-} thead_t;
-
-
-/* Union containing pointers to each the small structures which are freed up. */
-typedef union small_free {
- scope_t *f_scope; /* scope structure */
- thead_t *f_thead; /* tag head structure */
- tag_t *f_tag; /* tag element structure */
- forward_t *f_forward; /* forward tag reference */
-} small_free_t;
-
-
-/* String hash table support. The size of the hash table must fit
- within a page. */
-
-#ifndef SHASH_SIZE
-#define SHASH_SIZE 1009
-#endif
-
-#define HASH_LEN_MAX ((1 << 12) - 1) /* Max length we can store */
-
-typedef struct shash {
- struct shash *next; /* next hash value */
- char *string; /* string we are hashing */
- symint_t len; /* string length */
- symint_t indx; /* index within string table */
- EXTR *esym_ptr; /* global symbol pointer */
- SYMR *sym_ptr; /* local symbol pointer */
- SYMR *end_ptr; /* symbol pointer to end block */
- tag_t *tag_ptr; /* tag pointer */
- PDR *proc_ptr; /* procedure descriptor pointer */
-} shash_t;
-
-
-/* Type hash table support. The size of the hash table must fit
- within a page with the other extended file descriptor information.
- Because unique types which are hashed are fewer in number than
- strings, we use a smaller hash value. */
-
-#ifndef THASH_SIZE
-#define THASH_SIZE 113
-#endif
-
-typedef struct thash {
- struct thash *next; /* next hash value */
- AUXU type; /* type we are hashing */
- symint_t indx; /* index within string table */
-} thash_t;
-
-
-/* Extended file descriptor that contains all of the support necessary
- to add things to each file separately. */
-typedef struct efdr {
- FDR fdr; /* File header to be written out */
- FDR *orig_fdr; /* original file header */
- char *name; /* filename */
- int name_len; /* length of the filename */
- symint_t void_type; /* aux. pointer to 'void' type */
- symint_t int_type; /* aux. pointer to 'int' type */
- scope_t *cur_scope; /* current nested scopes */
- symint_t file_index; /* current file number */
- int nested_scopes; /* # nested scopes */
- varray_t strings; /* local strings */
- varray_t symbols; /* local symbols */
- varray_t procs; /* procedures */
- varray_t aux_syms; /* auxiliary symbols */
- struct efdr *next_file; /* next file descriptor */
- /* string/type hash tables */
- shash_t **shash_head; /* string hash table */
- thash_t *thash_head[THASH_SIZE];
-} efdr_t;
-
-/* Pre-initialized extended file structure. */
-static efdr_t init_file =
-{
- { /* FDR structure */
- 0, /* adr: memory address of beginning of file */
- 0, /* rss: file name (of source, if known) */
- 0, /* issBase: file's string space */
- 0, /* cbSs: number of bytes in the ss */
- 0, /* isymBase: beginning of symbols */
- 0, /* csym: count file's of symbols */
- 0, /* ilineBase: file's line symbols */
- 0, /* cline: count of file's line symbols */
- 0, /* ioptBase: file's optimization entries */
- 0, /* copt: count of file's optimization entries */
- 0, /* ipdFirst: start of procedures for this file */
- 0, /* cpd: count of procedures for this file */
- 0, /* iauxBase: file's auxiliary entries */
- 0, /* caux: count of file's auxiliary entries */
- 0, /* rfdBase: index into the file indirect table */
- 0, /* crfd: count file indirect entries */
- langC, /* lang: language for this file */
- 1, /* fMerge: whether this file can be merged */
- 0, /* fReadin: true if read in (not just created) */
-#ifdef HOST_WORDS_BIG_ENDIAN
- 1, /* fBigendian: if 1, compiled on big endian machine */
-#else
- 0, /* fBigendian: if 1, compiled on big endian machine */
-#endif
- GLEVEL_2, /* glevel: level this file was compiled with */
- 0, /* reserved: reserved for future use */
- 0, /* cbLineOffset: byte offset from header for this file ln's */
- 0, /* cbLine: size of lines for this file */
- },
-
- (FDR *) 0, /* orig_fdr: original file header pointer */
- (char *) 0, /* name: pointer to filename */
- 0, /* name_len: length of filename */
- 0, /* void_type: ptr to aux node for void type */
- 0, /* int_type: ptr to aux node for int type */
- (scope_t *) 0, /* cur_scope: current scope being processed */
- 0, /* file_index: current file # */
- 0, /* nested_scopes: # nested scopes */
- INIT_VARRAY (char), /* strings: local string varray */
- INIT_VARRAY (SYMR), /* symbols: local symbols varray */
- INIT_VARRAY (PDR), /* procs: procedure varray */
- INIT_VARRAY (AUXU), /* aux_syms: auxiliary symbols varray */
-
- (struct efdr *) 0, /* next_file: next file structure */
-
- (shash_t **) 0, /* shash_head: string hash table */
- { 0 }, /* thash_head: type hash table */
-};
-
-
-static efdr_t *first_file; /* first file descriptor */
-static efdr_t **last_file_ptr = &first_file; /* file descriptor tail */
-
-
-/* Union of various things that are held in pages. */
-typedef union page {
- char byte [ PAGE_SIZE ];
- unsigned char ubyte [ PAGE_SIZE ];
- efdr_t file [ PAGE_SIZE / sizeof (efdr_t) ];
- FDR ofile [ PAGE_SIZE / sizeof (FDR) ];
- PDR proc [ PAGE_SIZE / sizeof (PDR) ];
- SYMR sym [ PAGE_SIZE / sizeof (SYMR) ];
- EXTR esym [ PAGE_SIZE / sizeof (EXTR) ];
- AUXU aux [ PAGE_SIZE / sizeof (AUXU) ];
- DNR dense [ PAGE_SIZE / sizeof (DNR) ];
- scope_t scope [ PAGE_SIZE / sizeof (scope_t) ];
- vlinks_t vlinks [ PAGE_SIZE / sizeof (vlinks_t) ];
- shash_t shash [ PAGE_SIZE / sizeof (shash_t) ];
- thash_t thash [ PAGE_SIZE / sizeof (thash_t) ];
- tag_t tag [ PAGE_SIZE / sizeof (tag_t) ];
- forward_t forward [ PAGE_SIZE / sizeof (forward_t) ];
- thead_t thead [ PAGE_SIZE / sizeof (thead_t) ];
-} page_t;
-
-
-/* Structure holding allocation information for small sized structures. */
-typedef struct alloc_info {
- char *alloc_name; /* name of this allocation type (must be first) */
- page_t *cur_page; /* current page being allocated from */
- small_free_t free_list; /* current free list if any */
- int unallocated; /* number of elements unallocated on page */
- int total_alloc; /* total number of allocations */
- int total_free; /* total number of frees */
- int total_pages; /* total number of pages allocated */
-} alloc_info_t;
-
-/* Type information collected together. */
-typedef struct type_info {
- bt_t basic_type; /* basic type */
- coff_type_t orig_type; /* original COFF-based type */
- int num_tq; /* # type qualifiers */
- int num_dims; /* # dimensions */
- int num_sizes; /* # sizes */
- int extra_sizes; /* # extra sizes not tied with dims */
- tag_t * tag_ptr; /* tag pointer */
- int bitfield; /* symbol is a bitfield */
- int unknown_tag; /* this is an unknown tag */
- tq_t type_qualifiers[N_TQ]; /* type qualifiers (ptr, func, array)*/
- symint_t dimensions [N_TQ]; /* dimensions for each array */
- symint_t sizes [N_TQ+2]; /* sizes of each array slice + size of
- struct/union/enum + bitfield size */
-} type_info_t;
-
-/* Pre-initialized type_info struct. */
-static type_info_t type_info_init = {
- bt_Nil, /* basic type */
- T_NULL, /* original COFF-based type */
- 0, /* # type qualifiers */
- 0, /* # dimensions */
- 0, /* # sizes */
- 0, /* sizes not tied with dims */
- NULL, /* ptr to tag */
- 0, /* bitfield */
- 0, /* unknown tag */
- { /* type qualifiers */
- tq_Nil,
- tq_Nil,
- tq_Nil,
- tq_Nil,
- tq_Nil,
- tq_Nil,
- },
- { /* dimensions */
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- },
- { /* sizes */
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- },
-};
-
-
-/* Global virtual arrays & hash table for external strings as well as
- for the tags table and global tables for file descriptors, and
- dense numbers. */
-
-static varray_t file_desc = INIT_VARRAY (efdr_t);
-static varray_t dense_num = INIT_VARRAY (DNR);
-static varray_t tag_strings = INIT_VARRAY (char);
-static varray_t ext_strings = INIT_VARRAY (char);
-static varray_t ext_symbols = INIT_VARRAY (EXTR);
-
-static shash_t *orig_str_hash[SHASH_SIZE];
-static shash_t *ext_str_hash [SHASH_SIZE];
-static shash_t *tag_hash [SHASH_SIZE];
-
-/* Static types for int and void. Also, remember the last function's
- type (which is set up when we encounter the declaration for the
- function, and used when the end block for the function is emitted. */
-
-static type_info_t int_type_info;
-static type_info_t void_type_info;
-static type_info_t last_func_type_info;
-static EXTR *last_func_eptr;
-
-
-/* Convert COFF basic type to ECOFF basic type. The T_NULL type
- really should use bt_Void, but this causes the current ecoff GDB to
- issue unsupported type messages, and the Ultrix 4.00 dbx (aka MIPS
- 2.0) doesn't understand it, even though the compiler generates it.
- Maybe this will be fixed in 2.10 or 2.20 of the MIPS compiler
- suite, but for now go with what works. */
-
-static bt_t map_coff_types[ (int)T_MAX ] = {
- bt_Nil, /* T_NULL */
- bt_Nil, /* T_ARG */
- bt_Char, /* T_CHAR */
- bt_Short, /* T_SHORT */
- bt_Int, /* T_INT */
- bt_Long, /* T_LONG */
- bt_Float, /* T_FLOAT */
- bt_Double, /* T_DOUBLE */
- bt_Struct, /* T_STRUCT */
- bt_Union, /* T_UNION */
- bt_Enum, /* T_ENUM */
- bt_Enum, /* T_MOE */
- bt_UChar, /* T_UCHAR */
- bt_UShort, /* T_USHORT */
- bt_UInt, /* T_UINT */
- bt_ULong /* T_ULONG */
-};
-
-/* Convert COFF storage class to ECOFF storage class. */
-static sc_t map_coff_storage[ (int)C_MAX ] = {
- sc_Nil, /* 0: C_NULL */
- sc_Abs, /* 1: C_AUTO auto var */
- sc_Undefined, /* 2: C_EXT external */
- sc_Data, /* 3: C_STAT static */
- sc_Register, /* 4: C_REG register */
- sc_Undefined, /* 5: C_EXTDEF ??? */
- sc_Text, /* 6: C_LABEL label */
- sc_Text, /* 7: C_ULABEL user label */
- sc_Info, /* 8: C_MOS member of struct */
- sc_Abs, /* 9: C_ARG argument */
- sc_Info, /* 10: C_STRTAG struct tag */
- sc_Info, /* 11: C_MOU member of union */
- sc_Info, /* 12: C_UNTAG union tag */
- sc_Info, /* 13: C_TPDEF typedef */
- sc_Data, /* 14: C_USTATIC ??? */
- sc_Info, /* 15: C_ENTAG enum tag */
- sc_Info, /* 16: C_MOE member of enum */
- sc_Register, /* 17: C_REGPARM register parameter */
- sc_Bits, /* 18; C_FIELD bitfield */
- sc_Nil, /* 19 */
- sc_Nil, /* 20 */
- sc_Nil, /* 21 */
- sc_Nil, /* 22 */
- sc_Nil, /* 23 */
- sc_Nil, /* 24 */
- sc_Nil, /* 25 */
- sc_Nil, /* 26 */
- sc_Nil, /* 27 */
- sc_Nil, /* 28 */
- sc_Nil, /* 29 */
- sc_Nil, /* 30 */
- sc_Nil, /* 31 */
- sc_Nil, /* 32 */
- sc_Nil, /* 33 */
- sc_Nil, /* 34 */
- sc_Nil, /* 35 */
- sc_Nil, /* 36 */
- sc_Nil, /* 37 */
- sc_Nil, /* 38 */
- sc_Nil, /* 39 */
- sc_Nil, /* 40 */
- sc_Nil, /* 41 */
- sc_Nil, /* 42 */
- sc_Nil, /* 43 */
- sc_Nil, /* 44 */
- sc_Nil, /* 45 */
- sc_Nil, /* 46 */
- sc_Nil, /* 47 */
- sc_Nil, /* 48 */
- sc_Nil, /* 49 */
- sc_Nil, /* 50 */
- sc_Nil, /* 51 */
- sc_Nil, /* 52 */
- sc_Nil, /* 53 */
- sc_Nil, /* 54 */
- sc_Nil, /* 55 */
- sc_Nil, /* 56 */
- sc_Nil, /* 57 */
- sc_Nil, /* 58 */
- sc_Nil, /* 59 */
- sc_Nil, /* 60 */
- sc_Nil, /* 61 */
- sc_Nil, /* 62 */
- sc_Nil, /* 63 */
- sc_Nil, /* 64 */
- sc_Nil, /* 65 */
- sc_Nil, /* 66 */
- sc_Nil, /* 67 */
- sc_Nil, /* 68 */
- sc_Nil, /* 69 */
- sc_Nil, /* 70 */
- sc_Nil, /* 71 */
- sc_Nil, /* 72 */
- sc_Nil, /* 73 */
- sc_Nil, /* 74 */
- sc_Nil, /* 75 */
- sc_Nil, /* 76 */
- sc_Nil, /* 77 */
- sc_Nil, /* 78 */
- sc_Nil, /* 79 */
- sc_Nil, /* 80 */
- sc_Nil, /* 81 */
- sc_Nil, /* 82 */
- sc_Nil, /* 83 */
- sc_Nil, /* 84 */
- sc_Nil, /* 85 */
- sc_Nil, /* 86 */
- sc_Nil, /* 87 */
- sc_Nil, /* 88 */
- sc_Nil, /* 89 */
- sc_Nil, /* 90 */
- sc_Nil, /* 91 */
- sc_Nil, /* 92 */
- sc_Nil, /* 93 */
- sc_Nil, /* 94 */
- sc_Nil, /* 95 */
- sc_Nil, /* 96 */
- sc_Nil, /* 97 */
- sc_Nil, /* 98 */
- sc_Nil, /* 99 */
- sc_Text, /* 100: C_BLOCK block start/end */
- sc_Text, /* 101: C_FCN function start/end */
- sc_Info, /* 102: C_EOS end of struct/union/enum */
- sc_Nil, /* 103: C_FILE file start */
- sc_Nil, /* 104: C_LINE line number */
- sc_Nil, /* 105: C_ALIAS combined type info */
- sc_Nil, /* 106: C_HIDDEN ??? */
-};
-
-/* Convert COFF storage class to ECOFF symbol type. */
-static st_t map_coff_sym_type[ (int)C_MAX ] = {
- st_Nil, /* 0: C_NULL */
- st_Local, /* 1: C_AUTO auto var */
- st_Global, /* 2: C_EXT external */
- st_Static, /* 3: C_STAT static */
- st_Local, /* 4: C_REG register */
- st_Global, /* 5: C_EXTDEF ??? */
- st_Label, /* 6: C_LABEL label */
- st_Label, /* 7: C_ULABEL user label */
- st_Member, /* 8: C_MOS member of struct */
- st_Param, /* 9: C_ARG argument */
- st_Block, /* 10: C_STRTAG struct tag */
- st_Member, /* 11: C_MOU member of union */
- st_Block, /* 12: C_UNTAG union tag */
- st_Typedef, /* 13: C_TPDEF typedef */
- st_Static, /* 14: C_USTATIC ??? */
- st_Block, /* 15: C_ENTAG enum tag */
- st_Member, /* 16: C_MOE member of enum */
- st_Param, /* 17: C_REGPARM register parameter */
- st_Member, /* 18; C_FIELD bitfield */
- st_Nil, /* 19 */
- st_Nil, /* 20 */
- st_Nil, /* 21 */
- st_Nil, /* 22 */
- st_Nil, /* 23 */
- st_Nil, /* 24 */
- st_Nil, /* 25 */
- st_Nil, /* 26 */
- st_Nil, /* 27 */
- st_Nil, /* 28 */
- st_Nil, /* 29 */
- st_Nil, /* 30 */
- st_Nil, /* 31 */
- st_Nil, /* 32 */
- st_Nil, /* 33 */
- st_Nil, /* 34 */
- st_Nil, /* 35 */
- st_Nil, /* 36 */
- st_Nil, /* 37 */
- st_Nil, /* 38 */
- st_Nil, /* 39 */
- st_Nil, /* 40 */
- st_Nil, /* 41 */
- st_Nil, /* 42 */
- st_Nil, /* 43 */
- st_Nil, /* 44 */
- st_Nil, /* 45 */
- st_Nil, /* 46 */
- st_Nil, /* 47 */
- st_Nil, /* 48 */
- st_Nil, /* 49 */
- st_Nil, /* 50 */
- st_Nil, /* 51 */
- st_Nil, /* 52 */
- st_Nil, /* 53 */
- st_Nil, /* 54 */
- st_Nil, /* 55 */
- st_Nil, /* 56 */
- st_Nil, /* 57 */
- st_Nil, /* 58 */
- st_Nil, /* 59 */
- st_Nil, /* 60 */
- st_Nil, /* 61 */
- st_Nil, /* 62 */
- st_Nil, /* 63 */
- st_Nil, /* 64 */
- st_Nil, /* 65 */
- st_Nil, /* 66 */
- st_Nil, /* 67 */
- st_Nil, /* 68 */
- st_Nil, /* 69 */
- st_Nil, /* 70 */
- st_Nil, /* 71 */
- st_Nil, /* 72 */
- st_Nil, /* 73 */
- st_Nil, /* 74 */
- st_Nil, /* 75 */
- st_Nil, /* 76 */
- st_Nil, /* 77 */
- st_Nil, /* 78 */
- st_Nil, /* 79 */
- st_Nil, /* 80 */
- st_Nil, /* 81 */
- st_Nil, /* 82 */
- st_Nil, /* 83 */
- st_Nil, /* 84 */
- st_Nil, /* 85 */
- st_Nil, /* 86 */
- st_Nil, /* 87 */
- st_Nil, /* 88 */
- st_Nil, /* 89 */
- st_Nil, /* 90 */
- st_Nil, /* 91 */
- st_Nil, /* 92 */
- st_Nil, /* 93 */
- st_Nil, /* 94 */
- st_Nil, /* 95 */
- st_Nil, /* 96 */
- st_Nil, /* 97 */
- st_Nil, /* 98 */
- st_Nil, /* 99 */
- st_Block, /* 100: C_BLOCK block start/end */
- st_Proc, /* 101: C_FCN function start/end */
- st_End, /* 102: C_EOS end of struct/union/enum */
- st_File, /* 103: C_FILE file start */
- st_Nil, /* 104: C_LINE line number */
- st_Nil, /* 105: C_ALIAS combined type info */
- st_Nil, /* 106: C_HIDDEN ??? */
-};
-
-/* Map COFF derived types to ECOFF type qualifiers. */
-static tq_t map_coff_derived_type[ (int)DT_MAX ] = {
- tq_Nil, /* 0: DT_NON no more qualifiers */
- tq_Ptr, /* 1: DT_PTR pointer */
- tq_Proc, /* 2: DT_FCN function */
- tq_Array, /* 3: DT_ARY array */
-};
-
-
-/* Keep track of different sized allocation requests. */
-static alloc_info_t alloc_counts[ (int)alloc_type_last ];
-
-
-/* Pointers and such to the original symbol table that is read in. */
-static struct filehdr orig_file_header; /* global object file header */
-
-static HDRR orig_sym_hdr; /* symbolic header on input */
-static char *orig_linenum; /* line numbers */
-static DNR *orig_dense; /* dense numbers */
-static PDR *orig_procs; /* procedures */
-static SYMR *orig_local_syms; /* local symbols */
-static OPTR *orig_opt_syms; /* optimization symbols */
-static AUXU *orig_aux_syms; /* auxiliary symbols */
-static char *orig_local_strs; /* local strings */
-static char *orig_ext_strs; /* external strings */
-static FDR *orig_files; /* file descriptors */
-static symint_t *orig_rfds; /* relative file desc's */
-static EXTR *orig_ext_syms; /* external symbols */
-
-/* Macros to convert an index into a given object within the original
- symbol table. */
-#define CHECK(num,max,str) \
- (((unsigned long)num > (unsigned long)max) ? out_of_bounds (num, max, str, __LINE__) : 0)
-
-#define ORIG_LINENUM(indx) (CHECK ((indx), orig_sym_hdr.cbLine, "line#"), (indx) + orig_linenum)
-#define ORIG_DENSE(indx) (CHECK ((indx), orig_sym_hdr.idnMax, "dense"), (indx) + orig_dense)
-#define ORIG_PROCS(indx) (CHECK ((indx), orig_sym_hdr.ipdMax, "procs"), (indx) + orig_procs)
-#define ORIG_FILES(indx) (CHECK ((indx), orig_sym_hdr.ifdMax, "funcs"), (indx) + orig_files)
-#define ORIG_LSYMS(indx) (CHECK ((indx), orig_sym_hdr.isymMax, "lsyms"), (indx) + orig_local_syms)
-#define ORIG_LSTRS(indx) (CHECK ((indx), orig_sym_hdr.issMax, "lstrs"), (indx) + orig_local_strs)
-#define ORIG_ESYMS(indx) (CHECK ((indx), orig_sym_hdr.iextMax, "esyms"), (indx) + orig_ext_syms)
-#define ORIG_ESTRS(indx) (CHECK ((indx), orig_sym_hdr.issExtMax, "estrs"), (indx) + orig_ext_strs)
-#define ORIG_OPT(indx) (CHECK ((indx), orig_sym_hdr.ioptMax, "opt"), (indx) + orig_opt_syms)
-#define ORIG_AUX(indx) (CHECK ((indx), orig_sym_hdr.iauxMax, "aux"), (indx) + orig_aux_syms)
-#define ORIG_RFDS(indx) (CHECK ((indx), orig_sym_hdr.crfd, "rfds"), (indx) + orig_rfds)
-
-/* Various other statics. */
-static HDRR symbolic_header; /* symbolic header */
-static efdr_t *cur_file_ptr = (efdr_t *) 0; /* current file desc. header */
-static PDR *cur_proc_ptr = (PDR *) 0; /* current procedure header */
-static SYMR *cur_oproc_begin = (SYMR *) 0; /* original proc. sym begin info */
-static SYMR *cur_oproc_end = (SYMR *) 0; /* original proc. sym end info */
-static PDR *cur_oproc_ptr = (PDR *) 0; /* current original procedure*/
-static thead_t *cur_tag_head = (thead_t *) 0;/* current tag head */
-static long file_offset = 0; /* current file offset */
-static long max_file_offset = 0; /* maximum file offset */
-static FILE *object_stream = (FILE *) 0; /* file desc. to output .o */
-static FILE *obj_in_stream = (FILE *) 0; /* file desc. to input .o */
-static char *progname = (char *) 0; /* program name for errors */
-static char *input_name = "stdin"; /* name of input file */
-static char *object_name = (char *) 0; /* tmp. name of object file */
-static char *obj_in_name = (char *) 0; /* name of input object file */
-static char *cur_line_start = (char *) 0; /* current line read in */
-static char *cur_line_ptr = (char *) 0; /* ptr within current line */
-static unsigned cur_line_nbytes = 0; /* # bytes for current line */
-static unsigned cur_line_alloc = 0; /* # bytes total in buffer */
-static long line_number = 0; /* current input line number */
-static int debug = 0; /* trace functions */
-static int version = 0; /* print version # */
-static int had_errors = 0; /* != 0 if errors were found */
-static int rename_output = 0; /* != 0 if rename output file*/
-static int delete_input = 0; /* != 0 if delete input after done */
-static int stabs_seen = 0; /* != 0 if stabs have been seen */
-
-
-/* Pseudo symbol to use when putting stabs into the symbol table. */
-#ifndef STABS_SYMBOL
-#define STABS_SYMBOL "@stabs"
-#endif
-
-static char stabs_symbol[] = STABS_SYMBOL;
-
-
-/* Forward reference for functions. See the definition for more details. */
-
-#ifndef STATIC
-#define STATIC static
-#endif
-
-STATIC int out_of_bounds __proto((symint_t, symint_t, const char *, int));
-
-STATIC shash_t *hash_string __proto((const char *,
- Ptrdiff_t,
- shash_t **,
- symint_t *));
-
-STATIC symint_t add_string __proto((varray_t *,
- shash_t **,
- const char *,
- const char *,
- shash_t **));
-
-STATIC symint_t add_local_symbol
- __proto((const char *,
- const char *,
- st_t,
- sc_t,
- symint_t,
- symint_t));
-
-STATIC symint_t add_ext_symbol __proto((const char *,
- const char *,
- st_t,
- sc_t,
- long,
- symint_t,
- int));
-
-STATIC symint_t add_aux_sym_symint
- __proto((symint_t));
-
-STATIC symint_t add_aux_sym_rndx
- __proto((int, symint_t));
-
-STATIC symint_t add_aux_sym_tir __proto((type_info_t *,
- hash_state_t,
- thash_t **));
-
-STATIC tag_t * get_tag __proto((const char *,
- const char *,
- symint_t,
- bt_t));
-
-STATIC void add_unknown_tag __proto((tag_t *));
-
-STATIC void add_procedure __proto((const char *,
- const char *));
-
-STATIC void add_file __proto((const char *,
- const char *));
-
-STATIC void add_bytes __proto((varray_t *,
- char *,
- Size_t));
-
-STATIC void add_varray_page __proto((varray_t *));
-
-STATIC void update_headers __proto((void));
-
-STATIC void write_varray __proto((varray_t *, off_t, const char *));
-STATIC void write_object __proto((void));
-STATIC char *st_to_string __proto((st_t));
-STATIC char *sc_to_string __proto((sc_t));
-STATIC char *read_line __proto((void));
-STATIC void parse_input __proto((void));
-STATIC void mark_stabs __proto((const char *));
-STATIC void parse_begin __proto((const char *));
-STATIC void parse_bend __proto((const char *));
-STATIC void parse_def __proto((const char *));
-STATIC void parse_end __proto((const char *));
-STATIC void parse_ent __proto((const char *));
-STATIC void parse_file __proto((const char *));
-STATIC void parse_stabs_common
- __proto((const char *, const char *, const char *));
-STATIC void parse_stabs __proto((const char *));
-STATIC void parse_stabn __proto((const char *));
-STATIC page_t *read_seek __proto((Size_t, off_t, const char *));
-STATIC void copy_object __proto((void));
-
-STATIC void catch_signal __proto((int));
-STATIC page_t *allocate_page __proto((void));
-
-STATIC page_t *allocate_multiple_pages
- __proto((Size_t));
-
-STATIC void free_multiple_pages
- __proto((page_t *, Size_t));
-
-#ifndef MALLOC_CHECK
-STATIC page_t *allocate_cluster
- __proto((Size_t));
-#endif
-
-STATIC forward_t *allocate_forward __proto((void));
-STATIC scope_t *allocate_scope __proto((void));
-STATIC shash_t *allocate_shash __proto((void));
-STATIC tag_t *allocate_tag __proto((void));
-STATIC thash_t *allocate_thash __proto((void));
-STATIC thead_t *allocate_thead __proto((void));
-STATIC vlinks_t *allocate_vlinks __proto((void));
-
-STATIC void free_forward __proto((forward_t *));
-STATIC void free_scope __proto((scope_t *));
-STATIC void free_tag __proto((tag_t *));
-STATIC void free_thead __proto((thead_t *));
-
-STATIC char *local_index __proto((const char *, int));
-STATIC char *local_rindex __proto((const char *, int));
-
-#ifndef __alpha
-extern char *sbrk __proto((int));
-extern void free __proto((PTR_T));
-#endif
-extern char *mktemp __proto((char *));
-extern long strtol __proto((const char *, char **, int));
-
-extern char *optarg;
-extern int optind;
-extern int opterr;
-extern char *version_string;
-#ifndef NO_SYS_SIGLIST
-#ifndef DONT_DECLARE_SYS_SIGLIST
-extern char *sys_siglist[NSIG + 1];
-#endif
-#endif
-
-#ifndef SEEK_SET /* Symbolic constants for the "fseek" function: */
-#define SEEK_SET 0 /* Set file pointer to offset */
-#define SEEK_CUR 1 /* Set file pointer to its current value plus offset */
-#define SEEK_END 2 /* Set file pointer to the size of the file plus offset */
-#endif
-
-
-/* List of assembler pseudo ops and beginning sequences that need
- special actions. Someday, this should be a hash table, and such,
- but for now a linear list of names and calls to memcmp will
- do...... */
-
-typedef struct _pseudo_ops {
- const char *name; /* pseudo-op in ascii */
- int len; /* length of name to compare */
- void (*func) __proto((const char *)); /* function to handle line */
-} pseudo_ops_t;
-
-static pseudo_ops_t pseudo_ops[] = {
- { "#.def", sizeof("#.def")-1, parse_def },
- { "#.begin", sizeof("#.begin")-1, parse_begin },
- { "#.bend", sizeof("#.bend")-1, parse_bend },
- { ".end", sizeof(".end")-1, parse_end },
- { ".ent", sizeof(".ent")-1, parse_ent },
- { ".file", sizeof(".file")-1, parse_file },
- { "#.stabs", sizeof("#.stabs")-1, parse_stabs },
- { "#.stabn", sizeof("#.stabn")-1, parse_stabn },
- { ".stabs", sizeof(".stabs")-1, parse_stabs },
- { ".stabn", sizeof(".stabn")-1, parse_stabn },
- { "#@stabs", sizeof("#@stabs")-1, mark_stabs },
-};
-
-
-/* Add a page to a varray object. */
-
-STATIC void
-add_varray_page (vp)
- varray_t *vp; /* varray to add page to */
-{
- vlinks_t *new_links = allocate_vlinks ();
-
-#ifdef MALLOC_CHECK
- if (vp->object_size > 1)
- new_links->datum = (page_t *) xcalloc (1, vp->object_size);
- else
-#endif
- new_links->datum = allocate_page ();
-
- alloc_counts[ (int)alloc_type_varray ].total_alloc++;
- alloc_counts[ (int)alloc_type_varray ].total_pages++;
-
- new_links->start_index = vp->num_allocated;
- vp->objects_last_page = 0;
-
- if (vp->first == (vlinks_t *) 0) /* first allocation? */
- vp->first = vp->last = new_links;
- else
- { /* 2nd or greater allocation */
- new_links->prev = vp->last;
- vp->last->next = new_links;
- vp->last = new_links;
- }
-}
-
-
-/* Compute hash code (from tree.c) */
-
-#define HASHBITS 30
-
-STATIC shash_t *
-hash_string (text, hash_len, hash_tbl, ret_hash_index)
- const char *text; /* ptr to text to hash */
- Ptrdiff_t hash_len; /* length of the text */
- shash_t **hash_tbl; /* hash table */
- symint_t *ret_hash_index; /* ptr to store hash index */
-{
- register unsigned long hi;
- register Ptrdiff_t i;
- register shash_t *ptr;
- register int first_ch = *text;
-
- hi = hash_len;
- for (i = 0; i < hash_len; i++)
- hi = ((hi & 0x003fffff) * 613) + (text[i] & 0xff);
-
- hi &= (1 << HASHBITS) - 1;
- hi %= SHASH_SIZE;
-
- if (ret_hash_index != (symint_t *) 0)
- *ret_hash_index = hi;
-
- for (ptr = hash_tbl[hi]; ptr != (shash_t *) 0; ptr = ptr->next)
- if (hash_len == ptr->len
- && first_ch == ptr->string[0]
- && memcmp ((CPTR_T) text, (CPTR_T) ptr->string, hash_len) == 0)
- break;
-
- return ptr;
-}
-
-
-/* Add a string (and null pad) to one of the string tables. A
- consequence of hashing strings, is that we don't let strings
- cross page boundaries. The extra nulls will be ignored. */
-
-STATIC symint_t
-add_string (vp, hash_tbl, start, end_p1, ret_hash)
- varray_t *vp; /* string virtual array */
- shash_t **hash_tbl; /* ptr to hash table */
- const char *start; /* 1st byte in string */
- const char *end_p1; /* 1st byte after string */
- shash_t **ret_hash; /* return hash pointer */
-{
- register Ptrdiff_t len = end_p1 - start;
- register shash_t *hash_ptr;
- symint_t hi;
-
- if (len >= PAGE_USIZE)
- fatal ("String too big (%ld bytes)", (long) len);
-
- hash_ptr = hash_string (start, len, hash_tbl, &hi);
- if (hash_ptr == (shash_t *) 0)
- {
- register char *p;
-
- if (vp->objects_last_page + len >= PAGE_USIZE)
- {
- vp->num_allocated =
- ((vp->num_allocated + PAGE_USIZE - 1) / PAGE_USIZE) * PAGE_USIZE;
- add_varray_page (vp);
- }
-
- hash_ptr = allocate_shash ();
- hash_ptr->next = hash_tbl[hi];
- hash_tbl[hi] = hash_ptr;
-
- hash_ptr->len = len;
- hash_ptr->indx = vp->num_allocated;
- hash_ptr->string = p = & vp->last->datum->byte[ vp->objects_last_page ];
-
- vp->objects_last_page += len+1;
- vp->num_allocated += len+1;
-
- while (len-- > 0)
- *p++ = *start++;
-
- *p = '\0';
- }
-
- if (ret_hash != (shash_t **) 0)
- *ret_hash = hash_ptr;
-
- return hash_ptr->indx;
-}
-
-
-/* Add a local symbol. */
-
-STATIC symint_t
-add_local_symbol (str_start, str_end_p1, type, storage, value, indx)
- const char *str_start; /* first byte in string */
- const char *str_end_p1; /* first byte after string */
- st_t type; /* symbol type */
- sc_t storage; /* storage class */
- symint_t value; /* value of symbol */
- symint_t indx; /* index to local/aux. syms */
-{
- register symint_t ret;
- register SYMR *psym;
- register scope_t *pscope;
- register thead_t *ptag_head;
- register tag_t *ptag;
- register tag_t *ptag_next;
- register varray_t *vp = &cur_file_ptr->symbols;
- register int scope_delta = 0;
- shash_t *hash_ptr = (shash_t *) 0;
-
- if (vp->objects_last_page == vp->objects_per_page)
- add_varray_page (vp);
-
- psym = &vp->last->datum->sym[ vp->objects_last_page++ ];
-
- psym->value = value;
- psym->st = (unsigned) type;
- psym->sc = (unsigned) storage;
- psym->index = indx;
- psym->iss = (str_start == (const char *) 0)
- ? 0
- : add_string (&cur_file_ptr->strings,
- &cur_file_ptr->shash_head[0],
- str_start,
- str_end_p1,
- &hash_ptr);
-
- ret = vp->num_allocated++;
-
- if (MIPS_IS_STAB(psym))
- return ret;
-
- /* Save the symbol within the hash table if this is a static
- item, and it has a name. */
- if (hash_ptr != (shash_t *) 0
- && (type == st_Global || type == st_Static || type == st_Label
- || type == st_Proc || type == st_StaticProc))
- hash_ptr->sym_ptr = psym;
-
- /* push or pop a scope if appropriate. */
- switch (type)
- {
- default:
- break;
-
- case st_File: /* beginning of file */
- case st_Proc: /* procedure */
- case st_StaticProc: /* static procedure */
- case st_Block: /* begin scope */
- pscope = allocate_scope ();
- pscope->prev = cur_file_ptr->cur_scope;
- pscope->lsym = psym;
- pscope->lnumber = ret;
- pscope->type = type;
- cur_file_ptr->cur_scope = pscope;
-
- if (type != st_File)
- scope_delta = 1;
-
- /* For every block type except file, struct, union, or
- enumeration blocks, push a level on the tag stack. We omit
- file types, so that tags can span file boundaries. */
- if (type != st_File && storage != sc_Info)
- {
- ptag_head = allocate_thead ();
- ptag_head->first_tag = 0;
- ptag_head->prev = cur_tag_head;
- cur_tag_head = ptag_head;
- }
- break;
-
- case st_End:
- pscope = cur_file_ptr->cur_scope;
- if (pscope == (scope_t *)0)
- error ("internal error, too many st_End's");
-
- else
- {
- st_t begin_type = (st_t) pscope->lsym->st;
-
- if (begin_type != st_File)
- scope_delta = -1;
-
- /* Except for file, structure, union, or enumeration end
- blocks remove all tags created within this scope. */
- if (begin_type != st_File && storage != sc_Info)
- {
- ptag_head = cur_tag_head;
- cur_tag_head = ptag_head->prev;
-
- for (ptag = ptag_head->first_tag;
- ptag != (tag_t *) 0;
- ptag = ptag_next)
- {
- if (ptag->forward_ref != (forward_t *) 0)
- add_unknown_tag (ptag);
-
- ptag_next = ptag->same_block;
- ptag->hash_ptr->tag_ptr = ptag->same_name;
- free_tag (ptag);
- }
-
- free_thead (ptag_head);
- }
-
- cur_file_ptr->cur_scope = pscope->prev;
- psym->index = pscope->lnumber; /* blk end gets begin sym # */
-
- if (storage != sc_Info)
- psym->iss = pscope->lsym->iss; /* blk end gets same name */
-
- if (begin_type == st_File || begin_type == st_Block)
- pscope->lsym->index = ret+1; /* block begin gets next sym # */
-
- /* Functions push two or more aux words as follows:
- 1st word: index+1 of the end symbol
- 2nd word: type of the function (plus any aux words needed).
- Also, tie the external pointer back to the function begin symbol. */
- else
- {
- symint_t type;
- pscope->lsym->index = add_aux_sym_symint (ret+1);
- type = add_aux_sym_tir (&last_func_type_info,
- hash_no,
- &cur_file_ptr->thash_head[0]);
- if (last_func_eptr)
- {
- last_func_eptr->ifd = cur_file_ptr->file_index;
-
- /* The index for an external st_Proc symbol is the index
- of the st_Proc symbol in the local symbol table. */
- last_func_eptr->asym.index = psym->index;
- }
- }
-
- free_scope (pscope);
- }
- }
-
- cur_file_ptr->nested_scopes += scope_delta;
-
- if (debug && type != st_File
- && (debug > 2 || type == st_Block || type == st_End
- || type == st_Proc || type == st_StaticProc))
- {
- char *sc_str = sc_to_string (storage);
- char *st_str = st_to_string (type);
- int depth = cur_file_ptr->nested_scopes + (scope_delta < 0);
-
- fprintf (stderr,
- "\tlsym\tv= %10ld, depth= %2d, sc= %-12s",
- value, depth, sc_str);
-
- if (str_start && str_end_p1 - str_start > 0)
- fprintf (stderr, " st= %-11s name= %.*s\n", st_str, str_end_p1 - str_start, str_start);
- else
- {
- Size_t len = strlen (st_str);
- fprintf (stderr, " st= %.*s\n", len-1, st_str);
- }
- }
-
- return ret;
-}
-
-
-/* Add an external symbol. */
-
-STATIC symint_t
-add_ext_symbol (str_start, str_end_p1, type, storage, value, indx, ifd)
- const char *str_start; /* first byte in string */
- const char *str_end_p1; /* first byte after string */
- st_t type; /* symbol type */
- sc_t storage; /* storage class */
- long value; /* value of symbol */
- symint_t indx; /* index to local/aux. syms */
- int ifd; /* file index */
-{
- register EXTR *psym;
- register varray_t *vp = &ext_symbols;
- shash_t *hash_ptr = (shash_t *) 0;
-
- if (debug > 1)
- {
- char *sc_str = sc_to_string (storage);
- char *st_str = st_to_string (type);
-
- fprintf (stderr,
- "\tesym\tv= %10ld, ifd= %2d, sc= %-12s",
- value, ifd, sc_str);
-
- if (str_start && str_end_p1 - str_start > 0)
- fprintf (stderr, " st= %-11s name= %.*s\n", st_str, str_end_p1 - str_start, str_start);
- else
- fprintf (stderr, " st= %s\n", st_str);
- }
-
- if (vp->objects_last_page == vp->objects_per_page)
- add_varray_page (vp);
-
- psym = &vp->last->datum->esym[ vp->objects_last_page++ ];
-
- psym->ifd = ifd;
- psym->asym.value = value;
- psym->asym.st = (unsigned) type;
- psym->asym.sc = (unsigned) storage;
- psym->asym.index = indx;
- psym->asym.iss = (str_start == (const char *) 0)
- ? 0
- : add_string (&ext_strings,
- &ext_str_hash[0],
- str_start,
- str_end_p1,
- &hash_ptr);
-
- hash_ptr->esym_ptr = psym;
- return vp->num_allocated++;
-}
-
-
-/* Add an auxiliary symbol (passing a symint). */
-
-STATIC symint_t
-add_aux_sym_symint (aux_word)
- symint_t aux_word; /* auxiliary information word */
-{
- register AUXU *aux_ptr;
- register efdr_t *file_ptr = cur_file_ptr;
- register varray_t *vp = &file_ptr->aux_syms;
-
- if (vp->objects_last_page == vp->objects_per_page)
- add_varray_page (vp);
-
- aux_ptr = &vp->last->datum->aux[ vp->objects_last_page++ ];
- aux_ptr->isym = aux_word;
-
- return vp->num_allocated++;
-}
-
-
-/* Add an auxiliary symbol (passing a file/symbol index combo). */
-
-STATIC symint_t
-add_aux_sym_rndx (file_index, sym_index)
- int file_index;
- symint_t sym_index;
-{
- register AUXU *aux_ptr;
- register efdr_t *file_ptr = cur_file_ptr;
- register varray_t *vp = &file_ptr->aux_syms;
-
- if (vp->objects_last_page == vp->objects_per_page)
- add_varray_page (vp);
-
- aux_ptr = &vp->last->datum->aux[ vp->objects_last_page++ ];
- aux_ptr->rndx.rfd = file_index;
- aux_ptr->rndx.index = sym_index;
-
- return vp->num_allocated++;
-}
-
-
-/* Add an auxiliary symbol (passing the basic type and possibly
- type qualifiers). */
-
-STATIC symint_t
-add_aux_sym_tir (t, state, hash_tbl)
- type_info_t *t; /* current type information */
- hash_state_t state; /* whether to hash type or not */
- thash_t **hash_tbl; /* pointer to hash table to use */
-{
- register AUXU *aux_ptr;
- register efdr_t *file_ptr = cur_file_ptr;
- register varray_t *vp = &file_ptr->aux_syms;
- static AUXU init_aux;
- symint_t ret;
- int i;
- AUXU aux;
-
- aux = init_aux;
- aux.ti.bt = (int) t->basic_type;
- aux.ti.continued = 0;
- aux.ti.fBitfield = t->bitfield;
-
- aux.ti.tq0 = (int) t->type_qualifiers[0];
- aux.ti.tq1 = (int) t->type_qualifiers[1];
- aux.ti.tq2 = (int) t->type_qualifiers[2];
- aux.ti.tq3 = (int) t->type_qualifiers[3];
- aux.ti.tq4 = (int) t->type_qualifiers[4];
- aux.ti.tq5 = (int) t->type_qualifiers[5];
-
-
- /* For anything that adds additional information, we must not hash,
- so check here, and reset our state. */
-
- if (state != hash_no
- && (t->type_qualifiers[0] == tq_Array
- || t->type_qualifiers[1] == tq_Array
- || t->type_qualifiers[2] == tq_Array
- || t->type_qualifiers[3] == tq_Array
- || t->type_qualifiers[4] == tq_Array
- || t->type_qualifiers[5] == tq_Array
- || t->basic_type == bt_Struct
- || t->basic_type == bt_Union
- || t->basic_type == bt_Enum
- || t->bitfield
- || t->num_dims > 0))
- state = hash_no;
-
- /* See if we can hash this type, and save some space, but some types
- can't be hashed (because they contain arrays or continuations),
- and others can be put into the hash list, but cannot use existing
- types because other aux entries precede this one. */
-
- if (state != hash_no)
- {
- register thash_t *hash_ptr;
- register symint_t hi;
-
- hi = aux.isym & ((1 << HASHBITS) - 1);
- hi %= THASH_SIZE;
-
- for (hash_ptr = hash_tbl[hi];
- hash_ptr != (thash_t *) 0;
- hash_ptr = hash_ptr->next)
- {
- if (aux.isym == hash_ptr->type.isym)
- break;
- }
-
- if (hash_ptr != (thash_t *) 0 && state == hash_yes)
- return hash_ptr->indx;
-
- if (hash_ptr == (thash_t *) 0)
- {
- hash_ptr = allocate_thash ();
- hash_ptr->next = hash_tbl[hi];
- hash_ptr->type = aux;
- hash_ptr->indx = vp->num_allocated;
- hash_tbl[hi] = hash_ptr;
- }
- }
-
- /* Everything is set up, add the aux symbol. */
- if (vp->objects_last_page == vp->objects_per_page)
- add_varray_page (vp);
-
- aux_ptr = &vp->last->datum->aux[ vp->objects_last_page++ ];
- *aux_ptr = aux;
-
- ret = vp->num_allocated++;
-
- /* Add bitfield length if it exists.
-
- NOTE: Mips documentation claims bitfield goes at the end of the
- AUX record, but the DECstation compiler emits it here.
- (This would only make a difference for enum bitfields.)
-
- Also note: We use the last size given since gcc may emit 2
- for an enum bitfield. */
-
- if (t->bitfield)
- (void) add_aux_sym_symint ((symint_t)t->sizes[t->num_sizes-1]);
-
-
- /* Add tag information if needed. Structure, union, and enum
- references add 2 aux symbols: a [file index, symbol index]
- pointer to the structure type, and the current file index. */
-
- if (t->basic_type == bt_Struct
- || t->basic_type == bt_Union
- || t->basic_type == bt_Enum)
- {
- register symint_t file_index = t->tag_ptr->ifd;
- register symint_t sym_index = t->tag_ptr->indx;
-
- if (t->unknown_tag)
- {
- (void) add_aux_sym_rndx (ST_RFDESCAPE, sym_index);
- (void) add_aux_sym_symint ((symint_t)-1);
- }
- else if (sym_index != indexNil)
- {
- (void) add_aux_sym_rndx (ST_RFDESCAPE, sym_index);
- (void) add_aux_sym_symint (file_index);
- }
- else
- {
- register forward_t *forward_ref = allocate_forward ();
-
- forward_ref->type_ptr = aux_ptr;
- forward_ref->next = t->tag_ptr->forward_ref;
- t->tag_ptr->forward_ref = forward_ref;
-
- (void) add_aux_sym_rndx (ST_RFDESCAPE, sym_index);
- forward_ref->index_ptr
- = &vp->last->datum->aux[ vp->objects_last_page - 1];
-
- (void) add_aux_sym_symint (file_index);
- forward_ref->ifd_ptr
- = &vp->last->datum->aux[ vp->objects_last_page - 1];
- }
- }
-
- /* Add information about array bounds if they exist. */
- for (i = 0; i < t->num_dims; i++)
- {
- (void) add_aux_sym_rndx (ST_RFDESCAPE,
- cur_file_ptr->int_type);
-
- (void) add_aux_sym_symint (cur_file_ptr->file_index); /* file index*/
- (void) add_aux_sym_symint ((symint_t) 0); /* low bound */
- (void) add_aux_sym_symint (t->dimensions[i] - 1); /* high bound*/
- (void) add_aux_sym_symint ((t->dimensions[i] == 0) /* stride */
- ? 0
- : (t->sizes[i] * 8) / t->dimensions[i]);
- };
-
- /* NOTE: Mips documentation claims that the bitfield width goes here.
- But it needs to be emitted earlier. */
-
- return ret;
-}
-
-
-/* Add a tag to the tag table (unless it already exists). */
-
-STATIC tag_t *
-get_tag (tag_start, tag_end_p1, indx, basic_type)
- const char *tag_start; /* 1st byte of tag name */
- const char *tag_end_p1; /* 1st byte after tag name */
- symint_t indx; /* index of tag start block */
- bt_t basic_type; /* bt_Struct, bt_Union, or bt_Enum */
-{
- shash_t *hash_ptr;
- tag_t *tag_ptr;
- hash_ptr = hash_string (tag_start,
- tag_end_p1 - tag_start,
- &tag_hash[0],
- (symint_t *) 0);
-
- if (hash_ptr != (shash_t *) 0
- && hash_ptr->tag_ptr != (tag_t *) 0)
- {
- tag_ptr = hash_ptr->tag_ptr;
- if (indx != indexNil)
- {
- tag_ptr->basic_type = basic_type;
- tag_ptr->ifd = cur_file_ptr->file_index;
- tag_ptr->indx = indx;
- }
- return tag_ptr;
- }
-
- (void) add_string (&tag_strings,
- &tag_hash[0],
- tag_start,
- tag_end_p1,
- &hash_ptr);
-
- tag_ptr = allocate_tag ();
- tag_ptr->forward_ref = (forward_t *) 0;
- tag_ptr->hash_ptr = hash_ptr;
- tag_ptr->same_name = hash_ptr->tag_ptr;
- tag_ptr->basic_type = basic_type;
- tag_ptr->indx = indx;
- tag_ptr->ifd = (indx == indexNil) ? -1 : cur_file_ptr->file_index;
- tag_ptr->same_block = cur_tag_head->first_tag;
-
- cur_tag_head->first_tag = tag_ptr;
- hash_ptr->tag_ptr = tag_ptr;
-
- return tag_ptr;
-}
-
-
-/* Add an unknown {struct, union, enum} tag. */
-
-STATIC void
-add_unknown_tag (ptag)
- tag_t *ptag; /* pointer to tag information */
-{
- shash_t *hash_ptr = ptag->hash_ptr;
- char *name_start = hash_ptr->string;
- char *name_end_p1 = name_start + hash_ptr->len;
- forward_t *f_next = ptag->forward_ref;
- forward_t *f_cur;
- int sym_index;
- int file_index = cur_file_ptr->file_index;
-
- if (debug > 1)
- {
- char *agg_type = "{unknown aggregate type}";
- switch (ptag->basic_type)
- {
- case bt_Struct: agg_type = "struct"; break;
- case bt_Union: agg_type = "union"; break;
- case bt_Enum: agg_type = "enum"; break;
- default: break;
- }
-
- fprintf (stderr, "unknown %s %.*s found\n", agg_type,
- hash_ptr->len, name_start);
- }
-
- sym_index = add_local_symbol (name_start,
- name_end_p1,
- st_Block,
- sc_Info,
- (symint_t) 0,
- (symint_t) 0);
-
- (void) add_local_symbol (name_start,
- name_end_p1,
- st_End,
- sc_Info,
- (symint_t) 0,
- (symint_t) 0);
-
- while (f_next != (forward_t *) 0)
- {
- f_cur = f_next;
- f_next = f_next->next;
-
- f_cur->ifd_ptr->isym = file_index;
- f_cur->index_ptr->rndx.index = sym_index;
-
- free_forward (f_cur);
- }
-
- return;
-}
-
-
-/* Add a procedure to the current file's list of procedures, and record
- this is the current procedure. If the assembler created a PDR for
- this procedure, use that to initialize the current PDR. */
-
-STATIC void
-add_procedure (func_start, func_end_p1)
- const char *func_start; /* 1st byte of func name */
- const char *func_end_p1; /* 1st byte after func name */
-{
- register PDR *new_proc_ptr;
- register efdr_t *file_ptr = cur_file_ptr;
- register varray_t *vp = &file_ptr->procs;
- register symint_t value = 0;
- register st_t proc_type = st_Proc;
- register shash_t *shash_ptr = hash_string (func_start,
- func_end_p1 - func_start,
- &orig_str_hash[0],
- (symint_t *) 0);
-
- if (debug)
- fputc ('\n', stderr);
-
- if (vp->objects_last_page == vp->objects_per_page)
- add_varray_page (vp);
-
- cur_proc_ptr = new_proc_ptr = &vp->last->datum->proc[ vp->objects_last_page++ ];
-
- vp->num_allocated++;
-
-
- /* Did the assembler create this procedure? If so, get the PDR information. */
- cur_oproc_ptr = (PDR *) 0;
- if (shash_ptr != (shash_t *) 0)
- {
- register PDR *old_proc_ptr = shash_ptr->proc_ptr;
- register SYMR *sym_ptr = shash_ptr->sym_ptr;
-
- if (old_proc_ptr != (PDR *) 0
- && sym_ptr != (SYMR *) 0
- && ((st_t)sym_ptr->st == st_Proc || (st_t)sym_ptr->st == st_StaticProc))
- {
- cur_oproc_begin = sym_ptr;
- cur_oproc_end = shash_ptr->end_ptr;
- value = sym_ptr->value;
-
- cur_oproc_ptr = old_proc_ptr;
- proc_type = (st_t)sym_ptr->st;
- *new_proc_ptr = *old_proc_ptr; /* initialize */
- }
- }
-
- if (cur_oproc_ptr == (PDR *) 0)
- error ("Did not find a PDR block for %.*s", func_end_p1 - func_start, func_start);
-
- /* Determine the start of symbols. */
- new_proc_ptr->isym = file_ptr->symbols.num_allocated;
-
- /* Push the start of the function. */
- (void) add_local_symbol (func_start, func_end_p1,
- proc_type, sc_Text,
- value,
- (symint_t) 0);
-}
-
-
-/* Add a new filename, and set up all of the file relative
- virtual arrays (strings, symbols, aux syms, etc.). Record
- where the current file structure lives. */
-
-STATIC void
-add_file (file_start, file_end_p1)
- const char *file_start; /* first byte in string */
- const char *file_end_p1; /* first byte after string */
-{
- static char zero_bytes[2] = { '\0', '\0' };
-
- register Ptrdiff_t len = file_end_p1 - file_start;
- register int first_ch = *file_start;
- register efdr_t *file_ptr;
-
- if (debug)
- fprintf (stderr, "\tfile\t%.*s\n", len, file_start);
-
- /* See if the file has already been created. */
- for (file_ptr = first_file;
- file_ptr != (efdr_t *) 0;
- file_ptr = file_ptr->next_file)
- {
- if (first_ch == file_ptr->name[0]
- && file_ptr->name[len] == '\0'
- && memcmp ((CPTR_T) file_start, (CPTR_T) file_ptr->name, len) == 0)
- {
- cur_file_ptr = file_ptr;
- break;
- }
- }
-
- /* If this is a new file, create it. */
- if (file_ptr == (efdr_t *) 0)
- {
- if (file_desc.objects_last_page == file_desc.objects_per_page)
- add_varray_page (&file_desc);
-
- file_ptr = cur_file_ptr =
- &file_desc.last->datum->file[ file_desc.objects_last_page++ ];
- *file_ptr = init_file;
-
- file_ptr->file_index = file_desc.num_allocated++;
-
- /* Allocate the string hash table. */
- file_ptr->shash_head = (shash_t **) allocate_page ();
-
- /* Make sure 0 byte in string table is null */
- add_string (&file_ptr->strings,
- &file_ptr->shash_head[0],
- &zero_bytes[0],
- &zero_bytes[0],
- (shash_t **) 0);
-
- if (file_end_p1 - file_start > PAGE_USIZE-2)
- fatal ("Filename goes over one page boundary.");
-
- /* Push the start of the filename. We assume that the filename
- will be stored at string offset 1. */
- (void) add_local_symbol (file_start, file_end_p1, st_File, sc_Text,
- (symint_t) 0, (symint_t) 0);
- file_ptr->fdr.rss = 1;
- file_ptr->name = &file_ptr->strings.last->datum->byte[1];
- file_ptr->name_len = file_end_p1 - file_start;
-
- /* Update the linked list of file descriptors. */
- *last_file_ptr = file_ptr;
- last_file_ptr = &file_ptr->next_file;
-
- /* Add void & int types to the file (void should be first to catch
- errant 0's within the index fields). */
- file_ptr->void_type = add_aux_sym_tir (&void_type_info,
- hash_yes,
- &cur_file_ptr->thash_head[0]);
-
- file_ptr->int_type = add_aux_sym_tir (&int_type_info,
- hash_yes,
- &cur_file_ptr->thash_head[0]);
- }
-}
-
-
-/* Add a stream of random bytes to a varray. */
-
-STATIC void
-add_bytes (vp, input_ptr, nitems)
- varray_t *vp; /* virtual array to add too */
- char *input_ptr; /* start of the bytes */
- Size_t nitems; /* # items to move */
-{
- register Size_t move_items;
- register Size_t move_bytes;
- register char *ptr;
-
- while (nitems > 0)
- {
- if (vp->objects_last_page >= vp->objects_per_page)
- add_varray_page (vp);
-
- ptr = &vp->last->datum->byte[ vp->objects_last_page * vp->object_size ];
- move_items = vp->objects_per_page - vp->objects_last_page;
- if (move_items > nitems)
- move_items = nitems;
-
- move_bytes = move_items * vp->object_size;
- nitems -= move_items;
-
- if (move_bytes >= 32)
- {
- (void) memcpy ((PTR_T) ptr, (CPTR_T) input_ptr, move_bytes);
- input_ptr += move_bytes;
- }
- else
- {
- while (move_bytes-- > 0)
- *ptr++ = *input_ptr++;
- }
- }
-}
-
-
-/* Convert storage class to string. */
-
-STATIC char *
-sc_to_string(storage_class)
- sc_t storage_class;
-{
- switch(storage_class)
- {
- case sc_Nil: return "Nil,";
- case sc_Text: return "Text,";
- case sc_Data: return "Data,";
- case sc_Bss: return "Bss,";
- case sc_Register: return "Register,";
- case sc_Abs: return "Abs,";
- case sc_Undefined: return "Undefined,";
- case sc_CdbLocal: return "CdbLocal,";
- case sc_Bits: return "Bits,";
- case sc_CdbSystem: return "CdbSystem,";
- case sc_RegImage: return "RegImage,";
- case sc_Info: return "Info,";
- case sc_UserStruct: return "UserStruct,";
- case sc_SData: return "SData,";
- case sc_SBss: return "SBss,";
- case sc_RData: return "RData,";
- case sc_Var: return "Var,";
- case sc_Common: return "Common,";
- case sc_SCommon: return "SCommon,";
- case sc_VarRegister: return "VarRegister,";
- case sc_Variant: return "Variant,";
- case sc_SUndefined: return "SUndefined,";
- case sc_Init: return "Init,";
- case sc_Max: return "Max,";
- }
-
- return "???,";
-}
-
-
-/* Convert symbol type to string. */
-
-STATIC char *
-st_to_string(symbol_type)
- st_t symbol_type;
-{
- switch(symbol_type)
- {
- case st_Nil: return "Nil,";
- case st_Global: return "Global,";
- case st_Static: return "Static,";
- case st_Param: return "Param,";
- case st_Local: return "Local,";
- case st_Label: return "Label,";
- case st_Proc: return "Proc,";
- case st_Block: return "Block,";
- case st_End: return "End,";
- case st_Member: return "Member,";
- case st_Typedef: return "Typedef,";
- case st_File: return "File,";
- case st_RegReloc: return "RegReloc,";
- case st_Forward: return "Forward,";
- case st_StaticProc: return "StaticProc,";
- case st_Constant: return "Constant,";
- case st_Str: return "String,";
- case st_Number: return "Number,";
- case st_Expr: return "Expr,";
- case st_Type: return "Type,";
- case st_Max: return "Max,";
- }
-
- return "???,";
-}
-
-
-/* Read a line from standard input, and return the start of the buffer
- (which is grows if the line is too big). We split lines at the
- semi-colon, and return each logical line independently. */
-
-STATIC char *
-read_line __proto((void))
-{
- static int line_split_p = 0;
- register int string_p = 0;
- register int comment_p = 0;
- register int ch;
- register char *ptr;
-
- if (cur_line_start == (char *) 0)
- { /* allocate initial page */
- cur_line_start = (char *) allocate_page ();
- cur_line_alloc = PAGE_SIZE;
- }
-
- if (!line_split_p)
- line_number++;
-
- line_split_p = 0;
- cur_line_nbytes = 0;
-
- for (ptr = cur_line_start; (ch = getchar ()) != EOF; *ptr++ = ch)
- {
- if (++cur_line_nbytes >= cur_line_alloc-1)
- {
- register int num_pages = cur_line_alloc / PAGE_SIZE;
- register char *old_buffer = cur_line_start;
-
- cur_line_alloc += PAGE_SIZE;
- cur_line_start = (char *) allocate_multiple_pages (num_pages+1);
- memcpy (cur_line_start, old_buffer, num_pages * PAGE_SIZE);
-
- ptr = cur_line_start + cur_line_nbytes - 1;
- }
-
- if (ch == '\n')
- {
- *ptr++ = '\n';
- *ptr = '\0';
- cur_line_ptr = cur_line_start;
- return cur_line_ptr;
- }
-
- else if (ch == '\0')
- error ("Null character found in input");
-
- else if (!comment_p)
- {
- if (ch == '"')
- string_p = !string_p;
-
- else if (ch == '#')
- comment_p++;
-
- else if (ch == ';' && !string_p)
- {
- line_split_p = 1;
- *ptr++ = '\n';
- *ptr = '\0';
- cur_line_ptr = cur_line_start;
- return cur_line_ptr;
- }
- }
- }
-
- if (ferror (stdin))
- pfatal_with_name (input_name);
-
- cur_line_ptr = (char *) 0;
- return (char *) 0;
-}
-
-
-/* Parse #.begin directives which have a label as the first argument
- which gives the location of the start of the block. */
-
-STATIC void
-parse_begin (start)
- const char *start; /* start of directive */
-{
- const char *end_p1; /* end of label */
- int ch;
- shash_t *hash_ptr; /* hash pointer to lookup label */
-
- if (cur_file_ptr == (efdr_t *) 0)
- {
- error ("#.begin directive without a preceding .file directive");
- return;
- }
-
- if (cur_proc_ptr == (PDR *) 0)
- {
- error ("#.begin directive without a preceding .ent directive");
- return;
- }
-
- for (end_p1 = start; (ch = *end_p1) != '\0' && !isspace (ch); end_p1++)
- ;
-
- hash_ptr = hash_string (start,
- end_p1 - start,
- &orig_str_hash[0],
- (symint_t *) 0);
-
- if (hash_ptr == (shash_t *) 0)
- {
- error ("Label %.*s not found for #.begin", end_p1 - start, start);
- return;
- }
-
- if (cur_oproc_begin == (SYMR *) 0)
- {
- error ("Procedure table %.*s not found for #.begin", end_p1 - start, start);
- return;
- }
-
- (void) add_local_symbol ((const char *) 0, (const char *) 0,
- st_Block, sc_Text,
- (symint_t) hash_ptr->sym_ptr->value - cur_oproc_begin->value,
- (symint_t) 0);
-}
-
-
-/* Parse #.bend directives which have a label as the first argument
- which gives the location of the end of the block. */
-
-STATIC void
-parse_bend (start)
- const char *start; /* start of directive */
-{
- const char *end_p1; /* end of label */
- int ch;
- shash_t *hash_ptr; /* hash pointer to lookup label */
-
- if (cur_file_ptr == (efdr_t *) 0)
- {
- error ("#.begin directive without a preceding .file directive");
- return;
- }
-
- if (cur_proc_ptr == (PDR *) 0)
- {
- error ("#.bend directive without a preceding .ent directive");
- return;
- }
-
- for (end_p1 = start; (ch = *end_p1) != '\0' && !isspace (ch); end_p1++)
- ;
-
- hash_ptr = hash_string (start,
- end_p1 - start,
- &orig_str_hash[0],
- (symint_t *) 0);
-
- if (hash_ptr == (shash_t *) 0)
- {
- error ("Label %.*s not found for #.bend", end_p1 - start, start);
- return;
- }
-
- if (cur_oproc_begin == (SYMR *) 0)
- {
- error ("Procedure table %.*s not found for #.bend", end_p1 - start, start);
- return;
- }
-
- (void) add_local_symbol ((const char *) 0, (const char *) 0,
- st_End, sc_Text,
- (symint_t)hash_ptr->sym_ptr->value - cur_oproc_begin->value,
- (symint_t) 0);
-}
-
-
-/* Parse #.def directives, which are contain standard COFF subdirectives
- to describe the debugging format. These subdirectives include:
-
- .scl specify storage class
- .val specify a value
- .endef specify end of COFF directives
- .type specify the type
- .size specify the size of an array
- .dim specify an array dimension
- .tag specify a tag for a struct, union, or enum. */
-
-STATIC void
-parse_def (name_start)
- const char *name_start; /* start of directive */
-{
- const char *dir_start; /* start of current directive*/
- const char *dir_end_p1; /* end+1 of current directive*/
- const char *arg_start; /* start of current argument */
- const char *arg_end_p1; /* end+1 of current argument */
- const char *name_end_p1; /* end+1 of label */
- const char *tag_start = (const char *) 0; /* start of tag name */
- const char *tag_end_p1 = (const char *) 0; /* end+1 of tag name */
- sc_t storage_class = sc_Nil;
- st_t symbol_type = st_Nil;
- type_info_t t;
- EXTR *eptr = (EXTR *) 0; /* ext. sym equivalent to def*/
- int is_function = 0; /* != 0 if function */
- symint_t value = 0;
- symint_t indx = cur_file_ptr->void_type;
- int error_line = 0;
- symint_t arg_number;
- symint_t temp_array[ N_TQ ];
- int arg_was_number;
- int ch, i;
- Ptrdiff_t len;
-
- static int inside_enumeration = 0; /* is this an enumeration? */
-
-
- /* Initialize the type information. */
- t = type_info_init;
-
-
- /* Search for the end of the name being defined. */
- /* Allow spaces and such in names for G++ templates, which produce stabs
- that look like:
-
- #.def SMANIP<long unsigned int>; .scl 10; .type 0x8; .size 8; .endef */
-
- for (name_end_p1 = name_start; (ch = *name_end_p1) != ';' && ch != '\0'; name_end_p1++)
- ;
-
- if (ch == '\0')
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
- /* Parse the remaining subdirectives now. */
- dir_start = name_end_p1+1;
- for (;;)
- {
- while ((ch = *dir_start) == ' ' || ch == '\t')
- ++dir_start;
-
- if (ch != '.')
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
- /* Are we done? */
- if (dir_start[1] == 'e'
- && memcmp (dir_start, ".endef", sizeof (".endef")-1) == 0)
- break;
-
- /* Pick up the subdirective now */
- for (dir_end_p1 = dir_start+1;
- (ch = *dir_end_p1) != ' ' && ch != '\t';
- dir_end_p1++)
- {
- if (ch == '\0' || isspace (ch))
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
- }
-
- /* Pick up the subdirective argument now. */
- arg_was_number = arg_number = 0;
- arg_end_p1 = (const char *) 0;
- arg_start = dir_end_p1+1;
- ch = *arg_start;
- while (ch == ' ' || ch == '\t')
- ch = *++arg_start;
-
- if (isdigit (ch) || ch == '-' || ch == '+')
- {
- int ch2;
- arg_number = strtol (arg_start, (char **) &arg_end_p1, 0);
- if (arg_end_p1 != arg_start || (ch2 = *arg_end_p1 != ';') || ch2 != ',')
- arg_was_number++;
- }
-
- else if (ch == '\0' || isspace (ch))
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
- if (!arg_was_number)
- {
- /* Allow spaces and such in names for G++ templates. */
- for (arg_end_p1 = arg_start+1;
- (ch = *arg_end_p1) != ';' && ch != '\0';
- arg_end_p1++)
- ;
-
- if (ch == '\0')
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
- }
-
- /* Classify the directives now. */
- len = dir_end_p1 - dir_start;
- switch (dir_start[1])
- {
- default:
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
-
- case 'd':
- if (len == sizeof (".dim")-1
- && memcmp (dir_start, ".dim", sizeof (".dim")-1) == 0
- && arg_was_number)
- {
- symint_t *t_ptr = &temp_array[ N_TQ-1 ];
-
- *t_ptr = arg_number;
- while (*arg_end_p1 == ',' && arg_was_number)
- {
- arg_start = arg_end_p1+1;
- ch = *arg_start;
- while (ch == ' ' || ch == '\t')
- ch = *++arg_start;
-
- arg_was_number = 0;
- if (isdigit (ch) || ch == '-' || ch == '+')
- {
- int ch2;
- arg_number = strtol (arg_start, (char **) &arg_end_p1, 0);
- if (arg_end_p1 != arg_start || (ch2 = *arg_end_p1 != ';') || ch2 != ',')
- arg_was_number++;
-
- if (t_ptr == &temp_array[0])
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
- *--t_ptr = arg_number;
- }
- }
-
- /* Reverse order of dimensions. */
- while (t_ptr <= &temp_array[ N_TQ-1 ])
- {
- if (t.num_dims >= N_TQ-1)
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
- t.dimensions[ t.num_dims++ ] = *t_ptr++;
- }
- break;
- }
- else
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
-
- case 's':
- if (len == sizeof (".scl")-1
- && memcmp (dir_start, ".scl", sizeof (".scl")-1) == 0
- && arg_was_number
- && arg_number < ((symint_t) C_MAX))
- {
- /* If the symbol is a static or external, we have
- already gotten the appropriate type and class, so
- make sure we don't override those values. This is
- needed because there are some type and classes that
- are not in COFF, such as short data, etc. */
- if (symbol_type == st_Nil)
- {
- symbol_type = map_coff_sym_type[arg_number];
- storage_class = map_coff_storage [arg_number];
- }
- break;
- }
-
- else if (len == sizeof (".size")-1
- && memcmp (dir_start, ".size", sizeof (".size")-1) == 0
- && arg_was_number)
- {
- symint_t *t_ptr = &temp_array[ N_TQ-1 ];
-
- *t_ptr = arg_number;
- while (*arg_end_p1 == ',' && arg_was_number)
- {
- arg_start = arg_end_p1+1;
- ch = *arg_start;
- while (ch == ' ' || ch == '\t')
- ch = *++arg_start;
-
- arg_was_number = 0;
- if (isdigit (ch) || ch == '-' || ch == '+')
- {
- int ch2;
- arg_number = strtol (arg_start, (char **) &arg_end_p1, 0);
- if (arg_end_p1 != arg_start || (ch2 = *arg_end_p1 != ';') || ch2 != ',')
- arg_was_number++;
-
- if (t_ptr == &temp_array[0])
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
- *--t_ptr = arg_number;
- }
- }
-
- /* Reverse order of sizes. */
- while (t_ptr <= &temp_array[ N_TQ-1 ])
- {
- if (t.num_sizes >= N_TQ-1)
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
- t.sizes[ t.num_sizes++ ] = *t_ptr++;
- }
- break;
- }
-
- else
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
-
- case 't':
- if (len == sizeof (".type")-1
- && memcmp (dir_start, ".type", sizeof (".type")-1) == 0
- && arg_was_number)
- {
- tq_t *tq_ptr = &t.type_qualifiers[0];
-
- t.orig_type = (coff_type_t) (arg_number & N_BTMASK);
- t.basic_type = map_coff_types [(int)t.orig_type];
- for (i = N_TQ-1; i >= 0; i--)
- {
- int dt = (arg_number >> ((i * N_TQ_SHIFT) + N_BT_SHIFT)
- & N_TMASK);
-
- if (dt != (int)DT_NON)
- *tq_ptr++ = map_coff_derived_type [dt];
- }
-
- /* If this is a function, ignore it, so that we don't get
- two entries (one from the .ent, and one for the .def
- that precedes it). Save the type information so that
- the end block can properly add it after the begin block
- index. For MIPS knows what reason, we must strip off
- the function type at this point. */
- if (tq_ptr != &t.type_qualifiers[0] && tq_ptr[-1] == tq_Proc)
- {
- is_function = 1;
- tq_ptr[-1] = tq_Nil;
- }
-
- break;
- }
-
- else if (len == sizeof (".tag")-1
- && memcmp (dir_start, ".tag", sizeof (".tag")-1) == 0)
- {
- tag_start = arg_start;
- tag_end_p1 = arg_end_p1;
- break;
- }
-
- else
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
-
- case 'v':
- if (len == sizeof (".val")-1
- && memcmp (dir_start, ".val", sizeof (".val")-1) == 0)
- {
- if (arg_was_number)
- value = arg_number;
-
- /* If the value is not an integer value, it must be the
- name of a static or global item. Look up the name in
- the original symbol table to pick up the storage
- class, symbol type, etc. */
- else
- {
- shash_t *orig_hash_ptr; /* hash within orig sym table*/
- shash_t *ext_hash_ptr; /* hash within ext. sym table*/
-
- ext_hash_ptr = hash_string (arg_start,
- arg_end_p1 - arg_start,
- &ext_str_hash[0],
- (symint_t *) 0);
-
- if (ext_hash_ptr != (shash_t *) 0
- && ext_hash_ptr->esym_ptr != (EXTR *) 0)
- eptr = ext_hash_ptr->esym_ptr;
-
- orig_hash_ptr = hash_string (arg_start,
- arg_end_p1 - arg_start,
- &orig_str_hash[0],
- (symint_t *) 0);
-
- if ((orig_hash_ptr == (shash_t *) 0
- || orig_hash_ptr->sym_ptr == (SYMR *) 0)
- && eptr == (EXTR *) 0)
- {
- fprintf (stderr, "warning, %.*s not found in original or external symbol tables, value defaults to 0\n",
- arg_end_p1 - arg_start,
- arg_start);
- value = 0;
- }
- else
- {
- SYMR *ptr = (orig_hash_ptr != (shash_t *) 0
- && orig_hash_ptr->sym_ptr != (SYMR *) 0)
- ? orig_hash_ptr->sym_ptr
- : &eptr->asym;
-
- symbol_type = (st_t) ptr->st;
- storage_class = (sc_t) ptr->sc;
- value = ptr->value;
- }
- }
- break;
- }
- else
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
- }
-
- /* Set up to find next directive. */
- dir_start = arg_end_p1 + 1;
- }
-
-
- t.extra_sizes = (tag_start != (char *) 0);
- if (t.num_dims > 0)
- {
- int diff = t.num_dims - t.num_sizes;
- int i = t.num_dims - 1;
- int j;
-
- if (t.num_sizes != 1 || diff < 0)
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
- /* If this is an array, make sure the same number of dimensions
- and sizes were passed, creating extra sizes for multiply
- dimensioned arrays if not passed. */
-
- t.extra_sizes = 0;
- if (diff)
- {
- for (j = (sizeof (t.sizes) / sizeof (t.sizes[0])) - 1; j >= 0; j--)
- t.sizes[ j ] = ((j-diff) >= 0) ? t.sizes[ j-diff ] : 0;
-
- t.num_sizes = i + 1;
- for ( i--; i >= 0; i-- )
- {
- if (t.dimensions[ i+1 ])
- t.sizes[ i ] = t.sizes[ i+1 ] / t.dimensions[ i+1 ];
- else
- t.sizes[ i ] = t.sizes[ i+1 ];
- }
- }
- }
-
- else if (symbol_type == st_Member && t.num_sizes - t.extra_sizes == 1)
- { /* Is this a bitfield? This is indicated by a structure member
- having a size field that isn't an array. */
-
- t.bitfield = 1;
- }
-
-
- /* Except for enumeration members & begin/ending of scopes, put the
- type word in the aux. symbol table. */
-
- if (symbol_type == st_Block || symbol_type == st_End)
- indx = 0;
-
- else if (inside_enumeration)
- indx = cur_file_ptr->void_type;
-
- else
- {
- if (t.basic_type == bt_Struct
- || t.basic_type == bt_Union
- || t.basic_type == bt_Enum)
- {
- if (tag_start == (char *) 0)
- {
- error ("No tag specified for %.*s",
- name_end_p1 - name_start,
- name_start);
- return;
- }
-
- t.tag_ptr = get_tag (tag_start, tag_end_p1, (symint_t)indexNil,
- t.basic_type);
- }
-
- if (is_function)
- {
- last_func_type_info = t;
- last_func_eptr = eptr;
- return;
- }
-
- indx = add_aux_sym_tir (&t,
- hash_yes,
- &cur_file_ptr->thash_head[0]);
- }
-
-
- /* If this is an external or static symbol, update the appropriate
- external symbol. */
-
- if (eptr != (EXTR *) 0
- && (eptr->asym.index == indexNil || cur_proc_ptr == (PDR *) 0))
- {
- eptr->ifd = cur_file_ptr->file_index;
- eptr->asym.index = indx;
- }
-
-
- /* Do any last minute adjustments that are necessary. */
- switch (symbol_type)
- {
- default:
- break;
-
-
- /* For the beginning of structs, unions, and enumerations, the
- size info needs to be passed in the value field. */
-
- case st_Block:
- if (t.num_sizes - t.num_dims - t.extra_sizes != 1)
- {
- error_line = __LINE__;
- saber_stop ();
- goto bomb_out;
- }
-
- else
- value = t.sizes[0];
-
- inside_enumeration = (t.orig_type == T_ENUM);
- break;
-
-
- /* For the end of structs, unions, and enumerations, omit the
- name which is always ".eos". This needs to be done last, so
- that any error reporting above gives the correct name. */
-
- case st_End:
- name_start = name_end_p1 = (const char *) 0;
- value = inside_enumeration = 0;
- break;
-
-
- /* Members of structures and unions that aren't bitfields, need
- to adjust the value from a byte offset to a bit offset.
- Members of enumerations do not have the value adjusted, and
- can be distinguished by indx == indexNil. For enumerations,
- update the maximum enumeration value. */
-
- case st_Member:
- if (!t.bitfield && !inside_enumeration)
- value *= 8;
-
- break;
- }
-
-
- /* Add the symbol, except for global symbols outside of functions,
- for which the external symbol table is fine enough. */
-
- if (eptr == (EXTR *) 0
- || eptr->asym.st == (int)st_Nil
- || cur_proc_ptr != (PDR *) 0)
- {
- symint_t isym = add_local_symbol (name_start, name_end_p1,
- symbol_type, storage_class,
- value,
- indx);
-
- /* deal with struct, union, and enum tags. */
- if (symbol_type == st_Block)
- {
- /* Create or update the tag information. */
- tag_t *tag_ptr = get_tag (name_start,
- name_end_p1,
- isym,
- t.basic_type);
-
- /* If there are any forward references, fill in the appropriate
- file and symbol indexes. */
-
- symint_t file_index = cur_file_ptr->file_index;
- forward_t *f_next = tag_ptr->forward_ref;
- forward_t *f_cur;
-
- while (f_next != (forward_t *) 0)
- {
- f_cur = f_next;
- f_next = f_next->next;
-
- f_cur->ifd_ptr->isym = file_index;
- f_cur->index_ptr->rndx.index = isym;
-
- free_forward (f_cur);
- }
-
- tag_ptr->forward_ref = (forward_t *) 0;
- }
- }
-
- /* Normal return */
- return;
-
- /* Error return, issue message. */
-bomb_out:
- if (error_line)
- error ("compiler error, badly formed #.def (internal line # = %d)", error_line);
- else
- error ("compiler error, badly formed #.def");
-
- return;
-}
-
-
-/* Parse .end directives. */
-
-STATIC void
-parse_end (start)
- const char *start; /* start of directive */
-{
- register const char *start_func, *end_func_p1;
- register int ch;
- register symint_t value;
- register FDR *orig_fdr;
-
- if (cur_file_ptr == (efdr_t *) 0)
- {
- error (".end directive without a preceding .file directive");
- return;
- }
-
- if (cur_proc_ptr == (PDR *) 0)
- {
- error (".end directive without a preceding .ent directive");
- return;
- }
-
- /* Get the function name, skipping whitespace. */
- for (start_func = start; isspace (*start_func); start_func++)
- ;
-
- ch = *start_func;
- if (!IS_ASM_IDENT (ch))
- {
- error (".end directive has no name");
- return;
- }
-
- for (end_func_p1 = start_func; IS_ASM_IDENT (ch); ch = *++end_func_p1)
- ;
-
-
- /* Get the value field for creating the end from the original object
- file (which we find by locating the procedure start, and using the
- pointer to the end+1 block and backing up. The index points to a
- two word aux. symbol, whose first word is the index of the end
- symbol, and the second word is the type of the function return
- value. */
-
- orig_fdr = cur_file_ptr->orig_fdr;
- value = 0;
- if (orig_fdr != (FDR *)0 && cur_oproc_end != (SYMR *) 0)
- value = cur_oproc_end->value;
-
- else
- error ("Cannot find .end block for %.*s", end_func_p1 - start_func, start_func);
-
- (void) add_local_symbol (start_func, end_func_p1,
- st_End, sc_Text,
- value,
- (symint_t) 0);
-
- cur_proc_ptr = cur_oproc_ptr = (PDR *) 0;
-}
-
-
-/* Parse .ent directives. */
-
-STATIC void
-parse_ent (start)
- const char *start; /* start of directive */
-{
- register const char *start_func, *end_func_p1;
- register int ch;
-
- if (cur_file_ptr == (efdr_t *) 0)
- {
- error (".ent directive without a preceding .file directive");
- return;
- }
-
- if (cur_proc_ptr != (PDR *) 0)
- {
- error ("second .ent directive found before .end directive");
- return;
- }
-
- for (start_func = start; isspace (*start_func); start_func++)
- ;
-
- ch = *start_func;
- if (!IS_ASM_IDENT (ch))
- {
- error (".ent directive has no name");
- return;
- }
-
- for (end_func_p1 = start_func; IS_ASM_IDENT (ch); ch = *++end_func_p1)
- ;
-
- (void) add_procedure (start_func, end_func_p1);
-}
-
-
-/* Parse .file directives. */
-
-STATIC void
-parse_file (start)
- const char *start; /* start of directive */
-{
- char *p;
- register char *start_name, *end_name_p1;
-
- (void) strtol (start, &p, 0);
- if (start == p
- || (start_name = local_index (p, '"')) == (char *) 0
- || (end_name_p1 = local_rindex (++start_name, '"')) == (char *) 0)
- {
- error ("Invalid .file directive");
- return;
- }
-
- if (cur_proc_ptr != (PDR *) 0)
- {
- error ("No way to handle .file within .ent/.end section");
- return;
- }
-
- add_file (start_name, end_name_p1);
-}
-
-
-/* Make sure the @stabs symbol is emitted. */
-
-static void
-mark_stabs (start)
- const char *start; /* Start of directive (ignored) */
-{
- if (!stabs_seen)
- {
- /* Add a dummy @stabs symbol. */
- stabs_seen = 1;
- (void) add_local_symbol (stabs_symbol,
- stabs_symbol + sizeof (stabs_symbol),
- stNil, scInfo, -1, MIPS_MARK_STAB(0));
-
- }
-}
-
-
-/* Parse .stabs directives.
-
- .stabs directives have five fields:
- "string" a string, encoding the type information.
- code a numeric code, defined in <stab.h>
- 0 a zero
- 0 a zero or line number
- value a numeric value or an address.
-
- If the value is relocatable, we transform this into:
- iss points as an index into string space
- value value from lookup of the name
- st st from lookup of the name
- sc sc from lookup of the name
- index code|CODE_MASK
-
- If the value is not relocatable, we transform this into:
- iss points as an index into string space
- value value
- st st_Nil
- sc sc_Nil
- index code|CODE_MASK
-
- .stabn directives have four fields (string is null):
- code a numeric code, defined in <stab.h>
- 0 a zero
- 0 a zero or a line number
- value a numeric value or an address. */
-
-STATIC void
-parse_stabs_common (string_start, string_end, rest)
- const char *string_start; /* start of string or NULL */
- const char *string_end; /* end+1 of string or NULL */
- const char *rest; /* rest of the directive. */
-{
- efdr_t *save_file_ptr = cur_file_ptr;
- symint_t code;
- symint_t value;
- char *p;
- st_t st;
- sc_t sc;
- int ch;
-
- if (stabs_seen == 0)
- mark_stabs ("");
-
- /* Read code from stabs. */
- if (!isdigit (*rest))
- {
- error ("Invalid .stabs/.stabn directive, code is non-numeric");
- return;
- }
-
- code = strtol (rest, &p, 0);
-
- /* Line number stabs are handled differently, since they have two values,
- the line number and the address of the label. We use the index field
- (aka code) to hold the line number, and the value field to hold the
- address. The symbol type is st_Label, which should be different from
- the other stabs, so that gdb can recognize it. */
-
- if (code == (int)N_SLINE)
- {
- SYMR *sym_ptr, dummy_symr;
- shash_t *shash_ptr;
-
- /* Skip ,0, */
- if (p[0] != ',' || p[1] != '0' || p[2] != ',' || !isdigit (p[3]))
- {
- error ("Invalid line number .stabs/.stabn directive");
- return;
- }
-
- code = strtol (p+3, &p, 0);
- ch = *++p;
- if (p[-1] != ',' || isdigit (ch) || !IS_ASM_IDENT (ch))
- {
- error ("Invalid line number .stabs/.stabn directive");
- return;
- }
-
- dummy_symr.index = code;
- if (dummy_symr.index != code)
- {
- error ("Line number (%d) for .stabs/.stabn directive cannot fit in index field (20 bits)",
- code);
-
- return;
- }
-
- shash_ptr = hash_string (p,
- strlen (p) - 1,
- &orig_str_hash[0],
- (symint_t *) 0);
-
- if (shash_ptr == (shash_t *) 0
- || (sym_ptr = shash_ptr->sym_ptr) == (SYMR *) 0)
- {
- error ("Invalid .stabs/.stabn directive, value not found");
- return;
- }
-
- if ((st_t) sym_ptr->st != st_Label)
- {
- error ("Invalid line number .stabs/.stabn directive");
- return;
- }
-
- st = st_Label;
- sc = (sc_t) sym_ptr->sc;
- value = sym_ptr->value;
- }
- else
- {
- /* Skip ,<num>,<num>, */
- if (*p++ != ',')
- goto failure;
- for (; isdigit (*p); p++)
- ;
- if (*p++ != ',')
- goto failure;
- for (; isdigit (*p); p++)
- ;
- if (*p++ != ',')
- goto failure;
- ch = *p;
- if (!IS_ASM_IDENT (ch) && ch != '-')
- {
- failure:
- error ("Invalid .stabs/.stabn directive, bad character");
- return;
- }
-
- if (isdigit (ch) || ch == '-')
- {
- st = st_Nil;
- sc = sc_Nil;
- value = strtol (p, &p, 0);
- if (*p != '\n')
- {
- error ("Invalid .stabs/.stabn directive, stuff after numeric value");
- return;
- }
- }
- else if (!IS_ASM_IDENT (ch))
- {
- error ("Invalid .stabs/.stabn directive, bad character");
- return;
- }
- else
- {
- SYMR *sym_ptr;
- shash_t *shash_ptr;
- const char *start, *end_p1;
-
- start = p;
- if ((end_p1 = strchr (start, '+')) == (char *) 0)
- {
- if ((end_p1 = strchr (start, '-')) == (char *) 0)
- end_p1 = start + strlen(start) - 1;
- }
-
- shash_ptr = hash_string (start,
- end_p1 - start,
- &orig_str_hash[0],
- (symint_t *) 0);
-
- if (shash_ptr == (shash_t *) 0
- || (sym_ptr = shash_ptr->sym_ptr) == (SYMR *) 0)
- {
- shash_ptr = hash_string (start,
- end_p1 - start,
- &ext_str_hash[0],
- (symint_t *) 0);
-
- if (shash_ptr == (shash_t *) 0
- || shash_ptr->esym_ptr == (EXTR *) 0)
- {
- error ("Invalid .stabs/.stabn directive, value not found");
- return;
- }
- else
- sym_ptr = &(shash_ptr->esym_ptr->asym);
- }
-
- /* Traditionally, N_LBRAC and N_RBRAC are *not* relocated. */
- if (code == (int) N_LBRAC || code == (int) N_RBRAC)
- {
- sc = scNil;
- st = stNil;
- }
- else
- {
- sc = (sc_t) sym_ptr->sc;
- st = (st_t) sym_ptr->st;
- }
- value = sym_ptr->value;
-
- ch = *end_p1++;
- if (ch != '\n')
- {
- if (((!isdigit (*end_p1)) && (*end_p1 != '-'))
- || ((ch != '+') && (ch != '-')))
- {
- error ("Invalid .stabs/.stabn directive, badly formed value");
- return;
- }
- if (ch == '+')
- value += strtol (end_p1, &p, 0);
- else if (ch == '-')
- value -= strtol (end_p1, &p, 0);
-
- if (*p != '\n')
- {
- error ("Invalid .stabs/.stabn directive, stuff after numeric value");
- return;
- }
- }
- }
- code = MIPS_MARK_STAB(code);
- }
-
- (void) add_local_symbol (string_start, string_end, st, sc, value, code);
- /* Restore normal file type. */
- cur_file_ptr = save_file_ptr;
-}
-
-
-STATIC void
-parse_stabs (start)
- const char *start; /* start of directive */
-{
- const char *end = local_index (start+1, '"');
-
- if (*start != '"' || end == (const char *) 0 || end[1] != ',')
- {
- error ("Invalid .stabs directive, no string");
- return;
- }
-
- parse_stabs_common (start+1, end, end+2);
-}
-
-
-STATIC void
-parse_stabn (start)
- const char *start; /* start of directive */
-{
- parse_stabs_common ((const char *) 0, (const char *) 0, start);
-}
-
-
-/* Parse the input file, and write the lines to the output file
- if needed. */
-
-STATIC void
-parse_input __proto((void))
-{
- register char *p;
- register int i;
- register thead_t *ptag_head;
- register tag_t *ptag;
- register tag_t *ptag_next;
-
- if (debug)
- fprintf (stderr, "\tinput\n");
-
- /* Add a dummy scope block around the entire compilation unit for
- structures defined outside of blocks. */
- ptag_head = allocate_thead ();
- ptag_head->first_tag = 0;
- ptag_head->prev = cur_tag_head;
- cur_tag_head = ptag_head;
-
- while ((p = read_line ()) != (char *) 0)
- {
- /* Skip leading blanks */
- while (isspace (*p))
- p++;
-
- /* See if it's a directive we handle. If so, dispatch handler. */
- for (i = 0; i < sizeof (pseudo_ops) / sizeof (pseudo_ops[0]); i++)
- if (memcmp (p, pseudo_ops[i].name, pseudo_ops[i].len) == 0
- && isspace (p[pseudo_ops[i].len]))
- {
- p += pseudo_ops[i].len; /* skip to first argument */
- while (isspace (*p))
- p++;
-
- (*pseudo_ops[i].func)( p );
- break;
- }
- }
-
- /* Process any tags at global level. */
- ptag_head = cur_tag_head;
- cur_tag_head = ptag_head->prev;
-
- for (ptag = ptag_head->first_tag;
- ptag != (tag_t *) 0;
- ptag = ptag_next)
- {
- if (ptag->forward_ref != (forward_t *) 0)
- add_unknown_tag (ptag);
-
- ptag_next = ptag->same_block;
- ptag->hash_ptr->tag_ptr = ptag->same_name;
- free_tag (ptag);
- }
-
- free_thead (ptag_head);
-
-}
-
-
-/* Update the global headers with the final offsets in preparation
- to write out the .T file. */
-
-STATIC void
-update_headers __proto((void))
-{
- register symint_t i;
- register efdr_t *file_ptr;
-
- /* Set up the symbolic header. */
- file_offset = sizeof (symbolic_header) + orig_file_header.f_symptr;
- symbolic_header.magic = orig_sym_hdr.magic;
- symbolic_header.vstamp = orig_sym_hdr.vstamp;
-
- /* Set up global counts. */
- symbolic_header.issExtMax = ext_strings.num_allocated;
- symbolic_header.idnMax = dense_num.num_allocated;
- symbolic_header.ifdMax = file_desc.num_allocated;
- symbolic_header.iextMax = ext_symbols.num_allocated;
- symbolic_header.ilineMax = orig_sym_hdr.ilineMax;
- symbolic_header.ioptMax = orig_sym_hdr.ioptMax;
- symbolic_header.cbLine = orig_sym_hdr.cbLine;
- symbolic_header.crfd = orig_sym_hdr.crfd;
-
-
- /* Loop through each file, figuring out how many local syms,
- line numbers, etc. there are. Also, put out end symbol
- for the filename. */
-
- for (file_ptr = first_file;
- file_ptr != (efdr_t *) 0;
- file_ptr = file_ptr->next_file)
- {
- register SYMR *sym_start;
- register SYMR *sym;
- register SYMR *sym_end_p1;
- register FDR *fd_ptr = file_ptr->orig_fdr;
-
- cur_file_ptr = file_ptr;
-
- /* Copy st_Static symbols from the original local symbol table if
- they did not get added to the new local symbol table.
- This happens with stabs-in-ecoff or if the source file is
- compiled without debugging. */
- sym_start = ORIG_LSYMS (fd_ptr->isymBase);
- sym_end_p1 = sym_start + fd_ptr->csym;
- for (sym = sym_start; sym < sym_end_p1; sym++)
- {
- if ((st_t)sym->st == st_Static)
- {
- register char *str = ORIG_LSTRS (fd_ptr->issBase + sym->iss);
- register Size_t len = strlen (str);
- register shash_t *hash_ptr;
-
- /* Ignore internal labels. */
- if (str[0] == '$' && str[1] == 'L')
- continue;
- hash_ptr = hash_string (str,
- (Ptrdiff_t)len,
- &file_ptr->shash_head[0],
- (symint_t *) 0);
- if (hash_ptr == (shash_t *) 0)
- {
- (void) add_local_symbol (str, str + len,
- (st_t)sym->st, (sc_t)sym->sc,
- (symint_t)sym->value,
- (symint_t)indexNil);
- }
- }
- }
- (void) add_local_symbol ((const char *) 0, (const char *) 0,
- st_End, sc_Text,
- (symint_t) 0,
- (symint_t) 0);
-
- file_ptr->fdr.cpd = file_ptr->procs.num_allocated;
- file_ptr->fdr.ipdFirst = symbolic_header.ipdMax;
- symbolic_header.ipdMax += file_ptr->fdr.cpd;
-
- file_ptr->fdr.csym = file_ptr->symbols.num_allocated;
- file_ptr->fdr.isymBase = symbolic_header.isymMax;
- symbolic_header.isymMax += file_ptr->fdr.csym;
-
- file_ptr->fdr.caux = file_ptr->aux_syms.num_allocated;
- file_ptr->fdr.iauxBase = symbolic_header.iauxMax;
- symbolic_header.iauxMax += file_ptr->fdr.caux;
-
- file_ptr->fdr.cbSs = file_ptr->strings.num_allocated;
- file_ptr->fdr.issBase = symbolic_header.issMax;
- symbolic_header.issMax += file_ptr->fdr.cbSs;
- }
-
-#ifndef ALIGN_SYMTABLE_OFFSET
-#define ALIGN_SYMTABLE_OFFSET(OFFSET) (OFFSET)
-#endif
-
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- i = WORD_ALIGN (symbolic_header.cbLine); /* line numbers */
- if (i > 0)
- {
- symbolic_header.cbLineOffset = file_offset;
- file_offset += i;
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = symbolic_header.ioptMax; /* optimization symbols */
- if (((long) i) > 0)
- {
- symbolic_header.cbOptOffset = file_offset;
- file_offset += i * sizeof (OPTR);
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = symbolic_header.idnMax; /* dense numbers */
- if (i > 0)
- {
- symbolic_header.cbDnOffset = file_offset;
- file_offset += i * sizeof (DNR);
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = symbolic_header.ipdMax; /* procedure tables */
- if (i > 0)
- {
- symbolic_header.cbPdOffset = file_offset;
- file_offset += i * sizeof (PDR);
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = symbolic_header.isymMax; /* local symbols */
- if (i > 0)
- {
- symbolic_header.cbSymOffset = file_offset;
- file_offset += i * sizeof (SYMR);
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = symbolic_header.iauxMax; /* aux syms. */
- if (i > 0)
- {
- symbolic_header.cbAuxOffset = file_offset;
- file_offset += i * sizeof (TIR);
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = WORD_ALIGN (symbolic_header.issMax); /* local strings */
- if (i > 0)
- {
- symbolic_header.cbSsOffset = file_offset;
- file_offset += i;
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = WORD_ALIGN (symbolic_header.issExtMax); /* external strings */
- if (i > 0)
- {
- symbolic_header.cbSsExtOffset = file_offset;
- file_offset += i;
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = symbolic_header.ifdMax; /* file tables */
- if (i > 0)
- {
- symbolic_header.cbFdOffset = file_offset;
- file_offset += i * sizeof (FDR);
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = symbolic_header.crfd; /* relative file descriptors */
- if (i > 0)
- {
- symbolic_header.cbRfdOffset = file_offset;
- file_offset += i * sizeof (symint_t);
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-
- i = symbolic_header.iextMax; /* external symbols */
- if (i > 0)
- {
- symbolic_header.cbExtOffset = file_offset;
- file_offset += i * sizeof (EXTR);
- file_offset = ALIGN_SYMTABLE_OFFSET (file_offset);
- }
-}
-
-
-/* Write out a varray at a given location. */
-
-STATIC void
-write_varray (vp, offset, str)
- varray_t *vp; /* virtual array */
- off_t offset; /* offset to write varray to */
- const char *str; /* string to print out when tracing */
-{
- int num_write, sys_write;
- vlinks_t *ptr;
-
- if (vp->num_allocated == 0)
- return;
-
- if (debug)
- fprintf (stderr, "\twarray\tvp = 0x%.8x, offset = %7u, size = %7u, %s\n",
- vp, offset, vp->num_allocated * vp->object_size, str);
-
- if (file_offset != offset
- && fseek (object_stream, (long)offset, SEEK_SET) < 0)
- pfatal_with_name (object_name);
-
- for (ptr = vp->first; ptr != (vlinks_t *) 0; ptr = ptr->next)
- {
- num_write = (ptr->next == (vlinks_t *) 0)
- ? vp->objects_last_page * vp->object_size
- : vp->objects_per_page * vp->object_size;
-
- sys_write = fwrite ((PTR_T) ptr->datum, 1, num_write, object_stream);
- if (sys_write <= 0)
- pfatal_with_name (object_name);
-
- else if (sys_write != num_write)
- fatal ("Wrote %d bytes to %s, system returned %d",
- num_write,
- object_name,
- sys_write);
-
- file_offset += num_write;
- }
-}
-
-
-/* Write out the symbol table in the object file. */
-
-STATIC void
-write_object __proto((void))
-{
- int sys_write;
- efdr_t *file_ptr;
- off_t offset;
-
- if (debug)
- fprintf (stderr, "\n\twrite\tvp = 0x%.8x, offset = %7u, size = %7u, %s\n",
- (PTR_T *) &symbolic_header, 0, sizeof (symbolic_header),
- "symbolic header");
-
- sys_write = fwrite ((PTR_T) &symbolic_header,
- 1,
- sizeof (symbolic_header),
- object_stream);
-
- if (sys_write < 0)
- pfatal_with_name (object_name);
-
- else if (sys_write != sizeof (symbolic_header))
- fatal ("Wrote %d bytes to %s, system returned %d",
- sizeof (symbolic_header),
- object_name,
- sys_write);
-
-
- file_offset = sizeof (symbolic_header) + orig_file_header.f_symptr;
-
- if (symbolic_header.cbLine > 0) /* line numbers */
- {
- long sys_write;
-
- if (file_offset != symbolic_header.cbLineOffset
- && fseek (object_stream, symbolic_header.cbLineOffset, SEEK_SET) != 0)
- pfatal_with_name (object_name);
-
- if (debug)
- fprintf (stderr, "\twrite\tvp = 0x%.8x, offset = %7u, size = %7u, %s\n",
- (PTR_T *) &orig_linenum, symbolic_header.cbLineOffset,
- symbolic_header.cbLine, "Line numbers");
-
- sys_write = fwrite ((PTR_T) orig_linenum,
- 1,
- symbolic_header.cbLine,
- object_stream);
-
- if (sys_write <= 0)
- pfatal_with_name (object_name);
-
- else if (sys_write != symbolic_header.cbLine)
- fatal ("Wrote %d bytes to %s, system returned %d",
- symbolic_header.cbLine,
- object_name,
- sys_write);
-
- file_offset = symbolic_header.cbLineOffset + symbolic_header.cbLine;
- }
-
- if (symbolic_header.ioptMax > 0) /* optimization symbols */
- {
- long sys_write;
- long num_write = symbolic_header.ioptMax * sizeof (OPTR);
-
- if (file_offset != symbolic_header.cbOptOffset
- && fseek (object_stream, symbolic_header.cbOptOffset, SEEK_SET) != 0)
- pfatal_with_name (object_name);
-
- if (debug)
- fprintf (stderr, "\twrite\tvp = 0x%.8x, offset = %7u, size = %7u, %s\n",
- (PTR_T *) &orig_opt_syms, symbolic_header.cbOptOffset,
- num_write, "Optimizer symbols");
-
- sys_write = fwrite ((PTR_T) orig_opt_syms,
- 1,
- num_write,
- object_stream);
-
- if (sys_write <= 0)
- pfatal_with_name (object_name);
-
- else if (sys_write != num_write)
- fatal ("Wrote %d bytes to %s, system returned %d",
- num_write,
- object_name,
- sys_write);
-
- file_offset = symbolic_header.cbOptOffset + num_write;
- }
-
- if (symbolic_header.idnMax > 0) /* dense numbers */
- write_varray (&dense_num, (off_t)symbolic_header.cbDnOffset, "Dense numbers");
-
- if (symbolic_header.ipdMax > 0) /* procedure tables */
- {
- offset = symbolic_header.cbPdOffset;
- for (file_ptr = first_file;
- file_ptr != (efdr_t *) 0;
- file_ptr = file_ptr->next_file)
- {
- write_varray (&file_ptr->procs, offset, "Procedure tables");
- offset = file_offset;
- }
- }
-
- if (symbolic_header.isymMax > 0) /* local symbols */
- {
- offset = symbolic_header.cbSymOffset;
- for (file_ptr = first_file;
- file_ptr != (efdr_t *) 0;
- file_ptr = file_ptr->next_file)
- {
- write_varray (&file_ptr->symbols, offset, "Local symbols");
- offset = file_offset;
- }
- }
-
- if (symbolic_header.iauxMax > 0) /* aux symbols */
- {
- offset = symbolic_header.cbAuxOffset;
- for (file_ptr = first_file;
- file_ptr != (efdr_t *) 0;
- file_ptr = file_ptr->next_file)
- {
- write_varray (&file_ptr->aux_syms, offset, "Aux. symbols");
- offset = file_offset;
- }
- }
-
- if (symbolic_header.issMax > 0) /* local strings */
- {
- offset = symbolic_header.cbSsOffset;
- for (file_ptr = first_file;
- file_ptr != (efdr_t *) 0;
- file_ptr = file_ptr->next_file)
- {
- write_varray (&file_ptr->strings, offset, "Local strings");
- offset = file_offset;
- }
- }
-
- if (symbolic_header.issExtMax > 0) /* external strings */
- write_varray (&ext_strings, symbolic_header.cbSsExtOffset, "External strings");
-
- if (symbolic_header.ifdMax > 0) /* file tables */
- {
- offset = symbolic_header.cbFdOffset;
- if (file_offset != offset
- && fseek (object_stream, (long)offset, SEEK_SET) < 0)
- pfatal_with_name (object_name);
-
- file_offset = offset;
- for (file_ptr = first_file;
- file_ptr != (efdr_t *) 0;
- file_ptr = file_ptr->next_file)
- {
- if (debug)
- fprintf (stderr, "\twrite\tvp = 0x%.8x, offset = %7u, size = %7u, %s\n",
- (PTR_T *) &file_ptr->fdr, file_offset, sizeof (FDR), "File header");
-
- sys_write = fwrite (&file_ptr->fdr,
- 1,
- sizeof (FDR),
- object_stream);
-
- if (sys_write < 0)
- pfatal_with_name (object_name);
-
- else if (sys_write != sizeof (FDR))
- fatal ("Wrote %d bytes to %s, system returned %d",
- sizeof (FDR),
- object_name,
- sys_write);
-
- file_offset = offset += sizeof (FDR);
- }
- }
-
- if (symbolic_header.crfd > 0) /* relative file descriptors */
- {
- long sys_write;
- symint_t num_write = symbolic_header.crfd * sizeof (symint_t);
-
- if (file_offset != symbolic_header.cbRfdOffset
- && fseek (object_stream, symbolic_header.cbRfdOffset, SEEK_SET) != 0)
- pfatal_with_name (object_name);
-
- if (debug)
- fprintf (stderr, "\twrite\tvp = 0x%.8x, offset = %7u, size = %7u, %s\n",
- (PTR_T *) &orig_rfds, symbolic_header.cbRfdOffset,
- num_write, "Relative file descriptors");
-
- sys_write = fwrite (orig_rfds,
- 1,
- num_write,
- object_stream);
-
- if (sys_write <= 0)
- pfatal_with_name (object_name);
-
- else if (sys_write != num_write)
- fatal ("Wrote %d bytes to %s, system returned %d",
- num_write,
- object_name,
- sys_write);
-
- file_offset = symbolic_header.cbRfdOffset + num_write;
- }
-
- if (symbolic_header.issExtMax > 0) /* external symbols */
- write_varray (&ext_symbols, (off_t)symbolic_header.cbExtOffset, "External symbols");
-
- if (fclose (object_stream) != 0)
- pfatal_with_name (object_name);
-}
-
-
-/* Read some bytes at a specified location, and return a pointer. */
-
-STATIC page_t *
-read_seek (size, offset, str)
- Size_t size; /* # bytes to read */
- off_t offset; /* offset to read at */
- const char *str; /* name for tracing */
-{
- page_t *ptr;
- long sys_read = 0;
-
- if (size == 0) /* nothing to read */
- return (page_t *) 0;
-
- if (debug)
- fprintf (stderr, "\trseek\tsize = %7u, offset = %7u, currently at %7u, %s\n",
- size, offset, file_offset, str);
-
-#ifndef MALLOC_CHECK
- ptr = allocate_multiple_pages ((size + PAGE_USIZE - 1) / PAGE_USIZE);
-#else
- ptr = (page_t *) xcalloc (1, size);
-#endif
-
- /* If we need to seek, and the distance is nearby, just do some reads,
- to speed things up. */
- if (file_offset != offset)
- {
- symint_t difference = offset - file_offset;
-
- if (difference < 8)
- {
- char small_buffer[8];
-
- sys_read = fread (small_buffer, 1, difference, obj_in_stream);
- if (sys_read <= 0)
- pfatal_with_name (obj_in_name);
-
- if (sys_read != difference)
- fatal ("Wanted to read %d bytes from %s, system returned %d",
- size,
- obj_in_name,
- sys_read);
- }
- else if (fseek (obj_in_stream, offset, SEEK_SET) < 0)
- pfatal_with_name (obj_in_name);
- }
-
- sys_read = fread ((PTR_T)ptr, 1, size, obj_in_stream);
- if (sys_read <= 0)
- pfatal_with_name (obj_in_name);
-
- if (sys_read != size)
- fatal ("Wanted to read %d bytes from %s, system returned %d",
- size,
- obj_in_name,
- sys_read);
-
- file_offset = offset + size;
-
- if (file_offset > max_file_offset)
- max_file_offset = file_offset;
-
- return ptr;
-}
-
-
-/* Read the existing object file (and copy to the output object file
- if it is different from the input object file), and remove the old
- symbol table. */
-
-STATIC void
-copy_object __proto((void))
-{
- char buffer[ PAGE_SIZE ];
- register int sys_read;
- register int remaining;
- register int num_write;
- register int sys_write;
- register int fd, es;
- register int delete_ifd = 0;
- register int *remap_file_number;
- struct stat stat_buf;
-
- if (debug)
- fprintf (stderr, "\tcopy\n");
-
- if (fstat (fileno (obj_in_stream), &stat_buf) != 0
- || fseek (obj_in_stream, 0L, SEEK_SET) != 0)
- pfatal_with_name (obj_in_name);
-
- sys_read = fread ((PTR_T) &orig_file_header,
- 1,
- sizeof (struct filehdr),
- obj_in_stream);
-
- if (sys_read < 0)
- pfatal_with_name (obj_in_name);
-
- else if (sys_read == 0 && feof (obj_in_stream))
- return; /* create a .T file sans file header */
-
- else if (sys_read < sizeof (struct filehdr))
- fatal ("Wanted to read %d bytes from %s, system returned %d",
- sizeof (struct filehdr),
- obj_in_name,
- sys_read);
-
-
- if (orig_file_header.f_nsyms != sizeof (HDRR))
- fatal ("%s symbolic header wrong size (%d bytes, should be %d)",
- input_name, orig_file_header.f_nsyms, sizeof (HDRR));
-
-
- /* Read in the current symbolic header. */
- if (fseek (obj_in_stream, (long) orig_file_header.f_symptr, SEEK_SET) != 0)
- pfatal_with_name (input_name);
-
- sys_read = fread ((PTR_T) &orig_sym_hdr,
- 1,
- sizeof (orig_sym_hdr),
- obj_in_stream);
-
- if (sys_read < 0)
- pfatal_with_name (object_name);
-
- else if (sys_read < sizeof (struct filehdr))
- fatal ("Wanted to read %d bytes from %s, system returned %d",
- sizeof (struct filehdr),
- obj_in_name,
- sys_read);
-
-
- /* Read in each of the sections if they exist in the object file.
- We read things in in the order the mips assembler creates the
- sections, so in theory no extra seeks are done.
-
- For simplicity sake, round each read up to a page boundary,
- we may want to revisit this later.... */
-
- file_offset = orig_file_header.f_symptr + sizeof (struct filehdr);
-
- if (orig_sym_hdr.cbLine > 0) /* line numbers */
- orig_linenum = (char *) read_seek ((Size_t)orig_sym_hdr.cbLine,
- orig_sym_hdr.cbLineOffset,
- "Line numbers");
-
- if (orig_sym_hdr.ipdMax > 0) /* procedure tables */
- orig_procs = (PDR *) read_seek ((Size_t)orig_sym_hdr.ipdMax * sizeof (PDR),
- orig_sym_hdr.cbPdOffset,
- "Procedure tables");
-
- if (orig_sym_hdr.isymMax > 0) /* local symbols */
- orig_local_syms = (SYMR *) read_seek ((Size_t)orig_sym_hdr.isymMax * sizeof (SYMR),
- orig_sym_hdr.cbSymOffset,
- "Local symbols");
-
- if (orig_sym_hdr.iauxMax > 0) /* aux symbols */
- orig_aux_syms = (AUXU *) read_seek ((Size_t)orig_sym_hdr.iauxMax * sizeof (AUXU),
- orig_sym_hdr.cbAuxOffset,
- "Aux. symbols");
-
- if (orig_sym_hdr.issMax > 0) /* local strings */
- orig_local_strs = (char *) read_seek ((Size_t)orig_sym_hdr.issMax,
- orig_sym_hdr.cbSsOffset,
- "Local strings");
-
- if (orig_sym_hdr.issExtMax > 0) /* external strings */
- orig_ext_strs = (char *) read_seek ((Size_t)orig_sym_hdr.issExtMax,
- orig_sym_hdr.cbSsExtOffset,
- "External strings");
-
- if (orig_sym_hdr.ifdMax > 0) /* file tables */
- orig_files = (FDR *) read_seek ((Size_t)orig_sym_hdr.ifdMax * sizeof (FDR),
- orig_sym_hdr.cbFdOffset,
- "File tables");
-
- if (orig_sym_hdr.crfd > 0) /* relative file descriptors */
- orig_rfds = (symint_t *) read_seek ((Size_t)orig_sym_hdr.crfd * sizeof (symint_t),
- orig_sym_hdr.cbRfdOffset,
- "Relative file descriptors");
-
- if (orig_sym_hdr.issExtMax > 0) /* external symbols */
- orig_ext_syms = (EXTR *) read_seek ((Size_t)orig_sym_hdr.iextMax * sizeof (EXTR),
- orig_sym_hdr.cbExtOffset,
- "External symbols");
-
- if (orig_sym_hdr.idnMax > 0) /* dense numbers */
- {
- orig_dense = (DNR *) read_seek ((Size_t)orig_sym_hdr.idnMax * sizeof (DNR),
- orig_sym_hdr.cbDnOffset,
- "Dense numbers");
-
- add_bytes (&dense_num, (char *) orig_dense, (Size_t)orig_sym_hdr.idnMax);
- }
-
- if (orig_sym_hdr.ioptMax > 0) /* opt symbols */
- orig_opt_syms = (OPTR *) read_seek ((Size_t)orig_sym_hdr.ioptMax * sizeof (OPTR),
- orig_sym_hdr.cbOptOffset,
- "Optimizer symbols");
-
-
-
- /* Abort if the symbol table is not last. */
- if (max_file_offset != stat_buf.st_size)
- fatal ("Symbol table is not last (symbol table ends at %ld, .o ends at %ld",
- max_file_offset,
- stat_buf.st_size);
-
-
- /* If the first original file descriptor is a dummy which the assembler
- put out, but there are no symbols in it, skip it now. */
- if (orig_sym_hdr.ifdMax > 1
- && orig_files->csym == 2
- && orig_files->caux == 0)
- {
- char *filename = orig_local_strs + (orig_files->issBase + orig_files->rss);
- char *suffix = local_rindex (filename, '.');
-
- if (suffix != (char *) 0 && strcmp (suffix, ".s") == 0)
- delete_ifd = 1;
- }
-
-
- /* Create array to map original file numbers to the new file numbers
- (in case there are duplicate filenames, we collapse them into one
- file section, the MIPS assembler may or may not collapse them). */
-
- remap_file_number = (int *) alloca (sizeof (int) * orig_sym_hdr.ifdMax);
-
- for (fd = delete_ifd; fd < orig_sym_hdr.ifdMax; fd++)
- {
- register FDR *fd_ptr = ORIG_FILES (fd);
- register char *filename = ORIG_LSTRS (fd_ptr->issBase + fd_ptr->rss);
-
- /* file support itself. */
- add_file (filename, filename + strlen (filename));
- remap_file_number[fd] = cur_file_ptr->file_index;
- }
-
- if (delete_ifd > 0) /* just in case */
- remap_file_number[0] = remap_file_number[1];
-
-
- /* Loop, adding each of the external symbols. These must be in
- order or otherwise we would have to change the relocation
- entries. We don't just call add_bytes, because we need to have
- the names put into the external hash table. We set the type to
- 'void' for now, and parse_def will fill in the correct type if it
- is in the symbol table. We must add the external symbols before
- the locals, since the locals do lookups against the externals. */
-
- if (debug)
- fprintf (stderr, "\tehash\n");
-
- for (es = 0; es < orig_sym_hdr.iextMax; es++)
- {
- register EXTR *eptr = orig_ext_syms + es;
- register char *ename = ORIG_ESTRS (eptr->asym.iss);
- register unsigned ifd = eptr->ifd;
-
- (void) add_ext_symbol (ename,
- ename + strlen (ename),
- (st_t) eptr->asym.st,
- (sc_t) eptr->asym.sc,
- eptr->asym.value,
- (symint_t) ((eptr->asym.index == indexNil) ? indexNil : 0),
- (ifd < orig_sym_hdr.ifdMax) ? remap_file_number[ ifd ] : ifd);
- }
-
-
- /* For each of the files in the object file, copy the symbols, and such
- into the varrays for the new object file. */
-
- for (fd = delete_ifd; fd < orig_sym_hdr.ifdMax; fd++)
- {
- register FDR *fd_ptr = ORIG_FILES (fd);
- register char *filename = ORIG_LSTRS (fd_ptr->issBase + fd_ptr->rss);
- register SYMR *sym_start;
- register SYMR *sym;
- register SYMR *sym_end_p1;
- register PDR *proc_start;
- register PDR *proc;
- register PDR *proc_end_p1;
-
- /* file support itself. */
- add_file (filename, filename + strlen (filename));
- cur_file_ptr->orig_fdr = fd_ptr;
-
- /* Copy stuff that's just passed through (such as line #'s) */
- cur_file_ptr->fdr.adr = fd_ptr->adr;
- cur_file_ptr->fdr.ilineBase = fd_ptr->ilineBase;
- cur_file_ptr->fdr.cline = fd_ptr->cline;
- cur_file_ptr->fdr.rfdBase = fd_ptr->rfdBase;
- cur_file_ptr->fdr.crfd = fd_ptr->crfd;
- cur_file_ptr->fdr.cbLineOffset = fd_ptr->cbLineOffset;
- cur_file_ptr->fdr.cbLine = fd_ptr->cbLine;
- cur_file_ptr->fdr.fMerge = fd_ptr->fMerge;
- cur_file_ptr->fdr.fReadin = fd_ptr->fReadin;
- cur_file_ptr->fdr.glevel = fd_ptr->glevel;
-
- if (debug)
- fprintf (stderr, "\thash\tstart, filename %s\n", filename);
-
- /* For each of the static and global symbols defined, add them
- to the hash table of original symbols, so we can look up
- their values. */
-
- sym_start = ORIG_LSYMS (fd_ptr->isymBase);
- sym_end_p1 = sym_start + fd_ptr->csym;
- for (sym = sym_start; sym < sym_end_p1; sym++)
- {
- switch ((st_t) sym->st)
- {
- default:
- break;
-
- case st_Global:
- case st_Static:
- case st_Label:
- case st_Proc:
- case st_StaticProc:
- {
- auto symint_t hash_index;
- register char *str = ORIG_LSTRS (fd_ptr->issBase + sym->iss);
- register Size_t len = strlen (str);
- register shash_t *shash_ptr = hash_string (str,
- (Ptrdiff_t)len,
- &orig_str_hash[0],
- &hash_index);
-
- if (shash_ptr != (shash_t *) 0)
- error ("internal error, %s is already in original symbol table", str);
-
- else
- {
- shash_ptr = allocate_shash ();
- shash_ptr->next = orig_str_hash[hash_index];
- orig_str_hash[hash_index] = shash_ptr;
-
- shash_ptr->len = len;
- shash_ptr->indx = indexNil;
- shash_ptr->string = str;
- shash_ptr->sym_ptr = sym;
- }
- }
- break;
-
- case st_End:
- if ((sc_t) sym->sc == sc_Text)
- {
- register char *str = ORIG_LSTRS (fd_ptr->issBase + sym->iss);
-
- if (*str != '\0')
- {
- register Size_t len = strlen (str);
- register shash_t *shash_ptr = hash_string (str,
- (Ptrdiff_t)len,
- &orig_str_hash[0],
- (symint_t *) 0);
-
- if (shash_ptr != (shash_t *) 0)
- shash_ptr->end_ptr = sym;
- }
- }
- break;
-
- }
- }
-
- if (debug)
- {
- fprintf (stderr, "\thash\tdone, filename %s\n", filename);
- fprintf (stderr, "\tproc\tstart, filename %s\n", filename);
- }
-
- /* Go through each of the procedures in this file, and add the
- procedure pointer to the hash entry for the given name. */
-
- proc_start = ORIG_PROCS (fd_ptr->ipdFirst);
- proc_end_p1 = proc_start + fd_ptr->cpd;
- for (proc = proc_start; proc < proc_end_p1; proc++)
- {
- register SYMR *proc_sym = ORIG_LSYMS (fd_ptr->isymBase + proc->isym);
- register char *str = ORIG_LSTRS (fd_ptr->issBase + proc_sym->iss);
- register Size_t len = strlen (str);
- register shash_t *shash_ptr = hash_string (str,
- (Ptrdiff_t)len,
- &orig_str_hash[0],
- (symint_t *) 0);
-
- if (shash_ptr == (shash_t *) 0)
- error ("internal error, function %s is not in original symbol table", str);
-
- else
- shash_ptr->proc_ptr = proc;
- }
-
- if (debug)
- fprintf (stderr, "\tproc\tdone, filename %s\n", filename);
-
- }
- cur_file_ptr = first_file;
-
-
- /* Copy all of the object file up to the symbol table. Originally
- we were going to use ftruncate, but that doesn't seem to work
- on Ultrix 3.1.... */
-
- if (fseek (obj_in_stream, (long) 0, SEEK_SET) != 0)
- pfatal_with_name (obj_in_name);
-
- if (fseek (object_stream, (long) 0, SEEK_SET) != 0)
- pfatal_with_name (object_name);
-
- for (remaining = orig_file_header.f_symptr;
- remaining > 0;
- remaining -= num_write)
- {
- num_write = (remaining <= sizeof (buffer)) ? remaining : sizeof (buffer);
- sys_read = fread ((PTR_T) buffer, 1, num_write, obj_in_stream);
- if (sys_read <= 0)
- pfatal_with_name (obj_in_name);
-
- else if (sys_read != num_write)
- fatal ("Wanted to read %d bytes from %s, system returned %d",
- num_write,
- obj_in_name,
- sys_read);
-
- sys_write = fwrite (buffer, 1, num_write, object_stream);
- if (sys_write <= 0)
- pfatal_with_name (object_name);
-
- else if (sys_write != num_write)
- fatal ("Wrote %d bytes to %s, system returned %d",
- num_write,
- object_name,
- sys_write);
- }
-}
-
-
-/* Ye olde main program. */
-
-int
-main (argc, argv)
- int argc;
- char *argv[];
-{
- int iflag = 0;
- char *p = local_rindex (argv[0], '/');
- char *num_end;
- int option;
- int i;
-
- progname = (p != 0) ? p+1 : argv[0];
-
- (void) signal (SIGSEGV, catch_signal);
- (void) signal (SIGBUS, catch_signal);
- (void) signal (SIGABRT, catch_signal);
-
-#if !defined(__SABER__) && !defined(lint)
- if (sizeof (efdr_t) > PAGE_USIZE)
- fatal ("Efdr_t has a sizeof %d bytes, when it should be less than %d",
- sizeof (efdr_t),
- PAGE_USIZE);
-
- if (sizeof (page_t) != PAGE_USIZE)
- fatal ("Page_t has a sizeof %d bytes, when it should be %d",
- sizeof (page_t),
- PAGE_USIZE);
-
-#endif
-
- alloc_counts[ alloc_type_none ].alloc_name = "none";
- alloc_counts[ alloc_type_scope ].alloc_name = "scope";
- alloc_counts[ alloc_type_vlinks ].alloc_name = "vlinks";
- alloc_counts[ alloc_type_shash ].alloc_name = "shash";
- alloc_counts[ alloc_type_thash ].alloc_name = "thash";
- alloc_counts[ alloc_type_tag ].alloc_name = "tag";
- alloc_counts[ alloc_type_forward ].alloc_name = "forward";
- alloc_counts[ alloc_type_thead ].alloc_name = "thead";
- alloc_counts[ alloc_type_varray ].alloc_name = "varray";
-
- int_type_info = type_info_init;
- int_type_info.basic_type = bt_Int;
-
- void_type_info = type_info_init;
- void_type_info.basic_type = bt_Void;
-
- while ((option = getopt (argc, argv, "d:i:I:o:v")) != EOF)
- switch (option)
- {
- default:
- had_errors++;
- break;
-
- case 'd':
- debug = strtol (optarg, &num_end, 0);
- if ((unsigned)debug > 4 || num_end == optarg)
- had_errors++;
-
- break;
-
- case 'I':
- if (rename_output || obj_in_name != (char *) 0)
- had_errors++;
- else
- rename_output = 1;
-
- /* fall through to 'i' case. */
-
- case 'i':
- if (obj_in_name == (char *) 0)
- {
- obj_in_name = optarg;
- iflag++;
- }
- else
- had_errors++;
- break;
-
- case 'o':
- if (object_name == (char *) 0)
- object_name = optarg;
- else
- had_errors++;
- break;
-
- case 'v':
- version++;
- break;
- }
-
- if (obj_in_name == (char *) 0 && optind <= argc - 2)
- obj_in_name = argv[--argc];
-
- if (object_name == (char *) 0 && optind <= argc - 2)
- object_name = argv[--argc];
-
- /* If there is an output name, but no input name use
- the same file for both, deleting the name between
- opening it for input and opening it for output. */
- if (obj_in_name == (char *) 0 && object_name != (char *)0)
- {
- obj_in_name = object_name;
- delete_input = 1;
- }
-
- if (object_name == (char *) 0 || had_errors || optind != argc - 1)
- {
- fprintf (stderr, "Calling Sequence:\n");
- fprintf (stderr, "\tmips-tfile [-d <num>] [-v] [-i <o-in-file>] -o <o-out-file> <s-file> (or)\n");
- fprintf (stderr, "\tmips-tfile [-d <num>] [-v] [-I <o-in-file>] -o <o-out-file> <s-file> (or)\n");
- fprintf (stderr, "\tmips-tfile [-d <num>] [-v] <s-file> <o-in-file> <o-out-file>\n");
- fprintf (stderr, "\n");
- fprintf (stderr, "Debug levels are:\n");
- fprintf (stderr, " 1\tGeneral debug + trace functions/blocks.\n");
- fprintf (stderr, " 2\tDebug level 1 + trace externals.\n");
- fprintf (stderr, " 3\tDebug level 2 + trace all symbols.\n");
- fprintf (stderr, " 4\tDebug level 3 + trace memory allocations.\n");
- return 1;
- }
-
-
- if (version)
- {
- fprintf (stderr, "mips-tfile version %s", version_string);
-#ifdef TARGET_VERSION
- TARGET_VERSION;
-#endif
- fputc ('\n', stderr);
- }
-
- if (obj_in_name == (char *) 0)
- obj_in_name = object_name;
-
- if (rename_output && rename (object_name, obj_in_name) != 0)
- {
- char *buffer = (char *) allocate_multiple_pages (4);
- int len;
- int len2;
- int in_fd;
- int out_fd;
-
- /* Rename failed, copy input file */
- in_fd = open (object_name, O_RDONLY, 0666);
- if (in_fd < 0)
- pfatal_with_name (object_name);
-
- out_fd = open (obj_in_name, O_WRONLY | O_CREAT | O_TRUNC, 0666);
- if (out_fd < 0)
- pfatal_with_name (obj_in_name);
-
- while ((len = read (in_fd, buffer, 4*PAGE_SIZE)) > 0)
- {
- len2 = write (out_fd, buffer, len);
- if (len2 < 0)
- pfatal_with_name (object_name);
-
- if (len != len2)
- fatal ("wrote %d bytes to %s, expected to write %d", len2, obj_in_name, len);
- }
-
- free_multiple_pages ((page_t *)buffer, 4);
-
- if (len < 0)
- pfatal_with_name (object_name);
-
- if (close (in_fd) < 0)
- pfatal_with_name (object_name);
-
- if (close (out_fd) < 0)
- pfatal_with_name (obj_in_name);
- }
-
- /* Must open input before output, since the output may be the same file, and
- we need to get the input handle before truncating it. */
- obj_in_stream = fopen (obj_in_name, "r");
- if (obj_in_stream == (FILE *) 0)
- pfatal_with_name (obj_in_name);
-
- if (delete_input && unlink (obj_in_name) != 0)
- pfatal_with_name (obj_in_name);
-
- object_stream = fopen (object_name, "w");
- if (object_stream == (FILE *) 0)
- pfatal_with_name (object_name);
-
- if (strcmp (argv[optind], "-") != 0)
- {
- input_name = argv[optind];
- if (freopen (argv[optind], "r", stdin) != stdin)
- pfatal_with_name (argv[optind]);
- }
-
- copy_object (); /* scan & copy object file */
- parse_input (); /* scan all of input */
-
- update_headers (); /* write out tfile */
- write_object ();
-
- if (debug)
- {
- fprintf (stderr, "\n\tAllocation summary:\n\n");
- for (i = (int)alloc_type_none; i < (int)alloc_type_last; i++)
- if (alloc_counts[i].total_alloc)
- {
- fprintf (stderr,
- "\t%s\t%5d allocation(s), %5d free(s), %2d page(s)\n",
- alloc_counts[i].alloc_name,
- alloc_counts[i].total_alloc,
- alloc_counts[i].total_free,
- alloc_counts[i].total_pages);
- }
- }
-
- return (had_errors) ? 1 : 0;
-}
-
-
-/* Catch a signal and exit without dumping core. */
-
-STATIC void
-catch_signal (signum)
- int signum;
-{
- (void) signal (signum, SIG_DFL); /* just in case... */
-#ifdef NO_SYS_SIGLIST
- fatal ("caught signal");
-#else
- fatal (sys_siglist[signum]);
-#endif
-}
-
-/* Print a fatal error message. NAME is the text.
- Also include a system error message based on `errno'. */
-
-void
-pfatal_with_name (msg)
- char *msg;
-{
- int save_errno = errno; /* just in case.... */
- if (line_number > 0)
- fprintf (stderr, "%s, %s:%ld ", progname, input_name, line_number);
- else
- fprintf (stderr, "%s:", progname);
-
- errno = save_errno;
- if (errno == 0)
- fprintf (stderr, "[errno = 0] %s\n", msg);
- else
- perror (msg);
-
- exit (1);
-}
-
-
-/* Procedure to abort with an out of bounds error message. It has
- type int, so it can be used with an ?: expression within the
- ORIG_xxx macros, but the function never returns. */
-
-static int
-out_of_bounds (indx, max, str, prog_line)
- symint_t indx; /* index that is out of bounds */
- symint_t max; /* maximum index */
- const char *str; /* string to print out */
- int prog_line; /* line number within mips-tfile.c */
-{
- if (indx < max) /* just in case */
- return 0;
-
- fprintf (stderr, "%s, %s:%ld index %u is out of bounds for %s, max is %u, mips-tfile.c line# %d\n",
- progname, input_name, line_number, indx, str, max, prog_line);
-
- exit (1);
- return 0; /* turn off warning messages */
-}
-
-
-/* Allocate a cluster of pages. USE_MALLOC says that malloc does not
- like sbrk's behind it's back (or sbrk isn't available). If we use
- sbrk, we assume it gives us zeroed pages. */
-
-#ifndef MALLOC_CHECK
-#ifdef USE_MALLOC
-
-STATIC page_t *
-allocate_cluster (npages)
- Size_t npages;
-{
- register page_t *value = (page_t *) calloc (npages, PAGE_USIZE);
-
- if (value == 0)
- fatal ("Virtual memory exhausted.");
-
- if (debug > 3)
- fprintf (stderr, "\talloc\tnpages = %d, value = 0x%.8x\n", npages, value);
-
- return value;
-}
-
-#else /* USE_MALLOC */
-
-STATIC page_t *
-allocate_cluster (npages)
- Size_t npages;
-{
- register page_t *ptr = (page_t *) sbrk (0); /* current sbreak */
- unsigned long offset = ((unsigned long) ptr) & (PAGE_SIZE - 1);
-
- if (offset != 0) /* align to a page boundary */
- {
- if (sbrk (PAGE_USIZE - offset) == (char *)-1)
- pfatal_with_name ("allocate_cluster");
-
- ptr = (page_t *) (((char *)ptr) + PAGE_SIZE - offset);
- }
-
- if (sbrk (npages * PAGE_USIZE) == (char *)-1)
- pfatal_with_name ("allocate_cluster");
-
- if (debug > 3)
- fprintf (stderr, "\talloc\tnpages = %d, value = 0x%.8x\n", npages, ptr);
-
- return ptr;
-}
-
-#endif /* USE_MALLOC */
-
-
-static page_t *cluster_ptr = NULL;
-static unsigned pages_left = 0;
-
-#endif /* MALLOC_CHECK */
-
-
-/* Allocate some pages (which is initialized to 0). */
-
-STATIC page_t *
-allocate_multiple_pages (npages)
- Size_t npages;
-{
-#ifndef MALLOC_CHECK
- if (pages_left == 0 && npages < MAX_CLUSTER_PAGES)
- {
- pages_left = MAX_CLUSTER_PAGES;
- cluster_ptr = allocate_cluster (MAX_CLUSTER_PAGES);
- }
-
- if (npages <= pages_left)
- {
- page_t *ptr = cluster_ptr;
- cluster_ptr += npages;
- pages_left -= npages;
- return ptr;
- }
-
- return allocate_cluster (npages);
-
-#else /* MALLOC_CHECK */
- return (page_t *) xcalloc (npages, PAGE_SIZE);
-
-#endif /* MALLOC_CHECK */
-}
-
-
-/* Release some pages. */
-
-STATIC void
-free_multiple_pages (page_ptr, npages)
- page_t *page_ptr;
- Size_t npages;
-{
-#ifndef MALLOC_CHECK
- if (pages_left == 0)
- {
- cluster_ptr = page_ptr;
- pages_left = npages;
- }
-
- else if ((page_ptr + npages) == cluster_ptr)
- {
- cluster_ptr -= npages;
- pages_left += npages;
- }
-
- /* otherwise the page is not freed. If more than call is
- done, we probably should worry about it, but at present,
- the free pages is done right after an allocate. */
-
-#else /* MALLOC_CHECK */
- free ((char *) page_ptr);
-
-#endif /* MALLOC_CHECK */
-}
-
-
-/* Allocate one page (which is initialized to 0). */
-
-STATIC page_t *
-allocate_page __proto((void))
-{
-#ifndef MALLOC_CHECK
- if (pages_left == 0)
- {
- pages_left = MAX_CLUSTER_PAGES;
- cluster_ptr = allocate_cluster (MAX_CLUSTER_PAGES);
- }
-
- pages_left--;
- return cluster_ptr++;
-
-#else /* MALLOC_CHECK */
- return (page_t *) xcalloc (1, PAGE_SIZE);
-
-#endif /* MALLOC_CHECK */
-}
-
-
-/* Allocate scoping information. */
-
-STATIC scope_t *
-allocate_scope __proto((void))
-{
- register scope_t *ptr;
- static scope_t initial_scope;
-
-#ifndef MALLOC_CHECK
- ptr = alloc_counts[ (int)alloc_type_scope ].free_list.f_scope;
- if (ptr != (scope_t *) 0)
- alloc_counts[ (int)alloc_type_scope ].free_list.f_scope = ptr->free;
-
- else
- {
- register int unallocated = alloc_counts[ (int)alloc_type_scope ].unallocated;
- register page_t *cur_page = alloc_counts[ (int)alloc_type_scope ].cur_page;
-
- if (unallocated == 0)
- {
- unallocated = PAGE_SIZE / sizeof (scope_t);
- alloc_counts[ (int)alloc_type_scope ].cur_page = cur_page = allocate_page ();
- alloc_counts[ (int)alloc_type_scope ].total_pages++;
- }
-
- ptr = &cur_page->scope[ --unallocated ];
- alloc_counts[ (int)alloc_type_scope ].unallocated = unallocated;
- }
-
-#else
- ptr = (scope_t *) xmalloc (sizeof (scope_t));
-
-#endif
-
- alloc_counts[ (int)alloc_type_scope ].total_alloc++;
- *ptr = initial_scope;
- return ptr;
-}
-
-/* Free scoping information. */
-
-STATIC void
-free_scope (ptr)
- scope_t *ptr;
-{
- alloc_counts[ (int)alloc_type_scope ].total_free++;
-
-#ifndef MALLOC_CHECK
- ptr->free = alloc_counts[ (int)alloc_type_scope ].free_list.f_scope;
- alloc_counts[ (int)alloc_type_scope ].free_list.f_scope = ptr;
-
-#else
- xfree ((PTR_T) ptr);
-#endif
-
-}
-
-
-/* Allocate links for pages in a virtual array. */
-
-STATIC vlinks_t *
-allocate_vlinks __proto((void))
-{
- register vlinks_t *ptr;
- static vlinks_t initial_vlinks;
-
-#ifndef MALLOC_CHECK
- register int unallocated = alloc_counts[ (int)alloc_type_vlinks ].unallocated;
- register page_t *cur_page = alloc_counts[ (int)alloc_type_vlinks ].cur_page;
-
- if (unallocated == 0)
- {
- unallocated = PAGE_SIZE / sizeof (vlinks_t);
- alloc_counts[ (int)alloc_type_vlinks ].cur_page = cur_page = allocate_page ();
- alloc_counts[ (int)alloc_type_vlinks ].total_pages++;
- }
-
- ptr = &cur_page->vlinks[ --unallocated ];
- alloc_counts[ (int)alloc_type_vlinks ].unallocated = unallocated;
-
-#else
- ptr = (vlinks_t *) xmalloc (sizeof (vlinks_t));
-
-#endif
-
- alloc_counts[ (int)alloc_type_vlinks ].total_alloc++;
- *ptr = initial_vlinks;
- return ptr;
-}
-
-
-/* Allocate string hash buckets. */
-
-STATIC shash_t *
-allocate_shash __proto((void))
-{
- register shash_t *ptr;
- static shash_t initial_shash;
-
-#ifndef MALLOC_CHECK
- register int unallocated = alloc_counts[ (int)alloc_type_shash ].unallocated;
- register page_t *cur_page = alloc_counts[ (int)alloc_type_shash ].cur_page;
-
- if (unallocated == 0)
- {
- unallocated = PAGE_SIZE / sizeof (shash_t);
- alloc_counts[ (int)alloc_type_shash ].cur_page = cur_page = allocate_page ();
- alloc_counts[ (int)alloc_type_shash ].total_pages++;
- }
-
- ptr = &cur_page->shash[ --unallocated ];
- alloc_counts[ (int)alloc_type_shash ].unallocated = unallocated;
-
-#else
- ptr = (shash_t *) xmalloc (sizeof (shash_t));
-
-#endif
-
- alloc_counts[ (int)alloc_type_shash ].total_alloc++;
- *ptr = initial_shash;
- return ptr;
-}
-
-
-/* Allocate type hash buckets. */
-
-STATIC thash_t *
-allocate_thash __proto((void))
-{
- register thash_t *ptr;
- static thash_t initial_thash;
-
-#ifndef MALLOC_CHECK
- register int unallocated = alloc_counts[ (int)alloc_type_thash ].unallocated;
- register page_t *cur_page = alloc_counts[ (int)alloc_type_thash ].cur_page;
-
- if (unallocated == 0)
- {
- unallocated = PAGE_SIZE / sizeof (thash_t);
- alloc_counts[ (int)alloc_type_thash ].cur_page = cur_page = allocate_page ();
- alloc_counts[ (int)alloc_type_thash ].total_pages++;
- }
-
- ptr = &cur_page->thash[ --unallocated ];
- alloc_counts[ (int)alloc_type_thash ].unallocated = unallocated;
-
-#else
- ptr = (thash_t *) xmalloc (sizeof (thash_t));
-
-#endif
-
- alloc_counts[ (int)alloc_type_thash ].total_alloc++;
- *ptr = initial_thash;
- return ptr;
-}
-
-
-/* Allocate structure, union, or enum tag information. */
-
-STATIC tag_t *
-allocate_tag __proto((void))
-{
- register tag_t *ptr;
- static tag_t initial_tag;
-
-#ifndef MALLOC_CHECK
- ptr = alloc_counts[ (int)alloc_type_tag ].free_list.f_tag;
- if (ptr != (tag_t *) 0)
- alloc_counts[ (int)alloc_type_tag ].free_list.f_tag = ptr->free;
-
- else
- {
- register int unallocated = alloc_counts[ (int)alloc_type_tag ].unallocated;
- register page_t *cur_page = alloc_counts[ (int)alloc_type_tag ].cur_page;
-
- if (unallocated == 0)
- {
- unallocated = PAGE_SIZE / sizeof (tag_t);
- alloc_counts[ (int)alloc_type_tag ].cur_page = cur_page = allocate_page ();
- alloc_counts[ (int)alloc_type_tag ].total_pages++;
- }
-
- ptr = &cur_page->tag[ --unallocated ];
- alloc_counts[ (int)alloc_type_tag ].unallocated = unallocated;
- }
-
-#else
- ptr = (tag_t *) xmalloc (sizeof (tag_t));
-
-#endif
-
- alloc_counts[ (int)alloc_type_tag ].total_alloc++;
- *ptr = initial_tag;
- return ptr;
-}
-
-/* Free scoping information. */
-
-STATIC void
-free_tag (ptr)
- tag_t *ptr;
-{
- alloc_counts[ (int)alloc_type_tag ].total_free++;
-
-#ifndef MALLOC_CHECK
- ptr->free = alloc_counts[ (int)alloc_type_tag ].free_list.f_tag;
- alloc_counts[ (int)alloc_type_tag ].free_list.f_tag = ptr;
-
-#else
- xfree ((PTR_T) ptr);
-#endif
-
-}
-
-
-/* Allocate forward reference to a yet unknown tag. */
-
-STATIC forward_t *
-allocate_forward __proto((void))
-{
- register forward_t *ptr;
- static forward_t initial_forward;
-
-#ifndef MALLOC_CHECK
- ptr = alloc_counts[ (int)alloc_type_forward ].free_list.f_forward;
- if (ptr != (forward_t *) 0)
- alloc_counts[ (int)alloc_type_forward ].free_list.f_forward = ptr->free;
-
- else
- {
- register int unallocated = alloc_counts[ (int)alloc_type_forward ].unallocated;
- register page_t *cur_page = alloc_counts[ (int)alloc_type_forward ].cur_page;
-
- if (unallocated == 0)
- {
- unallocated = PAGE_SIZE / sizeof (forward_t);
- alloc_counts[ (int)alloc_type_forward ].cur_page = cur_page = allocate_page ();
- alloc_counts[ (int)alloc_type_forward ].total_pages++;
- }
-
- ptr = &cur_page->forward[ --unallocated ];
- alloc_counts[ (int)alloc_type_forward ].unallocated = unallocated;
- }
-
-#else
- ptr = (forward_t *) xmalloc (sizeof (forward_t));
-
-#endif
-
- alloc_counts[ (int)alloc_type_forward ].total_alloc++;
- *ptr = initial_forward;
- return ptr;
-}
-
-/* Free scoping information. */
-
-STATIC void
-free_forward (ptr)
- forward_t *ptr;
-{
- alloc_counts[ (int)alloc_type_forward ].total_free++;
-
-#ifndef MALLOC_CHECK
- ptr->free = alloc_counts[ (int)alloc_type_forward ].free_list.f_forward;
- alloc_counts[ (int)alloc_type_forward ].free_list.f_forward = ptr;
-
-#else
- xfree ((PTR_T) ptr);
-#endif
-
-}
-
-
-/* Allocate head of type hash list. */
-
-STATIC thead_t *
-allocate_thead __proto((void))
-{
- register thead_t *ptr;
- static thead_t initial_thead;
-
-#ifndef MALLOC_CHECK
- ptr = alloc_counts[ (int)alloc_type_thead ].free_list.f_thead;
- if (ptr != (thead_t *) 0)
- alloc_counts[ (int)alloc_type_thead ].free_list.f_thead = ptr->free;
-
- else
- {
- register int unallocated = alloc_counts[ (int)alloc_type_thead ].unallocated;
- register page_t *cur_page = alloc_counts[ (int)alloc_type_thead ].cur_page;
-
- if (unallocated == 0)
- {
- unallocated = PAGE_SIZE / sizeof (thead_t);
- alloc_counts[ (int)alloc_type_thead ].cur_page = cur_page = allocate_page ();
- alloc_counts[ (int)alloc_type_thead ].total_pages++;
- }
-
- ptr = &cur_page->thead[ --unallocated ];
- alloc_counts[ (int)alloc_type_thead ].unallocated = unallocated;
- }
-
-#else
- ptr = (thead_t *) xmalloc (sizeof (thead_t));
-
-#endif
-
- alloc_counts[ (int)alloc_type_thead ].total_alloc++;
- *ptr = initial_thead;
- return ptr;
-}
-
-/* Free scoping information. */
-
-STATIC void
-free_thead (ptr)
- thead_t *ptr;
-{
- alloc_counts[ (int)alloc_type_thead ].total_free++;
-
-#ifndef MALLOC_CHECK
- ptr->free = (thead_t *) alloc_counts[ (int)alloc_type_thead ].free_list.f_thead;
- alloc_counts[ (int)alloc_type_thead ].free_list.f_thead = ptr;
-
-#else
- xfree ((PTR_T) ptr);
-#endif
-
-}
-
-#endif /* MIPS_DEBUGGING_INFO */
-
-
-#ifdef HAVE_VPRINTF
-
-/* Output an error message and exit */
-
-/*VARARGS*/
-void
-fatal VPROTO((const char *format, ...))
-{
-#ifndef __STDC__
- char *format;
-#endif
- va_list ap;
-
- VA_START (ap, format);
-
-#ifndef __STDC__
- format = va_arg (ap, char *);
-#endif
-
- if (line_number > 0)
- fprintf (stderr, "%s, %s:%ld ", progname, input_name, line_number);
- else
- fprintf (stderr, "%s:", progname);
-
- vfprintf (stderr, format, ap);
- va_end (ap);
- fprintf (stderr, "\n");
- if (line_number > 0)
- fprintf (stderr, "line:\t%s\n", cur_line_start);
-
- saber_stop ();
- exit (1);
-}
-
-/*VARARGS*/
-void
-error VPROTO((const char *format, ...))
-{
-#ifndef __STDC__
- char *format;
-#endif
- va_list ap;
-
- VA_START (ap, format);
-
-#ifndef __STDC__
- format = va_arg (ap, char *);
-#endif
-
- if (line_number > 0)
- fprintf (stderr, "%s, %s:%ld ", progname, input_name, line_number);
- else
- fprintf (stderr, "%s:", progname);
-
- vfprintf (stderr, format, ap);
- fprintf (stderr, "\n");
- if (line_number > 0)
- fprintf (stderr, "line:\t%s\n", cur_line_start);
-
- had_errors++;
- va_end (ap);
-
- saber_stop ();
-}
-
-#else /* not HAVE_VPRINTF */
-
-void
-fatal (msg, arg1, arg2)
- char *msg, *arg1, *arg2;
-{
- error (msg, arg1, arg2);
- exit (1);
-}
-
-void
-error (msg, arg1, arg2)
- char *msg, *arg1, *arg2;
-{
- fprintf (stderr, "%s: ", progname);
- fprintf (stderr, msg, arg1, arg2);
- fprintf (stderr, "\n");
-}
-
-#endif /* not HAVE_VPRINTF */
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fatal ("Internal abort.");
-}
-
-
-/* When `malloc.c' is compiled with `rcheck' defined,
- it calls this function to report clobberage. */
-
-void
-botch (s)
- const char *s;
-{
- fatal (s);
-}
-
-/* Same as `malloc' but report error if no memory available. */
-
-PTR_T
-xmalloc (size)
- Size_t size;
-{
- register PTR_T value = malloc (size);
- if (value == 0)
- fatal ("Virtual memory exhausted.");
-
- if (debug > 3)
- fprintf (stderr, "\tmalloc\tptr = 0x%.8x, size = %10u\n", value, size);
-
- return value;
-}
-
-/* Same as `calloc' but report error if no memory available. */
-
-PTR_T
-xcalloc (size1, size2)
- Size_t size1, size2;
-{
- register PTR_T value = calloc (size1, size2);
- if (value == 0)
- fatal ("Virtual memory exhausted.");
-
- if (debug > 3)
- fprintf (stderr, "\tcalloc\tptr = 0x%.8x, size1 = %10u, size2 = %10u [%u]\n",
- value, size1, size2, size1+size2);
-
- return value;
-}
-
-/* Same as `realloc' but report error if no memory available. */
-
-PTR_T
-xrealloc (ptr, size)
- PTR_T ptr;
- Size_t size;
-{
- register PTR_T result = realloc (ptr, size);
- if (!result)
- fatal ("Virtual memory exhausted.");
-
- if (debug > 3)
- fprintf (stderr, "\trealloc\tptr = 0x%.8x, size = %10u, orig = 0x%.8x\n",
- result, size, ptr);
-
- return result;
-}
-
-void
-xfree (ptr)
- PTR_T ptr;
-{
- if (debug > 3)
- fprintf (stderr, "\tfree\tptr = 0x%.8x\n", ptr);
-
- free (ptr);
-}
-
-
-/* Define our own index/rindex, since the local and global symbol
- structures as defined by MIPS has an 'index' field. */
-
-STATIC char *
-local_index (str, sentinel)
- const char *str;
- int sentinel;
-{
- int ch;
-
- for ( ; (ch = *str) != sentinel; str++)
- {
- if (ch == '\0')
- return (char *) 0;
- }
-
- return (char *)str;
-}
-
-STATIC char *
-local_rindex (str, sentinel)
- const char *str;
- int sentinel;
-{
- int ch;
- const char *ret = (const char *) 0;
-
- for ( ; (ch = *str) != '\0'; str++)
- {
- if (ch == sentinel)
- ret = str;
- }
-
- return (char *)ret;
-}
diff --git a/gcc/modemap.def b/gcc/modemap.def
deleted file mode 100644
index 753ca54d762..00000000000
--- a/gcc/modemap.def
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Bytecode specific machine mode info for GNU C-compiler.
- Copyright (C) 1993 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. */
-
-/* Map mode to signed, unsigned typecodes, bytecode to push const,
- to load, to store */
-DEF_MODEMAP(QImode, QIcode, QUcode, constQI, loadQI, storeQI)
-DEF_MODEMAP(HImode, HIcode, HUcode, constHI, loadHI, storeHI)
-DEF_MODEMAP(VOIDmode, SIcode, SUcode, constSI, loadSI, storeSI)
-DEF_MODEMAP(SImode, SIcode, SUcode, constSI, loadSI, storeSI)
-DEF_MODEMAP(DImode, DIcode, DUcode, constDI, loadDI, storeDI)
-DEF_MODEMAP(PSImode, Pcode, Pcode, constP, loadP, storeP)
-DEF_MODEMAP(BLKmode, Pcode, Pcode, constP, loadP, neverneverland)
-DEF_MODEMAP(SFmode, SFcode, SFcode, constSF, loadSF, storeSF)
-DEF_MODEMAP(DFmode, DFcode, DFcode, constDF, loadDF, storeDF)
diff --git a/gcc/objc/Makefile.in b/gcc/objc/Makefile.in
deleted file mode 100644
index 76c72868ff5..00000000000
--- a/gcc/objc/Makefile.in
+++ /dev/null
@@ -1,105 +0,0 @@
-# GNU Objective C Runtime Makefile
-# Copyright (C) 1993, 1995, 1996, 1997 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 makefile is run by the parent dir's makefile.
-# thisdir1=`pwd`; \
-# srcdir1=`cd $(srcdir); pwd`; \
-# cd objc; \
-# $(MAKE) $(MAKEFLAGS) -f $$srcdir1/objc/Makefile libobjc.a \
-# srcdir=$$srcdir1 tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
-# GCC_FOR_TARGET="$$thisdir1/xgcc -B$$thisdir1/" \
-# GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$$thisdir1/include
-# OBJC_THREAD_FILE="$(OBJC_THREAD_FILE)"
-# Two targets are used by ../Makefile: `all' and `mostlyclean'.
-
-SHELL=/bin/sh
-
-.SUFFIXES: .m
-
-OPTIMIZE= -O
-
-VPATH = $(srcdir)/objc
-
-AR = ar
-AR_FLAGS = rc
-
-# Always search these dirs when compiling.
-SUBDIR_INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/config
-
-.c.o:
- $(GCC_FOR_TARGET) $(OPTIMIZE) \
- -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $<
-
-.m.o:
- $(GCC_FOR_TARGET) $(OPTIMIZE) -fgnu-runtime \
- -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $<
-
-# If we were not invoked from the parent dir,
-# invoke make in the parent dir and have reinvoke this makefile.
-# That's necessary to get the right values for srcdir, etc.
-all:
- cd ..; $(MAKE) sublibobjc.a
-
-OBJC_O = hash.o sarray.o class.o sendmsg.o init.o archive.o encoding.o \
- selector.o objects.o misc.o NXConstStr.o Object.o Protocol.o \
- nil_method.o thr.o linking.o $(OBJC_THREAD_FILE).o
-
-libobjc.a: $(OBJC_O)
- $(AR) rc libobjc.a $?
-# ranlib is run in the parent directory's makefile.
-
-OBJC_H = hash.h objc-list.h sarray.h objc.h \
- objc-api.h \
- NXConstStr.h Object.h Protocol.h encoding.h typedstream.h thr.h
-
-# copy objc headers to installation include directory
-copy-headers:
- -rm -fr $(incinstalldir)/objc
- -mkdir $(incinstalldir)/objc
- for file in $(OBJC_H); do \
- realfile=$(srcdir)/objc/$${file}; \
- cp $${realfile} $(incinstalldir)/objc; \
- chmod a+r $(incinstalldir)/objc/$${file}; \
- done
-
-mostlyclean:
- -rm -f *.o libobjc.a xforward fflags
-clean: mostlyclean
-distclean: mostlyclean
-extraclean: mostlyclean
-
-# For Sun VPATH.
-
-hash.o: hash.c
-sarray.o: sarray.c
-class.o: class.c
-sendmsg.o: sendmsg.c
-init.o: init.c
-archive.o: archive.c
-encoding.o: encoding.c
-selector.o: selector.c
-objects.o: objects.c
-misc.o: misc.c
-NXConstStr.o: NXConstStr.m
-Object.o: Object.m
-Protocol.o: Protocol.m
-thr.o: thr.h thr.c
-$(OBJC_THREAD_FILE).o: $(OBJC_THREAD_FILE).c
-nil_method.o: nil_method.c
-linking.o: linking.m
diff --git a/gcc/objc/NXConstStr.h b/gcc/objc/NXConstStr.h
deleted file mode 100644
index 6899c74070b..00000000000
--- a/gcc/objc/NXConstStr.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Interface for the NXConstantString class for Objective-C.
- Copyright (C) 1995 Free Software Foundation, Inc.
- Contributed by Pieter J. Schoenmakers <tiggr@es.ele.tue.nl>
-
-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
-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 __nxconstantstring_INCLUDE_GNU
-#define __nxconstantstring_INCLUDE_GNU
-
-#include "objc/Object.h"
-
-@interface NXConstantString: Object
-{
- char *c_string;
- unsigned int len;
-}
-
--(const char *) cString;
--(unsigned int) length;
-
-@end
-
-#endif
diff --git a/gcc/objc/NXConstStr.m b/gcc/objc/NXConstStr.m
deleted file mode 100644
index d3b21174366..00000000000
--- a/gcc/objc/NXConstStr.m
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Implementation of the NXConstantString class for Objective-C.
- Copyright (C) 1995 Free Software Foundation, Inc.
- Contributed by Pieter J. Schoenmakers <tiggr@es.ele.tue.nl>
-
-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
-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 "objc/NXConstStr.h"
-
-@implementation NXConstantString
-
--(const char *) cString
-{
- return (c_string);
-} /* -cString */
-
--(unsigned int) length
-{
- return (len);
-} /* -length */
-
-@end
diff --git a/gcc/objc/Object.h b/gcc/objc/Object.h
deleted file mode 100644
index 7fb86028ea9..00000000000
--- a/gcc/objc/Object.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Interface for the Object class for Objective-C.
- Copyright (C) 1993, 1994, 1995 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
-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. */
-
-/* As a special exception, if you link this library with files compiled
- with GCC to produce an executable, this does not 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 __object_INCLUDE_GNU
-#define __object_INCLUDE_GNU
-
-#include <objc/objc.h>
-#include <objc/typedstream.h>
-
-/*
- * All classes are derived from Object. As such,
- * this is the overhead tacked onto those objects.
- */
-@interface Object
-{
- Class isa; /* A pointer to the instance's class structure */
-}
-
- /* Initializing classes and instances */
-+ initialize;
-- init;
-
- /* Creating, freeing, and copying instances */
-+ new;
-+ alloc;
-- free;
-- copy;
-- shallowCopy;
-- deepen;
-- deepCopy;
-
- /* Identifying classes */
-- (Class)class;
-- (Class)superClass;
-- (MetaClass)metaClass;
-- (const char *)name;
-
- /* Identifying and comparing objects */
-- self;
-- (unsigned int)hash;
-- (BOOL)isEqual:anObject;
-- (int)compare:anotherObject;
-
- /* Testing object type */
-- (BOOL)isMetaClass;
-- (BOOL)isClass;
-- (BOOL)isInstance;
-
- /* Testing inheritance relationships */
-- (BOOL)isKindOf:(Class)aClassObject;
-- (BOOL)isMemberOf:(Class)aClassObject;
-- (BOOL)isKindOfClassNamed:(const char *)aClassName;
-- (BOOL)isMemberOfClassNamed:(const char *)aClassName;
-
- /* Testing class functionality */
-+ (BOOL)instancesRespondTo:(SEL)aSel;
-- (BOOL)respondsTo:(SEL)aSel;
-
- /* Testing protocol conformance */
-- (BOOL)conformsTo:(Protocol*)aProtocol;
-
- /* Introspection */
-+ (IMP)instanceMethodFor:(SEL)aSel;
-- (IMP)methodFor:(SEL)aSel;
-+ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel;
-- (struct objc_method_description *)descriptionForMethod:(SEL)aSel;
-
- /* Sending messages determined at run time */
-- perform:(SEL)aSel;
-- perform:(SEL)aSel with:anObject;
-- perform:(SEL)aSel with:anObject1 with:anObject2;
-
- /* Forwarding */
-- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame;
-- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame;
-
- /* Posing */
-+ poseAs:(Class)aClassObject;
-- (Class)transmuteClassTo:(Class)aClassObject;
-
- /* Enforcing intentions */
-- subclassResponsibility:(SEL)aSel;
-- notImplemented:(SEL)aSel;
-- shouldNotImplement:(SEL)aSel;
-
- /* Error handling */
-- doesNotRecognize:(SEL)aSel;
-- error:(const char *)aString, ...;
-
- /* Archiving */
-+ (int)version;
-+ setVersion:(int)aVersion;
-+ (int)streamVersion: (TypedStream*)aStream;
-
-- read: (TypedStream*)aStream;
-- write: (TypedStream*)aStream;
-- awake;
-
-@end
-
-#endif
diff --git a/gcc/objc/Object.m b/gcc/objc/Object.m
deleted file mode 100644
index 8573f3645a2..00000000000
--- a/gcc/objc/Object.m
+++ /dev/null
@@ -1,387 +0,0 @@
-/* The implementation of class Object for Objective-C.
- Copyright (C) 1993, 1994, 1995, 1997 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
-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. */
-
-/* As a special exception, if you link this library with files compiled
- with GCC to produce an executable, this does not 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. */
-
-#include <stdarg.h>
-#include "objc/Object.h"
-#include "objc/Protocol.h"
-#include "objc/objc-api.h"
-
-extern int errno;
-
-#define MAX_CLASS_NAME_LEN 256
-
-@implementation Object
-
-+ initialize
-{
- return self;
-}
-
-- init
-{
- return self;
-}
-
-+ new
-{
- return [[self alloc] init];
-}
-
-+ alloc
-{
- return class_create_instance(self);
-}
-
-- free
-{
- return object_dispose(self);
-}
-
-- copy
-{
- return [[self shallowCopy] deepen];
-}
-
-- shallowCopy
-{
- return object_copy(self);
-}
-
-- deepen
-{
- return self;
-}
-
-- deepCopy
-{
- return [self copy];
-}
-
-- (Class)class
-{
- return object_get_class(self);
-}
-
-- (Class)superClass
-{
- return object_get_super_class(self);
-}
-
-- (MetaClass)metaClass
-{
- return object_get_meta_class(self);
-}
-
-- (const char *)name
-{
- return object_get_class_name(self);
-}
-
-- self
-{
- return self;
-}
-
-- (unsigned int)hash
-{
- return (size_t)self;
-}
-
-- (BOOL)isEqual:anObject
-{
- return self==anObject;
-}
-
-- (int)compare:anotherObject;
-{
- if ([self isEqual:anotherObject])
- return 0;
- // Ordering objects by their address is pretty useless,
- // so subclasses should override this is some useful way.
- else if (self > anotherObject)
- return 1;
- else
- return -1;
-}
-
-- (BOOL)isMetaClass
-{
- return NO;
-}
-
-- (BOOL)isClass
-{
- return object_is_class(self);
-}
-
-- (BOOL)isInstance
-{
- return object_is_instance(self);
-}
-
-- (BOOL)isKindOf:(Class)aClassObject
-{
- Class class;
-
- for (class = self->isa; class!=Nil; class = class_get_super_class(class))
- if (class==aClassObject)
- return YES;
- return NO;
-}
-
-- (BOOL)isMemberOf:(Class)aClassObject
-{
- return self->isa==aClassObject;
-}
-
-- (BOOL)isKindOfClassNamed:(const char *)aClassName
-{
- Class class;
-
- if (aClassName!=NULL)
- for (class = self->isa; class!=Nil; class = class_get_super_class(class))
- if (!strcmp(class_get_class_name(class), aClassName))
- return YES;
- return NO;
-}
-
-- (BOOL)isMemberOfClassNamed:(const char *)aClassName
-{
- return ((aClassName!=NULL)
- &&!strcmp(class_get_class_name(self->isa), aClassName));
-}
-
-+ (BOOL)instancesRespondTo:(SEL)aSel
-{
- return class_get_instance_method(self, aSel)!=METHOD_NULL;
-}
-
-- (BOOL)respondsTo:(SEL)aSel
-{
- return ((object_is_instance(self)
- ?class_get_instance_method(self->isa, aSel)
- :class_get_class_method(self->isa, aSel))!=METHOD_NULL);
-}
-
-+ (IMP)instanceMethodFor:(SEL)aSel
-{
- return method_get_imp(class_get_instance_method(self, aSel));
-}
-
-// Indicates if the receiving class or instance conforms to the given protocol
-// not usually overridden by subclasses
-//
-// Modified 9/5/94 to always search the class object's protocol list, rather
-// than the meta class.
-
-+ (BOOL) conformsTo: (Protocol*)aProtocol
-{
- int i;
- struct objc_protocol_list* proto_list;
- id parent;
-
- for (proto_list = ((Class)self)->protocols;
- proto_list; proto_list = proto_list->next)
- {
- for (i=0; i < proto_list->count; i++)
- {
- if ([proto_list->list[i] conformsTo: aProtocol])
- return YES;
- }
- }
-
- if (parent = [self superClass])
- return [parent conformsTo: aProtocol];
- else
- return NO;
-}
-
-- (BOOL) conformsTo: (Protocol*)aProtocol
-{
- return [[self class] conformsTo:aProtocol];
-}
-
-- (IMP)methodFor:(SEL)aSel
-{
- return (method_get_imp(object_is_instance(self)
- ?class_get_instance_method(self->isa, aSel)
- :class_get_class_method(self->isa, aSel)));
-}
-
-+ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel
-{
- return ((struct objc_method_description *)
- class_get_instance_method(self, aSel));
-}
-
-- (struct objc_method_description *)descriptionForMethod:(SEL)aSel
-{
- return ((struct objc_method_description *)
- (object_is_instance(self)
- ?class_get_instance_method(self->isa, aSel)
- :class_get_class_method(self->isa, aSel)));
-}
-
-- perform:(SEL)aSel
-{
- IMP msg = objc_msg_lookup(self, aSel);
- if (!msg)
- return [self error:"invalid selector passed to %s", sel_get_name(_cmd)];
- return (*msg)(self, aSel);
-}
-
-- perform:(SEL)aSel with:anObject
-{
- IMP msg = objc_msg_lookup(self, aSel);
- if (!msg)
- return [self error:"invalid selector passed to %s", sel_get_name(_cmd)];
- return (*msg)(self, aSel, anObject);
-}
-
-- perform:(SEL)aSel with:anObject1 with:anObject2
-{
- IMP msg = objc_msg_lookup(self, aSel);
- if (!msg)
- return [self error:"invalid selector passed to %s", sel_get_name(_cmd)];
- return (*msg)(self, aSel, anObject1, anObject2);
-}
-
-- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame
-{
- return (retval_t)[self doesNotRecognize: aSel];
-}
-
-- (retval_t)performv:(SEL)aSel :(arglist_t)argFrame
-{
- return objc_msg_sendv(self, aSel, argFrame);
-}
-
-+ poseAs:(Class)aClassObject
-{
- return class_pose_as(self, aClassObject);
-}
-
-- (Class)transmuteClassTo:(Class)aClassObject
-{
- if (object_is_instance(self))
- if (class_is_class(aClassObject))
- if (class_get_instance_size(aClassObject)==class_get_instance_size(isa))
- if ([self isKindOf:aClassObject])
- {
- Class old_isa = isa;
- isa = aClassObject;
- return old_isa;
- }
- return nil;
-}
-
-- subclassResponsibility:(SEL)aSel
-{
- return [self error:"subclass should override %s", sel_get_name(aSel)];
-}
-
-- notImplemented:(SEL)aSel
-{
- return [self error:"method %s not implemented", sel_get_name(aSel)];
-}
-
-- shouldNotImplement:(SEL)aSel
-{
- return [self error:"%s should not implement %s",
- object_get_class_name(self), sel_get_name(aSel)];
-}
-
-- doesNotRecognize:(SEL)aSel
-{
- return [self error:"%s does not recognize %s",
- object_get_class_name(self), sel_get_name(aSel)];
-}
-
-#ifdef __alpha__
-extern size_t strlen(const char*);
-#endif
-
-- error:(const char *)aString, ...
-{
-#define FMT "error: %s (%s)\n%s\n"
- char fmt[(strlen((char*)FMT)+strlen((char*)object_get_class_name(self))
- +((aString!=NULL)?strlen((char*)aString):0)+8)];
- va_list ap;
-
- sprintf(fmt, FMT, object_get_class_name(self),
- object_is_instance(self)?"instance":"class",
- (aString!=NULL)?aString:"");
- va_start(ap, aString);
- objc_error(self, OBJC_ERR_UNKNOWN, fmt, ap);
- va_end(ap);
- return nil;
-#undef FMT
-}
-
-+ (int)version
-{
- return class_get_version(self);
-}
-
-+ setVersion:(int)aVersion
-{
- class_set_version(self, aVersion);
- return self;
-}
-
-+ (int)streamVersion: (TypedStream*)aStream
-{
- if (aStream->mode == OBJC_READONLY)
- return objc_get_stream_class_version (aStream, self);
- else
- return class_get_version (self);
-}
-
-// These are used to write or read the instance variables
-// declared in this particular part of the object. Subclasses
-// should extend these, by calling [super read/write: aStream]
-// before doing their own archiving. These methods are private, in
-// the sense that they should only be called from subclasses.
-
-- read: (TypedStream*)aStream
-{
- // [super read: aStream];
- return self;
-}
-
-- write: (TypedStream*)aStream
-{
- // [super write: aStream];
- return self;
-}
-
-- awake
-{
- // [super awake];
- return self;
-}
-
-@end
diff --git a/gcc/objc/Protocol.h b/gcc/objc/Protocol.h
deleted file mode 100644
index c7464cf17a9..00000000000
--- a/gcc/objc/Protocol.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Declare the class Protocol for Objective C programs.
- Copyright (C) 1993 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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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 __Protocol_INCLUDE_GNU
-#define __Protocol_INCLUDE_GNU
-
-#include "objc/Object.h"
-
-@interface Protocol : Object
-{
-@private
- char *protocol_name;
- struct objc_protocol_list *protocol_list;
- struct objc_method_description_list *instance_methods, *class_methods;
-}
-
-/* Obtaining attributes intrinsic to the protocol */
-
-- (const char *)name;
-
-/* Testing protocol conformance */
-
-- (BOOL) conformsTo: (Protocol *)aProtocolObject;
-
-/* Looking up information specific to a protocol */
-
-- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
-- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
-
-@end
-
-
-
-
-#endif __Protocol_INCLUDE_GNU
diff --git a/gcc/objc/Protocol.m b/gcc/objc/Protocol.m
deleted file mode 100644
index 43ba44eaf4f..00000000000
--- a/gcc/objc/Protocol.m
+++ /dev/null
@@ -1,128 +0,0 @@
-/* This file contains the implementation of class Protocol.
- Copyright (C) 1993 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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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. */
-
-#include "objc/Protocol.h"
-#include "objc/objc-api.h"
-
-/* Method description list */
-struct objc_method_description_list {
- int count;
- struct objc_method_description list[1];
-};
-
-
-@implementation Protocol
-{
-@private
- char *protocol_name;
- struct objc_protocol_list *protocol_list;
- struct objc_method_description_list *instance_methods, *class_methods;
-}
-
-/* Obtaining attributes intrinsic to the protocol */
-
-- (const char *)name
-{
- return protocol_name;
-}
-
-/* Testing protocol conformance */
-
-- (BOOL) conformsTo: (Protocol *)aProtocolObject
-{
- int i;
- struct objc_protocol_list* proto_list;
-
- if (!strcmp(aProtocolObject->protocol_name, self->protocol_name))
- return YES;
-
- for (proto_list = protocol_list; proto_list; proto_list = proto_list->next)
- {
- for (i=0; i < proto_list->count; i++)
- {
- if ([proto_list->list[i] conformsTo: aProtocolObject])
- return YES;
- }
- }
-
- return NO;
-}
-
-/* Looking up information specific to a protocol */
-
-- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel
-{
- int i;
- struct objc_protocol_list* proto_list;
- const char* name = sel_get_name (aSel);
- struct objc_method_description *result;
-
- for (i = 0; i < instance_methods->count; i++)
- {
- if (!strcmp ((char*)instance_methods->list[i].name, name))
- return &(instance_methods->list[i]);
- }
-
- for (proto_list = protocol_list; proto_list; proto_list = proto_list->next)
- {
- for (i=0; i < proto_list->count; i++)
- {
- if ((result = [proto_list->list[i]
- descriptionForInstanceMethod: aSel]))
- return result;
- }
- }
-
- return NULL;
-}
-
-- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
-{
- int i;
- struct objc_protocol_list* proto_list;
- const char* name = sel_get_name (aSel);
- struct objc_method_description *result;
-
- for (i = 0; i < class_methods->count; i++)
- {
- if (!strcmp ((char*)class_methods->list[i].name, name))
- return &(class_methods->list[i]);
- }
-
- for (proto_list = protocol_list; proto_list; proto_list = proto_list->next)
- {
- for (i=0; i < proto_list->count; i++)
- {
- if ((result = [proto_list->list[i]
- descriptionForClassMethod: aSel]))
- return result;
- }
- }
-
- return NULL;
-}
-
-@end
diff --git a/gcc/objc/README b/gcc/objc/README
deleted file mode 100644
index 70cea30ee2f..00000000000
--- a/gcc/objc/README
+++ /dev/null
@@ -1,97 +0,0 @@
-
-GNU Objective C notes
-*********************
-
-This document is to explain what has been done, and a little about how
-specific features differ from other implementations. The runtime has
-been completely rewritten in gcc 2.4. The earlier runtime had several
-severe bugs and was rather incomplete. The compiler has had several
-new features added as well.
-
-This is not documentation for Objective C, it is usable to someone
-who knows Objective C from somewhere else.
-
-
-Runtime API functions
-=====================
-
-The runtime is modeled after the NeXT Objective C runtime. That is,
-most functions have semantics as it is known from the NeXT. The
-names, however, have changed. All runtime API functions have names
-of lowercase letters and and underscores as opposed to the
-`traditional' mixed case names.
- The runtime api functions are not documented as of now.
-Someone offered to write it, and did it, but we were not allowed to
-use it by his university (Very sad story). We have started writing
-the documentation over again. This will be announced in appropriate
-places when it becomes available.
-
-
-Protocols
-=========
-
-Protocols are now fully supported. The semantics is exactly as on the
-NeXT. There is a flag to specify how protocols should be typechecked
-when adopted to classes. The normal typechecker requires that all
-methods in a given protocol must be implemented in the class that
-adopts it -- it is not enough to inherit them. The flag
-`-Wno-protocol' causes it to allow inherited methods, while
-`-Wprotocols' is the default which requires them defined.
-
-
-+initialize
-===========
-
-This method, if defined, is called before any other instance or class
-methods of that particular class. This method is not inherited, and
-is thus not called as initializer for a subclass that doesn't define
-it itself. Thus, each +initialize method is called exactly once (or
-never if no methods of that particular class is never called).
-Besides this, it is allowed to have several +initialize methods, one
-for each category. The order in which these (multiple methods) are
-called is not well defined. I am not completely certain what the
-semantics of this method is for other implementations, but this is
-how it works for GNU Objective C.
-
-
-Passivation/Activation/Typedstreams
-===================================
-
-This is supported in the style of NeXT TypedStream's. Consult the
-headerfile Typedstreams.h for api functions. I (Kresten) have
-rewritten it in Objective C, but this implementation is not part of
-2.4, it is available from the GNU Objective C prerelease archive.
- There is one difference worth noting concerning objects stored with
-objc_write_object_reference (aka NXWriteObjectReference). When these
-are read back in, their object is not guaranteed to be available until
-the `-awake' method is called in the object that requests that object.
-To objc_read_object you must pass a pointer to an id, which is valid
-after exit from the function calling it (like e.g. an instance
-variable). In general, you should not use objects read in until the
--awake method is called.
-
-
-Acknowledgements
-================
-
-The GNU Objective C team: Geoffrey Knauth <gsk@marble.com> (manager),
-Tom Wood <wood@next.com> (compiler) and Kresten Krab Thorup
-<krab@iesd.auc.dk> (runtime) would like to thank a some people for
-participating in the development of the present GNU Objective C.
-
-Paul Burchard <burchard@geom.umn.edu> and Andrew McCallum
-<mccallum@cs.rochester.edu> has been very helpful debugging the
-runtime. Eric Herring <herring@iesd.auc.dk> has been very helpful
-cleaning up after the documentation-copyright disaster and is now
-helping with the new documentation.
-
-Steve Naroff <snaroff@next.com> and Richard Stallman
-<rms@gnu.ai.mit.edu> has been very helpful with implementation details
-in the compiler.
-
-
-Bug Reports
-===========
-
-Please read the section `Submitting Bugreports' of the gcc manual
-before you submit any bugs.
diff --git a/gcc/objc/README.threads b/gcc/objc/README.threads
deleted file mode 100644
index 2cafb4ea7cf..00000000000
--- a/gcc/objc/README.threads
+++ /dev/null
@@ -1,50 +0,0 @@
-==============================================================================
-README - Wed Nov 29 15:16:24 EST 1995
-------------------------------------------------------------------------------
-
-Limited documentation is available in the THREADS file.
-
-This version has been tested on Sun Solaris, SGI Irix, and Windows NT.
-It should also work on any single threaded system.
-
-Thanks go to the following people for help test and debug the library:
-
- Scott Christley, scottc@ocbi.com
- Andrew McCallum, mccallum@cs.rochester.edu
-
-galen
-gchunt@cs.rochester.edu
-
-Any questions, bug reports, etc should be directed to:
-
-Scott Christley, scottc@ocbi.com
-
-Please do not bug Galen with email as he no longer supports the code.
-
-==============================================================================
-Changes from prior releases (in revered chronological order):
-------------------------------------------------------------------------------
-
-* Fixed bug in copy part of sarray_realloc. I had an < which should
- have been <=. (Bug report from Scott).
-
-------------------------------------------------------------------------------
-
-* Support for DEC OSF/1 is definitely broken. My programs always
- seg-fault when I link with libpthreads.a.
-
-* Thread id's are no longer int's, but are instead of type
- _objc_thread_t which is typedef'ed from a void *. An invalid thread
- id is denoted by NULL and not -1 as before.
-
-------------------------------------------------------------------------------
-
-* Renamed thread-winnt.c to thread-win32.c to better reflect support
- for the API on both Windows NT and Windows 95 platforms.
- (Who knows, maybe even Win32s :-).
-
-* Fixed bugs in Win32 support as per report from Scott Christley.
-
-* Fixed bug in sarray_get as per report from Scott Christley.
-
-
diff --git a/gcc/objc/THREADS b/gcc/objc/THREADS
deleted file mode 100644
index 5c3a4d1a131..00000000000
--- a/gcc/objc/THREADS
+++ /dev/null
@@ -1,336 +0,0 @@
-This file describes in little detail the modifications to the
-Objective-C runtime needed to make it thread safe.
-
-First off, kudos to Galen Hunt who is the author of this great work.
-
-If you have an comments or just want to know where to
-send me money to express your undying graditude for threading the
-Objective-C runtime you can reach Galen at:
-
- gchunt@cs.rochester.edu
-
-Any questions, comments, bug reports, etc. should send email either to the
-GCC bug account or to:
-
- Scott Christley <scottc@net-community.com>
-
-* Sarray Threading:
-
-The most critical component of the Objective-C runtime is the sparse array
-structure (sarray). Sarrays store object selectors and implementations.
-Following in the tradition of the Objective-C runtime, my threading
-support assumes that fast message dispatching is far more important
-than *ANY* and *ALL* other operations. The message dispatching thus
-uses *NO* locks on any kind. In fact, if you look in sarray.h, you
-will notice that the message dispatching has not been modified.
-Instead, I have modified the sarray management functions so that all
-updates to the sarray data structure can be made in parallel will
-message dispatching.
-
-To support concurrent message dispatching, no dynamically allocated
-sarray data structures are freed while more than one thread is
-operational. Sarray data structures that are no longer in use are
-kept in a linked list of garbage and are released whenever the program
-is operating with a single thread. The programmer can also flush the
-garbage list by calling sarray_remove_garbage when the programmer can
-ensure that no message dispatching is taking place concurrently. The
-amount of un-reclaimed sarray garbage should normally be extremely
-small in a real program as sarray structures are freed only when using
-the "poseAs" functionality and early in program initialization, which
-normally occurs while the program is single threaded.
-
-******************************************************************************
-* Static Variables:
-
-The following variables are either statically or globally defined. This list
-does not include variables which are internal to implementation dependent
-versions of thread-*.c.
-
-The following threading designations are used:
- SAFE : Implicitly thread safe.
- SINGLE : Must only be used in single thread mode.
- MUTEX : Protected by single global mutex objc_runtime_mutex.
- UNUSED : Not used in the runtime.
-
-Variable Name: Usage: Defined: Also used in:
-=========================== ====== ============ =====================
-__objc_class_hash MUTEX class.c
-__objc_class_links_resolved UNUSED class.c runtime.h
-__objc_class_number MUTEX class.c
-__objc_dangling_categories UNUSED init.c
-__objc_module_list MUTEX init.c
-__objc_selector_array MUTEX selector.c
-__objc_selector_hash MUTEX selector.c
-__objc_selector_max_index MUTEX selector.c sendmsg.c runtime.h
-__objc_selector_names MUTEX selector.c
-__objc_thread_exit_status SAFE thread.c
-__objc_uninstalled_dtable MUTEX sendmsg.c selector.c
-_objc_load_callback SAFE init.c objc-api.h
-_objc_lookup_class SAFE class.c objc-api.h
-_objc_object_alloc SINGLE objects.c objc-api.h
-_objc_object_copy SINGLE objects.c objc-api.h
-_objc_object_dispose SINGLE objects.c objc-api.h
-frwd_sel SAFE2 sendmsg.c
-idxsize MUTEX sarray.c sendmsg.c sarray.h
-initialize_sel SAFE2 sendmsg.c
-narrays MUTEX sarray.c sendmsg.c sarray.h
-nbuckets MUTEX sarray.c sendmsg.c sarray.h
-nindices MUTEX sarray.c sarray.h
-previous_constructors SAFE1 init.c
-proto_class SAFE1 init.c
-unclaimed_categories MUTEX init.c
-unclaimed_proto_list MUTEX init.c
-uninitialized_statics MUTEX init.c
-
-Notes:
-1) Initialized once in unithread mode.
-2) Initialized value will always be same, guaranteed by lock on selector
- hash table.
-
-
-******************************************************************************
-* Frontend/Backend design:
-
-The design of the Objective-C runtime thread and mutex functions utilizes a
-frontend/backend implementation.
-
-The frontend, as characterized by the files thr.h and thr.c, is a set
-of platform independent structures and functions which represent the
-user interface. Objective-C programs should use these structures and
-functions for their thread and mutex work if they wish to maintain a
-high degree of portability across platforms.
-
-The backend is composed of a file with the necessary code to map the ObjC
-thread and mutex to a platform specific implementation. For example, the
-file thr-solaris.c contains the implementation for Solaris. When you
-configure GCC, it attempts to pick an appropriate backend file for the
-target platform; however, you can override this choice by assign the
-OBJC_THREAD_FILE make variable to the basename of the backend file. This
-is especially useful on platforms which have multiple thread libraries.
-For example:
-
- make OBJC_THREAD_FILE=thr-posix
-
-would indicate that the generic posix backend file, thr-posix.c, should be
-compiled with the ObjC runtime library. If your platform does not support
-threads then you should specify the OBJC_THREAD_FILE=thr-single backend file
-to compile the ObjC runtime library without thread or mutex support; note
-that programs which rely upon the ObjC thread and mutex functions will
-compile and link correctly but attempting to create a thread or mutex will
-result in an error.
-
-
-******************************************************************************
-* Threads:
-
-The thread system attempts to create multiple threads using whatever
-operating system or library thread support is available. It does
-assume that all system functions are thread safe. Notably this means
-that the system implementation of malloc and free must be thread safe.
-If a system has multiple processors, the threads are configured for
-full parallel processing.
-
-*****
-* Frontend thread functions
-* User programs should use these thread functions.
-
-objc_thread_detach(SEL selector, id object, id argument), objc_thread_t
- Creates and detaches a new thread. The new thread starts by
- sending the given selector with a single argument to the
- given object.
-
-objc_thread_set_priority(int priority), int
- Sets a thread's relative priority within the program. Valid
- options are:
-
- OBJC_THREAD_INTERACTIVE_PRIORITY
- OBJC_THREAD_BACKGROUND_PRIORITY
- OBJC_THREAD_LOW_PRIORITY
-
-objc_thread_get_priority(void), int
- Query a thread's priority.
-
-objc_thread_yield(void), void
- Yields processor to another thread with equal or higher
- priority. It is up to the system scheduler to determine if
- the processor is taken or not.
-
-objc_thread_exit(void), int
- Terminates a thread. If this is the last thread executing
- then the program will terminate.
-
-objc_thread_id(void), int
- Returns the current thread's id.
-
-objc_thread_set_data(void *value), int
- Set a pointer to the thread's local storage. Local storage is
- thread specific.
-
-objc_thread_get_data(void), void *
- Returns the pointer to the thread's local storage.
-
-*****
-* Backend thread functions
-* User programs should *NOT* directly call these functions.
-
-__objc_init_thread_system(void), int
- Initialize the thread subsystem. Called once by __objc_exec_class.
- Return -1 if error otherwise return 0.
-
-__objc_fini_thread_system(void), int
- Closes the thread subsystem, not currently guaranteed to be called.
- Return -1 if error otherwise return 0.
-
-__objc_thread_create(void (*func)(void *arg), void *arg), objc_thread_t
- Spawns a new thread executing func, called by objc_thread_detach.
- Return NULL if error otherwise return thread id.
-
-__objc_thread_set_priority(int priority), int
- Set the thread's priority, called by objc_thread_set_priority.
- Return -1 if error otherwise return 0.
-
-__objc_thread_get_priority(void), int
- Query a thread's priority, called by objc_thread_get_priority.
- Return -1 if error otherwise return the priority.
-
-__objc_thread_yield(void), void
- Yields the processor, called by objc_thread_yield.
-
-__objc_thread_exit(void), int
- Terminates the thread, called by objc_thread_exit.
- Return -1 if error otherwise function does not return.
-
-__objc_thread_id(void), objc_thread_t
- Returns the current thread's id, called by objc_thread_id.
- Return -1 if error otherwise return thread id.
-
-__objc_thread_set_data(void *value), int
- Set pointer for thread local storage, called by objc_thread_set_data.
- Returns -1 if error otherwise return 0.
-
-__objc_thread_get_data(void), void *
- Returns the pointer to the thread's local storage.
- Returns NULL if error, called by objc_thread_get_data.
-
-
-******************************************************************************
-* Mutexs:
-
-Mutexs can be locked recursively. Each locked mutex remembers
-its owner (by thread id) and how many times it has been locked. The
-last unlock on a mutex removes the system lock and allows other
-threads to access the mutex.
-
-*****
-* Frontend thread functions
-* User programs should use these thread functions.
-
-objc_mutex_allocate(void), objc_mutex_t
- Allocates a new mutex. Mutex is initially unlocked.
-
-objc_mutex_deallocate(objc_mutex_t mutex), int
- Free a mutex. Before freeing the mutex, makes sure that no
- one else is using it.
-
-objc_mutex_lock(objc_mutex_t mutex), int
- Locks a mutex. As mentioned earlier, the same thread may call
- this routine repeatedly.
-
-objc_mutex_trylock(objc_mutex_t mutex), int
- Attempts to lock a mutex. Returns -1 if failed. If lock on
- mutex can be acquired then function operates exactly as
- objc_mutex_lock.
-
-objc_mutex_unlock(objc_mutex_t mutex), int
- Unlocks the mutex by one level. Other threads may not acquire
- the mutex until this thread has released all locks on it.
-
-*****
-* Backend thread functions
-* User programs should *NOT* directly call these functions.
-
-__objc_mutex_allocate(void), objc_mutex_t
- Allocates a new mutex, called by objc_mutex_allocate.
- Return NULL if error otherwise return mutex pointer.
-
-__objc_mutex_deallocate(objc_mutex_t mutex), int
- Free a mutex, called by objc_mutex_deallocate.
- Return -1 if error otherwise return 0.
-
-__objc_mutex_lock(objc_mutex_t mutex), int
- Locks a mutex, called by objc_mutex_lock.
- Return -1 if error otherwise return 0.
-
-__objc_mutex_trylock(objc_mutex_t mutex), int
- Attempts to lock a mutex, called by objc_mutex_trylock.
- Return -1 if failed to acquire lock or error otherwise return 0.
-
-__objc_mutex_unlock(objc_mutex_t mutex), int
- Unlocks the mutex, called by objc_mutex_unlock.
- Return -1 if error otherwise return 0.
-
-******************************************************************************
-* Condition Mutexs:
-
-Mutexs can be locked recursively. Each locked mutex remembers
-its owner (by thread id) and how many times it has been locked. The
-last unlock on a mutex removes the system lock and allows other
-threads to access the mutex.
-
-*****
-* Frontend thread functions
-* User programs should use these thread functions.
-
-objc_condition_allocate(void), objc_condition_t
- Allocate a condition mutex.
- Return NULL if error otherwise return condition pointer.
-
-objc_condition_deallocate(objc_condition_t condition), int
- Deallocate a condition. Note that this includes an implicit
- condition_broadcast to insure that waiting threads have the
- opportunity to wake. It is legal to dealloc a condition only
- if no other thread is/will be using it. Does NOT check for
- other threads waiting but just wakes them up.
-
-objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int
- Wait on the condition unlocking the mutex until objc_condition_signal()
- or objc_condition_broadcast() are called for the same condition. The
- given mutex *must* have the depth 1 so that it can be unlocked
- here, for someone else can lock it and signal/broadcast the condition.
- The mutex is used to lock access to the shared data that make up the
- "condition" predicate.
-
-objc_condition_broadcast(objc_condition_t condition), int
- Wake up all threads waiting on this condition. It is recommended that
- the called would lock the same mutex as the threads in
- objc_condition_wait before changing the "condition predicate"
- and make this call and unlock it right away after this call.
-
-objc_condition_signal(objc_condition_t condition), int
- Wake up one thread waiting on this condition.
-
-*****
-* Backend thread functions
-* User programs should *NOT* directly call these functions.
-
-__objc_condition_allocate(void), objc_condition_t
- Allocate a condition mutex, called by objc_condition_allocate.
- Return NULL if error otherwise return condition pointer.
-
-__objc_condition_deallocate(objc_condition_t condition), int
- Deallocate a condition, called by objc_condition_deallocate.
- Return -1 if error otherwise return 0.
-
-__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex), int
- Wait on the condition, called by objc_condition_wait.
- Return -1 if error otherwise return 0 when condition is met.
-
-__objc_condition_broadcast(objc_condition_t condition), int
- Wake up all threads waiting on this condition.
- Called by objc_condition_broadcast.
- Return -1 if error otherwise return 0.
-
-__objc_condition_signal(objc_condition_t condition), int
- Wake up one thread waiting on this condition.
- Called by objc_condition_signal.
- Return -1 if error otherwise return 0.
diff --git a/gcc/objc/THREADS.MACH b/gcc/objc/THREADS.MACH
deleted file mode 100644
index 55de6637866..00000000000
--- a/gcc/objc/THREADS.MACH
+++ /dev/null
@@ -1,23 +0,0 @@
-This readme refers to the file thr-mach.c.
-
-Under mach, thread priorities are kinda strange-- any given thread has
-a MAXIMUM priority and a BASE priority. The BASE priority is the
-current priority of the thread and the MAXIMUM is the maximum possible
-priority the thread can assume. The developer can lower, but never
-raise the maximum priority.
-
-The gcc concept of thread priorities is that they run at one of three
-levels; interactive, background, and low.
-
-Under mach, this is translated to:
-
-interactive -- set priority to maximum
-background -- set priority to 2/3 of maximum
-low -- set priority to 1/3 of maximum
-
-This means that it is possible for a thread with the priority of
-interactive to actually run at a lower priority than another thread
-with a background, or even low, priority if the developer has modified
-the maximum priority.
-
-
diff --git a/gcc/objc/archive.c b/gcc/objc/archive.c
deleted file mode 100644
index 2edb056acba..00000000000
--- a/gcc/objc/archive.c
+++ /dev/null
@@ -1,1641 +0,0 @@
-/* GNU Objective C Runtime archiving
- Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include "runtime.h"
-#include "typedstream.h"
-#include "encoding.h"
-
-extern int fflush(FILE*);
-
-#define ROUND(V, A) \
- ({ typeof(V) __v=(V); typeof(A) __a=(A); \
- __a*((__v+__a-1)/__a); })
-
-#define PTR2LONG(P) (((char*)(P))-(char*)0)
-#define LONG2PTR(L) (((char*)0)+(L))
-
-/* Declare some functions... */
-
-static int
-objc_read_class (struct objc_typed_stream* stream, Class* class);
-
-int objc_sizeof_type(const char* type);
-
-static int
-objc_write_use_common (struct objc_typed_stream* stream, unsigned long key);
-
-static int
-objc_write_register_common (struct objc_typed_stream* stream,
- unsigned long key);
-
-static int
-objc_write_class (struct objc_typed_stream* stream,
- struct objc_class* class);
-
-const char* objc_skip_type (const char* type);
-
-static void __objc_finish_write_root_object(struct objc_typed_stream*);
-static void __objc_finish_read_root_object(struct objc_typed_stream*);
-
-static __inline__ int
-__objc_code_unsigned_char (unsigned char* buf, unsigned char val)
-{
- if ((val&_B_VALUE) == val)
- {
- buf[0] = val|_B_SINT;
- return 1;
- }
- else
- {
- buf[0] = _B_NINT|0x01;
- buf[1] = val;
- return 2;
- }
-}
-
-int
-objc_write_unsigned_char (struct objc_typed_stream* stream,
- unsigned char value)
-{
- unsigned char buf[sizeof (unsigned char)+1];
- int len = __objc_code_unsigned_char (buf, value);
- return (*stream->write)(stream->physical, buf, len);
-}
-
-static __inline__ int
-__objc_code_char (unsigned char* buf, char val)
-{
- if (val >= 0)
- return __objc_code_unsigned_char (buf, val);
- else
- {
- buf[0] = _B_NINT|_B_SIGN|0x01;
- buf[1] = -val;
- return 2;
- }
-}
-
-int
-objc_write_char (struct objc_typed_stream* stream, char value)
-{
- unsigned char buf[sizeof (char)+1];
- int len = __objc_code_char (buf, value);
- return (*stream->write)(stream->physical, buf, len);
-}
-
-static __inline__ int
-__objc_code_unsigned_short (unsigned char* buf, unsigned short val)
-{
- if ((val&_B_VALUE) == val)
- {
- buf[0] = val|_B_SINT;
- return 1;
- }
- else
- {
- int c, b;
-
- buf[0] = _B_NINT;
-
- for (c= sizeof(short); c != 0; c -= 1)
- if (((val>>(8*(c-1)))%0x100) != 0)
- break;
-
- buf[0] |= c;
-
- for (b = 1; c != 0; c--, b++)
- {
- buf[b] = (val >> (8*(c-1)))%0x100;
- }
-
- return b;
- }
-}
-
-int
-objc_write_unsigned_short (struct objc_typed_stream* stream,
- unsigned short value)
-{
- unsigned char buf[sizeof (unsigned short)+1];
- int len = __objc_code_unsigned_short (buf, value);
- return (*stream->write)(stream->physical, buf, len);
-}
-
-static __inline__ int
-__objc_code_short (unsigned char* buf, short val)
-{
- int sign = (val < 0);
- int size = __objc_code_unsigned_short (buf, sign ? -val : val);
- if (sign)
- buf[0] |= _B_SIGN;
- return size;
-}
-
-int
-objc_write_short (struct objc_typed_stream* stream, short value)
-{
- unsigned char buf[sizeof (short)+1];
- int len = __objc_code_short (buf, value);
- return (*stream->write)(stream->physical, buf, len);
-}
-
-
-static __inline__ int
-__objc_code_unsigned_int (unsigned char* buf, unsigned int val)
-{
- if ((val&_B_VALUE) == val)
- {
- buf[0] = val|_B_SINT;
- return 1;
- }
- else
- {
- int c, b;
-
- buf[0] = _B_NINT;
-
- for (c= sizeof(int); c != 0; c -= 1)
- if (((val>>(8*(c-1)))%0x100) != 0)
- break;
-
- buf[0] |= c;
-
- for (b = 1; c != 0; c--, b++)
- {
- buf[b] = (val >> (8*(c-1)))%0x100;
- }
-
- return b;
- }
-}
-
-int
-objc_write_unsigned_int (struct objc_typed_stream* stream, unsigned int value)
-{
- unsigned char buf[sizeof(unsigned int)+1];
- int len = __objc_code_unsigned_int (buf, value);
- return (*stream->write)(stream->physical, buf, len);
-}
-
-static __inline__ int
-__objc_code_int (unsigned char* buf, int val)
-{
- int sign = (val < 0);
- int size = __objc_code_unsigned_int (buf, sign ? -val : val);
- if (sign)
- buf[0] |= _B_SIGN;
- return size;
-}
-
-int
-objc_write_int (struct objc_typed_stream* stream, int value)
-{
- unsigned char buf[sizeof(int)+1];
- int len = __objc_code_int (buf, value);
- return (*stream->write)(stream->physical, buf, len);
-}
-
-static __inline__ int
-__objc_code_unsigned_long (unsigned char* buf, unsigned long val)
-{
- if ((val&_B_VALUE) == val)
- {
- buf[0] = val|_B_SINT;
- return 1;
- }
- else
- {
- int c, b;
-
- buf[0] = _B_NINT;
-
- for (c= sizeof(long); c != 0; c -= 1)
- if (((val>>(8*(c-1)))%0x100) != 0)
- break;
-
- buf[0] |= c;
-
- for (b = 1; c != 0; c--, b++)
- {
- buf[b] = (val >> (8*(c-1)))%0x100;
- }
-
- return b;
- }
-}
-
-int
-objc_write_unsigned_long (struct objc_typed_stream* stream,
- unsigned long value)
-{
- unsigned char buf[sizeof(unsigned long)+1];
- int len = __objc_code_unsigned_long (buf, value);
- return (*stream->write)(stream->physical, buf, len);
-}
-
-static __inline__ int
-__objc_code_long (unsigned char* buf, long val)
-{
- int sign = (val < 0);
- int size = __objc_code_unsigned_long (buf, sign ? -val : val);
- if (sign)
- buf[0] |= _B_SIGN;
- return size;
-}
-
-int
-objc_write_long (struct objc_typed_stream* stream, long value)
-{
- unsigned char buf[sizeof(long)+1];
- int len = __objc_code_long (buf, value);
- return (*stream->write)(stream->physical, buf, len);
-}
-
-
-int
-objc_write_string (struct objc_typed_stream* stream,
- const unsigned char* string, unsigned int nbytes)
-{
- unsigned char buf[sizeof(unsigned int)+1];
- int len = __objc_code_unsigned_int (buf, nbytes);
-
- if ((buf[0]&_B_CODE) == _B_SINT)
- buf[0] = (buf[0]&_B_VALUE)|_B_SSTR;
-
- else /* _B_NINT */
- buf[0] = (buf[0]&_B_VALUE)|_B_NSTR;
-
- if ((*stream->write)(stream->physical, buf, len) != 0)
- return (*stream->write)(stream->physical, string, nbytes);
- else
- return 0;
-}
-
-int
-objc_write_string_atomic (struct objc_typed_stream* stream,
- unsigned char* string, unsigned int nbytes)
-{
- unsigned long key;
- if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, string))))
- return objc_write_use_common (stream, key);
- else
- {
- int length;
- hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(string)), string);
- if ((length = objc_write_register_common (stream, key)))
- return objc_write_string (stream, string, nbytes);
- return length;
- }
-}
-
-static int
-objc_write_register_common (struct objc_typed_stream* stream,
- unsigned long key)
-{
- unsigned char buf[sizeof (unsigned long)+2];
- int len = __objc_code_unsigned_long (buf+1, key);
- if (len == 1)
- {
- buf[0] = _B_RCOMM|0x01;
- buf[1] &= _B_VALUE;
- return (*stream->write)(stream->physical, buf, len+1);
- }
- else
- {
- buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM;
- return (*stream->write)(stream->physical, buf+1, len);
- }
-}
-
-static int
-objc_write_use_common (struct objc_typed_stream* stream, unsigned long key)
-{
- unsigned char buf[sizeof (unsigned long)+2];
- int len = __objc_code_unsigned_long (buf+1, key);
- if (len == 1)
- {
- buf[0] = _B_UCOMM|0x01;
- buf[1] &= _B_VALUE;
- return (*stream->write)(stream->physical, buf, 2);
- }
- else
- {
- buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM;
- return (*stream->write)(stream->physical, buf+1, len);
- }
-}
-
-static __inline__ int
-__objc_write_extension (struct objc_typed_stream* stream, unsigned char code)
-{
- if (code <= _B_VALUE)
- {
- unsigned char buf = code|_B_EXT;
- return (*stream->write)(stream->physical, &buf, 1);
- }
- else
- objc_error(nil, OBJC_ERR_BAD_OPCODE,
- "__objc_write_extension: bad opcode %c\n", code);
-}
-
-__inline__ int
-__objc_write_object (struct objc_typed_stream* stream, id object)
-{
- unsigned char buf = '\0';
- SEL write_sel = sel_get_any_uid ("write:");
- if (object)
- {
- __objc_write_extension (stream, _BX_OBJECT);
- objc_write_class (stream, object->class_pointer);
- (*objc_msg_lookup(object, write_sel))(object, write_sel, stream);
- return (*stream->write)(stream->physical, &buf, 1);
- }
- else
- return objc_write_use_common(stream, 0);
-}
-
-int
-objc_write_object_reference (struct objc_typed_stream* stream, id object)
-{
- unsigned long key;
- if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object))))
- return objc_write_use_common (stream, key);
-
- __objc_write_extension (stream, _BX_OBJREF);
- return objc_write_unsigned_long (stream, PTR2LONG (object));
-}
-
-int
-objc_write_root_object (struct objc_typed_stream* stream, id object)
-{
- int len;
- if (stream->writing_root_p)
- objc_error (nil, OBJC_ERR_RECURSE_ROOT,
- "objc_write_root_object called recursively");
- else
- {
- stream->writing_root_p = 1;
- __objc_write_extension (stream, _BX_OBJROOT);
- if((len = objc_write_object (stream, object)))
- __objc_finish_write_root_object(stream);
- stream->writing_root_p = 0;
- }
- return len;
-}
-
-int
-objc_write_object (struct objc_typed_stream* stream, id object)
-{
- unsigned long key;
- if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object))))
- return objc_write_use_common (stream, key);
-
- else if (object == nil)
- return objc_write_use_common(stream, 0);
-
- else
- {
- int length;
- hash_add (&stream->object_table, LONG2PTR(key=PTR2LONG(object)), object);
- if ((length = objc_write_register_common (stream, key)))
- return __objc_write_object (stream, object);
- return length;
- }
-}
-
-#ifdef __alpha__
-extern int atoi (const char*);
-extern size_t strlen(const char*);
-extern size_t strcpy(char*, const char*);
-#endif
-
-__inline__ int
-__objc_write_class (struct objc_typed_stream* stream, struct objc_class* class)
-{
- __objc_write_extension (stream, _BX_CLASS);
- objc_write_string_atomic(stream, (char*)class->name,
- strlen((char*)class->name));
- return objc_write_unsigned_long (stream, class->version);
-}
-
-
-static int
-objc_write_class (struct objc_typed_stream* stream,
- struct objc_class* class)
-{
- unsigned long key;
- if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, class))))
- return objc_write_use_common (stream, key);
- else
- {
- int length;
- hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(class)), class);
- if ((length = objc_write_register_common (stream, key)))
- return __objc_write_class (stream, class);
- return length;
- }
-}
-
-
-__inline__ int
-__objc_write_selector (struct objc_typed_stream* stream, SEL selector)
-{
- const char* sel_name;
- __objc_write_extension (stream, _BX_SEL);
- /* to handle NULL selectors */
- if ((SEL)0 == selector)
- return objc_write_string (stream, "", 0);
- sel_name = sel_get_name (selector);
- return objc_write_string (stream, sel_name, strlen ((char*)sel_name));
-}
-
-int
-objc_write_selector (struct objc_typed_stream* stream, SEL selector)
-{
- const char* sel_name;
- unsigned long key;
-
- /* to handle NULL selectors */
- if ((SEL)0 == selector)
- return __objc_write_selector (stream, selector);
-
- sel_name = sel_get_name (selector);
- if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, sel_name))))
- return objc_write_use_common (stream, key);
- else
- {
- int length;
- hash_add (&stream->stream_table,
- LONG2PTR(key=PTR2LONG(sel_name)), (char*)sel_name);
- if ((length = objc_write_register_common (stream, key)))
- return __objc_write_selector (stream, selector);
- return length;
- }
-}
-
-
-
-/*
-** Read operations
-*/
-
-__inline__ int
-objc_read_char (struct objc_typed_stream* stream, char* val)
-{
- unsigned char buf;
- int len;
- len = (*stream->read)(stream->physical, &buf, 1);
- if (len != 0)
- {
- if ((buf & _B_CODE) == _B_SINT)
- (*val) = (buf & _B_VALUE);
-
- else if ((buf & _B_NUMBER) == 1)
- {
- len = (*stream->read)(stream->physical, val, 1);
- if (buf&_B_SIGN)
- (*val) = -1*(*val);
- }
-
- else
- objc_error(nil, OBJC_ERR_BAD_DATA,
- "expected 8bit signed int, got %dbit int",
- (int)(buf&_B_NUMBER)*8);
- }
- return len;
-}
-
-
-__inline__ int
-objc_read_unsigned_char (struct objc_typed_stream* stream, unsigned char* val)
-{
- unsigned char buf;
- int len;
- if ((len = (*stream->read)(stream->physical, &buf, 1)))
- {
- if ((buf & _B_CODE) == _B_SINT)
- (*val) = (buf & _B_VALUE);
-
- else if ((buf & _B_NUMBER) == 1)
- len = (*stream->read)(stream->physical, val, 1);
-
- else
- objc_error(nil, OBJC_ERR_BAD_DATA,
- "expected 8bit unsigned int, got %dbit int",
- (int)(buf&_B_NUMBER)*8);
- }
- return len;
-}
-
-__inline__ int
-objc_read_short (struct objc_typed_stream* stream, short* value)
-{
- unsigned char buf[sizeof(short)+1];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- if ((buf[0] & _B_CODE) == _B_SINT)
- (*value) = (buf[0] & _B_VALUE);
-
- else
- {
- int pos = 1;
- int nbytes = buf[0] & _B_NUMBER;
- if (nbytes > sizeof (short))
- objc_error(nil, OBJC_ERR_BAD_DATA,
- "expected short, got bigger (%dbits)", nbytes*8);
- len = (*stream->read)(stream->physical, buf+1, nbytes);
- (*value) = 0;
- while (pos <= nbytes)
- (*value) = ((*value)*0x100) + buf[pos++];
- if (buf[0] & _B_SIGN)
- (*value) = -(*value);
- }
- }
- return len;
-}
-
-__inline__ int
-objc_read_unsigned_short (struct objc_typed_stream* stream,
- unsigned short* value)
-{
- unsigned char buf[sizeof(unsigned short)+1];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- if ((buf[0] & _B_CODE) == _B_SINT)
- (*value) = (buf[0] & _B_VALUE);
-
- else
- {
- int pos = 1;
- int nbytes = buf[0] & _B_NUMBER;
- if (nbytes > sizeof (short))
- objc_error(nil, OBJC_ERR_BAD_DATA,
- "expected short, got int or bigger");
- len = (*stream->read)(stream->physical, buf+1, nbytes);
- (*value) = 0;
- while (pos <= nbytes)
- (*value) = ((*value)*0x100) + buf[pos++];
- }
- }
- return len;
-}
-
-
-__inline__ int
-objc_read_int (struct objc_typed_stream* stream, int* value)
-{
- unsigned char buf[sizeof(int)+1];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- if ((buf[0] & _B_CODE) == _B_SINT)
- (*value) = (buf[0] & _B_VALUE);
-
- else
- {
- int pos = 1;
- int nbytes = buf[0] & _B_NUMBER;
- if (nbytes > sizeof (int))
- objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
- len = (*stream->read)(stream->physical, buf+1, nbytes);
- (*value) = 0;
- while (pos <= nbytes)
- (*value) = ((*value)*0x100) + buf[pos++];
- if (buf[0] & _B_SIGN)
- (*value) = -(*value);
- }
- }
- return len;
-}
-
-__inline__ int
-objc_read_long (struct objc_typed_stream* stream, long* value)
-{
- unsigned char buf[sizeof(long)+1];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- if ((buf[0] & _B_CODE) == _B_SINT)
- (*value) = (buf[0] & _B_VALUE);
-
- else
- {
- int pos = 1;
- int nbytes = buf[0] & _B_NUMBER;
- if (nbytes > sizeof (long))
- objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
- len = (*stream->read)(stream->physical, buf+1, nbytes);
- (*value) = 0;
- while (pos <= nbytes)
- (*value) = ((*value)*0x100) + buf[pos++];
- if (buf[0] & _B_SIGN)
- (*value) = -(*value);
- }
- }
- return len;
-}
-
-__inline__ int
-__objc_read_nbyte_uint (struct objc_typed_stream* stream,
- unsigned int nbytes, unsigned int* val)
-{
- int len, pos = 0;
- unsigned char buf[sizeof(unsigned int)+1];
-
- if (nbytes > sizeof (int))
- objc_error(nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
-
- len = (*stream->read)(stream->physical, buf, nbytes);
- (*val) = 0;
- while (pos < nbytes)
- (*val) = ((*val)*0x100) + buf[pos++];
- return len;
-}
-
-
-__inline__ int
-objc_read_unsigned_int (struct objc_typed_stream* stream,
- unsigned int* value)
-{
- unsigned char buf[sizeof(unsigned int)+1];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- if ((buf[0] & _B_CODE) == _B_SINT)
- (*value) = (buf[0] & _B_VALUE);
-
- else
- len = __objc_read_nbyte_uint (stream, (buf[0] & _B_VALUE), value);
-
- }
- return len;
-}
-
-int
-__objc_read_nbyte_ulong (struct objc_typed_stream* stream,
- unsigned int nbytes, unsigned long* val)
-{
- int len, pos = 0;
- unsigned char buf[sizeof(unsigned long)+1];
-
- if (nbytes > sizeof (long))
- objc_error(nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
-
- len = (*stream->read)(stream->physical, buf, nbytes);
- (*val) = 0;
- while (pos < nbytes)
- (*val) = ((*val)*0x100) + buf[pos++];
- return len;
-}
-
-
-__inline__ int
-objc_read_unsigned_long (struct objc_typed_stream* stream,
- unsigned long* value)
-{
- unsigned char buf[sizeof(unsigned long)+1];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- if ((buf[0] & _B_CODE) == _B_SINT)
- (*value) = (buf[0] & _B_VALUE);
-
- else
- len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), value);
-
- }
- return len;
-}
-
-__inline__ int
-objc_read_string (struct objc_typed_stream* stream,
- char** string)
-{
- unsigned char buf[sizeof(unsigned int)+1];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- unsigned long key = 0;
-
- if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
- {
- len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
- len = (*stream->read)(stream->physical, buf, 1);
- }
-
- switch (buf[0]&_B_CODE) {
- case _B_SSTR:
- {
- int length = buf[0]&_B_VALUE;
- (*string) = (char*)objc_malloc(length+1);
- if (key)
- hash_add (&stream->stream_table, LONG2PTR(key), *string);
- len = (*stream->read)(stream->physical, *string, length);
- (*string)[length] = '\0';
- }
- break;
-
- case _B_UCOMM:
- {
- char *tmp;
- len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
- tmp = hash_value_for_key (stream->stream_table, LONG2PTR (key));
- *string = objc_malloc (strlen(tmp) + 1);
- strcpy (*string, tmp);
- }
- break;
-
- case _B_NSTR:
- {
- unsigned int nbytes = buf[0]&_B_VALUE;
- len = __objc_read_nbyte_uint(stream, nbytes, &nbytes);
- if (len) {
- (*string) = (char*)objc_malloc(nbytes+1);
- if (key)
- hash_add (&stream->stream_table, LONG2PTR(key), *string);
- len = (*stream->read)(stream->physical, *string, nbytes);
- (*string)[nbytes] = '\0';
- }
- }
- break;
-
- default:
- objc_error(nil, OBJC_ERR_BAD_DATA,
- "expected string, got opcode %c\n", (buf[0]&_B_CODE));
- }
- }
-
- return len;
-}
-
-
-int
-objc_read_object (struct objc_typed_stream* stream, id* object)
-{
- unsigned char buf[sizeof (unsigned int)];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- SEL read_sel = sel_get_any_uid ("read:");
- unsigned long key = 0;
-
- if ((buf[0]&_B_CODE) == _B_RCOMM) /* register common */
- {
- len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
- len = (*stream->read)(stream->physical, buf, 1);
- }
-
- if (buf[0] == (_B_EXT | _BX_OBJECT))
- {
- Class class;
-
- /* get class */
- len = objc_read_class (stream, &class);
-
- /* create instance */
- (*object) = class_create_instance(class);
-
- /* register? */
- if (key)
- hash_add (&stream->object_table, LONG2PTR(key), *object);
-
- /* send -read: */
- if (__objc_responds_to (*object, read_sel))
- (*get_imp(class, read_sel))(*object, read_sel, stream);
-
- /* check null-byte */
- len = (*stream->read)(stream->physical, buf, 1);
- if (buf[0] != '\0')
- objc_error(nil, OBJC_ERR_BAD_DATA,
- "expected null-byte, got opcode %c", buf[0]);
- }
-
- else if ((buf[0]&_B_CODE) == _B_UCOMM)
- {
- if (key)
- objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
- len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
- (*object) = hash_value_for_key (stream->object_table, LONG2PTR(key));
- }
-
- else if (buf[0] == (_B_EXT | _BX_OBJREF)) /* a forward reference */
- {
- struct objc_list* other;
- len = objc_read_unsigned_long (stream, &key);
- other = (struct objc_list*)hash_value_for_key (stream->object_refs,
- LONG2PTR(key));
- hash_add (&stream->object_refs, LONG2PTR(key),
- (void*)list_cons(object, other));
- }
-
- else if (buf[0] == (_B_EXT | _BX_OBJROOT)) /* a root object */
- {
- if (key)
- objc_error(nil, OBJC_ERR_BAD_KEY,
- "cannot register root object...");
- len = objc_read_object (stream, object);
- __objc_finish_read_root_object (stream);
- }
-
- else
- objc_error(nil, OBJC_ERR_BAD_DATA,
- "expected object, got opcode %c", buf[0]);
- }
- return len;
-}
-
-static int
-objc_read_class (struct objc_typed_stream* stream, Class* class)
-{
- unsigned char buf[sizeof (unsigned int)];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- unsigned long key = 0;
-
- if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
- {
- len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
- len = (*stream->read)(stream->physical, buf, 1);
- }
-
- if (buf[0] == (_B_EXT | _BX_CLASS))
- {
- char* class_name;
- unsigned long version;
-
- /* get class */
- len = objc_read_string (stream, &class_name);
- (*class) = objc_get_class(class_name);
- objc_free(class_name);
-
- /* register */
- if (key)
- hash_add (&stream->stream_table, LONG2PTR(key), *class);
-
- objc_read_unsigned_long(stream, &version);
- hash_add (&stream->class_table, (*class)->name, (void*)version);
- }
-
- else if ((buf[0]&_B_CODE) == _B_UCOMM)
- {
- if (key)
- objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
- len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
- (*class) = hash_value_for_key (stream->stream_table, LONG2PTR(key));
- if (!*class)
- objc_error(nil, OBJC_ERR_BAD_CLASS,
- "cannot find class for key %lu", key);
- }
-
- else
- objc_error(nil, OBJC_ERR_BAD_DATA,
- "expected class, got opcode %c", buf[0]);
- }
- return len;
-}
-
-int
-objc_read_selector (struct objc_typed_stream* stream, SEL* selector)
-{
- unsigned char buf[sizeof (unsigned int)];
- int len;
- if ((len = (*stream->read)(stream->physical, buf, 1)))
- {
- unsigned long key = 0;
-
- if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
- {
- len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
- len = (*stream->read)(stream->physical, buf, 1);
- }
-
- if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */
- {
- char* selector_name;
-
- /* get selector */
- len = objc_read_string (stream, &selector_name);
- /* To handle NULL selectors */
- if (0 == strlen(selector_name))
- {
- (*selector) = (SEL)0;
- return 0;
- }
- else
- (*selector) = sel_get_any_uid(selector_name);
- objc_free(selector_name);
-
- /* register */
- if (key)
- hash_add (&stream->stream_table, LONG2PTR(key), (void*)*selector);
- }
-
- else if ((buf[0]&_B_CODE) == _B_UCOMM)
- {
- if (key)
- objc_error(nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
- len = __objc_read_nbyte_ulong(stream, (buf[0] & _B_VALUE), &key);
- (*selector) = hash_value_for_key (stream->stream_table,
- LONG2PTR(key));
- }
-
- else
- objc_error(nil, OBJC_ERR_BAD_DATA,
- "expected selector, got opcode %c", buf[0]);
- }
- return len;
-}
-
-/*
-** USER LEVEL FUNCTIONS
-*/
-
-/*
-** Write one object, encoded in TYPE and pointed to by DATA to the
-** typed stream STREAM.
-*/
-
-int
-objc_write_type(TypedStream* stream, const char* type, const void* data)
-{
- switch(*type) {
- case _C_ID:
- return objc_write_object (stream, *(id*)data);
- break;
-
- case _C_CLASS:
- return objc_write_class (stream, *(Class*)data);
- break;
-
- case _C_SEL:
- return objc_write_selector (stream, *(SEL*)data);
- break;
-
- case _C_CHR:
- return objc_write_char(stream, *(char*)data);
- break;
-
- case _C_UCHR:
- return objc_write_unsigned_char(stream, *(unsigned char*)data);
- break;
-
- case _C_SHT:
- return objc_write_short(stream, *(short*)data);
- break;
-
- case _C_USHT:
- return objc_write_unsigned_short(stream, *(unsigned short*)data);
- break;
-
- case _C_INT:
- return objc_write_int(stream, *(int*)data);
- break;
-
- case _C_UINT:
- return objc_write_unsigned_int(stream, *(unsigned int*)data);
- break;
-
- case _C_LNG:
- return objc_write_long(stream, *(long*)data);
- break;
-
- case _C_ULNG:
- return objc_write_unsigned_long(stream, *(unsigned long*)data);
- break;
-
- case _C_CHARPTR:
- return objc_write_string (stream, *(char**)data, strlen(*(char**)data));
- break;
-
- case _C_ATOM:
- return objc_write_string_atomic (stream, *(char**)data,
- strlen(*(char**)data));
- break;
-
- case _C_ARY_B:
- {
- int len = atoi(type+1);
- while (isdigit(*++type))
- ;
- return objc_write_array (stream, type, len, data);
- }
- break;
-
- case _C_STRUCT_B:
- {
- int acc_size = 0;
- int align;
- while (*type != _C_STRUCT_E && *type++ != '=')
- ; /* skip "<name>=" */
- while (*type != _C_STRUCT_E)
- {
- align = objc_alignof_type (type); /* padd to alignment */
- acc_size += ROUND (acc_size, align);
- objc_write_type (stream, type, ((char*)data)+acc_size);
- acc_size += objc_sizeof_type (type); /* add component size */
- type = objc_skip_typespec (type); /* skip component */
- }
- return 1;
- }
-
- default:
- objc_error(nil, OBJC_ERR_BAD_TYPE,
- "objc_write_type: cannot parse typespec: %s\n", type);
- }
-}
-
-/*
-** Read one object, encoded in TYPE and pointed to by DATA to the
-** typed stream STREAM. DATA specifies the address of the types to
-** read. Expected type is checked against the type actually present
-** on the stream.
-*/
-
-int
-objc_read_type(TypedStream* stream, const char* type, void* data)
-{
- char c;
- switch(c = *type) {
- case _C_ID:
- return objc_read_object (stream, (id*)data);
- break;
-
- case _C_CLASS:
- return objc_read_class (stream, (Class*)data);
- break;
-
- case _C_SEL:
- return objc_read_selector (stream, (SEL*)data);
- break;
-
- case _C_CHR:
- return objc_read_char (stream, (char*)data);
- break;
-
- case _C_UCHR:
- return objc_read_unsigned_char (stream, (unsigned char*)data);
- break;
-
- case _C_SHT:
- return objc_read_short (stream, (short*)data);
- break;
-
- case _C_USHT:
- return objc_read_unsigned_short (stream, (unsigned short*)data);
- break;
-
- case _C_INT:
- return objc_read_int (stream, (int*)data);
- break;
-
- case _C_UINT:
- return objc_read_unsigned_int (stream, (unsigned int*)data);
- break;
-
- case _C_LNG:
- return objc_read_long (stream, (long*)data);
- break;
-
- case _C_ULNG:
- return objc_read_unsigned_long (stream, (unsigned long*)data);
- break;
-
- case _C_CHARPTR:
- case _C_ATOM:
- return objc_read_string (stream, (char**)data);
- break;
-
- case _C_ARY_B:
- {
- int len = atoi(type+1);
- while (isdigit(*++type))
- ;
- return objc_read_array (stream, type, len, data);
- }
- break;
-
- case _C_STRUCT_B:
- {
- int acc_size = 0;
- int align;
- while (*type != _C_STRUCT_E && *type++ != '=')
- ; /* skip "<name>=" */
- while (*type != _C_STRUCT_E)
- {
- align = objc_alignof_type (type); /* padd to alignment */
- acc_size += ROUND (acc_size, align);
- objc_read_type (stream, type, ((char*)data)+acc_size);
- acc_size += objc_sizeof_type (type); /* add component size */
- type = objc_skip_typespec (type); /* skip component */
- }
- return 1;
- }
-
- default:
- objc_error(nil, OBJC_ERR_BAD_TYPE,
- "objc_read_type: cannot parse typespec: %s\n", type);
- }
-}
-
-/*
-** Write the object specified by the template TYPE to STREAM. Last
-** arguments specify addresses of values to be written. It might
-** seem surprising to specify values by address, but this is extremely
-** convenient for copy-paste with objc_read_types calls. A more
-** down-to-the-earth cause for this passing of addresses is that values
-** of arbitrary size is not well supported in ANSI C for functions with
-** variable number of arguments.
-*/
-
-int
-objc_write_types (TypedStream* stream, const char* type, ...)
-{
- va_list args;
- const char *c;
- int res = 0;
-
- va_start(args, type);
-
- for (c = type; *c; c = objc_skip_typespec (c))
- {
- switch(*c) {
- case _C_ID:
- res = objc_write_object (stream, *va_arg (args, id*));
- break;
-
- case _C_CLASS:
- res = objc_write_class (stream, *va_arg(args, Class*));
- break;
-
- case _C_SEL:
- res = objc_write_selector (stream, *va_arg(args, SEL*));
- break;
-
- case _C_CHR:
- res = objc_write_char (stream, *va_arg (args, char*));
- break;
-
- case _C_UCHR:
- res = objc_write_unsigned_char (stream,
- *va_arg (args, unsigned char*));
- break;
-
- case _C_SHT:
- res = objc_write_short (stream, *va_arg(args, short*));
- break;
-
- case _C_USHT:
- res = objc_write_unsigned_short (stream,
- *va_arg(args, unsigned short*));
- break;
-
- case _C_INT:
- res = objc_write_int(stream, *va_arg(args, int*));
- break;
-
- case _C_UINT:
- res = objc_write_unsigned_int(stream, *va_arg(args, unsigned int*));
- break;
-
- case _C_LNG:
- res = objc_write_long(stream, *va_arg(args, long*));
- break;
-
- case _C_ULNG:
- res = objc_write_unsigned_long(stream, *va_arg(args, unsigned long*));
- break;
-
- case _C_CHARPTR:
- {
- char** str = va_arg(args, char**);
- res = objc_write_string (stream, *str, strlen(*str));
- }
- break;
-
- case _C_ATOM:
- {
- char** str = va_arg(args, char**);
- res = objc_write_string_atomic (stream, *str, strlen(*str));
- }
- break;
-
- case _C_ARY_B:
- {
- int len = atoi(c+1);
- const char* t = c;
- while (isdigit(*++t))
- ;
- res = objc_write_array (stream, t, len, va_arg(args, void*));
- t = objc_skip_typespec (t);
- if (*t != _C_ARY_E)
- objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t);
- }
- break;
-
- default:
- objc_error(nil, OBJC_ERR_BAD_TYPE,
- "objc_write_types: cannot parse typespec: %s\n", type);
- }
- }
- va_end(args);
- return res;
-}
-
-
-/*
-** Last arguments specify addresses of values to be read. Expected
-** type is checked against the type actually present on the stream.
-*/
-
-int
-objc_read_types(TypedStream* stream, const char* type, ...)
-{
- va_list args;
- const char *c;
- int res = 0;
-
- va_start(args, type);
-
- for (c = type; *c; c = objc_skip_typespec(c))
- {
- switch(*c) {
- case _C_ID:
- res = objc_read_object(stream, va_arg(args, id*));
- break;
-
- case _C_CLASS:
- res = objc_read_class(stream, va_arg(args, Class*));
- break;
-
- case _C_SEL:
- res = objc_read_selector(stream, va_arg(args, SEL*));
- break;
-
- case _C_CHR:
- res = objc_read_char(stream, va_arg(args, char*));
- break;
-
- case _C_UCHR:
- res = objc_read_unsigned_char(stream, va_arg(args, unsigned char*));
- break;
-
- case _C_SHT:
- res = objc_read_short(stream, va_arg(args, short*));
- break;
-
- case _C_USHT:
- res = objc_read_unsigned_short(stream, va_arg(args, unsigned short*));
- break;
-
- case _C_INT:
- res = objc_read_int(stream, va_arg(args, int*));
- break;
-
- case _C_UINT:
- res = objc_read_unsigned_int(stream, va_arg(args, unsigned int*));
- break;
-
- case _C_LNG:
- res = objc_read_long(stream, va_arg(args, long*));
- break;
-
- case _C_ULNG:
- res = objc_read_unsigned_long(stream, va_arg(args, unsigned long*));
- break;
-
- case _C_CHARPTR:
- case _C_ATOM:
- {
- char** str = va_arg(args, char**);
- res = objc_read_string (stream, str);
- }
- break;
-
- case _C_ARY_B:
- {
- int len = atoi(c+1);
- const char* t = c;
- while (isdigit(*++t))
- ;
- res = objc_read_array (stream, t, len, va_arg(args, void*));
- t = objc_skip_typespec (t);
- if (*t != _C_ARY_E)
- objc_error(nil, OBJC_ERR_BAD_TYPE, "expected `]', got: %s", t);
- }
- break;
-
- default:
- objc_error(nil, OBJC_ERR_BAD_TYPE,
- "objc_read_types: cannot parse typespec: %s\n", type);
- }
- }
- va_end(args);
- return res;
-}
-
-/*
-** Write an array of COUNT elements of TYPE from the memory address DATA.
-** This is equivalent of objc_write_type (stream, "[N<type>]", data)
-*/
-
-int
-objc_write_array (TypedStream* stream, const char* type,
- int count, const void* data)
-{
- int off = objc_sizeof_type(type);
- const char* where = data;
-
- while (count-- > 0)
- {
- objc_write_type(stream, type, where);
- where += off;
- }
- return 1;
-}
-
-/*
-** Read an array of COUNT elements of TYPE into the memory address
-** DATA. The memory pointed to by data is supposed to be allocated
-** by the callee. This is equivalent of
-** objc_read_type (stream, "[N<type>]", data)
-*/
-
-int
-objc_read_array (TypedStream* stream, const char* type,
- int count, void* data)
-{
- int off = objc_sizeof_type(type);
- char* where = (char*)data;
-
- while (count-- > 0)
- {
- objc_read_type(stream, type, where);
- where += off;
- }
- return 1;
-}
-
-static int
-__objc_fread(FILE* file, char* data, int len)
-{
- return fread(data, len, 1, file);
-}
-
-static int
-__objc_fwrite(FILE* file, char* data, int len)
-{
- return fwrite(data, len, 1, file);
-}
-
-static int
-__objc_feof(FILE* file)
-{
- return feof(file);
-}
-
-static int
-__objc_no_write(FILE* file, char* data, int len)
-{
- objc_error (nil, OBJC_ERR_NO_WRITE, "TypedStream not open for writing");
-}
-
-static int
-__objc_no_read(FILE* file, char* data, int len)
-{
- objc_error (nil, OBJC_ERR_NO_READ, "TypedStream not open for reading");
-}
-
-static int
-__objc_read_typed_stream_signature (TypedStream* stream)
-{
- char buffer[80];
- int pos = 0;
- do
- (*stream->read)(stream->physical, buffer+pos, 1);
- while (buffer[pos++] != '\0')
- ;
- sscanf (buffer, "GNU TypedStream %d", &stream->version);
- if (stream->version != OBJC_TYPED_STREAM_VERSION)
- objc_error (nil, OBJC_ERR_STREAM_VERSION,
- "cannot handle TypedStream version %d", stream->version);
- return 1;
-}
-
-static int
-__objc_write_typed_stream_signature (TypedStream* stream)
-{
- char buffer[80];
- sprintf(buffer, "GNU TypedStream %d", OBJC_TYPED_STREAM_VERSION);
- stream->version = OBJC_TYPED_STREAM_VERSION;
- (*stream->write)(stream->physical, buffer, strlen(buffer)+1);
- return 1;
-}
-
-static void __objc_finish_write_root_object(struct objc_typed_stream* stream)
-{
- hash_delete (stream->object_table);
- stream->object_table = hash_new(64,
- (hash_func_type)hash_ptr,
- (compare_func_type)compare_ptrs);
-}
-
-static void __objc_finish_read_root_object(struct objc_typed_stream* stream)
-{
- node_ptr node;
- SEL awake_sel = sel_get_any_uid ("awake");
- cache_ptr free_list = hash_new (64,
- (hash_func_type) hash_ptr,
- (compare_func_type) compare_ptrs);
-
- /* resolve object forward references */
- for (node = hash_next (stream->object_refs, NULL); node;
- node = hash_next (stream->object_refs, node))
- {
- struct objc_list* reflist = node->value;
- const void* key = node->key;
- id object = hash_value_for_key (stream->object_table, key);
- while(reflist)
- {
- *((id*)reflist->head) = object;
- if (hash_value_for_key (free_list,reflist) == NULL)
- hash_add (&free_list,reflist,reflist);
-
- reflist = reflist->tail;
- }
- }
-
- /* apply __objc_free to all objects stored in free_list */
- for (node = hash_next (free_list, NULL); node;
- node = hash_next (free_list, node))
- objc_free ((void *) node->key);
-
- hash_delete (free_list);
-
- /* empty object reference table */
- hash_delete (stream->object_refs);
- stream->object_refs = hash_new(8, (hash_func_type)hash_ptr,
- (compare_func_type)compare_ptrs);
-
- /* call -awake for all objects read */
- if (awake_sel)
- {
- for (node = hash_next (stream->object_table, NULL); node;
- node = hash_next (stream->object_table, node))
- {
- id object = node->value;
- if (__objc_responds_to (object, awake_sel))
- (*objc_msg_lookup(object, awake_sel))(object, awake_sel);
- }
- }
-
- /* empty object table */
- hash_delete (stream->object_table);
- stream->object_table = hash_new(64,
- (hash_func_type)hash_ptr,
- (compare_func_type)compare_ptrs);
-}
-
-/*
-** Open the stream PHYSICAL in MODE
-*/
-
-TypedStream*
-objc_open_typed_stream (FILE* physical, int mode)
-{
- TypedStream* s = (TypedStream*)objc_malloc(sizeof(TypedStream));
-
- s->mode = mode;
- s->physical = physical;
- s->stream_table = hash_new(64,
- (hash_func_type)hash_ptr,
- (compare_func_type)compare_ptrs);
- s->object_table = hash_new(64,
- (hash_func_type)hash_ptr,
- (compare_func_type)compare_ptrs);
- s->eof = (objc_typed_eof_func)__objc_feof;
- s->flush = (objc_typed_flush_func)fflush;
- s->writing_root_p = 0;
- if (mode == OBJC_READONLY)
- {
- s->class_table = hash_new(8, (hash_func_type)hash_string,
- (compare_func_type)compare_strings);
- s->object_refs = hash_new(8, (hash_func_type)hash_ptr,
- (compare_func_type)compare_ptrs);
- s->read = (objc_typed_read_func)__objc_fread;
- s->write = (objc_typed_write_func)__objc_no_write;
- __objc_read_typed_stream_signature (s);
- }
- else if (mode == OBJC_WRITEONLY)
- {
- s->class_table = 0;
- s->object_refs = 0;
- s->read = (objc_typed_read_func)__objc_no_read;
- s->write = (objc_typed_write_func)__objc_fwrite;
- __objc_write_typed_stream_signature (s);
- }
- else
- {
- objc_close_typed_stream (s);
- return NULL;
- }
- s->type = OBJC_FILE_STREAM;
- return s;
-}
-
-/*
-** Open the file named by FILE_NAME in MODE
-*/
-
-TypedStream*
-objc_open_typed_stream_for_file (const char* file_name, int mode)
-{
- FILE* file = NULL;
- TypedStream* s;
-
- if (mode == OBJC_READONLY)
- file = fopen (file_name, "r");
- else
- file = fopen (file_name, "w");
-
- if (file)
- {
- s = objc_open_typed_stream (file, mode);
- if (s)
- s->type |= OBJC_MANAGED_STREAM;
- return s;
- }
- else
- return NULL;
-}
-
-/*
-** Close STREAM freeing the structure it self. If it was opened with
-** objc_open_typed_stream_for_file, the file will also be closed.
-*/
-
-void
-objc_close_typed_stream (TypedStream* stream)
-{
- if (stream->mode == OBJC_READONLY)
- {
- __objc_finish_read_root_object (stream); /* Just in case... */
- hash_delete (stream->class_table);
- hash_delete (stream->object_refs);
- }
-
- hash_delete (stream->stream_table);
- hash_delete (stream->object_table);
-
- if (stream->type == (OBJC_MANAGED_STREAM | OBJC_FILE_STREAM))
- fclose ((FILE*)stream->physical);
-
- objc_free(stream);
-}
-
-BOOL
-objc_end_of_typed_stream (TypedStream* stream)
-{
- return (*stream->eof)(stream->physical);
-}
-
-void
-objc_flush_typed_stream (TypedStream* stream)
-{
- (*stream->flush)(stream->physical);
-}
-
-long
-objc_get_stream_class_version (TypedStream* stream, Class class)
-{
- if (stream->class_table)
- return PTR2LONG(hash_value_for_key (stream->class_table, class->name));
- else
- return class_get_version (class);
-}
-
diff --git a/gcc/objc/class.c b/gcc/objc/class.c
deleted file mode 100644
index 23bea154910..00000000000
--- a/gcc/objc/class.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/* GNU Objective C Runtime class related functions
- Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup and Dennis Glatting.
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include "runtime.h" /* the kitchen sink */
-#include "sarray.h"
-
-/* The table of classname->class. Used for objc_lookup_class and friends */
-static cache_ptr __objc_class_hash = 0; /* !T:MUTEX */
-
-/* This is a hook which is called by objc_get_class and
- objc_lookup_class if the runtime is not able to find the class.
- This may e.g. try to load in the class using dynamic loading */
-Class (*_objc_lookup_class)(const char* name) = 0; /* !T:SAFE */
-
-
-/* True when class links has been resolved */
-BOOL __objc_class_links_resolved = NO; /* !T:UNUSED */
-
-
-/* Initial number of buckets size of class hash table. */
-#define CLASS_HASH_SIZE 32
-
-void __objc_init_class_tables()
-{
- /* Allocate the class hash table */
-
- if(__objc_class_hash)
- return;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- __objc_class_hash
- = hash_new (CLASS_HASH_SIZE,
- (hash_func_type) hash_string,
- (compare_func_type) compare_strings);
-
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-/* This function adds a class to the class hash table, and assigns the
- class a number, unless it's already known */
-void
-__objc_add_class_to_hash(Class class)
-{
- Class h_class;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- /* make sure the table is there */
- assert(__objc_class_hash);
-
- /* make sure it's not a meta class */
- assert(CLS_ISCLASS(class));
-
- /* Check to see if the class is already in the hash table. */
- h_class = hash_value_for_key (__objc_class_hash, class->name);
- if (!h_class)
- {
- /* The class isn't in the hash table. Add the class and assign a class
- number. */
- static unsigned int class_number = 1;
-
- CLS_SETNUMBER(class, class_number);
- CLS_SETNUMBER(class->class_pointer, class_number);
-
- ++class_number;
- hash_add (&__objc_class_hash, class->name, class);
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-/* Get the class object for the class named NAME. If NAME does not
- identify a known class, the hook _objc_lookup_class is called. If
- this fails, nil is returned */
-Class objc_lookup_class (const char* name)
-{
- Class class;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- /* Make sure the class hash table exists. */
- assert (__objc_class_hash);
-
- class = hash_value_for_key (__objc_class_hash, name);
-
- objc_mutex_unlock(__objc_runtime_mutex);
-
- if (class)
- return class;
-
- if (_objc_lookup_class)
- return (*_objc_lookup_class)(name);
- else
- return 0;
-}
-
-/* Get the class object for the class named NAME. If NAME does not
- identify a known class, the hook _objc_lookup_class is called. If
- this fails, an error message is issued and the system aborts */
-Class
-objc_get_class (const char *name)
-{
- Class class;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- /* Make sure the class hash table exists. */
- assert (__objc_class_hash);
-
- class = hash_value_for_key (__objc_class_hash, name);
-
- objc_mutex_unlock(__objc_runtime_mutex);
-
- if (class)
- return class;
-
- if (_objc_lookup_class)
- class = (*_objc_lookup_class)(name);
-
- if(class)
- return class;
-
- objc_error(nil, OBJC_ERR_BAD_CLASS,
- "objc runtime: cannot find class %s\n", name);
-}
-
-MetaClass
-objc_get_meta_class(const char *name)
-{
- return objc_get_class(name)->class_pointer;
-}
-
-/* This function provides a way to enumerate all the classes in the
- executable. Pass *ENUM_STATE == NULL to start the enumeration. The
- function will return 0 when there are no more classes.
- For example:
- id class;
- void *es = NULL;
- while ((class = objc_next_class(&es)))
- ... do something with class;
-*/
-Class
-objc_next_class(void **enum_state)
-{
- objc_mutex_lock(__objc_runtime_mutex);
-
- /* make sure the table is there */
- assert(__objc_class_hash);
-
- *(node_ptr*)enum_state =
- hash_next(__objc_class_hash, *(node_ptr*)enum_state);
-
- objc_mutex_unlock(__objc_runtime_mutex);
-
- if (*(node_ptr*)enum_state)
- return (*(node_ptr*)enum_state)->value;
- return (Class)0;
-}
-
-/* Resolve super/subclass links for all classes. The only thing we
- can be sure of is that the class_pointer for class objects point
- to the right meta class objects */
-void __objc_resolve_class_links()
-{
- node_ptr node;
- Class object_class = objc_get_class ("Object");
-
- assert(object_class);
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- /* Assign subclass links */
- for (node = hash_next (__objc_class_hash, NULL); node;
- node = hash_next (__objc_class_hash, node))
- {
- Class class1 = node->value;
-
- /* Make sure we have what we think we have. */
- assert (CLS_ISCLASS(class1));
- assert (CLS_ISMETA(class1->class_pointer));
-
- /* The class_pointer of all meta classes point to Object's meta class. */
- class1->class_pointer->class_pointer = object_class->class_pointer;
-
- if (!(CLS_ISRESOLV(class1)))
- {
- CLS_SETRESOLV(class1);
- CLS_SETRESOLV(class1->class_pointer);
-
- if(class1->super_class)
- {
- Class a_super_class
- = objc_get_class ((char *) class1->super_class);
-
- assert (a_super_class);
-
- DEBUG_PRINTF ("making class connections for: %s\n",
- class1->name);
-
- /* assign subclass links for superclass */
- class1->sibling_class = a_super_class->subclass_list;
- a_super_class->subclass_list = class1;
-
- /* Assign subclass links for meta class of superclass */
- if (a_super_class->class_pointer)
- {
- class1->class_pointer->sibling_class
- = a_super_class->class_pointer->subclass_list;
- a_super_class->class_pointer->subclass_list
- = class1->class_pointer;
- }
- }
- else /* a root class, make its meta object */
- /* be a subclass of Object */
- {
- class1->class_pointer->sibling_class
- = object_class->subclass_list;
- object_class->subclass_list = class1->class_pointer;
- }
- }
- }
-
- /* Assign superclass links */
- for (node = hash_next (__objc_class_hash, NULL); node;
- node = hash_next (__objc_class_hash, node))
- {
- Class class1 = node->value;
- Class sub_class;
- for (sub_class = class1->subclass_list; sub_class;
- sub_class = sub_class->sibling_class)
- {
- sub_class->super_class = class1;
- if(CLS_ISCLASS(sub_class))
- sub_class->class_pointer->super_class = class1->class_pointer;
- }
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-
-
-#define CLASSOF(c) ((c)->class_pointer)
-
-Class
-class_pose_as (Class impostor, Class super_class)
-{
- node_ptr node;
- Class class1;
-
- if (!CLS_ISRESOLV (impostor))
- __objc_resolve_class_links ();
-
- /* preconditions */
- assert (impostor);
- assert (super_class);
- assert (impostor->super_class == super_class);
- assert (CLS_ISCLASS (impostor));
- assert (CLS_ISCLASS (super_class));
- assert (impostor->instance_size == super_class->instance_size);
-
- {
- Class *subclass = &(super_class->subclass_list);
-
- /* move subclasses of super_class to impostor */
- while (*subclass)
- {
- Class nextSub = (*subclass)->sibling_class;
-
- if (*subclass != impostor)
- {
- Class sub = *subclass;
-
- /* classes */
- sub->sibling_class = impostor->subclass_list;
- sub->super_class = impostor;
- impostor->subclass_list = sub;
-
- /* It will happen that SUB is not a class object if it is
- the top of the meta class hierarchy chain. (root
- meta-class objects inherit their class object) If that is
- the case... don't mess with the meta-meta class. */
- if (CLS_ISCLASS (sub))
- {
- /* meta classes */
- CLASSOF (sub)->sibling_class =
- CLASSOF (impostor)->subclass_list;
- CLASSOF (sub)->super_class = CLASSOF (impostor);
- CLASSOF (impostor)->subclass_list = CLASSOF (sub);
- }
- }
-
- *subclass = nextSub;
- }
-
- /* set subclasses of superclass to be impostor only */
- super_class->subclass_list = impostor;
- CLASSOF (super_class)->subclass_list = CLASSOF (impostor);
-
- /* set impostor to have no sibling classes */
- impostor->sibling_class = 0;
- CLASSOF (impostor)->sibling_class = 0;
- }
-
- /* check relationship of impostor and super_class is kept. */
- assert (impostor->super_class == super_class);
- assert (CLASSOF (impostor)->super_class == CLASSOF (super_class));
-
- /* This is how to update the lookup table. Regardless of
- what the keys of the hashtable is, change all values that are
- superclass into impostor. */
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- for (node = hash_next (__objc_class_hash, NULL); node;
- node = hash_next (__objc_class_hash, node))
- {
- class1 = (Class)node->value;
- if (class1 == super_class)
- {
- node->value = impostor; /* change hash table value */
- }
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
-
- /* next, we update the dispatch tables... */
- __objc_update_dispatch_table_for_class (CLASSOF (impostor));
- __objc_update_dispatch_table_for_class (impostor);
-
- return impostor;
-}
-
-
diff --git a/gcc/objc/encoding.c b/gcc/objc/encoding.c
deleted file mode 100644
index c90e914f501..00000000000
--- a/gcc/objc/encoding.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/* Encoding of types for Objective C.
- Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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. */
-
-#include "encoding.h"
-
-#define MAX(X, Y) \
- ({ typeof(X) __x = (X), __y = (Y); \
- (__x > __y ? __x : __y); })
-
-#define MIN(X, Y) \
- ({ typeof(X) __x = (X), __y = (Y); \
- (__x < __y ? __x : __y); })
-
-#define ROUND(V, A) \
- ({ typeof(V) __v=(V); typeof(A) __a=(A); \
- __a*((__v+__a-1)/__a); })
-
-
-static inline int
-atoi (const char* str)
-{
- int res = 0;
-
- while (isdigit (*str))
- res *= 10, res += (*str++ - '0');
-
- return res;
-}
-
-/*
- return the size of an object specified by type
-*/
-
-int
-objc_sizeof_type(const char* type)
-{
- switch(*type) {
- case _C_ID:
- return sizeof(id);
- break;
-
- case _C_CLASS:
- return sizeof(Class);
- break;
-
- case _C_SEL:
- return sizeof(SEL);
- break;
-
- case _C_CHR:
- return sizeof(char);
- break;
-
- case _C_UCHR:
- return sizeof(unsigned char);
- break;
-
- case _C_SHT:
- return sizeof(short);
- break;
-
- case _C_USHT:
- return sizeof(unsigned short);
- break;
-
- case _C_INT:
- return sizeof(int);
- break;
-
- case _C_UINT:
- return sizeof(unsigned int);
- break;
-
- case _C_LNG:
- return sizeof(long);
- break;
-
- case _C_ULNG:
- return sizeof(unsigned long);
- break;
-
- case _C_FLT:
- return sizeof(float);
- break;
-
- case _C_DBL:
- return sizeof(double);
- break;
-
- case _C_PTR:
- case _C_ATOM:
- case _C_CHARPTR:
- return sizeof(char*);
- break;
-
- case _C_ARY_B:
- {
- int len = atoi(type+1);
- while (isdigit(*++type));
- return len*objc_aligned_size (type);
- }
- break;
-
- case _C_STRUCT_B:
- {
- int acc_size = 0;
- int align;
- while (*type != _C_STRUCT_E && *type++ != '='); /* skip "<name>=" */
- while (*type != _C_STRUCT_E)
- {
- align = objc_alignof_type (type); /* padd to alignment */
- acc_size = ROUND (acc_size, align);
- acc_size += objc_sizeof_type (type); /* add component size */
- type = objc_skip_typespec (type); /* skip component */
- }
- return acc_size;
- }
-
- case _C_UNION_B:
- {
- int max_size = 0;
- while (*type != _C_UNION_E && *type++ != '=') /* do nothing */;
- while (*type != _C_UNION_E)
- {
- max_size = MAX (max_size, objc_sizeof_type (type));
- type = objc_skip_typespec (type);
- }
- return max_size;
- }
-
- default:
- objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type);
- }
-}
-
-
-/*
- Return the alignment of an object specified by type
-*/
-
-int
-objc_alignof_type(const char* type)
-{
- switch(*type) {
- case _C_ID:
- return __alignof__(id);
- break;
-
- case _C_CLASS:
- return __alignof__(Class);
- break;
-
- case _C_SEL:
- return __alignof__(SEL);
- break;
-
- case _C_CHR:
- return __alignof__(char);
- break;
-
- case _C_UCHR:
- return __alignof__(unsigned char);
- break;
-
- case _C_SHT:
- return __alignof__(short);
- break;
-
- case _C_USHT:
- return __alignof__(unsigned short);
- break;
-
- case _C_INT:
- return __alignof__(int);
- break;
-
- case _C_UINT:
- return __alignof__(unsigned int);
- break;
-
- case _C_LNG:
- return __alignof__(long);
- break;
-
- case _C_ULNG:
- return __alignof__(unsigned long);
- break;
-
- case _C_FLT:
- return __alignof__(float);
- break;
-
- case _C_DBL:
- return __alignof__(double);
- break;
-
- case _C_PTR:
- case _C_ATOM:
- case _C_CHARPTR:
- return __alignof__(char*);
- break;
-
- case _C_ARY_B:
- while (isdigit(*++type)) /* do nothing */;
- return objc_alignof_type (type);
-
- case _C_STRUCT_B:
- {
- struct { int x; double y; } fooalign;
- while(*type != _C_STRUCT_E && *type++ != '=') /* do nothing */;
- if (*type != _C_STRUCT_E)
- return MAX (objc_alignof_type (type), __alignof__ (fooalign));
- else
- return __alignof__ (fooalign);
- }
-
- case _C_UNION_B:
- {
- int maxalign = 0;
- while (*type != _C_UNION_E && *type++ != '=') /* do nothing */;
- while (*type != _C_UNION_E)
- {
- maxalign = MAX (maxalign, objc_alignof_type (type));
- type = objc_skip_typespec (type);
- }
- return maxalign;
- }
-
- default:
- objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type);
- }
-}
-
-/*
- The aligned size if the size rounded up to the nearest alignment.
-*/
-
-int
-objc_aligned_size (const char* type)
-{
- int size = objc_sizeof_type (type);
- int align = objc_alignof_type (type);
- return ROUND (size, align);
-}
-
-/*
- The size rounded up to the nearest integral of the wordsize, taken
- to be the size of a void*.
-*/
-
-int
-objc_promoted_size (const char* type)
-{
- int size = objc_sizeof_type (type);
- int wordsize = sizeof (void*);
-
- return ROUND (size, wordsize);
-}
-
-/*
- Skip type qualifiers. These may eventually precede typespecs
- occurring in method prototype encodings.
-*/
-
-inline const char*
-objc_skip_type_qualifiers (const char* type)
-{
- while (*type == _C_CONST
- || *type == _C_IN
- || *type == _C_INOUT
- || *type == _C_OUT
- || *type == _C_BYCOPY
- || *type == _C_ONEWAY)
- {
- type += 1;
- }
- return type;
-}
-
-
-/*
- Skip one typespec element. If the typespec is prepended by type
- qualifiers, these are skipped as well.
-*/
-
-const char*
-objc_skip_typespec (const char* type)
-{
- type = objc_skip_type_qualifiers (type);
-
- switch (*type) {
-
- case _C_ID:
- /* An id may be annotated by the actual type if it is known
- with the @"ClassName" syntax */
-
- if (*++type != '"')
- return type;
- else
- {
- while (*++type != '"') /* do nothing */;
- return type + 1;
- }
-
- /* The following are one character type codes */
- case _C_CLASS:
- case _C_SEL:
- case _C_CHR:
- case _C_UCHR:
- case _C_CHARPTR:
- case _C_ATOM:
- case _C_SHT:
- case _C_USHT:
- case _C_INT:
- case _C_UINT:
- case _C_LNG:
- case _C_ULNG:
- case _C_FLT:
- case _C_DBL:
- case _C_VOID:
- case _C_UNDEF:
- return ++type;
- break;
-
- case _C_ARY_B:
- /* skip digits, typespec and closing ']' */
-
- while(isdigit(*++type));
- type = objc_skip_typespec(type);
- if (*type == _C_ARY_E)
- return ++type;
- else
- objc_error(nil, OBJC_ERR_BAD_TYPE, "bad array type %s\n", type);
-
- case _C_STRUCT_B:
- /* skip name, and elements until closing '}' */
-
- while (*type != _C_STRUCT_E && *type++ != '=');
- while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); }
- return ++type;
-
- case _C_UNION_B:
- /* skip name, and elements until closing ')' */
-
- while (*type != _C_UNION_E && *type++ != '=');
- while (*type != _C_UNION_E) { type = objc_skip_typespec (type); }
- return ++type;
-
- case _C_PTR:
- /* Just skip the following typespec */
-
- return objc_skip_typespec (++type);
-
- default:
- objc_error(nil, OBJC_ERR_BAD_TYPE, "unknown type %s\n", type);
- }
-}
-
-/*
- Skip an offset as part of a method encoding. This is prepended by a
- '+' if the argument is passed in registers.
-*/
-inline const char*
-objc_skip_offset (const char* type)
-{
- if (*type == '+') type++;
- while(isdigit(*++type));
- return type;
-}
-
-/*
- Skip an argument specification of a method encoding.
-*/
-const char*
-objc_skip_argspec (const char* type)
-{
- type = objc_skip_typespec (type);
- type = objc_skip_offset (type);
- return type;
-}
-
-/*
- Return the number of arguments that the method MTH expects.
- Note that all methods need two implicit arguments `self' and
- `_cmd'.
-*/
-int
-method_get_number_of_arguments (struct objc_method* mth)
-{
- int i = 0;
- const char* type = mth->method_types;
- while (*type)
- {
- type = objc_skip_argspec (type);
- i += 1;
- }
- return i - 1;
-}
-
-/*
- Return the size of the argument block needed on the stack to invoke
- the method MTH. This may be zero, if all arguments are passed in
- registers.
-*/
-
-int
-method_get_sizeof_arguments (struct objc_method* mth)
-{
- const char* type = objc_skip_typespec (mth->method_types);
- return atoi (type);
-}
-
-/*
- Return a pointer to the next argument of ARGFRAME. type points to
- the last argument. Typical use of this look like:
-
- {
- char *datum, *type;
- for (datum = method_get_first_argument (method, argframe, &type);
- datum; datum = method_get_next_argument (argframe, &type))
- {
- unsigned flags = objc_get_type_qualifiers (type);
- type = objc_skip_type_qualifiers (type);
- if (*type != _C_PTR)
- [portal encodeData: datum ofType: type];
- else
- {
- if ((flags & _F_IN) == _F_IN)
- [portal encodeData: *(char**)datum ofType: ++type];
- }
- }
- }
-*/
-
-char*
-method_get_next_argument (arglist_t argframe,
- const char **type)
-{
- const char *t = objc_skip_argspec (*type);
-
- if (*t == '\0')
- return 0;
-
- *type = t;
- t = objc_skip_typespec (t);
-
- if (*t == '+')
- return argframe->arg_regs + atoi (++t);
- else
- return argframe->arg_ptr + atoi (t);
-}
-
-/*
- Return a pointer to the value of the first argument of the method
- described in M with the given argumentframe ARGFRAME. The type
- is returned in TYPE. type must be passed to successive calls of
- method_get_next_argument.
-*/
-char*
-method_get_first_argument (struct objc_method* m,
- arglist_t argframe,
- const char** type)
-{
- *type = m->method_types;
- return method_get_next_argument (argframe, type);
-}
-
-/*
- Return a pointer to the ARGth argument of the method
- M from the frame ARGFRAME. The type of the argument
- is returned in the value-result argument TYPE
-*/
-
-char*
-method_get_nth_argument (struct objc_method* m,
- arglist_t argframe, int arg,
- const char **type)
-{
- const char* t = objc_skip_argspec (m->method_types);
-
- if (arg > method_get_number_of_arguments (m))
- return 0;
-
- while (arg--)
- t = objc_skip_argspec (t);
-
- *type = t;
- t = objc_skip_typespec (t);
-
- if (*t == '+')
- return argframe->arg_regs + atoi (++t);
- else
- return argframe->arg_ptr + atoi (t);
-}
-
-unsigned
-objc_get_type_qualifiers (const char* type)
-{
- unsigned res = 0;
- BOOL flag = YES;
-
- while (flag)
- switch (*type++)
- {
- case _C_CONST: res |= _F_CONST; break;
- case _C_IN: res |= _F_IN; break;
- case _C_INOUT: res |= _F_INOUT; break;
- case _C_OUT: res |= _F_OUT; break;
- case _C_BYCOPY: res |= _F_BYCOPY; break;
- case _C_ONEWAY: res |= _F_ONEWAY; break;
- default: flag = NO;
- }
-
- return res;
-}
diff --git a/gcc/objc/encoding.h b/gcc/objc/encoding.h
deleted file mode 100644
index c956034108a..00000000000
--- a/gcc/objc/encoding.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Encoding of types for Objective C.
- Copyright (C) 1993 Free Software Foundation, Inc.
-
-Author: Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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 __encoding_INCLUDE_GNU
-#define __encoding_INCLUDE_GNU
-
-#include <ctype.h>
-#include "objc/objc-api.h"
-
-#define _C_CONST 'r'
-#define _C_IN 'n'
-#define _C_INOUT 'N'
-#define _C_OUT 'o'
-#define _C_BYCOPY 'O'
-#define _C_ONEWAY 'V'
-
-#define _F_CONST 0x01
-#define _F_IN 0x01
-#define _F_OUT 0x02
-#define _F_INOUT 0x03
-#define _F_BYCOPY 0x04
-#define _F_ONEWAY 0x08
-
-
-int objc_aligned_size (const char* type);
-int objc_sizeof_type (const char* type);
-int objc_alignof_type (const char* type);
-int objc_aligned_size (const char* type);
-int objc_promoted_size (const char* type);
-const char* objc_skip_type_qualifiers (const char* type);
-const char* objc_skip_typespec (const char* type);
-const char* objc_skip_offset (const char* type);
-const char* objc_skip_argspec (const char* type);
-int method_get_number_of_arguments (struct objc_method*);
-int method_get_size_of_arguments (struct objc_method*);
-
-char* method_get_first_argument (struct objc_method*,
- arglist_t argframe,
- const char** type);
-char* method_get_next_argument (arglist_t argframe,
- const char **type);
-char* method_get_nth_argument (struct objc_method* m,
- arglist_t argframe,
- int arg,
- const char **type);
-
-unsigned objc_get_type_qualifiers (const char* type);
-
-
-#endif /* __encoding_INCLUDE_GNU */
diff --git a/gcc/objc/hash.c b/gcc/objc/hash.c
deleted file mode 100644
index 7534330fa1c..00000000000
--- a/gcc/objc/hash.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/* Hash tables for Objective C internal structures
- Copyright (C) 1993, 1996, 1997 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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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. */
-
-#include "assert.h"
-
-#include "objc/hash.h"
-
-#include "runtime.h" /* for DEBUG_PRINTF */
-
-/* These two macros determine when a hash table is full and
- by how much it should be expanded respectively.
-
- These equations are percentages. */
-#define FULLNESS(cache) \
- ((((cache)->size * 75) / 100) <= (cache)->used)
-#define EXPANSION(cache) \
- ((cache)->size * 2)
-
-cache_ptr
-hash_new (unsigned int size, hash_func_type hash_func,
- compare_func_type compare_func)
-{
- cache_ptr cache;
-
- /* Pass me a value greater than 0 and a power of 2. */
- assert (size);
- assert (!(size & (size - 1)));
-
- /* Allocate the cache structure. calloc insures
- its initialization for default values. */
- cache = (cache_ptr) objc_calloc (1, sizeof (struct cache));
- assert (cache);
-
- /* Allocate the array of buckets for the cache.
- calloc initializes all of the pointers to NULL. */
- cache->node_table
- = (node_ptr *) objc_calloc (size, sizeof (node_ptr));
- assert (cache->node_table);
-
- cache->size = size;
-
- /* This should work for all processor architectures? */
- cache->mask = (size - 1);
-
- /* Store the hashing function so that codes can be computed. */
- cache->hash_func = hash_func;
-
- /* Store the function that compares hash keys to
- determine if they are equal. */
- cache->compare_func = compare_func;
-
- return cache;
-}
-
-
-void
-hash_delete (cache_ptr cache)
-{
- node_ptr node;
- node_ptr next_node;
- unsigned int i;
-
- /* Purge all key/value pairs from the table. */
- /* Step through the nodes one by one and remove every node WITHOUT
- using hash_next. this makes hash_delete much more efficient. */
- for (i = 0;i < cache->size;i++) {
- if ((node = cache->node_table[i])) {
- /* an entry in the hash table has been found, now step through the
- nodes next in the list and free them. */
- while ((next_node = node->next)) {
- hash_remove (cache,node->key);
- node = next_node;
- }
-
- hash_remove (cache,node->key);
- }
- }
-
- /* Release the array of nodes and the cache itself. */
- objc_free(cache->node_table);
- objc_free(cache);
-}
-
-
-void
-hash_add (cache_ptr *cachep, const void *key, void *value)
-{
- size_t indx = (*(*cachep)->hash_func)(*cachep, key);
- node_ptr node = (node_ptr) objc_calloc (1, sizeof (struct cache_node));
-
-
- assert (node);
-
- /* Initialize the new node. */
- node->key = key;
- node->value = value;
- node->next = (*cachep)->node_table[indx];
-
- /* Debugging.
- Check the list for another key. */
-#ifdef DEBUG
- { node_ptr node1 = (*cachep)->node_table[indx];
-
- while (node1) {
-
- assert (node1->key != key);
- node1 = node1->next;
- }
- }
-#endif
-
- /* Install the node as the first element on the list. */
- (*cachep)->node_table[indx] = node;
-
- /* Bump the number of entries in the cache. */
- ++(*cachep)->used;
-
- /* Check the hash table's fullness. We're going
- to expand if it is above the fullness level. */
- if (FULLNESS (*cachep)) {
-
- /* The hash table has reached its fullness level. Time to
- expand it.
-
- I'm using a slow method here but is built on other
- primitive functions thereby increasing its
- correctness. */
- node_ptr node1 = NULL;
- cache_ptr new = hash_new (EXPANSION (*cachep),
- (*cachep)->hash_func,
- (*cachep)->compare_func);
-
- DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n",
- *cachep, (*cachep)->size, new->size);
-
- /* Copy the nodes from the first hash table to the new one. */
- while ((node1 = hash_next (*cachep, node1)))
- hash_add (&new, node1->key, node1->value);
-
- /* Trash the old cache. */
- hash_delete (*cachep);
-
- /* Return a pointer to the new hash table. */
- *cachep = new;
- }
-}
-
-
-void
-hash_remove (cache_ptr cache, const void *key)
-{
- size_t indx = (*cache->hash_func)(cache, key);
- node_ptr node = cache->node_table[indx];
-
-
- /* We assume there is an entry in the table. Error if it is not. */
- assert (node);
-
- /* Special case. First element is the key/value pair to be removed. */
- if ((*cache->compare_func)(node->key, key)) {
- cache->node_table[indx] = node->next;
- objc_free(node);
- } else {
-
- /* Otherwise, find the hash entry. */
- node_ptr prev = node;
- BOOL removed = NO;
-
- do {
-
- if ((*cache->compare_func)(node->key, key)) {
- prev->next = node->next, removed = YES;
- objc_free(node);
- } else
- prev = node, node = node->next;
- } while (!removed && node);
- assert (removed);
- }
-
- /* Decrement the number of entries in the hash table. */
- --cache->used;
-}
-
-
-node_ptr
-hash_next (cache_ptr cache, node_ptr node)
-{
- /* If the scan is being started then reset the last node
- visitied pointer and bucket index. */
- if (!node)
- cache->last_bucket = 0;
-
- /* If there is a node visited last then check for another
- entry in the same bucket; Otherwise step to the next bucket. */
- if (node) {
- if (node->next)
- /* There is a node which follows the last node
- returned. Step to that node and retun it. */
- return node->next;
- else
- ++cache->last_bucket;
- }
-
- /* If the list isn't exhausted then search the buckets for
- other nodes. */
- if (cache->last_bucket < cache->size) {
- /* Scan the remainder of the buckets looking for an entry
- at the head of the list. Return the first item found. */
- while (cache->last_bucket < cache->size)
- if (cache->node_table[cache->last_bucket])
- return cache->node_table[cache->last_bucket];
- else
- ++cache->last_bucket;
-
- /* No further nodes were found in the hash table. */
- return NULL;
- } else
- return NULL;
-}
-
-
-/* Given KEY, return corresponding value for it in CACHE.
- Return NULL if the KEY is not recorded. */
-
-void *
-hash_value_for_key (cache_ptr cache, const void *key)
-{
- node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)];
- void *retval = NULL;
-
- if (node)
- do {
- if ((*cache->compare_func)(node->key, key)) {
- retval = node->value;
- break;
- } else
- node = node->next;
- } while (!retval && node);
-
- return retval;
-}
-
-/* Given KEY, return YES if it exists in the CACHE.
- Return NO if it does not */
-
-BOOL
-hash_is_key_in_hash (cache_ptr cache, const void *key)
-{
- node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)];
-
- if (node)
- do {
- if ((*cache->compare_func)(node->key, key))
- return YES;
- else
- node = node->next;
- } while (node);
-
- return NO;
-}
diff --git a/gcc/objc/hash.h b/gcc/objc/hash.h
deleted file mode 100644
index bddb791c820..00000000000
--- a/gcc/objc/hash.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* Hash tables for Objective C method dispatch.
- Copyright (C) 1993, 1995, 1996 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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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 __hash_INCLUDE_GNU
-#define __hash_INCLUDE_GNU
-
-#include <stddef.h>
-#include <objc/objc.h>
-
-/*
- * This data structure is used to hold items
- * stored in a hash table. Each node holds
- * a key/value pair.
- *
- * Items in the cache are really of type void *.
- */
-typedef struct cache_node
-{
- struct cache_node *next; /* Pointer to next entry on the list.
- NULL indicates end of list. */
- const void *key; /* Key used to locate the value. Used
- to locate value when more than one
- key computes the same hash
- value. */
- void *value; /* Value stored for the key. */
-} *node_ptr;
-
-
-/*
- * This data type is the function that computes a hash code given a key.
- * Therefore, the key can be a pointer to anything and the function specific
- * to the key type.
- *
- * Unfortunately there is a mutual data structure reference problem with this
- * typedef. Therefore, to remove compiler warnings the functions passed to
- * hash_new will have to be casted to this type.
- */
-typedef unsigned int (*hash_func_type)(void *, const void *);
-
-/*
- * This data type is the function that compares two hash keys and returns an
- * integer greater than, equal to, or less than 0, according as the first
- * parameter is lexicographically greater than, equal to, or less than the
- * second.
- */
-
-typedef int (*compare_func_type)(const void *, const void *);
-
-
-/*
- * This data structure is the cache.
- *
- * It must be passed to all of the hashing routines
- * (except for new).
- */
-typedef struct cache
-{
- /* Variables used to implement the hash itself. */
- node_ptr *node_table; /* Pointer to an array of hash nodes. */
- /* Variables used to track the size of the hash table so to determine
- when to resize it. */
- unsigned int size; /* Number of buckets allocated for the hash table
- (number of array entries allocated for
- "node_table"). Must be a power of two. */
- unsigned int used; /* Current number of entries in the hash table. */
- unsigned int mask; /* Precomputed mask. */
-
- /* Variables used to implement indexing through the hash table. */
-
- unsigned int last_bucket; /* Tracks which entry in the array where
- the last value was returned. */
- /* Function used to compute a hash code given a key.
- This function is specified when the hash table is created. */
- hash_func_type hash_func;
- /* Function used to compare two hash keys to see if they are equal. */
- compare_func_type compare_func;
-} *cache_ptr;
-
-
-/* Two important hash tables. */
-extern cache_ptr module_hash_table, class_hash_table;
-
-/* Allocate and initialize a hash table. */
-
-cache_ptr hash_new (unsigned int size,
- hash_func_type hash_func,
- compare_func_type compare_func);
-
-/* Deallocate all of the hash nodes and the cache itself. */
-
-void hash_delete (cache_ptr cache);
-
-/* Add the key/value pair to the hash table. If the
- hash table reaches a level of fullness then it will be resized.
-
- assert if the key is already in the hash. */
-
-void hash_add (cache_ptr *cachep, const void *key, void *value);
-
-/* Remove the key/value pair from the hash table.
- assert if the key isn't in the table. */
-
-void hash_remove (cache_ptr cache, const void *key);
-
-/* Used to index through the hash table. Start with NULL
- to get the first entry.
-
- Successive calls pass the value returned previously.
- ** Don't modify the hash during this operation ***
-
- Cache nodes are returned such that key or value can
- be extracted. */
-
-node_ptr hash_next (cache_ptr cache, node_ptr node);
-
-/* Used to return a value from a hash table using a given key. */
-
-void *hash_value_for_key (cache_ptr cache, const void *key);
-
-/* Used to determine if the given key exists in the hash table */
-
-BOOL hash_is_key_in_hash (cache_ptr cache, const void *key);
-
-/************************************************
-
- Useful hashing functions.
-
- Declared inline for your pleasure.
-
-************************************************/
-
-/* Calculate a hash code by performing some
- manipulation of the key pointer. (Use the lowest bits
- except for those likely to be 0 due to alignment.) */
-
-static inline unsigned int
-hash_ptr (cache_ptr cache, const void *key)
-{
- return ((size_t)key / sizeof (void *)) & cache->mask;
-}
-
-
-/* Calculate a hash code by iterating over a NULL
- terminate string. */
-static inline unsigned int
-hash_string (cache_ptr cache, const void *key)
-{
- unsigned int ret = 0;
- unsigned int ctr = 0;
-
-
- while (*(char*)key) {
- ret ^= *(char*)key++ << ctr;
- ctr = (ctr + 1) % sizeof (void *);
- }
-
- return ret & cache->mask;
-}
-
-
-/* Compare two pointers for equality. */
-static inline int
-compare_ptrs (const void *k1, const void *k2)
-{
- return !(k1 - k2);
-}
-
-
-/* Compare two strings. */
-static inline int
-compare_strings (const void *k1, const void *k2)
-{
- if (k1 == k2)
- return 1;
- else if (k1 == 0 || k2 == 0)
- return 0;
- else
- return !strcmp (k1, k2);
-}
-
-
-#endif /* not __hash_INCLUDE_GNU */
diff --git a/gcc/objc/init.c b/gcc/objc/init.c
deleted file mode 100644
index fe64bf43940..00000000000
--- a/gcc/objc/init.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/* GNU Objective C Runtime initialization
- Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include "runtime.h"
-
-/* The version number of this runtime. This must match the number
- defined in gcc (objc-act.c) */
-#define OBJC_VERSION 8
-#define PROTOCOL_VERSION 2
-
-/* This list contains all modules currently loaded into the runtime */
-static struct objc_list* __objc_module_list = 0; /* !T:MUTEX */
-
-/* This list contains all proto_list's not yet assigned class links */
-static struct objc_list* unclaimed_proto_list = 0; /* !T:MUTEX */
-
-/* List of unresolved static instances. */
-static struct objc_list *uninitialized_statics = 0; /* !T:MUTEX */
-
-/* Global runtime "write" mutex. */
-objc_mutex_t __objc_runtime_mutex;
-
-/* Number of threads that are alive. */
-int __objc_runtime_threads_alive = 1; /* !T:MUTEX */
-
-/* Check compiler vs runtime version */
-static void init_check_module_version (Module_t);
-
-/* Assign isa links to protos */
-static void __objc_init_protocols (struct objc_protocol_list* protos);
-
-/* Add protocol to class */
-static void __objc_class_add_protocols (Class, struct objc_protocol_list*);
-
-/* This is a hook which is called by __objc_exec_class every time a class
- or a category is loaded into the runtime. This may e.g. help a
- dynamic loader determine the classes that have been loaded when
- an object file is dynamically linked in */
-void (*_objc_load_callback)(Class class, Category* category) = 0; /* !T:SAFE */
-
-/* Is all categories/classes resolved? */
-BOOL __objc_dangling_categories = NO; /* !T:UNUSED */
-
-extern SEL
-__sel_register_typed_name (const char *name, const char *types,
- struct objc_selector *orig, BOOL is_const);
-
-/* Send +load to all classes and categories from a module that implement
- this method */
-static void __objc_send_load(Module_t module);
-
-/* This list contains all the classes in the runtime system for whom their
- superclasses are not yet know to the runtime. */
-static struct objc_list* unresolved_classes = 0;
-
-/* Static function used to references the Object and NXConstantString classes. */
-static void
-__objc_force_linking (void)
-{
- extern void __objc_linking (void);
- __objc_linking ();
-
- /* Call the function to avoid compiler warning */
- __objc_force_linking ();
-}
-
-/* Run through the statics list, removing modules as soon as all its statics
- have been initialized. */
-static void
-objc_init_statics ()
-{
- struct objc_list **cell = &uninitialized_statics;
- struct objc_static_instances **statics_in_module;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- while (*cell)
- {
- int module_initialized = 1;
-
- for (statics_in_module = (*cell)->head;
- *statics_in_module; statics_in_module++)
- {
- struct objc_static_instances *statics = *statics_in_module;
- Class class = objc_lookup_class (statics->class_name);
-
- if (!class)
- module_initialized = 0;
- /* Actually, the static's class_pointer will be NULL when we
- haven't been here before. However, the comparison is to be
- reminded of taking into account class posing and to think about
- possible semantics... */
- else if (class != statics->instances[0]->class_pointer)
- {
- id *inst;
-
- for (inst = &statics->instances[0]; *inst; inst++)
- {
- (*inst)->class_pointer = class;
-
- /* ??? Make sure the object will not be freed. With
- refcounting, invoke `-retain'. Without refcounting, do
- nothing and hope that `-free' will never be invoked. */
-
- /* ??? Send the object an `-initStatic' or something to
- that effect now or later on? What are the semantics of
- statically allocated instances, besides the trivial
- NXConstantString, anyway? */
- }
- }
- }
- if (module_initialized)
- {
- /* Remove this module from the uninitialized list. */
- struct objc_list *this = *cell;
- *cell = this->tail;
- objc_free(this);
- }
- else
- cell = &(*cell)->tail;
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
-} /* objc_init_statics */
-
-/* This function is called by constructor functions generated for each
- module compiled. (_GLOBAL_$I$...) The purpose of this function is to
- gather the module pointers so that they may be processed by the
- initialization routines as soon as possible */
-
-void
-__objc_exec_class (Module_t module)
-{
- /* Have we processed any constructors previously? This flag is used to
- indicate that some global data structures need to be built. */
- static BOOL previous_constructors = 0;
-
- static struct objc_list* unclaimed_categories = 0;
-
- /* The symbol table (defined in objc-api.h) generated by gcc */
- Symtab_t symtab = module->symtab;
-
- /* The statics in this module */
- struct objc_static_instances **statics
- = symtab->defs[symtab->cls_def_cnt + symtab->cat_def_cnt];
-
- /* Entry used to traverse hash lists */
- struct objc_list** cell;
-
- /* The table of selector references for this module */
- SEL selectors = symtab->refs;
-
- /* dummy counter */
- int i;
-
- DEBUG_PRINTF ("received module: %s\n", module->name);
-
- /* check gcc version */
- init_check_module_version(module);
-
- /* On the first call of this routine, initialize some data structures. */
- if (!previous_constructors)
- {
- /* Initialize thread-safe system */
- __objc_init_thread_system();
- __objc_runtime_threads_alive = 1;
- __objc_runtime_mutex = objc_mutex_allocate();
-
- __objc_init_selector_tables();
- __objc_init_class_tables();
- __objc_init_dispatch_tables();
- previous_constructors = 1;
- }
-
- /* Save the module pointer for later processing. (not currently used) */
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_module_list = list_cons(module, __objc_module_list);
-
- /* Replace referenced selectors from names to SEL's. */
- if (selectors)
- {
- for (i = 0; selectors[i].sel_id; ++i)
- {
- const char *name, *type;
- name = (char*)selectors[i].sel_id;
- type = (char*)selectors[i].sel_types;
- /* Constructors are constant static data so we can safely store
- pointers to them in the runtime structures. is_const == YES */
- __sel_register_typed_name (name, type,
- (struct objc_selector*)&(selectors[i]),
- YES);
- }
- }
-
- /* Parse the classes in the load module and gather selector information. */
- DEBUG_PRINTF ("gathering selectors from module: %s\n", module->name);
- for (i = 0; i < symtab->cls_def_cnt; ++i)
- {
- Class class = (Class) symtab->defs[i];
- const char* superclass = (char*)class->super_class;
-
- /* Make sure we have what we think. */
- assert (CLS_ISCLASS(class));
- assert (CLS_ISMETA(class->class_pointer));
- DEBUG_PRINTF ("phase 1, processing class: %s\n", class->name);
-
- /* Store the class in the class table and assign class numbers. */
- __objc_add_class_to_hash (class);
-
- /* Register all of the selectors in the class and meta class. */
- __objc_register_selectors_from_class (class);
- __objc_register_selectors_from_class ((Class) class->class_pointer);
-
- /* Install the fake dispatch tables */
- __objc_install_premature_dtable(class);
- __objc_install_premature_dtable(class->class_pointer);
-
- if (class->protocols)
- __objc_init_protocols (class->protocols);
-
- /* Check to see if the superclass is known in this point. If it's not
- add the class to the unresolved_classes list. */
- if (superclass && !objc_lookup_class (superclass))
- unresolved_classes = list_cons (class, unresolved_classes);
- }
-
- /* Process category information from the module. */
- for (i = 0; i < symtab->cat_def_cnt; ++i)
- {
- Category_t category = symtab->defs[i + symtab->cls_def_cnt];
- Class class = objc_lookup_class (category->class_name);
-
- /* If the class for the category exists then append its methods. */
- if (class)
- {
-
- DEBUG_PRINTF ("processing categories from (module,object): %s, %s\n",
- module->name,
- class->name);
-
- /* Do instance methods. */
- if (category->instance_methods)
- class_add_method_list (class, category->instance_methods);
-
- /* Do class methods. */
- if (category->class_methods)
- class_add_method_list ((Class) class->class_pointer,
- category->class_methods);
-
- if (category->protocols)
- {
- __objc_init_protocols (category->protocols);
- __objc_class_add_protocols (class, category->protocols);
- }
-
- if (_objc_load_callback)
- _objc_load_callback(class, category);
- }
- else
- {
- /* The object to which the category methods belong can't be found.
- Save the information. */
- unclaimed_categories = list_cons(category, unclaimed_categories);
- }
- }
-
- if (statics)
- uninitialized_statics = list_cons (statics, uninitialized_statics);
- if (uninitialized_statics)
- objc_init_statics ();
-
- /* Scan the unclaimed category hash. Attempt to attach any unclaimed
- categories to objects. */
- for (cell = &unclaimed_categories;
- *cell;
- ({ if (*cell) cell = &(*cell)->tail; }))
- {
- Category_t category = (*cell)->head;
- Class class = objc_lookup_class (category->class_name);
-
- if (class)
- {
- DEBUG_PRINTF ("attaching stored categories to object: %s\n",
- class->name);
-
- list_remove_head (cell);
-
- if (category->instance_methods)
- class_add_method_list (class, category->instance_methods);
-
- if (category->class_methods)
- class_add_method_list ((Class) class->class_pointer,
- category->class_methods);
-
- if (category->protocols)
- {
- __objc_init_protocols (category->protocols);
- __objc_class_add_protocols (class, category->protocols);
- }
-
- if (_objc_load_callback)
- _objc_load_callback(class, category);
- }
- }
-
- if (unclaimed_proto_list && objc_lookup_class ("Protocol"))
- {
- list_mapcar (unclaimed_proto_list,(void(*)(void*))__objc_init_protocols);
- list_free (unclaimed_proto_list);
- unclaimed_proto_list = 0;
- }
-
- objc_send_load ();
-
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-void objc_send_load (void)
-{
- if (!__objc_module_list)
- return;
-
- /* Try to find out if all the classes loaded so far also have their
- superclasses known to the runtime. We suppose that the objects that are
- allocated in the +load method are in general of a class declared in the
- same module. */
- if (unresolved_classes)
- {
- Class class = unresolved_classes->head;
-
- while (objc_lookup_class ((char*)class->super_class))
- {
- list_remove_head (&unresolved_classes);
- if (unresolved_classes)
- class = unresolved_classes->head;
- else
- break;
- }
-
- /*
- * If we still have classes for which we don't have yet their super
- * classes known to the runtime we don't send the +load messages.
- */
- if (unresolved_classes)
- return;
- }
-
- /* Special check to allow sending messages to constant strings in +load
- methods. If the class is not yet known, even if all the classes are known,
- delay sending of +load. */
- if (!objc_lookup_class ("NXConstantString"))
- return;
-
- /* Iterate over all modules in the __objc_module_list and call on them the
- __objc_send_load function that sends the +load message. */
- list_mapcar (__objc_module_list, (void(*)(void*))__objc_send_load);
- list_free (__objc_module_list);
- __objc_module_list = NULL;
-}
-
-static void
-__objc_send_message_in_list (MethodList_t method_list, id object, SEL op)
-{
- while (method_list)
- {
- int i;
-
- /* Search the method list. */
- for (i = 0; i < method_list->method_count; i++)
- {
- Method_t mth = &method_list->method_list[i];
-
- if (mth->method_name && sel_eq (mth->method_name, op))
- {
- /* The method was found. */
- (*mth->method_imp) (object, mth->method_name);
- break;
- }
- }
- method_list = method_list->method_next;
- }
-}
-
-static void
-__objc_send_load(Module_t module)
-{
- /* The runtime mutex is locked in this point */
-
- Symtab_t symtab = module->symtab;
- static SEL load_sel = 0;
- int i;
-
- if (!load_sel)
- load_sel = sel_register_name ("load");
-
- /* Iterate thru classes defined in this module and send them the +load
- message if they implement it. At this point all methods defined in
- categories were added to the corresponding class, so all the +load
- methods of categories are in their corresponding classes. */
- for (i = 0; i < symtab->cls_def_cnt; i++)
- {
- Class class = (Class) symtab->defs[i];
- MethodList_t method_list = class->class_pointer->methods;
-
- __objc_send_message_in_list (method_list, (id)class, load_sel);
-
- /* Call the _objc_load_callback for this class. */
- if (_objc_load_callback)
- _objc_load_callback(class, 0);
- }
-
- /* Call the _objc_load_callback for categories. Don't register the instance
- methods as class methods for categories to root classes since they were
- already added in the class. */
- for (i = 0; i < symtab->cat_def_cnt; i++)
- {
- Category_t category = symtab->defs[i + symtab->cls_def_cnt];
- Class class = objc_lookup_class (category->class_name);
-
- if (_objc_load_callback)
- _objc_load_callback(class, category);
- }
-}
-
-/* Sanity check the version of gcc used to compile `module'*/
-static void init_check_module_version(Module_t module)
-{
- if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module)))
- {
- int code;
-
- if(module->version > OBJC_VERSION)
- code = OBJC_ERR_OBJC_VERSION;
- else if (module->version < OBJC_VERSION)
- code = OBJC_ERR_GCC_VERSION;
- else
- code = OBJC_ERR_MODULE_SIZE;
-
- objc_error(nil, code, "Module %s version %d doesn't match runtime %d\n",
- module->name, (int)module->version, OBJC_VERSION);
- }
-}
-
-static void
-__objc_init_protocols (struct objc_protocol_list* protos)
-{
- int i;
- static Class proto_class = 0;
-
- if (! protos)
- return;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- if (!proto_class)
- proto_class = objc_lookup_class("Protocol");
-
- if (!proto_class)
- {
- unclaimed_proto_list = list_cons (protos, unclaimed_proto_list);
- objc_mutex_unlock(__objc_runtime_mutex);
- return;
- }
-
-#if 0
- assert (protos->next == 0); /* only single ones allowed */
-#endif
-
- for(i = 0; i < protos->count; i++)
- {
- struct objc_protocol* aProto = protos->list[i];
- if (((size_t)aProto->class_pointer) == PROTOCOL_VERSION)
- {
- /* assign class pointer */
- aProto->class_pointer = proto_class;
-
- /* init super protocols */
- __objc_init_protocols (aProto->protocol_list);
- }
- else if (protos->list[i]->class_pointer != proto_class)
- {
- objc_error(nil, OBJC_ERR_PROTOCOL_VERSION,
- "Version %d doesn't match runtime protocol version %d\n",
- (int)((char*)protos->list[i]->class_pointer-(char*)0),
- PROTOCOL_VERSION);
- }
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-static void __objc_class_add_protocols (Class class,
- struct objc_protocol_list* protos)
-{
- /* Well... */
- if (! protos)
- return;
-
- /* Add it... */
- protos->next = class->protocols;
- class->protocols = protos;
-}
diff --git a/gcc/objc/linking.m b/gcc/objc/linking.m
deleted file mode 100644
index 8ecca028110..00000000000
--- a/gcc/objc/linking.m
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Force linking of classes required by Objective C runtime.
- Copyright (C) 1997 Free Software Foundation, Inc.
- Contributed by Ovidiu Predescu (ovidiu@net-community.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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <objc/Object.h>
-#include <objc/NXConstStr.h>
-
-/* Generate references to Object and NXConstanstString classes since they are
- needed by the runtime system to run correctly. */
-
-
-void __objc_linking (void)
-{
- [Object name];
- [NXConstantString name];
-}
-
diff --git a/gcc/objc/makefile.dos b/gcc/objc/makefile.dos
deleted file mode 100644
index 3e1b1871e40..00000000000
--- a/gcc/objc/makefile.dos
+++ /dev/null
@@ -1,56 +0,0 @@
-# GNU Objective C Runtime Makefile for compiling with djgpp
-# Copyright (C) 1993, 1994, 1996 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 Makefile is configured for GnuMAKE
-
-GCC_FOR_TARGET=gcc
-
-.SUFFIXES: .o .m
-
-OPTIMIZE = -O2
-
-# Always search these dirs when compiling.
-SUBDIR_INCLUDES = -I. -I.. -I../config
-
-.c.o:
- $(GCC_FOR_TARGET) $(OPTIMIZE) \
- -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $<
-
-.m.o:
- $(GCC_FOR_TARGET) $(OPTIMIZE) -fgnu-runtime \
- -c $(GCC_CFLAGS) $(SUBDIR_INCLUDES) $<
-
-OBJC_O = hash.o sarray.o class.o sendmsg.o init.o archive.o \
- selector.o objects.o misc.o object.o protocol.o encoding.o thread.o
-
-libobjc.a: $(OBJC_O)
- -rm -f libobjc.a
- ar rc libobjc.a $(OBJC_O)
- ranlib libobjc.a
-
-OBJC_H = hash.h objc-list.h sarray.h objc.h \
- objc-api.h \
- object.h protocol.h mutex.h \
- typedstream.h thread.h
-
-mostlyclean:
- -rm -f *.o libobjc.a xforward fflags
-clean: mostlyclean
-distclean: mostlyclean
-extraclean: mostlyclean
diff --git a/gcc/objc/misc.c b/gcc/objc/misc.c
deleted file mode 100644
index 8fc8a3fa6c8..00000000000
--- a/gcc/objc/misc.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* GNU Objective C Runtime Miscellaneous
- Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contrbuted by Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#define __USE_FIXED_PROTOTYPES__
-#include <stdlib.h>
-#include "runtime.h"
-
-/*
-** Error handler function
-** NULL so that default is to just print to stderr
-*/
-static objc_error_handler _objc_error_handler = NULL;
-
-/* Trigger an objc error */
-void
-objc_error(id object, int code, const char* fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- objc_verror(object, code, fmt, ap);
- va_end(ap);
-}
-
-/* Trigger an objc error */
-void
-objc_verror(id object, int code, const char* fmt, va_list ap)
-{
- BOOL result = NO;
-
- /* Call the error handler if its there
- Otherwise print to stderr */
- if (_objc_error_handler)
- result = (*_objc_error_handler)(object, code, fmt, ap);
- else
- vfprintf (stderr, fmt, ap);
-
- /* Continue if the error handler says its ok
- Otherwise abort the program */
- if (result)
- return;
- else
- abort();
-}
-
-/* Set the error handler */
-objc_error_handler
-objc_set_error_handler(objc_error_handler func)
-{
- objc_error_handler temp = _objc_error_handler;
- _objc_error_handler = func;
- return temp;
-}
-
-/*
-** Standard functions for memory allocation and disposal.
-** Users should use these functions in their ObjC programs so
-** that they work properly with garbage collectors as well as
-** can take advantage of the exception/error handling available.
-*/
-
-void *
-objc_malloc(size_t size)
-{
- void* res = (void*) (*_objc_malloc)(size);
- if(!res)
- objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
- return res;
-}
-
-void *
-objc_atomic_malloc(size_t size)
-{
- void* res = (void*) (*_objc_atomic_malloc)(size);
- if(!res)
- objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
- return res;
-}
-
-void *
-objc_valloc(size_t size)
-{
- void* res = (void*) (*_objc_valloc)(size);
- if(!res)
- objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
- return res;
-}
-
-void *
-objc_realloc(void *mem, size_t size)
-{
- void* res = (void*) (*_objc_realloc)(mem, size);
- if(!res)
- objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
- return res;
-}
-
-void *
-objc_calloc(size_t nelem, size_t size)
-{
- void* res = (void*) (*_objc_calloc)(nelem, size);
- if(!res)
- objc_error(nil, OBJC_ERR_MEMORY, "Virtual memory exhausted\n");
- return res;
-}
-
-void
-objc_free(void *mem)
-{
- (*_objc_free)(mem);
-}
-
-/*
-** Hook functions for memory allocation and disposal.
-** This makes it easy to substitute garbage collection systems
-** such as Boehm's GC by assigning these function pointers
-** to the GC's allocation routines. By default these point
-** to the ANSI standard malloc, realloc, free, etc.
-**
-** Users should call the normal objc routines above for
-** memory allocation and disposal within their programs.
-*/
-void *(*_objc_malloc)(size_t) = malloc;
-void *(*_objc_atomic_malloc)(size_t) = malloc;
-void *(*_objc_valloc)(size_t) = malloc;
-void *(*_objc_realloc)(void *, size_t) = realloc;
-void *(*_objc_calloc)(size_t, size_t) = calloc;
-void (*_objc_free)(void *) = free;
diff --git a/gcc/objc/nil_method.c b/gcc/objc/nil_method.c
deleted file mode 100644
index 1b6212826bd..00000000000
--- a/gcc/objc/nil_method.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* GNU Objective C Runtime nil receiver function
- Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-/* This is the nil method, the function that is called when the receiver
- of a method is nil */
-
-#include "runtime.h"
-
-id
-nil_method(id receiver, SEL op, ...)
-{
- return receiver;
-}
-
-
-
-
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
deleted file mode 100644
index 4e05b3203a7..00000000000
--- a/gcc/objc/objc-act.c
+++ /dev/null
@@ -1,8254 +0,0 @@
-/* Implement classes and message passing for Objective C.
- Copyright (C) 1992, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
- Contributed by Steve Naroff.
-
-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. */
-
-/* Purpose: This module implements the Objective-C 4.0 language.
-
- compatibility issues (with the Stepstone translator):
-
- - does not recognize the following 3.3 constructs.
- @requires, @classes, @messages, = (...)
- - methods with variable arguments must conform to ANSI standard.
- - tagged structure definitions that appear in BOTH the interface
- and implementation are not allowed.
- - public/private: all instance variables are public within the
- context of the implementation...I consider this to be a bug in
- the translator.
- - statically allocated objects are not supported. the user will
- receive an error if this service is requested.
-
- code generation `options':
-
- - OBJC_INT_SELECTORS */
-
-#include <stdio.h>
-#include "config.h"
-#include "tree.h"
-#include "c-tree.h"
-#include "c-lex.h"
-#include "flags.h"
-#include "objc-act.h"
-#include "input.h"
-#include "except.h"
-#include "function.h"
-
-
-/* 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
- if method names contain underscores. -- rms. */
-#ifndef OBJC_GEN_METHOD_LABEL
-#define OBJC_GEN_METHOD_LABEL(BUF, IS_INST, CLASS_NAME, CAT_NAME, SEL_NAME, NUM) \
- do { \
- char *temp; \
- sprintf ((BUF), "_%s_%s_%s_%s", \
- ((IS_INST) ? "i" : "c"), \
- (CLASS_NAME), \
- ((CAT_NAME)? (CAT_NAME) : ""), \
- (SEL_NAME)); \
- for (temp = (BUF); *temp; temp++) \
- if (*temp == ':') *temp = '_'; \
- } while (0)
-#endif
-
-/* These need specifying. */
-#ifndef OBJC_FORWARDING_STACK_OFFSET
-#define OBJC_FORWARDING_STACK_OFFSET 0
-#endif
-
-#ifndef OBJC_FORWARDING_MIN_OFFSET
-#define OBJC_FORWARDING_MIN_OFFSET 0
-#endif
-
-/* Define the special tree codes that we use. */
-
-/* Table indexed by tree code giving a string containing a character
- classifying the tree code. Possibilities are
- t, d, s, c, r, <, 1 and 2. See objc-tree.def for details. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-
-char *objc_tree_code_type[] = {
- "x",
-#include "objc-tree.def"
-};
-#undef DEFTREECODE
-
-/* Table indexed by tree code giving number of expression
- operands beyond the fixed part of the node structure.
- Not used for types or decls. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
-
-int objc_tree_code_length[] = {
- 0,
-#include "objc-tree.def"
-};
-#undef DEFTREECODE
-
-/* Names of tree components.
- Used for printing out the tree and error messages. */
-#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
-
-char *objc_tree_code_name[] = {
- "@@dummy",
-#include "objc-tree.def"
-};
-#undef DEFTREECODE
-
-/* Set up for use of obstacks. */
-
-#include "obstack.h"
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-/* This obstack is used to accumulate the encoding of a data type. */
-static struct obstack util_obstack;
-/* This points to the beginning of obstack contents,
- so we can free the whole contents. */
-char *util_firstobj;
-
-/* List of classes with list of their static instances. */
-static tree objc_static_instances = NULL_TREE;
-
-/* The declaration of the array administrating the static instances. */
-static tree static_instances_decl = NULL_TREE;
-
-/* for encode_method_def */
-#include "rtl.h"
-#include "c-parse.h"
-
-#define OBJC_VERSION (flag_next_runtime ? 5 : 8)
-#define PROTOCOL_VERSION 2
-
-#define OBJC_ENCODE_INLINE_DEFS 0
-#define OBJC_ENCODE_DONT_INLINE_DEFS 1
-
-/*** Private Interface (procedures) ***/
-
-/* Used by compile_file. */
-
-static void init_objc PROTO((void));
-static void finish_objc PROTO((void));
-
-/* Code generation. */
-
-static void synth_module_prologue PROTO((void));
-static tree build_constructor PROTO((tree, tree));
-static char *build_module_descriptor PROTO((void));
-static tree init_module_descriptor PROTO((tree));
-static tree build_objc_method_call PROTO((int, tree, tree,
- tree, tree, tree));
-static void generate_strings PROTO((void));
-static tree get_proto_encoding PROTO((tree));
-static void build_selector_translation_table PROTO((void));
-static tree build_ivar_chain PROTO((tree, int));
-
-static tree objc_add_static_instance PROTO((tree, tree));
-
-static tree build_ivar_template PROTO((void));
-static tree build_method_template PROTO((void));
-static tree build_private_template PROTO((tree));
-static void build_class_template PROTO((void));
-static void build_selector_template PROTO((void));
-static void build_category_template PROTO((void));
-static tree build_super_template PROTO((void));
-static tree build_category_initializer PROTO((tree, tree, tree,
- tree, tree, tree));
-static tree build_protocol_initializer PROTO((tree, tree, tree,
- tree, tree));
-
-static void synth_forward_declarations PROTO((void));
-static void generate_ivar_lists PROTO((void));
-static void generate_dispatch_tables PROTO((void));
-static void generate_shared_structures PROTO((void));
-static tree generate_protocol_list PROTO((tree));
-static void generate_forward_declaration_to_string_table PROTO((void));
-static void build_protocol_reference PROTO((tree));
-
-static tree init_selector PROTO((int));
-static tree build_keyword_selector PROTO((tree));
-static tree synth_id_with_class_suffix PROTO((char *, tree));
-
-/* From expr.c */
-extern int apply_args_register_offset PROTO((int));
-
-/* Misc. bookkeeping */
-
-typedef struct hashed_entry *hash;
-typedef struct hashed_attribute *attr;
-
-struct hashed_attribute
-{
- attr next;
- tree value;
-};
-struct hashed_entry
-{
- attr list;
- hash next;
- tree key;
-};
-
-static void hash_init PROTO((void));
-static void hash_enter PROTO((hash *, tree));
-static hash hash_lookup PROTO((hash *, tree));
-static void hash_add_attr PROTO((hash, tree));
-static tree lookup_method PROTO((tree, tree));
-static tree lookup_instance_method_static PROTO((tree, tree));
-static tree lookup_class_method_static PROTO((tree, tree));
-static tree add_class PROTO((tree));
-static void add_category PROTO((tree, tree));
-
-enum string_section
-{
- class_names, /* class, category, protocol, module names */
- meth_var_names, /* method and variable names */
- meth_var_types /* method and variable type descriptors */
-};
-
-static tree add_objc_string PROTO((tree,
- enum string_section));
-static tree build_objc_string_decl PROTO((tree,
- enum string_section));
-static tree build_selector_reference_decl PROTO((tree));
-
-/* Protocol additions. */
-
-static tree add_protocol PROTO((tree));
-static tree lookup_protocol PROTO((tree));
-static tree lookup_and_install_protocols PROTO((tree));
-
-/* Type encoding. */
-
-static void encode_type_qualifiers PROTO((tree));
-static void encode_pointer PROTO((tree, int, int));
-static void encode_array PROTO((tree, int, int));
-static void encode_aggregate PROTO((tree, int, int));
-static void encode_bitfield PROTO((int, int));
-static void encode_type PROTO((tree, int, int));
-static void encode_field_decl PROTO((tree, int, int));
-
-static void really_start_method PROTO((tree, tree));
-static int comp_method_with_proto PROTO((tree, tree));
-static int comp_proto_with_proto PROTO((tree, tree));
-static tree get_arg_type_list PROTO((tree, int, int));
-static tree expr_last PROTO((tree));
-
-/* Utilities for debugging and error diagnostics. */
-
-static void warn_with_method PROTO((char *, int, tree));
-static void error_with_ivar PROTO((char *, tree, tree));
-static char *gen_method_decl PROTO((tree, char *));
-static char *gen_declaration PROTO((tree, char *));
-static char *gen_declarator PROTO((tree, char *, char *));
-static int is_complex_decl PROTO((tree));
-static void adorn_decl PROTO((tree, char *));
-static void dump_interface PROTO((FILE *, tree));
-
-/* Everything else. */
-
-static void objc_fatal PROTO((void));
-static tree define_decl PROTO((tree, tree));
-static tree lookup_method_in_protocol_list PROTO((tree, tree, int));
-static tree lookup_protocol_in_reflist PROTO((tree, tree));
-static tree create_builtin_decl PROTO((enum tree_code,
- tree, char *));
-static tree my_build_string PROTO((int, char *));
-static void build_objc_symtab_template PROTO((void));
-static tree init_def_list PROTO((tree));
-static tree init_objc_symtab PROTO((tree));
-static void forward_declare_categories PROTO((void));
-static void generate_objc_symtab_decl PROTO((void));
-static tree build_selector PROTO((tree));
-static tree build_msg_pool_reference PROTO((int));
-static tree build_typed_selector_reference PROTO((tree, tree));
-static tree build_selector_reference PROTO((tree));
-static tree build_class_reference_decl PROTO((tree));
-static void add_class_reference PROTO((tree));
-static tree objc_copy_list PROTO((tree, tree *));
-static tree build_protocol_template PROTO((void));
-static tree build_descriptor_table_initializer PROTO((tree, tree));
-static tree build_method_prototype_list_template PROTO((tree, int));
-static tree build_method_prototype_template PROTO((void));
-static int forwarding_offset PROTO((tree));
-static tree encode_method_prototype PROTO((tree, tree));
-static tree generate_descriptor_table PROTO((tree, char *, int, tree, tree));
-static void generate_method_descriptors PROTO((tree));
-static tree build_tmp_function_decl PROTO((void));
-static void hack_method_prototype PROTO((tree, tree));
-static void generate_protocol_references PROTO((tree));
-static void generate_protocols PROTO((void));
-static void check_ivars PROTO((tree, tree));
-static tree build_ivar_list_template PROTO((tree, int));
-static tree build_method_list_template PROTO((tree, int));
-static tree build_ivar_list_initializer PROTO((tree, tree));
-static tree generate_ivars_list PROTO((tree, char *,
- int, tree));
-static tree build_dispatch_table_initializer PROTO((tree, tree));
-static tree generate_dispatch_table PROTO((tree, char *,
- int, tree));
-static tree build_shared_structure_initializer PROTO((tree, tree, tree, tree,
- tree, int, tree, tree,
- tree));
-static void generate_category PROTO((tree));
-static int is_objc_type_qualifier PROTO((tree));
-static tree adjust_type_for_id_default PROTO((tree));
-static tree check_duplicates PROTO((hash));
-static tree receiver_is_class_object PROTO((tree));
-static int check_methods PROTO((tree, tree, int));
-static int conforms_to_protocol PROTO((tree, tree));
-static void check_protocols PROTO((tree, char *, char *));
-static tree encode_method_def PROTO((tree));
-static void gen_declspecs PROTO((tree, char *, int));
-static void generate_classref_translation_entry PROTO((tree));
-static void handle_class_ref PROTO((tree));
-
-/*** Private Interface (data) ***/
-
-/* Reserved tag definitions. */
-
-#define TYPE_ID "id"
-#define TAG_OBJECT "objc_object"
-#define TAG_CLASS "objc_class"
-#define TAG_SUPER "objc_super"
-#define TAG_SELECTOR "objc_selector"
-
-#define UTAG_CLASS "_objc_class"
-#define UTAG_IVAR "_objc_ivar"
-#define UTAG_IVAR_LIST "_objc_ivar_list"
-#define UTAG_METHOD "_objc_method"
-#define UTAG_METHOD_LIST "_objc_method_list"
-#define UTAG_CATEGORY "_objc_category"
-#define UTAG_MODULE "_objc_module"
-#define UTAG_STATICS "_objc_statics"
-#define UTAG_SYMTAB "_objc_symtab"
-#define UTAG_SUPER "_objc_super"
-#define UTAG_SELECTOR "_objc_selector"
-
-#define UTAG_PROTOCOL "_objc_protocol"
-#define UTAG_PROTOCOL_LIST "_objc_protocol_list"
-#define UTAG_METHOD_PROTOTYPE "_objc_method_prototype"
-#define UTAG_METHOD_PROTOTYPE_LIST "_objc__method_prototype_list"
-
-#define STRING_OBJECT_CLASS_NAME "NXConstantString"
-#define PROTOCOL_OBJECT_CLASS_NAME "Protocol"
-
-static char *TAG_GETCLASS;
-static char *TAG_GETMETACLASS;
-static char *TAG_MSGSEND;
-static char *TAG_MSGSENDSUPER;
-static char *TAG_EXECCLASS;
-
-/* Set by `continue_class' and checked by `is_public'. */
-
-#define TREE_STATIC_TEMPLATE(record_type) (TREE_PUBLIC (record_type))
-#define TYPED_OBJECT(type) \
- (TREE_CODE (type) == RECORD_TYPE && TREE_STATIC_TEMPLATE (type))
-
-/* Some commonly used instances of "identifier_node". */
-
-static tree self_id, ucmd_id;
-static tree unused_list;
-
-static tree self_decl, umsg_decl, umsg_super_decl;
-static tree objc_get_class_decl, objc_get_meta_class_decl;
-
-static tree super_type, selector_type, id_type, objc_class_type;
-static tree instance_type, protocol_type;
-
-/* Type checking macros. */
-
-#define IS_ID(TYPE) \
- (TYPE_MAIN_VARIANT (TYPE) == TYPE_MAIN_VARIANT (id_type))
-#define IS_PROTOCOL_QUALIFIED_ID(TYPE) \
- (IS_ID (TYPE) && TYPE_PROTOCOL_LIST (TYPE))
-#define IS_SUPER(TYPE) \
- (super_type && TYPE_MAIN_VARIANT (TYPE) == TYPE_MAIN_VARIANT (super_type))
-
-static tree class_chain = NULL_TREE;
-static tree alias_chain = NULL_TREE;
-static tree interface_chain = NULL_TREE;
-static tree protocol_chain = NULL_TREE;
-
-/* Chains to manage selectors that are referenced and defined in the
- module. */
-
-static tree cls_ref_chain = NULL_TREE; /* Classes referenced. */
-static tree sel_ref_chain = NULL_TREE; /* Selectors referenced. */
-
-/* Chains to manage uniquing of strings. */
-
-static tree class_names_chain = NULL_TREE;
-static tree meth_var_names_chain = NULL_TREE;
-static tree meth_var_types_chain = NULL_TREE;
-
-/* Hash tables to manage the global pool of method prototypes. */
-
-static hash *nst_method_hash_list = 0;
-static hash *cls_method_hash_list = 0;
-
-/* Backend data declarations. */
-
-static tree UOBJC_SYMBOLS_decl;
-static tree UOBJC_INSTANCE_VARIABLES_decl, UOBJC_CLASS_VARIABLES_decl;
-static tree UOBJC_INSTANCE_METHODS_decl, UOBJC_CLASS_METHODS_decl;
-static tree UOBJC_CLASS_decl, UOBJC_METACLASS_decl;
-static tree UOBJC_SELECTOR_TABLE_decl;
-static tree UOBJC_MODULES_decl;
-static tree UOBJC_STRINGS_decl;
-
-/* The following are used when compiling a class implementation.
- implementation_template will normally be an interface, however if
- none exists this will be equal to implementation_context...it is
- set in start_class. */
-
-static tree implementation_context = NULL_TREE;
-static tree implementation_template = NULL_TREE;
-
-struct imp_entry
-{
- struct imp_entry *next;
- tree imp_context;
- tree imp_template;
- tree class_decl; /* _OBJC_CLASS_<my_name>; */
- tree meta_decl; /* _OBJC_METACLASS_<my_name>; */
-};
-
-static void handle_impent PROTO((struct imp_entry *));
-
-static struct imp_entry *imp_list = 0;
-static int imp_count = 0; /* `@implementation' */
-static int cat_count = 0; /* `@category' */
-
-static tree objc_class_template, objc_category_template, uprivate_record;
-static tree objc_protocol_template, objc_selector_template;
-static tree ucls_super_ref, uucls_super_ref;
-
-static tree objc_method_template, objc_ivar_template;
-static tree objc_symtab_template, objc_module_template;
-static tree objc_super_template, objc_object_reference;
-
-static tree objc_object_id, objc_class_id, objc_id_id;
-static tree constant_string_id;
-static tree constant_string_type;
-static tree UOBJC_SUPER_decl;
-
-static tree method_context = NULL_TREE;
-static int method_slot = 0; /* Used by start_method_def, */
-
-#define BUFSIZE 1024
-
-static char *errbuf; /* Buffer for error diagnostics */
-
-/* Data imported from tree.c. */
-
-extern enum debug_info_type write_symbols;
-
-/* Data imported from toplev.c. */
-
-extern char *dump_base_name;
-
-/* Generate code for GNU or NeXT runtime environment. */
-
-#ifdef NEXT_OBJC_RUNTIME
-int flag_next_runtime = 1;
-#else
-int flag_next_runtime = 0;
-#endif
-
-int flag_typed_selectors;
-
-/* Open and close the file for outputting class declarations, if requested. */
-
-int flag_gen_declaration = 0;
-
-FILE *gen_declaration_file;
-
-/* Warn if multiple methods are seen for the same selector, but with
- different argument types. */
-
-int warn_selector = 0;
-
-/* Warn if methods required by a protocol are not implemented in the
- class adopting it. When turned off, methods inherited to that
- class are also considered implemented */
-
-int flag_warn_protocol = 1;
-
-/* Tells "encode_pointer/encode_aggregate" whether we are generating
- type descriptors for instance variables (as opposed to methods).
- Type descriptors for instance variables contain more information
- than methods (for static typing and embedded structures). This
- was added to support features being planned for dbkit2. */
-
-static int generating_instance_variables = 0;
-
-void
-lang_init ()
-{
- /* The beginning of the file is a new line; check for #.
- With luck, we discover the real source file's name from that
- and put it in input_filename. */
- ungetc (check_newline (), finput);
-
- /* The line number can be -1 if we had -g3 and the input file
- had a directive specifying line 0. But we want predefined
- functions to have a line number of 0, not -1. */
- if (lineno == -1)
- lineno = 0;
-
- /* If gen_declaration desired, open the output file. */
- if (flag_gen_declaration)
- {
- int dump_base_name_length = strlen (dump_base_name);
- register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
- strcpy (dumpname, dump_base_name);
- strcat (dumpname, ".decl");
- gen_declaration_file = fopen (dumpname, "w");
- if (gen_declaration_file == 0)
- pfatal_with_name (dumpname);
- }
-
- if (flag_next_runtime)
- {
- TAG_GETCLASS = "objc_getClass";
- TAG_GETMETACLASS = "objc_getMetaClass";
- TAG_MSGSEND = "objc_msgSend";
- TAG_MSGSENDSUPER = "objc_msgSendSuper";
- TAG_EXECCLASS = "__objc_execClass";
- }
- else
- {
- TAG_GETCLASS = "objc_get_class";
- TAG_GETMETACLASS = "objc_get_meta_class";
- TAG_MSGSEND = "objc_msg_lookup";
- TAG_MSGSENDSUPER = "objc_msg_lookup_super";
- TAG_EXECCLASS = "__objc_exec_class";
- flag_typed_selectors = 1;
- }
-
- if (doing_objc_thang)
- init_objc ();
-}
-
-static void
-objc_fatal ()
-{
- fatal ("Objective-C text in C source file");
-}
-
-void
-finish_file ()
-{
- if (doing_objc_thang)
- finish_objc (); /* Objective-C finalization */
-
- if (gen_declaration_file)
- fclose (gen_declaration_file);
-}
-
-void
-lang_finish ()
-{
-}
-
-char *
-lang_identify ()
-{
- return "objc";
-}
-
-int
-lang_decode_option (p)
- char *p;
-{
- if (!strcmp (p, "-lang-objc"))
- doing_objc_thang = 1;
- else if (!strcmp (p, "-gen-decls"))
- flag_gen_declaration = 1;
- else if (!strcmp (p, "-Wselector"))
- warn_selector = 1;
- else if (!strcmp (p, "-Wno-selector"))
- warn_selector = 0;
- else if (!strcmp (p, "-Wprotocol"))
- flag_warn_protocol = 1;
- else if (!strcmp (p, "-Wno-protocol"))
- flag_warn_protocol = 0;
- else if (!strcmp (p, "-fgnu-runtime"))
- flag_next_runtime = 0;
- else if (!strcmp (p, "-fno-next-runtime"))
- flag_next_runtime = 0;
- else if (!strcmp (p, "-fno-gnu-runtime"))
- flag_next_runtime = 1;
- else if (!strcmp (p, "-fnext-runtime"))
- flag_next_runtime = 1;
- else
- return c_decode_option (p);
-
- return 1;
-}
-
-static tree
-define_decl (declarator, declspecs)
- tree declarator;
- tree declspecs;
-{
- tree decl = start_decl (declarator, declspecs, 0, NULL_TREE, NULL_TREE);
- finish_decl (decl, NULL_TREE, NULL_TREE);
- return decl;
-}
-
-/* Return 1 if LHS and RHS are compatible types for assignment or
- various other operations. Return 0 if they are incompatible, and
- return -1 if we choose to not decide. When the operation is
- REFLEXIVE, check for compatibility in either direction.
-
- For statically typed objects, an assignment of the form `a' = `b'
- is permitted if:
-
- `a' is of type "id",
- `a' and `b' are the same class type, or
- `a' and `b' are of class types A and B such that B is a descendant of A. */
-
-int
-maybe_objc_comptypes (lhs, rhs, reflexive)
- tree lhs, rhs;
- int reflexive;
-{
- if (doing_objc_thang)
- return objc_comptypes (lhs, rhs, reflexive);
- return -1;
-}
-
-static tree
-lookup_method_in_protocol_list (rproto_list, sel_name, class_meth)
- tree rproto_list;
- tree sel_name;
- int class_meth;
-{
- tree rproto, p;
- tree fnd = 0;
-
- for (rproto = rproto_list; rproto; rproto = TREE_CHAIN (rproto))
- {
- p = TREE_VALUE (rproto);
-
- if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
- {
- if ((fnd = lookup_method (class_meth
- ? PROTOCOL_CLS_METHODS (p)
- : PROTOCOL_NST_METHODS (p), sel_name)))
- ;
- else if (PROTOCOL_LIST (p))
- fnd = lookup_method_in_protocol_list (PROTOCOL_LIST (p),
- sel_name, class_meth);
- }
- else
- ; /* An identifier...if we could not find a protocol. */
-
- if (fnd)
- return fnd;
- }
-
- return 0;
-}
-
-static tree
-lookup_protocol_in_reflist (rproto_list, lproto)
- tree rproto_list;
- tree lproto;
-{
- tree rproto, p;
-
- /* Make sure the protocol is support by the object on the rhs. */
- if (TREE_CODE (lproto) == PROTOCOL_INTERFACE_TYPE)
- {
- tree fnd = 0;
- for (rproto = rproto_list; rproto; rproto = TREE_CHAIN (rproto))
- {
- p = TREE_VALUE (rproto);
-
- if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
- {
- if (lproto == p)
- fnd = lproto;
-
- else if (PROTOCOL_LIST (p))
- fnd = lookup_protocol_in_reflist (PROTOCOL_LIST (p), lproto);
- }
-
- if (fnd)
- return fnd;
- }
- }
- else
- ; /* An identifier...if we could not find a protocol. */
-
- return 0;
-}
-
-/* Return 1 if LHS and RHS are compatible types for assignment
- or various other operations. Return 0 if they are incompatible,
- and return -1 if we choose to not decide. When the operation
- is REFLEXIVE, check for compatibility in either direction. */
-
-int
-objc_comptypes (lhs, rhs, reflexive)
- tree lhs;
- tree rhs;
- int reflexive;
-{
- /* New clause for protocols. */
-
- if (TREE_CODE (lhs) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (lhs)) == RECORD_TYPE
- && TREE_CODE (rhs) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (rhs)) == RECORD_TYPE)
- {
- int lhs_is_proto = IS_PROTOCOL_QUALIFIED_ID (lhs);
- int rhs_is_proto = IS_PROTOCOL_QUALIFIED_ID (rhs);
-
- if (lhs_is_proto)
- {
- tree lproto, lproto_list = TYPE_PROTOCOL_LIST (lhs);
- tree rproto, rproto_list;
- tree p;
-
- if (rhs_is_proto)
- {
- rproto_list = TYPE_PROTOCOL_LIST (rhs);
-
- /* Make sure the protocol is supported by the object
- on the rhs. */
- for (lproto = lproto_list; lproto; lproto = TREE_CHAIN (lproto))
- {
- p = TREE_VALUE (lproto);
- rproto = lookup_protocol_in_reflist (rproto_list, p);
-
- if (!rproto)
- warning ("object does not conform to the `%s' protocol",
- IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
- }
- }
- else if (TYPED_OBJECT (TREE_TYPE (rhs)))
- {
- tree rname = TYPE_NAME (TREE_TYPE (rhs));
- tree rinter;
-
- /* Make sure the protocol is supported by the object
- on the rhs. */
- for (lproto = lproto_list; lproto; lproto = TREE_CHAIN (lproto))
- {
- p = TREE_VALUE (lproto);
- rproto = 0;
- rinter = lookup_interface (rname);
-
- while (rinter && !rproto)
- {
- tree cat;
-
- rproto_list = CLASS_PROTOCOL_LIST (rinter);
- rproto = lookup_protocol_in_reflist (rproto_list, p);
-
- /* Check for protocols adopted by categories. */
- cat = CLASS_CATEGORY_LIST (rinter);
- while (cat && !rproto)
- {
- rproto_list = CLASS_PROTOCOL_LIST (cat);
- rproto = lookup_protocol_in_reflist (rproto_list, p);
-
- cat = CLASS_CATEGORY_LIST (cat);
- }
-
- rinter = lookup_interface (CLASS_SUPER_NAME (rinter));
- }
-
- if (!rproto)
- warning ("class `%s' does not implement the `%s' protocol",
- IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (rhs))),
- IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
- }
- }
-
- /* May change...based on whether there was any mismatch */
- return 1;
- }
- else if (rhs_is_proto)
- /* Lhs is not a protocol...warn if it is statically typed */
- return (TYPED_OBJECT (TREE_TYPE (lhs)) != 0);
-
- else
- /* Defer to comptypes .*/
- return -1;
- }
-
- else if (TREE_CODE (lhs) == RECORD_TYPE && TREE_CODE (rhs) == RECORD_TYPE)
- ; /* Fall thru. This is the case we have been handling all along */
- else
- /* Defer to comptypes. */
- return -1;
-
- /* `id' = `<class> *', `<class> *' = `id' */
-
- if ((TYPE_NAME (lhs) == objc_object_id && TYPED_OBJECT (rhs))
- || (TYPE_NAME (rhs) == objc_object_id && TYPED_OBJECT (lhs)))
- return 1;
-
- /* `id' = `Class', `Class' = `id' */
-
- else if ((TYPE_NAME (lhs) == objc_object_id
- && TYPE_NAME (rhs) == objc_class_id)
- || (TYPE_NAME (lhs) == objc_class_id
- && TYPE_NAME (rhs) == objc_object_id))
- return 1;
-
- /* `<class> *' = `<class> *' */
-
- else if (TYPED_OBJECT (lhs) && TYPED_OBJECT (rhs))
- {
- tree lname = TYPE_NAME (lhs);
- tree rname = TYPE_NAME (rhs);
- tree inter;
-
- if (lname == rname)
- return 1;
-
- /* If the left hand side is a super class of the right hand side,
- allow it. */
- for (inter = lookup_interface (rname); inter;
- inter = lookup_interface (CLASS_SUPER_NAME (inter)))
- if (lname == CLASS_SUPER_NAME (inter))
- return 1;
-
- /* Allow the reverse when reflexive. */
- if (reflexive)
- for (inter = lookup_interface (lname); inter;
- inter = lookup_interface (CLASS_SUPER_NAME (inter)))
- if (rname == CLASS_SUPER_NAME (inter))
- return 1;
-
- return 0;
- }
- else
- /* Defer to comptypes. */
- return -1;
-}
-
-/* Called from c-decl.c before all calls to rest_of_decl_compilation. */
-
-void
-objc_check_decl (decl)
- tree decl;
-{
- tree type = TREE_TYPE (decl);
-
- if (TREE_CODE (type) == RECORD_TYPE
- && TREE_STATIC_TEMPLATE (type)
- && type != constant_string_type)
- {
- error_with_decl (decl, "`%s' cannot be statically allocated");
- fatal ("statically allocated objects not supported");
- }
-}
-
-void
-maybe_objc_check_decl (decl)
- tree decl;
-{
- if (doing_objc_thang)
- objc_check_decl (decl);
-}
-
-/* Implement static typing. At this point, we know we have an interface. */
-
-tree
-get_static_reference (interface, protocols)
- tree interface;
- tree protocols;
-{
- tree type = xref_tag (RECORD_TYPE, interface);
-
- if (protocols)
- {
- tree t, m = TYPE_MAIN_VARIANT (type);
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
- t = copy_node (type);
- TYPE_BINFO (t) = make_tree_vec (2);
- pop_obstacks ();
-
- /* Add this type to the chain of variants of TYPE. */
- TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
- TYPE_NEXT_VARIANT (m) = t;
-
- /* Look up protocols and install in lang specific list. */
- TYPE_PROTOCOL_LIST (t) = lookup_and_install_protocols (protocols);
-
- /* This forces a new pointer type to be created later
- (in build_pointer_type)...so that the new template
- we just created will actually be used...what a hack! */
- if (TYPE_POINTER_TO (t))
- TYPE_POINTER_TO (t) = 0;
-
- type = t;
- }
-
- return type;
-}
-
-tree
-get_object_reference (protocols)
- tree protocols;
-{
- tree type_decl = lookup_name (objc_id_id);
- tree type;
-
- if (type_decl && TREE_CODE (type_decl) == TYPE_DECL)
- {
- type = TREE_TYPE (type_decl);
- if (TYPE_MAIN_VARIANT (type) != id_type)
- warning ("Unexpected type for `id' (%s)",
- gen_declaration (type, errbuf));
- }
- else
- fatal ("Undefined type `id', please import <objc/objc.h>");
-
- /* This clause creates a new pointer type that is qualified with
- the protocol specification...this info is used later to do more
- elaborate type checking. */
-
- if (protocols)
- {
- tree t, m = TYPE_MAIN_VARIANT (type);
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
- t = copy_node (type);
- TYPE_BINFO (t) = make_tree_vec (2);
- pop_obstacks ();
-
- /* Add this type to the chain of variants of TYPE. */
- TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
- TYPE_NEXT_VARIANT (m) = t;
-
- /* Look up protocols...and install in lang specific list */
- TYPE_PROTOCOL_LIST (t) = lookup_and_install_protocols (protocols);
-
- /* This forces a new pointer type to be created later
- (in build_pointer_type)...so that the new template
- we just created will actually be used...what a hack! */
- if (TYPE_POINTER_TO (t))
- TYPE_POINTER_TO (t) = NULL;
-
- type = t;
- }
- return type;
-}
-
-static tree
-lookup_and_install_protocols (protocols)
- tree protocols;
-{
- tree proto;
- tree prev = NULL;
- tree return_value = protocols;
-
- for (proto = protocols; proto; proto = TREE_CHAIN (proto))
- {
- tree ident = TREE_VALUE (proto);
- tree p = lookup_protocol (ident);
-
- if (!p)
- {
- error ("Cannot find protocol declaration for `%s'",
- IDENTIFIER_POINTER (ident));
- if (prev)
- TREE_CHAIN (prev) = TREE_CHAIN (proto);
- else
- return_value = TREE_CHAIN (proto);
- }
- else
- {
- /* Replace identifier with actual protocol node. */
- TREE_VALUE (proto) = p;
- prev = proto;
- }
- }
-
- return return_value;
-}
-
-/* Create and push a decl for a built-in external variable or field NAME.
- CODE says which.
- TYPE is its data type. */
-
-static tree
-create_builtin_decl (code, type, name)
- enum tree_code code;
- tree type;
- char *name;
-{
- tree decl = build_decl (code, get_identifier (name), type);
-
- if (code == VAR_DECL)
- {
- TREE_STATIC (decl) = 1;
- make_decl_rtl (decl, 0, 1);
- pushdecl (decl);
- }
-
- DECL_ARTIFICIAL (decl) = 1;
- return decl;
-}
-
-/* Purpose: "play" parser, creating/installing representations
- of the declarations that are required by Objective-C.
-
- Model:
-
- type_spec--------->sc_spec
- (tree_list) (tree_list)
- | |
- | |
- identifier_node identifier_node */
-
-static void
-synth_module_prologue ()
-{
- tree temp_type;
- tree super_p;
-
- /* Defined in `objc.h' */
- objc_object_id = get_identifier (TAG_OBJECT);
-
- objc_object_reference = xref_tag (RECORD_TYPE, objc_object_id);
-
- id_type = build_pointer_type (objc_object_reference);
-
- objc_id_id = get_identifier (TYPE_ID);
- objc_class_id = get_identifier (TAG_CLASS);
-
- objc_class_type = build_pointer_type (xref_tag (RECORD_TYPE, objc_class_id));
- protocol_type = build_pointer_type (xref_tag (RECORD_TYPE,
- get_identifier (PROTOCOL_OBJECT_CLASS_NAME)));
-
- /* Declare type of selector-objects that represent an operation name. */
-
-#ifdef OBJC_INT_SELECTORS
- /* `unsigned int' */
- selector_type = unsigned_type_node;
-#else
- /* `struct objc_selector *' */
- selector_type
- = build_pointer_type (xref_tag (RECORD_TYPE,
- get_identifier (TAG_SELECTOR)));
-#endif /* not OBJC_INT_SELECTORS */
-
- /* Forward declare type, or else the prototype for msgSendSuper will
- complain. */
-
- super_p = build_pointer_type (xref_tag (RECORD_TYPE,
- get_identifier (TAG_SUPER)));
-
-
- /* id objc_msgSend (id, SEL, ...); */
-
- temp_type
- = build_function_type (id_type,
- tree_cons (NULL_TREE, id_type,
- tree_cons (NULL_TREE, selector_type,
- NULL_TREE)));
-
- if (! flag_next_runtime)
- {
- umsg_decl = build_decl (FUNCTION_DECL,
- get_identifier (TAG_MSGSEND), temp_type);
- DECL_EXTERNAL (umsg_decl) = 1;
- TREE_PUBLIC (umsg_decl) = 1;
- DECL_INLINE (umsg_decl) = 1;
- DECL_ARTIFICIAL (umsg_decl) = 1;
-
- if (flag_traditional && TAG_MSGSEND[0] != '_')
- DECL_BUILT_IN_NONANSI (umsg_decl) = 1;
-
- make_decl_rtl (umsg_decl, NULL_PTR, 1);
- pushdecl (umsg_decl);
- }
- else
- umsg_decl = builtin_function (TAG_MSGSEND, temp_type, NOT_BUILT_IN, 0);
-
- /* id objc_msgSendSuper (struct objc_super *, SEL, ...); */
-
- temp_type
- = build_function_type (id_type,
- tree_cons (NULL_TREE, super_p,
- tree_cons (NULL_TREE, selector_type,
- NULL_TREE)));
-
- umsg_super_decl = builtin_function (TAG_MSGSENDSUPER,
- temp_type, NOT_BUILT_IN, 0);
-
- /* id objc_getClass (const char *); */
-
- temp_type = build_function_type (id_type,
- tree_cons (NULL_TREE,
- const_string_type_node,
- tree_cons (NULL_TREE, void_type_node,
- NULL_TREE)));
-
- objc_get_class_decl
- = builtin_function (TAG_GETCLASS, temp_type, NOT_BUILT_IN, 0);
-
- /* id objc_getMetaClass (const char *); */
-
- objc_get_meta_class_decl
- = builtin_function (TAG_GETMETACLASS, temp_type, NOT_BUILT_IN, 0);
-
- /* static SEL _OBJC_SELECTOR_TABLE[]; */
-
- if (! flag_next_runtime)
- {
- if (flag_typed_selectors)
- {
- /* Suppress outputting debug symbols, because
- dbxout_init hasn'r been called yet. */
- enum debug_info_type save_write_symbols = write_symbols;
- write_symbols = NO_DEBUG;
-
- build_selector_template ();
- temp_type = build_array_type (objc_selector_template, NULL_TREE);
-
- write_symbols = save_write_symbols;
- }
- else
- temp_type = build_array_type (selector_type, NULL_TREE);
-
- layout_type (temp_type);
- UOBJC_SELECTOR_TABLE_decl
- = create_builtin_decl (VAR_DECL, temp_type,
- "_OBJC_SELECTOR_TABLE");
-
- /* Avoid warning when not sending messages. */
- TREE_USED (UOBJC_SELECTOR_TABLE_decl) = 1;
- }
-
- generate_forward_declaration_to_string_table ();
-
- /* Forward declare constant_string_id and constant_string_type. */
- constant_string_id = get_identifier (STRING_OBJECT_CLASS_NAME);
- constant_string_type = xref_tag (RECORD_TYPE, constant_string_id);
-}
-
-/* Custom build_string which sets TREE_TYPE! */
-
-static tree
-my_build_string (len, str)
- int len;
- char *str;
-{
- int wide_flag = 0;
- tree a_string = build_string (len, str);
-
- /* Some code from combine_strings, which is local to c-parse.y. */
- if (TREE_TYPE (a_string) == int_array_type_node)
- wide_flag = 1;
-
- TREE_TYPE (a_string)
- = build_array_type (wide_flag ? integer_type_node : char_type_node,
- build_index_type (build_int_2 (len - 1, 0)));
-
- TREE_CONSTANT (a_string) = 1; /* Puts string in the readonly segment */
- TREE_STATIC (a_string) = 1;
-
- return a_string;
-}
-
-/* Return a newly constructed OBJC_STRING_CST node whose value is
- the LEN characters at STR.
- The TREE_TYPE is not initialized. */
-
-tree
-build_objc_string (len, str)
- int len;
- char *str;
-{
- tree s = build_string (len, str);
-
- TREE_SET_CODE (s, OBJC_STRING_CST);
- return s;
-}
-
-/* Given a chain of OBJC_STRING_CST's, build a static instance of
- NXConstanString which points at the concatenation of those strings.
- We place the string object in the __string_objects section of the
- __OBJC segment. The Objective-C runtime will initialize the isa
- pointers of the string objects to point at the NXConstandString class
- object. */
-
-tree
-build_objc_string_object (strings)
- tree strings;
-{
- tree string, initlist, constructor;
- int length;
-
- if (!doing_objc_thang)
- objc_fatal ();
-
- if (lookup_interface (constant_string_id) == NULL_TREE)
- {
- error ("Cannot find interface declaration for `%s'",
- IDENTIFIER_POINTER (constant_string_id));
- return error_mark_node;
- }
-
- add_class_reference (constant_string_id);
-
- /* Combine_strings will work for OBJC_STRING_CST's too. */
- string = combine_strings (strings);
- TREE_SET_CODE (string, STRING_CST);
- length = TREE_STRING_LENGTH (string) - 1;
-
- if (! flag_next_runtime)
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- if (! TREE_PERMANENT (strings))
- string = my_build_string (length + 1,
- TREE_STRING_POINTER (string));
- }
-
- /* & ((NXConstantString) {0, string, length}) */
-
- initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0));
- initlist
- = tree_cons (NULL_TREE, copy_node (build_unary_op (ADDR_EXPR, string, 1)),
- initlist);
- initlist = tree_cons (NULL_TREE, build_int_2 (length, 0), initlist);
- constructor = build_constructor (constant_string_type, nreverse (initlist));
-
- if (!flag_next_runtime)
- {
- constructor
- = objc_add_static_instance (constructor, constant_string_type);
- pop_obstacks ();
- }
-
- return (build_unary_op (ADDR_EXPR, constructor, 1));
-}
-
-/* Declare a static instance of CLASS_DECL initialized by CONSTRUCTOR. */
-
-static tree
-objc_add_static_instance (constructor, class_decl)
- tree constructor, class_decl;
-{
- static int num_static_inst;
- tree *chain, decl, decl_spec, decl_expr;
- char buf[256];
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- /* Find the list of static instances for the CLASS_DECL. Create one if
- not found. */
- for (chain = &objc_static_instances;
- *chain && TREE_VALUE (*chain) != class_decl;
- chain = &TREE_CHAIN (*chain));
- if (!*chain)
- {
- *chain = tree_cons (NULL_TREE, class_decl, NULL_TREE);
- add_objc_string (TYPE_NAME (class_decl), class_names);
- }
-
- sprintf (buf, "_OBJC_INSTANCE_%d", num_static_inst++);
- decl = build_decl (VAR_DECL, get_identifier (buf), class_decl);
- DECL_COMMON (decl) = 1;
- TREE_STATIC (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- pushdecl_top_level (decl);
- rest_of_decl_compilation (decl, 0, 1, 0);
-
- /* Do this here so it gets output later instead of possibly
- inside something else we are writing. */
- DECL_INITIAL (decl) = constructor;
-
- /* Add the DECL to the head of this CLASS' list. */
- TREE_PURPOSE (*chain) = tree_cons (NULL_TREE, decl, TREE_PURPOSE (*chain));
-
- pop_obstacks ();
- return decl;
-}
-
-/* Build a static constant CONSTRUCTOR
- with type TYPE and elements ELTS. */
-
-static tree
-build_constructor (type, elts)
- tree type, elts;
-{
- tree constructor = build (CONSTRUCTOR, type, NULL_TREE, elts);
-
- TREE_CONSTANT (constructor) = 1;
- TREE_STATIC (constructor) = 1;
- TREE_READONLY (constructor) = 1;
-
- return constructor;
-}
-
-/* Take care of defining and initializing _OBJC_SYMBOLS. */
-
-/* Predefine the following data type:
-
- struct _objc_symtab
- {
- long sel_ref_cnt;
- SEL *refs;
- short cls_def_cnt;
- short cat_def_cnt;
- void *defs[cls_def_cnt + cat_def_cnt];
- }; */
-
-static void
-build_objc_symtab_template ()
-{
- tree field_decl, field_decl_chain, index;
-
- objc_symtab_template
- = start_struct (RECORD_TYPE, get_identifier (UTAG_SYMTAB));
-
- /* long sel_ref_cnt; */
-
- field_decl = create_builtin_decl (FIELD_DECL,
- long_integer_type_node,
- "sel_ref_cnt");
- field_decl_chain = field_decl;
-
- /* SEL *refs; */
-
- field_decl = create_builtin_decl (FIELD_DECL,
- build_pointer_type (selector_type),
- "refs");
- chainon (field_decl_chain, field_decl);
-
- /* short cls_def_cnt; */
-
- field_decl = create_builtin_decl (FIELD_DECL,
- short_integer_type_node,
- "cls_def_cnt");
- chainon (field_decl_chain, field_decl);
-
- /* short cat_def_cnt; */
-
- field_decl = create_builtin_decl (FIELD_DECL,
- short_integer_type_node,
- "cat_def_cnt");
- chainon (field_decl_chain, field_decl);
-
- /* void *defs[cls_def_cnt + cat_def_cnt]; */
-
- if (!flag_next_runtime)
- index = build_index_type (build_int_2 (imp_count + cat_count, 0));
- else
- index = build_index_type (build_int_2 (imp_count + cat_count - 1,
- imp_count == 0 && cat_count == 0
- ? -1 : 0));
- field_decl = create_builtin_decl (FIELD_DECL,
- build_array_type (ptr_type_node, index),
- "defs");
- chainon (field_decl_chain, field_decl);
-
- finish_struct (objc_symtab_template, field_decl_chain, NULL_TREE);
-}
-
-/* Create the initial value for the `defs' field of _objc_symtab.
- This is a CONSTRUCTOR. */
-
-static tree
-init_def_list (type)
- tree type;
-{
- tree expr, initlist = NULL_TREE;
- struct imp_entry *impent;
-
- if (imp_count)
- for (impent = imp_list; impent; impent = impent->next)
- {
- if (TREE_CODE (impent->imp_context) == CLASS_IMPLEMENTATION_TYPE)
- {
- expr = build_unary_op (ADDR_EXPR, impent->class_decl, 0);
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
- }
-
- if (cat_count)
- for (impent = imp_list; impent; impent = impent->next)
- {
- if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
- {
- expr = build_unary_op (ADDR_EXPR, impent->class_decl, 0);
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
- }
-
- if (!flag_next_runtime)
- {
- /* statics = { ..., _OBJC_STATIC_INSTANCES, ... } */
- tree expr;
-
- if (static_instances_decl)
- expr = build_unary_op (ADDR_EXPR, static_instances_decl, 0);
- else
- expr = build_int_2 (0, 0);
-
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
-
- return build_constructor (type, nreverse (initlist));
-}
-
-/* Construct the initial value for all of _objc_symtab. */
-
-static tree
-init_objc_symtab (type)
- tree type;
-{
- tree initlist;
-
- /* sel_ref_cnt = { ..., 5, ... } */
-
- initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0));
-
- /* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
-
- if (flag_next_runtime || ! sel_ref_chain)
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- initlist = tree_cons (NULL_TREE,
- build_unary_op (ADDR_EXPR,
- UOBJC_SELECTOR_TABLE_decl, 1),
- initlist);
-
- /* cls_def_cnt = { ..., 5, ... } */
-
- initlist = tree_cons (NULL_TREE, build_int_2 (imp_count, 0), initlist);
-
- /* cat_def_cnt = { ..., 5, ... } */
-
- initlist = tree_cons (NULL_TREE, build_int_2 (cat_count, 0), initlist);
-
- /* cls_def = { ..., { &Foo, &Bar, ...}, ... } */
-
- if (imp_count || cat_count || static_instances_decl)
- {
-
- tree field = TYPE_FIELDS (type);
- field = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (field))));
-
- initlist = tree_cons (NULL_TREE, init_def_list (TREE_TYPE (field)),
- initlist);
- }
-
- return build_constructor (type, nreverse (initlist));
-}
-
-/* Push forward-declarations of all the categories
- so that init_def_list can use them in a CONSTRUCTOR. */
-
-static void
-forward_declare_categories ()
-{
- struct imp_entry *impent;
- tree sav = implementation_context;
-
- for (impent = imp_list; impent; impent = impent->next)
- {
- if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
- {
- /* Set an invisible arg to synth_id_with_class_suffix. */
- implementation_context = impent->imp_context;
- impent->class_decl
- = create_builtin_decl (VAR_DECL, objc_category_template,
- IDENTIFIER_POINTER (synth_id_with_class_suffix ("_OBJC_CATEGORY", implementation_context)));
- }
- }
- implementation_context = sav;
-}
-
-/* Create the declaration of _OBJC_SYMBOLS, with type `strict _objc_symtab'
- and initialized appropriately. */
-
-static void
-generate_objc_symtab_decl ()
-{
- tree sc_spec;
-
- if (!objc_category_template)
- build_category_template ();
-
- /* forward declare categories */
- if (cat_count)
- forward_declare_categories ();
-
- if (!objc_symtab_template)
- build_objc_symtab_template ();
-
- sc_spec = build_tree_list (NULL_TREE, ridpointers[(int) RID_STATIC]);
-
- UOBJC_SYMBOLS_decl = start_decl (get_identifier ("_OBJC_SYMBOLS"),
- tree_cons (NULL_TREE,
- objc_symtab_template, sc_spec),
- 1,
- NULL_TREE, NULL_TREE);
-
- TREE_USED (UOBJC_SYMBOLS_decl) = 1;
- DECL_IGNORED_P (UOBJC_SYMBOLS_decl) = 1;
- DECL_ARTIFICIAL (UOBJC_SYMBOLS_decl) = 1;
- finish_decl (UOBJC_SYMBOLS_decl,
- init_objc_symtab (TREE_TYPE (UOBJC_SYMBOLS_decl)),
- NULL_TREE);
-}
-
-static tree
-init_module_descriptor (type)
- tree type;
-{
- tree initlist, expr;
-
- /* version = { 1, ... } */
-
- expr = build_int_2 (OBJC_VERSION, 0);
- initlist = build_tree_list (NULL_TREE, expr);
-
- /* size = { ..., sizeof (struct objc_module), ... } */
-
- expr = size_in_bytes (objc_module_template);
- initlist = tree_cons (NULL_TREE, expr, initlist);
-
- /* name = { ..., "foo.m", ... } */
-
- expr = add_objc_string (get_identifier (input_filename), class_names);
- initlist = tree_cons (NULL_TREE, expr, initlist);
-
- /* symtab = { ..., _OBJC_SYMBOLS, ... } */
-
- if (UOBJC_SYMBOLS_decl)
- expr = build_unary_op (ADDR_EXPR, UOBJC_SYMBOLS_decl, 0);
- else
- expr = build_int_2 (0, 0);
- initlist = tree_cons (NULL_TREE, expr, initlist);
-
- return build_constructor (type, nreverse (initlist));
-}
-
-/* Write out the data structures to describe Objective C classes defined.
- If appropriate, compile and output a setup function to initialize them.
- Return a string which is the name of a function to call to initialize
- the Objective C data structures for this file (and perhaps for other files
- also).
-
- struct objc_module { ... } _OBJC_MODULE = { ... }; */
-
-static char *
-build_module_descriptor ()
-{
- tree decl_specs, field_decl, field_decl_chain;
-
- objc_module_template
- = start_struct (RECORD_TYPE, get_identifier (UTAG_MODULE));
-
- /* Long version; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_LONG]);
- field_decl = get_identifier ("version");
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* long size; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_LONG]);
- field_decl = get_identifier ("size");
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* char *name; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("name"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_symtab *symtab; */
-
- decl_specs = get_identifier (UTAG_SYMTAB);
- decl_specs = build_tree_list (NULL_TREE, xref_tag (RECORD_TYPE, decl_specs));
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("symtab"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (objc_module_template, field_decl_chain, NULL_TREE);
-
- /* Create an instance of "objc_module". */
-
- decl_specs = tree_cons (NULL_TREE, objc_module_template,
- build_tree_list (NULL_TREE,
- ridpointers[(int) RID_STATIC]));
-
- UOBJC_MODULES_decl = start_decl (get_identifier ("_OBJC_MODULES"),
- decl_specs, 1, NULL_TREE, NULL_TREE);
-
- DECL_ARTIFICIAL (UOBJC_MODULES_decl) = 1;
- DECL_IGNORED_P (UOBJC_MODULES_decl) = 1;
- finish_decl (UOBJC_MODULES_decl,
- init_module_descriptor (TREE_TYPE (UOBJC_MODULES_decl)),
- NULL_TREE);
-
- /* Mark the decl to avoid "defined but not used" warning. */
- DECL_IN_SYSTEM_HEADER (UOBJC_MODULES_decl) = 1;
-
- /* Generate a constructor call for the module descriptor.
- This code was generated by reading the grammar rules
- of c-parse.in; Therefore, it may not be the most efficient
- way of generating the requisite code. */
-
- if (flag_next_runtime)
- return 0;
-
- {
- tree parms, function_decl, decelerator, void_list_node;
- tree function_type;
- extern tree get_file_function_name ();
- tree init_function_name = get_file_function_name ('I');
-
- /* Declare void __objc_execClass (void *); */
-
- void_list_node = build_tree_list (NULL_TREE, void_type_node);
- function_type
- = build_function_type (void_type_node,
- tree_cons (NULL_TREE, ptr_type_node,
- void_list_node));
- function_decl = build_decl (FUNCTION_DECL,
- get_identifier (TAG_EXECCLASS),
- function_type);
- DECL_EXTERNAL (function_decl) = 1;
- DECL_ARTIFICIAL (function_decl) = 1;
- TREE_PUBLIC (function_decl) = 1;
-
- pushdecl (function_decl);
- rest_of_decl_compilation (function_decl, 0, 0, 0);
-
- parms
- = build_tree_list (NULL_TREE,
- build_unary_op (ADDR_EXPR, UOBJC_MODULES_decl, 0));
- decelerator = build_function_call (function_decl, parms);
-
- /* void _GLOBAL_$I$<gnyf> () {objc_execClass (&L_OBJC_MODULES);} */
-
- start_function (void_list_node,
- build_parse_node (CALL_EXPR, init_function_name,
- /* This has the format of the output
- of get_parm_info. */
- tree_cons (NULL_TREE, NULL_TREE,
- void_list_node),
- NULL_TREE),
- NULL_TREE, NULL_TREE, 0);
-#if 0 /* This should be turned back on later
- for the systems where collect is not needed. */
- /* Make these functions nonglobal
- so each file can use the same name. */
- TREE_PUBLIC (current_function_decl) = 0;
-#endif
- TREE_USED (current_function_decl) = 1;
- store_parm_decls ();
-
- assemble_external (function_decl);
- c_expand_expr_stmt (decelerator);
-
- TREE_PUBLIC (current_function_decl) = 1;
-
- function_decl = current_function_decl;
- finish_function (0);
-
- /* Return the name of the constructor function. */
- return XSTR (XEXP (DECL_RTL (function_decl), 0), 0);
- }
-}
-
-/* extern const char _OBJC_STRINGS[]; */
-
-static void
-generate_forward_declaration_to_string_table ()
-{
- tree sc_spec, decl_specs, expr_decl;
-
- sc_spec = tree_cons (NULL_TREE, ridpointers[(int) RID_EXTERN], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_CHAR], sc_spec);
-
- expr_decl
- = build_nt (ARRAY_REF, get_identifier ("_OBJC_STRINGS"), NULL_TREE);
-
- UOBJC_STRINGS_decl = define_decl (expr_decl, decl_specs);
-}
-
-/* Return the DECL of the string IDENT in the SECTION. */
-
-static tree
-get_objc_string_decl (ident, section)
- tree ident;
- enum string_section section;
-{
- tree chain, decl;
-
- if (section == class_names)
- chain = class_names_chain;
- else if (section == meth_var_names)
- chain = meth_var_names_chain;
- else if (section == meth_var_types)
- chain = meth_var_types_chain;
-
- for (; chain != 0; chain = TREE_VALUE (chain))
- if (TREE_VALUE (chain) == ident)
- return (TREE_PURPOSE (chain));
-
- abort ();
- return NULL_TREE;
-}
-
-/* Output references to all statically allocated objects. Return the DECL
- for the array built. */
-
-static tree
-generate_static_references ()
-{
- tree decls = NULL_TREE, ident, decl_spec, expr_decl, expr = NULL_TREE;
- tree class_name, class, decl, instance, idecl, initlist;
- tree cl_chain, in_chain, type;
- int num_inst, num_class;
- char buf[256];
-
- if (flag_next_runtime)
- abort ();
-
- for (cl_chain = objc_static_instances, num_class = 0;
- cl_chain; cl_chain = TREE_CHAIN (cl_chain), num_class++)
- {
- for (num_inst = 0, in_chain = TREE_PURPOSE (cl_chain);
- in_chain; num_inst++, in_chain = TREE_CHAIN (in_chain));
-
- sprintf (buf, "_OBJC_STATIC_INSTANCES_%d", num_class);
- ident = get_identifier (buf);
-
- expr_decl = build_nt (ARRAY_REF, ident, NULL_TREE);
- decl_spec = tree_cons (NULL_TREE, build_pointer_type (void_type_node),
- build_tree_list (NULL_TREE,
- ridpointers[(int) RID_STATIC]));
- decl = start_decl (expr_decl, decl_spec, 1, NULL_TREE, NULL_TREE);
- DECL_CONTEXT (decl) = 0;
- DECL_ARTIFICIAL (decl) = 1;
-
- /* Output {class_name, ...}. */
- class = TREE_VALUE (cl_chain);
- class_name = get_objc_string_decl (TYPE_NAME (class), class_names);
- initlist = build_tree_list (NULL_TREE,
- build_unary_op (ADDR_EXPR, class_name, 1));
-
- /* Output {..., instance, ...}. */
- for (in_chain = TREE_PURPOSE (cl_chain);
- in_chain; in_chain = TREE_CHAIN (in_chain))
- {
- expr = build_unary_op (ADDR_EXPR, TREE_VALUE (in_chain), 1);
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
-
- /* Output {..., NULL}. */
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
-
- expr = build_constructor (TREE_TYPE (decl), nreverse (initlist));
- finish_decl (decl, expr, NULL_TREE);
- TREE_USED (decl) = 1;
-
- type = build_array_type (build_pointer_type (void_type_node), 0);
- decl = build_decl (VAR_DECL, ident, type);
- make_decl_rtl (decl, 0, 1);
- TREE_USED (decl) = 1;
- decls
- = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, decl, 1), decls);
- }
-
- decls = tree_cons (NULL_TREE, build_int_2 (0, 0), decls);
- ident = get_identifier ("_OBJC_STATIC_INSTANCES");
- expr_decl = build_nt (ARRAY_REF, ident, NULL_TREE);
- decl_spec = tree_cons (NULL_TREE, build_pointer_type (void_type_node),
- build_tree_list (NULL_TREE,
- ridpointers[(int) RID_STATIC]));
- static_instances_decl
- = start_decl (expr_decl, decl_spec, 1, NULL_TREE, NULL_TREE);
- TREE_USED (static_instances_decl) = 1;
- DECL_CONTEXT (static_instances_decl) = 0;
- DECL_ARTIFICIAL (static_instances_decl) = 1;
- end_temporary_allocation ();
- expr = build_constructor (TREE_TYPE (static_instances_decl),
- nreverse (decls));
- finish_decl (static_instances_decl, expr, NULL_TREE);
-}
-
-/* Output all strings. */
-
-static void
-generate_strings ()
-{
- tree sc_spec, decl_specs, expr_decl;
- tree chain, string_expr;
- tree string, decl;
-
- for (chain = class_names_chain; chain; chain = TREE_CHAIN (chain))
- {
- string = TREE_VALUE (chain);
- decl = TREE_PURPOSE (chain);
- sc_spec
- = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_CHAR], sc_spec);
- expr_decl = build_nt (ARRAY_REF, DECL_NAME (decl), NULL_TREE);
- decl = start_decl (expr_decl, decl_specs, 1, NULL_TREE, NULL_TREE);
- end_temporary_allocation ();
- string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
- IDENTIFIER_POINTER (string));
- finish_decl (decl, string_expr, NULL_TREE);
- }
-
- for (chain = meth_var_names_chain; chain; chain = TREE_CHAIN (chain))
- {
- string = TREE_VALUE (chain);
- decl = TREE_PURPOSE (chain);
- sc_spec
- = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_CHAR], sc_spec);
- expr_decl = build_nt (ARRAY_REF, DECL_NAME (decl), NULL_TREE);
- decl = start_decl (expr_decl, decl_specs, 1, NULL_TREE, NULL_TREE);
- string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
- IDENTIFIER_POINTER (string));
- finish_decl (decl, string_expr, NULL_TREE);
- }
-
- for (chain = meth_var_types_chain; chain; chain = TREE_CHAIN (chain))
- {
- string = TREE_VALUE (chain);
- decl = TREE_PURPOSE (chain);
- sc_spec
- = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_CHAR], sc_spec);
- expr_decl = build_nt (ARRAY_REF, DECL_NAME (decl), NULL_TREE);
- decl = start_decl (expr_decl, decl_specs, 1, NULL_TREE, NULL_TREE);
- string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
- IDENTIFIER_POINTER (string));
- finish_decl (decl, string_expr, NULL_TREE);
- }
-}
-
-static tree
-build_selector_reference_decl (name)
- tree name;
-{
- tree decl, ident;
- char buf[256];
- static int idx = 0;
-
- sprintf (buf, "_OBJC_SELECTOR_REFERENCES_%d", idx++);
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- ident = get_identifier (buf);
-
- decl = build_decl (VAR_DECL, ident, selector_type);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- TREE_USED (decl) = 1;
- TREE_READONLY (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- DECL_CONTEXT (decl) = 0;
-
- make_decl_rtl (decl, 0, 1);
- pushdecl_top_level (decl);
-
- pop_obstacks ();
-
- return decl;
-}
-
-/* Just a handy wrapper for add_objc_string. */
-
-static tree
-build_selector (ident)
- tree ident;
-{
- tree expr = add_objc_string (ident, meth_var_names);
- if (flag_typed_selectors)
- return expr;
- else
- return build_c_cast (selector_type, expr); /* cast! */
-}
-
-/* Synthesize the following expr: (char *)&_OBJC_STRINGS[<offset>]
- The cast stops the compiler from issuing the following message:
- grok.m: warning: initialization of non-const * pointer from const *
- grok.m: warning: initialization between incompatible pointer types. */
-
-static tree
-build_msg_pool_reference (offset)
- int offset;
-{
- tree expr = build_int_2 (offset, 0);
- tree cast;
-
- expr = build_array_ref (UOBJC_STRINGS_decl, expr);
- expr = build_unary_op (ADDR_EXPR, expr, 0);
-
- cast = build_tree_list (build_tree_list (NULL_TREE,
- ridpointers[(int) RID_CHAR]),
- build1 (INDIRECT_REF, NULL_TREE, NULL_TREE));
- TREE_TYPE (expr) = groktypename (cast);
- return expr;
-}
-
-static tree
-init_selector (offset)
- int offset;
-{
- tree expr = build_msg_pool_reference (offset);
- TREE_TYPE (expr) = selector_type;
- return expr;
-}
-
-static void
-build_selector_translation_table ()
-{
- tree sc_spec, decl_specs;
- tree chain, initlist = NULL_TREE;
- int offset = 0;
- tree decl, var_decl, name;
-
- /* The corresponding pop_obstacks is in finish_decl,
- called at the end of this function. */
- if (! flag_next_runtime)
- push_obstacks_nochange ();
-
- for (chain = sel_ref_chain; chain; chain = TREE_CHAIN (chain))
- {
- tree expr;
-
- expr = build_selector (TREE_VALUE (chain));
-
- if (flag_next_runtime)
- {
- name = DECL_NAME (TREE_PURPOSE (chain));
-
- sc_spec = build_tree_list (NULL_TREE, ridpointers[(int) RID_STATIC]);
-
- /* static SEL _OBJC_SELECTOR_REFERENCES_n = ...; */
- decl_specs = tree_cons (NULL_TREE, selector_type, sc_spec);
-
- var_decl = name;
-
- /* The `decl' that is returned from start_decl is the one that we
- forward declared in `build_selector_reference' */
- decl = start_decl (var_decl, decl_specs, 1, NULL_TREE, NULL_TREE);
- }
-
- /* add one for the '\0' character */
- offset += IDENTIFIER_LENGTH (TREE_VALUE (chain)) + 1;
-
- if (flag_next_runtime)
- finish_decl (decl, expr, NULL_TREE);
- else
- {
- if (flag_typed_selectors)
- {
- tree eltlist = NULL_TREE;
- tree encoding = get_proto_encoding (TREE_PURPOSE (chain));
- eltlist = tree_cons (NULL_TREE, expr, NULL_TREE);
- eltlist = tree_cons (NULL_TREE, encoding, eltlist);
- expr = build_constructor (objc_selector_template,
- nreverse (eltlist));
- }
- initlist = tree_cons (NULL_TREE, expr, initlist);
-
- }
- }
-
- if (! flag_next_runtime)
- {
- /* Cause the variable and its initial value to be actually output. */
- DECL_EXTERNAL (UOBJC_SELECTOR_TABLE_decl) = 0;
- TREE_STATIC (UOBJC_SELECTOR_TABLE_decl) = 1;
- /* NULL terminate the list and fix the decl for output. */
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- DECL_INITIAL (UOBJC_SELECTOR_TABLE_decl) = (tree) 1;
- initlist = build_constructor (TREE_TYPE (UOBJC_SELECTOR_TABLE_decl),
- nreverse (initlist));
- finish_decl (UOBJC_SELECTOR_TABLE_decl, initlist, NULL_TREE);
- current_function_decl = NULL_TREE;
- }
-}
-
-static tree
-get_proto_encoding (proto)
- tree proto;
-{
- tree encoding;
- if (proto)
- {
- tree tmp_decl;
-
- if (! METHOD_ENCODING (proto))
- {
- tmp_decl = build_tmp_function_decl ();
- hack_method_prototype (proto, tmp_decl);
- encoding = encode_method_prototype (proto, tmp_decl);
- METHOD_ENCODING (proto) = encoding;
- }
- else
- encoding = METHOD_ENCODING (proto);
-
- return add_objc_string (encoding, meth_var_types);
- }
- else
- return build_int_2 (0, 0);
-}
-
-/* sel_ref_chain is a list whose "value" fields will be instances of
- identifier_node that represent the selector. */
-
-static tree
-build_typed_selector_reference (ident, proto)
- tree ident, proto;
-{
- tree *chain = &sel_ref_chain;
- tree expr;
- int index = 0;
-
- while (*chain)
- {
- if (TREE_PURPOSE (*chain) == ident && TREE_VALUE (*chain) == proto)
- goto return_at_index;
-
- index++;
- chain = &TREE_CHAIN (*chain);
- }
-
- *chain = perm_tree_cons (proto, ident, NULL_TREE);
-
- return_at_index:
- expr = build_unary_op (ADDR_EXPR,
- build_array_ref (UOBJC_SELECTOR_TABLE_decl,
- build_int_2 (index, 0)),
- 1);
- return build_c_cast (selector_type, expr);
-}
-
-static tree
-build_selector_reference (ident)
- tree ident;
-{
- tree *chain = &sel_ref_chain;
- tree expr;
- int index = 0;
-
- while (*chain)
- {
- if (TREE_VALUE (*chain) == ident)
- return (flag_next_runtime
- ? TREE_PURPOSE (*chain)
- : build_array_ref (UOBJC_SELECTOR_TABLE_decl,
- build_int_2 (index, 0)));
-
- index++;
- chain = &TREE_CHAIN (*chain);
- }
-
- expr = build_selector_reference_decl (ident);
-
- *chain = perm_tree_cons (expr, ident, NULL_TREE);
-
- return (flag_next_runtime
- ? expr
- : build_array_ref (UOBJC_SELECTOR_TABLE_decl,
- build_int_2 (index, 0)));
-}
-
-static tree
-build_class_reference_decl (name)
- tree name;
-{
- tree decl, ident;
- char buf[256];
- static int idx = 0;
-
- sprintf (buf, "_OBJC_CLASS_REFERENCES_%d", idx++);
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- ident = get_identifier (buf);
-
- decl = build_decl (VAR_DECL, ident, objc_class_type);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- TREE_USED (decl) = 1;
- TREE_READONLY (decl) = 1;
- DECL_CONTEXT (decl) = 0;
- DECL_ARTIFICIAL (decl) = 1;
-
- make_decl_rtl (decl, 0, 1);
- pushdecl_top_level (decl);
-
- pop_obstacks ();
-
- return decl;
-}
-
-/* Create a class reference, but don't create a variable to reference
- it. */
-
-static void
-add_class_reference (ident)
- tree ident;
-{
- tree chain;
-
- if ((chain = cls_ref_chain))
- {
- tree tail;
- do
- {
- if (ident == TREE_VALUE (chain))
- return;
-
- tail = chain;
- chain = TREE_CHAIN (chain);
- }
- while (chain);
-
- /* Append to the end of the list */
- TREE_CHAIN (tail) = perm_tree_cons (NULL_TREE, ident, NULL_TREE);
- }
- else
- cls_ref_chain = perm_tree_cons (NULL_TREE, ident, NULL_TREE);
-}
-
-/* Get a class reference, creating it if necessary. Also create the
- reference variable. */
-
-tree
-get_class_reference (ident)
- tree ident;
-{
- if (flag_next_runtime)
- {
- tree *chain;
- tree decl;
-
- for (chain = &cls_ref_chain; *chain; chain = &TREE_CHAIN (*chain))
- if (TREE_VALUE (*chain) == ident)
- {
- if (! TREE_PURPOSE (*chain))
- TREE_PURPOSE (*chain) = build_class_reference_decl (ident);
-
- return TREE_PURPOSE (*chain);
- }
-
- decl = build_class_reference_decl (ident);
- *chain = perm_tree_cons (decl, ident, NULL_TREE);
- return decl;
- }
- else
- {
- tree params;
-
- add_class_reference (ident);
-
- params = build_tree_list (NULL_TREE,
- my_build_string (IDENTIFIER_LENGTH (ident) + 1,
- IDENTIFIER_POINTER (ident)));
-
- assemble_external (objc_get_class_decl);
- return build_function_call (objc_get_class_decl, params);
- }
-}
-
-/* SEL_REFDEF_CHAIN is a list whose "value" fields will be instances
- of identifier_node that represent the selector. It returns the
- offset of the selector from the beginning of the _OBJC_STRINGS
- pool. This offset is typically used by init_selector during code
- generation.
-
- For each string section we have a chain which maps identifier nodes
- to decls for the strings. */
-
-static tree
-add_objc_string (ident, section)
- tree ident;
- enum string_section section;
-{
- tree *chain, decl;
-
- if (section == class_names)
- chain = &class_names_chain;
- else if (section == meth_var_names)
- chain = &meth_var_names_chain;
- else if (section == meth_var_types)
- chain = &meth_var_types_chain;
-
- while (*chain)
- {
- if (TREE_VALUE (*chain) == ident)
- return build_unary_op (ADDR_EXPR, TREE_PURPOSE (*chain), 1);
-
- chain = &TREE_CHAIN (*chain);
- }
-
- decl = build_objc_string_decl (ident, section);
-
- *chain = perm_tree_cons (decl, ident, NULL_TREE);
-
- return build_unary_op (ADDR_EXPR, decl, 1);
-}
-
-static tree
-build_objc_string_decl (name, section)
- tree name;
- enum string_section section;
-{
- tree decl, ident;
- char buf[256];
- static int class_names_idx = 0;
- static int meth_var_names_idx = 0;
- static int meth_var_types_idx = 0;
-
- if (section == class_names)
- sprintf (buf, "_OBJC_CLASS_NAME_%d", class_names_idx++);
- else if (section == meth_var_names)
- sprintf (buf, "_OBJC_METH_VAR_NAME_%d", meth_var_names_idx++);
- else if (section == meth_var_types)
- sprintf (buf, "_OBJC_METH_VAR_TYPE_%d", meth_var_types_idx++);
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
- ident = get_identifier (buf);
-
- decl = build_decl (VAR_DECL, ident, build_array_type (char_type_node, 0));
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- TREE_USED (decl) = 1;
- TREE_READONLY (decl) = 1;
- TREE_CONSTANT (decl) = 1;
- DECL_CONTEXT (decl) = 0;
- DECL_ARTIFICIAL (decl) = 1;
-
- make_decl_rtl (decl, 0, 1);
- pushdecl_top_level (decl);
-
- pop_obstacks ();
-
- return decl;
-}
-
-
-void
-objc_declare_alias (alias_ident, class_ident)
- tree alias_ident;
- tree class_ident;
-{
- if (!doing_objc_thang)
- objc_fatal ();
-
- if (is_class_name (class_ident) != class_ident)
- warning ("Cannot find class `%s'", IDENTIFIER_POINTER (class_ident));
- else if (is_class_name (alias_ident))
- warning ("Class `%s' already exists", IDENTIFIER_POINTER (alias_ident));
- else
- alias_chain = tree_cons (class_ident, alias_ident, alias_chain);
-}
-
-void
-objc_declare_class (ident_list)
- tree ident_list;
-{
- tree list;
-
- if (!doing_objc_thang)
- objc_fatal ();
-
- for (list = ident_list; list; list = TREE_CHAIN (list))
- {
- tree ident = TREE_VALUE (list);
- tree decl;
-
- if ((decl = lookup_name (ident)))
- {
- error ("`%s' redeclared as different kind of symbol",
- IDENTIFIER_POINTER (ident));
- error_with_decl (decl, "previous declaration of `%s'");
- }
-
- if (! is_class_name (ident))
- {
- tree record = xref_tag (RECORD_TYPE, ident);
- TREE_STATIC_TEMPLATE (record) = 1;
- class_chain = tree_cons (NULL_TREE, ident, class_chain);
- }
- }
-}
-
-tree
-is_class_name (ident)
- tree ident;
-{
- tree chain;
-
- if (lookup_interface (ident))
- return ident;
-
- for (chain = class_chain; chain; chain = TREE_CHAIN (chain))
- {
- if (ident == TREE_VALUE (chain))
- return ident;
- }
-
- for (chain = alias_chain; chain; chain = TREE_CHAIN (chain))
- {
- if (ident == TREE_VALUE (chain))
- return TREE_PURPOSE (chain);
- }
-
- return 0;
-}
-
-tree
-lookup_interface (ident)
- tree ident;
-{
- tree chain;
-
- for (chain = interface_chain; chain; chain = TREE_CHAIN (chain))
- {
- if (ident == CLASS_NAME (chain))
- return chain;
- }
- return NULL_TREE;
-}
-
-static tree
-objc_copy_list (list, head)
- tree list;
- tree *head;
-{
- tree newlist = NULL_TREE, tail = NULL_TREE;
-
- while (list)
- {
- tail = copy_node (list);
-
- /* The following statement fixes a bug when inheriting instance
- variables that are declared to be bitfields. finish_struct
- expects to find the width of the bitfield in DECL_INITIAL,
- which it nulls out after processing the decl of the super
- class...rather than change the way finish_struct works (which
- is risky), I create the situation it expects...s.naroff
- (7/23/89). */
-
- if (DECL_BIT_FIELD (tail) && DECL_INITIAL (tail) == 0)
- DECL_INITIAL (tail) = build_int_2 (DECL_FIELD_SIZE (tail), 0);
-
- newlist = chainon (newlist, tail);
- list = TREE_CHAIN (list);
- }
-
- *head = newlist;
- return tail;
-}
-
-/* Used by: build_private_template, get_class_ivars, and
- continue_class. COPY is 1 when called from @defs. In this case
- copy all fields. Otherwise don't copy leaf ivars since we rely on
- them being side-effected exactly once by finish_struct. */
-
-static tree
-build_ivar_chain (interface, copy)
- tree interface;
- int copy;
-{
- tree my_name, super_name, ivar_chain;
-
- my_name = CLASS_NAME (interface);
- super_name = CLASS_SUPER_NAME (interface);
-
- /* Possibly copy leaf ivars. */
- if (copy)
- objc_copy_list (CLASS_IVARS (interface), &ivar_chain);
- else
- ivar_chain = CLASS_IVARS (interface);
-
- while (super_name)
- {
- tree op1;
- tree super_interface = lookup_interface (super_name);
-
- if (!super_interface)
- {
- /* fatal did not work with 2 args...should fix */
- error ("Cannot find interface declaration for `%s', superclass of `%s'",
- IDENTIFIER_POINTER (super_name),
- IDENTIFIER_POINTER (my_name));
- exit (FATAL_EXIT_CODE);
- }
-
- if (super_interface == interface)
- {
- fatal ("Circular inheritance in interface declaration for `%s'",
- IDENTIFIER_POINTER (super_name));
- }
-
- interface = super_interface;
- my_name = CLASS_NAME (interface);
- super_name = CLASS_SUPER_NAME (interface);
-
- op1 = CLASS_IVARS (interface);
- if (op1)
- {
- tree head, tail = objc_copy_list (op1, &head);
-
- /* Prepend super class ivars...make a copy of the list, we
- do not want to alter the original. */
- TREE_CHAIN (tail) = ivar_chain;
- ivar_chain = head;
- }
- }
- return ivar_chain;
-}
-
-/* struct <classname> {
- struct objc_class *isa;
- ...
- }; */
-
-static tree
-build_private_template (class)
- tree class;
-{
- tree ivar_context;
-
- if (CLASS_STATIC_TEMPLATE (class))
- {
- uprivate_record = CLASS_STATIC_TEMPLATE (class);
- ivar_context = TYPE_FIELDS (CLASS_STATIC_TEMPLATE (class));
- }
- else
- {
- uprivate_record = start_struct (RECORD_TYPE, CLASS_NAME (class));
-
- ivar_context = build_ivar_chain (class, 0);
-
- finish_struct (uprivate_record, ivar_context, NULL_TREE);
-
- CLASS_STATIC_TEMPLATE (class) = uprivate_record;
-
- /* mark this record as class template - for class type checking */
- TREE_STATIC_TEMPLATE (uprivate_record) = 1;
- }
-
- instance_type
- = groktypename (build_tree_list (build_tree_list (NULL_TREE,
- uprivate_record),
- build1 (INDIRECT_REF, NULL_TREE,
- NULL_TREE)));
-
- return ivar_context;
-}
-
-/* Begin code generation for protocols... */
-
-/* struct objc_protocol {
- char *protocol_name;
- struct objc_protocol **protocol_list;
- struct objc_method_desc *instance_methods;
- struct objc_method_desc *class_methods;
- }; */
-
-static tree
-build_protocol_template ()
-{
- tree decl_specs, field_decl, field_decl_chain;
- tree template;
-
- template = start_struct (RECORD_TYPE, get_identifier (UTAG_PROTOCOL));
-
- /* struct objc_class *isa; */
-
- decl_specs = build_tree_list (NULL_TREE, xref_tag (RECORD_TYPE,
- get_identifier (UTAG_CLASS)));
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("isa"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* char *protocol_name; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]);
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("protocol_name"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_protocol **protocol_list; */
-
- decl_specs = build_tree_list (NULL_TREE, template);
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("protocol_list"));
- field_decl = build1 (INDIRECT_REF, NULL_TREE, field_decl);
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_method_list *instance_methods; */
-
- decl_specs
- = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_METHOD_PROTOTYPE_LIST)));
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("instance_methods"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_method_list *class_methods; */
-
- decl_specs
- = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_METHOD_PROTOTYPE_LIST)));
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("class_methods"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- return finish_struct (template, field_decl_chain, NULL_TREE);
-}
-
-static tree
-build_descriptor_table_initializer (type, entries)
- tree type;
- tree entries;
-{
- tree initlist = NULL_TREE;
-
- do
- {
- tree eltlist = NULL_TREE;
-
- eltlist
- = tree_cons (NULL_TREE,
- build_selector (METHOD_SEL_NAME (entries)), NULL_TREE);
- eltlist
- = tree_cons (NULL_TREE,
- add_objc_string (METHOD_ENCODING (entries),
- meth_var_types),
- eltlist);
-
- initlist
- = tree_cons (NULL_TREE,
- build_constructor (type, nreverse (eltlist)), initlist);
-
- entries = TREE_CHAIN (entries);
- }
- while (entries);
-
- return build_constructor (build_array_type (type, 0), nreverse (initlist));
-}
-
-/* struct objc_method_prototype_list {
- int count;
- struct objc_method_prototype {
- SEL name;
- char *types;
- } list[1];
- }; */
-
-static tree
-build_method_prototype_list_template (list_type, size)
- tree list_type;
- int size;
-{
- tree objc_ivar_list_record;
- tree decl_specs, field_decl, field_decl_chain;
-
- /* Generate an unnamed struct definition. */
-
- objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
-
- /* int method_count; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_INT]);
- field_decl = get_identifier ("method_count");
-
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* struct objc_method method_list[]; */
-
- decl_specs = build_tree_list (NULL_TREE, list_type);
- field_decl = build_nt (ARRAY_REF, get_identifier ("method_list"),
- build_int_2 (size, 0));
-
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
-
- return objc_ivar_list_record;
-}
-
-static tree
-build_method_prototype_template ()
-{
- tree proto_record;
- tree decl_specs, field_decl, field_decl_chain;
-
- proto_record
- = start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD_PROTOTYPE));
-
-#ifdef OBJC_INT_SELECTORS
- /* unsigned int _cmd; */
- decl_specs
- = tree_cons (NULL_TREE, ridpointers[(int) RID_UNSIGNED], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_INT], decl_specs);
- field_decl = get_identifier ("_cmd");
-#else /* OBJC_INT_SELECTORS */
- /* struct objc_selector *_cmd; */
- decl_specs = tree_cons (NULL_TREE, xref_tag (RECORD_TYPE,
- get_identifier (TAG_SELECTOR)), NULL_TREE);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("_cmd"));
-#endif /* OBJC_INT_SELECTORS */
-
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_CHAR], NULL_TREE);
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("method_types"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (proto_record, field_decl_chain, NULL_TREE);
-
- return proto_record;
-}
-
-/* True if last call to forwarding_offset yielded a register offset. */
-static int offset_is_register;
-
-static int
-forwarding_offset (parm)
- tree parm;
-{
- int offset_in_bytes;
-
- if (GET_CODE (DECL_INCOMING_RTL (parm)) == MEM)
- {
- rtx addr = XEXP (DECL_INCOMING_RTL (parm), 0);
-
- /* ??? Here we assume that the parm address is indexed
- off the frame pointer or arg pointer.
- If that is not true, we produce meaningless results,
- but do not crash. */
- if (GET_CODE (addr) == PLUS
- && GET_CODE (XEXP (addr, 1)) == CONST_INT)
- offset_in_bytes = INTVAL (XEXP (addr, 1));
- else
- offset_in_bytes = 0;
-
- offset_in_bytes += OBJC_FORWARDING_STACK_OFFSET;
- offset_is_register = 0;
- }
- else if (GET_CODE (DECL_INCOMING_RTL (parm)) == REG)
- {
- int regno = REGNO (DECL_INCOMING_RTL (parm));
- offset_in_bytes = apply_args_register_offset (regno);
- offset_is_register = 1;
- }
- else
- return 0;
-
- /* This is the case where the parm is passed as an int or double
- and it is converted to a char, short or float and stored back
- in the parmlist. In this case, describe the parm
- with the variable's declared type, and adjust the address
- if the least significant bytes (which we are using) are not
- the first ones. */
- if (BYTES_BIG_ENDIAN && TREE_TYPE (parm) != DECL_ARG_TYPE (parm))
- offset_in_bytes += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parm)))
- - GET_MODE_SIZE (GET_MODE (DECL_RTL (parm))));
-
- return offset_in_bytes;
-}
-
-static tree
-encode_method_prototype (method_decl, func_decl)
- tree method_decl;
- tree func_decl;
-{
- tree parms;
- int stack_size, i;
- tree user_args;
- int max_parm_end = 0;
- char buf[40];
- tree result;
-
- /* ONEWAY and BYCOPY, for remote object are the only method qualifiers. */
- encode_type_qualifiers (TREE_PURPOSE (TREE_TYPE (method_decl)));
-
- /* C type. */
- encode_type (TREE_TYPE (TREE_TYPE (func_decl)),
- obstack_object_size (&util_obstack),
- OBJC_ENCODE_INLINE_DEFS);
-
- /* Stack size. */
- for (parms = DECL_ARGUMENTS (func_decl); parms;
- parms = TREE_CHAIN (parms))
- {
- int parm_end = (forwarding_offset (parms)
- + (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (parms)))
- / BITS_PER_UNIT));
-
- if (!offset_is_register && max_parm_end < parm_end)
- max_parm_end = parm_end;
- }
-
- stack_size = max_parm_end - OBJC_FORWARDING_MIN_OFFSET;
-
- sprintf (buf, "%d", stack_size);
- obstack_grow (&util_obstack, buf, strlen (buf));
-
- user_args = METHOD_SEL_ARGS (method_decl);
-
- /* Argument types. */
- for (parms = DECL_ARGUMENTS (func_decl), i = 0; parms;
- parms = TREE_CHAIN (parms), i++)
- {
- /* Process argument qualifiers for user supplied arguments. */
- if (i > 1)
- {
- encode_type_qualifiers (TREE_PURPOSE (TREE_TYPE (user_args)));
- user_args = TREE_CHAIN (user_args);
- }
-
- /* Type. */
- encode_type (TREE_TYPE (parms),
- obstack_object_size (&util_obstack),
- OBJC_ENCODE_INLINE_DEFS);
-
- /* Compute offset. */
- sprintf (buf, "%d", forwarding_offset (parms));
-
- /* Indicate register. */
- if (offset_is_register)
- obstack_1grow (&util_obstack, '+');
-
- obstack_grow (&util_obstack, buf, strlen (buf));
- }
-
- obstack_1grow (&util_obstack, '\0');
- result = get_identifier (obstack_finish (&util_obstack));
- obstack_free (&util_obstack, util_firstobj);
- return result;
-}
-
-static tree
-generate_descriptor_table (type, name, size, list, proto)
- tree type;
- char *name;
- int size;
- tree list;
- tree proto;
-{
- tree sc_spec, decl_specs, decl, initlist;
-
- sc_spec = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, type, sc_spec);
-
- decl = start_decl (synth_id_with_class_suffix (name, proto),
- decl_specs, 1, NULL_TREE, NULL_TREE);
-
- initlist = build_tree_list (NULL_TREE, build_int_2 (size, 0));
- initlist = tree_cons (NULL_TREE, list, initlist);
-
- finish_decl (decl, build_constructor (type, nreverse (initlist)),
- NULL_TREE);
-
- return decl;
-}
-
-static void
-generate_method_descriptors (protocol) /* generate_dispatch_tables */
- tree protocol;
-{
- static tree objc_method_prototype_template;
- tree initlist, chain, method_list_template;
- tree cast, variable_length_type;
- int size;
-
- if (!objc_method_prototype_template)
- objc_method_prototype_template = build_method_prototype_template ();
-
- cast = build_tree_list (build_tree_list (NULL_TREE, xref_tag (RECORD_TYPE,
- get_identifier (UTAG_METHOD_PROTOTYPE_LIST))),
- NULL_TREE);
- variable_length_type = groktypename (cast);
-
- chain = PROTOCOL_CLS_METHODS (protocol);
- if (chain)
- {
- size = list_length (chain);
-
- method_list_template
- = build_method_prototype_list_template (objc_method_prototype_template,
- size);
-
- initlist
- = build_descriptor_table_initializer (objc_method_prototype_template,
- chain);
-
- UOBJC_CLASS_METHODS_decl
- = generate_descriptor_table (method_list_template,
- "_OBJC_PROTOCOL_CLASS_METHODS",
- size, initlist, protocol);
- TREE_TYPE (UOBJC_CLASS_METHODS_decl) = variable_length_type;
- }
- else
- UOBJC_CLASS_METHODS_decl = 0;
-
- chain = PROTOCOL_NST_METHODS (protocol);
- if (chain)
- {
- size = list_length (chain);
-
- method_list_template
- = build_method_prototype_list_template (objc_method_prototype_template,
- size);
- initlist
- = build_descriptor_table_initializer (objc_method_prototype_template,
- chain);
-
- UOBJC_INSTANCE_METHODS_decl
- = generate_descriptor_table (method_list_template,
- "_OBJC_PROTOCOL_INSTANCE_METHODS",
- size, initlist, protocol);
- TREE_TYPE (UOBJC_INSTANCE_METHODS_decl) = variable_length_type;
- }
- else
- UOBJC_INSTANCE_METHODS_decl = 0;
-}
-
-static tree
-build_tmp_function_decl ()
-{
- tree decl_specs, expr_decl, parms;
- static int xxx = 0;
- char buffer[80];
-
- /* struct objc_object *objc_xxx (id, SEL, ...); */
- pushlevel (0);
- decl_specs = build_tree_list (NULL_TREE, objc_object_reference);
- push_parm_decl (build_tree_list
- (build_tree_list (decl_specs,
- build1 (INDIRECT_REF, NULL_TREE,
- NULL_TREE)),
- build_tree_list (NULL_TREE, NULL_TREE)));
-
- decl_specs = build_tree_list (NULL_TREE, xref_tag (RECORD_TYPE,
- get_identifier (TAG_SELECTOR)));
- expr_decl = build1 (INDIRECT_REF, NULL_TREE, NULL_TREE);
-
- push_parm_decl (build_tree_list (build_tree_list (decl_specs, expr_decl),
- build_tree_list (NULL_TREE, NULL_TREE)));
- parms = get_parm_info (0);
- poplevel (0, 0, 0);
-
- decl_specs = build_tree_list (NULL_TREE, objc_object_reference);
- sprintf (buffer, "__objc_tmp_%x", xxx++);
- expr_decl = build_nt (CALL_EXPR, get_identifier (buffer), parms, NULL_TREE);
- expr_decl = build1 (INDIRECT_REF, NULL_TREE, expr_decl);
-
- return define_decl (expr_decl, decl_specs);
-}
-
-static void
-hack_method_prototype (nst_methods, tmp_decl)
- tree nst_methods;
- tree tmp_decl;
-{
- tree parms;
- tree parm;
-
- /* Hack to avoid problem with static typing of self arg. */
- TREE_SET_CODE (nst_methods, CLASS_METHOD_DECL);
- start_method_def (nst_methods);
- TREE_SET_CODE (nst_methods, INSTANCE_METHOD_DECL);
-
- if (METHOD_ADD_ARGS (nst_methods) == (tree) 1)
- parms = get_parm_info (0); /* we have a `, ...' */
- else
- parms = get_parm_info (1); /* place a `void_at_end' */
-
- poplevel (0, 0, 0); /* Must be called BEFORE start_function. */
-
- /* Usually called from store_parm_decls -> init_function_start. */
-
- DECL_ARGUMENTS (tmp_decl) = TREE_PURPOSE (parms);
- current_function_decl = tmp_decl;
-
- {
- /* Code taken from start_function. */
- tree restype = TREE_TYPE (TREE_TYPE (tmp_decl));
- /* Promote the value to int before returning it. */
- if (TREE_CODE (restype) == INTEGER_TYPE
- && TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node))
- restype = integer_type_node;
- DECL_RESULT (tmp_decl) = build_decl (RESULT_DECL, 0, restype);
- }
-
- for (parm = DECL_ARGUMENTS (tmp_decl); parm; parm = TREE_CHAIN (parm))
- DECL_CONTEXT (parm) = tmp_decl;
-
- init_function_start (tmp_decl, "objc-act", 0);
-
- /* Typically called from expand_function_start for function definitions. */
- assign_parms (tmp_decl, 0);
-
- /* install return type */
- TREE_TYPE (TREE_TYPE (tmp_decl)) = groktypename (TREE_TYPE (nst_methods));
-
-}
-
-static void
-generate_protocol_references (plist)
- tree plist;
-{
- tree lproto;
-
- /* Forward declare protocols referenced. */
- for (lproto = plist; lproto; lproto = TREE_CHAIN (lproto))
- {
- tree proto = TREE_VALUE (lproto);
-
- if (TREE_CODE (proto) == PROTOCOL_INTERFACE_TYPE
- && PROTOCOL_NAME (proto))
- {
- if (! PROTOCOL_FORWARD_DECL (proto))
- build_protocol_reference (proto);
-
- if (PROTOCOL_LIST (proto))
- generate_protocol_references (PROTOCOL_LIST (proto));
- }
- }
-}
-
-static void
-generate_protocols ()
-{
- tree p, tmp_decl, encoding;
- tree sc_spec, decl_specs, decl;
- tree initlist, protocol_name_expr, refs_decl, refs_expr;
- tree cast_type2 = 0;
-
- tmp_decl = build_tmp_function_decl ();
-
- if (! objc_protocol_template)
- objc_protocol_template = build_protocol_template ();
-
- /* If a protocol was directly referenced, pull in indirect references. */
- for (p = protocol_chain; p; p = TREE_CHAIN (p))
- if (PROTOCOL_FORWARD_DECL (p) && PROTOCOL_LIST (p))
- generate_protocol_references (PROTOCOL_LIST (p));
-
- for (p = protocol_chain; p; p = TREE_CHAIN (p))
- {
- tree nst_methods = PROTOCOL_NST_METHODS (p);
- tree cls_methods = PROTOCOL_CLS_METHODS (p);
-
- /* If protocol wasn't referenced, don't generate any code. */
- if (! PROTOCOL_FORWARD_DECL (p))
- continue;
-
- /* Make sure we link in the Protocol class. */
- add_class_reference (get_identifier (PROTOCOL_OBJECT_CLASS_NAME));
-
- while (nst_methods)
- {
- if (! METHOD_ENCODING (nst_methods))
- {
- hack_method_prototype (nst_methods, tmp_decl);
- encoding = encode_method_prototype (nst_methods, tmp_decl);
- METHOD_ENCODING (nst_methods) = encoding;
- }
- nst_methods = TREE_CHAIN (nst_methods);
- }
-
- while (cls_methods)
- {
- if (! METHOD_ENCODING (cls_methods))
- {
- hack_method_prototype (cls_methods, tmp_decl);
- encoding = encode_method_prototype (cls_methods, tmp_decl);
- METHOD_ENCODING (cls_methods) = encoding;
- }
-
- cls_methods = TREE_CHAIN (cls_methods);
- }
- generate_method_descriptors (p);
-
- if (PROTOCOL_LIST (p))
- refs_decl = generate_protocol_list (p);
- else
- refs_decl = 0;
-
- /* static struct objc_protocol _OBJC_PROTOCOL_<mumble>; */
-
- sc_spec = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC],
- NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, objc_protocol_template, sc_spec);
-
- decl = start_decl (synth_id_with_class_suffix ("_OBJC_PROTOCOL", p),
- decl_specs, 1, NULL_TREE, NULL_TREE);
-
- protocol_name_expr = add_objc_string (PROTOCOL_NAME (p), class_names);
-
- if (refs_decl)
- {
- if (!cast_type2)
- cast_type2
- = groktypename
- (build_tree_list (build_tree_list (NULL_TREE,
- objc_protocol_template),
- build1 (INDIRECT_REF, NULL_TREE,
- build1 (INDIRECT_REF, NULL_TREE,
- NULL_TREE))));
-
- refs_expr = build_unary_op (ADDR_EXPR, refs_decl, 0);
- TREE_TYPE (refs_expr) = cast_type2;
- }
- else
- refs_expr = build_int_2 (0, 0);
-
- /* UOBJC_INSTANCE_METHODS_decl/UOBJC_CLASS_METHODS_decl are set
- by generate_method_descriptors, which is called above. */
- initlist = build_protocol_initializer (TREE_TYPE (decl),
- protocol_name_expr, refs_expr,
- UOBJC_INSTANCE_METHODS_decl,
- UOBJC_CLASS_METHODS_decl);
- finish_decl (decl, initlist, NULL_TREE);
-
- /* Mark the decl as used to avoid "defined but not used" warning. */
- TREE_USED (decl) = 1;
- }
-}
-
-static tree
-build_protocol_initializer (type, protocol_name, protocol_list,
- instance_methods, class_methods)
- tree type;
- tree protocol_name;
- tree protocol_list;
- tree instance_methods;
- tree class_methods;
-{
- tree initlist = NULL_TREE, expr;
- static tree cast_type = 0;
-
- if (!cast_type)
- cast_type
- = groktypename
- (build_tree_list
- (build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_CLASS))),
- build1 (INDIRECT_REF, NULL_TREE, NULL_TREE)));
-
- /* Filling the "isa" in with one allows the runtime system to
- detect that the version change...should remove before final release. */
-
- expr = build_int_2 (PROTOCOL_VERSION, 0);
- TREE_TYPE (expr) = cast_type;
- initlist = tree_cons (NULL_TREE, expr, initlist);
- initlist = tree_cons (NULL_TREE, protocol_name, initlist);
- initlist = tree_cons (NULL_TREE, protocol_list, initlist);
-
- if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- {
- expr = build_unary_op (ADDR_EXPR, instance_methods, 0);
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
-
- if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- {
- expr = build_unary_op (ADDR_EXPR, class_methods, 0);
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
-
- return build_constructor (type, nreverse (initlist));
-}
-
-/* struct objc_category {
- char *category_name;
- char *class_name;
- struct objc_method_list *instance_methods;
- struct objc_method_list *class_methods;
- struct objc_protocol_list *protocols;
- }; */
-
-static void
-build_category_template ()
-{
- tree decl_specs, field_decl, field_decl_chain;
-
- objc_category_template = start_struct (RECORD_TYPE,
- get_identifier (UTAG_CATEGORY));
- /* char *category_name; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]);
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("category_name"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* char *class_name; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("class_name"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_method_list *instance_methods; */
-
- decl_specs = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_METHOD_LIST)));
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("instance_methods"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_method_list *class_methods; */
-
- decl_specs = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_METHOD_LIST)));
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("class_methods"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_protocol **protocol_list; */
-
- decl_specs = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_PROTOCOL)));
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("protocol_list"));
- field_decl = build1 (INDIRECT_REF, NULL_TREE, field_decl);
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (objc_category_template, field_decl_chain, NULL_TREE);
-}
-
-/* struct objc_selector {
- void *sel_id;
- char *sel_type;
- }; */
-
-static void
-build_selector_template ()
-{
-
- tree decl_specs, field_decl, field_decl_chain;
-
- objc_selector_template
- = start_struct (RECORD_TYPE, get_identifier (UTAG_SELECTOR));
-
- /* void *sel_id; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_VOID]);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("sel_id"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* char *sel_type; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("sel_type"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (objc_selector_template, field_decl_chain, NULL_TREE);
-}
-
-/* struct objc_class {
- struct objc_class *isa;
- struct objc_class *super_class;
- char *name;
- long version;
- long info;
- long instance_size;
- struct objc_ivar_list *ivars;
- struct objc_method_list *methods;
- if (flag_next_runtime)
- struct objc_cache *cache;
- else {
- struct sarray *dtable;
- struct objc_class *subclass_list;
- struct objc_class *sibling_class;
- }
- struct objc_protocol_list *protocols;
- }; */
-
-static void
-build_class_template ()
-{
- tree decl_specs, field_decl, field_decl_chain;
-
- objc_class_template
- = start_struct (RECORD_TYPE, get_identifier (UTAG_CLASS));
-
- /* struct objc_class *isa; */
-
- decl_specs = build_tree_list (NULL_TREE, objc_class_template);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("isa"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* struct objc_class *super_class; */
-
- decl_specs = build_tree_list (NULL_TREE, objc_class_template);
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("super_class"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* char *name; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("name"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* long version; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_LONG]);
- field_decl = get_identifier ("version");
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* long info; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_LONG]);
- field_decl = get_identifier ("info");
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* long instance_size; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_LONG]);
- field_decl = get_identifier ("instance_size");
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_ivar_list *ivars; */
-
- decl_specs = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_IVAR_LIST)));
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("ivars"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_method_list *methods; */
-
- decl_specs = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_METHOD_LIST)));
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("methods"));
- field_decl
- = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- if (flag_next_runtime)
- {
- /* struct objc_cache *cache; */
-
- decl_specs = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier ("objc_cache")));
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("cache"));
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
- }
- else
- {
- /* struct sarray *dtable; */
-
- decl_specs = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier ("sarray")));
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("dtable"));
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_class *subclass_list; */
-
- decl_specs = build_tree_list (NULL_TREE, objc_class_template);
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("subclass_list"));
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_class *sibling_class; */
-
- decl_specs = build_tree_list (NULL_TREE, objc_class_template);
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("sibling_class"));
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
- }
-
- /* struct objc_protocol **protocol_list; */
-
- decl_specs = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_PROTOCOL)));
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("protocol_list"));
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, field_decl);
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
-
- finish_struct (objc_class_template, field_decl_chain, NULL_TREE);
-}
-
-/* Generate appropriate forward declarations for an implementation. */
-
-static void
-synth_forward_declarations ()
-{
- tree sc_spec, decl_specs, an_id;
-
- /* extern struct objc_class _OBJC_CLASS_<my_name>; */
-
- an_id = synth_id_with_class_suffix ("_OBJC_CLASS", implementation_context);
-
- sc_spec = build_tree_list (NULL_TREE, ridpointers[(int) RID_EXTERN]);
- decl_specs = tree_cons (NULL_TREE, objc_class_template, sc_spec);
- UOBJC_CLASS_decl = define_decl (an_id, decl_specs);
- TREE_USED (UOBJC_CLASS_decl) = 1;
- DECL_ARTIFICIAL (UOBJC_CLASS_decl) = 1;
-
- /* extern struct objc_class _OBJC_METACLASS_<my_name>; */
-
- an_id = synth_id_with_class_suffix ("_OBJC_METACLASS",
- implementation_context);
-
- UOBJC_METACLASS_decl = define_decl (an_id, decl_specs);
- TREE_USED (UOBJC_METACLASS_decl) = 1;
- DECL_ARTIFICIAL(UOBJC_METACLASS_decl) = 1;
-
- /* Pre-build the following entities - for speed/convenience. */
-
- an_id = get_identifier ("super_class");
- ucls_super_ref = build_component_ref (UOBJC_CLASS_decl, an_id);
- uucls_super_ref = build_component_ref (UOBJC_METACLASS_decl, an_id);
-}
-
-static void
-error_with_ivar (message, decl, rawdecl)
- char *message;
- tree decl;
- tree rawdecl;
-{
- count_error (0);
-
- report_error_function (DECL_SOURCE_FILE (decl));
-
- fprintf (stderr, "%s:%d: ",
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
- bzero (errbuf, BUFSIZE);
- fprintf (stderr, "%s `%s'\n", message, gen_declaration (rawdecl, errbuf));
-}
-
-#define USERTYPE(t) \
- (TREE_CODE (t) == RECORD_TYPE || TREE_CODE (t) == UNION_TYPE \
- || TREE_CODE (t) == ENUMERAL_TYPE)
-
-static void
-check_ivars (inter, imp)
- tree inter;
- tree imp;
-{
- tree intdecls = CLASS_IVARS (inter);
- tree impdecls = CLASS_IVARS (imp);
- tree rawintdecls = CLASS_RAW_IVARS (inter);
- tree rawimpdecls = CLASS_RAW_IVARS (imp);
-
- while (1)
- {
- tree t1, t2;
-
- if (intdecls == 0 && impdecls == 0)
- break;
- if (intdecls == 0 || impdecls == 0)
- {
- error ("inconsistent instance variable specification");
- break;
- }
-
- t1 = TREE_TYPE (intdecls); t2 = TREE_TYPE (impdecls);
-
- if (!comptypes (t1, t2))
- {
- if (DECL_NAME (intdecls) == DECL_NAME (impdecls))
- {
- error_with_ivar ("conflicting instance variable type",
- impdecls, rawimpdecls);
- error_with_ivar ("previous declaration of",
- intdecls, rawintdecls);
- }
- else /* both the type and the name don't match */
- {
- error ("inconsistent instance variable specification");
- break;
- }
- }
-
- else if (DECL_NAME (intdecls) != DECL_NAME (impdecls))
- {
- error_with_ivar ("conflicting instance variable name",
- impdecls, rawimpdecls);
- error_with_ivar ("previous declaration of",
- intdecls, rawintdecls);
- }
-
- intdecls = TREE_CHAIN (intdecls);
- impdecls = TREE_CHAIN (impdecls);
- rawintdecls = TREE_CHAIN (rawintdecls);
- rawimpdecls = TREE_CHAIN (rawimpdecls);
- }
-}
-
-/* Set super_type to the data type node for struct objc_super *,
- first defining struct objc_super itself.
- This needs to be done just once per compilation. */
-
-static tree
-build_super_template ()
-{
- tree record, decl_specs, field_decl, field_decl_chain;
-
- record = start_struct (RECORD_TYPE, get_identifier (UTAG_SUPER));
-
- /* struct objc_object *self; */
-
- decl_specs = build_tree_list (NULL_TREE, objc_object_reference);
- field_decl = get_identifier ("self");
- field_decl = build1 (INDIRECT_REF, NULL_TREE, field_decl);
- field_decl = grokfield (input_filename, lineno,
- field_decl, decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* struct objc_class *class; */
-
- decl_specs = get_identifier (UTAG_CLASS);
- decl_specs = build_tree_list (NULL_TREE, xref_tag (RECORD_TYPE, decl_specs));
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("class"));
-
- field_decl = grokfield (input_filename, lineno,
- field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (record, field_decl_chain, NULL_TREE);
-
- /* `struct objc_super *' */
- super_type = groktypename (build_tree_list (build_tree_list (NULL_TREE,
- record),
- build1 (INDIRECT_REF,
- NULL_TREE, NULL_TREE)));
- return record;
-}
-
-/* struct objc_ivar {
- char *ivar_name;
- char *ivar_type;
- int ivar_offset;
- }; */
-
-static tree
-build_ivar_template ()
-{
- tree objc_ivar_id, objc_ivar_record;
- tree decl_specs, field_decl, field_decl_chain;
-
- objc_ivar_id = get_identifier (UTAG_IVAR);
- objc_ivar_record = start_struct (RECORD_TYPE, objc_ivar_id);
-
- /* char *ivar_name; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("ivar_name"));
-
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* char *ivar_type; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_CHAR]);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("ivar_type"));
-
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* int ivar_offset; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_INT]);
- field_decl = get_identifier ("ivar_offset");
-
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (objc_ivar_record, field_decl_chain, NULL_TREE);
-
- return objc_ivar_record;
-}
-
-/* struct {
- int ivar_count;
- struct objc_ivar ivar_list[ivar_count];
- }; */
-
-static tree
-build_ivar_list_template (list_type, size)
- tree list_type;
- int size;
-{
- tree objc_ivar_list_record;
- tree decl_specs, field_decl, field_decl_chain;
-
- objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
-
- /* int ivar_count; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_INT]);
- field_decl = get_identifier ("ivar_count");
-
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* struct objc_ivar ivar_list[]; */
-
- decl_specs = build_tree_list (NULL_TREE, list_type);
- field_decl = build_nt (ARRAY_REF, get_identifier ("ivar_list"),
- build_int_2 (size, 0));
-
- field_decl = grokfield (input_filename, lineno,
- field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
-
- return objc_ivar_list_record;
-}
-
-/* struct {
- int method_next;
- int method_count;
- struct objc_method method_list[method_count];
- }; */
-
-static tree
-build_method_list_template (list_type, size)
- tree list_type;
- int size;
-{
- tree objc_ivar_list_record;
- tree decl_specs, field_decl, field_decl_chain;
-
- objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
-
- /* int method_next; */
-
- decl_specs
- = build_tree_list
- (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_METHOD_PROTOTYPE_LIST)));
- field_decl
- = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("method_next"));
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- /* int method_count; */
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_INT]);
- field_decl = get_identifier ("method_count");
-
- field_decl = grokfield (input_filename, lineno,
- field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* struct objc_method method_list[]; */
-
- decl_specs = build_tree_list (NULL_TREE, list_type);
- field_decl = build_nt (ARRAY_REF, get_identifier ("method_list"),
- build_int_2 (size, 0));
-
- field_decl = grokfield (input_filename, lineno,
- field_decl, decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
-
- return objc_ivar_list_record;
-}
-
-static tree
-build_ivar_list_initializer (type, field_decl)
- tree type;
- tree field_decl;
-{
- tree initlist = NULL_TREE;
-
- do
- {
- tree ivar = NULL_TREE;
-
- /* Set name. */
- if (DECL_NAME (field_decl))
- ivar = tree_cons (NULL_TREE,
- add_objc_string (DECL_NAME (field_decl),
- meth_var_names),
- ivar);
- else
- /* Unnamed bit-field ivar (yuck). */
- ivar = tree_cons (NULL_TREE, build_int_2 (0, 0), ivar);
-
- /* Set type. */
- encode_field_decl (field_decl,
- obstack_object_size (&util_obstack),
- OBJC_ENCODE_DONT_INLINE_DEFS);
-
- /* Null terminate string. */
- obstack_1grow (&util_obstack, 0);
- ivar
- = tree_cons
- (NULL_TREE,
- add_objc_string (get_identifier (obstack_finish (&util_obstack)),
- meth_var_types),
- ivar);
- obstack_free (&util_obstack, util_firstobj);
-
- /* set offset */
- ivar
- = tree_cons
- (NULL_TREE,
- build_int_2 ((TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field_decl))
- / BITS_PER_UNIT),
- 0),
- ivar);
-
- initlist = tree_cons (NULL_TREE,
- build_constructor (type, nreverse (ivar)),
- initlist);
-
- field_decl = TREE_CHAIN (field_decl);
- }
- while (field_decl);
-
- return build_constructor (build_array_type (type, 0), nreverse (initlist));
-}
-
-static tree
-generate_ivars_list (type, name, size, list)
- tree type;
- char *name;
- int size;
- tree list;
-{
- tree sc_spec, decl_specs, decl, initlist;
-
- sc_spec = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, type, sc_spec);
-
- decl = start_decl (synth_id_with_class_suffix (name, implementation_context),
- decl_specs, 1, NULL_TREE, NULL_TREE);
-
- initlist = build_tree_list (NULL_TREE, build_int_2 (size, 0));
- initlist = tree_cons (NULL_TREE, list, initlist);
-
- finish_decl (decl,
- build_constructor (TREE_TYPE (decl), nreverse (initlist)),
- NULL_TREE);
-
- return decl;
-}
-
-static void
-generate_ivar_lists ()
-{
- tree initlist, ivar_list_template, chain;
- tree cast, variable_length_type;
- int size;
-
- generating_instance_variables = 1;
-
- if (!objc_ivar_template)
- objc_ivar_template = build_ivar_template ();
-
- cast
- = build_tree_list
- (build_tree_list (NULL_TREE, xref_tag (RECORD_TYPE,
- get_identifier (UTAG_IVAR_LIST))),
- NULL_TREE);
- variable_length_type = groktypename (cast);
-
- /* Only generate class variables for the root of the inheritance
- hierarchy since these will be the same for every class. */
-
- if (CLASS_SUPER_NAME (implementation_template) == NULL_TREE
- && (chain = TYPE_FIELDS (objc_class_template)))
- {
- size = list_length (chain);
-
- ivar_list_template = build_ivar_list_template (objc_ivar_template, size);
- initlist = build_ivar_list_initializer (objc_ivar_template, chain);
-
- UOBJC_CLASS_VARIABLES_decl
- = generate_ivars_list (ivar_list_template, "_OBJC_CLASS_VARIABLES",
- size, initlist);
- TREE_TYPE (UOBJC_CLASS_VARIABLES_decl) = variable_length_type;
- }
- else
- UOBJC_CLASS_VARIABLES_decl = 0;
-
- chain = CLASS_IVARS (implementation_template);
- if (chain)
- {
- size = list_length (chain);
- ivar_list_template = build_ivar_list_template (objc_ivar_template, size);
- initlist = build_ivar_list_initializer (objc_ivar_template, chain);
-
- UOBJC_INSTANCE_VARIABLES_decl
- = generate_ivars_list (ivar_list_template, "_OBJC_INSTANCE_VARIABLES",
- size, initlist);
- TREE_TYPE (UOBJC_INSTANCE_VARIABLES_decl) = variable_length_type;
- }
- else
- UOBJC_INSTANCE_VARIABLES_decl = 0;
-
- generating_instance_variables = 0;
-}
-
-static tree
-build_dispatch_table_initializer (type, entries)
- tree type;
- tree entries;
-{
- tree initlist = NULL_TREE;
-
- do
- {
- tree elemlist = NULL_TREE;
-
- elemlist = tree_cons (NULL_TREE,
- build_selector (METHOD_SEL_NAME (entries)),
- NULL_TREE);
-
- elemlist = tree_cons (NULL_TREE,
- add_objc_string (METHOD_ENCODING (entries),
- meth_var_types),
- elemlist);
-
- elemlist = tree_cons (NULL_TREE,
- build_unary_op (ADDR_EXPR,
- METHOD_DEFINITION (entries), 1),
- elemlist);
-
- initlist = tree_cons (NULL_TREE,
- build_constructor (type, nreverse (elemlist)),
- initlist);
-
- entries = TREE_CHAIN (entries);
- }
- while (entries);
-
- return build_constructor (build_array_type (type, 0), nreverse (initlist));
-}
-
-/* To accomplish method prototyping without generating all kinds of
- inane warnings, the definition of the dispatch table entries were
- changed from:
-
- struct objc_method { SEL _cmd; ...; id (*_imp)(); };
- to:
- struct objc_method { SEL _cmd; ...; void *_imp; }; */
-
-static tree
-build_method_template ()
-{
- tree _SLT_record;
- tree decl_specs, field_decl, field_decl_chain;
-
- _SLT_record = start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD));
-
-#ifdef OBJC_INT_SELECTORS
- /* unsigned int _cmd; */
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_UNSIGNED],
- NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_INT], decl_specs);
- field_decl = get_identifier ("_cmd");
-#else /* not OBJC_INT_SELECTORS */
- /* struct objc_selector *_cmd; */
- decl_specs = tree_cons (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (TAG_SELECTOR)),
- NULL_TREE);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("_cmd"));
-#endif /* not OBJC_INT_SELECTORS */
-
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- field_decl_chain = field_decl;
-
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_CHAR], NULL_TREE);
- field_decl = build1 (INDIRECT_REF, NULL_TREE,
- get_identifier ("method_types"));
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- /* void *_imp; */
-
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_VOID], NULL_TREE);
- field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("_imp"));
- field_decl = grokfield (input_filename, lineno, field_decl,
- decl_specs, NULL_TREE);
- chainon (field_decl_chain, field_decl);
-
- finish_struct (_SLT_record, field_decl_chain, NULL_TREE);
-
- return _SLT_record;
-}
-
-
-static tree
-generate_dispatch_table (type, name, size, list)
- tree type;
- char *name;
- int size;
- tree list;
-{
- tree sc_spec, decl_specs, decl, initlist;
-
- sc_spec = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, type, sc_spec);
-
- decl = start_decl (synth_id_with_class_suffix (name, implementation_context),
- decl_specs, 1, NULL_TREE, NULL_TREE);
-
- initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0));
- initlist = tree_cons (NULL_TREE, build_int_2 (size, 0), initlist);
- initlist = tree_cons (NULL_TREE, list, initlist);
-
- finish_decl (decl,
- build_constructor (TREE_TYPE (decl), nreverse (initlist)),
- NULL_TREE);
-
- return decl;
-}
-
-static void
-generate_dispatch_tables ()
-{
- tree initlist, chain, method_list_template;
- tree cast, variable_length_type;
- int size;
-
- if (!objc_method_template)
- objc_method_template = build_method_template ();
-
- cast
- = build_tree_list
- (build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_METHOD_LIST))),
- NULL_TREE);
-
- variable_length_type = groktypename (cast);
-
- chain = CLASS_CLS_METHODS (implementation_context);
- if (chain)
- {
- size = list_length (chain);
-
- method_list_template
- = build_method_list_template (objc_method_template, size);
- initlist
- = build_dispatch_table_initializer (objc_method_template, chain);
-
- UOBJC_CLASS_METHODS_decl
- = generate_dispatch_table (method_list_template,
- ((TREE_CODE (implementation_context)
- == CLASS_IMPLEMENTATION_TYPE)
- ? "_OBJC_CLASS_METHODS"
- : "_OBJC_CATEGORY_CLASS_METHODS"),
- size, initlist);
- TREE_TYPE (UOBJC_CLASS_METHODS_decl) = variable_length_type;
- }
- else
- UOBJC_CLASS_METHODS_decl = 0;
-
- chain = CLASS_NST_METHODS (implementation_context);
- if (chain)
- {
- size = list_length (chain);
-
- method_list_template
- = build_method_list_template (objc_method_template, size);
- initlist
- = build_dispatch_table_initializer (objc_method_template, chain);
-
- if (TREE_CODE (implementation_context) == CLASS_IMPLEMENTATION_TYPE)
- UOBJC_INSTANCE_METHODS_decl
- = generate_dispatch_table (method_list_template,
- "_OBJC_INSTANCE_METHODS",
- size, initlist);
- else
- /* We have a category. */
- UOBJC_INSTANCE_METHODS_decl
- = generate_dispatch_table (method_list_template,
- "_OBJC_CATEGORY_INSTANCE_METHODS",
- size, initlist);
- TREE_TYPE (UOBJC_INSTANCE_METHODS_decl) = variable_length_type;
- }
- else
- UOBJC_INSTANCE_METHODS_decl = 0;
-}
-
-static tree
-generate_protocol_list (i_or_p)
- tree i_or_p;
-{
- static tree cast_type = 0;
- tree initlist, decl_specs, sc_spec;
- tree refs_decl, expr_decl, lproto, e, plist;
- int size = 0;
-
- if (TREE_CODE (i_or_p) == CLASS_INTERFACE_TYPE
- || TREE_CODE (i_or_p) == CATEGORY_INTERFACE_TYPE)
- plist = CLASS_PROTOCOL_LIST (i_or_p);
- else if (TREE_CODE (i_or_p) == PROTOCOL_INTERFACE_TYPE)
- plist = PROTOCOL_LIST (i_or_p);
- else
- abort ();
-
- if (!cast_type)
- cast_type
- = groktypename
- (build_tree_list
- (build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_PROTOCOL))),
- build1 (INDIRECT_REF, NULL_TREE, NULL_TREE)));
-
- /* Compute size. */
- for (lproto = plist; lproto; lproto = TREE_CHAIN (lproto))
- if (TREE_CODE (TREE_VALUE (lproto)) == PROTOCOL_INTERFACE_TYPE
- && PROTOCOL_FORWARD_DECL (TREE_VALUE (lproto)))
- size++;
-
- /* Build initializer. */
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), NULL_TREE);
-
- e = build_int_2 (size, 0);
- TREE_TYPE (e) = cast_type;
- initlist = tree_cons (NULL_TREE, e, initlist);
-
- for (lproto = plist; lproto; lproto = TREE_CHAIN (lproto))
- {
- tree pval = TREE_VALUE (lproto);
-
- if (TREE_CODE (pval) == PROTOCOL_INTERFACE_TYPE
- && PROTOCOL_FORWARD_DECL (pval))
- {
- e = build_unary_op (ADDR_EXPR, PROTOCOL_FORWARD_DECL (pval), 0);
- initlist = tree_cons (NULL_TREE, e, initlist);
- }
- }
-
- /* static struct objc_protocol *refs[n]; */
-
- sc_spec = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, xref_tag (RECORD_TYPE,
- get_identifier (UTAG_PROTOCOL)),
- sc_spec);
-
- if (TREE_CODE (i_or_p) == PROTOCOL_INTERFACE_TYPE)
- expr_decl = build_nt (ARRAY_REF,
- synth_id_with_class_suffix ("_OBJC_PROTOCOL_REFS",
- i_or_p),
- build_int_2 (size + 2, 0));
- else if (TREE_CODE (i_or_p) == CLASS_INTERFACE_TYPE)
- expr_decl = build_nt (ARRAY_REF,
- synth_id_with_class_suffix ("_OBJC_CLASS_PROTOCOLS",
- i_or_p),
- build_int_2 (size + 2, 0));
- else if (TREE_CODE (i_or_p) == CATEGORY_INTERFACE_TYPE)
- expr_decl
- = build_nt (ARRAY_REF,
- synth_id_with_class_suffix ("_OBJC_CATEGORY_PROTOCOLS",
- i_or_p),
- build_int_2 (size + 2, 0));
-
- expr_decl = build1 (INDIRECT_REF, NULL_TREE, expr_decl);
-
- refs_decl = start_decl (expr_decl, decl_specs, 1, NULL_TREE, NULL_TREE);
-
- finish_decl (refs_decl, build_constructor (TREE_TYPE (refs_decl),
- nreverse (initlist)),
- NULL_TREE);
-
- return refs_decl;
-}
-
-static tree
-build_category_initializer (type, cat_name, class_name,
- instance_methods, class_methods, protocol_list)
- tree type;
- tree cat_name;
- tree class_name;
- tree instance_methods;
- tree class_methods;
- tree protocol_list;
-{
- tree initlist = NULL_TREE, expr;
-
- initlist = tree_cons (NULL_TREE, cat_name, initlist);
- initlist = tree_cons (NULL_TREE, class_name, initlist);
-
- if (!instance_methods)
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- {
- expr = build_unary_op (ADDR_EXPR, instance_methods, 0);
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
- if (!class_methods)
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- {
- expr = build_unary_op (ADDR_EXPR, class_methods, 0);
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
-
- /* protocol_list = */
- if (!protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- {
- static tree cast_type2;
-
- if (!cast_type2)
- cast_type2
- = groktypename
- (build_tree_list
- (build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_PROTOCOL))),
- build1 (INDIRECT_REF, NULL_TREE,
- build1 (INDIRECT_REF, NULL_TREE, NULL_TREE))));
-
- expr = build_unary_op (ADDR_EXPR, protocol_list, 0);
- TREE_TYPE (expr) = cast_type2;
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
-
- return build_constructor (type, nreverse (initlist));
-}
-
-/* struct objc_class {
- struct objc_class *isa;
- struct objc_class *super_class;
- char *name;
- long version;
- long info;
- long instance_size;
- struct objc_ivar_list *ivars;
- struct objc_method_list *methods;
- if (flag_next_runtime)
- struct objc_cache *cache;
- else {
- struct sarray *dtable;
- struct objc_class *subclass_list;
- struct objc_class *sibling_class;
- }
- struct objc_protocol_list *protocols;
- }; */
-
-static tree
-build_shared_structure_initializer (type, isa, super, name, size, status,
- dispatch_table, ivar_list, protocol_list)
- tree type;
- tree isa;
- tree super;
- tree name;
- tree size;
- int status;
- tree dispatch_table;
- tree ivar_list;
- tree protocol_list;
-{
- tree initlist = NULL_TREE, expr;
-
- /* isa = */
- initlist = tree_cons (NULL_TREE, isa, initlist);
-
- /* super_class = */
- initlist = tree_cons (NULL_TREE, super, initlist);
-
- /* name = */
- initlist = tree_cons (NULL_TREE, default_conversion (name), initlist);
-
- /* version = */
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
-
- /* info = */
- initlist = tree_cons (NULL_TREE, build_int_2 (status, 0), initlist);
-
- /* instance_size = */
- initlist = tree_cons (NULL_TREE, size, initlist);
-
- /* objc_ivar_list = */
- if (!ivar_list)
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- {
- expr = build_unary_op (ADDR_EXPR, ivar_list, 0);
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
-
- /* objc_method_list = */
- if (!dispatch_table)
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- {
- expr = build_unary_op (ADDR_EXPR, dispatch_table, 0);
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
-
- if (flag_next_runtime)
- /* method_cache = */
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- {
- /* dtable = */
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
-
- /* subclass_list = */
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
-
- /* sibling_class = */
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- }
-
- /* protocol_list = */
- if (! protocol_list)
- initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist);
- else
- {
- static tree cast_type2;
-
- if (!cast_type2)
- cast_type2
- = groktypename
- (build_tree_list
- (build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (UTAG_PROTOCOL))),
- build1 (INDIRECT_REF, NULL_TREE,
- build1 (INDIRECT_REF, NULL_TREE, NULL_TREE))));
-
- expr = build_unary_op (ADDR_EXPR, protocol_list, 0);
- TREE_TYPE (expr) = cast_type2;
- initlist = tree_cons (NULL_TREE, expr, initlist);
- }
-
- return build_constructor (type, nreverse (initlist));
-}
-
-/* static struct objc_category _OBJC_CATEGORY_<name> = { ... }; */
-
-static void
-generate_category (cat)
- tree cat;
-{
- tree sc_spec, decl_specs, decl;
- tree initlist, cat_name_expr, class_name_expr;
- tree protocol_decl, category;
-
- add_class_reference (CLASS_NAME (cat));
- cat_name_expr = add_objc_string (CLASS_SUPER_NAME (cat), class_names);
-
- class_name_expr = add_objc_string (CLASS_NAME (cat), class_names);
-
- category = CLASS_CATEGORY_LIST (implementation_template);
-
- /* find the category interface from the class it is associated with */
- while (category)
- {
- if (CLASS_SUPER_NAME (cat) == CLASS_SUPER_NAME (category))
- break;
- category = CLASS_CATEGORY_LIST (category);
- }
-
- if (category && CLASS_PROTOCOL_LIST (category))
- {
- generate_protocol_references (CLASS_PROTOCOL_LIST (category));
- protocol_decl = generate_protocol_list (category);
- }
- else
- protocol_decl = 0;
-
- sc_spec = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC], NULL_TREE);
- decl_specs = tree_cons (NULL_TREE, objc_category_template, sc_spec);
-
- decl = start_decl (synth_id_with_class_suffix ("_OBJC_CATEGORY",
- implementation_context),
- decl_specs, 1, NULL_TREE, NULL_TREE);
-
- initlist = build_category_initializer (TREE_TYPE (decl),
- cat_name_expr, class_name_expr,
- UOBJC_INSTANCE_METHODS_decl,
- UOBJC_CLASS_METHODS_decl,
- protocol_decl);
-
- TREE_USED (decl) = 1;
- finish_decl (decl, initlist, NULL_TREE);
-}
-
-/* static struct objc_class _OBJC_METACLASS_Foo={ ... };
- static struct objc_class _OBJC_CLASS_Foo={ ... }; */
-
-static void
-generate_shared_structures ()
-{
- tree sc_spec, decl_specs, decl;
- tree name_expr, super_expr, root_expr;
- tree my_root_id = NULL_TREE, my_super_id = NULL_TREE;
- tree cast_type, initlist, protocol_decl;
-
- my_super_id = CLASS_SUPER_NAME (implementation_template);
- if (my_super_id)
- {
- add_class_reference (my_super_id);
-
- /* Compute "my_root_id" - this is required for code generation.
- the "isa" for all meta class structures points to the root of
- the inheritance hierarchy (e.g. "__Object")... */
- my_root_id = my_super_id;
- do
- {
- tree my_root_int = lookup_interface (my_root_id);
-
- if (my_root_int && CLASS_SUPER_NAME (my_root_int))
- my_root_id = CLASS_SUPER_NAME (my_root_int);
- else
- break;
- }
- while (1);
- }
- else
- /* No super class. */
- my_root_id = CLASS_NAME (implementation_template);
-
- cast_type
- = groktypename (build_tree_list (build_tree_list (NULL_TREE,
- objc_class_template),
- build1 (INDIRECT_REF,
- NULL_TREE, NULL_TREE)));
-
- name_expr = add_objc_string (CLASS_NAME (implementation_template),
- class_names);
-
- /* Install class `isa' and `super' pointers at runtime. */
- if (my_super_id)
- {
- super_expr = add_objc_string (my_super_id, class_names);
- super_expr = build_c_cast (cast_type, super_expr); /* cast! */
- }
- else
- super_expr = build_int_2 (0, 0);
-
- root_expr = add_objc_string (my_root_id, class_names);
- root_expr = build_c_cast (cast_type, root_expr); /* cast! */
-
- if (CLASS_PROTOCOL_LIST (implementation_template))
- {
- generate_protocol_references
- (CLASS_PROTOCOL_LIST (implementation_template));
- protocol_decl = generate_protocol_list (implementation_template);
- }
- else
- protocol_decl = 0;
-
- /* static struct objc_class _OBJC_METACLASS_Foo = { ... }; */
-
- sc_spec = build_tree_list (NULL_TREE, ridpointers[(int) RID_STATIC]);
- decl_specs = tree_cons (NULL_TREE, objc_class_template, sc_spec);
-
- decl = start_decl (DECL_NAME (UOBJC_METACLASS_decl), decl_specs, 1,
- NULL_TREE, NULL_TREE);
-
- initlist
- = build_shared_structure_initializer
- (TREE_TYPE (decl),
- root_expr, super_expr, name_expr,
- build_int_2 ((TREE_INT_CST_LOW (TYPE_SIZE (objc_class_template))
- / BITS_PER_UNIT),
- 0),
- 2 /*CLS_META*/,
- UOBJC_CLASS_METHODS_decl,
- UOBJC_CLASS_VARIABLES_decl,
- protocol_decl);
-
- finish_decl (decl, initlist, NULL_TREE);
-
- /* static struct objc_class _OBJC_CLASS_Foo={ ... }; */
-
- decl = start_decl (DECL_NAME (UOBJC_CLASS_decl), decl_specs, 1,
- NULL_TREE, NULL_TREE);
-
- initlist
- = build_shared_structure_initializer
- (TREE_TYPE (decl),
- build_unary_op (ADDR_EXPR, UOBJC_METACLASS_decl, 0),
- super_expr, name_expr,
- build_int_2
- ((TREE_INT_CST_LOW
- (TYPE_SIZE (CLASS_STATIC_TEMPLATE (implementation_template)))
- / BITS_PER_UNIT),
- 0),
- 1 /*CLS_FACTORY*/,
- UOBJC_INSTANCE_METHODS_decl,
- UOBJC_INSTANCE_VARIABLES_decl,
- protocol_decl);
-
- finish_decl (decl, initlist, NULL_TREE);
-}
-
-static tree
-synth_id_with_class_suffix (preamble, ctxt)
- char *preamble;
- tree ctxt;
-{
- char *string;
- if (TREE_CODE (ctxt) == CLASS_IMPLEMENTATION_TYPE
- || TREE_CODE (ctxt) == CLASS_INTERFACE_TYPE)
- {
- char *class_name
- = IDENTIFIER_POINTER (CLASS_NAME (implementation_context));
- string = (char *) alloca (strlen (preamble) + strlen (class_name) + 3);
- sprintf (string, "%s_%s", preamble,
- IDENTIFIER_POINTER (CLASS_NAME (ctxt)));
- }
- else if (TREE_CODE (ctxt) == CATEGORY_IMPLEMENTATION_TYPE
- || TREE_CODE (ctxt) == CATEGORY_INTERFACE_TYPE)
- {
- /* We have a category. */
- char *class_name
- = IDENTIFIER_POINTER (CLASS_NAME (implementation_context));
- char *class_super_name
- = IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_context));
- string = (char *) alloca (strlen (preamble)
- + strlen (class_name)
- + strlen (class_super_name)
- + 3);
- sprintf (string, "%s_%s_%s", preamble, class_name, class_super_name);
- }
- else if (TREE_CODE (ctxt) == PROTOCOL_INTERFACE_TYPE)
- {
- char *protocol_name = IDENTIFIER_POINTER (PROTOCOL_NAME (ctxt));
- string
- = (char *) alloca (strlen (preamble) + strlen (protocol_name) + 3);
- sprintf (string, "%s_%s", preamble, protocol_name);
- }
- return get_identifier (string);
-}
-
-static int
-is_objc_type_qualifier (node)
- tree node;
-{
- return (TREE_CODE (node) == IDENTIFIER_NODE
- && (node == ridpointers [(int) RID_CONST]
- || node == ridpointers [(int) RID_VOLATILE]
- || node == ridpointers [(int) RID_IN]
- || node == ridpointers [(int) RID_OUT]
- || node == ridpointers [(int) RID_INOUT]
- || node == ridpointers [(int) RID_BYCOPY]
- || node == ridpointers [(int) RID_ONEWAY]));
-}
-
-/* If type is empty or only type qualifiers are present, add default
- type of id (otherwise grokdeclarator will default to int). */
-
-static tree
-adjust_type_for_id_default (type)
- tree type;
-{
- tree declspecs, chain;
-
- if (!type)
- return build_tree_list (build_tree_list (NULL_TREE, objc_object_reference),
- build1 (INDIRECT_REF, NULL_TREE, NULL_TREE));
-
- declspecs = TREE_PURPOSE (type);
-
- /* Determine if a typespec is present. */
- for (chain = declspecs;
- chain;
- chain = TREE_CHAIN (chain))
- {
- if (!is_objc_type_qualifier (TREE_VALUE (chain)))
- return type;
- }
-
- return build_tree_list (tree_cons (NULL_TREE, objc_object_reference,
- declspecs),
- build1 (INDIRECT_REF, NULL_TREE, NULL_TREE));
-}
-
-/* Usage:
- keyworddecl:
- selector ':' '(' typename ')' identifier
-
- Purpose:
- Transform an Objective-C keyword argument into
- the C equivalent parameter declarator.
-
- In: key_name, an "identifier_node" (optional).
- arg_type, a "tree_list" (optional).
- arg_name, an "identifier_node".
-
- Note: It would be really nice to strongly type the preceding
- arguments in the function prototype; however, then I
- could not use the "accessor" macros defined in "tree.h".
-
- Out: an instance of "keyword_decl". */
-
-tree
-build_keyword_decl (key_name, arg_type, arg_name)
- tree key_name;
- tree arg_type;
- tree arg_name;
-{
- tree keyword_decl;
-
- /* If no type is specified, default to "id". */
- arg_type = adjust_type_for_id_default (arg_type);
-
- keyword_decl = make_node (KEYWORD_DECL);
-
- TREE_TYPE (keyword_decl) = arg_type;
- KEYWORD_ARG_NAME (keyword_decl) = arg_name;
- KEYWORD_KEY_NAME (keyword_decl) = key_name;
-
- return keyword_decl;
-}
-
-/* Given a chain of keyword_decl's, synthesize the full keyword selector. */
-
-static tree
-build_keyword_selector (selector)
- tree selector;
-{
- int len = 0;
- tree key_chain, key_name;
- char *buf;
-
- for (key_chain = selector; key_chain; key_chain = TREE_CHAIN (key_chain))
- {
- if (TREE_CODE (selector) == KEYWORD_DECL)
- key_name = KEYWORD_KEY_NAME (key_chain);
- else if (TREE_CODE (selector) == TREE_LIST)
- key_name = TREE_PURPOSE (key_chain);
-
- if (key_name)
- len += IDENTIFIER_LENGTH (key_name) + 1;
- else
- /* Just a ':' arg. */
- len++;
- }
-
- buf = (char *)alloca (len + 1);
- bzero (buf, len + 1);
-
- for (key_chain = selector; key_chain; key_chain = TREE_CHAIN (key_chain))
- {
- if (TREE_CODE (selector) == KEYWORD_DECL)
- key_name = KEYWORD_KEY_NAME (key_chain);
- else if (TREE_CODE (selector) == TREE_LIST)
- key_name = TREE_PURPOSE (key_chain);
-
- if (key_name)
- strcat (buf, IDENTIFIER_POINTER (key_name));
- strcat (buf, ":");
- }
-
- return get_identifier (buf);
-}
-
-/* Used for declarations and definitions. */
-
-tree
-build_method_decl (code, ret_type, selector, add_args)
- enum tree_code code;
- tree ret_type;
- tree selector;
- tree add_args;
-{
- tree method_decl;
-
- /* If no type is specified, default to "id". */
- ret_type = adjust_type_for_id_default (ret_type);
-
- method_decl = make_node (code);
- TREE_TYPE (method_decl) = ret_type;
-
- /* If we have a keyword selector, create an identifier_node that
- represents the full selector name (`:' included)... */
- if (TREE_CODE (selector) == KEYWORD_DECL)
- {
- METHOD_SEL_NAME (method_decl) = build_keyword_selector (selector);
- METHOD_SEL_ARGS (method_decl) = selector;
- METHOD_ADD_ARGS (method_decl) = add_args;
- }
- else
- {
- METHOD_SEL_NAME (method_decl) = selector;
- METHOD_SEL_ARGS (method_decl) = NULL_TREE;
- METHOD_ADD_ARGS (method_decl) = NULL_TREE;
- }
-
- return method_decl;
-}
-
-#define METHOD_DEF 0
-#define METHOD_REF 1
-
-/* Used by `build_message_expr' and `comp_method_types'. Return an
- argument list for method METH. CONTEXT is either METHOD_DEF or
- METHOD_REF, saying whether we are trying to define a method or call
- one. SUPERFLAG says this is for a send to super; this makes a
- difference for the NeXT calling sequence in which the lookup and
- the method call are done together. */
-
-static tree
-get_arg_type_list (meth, context, superflag)
- tree meth;
- int context;
- int superflag;
-{
- tree arglist, akey;
-
- /* Receiver type. */
- if (flag_next_runtime && superflag)
- arglist = build_tree_list (NULL_TREE, super_type);
- else if (context == METHOD_DEF)
- arglist = build_tree_list (NULL_TREE, TREE_TYPE (self_decl));
- else
- arglist = build_tree_list (NULL_TREE, id_type);
-
- /* Selector type - will eventually change to `int'. */
- chainon (arglist, build_tree_list (NULL_TREE, selector_type));
-
- /* Build a list of argument types. */
- for (akey = METHOD_SEL_ARGS (meth); akey; akey = TREE_CHAIN (akey))
- {
- tree arg_decl = groktypename_in_parm_context (TREE_TYPE (akey));
- chainon (arglist, build_tree_list (NULL_TREE, TREE_TYPE (arg_decl)));
- }
-
- if (METHOD_ADD_ARGS (meth) == (tree)1)
- /* We have a `, ...' immediately following the selector,
- finalize the arglist...simulate get_parm_info (0). */
- ;
- else if (METHOD_ADD_ARGS (meth))
- {
- /* we have a variable length selector */
- tree add_arg_list = TREE_CHAIN (METHOD_ADD_ARGS (meth));
- chainon (arglist, add_arg_list);
- }
- else
- /* finalize the arglist...simulate get_parm_info (1) */
- chainon (arglist, build_tree_list (NULL_TREE, void_type_node));
-
- return arglist;
-}
-
-static tree
-check_duplicates (hsh)
- hash hsh;
-{
- tree meth = NULL_TREE;
-
- if (hsh)
- {
- meth = hsh->key;
-
- if (hsh->list)
- {
- /* We have two methods with the same name and different types. */
- attr loop;
- char type = (TREE_CODE (meth) == INSTANCE_METHOD_DECL) ? '-' : '+';
-
- warning ("multiple declarations for method `%s'",
- IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
-
- warn_with_method ("using", type, meth);
- for (loop = hsh->list; loop; loop = loop->next)
- warn_with_method ("also found", type, loop->value);
- }
- }
- return meth;
-}
-
-/* If RECEIVER is a class reference, return the identifier node for the
- referenced class. RECEIVER is created by get_class_reference, so we
- check the exact form created depending on which runtimes are used. */
-
-static tree
-receiver_is_class_object (receiver)
- tree receiver;
-{
- tree chain, exp, arg;
- if (flag_next_runtime)
- {
- /* The receiver is a variable created by build_class_reference_decl. */
- if (TREE_CODE (receiver) == VAR_DECL
- && TREE_TYPE (receiver) == objc_class_type)
- /* Look up the identifier. */
- for (chain = cls_ref_chain; chain; chain = TREE_CHAIN (chain))
- if (TREE_PURPOSE (chain) == receiver)
- return TREE_VALUE (chain);
- }
- else
- {
- /* The receiver is a function call that returns an id. Check if
- it is a call to objc_getClass, if so, pick up the class name. */
- if ((exp = TREE_OPERAND (receiver, 0))
- && TREE_CODE (exp) == ADDR_EXPR
- && (exp = TREE_OPERAND (exp, 0))
- && TREE_CODE (exp) == FUNCTION_DECL
- && exp == objc_get_class_decl
- /* we have a call to objc_getClass! */
- && (arg = TREE_OPERAND (receiver, 1))
- && TREE_CODE (arg) == TREE_LIST
- && (arg = TREE_VALUE (arg)))
- {
- STRIP_NOPS (arg);
- if (TREE_CODE (arg) == ADDR_EXPR
- && (arg = TREE_OPERAND (arg, 0))
- && TREE_CODE (arg) == STRING_CST)
- /* Finally, we have the class name. */
- return get_identifier (TREE_STRING_POINTER (arg));
- }
- }
- return 0;
-}
-
-/* If we are currently building a message expr, this holds
- the identifier of the selector of the message. This is
- used when printing warnings about argument mismatches. */
-
-static tree building_objc_message_expr = 0;
-
-tree
-maybe_building_objc_message_expr ()
-{
- return building_objc_message_expr;
-}
-
-/* Construct an expression for sending a message.
- MESS has the object to send to in TREE_PURPOSE
- and the argument list (including selector) in TREE_VALUE.
-
- (*(<abstract_decl>(*)())_msg)(receiver, selTransTbl[n], ...);
- (*(<abstract_decl>(*)())_msgSuper)(receiver, selTransTbl[n], ...); */
-
-tree
-build_message_expr (mess)
- tree mess;
-{
- tree receiver = TREE_PURPOSE (mess);
- tree selector, self_object;
- tree rtype, sel_name;
- tree args = TREE_VALUE (mess);
- tree method_params = NULL_TREE;
- tree method_prototype = NULL_TREE;
- tree retval;
- int statically_typed = 0, statically_allocated = 0;
- tree class_ident = 0;
-
- /* 1 if this is sending to the superclass. */
- int super;
-
- if (!doing_objc_thang)
- objc_fatal ();
-
- if (TREE_CODE (receiver) == ERROR_MARK)
- return error_mark_node;
-
- /* Determine receiver type. */
- rtype = TREE_TYPE (receiver);
- super = IS_SUPER (rtype);
-
- if (! super)
- {
- if (TREE_STATIC_TEMPLATE (rtype))
- statically_allocated = 1;
- else if (TREE_CODE (rtype) == POINTER_TYPE
- && TREE_STATIC_TEMPLATE (TREE_TYPE (rtype)))
- statically_typed = 1;
- else if ((flag_next_runtime
- || (TREE_CODE (receiver) == CALL_EXPR && IS_ID (rtype)))
- && (class_ident = receiver_is_class_object (receiver)))
- ;
- else if (! IS_ID (rtype)
- /* Allow any type that matches objc_class_type. */
- && ! comptypes (rtype, objc_class_type))
- {
- bzero (errbuf, BUFSIZE);
- warning ("invalid receiver type `%s'",
- gen_declaration (rtype, errbuf));
- }
-
- if (statically_allocated)
- receiver = build_unary_op (ADDR_EXPR, receiver, 0);
-
- /* Don't evaluate the receiver twice. */
- receiver = save_expr (receiver);
- self_object = receiver;
- }
- else
- /* If sending to `super', use current self as the object. */
- self_object = self_decl;
-
- /* Obtain the full selector name. */
-
- if (TREE_CODE (args) == IDENTIFIER_NODE)
- /* A unary selector. */
- sel_name = args;
- else if (TREE_CODE (args) == TREE_LIST)
- sel_name = build_keyword_selector (args);
-
- /* Build the parameter list to give to the method. */
-
- method_params = NULL_TREE;
- if (TREE_CODE (args) == TREE_LIST)
- {
- tree chain = args, prev = NULL_TREE;
-
- /* We have a keyword selector--check for comma expressions. */
- while (chain)
- {
- tree element = TREE_VALUE (chain);
-
- /* We have a comma expression, must collapse... */
- if (TREE_CODE (element) == TREE_LIST)
- {
- if (prev)
- TREE_CHAIN (prev) = element;
- else
- args = element;
- }
- prev = chain;
- chain = TREE_CHAIN (chain);
- }
- method_params = args;
- }
-
- /* Determine operation return type. */
-
- if (IS_SUPER (rtype))
- {
- tree iface;
-
- if (CLASS_SUPER_NAME (implementation_template))
- {
- iface
- = lookup_interface (CLASS_SUPER_NAME (implementation_template));
-
- if (TREE_CODE (method_context) == INSTANCE_METHOD_DECL)
- method_prototype = lookup_instance_method_static (iface, sel_name);
- else
- method_prototype = lookup_class_method_static (iface, sel_name);
-
- if (iface && !method_prototype)
- warning ("`%s' does not respond to `%s'",
- IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_template)),
- IDENTIFIER_POINTER (sel_name));
- }
- else
- {
- error ("no super class declared in interface for `%s'",
- IDENTIFIER_POINTER (CLASS_NAME (implementation_template)));
- return error_mark_node;
- }
-
- }
- else if (statically_allocated)
- {
- tree ctype = TREE_TYPE (rtype);
- tree iface = lookup_interface (TYPE_NAME (rtype));
-
- if (iface)
- method_prototype = lookup_instance_method_static (iface, sel_name);
-
- if (! method_prototype && TYPE_PROTOCOL_LIST (ctype))
- method_prototype
- = lookup_method_in_protocol_list (TYPE_PROTOCOL_LIST (ctype),
- sel_name, 0);
-
- if (!method_prototype)
- warning ("`%s' does not respond to `%s'",
- IDENTIFIER_POINTER (TYPE_NAME (rtype)),
- IDENTIFIER_POINTER (sel_name));
- }
- else if (statically_typed)
- {
- tree ctype = TREE_TYPE (rtype);
-
- /* `self' is now statically_typed. All methods should be visible
- within the context of the implementation. */
- if (implementation_context
- && CLASS_NAME (implementation_context) == TYPE_NAME (ctype))
- {
- method_prototype
- = lookup_instance_method_static (implementation_template,
- sel_name);
-
- if (! method_prototype && TYPE_PROTOCOL_LIST (ctype))
- method_prototype
- = lookup_method_in_protocol_list (TYPE_PROTOCOL_LIST (ctype),
- sel_name, 0);
-
- if (! method_prototype
- && implementation_template != implementation_context)
- /* The method is not published in the interface. Check
- locally. */
- method_prototype
- = lookup_method (CLASS_NST_METHODS (implementation_context),
- sel_name);
- }
- else
- {
- tree iface;
-
- if ((iface = lookup_interface (TYPE_NAME (ctype))))
- method_prototype = lookup_instance_method_static (iface, sel_name);
-
- if (! method_prototype)
- {
- tree protocol_list = TYPE_PROTOCOL_LIST (ctype);
- if (protocol_list)
- method_prototype
- = lookup_method_in_protocol_list (protocol_list,
- sel_name, 0);
- }
- }
-
- if (!method_prototype)
- warning ("`%s' does not respond to `%s'",
- IDENTIFIER_POINTER (TYPE_NAME (ctype)),
- IDENTIFIER_POINTER (sel_name));
- }
- else if (class_ident)
- {
- if (implementation_context
- && CLASS_NAME (implementation_context) == class_ident)
- {
- method_prototype
- = lookup_class_method_static (implementation_template, sel_name);
-
- if (!method_prototype
- && implementation_template != implementation_context)
- /* The method is not published in the interface. Check
- locally. */
- method_prototype
- = lookup_method (CLASS_CLS_METHODS (implementation_context),
- sel_name);
- }
- else
- {
- tree iface;
-
- if ((iface = lookup_interface (class_ident)))
- method_prototype = lookup_class_method_static (iface, sel_name);
- }
-
- if (!method_prototype)
- {
- warning ("cannot find class (factory) method.");
- warning ("return type for `%s' defaults to id",
- IDENTIFIER_POINTER (sel_name));
- }
- }
- else if (IS_PROTOCOL_QUALIFIED_ID (rtype))
- {
- /* An anonymous object that has been qualified with a protocol. */
-
- tree protocol_list = TYPE_PROTOCOL_LIST (rtype);
-
- method_prototype = lookup_method_in_protocol_list (protocol_list,
- sel_name, 0);
-
- if (!method_prototype)
- {
- hash hsh;
-
- warning ("method `%s' not implemented by protocol.",
- IDENTIFIER_POINTER (sel_name));
-
- /* Try and find the method signature in the global pools. */
-
- if (!(hsh = hash_lookup (nst_method_hash_list, sel_name)))
- hsh = hash_lookup (cls_method_hash_list, sel_name);
-
- if (!(method_prototype = check_duplicates (hsh)))
- warning ("return type defaults to id");
- }
- }
- else
- {
- hash hsh;
-
- /* We think we have an instance...loophole: extern id Object; */
- hsh = hash_lookup (nst_method_hash_list, sel_name);
- if (!hsh)
- /* For various loopholes, like sending messages to self in a
- factory context. */
- hsh = hash_lookup (cls_method_hash_list, sel_name);
-
- method_prototype = check_duplicates (hsh);
- if (!method_prototype)
- {
- warning ("cannot find method.");
- warning ("return type for `%s' defaults to id",
- IDENTIFIER_POINTER (sel_name));
- }
- }
-
- /* Save the selector name for printing error messages. */
- building_objc_message_expr = sel_name;
-
- /* Build the parameters list for looking up the method.
- These are the object itself and the selector. */
-
- if (flag_typed_selectors)
- selector = build_typed_selector_reference (sel_name, method_prototype);
- else
- selector = build_selector_reference (sel_name);
-
- retval = build_objc_method_call (super, method_prototype,
- receiver, self_object,
- selector, method_params);
-
- building_objc_message_expr = 0;
-
- return retval;
-}
-
-/* Build a tree expression to send OBJECT the operation SELECTOR,
- looking up the method on object LOOKUP_OBJECT (often same as OBJECT),
- assuming the method has prototype METHOD_PROTOTYPE.
- (That is an INSTANCE_METHOD_DECL or CLASS_METHOD_DECL.)
- Use METHOD_PARAMS as list of args to pass to the method.
- If SUPER_FLAG is nonzero, we look up the superclass's method. */
-
-static tree
-build_objc_method_call (super_flag, method_prototype, lookup_object, object,
- selector, method_params)
- int super_flag;
- tree method_prototype, lookup_object, object, selector, method_params;
-{
- tree sender = (super_flag ? umsg_super_decl : umsg_decl);
- tree rcv_p = (super_flag
- ? build_pointer_type (xref_tag (RECORD_TYPE,
- get_identifier (TAG_SUPER)))
- : id_type);
-
- if (flag_next_runtime)
- {
- if (! method_prototype)
- {
- method_params = tree_cons (NULL_TREE, lookup_object,
- tree_cons (NULL_TREE, selector,
- method_params));
- assemble_external (sender);
- return build_function_call (sender, method_params);
- }
- else
- {
- /* This is a real kludge, but it is used only for the Next.
- Clobber the data type of SENDER temporarily to accept
- all the arguments for this operation, and to return
- whatever this operation returns. */
- tree arglist = NULL_TREE;
- tree retval;
-
- /* Save the proper contents of SENDER's data type. */
- tree savarg = TYPE_ARG_TYPES (TREE_TYPE (sender));
- tree savret = TREE_TYPE (TREE_TYPE (sender));
-
- /* Install this method's argument types. */
- arglist = get_arg_type_list (method_prototype, METHOD_REF,
- super_flag);
- TYPE_ARG_TYPES (TREE_TYPE (sender)) = arglist;
-
- /* Install this method's return type. */
- TREE_TYPE (TREE_TYPE (sender))
- = groktypename (TREE_TYPE (method_prototype));
-
- /* Call SENDER with all the parameters. This will do type
- checking using the arg types for this method. */
- method_params = tree_cons (NULL_TREE, lookup_object,
- tree_cons (NULL_TREE, selector,
- method_params));
- assemble_external (sender);
- retval = build_function_call (sender, method_params);
-
- /* Restore SENDER's return/argument types. */
- TYPE_ARG_TYPES (TREE_TYPE (sender)) = savarg;
- TREE_TYPE (TREE_TYPE (sender)) = savret;
- return retval;
- }
- }
- else
- {
- /* This is the portable way.
- First call the lookup function to get a pointer to the method,
- then cast the pointer, then call it with the method arguments. */
- tree method;
-
- /* Avoid trouble since we may evaluate each of these twice. */
- object = save_expr (object);
- selector = save_expr (selector);
-
- lookup_object = build_c_cast (rcv_p, lookup_object);
-
- assemble_external (sender);
- method
- = build_function_call (sender,
- tree_cons (NULL_TREE, lookup_object,
- tree_cons (NULL_TREE, selector,
- NULL_TREE)));
-
- /* If we have a method prototype, construct the data type this
- method needs, and cast what we got from SENDER into a pointer
- to that type. */
- if (method_prototype)
- {
- tree arglist = get_arg_type_list (method_prototype, METHOD_REF,
- super_flag);
- tree valtype = groktypename (TREE_TYPE (method_prototype));
- tree fake_function_type = build_function_type (valtype, arglist);
- TREE_TYPE (method) = build_pointer_type (fake_function_type);
- }
- else
- TREE_TYPE (method)
- = build_pointer_type (build_function_type (ptr_type_node, NULL_TREE));
-
- /* Pass the object to the method. */
- assemble_external (method);
- return build_function_call (method,
- tree_cons (NULL_TREE, object,
- tree_cons (NULL_TREE, selector,
- method_params)));
- }
-}
-
-static void
-build_protocol_reference (p)
- tree p;
-{
- tree decl, ident, ptype;
-
- push_obstacks_nochange ();
- end_temporary_allocation ();
-
- /* extern struct objc_protocol _OBJC_PROTOCOL_<mumble>; */
-
- ident = synth_id_with_class_suffix ("_OBJC_PROTOCOL", p);
- ptype
- = groktypename (build_tree_list (build_tree_list (NULL_TREE,
- objc_protocol_template),
- NULL_TREE));
-
- if (IDENTIFIER_GLOBAL_VALUE (ident))
- decl = IDENTIFIER_GLOBAL_VALUE (ident); /* Set by pushdecl. */
- else
- {
- decl = build_decl (VAR_DECL, ident, ptype);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- TREE_USED (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
-
- make_decl_rtl (decl, 0, 1);
- pushdecl_top_level (decl);
- }
-
- PROTOCOL_FORWARD_DECL (p) = decl;
- pop_obstacks ();
-}
-
-tree
-build_protocol_expr (protoname)
- tree protoname;
-{
- tree expr;
- tree p;
-
- if (!doing_objc_thang)
- objc_fatal ();
-
- p = lookup_protocol (protoname);
-
- if (!p)
- {
- error ("Cannot find protocol declaration for `%s'",
- IDENTIFIER_POINTER (protoname));
- return error_mark_node;
- }
-
- if (!PROTOCOL_FORWARD_DECL (p))
- build_protocol_reference (p);
-
- expr = build_unary_op (ADDR_EXPR, PROTOCOL_FORWARD_DECL (p), 0);
-
- TREE_TYPE (expr) = protocol_type;
-
- return expr;
-}
-
-tree
-build_selector_expr (selnamelist)
- tree selnamelist;
-{
- tree selname;
-
- if (!doing_objc_thang)
- objc_fatal ();
-
- /* Obtain the full selector name. */
- if (TREE_CODE (selnamelist) == IDENTIFIER_NODE)
- /* A unary selector. */
- selname = selnamelist;
- else if (TREE_CODE (selnamelist) == TREE_LIST)
- selname = build_keyword_selector (selnamelist);
-
- if (flag_typed_selectors)
- return build_typed_selector_reference (selname, 0);
- else
- return build_selector_reference (selname);
-}
-
-tree
-build_encode_expr (type)
- tree type;
-{
- tree result;
- char *string;
-
- if (!doing_objc_thang)
- objc_fatal ();
-
- encode_type (type, obstack_object_size (&util_obstack),
- OBJC_ENCODE_INLINE_DEFS);
- obstack_1grow (&util_obstack, 0); /* null terminate string */
- string = obstack_finish (&util_obstack);
-
- /* Synthesize a string that represents the encoded struct/union. */
- result = my_build_string (strlen (string) + 1, string);
- obstack_free (&util_obstack, util_firstobj);
- return result;
-}
-
-tree
-build_ivar_reference (id)
- tree id;
-{
- if (TREE_CODE (method_context) == CLASS_METHOD_DECL)
- {
- /* Historically, a class method that produced objects (factory
- method) would assign `self' to the instance that it
- allocated. This would effectively turn the class method into
- an instance method. Following this assignment, the instance
- variables could be accessed. That practice, while safe,
- violates the simple rule that a class method should not refer
- to an instance variable. It's better to catch the cases
- where this is done unknowingly than to support the above
- paradigm. */
- warning ("instance variable `%s' accessed in class method",
- IDENTIFIER_POINTER (id));
- TREE_TYPE (self_decl) = instance_type; /* cast */
- }
-
- return build_component_ref (build_indirect_ref (self_decl, "->"), id);
-}
-
-#define HASH_ALLOC_LIST_SIZE 170
-#define ATTR_ALLOC_LIST_SIZE 170
-#define SIZEHASHTABLE 257
-
-/* make positive */
-#define HASHFUNCTION(key) ((HOST_WIDE_INT) key & 0x7fffffff)
-
-static void
-hash_init ()
-{
- nst_method_hash_list = (hash *)xmalloc (SIZEHASHTABLE * sizeof (hash));
- cls_method_hash_list = (hash *)xmalloc (SIZEHASHTABLE * sizeof (hash));
-
- if (!nst_method_hash_list || !cls_method_hash_list)
- perror ("unable to allocate space in objc-tree.c");
- else
- {
- int i;
-
- for (i = 0; i < SIZEHASHTABLE; i++)
- {
- nst_method_hash_list[i] = 0;
- cls_method_hash_list[i] = 0;
- }
- }
-}
-
-static void
-hash_enter (hashlist, method)
- hash *hashlist;
- tree method;
-{
- static hash hash_alloc_list = 0;
- static int hash_alloc_index = 0;
- hash obj;
- int slot = HASHFUNCTION (METHOD_SEL_NAME (method)) % SIZEHASHTABLE;
-
- if (! hash_alloc_list || hash_alloc_index >= HASH_ALLOC_LIST_SIZE)
- {
- hash_alloc_index = 0;
- hash_alloc_list = (hash) xmalloc (sizeof (struct hashed_entry)
- * HASH_ALLOC_LIST_SIZE);
- if (! hash_alloc_list)
- perror ("unable to allocate in objc-tree.c");
- }
- obj = &hash_alloc_list[hash_alloc_index++];
- obj->list = 0;
- obj->next = hashlist[slot];
- obj->key = method;
-
- hashlist[slot] = obj; /* append to front */
-}
-
-static hash
-hash_lookup (hashlist, sel_name)
- hash *hashlist;
- tree sel_name;
-{
- hash target;
-
- target = hashlist[HASHFUNCTION (sel_name) % SIZEHASHTABLE];
-
- while (target)
- {
- if (sel_name == METHOD_SEL_NAME (target->key))
- return target;
-
- target = target->next;
- }
- return 0;
-}
-
-static void
-hash_add_attr (entry, value)
- hash entry;
- tree value;
-{
- static attr attr_alloc_list = 0;
- static int attr_alloc_index = 0;
- attr obj;
-
- if (! attr_alloc_list || attr_alloc_index >= ATTR_ALLOC_LIST_SIZE)
- {
- attr_alloc_index = 0;
- attr_alloc_list = (attr) xmalloc (sizeof (struct hashed_attribute)
- * ATTR_ALLOC_LIST_SIZE);
- if (! attr_alloc_list)
- perror ("unable to allocate in objc-tree.c");
- }
- obj = &attr_alloc_list[attr_alloc_index++];
- obj->next = entry->list;
- obj->value = value;
-
- entry->list = obj; /* append to front */
-}
-
-static tree
-lookup_method (mchain, method)
- tree mchain;
- tree method;
-{
- tree key;
-
- if (TREE_CODE (method) == IDENTIFIER_NODE)
- key = method;
- else
- key = METHOD_SEL_NAME (method);
-
- while (mchain)
- {
- if (METHOD_SEL_NAME (mchain) == key)
- return mchain;
- mchain = TREE_CHAIN (mchain);
- }
- return NULL_TREE;
-}
-
-static tree
-lookup_instance_method_static (interface, ident)
- tree interface;
- tree ident;
-{
- tree inter = interface;
- tree chain = CLASS_NST_METHODS (inter);
- tree meth = NULL_TREE;
-
- do
- {
- if ((meth = lookup_method (chain, ident)))
- return meth;
-
- if (CLASS_CATEGORY_LIST (inter))
- {
- tree category = CLASS_CATEGORY_LIST (inter);
- chain = CLASS_NST_METHODS (category);
-
- do
- {
- if ((meth = lookup_method (chain, ident)))
- return meth;
-
- /* Check for instance methods in protocols in categories. */
- if (CLASS_PROTOCOL_LIST (category))
- {
- if ((meth = (lookup_method_in_protocol_list
- (CLASS_PROTOCOL_LIST (category), ident, 0))))
- return meth;
- }
-
- if ((category = CLASS_CATEGORY_LIST (category)))
- chain = CLASS_NST_METHODS (category);
- }
- while (category);
- }
-
- if (CLASS_PROTOCOL_LIST (inter))
- {
- if ((meth = (lookup_method_in_protocol_list
- (CLASS_PROTOCOL_LIST (inter), ident, 0))))
- return meth;
- }
-
- if ((inter = lookup_interface (CLASS_SUPER_NAME (inter))))
- chain = CLASS_NST_METHODS (inter);
- }
- while (inter);
-
- return meth;
-}
-
-static tree
-lookup_class_method_static (interface, ident)
- tree interface;
- tree ident;
-{
- tree inter = interface;
- tree chain = CLASS_CLS_METHODS (inter);
- tree meth = NULL_TREE;
- tree root_inter = NULL_TREE;
-
- do
- {
- if ((meth = lookup_method (chain, ident)))
- return meth;
-
- if (CLASS_CATEGORY_LIST (inter))
- {
- tree category = CLASS_CATEGORY_LIST (inter);
- chain = CLASS_CLS_METHODS (category);
-
- do
- {
- if ((meth = lookup_method (chain, ident)))
- return meth;
-
- /* Check for class methods in protocols in categories. */
- if (CLASS_PROTOCOL_LIST (category))
- {
- if ((meth = (lookup_method_in_protocol_list
- (CLASS_PROTOCOL_LIST (category), ident, 1))))
- return meth;
- }
-
- if ((category = CLASS_CATEGORY_LIST (category)))
- chain = CLASS_CLS_METHODS (category);
- }
- while (category);
- }
-
- /* Check for class methods in protocols. */
- if (CLASS_PROTOCOL_LIST (inter))
- {
- if ((meth = (lookup_method_in_protocol_list
- (CLASS_PROTOCOL_LIST (inter), ident, 1))))
- return meth;
- }
-
- root_inter = inter;
- if ((inter = lookup_interface (CLASS_SUPER_NAME (inter))))
- chain = CLASS_CLS_METHODS (inter);
- }
- while (inter);
-
- /* Simulate wrap around. */
- return lookup_instance_method_static (root_inter, ident);
-}
-
-tree
-add_class_method (class, method)
- tree class;
- tree method;
-{
- tree mth;
- hash hsh;
-
- /* We will have allocated the method parameter declarations on the
- maybepermanent_obstack. Need to make sure they stick around! */
- preserve_data ();
-
- if (!(mth = lookup_method (CLASS_CLS_METHODS (class), method)))
- {
- /* put method on list in reverse order */
- TREE_CHAIN (method) = CLASS_CLS_METHODS (class);
- CLASS_CLS_METHODS (class) = method;
- }
- else
- {
- if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
- error ("duplicate definition of class method `%s'.",
- IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
- else
- {
- /* Check types; if different, complain. */
- if (!comp_proto_with_proto (method, mth))
- error ("duplicate declaration of class method `%s'.",
- IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
- }
- }
-
- if (!(hsh = hash_lookup (cls_method_hash_list, METHOD_SEL_NAME (method))))
- {
- /* Install on a global chain. */
- hash_enter (cls_method_hash_list, method);
- }
- else
- {
- /* Check types; if different, add to a list. */
- if (!comp_proto_with_proto (method, hsh->key))
- hash_add_attr (hsh, method);
- }
- return method;
-}
-
-tree
-add_instance_method (class, method)
- tree class;
- tree method;
-{
- tree mth;
- hash hsh;
-
- /* We will have allocated the method parameter declarations on the
- maybepermanent_obstack. Need to make sure they stick around! */
- preserve_data ();
-
- if (!(mth = lookup_method (CLASS_NST_METHODS (class), method)))
- {
- /* Put method on list in reverse order. */
- TREE_CHAIN (method) = CLASS_NST_METHODS (class);
- CLASS_NST_METHODS (class) = method;
- }
- else
- {
- if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
- error ("duplicate definition of instance method `%s'.",
- IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
- else
- {
- /* Check types; if different, complain. */
- if (!comp_proto_with_proto (method, mth))
- error ("duplicate declaration of instance method `%s'.",
- IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
- }
- }
-
- if (!(hsh = hash_lookup (nst_method_hash_list, METHOD_SEL_NAME (method))))
- {
- /* Install on a global chain. */
- hash_enter (nst_method_hash_list, method);
- }
- else
- {
- /* Check types; if different, add to a list. */
- if (!comp_proto_with_proto (method, hsh->key))
- hash_add_attr (hsh, method);
- }
- return method;
-}
-
-static tree
-add_class (class)
- tree class;
-{
- /* Put interfaces on list in reverse order. */
- TREE_CHAIN (class) = interface_chain;
- interface_chain = class;
- return interface_chain;
-}
-
-static void
-add_category (class, category)
- tree class;
- tree category;
-{
- /* Put categories on list in reverse order. */
- tree cat = CLASS_CATEGORY_LIST (class);
-
- while (cat)
- {
- if (CLASS_SUPER_NAME (cat) == CLASS_SUPER_NAME (category))
- warning ("duplicate interface declaration for category `%s(%s)'",
- IDENTIFIER_POINTER (CLASS_NAME (class)),
- IDENTIFIER_POINTER (CLASS_SUPER_NAME (category)));
- cat = CLASS_CATEGORY_LIST (cat);
- }
-
- CLASS_CATEGORY_LIST (category) = CLASS_CATEGORY_LIST (class);
- CLASS_CATEGORY_LIST (class) = category;
-}
-
-/* Called after parsing each instance variable declaration. Necessary to
- preserve typedefs and implement public/private...
-
- PUBLIC is 1 for public, 0 for protected, and 2 for private. */
-
-tree
-add_instance_variable (class, public, declarator, declspecs, width)
- tree class;
- int public;
- tree declarator;
- tree declspecs;
- tree width;
-{
- tree field_decl, raw_decl;
-
- raw_decl = build_tree_list (declspecs, declarator);
-
- if (CLASS_RAW_IVARS (class))
- chainon (CLASS_RAW_IVARS (class), raw_decl);
- else
- CLASS_RAW_IVARS (class) = raw_decl;
-
- field_decl = grokfield (input_filename, lineno,
- declarator, declspecs, width);
-
- /* Overload the public attribute, it is not used for FIELD_DECLs. */
- switch (public)
- {
- case 0:
- TREE_PUBLIC (field_decl) = 0;
- TREE_PRIVATE (field_decl) = 0;
- TREE_PROTECTED (field_decl) = 1;
- break;
-
- case 1:
- TREE_PUBLIC (field_decl) = 1;
- TREE_PRIVATE (field_decl) = 0;
- TREE_PROTECTED (field_decl) = 0;
- break;
-
- case 2:
- TREE_PUBLIC (field_decl) = 0;
- TREE_PRIVATE (field_decl) = 1;
- TREE_PROTECTED (field_decl) = 0;
- break;
-
- }
-
- if (CLASS_IVARS (class))
- chainon (CLASS_IVARS (class), field_decl);
- else
- CLASS_IVARS (class) = field_decl;
-
- return class;
-}
-
-tree
-is_ivar (decl_chain, ident)
- tree decl_chain;
- tree ident;
-{
- for ( ; decl_chain; decl_chain = TREE_CHAIN (decl_chain))
- if (DECL_NAME (decl_chain) == ident)
- return decl_chain;
- return NULL_TREE;
-}
-
-/* True if the ivar is private and we are not in its implementation. */
-
-int
-is_private (decl)
- tree decl;
-{
- if (TREE_PRIVATE (decl)
- && ! is_ivar (CLASS_IVARS (implementation_template), DECL_NAME (decl)))
- {
- error ("instance variable `%s' is declared private",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- return 1;
- }
- else
- return 0;
-}
-
-/* We have an instance variable reference;, check to see if it is public. */
-
-int
-is_public (expr, identifier)
- tree expr;
- tree identifier;
-{
- tree basetype = TREE_TYPE (expr);
- enum tree_code code = TREE_CODE (basetype);
- tree decl;
-
- if (code == RECORD_TYPE)
- {
- if (TREE_STATIC_TEMPLATE (basetype))
- {
- if (!lookup_interface (TYPE_NAME (basetype)))
- {
- error ("Cannot find interface declaration for `%s'",
- IDENTIFIER_POINTER (TYPE_NAME (basetype)));
- return 0;
- }
-
- if ((decl = is_ivar (TYPE_FIELDS (basetype), identifier)))
- {
- if (TREE_PUBLIC (decl))
- return 1;
-
- /* Important difference between the Stepstone translator:
- all instance variables should be public within the context
- of the implementation. */
- if (implementation_context
- && (((TREE_CODE (implementation_context)
- == CLASS_IMPLEMENTATION_TYPE)
- || (TREE_CODE (implementation_context)
- == CATEGORY_IMPLEMENTATION_TYPE))
- && (CLASS_NAME (implementation_context)
- == TYPE_NAME (basetype))))
- return ! is_private (decl);
-
- error ("instance variable `%s' is declared %s",
- IDENTIFIER_POINTER (identifier),
- TREE_PRIVATE (decl) ? "private" : "protected");
- return 0;
- }
- }
-
- else if (implementation_context && (basetype == objc_object_reference))
- {
- TREE_TYPE (expr) = uprivate_record;
- warning ("static access to object of type `id'");
- }
- }
-
- return 1;
-}
-
-/* Implement @defs (<classname>) within struct bodies. */
-
-tree
-get_class_ivars (interface)
- tree interface;
-{
- if (!doing_objc_thang)
- objc_fatal ();
-
- return build_ivar_chain (interface, 1);
-}
-
-/* Make sure all entries in CHAIN are also in LIST. */
-
-static int
-check_methods (chain, list, mtype)
- tree chain;
- tree list;
- int mtype;
-{
- int first = 1;
-
- while (chain)
- {
- if (!lookup_method (list, chain))
- {
- if (first)
- {
- if (TREE_CODE (implementation_context)
- == CLASS_IMPLEMENTATION_TYPE)
- warning ("incomplete implementation of class `%s'",
- IDENTIFIER_POINTER (CLASS_NAME (implementation_context)));
- else if (TREE_CODE (implementation_context)
- == CATEGORY_IMPLEMENTATION_TYPE)
- warning ("incomplete implementation of category `%s'",
- IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_context)));
- first = 0;
- }
-
- warning ("method definition for `%c%s' not found",
- mtype, IDENTIFIER_POINTER (METHOD_SEL_NAME (chain)));
- }
-
- chain = TREE_CHAIN (chain);
- }
-
- return first;
-}
-
-static int
-conforms_to_protocol (class, protocol)
- tree class;
- tree protocol;
-{
- while (protocol)
- {
- tree p = CLASS_PROTOCOL_LIST (class);
-
- while (p && TREE_VALUE (p) != TREE_VALUE (protocol))
- p = TREE_CHAIN (p);
-
- if (!p)
- {
- tree super = (CLASS_SUPER_NAME (class)
- ? lookup_interface (CLASS_SUPER_NAME (class))
- : NULL_TREE);
- int tmp = super ? conforms_to_protocol (super, protocol) : 0;
- if (!tmp)
- return 0;
- }
-
- protocol = TREE_CHAIN (protocol);
- }
-
- return 1;
-}
-
-/* Make sure all methods in CHAIN are accessible as MTYPE methods in
- CONTEXT. This is one of two mechanisms to check protocol integrity. */
-
-static int
-check_methods_accessible (chain, context, mtype)
- tree chain;
- tree context;
- int mtype;
-{
- int first = 1;
- tree list;
- tree base_context = context;
-
- while (chain)
- {
- context = base_context;
- while (context)
- {
- if (mtype == '+')
- list = CLASS_CLS_METHODS (context);
- else
- list = CLASS_NST_METHODS (context);
-
- if (lookup_method (list, chain))
- break;
-
- else if (TREE_CODE (context) == CLASS_IMPLEMENTATION_TYPE
- || TREE_CODE (context) == CLASS_INTERFACE_TYPE)
- context = (CLASS_SUPER_NAME (context)
- ? lookup_interface (CLASS_SUPER_NAME (context))
- : NULL_TREE);
-
- else if (TREE_CODE (context) == CATEGORY_IMPLEMENTATION_TYPE
- || TREE_CODE (context) == CATEGORY_INTERFACE_TYPE)
- context = (CLASS_NAME (context)
- ? lookup_interface (CLASS_NAME (context))
- : NULL_TREE);
- else
- abort ();
- }
-
- if (context == NULL_TREE)
- {
- if (first)
- {
- if (TREE_CODE (implementation_context)
- == CLASS_IMPLEMENTATION_TYPE)
- warning ("incomplete implementation of class `%s'",
- IDENTIFIER_POINTER
- (CLASS_NAME (implementation_context)));
- else if (TREE_CODE (implementation_context)
- == CATEGORY_IMPLEMENTATION_TYPE)
- warning ("incomplete implementation of category `%s'",
- IDENTIFIER_POINTER
- (CLASS_SUPER_NAME (implementation_context)));
- first = 0;
- }
- warning ("method definition for `%c%s' not found",
- mtype, IDENTIFIER_POINTER (METHOD_SEL_NAME (chain)));
- }
-
- chain = TREE_CHAIN (chain); /* next method... */
- }
- return first;
-}
-
-static void
-check_protocols (proto_list, type, name)
- tree proto_list;
- char *type;
- char *name;
-{
- for ( ; proto_list; proto_list = TREE_CHAIN (proto_list))
- {
- tree p = TREE_VALUE (proto_list);
-
- if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
- {
- int f1, f2;
-
- /* Ensure that all protocols have bodies. */
- if (flag_warn_protocol) {
- f1 = check_methods (PROTOCOL_CLS_METHODS (p),
- CLASS_CLS_METHODS (implementation_context),
- '+');
- f2 = check_methods (PROTOCOL_NST_METHODS (p),
- CLASS_NST_METHODS (implementation_context),
- '-');
- } else {
- f1 = check_methods_accessible (PROTOCOL_CLS_METHODS (p),
- implementation_context,
- '+');
- f2 = check_methods_accessible (PROTOCOL_NST_METHODS (p),
- implementation_context,
- '-');
- }
-
- if (!f1 || !f2)
- warning ("%s `%s' does not fully implement the `%s' protocol",
- type, name, IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
-
- }
- else
- ; /* An identifier if we could not find a protocol. */
-
- /* Check protocols recursively. */
- if (PROTOCOL_LIST (p))
- {
- tree super_class
- = lookup_interface (CLASS_SUPER_NAME (implementation_template));
- if (! conforms_to_protocol (super_class, PROTOCOL_LIST (p)))
- check_protocols (PROTOCOL_LIST (p), type, name);
- }
- }
-}
-
-/* Make sure that the class CLASS_NAME is defined
- CODE says which kind of thing CLASS_NAME ought to be.
- It can be CLASS_INTERFACE_TYPE, CLASS_IMPLEMENTATION_TYPE,
- CATEGORY_INTERFACE_TYPE, or CATEGORY_IMPLEMENTATION_TYPE.
-
- If CODE is CLASS_INTERFACE_TYPE, we also do a push_obstacks_nochange
- whose matching pop is in continue_class. */
-
-tree
-start_class (code, class_name, super_name, protocol_list)
- enum tree_code code;
- tree class_name;
- tree super_name;
- tree protocol_list;
-{
- tree class, decl;
-
- if (code == CLASS_INTERFACE_TYPE)
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- }
-
- if (!doing_objc_thang)
- objc_fatal ();
-
- class = make_node (code);
- TYPE_BINFO (class) = make_tree_vec (5);
-
- CLASS_NAME (class) = class_name;
- CLASS_SUPER_NAME (class) = super_name;
- CLASS_CLS_METHODS (class) = NULL_TREE;
-
- if (! is_class_name (class_name) && (decl = lookup_name (class_name)))
- {
- error ("`%s' redeclared as different kind of symbol",
- IDENTIFIER_POINTER (class_name));
- error_with_decl (decl, "previous declaration of `%s'");
- }
-
- if (code == CLASS_IMPLEMENTATION_TYPE)
- {
- {
- static tree implemented_classes = 0;
- tree chain = implemented_classes;
- for (chain = implemented_classes; chain; chain = TREE_CHAIN (chain))
- if (TREE_VALUE (chain) == class_name)
- {
- error ("reimplementation of class `%s'",
- IDENTIFIER_POINTER (class_name));
- return error_mark_node;
- }
- implemented_classes = perm_tree_cons (NULL_TREE, class_name,
- implemented_classes);
- }
-
- /* Pre-build the following entities - for speed/convenience. */
- if (!self_id)
- self_id = get_identifier ("self");
- if (!ucmd_id)
- ucmd_id = get_identifier ("_cmd");
- if (!unused_list)
- unused_list
- = build_tree_list (get_identifier ("__unused__"), NULL_TREE);
- if (!objc_super_template)
- objc_super_template = build_super_template ();
-
- /* Reset for multiple classes per file. */
- method_slot = 0;
-
- implementation_context = class;
-
- /* Lookup the interface for this implementation. */
-
- if (!(implementation_template = lookup_interface (class_name)))
- {
- warning ("Cannot find interface declaration for `%s'",
- IDENTIFIER_POINTER (class_name));
- add_class (implementation_template = implementation_context);
- }
-
- /* If a super class has been specified in the implementation,
- insure it conforms to the one specified in the interface. */
-
- if (super_name
- && (super_name != CLASS_SUPER_NAME (implementation_template)))
- {
- tree previous_name = CLASS_SUPER_NAME (implementation_template);
- char *name = previous_name ? IDENTIFIER_POINTER (previous_name) : "";
- error ("conflicting super class name `%s'",
- IDENTIFIER_POINTER (super_name));
- error ("previous declaration of `%s'", name);
- }
-
- else if (! super_name)
- {
- CLASS_SUPER_NAME (implementation_context)
- = CLASS_SUPER_NAME (implementation_template);
- }
- }
-
- else if (code == CLASS_INTERFACE_TYPE)
- {
- if (lookup_interface (class_name))
- warning ("duplicate interface declaration for class `%s'",
- IDENTIFIER_POINTER (class_name));
- else
- add_class (class);
-
- if (protocol_list)
- CLASS_PROTOCOL_LIST (class)
- = lookup_and_install_protocols (protocol_list);
- }
-
- else if (code == CATEGORY_INTERFACE_TYPE)
- {
- tree class_category_is_assoc_with;
-
- /* For a category, class_name is really the name of the class that
- the following set of methods will be associated with. We must
- find the interface so that can derive the objects template. */
-
- if (!(class_category_is_assoc_with = lookup_interface (class_name)))
- {
- error ("Cannot find interface declaration for `%s'",
- IDENTIFIER_POINTER (class_name));
- exit (FATAL_EXIT_CODE);
- }
- else
- add_category (class_category_is_assoc_with, class);
-
- if (protocol_list)
- CLASS_PROTOCOL_LIST (class)
- = lookup_and_install_protocols (protocol_list);
- }
-
- else if (code == CATEGORY_IMPLEMENTATION_TYPE)
- {
- /* Pre-build the following entities for speed/convenience. */
- if (!self_id)
- self_id = get_identifier ("self");
- if (!ucmd_id)
- ucmd_id = get_identifier ("_cmd");
- if (!unused_list)
- unused_list
- = build_tree_list (get_identifier ("__unused__"), NULL_TREE);
- if (!objc_super_template)
- objc_super_template = build_super_template ();
-
- /* Reset for multiple classes per file. */
- method_slot = 0;
-
- implementation_context = class;
-
- /* For a category, class_name is really the name of the class that
- the following set of methods will be associated with. We must
- find the interface so that can derive the objects template. */
-
- if (!(implementation_template = lookup_interface (class_name)))
- {
- error ("Cannot find interface declaration for `%s'",
- IDENTIFIER_POINTER (class_name));
- exit (FATAL_EXIT_CODE);
- }
- }
- return class;
-}
-
-tree
-continue_class (class)
- tree class;
-{
- if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE
- || TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
- {
- struct imp_entry *imp_entry;
- tree ivar_context;
-
- /* Check consistency of the instance variables. */
-
- if (CLASS_IVARS (class))
- check_ivars (implementation_template, class);
-
- /* code generation */
-
- ivar_context = build_private_template (implementation_template);
-
- if (!objc_class_template)
- build_class_template ();
-
- if (!(imp_entry
- = (struct imp_entry *) xmalloc (sizeof (struct imp_entry))))
- perror ("unable to allocate in objc-tree.c");
-
- imp_entry->next = imp_list;
- imp_entry->imp_context = class;
- imp_entry->imp_template = implementation_template;
-
- synth_forward_declarations ();
- imp_entry->class_decl = UOBJC_CLASS_decl;
- imp_entry->meta_decl = UOBJC_METACLASS_decl;
-
- /* Append to front and increment count. */
- imp_list = imp_entry;
- if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
- imp_count++;
- else
- cat_count++;
-
- return ivar_context;
- }
-
- else if (TREE_CODE (class) == CLASS_INTERFACE_TYPE)
- {
- tree record = xref_tag (RECORD_TYPE, CLASS_NAME (class));
-
- if (!TYPE_FIELDS (record))
- {
- finish_struct (record, build_ivar_chain (class, 0), NULL_TREE);
- CLASS_STATIC_TEMPLATE (class) = record;
-
- /* Mark this record as a class template for static typing. */
- TREE_STATIC_TEMPLATE (record) = 1;
- }
-
- return NULL_TREE;
- }
-
- else
- return error_mark_node;
-}
-
-/* This is called once we see the "@end" in an interface/implementation. */
-
-void
-finish_class (class)
- tree class;
-{
- if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
- {
- /* All code generation is done in finish_objc. */
-
- if (implementation_template != implementation_context)
- {
- /* Ensure that all method listed in the interface contain bodies. */
- check_methods (CLASS_CLS_METHODS (implementation_template),
- CLASS_CLS_METHODS (implementation_context), '+');
- check_methods (CLASS_NST_METHODS (implementation_template),
- CLASS_NST_METHODS (implementation_context), '-');
-
- if (CLASS_PROTOCOL_LIST (implementation_template))
- check_protocols (CLASS_PROTOCOL_LIST (implementation_template),
- "class",
- IDENTIFIER_POINTER (CLASS_NAME (implementation_context)));
- }
- }
-
- else if (TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
- {
- tree category = CLASS_CATEGORY_LIST (implementation_template);
-
- /* Find the category interface from the class it is associated with. */
- while (category)
- {
- if (CLASS_SUPER_NAME (class) == CLASS_SUPER_NAME (category))
- break;
- category = CLASS_CATEGORY_LIST (category);
- }
-
- if (category)
- {
- /* Ensure all method listed in the interface contain bodies. */
- check_methods (CLASS_CLS_METHODS (category),
- CLASS_CLS_METHODS (implementation_context), '+');
- check_methods (CLASS_NST_METHODS (category),
- CLASS_NST_METHODS (implementation_context), '-');
-
- if (CLASS_PROTOCOL_LIST (category))
- check_protocols (CLASS_PROTOCOL_LIST (category),
- "category",
- IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_context)));
- }
- }
-
- else if (TREE_CODE (class) == CLASS_INTERFACE_TYPE)
- {
- tree decl_specs;
- char *class_name = IDENTIFIER_POINTER (CLASS_NAME (class));
- char *string = (char *) alloca (strlen (class_name) + 3);
-
- /* extern struct objc_object *_<my_name>; */
-
- sprintf (string, "_%s", class_name);
-
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_EXTERN]);
- decl_specs = tree_cons (NULL_TREE, objc_object_reference, decl_specs);
- define_decl (build1 (INDIRECT_REF, NULL_TREE, get_identifier (string)),
- decl_specs);
- }
-}
-
-static tree
-add_protocol (protocol)
- tree protocol;
-{
- /* Put protocol on list in reverse order. */
- TREE_CHAIN (protocol) = protocol_chain;
- protocol_chain = protocol;
- return protocol_chain;
-}
-
-static tree
-lookup_protocol (ident)
- tree ident;
-{
- tree chain;
-
- for (chain = protocol_chain; chain; chain = TREE_CHAIN (chain))
- {
- if (ident == PROTOCOL_NAME (chain))
- return chain;
- }
-
- return NULL_TREE;
-}
-
-tree
-start_protocol (code, name, list)
- enum tree_code code;
- tree name;
- tree list;
-{
- tree protocol;
-
- if (!doing_objc_thang)
- objc_fatal ();
-
- /* This is as good a place as any. Need to invoke push_tag_toplevel. */
- if (!objc_protocol_template)
- objc_protocol_template = build_protocol_template ();
-
- protocol = make_node (code);
- TYPE_BINFO (protocol) = make_tree_vec (2);
-
- PROTOCOL_NAME (protocol) = name;
- PROTOCOL_LIST (protocol) = list;
-
- lookup_and_install_protocols (list);
-
- if (lookup_protocol (name))
- warning ("duplicate declaration for protocol `%s'",
- IDENTIFIER_POINTER (name));
- else
- add_protocol (protocol);
-
- PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
-
- return protocol;
-}
-
-void
-finish_protocol (protocol)
- tree protocol;
-{
-}
-
-
-/* "Encode" a data type into a string, which grows in util_obstack.
- ??? What is the FORMAT? Someone please document this! */
-
-static void
-encode_type_qualifiers (declspecs)
- tree declspecs;
-{
- tree spec;
-
- for (spec = declspecs; spec; spec = TREE_CHAIN (spec))
- {
- if (ridpointers[(int) RID_CONST] == TREE_VALUE (spec))
- obstack_1grow (&util_obstack, 'r');
- else if (ridpointers[(int) RID_IN] == TREE_VALUE (spec))
- obstack_1grow (&util_obstack, 'n');
- else if (ridpointers[(int) RID_INOUT] == TREE_VALUE (spec))
- obstack_1grow (&util_obstack, 'N');
- else if (ridpointers[(int) RID_OUT] == TREE_VALUE (spec))
- obstack_1grow (&util_obstack, 'o');
- else if (ridpointers[(int) RID_BYCOPY] == TREE_VALUE (spec))
- obstack_1grow (&util_obstack, 'O');
- else if (ridpointers[(int) RID_ONEWAY] == TREE_VALUE (spec))
- obstack_1grow (&util_obstack, 'V');
- }
-}
-
-/* Encode a pointer type. */
-
-static void
-encode_pointer (type, curtype, format)
- tree type;
- int curtype;
- int format;
-{
- tree pointer_to = TREE_TYPE (type);
-
- if (TREE_CODE (pointer_to) == RECORD_TYPE)
- {
- if (TYPE_NAME (pointer_to)
- && TREE_CODE (TYPE_NAME (pointer_to)) == IDENTIFIER_NODE)
- {
- char *name = IDENTIFIER_POINTER (TYPE_NAME (pointer_to));
-
- if (strcmp (name, TAG_OBJECT) == 0) /* '@' */
- {
- obstack_1grow (&util_obstack, '@');
- return;
- }
- else if (TREE_STATIC_TEMPLATE (pointer_to))
- {
- if (generating_instance_variables)
- {
- obstack_1grow (&util_obstack, '@');
- obstack_1grow (&util_obstack, '"');
- obstack_grow (&util_obstack, name, strlen (name));
- obstack_1grow (&util_obstack, '"');
- return;
- }
- else
- {
- obstack_1grow (&util_obstack, '@');
- return;
- }
- }
- else if (strcmp (name, TAG_CLASS) == 0) /* '#' */
- {
- obstack_1grow (&util_obstack, '#');
- return;
- }
-#ifndef OBJC_INT_SELECTORS
- else if (strcmp (name, TAG_SELECTOR) == 0) /* ':' */
- {
- obstack_1grow (&util_obstack, ':');
- return;
- }
-#endif /* OBJC_INT_SELECTORS */
- }
- }
- else if (TREE_CODE (pointer_to) == INTEGER_TYPE
- && TYPE_MODE (pointer_to) == QImode)
- {
- obstack_1grow (&util_obstack, '*');
- return;
- }
-
- /* We have a type that does not get special treatment. */
-
- /* NeXT extension */
- obstack_1grow (&util_obstack, '^');
- encode_type (pointer_to, curtype, format);
-}
-
-static void
-encode_array (type, curtype, format)
- tree type;
- int curtype;
- int format;
-{
- tree an_int_cst = TYPE_SIZE (type);
- tree array_of = TREE_TYPE (type);
- char buffer[40];
-
- /* An incomplete array is treated like a pointer. */
- if (an_int_cst == NULL)
- {
- encode_pointer (type, curtype, format);
- return;
- }
-
- sprintf (buffer, "[%d",
- (TREE_INT_CST_LOW (an_int_cst)
- / TREE_INT_CST_LOW (TYPE_SIZE (array_of))));
-
- obstack_grow (&util_obstack, buffer, strlen (buffer));
- encode_type (array_of, curtype, format);
- obstack_1grow (&util_obstack, ']');
- return;
-}
-
-static void
-encode_aggregate_within (type, curtype, format, left, right)
- tree type;
- int curtype;
- int format;
- char left;
- char right;
-{
- if (obstack_object_size (&util_obstack) > 0
- && *(obstack_next_free (&util_obstack) - 1) == '^')
- {
- tree name = TYPE_NAME (type);
-
- /* we have a reference; this is a NeXT extension. */
-
- if (obstack_object_size (&util_obstack) - curtype == 1
- && format == OBJC_ENCODE_INLINE_DEFS)
- {
- /* Output format of struct for first level only. */
- tree fields = TYPE_FIELDS (type);
-
- if (name && TREE_CODE (name) == IDENTIFIER_NODE)
- {
- obstack_1grow (&util_obstack, left);
- obstack_grow (&util_obstack,
- IDENTIFIER_POINTER (name),
- strlen (IDENTIFIER_POINTER (name)));
- obstack_1grow (&util_obstack, '=');
- }
- else
- {
- obstack_1grow (&util_obstack, left);
- obstack_grow (&util_obstack, "?=", 2);
- }
-
- for ( ; fields; fields = TREE_CHAIN (fields))
- encode_field_decl (fields, curtype, format);
-
- obstack_1grow (&util_obstack, right);
- }
-
- else if (name && TREE_CODE (name) == IDENTIFIER_NODE)
- {
- obstack_1grow (&util_obstack, left);
- obstack_grow (&util_obstack,
- IDENTIFIER_POINTER (name),
- strlen (IDENTIFIER_POINTER (name)));
- obstack_1grow (&util_obstack, right);
- }
-
- else
- {
- /* We have an untagged structure or a typedef. */
- obstack_1grow (&util_obstack, left);
- obstack_1grow (&util_obstack, '?');
- obstack_1grow (&util_obstack, right);
- }
- }
-
- else
- {
- tree name = TYPE_NAME (type);
- tree fields = TYPE_FIELDS (type);
-
- if (format == OBJC_ENCODE_INLINE_DEFS
- || generating_instance_variables)
- {
- obstack_1grow (&util_obstack, left);
- if (name && TREE_CODE (name) == IDENTIFIER_NODE)
- obstack_grow (&util_obstack,
- IDENTIFIER_POINTER (name),
- strlen (IDENTIFIER_POINTER (name)));
- else
- obstack_1grow (&util_obstack, '?');
-
- obstack_1grow (&util_obstack, '=');
-
- for (; fields; fields = TREE_CHAIN (fields))
- {
- if (generating_instance_variables)
- {
- tree fname = DECL_NAME (fields);
-
- obstack_1grow (&util_obstack, '"');
- if (fname && TREE_CODE (fname) == IDENTIFIER_NODE)
- {
- obstack_grow (&util_obstack,
- IDENTIFIER_POINTER (fname),
- strlen (IDENTIFIER_POINTER (fname)));
- }
-
- obstack_1grow (&util_obstack, '"');
- }
-
- encode_field_decl (fields, curtype, format);
- }
-
- obstack_1grow (&util_obstack, right);
- }
-
- else
- {
- obstack_1grow (&util_obstack, left);
- if (name && TREE_CODE (name) == IDENTIFIER_NODE)
- obstack_grow (&util_obstack,
- IDENTIFIER_POINTER (name),
- strlen (IDENTIFIER_POINTER (name)));
- else
- /* We have an untagged structure or a typedef. */
- obstack_1grow (&util_obstack, '?');
-
- obstack_1grow (&util_obstack, right);
- }
- }
-}
-
-static void
-encode_aggregate (type, curtype, format)
- tree type;
- int curtype;
- int format;
-{
- enum tree_code code = TREE_CODE (type);
-
- switch (code)
- {
- case RECORD_TYPE:
- {
- encode_aggregate_within(type, curtype, format, '{', '}');
- break;
- }
- case UNION_TYPE:
- {
- encode_aggregate_within(type, curtype, format, '(', ')');
- break;
- }
-
- case ENUMERAL_TYPE:
- obstack_1grow (&util_obstack, 'i');
- break;
- }
-}
-
-/* Support bitfields. The current version of Objective-C does not support
- them. The string will consist of one or more "b:n"'s where n is an
- integer describing the width of the bitfield. Currently, classes in
- the kit implement a method "-(char *)describeBitfieldStruct:" that
- simulates this. If they do not implement this method, the archiver
- assumes the bitfield is 16 bits wide (padded if necessary) and packed
- according to the GNU compiler. After looking at the "kit", it appears
- that all classes currently rely on this default behavior, rather than
- hand generating this string (which is tedious). */
-
-static void
-encode_bitfield (width, format)
- int width;
- int format;
-{
- char buffer[40];
- sprintf (buffer, "b%d", width);
- obstack_grow (&util_obstack, buffer, strlen (buffer));
-}
-
-/* FORMAT will be OBJC_ENCODE_INLINE_DEFS or OBJC_ENCODE_DONT_INLINE_DEFS. */
-
-static void
-encode_type (type, curtype, format)
- tree type;
- int curtype;
- int format;
-{
- enum tree_code code = TREE_CODE (type);
-
- if (code == INTEGER_TYPE)
- {
- if (TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)) == 0
- && TREE_INT_CST_HIGH (TYPE_MIN_VALUE (type)) == 0)
- {
- /* Unsigned integer types. */
-
- if (TYPE_MODE (type) == QImode)
- obstack_1grow (&util_obstack, 'C');
- else if (TYPE_MODE (type) == HImode)
- obstack_1grow (&util_obstack, 'S');
- else if (TYPE_MODE (type) == SImode)
- {
- if (type == long_unsigned_type_node)
- obstack_1grow (&util_obstack, 'L');
- else
- obstack_1grow (&util_obstack, 'I');
- }
- else if (TYPE_MODE (type) == DImode)
- obstack_1grow (&util_obstack, 'Q');
- }
-
- else
- /* Signed integer types. */
- {
- if (TYPE_MODE (type) == QImode)
- obstack_1grow (&util_obstack, 'c');
- else if (TYPE_MODE (type) == HImode)
- obstack_1grow (&util_obstack, 's');
- else if (TYPE_MODE (type) == SImode)
- {
- if (type == long_integer_type_node)
- obstack_1grow (&util_obstack, 'l');
- else
- obstack_1grow (&util_obstack, 'i');
- }
-
- else if (TYPE_MODE (type) == DImode)
- obstack_1grow (&util_obstack, 'q');
- }
- }
-
- else if (code == REAL_TYPE)
- {
- /* Floating point types. */
-
- if (TYPE_MODE (type) == SFmode)
- obstack_1grow (&util_obstack, 'f');
- else if (TYPE_MODE (type) == DFmode
- || TYPE_MODE (type) == TFmode)
- obstack_1grow (&util_obstack, 'd');
- }
-
- else if (code == VOID_TYPE)
- obstack_1grow (&util_obstack, 'v');
-
- else if (code == ARRAY_TYPE)
- encode_array (type, curtype, format);
-
- else if (code == POINTER_TYPE)
- encode_pointer (type, curtype, format);
-
- else if (code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE)
- encode_aggregate (type, curtype, format);
-
- else if (code == FUNCTION_TYPE) /* '?' */
- obstack_1grow (&util_obstack, '?');
-}
-
-static void
-encode_field_decl (field_decl, curtype, format)
- tree field_decl;
- int curtype;
- int format;
-{
- tree type;
-
- /* If this field is obviously a bitfield, or is a bitfield that has been
- clobbered to look like a ordinary integer mode, go ahead and generate
- the bitfield typing information. */
- type = TREE_TYPE (field_decl);
- if (DECL_BIT_FIELD (field_decl))
- encode_bitfield (DECL_FIELD_SIZE (field_decl), format);
- else if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && DECL_FIELD_SIZE (field_decl)
- && TYPE_MODE (type) > DECL_MODE (field_decl))
- encode_bitfield (DECL_FIELD_SIZE (field_decl), format);
- else
- encode_type (TREE_TYPE (field_decl), curtype, format);
-}
-
-static tree
-expr_last (complex_expr)
- tree complex_expr;
-{
- tree next;
-
- if (complex_expr)
- while ((next = TREE_OPERAND (complex_expr, 0)))
- complex_expr = next;
-
- return complex_expr;
-}
-
-/* The selector of the current method,
- or NULL if we aren't compiling a method. */
-
-tree
-maybe_objc_method_name (decl)
- tree decl;
-{
- if (method_context)
- return METHOD_SEL_NAME (method_context);
- else
- return 0;
-}
-
-/* Transform a method definition into a function definition as follows:
- - synthesize the first two arguments, "self" and "_cmd". */
-
-void
-start_method_def (method)
- tree method;
-{
- tree decl_specs;
-
- /* Required to implement _msgSuper. */
- method_context = method;
- UOBJC_SUPER_decl = NULL_TREE;
-
- /* Must be called BEFORE start_function. */
- pushlevel (0);
-
- /* Generate prototype declarations for arguments..."new-style". */
-
- if (TREE_CODE (method_context) == INSTANCE_METHOD_DECL)
- decl_specs = build_tree_list (NULL_TREE, uprivate_record);
- else
- /* Really a `struct objc_class *'. However, we allow people to
- assign to self, which changes its type midstream. */
- decl_specs = build_tree_list (NULL_TREE, objc_object_reference);
-
- push_parm_decl (build_tree_list
- (build_tree_list (decl_specs,
- build1 (INDIRECT_REF, NULL_TREE, self_id)),
- build_tree_list (unused_list, NULL_TREE)));
-
-#ifdef OBJC_INT_SELECTORS
- decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_UNSIGNED]);
- decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_INT], decl_specs);
- push_parm_decl (build_tree_list (build_tree_list (decl_specs, ucmd_id),
- build_tree_list (unused_list, NULL_TREE)));
-#else /* not OBJC_INT_SELECTORS */
- decl_specs = build_tree_list (NULL_TREE,
- xref_tag (RECORD_TYPE,
- get_identifier (TAG_SELECTOR)));
- push_parm_decl (build_tree_list
- (build_tree_list (decl_specs,
- build1 (INDIRECT_REF, NULL_TREE, ucmd_id)),
- build_tree_list (unused_list, NULL_TREE)));
-#endif /* not OBJC_INT_SELECTORS */
-
- /* Generate argument declarations if a keyword_decl. */
- if (METHOD_SEL_ARGS (method))
- {
- tree arglist = METHOD_SEL_ARGS (method);
- do
- {
- tree arg_spec = TREE_PURPOSE (TREE_TYPE (arglist));
- tree arg_decl = TREE_VALUE (TREE_TYPE (arglist));
-
- if (arg_decl)
- {
- tree last_expr = expr_last (arg_decl);
-
- /* Unite the abstract decl with its name. */
- TREE_OPERAND (last_expr, 0) = KEYWORD_ARG_NAME (arglist);
- push_parm_decl (build_tree_list
- (build_tree_list (arg_spec, arg_decl),
- build_tree_list (NULL_TREE, NULL_TREE)));
-
- /* Unhook: restore the abstract declarator. */
- TREE_OPERAND (last_expr, 0) = NULL_TREE;
- }
-
- else
- push_parm_decl (build_tree_list
- (build_tree_list (arg_spec,
- KEYWORD_ARG_NAME (arglist)),
- build_tree_list (NULL_TREE, NULL_TREE)));
-
- arglist = TREE_CHAIN (arglist);
- }
- while (arglist);
- }
-
- if (METHOD_ADD_ARGS (method) > (tree)1)
- {
- /* We have a variable length selector - in "prototype" format. */
- tree akey = TREE_PURPOSE (METHOD_ADD_ARGS (method));
- while (akey)
- {
- /* This must be done prior to calling pushdecl. pushdecl is
- going to change our chain on us. */
- tree nextkey = TREE_CHAIN (akey);
- pushdecl (akey);
- akey = nextkey;
- }
- }
-}
-
-static void
-warn_with_method (message, mtype, method)
- char *message;
- int mtype;
- tree method;
-{
- if (count_error (1) == 0)
- return;
-
- report_error_function (DECL_SOURCE_FILE (method));
-
- fprintf (stderr, "%s:%d: warning: ",
- DECL_SOURCE_FILE (method), DECL_SOURCE_LINE (method));
- bzero (errbuf, BUFSIZE);
- fprintf (stderr, "%s `%c%s'\n",
- message, mtype, gen_method_decl (method, errbuf));
-}
-
-/* Return 1 if METHOD is consistent with PROTO. */
-
-static int
-comp_method_with_proto (method, proto)
- tree method, proto;
-{
- static tree function_type = 0;
-
- /* Create a function_type node once. */
- if (!function_type)
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- function_type = make_node (FUNCTION_TYPE);
- pop_obstacks ();
- }
-
- /* Install argument types - normally set by build_function_type. */
- TYPE_ARG_TYPES (function_type) = get_arg_type_list (proto, METHOD_DEF, 0);
-
- /* install return type */
- TREE_TYPE (function_type) = groktypename (TREE_TYPE (proto));
-
- return comptypes (TREE_TYPE (METHOD_DEFINITION (method)), function_type);
-}
-
-/* Return 1 if PROTO1 is consistent with PROTO2. */
-
-static int
-comp_proto_with_proto (proto1, proto2)
- tree proto1, proto2;
-{
- static tree function_type1 = 0, function_type2 = 0;
-
- /* Create a couple function_type node's once. */
- if (!function_type1)
- {
- push_obstacks_nochange ();
- end_temporary_allocation ();
- function_type1 = make_node (FUNCTION_TYPE);
- function_type2 = make_node (FUNCTION_TYPE);
- pop_obstacks ();
- }
-
- /* Install argument types; normally set by build_function_type. */
- TYPE_ARG_TYPES (function_type1) = get_arg_type_list (proto1, METHOD_REF, 0);
- TYPE_ARG_TYPES (function_type2) = get_arg_type_list (proto2, METHOD_REF, 0);
-
- /* Install return type. */
- TREE_TYPE (function_type1) = groktypename (TREE_TYPE (proto1));
- TREE_TYPE (function_type2) = groktypename (TREE_TYPE (proto2));
-
- return comptypes (function_type1, function_type2);
-}
-
-/* - Generate an identifier for the function. the format is "_n_cls",
- where 1 <= n <= nMethods, and cls is the name the implementation we
- are processing.
- - Install the return type from the method declaration.
- - If we have a prototype, check for type consistency. */
-
-static void
-really_start_method (method, parmlist)
- tree method, parmlist;
-{
- tree sc_spec, ret_spec, ret_decl, decl_specs;
- tree method_decl, method_id;
- char *buf, *sel_name, *class_name, *cat_name;
-
- /* Synth the storage class & assemble the return type. */
- sc_spec = tree_cons (NULL_TREE, ridpointers[(int) RID_STATIC], NULL_TREE);
- ret_spec = TREE_PURPOSE (TREE_TYPE (method));
- decl_specs = chainon (sc_spec, ret_spec);
-
- sel_name = IDENTIFIER_POINTER (METHOD_SEL_NAME (method));
- class_name = IDENTIFIER_POINTER (CLASS_NAME (implementation_context));
- cat_name = ((TREE_CODE (implementation_context)
- == CLASS_IMPLEMENTATION_TYPE)
- ? NULL
- : IDENTIFIER_POINTER (CLASS_SUPER_NAME (implementation_context)));
- method_slot++;
-
- /* Make sure this is big enough for any plausible method label. */
- buf = (char *) alloca (50 + strlen (sel_name) + strlen (class_name)
- + (cat_name ? strlen (cat_name) : 0));
-
- OBJC_GEN_METHOD_LABEL (buf, TREE_CODE (method) == INSTANCE_METHOD_DECL,
- class_name, cat_name, sel_name, method_slot);
-
- method_id = get_identifier (buf);
-
- method_decl = build_nt (CALL_EXPR, method_id, parmlist, NULL_TREE);
-
- /* Check the declarator portion of the return type for the method. */
- if ((ret_decl = TREE_VALUE (TREE_TYPE (method))))
- {
- /* Unite the complex decl (specified in the abstract decl) with the
- function decl just synthesized..(int *), (int (*)()), (int (*)[]). */
- tree save_expr = expr_last (ret_decl);
-
- TREE_OPERAND (save_expr, 0) = method_decl;
- method_decl = ret_decl;
-
- /* Fool the parser into thinking it is starting a function. */
- start_function (decl_specs, method_decl, NULL_TREE, NULL_TREE, 0);
-
- /* Unhook: this has the effect of restoring the abstract declarator. */
- TREE_OPERAND (save_expr, 0) = NULL_TREE;
- }
-
- else
- {
- TREE_VALUE (TREE_TYPE (method)) = method_decl;
-
- /* Fool the parser into thinking it is starting a function. */
- start_function (decl_specs, method_decl, NULL_TREE, NULL_TREE, 0);
-
- /* Unhook: this has the effect of restoring the abstract declarator. */
- TREE_VALUE (TREE_TYPE (method)) = NULL_TREE;
- }
-
- METHOD_DEFINITION (method) = current_function_decl;
-
- if (implementation_template != implementation_context)
- {
- tree proto;
-
- if (TREE_CODE (method) == INSTANCE_METHOD_DECL)
- proto = lookup_instance_method_static (implementation_template,
- METHOD_SEL_NAME (method));
- else
- proto = lookup_class_method_static (implementation_template,
- METHOD_SEL_NAME (method));
-
- if (proto && ! comp_method_with_proto (method, proto))
- {
- char type = (TREE_CODE (method) == INSTANCE_METHOD_DECL ? '-' : '+');
-
- warn_with_method ("conflicting types for", type, method);
- warn_with_method ("previous declaration of", type, proto);
- }
- }
-}
-
-/* The following routine is always called...this "architecture" is to
- accommodate "old-style" variable length selectors.
-
- - a:a b:b // prototype ; id c; id d; // old-style. */
-
-void
-continue_method_def ()
-{
- tree parmlist;
-
- if (METHOD_ADD_ARGS (method_context) == (tree)1)
- /* We have a `, ...' immediately following the selector. */
- parmlist = get_parm_info (0);
- else
- parmlist = get_parm_info (1); /* place a `void_at_end' */
-
- /* Set self_decl from the first argument...this global is used by
- build_ivar_reference calling build_indirect_ref. */
- self_decl = TREE_PURPOSE (parmlist);
-
- poplevel (0, 0, 0);
- really_start_method (method_context, parmlist);
- store_parm_decls ();
-}
-
-/* Called by the parser, from the `pushlevel' production. */
-
-void
-add_objc_decls ()
-{
- if (!UOBJC_SUPER_decl)
- {
- UOBJC_SUPER_decl = start_decl (get_identifier (UTAG_SUPER),
- build_tree_list (NULL_TREE,
- objc_super_template),
- 0, NULL_TREE, NULL_TREE);
-
- finish_decl (UOBJC_SUPER_decl, NULL_TREE, NULL_TREE);
-
- /* This prevents `unused variable' warnings when compiling with -Wall. */
- TREE_USED (UOBJC_SUPER_decl) = 1;
- DECL_ARTIFICIAL (UOBJC_SUPER_decl) = 1;
- }
-}
-
-/* _n_Method (id self, SEL sel, ...)
- {
- struct objc_super _S;
- _msgSuper ((_S.self = self, _S.class = _cls, &_S), ...);
- } */
-
-tree
-get_super_receiver ()
-{
- if (method_context)
- {
- tree super_expr, super_expr_list;
-
- /* Set receiver to self. */
- super_expr = build_component_ref (UOBJC_SUPER_decl, self_id);
- super_expr = build_modify_expr (super_expr, NOP_EXPR, self_decl);
- super_expr_list = build_tree_list (NULL_TREE, super_expr);
-
- /* Set class to begin searching. */
- super_expr = build_component_ref (UOBJC_SUPER_decl,
- get_identifier ("class"));
-
- if (TREE_CODE (implementation_context) == CLASS_IMPLEMENTATION_TYPE)
- {
- /* [_cls, __cls]Super are "pre-built" in
- synth_forward_declarations. */
-
- super_expr = build_modify_expr (super_expr, NOP_EXPR,
- ((TREE_CODE (method_context)
- == INSTANCE_METHOD_DECL)
- ? ucls_super_ref
- : uucls_super_ref));
- }
-
- else
- /* We have a category. */
- {
- tree super_name = CLASS_SUPER_NAME (implementation_template);
- tree super_class;
-
- if (!super_name)
- {
- error ("no super class declared in interface for `%s'",
- IDENTIFIER_POINTER (CLASS_NAME (implementation_template)));
- return error_mark_node;
- }
-
- if (flag_next_runtime)
- {
- super_class = get_class_reference (super_name);
- if (TREE_CODE (method_context) == CLASS_METHOD_DECL)
- super_class
- = build_component_ref (build_indirect_ref (super_class, "->"),
- get_identifier ("isa"));
- }
- else
- {
- add_class_reference (super_name);
- super_class = (TREE_CODE (method_context) == INSTANCE_METHOD_DECL
- ? objc_get_class_decl : objc_get_meta_class_decl);
- assemble_external (super_class);
- super_class
- = build_function_call
- (super_class,
- build_tree_list
- (NULL_TREE,
- my_build_string (IDENTIFIER_LENGTH (super_name) + 1,
- IDENTIFIER_POINTER (super_name))));
- }
-
- TREE_TYPE (super_class) = TREE_TYPE (ucls_super_ref);
- super_expr = build_modify_expr (super_expr, NOP_EXPR, super_class);
- }
-
- chainon (super_expr_list, build_tree_list (NULL_TREE, super_expr));
-
- super_expr = build_unary_op (ADDR_EXPR, UOBJC_SUPER_decl, 0);
- chainon (super_expr_list, build_tree_list (NULL_TREE, super_expr));
-
- return build_compound_expr (super_expr_list);
- }
- else
- {
- error ("[super ...] must appear in a method context");
- return error_mark_node;
- }
-}
-
-static tree
-encode_method_def (func_decl)
- tree func_decl;
-{
- tree parms;
- int stack_size;
- int max_parm_end = 0;
- char buffer[40];
- tree result;
-
- /* Return type. */
- encode_type (TREE_TYPE (TREE_TYPE (func_decl)),
- obstack_object_size (&util_obstack),
- OBJC_ENCODE_INLINE_DEFS);
-
- /* Stack size. */
- for (parms = DECL_ARGUMENTS (func_decl); parms;
- parms = TREE_CHAIN (parms))
- {
- int parm_end = (forwarding_offset (parms)
- + (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (parms)))
- / BITS_PER_UNIT));
-
- if (!offset_is_register && parm_end > max_parm_end)
- max_parm_end = parm_end;
- }
-
- stack_size = max_parm_end - OBJC_FORWARDING_MIN_OFFSET;
-
- sprintf (buffer, "%d", stack_size);
- obstack_grow (&util_obstack, buffer, strlen (buffer));
-
- /* Argument types. */
- for (parms = DECL_ARGUMENTS (func_decl); parms;
- parms = TREE_CHAIN (parms))
- {
- /* Type. */
- encode_type (TREE_TYPE (parms),
- obstack_object_size (&util_obstack),
- OBJC_ENCODE_INLINE_DEFS);
-
- /* Compute offset. */
- sprintf (buffer, "%d", forwarding_offset (parms));
-
- /* Indicate register. */
- if (offset_is_register)
- obstack_1grow (&util_obstack, '+');
-
- obstack_grow (&util_obstack, buffer, strlen (buffer));
- }
-
- obstack_1grow (&util_obstack, 0);
- result = get_identifier (obstack_finish (&util_obstack));
- obstack_free (&util_obstack, util_firstobj);
- return result;
-}
-
-void
-finish_method_def ()
-{
- METHOD_ENCODING (method_context) = encode_method_def (current_function_decl);
-
- finish_function (0);
-
- /* Required to implement _msgSuper. This must be done AFTER finish_function,
- since the optimizer may find "may be used before set" errors. */
- method_context = NULL_TREE;
-}
-
-int
-lang_report_error_function (decl)
- tree decl;
-{
- if (method_context)
- {
- fprintf (stderr, "In method `%s'\n",
- IDENTIFIER_POINTER (METHOD_SEL_NAME (method_context)));
- return 1;
- }
-
- else
- return 0;
-}
-
-static int
-is_complex_decl (type)
- tree type;
-{
- return (TREE_CODE (type) == ARRAY_TYPE
- || TREE_CODE (type) == FUNCTION_TYPE
- || (TREE_CODE (type) == POINTER_TYPE && ! IS_ID (type)));
-}
-
-
-/* Code to convert a decl node into text for a declaration in C. */
-
-static char tmpbuf[256];
-
-static void
-adorn_decl (decl, str)
- tree decl;
- char *str;
-{
- enum tree_code code = TREE_CODE (decl);
-
- if (code == ARRAY_REF)
- {
- tree an_int_cst = TREE_OPERAND (decl, 1);
-
- if (an_int_cst && TREE_CODE (an_int_cst) == INTEGER_CST)
- sprintf (str + strlen (str), "[%d]", TREE_INT_CST_LOW (an_int_cst));
- else
- strcat (str, "[]");
- }
-
- else if (code == ARRAY_TYPE)
- {
- tree an_int_cst = TYPE_SIZE (decl);
- tree array_of = TREE_TYPE (decl);
-
- if (an_int_cst && TREE_CODE (an_int_cst) == INTEGER_TYPE)
- sprintf (str + strlen (str), "[%d]",
- (TREE_INT_CST_LOW (an_int_cst)
- / TREE_INT_CST_LOW (TYPE_SIZE (array_of))));
- else
- strcat (str, "[]");
- }
-
- else if (code == CALL_EXPR)
- {
- tree chain = TREE_PURPOSE (TREE_OPERAND (decl, 1));
-
- strcat (str, "(");
- while (chain)
- {
- gen_declaration (chain, str);
- chain = TREE_CHAIN (chain);
- if (chain)
- strcat (str, ", ");
- }
- strcat (str, ")");
- }
-
- else if (code == FUNCTION_TYPE)
- {
- tree chain = TYPE_ARG_TYPES (decl);
-
- strcat (str, "(");
- while (chain && TREE_VALUE (chain) != void_type_node)
- {
- gen_declaration (TREE_VALUE (chain), str);
- chain = TREE_CHAIN (chain);
- if (chain && TREE_VALUE (chain) != void_type_node)
- strcat (str, ", ");
- }
- strcat (str, ")");
- }
-
- else if (code == INDIRECT_REF)
- {
- strcpy (tmpbuf, "*");
- if (TREE_TYPE (decl) && TREE_CODE (TREE_TYPE (decl)) == TREE_LIST)
- {
- tree chain;
-
- for (chain = nreverse (copy_list (TREE_TYPE (decl)));
- chain;
- chain = TREE_CHAIN (chain))
- {
- if (TREE_CODE (TREE_VALUE (chain)) == IDENTIFIER_NODE)
- {
- strcat (tmpbuf, " ");
- strcat (tmpbuf, IDENTIFIER_POINTER (TREE_VALUE (chain)));
- }
- }
- if (str[0])
- strcat (tmpbuf, " ");
- }
- strcat (tmpbuf, str);
- strcpy (str, tmpbuf);
- }
-
- else if (code == POINTER_TYPE)
- {
- strcpy (tmpbuf, "*");
- if (TREE_READONLY (decl) || TYPE_VOLATILE (decl))
- {
- if (TREE_READONLY (decl))
- strcat (tmpbuf, " const");
- if (TYPE_VOLATILE (decl))
- strcat (tmpbuf, " volatile");
- if (str[0])
- strcat (tmpbuf, " ");
- }
- strcat (tmpbuf, str);
- strcpy (str, tmpbuf);
- }
-}
-
-static char *
-gen_declarator (decl, buf, name)
- tree decl;
- char *buf;
- char *name;
-{
- if (decl)
- {
- enum tree_code code = TREE_CODE (decl);
- char *str;
- tree op;
- int wrap = 0;
-
- switch (code)
- {
- case ARRAY_REF:
- case INDIRECT_REF:
- case CALL_EXPR:
- op = TREE_OPERAND (decl, 0);
-
- /* We have a pointer to a function or array...(*)(), (*)[] */
- if ((code == ARRAY_REF || code == CALL_EXPR)
- && op && TREE_CODE (op) == INDIRECT_REF)
- wrap = 1;
-
- str = gen_declarator (op, buf, name);
-
- if (wrap)
- {
- strcpy (tmpbuf, "(");
- strcat (tmpbuf, str);
- strcat (tmpbuf, ")");
- strcpy (str, tmpbuf);
- }
-
- adorn_decl (decl, str);
- break;
-
- case ARRAY_TYPE:
- case FUNCTION_TYPE:
- case POINTER_TYPE:
- strcpy (buf, name);
- str = buf;
-
- /* This clause is done iteratively rather than recursively. */
- do
- {
- op = (is_complex_decl (TREE_TYPE (decl))
- ? TREE_TYPE (decl) : NULL_TREE);
-
- adorn_decl (decl, str);
-
- /* We have a pointer to a function or array...(*)(), (*)[] */
- if (code == POINTER_TYPE
- && op && (TREE_CODE (op) == FUNCTION_TYPE
- || TREE_CODE (op) == ARRAY_TYPE))
- {
- strcpy (tmpbuf, "(");
- strcat (tmpbuf, str);
- strcat (tmpbuf, ")");
- strcpy (str, tmpbuf);
- }
-
- decl = (is_complex_decl (TREE_TYPE (decl))
- ? TREE_TYPE (decl) : NULL_TREE);
- }
-
- while (decl && (code = TREE_CODE (decl)))
- ;
-
- break;
-
- case IDENTIFIER_NODE:
- /* Will only happen if we are processing a "raw" expr-decl. */
- strcpy (buf, IDENTIFIER_POINTER (decl));
- return buf;
- }
-
- return str;
- }
-
- else
- /* We have an abstract declarator or a _DECL node. */
- {
- strcpy (buf, name);
- return buf;
- }
-}
-
-static void
-gen_declspecs (declspecs, buf, raw)
- tree declspecs;
- char *buf;
- int raw;
-{
- if (raw)
- {
- tree chain;
-
- for (chain = nreverse (copy_list (declspecs));
- chain; chain = TREE_CHAIN (chain))
- {
- tree aspec = TREE_VALUE (chain);
-
- if (TREE_CODE (aspec) == IDENTIFIER_NODE)
- strcat (buf, IDENTIFIER_POINTER (aspec));
- else if (TREE_CODE (aspec) == RECORD_TYPE)
- {
- if (TYPE_NAME (aspec))
- {
- tree protocol_list = TYPE_PROTOCOL_LIST (aspec);
-
- if (! TREE_STATIC_TEMPLATE (aspec))
- strcat (buf, "struct ");
- strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (aspec)));
-
- /* NEW!!! */
- if (protocol_list)
- {
- tree chain = protocol_list;
-
- strcat (buf, " <");
- while (chain)
- {
- strcat (buf,
- IDENTIFIER_POINTER
- (PROTOCOL_NAME (TREE_VALUE (chain))));
- chain = TREE_CHAIN (chain);
- if (chain)
- strcat (buf, ", ");
- }
- strcat (buf, ">");
- }
- }
-
- else
- strcat (buf, "untagged struct");
- }
-
- else if (TREE_CODE (aspec) == UNION_TYPE)
- {
- if (TYPE_NAME (aspec))
- {
- if (! TREE_STATIC_TEMPLATE (aspec))
- strcat (buf, "union ");
- strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (aspec)));
- }
- else
- strcat (buf, "untagged union");
- }
-
- else if (TREE_CODE (aspec) == ENUMERAL_TYPE)
- {
- if (TYPE_NAME (aspec))
- {
- if (! TREE_STATIC_TEMPLATE (aspec))
- strcat (buf, "enum ");
- strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (aspec)));
- }
- else
- strcat (buf, "untagged enum");
- }
-
- else if (TREE_CODE (aspec) == TYPE_DECL && DECL_NAME (aspec))
- strcat (buf, IDENTIFIER_POINTER (DECL_NAME (aspec)));
-
- else if (IS_ID (aspec))
- {
- tree protocol_list = TYPE_PROTOCOL_LIST (aspec);
-
- strcat (buf, "id");
- if (protocol_list)
- {
- tree chain = protocol_list;
-
- strcat (buf, " <");
- while (chain)
- {
- strcat (buf,
- IDENTIFIER_POINTER
- (PROTOCOL_NAME (TREE_VALUE (chain))));
- chain = TREE_CHAIN (chain);
- if (chain)
- strcat (buf, ", ");
- }
- strcat (buf, ">");
- }
- }
- if (TREE_CHAIN (chain))
- strcat (buf, " ");
- }
- }
- else
- {
- /* Type qualifiers. */
- if (TREE_READONLY (declspecs))
- strcat (buf, "const ");
- if (TYPE_VOLATILE (declspecs))
- strcat (buf, "volatile ");
-
- switch (TREE_CODE (declspecs))
- {
- /* Type specifiers. */
-
- case INTEGER_TYPE:
- declspecs = TYPE_MAIN_VARIANT (declspecs);
-
- /* Signed integer types. */
-
- if (declspecs == short_integer_type_node)
- strcat (buf, "short int ");
- else if (declspecs == integer_type_node)
- strcat (buf, "int ");
- else if (declspecs == long_integer_type_node)
- strcat (buf, "long int ");
- else if (declspecs == long_long_integer_type_node)
- strcat (buf, "long long int ");
- else if (declspecs == signed_char_type_node
- || declspecs == char_type_node)
- strcat (buf, "char ");
-
- /* Unsigned integer types. */
-
- else if (declspecs == short_unsigned_type_node)
- strcat (buf, "unsigned short ");
- else if (declspecs == unsigned_type_node)
- strcat (buf, "unsigned int ");
- else if (declspecs == long_unsigned_type_node)
- strcat (buf, "unsigned long ");
- else if (declspecs == long_long_unsigned_type_node)
- strcat (buf, "unsigned long long ");
- else if (declspecs == unsigned_char_type_node)
- strcat (buf, "unsigned char ");
- break;
-
- case REAL_TYPE:
- declspecs = TYPE_MAIN_VARIANT (declspecs);
-
- if (declspecs == float_type_node)
- strcat (buf, "float ");
- else if (declspecs == double_type_node)
- strcat (buf, "double ");
- else if (declspecs == long_double_type_node)
- strcat (buf, "long double ");
- break;
-
- case RECORD_TYPE:
- if (TYPE_NAME (declspecs)
- && TREE_CODE (TYPE_NAME (declspecs)) == IDENTIFIER_NODE)
- {
- tree protocol_list = TYPE_PROTOCOL_LIST (declspecs);
-
- if (! TREE_STATIC_TEMPLATE (declspecs))
- strcat (buf, "struct ");
- strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (declspecs)));
-
- if (protocol_list)
- {
- tree chain = protocol_list;
-
- strcat (buf, " <");
- while (chain)
- {
- strcat (buf,
- IDENTIFIER_POINTER
- (PROTOCOL_NAME (TREE_VALUE (chain))));
- chain = TREE_CHAIN (chain);
- if (chain)
- strcat (buf, ", ");
- }
- strcat (buf, ">");
- }
- }
-
- else
- strcat (buf, "untagged struct");
-
- strcat (buf, " ");
- break;
-
- case UNION_TYPE:
- if (TYPE_NAME (declspecs)
- && TREE_CODE (TYPE_NAME (declspecs)) == IDENTIFIER_NODE)
- {
- strcat (buf, "union ");
- strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (declspecs)));
- strcat (buf, " ");
- }
-
- else
- strcat (buf, "untagged union ");
- break;
-
- case ENUMERAL_TYPE:
- if (TYPE_NAME (declspecs)
- && TREE_CODE (TYPE_NAME (declspecs)) == IDENTIFIER_NODE)
- {
- strcat (buf, "enum ");
- strcat (buf, IDENTIFIER_POINTER (TYPE_NAME (declspecs)));
- strcat (buf, " ");
- }
-
- else
- strcat (buf, "untagged enum ");
- break;
-
- case VOID_TYPE:
- strcat (buf, "void ");
- break;
-
- case POINTER_TYPE:
- {
- tree protocol_list = TYPE_PROTOCOL_LIST (declspecs);
-
- strcat (buf, "id");
- if (protocol_list)
- {
- tree chain = protocol_list;
-
- strcat (buf, " <");
- while (chain)
- {
- strcat (buf,
- IDENTIFIER_POINTER
- (PROTOCOL_NAME (TREE_VALUE (chain))));
- chain = TREE_CHAIN (chain);
- if (chain)
- strcat (buf, ", ");
- }
-
- strcat (buf, ">");
- }
- }
- }
- }
-}
-
-static char *
-gen_declaration (atype_or_adecl, buf)
- tree atype_or_adecl;
- char *buf;
-{
- char declbuf[256];
-
- if (TREE_CODE (atype_or_adecl) == TREE_LIST)
- {
- tree declspecs; /* "identifier_node", "record_type" */
- tree declarator; /* "array_ref", "indirect_ref", "call_expr"... */
-
- /* We have a "raw", abstract declarator (typename). */
- declarator = TREE_VALUE (atype_or_adecl);
- declspecs = TREE_PURPOSE (atype_or_adecl);
-
- gen_declspecs (declspecs, buf, 1);
- if (declarator)
- {
- strcat (buf, " ");
- strcat (buf, gen_declarator (declarator, declbuf, ""));
- }
- }
-
- else
- {
- tree atype;
- tree declspecs; /* "integer_type", "real_type", "record_type"... */
- tree declarator; /* "array_type", "function_type", "pointer_type". */
-
- if (TREE_CODE (atype_or_adecl) == FIELD_DECL
- || TREE_CODE (atype_or_adecl) == PARM_DECL
- || TREE_CODE (atype_or_adecl) == FUNCTION_DECL)
- atype = TREE_TYPE (atype_or_adecl);
- else
- /* Assume we have a *_type node. */
- atype = atype_or_adecl;
-
- if (is_complex_decl (atype))
- {
- tree chain;
-
- /* Get the declaration specifier; it is at the end of the list. */
- declarator = chain = atype;
- do
- chain = TREE_TYPE (chain); /* not TREE_CHAIN (chain); */
- while (is_complex_decl (chain));
- declspecs = chain;
- }
-
- else
- {
- declspecs = atype;
- declarator = NULL_TREE;
- }
-
- gen_declspecs (declspecs, buf, 0);
-
- if (TREE_CODE (atype_or_adecl) == FIELD_DECL
- || TREE_CODE (atype_or_adecl) == PARM_DECL
- || TREE_CODE (atype_or_adecl) == FUNCTION_DECL)
- {
- char *decl_name = (DECL_NAME (atype_or_adecl)
- ? IDENTIFIER_POINTER (DECL_NAME (atype_or_adecl))
- : "");
-
- if (declarator)
- {
- strcat (buf, " ");
- strcat (buf, gen_declarator (declarator, declbuf, decl_name));
- }
-
- else if (decl_name[0])
- {
- strcat (buf, " ");
- strcat (buf, decl_name);
- }
- }
- else if (declarator)
- {
- strcat (buf, " ");
- strcat (buf, gen_declarator (declarator, declbuf, ""));
- }
- }
-
- return buf;
-}
-
-#define RAW_TYPESPEC(meth) (TREE_VALUE (TREE_PURPOSE (TREE_TYPE (meth))))
-
-static char *
-gen_method_decl (method, buf)
- tree method;
- char *buf;
-{
- tree chain;
-
- if (RAW_TYPESPEC (method) != objc_object_reference)
- {
- strcpy (buf, "(");
- gen_declaration (TREE_TYPE (method), buf);
- strcat (buf, ")");
- }
-
- chain = METHOD_SEL_ARGS (method);
- if (chain)
- {
- /* We have a chain of keyword_decls. */
- do
- {
- if (KEYWORD_KEY_NAME (chain))
- strcat (buf, IDENTIFIER_POINTER (KEYWORD_KEY_NAME (chain)));
-
- strcat (buf, ":");
- if (RAW_TYPESPEC (chain) != objc_object_reference)
- {
- strcat (buf, "(");
- gen_declaration (TREE_TYPE (chain), buf);
- strcat (buf, ")");
- }
-
- strcat (buf, IDENTIFIER_POINTER (KEYWORD_ARG_NAME (chain)));
- if ((chain = TREE_CHAIN (chain)))
- strcat (buf, " ");
- }
- while (chain);
-
- if (METHOD_ADD_ARGS (method) == (tree)1)
- strcat (buf, ", ...");
- else if (METHOD_ADD_ARGS (method))
- {
- /* We have a tree list node as generate by get_parm_info. */
- chain = TREE_PURPOSE (METHOD_ADD_ARGS (method));
-
- /* Know we have a chain of parm_decls. */
- while (chain)
- {
- strcat (buf, ", ");
- gen_declaration (chain, buf);
- chain = TREE_CHAIN (chain);
- }
- }
- }
-
- else
- /* We have a unary selector. */
- strcat (buf, IDENTIFIER_POINTER (METHOD_SEL_NAME (method)));
-
- return buf;
-}
-
-/* Debug info. */
-
-static void
-dump_interface (fp, chain)
- FILE *fp;
- tree chain;
-{
- char *buf = (char *)xmalloc (256);
- char *my_name = IDENTIFIER_POINTER (CLASS_NAME (chain));
- tree ivar_decls = CLASS_RAW_IVARS (chain);
- tree nst_methods = CLASS_NST_METHODS (chain);
- tree cls_methods = CLASS_CLS_METHODS (chain);
-
- fprintf (fp, "\n@interface %s", my_name);
-
- if (CLASS_SUPER_NAME (chain))
- {
- char *super_name = IDENTIFIER_POINTER (CLASS_SUPER_NAME (chain));
- fprintf (fp, " : %s\n", super_name);
- }
- else
- fprintf (fp, "\n");
-
- if (ivar_decls)
- {
- fprintf (fp, "{\n");
- do
- {
- bzero (buf, 256);
- fprintf (fp, "\t%s;\n", gen_declaration (ivar_decls, buf));
- ivar_decls = TREE_CHAIN (ivar_decls);
- }
- while (ivar_decls);
- fprintf (fp, "}\n");
- }
-
- while (nst_methods)
- {
- bzero (buf, 256);
- fprintf (fp, "- %s;\n", gen_method_decl (nst_methods, buf));
- nst_methods = TREE_CHAIN (nst_methods);
- }
-
- while (cls_methods)
- {
- bzero (buf, 256);
- fprintf (fp, "+ %s;\n", gen_method_decl (cls_methods, buf));
- cls_methods = TREE_CHAIN (cls_methods);
- }
- fprintf (fp, "\n@end");
-}
-
-static void
-init_objc ()
-{
- /* Add the special tree codes of Objective C to the tables. */
-
-#define LAST_CODE LAST_AND_UNUSED_TREE_CODE
-
- gcc_obstack_init (&util_obstack);
- util_firstobj = (char *) obstack_finish (&util_obstack);
-
- tree_code_type
- = (char **) xrealloc (tree_code_type,
- sizeof (char *) * LAST_OBJC_TREE_CODE);
- tree_code_length
- = (int *) xrealloc (tree_code_length,
- sizeof (int) * LAST_OBJC_TREE_CODE);
- tree_code_name
- = (char **) xrealloc (tree_code_name,
- sizeof (char *) * LAST_OBJC_TREE_CODE);
- bcopy ((char *) objc_tree_code_type,
- (char *) (tree_code_type + (int) LAST_CODE),
- (((int) LAST_OBJC_TREE_CODE - (int) LAST_CODE)
- * sizeof (char *)));
- bcopy ((char *) objc_tree_code_length,
- (char *) (tree_code_length + (int) LAST_CODE),
- (((int) LAST_OBJC_TREE_CODE - (int) LAST_CODE)
- * sizeof (int)));
- bcopy ((char *) objc_tree_code_name,
- (char *) (tree_code_name + (int) LAST_CODE),
- (((int) LAST_OBJC_TREE_CODE - (int) LAST_CODE)
- * sizeof (char *)));
-
- errbuf = (char *)xmalloc (BUFSIZE);
- hash_init ();
- synth_module_prologue ();
-}
-
-static void
-finish_objc ()
-{
- struct imp_entry *impent;
- tree chain;
- /* The internally generated initializers appear to have missing braces.
- Don't warn about this. */
- int save_warn_missing_braces = warn_missing_braces;
- warn_missing_braces = 0;
-
- generate_forward_declaration_to_string_table ();
-
-#ifdef OBJC_PROLOGUE
- OBJC_PROLOGUE;
-#endif
-
- /* Process the static instances here because initialization of objc_symtab
- dependens on them. */
- if (objc_static_instances)
- generate_static_references ();
-
- if (implementation_context || class_names_chain
- || meth_var_names_chain || meth_var_types_chain || sel_ref_chain)
- generate_objc_symtab_decl ();
-
- for (impent = imp_list; impent; impent = impent->next)
- {
- implementation_context = impent->imp_context;
- implementation_template = impent->imp_template;
-
- UOBJC_CLASS_decl = impent->class_decl;
- UOBJC_METACLASS_decl = impent->meta_decl;
-
- if (TREE_CODE (implementation_context) == CLASS_IMPLEMENTATION_TYPE)
- {
- /* all of the following reference the string pool... */
- generate_ivar_lists ();
- generate_dispatch_tables ();
- generate_shared_structures ();
- }
- else
- {
- generate_dispatch_tables ();
- generate_category (implementation_context);
- }
- }
-
- /* If we are using an array of selectors, we must always
- finish up the array decl even if no selectors were used. */
- if (! flag_next_runtime || sel_ref_chain)
- build_selector_translation_table ();
-
- if (protocol_chain)
- generate_protocols ();
-
- if (implementation_context || class_names_chain || objc_static_instances
- || meth_var_names_chain || meth_var_types_chain || sel_ref_chain)
- {
- /* Arrange for Objc data structures to be initialized at run time. */
- char *init_name = build_module_descriptor ();
- if (init_name)
- assemble_constructor (init_name);
- }
-
- /* Dump the class references. This forces the appropriate classes
- to be linked into the executable image, preserving unix archive
- semantics. This can be removed when we move to a more dynamically
- linked environment. */
-
- for (chain = cls_ref_chain; chain; chain = TREE_CHAIN (chain))
- {
- handle_class_ref (chain);
- if (TREE_PURPOSE (chain))
- generate_classref_translation_entry (chain);
- }
-
- for (impent = imp_list; impent; impent = impent->next)
- handle_impent (impent);
-
- /* Dump the string table last. */
-
- generate_strings ();
-
- if (flag_gen_declaration)
- {
- add_class (implementation_context);
- dump_interface (gen_declaration_file, implementation_context);
- }
-
- if (warn_selector)
- {
- int slot;
- hash hsh;
-
- /* Run through the selector hash tables and print a warning for any
- selector which has multiple methods. */
-
- for (slot = 0; slot < SIZEHASHTABLE; slot++)
- for (hsh = cls_method_hash_list[slot]; hsh; hsh = hsh->next)
- if (hsh->list)
- {
- tree meth = hsh->key;
- char type = (TREE_CODE (meth) == INSTANCE_METHOD_DECL
- ? '-' : '+');
- attr loop;
-
- warning ("potential selector conflict for method `%s'",
- IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
- warn_with_method ("found", type, meth);
- for (loop = hsh->list; loop; loop = loop->next)
- warn_with_method ("found", type, loop->value);
- }
-
- for (slot = 0; slot < SIZEHASHTABLE; slot++)
- for (hsh = nst_method_hash_list[slot]; hsh; hsh = hsh->next)
- if (hsh->list)
- {
- tree meth = hsh->key;
- char type = (TREE_CODE (meth) == INSTANCE_METHOD_DECL
- ? '-' : '+');
- attr loop;
-
- warning ("potential selector conflict for method `%s'",
- IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
- warn_with_method ("found", type, meth);
- for (loop = hsh->list; loop; loop = loop->next)
- warn_with_method ("found", type, loop->value);
- }
- }
-
- warn_missing_braces = save_warn_missing_braces;
-}
-
-/* Subroutines of finish_objc. */
-
-static void
-generate_classref_translation_entry (chain)
- tree chain;
-{
- tree expr, name, decl_specs, decl, sc_spec;
- tree type;
-
- type = TREE_TYPE (TREE_PURPOSE (chain));
-
- expr = add_objc_string (TREE_VALUE (chain), class_names);
- expr = build_c_cast (type, expr); /* cast! */
-
- name = DECL_NAME (TREE_PURPOSE (chain));
-
- sc_spec = build_tree_list (NULL_TREE, ridpointers[(int) RID_STATIC]);
-
- /* static struct objc_class * _OBJC_CLASS_REFERENCES_n = ...; */
- decl_specs = tree_cons (NULL_TREE, type, sc_spec);
-
- /* The decl that is returned from start_decl is the one that we
- forward declared in build_class_reference. */
- decl = start_decl (name, decl_specs, 1, NULL_TREE, NULL_TREE);
- finish_decl (decl, expr, NULL_TREE);
- return;
-}
-
-static void
-handle_class_ref (chain)
- tree chain;
-{
- char *name = IDENTIFIER_POINTER (TREE_VALUE (chain));
- if (! flag_next_runtime)
- {
- tree decl;
- char *string = (char *) alloca (strlen (name) + 30);
- tree exp;
-
- sprintf (string, "%sobjc_class_name_%s",
- (flag_next_runtime ? "." : "__"), name);
-
- /* Make a decl for this name, so we can use its address in a tree. */
- decl = build_decl (VAR_DECL, get_identifier (string), char_type_node);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
-
- pushdecl (decl);
- rest_of_decl_compilation (decl, 0, 0, 0);
-
- /* Make following constant read-only (why not)? */
- readonly_data_section ();
-
- exp = build1 (ADDR_EXPR, string_type_node, decl);
-
- /* Align the section properly. */
- assemble_constant_align (exp);
-
- /* Inform the assembler about this new external thing. */
- assemble_external (decl);
-
- /* Output a constant to reference this address. */
- output_constant (exp, int_size_in_bytes (string_type_node));
- }
- else
- {
- /* This overreliance on our assembler (i.e. lack of portability)
- should be dealt with at some point. The GNU strategy (above)
- won't work either, but it is a start. */
- char *string = (char *) alloca (strlen (name) + 30);
- sprintf (string, ".reference .objc_class_name_%s", name);
- assemble_asm (my_build_string (strlen (string) + 1, string));
- }
-}
-
-static void
-handle_impent (impent)
- struct imp_entry *impent;
-{
- implementation_context = impent->imp_context;
- implementation_template = impent->imp_template;
-
- if (TREE_CODE (impent->imp_context) == CLASS_IMPLEMENTATION_TYPE)
- {
- char *class_name = IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
- char *string = (char *) alloca (strlen (class_name) + 30);
-
- if (flag_next_runtime)
- {
- /* Grossly unportable.
- People should know better than to assume
- such things about assembler syntax! */
- sprintf (string, ".objc_class_name_%s=0", class_name);
- assemble_asm (my_build_string (strlen (string) + 1, string));
-
- sprintf (string, ".globl .objc_class_name_%s", class_name);
- assemble_asm (my_build_string (strlen (string) + 1, string));
- }
-
- else
- {
- sprintf (string, "%sobjc_class_name_%s",
- (flag_next_runtime ? "." : "__"), class_name);
- assemble_global (string);
- assemble_label (string);
- }
- }
-
- else if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
- {
- char *class_name = IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
- char *class_super_name
- = IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context));
- char *string = (char *) alloca (strlen (class_name)
- + strlen (class_super_name) + 30);
-
- /* Do the same for categories. Even though no references to these
- symbols are generated automatically by the compiler, it gives
- you a handle to pull them into an archive by hand. */
- if (flag_next_runtime)
- {
- /* Grossly unportable. */
- sprintf (string, ".objc_category_name_%s_%s=0",
- class_name, class_super_name);
- assemble_asm (my_build_string (strlen (string) + 1, string));
-
- sprintf (string, ".globl .objc_category_name_%s_%s",
- class_name, class_super_name);
- assemble_asm (my_build_string (strlen (string) + 1, string));
- }
-
- else
- {
- sprintf (string, "%sobjc_category_name_%s_%s",
- (flag_next_runtime ? "." : "__"),
- class_name, class_super_name);
- assemble_global (string);
- assemble_label (string);
- }
- }
-}
-
-#ifdef DEBUG
-
-static void
-objc_debug (fp)
- FILE *fp;
-{
- char *buf = (char *)xmalloc (256);
-
- { /* dump function prototypes */
- tree loop = UOBJC_MODULES_decl;
-
- fprintf (fp, "\n\nfunction prototypes:\n");
- while (loop)
- {
- if (TREE_CODE (loop) == FUNCTION_DECL && DECL_INITIAL (loop))
- {
- /* We have a function definition: generate prototype. */
- bzero (errbuf, BUFSIZE);
- gen_declaration (loop, errbuf);
- fprintf (fp, "%s;\n", errbuf);
- }
- loop = TREE_CHAIN (loop);
- }
- }
- {
- /* Dump global chains. */
- tree loop;
- int i, index = 0, offset = 0;
- hash hashlist;
-
- for (i = 0; i < SIZEHASHTABLE; i++)
- {
- if (hashlist = nst_method_hash_list[i])
- {
- fprintf (fp, "\n\nnst_method_hash_list[%d]:\n", i);
- do
- {
- bzero (buf, 256);
- fprintf (fp, "-%s;\n", gen_method_decl (hashlist->key, buf));
- hashlist = hashlist->next;
- }
- while (hashlist);
- }
- }
-
- for (i = 0; i < SIZEHASHTABLE; i++)
- {
- if (hashlist = cls_method_hash_list[i])
- {
- fprintf (fp, "\n\ncls_method_hash_list[%d]:\n", i);
- do
- {
- bzero (buf, 256);
- fprintf (fp, "-%s;\n", gen_method_decl (hashlist->key, buf));
- hashlist = hashlist->next;
- }
- while (hashlist);
- }
- }
-
- fprintf (fp, "\nsel_refdef_chain:\n");
- for (loop = sel_refdef_chain; loop; loop = TREE_CHAIN (loop))
- {
- fprintf (fp, "(index: %4d offset: %4d) %s\n", index, offset,
- IDENTIFIER_POINTER (TREE_VALUE (loop)));
- index++;
- /* add one for the '\0' character */
- offset += IDENTIFIER_LENGTH (TREE_VALUE (loop)) + 1;
- }
-
- fprintf (fp, "\n (max_selector_index: %4d.\n", max_selector_index);
- }
-}
-#endif
-
-void
-print_lang_statistics ()
-{
-}
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
deleted file mode 100644
index 65224de84f4..00000000000
--- a/gcc/objc/objc-act.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Declarations for objc-act.c.
- Copyright (C) 1990 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. */
-
-
-/*** Public Interface (procedures) ***/
-
-/* used by yyparse */
-
-void finish_file PROTO((void));
-tree start_class PROTO((enum tree_code, tree, tree, tree));
-tree continue_class PROTO((tree));
-void finish_class PROTO((tree));
-void start_method_def PROTO((tree));
-void continue_method_def PROTO((void));
-void finish_method_def PROTO((void));
-tree start_protocol PROTO((enum tree_code, tree, tree));
-void finish_protocol PROTO((tree));
-void add_objc_decls PROTO((void));
-
-tree is_ivar PROTO((tree, tree));
-int is_private PROTO((tree));
-int is_public PROTO((tree, tree));
-tree add_instance_variable PROTO((tree, int, tree, tree, tree));
-tree add_class_method PROTO((tree, tree));
-tree add_instance_method PROTO((tree, tree));
-tree get_super_receiver PROTO((void));
-tree get_class_ivars PROTO((tree));
-tree get_class_reference PROTO((tree));
-tree get_static_reference PROTO((tree, tree));
-tree get_object_reference PROTO((tree));
-tree build_message_expr PROTO((tree));
-tree build_selector_expr PROTO((tree));
-tree build_ivar_reference PROTO((tree));
-tree build_keyword_decl PROTO((tree, tree, tree));
-tree build_method_decl PROTO((enum tree_code, tree, tree, tree));
-tree build_protocol_expr PROTO((tree));
-tree build_objc_string_object PROTO((tree));
-
-extern tree objc_ivar_chain;
-extern tree objc_method_context;
-
-void objc_declare_alias PROTO((tree, tree));
-void objc_declare_class PROTO((tree));
-
-extern int objc_receiver_context;
-
-/* the following routines are used to implement statically typed objects */
-
-int objc_comptypes PROTO((tree, tree, int));
-void objc_check_decl PROTO((tree));
-
-/* NeXT extensions */
-
-tree build_encode_expr PROTO((tree));
-
-/* Objective-C structures */
-
-/* KEYWORD_DECL */
-#define KEYWORD_KEY_NAME(DECL) ((DECL)->decl.name)
-#define KEYWORD_ARG_NAME(DECL) ((DECL)->decl.arguments)
-
-/* INSTANCE_METHOD_DECL, CLASS_METHOD_DECL */
-#define METHOD_SEL_NAME(DECL) ((DECL)->decl.name)
-#define METHOD_SEL_ARGS(DECL) ((DECL)->decl.arguments)
-#define METHOD_ADD_ARGS(DECL) ((DECL)->decl.result)
-#define METHOD_DEFINITION(DECL) ((DECL)->decl.initial)
-#define METHOD_ENCODING(DECL) ((DECL)->decl.context)
-
-/* CLASS_INTERFACE_TYPE, CLASS_IMPLEMENTATION_TYPE,
- CATEGORY_INTERFACE_TYPE, CATEGORY_IMPLEMENTATION_TYPE,
- PROTOCOL_INTERFACE_TYPE */
-#define CLASS_NAME(CLASS) ((CLASS)->type.name)
-#define CLASS_SUPER_NAME(CLASS) ((CLASS)->type.context)
-#define CLASS_IVARS(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 0)
-#define CLASS_RAW_IVARS(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 1)
-#define CLASS_NST_METHODS(CLASS) ((CLASS)->type.minval)
-#define CLASS_CLS_METHODS(CLASS) ((CLASS)->type.maxval)
-#define CLASS_STATIC_TEMPLATE(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 2)
-#define CLASS_CATEGORY_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 3)
-#define CLASS_PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 4)
-#define PROTOCOL_NAME(CLASS) ((CLASS)->type.name)
-#define PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 0)
-#define PROTOCOL_NST_METHODS(CLASS) ((CLASS)->type.minval)
-#define PROTOCOL_CLS_METHODS(CLASS) ((CLASS)->type.maxval)
-#define PROTOCOL_FORWARD_DECL(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 1)
-#define TYPE_PROTOCOL_LIST(TYPE) ((TYPE)->type.context)
-
-/* Define the Objective-C or Objective-C++ language-specific tree codes. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
-enum objc_tree_code {
-#ifdef OBJCPLUS
- dummy_tree_code = LAST_CPLUS_TREE_CODE,
-#else
- dummy_tree_code = LAST_AND_UNUSED_TREE_CODE,
-#endif
-#include "objc-tree.def"
- LAST_OBJC_TREE_CODE
-};
-#undef DEFTREECODE
diff --git a/gcc/objc/objc-api.h b/gcc/objc/objc-api.h
deleted file mode 100644
index 2f5e8deb2b1..00000000000
--- a/gcc/objc/objc-api.h
+++ /dev/null
@@ -1,582 +0,0 @@
-/* GNU Objective-C Runtime API.
- Copyright (C) 1993, 1995, 1996, 1997 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
-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. */
-
-/* As a special exception, if you link this library with files compiled
- with GCC to produce an executable, this does not 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 __objc_api_INCLUDE_GNU
-#define __objc_api_INCLUDE_GNU
-
-#include "objc/objc.h"
-#include "objc/hash.h"
-#include "objc/thr.h"
-#include <stdio.h>
-#include <stdarg.h>
-
-/* For functions which return Method_t */
-#define METHOD_NULL (Method_t)0
- /* Boolean typedefs */
-/*
-** Method descriptor returned by introspective Object methods.
-** This is really just the first part of the more complete objc_method
-** structure defined below and used internally by the runtime.
-*/
-struct objc_method_description
-{
- SEL name; /* this is a selector, not a string */
- char *types; /* type encoding */
-};
-
-/* Filer types used to describe Ivars and Methods. */
-#define _C_ID '@'
-#define _C_CLASS '#'
-#define _C_SEL ':'
-#define _C_CHR 'c'
-#define _C_UCHR 'C'
-#define _C_SHT 's'
-#define _C_USHT 'S'
-#define _C_INT 'i'
-#define _C_UINT 'I'
-#define _C_LNG 'l'
-#define _C_ULNG 'L'
-#define _C_FLT 'f'
-#define _C_DBL 'd'
-#define _C_BFLD 'b'
-#define _C_VOID 'v'
-#define _C_UNDEF '?'
-#define _C_PTR '^'
-#define _C_CHARPTR '*'
-#define _C_ATOM '%'
-#define _C_ARY_B '['
-#define _C_ARY_E ']'
-#define _C_UNION_B '('
-#define _C_UNION_E ')'
-#define _C_STRUCT_B '{'
-#define _C_STRUCT_E '}'
-
-
-/*
-** Error handling
-**
-** Call objc_error() or objc_verror() to record an error; this error
-** routine will generally exit the program but not necessarily if the
-** user has installed his own error handler.
-**
-** Call objc_set_error_handler to assign your own function for
-** handling errors. The function should return YES if it is ok
-** to continue execution, or return NO or just abort if the
-** program should be stopped. The default error handler is just to
-** print a message on stderr.
-**
-** The error handler function should be of type objc_error_handler
-** The first parameter is an object instance of relevance.
-** The second parameter is an error code.
-** The third parameter is a format string in the printf style.
-** The fourth parameter is a variable list of arguments.
-*/
-extern void objc_error(id object, int code, const char* fmt, ...);
-extern void objc_verror(id object, int code, const char* fmt, va_list ap);
-typedef BOOL (*objc_error_handler)(id, int code, const char *fmt, va_list ap);
-objc_error_handler objc_set_error_handler(objc_error_handler func);
-
-/*
-** Error codes
-** These are used by the runtime library, and your
-** error handling may use them to determine if the error is
-** hard or soft thus whether execution can continue or abort.
-*/
-#define OBJC_ERR_UNKNOWN 0 /* Generic error */
-
-#define OBJC_ERR_OBJC_VERSION 1 /* Incorrect runtime version */
-#define OBJC_ERR_GCC_VERSION 2 /* Incorrect compiler version */
-#define OBJC_ERR_MODULE_SIZE 3 /* Bad module size */
-#define OBJC_ERR_PROTOCOL_VERSION 4 /* Incorrect protocol version */
-
-#define OBJC_ERR_MEMORY 10 /* Out of memory */
-
-#define OBJC_ERR_RECURSE_ROOT 20 /* Attempt to archive the root
- object more than once. */
-#define OBJC_ERR_BAD_DATA 21 /* Didn't read expected data */
-#define OBJC_ERR_BAD_KEY 22 /* Bad key for object */
-#define OBJC_ERR_BAD_CLASS 23 /* Unknown class */
-#define OBJC_ERR_BAD_TYPE 24 /* Bad type specification */
-#define OBJC_ERR_NO_READ 25 /* Cannot read stream */
-#define OBJC_ERR_NO_WRITE 26 /* Cannot write stream */
-#define OBJC_ERR_STREAM_VERSION 27 /* Incorrect stream version */
-#define OBJC_ERR_BAD_OPCODE 28 /* Bad opcode */
-
-#define OBJC_ERR_UNIMPLEMENTED 30 /* Method is not implemented */
-
-/*
-** Set this variable nonzero to print a line describing each
-** message that is sent. (this is currently disabled)
-*/
-extern BOOL objc_trace;
-
-
-/* For every class which happens to have statically allocated instances in
- this module, one OBJC_STATIC_INSTANCES is allocated by the compiler.
- INSTANCES is NULL terminated and points to all statically allocated
- instances of this class. */
-struct objc_static_instances
-{
- char *class_name;
- id instances[0];
-};
-
-/*
-** Whereas a Module (defined further down) is the root (typically) of a file,
-** a Symtab is the root of the class and category definitions within the
-** module.
-**
-** A Symtab contains a variable length array of pointers to classes and
-** categories defined in the module.
-*/
-typedef struct objc_symtab {
- unsigned long sel_ref_cnt; /* Unknown. */
- SEL refs; /* Unknown. */
- unsigned short cls_def_cnt; /* Number of classes compiled
- (defined) in the module. */
- unsigned short cat_def_cnt; /* Number of categories
- compiled (defined) in the
- module. */
-
- void *defs[1]; /* Variable array of pointers.
- cls_def_cnt of type Class
- followed by cat_def_cnt of
- type Category_t, followed
- by a NULL terminated array
- of objc_static_instances. */
-} Symtab, *Symtab_t;
-
-
-/*
-** The compiler generates one of these structures for each module that
-** composes the executable (eg main.m).
-**
-** This data structure is the root of the definition tree for the module.
-**
-** A collect program runs between ld stages and creates a ObjC ctor array.
-** That array holds a pointer to each module structure of the executable.
-*/
-typedef struct objc_module {
- unsigned long version; /* Compiler revision. */
- unsigned long size; /* sizeof(Module). */
- const char* name; /* Name of the file where the
- module was generated. The
- name includes the path. */
-
- Symtab_t symtab; /* Pointer to the Symtab of
- the module. The Symtab
- holds an array of
- pointers to
- the classes and categories
- defined in the module. */
-} Module, *Module_t;
-
-
-/*
-** The compiler generates one of these structures for a class that has
-** instance variables defined in its specification.
-*/
-typedef struct objc_ivar* Ivar_t;
-typedef struct objc_ivar_list {
- int ivar_count; /* Number of structures (Ivar)
- contained in the list. One
- structure per instance
- variable defined in the
- class. */
- struct objc_ivar {
- const char* ivar_name; /* Name of the instance
- variable as entered in the
- class definition. */
- const char* ivar_type; /* Description of the Ivar's
- type. Useful for
- debuggers. */
- int ivar_offset; /* Byte offset from the base
- address of the instance
- structure to the variable. */
-
- } ivar_list[1]; /* Variable length
- structure. */
-} IvarList, *IvarList_t;
-
-
-/*
-** The compiler generates one (or more) of these structures for a class that
-** has methods defined in its specification.
-**
-** The implementation of a class can be broken into separate pieces in a file
-** and categories can break them across modules. To handle this problem is a
-** singly linked list of methods.
-*/
-typedef struct objc_method Method;
-typedef Method* Method_t;
-typedef struct objc_method_list {
- struct objc_method_list* method_next; /* This variable is used to link
- a method list to another. It
- is a singly linked list. */
- int method_count; /* Number of methods defined in
- this structure. */
- struct objc_method {
- SEL method_name; /* This variable is the method's
- name. It is a char*.
- The unique integer passed to
- objc_msg_send is a char* too.
- It is compared against
- method_name using strcmp. */
- const char* method_types; /* Description of the method's
- parameter list. Useful for
- debuggers. */
- IMP method_imp; /* Address of the method in the
- executable. */
- } method_list[1]; /* Variable length
- structure. */
-} MethodList, *MethodList_t;
-
-struct objc_protocol_list {
- struct objc_protocol_list *next;
- int count;
- Protocol *list[1];
-};
-
-/*
-** This is used to assure consistent access to the info field of
-** classes
-*/
-#ifndef HOST_BITS_PER_LONG
-#define HOST_BITS_PER_LONG (sizeof(long)*8)
-#endif
-
-#define __CLS_INFO(cls) ((cls)->info)
-#define __CLS_ISINFO(cls, mask) ((__CLS_INFO(cls)&mask)==mask)
-#define __CLS_SETINFO(cls, mask) (__CLS_INFO(cls) |= mask)
-
-/* The structure is of type MetaClass */
-#define _CLS_META 0x2L
-#define CLS_ISMETA(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_META))
-
-
-/* The structure is of type Class */
-#define _CLS_CLASS 0x1L
-#define CLS_ISCLASS(cls) ((cls)&&__CLS_ISINFO(cls, _CLS_CLASS))
-
-/*
-** The class is initialized within the runtime. This means that
-** it has had correct super and sublinks assigned
-*/
-#define _CLS_RESOLV 0x8L
-#define CLS_ISRESOLV(cls) __CLS_ISINFO(cls, _CLS_RESOLV)
-#define CLS_SETRESOLV(cls) __CLS_SETINFO(cls, _CLS_RESOLV)
-
-/*
-** The class has been send a +initialize message or a such is not
-** defined for this class
-*/
-#define _CLS_INITIALIZED 0x04L
-#define CLS_ISINITIALIZED(cls) __CLS_ISINFO(cls, _CLS_INITIALIZED)
-#define CLS_SETINITIALIZED(cls) __CLS_SETINFO(cls, _CLS_INITIALIZED)
-
-/*
-** The class number of this class. This must be the same for both the
-** class and it's meta class object
-*/
-#define CLS_GETNUMBER(cls) (__CLS_INFO(cls) >> (HOST_BITS_PER_LONG/2))
-#define CLS_SETNUMBER(cls, num) \
- ({ (cls)->info <<= (HOST_BITS_PER_LONG/2); \
- (cls)->info >>= (HOST_BITS_PER_LONG/2); \
- __CLS_SETINFO(cls, (((unsigned long)num) << (HOST_BITS_PER_LONG/2))); })
-
-/*
-** The compiler generates one of these structures for each category. A class
-** may have many categories and contain both instance and factory methods.
-*/
-typedef struct objc_category {
- const char* category_name; /* Name of the category. Name
- contained in the () of the
- category definition. */
- const char* class_name; /* Name of the class to which
- the category belongs. */
- MethodList_t instance_methods; /* Linked list of instance
- methods defined in the
- category. NULL indicates no
- instance methods defined. */
- MethodList_t class_methods; /* Linked list of factory
- methods defined in the
- category. NULL indicates no
- class methods defined. */
- struct objc_protocol_list *protocols; /* List of Protocols
- conformed to */
-} Category, *Category_t;
-
-/*
-** Structure used when a message is send to a class's super class. The
-** compiler generates one of these structures and passes it to
-** objc_msg_super.
-*/
-typedef struct objc_super {
- id self; /* Id of the object sending
- the message. */
- Class class; /* Object's super class. */
-} Super, *Super_t;
-
-IMP objc_msg_lookup_super(Super_t super, SEL sel);
-
-retval_t objc_msg_sendv(id, SEL, arglist_t);
-
-
-
-/*
-** This is a hook which is called by objc_lookup_class and
-** objc_get_class if the runtime is not able to find the class.
-** This may e.g. try to load in the class using dynamic loading.
-** The function is guaranteed to be passed a non-NULL name string.
-*/
-extern Class (*_objc_lookup_class)(const char *name);
-
-/*
-** This is a hook which is called by __objc_exec_class every time a class
-** or a category is loaded into the runtime. This may e.g. help a
-** dynamic loader determine the classes that have been loaded when
-** an object file is dynamically linked in.
-*/
-extern void (*_objc_load_callback)(Class class, Category* category);
-
-/*
-** Hook functions for allocating, copying and disposing of instances
-*/
-extern id (*_objc_object_alloc)(Class class);
-extern id (*_objc_object_copy)(id object);
-extern id (*_objc_object_dispose)(id object);
-
-/*
-** Standard functions for memory allocation and disposal.
-** Users should use these functions in their ObjC programs so
-** that they work properly with garbage collectors as well as
-** can take advantage of the exception/error handling available.
-*/
-void *
-objc_malloc(size_t size);
-
-void *
-objc_atomic_malloc(size_t size);
-
-void *
-objc_valloc(size_t size);
-
-void *
-objc_realloc(void *mem, size_t size);
-
-void *
-objc_calloc(size_t nelem, size_t size);
-
-void
-objc_free(void *mem);
-
-/*
-** Hook functions for memory allocation and disposal.
-** This makes it easy to substitute garbage collection systems
-** such as Boehm's GC by assigning these function pointers
-** to the GC's allocation routines. By default these point
-** to the ANSI standard malloc, realloc, free, etc.
-**
-** Users should call the normal objc routines above for
-** memory allocation and disposal within their programs.
-*/
-extern void *(*_objc_malloc)(size_t);
-extern void *(*_objc_atomic_malloc)(size_t);
-extern void *(*_objc_valloc)(size_t);
-extern void *(*_objc_realloc)(void *, size_t);
-extern void *(*_objc_calloc)(size_t, size_t);
-extern void (*_objc_free)(void *);
-
-Method_t class_get_class_method(MetaClass class, SEL aSel);
-
-Method_t class_get_instance_method(Class class, SEL aSel);
-
-Class class_pose_as(Class impostor, Class superclass);
-
-Class objc_get_class(const char *name);
-
-Class objc_lookup_class(const char *name);
-
-Class objc_next_class(void **enum_state);
-
-const char *sel_get_name(SEL selector);
-
-const char *sel_get_type(SEL selector);
-
-SEL sel_get_uid(const char *name);
-
-SEL sel_get_any_uid(const char *name);
-
-SEL sel_get_any_typed_uid(const char *name);
-
-SEL sel_get_typed_uid(const char *name, const char*);
-
-SEL sel_register_name(const char *name);
-
-SEL sel_register_typed_name(const char *name, const char*type);
-
-
-BOOL sel_is_mapped (SEL aSel);
-
-extern id class_create_instance(Class class);
-
-/* You should call this function immediately after a bundle has loaded the
- code. This function sends the +load message to all classes/categories
- just loaded and then calls the _objc_load_callback function for each
- class/category. */
-extern void objc_send_load (void);
-
-static inline const char *
-class_get_class_name(Class class)
-{
- return CLS_ISCLASS(class)?class->name:((class==Nil)?"Nil":0);
-}
-
-static inline long
-class_get_instance_size(Class class)
-{
- return CLS_ISCLASS(class)?class->instance_size:0;
-}
-
-static inline MetaClass
-class_get_meta_class(Class class)
-{
- return CLS_ISCLASS(class)?class->class_pointer:Nil;
-}
-
-static inline Class
-class_get_super_class(Class class)
-{
- return CLS_ISCLASS(class)?class->super_class:Nil;
-}
-
-static inline int
-class_get_version(Class class)
-{
- return CLS_ISCLASS(class)?class->version:-1;
-}
-
-static inline BOOL
-class_is_class(Class class)
-{
- return CLS_ISCLASS(class);
-}
-
-static inline BOOL
-class_is_meta_class(Class class)
-{
- return CLS_ISMETA(class);
-}
-
-
-static inline void
-class_set_version(Class class, long version)
-{
- if (CLS_ISCLASS(class))
- class->version = version;
-}
-
-static inline IMP
-method_get_imp(Method_t method)
-{
- return (method!=METHOD_NULL)?method->method_imp:(IMP)0;
-}
-
-IMP get_imp (Class class, SEL sel);
-
-id object_copy(id object);
-
-id object_dispose(id object);
-
-static inline Class
-object_get_class(id object)
-{
- return ((object!=nil)
- ? (CLS_ISCLASS(object->class_pointer)
- ? object->class_pointer
- : (CLS_ISMETA(object->class_pointer)
- ? (Class)object
- : Nil))
- : Nil);
-}
-
-static inline const char *
-object_get_class_name(id object)
-{
- return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
- ?object->class_pointer->name
- :((Class)object)->name)
- :"Nil");
-}
-
-static inline MetaClass
-object_get_meta_class(id object)
-{
- return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
- ?object->class_pointer->class_pointer
- :(CLS_ISMETA(object->class_pointer)
- ?object->class_pointer
- :Nil))
- :Nil);
-}
-
-static inline Class
-object_get_super_class
-(id object)
-{
- return ((object!=nil)?(CLS_ISCLASS(object->class_pointer)
- ?object->class_pointer->super_class
- :(CLS_ISMETA(object->class_pointer)
- ?((Class)object)->super_class
- :Nil))
- :Nil);
-}
-
-static inline BOOL
-object_is_class(id object)
-{
- return CLS_ISCLASS((Class)object);
-}
-
-static inline BOOL
-object_is_instance(id object)
-{
- return (object!=nil)&&CLS_ISCLASS(object->class_pointer);
-}
-
-static inline BOOL
-object_is_meta_class(id object)
-{
- return CLS_ISMETA((Class)object);
-}
-
-struct sarray*
-objc_get_uninstalled_dtable();
-
-#endif /* not __objc_api_INCLUDE_GNU */
-
-
-
diff --git a/gcc/objc/objc-list.h b/gcc/objc/objc-list.h
deleted file mode 100644
index 19760906238..00000000000
--- a/gcc/objc/objc-list.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Generic single linked list to keep various information
- Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup.
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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 __GNU_OBJC_LIST_H
-#define __GNU_OBJC_LIST_H
-
-struct objc_list {
- void *head;
- struct objc_list *tail;
-};
-
-/* Return a cons cell produced from (head . tail) */
-
-static inline struct objc_list*
-list_cons(void* head, struct objc_list* tail)
-{
- struct objc_list* cell;
-
- cell = (struct objc_list*)objc_malloc(sizeof(struct objc_list));
- cell->head = head;
- cell->tail = tail;
- return cell;
-}
-
-/* Return the length of a list, list_length(NULL) returns zero */
-
-static inline int
-list_length(struct objc_list* list)
-{
- int i = 0;
- while(list)
- {
- i += 1;
- list = list->tail;
- }
- return i;
-}
-
-/* Return the Nth element of LIST, where N count from zero. If N
- larger than the list length, NULL is returned */
-
-static inline void*
-list_nth(int index, struct objc_list* list)
-{
- while(index-- != 0)
- {
- if(list->tail)
- list = list->tail;
- else
- return 0;
- }
- return list->head;
-}
-
-/* Remove the element at the head by replacing it by its successor */
-
-static inline void
-list_remove_head(struct objc_list** list)
-{
- if ((*list)->tail)
- {
- struct objc_list* tail = (*list)->tail; /* fetch next */
- *(*list) = *tail; /* copy next to list head */
- objc_free(tail); /* free next */
- }
- else /* only one element in list */
- {
- objc_free(*list);
- (*list) = 0;
- }
-}
-
-
-/* Remove the element with `car' set to ELEMENT */
-
-static inline void
-list_remove_elem(struct objc_list** list, void* elem)
-{
- while (*list) {
- if ((*list)->head == elem)
- list_remove_head(list);
- list = &((*list)->tail);
- }
-}
-
-/* Map FUNCTION over all elements in LIST */
-
-static inline void
-list_mapcar(struct objc_list* list, void(*function)(void*))
-{
- while(list)
- {
- (*function)(list->head);
- list = list->tail;
- }
-}
-
-/* Return element that has ELEM as car */
-
-static inline struct objc_list**
-list_find(struct objc_list** list, void* elem)
-{
- while(*list)
- {
- if ((*list)->head == elem)
- return list;
- list = &((*list)->tail);
- }
- return NULL;
-}
-
-/* Free list (backwards recursive) */
-
-static void
-list_free(struct objc_list* list)
-{
- if(list)
- {
- list_free(list->tail);
- objc_free(list);
- }
-}
-#endif __GNU_OBJC_LIST_H
diff --git a/gcc/objc/objc-tree.def b/gcc/objc/objc-tree.def
deleted file mode 100644
index 03f0c715776..00000000000
--- a/gcc/objc/objc-tree.def
+++ /dev/null
@@ -1,37 +0,0 @@
-/* This file contains the definitions and documentation for the
- additional tree codes used in the Objective C front end (see tree.def
- for the standard codes).
- Copyright (C) 1990 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. */
-
-
-/* Objective-C types. */
-DEFTREECODE (CLASS_INTERFACE_TYPE, "class_interface_type", "t", 0)
-DEFTREECODE (CLASS_IMPLEMENTATION_TYPE, "class_implementation_type", "t", 0)
-DEFTREECODE (CATEGORY_INTERFACE_TYPE, "category_interface_type", "t", 0)
-DEFTREECODE (CATEGORY_IMPLEMENTATION_TYPE,"category_implementation_type","t",0)
-DEFTREECODE (PROTOCOL_INTERFACE_TYPE, "protocol_interface_type", "t", 0)
-
-/* Objective-C decls. */
-DEFTREECODE (KEYWORD_DECL, "keyword_decl", "d", 0)
-DEFTREECODE (INSTANCE_METHOD_DECL, "instance_method_decl", "d", 0)
-DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", "d", 0)
-
-/* Objective-C constants. */
-DEFTREECODE (OBJC_STRING_CST, "objc_string_cst", "c", 3)
diff --git a/gcc/objc/objc.gperf b/gcc/objc/objc.gperf
deleted file mode 100644
index 407459f1589..00000000000
--- a/gcc/objc/objc.gperf
+++ /dev/null
@@ -1,64 +0,0 @@
-%{
-/* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ objc.gperf */
-%}
-struct resword { char *name; short token; enum rid rid; };
-%%
-@defs, DEFS, NORID
-@encode, ENCODE, NORID
-@end, END, NORID
-@implementation, IMPLEMENTATION, NORID
-@interface, INTERFACE, NORID
-@public, PUBLIC, NORID
-@selector, SELECTOR, NORID
-__alignof, ALIGNOF, NORID
-__alignof__, ALIGNOF, NORID
-__asm, ASM, NORID
-__asm__, ASM, NORID
-__attribute, ATTRIBUTE, NORID
-__attribute__, ATTRIBUTE, NORID
-__const, TYPE_QUAL, RID_CONST
-__const__, TYPE_QUAL, RID_CONST
-__extension__, EXTENSION, NORID
-__inline, SCSPEC, RID_INLINE
-__inline__, SCSPEC, RID_INLINE
-__signed, TYPESPEC, RID_SIGNED
-__signed__, TYPESPEC, RID_SIGNED
-__typeof, TYPEOF, NORID
-__typeof__, TYPEOF, NORID
-__volatile, TYPE_QUAL, RID_VOLATILE
-__volatile__, TYPE_QUAL, RID_VOLATILE
-asm, ASM, NORID
-auto, SCSPEC, RID_AUTO
-break, BREAK, NORID
-case, CASE, NORID
-char, TYPESPEC, RID_CHAR
-const, TYPE_QUAL, RID_CONST
-continue, CONTINUE, NORID
-default, DEFAULT, NORID
-do, DO, NORID
-double, TYPESPEC, RID_DOUBLE
-else, ELSE, NORID
-enum, ENUM, NORID
-extern, SCSPEC, RID_EXTERN
-float, TYPESPEC, RID_FLOAT
-for, FOR, NORID
-goto, GOTO, NORID
-if, IF, NORID
-inline, SCSPEC, RID_INLINE
-int, TYPESPEC, RID_INT
-long, TYPESPEC, RID_LONG
-register, SCSPEC, RID_REGISTER
-return, RETURN, NORID
-short, TYPESPEC, RID_SHORT
-signed, TYPESPEC, RID_SIGNED
-sizeof, SIZEOF, NORID
-static, SCSPEC, RID_STATIC
-struct, STRUCT, NORID
-switch, SWITCH, NORID
-typedef, SCSPEC, RID_TYPEDEF
-typeof, TYPEOF, NORID
-union, UNION, NORID
-unsigned, TYPESPEC, RID_UNSIGNED
-void, TYPESPEC, RID_VOID
-volatile, TYPE_QUAL, RID_VOLATILE
-while, WHILE, NORID
diff --git a/gcc/objc/objc.h b/gcc/objc/objc.h
deleted file mode 100644
index e48b0fd5bfb..00000000000
--- a/gcc/objc/objc.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Basic data types for Objective C.
- Copyright (C) 1993, 1995, 1996 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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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 __objc_INCLUDE_GNU
-#define __objc_INCLUDE_GNU
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stddef.h>
-
-/*
-** Definition of the boolean type.
-*/
-#ifdef __vxworks
-typedef int BOOL;
-#else
-typedef unsigned char BOOL;
-#endif
-#define YES (BOOL)1
-#define NO (BOOL)0
-
-/*
-** Definition of a selector. Selectors themselves are not unique, but
-** the sel_id is a unique identifier.
-*/
-typedef const struct objc_selector
-{
- void *sel_id;
- const char *sel_types;
-} *SEL;
-
-inline static BOOL
-sel_eq (SEL s1, SEL s2)
-{
- if (s1 == 0 || s2 == 0)
- return s1 == s2;
- else
- return s1->sel_id == s2->sel_id;
-}
-
-
-/*
-** ObjC uses this typedef for untyped instances.
-*/
-typedef struct objc_object {
- struct objc_class* class_pointer;
-} *id;
-
-/*
-** Definition of method type. When retrieving the implementation of a
-** method, this is type of the pointer returned
-*/
-typedef id (*IMP)(id, SEL, ...);
-
-/*
-** More simple types...
-*/
-#define nil (id)0 /* id of Nil instance */
-#define Nil (Class)0 /* id of Nil class */
-typedef char *STR; /* String alias */
-
-/*
-** The compiler generates one of these structures for each class.
-**
-** This structure is the definition for classes.
-**
-** This structure is generated by the compiler in the executable and used by
-** the run-time during normal messaging operations. Therefore some members
-** change type. The compiler generates "char* const" and places a string in
-** the following member variables: super_class.
-*/
-typedef struct objc_class *MetaClass;
-typedef struct objc_class *Class;
-struct objc_class {
- MetaClass class_pointer; /* Pointer to the class's
- meta class. */
- struct objc_class* super_class; /* Pointer to the super
- class. NULL for class
- Object. */
- const char* name; /* Name of the class. */
- long version; /* Unknown. */
- unsigned long info; /* Bit mask. See class masks
- defined above. */
- long instance_size; /* Size in bytes of the class.
- The sum of the class
- definition and all super
- class definitions. */
- struct objc_ivar_list* ivars; /* Pointer to a structure that
- describes the instance
- variables in the class
- definition. NULL indicates
- no instance variables. Does
- not include super class
- variables. */
- struct objc_method_list* methods; /* Linked list of instance
- methods defined for the
- class. */
- struct sarray * dtable; /* Pointer to instance
- method dispatch table. */
- struct objc_class* subclass_list; /* Subclasses */
- struct objc_class* sibling_class;
-
- struct objc_protocol_list *protocols; /* Protocols conformed to */
-};
-
-#ifndef __OBJC__
-typedef struct objc_protocol {
- struct objc_class* class_pointer;
- char *protocol_name;
- struct objc_protocol_list *protocol_list;
- struct objc_method_description_list *instance_methods, *class_methods;
-} Protocol;
-
-#else /* __OBJC__ */
-@class Protocol;
-#endif
-
-typedef void* retval_t; /* return value */
-typedef void(*apply_t)(void); /* function pointer */
-typedef union {
- char *arg_ptr;
- char arg_regs[sizeof (char*)];
-} *arglist_t; /* argument frame */
-
-
-IMP objc_msg_lookup(id receiver, SEL op);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not __objc_INCLUDE_GNU */
diff --git a/gcc/objc/objects.c b/gcc/objc/objects.c
deleted file mode 100644
index 3e68334c924..00000000000
--- a/gcc/objc/objects.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* GNU Objective C Runtime class related functions
- Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include "../tconfig.h" /* include defs of bzero for target */
-#include "runtime.h" /* the kitchen sink */
-
-id __objc_object_alloc(Class);
-id __objc_object_dispose(id);
-id __objc_object_copy(id);
-
-id (*_objc_object_alloc)(Class) = __objc_object_alloc; /* !T:SINGLE */
-id (*_objc_object_dispose)(id) = __objc_object_dispose; /* !T:SINGLE */
-id (*_objc_object_copy)(id) = __objc_object_copy; /* !T:SINGLE */
-
-id
-class_create_instance(Class class)
-{
- id new = nil;
- if (CLS_ISCLASS(class))
- new = (*_objc_object_alloc)(class);
- if (new!=nil)
- {
- memset (new, 0, class->instance_size);
- new->class_pointer = class;
- }
- return new;
-}
-
-id
-object_copy(id object)
-{
- if ((object!=nil)&&CLS_ISCLASS(object->class_pointer))
- return (*_objc_object_copy)(object);
- else
- return nil;
-}
-
-id
-object_dispose(id object)
-{
- if ((object!=nil)&&CLS_ISCLASS(object->class_pointer))
- {
- if (_objc_object_dispose)
- (*_objc_object_dispose)(object);
- else
- objc_free(object);
- }
- return nil;
-}
-
-id __objc_object_alloc(Class class)
-{
- return (id)objc_malloc(class->instance_size);
-}
-
-id __objc_object_dispose(id object)
-{
- objc_free(object);
- return 0;
-}
-
-id __objc_object_copy(id object)
-{
- id copy = class_create_instance(object->class_pointer);
- memcpy(copy, object, object->class_pointer->instance_size);
- return copy;
-}
-
-
diff --git a/gcc/objc/runtime.h b/gcc/objc/runtime.h
deleted file mode 100644
index 742e469b126..00000000000
--- a/gcc/objc/runtime.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* GNU Objective C Runtime internal declarations
- Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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 __objc_runtime_INCLUDE_GNU
-#define __objc_runtime_INCLUDE_GNU
-
-#include <stdarg.h> /* for varargs and va_list's */
-
-#include <stdio.h>
-#include <ctype.h>
-
-#include <stddef.h> /* so noone else will get system versions */
-#include "assert.h"
-
-#include "objc/objc.h" /* core data types */
-#include "objc/objc-api.h" /* runtime api functions */
-
-#include "objc/thr.h" /* thread and mutex support */
-
-#include "objc/hash.h" /* hash structures */
-#include "objc/objc-list.h" /* linear lists */
-
-extern void __objc_add_class_to_hash(Class); /* (objc-class.c) */
-extern void __objc_init_selector_tables(); /* (objc-sel.c) */
-extern void __objc_init_class_tables(); /* (objc-class.c) */
-extern void __objc_init_dispatch_tables(); /* (objc-dispatch.c) */
-extern void __objc_install_premature_dtable(Class); /* (objc-dispatch.c) */
-extern void __objc_resolve_class_links(); /* (objc-class.c) */
-extern void __objc_register_selectors_from_class(Class); /* (objc-sel.c) */
-extern void __objc_update_dispatch_table_for_class (Class);/* (objc-msg.c) */
-
-extern int __objc_init_thread_system(void); /* thread.c */
-extern int __objc_fini_thread_system(void); /* thread.c */
-
-extern void class_add_method_list(Class, MethodList_t);
-
-/* True when class links has been resolved */
-extern BOOL __objc_class_links_resolved;
-
-/* Number of selectors stored in each of the selector tables */
-extern int __objc_selector_max_index;
-
-/* Mutex locking __objc_selector_max_index and its arrays. */
-extern objc_mutex_t __objc_runtime_mutex;
-
-/* Number of threads which are alive. */
-extern int __objc_runtime_threads_alive;
-
-#ifdef DEBUG
-#define DEBUG_PRINTF(format, args...) printf (format, ## args)
-#else
-#define DEBUG_PRINTF(format, args...)
-#endif
-
-BOOL __objc_responds_to (id object, SEL sel); /* for internal use only! */
-SEL __sel_register_typed_name (const char*, const char*,
- struct objc_selector*, BOOL is_const);
-
-#endif /* not __objc_runtime_INCLUDE_GNU */
-
-
diff --git a/gcc/objc/sarray.c b/gcc/objc/sarray.c
deleted file mode 100644
index 7e40fba750f..00000000000
--- a/gcc/objc/sarray.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/* Sparse Arrays for Objective C dispatch tables
- Copyright (C) 1993, 1995, 1996 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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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. */
-
-#include "objc/sarray.h"
-#include "objc/runtime.h"
-#include <stdio.h>
-#include "assert.h"
-
-int nbuckets = 0; /* !T:MUTEX */
-int nindices = 0; /* !T:MUTEX */
-int narrays = 0; /* !T:MUTEX */
-int idxsize = 0; /* !T:MUTEX */
-
-static void * first_free_data = NULL; /* !T:MUTEX */
-
-#ifdef OBJC_SPARSE2
-const char* __objc_sparse2_id = "2 level sparse indices";
-#endif
-
-#ifdef OBJC_SPARSE3
-const char* __objc_sparse3_id = "3 level sparse indices";
-#endif
-
-#ifdef __alpha__
-const void *memcpy (void*, const void*, size_t);
-#endif
-
-/* This function removes any structures left over from free operations
- that were not safe in a multi-threaded environment. */
-void
-sarray_remove_garbage(void)
-{
- void **vp;
- void *np;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- vp = first_free_data;
- first_free_data = NULL;
-
- while (vp) {
- np = *vp;
- objc_free(vp);
- vp = np;
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-/* Free a block of dynamically allocated memory. If we are in multi-threaded
- mode, it is ok to free it. If not, we add it to the garbage heap to be
- freed later. */
-
-static void
-sarray_free_garbage(void *vp)
-{
- objc_mutex_lock(__objc_runtime_mutex);
-
- if (__objc_runtime_threads_alive == 1) {
- objc_free(vp);
- if (first_free_data)
- sarray_remove_garbage();
- }
- else {
- *(void **)vp = first_free_data;
- first_free_data = vp;
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-/* sarray_at_put : copies data in such a way as to be thread reader safe. */
-void
-sarray_at_put(struct sarray* array, sidx index, void* element)
-{
-#ifdef OBJC_SPARSE3
- struct sindex** the_index;
- struct sindex* new_index;
-#endif
- struct sbucket** the_bucket;
- struct sbucket* new_bucket;
-#ifdef OBJC_SPARSE3
- size_t ioffset;
-#endif
- size_t boffset;
- size_t eoffset;
-#ifdef PRECOMPUTE_SELECTORS
- union sofftype xx;
- xx.idx = index;
-#ifdef OBJC_SPARSE3
- ioffset = xx.off.ioffset;
-#endif
- boffset = xx.off.boffset;
- eoffset = xx.off.eoffset;
-#else /* not PRECOMPUTE_SELECTORS */
-#ifdef OBJC_SPARSE3
- ioffset = index/INDEX_CAPACITY;
- boffset = (index/BUCKET_SIZE)%INDEX_SIZE;
- eoffset = index%BUCKET_SIZE;
-#else
- boffset = index/BUCKET_SIZE;
- eoffset = index%BUCKET_SIZE;
-#endif
-#endif /* not PRECOMPUTE_SELECTORS */
-
- assert(soffset_decode(index) < array->capacity); /* Range check */
-
-#ifdef OBJC_SPARSE3
- the_index = &(array->indices[ioffset]);
- the_bucket = &((*the_index)->buckets[boffset]);
-#else
- the_bucket = &(array->buckets[boffset]);
-#endif
-
- if ((*the_bucket)->elems[eoffset] == element)
- return; /* great! we just avoided a lazy copy */
-
-#ifdef OBJC_SPARSE3
-
- /* First, perform lazy copy/allocation of index if needed */
-
- if ((*the_index) == array->empty_index) {
-
- /* The index was previously empty, allocate a new */
- new_index = (struct sindex*)objc_malloc(sizeof(struct sindex));
- memcpy(new_index, array->empty_index, sizeof(struct sindex));
- new_index->version.version = array->version.version;
- *the_index = new_index; /* Prepared for install. */
- the_bucket = &((*the_index)->buckets[boffset]);
-
- nindices += 1;
- } else if ((*the_index)->version.version != array->version.version) {
-
- /* This index must be lazy copied */
- struct sindex* old_index = *the_index;
- new_index = (struct sindex*)objc_malloc(sizeof(struct sindex));
- memcpy( new_index, old_index, sizeof(struct sindex));
- new_index->version.version = array->version.version;
- *the_index = new_index; /* Prepared for install. */
- the_bucket = &((*the_index)->buckets[boffset]);
-
- nindices += 1;
- }
-
-#endif /* OBJC_SPARSE3 */
-
- /* next, perform lazy allocation/copy of the bucket if needed */
-
- if ((*the_bucket) == array->empty_bucket) {
-
- /* The bucket was previously empty (or something like that), */
- /* allocate a new. This is the effect of `lazy' allocation */
- new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket));
- memcpy((void *) new_bucket, (const void*)array->empty_bucket,
- sizeof(struct sbucket));
- new_bucket->version.version = array->version.version;
- *the_bucket = new_bucket; /* Prepared for install. */
-
- nbuckets += 1;
-
- } else if ((*the_bucket)->version.version != array->version.version) {
-
- /* Perform lazy copy. */
- struct sbucket* old_bucket = *the_bucket;
- new_bucket = (struct sbucket*)objc_malloc(sizeof(struct sbucket));
- memcpy( new_bucket, old_bucket, sizeof(struct sbucket));
- new_bucket->version.version = array->version.version;
- *the_bucket = new_bucket; /* Prepared for install. */
-
- nbuckets += 1;
-
- }
- (*the_bucket)->elems[eoffset] = element;
-}
-
-void
-sarray_at_put_safe(struct sarray* array, sidx index, void* element)
-{
- if(soffset_decode(index) >= array->capacity)
- sarray_realloc(array, soffset_decode(index)+1);
- sarray_at_put(array, index, element);
-}
-
-struct sarray*
-sarray_new (int size, void* default_element)
-{
- struct sarray* arr;
-#ifdef OBJC_SPARSE3
- size_t num_indices = ((size-1)/(INDEX_CAPACITY))+1;
- struct sindex ** new_indices;
-#else /* OBJC_SPARSE2 */
- size_t num_indices = ((size-1)/BUCKET_SIZE)+1;
- struct sbucket ** new_buckets;
-#endif
- int counter;
-
- assert(size > 0);
-
- /* Allocate core array */
- arr = (struct sarray*) objc_malloc(sizeof(struct sarray));
- arr->version.version = 0;
-
- /* Initialize members */
-#ifdef OBJC_SPARSE3
- arr->capacity = num_indices*INDEX_CAPACITY;
- new_indices = (struct sindex**)
- objc_malloc(sizeof(struct sindex*)*num_indices);
-
- arr->empty_index = (struct sindex*) objc_malloc(sizeof(struct sindex));
- arr->empty_index->version.version = 0;
-
- narrays += 1;
- idxsize += num_indices;
- nindices += 1;
-
-#else /* OBJC_SPARSE2 */
- arr->capacity = num_indices*BUCKET_SIZE;
- new_buckets = (struct sbucket**)
- objc_malloc(sizeof(struct sbucket*)*num_indices);
-
- narrays += 1;
- idxsize += num_indices;
-
-#endif
-
- arr->empty_bucket = (struct sbucket*) objc_malloc(sizeof(struct sbucket));
- arr->empty_bucket->version.version = 0;
-
- nbuckets += 1;
-
- arr->ref_count = 1;
- arr->is_copy_of = (struct sarray*)0;
-
- for (counter=0; counter<BUCKET_SIZE; counter++)
- arr->empty_bucket->elems[counter] = default_element;
-
-#ifdef OBJC_SPARSE3
- for (counter=0; counter<INDEX_SIZE; counter++)
- arr->empty_index->buckets[counter] = arr->empty_bucket;
-
- for (counter=0; counter<num_indices; counter++)
- new_indices[counter] = arr->empty_index;
-
-#else /* OBJC_SPARSE2 */
-
- for (counter=0; counter<num_indices; counter++)
- new_buckets[counter] = arr->empty_bucket;
-
-#endif
-
-#ifdef OBJC_SPARSE3
- arr->indices = new_indices;
-#else /* OBJC_SPARSE2 */
- arr->buckets = new_buckets;
-#endif
-
- return arr;
-}
-
-
-/* Reallocate the sparse array to hold `newsize' entries
- Note: We really allocate and then free. We have to do this to ensure that
- any concurrent readers notice the update. */
-
-void
-sarray_realloc(struct sarray* array, int newsize)
-{
-#ifdef OBJC_SPARSE3
- size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY;
- size_t new_max_index = ((newsize-1)/INDEX_CAPACITY);
- size_t rounded_size = (new_max_index+1)*INDEX_CAPACITY;
-
- struct sindex ** new_indices;
- struct sindex ** old_indices;
-
-#else /* OBJC_SPARSE2 */
- size_t old_max_index = (array->capacity-1)/BUCKET_SIZE;
- size_t new_max_index = ((newsize-1)/BUCKET_SIZE);
- size_t rounded_size = (new_max_index+1)*BUCKET_SIZE;
-
- struct sbucket ** new_buckets;
- struct sbucket ** old_buckets;
-
-#endif
-
- int counter;
-
- assert(newsize > 0);
-
- /* The size is the same, just ignore the request */
- if(rounded_size <= array->capacity)
- return;
-
- assert(array->ref_count == 1); /* stop if lazy copied... */
-
- /* We are asked to extend the array -- allocate new bucket table, */
- /* and insert empty_bucket in newly allocated places. */
- if(rounded_size > array->capacity)
- {
-
-#ifdef OBJC_SPARSE3
- new_max_index += 4;
- rounded_size = (new_max_index+1)*INDEX_CAPACITY;
-
-#else /* OBJC_SPARSE2 */
- new_max_index += 4;
- rounded_size = (new_max_index+1)*BUCKET_SIZE;
-#endif
-
- /* update capacity */
- array->capacity = rounded_size;
-
-#ifdef OBJC_SPARSE3
- /* alloc to force re-read by any concurrent readers. */
- old_indices = array->indices;
- new_indices = (struct sindex**)
- objc_malloc((new_max_index+1)*sizeof(struct sindex*));
-#else /* OBJC_SPARSE2 */
- old_buckets = array->buckets;
- new_buckets = (struct sbucket**)
- objc_malloc((new_max_index+1)*sizeof(struct sbucket*));
-#endif
-
- /* copy buckets below old_max_index (they are still valid) */
- for(counter = 0; counter <= old_max_index; counter++ ) {
-#ifdef OBJC_SPARSE3
- new_indices[counter] = old_indices[counter];
-#else /* OBJC_SPARSE2 */
- new_buckets[counter] = old_buckets[counter];
-#endif
- }
-
-#ifdef OBJC_SPARSE3
- /* reset entries above old_max_index to empty_bucket */
- for(counter = old_max_index+1; counter <= new_max_index; counter++)
- new_indices[counter] = array->empty_index;
-#else /* OBJC_SPARSE2 */
- /* reset entries above old_max_index to empty_bucket */
- for(counter = old_max_index+1; counter <= new_max_index; counter++)
- new_buckets[counter] = array->empty_bucket;
-#endif
-
-#ifdef OBJC_SPARSE3
- /* install the new indices */
- array->indices = new_indices;
-#else /* OBJC_SPARSE2 */
- array->buckets = new_buckets;
-#endif
-
-#ifdef OBJC_SPARSE3
- /* free the old indices */
- sarray_free_garbage(old_indices);
-#else /* OBJC_SPARSE2 */
- sarray_free_garbage(old_buckets);
-#endif
-
- idxsize += (new_max_index-old_max_index);
- return;
- }
-}
-
-
-/* Free a sparse array allocated with sarray_new */
-
-void
-sarray_free(struct sarray* array) {
-
-#ifdef OBJC_SPARSE3
- size_t old_max_index = (array->capacity-1)/INDEX_CAPACITY;
- struct sindex ** old_indices;
-#else
- size_t old_max_index = (array->capacity-1)/BUCKET_SIZE;
- struct sbucket ** old_buckets;
-#endif
- int counter = 0;
-
- assert(array->ref_count != 0); /* Freed multiple times!!! */
-
- if(--(array->ref_count) != 0) /* There exists copies of me */
- return;
-
-#ifdef OBJC_SPARSE3
- old_indices = array->indices;
-#else
- old_buckets = array->buckets;
-#endif
-
- if((array->is_copy_of) && ((array->is_copy_of->ref_count - 1) == 0))
- sarray_free(array->is_copy_of);
-
- /* Free all entries that do not point to empty_bucket */
- for(counter = 0; counter <= old_max_index; counter++ ) {
-#ifdef OBJC_SPARSE3
- struct sindex* idx = old_indices[counter];
- if((idx != array->empty_index) &&
- (idx->version.version == array->version.version)) {
- int c2;
- for(c2=0; c2<INDEX_SIZE; c2++) {
- struct sbucket* bkt = idx->buckets[c2];
- if((bkt != array->empty_bucket) &&
- (bkt->version.version == array->version.version))
- {
- sarray_free_garbage(bkt);
- nbuckets -= 1;
- }
- }
- sarray_free_garbage(idx);
- nindices -= 1;
- }
-#else /* OBJC_SPARSE2 */
- struct sbucket* bkt = array->buckets[counter];
- if ((bkt != array->empty_bucket) &&
- (bkt->version.version == array->version.version))
- {
- sarray_free_garbage(bkt);
- nbuckets -= 1;
- }
-#endif
- }
-
-#ifdef OBJC_SPARSE3
- /* free empty_index */
- if(array->empty_index->version.version == array->version.version) {
- sarray_free_garbage(array->empty_index);
- nindices -= 1;
- }
-#endif
-
- /* free empty_bucket */
- if(array->empty_bucket->version.version == array->version.version) {
- sarray_free_garbage(array->empty_bucket);
- nbuckets -= 1;
- }
- idxsize -= (old_max_index+1);
- narrays -= 1;
-
-#ifdef OBJC_SPARSE3
- /* free bucket table */
- sarray_free_garbage(array->indices);
-
-#else
- /* free bucket table */
- sarray_free_garbage(array->buckets);
-
-#endif
-
- /* free array */
- sarray_free_garbage(array);
-}
-
-/* This is a lazy copy. Only the core of the structure is actually */
-/* copied. */
-
-struct sarray*
-sarray_lazy_copy(struct sarray* oarr)
-{
- struct sarray* arr;
-
-#ifdef OBJC_SPARSE3
- size_t num_indices = ((oarr->capacity-1)/INDEX_CAPACITY)+1;
- struct sindex ** new_indices;
-#else /* OBJC_SPARSE2 */
- size_t num_indices = ((oarr->capacity-1)/BUCKET_SIZE)+1;
- struct sbucket ** new_buckets;
-#endif
-
- /* Allocate core array */
- arr = (struct sarray*) objc_malloc(sizeof(struct sarray)); /* !!! */
- arr->version.version = oarr->version.version + 1;
-#ifdef OBJC_SPARSE3
- arr->empty_index = oarr->empty_index;
-#endif
- arr->empty_bucket = oarr->empty_bucket;
- arr->ref_count = 1;
- oarr->ref_count += 1;
- arr->is_copy_of = oarr;
- arr->capacity = oarr->capacity;
-
-#ifdef OBJC_SPARSE3
- /* Copy bucket table */
- new_indices = (struct sindex**)
- objc_malloc(sizeof(struct sindex*)*num_indices);
- memcpy( new_indices,oarr->indices,
- sizeof(struct sindex*)*num_indices);
- arr->indices = new_indices;
-#else
- /* Copy bucket table */
- new_buckets = (struct sbucket**)
- objc_malloc(sizeof(struct sbucket*)*num_indices);
- memcpy( new_buckets,oarr->buckets,
- sizeof(struct sbucket*)*num_indices);
- arr->buckets = new_buckets;
-#endif
-
- idxsize += num_indices;
- narrays += 1;
-
- return arr;
-}
diff --git a/gcc/objc/sarray.h b/gcc/objc/sarray.h
deleted file mode 100644
index 74fa38652ba..00000000000
--- a/gcc/objc/sarray.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/* Sparse Arrays for Objective C dispatch tables
- Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup.
-
-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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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 __sarray_INCLUDE_GNU
-#define __sarray_INCLUDE_GNU
-
-#define OBJC_SPARSE2 /* 2-level sparse array */
-/* #define OBJC_SPARSE3 */ /* 3-level sparse array */
-
-#ifdef OBJC_SPARSE2
-extern const char* __objc_sparse2_id;
-#endif
-
-#ifdef OBJC_SPARSE3
-extern const char* __objc_sparse3_id;
-#endif
-
-#include <stddef.h>
-
-#include "objc/thr.h"
-
-extern int nbuckets; /* for stats */
-extern int nindices;
-extern int narrays;
-extern int idxsize;
-
-#include <assert.h>
-
-/* An unsigned integer of same size as a pointer */
-#define SIZET_BITS (sizeof(size_t)*8)
-
-#if defined(__sparc__) || defined(OBJC_SPARSE2)
-#define PRECOMPUTE_SELECTORS
-#endif
-
-#ifdef OBJC_SPARSE3
-
-/* Buckets are 8 words each */
-#define BUCKET_BITS 3
-#define BUCKET_SIZE (1<<BUCKET_BITS)
-#define BUCKET_MASK (BUCKET_SIZE-1)
-
-/* Indices are 16 words each */
-#define INDEX_BITS 4
-#define INDEX_SIZE (1<<INDEX_BITS)
-#define INDEX_MASK (INDEX_SIZE-1)
-
-#define INDEX_CAPACITY (BUCKET_SIZE*INDEX_SIZE)
-
-#else /* OBJC_SPARSE2 */
-
-/* Buckets are 32 words each */
-#define BUCKET_BITS 5
-#define BUCKET_SIZE (1<<BUCKET_BITS)
-#define BUCKET_MASK (BUCKET_SIZE-1)
-
-#endif /* OBJC_SPARSE2 */
-
-typedef size_t sidx;
-
-#ifdef PRECOMPUTE_SELECTORS
-
-struct soffset {
-#ifdef OBJC_SPARSE3
- unsigned int unused : SIZET_BITS/4;
- unsigned int eoffset : SIZET_BITS/4;
- unsigned int boffset : SIZET_BITS/4;
- unsigned int ioffset : SIZET_BITS/4;
-#else /* OBJC_SPARSE2 */
-#ifdef __sparc__
- unsigned int boffset : (SIZET_BITS - 2) - BUCKET_BITS;
- unsigned int eoffset : BUCKET_BITS;
- unsigned int unused : 2;
-#else
- unsigned int boffset : SIZET_BITS/2;
- unsigned int eoffset : SIZET_BITS/2;
-#endif
-#endif /* OBJC_SPARSE2 */
-};
-
-union sofftype {
- struct soffset off;
- sidx idx;
-};
-
-#endif /* not PRECOMPUTE_SELECTORS */
-
-union sversion {
- int version;
- void *next_free;
-};
-
-struct sbucket {
- void* elems[BUCKET_SIZE]; /* elements stored in array */
- union sversion version; /* used for copy-on-write */
-};
-
-#ifdef OBJC_SPARSE3
-
-struct sindex {
- struct sbucket* buckets[INDEX_SIZE];
- union sversion version; /* used for copy-on-write */
-};
-
-#endif /* OBJC_SPARSE3 */
-
-struct sarray {
-#ifdef OBJC_SPARSE3
- struct sindex** indices;
- struct sindex* empty_index;
-#else /* OBJC_SPARSE2 */
- struct sbucket** buckets;
-#endif /* OBJC_SPARSE2 */
- struct sbucket* empty_bucket;
- union sversion version; /* used for copy-on-write */
- short ref_count;
- struct sarray* is_copy_of;
- size_t capacity;
-};
-
-struct sarray* sarray_new(int, void* default_element);
-void sarray_free(struct sarray*);
-struct sarray* sarray_lazy_copy(struct sarray*);
-void sarray_realloc(struct sarray*, int new_size);
-void sarray_at_put(struct sarray*, sidx index, void* elem);
-void sarray_at_put_safe(struct sarray*, sidx index, void* elem);
-
-struct sarray* sarray_hard_copy(struct sarray*); /* ... like the name? */
-void sarray_remove_garbage(void);
-
-
-#ifdef PRECOMPUTE_SELECTORS
-/* Transform soffset values to ints and vica verca */
-static inline unsigned int
-soffset_decode(sidx index)
-{
- union sofftype x;
- x.idx = index;
-#ifdef OBJC_SPARSE3
- return x.off.eoffset
- + (x.off.boffset*BUCKET_SIZE)
- + (x.off.ioffset*INDEX_CAPACITY);
-#else /* OBJC_SPARSE2 */
- return x.off.eoffset + (x.off.boffset*BUCKET_SIZE);
-#endif /* OBJC_SPARSE2 */
-}
-
-static inline sidx
-soffset_encode(size_t offset)
-{
- union sofftype x;
- x.off.eoffset = offset%BUCKET_SIZE;
-#ifdef OBJC_SPARSE3
- x.off.boffset = (offset/BUCKET_SIZE)%INDEX_SIZE;
- x.off.ioffset = offset/INDEX_CAPACITY;
-#else /* OBJC_SPARSE2 */
- x.off.boffset = offset/BUCKET_SIZE;
-#endif
- return (sidx)x.idx;
-}
-
-#else /* not PRECOMPUTE_SELECTORS */
-
-static inline size_t
-soffset_decode(sidx index)
-{
- return index;
-}
-
-static inline sidx
-soffset_encode(size_t offset)
-{
- return offset;
-}
-#endif /* not PRECOMPUTE_SELECTORS */
-
-/* Get element from the Sparse array `array' at offset `index' */
-
-static inline void* sarray_get(struct sarray* array, sidx index)
-{
-#ifdef PRECOMPUTE_SELECTORS
- union sofftype x;
- x.idx = index;
-#ifdef OBJC_SPARSE3
- return
- array->
- indices[x.off.ioffset]->
- buckets[x.off.boffset]->
- elems[x.off.eoffset];
-#else /* OBJC_SPARSE2 */
- return array->buckets[x.off.boffset]->elems[x.off.eoffset];
-#endif /* OBJC_SPARSE2 */
-#else /* not PRECOMPUTE_SELECTORS */
-#ifdef OBJC_SPARSE3
- return array->
- indices[index/INDEX_CAPACITY]->
- buckets[(index/BUCKET_SIZE)%INDEX_SIZE]->
- elems[index%BUCKET_SIZE];
-#else /* OBJC_SPARSE2 */
- return array->buckets[index/BUCKET_SIZE]->elems[index%BUCKET_SIZE];
-#endif /* not OBJC_SPARSE3 */
-#endif /* not PRECOMPUTE_SELECTORS */
-}
-
-static inline void* sarray_get_safe(struct sarray* array, sidx index)
-{
- if(soffset_decode(index) < array->capacity)
- return sarray_get(array, index);
- else
- return (array->empty_bucket->elems[0]);
-}
-
-#endif /* __sarray_INCLUDE_GNU */
diff --git a/gcc/objc/selector.c b/gcc/objc/selector.c
deleted file mode 100644
index de1bd4515f1..00000000000
--- a/gcc/objc/selector.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/* GNU Objective C Runtime selector related functions
- Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include "runtime.h"
-#include "objc/sarray.h"
-#include "encoding.h"
-
-/* Initial selector hash table size. Value doesn't matter much */
-#define SELECTOR_HASH_SIZE 128
-
-/* Tables mapping selector names to uid and opposite */
-static struct sarray* __objc_selector_array = 0; /* uid -> sel !T:MUTEX */
-static struct sarray* __objc_selector_names = 0; /* uid -> name !T:MUTEX */
-static cache_ptr __objc_selector_hash = 0; /* name -> uid !T:MUTEX */
-
-static void register_selectors_from_list(MethodList_t);
-
-/* Number of selectors stored in each of the above tables */
-int __objc_selector_max_index = 0; /* !T:MUTEX */
-
-void __objc_init_selector_tables()
-{
- __objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0);
- __objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0);
- __objc_selector_hash
- = hash_new (SELECTOR_HASH_SIZE,
- (hash_func_type) hash_string,
- (compare_func_type) compare_strings);
-}
-
-/* This routine is given a class and records all of the methods in its class
- structure in the record table. */
-void
-__objc_register_selectors_from_class (Class class)
-{
- MethodList_t method_list;
-
- method_list = class->methods;
- while (method_list)
- {
- register_selectors_from_list (method_list);
- method_list = method_list->method_next;
- }
-}
-
-
-/* This routine is given a list of methods and records each of the methods in
- the record table. This is the routine that does the actual recording
- work.
-
- This one is only called for Class objects. For categories,
- class_add_method_list is called.
- */
-static void
-register_selectors_from_list (MethodList_t method_list)
-{
- int i = 0;
- while (i < method_list->method_count)
- {
- Method_t method = &method_list->method_list[i];
- method->method_name
- = sel_register_typed_name ((const char*)method->method_name,
- method->method_types);
- i += 1;
- }
-}
-
-
-/* Returns YES iff t1 and t2 have same method types, but we ignore
- the argframe layout */
-BOOL
-sel_types_match (const char* t1, const char* t2)
-{
- if (!t1 || !t2)
- return NO;
- while (*t1 && *t2)
- {
- if (*t1 == '+') t1++;
- if (*t2 == '+') t2++;
- while (isdigit(*t1)) t1++;
- while (isdigit(*t2)) t2++;
- /* xxx Remove these next two lines when qualifiers are put in
- all selectors, not just Protocol selectors. */
- t1 = objc_skip_type_qualifiers(t1);
- t2 = objc_skip_type_qualifiers(t2);
- if (!*t1 && !*t2)
- return YES;
- if (*t1 != *t2)
- return NO;
- t1++;
- t2++;
- }
- return NO;
-}
-
-/* return selector representing name */
-SEL
-sel_get_typed_uid (const char *name, const char *types)
-{
- struct objc_list *l;
- sidx i;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- i = (sidx) hash_value_for_key (__objc_selector_hash, name);
- if (i == 0)
- {
- objc_mutex_unlock(__objc_runtime_mutex);
- return 0;
- }
-
- for (l = (struct objc_list*)sarray_get (__objc_selector_array, i);
- l; l = l->tail)
- {
- SEL s = (SEL)l->head;
- if (types == 0 || s->sel_types == 0)
- {
- if (s->sel_types == types)
- {
- objc_mutex_unlock(__objc_runtime_mutex);
- return s;
- }
- }
- else if (sel_types_match (s->sel_types, types))
- {
- objc_mutex_unlock(__objc_runtime_mutex);
- return s;
- }
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
- return 0;
-}
-
-/* Return selector representing name; prefer a selector with non-NULL type */
-SEL
-sel_get_any_typed_uid (const char *name)
-{
- struct objc_list *l;
- sidx i;
- SEL s;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- i = (sidx) hash_value_for_key (__objc_selector_hash, name);
- if (i == 0)
- {
- objc_mutex_unlock(__objc_runtime_mutex);
- return 0;
- }
-
- for (l = (struct objc_list*)sarray_get (__objc_selector_array, i);
- l; l = l->tail)
- {
- s = (SEL) l->head;
- if (s->sel_types)
- {
- objc_mutex_unlock(__objc_runtime_mutex);
- return s;
- }
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
- return s;
-}
-
-/* return selector representing name */
-SEL
-sel_get_any_uid (const char *name)
-{
- struct objc_list *l;
- sidx i;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- i = (sidx) hash_value_for_key (__objc_selector_hash, name);
- if (soffset_decode (i) == 0)
- {
- objc_mutex_unlock(__objc_runtime_mutex);
- return 0;
- }
-
- l = (struct objc_list*)sarray_get (__objc_selector_array, i);
- objc_mutex_unlock(__objc_runtime_mutex);
-
- if (l == 0)
- return 0;
-
- return (SEL)l->head;
-}
-
-/* return selector representing name */
-SEL
-sel_get_uid (const char *name)
-{
- return sel_register_typed_name (name, 0);
-}
-
-/* Get name of selector. If selector is unknown, the empty string ""
- is returned */
-const char*
-sel_get_name (SEL selector)
-{
- const char *ret;
-
- objc_mutex_lock(__objc_runtime_mutex);
- if ((soffset_decode((sidx)selector->sel_id) > 0)
- && (soffset_decode((sidx)selector->sel_id) <= __objc_selector_max_index))
- ret = sarray_get (__objc_selector_names, (sidx) selector->sel_id);
- else
- ret = 0;
- objc_mutex_unlock(__objc_runtime_mutex);
- return ret;
-}
-
-BOOL
-sel_is_mapped (SEL selector)
-{
- unsigned int idx = soffset_decode ((sidx)selector->sel_id);
- return ((idx > 0) && (idx <= __objc_selector_max_index));
-}
-
-
-const char*
-sel_get_type (SEL selector)
-{
- if (selector)
- return selector->sel_types;
- else
- return 0;
-}
-
-/* The uninstalled dispatch table */
-extern struct sarray* __objc_uninstalled_dtable;
-
-/* Store the passed selector name in the selector record and return its
- selector value (value returned by sel_get_uid).
- Assumes that the calling function has locked down __objc_runtime_mutex. */
-/* is_const parameter tells us if the name and types parameters
- are really constant or not. If YES then they are constant and
- we can just store the pointers. If NO then we need to copy
- name and types because the pointers may disappear later on. */
-SEL
-__sel_register_typed_name (const char *name, const char *types,
- struct objc_selector *orig, BOOL is_const)
-{
- struct objc_selector* j;
- sidx i;
- struct objc_list *l;
-
- i = (sidx) hash_value_for_key (__objc_selector_hash, name);
- if (soffset_decode (i) != 0)
- {
- for (l = (struct objc_list*)sarray_get (__objc_selector_array, i);
- l; l = l->tail)
- {
- SEL s = (SEL)l->head;
- if (types == 0 || s->sel_types == 0)
- {
- if (s->sel_types == types)
- {
- if (orig)
- {
- orig->sel_id = (void*)i;
- return orig;
- }
- else
- return s;
- }
- }
- else if (!strcmp (s->sel_types, types))
- {
- if (orig)
- {
- orig->sel_id = (void*)i;
- return orig;
- }
- else
- return s;
- }
- }
- if (orig)
- j = orig;
- else
- j = objc_malloc (sizeof (struct objc_selector));
-
- j->sel_id = (void*)i;
- /* Can we use the pointer or must copy types? Don't copy if NULL */
- if ((is_const) || (types == 0))
- j->sel_types = (const char*)types;
- else {
- j->sel_types = (char *) objc_malloc(strlen(types)+1);
- strcpy((char *)j->sel_types, types);
- }
- l = (struct objc_list*)sarray_get (__objc_selector_array, i);
- }
- else
- {
- __objc_selector_max_index += 1;
- i = soffset_encode(__objc_selector_max_index);
- if (orig)
- j = orig;
- else
- j = objc_malloc (sizeof (struct objc_selector));
-
- j->sel_id = (void*)i;
- /* Can we use the pointer or must copy types? Don't copy if NULL */
- if ((is_const) || (types == 0))
- j->sel_types = (const char*)types;
- else {
- j->sel_types = (char *) objc_malloc(strlen(types)+1);
- strcpy((char *)j->sel_types, types);
- }
- l = 0;
- }
-
- DEBUG_PRINTF ("Record selector %s[%s] as: %ld\n", name, types,
- soffset_decode (i));
-
- {
- int is_new = (l == 0);
- const char *new_name;
-
- /* Can we use the pointer or must copy name? Don't copy if NULL */
- if ((is_const) || (name == 0))
- new_name = name;
- else {
- new_name = (char *) objc_malloc(strlen(name)+1);
- strcpy((char *)new_name, name);
- }
-
- l = list_cons ((void*)j, l);
- sarray_at_put_safe (__objc_selector_names, i, (void *) new_name);
- sarray_at_put_safe (__objc_selector_array, i, (void *) l);
- if (is_new)
- hash_add (&__objc_selector_hash, (void *) new_name, (void *) i);
- }
-
- sarray_realloc(__objc_uninstalled_dtable, __objc_selector_max_index+1);
-
- return (SEL) j;
-}
-
-SEL
-sel_register_name (const char *name)
-{
- SEL ret;
-
- objc_mutex_lock(__objc_runtime_mutex);
- /* Assume that name is not constant static memory and needs to be
- copied before put into a runtime structure. is_const == NO */
- ret = __sel_register_typed_name (name, 0, 0, NO);
- objc_mutex_unlock(__objc_runtime_mutex);
-
- return ret;
-}
-
-SEL
-sel_register_typed_name (const char *name, const char *type)
-{
- SEL ret;
-
- objc_mutex_lock(__objc_runtime_mutex);
- /* Assume that name and type are not constant static memory and need to
- be copied before put into a runtime structure. is_const == NO */
- ret = __sel_register_typed_name (name, type, 0, NO);
- objc_mutex_unlock(__objc_runtime_mutex);
-
- return ret;
-}
-
diff --git a/gcc/objc/sendmsg.c b/gcc/objc/sendmsg.c
deleted file mode 100644
index 5c44dee0cdd..00000000000
--- a/gcc/objc/sendmsg.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/* GNU Objective C Runtime message lookup
- Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
- Contributed by Kresten Krab Thorup
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include "../tconfig.h"
-#include "runtime.h"
-#include "sarray.h"
-#include "encoding.h"
-
-/* this is how we hack STRUCT_VALUE to be 1 or 0 */
-#define gen_rtx(args...) 1
-#define rtx int
-
-#if !defined(STRUCT_VALUE) || STRUCT_VALUE == 0
-#define INVISIBLE_STRUCT_RETURN 1
-#else
-#define INVISIBLE_STRUCT_RETURN 0
-#endif
-
-/* The uninstalled dispatch table */
-struct sarray* __objc_uninstalled_dtable = 0; /* !T:MUTEX */
-
-/* Send +initialize to class */
-static void __objc_send_initialize(Class);
-
-static void __objc_install_dispatch_table_for_class (Class);
-
-/* Forward declare some functions */
-static void __objc_init_install_dtable(id, SEL);
-
-/* Various forwarding functions that are used based upon the
- return type for the selector.
- __objc_block_forward for structures.
- __objc_double_forward for floats/doubles.
- __objc_word_forward for pointers or types that fit in registers.
- */
-static double __objc_double_forward(id, SEL, ...);
-static id __objc_word_forward(id, SEL, ...);
-typedef struct { id many[8]; } __big;
-#if INVISIBLE_STRUCT_RETURN
-static __big
-#else
-static id
-#endif
-__objc_block_forward(id, SEL, ...);
-static Method_t search_for_method_in_hierarchy (Class class, SEL sel);
-static Method_t search_for_method_in_list(MethodList_t list, SEL op);
-id nil_method(id, SEL, ...);
-
-/* Given a selector, return the proper forwarding implementation. */
-__inline__
-IMP
-__objc_get_forward_imp (SEL sel)
-{
- const char *t = sel->sel_types;
-
- if (t && (*t == '[' || *t == '(' || *t == '{'))
- return (IMP)__objc_block_forward;
- else if (t && (*t == 'f' || *t == 'd'))
- return (IMP)__objc_double_forward;
- else
- return (IMP)__objc_word_forward;
-}
-
-/* Given a class and selector, return the selector's implementation. */
-__inline__
-IMP
-get_imp (Class class, SEL sel)
-{
- IMP impl;
- void* res = sarray_get (class->dtable, (size_t) sel->sel_id);
- if (res == 0)
- {
- /* Not a valid method */
- if(class->dtable == __objc_uninstalled_dtable)
- {
- /* The dispatch table needs to be installed. */
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_install_dispatch_table_for_class (class);
- objc_mutex_unlock(__objc_runtime_mutex);
- /* Call ourselves with the installed dispatch table
- and get the real method */
- res = get_imp(class, sel);
- }
- else
- {
- /* The dispatch table has been installed so the
- method just doesn't exist for the class.
- Return the forwarding implementation. */
- res = __objc_get_forward_imp(sel);
- }
- }
- return res;
-}
-
-/* Query if an object can respond to a selector, returns YES if the
-object implements the selector otherwise NO. Does not check if the
-method can be forwarded. */
-__inline__
-BOOL
-__objc_responds_to (id object, SEL sel)
-{
- void* res;
-
- /* Install dispatch table if need be */
- if (object->class_pointer->dtable == __objc_uninstalled_dtable)
- {
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_install_dispatch_table_for_class (object->class_pointer);
- objc_mutex_unlock(__objc_runtime_mutex);
- }
-
- /* Get the method from the dispatch table */
- res = sarray_get (object->class_pointer->dtable, (size_t) sel->sel_id);
- return (res != 0);
-}
-
-/* This is the lookup function. All entries in the table are either a
- valid method *or* zero. If zero then either the dispatch table
- needs to be installed or it doesn't exist and forwarding is attempted. */
-__inline__
-IMP
-objc_msg_lookup(id receiver, SEL op)
-{
- IMP result;
- if(receiver)
- {
- result = sarray_get(receiver->class_pointer->dtable, (sidx)op->sel_id);
- if (result == 0)
- {
- /* Not a valid method */
- if(receiver->class_pointer->dtable == __objc_uninstalled_dtable)
- {
- /* The dispatch table needs to be installed.
- This happens on the very first method call to the class. */
- __objc_init_install_dtable(receiver, op);
-
- /* Get real method for this in newly installed dtable */
- result = get_imp(receiver->class_pointer, op);
- }
- else
- {
- /* The dispatch table has been installed so the
- method just doesn't exist for the class.
- Attempt to forward the method. */
- result = __objc_get_forward_imp(op);
- }
- }
- return result;
- }
- else
- return nil_method;
-}
-
-IMP
-objc_msg_lookup_super (Super_t super, SEL sel)
-{
- if (super->self)
- return get_imp (super->class, sel);
- else
- return nil_method;
-}
-
-int method_get_sizeof_arguments (Method*);
-
-retval_t
-objc_msg_sendv(id object, SEL op, arglist_t arg_frame)
-{
- Method* m = class_get_instance_method(object->class_pointer, op);
- const char *type;
- *((id*)method_get_first_argument (m, arg_frame, &type)) = object;
- *((SEL*)method_get_next_argument (arg_frame, &type)) = op;
- return __builtin_apply((apply_t)m->method_imp,
- arg_frame,
- method_get_sizeof_arguments (m));
-}
-
-void
-__objc_init_dispatch_tables()
-{
- __objc_uninstalled_dtable
- = sarray_new(200, 0);
-}
-
-/* This function is called by objc_msg_lookup when the
- dispatch table needs to be installed; thus it is called once
- for each class, namely when the very first message is sent to it. */
-static void
-__objc_init_install_dtable(id receiver, SEL op)
-{
- /* This may happen, if the programmer has taken the address of a
- method before the dtable was initialized... too bad for him! */
- if(receiver->class_pointer->dtable != __objc_uninstalled_dtable)
- return;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- if(CLS_ISCLASS(receiver->class_pointer))
- {
- /* receiver is an ordinary object */
- assert(CLS_ISCLASS(receiver->class_pointer));
-
- /* install instance methods table */
- __objc_install_dispatch_table_for_class (receiver->class_pointer);
-
- /* call +initialize -- this will in turn install the factory
- dispatch table if not already done :-) */
- __objc_send_initialize(receiver->class_pointer);
- }
- else
- {
- /* receiver is a class object */
- assert(CLS_ISCLASS((Class)receiver));
- assert(CLS_ISMETA(receiver->class_pointer));
-
- /* Install real dtable for factory methods */
- __objc_install_dispatch_table_for_class (receiver->class_pointer);
-
- if (strcmp (sel_get_name (op), "initialize"))
- __objc_send_initialize((Class)receiver);
- else
- CLS_SETINITIALIZED((Class)receiver);
- }
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-/* Install dummy table for class which causes the first message to
- that class (or instances hereof) to be initialized properly */
-void
-__objc_install_premature_dtable(Class class)
-{
- assert(__objc_uninstalled_dtable);
- class->dtable = __objc_uninstalled_dtable;
-}
-
-/* Send +initialize to class if not already done */
-static void
-__objc_send_initialize(Class class)
-{
- /* This *must* be a class object */
- assert(CLS_ISCLASS(class));
- assert(!CLS_ISMETA(class));
-
- if (!CLS_ISINITIALIZED(class))
- {
- CLS_SETINITIALIZED(class);
- CLS_SETINITIALIZED(class->class_pointer);
-
- if(class->super_class)
- __objc_send_initialize(class->super_class);
-
- {
- SEL op = sel_register_name ("initialize");
- Class tmpclass = class;
- IMP imp = 0;
-
- while (!imp && tmpclass) {
- MethodList_t method_list = tmpclass->class_pointer->methods;
-
- while(!imp && method_list) {
- int i;
- Method_t method;
-
- for (i=0;i<method_list->method_count;i++) {
- method = &(method_list->method_list[i]);
- if (method->method_name
- && method->method_name->sel_id == op->sel_id) {
- imp = method->method_imp;
- break;
- }
- }
-
- method_list = method_list->method_next;
-
- }
-
- tmpclass = tmpclass->super_class;
- }
- if (imp)
- (*imp)((id)class, op);
-
- }
- }
-}
-
-/* Walk on the methods list of class and install the methods in the reverse
- order of the lists. Since methods added by categories are before the methods
- of class in the methods list, this allows categories to substitute methods
- declared in class. However if more than one category replace the same method
- nothing is guarranteed about what method will be used.
- Assumes that __objc_runtime_mutex is locked down. */
-static void
-__objc_install_methods_in_dtable (Class class, MethodList_t method_list)
-{
- int i;
-
- if (!method_list)
- return;
-
- if (method_list->method_next)
- __objc_install_methods_in_dtable (class, method_list->method_next);
-
- for (i = 0; i < method_list->method_count; i++)
- {
- Method_t method = &(method_list->method_list[i]);
- sarray_at_put_safe (class->dtable,
- (sidx) method->method_name->sel_id,
- method->method_imp);
- }
-}
-
-/* Assumes that __objc_runtime_mutex is locked down. */
-static void
-__objc_install_dispatch_table_for_class (Class class)
-{
- Class super;
- int counter;
-
- /* If the class has not yet had it's class links resolved, we must
- re-compute all class links */
- if(!CLS_ISRESOLV(class))
- __objc_resolve_class_links();
-
- super = class->super_class;
-
- if (super != 0 && (super->dtable == __objc_uninstalled_dtable))
- __objc_install_dispatch_table_for_class (super);
-
- /* Allocate dtable if necessary */
- if (super == 0)
- {
- objc_mutex_lock(__objc_runtime_mutex);
- class->dtable = sarray_new (__objc_selector_max_index, 0);
- objc_mutex_unlock(__objc_runtime_mutex);
- }
- else
- class->dtable = sarray_lazy_copy (super->dtable);
-
- __objc_install_methods_in_dtable (class, class->methods);
-}
-
-void
-__objc_update_dispatch_table_for_class (Class class)
-{
- Class next;
- struct sarray *arr;
-
- /* not yet installed -- skip it */
- if (class->dtable == __objc_uninstalled_dtable)
- return;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- arr = class->dtable;
- __objc_install_premature_dtable (class); /* someone might require it... */
- sarray_free (arr); /* release memory */
-
- /* could have been lazy... */
- __objc_install_dispatch_table_for_class (class);
-
- if (class->subclass_list) /* Traverse subclasses */
- for (next = class->subclass_list; next; next = next->sibling_class)
- __objc_update_dispatch_table_for_class (next);
-
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-
-/* This function adds a method list to a class. This function is
- typically called by another function specific to the run-time. As
- such this function does not worry about thread safe issues.
-
- This one is only called for categories. Class objects have their
- methods installed right away, and their selectors are made into
- SEL's by the function __objc_register_selectors_from_class. */
-void
-class_add_method_list (Class class, MethodList_t list)
-{
- int i;
-
- /* Passing of a linked list is not allowed. Do multiple calls. */
- assert (!list->method_next);
-
- /* Check for duplicates. */
- for (i = 0; i < list->method_count; ++i)
- {
- Method_t method = &list->method_list[i];
-
- if (method->method_name) /* Sometimes these are NULL */
- {
- /* This is where selector names are transmogrified to SEL's */
- method->method_name =
- sel_register_typed_name ((const char*)method->method_name,
- method->method_types);
- }
- }
-
- /* Add the methods to the class's method list. */
- list->method_next = class->methods;
- class->methods = list;
-
- /* Update the dispatch table of class */
- __objc_update_dispatch_table_for_class (class);
-}
-
-Method_t
-class_get_instance_method(Class class, SEL op)
-{
- return search_for_method_in_hierarchy(class, op);
-}
-
-Method_t
-class_get_class_method(MetaClass class, SEL op)
-{
- return search_for_method_in_hierarchy(class, op);
-}
-
-
-/* Search for a method starting from the current class up its hierarchy.
- Return a pointer to the method's method structure if found. NULL
- otherwise. */
-
-static Method_t
-search_for_method_in_hierarchy (Class cls, SEL sel)
-{
- Method_t method = NULL;
- Class class;
-
- if (! sel_is_mapped (sel))
- return NULL;
-
- /* Scan the method list of the class. If the method isn't found in the
- list then step to its super class. */
- for (class = cls; ((! method) && class); class = class->super_class)
- method = search_for_method_in_list (class->methods, sel);
-
- return method;
-}
-
-
-
-/* Given a linked list of method and a method's name. Search for the named
- method's method structure. Return a pointer to the method's method
- structure if found. NULL otherwise. */
-static Method_t
-search_for_method_in_list (MethodList_t list, SEL op)
-{
- MethodList_t method_list = list;
-
- if (! sel_is_mapped (op))
- return NULL;
-
- /* If not found then we'll search the list. */
- while (method_list)
- {
- int i;
-
- /* Search the method list. */
- for (i = 0; i < method_list->method_count; ++i)
- {
- Method_t method = &method_list->method_list[i];
-
- if (method->method_name)
- if (method->method_name->sel_id == op->sel_id)
- return method;
- }
-
- /* The method wasn't found. Follow the link to the next list of
- methods. */
- method_list = method_list->method_next;
- }
-
- return NULL;
-}
-
-static retval_t __objc_forward (id object, SEL sel, arglist_t args);
-
-/* Forwarding pointers/integers through the normal registers */
-static id
-__objc_word_forward (id rcv, SEL op, ...)
-{
- void *args, *res;
-
- args = __builtin_apply_args ();
- res = __objc_forward (rcv, op, args);
- if (res)
- __builtin_return (res);
- else
- return res;
-}
-
-/* Specific routine for forwarding floats/double because of
- architectural differences on some processors. i386s for
- example which uses a floating point stack versus general
- registers for floating point numbers. This forward routine
- makes sure that GCC restores the proper return values */
-static double
-__objc_double_forward (id rcv, SEL op, ...)
-{
- void *args, *res;
-
- args = __builtin_apply_args ();
- res = __objc_forward (rcv, op, args);
- __builtin_return (res);
-}
-
-#if INVISIBLE_STRUCT_RETURN
-static __big
-#else
-static id
-#endif
-__objc_block_forward (id rcv, SEL op, ...)
-{
- void *args, *res;
-
- args = __builtin_apply_args ();
- res = __objc_forward (rcv, op, args);
- if (res)
- __builtin_return (res);
-}
-
-
-/* This function is installed in the dispatch table for all methods which are
- not implemented. Thus, it is called when a selector is not recognized. */
-static retval_t
-__objc_forward (id object, SEL sel, arglist_t args)
-{
- IMP imp;
- static SEL frwd_sel = 0; /* !T:SAFE2 */
- SEL err_sel;
-
- /* first try if the object understands forward:: */
- if (!frwd_sel)
- frwd_sel = sel_get_any_uid("forward::");
-
- if (__objc_responds_to (object, frwd_sel))
- {
- imp = get_imp(object->class_pointer, frwd_sel);
- return (*imp)(object, frwd_sel, sel, args);
- }
-
- /* If the object recognizes the doesNotRecognize: method then we're going
- to send it. */
- err_sel = sel_get_any_uid ("doesNotRecognize:");
- if (__objc_responds_to (object, err_sel))
- {
- imp = get_imp (object->class_pointer, err_sel);
- return (*imp) (object, err_sel, sel);
- }
-
- /* The object doesn't recognize the method. Check for responding to
- error:. If it does then sent it. */
- {
- size_t strlen (const char*);
- char msg[256 + strlen ((const char*)sel_get_name (sel))
- + strlen ((const char*)object->class_pointer->name)];
-
- sprintf (msg, "(%s) %s does not recognize %s",
- (CLS_ISMETA(object->class_pointer)
- ? "class"
- : "instance" ),
- object->class_pointer->name, sel_get_name (sel));
-
- err_sel = sel_get_any_uid ("error:");
- if (__objc_responds_to (object, err_sel))
- {
- imp = get_imp (object->class_pointer, err_sel);
- return (*imp) (object, sel_get_any_uid ("error:"), msg);
- }
-
- /* The object doesn't respond to doesNotRecognize: or error:; Therefore,
- a default action is taken. */
- objc_error (object, OBJC_ERR_UNIMPLEMENTED, "%s\n", msg);
- }
-}
-
-void
-__objc_print_dtable_stats()
-{
- int total = 0;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- printf("memory usage: (%s)\n",
-#ifdef OBJC_SPARSE2
- "2-level sparse arrays"
-#else
- "3-level sparse arrays"
-#endif
- );
-
- printf("arrays: %d = %ld bytes\n", narrays,
- (int)narrays*sizeof(struct sarray));
- total += narrays*sizeof(struct sarray);
- printf("buckets: %d = %ld bytes\n", nbuckets,
- (int)nbuckets*sizeof(struct sbucket));
- total += nbuckets*sizeof(struct sbucket);
-
- printf("idxtables: %d = %ld bytes\n", idxsize, (int)idxsize*sizeof(void*));
- total += idxsize*sizeof(void*);
- printf("-----------------------------------\n");
- printf("total: %d bytes\n", total);
- printf("===================================\n");
-
- objc_mutex_unlock(__objc_runtime_mutex);
-}
-
-/* Returns the uninstalled dispatch table indicator.
- If a class' dispatch table points to __objc_uninstalled_dtable
- then that means it needs its dispatch table to be installed. */
-__inline__
-struct sarray*
-objc_get_uninstalled_dtable()
-{
- return __objc_uninstalled_dtable;
-}
diff --git a/gcc/objc/thr-decosf1.c b/gcc/objc/thr-decosf1.c
deleted file mode 100644
index fa432aa28cb..00000000000
--- a/gcc/objc/thr-decosf1.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/* GNU Objective C Runtime Thread Interface
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <pthread.h>
-#include <objc/thr.h>
-#include "runtime.h"
-
-/********
- * This structure represents a single mutual exclusion lock. Lock semantics
- * are detailed with the subsequent functions. We use whatever lock is
- * provided by the system. We augment it with depth and current owner id
- * fields to implement and re-entrant lock.
- */
-struct objc_mutex
-{
- volatile objc_thread_t owner; /* Id of thread that owns. */
- volatile int depth; /* # of acquires. */
- pthread_mutex_t lock; /* pthread mutex. */
-};
-
-/*****************************************************************************
- * Static variables.
- */
-static pthread_key_t __objc_thread_data_key; /* Data key for thread data.*/
-
-
-/********
- * Initialize the threads subsystem. Returns 0 if successful, or -1 if no
- * thread support is available.
- */
-int
-__objc_init_thread_system(void)
-{
- printf("__objc_init_thread_system\n");
-
- if (pthread_keycreate(&__objc_thread_data_key, NULL) == 0)
- return 0; /* Yes, return success. */
-
- return -1; /* Failed. */
-}
-
-int
-__objc_fini_thread_system(void)
-{
- return 0;
-}
-
-/********
- * Create a new thread of execution and return its id. Return NULL if fails.
- * The new thread starts in "func" with the given argument.
- */
-objc_thread_t
-objc_thread_create(void (*func)(void *arg), void *arg)
-{
- objc_thread_t thread_id = NULL; /* Detached thread id. */
- pthread_t new_thread_handle; /* DCE thread handle. */
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- if (pthread_create(&new_thread_handle, pthread_attr_default,
- (void *)func, arg) == 0) {
- /* ??? May not work! (64bit)*/
- thread_id = *(objc_thread_t *)&new_thread_handle;
- pthread_detach(&new_thread_handle); /* Fully detach thread. */
- __objc_runtime_threads_alive++;
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
- return thread_id;
-}
-
-/********
- * Set the current thread's priority.
- */
-int
-objc_thread_set_priority(int priority)
-{
- int sys_priority = 0;
-
- switch (priority) {
- case OBJC_THREAD_INTERACTIVE_PRIORITY:
- sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2;
- break;
- default:
- case OBJC_THREAD_BACKGROUND_PRIORITY:
- sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
- break;
- case OBJC_THREAD_LOW_PRIORITY:
- sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
- break;
- }
-
- if (pthread_setprio(pthread_self(), sys_priority) >= 0)
- return 0; /* Changed priority. End. */
-
- return -1; /* Failed. */
-}
-
-/********
- * Return the current thread's priority.
- */
-int
-objc_thread_get_priority(void)
-{
- int sys_priority; /* DCE thread priority. */
-
- if ((sys_priority = pthread_getprio(pthread_self())) >= 0) {
- if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP)
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
- if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP)
- return OBJC_THREAD_BACKGROUND_PRIORITY;
- return OBJC_THREAD_LOW_PRIORITY;
- }
- return -1; /* Couldn't get priority. */
-}
-
-/********
- * Yield our process time to another thread. Any BUSY waiting that is done
- * by a thread should use this function to make sure that other threads can
- * make progress even on a lazy uniprocessor system.
- */
-void
-objc_thread_yield(void)
-{
- pthread_yield(); /* Yield to equal thread. */
-}
-
-/********
- * Terminate the current tread. Doesn't return anything. Doesn't return.
- * Actually, if it failed returns -1.
- */
-int
-objc_thread_exit(void)
-{
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_runtime_threads_alive--;
- objc_mutex_unlock(__objc_runtime_mutex);
-
- pthread_exit(&__objc_thread_exit_status); /* Terminate thread. */
- return -1;
-}
-
-/********
- * Returns an integer value which uniquely describes a thread. Must not be
- * -1 which is reserved as a marker for "no thread".
- */
-objc_thread_t
-objc_thread_id(void)
-{
- pthread_t self = pthread_self();
-
- return (objc_thread_t) pthread_getuniqe_np (&self);
-}
-
-/********
- * Sets the thread's local storage pointer. Returns 0 if successful or -1
- * if failed.
- */
-int
-objc_thread_set_data(void *value)
-{
- if (pthread_setspecific(__objc_thread_data_key, (void *)value) == 0)
- return 0; /* Return thread data. */
- return -1;
-}
-
-/********
- * Returns the thread's local storage pointer. Returns NULL on failure.
- */
-void *
-objc_thread_get_data(void)
-{
- void * value = NULL;
-
- if (pthread_getspecific(__objc_thread_data_key, (void *)&value) == 0)
- return value; /* Return thread data. */
-
- return NULL;
-}
-
-/********
- * Allocate a mutex. Return the mutex pointer if successful or NULL if
- * the allocation fails for any reason.
- */
-objc_mutex_t
-objc_mutex_allocate(void)
-{
- objc_mutex_t mutex;
- int err = 0;
-
- if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
- return NULL; /* Abort if malloc failed. */
-
- err = pthread_mutex_init(&mutex->lock, pthread_mutexattr_default);
-
- if (err != 0) { /* System init failed? */
- objc_free(mutex); /* Yes, free local memory. */
- return NULL; /* Abort. */
- }
- mutex->owner = (objc_thread_t) -1; /* No owner. */
- mutex->depth = 0; /* No locks. */
- return mutex; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a mutex. Note that this includes an implicit mutex_lock to
- * insure that no one else is using the lock. It is legal to deallocate
- * a lock if we have a lock on it, but illegal to deallotcate a lock held
- * by anyone else.
- * Returns the number of locks on the thread. (1 for deallocate).
- */
-int
-objc_mutex_deallocate(objc_mutex_t mutex)
-{
- int depth; /* # of locks on mutex. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- depth = objc_mutex_lock(mutex); /* Must have lock. */
-
- pthread_mutex_unlock(&mutex->lock); /* Must unlock system mutex.*/
- pthread_mutex_destroy(&mutex->lock); /* Free system mutex. */
-
- objc_free(mutex); /* Free memory. */
- return depth; /* Return last depth. */
-}
-
-/********
- * Grab a lock on a mutex. If this thread already has a lock on this mutex
- * then we increment the lock count. If another thread has a lock on the
- * mutex we block and wait for the thread to release the lock.
- * Returns the lock count on the mutex held by this thread.
- */
-int
-objc_mutex_lock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (pthread_mutex_lock(&mutex->lock) != 0) /* Lock DCE system mutex. */
- return -1; /* Failed, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Try to grab a lock on a mutex. If this thread already has a lock on
- * this mutex then we increment the lock count and return it. If another
- * thread has a lock on the mutex returns -1.
- */
-int
-objc_mutex_trylock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (pthread_mutex_trylock(&mutex->lock) != 1) /* Lock DCE system mutex. */
- return -1; /* Failed, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Decrements the lock count on this mutex by one. If the lock count reaches
- * zero, release the lock on the mutex. Returns the lock count on the mutex.
- * It is an error to attempt to unlock a mutex which this thread doesn't hold
- * in which case return -1 and the mutex is unaffected.
- * Will also return -1 if the mutex free fails.
- */
-int
-objc_mutex_unlock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Released last lock? */
- return --mutex->depth; /* No, Decrement depth, end.*/
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = (objc_thread_t) -1; /* Set owner to "no thread".*/
-
- if (pthread_mutex_unlock(&mutex->lock) != 0) /* Unlock system mutex. */
- return -1; /* Failed, abort. */
-
- return 0; /* No, return success. */
-}
-
-/* End of File */
diff --git a/gcc/objc/thr-irix.c b/gcc/objc/thr-irix.c
deleted file mode 100644
index 6ea883e257c..00000000000
--- a/gcc/objc/thr-irix.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/* GNU Objective C Runtime Thread Interface - SGI IRIX Implementation
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/sysmp.h>
-#include <sys/prctl.h>
-#include <ulocks.h>
-#include <objc/thr.h>
-#include "runtime.h"
-
-/********
- * This structure represents a single mutual exclusion lock. Lock semantics
- * are detailed with the subsequent functions. We use whatever lock is
- * provided by the system. We augment it with depth and current owner id
- * fields to implement and re-entrant lock.
- */
-struct objc_mutex
-{
- volatile objc_thread_t owner; /* Id of thread that owns. */
- volatile int depth; /* # of acquires. */
- ulock_t lock; /* Irix lock. */
-};
-
-/*****************************************************************************
- * Static variables.
- */
-static void * __objc_shared_arena_handle = NULL; /* Storage arena locks. */
-
-/********
- * Initialize the threads subsystem. Returns 0 if successful, or -1 if no
- * thread support is available.
- */
-int
-__objc_init_thread_system(void)
-{
- char arena_name[64]; /* Name of IRIX arena. */
-
- DEBUG_PRINTF("__objc_init_thread_system\n");
- sprintf(arena_name, "/usr/tmp/objc_%05u", (unsigned)getpid());
- usconfig(CONF_INITUSERS, 256); /* Up to 256 threads. */
- usconfig(CONF_ARENATYPE, US_SHAREDONLY); /* Arena only for threads. */
- if (!(__objc_shared_arena_handle = usinit(arena_name))) /* Init Failed? */
- return -1; /* Yes, return error code. */
-
- return 0;
-}
-
-int
-__objc_fini_thread_system(void)
-{
- return 0;
-}
-
-/********
- * Create a new thread of execution and return its id. Return NULL if fails.
- * The new thread starts in "func" with the given argument.
- */
-objc_thread_t
-objc_thread_create(void (*func)(void *arg), void *arg)
-{
- objc_thread_t thread_id = NULL;
- int sys_id;
-
- objc_mutex_lock(__objc_runtime_mutex);
- if ((sys_id = sproc((void *)func, PR_SALL, arg)) >= 0) {
- thread_id = (objc_thread_t)sys_id;
- __objc_runtime_threads_alive++;
- }
- objc_mutex_unlock(__objc_runtime_mutex);
-
- return thread_id;
-}
-
-/********
- * Set the current thread's priority.
- */
-int
-objc_thread_set_priority(int priority)
-{
- int sys_priority = 0;
-
- switch (priority) {
- case OBJC_THREAD_INTERACTIVE_PRIORITY:
- break;
- default:
- case OBJC_THREAD_BACKGROUND_PRIORITY:
- break;
- case OBJC_THREAD_LOW_PRIORITY:
- break;
- }
- return -1; /* Failed. */
-}
-
-/********
- * Return the current thread's priority.
- */
-int
-objc_thread_get_priority(void)
-{
- return -1; /* Couldn't get priority. */
-}
-
-/********
- * Yield our process time to another thread. Any BUSY waiting that is done
- * by a thread should use this function to make sure that other threads can
- * make progress even on a lazy uniprocessor system.
- */
-void
-objc_thread_yield(void)
-{
- sginap(0); /* Yield to equal process. */
-}
-
-/********
- * Terminate the current tread. Doesn't return anything. Doesn't return.
- * Actually, if it failed returns -1.
- */
-int
-objc_thread_exit(void)
-{
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_runtime_threads_alive--;
- objc_mutex_unlock(__objc_runtime_mutex);
-
- exit(__objc_thread_exit_status); /* IRIX only has exit. */
- return -1;
-}
-
-/********
- * Returns an integer value which uniquely describes a thread. Must not be
- * NULL which is reserved as a marker for "no thread".
- */
-objc_thread_t
-objc_thread_id(void)
-{
- return (objc_thread_t)get_pid(); /* Threads are processes. */
-}
-
-/********
- * Sets the thread's local storage pointer. Returns 0 if successful or -1
- * if failed.
- */
-int
-objc_thread_set_data(void *value)
-{
- *((void **)&PRDA->usr_prda) = value; /* Set thread data ptr. */
- return 0;
-}
-
-/********
- * Returns the thread's local storage pointer. Returns NULL on failure.
- */
-void *
-objc_thread_get_data(void)
-{
- return *((void **)&PRDA->usr_prda); /* Return thread data ptr. */
-}
-
-/********
- * Allocate a mutex.
- * Return the mutex pointer if successful or NULL if the allocation failed
- * for any reason.
- */
-objc_mutex_t
-objc_mutex_allocate(void)
-{
- objc_mutex_t mutex;
- int err = 0;
-
- if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
- return NULL; /* Abort if malloc failed. */
-
- if (!(mutex->lock = usnewlock(__objc_shared_arena_handle)))
- err = -1;
-
- if (err != 0) { /* System init failed? */
- objc_free(mutex); /* Yes, free local memory. */
- return NULL; /* Abort. */
- }
- mutex->owner = NULL; /* No owner. */
- mutex->depth = 0; /* No locks. */
- return mutex; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a mutex. Note that this includes an implicit mutex_lock to
- * insure that no one else is using the lock. It is legal to deallocate
- * a lock if we have a lock on it, but illegal to deallotcate a lock held
- * by anyone else.
- * Returns the number of locks on the thread. (1 for deallocate).
- */
-int
-objc_mutex_deallocate(objc_mutex_t mutex)
-{
- int depth; /* # of locks on mutex. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- depth = objc_mutex_lock(mutex); /* Must have lock. */
-
- usfreelock(mutex->lock, __objc_shared_arena_handle); /* Free IRIX lock. */
-
- objc_free(mutex); /* Free memory. */
- return depth; /* Return last depth. */
-}
-
-/********
- * Grab a lock on a mutex. If this thread already has a lock on this mutex
- * then we increment the lock count. If another thread has a lock on the
- * mutex we block and wait for the thread to release the lock.
- * Returns the lock count on the mutex held by this thread.
- */
-int
-objc_mutex_lock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) { /* Already own lock? */
- DEBUG_PRINTF("lock owned by: %d:%d\n", mutex->owner, mutex->depth);
- return ++mutex->depth; /* Yes, increment depth. */
- }
-
- DEBUG_PRINTF("lock owned by: %d:%d (attempt by %d)\n",
- mutex->owner, mutex->depth, thread_id);
-
- if (ussetlock(mutex->lock) == 0) /* Did lock acquire fail? */
- return -1; /* Yes, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Try to grab a lock on a mutex. If this thread already has a lock on
- * this mutex then we increment the lock count and return it. If another
- * thread has a lock on the mutex returns -1.
- */
-int
-objc_mutex_trylock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (ustestlock(mutex->lock) == 0) /* Did lock acquire fail? */
- return -1; /* Yes, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Decrements the lock count on this mutex by one. If the lock count reaches
- * zero, release the lock on the mutex. Returns the lock count on the mutex.
- * It is an error to attempt to unlock a mutex which this thread doesn't hold
- * in which case return -1 and the mutex is unaffected.
- * Will also return -1 if the mutex free fails.
- */
-
-int
-objc_mutex_unlock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
-
- DEBUG_PRINTF("unlock by: %d:%d\n", mutex->owner, mutex->depth - 1);
-
- if (mutex->depth > 1) /* Released last lock? */
- return --mutex->depth; /* No, Decrement depth, end.*/
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = NULL; /* Set owner to "no thread".*/
-
- usunsetlock(mutex->lock); /* Free lock. */
-
- return 0; /* No, return success. */
-}
-
-/* End of File */
diff --git a/gcc/objc/thr-mach.c b/gcc/objc/thr-mach.c
deleted file mode 100644
index 1f43fc56f24..00000000000
--- a/gcc/objc/thr-mach.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/* GNU Objective C Runtime Thread Implementation
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
- Modified for Mach threads by Bill Bumgarner <bbum@friday.com>
- Condition functions added by Mircea Oancea <mircea@first.elcom.pub.ro>
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <mach/mach.h>
-#include <mach/cthreads.h>
-#include <objc/thr.h>
-#include "runtime.h"
-
-/********
- * This structure represents a single mutual exclusion lock. Lock semantics
- * are detailed with the subsequent functions. We use whatever lock is
- * provided by the system. We augment it with depth and current owner id
- * fields to implement and re-entrant lock.
- */
-struct objc_mutex
-{
- volatile objc_thread_t owner; /* Id of thread that owns. */
- volatile int depth; /* # of acquires. */
- struct mutex lock; /* cthread mutex */
-};
-
-struct objc_condition
-{
- struct condition condition; /* cthread condition */
-};
-
-/********
- * obtain the maximum thread priority that can set for t. Under the
- * mach threading model, it is possible for the developer to adjust the
- * maximum priority downward only-- cannot be raised without superuser
- * priviledges. Once lowered, it cannot be raised.
- */
-static int __mach_get_max_thread_priority(cthread_t t, int *base) {
- thread_t threadP;
- kern_return_t error;
- struct thread_sched_info info;
- unsigned int info_count=THREAD_SCHED_INFO_COUNT;
-
- if (t == NULL)
- return -1;
-
- threadP = cthread_thread(t); /* get thread underlying */
-
- error=thread_info(threadP, THREAD_SCHED_INFO,
- (thread_info_t)&info, &info_count);
-
- if (error != KERN_SUCCESS)
- return -1;
-
- if (base != NULL)
- *base = info.base_priority;
-
- return info.max_priority;
-}
-
-/********
- * Initialize the threads subsystem. Returns 0 if successful, or -1 if no
- * thread support is available.
- */
-int
-__objc_init_thread_system(void)
-{
- DEBUG_PRINTF("__objc_init_thread_system\n");
- return 0; /* Succeeded. */
-}
-
-
-int
-__objc_fini_thread_system(void)
-{
- return 0;
-}
-
-/********
- * Create a new thread of execution and return its id. Return NULL if fails.
- * The new thread starts in "func" with the given argument.
- */
-objc_thread_t
-objc_thread_create(void (*func)(void *arg), void *arg)
-{
- objc_thread_t thread_id = NULL; /* Detached thread id. */
- cthread_t new_thread_handle; /* cthread handle. */
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- /* create thread */
- new_thread_handle = cthread_fork((cthread_fn_t)func, arg);
-
- if(new_thread_handle) {
- /* this is not terribly portable */
- thread_id = *(objc_thread_t *)&new_thread_handle;
- cthread_detach(new_thread_handle); /* fully detach thread */
- __objc_runtime_threads_alive++; /* increment thread count */
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
- return thread_id;
-}
-
-/********
- * Set the current thread's priority.
- */
-int
-objc_thread_set_priority(int priority)
-{
- objc_thread_t *t = objc_thread_id();
- cthread_t cT = (cthread_t) t;
- int maxPriority = __mach_get_max_thread_priority(cT, NULL);
- int sys_priority = 0;
-
- if (maxPriority == -1)
- return -1;
-
- switch (priority) {
- case OBJC_THREAD_INTERACTIVE_PRIORITY:
- sys_priority = maxPriority;
- break;
- case OBJC_THREAD_BACKGROUND_PRIORITY:
- sys_priority = (maxPriority * 2) / 3;
- break;
- case OBJC_THREAD_LOW_PRIORITY:
- sys_priority = maxPriority / 3;
- break;
- default:
- return -1;
- }
-
- if (sys_priority == 0)
- return -1;
-
- if (cthread_priority(cT, sys_priority, 0) == KERN_SUCCESS)
- return 0; /* Changed priority. End. */
-
- return -1; /* Failed. */
-}
-
-/********
- * Return the current thread's priority [well, whatever it is closest to].
- */
-int
-objc_thread_get_priority(void)
-{
- objc_thread_t *t = objc_thread_id();
- cthread_t cT = (cthread_t) t; /* see objc_thread_id() */
- int basePriority;
- int maxPriority;
- int sys_priority = 0;
-
- int interactiveT, backgroundT, lowT; /* threasholds */
-
- maxPriority = __mach_get_max_thread_priority(cT, &basePriority);
-
- if(maxPriority == -1)
- return -1;
-
- if (basePriority > ( (maxPriority * 2) / 3))
- return OBJC_THREAD_INTERACTIVE_PRIORITY; /* interactive priority
- */
- if (basePriority > ( maxPriority / 3))
- return OBJC_THREAD_BACKGROUND_PRIORITY; /* background priority
- */
- return OBJC_THREAD_LOW_PRIORITY; /* everything else is low */
-}
-
-/********
- * Yield our process time to another thread. Any BUSY waiting that is done
- * by a thread should use this function to make sure that other threads can
- * make progress even on a lazy uniprocessor system.
- */
-void
-objc_thread_yield(void)
-{
- cthread_yield(); /* Yield to equal thread. */
-}
-
-/********
- * Terminate the current tread. Doesn't return anything. Doesn't return.
- * Actually, if it failed returns -1.
- */
-int
-objc_thread_exit(void)
-{
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_runtime_threads_alive--;
- objc_mutex_unlock(__objc_runtime_mutex);
-
- cthread_exit(&__objc_thread_exit_status); /* Terminate thread. */
- return -1;
-}
-
-/********
- * Returns an integer value which uniquely describes a thread. Must not be
- * NULL which is reserved as a marker for "no thread".
- */
-objc_thread_t
-objc_thread_id(void)
-{
- cthread_t self = cthread_self();
- return (objc_thread_t)self;
-}
-
-/********
- * Sets the thread's local storage pointer. Returns 0 if successful or -1
- * if failed.
- */
-
-int
-objc_thread_set_data(void *value)
-{
- cthread_set_data(cthread_self(), (any_t) value);
- return 0;
-}
-
-/********
- * Returns the thread's local storage pointer. Returns NULL on failure.
- */
-void *
-objc_thread_get_data(void)
-{
- return (void *) cthread_data(cthread_self());
-}
-
-/********
- * Allocate a mutex. Return the mutex pointer if successful or NULL if the
- * allocation failed for any reason.
- */
-objc_mutex_t
-objc_mutex_allocate(void)
-{
- objc_mutex_t mutex;
- int err = 0;
-
- if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
- return NULL; /* Abort if malloc failed. */
-
- err = mutex_init(&(mutex->lock));
-
- if (err != 0) { /* System init failed? */
- objc_free(mutex); /* Yes, free local memory. */
- return NULL; /* Abort. */
- }
- mutex->owner = (objc_thread_t) -1; /* No owner. */
- mutex->depth = 0; /* No locks. */
- return mutex; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a mutex. Note that this includes an implicit mutex_lock to
- * insure that no one else is using the lock. It is legal to deallocate
- * a lock if we have a lock on it, but illegal to deallocate a lock held
- * by anyone else.
- * Returns the number of locks on the thread. (1 for deallocate).
- */
-int
-objc_mutex_deallocate(objc_mutex_t mutex)
-{
- int depth; /* # of locks on mutex. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- depth = objc_mutex_lock(mutex); /* Must have lock. */
-
- mutex_unlock(&(mutex->lock)); /* Must unlock system mutex.*/
- mutex_clear(&(mutex->lock)); /* Free system mutex. */
-
- objc_free(mutex); /* Free memory. */
- return depth; /* Return last depth. */
-}
-
-/********
- * Grab a lock on a mutex. If this thread already has a lock on this mutex
- * then we increment the lock count. If another thread has a lock on the
- * mutex we block and wait for the thread to release the lock.
- * Returns the lock count on the mutex held by this thread.
- */
-int
-objc_mutex_lock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- mutex_lock(&(mutex->lock)); /* Lock cthread mutex. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Try to grab a lock on a mutex. If this thread already has a lock on
- * this mutex then we increment the lock count and return it. If another
- * thread has a lock on the mutex returns -1.
- */
-int
-objc_mutex_trylock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (mutex_try_lock(&(mutex->lock)) == 0) /* Lock cthread mutex. */
- return -1; /* Failed, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Decrements the lock count on this mutex by one. If the lock count reaches
- * zero, release the lock on the mutex. Returns the lock count on the mutex.
- * It is an error to attempt to unlock a mutex which this thread doesn't hold
- * in which case return -1 and the mutex is unaffected.
- * Will also return -1 if the mutex free fails.
- */
-int
-objc_mutex_unlock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Released last lock? */
- return --mutex->depth; /* No, Decrement depth, end.*/
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = (objc_thread_t) -1; /* Set owner to "no thread".*/
-
- mutex_unlock(&(mutex->lock)); /* unlock cthread mutex. */
-
- return 0; /* No, return success. */
-}
-
-/********
- * Allocate a condition. Return the condition pointer if successful or NULL
- * if the allocation failed for any reason.
- */
-objc_condition_t
-objc_condition_allocate(void)
-{
- objc_condition_t condition;
-
- if (!(condition = (objc_condition_t)objc_malloc(
- sizeof(struct objc_condition))))
- return NULL; /* Abort if malloc failed. */
-
- condition_init(&(condition->condition));
-
- return condition; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a condition. Note that this includes an implicit
- * condition_broadcast to insure that waiting threads have the opportunity
- * to wake. It is legal to dealloc a condition only if no other
- * thread is/will be using it. Here we do NOT check for other threads
- * waiting but just wake them up.
- */
-int
-objc_condition_deallocate(objc_condition_t condition)
-{
- condition_broadcast(&(condition->condition));
- condition_clear(&(condition->condition));
- objc_free(condition);
- return 0;
-}
-
-/********
- * Wait on the condition unlocking the mutex until objc_condition_signal()
- * or objc_condition_broadcast() are called for the same condition. The
- * given mutex *must* have the depth set to 1 so that it can be unlocked
- * here, so that someone else can lock it and signal/broadcast the condition.
- * The mutex is used to lock access to the shared data that make up the
- * "condition" predicate.
- */
-int
-objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex || !condition) /* Is argument bad? */
- return -1; /* Yes, abort. */
-
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Locked more than once ? */
- return -1; /* YES, return error */
- /* mutex will be unlocked */
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = (objc_thread_t) -1; /* Set owner to "no thread".*/
-
- condition_wait(&(condition->condition),
- &(mutex->lock)); /* unlock, wait ..., lock */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- mutex->depth = 1; /* Increment depth to end. */
- return 0; /* Return success. */
-}
-
-/********
- * Wake up all threads waiting on this condition. It is recommended that
- * the called would lock the same mutex as the threads in objc_condition_wait
- * before changing the "condition predicate" and make this call and unlock it
- * right away after this call.
- */
-int
-objc_condition_broadcast(objc_condition_t condition)
-{
- if (!condition)
- return -1;
- condition_broadcast(&(condition->condition));
- return 0;
-}
-
-/********
- * Wake up one thread waiting on this condition. It is recommended that
- * the called would lock the same mutex as the threads in objc_condition_wait
- * before changing the "condition predicate" and make this call and unlock it
- * right away after this call.
- */
-int
-objc_condition_signal(objc_condition_t condition)
-{
- if (!condition)
- return -1;
- condition_signal(&(condition->condition));
- return 0;
-}
-
diff --git a/gcc/objc/thr-os2.c b/gcc/objc/thr-os2.c
deleted file mode 100644
index 422d53ec3c1..00000000000
--- a/gcc/objc/thr-os2.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/* GNU Objective C Runtime Thread Interface - OS/2 emx Implementation
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Thomas Baier (baier@ci.tuwien.ac.at)
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <objc/thr.h>
-#include "runtime.h"
-
-#define INCL_DOSSEMAPHORES
-#define INCL_DOSPROCESS
-
-/*
- * conflicts with objc.h: SEL, BOOL, id
- * solution: prefixing those with _OS2_ before including <os2.h>
- */
-#define SEL _OS2_SEL
-#define BOOL _OS2_BOOL
-#define id _OS2_id
-#include <os2.h>
-#undef id
-#undef SEL
-#undef BOOL
-
-#include <stdlib.h>
-
-/********
- * This structure represents a single mutual exclusion lock. Lock semantics
- * are detailed with the subsequent functions. We use whatever lock is
- * provided by the system. We augment it with depth and current owner id
- * fields to implement and re-entrant lock.
- */
-struct objc_mutex
-{
- volatile objc_thread_t owner; /* Id of thread that owns. */
- volatile int depth; /* # of acquires. */
- HMTX handle; /* OS/2 mutex HANDLE. */
-};
-
-/*****************************************************************************
- * Static variables.
- */
-/* none needed for OS/2 */
-
-/********
- * Initialize the threads subsystem. Returns 0 if successful, or -1 if no
- * thread support is available.
- */
-int
-__objc_init_thread_system(void)
-{
- DEBUG_PRINTF("__objc_init_thread_system (os2-emx)\n");
-
- /* no initialization of thread subsystem */
- return 0; /* Yes, return success. */
-}
-
-int
-__objc_fini_thread_system(void)
-{
- /* no termination code for thread subsystem */
- return 0;
-}
-
-/********
- * Create a new thread of execution and return its id. Return NULL if fails.
- * The new thread starts in "func" with the given argument.
- */
-objc_thread_t
-objc_thread_create(void (*func)(void *arg), void *arg)
-{
- int thread_id = 0; /* id of the newly created thread */
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- /* create a thread calling "func", args "arg", stack size 32768 bytes */
- if ((thread_id = _beginthread (func,NULL,32768,arg)) < 0)
- thread_id = 0;
- else
- __objc_runtime_threads_alive++;
-
- objc_mutex_unlock(__objc_runtime_mutex);
-
- return (objc_thread_t)thread_id;
-}
-
-/********
- * Set the current thread's priority.
- */
-int
-objc_thread_set_priority(int priority)
-{
- ULONG sys_class = 0;
- ULONG sys_priority = 0;
-
- /* OBJC_THREAD_INTERACTIVE_PRIORITY -> PRTYC_FOREGROUNDSERVER
- * OBJC_THREAD_BACKGROUND_PRIORITY -> PRTYC_REGULSR
- * OBJC_THREAD_LOW_PRIORITY -> PRTYC_IDLETIME */
-
- switch (priority) {
- case OBJC_THREAD_INTERACTIVE_PRIORITY:
- sys_class = PRTYC_REGULAR;
- sys_priority = 10;
- break;
- default:
- case OBJC_THREAD_BACKGROUND_PRIORITY:
- sys_class = PRTYC_IDLETIME;
- sys_priority = 25;
- break;
- case OBJC_THREAD_LOW_PRIORITY:
- sys_class = PRTYC_IDLETIME;
- sys_priority = 0;
- break;
- }
- if (!DosSetPriority (PRTYS_THREAD,sys_class,sys_priority,*_threadid))
- return 0; /* Changed priority. End. */
-
- return -1; /* Failed. */
-}
-
-/********
- * Return the current thread's priority.
- */
-int
-objc_thread_get_priority(void)
-{
- PTIB ptib;
- PPIB ppib;
-
- DosGetInfoBlocks (&ptib,&ppib); /* get information about current thread */
-
- switch (ptib->tib_ptib2->tib2_ulpri) {
- case PRTYC_IDLETIME:
- case PRTYC_REGULAR:
- case PRTYC_TIMECRITICAL:
- case PRTYC_FOREGROUNDSERVER:
- default:
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
- }
- return -1; /* Couldn't get priority. */
-}
-
-/********
- * Yield our process time to another thread. Any BUSY waiting that is done
- * by a thread should use this function to make sure that other threads can
- * make progress even on a lazy uniprocessor system.
- */
-void
-objc_thread_yield(void)
-{
- DosSleep (0); /* Yield to equal thread. */
-}
-
-/********
- * Terminate the current tread. Doesn't return anything. Doesn't return.
- * Actually, if it failed returns -1.
- */
-int
-objc_thread_exit(void)
-{
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_runtime_threads_alive--;
- objc_mutex_unlock(__objc_runtime_mutex);
-
- _endthread (); /* terminate the thread, NEVER use DosExit () */
-
- return -1;
-}
-
-/********
- * Returns an integer value which uniquely describes a thread. Must not be
- * -1 which is reserved as a marker for "no thread".
- */
-objc_thread_t
-objc_thread_id(void)
-{
- return (objc_thread_t) *_threadid; /* Return thread id. */
-}
-
-/********
- * Sets the thread's local storage pointer. Returns 0 if successful or -1
- * if failed.
- */
-int
-objc_thread_set_data(void *value)
-{
- *_threadstore () = value;
-
- return 0;
-}
-
-/********
- * Returns the thread's local storage pointer. Returns NULL on failure.
- */
-void *
-objc_thread_get_data(void)
-{
- return *_threadstore ();
-}
-
-/********
- * Allocate a mutex. Return the mutex pointer if successful or NULL if
- * the allocation fails for any reason.
- */
-objc_mutex_t
-objc_mutex_allocate(void)
-{
- objc_mutex_t mutex;
- int err = 0;
-
- if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
- return NULL; /* Abort if malloc failed. */
-
- if (DosCreateMutexSem (NULL,&(mutex->handle),0L,0) > 0) {
- objc_free(mutex);
- return NULL;
- }
-
- mutex->owner = NULL; /* No owner. */
- mutex->depth = 0; /* No locks. */
- return mutex; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a mutex. Note that this includes an implicit mutex_lock to
- * insure that no one else is using the lock. It is legal to deallocate
- * a lock if we have a lock on it, but illegal to deallotcate a lock held
- * by anyone else.
- * Returns the number of locks on the thread. (1 for deallocate).
- */
-int
-objc_mutex_deallocate(objc_mutex_t mutex)
-{
- int depth; /* # of locks on mutex. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- depth = objc_mutex_lock(mutex); /* Must have lock. */
-
- DosCloseMutexSem (mutex->handle);
-
- objc_free(mutex); /* Free memory. */
- return depth; /* Return last depth. */
-}
-
-/********
- * Grab a lock on a mutex. If this thread already has a lock on this mutex
- * then we increment the lock count. If another thread has a lock on the
- * mutex we block and wait for the thread to release the lock.
- * Returns the lock count on the mutex held by this thread.
- */
-int
-objc_mutex_lock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
-
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (DosRequestMutexSem (mutex->handle,-1L) != 0)
- return -1;
-
- mutex->owner = thread_id; /* Mark thread as owner. */
-
- return ++mutex->depth; /* Increment depth to end. */
-}
-
-/********
- * Try to grab a lock on a mutex. If this thread already has a lock on
- * this mutex then we increment the lock count and return it. If another
- * thread has a lock on the mutex returns -1.
- */
-int
-objc_mutex_trylock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (DosRequestMutexSem (mutex->handle,0L) != 0)
- return -1;
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return ++mutex->depth; /* Increment depth to end. */
-}
-
-/********
- * Decrements the lock count on this mutex by one. If the lock count reaches
- * zero, release the lock on the mutex. Returns the lock count on the mutex.
- * It is an error to attempt to unlock a mutex which this thread doesn't hold
- * in which case return -1 and the mutex is unaffected.
- * Will also return -1 if the mutex free fails.
- */
-int
-objc_mutex_unlock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Released last lock? */
- return --mutex->depth; /* No, Decrement depth, end.*/
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = NULL; /* Set owner to "no thread".*/
-
- if (DosReleaseMutexSem(mutex->handle) != 0)
- return -1; /* Failed, abort. */
-
- return 0; /* No, return success. */
-}
diff --git a/gcc/objc/thr-posix.c b/gcc/objc/thr-posix.c
deleted file mode 100644
index 987f8a81b01..00000000000
--- a/gcc/objc/thr-posix.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/* GNU Objective C Runtime Thread Interface for POSIX compliant threads
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
- Modified for Linux/Pthreads by Kai-Uwe Sattler (kus@iti.cs.uni-magdeburg.de)
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <objc/thr.h>
-#include "runtime.h"
-#include <pthread.h>
-
-/********
- * This structure represents a single mutual exclusion lock. Lock semantics
- * are detailed with the subsequent functions. We use whatever lock is
- * provided by the system. We augment it with depth and current owner id
- * fields to implement and re-entrant lock.
- */
-struct objc_mutex
-{
- volatile objc_thread_t owner; /* Id of thread that owns. */
- volatile int depth; /* # of acquires. */
- pthread_mutex_t lock; /* pthread mutex. */
-};
-
-/*****************************************************************************
- * Static variables.
- */
-static pthread_key_t __objc_thread_data_key; /* Data key for thread data.*/
-
-
-/********
- * Initialize the threads subsystem. Returns 0 if successful, or -1 if no
- * thread support is available.
- */
-int
-__objc_init_thread_system(void)
-{
- if (pthread_key_create(&__objc_thread_data_key, NULL) == 0)
- return 0; /* Yes, return success. */
-
- return -1; /* Failed. */
-}
-
-int
-__objc_fini_thread_system(void)
-{
- return 0;
-}
-
-/********
- * Create a new thread of execution and return its id. Return NULL if fails.
- * The new thread starts in "func" with the given argument.
- */
-objc_thread_t
-objc_thread_create(void (*func)(void *arg), void *arg)
-{
- objc_thread_t thread_id = NULL; /* Detached thread id. */
- pthread_t new_thread_handle; /* DCE thread handle. */
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- if (pthread_create(&new_thread_handle, NULL,
- (void *)func, arg) == 0) {
- thread_id = (objc_thread_t) new_thread_handle;
- pthread_detach(new_thread_handle); /* Fully detach thread. */
- __objc_runtime_threads_alive++;
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
- return thread_id;
-}
-
-/********
- * Set the current thread's priority.
- */
-int
-objc_thread_set_priority(int priority)
-{
-#if 0 /* no get/set priority in Linux pthreads */
-
- int sys_priority = 0;
-
- switch (priority) {
- case OBJC_THREAD_INTERACTIVE_PRIORITY:
- sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2;
- break;
- default:
- case OBJC_THREAD_BACKGROUND_PRIORITY:
- sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
- break;
- case OBJC_THREAD_LOW_PRIORITY:
- sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
- break;
- }
-
- if (pthread_setprio(pthread_self(), sys_priority) >= 0)
- return 0; /* Changed priority. End. */
-
-#endif
- return -1; /* Failed. */
-}
-
-/********
- * Return the current thread's priority.
- */
-int
-objc_thread_get_priority(void)
-{
-#if 0 /* no get/set priority in Linux pthreads */
- int sys_priority; /* DCE thread priority. */
-
- if ((sys_priority = pthread_getprio(pthread_self())) >= 0) {
- if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP)
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
- if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP)
- return OBJC_THREAD_BACKGROUND_PRIORITY;
- return OBJC_THREAD_LOW_PRIORITY;
- }
-#endif
- return -1; /* Couldn't get priority. */
-}
-
-/********
- * Yield our process time to another thread. Any BUSY waiting that is done
- * by a thread should use this function to make sure that other threads can
- * make progress even on a lazy uniprocessor system.
- */
-void
-objc_thread_yield(void)
-{
- pthread_yield(); /* Yield to equal thread. */
-}
-
-/********
- * Terminate the current tread. Doesn't return anything. Doesn't return.
- * Actually, if it failed returns -1.
- */
-int
-objc_thread_exit(void)
-{
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_runtime_threads_alive--;
- objc_mutex_unlock(__objc_runtime_mutex);
-
- pthread_exit(&__objc_thread_exit_status); /* Terminate thread. */
- return -1;
-}
-
-/********
- * Returns an integer value which uniquely describes a thread. Must not be
- * -1 which is reserved as a marker for "no thread".
- */
-objc_thread_t
-objc_thread_id(void)
-{
- pthread_t self = pthread_self();
-
- return (objc_thread_t) self; /* Return thread handle. */
-}
-
-/********
- * Sets the thread's local storage pointer. Returns 0 if successful or -1
- * if failed.
- */
-int
-objc_thread_set_data(void *value)
-{
- if (pthread_setspecific(__objc_thread_data_key, (void *)value) == 0)
- return 0; /* Return thread data. */
- return -1;
-}
-
-/********
- * Returns the thread's local storage pointer. Returns NULL on failure.
- */
-void *
-objc_thread_get_data(void)
-{
- return pthread_getspecific(__objc_thread_data_key);
-}
-
-/********
- * Allocate a mutex. Return the mutex pointer if successful or NULL if
- * the allocation fails for any reason.
- */
-objc_mutex_t
-objc_mutex_allocate(void)
-{
- objc_mutex_t mutex;
- int err = 0;
-
- if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
- return NULL; /* Abort if malloc failed. */
-
- err = pthread_mutex_init(&mutex->lock, NULL);
-
- if (err != 0) { /* System init failed? */
- objc_free(mutex); /* Yes, free local memory. */
- return NULL; /* Abort. */
- }
- mutex->owner = NULL; /* No owner. */
- mutex->depth = 0; /* No locks. */
- return mutex; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a mutex. Note that this includes an implicit mutex_lock to
- * insure that no one else is using the lock. It is legal to deallocate
- * a lock if we have a lock on it, but illegal to deallotcate a lock held
- * by anyone else.
- * Returns the number of locks on the thread. (1 for deallocate).
- */
-int
-objc_mutex_deallocate(objc_mutex_t mutex)
-{
- int depth; /* # of locks on mutex. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- depth = objc_mutex_lock(mutex); /* Must have lock. */
-
- pthread_mutex_unlock(&mutex->lock); /* Must unlock system mutex.*/
- pthread_mutex_destroy(&mutex->lock); /* Free system mutex. */
-
- objc_free(mutex); /* Free memory. */
- return depth; /* Return last depth. */
-}
-
-/********
- * Grab a lock on a mutex. If this thread already has a lock on this mutex
- * then we increment the lock count. If another thread has a lock on the
- * mutex we block and wait for the thread to release the lock.
- * Returns the lock count on the mutex held by this thread.
- */
-int
-objc_mutex_lock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (pthread_mutex_lock(&mutex->lock) != 0) /* Lock DCE system mutex. */
- return -1; /* Failed, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Try to grab a lock on a mutex. If this thread already has a lock on
- * this mutex then we increment the lock count and return it. If another
- * thread has a lock on the mutex returns -1.
- */
-int
-objc_mutex_trylock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (pthread_mutex_trylock(&mutex->lock) != 1) /* Lock DCE system mutex. */
- return -1; /* Failed, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Decrements the lock count on this mutex by one. If the lock count reaches
- * zero, release the lock on the mutex. Returns the lock count on the mutex.
- * It is an error to attempt to unlock a mutex which this thread doesn't hold
- * in which case return -1 and the mutex is unaffected.
- * Will also return -1 if the mutex free fails.
- */
-int
-objc_mutex_unlock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Released last lock? */
- return --mutex->depth; /* No, Decrement depth, end.*/
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = NULL; /* Set owner to "no thread".*/
-
- if (pthread_mutex_unlock(&mutex->lock) != 0) /* Unlock system mutex. */
- return -1; /* Failed, abort. */
-
- return 0; /* No, return success. */
-}
diff --git a/gcc/objc/thr-pthreads.c b/gcc/objc/thr-pthreads.c
deleted file mode 100644
index 3e73fe07eb1..00000000000
--- a/gcc/objc/thr-pthreads.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/* GNU Objective C Runtime Thread Implementation for PCThreads under Linux.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Scott Christley <scottc@net-community.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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <pthread.h>
-#include <objc/thr.h>
-#include "runtime.h"
-
-/* Key structure for maintiain thread specific storage */
-static pthread_key_t _objc_thread_storage;
-
-/********
- * This structure represents a single mutual exclusion lock. Lock semantics
- * are detailed with the subsequent functions. We use whatever lock is
- * provided by the system. We augment it with depth and current owner id
- * fields to implement and re-entrant lock.
- */
-struct objc_mutex
-{
- volatile objc_thread_t owner; /* Id of thread that owns. */
- volatile int depth; /* # of acquires. */
- pthread_mutex_t mutex; /* PCThread mutex */
-};
-
-struct objc_condition
-{
- pthread_cond_t condition; /* cthread condition */
-};
-
-/********
- * Initialize the threads subsystem. Returns 0 if successful, or -1 if no
- * thread support is available.
- */
-int
-__objc_init_thread_system(void)
-{
- /* Initialize the thread storage key */
- return pthread_key_create(&_objc_thread_storage, NULL);
-}
-
-/********
- * Finalize the threads subsystem. Returns 0 if successful, or -1 if not
- */
-int
-__objc_fini_thread_system(void)
-{
- /* Destroy the thread storage key */
- /* Not implemented yet */
- /* return pthread_key_delete(&_objc_thread_storage); */
- return 0;
-}
-
-/********
- * Create a new thread of execution and return its id. Return NULL if fails.
- * The new thread starts in "func" with the given argument.
- */
-objc_thread_t
-objc_thread_create(void (*func)(void *arg), void *arg)
-{
- objc_thread_t thread_id;
- pthread_t new_thread_handle;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) )
- {
- thread_id = *(objc_thread_t *)&new_thread_handle;
- __objc_runtime_threads_alive++;
- }
- else
- thread_id = NULL;
-
- objc_mutex_unlock(__objc_runtime_mutex);
-
- return thread_id;
-}
-
-/********
- * Set the current thread's priority.
- */
-int
-objc_thread_set_priority(int priority)
-{
- /* Not implemented yet */
- return -1; /* Failed. */
-}
-
-/********
- * Return the current thread's priority.
- */
-int
-objc_thread_get_priority(void)
-{
- /* Not implemented yet */
- return OBJC_THREAD_INTERACTIVE_PRIORITY; /* Highest priority. */
-}
-
-/********
- * Yield our process time to another thread. Any BUSY waiting that is done
- * by a thread should use this function to make sure that other threads can
- * make progress even on a lazy uniprocessor system.
- */
-void
-objc_thread_yield(void)
-{
- pthread_yield(NULL);
-}
-
-/********
- * Terminate the current tread. Doesn't return anything. Doesn't return.
- * Actually, if it failed returns -1.
- */
-int
-objc_thread_exit(void)
-{
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_runtime_threads_alive--;
- objc_mutex_unlock(__objc_runtime_mutex);
-
- pthread_exit(&__objc_thread_exit_status); /* Terminate thread. */
- return -1;
-}
-
-/********
- * Returns an integer value which uniquely describes a thread. Must not be
- * NULL which is reserved as a marker for "no thread".
- */
-objc_thread_t
-objc_thread_id(void)
-{
- pthread_t self = pthread_self();
-
- return *(objc_thread_t *)&self; /* Return thread handle. */
-}
-
-/********
- * Sets the thread's local storage pointer. Returns 0 if successful or -1
- * if failed.
- */
-int
-objc_thread_set_data(void *value)
-{
- return pthread_setspecific(_objc_thread_storage, value);
-}
-
-/********
- * Returns the thread's local storage pointer. Returns NULL on failure.
- */
-void *
-objc_thread_get_data(void)
-{
- void *value = NULL;
-
- if ( !(pthread_getspecific(_objc_thread_storage, &value)) )
- return value;
-
- return NULL;
-}
-
-/********
- * Allocate a mutex. Return the mutex pointer if successful or NULL if the
- * allocation failed for any reason.
- */
-objc_mutex_t
-objc_mutex_allocate(void)
-{
- objc_mutex_t mutex;
-
- if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
- return NULL; /* Abort if malloc failed. */
-
- /* Create PCThread mutex */
- if ( pthread_mutex_init(&(mutex->mutex), NULL) )
- {
- /* Failed */
- objc_free(mutex);
- return NULL;
- }
-
- mutex->owner = NULL; /* No owner. */
- mutex->depth = 0; /* No locks. */
- return mutex; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a mutex. Note that this includes an implicit mutex_lock to
- * insure that no one else is using the lock. It is legal to deallocate
- * a lock if we have a lock on it, but illegal to deallocate a lock held
- * by anyone else.
- * Returns the number of locks on the thread. (1 for deallocate).
- */
-int
-objc_mutex_deallocate(objc_mutex_t mutex)
-{
- int depth; /* # of locks on mutex. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- depth = objc_mutex_lock(mutex); /* Must have lock. */
-
- /* Destroy PCThread mutex */
- pthread_mutex_destroy(&(mutex->mutex));
-
- objc_free(mutex); /* Free memory. */
- return depth; /* Return last depth. */
-}
-
-/********
- * Grab a lock on a mutex. If this thread already has a lock on this mutex
- * then we increment the lock count. If another thread has a lock on the
- * mutex we block and wait for the thread to release the lock.
- * Returns the lock count on the mutex held by this thread.
- */
-int
-objc_mutex_lock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
- int status;
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- {
- return ++mutex->depth; /* Yes, increment depth. */
- }
-
- /* Lock the PCThread mutex */
- status = pthread_mutex_lock(&(mutex->mutex));
- if (status)
- {
- return status; /* Failed */
- }
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Try to grab a lock on a mutex. If this thread already has a lock on
- * this mutex then we increment the lock count and return it. If another
- * thread has a lock on the mutex returns -1.
- */
-int
-objc_mutex_trylock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
- int status;
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- /* Lock the PCThread mutex */
- status = pthread_mutex_trylock(&(mutex->mutex));
- if (status)
- return status; /* Failed */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Decrements the lock count on this mutex by one. If the lock count reaches
- * zero, release the lock on the mutex. Returns the lock count on the mutex.
- * It is an error to attempt to unlock a mutex which this thread doesn't hold
- * in which case return -1 and the mutex is unaffected.
- * Will also return -1 if the mutex free fails.
- */
-int
-objc_mutex_unlock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
- int status;
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Released last lock? */
- return --mutex->depth; /* No, Decrement depth, end.*/
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = NULL; /* Set owner to "no thread".*/
-
- /* Unlock the PCThread mutex */
- status = pthread_mutex_unlock(&(mutex->mutex));
- if (status)
- return status; /* Failed */
-
- return 0; /* No, return success. */
-}
-
-/********
- * Allocate a condition. Return the condition pointer if successful or NULL
- * if the allocation failed for any reason.
- */
-objc_condition_t
-objc_condition_allocate(void)
-{
- objc_condition_t condition;
-
- if (!(condition = (objc_condition_t)objc_malloc(
- sizeof(struct objc_condition))))
- return NULL; /* Abort if malloc failed. */
-
- if ( pthread_cond_init(&(condition->condition), NULL) ) {
- objc_free(condition);
- return NULL;
- }
-
- return condition; /* Return condition handle. */
-}
-
-/********
- * Deallocate a condition. Note that this includes an implicit
- * condition_broadcast to insure that waiting threads have the opportunity
- * to wake. It is legal to dealloc a condition only if no other
- * thread is/will be using it. Here we do NOT check for other threads
- * waiting but just wake them up.
- */
-int
-objc_condition_deallocate(objc_condition_t condition)
-{
- pthread_cond_broadcast(&(condition->condition));
- pthread_cond_destroy(&(condition->condition));
- objc_free(condition);
- return 0;
-}
-
-/********
- * Wait on the condition unlocking the mutex until objc_condition_signal()
- * or objc_condition_broadcast() are called for the same condition. The
- * given mutex *must* have the depth set to 1 so that it can be unlocked
- * here, so that someone else can lock it and signal/broadcast the condition.
- * The mutex is used to lock access to the shared data that make up the
- * "condition" predicate.
- */
-int
-objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex || !condition) /* Is argument bad? */
- return -1; /* Yes, abort. */
-
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Locked more than once ? */
- return -1; /* YES, return error */
- /* mutex will be unlocked */
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = (objc_thread_t) -1; /* Set owner to "no thread".*/
-
- pthread_cond_wait(&(condition->condition),
- &(mutex->mutex)); /* unlock, wait ..., lock */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- mutex->depth = 1; /* Increment depth to end. */
- return 0; /* Return success. */
-}
-
-/********
- * Wake up all threads waiting on this condition. It is recommended that
- * the called would lock the same mutex as the threads in objc_condition_wait
- * before changing the "condition predicate" and make this call and unlock it
- * right away after this call.
- */
-int
-objc_condition_broadcast(objc_condition_t condition)
-{
- if (!condition)
- return -1;
- pthread_cond_broadcast(&(condition->condition));
- return 0;
-}
-
-/********
- * Wake up one thread waiting on this condition. It is recommended that
- * the called would lock the same mutex as the threads in objc_condition_wait
- * before changing the "condition predicate" and make this call and unlock it
- * right away after this call.
- */
-int
-objc_condition_signal(objc_condition_t condition)
-{
- if (!condition)
- return -1;
- pthread_cond_signal(&(condition->condition));
- return 0;
-}
-
-/* End of File */
diff --git a/gcc/objc/thr-single.c b/gcc/objc/thr-single.c
deleted file mode 100644
index 45b7b73fe2a..00000000000
--- a/gcc/objc/thr-single.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* GNU Objective C Runtime Thread Implementation
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <objc/thr.h>
-#include "runtime.h"
-
-/********
- * This structure represents a single mutual exclusion lock. Lock semantics
- * are detailed with the subsequent functions. We use whatever lock is
- * provided by the system. We augment it with depth and current owner id
- * fields to implement and re-entrant lock.
- */
-struct objc_mutex
-{
- volatile objc_thread_t owner; /* Id of thread that owns. */
- volatile int depth; /* # of acquires. */
-};
-
-/********
- * Initialize the threads subsystem. Returns 0 if successful, or -1 if no
- * thread support is available.
- */
-int
-__objc_init_thread_system(void)
-{
- DEBUG_PRINTF("__objc_init_thread_system\n");
- return -1; /* Failed. */
-}
-
-/********
- * Create a new thread of execution and return its id. Return NULL if fails.
- * The new thread starts in "func" with the given argument.
- */
-objc_thread_t
-objc_thread_create(void (*func)(void *arg), void *arg)
-{
- return NULL; /* We can't start threads. */
-}
-
-/********
- * Set the current thread's priority.
- */
-int
-objc_thread_set_priority(int priority)
-{
- return -1; /* Failed. */
-}
-
-/********
- * Return the current thread's priority.
- */
-int
-objc_thread_get_priority(void)
-{
- return OBJC_THREAD_INTERACTIVE_PRIORITY; /* Highest priority. */
-}
-
-/********
- * Yield our process time to another thread. Any BUSY waiting that is done
- * by a thread should use this function to make sure that other threads can
- * make progress even on a lazy uniprocessor system.
- */
-void
-objc_thread_yield(void)
-{
- return;
-}
-
-/********
- * Terminate the current tread. Doesn't return anything. Doesn't return.
- * Actually, if it failed returns -1.
- */
-int
-objc_thread_exit(void)
-{
- exit(__objc_thread_exit_status);
- return -1;
-}
-
-/********
- * Returns an integer value which uniquely describes a thread. Must not be
- * NULL which is reserved as a marker for "no thread".
- */
-objc_thread_t
-objc_thread_id(void)
-{
- return (objc_thread_t)1; /* No thread support, use 1.*/
-}
-
-/********
- * Sets the thread's local storage pointer. Returns 0 if successful or -1
- * if failed.
- */
-
-static void *thread_local_storage = NULL;
-
-int
-objc_thread_set_data(void *value)
-{
- thread_local_storage = value;
- return 0;
-}
-
-/********
- * Returns the thread's local storage pointer. Returns NULL on failure.
- */
-void *
-objc_thread_get_data(void)
-{
- return thread_local_storage;
-}
-
-/********
- * Allocate a mutex. Return the mutex pointer if successful or NULL if the
- * allocation failed for any reason.
- */
-objc_mutex_t
-objc_mutex_allocate(void)
-{
- objc_mutex_t mutex;
-
- if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
- return NULL; /* Abort if malloc failed. */
-
- mutex->owner = NULL; /* No owner. */
- mutex->depth = 0; /* No locks. */
- return mutex; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a mutex. Note that this includes an implicit mutex_lock to
- * insure that no one else is using the lock. It is legal to deallocate
- * a lock if we have a lock on it, but illegal to deallocate a lock held
- * by anyone else.
- * Returns the number of locks on the thread. (1 for deallocate).
- */
-int
-objc_mutex_deallocate(objc_mutex_t mutex)
-{
- int depth; /* # of locks on mutex. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- depth = objc_mutex_lock(mutex); /* Must have lock. */
-
- objc_free(mutex); /* Free memory. */
- return depth; /* Return last depth. */
-}
-
-/********
- * Grab a lock on a mutex. If this thread already has a lock on this mutex
- * then we increment the lock count. If another thread has a lock on the
- * mutex we block and wait for the thread to release the lock.
- * Returns the lock count on the mutex held by this thread.
- */
-int
-objc_mutex_lock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
-
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Try to grab a lock on a mutex. If this thread already has a lock on
- * this mutex then we increment the lock count and return it. If another
- * thread has a lock on the mutex returns -1.
- */
-int
-objc_mutex_trylock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Decrements the lock count on this mutex by one. If the lock count reaches
- * zero, release the lock on the mutex. Returns the lock count on the mutex.
- * It is an error to attempt to unlock a mutex which this thread doesn't hold
- * in which case return -1 and the mutex is unaffected.
- * Will also return -1 if the mutex free fails.
- */
-int
-objc_mutex_unlock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Released last lock? */
- return --mutex->depth; /* No, Decrement depth, end.*/
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = NULL; /* Set owner to "no thread".*/
-
- return 0; /* No, return success. */
-}
-
-/* End of File */
diff --git a/gcc/objc/thr-solaris.c b/gcc/objc/thr-solaris.c
deleted file mode 100644
index f1084bc7913..00000000000
--- a/gcc/objc/thr-solaris.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/* GNU Objective C Runtime Thread Interface
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
- Conditions added by Mircea Oancea (mircea@first.elcom.pub.ro)
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <objc/thr.h>
-#include "runtime.h"
-
-#include <thread.h>
-#include <synch.h>
-#include <errno.h>
-
-/********
- * This structure represents a single mutual exclusion lock. Lock semantics
- * are detailed with the subsequent functions. We use whatever lock is
- * provided by the system. We augment it with depth and current owner id
- * fields to implement and re-entrant lock.
- */
-struct objc_mutex
-{
- volatile objc_thread_t owner; /* Id of thread that owns. */
- volatile int depth; /* # of acquires. */
- mutex_t lock; /* System mutex. */
-};
-
-struct objc_condition
-{
- cond_t condition; /* solaris condition */
-};
-
-/*****************************************************************************
- * Static variables.
- */
-static thread_key_t __objc_thread_data_key; /* Data key for thread data.*/
-
-/********
- * Initialize the threads subsystem. Returns 0 if successful, or -1 if no
- * thread support is available.
- */
-int
-__objc_init_thread_system(void)
-{
- DEBUG_PRINTF("__objc_init_thread_system\n");
-
- if (thr_keycreate(&__objc_thread_data_key, NULL) == 0)
- return 0; /* Yes, return success. */
-
- return -1; /* Failed. */
-}
-
-int
-__objc_fini_thread_system(void)
-{
- return 0;
-}
-
-/********
- * Create a new thread of execution and return its id. Return -1 if fails.
- * The new thread starts in "func" with the given argument.
- */
-objc_thread_t
-objc_thread_create(void (*func)(void *arg), void *arg)
-{
- objc_thread_t thread_id = NULL; /* Detached thread id. */
- thread_t new_thread_id = 0; /* Solaris thread id type. */
- int errn;
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- if (thr_create(NULL, 0, (void *)func, arg,
- THR_DETACHED | THR_NEW_LWP,
- &new_thread_id) == 0) { /* Created new thread? */
- thread_id = (objc_thread_t)new_thread_id; /* Yes, remember its id. */
- __objc_runtime_threads_alive++;
- }
-
- objc_mutex_unlock(__objc_runtime_mutex);
-
- return thread_id;
-}
-
-/********
- * Set the current thread's priority.
- */
-int
-objc_thread_set_priority(int priority)
-{
- int sys_priority = 0;
-
- switch (priority) {
- case OBJC_THREAD_INTERACTIVE_PRIORITY:
- sys_priority = 300;
- break;
- default:
- case OBJC_THREAD_BACKGROUND_PRIORITY:
- sys_priority = 200;
- break;
- case OBJC_THREAD_LOW_PRIORITY:
- sys_priority = 1000;
- break;
- }
-
- if (thr_setprio(thr_self(), sys_priority) == 0)
- return 0; /* Changed priority. End. */
-
- return -1; /* Failed. */
-}
-
-/********
- * Return the current thread's priority.
- */
-int
-objc_thread_get_priority(void)
-{
- int sys_priority; /* Solaris thread priority. */
-
- if (thr_getprio(thr_self(), &sys_priority) == 0) {
- if (sys_priority >= 250)
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
- else if (sys_priority >= 150)
- return OBJC_THREAD_BACKGROUND_PRIORITY;
- return OBJC_THREAD_LOW_PRIORITY;
- }
-
- return -1; /* Couldn't get priority. */
-}
-
-/********
- * Yield our process time to another thread. Any BUSY waiting that is done
- * by a thread should use this function to make sure that other threads can
- * make progress even on a lazy uniprocessor system.
- */
-void
-objc_thread_yield(void)
-{
- thr_yield(); /* Yield to equal thread. */
-}
-
-/********
- * Terminate the current tread. Doesn't return anything. Doesn't return.
- * Actually, if it failed returns -1.
- */
-int
-objc_thread_exit(void)
-{
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_runtime_threads_alive++;
- objc_mutex_unlock(__objc_runtime_mutex);
-
- thr_exit(&__objc_thread_exit_status); /* Terminate thread. */
- return -1;
-}
-
-/********
- * Returns an integer value which uniquely describes a thread. Must not be
- * NULL which is reserved as a marker for "no thread".
- */
-objc_thread_t
-objc_thread_id(void)
-{
- return (objc_thread_t)thr_self();
-}
-
-/********
- * Sets the thread's local storage pointer. Returns 0 if successful or -1
- * if failed.
- */
-int
-objc_thread_set_data(void *value)
-{
- if (thr_setspecific(__objc_thread_data_key, value) == 0)
- return 0;
- return -1;
-}
-
-/********
- * Returns the thread's local storage pointer. Returns NULL on failure.
- */
-void *
-objc_thread_get_data(void)
-{
- void * value = NULL;
-
- if (thr_getspecific(__objc_thread_data_key, &value) == 0)
- return value; /* Return thread data. */
-
- return NULL;
-}
-
-/********
- * Allocate a mutex. Return the mutex pointer if successful or NULL if
- * the allocation fails for any reason.
- */
-objc_mutex_t
-objc_mutex_allocate(void)
-{
- struct objc_mutex *mutex;
- int err = 0;
-
- if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
- return NULL; /* Abort if malloc failed. */
-
- err = mutex_init(&mutex->lock, USYNC_THREAD, 0);
-
- if (err != 0) { /* System init failed? */
- objc_free(mutex); /* Yes, free local memory. */
- return NULL; /* Abort. */
- }
- mutex->owner = NULL; /* No owner. */
- mutex->depth = 0; /* No locks. */
- return mutex; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a mutex. Note that this includes an implicit mutex_lock to
- * insure that no one else is using the lock. It is legal to deallocate
- * a lock if we have a lock on it, but illegal to deallotcate a lock held
- * by anyone else.
- * Returns the number of locks on the thread. (1 for deallocate).
- */
-int
-objc_mutex_deallocate(objc_mutex_t mutex)
-{
- int depth; /* # of locks on mutex. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- depth = objc_mutex_lock(mutex); /* Must have lock. */
-
- mutex_destroy(&mutex->lock); /* System deallocate. */
-
- objc_free(mutex); /* Free memory. */
- return depth; /* Return last depth. */
-}
-
-/********
- * Grab a lock on a mutex. If this thread already has a lock on this mutex
- * then we increment the lock count. If another thread has a lock on the
- * mutex we block and wait for the thread to release the lock.
- * Returns the lock count on the mutex held by this thread.
- */
-int
-objc_mutex_lock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (mutex_lock(&mutex->lock) != 0) /* Did lock acquire fail? */
- return -1; /* Yes, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Try to grab a lock on a mutex. If this thread already has a lock on
- * this mutex then we increment the lock count and return it. If another
- * thread has a lock on the mutex returns -1.
- */
-int
-objc_mutex_trylock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- if (mutex_trylock(&mutex->lock) != 0) /* Did lock acquire fail? */
- return -1; /* Yes, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return mutex->depth = 1; /* Increment depth to end. */
-}
-
-/********
- * Decrements the lock count on this mutex by one. If the lock count reaches
- * zero, release the lock on the mutex. Returns the lock count on the mutex.
- * It is an error to attempt to unlock a mutex which this thread doesn't hold
- * in which case return -1 and the mutex is unaffected.
- * Will also return -1 if the mutex free fails.
- */
-int
-objc_mutex_unlock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Released last lock? */
- return --mutex->depth; /* No, Decrement depth, end.*/
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = NULL; /* Set owner to "no thread".*/
-
- if (mutex_unlock(&mutex->lock) != 0) /* Did lock release fail? */
- return -1; /* Yes, return error value. */
-
- return 0; /* No, return success. */
-}
-
-/********
- * Allocate a condition. Return the condition pointer if successful or NULL
- * if the allocation failed for any reason.
- */
-objc_condition_t
-objc_condition_allocate(void)
-{
- objc_condition_t condition;
-
- if (!(condition = (objc_condition_t)objc_malloc(
- sizeof(struct objc_condition))))
- return NULL; /* Abort if malloc failed. */
-
- cond_init(&(condition->condition), USYNC_THREAD, NULL);
-
- return condition; /* Return new condition */
-}
-
-/********
- * Deallocate a condition. Note that this includes an implicit
- * condition_broadcast to insure that waiting threads have the opportunity
- * to wake. It is legal to dealloc a condition only if no other
- * thread is/will be using it. Here we do NOT check for other threads
- * waiting but just wake them up.
- */
-int
-objc_condition_deallocate(objc_condition_t condition)
-{
- cond_broadcast(&(condition->condition)); /* Wakeup waiting threads */
- cond_destroy(&(condition->condition)); /* Kill condition */
- objc_free(condition); /* Release struct memory */
- return 0;
-}
-
-/********
- * Wait on the condition unlocking the mutex until objc_condition_signal()
- * or objc_condition_broadcast() are called for the same condition. The
- * given mutex *must* have the depth set to 1 so that it can be unlocked
- * here, so that someone else can lock it and signal/broadcast the condition.
- * The mutex is used to lock access to the shared data that make up the
- * "condition" predicate.
- */
-int
-objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex || !condition) /* Is argument bad? */
- return -1; /* Yes, abort. */
-
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Locked more than once ? */
- return -1; /* YES, return error */
- /* mutex will be unlocked */
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = (objc_thread_t) -1; /* Set owner to "no thread".*/
-
- cond_wait(&(condition->condition),
- &(mutex->lock)); /* unlock, wait ..., lock */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- mutex->depth = 1; /* Must be here ! */
-
- return 0; /* Return success. */
-}
-
-/********
- * Wake up all threads waiting on this condition. It is recommended that
- * the called would lock the same mutex as the threads in objc_condition_wait
- * before changing the "condition predicate" and make this call and unlock it
- * right away after this call.
- */
-int
-objc_condition_broadcast(objc_condition_t condition)
-{
- if (!condition)
- return -1;
- cond_broadcast(&(condition->condition));
- return 0;
-}
-
-/********
- * Wake up one thread waiting on this condition. It is recommended that
- * the called would lock the same mutex as the threads in objc_condition_wait
- * before changing the "condition predicate" and make this call and unlock it
- * right away after this call.
- */
-int
-objc_condition_signal(objc_condition_t condition)
-{
- if (!condition)
- return -1;
- cond_signal(&(condition->condition));
- return 0;
-}
-
-/* End of File */
diff --git a/gcc/objc/thr-win32.c b/gcc/objc/thr-win32.c
deleted file mode 100644
index 520a91d6ced..00000000000
--- a/gcc/objc/thr-win32.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/* GNU Objective C Runtime Thread Interface - Win32 Implementation
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <objc/thr.h>
-#include "runtime.h"
-
-#ifndef __OBJC__
-#define __OBJC__
-#endif
-#include <windows.h>
-
-/********
- * This structure represents a single mutual exclusion lock. Lock semantics
- * are detailed with the subsequent functions. We use whatever lock is
- * provided by the system. We augment it with depth and current owner id
- * fields to implement and re-entrant lock.
- */
-struct objc_mutex
-{
- volatile objc_thread_t owner; /* Id of thread that owns. */
- volatile int depth; /* # of acquires. */
- HANDLE handle; /* Win32 mutex HANDLE. */
-};
-
-/*****************************************************************************
- * Static variables.
- */
-static DWORD __objc_data_tls = (DWORD)-1; /* Win32 Thread Local Index.*/
-
-/********
- * Initialize the threads subsystem. Returns 0 if successful, or -1 if no
- * thread support is available.
- */
-int
-__objc_init_thread_system(void)
-{
- DEBUG_PRINTF("__objc_init_thread_system\n");
-
- if ((__objc_data_tls = TlsAlloc()) != (DWORD)-1)
- return 0; /* Yes, return success. */
-
- return -1; /* Failed. */
-}
-
-int
-__objc_fini_thread_system(void)
-{
- if (__objc_data_tls != (DWORD)-1) {
- TlsFree(__objc_data_tls);
- return 0;
- }
- return -1;
-}
-
-/********
- * Create a new thread of execution and return its id. Return NULL if fails.
- * The new thread starts in "func" with the given argument.
- */
-objc_thread_t
-objc_thread_create(void (*func)(void *arg), void *arg)
-{
- DWORD thread_id = 0; /* Detached thread id. */
- HANDLE win32_handle; /* Win32 thread handle. */
-
- objc_mutex_lock(__objc_runtime_mutex);
-
- if ((win32_handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func,
- arg, 0, &thread_id))) {
- __objc_runtime_threads_alive++;
- }
- else
- thread_id = 0;
-
- objc_mutex_unlock(__objc_runtime_mutex);
-
- return (objc_thread_t)thread_id;
-}
-
-/********
- * Set the current thread's priority.
- */
-int
-objc_thread_set_priority(int priority)
-{
- int sys_priority = 0;
-
- switch (priority) {
- case OBJC_THREAD_INTERACTIVE_PRIORITY:
- sys_priority = THREAD_PRIORITY_NORMAL;
- break;
- default:
- case OBJC_THREAD_BACKGROUND_PRIORITY:
- sys_priority = THREAD_PRIORITY_BELOW_NORMAL;
- break;
- case OBJC_THREAD_LOW_PRIORITY:
- sys_priority = THREAD_PRIORITY_LOWEST;
- break;
- }
- if (SetThreadPriority(GetCurrentThread(), sys_priority))
- return 0; /* Changed priority. End. */
-
- return -1; /* Failed. */
-}
-
-/********
- * Return the current thread's priority.
- */
-int
-objc_thread_get_priority(void)
-{
- int sys_priority;
-
- sys_priority = GetThreadPriority(GetCurrentThread());
-
- switch (sys_priority) {
- case THREAD_PRIORITY_HIGHEST:
- case THREAD_PRIORITY_TIME_CRITICAL:
- case THREAD_PRIORITY_ABOVE_NORMAL:
- case THREAD_PRIORITY_NORMAL:
- return OBJC_THREAD_INTERACTIVE_PRIORITY;
-
- default:
- case THREAD_PRIORITY_BELOW_NORMAL:
- return OBJC_THREAD_BACKGROUND_PRIORITY;
-
- case THREAD_PRIORITY_IDLE:
- case THREAD_PRIORITY_LOWEST:
- return OBJC_THREAD_LOW_PRIORITY;
- }
- return -1; /* Couldn't get priority. */
-}
-
-/********
- * Yield our process time to another thread. Any BUSY waiting that is done
- * by a thread should use this function to make sure that other threads can
- * make progress even on a lazy uniprocessor system.
- */
-void
-objc_thread_yield(void)
-{
- Sleep(0); /* Yield to equal thread. */
-}
-
-/********
- * Terminate the current tread. Doesn't return anything. Doesn't return.
- * Actually, if it failed returns -1.
- */
-int
-objc_thread_exit(void)
-{
- objc_mutex_lock(__objc_runtime_mutex);
- __objc_runtime_threads_alive--;
- objc_mutex_unlock(__objc_runtime_mutex);
-
- ExitThread(__objc_thread_exit_status); /* Terminate thread. */
- return -1;
-}
-
-/********
- * Returns an integer value which uniquely describes a thread. Must not be
- * -1 which is reserved as a marker for "no thread".
- */
-objc_thread_t
-objc_thread_id(void)
-{
- return (objc_thread_t)GetCurrentThreadId(); /* Return thread id. */
-}
-
-/********
- * Sets the thread's local storage pointer. Returns 0 if successful or -1
- * if failed.
- */
-int
-objc_thread_set_data(void *value)
-{
- if (TlsSetValue(__objc_data_tls, value))
- return 0; /* Return thread data. */
- return -1;
-}
-
-/********
- * Returns the thread's local storage pointer. Returns NULL on failure.
- */
-void *
-objc_thread_get_data(void)
-{
- return TlsGetValue(__objc_data_tls); /* Return thread data. */
-}
-
-/********
- * Allocate a mutex. Return the mutex pointer if successful or NULL if
- * the allocation fails for any reason.
- */
-objc_mutex_t
-objc_mutex_allocate(void)
-{
- objc_mutex_t mutex;
- int err = 0;
-
- if (!(mutex = (objc_mutex_t)objc_malloc(sizeof(struct objc_mutex))))
- return NULL; /* Abort if malloc failed. */
-
- if ((mutex->handle = CreateMutex(NULL, 0, NULL)) == NULL) {
- objc_free(mutex); /* Failed, free memory. */
- return NULL; /* Abort. */
- }
- mutex->owner = NULL; /* No owner. */
- mutex->depth = 0; /* No locks. */
- return mutex; /* Return mutex handle. */
-}
-
-/********
- * Deallocate a mutex. Note that this includes an implicit mutex_lock to
- * insure that no one else is using the lock. It is legal to deallocate
- * a lock if we have a lock on it, but illegal to deallotcate a lock held
- * by anyone else.
- * Returns the number of locks on the thread. (1 for deallocate).
- */
-int
-objc_mutex_deallocate(objc_mutex_t mutex)
-{
- int depth; /* # of locks on mutex. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- depth = objc_mutex_lock(mutex); /* Must have lock. */
-
- CloseHandle(mutex->handle); /* Close Win32 handle. */
-
- objc_free(mutex); /* Free memory. */
- return depth; /* Return last depth. */
-}
-
-/********
- * Grab a lock on a mutex. If this thread already has a lock on this mutex
- * then we increment the lock count. If another thread has a lock on the
- * mutex we block and wait for the thread to release the lock.
- * Returns the lock count on the mutex held by this thread.
- */
-int
-objc_mutex_lock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
- int status;
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- status = WaitForSingleObject(mutex->handle, INFINITE);
- if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED)
- return -1; /* Failed, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
-
- return ++mutex->depth; /* Increment depth to end. */
-}
-
-/********
- * Try to grab a lock on a mutex. If this thread already has a lock on
- * this mutex then we increment the lock count and return it. If another
- * thread has a lock on the mutex returns -1.
- */
-int
-objc_mutex_trylock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
- DWORD status; /* Return status from Win32.*/
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner == thread_id) /* Already own lock? */
- return ++mutex->depth; /* Yes, increment depth. */
-
- status = WaitForSingleObject(mutex->handle, 0);
- if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED)
- return -1; /* Failed, abort. */
-
- mutex->owner = thread_id; /* Mark thread as owner. */
- return ++mutex->depth; /* Increment depth to end. */
-}
-
-/********
- * Decrements the lock count on this mutex by one. If the lock count reaches
- * zero, release the lock on the mutex. Returns the lock count on the mutex.
- * It is an error to attempt to unlock a mutex which this thread doesn't hold
- * in which case return -1 and the mutex is unaffected.
- * Will also return -1 if the mutex free fails.
- */
-int
-objc_mutex_unlock(objc_mutex_t mutex)
-{
- objc_thread_t thread_id; /* Cache our thread id. */
-
- if (!mutex) /* Is argument bad? */
- return -1; /* Yes, abort. */
- thread_id = objc_thread_id(); /* Get this thread's id. */
- if (mutex->owner != thread_id) /* Does some else own lock? */
- return -1; /* Yes, abort. */
- if (mutex->depth > 1) /* Released last lock? */
- return --mutex->depth; /* No, Decrement depth, end.*/
- mutex->depth = 0; /* Yes, reset depth to 0. */
- mutex->owner = NULL; /* Set owner to "no thread".*/
-
- if (ReleaseMutex(mutex->handle) == 0)
- return -1; /* Failed, abort. */
-
- return 0; /* No, return success. */
-}
-
-/* End of File */
diff --git a/gcc/objc/thr.c b/gcc/objc/thr.c
deleted file mode 100644
index 2770b7de1ab..00000000000
--- a/gcc/objc/thr.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* GNU Objective C Runtime Thread Interface
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-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. */
-
-/* As a special exception, if you link this library with files compiled with
- GCC to produce an executable, this does not 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. */
-
-#include <stdlib.h>
-#include "runtime.h"
-
-/*************************************************************************
- * Universal static variables:
- */
-int __objc_thread_exit_status = 0; /* Global exit status. */
-
-/* Flag which lets us know if we ever became multi threaded */
-int __objc_is_multi_threaded = 0;
-/* The hook function called when the runtime becomes multi threaded */
-objc_thread_callback _objc_became_multi_threaded = NULL;
-
-/*****************************************************************************
- * Universal Functionality
- */
-
-/*
- Use this to set the hook function that will be called when the
- runtime initially becomes multi threaded.
- The hook function is only called once, meaning only when the
- 2nd thread is spawned, not for each and every thread.
-
- It returns the previous hook function or NULL if there is none.
-
- A program outside of the runtime could set this to some function so
- it can be informed; for example, the GNUstep Base Library sets it
- so it can implement the NSBecomingMultiThreaded notification.
- */
-objc_thread_callback objc_set_thread_callback(objc_thread_callback func)
-{
- objc_thread_callback temp = _objc_became_multi_threaded;
- _objc_became_multi_threaded = func;
- return temp;
-}
-
-/********
- * First function called in a thread, starts everything else.
- */
-struct __objc_thread_start_state
-{
- SEL selector;
- id object;
- id argument;
-};
-
-static volatile void
-__objc_thread_detach_function(struct __objc_thread_start_state *istate)
-{
- if (istate) { /* Is state valid? */
- id (*imp)(id,SEL,id);
- SEL selector = istate->selector;
- id object = istate->object;
- id argument = istate->argument;
-
- objc_free(istate);
-
- /* Clear out the thread local storage */
- objc_thread_set_data(NULL);
-
- /* Check to see if we just became multi threaded */
- if (!__objc_is_multi_threaded) {
- __objc_is_multi_threaded = 1;
-
- /* Call the hook function */
- if (_objc_became_multi_threaded != NULL)
- (*_objc_became_multi_threaded)();
- }
-
- if ((imp = (id(*)(id, SEL, id))objc_msg_lookup(object, selector))) {
- (*imp)(object, selector, argument);
- }
- else
- fprintf(stderr, "__objc_thread_start called with bad selector.\n");
- }
- else {
- fprintf(stderr, "__objc_thread_start called with NULL state.\n");
- }
- objc_thread_exit();
-}
-
-/********
- * Detach a new thread of execution and return its id. Returns NULL if fails.
- * Thread is started by sending message with selector to object. Message
- * takes a single argument.
- */
-objc_thread_t
-objc_thread_detach(SEL selector, id object, id argument)
-{
- struct __objc_thread_start_state *istate; /* Initialial thread state. */
- objc_thread_t thread_id = NULL; /* Detached thread id. */
-
- if (!(istate = (struct __objc_thread_start_state *)
- objc_malloc(sizeof(*istate)))) /* Can we allocate state? */
- return NULL; /* No, abort. */
-
- istate->selector = selector; /* Initialize the thread's */
- istate->object = object; /* state structure. */
- istate->argument = argument;
-
- if ((thread_id = objc_thread_create((void *)__objc_thread_detach_function,
- istate)) == NULL) {
- objc_free(istate); /* Release state if failed. */
- return thread_id;
- }
-
- return thread_id;
-}
-
-#undef objc_mutex_lock()
-#undef objc_mutex_unlock()
-
-int
-objc_mutex_unlock_x(objc_mutex_t mutex, const char *f, int l)
-{
- printf("%16.16s#%4d < unlock", f, l);
- return objc_mutex_unlock(mutex);
-}
-
-int
-objc_mutex_lock_x(objc_mutex_t mutex, const char *f, int l)
-{
- printf("%16.16s#%4d < lock", f, l);
- return objc_mutex_lock(mutex);
-}
-
-/* End of File */
diff --git a/gcc/objc/thr.h b/gcc/objc/thr.h
deleted file mode 100644
index 80331fe692a..00000000000
--- a/gcc/objc/thr.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Thread and mutex controls for Objective C.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
-
-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.
-
-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. */
-
-/* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not 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 __thread_INCLUDE_GNU
-#define __thread_INCLUDE_GNU
-
-#include "objc/objc.h"
-
-/*************************************************************************
- * Universal static variables:
- */
-extern int __objc_thread_exit_status; /* Global exit status. */
-
-/********
- * Thread safe implementation types and functions.
- */
-
-#define OBJC_THREAD_INTERACTIVE_PRIORITY 2
-#define OBJC_THREAD_BACKGROUND_PRIORITY 1
-#define OBJC_THREAD_LOW_PRIORITY 0
-
-typedef void * objc_thread_t;
-typedef struct objc_mutex *objc_mutex_t;
-typedef struct objc_condition *objc_condition_t;
-
-objc_mutex_t objc_mutex_allocate(void);
-int objc_mutex_deallocate(objc_mutex_t mutex);
-int objc_mutex_lock(objc_mutex_t mutex);
-int objc_mutex_unlock(objc_mutex_t mutex);
-int objc_mutex_trylock(objc_mutex_t mutex);
-
-objc_condition_t objc_condition_allocate(void);
-int objc_condition_deallocate(objc_condition_t condition);
-int objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex);
-int objc_condition_signal(objc_condition_t condition);
-int objc_condition_broadcast(objc_condition_t condition);
-
-objc_thread_t objc_thread_create(void (*func)(void *arg), void *arg);
-void objc_thread_yield(void);
-int objc_thread_exit(void);
-int objc_thread_set_priority(int priority);
-int objc_thread_get_priority(void);
-void * objc_thread_get_data(void);
-int objc_thread_set_data(void *value);
-objc_thread_t objc_thread_id(void);
-
-objc_thread_t objc_thread_detach(SEL selector, id object, id argument);
-int objc_mutex_lock_x(objc_mutex_t mutex, const char *f, int l);
-int objc_mutex_unlock_x(objc_mutex_t mutex, const char *f, int l);
-
-/*
- Use this to set the hook function that will be called when the
- runtime initially becomes multi threaded.
- The hook function is only called once, meaning only when the
- 2nd thread is spawned, not for each and every thread.
-
- It returns the previous hook function or NULL if there is none.
-
- A program outside of the runtime could set this to some function so
- it can be informed; for example, the GNUstep Base Library sets it
- so it can implement the NSBecomingMultiThreaded notification.
- */
-typedef void (*objc_thread_callback)();
-objc_thread_callback objc_set_thread_callback(objc_thread_callback func);
-
-/* For debugging of locks, uncomment these two macros: */
-/* #define objc_mutex_lock(x) objc_mutex_lock_x(x, __FILE__, __LINE__) */
-/* #define objc_mutex_unlock(x) objc_mutex_unlock_x(x, __FILE__, __LINE__)*/
-
-#endif /* not __thread_INCLUDE_GNU */
diff --git a/gcc/objc/typedstream.h b/gcc/objc/typedstream.h
deleted file mode 100644
index 50bd6542932..00000000000
--- a/gcc/objc/typedstream.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* GNU Objective-C Typed Streams interface.
- Copyright (C) 1993, 1995 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
-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. */
-
-/* As a special exception, if you link this library with files compiled
- with GCC to produce an executable, this does not 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 __typedstream_INCLUDE_GNU
-#define __typedstream_INCLUDE_GNU
-
-#include "objc/objc.h"
-#include "objc/hash.h"
-#include <stdio.h>
-
-typedef int (*objc_typed_read_func)(void*, char*, int);
-typedef int (*objc_typed_write_func)(void*, const char*, int);
-typedef int (*objc_typed_flush_func)(void*);
-typedef int (*objc_typed_eof_func)(void*);
-
-#define OBJC_READONLY 0x01
-#define OBJC_WRITEONLY 0x02
-
-#define OBJC_MANAGED_STREAM 0x01
-#define OBJC_FILE_STREAM 0x02
-#define OBJC_MEMORY_STREAM 0x04
-
-#define OBJC_TYPED_STREAM_VERSION 0x01
-
-typedef struct objc_typed_stream {
- void* physical;
- cache_ptr object_table; /* read/written objects */
- cache_ptr stream_table; /* other read/written but shared things.. */
- cache_ptr class_table; /* class version mapping */
- cache_ptr object_refs; /* forward references */
- int mode; /* OBJC_READONLY or OBJC_WRITEONLY */
- int type; /* MANAGED, FILE, MEMORY etc bit string */
- int version; /* version used when writing */
- int writing_root_p;
- objc_typed_read_func read;
- objc_typed_write_func write;
- objc_typed_eof_func eof;
- objc_typed_flush_func flush;
-} TypedStream;
-
-/* opcode masks */
-#define _B_VALUE 0x1fU
-#define _B_CODE 0xe0U
-#define _B_SIGN 0x10U
-#define _B_NUMBER 0x0fU
-
-/* standard opcodes */
-#define _B_INVALID 0x00U
-#define _B_SINT 0x20U
-#define _B_NINT 0x40U
-#define _B_SSTR 0x60U
-#define _B_NSTR 0x80U
-#define _B_RCOMM 0xa0U
-#define _B_UCOMM 0xc0U
-#define _B_EXT 0xe0U
-
-/* eXtension opcodes */
-#define _BX_OBJECT 0x00U
-#define _BX_CLASS 0x01U
-#define _BX_SEL 0x02U
-#define _BX_OBJREF 0x03U
-#define _BX_OBJROOT 0x04U
-#define _BX_EXT 0x1fU
-
-/*
-** Read and write objects as specified by TYPE. All the `last'
-** arguments are pointers to the objects to read/write.
-*/
-
-int objc_write_type (TypedStream* stream, const char* type, const void* data);
-int objc_read_type (TypedStream* stream, const char* type, void* data);
-
-int objc_write_types (TypedStream* stream, const char* type, ...);
-int objc_read_types (TypedStream* stream, const char* type, ...);
-
-int objc_write_object_reference (TypedStream* stream, id object);
-int objc_write_root_object (TypedStream* stream, id object);
-
-long objc_get_stream_class_version (TypedStream* stream, Class class);
-
-
-/*
-** Convenience functions
-*/
-
-int objc_write_array (TypedStream* stream, const char* type,
- int count, const void* data);
-int objc_read_array (TypedStream* stream, const char* type,
- int count, void* data);
-
-int objc_write_object (TypedStream* stream, id object);
-int objc_read_object (TypedStream* stream, id* object);
-
-
-
-/*
-** Open a typed stream for reading or writing. MODE may be either of
-** OBJC_READONLY or OBJC_WRITEONLY.
-*/
-
-TypedStream* objc_open_typed_stream (FILE* physical, int mode);
-TypedStream* objc_open_typed_stream_for_file (const char* file_name, int mode);
-
-void objc_close_typed_stream (TypedStream* stream);
-
-BOOL objc_end_of_typed_stream (TypedStream* stream);
-void objc_flush_typed_stream (TypedStream* stream);
-
-#endif /* not __typedstream_INCLUDE_GNU */
diff --git a/gcc/optabs.c b/gcc/optabs.c
deleted file mode 100644
index 22a9d2a720f..00000000000
--- a/gcc/optabs.c
+++ /dev/null
@@ -1,4376 +0,0 @@
-/* Expand the basic unary and binary arithmetic operations, for GNU compiler.
- Copyright (C) 1987, 88, 92, 93, 94, 95, 1996 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. */
-
-
-#include "config.h"
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "insn-flags.h"
-#include "insn-codes.h"
-#include "expr.h"
-#include "insn-config.h"
-#include "recog.h"
-#include "reload.h"
-#include <ctype.h>
-
-/* Each optab contains info on how this target machine
- can perform a particular operation
- for all sizes and kinds of operands.
-
- The operation to be performed is often specified
- by passing one of these optabs as an argument.
-
- See expr.h for documentation of these optabs. */
-
-optab add_optab;
-optab sub_optab;
-optab smul_optab;
-optab smul_highpart_optab;
-optab umul_highpart_optab;
-optab smul_widen_optab;
-optab umul_widen_optab;
-optab sdiv_optab;
-optab sdivmod_optab;
-optab udiv_optab;
-optab udivmod_optab;
-optab smod_optab;
-optab umod_optab;
-optab flodiv_optab;
-optab ftrunc_optab;
-optab and_optab;
-optab ior_optab;
-optab xor_optab;
-optab ashl_optab;
-optab lshr_optab;
-optab ashr_optab;
-optab rotl_optab;
-optab rotr_optab;
-optab smin_optab;
-optab smax_optab;
-optab umin_optab;
-optab umax_optab;
-
-optab mov_optab;
-optab movstrict_optab;
-
-optab neg_optab;
-optab abs_optab;
-optab one_cmpl_optab;
-optab ffs_optab;
-optab sqrt_optab;
-optab sin_optab;
-optab cos_optab;
-
-optab cmp_optab;
-optab ucmp_optab; /* Used only for libcalls for unsigned comparisons. */
-optab tst_optab;
-
-optab strlen_optab;
-
-/* Tables of patterns for extending one integer mode to another. */
-enum insn_code extendtab[MAX_MACHINE_MODE][MAX_MACHINE_MODE][2];
-
-/* Tables of patterns for converting between fixed and floating point. */
-enum insn_code fixtab[NUM_MACHINE_MODES][NUM_MACHINE_MODES][2];
-enum insn_code fixtrunctab[NUM_MACHINE_MODES][NUM_MACHINE_MODES][2];
-enum insn_code floattab[NUM_MACHINE_MODES][NUM_MACHINE_MODES][2];
-
-/* Contains the optab used for each rtx code. */
-optab code_to_optab[NUM_RTX_CODE + 1];
-
-/* SYMBOL_REF rtx's for the library functions that are called
- implicitly and not via optabs. */
-
-rtx extendsfdf2_libfunc;
-rtx extendsfxf2_libfunc;
-rtx extendsftf2_libfunc;
-rtx extenddfxf2_libfunc;
-rtx extenddftf2_libfunc;
-
-rtx truncdfsf2_libfunc;
-rtx truncxfsf2_libfunc;
-rtx trunctfsf2_libfunc;
-rtx truncxfdf2_libfunc;
-rtx trunctfdf2_libfunc;
-
-rtx memcpy_libfunc;
-rtx bcopy_libfunc;
-rtx memcmp_libfunc;
-rtx bcmp_libfunc;
-rtx memset_libfunc;
-rtx bzero_libfunc;
-
-rtx throw_libfunc;
-
-rtx eqhf2_libfunc;
-rtx nehf2_libfunc;
-rtx gthf2_libfunc;
-rtx gehf2_libfunc;
-rtx lthf2_libfunc;
-rtx lehf2_libfunc;
-
-rtx eqsf2_libfunc;
-rtx nesf2_libfunc;
-rtx gtsf2_libfunc;
-rtx gesf2_libfunc;
-rtx ltsf2_libfunc;
-rtx lesf2_libfunc;
-
-rtx eqdf2_libfunc;
-rtx nedf2_libfunc;
-rtx gtdf2_libfunc;
-rtx gedf2_libfunc;
-rtx ltdf2_libfunc;
-rtx ledf2_libfunc;
-
-rtx eqxf2_libfunc;
-rtx nexf2_libfunc;
-rtx gtxf2_libfunc;
-rtx gexf2_libfunc;
-rtx ltxf2_libfunc;
-rtx lexf2_libfunc;
-
-rtx eqtf2_libfunc;
-rtx netf2_libfunc;
-rtx gttf2_libfunc;
-rtx getf2_libfunc;
-rtx lttf2_libfunc;
-rtx letf2_libfunc;
-
-rtx floatsisf_libfunc;
-rtx floatdisf_libfunc;
-rtx floattisf_libfunc;
-
-rtx floatsidf_libfunc;
-rtx floatdidf_libfunc;
-rtx floattidf_libfunc;
-
-rtx floatsixf_libfunc;
-rtx floatdixf_libfunc;
-rtx floattixf_libfunc;
-
-rtx floatsitf_libfunc;
-rtx floatditf_libfunc;
-rtx floattitf_libfunc;
-
-rtx fixsfsi_libfunc;
-rtx fixsfdi_libfunc;
-rtx fixsfti_libfunc;
-
-rtx fixdfsi_libfunc;
-rtx fixdfdi_libfunc;
-rtx fixdfti_libfunc;
-
-rtx fixxfsi_libfunc;
-rtx fixxfdi_libfunc;
-rtx fixxfti_libfunc;
-
-rtx fixtfsi_libfunc;
-rtx fixtfdi_libfunc;
-rtx fixtfti_libfunc;
-
-rtx fixunssfsi_libfunc;
-rtx fixunssfdi_libfunc;
-rtx fixunssfti_libfunc;
-
-rtx fixunsdfsi_libfunc;
-rtx fixunsdfdi_libfunc;
-rtx fixunsdfti_libfunc;
-
-rtx fixunsxfsi_libfunc;
-rtx fixunsxfdi_libfunc;
-rtx fixunsxfti_libfunc;
-
-rtx fixunstfsi_libfunc;
-rtx fixunstfdi_libfunc;
-rtx fixunstfti_libfunc;
-
-/* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
- gives the gen_function to make a branch to test that condition. */
-
-rtxfun bcc_gen_fctn[NUM_RTX_CODE];
-
-/* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
- gives the insn code to make a store-condition insn
- to test that condition. */
-
-enum insn_code setcc_gen_code[NUM_RTX_CODE];
-
-#ifdef HAVE_conditional_move
-/* Indexed by the machine mode, gives the insn code to make a conditional
- move insn. This is not indexed by the rtx-code like bcc_gen_fctn and
- setcc_gen_code to cut down on the number of named patterns. Consider a day
- when a lot more rtx codes are conditional (eg: for the ARM). */
-
-enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
-#endif
-
-static int add_equal_note PROTO((rtx, rtx, enum rtx_code, rtx, rtx));
-static rtx widen_operand PROTO((rtx, enum machine_mode,
- enum machine_mode, int, int));
-static enum insn_code can_fix_p PROTO((enum machine_mode, enum machine_mode,
- int, int *));
-static enum insn_code can_float_p PROTO((enum machine_mode, enum machine_mode,
- int));
-static rtx ftruncify PROTO((rtx));
-static optab init_optab PROTO((enum rtx_code));
-static void init_libfuncs PROTO((optab, int, int, char *, int));
-static void init_integral_libfuncs PROTO((optab, char *, int));
-static void init_floating_libfuncs PROTO((optab, char *, int));
-static void init_complex_libfuncs PROTO((optab, char *, int));
-
-/* Add a REG_EQUAL note to the last insn in SEQ. TARGET is being set to
- the result of operation CODE applied to OP0 (and OP1 if it is a binary
- operation).
-
- If the last insn does not set TARGET, don't do anything, but return 1.
-
- If a previous insn sets TARGET and TARGET is one of OP0 or OP1,
- don't add the REG_EQUAL note but return 0. Our caller can then try
- again, ensuring that TARGET is not one of the operands. */
-
-static int
-add_equal_note (seq, target, code, op0, op1)
- rtx seq;
- rtx target;
- enum rtx_code code;
- rtx op0, op1;
-{
- rtx set;
- int i;
- rtx note;
-
- if ((GET_RTX_CLASS (code) != '1' && GET_RTX_CLASS (code) != '2'
- && GET_RTX_CLASS (code) != 'c' && GET_RTX_CLASS (code) != '<')
- || GET_CODE (seq) != SEQUENCE
- || (set = single_set (XVECEXP (seq, 0, XVECLEN (seq, 0) - 1))) == 0
- || GET_CODE (target) == ZERO_EXTRACT
- || (! rtx_equal_p (SET_DEST (set), target)
- /* For a STRICT_LOW_PART, the REG_NOTE applies to what is inside the
- SUBREG. */
- && (GET_CODE (SET_DEST (set)) != STRICT_LOW_PART
- || ! rtx_equal_p (SUBREG_REG (XEXP (SET_DEST (set), 0)),
- target))))
- return 1;
-
- /* If TARGET is in OP0 or OP1, check if anything in SEQ sets TARGET
- besides the last insn. */
- if (reg_overlap_mentioned_p (target, op0)
- || (op1 && reg_overlap_mentioned_p (target, op1)))
- for (i = XVECLEN (seq, 0) - 2; i >= 0; i--)
- if (reg_set_p (target, XVECEXP (seq, 0, i)))
- return 0;
-
- if (GET_RTX_CLASS (code) == '1')
- note = gen_rtx (code, GET_MODE (target), copy_rtx (op0));
- else
- note = gen_rtx (code, GET_MODE (target), copy_rtx (op0), copy_rtx (op1));
-
- REG_NOTES (XVECEXP (seq, 0, XVECLEN (seq, 0) - 1))
- = gen_rtx (EXPR_LIST, REG_EQUAL, note,
- REG_NOTES (XVECEXP (seq, 0, XVECLEN (seq, 0) - 1)));
-
- return 1;
-}
-
-/* Widen OP to MODE and return the rtx for the widened operand. UNSIGNEDP
- says whether OP is signed or unsigned. NO_EXTEND is nonzero if we need
- not actually do a sign-extend or zero-extend, but can leave the
- higher-order bits of the result rtx undefined, for example, in the case
- of logical operations, but not right shifts. */
-
-static rtx
-widen_operand (op, mode, oldmode, unsignedp, no_extend)
- rtx op;
- enum machine_mode mode, oldmode;
- int unsignedp;
- int no_extend;
-{
- rtx result;
-
- /* If we must extend do so. If OP is either a constant or a SUBREG
- for a promoted object, also extend since it will be more efficient to
- do so. */
- if (! no_extend
- || GET_MODE (op) == VOIDmode
- || (GET_CODE (op) == SUBREG && SUBREG_PROMOTED_VAR_P (op)))
- return convert_modes (mode, oldmode, op, unsignedp);
-
- /* If MODE is no wider than a single word, we return a paradoxical
- SUBREG. */
- if (GET_MODE_SIZE (mode) <= UNITS_PER_WORD)
- return gen_rtx (SUBREG, mode, force_reg (GET_MODE (op), op), 0);
-
- /* Otherwise, get an object of MODE, clobber it, and set the low-order
- part to OP. */
-
- result = gen_reg_rtx (mode);
- emit_insn (gen_rtx (CLOBBER, VOIDmode, result));
- emit_move_insn (gen_lowpart (GET_MODE (op), result), op);
- return result;
-}
-
-/* Generate code to perform an operation specified by BINOPTAB
- on operands OP0 and OP1, with result having machine-mode MODE.
-
- UNSIGNEDP is for the case where we have to widen the operands
- to perform the operation. It says to use zero-extension.
-
- If TARGET is nonzero, the value
- is generated there, if it is convenient to do so.
- In all cases an rtx is returned for the locus of the value;
- this may or may not be TARGET. */
-
-rtx
-expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
- enum machine_mode mode;
- optab binoptab;
- rtx op0, op1;
- rtx target;
- int unsignedp;
- enum optab_methods methods;
-{
- enum optab_methods next_methods
- = (methods == OPTAB_LIB || methods == OPTAB_LIB_WIDEN
- ? OPTAB_WIDEN : methods);
- enum mode_class class;
- enum machine_mode wider_mode;
- register rtx temp;
- int commutative_op = 0;
- int shift_op = (binoptab->code == ASHIFT
- || binoptab->code == ASHIFTRT
- || binoptab->code == LSHIFTRT
- || binoptab->code == ROTATE
- || binoptab->code == ROTATERT);
- rtx entry_last = get_last_insn ();
- rtx last;
-
- class = GET_MODE_CLASS (mode);
-
- op0 = protect_from_queue (op0, 0);
- op1 = protect_from_queue (op1, 0);
- if (target)
- target = protect_from_queue (target, 1);
-
- if (flag_force_mem)
- {
- op0 = force_not_mem (op0);
- op1 = force_not_mem (op1);
- }
-
- /* If subtracting an integer constant, convert this into an addition of
- the negated constant. */
-
- if (binoptab == sub_optab && GET_CODE (op1) == CONST_INT)
- {
- op1 = negate_rtx (mode, op1);
- binoptab = add_optab;
- }
-
- /* If we are inside an appropriately-short loop and one operand is an
- expensive constant, force it into a register. */
- if (CONSTANT_P (op0) && preserve_subexpressions_p ()
- && rtx_cost (op0, binoptab->code) > 2)
- op0 = force_reg (mode, op0);
-
- if (CONSTANT_P (op1) && preserve_subexpressions_p ()
- && ! shift_op && rtx_cost (op1, binoptab->code) > 2)
- op1 = force_reg (mode, op1);
-
- /* Record where to delete back to if we backtrack. */
- last = get_last_insn ();
-
- /* If operation is commutative,
- try to make the first operand a register.
- Even better, try to make it the same as the target.
- Also try to make the last operand a constant. */
- if (GET_RTX_CLASS (binoptab->code) == 'c'
- || binoptab == smul_widen_optab
- || binoptab == umul_widen_optab
- || binoptab == smul_highpart_optab
- || binoptab == umul_highpart_optab)
- {
- commutative_op = 1;
-
- if (((target == 0 || GET_CODE (target) == REG)
- ? ((GET_CODE (op1) == REG
- && GET_CODE (op0) != REG)
- || target == op1)
- : rtx_equal_p (op1, target))
- || GET_CODE (op0) == CONST_INT)
- {
- temp = op1;
- op1 = op0;
- op0 = temp;
- }
- }
-
- /* If we can do it with a three-operand insn, do so. */
-
- if (methods != OPTAB_MUST_WIDEN
- && binoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- int icode = (int) binoptab->handlers[(int) mode].insn_code;
- enum machine_mode mode0 = insn_operand_mode[icode][1];
- enum machine_mode mode1 = insn_operand_mode[icode][2];
- rtx pat;
- rtx xop0 = op0, xop1 = op1;
-
- if (target)
- temp = target;
- else
- temp = gen_reg_rtx (mode);
-
- /* If it is a commutative operator and the modes would match
- if we would swap the operands, we can save the conversions. */
- if (commutative_op)
- {
- if (GET_MODE (op0) != mode0 && GET_MODE (op1) != mode1
- && GET_MODE (op0) == mode1 && GET_MODE (op1) == mode0)
- {
- register rtx tmp;
-
- tmp = op0; op0 = op1; op1 = tmp;
- tmp = xop0; xop0 = xop1; xop1 = tmp;
- }
- }
-
- /* In case the insn wants input operands in modes different from
- the result, convert the operands. */
-
- if (GET_MODE (op0) != VOIDmode
- && GET_MODE (op0) != mode0
- && mode0 != VOIDmode)
- xop0 = convert_to_mode (mode0, xop0, unsignedp);
-
- if (GET_MODE (xop1) != VOIDmode
- && GET_MODE (xop1) != mode1
- && mode1 != VOIDmode)
- xop1 = convert_to_mode (mode1, xop1, unsignedp);
-
- /* Now, if insn's predicates don't allow our operands, put them into
- pseudo regs. */
-
- if (! (*insn_operand_predicate[icode][1]) (xop0, mode0)
- && mode0 != VOIDmode)
- xop0 = copy_to_mode_reg (mode0, xop0);
-
- if (! (*insn_operand_predicate[icode][2]) (xop1, mode1)
- && mode1 != VOIDmode)
- xop1 = copy_to_mode_reg (mode1, xop1);
-
- if (! (*insn_operand_predicate[icode][0]) (temp, mode))
- temp = gen_reg_rtx (mode);
-
- pat = GEN_FCN (icode) (temp, xop0, xop1);
- if (pat)
- {
- /* If PAT is a multi-insn sequence, try to add an appropriate
- REG_EQUAL note to it. If we can't because TEMP conflicts with an
- operand, call ourselves again, this time without a target. */
- if (GET_CODE (pat) == SEQUENCE
- && ! add_equal_note (pat, temp, binoptab->code, xop0, xop1))
- {
- delete_insns_since (last);
- return expand_binop (mode, binoptab, op0, op1, NULL_RTX,
- unsignedp, methods);
- }
-
- emit_insn (pat);
- return temp;
- }
- else
- delete_insns_since (last);
- }
-
- /* If this is a multiply, see if we can do a widening operation that
- takes operands of this mode and makes a wider mode. */
-
- if (binoptab == smul_optab && GET_MODE_WIDER_MODE (mode) != VOIDmode
- && (((unsignedp ? umul_widen_optab : smul_widen_optab)
- ->handlers[(int) GET_MODE_WIDER_MODE (mode)].insn_code)
- != CODE_FOR_nothing))
- {
- temp = expand_binop (GET_MODE_WIDER_MODE (mode),
- unsignedp ? umul_widen_optab : smul_widen_optab,
- op0, op1, NULL_RTX, unsignedp, OPTAB_DIRECT);
-
- if (temp != 0)
- {
- if (GET_MODE_CLASS (mode) == MODE_INT)
- return gen_lowpart (mode, temp);
- else
- return convert_to_mode (mode, temp, unsignedp);
- }
- }
-
- /* Look for a wider mode of the same class for which we think we
- can open-code the operation. Check for a widening multiply at the
- wider mode as well. */
-
- if ((class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
- && methods != OPTAB_DIRECT && methods != OPTAB_LIB)
- for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- if (binoptab->handlers[(int) wider_mode].insn_code != CODE_FOR_nothing
- || (binoptab == smul_optab
- && GET_MODE_WIDER_MODE (wider_mode) != VOIDmode
- && (((unsignedp ? umul_widen_optab : smul_widen_optab)
- ->handlers[(int) GET_MODE_WIDER_MODE (wider_mode)].insn_code)
- != CODE_FOR_nothing)))
- {
- rtx xop0 = op0, xop1 = op1;
- int no_extend = 0;
-
- /* For certain integer operations, we need not actually extend
- the narrow operands, as long as we will truncate
- the results to the same narrowness. */
-
- if ((binoptab == ior_optab || binoptab == and_optab
- || binoptab == xor_optab
- || binoptab == add_optab || binoptab == sub_optab
- || binoptab == smul_optab || binoptab == ashl_optab)
- && class == MODE_INT)
- no_extend = 1;
-
- xop0 = widen_operand (xop0, wider_mode, mode, unsignedp, no_extend);
-
- /* The second operand of a shift must always be extended. */
- xop1 = widen_operand (xop1, wider_mode, mode, unsignedp,
- no_extend && binoptab != ashl_optab);
-
- temp = expand_binop (wider_mode, binoptab, xop0, xop1, NULL_RTX,
- unsignedp, OPTAB_DIRECT);
- if (temp)
- {
- if (class != MODE_INT)
- {
- if (target == 0)
- target = gen_reg_rtx (mode);
- convert_move (target, temp, 0);
- return target;
- }
- else
- return gen_lowpart (mode, temp);
- }
- else
- delete_insns_since (last);
- }
- }
-
- /* These can be done a word at a time. */
- if ((binoptab == and_optab || binoptab == ior_optab || binoptab == xor_optab)
- && class == MODE_INT
- && GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && binoptab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing)
- {
- int i;
- rtx insns;
- rtx equiv_value;
-
- /* If TARGET is the same as one of the operands, the REG_EQUAL note
- won't be accurate, so use a new target. */
- if (target == 0 || target == op0 || target == op1)
- target = gen_reg_rtx (mode);
-
- start_sequence ();
-
- /* Do the actual arithmetic. */
- for (i = 0; i < GET_MODE_BITSIZE (mode) / BITS_PER_WORD; i++)
- {
- rtx target_piece = operand_subword (target, i, 1, mode);
- rtx x = expand_binop (word_mode, binoptab,
- operand_subword_force (op0, i, mode),
- operand_subword_force (op1, i, mode),
- target_piece, unsignedp, next_methods);
-
- if (x == 0)
- break;
-
- if (target_piece != x)
- emit_move_insn (target_piece, x);
- }
-
- insns = get_insns ();
- end_sequence ();
-
- if (i == GET_MODE_BITSIZE (mode) / BITS_PER_WORD)
- {
- if (binoptab->code != UNKNOWN)
- equiv_value
- = gen_rtx (binoptab->code, mode, copy_rtx (op0), copy_rtx (op1));
- else
- equiv_value = 0;
-
- emit_no_conflict_block (insns, target, op0, op1, equiv_value);
- return target;
- }
- }
-
- /* Synthesize double word shifts from single word shifts. */
- if ((binoptab == lshr_optab || binoptab == ashl_optab
- || binoptab == ashr_optab)
- && class == MODE_INT
- && GET_CODE (op1) == CONST_INT
- && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && binoptab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing
- && ashl_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing
- && lshr_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing)
- {
- rtx insns, inter, equiv_value;
- rtx into_target, outof_target;
- rtx into_input, outof_input;
- int shift_count, left_shift, outof_word;
-
- /* If TARGET is the same as one of the operands, the REG_EQUAL note
- won't be accurate, so use a new target. */
- if (target == 0 || target == op0 || target == op1)
- target = gen_reg_rtx (mode);
-
- start_sequence ();
-
- shift_count = INTVAL (op1);
-
- /* OUTOF_* is the word we are shifting bits away from, and
- INTO_* is the word that we are shifting bits towards, thus
- they differ depending on the direction of the shift and
- WORDS_BIG_ENDIAN. */
-
- left_shift = binoptab == ashl_optab;
- outof_word = left_shift ^ ! WORDS_BIG_ENDIAN;
-
- outof_target = operand_subword (target, outof_word, 1, mode);
- into_target = operand_subword (target, 1 - outof_word, 1, mode);
-
- outof_input = operand_subword_force (op0, outof_word, mode);
- into_input = operand_subword_force (op0, 1 - outof_word, mode);
-
- if (shift_count >= BITS_PER_WORD)
- {
- inter = expand_binop (word_mode, binoptab,
- outof_input,
- GEN_INT (shift_count - BITS_PER_WORD),
- into_target, unsignedp, next_methods);
-
- if (inter != 0 && inter != into_target)
- emit_move_insn (into_target, inter);
-
- /* For a signed right shift, we must fill the word we are shifting
- out of with copies of the sign bit. Otherwise it is zeroed. */
- if (inter != 0 && binoptab != ashr_optab)
- inter = CONST0_RTX (word_mode);
- else if (inter != 0)
- inter = expand_binop (word_mode, binoptab,
- outof_input,
- GEN_INT (BITS_PER_WORD - 1),
- outof_target, unsignedp, next_methods);
-
- if (inter != 0 && inter != outof_target)
- emit_move_insn (outof_target, inter);
- }
- else
- {
- rtx carries;
- optab reverse_unsigned_shift, unsigned_shift;
-
- /* For a shift of less then BITS_PER_WORD, to compute the carry,
- we must do a logical shift in the opposite direction of the
- desired shift. */
-
- reverse_unsigned_shift = (left_shift ? lshr_optab : ashl_optab);
-
- /* For a shift of less than BITS_PER_WORD, to compute the word
- shifted towards, we need to unsigned shift the orig value of
- that word. */
-
- unsigned_shift = (left_shift ? ashl_optab : lshr_optab);
-
- carries = expand_binop (word_mode, reverse_unsigned_shift,
- outof_input,
- GEN_INT (BITS_PER_WORD - shift_count),
- 0, unsignedp, next_methods);
-
- if (carries == 0)
- inter = 0;
- else
- inter = expand_binop (word_mode, unsigned_shift, into_input,
- op1, 0, unsignedp, next_methods);
-
- if (inter != 0)
- inter = expand_binop (word_mode, ior_optab, carries, inter,
- into_target, unsignedp, next_methods);
-
- if (inter != 0 && inter != into_target)
- emit_move_insn (into_target, inter);
-
- if (inter != 0)
- inter = expand_binop (word_mode, binoptab, outof_input,
- op1, outof_target, unsignedp, next_methods);
-
- if (inter != 0 && inter != outof_target)
- emit_move_insn (outof_target, inter);
- }
-
- insns = get_insns ();
- end_sequence ();
-
- if (inter != 0)
- {
- if (binoptab->code != UNKNOWN)
- equiv_value = gen_rtx (binoptab->code, mode, op0, op1);
- else
- equiv_value = 0;
-
- emit_no_conflict_block (insns, target, op0, op1, equiv_value);
- return target;
- }
- }
-
- /* Synthesize double word rotates from single word shifts. */
- if ((binoptab == rotl_optab || binoptab == rotr_optab)
- && class == MODE_INT
- && GET_CODE (op1) == CONST_INT
- && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && ashl_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing
- && lshr_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing)
- {
- rtx insns, equiv_value;
- rtx into_target, outof_target;
- rtx into_input, outof_input;
- rtx inter;
- int shift_count, left_shift, outof_word;
-
- /* If TARGET is the same as one of the operands, the REG_EQUAL note
- won't be accurate, so use a new target. */
- if (target == 0 || target == op0 || target == op1)
- target = gen_reg_rtx (mode);
-
- start_sequence ();
-
- shift_count = INTVAL (op1);
-
- /* OUTOF_* is the word we are shifting bits away from, and
- INTO_* is the word that we are shifting bits towards, thus
- they differ depending on the direction of the shift and
- WORDS_BIG_ENDIAN. */
-
- left_shift = (binoptab == rotl_optab);
- outof_word = left_shift ^ ! WORDS_BIG_ENDIAN;
-
- outof_target = operand_subword (target, outof_word, 1, mode);
- into_target = operand_subword (target, 1 - outof_word, 1, mode);
-
- outof_input = operand_subword_force (op0, outof_word, mode);
- into_input = operand_subword_force (op0, 1 - outof_word, mode);
-
- if (shift_count == BITS_PER_WORD)
- {
- /* This is just a word swap. */
- emit_move_insn (outof_target, into_input);
- emit_move_insn (into_target, outof_input);
- inter = const0_rtx;
- }
- else
- {
- rtx into_temp1, into_temp2, outof_temp1, outof_temp2;
- rtx first_shift_count, second_shift_count;
- optab reverse_unsigned_shift, unsigned_shift;
-
- reverse_unsigned_shift = (left_shift ^ (shift_count < BITS_PER_WORD)
- ? lshr_optab : ashl_optab);
-
- unsigned_shift = (left_shift ^ (shift_count < BITS_PER_WORD)
- ? ashl_optab : lshr_optab);
-
- if (shift_count > BITS_PER_WORD)
- {
- first_shift_count = GEN_INT (shift_count - BITS_PER_WORD);
- second_shift_count = GEN_INT (2*BITS_PER_WORD - shift_count);
- }
- else
- {
- first_shift_count = GEN_INT (BITS_PER_WORD - shift_count);
- second_shift_count = GEN_INT (shift_count);
- }
-
- into_temp1 = expand_binop (word_mode, unsigned_shift,
- outof_input, first_shift_count,
- NULL_RTX, unsignedp, next_methods);
- into_temp2 = expand_binop (word_mode, reverse_unsigned_shift,
- into_input, second_shift_count,
- into_target, unsignedp, next_methods);
-
- if (into_temp1 != 0 && into_temp2 != 0)
- inter = expand_binop (word_mode, ior_optab, into_temp1, into_temp2,
- into_target, unsignedp, next_methods);
- else
- inter = 0;
-
- if (inter != 0 && inter != into_target)
- emit_move_insn (into_target, inter);
-
- outof_temp1 = expand_binop (word_mode, unsigned_shift,
- into_input, first_shift_count,
- NULL_RTX, unsignedp, next_methods);
- outof_temp2 = expand_binop (word_mode, reverse_unsigned_shift,
- outof_input, second_shift_count,
- outof_target, unsignedp, next_methods);
-
- if (inter != 0 && outof_temp1 != 0 && outof_temp2 != 0)
- inter = expand_binop (word_mode, ior_optab,
- outof_temp1, outof_temp2,
- outof_target, unsignedp, next_methods);
-
- if (inter != 0 && inter != outof_target)
- emit_move_insn (outof_target, inter);
- }
-
- insns = get_insns ();
- end_sequence ();
-
- if (inter != 0)
- {
- if (binoptab->code != UNKNOWN)
- equiv_value = gen_rtx (binoptab->code, mode, op0, op1);
- else
- equiv_value = 0;
-
- /* We can't make this a no conflict block if this is a word swap,
- because the word swap case fails if the input and output values
- are in the same register. */
- if (shift_count != BITS_PER_WORD)
- emit_no_conflict_block (insns, target, op0, op1, equiv_value);
- else
- emit_insns (insns);
-
-
- return target;
- }
- }
-
- /* These can be done a word at a time by propagating carries. */
- if ((binoptab == add_optab || binoptab == sub_optab)
- && class == MODE_INT
- && GET_MODE_SIZE (mode) >= 2 * UNITS_PER_WORD
- && binoptab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing)
- {
- int i;
- rtx carry_tmp = gen_reg_rtx (word_mode);
- optab otheroptab = binoptab == add_optab ? sub_optab : add_optab;
- int nwords = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
- rtx carry_in, carry_out;
- rtx xop0, xop1;
-
- /* We can handle either a 1 or -1 value for the carry. If STORE_FLAG
- value is one of those, use it. Otherwise, use 1 since it is the
- one easiest to get. */
-#if STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1
- int normalizep = STORE_FLAG_VALUE;
-#else
- int normalizep = 1;
-#endif
-
- /* Prepare the operands. */
- xop0 = force_reg (mode, op0);
- xop1 = force_reg (mode, op1);
-
- if (target == 0 || GET_CODE (target) != REG
- || target == xop0 || target == xop1)
- target = gen_reg_rtx (mode);
-
- /* Indicate for flow that the entire target reg is being set. */
- if (GET_CODE (target) == REG)
- emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
-
- /* Do the actual arithmetic. */
- for (i = 0; i < nwords; i++)
- {
- int index = (WORDS_BIG_ENDIAN ? nwords - i - 1 : i);
- rtx target_piece = operand_subword (target, index, 1, mode);
- rtx op0_piece = operand_subword_force (xop0, index, mode);
- rtx op1_piece = operand_subword_force (xop1, index, mode);
- rtx x;
-
- /* Main add/subtract of the input operands. */
- x = expand_binop (word_mode, binoptab,
- op0_piece, op1_piece,
- target_piece, unsignedp, next_methods);
- if (x == 0)
- break;
-
- if (i + 1 < nwords)
- {
- /* Store carry from main add/subtract. */
- carry_out = gen_reg_rtx (word_mode);
- carry_out = emit_store_flag_force (carry_out,
- (binoptab == add_optab
- ? LTU : GTU),
- x, op0_piece,
- word_mode, 1, normalizep);
- }
-
- if (i > 0)
- {
- /* Add/subtract previous carry to main result. */
- x = expand_binop (word_mode,
- normalizep == 1 ? binoptab : otheroptab,
- x, carry_in,
- target_piece, 1, next_methods);
- if (x == 0)
- break;
- else if (target_piece != x)
- emit_move_insn (target_piece, x);
-
- if (i + 1 < nwords)
- {
- /* THIS CODE HAS NOT BEEN TESTED. */
- /* Get out carry from adding/subtracting carry in. */
- carry_tmp = emit_store_flag_force (carry_tmp,
- binoptab == add_optab
- ? LTU : GTU,
- x, carry_in,
- word_mode, 1, normalizep);
-
- /* Logical-ior the two poss. carry together. */
- carry_out = expand_binop (word_mode, ior_optab,
- carry_out, carry_tmp,
- carry_out, 0, next_methods);
- if (carry_out == 0)
- break;
- }
- }
-
- carry_in = carry_out;
- }
-
- if (i == GET_MODE_BITSIZE (mode) / BITS_PER_WORD)
- {
- if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- rtx temp = emit_move_insn (target, target);
-
- REG_NOTES (temp) = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (binoptab->code, mode,
- copy_rtx (xop0),
- copy_rtx (xop1)),
- REG_NOTES (temp));
- }
- return target;
- }
- else
- delete_insns_since (last);
- }
-
- /* If we want to multiply two two-word values and have normal and widening
- multiplies of single-word values, we can do this with three smaller
- multiplications. Note that we do not make a REG_NO_CONFLICT block here
- because we are not operating on one word at a time.
-
- The multiplication proceeds as follows:
- _______________________
- [__op0_high_|__op0_low__]
- _______________________
- * [__op1_high_|__op1_low__]
- _______________________________________________
- _______________________
- (1) [__op0_low__*__op1_low__]
- _______________________
- (2a) [__op0_low__*__op1_high_]
- _______________________
- (2b) [__op0_high_*__op1_low__]
- _______________________
- (3) [__op0_high_*__op1_high_]
-
-
- This gives a 4-word result. Since we are only interested in the
- lower 2 words, partial result (3) and the upper words of (2a) and
- (2b) don't need to be calculated. Hence (2a) and (2b) can be
- calculated using non-widening multiplication.
-
- (1), however, needs to be calculated with an unsigned widening
- multiplication. If this operation is not directly supported we
- try using a signed widening multiplication and adjust the result.
- This adjustment works as follows:
-
- If both operands are positive then no adjustment is needed.
-
- If the operands have different signs, for example op0_low < 0 and
- op1_low >= 0, the instruction treats the most significant bit of
- op0_low as a sign bit instead of a bit with significance
- 2**(BITS_PER_WORD-1), i.e. the instruction multiplies op1_low
- with 2**BITS_PER_WORD - op0_low, and two's complements the
- result. Conclusion: We need to add op1_low * 2**BITS_PER_WORD to
- the result.
-
- Similarly, if both operands are negative, we need to add
- (op0_low + op1_low) * 2**BITS_PER_WORD.
-
- We use a trick to adjust quickly. We logically shift op0_low right
- (op1_low) BITS_PER_WORD-1 steps to get 0 or 1, and add this to
- op0_high (op1_high) before it is used to calculate 2b (2a). If no
- logical shift exists, we do an arithmetic right shift and subtract
- the 0 or -1. */
-
- if (binoptab == smul_optab
- && class == MODE_INT
- && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
- && smul_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing
- && add_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing
- && ((umul_widen_optab->handlers[(int) mode].insn_code
- != CODE_FOR_nothing)
- || (smul_widen_optab->handlers[(int) mode].insn_code
- != CODE_FOR_nothing)))
- {
- int low = (WORDS_BIG_ENDIAN ? 1 : 0);
- int high = (WORDS_BIG_ENDIAN ? 0 : 1);
- rtx op0_high = operand_subword_force (op0, high, mode);
- rtx op0_low = operand_subword_force (op0, low, mode);
- rtx op1_high = operand_subword_force (op1, high, mode);
- rtx op1_low = operand_subword_force (op1, low, mode);
- rtx product = 0;
- rtx op0_xhigh;
- rtx op1_xhigh;
-
- /* If the target is the same as one of the inputs, don't use it. This
- prevents problems with the REG_EQUAL note. */
- if (target == op0 || target == op1
- || (target != 0 && GET_CODE (target) != REG))
- target = 0;
-
- /* Multiply the two lower words to get a double-word product.
- If unsigned widening multiplication is available, use that;
- otherwise use the signed form and compensate. */
-
- if (umul_widen_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- product = expand_binop (mode, umul_widen_optab, op0_low, op1_low,
- target, 1, OPTAB_DIRECT);
-
- /* If we didn't succeed, delete everything we did so far. */
- if (product == 0)
- delete_insns_since (last);
- else
- op0_xhigh = op0_high, op1_xhigh = op1_high;
- }
-
- if (product == 0
- && smul_widen_optab->handlers[(int) mode].insn_code
- != CODE_FOR_nothing)
- {
- rtx wordm1 = GEN_INT (BITS_PER_WORD - 1);
- product = expand_binop (mode, smul_widen_optab, op0_low, op1_low,
- target, 1, OPTAB_DIRECT);
- op0_xhigh = expand_binop (word_mode, lshr_optab, op0_low, wordm1,
- NULL_RTX, 1, next_methods);
- if (op0_xhigh)
- op0_xhigh = expand_binop (word_mode, add_optab, op0_high,
- op0_xhigh, op0_xhigh, 0, next_methods);
- else
- {
- op0_xhigh = expand_binop (word_mode, ashr_optab, op0_low, wordm1,
- NULL_RTX, 0, next_methods);
- if (op0_xhigh)
- op0_xhigh = expand_binop (word_mode, sub_optab, op0_high,
- op0_xhigh, op0_xhigh, 0,
- next_methods);
- }
-
- op1_xhigh = expand_binop (word_mode, lshr_optab, op1_low, wordm1,
- NULL_RTX, 1, next_methods);
- if (op1_xhigh)
- op1_xhigh = expand_binop (word_mode, add_optab, op1_high,
- op1_xhigh, op1_xhigh, 0, next_methods);
- else
- {
- op1_xhigh = expand_binop (word_mode, ashr_optab, op1_low, wordm1,
- NULL_RTX, 0, next_methods);
- if (op1_xhigh)
- op1_xhigh = expand_binop (word_mode, sub_optab, op1_high,
- op1_xhigh, op1_xhigh, 0,
- next_methods);
- }
- }
-
- /* If we have been able to directly compute the product of the
- low-order words of the operands and perform any required adjustments
- of the operands, we proceed by trying two more multiplications
- and then computing the appropriate sum.
-
- We have checked above that the required addition is provided.
- Full-word addition will normally always succeed, especially if
- it is provided at all, so we don't worry about its failure. The
- multiplication may well fail, however, so we do handle that. */
-
- if (product && op0_xhigh && op1_xhigh)
- {
- rtx product_high = operand_subword (product, high, 1, mode);
- rtx temp = expand_binop (word_mode, binoptab, op0_low, op1_xhigh,
- NULL_RTX, 0, OPTAB_DIRECT);
-
- if (temp != 0)
- temp = expand_binop (word_mode, add_optab, temp, product_high,
- product_high, 0, next_methods);
-
- if (temp != 0 && temp != product_high)
- emit_move_insn (product_high, temp);
-
- if (temp != 0)
- temp = expand_binop (word_mode, binoptab, op1_low, op0_xhigh,
- NULL_RTX, 0, OPTAB_DIRECT);
-
- if (temp != 0)
- temp = expand_binop (word_mode, add_optab, temp,
- product_high, product_high,
- 0, next_methods);
-
- if (temp != 0 && temp != product_high)
- emit_move_insn (product_high, temp);
-
- if (temp != 0)
- {
- if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- temp = emit_move_insn (product, product);
- REG_NOTES (temp) = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (MULT, mode,
- copy_rtx (op0),
- copy_rtx (op1)),
- REG_NOTES (temp));
- }
- return product;
- }
- }
-
- /* If we get here, we couldn't do it for some reason even though we
- originally thought we could. Delete anything we've emitted in
- trying to do it. */
-
- delete_insns_since (last);
- }
-
- /* We need to open-code the complex type operations: '+, -, * and /' */
-
- /* At this point we allow operations between two similar complex
- numbers, and also if one of the operands is not a complex number
- but rather of MODE_FLOAT or MODE_INT. However, the caller
- must make sure that the MODE of the non-complex operand matches
- the SUBMODE of the complex operand. */
-
- if (class == MODE_COMPLEX_FLOAT || class == MODE_COMPLEX_INT)
- {
- rtx real0 = 0, imag0 = 0;
- rtx real1 = 0, imag1 = 0;
- rtx realr, imagr, res;
- rtx seq;
- rtx equiv_value;
- int ok = 0;
-
- /* Find the correct mode for the real and imaginary parts */
- enum machine_mode submode
- = mode_for_size (GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT,
- class == MODE_COMPLEX_INT ? MODE_INT : MODE_FLOAT,
- 0);
-
- if (submode == BLKmode)
- abort ();
-
- if (! target)
- target = gen_reg_rtx (mode);
-
- start_sequence ();
-
- realr = gen_realpart (submode, target);
- imagr = gen_imagpart (submode, target);
-
- if (GET_MODE (op0) == mode)
- {
- real0 = gen_realpart (submode, op0);
- imag0 = gen_imagpart (submode, op0);
- }
- else
- real0 = op0;
-
- if (GET_MODE (op1) == mode)
- {
- real1 = gen_realpart (submode, op1);
- imag1 = gen_imagpart (submode, op1);
- }
- else
- real1 = op1;
-
- if (real0 == 0 || real1 == 0 || ! (imag0 != 0|| imag1 != 0))
- abort ();
-
- switch (binoptab->code)
- {
- case PLUS:
- /* (a+ib) + (c+id) = (a+c) + i(b+d) */
- case MINUS:
- /* (a+ib) - (c+id) = (a-c) + i(b-d) */
- res = expand_binop (submode, binoptab, real0, real1,
- realr, unsignedp, methods);
-
- if (res == 0)
- break;
- else if (res != realr)
- emit_move_insn (realr, res);
-
- if (imag0 && imag1)
- res = expand_binop (submode, binoptab, imag0, imag1,
- imagr, unsignedp, methods);
- else if (imag0)
- res = imag0;
- else if (binoptab->code == MINUS)
- res = expand_unop (submode, neg_optab, imag1, imagr, unsignedp);
- else
- res = imag1;
-
- if (res == 0)
- break;
- else if (res != imagr)
- emit_move_insn (imagr, res);
-
- ok = 1;
- break;
-
- case MULT:
- /* (a+ib) * (c+id) = (ac-bd) + i(ad+cb) */
-
- if (imag0 && imag1)
- {
- rtx temp1, temp2;
-
- /* Don't fetch these from memory more than once. */
- real0 = force_reg (submode, real0);
- real1 = force_reg (submode, real1);
- imag0 = force_reg (submode, imag0);
- imag1 = force_reg (submode, imag1);
-
- temp1 = expand_binop (submode, binoptab, real0, real1, NULL_RTX,
- unsignedp, methods);
-
- temp2 = expand_binop (submode, binoptab, imag0, imag1, NULL_RTX,
- unsignedp, methods);
-
- if (temp1 == 0 || temp2 == 0)
- break;
-
- res = expand_binop (submode, sub_optab, temp1, temp2,
- realr, unsignedp, methods);
-
- if (res == 0)
- break;
- else if (res != realr)
- emit_move_insn (realr, res);
-
- temp1 = expand_binop (submode, binoptab, real0, imag1,
- NULL_RTX, unsignedp, methods);
-
- temp2 = expand_binop (submode, binoptab, real1, imag0,
- NULL_RTX, unsignedp, methods);
-
- if (temp1 == 0 || temp2 == 0)
- break;
-
- res = expand_binop (submode, add_optab, temp1, temp2,
- imagr, unsignedp, methods);
-
- if (res == 0)
- break;
- else if (res != imagr)
- emit_move_insn (imagr, res);
-
- ok = 1;
- }
- else
- {
- /* Don't fetch these from memory more than once. */
- real0 = force_reg (submode, real0);
- real1 = force_reg (submode, real1);
-
- res = expand_binop (submode, binoptab, real0, real1,
- realr, unsignedp, methods);
- if (res == 0)
- break;
- else if (res != realr)
- emit_move_insn (realr, res);
-
- if (imag0 != 0)
- res = expand_binop (submode, binoptab,
- real1, imag0, imagr, unsignedp, methods);
- else
- res = expand_binop (submode, binoptab,
- real0, imag1, imagr, unsignedp, methods);
-
- if (res == 0)
- break;
- else if (res != imagr)
- emit_move_insn (imagr, res);
-
- ok = 1;
- }
- break;
-
- case DIV:
- /* (a+ib) / (c+id) = ((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd)) */
-
- if (imag1 == 0)
- {
- /* (a+ib) / (c+i0) = (a/c) + i(b/c) */
-
- /* Don't fetch these from memory more than once. */
- real1 = force_reg (submode, real1);
-
- /* Simply divide the real and imaginary parts by `c' */
- if (class == MODE_COMPLEX_FLOAT)
- res = expand_binop (submode, binoptab, real0, real1,
- realr, unsignedp, methods);
- else
- res = expand_divmod (0, TRUNC_DIV_EXPR, submode,
- real0, real1, realr, unsignedp);
-
- if (res == 0)
- break;
- else if (res != realr)
- emit_move_insn (realr, res);
-
- if (class == MODE_COMPLEX_FLOAT)
- res = expand_binop (submode, binoptab, imag0, real1,
- imagr, unsignedp, methods);
- else
- res = expand_divmod (0, TRUNC_DIV_EXPR, submode,
- imag0, real1, imagr, unsignedp);
-
- if (res == 0)
- break;
- else if (res != imagr)
- emit_move_insn (imagr, res);
-
- ok = 1;
- }
- else
- {
- /* Divisor is of complex type:
- X/(a+ib) */
- rtx divisor;
- rtx real_t, imag_t;
- rtx lhs, rhs;
- rtx temp1, temp2;
-
- /* Don't fetch these from memory more than once. */
- real0 = force_reg (submode, real0);
- real1 = force_reg (submode, real1);
-
- if (imag0 != 0)
- imag0 = force_reg (submode, imag0);
-
- imag1 = force_reg (submode, imag1);
-
- /* Divisor: c*c + d*d */
- temp1 = expand_binop (submode, smul_optab, real1, real1,
- NULL_RTX, unsignedp, methods);
-
- temp2 = expand_binop (submode, smul_optab, imag1, imag1,
- NULL_RTX, unsignedp, methods);
-
- if (temp1 == 0 || temp2 == 0)
- break;
-
- divisor = expand_binop (submode, add_optab, temp1, temp2,
- NULL_RTX, unsignedp, methods);
- if (divisor == 0)
- break;
-
- if (imag0 == 0)
- {
- /* ((a)(c-id))/divisor */
- /* (a+i0) / (c+id) = (ac/(cc+dd)) + i(-ad/(cc+dd)) */
-
- /* Calculate the dividend */
- real_t = expand_binop (submode, smul_optab, real0, real1,
- NULL_RTX, unsignedp, methods);
-
- imag_t = expand_binop (submode, smul_optab, real0, imag1,
- NULL_RTX, unsignedp, methods);
-
- if (real_t == 0 || imag_t == 0)
- break;
-
- imag_t = expand_unop (submode, neg_optab, imag_t,
- NULL_RTX, unsignedp);
- }
- else
- {
- /* ((a+ib)(c-id))/divider */
- /* Calculate the dividend */
- temp1 = expand_binop (submode, smul_optab, real0, real1,
- NULL_RTX, unsignedp, methods);
-
- temp2 = expand_binop (submode, smul_optab, imag0, imag1,
- NULL_RTX, unsignedp, methods);
-
- if (temp1 == 0 || temp2 == 0)
- break;
-
- real_t = expand_binop (submode, add_optab, temp1, temp2,
- NULL_RTX, unsignedp, methods);
-
- temp1 = expand_binop (submode, smul_optab, imag0, real1,
- NULL_RTX, unsignedp, methods);
-
- temp2 = expand_binop (submode, smul_optab, real0, imag1,
- NULL_RTX, unsignedp, methods);
-
- if (temp1 == 0 || temp2 == 0)
- break;
-
- imag_t = expand_binop (submode, sub_optab, temp1, temp2,
- NULL_RTX, unsignedp, methods);
-
- if (real_t == 0 || imag_t == 0)
- break;
- }
-
- if (class == MODE_COMPLEX_FLOAT)
- res = expand_binop (submode, binoptab, real_t, divisor,
- realr, unsignedp, methods);
- else
- res = expand_divmod (0, TRUNC_DIV_EXPR, submode,
- real_t, divisor, realr, unsignedp);
-
- if (res == 0)
- break;
- else if (res != realr)
- emit_move_insn (realr, res);
-
- if (class == MODE_COMPLEX_FLOAT)
- res = expand_binop (submode, binoptab, imag_t, divisor,
- imagr, unsignedp, methods);
- else
- res = expand_divmod (0, TRUNC_DIV_EXPR, submode,
- imag_t, divisor, imagr, unsignedp);
-
- if (res == 0)
- break;
- else if (res != imagr)
- emit_move_insn (imagr, res);
-
- ok = 1;
- }
- break;
-
- default:
- abort ();
- }
-
- seq = get_insns ();
- end_sequence ();
-
- if (ok)
- {
- if (binoptab->code != UNKNOWN)
- equiv_value
- = gen_rtx (binoptab->code, mode, copy_rtx (op0), copy_rtx (op1));
- else
- equiv_value = 0;
-
- emit_no_conflict_block (seq, target, op0, op1, equiv_value);
-
- return target;
- }
- }
-
- /* It can't be open-coded in this mode.
- Use a library call if one is available and caller says that's ok. */
-
- if (binoptab->handlers[(int) mode].libfunc
- && (methods == OPTAB_LIB || methods == OPTAB_LIB_WIDEN))
- {
- rtx insns;
- rtx funexp = binoptab->handlers[(int) mode].libfunc;
- rtx op1x = op1;
- enum machine_mode op1_mode = mode;
- rtx value;
-
- start_sequence ();
-
- if (shift_op)
- {
- op1_mode = word_mode;
- /* Specify unsigned here,
- since negative shift counts are meaningless. */
- op1x = convert_to_mode (word_mode, op1, 1);
- }
-
- if (GET_MODE (op0) != VOIDmode
- && GET_MODE (op0) != mode)
- op0 = convert_to_mode (mode, op0, unsignedp);
-
- /* Pass 1 for NO_QUEUE so we don't lose any increments
- if the libcall is cse'd or moved. */
- value = emit_library_call_value (binoptab->handlers[(int) mode].libfunc,
- NULL_RTX, 1, mode, 2,
- op0, mode, op1x, op1_mode);
-
- insns = get_insns ();
- end_sequence ();
-
- target = gen_reg_rtx (mode);
- emit_libcall_block (insns, target, value,
- gen_rtx (binoptab->code, mode, op0, op1));
-
- return target;
- }
-
- delete_insns_since (last);
-
- /* It can't be done in this mode. Can we do it in a wider mode? */
-
- if (! (methods == OPTAB_WIDEN || methods == OPTAB_LIB_WIDEN
- || methods == OPTAB_MUST_WIDEN))
- {
- /* Caller says, don't even try. */
- delete_insns_since (entry_last);
- return 0;
- }
-
- /* Compute the value of METHODS to pass to recursive calls.
- Don't allow widening to be tried recursively. */
-
- methods = (methods == OPTAB_LIB_WIDEN ? OPTAB_LIB : OPTAB_DIRECT);
-
- /* Look for a wider mode of the same class for which it appears we can do
- the operation. */
-
- if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
- {
- for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- if ((binoptab->handlers[(int) wider_mode].insn_code
- != CODE_FOR_nothing)
- || (methods == OPTAB_LIB
- && binoptab->handlers[(int) wider_mode].libfunc))
- {
- rtx xop0 = op0, xop1 = op1;
- int no_extend = 0;
-
- /* For certain integer operations, we need not actually extend
- the narrow operands, as long as we will truncate
- the results to the same narrowness. */
-
- if ((binoptab == ior_optab || binoptab == and_optab
- || binoptab == xor_optab
- || binoptab == add_optab || binoptab == sub_optab
- || binoptab == smul_optab || binoptab == ashl_optab)
- && class == MODE_INT)
- no_extend = 1;
-
- xop0 = widen_operand (xop0, wider_mode, mode,
- unsignedp, no_extend);
-
- /* The second operand of a shift must always be extended. */
- xop1 = widen_operand (xop1, wider_mode, mode, unsignedp,
- no_extend && binoptab != ashl_optab);
-
- temp = expand_binop (wider_mode, binoptab, xop0, xop1, NULL_RTX,
- unsignedp, methods);
- if (temp)
- {
- if (class != MODE_INT)
- {
- if (target == 0)
- target = gen_reg_rtx (mode);
- convert_move (target, temp, 0);
- return target;
- }
- else
- return gen_lowpart (mode, temp);
- }
- else
- delete_insns_since (last);
- }
- }
- }
-
- delete_insns_since (entry_last);
- return 0;
-}
-
-/* Expand a binary operator which has both signed and unsigned forms.
- UOPTAB is the optab for unsigned operations, and SOPTAB is for
- signed operations.
-
- If we widen unsigned operands, we may use a signed wider operation instead
- of an unsigned wider operation, since the result would be the same. */
-
-rtx
-sign_expand_binop (mode, uoptab, soptab, op0, op1, target, unsignedp, methods)
- enum machine_mode mode;
- optab uoptab, soptab;
- rtx op0, op1, target;
- int unsignedp;
- enum optab_methods methods;
-{
- register rtx temp;
- optab direct_optab = unsignedp ? uoptab : soptab;
- struct optab wide_soptab;
-
- /* Do it without widening, if possible. */
- temp = expand_binop (mode, direct_optab, op0, op1, target,
- unsignedp, OPTAB_DIRECT);
- if (temp || methods == OPTAB_DIRECT)
- return temp;
-
- /* Try widening to a signed int. Make a fake signed optab that
- hides any signed insn for direct use. */
- wide_soptab = *soptab;
- wide_soptab.handlers[(int) mode].insn_code = CODE_FOR_nothing;
- wide_soptab.handlers[(int) mode].libfunc = 0;
-
- temp = expand_binop (mode, &wide_soptab, op0, op1, target,
- unsignedp, OPTAB_WIDEN);
-
- /* For unsigned operands, try widening to an unsigned int. */
- if (temp == 0 && unsignedp)
- temp = expand_binop (mode, uoptab, op0, op1, target,
- unsignedp, OPTAB_WIDEN);
- if (temp || methods == OPTAB_WIDEN)
- return temp;
-
- /* Use the right width lib call if that exists. */
- temp = expand_binop (mode, direct_optab, op0, op1, target, unsignedp, OPTAB_LIB);
- if (temp || methods == OPTAB_LIB)
- return temp;
-
- /* Must widen and use a lib call, use either signed or unsigned. */
- temp = expand_binop (mode, &wide_soptab, op0, op1, target,
- unsignedp, methods);
- if (temp != 0)
- return temp;
- if (unsignedp)
- return expand_binop (mode, uoptab, op0, op1, target,
- unsignedp, methods);
- return 0;
-}
-
-/* Generate code to perform an operation specified by BINOPTAB
- on operands OP0 and OP1, with two results to TARG1 and TARG2.
- We assume that the order of the operands for the instruction
- is TARG0, OP0, OP1, TARG1, which would fit a pattern like
- [(set TARG0 (operate OP0 OP1)) (set TARG1 (operate ...))].
-
- Either TARG0 or TARG1 may be zero, but what that means is that
- that result is not actually wanted. We will generate it into
- a dummy pseudo-reg and discard it. They may not both be zero.
-
- Returns 1 if this operation can be performed; 0 if not. */
-
-int
-expand_twoval_binop (binoptab, op0, op1, targ0, targ1, unsignedp)
- optab binoptab;
- rtx op0, op1;
- rtx targ0, targ1;
- int unsignedp;
-{
- enum machine_mode mode = GET_MODE (targ0 ? targ0 : targ1);
- enum mode_class class;
- enum machine_mode wider_mode;
- rtx entry_last = get_last_insn ();
- rtx last;
-
- class = GET_MODE_CLASS (mode);
-
- op0 = protect_from_queue (op0, 0);
- op1 = protect_from_queue (op1, 0);
-
- if (flag_force_mem)
- {
- op0 = force_not_mem (op0);
- op1 = force_not_mem (op1);
- }
-
- /* If we are inside an appropriately-short loop and one operand is an
- expensive constant, force it into a register. */
- if (CONSTANT_P (op0) && preserve_subexpressions_p ()
- && rtx_cost (op0, binoptab->code) > 2)
- op0 = force_reg (mode, op0);
-
- if (CONSTANT_P (op1) && preserve_subexpressions_p ()
- && rtx_cost (op1, binoptab->code) > 2)
- op1 = force_reg (mode, op1);
-
- if (targ0)
- targ0 = protect_from_queue (targ0, 1);
- else
- targ0 = gen_reg_rtx (mode);
- if (targ1)
- targ1 = protect_from_queue (targ1, 1);
- else
- targ1 = gen_reg_rtx (mode);
-
- /* Record where to go back to if we fail. */
- last = get_last_insn ();
-
- if (binoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- int icode = (int) binoptab->handlers[(int) mode].insn_code;
- enum machine_mode mode0 = insn_operand_mode[icode][1];
- enum machine_mode mode1 = insn_operand_mode[icode][2];
- rtx pat;
- rtx xop0 = op0, xop1 = op1;
-
- /* In case this insn wants input operands in modes different from the
- result, convert the operands. */
- if (GET_MODE (op0) != VOIDmode && GET_MODE (op0) != mode0)
- xop0 = convert_to_mode (mode0, xop0, unsignedp);
-
- if (GET_MODE (op1) != VOIDmode && GET_MODE (op1) != mode1)
- xop1 = convert_to_mode (mode1, xop1, unsignedp);
-
- /* Now, if insn doesn't accept these operands, put them into pseudos. */
- if (! (*insn_operand_predicate[icode][1]) (xop0, mode0))
- xop0 = copy_to_mode_reg (mode0, xop0);
-
- if (! (*insn_operand_predicate[icode][2]) (xop1, mode1))
- xop1 = copy_to_mode_reg (mode1, xop1);
-
- /* We could handle this, but we should always be called with a pseudo
- for our targets and all insns should take them as outputs. */
- if (! (*insn_operand_predicate[icode][0]) (targ0, mode)
- || ! (*insn_operand_predicate[icode][3]) (targ1, mode))
- abort ();
-
- pat = GEN_FCN (icode) (targ0, xop0, xop1, targ1);
- if (pat)
- {
- emit_insn (pat);
- return 1;
- }
- else
- delete_insns_since (last);
- }
-
- /* It can't be done in this mode. Can we do it in a wider mode? */
-
- if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
- {
- for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- if (binoptab->handlers[(int) wider_mode].insn_code
- != CODE_FOR_nothing)
- {
- register rtx t0 = gen_reg_rtx (wider_mode);
- register rtx t1 = gen_reg_rtx (wider_mode);
-
- if (expand_twoval_binop (binoptab,
- convert_modes (wider_mode, mode, op0,
- unsignedp),
- convert_modes (wider_mode, mode, op1,
- unsignedp),
- t0, t1, unsignedp))
- {
- convert_move (targ0, t0, unsignedp);
- convert_move (targ1, t1, unsignedp);
- return 1;
- }
- else
- delete_insns_since (last);
- }
- }
- }
-
- delete_insns_since (entry_last);
- return 0;
-}
-
-/* Generate code to perform an operation specified by UNOPTAB
- on operand OP0, with result having machine-mode MODE.
-
- UNSIGNEDP is for the case where we have to widen the operands
- to perform the operation. It says to use zero-extension.
-
- If TARGET is nonzero, the value
- is generated there, if it is convenient to do so.
- In all cases an rtx is returned for the locus of the value;
- this may or may not be TARGET. */
-
-rtx
-expand_unop (mode, unoptab, op0, target, unsignedp)
- enum machine_mode mode;
- optab unoptab;
- rtx op0;
- rtx target;
- int unsignedp;
-{
- enum mode_class class;
- enum machine_mode wider_mode;
- register rtx temp;
- rtx last = get_last_insn ();
- rtx pat;
-
- class = GET_MODE_CLASS (mode);
-
- op0 = protect_from_queue (op0, 0);
-
- if (flag_force_mem)
- {
- op0 = force_not_mem (op0);
- }
-
- if (target)
- target = protect_from_queue (target, 1);
-
- if (unoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- int icode = (int) unoptab->handlers[(int) mode].insn_code;
- enum machine_mode mode0 = insn_operand_mode[icode][1];
- rtx xop0 = op0;
-
- if (target)
- temp = target;
- else
- temp = gen_reg_rtx (mode);
-
- if (GET_MODE (xop0) != VOIDmode
- && GET_MODE (xop0) != mode0)
- xop0 = convert_to_mode (mode0, xop0, unsignedp);
-
- /* Now, if insn doesn't accept our operand, put it into a pseudo. */
-
- if (! (*insn_operand_predicate[icode][1]) (xop0, mode0))
- xop0 = copy_to_mode_reg (mode0, xop0);
-
- if (! (*insn_operand_predicate[icode][0]) (temp, mode))
- temp = gen_reg_rtx (mode);
-
- pat = GEN_FCN (icode) (temp, xop0);
- if (pat)
- {
- if (GET_CODE (pat) == SEQUENCE
- && ! add_equal_note (pat, temp, unoptab->code, xop0, NULL_RTX))
- {
- delete_insns_since (last);
- return expand_unop (mode, unoptab, op0, NULL_RTX, unsignedp);
- }
-
- emit_insn (pat);
-
- return temp;
- }
- else
- delete_insns_since (last);
- }
-
- /* It can't be done in this mode. Can we open-code it in a wider mode? */
-
- if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
- for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- if (unoptab->handlers[(int) wider_mode].insn_code != CODE_FOR_nothing)
- {
- rtx xop0 = op0;
-
- /* For certain operations, we need not actually extend
- the narrow operand, as long as we will truncate the
- results to the same narrowness. */
-
- xop0 = widen_operand (xop0, wider_mode, mode, unsignedp,
- (unoptab == neg_optab
- || unoptab == one_cmpl_optab)
- && class == MODE_INT);
-
- temp = expand_unop (wider_mode, unoptab, xop0, NULL_RTX,
- unsignedp);
-
- if (temp)
- {
- if (class != MODE_INT)
- {
- if (target == 0)
- target = gen_reg_rtx (mode);
- convert_move (target, temp, 0);
- return target;
- }
- else
- return gen_lowpart (mode, temp);
- }
- else
- delete_insns_since (last);
- }
- }
-
- /* These can be done a word at a time. */
- if (unoptab == one_cmpl_optab
- && class == MODE_INT
- && GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && unoptab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing)
- {
- int i;
- rtx insns;
-
- if (target == 0 || target == op0)
- target = gen_reg_rtx (mode);
-
- start_sequence ();
-
- /* Do the actual arithmetic. */
- for (i = 0; i < GET_MODE_BITSIZE (mode) / BITS_PER_WORD; i++)
- {
- rtx target_piece = operand_subword (target, i, 1, mode);
- rtx x = expand_unop (word_mode, unoptab,
- operand_subword_force (op0, i, mode),
- target_piece, unsignedp);
- if (target_piece != x)
- emit_move_insn (target_piece, x);
- }
-
- insns = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (insns, target, op0, NULL_RTX,
- gen_rtx (unoptab->code, mode, copy_rtx (op0)));
- return target;
- }
-
- /* Open-code the complex negation operation. */
- else if (unoptab == neg_optab
- && (class == MODE_COMPLEX_FLOAT || class == MODE_COMPLEX_INT))
- {
- rtx target_piece;
- rtx x;
- rtx seq;
-
- /* Find the correct mode for the real and imaginary parts */
- enum machine_mode submode
- = mode_for_size (GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT,
- class == MODE_COMPLEX_INT ? MODE_INT : MODE_FLOAT,
- 0);
-
- if (submode == BLKmode)
- abort ();
-
- if (target == 0)
- target = gen_reg_rtx (mode);
-
- start_sequence ();
-
- target_piece = gen_imagpart (submode, target);
- x = expand_unop (submode, unoptab,
- gen_imagpart (submode, op0),
- target_piece, unsignedp);
- if (target_piece != x)
- emit_move_insn (target_piece, x);
-
- target_piece = gen_realpart (submode, target);
- x = expand_unop (submode, unoptab,
- gen_realpart (submode, op0),
- target_piece, unsignedp);
- if (target_piece != x)
- emit_move_insn (target_piece, x);
-
- seq = get_insns ();
- end_sequence ();
-
- emit_no_conflict_block (seq, target, op0, 0,
- gen_rtx (unoptab->code, mode, copy_rtx (op0)));
- return target;
- }
-
- /* Now try a library call in this mode. */
- if (unoptab->handlers[(int) mode].libfunc)
- {
- rtx insns;
- rtx funexp = unoptab->handlers[(int) mode].libfunc;
- rtx value;
-
- start_sequence ();
-
- /* Pass 1 for NO_QUEUE so we don't lose any increments
- if the libcall is cse'd or moved. */
- value = emit_library_call_value (unoptab->handlers[(int) mode].libfunc,
- NULL_RTX, 1, mode, 1, op0, mode);
- insns = get_insns ();
- end_sequence ();
-
- target = gen_reg_rtx (mode);
- emit_libcall_block (insns, target, value,
- gen_rtx (unoptab->code, mode, op0));
-
- return target;
- }
-
- /* It can't be done in this mode. Can we do it in a wider mode? */
-
- if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
- {
- for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- if ((unoptab->handlers[(int) wider_mode].insn_code
- != CODE_FOR_nothing)
- || unoptab->handlers[(int) wider_mode].libfunc)
- {
- rtx xop0 = op0;
-
- /* For certain operations, we need not actually extend
- the narrow operand, as long as we will truncate the
- results to the same narrowness. */
-
- xop0 = widen_operand (xop0, wider_mode, mode, unsignedp,
- (unoptab == neg_optab
- || unoptab == one_cmpl_optab)
- && class == MODE_INT);
-
- temp = expand_unop (wider_mode, unoptab, xop0, NULL_RTX,
- unsignedp);
-
- if (temp)
- {
- if (class != MODE_INT)
- {
- if (target == 0)
- target = gen_reg_rtx (mode);
- convert_move (target, temp, 0);
- return target;
- }
- else
- return gen_lowpart (mode, temp);
- }
- else
- delete_insns_since (last);
- }
- }
- }
-
- /* If there is no negate operation, try doing a subtract from zero.
- The US Software GOFAST library needs this. */
- if (unoptab == neg_optab)
- {
- rtx temp;
- temp = expand_binop (mode, sub_optab, CONST0_RTX (mode), op0,
- target, unsignedp, OPTAB_LIB_WIDEN);
- if (temp)
- return temp;
- }
-
- return 0;
-}
-
-/* Emit code to compute the absolute value of OP0, with result to
- TARGET if convenient. (TARGET may be 0.) The return value says
- where the result actually is to be found.
-
- MODE is the mode of the operand; the mode of the result is
- different but can be deduced from MODE.
-
- UNSIGNEDP is relevant if extension is needed. */
-
-rtx
-expand_abs (mode, op0, target, unsignedp, safe)
- enum machine_mode mode;
- rtx op0;
- rtx target;
- int unsignedp;
- int safe;
-{
- rtx temp, op1;
-
- /* First try to do it with a special abs instruction. */
- temp = expand_unop (mode, abs_optab, op0, target, 0);
- if (temp != 0)
- return temp;
-
- /* If this machine has expensive jumps, we can do integer absolute
- value of X as (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)),
- where W is the width of MODE. */
-
- if (GET_MODE_CLASS (mode) == MODE_INT && BRANCH_COST >= 2)
- {
- rtx extended = expand_shift (RSHIFT_EXPR, mode, op0,
- size_int (GET_MODE_BITSIZE (mode) - 1),
- NULL_RTX, 0);
-
- temp = expand_binop (mode, xor_optab, extended, op0, target, 0,
- OPTAB_LIB_WIDEN);
- if (temp != 0)
- temp = expand_binop (mode, sub_optab, temp, extended, target, 0,
- OPTAB_LIB_WIDEN);
-
- if (temp != 0)
- return temp;
- }
-
- /* If that does not win, use conditional jump and negate. */
-
- /* It is safe to use the target if it is the same
- as the source if this is also a pseudo register */
- if (op0 == target && GET_CODE (op0) == REG
- && REGNO (op0) >= FIRST_PSEUDO_REGISTER)
- safe = 1;
-
- op1 = gen_label_rtx ();
- if (target == 0 || ! safe
- || GET_MODE (target) != mode
- || (GET_CODE (target) == MEM && MEM_VOLATILE_P (target))
- || (GET_CODE (target) == REG
- && REGNO (target) < FIRST_PSEUDO_REGISTER))
- target = gen_reg_rtx (mode);
-
- emit_move_insn (target, op0);
- NO_DEFER_POP;
-
- /* If this mode is an integer too wide to compare properly,
- compare word by word. Rely on CSE to optimize constant cases. */
- if (GET_MODE_CLASS (mode) == MODE_INT && ! can_compare_p (mode))
- do_jump_by_parts_greater_rtx (mode, 0, target, const0_rtx,
- NULL_RTX, op1);
- else
- {
- temp = compare_from_rtx (target, CONST0_RTX (mode), GE, 0, mode,
- NULL_RTX, 0);
- if (temp == const1_rtx)
- return target;
- else if (temp != const0_rtx)
- {
- if (bcc_gen_fctn[(int) GET_CODE (temp)] != 0)
- emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (temp)]) (op1));
- else
- abort ();
- }
- }
-
- op0 = expand_unop (mode, neg_optab, target, target, 0);
- if (op0 != target)
- emit_move_insn (target, op0);
- emit_label (op1);
- OK_DEFER_POP;
- return target;
-}
-
-/* Emit code to compute the absolute value of OP0, with result to
- TARGET if convenient. (TARGET may be 0.) The return value says
- where the result actually is to be found.
-
- MODE is the mode of the operand; the mode of the result is
- different but can be deduced from MODE.
-
- UNSIGNEDP is relevant for complex integer modes. */
-
-rtx
-expand_complex_abs (mode, op0, target, unsignedp)
- enum machine_mode mode;
- rtx op0;
- rtx target;
- int unsignedp;
-{
- enum mode_class class = GET_MODE_CLASS (mode);
- enum machine_mode wider_mode;
- register rtx temp;
- rtx entry_last = get_last_insn ();
- rtx last;
- rtx pat;
-
- /* Find the correct mode for the real and imaginary parts. */
- enum machine_mode submode
- = mode_for_size (GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT,
- class == MODE_COMPLEX_INT ? MODE_INT : MODE_FLOAT,
- 0);
-
- if (submode == BLKmode)
- abort ();
-
- op0 = protect_from_queue (op0, 0);
-
- if (flag_force_mem)
- {
- op0 = force_not_mem (op0);
- }
-
- last = get_last_insn ();
-
- if (target)
- target = protect_from_queue (target, 1);
-
- if (abs_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- int icode = (int) abs_optab->handlers[(int) mode].insn_code;
- enum machine_mode mode0 = insn_operand_mode[icode][1];
- rtx xop0 = op0;
-
- if (target)
- temp = target;
- else
- temp = gen_reg_rtx (submode);
-
- if (GET_MODE (xop0) != VOIDmode
- && GET_MODE (xop0) != mode0)
- xop0 = convert_to_mode (mode0, xop0, unsignedp);
-
- /* Now, if insn doesn't accept our operand, put it into a pseudo. */
-
- if (! (*insn_operand_predicate[icode][1]) (xop0, mode0))
- xop0 = copy_to_mode_reg (mode0, xop0);
-
- if (! (*insn_operand_predicate[icode][0]) (temp, submode))
- temp = gen_reg_rtx (submode);
-
- pat = GEN_FCN (icode) (temp, xop0);
- if (pat)
- {
- if (GET_CODE (pat) == SEQUENCE
- && ! add_equal_note (pat, temp, abs_optab->code, xop0, NULL_RTX))
- {
- delete_insns_since (last);
- return expand_unop (mode, abs_optab, op0, NULL_RTX, unsignedp);
- }
-
- emit_insn (pat);
-
- return temp;
- }
- else
- delete_insns_since (last);
- }
-
- /* It can't be done in this mode. Can we open-code it in a wider mode? */
-
- for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- if (abs_optab->handlers[(int) wider_mode].insn_code != CODE_FOR_nothing)
- {
- rtx xop0 = op0;
-
- xop0 = convert_modes (wider_mode, mode, xop0, unsignedp);
- temp = expand_complex_abs (wider_mode, xop0, NULL_RTX, unsignedp);
-
- if (temp)
- {
- if (class != MODE_COMPLEX_INT)
- {
- if (target == 0)
- target = gen_reg_rtx (submode);
- convert_move (target, temp, 0);
- return target;
- }
- else
- return gen_lowpart (submode, temp);
- }
- else
- delete_insns_since (last);
- }
- }
-
- /* Open-code the complex absolute-value operation
- if we can open-code sqrt. Otherwise it's not worth while. */
- if (sqrt_optab->handlers[(int) submode].insn_code != CODE_FOR_nothing)
- {
- rtx real, imag, total;
-
- real = gen_realpart (submode, op0);
- imag = gen_imagpart (submode, op0);
-
- /* Square both parts. */
- real = expand_mult (submode, real, real, NULL_RTX, 0);
- imag = expand_mult (submode, imag, imag, NULL_RTX, 0);
-
- /* Sum the parts. */
- total = expand_binop (submode, add_optab, real, imag, NULL_RTX,
- 0, OPTAB_LIB_WIDEN);
-
- /* Get sqrt in TARGET. Set TARGET to where the result is. */
- target = expand_unop (submode, sqrt_optab, total, target, 0);
- if (target == 0)
- delete_insns_since (last);
- else
- return target;
- }
-
- /* Now try a library call in this mode. */
- if (abs_optab->handlers[(int) mode].libfunc)
- {
- rtx insns;
- rtx funexp = abs_optab->handlers[(int) mode].libfunc;
- rtx value;
-
- start_sequence ();
-
- /* Pass 1 for NO_QUEUE so we don't lose any increments
- if the libcall is cse'd or moved. */
- value = emit_library_call_value (abs_optab->handlers[(int) mode].libfunc,
- NULL_RTX, 1, submode, 1, op0, mode);
- insns = get_insns ();
- end_sequence ();
-
- target = gen_reg_rtx (submode);
- emit_libcall_block (insns, target, value,
- gen_rtx (abs_optab->code, mode, op0));
-
- return target;
- }
-
- /* It can't be done in this mode. Can we do it in a wider mode? */
-
- for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- if ((abs_optab->handlers[(int) wider_mode].insn_code
- != CODE_FOR_nothing)
- || abs_optab->handlers[(int) wider_mode].libfunc)
- {
- rtx xop0 = op0;
-
- xop0 = convert_modes (wider_mode, mode, xop0, unsignedp);
-
- temp = expand_complex_abs (wider_mode, xop0, NULL_RTX, unsignedp);
-
- if (temp)
- {
- if (class != MODE_COMPLEX_INT)
- {
- if (target == 0)
- target = gen_reg_rtx (submode);
- convert_move (target, temp, 0);
- return target;
- }
- else
- return gen_lowpart (submode, temp);
- }
- else
- delete_insns_since (last);
- }
- }
-
- delete_insns_since (entry_last);
- return 0;
-}
-
-/* Generate an instruction whose insn-code is INSN_CODE,
- with two operands: an output TARGET and an input OP0.
- TARGET *must* be nonzero, and the output is always stored there.
- CODE is an rtx code such that (CODE OP0) is an rtx that describes
- the value that is stored into TARGET. */
-
-void
-emit_unop_insn (icode, target, op0, code)
- int icode;
- rtx target;
- rtx op0;
- enum rtx_code code;
-{
- register rtx temp;
- enum machine_mode mode0 = insn_operand_mode[icode][1];
- rtx pat;
-
- temp = target = protect_from_queue (target, 1);
-
- op0 = protect_from_queue (op0, 0);
-
- /* Sign and zero extension from memory is often done specially on
- RISC machines, so forcing into a register here can pessimize
- code. */
- if (flag_force_mem && code != SIGN_EXTEND && code != ZERO_EXTEND)
- op0 = force_not_mem (op0);
-
- /* Now, if insn does not accept our operands, put them into pseudos. */
-
- if (! (*insn_operand_predicate[icode][1]) (op0, mode0))
- op0 = copy_to_mode_reg (mode0, op0);
-
- if (! (*insn_operand_predicate[icode][0]) (temp, GET_MODE (temp))
- || (flag_force_mem && GET_CODE (temp) == MEM))
- temp = gen_reg_rtx (GET_MODE (temp));
-
- pat = GEN_FCN (icode) (temp, op0);
-
- if (GET_CODE (pat) == SEQUENCE && code != UNKNOWN)
- add_equal_note (pat, temp, code, op0, NULL_RTX);
-
- emit_insn (pat);
-
- if (temp != target)
- emit_move_insn (target, temp);
-}
-
-/* Emit code to perform a series of operations on a multi-word quantity, one
- word at a time.
-
- Such a block is preceded by a CLOBBER of the output, consists of multiple
- insns, each setting one word of the output, and followed by a SET copying
- the output to itself.
-
- Each of the insns setting words of the output receives a REG_NO_CONFLICT
- note indicating that it doesn't conflict with the (also multi-word)
- inputs. The entire block is surrounded by REG_LIBCALL and REG_RETVAL
- notes.
-
- INSNS is a block of code generated to perform the operation, not including
- the CLOBBER and final copy. All insns that compute intermediate values
- are first emitted, followed by the block as described above.
-
- TARGET, OP0, and OP1 are the output and inputs of the operations,
- respectively. OP1 may be zero for a unary operation.
-
- EQUIV, if non-zero, is an expression to be placed into a REG_EQUAL note
- on the last insn.
-
- If TARGET is not a register, INSNS is simply emitted with no special
- processing. Likewise if anything in INSNS is not an INSN or if
- there is a libcall block inside INSNS.
-
- The final insn emitted is returned. */
-
-rtx
-emit_no_conflict_block (insns, target, op0, op1, equiv)
- rtx insns;
- rtx target;
- rtx op0, op1;
- rtx equiv;
-{
- rtx prev, next, first, last, insn;
-
- if (GET_CODE (target) != REG || reload_in_progress)
- return emit_insns (insns);
- else
- for (insn = insns; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) != INSN
- || find_reg_note (insn, REG_LIBCALL, NULL_RTX))
- return emit_insns (insns);
-
- /* First emit all insns that do not store into words of the output and remove
- these from the list. */
- for (insn = insns; insn; insn = next)
- {
- rtx set = 0;
- int i;
-
- next = NEXT_INSN (insn);
-
- if (GET_CODE (PATTERN (insn)) == SET)
- set = PATTERN (insn);
- else if (GET_CODE (PATTERN (insn)) == PARALLEL)
- {
- for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
- if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET)
- {
- set = XVECEXP (PATTERN (insn), 0, i);
- break;
- }
- }
-
- if (set == 0)
- abort ();
-
- if (! reg_overlap_mentioned_p (target, SET_DEST (set)))
- {
- if (PREV_INSN (insn))
- NEXT_INSN (PREV_INSN (insn)) = next;
- else
- insns = next;
-
- if (next)
- PREV_INSN (next) = PREV_INSN (insn);
-
- add_insn (insn);
- }
- }
-
- prev = get_last_insn ();
-
- /* Now write the CLOBBER of the output, followed by the setting of each
- of the words, followed by the final copy. */
- if (target != op0 && target != op1)
- emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
-
- for (insn = insns; insn; insn = next)
- {
- next = NEXT_INSN (insn);
- add_insn (insn);
-
- if (op1 && GET_CODE (op1) == REG)
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_NO_CONFLICT, op1,
- REG_NOTES (insn));
-
- if (op0 && GET_CODE (op0) == REG)
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_NO_CONFLICT, op0,
- REG_NOTES (insn));
- }
-
- if (mov_optab->handlers[(int) GET_MODE (target)].insn_code
- != CODE_FOR_nothing)
- {
- last = emit_move_insn (target, target);
- if (equiv)
- REG_NOTES (last)
- = gen_rtx (EXPR_LIST, REG_EQUAL, equiv, REG_NOTES (last));
- }
- else
- last = get_last_insn ();
-
- if (prev == 0)
- first = get_insns ();
- else
- first = NEXT_INSN (prev);
-
- /* Encapsulate the block so it gets manipulated as a unit. */
- REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
- REG_NOTES (first));
- REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
-
- return last;
-}
-
-/* Emit code to make a call to a constant function or a library call.
-
- INSNS is a list containing all insns emitted in the call.
- These insns leave the result in RESULT. Our block is to copy RESULT
- to TARGET, which is logically equivalent to EQUIV.
-
- We first emit any insns that set a pseudo on the assumption that these are
- loading constants into registers; doing so allows them to be safely cse'ed
- between blocks. Then we emit all the other insns in the block, followed by
- an insn to move RESULT to TARGET. This last insn will have a REQ_EQUAL
- note with an operand of EQUIV.
-
- Moving assignments to pseudos outside of the block is done to improve
- the generated code, but is not required to generate correct code,
- hence being unable to move an assignment is not grounds for not making
- a libcall block. There are two reasons why it is safe to leave these
- insns inside the block: First, we know that these pseudos cannot be
- used in generated RTL outside the block since they are created for
- temporary purposes within the block. Second, CSE will not record the
- values of anything set inside a libcall block, so we know they must
- be dead at the end of the block.
-
- Except for the first group of insns (the ones setting pseudos), the
- block is delimited by REG_RETVAL and REG_LIBCALL notes. */
-
-void
-emit_libcall_block (insns, target, result, equiv)
- rtx insns;
- rtx target;
- rtx result;
- rtx equiv;
-{
- rtx prev, next, first, last, insn;
-
- /* First emit all insns that set pseudos. Remove them from the list as
- we go. Avoid insns that set pseudos which were referenced in previous
- insns. These can be generated by move_by_pieces, for example,
- to update an address. Similarly, avoid insns that reference things
- set in previous insns. */
-
- for (insn = insns; insn; insn = next)
- {
- rtx set = single_set (insn);
-
- next = NEXT_INSN (insn);
-
- if (set != 0 && GET_CODE (SET_DEST (set)) == REG
- && REGNO (SET_DEST (set)) >= FIRST_PSEUDO_REGISTER
- && (insn == insns
- || (! reg_mentioned_p (SET_DEST (set), PATTERN (insns))
- && ! reg_used_between_p (SET_DEST (set), insns, insn)
- && ! modified_in_p (SET_SRC (set), insns)
- && ! modified_between_p (SET_SRC (set), insns, insn))))
- {
- if (PREV_INSN (insn))
- NEXT_INSN (PREV_INSN (insn)) = next;
- else
- insns = next;
-
- if (next)
- PREV_INSN (next) = PREV_INSN (insn);
-
- add_insn (insn);
- }
- }
-
- prev = get_last_insn ();
-
- /* Write the remaining insns followed by the final copy. */
-
- for (insn = insns; insn; insn = next)
- {
- next = NEXT_INSN (insn);
-
- add_insn (insn);
- }
-
- last = emit_move_insn (target, result);
- if (mov_optab->handlers[(int) GET_MODE (target)].insn_code
- != CODE_FOR_nothing)
- REG_NOTES (last) = gen_rtx (EXPR_LIST,
- REG_EQUAL, copy_rtx (equiv), REG_NOTES (last));
-
- if (prev == 0)
- first = get_insns ();
- else
- first = NEXT_INSN (prev);
-
- /* Encapsulate the block so it gets manipulated as a unit. */
- REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
- REG_NOTES (first));
- REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
-}
-
-/* Generate code to store zero in X. */
-
-void
-emit_clr_insn (x)
- rtx x;
-{
- emit_move_insn (x, const0_rtx);
-}
-
-/* Generate code to store 1 in X
- assuming it contains zero beforehand. */
-
-void
-emit_0_to_1_insn (x)
- rtx x;
-{
- emit_move_insn (x, const1_rtx);
-}
-
-/* Generate code to compare X with Y
- so that the condition codes are set.
-
- MODE is the mode of the inputs (in case they are const_int).
- UNSIGNEDP nonzero says that X and Y are unsigned;
- this matters if they need to be widened.
-
- If they have mode BLKmode, then SIZE specifies the size of both X and Y,
- and ALIGN specifies the known shared alignment of X and Y.
-
- COMPARISON is the rtl operator to compare with (EQ, NE, GT, etc.).
- It is ignored for fixed-point and block comparisons;
- it is used only for floating-point comparisons. */
-
-void
-emit_cmp_insn (x, y, comparison, size, mode, unsignedp, align)
- rtx x, y;
- enum rtx_code comparison;
- rtx size;
- enum machine_mode mode;
- int unsignedp;
- int align;
-{
- enum mode_class class;
- enum machine_mode wider_mode;
-
- class = GET_MODE_CLASS (mode);
-
- /* They could both be VOIDmode if both args are immediate constants,
- but we should fold that at an earlier stage.
- With no special code here, this will call abort,
- reminding the programmer to implement such folding. */
-
- if (mode != BLKmode && flag_force_mem)
- {
- x = force_not_mem (x);
- y = force_not_mem (y);
- }
-
- /* If we are inside an appropriately-short loop and one operand is an
- expensive constant, force it into a register. */
- if (CONSTANT_P (x) && preserve_subexpressions_p () && rtx_cost (x, COMPARE) > 2)
- x = force_reg (mode, x);
-
- if (CONSTANT_P (y) && preserve_subexpressions_p () && rtx_cost (y, COMPARE) > 2)
- y = force_reg (mode, y);
-
- /* Don't let both operands fail to indicate the mode. */
- if (GET_MODE (x) == VOIDmode && GET_MODE (y) == VOIDmode)
- x = force_reg (mode, x);
-
- /* Handle all BLKmode compares. */
-
- if (mode == BLKmode)
- {
- emit_queue ();
- x = protect_from_queue (x, 0);
- y = protect_from_queue (y, 0);
-
- if (size == 0)
- abort ();
-#ifdef HAVE_cmpstrqi
- if (HAVE_cmpstrqi
- && GET_CODE (size) == CONST_INT
- && INTVAL (size) < (1 << GET_MODE_BITSIZE (QImode)))
- {
- enum machine_mode result_mode
- = insn_operand_mode[(int) CODE_FOR_cmpstrqi][0];
- rtx result = gen_reg_rtx (result_mode);
- emit_insn (gen_cmpstrqi (result, x, y, size, GEN_INT (align)));
- emit_cmp_insn (result, const0_rtx, comparison, NULL_RTX,
- result_mode, 0, 0);
- }
- else
-#endif
-#ifdef HAVE_cmpstrhi
- if (HAVE_cmpstrhi
- && GET_CODE (size) == CONST_INT
- && INTVAL (size) < (1 << GET_MODE_BITSIZE (HImode)))
- {
- enum machine_mode result_mode
- = insn_operand_mode[(int) CODE_FOR_cmpstrhi][0];
- rtx result = gen_reg_rtx (result_mode);
- emit_insn (gen_cmpstrhi (result, x, y, size, GEN_INT (align)));
- emit_cmp_insn (result, const0_rtx, comparison, NULL_RTX,
- result_mode, 0, 0);
- }
- else
-#endif
-#ifdef HAVE_cmpstrsi
- if (HAVE_cmpstrsi)
- {
- enum machine_mode result_mode
- = insn_operand_mode[(int) CODE_FOR_cmpstrsi][0];
- rtx result = gen_reg_rtx (result_mode);
- size = protect_from_queue (size, 0);
- emit_insn (gen_cmpstrsi (result, x, y,
- convert_to_mode (SImode, size, 1),
- GEN_INT (align)));
- emit_cmp_insn (result, const0_rtx, comparison, NULL_RTX,
- result_mode, 0, 0);
- }
- else
-#endif
- {
- rtx result;
-
-#ifdef TARGET_MEM_FUNCTIONS
- emit_library_call (memcmp_libfunc, 0,
- TYPE_MODE (integer_type_node), 3,
- XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
- convert_to_mode (TYPE_MODE (sizetype), size,
- TREE_UNSIGNED (sizetype)),
- TYPE_MODE (sizetype));
-#else
- emit_library_call (bcmp_libfunc, 0,
- TYPE_MODE (integer_type_node), 3,
- XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
- convert_to_mode (TYPE_MODE (integer_type_node),
- size,
- TREE_UNSIGNED (integer_type_node)),
- TYPE_MODE (integer_type_node));
-#endif
-
- /* Immediately move the result of the libcall into a pseudo
- register so reload doesn't clobber the value if it needs
- the return register for a spill reg. */
- result = gen_reg_rtx (TYPE_MODE (integer_type_node));
- emit_move_insn (result,
- hard_libcall_value (TYPE_MODE (integer_type_node)));
- emit_cmp_insn (result,
- const0_rtx, comparison, NULL_RTX,
- TYPE_MODE (integer_type_node), 0, 0);
- }
- return;
- }
-
- /* Handle some compares against zero. */
-
- if (y == CONST0_RTX (mode)
- && tst_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- int icode = (int) tst_optab->handlers[(int) mode].insn_code;
-
- emit_queue ();
- x = protect_from_queue (x, 0);
- y = protect_from_queue (y, 0);
-
- /* Now, if insn does accept these operands, put them into pseudos. */
- if (! (*insn_operand_predicate[icode][0])
- (x, insn_operand_mode[icode][0]))
- x = copy_to_mode_reg (insn_operand_mode[icode][0], x);
-
- emit_insn (GEN_FCN (icode) (x));
- return;
- }
-
- /* Handle compares for which there is a directly suitable insn. */
-
- if (cmp_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
- {
- int icode = (int) cmp_optab->handlers[(int) mode].insn_code;
-
- emit_queue ();
- x = protect_from_queue (x, 0);
- y = protect_from_queue (y, 0);
-
- /* Now, if insn doesn't accept these operands, put them into pseudos. */
- if (! (*insn_operand_predicate[icode][0])
- (x, insn_operand_mode[icode][0]))
- x = copy_to_mode_reg (insn_operand_mode[icode][0], x);
-
- if (! (*insn_operand_predicate[icode][1])
- (y, insn_operand_mode[icode][1]))
- y = copy_to_mode_reg (insn_operand_mode[icode][1], y);
-
- emit_insn (GEN_FCN (icode) (x, y));
- return;
- }
-
- /* Try widening if we can find a direct insn that way. */
-
- if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
- {
- for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- if (cmp_optab->handlers[(int) wider_mode].insn_code
- != CODE_FOR_nothing)
- {
- x = protect_from_queue (x, 0);
- y = protect_from_queue (y, 0);
- x = convert_modes (wider_mode, mode, x, unsignedp);
- y = convert_modes (wider_mode, mode, y, unsignedp);
- emit_cmp_insn (x, y, comparison, NULL_RTX,
- wider_mode, unsignedp, align);
- return;
- }
- }
- }
-
- /* Handle a lib call just for the mode we are using. */
-
- if (cmp_optab->handlers[(int) mode].libfunc
- && class != MODE_FLOAT)
- {
- rtx libfunc = cmp_optab->handlers[(int) mode].libfunc;
- rtx result;
-
- /* If we want unsigned, and this mode has a distinct unsigned
- comparison routine, use that. */
- if (unsignedp && ucmp_optab->handlers[(int) mode].libfunc)
- libfunc = ucmp_optab->handlers[(int) mode].libfunc;
-
- emit_library_call (libfunc, 1,
- word_mode, 2, x, mode, y, mode);
-
- /* Immediately move the result of the libcall into a pseudo
- register so reload doesn't clobber the value if it needs
- the return register for a spill reg. */
- result = gen_reg_rtx (word_mode);
- emit_move_insn (result, hard_libcall_value (word_mode));
-
- /* Integer comparison returns a result that must be compared against 1,
- so that even if we do an unsigned compare afterward,
- there is still a value that can represent the result "less than". */
- emit_cmp_insn (result, const1_rtx,
- comparison, NULL_RTX, word_mode, unsignedp, 0);
- return;
- }
-
- if (class == MODE_FLOAT)
- emit_float_lib_cmp (x, y, comparison);
-
- else
- abort ();
-}
-
-/* Nonzero if a compare of mode MODE can be done straightforwardly
- (without splitting it into pieces). */
-
-int
-can_compare_p (mode)
- enum machine_mode mode;
-{
- do
- {
- if (cmp_optab->handlers[(int)mode].insn_code != CODE_FOR_nothing)
- return 1;
- mode = GET_MODE_WIDER_MODE (mode);
- } while (mode != VOIDmode);
-
- return 0;
-}
-
-/* Emit a library call comparison between floating point X and Y.
- COMPARISON is the rtl operator to compare with (EQ, NE, GT, etc.). */
-
-void
-emit_float_lib_cmp (x, y, comparison)
- rtx x, y;
- enum rtx_code comparison;
-{
- enum machine_mode mode = GET_MODE (x);
- rtx libfunc = 0;
- rtx result;
-
- if (mode == HFmode)
- switch (comparison)
- {
- case EQ:
- libfunc = eqhf2_libfunc;
- break;
-
- case NE:
- libfunc = nehf2_libfunc;
- break;
-
- case GT:
- libfunc = gthf2_libfunc;
- break;
-
- case GE:
- libfunc = gehf2_libfunc;
- break;
-
- case LT:
- libfunc = lthf2_libfunc;
- break;
-
- case LE:
- libfunc = lehf2_libfunc;
- break;
- }
- else if (mode == SFmode)
- switch (comparison)
- {
- case EQ:
- libfunc = eqsf2_libfunc;
- break;
-
- case NE:
- libfunc = nesf2_libfunc;
- break;
-
- case GT:
- libfunc = gtsf2_libfunc;
- break;
-
- case GE:
- libfunc = gesf2_libfunc;
- break;
-
- case LT:
- libfunc = ltsf2_libfunc;
- break;
-
- case LE:
- libfunc = lesf2_libfunc;
- break;
- }
- else if (mode == DFmode)
- switch (comparison)
- {
- case EQ:
- libfunc = eqdf2_libfunc;
- break;
-
- case NE:
- libfunc = nedf2_libfunc;
- break;
-
- case GT:
- libfunc = gtdf2_libfunc;
- break;
-
- case GE:
- libfunc = gedf2_libfunc;
- break;
-
- case LT:
- libfunc = ltdf2_libfunc;
- break;
-
- case LE:
- libfunc = ledf2_libfunc;
- break;
- }
- else if (mode == XFmode)
- switch (comparison)
- {
- case EQ:
- libfunc = eqxf2_libfunc;
- break;
-
- case NE:
- libfunc = nexf2_libfunc;
- break;
-
- case GT:
- libfunc = gtxf2_libfunc;
- break;
-
- case GE:
- libfunc = gexf2_libfunc;
- break;
-
- case LT:
- libfunc = ltxf2_libfunc;
- break;
-
- case LE:
- libfunc = lexf2_libfunc;
- break;
- }
- else if (mode == TFmode)
- switch (comparison)
- {
- case EQ:
- libfunc = eqtf2_libfunc;
- break;
-
- case NE:
- libfunc = netf2_libfunc;
- break;
-
- case GT:
- libfunc = gttf2_libfunc;
- break;
-
- case GE:
- libfunc = getf2_libfunc;
- break;
-
- case LT:
- libfunc = lttf2_libfunc;
- break;
-
- case LE:
- libfunc = letf2_libfunc;
- break;
- }
- else
- {
- enum machine_mode wider_mode;
-
- for (wider_mode = GET_MODE_WIDER_MODE (mode); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- {
- if ((cmp_optab->handlers[(int) wider_mode].insn_code
- != CODE_FOR_nothing)
- || (cmp_optab->handlers[(int) wider_mode].libfunc != 0))
- {
- x = protect_from_queue (x, 0);
- y = protect_from_queue (y, 0);
- x = convert_to_mode (wider_mode, x, 0);
- y = convert_to_mode (wider_mode, y, 0);
- emit_float_lib_cmp (x, y, comparison);
- return;
- }
- }
- abort ();
- }
-
- if (libfunc == 0)
- abort ();
-
- emit_library_call (libfunc, 1,
- word_mode, 2, x, mode, y, mode);
-
- /* Immediately move the result of the libcall into a pseudo
- register so reload doesn't clobber the value if it needs
- the return register for a spill reg. */
- result = gen_reg_rtx (word_mode);
- emit_move_insn (result, hard_libcall_value (word_mode));
-
- emit_cmp_insn (result, const0_rtx, comparison,
- NULL_RTX, word_mode, 0, 0);
-}
-
-/* Generate code to indirectly jump to a location given in the rtx LOC. */
-
-void
-emit_indirect_jump (loc)
- rtx loc;
-{
- if (! ((*insn_operand_predicate[(int)CODE_FOR_indirect_jump][0])
- (loc, Pmode)))
- loc = copy_to_mode_reg (Pmode, loc);
-
- emit_jump_insn (gen_indirect_jump (loc));
- emit_barrier ();
-}
-
-#ifdef HAVE_conditional_move
-
-/* Emit a conditional move instruction if the machine supports one for that
- condition and machine mode.
-
- OP0 and OP1 are the operands that should be compared using CODE. CMODE is
- the mode to use should they be constants. If it is VOIDmode, they cannot
- both be constants.
-
- OP2 should be stored in TARGET if the comparison is true, otherwise OP3
- should be stored there. MODE is the mode to use should they be constants.
- If it is VOIDmode, they cannot both be constants.
-
- The result is either TARGET (perhaps modified) or NULL_RTX if the operation
- is not supported. */
-
-rtx
-emit_conditional_move (target, code, op0, op1, cmode, op2, op3, mode,
- unsignedp)
- rtx target;
- enum rtx_code code;
- rtx op0, op1;
- enum machine_mode cmode;
- rtx op2, op3;
- enum machine_mode mode;
- int unsignedp;
-{
- rtx tem, subtarget, comparison, insn;
- enum insn_code icode;
-
- /* If one operand is constant, make it the second one. Only do this
- if the other operand is not constant as well. */
-
- if ((CONSTANT_P (op0) && ! CONSTANT_P (op1))
- || (GET_CODE (op0) == CONST_INT && GET_CODE (op1) != CONST_INT))
- {
- tem = op0;
- op0 = op1;
- op1 = tem;
- code = swap_condition (code);
- }
-
- if (cmode == VOIDmode)
- cmode = GET_MODE (op0);
-
- if ((CONSTANT_P (op2) && ! CONSTANT_P (op3))
- || (GET_CODE (op2) == CONST_INT && GET_CODE (op3) != CONST_INT))
- {
- tem = op2;
- op2 = op3;
- op3 = tem;
- /* ??? This may not be appropriate (consider IEEE). Perhaps we should
- call can_reverse_comparison_p here and bail out if necessary.
- It's not clear whether we need to do this canonicalization though. */
- code = reverse_condition (code);
- }
-
- if (mode == VOIDmode)
- mode = GET_MODE (op2);
-
- icode = movcc_gen_code[mode];
-
- if (icode == CODE_FOR_nothing)
- return 0;
-
- if (flag_force_mem)
- {
- op2 = force_not_mem (op2);
- op3 = force_not_mem (op3);
- }
-
- if (target)
- target = protect_from_queue (target, 1);
- else
- target = gen_reg_rtx (mode);
-
- subtarget = target;
-
- emit_queue ();
-
- op2 = protect_from_queue (op2, 0);
- op3 = protect_from_queue (op3, 0);
-
- /* If the insn doesn't accept these operands, put them in pseudos. */
-
- if (! (*insn_operand_predicate[icode][0])
- (subtarget, insn_operand_mode[icode][0]))
- subtarget = gen_reg_rtx (insn_operand_mode[icode][0]);
-
- if (! (*insn_operand_predicate[icode][2])
- (op2, insn_operand_mode[icode][2]))
- op2 = copy_to_mode_reg (insn_operand_mode[icode][2], op2);
-
- if (! (*insn_operand_predicate[icode][3])
- (op3, insn_operand_mode[icode][3]))
- op3 = copy_to_mode_reg (insn_operand_mode[icode][3], op3);
-
- /* Everything should now be in the suitable form, so emit the compare insn
- and then the conditional move. */
-
- comparison
- = compare_from_rtx (op0, op1, code, unsignedp, cmode, NULL_RTX, 0);
-
- /* ??? Watch for const0_rtx (nop) and const_true_rtx (unconditional)? */
- if (GET_CODE (comparison) != code)
- /* This shouldn't happen. */
- abort ();
-
- insn = GEN_FCN (icode) (subtarget, comparison, op2, op3);
-
- /* If that failed, then give up. */
- if (insn == 0)
- return 0;
-
- emit_insn (insn);
-
- if (subtarget != target)
- convert_move (target, subtarget, 0);
-
- return target;
-}
-
-/* Return non-zero if a conditional move of mode MODE is supported.
-
- This function is for combine so it can tell whether an insn that looks
- like a conditional move is actually supported by the hardware. If we
- guess wrong we lose a bit on optimization, but that's it. */
-/* ??? sparc64 supports conditionally moving integers values based on fp
- comparisons, and vice versa. How do we handle them? */
-
-int
-can_conditionally_move_p (mode)
- enum machine_mode mode;
-{
- if (movcc_gen_code[mode] != CODE_FOR_nothing)
- return 1;
-
- return 0;
-}
-
-#endif /* HAVE_conditional_move */
-
-/* These three functions generate an insn body and return it
- rather than emitting the insn.
-
- They do not protect from queued increments,
- because they may be used 1) in protect_from_queue itself
- and 2) in other passes where there is no queue. */
-
-/* Generate and return an insn body to add Y to X. */
-
-rtx
-gen_add2_insn (x, y)
- rtx x, y;
-{
- int icode = (int) add_optab->handlers[(int) GET_MODE (x)].insn_code;
-
- if (! (*insn_operand_predicate[icode][0]) (x, insn_operand_mode[icode][0])
- || ! (*insn_operand_predicate[icode][1]) (x, insn_operand_mode[icode][1])
- || ! (*insn_operand_predicate[icode][2]) (y, insn_operand_mode[icode][2]))
- abort ();
-
- return (GEN_FCN (icode) (x, x, y));
-}
-
-int
-have_add2_insn (mode)
- enum machine_mode mode;
-{
- return add_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
-}
-
-/* Generate and return an insn body to subtract Y from X. */
-
-rtx
-gen_sub2_insn (x, y)
- rtx x, y;
-{
- int icode = (int) sub_optab->handlers[(int) GET_MODE (x)].insn_code;
-
- if (! (*insn_operand_predicate[icode][0]) (x, insn_operand_mode[icode][0])
- || ! (*insn_operand_predicate[icode][1]) (x, insn_operand_mode[icode][1])
- || ! (*insn_operand_predicate[icode][2]) (y, insn_operand_mode[icode][2]))
- abort ();
-
- return (GEN_FCN (icode) (x, x, y));
-}
-
-int
-have_sub2_insn (mode)
- enum machine_mode mode;
-{
- return sub_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
-}
-
-/* Generate the body of an instruction to copy Y into X.
- It may be a SEQUENCE, if one insn isn't enough. */
-
-rtx
-gen_move_insn (x, y)
- rtx x, y;
-{
- register enum machine_mode mode = GET_MODE (x);
- enum insn_code insn_code;
- rtx seq;
-
- if (mode == VOIDmode)
- mode = GET_MODE (y);
-
- insn_code = mov_optab->handlers[(int) mode].insn_code;
-
- /* Handle MODE_CC modes: If we don't have a special move insn for this mode,
- find a mode to do it in. If we have a movcc, use it. Otherwise,
- find the MODE_INT mode of the same width. */
-
- if (GET_MODE_CLASS (mode) == MODE_CC && insn_code == CODE_FOR_nothing)
- {
- enum machine_mode tmode = VOIDmode;
- rtx x1 = x, y1 = y;
-
- if (mode != CCmode
- && mov_optab->handlers[(int) CCmode].insn_code != CODE_FOR_nothing)
- tmode = CCmode;
- else
- for (tmode = QImode; tmode != VOIDmode;
- tmode = GET_MODE_WIDER_MODE (tmode))
- if (GET_MODE_SIZE (tmode) == GET_MODE_SIZE (mode))
- break;
-
- if (tmode == VOIDmode)
- abort ();
-
- /* Get X and Y in TMODE. We can't use gen_lowpart here because it
- may call change_address which is not appropriate if we were
- called when a reload was in progress. We don't have to worry
- about changing the address since the size in bytes is supposed to
- be the same. Copy the MEM to change the mode and move any
- substitutions from the old MEM to the new one. */
-
- if (reload_in_progress)
- {
- x = gen_lowpart_common (tmode, x1);
- if (x == 0 && GET_CODE (x1) == MEM)
- {
- x = gen_rtx (MEM, tmode, XEXP (x1, 0));
- RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (x1);
- MEM_IN_STRUCT_P (x) = MEM_IN_STRUCT_P (x1);
- MEM_VOLATILE_P (x) = MEM_VOLATILE_P (x1);
- copy_replacements (x1, x);
- }
-
- y = gen_lowpart_common (tmode, y1);
- if (y == 0 && GET_CODE (y1) == MEM)
- {
- y = gen_rtx (MEM, tmode, XEXP (y1, 0));
- RTX_UNCHANGING_P (y) = RTX_UNCHANGING_P (y1);
- MEM_IN_STRUCT_P (y) = MEM_IN_STRUCT_P (y1);
- MEM_VOLATILE_P (y) = MEM_VOLATILE_P (y1);
- copy_replacements (y1, y);
- }
- }
- else
- {
- x = gen_lowpart (tmode, x);
- y = gen_lowpart (tmode, y);
- }
-
- insn_code = mov_optab->handlers[(int) tmode].insn_code;
- return (GEN_FCN (insn_code) (x, y));
- }
-
- start_sequence ();
- emit_move_insn_1 (x, y);
- seq = gen_sequence ();
- end_sequence ();
- return seq;
-}
-
-/* Return the insn code used to extend FROM_MODE to TO_MODE.
- UNSIGNEDP specifies zero-extension instead of sign-extension. If
- no such operation exists, CODE_FOR_nothing will be returned. */
-
-enum insn_code
-can_extend_p (to_mode, from_mode, unsignedp)
- enum machine_mode to_mode, from_mode;
- int unsignedp;
-{
- return extendtab[(int) to_mode][(int) from_mode][unsignedp];
-}
-
-/* Generate the body of an insn to extend Y (with mode MFROM)
- into X (with mode MTO). Do zero-extension if UNSIGNEDP is nonzero. */
-
-rtx
-gen_extend_insn (x, y, mto, mfrom, unsignedp)
- rtx x, y;
- enum machine_mode mto, mfrom;
- int unsignedp;
-{
- return (GEN_FCN (extendtab[(int) mto][(int) mfrom][unsignedp]) (x, y));
-}
-
-/* can_fix_p and can_float_p say whether the target machine
- can directly convert a given fixed point type to
- a given floating point type, or vice versa.
- The returned value is the CODE_FOR_... value to use,
- or CODE_FOR_nothing if these modes cannot be directly converted.
-
- *TRUNCP_PTR is set to 1 if it is necessary to output
- an explicit FTRUNC insn before the fix insn; otherwise 0. */
-
-static enum insn_code
-can_fix_p (fixmode, fltmode, unsignedp, truncp_ptr)
- enum machine_mode fltmode, fixmode;
- int unsignedp;
- int *truncp_ptr;
-{
- *truncp_ptr = 0;
- if (fixtrunctab[(int) fltmode][(int) fixmode][unsignedp] != CODE_FOR_nothing)
- return fixtrunctab[(int) fltmode][(int) fixmode][unsignedp];
-
- if (ftrunc_optab->handlers[(int) fltmode].insn_code != CODE_FOR_nothing)
- {
- *truncp_ptr = 1;
- return fixtab[(int) fltmode][(int) fixmode][unsignedp];
- }
- return CODE_FOR_nothing;
-}
-
-static enum insn_code
-can_float_p (fltmode, fixmode, unsignedp)
- enum machine_mode fixmode, fltmode;
- int unsignedp;
-{
- return floattab[(int) fltmode][(int) fixmode][unsignedp];
-}
-
-/* Generate code to convert FROM to floating point
- and store in TO. FROM must be fixed point and not VOIDmode.
- UNSIGNEDP nonzero means regard FROM as unsigned.
- Normally this is done by correcting the final value
- if it is negative. */
-
-void
-expand_float (to, from, unsignedp)
- rtx to, from;
- int unsignedp;
-{
- enum insn_code icode;
- register rtx target = to;
- enum machine_mode fmode, imode;
-
- /* Crash now, because we won't be able to decide which mode to use. */
- if (GET_MODE (from) == VOIDmode)
- abort ();
-
- /* Look for an insn to do the conversion. Do it in the specified
- modes if possible; otherwise convert either input, output or both to
- wider mode. If the integer mode is wider than the mode of FROM,
- we can do the conversion signed even if the input is unsigned. */
-
- for (imode = GET_MODE (from); imode != VOIDmode;
- imode = GET_MODE_WIDER_MODE (imode))
- for (fmode = GET_MODE (to); fmode != VOIDmode;
- fmode = GET_MODE_WIDER_MODE (fmode))
- {
- int doing_unsigned = unsignedp;
-
- icode = can_float_p (fmode, imode, unsignedp);
- if (icode == CODE_FOR_nothing && imode != GET_MODE (from) && unsignedp)
- icode = can_float_p (fmode, imode, 0), doing_unsigned = 0;
-
- if (icode != CODE_FOR_nothing)
- {
- to = protect_from_queue (to, 1);
- from = protect_from_queue (from, 0);
-
- if (imode != GET_MODE (from))
- from = convert_to_mode (imode, from, unsignedp);
-
- if (fmode != GET_MODE (to))
- target = gen_reg_rtx (fmode);
-
- emit_unop_insn (icode, target, from,
- doing_unsigned ? UNSIGNED_FLOAT : FLOAT);
-
- if (target != to)
- convert_move (to, target, 0);
- return;
- }
- }
-
-#if !defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
-
- /* Unsigned integer, and no way to convert directly.
- Convert as signed, then conditionally adjust the result. */
- if (unsignedp)
- {
- rtx label = gen_label_rtx ();
- rtx temp;
- REAL_VALUE_TYPE offset;
-
- emit_queue ();
-
- to = protect_from_queue (to, 1);
- from = protect_from_queue (from, 0);
-
- if (flag_force_mem)
- from = force_not_mem (from);
-
- /* Look for a usable floating mode FMODE wider than the source and at
- least as wide as the target. Using FMODE will avoid rounding woes
- with unsigned values greater than the signed maximum value. */
-
- for (fmode = GET_MODE (to); fmode != VOIDmode;
- fmode = GET_MODE_WIDER_MODE (fmode))
- if (GET_MODE_BITSIZE (GET_MODE (from)) < GET_MODE_BITSIZE (fmode)
- && can_float_p (fmode, GET_MODE (from), 0) != CODE_FOR_nothing)
- break;
-
- if (fmode == VOIDmode)
- {
- /* There is no such mode. Pretend the target is wide enough. */
- fmode = GET_MODE (to);
-
- /* Avoid double-rounding when TO is narrower than FROM. */
- if ((significand_size (fmode) + 1)
- < GET_MODE_BITSIZE (GET_MODE (from)))
- {
- rtx temp1;
- rtx neglabel = gen_label_rtx ();
-
- /* Don't use TARGET if it isn't a register, is a hard register,
- or is the wrong mode. */
- if (GET_CODE (target) != REG
- || REGNO (target) < FIRST_PSEUDO_REGISTER
- || GET_MODE (target) != fmode)
- target = gen_reg_rtx (fmode);
-
- imode = GET_MODE (from);
- do_pending_stack_adjust ();
-
- /* Test whether the sign bit is set. */
- emit_cmp_insn (from, const0_rtx, GE, NULL_RTX, imode, 0, 0);
- emit_jump_insn (gen_blt (neglabel));
-
- /* The sign bit is not set. Convert as signed. */
- expand_float (target, from, 0);
- emit_jump_insn (gen_jump (label));
- emit_barrier ();
-
- /* The sign bit is set.
- Convert to a usable (positive signed) value by shifting right
- one bit, while remembering if a nonzero bit was shifted
- out; i.e., compute (from & 1) | (from >> 1). */
-
- emit_label (neglabel);
- temp = expand_binop (imode, and_optab, from, const1_rtx,
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
- temp1 = expand_shift (RSHIFT_EXPR, imode, from, integer_one_node,
- NULL_RTX, 1);
- temp = expand_binop (imode, ior_optab, temp, temp1, temp, 1,
- OPTAB_LIB_WIDEN);
- expand_float (target, temp, 0);
-
- /* Multiply by 2 to undo the shift above. */
- temp = expand_binop (fmode, add_optab, target, target,
- target, 0, OPTAB_LIB_WIDEN);
- if (temp != target)
- emit_move_insn (target, temp);
-
- do_pending_stack_adjust ();
- emit_label (label);
- goto done;
- }
- }
-
- /* If we are about to do some arithmetic to correct for an
- unsigned operand, do it in a pseudo-register. */
-
- if (GET_MODE (to) != fmode
- || GET_CODE (to) != REG || REGNO (to) < FIRST_PSEUDO_REGISTER)
- target = gen_reg_rtx (fmode);
-
- /* Convert as signed integer to floating. */
- expand_float (target, from, 0);
-
- /* If FROM is negative (and therefore TO is negative),
- correct its value by 2**bitwidth. */
-
- do_pending_stack_adjust ();
- emit_cmp_insn (from, const0_rtx, GE, NULL_RTX, GET_MODE (from), 0, 0);
- emit_jump_insn (gen_bge (label));
-
- /* On SCO 3.2.1, ldexp rejects values outside [0.5, 1).
- Rather than setting up a dconst_dot_5, let's hope SCO
- fixes the bug. */
- offset = REAL_VALUE_LDEXP (dconst1, GET_MODE_BITSIZE (GET_MODE (from)));
- temp = expand_binop (fmode, add_optab, target,
- CONST_DOUBLE_FROM_REAL_VALUE (offset, fmode),
- target, 0, OPTAB_LIB_WIDEN);
- if (temp != target)
- emit_move_insn (target, temp);
-
- do_pending_stack_adjust ();
- emit_label (label);
- goto done;
- }
-#endif
-
- /* No hardware instruction available; call a library routine to convert from
- SImode, DImode, or TImode into SFmode, DFmode, XFmode, or TFmode. */
- {
- rtx libfcn;
- rtx insns;
- rtx value;
-
- to = protect_from_queue (to, 1);
- from = protect_from_queue (from, 0);
-
- if (GET_MODE_SIZE (GET_MODE (from)) < GET_MODE_SIZE (SImode))
- from = convert_to_mode (SImode, from, unsignedp);
-
- if (flag_force_mem)
- from = force_not_mem (from);
-
- if (GET_MODE (to) == SFmode)
- {
- if (GET_MODE (from) == SImode)
- libfcn = floatsisf_libfunc;
- else if (GET_MODE (from) == DImode)
- libfcn = floatdisf_libfunc;
- else if (GET_MODE (from) == TImode)
- libfcn = floattisf_libfunc;
- else
- abort ();
- }
- else if (GET_MODE (to) == DFmode)
- {
- if (GET_MODE (from) == SImode)
- libfcn = floatsidf_libfunc;
- else if (GET_MODE (from) == DImode)
- libfcn = floatdidf_libfunc;
- else if (GET_MODE (from) == TImode)
- libfcn = floattidf_libfunc;
- else
- abort ();
- }
- else if (GET_MODE (to) == XFmode)
- {
- if (GET_MODE (from) == SImode)
- libfcn = floatsixf_libfunc;
- else if (GET_MODE (from) == DImode)
- libfcn = floatdixf_libfunc;
- else if (GET_MODE (from) == TImode)
- libfcn = floattixf_libfunc;
- else
- abort ();
- }
- else if (GET_MODE (to) == TFmode)
- {
- if (GET_MODE (from) == SImode)
- libfcn = floatsitf_libfunc;
- else if (GET_MODE (from) == DImode)
- libfcn = floatditf_libfunc;
- else if (GET_MODE (from) == TImode)
- libfcn = floattitf_libfunc;
- else
- abort ();
- }
- else
- abort ();
-
- start_sequence ();
-
- value = emit_library_call_value (libfcn, NULL_RTX, 1,
- GET_MODE (to),
- 1, from, GET_MODE (from));
- insns = get_insns ();
- end_sequence ();
-
- emit_libcall_block (insns, target, value,
- gen_rtx (FLOAT, GET_MODE (to), from));
- }
-
- done:
-
- /* Copy result to requested destination
- if we have been computing in a temp location. */
-
- if (target != to)
- {
- if (GET_MODE (target) == GET_MODE (to))
- emit_move_insn (to, target);
- else
- convert_move (to, target, 0);
- }
-}
-
-/* expand_fix: generate code to convert FROM to fixed point
- and store in TO. FROM must be floating point. */
-
-static rtx
-ftruncify (x)
- rtx x;
-{
- rtx temp = gen_reg_rtx (GET_MODE (x));
- return expand_unop (GET_MODE (x), ftrunc_optab, x, temp, 0);
-}
-
-void
-expand_fix (to, from, unsignedp)
- register rtx to, from;
- int unsignedp;
-{
- enum insn_code icode;
- register rtx target = to;
- enum machine_mode fmode, imode;
- int must_trunc = 0;
- rtx libfcn = 0;
-
- /* We first try to find a pair of modes, one real and one integer, at
- least as wide as FROM and TO, respectively, in which we can open-code
- this conversion. If the integer mode is wider than the mode of TO,
- we can do the conversion either signed or unsigned. */
-
- for (imode = GET_MODE (to); imode != VOIDmode;
- imode = GET_MODE_WIDER_MODE (imode))
- for (fmode = GET_MODE (from); fmode != VOIDmode;
- fmode = GET_MODE_WIDER_MODE (fmode))
- {
- int doing_unsigned = unsignedp;
-
- icode = can_fix_p (imode, fmode, unsignedp, &must_trunc);
- if (icode == CODE_FOR_nothing && imode != GET_MODE (to) && unsignedp)
- icode = can_fix_p (imode, fmode, 0, &must_trunc), doing_unsigned = 0;
-
- if (icode != CODE_FOR_nothing)
- {
- to = protect_from_queue (to, 1);
- from = protect_from_queue (from, 0);
-
- if (fmode != GET_MODE (from))
- from = convert_to_mode (fmode, from, 0);
-
- if (must_trunc)
- from = ftruncify (from);
-
- if (imode != GET_MODE (to))
- target = gen_reg_rtx (imode);
-
- emit_unop_insn (icode, target, from,
- doing_unsigned ? UNSIGNED_FIX : FIX);
- if (target != to)
- convert_move (to, target, unsignedp);
- return;
- }
- }
-
-#if !defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
- /* For an unsigned conversion, there is one more way to do it.
- If we have a signed conversion, we generate code that compares
- the real value to the largest representable positive number. If if
- is smaller, the conversion is done normally. Otherwise, subtract
- one plus the highest signed number, convert, and add it back.
-
- We only need to check all real modes, since we know we didn't find
- anything with a wider integer mode. */
-
- if (unsignedp && GET_MODE_BITSIZE (GET_MODE (to)) <= HOST_BITS_PER_WIDE_INT)
- for (fmode = GET_MODE (from); fmode != VOIDmode;
- fmode = GET_MODE_WIDER_MODE (fmode))
- /* Make sure we won't lose significant bits doing this. */
- if (GET_MODE_BITSIZE (fmode) > GET_MODE_BITSIZE (GET_MODE (to))
- && CODE_FOR_nothing != can_fix_p (GET_MODE (to), fmode, 0,
- &must_trunc))
- {
- int bitsize;
- REAL_VALUE_TYPE offset;
- rtx limit, lab1, lab2, insn;
-
- bitsize = GET_MODE_BITSIZE (GET_MODE (to));
- offset = REAL_VALUE_LDEXP (dconst1, bitsize - 1);
- limit = CONST_DOUBLE_FROM_REAL_VALUE (offset, fmode);
- lab1 = gen_label_rtx ();
- lab2 = gen_label_rtx ();
-
- emit_queue ();
- to = protect_from_queue (to, 1);
- from = protect_from_queue (from, 0);
-
- if (flag_force_mem)
- from = force_not_mem (from);
-
- if (fmode != GET_MODE (from))
- from = convert_to_mode (fmode, from, 0);
-
- /* See if we need to do the subtraction. */
- do_pending_stack_adjust ();
- emit_cmp_insn (from, limit, GE, NULL_RTX, GET_MODE (from), 0, 0);
- emit_jump_insn (gen_bge (lab1));
-
- /* If not, do the signed "fix" and branch around fixup code. */
- expand_fix (to, from, 0);
- emit_jump_insn (gen_jump (lab2));
- emit_barrier ();
-
- /* Otherwise, subtract 2**(N-1), convert to signed number,
- then add 2**(N-1). Do the addition using XOR since this
- will often generate better code. */
- emit_label (lab1);
- target = expand_binop (GET_MODE (from), sub_optab, from, limit,
- NULL_RTX, 0, OPTAB_LIB_WIDEN);
- expand_fix (to, target, 0);
- target = expand_binop (GET_MODE (to), xor_optab, to,
- GEN_INT ((HOST_WIDE_INT) 1 << (bitsize - 1)),
- to, 1, OPTAB_LIB_WIDEN);
-
- if (target != to)
- emit_move_insn (to, target);
-
- emit_label (lab2);
-
- if (mov_optab->handlers[(int) GET_MODE (to)].insn_code
- != CODE_FOR_nothing)
- {
- /* Make a place for a REG_NOTE and add it. */
- insn = emit_move_insn (to, to);
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
- gen_rtx (UNSIGNED_FIX, GET_MODE (to),
- copy_rtx (from)),
- REG_NOTES (insn));
- }
- return;
- }
-#endif
-
- /* We can't do it with an insn, so use a library call. But first ensure
- that the mode of TO is at least as wide as SImode, since those are the
- only library calls we know about. */
-
- if (GET_MODE_SIZE (GET_MODE (to)) < GET_MODE_SIZE (SImode))
- {
- target = gen_reg_rtx (SImode);
-
- expand_fix (target, from, unsignedp);
- }
- else if (GET_MODE (from) == SFmode)
- {
- if (GET_MODE (to) == SImode)
- libfcn = unsignedp ? fixunssfsi_libfunc : fixsfsi_libfunc;
- else if (GET_MODE (to) == DImode)
- libfcn = unsignedp ? fixunssfdi_libfunc : fixsfdi_libfunc;
- else if (GET_MODE (to) == TImode)
- libfcn = unsignedp ? fixunssfti_libfunc : fixsfti_libfunc;
- else
- abort ();
- }
- else if (GET_MODE (from) == DFmode)
- {
- if (GET_MODE (to) == SImode)
- libfcn = unsignedp ? fixunsdfsi_libfunc : fixdfsi_libfunc;
- else if (GET_MODE (to) == DImode)
- libfcn = unsignedp ? fixunsdfdi_libfunc : fixdfdi_libfunc;
- else if (GET_MODE (to) == TImode)
- libfcn = unsignedp ? fixunsdfti_libfunc : fixdfti_libfunc;
- else
- abort ();
- }
- else if (GET_MODE (from) == XFmode)
- {
- if (GET_MODE (to) == SImode)
- libfcn = unsignedp ? fixunsxfsi_libfunc : fixxfsi_libfunc;
- else if (GET_MODE (to) == DImode)
- libfcn = unsignedp ? fixunsxfdi_libfunc : fixxfdi_libfunc;
- else if (GET_MODE (to) == TImode)
- libfcn = unsignedp ? fixunsxfti_libfunc : fixxfti_libfunc;
- else
- abort ();
- }
- else if (GET_MODE (from) == TFmode)
- {
- if (GET_MODE (to) == SImode)
- libfcn = unsignedp ? fixunstfsi_libfunc : fixtfsi_libfunc;
- else if (GET_MODE (to) == DImode)
- libfcn = unsignedp ? fixunstfdi_libfunc : fixtfdi_libfunc;
- else if (GET_MODE (to) == TImode)
- libfcn = unsignedp ? fixunstfti_libfunc : fixtfti_libfunc;
- else
- abort ();
- }
- else
- abort ();
-
- if (libfcn)
- {
- rtx insns;
- rtx value;
-
- to = protect_from_queue (to, 1);
- from = protect_from_queue (from, 0);
-
- if (flag_force_mem)
- from = force_not_mem (from);
-
- start_sequence ();
-
- value = emit_library_call_value (libfcn, NULL_RTX, 1, GET_MODE (to),
-
- 1, from, GET_MODE (from));
- insns = get_insns ();
- end_sequence ();
-
- emit_libcall_block (insns, target, value,
- gen_rtx (unsignedp ? UNSIGNED_FIX : FIX,
- GET_MODE (to), from));
- }
-
- if (target != to)
- {
- if (GET_MODE (to) == GET_MODE (target))
- emit_move_insn (to, target);
- else
- convert_move (to, target, 0);
- }
-}
-
-static optab
-init_optab (code)
- enum rtx_code code;
-{
- int i;
- optab op = (optab) xmalloc (sizeof (struct optab));
- op->code = code;
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- {
- op->handlers[i].insn_code = CODE_FOR_nothing;
- op->handlers[i].libfunc = 0;
- }
-
- if (code != UNKNOWN)
- code_to_optab[(int) code] = op;
-
- return op;
-}
-
-/* Initialize the libfunc fields of an entire group of entries in some
- optab. Each entry is set equal to a string consisting of a leading
- pair of underscores followed by a generic operation name followed by
- a mode name (downshifted to lower case) followed by a single character
- representing the number of operands for the given operation (which is
- usually one of the characters '2', '3', or '4').
-
- OPTABLE is the table in which libfunc fields are to be initialized.
- FIRST_MODE is the first machine mode index in the given optab to
- initialize.
- LAST_MODE is the last machine mode index in the given optab to
- initialize.
- OPNAME is the generic (string) name of the operation.
- SUFFIX is the character which specifies the number of operands for
- the given generic operation.
-*/
-
-static void
-init_libfuncs (optable, first_mode, last_mode, opname, suffix)
- register optab optable;
- register int first_mode;
- register int last_mode;
- register char *opname;
- register int suffix;
-{
- register int mode;
- register unsigned opname_len = strlen (opname);
-
- for (mode = first_mode; (int) mode <= (int) last_mode;
- mode = (enum machine_mode) ((int) mode + 1))
- {
- register char *mname = mode_name[(int) mode];
- register unsigned mname_len = strlen (mname);
- register char *libfunc_name
- = (char *) xmalloc (2 + opname_len + mname_len + 1 + 1);
- register char *p;
- register char *q;
-
- p = libfunc_name;
- *p++ = '_';
- *p++ = '_';
- for (q = opname; *q; )
- *p++ = *q++;
- for (q = mname; *q; q++)
- *p++ = tolower (*q);
- *p++ = suffix;
- *p++ = '\0';
- optable->handlers[(int) mode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, libfunc_name);
- }
-}
-
-/* Initialize the libfunc fields of an entire group of entries in some
- optab which correspond to all integer mode operations. The parameters
- have the same meaning as similarly named ones for the `init_libfuncs'
- routine. (See above). */
-
-static void
-init_integral_libfuncs (optable, opname, suffix)
- register optab optable;
- register char *opname;
- register int suffix;
-{
- init_libfuncs (optable, SImode, TImode, opname, suffix);
-}
-
-/* Initialize the libfunc fields of an entire group of entries in some
- optab which correspond to all real mode operations. The parameters
- have the same meaning as similarly named ones for the `init_libfuncs'
- routine. (See above). */
-
-static void
-init_floating_libfuncs (optable, opname, suffix)
- register optab optable;
- register char *opname;
- register int suffix;
-{
- init_libfuncs (optable, SFmode, TFmode, opname, suffix);
-}
-
-/* Initialize the libfunc fields of an entire group of entries in some
- optab which correspond to all complex floating modes. The parameters
- have the same meaning as similarly named ones for the `init_libfuncs'
- routine. (See above). */
-
-static void
-init_complex_libfuncs (optable, opname, suffix)
- register optab optable;
- register char *opname;
- register int suffix;
-{
- init_libfuncs (optable, SCmode, TCmode, opname, suffix);
-}
-
-/* Call this once to initialize the contents of the optabs
- appropriately for the current target machine. */
-
-void
-init_optabs ()
-{
- int i, j;
- enum insn_code *p;
-
- /* Start by initializing all tables to contain CODE_FOR_nothing. */
-
- for (p = fixtab[0][0];
- p < fixtab[0][0] + sizeof fixtab / sizeof (fixtab[0][0][0]);
- p++)
- *p = CODE_FOR_nothing;
-
- for (p = fixtrunctab[0][0];
- p < fixtrunctab[0][0] + sizeof fixtrunctab / sizeof (fixtrunctab[0][0][0]);
- p++)
- *p = CODE_FOR_nothing;
-
- for (p = floattab[0][0];
- p < floattab[0][0] + sizeof floattab / sizeof (floattab[0][0][0]);
- p++)
- *p = CODE_FOR_nothing;
-
- for (p = extendtab[0][0];
- p < extendtab[0][0] + sizeof extendtab / sizeof extendtab[0][0][0];
- p++)
- *p = CODE_FOR_nothing;
-
- for (i = 0; i < NUM_RTX_CODE; i++)
- setcc_gen_code[i] = CODE_FOR_nothing;
-
-#ifdef HAVE_conditional_move
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- movcc_gen_code[i] = CODE_FOR_nothing;
-#endif
-
- add_optab = init_optab (PLUS);
- sub_optab = init_optab (MINUS);
- smul_optab = init_optab (MULT);
- smul_highpart_optab = init_optab (UNKNOWN);
- umul_highpart_optab = init_optab (UNKNOWN);
- smul_widen_optab = init_optab (UNKNOWN);
- umul_widen_optab = init_optab (UNKNOWN);
- sdiv_optab = init_optab (DIV);
- sdivmod_optab = init_optab (UNKNOWN);
- udiv_optab = init_optab (UDIV);
- udivmod_optab = init_optab (UNKNOWN);
- smod_optab = init_optab (MOD);
- umod_optab = init_optab (UMOD);
- flodiv_optab = init_optab (DIV);
- ftrunc_optab = init_optab (UNKNOWN);
- and_optab = init_optab (AND);
- ior_optab = init_optab (IOR);
- xor_optab = init_optab (XOR);
- ashl_optab = init_optab (ASHIFT);
- ashr_optab = init_optab (ASHIFTRT);
- lshr_optab = init_optab (LSHIFTRT);
- rotl_optab = init_optab (ROTATE);
- rotr_optab = init_optab (ROTATERT);
- smin_optab = init_optab (SMIN);
- smax_optab = init_optab (SMAX);
- umin_optab = init_optab (UMIN);
- umax_optab = init_optab (UMAX);
- mov_optab = init_optab (UNKNOWN);
- movstrict_optab = init_optab (UNKNOWN);
- cmp_optab = init_optab (UNKNOWN);
- ucmp_optab = init_optab (UNKNOWN);
- tst_optab = init_optab (UNKNOWN);
- neg_optab = init_optab (NEG);
- abs_optab = init_optab (ABS);
- one_cmpl_optab = init_optab (NOT);
- ffs_optab = init_optab (FFS);
- sqrt_optab = init_optab (SQRT);
- sin_optab = init_optab (UNKNOWN);
- cos_optab = init_optab (UNKNOWN);
- strlen_optab = init_optab (UNKNOWN);
-
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- {
- movstr_optab[i] = CODE_FOR_nothing;
- clrstr_optab[i] = CODE_FOR_nothing;
-
-#ifdef HAVE_SECONDARY_RELOADS
- reload_in_optab[i] = reload_out_optab[i] = CODE_FOR_nothing;
-#endif
- }
-
- /* Fill in the optabs with the insns we support. */
- init_all_optabs ();
-
-#ifdef FIXUNS_TRUNC_LIKE_FIX_TRUNC
- /* This flag says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
- for (i = 0; i < NUM_MACHINE_MODES; i++)
- for (j = 0; j < NUM_MACHINE_MODES; j++)
- fixtrunctab[i][j][1] = fixtrunctab[i][j][0];
-#endif
-
-#ifdef EXTRA_CC_MODES
- init_mov_optab ();
-#endif
-
- /* Initialize the optabs with the names of the library functions. */
- init_integral_libfuncs (add_optab, "add", '3');
- init_floating_libfuncs (add_optab, "add", '3');
- init_integral_libfuncs (sub_optab, "sub", '3');
- init_floating_libfuncs (sub_optab, "sub", '3');
- init_integral_libfuncs (smul_optab, "mul", '3');
- init_floating_libfuncs (smul_optab, "mul", '3');
- init_integral_libfuncs (sdiv_optab, "div", '3');
- init_integral_libfuncs (udiv_optab, "udiv", '3');
- init_integral_libfuncs (sdivmod_optab, "divmod", '4');
- init_integral_libfuncs (udivmod_optab, "udivmod", '4');
- init_integral_libfuncs (smod_optab, "mod", '3');
- init_integral_libfuncs (umod_optab, "umod", '3');
- init_floating_libfuncs (flodiv_optab, "div", '3');
- init_floating_libfuncs (ftrunc_optab, "ftrunc", '2');
- init_integral_libfuncs (and_optab, "and", '3');
- init_integral_libfuncs (ior_optab, "ior", '3');
- init_integral_libfuncs (xor_optab, "xor", '3');
- init_integral_libfuncs (ashl_optab, "ashl", '3');
- init_integral_libfuncs (ashr_optab, "ashr", '3');
- init_integral_libfuncs (lshr_optab, "lshr", '3');
- init_integral_libfuncs (smin_optab, "min", '3');
- init_floating_libfuncs (smin_optab, "min", '3');
- init_integral_libfuncs (smax_optab, "max", '3');
- init_floating_libfuncs (smax_optab, "max", '3');
- init_integral_libfuncs (umin_optab, "umin", '3');
- init_integral_libfuncs (umax_optab, "umax", '3');
- init_integral_libfuncs (neg_optab, "neg", '2');
- init_floating_libfuncs (neg_optab, "neg", '2');
- init_integral_libfuncs (one_cmpl_optab, "one_cmpl", '2');
- init_integral_libfuncs (ffs_optab, "ffs", '2');
-
- /* Comparison libcalls for integers MUST come in pairs, signed/unsigned. */
- init_integral_libfuncs (cmp_optab, "cmp", '2');
- init_integral_libfuncs (ucmp_optab, "ucmp", '2');
- init_floating_libfuncs (cmp_optab, "cmp", '2');
-
-#ifdef MULSI3_LIBCALL
- smul_optab->handlers[(int) SImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, MULSI3_LIBCALL);
-#endif
-#ifdef MULDI3_LIBCALL
- smul_optab->handlers[(int) DImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, MULDI3_LIBCALL);
-#endif
-
-#ifdef DIVSI3_LIBCALL
- sdiv_optab->handlers[(int) SImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, DIVSI3_LIBCALL);
-#endif
-#ifdef DIVDI3_LIBCALL
- sdiv_optab->handlers[(int) DImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, DIVDI3_LIBCALL);
-#endif
-
-#ifdef UDIVSI3_LIBCALL
- udiv_optab->handlers[(int) SImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, UDIVSI3_LIBCALL);
-#endif
-#ifdef UDIVDI3_LIBCALL
- udiv_optab->handlers[(int) DImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, UDIVDI3_LIBCALL);
-#endif
-
-#ifdef MODSI3_LIBCALL
- smod_optab->handlers[(int) SImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, MODSI3_LIBCALL);
-#endif
-#ifdef MODDI3_LIBCALL
- smod_optab->handlers[(int) DImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, MODDI3_LIBCALL);
-#endif
-
-#ifdef UMODSI3_LIBCALL
- umod_optab->handlers[(int) SImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, UMODSI3_LIBCALL);
-#endif
-#ifdef UMODDI3_LIBCALL
- umod_optab->handlers[(int) DImode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, UMODDI3_LIBCALL);
-#endif
-
- /* Use cabs for DC complex abs, since systems generally have cabs.
- Don't define any libcall for SCmode, so that cabs will be used. */
- abs_optab->handlers[(int) DCmode].libfunc
- = gen_rtx (SYMBOL_REF, Pmode, "cabs");
-
- /* The ffs function operates on `int'. */
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
- ffs_optab->handlers[(int) mode_for_size (INT_TYPE_SIZE, MODE_INT, 0)] .libfunc
- = gen_rtx (SYMBOL_REF, Pmode, "ffs");
-
- extendsfdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__extendsfdf2");
- extendsfxf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__extendsfxf2");
- extendsftf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__extendsftf2");
- extenddfxf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__extenddfxf2");
- extenddftf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__extenddftf2");
-
- truncdfsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__truncdfsf2");
- truncxfsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__truncxfsf2");
- trunctfsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__trunctfsf2");
- truncxfdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__truncxfdf2");
- trunctfdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__trunctfdf2");
-
- memcpy_libfunc = gen_rtx (SYMBOL_REF, Pmode, "memcpy");
- bcopy_libfunc = gen_rtx (SYMBOL_REF, Pmode, "bcopy");
- memcmp_libfunc = gen_rtx (SYMBOL_REF, Pmode, "memcmp");
- bcmp_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gcc_bcmp");
- memset_libfunc = gen_rtx (SYMBOL_REF, Pmode, "memset");
- bzero_libfunc = gen_rtx (SYMBOL_REF, Pmode, "bzero");
-
- throw_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__throw");
-
- eqhf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__eqhf2");
- nehf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__nehf2");
- gthf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gthf2");
- gehf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gehf2");
- lthf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__lthf2");
- lehf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__lehf2");
-
- eqsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__eqsf2");
- nesf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__nesf2");
- gtsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gtsf2");
- gesf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gesf2");
- ltsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__ltsf2");
- lesf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__lesf2");
-
- eqdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__eqdf2");
- nedf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__nedf2");
- gtdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gtdf2");
- gedf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gedf2");
- ltdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__ltdf2");
- ledf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__ledf2");
-
- eqxf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__eqxf2");
- nexf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__nexf2");
- gtxf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gtxf2");
- gexf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gexf2");
- ltxf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__ltxf2");
- lexf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__lexf2");
-
- eqtf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__eqtf2");
- netf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__netf2");
- gttf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__gttf2");
- getf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__getf2");
- lttf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__lttf2");
- letf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__letf2");
-
- floatsisf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floatsisf");
- floatdisf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floatdisf");
- floattisf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floattisf");
-
- floatsidf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floatsidf");
- floatdidf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floatdidf");
- floattidf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floattidf");
-
- floatsixf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floatsixf");
- floatdixf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floatdixf");
- floattixf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floattixf");
-
- floatsitf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floatsitf");
- floatditf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floatditf");
- floattitf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__floattitf");
-
- fixsfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixsfsi");
- fixsfdi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixsfdi");
- fixsfti_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixsfti");
-
- fixdfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixdfsi");
- fixdfdi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixdfdi");
- fixdfti_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixdfti");
-
- fixxfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixxfsi");
- fixxfdi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixxfdi");
- fixxfti_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixxfti");
-
- fixtfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixtfsi");
- fixtfdi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixtfdi");
- fixtfti_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixtfti");
-
- fixunssfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunssfsi");
- fixunssfdi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunssfdi");
- fixunssfti_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunssfti");
-
- fixunsdfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunsdfsi");
- fixunsdfdi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunsdfdi");
- fixunsdfti_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunsdfti");
-
- fixunsxfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunsxfsi");
- fixunsxfdi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunsxfdi");
- fixunsxfti_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunsxfti");
-
- fixunstfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunstfsi");
- fixunstfdi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunstfdi");
- fixunstfti_libfunc = gen_rtx (SYMBOL_REF, Pmode, "__fixunstfti");
-
-#ifdef INIT_TARGET_OPTABS
- /* Allow the target to add more libcalls or rename some, etc. */
- INIT_TARGET_OPTABS;
-#endif
-}
-
-#ifdef BROKEN_LDEXP
-
-/* SCO 3.2 apparently has a broken ldexp. */
-
-double
-ldexp(x,n)
- double x;
- int n;
-{
- if (n > 0)
- while (n--)
- x *= 2;
-
- return x;
-}
-#endif /* BROKEN_LDEXP */
diff --git a/gcc/output.h b/gcc/output.h
deleted file mode 100644
index 8722b647590..00000000000
--- a/gcc/output.h
+++ /dev/null
@@ -1,431 +0,0 @@
-/* Declarations for insn-output.c. These functions are defined in recog.c,
- final.c, and varasm.c.
- Copyright (C) 1987, 1991, 1994 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. */
-
-/* Initialize data in final at the beginning of a compilation. */
-extern void init_final PROTO((char *));
-
-/* Called at end of source file,
- to output the block-profiling table for this entire compilation. */
-extern void end_final PROTO((char *));
-
-/* Enable APP processing of subsequent output.
- Used before the output from an `asm' statement. */
-extern void app_enable PROTO((void));
-
-/* Disable APP processing of subsequent output.
- Called from varasm.c before most kinds of output. */
-extern void app_disable PROTO((void));
-
-/* Return the number of slots filled in the current
- delayed branch sequence (we don't count the insn needing the
- delay slot). Zero if not in a delayed branch sequence. */
-extern int dbr_sequence_length PROTO((void));
-
-/* Indicate that branch shortening hasn't yet been done. */
-extern void init_insn_lengths PROTO((void));
-
-#ifdef RTX_CODE
-/* Obtain the current length of an insn. If branch shortening has been done,
- get its actual length. Otherwise, get its maximum length. */
-extern int get_attr_length PROTO((rtx));
-
-/* Make a pass over all insns and compute their actual lengths by shortening
- any branches of variable length if possible. */
-extern void shorten_branches PROTO((rtx));
-
-/* Output assembler code for the start of a function,
- and initialize some of the variables in this file
- for the new function. The label for the function and associated
- assembler pseudo-ops have already been output in
- `assemble_start_function'. */
-extern void final_start_function STDIO_PROTO((rtx, FILE *, int));
-
-/* Output assembler code for the end of a function.
- For clarity, args are same as those of `final_start_function'
- even though not all of them are needed. */
-extern void final_end_function STDIO_PROTO((rtx, FILE *, int));
-
-/* Output assembler code for some insns: all or part of a function. */
-extern void final STDIO_PROTO((rtx, FILE *, int, int));
-
-/* The final scan for one insn, INSN. Args are same as in `final', except
- that INSN is the insn being scanned. Value returned is the next insn to
- be scanned. */
-extern rtx final_scan_insn STDIO_PROTO((rtx, FILE *, int, int, int));
-
-/* Replace a SUBREG with a REG or a MEM, based on the thing it is a
- subreg of. */
-extern rtx alter_subreg PROTO((rtx));
-
-/* Report inconsistency between the assembler template and the operands.
- In an `asm', it's the user's fault; otherwise, the compiler's fault. */
-extern void output_operand_lossage PROTO((char *));
-
-/* Output a string of assembler code, substituting insn operands.
- Defined in final.c. */
-extern void output_asm_insn PROTO((char *, rtx *));
-
-/* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */
-extern void output_asm_label PROTO((rtx));
-
-/* Print a memory reference operand for address X
- using machine-dependent assembler syntax. */
-extern void output_address PROTO((rtx));
-
-/* Print an integer constant expression in assembler syntax.
- Addition and subtraction are the only arithmetic
- that may appear in these expressions. */
-extern void output_addr_const STDIO_PROTO((FILE *, rtx));
-
-/* Output a string of assembler code, substituting numbers, strings
- and fixed syntactic prefixes. */
-extern void asm_fprintf STDIO_PROTO(PVPROTO((FILE *file,
- char *p, ...)));
-
-/* Split up a CONST_DOUBLE or integer constant rtx into two rtx's for single
- words. */
-extern void split_double PROTO((rtx, rtx *, rtx *));
-
-/* Return nonzero if this function has no function calls. */
-extern int leaf_function_p PROTO((void));
-
-/* Return 1 if this function uses only the registers that can be
- safely renumbered. */
-extern int only_leaf_regs_used PROTO((void));
-
-/* Scan IN_RTX and its subexpressions, and renumber all regs into those
- available in leaf functions. */
-extern void leaf_renumber_regs_insn PROTO((rtx));
-#endif
-
-/* Functions in varasm.c. */
-
-/* Tell assembler to switch to text section. */
-extern void text_section PROTO((void));
-
-/* Tell assembler to switch to data section. */
-extern void data_section PROTO((void));
-
-/* Tell assembler to switch to read-only data section. This is normally
- the text section. */
-extern void readonly_data_section PROTO((void));
-
-/* Determine if we're in the text section. */
-extern int in_text_section PROTO((void));
-
-#ifdef TREE_CODE
-/* Tell assembler to change to section NAME for DECL.
- If DECL is NULL, just switch to section NAME.
- If NAME is NULL, get the name from DECL. */
-extern void named_section PROTO((tree, char *));
-
-/* Tell assembler to switch to the section for function DECL. */
-extern void function_section PROTO((tree));
-
-/* Tell assembler to switch to the section for the exception table. */
-extern void exception_section PROTO((void));
-
-/* Create the rtl to represent a function, for a function definition.
- DECL is a FUNCTION_DECL node which describes which function.
- The rtl is stored into DECL. */
-extern void make_function_rtl PROTO((tree));
-
-/* Decode an `asm' spec for a declaration as a register name.
- Return the register number, or -1 if nothing specified,
- or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized,
- or -3 if ASMSPEC is `cc' and is not recognized,
- or -4 if ASMSPEC is `memory' and is not recognized.
- Accept an exact spelling or a decimal number.
- Prefixes such as % are optional. */
-extern int decode_reg_name PROTO((char *));
-
-/* Create the DECL_RTL for a declaration for a static or external variable
- or static or external function.
- ASMSPEC, if not 0, is the string which the user specified
- as the assembler symbol name.
- TOP_LEVEL is nonzero if this is a file-scope variable.
-
- This is never called for PARM_DECL nodes. */
-extern void make_decl_rtl PROTO((tree, char *, int));
-
-/* Make the rtl for variable VAR be volatile.
- Use this only for static variables. */
-extern void make_var_volatile PROTO((tree));
-
-/* Output alignment directive to align for constant expression EXP. */
-extern void assemble_constant_align PROTO((tree));
-
-/* Output a string of literal assembler code
- for an `asm' keyword used between functions. */
-extern void assemble_asm PROTO((tree));
-
-/* Record an element in the table of global destructors.
- How this is done depends on what sort of assembler and linker
- are in use.
-
- NAME should be the name of a global function to be called
- at exit time. This name is output using assemble_name. */
-extern void assemble_destructor PROTO((char *));
-
-/* Likewise for global constructors. */
-extern void assemble_constructor PROTO((char *));
-
-/* Likewise for entries we want to record for garbage collection.
- Garbage collection is still under development. */
-extern void assemble_gc_entry PROTO((char *));
-
-/* Output assembler code for the constant pool of a function and associated
- with defining the name of the function. DECL describes the function.
- NAME is the function's name. For the constant pool, we use the current
- constant pool data. */
-extern void assemble_start_function PROTO((tree, char *));
-
-/* Output assembler code associated with defining the size of the
- function. DECL describes the function. NAME is the function's name. */
-extern void assemble_end_function PROTO((tree, char *));
-
-/* Assemble code to leave SIZE bytes of zeros. */
-extern void assemble_zeros PROTO((int));
-
-/* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
-extern void assemble_align PROTO((int));
-
-/* Assemble a string constant with the specified C string as contents. */
-extern void assemble_string PROTO((char *, int));
-/* Assemble everything that is needed for a variable or function declaration.
- Not used for automatic variables, and not used for function definitions.
- Should not be called for variables of incomplete structure type.
-
- TOP_LEVEL is nonzero if this variable has file scope.
- AT_END is nonzero if this is the special handling, at end of compilation,
- to define things that have had only tentative definitions.
- DONT_OUTPUT_DATA if nonzero means don't actually output the
- initial value (that will be done by the caller). */
-extern void assemble_variable PROTO((tree, int, int, int));
-
-/* Output text storage for constructor CONSTR. */
-extern void bc_output_constructor PROTO((tree, int));
-
-/* Create storage for constructor CONSTR. */
-extern void bc_output_data_constructor PROTO((tree));
-
-/* Output something to declare an external symbol to the assembler.
- (Most assemblers don't need this, so we normally output nothing.)
- Do nothing if DECL is not external. */
-extern void assemble_external PROTO((tree));
-#endif
-
-#ifdef RTX_CODE
-/* Similar, for calling a library function FUN. */
-extern void assemble_external_libcall PROTO((rtx));
-#endif
-
-/* Declare the label NAME global. */
-extern void assemble_global PROTO((char *));
-
-/* Assemble a label named NAME. */
-extern void assemble_label PROTO((char *));
-
-/* Output to FILE a reference to the assembler name of a C-level name NAME.
- If NAME starts with a *, the rest of NAME is output verbatim.
- Otherwise NAME is transformed in an implementation-defined way
- (usually by the addition of an underscore).
- Many macros in the tm file are defined to call this function. */
-extern void assemble_name STDIO_PROTO((FILE *, char *));
-
-#ifdef RTX_CODE
-/* Assemble the integer constant X into an object of SIZE bytes.
- X must be either a CONST_INT or CONST_DOUBLE.
-
- Return 1 if we were able to output the constant, otherwise 0. If FORCE is
- non-zero, abort if we can't output the constant. */
-extern int assemble_integer PROTO((rtx, int, int));
-
-#ifdef EMUSHORT
-/* Assemble the floating-point constant D into an object of size MODE. */
-extern void assemble_real PROTO((REAL_VALUE_TYPE,
- enum machine_mode));
-#endif
-#endif
-
-/* At the end of a function, forget the memory-constants
- previously made for CONST_DOUBLEs. Mark them as not on real_constant_chain.
- Also clear out real_constant_chain and clear out all the chain-pointers. */
-extern void clear_const_double_mem PROTO((void));
-
-/* Start deferring output of subconstants. */
-extern void defer_addressed_constants PROTO((void));
-
-/* Stop deferring output of subconstants,
- and output now all those that have been deferred. */
-extern void output_deferred_addressed_constants PROTO((void));
-
-/* Initialize constant pool hashing for next function. */
-extern void init_const_rtx_hash_table PROTO((void));
-
-/* Return the size of the constant pool. */
-extern int get_pool_size PROTO((void));
-
-#ifdef TREE_CODE
-/* Write all the constants in the constant pool. */
-extern void output_constant_pool PROTO((char *, tree));
-
-/* Output assembler code for constant EXP to FILE, with no label.
- This includes the pseudo-op such as ".int" or ".byte", and a newline.
- Assumes output_addressed_constants has been done on EXP already.
-
- Generate exactly SIZE bytes of assembler data, padding at the end
- with zeros if necessary. SIZE must always be specified. */
-extern void output_constant PROTO((tree, int));
-#endif
-
-/* When outputting assembler code, indicates which alternative
- of the constraints was actually satisfied. */
-extern int which_alternative;
-
-#ifdef RTX_CODE
-/* When outputting delayed branch sequences, this rtx holds the
- sequence being output. It is null when no delayed branch
- sequence is being output, so it can be used as a test in the
- insn output code.
-
- This variable is defined in final.c. */
-extern rtx final_sequence;
-#endif
-
-/* Number of bytes of args popped by function being compiled on its return.
- Zero if no bytes are to be popped.
- May affect compilation of return insn or of function epilogue. */
-
-extern int current_function_pops_args;
-
-/* Nonzero if function being compiled needs to be given an address
- where the value should be stored. */
-
-extern int current_function_returns_struct;
-
-/* Nonzero if function being compiled needs to
- return the address of where it has put a structure value. */
-
-extern int current_function_returns_pcc_struct;
-
-/* Nonzero if function being compiled needs to be passed a static chain. */
-
-extern int current_function_needs_context;
-
-/* Nonzero if function being compiled can call setjmp. */
-
-extern int current_function_calls_setjmp;
-
-/* Nonzero if function being compiled can call longjmp. */
-
-extern int current_function_calls_longjmp;
-
-/* Nonzero if function being compiled can call alloca,
- either as a subroutine or builtin. */
-
-extern int current_function_calls_alloca;
-
-/* Nonzero if function being compiled receives nonlocal gotos
- from nested functions. */
-
-extern int current_function_has_nonlocal_label;
-
-/* Nonzero if function being compiled contains nested functions. */
-
-extern int current_function_contains_functions;
-
-/* Nonzero if the current function returns a pointer type */
-
-extern int current_function_returns_pointer;
-
-/* If function's args have a fixed size, this is that size, in bytes.
- Otherwise, it is -1.
- May affect compilation of return insn or of function epilogue. */
-
-extern int current_function_args_size;
-
-/* # bytes the prologue should push and pretend that the caller pushed them.
- The prologue must do this, but only if parms can be passed in registers. */
-
-extern int current_function_pretend_args_size;
-
-/* # of bytes of outgoing arguments required to be pushed by the prologue.
- If this is non-zero, it means that ACCUMULATE_OUTGOING_ARGS was defined
- and no stack adjusts will be done on function calls. */
-
-extern int current_function_outgoing_args_size;
-
-/* Nonzero if current function uses varargs.h or equivalent.
- Zero for functions that use stdarg.h. */
-
-extern int current_function_varargs;
-
-/* Nonzero if current function uses stdarg.h or equivalent.
- Zero for functions that use varargs.h. */
-
-extern int current_function_stdarg;
-
-/* Quantities of various kinds of registers
- used for the current function's args. */
-
-extern CUMULATIVE_ARGS current_function_args_info;
-
-/* Name of function now being compiled. */
-
-extern char *current_function_name;
-
-#ifdef RTX_CODE
-/* If non-zero, an RTL expression for that location at which the current
- function returns its result. Usually equal to
- DECL_RTL (DECL_RESULT (current_function_decl)). */
-
-extern rtx current_function_return_rtx;
-
-/* If some insns can be deferred to the delay slots of the epilogue, the
- delay list for them is recorded here. */
-
-extern rtx current_function_epilogue_delay_list;
-#endif
-
-/* Nonzero means generate position-independent code.
- This is not fully implemented yet. */
-
-extern int flag_pic;
-
-/* This is nonzero if the current function uses pic_offset_table_rtx. */
-extern int current_function_uses_pic_offset_table;
-
-/* This is nonzero if the current function uses the constant pool. */
-extern int current_function_uses_const_pool;
-
-/* The line number of the beginning of the current function.
- sdbout.c needs this so that it can output relative linenumbers. */
-
-#ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers. */
-extern int sdb_begin_function_line;
-#endif
-
-/* File in which assembler code is being written. */
-
-#ifdef BUFSIZ
-extern FILE *asm_out_file;
-#endif
diff --git a/gcc/pcp.h b/gcc/pcp.h
deleted file mode 100644
index 280a65ec35d..00000000000
--- a/gcc/pcp.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* pcp.h -- Describes the format of a precompiled file
- Copyright (C) 1990 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. */
-
-
-
-/* Structure allocated for every string in a precompiled file */
-typedef struct stringdef STRINGDEF;
-struct stringdef
-{
- U_CHAR *contents; /* String to include */
- int len; /* Its length */
- int writeflag; /* Whether we write this */
- int lineno; /* Linenumber of source file */
- U_CHAR *filename; /* Name of source file */
- STRINGDEF *chain; /* Global list of strings in natural order */
- int output_mark; /* Where in the output this goes */
-};
-
-typedef struct keydef KEYDEF;
-struct keydef
-{
- STRINGDEF *str;
- KEYDEF *chain;
-};
-
-/* Format: */
-/* A precompiled file starts with a series of #define and #undef
- statements:
- #define MAC DEF --- Indicates MAC must be defined with defn DEF
- #define MAC --- Indicates MAC must be defined with any defn
- #undef MAC --- Indicates MAC cannot be defined
-
-These preconditions must be true for a precompiled file to be used.
-The preconditions section is null terminated. */
-
-/* Then, there is a four byte number (in network byte order) which */
- /* indicates the number of strings the file contains. */
-
-/* Each string contains a STRINGDEF structure. The only component of */
- /* the STRINGDEF structure which is used is the lineno field, which */
- /* should hold the line number in the original header file. */
- /* Then follows the string, followed by a null. Then comes a four */
- /* byte number (again, in network byte order) indicating the number */
- /* of keys for this string. Each key is a KEYDEF structure, with */
- /* irrelevant contents, followed by the null-terminated string. */
-
-/* If the number of keys is 0, then there are no keys for the string, */
- /* in other words, the string will never be included. If the number */
- /* of keys is -1, this is a special flag indicating there are no keys */
- /* in the file, and the string is mandatory (that is, it must be */
- /* included regardless in the included output). */
-
-/* A file, then, looks like this:
-
- Precondition 1
- Precondition 2
- .
- .
- .
- <NUL>
- Number of strings
- STRINGDEF
- String . . . <NUL>
- Number of keys
- KEYDEF
- Key . . . <NUL>
- KEYDEF
- Key . . . <NUL>
- .
- .
- .
- STRINGDEF
- String . . . <NUL>
- Number of keys
- KEYDEF
- Key . . . <NUL>
- .
- .
- .
- .
- .
- .
-
-*/
diff --git a/gcc/pexecute.c b/gcc/pexecute.c
deleted file mode 100644
index 174bbd49605..00000000000
--- a/gcc/pexecute.c
+++ /dev/null
@@ -1,589 +0,0 @@
-/* Utilities to execute a program in a subprocess (possibly linked by pipes
- with other subprocesses), and wait for it.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This file exports two functions: pexecute and pwait. */
-
-/* This file lives in at least two places: libiberty and gcc.
- Don't change one without the other. */
-
-#include <stdio.h>
-#include <errno.h>
-
-#ifdef IN_GCC
-#include "config.h"
-#include "gansidecl.h"
-/* ??? Need to find a suitable header file. */
-#define PEXECUTE_FIRST 1
-#define PEXECUTE_LAST 2
-#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST)
-#define PEXECUTE_SEARCH 4
-#define PEXECUTE_VERBOSE 8
-#else
-#include "libiberty.h"
-#endif
-
-/* stdin file number. */
-#define STDIN_FILE_NO 0
-
-/* stdout file number. */
-#define STDOUT_FILE_NO 1
-
-/* value of `pipe': port index for reading. */
-#define READ_PORT 0
-
-/* value of `pipe': port index for writing. */
-#define WRITE_PORT 1
-
-static char *install_error_msg = "installation problem, cannot exec `%s'";
-
-/* pexecute: execute a program.
-
- PROGRAM and ARGV are the arguments to execv/execvp.
-
- THIS_PNAME is name of the calling program (i.e. argv[0]).
-
- TEMP_BASE is the path name, sans suffix, of a temporary file to use
- if needed. This is currently only needed for MSDOS ports that don't use
- GO32 (do any still exist?). Ports that don't need it can pass NULL.
-
- (FLAGS & PEXECUTE_SEARCH) is non-zero if $PATH should be searched
- (??? It's not clear that GCC passes this flag correctly).
- (FLAGS & PEXECUTE_FIRST) is nonzero for the first process in chain.
- (FLAGS & PEXECUTE_FIRST) is nonzero for the last process in chain.
- FIRST_LAST could be simplified to only mark the last of a chain of processes
- but that requires the caller to always mark the last one (and not give up
- early if some error occurs). It's more robust to require the caller to
- mark both ends of the chain.
-
- The result is the pid on systems like Unix where we fork/exec and on systems
- like WIN32 and OS2 where we use spawn. It is up to the caller to wait for
- the child.
-
- The result is the WEXITSTATUS on systems like MSDOS where we spawn and wait
- for the child here.
-
- Upon failure, ERRMSG_FMT and ERRMSG_ARG are set to the text of the error
- message with an optional argument (if not needed, ERRMSG_ARG is set to
- NULL), and -1 is returned. `errno' is available to the caller to use.
-
- pwait: cover function for wait.
-
- PID is the process id of the task to wait for.
- STATUS is the `status' argument to wait.
- FLAGS is currently unused (allows future enhancement without breaking
- upward compatibility). Pass 0 for now.
-
- The result is the pid of the child reaped,
- or -1 for failure (errno says why).
-
- On systems that don't support waiting for a particular child, PID is
- ignored. On systems like MSDOS that don't really multitask pwait
- is just a mechanism to provide a consistent interface for the caller.
-
- pfinish: finish generation of script
-
- pfinish is necessary for systems like MPW where a script is generated that
- runs the requested programs.
-*/
-
-#ifdef __MSDOS__
-
-/* MSDOS doesn't multitask, but for the sake of a consistent interface
- the code behaves like it does. pexecute runs the program, tucks the
- exit code away, and returns a "pid". pwait must be called to fetch the
- exit code. */
-
-#include <process.h>
-
-/* For communicating information from pexecute to pwait. */
-static int last_pid = 0;
-static int last_status = 0;
-static int last_reaped = 0;
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int rc;
-
- last_pid++;
- if (last_pid < 0)
- last_pid = 1;
-
- if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
- abort ();
-
-#ifdef __GO32__
- /* ??? What are the possible return values from spawnv? */
- rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv);
-#else
- char *scmd, *rf;
- FILE *argfile;
- int i, el = flags & PEXECUTE_SEARCH ? 4 : 0;
-
- scmd = (char *) xmalloc (strlen (program) + strlen (temp_base) + 6 + el);
- rf = scmd + strlen(program) + 2 + el;
- sprintf (scmd, "%s%s @%s.gp", program,
- (flags & PEXECUTE_SEARCH ? ".exe" : ""), temp_base);
- argfile = fopen (rf, "w");
- if (argfile == 0)
- {
- int errno_save = errno;
- free (scmd);
- errno = errno_save;
- *errmsg_fmt = "cannot open `%s.gp'";
- *errmsg_arg = temp_base;
- return -1;
- }
-
- for (i=1; argv[i]; i++)
- {
- char *cp;
- for (cp = argv[i]; *cp; cp++)
- {
- if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp))
- fputc ('\\', argfile);
- fputc (*cp, argfile);
- }
- fputc ('\n', argfile);
- }
- fclose (argfile);
-
- rc = system (scmd);
-
- {
- int errno_save = errno;
- remove (rf);
- free (scmd);
- errno = errno_save;
- }
-#endif
-
- if (rc == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = program;
- return -1;
- }
-
- /* Tuck the status away for pwait, and return a "pid". */
- last_status = rc << 8;
- return last_pid;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* On MSDOS each pexecute must be followed by it's associated pwait. */
- if (pid != last_pid
- /* Called twice for the same child? */
- || pid == last_reaped)
- {
- /* ??? ECHILD would be a better choice. Can we use it here? */
- errno = EINVAL;
- return -1;
- }
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
- *status = last_status;
- last_reaped = last_pid;
- return last_pid;
-}
-
-#endif /* MSDOS */
-
-#if defined (_WIN32)
-
-#include <process.h>
-extern int _spawnv ();
-extern int _spawnvp ();
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int pid;
-
- if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
- abort ();
- pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv) (_P_NOWAIT, program, argv);
- if (pid == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = program;
- return -1;
- }
- return pid;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
- return cwait (status, pid, WAIT_CHILD);
-}
-
-#endif /* _WIN32 */
-
-#ifdef OS2
-
-/* ??? Does OS2 have process.h? */
-extern int spawnv ();
-extern int spawnvp ();
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int pid;
-
- if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
- abort ();
- /* ??? Presumably 1 == _P_NOWAIT. */
- pid = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv);
- if (pid == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = program;
- return -1;
- }
- return pid;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
- int pid = wait (status);
- return pid;
-}
-
-#endif /* OS2 */
-
-#ifdef MPW
-
-/* MPW pexecute doesn't actually run anything; instead, it writes out
- script commands that, when run, will do the actual executing.
-
- For example, in GCC's case, GCC will write out several script commands:
-
- cpp ...
- cc1 ...
- as ...
- ld ...
-
- and then exit. None of the above programs will have run yet. The task
- that called GCC will then execute the script and cause cpp,etc. to run.
- The caller must invoke pfinish before calling exit. This adds
- the finishing touches to the generated script. */
-
-static int first_time = 1;
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- char tmpprogram[255];
- char *cp, *tmpname;
- int i;
-
- mpwify_filename (program, tmpprogram);
- if (first_time)
- {
- printf ("Set Failed 0\n");
- first_time = 0;
- }
-
- fputs ("If {Failed} == 0\n", stdout);
- /* If being verbose, output a copy of the command. It should be
- accurate enough and escaped enough to be "clickable". */
- if (flags & PEXECUTE_VERBOSE)
- {
- fputs ("\tEcho ", stdout);
- fputc ('\'', stdout);
- fputs (tmpprogram, stdout);
- fputc ('\'', stdout);
- fputc (' ', stdout);
- for (i=1; argv[i]; i++)
- {
- fputc ('\'', stdout);
- /* See if we have an argument that needs fixing. */
- if (strchr(argv[i], '/'))
- {
- tmpname = xmalloc (256);
- mpwify_filename (argv[i], tmpname);
- argv[i] = tmpname;
- }
- for (cp = argv[i]; *cp; cp++)
- {
- /* Write an Option-d escape char in front of special chars. */
- if (strchr("'+", *cp))
- fputc ('\266', stdout);
- fputc (*cp, stdout);
- }
- fputc ('\'', stdout);
- fputc (' ', stdout);
- }
- fputs ("\n", stdout);
- }
- fputs ("\t", stdout);
- fputs (tmpprogram, stdout);
- fputc (' ', stdout);
-
- for (i=1; argv[i]; i++)
- {
- /* See if we have an argument that needs fixing. */
- if (strchr(argv[i], '/'))
- {
- tmpname = xmalloc (256);
- mpwify_filename (argv[i], tmpname);
- argv[i] = tmpname;
- }
- if (strchr (argv[i], ' '))
- fputc ('\'', stdout);
- for (cp = argv[i]; *cp; cp++)
- {
- /* Write an Option-d escape char in front of special chars. */
- if (strchr("'+", *cp))
- fputc ('\266', stdout);
- fputc (*cp, stdout);
- }
- if (strchr (argv[i], ' '))
- fputc ('\'', stdout);
- fputc (' ', stdout);
- }
-
- fputs ("\n", stdout);
-
- /* Output commands that arrange to clean up and exit if a failure occurs.
- We have to be careful to collect the status from the program that was
- run, rather than some other script command. Also, we don't exit
- immediately, since necessary cleanups are at the end of the script. */
- fputs ("\tSet TmpStatus {Status}\n", stdout);
- fputs ("\tIf {TmpStatus} != 0\n", stdout);
- fputs ("\t\tSet Failed {TmpStatus}\n", stdout);
- fputs ("\tEnd\n", stdout);
- fputs ("End\n", stdout);
-
- /* We're just composing a script, can't fail here. */
- return 0;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- *status = 0;
- return 0;
-}
-
-/* Write out commands that will exit with the correct error code
- if something in the script failed. */
-
-void
-pfinish ()
-{
- printf ("\tExit \"{Failed}\"\n");
-}
-
-#endif /* MPW */
-
-/* include for Unix-like environments but not for Dos-like environments */
-#if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \
- && ! defined (_WIN32)
-
-#ifdef VMS
-#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \
- lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1)
-#else
-#ifdef USG
-#define vfork fork
-#endif
-#endif
-
-extern int execv ();
-extern int execvp ();
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int (*func)() = (flags & PEXECUTE_SEARCH ? execvp : execv);
- int pid;
- int pdes[2];
- int input_desc, output_desc;
- int retries, sleep_interval;
- /* Pipe waiting from last process, to be used as input for the next one.
- Value is STDIN_FILE_NO if no pipe is waiting
- (i.e. the next command is the first of a group). */
- static int last_pipe_input;
-
- /* If this is the first process, initialize. */
- if (flags & PEXECUTE_FIRST)
- last_pipe_input = STDIN_FILE_NO;
-
- input_desc = last_pipe_input;
-
- /* If this isn't the last process, make a pipe for its output,
- and record it as waiting to be the input to the next process. */
- if (! (flags & PEXECUTE_LAST))
- {
- if (pipe (pdes) < 0)
- {
- *errmsg_fmt = "pipe";
- *errmsg_arg = NULL;
- return -1;
- }
- output_desc = pdes[WRITE_PORT];
- last_pipe_input = pdes[READ_PORT];
- }
- else
- {
- /* Last process. */
- output_desc = STDOUT_FILE_NO;
- last_pipe_input = STDIN_FILE_NO;
- }
-
- /* Fork a subprocess; wait and retry if it fails. */
- sleep_interval = 1;
- for (retries = 0; retries < 4; retries++)
- {
- pid = vfork ();
- if (pid >= 0)
- break;
- sleep (sleep_interval);
- sleep_interval *= 2;
- }
-
- switch (pid)
- {
- case -1:
- {
-#ifdef vfork
- *errmsg_fmt = "fork";
-#else
- *errmsg_fmt = "vfork";
-#endif
- *errmsg_arg = NULL;
- return -1;
- }
-
- case 0: /* child */
- /* Move the input and output pipes into place, if necessary. */
- if (input_desc != STDIN_FILE_NO)
- {
- close (STDIN_FILE_NO);
- dup (input_desc);
- close (input_desc);
- }
- if (output_desc != STDOUT_FILE_NO)
- {
- close (STDOUT_FILE_NO);
- dup (output_desc);
- close (output_desc);
- }
-
- /* Close the parent's descs that aren't wanted here. */
- if (last_pipe_input != STDIN_FILE_NO)
- close (last_pipe_input);
-
- /* Exec the program. */
- (*func) (program, argv);
-
- /* Note: Calling fprintf and exit here doesn't seem right for vfork. */
- fprintf (stderr, "%s: ", this_pname);
- fprintf (stderr, install_error_msg, program);
-#ifdef IN_GCC
- fprintf (stderr, ": %s\n", my_strerror (errno));
-#else
- fprintf (stderr, ": %s\n", xstrerror (errno));
-#endif
- exit (-1);
- /* NOTREACHED */
- return 0;
-
- default:
- /* In the parent, after forking.
- Close the descriptors that we made for this child. */
- if (input_desc != STDIN_FILE_NO)
- close (input_desc);
- if (output_desc != STDOUT_FILE_NO)
- close (output_desc);
-
- /* Return child's process number. */
- return pid;
- }
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
-#ifdef VMS
- pid = waitpid (-1, status, 0);
-#else
- pid = wait (status);
-#endif
- return pid;
-}
-
-#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! _WIN32 */
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
deleted file mode 100644
index 7c268197a74..00000000000
--- a/gcc/print-rtl.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/* Print RTL for GNU C Compiler.
- Copyright (C) 1987, 1988, 1992 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. */
-
-
-#include "config.h"
-#include <ctype.h>
-#include <stdio.h>
-#include "rtl.h"
-
-
-/* How to print out a register name.
- We don't use PRINT_REG because some definitions of PRINT_REG
- don't work here. */
-#ifndef DEBUG_PRINT_REG
-#define DEBUG_PRINT_REG(RTX, CODE, FILE) \
- fprintf ((FILE), "%d %s", REGNO (RTX), reg_names[REGNO (RTX)])
-#endif
-
-/* Array containing all of the register names */
-
-#ifdef DEBUG_REGISTER_NAMES
-static char *reg_names[] = DEBUG_REGISTER_NAMES;
-#else
-static char *reg_names[] = REGISTER_NAMES;
-#endif
-
-static FILE *outfile;
-
-char spaces[] = " ";
-
-static int sawclose = 0;
-
-/* Names for patterns. Non-zero only when linked with insn-output.c. */
-
-extern char **insn_name_ptr;
-
-/* Print IN_RTX onto OUTFILE. This is the recursive part of printing. */
-
-static void
-print_rtx (in_rtx)
- register rtx in_rtx;
-{
- static int indent;
- register int i, j;
- register char *format_ptr;
- register int is_insn;
-
- if (sawclose)
- {
- fprintf (outfile, "\n%s",
- (spaces + (sizeof spaces - 1 - indent * 2)));
- sawclose = 0;
- }
-
- if (in_rtx == 0)
- {
- fprintf (outfile, "(nil)");
- sawclose = 1;
- return;
- }
-
- /* print name of expression code */
- fprintf (outfile, "(%s", GET_RTX_NAME (GET_CODE (in_rtx)));
-
- if (in_rtx->in_struct)
- fprintf (outfile, "/s");
-
- if (in_rtx->volatil)
- fprintf (outfile, "/v");
-
- if (in_rtx->unchanging)
- fprintf (outfile, "/u");
-
- if (in_rtx->integrated)
- fprintf (outfile, "/i");
-
- if (GET_MODE (in_rtx) != VOIDmode)
- {
- /* Print REG_NOTE names for EXPR_LIST and INSN_LIST. */
- if (GET_CODE (in_rtx) == EXPR_LIST || GET_CODE (in_rtx) == INSN_LIST)
- fprintf (outfile, ":%s", GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
- else
- fprintf (outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx)));
- }
-
- is_insn = (GET_RTX_CLASS (GET_CODE (in_rtx)) == 'i');
- format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (in_rtx)); i++)
- switch (*format_ptr++)
- {
- case 'S':
- case 's':
- if (i == 3 && GET_CODE (in_rtx) == NOTE
- && (NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_EH_REGION_BEG
- || NOTE_LINE_NUMBER (in_rtx) == NOTE_INSN_EH_REGION_END))
- {
- fprintf (outfile, " %d", NOTE_BLOCK_NUMBER (in_rtx));
- sawclose = 1;
- break;
- }
- if (XSTR (in_rtx, i) == 0)
- fprintf (outfile, " \"\"");
- else
- fprintf (outfile, " (\"%s\")", XSTR (in_rtx, i));
- sawclose = 1;
- break;
-
- /* 0 indicates a field for internal use that should not be printed. */
- case '0':
- break;
-
- case 'e':
- indent += 2;
- if (!sawclose)
- fprintf (outfile, " ");
- print_rtx (XEXP (in_rtx, i));
- indent -= 2;
- break;
-
- case 'E':
- case 'V':
- indent += 2;
- if (sawclose)
- {
- fprintf (outfile, "\n%s",
- (spaces + (sizeof spaces - 1 - indent * 2)));
- sawclose = 0;
- }
- fprintf (outfile, "[ ");
- if (NULL != XVEC (in_rtx, i))
- {
- indent += 2;
- if (XVECLEN (in_rtx, i))
- sawclose = 1;
-
- for (j = 0; j < XVECLEN (in_rtx, i); j++)
- print_rtx (XVECEXP (in_rtx, i, j));
-
- indent -= 2;
- }
- if (sawclose)
- fprintf (outfile, "\n%s",
- (spaces + (sizeof spaces - 1 - indent * 2)));
-
- fprintf (outfile, "] ");
- sawclose = 1;
- indent -= 2;
- break;
-
- case 'w':
- fprintf (outfile, " ");
- fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, XWINT (in_rtx, i));
- break;
-
- case 'i':
- {
- register int value = XINT (in_rtx, i);
-
- if (GET_CODE (in_rtx) == REG && value < FIRST_PSEUDO_REGISTER)
- {
- fputc (' ', outfile);
- DEBUG_PRINT_REG (in_rtx, 0, outfile);
- }
- else
- fprintf (outfile, " %d", value);
- }
- if (is_insn && &INSN_CODE (in_rtx) == &XINT (in_rtx, i)
- && insn_name_ptr
- && XINT (in_rtx, i) >= 0)
- fprintf (outfile, " {%s}", insn_name_ptr[XINT (in_rtx, i)]);
- sawclose = 0;
- break;
-
- /* Print NOTE_INSN names rather than integer codes. */
-
- case 'n':
- if (XINT (in_rtx, i) <= 0)
- fprintf (outfile, " %s", GET_NOTE_INSN_NAME (XINT (in_rtx, i)));
- else
- fprintf (outfile, " %d", XINT (in_rtx, i));
- sawclose = 0;
- break;
-
- case 'u':
- if (XEXP (in_rtx, i) != NULL)
- fprintf (outfile, " %d", INSN_UID (XEXP (in_rtx, i)));
- else
- fprintf (outfile, " 0");
- sawclose = 0;
- break;
-
- case '*':
- fprintf (outfile, " Unknown");
- sawclose = 0;
- break;
-
- default:
- fprintf (stderr,
- "switch format wrong in rtl.print_rtx(). format was: %c.\n",
- format_ptr[-1]);
- abort ();
- }
-
- fprintf (outfile, ")");
- sawclose = 1;
-}
-
-/* Call this function from the debugger to see what X looks like. */
-
-void
-debug_rtx (x)
- rtx x;
-{
- outfile = stderr;
- print_rtx (x);
- fprintf (stderr, "\n");
-}
-
-/* Count of rtx's to print with debug_rtx_list.
- This global exists because gdb user defined commands have no arguments. */
-
-int debug_rtx_count = 0; /* 0 is treated as equivalent to 1 */
-
-/* Call this function to print list from X on.
-
- N is a count of the rtx's to print. Positive values print from the specified
- rtx on. Negative values print a window around the rtx.
- EG: -5 prints 2 rtx's on either side (in addition to the specified rtx). */
-
-void
-debug_rtx_list (x, n)
- rtx x;
- int n;
-{
- int i,count;
- rtx insn;
-
- count = n == 0 ? 1 : n < 0 ? -n : n;
-
- /* If we are printing a window, back up to the start. */
-
- if (n < 0)
- for (i = count / 2; i > 0; i--)
- {
- if (PREV_INSN (x) == 0)
- break;
- x = PREV_INSN (x);
- }
-
- for (i = count, insn = x; i > 0 && insn != 0; i--, insn = NEXT_INSN (insn))
- debug_rtx (insn);
-}
-
-/* Call this function to search an rtx list to find one with insn uid UID,
- and then call debug_rtx_list to print it, using DEBUG_RTX_COUNT.
- The found insn is returned to enable further debugging analysis. */
-
-rtx
-debug_rtx_find(x, uid)
- rtx x;
- int uid;
-{
- while (x != 0 && INSN_UID (x) != uid)
- x = NEXT_INSN (x);
- if (x != 0)
- {
- debug_rtx_list (x, debug_rtx_count);
- return x;
- }
- else
- {
- fprintf (stderr, "insn uid %d not found\n", uid);
- return 0;
- }
-}
-
-/* External entry point for printing a chain of insns
- starting with RTX_FIRST onto file OUTF.
- A blank line separates insns.
-
- If RTX_FIRST is not an insn, then it alone is printed, with no newline. */
-
-void
-print_rtl (outf, rtx_first)
- FILE *outf;
- rtx rtx_first;
-{
- register rtx tmp_rtx;
-
- outfile = outf;
- sawclose = 0;
-
- if (rtx_first == 0)
- fprintf (outf, "(nil)\n");
- else
- switch (GET_CODE (rtx_first))
- {
- case INSN:
- case JUMP_INSN:
- case CALL_INSN:
- case NOTE:
- case CODE_LABEL:
- case BARRIER:
- for (tmp_rtx = rtx_first; NULL != tmp_rtx; tmp_rtx = NEXT_INSN (tmp_rtx))
- {
- print_rtx (tmp_rtx);
- fprintf (outfile, "\n");
- }
- break;
-
- default:
- print_rtx (rtx_first);
- }
-}
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
deleted file mode 100644
index 4949aec117a..00000000000
--- a/gcc/print-tree.c
+++ /dev/null
@@ -1,698 +0,0 @@
-/* Prints out tree in human readable form - GNU C-compiler
- Copyright (C) 1990, 91, 93, 94, 95, 1996 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. */
-
-
-#include "config.h"
-#include "tree.h"
-#include <stdio.h>
-
-extern char **tree_code_name;
-
-extern char *mode_name[];
-
-void print_node ();
-void indent_to ();
-
-/* Define the hash table of nodes already seen.
- Such nodes are not repeated; brief cross-references are used. */
-
-#define HASH_SIZE 37
-
-struct bucket
-{
- tree node;
- struct bucket *next;
-};
-
-static struct bucket **table;
-
-/* Print the node NODE on standard error, for debugging.
- Most nodes referred to by this one are printed recursively
- down to a depth of six. */
-
-void
-debug_tree (node)
- tree node;
-{
- char *object = (char *) oballoc (0);
-
- table = (struct bucket **) oballoc (HASH_SIZE * sizeof (struct bucket *));
- bzero ((char *) table, HASH_SIZE * sizeof (struct bucket *));
- print_node (stderr, "", node, 0);
- table = 0;
- obfree (object);
- fprintf (stderr, "\n");
-}
-
-/* Print a node in brief fashion, with just the code, address and name. */
-
-void
-print_node_brief (file, prefix, node, indent)
- FILE *file;
- char *prefix;
- tree node;
- int indent;
-{
- char class;
-
- if (node == 0)
- return;
-
- class = TREE_CODE_CLASS (TREE_CODE (node));
-
- /* Always print the slot this node is in, and its code, address and
- name if any. */
- if (indent > 0)
- fprintf (file, " ");
- fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]);
- fprintf (file, HOST_PTR_PRINTF, (HOST_WIDE_INT) node);
-
- if (class == 'd')
- {
- if (DECL_NAME (node))
- fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
- }
- else if (class == 't')
- {
- if (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))));
- }
- }
- if (TREE_CODE (node) == IDENTIFIER_NODE)
- fprintf (file, " %s", IDENTIFIER_POINTER (node));
- /* We might as well always print the value of an integer. */
- if (TREE_CODE (node) == INTEGER_CST)
- {
- if (TREE_CONSTANT_OVERFLOW (node))
- fprintf (file, " overflow");
-
- fprintf (file, " ");
- 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)
- {
- fprintf (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));
- }
- if (TREE_CODE (node) == REAL_CST)
- {
- REAL_VALUE_TYPE d;
-
- if (TREE_OVERFLOW (node))
- fprintf (file, " overflow");
-
-#if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
- d = TREE_REAL_CST (node);
- if (REAL_VALUE_ISINF (d))
- fprintf (file, " Inf");
- else if (REAL_VALUE_ISNAN (d))
- fprintf (file, " Nan");
- else
- {
- char string[100];
-
- REAL_VALUE_TO_DECIMAL (d, "%e", string);
- fprintf (file, " %s", string);
- }
-#else
- {
- int i;
- unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
- fprintf (file, " 0x");
- for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
- fprintf (file, "%02x", *p++);
- fprintf (file, "");
- }
-#endif
- }
-
- fprintf (file, ">");
-}
-
-void
-indent_to (file, column)
- FILE *file;
- int column;
-{
- int i;
-
- /* Since this is the long way, indent to desired column. */
- if (column > 0)
- fprintf (file, "\n");
- for (i = 0; i < column; i++)
- fprintf (file, " ");
-}
-
-/* Print the node NODE in full on file FILE, preceded by PREFIX,
- starting in column INDENT. */
-
-void
-print_node (file, prefix, node, indent)
- FILE *file;
- char *prefix;
- tree node;
- int indent;
-{
- int hash;
- struct bucket *b;
- enum machine_mode mode;
- char class;
- int len;
- int first_rtl;
- int i;
-
- if (node == 0)
- return;
-
- class = TREE_CODE_CLASS (TREE_CODE (node));
-
- /* Don't get too deep in nesting. If the user wants to see deeper,
- it is easy to use the address of a lowest-level node
- as an argument in another call to debug_tree. */
-
- if (indent > 24)
- {
- print_node_brief (file, prefix, node, indent);
- return;
- }
-
- if (indent > 8 && (class == 't' || class == 'd'))
- {
- print_node_brief (file, prefix, node, indent);
- return;
- }
-
- /* It is unsafe to look at any other filds of an ERROR_MARK node. */
- if (TREE_CODE (node) == ERROR_MARK)
- {
- print_node_brief (file, prefix, node, indent);
- return;
- }
-
- hash = ((unsigned HOST_WIDE_INT) 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)
- {
- print_node_brief (file, prefix, node, indent);
- return;
- }
-
- /* Add this node to the table. */
- b = (struct bucket *) oballoc (sizeof (struct bucket));
- b->node = node;
- b->next = table[hash];
- table[hash] = b;
-
- /* Indent to the specified column, since this is the long form. */
- indent_to (file, indent);
-
- /* Print the slot this node is in, and its code, and address. */
- fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]);
- fprintf (file, HOST_PTR_PRINTF, (HOST_WIDE_INT) node);
-
- /* Print the name, if any. */
- if (class == 'd')
- {
- if (DECL_NAME (node))
- fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
- }
- else if (class == 't')
- {
- if (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))));
- }
- }
- if (TREE_CODE (node) == IDENTIFIER_NODE)
- fprintf (file, " %s", IDENTIFIER_POINTER (node));
-
- if (TREE_CODE (node) == INTEGER_CST)
- {
- if (indent <= 4)
- print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
- }
- else
- {
- print_node (file, "type", TREE_TYPE (node), indent + 4);
- if (TREE_TYPE (node))
- indent_to (file, indent + 3);
-
- print_obstack_name ((char *) node, file, "");
- indent_to (file, indent + 3);
- }
-
- /* If a permanent object is in the wrong obstack, or the reverse, warn. */
- if (object_permanent_p (node) != TREE_PERMANENT (node))
- {
- if (TREE_PERMANENT (node))
- fputs (" !!permanent object in non-permanent obstack!!", file);
- else
- fputs (" !!non-permanent object in permanent obstack!!", file);
- indent_to (file, indent + 3);
- }
-
- if (TREE_SIDE_EFFECTS (node))
- fputs (" side-effects", file);
- if (TREE_READONLY (node))
- fputs (" readonly", file);
- if (TREE_CONSTANT (node))
- fputs (" constant", file);
- if (TREE_ADDRESSABLE (node))
- fputs (" addressable", file);
- if (TREE_THIS_VOLATILE (node))
- fputs (" volatile", file);
- if (TREE_UNSIGNED (node))
- fputs (" unsigned", file);
- if (TREE_ASM_WRITTEN (node))
- fputs (" asm_written", file);
- if (TREE_USED (node))
- fputs (" used", file);
- if (TREE_RAISES (node))
- fputs (" raises", file);
- if (TREE_PERMANENT (node))
- fputs (" permanent", file);
- if (TREE_PUBLIC (node))
- fputs (" public", file);
- if (TREE_STATIC (node))
- fputs (" static", file);
- if (TREE_LANG_FLAG_0 (node))
- fputs (" tree_0", file);
- if (TREE_LANG_FLAG_1 (node))
- fputs (" tree_1", file);
- if (TREE_LANG_FLAG_2 (node))
- fputs (" tree_2", file);
- if (TREE_LANG_FLAG_3 (node))
- fputs (" tree_3", file);
- if (TREE_LANG_FLAG_4 (node))
- fputs (" tree_4", file);
- if (TREE_LANG_FLAG_5 (node))
- fputs (" tree_5", file);
- if (TREE_LANG_FLAG_6 (node))
- fputs (" tree_6", file);
-
- /* DECL_ nodes have additional attributes. */
-
- switch (TREE_CODE_CLASS (TREE_CODE (node)))
- {
- case 'd':
- mode = DECL_MODE (node);
-
- if (DECL_IGNORED_P (node))
- fputs (" ignored", file);
- if (DECL_ABSTRACT (node))
- fputs (" abstract", file);
- if (DECL_IN_SYSTEM_HEADER (node))
- fputs (" in_system_header", file);
- if (DECL_COMMON (node))
- fputs (" common", file);
- if (DECL_EXTERNAL (node))
- fputs (" external", file);
- if (DECL_REGISTER (node))
- fputs (" regdecl", file);
- if (DECL_PACKED (node))
- fputs (" packed", file);
- if (DECL_NONLOCAL (node))
- fputs (" nonlocal", file);
- if (DECL_INLINE (node))
- fputs (" inline", file);
-
- if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
- fputs (" suppress-debug", file);
-
- if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node))
- fputs (" built-in", file);
- if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN_NONANSI (node))
- fputs (" built-in-nonansi", file);
-
- if (TREE_CODE (node) == FIELD_DECL && DECL_BIT_FIELD (node))
- fputs (" bit-field", file);
- if (TREE_CODE (node) == LABEL_DECL && DECL_TOO_LATE (node))
- fputs (" too-late", file);
- if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
- fputs (" in-text-section", file);
-
- if (DECL_VIRTUAL_P (node))
- fputs (" virtual", file);
- if (DECL_DEFER_OUTPUT (node))
- fputs (" defer-output", file);
- if (DECL_TRANSPARENT_UNION (node))
- fputs (" transparent-union", file);
-
- if (DECL_LANG_FLAG_0 (node))
- fputs (" decl_0", file);
- if (DECL_LANG_FLAG_1 (node))
- fputs (" decl_1", file);
- if (DECL_LANG_FLAG_2 (node))
- fputs (" decl_2", file);
- if (DECL_LANG_FLAG_3 (node))
- fputs (" decl_3", file);
- if (DECL_LANG_FLAG_4 (node))
- fputs (" decl_4", file);
- if (DECL_LANG_FLAG_5 (node))
- fputs (" decl_5", file);
- if (DECL_LANG_FLAG_6 (node))
- fputs (" decl_6", file);
- if (DECL_LANG_FLAG_7 (node))
- fputs (" decl_7", file);
-
- fprintf (file, " %s", mode_name[(int) mode]);
-
- fprintf (file, " file %s line %d",
- DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
-
- print_node (file, "size", DECL_SIZE (node), indent + 4);
- indent_to (file, indent + 3);
- if (TREE_CODE (node) != FUNCTION_DECL)
- fprintf (file, " align %d", DECL_ALIGN (node));
- else if (DECL_INLINE (node))
- fprintf (file, " frame_size %d", DECL_FRAME_SIZE (node));
- else if (DECL_BUILT_IN (node))
- fprintf (file, " built-in code %d", DECL_FUNCTION_CODE (node));
- if (TREE_CODE (node) == FIELD_DECL)
- print_node (file, "bitpos", DECL_FIELD_BITPOS (node), indent + 4);
- print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
- print_node_brief (file, "machine_attributes", DECL_MACHINE_ATTRIBUTES (node), indent + 4);
- print_node_brief (file, "abstract_origin",
- DECL_ABSTRACT_ORIGIN (node), indent + 4);
-
- print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
- print_node (file, "result", DECL_RESULT (node), indent + 4);
- print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
-
- print_lang_decl (file, node, indent);
-
- if (DECL_RTL (node) != 0)
- {
- indent_to (file, indent + 4);
- print_rtl (file, DECL_RTL (node));
- }
-
- if (DECL_SAVED_INSNS (node) != 0)
- {
- indent_to (file, indent + 4);
- if (TREE_CODE (node) == PARM_DECL)
- {
- fprintf (file, "incoming-rtl ");
- print_rtl (file, DECL_INCOMING_RTL (node));
- }
- else if (TREE_CODE (node) == FUNCTION_DECL)
- {
- fprintf (file, "saved-insns ");
- fprintf (file, HOST_PTR_PRINTF,
- (HOST_WIDE_INT) DECL_SAVED_INSNS (node));
- }
- }
-
- /* Print the decl chain only if decl is at second level. */
- if (indent == 4)
- print_node (file, "chain", TREE_CHAIN (node), indent + 4);
- else
- print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
- break;
-
- case 't':
- if (TYPE_NO_FORCE_BLK (node))
- fputs (" no-force-blk", file);
- if (TYPE_STRING_FLAG (node))
- fputs (" string-flag", file);
- if (TYPE_NEEDS_CONSTRUCTING (node))
- fputs (" needs-constructing", file);
- if (TYPE_TRANSPARENT_UNION (node))
- fputs (" transparent-union", file);
- if (TYPE_PACKED (node))
- fputs (" packed", file);
-
- if (TYPE_LANG_FLAG_0 (node))
- fputs (" type_0", file);
- if (TYPE_LANG_FLAG_1 (node))
- fputs (" type_1", file);
- if (TYPE_LANG_FLAG_2 (node))
- fputs (" type_2", file);
- if (TYPE_LANG_FLAG_3 (node))
- fputs (" type_3", file);
- if (TYPE_LANG_FLAG_4 (node))
- fputs (" type_4", file);
- if (TYPE_LANG_FLAG_5 (node))
- fputs (" type_5", file);
- if (TYPE_LANG_FLAG_6 (node))
- fputs (" type_6", file);
-
- mode = TYPE_MODE (node);
- fprintf (file, " %s", mode_name[(int) mode]);
-
- print_node (file, "size", TYPE_SIZE (node), indent + 4);
- indent_to (file, indent + 3);
-
- fprintf (file, " align %d", TYPE_ALIGN (node));
- fprintf (file, " symtab %d", TYPE_SYMTAB_ADDRESS (node));
-
- print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4);
-
- if (TREE_CODE (node) == ARRAY_TYPE || TREE_CODE (node) == SET_TYPE)
- print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
- else if (TREE_CODE (node) == INTEGER_TYPE
- || TREE_CODE (node) == BOOLEAN_TYPE
- || TREE_CODE (node) == CHAR_TYPE)
- {
- fprintf (file, " precision %d", TYPE_PRECISION (node));
- print_node (file, "min", TYPE_MIN_VALUE (node), indent + 4);
- print_node (file, "max", TYPE_MAX_VALUE (node), indent + 4);
- }
- else if (TREE_CODE (node) == ENUMERAL_TYPE)
- {
- fprintf (file, " precision %d", TYPE_PRECISION (node));
- print_node (file, "min", TYPE_MIN_VALUE (node), indent + 4);
- print_node (file, "max", TYPE_MAX_VALUE (node), indent + 4);
- print_node (file, "values", TYPE_VALUES (node), indent + 4);
- }
- else if (TREE_CODE (node) == REAL_TYPE)
- fprintf (file, " precision %d", TYPE_PRECISION (node));
- else if (TREE_CODE (node) == RECORD_TYPE
- || TREE_CODE (node) == UNION_TYPE
- || TREE_CODE (node) == QUAL_UNION_TYPE)
- print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
- else if (TREE_CODE (node) == FUNCTION_TYPE || TREE_CODE (node) == METHOD_TYPE)
- {
- if (TYPE_METHOD_BASETYPE (node))
- print_node_brief (file, "method basetype", TYPE_METHOD_BASETYPE (node), indent + 4);
- print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4);
- }
- if (TYPE_CONTEXT (node))
- print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4);
-
- print_lang_type (file, node, indent);
-
- if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
- indent_to (file, indent + 3);
- print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node), indent + 4);
- print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node), indent + 4);
- print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
- break;
-
- case 'b':
- print_node (file, "vars", BLOCK_VARS (node), indent + 4);
- print_node (file, "tags", BLOCK_TYPE_TAGS (node), indent + 4);
- print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), indent + 4);
- print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
- print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
- print_node (file, "abstract_origin",
- BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
- return;
-
- case 'e':
- case '<':
- case '1':
- case '2':
- case 'r':
- case 's':
- switch (TREE_CODE (node))
- {
- case BIND_EXPR:
- print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4);
- print_node (file, "body", TREE_OPERAND (node, 1), indent + 4);
- print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
- return;
- }
-
- first_rtl = len = tree_code_length[(int) TREE_CODE (node)];
- /* These kinds of nodes contain rtx's, not trees,
- after a certain point. Print the rtx's as rtx's. */
- switch (TREE_CODE (node))
- {
- case SAVE_EXPR:
- first_rtl = 2;
- break;
- case CALL_EXPR:
- first_rtl = 2;
- break;
- case METHOD_CALL_EXPR:
- first_rtl = 3;
- break;
- case WITH_CLEANUP_EXPR:
- /* Should be defined to be 2. */
- first_rtl = 1;
- break;
- case RTL_EXPR:
- first_rtl = 0;
- }
- for (i = 0; i < len; i++)
- {
- if (i >= first_rtl)
- {
- indent_to (file, indent + 4);
- fprintf (file, "rtl %d ", i);
- if (TREE_OPERAND (node, i))
- print_rtl (file, (struct rtx_def *) TREE_OPERAND (node, i));
- else
- fprintf (file, "(nil)");
- fprintf (file, "\n");
- }
- else
- {
- char temp[10];
-
- sprintf (temp, "arg %d", i);
- print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
- }
- }
- break;
-
- case 'c':
- case 'x':
- switch (TREE_CODE (node))
- {
- case INTEGER_CST:
- if (TREE_CONSTANT_OVERFLOW (node))
- fprintf (file, " overflow");
-
- fprintf (file, " ");
- 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)
- {
- fprintf (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));
- break;
-
- case REAL_CST:
- {
- REAL_VALUE_TYPE d;
-
- if (TREE_OVERFLOW (node))
- fprintf (file, " overflow");
-
-#if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
- d = TREE_REAL_CST (node);
- if (REAL_VALUE_ISINF (d))
- fprintf (file, " Inf");
- else if (REAL_VALUE_ISNAN (d))
- fprintf (file, " Nan");
- else
- {
- char string[100];
-
- REAL_VALUE_TO_DECIMAL (d, "%e", string);
- fprintf (file, " %s", string);
- }
-#else
- {
- int i;
- unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
- fprintf (file, " 0x");
- for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
- fprintf (file, "%02x", *p++);
- fprintf (file, "");
- }
-#endif
- }
- break;
-
- case COMPLEX_CST:
- print_node (file, "real", TREE_REALPART (node), indent + 4);
- print_node (file, "imag", TREE_IMAGPART (node), indent + 4);
- break;
-
- case STRING_CST:
- fprintf (file, " \"%s\"", TREE_STRING_POINTER (node));
- /* Print the chain at second level. */
- if (indent == 4)
- print_node (file, "chain", TREE_CHAIN (node), indent + 4);
- else
- print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
- break;
-
- case IDENTIFIER_NODE:
- print_lang_identifier (file, node, indent);
- break;
-
- case TREE_LIST:
- print_node (file, "purpose", TREE_PURPOSE (node), indent + 4);
- print_node (file, "value", TREE_VALUE (node), indent + 4);
- print_node (file, "chain", TREE_CHAIN (node), indent + 4);
- break;
-
- case TREE_VEC:
- len = TREE_VEC_LENGTH (node);
- for (i = 0; i < len; i++)
- if (TREE_VEC_ELT (node, i))
- {
- char temp[10];
- sprintf (temp, "elt %d", i);
- indent_to (file, indent + 4);
- print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0);
- }
- break;
-
- case OP_IDENTIFIER:
- print_node (file, "op1", TREE_PURPOSE (node), indent + 4);
- print_node (file, "op2", TREE_VALUE (node), indent + 4);
- }
-
- break;
- }
-
- fprintf (file, ">");
-}
diff --git a/gcc/profile.c b/gcc/profile.c
deleted file mode 100644
index dcdd5fe6574..00000000000
--- a/gcc/profile.c
+++ /dev/null
@@ -1,1634 +0,0 @@
-/* Calculate branch probabilities, and basic block execution counts.
- Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
- Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
- based on some ideas from Dain Samples of UC Berkeley.
- Further mangling by Bob Manson, Cygnus Support.
-
-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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* ??? Really should not put insns inside of LIBCALL sequences, when putting
- insns after a call, should look for the insn setting the retval, and
- insert the insns after that one. */
-
-/* ??? Register allocation should use basic block execution counts to
- give preference to the most commonly executed blocks. */
-
-/* ??? The .da files are not safe. Changing the program after creating .da
- files or using different options when compiling with -fbranch-probabilities
- can result the arc data not matching the program. Maybe add instrumented
- arc count to .bbg file? Maybe check whether PFG matches the .bbg file? */
-
-/* ??? Should calculate branch probabilities before instrumenting code, since
- then we can use arc counts to help decide which arcs to instrument. */
-
-/* ??? Rearrange code so that the most frequently executed arcs become from
- one block to the next block (i.e. a fall through), move seldom executed
- code outside of loops even at the expense of adding a few branches to
- achieve this, see Dain Sample's UC Berkeley thesis. */
-
-#include "config.h"
-#include "rtl.h"
-#include "flags.h"
-#include "insn-flags.h"
-#include "insn-config.h"
-#include "output.h"
-#include <stdio.h>
-#include "tree.h"
-#include "output.h"
-#include "gcov-io.h"
-
-extern char * xmalloc ();
-extern void free ();
-extern tree get_file_function_name ();
-
-/* One of these is dynamically created whenever we identify an arc in the
- function. */
-
-struct adj_list
-{
- int source;
- int target;
- int arc_count;
- unsigned int count_valid : 1;
- unsigned int on_tree : 1;
- unsigned int fake : 1;
- unsigned int fall_through : 1;
- rtx branch_insn;
- struct adj_list *pred_next;
- struct adj_list *succ_next;
-};
-
-#define ARC_TARGET(ARCPTR) (ARCPTR->target)
-#define ARC_SOURCE(ARCPTR) (ARCPTR->source)
-#define ARC_COUNT(ARCPTR) (ARCPTR->arc_count)
-
-/* Count the number of basic blocks, and create an array of these structures,
- one for each bb in the function. */
-
-struct bb_info
-{
- struct adj_list *succ;
- struct adj_list *pred;
- int succ_count;
- int pred_count;
- int exec_count;
- unsigned int count_valid : 1;
- unsigned int on_tree : 1;
- rtx first_insn;
-};
-
-/* Indexed by label number, gives the basic block number containing that
- label. */
-
-static int *label_to_bb;
-
-/* Number of valid entries in the label_to_bb array. */
-
-static int label_to_bb_size;
-
-/* Indexed by block index, holds the basic block graph. */
-
-static struct bb_info *bb_graph;
-
-/* Name and file pointer of the output file for the basic block graph. */
-
-static char *bbg_file_name;
-static FILE *bbg_file;
-
-/* Name and file pointer of the input file for the arc count data. */
-
-static char *da_file_name;
-static FILE *da_file;
-
-/* Pointer of the output file for the basic block/line number map. */
-static FILE *bb_file;
-
-/* Last source file name written to bb_file. */
-
-static char *last_bb_file_name;
-
-/* Indicates whether the next line number note should be output to
- bb_file or not. Used to eliminate a redundant note after an
- expanded inline function call. */
-
-static int ignore_next_note;
-
-/* Used by final, for allocating the proper amount of storage for the
- instrumented arc execution counts. */
-
-int count_instrumented_arcs;
-
-/* Number of executions for the return label. */
-
-int return_label_execution_count;
-
-/* Collect statistics on the performance of this pass for the entire source
- file. */
-
-static int total_num_blocks;
-static int total_num_arcs;
-static int total_num_arcs_instrumented;
-static int total_num_blocks_created;
-static int total_num_passes;
-static int total_num_times_called;
-static int total_hist_br_prob[20];
-static int total_num_never_executed;
-static int total_num_branches;
-
-/* Forward declarations. */
-static void init_arc PROTO((struct adj_list *, int, int, rtx));
-static void find_spanning_tree PROTO((int));
-static void expand_spanning_tree PROTO((int));
-static void fill_spanning_tree PROTO((int));
-static void init_arc_profiler PROTO((void));
-static void output_arc_profiler PROTO((int, rtx));
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-/* If non-zero, we need to output a constructor to set up the
- per-object-file data. */
-static int need_func_profiler = 0;
-
-
-/* Add arc instrumentation code to the entire insn chain.
-
- F is the first insn of the chain.
- NUM_BLOCKS is the number of basic blocks found in F.
- DUMP_FILE, if nonzero, is an rtl dump file we can write to. */
-
-static void
-instrument_arcs (f, num_blocks, dump_file)
- rtx f;
- int num_blocks;
- FILE *dump_file;
-{
- register int i;
- register struct adj_list *arcptr, *backptr;
- int num_arcs = 0;
- int num_instr_arcs = 0;
- rtx insn;
-
- int neg_one = -1;
- int zero = 0;
- int inverted;
- rtx note;
-
- /* Instrument the program start. */
- /* Handle block 0 specially, since it will always be instrumented,
- but it doesn't have a valid first_insn or branch_insn. We must
- put the instructions before the NOTE_INSN_FUNCTION_BEG note, so
- that they don't clobber any of the parameters of the current
- function. */
- for (insn = f; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG)
- break;
- insn = PREV_INSN (insn);
- need_func_profiler = 1;
- output_arc_profiler (total_num_arcs_instrumented + num_instr_arcs++, insn);
-
- for (i = 1; i < num_blocks; i++)
- for (arcptr = bb_graph[i].succ; arcptr; arcptr = arcptr->succ_next)
- if (! arcptr->on_tree)
- {
- if (dump_file)
- fprintf (dump_file, "Arc %d to %d instrumented\n", i,
- ARC_TARGET (arcptr));
-
- /* Check to see if this arc is the only exit from its source block,
- or the only entrance to its target block. In either case,
- we don't need to create a new block to instrument the arc. */
-
- if (bb_graph[i].succ == arcptr && arcptr->succ_next == 0)
- {
- /* Instrument the source block. */
- output_arc_profiler (total_num_arcs_instrumented
- + num_instr_arcs++,
- PREV_INSN (bb_graph[i].first_insn));
- }
- else if (arcptr == bb_graph[ARC_TARGET (arcptr)].pred
- && arcptr->pred_next == 0)
- {
- /* Instrument the target block. */
- output_arc_profiler (total_num_arcs_instrumented
- + num_instr_arcs++,
- PREV_INSN (bb_graph[ARC_TARGET (arcptr)].first_insn));
- }
- else if (arcptr->fall_through)
- {
- /* This is a fall-through; put the instrumentation code after
- the branch that ends this block. */
-
- for (backptr = bb_graph[i].succ; backptr;
- backptr = backptr->succ_next)
- if (backptr != arcptr)
- break;
-
- output_arc_profiler (total_num_arcs_instrumented
- + num_instr_arcs++,
- backptr->branch_insn);
- }
- else
- {
- /* Must emit a new basic block to hold the arc counting code. */
- enum rtx_code code = GET_CODE (PATTERN (arcptr->branch_insn));
-
- if (code == SET)
- {
- /* Create the new basic block right after the branch.
- Invert the branch so that it jumps past the end of the new
- block. The new block will consist of the instrumentation
- code, and a jump to the target of this arc. */
- int this_is_simplejump = simplejump_p (arcptr->branch_insn);
- rtx new_label = gen_label_rtx ();
- rtx old_label, set_src;
- rtx after = arcptr->branch_insn;
-
- /* Simplejumps can't reach here. */
- if (this_is_simplejump)
- abort ();
-
- /* We can't use JUMP_LABEL, because it won't be set if we
- are compiling without optimization. */
-
- set_src = SET_SRC (single_set (arcptr->branch_insn));
- if (GET_CODE (set_src) == LABEL_REF)
- old_label = set_src;
- else if (GET_CODE (set_src) != IF_THEN_ELSE)
- abort ();
- else if (XEXP (set_src, 1) == pc_rtx)
- old_label = XEXP (XEXP (set_src, 2), 0);
- else
- old_label = XEXP (XEXP (set_src, 1), 0);
-
- /* Set the JUMP_LABEL so that redirect_jump will work. */
- JUMP_LABEL (arcptr->branch_insn) = old_label;
-
- /* Add a use for OLD_LABEL that will be needed when we emit
- the JUMP_INSN below. If we don't do this here,
- `invert_jump' might delete it for us. We must add two
- when not optimizing, because the NUSES is zero now,
- but must be at least two to prevent the label from being
- deleted. */
- LABEL_NUSES (old_label) += 2;
-
- /* Emit the insns for the new block in reverse order,
- since that is most convenient. */
-
- if (this_is_simplejump)
- {
- after = NEXT_INSN (arcptr->branch_insn);
- if (! redirect_jump (arcptr->branch_insn, new_label))
- /* Don't know what to do if this branch won't
- redirect. */
- abort ();
- }
- else
- {
- if (! invert_jump (arcptr->branch_insn, new_label))
- /* Don't know what to do if this branch won't invert. */
- abort ();
-
- emit_label_after (new_label, after);
- LABEL_NUSES (new_label)++;
- }
- emit_barrier_after (after);
- emit_jump_insn_after (gen_jump (old_label), after);
- JUMP_LABEL (NEXT_INSN (after)) = old_label;
-
- /* Instrument the source arc. */
- output_arc_profiler (total_num_arcs_instrumented
- + num_instr_arcs++,
- after);
- if (this_is_simplejump)
- {
- emit_label_after (new_label, after);
- LABEL_NUSES (new_label)++;
- }
- }
- else if (code == ADDR_VEC || code == ADDR_DIFF_VEC)
- {
- /* A table jump. Create a new basic block immediately
- after the table, by emitting a barrier, a label, a
- counting note, and a jump to the old label. Put the
- new label in the table. */
-
- rtx new_label = gen_label_rtx ();
- rtx old_lref, new_lref;
- int index;
-
- /* Must determine the old_label reference, do this
- by counting the arcs after this one, which will
- give the index of our label in the table. */
-
- index = 0;
- for (backptr = arcptr->succ_next; backptr;
- backptr = backptr->succ_next)
- index++;
-
- old_lref = XVECEXP (PATTERN (arcptr->branch_insn),
- (code == ADDR_DIFF_VEC), index);
-
- /* Emit the insns for the new block in reverse order,
- since that is most convenient. */
- emit_jump_insn_after (gen_jump (XEXP (old_lref, 0)),
- arcptr->branch_insn);
- JUMP_LABEL (NEXT_INSN (arcptr->branch_insn))
- = XEXP (old_lref, 0);
-
- /* Instrument the source arc. */
- output_arc_profiler (total_num_arcs_instrumented
- + num_instr_arcs++,
- arcptr->branch_insn);
-
- emit_label_after (new_label, arcptr->branch_insn);
- LABEL_NUSES (NEXT_INSN (arcptr->branch_insn))++;
- emit_barrier_after (arcptr->branch_insn);
-
- /* Fix up the table jump. */
- new_lref = gen_rtx (LABEL_REF, Pmode, new_label);
- XVECEXP (PATTERN (arcptr->branch_insn),
- (code == ADDR_DIFF_VEC), index) = new_lref;
- }
- else
- abort ();
-
- num_arcs += 1;
- if (dump_file)
- fprintf (dump_file,
- "Arc %d to %d needed new basic block\n", i,
- ARC_TARGET (arcptr));
- }
- }
-
- total_num_arcs_instrumented += num_instr_arcs;
- count_instrumented_arcs = total_num_arcs_instrumented;
-
- total_num_blocks_created += num_arcs;
- if (dump_file)
- {
- fprintf (dump_file, "%d arcs instrumented\n", num_instr_arcs);
- fprintf (dump_file, "%d extra basic blocks created\n", num_arcs);
- }
-}
-
-/* Output STRING to bb_file, surrounded by DELIMITER. */
-
-static void
-output_gcov_string (string, delimiter)
- char *string;
- long delimiter;
-{
- long temp;
-
- /* Write a delimiter to indicate that a file name follows. */
- __write_long (delimiter, bb_file, 4);
-
- /* Write the string. */
- temp = strlen (string) + 1;
- fwrite (string, temp, 1, bb_file);
-
- /* Append a few zeros, to align the output to a 4 byte boundary. */
- temp = temp & 0x3;
- if (temp)
- {
- char c[4];
-
- c[0] = c[1] = c[2] = c[3] = 0;
- fwrite (c, sizeof (char), 4 - temp, bb_file);
- }
-
- /* Store another delimiter in the .bb file, just to make it easy to find the
- end of the file name. */
- __write_long (delimiter, bb_file, 4);
-}
-
-/* Instrument and/or analyze program behavior based on program flow graph.
- In either case, this function builds a flow graph for the function being
- compiled. The flow graph is stored in BB_GRAPH.
-
- When FLAG_PROFILE_ARCS is nonzero, this function instruments the arcs in
- the flow graph that are needed to reconstruct the dynamic behavior of the
- flow graph.
-
- When FLAG_BRANCH_PROBABILITIES is nonzero, this function reads auxilliary
- information from a data file containing arc count information from previous
- executions of the function being compiled. In this case, the flow graph is
- annotated with actual execution counts, which are later propagated into the
- rtl for optimization purposes.
-
- Main entry point of this file. */
-
-void
-branch_prob (f, dump_file)
- rtx f;
- FILE *dump_file;
-{
- int i, num_blocks;
- int dest;
- rtx insn;
- struct adj_list *arcptr;
- int num_arcs, changes, passes;
- int total, prob;
- int hist_br_prob[20], num_never_executed, num_branches;
- /* Set to non-zero if we got bad count information. */
- int bad_counts = 0;
-
- /* start of a function. */
- if (flag_test_coverage)
- output_gcov_string (current_function_name, (long) -2);
-
- /* Execute this only if doing arc profiling or branch probabilities. */
- if (! profile_arc_flag && ! flag_branch_probabilities
- && ! flag_test_coverage)
- abort ();
-
- total_num_times_called++;
-
- /* Create an array label_to_bb of ints of size max_label_num. */
- label_to_bb_size = max_label_num ();
- label_to_bb = (int *) oballoc (label_to_bb_size * sizeof (int));
- bzero ((char *) label_to_bb, label_to_bb_size * sizeof (int));
-
- /* Scan the insns in the function, count the number of basic blocks
- present. When a code label is passed, set label_to_bb[label] = bb
- number. */
-
- /* The first block found will be block 1, so that function entry can be
- block 0. */
-
- {
- register RTX_CODE prev_code = JUMP_INSN;
- register RTX_CODE code;
- register rtx insn;
- register int i;
- int block_separator_emitted = 0;
-
- ignore_next_note = 0;
-
- for (insn = NEXT_INSN (f), i = 0; insn; insn = NEXT_INSN (insn))
- {
- code = GET_CODE (insn);
-
- if (code == BARRIER)
- ;
- else if (code == CODE_LABEL)
- /* This label is part of the next block, but we can't increment
- block number yet since there might be multiple labels. */
- label_to_bb[CODE_LABEL_NUMBER (insn)] = i + 1;
- /* We make NOTE_INSN_SETJMP notes into a block of their own, so that
- they can be the target of the fake arc for the setjmp call.
- This avoids creating cycles of fake arcs, which would happen if
- the block after the setjmp call contained a call insn. */
- else if ((prev_code == JUMP_INSN || prev_code == CALL_INSN
- || prev_code == CODE_LABEL || prev_code == BARRIER)
- && (GET_RTX_CLASS (code) == 'i'
- || (code == NOTE &&
- NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)))
- {
- i += 1;
-
- /* Emit the block separator if it hasn't already been emitted. */
- if (flag_test_coverage && ! block_separator_emitted)
- {
- /* Output a zero to the .bb file to indicate that a new
- block list is starting. */
- __write_long (0, bb_file, 4);
- }
- block_separator_emitted = 0;
- }
- /* If flag_test_coverage is true, then we must add an entry to the
- .bb file for every note. */
- else if (code == NOTE && flag_test_coverage)
- {
- /* Must ignore the line number notes that immediately follow the
- end of an inline function to avoid counting it twice. There
- is a note before the call, and one after the call. */
- if (NOTE_LINE_NUMBER (insn) == NOTE_REPEATED_LINE_NUMBER)
- ignore_next_note = 1;
- else if (NOTE_LINE_NUMBER (insn) > 0)
- {
- if (ignore_next_note)
- ignore_next_note = 0;
- else
- {
- /* Emit a block separator here to ensure that a NOTE
- immediately following a JUMP_INSN or CALL_INSN will end
- up in the right basic block list. */
- if ((prev_code == JUMP_INSN || prev_code == CALL_INSN
- || prev_code == CODE_LABEL || prev_code == BARRIER)
- && ! block_separator_emitted)
- {
- /* Output a zero to the .bb file to indicate that
- a new block list is starting. */
- __write_long (0, bb_file, 4);
-
- block_separator_emitted = 1;
- }
-
- /* If this is a new source file, then output the file's
- name to the .bb file. */
- if (! last_bb_file_name
- || strcmp (NOTE_SOURCE_FILE (insn),
- last_bb_file_name))
- {
- if (last_bb_file_name)
- free (last_bb_file_name);
- last_bb_file_name =
- xmalloc (strlen (NOTE_SOURCE_FILE (insn)) + 1);
- strcpy (last_bb_file_name, NOTE_SOURCE_FILE (insn));
- output_gcov_string (NOTE_SOURCE_FILE (insn), (long)-1);
- }
-
- /* Output the line number to the .bb file. Must be done
- after the output_bb_profile_data() call, and after the
- file name is written, to ensure that it is correctly
- handled by gcov. */
- __write_long (NOTE_LINE_NUMBER (insn), bb_file, 4);
- }
- }
- }
-
- if (code != NOTE)
- prev_code = code;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
- prev_code = CALL_INSN;
- }
-
- /* Allocate last `normal' entry for bb_graph. */
-
- /* The last insn was a jump, call, or label. In that case we have
- a block at the end of the function with no insns. */
- if (prev_code == JUMP_INSN || prev_code == CALL_INSN
- || prev_code == CODE_LABEL || prev_code == BARRIER)
- {
- i++;
-
- /* Emit the block separator if it hasn't already been emitted. */
- if (flag_test_coverage && ! block_separator_emitted)
- {
- /* Output a zero to the .bb file to indicate that a new
- block list is starting. */
- __write_long (0, bb_file, 4);
- }
- }
-
- /* Create another block to stand for EXIT, and make all return insns, and
- the last basic block point here. Add one more to account for block
- zero. */
- num_blocks = i + 2;
- }
-
- total_num_blocks += num_blocks;
- if (dump_file)
- fprintf (dump_file, "%d basic blocks\n", num_blocks);
-
- /* If we are only doing test coverage here, then return now. */
- if (! profile_arc_flag && ! flag_branch_probabilities)
- return;
-
- /* Create and initialize the arrays that will hold bb_graph
- and execution count info. */
-
- bb_graph = (struct bb_info *) alloca (num_blocks * sizeof (struct bb_info));
- bzero ((char *) bb_graph, (sizeof (struct bb_info) * num_blocks));
-
- {
- /* Scan the insns again:
- - at the entry to each basic block, increment the predecessor count
- (and successor of previous block) if it is a fall through entry,
- create adj_list entries for this and the previous block
- - at each jump insn, increment predecessor/successor counts for
- target/source basic blocks, add this insn to pred/succ lists.
-
- This also cannot be broken out as a separate subroutine
- because it uses `alloca'. */
-
- register RTX_CODE prev_code = JUMP_INSN;
- register RTX_CODE code;
- register rtx insn;
- register int i;
- int fall_through = 0;
- struct adj_list *arcptr;
- int dest;
-
- /* Block 0 always falls through to block 1. */
- num_arcs = 0;
- arcptr = (struct adj_list *) alloca (sizeof (struct adj_list));
- init_arc (arcptr, 0, 1, 0);
- arcptr->fall_through = 1;
- num_arcs++;
-
- /* Add a fake fall through arc from the last block to block 0, to make the
- graph complete. */
- arcptr = (struct adj_list *) alloca (sizeof (struct adj_list));
- init_arc (arcptr, num_blocks - 1, 0, 0);
- arcptr->fake = 1;
- num_arcs++;
-
- /* Exit must be one node of the graph, and all exits from the function
- must point there. When see a return branch, must point the arc to the
- exit node. */
-
- /* Must start scan with second insn in function as above. */
- for (insn = NEXT_INSN (f), i = 0; insn; insn = NEXT_INSN (insn))
- {
- code = GET_CODE (insn);
-
- if (code == BARRIER)
- fall_through = 0;
- else if (code == CODE_LABEL)
- ;
- /* We make NOTE_INSN_SETJMP notes into a block of their own, so that
- they can be the target of the fake arc for the setjmp call.
- This avoids creating cycles of fake arcs, which would happen if
- the block after the setjmp call ended with a call. */
- else if ((prev_code == JUMP_INSN || prev_code == CALL_INSN
- || prev_code == CODE_LABEL || prev_code == BARRIER)
- && (GET_RTX_CLASS (code) == 'i'
- || (code == NOTE &&
- NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)))
- {
- /* This is the first insn of the block. */
- i += 1;
- if (fall_through)
- {
- arcptr = (struct adj_list *) alloca (sizeof (struct adj_list));
- init_arc (arcptr, i - 1, i, 0);
- arcptr->fall_through = 1;
-
- num_arcs++;
- }
- fall_through = 1;
- bb_graph[i].first_insn = insn;
- }
- else if (code == NOTE)
- ;
-
- if (code == CALL_INSN)
- {
- /* In the normal case, the call returns, and this is just like
- a branch fall through. */
- fall_through = 1;
-
- /* Setjmp may return more times than called, so to make the graph
- solvable, add a fake arc from the function entrance to the
- next block.
-
- All other functions may return fewer times than called (if
- a descendent call longjmp or exit), so to make the graph
- solvable, add a fake arc to the function exit from the
- current block.
-
- Distinguish the cases by checking for a SETJUMP note.
- A call_insn can be the last ins of a function, so must check
- to see if next insn actually exists. */
- arcptr = (struct adj_list *) alloca (sizeof (struct adj_list));
- if (NEXT_INSN (insn)
- && GET_CODE (NEXT_INSN (insn)) == NOTE
- && NOTE_LINE_NUMBER (NEXT_INSN (insn)) == NOTE_INSN_SETJMP)
- init_arc (arcptr, 0, i+1, insn);
- else
- init_arc (arcptr, i, num_blocks-1, insn);
- arcptr->fake = 1;
- num_arcs++;
- }
- else if (code == JUMP_INSN)
- {
- rtx tem, pattern = PATTERN (insn);
- rtx tablejump = 0;
-
- /* If running without optimization, then jump label won't be valid,
- so we must search for the destination label in that case.
- We have to handle tablejumps and returns specially anyways, so
- we don't check the JUMP_LABEL at all here. */
-
- if (GET_CODE (pattern) == PARALLEL)
- {
- /* This assumes that PARALLEL jumps are tablejump entry
- jumps. */
- /* Make an arc from this jump to the label of the
- jump table. This will instrument the number of
- times the switch statement is executed. */
- if (GET_CODE (XVECEXP (pattern, 0, 1)) == USE)
- {
- tem = XEXP (XVECEXP (pattern, 0, 1), 0);
- if (GET_CODE (tem) != LABEL_REF)
- abort ();
- dest = label_to_bb[CODE_LABEL_NUMBER (XEXP (tem, 0))];
- }
- else if (GET_CODE (XVECEXP (pattern, 0, 0)) == SET
- && SET_DEST (XVECEXP (pattern, 0, 0)) == pc_rtx)
- {
- tem = SET_SRC (XVECEXP (pattern, 0, 0));
- if (GET_CODE (tem) == PLUS
- && GET_CODE (XEXP (tem, 1)) == LABEL_REF)
- {
- tem = XEXP (tem, 1);
- dest = label_to_bb [CODE_LABEL_NUMBER (XEXP (tem, 0))];
- }
- }
- else
- abort ();
- }
- else if (GET_CODE (pattern) == ADDR_VEC
- || GET_CODE (pattern) == ADDR_DIFF_VEC)
- tablejump = pattern;
- else if (GET_CODE (pattern) == RETURN)
- dest = num_blocks - 1;
- else if ((tem = SET_SRC (pattern))
- && GET_CODE (tem) == LABEL_REF)
- dest = label_to_bb[CODE_LABEL_NUMBER (XEXP (tem, 0))];
- else
- {
- rtx label_ref;
-
- /* Must be an IF_THEN_ELSE branch. */
- if (GET_CODE (tem) != IF_THEN_ELSE)
- abort ();
- if (XEXP (tem, 1) != pc_rtx)
- label_ref = XEXP (tem, 1);
- else
- label_ref = XEXP (tem, 2);
- dest = label_to_bb[CODE_LABEL_NUMBER (XEXP (label_ref, 0))];
- }
-
- if (tablejump)
- {
- int diff_vec_p = GET_CODE (tablejump) == ADDR_DIFF_VEC;
- int len = XVECLEN (tablejump, diff_vec_p);
- int k;
-
- for (k = 0; k < len; k++)
- {
- rtx tem = XEXP (XVECEXP (tablejump, diff_vec_p, k), 0);
- dest = label_to_bb[CODE_LABEL_NUMBER (tem)];
-
- arcptr = (struct adj_list *) alloca (sizeof(struct adj_list));
- init_arc (arcptr, i, dest, insn);
-
- num_arcs++;
- }
- }
- else
- {
- arcptr = (struct adj_list *) alloca (sizeof (struct adj_list));
- init_arc (arcptr, i, dest, insn);
-
- num_arcs++;
- }
-
- /* Determine whether or not this jump will fall through.
- Unconditional jumps and returns are not always followed by
- barriers. */
- pattern = PATTERN (insn);
- if (GET_CODE (pattern) == PARALLEL
- || GET_CODE (pattern) == RETURN)
- fall_through = 0;
- else if (GET_CODE (pattern) == ADDR_VEC
- || GET_CODE (pattern) == ADDR_DIFF_VEC)
- /* These aren't actually jump insns, but they never fall
- through, so... */
- fall_through = 0;
- else
- {
- if (GET_CODE (pattern) != SET || SET_DEST (pattern) != pc_rtx)
- abort ();
- if (GET_CODE (SET_SRC (pattern)) != IF_THEN_ELSE)
- fall_through = 0;
- }
- }
-
- if (code != NOTE)
- prev_code = code;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
- prev_code = CALL_INSN;
- }
-
- /* If the code at the end of the function would give a new block, then
- do the following. */
-
- if (prev_code == JUMP_INSN || prev_code == CALL_INSN
- || prev_code == CODE_LABEL || prev_code == BARRIER)
- {
- if (fall_through)
- {
- arcptr = (struct adj_list *) alloca (sizeof (struct adj_list));
- init_arc (arcptr, i, i + 1, 0);
- arcptr->fall_through = 1;
-
- num_arcs++;
- }
-
- /* This may not be a real insn, but that should not cause a problem. */
- bb_graph[i+1].first_insn = get_last_insn ();
- }
-
- /* There is always a fake arc from the last block of the function
- to the function exit block. */
- arcptr = (struct adj_list *) alloca (sizeof (struct adj_list));
- init_arc (arcptr, num_blocks-2, num_blocks-1, 0);
- arcptr->fake = 1;
- num_arcs++;
- }
-
- total_num_arcs += num_arcs;
- if (dump_file)
- fprintf (dump_file, "%d arcs\n", num_arcs);
-
- /* Create spanning tree from basic block graph, mark each arc that is
- on the spanning tree. */
-
- /* To reduce the instrumentation cost, make two passes over the tree.
- First, put as many must-split (crowded and fake) arcs on the tree as
- possible, then on the second pass fill in the rest of the tree.
- Note that the spanning tree is considered undirected, so that as many
- must-split arcs as possible can be put on it.
-
- Fallthough arcs which are crowded should not be chosen on the first
- pass, since they do not require creating a new basic block. These
- arcs will have fall_through set. */
-
- find_spanning_tree (num_blocks);
-
- /* Create a .bbg file from which gcov can reconstruct the basic block
- graph. First output the number of basic blocks, and then for every
- arc output the source and target basic block numbers.
- NOTE: The format of this file must be compatible with gcov. */
-
- if (flag_test_coverage)
- {
- int flag_bits;
-
- __write_long (num_blocks, bbg_file, 4);
- __write_long (num_arcs, bbg_file, 4);
-
- for (i = 0; i < num_blocks; i++)
- {
- long count = 0;
- for (arcptr = bb_graph[i].succ; arcptr; arcptr = arcptr->succ_next)
- count++;
- __write_long (count, bbg_file, 4);
-
- for (arcptr = bb_graph[i].succ; arcptr; arcptr = arcptr->succ_next)
- {
- flag_bits = 0;
- if (arcptr->on_tree)
- flag_bits |= 0x1;
- if (arcptr->fake)
- flag_bits |= 0x2;
- if (arcptr->fall_through)
- flag_bits |= 0x4;
-
- __write_long (ARC_TARGET (arcptr), bbg_file, 4);
- __write_long (flag_bits, bbg_file, 4);
- }
- }
-
- /* Emit a -1 to separate the list of all arcs from the list of
- loop back edges that follows. */
- __write_long (-1, bbg_file, 4);
- }
-
- /* For each arc not on the spanning tree, add counting code as rtl. */
-
- if (profile_arc_flag)
- instrument_arcs (f, num_blocks, dump_file);
-
- /* Execute the rest only if doing branch probabilities. */
- if (! flag_branch_probabilities)
- return;
-
- /* For each arc not on the spanning tree, set its execution count from
- the .da file. */
-
- /* The first count in the .da file is the number of times that the function
- was entered. This is the exec_count for block zero. */
-
- num_arcs = 0;
- for (i = 0; i < num_blocks; i++)
- for (arcptr = bb_graph[i].succ; arcptr; arcptr = arcptr->succ_next)
- if (! arcptr->on_tree)
- {
- num_arcs++;
- if (da_file)
- {
- long value;
- __read_long (&value, da_file, 8);
- ARC_COUNT (arcptr) = value;
- }
- else
- ARC_COUNT (arcptr) = 0;
- arcptr->count_valid = 1;
- bb_graph[i].succ_count--;
- bb_graph[ARC_TARGET (arcptr)].pred_count--;
- }
-
- if (dump_file)
- fprintf (dump_file, "%d arc counts read\n", num_arcs);
-
- /* For every block in the file,
- - if every exit/entrance arc has a known count, then set the block count
- - if the block count is known, and every exit/entrance arc but one has
- a known execution count, then set the count of the remaining arc
-
- As arc counts are set, decrement the succ/pred count, but don't delete
- the arc, that way we can easily tell when all arcs are known, or only
- one arc is unknown. */
-
- /* The order that the basic blocks are iterated through is important.
- Since the code that finds spanning trees starts with block 0, low numbered
- arcs are put on the spanning tree in preference to high numbered arcs.
- Hence, most instrumented arcs are at the end. Graph solving works much
- faster if we propagate numbers from the end to the start.
-
- This takes an average of slightly more than 3 passes. */
-
- changes = 1;
- passes = 0;
- while (changes)
- {
- passes++;
- changes = 0;
-
- for (i = num_blocks - 1; i >= 0; i--)
- {
- struct bb_info *binfo = &bb_graph[i];
- if (! binfo->count_valid)
- {
- if (binfo->succ_count == 0)
- {
- total = 0;
- for (arcptr = binfo->succ; arcptr;
- arcptr = arcptr->succ_next)
- total += ARC_COUNT (arcptr);
- binfo->exec_count = total;
- binfo->count_valid = 1;
- changes = 1;
- }
- else if (binfo->pred_count == 0)
- {
- total = 0;
- for (arcptr = binfo->pred; arcptr;
- arcptr = arcptr->pred_next)
- total += ARC_COUNT (arcptr);
- binfo->exec_count = total;
- binfo->count_valid = 1;
- changes = 1;
- }
- }
- if (binfo->count_valid)
- {
- if (binfo->succ_count == 1)
- {
- total = 0;
- /* One of the counts will be invalid, but it is zero,
- so adding it in also doesn't hurt. */
- for (arcptr = binfo->succ; arcptr;
- arcptr = arcptr->succ_next)
- total += ARC_COUNT (arcptr);
- /* Calculate count for remaining arc by conservation. */
- total = binfo->exec_count - total;
- /* Search for the invalid arc, and set its count. */
- for (arcptr = binfo->succ; arcptr;
- arcptr = arcptr->succ_next)
- if (! arcptr->count_valid)
- break;
- if (! arcptr)
- abort ();
- arcptr->count_valid = 1;
- ARC_COUNT (arcptr) = total;
- binfo->succ_count--;
-
- bb_graph[ARC_TARGET (arcptr)].pred_count--;
- changes = 1;
- }
- if (binfo->pred_count == 1)
- {
- total = 0;
- /* One of the counts will be invalid, but it is zero,
- so adding it in also doesn't hurt. */
- for (arcptr = binfo->pred; arcptr;
- arcptr = arcptr->pred_next)
- total += ARC_COUNT (arcptr);
- /* Calculate count for remaining arc by conservation. */
- total = binfo->exec_count - total;
- /* Search for the invalid arc, and set its count. */
- for (arcptr = binfo->pred; arcptr;
- arcptr = arcptr->pred_next)
- if (! arcptr->count_valid)
- break;
- if (! arcptr)
- abort ();
- arcptr->count_valid = 1;
- ARC_COUNT (arcptr) = total;
- binfo->pred_count--;
-
- bb_graph[ARC_SOURCE (arcptr)].succ_count--;
- changes = 1;
- }
- }
- }
- }
-
- total_num_passes += passes;
- if (dump_file)
- fprintf (dump_file, "Graph solving took %d passes.\n\n", passes);
-
- /* If the graph has been correctly solved, every block will have a
- succ and pred count of zero. */
- for (i = 0; i < num_blocks; i++)
- {
- struct bb_info *binfo = &bb_graph[i];
- if (binfo->succ_count || binfo->pred_count)
- abort ();
- }
-
- /* For every arc, calculate its branch probability and add a reg_note
- to the branch insn to indicate this. */
-
- for (i = 0; i < 20; i++)
- hist_br_prob[i] = 0;
- num_never_executed = 0;
- num_branches = 0;
-
- for (i = 0; i < num_blocks; i++)
- {
- struct bb_info *binfo = &bb_graph[i];
-
- total = binfo->exec_count;
- for (arcptr = binfo->succ; arcptr; arcptr = arcptr->succ_next)
- {
- if (arcptr->branch_insn)
- {
- /* This calculates the branch probability as an integer between
- 0 and REG_BR_PROB_BASE, properly rounded to the nearest
- integer. Perform the arithmetic in double to avoid
- overflowing the range of ints. */
-
- if (total == 0)
- prob = -1;
- else
- {
- rtx pat = PATTERN (arcptr->branch_insn);
-
- prob = (((double)ARC_COUNT (arcptr) * REG_BR_PROB_BASE)
- + (total >> 1)) / total;
- if (prob < 0 || prob > REG_BR_PROB_BASE)
- {
- if (dump_file)
- fprintf (dump_file, "bad count: prob for %d-%d thought to be %d (forcibly normalized)\n",
- ARC_SOURCE (arcptr), ARC_TARGET (arcptr),
- prob);
-
- bad_counts = 1;
- prob = REG_BR_PROB_BASE / 2;
- }
-
- /* Match up probability with JUMP pattern. */
-
- if (GET_CODE (pat) == SET
- && GET_CODE (SET_SRC (pat)) == IF_THEN_ELSE)
- {
- if (ARC_TARGET (arcptr) == ARC_SOURCE (arcptr) + 1)
- {
- /* A fall through arc should never have a
- branch insn. */
- abort ();
- }
- else
- {
- /* This is the arc for the taken branch. */
- if (GET_CODE (XEXP (SET_SRC (pat), 2)) != PC)
- prob = REG_BR_PROB_BASE - prob;
- }
- }
- }
-
- if (prob == -1)
- num_never_executed++;
- else
- {
- int index = prob * 20 / REG_BR_PROB_BASE;
- if (index == 20)
- index = 19;
- hist_br_prob[index]++;
- }
- num_branches++;
-
- REG_NOTES (arcptr->branch_insn)
- = gen_rtx (EXPR_LIST, REG_BR_PROB, GEN_INT (prob),
- REG_NOTES (arcptr->branch_insn));
- }
- }
-
- /* Add a REG_EXEC_COUNT note to the first instruction of this block. */
- if (! binfo->first_insn
- || GET_RTX_CLASS (GET_CODE (binfo->first_insn)) != 'i')
- {
- /* Block 0 is a fake block representing function entry, and does
- not have a real first insn. The second last block might not
- begin with a real insn. */
- if (i == num_blocks - 1)
- return_label_execution_count = total;
- else if (i != 0 && i != num_blocks - 2)
- abort ();
- }
- else
- {
- REG_NOTES (binfo->first_insn)
- = gen_rtx (EXPR_LIST, REG_EXEC_COUNT, GEN_INT (total),
- REG_NOTES (binfo->first_insn));
- if (i == num_blocks - 1)
- return_label_execution_count = total;
- }
- }
-
- /* This should never happen. */
- if (bad_counts)
- warning ("Arc profiling: some arc counts were bad.");
-
- if (dump_file)
- {
- fprintf (dump_file, "%d branches\n", num_branches);
- fprintf (dump_file, "%d branches never executed\n",
- num_never_executed);
- if (num_branches)
- for (i = 0; i < 10; i++)
- fprintf (dump_file, "%d%% branches in range %d-%d%%\n",
- (hist_br_prob[i]+hist_br_prob[19-i])*100/num_branches,
- 5*i, 5*i+5);
-
- total_num_branches += num_branches;
- total_num_never_executed += num_never_executed;
- for (i = 0; i < 20; i++)
- total_hist_br_prob[i] += hist_br_prob[i];
- }
-
-}
-
-/* Initialize a new arc.
- ARCPTR is the empty adj_list this function fills in.
- SOURCE is the block number of the source block.
- TARGET is the block number of the target block.
- INSN is the insn which transfers control from SOURCE to TARGET,
- or zero if the transfer is implicit. */
-
-static void
-init_arc (arcptr, source, target, insn)
- struct adj_list *arcptr;
- int source, target;
- rtx insn;
-{
- ARC_TARGET (arcptr) = target;
- ARC_SOURCE (arcptr) = source;
-
- ARC_COUNT (arcptr) = 0;
- arcptr->count_valid = 0;
- arcptr->on_tree = 0;
- arcptr->fake = 0;
- arcptr->fall_through = 0;
- arcptr->branch_insn = insn;
-
- arcptr->succ_next = bb_graph[source].succ;
- bb_graph[source].succ = arcptr;
- bb_graph[source].succ_count++;
-
- arcptr->pred_next = bb_graph[target].pred;
- bb_graph[target].pred = arcptr;
- bb_graph[target].pred_count++;
-}
-
-/* This function searches all of the arcs in the program flow graph, and puts
- as many bad arcs as possible onto the spanning tree. Bad arcs include
- fake arcs (needed for setjmp(), longjmp(), exit()) which MUST be on the
- spanning tree as they can't be instrumented. Also, arcs which must be
- split when instrumented should be part of the spanning tree if possible. */
-
-static void
-find_spanning_tree (num_blocks)
- int num_blocks;
-{
- int i;
- struct adj_list *arcptr;
- struct bb_info *binfo = &bb_graph[0];
-
- /* Fake arcs must be part of the spanning tree, and are always safe to put
- on the spanning tree. Fake arcs will either be a successor of node 0,
- a predecessor of the last node, or from the last node to node 0. */
-
- for (arcptr = bb_graph[0].succ; arcptr; arcptr = arcptr->succ_next)
- if (arcptr->fake)
- {
- /* Adding this arc should never cause a cycle. This is a fatal
- error if it would. */
- if (bb_graph[ARC_TARGET (arcptr)].on_tree && binfo->on_tree)
- abort();
- else
- {
- arcptr->on_tree = 1;
- bb_graph[ARC_TARGET (arcptr)].on_tree = 1;
- binfo->on_tree = 1;
- }
- }
-
- binfo = &bb_graph[num_blocks-1];
- for (arcptr = binfo->pred; arcptr; arcptr = arcptr->pred_next)
- if (arcptr->fake)
- {
- /* Adding this arc should never cause a cycle. This is a fatal
- error if it would. */
- if (bb_graph[ARC_SOURCE (arcptr)].on_tree && binfo->on_tree)
- abort();
- else
- {
- arcptr->on_tree = 1;
- bb_graph[ARC_SOURCE (arcptr)].on_tree = 1;
- binfo->on_tree = 1;
- }
- }
- /* The only entrace to node zero is a fake arc. */
- bb_graph[0].pred->on_tree = 1;
-
- /* Arcs which are crowded at both the source and target should be put on
- the spanning tree if possible, except for fall_throuch arcs which never
- require adding a new block even if crowded, add arcs with the same source
- and dest which must always be instrumented. */
- for (i = 0; i < num_blocks; i++)
- {
- binfo = &bb_graph[i];
-
- for (arcptr = binfo->succ; arcptr; arcptr = arcptr->succ_next)
- if (! ((binfo->succ == arcptr && arcptr->succ_next == 0)
- || (bb_graph[ARC_TARGET (arcptr)].pred
- && arcptr->pred_next == 0))
- && ! arcptr->fall_through
- && ARC_TARGET (arcptr) != i)
- {
- /* This is a crowded arc at both source and target. Try to put
- in on the spanning tree. Can do this if either the source or
- target block is not yet on the tree. */
- if (! bb_graph[ARC_TARGET (arcptr)].on_tree || ! binfo->on_tree)
- {
- arcptr->on_tree = 1;
- bb_graph[ARC_TARGET (arcptr)].on_tree = 1;
- binfo->on_tree = 1;
- }
- }
- }
-
- /* Clear all of the basic block on_tree bits, so that we can use them to
- create the spanning tree. */
- for (i = 0; i < num_blocks; i++)
- bb_graph[i].on_tree = 0;
-
- /* Now fill in the spanning tree until every basic block is on it.
- Don't put the 0 to 1 fall through arc on the tree, since it is
- always cheap to instrument, so start filling the tree from node 1. */
-
- for (i = 1; i < num_blocks; i++)
- for (arcptr = bb_graph[i].succ; arcptr; arcptr = arcptr->succ_next)
- if (! arcptr->on_tree
- && ! bb_graph[ARC_TARGET (arcptr)].on_tree)
- {
- fill_spanning_tree (i);
- break;
- }
-}
-
-/* Add arcs reached from BLOCK to the spanning tree if they are needed and
- not already there. */
-
-static void
-fill_spanning_tree (block)
- int block;
-{
- struct adj_list *arcptr;
-
- expand_spanning_tree (block);
-
- for (arcptr = bb_graph[block].succ; arcptr; arcptr = arcptr->succ_next)
- if (! arcptr->on_tree
- && ! bb_graph[ARC_TARGET (arcptr)].on_tree)
- {
- arcptr->on_tree = 1;
- fill_spanning_tree (ARC_TARGET (arcptr));
- }
-}
-
-/* When first visit a block, must add all blocks that are already connected
- to this block via tree arcs to the spanning tree. */
-
-static void
-expand_spanning_tree (block)
- int block;
-{
- struct adj_list *arcptr;
-
- bb_graph[block].on_tree = 1;
-
- for (arcptr = bb_graph[block].succ; arcptr; arcptr = arcptr->succ_next)
- if (arcptr->on_tree && ! bb_graph[ARC_TARGET (arcptr)].on_tree)
- expand_spanning_tree (ARC_TARGET (arcptr));
-
- for (arcptr = bb_graph[block].pred;
- arcptr; arcptr = arcptr->pred_next)
- if (arcptr->on_tree && ! bb_graph[ARC_SOURCE (arcptr)].on_tree)
- expand_spanning_tree (ARC_SOURCE (arcptr));
-}
-
-/* Perform file-level initialization for branch-prob processing. */
-
-void
-init_branch_prob (filename)
- char *filename;
-{
- long len;
- int i;
-
- if (flag_test_coverage)
- {
- /* Open an output file for the basic block/line number map. */
- int len = strlen (filename);
- char *data_file = (char *) alloca (len + 4);
- strcpy (data_file, filename);
- strip_off_ending (data_file, len);
- strcat (data_file, ".bb");
- if ((bb_file = fopen (data_file, "w")) == 0)
- pfatal_with_name (data_file);
-
- /* Open an output file for the program flow graph. */
- len = strlen (filename);
- bbg_file_name = (char *) alloca (len + 5);
- strcpy (bbg_file_name, filename);
- strip_off_ending (bbg_file_name, len);
- strcat (bbg_file_name, ".bbg");
- if ((bbg_file = fopen (bbg_file_name, "w")) == 0)
- pfatal_with_name (bbg_file_name);
-
- /* Initialize to zero, to ensure that the first file name will be
- written to the .bb file. */
- last_bb_file_name = 0;
- }
-
- if (flag_branch_probabilities)
- {
- len = strlen (filename);
- da_file_name = (char *) alloca (len + 4);
- strcpy (da_file_name, filename);
- strip_off_ending (da_file_name, len);
- strcat (da_file_name, ".da");
- if ((da_file = fopen (da_file_name, "r")) == 0)
- warning ("file %s not found, execution counts assumed to be zero.",
- da_file_name);
-
- /* The first word in the .da file gives the number of instrumented arcs,
- which is not needed for our purposes. */
-
- if (da_file)
- __read_long (&len, da_file, 8);
- }
-
- if (profile_arc_flag)
- init_arc_profiler ();
-
- total_num_blocks = 0;
- total_num_arcs = 0;
- total_num_arcs_instrumented = 0;
- total_num_blocks_created = 0;
- total_num_passes = 0;
- total_num_times_called = 0;
- total_num_branches = 0;
- total_num_never_executed = 0;
- for (i = 0; i < 20; i++)
- total_hist_br_prob[i] = 0;
-}
-
-/* Performs file-level cleanup after branch-prob processing
- is completed. */
-
-void
-end_branch_prob (dump_file)
- FILE *dump_file;
-{
- if (flag_test_coverage)
- {
- fclose (bb_file);
- fclose (bbg_file);
- }
-
- if (flag_branch_probabilities)
- {
- if (da_file)
- {
- long temp;
- /* This seems slightly dangerous, as it presumes the EOF
- flag will not be set until an attempt is made to read
- past the end of the file. */
- if (feof (da_file))
- warning (".da file contents exhausted too early\n");
- /* Should be at end of file now. */
- if (__read_long (&temp, da_file, 8) == 0)
- warning (".da file contents not exhausted\n");
- fclose (da_file);
- }
- }
-
- if (dump_file)
- {
- fprintf (dump_file, "\n");
- fprintf (dump_file, "Total number of blocks: %d\n", total_num_blocks);
- fprintf (dump_file, "Total number of arcs: %d\n", total_num_arcs);
- fprintf (dump_file, "Total number of instrumented arcs: %d\n",
- total_num_arcs_instrumented);
- fprintf (dump_file, "Total number of blocks created: %d\n",
- total_num_blocks_created);
- fprintf (dump_file, "Total number of graph solution passes: %d\n",
- total_num_passes);
- if (total_num_times_called != 0)
- fprintf (dump_file, "Average number of graph solution passes: %d\n",
- (total_num_passes + (total_num_times_called >> 1))
- / total_num_times_called);
- fprintf (dump_file, "Total number of branches: %d\n", total_num_branches);
- fprintf (dump_file, "Total number of branches never executed: %d\n",
- total_num_never_executed);
- if (total_num_branches)
- {
- int i;
-
- for (i = 0; i < 10; i++)
- fprintf (dump_file, "%d%% branches in range %d-%d%%\n",
- (total_hist_br_prob[i] + total_hist_br_prob[19-i]) * 100
- / total_num_branches, 5*i, 5*i+5);
- }
- }
-}
-
-/* The label used by the arc profiling code. */
-
-static rtx profiler_label;
-
-/* Initialize the profiler_label. */
-
-static void
-init_arc_profiler ()
-{
- /* Generate and save a copy of this so it can be shared. */
- char *name = xmalloc (20);
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 2);
- profiler_label = gen_rtx (SYMBOL_REF, Pmode, name);
-}
-
-/* Output instructions as RTL to increment the arc execution count. */
-
-static void
-output_arc_profiler (arcno, insert_after)
- int arcno;
- rtx insert_after;
-{
- rtx profiler_target_addr
- = (arcno
- ? gen_rtx (CONST, Pmode,
- gen_rtx (PLUS, Pmode, profiler_label,
- gen_rtx (CONST_INT, VOIDmode,
- LONG_TYPE_SIZE / BITS_PER_UNIT * arcno)))
- : profiler_label);
- enum machine_mode mode = mode_for_size (LONG_TYPE_SIZE, MODE_INT, 0);
- rtx profiler_reg = gen_reg_rtx (mode);
- rtx address_reg = gen_reg_rtx (Pmode);
- rtx mem_ref, add_ref;
- rtx sequence;
-
-#ifdef SMALL_REGISTER_CLASSES
- /* In this case, reload can use explicitly mentioned hard registers for
- reloads. It is not safe to output profiling code between a call
- and the instruction that copies the result to a pseudo-reg. This
- is because reload may allocate one of the profiling code pseudo-regs
- to the return value reg, thus clobbering the return value. So we
- must check for calls here, and emit the profiling code after the
- instruction that uses the return value, if any.
-
- ??? The code here performs the same tests that reload does so hopefully
- all the bases are covered. */
-
- if (SMALL_REGISTER_CLASSES
- && GET_CODE (insert_after) == CALL_INSN
- && (GET_CODE (PATTERN (insert_after)) == SET
- || (GET_CODE (PATTERN (insert_after)) == PARALLEL
- && GET_CODE (XVECEXP (PATTERN (insert_after), 0, 0)) == SET)))
- {
- rtx return_reg;
- rtx next_insert_after = next_nonnote_insn (insert_after);
-
- if (GET_CODE (next_insert_after) == INSN)
- {
- /* The first insn after the call may be a stack pop, skip it. */
- if (GET_CODE (PATTERN (next_insert_after)) == SET
- && SET_DEST (PATTERN (next_insert_after)) == stack_pointer_rtx)
- next_insert_after = next_nonnote_insn (next_insert_after);
-
- if (GET_CODE (PATTERN (insert_after)) == SET)
- return_reg = SET_DEST (PATTERN (insert_after));
- else
- return_reg = SET_DEST (XVECEXP (PATTERN (insert_after), 0, 0));
-
- if (reg_referenced_p (return_reg, PATTERN (next_insert_after)))
- insert_after = next_insert_after;
- }
- }
-#endif
-
- start_sequence ();
-
- emit_move_insn (address_reg, profiler_target_addr);
- mem_ref = gen_rtx (MEM, mode, address_reg);
- emit_move_insn (profiler_reg, mem_ref);
-
- add_ref = gen_rtx (PLUS, mode, profiler_reg, GEN_INT (1));
- emit_move_insn (profiler_reg, add_ref);
-
- /* This is the same rtx as above, but it is not legal to share this rtx. */
- mem_ref = gen_rtx (MEM, mode, address_reg);
- emit_move_insn (mem_ref, profiler_reg);
-
- sequence = gen_sequence ();
- end_sequence ();
- emit_insn_after (sequence, insert_after);
-}
-
-/* Output code for a constructor that will invoke __bb_init_func, if
- this has not already been done. */
-
-void
-output_func_start_profiler ()
-{
- tree fnname, fndecl;
- char *name, *cfnname;
- rtx table_address;
- enum machine_mode mode = mode_for_size (LONG_TYPE_SIZE, MODE_INT, 0);
-
- /* It's either already been output, or we don't need it because we're
- not doing profile-arcs. */
- if (! need_func_profiler)
- return;
-
- need_func_profiler = 0;
-
- /* Synthesize a constructor function to invoke __bb_init_func with a
- pointer to this object file's profile block. */
- start_sequence ();
-
- /* Try and make a unique name given the "file function name".
-
- And no, I don't like this either. */
-
- fnname = get_file_function_name ('I');
- cfnname = IDENTIFIER_POINTER (fnname);
- name = xmalloc (strlen (cfnname) + 5);
- sprintf (name, "%sGCOV",cfnname);
- fnname = get_identifier (name);
- free (name);
-
- fndecl = build_decl (FUNCTION_DECL, fnname,
- build_function_type (void_type_node, NULL_TREE));
- DECL_EXTERNAL (fndecl) = 1;
- TREE_PUBLIC (fndecl) = 1;
- DECL_ASSEMBLER_NAME (fndecl) = fnname;
- DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
- current_function_decl = fndecl;
- pushlevel (0);
- make_function_rtl (fndecl);
- init_function_start (fndecl, input_filename, lineno);
- expand_function_start (fndecl, 0);
-
- /* Actually generate the code to call __bb_init_func. */
- name = xmalloc (20);
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 0);
- table_address = force_reg (Pmode, gen_rtx (SYMBOL_REF, Pmode, name));
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__bb_init_func"), 0,
- mode, 1, table_address, Pmode);
-
- expand_function_end (input_filename, lineno, 0);
- poplevel (1, 0, 1);
- rest_of_compilation (fndecl);
- fflush (asm_out_file);
- current_function_decl = NULL_TREE;
-
- assemble_constructor (IDENTIFIER_POINTER (DECL_NAME (fndecl)));
-}
diff --git a/gcc/protoize.c b/gcc/protoize.c
deleted file mode 100644
index 4c77c56b201..00000000000
--- a/gcc/protoize.c
+++ /dev/null
@@ -1,4708 +0,0 @@
-/* Protoize program - Original version by Ron Guilmette (rfg@segfault.us.com).
- Copyright (C) 1989, 92-95, 1996 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. */
-
-/* Any reasonable C++ compiler should have all of the same features
- as __STDC__ plus more, so make sure that __STDC__ is defined if
- __cplusplus is defined. */
-
-#if defined(__cplusplus) && !defined(__STDC__)
-#define __STDC__ 1
-#endif /* defined(__cplusplus) && !defined(__STDC__) */
-
-#if defined(__GNUC__) || defined (__GNUG__)
-#define VOLATILE volatile
-#else
-#define VOLATILE
-#endif
-
-#ifndef __STDC__
-#define const
-#define volatile
-#endif
-
-#include "config.h"
-
-#if 0
-/* Users are not supposed to use _POSIX_SOURCE to say the
- system is a POSIX system. That is not what _POSIX_SOURCE means! -- rms */
-/* If the user asked for POSIX via _POSIX_SOURCE, turn on POSIX code. */
-#if defined(_POSIX_SOURCE) && !defined(POSIX)
-#define POSIX
-#endif
-#endif /* 0 */
-
-#ifdef POSIX /* We should be able to define _POSIX_SOURCE unconditionally,
- but some systems respond in buggy ways to it,
- including SunOS 4.1.1. Which we don't classify as POSIX. */
-/* In case this is a POSIX system with an ANSI C compiler,
- ask for definition of all POSIX facilities. */
-#undef _POSIX_SOURCE
-#define _POSIX_SOURCE
-#endif
-
-#include <varargs.h>
-/* On some systems stdio.h includes stdarg.h;
- we must bring in varargs.h first. */
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if ! defined (_WIN32) || defined (__CYGWIN32__)
-#if defined(POSIX) || defined(CONCURRENT)
-#include <dirent.h>
-#else
-#include <sys/dir.h>
-#endif
-#endif
-#include <setjmp.h>
-
-#include "gansidecl.h"
-
-/* Include getopt.h for the sake of getopt_long.
- We don't need the declaration of getopt, and it could conflict
- with something from a system header file, so effectively nullify that. */
-#define getopt getopt_loser
-#include "getopt.h"
-#undef getopt
-
-#ifndef errno
-extern int errno;
-#endif
-
-#ifndef HAVE_STRERROR
-extern int sys_nerr;
-#if defined(bsd4_4)
-extern const char *const sys_errlist[];
-#else
-extern char *sys_errlist[];
-#endif
-#else
-extern char *strerror();
-#endif
-
-extern char *version_string;
-
-/* Systems which are compatible only with POSIX 1003.1-1988 (but *not*
- with POSIX 1003.1-1990), e.g. Ultrix 4.2, might not have
- const qualifiers in the prototypes in the system include files.
- Unfortunately, this can lead to GCC issuing lots of warnings for
- calls to the following functions. To eliminate these warnings we
- provide the following #defines. */
-
-#define my_access(file,flag) access((char *)file, flag)
-#define my_stat(file,pkt) stat((char *)file, pkt)
-#define my_link(file1, file2) link((char *)file1, (char *)file2)
-#define my_unlink(file) unlink((char *)file)
-#define my_open(file, mode, flag) open((char *)file, mode, flag)
-#define my_chmod(file, mode) chmod((char *)file, mode)
-
-extern char *getpwd ();
-
-extern char *choose_temp_base PROTO ((void));
-
-extern int pexecute PROTO ((const char *, char * const *, const char *,
- const char *, char **, char **, int));
-extern int pwait PROTO ((int, int *, int));
-/* Flag arguments to pexecute. */
-#define PEXECUTE_FIRST 1
-#define PEXECUTE_LAST 2
-#define PEXECUTE_SEARCH 4
-
-/* Aliases for pointers to void.
- These were made to facilitate compilation with old brain-dead DEC C
- compilers which didn't properly grok `void*' types. */
-
-#ifdef __STDC__
-typedef void * pointer_type;
-typedef const void * const_pointer_type;
-#else
-typedef char * pointer_type;
-typedef char * const_pointer_type;
-#endif
-
-#if defined(POSIX)
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-
-#else /* !defined(POSIX) */
-
-#define R_OK 4 /* Test for Read permission */
-#define W_OK 2 /* Test for Write permission */
-#define X_OK 1 /* Test for eXecute permission */
-#define F_OK 0 /* Test for existence of File */
-
-#ifndef O_RDONLY
-#define O_RDONLY 0
-#endif
-
-#ifndef O_WRONLY
-#define O_WRONLY 1
-#endif
-
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
-#endif
-#ifndef WTERMSIG
-#define WTERMSIG(S) ((S) & 0x7f)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(S) (((S) & 0xff) == 0)
-#endif
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
-#endif
-
-/* Declaring stat or __flsbuf with a prototype
- causes conflicts with system headers on some systems. */
-
-#ifndef abort
-typedef void voidfn ();
-extern VOLATILE voidfn abort;
-#endif
-extern int creat ();
-#if 0 /* These conflict with stdio.h on some systems. */
-extern int fprintf (FILE *, const char *, ...);
-extern int printf (const char *, ...);
-extern int open (const char *, int, ...);
-#endif /* 0 */
-extern void exit ();
-extern void free ();
-extern int read ();
-extern int write ();
-extern int close ();
-extern int fflush ();
-extern int atoi ();
-extern int puts ();
-extern int fputs ();
-extern int fputc ();
-extern int link ();
-extern int unlink ();
-extern int access ();
-
-#if 0 /* size_t from sys/types.h may fail to match GCC.
- If so, we would get a warning from this. */
-extern size_t strlen ()
-#endif
-
-/* Fork is not declared because the declaration caused a conflict
- on the HPPA. */
-#if !(defined (USG) || defined (VMS))
-#define fork vfork
-#endif /* (defined (USG) || defined (VMS)) */
-
-#endif /* !defined (POSIX) */
-
-extern char *rindex ();
-
-/* Look for these where the `const' qualifier is intentionally cast aside. */
-
-#define NONCONST
-
-/* Define a STRINGIFY macro that's right for ANSI or traditional C. */
-
-#ifdef __STDC__
-#define STRINGIFY(STRING) #STRING
-#else
-#define STRINGIFY(STRING) "STRING"
-#endif
-
-/* Define a default place to find the SYSCALLS.X file. */
-
-#ifndef STD_PROTO_DIR
-#define STD_PROTO_DIR "/usr/local/lib"
-#endif /* !defined (STD_PROTO_DIR) */
-
-/* Suffix of aux_info files. */
-
-static const char * const aux_info_suffix = ".X";
-
-/* String to attach to filenames for saved versions of original files. */
-
-static const char * const save_suffix = ".save";
-
-#ifndef UNPROTOIZE
-
-/* File name of the file which contains descriptions of standard system
- routines. Note that we never actually do anything with this file per se,
- but we do read in its corresponding aux_info file. */
-
-static const char syscalls_filename[] = "SYSCALLS.c";
-
-/* Default place to find the above file. */
-
-static const char * const default_syscalls_dir = STD_PROTO_DIR;
-
-/* Variable to hold the complete absolutized filename of the SYSCALLS.c.X
- file. */
-
-static char * syscalls_absolute_filename;
-
-#endif /* !defined (UNPROTOIZE) */
-
-/* Type of the structure that holds information about macro unexpansions. */
-
-struct unexpansion_struct {
- const char *expanded;
- const char *contracted;
-};
-typedef struct unexpansion_struct unexpansion;
-
-/* A table of conversions that may need to be made for some (stupid) older
- operating systems where these types are preprocessor macros rather than
- typedefs (as they really ought to be).
-
- WARNING: The contracted forms must be as small (or smaller) as the
- expanded forms, or else havoc will ensue. */
-
-static const unexpansion unexpansions[] = {
- { "struct _iobuf", "FILE" },
- { 0, 0 }
-};
-
-/* The number of "primary" slots in the hash tables for filenames and for
- function names. This can be as big or as small as you like, except that
- it must be a power of two. */
-
-#define HASH_TABLE_SIZE (1 << 9)
-
-/* Bit mask to use when computing hash values. */
-
-static const int hash_mask = (HASH_TABLE_SIZE - 1);
-
-/* Make a table of default system include directories
- just as it is done in cccp.c. */
-
-#ifndef STANDARD_INCLUDE_DIR
-#define STANDARD_INCLUDE_DIR "/usr/include"
-#endif
-
-#ifndef LOCAL_INCLUDE_DIR
-#define LOCAL_INCLUDE_DIR "/usr/local/include"
-#endif
-
-struct default_include { const char *fname; int x1, x2; } include_defaults[]
-#ifdef INCLUDE_DEFAULTS
- = INCLUDE_DEFAULTS;
-#else
- = {
- /* Pick up GNU C++ specific include files. */
- { GPLUSPLUS_INCLUDE_DIR, 1, 1 },
-#ifdef CROSS_COMPILE
- /* This is the dir for fixincludes. Put it just before
- the files that we fix. */
- { GCC_INCLUDE_DIR, 0, 0 },
- /* For cross-compilation, this dir name is generated
- automatically in Makefile.in. */
- { CROSS_INCLUDE_DIR, 0, 0 },
- /* This is another place that the target system's headers might be. */
- { TOOL_INCLUDE_DIR, 0, 0 },
-#else /* not CROSS_COMPILE */
- /* This should be /use/local/include and should come before
- the fixincludes-fixed header files. */
- { LOCAL_INCLUDE_DIR, 0, 1 },
- /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
- Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */
- { TOOL_INCLUDE_DIR, 0, 0 },
- /* This is the dir for fixincludes. Put it just before
- the files that we fix. */
- { GCC_INCLUDE_DIR, 0, 0 },
- /* Some systems have an extra dir of include files. */
-#ifdef SYSTEM_INCLUDE_DIR
- { SYSTEM_INCLUDE_DIR, 0, 0 },
-#endif
- { STANDARD_INCLUDE_DIR, 0, 0},
-#endif /* not CROSS_COMPILE */
- { 0, 0, 0}
- };
-#endif /* no INCLUDE_DEFAULTS */
-
-/* Datatype for lists of directories or filenames. */
-struct string_list
-{
- char *name;
- struct string_list *next;
-};
-
-/* List of directories in which files should be converted. */
-
-struct string_list *directory_list;
-
-/* List of file names which should not be converted.
- A file is excluded if the end of its name, following a /,
- matches one of the names in this list. */
-
-struct string_list *exclude_list;
-
-/* The name of the other style of variable-number-of-parameters functions
- (i.e. the style that we want to leave unconverted because we don't yet
- know how to convert them to this style. This string is used in warning
- messages. */
-
-/* Also define here the string that we can search for in the parameter lists
- taken from the .X files which will unambiguously indicate that we have
- found a varargs style function. */
-
-#ifdef UNPROTOIZE
-static const char * const other_var_style = "stdarg";
-#else /* !defined (UNPROTOIZE) */
-static const char * const other_var_style = "varargs";
-/* Note that this is a string containing the expansion of va_alist.
- But in `main' we discard all but the first token. */
-static const char *varargs_style_indicator = STRINGIFY (va_alist);
-#endif /* !defined (UNPROTOIZE) */
-
-/* The following two types are used to create hash tables. In this program,
- there are two hash tables which are used to store and quickly lookup two
- different classes of strings. The first type of strings stored in the
- first hash table are absolute filenames of files which protoize needs to
- know about. The second type of strings (stored in the second hash table)
- are function names. It is this second class of strings which really
- inspired the use of the hash tables, because there may be a lot of them. */
-
-typedef struct hash_table_entry_struct hash_table_entry;
-
-/* Do some typedefs so that we don't have to write "struct" so often. */
-
-typedef struct def_dec_info_struct def_dec_info;
-typedef struct file_info_struct file_info;
-typedef struct f_list_chain_item_struct f_list_chain_item;
-
-/* In the struct below, note that the "_info" field has two different uses
- depending on the type of hash table we are in (i.e. either the filenames
- hash table or the function names hash table). In the filenames hash table
- the info fields of the entries point to the file_info struct which is
- associated with each filename (1 per filename). In the function names
- hash table, the info field points to the head of a singly linked list of
- def_dec_info entries which are all defs or decs of the function whose
- name is pointed to by the "symbol" field. Keeping all of the defs/decs
- for a given function name on a special list specifically for that function
- name makes it quick and easy to find out all of the important information
- about a given (named) function. */
-
-struct hash_table_entry_struct {
- hash_table_entry * hash_next; /* -> to secondary entries */
- const char * symbol; /* -> to the hashed string */
- union {
- const def_dec_info * _ddip;
- file_info * _fip;
- } _info;
-};
-#define ddip _info._ddip
-#define fip _info._fip
-
-/* Define a type specifically for our two hash tables. */
-
-typedef hash_table_entry hash_table[HASH_TABLE_SIZE];
-
-/* The following struct holds all of the important information about any
- single filename (e.g. file) which we need to know about. */
-
-struct file_info_struct {
- const hash_table_entry * hash_entry; /* -> to associated hash entry */
- const def_dec_info * defs_decs; /* -> to chain of defs/decs */
- time_t mtime; /* Time of last modification. */
-};
-
-/* Due to the possibility that functions may return pointers to functions,
- (which may themselves have their own parameter lists) and due to the
- fact that returned pointers-to-functions may be of type "pointer-to-
- function-returning-pointer-to-function" (ad nauseum) we have to keep
- an entire chain of ANSI style formal parameter lists for each function.
-
- Normally, for any given function, there will only be one formals list
- on the chain, but you never know.
-
- Note that the head of each chain of formals lists is pointed to by the
- `f_list_chain' field of the corresponding def_dec_info record.
-
- For any given chain, the item at the head of the chain is the *leftmost*
- parameter list seen in the actual C language function declaration. If
- there are other members of the chain, then these are linked in left-to-right
- order from the head of the chain. */
-
-struct f_list_chain_item_struct {
- const f_list_chain_item * chain_next; /* -> to next item on chain */
- const char * formals_list; /* -> to formals list string */
-};
-
-/* The following struct holds all of the important information about any
- single function definition or declaration which we need to know about.
- Note that for unprotoize we don't need to know very much because we
- never even create records for stuff that we don't intend to convert
- (like for instance defs and decs which are already in old K&R format
- and "implicit" function declarations). */
-
-struct def_dec_info_struct {
- const def_dec_info * next_in_file; /* -> to rest of chain for file */
- file_info * file; /* -> file_info for containing file */
- int line; /* source line number of def/dec */
- const char * ansi_decl; /* -> left end of ansi decl */
- hash_table_entry * hash_entry; /* -> hash entry for function name */
- unsigned int is_func_def; /* = 0 means this is a declaration */
- const def_dec_info * next_for_func; /* -> to rest of chain for func name */
- unsigned int f_list_count; /* count of formals lists we expect */
- char prototyped; /* = 0 means already prototyped */
-#ifndef UNPROTOIZE
- const f_list_chain_item * f_list_chain; /* -> chain of formals lists */
- const def_dec_info * definition; /* -> def/dec containing related def */
- char is_static; /* = 0 means visibility is "extern" */
- char is_implicit; /* != 0 for implicit func decl's */
- char written; /* != 0 means written for implicit */
-#else /* !defined (UNPROTOIZE) */
- const char * formal_names; /* -> to list of names of formals */
- const char * formal_decls; /* -> to string of formal declarations */
-#endif /* !defined (UNPROTOIZE) */
-};
-
-/* Pointer to the tail component of the filename by which this program was
- invoked. Used everywhere in error and warning messages. */
-
-static const char *pname;
-
-/* Error counter. Will be non-zero if we should give up at the next convenient
- stopping point. */
-
-static int errors = 0;
-
-/* Option flags. */
-/* ??? These comments should say what the flag mean as well as the options
- that set them. */
-
-/* File name to use for running gcc. Allows GCC 2 to be named
- something other than gcc. */
-static const char *compiler_file_name = "gcc";
-
-static int version_flag = 0; /* Print our version number. */
-static int quiet_flag = 0; /* Don't print messages normally. */
-static int nochange_flag = 0; /* Don't convert, just say what files
- we would have converted. */
-static int nosave_flag = 0; /* Don't save the old version. */
-static int keep_flag = 0; /* Don't delete the .X files. */
-static const char ** compile_params = 0; /* Option string for gcc. */
-#ifdef UNPROTOIZE
-static const char *indent_string = " "; /* Indentation for newly
- inserted parm decls. */
-#else /* !defined (UNPROTOIZE) */
-static int local_flag = 0; /* Insert new local decls (when?). */
-static int global_flag = 0; /* set by -g option */
-static int cplusplus_flag = 0; /* Rename converted files to *.C. */
-static const char *nondefault_syscalls_dir = 0; /* Dir to look for
- SYSCALLS.c.X in. */
-#endif /* !defined (UNPROTOIZE) */
-
-/* An index into the compile_params array where we should insert the source
- file name when we are ready to exec the C compiler. A zero value indicates
- that we have not yet called munge_compile_params. */
-
-static int input_file_name_index = 0;
-
-/* An index into the compile_params array where we should insert the filename
- for the aux info file, when we run the C compiler. */
-static int aux_info_file_name_index = 0;
-
-/* Count of command line arguments which were "filename" arguments. */
-
-static int n_base_source_files = 0;
-
-/* Points to a malloc'ed list of pointers to all of the filenames of base
- source files which were specified on the command line. */
-
-static const char **base_source_filenames;
-
-/* Line number of the line within the current aux_info file that we
- are currently processing. Used for error messages in case the prototypes
- info file is corrupted somehow. */
-
-static int current_aux_info_lineno;
-
-/* Pointer to the name of the source file currently being converted. */
-
-static const char *convert_filename;
-
-/* Pointer to relative root string (taken from aux_info file) which indicates
- where directory the user was in when he did the compilation step that
- produced the containing aux_info file. */
-
-static const char *invocation_filename;
-
-/* Pointer to the base of the input buffer that holds the original text for the
- source file currently being converted. */
-
-static const char *orig_text_base;
-
-/* Pointer to the byte just beyond the end of the input buffer that holds the
- original text for the source file currently being converted. */
-
-static const char *orig_text_limit;
-
-/* Pointer to the base of the input buffer that holds the cleaned text for the
- source file currently being converted. */
-
-static const char *clean_text_base;
-
-/* Pointer to the byte just beyond the end of the input buffer that holds the
- cleaned text for the source file currently being converted. */
-
-static const char *clean_text_limit;
-
-/* Pointer to the last byte in the cleaned text buffer that we have already
- (virtually) copied to the output buffer (or decided to ignore). */
-
-static const char * clean_read_ptr;
-
-/* Pointer to the base of the output buffer that holds the replacement text
- for the source file currently being converted. */
-
-static char *repl_text_base;
-
-/* Pointer to the byte just beyond the end of the output buffer that holds the
- replacement text for the source file currently being converted. */
-
-static char *repl_text_limit;
-
-/* Pointer to the last byte which has been stored into the output buffer.
- The next byte to be stored should be stored just past where this points
- to. */
-
-static char * repl_write_ptr;
-
-/* Pointer into the cleaned text buffer for the source file we are currently
- converting. This points to the first character of the line that we last
- did a "seek_to_line" to (see below). */
-
-static const char *last_known_line_start;
-
-/* Number of the line (in the cleaned text buffer) that we last did a
- "seek_to_line" to. Will be one if we just read a new source file
- into the cleaned text buffer. */
-
-static int last_known_line_number;
-
-/* The filenames hash table. */
-
-static hash_table filename_primary;
-
-/* The function names hash table. */
-
-static hash_table function_name_primary;
-
-/* The place to keep the recovery address which is used only in cases where
- we get hopelessly confused by something in the cleaned original text. */
-
-static jmp_buf source_confusion_recovery;
-
-/* A pointer to the current directory filename (used by abspath). */
-
-static char *cwd_buffer;
-
-/* A place to save the read pointer until we are sure that an individual
- attempt at editing will succeed. */
-
-static const char * saved_clean_read_ptr;
-
-/* A place to save the write pointer until we are sure that an individual
- attempt at editing will succeed. */
-
-static char * saved_repl_write_ptr;
-
-/* Forward declaration. */
-
-static const char *shortpath ();
-
-char *
-my_strerror(e)
- int e;
-{
-
-#ifdef HAVE_STRERROR
- return strerror(e);
-
-#else
-
- static char buffer[30];
- if (!e)
- return "";
-
- if (e > 0 && e < sys_nerr)
- return sys_errlist[e];
-
- sprintf (buffer, "Unknown error %d", e);
- return buffer;
-#endif
-}
-
-/* Allocate some space, but check that the allocation was successful. */
-/* alloca.c uses this, so don't make it static. */
-
-pointer_type
-xmalloc (byte_count)
- size_t byte_count;
-{
- pointer_type rv;
-
- rv = (pointer_type) malloc (byte_count);
- if (rv == NULL)
- {
- fprintf (stderr, "\n%s: virtual memory exceeded\n", pname);
- exit (1);
- return 0; /* avoid warnings */
- }
- else
- return rv;
-}
-
-/* Reallocate some space, but check that the reallocation was successful. */
-
-pointer_type
-xrealloc (old_space, byte_count)
- pointer_type old_space;
- size_t byte_count;
-{
- pointer_type rv;
-
- rv = (pointer_type) realloc (old_space, byte_count);
- if (rv == NULL)
- {
- fprintf (stderr, "\n%s: virtual memory exceeded\n", pname);
- exit (1);
- return 0; /* avoid warnings */
- }
- else
- return rv;
-}
-
-/* Deallocate the area pointed to by an arbitrary pointer, but first, strip
- the `const' qualifier from it and also make sure that the pointer value
- is non-null. */
-
-void
-xfree (p)
- const_pointer_type p;
-{
- if (p)
- free ((NONCONST pointer_type) p);
-}
-
-/* Make a copy of a string INPUT with size SIZE. */
-
-static char *
-savestring (input, size)
- const char *input;
- unsigned int size;
-{
- char *output = (char *) xmalloc (size + 1);
- strcpy (output, input);
- return output;
-}
-
-/* Make a copy of the concatenation of INPUT1 and INPUT2. */
-
-static char *
-savestring2 (input1, size1, input2, size2)
- const char *input1;
- unsigned int size1;
- const char *input2;
- unsigned int size2;
-{
- char *output = (char *) xmalloc (size1 + size2 + 1);
- strcpy (output, input1);
- strcpy (&output[size1], input2);
- return output;
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing. */
-
-void
-fancy_abort ()
-{
- fprintf (stderr, "%s: internal abort\n", pname);
- exit (1);
-}
-
-/* Make a duplicate of the first N bytes of a given string in a newly
- allocated area. */
-
-static char *
-dupnstr (s, n)
- const char *s;
- size_t n;
-{
- char *ret_val = (char *) xmalloc (n + 1);
-
- strncpy (ret_val, s, n);
- ret_val[n] = '\0';
- return ret_val;
-}
-
-/* Return a pointer to the first occurrence of s2 within s1 or NULL if s2
- does not occur within s1. Assume neither s1 nor s2 are null pointers. */
-
-static const char *
-substr (s1, s2)
- const char *s1;
- const char *const s2;
-{
- for (; *s1 ; s1++)
- {
- const char *p1;
- const char *p2;
- int c;
-
- for (p1 = s1, p2 = s2; c = *p2; p1++, p2++)
- if (*p1 != c)
- goto outer;
- return s1;
-outer:
- ;
- }
- return 0;
-}
-
-/* Read LEN bytes at PTR from descriptor DESC, for file FILENAME,
- retrying if necessary. Return the actual number of bytes read. */
-
-static int
-safe_read (desc, ptr, len)
- int desc;
- char *ptr;
- int len;
-{
- int left = len;
- while (left > 0) {
- int nchars = read (desc, ptr, left);
- if (nchars < 0)
- {
-#ifdef EINTR
- if (errno == EINTR)
- continue;
-#endif
- return nchars;
- }
- if (nchars == 0)
- break;
- ptr += nchars;
- left -= nchars;
- }
- return len - left;
-}
-
-/* Write LEN bytes at PTR to descriptor DESC,
- retrying if necessary, and treating any real error as fatal. */
-
-static void
-safe_write (desc, ptr, len, out_fname)
- int desc;
- char *ptr;
- int len;
- char *out_fname;
-{
- while (len > 0) {
- int written = write (desc, ptr, len);
- if (written < 0)
- {
-#ifdef EINTR
- if (errno == EINTR)
- continue;
-#endif
- fprintf (stderr, "%s: error writing file `%s': %s\n",
- pname, shortpath (NULL, out_fname), my_strerror(errno));
- return;
- }
- ptr += written;
- len -= written;
- }
-}
-
-/* Get setup to recover in case the edit we are about to do goes awry. */
-
-void
-save_pointers ()
-{
- saved_clean_read_ptr = clean_read_ptr;
- saved_repl_write_ptr = repl_write_ptr;
-}
-
-/* Call this routine to recover our previous state whenever something looks
- too confusing in the source code we are trying to edit. */
-
-void
-restore_pointers ()
-{
- clean_read_ptr = saved_clean_read_ptr;
- repl_write_ptr = saved_repl_write_ptr;
-}
-
-/* Return true if the given character is a valid identifier character. */
-
-static int
-is_id_char (ch)
- char ch;
-{
- return (isalnum (ch) || (ch == '_') || (ch == '$'));
-}
-
-/* Give a message indicating the proper way to invoke this program and then
- exit with non-zero status. */
-
-static void
-usage ()
-{
-#ifdef UNPROTOIZE
- fprintf (stderr, "%s: usage '%s [ -VqfnkN ] [ -i <istring> ] [ filename ... ]'\n",
- pname, pname);
-#else /* !defined (UNPROTOIZE) */
- fprintf (stderr, "%s: usage '%s [ -VqfnkNlgC ] [ -B <dirname> ] [ filename ... ]'\n",
- pname, pname);
-#endif /* !defined (UNPROTOIZE) */
- exit (1);
-}
-
-/* Return true if the given filename (assumed to be an absolute filename)
- designates a file residing anywhere beneath any one of the "system"
- include directories. */
-
-static int
-in_system_include_dir (path)
- const char *path;
-{
- struct default_include *p;
-
- if (path[0] != '/')
- abort (); /* Must be an absolutized filename. */
-
- for (p = include_defaults; p->fname; p++)
- if (!strncmp (path, p->fname, strlen (p->fname))
- && path[strlen (p->fname)] == '/')
- return 1;
- return 0;
-}
-
-#if 0
-/* Return true if the given filename designates a file that the user has
- read access to and for which the user has write access to the containing
- directory. */
-
-static int
-file_could_be_converted (const char *path)
-{
- char *const dir_name = (char *) alloca (strlen (path) + 1);
-
- if (my_access (path, R_OK))
- return 0;
-
- {
- char *dir_last_slash;
-
- strcpy (dir_name, path);
- dir_last_slash = rindex (dir_name, '/');
- if (dir_last_slash)
- *dir_last_slash = '\0';
- else
- abort (); /* Should have been an absolutized filename. */
- }
-
- if (my_access (path, W_OK))
- return 0;
-
- return 1;
-}
-
-/* Return true if the given filename designates a file that we are allowed
- to modify. Files which we should not attempt to modify are (a) "system"
- include files, and (b) files which the user doesn't have write access to,
- and (c) files which reside in directories which the user doesn't have
- write access to. Unless requested to be quiet, give warnings about
- files that we will not try to convert for one reason or another. An
- exception is made for "system" include files, which we never try to
- convert and for which we don't issue the usual warnings. */
-
-static int
-file_normally_convertible (const char *path)
-{
- char *const dir_name = alloca (strlen (path) + 1);
-
- if (in_system_include_dir (path))
- return 0;
-
- {
- char *dir_last_slash;
-
- strcpy (dir_name, path);
- dir_last_slash = rindex (dir_name, '/');
- if (dir_last_slash)
- *dir_last_slash = '\0';
- else
- abort (); /* Should have been an absolutized filename. */
- }
-
- if (my_access (path, R_OK))
- {
- if (!quiet_flag)
- fprintf (stderr, "%s: warning: no read access for file `%s'\n",
- pname, shortpath (NULL, path));
- return 0;
- }
-
- if (my_access (path, W_OK))
- {
- if (!quiet_flag)
- fprintf (stderr, "%s: warning: no write access for file `%s'\n",
- pname, shortpath (NULL, path));
- return 0;
- }
-
- if (my_access (dir_name, W_OK))
- {
- if (!quiet_flag)
- fprintf (stderr, "%s: warning: no write access for dir containing `%s'\n",
- pname, shortpath (NULL, path));
- return 0;
- }
-
- return 1;
-}
-#endif /* 0 */
-
-#ifndef UNPROTOIZE
-
-/* Return true if the given file_info struct refers to the special SYSCALLS.c.X
- file. Return false otherwise. */
-
-static int
-is_syscalls_file (fi_p)
- const file_info *fi_p;
-{
- char const *f = fi_p->hash_entry->symbol;
- size_t fl = strlen (f), sysl = sizeof (syscalls_filename) - 1;
- return sysl <= fl && strcmp (f + fl - sysl, syscalls_filename) == 0;
-}
-
-#endif /* !defined (UNPROTOIZE) */
-
-/* Check to see if this file will need to have anything done to it on this
- run. If there is nothing in the given file which both needs conversion
- and for which we have the necessary stuff to do the conversion, return
- false. Otherwise, return true.
-
- Note that (for protoize) it is only valid to call this function *after*
- the connections between declarations and definitions have all been made
- by connect_defs_and_decs. */
-
-static int
-needs_to_be_converted (file_p)
- const file_info *file_p;
-{
- const def_dec_info *ddp;
-
-#ifndef UNPROTOIZE
-
- if (is_syscalls_file (file_p))
- return 0;
-
-#endif /* !defined (UNPROTOIZE) */
-
- for (ddp = file_p->defs_decs; ddp; ddp = ddp->next_in_file)
-
- if (
-
-#ifndef UNPROTOIZE
-
- /* ... and if we a protoizing and this function is in old style ... */
- !ddp->prototyped
- /* ... and if this a definition or is a decl with an associated def ... */
- && (ddp->is_func_def || (!ddp->is_func_def && ddp->definition))
-
-#else /* defined (UNPROTOIZE) */
-
- /* ... and if we are unprotoizing and this function is in new style ... */
- ddp->prototyped
-
-#endif /* defined (UNPROTOIZE) */
- )
- /* ... then the containing file needs converting. */
- return -1;
- return 0;
-}
-
-/* Return 1 if the file name NAME is in a directory
- that should be converted. */
-
-static int
-directory_specified_p (name)
- const char *name;
-{
- struct string_list *p;
-
- for (p = directory_list; p; p = p->next)
- if (!strncmp (name, p->name, strlen (p->name))
- && name[strlen (p->name)] == '/')
- {
- const char *q = name + strlen (p->name) + 1;
-
- /* If there are more slashes, it's in a subdir, so
- this match doesn't count. */
- while (*q)
- if (*q++ == '/')
- goto lose;
- return 1;
-
- lose: ;
- }
-
- return 0;
-}
-
-/* Return 1 if the file named NAME should be excluded from conversion. */
-
-static int
-file_excluded_p (name)
- const char *name;
-{
- struct string_list *p;
- int len = strlen (name);
-
- for (p = exclude_list; p; p = p->next)
- if (!strcmp (name + len - strlen (p->name), p->name)
- && name[len - strlen (p->name) - 1] == '/')
- return 1;
-
- return 0;
-}
-
-/* Construct a new element of a string_list.
- STRING is the new element value, and REST holds the remaining elements. */
-
-static struct string_list *
-string_list_cons (string, rest)
- char *string;
- struct string_list *rest;
-{
- struct string_list *temp
- = (struct string_list *) xmalloc (sizeof (struct string_list));
-
- temp->next = rest;
- temp->name = string;
- return temp;
-}
-
-/* ??? The GNU convention for mentioning function args in its comments
- is to capitalize them. So change "hash_tab_p" to HASH_TAB_P below.
- Likewise for all the other functions. */
-
-/* Given a hash table, apply some function to each node in the table. The
- table to traverse is given as the "hash_tab_p" argument, and the
- function to be applied to each node in the table is given as "func"
- argument. */
-
-static void
-visit_each_hash_node (hash_tab_p, func)
- const hash_table_entry *hash_tab_p;
- void (*func)();
-{
- const hash_table_entry *primary;
-
- for (primary = hash_tab_p; primary < &hash_tab_p[HASH_TABLE_SIZE]; primary++)
- if (primary->symbol)
- {
- hash_table_entry *second;
-
- (*func)(primary);
- for (second = primary->hash_next; second; second = second->hash_next)
- (*func) (second);
- }
-}
-
-/* Initialize all of the fields of a new hash table entry, pointed
- to by the "p" parameter. Note that the space to hold the entry
- is assumed to have already been allocated before this routine is
- called. */
-
-static hash_table_entry *
-add_symbol (p, s)
- hash_table_entry *p;
- const char *s;
-{
- p->hash_next = NULL;
- p->symbol = savestring (s, strlen (s));
- p->ddip = NULL;
- p->fip = NULL;
- return p;
-}
-
-/* Look for a particular function name or filename in the particular
- hash table indicated by "hash_tab_p". If the name is not in the
- given hash table, add it. Either way, return a pointer to the
- hash table entry for the given name. */
-
-static hash_table_entry *
-lookup (hash_tab_p, search_symbol)
- hash_table_entry *hash_tab_p;
- const char *search_symbol;
-{
- int hash_value = 0;
- const char *search_symbol_char_p = search_symbol;
- hash_table_entry *p;
-
- while (*search_symbol_char_p)
- hash_value += *search_symbol_char_p++;
- hash_value &= hash_mask;
- p = &hash_tab_p[hash_value];
- if (! p->symbol)
- return add_symbol (p, search_symbol);
- if (!strcmp (p->symbol, search_symbol))
- return p;
- while (p->hash_next)
- {
- p = p->hash_next;
- if (!strcmp (p->symbol, search_symbol))
- return p;
- }
- p->hash_next = (hash_table_entry *) xmalloc (sizeof (hash_table_entry));
- p = p->hash_next;
- return add_symbol (p, search_symbol);
-}
-
-/* Throw a def/dec record on the junk heap.
-
- Also, since we are not using this record anymore, free up all of the
- stuff it pointed to. */
-
-static void
-free_def_dec (p)
- def_dec_info *p;
-{
- xfree (p->ansi_decl);
-
-#ifndef UNPROTOIZE
- {
- const f_list_chain_item * curr;
- const f_list_chain_item * next;
-
- for (curr = p->f_list_chain; curr; curr = next)
- {
- next = curr->chain_next;
- xfree (curr);
- }
- }
-#endif /* !defined (UNPROTOIZE) */
-
- xfree (p);
-}
-
-/* Unexpand as many macro symbol as we can find.
-
- If the given line must be unexpanded, make a copy of it in the heap and
- return a pointer to the unexpanded copy. Otherwise return NULL. */
-
-static char *
-unexpand_if_needed (aux_info_line)
- const char *aux_info_line;
-{
- static char *line_buf = 0;
- static int line_buf_size = 0;
- const unexpansion *unexp_p;
- int got_unexpanded = 0;
- const char *s;
- char *copy_p = line_buf;
-
- if (line_buf == 0)
- {
- line_buf_size = 1024;
- line_buf = (char *) xmalloc (line_buf_size);
- }
-
- copy_p = line_buf;
-
- /* Make a copy of the input string in line_buf, expanding as necessary. */
-
- for (s = aux_info_line; *s != '\n'; )
- {
- for (unexp_p = unexpansions; unexp_p->expanded; unexp_p++)
- {
- const char *in_p = unexp_p->expanded;
- size_t len = strlen (in_p);
-
- if (*s == *in_p && !strncmp (s, in_p, len) && !is_id_char (s[len]))
- {
- int size = strlen (unexp_p->contracted);
- got_unexpanded = 1;
- if (copy_p + size - line_buf >= line_buf_size)
- {
- int offset = copy_p - line_buf;
- line_buf_size *= 2;
- line_buf_size += size;
- line_buf = (char *) xrealloc (line_buf, line_buf_size);
- copy_p = line_buf + offset;
- }
- strcpy (copy_p, unexp_p->contracted);
- copy_p += size;
-
- /* Assume the there will not be another replacement required
- within the text just replaced. */
-
- s += len;
- goto continue_outer;
- }
- }
- if (copy_p - line_buf == line_buf_size)
- {
- int offset = copy_p - line_buf;
- line_buf_size *= 2;
- line_buf = (char *) xrealloc (line_buf, line_buf_size);
- copy_p = line_buf + offset;
- }
- *copy_p++ = *s++;
-continue_outer: ;
- }
- if (copy_p + 2 - line_buf >= line_buf_size)
- {
- int offset = copy_p - line_buf;
- line_buf_size *= 2;
- line_buf = (char *) xrealloc (line_buf, line_buf_size);
- copy_p = line_buf + offset;
- }
- *copy_p++ = '\n';
- *copy_p = '\0';
-
- return (got_unexpanded ? savestring (line_buf, copy_p - line_buf) : 0);
-}
-
-/* Return the absolutized filename for the given relative
- filename. Note that if that filename is already absolute, it may
- still be returned in a modified form because this routine also
- eliminates redundant slashes and single dots and eliminates double
- dots to get a shortest possible filename from the given input
- filename. The absolutization of relative filenames is made by
- assuming that the given filename is to be taken as relative to
- the first argument (cwd) or to the current directory if cwd is
- NULL. */
-
-static char *
-abspath (cwd, rel_filename)
- const char *cwd;
- const char *rel_filename;
-{
- /* Setup the current working directory as needed. */
- const char *cwd2 = (cwd) ? cwd : cwd_buffer;
- char *const abs_buffer
- = (char *) alloca (strlen (cwd2) + strlen (rel_filename) + 2);
- char *endp = abs_buffer;
- char *outp, *inp;
-
- /* Copy the filename (possibly preceded by the current working
- directory name) into the absolutization buffer. */
-
- {
- const char *src_p;
-
- if (rel_filename[0] != '/')
- {
- src_p = cwd2;
- while (*endp++ = *src_p++)
- continue;
- *(endp-1) = '/'; /* overwrite null */
- }
- src_p = rel_filename;
- while (*endp++ = *src_p++)
- continue;
- }
-
- /* Now make a copy of abs_buffer into abs_buffer, shortening the
- filename (by taking out slashes and dots) as we go. */
-
- outp = inp = abs_buffer;
- *outp++ = *inp++; /* copy first slash */
-#ifdef apollo
- if (inp[0] == '/')
- *outp++ = *inp++; /* copy second slash */
-#endif
- for (;;)
- {
- if (!inp[0])
- break;
- else if (inp[0] == '/' && outp[-1] == '/')
- {
- inp++;
- continue;
- }
- else if (inp[0] == '.' && outp[-1] == '/')
- {
- if (!inp[1])
- break;
- else if (inp[1] == '/')
- {
- inp += 2;
- continue;
- }
- else if ((inp[1] == '.') && (inp[2] == 0 || inp[2] == '/'))
- {
- inp += (inp[2] == '/') ? 3 : 2;
- outp -= 2;
- while (outp >= abs_buffer && *outp != '/')
- outp--;
- if (outp < abs_buffer)
- {
- /* Catch cases like /.. where we try to backup to a
- point above the absolute root of the logical file
- system. */
-
- fprintf (stderr, "%s: invalid file name: %s\n",
- pname, rel_filename);
- exit (1);
- }
- *++outp = '\0';
- continue;
- }
- }
- *outp++ = *inp++;
- }
-
- /* On exit, make sure that there is a trailing null, and make sure that
- the last character of the returned string is *not* a slash. */
-
- *outp = '\0';
- if (outp[-1] == '/')
- *--outp = '\0';
-
- /* Make a copy (in the heap) of the stuff left in the absolutization
- buffer and return a pointer to the copy. */
-
- return savestring (abs_buffer, outp - abs_buffer);
-}
-
-/* Given a filename (and possibly a directory name from which the filename
- is relative) return a string which is the shortest possible
- equivalent for the corresponding full (absolutized) filename. The
- shortest possible equivalent may be constructed by converting the
- absolutized filename to be a relative filename (i.e. relative to
- the actual current working directory). However if a relative filename
- is longer, then the full absolute filename is returned.
-
- KNOWN BUG:
-
- Note that "simple-minded" conversion of any given type of filename (either
- relative or absolute) may not result in a valid equivalent filename if any
- subpart of the original filename is actually a symbolic link. */
-
-static const char *
-shortpath (cwd, filename)
- const char *cwd;
- const char *filename;
-{
- char *rel_buffer;
- char *rel_buf_p;
- char *cwd_p = cwd_buffer;
- char *path_p;
- int unmatched_slash_count = 0;
- size_t filename_len = strlen (filename);
-
- path_p = abspath (cwd, filename);
- rel_buf_p = rel_buffer = (char *) xmalloc (filename_len);
-
- while (*cwd_p && (*cwd_p == *path_p))
- {
- cwd_p++;
- path_p++;
- }
- if (!*cwd_p && (!*path_p || *path_p == '/')) /* whole pwd matched */
- {
- if (!*path_p) /* input *is* the current path! */
- return ".";
- else
- return ++path_p;
- }
- else
- {
- if (*path_p)
- {
- --cwd_p;
- --path_p;
- while (*cwd_p != '/') /* backup to last slash */
- {
- --cwd_p;
- --path_p;
- }
- cwd_p++;
- path_p++;
- unmatched_slash_count++;
- }
-
- /* Find out how many directory levels in cwd were *not* matched. */
- while (*cwd_p)
- if (*cwd_p++ == '/')
- unmatched_slash_count++;
-
- /* Now we know how long the "short name" will be.
- Reject it if longer than the input. */
- if (unmatched_slash_count * 3 + strlen (path_p) >= filename_len)
- return filename;
-
- /* For each of them, put a `../' at the beginning of the short name. */
- while (unmatched_slash_count--)
- {
- /* Give up if the result gets to be longer
- than the absolute path name. */
- if (rel_buffer + filename_len <= rel_buf_p + 3)
- return filename;
- *rel_buf_p++ = '.';
- *rel_buf_p++ = '.';
- *rel_buf_p++ = '/';
- }
-
- /* Then tack on the unmatched part of the desired file's name. */
- do
- {
- if (rel_buffer + filename_len <= rel_buf_p)
- return filename;
- }
- while (*rel_buf_p++ = *path_p++);
-
- --rel_buf_p;
- if (*(rel_buf_p-1) == '/')
- *--rel_buf_p = '\0';
- return rel_buffer;
- }
-}
-
-/* Lookup the given filename in the hash table for filenames. If it is a
- new one, then the hash table info pointer will be null. In this case,
- we create a new file_info record to go with the filename, and we initialize
- that record with some reasonable values. */
-
-/* FILENAME was const, but that causes a warning on AIX when calling stat.
- That is probably a bug in AIX, but might as well avoid the warning. */
-
-static file_info *
-find_file (filename, do_not_stat)
- char *filename;
- int do_not_stat;
-{
- hash_table_entry *hash_entry_p;
-
- hash_entry_p = lookup (filename_primary, filename);
- if (hash_entry_p->fip)
- return hash_entry_p->fip;
- else
- {
- struct stat stat_buf;
- file_info *file_p = (file_info *) xmalloc (sizeof (file_info));
-
- /* If we cannot get status on any given source file, give a warning
- and then just set its time of last modification to infinity. */
-
- if (do_not_stat)
- stat_buf.st_mtime = (time_t) 0;
- else
- {
- if (my_stat (filename, &stat_buf) == -1)
- {
- fprintf (stderr, "%s: %s: can't get status: %s\n",
- pname, shortpath (NULL, filename), my_strerror(errno));
- stat_buf.st_mtime = (time_t) -1;
- }
- }
-
- hash_entry_p->fip = file_p;
- file_p->hash_entry = hash_entry_p;
- file_p->defs_decs = NULL;
- file_p->mtime = stat_buf.st_mtime;
- return file_p;
- }
-}
-
-/* Generate a fatal error because some part of the aux_info file is
- messed up. */
-
-static void
-aux_info_corrupted ()
-{
- fprintf (stderr, "\n%s: fatal error: aux info file corrupted at line %d\n",
- pname, current_aux_info_lineno);
- exit (1);
-}
-
-/* ??? This comment is vague. Say what the condition is for. */
-/* Check to see that a condition is true. This is kind of like an assert. */
-
-static void
-check_aux_info (cond)
- int cond;
-{
- if (! cond)
- aux_info_corrupted ();
-}
-
-/* Given a pointer to the closing right parenthesis for a particular formals
- list (in an aux_info file) find the corresponding left parenthesis and
- return a pointer to it. */
-
-static const char *
-find_corresponding_lparen (p)
- const char *p;
-{
- const char *q;
- int paren_depth;
-
- for (paren_depth = 1, q = p-1; paren_depth; q--)
- {
- switch (*q)
- {
- case ')':
- paren_depth++;
- break;
- case '(':
- paren_depth--;
- break;
- }
- }
- return ++q;
-}
-
-/* Given a line from an aux info file, and a time at which the aux info
- file it came from was created, check to see if the item described in
- the line comes from a file which has been modified since the aux info
- file was created. If so, return non-zero, else return zero. */
-
-static int
-referenced_file_is_newer (l, aux_info_mtime)
- const char *l;
- time_t aux_info_mtime;
-{
- const char *p;
- file_info *fi_p;
- char *filename;
-
- check_aux_info (l[0] == '/');
- check_aux_info (l[1] == '*');
- check_aux_info (l[2] == ' ');
-
- {
- const char *filename_start = p = l + 3;
-
- while (*p != ':')
- p++;
- filename = (char *) alloca ((size_t) (p - filename_start) + 1);
- strncpy (filename, filename_start, (size_t) (p - filename_start));
- filename[p-filename_start] = '\0';
- }
-
- /* Call find_file to find the file_info record associated with the file
- which contained this particular def or dec item. Note that this call
- may cause a new file_info record to be created if this is the first time
- that we have ever known about this particular file. */
-
- fi_p = find_file (abspath (invocation_filename, filename), 0);
-
- return (fi_p->mtime > aux_info_mtime);
-}
-
-/* Given a line of info from the aux_info file, create a new
- def_dec_info record to remember all of the important information about
- a function definition or declaration.
-
- Link this record onto the list of such records for the particular file in
- which it occurred in proper (descending) line number order (for now).
-
- If there is an identical record already on the list for the file, throw
- this one away. Doing so takes care of the (useless and troublesome)
- duplicates which are bound to crop up due to multiple inclusions of any
- given individual header file.
-
- Finally, link the new def_dec record onto the list of such records
- pertaining to this particular function name. */
-
-static void
-save_def_or_dec (l, is_syscalls)
- const char *l;
- int is_syscalls;
-{
- const char *p;
- const char *semicolon_p;
- def_dec_info *def_dec_p = (def_dec_info *) xmalloc (sizeof (def_dec_info));
-
-#ifndef UNPROTOIZE
- def_dec_p->written = 0;
-#endif /* !defined (UNPROTOIZE) */
-
- /* Start processing the line by picking off 5 pieces of information from
- the left hand end of the line. These are filename, line number,
- new/old/implicit flag (new = ANSI prototype format), definition or
- declaration flag, and extern/static flag). */
-
- check_aux_info (l[0] == '/');
- check_aux_info (l[1] == '*');
- check_aux_info (l[2] == ' ');
-
- {
- const char *filename_start = p = l + 3;
- char *filename;
-
- while (*p != ':')
- p++;
- filename = (char *) alloca ((size_t) (p - filename_start) + 1);
- strncpy (filename, filename_start, (size_t) (p - filename_start));
- filename[p-filename_start] = '\0';
-
- /* Call find_file to find the file_info record associated with the file
- which contained this particular def or dec item. Note that this call
- may cause a new file_info record to be created if this is the first time
- that we have ever known about this particular file.
-
- Note that we started out by forcing all of the base source file names
- (i.e. the names of the aux_info files with the .X stripped off) into the
- filenames hash table, and we simultaneously setup file_info records for
- all of these base file names (even if they may be useless later).
- The file_info records for all of these "base" file names (properly)
- act as file_info records for the "original" (i.e. un-included) files
- which were submitted to gcc for compilation (when the -aux-info
- option was used). */
-
- def_dec_p->file = find_file (abspath (invocation_filename, filename), is_syscalls);
- }
-
- {
- const char *line_number_start = ++p;
- char line_number[10];
-
- while (*p != ':')
- p++;
- strncpy (line_number, line_number_start, (size_t) (p - line_number_start));
- line_number[p-line_number_start] = '\0';
- def_dec_p->line = atoi (line_number);
- }
-
- /* Check that this record describes a new-style, old-style, or implicit
- definition or declaration. */
-
- p++; /* Skip over the `:'. */
- check_aux_info ((*p == 'N') || (*p == 'O') || (*p == 'I'));
-
- /* Is this a new style (ANSI prototyped) definition or declaration? */
-
- def_dec_p->prototyped = (*p == 'N');
-
-#ifndef UNPROTOIZE
-
- /* Is this an implicit declaration? */
-
- def_dec_p->is_implicit = (*p == 'I');
-
-#endif /* !defined (UNPROTOIZE) */
-
- p++;
-
- check_aux_info ((*p == 'C') || (*p == 'F'));
-
- /* Is this item a function definition (F) or a declaration (C). Note that
- we treat item taken from the syscalls file as though they were function
- definitions regardless of what the stuff in the file says. */
-
- def_dec_p->is_func_def = ((*p++ == 'F') || is_syscalls);
-
-#ifndef UNPROTOIZE
- def_dec_p->definition = 0; /* Fill this in later if protoizing. */
-#endif /* !defined (UNPROTOIZE) */
-
- check_aux_info (*p++ == ' ');
- check_aux_info (*p++ == '*');
- check_aux_info (*p++ == '/');
- check_aux_info (*p++ == ' ');
-
-#ifdef UNPROTOIZE
- check_aux_info ((!strncmp (p, "static", 6)) || (!strncmp (p, "extern", 6)));
-#else /* !defined (UNPROTOIZE) */
- if (!strncmp (p, "static", 6))
- def_dec_p->is_static = -1;
- else if (!strncmp (p, "extern", 6))
- def_dec_p->is_static = 0;
- else
- check_aux_info (0); /* Didn't find either `extern' or `static'. */
-#endif /* !defined (UNPROTOIZE) */
-
- {
- const char *ansi_start = p;
-
- p += 6; /* Pass over the "static" or "extern". */
-
- /* We are now past the initial stuff. Search forward from here to find
- the terminating semicolon that should immediately follow the entire
- ANSI format function declaration. */
-
- while (*++p != ';')
- continue;
-
- semicolon_p = p;
-
- /* Make a copy of the ansi declaration part of the line from the aux_info
- file. */
-
- def_dec_p->ansi_decl
- = dupnstr (ansi_start, (size_t) ((semicolon_p+1) - ansi_start));
-
- /* Backup and point at the final right paren of the final argument list. */
-
- p--;
-
-#ifndef UNPROTOIZE
- def_dec_p->f_list_chain = NULL;
-#endif /* !defined (UNPROTOIZE) */
-
- while (p != ansi_start && (p[-1] == ' ' || p[-1] == '\t')) p--;
- if (*p != ')')
- {
- free_def_dec (def_dec_p);
- return;
- }
- }
-
- /* Now isolate a whole set of formal argument lists, one-by-one. Normally,
- there will only be one list to isolate, but there could be more. */
-
- def_dec_p->f_list_count = 0;
-
- for (;;)
- {
- const char *left_paren_p = find_corresponding_lparen (p);
-#ifndef UNPROTOIZE
- {
- f_list_chain_item *cip =
- (f_list_chain_item *) xmalloc (sizeof (f_list_chain_item));
-
- cip->formals_list
- = dupnstr (left_paren_p + 1, (size_t) (p - (left_paren_p+1)));
-
- /* Add the new chain item at the head of the current list. */
-
- cip->chain_next = def_dec_p->f_list_chain;
- def_dec_p->f_list_chain = cip;
- }
-#endif /* !defined (UNPROTOIZE) */
- def_dec_p->f_list_count++;
-
- p = left_paren_p - 2;
-
- /* p must now point either to another right paren, or to the last
- character of the name of the function that was declared/defined.
- If p points to another right paren, then this indicates that we
- are dealing with multiple formals lists. In that case, there
- really should be another right paren preceding this right paren. */
-
- if (*p != ')')
- break;
- else
- check_aux_info (*--p == ')');
- }
-
-
- {
- const char *past_fn = p + 1;
-
- check_aux_info (*past_fn == ' ');
-
- /* Scan leftwards over the identifier that names the function. */
-
- while (is_id_char (*p))
- p--;
- p++;
-
- /* p now points to the leftmost character of the function name. */
-
- {
- char *fn_string = (char *) alloca (past_fn - p + 1);
-
- strncpy (fn_string, p, (size_t) (past_fn - p));
- fn_string[past_fn-p] = '\0';
- def_dec_p->hash_entry = lookup (function_name_primary, fn_string);
- }
- }
-
- /* Look at all of the defs and decs for this function name that we have
- collected so far. If there is already one which is at the same
- line number in the same file, then we can discard this new def_dec_info
- record.
-
- As an extra assurance that any such pair of (nominally) identical
- function declarations are in fact identical, we also compare the
- ansi_decl parts of the lines from the aux_info files just to be on
- the safe side.
-
- This comparison will fail if (for instance) the user was playing
- messy games with the preprocessor which ultimately causes one
- function declaration in one header file to look differently when
- that file is included by two (or more) other files. */
-
- {
- const def_dec_info *other;
-
- for (other = def_dec_p->hash_entry->ddip; other; other = other->next_for_func)
- {
- if (def_dec_p->line == other->line && def_dec_p->file == other->file)
- {
- if (strcmp (def_dec_p->ansi_decl, other->ansi_decl))
- {
- fprintf (stderr, "%s:%d: declaration of function `%s' takes different forms\n",
- def_dec_p->file->hash_entry->symbol,
- def_dec_p->line,
- def_dec_p->hash_entry->symbol);
- exit (1);
- }
- free_def_dec (def_dec_p);
- return;
- }
- }
- }
-
-#ifdef UNPROTOIZE
-
- /* If we are doing unprotoizing, we must now setup the pointers that will
- point to the K&R name list and to the K&R argument declarations list.
-
- Note that if this is only a function declaration, then we should not
- expect to find any K&R style formals list following the ANSI-style
- formals list. This is because GCC knows that such information is
- useless in the case of function declarations (function definitions
- are a different story however).
-
- Since we are unprotoizing, we don't need any such lists anyway.
- All we plan to do is to delete all characters between ()'s in any
- case. */
-
- def_dec_p->formal_names = NULL;
- def_dec_p->formal_decls = NULL;
-
- if (def_dec_p->is_func_def)
- {
- p = semicolon_p;
- check_aux_info (*++p == ' ');
- check_aux_info (*++p == '/');
- check_aux_info (*++p == '*');
- check_aux_info (*++p == ' ');
- check_aux_info (*++p == '(');
-
- {
- const char *kr_names_start = ++p; /* Point just inside '('. */
-
- while (*p++ != ')')
- continue;
- p--; /* point to closing right paren */
-
- /* Make a copy of the K&R parameter names list. */
-
- def_dec_p->formal_names
- = dupnstr (kr_names_start, (size_t) (p - kr_names_start));
- }
-
- check_aux_info (*++p == ' ');
- p++;
-
- /* p now points to the first character of the K&R style declarations
- list (if there is one) or to the star-slash combination that ends
- the comment in which such lists get embedded. */
-
- /* Make a copy of the K&R formal decls list and set the def_dec record
- to point to it. */
-
- if (*p == '*') /* Are there no K&R declarations? */
- {
- check_aux_info (*++p == '/');
- def_dec_p->formal_decls = "";
- }
- else
- {
- const char *kr_decls_start = p;
-
- while (p[0] != '*' || p[1] != '/')
- p++;
- p--;
-
- check_aux_info (*p == ' ');
-
- def_dec_p->formal_decls
- = dupnstr (kr_decls_start, (size_t) (p - kr_decls_start));
- }
-
- /* Handle a special case. If we have a function definition marked as
- being in "old" style, and if it's formal names list is empty, then
- it may actually have the string "void" in its real formals list
- in the original source code. Just to make sure, we will get setup
- to convert such things anyway.
-
- This kludge only needs to be here because of an insurmountable
- problem with generating .X files. */
-
- if (!def_dec_p->prototyped && !*def_dec_p->formal_names)
- def_dec_p->prototyped = 1;
- }
-
- /* Since we are unprotoizing, if this item is already in old (K&R) style,
- we can just ignore it. If that is true, throw away the itme now. */
-
- if (!def_dec_p->prototyped)
- {
- free_def_dec (def_dec_p);
- return;
- }
-
-#endif /* defined (UNPROTOIZE) */
-
- /* Add this record to the head of the list of records pertaining to this
- particular function name. */
-
- def_dec_p->next_for_func = def_dec_p->hash_entry->ddip;
- def_dec_p->hash_entry->ddip = def_dec_p;
-
- /* Add this new def_dec_info record to the sorted list of def_dec_info
- records for this file. Note that we don't have to worry about duplicates
- (caused by multiple inclusions of header files) here because we have
- already eliminated duplicates above. */
-
- if (!def_dec_p->file->defs_decs)
- {
- def_dec_p->file->defs_decs = def_dec_p;
- def_dec_p->next_in_file = NULL;
- }
- else
- {
- int line = def_dec_p->line;
- const def_dec_info *prev = NULL;
- const def_dec_info *curr = def_dec_p->file->defs_decs;
- const def_dec_info *next = curr->next_in_file;
-
- while (next && (line < curr->line))
- {
- prev = curr;
- curr = next;
- next = next->next_in_file;
- }
- if (line >= curr->line)
- {
- def_dec_p->next_in_file = curr;
- if (prev)
- ((NONCONST def_dec_info *) prev)->next_in_file = def_dec_p;
- else
- def_dec_p->file->defs_decs = def_dec_p;
- }
- else /* assert (next == NULL); */
- {
- ((NONCONST def_dec_info *) curr)->next_in_file = def_dec_p;
- /* assert (next == NULL); */
- def_dec_p->next_in_file = next;
- }
- }
-}
-
-/* Set up the vector COMPILE_PARAMS which is the argument list for running GCC.
- Also set input_file_name_index and aux_info_file_name_index
- to the indices of the slots where the file names should go. */
-
-/* We initialize the vector by removing -g, -O, -S, -c, and -o options,
- and adding '-aux-info AUXFILE -S -o /dev/null INFILE' at the end. */
-
-static void
-munge_compile_params (params_list)
- const char *params_list;
-{
- /* Build up the contents in a temporary vector
- that is so big that to has to be big enough. */
- const char **temp_params
- = (const char **) alloca ((strlen (params_list) + 8) * sizeof (char *));
- int param_count = 0;
- const char *param;
-
- temp_params[param_count++] = compiler_file_name;
- for (;;)
- {
- while (isspace (*params_list))
- params_list++;
- if (!*params_list)
- break;
- param = params_list;
- while (*params_list && !isspace (*params_list))
- params_list++;
- if (param[0] != '-')
- temp_params[param_count++]
- = dupnstr (param, (size_t) (params_list - param));
- else
- {
- switch (param[1])
- {
- case 'g':
- case 'O':
- case 'S':
- case 'c':
- break; /* Don't copy these. */
- case 'o':
- while (isspace (*params_list))
- params_list++;
- while (*params_list && !isspace (*params_list))
- params_list++;
- break;
- default:
- temp_params[param_count++]
- = dupnstr (param, (size_t) (params_list - param));
- }
- }
- if (!*params_list)
- break;
- }
- temp_params[param_count++] = "-aux-info";
-
- /* Leave room for the aux-info file name argument. */
- aux_info_file_name_index = param_count;
- temp_params[param_count++] = NULL;
-
- temp_params[param_count++] = "-S";
- temp_params[param_count++] = "-o";
- temp_params[param_count++] = "/dev/null";
-
- /* Leave room for the input file name argument. */
- input_file_name_index = param_count;
- temp_params[param_count++] = NULL;
- /* Terminate the list. */
- temp_params[param_count++] = NULL;
-
- /* Make a copy of the compile_params in heap space. */
-
- compile_params
- = (const char **) xmalloc (sizeof (char *) * (param_count+1));
- memcpy (compile_params, temp_params, sizeof (char *) * param_count);
-}
-
-/* Do a recompilation for the express purpose of generating a new aux_info
- file to go with a specific base source file.
-
- The result is a boolean indicating success. */
-
-static int
-gen_aux_info_file (base_filename)
- const char *base_filename;
-{
- if (!input_file_name_index)
- munge_compile_params ("");
-
- /* Store the full source file name in the argument vector. */
- compile_params[input_file_name_index] = shortpath (NULL, base_filename);
- /* Add .X to source file name to get aux-info file name. */
- compile_params[aux_info_file_name_index]
- = savestring2 (compile_params[input_file_name_index],
- strlen (compile_params[input_file_name_index]),
- ".X",
- 2);
-
- if (!quiet_flag)
- fprintf (stderr, "%s: compiling `%s'\n",
- pname, compile_params[input_file_name_index]);
-
- {
- char *errmsg_fmt, *errmsg_arg;
- int wait_status, pid;
- char *temp_base = choose_temp_base ();
-
- pid = pexecute (compile_params[0], (char * const *) compile_params,
- pname, temp_base, &errmsg_fmt, &errmsg_arg,
- PEXECUTE_FIRST | PEXECUTE_LAST | PEXECUTE_SEARCH);
-
- if (pid == -1)
- {
- int errno_val = errno;
- fprintf (stderr, "%s: ", pname);
- fprintf (stderr, errmsg_fmt, errmsg_arg);
- fprintf (stderr, ": %s\n", my_strerror (errno_val));
- return 0;
- }
-
- pid = pwait (pid, &wait_status, 0);
- if (pid == -1)
- {
- fprintf (stderr, "%s: wait: %s\n", pname, my_strerror (errno));
- return 0;
- }
- if (WIFSIGNALED (wait_status))
- {
- fprintf (stderr, "%s: subprocess got fatal signal %d\n",
- pname, WTERMSIG (wait_status));
- return 0;
- }
- if (WIFEXITED (wait_status))
- {
- if (WEXITSTATUS (wait_status) != 0)
- {
- fprintf (stderr, "%s: %s exited with status %d\n",
- pname, compile_params[0], WEXITSTATUS (wait_status));
- return 0;
- }
- return 1;
- }
- abort ();
- }
-}
-
-/* Read in all of the information contained in a single aux_info file.
- Save all of the important stuff for later. */
-
-static void
-process_aux_info_file (base_source_filename, keep_it, is_syscalls)
- const char *base_source_filename;
- int keep_it;
- int is_syscalls;
-{
- size_t base_len = strlen (base_source_filename);
- char * aux_info_filename
- = (char *) alloca (base_len + strlen (aux_info_suffix) + 1);
- char *aux_info_base;
- char *aux_info_limit;
- char *aux_info_relocated_name;
- const char *aux_info_second_line;
- time_t aux_info_mtime;
- size_t aux_info_size;
- int must_create;
-
- /* Construct the aux_info filename from the base source filename. */
-
- strcpy (aux_info_filename, base_source_filename);
- strcat (aux_info_filename, aux_info_suffix);
-
- /* Check that the aux_info file exists and is readable. If it does not
- exist, try to create it (once only). */
-
- /* If file doesn't exist, set must_create.
- Likewise if it exists and we can read it but it is obsolete.
- Otherwise, report an error. */
- must_create = 0;
-
- /* Come here with must_create set to 1 if file is out of date. */
-start_over: ;
-
- if (my_access (aux_info_filename, R_OK) == -1)
- {
- if (errno == ENOENT)
- {
- if (is_syscalls)
- {
- fprintf (stderr, "%s: warning: missing SYSCALLS file `%s'\n",
- pname, aux_info_filename);
- return;
- }
- must_create = 1;
- }
- else
- {
- fprintf (stderr, "%s: can't read aux info file `%s': %s\n",
- pname, shortpath (NULL, aux_info_filename),
- my_strerror(errno));
- errors++;
- return;
- }
- }
-#if 0 /* There is code farther down to take care of this. */
- else
- {
- struct stat s1, s2;
- stat (aux_info_file_name, &s1);
- stat (base_source_file_name, &s2);
- if (s2.st_mtime > s1.st_mtime)
- must_create = 1;
- }
-#endif /* 0 */
-
- /* If we need a .X file, create it, and verify we can read it. */
- if (must_create)
- {
- if (!gen_aux_info_file (base_source_filename))
- {
- errors++;
- return;
- }
- if (my_access (aux_info_filename, R_OK) == -1)
- {
- fprintf (stderr, "%s: can't read aux info file `%s': %s\n",
- pname, shortpath (NULL, aux_info_filename),
- my_strerror(errno));
- errors++;
- return;
- }
- }
-
- {
- struct stat stat_buf;
-
- /* Get some status information about this aux_info file. */
-
- if (my_stat (aux_info_filename, &stat_buf) == -1)
- {
- fprintf (stderr, "%s: can't get status of aux info file `%s': %s\n",
- pname, shortpath (NULL, aux_info_filename),
- my_strerror(errno));
- errors++;
- return;
- }
-
- /* Check on whether or not this aux_info file is zero length. If it is,
- then just ignore it and return. */
-
- if ((aux_info_size = stat_buf.st_size) == 0)
- return;
-
- /* Get the date/time of last modification for this aux_info file and
- remember it. We will have to check that any source files that it
- contains information about are at least this old or older. */
-
- aux_info_mtime = stat_buf.st_mtime;
-
- if (!is_syscalls)
- {
- /* Compare mod time with the .c file; update .X file if obsolete.
- The code later on can fail to check the .c file
- if it did not directly define any functions. */
-
- if (my_stat (base_source_filename, &stat_buf) == -1)
- {
- fprintf (stderr, "%s: can't get status of aux info file `%s': %s\n",
- pname, shortpath (NULL, base_source_filename),
- my_strerror(errno));
- errors++;
- return;
- }
- if (stat_buf.st_mtime > aux_info_mtime)
- {
- must_create = 1;
- goto start_over;
- }
- }
- }
-
- {
- int aux_info_file;
-
- /* Open the aux_info file. */
-
- if ((aux_info_file = my_open (aux_info_filename, O_RDONLY, 0444 )) == -1)
- {
- fprintf (stderr, "%s: can't open aux info file `%s' for reading: %s\n",
- pname, shortpath (NULL, aux_info_filename),
- my_strerror(errno));
- return;
- }
-
- /* Allocate space to hold the aux_info file in memory. */
-
- aux_info_base = xmalloc (aux_info_size + 1);
- aux_info_limit = aux_info_base + aux_info_size;
- *aux_info_limit = '\0';
-
- /* Read the aux_info file into memory. */
-
- if (safe_read (aux_info_file, aux_info_base, aux_info_size) != aux_info_size)
- {
- fprintf (stderr, "%s: error reading aux info file `%s': %s\n",
- pname, shortpath (NULL, aux_info_filename),
- my_strerror(errno));
- free (aux_info_base);
- close (aux_info_file);
- return;
- }
-
- /* Close the aux info file. */
-
- if (close (aux_info_file))
- {
- fprintf (stderr, "%s: error closing aux info file `%s': %s\n",
- pname, shortpath (NULL, aux_info_filename),
- my_strerror(errno));
- free (aux_info_base);
- close (aux_info_file);
- return;
- }
- }
-
- /* Delete the aux_info file (unless requested not to). If the deletion
- fails for some reason, don't even worry about it. */
-
- if (must_create && !keep_it)
- if (my_unlink (aux_info_filename) == -1)
- fprintf (stderr, "%s: can't delete aux info file `%s': %s\n",
- pname, shortpath (NULL, aux_info_filename),
- my_strerror(errno));
-
- /* Save a pointer into the first line of the aux_info file which
- contains the filename of the directory from which the compiler
- was invoked when the associated source file was compiled.
- This information is used later to help create complete
- filenames out of the (potentially) relative filenames in
- the aux_info file. */
-
- {
- char *p = aux_info_base;
-
- while (*p != ':')
- p++;
- p++;
- while (*p == ' ')
- p++;
- invocation_filename = p; /* Save a pointer to first byte of path. */
- while (*p != ' ')
- p++;
- *p++ = '/';
- *p++ = '\0';
- while (*p++ != '\n')
- continue;
- aux_info_second_line = p;
- aux_info_relocated_name = 0;
- if (invocation_filename[0] != '/')
- {
- /* INVOCATION_FILENAME is relative;
- append it to BASE_SOURCE_FILENAME's dir. */
- char *dir_end;
- aux_info_relocated_name = xmalloc (base_len + (p-invocation_filename));
- strcpy (aux_info_relocated_name, base_source_filename);
- dir_end = rindex (aux_info_relocated_name, '/');
- if (dir_end)
- dir_end++;
- else
- dir_end = aux_info_relocated_name;
- strcpy (dir_end, invocation_filename);
- invocation_filename = aux_info_relocated_name;
- }
- }
-
-
- {
- const char *aux_info_p;
-
- /* Do a pre-pass on the lines in the aux_info file, making sure that all
- of the source files referenced in there are at least as old as this
- aux_info file itself. If not, go back and regenerate the aux_info
- file anew. Don't do any of this for the syscalls file. */
-
- if (!is_syscalls)
- {
- current_aux_info_lineno = 2;
-
- for (aux_info_p = aux_info_second_line; *aux_info_p; )
- {
- if (referenced_file_is_newer (aux_info_p, aux_info_mtime))
- {
- free (aux_info_base);
- xfree (aux_info_relocated_name);
- if (keep_it && my_unlink (aux_info_filename) == -1)
- {
- fprintf (stderr, "%s: can't delete file `%s': %s\n",
- pname, shortpath (NULL, aux_info_filename),
- my_strerror(errno));
- return;
- }
- must_create = 1;
- goto start_over;
- }
-
- /* Skip over the rest of this line to start of next line. */
-
- while (*aux_info_p != '\n')
- aux_info_p++;
- aux_info_p++;
- current_aux_info_lineno++;
- }
- }
-
- /* Now do the real pass on the aux_info lines. Save their information in
- the in-core data base. */
-
- current_aux_info_lineno = 2;
-
- for (aux_info_p = aux_info_second_line; *aux_info_p;)
- {
- char *unexpanded_line = unexpand_if_needed (aux_info_p);
-
- if (unexpanded_line)
- {
- save_def_or_dec (unexpanded_line, is_syscalls);
- free (unexpanded_line);
- }
- else
- save_def_or_dec (aux_info_p, is_syscalls);
-
- /* Skip over the rest of this line and get to start of next line. */
-
- while (*aux_info_p != '\n')
- aux_info_p++;
- aux_info_p++;
- current_aux_info_lineno++;
- }
- }
-
- free (aux_info_base);
- xfree (aux_info_relocated_name);
-}
-
-#ifndef UNPROTOIZE
-
-/* Check an individual filename for a .c suffix. If the filename has this
- suffix, rename the file such that its suffix is changed to .C. This
- function implements the -C option. */
-
-static void
-rename_c_file (hp)
- const hash_table_entry *hp;
-{
- const char *filename = hp->symbol;
- int last_char_index = strlen (filename) - 1;
- char *const new_filename = (char *) alloca (strlen (filename) + 1);
-
- /* Note that we don't care here if the given file was converted or not. It
- is possible that the given file was *not* converted, simply because there
- was nothing in it which actually required conversion. Even in this case,
- we want to do the renaming. Note that we only rename files with the .c
- suffix. */
-
- if (filename[last_char_index] != 'c' || filename[last_char_index-1] != '.')
- return;
-
- strcpy (new_filename, filename);
- new_filename[last_char_index] = 'C';
-
- if (my_link (filename, new_filename) == -1)
- {
- fprintf (stderr, "%s: warning: can't link file `%s' to `%s': %s\n",
- pname, shortpath (NULL, filename),
- shortpath (NULL, new_filename), my_strerror(errno));
- errors++;
- return;
- }
-
- if (my_unlink (filename) == -1)
- {
- fprintf (stderr, "%s: warning: can't delete file `%s': %s\n",
- pname, shortpath (NULL, filename), my_strerror(errno));
- errors++;
- return;
- }
-}
-
-#endif /* !defined (UNPROTOIZE) */
-
-/* Take the list of definitions and declarations attached to a particular
- file_info node and reverse the order of the list. This should get the
- list into an order such that the item with the lowest associated line
- number is nearest the head of the list. When these lists are originally
- built, they are in the opposite order. We want to traverse them in
- normal line number order later (i.e. lowest to highest) so reverse the
- order here. */
-
-static void
-reverse_def_dec_list (hp)
- const hash_table_entry *hp;
-{
- file_info *file_p = hp->fip;
- def_dec_info *prev = NULL;
- def_dec_info *current = (def_dec_info *)file_p->defs_decs;
-
- if (!current)
- return; /* no list to reverse */
-
- prev = current;
- if (! (current = (def_dec_info *)current->next_in_file))
- return; /* can't reverse a single list element */
-
- prev->next_in_file = NULL;
-
- while (current)
- {
- def_dec_info *next = (def_dec_info *)current->next_in_file;
-
- current->next_in_file = prev;
- prev = current;
- current = next;
- }
-
- file_p->defs_decs = prev;
-}
-
-#ifndef UNPROTOIZE
-
-/* Find the (only?) extern definition for a particular function name, starting
- from the head of the linked list of entries for the given name. If we
- cannot find an extern definition for the given function name, issue a
- warning and scrounge around for the next best thing, i.e. an extern
- function declaration with a prototype attached to it. Note that we only
- allow such substitutions for extern declarations and never for static
- declarations. That's because the only reason we allow them at all is
- to let un-prototyped function declarations for system-supplied library
- functions get their prototypes from our own extra SYSCALLS.c.X file which
- contains all of the correct prototypes for system functions. */
-
-static const def_dec_info *
-find_extern_def (head, user)
- const def_dec_info *head;
- const def_dec_info *user;
-{
- const def_dec_info *dd_p;
- const def_dec_info *extern_def_p = NULL;
- int conflict_noted = 0;
-
- /* Don't act too stupid here. Somebody may try to convert an entire system
- in one swell fwoop (rather than one program at a time, as should be done)
- and in that case, we may find that there are multiple extern definitions
- of a given function name in the entire set of source files that we are
- converting. If however one of these definitions resides in exactly the
- same source file as the reference we are trying to satisfy then in that
- case it would be stupid for us to fail to realize that this one definition
- *must* be the precise one we are looking for.
-
- To make sure that we don't miss an opportunity to make this "same file"
- leap of faith, we do a prescan of the list of records relating to the
- given function name, and we look (on this first scan) *only* for a
- definition of the function which is in the same file as the reference
- we are currently trying to satisfy. */
-
- for (dd_p = head; dd_p; dd_p = dd_p->next_for_func)
- if (dd_p->is_func_def && !dd_p->is_static && dd_p->file == user->file)
- return dd_p;
-
- /* Now, since we have not found a definition in the same file as the
- reference, we scan the list again and consider all possibilities from
- all files. Here we may get conflicts with the things listed in the
- SYSCALLS.c.X file, but if that happens it only means that the source
- code being converted contains its own definition of a function which
- could have been supplied by libc.a. In such cases, we should avoid
- issuing the normal warning, and defer to the definition given in the
- user's own code. */
-
- for (dd_p = head; dd_p; dd_p = dd_p->next_for_func)
- if (dd_p->is_func_def && !dd_p->is_static)
- {
- if (!extern_def_p) /* Previous definition? */
- extern_def_p = dd_p; /* Remember the first definition found. */
- else
- {
- /* Ignore definition just found if it came from SYSCALLS.c.X. */
-
- if (is_syscalls_file (dd_p->file))
- continue;
-
- /* Quietly replace the definition previously found with the one
- just found if the previous one was from SYSCALLS.c.X. */
-
- if (is_syscalls_file (extern_def_p->file))
- {
- extern_def_p = dd_p;
- continue;
- }
-
- /* If we get here, then there is a conflict between two function
- declarations for the same function, both of which came from the
- user's own code. */
-
- if (!conflict_noted) /* first time we noticed? */
- {
- conflict_noted = 1;
- fprintf (stderr, "%s: conflicting extern definitions of '%s'\n",
- pname, head->hash_entry->symbol);
- if (!quiet_flag)
- {
- fprintf (stderr, "%s: declarations of '%s' will not be converted\n",
- pname, head->hash_entry->symbol);
- fprintf (stderr, "%s: conflict list for '%s' follows:\n",
- pname, head->hash_entry->symbol);
- fprintf (stderr, "%s: %s(%d): %s\n",
- pname,
- shortpath (NULL, extern_def_p->file->hash_entry->symbol),
- extern_def_p->line, extern_def_p->ansi_decl);
- }
- }
- if (!quiet_flag)
- fprintf (stderr, "%s: %s(%d): %s\n",
- pname,
- shortpath (NULL, dd_p->file->hash_entry->symbol),
- dd_p->line, dd_p->ansi_decl);
- }
- }
-
- /* We want to err on the side of caution, so if we found multiple conflicting
- definitions for the same function, treat this as being that same as if we
- had found no definitions (i.e. return NULL). */
-
- if (conflict_noted)
- return NULL;
-
- if (!extern_def_p)
- {
- /* We have no definitions for this function so do the next best thing.
- Search for an extern declaration already in prototype form. */
-
- for (dd_p = head; dd_p; dd_p = dd_p->next_for_func)
- if (!dd_p->is_func_def && !dd_p->is_static && dd_p->prototyped)
- {
- extern_def_p = dd_p; /* save a pointer to the definition */
- if (!quiet_flag)
- fprintf (stderr, "%s: warning: using formals list from %s(%d) for function `%s'\n",
- pname,
- shortpath (NULL, dd_p->file->hash_entry->symbol),
- dd_p->line, dd_p->hash_entry->symbol);
- break;
- }
-
- /* Gripe about unprototyped function declarations that we found no
- corresponding definition (or other source of prototype information)
- for.
-
- Gripe even if the unprototyped declaration we are worried about
- exists in a file in one of the "system" include directories. We
- can gripe about these because we should have at least found a
- corresponding (pseudo) definition in the SYSCALLS.c.X file. If we
- didn't, then that means that the SYSCALLS.c.X file is missing some
- needed prototypes for this particular system. That is worth telling
- the user about! */
-
- if (!extern_def_p)
- {
- const char *file = user->file->hash_entry->symbol;
-
- if (!quiet_flag)
- if (in_system_include_dir (file))
- {
- /* Why copy this string into `needed' at all?
- Why not just use user->ansi_decl without copying? */
- char *needed = (char *) alloca (strlen (user->ansi_decl) + 1);
- char *p;
-
- strcpy (needed, user->ansi_decl);
- p = (NONCONST char *) substr (needed, user->hash_entry->symbol)
- + strlen (user->hash_entry->symbol) + 2;
- /* Avoid having ??? in the string. */
- *p++ = '?';
- *p++ = '?';
- *p++ = '?';
- strcpy (p, ");");
-
- fprintf (stderr, "%s: %d: `%s' used but missing from SYSCALLS\n",
- shortpath (NULL, file), user->line,
- needed+7); /* Don't print "extern " */
- }
-#if 0
- else
- fprintf (stderr, "%s: %d: warning: no extern definition for `%s'\n",
- shortpath (NULL, file), user->line,
- user->hash_entry->symbol);
-#endif
- }
- }
- return extern_def_p;
-}
-
-/* Find the (only?) static definition for a particular function name in a
- given file. Here we get the function-name and the file info indirectly
- from the def_dec_info record pointer which is passed in. */
-
-static const def_dec_info *
-find_static_definition (user)
- const def_dec_info *user;
-{
- const def_dec_info *head = user->hash_entry->ddip;
- const def_dec_info *dd_p;
- int num_static_defs = 0;
- const def_dec_info *static_def_p = NULL;
-
- for (dd_p = head; dd_p; dd_p = dd_p->next_for_func)
- if (dd_p->is_func_def && dd_p->is_static && (dd_p->file == user->file))
- {
- static_def_p = dd_p; /* save a pointer to the definition */
- num_static_defs++;
- }
- if (num_static_defs == 0)
- {
- if (!quiet_flag)
- fprintf (stderr, "%s: warning: no static definition for `%s' in file `%s'\n",
- pname, head->hash_entry->symbol,
- shortpath (NULL, user->file->hash_entry->symbol));
- }
- else if (num_static_defs > 1)
- {
- fprintf (stderr, "%s: multiple static defs of `%s' in file `%s'\n",
- pname, head->hash_entry->symbol,
- shortpath (NULL, user->file->hash_entry->symbol));
- return NULL;
- }
- return static_def_p;
-}
-
-/* Find good prototype style formal argument lists for all of the function
- declarations which didn't have them before now.
-
- To do this we consider each function name one at a time. For each function
- name, we look at the items on the linked list of def_dec_info records for
- that particular name.
-
- Somewhere on this list we should find one (and only one) def_dec_info
- record which represents the actual function definition, and this record
- should have a nice formal argument list already associated with it.
-
- Thus, all we have to do is to connect up all of the other def_dec_info
- records for this particular function name to the special one which has
- the full-blown formals list.
-
- Of course it is a little more complicated than just that. See below for
- more details. */
-
-static void
-connect_defs_and_decs (hp)
- const hash_table_entry *hp;
-{
- const def_dec_info *dd_p;
- const def_dec_info *extern_def_p = NULL;
- int first_extern_reference = 1;
-
- /* Traverse the list of definitions and declarations for this particular
- function name. For each item on the list, if it is a function
- definition (either old style or new style) then GCC has already been
- kind enough to produce a prototype for us, and it is associated with
- the item already, so declare the item as its own associated "definition".
-
- Also, for each item which is only a function declaration, but which
- nonetheless has its own prototype already (obviously supplied by the user)
- declare the item as it's own definition.
-
- Note that when/if there are multiple user-supplied prototypes already
- present for multiple declarations of any given function, these multiple
- prototypes *should* all match exactly with one another and with the
- prototype for the actual function definition. We don't check for this
- here however, since we assume that the compiler must have already done
- this consistency checking when it was creating the .X files. */
-
- for (dd_p = hp->ddip; dd_p; dd_p = dd_p->next_for_func)
- if (dd_p->prototyped)
- ((NONCONST def_dec_info *) dd_p)->definition = dd_p;
-
- /* Traverse the list of definitions and declarations for this particular
- function name. For each item on the list, if it is an extern function
- declaration and if it has no associated definition yet, go try to find
- the matching extern definition for the declaration.
-
- When looking for the matching function definition, warn the user if we
- fail to find one.
-
- If we find more that one function definition also issue a warning.
-
- Do the search for the matching definition only once per unique function
- name (and only when absolutely needed) so that we can avoid putting out
- redundant warning messages, and so that we will only put out warning
- messages when there is actually a reference (i.e. a declaration) for
- which we need to find a matching definition. */
-
- for (dd_p = hp->ddip; dd_p; dd_p = dd_p->next_for_func)
- if (!dd_p->is_func_def && !dd_p->is_static && !dd_p->definition)
- {
- if (first_extern_reference)
- {
- extern_def_p = find_extern_def (hp->ddip, dd_p);
- first_extern_reference = 0;
- }
- ((NONCONST def_dec_info *) dd_p)->definition = extern_def_p;
- }
-
- /* Traverse the list of definitions and declarations for this particular
- function name. For each item on the list, if it is a static function
- declaration and if it has no associated definition yet, go try to find
- the matching static definition for the declaration within the same file.
-
- When looking for the matching function definition, warn the user if we
- fail to find one in the same file with the declaration, and refuse to
- convert this kind of cross-file static function declaration. After all,
- this is stupid practice and should be discouraged.
-
- We don't have to worry about the possibility that there is more than one
- matching function definition in the given file because that would have
- been flagged as an error by the compiler.
-
- Do the search for the matching definition only once per unique
- function-name/source-file pair (and only when absolutely needed) so that
- we can avoid putting out redundant warning messages, and so that we will
- only put out warning messages when there is actually a reference (i.e. a
- declaration) for which we actually need to find a matching definition. */
-
- for (dd_p = hp->ddip; dd_p; dd_p = dd_p->next_for_func)
- if (!dd_p->is_func_def && dd_p->is_static && !dd_p->definition)
- {
- const def_dec_info *dd_p2;
- const def_dec_info *static_def;
-
- /* We have now found a single static declaration for which we need to
- find a matching definition. We want to minimize the work (and the
- number of warnings), so we will find an appropriate (matching)
- static definition for this declaration, and then distribute it
- (as the definition for) any and all other static declarations
- for this function name which occur within the same file, and which
- do not already have definitions.
-
- Note that a trick is used here to prevent subsequent attempts to
- call find_static_definition for a given function-name & file
- if the first such call returns NULL. Essentially, we convert
- these NULL return values to -1, and put the -1 into the definition
- field for each other static declaration from the same file which
- does not already have an associated definition.
- This makes these other static declarations look like they are
- actually defined already when the outer loop here revisits them
- later on. Thus, the outer loop will skip over them. Later, we
- turn the -1's back to NULL's. */
-
- ((NONCONST def_dec_info *) dd_p)->definition =
- (static_def = find_static_definition (dd_p))
- ? static_def
- : (const def_dec_info *) -1;
-
- for (dd_p2 = dd_p->next_for_func; dd_p2; dd_p2 = dd_p2->next_for_func)
- if (!dd_p2->is_func_def && dd_p2->is_static
- && !dd_p2->definition && (dd_p2->file == dd_p->file))
- ((NONCONST def_dec_info *)dd_p2)->definition = dd_p->definition;
- }
-
- /* Convert any dummy (-1) definitions we created in the step above back to
- NULL's (as they should be). */
-
- for (dd_p = hp->ddip; dd_p; dd_p = dd_p->next_for_func)
- if (dd_p->definition == (def_dec_info *) -1)
- ((NONCONST def_dec_info *) dd_p)->definition = NULL;
-}
-
-#endif /* !defined (UNPROTOIZE) */
-
-/* Give a pointer into the clean text buffer, return a number which is the
- original source line number that the given pointer points into. */
-
-static int
-identify_lineno (clean_p)
- const char *clean_p;
-{
- int line_num = 1;
- const char *scan_p;
-
- for (scan_p = clean_text_base; scan_p <= clean_p; scan_p++)
- if (*scan_p == '\n')
- line_num++;
- return line_num;
-}
-
-/* Issue an error message and give up on doing this particular edit. */
-
-static void
-declare_source_confusing (clean_p)
- const char *clean_p;
-{
- if (!quiet_flag)
- {
- if (clean_p == 0)
- fprintf (stderr, "%s: %d: warning: source too confusing\n",
- shortpath (NULL, convert_filename), last_known_line_number);
- else
- fprintf (stderr, "%s: %d: warning: source too confusing\n",
- shortpath (NULL, convert_filename),
- identify_lineno (clean_p));
- }
- longjmp (source_confusion_recovery, 1);
-}
-
-/* Check that a condition which is expected to be true in the original source
- code is in fact true. If not, issue an error message and give up on
- converting this particular source file. */
-
-static void
-check_source (cond, clean_p)
- int cond;
- const char *clean_p;
-{
- if (!cond)
- declare_source_confusing (clean_p);
-}
-
-/* If we think of the in-core cleaned text buffer as a memory mapped
- file (with the variable last_known_line_start acting as sort of a
- file pointer) then we can imagine doing "seeks" on the buffer. The
- following routine implements a kind of "seek" operation for the in-core
- (cleaned) copy of the source file. When finished, it returns a pointer to
- the start of a given (numbered) line in the cleaned text buffer.
-
- Note that protoize only has to "seek" in the forward direction on the
- in-core cleaned text file buffers, and it never needs to back up.
-
- This routine is made a little bit faster by remembering the line number
- (and pointer value) supplied (and returned) from the previous "seek".
- This prevents us from always having to start all over back at the top
- of the in-core cleaned buffer again. */
-
-static const char *
-seek_to_line (n)
- int n;
-{
- if (n < last_known_line_number)
- abort ();
-
- while (n > last_known_line_number)
- {
- while (*last_known_line_start != '\n')
- check_source (++last_known_line_start < clean_text_limit, 0);
- last_known_line_start++;
- last_known_line_number++;
- }
- return last_known_line_start;
-}
-
-/* Given a pointer to a character in the cleaned text buffer, return a pointer
- to the next non-whitespace character which follows it. */
-
-static const char *
-forward_to_next_token_char (ptr)
- const char *ptr;
-{
- for (++ptr; isspace (*ptr); check_source (++ptr < clean_text_limit, 0))
- continue;
- return ptr;
-}
-
-/* Copy a chunk of text of length `len' and starting at `str' to the current
- output buffer. Note that all attempts to add stuff to the current output
- buffer ultimately go through here. */
-
-static void
-output_bytes (str, len)
- const char *str;
- size_t len;
-{
- if ((repl_write_ptr + 1) + len >= repl_text_limit)
- {
- size_t new_size = (repl_text_limit - repl_text_base) << 1;
- char *new_buf = (char *) xrealloc (repl_text_base, new_size);
-
- repl_write_ptr = new_buf + (repl_write_ptr - repl_text_base);
- repl_text_base = new_buf;
- repl_text_limit = new_buf + new_size;
- }
- memcpy (repl_write_ptr + 1, str, len);
- repl_write_ptr += len;
-}
-
-/* Copy all bytes (except the trailing null) of a null terminated string to
- the current output buffer. */
-
-static void
-output_string (str)
- const char *str;
-{
- output_bytes (str, strlen (str));
-}
-
-/* Copy some characters from the original text buffer to the current output
- buffer.
-
- This routine takes a pointer argument `p' which is assumed to be a pointer
- into the cleaned text buffer. The bytes which are copied are the `original'
- equivalents for the set of bytes between the last value of `clean_read_ptr'
- and the argument value `p'.
-
- The set of bytes copied however, comes *not* from the cleaned text buffer,
- but rather from the direct counterparts of these bytes within the original
- text buffer.
-
- Thus, when this function is called, some bytes from the original text
- buffer (which may include original comments and preprocessing directives)
- will be copied into the output buffer.
-
- Note that the request implied when this routine is called includes the
- byte pointed to by the argument pointer `p'. */
-
-static void
-output_up_to (p)
- const char *p;
-{
- size_t copy_length = (size_t) (p - clean_read_ptr);
- const char *copy_start = orig_text_base+(clean_read_ptr-clean_text_base)+1;
-
- if (copy_length == 0)
- return;
-
- output_bytes (copy_start, copy_length);
- clean_read_ptr = p;
-}
-
-/* Given a pointer to a def_dec_info record which represents some form of
- definition of a function (perhaps a real definition, or in lieu of that
- perhaps just a declaration with a full prototype) return true if this
- function is one which we should avoid converting. Return false
- otherwise. */
-
-static int
-other_variable_style_function (ansi_header)
- const char *ansi_header;
-{
-#ifdef UNPROTOIZE
-
- /* See if we have a stdarg function, or a function which has stdarg style
- parameters or a stdarg style return type. */
-
- return substr (ansi_header, "...") != 0;
-
-#else /* !defined (UNPROTOIZE) */
-
- /* See if we have a varargs function, or a function which has varargs style
- parameters or a varargs style return type. */
-
- const char *p;
- int len = strlen (varargs_style_indicator);
-
- for (p = ansi_header; p; )
- {
- const char *candidate;
-
- if ((candidate = substr (p, varargs_style_indicator)) == 0)
- return 0;
- else
- if (!is_id_char (candidate[-1]) && !is_id_char (candidate[len]))
- return 1;
- else
- p = candidate + 1;
- }
- return 0;
-#endif /* !defined (UNPROTOIZE) */
-}
-
-/* Do the editing operation specifically for a function "declaration". Note
- that editing for function "definitions" are handled in a separate routine
- below. */
-
-static void
-edit_fn_declaration (def_dec_p, clean_text_p)
- const def_dec_info *def_dec_p;
- const char *volatile clean_text_p;
-{
- const char *start_formals;
- const char *end_formals;
- const char *function_to_edit = def_dec_p->hash_entry->symbol;
- size_t func_name_len = strlen (function_to_edit);
- const char *end_of_fn_name;
-
-#ifndef UNPROTOIZE
-
- const f_list_chain_item *this_f_list_chain_item;
- const def_dec_info *definition = def_dec_p->definition;
-
- /* If we are protoizing, and if we found no corresponding definition for
- this particular function declaration, then just leave this declaration
- exactly as it is. */
-
- if (!definition)
- return;
-
- /* If we are protoizing, and if the corresponding definition that we found
- for this particular function declaration defined an old style varargs
- function, then we want to issue a warning and just leave this function
- declaration unconverted. */
-
- if (other_variable_style_function (definition->ansi_decl))
- {
- if (!quiet_flag)
- fprintf (stderr, "%s: %d: warning: varargs function declaration not converted\n",
- shortpath (NULL, def_dec_p->file->hash_entry->symbol),
- def_dec_p->line);
- return;
- }
-
-#endif /* !defined (UNPROTOIZE) */
-
- /* Setup here to recover from confusing source code detected during this
- particular "edit". */
-
- save_pointers ();
- if (setjmp (source_confusion_recovery))
- {
- restore_pointers ();
- fprintf (stderr, "%s: declaration of function `%s' not converted\n",
- pname, function_to_edit);
- return;
- }
-
- /* We are editing a function declaration. The line number we did a seek to
- contains the comma or semicolon which follows the declaration. Our job
- now is to scan backwards looking for the function name. This name *must*
- be followed by open paren (ignoring whitespace, of course). We need to
- replace everything between that open paren and the corresponding closing
- paren. If we are protoizing, we need to insert the prototype-style
- formals lists. If we are unprotoizing, we need to just delete everything
- between the pairs of opening and closing parens. */
-
- /* First move up to the end of the line. */
-
- while (*clean_text_p != '\n')
- check_source (++clean_text_p < clean_text_limit, 0);
- clean_text_p--; /* Point to just before the newline character. */
-
- /* Now we can scan backwards for the function name. */
-
- do
- {
- for (;;)
- {
- /* Scan leftwards until we find some character which can be
- part of an identifier. */
-
- while (!is_id_char (*clean_text_p))
- check_source (--clean_text_p > clean_read_ptr, 0);
-
- /* Scan backwards until we find a char that cannot be part of an
- identifier. */
-
- while (is_id_char (*clean_text_p))
- check_source (--clean_text_p > clean_read_ptr, 0);
-
- /* Having found an "id break", see if the following id is the one
- that we are looking for. If so, then exit from this loop. */
-
- if (!strncmp (clean_text_p+1, function_to_edit, func_name_len))
- {
- char ch = *(clean_text_p + 1 + func_name_len);
-
- /* Must also check to see that the name in the source text
- ends where it should (in order to prevent bogus matches
- on similar but longer identifiers. */
-
- if (! is_id_char (ch))
- break; /* exit from loop */
- }
- }
-
- /* We have now found the first perfect match for the function name in
- our backward search. This may or may not be the actual function
- name at the start of the actual function declaration (i.e. we could
- have easily been mislead). We will try to avoid getting fooled too
- often by looking forward for the open paren which should follow the
- identifier we just found. We ignore whitespace while hunting. If
- the next non-whitespace byte we see is *not* an open left paren,
- then we must assume that we have been fooled and we start over
- again accordingly. Note that there is no guarantee, that even if
- we do see the open paren, that we are in the right place.
- Programmers do the strangest things sometimes! */
-
- end_of_fn_name = clean_text_p + strlen (def_dec_p->hash_entry->symbol);
- start_formals = forward_to_next_token_char (end_of_fn_name);
- }
- while (*start_formals != '(');
-
- /* start_of_formals now points to the opening left paren which immediately
- follows the name of the function. */
-
- /* Note that there may be several formals lists which need to be modified
- due to the possibility that the return type of this function is a
- pointer-to-function type. If there are several formals lists, we
- convert them in left-to-right order here. */
-
-#ifndef UNPROTOIZE
- this_f_list_chain_item = definition->f_list_chain;
-#endif /* !defined (UNPROTOIZE) */
-
- for (;;)
- {
- {
- int depth;
-
- end_formals = start_formals + 1;
- depth = 1;
- for (; depth; check_source (++end_formals < clean_text_limit, 0))
- {
- switch (*end_formals)
- {
- case '(':
- depth++;
- break;
- case ')':
- depth--;
- break;
- }
- }
- end_formals--;
- }
-
- /* end_formals now points to the closing right paren of the formals
- list whose left paren is pointed to by start_formals. */
-
- /* Now, if we are protoizing, we insert the new ANSI-style formals list
- attached to the associated definition of this function. If however
- we are unprotoizing, then we simply delete any formals list which
- may be present. */
-
- output_up_to (start_formals);
-#ifndef UNPROTOIZE
- if (this_f_list_chain_item)
- {
- output_string (this_f_list_chain_item->formals_list);
- this_f_list_chain_item = this_f_list_chain_item->chain_next;
- }
- else
- {
- if (!quiet_flag)
- fprintf (stderr, "%s: warning: too many parameter lists in declaration of `%s'\n",
- pname, def_dec_p->hash_entry->symbol);
- check_source (0, end_formals); /* leave the declaration intact */
- }
-#endif /* !defined (UNPROTOIZE) */
- clean_read_ptr = end_formals - 1;
-
- /* Now see if it looks like there may be another formals list associated
- with the function declaration that we are converting (following the
- formals list that we just converted. */
-
- {
- const char *another_r_paren = forward_to_next_token_char (end_formals);
-
- if ((*another_r_paren != ')')
- || (*(start_formals = forward_to_next_token_char (another_r_paren)) != '('))
- {
-#ifndef UNPROTOIZE
- if (this_f_list_chain_item)
- {
- if (!quiet_flag)
- fprintf (stderr, "\n%s: warning: too few parameter lists in declaration of `%s'\n",
- pname, def_dec_p->hash_entry->symbol);
- check_source (0, start_formals); /* leave the decl intact */
- }
-#endif /* !defined (UNPROTOIZE) */
- break;
-
- }
- }
-
- /* There does appear to be yet another formals list, so loop around
- again, and convert it also. */
- }
-}
-
-/* Edit a whole group of formals lists, starting with the rightmost one
- from some set of formals lists. This routine is called once (from the
- outside) for each function declaration which is converted. It is
- recursive however, and it calls itself once for each remaining formal
- list that lies to the left of the one it was originally called to work
- on. Thus, a whole set gets done in right-to-left order.
-
- This routine returns non-zero if it thinks that it should not be trying
- to convert this particular function definition (because the name of the
- function doesn't match the one expected). */
-
-static int
-edit_formals_lists (end_formals, f_list_count, def_dec_p)
- const char *end_formals;
- unsigned int f_list_count;
- const def_dec_info *def_dec_p;
-{
- const char *start_formals;
- int depth;
-
- start_formals = end_formals - 1;
- depth = 1;
- for (; depth; check_source (--start_formals > clean_read_ptr, 0))
- {
- switch (*start_formals)
- {
- case '(':
- depth--;
- break;
- case ')':
- depth++;
- break;
- }
- }
- start_formals++;
-
- /* start_formals now points to the opening left paren of the formals list. */
-
- f_list_count--;
-
- if (f_list_count)
- {
- const char *next_end;
-
- /* There should be more formal lists to the left of here. */
-
- next_end = start_formals - 1;
- check_source (next_end > clean_read_ptr, 0);
- while (isspace (*next_end))
- check_source (--next_end > clean_read_ptr, 0);
- check_source (*next_end == ')', next_end);
- check_source (--next_end > clean_read_ptr, 0);
- check_source (*next_end == ')', next_end);
- if (edit_formals_lists (next_end, f_list_count, def_dec_p))
- return 1;
- }
-
- /* Check that the function name in the header we are working on is the same
- as the one we would expect to find. If not, issue a warning and return
- non-zero. */
-
- if (f_list_count == 0)
- {
- const char *expected = def_dec_p->hash_entry->symbol;
- const char *func_name_start;
- const char *func_name_limit;
- size_t func_name_len;
-
- for (func_name_limit = start_formals-1; isspace (*func_name_limit); )
- check_source (--func_name_limit > clean_read_ptr, 0);
-
- for (func_name_start = func_name_limit++;
- is_id_char (*func_name_start);
- func_name_start--)
- check_source (func_name_start > clean_read_ptr, 0);
- func_name_start++;
- func_name_len = func_name_limit - func_name_start;
- if (func_name_len == 0)
- check_source (0, func_name_start);
- if (func_name_len != strlen (expected)
- || strncmp (func_name_start, expected, func_name_len))
- {
- fprintf (stderr, "%s: %d: warning: found `%s' but expected `%s'\n",
- shortpath (NULL, def_dec_p->file->hash_entry->symbol),
- identify_lineno (func_name_start),
- dupnstr (func_name_start, func_name_len),
- expected);
- return 1;
- }
- }
-
- output_up_to (start_formals);
-
-#ifdef UNPROTOIZE
- if (f_list_count == 0)
- output_string (def_dec_p->formal_names);
-#else /* !defined (UNPROTOIZE) */
- {
- unsigned f_list_depth;
- const f_list_chain_item *flci_p = def_dec_p->f_list_chain;
-
- /* At this point, the current value of f_list count says how many
- links we have to follow through the f_list_chain to get to the
- particular formals list that we need to output next. */
-
- for (f_list_depth = 0; f_list_depth < f_list_count; f_list_depth++)
- flci_p = flci_p->chain_next;
- output_string (flci_p->formals_list);
- }
-#endif /* !defined (UNPROTOIZE) */
-
- clean_read_ptr = end_formals - 1;
- return 0;
-}
-
-/* Given a pointer to a byte in the clean text buffer which points to
- the beginning of a line that contains a "follower" token for a
- function definition header, do whatever is necessary to find the
- right closing paren for the rightmost formals list of the function
- definition header. */
-
-static const char *
-find_rightmost_formals_list (clean_text_p)
- const char *clean_text_p;
-{
- const char *end_formals;
-
- /* We are editing a function definition. The line number we did a seek
- to contains the first token which immediately follows the entire set of
- formals lists which are part of this particular function definition
- header.
-
- Our job now is to scan leftwards in the clean text looking for the
- right-paren which is at the end of the function header's rightmost
- formals list.
-
- If we ignore whitespace, this right paren should be the first one we
- see which is (ignoring whitespace) immediately followed either by the
- open curly-brace beginning the function body or by an alphabetic
- character (in the case where the function definition is in old (K&R)
- style and there are some declarations of formal parameters). */
-
- /* It is possible that the right paren we are looking for is on the
- current line (together with its following token). Just in case that
- might be true, we start out here by skipping down to the right end of
- the current line before starting our scan. */
-
- for (end_formals = clean_text_p; *end_formals != '\n'; end_formals++)
- continue;
- end_formals--;
-
-#ifdef UNPROTOIZE
-
- /* Now scan backwards while looking for the right end of the rightmost
- formals list associated with this function definition. */
-
- {
- char ch;
- const char *l_brace_p;
-
- /* Look leftward and try to find a right-paren. */
-
- while (*end_formals != ')')
- {
- if (isspace (*end_formals))
- while (isspace (*end_formals))
- check_source (--end_formals > clean_read_ptr, 0);
- else
- check_source (--end_formals > clean_read_ptr, 0);
- }
-
- ch = *(l_brace_p = forward_to_next_token_char (end_formals));
- /* Since we are unprotoizing an ANSI-style (prototyped) function
- definition, there had better not be anything (except whitespace)
- between the end of the ANSI formals list and the beginning of the
- function body (i.e. the '{'). */
-
- check_source (ch == '{', l_brace_p);
- }
-
-#else /* !defined (UNPROTOIZE) */
-
- /* Now scan backwards while looking for the right end of the rightmost
- formals list associated with this function definition. */
-
- while (1)
- {
- char ch;
- const char *l_brace_p;
-
- /* Look leftward and try to find a right-paren. */
-
- while (*end_formals != ')')
- {
- if (isspace (*end_formals))
- while (isspace (*end_formals))
- check_source (--end_formals > clean_read_ptr, 0);
- else
- check_source (--end_formals > clean_read_ptr, 0);
- }
-
- ch = *(l_brace_p = forward_to_next_token_char (end_formals));
-
- /* Since it is possible that we found a right paren before the starting
- '{' of the body which IS NOT the one at the end of the real K&R
- formals list (say for instance, we found one embedded inside one of
- the old K&R formal parameter declarations) we have to check to be
- sure that this is in fact the right paren that we were looking for.
-
- The one we were looking for *must* be followed by either a '{' or
- by an alphabetic character, while others *cannot* validly be followed
- by such characters. */
-
- if ((ch == '{') || isalpha (ch))
- break;
-
- /* At this point, we have found a right paren, but we know that it is
- not the one we were looking for, so backup one character and keep
- looking. */
-
- check_source (--end_formals > clean_read_ptr, 0);
- }
-
-#endif /* !defined (UNPROTOIZE) */
-
- return end_formals;
-}
-
-#ifndef UNPROTOIZE
-
-/* Insert into the output file a totally new declaration for a function
- which (up until now) was being called from within the current block
- without having been declared at any point such that the declaration
- was visible (i.e. in scope) at the point of the call.
-
- We need to add in explicit declarations for all such function calls
- in order to get the full benefit of prototype-based function call
- parameter type checking. */
-
-static void
-add_local_decl (def_dec_p, clean_text_p)
- const def_dec_info *def_dec_p;
- const char *clean_text_p;
-{
- const char *start_of_block;
- const char *function_to_edit = def_dec_p->hash_entry->symbol;
-
- /* Don't insert new local explicit declarations unless explicitly requested
- to do so. */
-
- if (!local_flag)
- return;
-
- /* Setup here to recover from confusing source code detected during this
- particular "edit". */
-
- save_pointers ();
- if (setjmp (source_confusion_recovery))
- {
- restore_pointers ();
- fprintf (stderr, "%s: local declaration for function `%s' not inserted\n",
- pname, function_to_edit);
- return;
- }
-
- /* We have already done a seek to the start of the line which should
- contain *the* open curly brace which begins the block in which we need
- to insert an explicit function declaration (to replace the implicit one).
-
- Now we scan that line, starting from the left, until we find the
- open curly brace we are looking for. Note that there may actually be
- multiple open curly braces on the given line, but we will be happy
- with the leftmost one no matter what. */
-
- start_of_block = clean_text_p;
- while (*start_of_block != '{' && *start_of_block != '\n')
- check_source (++start_of_block < clean_text_limit, 0);
-
- /* Note that the line from the original source could possibly
- contain *no* open curly braces! This happens if the line contains
- a macro call which expands into a chunk of text which includes a
- block (and that block's associated open and close curly braces).
- In cases like this, we give up, issue a warning, and do nothing. */
-
- if (*start_of_block != '{')
- {
- if (!quiet_flag)
- fprintf (stderr,
- "\n%s: %d: warning: can't add declaration of `%s' into macro call\n",
- def_dec_p->file->hash_entry->symbol, def_dec_p->line,
- def_dec_p->hash_entry->symbol);
- return;
- }
-
- /* Figure out what a nice (pretty) indentation would be for the new
- declaration we are adding. In order to do this, we must scan forward
- from the '{' until we find the first line which starts with some
- non-whitespace characters (i.e. real "token" material). */
-
- {
- const char *ep = forward_to_next_token_char (start_of_block) - 1;
- const char *sp;
-
- /* Now we have ep pointing at the rightmost byte of some existing indent
- stuff. At least that is the hope.
-
- We can now just scan backwards and find the left end of the existing
- indentation string, and then copy it to the output buffer. */
-
- for (sp = ep; isspace (*sp) && *sp != '\n'; sp--)
- continue;
-
- /* Now write out the open { which began this block, and any following
- trash up to and including the last byte of the existing indent that
- we just found. */
-
- output_up_to (ep);
-
- /* Now we go ahead and insert the new declaration at this point.
-
- If the definition of the given function is in the same file that we
- are currently editing, and if its full ANSI declaration normally
- would start with the keyword `extern', suppress the `extern'. */
-
- {
- const char *decl = def_dec_p->definition->ansi_decl;
-
- if ((*decl == 'e') && (def_dec_p->file == def_dec_p->definition->file))
- decl += 7;
- output_string (decl);
- }
-
- /* Finally, write out a new indent string, just like the preceding one
- that we found. This will typically include a newline as the first
- character of the indent string. */
-
- output_bytes (sp, (size_t) (ep - sp) + 1);
- }
-}
-
-/* Given a pointer to a file_info record, and a pointer to the beginning
- of a line (in the clean text buffer) which is assumed to contain the
- first "follower" token for the first function definition header in the
- given file, find a good place to insert some new global function
- declarations (which will replace scattered and imprecise implicit ones)
- and then insert the new explicit declaration at that point in the file. */
-
-static void
-add_global_decls (file_p, clean_text_p)
- const file_info *file_p;
- const char *clean_text_p;
-{
- const def_dec_info *dd_p;
- const char *scan_p;
-
- /* Setup here to recover from confusing source code detected during this
- particular "edit". */
-
- save_pointers ();
- if (setjmp (source_confusion_recovery))
- {
- restore_pointers ();
- fprintf (stderr, "%s: global declarations for file `%s' not inserted\n",
- pname, shortpath (NULL, file_p->hash_entry->symbol));
- return;
- }
-
- /* Start by finding a good location for adding the new explicit function
- declarations. To do this, we scan backwards, ignoring whitespace
- and comments and other junk until we find either a semicolon, or until
- we hit the beginning of the file. */
-
- scan_p = find_rightmost_formals_list (clean_text_p);
- for (;; --scan_p)
- {
- if (scan_p < clean_text_base)
- break;
- check_source (scan_p > clean_read_ptr, 0);
- if (*scan_p == ';')
- break;
- }
-
- /* scan_p now points either to a semicolon, or to just before the start
- of the whole file. */
-
- /* Now scan forward for the first non-whitespace character. In theory,
- this should be the first character of the following function definition
- header. We will put in the added declarations just prior to that. */
-
- scan_p++;
- while (isspace (*scan_p))
- scan_p++;
- scan_p--;
-
- output_up_to (scan_p);
-
- /* Now write out full prototypes for all of the things that had been
- implicitly declared in this file (but only those for which we were
- actually able to find unique matching definitions). Avoid duplicates
- by marking things that we write out as we go. */
-
- {
- int some_decls_added = 0;
-
- for (dd_p = file_p->defs_decs; dd_p; dd_p = dd_p->next_in_file)
- if (dd_p->is_implicit && dd_p->definition && !dd_p->definition->written)
- {
- const char *decl = dd_p->definition->ansi_decl;
-
- /* If the function for which we are inserting a declaration is
- actually defined later in the same file, then suppress the
- leading `extern' keyword (if there is one). */
-
- if (*decl == 'e' && (dd_p->file == dd_p->definition->file))
- decl += 7;
-
- output_string ("\n");
- output_string (decl);
- some_decls_added = 1;
- ((NONCONST def_dec_info *) dd_p->definition)->written = 1;
- }
- if (some_decls_added)
- output_string ("\n\n");
- }
-
- /* Unmark all of the definitions that we just marked. */
-
- for (dd_p = file_p->defs_decs; dd_p; dd_p = dd_p->next_in_file)
- if (dd_p->definition)
- ((NONCONST def_dec_info *) dd_p->definition)->written = 0;
-}
-
-#endif /* !defined (UNPROTOIZE) */
-
-/* Do the editing operation specifically for a function "definition". Note
- that editing operations for function "declarations" are handled by a
- separate routine above. */
-
-static void
-edit_fn_definition (def_dec_p, clean_text_p)
- const def_dec_info *def_dec_p;
- const char *clean_text_p;
-{
- const char *end_formals;
- const char *function_to_edit = def_dec_p->hash_entry->symbol;
-
- /* Setup here to recover from confusing source code detected during this
- particular "edit". */
-
- save_pointers ();
- if (setjmp (source_confusion_recovery))
- {
- restore_pointers ();
- fprintf (stderr, "%s: definition of function `%s' not converted\n",
- pname, function_to_edit);
- return;
- }
-
- end_formals = find_rightmost_formals_list (clean_text_p);
-
- /* end_of_formals now points to the closing right paren of the rightmost
- formals list which is actually part of the `header' of the function
- definition that we are converting. */
-
- /* If the header of this function definition looks like it declares a
- function with a variable number of arguments, and if the way it does
- that is different from that way we would like it (i.e. varargs vs.
- stdarg) then issue a warning and leave the header unconverted. */
-
- if (other_variable_style_function (def_dec_p->ansi_decl))
- {
- if (!quiet_flag)
- fprintf (stderr, "%s: %d: warning: definition of %s not converted\n",
- shortpath (NULL, def_dec_p->file->hash_entry->symbol),
- identify_lineno (end_formals),
- other_var_style);
- output_up_to (end_formals);
- return;
- }
-
- if (edit_formals_lists (end_formals, def_dec_p->f_list_count, def_dec_p))
- {
- restore_pointers ();
- fprintf (stderr, "%s: definition of function `%s' not converted\n",
- pname, function_to_edit);
- return;
- }
-
- /* Have to output the last right paren because this never gets flushed by
- edit_formals_list. */
-
- output_up_to (end_formals);
-
-#ifdef UNPROTOIZE
- {
- const char *decl_p;
- const char *semicolon_p;
- const char *limit_p;
- const char *scan_p;
- int had_newlines = 0;
-
- /* Now write out the K&R style formal declarations, one per line. */
-
- decl_p = def_dec_p->formal_decls;
- limit_p = decl_p + strlen (decl_p);
- for (;decl_p < limit_p; decl_p = semicolon_p + 2)
- {
- for (semicolon_p = decl_p; *semicolon_p != ';'; semicolon_p++)
- continue;
- output_string ("\n");
- output_string (indent_string);
- output_bytes (decl_p, (size_t) ((semicolon_p + 1) - decl_p));
- }
-
- /* If there are no newlines between the end of the formals list and the
- start of the body, we should insert one now. */
-
- for (scan_p = end_formals+1; *scan_p != '{'; )
- {
- if (*scan_p == '\n')
- {
- had_newlines = 1;
- break;
- }
- check_source (++scan_p < clean_text_limit, 0);
- }
- if (!had_newlines)
- output_string ("\n");
- }
-#else /* !defined (UNPROTOIZE) */
- /* If we are protoizing, there may be some flotsam & jetsam (like comments
- and preprocessing directives) after the old formals list but before
- the following { and we would like to preserve that stuff while effectively
- deleting the existing K&R formal parameter declarations. We do so here
- in a rather tricky way. Basically, we white out any stuff *except*
- the comments/pp-directives in the original text buffer, then, if there
- is anything in this area *other* than whitespace, we output it. */
- {
- const char *end_formals_orig;
- const char *start_body;
- const char *start_body_orig;
- const char *scan;
- const char *scan_orig;
- int have_flotsam = 0;
- int have_newlines = 0;
-
- for (start_body = end_formals + 1; *start_body != '{';)
- check_source (++start_body < clean_text_limit, 0);
-
- end_formals_orig = orig_text_base + (end_formals - clean_text_base);
- start_body_orig = orig_text_base + (start_body - clean_text_base);
- scan = end_formals + 1;
- scan_orig = end_formals_orig + 1;
- for (; scan < start_body; scan++, scan_orig++)
- {
- if (*scan == *scan_orig)
- {
- have_newlines |= (*scan_orig == '\n');
- /* Leave identical whitespace alone. */
- if (!isspace (*scan_orig))
- *((NONCONST char *)scan_orig) = ' '; /* identical - so whiteout */
- }
- else
- have_flotsam = 1;
- }
- if (have_flotsam)
- output_bytes (end_formals_orig + 1,
- (size_t) (start_body_orig - end_formals_orig) - 1);
- else
- if (have_newlines)
- output_string ("\n");
- else
- output_string (" ");
- clean_read_ptr = start_body - 1;
- }
-#endif /* !defined (UNPROTOIZE) */
-}
-
-/* Clean up the clean text buffer. Do this by converting comments and
- preprocessing directives into spaces. Also convert line continuations
- into whitespace. Also, whiteout string and character literals. */
-
-static void
-do_cleaning (new_clean_text_base, new_clean_text_limit)
- char *new_clean_text_base;
- char *new_clean_text_limit;
-{
- char *scan_p;
- int non_whitespace_since_newline = 0;
-
- for (scan_p = new_clean_text_base; scan_p < new_clean_text_limit; scan_p++)
- {
- switch (*scan_p)
- {
- case '/': /* Handle comments. */
- if (scan_p[1] != '*')
- goto regular;
- non_whitespace_since_newline = 1;
- scan_p[0] = ' ';
- scan_p[1] = ' ';
- scan_p += 2;
- while (scan_p[1] != '/' || scan_p[0] != '*')
- {
- if (!isspace (*scan_p))
- *scan_p = ' ';
- if (++scan_p >= new_clean_text_limit)
- abort ();
- }
- *scan_p++ = ' ';
- *scan_p = ' ';
- break;
-
- case '#': /* Handle pp directives. */
- if (non_whitespace_since_newline)
- goto regular;
- *scan_p = ' ';
- while (scan_p[1] != '\n' || scan_p[0] == '\\')
- {
- if (!isspace (*scan_p))
- *scan_p = ' ';
- if (++scan_p >= new_clean_text_limit)
- abort ();
- }
- *scan_p++ = ' ';
- break;
-
- case '\'': /* Handle character literals. */
- non_whitespace_since_newline = 1;
- while (scan_p[1] != '\'' || scan_p[0] == '\\')
- {
- if (scan_p[0] == '\\' && !isspace (scan_p[1]))
- scan_p[1] = ' ';
- if (!isspace (*scan_p))
- *scan_p = ' ';
- if (++scan_p >= new_clean_text_limit)
- abort ();
- }
- *scan_p++ = ' ';
- break;
-
- case '"': /* Handle string literals. */
- non_whitespace_since_newline = 1;
- while (scan_p[1] != '"' || scan_p[0] == '\\')
- {
- if (scan_p[0] == '\\' && !isspace (scan_p[1]))
- scan_p[1] = ' ';
- if (!isspace (*scan_p))
- *scan_p = ' ';
- if (++scan_p >= new_clean_text_limit)
- abort ();
- }
- if (!isspace (*scan_p))
- *scan_p = ' ';
- scan_p++;
- break;
-
- case '\\': /* Handle line continuations. */
- if (scan_p[1] != '\n')
- goto regular;
- *scan_p = ' ';
- break;
-
- case '\n':
- non_whitespace_since_newline = 0; /* Reset. */
- break;
-
- case ' ':
- case '\v':
- case '\t':
- case '\r':
- case '\f':
- case '\b':
- break; /* Whitespace characters. */
-
- default:
-regular:
- non_whitespace_since_newline = 1;
- break;
- }
- }
-}
-
-/* Given a pointer to the closing right parenthesis for a particular formals
- list (in the clean text buffer) find the corresponding left parenthesis
- and return a pointer to it. */
-
-static const char *
-careful_find_l_paren (p)
- const char *p;
-{
- const char *q;
- int paren_depth;
-
- for (paren_depth = 1, q = p-1; paren_depth; check_source (--q >= clean_text_base, 0))
- {
- switch (*q)
- {
- case ')':
- paren_depth++;
- break;
- case '(':
- paren_depth--;
- break;
- }
- }
- return ++q;
-}
-
-/* Scan the clean text buffer for cases of function definitions that we
- don't really know about because they were preprocessed out when the
- aux info files were created.
-
- In this version of protoize/unprotoize we just give a warning for each
- one found. A later version may be able to at least unprotoize such
- missed items.
-
- Note that we may easily find all function definitions simply by
- looking for places where there is a left paren which is (ignoring
- whitespace) immediately followed by either a left-brace or by an
- upper or lower case letter. Whenever we find this combination, we
- have also found a function definition header.
-
- Finding function *declarations* using syntactic clues is much harder.
- I will probably try to do this in a later version though. */
-
-static void
-scan_for_missed_items (file_p)
- const file_info *file_p;
-{
- static const char *scan_p;
- const char *limit = clean_text_limit - 3;
- static const char *backup_limit;
-
- backup_limit = clean_text_base - 1;
-
- for (scan_p = clean_text_base; scan_p < limit; scan_p++)
- {
- if (*scan_p == ')')
- {
- static const char *last_r_paren;
- const char *ahead_p;
-
- last_r_paren = scan_p;
-
- for (ahead_p = scan_p + 1; isspace (*ahead_p); )
- check_source (++ahead_p < limit, limit);
-
- scan_p = ahead_p - 1;
-
- if (isalpha (*ahead_p) || *ahead_p == '{')
- {
- const char *last_l_paren;
- const int lineno = identify_lineno (ahead_p);
-
- if (setjmp (source_confusion_recovery))
- continue;
-
- /* We know we have a function definition header. Now skip
- leftwards over all of its associated formals lists. */
-
- do
- {
- last_l_paren = careful_find_l_paren (last_r_paren);
- for (last_r_paren = last_l_paren-1; isspace (*last_r_paren); )
- check_source (--last_r_paren >= backup_limit, backup_limit);
- }
- while (*last_r_paren == ')');
-
- if (is_id_char (*last_r_paren))
- {
- const char *id_limit = last_r_paren + 1;
- const char *id_start;
- size_t id_length;
- const def_dec_info *dd_p;
-
- for (id_start = id_limit-1; is_id_char (*id_start); )
- check_source (--id_start >= backup_limit, backup_limit);
- id_start++;
- backup_limit = id_start;
- if ((id_length = (size_t) (id_limit - id_start)) == 0)
- goto not_missed;
-
- {
- char *func_name = (char *) alloca (id_length + 1);
- static const char * const stmt_keywords[]
- = { "if", "else", "do", "while", "for", "switch", "case", "return", 0 };
- const char * const *stmt_keyword;
-
- strncpy (func_name, id_start, id_length);
- func_name[id_length] = '\0';
-
- /* We must check here to see if we are actually looking at
- a statement rather than an actual function call. */
-
- for (stmt_keyword = stmt_keywords; *stmt_keyword; stmt_keyword++)
- if (!strcmp (func_name, *stmt_keyword))
- goto not_missed;
-
-#if 0
- fprintf (stderr, "%s: found definition of `%s' at %s(%d)\n",
- pname,
- func_name,
- shortpath (NULL, file_p->hash_entry->symbol),
- identify_lineno (id_start));
-#endif /* 0 */
- /* We really should check for a match of the function name
- here also, but why bother. */
-
- for (dd_p = file_p->defs_decs; dd_p; dd_p = dd_p->next_in_file)
- if (dd_p->is_func_def && dd_p->line == lineno)
- goto not_missed;
-
- /* If we make it here, then we did not know about this
- function definition. */
-
- fprintf (stderr, "%s: %d: warning: `%s' excluded by preprocessing\n",
- shortpath (NULL, file_p->hash_entry->symbol),
- identify_lineno (id_start), func_name);
- fprintf (stderr, "%s: function definition not converted\n",
- pname);
- }
- not_missed: ;
- }
- }
- }
- }
-}
-
-/* Do all editing operations for a single source file (either a "base" file
- or an "include" file). To do this we read the file into memory, keep a
- virgin copy there, make another cleaned in-core copy of the original file
- (i.e. one in which all of the comments and preprocessing directives have
- been replaced with whitespace), then use these two in-core copies of the
- file to make a new edited in-core copy of the file. Finally, rename the
- original file (as a way of saving it), and then write the edited version
- of the file from core to a disk file of the same name as the original.
-
- Note that the trick of making a copy of the original sans comments &
- preprocessing directives make the editing a whole lot easier. */
-
-static void
-edit_file (hp)
- const hash_table_entry *hp;
-{
- struct stat stat_buf;
- const file_info *file_p = hp->fip;
- char *new_orig_text_base;
- char *new_orig_text_limit;
- char *new_clean_text_base;
- char *new_clean_text_limit;
- size_t orig_size;
- size_t repl_size;
- int first_definition_in_file;
-
- /* If we are not supposed to be converting this file, or if there is
- nothing in there which needs converting, just skip this file. */
-
- if (!needs_to_be_converted (file_p))
- return;
-
- convert_filename = file_p->hash_entry->symbol;
-
- /* Convert a file if it is in a directory where we want conversion
- and the file is not excluded. */
-
- if (!directory_specified_p (convert_filename)
- || file_excluded_p (convert_filename))
- {
- if (!quiet_flag
-#ifdef UNPROTOIZE
- /* Don't even mention "system" include files unless we are
- protoizing. If we are protoizing, we mention these as a
- gentle way of prodding the user to convert his "system"
- include files to prototype format. */
- && !in_system_include_dir (convert_filename)
-#endif /* defined (UNPROTOIZE) */
- )
- fprintf (stderr, "%s: `%s' not converted\n",
- pname, shortpath (NULL, convert_filename));
- return;
- }
-
- /* Let the user know what we are up to. */
-
- if (nochange_flag)
- fprintf (stderr, "%s: would convert file `%s'\n",
- pname, shortpath (NULL, convert_filename));
- else
- fprintf (stderr, "%s: converting file `%s'\n",
- pname, shortpath (NULL, convert_filename));
- fflush (stderr);
-
- /* Find out the size (in bytes) of the original file. */
-
- /* The cast avoids an erroneous warning on AIX. */
- if (my_stat ((char *)convert_filename, &stat_buf) == -1)
- {
- fprintf (stderr, "%s: can't get status for file `%s': %s\n",
- pname, shortpath (NULL, convert_filename), my_strerror(errno));
- return;
- }
- orig_size = stat_buf.st_size;
-
- /* Allocate a buffer to hold the original text. */
-
- orig_text_base = new_orig_text_base = (char *) xmalloc (orig_size + 2);
- orig_text_limit = new_orig_text_limit = new_orig_text_base + orig_size;
-
- /* Allocate a buffer to hold the cleaned-up version of the original text. */
-
- clean_text_base = new_clean_text_base = (char *) xmalloc (orig_size + 2);
- clean_text_limit = new_clean_text_limit = new_clean_text_base + orig_size;
- clean_read_ptr = clean_text_base - 1;
-
- /* Allocate a buffer that will hopefully be large enough to hold the entire
- converted output text. As an initial guess for the maximum size of the
- output buffer, use 125% of the size of the original + some extra. This
- buffer can be expanded later as needed. */
-
- repl_size = orig_size + (orig_size >> 2) + 4096;
- repl_text_base = (char *) xmalloc (repl_size + 2);
- repl_text_limit = repl_text_base + repl_size - 1;
- repl_write_ptr = repl_text_base - 1;
-
- {
- int input_file;
-
- /* Open the file to be converted in READ ONLY mode. */
-
- if ((input_file = my_open (convert_filename, O_RDONLY, 0444)) == -1)
- {
- fprintf (stderr, "%s: can't open file `%s' for reading: %s\n",
- pname, shortpath (NULL, convert_filename),
- my_strerror(errno));
- return;
- }
-
- /* Read the entire original source text file into the original text buffer
- in one swell fwoop. Then figure out where the end of the text is and
- make sure that it ends with a newline followed by a null. */
-
- if (safe_read (input_file, new_orig_text_base, orig_size) != orig_size)
- {
- close (input_file);
- fprintf (stderr, "\n%s: error reading input file `%s': %s\n",
- pname, shortpath (NULL, convert_filename),
- my_strerror(errno));
- return;
- }
-
- close (input_file);
- }
-
- if (orig_size == 0 || orig_text_limit[-1] != '\n')
- {
- *new_orig_text_limit++ = '\n';
- orig_text_limit++;
- }
-
- /* Create the cleaned up copy of the original text. */
-
- memcpy (new_clean_text_base, orig_text_base,
- (size_t) (orig_text_limit - orig_text_base));
- do_cleaning (new_clean_text_base, new_clean_text_limit);
-
-#if 0
- {
- int clean_file;
- size_t clean_size = orig_text_limit - orig_text_base;
- char *const clean_filename = (char *) alloca (strlen (convert_filename) + 6 + 1);
-
- /* Open (and create) the clean file. */
-
- strcpy (clean_filename, convert_filename);
- strcat (clean_filename, ".clean");
- if ((clean_file = creat (clean_filename, 0666)) == -1)
- {
- fprintf (stderr, "%s: can't create/open clean file `%s': %s\n",
- pname, shortpath (NULL, clean_filename),
- my_strerror(errno));
- return;
- }
-
- /* Write the clean file. */
-
- safe_write (clean_file, new_clean_text_base, clean_size, clean_filename);
-
- close (clean_file);
- }
-#endif /* 0 */
-
- /* Do a simplified scan of the input looking for things that were not
- mentioned in the aux info files because of the fact that they were
- in a region of the source which was preprocessed-out (via #if or
- via #ifdef). */
-
- scan_for_missed_items (file_p);
-
- /* Setup to do line-oriented forward seeking in the clean text buffer. */
-
- last_known_line_number = 1;
- last_known_line_start = clean_text_base;
-
- /* Now get down to business and make all of the necessary edits. */
-
- {
- const def_dec_info *def_dec_p;
-
- first_definition_in_file = 1;
- def_dec_p = file_p->defs_decs;
- for (; def_dec_p; def_dec_p = def_dec_p->next_in_file)
- {
- const char *clean_text_p = seek_to_line (def_dec_p->line);
-
- /* clean_text_p now points to the first character of the line which
- contains the `terminator' for the declaration or definition that
- we are about to process. */
-
-#ifndef UNPROTOIZE
-
- if (global_flag && def_dec_p->is_func_def && first_definition_in_file)
- {
- add_global_decls (def_dec_p->file, clean_text_p);
- first_definition_in_file = 0;
- }
-
- /* Don't edit this item if it is already in prototype format or if it
- is a function declaration and we have found no corresponding
- definition. */
-
- if (def_dec_p->prototyped
- || (!def_dec_p->is_func_def && !def_dec_p->definition))
- continue;
-
-#endif /* !defined (UNPROTOIZE) */
-
- if (def_dec_p->is_func_def)
- edit_fn_definition (def_dec_p, clean_text_p);
- else
-#ifndef UNPROTOIZE
- if (def_dec_p->is_implicit)
- add_local_decl (def_dec_p, clean_text_p);
- else
-#endif /* !defined (UNPROTOIZE) */
- edit_fn_declaration (def_dec_p, clean_text_p);
- }
- }
-
- /* Finalize things. Output the last trailing part of the original text. */
-
- output_up_to (clean_text_limit - 1);
-
- /* If this is just a test run, stop now and just deallocate the buffers. */
-
- if (nochange_flag)
- {
- free (new_orig_text_base);
- free (new_clean_text_base);
- free (repl_text_base);
- return;
- }
-
- /* Change the name of the original input file. This is just a quick way of
- saving the original file. */
-
- if (!nosave_flag)
- {
- char *new_filename =
- (char *) xmalloc (strlen (convert_filename) + strlen (save_suffix) + 2);
-
- strcpy (new_filename, convert_filename);
- strcat (new_filename, save_suffix);
- if (my_link (convert_filename, new_filename) == -1)
- {
- if (errno == EEXIST)
- {
- if (!quiet_flag)
- fprintf (stderr, "%s: warning: file `%s' already saved in `%s'\n",
- pname,
- shortpath (NULL, convert_filename),
- shortpath (NULL, new_filename));
- }
- else
- {
- fprintf (stderr, "%s: can't link file `%s' to `%s': %s\n",
- pname,
- shortpath (NULL, convert_filename),
- shortpath (NULL, new_filename),
- my_strerror(errno));
- return;
- }
- }
- }
-
- if (my_unlink (convert_filename) == -1)
- {
- fprintf (stderr, "%s: can't delete file `%s': %s\n",
- pname, shortpath (NULL, convert_filename), my_strerror(errno));
- return;
- }
-
- {
- int output_file;
-
- /* Open (and create) the output file. */
-
- if ((output_file = creat (convert_filename, 0666)) == -1)
- {
- fprintf (stderr, "%s: can't create/open output file `%s': %s\n",
- pname, shortpath (NULL, convert_filename),
- my_strerror(errno));
- return;
- }
-
- /* Write the output file. */
-
- {
- unsigned int out_size = (repl_write_ptr + 1) - repl_text_base;
-
- safe_write (output_file, repl_text_base, out_size, convert_filename);
- }
-
- close (output_file);
- }
-
- /* Deallocate the conversion buffers. */
-
- free (new_orig_text_base);
- free (new_clean_text_base);
- free (repl_text_base);
-
- /* Change the mode of the output file to match the original file. */
-
- /* The cast avoids an erroneous warning on AIX. */
- if (my_chmod ((char *)convert_filename, stat_buf.st_mode) == -1)
- fprintf (stderr, "%s: can't change mode of file `%s': %s\n",
- pname, shortpath (NULL, convert_filename), my_strerror(errno));
-
- /* Note: We would try to change the owner and group of the output file
- to match those of the input file here, except that may not be a good
- thing to do because it might be misleading. Also, it might not even
- be possible to do that (on BSD systems with quotas for instance). */
-}
-
-/* Do all of the individual steps needed to do the protoization (or
- unprotoization) of the files referenced in the aux_info files given
- in the command line. */
-
-static void
-do_processing ()
-{
- const char * const *base_pp;
- const char * const * const end_pps
- = &base_source_filenames[n_base_source_files];
-
-#ifndef UNPROTOIZE
- int syscalls_len;
-#endif /* !defined (UNPROTOIZE) */
-
- /* One-by-one, check (and create if necessary), open, and read all of the
- stuff in each aux_info file. After reading each aux_info file, the
- aux_info_file just read will be automatically deleted unless the
- keep_flag is set. */
-
- for (base_pp = base_source_filenames; base_pp < end_pps; base_pp++)
- process_aux_info_file (*base_pp, keep_flag, 0);
-
-#ifndef UNPROTOIZE
-
- /* Also open and read the special SYSCALLS.c aux_info file which gives us
- the prototypes for all of the standard system-supplied functions. */
-
- if (nondefault_syscalls_dir)
- {
- syscalls_absolute_filename
- = (char *) xmalloc (strlen (nondefault_syscalls_dir)
- + sizeof (syscalls_filename) + 1);
- strcpy (syscalls_absolute_filename, nondefault_syscalls_dir);
- }
- else
- {
- syscalls_absolute_filename
- = (char *) xmalloc (strlen (default_syscalls_dir)
- + sizeof (syscalls_filename) + 1);
- strcpy (syscalls_absolute_filename, default_syscalls_dir);
- }
-
- syscalls_len = strlen (syscalls_absolute_filename);
- if (*(syscalls_absolute_filename + syscalls_len - 1) != '/')
- {
- *(syscalls_absolute_filename + syscalls_len++) = '/';
- *(syscalls_absolute_filename + syscalls_len) = '\0';
- }
- strcat (syscalls_absolute_filename, syscalls_filename);
-
- /* Call process_aux_info_file in such a way that it does not try to
- delete the SYSCALLS aux_info file. */
-
- process_aux_info_file (syscalls_absolute_filename, 1, 1);
-
-#endif /* !defined (UNPROTOIZE) */
-
- /* When we first read in all of the information from the aux_info files
- we saved in it descending line number order, because that was likely to
- be faster. Now however, we want the chains of def & dec records to
- appear in ascending line number order as we get further away from the
- file_info record that they hang from. The following line causes all of
- these lists to be rearranged into ascending line number order. */
-
- visit_each_hash_node (filename_primary, reverse_def_dec_list);
-
-#ifndef UNPROTOIZE
-
- /* Now do the "real" work. The following line causes each declaration record
- to be "visited". For each of these nodes, an attempt is made to match
- up the function declaration with a corresponding function definition,
- which should have a full prototype-format formals list with it. Once
- these match-ups are made, the conversion of the function declarations
- to prototype format can be made. */
-
- visit_each_hash_node (function_name_primary, connect_defs_and_decs);
-
-#endif /* !defined (UNPROTOIZE) */
-
- /* Now convert each file that can be converted (and needs to be). */
-
- visit_each_hash_node (filename_primary, edit_file);
-
-#ifndef UNPROTOIZE
-
- /* If we are working in cplusplus mode, try to rename all .c files to .C
- files. Don't panic if some of the renames don't work. */
-
- if (cplusplus_flag && !nochange_flag)
- visit_each_hash_node (filename_primary, rename_c_file);
-
-#endif /* !defined (UNPROTOIZE) */
-}
-
-static struct option longopts[] =
-{
- {"version", 0, 0, 'V'},
- {"file_name", 0, 0, 'p'},
- {"quiet", 0, 0, 'q'},
- {"silent", 0, 0, 'q'},
- {"force", 0, 0, 'f'},
- {"keep", 0, 0, 'k'},
- {"nosave", 0, 0, 'N'},
- {"nochange", 0, 0, 'n'},
- {"compiler-options", 1, 0, 'c'},
- {"exclude", 1, 0, 'x'},
- {"directory", 1, 0, 'd'},
-#ifdef UNPROTOIZE
- {"indent", 1, 0, 'i'},
-#else
- {"local", 0, 0, 'l'},
- {"global", 0, 0, 'g'},
- {"c++", 0, 0, 'C'},
- {"syscalls-dir", 1, 0, 'B'},
-#endif
- {0, 0, 0, 0}
-};
-
-int
-main (argc, argv)
- int argc;
- char **const argv;
-{
- int longind;
- int c;
- const char *params = "";
-
- pname = rindex (argv[0], '/');
- pname = pname ? pname+1 : argv[0];
-
- cwd_buffer = getpwd ();
- if (!cwd_buffer)
- {
- fprintf (stderr, "%s: cannot get working directory: %s\n",
- pname, my_strerror(errno));
- exit (1);
- }
-
- /* By default, convert the files in the current directory. */
- directory_list = string_list_cons (cwd_buffer, NULL);
-
- while ((c = getopt_long (argc, argv,
-#ifdef UNPROTOIZE
- "c:d:i:knNp:qvVx:",
-#else
- "B:c:Cd:gklnNp:qvVx:",
-#endif
- longopts, &longind)) != EOF)
- {
- if (c == 0) /* Long option. */
- c = longopts[longind].val;
- switch (c)
- {
- case 'p':
- compiler_file_name = optarg;
- break;
- case 'd':
- directory_list
- = string_list_cons (abspath (NULL, optarg), directory_list);
- break;
- case 'x':
- exclude_list = string_list_cons (optarg, exclude_list);
- break;
-
- case 'v':
- case 'V':
- version_flag = 1;
- break;
- case 'q':
- quiet_flag = 1;
- break;
-#if 0
- case 'f':
- force_flag = 1;
- break;
-#endif
- case 'n':
- nochange_flag = 1;
- keep_flag = 1;
- break;
- case 'N':
- nosave_flag = 1;
- break;
- case 'k':
- keep_flag = 1;
- break;
- case 'c':
- params = optarg;
- break;
-#ifdef UNPROTOIZE
- case 'i':
- indent_string = optarg;
- break;
-#else /* !defined (UNPROTOIZE) */
- case 'l':
- local_flag = 1;
- break;
- case 'g':
- global_flag = 1;
- break;
- case 'C':
- cplusplus_flag = 1;
- break;
- case 'B':
- nondefault_syscalls_dir = optarg;
- break;
-#endif /* !defined (UNPROTOIZE) */
- default:
- usage ();
- }
- }
-
- /* Set up compile_params based on -p and -c options. */
- munge_compile_params (params);
-
- n_base_source_files = argc - optind;
-
- /* Now actually make a list of the base source filenames. */
-
- base_source_filenames =
- (const char **) xmalloc ((n_base_source_files + 1) * sizeof (char *));
- n_base_source_files = 0;
- for (; optind < argc; optind++)
- {
- const char *path = abspath (NULL, argv[optind]);
- int len = strlen (path);
-
- if (path[len-1] == 'c' && path[len-2] == '.')
- base_source_filenames[n_base_source_files++] = path;
- else
- {
- fprintf (stderr, "%s: input file names must have .c suffixes: %s\n",
- pname, shortpath (NULL, path));
- errors++;
- }
- }
-
-#ifndef UNPROTOIZE
- /* We are only interested in the very first identifier token in the
- definition of `va_list', so if there is more junk after that first
- identifier token, delete it from the `varargs_style_indicator'. */
- {
- const char *cp;
-
- for (cp = varargs_style_indicator; isalnum (*cp) || *cp == '_'; cp++)
- continue;
- if (*cp != 0)
- varargs_style_indicator = savestring (varargs_style_indicator,
- cp - varargs_style_indicator);
- }
-#endif /* !defined (UNPROTOIZE) */
-
- if (errors)
- usage ();
- else
- {
- if (version_flag)
- fprintf (stderr, "%s: %s\n", pname, version_string);
- do_processing ();
- }
- if (errors)
- exit (1);
- else
- exit (0);
- return 1;
-}
diff --git a/gcc/real.c b/gcc/real.c
deleted file mode 100644
index f7e22eae3bb..00000000000
--- a/gcc/real.c
+++ /dev/null
@@ -1,6300 +0,0 @@
-/* real.c - implementation of REAL_ARITHMETIC, REAL_VALUE_ATOF,
- and support for XFmode IEEE extended real floating point arithmetic.
- Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
- Contributed by Stephen L. Moshier (moshier@world.std.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 <stdio.h>
-#include <errno.h>
-#include "config.h"
-#include "tree.h"
-
-#ifndef errno
-extern int errno;
-#endif
-
-/* To enable support of XFmode extended real floating point, define
-LONG_DOUBLE_TYPE_SIZE 96 in the tm.h file (m68k.h or i386.h).
-
-To support cross compilation between IEEE, VAX and IBM floating
-point formats, define REAL_ARITHMETIC in the tm.h file.
-
-In either case the machine files (tm.h) must not contain any code
-that tries to use host floating point arithmetic to convert
-REAL_VALUE_TYPEs from `double' to `float', pass them to fprintf,
-etc. In cross-compile situations a REAL_VALUE_TYPE may not
-be intelligible to the host computer's native arithmetic.
-
-The emulator defaults to the host's floating point format so that
-its decimal conversion functions can be used if desired (see
-real.h).
-
-The first part of this file interfaces gcc to a floating point
-arithmetic suite that was not written with gcc in mind. Avoid
-changing the low-level arithmetic routines unless you have suitable
-test programs available. A special version of the PARANOIA floating
-point arithmetic tester, modified for this purpose, can be found on
-usc.edu: /pub/C-numanal/ieeetest.zoo. Other tests, and libraries of
-XFmode and TFmode transcendental functions, can be obtained by ftp from
-netlib.att.com: netlib/cephes. */
-
-/* Type of computer arithmetic.
- Only one of DEC, IBM, IEEE, or UNK should get defined.
-
- `IEEE', when REAL_WORDS_BIG_ENDIAN is non-zero, refers generically
- to big-endian IEEE floating-point data structure. This definition
- should work in SFmode `float' type and DFmode `double' type on
- virtually all big-endian IEEE machines. If LONG_DOUBLE_TYPE_SIZE
- has been defined to be 96, then IEEE also invokes the particular
- XFmode (`long double' type) data structure used by the Motorola
- 680x0 series processors.
-
- `IEEE', when REAL_WORDS_BIG_ENDIAN is zero, refers generally to
- little-endian IEEE machines. In this case, if LONG_DOUBLE_TYPE_SIZE
- has been defined to be 96, then IEEE also invokes the particular
- XFmode `long double' data structure used by the Intel 80x86 series
- processors.
-
- `DEC' refers specifically to the Digital Equipment Corp PDP-11
- and VAX floating point data structure. This model currently
- supports no type wider than DFmode.
-
- `IBM' refers specifically to the IBM System/370 and compatible
- floating point data structure. This model currently supports
- no type wider than DFmode. The IBM conversions were contributed by
- frank@atom.ansto.gov.au (Frank Crawford).
-
- If LONG_DOUBLE_TYPE_SIZE = 64 (the default, unless tm.h defines it)
- then `long double' and `double' are both implemented, but they
- both mean DFmode. In this case, the software floating-point
- support available here is activated by writing
- #define REAL_ARITHMETIC
- in tm.h.
-
- The case LONG_DOUBLE_TYPE_SIZE = 128 activates TFmode support
- and may deactivate XFmode since `long double' is used to refer
- to both modes.
-
- The macros FLOAT_WORDS_BIG_ENDIAN, HOST_FLOAT_WORDS_BIG_ENDIAN,
- contributed by Richard Earnshaw <Richard.Earnshaw@cl.cam.ac.uk>,
- separate the floating point unit's endian-ness from that of
- the integer addressing. This permits one to define a big-endian
- FPU on a little-endian machine (e.g., ARM). An extension to
- BYTES_BIG_ENDIAN may be required for some machines in the future.
- These optional macros may be defined in tm.h. In real.h, they
- default to WORDS_BIG_ENDIAN, etc., so there is no need to define
- them for any normal host or target machine on which the floats
- and the integers have the same endian-ness. */
-
-
-/* The following converts gcc macros into the ones used by this file. */
-
-/* REAL_ARITHMETIC defined means that macros in real.h are
- defined to call emulator functions. */
-#ifdef REAL_ARITHMETIC
-
-#if TARGET_FLOAT_FORMAT == VAX_FLOAT_FORMAT
-/* PDP-11, Pro350, VAX: */
-#define DEC 1
-#else /* it's not VAX */
-#if TARGET_FLOAT_FORMAT == IBM_FLOAT_FORMAT
-/* IBM System/370 style */
-#define IBM 1
-#else /* it's also not an IBM */
-#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
-#define IEEE
-#else /* it's not IEEE either */
-/* UNKnown arithmetic. We don't support this and can't go on. */
-unknown arithmetic type
-#define UNK 1
-#endif /* not IEEE */
-#endif /* not IBM */
-#endif /* not VAX */
-
-#define REAL_WORDS_BIG_ENDIAN FLOAT_WORDS_BIG_ENDIAN
-
-#else
-/* REAL_ARITHMETIC not defined means that the *host's* data
- structure will be used. It may differ by endian-ness from the
- target machine's structure and will get its ends swapped
- accordingly (but not here). Probably only the decimal <-> binary
- functions in this file will actually be used in this case. */
-
-#if HOST_FLOAT_FORMAT == VAX_FLOAT_FORMAT
-#define DEC 1
-#else /* it's not VAX */
-#if HOST_FLOAT_FORMAT == IBM_FLOAT_FORMAT
-/* IBM System/370 style */
-#define IBM 1
-#else /* it's also not an IBM */
-#if HOST_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
-#define IEEE
-#else /* it's not IEEE either */
-unknown arithmetic type
-#define UNK 1
-#endif /* not IEEE */
-#endif /* not IBM */
-#endif /* not VAX */
-
-#define REAL_WORDS_BIG_ENDIAN HOST_FLOAT_WORDS_BIG_ENDIAN
-
-#endif /* REAL_ARITHMETIC not defined */
-
-/* Define INFINITY for support of infinity.
- Define NANS for support of Not-a-Number's (NaN's). */
-#if !defined(DEC) && !defined(IBM)
-#define INFINITY
-#define NANS
-#endif
-
-/* Support of NaNs requires support of infinity. */
-#ifdef NANS
-#ifndef INFINITY
-#define INFINITY
-#endif
-#endif
-
-/* Find a host integer type that is at least 16 bits wide,
- and another type at least twice whatever that size is. */
-
-#if HOST_BITS_PER_CHAR >= 16
-#define EMUSHORT char
-#define EMUSHORT_SIZE HOST_BITS_PER_CHAR
-#define EMULONG_SIZE (2 * HOST_BITS_PER_CHAR)
-#else
-#if HOST_BITS_PER_SHORT >= 16
-#define EMUSHORT short
-#define EMUSHORT_SIZE HOST_BITS_PER_SHORT
-#define EMULONG_SIZE (2 * HOST_BITS_PER_SHORT)
-#else
-#if HOST_BITS_PER_INT >= 16
-#define EMUSHORT int
-#define EMUSHORT_SIZE HOST_BITS_PER_INT
-#define EMULONG_SIZE (2 * HOST_BITS_PER_INT)
-#else
-#if HOST_BITS_PER_LONG >= 16
-#define EMUSHORT long
-#define EMUSHORT_SIZE HOST_BITS_PER_LONG
-#define EMULONG_SIZE (2 * HOST_BITS_PER_LONG)
-#else
-/* You will have to modify this program to have a smaller unit size. */
-#define EMU_NON_COMPILE
-#endif
-#endif
-#endif
-#endif
-
-#if HOST_BITS_PER_SHORT >= EMULONG_SIZE
-#define EMULONG short
-#else
-#if HOST_BITS_PER_INT >= EMULONG_SIZE
-#define EMULONG int
-#else
-#if HOST_BITS_PER_LONG >= EMULONG_SIZE
-#define EMULONG long
-#else
-#if HOST_BITS_PER_LONG_LONG >= EMULONG_SIZE
-#define EMULONG long long int
-#else
-/* You will have to modify this program to have a smaller unit size. */
-#define EMU_NON_COMPILE
-#endif
-#endif
-#endif
-#endif
-
-
-/* The host interface doesn't work if no 16-bit size exists. */
-#if EMUSHORT_SIZE != 16
-#define EMU_NON_COMPILE
-#endif
-
-/* OK to continue compilation. */
-#ifndef EMU_NON_COMPILE
-
-/* Construct macros to translate between REAL_VALUE_TYPE and e type.
- In GET_REAL and PUT_REAL, r and e are pointers.
- A REAL_VALUE_TYPE is guaranteed to occupy contiguous locations
- in memory, with no holes. */
-
-#if LONG_DOUBLE_TYPE_SIZE == 96
-/* Number of 16 bit words in external e type format */
-#define NE 6
-#define MAXDECEXP 4932
-#define MINDECEXP -4956
-#define GET_REAL(r,e) bcopy ((char *) r, (char *) e, 2*NE)
-#define PUT_REAL(e,r) bcopy ((char *) e, (char *) r, 2*NE)
-#else /* no XFmode */
-#if LONG_DOUBLE_TYPE_SIZE == 128
-#define NE 10
-#define MAXDECEXP 4932
-#define MINDECEXP -4977
-#define GET_REAL(r,e) bcopy ((char *) r, (char *) e, 2*NE)
-#define PUT_REAL(e,r) bcopy ((char *) e, (char *) r, 2*NE)
-#else
-#define NE 6
-#define MAXDECEXP 4932
-#define MINDECEXP -4956
-#ifdef REAL_ARITHMETIC
-/* Emulator uses target format internally
- but host stores it in host endian-ness. */
-
-#define GET_REAL(r,e) \
-do { \
- if (HOST_FLOAT_WORDS_BIG_ENDIAN == REAL_WORDS_BIG_ENDIAN) \
- e53toe ((unsigned EMUSHORT *) (r), (e)); \
- else \
- { \
- unsigned EMUSHORT w[4]; \
- w[3] = ((EMUSHORT *) r)[0]; \
- w[2] = ((EMUSHORT *) r)[1]; \
- w[1] = ((EMUSHORT *) r)[2]; \
- w[0] = ((EMUSHORT *) r)[3]; \
- e53toe (w, (e)); \
- } \
- } while (0)
-
-#define PUT_REAL(e,r) \
-do { \
- if (HOST_FLOAT_WORDS_BIG_ENDIAN == REAL_WORDS_BIG_ENDIAN) \
- etoe53 ((e), (unsigned EMUSHORT *) (r)); \
- else \
- { \
- unsigned EMUSHORT w[4]; \
- etoe53 ((e), w); \
- *((EMUSHORT *) r) = w[3]; \
- *((EMUSHORT *) r + 1) = w[2]; \
- *((EMUSHORT *) r + 2) = w[1]; \
- *((EMUSHORT *) r + 3) = w[0]; \
- } \
- } while (0)
-
-#else /* not REAL_ARITHMETIC */
-
-/* emulator uses host format */
-#define GET_REAL(r,e) e53toe ((unsigned EMUSHORT *) (r), (e))
-#define PUT_REAL(e,r) etoe53 ((e), (unsigned EMUSHORT *) (r))
-
-#endif /* not REAL_ARITHMETIC */
-#endif /* not TFmode */
-#endif /* no XFmode */
-
-
-/* Number of 16 bit words in internal format */
-#define NI (NE+3)
-
-/* Array offset to exponent */
-#define E 1
-
-/* Array offset to high guard word */
-#define M 2
-
-/* Number of bits of precision */
-#define NBITS ((NI-4)*16)
-
-/* Maximum number of decimal digits in ASCII conversion
- * = NBITS*log10(2)
- */
-#define NDEC (NBITS*8/27)
-
-/* The exponent of 1.0 */
-#define EXONE (0x3fff)
-
-extern int extra_warnings;
-extern unsigned EMUSHORT ezero[], ehalf[], eone[], etwo[];
-extern unsigned EMUSHORT elog2[], esqrt2[];
-
-static void endian PROTO((unsigned EMUSHORT *, long *,
- enum machine_mode));
-static void eclear PROTO((unsigned EMUSHORT *));
-static void emov PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void eabs PROTO((unsigned EMUSHORT *));
-static void eneg PROTO((unsigned EMUSHORT *));
-static int eisneg PROTO((unsigned EMUSHORT *));
-static int eisinf PROTO((unsigned EMUSHORT *));
-static int eisnan PROTO((unsigned EMUSHORT *));
-static void einfin PROTO((unsigned EMUSHORT *));
-static void enan PROTO((unsigned EMUSHORT *, int));
-static void emovi PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void emovo PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void ecleaz PROTO((unsigned EMUSHORT *));
-static void ecleazs PROTO((unsigned EMUSHORT *));
-static void emovz PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void einan PROTO((unsigned EMUSHORT *));
-static int eiisnan PROTO((unsigned EMUSHORT *));
-static int eiisneg PROTO((unsigned EMUSHORT *));
-static void eiinfin PROTO((unsigned EMUSHORT *));
-static int eiisinf PROTO((unsigned EMUSHORT *));
-static int ecmpm PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void eshdn1 PROTO((unsigned EMUSHORT *));
-static void eshup1 PROTO((unsigned EMUSHORT *));
-static void eshdn8 PROTO((unsigned EMUSHORT *));
-static void eshup8 PROTO((unsigned EMUSHORT *));
-static void eshup6 PROTO((unsigned EMUSHORT *));
-static void eshdn6 PROTO((unsigned EMUSHORT *));
-static void eaddm PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void esubm PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void m16m PROTO((unsigned int, unsigned short *,
- unsigned short *));
-static int edivm PROTO((unsigned short *, unsigned short *));
-static int emulm PROTO((unsigned short *, unsigned short *));
-static void emdnorm PROTO((unsigned EMUSHORT *, int, int, EMULONG, int));
-static void esub PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *,
- unsigned EMUSHORT *));
-static void eadd PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *,
- unsigned EMUSHORT *));
-static void eadd1 PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *,
- unsigned EMUSHORT *));
-static void ediv PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *,
- unsigned EMUSHORT *));
-static void emul PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *,
- unsigned EMUSHORT *));
-static void e53toe PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void e64toe PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void e113toe PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void e24toe PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void etoe113 PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void toe113 PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void etoe64 PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void toe64 PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void etoe53 PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void toe53 PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void etoe24 PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void toe24 PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static int ecmp PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void eround PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void ltoe PROTO((HOST_WIDE_INT *, unsigned EMUSHORT *));
-static void ultoe PROTO((unsigned HOST_WIDE_INT *, unsigned EMUSHORT *));
-static void eifrac PROTO((unsigned EMUSHORT *, HOST_WIDE_INT *,
- unsigned EMUSHORT *));
-static void euifrac PROTO((unsigned EMUSHORT *, unsigned HOST_WIDE_INT *,
- unsigned EMUSHORT *));
-static int eshift PROTO((unsigned EMUSHORT *, int));
-static int enormlz PROTO((unsigned EMUSHORT *));
-static void e24toasc PROTO((unsigned EMUSHORT *, char *, int));
-static void e53toasc PROTO((unsigned EMUSHORT *, char *, int));
-static void e64toasc PROTO((unsigned EMUSHORT *, char *, int));
-static void e113toasc PROTO((unsigned EMUSHORT *, char *, int));
-static void etoasc PROTO((unsigned EMUSHORT *, char *, int));
-static void asctoe24 PROTO((char *, unsigned EMUSHORT *));
-static void asctoe53 PROTO((char *, unsigned EMUSHORT *));
-static void asctoe64 PROTO((char *, unsigned EMUSHORT *));
-static void asctoe113 PROTO((char *, unsigned EMUSHORT *));
-static void asctoe PROTO((char *, unsigned EMUSHORT *));
-static void asctoeg PROTO((char *, unsigned EMUSHORT *, int));
-static void efloor PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void efrexp PROTO((unsigned EMUSHORT *, int *,
- unsigned EMUSHORT *));
-static void eldexp PROTO((unsigned EMUSHORT *, int, unsigned EMUSHORT *));
-static void eremain PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *,
- unsigned EMUSHORT *));
-static void eiremain PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void mtherr PROTO((char *, int));
-static void dectoe PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void etodec PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void todec PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void ibmtoe PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *,
- enum machine_mode));
-static void etoibm PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *,
- enum machine_mode));
-static void toibm PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *,
- enum machine_mode));
-static void make_nan PROTO((unsigned EMUSHORT *, int, enum machine_mode));
-static void uditoe PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void ditoe PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void etoudi PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void etodi PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-static void esqrt PROTO((unsigned EMUSHORT *, unsigned EMUSHORT *));
-
-/* Copy 32-bit numbers obtained from array containing 16-bit numbers,
- swapping ends if required, into output array of longs. The
- result is normally passed to fprintf by the ASM_OUTPUT_ macros. */
-
-static void
-endian (e, x, mode)
- unsigned EMUSHORT e[];
- long x[];
- enum machine_mode mode;
-{
- unsigned long th, t;
-
- if (REAL_WORDS_BIG_ENDIAN)
- {
- switch (mode)
- {
-
- case TFmode:
- /* Swap halfwords in the fourth long. */
- th = (unsigned long) e[6] & 0xffff;
- t = (unsigned long) e[7] & 0xffff;
- t |= th << 16;
- x[3] = (long) t;
-
- case XFmode:
-
- /* Swap halfwords in the third long. */
- th = (unsigned long) e[4] & 0xffff;
- t = (unsigned long) e[5] & 0xffff;
- t |= th << 16;
- x[2] = (long) t;
- /* fall into the double case */
-
- case DFmode:
-
- /* swap halfwords in the second word */
- th = (unsigned long) e[2] & 0xffff;
- t = (unsigned long) e[3] & 0xffff;
- t |= th << 16;
- x[1] = (long) t;
- /* fall into the float case */
-
- case HFmode:
- case SFmode:
-
- /* swap halfwords in the first word */
- th = (unsigned long) e[0] & 0xffff;
- t = (unsigned long) e[1] & 0xffff;
- t |= th << 16;
- x[0] = (long) t;
- break;
-
- default:
- abort ();
- }
- }
- else
- {
- /* Pack the output array without swapping. */
-
- switch (mode)
- {
-
- case TFmode:
-
- /* Pack the fourth long. */
- th = (unsigned long) e[7] & 0xffff;
- t = (unsigned long) e[6] & 0xffff;
- t |= th << 16;
- x[3] = (long) t;
-
- case XFmode:
-
- /* Pack the third long.
- Each element of the input REAL_VALUE_TYPE array has 16 useful bits
- in it. */
- th = (unsigned long) e[5] & 0xffff;
- t = (unsigned long) e[4] & 0xffff;
- t |= th << 16;
- x[2] = (long) t;
- /* fall into the double case */
-
- case DFmode:
-
- /* pack the second long */
- th = (unsigned long) e[3] & 0xffff;
- t = (unsigned long) e[2] & 0xffff;
- t |= th << 16;
- x[1] = (long) t;
- /* fall into the float case */
-
- case HFmode:
- case SFmode:
-
- /* pack the first long */
- th = (unsigned long) e[1] & 0xffff;
- t = (unsigned long) e[0] & 0xffff;
- t |= th << 16;
- x[0] = (long) t;
- break;
-
- default:
- abort ();
- }
- }
-}
-
-
-/* This is the implementation of the REAL_ARITHMETIC macro. */
-
-void
-earith (value, icode, r1, r2)
- REAL_VALUE_TYPE *value;
- int icode;
- REAL_VALUE_TYPE *r1;
- REAL_VALUE_TYPE *r2;
-{
- unsigned EMUSHORT d1[NE], d2[NE], v[NE];
- enum tree_code code;
-
- GET_REAL (r1, d1);
- GET_REAL (r2, d2);
-#ifdef NANS
-/* Return NaN input back to the caller. */
- if (eisnan (d1))
- {
- PUT_REAL (d1, value);
- return;
- }
- if (eisnan (d2))
- {
- PUT_REAL (d2, value);
- return;
- }
-#endif
- code = (enum tree_code) icode;
- switch (code)
- {
- case PLUS_EXPR:
- eadd (d2, d1, v);
- break;
-
- case MINUS_EXPR:
- esub (d2, d1, v); /* d1 - d2 */
- break;
-
- case MULT_EXPR:
- emul (d2, d1, v);
- break;
-
- case RDIV_EXPR:
-#ifndef REAL_INFINITY
- if (ecmp (d2, ezero) == 0)
- {
-#ifdef NANS
- enan (v, eisneg (d1) ^ eisneg (d2));
- break;
-#else
- abort ();
-#endif
- }
-#endif
- ediv (d2, d1, v); /* d1/d2 */
- break;
-
- case MIN_EXPR: /* min (d1,d2) */
- if (ecmp (d1, d2) < 0)
- emov (d1, v);
- else
- emov (d2, v);
- break;
-
- case MAX_EXPR: /* max (d1,d2) */
- if (ecmp (d1, d2) > 0)
- emov (d1, v);
- else
- emov (d2, v);
- break;
- default:
- emov (ezero, v);
- break;
- }
-PUT_REAL (v, value);
-}
-
-
-/* Truncate REAL_VALUE_TYPE toward zero to signed HOST_WIDE_INT.
- implements REAL_VALUE_RNDZINT (x) (etrunci (x)). */
-
-REAL_VALUE_TYPE
-etrunci (x)
- REAL_VALUE_TYPE x;
-{
- unsigned EMUSHORT f[NE], g[NE];
- REAL_VALUE_TYPE r;
- HOST_WIDE_INT l;
-
- GET_REAL (&x, g);
-#ifdef NANS
- if (eisnan (g))
- return (x);
-#endif
- eifrac (g, &l, f);
- ltoe (&l, g);
- PUT_REAL (g, &r);
- return (r);
-}
-
-
-/* Truncate REAL_VALUE_TYPE toward zero to unsigned HOST_WIDE_INT;
- implements REAL_VALUE_UNSIGNED_RNDZINT (x) (etruncui (x)). */
-
-REAL_VALUE_TYPE
-etruncui (x)
- REAL_VALUE_TYPE x;
-{
- unsigned EMUSHORT f[NE], g[NE];
- REAL_VALUE_TYPE r;
- unsigned HOST_WIDE_INT l;
-
- GET_REAL (&x, g);
-#ifdef NANS
- if (eisnan (g))
- return (x);
-#endif
- euifrac (g, &l, f);
- ultoe (&l, g);
- PUT_REAL (g, &r);
- return (r);
-}
-
-
-/* This is the REAL_VALUE_ATOF function. It converts a decimal string to
- binary, rounding off as indicated by the machine_mode argument. Then it
- promotes the rounded value to REAL_VALUE_TYPE. */
-
-REAL_VALUE_TYPE
-ereal_atof (s, t)
- char *s;
- enum machine_mode t;
-{
- unsigned EMUSHORT tem[NE], e[NE];
- REAL_VALUE_TYPE r;
-
- switch (t)
- {
- case HFmode:
- case SFmode:
- asctoe24 (s, tem);
- e24toe (tem, e);
- break;
- case DFmode:
- asctoe53 (s, tem);
- e53toe (tem, e);
- break;
- case XFmode:
- asctoe64 (s, tem);
- e64toe (tem, e);
- break;
- case TFmode:
- asctoe113 (s, tem);
- e113toe (tem, e);
- break;
- default:
- asctoe (s, e);
- }
- PUT_REAL (e, &r);
- return (r);
-}
-
-
-/* Expansion of REAL_NEGATE. */
-
-REAL_VALUE_TYPE
-ereal_negate (x)
- REAL_VALUE_TYPE x;
-{
- unsigned EMUSHORT e[NE];
- REAL_VALUE_TYPE r;
-
- GET_REAL (&x, e);
- eneg (e);
- PUT_REAL (e, &r);
- return (r);
-}
-
-
-/* Round real toward zero to HOST_WIDE_INT;
- implements REAL_VALUE_FIX (x). */
-
-HOST_WIDE_INT
-efixi (x)
- REAL_VALUE_TYPE x;
-{
- unsigned EMUSHORT f[NE], g[NE];
- HOST_WIDE_INT l;
-
- GET_REAL (&x, f);
-#ifdef NANS
- if (eisnan (f))
- {
- warning ("conversion from NaN to int");
- return (-1);
- }
-#endif
- eifrac (f, &l, g);
- return l;
-}
-
-/* Round real toward zero to unsigned HOST_WIDE_INT
- implements REAL_VALUE_UNSIGNED_FIX (x).
- Negative input returns zero. */
-
-unsigned HOST_WIDE_INT
-efixui (x)
- REAL_VALUE_TYPE x;
-{
- unsigned EMUSHORT f[NE], g[NE];
- unsigned HOST_WIDE_INT l;
-
- GET_REAL (&x, f);
-#ifdef NANS
- if (eisnan (f))
- {
- warning ("conversion from NaN to unsigned int");
- return (-1);
- }
-#endif
- euifrac (f, &l, g);
- return l;
-}
-
-
-/* REAL_VALUE_FROM_INT macro. */
-
-void
-ereal_from_int (d, i, j, mode)
- REAL_VALUE_TYPE *d;
- HOST_WIDE_INT i, j;
- enum machine_mode mode;
-{
- unsigned EMUSHORT df[NE], dg[NE];
- HOST_WIDE_INT low, high;
- int sign;
-
- if (GET_MODE_CLASS (mode) != MODE_FLOAT)
- abort ();
- sign = 0;
- low = i;
- if ((high = j) < 0)
- {
- sign = 1;
- /* complement and add 1 */
- high = ~high;
- if (low)
- low = -low;
- else
- high += 1;
- }
- eldexp (eone, HOST_BITS_PER_WIDE_INT, df);
- ultoe ((unsigned HOST_WIDE_INT *) &high, dg);
- emul (dg, df, dg);
- ultoe ((unsigned HOST_WIDE_INT *) &low, df);
- eadd (df, dg, dg);
- if (sign)
- eneg (dg);
-
- /* A REAL_VALUE_TYPE may not be wide enough to hold the two HOST_WIDE_INTS.
- Avoid double-rounding errors later by rounding off now from the
- extra-wide internal format to the requested precision. */
- switch (GET_MODE_BITSIZE (mode))
- {
- case 32:
- etoe24 (dg, df);
- e24toe (df, dg);
- break;
-
- case 64:
- etoe53 (dg, df);
- e53toe (df, dg);
- break;
-
- case 96:
- etoe64 (dg, df);
- e64toe (df, dg);
- break;
-
- case 128:
- etoe113 (dg, df);
- e113toe (df, dg);
- break;
-
- default:
- abort ();
- }
-
- PUT_REAL (dg, d);
-}
-
-
-/* REAL_VALUE_FROM_UNSIGNED_INT macro. */
-
-void
-ereal_from_uint (d, i, j, mode)
- REAL_VALUE_TYPE *d;
- unsigned HOST_WIDE_INT i, j;
- enum machine_mode mode;
-{
- unsigned EMUSHORT df[NE], dg[NE];
- unsigned HOST_WIDE_INT low, high;
-
- if (GET_MODE_CLASS (mode) != MODE_FLOAT)
- abort ();
- low = i;
- high = j;
- eldexp (eone, HOST_BITS_PER_WIDE_INT, df);
- ultoe (&high, dg);
- emul (dg, df, dg);
- ultoe (&low, df);
- eadd (df, dg, dg);
-
- /* A REAL_VALUE_TYPE may not be wide enough to hold the two HOST_WIDE_INTS.
- Avoid double-rounding errors later by rounding off now from the
- extra-wide internal format to the requested precision. */
- switch (GET_MODE_BITSIZE (mode))
- {
- case 32:
- etoe24 (dg, df);
- e24toe (df, dg);
- break;
-
- case 64:
- etoe53 (dg, df);
- e53toe (df, dg);
- break;
-
- case 96:
- etoe64 (dg, df);
- e64toe (df, dg);
- break;
-
- case 128:
- etoe113 (dg, df);
- e113toe (df, dg);
- break;
-
- default:
- abort ();
- }
-
- PUT_REAL (dg, d);
-}
-
-
-/* REAL_VALUE_TO_INT macro. */
-
-void
-ereal_to_int (low, high, rr)
- HOST_WIDE_INT *low, *high;
- REAL_VALUE_TYPE rr;
-{
- unsigned EMUSHORT d[NE], df[NE], dg[NE], dh[NE];
- int s;
-
- GET_REAL (&rr, d);
-#ifdef NANS
- if (eisnan (d))
- {
- warning ("conversion from NaN to int");
- *low = -1;
- *high = -1;
- return;
- }
-#endif
- /* convert positive value */
- s = 0;
- if (eisneg (d))
- {
- eneg (d);
- s = 1;
- }
- eldexp (eone, HOST_BITS_PER_WIDE_INT, df);
- ediv (df, d, dg); /* dg = d / 2^32 is the high word */
- euifrac (dg, (unsigned HOST_WIDE_INT *) high, dh);
- emul (df, dh, dg); /* fractional part is the low word */
- euifrac (dg, (unsigned HOST_WIDE_INT *)low, dh);
- if (s)
- {
- /* complement and add 1 */
- *high = ~(*high);
- if (*low)
- *low = -(*low);
- else
- *high += 1;
- }
-}
-
-
-/* REAL_VALUE_LDEXP macro. */
-
-REAL_VALUE_TYPE
-ereal_ldexp (x, n)
- REAL_VALUE_TYPE x;
- int n;
-{
- unsigned EMUSHORT e[NE], y[NE];
- REAL_VALUE_TYPE r;
-
- GET_REAL (&x, e);
-#ifdef NANS
- if (eisnan (e))
- return (x);
-#endif
- eldexp (e, n, y);
- PUT_REAL (y, &r);
- return (r);
-}
-
-/* These routines are conditionally compiled because functions
- of the same names may be defined in fold-const.c. */
-
-#ifdef REAL_ARITHMETIC
-
-/* Check for infinity in a REAL_VALUE_TYPE. */
-
-int
-target_isinf (x)
- REAL_VALUE_TYPE x;
-{
- unsigned EMUSHORT e[NE];
-
-#ifdef INFINITY
- GET_REAL (&x, e);
- return (eisinf (e));
-#else
- return 0;
-#endif
-}
-
-/* Check whether a REAL_VALUE_TYPE item is a NaN. */
-
-int
-target_isnan (x)
- REAL_VALUE_TYPE x;
-{
- unsigned EMUSHORT e[NE];
-
-#ifdef NANS
- GET_REAL (&x, e);
- return (eisnan (e));
-#else
- return (0);
-#endif
-}
-
-
-/* Check for a negative REAL_VALUE_TYPE number.
- This just checks the sign bit, so that -0 counts as negative. */
-
-int
-target_negative (x)
- REAL_VALUE_TYPE x;
-{
- return ereal_isneg (x);
-}
-
-/* Expansion of REAL_VALUE_TRUNCATE.
- The result is in floating point, rounded to nearest or even. */
-
-REAL_VALUE_TYPE
-real_value_truncate (mode, arg)
- enum machine_mode mode;
- REAL_VALUE_TYPE arg;
-{
- unsigned EMUSHORT e[NE], t[NE];
- REAL_VALUE_TYPE r;
-
- GET_REAL (&arg, e);
-#ifdef NANS
- if (eisnan (e))
- return (arg);
-#endif
- eclear (t);
- switch (mode)
- {
- case TFmode:
- etoe113 (e, t);
- e113toe (t, t);
- break;
-
- case XFmode:
- etoe64 (e, t);
- e64toe (t, t);
- break;
-
- case DFmode:
- etoe53 (e, t);
- e53toe (t, t);
- break;
-
- case HFmode:
- case SFmode:
- etoe24 (e, t);
- e24toe (t, t);
- break;
-
- case SImode:
- r = etrunci (arg);
- return (r);
-
- /* If an unsupported type was requested, presume that
- the machine files know something useful to do with
- the unmodified value. */
-
- default:
- return (arg);
- }
- PUT_REAL (t, &r);
- return (r);
-}
-
-/* Try to change R into its exact multiplicative inverse in machine mode
- MODE. Return nonzero function value if successful. */
-
-int
-exact_real_inverse (mode, r)
- enum machine_mode mode;
- REAL_VALUE_TYPE *r;
-{
- unsigned EMUSHORT e[NE], einv[NE];
- REAL_VALUE_TYPE rinv;
- int i;
-
- GET_REAL (r, e);
-
- /* Test for input in range. Don't transform IEEE special values. */
- if (eisinf (e) || eisnan (e) || (ecmp (e, ezero) == 0))
- return 0;
-
- /* Test for a power of 2: all significand bits zero except the MSB.
- We are assuming the target has binary (or hex) arithmetic. */
- if (e[NE - 2] != 0x8000)
- return 0;
-
- for (i = 0; i < NE - 2; i++)
- {
- if (e[i] != 0)
- return 0;
- }
-
- /* Compute the inverse and truncate it to the required mode. */
- ediv (e, eone, einv);
- PUT_REAL (einv, &rinv);
- rinv = real_value_truncate (mode, rinv);
-
-#ifdef CHECK_FLOAT_VALUE
- /* This check is not redundant. It may, for example, flush
- a supposedly IEEE denormal value to zero. */
- i = 0;
- if (CHECK_FLOAT_VALUE (mode, rinv, i))
- return 0;
-#endif
- GET_REAL (&rinv, einv);
-
- /* Check the bits again, because the truncation might have
- generated an arbitrary saturation value on overflow. */
- if (einv[NE - 2] != 0x8000)
- return 0;
-
- for (i = 0; i < NE - 2; i++)
- {
- if (einv[i] != 0)
- return 0;
- }
-
- /* Fail if the computed inverse is out of range. */
- if (eisinf (einv) || eisnan (einv) || (ecmp (einv, ezero) == 0))
- return 0;
-
- /* Output the reciprocal and return success flag. */
- PUT_REAL (einv, r);
- return 1;
-}
-#endif /* REAL_ARITHMETIC defined */
-
-/* Used for debugging--print the value of R in human-readable format
- on stderr. */
-
-void
-debug_real (r)
- REAL_VALUE_TYPE r;
-{
- char dstr[30];
-
- REAL_VALUE_TO_DECIMAL (r, "%.20g", dstr);
- fprintf (stderr, "%s", dstr);
-}
-
-
-/* The following routines convert REAL_VALUE_TYPE to the various floating
- point formats that are meaningful to supported computers.
-
- The results are returned in 32-bit pieces, each piece stored in a `long'.
- This is so they can be printed by statements like
-
- fprintf (file, "%lx, %lx", L[0], L[1]);
-
- that will work on both narrow- and wide-word host computers. */
-
-/* Convert R to a 128-bit long double precision value. The output array L
- contains four 32-bit pieces of the result, in the order they would appear
- in memory. */
-
-void
-etartdouble (r, l)
- REAL_VALUE_TYPE r;
- long l[];
-{
- unsigned EMUSHORT e[NE];
-
- GET_REAL (&r, e);
- etoe113 (e, e);
- endian (e, l, TFmode);
-}
-
-/* Convert R to a double extended precision value. The output array L
- contains three 32-bit pieces of the result, in the order they would
- appear in memory. */
-
-void
-etarldouble (r, l)
- REAL_VALUE_TYPE r;
- long l[];
-{
- unsigned EMUSHORT e[NE];
-
- GET_REAL (&r, e);
- etoe64 (e, e);
- endian (e, l, XFmode);
-}
-
-/* Convert R to a double precision value. The output array L contains two
- 32-bit pieces of the result, in the order they would appear in memory. */
-
-void
-etardouble (r, l)
- REAL_VALUE_TYPE r;
- long l[];
-{
- unsigned EMUSHORT e[NE];
-
- GET_REAL (&r, e);
- etoe53 (e, e);
- endian (e, l, DFmode);
-}
-
-/* Convert R to a single precision float value stored in the least-significant
- bits of a `long'. */
-
-long
-etarsingle (r)
- REAL_VALUE_TYPE r;
-{
- unsigned EMUSHORT e[NE];
- long l;
-
- GET_REAL (&r, e);
- etoe24 (e, e);
- endian (e, &l, SFmode);
- return ((long) l);
-}
-
-/* Convert X to a decimal ASCII string S for output to an assembly
- language file. Note, there is no standard way to spell infinity or
- a NaN, so these values may require special treatment in the tm.h
- macros. */
-
-void
-ereal_to_decimal (x, s)
- REAL_VALUE_TYPE x;
- char *s;
-{
- unsigned EMUSHORT e[NE];
-
- GET_REAL (&x, e);
- etoasc (e, s, 20);
-}
-
-/* Compare X and Y. Return 1 if X > Y, 0 if X == Y, -1 if X < Y,
- or -2 if either is a NaN. */
-
-int
-ereal_cmp (x, y)
- REAL_VALUE_TYPE x, y;
-{
- unsigned EMUSHORT ex[NE], ey[NE];
-
- GET_REAL (&x, ex);
- GET_REAL (&y, ey);
- return (ecmp (ex, ey));
-}
-
-/* Return 1 if the sign bit of X is set, else return 0. */
-
-int
-ereal_isneg (x)
- REAL_VALUE_TYPE x;
-{
- unsigned EMUSHORT ex[NE];
-
- GET_REAL (&x, ex);
- return (eisneg (ex));
-}
-
-/* End of REAL_ARITHMETIC interface */
-
-/*
- Extended precision IEEE binary floating point arithmetic routines
-
- Numbers are stored in C language as arrays of 16-bit unsigned
- short integers. The arguments of the routines are pointers to
- the arrays.
-
- External e type data structure, similar to Intel 8087 chip
- temporary real format but possibly with a larger significand:
-
- NE-1 significand words (least significant word first,
- most significant bit is normally set)
- exponent (value = EXONE for 1.0,
- top bit is the sign)
-
-
- Internal exploded e-type data structure of a number (a "word" is 16 bits):
-
- ei[0] sign word (0 for positive, 0xffff for negative)
- ei[1] biased exponent (value = EXONE for the number 1.0)
- ei[2] high guard word (always zero after normalization)
- ei[3]
- to ei[NI-2] significand (NI-4 significand words,
- most significant word first,
- most significant bit is set)
- ei[NI-1] low guard word (0x8000 bit is rounding place)
-
-
-
- Routines for external format e-type numbers
-
- asctoe (string, e) ASCII string to extended double e type
- asctoe64 (string, &d) ASCII string to long double
- asctoe53 (string, &d) ASCII string to double
- asctoe24 (string, &f) ASCII string to single
- asctoeg (string, e, prec) ASCII string to specified precision
- e24toe (&f, e) IEEE single precision to e type
- e53toe (&d, e) IEEE double precision to e type
- e64toe (&d, e) IEEE long double precision to e type
- e113toe (&d, e) 128-bit long double precision to e type
- eabs (e) absolute value
- eadd (a, b, c) c = b + a
- eclear (e) e = 0
- ecmp (a, b) Returns 1 if a > b, 0 if a == b,
- -1 if a < b, -2 if either a or b is a NaN.
- ediv (a, b, c) c = b / a
- efloor (a, b) truncate to integer, toward -infinity
- efrexp (a, exp, s) extract exponent and significand
- eifrac (e, &l, frac) e to HOST_WIDE_INT and e type fraction
- euifrac (e, &l, frac) e to unsigned HOST_WIDE_INT and e type fraction
- einfin (e) set e to infinity, leaving its sign alone
- eldexp (a, n, b) multiply by 2**n
- emov (a, b) b = a
- emul (a, b, c) c = b * a
- eneg (e) e = -e
- eround (a, b) b = nearest integer value to a
- esub (a, b, c) c = b - a
- e24toasc (&f, str, n) single to ASCII string, n digits after decimal
- e53toasc (&d, str, n) double to ASCII string, n digits after decimal
- e64toasc (&d, str, n) 80-bit long double to ASCII string
- e113toasc (&d, str, n) 128-bit long double to ASCII string
- etoasc (e, str, n) e to ASCII string, n digits after decimal
- etoe24 (e, &f) convert e type to IEEE single precision
- etoe53 (e, &d) convert e type to IEEE double precision
- etoe64 (e, &d) convert e type to IEEE long double precision
- ltoe (&l, e) HOST_WIDE_INT to e type
- ultoe (&l, e) unsigned HOST_WIDE_INT to e type
- eisneg (e) 1 if sign bit of e != 0, else 0
- eisinf (e) 1 if e has maximum exponent (non-IEEE)
- or is infinite (IEEE)
- eisnan (e) 1 if e is a NaN
-
-
- Routines for internal format exploded e-type numbers
-
- eaddm (ai, bi) add significands, bi = bi + ai
- ecleaz (ei) ei = 0
- ecleazs (ei) set ei = 0 but leave its sign alone
- ecmpm (ai, bi) compare significands, return 1, 0, or -1
- edivm (ai, bi) divide significands, bi = bi / ai
- emdnorm (ai,l,s,exp) normalize and round off
- emovi (a, ai) convert external a to internal ai
- emovo (ai, a) convert internal ai to external a
- emovz (ai, bi) bi = ai, low guard word of bi = 0
- emulm (ai, bi) multiply significands, bi = bi * ai
- enormlz (ei) left-justify the significand
- eshdn1 (ai) shift significand and guards down 1 bit
- eshdn8 (ai) shift down 8 bits
- eshdn6 (ai) shift down 16 bits
- eshift (ai, n) shift ai n bits up (or down if n < 0)
- eshup1 (ai) shift significand and guards up 1 bit
- eshup8 (ai) shift up 8 bits
- eshup6 (ai) shift up 16 bits
- esubm (ai, bi) subtract significands, bi = bi - ai
- eiisinf (ai) 1 if infinite
- eiisnan (ai) 1 if a NaN
- eiisneg (ai) 1 if sign bit of ai != 0, else 0
- einan (ai) set ai = NaN
- eiinfin (ai) set ai = infinity
-
- The result is always normalized and rounded to NI-4 word precision
- after each arithmetic operation.
-
- Exception flags are NOT fully supported.
-
- Signaling NaN's are NOT supported; they are treated the same
- as quiet NaN's.
-
- Define INFINITY for support of infinity; otherwise a
- saturation arithmetic is implemented.
-
- Define NANS for support of Not-a-Number items; otherwise the
- arithmetic will never produce a NaN output, and might be confused
- by a NaN input.
- If NaN's are supported, the output of `ecmp (a,b)' is -2 if
- either a or b is a NaN. This means asking `if (ecmp (a,b) < 0)'
- may not be legitimate. Use `if (ecmp (a,b) == -1)' for `less than'
- if in doubt.
-
- Denormals are always supported here where appropriate (e.g., not
- for conversion to DEC numbers). */
-
-/* Definitions for error codes that are passed to the common error handling
- routine mtherr.
-
- For Digital Equipment PDP-11 and VAX computers, certain
- IBM systems, and others that use numbers with a 56-bit
- significand, the symbol DEC should be defined. In this
- mode, most floating point constants are given as arrays
- of octal integers to eliminate decimal to binary conversion
- errors that might be introduced by the compiler.
-
- For computers, such as IBM PC, that follow the IEEE
- Standard for Binary Floating Point Arithmetic (ANSI/IEEE
- Std 754-1985), the symbol IEEE should be defined.
- These numbers have 53-bit significands. In this mode, constants
- are provided as arrays of hexadecimal 16 bit integers.
- The endian-ness of generated values is controlled by
- REAL_WORDS_BIG_ENDIAN.
-
- To accommodate other types of computer arithmetic, all
- constants are also provided in a normal decimal radix
- which one can hope are correctly converted to a suitable
- format by the available C language compiler. To invoke
- this mode, the symbol UNK is defined.
-
- An important difference among these modes is a predefined
- set of machine arithmetic constants for each. The numbers
- MACHEP (the machine roundoff error), MAXNUM (largest number
- represented), and several other parameters are preset by
- the configuration symbol. Check the file const.c to
- ensure that these values are correct for your computer.
-
- For ANSI C compatibility, define ANSIC equal to 1. Currently
- this affects only the atan2 function and others that use it. */
-
-/* Constant definitions for math error conditions. */
-
-#define DOMAIN 1 /* argument domain error */
-#define SING 2 /* argument singularity */
-#define OVERFLOW 3 /* overflow range error */
-#define UNDERFLOW 4 /* underflow range error */
-#define TLOSS 5 /* total loss of precision */
-#define PLOSS 6 /* partial loss of precision */
-#define INVALID 7 /* NaN-producing operation */
-
-/* e type constants used by high precision check routines */
-
-#if LONG_DOUBLE_TYPE_SIZE == 128
-/* 0.0 */
-unsigned EMUSHORT ezero[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,};
-extern unsigned EMUSHORT ezero[];
-
-/* 5.0E-1 */
-unsigned EMUSHORT ehalf[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3ffe,};
-extern unsigned EMUSHORT ehalf[];
-
-/* 1.0E0 */
-unsigned EMUSHORT eone[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff,};
-extern unsigned EMUSHORT eone[];
-
-/* 2.0E0 */
-unsigned EMUSHORT etwo[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4000,};
-extern unsigned EMUSHORT etwo[];
-
-/* 3.2E1 */
-unsigned EMUSHORT e32[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4004,};
-extern unsigned EMUSHORT e32[];
-
-/* 6.93147180559945309417232121458176568075500134360255E-1 */
-unsigned EMUSHORT elog2[NE] =
- {0x40f3, 0xf6af, 0x03f2, 0xb398,
- 0xc9e3, 0x79ab, 0150717, 0013767, 0130562, 0x3ffe,};
-extern unsigned EMUSHORT elog2[];
-
-/* 1.41421356237309504880168872420969807856967187537695E0 */
-unsigned EMUSHORT esqrt2[NE] =
- {0x1d6f, 0xbe9f, 0x754a, 0x89b3,
- 0x597d, 0x6484, 0174736, 0171463, 0132404, 0x3fff,};
-extern unsigned EMUSHORT esqrt2[];
-
-/* 3.14159265358979323846264338327950288419716939937511E0 */
-unsigned EMUSHORT epi[NE] =
- {0x2902, 0x1cd1, 0x80dc, 0x628b,
- 0xc4c6, 0xc234, 0020550, 0155242, 0144417, 0040000,};
-extern unsigned EMUSHORT epi[];
-
-#else
-/* LONG_DOUBLE_TYPE_SIZE is other than 128 */
-unsigned EMUSHORT ezero[NE] =
- {0, 0000000, 0000000, 0000000, 0000000, 0000000,};
-unsigned EMUSHORT ehalf[NE] =
- {0, 0000000, 0000000, 0000000, 0100000, 0x3ffe,};
-unsigned EMUSHORT eone[NE] =
- {0, 0000000, 0000000, 0000000, 0100000, 0x3fff,};
-unsigned EMUSHORT etwo[NE] =
- {0, 0000000, 0000000, 0000000, 0100000, 0040000,};
-unsigned EMUSHORT e32[NE] =
- {0, 0000000, 0000000, 0000000, 0100000, 0040004,};
-unsigned EMUSHORT elog2[NE] =
- {0xc9e4, 0x79ab, 0150717, 0013767, 0130562, 0x3ffe,};
-unsigned EMUSHORT esqrt2[NE] =
- {0x597e, 0x6484, 0174736, 0171463, 0132404, 0x3fff,};
-unsigned EMUSHORT epi[NE] =
- {0xc4c6, 0xc234, 0020550, 0155242, 0144417, 0040000,};
-#endif
-
-/* Control register for rounding precision.
- This can be set to 113 (if NE=10), 80 (if NE=6), 64, 56, 53, or 24 bits. */
-
-int rndprc = NBITS;
-extern int rndprc;
-
-/* Clear out entire e-type number X. */
-
-static void
-eclear (x)
- register unsigned EMUSHORT *x;
-{
- register int i;
-
- for (i = 0; i < NE; i++)
- *x++ = 0;
-}
-
-/* Move e-type number from A to B. */
-
-static void
-emov (a, b)
- register unsigned EMUSHORT *a, *b;
-{
- register int i;
-
- for (i = 0; i < NE; i++)
- *b++ = *a++;
-}
-
-
-/* Absolute value of e-type X. */
-
-static void
-eabs (x)
- unsigned EMUSHORT x[];
-{
- /* sign is top bit of last word of external format */
- x[NE - 1] &= 0x7fff;
-}
-
-/* Negate the e-type number X. */
-
-static void
-eneg (x)
- unsigned EMUSHORT x[];
-{
-
- x[NE - 1] ^= 0x8000; /* Toggle the sign bit */
-}
-
-/* Return 1 if sign bit of e-type number X is nonzero, else zero. */
-
-static int
-eisneg (x)
- unsigned EMUSHORT x[];
-{
-
- if (x[NE - 1] & 0x8000)
- return (1);
- else
- return (0);
-}
-
-/* Return 1 if e-type number X is infinity, else return zero. */
-
-static int
-eisinf (x)
- unsigned EMUSHORT x[];
-{
-
-#ifdef NANS
- if (eisnan (x))
- return (0);
-#endif
- if ((x[NE - 1] & 0x7fff) == 0x7fff)
- return (1);
- else
- return (0);
-}
-
-/* Check if e-type number is not a number. The bit pattern is one that we
- defined, so we know for sure how to detect it. */
-
-static int
-eisnan (x)
- unsigned EMUSHORT x[];
-{
-#ifdef NANS
- int i;
-
- /* NaN has maximum exponent */
- if ((x[NE - 1] & 0x7fff) != 0x7fff)
- return (0);
- /* ... and non-zero significand field. */
- for (i = 0; i < NE - 1; i++)
- {
- if (*x++ != 0)
- return (1);
- }
-#endif
-
- return (0);
-}
-
-/* Fill e-type number X with infinity pattern (IEEE)
- or largest possible number (non-IEEE). */
-
-static void
-einfin (x)
- register unsigned EMUSHORT *x;
-{
- register int i;
-
-#ifdef INFINITY
- for (i = 0; i < NE - 1; i++)
- *x++ = 0;
- *x |= 32767;
-#else
- for (i = 0; i < NE - 1; i++)
- *x++ = 0xffff;
- *x |= 32766;
- if (rndprc < NBITS)
- {
- if (rndprc == 113)
- {
- *(x - 9) = 0;
- *(x - 8) = 0;
- }
- if (rndprc == 64)
- {
- *(x - 5) = 0;
- }
- if (rndprc == 53)
- {
- *(x - 4) = 0xf800;
- }
- else
- {
- *(x - 4) = 0;
- *(x - 3) = 0;
- *(x - 2) = 0xff00;
- }
- }
-#endif
-}
-
-/* Output an e-type NaN.
- This generates Intel's quiet NaN pattern for extended real.
- The exponent is 7fff, the leading mantissa word is c000. */
-
-static void
-enan (x, sign)
- register unsigned EMUSHORT *x;
- int sign;
-{
- register int i;
-
- for (i = 0; i < NE - 2; i++)
- *x++ = 0;
- *x++ = 0xc000;
- *x = (sign << 15) | 0x7fff;
-}
-
-/* Move in an e-type number A, converting it to exploded e-type B. */
-
-static void
-emovi (a, b)
- unsigned EMUSHORT *a, *b;
-{
- register unsigned EMUSHORT *p, *q;
- int i;
-
- q = b;
- p = a + (NE - 1); /* point to last word of external number */
- /* get the sign bit */
- if (*p & 0x8000)
- *q++ = 0xffff;
- else
- *q++ = 0;
- /* get the exponent */
- *q = *p--;
- *q++ &= 0x7fff; /* delete the sign bit */
-#ifdef INFINITY
- if ((*(q - 1) & 0x7fff) == 0x7fff)
- {
-#ifdef NANS
- if (eisnan (a))
- {
- *q++ = 0;
- for (i = 3; i < NI; i++)
- *q++ = *p--;
- return;
- }
-#endif
-
- for (i = 2; i < NI; i++)
- *q++ = 0;
- return;
- }
-#endif
-
- /* clear high guard word */
- *q++ = 0;
- /* move in the significand */
- for (i = 0; i < NE - 1; i++)
- *q++ = *p--;
- /* clear low guard word */
- *q = 0;
-}
-
-/* Move out exploded e-type number A, converting it to e type B. */
-
-static void
-emovo (a, b)
- unsigned EMUSHORT *a, *b;
-{
- register unsigned EMUSHORT *p, *q;
- unsigned EMUSHORT i;
- int j;
-
- p = a;
- q = b + (NE - 1); /* point to output exponent */
- /* combine sign and exponent */
- i = *p++;
- if (i)
- *q-- = *p++ | 0x8000;
- else
- *q-- = *p++;
-#ifdef INFINITY
- if (*(p - 1) == 0x7fff)
- {
-#ifdef NANS
- if (eiisnan (a))
- {
- enan (b, eiisneg (a));
- return;
- }
-#endif
- einfin (b);
- return;
- }
-#endif
- /* skip over guard word */
- ++p;
- /* move the significand */
- for (j = 0; j < NE - 1; j++)
- *q-- = *p++;
-}
-
-/* Clear out exploded e-type number XI. */
-
-static void
-ecleaz (xi)
- register unsigned EMUSHORT *xi;
-{
- register int i;
-
- for (i = 0; i < NI; i++)
- *xi++ = 0;
-}
-
-/* Clear out exploded e-type XI, but don't touch the sign. */
-
-static void
-ecleazs (xi)
- register unsigned EMUSHORT *xi;
-{
- register int i;
-
- ++xi;
- for (i = 0; i < NI - 1; i++)
- *xi++ = 0;
-}
-
-/* Move exploded e-type number from A to B. */
-
-static void
-emovz (a, b)
- register unsigned EMUSHORT *a, *b;
-{
- register int i;
-
- for (i = 0; i < NI - 1; i++)
- *b++ = *a++;
- /* clear low guard word */
- *b = 0;
-}
-
-/* Generate exploded e-type NaN.
- The explicit pattern for this is maximum exponent and
- top two significant bits set. */
-
-static void
-einan (x)
- unsigned EMUSHORT x[];
-{
-
- ecleaz (x);
- x[E] = 0x7fff;
- x[M + 1] = 0xc000;
-}
-
-/* Return nonzero if exploded e-type X is a NaN. */
-
-static int
-eiisnan (x)
- unsigned EMUSHORT x[];
-{
- int i;
-
- if ((x[E] & 0x7fff) == 0x7fff)
- {
- for (i = M + 1; i < NI; i++)
- {
- if (x[i] != 0)
- return (1);
- }
- }
- return (0);
-}
-
-/* Return nonzero if sign of exploded e-type X is nonzero. */
-
-static int
-eiisneg (x)
- unsigned EMUSHORT x[];
-{
-
- return x[0] != 0;
-}
-
-/* Fill exploded e-type X with infinity pattern.
- This has maximum exponent and significand all zeros. */
-
-static void
-eiinfin (x)
- unsigned EMUSHORT x[];
-{
-
- ecleaz (x);
- x[E] = 0x7fff;
-}
-
-/* Return nonzero if exploded e-type X is infinite. */
-
-static int
-eiisinf (x)
- unsigned EMUSHORT x[];
-{
-
-#ifdef NANS
- if (eiisnan (x))
- return (0);
-#endif
- if ((x[E] & 0x7fff) == 0x7fff)
- return (1);
- return (0);
-}
-
-
-/* Compare significands of numbers in internal exploded e-type format.
- Guard words are included in the comparison.
-
- Returns +1 if a > b
- 0 if a == b
- -1 if a < b */
-
-static int
-ecmpm (a, b)
- register unsigned EMUSHORT *a, *b;
-{
- int i;
-
- a += M; /* skip up to significand area */
- b += M;
- for (i = M; i < NI; i++)
- {
- if (*a++ != *b++)
- goto difrnt;
- }
- return (0);
-
- difrnt:
- if (*(--a) > *(--b))
- return (1);
- else
- return (-1);
-}
-
-/* Shift significand of exploded e-type X down by 1 bit. */
-
-static void
-eshdn1 (x)
- register unsigned EMUSHORT *x;
-{
- register unsigned EMUSHORT bits;
- int i;
-
- x += M; /* point to significand area */
-
- bits = 0;
- for (i = M; i < NI; i++)
- {
- if (*x & 1)
- bits |= 1;
- *x >>= 1;
- if (bits & 2)
- *x |= 0x8000;
- bits <<= 1;
- ++x;
- }
-}
-
-/* Shift significand of exploded e-type X up by 1 bit. */
-
-static void
-eshup1 (x)
- register unsigned EMUSHORT *x;
-{
- register unsigned EMUSHORT bits;
- int i;
-
- x += NI - 1;
- bits = 0;
-
- for (i = M; i < NI; i++)
- {
- if (*x & 0x8000)
- bits |= 1;
- *x <<= 1;
- if (bits & 2)
- *x |= 1;
- bits <<= 1;
- --x;
- }
-}
-
-
-/* Shift significand of exploded e-type X down by 8 bits. */
-
-static void
-eshdn8 (x)
- register unsigned EMUSHORT *x;
-{
- register unsigned EMUSHORT newbyt, oldbyt;
- int i;
-
- x += M;
- oldbyt = 0;
- for (i = M; i < NI; i++)
- {
- newbyt = *x << 8;
- *x >>= 8;
- *x |= oldbyt;
- oldbyt = newbyt;
- ++x;
- }
-}
-
-/* Shift significand of exploded e-type X up by 8 bits. */
-
-static void
-eshup8 (x)
- register unsigned EMUSHORT *x;
-{
- int i;
- register unsigned EMUSHORT newbyt, oldbyt;
-
- x += NI - 1;
- oldbyt = 0;
-
- for (i = M; i < NI; i++)
- {
- newbyt = *x >> 8;
- *x <<= 8;
- *x |= oldbyt;
- oldbyt = newbyt;
- --x;
- }
-}
-
-/* Shift significand of exploded e-type X up by 16 bits. */
-
-static void
-eshup6 (x)
- register unsigned EMUSHORT *x;
-{
- int i;
- register unsigned EMUSHORT *p;
-
- p = x + M;
- x += M + 1;
-
- for (i = M; i < NI - 1; i++)
- *p++ = *x++;
-
- *p = 0;
-}
-
-/* Shift significand of exploded e-type X down by 16 bits. */
-
-static void
-eshdn6 (x)
- register unsigned EMUSHORT *x;
-{
- int i;
- register unsigned EMUSHORT *p;
-
- x += NI - 1;
- p = x + 1;
-
- for (i = M; i < NI - 1; i++)
- *(--p) = *(--x);
-
- *(--p) = 0;
-}
-
-/* Add significands of exploded e-type X and Y. X + Y replaces Y. */
-
-static void
-eaddm (x, y)
- unsigned EMUSHORT *x, *y;
-{
- register unsigned EMULONG a;
- int i;
- unsigned int carry;
-
- x += NI - 1;
- y += NI - 1;
- carry = 0;
- for (i = M; i < NI; i++)
- {
- a = (unsigned EMULONG) (*x) + (unsigned EMULONG) (*y) + carry;
- if (a & 0x10000)
- carry = 1;
- else
- carry = 0;
- *y = (unsigned EMUSHORT) a;
- --x;
- --y;
- }
-}
-
-/* Subtract significands of exploded e-type X and Y. Y - X replaces Y. */
-
-static void
-esubm (x, y)
- unsigned EMUSHORT *x, *y;
-{
- unsigned EMULONG a;
- int i;
- unsigned int carry;
-
- x += NI - 1;
- y += NI - 1;
- carry = 0;
- for (i = M; i < NI; i++)
- {
- a = (unsigned EMULONG) (*y) - (unsigned EMULONG) (*x) - carry;
- if (a & 0x10000)
- carry = 1;
- else
- carry = 0;
- *y = (unsigned EMUSHORT) a;
- --x;
- --y;
- }
-}
-
-
-static unsigned EMUSHORT equot[NI];
-
-
-#if 0
-/* Radix 2 shift-and-add versions of multiply and divide */
-
-
-/* Divide significands */
-
-int
-edivm (den, num)
- unsigned EMUSHORT den[], num[];
-{
- int i;
- register unsigned EMUSHORT *p, *q;
- unsigned EMUSHORT j;
-
- p = &equot[0];
- *p++ = num[0];
- *p++ = num[1];
-
- for (i = M; i < NI; i++)
- {
- *p++ = 0;
- }
-
- /* Use faster compare and subtraction if denominator has only 15 bits of
- significance. */
-
- p = &den[M + 2];
- if (*p++ == 0)
- {
- for (i = M + 3; i < NI; i++)
- {
- if (*p++ != 0)
- goto fulldiv;
- }
- if ((den[M + 1] & 1) != 0)
- goto fulldiv;
- eshdn1 (num);
- eshdn1 (den);
-
- p = &den[M + 1];
- q = &num[M + 1];
-
- for (i = 0; i < NBITS + 2; i++)
- {
- if (*p <= *q)
- {
- *q -= *p;
- j = 1;
- }
- else
- {
- j = 0;
- }
- eshup1 (equot);
- equot[NI - 2] |= j;
- eshup1 (num);
- }
- goto divdon;
- }
-
- /* The number of quotient bits to calculate is NBITS + 1 scaling guard
- bit + 1 roundoff bit. */
-
- fulldiv:
-
- p = &equot[NI - 2];
- for (i = 0; i < NBITS + 2; i++)
- {
- if (ecmpm (den, num) <= 0)
- {
- esubm (den, num);
- j = 1; /* quotient bit = 1 */
- }
- else
- j = 0;
- eshup1 (equot);
- *p |= j;
- eshup1 (num);
- }
-
- divdon:
-
- eshdn1 (equot);
- eshdn1 (equot);
-
- /* test for nonzero remainder after roundoff bit */
- p = &num[M];
- j = 0;
- for (i = M; i < NI; i++)
- {
- j |= *p++;
- }
- if (j)
- j = 1;
-
-
- for (i = 0; i < NI; i++)
- num[i] = equot[i];
- return ((int) j);
-}
-
-
-/* Multiply significands */
-
-int
-emulm (a, b)
- unsigned EMUSHORT a[], b[];
-{
- unsigned EMUSHORT *p, *q;
- int i, j, k;
-
- equot[0] = b[0];
- equot[1] = b[1];
- for (i = M; i < NI; i++)
- equot[i] = 0;
-
- p = &a[NI - 2];
- k = NBITS;
- while (*p == 0) /* significand is not supposed to be zero */
- {
- eshdn6 (a);
- k -= 16;
- }
- if ((*p & 0xff) == 0)
- {
- eshdn8 (a);
- k -= 8;
- }
-
- q = &equot[NI - 1];
- j = 0;
- for (i = 0; i < k; i++)
- {
- if (*p & 1)
- eaddm (b, equot);
- /* remember if there were any nonzero bits shifted out */
- if (*q & 1)
- j |= 1;
- eshdn1 (a);
- eshdn1 (equot);
- }
-
- for (i = 0; i < NI; i++)
- b[i] = equot[i];
-
- /* return flag for lost nonzero bits */
- return (j);
-}
-
-#else
-
-/* Radix 65536 versions of multiply and divide. */
-
-/* Multiply significand of e-type number B
- by 16-bit quantity A, return e-type result to C. */
-
-static void
-m16m (a, b, c)
- unsigned int a;
- unsigned EMUSHORT b[], c[];
-{
- register unsigned EMUSHORT *pp;
- register unsigned EMULONG carry;
- unsigned EMUSHORT *ps;
- unsigned EMUSHORT p[NI];
- unsigned EMULONG aa, m;
- int i;
-
- aa = a;
- pp = &p[NI-2];
- *pp++ = 0;
- *pp = 0;
- ps = &b[NI-1];
-
- for (i=M+1; i<NI; i++)
- {
- if (*ps == 0)
- {
- --ps;
- --pp;
- *(pp-1) = 0;
- }
- else
- {
- m = (unsigned EMULONG) aa * *ps--;
- carry = (m & 0xffff) + *pp;
- *pp-- = (unsigned EMUSHORT)carry;
- carry = (carry >> 16) + (m >> 16) + *pp;
- *pp = (unsigned EMUSHORT)carry;
- *(pp-1) = carry >> 16;
- }
- }
- for (i=M; i<NI; i++)
- c[i] = p[i];
-}
-
-/* Divide significands of exploded e-types NUM / DEN. Neither the
- numerator NUM nor the denominator DEN is permitted to have its high guard
- word nonzero. */
-
-static int
-edivm (den, num)
- unsigned EMUSHORT den[], num[];
-{
- int i;
- register unsigned EMUSHORT *p;
- unsigned EMULONG tnum;
- unsigned EMUSHORT j, tdenm, tquot;
- unsigned EMUSHORT tprod[NI+1];
-
- p = &equot[0];
- *p++ = num[0];
- *p++ = num[1];
-
- for (i=M; i<NI; i++)
- {
- *p++ = 0;
- }
- eshdn1 (num);
- tdenm = den[M+1];
- for (i=M; i<NI; i++)
- {
- /* Find trial quotient digit (the radix is 65536). */
- tnum = (((unsigned EMULONG) num[M]) << 16) + num[M+1];
-
- /* Do not execute the divide instruction if it will overflow. */
- if ((tdenm * 0xffffL) < tnum)
- tquot = 0xffff;
- else
- tquot = tnum / tdenm;
- /* Multiply denominator by trial quotient digit. */
- m16m ((unsigned int)tquot, den, tprod);
- /* The quotient digit may have been overestimated. */
- if (ecmpm (tprod, num) > 0)
- {
- tquot -= 1;
- esubm (den, tprod);
- if (ecmpm (tprod, num) > 0)
- {
- tquot -= 1;
- esubm (den, tprod);
- }
- }
- esubm (tprod, num);
- equot[i] = tquot;
- eshup6(num);
- }
- /* test for nonzero remainder after roundoff bit */
- p = &num[M];
- j = 0;
- for (i=M; i<NI; i++)
- {
- j |= *p++;
- }
- if (j)
- j = 1;
-
- for (i=0; i<NI; i++)
- num[i] = equot[i];
-
- return ((int)j);
-}
-
-/* Multiply significands of exploded e-type A and B, result in B. */
-
-static int
-emulm (a, b)
- unsigned EMUSHORT a[], b[];
-{
- unsigned EMUSHORT *p, *q;
- unsigned EMUSHORT pprod[NI];
- unsigned EMUSHORT j;
- int i;
-
- equot[0] = b[0];
- equot[1] = b[1];
- for (i=M; i<NI; i++)
- equot[i] = 0;
-
- j = 0;
- p = &a[NI-1];
- q = &equot[NI-1];
- for (i=M+1; i<NI; i++)
- {
- if (*p == 0)
- {
- --p;
- }
- else
- {
- m16m ((unsigned int) *p--, b, pprod);
- eaddm(pprod, equot);
- }
- j |= *q;
- eshdn6(equot);
- }
-
- for (i=0; i<NI; i++)
- b[i] = equot[i];
-
- /* return flag for lost nonzero bits */
- return ((int)j);
-}
-#endif
-
-
-/* Normalize and round off.
-
- The internal format number to be rounded is S.
- Input LOST is 0 if the value is exact. This is the so-called sticky bit.
-
- Input SUBFLG indicates whether the number was obtained
- by a subtraction operation. In that case if LOST is nonzero
- then the number is slightly smaller than indicated.
-
- Input EXP is the biased exponent, which may be negative.
- the exponent field of S is ignored but is replaced by
- EXP as adjusted by normalization and rounding.
-
- Input RCNTRL is the rounding control. If it is nonzero, the
- returned value will be rounded to RNDPRC bits.
-
- For future reference: In order for emdnorm to round off denormal
- significands at the right point, the input exponent must be
- adjusted to be the actual value it would have after conversion to
- the final floating point type. This adjustment has been
- implemented for all type conversions (etoe53, etc.) and decimal
- conversions, but not for the arithmetic functions (eadd, etc.).
- Data types having standard 15-bit exponents are not affected by
- this, but SFmode and DFmode are affected. For example, ediv with
- rndprc = 24 will not round correctly to 24-bit precision if the
- result is denormal. */
-
-static int rlast = -1;
-static int rw = 0;
-static unsigned EMUSHORT rmsk = 0;
-static unsigned EMUSHORT rmbit = 0;
-static unsigned EMUSHORT rebit = 0;
-static int re = 0;
-static unsigned EMUSHORT rbit[NI];
-
-static void
-emdnorm (s, lost, subflg, exp, rcntrl)
- unsigned EMUSHORT s[];
- int lost;
- int subflg;
- EMULONG exp;
- int rcntrl;
-{
- int i, j;
- unsigned EMUSHORT r;
-
- /* Normalize */
- j = enormlz (s);
-
- /* a blank significand could mean either zero or infinity. */
-#ifndef INFINITY
- if (j > NBITS)
- {
- ecleazs (s);
- return;
- }
-#endif
- exp -= j;
-#ifndef INFINITY
- if (exp >= 32767L)
- goto overf;
-#else
- if ((j > NBITS) && (exp < 32767))
- {
- ecleazs (s);
- return;
- }
-#endif
- if (exp < 0L)
- {
- if (exp > (EMULONG) (-NBITS - 1))
- {
- j = (int) exp;
- i = eshift (s, j);
- if (i)
- lost = 1;
- }
- else
- {
- ecleazs (s);
- return;
- }
- }
- /* Round off, unless told not to by rcntrl. */
- if (rcntrl == 0)
- goto mdfin;
- /* Set up rounding parameters if the control register changed. */
- if (rndprc != rlast)
- {
- ecleaz (rbit);
- switch (rndprc)
- {
- default:
- case NBITS:
- rw = NI - 1; /* low guard word */
- rmsk = 0xffff;
- rmbit = 0x8000;
- re = rw - 1;
- rebit = 1;
- break;
- case 113:
- rw = 10;
- rmsk = 0x7fff;
- rmbit = 0x4000;
- rebit = 0x8000;
- re = rw;
- break;
- case 64:
- rw = 7;
- rmsk = 0xffff;
- rmbit = 0x8000;
- re = rw - 1;
- rebit = 1;
- break;
- /* For DEC or IBM arithmetic */
- case 56:
- rw = 6;
- rmsk = 0xff;
- rmbit = 0x80;
- rebit = 0x100;
- re = rw;
- break;
- case 53:
- rw = 6;
- rmsk = 0x7ff;
- rmbit = 0x0400;
- rebit = 0x800;
- re = rw;
- break;
- case 24:
- rw = 4;
- rmsk = 0xff;
- rmbit = 0x80;
- rebit = 0x100;
- re = rw;
- break;
- }
- rbit[re] = rebit;
- rlast = rndprc;
- }
-
- /* Shift down 1 temporarily if the data structure has an implied
- most significant bit and the number is denormal.
- Intel long double denormals also lose one bit of precision. */
- if ((exp <= 0) && (rndprc != NBITS)
- && ((rndprc != 64) || ((rndprc == 64) && ! REAL_WORDS_BIG_ENDIAN)))
- {
- lost |= s[NI - 1] & 1;
- eshdn1 (s);
- }
- /* Clear out all bits below the rounding bit,
- remembering in r if any were nonzero. */
- r = s[rw] & rmsk;
- if (rndprc < NBITS)
- {
- i = rw + 1;
- while (i < NI)
- {
- if (s[i])
- r |= 1;
- s[i] = 0;
- ++i;
- }
- }
- s[rw] &= ~rmsk;
- if ((r & rmbit) != 0)
- {
- if (r == rmbit)
- {
- if (lost == 0)
- { /* round to even */
- if ((s[re] & rebit) == 0)
- goto mddone;
- }
- else
- {
- if (subflg != 0)
- goto mddone;
- }
- }
- eaddm (rbit, s);
- }
- mddone:
-/* Undo the temporary shift for denormal values. */
- if ((exp <= 0) && (rndprc != NBITS)
- && ((rndprc != 64) || ((rndprc == 64) && ! REAL_WORDS_BIG_ENDIAN)))
- {
- eshup1 (s);
- }
- if (s[2] != 0)
- { /* overflow on roundoff */
- eshdn1 (s);
- exp += 1;
- }
- mdfin:
- s[NI - 1] = 0;
- if (exp >= 32767L)
- {
-#ifndef INFINITY
- overf:
-#endif
-#ifdef INFINITY
- s[1] = 32767;
- for (i = 2; i < NI - 1; i++)
- s[i] = 0;
- if (extra_warnings)
- warning ("floating point overflow");
-#else
- s[1] = 32766;
- s[2] = 0;
- for (i = M + 1; i < NI - 1; i++)
- s[i] = 0xffff;
- s[NI - 1] = 0;
- if ((rndprc < 64) || (rndprc == 113))
- {
- s[rw] &= ~rmsk;
- if (rndprc == 24)
- {
- s[5] = 0;
- s[6] = 0;
- }
- }
-#endif
- return;
- }
- if (exp < 0)
- s[1] = 0;
- else
- s[1] = (unsigned EMUSHORT) exp;
-}
-
-/* Subtract. C = B - A, all e type numbers. */
-
-static int subflg = 0;
-
-static void
-esub (a, b, c)
- unsigned EMUSHORT *a, *b, *c;
-{
-
-#ifdef NANS
- if (eisnan (a))
- {
- emov (a, c);
- return;
- }
- if (eisnan (b))
- {
- emov (b, c);
- return;
- }
-/* Infinity minus infinity is a NaN.
- Test for subtracting infinities of the same sign. */
- if (eisinf (a) && eisinf (b)
- && ((eisneg (a) ^ eisneg (b)) == 0))
- {
- mtherr ("esub", INVALID);
- enan (c, 0);
- return;
- }
-#endif
- subflg = 1;
- eadd1 (a, b, c);
-}
-
-/* Add. C = A + B, all e type. */
-
-static void
-eadd (a, b, c)
- unsigned EMUSHORT *a, *b, *c;
-{
-
-#ifdef NANS
-/* NaN plus anything is a NaN. */
- if (eisnan (a))
- {
- emov (a, c);
- return;
- }
- if (eisnan (b))
- {
- emov (b, c);
- return;
- }
-/* Infinity minus infinity is a NaN.
- Test for adding infinities of opposite signs. */
- if (eisinf (a) && eisinf (b)
- && ((eisneg (a) ^ eisneg (b)) != 0))
- {
- mtherr ("esub", INVALID);
- enan (c, 0);
- return;
- }
-#endif
- subflg = 0;
- eadd1 (a, b, c);
-}
-
-/* Arithmetic common to both addition and subtraction. */
-
-static void
-eadd1 (a, b, c)
- unsigned EMUSHORT *a, *b, *c;
-{
- unsigned EMUSHORT ai[NI], bi[NI], ci[NI];
- int i, lost, j, k;
- EMULONG lt, lta, ltb;
-
-#ifdef INFINITY
- if (eisinf (a))
- {
- emov (a, c);
- if (subflg)
- eneg (c);
- return;
- }
- if (eisinf (b))
- {
- emov (b, c);
- return;
- }
-#endif
- emovi (a, ai);
- emovi (b, bi);
- if (subflg)
- ai[0] = ~ai[0];
-
- /* compare exponents */
- lta = ai[E];
- ltb = bi[E];
- lt = lta - ltb;
- if (lt > 0L)
- { /* put the larger number in bi */
- emovz (bi, ci);
- emovz (ai, bi);
- emovz (ci, ai);
- ltb = bi[E];
- lt = -lt;
- }
- lost = 0;
- if (lt != 0L)
- {
- if (lt < (EMULONG) (-NBITS - 1))
- goto done; /* answer same as larger addend */
- k = (int) lt;
- lost = eshift (ai, k); /* shift the smaller number down */
- }
- else
- {
- /* exponents were the same, so must compare significands */
- i = ecmpm (ai, bi);
- if (i == 0)
- { /* the numbers are identical in magnitude */
- /* if different signs, result is zero */
- if (ai[0] != bi[0])
- {
- eclear (c);
- return;
- }
- /* if same sign, result is double */
- /* double denormalized tiny number */
- if ((bi[E] == 0) && ((bi[3] & 0x8000) == 0))
- {
- eshup1 (bi);
- goto done;
- }
- /* add 1 to exponent unless both are zero! */
- for (j = 1; j < NI - 1; j++)
- {
- if (bi[j] != 0)
- {
- ltb += 1;
- if (ltb >= 0x7fff)
- {
- eclear (c);
- if (ai[0] != 0)
- eneg (c);
- einfin (c);
- return;
- }
- break;
- }
- }
- bi[E] = (unsigned EMUSHORT) ltb;
- goto done;
- }
- if (i > 0)
- { /* put the larger number in bi */
- emovz (bi, ci);
- emovz (ai, bi);
- emovz (ci, ai);
- }
- }
- if (ai[0] == bi[0])
- {
- eaddm (ai, bi);
- subflg = 0;
- }
- else
- {
- esubm (ai, bi);
- subflg = 1;
- }
- emdnorm (bi, lost, subflg, ltb, 64);
-
- done:
- emovo (bi, c);
-}
-
-/* Divide: C = B/A, all e type. */
-
-static void
-ediv (a, b, c)
- unsigned EMUSHORT *a, *b, *c;
-{
- unsigned EMUSHORT ai[NI], bi[NI];
- int i, sign;
- EMULONG lt, lta, ltb;
-
-/* IEEE says if result is not a NaN, the sign is "-" if and only if
- operands have opposite signs -- but flush -0 to 0 later if not IEEE. */
- sign = eisneg(a) ^ eisneg(b);
-
-#ifdef NANS
-/* Return any NaN input. */
- if (eisnan (a))
- {
- emov (a, c);
- return;
- }
- if (eisnan (b))
- {
- emov (b, c);
- return;
- }
-/* Zero over zero, or infinity over infinity, is a NaN. */
- if (((ecmp (a, ezero) == 0) && (ecmp (b, ezero) == 0))
- || (eisinf (a) && eisinf (b)))
- {
- mtherr ("ediv", INVALID);
- enan (c, sign);
- return;
- }
-#endif
-/* Infinity over anything else is infinity. */
-#ifdef INFINITY
- if (eisinf (b))
- {
- einfin (c);
- goto divsign;
- }
-/* Anything else over infinity is zero. */
- if (eisinf (a))
- {
- eclear (c);
- goto divsign;
- }
-#endif
- emovi (a, ai);
- emovi (b, bi);
- lta = ai[E];
- ltb = bi[E];
- if (bi[E] == 0)
- { /* See if numerator is zero. */
- for (i = 1; i < NI - 1; i++)
- {
- if (bi[i] != 0)
- {
- ltb -= enormlz (bi);
- goto dnzro1;
- }
- }
- eclear (c);
- goto divsign;
- }
- dnzro1:
-
- if (ai[E] == 0)
- { /* possible divide by zero */
- for (i = 1; i < NI - 1; i++)
- {
- if (ai[i] != 0)
- {
- lta -= enormlz (ai);
- goto dnzro2;
- }
- }
-/* Divide by zero is not an invalid operation.
- It is a divide-by-zero operation! */
- einfin (c);
- mtherr ("ediv", SING);
- goto divsign;
- }
- dnzro2:
-
- i = edivm (ai, bi);
- /* calculate exponent */
- lt = ltb - lta + EXONE;
- emdnorm (bi, i, 0, lt, 64);
- emovo (bi, c);
-
- divsign:
-
- if (sign
-#ifndef IEEE
- && (ecmp (c, ezero) != 0)
-#endif
- )
- *(c+(NE-1)) |= 0x8000;
- else
- *(c+(NE-1)) &= ~0x8000;
-}
-
-/* Multiply e-types A and B, return e-type product C. */
-
-static void
-emul (a, b, c)
- unsigned EMUSHORT *a, *b, *c;
-{
- unsigned EMUSHORT ai[NI], bi[NI];
- int i, j, sign;
- EMULONG lt, lta, ltb;
-
-/* IEEE says if result is not a NaN, the sign is "-" if and only if
- operands have opposite signs -- but flush -0 to 0 later if not IEEE. */
- sign = eisneg(a) ^ eisneg(b);
-
-#ifdef NANS
-/* NaN times anything is the same NaN. */
- if (eisnan (a))
- {
- emov (a, c);
- return;
- }
- if (eisnan (b))
- {
- emov (b, c);
- return;
- }
-/* Zero times infinity is a NaN. */
- if ((eisinf (a) && (ecmp (b, ezero) == 0))
- || (eisinf (b) && (ecmp (a, ezero) == 0)))
- {
- mtherr ("emul", INVALID);
- enan (c, sign);
- return;
- }
-#endif
-/* Infinity times anything else is infinity. */
-#ifdef INFINITY
- if (eisinf (a) || eisinf (b))
- {
- einfin (c);
- goto mulsign;
- }
-#endif
- emovi (a, ai);
- emovi (b, bi);
- lta = ai[E];
- ltb = bi[E];
- if (ai[E] == 0)
- {
- for (i = 1; i < NI - 1; i++)
- {
- if (ai[i] != 0)
- {
- lta -= enormlz (ai);
- goto mnzer1;
- }
- }
- eclear (c);
- goto mulsign;
- }
- mnzer1:
-
- if (bi[E] == 0)
- {
- for (i = 1; i < NI - 1; i++)
- {
- if (bi[i] != 0)
- {
- ltb -= enormlz (bi);
- goto mnzer2;
- }
- }
- eclear (c);
- goto mulsign;
- }
- mnzer2:
-
- /* Multiply significands */
- j = emulm (ai, bi);
- /* calculate exponent */
- lt = lta + ltb - (EXONE - 1);
- emdnorm (bi, j, 0, lt, 64);
- emovo (bi, c);
-
- mulsign:
-
- if (sign
-#ifndef IEEE
- && (ecmp (c, ezero) != 0)
-#endif
- )
- *(c+(NE-1)) |= 0x8000;
- else
- *(c+(NE-1)) &= ~0x8000;
-}
-
-/* Convert double precision PE to e-type Y. */
-
-static void
-e53toe (pe, y)
- unsigned EMUSHORT *pe, *y;
-{
-#ifdef DEC
-
- dectoe (pe, y);
-
-#else
-#ifdef IBM
-
- ibmtoe (pe, y, DFmode);
-
-#else
- register unsigned EMUSHORT r;
- register unsigned EMUSHORT *e, *p;
- unsigned EMUSHORT yy[NI];
- int denorm, k;
-
- e = pe;
- denorm = 0; /* flag if denormalized number */
- ecleaz (yy);
- if (! REAL_WORDS_BIG_ENDIAN)
- e += 3;
- r = *e;
- yy[0] = 0;
- if (r & 0x8000)
- yy[0] = 0xffff;
- yy[M] = (r & 0x0f) | 0x10;
- r &= ~0x800f; /* strip sign and 4 significand bits */
-#ifdef INFINITY
- if (r == 0x7ff0)
- {
-#ifdef NANS
- if (! REAL_WORDS_BIG_ENDIAN)
- {
- if (((pe[3] & 0xf) != 0) || (pe[2] != 0)
- || (pe[1] != 0) || (pe[0] != 0))
- {
- enan (y, yy[0] != 0);
- return;
- }
- }
- else
- {
- if (((pe[0] & 0xf) != 0) || (pe[1] != 0)
- || (pe[2] != 0) || (pe[3] != 0))
- {
- enan (y, yy[0] != 0);
- return;
- }
- }
-#endif /* NANS */
- eclear (y);
- einfin (y);
- if (yy[0])
- eneg (y);
- return;
- }
-#endif /* INFINITY */
- r >>= 4;
- /* If zero exponent, then the significand is denormalized.
- So take back the understood high significand bit. */
-
- if (r == 0)
- {
- denorm = 1;
- yy[M] &= ~0x10;
- }
- r += EXONE - 01777;
- yy[E] = r;
- p = &yy[M + 1];
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- {
- *p++ = *(--e);
- *p++ = *(--e);
- *p++ = *(--e);
- }
- else
- {
- ++e;
- *p++ = *e++;
- *p++ = *e++;
- *p++ = *e++;
- }
-#endif
- eshift (yy, -5);
- if (denorm)
- { /* if zero exponent, then normalize the significand */
- if ((k = enormlz (yy)) > NBITS)
- ecleazs (yy);
- else
- yy[E] -= (unsigned EMUSHORT) (k - 1);
- }
- emovo (yy, y);
-#endif /* not IBM */
-#endif /* not DEC */
-}
-
-/* Convert double extended precision float PE to e type Y. */
-
-static void
-e64toe (pe, y)
- unsigned EMUSHORT *pe, *y;
-{
- unsigned EMUSHORT yy[NI];
- unsigned EMUSHORT *e, *p, *q;
- int i;
-
- e = pe;
- p = yy;
- for (i = 0; i < NE - 5; i++)
- *p++ = 0;
-/* This precision is not ordinarily supported on DEC or IBM. */
-#ifdef DEC
- for (i = 0; i < 5; i++)
- *p++ = *e++;
-#endif
-#ifdef IBM
- p = &yy[0] + (NE - 1);
- *p-- = *e++;
- ++e;
- for (i = 0; i < 5; i++)
- *p-- = *e++;
-#endif
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- {
- for (i = 0; i < 5; i++)
- *p++ = *e++;
-
- /* For denormal long double Intel format, shift significand up one
- -- but only if the top significand bit is zero. A top bit of 1
- is "pseudodenormal" when the exponent is zero. */
- if((yy[NE-1] & 0x7fff) == 0 && (yy[NE-2] & 0x8000) == 0)
- {
- unsigned EMUSHORT temp[NI];
-
- emovi(yy, temp);
- eshup1(temp);
- emovo(temp,y);
- return;
- }
- }
- else
- {
- p = &yy[0] + (NE - 1);
-#ifdef ARM_EXTENDED_IEEE_FORMAT
- /* For ARMs, the exponent is in the lowest 15 bits of the word. */
- *p-- = (e[0] & 0x8000) | (e[1] & 0x7ffff);
- e += 2;
-#else
- *p-- = *e++;
- ++e;
-#endif
- for (i = 0; i < 4; i++)
- *p-- = *e++;
- }
-#endif
-#ifdef INFINITY
- /* Point to the exponent field and check max exponent cases. */
- p = &yy[NE - 1];
- if ((*p & 0x7fff) == 0x7fff)
- {
-#ifdef NANS
- if (! REAL_WORDS_BIG_ENDIAN)
- {
- for (i = 0; i < 4; i++)
- {
- if ((i != 3 && pe[i] != 0)
- /* Anything but 0x8000 here, including 0, is a NaN. */
- || (i == 3 && pe[i] != 0x8000))
- {
- enan (y, (*p & 0x8000) != 0);
- return;
- }
- }
- }
- else
- {
-#ifdef ARM_EXTENDED_IEEE_FORMAT
- for (i = 2; i <= 5; i++)
- {
- if (pe[i] != 0)
- {
- enan (y, (*p & 0x8000) != 0);
- return;
- }
- }
-#else /* not ARM */
- /* In Motorola extended precision format, the most significant
- bit of an infinity mantissa could be either 1 or 0. It is
- the lower order bits that tell whether the value is a NaN. */
- if ((pe[2] & 0x7fff) != 0)
- goto bigend_nan;
-
- for (i = 3; i <= 5; i++)
- {
- if (pe[i] != 0)
- {
-bigend_nan:
- enan (y, (*p & 0x8000) != 0);
- return;
- }
- }
-#endif /* not ARM */
- }
-#endif /* NANS */
- eclear (y);
- einfin (y);
- if (*p & 0x8000)
- eneg (y);
- return;
- }
-#endif /* INFINITY */
- p = yy;
- q = y;
- for (i = 0; i < NE; i++)
- *q++ = *p++;
-}
-
-/* Convert 128-bit long double precision float PE to e type Y. */
-
-static void
-e113toe (pe, y)
- unsigned EMUSHORT *pe, *y;
-{
- register unsigned EMUSHORT r;
- unsigned EMUSHORT *e, *p;
- unsigned EMUSHORT yy[NI];
- int denorm, i;
-
- e = pe;
- denorm = 0;
- ecleaz (yy);
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- e += 7;
-#endif
- r = *e;
- yy[0] = 0;
- if (r & 0x8000)
- yy[0] = 0xffff;
- r &= 0x7fff;
-#ifdef INFINITY
- if (r == 0x7fff)
- {
-#ifdef NANS
- if (! REAL_WORDS_BIG_ENDIAN)
- {
- for (i = 0; i < 7; i++)
- {
- if (pe[i] != 0)
- {
- enan (y, yy[0] != 0);
- return;
- }
- }
- }
- else
- {
- for (i = 1; i < 8; i++)
- {
- if (pe[i] != 0)
- {
- enan (y, yy[0] != 0);
- return;
- }
- }
- }
-#endif /* NANS */
- eclear (y);
- einfin (y);
- if (yy[0])
- eneg (y);
- return;
- }
-#endif /* INFINITY */
- yy[E] = r;
- p = &yy[M + 1];
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- {
- for (i = 0; i < 7; i++)
- *p++ = *(--e);
- }
- else
- {
- ++e;
- for (i = 0; i < 7; i++)
- *p++ = *e++;
- }
-#endif
-/* If denormal, remove the implied bit; else shift down 1. */
- if (r == 0)
- {
- yy[M] = 0;
- }
- else
- {
- yy[M] = 1;
- eshift (yy, -1);
- }
- emovo (yy, y);
-}
-
-/* Convert single precision float PE to e type Y. */
-
-static void
-e24toe (pe, y)
- unsigned EMUSHORT *pe, *y;
-{
-#ifdef IBM
-
- ibmtoe (pe, y, SFmode);
-
-#else
- register unsigned EMUSHORT r;
- register unsigned EMUSHORT *e, *p;
- unsigned EMUSHORT yy[NI];
- int denorm, k;
-
- e = pe;
- denorm = 0; /* flag if denormalized number */
- ecleaz (yy);
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- e += 1;
-#endif
-#ifdef DEC
- e += 1;
-#endif
- r = *e;
- yy[0] = 0;
- if (r & 0x8000)
- yy[0] = 0xffff;
- yy[M] = (r & 0x7f) | 0200;
- r &= ~0x807f; /* strip sign and 7 significand bits */
-#ifdef INFINITY
- if (r == 0x7f80)
- {
-#ifdef NANS
- if (REAL_WORDS_BIG_ENDIAN)
- {
- if (((pe[0] & 0x7f) != 0) || (pe[1] != 0))
- {
- enan (y, yy[0] != 0);
- return;
- }
- }
- else
- {
- if (((pe[1] & 0x7f) != 0) || (pe[0] != 0))
- {
- enan (y, yy[0] != 0);
- return;
- }
- }
-#endif /* NANS */
- eclear (y);
- einfin (y);
- if (yy[0])
- eneg (y);
- return;
- }
-#endif /* INFINITY */
- r >>= 7;
- /* If zero exponent, then the significand is denormalized.
- So take back the understood high significand bit. */
- if (r == 0)
- {
- denorm = 1;
- yy[M] &= ~0200;
- }
- r += EXONE - 0177;
- yy[E] = r;
- p = &yy[M + 1];
-#ifdef DEC
- *p++ = *(--e);
-#endif
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- *p++ = *(--e);
- else
- {
- ++e;
- *p++ = *e++;
- }
-#endif
- eshift (yy, -8);
- if (denorm)
- { /* if zero exponent, then normalize the significand */
- if ((k = enormlz (yy)) > NBITS)
- ecleazs (yy);
- else
- yy[E] -= (unsigned EMUSHORT) (k - 1);
- }
- emovo (yy, y);
-#endif /* not IBM */
-}
-
-/* Convert e-type X to IEEE 128-bit long double format E. */
-
-static void
-etoe113 (x, e)
- unsigned EMUSHORT *x, *e;
-{
- unsigned EMUSHORT xi[NI];
- EMULONG exp;
- int rndsav;
-
-#ifdef NANS
- if (eisnan (x))
- {
- make_nan (e, eisneg (x), TFmode);
- return;
- }
-#endif
- emovi (x, xi);
- exp = (EMULONG) xi[E];
-#ifdef INFINITY
- if (eisinf (x))
- goto nonorm;
-#endif
- /* round off to nearest or even */
- rndsav = rndprc;
- rndprc = 113;
- emdnorm (xi, 0, 0, exp, 64);
- rndprc = rndsav;
- nonorm:
- toe113 (xi, e);
-}
-
-/* Convert exploded e-type X, that has already been rounded to
- 113-bit precision, to IEEE 128-bit long double format Y. */
-
-static void
-toe113 (a, b)
- unsigned EMUSHORT *a, *b;
-{
- register unsigned EMUSHORT *p, *q;
- unsigned EMUSHORT i;
-
-#ifdef NANS
- if (eiisnan (a))
- {
- make_nan (b, eiisneg (a), TFmode);
- return;
- }
-#endif
- p = a;
- if (REAL_WORDS_BIG_ENDIAN)
- q = b;
- else
- q = b + 7; /* point to output exponent */
-
- /* If not denormal, delete the implied bit. */
- if (a[E] != 0)
- {
- eshup1 (a);
- }
- /* combine sign and exponent */
- i = *p++;
- if (REAL_WORDS_BIG_ENDIAN)
- {
- if (i)
- *q++ = *p++ | 0x8000;
- else
- *q++ = *p++;
- }
- else
- {
- if (i)
- *q-- = *p++ | 0x8000;
- else
- *q-- = *p++;
- }
- /* skip over guard word */
- ++p;
- /* move the significand */
- if (REAL_WORDS_BIG_ENDIAN)
- {
- for (i = 0; i < 7; i++)
- *q++ = *p++;
- }
- else
- {
- for (i = 0; i < 7; i++)
- *q-- = *p++;
- }
-}
-
-/* Convert e-type X to IEEE double extended format E. */
-
-static void
-etoe64 (x, e)
- unsigned EMUSHORT *x, *e;
-{
- unsigned EMUSHORT xi[NI];
- EMULONG exp;
- int rndsav;
-
-#ifdef NANS
- if (eisnan (x))
- {
- make_nan (e, eisneg (x), XFmode);
- return;
- }
-#endif
- emovi (x, xi);
- /* adjust exponent for offset */
- exp = (EMULONG) xi[E];
-#ifdef INFINITY
- if (eisinf (x))
- goto nonorm;
-#endif
- /* round off to nearest or even */
- rndsav = rndprc;
- rndprc = 64;
- emdnorm (xi, 0, 0, exp, 64);
- rndprc = rndsav;
- nonorm:
- toe64 (xi, e);
-}
-
-/* Convert exploded e-type X, that has already been rounded to
- 64-bit precision, to IEEE double extended format Y. */
-
-static void
-toe64 (a, b)
- unsigned EMUSHORT *a, *b;
-{
- register unsigned EMUSHORT *p, *q;
- unsigned EMUSHORT i;
-
-#ifdef NANS
- if (eiisnan (a))
- {
- make_nan (b, eiisneg (a), XFmode);
- return;
- }
-#endif
- /* Shift denormal long double Intel format significand down one bit. */
- if ((a[E] == 0) && ! REAL_WORDS_BIG_ENDIAN)
- eshdn1 (a);
- p = a;
-#ifdef IBM
- q = b;
-#endif
-#ifdef DEC
- q = b + 4;
-#endif
-#ifdef IEEE
- if (REAL_WORDS_BIG_ENDIAN)
- q = b;
- else
- {
- q = b + 4; /* point to output exponent */
-#if LONG_DOUBLE_TYPE_SIZE == 96
- /* Clear the last two bytes of 12-byte Intel format */
- *(q+1) = 0;
-#endif
- }
-#endif
-
- /* combine sign and exponent */
- i = *p++;
-#ifdef IBM
- if (i)
- *q++ = *p++ | 0x8000;
- else
- *q++ = *p++;
- *q++ = 0;
-#endif
-#ifdef DEC
- if (i)
- *q-- = *p++ | 0x8000;
- else
- *q-- = *p++;
-#endif
-#ifdef IEEE
- if (REAL_WORDS_BIG_ENDIAN)
- {
-#ifdef ARM_EXTENDED_IEEE_FORMAT
- /* The exponent is in the lowest 15 bits of the first word. */
- *q++ = i ? 0x8000 : 0;
- *q++ = *p++;
-#else
- if (i)
- *q++ = *p++ | 0x8000;
- else
- *q++ = *p++;
- *q++ = 0;
-#endif
- }
- else
- {
- if (i)
- *q-- = *p++ | 0x8000;
- else
- *q-- = *p++;
- }
-#endif
- /* skip over guard word */
- ++p;
- /* move the significand */
-#ifdef IBM
- for (i = 0; i < 4; i++)
- *q++ = *p++;
-#endif
-#ifdef DEC
- for (i = 0; i < 4; i++)
- *q-- = *p++;
-#endif
-#ifdef IEEE
- if (REAL_WORDS_BIG_ENDIAN)
- {
- for (i = 0; i < 4; i++)
- *q++ = *p++;
- }
- else
- {
-#ifdef INFINITY
- if (eiisinf (a))
- {
- /* Intel long double infinity significand. */
- *q-- = 0x8000;
- *q-- = 0;
- *q-- = 0;
- *q = 0;
- return;
- }
-#endif
- for (i = 0; i < 4; i++)
- *q-- = *p++;
- }
-#endif
-}
-
-/* e type to double precision. */
-
-#ifdef DEC
-/* Convert e-type X to DEC-format double E. */
-
-static void
-etoe53 (x, e)
- unsigned EMUSHORT *x, *e;
-{
- etodec (x, e); /* see etodec.c */
-}
-
-/* Convert exploded e-type X, that has already been rounded to
- 56-bit double precision, to DEC double Y. */
-
-static void
-toe53 (x, y)
- unsigned EMUSHORT *x, *y;
-{
- todec (x, y);
-}
-
-#else
-#ifdef IBM
-/* Convert e-type X to IBM 370-format double E. */
-
-static void
-etoe53 (x, e)
- unsigned EMUSHORT *x, *e;
-{
- etoibm (x, e, DFmode);
-}
-
-/* Convert exploded e-type X, that has already been rounded to
- 56-bit precision, to IBM 370 double Y. */
-
-static void
-toe53 (x, y)
- unsigned EMUSHORT *x, *y;
-{
- toibm (x, y, DFmode);
-}
-
-#else /* it's neither DEC nor IBM */
-
-/* Convert e-type X to IEEE double E. */
-
-static void
-etoe53 (x, e)
- unsigned EMUSHORT *x, *e;
-{
- unsigned EMUSHORT xi[NI];
- EMULONG exp;
- int rndsav;
-
-#ifdef NANS
- if (eisnan (x))
- {
- make_nan (e, eisneg (x), DFmode);
- return;
- }
-#endif
- emovi (x, xi);
- /* adjust exponent for offsets */
- exp = (EMULONG) xi[E] - (EXONE - 0x3ff);
-#ifdef INFINITY
- if (eisinf (x))
- goto nonorm;
-#endif
- /* round off to nearest or even */
- rndsav = rndprc;
- rndprc = 53;
- emdnorm (xi, 0, 0, exp, 64);
- rndprc = rndsav;
- nonorm:
- toe53 (xi, e);
-}
-
-/* Convert exploded e-type X, that has already been rounded to
- 53-bit precision, to IEEE double Y. */
-
-static void
-toe53 (x, y)
- unsigned EMUSHORT *x, *y;
-{
- unsigned EMUSHORT i;
- unsigned EMUSHORT *p;
-
-#ifdef NANS
- if (eiisnan (x))
- {
- make_nan (y, eiisneg (x), DFmode);
- return;
- }
-#endif
- p = &x[0];
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- y += 3;
-#endif
- *y = 0; /* output high order */
- if (*p++)
- *y = 0x8000; /* output sign bit */
-
- i = *p++;
- if (i >= (unsigned int) 2047)
- {
- /* Saturate at largest number less than infinity. */
-#ifdef INFINITY
- *y |= 0x7ff0;
- if (! REAL_WORDS_BIG_ENDIAN)
- {
- *(--y) = 0;
- *(--y) = 0;
- *(--y) = 0;
- }
- else
- {
- ++y;
- *y++ = 0;
- *y++ = 0;
- *y++ = 0;
- }
-#else
- *y |= (unsigned EMUSHORT) 0x7fef;
- if (! REAL_WORDS_BIG_ENDIAN)
- {
- *(--y) = 0xffff;
- *(--y) = 0xffff;
- *(--y) = 0xffff;
- }
- else
- {
- ++y;
- *y++ = 0xffff;
- *y++ = 0xffff;
- *y++ = 0xffff;
- }
-#endif
- return;
- }
- if (i == 0)
- {
- eshift (x, 4);
- }
- else
- {
- i <<= 4;
- eshift (x, 5);
- }
- i |= *p++ & (unsigned EMUSHORT) 0x0f; /* *p = xi[M] */
- *y |= (unsigned EMUSHORT) i; /* high order output already has sign bit set */
- if (! REAL_WORDS_BIG_ENDIAN)
- {
- *(--y) = *p++;
- *(--y) = *p++;
- *(--y) = *p;
- }
- else
- {
- ++y;
- *y++ = *p++;
- *y++ = *p++;
- *y++ = *p++;
- }
-}
-
-#endif /* not IBM */
-#endif /* not DEC */
-
-
-
-/* e type to single precision. */
-
-#ifdef IBM
-/* Convert e-type X to IBM 370 float E. */
-
-static void
-etoe24 (x, e)
- unsigned EMUSHORT *x, *e;
-{
- etoibm (x, e, SFmode);
-}
-
-/* Convert exploded e-type X, that has already been rounded to
- float precision, to IBM 370 float Y. */
-
-static void
-toe24 (x, y)
- unsigned EMUSHORT *x, *y;
-{
- toibm (x, y, SFmode);
-}
-
-#else
-/* Convert e-type X to IEEE float E. DEC float is the same as IEEE float. */
-
-static void
-etoe24 (x, e)
- unsigned EMUSHORT *x, *e;
-{
- EMULONG exp;
- unsigned EMUSHORT xi[NI];
- int rndsav;
-
-#ifdef NANS
- if (eisnan (x))
- {
- make_nan (e, eisneg (x), SFmode);
- return;
- }
-#endif
- emovi (x, xi);
- /* adjust exponent for offsets */
- exp = (EMULONG) xi[E] - (EXONE - 0177);
-#ifdef INFINITY
- if (eisinf (x))
- goto nonorm;
-#endif
- /* round off to nearest or even */
- rndsav = rndprc;
- rndprc = 24;
- emdnorm (xi, 0, 0, exp, 64);
- rndprc = rndsav;
- nonorm:
- toe24 (xi, e);
-}
-
-/* Convert exploded e-type X, that has already been rounded to
- float precision, to IEEE float Y. */
-
-static void
-toe24 (x, y)
- unsigned EMUSHORT *x, *y;
-{
- unsigned EMUSHORT i;
- unsigned EMUSHORT *p;
-
-#ifdef NANS
- if (eiisnan (x))
- {
- make_nan (y, eiisneg (x), SFmode);
- return;
- }
-#endif
- p = &x[0];
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- y += 1;
-#endif
-#ifdef DEC
- y += 1;
-#endif
- *y = 0; /* output high order */
- if (*p++)
- *y = 0x8000; /* output sign bit */
-
- i = *p++;
-/* Handle overflow cases. */
- if (i >= 255)
- {
-#ifdef INFINITY
- *y |= (unsigned EMUSHORT) 0x7f80;
-#ifdef DEC
- *(--y) = 0;
-#endif
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- *(--y) = 0;
- else
- {
- ++y;
- *y = 0;
- }
-#endif
-#else /* no INFINITY */
- *y |= (unsigned EMUSHORT) 0x7f7f;
-#ifdef DEC
- *(--y) = 0xffff;
-#endif
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- *(--y) = 0xffff;
- else
- {
- ++y;
- *y = 0xffff;
- }
-#endif
-#ifdef ERANGE
- errno = ERANGE;
-#endif
-#endif /* no INFINITY */
- return;
- }
- if (i == 0)
- {
- eshift (x, 7);
- }
- else
- {
- i <<= 7;
- eshift (x, 8);
- }
- i |= *p++ & (unsigned EMUSHORT) 0x7f; /* *p = xi[M] */
- /* High order output already has sign bit set. */
- *y |= i;
-#ifdef DEC
- *(--y) = *p;
-#endif
-#ifdef IEEE
- if (! REAL_WORDS_BIG_ENDIAN)
- *(--y) = *p;
- else
- {
- ++y;
- *y = *p;
- }
-#endif
-}
-#endif /* not IBM */
-
-/* Compare two e type numbers.
- Return +1 if a > b
- 0 if a == b
- -1 if a < b
- -2 if either a or b is a NaN. */
-
-static int
-ecmp (a, b)
- unsigned EMUSHORT *a, *b;
-{
- unsigned EMUSHORT ai[NI], bi[NI];
- register unsigned EMUSHORT *p, *q;
- register int i;
- int msign;
-
-#ifdef NANS
- if (eisnan (a) || eisnan (b))
- return (-2);
-#endif
- emovi (a, ai);
- p = ai;
- emovi (b, bi);
- q = bi;
-
- if (*p != *q)
- { /* the signs are different */
- /* -0 equals + 0 */
- for (i = 1; i < NI - 1; i++)
- {
- if (ai[i] != 0)
- goto nzro;
- if (bi[i] != 0)
- goto nzro;
- }
- return (0);
- nzro:
- if (*p == 0)
- return (1);
- else
- return (-1);
- }
- /* both are the same sign */
- if (*p == 0)
- msign = 1;
- else
- msign = -1;
- i = NI - 1;
- do
- {
- if (*p++ != *q++)
- {
- goto diff;
- }
- }
- while (--i > 0);
-
- return (0); /* equality */
-
- diff:
-
- if (*(--p) > *(--q))
- return (msign); /* p is bigger */
- else
- return (-msign); /* p is littler */
-}
-
-/* Find e-type nearest integer to X, as floor (X + 0.5). */
-
-static void
-eround (x, y)
- unsigned EMUSHORT *x, *y;
-{
- eadd (ehalf, x, y);
- efloor (y, y);
-}
-
-/* Convert HOST_WIDE_INT LP to e type Y. */
-
-static void
-ltoe (lp, y)
- HOST_WIDE_INT *lp;
- unsigned EMUSHORT *y;
-{
- unsigned EMUSHORT yi[NI];
- unsigned HOST_WIDE_INT ll;
- int k;
-
- ecleaz (yi);
- if (*lp < 0)
- {
- /* make it positive */
- ll = (unsigned HOST_WIDE_INT) (-(*lp));
- yi[0] = 0xffff; /* put correct sign in the e type number */
- }
- else
- {
- ll = (unsigned HOST_WIDE_INT) (*lp);
- }
- /* move the long integer to yi significand area */
-#if HOST_BITS_PER_WIDE_INT == 64
- yi[M] = (unsigned EMUSHORT) (ll >> 48);
- yi[M + 1] = (unsigned EMUSHORT) (ll >> 32);
- yi[M + 2] = (unsigned EMUSHORT) (ll >> 16);
- yi[M + 3] = (unsigned EMUSHORT) ll;
- yi[E] = EXONE + 47; /* exponent if normalize shift count were 0 */
-#else
- yi[M] = (unsigned EMUSHORT) (ll >> 16);
- yi[M + 1] = (unsigned EMUSHORT) ll;
- yi[E] = EXONE + 15; /* exponent if normalize shift count were 0 */
-#endif
-
- if ((k = enormlz (yi)) > NBITS)/* normalize the significand */
- ecleaz (yi); /* it was zero */
- else
- yi[E] -= (unsigned EMUSHORT) k;/* subtract shift count from exponent */
- emovo (yi, y); /* output the answer */
-}
-
-/* Convert unsigned HOST_WIDE_INT LP to e type Y. */
-
-static void
-ultoe (lp, y)
- unsigned HOST_WIDE_INT *lp;
- unsigned EMUSHORT *y;
-{
- unsigned EMUSHORT yi[NI];
- unsigned HOST_WIDE_INT ll;
- int k;
-
- ecleaz (yi);
- ll = *lp;
-
- /* move the long integer to ayi significand area */
-#if HOST_BITS_PER_WIDE_INT == 64
- yi[M] = (unsigned EMUSHORT) (ll >> 48);
- yi[M + 1] = (unsigned EMUSHORT) (ll >> 32);
- yi[M + 2] = (unsigned EMUSHORT) (ll >> 16);
- yi[M + 3] = (unsigned EMUSHORT) ll;
- yi[E] = EXONE + 47; /* exponent if normalize shift count were 0 */
-#else
- yi[M] = (unsigned EMUSHORT) (ll >> 16);
- yi[M + 1] = (unsigned EMUSHORT) ll;
- yi[E] = EXONE + 15; /* exponent if normalize shift count were 0 */
-#endif
-
- if ((k = enormlz (yi)) > NBITS)/* normalize the significand */
- ecleaz (yi); /* it was zero */
- else
- yi[E] -= (unsigned EMUSHORT) k; /* subtract shift count from exponent */
- emovo (yi, y); /* output the answer */
-}
-
-
-/* Find signed HOST_WIDE_INT integer I and floating point fractional
- part FRAC of e-type (packed internal format) floating point input X.
- The integer output I has the sign of the input, except that
- positive overflow is permitted if FIXUNS_TRUNC_LIKE_FIX_TRUNC.
- The output e-type fraction FRAC is the positive fractional
- part of abs (X). */
-
-static void
-eifrac (x, i, frac)
- unsigned EMUSHORT *x;
- HOST_WIDE_INT *i;
- unsigned EMUSHORT *frac;
-{
- unsigned EMUSHORT xi[NI];
- int j, k;
- unsigned HOST_WIDE_INT ll;
-
- emovi (x, xi);
- k = (int) xi[E] - (EXONE - 1);
- if (k <= 0)
- {
- /* if exponent <= 0, integer = 0 and real output is fraction */
- *i = 0L;
- emovo (xi, frac);
- return;
- }
- if (k > (HOST_BITS_PER_WIDE_INT - 1))
- {
- /* long integer overflow: output large integer
- and correct fraction */
- if (xi[0])
- *i = ((unsigned HOST_WIDE_INT) 1) << (HOST_BITS_PER_WIDE_INT - 1);
- else
- {
-#ifdef FIXUNS_TRUNC_LIKE_FIX_TRUNC
- /* In this case, let it overflow and convert as if unsigned. */
- euifrac (x, &ll, frac);
- *i = (HOST_WIDE_INT) ll;
- return;
-#else
- /* In other cases, return the largest positive integer. */
- *i = (((unsigned HOST_WIDE_INT) 1) << (HOST_BITS_PER_WIDE_INT - 1)) - 1;
-#endif
- }
- eshift (xi, k);
- if (extra_warnings)
- warning ("overflow on truncation to integer");
- }
- else if (k > 16)
- {
- /* Shift more than 16 bits: first shift up k-16 mod 16,
- then shift up by 16's. */
- j = k - ((k >> 4) << 4);
- eshift (xi, j);
- ll = xi[M];
- k -= j;
- do
- {
- eshup6 (xi);
- ll = (ll << 16) | xi[M];
- }
- while ((k -= 16) > 0);
- *i = ll;
- if (xi[0])
- *i = -(*i);
- }
- else
- {
- /* shift not more than 16 bits */
- eshift (xi, k);
- *i = (HOST_WIDE_INT) xi[M] & 0xffff;
- if (xi[0])
- *i = -(*i);
- }
- xi[0] = 0;
- xi[E] = EXONE - 1;
- xi[M] = 0;
- if ((k = enormlz (xi)) > NBITS)
- ecleaz (xi);
- else
- xi[E] -= (unsigned EMUSHORT) k;
-
- emovo (xi, frac);
-}
-
-
-/* Find unsigned HOST_WIDE_INT integer I and floating point fractional part
- FRAC of e-type X. A negative input yields integer output = 0 but
- correct fraction. */
-
-static void
-euifrac (x, i, frac)
- unsigned EMUSHORT *x;
- unsigned HOST_WIDE_INT *i;
- unsigned EMUSHORT *frac;
-{
- unsigned HOST_WIDE_INT ll;
- unsigned EMUSHORT xi[NI];
- int j, k;
-
- emovi (x, xi);
- k = (int) xi[E] - (EXONE - 1);
- if (k <= 0)
- {
- /* if exponent <= 0, integer = 0 and argument is fraction */
- *i = 0L;
- emovo (xi, frac);
- return;
- }
- if (k > HOST_BITS_PER_WIDE_INT)
- {
- /* Long integer overflow: output large integer
- and correct fraction.
- Note, the BSD microvax compiler says that ~(0UL)
- is a syntax error. */
- *i = ~(0L);
- eshift (xi, k);
- if (extra_warnings)
- warning ("overflow on truncation to unsigned integer");
- }
- else if (k > 16)
- {
- /* Shift more than 16 bits: first shift up k-16 mod 16,
- then shift up by 16's. */
- j = k - ((k >> 4) << 4);
- eshift (xi, j);
- ll = xi[M];
- k -= j;
- do
- {
- eshup6 (xi);
- ll = (ll << 16) | xi[M];
- }
- while ((k -= 16) > 0);
- *i = ll;
- }
- else
- {
- /* shift not more than 16 bits */
- eshift (xi, k);
- *i = (HOST_WIDE_INT) xi[M] & 0xffff;
- }
-
- if (xi[0]) /* A negative value yields unsigned integer 0. */
- *i = 0L;
-
- xi[0] = 0;
- xi[E] = EXONE - 1;
- xi[M] = 0;
- if ((k = enormlz (xi)) > NBITS)
- ecleaz (xi);
- else
- xi[E] -= (unsigned EMUSHORT) k;
-
- emovo (xi, frac);
-}
-
-/* Shift the significand of exploded e-type X up or down by SC bits. */
-
-static int
-eshift (x, sc)
- unsigned EMUSHORT *x;
- int sc;
-{
- unsigned EMUSHORT lost;
- unsigned EMUSHORT *p;
-
- if (sc == 0)
- return (0);
-
- lost = 0;
- p = x + NI - 1;
-
- if (sc < 0)
- {
- sc = -sc;
- while (sc >= 16)
- {
- lost |= *p; /* remember lost bits */
- eshdn6 (x);
- sc -= 16;
- }
-
- while (sc >= 8)
- {
- lost |= *p & 0xff;
- eshdn8 (x);
- sc -= 8;
- }
-
- while (sc > 0)
- {
- lost |= *p & 1;
- eshdn1 (x);
- sc -= 1;
- }
- }
- else
- {
- while (sc >= 16)
- {
- eshup6 (x);
- sc -= 16;
- }
-
- while (sc >= 8)
- {
- eshup8 (x);
- sc -= 8;
- }
-
- while (sc > 0)
- {
- eshup1 (x);
- sc -= 1;
- }
- }
- if (lost)
- lost = 1;
- return ((int) lost);
-}
-
-/* Shift normalize the significand area of exploded e-type X.
- Return the shift count (up = positive). */
-
-static int
-enormlz (x)
- unsigned EMUSHORT x[];
-{
- register unsigned EMUSHORT *p;
- int sc;
-
- sc = 0;
- p = &x[M];
- if (*p != 0)
- goto normdn;
- ++p;
- if (*p & 0x8000)
- return (0); /* already normalized */
- while (*p == 0)
- {
- eshup6 (x);
- sc += 16;
-
- /* With guard word, there are NBITS+16 bits available.
- Return true if all are zero. */
- if (sc > NBITS)
- return (sc);
- }
- /* see if high byte is zero */
- while ((*p & 0xff00) == 0)
- {
- eshup8 (x);
- sc += 8;
- }
- /* now shift 1 bit at a time */
- while ((*p & 0x8000) == 0)
- {
- eshup1 (x);
- sc += 1;
- if (sc > NBITS)
- {
- mtherr ("enormlz", UNDERFLOW);
- return (sc);
- }
- }
- return (sc);
-
- /* Normalize by shifting down out of the high guard word
- of the significand */
- normdn:
-
- if (*p & 0xff00)
- {
- eshdn8 (x);
- sc -= 8;
- }
- while (*p != 0)
- {
- eshdn1 (x);
- sc -= 1;
-
- if (sc < -NBITS)
- {
- mtherr ("enormlz", OVERFLOW);
- return (sc);
- }
- }
- return (sc);
-}
-
-/* Powers of ten used in decimal <-> binary conversions. */
-
-#define NTEN 12
-#define MAXP 4096
-
-#if LONG_DOUBLE_TYPE_SIZE == 128
-static unsigned EMUSHORT etens[NTEN + 1][NE] =
-{
- {0x6576, 0x4a92, 0x804a, 0x153f,
- 0xc94c, 0x979a, 0x8a20, 0x5202, 0xc460, 0x7525,}, /* 10**4096 */
- {0x6a32, 0xce52, 0x329a, 0x28ce,
- 0xa74d, 0x5de4, 0xc53d, 0x3b5d, 0x9e8b, 0x5a92,}, /* 10**2048 */
- {0x526c, 0x50ce, 0xf18b, 0x3d28,
- 0x650d, 0x0c17, 0x8175, 0x7586, 0xc976, 0x4d48,},
- {0x9c66, 0x58f8, 0xbc50, 0x5c54,
- 0xcc65, 0x91c6, 0xa60e, 0xa0ae, 0xe319, 0x46a3,},
- {0x851e, 0xeab7, 0x98fe, 0x901b,
- 0xddbb, 0xde8d, 0x9df9, 0xebfb, 0xaa7e, 0x4351,},
- {0x0235, 0x0137, 0x36b1, 0x336c,
- 0xc66f, 0x8cdf, 0x80e9, 0x47c9, 0x93ba, 0x41a8,},
- {0x50f8, 0x25fb, 0xc76b, 0x6b71,
- 0x3cbf, 0xa6d5, 0xffcf, 0x1f49, 0xc278, 0x40d3,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0xf020, 0xb59d, 0x2b70, 0xada8, 0x9dc5, 0x4069,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0400, 0xc9bf, 0x8e1b, 0x4034,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x2000, 0xbebc, 0x4019,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x9c40, 0x400c,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0xc800, 0x4005,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0xa000, 0x4002,}, /* 10**1 */
-};
-
-static unsigned EMUSHORT emtens[NTEN + 1][NE] =
-{
- {0x2030, 0xcffc, 0xa1c3, 0x8123,
- 0x2de3, 0x9fde, 0xd2ce, 0x04c8, 0xa6dd, 0x0ad8,}, /* 10**-4096 */
- {0x8264, 0xd2cb, 0xf2ea, 0x12d4,
- 0x4925, 0x2de4, 0x3436, 0x534f, 0xceae, 0x256b,}, /* 10**-2048 */
- {0xf53f, 0xf698, 0x6bd3, 0x0158,
- 0x87a6, 0xc0bd, 0xda57, 0x82a5, 0xa2a6, 0x32b5,},
- {0xe731, 0x04d4, 0xe3f2, 0xd332,
- 0x7132, 0xd21c, 0xdb23, 0xee32, 0x9049, 0x395a,},
- {0xa23e, 0x5308, 0xfefb, 0x1155,
- 0xfa91, 0x1939, 0x637a, 0x4325, 0xc031, 0x3cac,},
- {0xe26d, 0xdbde, 0xd05d, 0xb3f6,
- 0xac7c, 0xe4a0, 0x64bc, 0x467c, 0xddd0, 0x3e55,},
- {0x2a20, 0x6224, 0x47b3, 0x98d7,
- 0x3f23, 0xe9a5, 0xa539, 0xea27, 0xa87f, 0x3f2a,},
- {0x0b5b, 0x4af2, 0xa581, 0x18ed,
- 0x67de, 0x94ba, 0x4539, 0x1ead, 0xcfb1, 0x3f94,},
- {0xbf71, 0xa9b3, 0x7989, 0xbe68,
- 0x4c2e, 0xe15b, 0xc44d, 0x94be, 0xe695, 0x3fc9,},
- {0x3d4d, 0x7c3d, 0x36ba, 0x0d2b,
- 0xfdc2, 0xcefc, 0x8461, 0x7711, 0xabcc, 0x3fe4,},
- {0xc155, 0xa4a8, 0x404e, 0x6113,
- 0xd3c3, 0x652b, 0xe219, 0x1758, 0xd1b7, 0x3ff1,},
- {0xd70a, 0x70a3, 0x0a3d, 0xa3d7,
- 0x3d70, 0xd70a, 0x70a3, 0x0a3d, 0xa3d7, 0x3ff8,},
- {0xcccd, 0xcccc, 0xcccc, 0xcccc,
- 0xcccc, 0xcccc, 0xcccc, 0xcccc, 0xcccc, 0x3ffb,}, /* 10**-1 */
-};
-#else
-/* LONG_DOUBLE_TYPE_SIZE is other than 128 */
-static unsigned EMUSHORT etens[NTEN + 1][NE] =
-{
- {0xc94c, 0x979a, 0x8a20, 0x5202, 0xc460, 0x7525,}, /* 10**4096 */
- {0xa74d, 0x5de4, 0xc53d, 0x3b5d, 0x9e8b, 0x5a92,}, /* 10**2048 */
- {0x650d, 0x0c17, 0x8175, 0x7586, 0xc976, 0x4d48,},
- {0xcc65, 0x91c6, 0xa60e, 0xa0ae, 0xe319, 0x46a3,},
- {0xddbc, 0xde8d, 0x9df9, 0xebfb, 0xaa7e, 0x4351,},
- {0xc66f, 0x8cdf, 0x80e9, 0x47c9, 0x93ba, 0x41a8,},
- {0x3cbf, 0xa6d5, 0xffcf, 0x1f49, 0xc278, 0x40d3,},
- {0xf020, 0xb59d, 0x2b70, 0xada8, 0x9dc5, 0x4069,},
- {0x0000, 0x0000, 0x0400, 0xc9bf, 0x8e1b, 0x4034,},
- {0x0000, 0x0000, 0x0000, 0x2000, 0xbebc, 0x4019,},
- {0x0000, 0x0000, 0x0000, 0x0000, 0x9c40, 0x400c,},
- {0x0000, 0x0000, 0x0000, 0x0000, 0xc800, 0x4005,},
- {0x0000, 0x0000, 0x0000, 0x0000, 0xa000, 0x4002,}, /* 10**1 */
-};
-
-static unsigned EMUSHORT emtens[NTEN + 1][NE] =
-{
- {0x2de4, 0x9fde, 0xd2ce, 0x04c8, 0xa6dd, 0x0ad8,}, /* 10**-4096 */
- {0x4925, 0x2de4, 0x3436, 0x534f, 0xceae, 0x256b,}, /* 10**-2048 */
- {0x87a6, 0xc0bd, 0xda57, 0x82a5, 0xa2a6, 0x32b5,},
- {0x7133, 0xd21c, 0xdb23, 0xee32, 0x9049, 0x395a,},
- {0xfa91, 0x1939, 0x637a, 0x4325, 0xc031, 0x3cac,},
- {0xac7d, 0xe4a0, 0x64bc, 0x467c, 0xddd0, 0x3e55,},
- {0x3f24, 0xe9a5, 0xa539, 0xea27, 0xa87f, 0x3f2a,},
- {0x67de, 0x94ba, 0x4539, 0x1ead, 0xcfb1, 0x3f94,},
- {0x4c2f, 0xe15b, 0xc44d, 0x94be, 0xe695, 0x3fc9,},
- {0xfdc2, 0xcefc, 0x8461, 0x7711, 0xabcc, 0x3fe4,},
- {0xd3c3, 0x652b, 0xe219, 0x1758, 0xd1b7, 0x3ff1,},
- {0x3d71, 0xd70a, 0x70a3, 0x0a3d, 0xa3d7, 0x3ff8,},
- {0xcccd, 0xcccc, 0xcccc, 0xcccc, 0xcccc, 0x3ffb,}, /* 10**-1 */
-};
-#endif
-
-/* Convert float value X to ASCII string STRING with NDIG digits after
- the decimal point. */
-
-static void
-e24toasc (x, string, ndigs)
- unsigned EMUSHORT x[];
- char *string;
- int ndigs;
-{
- unsigned EMUSHORT w[NI];
-
- e24toe (x, w);
- etoasc (w, string, ndigs);
-}
-
-/* Convert double value X to ASCII string STRING with NDIG digits after
- the decimal point. */
-
-static void
-e53toasc (x, string, ndigs)
- unsigned EMUSHORT x[];
- char *string;
- int ndigs;
-{
- unsigned EMUSHORT w[NI];
-
- e53toe (x, w);
- etoasc (w, string, ndigs);
-}
-
-/* Convert double extended value X to ASCII string STRING with NDIG digits
- after the decimal point. */
-
-static void
-e64toasc (x, string, ndigs)
- unsigned EMUSHORT x[];
- char *string;
- int ndigs;
-{
- unsigned EMUSHORT w[NI];
-
- e64toe (x, w);
- etoasc (w, string, ndigs);
-}
-
-/* Convert 128-bit long double value X to ASCII string STRING with NDIG digits
- after the decimal point. */
-
-static void
-e113toasc (x, string, ndigs)
- unsigned EMUSHORT x[];
- char *string;
- int ndigs;
-{
- unsigned EMUSHORT w[NI];
-
- e113toe (x, w);
- etoasc (w, string, ndigs);
-}
-
-/* Convert e-type X to ASCII string STRING with NDIGS digits after
- the decimal point. */
-
-static char wstring[80]; /* working storage for ASCII output */
-
-static void
-etoasc (x, string, ndigs)
- unsigned EMUSHORT x[];
- char *string;
- int ndigs;
-{
- EMUSHORT digit;
- unsigned EMUSHORT y[NI], t[NI], u[NI], w[NI];
- unsigned EMUSHORT *p, *r, *ten;
- unsigned EMUSHORT sign;
- int i, j, k, expon, rndsav;
- char *s, *ss;
- unsigned EMUSHORT m;
-
-
- rndsav = rndprc;
- ss = string;
- s = wstring;
- *ss = '\0';
- *s = '\0';
-#ifdef NANS
- if (eisnan (x))
- {
- sprintf (wstring, " NaN ");
- goto bxit;
- }
-#endif
- rndprc = NBITS; /* set to full precision */
- emov (x, y); /* retain external format */
- if (y[NE - 1] & 0x8000)
- {
- sign = 0xffff;
- y[NE - 1] &= 0x7fff;
- }
- else
- {
- sign = 0;
- }
- expon = 0;
- ten = &etens[NTEN][0];
- emov (eone, t);
- /* Test for zero exponent */
- if (y[NE - 1] == 0)
- {
- for (k = 0; k < NE - 1; k++)
- {
- if (y[k] != 0)
- goto tnzro; /* denormalized number */
- }
- goto isone; /* valid all zeros */
- }
- tnzro:
-
- /* Test for infinity. */
- if (y[NE - 1] == 0x7fff)
- {
- if (sign)
- sprintf (wstring, " -Infinity ");
- else
- sprintf (wstring, " Infinity ");
- goto bxit;
- }
-
- /* Test for exponent nonzero but significand denormalized.
- * This is an error condition.
- */
- if ((y[NE - 1] != 0) && ((y[NE - 2] & 0x8000) == 0))
- {
- mtherr ("etoasc", DOMAIN);
- sprintf (wstring, "NaN");
- goto bxit;
- }
-
- /* Compare to 1.0 */
- i = ecmp (eone, y);
- if (i == 0)
- goto isone;
-
- if (i == -2)
- abort ();
-
- if (i < 0)
- { /* Number is greater than 1 */
- /* Convert significand to an integer and strip trailing decimal zeros. */
- emov (y, u);
- u[NE - 1] = EXONE + NBITS - 1;
-
- p = &etens[NTEN - 4][0];
- m = 16;
- do
- {
- ediv (p, u, t);
- efloor (t, w);
- for (j = 0; j < NE - 1; j++)
- {
- if (t[j] != w[j])
- goto noint;
- }
- emov (t, u);
- expon += (int) m;
- noint:
- p += NE;
- m >>= 1;
- }
- while (m != 0);
-
- /* Rescale from integer significand */
- u[NE - 1] += y[NE - 1] - (unsigned int) (EXONE + NBITS - 1);
- emov (u, y);
- /* Find power of 10 */
- emov (eone, t);
- m = MAXP;
- p = &etens[0][0];
- /* An unordered compare result shouldn't happen here. */
- while (ecmp (ten, u) <= 0)
- {
- if (ecmp (p, u) <= 0)
- {
- ediv (p, u, u);
- emul (p, t, t);
- expon += (int) m;
- }
- m >>= 1;
- if (m == 0)
- break;
- p += NE;
- }
- }
- else
- { /* Number is less than 1.0 */
- /* Pad significand with trailing decimal zeros. */
- if (y[NE - 1] == 0)
- {
- while ((y[NE - 2] & 0x8000) == 0)
- {
- emul (ten, y, y);
- expon -= 1;
- }
- }
- else
- {
- emovi (y, w);
- for (i = 0; i < NDEC + 1; i++)
- {
- if ((w[NI - 1] & 0x7) != 0)
- break;
- /* multiply by 10 */
- emovz (w, u);
- eshdn1 (u);
- eshdn1 (u);
- eaddm (w, u);
- u[1] += 3;
- while (u[2] != 0)
- {
- eshdn1 (u);
- u[1] += 1;
- }
- if (u[NI - 1] != 0)
- break;
- if (eone[NE - 1] <= u[1])
- break;
- emovz (u, w);
- expon -= 1;
- }
- emovo (w, y);
- }
- k = -MAXP;
- p = &emtens[0][0];
- r = &etens[0][0];
- emov (y, w);
- emov (eone, t);
- while (ecmp (eone, w) > 0)
- {
- if (ecmp (p, w) >= 0)
- {
- emul (r, w, w);
- emul (r, t, t);
- expon += k;
- }
- k /= 2;
- if (k == 0)
- break;
- p += NE;
- r += NE;
- }
- ediv (t, eone, t);
- }
- isone:
- /* Find the first (leading) digit. */
- emovi (t, w);
- emovz (w, t);
- emovi (y, w);
- emovz (w, y);
- eiremain (t, y);
- digit = equot[NI - 1];
- while ((digit == 0) && (ecmp (y, ezero) != 0))
- {
- eshup1 (y);
- emovz (y, u);
- eshup1 (u);
- eshup1 (u);
- eaddm (u, y);
- eiremain (t, y);
- digit = equot[NI - 1];
- expon -= 1;
- }
- s = wstring;
- if (sign)
- *s++ = '-';
- else
- *s++ = ' ';
- /* Examine number of digits requested by caller. */
- if (ndigs < 0)
- ndigs = 0;
- if (ndigs > NDEC)
- ndigs = NDEC;
- if (digit == 10)
- {
- *s++ = '1';
- *s++ = '.';
- if (ndigs > 0)
- {
- *s++ = '0';
- ndigs -= 1;
- }
- expon += 1;
- }
- else
- {
- *s++ = (char)digit + '0';
- *s++ = '.';
- }
- /* Generate digits after the decimal point. */
- for (k = 0; k <= ndigs; k++)
- {
- /* multiply current number by 10, without normalizing */
- eshup1 (y);
- emovz (y, u);
- eshup1 (u);
- eshup1 (u);
- eaddm (u, y);
- eiremain (t, y);
- *s++ = (char) equot[NI - 1] + '0';
- }
- digit = equot[NI - 1];
- --s;
- ss = s;
- /* round off the ASCII string */
- if (digit > 4)
- {
- /* Test for critical rounding case in ASCII output. */
- if (digit == 5)
- {
- emovo (y, t);
- if (ecmp (t, ezero) != 0)
- goto roun; /* round to nearest */
- if ((*(s - 1) & 1) == 0)
- goto doexp; /* round to even */
- }
- /* Round up and propagate carry-outs */
- roun:
- --s;
- k = *s & 0x7f;
- /* Carry out to most significant digit? */
- if (k == '.')
- {
- --s;
- k = *s;
- k += 1;
- *s = (char) k;
- /* Most significant digit carries to 10? */
- if (k > '9')
- {
- expon += 1;
- *s = '1';
- }
- goto doexp;
- }
- /* Round up and carry out from less significant digits */
- k += 1;
- *s = (char) k;
- if (k > '9')
- {
- *s = '0';
- goto roun;
- }
- }
- doexp:
- /*
- if (expon >= 0)
- sprintf (ss, "e+%d", expon);
- else
- sprintf (ss, "e%d", expon);
- */
- sprintf (ss, "e%d", expon);
- bxit:
- rndprc = rndsav;
- /* copy out the working string */
- s = string;
- ss = wstring;
- while (*ss == ' ') /* strip possible leading space */
- ++ss;
- while ((*s++ = *ss++) != '\0')
- ;
-}
-
-
-/* Convert ASCII string to floating point.
-
- Numeric input is a free format decimal number of any length, with
- or without decimal point. Entering E after the number followed by an
- integer number causes the second number to be interpreted as a power of
- 10 to be multiplied by the first number (i.e., "scientific" notation). */
-
-/* Convert ASCII string S to single precision float value Y. */
-
-static void
-asctoe24 (s, y)
- char *s;
- unsigned EMUSHORT *y;
-{
- asctoeg (s, y, 24);
-}
-
-
-/* Convert ASCII string S to double precision value Y. */
-
-static void
-asctoe53 (s, y)
- char *s;
- unsigned EMUSHORT *y;
-{
-#if defined(DEC) || defined(IBM)
- asctoeg (s, y, 56);
-#else
- asctoeg (s, y, 53);
-#endif
-}
-
-
-/* Convert ASCII string S to double extended value Y. */
-
-static void
-asctoe64 (s, y)
- char *s;
- unsigned EMUSHORT *y;
-{
- asctoeg (s, y, 64);
-}
-
-/* Convert ASCII string S to 128-bit long double Y. */
-
-static void
-asctoe113 (s, y)
- char *s;
- unsigned EMUSHORT *y;
-{
- asctoeg (s, y, 113);
-}
-
-/* Convert ASCII string S to e type Y. */
-
-static void
-asctoe (s, y)
- char *s;
- unsigned EMUSHORT *y;
-{
- asctoeg (s, y, NBITS);
-}
-
-/* Convert ASCII string SS to e type Y, with a specified rounding precision
- of OPREC bits. */
-
-static void
-asctoeg (ss, y, oprec)
- char *ss;
- unsigned EMUSHORT *y;
- int oprec;
-{
- unsigned EMUSHORT yy[NI], xt[NI], tt[NI];
- int esign, decflg, sgnflg, nexp, exp, prec, lost;
- int k, trail, c, rndsav;
- EMULONG lexp;
- unsigned EMUSHORT nsign, *p;
- char *sp, *s, *lstr;
-
- /* Copy the input string. */
- lstr = (char *) alloca (strlen (ss) + 1);
- s = ss;
- while (*s == ' ') /* skip leading spaces */
- ++s;
- sp = lstr;
- while ((*sp++ = *s++) != '\0')
- ;
- s = lstr;
-
- rndsav = rndprc;
- rndprc = NBITS; /* Set to full precision */
- lost = 0;
- nsign = 0;
- decflg = 0;
- sgnflg = 0;
- nexp = 0;
- exp = 0;
- prec = 0;
- ecleaz (yy);
- trail = 0;
-
- nxtcom:
- k = *s - '0';
- if ((k >= 0) && (k <= 9))
- {
- /* Ignore leading zeros */
- if ((prec == 0) && (decflg == 0) && (k == 0))
- goto donchr;
- /* Identify and strip trailing zeros after the decimal point. */
- if ((trail == 0) && (decflg != 0))
- {
- sp = s;
- while ((*sp >= '0') && (*sp <= '9'))
- ++sp;
- /* Check for syntax error */
- c = *sp & 0x7f;
- if ((c != 'e') && (c != 'E') && (c != '\0')
- && (c != '\n') && (c != '\r') && (c != ' ')
- && (c != ','))
- goto error;
- --sp;
- while (*sp == '0')
- *sp-- = 'z';
- trail = 1;
- if (*s == 'z')
- goto donchr;
- }
-
- /* If enough digits were given to more than fill up the yy register,
- continuing until overflow into the high guard word yy[2]
- guarantees that there will be a roundoff bit at the top
- of the low guard word after normalization. */
-
- if (yy[2] == 0)
- {
- if (decflg)
- nexp += 1; /* count digits after decimal point */
- eshup1 (yy); /* multiply current number by 10 */
- emovz (yy, xt);
- eshup1 (xt);
- eshup1 (xt);
- eaddm (xt, yy);
- ecleaz (xt);
- xt[NI - 2] = (unsigned EMUSHORT) k;
- eaddm (xt, yy);
- }
- else
- {
- /* Mark any lost non-zero digit. */
- lost |= k;
- /* Count lost digits before the decimal point. */
- if (decflg == 0)
- nexp -= 1;
- }
- prec += 1;
- goto donchr;
- }
-
- switch (*s)
- {
- case 'z':
- break;
- case 'E':
- case 'e':
- goto expnt;
- case '.': /* decimal point */
- if (decflg)
- goto error;
- ++decflg;
- break;
- case '-':
- nsign = 0xffff;
- if (sgnflg)
- goto error;
- ++sgnflg;
- break;
- case '+':
- if (sgnflg)
- goto error;
- ++sgnflg;
- break;
- case ',':
- case ' ':
- case '\0':
- case '\n':
- case '\r':
- goto daldone;
- case 'i':
- case 'I':
- goto infinite;
- default:
- error:
-#ifdef NANS
- einan (yy);
-#else
- mtherr ("asctoe", DOMAIN);
- eclear (yy);
-#endif
- goto aexit;
- }
- donchr:
- ++s;
- goto nxtcom;
-
- /* Exponent interpretation */
- expnt:
- /* 0.0eXXX is zero, regardless of XXX. Check for the 0.0. */
- for (k = 0; k < NI; k++)
- {
- if (yy[k] != 0)
- goto read_expnt;
- }
- goto aexit;
-
-read_expnt:
- esign = 1;
- exp = 0;
- ++s;
- /* check for + or - */
- if (*s == '-')
- {
- esign = -1;
- ++s;
- }
- if (*s == '+')
- ++s;
- while ((*s >= '0') && (*s <= '9'))
- {
- exp *= 10;
- exp += *s++ - '0';
- if (exp > -(MINDECEXP))
- {
- if (esign < 0)
- goto zero;
- else
- goto infinite;
- }
- }
- if (esign < 0)
- exp = -exp;
- if (exp > MAXDECEXP)
- {
- infinite:
- ecleaz (yy);
- yy[E] = 0x7fff; /* infinity */
- goto aexit;
- }
- if (exp < MINDECEXP)
- {
- zero:
- ecleaz (yy);
- goto aexit;
- }
-
- daldone:
- nexp = exp - nexp;
- /* Pad trailing zeros to minimize power of 10, per IEEE spec. */
- while ((nexp > 0) && (yy[2] == 0))
- {
- emovz (yy, xt);
- eshup1 (xt);
- eshup1 (xt);
- eaddm (yy, xt);
- eshup1 (xt);
- if (xt[2] != 0)
- break;
- nexp -= 1;
- emovz (xt, yy);
- }
- if ((k = enormlz (yy)) > NBITS)
- {
- ecleaz (yy);
- goto aexit;
- }
- lexp = (EXONE - 1 + NBITS) - k;
- emdnorm (yy, lost, 0, lexp, 64);
-
- /* Convert to external format:
-
- Multiply by 10**nexp. If precision is 64 bits,
- the maximum relative error incurred in forming 10**n
- for 0 <= n <= 324 is 8.2e-20, at 10**180.
- For 0 <= n <= 999, the peak relative error is 1.4e-19 at 10**947.
- For 0 >= n >= -999, it is -1.55e-19 at 10**-435. */
-
- lexp = yy[E];
- if (nexp == 0)
- {
- k = 0;
- goto expdon;
- }
- esign = 1;
- if (nexp < 0)
- {
- nexp = -nexp;
- esign = -1;
- if (nexp > 4096)
- {
- /* Punt. Can't handle this without 2 divides. */
- emovi (etens[0], tt);
- lexp -= tt[E];
- k = edivm (tt, yy);
- lexp += EXONE;
- nexp -= 4096;
- }
- }
- p = &etens[NTEN][0];
- emov (eone, xt);
- exp = 1;
- do
- {
- if (exp & nexp)
- emul (p, xt, xt);
- p -= NE;
- exp = exp + exp;
- }
- while (exp <= MAXP);
-
- emovi (xt, tt);
- if (esign < 0)
- {
- lexp -= tt[E];
- k = edivm (tt, yy);
- lexp += EXONE;
- }
- else
- {
- lexp += tt[E];
- k = emulm (tt, yy);
- lexp -= EXONE - 1;
- }
-
- expdon:
-
- /* Round and convert directly to the destination type */
- if (oprec == 53)
- lexp -= EXONE - 0x3ff;
-#ifdef IBM
- else if (oprec == 24 || oprec == 56)
- lexp -= EXONE - (0x41 << 2);
-#else
- else if (oprec == 24)
- lexp -= EXONE - 0177;
-#endif
-#ifdef DEC
- else if (oprec == 56)
- lexp -= EXONE - 0201;
-#endif
- rndprc = oprec;
- emdnorm (yy, k, 0, lexp, 64);
-
- aexit:
-
- rndprc = rndsav;
- yy[0] = nsign;
- switch (oprec)
- {
-#ifdef DEC
- case 56:
- todec (yy, y); /* see etodec.c */
- break;
-#endif
-#ifdef IBM
- case 56:
- toibm (yy, y, DFmode);
- break;
-#endif
- case 53:
- toe53 (yy, y);
- break;
- case 24:
- toe24 (yy, y);
- break;
- case 64:
- toe64 (yy, y);
- break;
- case 113:
- toe113 (yy, y);
- break;
- case NBITS:
- emovo (yy, y);
- break;
- }
-}
-
-
-
-/* Return Y = largest integer not greater than X (truncated toward minus
- infinity). */
-
-static unsigned EMUSHORT bmask[] =
-{
- 0xffff,
- 0xfffe,
- 0xfffc,
- 0xfff8,
- 0xfff0,
- 0xffe0,
- 0xffc0,
- 0xff80,
- 0xff00,
- 0xfe00,
- 0xfc00,
- 0xf800,
- 0xf000,
- 0xe000,
- 0xc000,
- 0x8000,
- 0x0000,
-};
-
-static void
-efloor (x, y)
- unsigned EMUSHORT x[], y[];
-{
- register unsigned EMUSHORT *p;
- int e, expon, i;
- unsigned EMUSHORT f[NE];
-
- emov (x, f); /* leave in external format */
- expon = (int) f[NE - 1];
- e = (expon & 0x7fff) - (EXONE - 1);
- if (e <= 0)
- {
- eclear (y);
- goto isitneg;
- }
- /* number of bits to clear out */
- e = NBITS - e;
- emov (f, y);
- if (e <= 0)
- return;
-
- p = &y[0];
- while (e >= 16)
- {
- *p++ = 0;
- e -= 16;
- }
- /* clear the remaining bits */
- *p &= bmask[e];
- /* truncate negatives toward minus infinity */
- isitneg:
-
- if ((unsigned EMUSHORT) expon & (unsigned EMUSHORT) 0x8000)
- {
- for (i = 0; i < NE - 1; i++)
- {
- if (f[i] != y[i])
- {
- esub (eone, y, y);
- break;
- }
- }
- }
-}
-
-
-/* Return S and EXP such that S * 2^EXP = X and .5 <= S < 1.
- For example, 1.1 = 0.55 * 2^1. */
-
-static void
-efrexp (x, exp, s)
- unsigned EMUSHORT x[];
- int *exp;
- unsigned EMUSHORT s[];
-{
- unsigned EMUSHORT xi[NI];
- EMULONG li;
-
- emovi (x, xi);
- /* Handle denormalized numbers properly using long integer exponent. */
- li = (EMULONG) ((EMUSHORT) xi[1]);
-
- if (li == 0)
- {
- li -= enormlz (xi);
- }
- xi[1] = 0x3ffe;
- emovo (xi, s);
- *exp = (int) (li - 0x3ffe);
-}
-
-/* Return e type Y = X * 2^PWR2. */
-
-static void
-eldexp (x, pwr2, y)
- unsigned EMUSHORT x[];
- int pwr2;
- unsigned EMUSHORT y[];
-{
- unsigned EMUSHORT xi[NI];
- EMULONG li;
- int i;
-
- emovi (x, xi);
- li = xi[1];
- li += pwr2;
- i = 0;
- emdnorm (xi, i, i, li, 64);
- emovo (xi, y);
-}
-
-
-/* C = remainder after dividing B by A, all e type values.
- Least significant integer quotient bits left in EQUOT. */
-
-static void
-eremain (a, b, c)
- unsigned EMUSHORT a[], b[], c[];
-{
- unsigned EMUSHORT den[NI], num[NI];
-
-#ifdef NANS
- if (eisinf (b)
- || (ecmp (a, ezero) == 0)
- || eisnan (a)
- || eisnan (b))
- {
- enan (c, 0);
- return;
- }
-#endif
- if (ecmp (a, ezero) == 0)
- {
- mtherr ("eremain", SING);
- eclear (c);
- return;
- }
- emovi (a, den);
- emovi (b, num);
- eiremain (den, num);
- /* Sign of remainder = sign of quotient */
- if (a[0] == b[0])
- num[0] = 0;
- else
- num[0] = 0xffff;
- emovo (num, c);
-}
-
-/* Return quotient of exploded e-types NUM / DEN in EQUOT,
- remainder in NUM. */
-
-static void
-eiremain (den, num)
- unsigned EMUSHORT den[], num[];
-{
- EMULONG ld, ln;
- unsigned EMUSHORT j;
-
- ld = den[E];
- ld -= enormlz (den);
- ln = num[E];
- ln -= enormlz (num);
- ecleaz (equot);
- while (ln >= ld)
- {
- if (ecmpm (den, num) <= 0)
- {
- esubm (den, num);
- j = 1;
- }
- else
- j = 0;
- eshup1 (equot);
- equot[NI - 1] |= j;
- eshup1 (num);
- ln -= 1;
- }
- emdnorm (num, 0, 0, ln, 0);
-}
-
-/* Report an error condition CODE encountered in function NAME.
- CODE is one of the following:
-
- Mnemonic Value Significance
-
- DOMAIN 1 argument domain error
- SING 2 function singularity
- OVERFLOW 3 overflow range error
- UNDERFLOW 4 underflow range error
- TLOSS 5 total loss of precision
- PLOSS 6 partial loss of precision
- INVALID 7 NaN - producing operation
- EDOM 33 Unix domain error code
- ERANGE 34 Unix range error code
-
- The order of appearance of the following messages is bound to the
- error codes defined above. */
-
-#define NMSGS 8
-static char *ermsg[NMSGS] =
-{
- "unknown", /* error code 0 */
- "domain", /* error code 1 */
- "singularity", /* et seq. */
- "overflow",
- "underflow",
- "total loss of precision",
- "partial loss of precision",
- "invalid operation"
-};
-
-int merror = 0;
-extern int merror;
-
-static void
-mtherr (name, code)
- char *name;
- int code;
-{
- char errstr[80];
-
- /* The string passed by the calling program is supposed to be the
- name of the function in which the error occurred.
- The code argument selects which error message string will be printed. */
-
- if ((code <= 0) || (code >= NMSGS))
- code = 0;
- sprintf (errstr, " %s %s error", name, ermsg[code]);
- if (extra_warnings)
- warning (errstr);
- /* Set global error message word */
- merror = code + 1;
-}
-
-#ifdef DEC
-/* Convert DEC double precision D to e type E. */
-
-static void
-dectoe (d, e)
- unsigned EMUSHORT *d;
- unsigned EMUSHORT *e;
-{
- unsigned EMUSHORT y[NI];
- register unsigned EMUSHORT r, *p;
-
- ecleaz (y); /* start with a zero */
- p = y; /* point to our number */
- r = *d; /* get DEC exponent word */
- if (*d & (unsigned int) 0x8000)
- *p = 0xffff; /* fill in our sign */
- ++p; /* bump pointer to our exponent word */
- r &= 0x7fff; /* strip the sign bit */
- if (r == 0) /* answer = 0 if high order DEC word = 0 */
- goto done;
-
-
- r >>= 7; /* shift exponent word down 7 bits */
- r += EXONE - 0201; /* subtract DEC exponent offset */
- /* add our e type exponent offset */
- *p++ = r; /* to form our exponent */
-
- r = *d++; /* now do the high order mantissa */
- r &= 0177; /* strip off the DEC exponent and sign bits */
- r |= 0200; /* the DEC understood high order mantissa bit */
- *p++ = r; /* put result in our high guard word */
-
- *p++ = *d++; /* fill in the rest of our mantissa */
- *p++ = *d++;
- *p = *d;
-
- eshdn8 (y); /* shift our mantissa down 8 bits */
- done:
- emovo (y, e);
-}
-
-/* Convert e type X to DEC double precision D. */
-
-static void
-etodec (x, d)
- unsigned EMUSHORT *x, *d;
-{
- unsigned EMUSHORT xi[NI];
- EMULONG exp;
- int rndsav;
-
- emovi (x, xi);
- /* Adjust exponent for offsets. */
- exp = (EMULONG) xi[E] - (EXONE - 0201);
- /* Round off to nearest or even. */
- rndsav = rndprc;
- rndprc = 56;
- emdnorm (xi, 0, 0, exp, 64);
- rndprc = rndsav;
- todec (xi, d);
-}
-
-/* Convert exploded e-type X, that has already been rounded to
- 56-bit precision, to DEC format double Y. */
-
-static void
-todec (x, y)
- unsigned EMUSHORT *x, *y;
-{
- unsigned EMUSHORT i;
- unsigned EMUSHORT *p;
-
- p = x;
- *y = 0;
- if (*p++)
- *y = 0100000;
- i = *p++;
- if (i == 0)
- {
- *y++ = 0;
- *y++ = 0;
- *y++ = 0;
- *y++ = 0;
- return;
- }
- if (i > 0377)
- {
- *y++ |= 077777;
- *y++ = 0xffff;
- *y++ = 0xffff;
- *y++ = 0xffff;
-#ifdef ERANGE
- errno = ERANGE;
-#endif
- return;
- }
- i &= 0377;
- i <<= 7;
- eshup8 (x);
- x[M] &= 0177;
- i |= x[M];
- *y++ |= i;
- *y++ = x[M + 1];
- *y++ = x[M + 2];
- *y++ = x[M + 3];
-}
-#endif /* DEC */
-
-#ifdef IBM
-/* Convert IBM single/double precision to e type. */
-
-static void
-ibmtoe (d, e, mode)
- unsigned EMUSHORT *d;
- unsigned EMUSHORT *e;
- enum machine_mode mode;
-{
- unsigned EMUSHORT y[NI];
- register unsigned EMUSHORT r, *p;
- int rndsav;
-
- ecleaz (y); /* start with a zero */
- p = y; /* point to our number */
- r = *d; /* get IBM exponent word */
- if (*d & (unsigned int) 0x8000)
- *p = 0xffff; /* fill in our sign */
- ++p; /* bump pointer to our exponent word */
- r &= 0x7f00; /* strip the sign bit */
- r >>= 6; /* shift exponent word down 6 bits */
- /* in fact shift by 8 right and 2 left */
- r += EXONE - (0x41 << 2); /* subtract IBM exponent offset */
- /* add our e type exponent offset */
- *p++ = r; /* to form our exponent */
-
- *p++ = *d++ & 0xff; /* now do the high order mantissa */
- /* strip off the IBM exponent and sign bits */
- if (mode != SFmode) /* there are only 2 words in SFmode */
- {
- *p++ = *d++; /* fill in the rest of our mantissa */
- *p++ = *d++;
- }
- *p = *d;
-
- if (y[M] == 0 && y[M+1] == 0 && y[M+2] == 0 && y[M+3] == 0)
- y[0] = y[E] = 0;
- else
- y[E] -= 5 + enormlz (y); /* now normalise the mantissa */
- /* handle change in RADIX */
- emovo (y, e);
-}
-
-
-
-/* Convert e type to IBM single/double precision. */
-
-static void
-etoibm (x, d, mode)
- unsigned EMUSHORT *x, *d;
- enum machine_mode mode;
-{
- unsigned EMUSHORT xi[NI];
- EMULONG exp;
- int rndsav;
-
- emovi (x, xi);
- exp = (EMULONG) xi[E] - (EXONE - (0x41 << 2)); /* adjust exponent for offsets */
- /* round off to nearest or even */
- rndsav = rndprc;
- rndprc = 56;
- emdnorm (xi, 0, 0, exp, 64);
- rndprc = rndsav;
- toibm (xi, d, mode);
-}
-
-static void
-toibm (x, y, mode)
- unsigned EMUSHORT *x, *y;
- enum machine_mode mode;
-{
- unsigned EMUSHORT i;
- unsigned EMUSHORT *p;
- int r;
-
- p = x;
- *y = 0;
- if (*p++)
- *y = 0x8000;
- i = *p++;
- if (i == 0)
- {
- *y++ = 0;
- *y++ = 0;
- if (mode != SFmode)
- {
- *y++ = 0;
- *y++ = 0;
- }
- return;
- }
- r = i & 0x3;
- i >>= 2;
- if (i > 0x7f)
- {
- *y++ |= 0x7fff;
- *y++ = 0xffff;
- if (mode != SFmode)
- {
- *y++ = 0xffff;
- *y++ = 0xffff;
- }
-#ifdef ERANGE
- errno = ERANGE;
-#endif
- return;
- }
- i &= 0x7f;
- *y |= (i << 8);
- eshift (x, r + 5);
- *y++ |= x[M];
- *y++ = x[M + 1];
- if (mode != SFmode)
- {
- *y++ = x[M + 2];
- *y++ = x[M + 3];
- }
-}
-#endif /* IBM */
-
-/* Output a binary NaN bit pattern in the target machine's format. */
-
-/* If special NaN bit patterns are required, define them in tm.h
- as arrays of unsigned 16-bit shorts. Otherwise, use the default
- patterns here. */
-#ifdef TFMODE_NAN
-TFMODE_NAN;
-#else
-#ifdef IEEE
-unsigned EMUSHORT TFbignan[8] =
- {0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
-unsigned EMUSHORT TFlittlenan[8] = {0, 0, 0, 0, 0, 0, 0x8000, 0xffff};
-#endif
-#endif
-
-#ifdef XFMODE_NAN
-XFMODE_NAN;
-#else
-#ifdef IEEE
-unsigned EMUSHORT XFbignan[6] =
- {0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
-unsigned EMUSHORT XFlittlenan[6] = {0, 0, 0, 0xc000, 0xffff, 0};
-#endif
-#endif
-
-#ifdef DFMODE_NAN
-DFMODE_NAN;
-#else
-#ifdef IEEE
-unsigned EMUSHORT DFbignan[4] = {0x7fff, 0xffff, 0xffff, 0xffff};
-unsigned EMUSHORT DFlittlenan[4] = {0, 0, 0, 0xfff8};
-#endif
-#endif
-
-#ifdef SFMODE_NAN
-SFMODE_NAN;
-#else
-#ifdef IEEE
-unsigned EMUSHORT SFbignan[2] = {0x7fff, 0xffff};
-unsigned EMUSHORT SFlittlenan[2] = {0, 0xffc0};
-#endif
-#endif
-
-
-static void
-make_nan (nan, sign, mode)
- unsigned EMUSHORT *nan;
- int sign;
- enum machine_mode mode;
-{
- int n;
- unsigned EMUSHORT *p;
-
- switch (mode)
- {
-/* Possibly the `reserved operand' patterns on a VAX can be
- used like NaN's, but probably not in the same way as IEEE. */
-#if !defined(DEC) && !defined(IBM)
- case TFmode:
- n = 8;
- if (REAL_WORDS_BIG_ENDIAN)
- p = TFbignan;
- else
- p = TFlittlenan;
- break;
- case XFmode:
- n = 6;
- if (REAL_WORDS_BIG_ENDIAN)
- p = XFbignan;
- else
- p = XFlittlenan;
- break;
- case DFmode:
- n = 4;
- if (REAL_WORDS_BIG_ENDIAN)
- p = DFbignan;
- else
- p = DFlittlenan;
- break;
- case HFmode:
- case SFmode:
- n = 2;
- if (REAL_WORDS_BIG_ENDIAN)
- p = SFbignan;
- else
- p = SFlittlenan;
- break;
-#endif
- default:
- abort ();
- }
- if (REAL_WORDS_BIG_ENDIAN)
- *nan++ = (sign << 15) | *p++;
- while (--n != 0)
- *nan++ = *p++;
- if (! REAL_WORDS_BIG_ENDIAN)
- *nan = (sign << 15) | *p;
-}
-
-/* Convert an SFmode target `float' value to a REAL_VALUE_TYPE.
- This is the inverse of the function `etarsingle' invoked by
- REAL_VALUE_TO_TARGET_SINGLE. */
-
-REAL_VALUE_TYPE
-ereal_from_float (f)
- HOST_WIDE_INT f;
-{
- REAL_VALUE_TYPE r;
- unsigned EMUSHORT s[2];
- unsigned EMUSHORT e[NE];
-
- /* Convert 32 bit integer to array of 16 bit pieces in target machine order.
- This is the inverse operation to what the function `endian' does. */
- if (REAL_WORDS_BIG_ENDIAN)
- {
- s[0] = (unsigned EMUSHORT) (f >> 16);
- s[1] = (unsigned EMUSHORT) f;
- }
- else
- {
- s[0] = (unsigned EMUSHORT) f;
- s[1] = (unsigned EMUSHORT) (f >> 16);
- }
- /* Convert and promote the target float to E-type. */
- e24toe (s, e);
- /* Output E-type to REAL_VALUE_TYPE. */
- PUT_REAL (e, &r);
- return r;
-}
-
-
-/* Convert a DFmode target `double' value to a REAL_VALUE_TYPE.
- This is the inverse of the function `etardouble' invoked by
- REAL_VALUE_TO_TARGET_DOUBLE.
-
- The DFmode is stored as an array of HOST_WIDE_INT in the target's
- data format, with no holes in the bit packing. The first element
- of the input array holds the bits that would come first in the
- target computer's memory. */
-
-REAL_VALUE_TYPE
-ereal_from_double (d)
- HOST_WIDE_INT d[];
-{
- REAL_VALUE_TYPE r;
- unsigned EMUSHORT s[4];
- unsigned EMUSHORT e[NE];
-
- /* Convert array of HOST_WIDE_INT to equivalent array of 16-bit pieces. */
- if (REAL_WORDS_BIG_ENDIAN)
- {
- s[0] = (unsigned EMUSHORT) (d[0] >> 16);
- s[1] = (unsigned EMUSHORT) d[0];
-#if HOST_BITS_PER_WIDE_INT == 32
- s[2] = (unsigned EMUSHORT) (d[1] >> 16);
- s[3] = (unsigned EMUSHORT) d[1];
-#else
- /* In this case the entire target double is contained in the
- first array element. The second element of the input is
- ignored. */
- s[2] = (unsigned EMUSHORT) (d[0] >> 48);
- s[3] = (unsigned EMUSHORT) (d[0] >> 32);
-#endif
- }
- else
- {
- /* Target float words are little-endian. */
- s[0] = (unsigned EMUSHORT) d[0];
- s[1] = (unsigned EMUSHORT) (d[0] >> 16);
-#if HOST_BITS_PER_WIDE_INT == 32
- s[2] = (unsigned EMUSHORT) d[1];
- s[3] = (unsigned EMUSHORT) (d[1] >> 16);
-#else
- s[2] = (unsigned EMUSHORT) (d[0] >> 32);
- s[3] = (unsigned EMUSHORT) (d[0] >> 48);
-#endif
- }
- /* Convert target double to E-type. */
- e53toe (s, e);
- /* Output E-type to REAL_VALUE_TYPE. */
- PUT_REAL (e, &r);
- return r;
-}
-
-
-/* Convert target computer unsigned 64-bit integer to e-type.
- The endian-ness of DImode follows the convention for integers,
- so we use WORDS_BIG_ENDIAN here, not REAL_WORDS_BIG_ENDIAN. */
-
-static void
-uditoe (di, e)
- unsigned EMUSHORT *di; /* Address of the 64-bit int. */
- unsigned EMUSHORT *e;
-{
- unsigned EMUSHORT yi[NI];
- int k;
-
- ecleaz (yi);
- if (WORDS_BIG_ENDIAN)
- {
- for (k = M; k < M + 4; k++)
- yi[k] = *di++;
- }
- else
- {
- for (k = M + 3; k >= M; k--)
- yi[k] = *di++;
- }
- yi[E] = EXONE + 47; /* exponent if normalize shift count were 0 */
- if ((k = enormlz (yi)) > NBITS)/* normalize the significand */
- ecleaz (yi); /* it was zero */
- else
- yi[E] -= (unsigned EMUSHORT) k;/* subtract shift count from exponent */
- emovo (yi, e);
-}
-
-/* Convert target computer signed 64-bit integer to e-type. */
-
-static void
-ditoe (di, e)
- unsigned EMUSHORT *di; /* Address of the 64-bit int. */
- unsigned EMUSHORT *e;
-{
- unsigned EMULONG acc;
- unsigned EMUSHORT yi[NI];
- unsigned EMUSHORT carry;
- int k, sign;
-
- ecleaz (yi);
- if (WORDS_BIG_ENDIAN)
- {
- for (k = M; k < M + 4; k++)
- yi[k] = *di++;
- }
- else
- {
- for (k = M + 3; k >= M; k--)
- yi[k] = *di++;
- }
- /* Take absolute value */
- sign = 0;
- if (yi[M] & 0x8000)
- {
- sign = 1;
- carry = 0;
- for (k = M + 3; k >= M; k--)
- {
- acc = (unsigned EMULONG) (~yi[k] & 0xffff) + carry;
- yi[k] = acc;
- carry = 0;
- if (acc & 0x10000)
- carry = 1;
- }
- }
- yi[E] = EXONE + 47; /* exponent if normalize shift count were 0 */
- if ((k = enormlz (yi)) > NBITS)/* normalize the significand */
- ecleaz (yi); /* it was zero */
- else
- yi[E] -= (unsigned EMUSHORT) k;/* subtract shift count from exponent */
- emovo (yi, e);
- if (sign)
- eneg (e);
-}
-
-
-/* Convert e-type to unsigned 64-bit int. */
-
-static void
-etoudi (x, i)
- unsigned EMUSHORT *x;
- unsigned EMUSHORT *i;
-{
- unsigned EMUSHORT xi[NI];
- int j, k;
-
- emovi (x, xi);
- if (xi[0])
- {
- xi[M] = 0;
- goto noshift;
- }
- k = (int) xi[E] - (EXONE - 1);
- if (k <= 0)
- {
- for (j = 0; j < 4; j++)
- *i++ = 0;
- return;
- }
- if (k > 64)
- {
- for (j = 0; j < 4; j++)
- *i++ = 0xffff;
- if (extra_warnings)
- warning ("overflow on truncation to integer");
- return;
- }
- if (k > 16)
- {
- /* Shift more than 16 bits: first shift up k-16 mod 16,
- then shift up by 16's. */
- j = k - ((k >> 4) << 4);
- if (j == 0)
- j = 16;
- eshift (xi, j);
- if (WORDS_BIG_ENDIAN)
- *i++ = xi[M];
- else
- {
- i += 3;
- *i-- = xi[M];
- }
- k -= j;
- do
- {
- eshup6 (xi);
- if (WORDS_BIG_ENDIAN)
- *i++ = xi[M];
- else
- *i-- = xi[M];
- }
- while ((k -= 16) > 0);
- }
- else
- {
- /* shift not more than 16 bits */
- eshift (xi, k);
-
-noshift:
-
- if (WORDS_BIG_ENDIAN)
- {
- i += 3;
- *i-- = xi[M];
- *i-- = 0;
- *i-- = 0;
- *i = 0;
- }
- else
- {
- *i++ = xi[M];
- *i++ = 0;
- *i++ = 0;
- *i = 0;
- }
- }
-}
-
-
-/* Convert e-type to signed 64-bit int. */
-
-static void
-etodi (x, i)
- unsigned EMUSHORT *x;
- unsigned EMUSHORT *i;
-{
- unsigned EMULONG acc;
- unsigned EMUSHORT xi[NI];
- unsigned EMUSHORT carry;
- unsigned EMUSHORT *isave;
- int j, k;
-
- emovi (x, xi);
- k = (int) xi[E] - (EXONE - 1);
- if (k <= 0)
- {
- for (j = 0; j < 4; j++)
- *i++ = 0;
- return;
- }
- if (k > 64)
- {
- for (j = 0; j < 4; j++)
- *i++ = 0xffff;
- if (extra_warnings)
- warning ("overflow on truncation to integer");
- return;
- }
- isave = i;
- if (k > 16)
- {
- /* Shift more than 16 bits: first shift up k-16 mod 16,
- then shift up by 16's. */
- j = k - ((k >> 4) << 4);
- if (j == 0)
- j = 16;
- eshift (xi, j);
- if (WORDS_BIG_ENDIAN)
- *i++ = xi[M];
- else
- {
- i += 3;
- *i-- = xi[M];
- }
- k -= j;
- do
- {
- eshup6 (xi);
- if (WORDS_BIG_ENDIAN)
- *i++ = xi[M];
- else
- *i-- = xi[M];
- }
- while ((k -= 16) > 0);
- }
- else
- {
- /* shift not more than 16 bits */
- eshift (xi, k);
-
- if (WORDS_BIG_ENDIAN)
- {
- i += 3;
- *i = xi[M];
- *i-- = 0;
- *i-- = 0;
- *i = 0;
- }
- else
- {
- *i++ = xi[M];
- *i++ = 0;
- *i++ = 0;
- *i = 0;
- }
- }
- /* Negate if negative */
- if (xi[0])
- {
- carry = 0;
- if (WORDS_BIG_ENDIAN)
- isave += 3;
- for (k = 0; k < 4; k++)
- {
- acc = (unsigned EMULONG) (~(*isave) & 0xffff) + carry;
- if (WORDS_BIG_ENDIAN)
- *isave-- = acc;
- else
- *isave++ = acc;
- carry = 0;
- if (acc & 0x10000)
- carry = 1;
- }
- }
-}
-
-
-/* Longhand square root routine. */
-
-
-static int esqinited = 0;
-static unsigned short sqrndbit[NI];
-
-static void
-esqrt (x, y)
- unsigned EMUSHORT *x, *y;
-{
- unsigned EMUSHORT temp[NI], num[NI], sq[NI], xx[NI];
- EMULONG m, exp;
- int i, j, k, n, nlups;
-
- if (esqinited == 0)
- {
- ecleaz (sqrndbit);
- sqrndbit[NI - 2] = 1;
- esqinited = 1;
- }
- /* Check for arg <= 0 */
- i = ecmp (x, ezero);
- if (i <= 0)
- {
- if (i == -1)
- {
- mtherr ("esqrt", DOMAIN);
- eclear (y);
- }
- else
- emov (x, y);
- return;
- }
-
-#ifdef INFINITY
- if (eisinf (x))
- {
- eclear (y);
- einfin (y);
- return;
- }
-#endif
- /* Bring in the arg and renormalize if it is denormal. */
- emovi (x, xx);
- m = (EMULONG) xx[1]; /* local long word exponent */
- if (m == 0)
- m -= enormlz (xx);
-
- /* Divide exponent by 2 */
- m -= 0x3ffe;
- exp = (unsigned short) ((m / 2) + 0x3ffe);
-
- /* Adjust if exponent odd */
- if ((m & 1) != 0)
- {
- if (m > 0)
- exp += 1;
- eshdn1 (xx);
- }
-
- ecleaz (sq);
- ecleaz (num);
- n = 8; /* get 8 bits of result per inner loop */
- nlups = rndprc;
- j = 0;
-
- while (nlups > 0)
- {
- /* bring in next word of arg */
- if (j < NE)
- num[NI - 1] = xx[j + 3];
- /* Do additional bit on last outer loop, for roundoff. */
- if (nlups <= 8)
- n = nlups + 1;
- for (i = 0; i < n; i++)
- {
- /* Next 2 bits of arg */
- eshup1 (num);
- eshup1 (num);
- /* Shift up answer */
- eshup1 (sq);
- /* Make trial divisor */
- for (k = 0; k < NI; k++)
- temp[k] = sq[k];
- eshup1 (temp);
- eaddm (sqrndbit, temp);
- /* Subtract and insert answer bit if it goes in */
- if (ecmpm (temp, num) <= 0)
- {
- esubm (temp, num);
- sq[NI - 2] |= 1;
- }
- }
- nlups -= n;
- j += 1;
- }
-
- /* Adjust for extra, roundoff loop done. */
- exp += (NBITS - 1) - rndprc;
-
- /* Sticky bit = 1 if the remainder is nonzero. */
- k = 0;
- for (i = 3; i < NI; i++)
- k |= (int) num[i];
-
- /* Renormalize and round off. */
- emdnorm (sq, k, 0, exp, 64);
- emovo (sq, y);
-}
-#endif /* EMU_NON_COMPILE not defined */
-
-/* Return the binary precision of the significand for a given
- floating point mode. The mode can hold an integer value
- that many bits wide, without losing any bits. */
-
-int
-significand_size (mode)
- enum machine_mode mode;
-{
-
-/* Don't test the modes, but their sizes, lest this
- code won't work for BITS_PER_UNIT != 8 . */
-
-switch (GET_MODE_BITSIZE (mode))
- {
- case 32:
- return 24;
-
- case 64:
-#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
- return 53;
-#else
-#if TARGET_FLOAT_FORMAT == IBM_FLOAT_FORMAT
- return 56;
-#else
-#if TARGET_FLOAT_FORMAT == VAX_FLOAT_FORMAT
- return 56;
-#else
- abort ();
-#endif
-#endif
-#endif
-
- case 96:
- return 64;
- case 128:
- return 113;
-
- default:
- abort ();
- }
-}
diff --git a/gcc/real.h b/gcc/real.h
deleted file mode 100644
index c57ccc1cff3..00000000000
--- a/gcc/real.h
+++ /dev/null
@@ -1,444 +0,0 @@
-/* Front-end tree definitions for GNU compiler.
- Copyright (C) 1989, 1991, 1994, 1996 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. */
-
-#ifndef REAL_H_INCLUDED
-#define REAL_H_INCLUDED
-
-/* Define codes for all the float formats that we know of. */
-#define UNKNOWN_FLOAT_FORMAT 0
-#define IEEE_FLOAT_FORMAT 1
-#define VAX_FLOAT_FORMAT 2
-#define IBM_FLOAT_FORMAT 3
-
-/* Default to IEEE float if not specified. Nearly all machines use it. */
-
-#ifndef TARGET_FLOAT_FORMAT
-#define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-#endif
-
-#ifndef HOST_FLOAT_FORMAT
-#define HOST_FLOAT_FORMAT IEEE_FLOAT_FORMAT
-#endif
-
-#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
-#define REAL_INFINITY
-#endif
-
-/* If FLOAT_WORDS_BIG_ENDIAN and HOST_FLOAT_WORDS_BIG_ENDIAN are not defined
- in the header files, then this implies the word-endianness is the same as
- for integers. */
-
-/* This is defined 0 or 1, like WORDS_BIG_ENDIAN. */
-#ifndef FLOAT_WORDS_BIG_ENDIAN
-#define FLOAT_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
-#endif
-
-/* This is defined 0 or 1, unlike HOST_WORDS_BIG_ENDIAN. */
-#ifndef HOST_FLOAT_WORDS_BIG_ENDIAN
-#ifdef HOST_WORDS_BIG_ENDIAN
-#define HOST_FLOAT_WORDS_BIG_ENDIAN 1
-#else
-#define HOST_FLOAT_WORDS_BIG_ENDIAN 0
-#endif
-#endif
-
-/* Defining REAL_ARITHMETIC invokes a floating point emulator
- that can produce a target machine format differing by more
- than just endian-ness from the host's format. The emulator
- is also used to support extended real XFmode. */
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-#endif
-#if (LONG_DOUBLE_TYPE_SIZE == 96) || (LONG_DOUBLE_TYPE_SIZE == 128)
-#ifndef REAL_ARITHMETIC
-#define REAL_ARITHMETIC
-#endif
-#endif
-#ifdef REAL_ARITHMETIC
-/* **** Start of software floating point emulator interface macros **** */
-
-/* Support 80-bit extended real XFmode if LONG_DOUBLE_TYPE_SIZE
- has been defined to be 96 in the tm.h machine file. */
-#if (LONG_DOUBLE_TYPE_SIZE == 96)
-#define REAL_IS_NOT_DOUBLE
-#define REAL_ARITHMETIC
-typedef struct {
- HOST_WIDE_INT r[(11 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))];
-} realvaluetype;
-#define REAL_VALUE_TYPE realvaluetype
-
-#else /* no XFmode support */
-
-#if (LONG_DOUBLE_TYPE_SIZE == 128)
-
-#define REAL_IS_NOT_DOUBLE
-#define REAL_ARITHMETIC
-typedef struct {
- HOST_WIDE_INT r[(19 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))];
-} realvaluetype;
-#define REAL_VALUE_TYPE realvaluetype
-
-#else /* not TFmode */
-
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
-/* If no XFmode support, then a REAL_VALUE_TYPE is 64 bits wide
- but it is not necessarily a host machine double. */
-#define REAL_IS_NOT_DOUBLE
-typedef struct {
- HOST_WIDE_INT r[(7 + sizeof (HOST_WIDE_INT))/(sizeof (HOST_WIDE_INT))];
-} realvaluetype;
-#define REAL_VALUE_TYPE realvaluetype
-#else
-/* If host and target formats are compatible, then a REAL_VALUE_TYPE
- is actually a host machine double. */
-#define REAL_VALUE_TYPE double
-#endif
-
-#endif /* no TFmode support */
-#endif /* no XFmode support */
-
-extern int significand_size PROTO((enum machine_mode));
-
-/* If emulation has been enabled by defining REAL_ARITHMETIC or by
- setting LONG_DOUBLE_TYPE_SIZE to 96 or 128, then define macros so that
- they invoke emulator functions. This will succeed only if the machine
- files have been updated to use these macros in place of any
- references to host machine `double' or `float' types. */
-#ifdef REAL_ARITHMETIC
-#undef REAL_ARITHMETIC
-#define REAL_ARITHMETIC(value, code, d1, d2) \
- earith (&(value), (code), &(d1), &(d2))
-
-/* Declare functions in real.c. */
-extern void earith PROTO((REAL_VALUE_TYPE *, int,
- REAL_VALUE_TYPE *, REAL_VALUE_TYPE *));
-extern REAL_VALUE_TYPE etrunci PROTO((REAL_VALUE_TYPE));
-extern REAL_VALUE_TYPE etruncui PROTO((REAL_VALUE_TYPE));
-extern REAL_VALUE_TYPE ereal_atof PROTO((char *, enum machine_mode));
-extern REAL_VALUE_TYPE ereal_negate PROTO((REAL_VALUE_TYPE));
-extern HOST_WIDE_INT efixi PROTO((REAL_VALUE_TYPE));
-extern unsigned HOST_WIDE_INT efixui PROTO((REAL_VALUE_TYPE));
-extern void ereal_from_int PROTO((REAL_VALUE_TYPE *,
- HOST_WIDE_INT, HOST_WIDE_INT,
- enum machine_mode));
-extern void ereal_from_uint PROTO((REAL_VALUE_TYPE *,
- unsigned HOST_WIDE_INT,
- unsigned HOST_WIDE_INT,
- enum machine_mode));
-extern void ereal_to_int PROTO((HOST_WIDE_INT *, HOST_WIDE_INT *,
- REAL_VALUE_TYPE));
-extern REAL_VALUE_TYPE ereal_ldexp PROTO((REAL_VALUE_TYPE, int));
-
-extern void etartdouble PROTO((REAL_VALUE_TYPE, long *));
-extern void etarldouble PROTO((REAL_VALUE_TYPE, long *));
-extern void etardouble PROTO((REAL_VALUE_TYPE, long *));
-extern long etarsingle PROTO((REAL_VALUE_TYPE));
-extern void ereal_to_decimal PROTO((REAL_VALUE_TYPE, char *));
-extern int ereal_cmp PROTO((REAL_VALUE_TYPE, REAL_VALUE_TYPE));
-extern int ereal_isneg PROTO((REAL_VALUE_TYPE));
-extern REAL_VALUE_TYPE ereal_from_float PROTO((HOST_WIDE_INT));
-extern REAL_VALUE_TYPE ereal_from_double PROTO((HOST_WIDE_INT *));
-
-#define REAL_VALUES_EQUAL(x, y) (ereal_cmp ((x), (y)) == 0)
-/* true if x < y : */
-#define REAL_VALUES_LESS(x, y) (ereal_cmp ((x), (y)) == -1)
-#define REAL_VALUE_LDEXP(x, n) ereal_ldexp (x, n)
-
-/* These return REAL_VALUE_TYPE: */
-#define REAL_VALUE_RNDZINT(x) (etrunci (x))
-#define REAL_VALUE_UNSIGNED_RNDZINT(x) (etruncui (x))
-extern REAL_VALUE_TYPE real_value_truncate ();
-#define REAL_VALUE_TRUNCATE(mode, x) real_value_truncate (mode, x)
-
-/* These return HOST_WIDE_INT: */
-/* Convert a floating-point value to integer, rounding toward zero. */
-#define REAL_VALUE_FIX(x) (efixi (x))
-/* Convert a floating-point value to unsigned integer, rounding
- toward zero. */
-#define REAL_VALUE_UNSIGNED_FIX(x) (efixui (x))
-
-#define REAL_VALUE_ATOF ereal_atof
-#define REAL_VALUE_NEGATE ereal_negate
-
-#define REAL_VALUE_MINUS_ZERO(x) \
- ((ereal_cmp (x, dconst0) == 0) && (ereal_isneg (x) != 0 ))
-
-#define REAL_VALUE_TO_INT ereal_to_int
-
-/* Here the cast to HOST_WIDE_INT sign-extends arguments such as ~0. */
-#define REAL_VALUE_FROM_INT(d, lo, hi, mode) \
- ereal_from_int (&d, (HOST_WIDE_INT) (lo), (HOST_WIDE_INT) (hi), mode)
-
-#define REAL_VALUE_FROM_UNSIGNED_INT(d, lo, hi, mode) \
- ereal_from_uint (&d, lo, hi, mode)
-
-/* IN is a REAL_VALUE_TYPE. OUT is an array of longs. */
-#if LONG_DOUBLE_TYPE_SIZE == 96
-#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT) (etarldouble ((IN), (OUT)))
-#else
-#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT) (etartdouble ((IN), (OUT)))
-#endif
-#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) (etardouble ((IN), (OUT)))
-
-/* IN is a REAL_VALUE_TYPE. OUT is a long. */
-#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) ((OUT) = etarsingle ((IN)))
-
-/* d is an array of HOST_WIDE_INT that holds a double precision
- value in the target computer's floating point format. */
-#define REAL_VALUE_FROM_TARGET_DOUBLE(d) (ereal_from_double (d))
-
-/* f is a HOST_WIDE_INT containing a single precision target float value. */
-#define REAL_VALUE_FROM_TARGET_SINGLE(f) (ereal_from_float (f))
-
-/* Conversions to decimal ASCII string. */
-#define REAL_VALUE_TO_DECIMAL(r, fmt, s) (ereal_to_decimal (r, s))
-
-#endif /* REAL_ARITHMETIC defined */
-
-/* **** End of software floating point emulator interface macros **** */
-#else /* No XFmode or TFmode and REAL_ARITHMETIC not defined */
-
-/* old interface */
-#ifdef REAL_ARITHMETIC
-/* Defining REAL_IS_NOT_DOUBLE breaks certain initializations
- when REAL_ARITHMETIC etc. are not defined. */
-
-/* Now see if the host and target machines use the same format.
- If not, define REAL_IS_NOT_DOUBLE (even if we end up representing
- reals as doubles because we have no better way in this cross compiler.)
- This turns off various optimizations that can happen when we know the
- compiler's float format matches the target's float format.
- */
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
-#define REAL_IS_NOT_DOUBLE
-#ifndef REAL_VALUE_TYPE
-typedef struct {
- HOST_WIDE_INT r[sizeof (double)/sizeof (HOST_WIDE_INT)];
- } realvaluetype;
-#define REAL_VALUE_TYPE realvaluetype
-#endif /* no REAL_VALUE_TYPE */
-#endif /* formats differ */
-#endif /* 0 */
-
-#endif /* emulator not used */
-
-/* If we are not cross-compiling, use a `double' to represent the
- floating-point value. Otherwise, use some other type
- (probably a struct containing an array of longs). */
-#ifndef REAL_VALUE_TYPE
-#define REAL_VALUE_TYPE double
-#else
-#define REAL_IS_NOT_DOUBLE
-#endif
-
-#if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
-
-/* Convert a type `double' value in host format first to a type `float'
- value in host format and then to a single type `long' value which
- is the bitwise equivalent of the `float' value. */
-#ifndef REAL_VALUE_TO_TARGET_SINGLE
-#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \
-do { float f = (float) (IN); \
- (OUT) = *(long *) &f; \
- } while (0)
-#endif
-
-/* Convert a type `double' value in host format to a pair of type `long'
- values which is its bitwise equivalent, but put the two words into
- proper word order for the target. */
-#ifndef REAL_VALUE_TO_TARGET_DOUBLE
-#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \
-do { REAL_VALUE_TYPE in = (IN); /* Make sure it's not in a register. */\
- if (HOST_FLOAT_WORDS_BIG_ENDIAN == FLOAT_WORDS_BIG_ENDIAN) \
- { \
- (OUT)[0] = ((long *) &in)[0]; \
- (OUT)[1] = ((long *) &in)[1]; \
- } \
- else \
- { \
- (OUT)[1] = ((long *) &in)[0]; \
- (OUT)[0] = ((long *) &in)[1]; \
- } \
- } while (0)
-#endif
-#endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
-
-/* In this configuration, double and long double are the same. */
-#ifndef REAL_VALUE_TO_TARGET_LONG_DOUBLE
-#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(a, b) REAL_VALUE_TO_TARGET_DOUBLE (a, b)
-#endif
-
-/* Compare two floating-point values for equality. */
-#ifndef REAL_VALUES_EQUAL
-#define REAL_VALUES_EQUAL(x, y) ((x) == (y))
-#endif
-
-/* Compare two floating-point values for less than. */
-#ifndef REAL_VALUES_LESS
-#define REAL_VALUES_LESS(x, y) ((x) < (y))
-#endif
-
-/* Truncate toward zero to an integer floating-point value. */
-#ifndef REAL_VALUE_RNDZINT
-#define REAL_VALUE_RNDZINT(x) ((double) ((int) (x)))
-#endif
-
-/* Truncate toward zero to an unsigned integer floating-point value. */
-#ifndef REAL_VALUE_UNSIGNED_RNDZINT
-#define REAL_VALUE_UNSIGNED_RNDZINT(x) ((double) ((unsigned int) (x)))
-#endif
-
-/* Convert a floating-point value to integer, rounding toward zero. */
-#ifndef REAL_VALUE_FIX
-#define REAL_VALUE_FIX(x) ((int) (x))
-#endif
-
-/* Convert a floating-point value to unsigned integer, rounding
- toward zero. */
-#ifndef REAL_VALUE_UNSIGNED_FIX
-#define REAL_VALUE_UNSIGNED_FIX(x) ((unsigned int) (x))
-#endif
-
-/* Scale X by Y powers of 2. */
-#ifndef REAL_VALUE_LDEXP
-#define REAL_VALUE_LDEXP(x, y) ldexp (x, y)
-extern double ldexp ();
-#endif
-
-/* Convert the string X to a floating-point value. */
-#ifndef REAL_VALUE_ATOF
-#if 1
-/* Use real.c to convert decimal numbers to binary, ... */
-REAL_VALUE_TYPE ereal_atof ();
-#define REAL_VALUE_ATOF(x, s) ereal_atof (x, s)
-#else
-/* ... or, if you like the host computer's atof, go ahead and use it: */
-#define REAL_VALUE_ATOF(x, s) atof (x)
-#if defined (MIPSEL) || defined (MIPSEB)
-/* MIPS compiler can't handle parens around the function name.
- This problem *does not* appear to be connected with any
- macro definition for atof. It does not seem there is one. */
-extern double atof ();
-#else
-extern double (atof) ();
-#endif
-#endif
-#endif
-
-/* Negate the floating-point value X. */
-#ifndef REAL_VALUE_NEGATE
-#define REAL_VALUE_NEGATE(x) (- (x))
-#endif
-
-/* Truncate the floating-point value X to mode MODE. This is correct only
- for the most common case where the host and target have objects of the same
- size and where `float' is SFmode. */
-
-/* Don't use REAL_VALUE_TRUNCATE directly--always call real_value_truncate. */
-extern REAL_VALUE_TYPE real_value_truncate ();
-
-#ifndef REAL_VALUE_TRUNCATE
-#define REAL_VALUE_TRUNCATE(mode, x) \
- (GET_MODE_BITSIZE (mode) == sizeof (float) * HOST_BITS_PER_CHAR \
- ? (float) (x) : (x))
-#endif
-
-/* Determine whether a floating-point value X is infinite. */
-#ifndef REAL_VALUE_ISINF
-#define REAL_VALUE_ISINF(x) (target_isinf (x))
-#endif
-
-/* Determine whether a floating-point value X is a NaN. */
-#ifndef REAL_VALUE_ISNAN
-#define REAL_VALUE_ISNAN(x) (target_isnan (x))
-#endif
-
-/* Determine whether a floating-point value X is negative. */
-#ifndef REAL_VALUE_NEGATIVE
-#define REAL_VALUE_NEGATIVE(x) (target_negative (x))
-#endif
-
-/* Determine whether a floating-point value X is minus 0. */
-#ifndef REAL_VALUE_MINUS_ZERO
-#define REAL_VALUE_MINUS_ZERO(x) ((x) == 0 && REAL_VALUE_NEGATIVE (x))
-#endif
-
-/* Constant real values 0, 1, 2, and -1. */
-
-extern REAL_VALUE_TYPE dconst0;
-extern REAL_VALUE_TYPE dconst1;
-extern REAL_VALUE_TYPE dconst2;
-extern REAL_VALUE_TYPE dconstm1;
-
-/* Union type used for extracting real values from CONST_DOUBLEs
- or putting them in. */
-
-union real_extract
-{
- REAL_VALUE_TYPE d;
- HOST_WIDE_INT i[sizeof (REAL_VALUE_TYPE) / sizeof (HOST_WIDE_INT)];
-};
-
-/* For a CONST_DOUBLE:
- The usual two ints that hold the value.
- For a DImode, that is all there are;
- and CONST_DOUBLE_LOW is the low-order word and ..._HIGH the high-order.
- For a float, the number of ints varies,
- and CONST_DOUBLE_LOW is the one that should come first *in memory*.
- So use &CONST_DOUBLE_LOW(r) as the address of an array of ints. */
-#define CONST_DOUBLE_LOW(r) XWINT (r, 2)
-#define CONST_DOUBLE_HIGH(r) XWINT (r, 3)
-
-/* Link for chain of all CONST_DOUBLEs in use in current function. */
-#define CONST_DOUBLE_CHAIN(r) XEXP (r, 1)
-/* The MEM which represents this CONST_DOUBLE's value in memory,
- or const0_rtx if no MEM has been made for it yet,
- or cc0_rtx if it is not on the chain. */
-#define CONST_DOUBLE_MEM(r) XEXP (r, 0)
-
-/* Function to return a real value (not a tree node)
- from a given integer constant. */
-REAL_VALUE_TYPE real_value_from_int_cst ();
-
-/* Given a CONST_DOUBLE in FROM, store into TO the value it represents. */
-
-#define REAL_VALUE_FROM_CONST_DOUBLE(to, from) \
-do { union real_extract u; \
- bcopy ((char *) &CONST_DOUBLE_LOW ((from)), (char *) &u, sizeof u); \
- to = u.d; } while (0)
-
-/* Return a CONST_DOUBLE with value R and mode M. */
-
-#define CONST_DOUBLE_FROM_REAL_VALUE(r, m) immed_real_const_1 (r, m)
-extern struct rtx_def *immed_real_const_1 PROTO((REAL_VALUE_TYPE,
- enum machine_mode));
-
-
-/* Convert a floating point value `r', that can be interpreted
- as a host machine float or double, to a decimal ASCII string `s'
- using printf format string `fmt'. */
-#ifndef REAL_VALUE_TO_DECIMAL
-#define REAL_VALUE_TO_DECIMAL(r, fmt, s) (sprintf (s, fmt, r))
-#endif
-
-/* Replace R by 1/R in the given machine mode, if the result is exact. */
-extern int exact_real_inverse PROTO((enum machine_mode, REAL_VALUE_TYPE *));
-
-#endif /* Not REAL_H_INCLUDED */
diff --git a/gcc/recog.c b/gcc/recog.c
deleted file mode 100644
index 3c7d14c8cea..00000000000
--- a/gcc/recog.c
+++ /dev/null
@@ -1,1994 +0,0 @@
-/* Subroutines used by or related to instruction recognition.
- Copyright (C) 1987, 88, 91-5, 1996 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. */
-
-
-#include "config.h"
-#include "rtl.h"
-#include <stdio.h>
-#include "insn-config.h"
-#include "insn-attr.h"
-#include "insn-flags.h"
-#include "insn-codes.h"
-#include "recog.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "flags.h"
-#include "real.h"
-
-#ifndef STACK_PUSH_CODE
-#ifdef STACK_GROWS_DOWNWARD
-#define STACK_PUSH_CODE PRE_DEC
-#else
-#define STACK_PUSH_CODE PRE_INC
-#endif
-#endif
-
-/* Import from final.c: */
-extern rtx alter_subreg ();
-
-int strict_memory_address_p ();
-int memory_address_p ();
-
-/* Nonzero means allow operands to be volatile.
- This should be 0 if you are generating rtl, such as if you are calling
- the functions in optabs.c and expmed.c (most of the time).
- This should be 1 if all valid insns need to be recognized,
- such as in regclass.c and final.c and reload.c.
-
- init_recog and init_recog_no_volatile are responsible for setting this. */
-
-int volatile_ok;
-
-/* On return from `constrain_operands', indicate which alternative
- was satisfied. */
-
-int which_alternative;
-
-/* Nonzero after end of reload pass.
- Set to 1 or 0 by toplev.c.
- Controls the significance of (SUBREG (MEM)). */
-
-int reload_completed;
-
-/* Initialize data used by the function `recog'.
- This must be called once in the compilation of a function
- before any insn recognition may be done in the function. */
-
-void
-init_recog_no_volatile ()
-{
- volatile_ok = 0;
-}
-
-void
-init_recog ()
-{
- volatile_ok = 1;
-}
-
-/* Try recognizing the instruction INSN,
- and return the code number that results.
- Remember the code so that repeated calls do not
- need to spend the time for actual rerecognition.
-
- This function is the normal interface to instruction recognition.
- The automatically-generated function `recog' is normally called
- through this one. (The only exception is in combine.c.) */
-
-int
-recog_memoized (insn)
- rtx insn;
-{
- if (INSN_CODE (insn) < 0)
- INSN_CODE (insn) = recog (PATTERN (insn), insn, NULL_PTR);
- return INSN_CODE (insn);
-}
-
-/* Check that X is an insn-body for an `asm' with operands
- and that the operands mentioned in it are legitimate. */
-
-int
-check_asm_operands (x)
- rtx x;
-{
- int noperands = asm_noperands (x);
- rtx *operands;
- int i;
-
- if (noperands < 0)
- return 0;
- if (noperands == 0)
- return 1;
-
- operands = (rtx *) alloca (noperands * sizeof (rtx));
- decode_asm_operands (x, operands, NULL_PTR, NULL_PTR, NULL_PTR);
-
- for (i = 0; i < noperands; i++)
- if (!general_operand (operands[i], VOIDmode))
- return 0;
-
- return 1;
-}
-
-/* Static data for the next two routines.
-
- The maximum number of changes supported is defined as the maximum
- number of operands times 5. This allows for repeated substitutions
- inside complex indexed address, or, alternatively, changes in up
- to 5 insns. */
-
-#define MAX_CHANGE_LOCS (MAX_RECOG_OPERANDS * 5)
-
-static rtx change_objects[MAX_CHANGE_LOCS];
-static int change_old_codes[MAX_CHANGE_LOCS];
-static rtx *change_locs[MAX_CHANGE_LOCS];
-static rtx change_olds[MAX_CHANGE_LOCS];
-
-static int num_changes = 0;
-
-/* Validate a proposed change to OBJECT. LOC is the location in the rtl for
- at which NEW will be placed. If OBJECT is zero, no validation is done,
- the change is simply made.
-
- Two types of objects are supported: If OBJECT is a MEM, memory_address_p
- will be called with the address and mode as parameters. If OBJECT is
- an INSN, CALL_INSN, or JUMP_INSN, the insn will be re-recognized with
- the change in place.
-
- IN_GROUP is non-zero if this is part of a group of changes that must be
- performed as a group. In that case, the changes will be stored. The
- function `apply_change_group' will validate and apply the changes.
-
- If IN_GROUP is zero, this is a single change. Try to recognize the insn
- or validate the memory reference with the change applied. If the result
- is not valid for the machine, suppress the change and return zero.
- Otherwise, perform the change and return 1. */
-
-int
-validate_change (object, loc, new, in_group)
- rtx object;
- rtx *loc;
- rtx new;
- int in_group;
-{
- rtx old = *loc;
-
- if (old == new || rtx_equal_p (old, new))
- return 1;
-
- if (num_changes >= MAX_CHANGE_LOCS
- || (in_group == 0 && num_changes != 0))
- abort ();
-
- *loc = new;
-
- /* Save the information describing this change. */
- change_objects[num_changes] = object;
- change_locs[num_changes] = loc;
- change_olds[num_changes] = old;
-
- if (object && GET_CODE (object) != MEM)
- {
- /* Set INSN_CODE to force rerecognition of insn. Save old code in
- case invalid. */
- change_old_codes[num_changes] = INSN_CODE (object);
- INSN_CODE (object) = -1;
- }
-
- num_changes++;
-
- /* If we are making a group of changes, return 1. Otherwise, validate the
- change group we made. */
-
- if (in_group)
- return 1;
- else
- return apply_change_group ();
-}
-
-/* Apply a group of changes previously issued with `validate_change'.
- Return 1 if all changes are valid, zero otherwise. */
-
-int
-apply_change_group ()
-{
- int i;
-
- /* The changes have been applied and all INSN_CODEs have been reset to force
- rerecognition.
-
- The changes are valid if we aren't given an object, or if we are
- given a MEM and it still is a valid address, or if this is in insn
- and it is recognized. In the latter case, if reload has completed,
- we also require that the operands meet the constraints for
- the insn. We do not allow modifying an ASM_OPERANDS after reload
- has completed because verifying the constraints is too difficult. */
-
- for (i = 0; i < num_changes; i++)
- {
- rtx object = change_objects[i];
-
- if (object == 0)
- continue;
-
- if (GET_CODE (object) == MEM)
- {
- if (! memory_address_p (GET_MODE (object), XEXP (object, 0)))
- break;
- }
- else if ((recog_memoized (object) < 0
- && (asm_noperands (PATTERN (object)) < 0
- || ! check_asm_operands (PATTERN (object))
- || reload_completed))
- || (reload_completed
- && (insn_extract (object),
- ! constrain_operands (INSN_CODE (object), 1))))
- {
- rtx pat = PATTERN (object);
-
- /* Perhaps we couldn't recognize the insn because there were
- extra CLOBBERs at the end. If so, try to re-recognize
- without the last CLOBBER (later iterations will cause each of
- them to be eliminated, in turn). But don't do this if we
- have an ASM_OPERAND. */
- if (GET_CODE (pat) == PARALLEL
- && GET_CODE (XVECEXP (pat, 0, XVECLEN (pat, 0) - 1)) == CLOBBER
- && asm_noperands (PATTERN (object)) < 0)
- {
- rtx newpat;
-
- if (XVECLEN (pat, 0) == 2)
- newpat = XVECEXP (pat, 0, 0);
- else
- {
- int j;
-
- newpat = gen_rtx (PARALLEL, VOIDmode,
- gen_rtvec (XVECLEN (pat, 0) - 1));
- for (j = 0; j < XVECLEN (newpat, 0); j++)
- XVECEXP (newpat, 0, j) = XVECEXP (pat, 0, j);
- }
-
- /* Add a new change to this group to replace the pattern
- with this new pattern. Then consider this change
- as having succeeded. The change we added will
- cause the entire call to fail if things remain invalid.
-
- Note that this can lose if a later change than the one
- we are processing specified &XVECEXP (PATTERN (object), 0, X)
- but this shouldn't occur. */
-
- validate_change (object, &PATTERN (object), newpat, 1);
- }
- else if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
- /* If this insn is a CLOBBER or USE, it is always valid, but is
- never recognized. */
- continue;
- else
- break;
- }
- }
-
- if (i == num_changes)
- {
- num_changes = 0;
- return 1;
- }
- else
- {
- cancel_changes (0);
- return 0;
- }
-}
-
-/* Return the number of changes so far in the current group. */
-
-int
-num_validated_changes ()
-{
- return num_changes;
-}
-
-/* Retract the changes numbered NUM and up. */
-
-void
-cancel_changes (num)
- int num;
-{
- int i;
-
- /* Back out all the changes. Do this in the opposite order in which
- they were made. */
- for (i = num_changes - 1; i >= num; i--)
- {
- *change_locs[i] = change_olds[i];
- if (change_objects[i] && GET_CODE (change_objects[i]) != MEM)
- INSN_CODE (change_objects[i]) = change_old_codes[i];
- }
- num_changes = num;
-}
-
-/* Replace every occurrence of FROM in X with TO. Mark each change with
- validate_change passing OBJECT. */
-
-static void
-validate_replace_rtx_1 (loc, from, to, object)
- rtx *loc;
- rtx from, to, object;
-{
- register int i, j;
- register char *fmt;
- register rtx x = *loc;
- enum rtx_code code = GET_CODE (x);
-
- /* X matches FROM if it is the same rtx or they are both referring to the
- same register in the same mode. Avoid calling rtx_equal_p unless the
- operands look similar. */
-
- if (x == from
- || (GET_CODE (x) == REG && GET_CODE (from) == REG
- && GET_MODE (x) == GET_MODE (from)
- && REGNO (x) == REGNO (from))
- || (GET_CODE (x) == GET_CODE (from) && GET_MODE (x) == GET_MODE (from)
- && rtx_equal_p (x, from)))
- {
- validate_change (object, loc, to, 1);
- return;
- }
-
- /* For commutative or comparison operations, try replacing each argument
- separately and seeing if we made any changes. If so, put a constant
- argument last.*/
- if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == 'c')
- {
- int prev_changes = num_changes;
-
- validate_replace_rtx_1 (&XEXP (x, 0), from, to, object);
- validate_replace_rtx_1 (&XEXP (x, 1), from, to, object);
- if (prev_changes != num_changes && CONSTANT_P (XEXP (x, 0)))
- {
- validate_change (object, loc,
- gen_rtx (GET_RTX_CLASS (code) == 'c' ? code
- : swap_condition (code),
- GET_MODE (x), XEXP (x, 1), XEXP (x, 0)),
- 1);
- x = *loc;
- code = GET_CODE (x);
- }
- }
-
- switch (code)
- {
- case PLUS:
- /* If we have have a PLUS whose second operand is now a CONST_INT, use
- plus_constant to try to simplify it. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT && XEXP (x, 1) == to)
- validate_change (object, loc,
- plus_constant (XEXP (x, 0), INTVAL (XEXP (x, 1))), 1);
- return;
-
- case ZERO_EXTEND:
- case SIGN_EXTEND:
- /* In these cases, the operation to be performed depends on the mode
- of the operand. If we are replacing the operand with a VOIDmode
- constant, we lose the information. So try to simplify the operation
- in that case. If it fails, substitute in something that we know
- won't be recognized. */
- if (GET_MODE (to) == VOIDmode
- && (XEXP (x, 0) == from
- || (GET_CODE (XEXP (x, 0)) == REG && GET_CODE (from) == REG
- && GET_MODE (XEXP (x, 0)) == GET_MODE (from)
- && REGNO (XEXP (x, 0)) == REGNO (from))))
- {
- rtx new = simplify_unary_operation (code, GET_MODE (x), to,
- GET_MODE (from));
- if (new == 0)
- new = gen_rtx (CLOBBER, GET_MODE (x), const0_rtx);
-
- validate_change (object, loc, new, 1);
- return;
- }
- break;
-
- case SUBREG:
- /* If we have a SUBREG of a register that we are replacing and we are
- replacing it with a MEM, make a new MEM and try replacing the
- SUBREG with it. Don't do this if the MEM has a mode-dependent address
- or if we would be widening it. */
-
- if (SUBREG_REG (x) == from
- && GET_CODE (from) == REG
- && GET_CODE (to) == MEM
- && ! mode_dependent_address_p (XEXP (to, 0))
- && ! MEM_VOLATILE_P (to)
- && GET_MODE_SIZE (GET_MODE (x)) <= GET_MODE_SIZE (GET_MODE (to)))
- {
- int offset = SUBREG_WORD (x) * UNITS_PER_WORD;
- enum machine_mode mode = GET_MODE (x);
- rtx new;
-
- if (BYTES_BIG_ENDIAN)
- offset += (MIN (UNITS_PER_WORD,
- GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode)));
-
- new = gen_rtx (MEM, mode, plus_constant (XEXP (to, 0), offset));
- MEM_VOLATILE_P (new) = MEM_VOLATILE_P (to);
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (to);
- MEM_IN_STRUCT_P (new) = MEM_IN_STRUCT_P (to);
- validate_change (object, loc, new, 1);
- return;
- }
- break;
-
- case ZERO_EXTRACT:
- case SIGN_EXTRACT:
- /* If we are replacing a register with memory, try to change the memory
- to be the mode required for memory in extract operations (this isn't
- likely to be an insertion operation; if it was, nothing bad will
- happen, we might just fail in some cases). */
-
- if (XEXP (x, 0) == from && GET_CODE (from) == REG && GET_CODE (to) == MEM
- && GET_CODE (XEXP (x, 1)) == CONST_INT
- && GET_CODE (XEXP (x, 2)) == CONST_INT
- && ! mode_dependent_address_p (XEXP (to, 0))
- && ! MEM_VOLATILE_P (to))
- {
- enum machine_mode wanted_mode = VOIDmode;
- enum machine_mode is_mode = GET_MODE (to);
- int width = INTVAL (XEXP (x, 1));
- int pos = INTVAL (XEXP (x, 2));
-
-#ifdef HAVE_extzv
- if (code == ZERO_EXTRACT)
- wanted_mode = insn_operand_mode[(int) CODE_FOR_extzv][1];
-#endif
-#ifdef HAVE_extv
- if (code == SIGN_EXTRACT)
- wanted_mode = insn_operand_mode[(int) CODE_FOR_extv][1];
-#endif
-
- /* If we have a narrower mode, we can do something. */
- if (wanted_mode != VOIDmode
- && GET_MODE_SIZE (wanted_mode) < GET_MODE_SIZE (is_mode))
- {
- int offset = pos / BITS_PER_UNIT;
- rtx newmem;
-
- /* If the bytes and bits are counted differently, we
- must adjust the offset. */
- if (BYTES_BIG_ENDIAN != BITS_BIG_ENDIAN)
- offset = (GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (wanted_mode)
- - offset);
-
- pos %= GET_MODE_BITSIZE (wanted_mode);
-
- newmem = gen_rtx (MEM, wanted_mode,
- plus_constant (XEXP (to, 0), offset));
- RTX_UNCHANGING_P (newmem) = RTX_UNCHANGING_P (to);
- MEM_VOLATILE_P (newmem) = MEM_VOLATILE_P (to);
- MEM_IN_STRUCT_P (newmem) = MEM_IN_STRUCT_P (to);
-
- validate_change (object, &XEXP (x, 2), GEN_INT (pos), 1);
- validate_change (object, &XEXP (x, 0), newmem, 1);
- }
- }
-
- break;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- validate_replace_rtx_1 (&XEXP (x, i), from, to, object);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- validate_replace_rtx_1 (&XVECEXP (x, i, j), from, to, object);
- }
-}
-
-/* Try replacing every occurrence of FROM in INSN with TO. After all
- changes have been made, validate by seeing if INSN is still valid. */
-
-int
-validate_replace_rtx (from, to, insn)
- rtx from, to, insn;
-{
- validate_replace_rtx_1 (&PATTERN (insn), from, to, insn);
- return apply_change_group ();
-}
-
-#ifdef HAVE_cc0
-/* Return 1 if the insn using CC0 set by INSN does not contain
- any ordered tests applied to the condition codes.
- EQ and NE tests do not count. */
-
-int
-next_insn_tests_no_inequality (insn)
- rtx insn;
-{
- register rtx next = next_cc0_user (insn);
-
- /* If there is no next insn, we have to take the conservative choice. */
- if (next == 0)
- return 0;
-
- return ((GET_CODE (next) == JUMP_INSN
- || GET_CODE (next) == INSN
- || GET_CODE (next) == CALL_INSN)
- && ! inequality_comparisons_p (PATTERN (next)));
-}
-
-#if 0 /* This is useless since the insn that sets the cc's
- must be followed immediately by the use of them. */
-/* Return 1 if the CC value set up by INSN is not used. */
-
-int
-next_insns_test_no_inequality (insn)
- rtx insn;
-{
- register rtx next = NEXT_INSN (insn);
-
- for (; next != 0; next = NEXT_INSN (next))
- {
- if (GET_CODE (next) == CODE_LABEL
- || GET_CODE (next) == BARRIER)
- return 1;
- if (GET_CODE (next) == NOTE)
- continue;
- if (inequality_comparisons_p (PATTERN (next)))
- return 0;
- if (sets_cc0_p (PATTERN (next)) == 1)
- return 1;
- if (! reg_mentioned_p (cc0_rtx, PATTERN (next)))
- return 1;
- }
- return 1;
-}
-#endif
-#endif
-
-/* This is used by find_single_use to locate an rtx that contains exactly one
- use of DEST, which is typically either a REG or CC0. It returns a
- pointer to the innermost rtx expression containing DEST. Appearances of
- DEST that are being used to totally replace it are not counted. */
-
-static rtx *
-find_single_use_1 (dest, loc)
- rtx dest;
- rtx *loc;
-{
- rtx x = *loc;
- enum rtx_code code = GET_CODE (x);
- rtx *result = 0;
- rtx *this_result;
- int i;
- char *fmt;
-
- switch (code)
- {
- case CONST_INT:
- case CONST:
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST_DOUBLE:
- case CLOBBER:
- return 0;
-
- case SET:
- /* If the destination is anything other than CC0, PC, a REG or a SUBREG
- of a REG that occupies all of the REG, the insn uses DEST if
- it is mentioned in the destination or the source. Otherwise, we
- need just check the source. */
- if (GET_CODE (SET_DEST (x)) != CC0
- && GET_CODE (SET_DEST (x)) != PC
- && GET_CODE (SET_DEST (x)) != REG
- && ! (GET_CODE (SET_DEST (x)) == SUBREG
- && GET_CODE (SUBREG_REG (SET_DEST (x))) == REG
- && (((GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (x))))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
- == ((GET_MODE_SIZE (GET_MODE (SET_DEST (x)))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD))))
- break;
-
- return find_single_use_1 (dest, &SET_SRC (x));
-
- case MEM:
- case SUBREG:
- return find_single_use_1 (dest, &XEXP (x, 0));
- }
-
- /* If it wasn't one of the common cases above, check each expression and
- vector of this code. Look for a unique usage of DEST. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- if (dest == XEXP (x, i)
- || (GET_CODE (dest) == REG && GET_CODE (XEXP (x, i)) == REG
- && REGNO (dest) == REGNO (XEXP (x, i))))
- this_result = loc;
- else
- this_result = find_single_use_1 (dest, &XEXP (x, i));
-
- if (result == 0)
- result = this_result;
- else if (this_result)
- /* Duplicate usage. */
- return 0;
- }
- else if (fmt[i] == 'E')
- {
- int j;
-
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- {
- if (XVECEXP (x, i, j) == dest
- || (GET_CODE (dest) == REG
- && GET_CODE (XVECEXP (x, i, j)) == REG
- && REGNO (XVECEXP (x, i, j)) == REGNO (dest)))
- this_result = loc;
- else
- this_result = find_single_use_1 (dest, &XVECEXP (x, i, j));
-
- if (result == 0)
- result = this_result;
- else if (this_result)
- return 0;
- }
- }
- }
-
- return result;
-}
-
-/* See if DEST, produced in INSN, is used only a single time in the
- sequel. If so, return a pointer to the innermost rtx expression in which
- it is used.
-
- If PLOC is non-zero, *PLOC is set to the insn containing the single use.
-
- This routine will return usually zero either before flow is called (because
- there will be no LOG_LINKS notes) or after reload (because the REG_DEAD
- note can't be trusted).
-
- If DEST is cc0_rtx, we look only at the next insn. In that case, we don't
- care about REG_DEAD notes or LOG_LINKS.
-
- Otherwise, we find the single use by finding an insn that has a
- LOG_LINKS pointing at INSN and has a REG_DEAD note for DEST. If DEST is
- only referenced once in that insn, we know that it must be the first
- and last insn referencing DEST. */
-
-rtx *
-find_single_use (dest, insn, ploc)
- rtx dest;
- rtx insn;
- rtx *ploc;
-{
- rtx next;
- rtx *result;
- rtx link;
-
-#ifdef HAVE_cc0
- if (dest == cc0_rtx)
- {
- next = NEXT_INSN (insn);
- if (next == 0
- || (GET_CODE (next) != INSN && GET_CODE (next) != JUMP_INSN))
- return 0;
-
- result = find_single_use_1 (dest, &PATTERN (next));
- if (result && ploc)
- *ploc = next;
- return result;
- }
-#endif
-
- if (reload_completed || reload_in_progress || GET_CODE (dest) != REG)
- return 0;
-
- for (next = next_nonnote_insn (insn);
- next != 0 && GET_CODE (next) != CODE_LABEL;
- next = next_nonnote_insn (next))
- if (GET_RTX_CLASS (GET_CODE (next)) == 'i' && dead_or_set_p (next, dest))
- {
- for (link = LOG_LINKS (next); link; link = XEXP (link, 1))
- if (XEXP (link, 0) == insn)
- break;
-
- if (link)
- {
- result = find_single_use_1 (dest, &PATTERN (next));
- if (ploc)
- *ploc = next;
- return result;
- }
- }
-
- return 0;
-}
-
-/* Return 1 if OP is a valid general operand for machine mode MODE.
- This is either a register reference, a memory reference,
- or a constant. In the case of a memory reference, the address
- is checked for general validity for the target machine.
-
- Register and memory references must have mode MODE in order to be valid,
- but some constants have no machine mode and are valid for any mode.
-
- If MODE is VOIDmode, OP is checked for validity for whatever mode
- it has.
-
- The main use of this function is as a predicate in match_operand
- expressions in the machine description.
-
- For an explanation of this function's behavior for registers of
- class NO_REGS, see the comment for `register_operand'. */
-
-int
-general_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- register enum rtx_code code = GET_CODE (op);
- int mode_altering_drug = 0;
-
- if (mode == VOIDmode)
- mode = GET_MODE (op);
-
- /* Don't accept CONST_INT or anything similar
- if the caller wants something floating. */
- if (GET_MODE (op) == VOIDmode && mode != VOIDmode
- && GET_MODE_CLASS (mode) != MODE_INT
- && GET_MODE_CLASS (mode) != MODE_PARTIAL_INT)
- return 0;
-
- if (CONSTANT_P (op))
- return ((GET_MODE (op) == VOIDmode || GET_MODE (op) == mode)
-#ifdef LEGITIMATE_PIC_OPERAND_P
- && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
-#endif
- && LEGITIMATE_CONSTANT_P (op));
-
- /* Except for certain constants with VOIDmode, already checked for,
- OP's mode must match MODE if MODE specifies a mode. */
-
- if (GET_MODE (op) != mode)
- return 0;
-
- if (code == SUBREG)
- {
-#ifdef INSN_SCHEDULING
- /* On machines that have insn scheduling, we want all memory
- reference to be explicit, so outlaw paradoxical SUBREGs. */
- if (GET_CODE (SUBREG_REG (op)) == MEM
- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (SUBREG_REG (op))))
- return 0;
-#endif
-
- op = SUBREG_REG (op);
- code = GET_CODE (op);
-#if 0
- /* No longer needed, since (SUBREG (MEM...))
- will load the MEM into a reload reg in the MEM's own mode. */
- mode_altering_drug = 1;
-#endif
- }
-
- if (code == REG)
- /* A register whose class is NO_REGS is not a general operand. */
- return (REGNO (op) >= FIRST_PSEUDO_REGISTER
- || REGNO_REG_CLASS (REGNO (op)) != NO_REGS);
-
- if (code == MEM)
- {
- register rtx y = XEXP (op, 0);
- if (! volatile_ok && MEM_VOLATILE_P (op))
- return 0;
- /* Use the mem's mode, since it will be reloaded thus. */
- mode = GET_MODE (op);
- GO_IF_LEGITIMATE_ADDRESS (mode, y, win);
- }
- return 0;
-
- win:
- if (mode_altering_drug)
- return ! mode_dependent_address_p (XEXP (op, 0));
- return 1;
-}
-
-/* Return 1 if OP is a valid memory address for a memory reference
- of mode MODE.
-
- The main use of this function is as a predicate in match_operand
- expressions in the machine description. */
-
-int
-address_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return memory_address_p (mode, op);
-}
-
-/* Return 1 if OP is a register reference of mode MODE.
- If MODE is VOIDmode, accept a register in any mode.
-
- The main use of this function is as a predicate in match_operand
- expressions in the machine description.
-
- As a special exception, registers whose class is NO_REGS are
- not accepted by `register_operand'. The reason for this change
- is to allow the representation of special architecture artifacts
- (such as a condition code register) without extending the rtl
- definitions. Since registers of class NO_REGS cannot be used
- as registers in any case where register classes are examined,
- it is most consistent to keep this function from accepting them. */
-
-int
-register_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (GET_MODE (op) != mode && mode != VOIDmode)
- return 0;
-
- if (GET_CODE (op) == SUBREG)
- {
- /* Before reload, we can allow (SUBREG (MEM...)) as a register operand
- because it is guaranteed to be reloaded into one.
- Just make sure the MEM is valid in itself.
- (Ideally, (SUBREG (MEM)...) should not exist after reload,
- but currently it does result from (SUBREG (REG)...) where the
- reg went on the stack.) */
- if (! reload_completed && GET_CODE (SUBREG_REG (op)) == MEM)
- return general_operand (op, mode);
-
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- if (GET_CODE (SUBREG_REG (op)) == REG
- && REGNO (SUBREG_REG (op)) < FIRST_PSEUDO_REGISTER
- && TEST_HARD_REG_BIT (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE],
- REGNO (SUBREG_REG (op)))
- && (GET_MODE_SIZE (mode)
- != GET_MODE_SIZE (GET_MODE (SUBREG_REG (op))))
- && GET_MODE_CLASS (GET_MODE (SUBREG_REG (op))) != MODE_COMPLEX_INT
- && GET_MODE_CLASS (GET_MODE (SUBREG_REG (op))) != MODE_COMPLEX_FLOAT)
- return 0;
-#endif
-
- op = SUBREG_REG (op);
- }
-
- /* We don't consider registers whose class is NO_REGS
- to be a register operand. */
- return (GET_CODE (op) == REG
- && (REGNO (op) >= FIRST_PSEUDO_REGISTER
- || REGNO_REG_CLASS (REGNO (op)) != NO_REGS));
-}
-
-/* Return 1 if OP should match a MATCH_SCRATCH, i.e., if it is a SCRATCH
- or a hard register. */
-
-int
-scratch_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (GET_MODE (op) == mode
- && (GET_CODE (op) == SCRATCH
- || (GET_CODE (op) == REG
- && REGNO (op) < FIRST_PSEUDO_REGISTER)));
-}
-
-/* Return 1 if OP is a valid immediate operand for mode MODE.
-
- The main use of this function is as a predicate in match_operand
- expressions in the machine description. */
-
-int
-immediate_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- /* Don't accept CONST_INT or anything similar
- if the caller wants something floating. */
- if (GET_MODE (op) == VOIDmode && mode != VOIDmode
- && GET_MODE_CLASS (mode) != MODE_INT
- && GET_MODE_CLASS (mode) != MODE_PARTIAL_INT)
- return 0;
-
- return (CONSTANT_P (op)
- && (GET_MODE (op) == mode || mode == VOIDmode
- || GET_MODE (op) == VOIDmode)
-#ifdef LEGITIMATE_PIC_OPERAND_P
- && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
-#endif
- && LEGITIMATE_CONSTANT_P (op));
-}
-
-/* Returns 1 if OP is an operand that is a CONST_INT. */
-
-int
-const_int_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return GET_CODE (op) == CONST_INT;
-}
-
-/* Returns 1 if OP is an operand that is a constant integer or constant
- floating-point number. */
-
-int
-const_double_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- /* Don't accept CONST_INT or anything similar
- if the caller wants something floating. */
- if (GET_MODE (op) == VOIDmode && mode != VOIDmode
- && GET_MODE_CLASS (mode) != MODE_INT
- && GET_MODE_CLASS (mode) != MODE_PARTIAL_INT)
- return 0;
-
- return ((GET_CODE (op) == CONST_DOUBLE || GET_CODE (op) == CONST_INT)
- && (mode == VOIDmode || GET_MODE (op) == mode
- || GET_MODE (op) == VOIDmode));
-}
-
-/* Return 1 if OP is a general operand that is not an immediate operand. */
-
-int
-nonimmediate_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return (general_operand (op, mode) && ! CONSTANT_P (op));
-}
-
-/* Return 1 if OP is a register reference or immediate value of mode MODE. */
-
-int
-nonmemory_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- if (CONSTANT_P (op))
- {
- /* Don't accept CONST_INT or anything similar
- if the caller wants something floating. */
- if (GET_MODE (op) == VOIDmode && mode != VOIDmode
- && GET_MODE_CLASS (mode) != MODE_INT
- && GET_MODE_CLASS (mode) != MODE_PARTIAL_INT)
- return 0;
-
- return ((GET_MODE (op) == VOIDmode || GET_MODE (op) == mode)
-#ifdef LEGITIMATE_PIC_OPERAND_P
- && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
-#endif
- && LEGITIMATE_CONSTANT_P (op));
- }
-
- if (GET_MODE (op) != mode && mode != VOIDmode)
- return 0;
-
- if (GET_CODE (op) == SUBREG)
- {
- /* Before reload, we can allow (SUBREG (MEM...)) as a register operand
- because it is guaranteed to be reloaded into one.
- Just make sure the MEM is valid in itself.
- (Ideally, (SUBREG (MEM)...) should not exist after reload,
- but currently it does result from (SUBREG (REG)...) where the
- reg went on the stack.) */
- if (! reload_completed && GET_CODE (SUBREG_REG (op)) == MEM)
- return general_operand (op, mode);
- op = SUBREG_REG (op);
- }
-
- /* We don't consider registers whose class is NO_REGS
- to be a register operand. */
- return (GET_CODE (op) == REG
- && (REGNO (op) >= FIRST_PSEUDO_REGISTER
- || REGNO_REG_CLASS (REGNO (op)) != NO_REGS));
-}
-
-/* Return 1 if OP is a valid operand that stands for pushing a
- value of mode MODE onto the stack.
-
- The main use of this function is as a predicate in match_operand
- expressions in the machine description. */
-
-int
-push_operand (op, mode)
- rtx op;
- enum machine_mode mode;
-{
- if (GET_CODE (op) != MEM)
- return 0;
-
- if (GET_MODE (op) != mode)
- return 0;
-
- op = XEXP (op, 0);
-
- if (GET_CODE (op) != STACK_PUSH_CODE)
- return 0;
-
- return XEXP (op, 0) == stack_pointer_rtx;
-}
-
-/* Return 1 if ADDR is a valid memory address for mode MODE. */
-
-int
-memory_address_p (mode, addr)
- enum machine_mode mode;
- register rtx addr;
-{
- GO_IF_LEGITIMATE_ADDRESS (mode, addr, win);
- return 0;
-
- win:
- return 1;
-}
-
-/* Return 1 if OP is a valid memory reference with mode MODE,
- including a valid address.
-
- The main use of this function is as a predicate in match_operand
- expressions in the machine description. */
-
-int
-memory_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- rtx inner;
-
- if (! reload_completed)
- /* Note that no SUBREG is a memory operand before end of reload pass,
- because (SUBREG (MEM...)) forces reloading into a register. */
- return GET_CODE (op) == MEM && general_operand (op, mode);
-
- if (mode != VOIDmode && GET_MODE (op) != mode)
- return 0;
-
- inner = op;
- if (GET_CODE (inner) == SUBREG)
- inner = SUBREG_REG (inner);
-
- return (GET_CODE (inner) == MEM && general_operand (op, mode));
-}
-
-/* Return 1 if OP is a valid indirect memory reference with mode MODE;
- that is, a memory reference whose address is a general_operand. */
-
-int
-indirect_operand (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- /* Before reload, a SUBREG isn't in memory (see memory_operand, above). */
- if (! reload_completed
- && GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == MEM)
- {
- register int offset = SUBREG_WORD (op) * UNITS_PER_WORD;
- rtx inner = SUBREG_REG (op);
-
- if (BYTES_BIG_ENDIAN)
- offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (op)))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (inner))));
-
- if (mode != VOIDmode && GET_MODE (op) != mode)
- return 0;
-
- /* The only way that we can have a general_operand as the resulting
- address is if OFFSET is zero and the address already is an operand
- or if the address is (plus Y (const_int -OFFSET)) and Y is an
- operand. */
-
- return ((offset == 0 && general_operand (XEXP (inner, 0), Pmode))
- || (GET_CODE (XEXP (inner, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (inner, 0), 1)) == CONST_INT
- && INTVAL (XEXP (XEXP (inner, 0), 1)) == -offset
- && general_operand (XEXP (XEXP (inner, 0), 0), Pmode)));
- }
-
- return (GET_CODE (op) == MEM
- && memory_operand (op, mode)
- && general_operand (XEXP (op, 0), Pmode));
-}
-
-/* Return 1 if this is a comparison operator. This allows the use of
- MATCH_OPERATOR to recognize all the branch insns. */
-
-int
-comparison_operator (op, mode)
- register rtx op;
- enum machine_mode mode;
-{
- return ((mode == VOIDmode || GET_MODE (op) == mode)
- && GET_RTX_CLASS (GET_CODE (op)) == '<');
-}
-
-/* If BODY is an insn body that uses ASM_OPERANDS,
- return the number of operands (both input and output) in the insn.
- Otherwise return -1. */
-
-int
-asm_noperands (body)
- rtx body;
-{
- if (GET_CODE (body) == ASM_OPERANDS)
- /* No output operands: return number of input operands. */
- return ASM_OPERANDS_INPUT_LENGTH (body);
- if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
- /* Single output operand: BODY is (set OUTPUT (asm_operands ...)). */
- return ASM_OPERANDS_INPUT_LENGTH (SET_SRC (body)) + 1;
- else if (GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == SET
- && GET_CODE (SET_SRC (XVECEXP (body, 0, 0))) == ASM_OPERANDS)
- {
- /* Multiple output operands, or 1 output plus some clobbers:
- body is [(set OUTPUT (asm_operands ...))... (clobber (reg ...))...]. */
- int i;
- int n_sets;
-
- /* Count backwards through CLOBBERs to determine number of SETs. */
- for (i = XVECLEN (body, 0); i > 0; i--)
- {
- if (GET_CODE (XVECEXP (body, 0, i - 1)) == SET)
- break;
- if (GET_CODE (XVECEXP (body, 0, i - 1)) != CLOBBER)
- return -1;
- }
-
- /* N_SETS is now number of output operands. */
- n_sets = i;
-
- /* Verify that all the SETs we have
- came from a single original asm_operands insn
- (so that invalid combinations are blocked). */
- for (i = 0; i < n_sets; i++)
- {
- rtx elt = XVECEXP (body, 0, i);
- if (GET_CODE (elt) != SET)
- return -1;
- if (GET_CODE (SET_SRC (elt)) != ASM_OPERANDS)
- return -1;
- /* If these ASM_OPERANDS rtx's came from different original insns
- then they aren't allowed together. */
- if (ASM_OPERANDS_INPUT_VEC (SET_SRC (elt))
- != ASM_OPERANDS_INPUT_VEC (SET_SRC (XVECEXP (body, 0, 0))))
- return -1;
- }
- return (ASM_OPERANDS_INPUT_LENGTH (SET_SRC (XVECEXP (body, 0, 0)))
- + n_sets);
- }
- else if (GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
- {
- /* 0 outputs, but some clobbers:
- body is [(asm_operands ...) (clobber (reg ...))...]. */
- int i;
-
- /* Make sure all the other parallel things really are clobbers. */
- for (i = XVECLEN (body, 0) - 1; i > 0; i--)
- if (GET_CODE (XVECEXP (body, 0, i)) != CLOBBER)
- return -1;
-
- return ASM_OPERANDS_INPUT_LENGTH (XVECEXP (body, 0, 0));
- }
- else
- return -1;
-}
-
-/* Assuming BODY is an insn body that uses ASM_OPERANDS,
- copy its operands (both input and output) into the vector OPERANDS,
- the locations of the operands within the insn into the vector OPERAND_LOCS,
- and the constraints for the operands into CONSTRAINTS.
- Write the modes of the operands into MODES.
- Return the assembler-template.
-
- If MODES, OPERAND_LOCS, CONSTRAINTS or OPERANDS is 0,
- we don't store that info. */
-
-char *
-decode_asm_operands (body, operands, operand_locs, constraints, modes)
- rtx body;
- rtx *operands;
- rtx **operand_locs;
- char **constraints;
- enum machine_mode *modes;
-{
- register int i;
- int noperands;
- char *template = 0;
-
- if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
- {
- rtx asmop = SET_SRC (body);
- /* Single output operand: BODY is (set OUTPUT (asm_operands ....)). */
-
- noperands = ASM_OPERANDS_INPUT_LENGTH (asmop) + 1;
-
- for (i = 1; i < noperands; i++)
- {
- if (operand_locs)
- operand_locs[i] = &ASM_OPERANDS_INPUT (asmop, i - 1);
- if (operands)
- operands[i] = ASM_OPERANDS_INPUT (asmop, i - 1);
- if (constraints)
- constraints[i] = ASM_OPERANDS_INPUT_CONSTRAINT (asmop, i - 1);
- if (modes)
- modes[i] = ASM_OPERANDS_INPUT_MODE (asmop, i - 1);
- }
-
- /* The output is in the SET.
- Its constraint is in the ASM_OPERANDS itself. */
- if (operands)
- operands[0] = SET_DEST (body);
- if (operand_locs)
- operand_locs[0] = &SET_DEST (body);
- if (constraints)
- constraints[0] = ASM_OPERANDS_OUTPUT_CONSTRAINT (asmop);
- if (modes)
- modes[0] = GET_MODE (SET_DEST (body));
- template = ASM_OPERANDS_TEMPLATE (asmop);
- }
- else if (GET_CODE (body) == ASM_OPERANDS)
- {
- rtx asmop = body;
- /* No output operands: BODY is (asm_operands ....). */
-
- noperands = ASM_OPERANDS_INPUT_LENGTH (asmop);
-
- /* The input operands are found in the 1st element vector. */
- /* Constraints for inputs are in the 2nd element vector. */
- for (i = 0; i < noperands; i++)
- {
- if (operand_locs)
- operand_locs[i] = &ASM_OPERANDS_INPUT (asmop, i);
- if (operands)
- operands[i] = ASM_OPERANDS_INPUT (asmop, i);
- if (constraints)
- constraints[i] = ASM_OPERANDS_INPUT_CONSTRAINT (asmop, i);
- if (modes)
- modes[i] = ASM_OPERANDS_INPUT_MODE (asmop, i);
- }
- template = ASM_OPERANDS_TEMPLATE (asmop);
- }
- else if (GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == SET)
- {
- rtx asmop = SET_SRC (XVECEXP (body, 0, 0));
- int nparallel = XVECLEN (body, 0); /* Includes CLOBBERs. */
- int nin = ASM_OPERANDS_INPUT_LENGTH (asmop);
- int nout = 0; /* Does not include CLOBBERs. */
-
- /* At least one output, plus some CLOBBERs. */
-
- /* The outputs are in the SETs.
- Their constraints are in the ASM_OPERANDS itself. */
- for (i = 0; i < nparallel; i++)
- {
- if (GET_CODE (XVECEXP (body, 0, i)) == CLOBBER)
- break; /* Past last SET */
-
- if (operands)
- operands[i] = SET_DEST (XVECEXP (body, 0, i));
- if (operand_locs)
- operand_locs[i] = &SET_DEST (XVECEXP (body, 0, i));
- if (constraints)
- constraints[i] = XSTR (SET_SRC (XVECEXP (body, 0, i)), 1);
- if (modes)
- modes[i] = GET_MODE (SET_DEST (XVECEXP (body, 0, i)));
- nout++;
- }
-
- for (i = 0; i < nin; i++)
- {
- if (operand_locs)
- operand_locs[i + nout] = &ASM_OPERANDS_INPUT (asmop, i);
- if (operands)
- operands[i + nout] = ASM_OPERANDS_INPUT (asmop, i);
- if (constraints)
- constraints[i + nout] = ASM_OPERANDS_INPUT_CONSTRAINT (asmop, i);
- if (modes)
- modes[i + nout] = ASM_OPERANDS_INPUT_MODE (asmop, i);
- }
-
- template = ASM_OPERANDS_TEMPLATE (asmop);
- }
- else if (GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
- {
- /* No outputs, but some CLOBBERs. */
-
- rtx asmop = XVECEXP (body, 0, 0);
- int nin = ASM_OPERANDS_INPUT_LENGTH (asmop);
-
- for (i = 0; i < nin; i++)
- {
- if (operand_locs)
- operand_locs[i] = &ASM_OPERANDS_INPUT (asmop, i);
- if (operands)
- operands[i] = ASM_OPERANDS_INPUT (asmop, i);
- if (constraints)
- constraints[i] = ASM_OPERANDS_INPUT_CONSTRAINT (asmop, i);
- if (modes)
- modes[i] = ASM_OPERANDS_INPUT_MODE (asmop, i);
- }
-
- template = ASM_OPERANDS_TEMPLATE (asmop);
- }
-
- return template;
-}
-
-/* Given an rtx *P, if it is a sum containing an integer constant term,
- return the location (type rtx *) of the pointer to that constant term.
- Otherwise, return a null pointer. */
-
-static rtx *
-find_constant_term_loc (p)
- rtx *p;
-{
- register rtx *tem;
- register enum rtx_code code = GET_CODE (*p);
-
- /* If *P IS such a constant term, P is its location. */
-
- if (code == CONST_INT || code == SYMBOL_REF || code == LABEL_REF
- || code == CONST)
- return p;
-
- /* Otherwise, if not a sum, it has no constant term. */
-
- if (GET_CODE (*p) != PLUS)
- return 0;
-
- /* If one of the summands is constant, return its location. */
-
- if (XEXP (*p, 0) && CONSTANT_P (XEXP (*p, 0))
- && XEXP (*p, 1) && CONSTANT_P (XEXP (*p, 1)))
- return p;
-
- /* Otherwise, check each summand for containing a constant term. */
-
- if (XEXP (*p, 0) != 0)
- {
- tem = find_constant_term_loc (&XEXP (*p, 0));
- if (tem != 0)
- return tem;
- }
-
- if (XEXP (*p, 1) != 0)
- {
- tem = find_constant_term_loc (&XEXP (*p, 1));
- if (tem != 0)
- return tem;
- }
-
- return 0;
-}
-
-/* Return 1 if OP is a memory reference
- whose address contains no side effects
- and remains valid after the addition
- of a positive integer less than the
- size of the object being referenced.
-
- We assume that the original address is valid and do not check it.
-
- This uses strict_memory_address_p as a subroutine, so
- don't use it before reload. */
-
-int
-offsettable_memref_p (op)
- rtx op;
-{
- return ((GET_CODE (op) == MEM)
- && offsettable_address_p (1, GET_MODE (op), XEXP (op, 0)));
-}
-
-/* Similar, but don't require a strictly valid mem ref:
- consider pseudo-regs valid as index or base regs. */
-
-int
-offsettable_nonstrict_memref_p (op)
- rtx op;
-{
- return ((GET_CODE (op) == MEM)
- && offsettable_address_p (0, GET_MODE (op), XEXP (op, 0)));
-}
-
-/* Return 1 if Y is a memory address which contains no side effects
- and would remain valid after the addition of a positive integer
- less than the size of that mode.
-
- We assume that the original address is valid and do not check it.
- We do check that it is valid for narrower modes.
-
- If STRICTP is nonzero, we require a strictly valid address,
- for the sake of use in reload.c. */
-
-int
-offsettable_address_p (strictp, mode, y)
- int strictp;
- enum machine_mode mode;
- register rtx y;
-{
- register enum rtx_code ycode = GET_CODE (y);
- register rtx z;
- rtx y1 = y;
- rtx *y2;
- int (*addressp) () = (strictp ? strict_memory_address_p : memory_address_p);
-
- if (CONSTANT_ADDRESS_P (y))
- return 1;
-
- /* Adjusting an offsettable address involves changing to a narrower mode.
- Make sure that's OK. */
-
- if (mode_dependent_address_p (y))
- return 0;
-
- /* If the expression contains a constant term,
- see if it remains valid when max possible offset is added. */
-
- if ((ycode == PLUS) && (y2 = find_constant_term_loc (&y1)))
- {
- int good;
-
- y1 = *y2;
- *y2 = plus_constant (*y2, GET_MODE_SIZE (mode) - 1);
- /* Use QImode because an odd displacement may be automatically invalid
- for any wider mode. But it should be valid for a single byte. */
- good = (*addressp) (QImode, y);
-
- /* In any case, restore old contents of memory. */
- *y2 = y1;
- return good;
- }
-
- if (ycode == PRE_DEC || ycode == PRE_INC
- || ycode == POST_DEC || ycode == POST_INC)
- return 0;
-
- /* The offset added here is chosen as the maximum offset that
- any instruction could need to add when operating on something
- of the specified mode. We assume that if Y and Y+c are
- valid addresses then so is Y+d for all 0<d<c. */
-
- z = plus_constant_for_output (y, GET_MODE_SIZE (mode) - 1);
-
- /* Use QImode because an odd displacement may be automatically invalid
- for any wider mode. But it should be valid for a single byte. */
- return (*addressp) (QImode, z);
-}
-
-/* Return 1 if ADDR is an address-expression whose effect depends
- on the mode of the memory reference it is used in.
-
- Autoincrement addressing is a typical example of mode-dependence
- because the amount of the increment depends on the mode. */
-
-int
-mode_dependent_address_p (addr)
- rtx addr;
-{
- GO_IF_MODE_DEPENDENT_ADDRESS (addr, win);
- return 0;
- win:
- return 1;
-}
-
-/* Return 1 if OP is a general operand
- other than a memory ref with a mode dependent address. */
-
-int
-mode_independent_operand (op, mode)
- enum machine_mode mode;
- rtx op;
-{
- rtx addr;
-
- if (! general_operand (op, mode))
- return 0;
-
- if (GET_CODE (op) != MEM)
- return 1;
-
- addr = XEXP (op, 0);
- GO_IF_MODE_DEPENDENT_ADDRESS (addr, lose);
- return 1;
- lose:
- return 0;
-}
-
-/* Given an operand OP that is a valid memory reference
- which satisfies offsettable_memref_p,
- return a new memory reference whose address has been adjusted by OFFSET.
- OFFSET should be positive and less than the size of the object referenced.
-*/
-
-rtx
-adj_offsettable_operand (op, offset)
- rtx op;
- int offset;
-{
- register enum rtx_code code = GET_CODE (op);
-
- if (code == MEM)
- {
- register rtx y = XEXP (op, 0);
- register rtx new;
-
- if (CONSTANT_ADDRESS_P (y))
- {
- new = gen_rtx (MEM, GET_MODE (op), plus_constant_for_output (y, offset));
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (op);
- return new;
- }
-
- if (GET_CODE (y) == PLUS)
- {
- rtx z = y;
- register rtx *const_loc;
-
- op = copy_rtx (op);
- z = XEXP (op, 0);
- const_loc = find_constant_term_loc (&z);
- if (const_loc)
- {
- *const_loc = plus_constant_for_output (*const_loc, offset);
- return op;
- }
- }
-
- new = gen_rtx (MEM, GET_MODE (op), plus_constant_for_output (y, offset));
- RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (op);
- return new;
- }
- abort ();
-}
-
-#ifdef REGISTER_CONSTRAINTS
-
-/* Check the operands of an insn (found in recog_operands)
- against the insn's operand constraints (found via INSN_CODE_NUM)
- and return 1 if they are valid.
-
- WHICH_ALTERNATIVE is set to a number which indicates which
- alternative of constraints was matched: 0 for the first alternative,
- 1 for the next, etc.
-
- In addition, when two operands are match
- and it happens that the output operand is (reg) while the
- input operand is --(reg) or ++(reg) (a pre-inc or pre-dec),
- make the output operand look like the input.
- This is because the output operand is the one the template will print.
-
- This is used in final, just before printing the assembler code and by
- the routines that determine an insn's attribute.
-
- If STRICT is a positive non-zero value, it means that we have been
- called after reload has been completed. In that case, we must
- do all checks strictly. If it is zero, it means that we have been called
- before reload has completed. In that case, we first try to see if we can
- find an alternative that matches strictly. If not, we try again, this
- time assuming that reload will fix up the insn. This provides a "best
- guess" for the alternative and is used to compute attributes of insns prior
- to reload. A negative value of STRICT is used for this internal call. */
-
-struct funny_match
-{
- int this, other;
-};
-
-int
-constrain_operands (insn_code_num, strict)
- int insn_code_num;
- int strict;
-{
- char *constraints[MAX_RECOG_OPERANDS];
- int matching_operands[MAX_RECOG_OPERANDS];
- enum op_type {OP_IN, OP_OUT, OP_INOUT} op_types[MAX_RECOG_OPERANDS];
- int earlyclobber[MAX_RECOG_OPERANDS];
- register int c;
- int noperands = insn_n_operands[insn_code_num];
-
- struct funny_match funny_match[MAX_RECOG_OPERANDS];
- int funny_match_index;
- int nalternatives = insn_n_alternatives[insn_code_num];
-
- if (noperands == 0 || nalternatives == 0)
- return 1;
-
- for (c = 0; c < noperands; c++)
- {
- constraints[c] = insn_operand_constraint[insn_code_num][c];
- matching_operands[c] = -1;
- op_types[c] = OP_IN;
- }
-
- which_alternative = 0;
-
- while (which_alternative < nalternatives)
- {
- register int opno;
- int lose = 0;
- funny_match_index = 0;
-
- for (opno = 0; opno < noperands; opno++)
- {
- register rtx op = recog_operand[opno];
- enum machine_mode mode = GET_MODE (op);
- register char *p = constraints[opno];
- int offset = 0;
- int win = 0;
- int val;
-
- earlyclobber[opno] = 0;
-
- /* A unary operator may be accepted by the predicate, but it
- is irrelevant for matching contraints. */
- if (GET_RTX_CLASS (GET_CODE (op)) == '1')
- op = XEXP (op, 0);
-
- if (GET_CODE (op) == SUBREG)
- {
- if (GET_CODE (SUBREG_REG (op)) == REG
- && REGNO (SUBREG_REG (op)) < FIRST_PSEUDO_REGISTER)
- offset = SUBREG_WORD (op);
- op = SUBREG_REG (op);
- }
-
- /* An empty constraint or empty alternative
- allows anything which matched the pattern. */
- if (*p == 0 || *p == ',')
- win = 1;
-
- while (*p && (c = *p++) != ',')
- switch (c)
- {
- case '?':
- case '!':
- case '*':
- case '%':
- break;
-
- case '#':
- /* Ignore rest of this alternative as far as
- constraint checking is concerned. */
- while (*p && *p != ',')
- p++;
- break;
-
- case '=':
- op_types[opno] = OP_OUT;
- break;
-
- case '+':
- op_types[opno] = OP_INOUT;
- break;
-
- case '&':
- earlyclobber[opno] = 1;
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- /* This operand must be the same as a previous one.
- This kind of constraint is used for instructions such
- as add when they take only two operands.
-
- Note that the lower-numbered operand is passed first.
-
- If we are not testing strictly, assume that this constraint
- will be satisfied. */
- if (strict < 0)
- val = 1;
- else
- val = operands_match_p (recog_operand[c - '0'],
- recog_operand[opno]);
-
- matching_operands[opno] = c - '0';
- matching_operands[c - '0'] = opno;
-
- if (val != 0)
- win = 1;
- /* If output is *x and input is *--x,
- arrange later to change the output to *--x as well,
- since the output op is the one that will be printed. */
- if (val == 2 && strict > 0)
- {
- funny_match[funny_match_index].this = opno;
- funny_match[funny_match_index++].other = c - '0';
- }
- break;
-
- case 'p':
- /* p is used for address_operands. When we are called by
- gen_reload, no one will have checked that the address is
- strictly valid, i.e., that all pseudos requiring hard regs
- have gotten them. */
- if (strict <= 0
- || (strict_memory_address_p
- (insn_operand_mode[insn_code_num][opno], op)))
- win = 1;
- break;
-
- /* No need to check general_operand again;
- it was done in insn-recog.c. */
- case 'g':
- /* Anything goes unless it is a REG and really has a hard reg
- but the hard reg is not in the class GENERAL_REGS. */
- if (strict < 0
- || GENERAL_REGS == ALL_REGS
- || GET_CODE (op) != REG
- || (reload_in_progress
- && REGNO (op) >= FIRST_PSEUDO_REGISTER)
- || reg_fits_class_p (op, GENERAL_REGS, offset, mode))
- win = 1;
- break;
-
- case 'r':
- if (strict < 0
- || (strict == 0
- && GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER)
- || (strict == 0 && GET_CODE (op) == SCRATCH)
- || (GET_CODE (op) == REG
- && ((GENERAL_REGS == ALL_REGS
- && REGNO (op) < FIRST_PSEUDO_REGISTER)
- || reg_fits_class_p (op, GENERAL_REGS,
- offset, mode))))
- win = 1;
- break;
-
- case 'X':
- /* This is used for a MATCH_SCRATCH in the cases when
- we don't actually need anything. So anything goes
- any time. */
- win = 1;
- break;
-
- case 'm':
- if (GET_CODE (op) == MEM
- /* Before reload, accept what reload can turn into mem. */
- || (strict < 0 && CONSTANT_P (op))
- /* During reload, accept a pseudo */
- || (reload_in_progress && GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER))
- win = 1;
- break;
-
- case '<':
- if (GET_CODE (op) == MEM
- && (GET_CODE (XEXP (op, 0)) == PRE_DEC
- || GET_CODE (XEXP (op, 0)) == POST_DEC))
- win = 1;
- break;
-
- case '>':
- if (GET_CODE (op) == MEM
- && (GET_CODE (XEXP (op, 0)) == PRE_INC
- || GET_CODE (XEXP (op, 0)) == POST_INC))
- win = 1;
- break;
-
- case 'E':
-#ifndef REAL_ARITHMETIC
- /* Match any CONST_DOUBLE, but only if
- we can examine the bits of it reliably. */
- if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
- || HOST_BITS_PER_WIDE_INT != BITS_PER_WORD)
- && GET_MODE (op) != VOIDmode && ! flag_pretend_float)
- break;
-#endif
- if (GET_CODE (op) == CONST_DOUBLE)
- win = 1;
- break;
-
- case 'F':
- if (GET_CODE (op) == CONST_DOUBLE)
- win = 1;
- break;
-
- case 'G':
- case 'H':
- if (GET_CODE (op) == CONST_DOUBLE
- && CONST_DOUBLE_OK_FOR_LETTER_P (op, c))
- win = 1;
- break;
-
- case 's':
- if (GET_CODE (op) == CONST_INT
- || (GET_CODE (op) == CONST_DOUBLE
- && GET_MODE (op) == VOIDmode))
- break;
- case 'i':
- if (CONSTANT_P (op))
- win = 1;
- break;
-
- case 'n':
- if (GET_CODE (op) == CONST_INT
- || (GET_CODE (op) == CONST_DOUBLE
- && GET_MODE (op) == VOIDmode))
- win = 1;
- break;
-
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- if (GET_CODE (op) == CONST_INT
- && CONST_OK_FOR_LETTER_P (INTVAL (op), c))
- win = 1;
- break;
-
-#ifdef EXTRA_CONSTRAINT
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- if (EXTRA_CONSTRAINT (op, c))
- win = 1;
- break;
-#endif
-
- case 'V':
- if (GET_CODE (op) == MEM
- && ((strict > 0 && ! offsettable_memref_p (op))
- || (strict < 0
- && !(CONSTANT_P (op) || GET_CODE (op) == MEM))
- || (reload_in_progress
- && !(GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER))))
- win = 1;
- break;
-
- case 'o':
- if ((strict > 0 && offsettable_memref_p (op))
- || (strict == 0 && offsettable_nonstrict_memref_p (op))
- /* Before reload, accept what reload can handle. */
- || (strict < 0
- && (CONSTANT_P (op) || GET_CODE (op) == MEM))
- /* During reload, accept a pseudo */
- || (reload_in_progress && GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER))
- win = 1;
- break;
-
- default:
- if (strict < 0
- || (strict == 0
- && GET_CODE (op) == REG
- && REGNO (op) >= FIRST_PSEUDO_REGISTER)
- || (strict == 0 && GET_CODE (op) == SCRATCH)
- || (GET_CODE (op) == REG
- && reg_fits_class_p (op, REG_CLASS_FROM_LETTER (c),
- offset, mode)))
- win = 1;
- }
-
- constraints[opno] = p;
- /* If this operand did not win somehow,
- this alternative loses. */
- if (! win)
- lose = 1;
- }
- /* This alternative won; the operands are ok.
- Change whichever operands this alternative says to change. */
- if (! lose)
- {
- int opno, eopno;
-
- /* See if any earlyclobber operand conflicts with some other
- operand. */
-
- if (strict > 0)
- for (eopno = 0; eopno < noperands; eopno++)
- /* Ignore earlyclobber operands now in memory,
- because we would often report failure when we have
- two memory operands, one of which was formerly a REG. */
- if (earlyclobber[eopno]
- && GET_CODE (recog_operand[eopno]) == REG)
- for (opno = 0; opno < noperands; opno++)
- if ((GET_CODE (recog_operand[opno]) == MEM
- || op_types[opno] != OP_OUT)
- && opno != eopno
- /* Ignore things like match_operator operands. */
- && *insn_operand_constraint[insn_code_num][opno] != 0
- && ! (matching_operands[opno] == eopno
- && rtx_equal_p (recog_operand[opno],
- recog_operand[eopno]))
- && ! safe_from_earlyclobber (recog_operand[opno],
- recog_operand[eopno]))
- lose = 1;
-
- if (! lose)
- {
- while (--funny_match_index >= 0)
- {
- recog_operand[funny_match[funny_match_index].other]
- = recog_operand[funny_match[funny_match_index].this];
- }
-
- return 1;
- }
- }
-
- which_alternative++;
- }
-
- /* If we are about to reject this, but we are not to test strictly,
- try a very loose test. Only return failure if it fails also. */
- if (strict == 0)
- return constrain_operands (insn_code_num, -1);
- else
- return 0;
-}
-
-/* Return 1 iff OPERAND (assumed to be a REG rtx)
- is a hard reg in class CLASS when its regno is offsetted by OFFSET
- and changed to mode MODE.
- If REG occupies multiple hard regs, all of them must be in CLASS. */
-
-int
-reg_fits_class_p (operand, class, offset, mode)
- rtx operand;
- register enum reg_class class;
- int offset;
- enum machine_mode mode;
-{
- register int regno = REGNO (operand);
- if (regno < FIRST_PSEUDO_REGISTER
- && TEST_HARD_REG_BIT (reg_class_contents[(int) class],
- regno + offset))
- {
- register int sr;
- regno += offset;
- for (sr = HARD_REGNO_NREGS (regno, mode) - 1;
- sr > 0; sr--)
- if (! TEST_HARD_REG_BIT (reg_class_contents[(int) class],
- regno + sr))
- break;
- return sr == 0;
- }
-
- return 0;
-}
-
-#endif /* REGISTER_CONSTRAINTS */
diff --git a/gcc/recog.h b/gcc/recog.h
deleted file mode 100644
index cd270ed2115..00000000000
--- a/gcc/recog.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Declarations for interface to insn recognizer and insn-output.c.
- Copyright (C) 1987, 1996 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. */
-
-#include "gansidecl.h"
-
-/* Recognize an insn and return its insn-code,
- which is the sequence number of the DEFINE_INSN that it matches.
- If the insn does not match, return -1. */
-
-extern int recog_memoized PROTO((rtx));
-
-/* Determine whether a proposed change to an insn or MEM will make it
- invalid. Make the change if not. */
-
-extern int validate_change PROTO((rtx, rtx *, rtx, int));
-
-/* Apply a group of changes if valid. */
-
-extern int apply_change_group PROTO((void));
-
-/* Return the number of changes so far in the current group. */
-
-extern int num_validated_changes PROTO((void));
-
-/* Retract some changes. */
-
-extern void cancel_changes PROTO((int));
-
-/* Nonzero means volatile operands are recognized. */
-
-extern int volatile_ok;
-
-/* Extract the operands from an insn that has been recognized. */
-
-extern void insn_extract PROTO((rtx));
-
-/* The following vectors hold the results from insn_extract. */
-
-/* Indexed by N, gives value of operand N. */
-extern rtx recog_operand[];
-
-/* Indexed by N, gives location where operand N was found. */
-extern rtx *recog_operand_loc[];
-
-/* Indexed by N, gives location where the Nth duplicate-appearance of
- an operand was found. This is something that matched MATCH_DUP. */
-extern rtx *recog_dup_loc[];
-
-/* Indexed by N, gives the operand number that was duplicated in the
- Nth duplicate-appearance of an operand. */
-extern char recog_dup_num[];
-
-/* Access the output function for CODE. */
-
-#define OUT_FCN(CODE) (*insn_outfun[(int) (CODE)])
-
-/* Tables defined in insn-output.c that give information about
- each insn-code value. */
-
-/* These are vectors indexed by insn-code. Details in genoutput.c. */
-
-extern char *const insn_template[];
-
-extern char *(*const insn_outfun[]) ();
-
-extern const int insn_n_operands[];
-
-extern const int insn_n_dups[];
-
-/* Indexed by insn code number, gives # of constraint alternatives. */
-
-extern const int insn_n_alternatives[];
-
-/* These are two-dimensional arrays indexed first by the insn-code
- and second by the operand number. Details in genoutput.c. */
-
-#ifdef REGISTER_CONSTRAINTS /* Avoid undef sym in certain broken linkers. */
-extern char *const insn_operand_constraint[][MAX_RECOG_OPERANDS];
-#endif
-
-#ifndef REGISTER_CONSTRAINTS /* Avoid undef sym in certain broken linkers. */
-extern const char insn_operand_address_p[][MAX_RECOG_OPERANDS];
-#endif
-
-extern const enum machine_mode insn_operand_mode[][MAX_RECOG_OPERANDS];
-
-extern const char insn_operand_strict_low[][MAX_RECOG_OPERANDS];
-
-extern int (*const insn_operand_predicate[][MAX_RECOG_OPERANDS]) ();
-
-extern char * insn_name[];
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
deleted file mode 100644
index 8551e65e00a..00000000000
--- a/gcc/reg-stack.c
+++ /dev/null
@@ -1,3235 +0,0 @@
-/* Register to Stack convert for GNU compiler.
- Copyright (C) 1992, 1993, 1994, 1995, 1996 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 pass converts stack-like registers from the "flat register
- file" model that gcc uses, to a stack convention that the 387 uses.
-
- * The form of the input:
-
- On input, the function consists of insn that have had their
- registers fully allocated to a set of "virtual" registers. Note that
- the word "virtual" is used differently here than elsewhere in gcc: for
- each virtual stack reg, there is a hard reg, but the mapping between
- them is not known until this pass is run. On output, hard register
- numbers have been substituted, and various pop and exchange insns have
- been emitted. The hard register numbers and the virtual register
- numbers completely overlap - before this pass, all stack register
- numbers are virtual, and afterward they are all hard.
-
- The virtual registers can be manipulated normally by gcc, and their
- semantics are the same as for normal registers. After the hard
- register numbers are substituted, the semantics of an insn containing
- stack-like regs are not the same as for an insn with normal regs: for
- instance, it is not safe to delete an insn that appears to be a no-op
- move. In general, no insn containing hard regs should be changed
- after this pass is done.
-
- * The form of the output:
-
- After this pass, hard register numbers represent the distance from
- the current top of stack to the desired register. A reference to
- FIRST_STACK_REG references the top of stack, FIRST_STACK_REG + 1,
- represents the register just below that, and so forth. Also, REG_DEAD
- notes indicate whether or not a stack register should be popped.
-
- A "swap" insn looks like a parallel of two patterns, where each
- pattern is a SET: one sets A to B, the other B to A.
-
- A "push" or "load" insn is a SET whose SET_DEST is FIRST_STACK_REG
- and whose SET_DEST is REG or MEM. Any other SET_DEST, such as PLUS,
- will replace the existing stack top, not push a new value.
-
- A store insn is a SET whose SET_DEST is FIRST_STACK_REG, and whose
- SET_SRC is REG or MEM.
-
- The case where the SET_SRC and SET_DEST are both FIRST_STACK_REG
- appears ambiguous. As a special case, the presence of a REG_DEAD note
- for FIRST_STACK_REG differentiates between a load insn and a pop.
-
- If a REG_DEAD is present, the insn represents a "pop" that discards
- the top of the register stack. If there is no REG_DEAD note, then the
- insn represents a "dup" or a push of the current top of stack onto the
- stack.
-
- * Methodology:
-
- Existing REG_DEAD and REG_UNUSED notes for stack registers are
- deleted and recreated from scratch. REG_DEAD is never created for a
- SET_DEST, only REG_UNUSED.
-
- Before life analysis, the mode of each insn is set based on whether
- or not any stack registers are mentioned within that insn. VOIDmode
- means that no regs are mentioned anyway, and QImode means that at
- least one pattern within the insn mentions stack registers. This
- information is valid until after reg_to_stack returns, and is used
- from jump_optimize.
-
- * asm_operands:
-
- There are several rules on the usage of stack-like regs in
- asm_operands insns. These rules apply only to the operands that are
- stack-like regs:
-
- 1. Given a set of input regs that die in an asm_operands, it is
- necessary to know which are implicitly popped by the asm, and
- which must be explicitly popped by gcc.
-
- An input reg that is implicitly popped by the asm must be
- explicitly clobbered, unless it is constrained to match an
- output operand.
-
- 2. For any input reg that is implicitly popped by an asm, it is
- necessary to know how to adjust the stack to compensate for the pop.
- If any non-popped input is closer to the top of the reg-stack than
- the implicitly popped reg, it would not be possible to know what the
- stack looked like - it's not clear how the rest of the stack "slides
- up".
-
- All implicitly popped input regs must be closer to the top of
- the reg-stack than any input that is not implicitly popped.
-
- 3. It is possible that if an input dies in an insn, reload might
- use the input reg for an output reload. Consider this example:
-
- asm ("foo" : "=t" (a) : "f" (b));
-
- This asm says that input B is not popped by the asm, and that
- the asm pushes a result onto the reg-stack, ie, the stack is one
- deeper after the asm than it was before. But, it is possible that
- reload will think that it can use the same reg for both the input and
- the output, if input B dies in this insn.
-
- If any input operand uses the "f" constraint, all output reg
- constraints must use the "&" earlyclobber.
-
- The asm above would be written as
-
- asm ("foo" : "=&t" (a) : "f" (b));
-
- 4. Some operands need to be in particular places on the stack. All
- output operands fall in this category - there is no other way to
- know which regs the outputs appear in unless the user indicates
- this in the constraints.
-
- Output operands must specifically indicate which reg an output
- appears in after an asm. "=f" is not allowed: the operand
- constraints must select a class with a single reg.
-
- 5. Output operands may not be "inserted" between existing stack regs.
- Since no 387 opcode uses a read/write operand, all output operands
- are dead before the asm_operands, and are pushed by the asm_operands.
- It makes no sense to push anywhere but the top of the reg-stack.
-
- Output operands must start at the top of the reg-stack: output
- operands may not "skip" a reg.
-
- 6. Some asm statements may need extra stack space for internal
- calculations. This can be guaranteed by clobbering stack registers
- unrelated to the inputs and outputs.
-
- Here are a couple of reasonable asms to want to write. This asm
- takes one input, which is internally popped, and produces two outputs.
-
- asm ("fsincos" : "=t" (cos), "=u" (sin) : "0" (inp));
-
- This asm takes two inputs, which are popped by the fyl2xp1 opcode,
- and replaces them with one output. The user must code the "st(1)"
- clobber for reg-stack.c to know that fyl2xp1 pops both inputs.
-
- asm ("fyl2xp1" : "=t" (result) : "0" (x), "u" (y) : "st(1)");
-
- */
-
-#include <stdio.h>
-#include "config.h"
-#include "tree.h"
-#include "rtl.h"
-#include "insn-config.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "flags.h"
-#include "insn-flags.h"
-
-#ifdef STACK_REGS
-
-#define REG_STACK_SIZE (LAST_STACK_REG - FIRST_STACK_REG + 1)
-
-/* This is the basic stack record. TOP is an index into REG[] such
- that REG[TOP] is the top of stack. If TOP is -1 the stack is empty.
-
- If TOP is -2, REG[] is not yet initialized. Stack initialization
- consists of placing each live reg in array `reg' and setting `top'
- appropriately.
-
- REG_SET indicates which registers are live. */
-
-typedef struct stack_def
-{
- int top; /* index to top stack element */
- HARD_REG_SET reg_set; /* set of live registers */
- char reg[REG_STACK_SIZE]; /* register - stack mapping */
-} *stack;
-
-/* highest instruction uid */
-static int max_uid = 0;
-
-/* Number of basic blocks in the current function. */
-static int blocks;
-
-/* Element N is first insn in basic block N.
- This info lasts until we finish compiling the function. */
-static rtx *block_begin;
-
-/* Element N is last insn in basic block N.
- This info lasts until we finish compiling the function. */
-static rtx *block_end;
-
-/* Element N is nonzero if control can drop into basic block N */
-static char *block_drops_in;
-
-/* Element N says all about the stack at entry block N */
-static stack block_stack_in;
-
-/* Element N says all about the stack life at the end of block N */
-static HARD_REG_SET *block_out_reg_set;
-
-/* This is where the BLOCK_NUM values are really stored. This is set
- up by find_blocks and used there and in life_analysis. It can be used
- later, but only to look up an insn that is the head or tail of some
- block. life_analysis and the stack register conversion process can
- add insns within a block. */
-static int *block_number;
-
-/* This is the register file for all register after conversion */
-static rtx
- FP_mode_reg[LAST_STACK_REG+1-FIRST_STACK_REG][(int) MAX_MACHINE_MODE];
-
-#define FP_MODE_REG(regno,mode) \
- (FP_mode_reg[(regno)-FIRST_STACK_REG][(int)(mode)])
-
-/* Get the basic block number of an insn. See note at block_number
- definition are validity of this information. */
-
-#define BLOCK_NUM(INSN) \
- ((INSN_UID (INSN) > max_uid) \
- ? (abort() , -1) : block_number[INSN_UID (INSN)])
-
-extern rtx forced_labels;
-
-/* Forward declarations */
-
-static void mark_regs_pat PROTO((rtx, HARD_REG_SET *));
-static void straighten_stack PROTO((rtx, stack));
-static void record_label_references PROTO((rtx, rtx));
-static rtx *get_true_reg PROTO((rtx *));
-static int constrain_asm_operands PROTO((int, rtx *, char **, int *,
- enum reg_class *));
-
-static void record_asm_reg_life PROTO((rtx,stack, rtx *, char **,
- int, int));
-static void record_reg_life_pat PROTO((rtx, HARD_REG_SET *,
- HARD_REG_SET *, int));
-static void get_asm_operand_length PROTO((rtx, int, int *, int *));
-static void record_reg_life PROTO((rtx, int, stack));
-static void find_blocks PROTO((rtx));
-static int uses_reg_or_mem PROTO((rtx));
-static rtx stack_result PROTO((tree));
-static void stack_reg_life_analysis PROTO((rtx, HARD_REG_SET *));
-static void replace_reg PROTO((rtx *, int));
-static void remove_regno_note PROTO((rtx, enum reg_note, int));
-static int get_hard_regnum PROTO((stack, rtx));
-static void delete_insn_for_stacker PROTO((rtx));
-static rtx emit_pop_insn PROTO((rtx, stack, rtx, rtx (*) ()));
-static void emit_swap_insn PROTO((rtx, stack, rtx));
-static void move_for_stack_reg PROTO((rtx, stack, rtx));
-static void swap_rtx_condition PROTO((rtx));
-static void compare_for_stack_reg PROTO((rtx, stack, rtx));
-static void subst_stack_regs_pat PROTO((rtx, stack, rtx));
-static void subst_asm_stack_regs PROTO((rtx, stack, rtx *, rtx **,
- char **, int, int));
-static void subst_stack_regs PROTO((rtx, stack));
-static void change_stack PROTO((rtx, stack, stack, rtx (*) ()));
-
-static void goto_block_pat PROTO((rtx, stack, rtx));
-static void convert_regs PROTO((void));
-static void print_blocks PROTO((FILE *, rtx, rtx));
-static void dump_stack_info PROTO((FILE *));
-
-/* Mark all registers needed for this pattern. */
-
-static void
-mark_regs_pat (pat, set)
- rtx pat;
- HARD_REG_SET *set;
-{
- enum machine_mode mode;
- register int regno;
- register int count;
-
- if (GET_CODE (pat) == SUBREG)
- {
- mode = GET_MODE (pat);
- regno = SUBREG_WORD (pat);
- regno += REGNO (SUBREG_REG (pat));
- }
- else
- regno = REGNO (pat), mode = GET_MODE (pat);
-
- for (count = HARD_REGNO_NREGS (regno, mode);
- count; count--, regno++)
- SET_HARD_REG_BIT (*set, regno);
-}
-
-/* Reorganise the stack into ascending numbers,
- after this insn. */
-
-static void
-straighten_stack (insn, regstack)
- rtx insn;
- stack regstack;
-{
- struct stack_def temp_stack;
- int top;
-
- temp_stack.reg_set = regstack->reg_set;
-
- for (top = temp_stack.top = regstack->top; top >= 0; top--)
- temp_stack.reg[top] = FIRST_STACK_REG + temp_stack.top - top;
-
- change_stack (insn, regstack, &temp_stack, emit_insn_after);
-}
-
-/* Return non-zero if any stack register is mentioned somewhere within PAT. */
-
-int
-stack_regs_mentioned_p (pat)
- rtx pat;
-{
- register char *fmt;
- register int i;
-
- if (STACK_REG_P (pat))
- return 1;
-
- fmt = GET_RTX_FORMAT (GET_CODE (pat));
- for (i = GET_RTX_LENGTH (GET_CODE (pat)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
-
- for (j = XVECLEN (pat, i) - 1; j >= 0; j--)
- if (stack_regs_mentioned_p (XVECEXP (pat, i, j)))
- return 1;
- }
- else if (fmt[i] == 'e' && stack_regs_mentioned_p (XEXP (pat, i)))
- return 1;
- }
-
- return 0;
-}
-
-/* Convert register usage from "flat" register file usage to a "stack
- register file. FIRST is the first insn in the function, FILE is the
- dump file, if used.
-
- First compute the beginning and end of each basic block. Do a
- register life analysis on the stack registers, recording the result
- for the head and tail of each basic block. The convert each insn one
- by one. Run a last jump_optimize() pass, if optimizing, to eliminate
- any cross-jumping created when the converter inserts pop insns.*/
-
-void
-reg_to_stack (first, file)
- rtx first;
- FILE *file;
-{
- register rtx insn;
- register int i;
- int stack_reg_seen = 0;
- enum machine_mode mode;
- HARD_REG_SET stackentry;
-
- CLEAR_HARD_REG_SET (stackentry);
-
- {
- static initialised;
- if (!initialised)
- {
-#if 0
- initialised = 1; /* This array can not have been previously
- initialised, because the rtx's are
- thrown away between compilations of
- functions. */
-#endif
- for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
- {
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- FP_MODE_REG (i, mode) = gen_rtx (REG, mode, i);
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_COMPLEX_FLOAT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- FP_MODE_REG (i, mode) = gen_rtx (REG, mode, i);
- }
- }
- }
-
- /* Count the basic blocks. Also find maximum insn uid. */
- {
- register RTX_CODE prev_code = BARRIER;
- register RTX_CODE code;
- register before_function_beg = 1;
-
- max_uid = 0;
- blocks = 0;
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- /* Note that this loop must select the same block boundaries
- as code in find_blocks. Also note that this code is not the
- same as that used in flow.c. */
-
- if (INSN_UID (insn) > max_uid)
- max_uid = INSN_UID (insn);
-
- code = GET_CODE (insn);
-
- if (code == CODE_LABEL
- || (prev_code != INSN
- && prev_code != CALL_INSN
- && prev_code != CODE_LABEL
- && GET_RTX_CLASS (code) == 'i'))
- blocks++;
-
- if (code == NOTE && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG)
- before_function_beg = 0;
-
- /* Remember whether or not this insn mentions an FP regs.
- Check JUMP_INSNs too, in case someone creates a funny PARALLEL. */
-
- if (GET_RTX_CLASS (code) == 'i'
- && stack_regs_mentioned_p (PATTERN (insn)))
- {
- stack_reg_seen = 1;
- PUT_MODE (insn, QImode);
-
- /* Note any register passing parameters. */
-
- if (before_function_beg && code == INSN
- && GET_CODE (PATTERN (insn)) == USE)
- record_reg_life_pat (PATTERN (insn), (HARD_REG_SET *) 0,
- &stackentry, 1);
- }
- else
- PUT_MODE (insn, VOIDmode);
-
- if (code == CODE_LABEL)
- LABEL_REFS (insn) = insn; /* delete old chain */
-
- if (code != NOTE)
- prev_code = code;
- }
- }
-
- /* If no stack register reference exists in this insn, there isn't
- anything to convert. */
-
- if (! stack_reg_seen)
- return;
-
- /* If there are stack registers, there must be at least one block. */
-
- if (! blocks)
- abort ();
-
- /* Allocate some tables that last till end of compiling this function
- and some needed only in find_blocks and life_analysis. */
-
- block_begin = (rtx *) alloca (blocks * sizeof (rtx));
- block_end = (rtx *) alloca (blocks * sizeof (rtx));
- block_drops_in = (char *) alloca (blocks);
-
- block_stack_in = (stack) alloca (blocks * sizeof (struct stack_def));
- block_out_reg_set = (HARD_REG_SET *) alloca (blocks * sizeof (HARD_REG_SET));
- bzero ((char *) block_stack_in, blocks * sizeof (struct stack_def));
- bzero ((char *) block_out_reg_set, blocks * sizeof (HARD_REG_SET));
-
- block_number = (int *) alloca ((max_uid + 1) * sizeof (int));
-
- find_blocks (first);
- stack_reg_life_analysis (first, &stackentry);
-
- /* Dump the life analysis debug information before jump
- optimization, as that will destroy the LABEL_REFS we keep the
- information in. */
-
- if (file)
- dump_stack_info (file);
-
- convert_regs ();
-
- if (optimize)
- jump_optimize (first, 2, 0, 0);
-}
-
-/* Check PAT, which is in INSN, for LABEL_REFs. Add INSN to the
- label's chain of references, and note which insn contains each
- reference. */
-
-static void
-record_label_references (insn, pat)
- rtx insn, pat;
-{
- register enum rtx_code code = GET_CODE (pat);
- register int i;
- register char *fmt;
-
- if (code == LABEL_REF)
- {
- register rtx label = XEXP (pat, 0);
- register rtx ref;
-
- if (GET_CODE (label) != CODE_LABEL)
- abort ();
-
- /* If this is an undefined label, LABEL_REFS (label) contains
- garbage. */
- if (INSN_UID (label) == 0)
- return;
-
- /* Don't make a duplicate in the code_label's chain. */
-
- for (ref = LABEL_REFS (label);
- ref && ref != label;
- ref = LABEL_NEXTREF (ref))
- if (CONTAINING_INSN (ref) == insn)
- return;
-
- CONTAINING_INSN (pat) = insn;
- LABEL_NEXTREF (pat) = LABEL_REFS (label);
- LABEL_REFS (label) = pat;
-
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- record_label_references (insn, XEXP (pat, i));
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (pat, i); j++)
- record_label_references (insn, XVECEXP (pat, i, j));
- }
- }
-}
-
-/* Return a pointer to the REG expression within PAT. If PAT is not a
- REG, possible enclosed by a conversion rtx, return the inner part of
- PAT that stopped the search. */
-
-static rtx *
-get_true_reg (pat)
- rtx *pat;
-{
- for (;;)
- switch (GET_CODE (*pat))
- {
- case SUBREG:
- /* eliminate FP subregister accesses in favour of the
- actual FP register in use. */
- {
- rtx subreg;
- if (FP_REG_P (subreg = SUBREG_REG (*pat)))
- {
- *pat = FP_MODE_REG (REGNO (subreg) + SUBREG_WORD (*pat),
- GET_MODE (subreg));
- default:
- return pat;
- }
- }
- case FLOAT:
- case FIX:
- case FLOAT_EXTEND:
- pat = & XEXP (*pat, 0);
- }
-}
-
-/* Scan the OPERANDS and OPERAND_CONSTRAINTS of an asm_operands.
- N_OPERANDS is the total number of operands. Return which alternative
- matched, or -1 is no alternative matches.
-
- OPERAND_MATCHES is an array which indicates which operand this
- operand matches due to the constraints, or -1 if no match is required.
- If two operands match by coincidence, but are not required to match by
- the constraints, -1 is returned.
-
- OPERAND_CLASS is an array which indicates the smallest class
- required by the constraints. If the alternative that matches calls
- for some class `class', and the operand matches a subclass of `class',
- OPERAND_CLASS is set to `class' as required by the constraints, not to
- the subclass. If an alternative allows more than one class,
- OPERAND_CLASS is set to the smallest class that is a union of the
- allowed classes. */
-
-static int
-constrain_asm_operands (n_operands, operands, operand_constraints,
- operand_matches, operand_class)
- int n_operands;
- rtx *operands;
- char **operand_constraints;
- int *operand_matches;
- enum reg_class *operand_class;
-{
- char **constraints = (char **) alloca (n_operands * sizeof (char *));
- char *q;
- int this_alternative, this_operand;
- int n_alternatives;
- int j;
-
- for (j = 0; j < n_operands; j++)
- constraints[j] = operand_constraints[j];
-
- /* Compute the number of alternatives in the operands. reload has
- already guaranteed that all operands have the same number of
- alternatives. */
-
- n_alternatives = 1;
- for (q = constraints[0]; *q; q++)
- n_alternatives += (*q == ',');
-
- this_alternative = 0;
- while (this_alternative < n_alternatives)
- {
- int lose = 0;
- int i;
-
- /* No operands match, no narrow class requirements yet. */
- for (i = 0; i < n_operands; i++)
- {
- operand_matches[i] = -1;
- operand_class[i] = NO_REGS;
- }
-
- for (this_operand = 0; this_operand < n_operands; this_operand++)
- {
- rtx op = operands[this_operand];
- enum machine_mode mode = GET_MODE (op);
- char *p = constraints[this_operand];
- int offset = 0;
- int win = 0;
- int c;
-
- if (GET_CODE (op) == SUBREG)
- {
- if (GET_CODE (SUBREG_REG (op)) == REG
- && REGNO (SUBREG_REG (op)) < FIRST_PSEUDO_REGISTER)
- offset = SUBREG_WORD (op);
- op = SUBREG_REG (op);
- }
-
- /* An empty constraint or empty alternative
- allows anything which matched the pattern. */
- if (*p == 0 || *p == ',')
- win = 1;
-
- while (*p && (c = *p++) != ',')
- switch (c)
- {
- case '=':
- case '+':
- case '?':
- case '&':
- case '!':
- case '*':
- case '%':
- /* Ignore these. */
- break;
-
- case '#':
- /* Ignore rest of this alternative. */
- while (*p && *p != ',') p++;
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- /* This operand must be the same as a previous one.
- This kind of constraint is used for instructions such
- as add when they take only two operands.
-
- Note that the lower-numbered operand is passed first. */
-
- if (operands_match_p (operands[c - '0'],
- operands[this_operand]))
- {
- operand_matches[this_operand] = c - '0';
- win = 1;
- }
- break;
-
- case 'p':
- /* p is used for address_operands. Since this is an asm,
- just to make sure that the operand is valid for Pmode. */
-
- if (strict_memory_address_p (Pmode, op))
- win = 1;
- break;
-
- case 'g':
- /* Anything goes unless it is a REG and really has a hard reg
- but the hard reg is not in the class GENERAL_REGS. */
- if (GENERAL_REGS == ALL_REGS
- || GET_CODE (op) != REG
- || reg_fits_class_p (op, GENERAL_REGS, offset, mode))
- {
- if (GET_CODE (op) == REG)
- operand_class[this_operand]
- = reg_class_subunion[(int) operand_class[this_operand]][(int) GENERAL_REGS];
- win = 1;
- }
- break;
-
- case 'r':
- if (GET_CODE (op) == REG
- && (GENERAL_REGS == ALL_REGS
- || reg_fits_class_p (op, GENERAL_REGS, offset, mode)))
- {
- operand_class[this_operand]
- = reg_class_subunion[(int) operand_class[this_operand]][(int) GENERAL_REGS];
- win = 1;
- }
- break;
-
- case 'X':
- /* This is used for a MATCH_SCRATCH in the cases when we
- don't actually need anything. So anything goes any time. */
- win = 1;
- break;
-
- case 'm':
- if (GET_CODE (op) == MEM)
- win = 1;
- break;
-
- case '<':
- if (GET_CODE (op) == MEM
- && (GET_CODE (XEXP (op, 0)) == PRE_DEC
- || GET_CODE (XEXP (op, 0)) == POST_DEC))
- win = 1;
- break;
-
- case '>':
- if (GET_CODE (op) == MEM
- && (GET_CODE (XEXP (op, 0)) == PRE_INC
- || GET_CODE (XEXP (op, 0)) == POST_INC))
- win = 1;
- break;
-
- case 'E':
- /* Match any CONST_DOUBLE, but only if
- we can examine the bits of it reliably. */
- if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
- || HOST_BITS_PER_WIDE_INT != BITS_PER_WORD)
- && GET_CODE (op) != VOIDmode && ! flag_pretend_float)
- break;
- if (GET_CODE (op) == CONST_DOUBLE)
- win = 1;
- break;
-
- case 'F':
- if (GET_CODE (op) == CONST_DOUBLE)
- win = 1;
- break;
-
- case 'G':
- case 'H':
- if (GET_CODE (op) == CONST_DOUBLE
- && CONST_DOUBLE_OK_FOR_LETTER_P (op, c))
- win = 1;
- break;
-
- case 's':
- if (GET_CODE (op) == CONST_INT
- || (GET_CODE (op) == CONST_DOUBLE
- && GET_MODE (op) == VOIDmode))
- break;
- /* Fall through */
- case 'i':
- if (CONSTANT_P (op))
- win = 1;
- break;
-
- case 'n':
- if (GET_CODE (op) == CONST_INT
- || (GET_CODE (op) == CONST_DOUBLE
- && GET_MODE (op) == VOIDmode))
- win = 1;
- break;
-
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- if (GET_CODE (op) == CONST_INT
- && CONST_OK_FOR_LETTER_P (INTVAL (op), c))
- win = 1;
- break;
-
-#ifdef EXTRA_CONSTRAINT
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- if (EXTRA_CONSTRAINT (op, c))
- win = 1;
- break;
-#endif
-
- case 'V':
- if (GET_CODE (op) == MEM && ! offsettable_memref_p (op))
- win = 1;
- break;
-
- case 'o':
- if (offsettable_memref_p (op))
- win = 1;
- break;
-
- default:
- if (GET_CODE (op) == REG
- && reg_fits_class_p (op, REG_CLASS_FROM_LETTER (c),
- offset, mode))
- {
- operand_class[this_operand]
- = reg_class_subunion[(int)operand_class[this_operand]][(int) REG_CLASS_FROM_LETTER (c)];
- win = 1;
- }
- }
-
- constraints[this_operand] = p;
- /* If this operand did not win somehow,
- this alternative loses. */
- if (! win)
- lose = 1;
- }
- /* This alternative won; the operands are ok.
- Change whichever operands this alternative says to change. */
- if (! lose)
- break;
-
- this_alternative++;
- }
-
- /* For operands constrained to match another operand, copy the other
- operand's class to this operand's class. */
- for (j = 0; j < n_operands; j++)
- if (operand_matches[j] >= 0)
- operand_class[j] = operand_class[operand_matches[j]];
-
- return this_alternative == n_alternatives ? -1 : this_alternative;
-}
-
-/* Record the life info of each stack reg in INSN, updating REGSTACK.
- N_INPUTS is the number of inputs; N_OUTPUTS the outputs. CONSTRAINTS
- is an array of the constraint strings used in the asm statement.
- OPERANDS is an array of all operands for the insn, and is assumed to
- contain all output operands, then all inputs operands.
-
- There are many rules that an asm statement for stack-like regs must
- follow. Those rules are explained at the top of this file: the rule
- numbers below refer to that explanation. */
-
-static void
-record_asm_reg_life (insn, regstack, operands, constraints,
- n_inputs, n_outputs)
- rtx insn;
- stack regstack;
- rtx *operands;
- char **constraints;
- int n_inputs, n_outputs;
-{
- int i;
- int n_operands = n_inputs + n_outputs;
- int first_input = n_outputs;
- int n_clobbers;
- int malformed_asm = 0;
- rtx body = PATTERN (insn);
-
- int *operand_matches = (int *) alloca (n_operands * sizeof (int *));
-
- enum reg_class *operand_class
- = (enum reg_class *) alloca (n_operands * sizeof (enum reg_class *));
-
- int reg_used_as_output[FIRST_PSEUDO_REGISTER];
- int implicitly_dies[FIRST_PSEUDO_REGISTER];
-
- rtx *clobber_reg;
-
- /* Find out what the constraints require. If no constraint
- alternative matches, this asm is malformed. */
- i = constrain_asm_operands (n_operands, operands, constraints,
- operand_matches, operand_class);
- if (i < 0)
- malformed_asm = 1;
-
- /* Strip SUBREGs here to make the following code simpler. */
- for (i = 0; i < n_operands; i++)
- if (GET_CODE (operands[i]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[i])) == REG)
- operands[i] = SUBREG_REG (operands[i]);
-
- /* Set up CLOBBER_REG. */
-
- n_clobbers = 0;
-
- if (GET_CODE (body) == PARALLEL)
- {
- clobber_reg = (rtx *) alloca (XVECLEN (body, 0) * sizeof (rtx *));
-
- for (i = 0; i < XVECLEN (body, 0); i++)
- if (GET_CODE (XVECEXP (body, 0, i)) == CLOBBER)
- {
- rtx clobber = XVECEXP (body, 0, i);
- rtx reg = XEXP (clobber, 0);
-
- if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG)
- reg = SUBREG_REG (reg);
-
- if (STACK_REG_P (reg))
- {
- clobber_reg[n_clobbers] = reg;
- n_clobbers++;
- }
- }
- }
-
- /* Enforce rule #4: Output operands must specifically indicate which
- reg an output appears in after an asm. "=f" is not allowed: the
- operand constraints must select a class with a single reg.
-
- Also enforce rule #5: Output operands must start at the top of
- the reg-stack: output operands may not "skip" a reg. */
-
- bzero ((char *) reg_used_as_output, sizeof (reg_used_as_output));
- for (i = 0; i < n_outputs; i++)
- if (STACK_REG_P (operands[i]))
- if (reg_class_size[(int) operand_class[i]] != 1)
- {
- error_for_asm
- (insn, "Output constraint %d must specify a single register", i);
- malformed_asm = 1;
- }
- else
- reg_used_as_output[REGNO (operands[i])] = 1;
-
-
- /* Search for first non-popped reg. */
- for (i = FIRST_STACK_REG; i < LAST_STACK_REG + 1; i++)
- if (! reg_used_as_output[i])
- break;
-
- /* If there are any other popped regs, that's an error. */
- for (; i < LAST_STACK_REG + 1; i++)
- if (reg_used_as_output[i])
- break;
-
- if (i != LAST_STACK_REG + 1)
- {
- error_for_asm (insn, "Output regs must be grouped at top of stack");
- malformed_asm = 1;
- }
-
- /* Enforce rule #2: All implicitly popped input regs must be closer
- to the top of the reg-stack than any input that is not implicitly
- popped. */
-
- bzero ((char *) implicitly_dies, sizeof (implicitly_dies));
- for (i = first_input; i < first_input + n_inputs; i++)
- if (STACK_REG_P (operands[i]))
- {
- /* An input reg is implicitly popped if it is tied to an
- output, or if there is a CLOBBER for it. */
- int j;
-
- for (j = 0; j < n_clobbers; j++)
- if (operands_match_p (clobber_reg[j], operands[i]))
- break;
-
- if (j < n_clobbers || operand_matches[i] >= 0)
- implicitly_dies[REGNO (operands[i])] = 1;
- }
-
- /* Search for first non-popped reg. */
- for (i = FIRST_STACK_REG; i < LAST_STACK_REG + 1; i++)
- if (! implicitly_dies[i])
- break;
-
- /* If there are any other popped regs, that's an error. */
- for (; i < LAST_STACK_REG + 1; i++)
- if (implicitly_dies[i])
- break;
-
- if (i != LAST_STACK_REG + 1)
- {
- error_for_asm (insn,
- "Implicitly popped regs must be grouped at top of stack");
- malformed_asm = 1;
- }
-
- /* Enfore rule #3: If any input operand uses the "f" constraint, all
- output constraints must use the "&" earlyclobber.
-
- ??? Detect this more deterministically by having constraint_asm_operands
- record any earlyclobber. */
-
- for (i = first_input; i < first_input + n_inputs; i++)
- if (operand_matches[i] == -1)
- {
- int j;
-
- for (j = 0; j < n_outputs; j++)
- if (operands_match_p (operands[j], operands[i]))
- {
- error_for_asm (insn,
- "Output operand %d must use `&' constraint", j);
- malformed_asm = 1;
- }
- }
-
- if (malformed_asm)
- {
- /* Avoid further trouble with this insn. */
- PATTERN (insn) = gen_rtx (USE, VOIDmode, const0_rtx);
- PUT_MODE (insn, VOIDmode);
- return;
- }
-
- /* Process all outputs */
- for (i = 0; i < n_outputs; i++)
- {
- rtx op = operands[i];
-
- if (! STACK_REG_P (op))
- if (stack_regs_mentioned_p (op))
- abort ();
- else
- continue;
-
- /* Each destination is dead before this insn. If the
- destination is not used after this insn, record this with
- REG_UNUSED. */
-
- if (! TEST_HARD_REG_BIT (regstack->reg_set, REGNO (op)))
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_UNUSED, op,
- REG_NOTES (insn));
-
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (op));
- }
-
- /* Process all inputs */
- for (i = first_input; i < first_input + n_inputs; i++)
- {
- if (! STACK_REG_P (operands[i]))
- if (stack_regs_mentioned_p (operands[i]))
- abort ();
- else
- continue;
-
- /* If an input is dead after the insn, record a death note.
- But don't record a death note if there is already a death note,
- or if the input is also an output. */
-
- if (! TEST_HARD_REG_BIT (regstack->reg_set, REGNO (operands[i]))
- && operand_matches[i] == -1
- && find_regno_note (insn, REG_DEAD, REGNO (operands[i])) == NULL_RTX)
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_DEAD, operands[i],
- REG_NOTES (insn));
-
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (operands[i]));
- }
-}
-
-/* Scan PAT, which is part of INSN, and record registers appearing in
- a SET_DEST in DEST, and other registers in SRC.
-
- This function does not know about SET_DESTs that are both input and
- output (such as ZERO_EXTRACT) - this cannot happen on a 387. */
-
-static void
-record_reg_life_pat (pat, src, dest, douse)
- rtx pat;
- HARD_REG_SET *src, *dest;
- int douse;
-{
- register char *fmt;
- register int i;
-
- if (STACK_REG_P (pat)
- || (GET_CODE (pat) == SUBREG && STACK_REG_P (SUBREG_REG (pat))))
- {
- if (src)
- mark_regs_pat (pat, src);
-
- if (dest)
- mark_regs_pat (pat, dest);
-
- return;
- }
-
- if (GET_CODE (pat) == SET)
- {
- record_reg_life_pat (XEXP (pat, 0), NULL_PTR, dest, 0);
- record_reg_life_pat (XEXP (pat, 1), src, NULL_PTR, 0);
- return;
- }
-
- /* We don't need to consider either of these cases. */
- if (GET_CODE (pat) == USE && !douse || GET_CODE (pat) == CLOBBER)
- return;
-
- fmt = GET_RTX_FORMAT (GET_CODE (pat));
- for (i = GET_RTX_LENGTH (GET_CODE (pat)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
-
- for (j = XVECLEN (pat, i) - 1; j >= 0; j--)
- record_reg_life_pat (XVECEXP (pat, i, j), src, dest, 0);
- }
- else if (fmt[i] == 'e')
- record_reg_life_pat (XEXP (pat, i), src, dest, 0);
- }
-}
-
-/* Calculate the number of inputs and outputs in BODY, an
- asm_operands. N_OPERANDS is the total number of operands, and
- N_INPUTS and N_OUTPUTS are pointers to ints into which the results are
- placed. */
-
-static void
-get_asm_operand_lengths (body, n_operands, n_inputs, n_outputs)
- rtx body;
- int n_operands;
- int *n_inputs, *n_outputs;
-{
- if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
- *n_inputs = ASM_OPERANDS_INPUT_LENGTH (SET_SRC (body));
-
- else if (GET_CODE (body) == ASM_OPERANDS)
- *n_inputs = ASM_OPERANDS_INPUT_LENGTH (body);
-
- else if (GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == SET)
- *n_inputs = ASM_OPERANDS_INPUT_LENGTH (SET_SRC (XVECEXP (body, 0, 0)));
-
- else if (GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
- *n_inputs = ASM_OPERANDS_INPUT_LENGTH (XVECEXP (body, 0, 0));
- else
- abort ();
-
- *n_outputs = n_operands - *n_inputs;
-}
-
-/* Scan INSN, which is in BLOCK, and record the life & death of stack
- registers in REGSTACK. This function is called to process insns from
- the last insn in a block to the first. The actual scanning is done in
- record_reg_life_pat.
-
- If a register is live after a CALL_INSN, but is not a value return
- register for that CALL_INSN, then code is emitted to initialize that
- register. The block_end[] data is kept accurate.
-
- Existing death and unset notes for stack registers are deleted
- before processing the insn. */
-
-static void
-record_reg_life (insn, block, regstack)
- rtx insn;
- int block;
- stack regstack;
-{
- rtx note, *note_link;
- int n_operands;
-
- if ((GET_CODE (insn) != INSN && GET_CODE (insn) != CALL_INSN)
- || INSN_DELETED_P (insn))
- return;
-
- /* Strip death notes for stack regs from this insn */
-
- note_link = &REG_NOTES(insn);
- for (note = *note_link; note; note = XEXP (note, 1))
- if (STACK_REG_P (XEXP (note, 0))
- && (REG_NOTE_KIND (note) == REG_DEAD
- || REG_NOTE_KIND (note) == REG_UNUSED))
- *note_link = XEXP (note, 1);
- else
- note_link = &XEXP (note, 1);
-
- /* Process all patterns in the insn. */
-
- n_operands = asm_noperands (PATTERN (insn));
- if (n_operands >= 0)
- {
- /* This insn is an `asm' with operands. Decode the operands,
- decide how many are inputs, and record the life information. */
-
- rtx operands[MAX_RECOG_OPERANDS];
- rtx body = PATTERN (insn);
- int n_inputs, n_outputs;
- char **constraints = (char **) alloca (n_operands * sizeof (char *));
-
- decode_asm_operands (body, operands, NULL_PTR, constraints, NULL_PTR);
- get_asm_operand_lengths (body, n_operands, &n_inputs, &n_outputs);
- record_asm_reg_life (insn, regstack, operands, constraints,
- n_inputs, n_outputs);
- return;
- }
-
- {
- HARD_REG_SET src, dest;
- int regno;
-
- CLEAR_HARD_REG_SET (src);
- CLEAR_HARD_REG_SET (dest);
-
- if (GET_CODE (insn) == CALL_INSN)
- for (note = CALL_INSN_FUNCTION_USAGE (insn);
- note;
- note = XEXP (note, 1))
- if (GET_CODE (XEXP (note, 0)) == USE)
- record_reg_life_pat (SET_DEST (XEXP (note, 0)), &src, NULL_PTR, 0);
-
- record_reg_life_pat (PATTERN (insn), &src, &dest, 0);
- for (regno = FIRST_STACK_REG; regno <= LAST_STACK_REG; regno++)
- if (! TEST_HARD_REG_BIT (regstack->reg_set, regno))
- {
- if (TEST_HARD_REG_BIT (src, regno)
- && ! TEST_HARD_REG_BIT (dest, regno))
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_DEAD,
- FP_MODE_REG (regno, DFmode),
- REG_NOTES (insn));
- else if (TEST_HARD_REG_BIT (dest, regno))
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_UNUSED,
- FP_MODE_REG (regno, DFmode),
- REG_NOTES (insn));
- }
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- int reg;
-
- /* There might be a reg that is live after a function call.
- Initialize it to zero so that the program does not crash. See
- comment towards the end of stack_reg_life_analysis(). */
-
- for (reg = FIRST_STACK_REG; reg <= LAST_STACK_REG; reg++)
- if (! TEST_HARD_REG_BIT (dest, reg)
- && TEST_HARD_REG_BIT (regstack->reg_set, reg))
- {
- rtx init, pat;
-
- /* The insn will use virtual register numbers, and so
- convert_regs is expected to process these. But BLOCK_NUM
- cannot be used on these insns, because they do not appear in
- block_number[]. */
-
- pat = gen_rtx (SET, VOIDmode, FP_MODE_REG (reg, DFmode),
- CONST0_RTX (DFmode));
- init = emit_insn_after (pat, insn);
- PUT_MODE (init, QImode);
-
- CLEAR_HARD_REG_BIT (regstack->reg_set, reg);
-
- /* If the CALL_INSN was the end of a block, move the
- block_end to point to the new insn. */
-
- if (block_end[block] == insn)
- block_end[block] = init;
- }
-
- /* Some regs do not survive a CALL */
- AND_COMPL_HARD_REG_SET (regstack->reg_set, call_used_reg_set);
- }
-
- AND_COMPL_HARD_REG_SET (regstack->reg_set, dest);
- IOR_HARD_REG_SET (regstack->reg_set, src);
- }
-}
-
-/* Find all basic blocks of the function, which starts with FIRST.
- For each JUMP_INSN, build the chain of LABEL_REFS on each CODE_LABEL. */
-
-static void
-find_blocks (first)
- rtx first;
-{
- register rtx insn;
- register int block;
- register RTX_CODE prev_code = BARRIER;
- register RTX_CODE code;
- rtx label_value_list = 0;
-
- /* Record where all the blocks start and end.
- Record which basic blocks control can drop in to. */
-
- block = -1;
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- /* Note that this loop must select the same block boundaries
- as code in reg_to_stack, but that these are not the same
- as those selected in flow.c. */
-
- code = GET_CODE (insn);
-
- if (code == CODE_LABEL
- || (prev_code != INSN
- && prev_code != CALL_INSN
- && prev_code != CODE_LABEL
- && GET_RTX_CLASS (code) == 'i'))
- {
- block_begin[++block] = insn;
- block_end[block] = insn;
- block_drops_in[block] = prev_code != BARRIER;
- }
- else if (GET_RTX_CLASS (code) == 'i')
- block_end[block] = insn;
-
- if (GET_RTX_CLASS (code) == 'i')
- {
- rtx note;
-
- /* Make a list of all labels referred to other than by jumps. */
- for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_LABEL)
- label_value_list = gen_rtx (EXPR_LIST, VOIDmode, XEXP (note, 0),
- label_value_list);
- }
-
- block_number[INSN_UID (insn)] = block;
-
- if (code != NOTE)
- prev_code = code;
- }
-
- if (block + 1 != blocks)
- abort ();
-
- /* generate all label references to the corresponding jump insn */
- for (block = 0; block < blocks; block++)
- {
- insn = block_end[block];
-
- if (GET_CODE (insn) == JUMP_INSN)
- {
- rtx pat = PATTERN (insn);
- int computed_jump = 0;
- rtx x;
-
- if (GET_CODE (pat) == PARALLEL)
- {
- int len = XVECLEN (pat, 0);
- int has_use_labelref = 0;
- int i;
-
- for (i = len - 1; i >= 0; i--)
- if (GET_CODE (XVECEXP (pat, 0, i)) == USE
- && GET_CODE (XEXP (XVECEXP (pat, 0, i), 0)) == LABEL_REF)
- has_use_labelref = 1;
-
- if (! has_use_labelref)
- for (i = len - 1; i >= 0; i--)
- if (GET_CODE (XVECEXP (pat, 0, i)) == SET
- && SET_DEST (XVECEXP (pat, 0, i)) == pc_rtx
- && uses_reg_or_mem (SET_SRC (XVECEXP (pat, 0, i))))
- computed_jump = 1;
- }
- else if (GET_CODE (pat) == SET
- && SET_DEST (pat) == pc_rtx
- && uses_reg_or_mem (SET_SRC (pat)))
- computed_jump = 1;
-
- if (computed_jump)
- {
- for (x = label_value_list; x; x = XEXP (x, 1))
- record_label_references (insn,
- gen_rtx (LABEL_REF, VOIDmode,
- XEXP (x, 0)));
-
- for (x = forced_labels; x; x = XEXP (x, 1))
- record_label_references (insn,
- gen_rtx (LABEL_REF, VOIDmode,
- XEXP (x, 0)));
- }
-
- record_label_references (insn, pat);
- }
- }
-}
-
-/* Return 1 if X contain a REG or MEM that is not in the constant pool. */
-
-static int
-uses_reg_or_mem (x)
- rtx x;
-{
- enum rtx_code code = GET_CODE (x);
- int i, j;
- char *fmt;
-
- if (code == REG
- || (code == MEM
- && ! (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)))))
- return 1;
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e'
- && uses_reg_or_mem (XEXP (x, i)))
- return 1;
-
- if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- if (uses_reg_or_mem (XVECEXP (x, i, j)))
- return 1;
- }
-
- return 0;
-}
-
-/* If current function returns its result in an fp stack register,
- return the REG. Otherwise, return 0. */
-
-static rtx
-stack_result (decl)
- tree decl;
-{
- rtx result = DECL_RTL (DECL_RESULT (decl));
-
- if (result != 0
- && ! (GET_CODE (result) == REG
- && REGNO (result) < FIRST_PSEUDO_REGISTER))
- {
-#ifdef FUNCTION_OUTGOING_VALUE
- result
- = FUNCTION_OUTGOING_VALUE (TREE_TYPE (DECL_RESULT (decl)), decl);
-#else
- result = FUNCTION_VALUE (TREE_TYPE (DECL_RESULT (decl)), decl);
-#endif
- }
-
- return result != 0 && STACK_REG_P (result) ? result : 0;
-}
-
-/* Determine the which registers are live at the start of each basic
- block of the function whose first insn is FIRST.
-
- First, if the function returns a real_type, mark the function
- return type as live at each return point, as the RTL may not give any
- hint that the register is live.
-
- Then, start with the last block and work back to the first block.
- Similarly, work backwards within each block, insn by insn, recording
- which regs are dead and which are used (and therefore live) in the
- hard reg set of block_stack_in[].
-
- After processing each basic block, if there is a label at the start
- of the block, propagate the live registers to all jumps to this block.
-
- As a special case, if there are regs live in this block, that are
- not live in a block containing a jump to this label, and the block
- containing the jump has already been processed, we must propagate this
- block's entry register life back to the block containing the jump, and
- restart life analysis from there.
-
- In the worst case, this function may traverse the insns
- REG_STACK_SIZE times. This is necessary, since a jump towards the end
- of the insns may not know that a reg is live at a target that is early
- in the insns. So we back up and start over with the new reg live.
-
- If there are registers that are live at the start of the function,
- insns are emitted to initialize these registers. Something similar is
- done after CALL_INSNs in record_reg_life. */
-
-static void
-stack_reg_life_analysis (first, stackentry)
- rtx first;
- HARD_REG_SET *stackentry;
-{
- int reg, block;
- struct stack_def regstack;
-
- {
- rtx retvalue;
-
- if (retvalue = stack_result (current_function_decl))
- {
- /* Find all RETURN insns and mark them. */
-
- for (block = blocks - 1; --block >= 0;)
- if (GET_CODE (block_end[block]) == JUMP_INSN
- && GET_CODE (PATTERN (block_end[block])) == RETURN)
- mark_regs_pat (retvalue, block_out_reg_set+block);
-
- /* Mark off the end of last block if we "fall off" the end of the
- function into the epilogue. */
-
- if (GET_CODE (block_end[blocks-1]) != JUMP_INSN
- || GET_CODE (PATTERN (block_end[blocks-1])) == RETURN)
- mark_regs_pat (retvalue, block_out_reg_set+blocks-1);
- }
- }
-
- /* now scan all blocks backward for stack register use */
-
- block = blocks - 1;
- while (block >= 0)
- {
- register rtx insn, prev;
-
- /* current register status at last instruction */
-
- COPY_HARD_REG_SET (regstack.reg_set, block_out_reg_set[block]);
-
- prev = block_end[block];
- do
- {
- insn = prev;
- prev = PREV_INSN (insn);
-
- /* If the insn is a CALL_INSN, we need to ensure that
- everything dies. But otherwise don't process unless there
- are some stack regs present. */
-
- if (GET_MODE (insn) == QImode || GET_CODE (insn) == CALL_INSN)
- record_reg_life (insn, block, &regstack);
-
- } while (insn != block_begin[block]);
-
- /* Set the state at the start of the block. Mark that no
- register mapping information known yet. */
-
- COPY_HARD_REG_SET (block_stack_in[block].reg_set, regstack.reg_set);
- block_stack_in[block].top = -2;
-
- /* If there is a label, propagate our register life to all jumps
- to this label. */
-
- if (GET_CODE (insn) == CODE_LABEL)
- {
- register rtx label;
- int must_restart = 0;
-
- for (label = LABEL_REFS (insn); label != insn;
- label = LABEL_NEXTREF (label))
- {
- int jump_block = BLOCK_NUM (CONTAINING_INSN (label));
-
- if (jump_block < block)
- IOR_HARD_REG_SET (block_out_reg_set[jump_block],
- block_stack_in[block].reg_set);
- else
- {
- /* The block containing the jump has already been
- processed. If there are registers that were not known
- to be live then, but are live now, we must back up
- and restart life analysis from that point with the new
- life information. */
-
- GO_IF_HARD_REG_SUBSET (block_stack_in[block].reg_set,
- block_out_reg_set[jump_block],
- win);
-
- IOR_HARD_REG_SET (block_out_reg_set[jump_block],
- block_stack_in[block].reg_set);
-
- block = jump_block;
- must_restart = 1;
-
- win:
- ;
- }
- }
- if (must_restart)
- continue;
- }
-
- if (block_drops_in[block])
- IOR_HARD_REG_SET (block_out_reg_set[block-1],
- block_stack_in[block].reg_set);
-
- block -= 1;
- }
-
- /* If any reg is live at the start of the first block of a
- function, then we must guarantee that the reg holds some value by
- generating our own "load" of that register. Otherwise a 387 would
- fault trying to access an empty register. */
-
- /* Load zero into each live register. The fact that a register
- appears live at the function start necessarily implies an error
- in the user program: it means that (unless the offending code is *never*
- executed) this program is using uninitialised floating point
- variables. In order to keep broken code like this happy, we initialise
- those variables with zero.
-
- Note that we are inserting virtual register references here:
- these insns must be processed by convert_regs later. Also, these
- insns will not be in block_number, so BLOCK_NUM() will fail for them. */
-
- for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; reg--)
- if (TEST_HARD_REG_BIT (block_stack_in[0].reg_set, reg)
- && ! TEST_HARD_REG_BIT (*stackentry, reg))
- {
- rtx init_rtx;
-
- init_rtx = gen_rtx (SET, VOIDmode, FP_MODE_REG(reg, DFmode),
- CONST0_RTX (DFmode));
- block_begin[0] = emit_insn_after (init_rtx, first);
- PUT_MODE (block_begin[0], QImode);
-
- CLEAR_HARD_REG_BIT (block_stack_in[0].reg_set, reg);
- }
-}
-
-/*****************************************************************************
- This section deals with stack register substitution, and forms the second
- pass over the RTL.
- *****************************************************************************/
-
-/* Replace REG, which is a pointer to a stack reg RTX, with an RTX for
- the desired hard REGNO. */
-
-static void
-replace_reg (reg, regno)
- rtx *reg;
- int regno;
-{
- if (regno < FIRST_STACK_REG || regno > LAST_STACK_REG
- || ! STACK_REG_P (*reg))
- abort ();
-
- switch (GET_MODE_CLASS (GET_MODE (*reg)))
- {
- default: abort ();
- case MODE_FLOAT:
- case MODE_COMPLEX_FLOAT:;
- }
-
- *reg = FP_MODE_REG (regno, GET_MODE (*reg));
-}
-
-/* Remove a note of type NOTE, which must be found, for register
- number REGNO from INSN. Remove only one such note. */
-
-static void
-remove_regno_note (insn, note, regno)
- rtx insn;
- enum reg_note note;
- int regno;
-{
- register rtx *note_link, this;
-
- note_link = &REG_NOTES(insn);
- for (this = *note_link; this; this = XEXP (this, 1))
- if (REG_NOTE_KIND (this) == note
- && REG_P (XEXP (this, 0)) && REGNO (XEXP (this, 0)) == regno)
- {
- *note_link = XEXP (this, 1);
- return;
- }
- else
- note_link = &XEXP (this, 1);
-
- abort ();
-}
-
-/* Find the hard register number of virtual register REG in REGSTACK.
- The hard register number is relative to the top of the stack. -1 is
- returned if the register is not found. */
-
-static int
-get_hard_regnum (regstack, reg)
- stack regstack;
- rtx reg;
-{
- int i;
-
- if (! STACK_REG_P (reg))
- abort ();
-
- for (i = regstack->top; i >= 0; i--)
- if (regstack->reg[i] == REGNO (reg))
- break;
-
- return i >= 0 ? (FIRST_STACK_REG + regstack->top - i) : -1;
-}
-
-/* Delete INSN from the RTL. Mark the insn, but don't remove it from
- the chain of insns. Doing so could confuse block_begin and block_end
- if this were the only insn in the block. */
-
-static void
-delete_insn_for_stacker (insn)
- rtx insn;
-{
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
-}
-
-/* Emit an insn to pop virtual register REG before or after INSN.
- REGSTACK is the stack state after INSN and is updated to reflect this
- pop. WHEN is either emit_insn_before or emit_insn_after. A pop insn
- is represented as a SET whose destination is the register to be popped
- and source is the top of stack. A death note for the top of stack
- cases the movdf pattern to pop. */
-
-static rtx
-emit_pop_insn (insn, regstack, reg, when)
- rtx insn;
- stack regstack;
- rtx reg;
- rtx (*when)();
-{
- rtx pop_insn, pop_rtx;
- int hard_regno;
-
- hard_regno = get_hard_regnum (regstack, reg);
-
- if (hard_regno < FIRST_STACK_REG)
- abort ();
-
- pop_rtx = gen_rtx (SET, VOIDmode, FP_MODE_REG (hard_regno, DFmode),
- FP_MODE_REG (FIRST_STACK_REG, DFmode));
-
- pop_insn = (*when) (pop_rtx, insn);
- /* ??? This used to be VOIDmode, but that seems wrong. */
- PUT_MODE (pop_insn, QImode);
-
- REG_NOTES (pop_insn) = gen_rtx (EXPR_LIST, REG_DEAD,
- FP_MODE_REG (FIRST_STACK_REG, DFmode),
- REG_NOTES (pop_insn));
-
- regstack->reg[regstack->top - (hard_regno - FIRST_STACK_REG)]
- = regstack->reg[regstack->top];
- regstack->top -= 1;
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (reg));
-
- return pop_insn;
-}
-
-/* Emit an insn before or after INSN to swap virtual register REG with the
- top of stack. WHEN should be `emit_insn_before' or `emit_insn_before'
- REGSTACK is the stack state before the swap, and is updated to reflect
- the swap. A swap insn is represented as a PARALLEL of two patterns:
- each pattern moves one reg to the other.
-
- If REG is already at the top of the stack, no insn is emitted. */
-
-static void
-emit_swap_insn (insn, regstack, reg)
- rtx insn;
- stack regstack;
- rtx reg;
-{
- int hard_regno;
- rtx gen_swapdf();
- rtx swap_rtx, swap_insn;
- int tmp, other_reg; /* swap regno temps */
- rtx i1; /* the stack-reg insn prior to INSN */
- rtx i1set = NULL_RTX; /* the SET rtx within I1 */
-
- hard_regno = get_hard_regnum (regstack, reg);
-
- if (hard_regno < FIRST_STACK_REG)
- abort ();
- if (hard_regno == FIRST_STACK_REG)
- return;
-
- other_reg = regstack->top - (hard_regno - FIRST_STACK_REG);
-
- tmp = regstack->reg[other_reg];
- regstack->reg[other_reg] = regstack->reg[regstack->top];
- regstack->reg[regstack->top] = tmp;
-
- /* Find the previous insn involving stack regs, but don't go past
- any labels, calls or jumps. */
- i1 = prev_nonnote_insn (insn);
- while (i1 && GET_CODE (i1) == INSN && GET_MODE (i1) != QImode)
- i1 = prev_nonnote_insn (i1);
-
- if (i1)
- i1set = single_set (i1);
-
- if (i1set)
- {
- rtx i2; /* the stack-reg insn prior to I1 */
- rtx i1src = *get_true_reg (&SET_SRC (i1set));
- rtx i1dest = *get_true_reg (&SET_DEST (i1set));
-
- /* If the previous register stack push was from the reg we are to
- swap with, omit the swap. */
-
- if (GET_CODE (i1dest) == REG && REGNO (i1dest) == FIRST_STACK_REG
- && GET_CODE (i1src) == REG && REGNO (i1src) == hard_regno - 1
- && find_regno_note (i1, REG_DEAD, FIRST_STACK_REG) == NULL_RTX)
- return;
-
- /* If the previous insn wrote to the reg we are to swap with,
- omit the swap. */
-
- if (GET_CODE (i1dest) == REG && REGNO (i1dest) == hard_regno
- && GET_CODE (i1src) == REG && REGNO (i1src) == FIRST_STACK_REG
- && find_regno_note (i1, REG_DEAD, FIRST_STACK_REG) == NULL_RTX)
- return;
- }
-
- if (GET_RTX_CLASS (GET_CODE (i1)) == 'i' && sets_cc0_p (PATTERN (i1)))
- {
- i1 = next_nonnote_insn (i1);
- if (i1 == insn)
- abort ();
- }
-
- swap_rtx = gen_swapdf (FP_MODE_REG (hard_regno, DFmode),
- FP_MODE_REG (FIRST_STACK_REG, DFmode));
- swap_insn = emit_insn_after (swap_rtx, i1);
- /* ??? This used to be VOIDmode, but that seems wrong. */
- PUT_MODE (swap_insn, QImode);
-}
-
-/* Handle a move to or from a stack register in PAT, which is in INSN.
- REGSTACK is the current stack. */
-
-static void
-move_for_stack_reg (insn, regstack, pat)
- rtx insn;
- stack regstack;
- rtx pat;
-{
- rtx *psrc = get_true_reg (&SET_SRC (pat));
- rtx *pdest = get_true_reg (&SET_DEST (pat));
- rtx src, dest;
- rtx note;
-
- src = *psrc; dest = *pdest;
-
- if (STACK_REG_P (src) && STACK_REG_P (dest))
- {
- /* Write from one stack reg to another. If SRC dies here, then
- just change the register mapping and delete the insn. */
-
- note = find_regno_note (insn, REG_DEAD, REGNO (src));
- if (note)
- {
- int i;
-
- /* If this is a no-op move, there must not be a REG_DEAD note. */
- if (REGNO (src) == REGNO (dest))
- abort ();
-
- for (i = regstack->top; i >= 0; i--)
- if (regstack->reg[i] == REGNO (src))
- break;
-
- /* The source must be live, and the dest must be dead. */
- if (i < 0 || get_hard_regnum (regstack, dest) >= FIRST_STACK_REG)
- abort ();
-
- /* It is possible that the dest is unused after this insn.
- If so, just pop the src. */
-
- if (find_regno_note (insn, REG_UNUSED, REGNO (dest)))
- {
- emit_pop_insn (insn, regstack, src, emit_insn_after);
-
- delete_insn_for_stacker (insn);
- return;
- }
-
- regstack->reg[i] = REGNO (dest);
-
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (src));
-
- delete_insn_for_stacker (insn);
-
- return;
- }
-
- /* The source reg does not die. */
-
- /* If this appears to be a no-op move, delete it, or else it
- will confuse the machine description output patterns. But if
- it is REG_UNUSED, we must pop the reg now, as per-insn processing
- for REG_UNUSED will not work for deleted insns. */
-
- if (REGNO (src) == REGNO (dest))
- {
- if (find_regno_note (insn, REG_UNUSED, REGNO (dest)))
- emit_pop_insn (insn, regstack, dest, emit_insn_after);
-
- delete_insn_for_stacker (insn);
- return;
- }
-
- /* The destination ought to be dead */
- if (get_hard_regnum (regstack, dest) >= FIRST_STACK_REG)
- abort ();
-
- replace_reg (psrc, get_hard_regnum (regstack, src));
-
- regstack->reg[++regstack->top] = REGNO (dest);
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
- replace_reg (pdest, FIRST_STACK_REG);
- }
- else if (STACK_REG_P (src))
- {
- /* Save from a stack reg to MEM, or possibly integer reg. Since
- only top of stack may be saved, emit an exchange first if
- needs be. */
-
- emit_swap_insn (insn, regstack, src);
-
- note = find_regno_note (insn, REG_DEAD, REGNO (src));
- if (note)
- {
- replace_reg (&XEXP (note, 0), FIRST_STACK_REG);
- regstack->top--;
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (src));
- }
- else if (GET_MODE (src) == XFmode && regstack->top < REG_STACK_SIZE - 1)
- {
- /* A 387 cannot write an XFmode value to a MEM without
- clobbering the source reg. The output code can handle
- this by reading back the value from the MEM.
- But it is more efficient to use a temp register if one is
- available. Push the source value here if the register
- stack is not full, and then write the value to memory via
- a pop. */
- rtx push_rtx, push_insn;
- rtx top_stack_reg = FP_MODE_REG (FIRST_STACK_REG, XFmode);
-
- push_rtx = gen_movxf (top_stack_reg, top_stack_reg);
- push_insn = emit_insn_before (push_rtx, insn);
- PUT_MODE (push_insn, QImode);
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_DEAD, top_stack_reg,
- REG_NOTES (insn));
- }
-
- replace_reg (psrc, FIRST_STACK_REG);
- }
- else if (STACK_REG_P (dest))
- {
- /* Load from MEM, or possibly integer REG or constant, into the
- stack regs. The actual target is always the top of the
- stack. The stack mapping is changed to reflect that DEST is
- now at top of stack. */
-
- /* The destination ought to be dead */
- if (get_hard_regnum (regstack, dest) >= FIRST_STACK_REG)
- abort ();
-
- if (regstack->top >= REG_STACK_SIZE)
- abort ();
-
- regstack->reg[++regstack->top] = REGNO (dest);
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (dest));
- replace_reg (pdest, FIRST_STACK_REG);
- }
- else
- abort ();
-}
-
-static void
-swap_rtx_condition (pat)
- rtx pat;
-{
- register char *fmt;
- register int i;
-
- if (GET_RTX_CLASS (GET_CODE (pat)) == '<')
- {
- PUT_CODE (pat, swap_condition (GET_CODE (pat)));
- return;
- }
-
- fmt = GET_RTX_FORMAT (GET_CODE (pat));
- for (i = GET_RTX_LENGTH (GET_CODE (pat)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
-
- for (j = XVECLEN (pat, i) - 1; j >= 0; j--)
- swap_rtx_condition (XVECEXP (pat, i, j));
- }
- else if (fmt[i] == 'e')
- swap_rtx_condition (XEXP (pat, i));
- }
-}
-
-/* Handle a comparison. Special care needs to be taken to avoid
- causing comparisons that a 387 cannot do correctly, such as EQ.
-
- Also, a pop insn may need to be emitted. The 387 does have an
- `fcompp' insn that can pop two regs, but it is sometimes too expensive
- to do this - a `fcomp' followed by a `fstpl %st(0)' may be easier to
- set up. */
-
-static void
-compare_for_stack_reg (insn, regstack, pat)
- rtx insn;
- stack regstack;
- rtx pat;
-{
- rtx *src1, *src2;
- rtx src1_note, src2_note;
- rtx cc0_user;
-
- src1 = get_true_reg (&XEXP (SET_SRC (pat), 0));
- src2 = get_true_reg (&XEXP (SET_SRC (pat), 1));
- cc0_user = next_cc0_user (insn);
-
- /* If the insn that uses cc0 is a conditional move, then the destination
- must be the top of stack */
- if (GET_CODE (PATTERN (cc0_user)) == SET
- && SET_DEST (PATTERN (cc0_user)) != pc_rtx
- && GET_CODE (SET_SRC (PATTERN (cc0_user))) == IF_THEN_ELSE)
- {
- rtx *dest, src_note;
-
- dest = get_true_reg (&SET_DEST (PATTERN (cc0_user)));
- if (REGNO (*dest) != regstack->reg[regstack->top])
- {
- emit_swap_insn (insn, regstack, *dest);
- }
- }
-
- /* ??? If fxch turns out to be cheaper than fstp, give priority to
- registers that die in this insn - move those to stack top first. */
- if (! STACK_REG_P (*src1)
- || (STACK_REG_P (*src2)
- && get_hard_regnum (regstack, *src2) == FIRST_STACK_REG))
- {
- rtx temp, next;
-
- temp = XEXP (SET_SRC (pat), 0);
- XEXP (SET_SRC (pat), 0) = XEXP (SET_SRC (pat), 1);
- XEXP (SET_SRC (pat), 1) = temp;
-
- src1 = get_true_reg (&XEXP (SET_SRC (pat), 0));
- src2 = get_true_reg (&XEXP (SET_SRC (pat), 1));
-
- next = next_cc0_user (insn);
- if (next == NULL_RTX)
- abort ();
-
- swap_rtx_condition (PATTERN (next));
- INSN_CODE (next) = -1;
- INSN_CODE (insn) = -1;
- }
-
- /* We will fix any death note later. */
-
- src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
-
- if (STACK_REG_P (*src2))
- src2_note = find_regno_note (insn, REG_DEAD, REGNO (*src2));
- else
- src2_note = NULL_RTX;
-
- emit_swap_insn (insn, regstack, *src1);
-
- replace_reg (src1, FIRST_STACK_REG);
-
- if (STACK_REG_P (*src2))
- replace_reg (src2, get_hard_regnum (regstack, *src2));
-
- if (src1_note)
- {
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (XEXP (src1_note, 0)));
- replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
- regstack->top--;
- }
-
- /* If the second operand dies, handle that. But if the operands are
- the same stack register, don't bother, because only one death is
- needed, and it was just handled. */
-
- if (src2_note
- && ! (STACK_REG_P (*src1) && STACK_REG_P (*src2)
- && REGNO (*src1) == REGNO (*src2)))
- {
- /* As a special case, two regs may die in this insn if src2 is
- next to top of stack and the top of stack also dies. Since
- we have already popped src1, "next to top of stack" is really
- at top (FIRST_STACK_REG) now. */
-
- if (get_hard_regnum (regstack, XEXP (src2_note, 0)) == FIRST_STACK_REG
- && src1_note)
- {
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (XEXP (src2_note, 0)));
- replace_reg (&XEXP (src2_note, 0), FIRST_STACK_REG + 1);
- regstack->top--;
- }
- else
- {
- /* The 386 can only represent death of the first operand in
- the case handled above. In all other cases, emit a separate
- pop and remove the death note from here. */
-
- link_cc0_insns (insn);
-
- remove_regno_note (insn, REG_DEAD, REGNO (XEXP (src2_note, 0)));
-
- emit_pop_insn (insn, regstack, XEXP (src2_note, 0),
- emit_insn_after);
- }
- }
-}
-
-/* Substitute new registers in PAT, which is part of INSN. REGSTACK
- is the current register layout. */
-
-static void
-subst_stack_regs_pat (insn, regstack, pat)
- rtx insn;
- stack regstack;
- rtx pat;
-{
- rtx *dest, *src;
- rtx *src1 = (rtx *) NULL_PTR, *src2;
- rtx src1_note, src2_note;
-
- if (GET_CODE (pat) != SET)
- return;
-
- dest = get_true_reg (&SET_DEST (pat));
- src = get_true_reg (&SET_SRC (pat));
-
- /* See if this is a `movM' pattern, and handle elsewhere if so. */
-
- if (*dest != cc0_rtx
- && (STACK_REG_P (*src)
- || (STACK_REG_P (*dest)
- && (GET_CODE (*src) == REG || GET_CODE (*src) == MEM
- || GET_CODE (*src) == CONST_DOUBLE))))
- move_for_stack_reg (insn, regstack, pat);
- else
- switch (GET_CODE (SET_SRC (pat)))
- {
- case COMPARE:
- compare_for_stack_reg (insn, regstack, pat);
- break;
-
- case CALL:
- {
- int count;
- for (count = HARD_REGNO_NREGS (REGNO (*dest), GET_MODE (*dest));
- --count >= 0;)
- {
- regstack->reg[++regstack->top] = REGNO (*dest) + count;
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest) + count);
- }
- }
- replace_reg (dest, FIRST_STACK_REG);
- break;
-
- case REG:
- /* This is a `tstM2' case. */
- if (*dest != cc0_rtx)
- abort ();
-
- src1 = src;
-
- /* Fall through. */
-
- case FLOAT_TRUNCATE:
- case SQRT:
- case ABS:
- case NEG:
- /* These insns only operate on the top of the stack. DEST might
- be cc0_rtx if we're processing a tstM pattern. Also, it's
- possible that the tstM case results in a REG_DEAD note on the
- source. */
-
- if (src1 == 0)
- src1 = get_true_reg (&XEXP (SET_SRC (pat), 0));
-
- emit_swap_insn (insn, regstack, *src1);
-
- src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
-
- if (STACK_REG_P (*dest))
- replace_reg (dest, FIRST_STACK_REG);
-
- if (src1_note)
- {
- replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
- regstack->top--;
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (*src1));
- }
-
- replace_reg (src1, FIRST_STACK_REG);
-
- break;
-
- case MINUS:
- case DIV:
- /* On i386, reversed forms of subM3 and divM3 exist for
- MODE_FLOAT, so the same code that works for addM3 and mulM3
- can be used. */
- case MULT:
- case PLUS:
- /* These insns can accept the top of stack as a destination
- from a stack reg or mem, or can use the top of stack as a
- source and some other stack register (possibly top of stack)
- as a destination. */
-
- src1 = get_true_reg (&XEXP (SET_SRC (pat), 0));
- src2 = get_true_reg (&XEXP (SET_SRC (pat), 1));
-
- /* We will fix any death note later. */
-
- if (STACK_REG_P (*src1))
- src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
- else
- src1_note = NULL_RTX;
- if (STACK_REG_P (*src2))
- src2_note = find_regno_note (insn, REG_DEAD, REGNO (*src2));
- else
- src2_note = NULL_RTX;
-
- /* If either operand is not a stack register, then the dest
- must be top of stack. */
-
- if (! STACK_REG_P (*src1) || ! STACK_REG_P (*src2))
- emit_swap_insn (insn, regstack, *dest);
- else
- {
- /* Both operands are REG. If neither operand is already
- at the top of stack, choose to make the one that is the dest
- the new top of stack. */
-
- int src1_hard_regnum, src2_hard_regnum;
-
- src1_hard_regnum = get_hard_regnum (regstack, *src1);
- src2_hard_regnum = get_hard_regnum (regstack, *src2);
- if (src1_hard_regnum == -1 || src2_hard_regnum == -1)
- abort ();
-
- if (src1_hard_regnum != FIRST_STACK_REG
- && src2_hard_regnum != FIRST_STACK_REG)
- emit_swap_insn (insn, regstack, *dest);
- }
-
- if (STACK_REG_P (*src1))
- replace_reg (src1, get_hard_regnum (regstack, *src1));
- if (STACK_REG_P (*src2))
- replace_reg (src2, get_hard_regnum (regstack, *src2));
-
- if (src1_note)
- {
- /* If the register that dies is at the top of stack, then
- the destination is somewhere else - merely substitute it.
- But if the reg that dies is not at top of stack, then
- move the top of stack to the dead reg, as though we had
- done the insn and then a store-with-pop. */
-
- if (REGNO (XEXP (src1_note, 0)) == regstack->reg[regstack->top])
- {
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
- replace_reg (dest, get_hard_regnum (regstack, *dest));
- }
- else
- {
- int regno = get_hard_regnum (regstack, XEXP (src1_note, 0));
-
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
- replace_reg (dest, regno);
-
- regstack->reg[regstack->top - (regno - FIRST_STACK_REG)]
- = regstack->reg[regstack->top];
- }
-
- CLEAR_HARD_REG_BIT (regstack->reg_set,
- REGNO (XEXP (src1_note, 0)));
- replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
- regstack->top--;
- }
- else if (src2_note)
- {
- if (REGNO (XEXP (src2_note, 0)) == regstack->reg[regstack->top])
- {
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
- replace_reg (dest, get_hard_regnum (regstack, *dest));
- }
- else
- {
- int regno = get_hard_regnum (regstack, XEXP (src2_note, 0));
-
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
- replace_reg (dest, regno);
-
- regstack->reg[regstack->top - (regno - FIRST_STACK_REG)]
- = regstack->reg[regstack->top];
- }
-
- CLEAR_HARD_REG_BIT (regstack->reg_set,
- REGNO (XEXP (src2_note, 0)));
- replace_reg (&XEXP (src2_note, 0), FIRST_STACK_REG);
- regstack->top--;
- }
- else
- {
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
- replace_reg (dest, get_hard_regnum (regstack, *dest));
- }
-
- break;
-
- case UNSPEC:
- switch (XINT (SET_SRC (pat), 1))
- {
- case 1: /* sin */
- case 2: /* cos */
- /* These insns only operate on the top of the stack. */
-
- src1 = get_true_reg (&XVECEXP (SET_SRC (pat), 0, 0));
-
- emit_swap_insn (insn, regstack, *src1);
-
- src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
-
- if (STACK_REG_P (*dest))
- replace_reg (dest, FIRST_STACK_REG);
-
- if (src1_note)
- {
- replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
- regstack->top--;
- CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (*src1));
- }
-
- replace_reg (src1, FIRST_STACK_REG);
-
- break;
-
- default:
- abort ();
- }
- break;
-
- case IF_THEN_ELSE:
- /* This insn requires the top of stack to be the destination. */
-
- src1 = get_true_reg (&XEXP (SET_SRC (pat), 1));
- src2 = get_true_reg (&XEXP (SET_SRC (pat), 2));
-
- src1_note = find_regno_note (insn, REG_DEAD, REGNO (*src1));
- src2_note = find_regno_note (insn, REG_DEAD, REGNO (*src2));
-
- {
- rtx src_note [3];
- int i;
-
- src_note[0] = 0;
- src_note[1] = src1_note;
- src_note[2] = src2_note;
-
- if (STACK_REG_P (*src1))
- replace_reg (src1, get_hard_regnum (regstack, *src1));
- if (STACK_REG_P (*src2))
- replace_reg (src2, get_hard_regnum (regstack, *src2));
-
- for (i = 1; i <= 2; i++)
- if (src_note [i])
- {
- int regno = get_hard_regnum (regstack, XEXP (src_note [i], 0));
-
- /* If the register that dies is not at the top of stack, then
- move the top of stack to the dead reg */
- if (REGNO (XEXP (src_note[i], 0))
- != regstack->reg[regstack->top])
- {
- remove_regno_note (insn, REG_DEAD,
- REGNO (XEXP (src_note [i], 0)));
- emit_pop_insn (insn, regstack, XEXP (src_note[i], 0),
- emit_insn_after);
- }
- else
- {
- CLEAR_HARD_REG_BIT (regstack->reg_set,
- REGNO (XEXP (src_note[i], 0)));
- replace_reg (&XEXP (src_note[i], 0), FIRST_STACK_REG);
- regstack->top--;
- }
-
- }
-
- SET_HARD_REG_BIT (regstack->reg_set, REGNO (*dest));
- replace_reg (dest, FIRST_STACK_REG);
- }
-
- break;
-
- default:
- abort ();
- }
-}
-
-/* Substitute hard regnums for any stack regs in INSN, which has
- N_INPUTS inputs and N_OUTPUTS outputs. REGSTACK is the stack info
- before the insn, and is updated with changes made here. CONSTRAINTS is
- an array of the constraint strings used in the asm statement.
-
- OPERANDS is an array of the operands, and OPERANDS_LOC is a
- parallel array of where the operands were found. The output operands
- all precede the input operands.
-
- There are several requirements and assumptions about the use of
- stack-like regs in asm statements. These rules are enforced by
- record_asm_stack_regs; see comments there for details. Any
- asm_operands left in the RTL at this point may be assume to meet the
- requirements, since record_asm_stack_regs removes any problem asm. */
-
-static void
-subst_asm_stack_regs (insn, regstack, operands, operands_loc, constraints,
- n_inputs, n_outputs)
- rtx insn;
- stack regstack;
- rtx *operands, **operands_loc;
- char **constraints;
- int n_inputs, n_outputs;
-{
- int n_operands = n_inputs + n_outputs;
- int first_input = n_outputs;
- rtx body = PATTERN (insn);
-
- int *operand_matches = (int *) alloca (n_operands * sizeof (int *));
- enum reg_class *operand_class
- = (enum reg_class *) alloca (n_operands * sizeof (enum reg_class *));
-
- rtx *note_reg; /* Array of note contents */
- rtx **note_loc; /* Address of REG field of each note */
- enum reg_note *note_kind; /* The type of each note */
-
- rtx *clobber_reg;
- rtx **clobber_loc;
-
- struct stack_def temp_stack;
- int n_notes;
- int n_clobbers;
- rtx note;
- int i;
-
- /* Find out what the constraints required. If no constraint
- alternative matches, that is a compiler bug: we should have caught
- such an insn during the life analysis pass (and reload should have
- caught it regardless). */
-
- i = constrain_asm_operands (n_operands, operands, constraints,
- operand_matches, operand_class);
- if (i < 0)
- abort ();
-
- /* Strip SUBREGs here to make the following code simpler. */
- for (i = 0; i < n_operands; i++)
- if (GET_CODE (operands[i]) == SUBREG
- && GET_CODE (SUBREG_REG (operands[i])) == REG)
- {
- operands_loc[i] = & SUBREG_REG (operands[i]);
- operands[i] = SUBREG_REG (operands[i]);
- }
-
- /* Set up NOTE_REG, NOTE_LOC and NOTE_KIND. */
-
- for (i = 0, note = REG_NOTES (insn); note; note = XEXP (note, 1))
- i++;
-
- note_reg = (rtx *) alloca (i * sizeof (rtx));
- note_loc = (rtx **) alloca (i * sizeof (rtx *));
- note_kind = (enum reg_note *) alloca (i * sizeof (enum reg_note));
-
- n_notes = 0;
- for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
- {
- rtx reg = XEXP (note, 0);
- rtx *loc = & XEXP (note, 0);
-
- if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG)
- {
- loc = & SUBREG_REG (reg);
- reg = SUBREG_REG (reg);
- }
-
- if (STACK_REG_P (reg)
- && (REG_NOTE_KIND (note) == REG_DEAD
- || REG_NOTE_KIND (note) == REG_UNUSED))
- {
- note_reg[n_notes] = reg;
- note_loc[n_notes] = loc;
- note_kind[n_notes] = REG_NOTE_KIND (note);
- n_notes++;
- }
- }
-
- /* Set up CLOBBER_REG and CLOBBER_LOC. */
-
- n_clobbers = 0;
-
- if (GET_CODE (body) == PARALLEL)
- {
- clobber_reg = (rtx *) alloca (XVECLEN (body, 0) * sizeof (rtx *));
- clobber_loc = (rtx **) alloca (XVECLEN (body, 0) * sizeof (rtx **));
-
- for (i = 0; i < XVECLEN (body, 0); i++)
- if (GET_CODE (XVECEXP (body, 0, i)) == CLOBBER)
- {
- rtx clobber = XVECEXP (body, 0, i);
- rtx reg = XEXP (clobber, 0);
- rtx *loc = & XEXP (clobber, 0);
-
- if (GET_CODE (reg) == SUBREG && GET_CODE (SUBREG_REG (reg)) == REG)
- {
- loc = & SUBREG_REG (reg);
- reg = SUBREG_REG (reg);
- }
-
- if (STACK_REG_P (reg))
- {
- clobber_reg[n_clobbers] = reg;
- clobber_loc[n_clobbers] = loc;
- n_clobbers++;
- }
- }
- }
-
- bcopy ((char *) regstack, (char *) &temp_stack, sizeof (temp_stack));
-
- /* Put the input regs into the desired place in TEMP_STACK. */
-
- for (i = first_input; i < first_input + n_inputs; i++)
- if (STACK_REG_P (operands[i])
- && reg_class_subset_p (operand_class[i], FLOAT_REGS)
- && operand_class[i] != FLOAT_REGS)
- {
- /* If an operand needs to be in a particular reg in
- FLOAT_REGS, the constraint was either 't' or 'u'. Since
- these constraints are for single register classes, and reload
- guaranteed that operand[i] is already in that class, we can
- just use REGNO (operands[i]) to know which actual reg this
- operand needs to be in. */
-
- int regno = get_hard_regnum (&temp_stack, operands[i]);
-
- if (regno < 0)
- abort ();
-
- if (regno != REGNO (operands[i]))
- {
- /* operands[i] is not in the right place. Find it
- and swap it with whatever is already in I's place.
- K is where operands[i] is now. J is where it should
- be. */
- int j, k, temp;
-
- k = temp_stack.top - (regno - FIRST_STACK_REG);
- j = (temp_stack.top
- - (REGNO (operands[i]) - FIRST_STACK_REG));
-
- temp = temp_stack.reg[k];
- temp_stack.reg[k] = temp_stack.reg[j];
- temp_stack.reg[j] = temp;
- }
- }
-
- /* emit insns before INSN to make sure the reg-stack is in the right
- order. */
-
- change_stack (insn, regstack, &temp_stack, emit_insn_before);
-
- /* Make the needed input register substitutions. Do death notes and
- clobbers too, because these are for inputs, not outputs. */
-
- for (i = first_input; i < first_input + n_inputs; i++)
- if (STACK_REG_P (operands[i]))
- {
- int regnum = get_hard_regnum (regstack, operands[i]);
-
- if (regnum < 0)
- abort ();
-
- replace_reg (operands_loc[i], regnum);
- }
-
- for (i = 0; i < n_notes; i++)
- if (note_kind[i] == REG_DEAD)
- {
- int regnum = get_hard_regnum (regstack, note_reg[i]);
-
- if (regnum < 0)
- abort ();
-
- replace_reg (note_loc[i], regnum);
- }
-
- for (i = 0; i < n_clobbers; i++)
- {
- /* It's OK for a CLOBBER to reference a reg that is not live.
- Don't try to replace it in that case. */
- int regnum = get_hard_regnum (regstack, clobber_reg[i]);
-
- if (regnum >= 0)
- {
- /* Sigh - clobbers always have QImode. But replace_reg knows
- that these regs can't be MODE_INT and will abort. Just put
- the right reg there without calling replace_reg. */
-
- *clobber_loc[i] = FP_MODE_REG (regnum, DFmode);
- }
- }
-
- /* Now remove from REGSTACK any inputs that the asm implicitly popped. */
-
- for (i = first_input; i < first_input + n_inputs; i++)
- if (STACK_REG_P (operands[i]))
- {
- /* An input reg is implicitly popped if it is tied to an
- output, or if there is a CLOBBER for it. */
- int j;
-
- for (j = 0; j < n_clobbers; j++)
- if (operands_match_p (clobber_reg[j], operands[i]))
- break;
-
- if (j < n_clobbers || operand_matches[i] >= 0)
- {
- /* operands[i] might not be at the top of stack. But that's OK,
- because all we need to do is pop the right number of regs
- off of the top of the reg-stack. record_asm_stack_regs
- guaranteed that all implicitly popped regs were grouped
- at the top of the reg-stack. */
-
- CLEAR_HARD_REG_BIT (regstack->reg_set,
- regstack->reg[regstack->top]);
- regstack->top--;
- }
- }
-
- /* Now add to REGSTACK any outputs that the asm implicitly pushed.
- Note that there isn't any need to substitute register numbers.
- ??? Explain why this is true. */
-
- for (i = LAST_STACK_REG; i >= FIRST_STACK_REG; i--)
- {
- /* See if there is an output for this hard reg. */
- int j;
-
- for (j = 0; j < n_outputs; j++)
- if (STACK_REG_P (operands[j]) && REGNO (operands[j]) == i)
- {
- regstack->reg[++regstack->top] = i;
- SET_HARD_REG_BIT (regstack->reg_set, i);
- break;
- }
- }
-
- /* Now emit a pop insn for any REG_UNUSED output, or any REG_DEAD
- input that the asm didn't implicitly pop. If the asm didn't
- implicitly pop an input reg, that reg will still be live.
-
- Note that we can't use find_regno_note here: the register numbers
- in the death notes have already been substituted. */
-
- for (i = 0; i < n_outputs; i++)
- if (STACK_REG_P (operands[i]))
- {
- int j;
-
- for (j = 0; j < n_notes; j++)
- if (REGNO (operands[i]) == REGNO (note_reg[j])
- && note_kind[j] == REG_UNUSED)
- {
- insn = emit_pop_insn (insn, regstack, operands[i],
- emit_insn_after);
- break;
- }
- }
-
- for (i = first_input; i < first_input + n_inputs; i++)
- if (STACK_REG_P (operands[i]))
- {
- int j;
-
- for (j = 0; j < n_notes; j++)
- if (REGNO (operands[i]) == REGNO (note_reg[j])
- && note_kind[j] == REG_DEAD
- && TEST_HARD_REG_BIT (regstack->reg_set, REGNO (operands[i])))
- {
- insn = emit_pop_insn (insn, regstack, operands[i],
- emit_insn_after);
- break;
- }
- }
-}
-
-/* Substitute stack hard reg numbers for stack virtual registers in
- INSN. Non-stack register numbers are not changed. REGSTACK is the
- current stack content. Insns may be emitted as needed to arrange the
- stack for the 387 based on the contents of the insn. */
-
-static void
-subst_stack_regs (insn, regstack)
- rtx insn;
- stack regstack;
-{
- register rtx *note_link, note;
- register int i;
- int n_operands;
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- int top = regstack->top;
-
- /* If there are any floating point parameters to be passed in
- registers for this call, make sure they are in the right
- order. */
-
- if (top >= 0)
- {
- straighten_stack (PREV_INSN (insn), regstack);
-
- /* Now mark the arguments as dead after the call. */
-
- while (regstack->top >= 0)
- {
- CLEAR_HARD_REG_BIT (regstack->reg_set, FIRST_STACK_REG + regstack->top);
- regstack->top--;
- }
- }
- }
-
- /* Do the actual substitution if any stack regs are mentioned.
- Since we only record whether entire insn mentions stack regs, and
- subst_stack_regs_pat only works for patterns that contain stack regs,
- we must check each pattern in a parallel here. A call_value_pop could
- fail otherwise. */
-
- if (GET_MODE (insn) == QImode)
- {
- n_operands = asm_noperands (PATTERN (insn));
- if (n_operands >= 0)
- {
- /* This insn is an `asm' with operands. Decode the operands,
- decide how many are inputs, and do register substitution.
- Any REG_UNUSED notes will be handled by subst_asm_stack_regs. */
-
- rtx operands[MAX_RECOG_OPERANDS];
- rtx *operands_loc[MAX_RECOG_OPERANDS];
- rtx body = PATTERN (insn);
- int n_inputs, n_outputs;
- char **constraints
- = (char **) alloca (n_operands * sizeof (char *));
-
- decode_asm_operands (body, operands, operands_loc,
- constraints, NULL_PTR);
- get_asm_operand_lengths (body, n_operands, &n_inputs, &n_outputs);
- subst_asm_stack_regs (insn, regstack, operands, operands_loc,
- constraints, n_inputs, n_outputs);
- return;
- }
-
- if (GET_CODE (PATTERN (insn)) == PARALLEL)
- for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
- {
- if (stack_regs_mentioned_p (XVECEXP (PATTERN (insn), 0, i)))
- subst_stack_regs_pat (insn, regstack,
- XVECEXP (PATTERN (insn), 0, i));
- }
- else
- subst_stack_regs_pat (insn, regstack, PATTERN (insn));
- }
-
- /* subst_stack_regs_pat may have deleted a no-op insn. If so, any
- REG_UNUSED will already have been dealt with, so just return. */
-
- if (GET_CODE (insn) == NOTE)
- return;
-
- /* If there is a REG_UNUSED note on a stack register on this insn,
- the indicated reg must be popped. The REG_UNUSED note is removed,
- since the form of the newly emitted pop insn references the reg,
- making it no longer `unset'. */
-
- note_link = &REG_NOTES(insn);
- for (note = *note_link; note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_UNUSED && STACK_REG_P (XEXP (note, 0)))
- {
- *note_link = XEXP (note, 1);
- insn = emit_pop_insn (insn, regstack, XEXP (note, 0), emit_insn_after);
- }
- else
- note_link = &XEXP (note, 1);
-}
-
-/* Change the organization of the stack so that it fits a new basic
- block. Some registers might have to be popped, but there can never be
- a register live in the new block that is not now live.
-
- Insert any needed insns before or after INSN. WHEN is emit_insn_before
- or emit_insn_after. OLD is the original stack layout, and NEW is
- the desired form. OLD is updated to reflect the code emitted, ie, it
- will be the same as NEW upon return.
-
- This function will not preserve block_end[]. But that information
- is no longer needed once this has executed. */
-
-static void
-change_stack (insn, old, new, when)
- rtx insn;
- stack old;
- stack new;
- rtx (*when)();
-{
- int reg;
-
- /* We will be inserting new insns "backwards", by calling emit_insn_before.
- If we are to insert after INSN, find the next insn, and insert before
- it. */
-
- if (when == emit_insn_after)
- insn = NEXT_INSN (insn);
-
- /* Pop any registers that are not needed in the new block. */
-
- for (reg = old->top; reg >= 0; reg--)
- if (! TEST_HARD_REG_BIT (new->reg_set, old->reg[reg]))
- emit_pop_insn (insn, old, FP_MODE_REG (old->reg[reg], DFmode),
- emit_insn_before);
-
- if (new->top == -2)
- {
- /* If the new block has never been processed, then it can inherit
- the old stack order. */
-
- new->top = old->top;
- bcopy (old->reg, new->reg, sizeof (new->reg));
- }
- else
- {
- /* This block has been entered before, and we must match the
- previously selected stack order. */
-
- /* By now, the only difference should be the order of the stack,
- not their depth or liveliness. */
-
- GO_IF_HARD_REG_EQUAL (old->reg_set, new->reg_set, win);
-
- abort ();
-
- win:
-
- if (old->top != new->top)
- abort ();
-
- /* Loop here emitting swaps until the stack is correct. The
- worst case number of swaps emitted is N + 2, where N is the
- depth of the stack. In some cases, the reg at the top of
- stack may be correct, but swapped anyway in order to fix
- other regs. But since we never swap any other reg away from
- its correct slot, this algorithm will converge. */
-
- do
- {
- /* Swap the reg at top of stack into the position it is
- supposed to be in, until the correct top of stack appears. */
-
- while (old->reg[old->top] != new->reg[new->top])
- {
- for (reg = new->top; reg >= 0; reg--)
- if (new->reg[reg] == old->reg[old->top])
- break;
-
- if (reg == -1)
- abort ();
-
- emit_swap_insn (insn, old,
- FP_MODE_REG (old->reg[reg], DFmode));
- }
-
- /* See if any regs remain incorrect. If so, bring an
- incorrect reg to the top of stack, and let the while loop
- above fix it. */
-
- for (reg = new->top; reg >= 0; reg--)
- if (new->reg[reg] != old->reg[reg])
- {
- emit_swap_insn (insn, old,
- FP_MODE_REG (old->reg[reg], DFmode));
- break;
- }
- } while (reg >= 0);
-
- /* At this point there must be no differences. */
-
- for (reg = old->top; reg >= 0; reg--)
- if (old->reg[reg] != new->reg[reg])
- abort ();
- }
-}
-
-/* Check PAT, which points to RTL in INSN, for a LABEL_REF. If it is
- found, ensure that a jump from INSN to the code_label to which the
- label_ref points ends up with the same stack as that at the
- code_label. Do this by inserting insns just before the code_label to
- pop and rotate the stack until it is in the correct order. REGSTACK
- is the order of the register stack in INSN.
-
- Any code that is emitted here must not be later processed as part
- of any block, as it will already contain hard register numbers. */
-
-static void
-goto_block_pat (insn, regstack, pat)
- rtx insn;
- stack regstack;
- rtx pat;
-{
- rtx label;
- rtx new_jump, new_label, new_barrier;
- rtx *ref;
- stack label_stack;
- struct stack_def temp_stack;
- int reg;
-
- switch (GET_CODE (pat))
- {
- case RETURN:
- straighten_stack (PREV_INSN (insn), regstack);
- return;
- default:
- {
- int i, j;
- char *fmt = GET_RTX_FORMAT (GET_CODE (pat));
-
- for (i = GET_RTX_LENGTH (GET_CODE (pat)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- goto_block_pat (insn, regstack, XEXP (pat, i));
- if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (pat, i); j++)
- goto_block_pat (insn, regstack, XVECEXP (pat, i, j));
- }
- return;
- }
- case LABEL_REF:;
- }
-
- label = XEXP (pat, 0);
- if (GET_CODE (label) != CODE_LABEL)
- abort ();
-
- /* First, see if in fact anything needs to be done to the stack at all. */
- if (INSN_UID (label) <= 0)
- return;
-
- label_stack = &block_stack_in[BLOCK_NUM (label)];
-
- if (label_stack->top == -2)
- {
- /* If the target block hasn't had a stack order selected, then
- we need merely ensure that no pops are needed. */
-
- for (reg = regstack->top; reg >= 0; reg--)
- if (! TEST_HARD_REG_BIT (label_stack->reg_set, regstack->reg[reg]))
- break;
-
- if (reg == -1)
- {
- /* change_stack will not emit any code in this case. */
-
- change_stack (label, regstack, label_stack, emit_insn_after);
- return;
- }
- }
- else if (label_stack->top == regstack->top)
- {
- for (reg = label_stack->top; reg >= 0; reg--)
- if (label_stack->reg[reg] != regstack->reg[reg])
- break;
-
- if (reg == -1)
- return;
- }
-
- /* At least one insn will need to be inserted before label. Insert
- a jump around the code we are about to emit. Emit a label for the new
- code, and point the original insn at this new label. We can't use
- redirect_jump here, because we're using fld[4] of the code labels as
- LABEL_REF chains, no NUSES counters. */
-
- new_jump = emit_jump_insn_before (gen_jump (label), label);
- record_label_references (new_jump, PATTERN (new_jump));
- JUMP_LABEL (new_jump) = label;
-
- new_barrier = emit_barrier_after (new_jump);
-
- new_label = gen_label_rtx ();
- emit_label_after (new_label, new_barrier);
- LABEL_REFS (new_label) = new_label;
-
- /* The old label_ref will no longer point to the code_label if now uses,
- so strip the label_ref from the code_label's chain of references. */
-
- for (ref = &LABEL_REFS (label); *ref != label; ref = &LABEL_NEXTREF (*ref))
- if (*ref == pat)
- break;
-
- if (*ref == label)
- abort ();
-
- *ref = LABEL_NEXTREF (*ref);
-
- XEXP (pat, 0) = new_label;
- record_label_references (insn, PATTERN (insn));
-
- if (JUMP_LABEL (insn) == label)
- JUMP_LABEL (insn) = new_label;
-
- /* Now emit the needed code. */
-
- temp_stack = *regstack;
-
- change_stack (new_label, &temp_stack, label_stack, emit_insn_after);
-}
-
-/* Traverse all basic blocks in a function, converting the register
- references in each insn from the "flat" register file that gcc uses, to
- the stack-like registers the 387 uses. */
-
-static void
-convert_regs ()
-{
- register int block, reg;
- register rtx insn, next;
- struct stack_def regstack;
-
- for (block = 0; block < blocks; block++)
- {
- if (block_stack_in[block].top == -2)
- {
- /* This block has not been previously encountered. Choose a
- default mapping for any stack regs live on entry */
-
- block_stack_in[block].top = -1;
-
- for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; reg--)
- if (TEST_HARD_REG_BIT (block_stack_in[block].reg_set, reg))
- block_stack_in[block].reg[++block_stack_in[block].top] = reg;
- }
-
- /* Process all insns in this block. Keep track of `next' here,
- so that we don't process any insns emitted while making
- substitutions in INSN. */
-
- next = block_begin[block];
- regstack = block_stack_in[block];
- do
- {
- insn = next;
- next = NEXT_INSN (insn);
-
- /* Don't bother processing unless there is a stack reg
- mentioned or if it's a CALL_INSN (register passing of
- floating point values). */
-
- if (GET_MODE (insn) == QImode || GET_CODE (insn) == CALL_INSN)
- subst_stack_regs (insn, &regstack);
-
- } while (insn != block_end[block]);
-
- /* Something failed if the stack life doesn't match. */
-
- GO_IF_HARD_REG_EQUAL (regstack.reg_set, block_out_reg_set[block], win);
-
- abort ();
-
- win:
-
- /* Adjust the stack of this block on exit to match the stack of
- the target block, or copy stack information into stack of
- jump target if the target block's stack order hasn't been set
- yet. */
-
- if (GET_CODE (insn) == JUMP_INSN)
- goto_block_pat (insn, &regstack, PATTERN (insn));
-
- /* Likewise handle the case where we fall into the next block. */
-
- if ((block < blocks - 1) && block_drops_in[block+1])
- change_stack (insn, &regstack, &block_stack_in[block+1],
- emit_insn_after);
- }
-
- /* If the last basic block is the end of a loop, and that loop has
- regs live at its start, then the last basic block will have regs live
- at its end that need to be popped before the function returns. */
-
- {
- int value_reg_low, value_reg_high;
- value_reg_low = value_reg_high = -1;
- {
- rtx retvalue;
- if (retvalue = stack_result (current_function_decl))
- {
- value_reg_low = REGNO (retvalue);
- value_reg_high = value_reg_low +
- HARD_REGNO_NREGS (value_reg_low, GET_MODE (retvalue)) - 1;
- }
-
- }
- for (reg = regstack.top; reg >= 0; reg--)
- if (regstack.reg[reg] < value_reg_low ||
- regstack.reg[reg] > value_reg_high)
- insn = emit_pop_insn (insn, &regstack,
- FP_MODE_REG (regstack.reg[reg], DFmode),
- emit_insn_after);
- }
- straighten_stack (insn, &regstack);
-}
-
-/* Check expression PAT, which is in INSN, for label references. if
- one is found, print the block number of destination to FILE. */
-
-static void
-print_blocks (file, insn, pat)
- FILE *file;
- rtx insn, pat;
-{
- register RTX_CODE code = GET_CODE (pat);
- register int i;
- register char *fmt;
-
- if (code == LABEL_REF)
- {
- register rtx label = XEXP (pat, 0);
-
- if (GET_CODE (label) != CODE_LABEL)
- abort ();
-
- fprintf (file, " %d", BLOCK_NUM (label));
-
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- print_blocks (file, insn, XEXP (pat, i));
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (pat, i); j++)
- print_blocks (file, insn, XVECEXP (pat, i, j));
- }
- }
-}
-
-/* Write information about stack registers and stack blocks into FILE.
- This is part of making a debugging dump. */
-
-static void
-dump_stack_info (file)
- FILE *file;
-{
- register int block;
-
- fprintf (file, "\n%d stack blocks.\n", blocks);
- for (block = 0; block < blocks; block++)
- {
- register rtx head, jump, end;
- register int regno;
-
- fprintf (file, "\nStack block %d: first insn %d, last %d.\n",
- block, INSN_UID (block_begin[block]),
- INSN_UID (block_end[block]));
-
- head = block_begin[block];
-
- fprintf (file, "Reached from blocks: ");
- if (GET_CODE (head) == CODE_LABEL)
- for (jump = LABEL_REFS (head);
- jump != head;
- jump = LABEL_NEXTREF (jump))
- {
- register int from_block = BLOCK_NUM (CONTAINING_INSN (jump));
- fprintf (file, " %d", from_block);
- }
- if (block_drops_in[block])
- fprintf (file, " previous");
-
- fprintf (file, "\nlive stack registers on block entry: ");
- for (regno = FIRST_STACK_REG; regno <= LAST_STACK_REG; regno++)
- {
- if (TEST_HARD_REG_BIT (block_stack_in[block].reg_set, regno))
- fprintf (file, "%d ", regno);
- }
-
- fprintf (file, "\nlive stack registers on block exit: ");
- for (regno = FIRST_STACK_REG; regno <= LAST_STACK_REG; regno++)
- {
- if (TEST_HARD_REG_BIT (block_out_reg_set[block], regno))
- fprintf (file, "%d ", regno);
- }
-
- end = block_end[block];
-
- fprintf (file, "\nJumps to blocks: ");
- if (GET_CODE (end) == JUMP_INSN)
- print_blocks (file, end, PATTERN (end));
-
- if (block + 1 < blocks && block_drops_in[block+1])
- fprintf (file, " next");
- else if (block + 1 == blocks
- || (GET_CODE (end) == JUMP_INSN
- && GET_CODE (PATTERN (end)) == RETURN))
- fprintf (file, " return");
-
- fprintf (file, "\n");
- }
-}
-#endif /* STACK_REGS */
diff --git a/gcc/regclass.c b/gcc/regclass.c
deleted file mode 100644
index f5624722813..00000000000
--- a/gcc/regclass.c
+++ /dev/null
@@ -1,1910 +0,0 @@
-/* Compute register class preferences for pseudo-registers.
- Copyright (C) 1987, 88, 91, 92, 93, 94, 1996 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 contains two passes of the compiler: reg_scan and reg_class.
- It also defines some tables of information about the hardware registers
- and a function init_reg_sets to initialize the tables. */
-
-#include "config.h"
-#include "rtl.h"
-#include "hard-reg-set.h"
-#include "flags.h"
-#include "basic-block.h"
-#include "regs.h"
-#include "insn-config.h"
-#include "recog.h"
-#include "reload.h"
-#include "real.h"
-#include "bytecode.h"
-
-#ifndef REGISTER_MOVE_COST
-#define REGISTER_MOVE_COST(x, y) 2
-#endif
-
-#ifndef MEMORY_MOVE_COST
-#define MEMORY_MOVE_COST(x) 4
-#endif
-
-/* If we have auto-increment or auto-decrement and we can have secondary
- reloads, we are not allowed to use classes requiring secondary
- reloads for pseudos auto-incremented since reload can't handle it. */
-
-#ifdef AUTO_INC_DEC
-#if defined(SECONDARY_INPUT_RELOAD_CLASS) || defined(SECONDARY_OUTPUT_RELOAD_CLASS)
-#define FORBIDDEN_INC_DEC_CLASSES
-#endif
-#endif
-
-/* Register tables used by many passes. */
-
-/* Indexed by hard register number, contains 1 for registers
- that are fixed use (stack pointer, pc, frame pointer, etc.).
- These are the registers that cannot be used to allocate
- a pseudo reg whose life does not cross calls. */
-
-char fixed_regs[FIRST_PSEUDO_REGISTER];
-
-/* Same info as a HARD_REG_SET. */
-
-HARD_REG_SET fixed_reg_set;
-
-/* Data for initializing the above. */
-
-static char initial_fixed_regs[] = FIXED_REGISTERS;
-
-/* Indexed by hard register number, contains 1 for registers
- that are fixed use or are clobbered by function calls.
- These are the registers that cannot be used to allocate
- a pseudo reg whose life crosses calls. */
-
-char call_used_regs[FIRST_PSEUDO_REGISTER];
-
-/* Same info as a HARD_REG_SET. */
-
-HARD_REG_SET call_used_reg_set;
-
-/* HARD_REG_SET of registers we want to avoid caller saving. */
-HARD_REG_SET losing_caller_save_reg_set;
-
-/* Data for initializing the above. */
-
-static char initial_call_used_regs[] = CALL_USED_REGISTERS;
-
-/* Indexed by hard register number, contains 1 for registers that are
- fixed use -- i.e. in fixed_regs -- or a function value return register
- or STRUCT_VALUE_REGNUM or STATIC_CHAIN_REGNUM. These are the
- registers that cannot hold quantities across calls even if we are
- willing to save and restore them. */
-
-char call_fixed_regs[FIRST_PSEUDO_REGISTER];
-
-/* The same info as a HARD_REG_SET. */
-
-HARD_REG_SET call_fixed_reg_set;
-
-/* Number of non-fixed registers. */
-
-int n_non_fixed_regs;
-
-/* Indexed by hard register number, contains 1 for registers
- that are being used for global register decls.
- These must be exempt from ordinary flow analysis
- and are also considered fixed. */
-
-char global_regs[FIRST_PSEUDO_REGISTER];
-
-/* Table of register numbers in the order in which to try to use them. */
-#ifdef REG_ALLOC_ORDER
-int reg_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER;
-#endif
-
-/* For each reg class, a HARD_REG_SET saying which registers are in it. */
-
-HARD_REG_SET reg_class_contents[N_REG_CLASSES];
-
-/* The same information, but as an array of unsigned ints. We copy from
- these unsigned ints to the table above. We do this so the tm.h files
- do not have to be aware of the wordsize for machines with <= 64 regs. */
-
-#define N_REG_INTS \
- ((FIRST_PSEUDO_REGISTER + (HOST_BITS_PER_INT - 1)) / HOST_BITS_PER_INT)
-
-static unsigned int_reg_class_contents[N_REG_CLASSES][N_REG_INTS]
- = REG_CLASS_CONTENTS;
-
-/* For each reg class, number of regs it contains. */
-
-int reg_class_size[N_REG_CLASSES];
-
-/* For each reg class, table listing all the containing classes. */
-
-enum reg_class reg_class_superclasses[N_REG_CLASSES][N_REG_CLASSES];
-
-/* For each reg class, table listing all the classes contained in it. */
-
-enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
-
-/* For each pair of reg classes,
- a largest reg class contained in their union. */
-
-enum reg_class reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES];
-
-/* For each pair of reg classes,
- the smallest reg class containing their union. */
-
-enum reg_class reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES];
-
-/* Array containing all of the register names */
-
-char *reg_names[] = REGISTER_NAMES;
-
-/* For each hard register, the widest mode object that it can contain.
- This will be a MODE_INT mode if the register can hold integers. Otherwise
- it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the
- register. */
-
-enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
-
-/* Indexed by n, gives number of times (REG n) is set or clobbered.
- This information remains valid for the rest of the compilation
- of the current function; it is used to control register allocation.
-
- This information applies to both hard registers and pseudo registers,
- unlike much of the information above. */
-
-short *reg_n_sets;
-
-/* Maximum cost of moving from a register in one class to a register in
- another class. Based on REGISTER_MOVE_COST. */
-
-static int move_cost[N_REG_CLASSES][N_REG_CLASSES];
-
-/* Similar, but here we don't have to move if the first index is a subset
- of the second so in that case the cost is zero. */
-
-static int may_move_cost[N_REG_CLASSES][N_REG_CLASSES];
-
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-
-/* These are the classes that regs which are auto-incremented or decremented
- cannot be put in. */
-
-static int forbidden_inc_dec_class[N_REG_CLASSES];
-
-/* Indexed by n, is non-zero if (REG n) is used in an auto-inc or auto-dec
- context. */
-
-static char *in_inc_dec;
-
-#endif /* FORBIDDEN_INC_DEC_CLASSES */
-
-/* Function called only once to initialize the above data on reg usage.
- Once this is done, various switches may override. */
-
-void
-init_reg_sets ()
-{
- register int i, j;
-
- /* First copy the register information from the initial int form into
- the regsets. */
-
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- CLEAR_HARD_REG_SET (reg_class_contents[i]);
-
- for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
- if (int_reg_class_contents[i][j / HOST_BITS_PER_INT]
- & ((unsigned) 1 << (j % HOST_BITS_PER_INT)))
- SET_HARD_REG_BIT (reg_class_contents[i], j);
- }
-
- bcopy (initial_fixed_regs, fixed_regs, sizeof fixed_regs);
- bcopy (initial_call_used_regs, call_used_regs, sizeof call_used_regs);
- bzero (global_regs, sizeof global_regs);
-
- /* Compute number of hard regs in each class. */
-
- bzero ((char *) reg_class_size, sizeof reg_class_size);
- for (i = 0; i < N_REG_CLASSES; i++)
- for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
- if (TEST_HARD_REG_BIT (reg_class_contents[i], j))
- reg_class_size[i]++;
-
- /* Initialize the table of subunions.
- reg_class_subunion[I][J] gets the largest-numbered reg-class
- that is contained in the union of classes I and J. */
-
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- for (j = 0; j < N_REG_CLASSES; j++)
- {
-#ifdef HARD_REG_SET
- register /* Declare it register if it's a scalar. */
-#endif
- HARD_REG_SET c;
- register int k;
-
- COPY_HARD_REG_SET (c, reg_class_contents[i]);
- IOR_HARD_REG_SET (c, reg_class_contents[j]);
- for (k = 0; k < N_REG_CLASSES; k++)
- {
- GO_IF_HARD_REG_SUBSET (reg_class_contents[k], c,
- subclass1);
- continue;
-
- subclass1:
- /* keep the largest subclass */ /* SPEE 900308 */
- GO_IF_HARD_REG_SUBSET (reg_class_contents[k],
- reg_class_contents[(int) reg_class_subunion[i][j]],
- subclass2);
- reg_class_subunion[i][j] = (enum reg_class) k;
- subclass2:
- ;
- }
- }
- }
-
- /* Initialize the table of superunions.
- reg_class_superunion[I][J] gets the smallest-numbered reg-class
- containing the union of classes I and J. */
-
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- for (j = 0; j < N_REG_CLASSES; j++)
- {
-#ifdef HARD_REG_SET
- register /* Declare it register if it's a scalar. */
-#endif
- HARD_REG_SET c;
- register int k;
-
- COPY_HARD_REG_SET (c, reg_class_contents[i]);
- IOR_HARD_REG_SET (c, reg_class_contents[j]);
- for (k = 0; k < N_REG_CLASSES; k++)
- GO_IF_HARD_REG_SUBSET (c, reg_class_contents[k], superclass);
-
- superclass:
- reg_class_superunion[i][j] = (enum reg_class) k;
- }
- }
-
- /* Initialize the tables of subclasses and superclasses of each reg class.
- First clear the whole table, then add the elements as they are found. */
-
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- for (j = 0; j < N_REG_CLASSES; j++)
- {
- reg_class_superclasses[i][j] = LIM_REG_CLASSES;
- reg_class_subclasses[i][j] = LIM_REG_CLASSES;
- }
- }
-
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- if (i == (int) NO_REGS)
- continue;
-
- for (j = i + 1; j < N_REG_CLASSES; j++)
- {
- enum reg_class *p;
-
- GO_IF_HARD_REG_SUBSET (reg_class_contents[i], reg_class_contents[j],
- subclass);
- continue;
- subclass:
- /* Reg class I is a subclass of J.
- Add J to the table of superclasses of I. */
- p = &reg_class_superclasses[i][0];
- while (*p != LIM_REG_CLASSES) p++;
- *p = (enum reg_class) j;
- /* Add I to the table of superclasses of J. */
- p = &reg_class_subclasses[j][0];
- while (*p != LIM_REG_CLASSES) p++;
- *p = (enum reg_class) i;
- }
- }
-
- /* Initialize the move cost table. Find every subset of each class
- and take the maximum cost of moving any subset to any other. */
-
- for (i = 0; i < N_REG_CLASSES; i++)
- for (j = 0; j < N_REG_CLASSES; j++)
- {
- int cost = i == j ? 2 : REGISTER_MOVE_COST (i, j);
- enum reg_class *p1, *p2;
-
- for (p2 = &reg_class_subclasses[j][0]; *p2 != LIM_REG_CLASSES; p2++)
- if (*p2 != i)
- cost = MAX (cost, REGISTER_MOVE_COST (i, *p2));
-
- for (p1 = &reg_class_subclasses[i][0]; *p1 != LIM_REG_CLASSES; p1++)
- {
- if (*p1 != j)
- cost = MAX (cost, REGISTER_MOVE_COST (*p1, j));
-
- for (p2 = &reg_class_subclasses[j][0];
- *p2 != LIM_REG_CLASSES; p2++)
- if (*p1 != *p2)
- cost = MAX (cost, REGISTER_MOVE_COST (*p1, *p2));
- }
-
- move_cost[i][j] = cost;
-
- if (reg_class_subset_p (i, j))
- cost = 0;
-
- may_move_cost[i][j] = cost;
- }
-}
-
-/* After switches have been processed, which perhaps alter
- `fixed_regs' and `call_used_regs', convert them to HARD_REG_SETs. */
-
-static void
-init_reg_sets_1 ()
-{
- register int i;
-
- /* This macro allows the fixed or call-used registers
- to depend on target flags. */
-
-#ifdef CONDITIONAL_REGISTER_USAGE
- CONDITIONAL_REGISTER_USAGE;
-#endif
-
- /* Initialize "constant" tables. */
-
- CLEAR_HARD_REG_SET (fixed_reg_set);
- CLEAR_HARD_REG_SET (call_used_reg_set);
- CLEAR_HARD_REG_SET (call_fixed_reg_set);
-
- bcopy (fixed_regs, call_fixed_regs, sizeof call_fixed_regs);
-
- n_non_fixed_regs = 0;
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (fixed_regs[i])
- SET_HARD_REG_BIT (fixed_reg_set, i);
- else
- n_non_fixed_regs++;
-
- if (call_used_regs[i])
- SET_HARD_REG_BIT (call_used_reg_set, i);
- if (call_fixed_regs[i])
- SET_HARD_REG_BIT (call_fixed_reg_set, i);
- if (CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (i)))
- SET_HARD_REG_BIT (losing_caller_save_reg_set, i);
- }
-}
-
-/* Compute the table of register modes.
- These values are used to record death information for individual registers
- (as opposed to a multi-register mode). */
-
-static void
-init_reg_modes ()
-{
- register int i;
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- reg_raw_mode[i] = choose_hard_reg_mode (i, 1);
-
- /* If we couldn't find a valid mode, fall back to `word_mode'.
- ??? We assume `word_mode' has already been initialized.
- ??? One situation in which we need to do this is on the mips where
- HARD_REGNO_NREGS (fpreg, [SD]Fmode) returns 2. Ideally we'd like
- to use DF mode for the even registers and VOIDmode for the odd
- (for the cpu models where the odd ones are inaccessible). */
- if (reg_raw_mode[i] == VOIDmode)
- reg_raw_mode[i] = word_mode;
- }
-}
-
-/* Finish initializing the register sets and
- initialize the register modes. */
-
-void
-init_regs ()
-{
- /* This finishes what was started by init_reg_sets, but couldn't be done
- until after register usage was specified. */
- if (!output_bytecode)
- init_reg_sets_1 ();
-
- init_reg_modes ();
-}
-
-/* Return a machine mode that is legitimate for hard reg REGNO and large
- enough to save nregs. If we can't find one, return VOIDmode. */
-
-enum machine_mode
-choose_hard_reg_mode (regno, nregs)
- int regno;
- int nregs;
-{
- enum machine_mode found_mode = VOIDmode, mode;
-
- /* We first look for the largest integer mode that can be validly
- held in REGNO. If none, we look for the largest floating-point mode.
- If we still didn't find a valid mode, try CCmode. */
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if (HARD_REGNO_NREGS (regno, mode) == nregs
- && HARD_REGNO_MODE_OK (regno, mode))
- found_mode = mode;
-
- if (found_mode != VOIDmode)
- return found_mode;
-
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
- mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if (HARD_REGNO_NREGS (regno, mode) == nregs
- && HARD_REGNO_MODE_OK (regno, mode))
- found_mode = mode;
-
- if (found_mode != VOIDmode)
- return found_mode;
-
- if (HARD_REGNO_NREGS (regno, CCmode) == nregs
- && HARD_REGNO_MODE_OK (regno, CCmode))
- return CCmode;
-
- /* We can't find a mode valid for this register. */
- return VOIDmode;
-}
-
-/* Specify the usage characteristics of the register named NAME.
- It should be a fixed register if FIXED and a
- call-used register if CALL_USED. */
-
-void
-fix_register (name, fixed, call_used)
- char *name;
- int fixed, call_used;
-{
- int i;
-
- if (output_bytecode)
- {
- warning ("request to mark `%s' as %s ignored by bytecode compiler",
- name, call_used ? "call-used" : "fixed");
- return;
- }
-
- /* Decode the name and update the primary form of
- the register info. */
-
- if ((i = decode_reg_name (name)) >= 0)
- {
- fixed_regs[i] = fixed;
- call_used_regs[i] = call_used;
- }
- else
- {
- warning ("unknown register name: %s", name);
- }
-}
-
-/* Mark register number I as global. */
-
-void
-globalize_reg (i)
- int i;
-{
- if (global_regs[i])
- {
- warning ("register used for two global register variables");
- return;
- }
-
- if (call_used_regs[i] && ! fixed_regs[i])
- warning ("call-clobbered register used for global register variable");
-
- global_regs[i] = 1;
-
- /* If already fixed, nothing else to do. */
- if (fixed_regs[i])
- return;
-
- fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 1;
- n_non_fixed_regs--;
-
- SET_HARD_REG_BIT (fixed_reg_set, i);
- SET_HARD_REG_BIT (call_used_reg_set, i);
- SET_HARD_REG_BIT (call_fixed_reg_set, i);
-}
-
-/* Now the data and code for the `regclass' pass, which happens
- just before local-alloc. */
-
-/* The `costs' struct records the cost of using a hard register of each class
- and of using memory for each pseudo. We use this data to set up
- register class preferences. */
-
-struct costs
-{
- int cost[N_REG_CLASSES];
- int mem_cost;
-};
-
-/* Record the cost of each class for each pseudo. */
-
-static struct costs *costs;
-
-/* Record the same data by operand number, accumulated for each alternative
- in an insn. The contribution to a pseudo is that of the minimum-cost
- alternative. */
-
-static struct costs op_costs[MAX_RECOG_OPERANDS];
-
-/* (enum reg_class) prefclass[R] is the preferred class for pseudo number R.
- This is available after `regclass' is run. */
-
-static char *prefclass;
-
-/* altclass[R] is a register class that we should use for allocating
- pseudo number R if no register in the preferred class is available.
- If no register in this class is available, memory is preferred.
-
- It might appear to be more general to have a bitmask of classes here,
- but since it is recommended that there be a class corresponding to the
- union of most major pair of classes, that generality is not required.
-
- This is available after `regclass' is run. */
-
-static char *altclass;
-
-/* Record the depth of loops that we are in. */
-
-static int loop_depth;
-
-/* Account for the fact that insns within a loop are executed very commonly,
- but don't keep doing this as loops go too deep. */
-
-static int loop_cost;
-
-static void record_reg_classes PROTO((int, int, rtx *, enum machine_mode *,
- char **, rtx));
-static int copy_cost PROTO((rtx, enum machine_mode,
- enum reg_class, int));
-static void record_address_regs PROTO((rtx, enum reg_class, int));
-static auto_inc_dec_reg_p PROTO((rtx, enum machine_mode));
-static void reg_scan_mark_refs PROTO((rtx, rtx, int));
-
-/* Return the reg_class in which pseudo reg number REGNO is best allocated.
- This function is sometimes called before the info has been computed.
- When that happens, just return GENERAL_REGS, which is innocuous. */
-
-enum reg_class
-reg_preferred_class (regno)
- int regno;
-{
- if (prefclass == 0)
- return GENERAL_REGS;
- return (enum reg_class) prefclass[regno];
-}
-
-enum reg_class
-reg_alternate_class (regno)
-{
- if (prefclass == 0)
- return ALL_REGS;
-
- return (enum reg_class) altclass[regno];
-}
-
-/* This prevents dump_flow_info from losing if called
- before regclass is run. */
-
-void
-regclass_init ()
-{
- prefclass = 0;
-}
-
-/* This is a pass of the compiler that scans all instructions
- and calculates the preferred class for each pseudo-register.
- This information can be accessed later by calling `reg_preferred_class'.
- This pass comes just before local register allocation. */
-
-void
-regclass (f, nregs)
- rtx f;
- int nregs;
-{
-#ifdef REGISTER_CONSTRAINTS
- register rtx insn;
- register int i, j;
- struct costs init_cost;
- rtx set;
- int pass;
-
- init_recog ();
-
- costs = (struct costs *) alloca (nregs * sizeof (struct costs));
-
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-
- in_inc_dec = (char *) alloca (nregs);
-
- /* Initialize information about which register classes can be used for
- pseudos that are auto-incremented or auto-decremented. It would
- seem better to put this in init_reg_sets, but we need to be able
- to allocate rtx, which we can't do that early. */
-
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- rtx r = gen_rtx (REG, VOIDmode, 0);
- enum machine_mode m;
-
- for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
- if (TEST_HARD_REG_BIT (reg_class_contents[i], j))
- {
- REGNO (r) = j;
-
- for (m = VOIDmode; (int) m < (int) MAX_MACHINE_MODE;
- m = (enum machine_mode) ((int) m + 1))
- if (HARD_REGNO_MODE_OK (j, m))
- {
- PUT_MODE (r, m);
-
- /* If a register is not directly suitable for an
- auto-increment or decrement addressing mode and
- requires secondary reloads, disallow its class from
- being used in such addresses. */
-
- if ((0
-#ifdef SECONDARY_RELOAD_CLASS
- || (SECONDARY_RELOAD_CLASS (BASE_REG_CLASS, m, r)
- != NO_REGS)
-#else
-#ifdef SECONDARY_INPUT_RELOAD_CLASS
- || (SECONDARY_INPUT_RELOAD_CLASS (BASE_REG_CLASS, m, r)
- != NO_REGS)
-#endif
-#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
- || (SECONDARY_OUTPUT_RELOAD_CLASS (BASE_REG_CLASS, m, r)
- != NO_REGS)
-#endif
-#endif
- )
- && ! auto_inc_dec_reg_p (r, m))
- forbidden_inc_dec_class[i] = 1;
- }
- }
- }
-#endif /* FORBIDDEN_INC_DEC_CLASSES */
-
- init_cost.mem_cost = 10000;
- for (i = 0; i < N_REG_CLASSES; i++)
- init_cost.cost[i] = 10000;
-
- /* Normally we scan the insns once and determine the best class to use for
- each register. However, if -fexpensive_optimizations are on, we do so
- twice, the second time using the tentative best classes to guide the
- selection. */
-
- for (pass = 0; pass <= flag_expensive_optimizations; pass++)
- {
- /* Zero out our accumulation of the cost of each class for each reg. */
-
- bzero ((char *) costs, nregs * sizeof (struct costs));
-
-#ifdef FORBIDDEN_INC_DEC_CLASSES
- bzero (in_inc_dec, nregs);
-#endif
-
- loop_depth = 0, loop_cost = 1;
-
- /* Scan the instructions and record each time it would
- save code to put a certain register in a certain class. */
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- {
- char *constraints[MAX_RECOG_OPERANDS];
- enum machine_mode modes[MAX_RECOG_OPERANDS];
- int nalternatives;
- int noperands;
-
- /* Show that an insn inside a loop is likely to be executed three
- times more than insns outside a loop. This is much more aggressive
- than the assumptions made elsewhere and is being tried as an
- experiment. */
-
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- loop_depth++, loop_cost = 1 << (2 * MIN (loop_depth, 5));
- else if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- loop_depth--, loop_cost = 1 << (2 * MIN (loop_depth, 5));
-
- else if ((GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) != USE
- && GET_CODE (PATTERN (insn)) != CLOBBER
- && GET_CODE (PATTERN (insn)) != ASM_INPUT)
- || (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) != ADDR_VEC
- && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC)
- || GET_CODE (insn) == CALL_INSN)
- {
- if (GET_CODE (insn) == INSN
- && (noperands = asm_noperands (PATTERN (insn))) >= 0)
- {
- decode_asm_operands (PATTERN (insn), recog_operand, NULL_PTR,
- constraints, modes);
- nalternatives = (noperands == 0 ? 0
- : n_occurrences (',', constraints[0]) + 1);
- }
- else
- {
- int insn_code_number = recog_memoized (insn);
- rtx note;
-
- set = single_set (insn);
- insn_extract (insn);
-
- nalternatives = insn_n_alternatives[insn_code_number];
- noperands = insn_n_operands[insn_code_number];
-
- /* If this insn loads a parameter from its stack slot, then
- it represents a savings, rather than a cost, if the
- parameter is stored in memory. Record this fact. */
-
- if (set != 0 && GET_CODE (SET_DEST (set)) == REG
- && GET_CODE (SET_SRC (set)) == MEM
- && (note = find_reg_note (insn, REG_EQUIV,
- NULL_RTX)) != 0
- && GET_CODE (XEXP (note, 0)) == MEM)
- {
- costs[REGNO (SET_DEST (set))].mem_cost
- -= (MEMORY_MOVE_COST (GET_MODE (SET_DEST (set)))
- * loop_cost);
- record_address_regs (XEXP (SET_SRC (set), 0),
- BASE_REG_CLASS, loop_cost * 2);
- continue;
- }
-
- /* Improve handling of two-address insns such as
- (set X (ashift CONST Y)) where CONST must be made to
- match X. Change it into two insns: (set X CONST)
- (set X (ashift X Y)). If we left this for reloading, it
- would probably get three insns because X and Y might go
- in the same place. This prevents X and Y from receiving
- the same hard reg.
-
- We can only do this if the modes of operands 0 and 1
- (which might not be the same) are tieable and we only need
- do this during our first pass. */
-
- if (pass == 0 && optimize
- && noperands >= 3
- && insn_operand_constraint[insn_code_number][1][0] == '0'
- && insn_operand_constraint[insn_code_number][1][1] == 0
- && CONSTANT_P (recog_operand[1])
- && ! rtx_equal_p (recog_operand[0], recog_operand[1])
- && ! rtx_equal_p (recog_operand[0], recog_operand[2])
- && GET_CODE (recog_operand[0]) == REG
- && MODES_TIEABLE_P (GET_MODE (recog_operand[0]),
- insn_operand_mode[insn_code_number][1]))
- {
- rtx previnsn = prev_real_insn (insn);
- rtx dest
- = gen_lowpart (insn_operand_mode[insn_code_number][1],
- recog_operand[0]);
- rtx newinsn
- = emit_insn_before (gen_move_insn (dest,
- recog_operand[1]),
- insn);
-
- /* If this insn was the start of a basic block,
- include the new insn in that block.
- We need not check for code_label here;
- while a basic block can start with a code_label,
- INSN could not be at the beginning of that block. */
- if (previnsn == 0 || GET_CODE (previnsn) == JUMP_INSN)
- {
- int b;
- for (b = 0; b < n_basic_blocks; b++)
- if (insn == basic_block_head[b])
- basic_block_head[b] = newinsn;
- }
-
- /* This makes one more setting of new insns's dest. */
- reg_n_sets[REGNO (recog_operand[0])]++;
-
- *recog_operand_loc[1] = recog_operand[0];
- for (i = insn_n_dups[insn_code_number] - 1; i >= 0; i--)
- if (recog_dup_num[i] == 1)
- *recog_dup_loc[i] = recog_operand[0];
-
- insn = PREV_INSN (newinsn);
- continue;
- }
-
- for (i = 0; i < noperands; i++)
- {
- constraints[i]
- = insn_operand_constraint[insn_code_number][i];
- modes[i] = insn_operand_mode[insn_code_number][i];
- }
- }
-
- /* If we get here, we are set up to record the costs of all the
- operands for this insn. Start by initializing the costs.
- Then handle any address registers. Finally record the desired
- classes for any pseudos, doing it twice if some pair of
- operands are commutative. */
-
- for (i = 0; i < noperands; i++)
- {
- op_costs[i] = init_cost;
-
- if (GET_CODE (recog_operand[i]) == SUBREG)
- recog_operand[i] = SUBREG_REG (recog_operand[i]);
-
- if (GET_CODE (recog_operand[i]) == MEM)
- record_address_regs (XEXP (recog_operand[i], 0),
- BASE_REG_CLASS, loop_cost * 2);
- else if (constraints[i][0] == 'p')
- record_address_regs (recog_operand[i],
- BASE_REG_CLASS, loop_cost * 2);
- }
-
- /* Check for commutative in a separate loop so everything will
- have been initialized. We must do this even if one operand
- is a constant--see addsi3 in m68k.md. */
-
- for (i = 0; i < noperands - 1; i++)
- if (constraints[i][0] == '%')
- {
- char *xconstraints[MAX_RECOG_OPERANDS];
- int j;
-
- /* Handle commutative operands by swapping the constraints.
- We assume the modes are the same. */
-
- for (j = 0; j < noperands; j++)
- xconstraints[j] = constraints[j];
-
- xconstraints[i] = constraints[i+1];
- xconstraints[i+1] = constraints[i];
- record_reg_classes (nalternatives, noperands,
- recog_operand, modes, xconstraints,
- insn);
- }
-
- record_reg_classes (nalternatives, noperands, recog_operand,
- modes, constraints, insn);
-
- /* Now add the cost for each operand to the total costs for
- its register. */
-
- for (i = 0; i < noperands; i++)
- if (GET_CODE (recog_operand[i]) == REG
- && REGNO (recog_operand[i]) >= FIRST_PSEUDO_REGISTER)
- {
- int regno = REGNO (recog_operand[i]);
- struct costs *p = &costs[regno], *q = &op_costs[i];
-
- p->mem_cost += q->mem_cost * loop_cost;
- for (j = 0; j < N_REG_CLASSES; j++)
- p->cost[j] += q->cost[j] * loop_cost;
- }
- }
- }
-
- /* Now for each register look at how desirable each class is
- and find which class is preferred. Store that in
- `prefclass[REGNO]'. Record in `altclass[REGNO]' the largest register
- class any of whose registers is better than memory. */
-
- if (pass == 0)
- {
- prefclass = (char *) oballoc (nregs);
- altclass = (char *) oballoc (nregs);
- }
-
- for (i = FIRST_PSEUDO_REGISTER; i < nregs; i++)
- {
- register int best_cost = (1 << (HOST_BITS_PER_INT - 2)) - 1;
- enum reg_class best = ALL_REGS, alt = NO_REGS;
- /* This is an enum reg_class, but we call it an int
- to save lots of casts. */
- register int class;
- register struct costs *p = &costs[i];
-
- for (class = (int) ALL_REGS - 1; class > 0; class--)
- {
- /* Ignore classes that are too small for this operand or
- invalid for a operand that was auto-incremented. */
- if (CLASS_MAX_NREGS (class, PSEUDO_REGNO_MODE (i))
- > reg_class_size[class]
-#ifdef FORBIDDEN_INC_DEC_CLASSES
- || (in_inc_dec[i] && forbidden_inc_dec_class[class])
-#endif
- )
- ;
- else if (p->cost[class] < best_cost)
- {
- best_cost = p->cost[class];
- best = (enum reg_class) class;
- }
- else if (p->cost[class] == best_cost)
- best = reg_class_subunion[(int)best][class];
- }
-
- /* Record the alternate register class; i.e., a class for which
- every register in it is better than using memory. If adding a
- class would make a smaller class (i.e., no union of just those
- classes exists), skip that class. The major unions of classes
- should be provided as a register class. Don't do this if we
- will be doing it again later. */
-
- if (pass == 1 || ! flag_expensive_optimizations)
- for (class = 0; class < N_REG_CLASSES; class++)
- if (p->cost[class] < p->mem_cost
- && (reg_class_size[(int) reg_class_subunion[(int) alt][class]]
- > reg_class_size[(int) alt])
-#ifdef FORBIDDEN_INC_DEC_CLASSES
- && ! (in_inc_dec[i] && forbidden_inc_dec_class[class])
-#endif
- )
- alt = reg_class_subunion[(int) alt][class];
-
- /* If we don't add any classes, nothing to try. */
- if (alt == best)
- alt = NO_REGS;
-
- /* We cast to (int) because (char) hits bugs in some compilers. */
- prefclass[i] = (int) best;
- altclass[i] = (int) alt;
- }
- }
-#endif /* REGISTER_CONSTRAINTS */
-}
-
-#ifdef REGISTER_CONSTRAINTS
-
-/* Record the cost of using memory or registers of various classes for
- the operands in INSN.
-
- N_ALTS is the number of alternatives.
-
- N_OPS is the number of operands.
-
- OPS is an array of the operands.
-
- MODES are the modes of the operands, in case any are VOIDmode.
-
- CONSTRAINTS are the constraints to use for the operands. This array
- is modified by this procedure.
-
- This procedure works alternative by alternative. For each alternative
- we assume that we will be able to allocate all pseudos to their ideal
- register class and calculate the cost of using that alternative. Then
- we compute for each operand that is a pseudo-register, the cost of
- having the pseudo allocated to each register class and using it in that
- alternative. To this cost is added the cost of the alternative.
-
- The cost of each class for this insn is its lowest cost among all the
- alternatives. */
-
-static void
-record_reg_classes (n_alts, n_ops, ops, modes, constraints, insn)
- int n_alts;
- int n_ops;
- rtx *ops;
- enum machine_mode *modes;
- char **constraints;
- rtx insn;
-{
- int alt;
- enum op_type {OP_READ, OP_WRITE, OP_READ_WRITE} op_types[MAX_RECOG_OPERANDS];
- int i, j;
- rtx set;
-
- /* By default, each operand is an input operand. */
-
- for (i = 0; i < n_ops; i++)
- op_types[i] = OP_READ;
-
- /* Process each alternative, each time minimizing an operand's cost with
- the cost for each operand in that alternative. */
-
- for (alt = 0; alt < n_alts; alt++)
- {
- struct costs this_op_costs[MAX_RECOG_OPERANDS];
- int alt_fail = 0;
- int alt_cost = 0;
- enum reg_class classes[MAX_RECOG_OPERANDS];
- int class;
-
- for (i = 0; i < n_ops; i++)
- {
- char *p = constraints[i];
- rtx op = ops[i];
- enum machine_mode mode = modes[i];
- int allows_mem = 0;
- int win = 0;
- char c;
-
- /* If this operand has no constraints at all, we can conclude
- nothing about it since anything is valid. */
-
- if (*p == 0)
- {
- if (GET_CODE (op) == REG && REGNO (op) >= FIRST_PSEUDO_REGISTER)
- bzero ((char *) &this_op_costs[i], sizeof this_op_costs[i]);
-
- continue;
- }
-
- if (*p == '%')
- p++;
-
- /* If this alternative is only relevant when this operand
- matches a previous operand, we do different things depending
- on whether this operand is a pseudo-reg or not. */
-
- if (p[0] >= '0' && p[0] <= '0' + i && (p[1] == ',' || p[1] == 0))
- {
- j = p[0] - '0';
- classes[i] = classes[j];
-
- if (GET_CODE (op) != REG || REGNO (op) < FIRST_PSEUDO_REGISTER)
- {
- /* If this matches the other operand, we have no added
- cost and we win. */
- if (rtx_equal_p (ops[j], op))
- win = 1;
-
- /* If we can put the other operand into a register, add to
- the cost of this alternative the cost to copy this
- operand to the register used for the other operand. */
-
- else if (classes[j] != NO_REGS)
- alt_cost += copy_cost (op, mode, classes[j], 1), win = 1;
- }
- else if (GET_CODE (ops[j]) != REG
- || REGNO (ops[j]) < FIRST_PSEUDO_REGISTER)
- {
- /* This op is a pseudo but the one it matches is not. */
-
- /* If we can't put the other operand into a register, this
- alternative can't be used. */
-
- if (classes[j] == NO_REGS)
- alt_fail = 1;
-
- /* Otherwise, add to the cost of this alternative the cost
- to copy the other operand to the register used for this
- operand. */
-
- else
- alt_cost += copy_cost (ops[j], mode, classes[j], 1);
- }
- else
- {
- /* The costs of this operand are the same as that of the
- other operand. However, if we cannot tie them, this
- alternative needs to do a copy, which is one
- instruction. */
-
- this_op_costs[i] = this_op_costs[j];
- if (REGNO (ops[i]) != REGNO (ops[j])
- && ! find_reg_note (insn, REG_DEAD, op))
- alt_cost += 2;
-
- /* This is in place of ordinary cost computation
- for this operand, so skip to the end of the
- alternative (should be just one character). */
- while (*p && *p++ != ',')
- ;
-
- constraints[i] = p;
- continue;
- }
- }
-
- /* Scan all the constraint letters. See if the operand matches
- any of the constraints. Collect the valid register classes
- and see if this operand accepts memory. */
-
- classes[i] = NO_REGS;
- while (*p && (c = *p++) != ',')
- switch (c)
- {
- case '=':
- op_types[i] = OP_WRITE;
- break;
-
- case '+':
- op_types[i] = OP_READ_WRITE;
- break;
-
- case '*':
- /* Ignore the next letter for this pass. */
- p++;
- break;
-
- case '%':
- case '?': case '!': case '#':
- case '&':
- case '0': case '1': case '2': case '3': case '4':
- case 'p':
- break;
-
- case 'm': case 'o': case 'V':
- /* It doesn't seem worth distinguishing between offsettable
- and non-offsettable addresses here. */
- allows_mem = 1;
- if (GET_CODE (op) == MEM)
- win = 1;
- break;
-
- case '<':
- if (GET_CODE (op) == MEM
- && (GET_CODE (XEXP (op, 0)) == PRE_DEC
- || GET_CODE (XEXP (op, 0)) == POST_DEC))
- win = 1;
- break;
-
- case '>':
- if (GET_CODE (op) == MEM
- && (GET_CODE (XEXP (op, 0)) == PRE_INC
- || GET_CODE (XEXP (op, 0)) == POST_INC))
- win = 1;
- break;
-
- case 'E':
-#ifndef REAL_ARITHMETIC
- /* Match any floating double constant, but only if
- we can examine the bits of it reliably. */
- if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
- || HOST_BITS_PER_WIDE_INT != BITS_PER_WORD)
- && GET_MODE (op) != VOIDmode && ! flag_pretend_float)
- break;
-#endif
- if (GET_CODE (op) == CONST_DOUBLE)
- win = 1;
- break;
-
- case 'F':
- if (GET_CODE (op) == CONST_DOUBLE)
- win = 1;
- break;
-
- case 'G':
- case 'H':
- if (GET_CODE (op) == CONST_DOUBLE
- && CONST_DOUBLE_OK_FOR_LETTER_P (op, c))
- win = 1;
- break;
-
- case 's':
- if (GET_CODE (op) == CONST_INT
- || (GET_CODE (op) == CONST_DOUBLE
- && GET_MODE (op) == VOIDmode))
- break;
- case 'i':
- if (CONSTANT_P (op)
-#ifdef LEGITIMATE_PIC_OPERAND_P
- && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
-#endif
- )
- win = 1;
- break;
-
- case 'n':
- if (GET_CODE (op) == CONST_INT
- || (GET_CODE (op) == CONST_DOUBLE
- && GET_MODE (op) == VOIDmode))
- win = 1;
- break;
-
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- if (GET_CODE (op) == CONST_INT
- && CONST_OK_FOR_LETTER_P (INTVAL (op), c))
- win = 1;
- break;
-
- case 'X':
- win = 1;
- break;
-
-#ifdef EXTRA_CONSTRAINT
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- if (EXTRA_CONSTRAINT (op, c))
- win = 1;
- break;
-#endif
-
- case 'g':
- if (GET_CODE (op) == MEM
- || (CONSTANT_P (op)
-#ifdef LEGITIMATE_PIC_OPERAND_P
- && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
-#endif
- ))
- win = 1;
- allows_mem = 1;
- case 'r':
- classes[i]
- = reg_class_subunion[(int) classes[i]][(int) GENERAL_REGS];
- break;
-
- default:
- classes[i]
- = reg_class_subunion[(int) classes[i]]
- [(int) REG_CLASS_FROM_LETTER (c)];
- }
-
- constraints[i] = p;
-
- /* How we account for this operand now depends on whether it is a
- pseudo register or not. If it is, we first check if any
- register classes are valid. If not, we ignore this alternative,
- since we want to assume that all pseudos get allocated for
- register preferencing. If some register class is valid, compute
- the costs of moving the pseudo into that class. */
-
- if (GET_CODE (op) == REG && REGNO (op) >= FIRST_PSEUDO_REGISTER)
- {
- if (classes[i] == NO_REGS)
- alt_fail = 1;
- else
- {
- struct costs *pp = &this_op_costs[i];
-
- for (class = 0; class < N_REG_CLASSES; class++)
- pp->cost[class] = may_move_cost[class][(int) classes[i]];
-
- /* If the alternative actually allows memory, make things
- a bit cheaper since we won't need an extra insn to
- load it. */
-
- pp->mem_cost = MEMORY_MOVE_COST (mode) - allows_mem;
-
- /* If we have assigned a class to this register in our
- first pass, add a cost to this alternative corresponding
- to what we would add if this register were not in the
- appropriate class. */
-
- if (prefclass)
- alt_cost
- += may_move_cost[prefclass[REGNO (op)]][(int) classes[i]];
- }
- }
-
- /* Otherwise, if this alternative wins, either because we
- have already determined that or if we have a hard register of
- the proper class, there is no cost for this alternative. */
-
- else if (win
- || (GET_CODE (op) == REG
- && reg_fits_class_p (op, classes[i], 0, GET_MODE (op))))
- ;
-
- /* If registers are valid, the cost of this alternative includes
- copying the object to and/or from a register. */
-
- else if (classes[i] != NO_REGS)
- {
- if (op_types[i] != OP_WRITE)
- alt_cost += copy_cost (op, mode, classes[i], 1);
-
- if (op_types[i] != OP_READ)
- alt_cost += copy_cost (op, mode, classes[i], 0);
- }
-
- /* The only other way this alternative can be used is if this is a
- constant that could be placed into memory. */
-
- else if (CONSTANT_P (op) && allows_mem)
- alt_cost += MEMORY_MOVE_COST (mode);
- else
- alt_fail = 1;
- }
-
- if (alt_fail)
- continue;
-
- /* Finally, update the costs with the information we've calculated
- about this alternative. */
-
- for (i = 0; i < n_ops; i++)
- if (GET_CODE (ops[i]) == REG
- && REGNO (ops[i]) >= FIRST_PSEUDO_REGISTER)
- {
- struct costs *pp = &op_costs[i], *qq = &this_op_costs[i];
- int scale = 1 + (op_types[i] == OP_READ_WRITE);
-
- pp->mem_cost = MIN (pp->mem_cost,
- (qq->mem_cost + alt_cost) * scale);
-
- for (class = 0; class < N_REG_CLASSES; class++)
- pp->cost[class] = MIN (pp->cost[class],
- (qq->cost[class] + alt_cost) * scale);
- }
- }
-
- /* If this insn is a single set copying operand 1 to operand 0
- and one is a pseudo with the other a hard reg that is in its
- own register class, set the cost of that register class to -1. */
-
- if ((set = single_set (insn)) != 0
- && ops[0] == SET_DEST (set) && ops[1] == SET_SRC (set)
- && GET_CODE (ops[0]) == REG && GET_CODE (ops[1]) == REG)
- for (i = 0; i <= 1; i++)
- if (REGNO (ops[i]) >= FIRST_PSEUDO_REGISTER)
- {
- int regno = REGNO (ops[!i]);
- enum machine_mode mode = GET_MODE (ops[!i]);
- int class;
- int nr;
-
- if (regno >= FIRST_PSEUDO_REGISTER && prefclass != 0
- && (reg_class_size[prefclass[regno]]
- == CLASS_MAX_NREGS (prefclass[regno], mode)))
- op_costs[i].cost[prefclass[regno]] = -1;
- else if (regno < FIRST_PSEUDO_REGISTER)
- for (class = 0; class < N_REG_CLASSES; class++)
- if (TEST_HARD_REG_BIT (reg_class_contents[class], regno)
- && reg_class_size[class] == CLASS_MAX_NREGS (class, mode))
- {
- if (reg_class_size[class] == 1)
- op_costs[i].cost[class] = -1;
- else
- {
- for (nr = 0; nr < HARD_REGNO_NREGS(regno, mode); nr++)
- {
- if (!TEST_HARD_REG_BIT (reg_class_contents[class], regno + nr))
- break;
- }
-
- if (nr == HARD_REGNO_NREGS(regno,mode))
- op_costs[i].cost[class] = -1;
- }
- }
- }
-}
-
-/* Compute the cost of loading X into (if TO_P is non-zero) or from (if
- TO_P is zero) a register of class CLASS in mode MODE.
-
- X must not be a pseudo. */
-
-static int
-copy_cost (x, mode, class, to_p)
- rtx x;
- enum machine_mode mode;
- enum reg_class class;
- int to_p;
-{
- enum reg_class secondary_class = NO_REGS;
-
- /* If X is a SCRATCH, there is actually nothing to move since we are
- assuming optimal allocation. */
-
- if (GET_CODE (x) == SCRATCH)
- return 0;
-
- /* Get the class we will actually use for a reload. */
- class = PREFERRED_RELOAD_CLASS (x, class);
-
-#ifdef HAVE_SECONDARY_RELOADS
- /* If we need a secondary reload (we assume here that we are using
- the secondary reload as an intermediate, not a scratch register), the
- cost is that to load the input into the intermediate register, then
- to copy them. We use a special value of TO_P to avoid recursion. */
-
-#ifdef SECONDARY_INPUT_RELOAD_CLASS
- if (to_p == 1)
- secondary_class = SECONDARY_INPUT_RELOAD_CLASS (class, mode, x);
-#endif
-
-#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
- if (! to_p)
- secondary_class = SECONDARY_OUTPUT_RELOAD_CLASS (class, mode, x);
-#endif
-
- if (secondary_class != NO_REGS)
- return (move_cost[(int) secondary_class][(int) class]
- + copy_cost (x, mode, secondary_class, 2));
-#endif /* HAVE_SECONDARY_RELOADS */
-
- /* For memory, use the memory move cost, for (hard) registers, use the
- cost to move between the register classes, and use 2 for everything
- else (constants). */
-
- if (GET_CODE (x) == MEM || class == NO_REGS)
- return MEMORY_MOVE_COST (mode);
-
- else if (GET_CODE (x) == REG)
- return move_cost[(int) REGNO_REG_CLASS (REGNO (x))][(int) class];
-
- else
- /* If this is a constant, we may eventually want to call rtx_cost here. */
- return 2;
-}
-
-/* Record the pseudo registers we must reload into hard registers
- in a subexpression of a memory address, X.
-
- CLASS is the class that the register needs to be in and is either
- BASE_REG_CLASS or INDEX_REG_CLASS.
-
- SCALE is twice the amount to multiply the cost by (it is twice so we
- can represent half-cost adjustments). */
-
-static void
-record_address_regs (x, class, scale)
- rtx x;
- enum reg_class class;
- int scale;
-{
- register enum rtx_code code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_INT:
- case CONST:
- case CC0:
- case PC:
- case SYMBOL_REF:
- case LABEL_REF:
- return;
-
- case PLUS:
- /* When we have an address that is a sum,
- we must determine whether registers are "base" or "index" regs.
- If there is a sum of two registers, we must choose one to be
- the "base". Luckily, we can use the REGNO_POINTER_FLAG
- to make a good choice most of the time. We only need to do this
- on machines that can have two registers in an address and where
- the base and index register classes are different.
-
- ??? This code used to set REGNO_POINTER_FLAG in some cases, but
- that seems bogus since it should only be set when we are sure
- the register is being used as a pointer. */
-
- {
- rtx arg0 = XEXP (x, 0);
- rtx arg1 = XEXP (x, 1);
- register enum rtx_code code0 = GET_CODE (arg0);
- register enum rtx_code code1 = GET_CODE (arg1);
-
- /* Look inside subregs. */
- if (code0 == SUBREG)
- arg0 = SUBREG_REG (arg0), code0 = GET_CODE (arg0);
- if (code1 == SUBREG)
- arg1 = SUBREG_REG (arg1), code1 = GET_CODE (arg1);
-
- /* If this machine only allows one register per address, it must
- be in the first operand. */
-
- if (MAX_REGS_PER_ADDRESS == 1)
- record_address_regs (arg0, class, scale);
-
- /* If index and base registers are the same on this machine, just
- record registers in any non-constant operands. We assume here,
- as well as in the tests below, that all addresses are in
- canonical form. */
-
- else if (INDEX_REG_CLASS == BASE_REG_CLASS)
- {
- record_address_regs (arg0, class, scale);
- if (! CONSTANT_P (arg1))
- record_address_regs (arg1, class, scale);
- }
-
- /* If the second operand is a constant integer, it doesn't change
- what class the first operand must be. */
-
- else if (code1 == CONST_INT || code1 == CONST_DOUBLE)
- record_address_regs (arg0, class, scale);
-
- /* If the second operand is a symbolic constant, the first operand
- must be an index register. */
-
- else if (code1 == SYMBOL_REF || code1 == CONST || code1 == LABEL_REF)
- record_address_regs (arg0, INDEX_REG_CLASS, scale);
-
- /* If this the sum of two registers where the first is known to be a
- pointer, it must be a base register with the second an index. */
-
- else if (code0 == REG && code1 == REG
- && REGNO_POINTER_FLAG (REGNO (arg0)))
- {
- record_address_regs (arg0, BASE_REG_CLASS, scale);
- record_address_regs (arg1, INDEX_REG_CLASS, scale);
- }
-
- /* If this is the sum of two registers and neither is known to
- be a pointer, count equal chances that each might be a base
- or index register. This case should be rare. */
-
- else if (code0 == REG && code1 == REG
- && ! REGNO_POINTER_FLAG (REGNO (arg0))
- && ! REGNO_POINTER_FLAG (REGNO (arg1)))
- {
- record_address_regs (arg0, BASE_REG_CLASS, scale / 2);
- record_address_regs (arg0, INDEX_REG_CLASS, scale / 2);
- record_address_regs (arg1, BASE_REG_CLASS, scale / 2);
- record_address_regs (arg1, INDEX_REG_CLASS, scale / 2);
- }
-
- /* In all other cases, the first operand is an index and the
- second is the base. */
-
- else
- {
- record_address_regs (arg0, INDEX_REG_CLASS, scale);
- record_address_regs (arg1, BASE_REG_CLASS, scale);
- }
- }
- break;
-
- case POST_INC:
- case PRE_INC:
- case POST_DEC:
- case PRE_DEC:
- /* Double the importance of a pseudo register that is incremented
- or decremented, since it would take two extra insns
- if it ends up in the wrong place. If the operand is a pseudo,
- show it is being used in an INC_DEC context. */
-
-#ifdef FORBIDDEN_INC_DEC_CLASSES
- if (GET_CODE (XEXP (x, 0)) == REG
- && REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER)
- in_inc_dec[REGNO (XEXP (x, 0))] = 1;
-#endif
-
- record_address_regs (XEXP (x, 0), class, 2 * scale);
- break;
-
- case REG:
- {
- register struct costs *pp = &costs[REGNO (x)];
- register int i;
-
- pp->mem_cost += (MEMORY_MOVE_COST (Pmode) * scale) / 2;
-
- for (i = 0; i < N_REG_CLASSES; i++)
- pp->cost[i] += (may_move_cost[i][(int) class] * scale) / 2;
- }
- break;
-
- default:
- {
- register char *fmt = GET_RTX_FORMAT (code);
- register int i;
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- record_address_regs (XEXP (x, i), class, scale);
- }
- }
-}
-
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-
-/* Return 1 if REG is valid as an auto-increment memory reference
- to an object of MODE. */
-
-static
-auto_inc_dec_reg_p (reg, mode)
- rtx reg;
- enum machine_mode mode;
-{
-#ifdef HAVE_POST_INCREMENT
- if (memory_address_p (mode, gen_rtx (POST_INC, Pmode, reg)))
- return 1;
-#endif
-
-#ifdef HAVE_POST_DECREMENT
- if (memory_address_p (mode, gen_rtx (POST_DEC, Pmode, reg)))
- return 1;
-#endif
-
-#ifdef HAVE_PRE_INCREMENT
- if (memory_address_p (mode, gen_rtx (PRE_INC, Pmode, reg)))
- return 1;
-#endif
-
-#ifdef HAVE_PRE_DECREMENT
- if (memory_address_p (mode, gen_rtx (PRE_DEC, Pmode, reg)))
- return 1;
-#endif
-
- return 0;
-}
-#endif
-
-#endif /* REGISTER_CONSTRAINTS */
-
-/* This is the `regscan' pass of the compiler, run just before cse
- and again just before loop.
-
- It finds the first and last use of each pseudo-register
- and records them in the vectors regno_first_uid, regno_last_uid
- and counts the number of sets in the vector reg_n_sets.
-
- REPEAT is nonzero the second time this is called. */
-
-/* Indexed by pseudo register number, gives uid of first insn using the reg
- (as of the time reg_scan is called). */
-
-int *regno_first_uid;
-
-/* Indexed by pseudo register number, gives uid of last insn using the reg
- (as of the time reg_scan is called). */
-
-int *regno_last_uid;
-
-/* Indexed by pseudo register number, gives uid of last insn using the reg
- or mentioning it in a note (as of the time reg_scan is called). */
-
-int *regno_last_note_uid;
-
-/* Record the number of registers we used when we allocated the above two
- tables. If we are called again with more than this, we must re-allocate
- the tables. */
-
-static int highest_regno_in_uid_map;
-
-/* Maximum number of parallel sets and clobbers in any insn in this fn.
- Always at least 3, since the combiner could put that many together
- and we want this to remain correct for all the remaining passes. */
-
-int max_parallel;
-
-void
-reg_scan (f, nregs, repeat)
- rtx f;
- int nregs;
- int repeat;
-{
- register rtx insn;
-
- if (!repeat || nregs > highest_regno_in_uid_map)
- {
- /* Leave some spare space in case more regs are allocated. */
- highest_regno_in_uid_map = nregs + nregs / 20;
- regno_first_uid
- = (int *) oballoc (highest_regno_in_uid_map * sizeof (int));
- regno_last_uid
- = (int *) oballoc (highest_regno_in_uid_map * sizeof (int));
- regno_last_note_uid
- = (int *) oballoc (highest_regno_in_uid_map * sizeof (int));
- reg_n_sets
- = (short *) oballoc (highest_regno_in_uid_map * sizeof (short));
- }
-
- bzero ((char *) regno_first_uid, highest_regno_in_uid_map * sizeof (int));
- bzero ((char *) regno_last_uid, highest_regno_in_uid_map * sizeof (int));
- bzero ((char *) regno_last_note_uid,
- highest_regno_in_uid_map * sizeof (int));
- bzero ((char *) reg_n_sets, highest_regno_in_uid_map * sizeof (short));
-
- max_parallel = 3;
-
- for (insn = f; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN
- || GET_CODE (insn) == CALL_INSN
- || GET_CODE (insn) == JUMP_INSN)
- {
- if (GET_CODE (PATTERN (insn)) == PARALLEL
- && XVECLEN (PATTERN (insn), 0) > max_parallel)
- max_parallel = XVECLEN (PATTERN (insn), 0);
- reg_scan_mark_refs (PATTERN (insn), insn, 0);
-
- if (REG_NOTES (insn))
- reg_scan_mark_refs (REG_NOTES (insn), insn, 1);
- }
-}
-
-/* X is the expression to scan. INSN is the insn it appears in.
- NOTE_FLAG is nonzero if X is from INSN's notes rather than its body. */
-
-static void
-reg_scan_mark_refs (x, insn, note_flag)
- rtx x;
- rtx insn;
- int note_flag;
-{
- register enum rtx_code code = GET_CODE (x);
- register rtx dest;
- register rtx note;
-
- switch (code)
- {
- case CONST_INT:
- case CONST:
- case CONST_DOUBLE:
- case CC0:
- case PC:
- case SYMBOL_REF:
- case LABEL_REF:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- return;
-
- case REG:
- {
- register int regno = REGNO (x);
-
- regno_last_note_uid[regno] = INSN_UID (insn);
- if (!note_flag)
- regno_last_uid[regno] = INSN_UID (insn);
- if (regno_first_uid[regno] == 0)
- regno_first_uid[regno] = INSN_UID (insn);
- }
- break;
-
- case EXPR_LIST:
- if (XEXP (x, 0))
- reg_scan_mark_refs (XEXP (x, 0), insn, note_flag);
- if (XEXP (x, 1))
- reg_scan_mark_refs (XEXP (x, 1), insn, note_flag);
- break;
-
- case INSN_LIST:
- if (XEXP (x, 1))
- reg_scan_mark_refs (XEXP (x, 1), insn, note_flag);
- break;
-
- case SET:
- /* Count a set of the destination if it is a register. */
- for (dest = SET_DEST (x);
- GET_CODE (dest) == SUBREG || GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == ZERO_EXTEND;
- dest = XEXP (dest, 0))
- ;
-
- if (GET_CODE (dest) == REG)
- reg_n_sets[REGNO (dest)]++;
-
- /* If this is setting a pseudo from another pseudo or the sum of a
- pseudo and a constant integer and the other pseudo is known to be
- a pointer, set the destination to be a pointer as well.
-
- Likewise if it is setting the destination from an address or from a
- value equivalent to an address or to the sum of an address and
- something else.
-
- But don't do any of this if the pseudo corresponds to a user
- variable since it should have already been set as a pointer based
- on the type. */
-
- if (GET_CODE (SET_DEST (x)) == REG
- && REGNO (SET_DEST (x)) >= FIRST_PSEUDO_REGISTER
- && ! REG_USERVAR_P (SET_DEST (x))
- && ! REGNO_POINTER_FLAG (REGNO (SET_DEST (x)))
- && ((GET_CODE (SET_SRC (x)) == REG
- && REGNO_POINTER_FLAG (REGNO (SET_SRC (x))))
- || ((GET_CODE (SET_SRC (x)) == PLUS
- || GET_CODE (SET_SRC (x)) == LO_SUM)
- && GET_CODE (XEXP (SET_SRC (x), 1)) == CONST_INT
- && GET_CODE (XEXP (SET_SRC (x), 0)) == REG
- && REGNO_POINTER_FLAG (REGNO (XEXP (SET_SRC (x), 0))))
- || GET_CODE (SET_SRC (x)) == CONST
- || GET_CODE (SET_SRC (x)) == SYMBOL_REF
- || GET_CODE (SET_SRC (x)) == LABEL_REF
- || (GET_CODE (SET_SRC (x)) == HIGH
- && (GET_CODE (XEXP (SET_SRC (x), 0)) == CONST
- || GET_CODE (XEXP (SET_SRC (x), 0)) == SYMBOL_REF
- || GET_CODE (XEXP (SET_SRC (x), 0)) == LABEL_REF))
- || ((GET_CODE (SET_SRC (x)) == PLUS
- || GET_CODE (SET_SRC (x)) == LO_SUM)
- && (GET_CODE (XEXP (SET_SRC (x), 1)) == CONST
- || GET_CODE (XEXP (SET_SRC (x), 1)) == SYMBOL_REF
- || GET_CODE (XEXP (SET_SRC (x), 1)) == LABEL_REF))
- || ((note = find_reg_note (insn, REG_EQUAL, 0)) != 0
- && (GET_CODE (XEXP (note, 0)) == CONST
- || GET_CODE (XEXP (note, 0)) == SYMBOL_REF
- || GET_CODE (XEXP (note, 0)) == LABEL_REF))))
- REGNO_POINTER_FLAG (REGNO (SET_DEST (x))) = 1;
-
- /* ... fall through ... */
-
- default:
- {
- register char *fmt = GET_RTX_FORMAT (code);
- register int i;
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- reg_scan_mark_refs (XEXP (x, i), insn, note_flag);
- else if (fmt[i] == 'E' && XVEC (x, i) != 0)
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- reg_scan_mark_refs (XVECEXP (x, i, j), insn, note_flag);
- }
- }
- }
- }
-}
-
-/* Return nonzero if C1 is a subset of C2, i.e., if every register in C1
- is also in C2. */
-
-int
-reg_class_subset_p (c1, c2)
- register enum reg_class c1;
- register enum reg_class c2;
-{
- if (c1 == c2) return 1;
-
- if (c2 == ALL_REGS)
- win:
- return 1;
- GO_IF_HARD_REG_SUBSET (reg_class_contents[(int)c1],
- reg_class_contents[(int)c2],
- win);
- return 0;
-}
-
-/* Return nonzero if there is a register that is in both C1 and C2. */
-
-int
-reg_classes_intersect_p (c1, c2)
- register enum reg_class c1;
- register enum reg_class c2;
-{
-#ifdef HARD_REG_SET
- register
-#endif
- HARD_REG_SET c;
-
- if (c1 == c2) return 1;
-
- if (c1 == ALL_REGS || c2 == ALL_REGS)
- return 1;
-
- COPY_HARD_REG_SET (c, reg_class_contents[(int) c1]);
- AND_HARD_REG_SET (c, reg_class_contents[(int) c2]);
-
- GO_IF_HARD_REG_SUBSET (c, reg_class_contents[(int) NO_REGS], lose);
- return 1;
-
- lose:
- return 0;
-}
-
diff --git a/gcc/regs.h b/gcc/regs.h
deleted file mode 100644
index fe0d1ac1af1..00000000000
--- a/gcc/regs.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* Define per-register tables for data flow info and register allocation.
- Copyright (C) 1987, 1993, 1994, 1995 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. */
-
-
-
-#define REG_BYTES(R) mode_size[(int) GET_MODE (R)]
-
-/* Get the number of consecutive hard regs required to hold the REG rtx R.
- When something may be an explicit hard reg, REG_SIZE is the only
- valid way to get this value. You cannot get it from the regno. */
-
-#define REG_SIZE(R) \
- ((mode_size[(int) GET_MODE (R)] + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Maximum register number used in this function, plus one. */
-
-extern int max_regno;
-
-/* Maximum number of SCRATCH rtx's in each block of this function. */
-
-extern int max_scratch;
-
-/* Indexed by n, gives number of times (REG n) is used or set.
- References within loops may be counted more times. */
-
-extern int *reg_n_refs;
-
-/* Indexed by n, gives number of times (REG n) is set. */
-
-extern short *reg_n_sets;
-
-/* Indexed by N, gives number of insns in which register N dies.
- Note that if register N is live around loops, it can die
- in transitions between basic blocks, and that is not counted here.
- So this is only a reliable indicator of how many regions of life there are
- for registers that are contained in one basic block. */
-
-extern short *reg_n_deaths;
-
-/* Indexed by N; says whether a pseudo register N was ever used
- within a SUBREG that changes the size of the reg. Some machines prohibit
- such objects to be in certain (usually floating-point) registers. */
-
-extern char *reg_changes_size;
-
-/* Get the number of consecutive words required to hold pseudo-reg N. */
-
-#define PSEUDO_REGNO_SIZE(N) \
- ((GET_MODE_SIZE (PSEUDO_REGNO_MODE (N)) + UNITS_PER_WORD - 1) \
- / UNITS_PER_WORD)
-
-/* Get the number of bytes required to hold pseudo-reg N. */
-
-#define PSEUDO_REGNO_BYTES(N) \
- GET_MODE_SIZE (PSEUDO_REGNO_MODE (N))
-
-/* Get the machine mode of pseudo-reg N. */
-
-#define PSEUDO_REGNO_MODE(N) GET_MODE (regno_reg_rtx[N])
-
-/* Indexed by N, gives number of CALL_INSNS across which (REG n) is live. */
-
-extern int *reg_n_calls_crossed;
-
-/* Total number of instructions at which (REG n) is live.
- The larger this is, the less priority (REG n) gets for
- allocation in a hard register (in global-alloc).
- This is set in flow.c and remains valid for the rest of the compilation
- of the function; it is used to control register allocation.
-
- local-alloc.c may alter this number to change the priority.
-
- Negative values are special.
- -1 is used to mark a pseudo reg which has a constant or memory equivalent
- and is used infrequently enough that it should not get a hard register.
- -2 is used to mark a pseudo reg for a parameter, when a frame pointer
- is not required. global.c makes an allocno for this but does
- not try to assign a hard register to it. */
-
-extern int *reg_live_length;
-
-/* Vector of substitutions of register numbers,
- used to map pseudo regs into hardware regs. */
-
-extern short *reg_renumber;
-
-/* Vector indexed by hardware reg
- saying whether that reg is ever used. */
-
-extern char regs_ever_live[FIRST_PSEUDO_REGISTER];
-
-/* Vector indexed by hardware reg giving its name. */
-
-extern char *reg_names[FIRST_PSEUDO_REGISTER];
-
-/* For each hard register, the widest mode object that it can contain.
- This will be a MODE_INT mode if the register can hold integers. Otherwise
- it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the
- register. */
-
-extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
-
-/* Vector indexed by regno; gives uid of first insn using that reg.
- This is computed by reg_scan for use by cse and loop.
- It is sometimes adjusted for subsequent changes during loop,
- but not adjusted by cse even if cse invalidates it. */
-
-extern int *regno_first_uid;
-
-/* Vector indexed by regno; gives uid of last insn using that reg.
- This is computed by reg_scan for use by cse and loop.
- It is sometimes adjusted for subsequent changes during loop,
- but not adjusted by cse even if cse invalidates it.
- This is harmless since cse won't scan through a loop end. */
-
-extern int *regno_last_uid;
-
-/* Similar, but includes insns that mention the reg in their notes. */
-
-extern int *regno_last_note_uid;
-
-/* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function.
- After rtl generation, it is 1 plus the largest register number used. */
-
-extern int reg_rtx_no;
-
-/* Vector indexed by regno; contains 1 for a register is considered a pointer.
- Reloading, etc. will use a pointer register rather than a non-pointer
- as the base register in an address, when there is a choice of two regs. */
-
-extern char *regno_pointer_flag;
-#define REGNO_POINTER_FLAG(REGNO) regno_pointer_flag[REGNO]
-extern int regno_pointer_flag_length;
-
-/* List made of EXPR_LIST rtx's which gives pairs of pseudo registers
- that have to go in the same hard reg. */
-extern rtx regs_may_share;
-
-/* Vector mapping pseudo regno into the REG rtx for that register.
- This is computed by reg_scan. */
-
-extern rtx *regno_reg_rtx;
-
-/* Flag set by local-alloc or global-alloc if they decide to allocate
- something in a call-clobbered register. */
-
-extern int caller_save_needed;
-
-/* Predicate to decide whether to give a hard reg to a pseudo which
- is referenced REFS times and would need to be saved and restored
- around a call CALLS times. */
-
-#ifndef CALLER_SAVE_PROFITABLE
-#define CALLER_SAVE_PROFITABLE(REFS, CALLS) (4 * (CALLS) < (REFS))
-#endif
-
-/* On most machines a register class is likely to be spilled if it
- only has one register. */
-#ifndef CLASS_LIKELY_SPILLED_P
-#define CLASS_LIKELY_SPILLED_P(CLASS) (reg_class_size[(int) (CLASS)] == 1)
-#endif
-
-/* Allocated in local_alloc. */
-
-/* A list of SCRATCH rtl allocated by local-alloc. */
-extern rtx *scratch_list;
-/* The basic block in which each SCRATCH is used. */
-extern int *scratch_block;
-/* The length of the arrays pointed to by scratch_block and scratch_list. */
-extern int scratch_list_length;
diff --git a/gcc/reload.c b/gcc/reload.c
deleted file mode 100644
index d4d0b1e2c9c..00000000000
--- a/gcc/reload.c
+++ /dev/null
@@ -1,6163 +0,0 @@
-/* Search an insn for pseudo regs that must be in hard regs and are not.
- Copyright (C) 1987, 88, 89, 92-6, 1997 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 contains subroutines used only from the file reload1.c.
- It knows how to scan one insn for operands and values
- that need to be copied into registers to make valid code.
- It also finds other operands and values which are valid
- but for which equivalent values in registers exist and
- ought to be used instead.
-
- Before processing the first insn of the function, call `init_reload'.
-
- To scan an insn, call `find_reloads'. This does two things:
- 1. sets up tables describing which values must be reloaded
- for this insn, and what kind of hard regs they must be reloaded into;
- 2. optionally record the locations where those values appear in
- the data, so they can be replaced properly later.
- This is done only if the second arg to `find_reloads' is nonzero.
-
- The third arg to `find_reloads' specifies the number of levels
- of indirect addressing supported by the machine. If it is zero,
- indirect addressing is not valid. If it is one, (MEM (REG n))
- is valid even if (REG n) did not get a hard register; if it is two,
- (MEM (MEM (REG n))) is also valid even if (REG n) did not get a
- hard register, and similarly for higher values.
-
- Then you must choose the hard regs to reload those pseudo regs into,
- and generate appropriate load insns before this insn and perhaps
- also store insns after this insn. Set up the array `reload_reg_rtx'
- to contain the REG rtx's for the registers you used. In some
- cases `find_reloads' will return a nonzero value in `reload_reg_rtx'
- for certain reloads. Then that tells you which register to use,
- so you do not need to allocate one. But you still do need to add extra
- instructions to copy the value into and out of that register.
-
- Finally you must call `subst_reloads' to substitute the reload reg rtx's
- into the locations already recorded.
-
-NOTE SIDE EFFECTS:
-
- find_reloads can alter the operands of the instruction it is called on.
-
- 1. Two operands of any sort may be interchanged, if they are in a
- commutative instruction.
- This happens only if find_reloads thinks the instruction will compile
- better that way.
-
- 2. Pseudo-registers that are equivalent to constants are replaced
- with those constants if they are not in hard registers.
-
-1 happens every time find_reloads is called.
-2 happens only when REPLACE is 1, which is only when
-actually doing the reloads, not when just counting them.
-
-
-Using a reload register for several reloads in one insn:
-
-When an insn has reloads, it is considered as having three parts:
-the input reloads, the insn itself after reloading, and the output reloads.
-Reloads of values used in memory addresses are often needed for only one part.
-
-When this is so, reload_when_needed records which part needs the reload.
-Two reloads for different parts of the insn can share the same reload
-register.
-
-When a reload is used for addresses in multiple parts, or when it is
-an ordinary operand, it is classified as RELOAD_OTHER, and cannot share
-a register with any other reload. */
-
-#define REG_OK_STRICT
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "insn-config.h"
-#include "insn-codes.h"
-#include "recog.h"
-#include "reload.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "flags.h"
-#include "real.h"
-#include "output.h"
-#include "expr.h"
-
-#ifndef REGISTER_MOVE_COST
-#define REGISTER_MOVE_COST(x, y) 2
-#endif
-
-#ifndef REGNO_MODE_OK_FOR_BASE_P
-#define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) REGNO_OK_FOR_BASE_P (REGNO)
-#endif
-
-#ifndef REG_MODE_OK_FOR_BASE_P
-#define REG_MODE_OK_FOR_BASE_P(REGNO, MODE) REG_OK_FOR_BASE_P (REGNO)
-#endif
-
-/* The variables set up by `find_reloads' are:
-
- n_reloads number of distinct reloads needed; max reload # + 1
- tables indexed by reload number
- reload_in rtx for value to reload from
- reload_out rtx for where to store reload-reg afterward if nec
- (often the same as reload_in)
- reload_reg_class enum reg_class, saying what regs to reload into
- reload_inmode enum machine_mode; mode this operand should have
- when reloaded, on input.
- reload_outmode enum machine_mode; mode this operand should have
- when reloaded, on output.
- reload_optional char, nonzero for an optional reload.
- Optional reloads are ignored unless the
- value is already sitting in a register.
- reload_inc int, positive amount to increment or decrement by if
- reload_in is a PRE_DEC, PRE_INC, POST_DEC, POST_INC.
- Ignored otherwise (don't assume it is zero).
- reload_in_reg rtx. A reg for which reload_in is the equivalent.
- If reload_in is a symbol_ref which came from
- reg_equiv_constant, then this is the pseudo
- which has that symbol_ref as equivalent.
- reload_reg_rtx rtx. This is the register to reload into.
- If it is zero when `find_reloads' returns,
- you must find a suitable register in the class
- specified by reload_reg_class, and store here
- an rtx for that register with mode from
- reload_inmode or reload_outmode.
- reload_nocombine char, nonzero if this reload shouldn't be
- combined with another reload.
- reload_opnum int, operand number being reloaded. This is
- used to group related reloads and need not always
- be equal to the actual operand number in the insn,
- though it current will be; for in-out operands, it
- is one of the two operand numbers.
- reload_when_needed enum, classifies reload as needed either for
- addressing an input reload, addressing an output,
- for addressing a non-reloaded mem ref,
- or for unspecified purposes (i.e., more than one
- of the above).
- reload_secondary_p int, 1 if this is a secondary register for one
- or more reloads.
- reload_secondary_in_reload
- reload_secondary_out_reload
- int, gives the reload number of a secondary
- reload, when needed; otherwise -1
- reload_secondary_in_icode
- reload_secondary_out_icode
- enum insn_code, if a secondary reload is required,
- gives the INSN_CODE that uses the secondary
- reload as a scratch register, or CODE_FOR_nothing
- if the secondary reload register is to be an
- intermediate register. */
-int n_reloads;
-
-rtx reload_in[MAX_RELOADS];
-rtx reload_out[MAX_RELOADS];
-enum reg_class reload_reg_class[MAX_RELOADS];
-enum machine_mode reload_inmode[MAX_RELOADS];
-enum machine_mode reload_outmode[MAX_RELOADS];
-rtx reload_reg_rtx[MAX_RELOADS];
-char reload_optional[MAX_RELOADS];
-int reload_inc[MAX_RELOADS];
-rtx reload_in_reg[MAX_RELOADS];
-char reload_nocombine[MAX_RELOADS];
-int reload_opnum[MAX_RELOADS];
-enum reload_type reload_when_needed[MAX_RELOADS];
-int reload_secondary_p[MAX_RELOADS];
-int reload_secondary_in_reload[MAX_RELOADS];
-int reload_secondary_out_reload[MAX_RELOADS];
-enum insn_code reload_secondary_in_icode[MAX_RELOADS];
-enum insn_code reload_secondary_out_icode[MAX_RELOADS];
-
-/* All the "earlyclobber" operands of the current insn
- are recorded here. */
-int n_earlyclobbers;
-rtx reload_earlyclobbers[MAX_RECOG_OPERANDS];
-
-int reload_n_operands;
-
-/* Replacing reloads.
-
- If `replace_reloads' is nonzero, then as each reload is recorded
- an entry is made for it in the table `replacements'.
- Then later `subst_reloads' can look through that table and
- perform all the replacements needed. */
-
-/* Nonzero means record the places to replace. */
-static int replace_reloads;
-
-/* Each replacement is recorded with a structure like this. */
-struct replacement
-{
- rtx *where; /* Location to store in */
- rtx *subreg_loc; /* Location of SUBREG if WHERE is inside
- a SUBREG; 0 otherwise. */
- int what; /* which reload this is for */
- enum machine_mode mode; /* mode it must have */
-};
-
-static struct replacement replacements[MAX_RECOG_OPERANDS * ((MAX_REGS_PER_ADDRESS * 2) + 1)];
-
-/* Number of replacements currently recorded. */
-static int n_replacements;
-
-/* Used to track what is modified by an operand. */
-struct decomposition
-{
- int reg_flag; /* Nonzero if referencing a register. */
- int safe; /* Nonzero if this can't conflict with anything. */
- rtx base; /* Base address for MEM. */
- HOST_WIDE_INT start; /* Starting offset or register number. */
- HOST_WIDE_INT end; /* Ending offset or register number. */
-};
-
-/* MEM-rtx's created for pseudo-regs in stack slots not directly addressable;
- (see reg_equiv_address). */
-static rtx memlocs[MAX_RECOG_OPERANDS * ((MAX_REGS_PER_ADDRESS * 2) + 1)];
-static int n_memlocs;
-
-#ifdef SECONDARY_MEMORY_NEEDED
-
-/* Save MEMs needed to copy from one class of registers to another. One MEM
- is used per mode, but normally only one or two modes are ever used.
-
- We keep two versions, before and after register elimination. The one
- after register elimination is record separately for each operand. This
- is done in case the address is not valid to be sure that we separately
- reload each. */
-
-static rtx secondary_memlocs[NUM_MACHINE_MODES];
-static rtx secondary_memlocs_elim[NUM_MACHINE_MODES][MAX_RECOG_OPERANDS];
-#endif
-
-/* The instruction we are doing reloads for;
- so we can test whether a register dies in it. */
-static rtx this_insn;
-
-/* Nonzero if this instruction is a user-specified asm with operands. */
-static int this_insn_is_asm;
-
-/* If hard_regs_live_known is nonzero,
- we can tell which hard regs are currently live,
- at least enough to succeed in choosing dummy reloads. */
-static int hard_regs_live_known;
-
-/* Indexed by hard reg number,
- element is nonegative if hard reg has been spilled.
- This vector is passed to `find_reloads' as an argument
- and is not changed here. */
-static short *static_reload_reg_p;
-
-/* Set to 1 in subst_reg_equivs if it changes anything. */
-static int subst_reg_equivs_changed;
-
-/* On return from push_reload, holds the reload-number for the OUT
- operand, which can be different for that from the input operand. */
-static int output_reloadnum;
-
- /* Compare two RTX's. */
-#define MATCHES(x, y) \
- (x == y || (x != 0 && (GET_CODE (x) == REG \
- ? GET_CODE (y) == REG && REGNO (x) == REGNO (y) \
- : rtx_equal_p (x, y) && ! side_effects_p (x))))
-
- /* Indicates if two reloads purposes are for similar enough things that we
- can merge their reloads. */
-#define MERGABLE_RELOADS(when1, when2, op1, op2) \
- ((when1) == RELOAD_OTHER || (when2) == RELOAD_OTHER \
- || ((when1) == (when2) && (op1) == (op2)) \
- || ((when1) == RELOAD_FOR_INPUT && (when2) == RELOAD_FOR_INPUT) \
- || ((when1) == RELOAD_FOR_OPERAND_ADDRESS \
- && (when2) == RELOAD_FOR_OPERAND_ADDRESS) \
- || ((when1) == RELOAD_FOR_OTHER_ADDRESS \
- && (when2) == RELOAD_FOR_OTHER_ADDRESS))
-
- /* Nonzero if these two reload purposes produce RELOAD_OTHER when merged. */
-#define MERGE_TO_OTHER(when1, when2, op1, op2) \
- ((when1) != (when2) \
- || ! ((op1) == (op2) \
- || (when1) == RELOAD_FOR_INPUT \
- || (when1) == RELOAD_FOR_OPERAND_ADDRESS \
- || (when1) == RELOAD_FOR_OTHER_ADDRESS))
-
- /* If we are going to reload an address, compute the reload type to
- use. */
-#define ADDR_TYPE(type) \
- ((type) == RELOAD_FOR_INPUT_ADDRESS \
- ? RELOAD_FOR_INPADDR_ADDRESS \
- : ((type) == RELOAD_FOR_OUTPUT_ADDRESS \
- ? RELOAD_FOR_OUTADDR_ADDRESS \
- : (type)))
-
-static int push_secondary_reload PROTO((int, rtx, int, int, enum reg_class,
- enum machine_mode, enum reload_type,
- enum insn_code *));
-static enum reg_class find_valid_class PROTO((enum machine_mode, int));
-static int push_reload PROTO((rtx, rtx, rtx *, rtx *, enum reg_class,
- enum machine_mode, enum machine_mode,
- int, int, int, enum reload_type));
-static void push_replacement PROTO((rtx *, int, enum machine_mode));
-static void combine_reloads PROTO((void));
-static rtx find_dummy_reload PROTO((rtx, rtx, rtx *, rtx *,
- enum machine_mode, enum machine_mode,
- enum reg_class, int, int));
-static int earlyclobber_operand_p PROTO((rtx));
-static int hard_reg_set_here_p PROTO((int, int, rtx));
-static struct decomposition decompose PROTO((rtx));
-static int immune_p PROTO((rtx, rtx, struct decomposition));
-static int alternative_allows_memconst PROTO((char *, int));
-static rtx find_reloads_toplev PROTO((rtx, int, enum reload_type, int, int));
-static rtx make_memloc PROTO((rtx, int));
-static int find_reloads_address PROTO((enum machine_mode, rtx *, rtx, rtx *,
- int, enum reload_type, int, rtx));
-static rtx subst_reg_equivs PROTO((rtx));
-static rtx subst_indexed_address PROTO((rtx));
-static int find_reloads_address_1 PROTO((enum machine_mode, rtx, int, rtx *,
- int, enum reload_type,int, rtx));
-static void find_reloads_address_part PROTO((rtx, rtx *, enum reg_class,
- enum machine_mode, int,
- enum reload_type, int));
-static int find_inc_amount PROTO((rtx, rtx));
-
-#ifdef HAVE_SECONDARY_RELOADS
-
-/* Determine if any secondary reloads are needed for loading (if IN_P is
- non-zero) or storing (if IN_P is zero) X to or from a reload register of
- register class RELOAD_CLASS in mode RELOAD_MODE. If secondary reloads
- are needed, push them.
-
- Return the reload number of the secondary reload we made, or -1 if
- we didn't need one. *PICODE is set to the insn_code to use if we do
- need a secondary reload. */
-
-static int
-push_secondary_reload (in_p, x, opnum, optional, reload_class, reload_mode,
- type, picode)
- int in_p;
- rtx x;
- int opnum;
- int optional;
- enum reg_class reload_class;
- enum machine_mode reload_mode;
- enum reload_type type;
- enum insn_code *picode;
-{
- enum reg_class class = NO_REGS;
- enum machine_mode mode = reload_mode;
- enum insn_code icode = CODE_FOR_nothing;
- enum reg_class t_class = NO_REGS;
- enum machine_mode t_mode = VOIDmode;
- enum insn_code t_icode = CODE_FOR_nothing;
- enum reload_type secondary_type;
- int i;
- int s_reload, t_reload = -1;
-
- if (type == RELOAD_FOR_INPUT_ADDRESS
- || type == RELOAD_FOR_OUTPUT_ADDRESS
- || type == RELOAD_FOR_INPADDR_ADDRESS
- || type == RELOAD_FOR_OUTADDR_ADDRESS)
- secondary_type = type;
- else
- secondary_type = in_p ? RELOAD_FOR_INPUT_ADDRESS : RELOAD_FOR_OUTPUT_ADDRESS;
-
- *picode = CODE_FOR_nothing;
-
- /* If X is a paradoxical SUBREG, use the inner value to determine both the
- mode and object being reloaded. */
- if (GET_CODE (x) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (x))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))))
- {
- x = SUBREG_REG (x);
- reload_mode = GET_MODE (x);
- }
-
- /* If X is a pseudo-register that has an equivalent MEM (actually, if it
- is still a pseudo-register by now, it *must* have an equivalent MEM
- but we don't want to assume that), use that equivalent when seeing if
- a secondary reload is needed since whether or not a reload is needed
- might be sensitive to the form of the MEM. */
-
- if (GET_CODE (x) == REG && REGNO (x) >= FIRST_PSEUDO_REGISTER
- && reg_equiv_mem[REGNO (x)] != 0)
- x = reg_equiv_mem[REGNO (x)];
-
-#ifdef SECONDARY_INPUT_RELOAD_CLASS
- if (in_p)
- class = SECONDARY_INPUT_RELOAD_CLASS (reload_class, reload_mode, x);
-#endif
-
-#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
- if (! in_p)
- class = SECONDARY_OUTPUT_RELOAD_CLASS (reload_class, reload_mode, x);
-#endif
-
- /* If we don't need any secondary registers, done. */
- if (class == NO_REGS)
- return -1;
-
- /* Get a possible insn to use. If the predicate doesn't accept X, don't
- use the insn. */
-
- icode = (in_p ? reload_in_optab[(int) reload_mode]
- : reload_out_optab[(int) reload_mode]);
-
- if (icode != CODE_FOR_nothing
- && insn_operand_predicate[(int) icode][in_p]
- && (! (insn_operand_predicate[(int) icode][in_p]) (x, reload_mode)))
- icode = CODE_FOR_nothing;
-
- /* If we will be using an insn, see if it can directly handle the reload
- register we will be using. If it can, the secondary reload is for a
- scratch register. If it can't, we will use the secondary reload for
- an intermediate register and require a tertiary reload for the scratch
- register. */
-
- if (icode != CODE_FOR_nothing)
- {
- /* If IN_P is non-zero, the reload register will be the output in
- operand 0. If IN_P is zero, the reload register will be the input
- in operand 1. Outputs should have an initial "=", which we must
- skip. */
-
- char insn_letter = insn_operand_constraint[(int) icode][!in_p][in_p];
- enum reg_class insn_class
- = (insn_letter == 'r' ? GENERAL_REGS
- : REG_CLASS_FROM_LETTER (insn_letter));
-
- if (insn_class == NO_REGS
- || (in_p && insn_operand_constraint[(int) icode][!in_p][0] != '=')
- /* The scratch register's constraint must start with "=&". */
- || insn_operand_constraint[(int) icode][2][0] != '='
- || insn_operand_constraint[(int) icode][2][1] != '&')
- abort ();
-
- if (reg_class_subset_p (reload_class, insn_class))
- mode = insn_operand_mode[(int) icode][2];
- else
- {
- char t_letter = insn_operand_constraint[(int) icode][2][2];
- class = insn_class;
- t_mode = insn_operand_mode[(int) icode][2];
- t_class = (t_letter == 'r' ? GENERAL_REGS
- : REG_CLASS_FROM_LETTER (t_letter));
- t_icode = icode;
- icode = CODE_FOR_nothing;
- }
- }
-
- /* This case isn't valid, so fail. Reload is allowed to use the same
- register for RELOAD_FOR_INPUT_ADDRESS and RELOAD_FOR_INPUT reloads, but
- in the case of a secondary register, we actually need two different
- registers for correct code. We fail here to prevent the possibility of
- silently generating incorrect code later.
-
- The convention is that secondary input reloads are valid only if the
- secondary_class is different from class. If you have such a case, you
- can not use secondary reloads, you must work around the problem some
- other way.
-
- Allow this when MODE is not reload_mode and assume that the generated
- code handles this case (it does on the Alpha, which is the only place
- this currently happens). */
-
- if (in_p && class == reload_class && mode == reload_mode)
- abort ();
-
- /* If we need a tertiary reload, see if we have one we can reuse or else
- make a new one. */
-
- if (t_class != NO_REGS)
- {
- for (t_reload = 0; t_reload < n_reloads; t_reload++)
- if (reload_secondary_p[t_reload]
- && (reg_class_subset_p (t_class, reload_reg_class[t_reload])
- || reg_class_subset_p (reload_reg_class[t_reload], t_class))
- && ((in_p && reload_inmode[t_reload] == t_mode)
- || (! in_p && reload_outmode[t_reload] == t_mode))
- && ((in_p && (reload_secondary_in_icode[t_reload]
- == CODE_FOR_nothing))
- || (! in_p &&(reload_secondary_out_icode[t_reload]
- == CODE_FOR_nothing)))
- && (reg_class_size[(int) t_class] == 1
-#ifdef SMALL_REGISTER_CLASSES
- || SMALL_REGISTER_CLASSES
-#endif
- )
- && MERGABLE_RELOADS (secondary_type,
- reload_when_needed[t_reload],
- opnum, reload_opnum[t_reload]))
- {
- if (in_p)
- reload_inmode[t_reload] = t_mode;
- if (! in_p)
- reload_outmode[t_reload] = t_mode;
-
- if (reg_class_subset_p (t_class, reload_reg_class[t_reload]))
- reload_reg_class[t_reload] = t_class;
-
- reload_opnum[t_reload] = MIN (reload_opnum[t_reload], opnum);
- reload_optional[t_reload] &= optional;
- reload_secondary_p[t_reload] = 1;
- if (MERGE_TO_OTHER (secondary_type, reload_when_needed[t_reload],
- opnum, reload_opnum[t_reload]))
- reload_when_needed[t_reload] = RELOAD_OTHER;
- }
-
- if (t_reload == n_reloads)
- {
- /* We need to make a new tertiary reload for this register class. */
- reload_in[t_reload] = reload_out[t_reload] = 0;
- reload_reg_class[t_reload] = t_class;
- reload_inmode[t_reload] = in_p ? t_mode : VOIDmode;
- reload_outmode[t_reload] = ! in_p ? t_mode : VOIDmode;
- reload_reg_rtx[t_reload] = 0;
- reload_optional[t_reload] = optional;
- reload_inc[t_reload] = 0;
- /* Maybe we could combine these, but it seems too tricky. */
- reload_nocombine[t_reload] = 1;
- reload_in_reg[t_reload] = 0;
- reload_opnum[t_reload] = opnum;
- reload_when_needed[t_reload] = secondary_type;
- reload_secondary_in_reload[t_reload] = -1;
- reload_secondary_out_reload[t_reload] = -1;
- reload_secondary_in_icode[t_reload] = CODE_FOR_nothing;
- reload_secondary_out_icode[t_reload] = CODE_FOR_nothing;
- reload_secondary_p[t_reload] = 1;
-
- n_reloads++;
- }
- }
-
- /* See if we can reuse an existing secondary reload. */
- for (s_reload = 0; s_reload < n_reloads; s_reload++)
- if (reload_secondary_p[s_reload]
- && (reg_class_subset_p (class, reload_reg_class[s_reload])
- || reg_class_subset_p (reload_reg_class[s_reload], class))
- && ((in_p && reload_inmode[s_reload] == mode)
- || (! in_p && reload_outmode[s_reload] == mode))
- && ((in_p && reload_secondary_in_reload[s_reload] == t_reload)
- || (! in_p && reload_secondary_out_reload[s_reload] == t_reload))
- && ((in_p && reload_secondary_in_icode[s_reload] == t_icode)
- || (! in_p && reload_secondary_out_icode[s_reload] == t_icode))
- && (reg_class_size[(int) class] == 1
-#ifdef SMALL_REGISTER_CLASSES
- || SMALL_REGISTER_CLASSES
-#endif
- )
- && MERGABLE_RELOADS (secondary_type, reload_when_needed[s_reload],
- opnum, reload_opnum[s_reload]))
- {
- if (in_p)
- reload_inmode[s_reload] = mode;
- if (! in_p)
- reload_outmode[s_reload] = mode;
-
- if (reg_class_subset_p (class, reload_reg_class[s_reload]))
- reload_reg_class[s_reload] = class;
-
- reload_opnum[s_reload] = MIN (reload_opnum[s_reload], opnum);
- reload_optional[s_reload] &= optional;
- reload_secondary_p[s_reload] = 1;
- if (MERGE_TO_OTHER (secondary_type, reload_when_needed[s_reload],
- opnum, reload_opnum[s_reload]))
- reload_when_needed[s_reload] = RELOAD_OTHER;
- }
-
- if (s_reload == n_reloads)
- {
- /* We need to make a new secondary reload for this register class. */
- reload_in[s_reload] = reload_out[s_reload] = 0;
- reload_reg_class[s_reload] = class;
-
- reload_inmode[s_reload] = in_p ? mode : VOIDmode;
- reload_outmode[s_reload] = ! in_p ? mode : VOIDmode;
- reload_reg_rtx[s_reload] = 0;
- reload_optional[s_reload] = optional;
- reload_inc[s_reload] = 0;
- /* Maybe we could combine these, but it seems too tricky. */
- reload_nocombine[s_reload] = 1;
- reload_in_reg[s_reload] = 0;
- reload_opnum[s_reload] = opnum;
- reload_when_needed[s_reload] = secondary_type;
- reload_secondary_in_reload[s_reload] = in_p ? t_reload : -1;
- reload_secondary_out_reload[s_reload] = ! in_p ? t_reload : -1;
- reload_secondary_in_icode[s_reload] = in_p ? t_icode : CODE_FOR_nothing;
- reload_secondary_out_icode[s_reload]
- = ! in_p ? t_icode : CODE_FOR_nothing;
- reload_secondary_p[s_reload] = 1;
-
- n_reloads++;
-
-#ifdef SECONDARY_MEMORY_NEEDED
- /* If we need a memory location to copy between the two reload regs,
- set it up now. */
-
- if (in_p && icode == CODE_FOR_nothing
- && SECONDARY_MEMORY_NEEDED (class, reload_class, mode))
- get_secondary_mem (x, mode, opnum, type);
-
- if (! in_p && icode == CODE_FOR_nothing
- && SECONDARY_MEMORY_NEEDED (reload_class, class, mode))
- get_secondary_mem (x, mode, opnum, type);
-#endif
- }
-
- *picode = icode;
- return s_reload;
-}
-#endif /* HAVE_SECONDARY_RELOADS */
-
-#ifdef SECONDARY_MEMORY_NEEDED
-
-/* Return a memory location that will be used to copy X in mode MODE.
- If we haven't already made a location for this mode in this insn,
- call find_reloads_address on the location being returned. */
-
-rtx
-get_secondary_mem (x, mode, opnum, type)
- rtx x;
- enum machine_mode mode;
- int opnum;
- enum reload_type type;
-{
- rtx loc;
- int mem_valid;
-
- /* By default, if MODE is narrower than a word, widen it to a word.
- This is required because most machines that require these memory
- locations do not support short load and stores from all registers
- (e.g., FP registers). */
-
-#ifdef SECONDARY_MEMORY_NEEDED_MODE
- mode = SECONDARY_MEMORY_NEEDED_MODE (mode);
-#else
- if (GET_MODE_BITSIZE (mode) < BITS_PER_WORD)
- mode = mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (mode), 0);
-#endif
-
- /* If we already have made a MEM for this operand in MODE, return it. */
- if (secondary_memlocs_elim[(int) mode][opnum] != 0)
- return secondary_memlocs_elim[(int) mode][opnum];
-
- /* If this is the first time we've tried to get a MEM for this mode,
- allocate a new one. `something_changed' in reload will get set
- by noticing that the frame size has changed. */
-
- if (secondary_memlocs[(int) mode] == 0)
- {
-#ifdef SECONDARY_MEMORY_NEEDED_RTX
- secondary_memlocs[(int) mode] = SECONDARY_MEMORY_NEEDED_RTX (mode);
-#else
- secondary_memlocs[(int) mode]
- = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
-#endif
- }
-
- /* Get a version of the address doing any eliminations needed. If that
- didn't give us a new MEM, make a new one if it isn't valid. */
-
- loc = eliminate_regs (secondary_memlocs[(int) mode], VOIDmode, NULL_RTX, 0);
- mem_valid = strict_memory_address_p (mode, XEXP (loc, 0));
-
- if (! mem_valid && loc == secondary_memlocs[(int) mode])
- loc = copy_rtx (loc);
-
- /* The only time the call below will do anything is if the stack
- offset is too large. In that case IND_LEVELS doesn't matter, so we
- can just pass a zero. Adjust the type to be the address of the
- corresponding object. If the address was valid, save the eliminated
- address. If it wasn't valid, we need to make a reload each time, so
- don't save it. */
-
- if (! mem_valid)
- {
- type = (type == RELOAD_FOR_INPUT ? RELOAD_FOR_INPUT_ADDRESS
- : type == RELOAD_FOR_OUTPUT ? RELOAD_FOR_OUTPUT_ADDRESS
- : RELOAD_OTHER);
-
- find_reloads_address (mode, NULL_PTR, XEXP (loc, 0), &XEXP (loc, 0),
- opnum, type, 0, 0);
- }
-
- secondary_memlocs_elim[(int) mode][opnum] = loc;
- return loc;
-}
-
-/* Clear any secondary memory locations we've made. */
-
-void
-clear_secondary_mem ()
-{
- bzero ((char *) secondary_memlocs, sizeof secondary_memlocs);
-}
-#endif /* SECONDARY_MEMORY_NEEDED */
-
-/* Find the largest class for which every register number plus N is valid in
- M1 (if in range). Abort if no such class exists. */
-
-static enum reg_class
-find_valid_class (m1, n)
- enum machine_mode m1;
- int n;
-{
- int class;
- int regno;
- enum reg_class best_class;
- int best_size = 0;
-
- for (class = 1; class < N_REG_CLASSES; class++)
- {
- int bad = 0;
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER && ! bad; regno++)
- if (TEST_HARD_REG_BIT (reg_class_contents[class], regno)
- && TEST_HARD_REG_BIT (reg_class_contents[class], regno + n)
- && ! HARD_REGNO_MODE_OK (regno + n, m1))
- bad = 1;
-
- if (! bad && reg_class_size[class] > best_size)
- best_class = class, best_size = reg_class_size[class];
- }
-
- if (best_size == 0)
- abort ();
-
- return best_class;
-}
-
-/* Record one reload that needs to be performed.
- IN is an rtx saying where the data are to be found before this instruction.
- OUT says where they must be stored after the instruction.
- (IN is zero for data not read, and OUT is zero for data not written.)
- INLOC and OUTLOC point to the places in the instructions where
- IN and OUT were found.
- If IN and OUT are both non-zero, it means the same register must be used
- to reload both IN and OUT.
-
- CLASS is a register class required for the reloaded data.
- INMODE is the machine mode that the instruction requires
- for the reg that replaces IN and OUTMODE is likewise for OUT.
-
- If IN is zero, then OUT's location and mode should be passed as
- INLOC and INMODE.
-
- STRICT_LOW is the 1 if there is a containing STRICT_LOW_PART rtx.
-
- OPTIONAL nonzero means this reload does not need to be performed:
- it can be discarded if that is more convenient.
-
- OPNUM and TYPE say what the purpose of this reload is.
-
- The return value is the reload-number for this reload.
-
- If both IN and OUT are nonzero, in some rare cases we might
- want to make two separate reloads. (Actually we never do this now.)
- Therefore, the reload-number for OUT is stored in
- output_reloadnum when we return; the return value applies to IN.
- Usually (presently always), when IN and OUT are nonzero,
- the two reload-numbers are equal, but the caller should be careful to
- distinguish them. */
-
-static int
-push_reload (in, out, inloc, outloc, class,
- inmode, outmode, strict_low, optional, opnum, type)
- register rtx in, out;
- rtx *inloc, *outloc;
- enum reg_class class;
- enum machine_mode inmode, outmode;
- int strict_low;
- int optional;
- int opnum;
- enum reload_type type;
-{
- register int i;
- int dont_share = 0;
- int dont_remove_subreg = 0;
- rtx *in_subreg_loc = 0, *out_subreg_loc = 0;
- int secondary_in_reload = -1, secondary_out_reload = -1;
- enum insn_code secondary_in_icode = CODE_FOR_nothing;
- enum insn_code secondary_out_icode = CODE_FOR_nothing;
-
- /* INMODE and/or OUTMODE could be VOIDmode if no mode
- has been specified for the operand. In that case,
- use the operand's mode as the mode to reload. */
- if (inmode == VOIDmode && in != 0)
- inmode = GET_MODE (in);
- if (outmode == VOIDmode && out != 0)
- outmode = GET_MODE (out);
-
- /* If IN is a pseudo register everywhere-equivalent to a constant, and
- it is not in a hard register, reload straight from the constant,
- since we want to get rid of such pseudo registers.
- Often this is done earlier, but not always in find_reloads_address. */
- if (in != 0 && GET_CODE (in) == REG)
- {
- register int regno = REGNO (in);
-
- if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0)
- in = reg_equiv_constant[regno];
- }
-
- /* Likewise for OUT. Of course, OUT will never be equivalent to
- an actual constant, but it might be equivalent to a memory location
- (in the case of a parameter). */
- if (out != 0 && GET_CODE (out) == REG)
- {
- register int regno = REGNO (out);
-
- if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0)
- out = reg_equiv_constant[regno];
- }
-
- /* If we have a read-write operand with an address side-effect,
- change either IN or OUT so the side-effect happens only once. */
- if (in != 0 && out != 0 && GET_CODE (in) == MEM && rtx_equal_p (in, out))
- {
- if (GET_CODE (XEXP (in, 0)) == POST_INC
- || GET_CODE (XEXP (in, 0)) == POST_DEC)
- in = gen_rtx (MEM, GET_MODE (in), XEXP (XEXP (in, 0), 0));
- if (GET_CODE (XEXP (in, 0)) == PRE_INC
- || GET_CODE (XEXP (in, 0)) == PRE_DEC)
- out = gen_rtx (MEM, GET_MODE (out), XEXP (XEXP (out, 0), 0));
- }
-
- /* If we are reloading a (SUBREG constant ...), really reload just the
- inside expression in its own mode. Similarly for (SUBREG (PLUS ...)).
- If we have (SUBREG:M1 (MEM:M2 ...) ...) (or an inner REG that is still
- a pseudo and hence will become a MEM) with M1 wider than M2 and the
- register is a pseudo, also reload the inside expression.
- For machines that extend byte loads, do this for any SUBREG of a pseudo
- where both M1 and M2 are a word or smaller, M1 is wider than M2, and
- M2 is an integral mode that gets extended when loaded.
- Similar issue for (SUBREG:M1 (REG:M2 ...) ...) for a hard register R where
- either M1 is not valid for R or M2 is wider than a word but we only
- need one word to store an M2-sized quantity in R.
- (However, if OUT is nonzero, we need to reload the reg *and*
- the subreg, so do nothing here, and let following statement handle it.)
-
- Note that the case of (SUBREG (CONST_INT...)...) is handled elsewhere;
- we can't handle it here because CONST_INT does not indicate a mode.
-
- Similarly, we must reload the inside expression if we have a
- STRICT_LOW_PART (presumably, in == out in the cas).
-
- Also reload the inner expression if it does not require a secondary
- reload but the SUBREG does.
-
- Finally, reload the inner expression if it is a register that is in
- the class whose registers cannot be referenced in a different size
- and M1 is not the same size as M2. If SUBREG_WORD is nonzero, we
- cannot reload just the inside since we might end up with the wrong
- register class. */
-
- if (in != 0 && GET_CODE (in) == SUBREG && SUBREG_WORD (in) == 0
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- && class != CLASS_CANNOT_CHANGE_SIZE
-#endif
- && (CONSTANT_P (SUBREG_REG (in))
- || GET_CODE (SUBREG_REG (in)) == PLUS
- || strict_low
- || (((GET_CODE (SUBREG_REG (in)) == REG
- && REGNO (SUBREG_REG (in)) >= FIRST_PSEUDO_REGISTER)
- || GET_CODE (SUBREG_REG (in)) == MEM)
- && ((GET_MODE_SIZE (inmode)
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (in))))
-#ifdef LOAD_EXTEND_OP
- || (GET_MODE_SIZE (inmode) <= UNITS_PER_WORD
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
- <= UNITS_PER_WORD)
- && (GET_MODE_SIZE (inmode)
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (in))))
- && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (in)))
- && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (in))) != NIL)
-#endif
- ))
- || (GET_CODE (SUBREG_REG (in)) == REG
- && REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER
- /* The case where out is nonzero
- is handled differently in the following statement. */
- && (out == 0 || SUBREG_WORD (in) == 0)
- && ((GET_MODE_SIZE (inmode) <= UNITS_PER_WORD
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
- > UNITS_PER_WORD)
- && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
- / UNITS_PER_WORD)
- != HARD_REGNO_NREGS (REGNO (SUBREG_REG (in)),
- GET_MODE (SUBREG_REG (in)))))
- || ! HARD_REGNO_MODE_OK ((REGNO (SUBREG_REG (in))
- + SUBREG_WORD (in)),
- inmode)))
-#ifdef SECONDARY_INPUT_RELOAD_CLASS
- || (SECONDARY_INPUT_RELOAD_CLASS (class, inmode, in) != NO_REGS
- && (SECONDARY_INPUT_RELOAD_CLASS (class,
- GET_MODE (SUBREG_REG (in)),
- SUBREG_REG (in))
- == NO_REGS))
-#endif
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- || (GET_CODE (SUBREG_REG (in)) == REG
- && REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER
- && (TEST_HARD_REG_BIT
- (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE],
- REGNO (SUBREG_REG (in))))
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
- != GET_MODE_SIZE (inmode)))
-#endif
- ))
- {
- in_subreg_loc = inloc;
- inloc = &SUBREG_REG (in);
- in = *inloc;
-#ifndef LOAD_EXTEND_OP
- if (GET_CODE (in) == MEM)
- /* This is supposed to happen only for paradoxical subregs made by
- combine.c. (SUBREG (MEM)) isn't supposed to occur other ways. */
- if (GET_MODE_SIZE (GET_MODE (in)) > GET_MODE_SIZE (inmode))
- abort ();
-#endif
- inmode = GET_MODE (in);
- }
-
- /* Similar issue for (SUBREG:M1 (REG:M2 ...) ...) for a hard register R where
- either M1 is not valid for R or M2 is wider than a word but we only
- need one word to store an M2-sized quantity in R.
-
- However, we must reload the inner reg *as well as* the subreg in
- that case. */
-
- /* Similar issue for (SUBREG constant ...) if it was not handled by the
- code above. This can happen if SUBREG_WORD != 0. */
-
- if (in != 0 && GET_CODE (in) == SUBREG
- && (CONSTANT_P (SUBREG_REG (in))
- || (GET_CODE (SUBREG_REG (in)) == REG
- && REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER
- && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (in))
- + SUBREG_WORD (in),
- inmode)
- || (GET_MODE_SIZE (inmode) <= UNITS_PER_WORD
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
- > UNITS_PER_WORD)
- && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
- / UNITS_PER_WORD)
- != HARD_REGNO_NREGS (REGNO (SUBREG_REG (in)),
- GET_MODE (SUBREG_REG (in)))))))))
- {
- /* This relies on the fact that emit_reload_insns outputs the
- instructions for input reloads of type RELOAD_OTHER in the same
- order as the reloads. Thus if the outer reload is also of type
- RELOAD_OTHER, we are guaranteed that this inner reload will be
- output before the outer reload. */
- push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), NULL_PTR,
- find_valid_class (inmode, SUBREG_WORD (in)),
- VOIDmode, VOIDmode, 0, 0, opnum, type);
- dont_remove_subreg = 1;
- }
-
- /* Similarly for paradoxical and problematical SUBREGs on the output.
- Note that there is no reason we need worry about the previous value
- of SUBREG_REG (out); even if wider than out,
- storing in a subreg is entitled to clobber it all
- (except in the case of STRICT_LOW_PART,
- and in that case the constraint should label it input-output.) */
- if (out != 0 && GET_CODE (out) == SUBREG && SUBREG_WORD (out) == 0
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- && class != CLASS_CANNOT_CHANGE_SIZE
-#endif
- && (CONSTANT_P (SUBREG_REG (out))
- || strict_low
- || (((GET_CODE (SUBREG_REG (out)) == REG
- && REGNO (SUBREG_REG (out)) >= FIRST_PSEUDO_REGISTER)
- || GET_CODE (SUBREG_REG (out)) == MEM)
- && ((GET_MODE_SIZE (outmode)
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (out))))))
- || (GET_CODE (SUBREG_REG (out)) == REG
- && REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER
- && ((GET_MODE_SIZE (outmode) <= UNITS_PER_WORD
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))
- > UNITS_PER_WORD)
- && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))
- / UNITS_PER_WORD)
- != HARD_REGNO_NREGS (REGNO (SUBREG_REG (out)),
- GET_MODE (SUBREG_REG (out)))))
- || ! HARD_REGNO_MODE_OK ((REGNO (SUBREG_REG (out))
- + SUBREG_WORD (out)),
- outmode)))
-#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
- || (SECONDARY_OUTPUT_RELOAD_CLASS (class, outmode, out) != NO_REGS
- && (SECONDARY_OUTPUT_RELOAD_CLASS (class,
- GET_MODE (SUBREG_REG (out)),
- SUBREG_REG (out))
- == NO_REGS))
-#endif
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- || (GET_CODE (SUBREG_REG (out)) == REG
- && REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER
- && (TEST_HARD_REG_BIT
- (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE],
- REGNO (SUBREG_REG (out))))
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))
- != GET_MODE_SIZE (outmode)))
-#endif
- ))
- {
- out_subreg_loc = outloc;
- outloc = &SUBREG_REG (out);
- out = *outloc;
-#ifndef LOAD_EXTEND_OP
- if (GET_CODE (out) == MEM
- && GET_MODE_SIZE (GET_MODE (out)) > GET_MODE_SIZE (outmode))
- abort ();
-#endif
- outmode = GET_MODE (out);
- }
-
- /* Similar issue for (SUBREG:M1 (REG:M2 ...) ...) for a hard register R where
- either M1 is not valid for R or M2 is wider than a word but we only
- need one word to store an M2-sized quantity in R.
-
- However, we must reload the inner reg *as well as* the subreg in
- that case. In this case, the inner reg is an in-out reload. */
-
- if (out != 0 && GET_CODE (out) == SUBREG
- && GET_CODE (SUBREG_REG (out)) == REG
- && REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER
- && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (out)) + SUBREG_WORD (out),
- outmode)
- || (GET_MODE_SIZE (outmode) <= UNITS_PER_WORD
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))
- > UNITS_PER_WORD)
- && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))
- / UNITS_PER_WORD)
- != HARD_REGNO_NREGS (REGNO (SUBREG_REG (out)),
- GET_MODE (SUBREG_REG (out)))))))
- {
- /* This relies on the fact that emit_reload_insns outputs the
- instructions for output reloads of type RELOAD_OTHER in reverse
- order of the reloads. Thus if the outer reload is also of type
- RELOAD_OTHER, we are guaranteed that this inner reload will be
- output after the outer reload. */
- dont_remove_subreg = 1;
- push_reload (SUBREG_REG (out), SUBREG_REG (out), &SUBREG_REG (out),
- &SUBREG_REG (out),
- find_valid_class (outmode, SUBREG_WORD (out)),
- VOIDmode, VOIDmode, 0, 0,
- opnum, RELOAD_OTHER);
- }
-
- /* If IN appears in OUT, we can't share any input-only reload for IN. */
- if (in != 0 && out != 0 && GET_CODE (out) == MEM
- && (GET_CODE (in) == REG || GET_CODE (in) == MEM)
- && reg_overlap_mentioned_for_reload_p (in, XEXP (out, 0)))
- dont_share = 1;
-
- /* If IN is a SUBREG of a hard register, make a new REG. This
- simplifies some of the cases below. */
-
- if (in != 0 && GET_CODE (in) == SUBREG && GET_CODE (SUBREG_REG (in)) == REG
- && REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER
- && ! dont_remove_subreg)
- in = gen_rtx (REG, GET_MODE (in),
- REGNO (SUBREG_REG (in)) + SUBREG_WORD (in));
-
- /* Similarly for OUT. */
- if (out != 0 && GET_CODE (out) == SUBREG
- && GET_CODE (SUBREG_REG (out)) == REG
- && REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER
- && ! dont_remove_subreg)
- out = gen_rtx (REG, GET_MODE (out),
- REGNO (SUBREG_REG (out)) + SUBREG_WORD (out));
-
- /* Narrow down the class of register wanted if that is
- desirable on this machine for efficiency. */
- if (in != 0)
- class = PREFERRED_RELOAD_CLASS (in, class);
-
- /* Output reloads may need analogous treatment, different in detail. */
-#ifdef PREFERRED_OUTPUT_RELOAD_CLASS
- if (out != 0)
- class = PREFERRED_OUTPUT_RELOAD_CLASS (out, class);
-#endif
-
- /* Make sure we use a class that can handle the actual pseudo
- inside any subreg. For example, on the 386, QImode regs
- can appear within SImode subregs. Although GENERAL_REGS
- can handle SImode, QImode needs a smaller class. */
-#ifdef LIMIT_RELOAD_CLASS
- if (in_subreg_loc)
- class = LIMIT_RELOAD_CLASS (inmode, class);
- else if (in != 0 && GET_CODE (in) == SUBREG)
- class = LIMIT_RELOAD_CLASS (GET_MODE (SUBREG_REG (in)), class);
-
- if (out_subreg_loc)
- class = LIMIT_RELOAD_CLASS (outmode, class);
- if (out != 0 && GET_CODE (out) == SUBREG)
- class = LIMIT_RELOAD_CLASS (GET_MODE (SUBREG_REG (out)), class);
-#endif
-
- /* Verify that this class is at least possible for the mode that
- is specified. */
- if (this_insn_is_asm)
- {
- enum machine_mode mode;
- if (GET_MODE_SIZE (inmode) > GET_MODE_SIZE (outmode))
- mode = inmode;
- else
- mode = outmode;
- if (mode == VOIDmode)
- {
- error_for_asm (this_insn, "cannot reload integer constant operand in `asm'");
- mode = word_mode;
- if (in != 0)
- inmode = word_mode;
- if (out != 0)
- outmode = word_mode;
- }
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (HARD_REGNO_MODE_OK (i, mode)
- && TEST_HARD_REG_BIT (reg_class_contents[(int) class], i))
- {
- int nregs = HARD_REGNO_NREGS (i, mode);
-
- int j;
- for (j = 1; j < nregs; j++)
- if (! TEST_HARD_REG_BIT (reg_class_contents[(int) class], i + j))
- break;
- if (j == nregs)
- break;
- }
- if (i == FIRST_PSEUDO_REGISTER)
- {
- error_for_asm (this_insn, "impossible register constraint in `asm'");
- class = ALL_REGS;
- }
- }
-
- if (class == NO_REGS)
- abort ();
-
- /* We can use an existing reload if the class is right
- and at least one of IN and OUT is a match
- and the other is at worst neutral.
- (A zero compared against anything is neutral.)
-
- If SMALL_REGISTER_CLASSES, don't use existing reloads unless they are
- for the same thing since that can cause us to need more reload registers
- than we otherwise would. */
-
- for (i = 0; i < n_reloads; i++)
- if ((reg_class_subset_p (class, reload_reg_class[i])
- || reg_class_subset_p (reload_reg_class[i], class))
- /* If the existing reload has a register, it must fit our class. */
- && (reload_reg_rtx[i] == 0
- || TEST_HARD_REG_BIT (reg_class_contents[(int) class],
- true_regnum (reload_reg_rtx[i])))
- && ((in != 0 && MATCHES (reload_in[i], in) && ! dont_share
- && (out == 0 || reload_out[i] == 0 || MATCHES (reload_out[i], out)))
- ||
- (out != 0 && MATCHES (reload_out[i], out)
- && (in == 0 || reload_in[i] == 0 || MATCHES (reload_in[i], in))))
- && (reg_class_size[(int) class] == 1
-#ifdef SMALL_REGISTER_CLASSES
- || SMALL_REGISTER_CLASSES
-#endif
- )
- && MERGABLE_RELOADS (type, reload_when_needed[i],
- opnum, reload_opnum[i]))
- break;
-
- /* Reloading a plain reg for input can match a reload to postincrement
- that reg, since the postincrement's value is the right value.
- Likewise, it can match a preincrement reload, since we regard
- the preincrementation as happening before any ref in this insn
- to that register. */
- if (i == n_reloads)
- for (i = 0; i < n_reloads; i++)
- if ((reg_class_subset_p (class, reload_reg_class[i])
- || reg_class_subset_p (reload_reg_class[i], class))
- /* If the existing reload has a register, it must fit our class. */
- && (reload_reg_rtx[i] == 0
- || TEST_HARD_REG_BIT (reg_class_contents[(int) class],
- true_regnum (reload_reg_rtx[i])))
- && out == 0 && reload_out[i] == 0 && reload_in[i] != 0
- && ((GET_CODE (in) == REG
- && (GET_CODE (reload_in[i]) == POST_INC
- || GET_CODE (reload_in[i]) == POST_DEC
- || GET_CODE (reload_in[i]) == PRE_INC
- || GET_CODE (reload_in[i]) == PRE_DEC)
- && MATCHES (XEXP (reload_in[i], 0), in))
- ||
- (GET_CODE (reload_in[i]) == REG
- && (GET_CODE (in) == POST_INC
- || GET_CODE (in) == POST_DEC
- || GET_CODE (in) == PRE_INC
- || GET_CODE (in) == PRE_DEC)
- && MATCHES (XEXP (in, 0), reload_in[i])))
- && (reg_class_size[(int) class] == 1
-#ifdef SMALL_REGISTER_CLASSES
- || SMALL_REGISTER_CLASSES
-#endif
- )
- && MERGABLE_RELOADS (type, reload_when_needed[i],
- opnum, reload_opnum[i]))
- {
- /* Make sure reload_in ultimately has the increment,
- not the plain register. */
- if (GET_CODE (in) == REG)
- in = reload_in[i];
- break;
- }
-
- if (i == n_reloads)
- {
- /* See if we need a secondary reload register to move between CLASS
- and IN or CLASS and OUT. Get the icode and push any required reloads
- needed for each of them if so. */
-
-#ifdef SECONDARY_INPUT_RELOAD_CLASS
- if (in != 0)
- secondary_in_reload
- = push_secondary_reload (1, in, opnum, optional, class, inmode, type,
- &secondary_in_icode);
-#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);
-#endif
-
- /* We found no existing reload suitable for re-use.
- So add an additional reload. */
-
- i = n_reloads;
- reload_in[i] = in;
- reload_out[i] = out;
- reload_reg_class[i] = class;
- reload_inmode[i] = inmode;
- reload_outmode[i] = outmode;
- reload_reg_rtx[i] = 0;
- reload_optional[i] = optional;
- reload_inc[i] = 0;
- reload_nocombine[i] = 0;
- reload_in_reg[i] = inloc ? *inloc : 0;
- reload_opnum[i] = opnum;
- reload_when_needed[i] = type;
- reload_secondary_in_reload[i] = secondary_in_reload;
- reload_secondary_out_reload[i] = secondary_out_reload;
- reload_secondary_in_icode[i] = secondary_in_icode;
- reload_secondary_out_icode[i] = secondary_out_icode;
- reload_secondary_p[i] = 0;
-
- n_reloads++;
-
-#ifdef SECONDARY_MEMORY_NEEDED
- /* If a memory location is needed for the copy, make one. */
- if (in != 0 && GET_CODE (in) == REG
- && REGNO (in) < FIRST_PSEUDO_REGISTER
- && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (REGNO (in)),
- class, inmode))
- get_secondary_mem (in, inmode, opnum, type);
-
- if (out != 0 && GET_CODE (out) == REG
- && REGNO (out) < FIRST_PSEUDO_REGISTER
- && SECONDARY_MEMORY_NEEDED (class, REGNO_REG_CLASS (REGNO (out)),
- outmode))
- get_secondary_mem (out, outmode, opnum, type);
-#endif
- }
- else
- {
- /* We are reusing an existing reload,
- but we may have additional information for it.
- For example, we may now have both IN and OUT
- while the old one may have just one of them. */
-
- /* The modes can be different. If they are, we want to reload in
- the larger mode, so that the value is valid for both modes. */
- if (inmode != VOIDmode
- && GET_MODE_SIZE (inmode) > GET_MODE_SIZE (reload_inmode[i]))
- reload_inmode[i] = inmode;
- if (outmode != VOIDmode
- && GET_MODE_SIZE (outmode) > GET_MODE_SIZE (reload_outmode[i]))
- reload_outmode[i] = outmode;
- if (in != 0)
- reload_in[i] = in;
- if (out != 0)
- reload_out[i] = out;
- if (reg_class_subset_p (class, reload_reg_class[i]))
- reload_reg_class[i] = class;
- reload_optional[i] &= optional;
- if (MERGE_TO_OTHER (type, reload_when_needed[i],
- opnum, reload_opnum[i]))
- reload_when_needed[i] = RELOAD_OTHER;
- reload_opnum[i] = MIN (reload_opnum[i], opnum);
- }
-
- /* If the ostensible rtx being reload differs from the rtx found
- in the location to substitute, this reload is not safe to combine
- because we cannot reliably tell whether it appears in the insn. */
-
- if (in != 0 && in != *inloc)
- reload_nocombine[i] = 1;
-
-#if 0
- /* This was replaced by changes in find_reloads_address_1 and the new
- function inc_for_reload, which go with a new meaning of reload_inc. */
-
- /* If this is an IN/OUT reload in an insn that sets the CC,
- it must be for an autoincrement. It doesn't work to store
- the incremented value after the insn because that would clobber the CC.
- So we must do the increment of the value reloaded from,
- increment it, store it back, then decrement again. */
- if (out != 0 && sets_cc0_p (PATTERN (this_insn)))
- {
- out = 0;
- reload_out[i] = 0;
- reload_inc[i] = find_inc_amount (PATTERN (this_insn), in);
- /* If we did not find a nonzero amount-to-increment-by,
- that contradicts the belief that IN is being incremented
- in an address in this insn. */
- if (reload_inc[i] == 0)
- abort ();
- }
-#endif
-
- /* If we will replace IN and OUT with the reload-reg,
- record where they are located so that substitution need
- not do a tree walk. */
-
- if (replace_reloads)
- {
- if (inloc != 0)
- {
- register struct replacement *r = &replacements[n_replacements++];
- r->what = i;
- r->subreg_loc = in_subreg_loc;
- r->where = inloc;
- r->mode = inmode;
- }
- if (outloc != 0 && outloc != inloc)
- {
- register struct replacement *r = &replacements[n_replacements++];
- r->what = i;
- r->where = outloc;
- r->subreg_loc = out_subreg_loc;
- r->mode = outmode;
- }
- }
-
- /* If this reload is just being introduced and it has both
- an incoming quantity and an outgoing quantity that are
- supposed to be made to match, see if either one of the two
- can serve as the place to reload into.
-
- If one of them is acceptable, set reload_reg_rtx[i]
- to that one. */
-
- if (in != 0 && out != 0 && in != out && reload_reg_rtx[i] == 0)
- {
- reload_reg_rtx[i] = find_dummy_reload (in, out, inloc, outloc,
- inmode, outmode,
- reload_reg_class[i], i,
- reload_earlyclobbers[i] != NULL);
-
- /* If the outgoing register already contains the same value
- as the incoming one, we can dispense with loading it.
- The easiest way to tell the caller that is to give a phony
- value for the incoming operand (same as outgoing one). */
- if (reload_reg_rtx[i] == out
- && (GET_CODE (in) == REG || CONSTANT_P (in))
- && 0 != find_equiv_reg (in, this_insn, 0, REGNO (out),
- static_reload_reg_p, i, inmode))
- reload_in[i] = out;
- }
-
- /* If this is an input reload and the operand contains a register that
- dies in this insn and is used nowhere else, see if it is the right class
- to be used for this reload. Use it if so. (This occurs most commonly
- in the case of paradoxical SUBREGs and in-out reloads). We cannot do
- this if it is also an output reload that mentions the register unless
- the output is a SUBREG that clobbers an entire register.
-
- Note that the operand might be one of the spill regs, if it is a
- pseudo reg and we are in a block where spilling has not taken place.
- But if there is no spilling in this block, that is OK.
- An explicitly used hard reg cannot be a spill reg. */
-
- if (reload_reg_rtx[i] == 0 && in != 0)
- {
- rtx note;
- int regno;
-
- for (note = REG_NOTES (this_insn); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_DEAD
- && GET_CODE (XEXP (note, 0)) == REG
- && (regno = REGNO (XEXP (note, 0))) < FIRST_PSEUDO_REGISTER
- && reg_mentioned_p (XEXP (note, 0), in)
- && ! refers_to_regno_for_reload_p (regno,
- (regno
- + HARD_REGNO_NREGS (regno,
- inmode)),
- PATTERN (this_insn), inloc)
- /* If this is also an output reload, IN cannot be used as
- the reload register if it is set in this insn unless IN
- is also OUT. */
- && (out == 0 || in == out
- || ! hard_reg_set_here_p (regno,
- (regno
- + HARD_REGNO_NREGS (regno,
- inmode)),
- PATTERN (this_insn)))
- /* ??? Why is this code so different from the previous?
- Is there any simple coherent way to describe the two together?
- What's going on here. */
- && (in != out
- || (GET_CODE (in) == SUBREG
- && (((GET_MODE_SIZE (GET_MODE (in)) + (UNITS_PER_WORD - 1))
- / UNITS_PER_WORD)
- == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD))))
- /* Make sure the operand fits in the reg that dies. */
- && GET_MODE_SIZE (inmode) <= GET_MODE_SIZE (GET_MODE (XEXP (note, 0)))
- && HARD_REGNO_MODE_OK (regno, inmode)
- && GET_MODE_SIZE (outmode) <= GET_MODE_SIZE (GET_MODE (XEXP (note, 0)))
- && HARD_REGNO_MODE_OK (regno, outmode)
- && TEST_HARD_REG_BIT (reg_class_contents[(int) class], regno)
- && !fixed_regs[regno])
- {
- reload_reg_rtx[i] = gen_rtx (REG, inmode, regno);
- break;
- }
- }
-
- if (out)
- output_reloadnum = i;
-
- return i;
-}
-
-/* Record an additional place we must replace a value
- for which we have already recorded a reload.
- RELOADNUM is the value returned by push_reload
- when the reload was recorded.
- This is used in insn patterns that use match_dup. */
-
-static void
-push_replacement (loc, reloadnum, mode)
- rtx *loc;
- int reloadnum;
- enum machine_mode mode;
-{
- if (replace_reloads)
- {
- register struct replacement *r = &replacements[n_replacements++];
- r->what = reloadnum;
- r->where = loc;
- r->subreg_loc = 0;
- r->mode = mode;
- }
-}
-
-/* Transfer all replacements that used to be in reload FROM to be in
- reload TO. */
-
-void
-transfer_replacements (to, from)
- int to, from;
-{
- int i;
-
- for (i = 0; i < n_replacements; i++)
- if (replacements[i].what == from)
- replacements[i].what = to;
-}
-
-/* If there is only one output reload, and it is not for an earlyclobber
- operand, try to combine it with a (logically unrelated) input reload
- to reduce the number of reload registers needed.
-
- This is safe if the input reload does not appear in
- the value being output-reloaded, because this implies
- it is not needed any more once the original insn completes.
-
- If that doesn't work, see we can use any of the registers that
- die in this insn as a reload register. We can if it is of the right
- class and does not appear in the value being output-reloaded. */
-
-static void
-combine_reloads ()
-{
- int i;
- int output_reload = -1;
- int secondary_out = -1;
- rtx note;
-
- /* Find the output reload; return unless there is exactly one
- and that one is mandatory. */
-
- for (i = 0; i < n_reloads; i++)
- if (reload_out[i] != 0)
- {
- if (output_reload >= 0)
- return;
- output_reload = i;
- }
-
- if (output_reload < 0 || reload_optional[output_reload])
- return;
-
- /* An input-output reload isn't combinable. */
-
- if (reload_in[output_reload] != 0)
- return;
-
- /* If this reload is for an earlyclobber operand, we can't do anything. */
- if (earlyclobber_operand_p (reload_out[output_reload]))
- return;
-
- /* Check each input reload; can we combine it? */
-
- for (i = 0; i < n_reloads; i++)
- if (reload_in[i] && ! reload_optional[i] && ! reload_nocombine[i]
- /* Life span of this reload must not extend past main insn. */
- && reload_when_needed[i] != RELOAD_FOR_OUTPUT_ADDRESS
- && reload_when_needed[i] != RELOAD_FOR_OUTADDR_ADDRESS
- && reload_when_needed[i] != RELOAD_OTHER
- && (CLASS_MAX_NREGS (reload_reg_class[i], reload_inmode[i])
- == CLASS_MAX_NREGS (reload_reg_class[output_reload],
- reload_outmode[output_reload]))
- && reload_inc[i] == 0
- && reload_reg_rtx[i] == 0
-#ifdef SECONDARY_MEMORY_NEEDED
- /* Don't combine two reloads with different secondary
- memory locations. */
- && (secondary_memlocs_elim[(int) reload_outmode[output_reload]][reload_opnum[i]] == 0
- || secondary_memlocs_elim[(int) reload_outmode[output_reload]][reload_opnum[output_reload]] == 0
- || rtx_equal_p (secondary_memlocs_elim[(int) reload_outmode[output_reload]][reload_opnum[i]],
- secondary_memlocs_elim[(int) reload_outmode[output_reload]][reload_opnum[output_reload]]))
-#endif
- && (
-#ifdef SMALL_REGISTER_CLASSES
- SMALL_REGISTER_CLASSES
-#else
- 0
-#endif
- ? reload_reg_class[i] == reload_reg_class[output_reload]
- : (reg_class_subset_p (reload_reg_class[i],
- reload_reg_class[output_reload])
- || reg_class_subset_p (reload_reg_class[output_reload],
- reload_reg_class[i])))
- && (MATCHES (reload_in[i], reload_out[output_reload])
- /* Args reversed because the first arg seems to be
- the one that we imagine being modified
- while the second is the one that might be affected. */
- || (! reg_overlap_mentioned_for_reload_p (reload_out[output_reload],
- reload_in[i])
- /* However, if the input is a register that appears inside
- the output, then we also can't share.
- Imagine (set (mem (reg 69)) (plus (reg 69) ...)).
- If the same reload reg is used for both reg 69 and the
- result to be stored in memory, then that result
- will clobber the address of the memory ref. */
- && ! (GET_CODE (reload_in[i]) == REG
- && reg_overlap_mentioned_for_reload_p (reload_in[i],
- reload_out[output_reload]))))
- && (reg_class_size[(int) reload_reg_class[i]]
-#ifdef SMALL_REGISTER_CLASSES
- || SMALL_REGISTER_CLASSES
-#endif
- )
- /* We will allow making things slightly worse by combining an
- input and an output, but no worse than that. */
- && (reload_when_needed[i] == RELOAD_FOR_INPUT
- || reload_when_needed[i] == RELOAD_FOR_OUTPUT))
- {
- int j;
-
- /* We have found a reload to combine with! */
- reload_out[i] = reload_out[output_reload];
- reload_outmode[i] = reload_outmode[output_reload];
- /* Mark the old output reload as inoperative. */
- reload_out[output_reload] = 0;
- /* The combined reload is needed for the entire insn. */
- reload_when_needed[i] = RELOAD_OTHER;
- /* If the output reload had a secondary reload, copy it. */
- if (reload_secondary_out_reload[output_reload] != -1)
- {
- reload_secondary_out_reload[i]
- = reload_secondary_out_reload[output_reload];
- reload_secondary_out_icode[i]
- = reload_secondary_out_icode[output_reload];
- }
-
-#ifdef SECONDARY_MEMORY_NEEDED
- /* Copy any secondary MEM. */
- if (secondary_memlocs_elim[(int) reload_outmode[output_reload]][reload_opnum[output_reload]] != 0)
- secondary_memlocs_elim[(int) reload_outmode[output_reload]][reload_opnum[i]]
- = secondary_memlocs_elim[(int) reload_outmode[output_reload]][reload_opnum[output_reload]];
-#endif
- /* If required, minimize the register class. */
- if (reg_class_subset_p (reload_reg_class[output_reload],
- reload_reg_class[i]))
- reload_reg_class[i] = reload_reg_class[output_reload];
-
- /* Transfer all replacements from the old reload to the combined. */
- for (j = 0; j < n_replacements; j++)
- if (replacements[j].what == output_reload)
- replacements[j].what = i;
-
- return;
- }
-
- /* If this insn has only one operand that is modified or written (assumed
- to be the first), it must be the one corresponding to this reload. It
- is safe to use anything that dies in this insn for that output provided
- that it does not occur in the output (we already know it isn't an
- earlyclobber. If this is an asm insn, give up. */
-
- if (INSN_CODE (this_insn) == -1)
- return;
-
- for (i = 1; i < insn_n_operands[INSN_CODE (this_insn)]; i++)
- if (insn_operand_constraint[INSN_CODE (this_insn)][i][0] == '='
- || insn_operand_constraint[INSN_CODE (this_insn)][i][0] == '+')
- return;
-
- /* See if some hard register that dies in this insn and is not used in
- the output is the right class. Only works if the register we pick
- up can fully hold our output reload. */
- for (note = REG_NOTES (this_insn); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_DEAD
- && GET_CODE (XEXP (note, 0)) == REG
- && ! reg_overlap_mentioned_for_reload_p (XEXP (note, 0),
- reload_out[output_reload])
- && REGNO (XEXP (note, 0)) < FIRST_PSEUDO_REGISTER
- && HARD_REGNO_MODE_OK (REGNO (XEXP (note, 0)), reload_outmode[output_reload])
- && TEST_HARD_REG_BIT (reg_class_contents[(int) reload_reg_class[output_reload]],
- REGNO (XEXP (note, 0)))
- && (HARD_REGNO_NREGS (REGNO (XEXP (note, 0)), reload_outmode[output_reload])
- <= HARD_REGNO_NREGS (REGNO (XEXP (note, 0)), GET_MODE (XEXP (note, 0))))
- /* Ensure that a secondary or tertiary reload for this output
- won't want this register. */
- && ((secondary_out = reload_secondary_out_reload[output_reload]) == -1
- || (! (TEST_HARD_REG_BIT
- (reg_class_contents[(int) reload_reg_class[secondary_out]],
- REGNO (XEXP (note, 0))))
- && ((secondary_out = reload_secondary_out_reload[secondary_out]) == -1
- || ! (TEST_HARD_REG_BIT
- (reg_class_contents[(int) reload_reg_class[secondary_out]],
- REGNO (XEXP (note, 0)))))))
- && ! fixed_regs[REGNO (XEXP (note, 0))])
- {
- reload_reg_rtx[output_reload] = gen_rtx (REG,
- reload_outmode[output_reload],
- REGNO (XEXP (note, 0)));
- return;
- }
-}
-
-/* Try to find a reload register for an in-out reload (expressions IN and OUT).
- See if one of IN and OUT is a register that may be used;
- this is desirable since a spill-register won't be needed.
- If so, return the register rtx that proves acceptable.
-
- INLOC and OUTLOC are locations where IN and OUT appear in the insn.
- CLASS is the register class required for the reload.
-
- If FOR_REAL is >= 0, it is the number of the reload,
- and in some cases when it can be discovered that OUT doesn't need
- to be computed, clear out reload_out[FOR_REAL].
-
- If FOR_REAL is -1, this should not be done, because this call
- is just to see if a register can be found, not to find and install it.
-
- EARLYCLOBBER is non-zero if OUT is an earlyclobber operand. This
- puts an additional constraint on being able to use IN for OUT since
- IN must not appear elsewhere in the insn (it is assumed that IN itself
- is safe from the earlyclobber). */
-
-static rtx
-find_dummy_reload (real_in, real_out, inloc, outloc,
- inmode, outmode, class, for_real, earlyclobber)
- rtx real_in, real_out;
- rtx *inloc, *outloc;
- enum machine_mode inmode, outmode;
- enum reg_class class;
- int for_real;
- int earlyclobber;
-{
- rtx in = real_in;
- rtx out = real_out;
- int in_offset = 0;
- int out_offset = 0;
- rtx value = 0;
-
- /* If operands exceed a word, we can't use either of them
- unless they have the same size. */
- if (GET_MODE_SIZE (outmode) != GET_MODE_SIZE (inmode)
- && (GET_MODE_SIZE (outmode) > UNITS_PER_WORD
- || GET_MODE_SIZE (inmode) > UNITS_PER_WORD))
- return 0;
-
- /* Find the inside of any subregs. */
- while (GET_CODE (out) == SUBREG)
- {
- out_offset = SUBREG_WORD (out);
- out = SUBREG_REG (out);
- }
- while (GET_CODE (in) == SUBREG)
- {
- in_offset = SUBREG_WORD (in);
- in = SUBREG_REG (in);
- }
-
- /* Narrow down the reg class, the same way push_reload will;
- otherwise we might find a dummy now, but push_reload won't. */
- class = PREFERRED_RELOAD_CLASS (in, class);
-
- /* See if OUT will do. */
- if (GET_CODE (out) == REG
- && REGNO (out) < FIRST_PSEUDO_REGISTER)
- {
- register int regno = REGNO (out) + out_offset;
- int nwords = HARD_REGNO_NREGS (regno, outmode);
- rtx saved_rtx;
-
- /* When we consider whether the insn uses OUT,
- ignore references within IN. They don't prevent us
- from copying IN into OUT, because those refs would
- move into the insn that reloads IN.
-
- However, we only ignore IN in its role as this reload.
- If the insn uses IN elsewhere and it contains OUT,
- that counts. We can't be sure it's the "same" operand
- so it might not go through this reload. */
- saved_rtx = *inloc;
- *inloc = const0_rtx;
-
- if (regno < FIRST_PSEUDO_REGISTER
- /* A fixed reg that can overlap other regs better not be used
- for reloading in any way. */
-#ifdef OVERLAPPING_REGNO_P
- && ! (fixed_regs[regno] && OVERLAPPING_REGNO_P (regno))
-#endif
- && ! refers_to_regno_for_reload_p (regno, regno + nwords,
- PATTERN (this_insn), outloc))
- {
- int i;
- for (i = 0; i < nwords; i++)
- if (! TEST_HARD_REG_BIT (reg_class_contents[(int) class],
- regno + i))
- break;
-
- if (i == nwords)
- {
- if (GET_CODE (real_out) == REG)
- value = real_out;
- else
- value = gen_rtx (REG, outmode, regno);
- }
- }
-
- *inloc = saved_rtx;
- }
-
- /* Consider using IN if OUT was not acceptable
- or if OUT dies in this insn (like the quotient in a divmod insn).
- We can't use IN unless it is dies in this insn,
- which means we must know accurately which hard regs are live.
- Also, the result can't go in IN if IN is used within OUT,
- or if OUT is an earlyclobber and IN appears elsewhere in the insn. */
- if (hard_regs_live_known
- && GET_CODE (in) == REG
- && REGNO (in) < FIRST_PSEUDO_REGISTER
- && (value == 0
- || find_reg_note (this_insn, REG_UNUSED, real_out))
- && find_reg_note (this_insn, REG_DEAD, real_in)
- && !fixed_regs[REGNO (in)]
- && HARD_REGNO_MODE_OK (REGNO (in),
- /* The only case where out and real_out might
- have different modes is where real_out
- is a subreg, and in that case, out
- has a real mode. */
- (GET_MODE (out) != VOIDmode
- ? GET_MODE (out) : outmode)))
- {
- register int regno = REGNO (in) + in_offset;
- int nwords = HARD_REGNO_NREGS (regno, inmode);
-
- if (! refers_to_regno_for_reload_p (regno, regno + nwords, out, NULL_PTR)
- && ! hard_reg_set_here_p (regno, regno + nwords,
- PATTERN (this_insn))
- && (! earlyclobber
- || ! refers_to_regno_for_reload_p (regno, regno + nwords,
- PATTERN (this_insn), inloc)))
- {
- int i;
- for (i = 0; i < nwords; i++)
- if (! TEST_HARD_REG_BIT (reg_class_contents[(int) class],
- regno + i))
- break;
-
- if (i == nwords)
- {
- /* If we were going to use OUT as the reload reg
- and changed our mind, it means OUT is a dummy that
- dies here. So don't bother copying value to it. */
- if (for_real >= 0 && value == real_out)
- reload_out[for_real] = 0;
- if (GET_CODE (real_in) == REG)
- value = real_in;
- else
- value = gen_rtx (REG, inmode, regno);
- }
- }
- }
-
- return value;
-}
-
-/* This page contains subroutines used mainly for determining
- whether the IN or an OUT of a reload can serve as the
- reload register. */
-
-/* Return 1 if X is an operand of an insn that is being earlyclobbered. */
-
-static int
-earlyclobber_operand_p (x)
- rtx x;
-{
- int i;
-
- for (i = 0; i < n_earlyclobbers; i++)
- if (reload_earlyclobbers[i] == x)
- return 1;
-
- return 0;
-}
-
-/* Return 1 if expression X alters a hard reg in the range
- from BEG_REGNO (inclusive) to END_REGNO (exclusive),
- either explicitly or in the guise of a pseudo-reg allocated to REGNO.
- X should be the body of an instruction. */
-
-static int
-hard_reg_set_here_p (beg_regno, end_regno, x)
- register int beg_regno, end_regno;
- rtx x;
-{
- if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER)
- {
- register rtx op0 = SET_DEST (x);
- while (GET_CODE (op0) == SUBREG)
- op0 = SUBREG_REG (op0);
- if (GET_CODE (op0) == REG)
- {
- register int r = REGNO (op0);
- /* See if this reg overlaps range under consideration. */
- if (r < end_regno
- && r + HARD_REGNO_NREGS (r, GET_MODE (op0)) > beg_regno)
- return 1;
- }
- }
- else if (GET_CODE (x) == PARALLEL)
- {
- register int i = XVECLEN (x, 0) - 1;
- for (; i >= 0; i--)
- if (hard_reg_set_here_p (beg_regno, end_regno, XVECEXP (x, 0, i)))
- return 1;
- }
-
- return 0;
-}
-
-/* Return 1 if ADDR is a valid memory address for mode MODE,
- and check that each pseudo reg has the proper kind of
- hard reg. */
-
-int
-strict_memory_address_p (mode, addr)
- enum machine_mode mode;
- register rtx addr;
-{
- GO_IF_LEGITIMATE_ADDRESS (mode, addr, win);
- return 0;
-
- win:
- return 1;
-}
-
-/* Like rtx_equal_p except that it allows a REG and a SUBREG to match
- if they are the same hard reg, and has special hacks for
- autoincrement and autodecrement.
- This is specifically intended for find_reloads to use
- in determining whether two operands match.
- X is the operand whose number is the lower of the two.
-
- The value is 2 if Y contains a pre-increment that matches
- a non-incrementing address in X. */
-
-/* ??? To be completely correct, we should arrange to pass
- for X the output operand and for Y the input operand.
- For now, we assume that the output operand has the lower number
- because that is natural in (SET output (... input ...)). */
-
-int
-operands_match_p (x, y)
- register rtx x, y;
-{
- register int i;
- register RTX_CODE code = GET_CODE (x);
- register char *fmt;
- int success_2;
-
- if (x == y)
- return 1;
- if ((code == REG || (code == SUBREG && GET_CODE (SUBREG_REG (x)) == REG))
- && (GET_CODE (y) == REG || (GET_CODE (y) == SUBREG
- && GET_CODE (SUBREG_REG (y)) == REG)))
- {
- register int j;
-
- if (code == SUBREG)
- {
- i = REGNO (SUBREG_REG (x));
- if (i >= FIRST_PSEUDO_REGISTER)
- goto slow;
- i += SUBREG_WORD (x);
- }
- else
- i = REGNO (x);
-
- if (GET_CODE (y) == SUBREG)
- {
- j = REGNO (SUBREG_REG (y));
- if (j >= FIRST_PSEUDO_REGISTER)
- goto slow;
- j += SUBREG_WORD (y);
- }
- else
- j = REGNO (y);
-
- /* On a WORDS_BIG_ENDIAN machine, point to the last register of a
- multiple hard register group, so that for example (reg:DI 0) and
- (reg:SI 1) will be considered the same register. */
- if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD
- && i < FIRST_PSEUDO_REGISTER)
- i += (GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD) - 1;
- if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (y)) > UNITS_PER_WORD
- && j < FIRST_PSEUDO_REGISTER)
- j += (GET_MODE_SIZE (GET_MODE (y)) / UNITS_PER_WORD) - 1;
-
- return i == j;
- }
- /* If two operands must match, because they are really a single
- operand of an assembler insn, then two postincrements are invalid
- because the assembler insn would increment only once.
- On the other hand, an postincrement matches ordinary indexing
- if the postincrement is the output operand. */
- if (code == POST_DEC || code == POST_INC)
- return operands_match_p (XEXP (x, 0), y);
- /* Two preincrements are invalid
- because the assembler insn would increment only once.
- On the other hand, an preincrement matches ordinary indexing
- if the preincrement is the input operand.
- In this case, return 2, since some callers need to do special
- things when this happens. */
- if (GET_CODE (y) == PRE_DEC || GET_CODE (y) == PRE_INC)
- return operands_match_p (x, XEXP (y, 0)) ? 2 : 0;
-
- slow:
-
- /* Now we have disposed of all the cases
- in which different rtx codes can match. */
- if (code != GET_CODE (y))
- return 0;
- if (code == LABEL_REF)
- return XEXP (x, 0) == XEXP (y, 0);
- if (code == SYMBOL_REF)
- return XSTR (x, 0) == XSTR (y, 0);
-
- /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent. */
-
- if (GET_MODE (x) != GET_MODE (y))
- return 0;
-
- /* Compare the elements. If any pair of corresponding elements
- fail to match, return 0 for the whole things. */
-
- success_2 = 0;
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- int val;
- switch (fmt[i])
- {
- case 'w':
- if (XWINT (x, i) != XWINT (y, i))
- return 0;
- break;
-
- case 'i':
- if (XINT (x, i) != XINT (y, i))
- return 0;
- break;
-
- case 'e':
- val = operands_match_p (XEXP (x, i), XEXP (y, i));
- if (val == 0)
- return 0;
- /* If any subexpression returns 2,
- we should return 2 if we are successful. */
- if (val == 2)
- success_2 = 1;
- break;
-
- case '0':
- break;
-
- /* It is believed that rtx's at this level will never
- contain anything but integers and other rtx's,
- except for within LABEL_REFs and SYMBOL_REFs. */
- default:
- abort ();
- }
- }
- return 1 + success_2;
-}
-
-/* Return the number of times character C occurs in string S. */
-
-int
-n_occurrences (c, s)
- int c;
- char *s;
-{
- int n = 0;
- while (*s)
- n += (*s++ == c);
- return n;
-}
-
-/* Describe the range of registers or memory referenced by X.
- If X is a register, set REG_FLAG and put the first register
- number into START and the last plus one into END.
- If X is a memory reference, put a base address into BASE
- and a range of integer offsets into START and END.
- If X is pushing on the stack, we can assume it causes no trouble,
- so we set the SAFE field. */
-
-static struct decomposition
-decompose (x)
- rtx x;
-{
- struct decomposition val;
- int all_const = 0;
-
- val.reg_flag = 0;
- val.safe = 0;
- if (GET_CODE (x) == MEM)
- {
- rtx base, offset = 0;
- rtx addr = XEXP (x, 0);
-
- if (GET_CODE (addr) == PRE_DEC || GET_CODE (addr) == PRE_INC
- || GET_CODE (addr) == POST_DEC || GET_CODE (addr) == POST_INC)
- {
- val.base = XEXP (addr, 0);
- val.start = - GET_MODE_SIZE (GET_MODE (x));
- val.end = GET_MODE_SIZE (GET_MODE (x));
- val.safe = REGNO (val.base) == STACK_POINTER_REGNUM;
- return val;
- }
-
- if (GET_CODE (addr) == CONST)
- {
- addr = XEXP (addr, 0);
- all_const = 1;
- }
- if (GET_CODE (addr) == PLUS)
- {
- if (CONSTANT_P (XEXP (addr, 0)))
- {
- base = XEXP (addr, 1);
- offset = XEXP (addr, 0);
- }
- else if (CONSTANT_P (XEXP (addr, 1)))
- {
- base = XEXP (addr, 0);
- offset = XEXP (addr, 1);
- }
- }
-
- if (offset == 0)
- {
- base = addr;
- offset = const0_rtx;
- }
- if (GET_CODE (offset) == CONST)
- offset = XEXP (offset, 0);
- if (GET_CODE (offset) == PLUS)
- {
- if (GET_CODE (XEXP (offset, 0)) == CONST_INT)
- {
- base = gen_rtx (PLUS, GET_MODE (base), base, XEXP (offset, 1));
- offset = XEXP (offset, 0);
- }
- else if (GET_CODE (XEXP (offset, 1)) == CONST_INT)
- {
- base = gen_rtx (PLUS, GET_MODE (base), base, XEXP (offset, 0));
- offset = XEXP (offset, 1);
- }
- else
- {
- base = gen_rtx (PLUS, GET_MODE (base), base, offset);
- offset = const0_rtx;
- }
- }
- else if (GET_CODE (offset) != CONST_INT)
- {
- base = gen_rtx (PLUS, GET_MODE (base), base, offset);
- offset = const0_rtx;
- }
-
- if (all_const && GET_CODE (base) == PLUS)
- base = gen_rtx (CONST, GET_MODE (base), base);
-
- if (GET_CODE (offset) != CONST_INT)
- abort ();
-
- val.start = INTVAL (offset);
- val.end = val.start + GET_MODE_SIZE (GET_MODE (x));
- val.base = base;
- return val;
- }
- else if (GET_CODE (x) == REG)
- {
- val.reg_flag = 1;
- val.start = true_regnum (x);
- if (val.start < 0)
- {
- /* A pseudo with no hard reg. */
- val.start = REGNO (x);
- val.end = val.start + 1;
- }
- else
- /* A hard reg. */
- val.end = val.start + HARD_REGNO_NREGS (val.start, GET_MODE (x));
- }
- else if (GET_CODE (x) == SUBREG)
- {
- if (GET_CODE (SUBREG_REG (x)) != REG)
- /* This could be more precise, but it's good enough. */
- return decompose (SUBREG_REG (x));
- val.reg_flag = 1;
- val.start = true_regnum (x);
- if (val.start < 0)
- return decompose (SUBREG_REG (x));
- else
- /* A hard reg. */
- val.end = val.start + HARD_REGNO_NREGS (val.start, GET_MODE (x));
- }
- else if (CONSTANT_P (x)
- /* This hasn't been assigned yet, so it can't conflict yet. */
- || GET_CODE (x) == SCRATCH)
- val.safe = 1;
- else
- abort ();
- return val;
-}
-
-/* Return 1 if altering Y will not modify the value of X.
- Y is also described by YDATA, which should be decompose (Y). */
-
-static int
-immune_p (x, y, ydata)
- rtx x, y;
- struct decomposition ydata;
-{
- struct decomposition xdata;
-
- if (ydata.reg_flag)
- return !refers_to_regno_for_reload_p (ydata.start, ydata.end, x, NULL_PTR);
- if (ydata.safe)
- return 1;
-
- if (GET_CODE (y) != MEM)
- abort ();
- /* If Y is memory and X is not, Y can't affect X. */
- if (GET_CODE (x) != MEM)
- return 1;
-
- xdata = decompose (x);
-
- if (! rtx_equal_p (xdata.base, ydata.base))
- {
- /* If bases are distinct symbolic constants, there is no overlap. */
- if (CONSTANT_P (xdata.base) && CONSTANT_P (ydata.base))
- return 1;
- /* Constants and stack slots never overlap. */
- if (CONSTANT_P (xdata.base)
- && (ydata.base == frame_pointer_rtx
- || ydata.base == hard_frame_pointer_rtx
- || ydata.base == stack_pointer_rtx))
- return 1;
- if (CONSTANT_P (ydata.base)
- && (xdata.base == frame_pointer_rtx
- || xdata.base == hard_frame_pointer_rtx
- || xdata.base == stack_pointer_rtx))
- return 1;
- /* If either base is variable, we don't know anything. */
- return 0;
- }
-
-
- return (xdata.start >= ydata.end || ydata.start >= xdata.end);
-}
-
-/* Similar, but calls decompose. */
-
-int
-safe_from_earlyclobber (op, clobber)
- rtx op, clobber;
-{
- struct decomposition early_data;
-
- early_data = decompose (clobber);
- return immune_p (op, clobber, early_data);
-}
-
-/* Main entry point of this file: search the body of INSN
- for values that need reloading and record them with push_reload.
- REPLACE nonzero means record also where the values occur
- so that subst_reloads can be used.
-
- IND_LEVELS says how many levels of indirection are supported by this
- machine; a value of zero means that a memory reference is not a valid
- memory address.
-
- LIVE_KNOWN says we have valid information about which hard
- regs are live at each point in the program; this is true when
- we are called from global_alloc but false when stupid register
- allocation has been done.
-
- RELOAD_REG_P if nonzero is a vector indexed by hard reg number
- which is nonnegative if the reg has been commandeered for reloading into.
- It is copied into STATIC_RELOAD_REG_P and referenced from there
- by various subroutines. */
-
-void
-find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
- rtx insn;
- int replace, ind_levels;
- int live_known;
- short *reload_reg_p;
-{
-#ifdef REGISTER_CONSTRAINTS
-
- register int insn_code_number;
- register int i, j;
- int noperands;
- /* These are the constraints for the insn. We don't change them. */
- char *constraints1[MAX_RECOG_OPERANDS];
- /* These start out as the constraints for the insn
- and they are chewed up as we consider alternatives. */
- char *constraints[MAX_RECOG_OPERANDS];
- /* These are the preferred classes for an operand, or NO_REGS if it isn't
- a register. */
- enum reg_class preferred_class[MAX_RECOG_OPERANDS];
- char pref_or_nothing[MAX_RECOG_OPERANDS];
- /* Nonzero for a MEM operand whose entire address needs a reload. */
- int address_reloaded[MAX_RECOG_OPERANDS];
- /* Value of enum reload_type to use for operand. */
- enum reload_type operand_type[MAX_RECOG_OPERANDS];
- /* Value of enum reload_type to use within address of operand. */
- enum reload_type address_type[MAX_RECOG_OPERANDS];
- /* Save the usage of each operand. */
- enum reload_usage { RELOAD_READ, RELOAD_READ_WRITE, RELOAD_WRITE } modified[MAX_RECOG_OPERANDS];
- int no_input_reloads = 0, no_output_reloads = 0;
- int n_alternatives;
- int this_alternative[MAX_RECOG_OPERANDS];
- char this_alternative_win[MAX_RECOG_OPERANDS];
- char this_alternative_offmemok[MAX_RECOG_OPERANDS];
- char this_alternative_earlyclobber[MAX_RECOG_OPERANDS];
- int this_alternative_matches[MAX_RECOG_OPERANDS];
- int swapped;
- int goal_alternative[MAX_RECOG_OPERANDS];
- int this_alternative_number;
- int goal_alternative_number;
- int operand_reloadnum[MAX_RECOG_OPERANDS];
- int goal_alternative_matches[MAX_RECOG_OPERANDS];
- int goal_alternative_matched[MAX_RECOG_OPERANDS];
- char goal_alternative_win[MAX_RECOG_OPERANDS];
- char goal_alternative_offmemok[MAX_RECOG_OPERANDS];
- char goal_alternative_earlyclobber[MAX_RECOG_OPERANDS];
- int goal_alternative_swapped;
- int best;
- int commutative;
- char operands_match[MAX_RECOG_OPERANDS][MAX_RECOG_OPERANDS];
- rtx substed_operand[MAX_RECOG_OPERANDS];
- rtx body = PATTERN (insn);
- rtx set = single_set (insn);
- int goal_earlyclobber, this_earlyclobber;
- enum machine_mode operand_mode[MAX_RECOG_OPERANDS];
-
- this_insn = insn;
- this_insn_is_asm = 0; /* Tentative. */
- n_reloads = 0;
- n_replacements = 0;
- n_memlocs = 0;
- n_earlyclobbers = 0;
- replace_reloads = replace;
- hard_regs_live_known = live_known;
- static_reload_reg_p = reload_reg_p;
-
- /* JUMP_INSNs and CALL_INSNs are not allowed to have any output reloads;
- neither are insns that SET cc0. Insns that use CC0 are not allowed
- to have any input reloads. */
- if (GET_CODE (insn) == JUMP_INSN || GET_CODE (insn) == CALL_INSN)
- no_output_reloads = 1;
-
-#ifdef HAVE_cc0
- if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
- no_input_reloads = 1;
- if (reg_set_p (cc0_rtx, PATTERN (insn)))
- no_output_reloads = 1;
-#endif
-
-#ifdef SECONDARY_MEMORY_NEEDED
- /* The eliminated forms of any secondary memory locations are per-insn, so
- clear them out here. */
-
- bzero ((char *) secondary_memlocs_elim, sizeof secondary_memlocs_elim);
-#endif
-
- /* Find what kind of insn this is. NOPERANDS gets number of operands.
- Make OPERANDS point to a vector of operand values.
- Make OPERAND_LOCS point to a vector of pointers to
- where the operands were found.
- Fill CONSTRAINTS and CONSTRAINTS1 with pointers to the
- constraint-strings for this insn.
- Return if the insn needs no reload processing. */
-
- switch (GET_CODE (body))
- {
- case USE:
- case CLOBBER:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- return;
-
- case SET:
- /* Dispose quickly of (set (reg..) (reg..)) if both have hard regs and it
- is cheap to move between them. If it is not, there may not be an insn
- to do the copy, so we may need a reload. */
- if (GET_CODE (SET_DEST (body)) == REG
- && REGNO (SET_DEST (body)) < FIRST_PSEUDO_REGISTER
- && GET_CODE (SET_SRC (body)) == REG
- && REGNO (SET_SRC (body)) < FIRST_PSEUDO_REGISTER
- && REGISTER_MOVE_COST (REGNO_REG_CLASS (REGNO (SET_SRC (body))),
- REGNO_REG_CLASS (REGNO (SET_DEST (body)))) == 2)
- return;
- case PARALLEL:
- case ASM_OPERANDS:
- reload_n_operands = noperands = asm_noperands (body);
- if (noperands >= 0)
- {
- /* This insn is an `asm' with operands. */
-
- insn_code_number = -1;
- this_insn_is_asm = 1;
-
- /* expand_asm_operands makes sure there aren't too many operands. */
- if (noperands > MAX_RECOG_OPERANDS)
- abort ();
-
- /* Now get the operand values and constraints out of the insn. */
-
- decode_asm_operands (body, recog_operand, recog_operand_loc,
- constraints, operand_mode);
- if (noperands > 0)
- {
- bcopy ((char *) constraints, (char *) constraints1,
- noperands * sizeof (char *));
- n_alternatives = n_occurrences (',', constraints[0]) + 1;
- for (i = 1; i < noperands; i++)
- if (n_alternatives != n_occurrences (',', constraints[i]) + 1)
- {
- error_for_asm (insn, "operand constraints differ in number of alternatives");
- /* Avoid further trouble with this insn. */
- PATTERN (insn) = gen_rtx (USE, VOIDmode, const0_rtx);
- n_reloads = 0;
- return;
- }
- }
- break;
- }
-
- default:
- /* Ordinary insn: recognize it, get the operands via insn_extract
- and get the constraints. */
-
- insn_code_number = recog_memoized (insn);
- if (insn_code_number < 0)
- fatal_insn_not_found (insn);
-
- reload_n_operands = noperands = insn_n_operands[insn_code_number];
- n_alternatives = insn_n_alternatives[insn_code_number];
- /* Just return "no reloads" if insn has no operands with constraints. */
- if (n_alternatives == 0)
- return;
- insn_extract (insn);
- for (i = 0; i < noperands; i++)
- {
- constraints[i] = constraints1[i]
- = insn_operand_constraint[insn_code_number][i];
- operand_mode[i] = insn_operand_mode[insn_code_number][i];
- }
- }
-
- if (noperands == 0)
- return;
-
- commutative = -1;
-
- /* If we will need to know, later, whether some pair of operands
- are the same, we must compare them now and save the result.
- Reloading the base and index registers will clobber them
- and afterward they will fail to match. */
-
- for (i = 0; i < noperands; i++)
- {
- register char *p;
- register int c;
-
- substed_operand[i] = recog_operand[i];
- p = constraints[i];
-
- modified[i] = RELOAD_READ;
-
- /* Scan this operand's constraint to see if it is an output operand,
- an in-out operand, is commutative, or should match another. */
-
- while (c = *p++)
- {
- if (c == '=')
- modified[i] = RELOAD_WRITE;
- else if (c == '+')
- modified[i] = RELOAD_READ_WRITE;
- else if (c == '%')
- {
- /* The last operand should not be marked commutative. */
- if (i == noperands - 1)
- {
- if (this_insn_is_asm)
- warning_for_asm (this_insn,
- "`%%' constraint used with last operand");
- else
- abort ();
- }
- else
- commutative = i;
- }
- else if (c >= '0' && c <= '9')
- {
- c -= '0';
- operands_match[c][i]
- = operands_match_p (recog_operand[c], recog_operand[i]);
-
- /* An operand may not match itself. */
- if (c == i)
- {
- if (this_insn_is_asm)
- warning_for_asm (this_insn,
- "operand %d has constraint %d", i, c);
- else
- abort ();
- }
-
- /* If C can be commuted with C+1, and C might need to match I,
- then C+1 might also need to match I. */
- if (commutative >= 0)
- {
- if (c == commutative || c == commutative + 1)
- {
- int other = c + (c == commutative ? 1 : -1);
- operands_match[other][i]
- = operands_match_p (recog_operand[other], recog_operand[i]);
- }
- if (i == commutative || i == commutative + 1)
- {
- int other = i + (i == commutative ? 1 : -1);
- operands_match[c][other]
- = operands_match_p (recog_operand[c], recog_operand[other]);
- }
- /* Note that C is supposed to be less than I.
- No need to consider altering both C and I because in
- that case we would alter one into the other. */
- }
- }
- }
- }
-
- /* Examine each operand that is a memory reference or memory address
- and reload parts of the addresses into index registers.
- Also here any references to pseudo regs that didn't get hard regs
- but are equivalent to constants get replaced in the insn itself
- with those constants. Nobody will ever see them again.
-
- Finally, set up the preferred classes of each operand. */
-
- for (i = 0; i < noperands; i++)
- {
- register RTX_CODE code = GET_CODE (recog_operand[i]);
-
- address_reloaded[i] = 0;
- operand_type[i] = (modified[i] == RELOAD_READ ? RELOAD_FOR_INPUT
- : modified[i] == RELOAD_WRITE ? RELOAD_FOR_OUTPUT
- : RELOAD_OTHER);
- address_type[i]
- = (modified[i] == RELOAD_READ ? RELOAD_FOR_INPUT_ADDRESS
- : modified[i] == RELOAD_WRITE ? RELOAD_FOR_OUTPUT_ADDRESS
- : RELOAD_OTHER);
-
- if (*constraints[i] == 0)
- /* Ignore things like match_operator operands. */
- ;
- else if (constraints[i][0] == 'p')
- {
- find_reloads_address (VOIDmode, NULL_PTR,
- recog_operand[i], recog_operand_loc[i],
- i, operand_type[i], ind_levels, insn);
-
- /* If we now have a simple operand where we used to have a
- PLUS or MULT, re-recognize and try again. */
- if ((GET_RTX_CLASS (GET_CODE (*recog_operand_loc[i])) == 'o'
- || GET_CODE (*recog_operand_loc[i]) == SUBREG)
- && (GET_CODE (recog_operand[i]) == MULT
- || GET_CODE (recog_operand[i]) == PLUS))
- {
- INSN_CODE (insn) = -1;
- find_reloads (insn, replace, ind_levels, live_known,
- reload_reg_p);
- return;
- }
-
- substed_operand[i] = recog_operand[i] = *recog_operand_loc[i];
- }
- else if (code == MEM)
- {
- if (find_reloads_address (GET_MODE (recog_operand[i]),
- recog_operand_loc[i],
- XEXP (recog_operand[i], 0),
- &XEXP (recog_operand[i], 0),
- i, address_type[i], ind_levels, insn))
- address_reloaded[i] = 1;
- substed_operand[i] = recog_operand[i] = *recog_operand_loc[i];
- }
- else if (code == SUBREG)
- substed_operand[i] = recog_operand[i] = *recog_operand_loc[i]
- = find_reloads_toplev (recog_operand[i], i, address_type[i],
- ind_levels,
- set != 0
- && &SET_DEST (set) == recog_operand_loc[i]);
- else if (code == PLUS || GET_RTX_CLASS (code) == '1')
- /* We can get a PLUS as an "operand" as a result of register
- elimination. See eliminate_regs and gen_reload. We handle
- a unary operator by reloading the operand. */
- substed_operand[i] = recog_operand[i] = *recog_operand_loc[i]
- = find_reloads_toplev (recog_operand[i], i, address_type[i],
- ind_levels, 0);
- else if (code == REG)
- {
- /* This is equivalent to calling find_reloads_toplev.
- The code is duplicated for speed.
- When we find a pseudo always equivalent to a constant,
- we replace it by the constant. We must be sure, however,
- that we don't try to replace it in the insn in which it
- is being set. */
- register int regno = REGNO (recog_operand[i]);
- if (reg_equiv_constant[regno] != 0
- && (set == 0 || &SET_DEST (set) != recog_operand_loc[i]))
- substed_operand[i] = recog_operand[i]
- = reg_equiv_constant[regno];
-#if 0 /* This might screw code in reload1.c to delete prior output-reload
- that feeds this insn. */
- if (reg_equiv_mem[regno] != 0)
- substed_operand[i] = recog_operand[i]
- = reg_equiv_mem[regno];
-#endif
- if (reg_equiv_address[regno] != 0)
- {
- /* If reg_equiv_address is not a constant address, copy it,
- since it may be shared. */
- /* We must rerun eliminate_regs, in case the elimination
- offsets have changed. */
- rtx address = XEXP (eliminate_regs (reg_equiv_memory_loc[regno],
- 0, NULL_RTX, 0),
- 0);
-
- if (rtx_varies_p (address))
- address = copy_rtx (address);
-
- /* If this is an output operand, we must output a CLOBBER
- after INSN so find_equiv_reg knows REGNO is being written.
- Mark this insn specially, do we can put our output reloads
- after it. */
-
- if (modified[i] != RELOAD_READ)
- PUT_MODE (emit_insn_after (gen_rtx (CLOBBER, VOIDmode,
- recog_operand[i]),
- insn),
- DImode);
-
- *recog_operand_loc[i] = recog_operand[i]
- = gen_rtx (MEM, GET_MODE (recog_operand[i]), address);
- RTX_UNCHANGING_P (recog_operand[i])
- = RTX_UNCHANGING_P (regno_reg_rtx[regno]);
- find_reloads_address (GET_MODE (recog_operand[i]),
- recog_operand_loc[i],
- XEXP (recog_operand[i], 0),
- &XEXP (recog_operand[i], 0),
- i, address_type[i], ind_levels, insn);
- substed_operand[i] = recog_operand[i] = *recog_operand_loc[i];
- }
- }
- /* If the operand is still a register (we didn't replace it with an
- equivalent), get the preferred class to reload it into. */
- code = GET_CODE (recog_operand[i]);
- preferred_class[i]
- = ((code == REG && REGNO (recog_operand[i]) >= FIRST_PSEUDO_REGISTER)
- ? reg_preferred_class (REGNO (recog_operand[i])) : NO_REGS);
- pref_or_nothing[i]
- = (code == REG && REGNO (recog_operand[i]) >= FIRST_PSEUDO_REGISTER
- && reg_alternate_class (REGNO (recog_operand[i])) == NO_REGS);
- }
-
- /* If this is simply a copy from operand 1 to operand 0, merge the
- preferred classes for the operands. */
- if (set != 0 && noperands >= 2 && recog_operand[0] == SET_DEST (set)
- && recog_operand[1] == SET_SRC (set))
- {
- preferred_class[0] = preferred_class[1]
- = reg_class_subunion[(int) preferred_class[0]][(int) preferred_class[1]];
- pref_or_nothing[0] |= pref_or_nothing[1];
- pref_or_nothing[1] |= pref_or_nothing[0];
- }
-
- /* Now see what we need for pseudo-regs that didn't get hard regs
- or got the wrong kind of hard reg. For this, we must consider
- all the operands together against the register constraints. */
-
- best = MAX_RECOG_OPERANDS + 300;
-
- swapped = 0;
- goal_alternative_swapped = 0;
- try_swapped:
-
- /* The constraints are made of several alternatives.
- Each operand's constraint looks like foo,bar,... with commas
- separating the alternatives. The first alternatives for all
- operands go together, the second alternatives go together, etc.
-
- First loop over alternatives. */
-
- for (this_alternative_number = 0;
- this_alternative_number < n_alternatives;
- this_alternative_number++)
- {
- /* Loop over operands for one constraint alternative. */
- /* LOSERS counts those that don't fit this alternative
- and would require loading. */
- int losers = 0;
- /* BAD is set to 1 if it some operand can't fit this alternative
- even after reloading. */
- int bad = 0;
- /* REJECT is a count of how undesirable this alternative says it is
- if any reloading is required. If the alternative matches exactly
- then REJECT is ignored, but otherwise it gets this much
- counted against it in addition to the reloading needed. Each
- ? counts three times here since we want the disparaging caused by
- a bad register class to only count 1/3 as much. */
- int reject = 0;
-
- this_earlyclobber = 0;
-
- for (i = 0; i < noperands; i++)
- {
- register char *p = constraints[i];
- register int win = 0;
- /* 0 => this operand can be reloaded somehow for this alternative */
- int badop = 1;
- /* 0 => this operand can be reloaded if the alternative allows regs. */
- int winreg = 0;
- int c;
- register rtx operand = recog_operand[i];
- int offset = 0;
- /* Nonzero means this is a MEM that must be reloaded into a reg
- regardless of what the constraint says. */
- int force_reload = 0;
- int offmemok = 0;
- /* Nonzero if a constant forced into memory would be OK for this
- operand. */
- int constmemok = 0;
- int earlyclobber = 0;
-
- /* If the predicate accepts a unary operator, it means that
- we need to reload the operand. */
- if (GET_RTX_CLASS (GET_CODE (operand)) == '1')
- operand = XEXP (operand, 0);
-
- /* If the operand is a SUBREG, extract
- the REG or MEM (or maybe even a constant) within.
- (Constants can occur as a result of reg_equiv_constant.) */
-
- while (GET_CODE (operand) == SUBREG)
- {
- offset += SUBREG_WORD (operand);
- operand = SUBREG_REG (operand);
- /* Force reload if this is a constant or PLUS or if there may may
- be a problem accessing OPERAND in the outer mode. */
- if (CONSTANT_P (operand)
- || GET_CODE (operand) == PLUS
- /* We must force a reload of paradoxical SUBREGs
- of a MEM because the alignment of the inner value
- may not be enough to do the outer reference. On
- big-endian machines, it may also reference outside
- the object.
-
- On machines that extend byte operations and we have a
- SUBREG where both the inner and outer modes are no wider
- than a word and the inner mode is narrower, is integral,
- and gets extended when loaded from memory, combine.c has
- made assumptions about the behavior of the machine in such
- register access. If the data is, in fact, in memory we
- must always load using the size assumed to be in the
- register and let the insn do the different-sized
- accesses. */
- || ((GET_CODE (operand) == MEM
- || (GET_CODE (operand)== REG
- && REGNO (operand) >= FIRST_PSEUDO_REGISTER))
- && (((GET_MODE_BITSIZE (GET_MODE (operand))
- < BIGGEST_ALIGNMENT)
- && (GET_MODE_SIZE (operand_mode[i])
- > GET_MODE_SIZE (GET_MODE (operand))))
- || (GET_CODE (operand) == MEM && BYTES_BIG_ENDIAN)
-#ifdef LOAD_EXTEND_OP
- || (GET_MODE_SIZE (operand_mode[i]) <= UNITS_PER_WORD
- && (GET_MODE_SIZE (GET_MODE (operand))
- <= UNITS_PER_WORD)
- && (GET_MODE_SIZE (operand_mode[i])
- > GET_MODE_SIZE (GET_MODE (operand)))
- && INTEGRAL_MODE_P (GET_MODE (operand))
- && LOAD_EXTEND_OP (GET_MODE (operand)) != NIL)
-#endif
- ))
- /* Subreg of a hard reg which can't handle the subreg's mode
- or which would handle that mode in the wrong number of
- registers for subregging to work. */
- || (GET_CODE (operand) == REG
- && REGNO (operand) < FIRST_PSEUDO_REGISTER
- && ((GET_MODE_SIZE (operand_mode[i]) <= UNITS_PER_WORD
- && (GET_MODE_SIZE (GET_MODE (operand))
- > UNITS_PER_WORD)
- && ((GET_MODE_SIZE (GET_MODE (operand))
- / UNITS_PER_WORD)
- != HARD_REGNO_NREGS (REGNO (operand),
- GET_MODE (operand))))
- || ! HARD_REGNO_MODE_OK (REGNO (operand) + offset,
- operand_mode[i]))))
- force_reload = 1;
- }
-
- this_alternative[i] = (int) NO_REGS;
- this_alternative_win[i] = 0;
- this_alternative_offmemok[i] = 0;
- this_alternative_earlyclobber[i] = 0;
- this_alternative_matches[i] = -1;
-
- /* An empty constraint or empty alternative
- allows anything which matched the pattern. */
- if (*p == 0 || *p == ',')
- win = 1, badop = 0;
-
- /* Scan this alternative's specs for this operand;
- set WIN if the operand fits any letter in this alternative.
- Otherwise, clear BADOP if this operand could
- fit some letter after reloads,
- or set WINREG if this operand could fit after reloads
- provided the constraint allows some registers. */
-
- while (*p && (c = *p++) != ',')
- switch (c)
- {
- case '=':
- case '+':
- case '*':
- break;
-
- case '%':
- /* The last operand should not be marked commutative. */
- if (i != noperands - 1)
- commutative = i;
- break;
-
- case '?':
- reject += 3;
- break;
-
- case '!':
- reject = 300;
- break;
-
- case '#':
- /* Ignore rest of this alternative as far as
- reloading is concerned. */
- while (*p && *p != ',') p++;
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- c -= '0';
- this_alternative_matches[i] = c;
- /* We are supposed to match a previous operand.
- If we do, we win if that one did.
- If we do not, count both of the operands as losers.
- (This is too conservative, since most of the time
- only a single reload insn will be needed to make
- the two operands win. As a result, this alternative
- may be rejected when it is actually desirable.) */
- if ((swapped && (c != commutative || i != commutative + 1))
- /* If we are matching as if two operands were swapped,
- also pretend that operands_match had been computed
- with swapped.
- But if I is the second of those and C is the first,
- don't exchange them, because operands_match is valid
- only on one side of its diagonal. */
- ? (operands_match
- [(c == commutative || c == commutative + 1)
- ? 2*commutative + 1 - c : c]
- [(i == commutative || i == commutative + 1)
- ? 2*commutative + 1 - i : i])
- : operands_match[c][i])
- win = this_alternative_win[c];
- else
- {
- /* Operands don't match. */
- rtx value;
- /* Retroactively mark the operand we had to match
- as a loser, if it wasn't already. */
- if (this_alternative_win[c])
- losers++;
- this_alternative_win[c] = 0;
- if (this_alternative[c] == (int) NO_REGS)
- bad = 1;
- /* But count the pair only once in the total badness of
- this alternative, if the pair can be a dummy reload. */
- value
- = find_dummy_reload (recog_operand[i], recog_operand[c],
- recog_operand_loc[i], recog_operand_loc[c],
- operand_mode[i], operand_mode[c],
- this_alternative[c], -1,
- this_alternative_earlyclobber[c]);
-
- if (value != 0)
- losers--;
- }
- /* This can be fixed with reloads if the operand
- we are supposed to match can be fixed with reloads. */
- badop = 0;
- this_alternative[i] = this_alternative[c];
-
- /* If we have to reload this operand and some previous
- operand also had to match the same thing as this
- operand, we don't know how to do that. So reject this
- alternative. */
- if (! win || force_reload)
- for (j = 0; j < i; j++)
- if (this_alternative_matches[j]
- == this_alternative_matches[i])
- badop = 1;
-
- break;
-
- case 'p':
- /* All necessary reloads for an address_operand
- were handled in find_reloads_address. */
- this_alternative[i] = (int) BASE_REG_CLASS;
- win = 1;
- break;
-
- case 'm':
- if (force_reload)
- break;
- if (GET_CODE (operand) == MEM
- || (GET_CODE (operand) == REG
- && REGNO (operand) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[REGNO (operand)] < 0))
- win = 1;
- if (CONSTANT_P (operand))
- badop = 0;
- constmemok = 1;
- break;
-
- case '<':
- if (GET_CODE (operand) == MEM
- && ! address_reloaded[i]
- && (GET_CODE (XEXP (operand, 0)) == PRE_DEC
- || GET_CODE (XEXP (operand, 0)) == POST_DEC))
- win = 1;
- break;
-
- case '>':
- if (GET_CODE (operand) == MEM
- && ! address_reloaded[i]
- && (GET_CODE (XEXP (operand, 0)) == PRE_INC
- || GET_CODE (XEXP (operand, 0)) == POST_INC))
- win = 1;
- break;
-
- /* Memory operand whose address is not offsettable. */
- case 'V':
- if (force_reload)
- break;
- if (GET_CODE (operand) == MEM
- && ! (ind_levels ? offsettable_memref_p (operand)
- : offsettable_nonstrict_memref_p (operand))
- /* Certain mem addresses will become offsettable
- after they themselves are reloaded. This is important;
- we don't want our own handling of unoffsettables
- to override the handling of reg_equiv_address. */
- && !(GET_CODE (XEXP (operand, 0)) == REG
- && (ind_levels == 0
- || reg_equiv_address[REGNO (XEXP (operand, 0))] != 0)))
- win = 1;
- break;
-
- /* Memory operand whose address is offsettable. */
- case 'o':
- if (force_reload)
- break;
- if ((GET_CODE (operand) == MEM
- /* If IND_LEVELS, find_reloads_address won't reload a
- pseudo that didn't get a hard reg, so we have to
- reject that case. */
- && (ind_levels ? offsettable_memref_p (operand)
- : offsettable_nonstrict_memref_p (operand)))
- /* A reloaded auto-increment address is offsettable,
- because it is now just a simple register indirect. */
- || (GET_CODE (operand) == MEM
- && address_reloaded[i]
- && (GET_CODE (XEXP (operand, 0)) == PRE_INC
- || GET_CODE (XEXP (operand, 0)) == PRE_DEC
- || GET_CODE (XEXP (operand, 0)) == POST_INC
- || GET_CODE (XEXP (operand, 0)) == POST_DEC))
- /* Certain mem addresses will become offsettable
- after they themselves are reloaded. This is important;
- we don't want our own handling of unoffsettables
- to override the handling of reg_equiv_address. */
- || (GET_CODE (operand) == MEM
- && GET_CODE (XEXP (operand, 0)) == REG
- && (ind_levels == 0
- || reg_equiv_address[REGNO (XEXP (operand, 0))] != 0))
- || (GET_CODE (operand) == REG
- && REGNO (operand) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[REGNO (operand)] < 0
- /* If reg_equiv_address is nonzero, we will be
- loading it into a register; hence it will be
- offsettable, but we cannot say that reg_equiv_mem
- is offsettable without checking. */
- && ((reg_equiv_mem[REGNO (operand)] != 0
- && offsettable_memref_p (reg_equiv_mem[REGNO (operand)]))
- || (reg_equiv_address[REGNO (operand)] != 0))))
- win = 1;
- if (CONSTANT_P (operand) || GET_CODE (operand) == MEM)
- badop = 0;
- constmemok = 1;
- offmemok = 1;
- break;
-
- case '&':
- /* Output operand that is stored before the need for the
- input operands (and their index registers) is over. */
- earlyclobber = 1, this_earlyclobber = 1;
- break;
-
- case 'E':
-#ifndef REAL_ARITHMETIC
- /* Match any floating double constant, but only if
- we can examine the bits of it reliably. */
- if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
- || HOST_BITS_PER_WIDE_INT != BITS_PER_WORD)
- && GET_MODE (operand) != VOIDmode && ! flag_pretend_float)
- break;
-#endif
- if (GET_CODE (operand) == CONST_DOUBLE)
- win = 1;
- break;
-
- case 'F':
- if (GET_CODE (operand) == CONST_DOUBLE)
- win = 1;
- break;
-
- case 'G':
- case 'H':
- if (GET_CODE (operand) == CONST_DOUBLE
- && CONST_DOUBLE_OK_FOR_LETTER_P (operand, c))
- win = 1;
- break;
-
- case 's':
- if (GET_CODE (operand) == CONST_INT
- || (GET_CODE (operand) == CONST_DOUBLE
- && GET_MODE (operand) == VOIDmode))
- break;
- case 'i':
- if (CONSTANT_P (operand)
-#ifdef LEGITIMATE_PIC_OPERAND_P
- && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (operand))
-#endif
- )
- win = 1;
- break;
-
- case 'n':
- if (GET_CODE (operand) == CONST_INT
- || (GET_CODE (operand) == CONST_DOUBLE
- && GET_MODE (operand) == VOIDmode))
- win = 1;
- break;
-
- case 'I':
- case 'J':
- case 'K':
- case 'L':
- case 'M':
- case 'N':
- case 'O':
- case 'P':
- if (GET_CODE (operand) == CONST_INT
- && CONST_OK_FOR_LETTER_P (INTVAL (operand), c))
- win = 1;
- break;
-
- case 'X':
- win = 1;
- break;
-
- case 'g':
- if (! force_reload
- /* A PLUS is never a valid operand, but reload can make
- it from a register when eliminating registers. */
- && GET_CODE (operand) != PLUS
- /* A SCRATCH is not a valid operand. */
- && GET_CODE (operand) != SCRATCH
-#ifdef LEGITIMATE_PIC_OPERAND_P
- && (! CONSTANT_P (operand)
- || ! flag_pic
- || LEGITIMATE_PIC_OPERAND_P (operand))
-#endif
- && (GENERAL_REGS == ALL_REGS
- || GET_CODE (operand) != REG
- || (REGNO (operand) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[REGNO (operand)] < 0)))
- win = 1;
- /* Drop through into 'r' case */
-
- case 'r':
- this_alternative[i]
- = (int) reg_class_subunion[this_alternative[i]][(int) GENERAL_REGS];
- goto reg;
-
-#ifdef EXTRA_CONSTRAINT
- case 'Q':
- case 'R':
- case 'S':
- case 'T':
- case 'U':
- if (EXTRA_CONSTRAINT (operand, c))
- win = 1;
- break;
-#endif
-
- default:
- this_alternative[i]
- = (int) reg_class_subunion[this_alternative[i]][(int) REG_CLASS_FROM_LETTER (c)];
-
- reg:
- if (GET_MODE (operand) == BLKmode)
- break;
- winreg = 1;
- if (GET_CODE (operand) == REG
- && reg_fits_class_p (operand, this_alternative[i],
- offset, GET_MODE (recog_operand[i])))
- win = 1;
- break;
- }
-
- constraints[i] = p;
-
- /* If this operand could be handled with a reg,
- and some reg is allowed, then this operand can be handled. */
- if (winreg && this_alternative[i] != (int) NO_REGS)
- badop = 0;
-
- /* Record which operands fit this alternative. */
- this_alternative_earlyclobber[i] = earlyclobber;
- if (win && ! force_reload)
- this_alternative_win[i] = 1;
- else
- {
- int const_to_mem = 0;
-
- this_alternative_offmemok[i] = offmemok;
- losers++;
- if (badop)
- bad = 1;
- /* Alternative loses if it has no regs for a reg operand. */
- if (GET_CODE (operand) == REG
- && this_alternative[i] == (int) NO_REGS
- && this_alternative_matches[i] < 0)
- bad = 1;
-
- /* Alternative loses if it requires a type of reload not
- permitted for this insn. We can always reload SCRATCH
- and objects with a REG_UNUSED note. */
- if (GET_CODE (operand) != SCRATCH
- && modified[i] != RELOAD_READ && no_output_reloads
- && ! find_reg_note (insn, REG_UNUSED, operand))
- bad = 1;
- else if (modified[i] != RELOAD_WRITE && no_input_reloads)
- bad = 1;
-
- /* If this is a constant that is reloaded into the desired
- class by copying it to memory first, count that as another
- reload. This is consistent with other code and is
- required to avoid choosing another alternative when
- the constant is moved into memory by this function on
- an early reload pass. Note that the test here is
- precisely the same as in the code below that calls
- force_const_mem. */
- if (CONSTANT_P (operand)
- /* force_const_mem does not accept HIGH. */
- && GET_CODE (operand) != HIGH
- && (PREFERRED_RELOAD_CLASS (operand,
- (enum reg_class) this_alternative[i])
- == NO_REGS)
- && operand_mode[i] != VOIDmode)
- {
- const_to_mem = 1;
- if (this_alternative[i] != (int) NO_REGS)
- losers++;
- }
-
- /* If we can't reload this value at all, reject this
- alternative. Note that we could also lose due to
- LIMIT_RELOAD_RELOAD_CLASS, but we don't check that
- here. */
-
- if (! CONSTANT_P (operand)
- && (enum reg_class) this_alternative[i] != NO_REGS
- && (PREFERRED_RELOAD_CLASS (operand,
- (enum reg_class) this_alternative[i])
- == NO_REGS))
- bad = 1;
-
- /* We prefer to reload pseudos over reloading other things,
- since such reloads may be able to be eliminated later.
- If we are reloading a SCRATCH, we won't be generating any
- insns, just using a register, so it is also preferred.
- So bump REJECT in other cases. Don't do this in the
- case where we are forcing a constant into memory and
- it will then win since we don't want to have a different
- alternative match then. */
- if (! (GET_CODE (operand) == REG
- && REGNO (operand) >= FIRST_PSEUDO_REGISTER)
- && GET_CODE (operand) != SCRATCH
- && ! (const_to_mem && constmemok))
- reject++;
- }
-
- /* If this operand is a pseudo register that didn't get a hard
- reg and this alternative accepts some register, see if the
- class that we want is a subset of the preferred class for this
- register. If not, but it intersects that class, use the
- preferred class instead. If it does not intersect the preferred
- class, show that usage of this alternative should be discouraged;
- it will be discouraged more still if the register is `preferred
- or nothing'. We do this because it increases the chance of
- reusing our spill register in a later insn and avoiding a pair
- of memory stores and loads.
-
- Don't bother with this if this alternative will accept this
- operand.
-
- Don't do this for a multiword operand, since it is only a
- small win and has the risk of requiring more spill registers,
- which could cause a large loss.
-
- Don't do this if the preferred class has only one register
- because we might otherwise exhaust the class. */
-
-
- if (! win && this_alternative[i] != (int) NO_REGS
- && GET_MODE_SIZE (operand_mode[i]) <= UNITS_PER_WORD
- && reg_class_size[(int) preferred_class[i]] > 1)
- {
- if (! reg_class_subset_p (this_alternative[i],
- preferred_class[i]))
- {
- /* Since we don't have a way of forming the intersection,
- we just do something special if the preferred class
- is a subset of the class we have; that's the most
- common case anyway. */
- if (reg_class_subset_p (preferred_class[i],
- this_alternative[i]))
- this_alternative[i] = (int) preferred_class[i];
- else
- reject += (1 + pref_or_nothing[i]);
- }
- }
- }
-
- /* Now see if any output operands that are marked "earlyclobber"
- in this alternative conflict with any input operands
- or any memory addresses. */
-
- for (i = 0; i < noperands; i++)
- if (this_alternative_earlyclobber[i]
- && this_alternative_win[i])
- {
- struct decomposition early_data;
-
- early_data = decompose (recog_operand[i]);
-
- if (modified[i] == RELOAD_READ)
- {
- if (this_insn_is_asm)
- warning_for_asm (this_insn,
- "`&' constraint used with input operand");
- else
- abort ();
- continue;
- }
-
- if (this_alternative[i] == NO_REGS)
- {
- this_alternative_earlyclobber[i] = 0;
- if (this_insn_is_asm)
- error_for_asm (this_insn,
- "`&' constraint used with no register class");
- else
- abort ();
- }
-
- for (j = 0; j < noperands; j++)
- /* Is this an input operand or a memory ref? */
- if ((GET_CODE (recog_operand[j]) == MEM
- || modified[j] != RELOAD_WRITE)
- && j != i
- /* Ignore things like match_operator operands. */
- && *constraints1[j] != 0
- /* Don't count an input operand that is constrained to match
- the early clobber operand. */
- && ! (this_alternative_matches[j] == i
- && rtx_equal_p (recog_operand[i], recog_operand[j]))
- /* Is it altered by storing the earlyclobber operand? */
- && !immune_p (recog_operand[j], recog_operand[i], early_data))
- {
- /* If the output is in a single-reg class,
- it's costly to reload it, so reload the input instead. */
- if (reg_class_size[this_alternative[i]] == 1
- && (GET_CODE (recog_operand[j]) == REG
- || GET_CODE (recog_operand[j]) == SUBREG))
- {
- losers++;
- this_alternative_win[j] = 0;
- }
- else
- break;
- }
- /* If an earlyclobber operand conflicts with something,
- it must be reloaded, so request this and count the cost. */
- if (j != noperands)
- {
- losers++;
- this_alternative_win[i] = 0;
- for (j = 0; j < noperands; j++)
- if (this_alternative_matches[j] == i
- && this_alternative_win[j])
- {
- this_alternative_win[j] = 0;
- losers++;
- }
- }
- }
-
- /* If one alternative accepts all the operands, no reload required,
- choose that alternative; don't consider the remaining ones. */
- if (losers == 0)
- {
- /* Unswap these so that they are never swapped at `finish'. */
- if (commutative >= 0)
- {
- recog_operand[commutative] = substed_operand[commutative];
- recog_operand[commutative + 1]
- = substed_operand[commutative + 1];
- }
- for (i = 0; i < noperands; i++)
- {
- goal_alternative_win[i] = 1;
- goal_alternative[i] = this_alternative[i];
- goal_alternative_offmemok[i] = this_alternative_offmemok[i];
- goal_alternative_matches[i] = this_alternative_matches[i];
- goal_alternative_earlyclobber[i]
- = this_alternative_earlyclobber[i];
- }
- goal_alternative_number = this_alternative_number;
- goal_alternative_swapped = swapped;
- goal_earlyclobber = this_earlyclobber;
- goto finish;
- }
-
- /* REJECT, set by the ! and ? constraint characters and when a register
- would be reloaded into a non-preferred class, discourages the use of
- this alternative for a reload goal. REJECT is incremented by three
- for each ? and one for each non-preferred class. */
- losers = losers * 3 + reject;
-
- /* If this alternative can be made to work by reloading,
- and it needs less reloading than the others checked so far,
- record it as the chosen goal for reloading. */
- if (! bad && best > losers)
- {
- for (i = 0; i < noperands; i++)
- {
- goal_alternative[i] = this_alternative[i];
- goal_alternative_win[i] = this_alternative_win[i];
- goal_alternative_offmemok[i] = this_alternative_offmemok[i];
- goal_alternative_matches[i] = this_alternative_matches[i];
- goal_alternative_earlyclobber[i]
- = this_alternative_earlyclobber[i];
- }
- goal_alternative_swapped = swapped;
- best = losers;
- goal_alternative_number = this_alternative_number;
- goal_earlyclobber = this_earlyclobber;
- }
- }
-
- /* If insn is commutative (it's safe to exchange a certain pair of operands)
- then we need to try each alternative twice,
- the second time matching those two operands
- as if we had exchanged them.
- To do this, really exchange them in operands.
-
- If we have just tried the alternatives the second time,
- return operands to normal and drop through. */
-
- if (commutative >= 0)
- {
- swapped = !swapped;
- if (swapped)
- {
- register enum reg_class tclass;
- register int t;
-
- recog_operand[commutative] = substed_operand[commutative + 1];
- recog_operand[commutative + 1] = substed_operand[commutative];
-
- tclass = preferred_class[commutative];
- preferred_class[commutative] = preferred_class[commutative + 1];
- preferred_class[commutative + 1] = tclass;
-
- t = pref_or_nothing[commutative];
- pref_or_nothing[commutative] = pref_or_nothing[commutative + 1];
- pref_or_nothing[commutative + 1] = t;
-
- bcopy ((char *) constraints1, (char *) constraints,
- noperands * sizeof (char *));
- goto try_swapped;
- }
- else
- {
- recog_operand[commutative] = substed_operand[commutative];
- recog_operand[commutative + 1] = substed_operand[commutative + 1];
- }
- }
-
- /* The operands don't meet the constraints.
- goal_alternative describes the alternative
- that we could reach by reloading the fewest operands.
- Reload so as to fit it. */
-
- if (best == MAX_RECOG_OPERANDS + 300)
- {
- /* No alternative works with reloads?? */
- if (insn_code_number >= 0)
- abort ();
- error_for_asm (insn, "inconsistent operand constraints in an `asm'");
- /* Avoid further trouble with this insn. */
- PATTERN (insn) = gen_rtx (USE, VOIDmode, const0_rtx);
- n_reloads = 0;
- return;
- }
-
- /* Jump to `finish' from above if all operands are valid already.
- In that case, goal_alternative_win is all 1. */
- finish:
-
- /* Right now, for any pair of operands I and J that are required to match,
- with I < J,
- goal_alternative_matches[J] is I.
- Set up goal_alternative_matched as the inverse function:
- goal_alternative_matched[I] = J. */
-
- for (i = 0; i < noperands; i++)
- goal_alternative_matched[i] = -1;
-
- for (i = 0; i < noperands; i++)
- if (! goal_alternative_win[i]
- && goal_alternative_matches[i] >= 0)
- goal_alternative_matched[goal_alternative_matches[i]] = i;
-
- /* If the best alternative is with operands 1 and 2 swapped,
- consider them swapped before reporting the reloads. Update the
- operand numbers of any reloads already pushed. */
-
- if (goal_alternative_swapped)
- {
- register rtx tem;
-
- tem = substed_operand[commutative];
- substed_operand[commutative] = substed_operand[commutative + 1];
- substed_operand[commutative + 1] = tem;
- tem = recog_operand[commutative];
- recog_operand[commutative] = recog_operand[commutative + 1];
- recog_operand[commutative + 1] = tem;
-
- for (i = 0; i < n_reloads; i++)
- {
- if (reload_opnum[i] == commutative)
- reload_opnum[i] = commutative + 1;
- else if (reload_opnum[i] == commutative + 1)
- reload_opnum[i] = commutative;
- }
- }
-
- /* Perform whatever substitutions on the operands we are supposed
- to make due to commutativity or replacement of registers
- with equivalent constants or memory slots. */
-
- for (i = 0; i < noperands; i++)
- {
- *recog_operand_loc[i] = substed_operand[i];
- /* While we are looping on operands, initialize this. */
- operand_reloadnum[i] = -1;
-
- /* If this is an earlyclobber operand, we need to widen the scope.
- The reload must remain valid from the start of the insn being
- reloaded until after the operand is stored into its destination.
- We approximate this with RELOAD_OTHER even though we know that we
- do not conflict with RELOAD_FOR_INPUT_ADDRESS reloads.
-
- One special case that is worth checking is when we have an
- output that is earlyclobber but isn't used past the insn (typically
- a SCRATCH). In this case, we only need have the reload live
- through the insn itself, but not for any of our input or output
- reloads.
-
- In any case, anything needed to address this operand can remain
- however they were previously categorized. */
-
- if (goal_alternative_earlyclobber[i])
- operand_type[i]
- = (find_reg_note (insn, REG_UNUSED, recog_operand[i])
- ? RELOAD_FOR_INSN : RELOAD_OTHER);
- }
-
- /* Any constants that aren't allowed and can't be reloaded
- into registers are here changed into memory references. */
- for (i = 0; i < noperands; i++)
- if (! goal_alternative_win[i]
- && CONSTANT_P (recog_operand[i])
- /* force_const_mem does not accept HIGH. */
- && GET_CODE (recog_operand[i]) != HIGH
- && (PREFERRED_RELOAD_CLASS (recog_operand[i],
- (enum reg_class) goal_alternative[i])
- == NO_REGS)
- && operand_mode[i] != VOIDmode)
- {
- *recog_operand_loc[i] = recog_operand[i]
- = find_reloads_toplev (force_const_mem (operand_mode[i],
- recog_operand[i]),
- i, address_type[i], ind_levels, 0);
- if (alternative_allows_memconst (constraints1[i],
- goal_alternative_number))
- goal_alternative_win[i] = 1;
- }
-
- /* Record the values of the earlyclobber operands for the caller. */
- if (goal_earlyclobber)
- for (i = 0; i < noperands; i++)
- if (goal_alternative_earlyclobber[i])
- reload_earlyclobbers[n_earlyclobbers++] = recog_operand[i];
-
- /* Now record reloads for all the operands that need them. */
- for (i = 0; i < noperands; i++)
- if (! goal_alternative_win[i])
- {
- /* Operands that match previous ones have already been handled. */
- if (goal_alternative_matches[i] >= 0)
- ;
- /* Handle an operand with a nonoffsettable address
- appearing where an offsettable address will do
- by reloading the address into a base register.
-
- ??? We can also do this when the operand is a register and
- reg_equiv_mem is not offsettable, but this is a bit tricky,
- so we don't bother with it. It may not be worth doing. */
- else if (goal_alternative_matched[i] == -1
- && goal_alternative_offmemok[i]
- && GET_CODE (recog_operand[i]) == MEM)
- {
- operand_reloadnum[i]
- = push_reload (XEXP (recog_operand[i], 0), NULL_RTX,
- &XEXP (recog_operand[i], 0), NULL_PTR,
- BASE_REG_CLASS, GET_MODE (XEXP (recog_operand[i], 0)),
- VOIDmode, 0, 0, i, RELOAD_FOR_INPUT);
- reload_inc[operand_reloadnum[i]]
- = GET_MODE_SIZE (GET_MODE (recog_operand[i]));
-
- /* If this operand is an output, we will have made any
- reloads for its address as RELOAD_FOR_OUTPUT_ADDRESS, but
- now we are treating part of the operand as an input, so
- we must change these to RELOAD_FOR_INPUT_ADDRESS. */
-
- if (modified[i] == RELOAD_WRITE)
- {
- for (j = 0; j < n_reloads; j++)
- {
- if (reload_opnum[j] == i)
- {
- if (reload_when_needed[j] == RELOAD_FOR_OUTPUT_ADDRESS)
- reload_when_needed[j] = RELOAD_FOR_INPUT_ADDRESS;
- else if (reload_when_needed[j]
- == RELOAD_FOR_OUTADDR_ADDRESS)
- reload_when_needed[j] = RELOAD_FOR_INPADDR_ADDRESS;
- }
- }
- }
- }
- else if (goal_alternative_matched[i] == -1)
- operand_reloadnum[i] =
- push_reload (modified[i] != RELOAD_WRITE ? recog_operand[i] : 0,
- modified[i] != RELOAD_READ ? recog_operand[i] : 0,
- (modified[i] != RELOAD_WRITE ?
- recog_operand_loc[i] : 0),
- modified[i] != RELOAD_READ ? recog_operand_loc[i] : 0,
- (enum reg_class) goal_alternative[i],
- (modified[i] == RELOAD_WRITE
- ? VOIDmode : operand_mode[i]),
- (modified[i] == RELOAD_READ
- ? VOIDmode : operand_mode[i]),
- (insn_code_number < 0 ? 0
- : insn_operand_strict_low[insn_code_number][i]),
- 0, i, operand_type[i]);
- /* In a matching pair of operands, one must be input only
- and the other must be output only.
- Pass the input operand as IN and the other as OUT. */
- else if (modified[i] == RELOAD_READ
- && modified[goal_alternative_matched[i]] == RELOAD_WRITE)
- {
- operand_reloadnum[i]
- = push_reload (recog_operand[i],
- recog_operand[goal_alternative_matched[i]],
- recog_operand_loc[i],
- recog_operand_loc[goal_alternative_matched[i]],
- (enum reg_class) goal_alternative[i],
- operand_mode[i],
- operand_mode[goal_alternative_matched[i]],
- 0, 0, i, RELOAD_OTHER);
- operand_reloadnum[goal_alternative_matched[i]] = output_reloadnum;
- }
- else if (modified[i] == RELOAD_WRITE
- && modified[goal_alternative_matched[i]] == RELOAD_READ)
- {
- operand_reloadnum[goal_alternative_matched[i]]
- = push_reload (recog_operand[goal_alternative_matched[i]],
- recog_operand[i],
- recog_operand_loc[goal_alternative_matched[i]],
- recog_operand_loc[i],
- (enum reg_class) goal_alternative[i],
- operand_mode[goal_alternative_matched[i]],
- operand_mode[i],
- 0, 0, i, RELOAD_OTHER);
- operand_reloadnum[i] = output_reloadnum;
- }
- else if (insn_code_number >= 0)
- abort ();
- else
- {
- error_for_asm (insn, "inconsistent operand constraints in an `asm'");
- /* Avoid further trouble with this insn. */
- PATTERN (insn) = gen_rtx (USE, VOIDmode, const0_rtx);
- n_reloads = 0;
- return;
- }
- }
- else if (goal_alternative_matched[i] < 0
- && goal_alternative_matches[i] < 0
- && optimize)
- {
- /* For each non-matching operand that's a MEM or a pseudo-register
- that didn't get a hard register, make an optional reload.
- This may get done even if the insn needs no reloads otherwise. */
-
- rtx operand = recog_operand[i];
-
- while (GET_CODE (operand) == SUBREG)
- operand = XEXP (operand, 0);
- if ((GET_CODE (operand) == MEM
- || (GET_CODE (operand) == REG
- && REGNO (operand) >= FIRST_PSEUDO_REGISTER))
- && (enum reg_class) goal_alternative[i] != NO_REGS
- && ! no_input_reloads
- /* Optional output reloads don't do anything and we mustn't
- make in-out reloads on insns that are not permitted output
- reloads. */
- && (modified[i] == RELOAD_READ
- || (modified[i] == RELOAD_READ_WRITE && ! no_output_reloads)))
- operand_reloadnum[i]
- = push_reload (modified[i] != RELOAD_WRITE ? recog_operand[i] : 0,
- modified[i] != RELOAD_READ ? recog_operand[i] : 0,
- (modified[i] != RELOAD_WRITE
- ? recog_operand_loc[i] : 0),
- (modified[i] != RELOAD_READ
- ? recog_operand_loc[i] : 0),
- (enum reg_class) goal_alternative[i],
- (modified[i] == RELOAD_WRITE
- ? VOIDmode : operand_mode[i]),
- (modified[i] == RELOAD_READ
- ? VOIDmode : operand_mode[i]),
- (insn_code_number < 0 ? 0
- : insn_operand_strict_low[insn_code_number][i]),
- 1, i, operand_type[i]);
- }
- else if (goal_alternative_matches[i] >= 0
- && goal_alternative_win[goal_alternative_matches[i]]
- && modified[i] == RELOAD_READ
- && modified[goal_alternative_matches[i]] == RELOAD_WRITE
- && ! no_input_reloads && ! no_output_reloads
- && optimize)
- {
- /* Similarly, make an optional reload for a pair of matching
- objects that are in MEM or a pseudo that didn't get a hard reg. */
-
- rtx operand = recog_operand[i];
-
- while (GET_CODE (operand) == SUBREG)
- operand = XEXP (operand, 0);
- if ((GET_CODE (operand) == MEM
- || (GET_CODE (operand) == REG
- && REGNO (operand) >= FIRST_PSEUDO_REGISTER))
- && ((enum reg_class) goal_alternative[goal_alternative_matches[i]]
- != NO_REGS))
- operand_reloadnum[i] = operand_reloadnum[goal_alternative_matches[i]]
- = push_reload (recog_operand[goal_alternative_matches[i]],
- recog_operand[i],
- recog_operand_loc[goal_alternative_matches[i]],
- recog_operand_loc[i],
- (enum reg_class) goal_alternative[goal_alternative_matches[i]],
- operand_mode[goal_alternative_matches[i]],
- operand_mode[i],
- 0, 1, goal_alternative_matches[i], RELOAD_OTHER);
- }
-
- /* If this insn pattern contains any MATCH_DUP's, make sure that
- they will be substituted if the operands they match are substituted.
- Also do now any substitutions we already did on the operands.
-
- Don't do this if we aren't making replacements because we might be
- propagating things allocated by frame pointer elimination into places
- it doesn't expect. */
-
- if (insn_code_number >= 0 && replace)
- for (i = insn_n_dups[insn_code_number] - 1; i >= 0; i--)
- {
- int opno = recog_dup_num[i];
- *recog_dup_loc[i] = *recog_operand_loc[opno];
- if (operand_reloadnum[opno] >= 0)
- push_replacement (recog_dup_loc[i], operand_reloadnum[opno],
- insn_operand_mode[insn_code_number][opno]);
- }
-
-#if 0
- /* This loses because reloading of prior insns can invalidate the equivalence
- (or at least find_equiv_reg isn't smart enough to find it any more),
- causing this insn to need more reload regs than it needed before.
- It may be too late to make the reload regs available.
- Now this optimization is done safely in choose_reload_regs. */
-
- /* For each reload of a reg into some other class of reg,
- search for an existing equivalent reg (same value now) in the right class.
- We can use it as long as we don't need to change its contents. */
- for (i = 0; i < n_reloads; i++)
- if (reload_reg_rtx[i] == 0
- && reload_in[i] != 0
- && GET_CODE (reload_in[i]) == REG
- && reload_out[i] == 0)
- {
- reload_reg_rtx[i]
- = find_equiv_reg (reload_in[i], insn, reload_reg_class[i], -1,
- static_reload_reg_p, 0, reload_inmode[i]);
- /* Prevent generation of insn to load the value
- because the one we found already has the value. */
- if (reload_reg_rtx[i])
- reload_in[i] = reload_reg_rtx[i];
- }
-#endif
-
- /* Perhaps an output reload can be combined with another
- to reduce needs by one. */
- if (!goal_earlyclobber)
- combine_reloads ();
-
- /* If we have a pair of reloads for parts of an address, they are reloading
- the same object, the operands themselves were not reloaded, and they
- are for two operands that are supposed to match, merge the reloads and
- change the type of the surviving reload to RELOAD_FOR_OPERAND_ADDRESS. */
-
- for (i = 0; i < n_reloads; i++)
- {
- int k;
-
- for (j = i + 1; j < n_reloads; j++)
- if ((reload_when_needed[i] == RELOAD_FOR_INPUT_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_OUTPUT_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_INPADDR_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_OUTADDR_ADDRESS)
- && (reload_when_needed[j] == RELOAD_FOR_INPUT_ADDRESS
- || reload_when_needed[j] == RELOAD_FOR_OUTPUT_ADDRESS
- || reload_when_needed[j] == RELOAD_FOR_INPADDR_ADDRESS
- || reload_when_needed[j] == RELOAD_FOR_OUTADDR_ADDRESS)
- && rtx_equal_p (reload_in[i], reload_in[j])
- && (operand_reloadnum[reload_opnum[i]] < 0
- || reload_optional[operand_reloadnum[reload_opnum[i]]])
- && (operand_reloadnum[reload_opnum[j]] < 0
- || reload_optional[operand_reloadnum[reload_opnum[j]]])
- && (goal_alternative_matches[reload_opnum[i]] == reload_opnum[j]
- || (goal_alternative_matches[reload_opnum[j]]
- == reload_opnum[i])))
- {
- for (k = 0; k < n_replacements; k++)
- if (replacements[k].what == j)
- replacements[k].what = i;
-
- if (reload_when_needed[i] == RELOAD_FOR_INPADDR_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_OUTADDR_ADDRESS)
- reload_when_needed[i] = RELOAD_FOR_OPADDR_ADDR;
- else
- reload_when_needed[i] = RELOAD_FOR_OPERAND_ADDRESS;
- reload_in[j] = 0;
- }
- }
-
- /* Scan all the reloads and update their type.
- If a reload is for the address of an operand and we didn't reload
- that operand, change the type. Similarly, change the operand number
- of a reload when two operands match. If a reload is optional, treat it
- as though the operand isn't reloaded.
-
- ??? This latter case is somewhat odd because if we do the optional
- reload, it means the object is hanging around. Thus we need only
- do the address reload if the optional reload was NOT done.
-
- Change secondary reloads to be the address type of their operand, not
- the normal type.
-
- If an operand's reload is now RELOAD_OTHER, change any
- RELOAD_FOR_INPUT_ADDRESS reloads of that operand to
- RELOAD_FOR_OTHER_ADDRESS. */
-
- for (i = 0; i < n_reloads; i++)
- {
- if (reload_secondary_p[i]
- && reload_when_needed[i] == operand_type[reload_opnum[i]])
- reload_when_needed[i] = address_type[reload_opnum[i]];
-
- if ((reload_when_needed[i] == RELOAD_FOR_INPUT_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_OUTPUT_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_INPADDR_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_OUTADDR_ADDRESS)
- && (operand_reloadnum[reload_opnum[i]] < 0
- || reload_optional[operand_reloadnum[reload_opnum[i]]]))
- {
- /* If we have a secondary reload to go along with this reload,
- change its type to RELOAD_FOR_OPADDR_ADDR. */
-
- if ((reload_when_needed[i] == RELOAD_FOR_INPUT_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_INPADDR_ADDRESS)
- && reload_secondary_in_reload[i] != -1)
- {
- int secondary_in_reload = reload_secondary_in_reload[i];
-
- reload_when_needed[secondary_in_reload] =
- RELOAD_FOR_OPADDR_ADDR;
-
- /* If there's a tertiary reload we have to change it also. */
- if (secondary_in_reload > 0
- && reload_secondary_in_reload[secondary_in_reload] != -1)
- reload_when_needed[reload_secondary_in_reload[secondary_in_reload]]
- = RELOAD_FOR_OPADDR_ADDR;
- }
-
- if ((reload_when_needed[i] == RELOAD_FOR_OUTPUT_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_OUTADDR_ADDRESS)
- && reload_secondary_out_reload[i] != -1)
- {
- int secondary_out_reload = reload_secondary_out_reload[i];
-
- reload_when_needed[secondary_out_reload] =
- RELOAD_FOR_OPADDR_ADDR;
-
- /* If there's a tertiary reload we have to change it also. */
- if (secondary_out_reload
- && reload_secondary_out_reload[secondary_out_reload] != -1)
- reload_when_needed[reload_secondary_out_reload[secondary_out_reload]]
- = RELOAD_FOR_OPADDR_ADDR;
- }
- if (reload_when_needed[i] == RELOAD_FOR_INPADDR_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_OUTADDR_ADDRESS)
- reload_when_needed[i] = RELOAD_FOR_OPADDR_ADDR;
- else
- reload_when_needed[i] = RELOAD_FOR_OPERAND_ADDRESS;
- }
-
- if ((reload_when_needed[i] == RELOAD_FOR_INPUT_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_INPADDR_ADDRESS)
- && operand_reloadnum[reload_opnum[i]] >= 0
- && (reload_when_needed[operand_reloadnum[reload_opnum[i]]]
- == RELOAD_OTHER))
- reload_when_needed[i] = RELOAD_FOR_OTHER_ADDRESS;
-
- if (goal_alternative_matches[reload_opnum[i]] >= 0)
- reload_opnum[i] = goal_alternative_matches[reload_opnum[i]];
- }
-
- /* See if we have any reloads that are now allowed to be merged
- because we've changed when the reload is needed to
- RELOAD_FOR_OPERAND_ADDRESS or RELOAD_FOR_OTHER_ADDRESS. Only
- check for the most common cases. */
-
- for (i = 0; i < n_reloads; i++)
- if (reload_in[i] != 0 && reload_out[i] == 0
- && (reload_when_needed[i] == RELOAD_FOR_OPERAND_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_OPADDR_ADDR
- || reload_when_needed[i] == RELOAD_FOR_OTHER_ADDRESS))
- for (j = 0; j < n_reloads; j++)
- if (i != j && reload_in[j] != 0 && reload_out[j] == 0
- && reload_when_needed[j] == reload_when_needed[i]
- && MATCHES (reload_in[i], reload_in[j])
- && reload_reg_class[i] == reload_reg_class[j]
- && !reload_nocombine[i] && !reload_nocombine[j]
- && reload_reg_rtx[i] == reload_reg_rtx[j])
- {
- reload_opnum[i] = MIN (reload_opnum[i], reload_opnum[j]);
- transfer_replacements (i, j);
- reload_in[j] = 0;
- }
-
-#else /* no REGISTER_CONSTRAINTS */
- int noperands;
- int insn_code_number;
- int goal_earlyclobber = 0; /* Always 0, to make combine_reloads happen. */
- register int i;
- rtx body = PATTERN (insn);
-
- n_reloads = 0;
- n_replacements = 0;
- n_earlyclobbers = 0;
- replace_reloads = replace;
- this_insn = insn;
-
- /* Find what kind of insn this is. NOPERANDS gets number of operands.
- Store the operand values in RECOG_OPERAND and the locations
- of the words in the insn that point to them in RECOG_OPERAND_LOC.
- Return if the insn needs no reload processing. */
-
- switch (GET_CODE (body))
- {
- case USE:
- case CLOBBER:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- return;
-
- case PARALLEL:
- case SET:
- noperands = asm_noperands (body);
- if (noperands >= 0)
- {
- /* This insn is an `asm' with operands.
- First, find out how many operands, and allocate space. */
-
- insn_code_number = -1;
- /* ??? This is a bug! ???
- Give up and delete this insn if it has too many operands. */
- if (noperands > MAX_RECOG_OPERANDS)
- abort ();
-
- /* Now get the operand values out of the insn. */
-
- decode_asm_operands (body, recog_operand, recog_operand_loc,
- NULL_PTR, NULL_PTR);
- break;
- }
-
- default:
- /* Ordinary insn: recognize it, allocate space for operands and
- constraints, and get them out via insn_extract. */
-
- insn_code_number = recog_memoized (insn);
- noperands = insn_n_operands[insn_code_number];
- insn_extract (insn);
- }
-
- if (noperands == 0)
- return;
-
- for (i = 0; i < noperands; i++)
- {
- register RTX_CODE code = GET_CODE (recog_operand[i]);
- int is_set_dest = GET_CODE (body) == SET && (i == 0);
-
- if (insn_code_number >= 0)
- if (insn_operand_address_p[insn_code_number][i])
- find_reloads_address (VOIDmode, NULL_PTR,
- recog_operand[i], recog_operand_loc[i],
- i, RELOAD_FOR_INPUT, ind_levels, insn);
-
- /* In these cases, we can't tell if the operand is an input
- or an output, so be conservative. In practice it won't be
- problem. */
-
- if (code == MEM)
- find_reloads_address (GET_MODE (recog_operand[i]),
- recog_operand_loc[i],
- XEXP (recog_operand[i], 0),
- &XEXP (recog_operand[i], 0),
- i, RELOAD_OTHER, ind_levels, insn);
- if (code == SUBREG)
- recog_operand[i] = *recog_operand_loc[i]
- = find_reloads_toplev (recog_operand[i], i, RELOAD_OTHER,
- ind_levels, is_set_dest);
- if (code == REG)
- {
- register int regno = REGNO (recog_operand[i]);
- if (reg_equiv_constant[regno] != 0 && !is_set_dest)
- recog_operand[i] = *recog_operand_loc[i]
- = reg_equiv_constant[regno];
-#if 0 /* This might screw code in reload1.c to delete prior output-reload
- that feeds this insn. */
- if (reg_equiv_mem[regno] != 0)
- recog_operand[i] = *recog_operand_loc[i]
- = reg_equiv_mem[regno];
-#endif
- }
- }
-
- /* Perhaps an output reload can be combined with another
- to reduce needs by one. */
- if (!goal_earlyclobber)
- combine_reloads ();
-#endif /* no REGISTER_CONSTRAINTS */
-}
-
-/* Return 1 if alternative number ALTNUM in constraint-string CONSTRAINT
- accepts a memory operand with constant address. */
-
-static int
-alternative_allows_memconst (constraint, altnum)
- char *constraint;
- int altnum;
-{
- register int c;
- /* Skip alternatives before the one requested. */
- while (altnum > 0)
- {
- while (*constraint++ != ',');
- altnum--;
- }
- /* Scan the requested alternative for 'm' or 'o'.
- If one of them is present, this alternative accepts memory constants. */
- while ((c = *constraint++) && c != ',' && c != '#')
- if (c == 'm' || c == 'o')
- return 1;
- return 0;
-}
-
-/* Scan X for memory references and scan the addresses for reloading.
- Also checks for references to "constant" regs that we want to eliminate
- and replaces them with the values they stand for.
- We may alter X destructively if it contains a reference to such.
- If X is just a constant reg, we return the equivalent value
- instead of X.
-
- IND_LEVELS says how many levels of indirect addressing this machine
- supports.
-
- OPNUM and TYPE identify the purpose of the reload.
-
- IS_SET_DEST is true if X is the destination of a SET, which is not
- appropriate to be replaced by a constant. */
-
-static rtx
-find_reloads_toplev (x, opnum, type, ind_levels, is_set_dest)
- rtx x;
- int opnum;
- enum reload_type type;
- int ind_levels;
- int is_set_dest;
-{
- register RTX_CODE code = GET_CODE (x);
-
- register char *fmt = GET_RTX_FORMAT (code);
- register int i;
-
- if (code == REG)
- {
- /* This code is duplicated for speed in find_reloads. */
- register int regno = REGNO (x);
- if (reg_equiv_constant[regno] != 0 && !is_set_dest)
- x = reg_equiv_constant[regno];
-#if 0
-/* This creates (subreg (mem...)) which would cause an unnecessary
- reload of the mem. */
- else if (reg_equiv_mem[regno] != 0)
- x = reg_equiv_mem[regno];
-#endif
- else if (reg_equiv_address[regno] != 0)
- {
- /* If reg_equiv_address varies, it may be shared, so copy it. */
- /* We must rerun eliminate_regs, in case the elimination
- offsets have changed. */
- rtx addr = XEXP (eliminate_regs (reg_equiv_memory_loc[regno], 0,
- NULL_RTX, 0),
- 0);
-
- if (rtx_varies_p (addr))
- addr = copy_rtx (addr);
-
- x = gen_rtx (MEM, GET_MODE (x), addr);
- RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (regno_reg_rtx[regno]);
- find_reloads_address (GET_MODE (x), NULL_PTR,
- XEXP (x, 0),
- &XEXP (x, 0), opnum, type, ind_levels, 0);
- }
- return x;
- }
- if (code == MEM)
- {
- rtx tem = x;
- find_reloads_address (GET_MODE (x), &tem, XEXP (x, 0), &XEXP (x, 0),
- opnum, type, ind_levels, 0);
- return tem;
- }
-
- if (code == SUBREG && GET_CODE (SUBREG_REG (x)) == REG)
- {
- /* Check for SUBREG containing a REG that's equivalent to a constant.
- If the constant has a known value, truncate it right now.
- Similarly if we are extracting a single-word of a multi-word
- constant. If the constant is symbolic, allow it to be substituted
- normally. push_reload will strip the subreg later. If the
- constant is VOIDmode, abort because we will lose the mode of
- the register (this should never happen because one of the cases
- above should handle it). */
-
- register int regno = REGNO (SUBREG_REG (x));
- rtx tem;
-
- if (subreg_lowpart_p (x)
- && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0
- && (tem = gen_lowpart_common (GET_MODE (x),
- reg_equiv_constant[regno])) != 0)
- return tem;
-
- if (GET_MODE_BITSIZE (GET_MODE (x)) == BITS_PER_WORD
- && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0
- && (tem = operand_subword (reg_equiv_constant[regno],
- SUBREG_WORD (x), 0,
- GET_MODE (SUBREG_REG (x)))) != 0)
- return tem;
-
- if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0
- && GET_MODE (reg_equiv_constant[regno]) == VOIDmode)
- abort ();
-
- /* If the subreg contains a reg that will be converted to a mem,
- convert the subreg to a narrower memref now.
- Otherwise, we would get (subreg (mem ...) ...),
- which would force reload of the mem.
-
- We also need to do this if there is an equivalent MEM that is
- not offsettable. In that case, alter_subreg would produce an
- invalid address on big-endian machines.
-
- For machines that extend byte loads, we must not reload using
- a wider mode if we have a paradoxical SUBREG. find_reloads will
- force a reload in that case. So we should not do anything here. */
-
- else if (regno >= FIRST_PSEUDO_REGISTER
-#ifdef LOAD_EXTEND_OP
- && (GET_MODE_SIZE (GET_MODE (x))
- <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
-#endif
- && (reg_equiv_address[regno] != 0
- || (reg_equiv_mem[regno] != 0
- && (! strict_memory_address_p (GET_MODE (x),
- XEXP (reg_equiv_mem[regno], 0))
- || ! offsettable_memref_p (reg_equiv_mem[regno])))))
- {
- int offset = SUBREG_WORD (x) * UNITS_PER_WORD;
- /* We must rerun eliminate_regs, in case the elimination
- offsets have changed. */
- rtx addr = XEXP (eliminate_regs (reg_equiv_memory_loc[regno], 0,
- NULL_RTX, 0),
- 0);
- if (BYTES_BIG_ENDIAN)
- {
- int size;
- size = GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)));
- offset += MIN (size, UNITS_PER_WORD);
- size = GET_MODE_SIZE (GET_MODE (x));
- offset -= MIN (size, UNITS_PER_WORD);
- }
- addr = plus_constant (addr, offset);
- x = gen_rtx (MEM, GET_MODE (x), addr);
- RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (regno_reg_rtx[regno]);
- find_reloads_address (GET_MODE (x), NULL_PTR,
- XEXP (x, 0),
- &XEXP (x, 0), opnum, type, ind_levels, 0);
- }
-
- }
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- XEXP (x, i) = find_reloads_toplev (XEXP (x, i), opnum, type,
- ind_levels, is_set_dest);
- }
- return x;
-}
-
-/* Return a mem ref for the memory equivalent of reg REGNO.
- This mem ref is not shared with anything. */
-
-static rtx
-make_memloc (ad, regno)
- rtx ad;
- int regno;
-{
- register int i;
- /* We must rerun eliminate_regs, in case the elimination
- offsets have changed. */
- rtx tem = XEXP (eliminate_regs (reg_equiv_memory_loc[regno], 0, NULL_RTX, 0),
- 0);
-
-#if 0 /* We cannot safely reuse a memloc made here;
- if the pseudo appears twice, and its mem needs a reload,
- it gets two separate reloads assigned, but it only
- gets substituted with the second of them;
- then it can get used before that reload reg gets loaded up. */
- for (i = 0; i < n_memlocs; i++)
- if (rtx_equal_p (tem, XEXP (memlocs[i], 0)))
- return memlocs[i];
-#endif
-
- /* If TEM might contain a pseudo, we must copy it to avoid
- modifying it when we do the substitution for the reload. */
- if (rtx_varies_p (tem))
- tem = copy_rtx (tem);
-
- tem = gen_rtx (MEM, GET_MODE (ad), tem);
- RTX_UNCHANGING_P (tem) = RTX_UNCHANGING_P (regno_reg_rtx[regno]);
- memlocs[n_memlocs++] = tem;
- return tem;
-}
-
-/* Record all reloads needed for handling memory address AD
- which appears in *LOC in a memory reference to mode MODE
- which itself is found in location *MEMREFLOC.
- Note that we take shortcuts assuming that no multi-reg machine mode
- occurs as part of an address.
-
- OPNUM and TYPE specify the purpose of this reload.
-
- IND_LEVELS says how many levels of indirect addressing this machine
- supports.
-
- INSN, if nonzero, is the insn in which we do the reload. It is used
- to determine if we may generate output reloads.
-
- Value is nonzero if this address is reloaded or replaced as a whole.
- This is interesting to the caller if the address is an autoincrement.
-
- Note that there is no verification that the address will be valid after
- this routine does its work. Instead, we rely on the fact that the address
- was valid when reload started. So we need only undo things that reload
- could have broken. These are wrong register types, pseudos not allocated
- to a hard register, and frame pointer elimination. */
-
-static int
-find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
- enum machine_mode mode;
- rtx *memrefloc;
- rtx ad;
- rtx *loc;
- int opnum;
- enum reload_type type;
- int ind_levels;
- rtx insn;
-{
- register int regno;
- rtx tem;
-
- /* If the address is a register, see if it is a legitimate address and
- reload if not. We first handle the cases where we need not reload
- or where we must reload in a non-standard way. */
-
- if (GET_CODE (ad) == REG)
- {
- regno = REGNO (ad);
-
- if (reg_equiv_constant[regno] != 0
- && strict_memory_address_p (mode, reg_equiv_constant[regno]))
- {
- *loc = ad = reg_equiv_constant[regno];
- return 1;
- }
-
- else if (reg_equiv_address[regno] != 0)
- {
- tem = make_memloc (ad, regno);
- find_reloads_address (GET_MODE (tem), NULL_PTR, XEXP (tem, 0),
- &XEXP (tem, 0), opnum, ADDR_TYPE (type),
- ind_levels, insn);
- push_reload (tem, NULL_RTX, loc, NULL_PTR,
- reload_address_base_reg_class,
- GET_MODE (ad), VOIDmode, 0, 0,
- opnum, type);
- return 1;
- }
-
- /* We can avoid a reload if the register's equivalent memory expression
- is valid as an indirect memory address.
- But not all addresses are valid in a mem used as an indirect address:
- only reg or reg+constant. */
-
- else if (reg_equiv_mem[regno] != 0 && ind_levels > 0
- && strict_memory_address_p (mode, reg_equiv_mem[regno])
- && (GET_CODE (XEXP (reg_equiv_mem[regno], 0)) == REG
- || (GET_CODE (XEXP (reg_equiv_mem[regno], 0)) == PLUS
- && GET_CODE (XEXP (XEXP (reg_equiv_mem[regno], 0), 0)) == REG
- && CONSTANT_P (XEXP (XEXP (reg_equiv_mem[regno], 0), 1)))))
- return 0;
-
- /* The only remaining case where we can avoid a reload is if this is a
- hard register that is valid as a base register and which is not the
- subject of a CLOBBER in this insn. */
-
- else if (regno < FIRST_PSEUDO_REGISTER
- && REGNO_MODE_OK_FOR_BASE_P (regno, mode)
- && ! regno_clobbered_p (regno, this_insn))
- return 0;
-
- /* If we do not have one of the cases above, we must do the reload. */
- push_reload (ad, NULL_RTX, loc, NULL_PTR, reload_address_base_reg_class,
- GET_MODE (ad), VOIDmode, 0, 0, opnum, type);
- return 1;
- }
-
- if (strict_memory_address_p (mode, ad))
- {
- /* The address appears valid, so reloads are not needed.
- But the address may contain an eliminable register.
- This can happen because a machine with indirect addressing
- may consider a pseudo register by itself a valid address even when
- it has failed to get a hard reg.
- So do a tree-walk to find and eliminate all such regs. */
-
- /* But first quickly dispose of a common case. */
- if (GET_CODE (ad) == PLUS
- && GET_CODE (XEXP (ad, 1)) == CONST_INT
- && GET_CODE (XEXP (ad, 0)) == REG
- && reg_equiv_constant[REGNO (XEXP (ad, 0))] == 0)
- return 0;
-
- subst_reg_equivs_changed = 0;
- *loc = subst_reg_equivs (ad);
-
- if (! subst_reg_equivs_changed)
- return 0;
-
- /* Check result for validity after substitution. */
- if (strict_memory_address_p (mode, ad))
- return 0;
- }
-
- /* The address is not valid. We have to figure out why. One possibility
- is that it is itself a MEM. This can happen when the frame pointer is
- being eliminated, a pseudo is not allocated to a hard register, and the
- offset between the frame and stack pointers is not its initial value.
- In that case the pseudo will have been replaced by a MEM referring to
- the stack pointer. */
- if (GET_CODE (ad) == MEM)
- {
- /* First ensure that the address in this MEM is valid. Then, unless
- indirect addresses are valid, reload the MEM into a register. */
- tem = ad;
- find_reloads_address (GET_MODE (ad), &tem, XEXP (ad, 0), &XEXP (ad, 0),
- opnum, ADDR_TYPE (type),
- ind_levels == 0 ? 0 : ind_levels - 1, insn);
-
- /* If tem was changed, then we must create a new memory reference to
- hold it and store it back into memrefloc. */
- if (tem != ad && memrefloc)
- {
- *memrefloc = copy_rtx (*memrefloc);
- copy_replacements (tem, XEXP (*memrefloc, 0));
- loc = &XEXP (*memrefloc, 0);
- }
-
- /* Check similar cases as for indirect addresses as above except
- that we can allow pseudos and a MEM since they should have been
- taken care of above. */
-
- if (ind_levels == 0
- || (GET_CODE (XEXP (tem, 0)) == SYMBOL_REF && ! indirect_symref_ok)
- || GET_CODE (XEXP (tem, 0)) == MEM
- || ! (GET_CODE (XEXP (tem, 0)) == REG
- || (GET_CODE (XEXP (tem, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (tem, 0), 0)) == REG
- && GET_CODE (XEXP (XEXP (tem, 0), 1)) == CONST_INT)))
- {
- /* Must use TEM here, not AD, since it is the one that will
- have any subexpressions reloaded, if needed. */
- push_reload (tem, NULL_RTX, loc, NULL_PTR,
- reload_address_base_reg_class, GET_MODE (tem),
- VOIDmode, 0,
- 0, opnum, type);
- return 1;
- }
- else
- return 0;
- }
-
- /* If we have address of a stack slot but it's not valid because the
- displacement is too large, compute the sum in a register.
- Handle all base registers here, not just fp/ap/sp, because on some
- targets (namely SH) we can also get too large displacements from
- big-endian corrections. */
- else if (GET_CODE (ad) == PLUS
- && GET_CODE (XEXP (ad, 0)) == REG
- && REGNO (XEXP (ad, 0)) < FIRST_PSEUDO_REGISTER
- && REG_MODE_OK_FOR_BASE_P (XEXP (ad, 0), mode)
- && GET_CODE (XEXP (ad, 1)) == CONST_INT)
- {
- /* Unshare the MEM rtx so we can safely alter it. */
- if (memrefloc)
- {
- *memrefloc = copy_rtx (*memrefloc);
- loc = &XEXP (*memrefloc, 0);
- }
- if (double_reg_address_ok)
- {
- /* Unshare the sum as well. */
- *loc = ad = copy_rtx (ad);
- /* Reload the displacement into an index reg.
- We assume the frame pointer or arg pointer is a base reg. */
- find_reloads_address_part (XEXP (ad, 1), &XEXP (ad, 1),
- reload_address_index_reg_class,
- GET_MODE (ad), opnum, type, ind_levels);
- }
- else
- {
- /* If the sum of two regs is not necessarily valid,
- reload the sum into a base reg.
- That will at least work. */
- find_reloads_address_part (ad, loc, reload_address_base_reg_class,
- Pmode, opnum, type, ind_levels);
- }
- return 1;
- }
-
- /* If we have an indexed stack slot, there are three possible reasons why
- it might be invalid: The index might need to be reloaded, the address
- might have been made by frame pointer elimination and hence have a
- constant out of range, or both reasons might apply.
-
- We can easily check for an index needing reload, but even if that is the
- case, we might also have an invalid constant. To avoid making the
- conservative assumption and requiring two reloads, we see if this address
- is valid when not interpreted strictly. If it is, the only problem is
- that the index needs a reload and find_reloads_address_1 will take care
- of it.
-
- There is still a case when we might generate an extra reload,
- however. In certain cases eliminate_regs will return a MEM for a REG
- (see the code there for details). In those cases, memory_address_p
- applied to our address will return 0 so we will think that our offset
- must be too large. But it might indeed be valid and the only problem
- is that a MEM is present where a REG should be. This case should be
- very rare and there doesn't seem to be any way to avoid it.
-
- If we decide to do something here, it must be that
- `double_reg_address_ok' is true and that this address rtl was made by
- eliminate_regs. We generate a reload of the fp/sp/ap + constant and
- rework the sum so that the reload register will be added to the index.
- This is safe because we know the address isn't shared.
-
- We check for fp/ap/sp as both the first and second operand of the
- innermost PLUS. */
-
- else if (GET_CODE (ad) == PLUS && GET_CODE (XEXP (ad, 1)) == CONST_INT
- && GET_CODE (XEXP (ad, 0)) == PLUS
- && (XEXP (XEXP (ad, 0), 0) == frame_pointer_rtx
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- || XEXP (XEXP (ad, 0), 0) == hard_frame_pointer_rtx
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || XEXP (XEXP (ad, 0), 0) == arg_pointer_rtx
-#endif
- || XEXP (XEXP (ad, 0), 0) == stack_pointer_rtx)
- && ! memory_address_p (mode, ad))
- {
- *loc = ad = gen_rtx (PLUS, GET_MODE (ad),
- plus_constant (XEXP (XEXP (ad, 0), 0),
- INTVAL (XEXP (ad, 1))),
- XEXP (XEXP (ad, 0), 1));
- find_reloads_address_part (XEXP (ad, 0), &XEXP (ad, 0),
- reload_address_base_reg_class,
- GET_MODE (ad), opnum, type, ind_levels);
- find_reloads_address_1 (mode, XEXP (ad, 1), 1, &XEXP (ad, 1), opnum,
- type, 0, insn);
-
- return 1;
- }
-
- else if (GET_CODE (ad) == PLUS && GET_CODE (XEXP (ad, 1)) == CONST_INT
- && GET_CODE (XEXP (ad, 0)) == PLUS
- && (XEXP (XEXP (ad, 0), 1) == frame_pointer_rtx
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- || XEXP (XEXP (ad, 0), 1) == hard_frame_pointer_rtx
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || XEXP (XEXP (ad, 0), 1) == arg_pointer_rtx
-#endif
- || XEXP (XEXP (ad, 0), 1) == stack_pointer_rtx)
- && ! memory_address_p (mode, ad))
- {
- *loc = ad = gen_rtx (PLUS, GET_MODE (ad),
- XEXP (XEXP (ad, 0), 0),
- plus_constant (XEXP (XEXP (ad, 0), 1),
- INTVAL (XEXP (ad, 1))));
- find_reloads_address_part (XEXP (ad, 1), &XEXP (ad, 1),
- reload_address_base_reg_class,
- GET_MODE (ad), opnum, type, ind_levels);
- find_reloads_address_1 (mode, XEXP (ad, 0), 1, &XEXP (ad, 0), opnum,
- type, 0, insn);
-
- return 1;
- }
-
- /* See if address becomes valid when an eliminable register
- in a sum is replaced. */
-
- tem = ad;
- if (GET_CODE (ad) == PLUS)
- tem = subst_indexed_address (ad);
- if (tem != ad && strict_memory_address_p (mode, tem))
- {
- /* Ok, we win that way. Replace any additional eliminable
- registers. */
-
- subst_reg_equivs_changed = 0;
- tem = subst_reg_equivs (tem);
-
- /* Make sure that didn't make the address invalid again. */
-
- if (! subst_reg_equivs_changed || strict_memory_address_p (mode, tem))
- {
- *loc = tem;
- return 0;
- }
- }
-
- /* If constants aren't valid addresses, reload the constant address
- into a register. */
- if (CONSTANT_P (ad) && ! strict_memory_address_p (mode, ad))
- {
- /* If AD is in address in the constant pool, the MEM rtx may be shared.
- Unshare it so we can safely alter it. */
- if (memrefloc && GET_CODE (ad) == SYMBOL_REF
- && CONSTANT_POOL_ADDRESS_P (ad))
- {
- *memrefloc = copy_rtx (*memrefloc);
- loc = &XEXP (*memrefloc, 0);
- }
-
- find_reloads_address_part (ad, loc, reload_address_base_reg_class,
- Pmode, opnum, type,
- ind_levels);
- return 1;
- }
-
- return find_reloads_address_1 (mode, ad, 0, loc, opnum, type, ind_levels,
- insn);
-}
-
-/* Find all pseudo regs appearing in AD
- that are eliminable in favor of equivalent values
- and do not have hard regs; replace them by their equivalents. */
-
-static rtx
-subst_reg_equivs (ad)
- rtx ad;
-{
- register RTX_CODE code = GET_CODE (ad);
- register int i;
- register char *fmt;
-
- switch (code)
- {
- case HIGH:
- case CONST_INT:
- case CONST:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- case PC:
- case CC0:
- return ad;
-
- case REG:
- {
- register int regno = REGNO (ad);
-
- if (reg_equiv_constant[regno] != 0)
- {
- subst_reg_equivs_changed = 1;
- return reg_equiv_constant[regno];
- }
- }
- return ad;
-
- case PLUS:
- /* Quickly dispose of a common case. */
- if (XEXP (ad, 0) == frame_pointer_rtx
- && GET_CODE (XEXP (ad, 1)) == CONST_INT)
- return ad;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- XEXP (ad, i) = subst_reg_equivs (XEXP (ad, i));
- return ad;
-}
-
-/* Compute the sum of X and Y, making canonicalizations assumed in an
- address, namely: sum constant integers, surround the sum of two
- constants with a CONST, put the constant as the second operand, and
- group the constant on the outermost sum.
-
- This routine assumes both inputs are already in canonical form. */
-
-rtx
-form_sum (x, y)
- rtx x, y;
-{
- rtx tem;
- enum machine_mode mode = GET_MODE (x);
-
- if (mode == VOIDmode)
- mode = GET_MODE (y);
-
- if (mode == VOIDmode)
- mode = Pmode;
-
- if (GET_CODE (x) == CONST_INT)
- return plus_constant (y, INTVAL (x));
- else if (GET_CODE (y) == CONST_INT)
- return plus_constant (x, INTVAL (y));
- else if (CONSTANT_P (x))
- tem = x, x = y, y = tem;
-
- if (GET_CODE (x) == PLUS && CONSTANT_P (XEXP (x, 1)))
- return form_sum (XEXP (x, 0), form_sum (XEXP (x, 1), y));
-
- /* Note that if the operands of Y are specified in the opposite
- order in the recursive calls below, infinite recursion will occur. */
- if (GET_CODE (y) == PLUS && CONSTANT_P (XEXP (y, 1)))
- return form_sum (form_sum (x, XEXP (y, 0)), XEXP (y, 1));
-
- /* If both constant, encapsulate sum. Otherwise, just form sum. A
- constant will have been placed second. */
- if (CONSTANT_P (x) && CONSTANT_P (y))
- {
- if (GET_CODE (x) == CONST)
- x = XEXP (x, 0);
- if (GET_CODE (y) == CONST)
- y = XEXP (y, 0);
-
- return gen_rtx (CONST, VOIDmode, gen_rtx (PLUS, mode, x, y));
- }
-
- return gen_rtx (PLUS, mode, x, y);
-}
-
-/* If ADDR is a sum containing a pseudo register that should be
- replaced with a constant (from reg_equiv_constant),
- return the result of doing so, and also apply the associative
- law so that the result is more likely to be a valid address.
- (But it is not guaranteed to be one.)
-
- Note that at most one register is replaced, even if more are
- replaceable. Also, we try to put the result into a canonical form
- so it is more likely to be a valid address.
-
- In all other cases, return ADDR. */
-
-static rtx
-subst_indexed_address (addr)
- rtx addr;
-{
- rtx op0 = 0, op1 = 0, op2 = 0;
- rtx tem;
- int regno;
-
- if (GET_CODE (addr) == PLUS)
- {
- /* Try to find a register to replace. */
- op0 = XEXP (addr, 0), op1 = XEXP (addr, 1), op2 = 0;
- if (GET_CODE (op0) == REG
- && (regno = REGNO (op0)) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0)
- op0 = reg_equiv_constant[regno];
- else if (GET_CODE (op1) == REG
- && (regno = REGNO (op1)) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0)
- op1 = reg_equiv_constant[regno];
- else if (GET_CODE (op0) == PLUS
- && (tem = subst_indexed_address (op0)) != op0)
- op0 = tem;
- else if (GET_CODE (op1) == PLUS
- && (tem = subst_indexed_address (op1)) != op1)
- op1 = tem;
- else
- return addr;
-
- /* Pick out up to three things to add. */
- if (GET_CODE (op1) == PLUS)
- op2 = XEXP (op1, 1), op1 = XEXP (op1, 0);
- else if (GET_CODE (op0) == PLUS)
- op2 = op1, op1 = XEXP (op0, 1), op0 = XEXP (op0, 0);
-
- /* Compute the sum. */
- if (op2 != 0)
- op1 = form_sum (op1, op2);
- if (op1 != 0)
- op0 = form_sum (op0, op1);
-
- return op0;
- }
- return addr;
-}
-
-/* Record the pseudo registers we must reload into hard registers in a
- subexpression of a would-be memory address, X referring to a value
- in mode MODE. (This function is not called if the address we find
- is strictly valid.)
-
- CONTEXT = 1 means we are considering regs as index regs,
- = 0 means we are considering them as base regs.
-
- OPNUM and TYPE specify the purpose of any reloads made.
-
- IND_LEVELS says how many levels of indirect addressing are
- supported at this point in the address.
-
- INSN, if nonzero, is the insn in which we do the reload. It is used
- to determine if we may generate output reloads.
-
- We return nonzero if X, as a whole, is reloaded or replaced. */
-
-/* Note that we take shortcuts assuming that no multi-reg machine mode
- occurs as part of an address.
- Also, this is not fully machine-customizable; it works for machines
- such as vaxes and 68000's and 32000's, but other possible machines
- could have addressing modes that this does not handle right. */
-
-static int
-find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
- enum machine_mode mode;
- rtx x;
- int context;
- rtx *loc;
- int opnum;
- enum reload_type type;
- int ind_levels;
- rtx insn;
-{
- register RTX_CODE code = GET_CODE (x);
-
- switch (code)
- {
- case PLUS:
- {
- register rtx orig_op0 = XEXP (x, 0);
- register rtx orig_op1 = XEXP (x, 1);
- register RTX_CODE code0 = GET_CODE (orig_op0);
- register RTX_CODE code1 = GET_CODE (orig_op1);
- register rtx op0 = orig_op0;
- register rtx op1 = orig_op1;
-
- if (GET_CODE (op0) == SUBREG)
- {
- op0 = SUBREG_REG (op0);
- code0 = GET_CODE (op0);
- if (code0 == REG && REGNO (op0) < FIRST_PSEUDO_REGISTER)
- op0 = gen_rtx (REG, word_mode,
- REGNO (op0) + SUBREG_WORD (orig_op0));
- }
-
- if (GET_CODE (op1) == SUBREG)
- {
- op1 = SUBREG_REG (op1);
- code1 = GET_CODE (op1);
- if (code1 == REG && REGNO (op1) < FIRST_PSEUDO_REGISTER)
- op1 = gen_rtx (REG, GET_MODE (op1),
- REGNO (op1) + SUBREG_WORD (orig_op1));
- }
-
- if (code0 == MULT || code0 == SIGN_EXTEND || code0 == TRUNCATE
- || code0 == ZERO_EXTEND || code1 == MEM)
- {
- find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum,
- type, ind_levels, insn);
- find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
- type, ind_levels, insn);
- }
-
- else if (code1 == MULT || code1 == SIGN_EXTEND || code1 == TRUNCATE
- || code1 == ZERO_EXTEND || code0 == MEM)
- {
- find_reloads_address_1 (mode, orig_op0, 0, &XEXP (x, 0), opnum,
- type, ind_levels, insn);
- find_reloads_address_1 (mode, orig_op1, 1, &XEXP (x, 1), opnum,
- type, ind_levels, insn);
- }
-
- else if (code0 == CONST_INT || code0 == CONST
- || code0 == SYMBOL_REF || code0 == LABEL_REF)
- find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
- type, ind_levels, insn);
-
- else if (code1 == CONST_INT || code1 == CONST
- || code1 == SYMBOL_REF || code1 == LABEL_REF)
- find_reloads_address_1 (mode, orig_op0, 0, &XEXP (x, 0), opnum,
- type, ind_levels, insn);
-
- else if (code0 == REG && code1 == REG)
- {
- if (REG_OK_FOR_INDEX_P (op0)
- && REG_MODE_OK_FOR_BASE_P (op1, mode))
- return 0;
- else if (REG_OK_FOR_INDEX_P (op1)
- && REG_MODE_OK_FOR_BASE_P (op0, mode))
- return 0;
- else if (REG_MODE_OK_FOR_BASE_P (op1, mode))
- find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum,
- type, ind_levels, insn);
- else if (REG_MODE_OK_FOR_BASE_P (op0, mode))
- find_reloads_address_1 (mode, orig_op1, 1, &XEXP (x, 1), opnum,
- type, ind_levels, insn);
- else if (REG_OK_FOR_INDEX_P (op1))
- find_reloads_address_1 (mode, orig_op0, 0, &XEXP (x, 0), opnum,
- type, ind_levels, insn);
- else if (REG_OK_FOR_INDEX_P (op0))
- find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
- type, ind_levels, insn);
- else
- {
- find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum,
- type, ind_levels, insn);
- find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
- type, ind_levels, insn);
- }
- }
-
- else if (code0 == REG)
- {
- find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum,
- type, ind_levels, insn);
- find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
- type, ind_levels, insn);
- }
-
- else if (code1 == REG)
- {
- find_reloads_address_1 (mode, orig_op1, 1, &XEXP (x, 1), opnum,
- type, ind_levels, insn);
- find_reloads_address_1 (mode, orig_op0, 0, &XEXP (x, 0), opnum,
- type, ind_levels, insn);
- }
- }
-
- return 0;
-
- case POST_INC:
- case POST_DEC:
- case PRE_INC:
- case PRE_DEC:
- if (GET_CODE (XEXP (x, 0)) == REG)
- {
- register int regno = REGNO (XEXP (x, 0));
- int value = 0;
- rtx x_orig = x;
-
- /* A register that is incremented cannot be constant! */
- if (regno >= FIRST_PSEUDO_REGISTER
- && reg_equiv_constant[regno] != 0)
- abort ();
-
- /* Handle a register that is equivalent to a memory location
- which cannot be addressed directly. */
- if (reg_equiv_address[regno] != 0)
- {
- rtx tem = make_memloc (XEXP (x, 0), regno);
- /* First reload the memory location's address.
- We can't use ADDR_TYPE (type) here, because we need to
- write back the value after reading it, hence we actually
- need two registers. */
- find_reloads_address (GET_MODE (tem), 0, XEXP (tem, 0),
- &XEXP (tem, 0), opnum, type,
- ind_levels, insn);
- /* Put this inside a new increment-expression. */
- x = gen_rtx (GET_CODE (x), GET_MODE (x), tem);
- /* Proceed to reload that, as if it contained a register. */
- }
-
- /* If we have a hard register that is ok as an index,
- don't make a reload. If an autoincrement of a nice register
- isn't "valid", it must be that no autoincrement is "valid".
- If that is true and something made an autoincrement anyway,
- this must be a special context where one is allowed.
- (For example, a "push" instruction.)
- We can't improve this address, so leave it alone. */
-
- /* Otherwise, reload the autoincrement into a suitable hard reg
- and record how much to increment by. */
-
- if (reg_renumber[regno] >= 0)
- regno = reg_renumber[regno];
- if ((regno >= FIRST_PSEUDO_REGISTER
- || !(context ? REGNO_OK_FOR_INDEX_P (regno)
- : REGNO_MODE_OK_FOR_BASE_P (regno, mode))))
- {
- register rtx link;
- int reloadnum;
-
- /* If we can output the register afterwards, do so, this
- saves the extra update.
- We can do so if we have an INSN - i.e. no JUMP_INSN nor
- CALL_INSN - and it does not set CC0.
- But don't do this if we cannot directly address the
- memory location, since this will make it harder to
- reuse address reloads, and increses register pressure.
- Also don't do this if we can probably update x directly. */
- rtx equiv = reg_equiv_mem[regno];
- int icode = (int) add_optab->handlers[(int) Pmode].insn_code;
- if (insn && GET_CODE (insn) == INSN && equiv
-#ifdef HAVE_cc0
- && ! sets_cc0_p (PATTERN (insn))
-#endif
- && ! (icode != CODE_FOR_nothing
- && (*insn_operand_predicate[icode][0]) (equiv, Pmode)
- && (*insn_operand_predicate[icode][1]) (equiv, Pmode)))
- {
- loc = &XEXP (x, 0);
- x = XEXP (x, 0);
- reloadnum
- = push_reload (x, x, loc, loc,
- (context
- ? reload_address_index_reg_class
- : reload_address_base_reg_class),
- GET_MODE (x), GET_MODE (x), VOIDmode, 0,
- opnum, RELOAD_OTHER);
- }
- else
- {
- reloadnum
- = push_reload (x, NULL_RTX, loc, NULL_PTR,
- (context
- ? reload_address_index_reg_class
- : reload_address_base_reg_class),
- GET_MODE (x), GET_MODE (x), VOIDmode, 0,
- opnum, type);
- reload_inc[reloadnum]
- = find_inc_amount (PATTERN (this_insn), XEXP (x_orig, 0));
-
- value = 1;
- }
-
-#ifdef AUTO_INC_DEC
- /* Update the REG_INC notes. */
-
- for (link = REG_NOTES (this_insn);
- link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC
- && REGNO (XEXP (link, 0)) == REGNO (XEXP (x_orig, 0)))
- push_replacement (&XEXP (link, 0), reloadnum, VOIDmode);
-#endif
- }
- return value;
- }
-
- else if (GET_CODE (XEXP (x, 0)) == MEM)
- {
- /* This is probably the result of a substitution, by eliminate_regs,
- of an equivalent address for a pseudo that was not allocated to a
- hard register. Verify that the specified address is valid and
- reload it into a register. */
- rtx tem = XEXP (x, 0);
- register rtx link;
- int reloadnum;
-
- /* Since we know we are going to reload this item, don't decrement
- for the indirection level.
-
- Note that this is actually conservative: it would be slightly
- more efficient to use the value of SPILL_INDIRECT_LEVELS from
- reload1.c here. */
- /* We can't use ADDR_TYPE (type) here, because we need to
- write back the value after reading it, hence we actually
- need two registers. */
- find_reloads_address (GET_MODE (x), &XEXP (x, 0),
- XEXP (XEXP (x, 0), 0), &XEXP (XEXP (x, 0), 0),
- opnum, type, ind_levels, insn);
-
- reloadnum = push_reload (x, NULL_RTX, loc, NULL_PTR,
- (context
- ? reload_address_index_reg_class
- : reload_address_base_reg_class),
- GET_MODE (x), VOIDmode, 0, 0, opnum, type);
- reload_inc[reloadnum]
- = find_inc_amount (PATTERN (this_insn), XEXP (x, 0));
-
- link = FIND_REG_INC_NOTE (this_insn, tem);
- if (link != 0)
- push_replacement (&XEXP (link, 0), reloadnum, VOIDmode);
-
- return 1;
- }
- return 0;
-
- case MEM:
- /* This is probably the result of a substitution, by eliminate_regs, of
- an equivalent address for a pseudo that was not allocated to a hard
- register. Verify that the specified address is valid and reload it
- into a register.
-
- Since we know we are going to reload this item, don't decrement for
- the indirection level.
-
- Note that this is actually conservative: it would be slightly more
- efficient to use the value of SPILL_INDIRECT_LEVELS from
- reload1.c here. */
-
- find_reloads_address (GET_MODE (x), loc, XEXP (x, 0), &XEXP (x, 0),
- opnum, ADDR_TYPE (type), ind_levels, insn);
- push_reload (*loc, NULL_RTX, loc, NULL_PTR,
- (context ? reload_address_index_reg_class
- : reload_address_base_reg_class),
- GET_MODE (x), VOIDmode, 0, 0, opnum, type);
- return 1;
-
- case REG:
- {
- register int regno = REGNO (x);
-
- if (reg_equiv_constant[regno] != 0)
- {
- find_reloads_address_part (reg_equiv_constant[regno], loc,
- (context
- ? reload_address_index_reg_class
- : reload_address_base_reg_class),
- GET_MODE (x), opnum, type, ind_levels);
- return 1;
- }
-
-#if 0 /* This might screw code in reload1.c to delete prior output-reload
- that feeds this insn. */
- if (reg_equiv_mem[regno] != 0)
- {
- push_reload (reg_equiv_mem[regno], NULL_RTX, loc, NULL_PTR,
- (context
- ? reload_address_index_reg_class
- : reload_address_base_reg_class),
- GET_MODE (x), VOIDmode, 0, 0, opnum, type);
- return 1;
- }
-#endif
-
- if (reg_equiv_address[regno] != 0)
- {
- x = make_memloc (x, regno);
- find_reloads_address (GET_MODE (x), 0, XEXP (x, 0), &XEXP (x, 0),
- opnum, ADDR_TYPE (type), ind_levels, insn);
- }
-
- if (reg_renumber[regno] >= 0)
- regno = reg_renumber[regno];
-
- if ((regno >= FIRST_PSEUDO_REGISTER
- || !(context ? REGNO_OK_FOR_INDEX_P (regno)
- : REGNO_MODE_OK_FOR_BASE_P (regno, mode))))
- {
- push_reload (x, NULL_RTX, loc, NULL_PTR,
- (context
- ? reload_address_index_reg_class
- : reload_address_base_reg_class),
- GET_MODE (x), VOIDmode, 0, 0, opnum, type);
- return 1;
- }
-
- /* If a register appearing in an address is the subject of a CLOBBER
- in this insn, reload it into some other register to be safe.
- The CLOBBER is supposed to make the register unavailable
- from before this insn to after it. */
- if (regno_clobbered_p (regno, this_insn))
- {
- push_reload (x, NULL_RTX, loc, NULL_PTR,
- (context
- ? reload_address_index_reg_class
- : reload_address_base_reg_class),
- GET_MODE (x), VOIDmode, 0, 0, opnum, type);
- return 1;
- }
- }
- return 0;
-
- case SUBREG:
- if (GET_CODE (SUBREG_REG (x)) == REG)
- {
- /* If this is a SUBREG of a hard register and the resulting register
- is of the wrong class, reload the whole SUBREG. This avoids
- needless copies if SUBREG_REG is multi-word. */
- if (REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
- {
- int regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x);
-
- if (! (context ? REGNO_OK_FOR_INDEX_P (regno)
- : REGNO_MODE_OK_FOR_BASE_P (regno, mode)))
- {
- push_reload (x, NULL_RTX, loc, NULL_PTR,
- (context
- ? reload_address_index_reg_class
- : reload_address_base_reg_class),
- GET_MODE (x), VOIDmode, 0, 0, opnum, type);
- return 1;
- }
- }
- /* If this is a SUBREG of a pseudo-register, and the pseudo-register
- is larger than the class size, then reload the whole SUBREG. */
- else
- {
- enum reg_class class = (context
- ? reload_address_index_reg_class
- : reload_address_base_reg_class);
- if (CLASS_MAX_NREGS (class, GET_MODE (SUBREG_REG (x)))
- > reg_class_size[class])
- {
- push_reload (x, NULL_RTX, loc, NULL_PTR, class,
- GET_MODE (x), VOIDmode, 0, 0, opnum, type);
- return 1;
- }
- }
- }
- break;
- }
-
- {
- register char *fmt = GET_RTX_FORMAT (code);
- register int i;
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- find_reloads_address_1 (mode, XEXP (x, i), context, &XEXP (x, i),
- opnum, type, ind_levels, insn);
- }
- }
-
- return 0;
-}
-
-/* X, which is found at *LOC, is a part of an address that needs to be
- reloaded into a register of class CLASS. If X is a constant, or if
- X is a PLUS that contains a constant, check that the constant is a
- legitimate operand and that we are supposed to be able to load
- it into the register.
-
- If not, force the constant into memory and reload the MEM instead.
-
- MODE is the mode to use, in case X is an integer constant.
-
- OPNUM and TYPE describe the purpose of any reloads made.
-
- IND_LEVELS says how many levels of indirect addressing this machine
- supports. */
-
-static void
-find_reloads_address_part (x, loc, class, mode, opnum, type, ind_levels)
- rtx x;
- rtx *loc;
- enum reg_class class;
- enum machine_mode mode;
- int opnum;
- enum reload_type type;
- int ind_levels;
-{
- if (CONSTANT_P (x)
- && (! LEGITIMATE_CONSTANT_P (x)
- || PREFERRED_RELOAD_CLASS (x, class) == NO_REGS))
- {
- rtx tem = x = force_const_mem (mode, x);
- find_reloads_address (mode, &tem, XEXP (tem, 0), &XEXP (tem, 0),
- opnum, type, ind_levels, 0);
- }
-
- else if (GET_CODE (x) == PLUS
- && CONSTANT_P (XEXP (x, 1))
- && (! LEGITIMATE_CONSTANT_P (XEXP (x, 1))
- || PREFERRED_RELOAD_CLASS (XEXP (x, 1), class) == NO_REGS))
- {
- rtx tem = force_const_mem (GET_MODE (x), XEXP (x, 1));
-
- x = gen_rtx (PLUS, GET_MODE (x), XEXP (x, 0), tem);
- find_reloads_address (mode, &tem, XEXP (tem, 0), &XEXP (tem, 0),
- opnum, type, ind_levels, 0);
- }
-
- push_reload (x, NULL_RTX, loc, NULL_PTR, class,
- mode, VOIDmode, 0, 0, opnum, type);
-}
-
-/* Substitute into the current INSN the registers into which we have reloaded
- the things that need reloading. The array `replacements'
- says contains the locations of all pointers that must be changed
- and says what to replace them with.
-
- Return the rtx that X translates into; usually X, but modified. */
-
-void
-subst_reloads ()
-{
- register int i;
-
- for (i = 0; i < n_replacements; i++)
- {
- register struct replacement *r = &replacements[i];
- register rtx reloadreg = reload_reg_rtx[r->what];
- if (reloadreg)
- {
- /* Encapsulate RELOADREG so its machine mode matches what
- used to be there. Note that gen_lowpart_common will
- do the wrong thing if RELOADREG is multi-word. RELOADREG
- will always be a REG here. */
- if (GET_MODE (reloadreg) != r->mode && r->mode != VOIDmode)
- reloadreg = gen_rtx (REG, r->mode, REGNO (reloadreg));
-
- /* If we are putting this into a SUBREG and RELOADREG is a
- SUBREG, we would be making nested SUBREGs, so we have to fix
- this up. Note that r->where == &SUBREG_REG (*r->subreg_loc). */
-
- if (r->subreg_loc != 0 && GET_CODE (reloadreg) == SUBREG)
- {
- if (GET_MODE (*r->subreg_loc)
- == GET_MODE (SUBREG_REG (reloadreg)))
- *r->subreg_loc = SUBREG_REG (reloadreg);
- else
- {
- *r->where = SUBREG_REG (reloadreg);
- SUBREG_WORD (*r->subreg_loc) += SUBREG_WORD (reloadreg);
- }
- }
- else
- *r->where = reloadreg;
- }
- /* If reload got no reg and isn't optional, something's wrong. */
- else if (! reload_optional[r->what])
- abort ();
- }
-}
-
-/* Make a copy of any replacements being done into X and move those copies
- to locations in Y, a copy of X. We only look at the highest level of
- the RTL. */
-
-void
-copy_replacements (x, y)
- rtx x;
- rtx y;
-{
- int i, j;
- enum rtx_code code = GET_CODE (x);
- char *fmt = GET_RTX_FORMAT (code);
- struct replacement *r;
-
- /* We can't support X being a SUBREG because we might then need to know its
- location if something inside it was replaced. */
- if (code == SUBREG)
- abort ();
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- for (j = 0; j < n_replacements; j++)
- {
- if (replacements[j].subreg_loc == &XEXP (x, i))
- {
- r = &replacements[n_replacements++];
- r->where = replacements[j].where;
- r->subreg_loc = &XEXP (y, i);
- r->what = replacements[j].what;
- r->mode = replacements[j].mode;
- }
- else if (replacements[j].where == &XEXP (x, i))
- {
- r = &replacements[n_replacements++];
- r->where = &XEXP (y, i);
- r->subreg_loc = 0;
- r->what = replacements[j].what;
- r->mode = replacements[j].mode;
- }
- }
-}
-
-/* If LOC was scheduled to be replaced by something, return the replacement.
- Otherwise, return *LOC. */
-
-rtx
-find_replacement (loc)
- rtx *loc;
-{
- struct replacement *r;
-
- for (r = &replacements[0]; r < &replacements[n_replacements]; r++)
- {
- rtx reloadreg = reload_reg_rtx[r->what];
-
- if (reloadreg && r->where == loc)
- {
- if (r->mode != VOIDmode && GET_MODE (reloadreg) != r->mode)
- reloadreg = gen_rtx (REG, r->mode, REGNO (reloadreg));
-
- return reloadreg;
- }
- else if (reloadreg && r->subreg_loc == loc)
- {
- /* RELOADREG must be either a REG or a SUBREG.
-
- ??? Is it actually still ever a SUBREG? If so, why? */
-
- if (GET_CODE (reloadreg) == REG)
- return gen_rtx (REG, GET_MODE (*loc),
- REGNO (reloadreg) + SUBREG_WORD (*loc));
- else if (GET_MODE (reloadreg) == GET_MODE (*loc))
- return reloadreg;
- else
- return gen_rtx (SUBREG, GET_MODE (*loc), SUBREG_REG (reloadreg),
- SUBREG_WORD (reloadreg) + SUBREG_WORD (*loc));
- }
- }
-
- return *loc;
-}
-
-/* Return nonzero if register in range [REGNO, ENDREGNO)
- appears either explicitly or implicitly in X
- other than being stored into (except for earlyclobber operands).
-
- References contained within the substructure at LOC do not count.
- LOC may be zero, meaning don't ignore anything.
-
- This is similar to refers_to_regno_p in rtlanal.c except that we
- look at equivalences for pseudos that didn't get hard registers. */
-
-int
-refers_to_regno_for_reload_p (regno, endregno, x, loc)
- int regno, endregno;
- rtx x;
- rtx *loc;
-{
- register int i;
- register RTX_CODE code;
- register char *fmt;
-
- if (x == 0)
- return 0;
-
- repeat:
- code = GET_CODE (x);
-
- switch (code)
- {
- case REG:
- i = REGNO (x);
-
- /* If this is a pseudo, a hard register must not have been allocated.
- X must therefore either be a constant or be in memory. */
- if (i >= FIRST_PSEUDO_REGISTER)
- {
- if (reg_equiv_memory_loc[i])
- return refers_to_regno_for_reload_p (regno, endregno,
- reg_equiv_memory_loc[i],
- NULL_PTR);
-
- if (reg_equiv_constant[i])
- return 0;
-
- abort ();
- }
-
- return (endregno > i
- && regno < i + (i < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (i, GET_MODE (x))
- : 1));
-
- case SUBREG:
- /* If this is a SUBREG of a hard reg, we can see exactly which
- registers are being modified. Otherwise, handle normally. */
- if (GET_CODE (SUBREG_REG (x)) == REG
- && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
- {
- int inner_regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x);
- int inner_endregno
- = inner_regno + (inner_regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
-
- return endregno > inner_regno && regno < inner_endregno;
- }
- break;
-
- case CLOBBER:
- case SET:
- if (&SET_DEST (x) != loc
- /* Note setting a SUBREG counts as referring to the REG it is in for
- a pseudo but not for hard registers since we can
- treat each word individually. */
- && ((GET_CODE (SET_DEST (x)) == SUBREG
- && loc != &SUBREG_REG (SET_DEST (x))
- && GET_CODE (SUBREG_REG (SET_DEST (x))) == REG
- && REGNO (SUBREG_REG (SET_DEST (x))) >= FIRST_PSEUDO_REGISTER
- && refers_to_regno_for_reload_p (regno, endregno,
- SUBREG_REG (SET_DEST (x)),
- loc))
- /* If the output is an earlyclobber operand, this is
- a conflict. */
- || ((GET_CODE (SET_DEST (x)) != REG
- || earlyclobber_operand_p (SET_DEST (x)))
- && refers_to_regno_for_reload_p (regno, endregno,
- SET_DEST (x), loc))))
- return 1;
-
- if (code == CLOBBER || loc == &SET_SRC (x))
- return 0;
- x = SET_SRC (x);
- goto repeat;
- }
-
- /* X does not match, so try its subexpressions. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e' && loc != &XEXP (x, i))
- {
- if (i == 0)
- {
- x = XEXP (x, 0);
- goto repeat;
- }
- else
- if (refers_to_regno_for_reload_p (regno, endregno,
- XEXP (x, i), loc))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >=0; j--)
- if (loc != &XVECEXP (x, i, j)
- && refers_to_regno_for_reload_p (regno, endregno,
- XVECEXP (x, i, j), loc))
- return 1;
- }
- }
- return 0;
-}
-
-/* Nonzero if modifying X will affect IN. If X is a register or a SUBREG,
- we check if any register number in X conflicts with the relevant register
- numbers. If X is a constant, return 0. If X is a MEM, return 1 iff IN
- contains a MEM (we don't bother checking for memory addresses that can't
- conflict because we expect this to be a rare case.
-
- This function is similar to reg_overlap_mention_p in rtlanal.c except
- that we look at equivalences for pseudos that didn't get hard registers. */
-
-int
-reg_overlap_mentioned_for_reload_p (x, in)
- rtx x, in;
-{
- int regno, endregno;
-
- if (GET_CODE (x) == SUBREG)
- {
- regno = REGNO (SUBREG_REG (x));
- if (regno < FIRST_PSEUDO_REGISTER)
- regno += SUBREG_WORD (x);
- }
- else if (GET_CODE (x) == REG)
- {
- regno = REGNO (x);
-
- /* If this is a pseudo, it must not have been assigned a hard register.
- Therefore, it must either be in memory or be a constant. */
-
- if (regno >= FIRST_PSEUDO_REGISTER)
- {
- if (reg_equiv_memory_loc[regno])
- return refers_to_mem_for_reload_p (in);
- else if (reg_equiv_constant[regno])
- return 0;
- abort ();
- }
- }
- else if (CONSTANT_P (x))
- return 0;
- else if (GET_CODE (x) == MEM)
- return refers_to_mem_for_reload_p (in);
- else if (GET_CODE (x) == SCRATCH || GET_CODE (x) == PC
- || GET_CODE (x) == CC0)
- return reg_mentioned_p (x, in);
- else
- abort ();
-
- endregno = regno + (regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
-
- return refers_to_regno_for_reload_p (regno, endregno, in, NULL_PTR);
-}
-
-/* Return nonzero if anything in X contains a MEM. Look also for pseudo
- registers. */
-
-int
-refers_to_mem_for_reload_p (x)
- rtx x;
-{
- char *fmt;
- int i;
-
- if (GET_CODE (x) == MEM)
- return 1;
-
- if (GET_CODE (x) == REG)
- return (REGNO (x) >= FIRST_PSEUDO_REGISTER
- && reg_equiv_memory_loc[REGNO (x)]);
-
- fmt = GET_RTX_FORMAT (GET_CODE (x));
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
- if (fmt[i] == 'e'
- && (GET_CODE (XEXP (x, i)) == MEM
- || refers_to_mem_for_reload_p (XEXP (x, i))))
- return 1;
-
- return 0;
-}
-
-/* Check the insns before INSN to see if there is a suitable register
- containing the same value as GOAL.
- If OTHER is -1, look for a register in class CLASS.
- Otherwise, just see if register number OTHER shares GOAL's value.
-
- Return an rtx for the register found, or zero if none is found.
-
- If RELOAD_REG_P is (short *)1,
- we reject any hard reg that appears in reload_reg_rtx
- because such a hard reg is also needed coming into this insn.
-
- If RELOAD_REG_P is any other nonzero value,
- it is a vector indexed by hard reg number
- and we reject any hard reg whose element in the vector is nonnegative
- as well as any that appears in reload_reg_rtx.
-
- If GOAL is zero, then GOALREG is a register number; we look
- for an equivalent for that register.
-
- MODE is the machine mode of the value we want an equivalence for.
- If GOAL is nonzero and not VOIDmode, then it must have mode MODE.
-
- This function is used by jump.c as well as in the reload pass.
-
- If GOAL is the sum of the stack pointer and a constant, we treat it
- as if it were a constant except that sp is required to be unchanging. */
-
-rtx
-find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode)
- register rtx goal;
- rtx insn;
- enum reg_class class;
- register int other;
- short *reload_reg_p;
- int goalreg;
- enum machine_mode mode;
-{
- register rtx p = insn;
- rtx goaltry, valtry, value, where;
- register rtx pat;
- register int regno = -1;
- int valueno;
- int goal_mem = 0;
- int goal_const = 0;
- int goal_mem_addr_varies = 0;
- int need_stable_sp = 0;
- int nregs;
- int valuenregs;
-
- if (goal == 0)
- regno = goalreg;
- else if (GET_CODE (goal) == REG)
- regno = REGNO (goal);
- else if (GET_CODE (goal) == MEM)
- {
- enum rtx_code code = GET_CODE (XEXP (goal, 0));
- if (MEM_VOLATILE_P (goal))
- return 0;
- if (flag_float_store && GET_MODE_CLASS (GET_MODE (goal)) == MODE_FLOAT)
- return 0;
- /* An address with side effects must be reexecuted. */
- switch (code)
- {
- case POST_INC:
- case PRE_INC:
- case POST_DEC:
- case PRE_DEC:
- return 0;
- }
- goal_mem = 1;
- }
- else if (CONSTANT_P (goal))
- goal_const = 1;
- else if (GET_CODE (goal) == PLUS
- && XEXP (goal, 0) == stack_pointer_rtx
- && CONSTANT_P (XEXP (goal, 1)))
- goal_const = need_stable_sp = 1;
- else
- return 0;
-
- /* On some machines, certain regs must always be rejected
- because they don't behave the way ordinary registers do. */
-
-#ifdef OVERLAPPING_REGNO_P
- if (regno >= 0 && regno < FIRST_PSEUDO_REGISTER
- && OVERLAPPING_REGNO_P (regno))
- return 0;
-#endif
-
- /* Scan insns back from INSN, looking for one that copies
- a value into or out of GOAL.
- Stop and give up if we reach a label. */
-
- while (1)
- {
- p = PREV_INSN (p);
- if (p == 0 || GET_CODE (p) == CODE_LABEL)
- return 0;
- if (GET_CODE (p) == INSN
- /* If we don't want spill regs ... */
- && (! (reload_reg_p != 0
- && reload_reg_p != (short *) (HOST_WIDE_INT) 1)
- /* ... then ignore insns introduced by reload; they aren't useful
- and can cause results in reload_as_needed to be different
- from what they were when calculating the need for spills.
- If we notice an input-reload insn here, we will reject it below,
- but it might hide a usable equivalent. That makes bad code.
- It may even abort: perhaps no reg was spilled for this insn
- because it was assumed we would find that equivalent. */
- || INSN_UID (p) < reload_first_uid))
- {
- rtx tem;
- pat = single_set (p);
- /* First check for something that sets some reg equal to GOAL. */
- if (pat != 0
- && ((regno >= 0
- && true_regnum (SET_SRC (pat)) == regno
- && (valueno = true_regnum (valtry = SET_DEST (pat))) >= 0)
- ||
- (regno >= 0
- && true_regnum (SET_DEST (pat)) == regno
- && (valueno = true_regnum (valtry = SET_SRC (pat))) >= 0)
- ||
- (goal_const && rtx_equal_p (SET_SRC (pat), goal)
- && (valueno = true_regnum (valtry = SET_DEST (pat))) >= 0)
- || (goal_mem
- && (valueno = true_regnum (valtry = SET_DEST (pat))) >= 0
- && rtx_renumbered_equal_p (goal, SET_SRC (pat)))
- || (goal_mem
- && (valueno = true_regnum (valtry = SET_SRC (pat))) >= 0
- && rtx_renumbered_equal_p (goal, SET_DEST (pat)))
- /* If we are looking for a constant,
- and something equivalent to that constant was copied
- into a reg, we can use that reg. */
- || (goal_const && (tem = find_reg_note (p, REG_EQUIV,
- NULL_RTX))
- && rtx_equal_p (XEXP (tem, 0), goal)
- && (valueno = true_regnum (valtry = SET_DEST (pat))) >= 0)
- || (goal_const && (tem = find_reg_note (p, REG_EQUIV,
- NULL_RTX))
- && GET_CODE (SET_DEST (pat)) == REG
- && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (XEXP (tem, 0))) == MODE_FLOAT
- && GET_CODE (goal) == CONST_INT
- && 0 != (goaltry = operand_subword (XEXP (tem, 0), 0, 0,
- VOIDmode))
- && rtx_equal_p (goal, goaltry)
- && (valtry = operand_subword (SET_DEST (pat), 0, 0,
- VOIDmode))
- && (valueno = true_regnum (valtry)) >= 0)
- || (goal_const && (tem = find_reg_note (p, REG_EQUIV,
- NULL_RTX))
- && GET_CODE (SET_DEST (pat)) == REG
- && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
- && GET_MODE_CLASS (GET_MODE (XEXP (tem, 0))) == MODE_FLOAT
- && GET_CODE (goal) == CONST_INT
- && 0 != (goaltry = operand_subword (XEXP (tem, 0), 1, 0,
- VOIDmode))
- && rtx_equal_p (goal, goaltry)
- && (valtry
- = operand_subword (SET_DEST (pat), 1, 0, VOIDmode))
- && (valueno = true_regnum (valtry)) >= 0)))
- if (other >= 0
- ? valueno == other
- : ((unsigned) valueno < FIRST_PSEUDO_REGISTER
- && TEST_HARD_REG_BIT (reg_class_contents[(int) class],
- valueno)))
- {
- value = valtry;
- where = p;
- break;
- }
- }
- }
-
- /* We found a previous insn copying GOAL into a suitable other reg VALUE
- (or copying VALUE into GOAL, if GOAL is also a register).
- Now verify that VALUE is really valid. */
-
- /* VALUENO is the register number of VALUE; a hard register. */
-
- /* Don't try to re-use something that is killed in this insn. We want
- to be able to trust REG_UNUSED notes. */
- if (find_reg_note (where, REG_UNUSED, value))
- return 0;
-
- /* If we propose to get the value from the stack pointer or if GOAL is
- a MEM based on the stack pointer, we need a stable SP. */
- if (valueno == STACK_POINTER_REGNUM || regno == STACK_POINTER_REGNUM
- || (goal_mem && reg_overlap_mentioned_for_reload_p (stack_pointer_rtx,
- goal)))
- need_stable_sp = 1;
-
- /* Reject VALUE if the copy-insn moved the wrong sort of datum. */
- if (GET_MODE (value) != mode)
- return 0;
-
- /* Reject VALUE if it was loaded from GOAL
- and is also a register that appears in the address of GOAL. */
-
- if (goal_mem && value == SET_DEST (single_set (where))
- && refers_to_regno_for_reload_p (valueno,
- (valueno
- + HARD_REGNO_NREGS (valueno, mode)),
- goal, NULL_PTR))
- return 0;
-
- /* Reject registers that overlap GOAL. */
-
- if (!goal_mem && !goal_const
- && regno + HARD_REGNO_NREGS (regno, mode) > valueno
- && regno < valueno + HARD_REGNO_NREGS (valueno, mode))
- return 0;
-
- /* Reject VALUE if it is one of the regs reserved for reloads.
- Reload1 knows how to reuse them anyway, and it would get
- confused if we allocated one without its knowledge.
- (Now that insns introduced by reload are ignored above,
- this case shouldn't happen, but I'm not positive.) */
-
- if (reload_reg_p != 0 && reload_reg_p != (short *) (HOST_WIDE_INT) 1
- && reload_reg_p[valueno] >= 0)
- return 0;
-
- /* On some machines, certain regs must always be rejected
- because they don't behave the way ordinary registers do. */
-
-#ifdef OVERLAPPING_REGNO_P
- if (OVERLAPPING_REGNO_P (valueno))
- return 0;
-#endif
-
- nregs = HARD_REGNO_NREGS (regno, mode);
- valuenregs = HARD_REGNO_NREGS (valueno, mode);
-
- /* Reject VALUE if it is a register being used for an input reload
- even if it is not one of those reserved. */
-
- if (reload_reg_p != 0)
- {
- int i;
- for (i = 0; i < n_reloads; i++)
- if (reload_reg_rtx[i] != 0 && reload_in[i])
- {
- int regno1 = REGNO (reload_reg_rtx[i]);
- int nregs1 = HARD_REGNO_NREGS (regno1,
- GET_MODE (reload_reg_rtx[i]));
- if (regno1 < valueno + valuenregs
- && regno1 + nregs1 > valueno)
- return 0;
- }
- }
-
- if (goal_mem)
- /* We must treat frame pointer as varying here,
- since it can vary--in a nonlocal goto as generated by expand_goto. */
- goal_mem_addr_varies = !CONSTANT_ADDRESS_P (XEXP (goal, 0));
-
- /* Now verify that the values of GOAL and VALUE remain unaltered
- until INSN is reached. */
-
- p = insn;
- while (1)
- {
- p = PREV_INSN (p);
- if (p == where)
- return value;
-
- /* Don't trust the conversion past a function call
- if either of the two is in a call-clobbered register, or memory. */
- if (GET_CODE (p) == CALL_INSN
- && ((regno >= 0 && regno < FIRST_PSEUDO_REGISTER
- && call_used_regs[regno])
- ||
- (valueno >= 0 && valueno < FIRST_PSEUDO_REGISTER
- && call_used_regs[valueno])
- ||
- goal_mem
- || need_stable_sp))
- return 0;
-
-#ifdef NON_SAVING_SETJMP
- if (NON_SAVING_SETJMP && GET_CODE (p) == NOTE
- && NOTE_LINE_NUMBER (p) == NOTE_INSN_SETJMP)
- return 0;
-#endif
-
-#ifdef INSN_CLOBBERS_REGNO_P
- if ((valueno >= 0 && valueno < FIRST_PSEUDO_REGISTER
- && INSN_CLOBBERS_REGNO_P (p, valueno))
- || (regno >= 0 && regno < FIRST_PSEUDO_REGISTER
- && INSN_CLOBBERS_REGNO_P (p, regno)))
- return 0;
-#endif
-
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i')
- {
- /* If this insn P stores in either GOAL or VALUE, return 0.
- If GOAL is a memory ref and this insn writes memory, return 0.
- If GOAL is a memory ref and its address is not constant,
- and this insn P changes a register used in GOAL, return 0. */
-
- pat = PATTERN (p);
- if (GET_CODE (pat) == SET || GET_CODE (pat) == CLOBBER)
- {
- register rtx dest = SET_DEST (pat);
- while (GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == STRICT_LOW_PART)
- dest = XEXP (dest, 0);
- if (GET_CODE (dest) == REG)
- {
- register int xregno = REGNO (dest);
- int xnregs;
- if (REGNO (dest) < FIRST_PSEUDO_REGISTER)
- xnregs = HARD_REGNO_NREGS (xregno, GET_MODE (dest));
- else
- xnregs = 1;
- if (xregno < regno + nregs && xregno + xnregs > regno)
- return 0;
- if (xregno < valueno + valuenregs
- && xregno + xnregs > valueno)
- return 0;
- if (goal_mem_addr_varies
- && reg_overlap_mentioned_for_reload_p (dest, goal))
- return 0;
- }
- else if (goal_mem && GET_CODE (dest) == MEM
- && ! push_operand (dest, GET_MODE (dest)))
- return 0;
- else if (GET_CODE (dest) == MEM && regno >= FIRST_PSEUDO_REGISTER
- && reg_equiv_memory_loc[regno] != 0)
- return 0;
- else if (need_stable_sp && push_operand (dest, GET_MODE (dest)))
- return 0;
- }
- else if (GET_CODE (pat) == PARALLEL)
- {
- register int i;
- for (i = XVECLEN (pat, 0) - 1; i >= 0; i--)
- {
- register rtx v1 = XVECEXP (pat, 0, i);
- if (GET_CODE (v1) == SET || GET_CODE (v1) == CLOBBER)
- {
- register rtx dest = SET_DEST (v1);
- while (GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == STRICT_LOW_PART)
- dest = XEXP (dest, 0);
- if (GET_CODE (dest) == REG)
- {
- register int xregno = REGNO (dest);
- int xnregs;
- if (REGNO (dest) < FIRST_PSEUDO_REGISTER)
- xnregs = HARD_REGNO_NREGS (xregno, GET_MODE (dest));
- else
- xnregs = 1;
- if (xregno < regno + nregs
- && xregno + xnregs > regno)
- return 0;
- if (xregno < valueno + valuenregs
- && xregno + xnregs > valueno)
- return 0;
- if (goal_mem_addr_varies
- && reg_overlap_mentioned_for_reload_p (dest,
- goal))
- return 0;
- }
- else if (goal_mem && GET_CODE (dest) == MEM
- && ! push_operand (dest, GET_MODE (dest)))
- return 0;
- else if (need_stable_sp
- && push_operand (dest, GET_MODE (dest)))
- return 0;
- }
- }
- }
-
- if (GET_CODE (p) == CALL_INSN && CALL_INSN_FUNCTION_USAGE (p))
- {
- rtx link;
-
- for (link = CALL_INSN_FUNCTION_USAGE (p); XEXP (link, 1) != 0;
- link = XEXP (link, 1))
- {
- pat = XEXP (link, 0);
- if (GET_CODE (pat) == CLOBBER)
- {
- register rtx dest = SET_DEST (pat);
- while (GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == STRICT_LOW_PART)
- dest = XEXP (dest, 0);
- if (GET_CODE (dest) == REG)
- {
- register int xregno = REGNO (dest);
- int xnregs;
- if (REGNO (dest) < FIRST_PSEUDO_REGISTER)
- xnregs = HARD_REGNO_NREGS (xregno, GET_MODE (dest));
- else
- xnregs = 1;
- if (xregno < regno + nregs
- && xregno + xnregs > regno)
- return 0;
- if (xregno < valueno + valuenregs
- && xregno + xnregs > valueno)
- return 0;
- if (goal_mem_addr_varies
- && reg_overlap_mentioned_for_reload_p (dest,
- goal))
- return 0;
- }
- else if (goal_mem && GET_CODE (dest) == MEM
- && ! push_operand (dest, GET_MODE (dest)))
- return 0;
- else if (need_stable_sp
- && push_operand (dest, GET_MODE (dest)))
- return 0;
- }
- }
- }
-
-#ifdef AUTO_INC_DEC
- /* If this insn auto-increments or auto-decrements
- either regno or valueno, return 0 now.
- If GOAL is a memory ref and its address is not constant,
- and this insn P increments a register used in GOAL, return 0. */
- {
- register rtx link;
-
- for (link = REG_NOTES (p); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_INC
- && GET_CODE (XEXP (link, 0)) == REG)
- {
- register int incno = REGNO (XEXP (link, 0));
- if (incno < regno + nregs && incno >= regno)
- return 0;
- if (incno < valueno + valuenregs && incno >= valueno)
- return 0;
- if (goal_mem_addr_varies
- && reg_overlap_mentioned_for_reload_p (XEXP (link, 0),
- goal))
- return 0;
- }
- }
-#endif
- }
- }
-}
-
-/* Find a place where INCED appears in an increment or decrement operator
- within X, and return the amount INCED is incremented or decremented by.
- The value is always positive. */
-
-static int
-find_inc_amount (x, inced)
- rtx x, inced;
-{
- register enum rtx_code code = GET_CODE (x);
- register char *fmt;
- register int i;
-
- if (code == MEM)
- {
- register rtx addr = XEXP (x, 0);
- if ((GET_CODE (addr) == PRE_DEC
- || GET_CODE (addr) == POST_DEC
- || GET_CODE (addr) == PRE_INC
- || GET_CODE (addr) == POST_INC)
- && XEXP (addr, 0) == inced)
- return GET_MODE_SIZE (GET_MODE (x));
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- register int tem = find_inc_amount (XEXP (x, i), inced);
- if (tem != 0)
- return tem;
- }
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- {
- register int tem = find_inc_amount (XVECEXP (x, i, j), inced);
- if (tem != 0)
- return tem;
- }
- }
- }
-
- return 0;
-}
-
-/* Return 1 if register REGNO is the subject of a clobber in insn INSN. */
-
-int
-regno_clobbered_p (regno, insn)
- int regno;
- rtx insn;
-{
- if (GET_CODE (PATTERN (insn)) == CLOBBER
- && GET_CODE (XEXP (PATTERN (insn), 0)) == REG)
- return REGNO (XEXP (PATTERN (insn), 0)) == regno;
-
- if (GET_CODE (PATTERN (insn)) == PARALLEL)
- {
- int i = XVECLEN (PATTERN (insn), 0) - 1;
-
- for (; i >= 0; i--)
- {
- rtx elt = XVECEXP (PATTERN (insn), 0, i);
- if (GET_CODE (elt) == CLOBBER && GET_CODE (XEXP (elt, 0)) == REG
- && REGNO (XEXP (elt, 0)) == regno)
- return 1;
- }
- }
-
- return 0;
-}
-
-static char *reload_when_needed_name[] =
-{
- "RELOAD_FOR_INPUT",
- "RELOAD_FOR_OUTPUT",
- "RELOAD_FOR_INSN",
- "RELOAD_FOR_INPUT_ADDRESS",
- "RELOAD_FOR_INPADDR_ADDRESS",
- "RELOAD_FOR_OUTPUT_ADDRESS",
- "RELOAD_FOR_OUTADDR_ADDRESS",
- "RELOAD_FOR_OPERAND_ADDRESS",
- "RELOAD_FOR_OPADDR_ADDR",
- "RELOAD_OTHER",
- "RELOAD_FOR_OTHER_ADDRESS"
-};
-
-static char *reg_class_names[] = REG_CLASS_NAMES;
-
-/* This function is used to print the variables set by 'find_reloads' */
-
-void
-debug_reload()
-{
- int r;
-
- fprintf (stderr, "\nn_reloads = %d\n", n_reloads);
-
- for (r = 0; r < n_reloads; r++)
- {
- fprintf (stderr, "\nRELOAD %d\n", r);
-
- if (reload_in[r])
- {
- fprintf (stderr, "\nreload_in (%s) = ",
- GET_MODE_NAME (reload_inmode[r]));
- debug_rtx (reload_in[r]);
- }
-
- if (reload_out[r])
- {
- fprintf (stderr, "\nreload_out (%s) = ",
- GET_MODE_NAME (reload_outmode[r]));
- debug_rtx (reload_out[r]);
- }
-
- fprintf (stderr, "%s, ", reg_class_names[(int) reload_reg_class[r]]);
-
- fprintf (stderr, "%s (opnum = %d)",
- reload_when_needed_name[(int)reload_when_needed[r]],
- reload_opnum[r]);
-
- if (reload_optional[r])
- fprintf (stderr, ", optional");
-
- if (reload_in[r])
- fprintf (stderr, ", inc by %d\n", reload_inc[r]);
-
- if (reload_nocombine[r])
- fprintf (stderr, ", can't combine");
-
- if (reload_secondary_p[r])
- fprintf (stderr, ", secondary_reload_p");
-
- if (reload_in_reg[r])
- {
- fprintf (stderr, "\nreload_in_reg:\t\t\t");
- debug_rtx (reload_in_reg[r]);
- }
-
- if (reload_reg_rtx[r])
- {
- fprintf (stderr, "\nreload_reg_rtx:\t\t\t");
- debug_rtx (reload_reg_rtx[r]);
- }
-
- if (reload_secondary_in_reload[r] != -1)
- {
- fprintf (stderr, "\nsecondary_in_reload = ");
- fprintf (stderr, "%d ", reload_secondary_in_reload[r]);
- }
-
- if (reload_secondary_out_reload[r] != -1)
- {
- if (reload_secondary_in_reload[r] != -1)
- fprintf (stderr, ", secondary_out_reload = ");
- else
- fprintf (stderr, "\nsecondary_out_reload = ");
-
- fprintf (stderr, "%d", reload_secondary_out_reload[r]);
- }
-
-
- if (reload_secondary_in_icode[r] != CODE_FOR_nothing)
- {
- fprintf (stderr, "\nsecondary_in_icode = ");
- fprintf (stderr, "%s", insn_name[r]);
- }
-
- if (reload_secondary_out_icode[r] != CODE_FOR_nothing)
- {
- if (reload_secondary_in_icode[r] != CODE_FOR_nothing)
- fprintf (stderr, ", secondary_out_icode = ");
- else
- fprintf (stderr, "\nsecondary_out_icode = ");
-
- fprintf (stderr, "%s ", insn_name[r]);
- }
- fprintf (stderr, "\n");
- }
-
- fprintf (stderr, "\n");
-}
diff --git a/gcc/reload.h b/gcc/reload.h
deleted file mode 100644
index 98c6dd415a4..00000000000
--- a/gcc/reload.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/* Communication between reload.c and reload1.c.
- Copyright (C) 1987, 91, 92, 93, 94, 95, 1997 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. */
-
-
-/* If secondary reloads are the same for inputs and outputs, define those
- macros here. */
-
-#ifdef SECONDARY_RELOAD_CLASS
-#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
- SECONDARY_RELOAD_CLASS (CLASS, MODE, X)
-#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
- SECONDARY_RELOAD_CLASS (CLASS, MODE, X)
-#endif
-
-/* If either macro is defined, show that we need secondary reloads. */
-#if defined(SECONDARY_INPUT_RELOAD_CLASS) || defined(SECONDARY_OUTPUT_RELOAD_CLASS)
-#define HAVE_SECONDARY_RELOADS
-#endif
-
-/* See reload.c and reload1.c for comments on these variables. */
-
-/* Maximum number of reloads we can need. */
-#define MAX_RELOADS (2 * MAX_RECOG_OPERANDS * (MAX_REGS_PER_ADDRESS + 1))
-
-extern enum reg_class reload_address_base_reg_class;
-extern enum reg_class reload_address_index_reg_class;
-extern rtx reload_in[MAX_RELOADS];
-extern rtx reload_out[MAX_RELOADS];
-extern rtx reload_in_reg[MAX_RELOADS];
-extern enum reg_class reload_reg_class[MAX_RELOADS];
-extern enum machine_mode reload_inmode[MAX_RELOADS];
-extern enum machine_mode reload_outmode[MAX_RELOADS];
-extern char reload_optional[MAX_RELOADS];
-extern int reload_inc[MAX_RELOADS];
-extern int reload_opnum[MAX_RELOADS];
-extern int reload_secondary_p[MAX_RELOADS];
-extern int reload_secondary_in_reload[MAX_RELOADS];
-extern int reload_secondary_out_reload[MAX_RELOADS];
-#ifdef MAX_INSN_CODE
-extern enum insn_code reload_secondary_in_icode[MAX_RELOADS];
-extern enum insn_code reload_secondary_out_icode[MAX_RELOADS];
-#endif
-extern int n_reloads;
-
-extern rtx reload_reg_rtx[MAX_RELOADS];
-
-/* Encode the usage of a reload. The following codes are supported:
-
- RELOAD_FOR_INPUT reload of an input operand
- RELOAD_FOR_OUTPUT likewise, for output
- RELOAD_FOR_INSN a reload that must not conflict with anything
- used in the insn, but may conflict with
- something used before or after the insn
- RELOAD_FOR_INPUT_ADDRESS reload for parts of the address of an object
- that is an input reload
- RELOAD_FOR_INPADDR_ADDRESS reload needed for RELOAD_FOR_INPUT_ADDRESS
- RELOAD_FOR_OUTPUT_ADDRESS like RELOAD_FOR INPUT_ADDRESS, for output
- RELOAD_FOR_OUTADDR_ADDRESS reload needed for RELOAD_FOR_OUTPUT_ADDRESS
- RELOAD_FOR_OPERAND_ADDRESS reload for the address of a non-reloaded
- operand; these don't conflict with
- any other addresses.
- RELOAD_FOR_OPADDR_ADDR reload needed for RELOAD_FOR_OPERAND_ADDRESS
- reloads; usually secondary reloads
- RELOAD_OTHER none of the above, usually multiple uses
- RELOAD_FOR_OTHER_ADDRESS reload for part of the address of an input
- that is marked RELOAD_OTHER.
-
- This used to be "enum reload_when_needed" but some debuggers have trouble
- with an enum tag and variable of the same name. */
-
-enum reload_type
-{
- RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN,
- RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INPADDR_ADDRESS,
- RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS,
- RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OPADDR_ADDR,
- RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS
-};
-
-extern enum reload_type reload_when_needed[MAX_RELOADS];
-
-extern rtx *reg_equiv_constant;
-extern rtx *reg_equiv_memory_loc;
-extern rtx *reg_equiv_address;
-extern rtx *reg_equiv_mem;
-
-/* All the "earlyclobber" operands of the current insn
- are recorded here. */
-extern int n_earlyclobbers;
-extern rtx reload_earlyclobbers[MAX_RECOG_OPERANDS];
-
-/* Save the number of operands. */
-extern int reload_n_operands;
-
-/* First uid used by insns created by reload in this function.
- Used in find_equiv_reg. */
-extern int reload_first_uid;
-
-/* Nonzero if indirect addressing is supported when the innermost MEM is
- of the form (MEM (SYMBOL_REF sym)). It is assumed that the level to
- which these are valid is the same as spill_indirect_levels, above. */
-
-extern char indirect_symref_ok;
-
-/* Nonzero if an address (plus (reg frame_pointer) (reg ...)) is valid. */
-extern char double_reg_address_ok;
-
-#ifdef MAX_INSN_CODE
-/* These arrays record the insn_code of insns that may be needed to
- perform input and output reloads of special objects. They provide a
- place to pass a scratch register. */
-extern enum insn_code reload_in_optab[];
-extern enum insn_code reload_out_optab[];
-#endif
-
-/* Functions from reload.c: */
-
-/* Return a memory location that will be used to copy X in mode MODE.
- If we haven't already made a location for this mode in this insn,
- call find_reloads_address on the location being returned. */
-extern rtx get_secondary_mem PROTO((rtx, enum machine_mode,
- int, enum reload_type));
-
-/* Clear any secondary memory locations we've made. */
-extern void clear_secondary_mem PROTO((void));
-
-/* Transfer all replacements that used to be in reload FROM to be in
- reload TO. */
-extern void transfer_replacements PROTO((int, int));
-
-/* Return 1 if ADDR is a valid memory address for mode MODE,
- and check that each pseudo reg has the proper kind of
- hard reg. */
-extern int strict_memory_address_p PROTO((enum machine_mode, rtx));
-
-/* Like rtx_equal_p except that it allows a REG and a SUBREG to match
- if they are the same hard reg, and has special hacks for
- autoincrement and autodecrement. */
-extern int operands_match_p PROTO((rtx, rtx));
-
-/* Return the number of times character C occurs in string S. */
-extern int n_occurrences PROTO((int, char *));
-
-/* Return 1 if altering OP will not modify the value of CLOBBER. */
-extern int safe_from_earlyclobber PROTO((rtx, rtx));
-
-/* Search the body of INSN for values that need reloading and record them
- with push_reload. REPLACE nonzero means record also where the values occur
- so that subst_reloads can be used. */
-extern void find_reloads PROTO((rtx, int, int, int, short *));
-
-/* Compute the sum of X and Y, making canonicalizations assumed in an
- address, namely: sum constant integers, surround the sum of two
- constants with a CONST, put the constant as the second operand, and
- group the constant on the outermost sum. */
-extern rtx form_sum PROTO((rtx, rtx));
-
-/* Substitute into the current INSN the registers into which we have reloaded
- the things that need reloading. */
-extern void subst_reloads PROTO((void));
-
-/* Make a copy of any replacements being done into X and move those copies
- to locations in Y, a copy of X. We only look at the highest level of
- the RTL. */
-extern void copy_replacements PROTO((rtx, rtx));
-
-/* If LOC was scheduled to be replaced by something, return the replacement.
- Otherwise, return *LOC. */
-extern rtx find_replacement PROTO((rtx *));
-
-/* Return nonzero if register in range [REGNO, ENDREGNO)
- appears either explicitly or implicitly in X
- other than being stored into. */
-extern int refers_to_regno_for_reload_p PROTO((int, int, rtx, rtx *));
-
-/* Nonzero if modifying X will affect IN. */
-extern int reg_overlap_mentioned_for_reload_p PROTO((rtx, rtx));
-
-/* Return nonzero if anything in X contains a MEM. Look also for pseudo
- registers. */
-extern int refers_to_mem_for_reload_p PROTO((rtx));
-
-/* Check the insns before INSN to see if there is a suitable register
- containing the same value as GOAL. */
-extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *,
- int, enum machine_mode));
-
-/* Return 1 if register REGNO is the subject of a clobber in insn INSN. */
-extern int regno_clobbered_p PROTO((int, rtx));
-
-
-/* Functions in reload1.c: */
-
-/* Initialize the reload pass once per compilation. */
-extern void init_reload PROTO((void));
-
-/* The reload pass itself. */
-extern int reload STDIO_PROTO((rtx, int, FILE *));
-
-/* Mark the slots in regs_ever_live for the hard regs
- used by pseudo-reg number REGNO. */
-extern void mark_home_live PROTO((int));
-
-/* Scan X and replace any eliminable registers (such as fp) with a
- replacement (such as sp), plus an offset. */
-extern rtx eliminate_regs PROTO((rtx, enum machine_mode, rtx, int));
-
-/* Emit code to perform a reload from IN (which may be a reload register) to
- OUT (which may also be a reload register). IN or OUT is from operand
- OPNUM with reload type TYPE. */
-extern rtx gen_reload PROTO((rtx, rtx, int, enum reload_type));
-
-/* Functions in caller-save.c: */
-
-/* Initialize for caller-save. */
-extern void init_caller_save PROTO((void));
-
-/* Initialize save areas by showing that we haven't allocated any yet. */
-extern void init_save_areas PROTO((void));
-
-/* Allocate save areas for any hard registers that might need saving. */
-extern int setup_save_areas PROTO((int *));
-
-/* Find the places where hard regs are live across calls and save them. */
-extern void save_call_clobbered_regs PROTO((enum machine_mode));
diff --git a/gcc/reload1.c b/gcc/reload1.c
deleted file mode 100644
index a7b4238d1b5..00000000000
--- a/gcc/reload1.c
+++ /dev/null
@@ -1,8186 +0,0 @@
-/* Reload pseudo regs into hard regs for insns that require hard regs.
- Copyright (C) 1987, 88, 89, 92-6, 1997 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. */
-
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "obstack.h"
-#include "insn-config.h"
-#include "insn-flags.h"
-#include "insn-codes.h"
-#include "flags.h"
-#include "expr.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "reload.h"
-#include "recog.h"
-#include "basic-block.h"
-#include "output.h"
-#include "real.h"
-
-/* This file contains the reload pass of the compiler, which is
- run after register allocation has been done. It checks that
- each insn is valid (operands required to be in registers really
- are in registers of the proper class) and fixes up invalid ones
- by copying values temporarily into registers for the insns
- that need them.
-
- The results of register allocation are described by the vector
- reg_renumber; the insns still contain pseudo regs, but reg_renumber
- can be used to find which hard reg, if any, a pseudo reg is in.
-
- The technique we always use is to free up a few hard regs that are
- called ``reload regs'', and for each place where a pseudo reg
- must be in a hard reg, copy it temporarily into one of the reload regs.
-
- All the pseudos that were formerly allocated to the hard regs that
- are now in use as reload regs must be ``spilled''. This means
- that they go to other hard regs, or to stack slots if no other
- available hard regs can be found. Spilling can invalidate more
- insns, requiring additional need for reloads, so we must keep checking
- until the process stabilizes.
-
- For machines with different classes of registers, we must keep track
- of the register class needed for each reload, and make sure that
- we allocate enough reload registers of each class.
-
- The file reload.c contains the code that checks one insn for
- validity and reports the reloads that it needs. This file
- is in charge of scanning the entire rtl code, accumulating the
- reload needs, spilling, assigning reload registers to use for
- fixing up each insn, and generating the new insns to copy values
- into the reload registers. */
-
-
-#ifndef REGISTER_MOVE_COST
-#define REGISTER_MOVE_COST(x, y) 2
-#endif
-
-#ifndef MEMORY_MOVE_COST
-#define MEMORY_MOVE_COST(x) 4
-#endif
-
-/* During reload_as_needed, element N contains a REG rtx for the hard reg
- into which reg N has been reloaded (perhaps for a previous insn). */
-static rtx *reg_last_reload_reg;
-
-/* Elt N nonzero if reg_last_reload_reg[N] has been set in this insn
- for an output reload that stores into reg N. */
-static char *reg_has_output_reload;
-
-/* Indicates which hard regs are reload-registers for an output reload
- in the current insn. */
-static HARD_REG_SET reg_is_output_reload;
-
-/* Element N is the constant value to which pseudo reg N is equivalent,
- or zero if pseudo reg N is not equivalent to a constant.
- find_reloads looks at this in order to replace pseudo reg N
- with the constant it stands for. */
-rtx *reg_equiv_constant;
-
-/* Element N is a memory location to which pseudo reg N is equivalent,
- prior to any register elimination (such as frame pointer to stack
- pointer). Depending on whether or not it is a valid address, this value
- is transferred to either reg_equiv_address or reg_equiv_mem. */
-rtx *reg_equiv_memory_loc;
-
-/* Element N is the address of stack slot to which pseudo reg N is equivalent.
- This is used when the address is not valid as a memory address
- (because its displacement is too big for the machine.) */
-rtx *reg_equiv_address;
-
-/* Element N is the memory slot to which pseudo reg N is equivalent,
- or zero if pseudo reg N is not equivalent to a memory slot. */
-rtx *reg_equiv_mem;
-
-/* Widest width in which each pseudo reg is referred to (via subreg). */
-static int *reg_max_ref_width;
-
-/* Element N is the insn that initialized reg N from its equivalent
- constant or memory slot. */
-static rtx *reg_equiv_init;
-
-/* During reload_as_needed, element N contains the last pseudo regno
- reloaded into the Nth reload register. This vector is in parallel
- with spill_regs. If that pseudo reg occupied more than one register,
- reg_reloaded_contents points to that pseudo for each spill register in
- use; all of these must remain set for an inheritance to occur. */
-static int reg_reloaded_contents[FIRST_PSEUDO_REGISTER];
-
-/* During reload_as_needed, element N contains the insn for which
- the Nth reload register was last used. This vector is in parallel
- with spill_regs, and its contents are significant only when
- reg_reloaded_contents is significant. */
-static rtx reg_reloaded_insn[FIRST_PSEUDO_REGISTER];
-
-/* Number of spill-regs so far; number of valid elements of spill_regs. */
-static int n_spills;
-
-/* In parallel with spill_regs, contains REG rtx's for those regs.
- Holds the last rtx used for any given reg, or 0 if it has never
- been used for spilling yet. This rtx is reused, provided it has
- the proper mode. */
-static rtx spill_reg_rtx[FIRST_PSEUDO_REGISTER];
-
-/* In parallel with spill_regs, contains nonzero for a spill reg
- that was stored after the last time it was used.
- The precise value is the insn generated to do the store. */
-static rtx spill_reg_store[FIRST_PSEUDO_REGISTER];
-
-/* This table is the inverse mapping of spill_regs:
- indexed by hard reg number,
- it contains the position of that reg in spill_regs,
- or -1 for something that is not in spill_regs. */
-static short spill_reg_order[FIRST_PSEUDO_REGISTER];
-
-/* This reg set indicates registers that may not be used for retrying global
- allocation. The registers that may not be used include all spill registers
- and the frame pointer (if we are using one). */
-HARD_REG_SET forbidden_regs;
-
-/* This reg set indicates registers that are not good for spill registers.
- They will not be used to complete groups of spill registers. This includes
- all fixed registers, registers that may be eliminated, and, if
- SMALL_REGISTER_CLASSES is not defined, registers explicitly used in the rtl.
-
- (spill_reg_order prevents these registers from being used to start a
- group.) */
-static HARD_REG_SET bad_spill_regs;
-
-/* Describes order of use of registers for reloading
- of spilled pseudo-registers. `spills' is the number of
- elements that are actually valid; new ones are added at the end. */
-static short spill_regs[FIRST_PSEUDO_REGISTER];
-
-/* This reg set indicates those registers that have been used a spill
- registers. This information is used in reorg.c, to help figure out
- what registers are live at any point. It is assumed that all spill_regs
- are dead at every CODE_LABEL. */
-
-HARD_REG_SET used_spill_regs;
-
-/* Index of last register assigned as a spill register. We allocate in
- a round-robin fashion. */
-
-static int last_spill_reg;
-
-/* Describes order of preference for putting regs into spill_regs.
- Contains the numbers of all the hard regs, in order most preferred first.
- This order is different for each function.
- It is set up by order_regs_for_reload.
- Empty elements at the end contain -1. */
-static short potential_reload_regs[FIRST_PSEUDO_REGISTER];
-
-/* 1 for a hard register that appears explicitly in the rtl
- (for example, function value registers, special registers
- used by insns, structure value pointer registers). */
-static char regs_explicitly_used[FIRST_PSEUDO_REGISTER];
-
-/* Indicates if a register was counted against the need for
- groups. 0 means it can count against max_nongroup instead. */
-static HARD_REG_SET counted_for_groups;
-
-/* Indicates if a register was counted against the need for
- non-groups. 0 means it can become part of a new group.
- During choose_reload_regs, 1 here means don't use this reg
- as part of a group, even if it seems to be otherwise ok. */
-static HARD_REG_SET counted_for_nongroups;
-
-/* Indexed by pseudo reg number N,
- says may not delete stores into the real (memory) home of pseudo N.
- This is set if we already substituted a memory equivalent in some uses,
- which happens when we have to eliminate the fp from it. */
-static char *cannot_omit_stores;
-
-/* Nonzero if indirect addressing is supported on the machine; this means
- that spilling (REG n) does not require reloading it into a register in
- order to do (MEM (REG n)) or (MEM (PLUS (REG n) (CONST_INT c))). The
- value indicates the level of indirect addressing supported, e.g., two
- means that (MEM (MEM (REG n))) is also valid if (REG n) does not get
- a hard register. */
-
-static char spill_indirect_levels;
-
-/* Nonzero if indirect addressing is supported when the innermost MEM is
- of the form (MEM (SYMBOL_REF sym)). It is assumed that the level to
- which these are valid is the same as spill_indirect_levels, above. */
-
-char indirect_symref_ok;
-
-/* Nonzero if an address (plus (reg frame_pointer) (reg ...)) is valid. */
-
-char double_reg_address_ok;
-
-/* Record the stack slot for each spilled hard register. */
-
-static rtx spill_stack_slot[FIRST_PSEUDO_REGISTER];
-
-/* Width allocated so far for that stack slot. */
-
-static int spill_stack_slot_width[FIRST_PSEUDO_REGISTER];
-
-/* Indexed by register class and basic block number, nonzero if there is
- any need for a spill register of that class in that basic block.
- The pointer is 0 if we did stupid allocation and don't know
- the structure of basic blocks. */
-
-char *basic_block_needs[N_REG_CLASSES];
-
-/* First uid used by insns created by reload in this function.
- Used in find_equiv_reg. */
-int reload_first_uid;
-
-/* Flag set by local-alloc or global-alloc if anything is live in
- a call-clobbered reg across calls. */
-
-int caller_save_needed;
-
-/* The register class to use for a base register when reloading an
- address. This is normally BASE_REG_CLASS, but it may be different
- when using SMALL_REGISTER_CLASSES and passing parameters in
- registers. */
-enum reg_class reload_address_base_reg_class;
-
-/* The register class to use for an index register when reloading an
- address. This is normally INDEX_REG_CLASS, but it may be different
- when using SMALL_REGISTER_CLASSES and passing parameters in
- registers. */
-enum reg_class reload_address_index_reg_class;
-
-/* Set to 1 while reload_as_needed is operating.
- Required by some machines to handle any generated moves differently. */
-
-int reload_in_progress = 0;
-
-/* These arrays record the insn_code of insns that may be needed to
- perform input and output reloads of special objects. They provide a
- place to pass a scratch register. */
-
-enum insn_code reload_in_optab[NUM_MACHINE_MODES];
-enum insn_code reload_out_optab[NUM_MACHINE_MODES];
-
-/* This obstack is used for allocation of rtl during register elimination.
- The allocated storage can be freed once find_reloads has processed the
- insn. */
-
-struct obstack reload_obstack;
-char *reload_firstobj;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-/* List of labels that must never be deleted. */
-extern rtx forced_labels;
-
-/* Allocation number table from global register allocation. */
-extern int *reg_allocno;
-
-/* This structure is used to record information about register eliminations.
- Each array entry describes one possible way of eliminating a register
- in favor of another. If there is more than one way of eliminating a
- particular register, the most preferred should be specified first. */
-
-static struct elim_table
-{
- int from; /* Register number to be eliminated. */
- int to; /* Register number used as replacement. */
- int initial_offset; /* Initial difference between values. */
- int can_eliminate; /* Non-zero if this elimination can be done. */
- int can_eliminate_previous; /* Value of CAN_ELIMINATE in previous scan over
- insns made by reload. */
- int offset; /* Current offset between the two regs. */
- int max_offset; /* Maximum offset between the two regs. */
- int previous_offset; /* Offset at end of previous insn. */
- int ref_outside_mem; /* "to" has been referenced outside a MEM. */
- rtx from_rtx; /* REG rtx for the register to be eliminated.
- We cannot simply compare the number since
- we might then spuriously replace a hard
- register corresponding to a pseudo
- assigned to the reg to be eliminated. */
- rtx to_rtx; /* REG rtx for the replacement. */
-} reg_eliminate[] =
-
-/* If a set of eliminable registers was specified, define the table from it.
- Otherwise, default to the normal case of the frame pointer being
- replaced by the stack pointer. */
-
-#ifdef ELIMINABLE_REGS
- ELIMINABLE_REGS;
-#else
- {{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}};
-#endif
-
-#define NUM_ELIMINABLE_REGS (sizeof reg_eliminate / sizeof reg_eliminate[0])
-
-/* Record the number of pending eliminations that have an offset not equal
- to their initial offset. If non-zero, we use a new copy of each
- replacement result in any insns encountered. */
-static int num_not_at_initial_offset;
-
-/* Count the number of registers that we may be able to eliminate. */
-static int num_eliminable;
-
-/* For each label, we record the offset of each elimination. If we reach
- a label by more than one path and an offset differs, we cannot do the
- elimination. This information is indexed by the number of the label.
- The first table is an array of flags that records whether we have yet
- encountered a label and the second table is an array of arrays, one
- entry in the latter array for each elimination. */
-
-static char *offsets_known_at;
-static int (*offsets_at)[NUM_ELIMINABLE_REGS];
-
-/* Number of labels in the current function. */
-
-static int num_labels;
-
-struct hard_reg_n_uses { int regno; int uses; };
-
-static int possible_group_p PROTO((int, int *));
-static void count_possible_groups PROTO((int *, enum machine_mode *,
- int *, int));
-static int modes_equiv_for_class_p PROTO((enum machine_mode,
- enum machine_mode,
- enum reg_class));
-static void spill_failure PROTO((rtx));
-static int new_spill_reg PROTO((int, int, int *, int *, int,
- FILE *));
-static void delete_dead_insn PROTO((rtx));
-static void alter_reg PROTO((int, int));
-static void mark_scratch_live PROTO((rtx));
-static void set_label_offsets PROTO((rtx, rtx, int));
-static int eliminate_regs_in_insn PROTO((rtx, int));
-static void mark_not_eliminable PROTO((rtx, rtx));
-static int spill_hard_reg PROTO((int, int, FILE *, int));
-static void scan_paradoxical_subregs PROTO((rtx));
-static int hard_reg_use_compare PROTO((const GENERIC_PTR, const GENERIC_PTR));
-static void order_regs_for_reload PROTO((int));
-static int compare_spill_regs PROTO((const GENERIC_PTR, const GENERIC_PTR));
-static void reload_as_needed PROTO((rtx, int));
-static void forget_old_reloads_1 PROTO((rtx, rtx));
-static int reload_reg_class_lower PROTO((const GENERIC_PTR, const GENERIC_PTR));
-static void mark_reload_reg_in_use PROTO((int, int, enum reload_type,
- enum machine_mode));
-static void clear_reload_reg_in_use PROTO((int, int, enum reload_type,
- enum machine_mode));
-static int reload_reg_free_p PROTO((int, int, enum reload_type));
-static int reload_reg_free_before_p PROTO((int, int, enum reload_type));
-static int reload_reg_reaches_end_p PROTO((int, int, enum reload_type));
-static int reloads_conflict PROTO((int, int));
-static int allocate_reload_reg PROTO((int, rtx, int, int));
-static void choose_reload_regs PROTO((rtx, rtx));
-static void merge_assigned_reloads PROTO((rtx));
-static void emit_reload_insns PROTO((rtx));
-static void delete_output_reload PROTO((rtx, int, rtx));
-static void inc_for_reload PROTO((rtx, rtx, int));
-static int constraint_accepts_reg_p PROTO((char *, rtx));
-static int count_occurrences PROTO((rtx, rtx));
-static void reload_cse_invalidate_regno PROTO((int, enum machine_mode, int));
-static int reload_cse_mem_conflict_p PROTO((rtx, rtx, enum machine_mode,
- rtx));
-static void reload_cse_invalidate_mem PROTO((rtx));
-static void reload_cse_invalidate_rtx PROTO((rtx, rtx));
-static void reload_cse_regs PROTO((rtx));
-static int reload_cse_regno_equal_p PROTO((int, rtx, enum machine_mode));
-static int reload_cse_noop_set_p PROTO((rtx));
-static void reload_cse_simplify_set PROTO((rtx, rtx));
-static void reload_cse_check_clobber PROTO((rtx, rtx));
-static void reload_cse_record_set PROTO((rtx, rtx));
-
-/* Initialize the reload pass once per compilation. */
-
-void
-init_reload ()
-{
- register int i;
-
- /* Often (MEM (REG n)) is still valid even if (REG n) is put on the stack.
- Set spill_indirect_levels to the number of levels such addressing is
- permitted, zero if it is not permitted at all. */
-
- register rtx tem
- = gen_rtx (MEM, Pmode,
- gen_rtx (PLUS, Pmode,
- gen_rtx (REG, Pmode, LAST_VIRTUAL_REGISTER + 1),
- GEN_INT (4)));
- spill_indirect_levels = 0;
-
- while (memory_address_p (QImode, tem))
- {
- spill_indirect_levels++;
- tem = gen_rtx (MEM, Pmode, tem);
- }
-
- /* See if indirect addressing is valid for (MEM (SYMBOL_REF ...)). */
-
- tem = gen_rtx (MEM, Pmode, gen_rtx (SYMBOL_REF, Pmode, "foo"));
- indirect_symref_ok = memory_address_p (QImode, tem);
-
- /* See if reg+reg is a valid (and offsettable) address. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- tem = gen_rtx (PLUS, Pmode,
- gen_rtx (REG, Pmode, HARD_FRAME_POINTER_REGNUM),
- gen_rtx (REG, Pmode, i));
- /* This way, we make sure that reg+reg is an offsettable address. */
- tem = plus_constant (tem, 4);
-
- if (memory_address_p (QImode, tem))
- {
- double_reg_address_ok = 1;
- break;
- }
- }
-
- /* Initialize obstack for our rtl allocation. */
- gcc_obstack_init (&reload_obstack);
- reload_firstobj = (char *) obstack_alloc (&reload_obstack, 0);
-
- /* Decide which register class should be used when reloading
- addresses. If we are using SMALL_REGISTER_CLASSES, and any
- parameters are passed in registers, then we do not want to use
- those registers when reloading an address. Otherwise, if a
- function argument needs a reload, we may wind up clobbering
- another argument to the function which was already computed. If
- we find a subset class which simply avoids those registers, we
- use it instead. ??? It would be better to only use the
- restricted class when we actually are loading function arguments,
- but that is hard to determine. */
- reload_address_base_reg_class = BASE_REG_CLASS;
- reload_address_index_reg_class = INDEX_REG_CLASS;
-#ifdef SMALL_REGISTER_CLASSES
- if (SMALL_REGISTER_CLASSES)
- {
- int regno;
- HARD_REG_SET base, index;
- enum reg_class *p;
-
- COPY_HARD_REG_SET (base, reg_class_contents[BASE_REG_CLASS]);
- COPY_HARD_REG_SET (index, reg_class_contents[INDEX_REG_CLASS]);
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- {
- if (FUNCTION_ARG_REGNO_P (regno))
- {
- CLEAR_HARD_REG_BIT (base, regno);
- CLEAR_HARD_REG_BIT (index, regno);
- }
- }
-
- GO_IF_HARD_REG_EQUAL (base, reg_class_contents[BASE_REG_CLASS],
- baseok);
- for (p = reg_class_subclasses[BASE_REG_CLASS];
- *p != LIM_REG_CLASSES;
- p++)
- {
- GO_IF_HARD_REG_EQUAL (base, reg_class_contents[*p], usebase);
- continue;
- usebase:
- reload_address_base_reg_class = *p;
- break;
- }
- baseok:;
-
- GO_IF_HARD_REG_EQUAL (index, reg_class_contents[INDEX_REG_CLASS],
- indexok);
- for (p = reg_class_subclasses[INDEX_REG_CLASS];
- *p != LIM_REG_CLASSES;
- p++)
- {
- GO_IF_HARD_REG_EQUAL (index, reg_class_contents[*p], useindex);
- continue;
- useindex:
- reload_address_index_reg_class = *p;
- break;
- }
- indexok:;
- }
-#endif /* SMALL_REGISTER_CLASSES */
-}
-
-/* Main entry point for the reload pass.
-
- FIRST is the first insn of the function being compiled.
-
- GLOBAL nonzero means we were called from global_alloc
- and should attempt to reallocate any pseudoregs that we
- displace from hard regs we will use for reloads.
- If GLOBAL is zero, we do not have enough information to do that,
- so any pseudo reg that is spilled must go to the stack.
-
- DUMPFILE is the global-reg debugging dump file stream, or 0.
- If it is nonzero, messages are written to it to describe
- which registers are seized as reload regs, which pseudo regs
- are spilled from them, and where the pseudo regs are reallocated to.
-
- Return value is nonzero if reload failed
- and we must not do any more for this function. */
-
-int
-reload (first, global, dumpfile)
- rtx first;
- int global;
- FILE *dumpfile;
-{
- register int class;
- register int i, j, k;
- register rtx insn;
- register struct elim_table *ep;
-
- int something_changed;
- int something_needs_reloads;
- int something_needs_elimination;
- int new_basic_block_needs;
- enum reg_class caller_save_spill_class = NO_REGS;
- int caller_save_group_size = 1;
-
- /* Nonzero means we couldn't get enough spill regs. */
- int failure = 0;
-
- /* The basic block number currently being processed for INSN. */
- int this_block;
-
- /* Make sure even insns with volatile mem refs are recognizable. */
- init_recog ();
-
- /* Enable find_equiv_reg to distinguish insns made by reload. */
- reload_first_uid = get_max_uid ();
-
- for (i = 0; i < N_REG_CLASSES; i++)
- basic_block_needs[i] = 0;
-
-#ifdef SECONDARY_MEMORY_NEEDED
- /* Initialize the secondary memory table. */
- clear_secondary_mem ();
-#endif
-
- /* Remember which hard regs appear explicitly
- before we merge into `regs_ever_live' the ones in which
- pseudo regs have been allocated. */
- bcopy (regs_ever_live, regs_explicitly_used, sizeof regs_ever_live);
-
- /* We don't have a stack slot for any spill reg yet. */
- bzero ((char *) spill_stack_slot, sizeof spill_stack_slot);
- bzero ((char *) spill_stack_slot_width, sizeof spill_stack_slot_width);
-
- /* Initialize the save area information for caller-save, in case some
- are needed. */
- init_save_areas ();
-
- /* Compute which hard registers are now in use
- as homes for pseudo registers.
- This is done here rather than (eg) in global_alloc
- because this point is reached even if not optimizing. */
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- mark_home_live (i);
-
- for (i = 0; i < scratch_list_length; i++)
- if (scratch_list[i])
- mark_scratch_live (scratch_list[i]);
-
- /* Make sure that the last insn in the chain
- is not something that needs reloading. */
- emit_note (NULL_PTR, NOTE_INSN_DELETED);
-
- /* Find all the pseudo registers that didn't get hard regs
- but do have known equivalent constants or memory slots.
- These include parameters (known equivalent to parameter slots)
- and cse'd or loop-moved constant memory addresses.
-
- Record constant equivalents in reg_equiv_constant
- so they will be substituted by find_reloads.
- Record memory equivalents in reg_mem_equiv so they can
- be substituted eventually by altering the REG-rtx's. */
-
- reg_equiv_constant = (rtx *) alloca (max_regno * sizeof (rtx));
- bzero ((char *) reg_equiv_constant, max_regno * sizeof (rtx));
- reg_equiv_memory_loc = (rtx *) alloca (max_regno * sizeof (rtx));
- bzero ((char *) reg_equiv_memory_loc, max_regno * sizeof (rtx));
- reg_equiv_mem = (rtx *) alloca (max_regno * sizeof (rtx));
- bzero ((char *) reg_equiv_mem, max_regno * sizeof (rtx));
- reg_equiv_init = (rtx *) alloca (max_regno * sizeof (rtx));
- bzero ((char *) reg_equiv_init, max_regno * sizeof (rtx));
- reg_equiv_address = (rtx *) alloca (max_regno * sizeof (rtx));
- bzero ((char *) reg_equiv_address, max_regno * sizeof (rtx));
- reg_max_ref_width = (int *) alloca (max_regno * sizeof (int));
- bzero ((char *) reg_max_ref_width, max_regno * sizeof (int));
- cannot_omit_stores = (char *) alloca (max_regno);
- bzero (cannot_omit_stores, max_regno);
-
-#ifdef SMALL_REGISTER_CLASSES
- if (SMALL_REGISTER_CLASSES)
- CLEAR_HARD_REG_SET (forbidden_regs);
-#endif
-
- /* Look for REG_EQUIV notes; record what each pseudo is equivalent to.
- Also find all paradoxical subregs and find largest such for each pseudo.
- On machines with small register classes, record hard registers that
- are used for user variables. These can never be used for spills.
- Also look for a "constant" NOTE_INSN_SETJMP. This means that all
- caller-saved registers must be marked live. */
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- rtx set = single_set (insn);
-
- if (GET_CODE (insn) == NOTE && CONST_CALL_P (insn)
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (! call_used_regs[i])
- regs_ever_live[i] = 1;
-
- if (set != 0 && GET_CODE (SET_DEST (set)) == REG)
- {
- rtx note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
- if (note
-#ifdef LEGITIMATE_PIC_OPERAND_P
- && (! CONSTANT_P (XEXP (note, 0)) || ! flag_pic
- || LEGITIMATE_PIC_OPERAND_P (XEXP (note, 0)))
-#endif
- )
- {
- rtx x = XEXP (note, 0);
- i = REGNO (SET_DEST (set));
- if (i > LAST_VIRTUAL_REGISTER)
- {
- if (GET_CODE (x) == MEM)
- reg_equiv_memory_loc[i] = x;
- else if (CONSTANT_P (x))
- {
- if (LEGITIMATE_CONSTANT_P (x))
- reg_equiv_constant[i] = x;
- else
- reg_equiv_memory_loc[i]
- = force_const_mem (GET_MODE (SET_DEST (set)), x);
- }
- else
- continue;
-
- /* If this register is being made equivalent to a MEM
- and the MEM is not SET_SRC, the equivalencing insn
- is one with the MEM as a SET_DEST and it occurs later.
- So don't mark this insn now. */
- if (GET_CODE (x) != MEM
- || rtx_equal_p (SET_SRC (set), x))
- reg_equiv_init[i] = insn;
- }
- }
- }
-
- /* If this insn is setting a MEM from a register equivalent to it,
- this is the equivalencing insn. */
- else if (set && GET_CODE (SET_DEST (set)) == MEM
- && GET_CODE (SET_SRC (set)) == REG
- && reg_equiv_memory_loc[REGNO (SET_SRC (set))]
- && rtx_equal_p (SET_DEST (set),
- reg_equiv_memory_loc[REGNO (SET_SRC (set))]))
- reg_equiv_init[REGNO (SET_SRC (set))] = insn;
-
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- scan_paradoxical_subregs (PATTERN (insn));
- }
-
- /* Does this function require a frame pointer? */
-
- frame_pointer_needed = (! flag_omit_frame_pointer
-#ifdef EXIT_IGNORE_STACK
- /* ?? If EXIT_IGNORE_STACK is set, we will not save
- and restore sp for alloca. So we can't eliminate
- the frame pointer in that case. At some point,
- we should improve this by emitting the
- sp-adjusting insns for this case. */
- || (current_function_calls_alloca
- && EXIT_IGNORE_STACK)
-#endif
- || FRAME_POINTER_REQUIRED);
-
- num_eliminable = 0;
-
- /* Initialize the table of registers to eliminate. The way we do this
- depends on how the eliminable registers were defined. */
-#ifdef ELIMINABLE_REGS
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- {
- ep->can_eliminate = ep->can_eliminate_previous
- = (CAN_ELIMINATE (ep->from, ep->to)
- && ! (ep->to == STACK_POINTER_REGNUM && frame_pointer_needed));
- }
-#else
- reg_eliminate[0].can_eliminate = reg_eliminate[0].can_eliminate_previous
- = ! frame_pointer_needed;
-#endif
-
- /* Count the number of eliminable registers and build the FROM and TO
- REG rtx's. Note that code in gen_rtx will cause, e.g.,
- gen_rtx (REG, Pmode, STACK_POINTER_REGNUM) to equal stack_pointer_rtx.
- We depend on this. */
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- {
- num_eliminable += ep->can_eliminate;
- ep->from_rtx = gen_rtx (REG, Pmode, ep->from);
- ep->to_rtx = gen_rtx (REG, Pmode, ep->to);
- }
-
- num_labels = max_label_num () - get_first_label_num ();
-
- /* Allocate the tables used to store offset information at labels. */
- offsets_known_at = (char *) alloca (num_labels);
- offsets_at
- = (int (*)[NUM_ELIMINABLE_REGS])
- alloca (num_labels * NUM_ELIMINABLE_REGS * sizeof (int));
-
- offsets_known_at -= get_first_label_num ();
- offsets_at -= get_first_label_num ();
-
- /* Alter each pseudo-reg rtx to contain its hard reg number.
- Assign stack slots to the pseudos that lack hard regs or equivalents.
- Do not touch virtual registers. */
-
- for (i = LAST_VIRTUAL_REGISTER + 1; i < max_regno; i++)
- alter_reg (i, -1);
-
- /* If we have some registers we think can be eliminated, scan all insns to
- see if there is an insn that sets one of these registers to something
- other than itself plus a constant. If so, the register cannot be
- eliminated. Doing this scan here eliminates an extra pass through the
- main reload loop in the most common case where register elimination
- cannot be done. */
- for (insn = first; insn && num_eliminable; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- note_stores (PATTERN (insn), mark_not_eliminable);
-
-#ifndef REGISTER_CONSTRAINTS
- /* If all the pseudo regs have hard regs,
- except for those that are never referenced,
- we know that no reloads are needed. */
- /* But that is not true if there are register constraints, since
- in that case some pseudos might be in the wrong kind of hard reg. */
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_renumber[i] == -1 && reg_n_refs[i] != 0)
- break;
-
- if (i == max_regno && num_eliminable == 0 && ! caller_save_needed)
- return;
-#endif
-
- /* Compute the order of preference for hard registers to spill.
- Store them by decreasing preference in potential_reload_regs. */
-
- order_regs_for_reload (global);
-
- /* So far, no hard regs have been spilled. */
- n_spills = 0;
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- spill_reg_order[i] = -1;
-
- /* Initialize to -1, which means take the first spill register. */
- last_spill_reg = -1;
-
- /* On most machines, we can't use any register explicitly used in the
- rtl as a spill register. But on some, we have to. Those will have
- taken care to keep the life of hard regs as short as possible. */
-
-#ifdef SMALL_REGISTER_CLASSES
- if (! SMALL_REGISTER_CLASSES)
-#endif
- COPY_HARD_REG_SET (forbidden_regs, bad_spill_regs);
-
- /* Spill any hard regs that we know we can't eliminate. */
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- if (! ep->can_eliminate)
- spill_hard_reg (ep->from, global, dumpfile, 1);
-
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- if (frame_pointer_needed)
- spill_hard_reg (HARD_FRAME_POINTER_REGNUM, global, dumpfile, 1);
-#endif
-
- if (global)
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- basic_block_needs[i] = (char *) alloca (n_basic_blocks);
- bzero (basic_block_needs[i], n_basic_blocks);
- }
-
- /* From now on, we need to emit any moves without making new pseudos. */
- reload_in_progress = 1;
-
- /* This loop scans the entire function each go-round
- and repeats until one repetition spills no additional hard regs. */
-
- /* This flag is set when a pseudo reg is spilled,
- to require another pass. Note that getting an additional reload
- reg does not necessarily imply any pseudo reg was spilled;
- sometimes we find a reload reg that no pseudo reg was allocated in. */
- something_changed = 1;
- /* This flag is set if there are any insns that require reloading. */
- something_needs_reloads = 0;
- /* This flag is set if there are any insns that require register
- eliminations. */
- something_needs_elimination = 0;
- while (something_changed)
- {
- rtx after_call = 0;
-
- /* For each class, number of reload regs needed in that class.
- This is the maximum over all insns of the needs in that class
- of the individual insn. */
- int max_needs[N_REG_CLASSES];
- /* For each class, size of group of consecutive regs
- that is needed for the reloads of this class. */
- int group_size[N_REG_CLASSES];
- /* For each class, max number of consecutive groups needed.
- (Each group contains group_size[CLASS] consecutive registers.) */
- int max_groups[N_REG_CLASSES];
- /* For each class, max number needed of regs that don't belong
- to any of the groups. */
- int max_nongroups[N_REG_CLASSES];
- /* For each class, the machine mode which requires consecutive
- groups of regs of that class.
- If two different modes ever require groups of one class,
- they must be the same size and equally restrictive for that class,
- otherwise we can't handle the complexity. */
- enum machine_mode group_mode[N_REG_CLASSES];
- /* Record the insn where each maximum need is first found. */
- rtx max_needs_insn[N_REG_CLASSES];
- rtx max_groups_insn[N_REG_CLASSES];
- rtx max_nongroups_insn[N_REG_CLASSES];
- rtx x;
- HOST_WIDE_INT starting_frame_size;
- int previous_frame_pointer_needed = frame_pointer_needed;
- static char *reg_class_names[] = REG_CLASS_NAMES;
-
- something_changed = 0;
- bzero ((char *) max_needs, sizeof max_needs);
- bzero ((char *) max_groups, sizeof max_groups);
- bzero ((char *) max_nongroups, sizeof max_nongroups);
- bzero ((char *) max_needs_insn, sizeof max_needs_insn);
- bzero ((char *) max_groups_insn, sizeof max_groups_insn);
- bzero ((char *) max_nongroups_insn, sizeof max_nongroups_insn);
- bzero ((char *) group_size, sizeof group_size);
- for (i = 0; i < N_REG_CLASSES; i++)
- group_mode[i] = VOIDmode;
-
- /* Keep track of which basic blocks are needing the reloads. */
- this_block = 0;
-
- /* Remember whether any element of basic_block_needs
- changes from 0 to 1 in this pass. */
- new_basic_block_needs = 0;
-
- /* Round size of stack frame to BIGGEST_ALIGNMENT. This must be done
- here because the stack size may be a part of the offset computation
- for register elimination, and there might have been new stack slots
- created in the last iteration of this loop. */
- assign_stack_local (BLKmode, 0, 0);
-
- starting_frame_size = get_frame_size ();
-
- /* Reset all offsets on eliminable registers to their initial values. */
-#ifdef ELIMINABLE_REGS
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- {
- INITIAL_ELIMINATION_OFFSET (ep->from, ep->to, ep->initial_offset);
- ep->previous_offset = ep->offset
- = ep->max_offset = ep->initial_offset;
- }
-#else
-#ifdef INITIAL_FRAME_POINTER_OFFSET
- INITIAL_FRAME_POINTER_OFFSET (reg_eliminate[0].initial_offset);
-#else
- if (!FRAME_POINTER_REQUIRED)
- abort ();
- reg_eliminate[0].initial_offset = 0;
-#endif
- reg_eliminate[0].previous_offset = reg_eliminate[0].max_offset
- = reg_eliminate[0].offset = reg_eliminate[0].initial_offset;
-#endif
-
- num_not_at_initial_offset = 0;
-
- bzero ((char *) &offsets_known_at[get_first_label_num ()], num_labels);
-
- /* Set a known offset for each forced label to be at the initial offset
- of each elimination. We do this because we assume that all
- computed jumps occur from a location where each elimination is
- at its initial offset. */
-
- for (x = forced_labels; x; x = XEXP (x, 1))
- if (XEXP (x, 0))
- set_label_offsets (XEXP (x, 0), NULL_RTX, 1);
-
- /* For each pseudo register that has an equivalent location defined,
- try to eliminate any eliminable registers (such as the frame pointer)
- assuming initial offsets for the replacement register, which
- is the normal case.
-
- If the resulting location is directly addressable, substitute
- the MEM we just got directly for the old REG.
-
- If it is not addressable but is a constant or the sum of a hard reg
- and constant, it is probably not addressable because the constant is
- out of range, in that case record the address; we will generate
- hairy code to compute the address in a register each time it is
- needed. Similarly if it is a hard register, but one that is not
- valid as an address register.
-
- If the location is not addressable, but does not have one of the
- above forms, assign a stack slot. We have to do this to avoid the
- potential of producing lots of reloads if, e.g., a location involves
- a pseudo that didn't get a hard register and has an equivalent memory
- location that also involves a pseudo that didn't get a hard register.
-
- Perhaps at some point we will improve reload_when_needed handling
- so this problem goes away. But that's very hairy. */
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_renumber[i] < 0 && reg_equiv_memory_loc[i])
- {
- rtx x = eliminate_regs (reg_equiv_memory_loc[i], 0, NULL_RTX, 0);
-
- if (strict_memory_address_p (GET_MODE (regno_reg_rtx[i]),
- XEXP (x, 0)))
- reg_equiv_mem[i] = x, reg_equiv_address[i] = 0;
- else if (CONSTANT_P (XEXP (x, 0))
- || (GET_CODE (XEXP (x, 0)) == REG
- && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
- || (GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
- && (REGNO (XEXP (XEXP (x, 0), 0))
- < FIRST_PSEUDO_REGISTER)
- && CONSTANT_P (XEXP (XEXP (x, 0), 1))))
- reg_equiv_address[i] = XEXP (x, 0), reg_equiv_mem[i] = 0;
- else
- {
- /* Make a new stack slot. Then indicate that something
- changed so we go back and recompute offsets for
- eliminable registers because the allocation of memory
- below might change some offset. reg_equiv_{mem,address}
- will be set up for this pseudo on the next pass around
- the loop. */
- reg_equiv_memory_loc[i] = 0;
- reg_equiv_init[i] = 0;
- alter_reg (i, -1);
- something_changed = 1;
- }
- }
-
- /* If we allocated another pseudo to the stack, redo elimination
- bookkeeping. */
- if (something_changed)
- continue;
-
- /* If caller-saves needs a group, initialize the group to include
- the size and mode required for caller-saves. */
-
- if (caller_save_group_size > 1)
- {
- group_mode[(int) caller_save_spill_class] = Pmode;
- group_size[(int) caller_save_spill_class] = caller_save_group_size;
- }
-
- /* Compute the most additional registers needed by any instruction.
- Collect information separately for each class of regs. */
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- if (global && this_block + 1 < n_basic_blocks
- && insn == basic_block_head[this_block+1])
- ++this_block;
-
- /* If this is a label, a JUMP_INSN, or has REG_NOTES (which
- might include REG_LABEL), we need to see what effects this
- has on the known offsets at labels. */
-
- if (GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == JUMP_INSN
- || (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && REG_NOTES (insn) != 0))
- set_label_offsets (insn, insn, 0);
-
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- /* Nonzero means don't use a reload reg that overlaps
- the place where a function value can be returned. */
- rtx avoid_return_reg = 0;
-
- rtx old_body = PATTERN (insn);
- int old_code = INSN_CODE (insn);
- rtx old_notes = REG_NOTES (insn);
- int did_elimination = 0;
-
- /* To compute the number of reload registers of each class
- needed for an insn, we must simulate what choose_reload_regs
- can do. We do this by splitting an insn into an "input" and
- an "output" part. RELOAD_OTHER reloads are used in both.
- The input part uses those reloads, RELOAD_FOR_INPUT reloads,
- which must be live over the entire input section of reloads,
- and the maximum of all the RELOAD_FOR_INPUT_ADDRESS and
- RELOAD_FOR_OPERAND_ADDRESS reloads, which conflict with the
- inputs.
-
- The registers needed for output are RELOAD_OTHER and
- RELOAD_FOR_OUTPUT, which are live for the entire output
- portion, and the maximum of all the RELOAD_FOR_OUTPUT_ADDRESS
- reloads for each operand.
-
- The total number of registers needed is the maximum of the
- inputs and outputs. */
-
- struct needs
- {
- /* [0] is normal, [1] is nongroup. */
- int regs[2][N_REG_CLASSES];
- int groups[N_REG_CLASSES];
- };
-
- /* Each `struct needs' corresponds to one RELOAD_... type. */
- struct {
- struct needs other;
- struct needs input;
- struct needs output;
- struct needs insn;
- struct needs other_addr;
- struct needs op_addr;
- struct needs op_addr_reload;
- struct needs in_addr[MAX_RECOG_OPERANDS];
- struct needs in_addr_addr[MAX_RECOG_OPERANDS];
- struct needs out_addr[MAX_RECOG_OPERANDS];
- struct needs out_addr_addr[MAX_RECOG_OPERANDS];
- } insn_needs;
-
- /* If needed, eliminate any eliminable registers. */
- if (num_eliminable)
- did_elimination = eliminate_regs_in_insn (insn, 0);
-
-#ifdef SMALL_REGISTER_CLASSES
- /* Set avoid_return_reg if this is an insn
- that might use the value of a function call. */
- if (SMALL_REGISTER_CLASSES && GET_CODE (insn) == CALL_INSN)
- {
- if (GET_CODE (PATTERN (insn)) == SET)
- after_call = SET_DEST (PATTERN (insn));
- else if (GET_CODE (PATTERN (insn)) == PARALLEL
- && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET)
- after_call = SET_DEST (XVECEXP (PATTERN (insn), 0, 0));
- else
- after_call = 0;
- }
- else if (SMALL_REGISTER_CLASSES
- && after_call != 0
- && !(GET_CODE (PATTERN (insn)) == SET
- && SET_DEST (PATTERN (insn)) == stack_pointer_rtx))
- {
- if (reg_referenced_p (after_call, PATTERN (insn)))
- avoid_return_reg = after_call;
- after_call = 0;
- }
-#endif /* SMALL_REGISTER_CLASSES */
-
- /* Analyze the instruction. */
- find_reloads (insn, 0, spill_indirect_levels, global,
- spill_reg_order);
-
- /* Remember for later shortcuts which insns had any reloads or
- register eliminations.
-
- One might think that it would be worthwhile to mark insns
- that need register replacements but not reloads, but this is
- not safe because find_reloads may do some manipulation of
- the insn (such as swapping commutative operands), which would
- be lost when we restore the old pattern after register
- replacement. So the actions of find_reloads must be redone in
- subsequent passes or in reload_as_needed.
-
- However, it is safe to mark insns that need reloads
- but not register replacement. */
-
- PUT_MODE (insn, (did_elimination ? QImode
- : n_reloads ? HImode
- : GET_MODE (insn) == DImode ? DImode
- : VOIDmode));
-
- /* Discard any register replacements done. */
- if (did_elimination)
- {
- obstack_free (&reload_obstack, reload_firstobj);
- PATTERN (insn) = old_body;
- INSN_CODE (insn) = old_code;
- REG_NOTES (insn) = old_notes;
- something_needs_elimination = 1;
- }
-
- /* If this insn has no reloads, we need not do anything except
- in the case of a CALL_INSN when we have caller-saves and
- caller-save needs reloads. */
-
- if (n_reloads == 0
- && ! (GET_CODE (insn) == CALL_INSN
- && caller_save_spill_class != NO_REGS))
- continue;
-
- something_needs_reloads = 1;
- bzero ((char *) &insn_needs, sizeof insn_needs);
-
- /* Count each reload once in every class
- containing the reload's own class. */
-
- for (i = 0; i < n_reloads; i++)
- {
- register enum reg_class *p;
- enum reg_class class = reload_reg_class[i];
- int size;
- enum machine_mode mode;
- int nongroup_need;
- struct needs *this_needs;
-
- /* Don't count the dummy reloads, for which one of the
- regs mentioned in the insn can be used for reloading.
- Don't count optional reloads.
- Don't count reloads that got combined with others. */
- if (reload_reg_rtx[i] != 0
- || reload_optional[i] != 0
- || (reload_out[i] == 0 && reload_in[i] == 0
- && ! reload_secondary_p[i]))
- continue;
-
- /* Show that a reload register of this class is needed
- in this basic block. We do not use insn_needs and
- insn_groups because they are overly conservative for
- this purpose. */
- if (global && ! basic_block_needs[(int) class][this_block])
- {
- basic_block_needs[(int) class][this_block] = 1;
- new_basic_block_needs = 1;
- }
-
-
- mode = reload_inmode[i];
- if (GET_MODE_SIZE (reload_outmode[i]) > GET_MODE_SIZE (mode))
- mode = reload_outmode[i];
- size = CLASS_MAX_NREGS (class, mode);
-
- /* If this class doesn't want a group, determine if we have
- a nongroup need or a regular need. We have a nongroup
- need if this reload conflicts with a group reload whose
- class intersects with this reload's class. */
-
- nongroup_need = 0;
- if (size == 1)
- for (j = 0; j < n_reloads; j++)
- if ((CLASS_MAX_NREGS (reload_reg_class[j],
- (GET_MODE_SIZE (reload_outmode[j])
- > GET_MODE_SIZE (reload_inmode[j]))
- ? reload_outmode[j]
- : reload_inmode[j])
- > 1)
- && (!reload_optional[j])
- && (reload_in[j] != 0 || reload_out[j] != 0
- || reload_secondary_p[j])
- && reloads_conflict (i, j)
- && reg_classes_intersect_p (class,
- reload_reg_class[j]))
- {
- nongroup_need = 1;
- break;
- }
-
- /* Decide which time-of-use to count this reload for. */
- switch (reload_when_needed[i])
- {
- case RELOAD_OTHER:
- this_needs = &insn_needs.other;
- break;
- case RELOAD_FOR_INPUT:
- this_needs = &insn_needs.input;
- break;
- case RELOAD_FOR_OUTPUT:
- this_needs = &insn_needs.output;
- break;
- case RELOAD_FOR_INSN:
- this_needs = &insn_needs.insn;
- break;
- case RELOAD_FOR_OTHER_ADDRESS:
- this_needs = &insn_needs.other_addr;
- break;
- case RELOAD_FOR_INPUT_ADDRESS:
- this_needs = &insn_needs.in_addr[reload_opnum[i]];
- break;
- case RELOAD_FOR_INPADDR_ADDRESS:
- this_needs = &insn_needs.in_addr_addr[reload_opnum[i]];
- break;
- case RELOAD_FOR_OUTPUT_ADDRESS:
- this_needs = &insn_needs.out_addr[reload_opnum[i]];
- break;
- case RELOAD_FOR_OUTADDR_ADDRESS:
- this_needs = &insn_needs.out_addr_addr[reload_opnum[i]];
- break;
- case RELOAD_FOR_OPERAND_ADDRESS:
- this_needs = &insn_needs.op_addr;
- break;
- case RELOAD_FOR_OPADDR_ADDR:
- this_needs = &insn_needs.op_addr_reload;
- break;
- }
-
- if (size > 1)
- {
- enum machine_mode other_mode, allocate_mode;
-
- /* Count number of groups needed separately from
- number of individual regs needed. */
- this_needs->groups[(int) class]++;
- p = reg_class_superclasses[(int) class];
- while (*p != LIM_REG_CLASSES)
- this_needs->groups[(int) *p++]++;
-
- /* Record size and mode of a group of this class. */
- /* If more than one size group is needed,
- make all groups the largest needed size. */
- if (group_size[(int) class] < size)
- {
- other_mode = group_mode[(int) class];
- allocate_mode = mode;
-
- group_size[(int) class] = size;
- group_mode[(int) class] = mode;
- }
- else
- {
- other_mode = mode;
- allocate_mode = group_mode[(int) class];
- }
-
- /* Crash if two dissimilar machine modes both need
- groups of consecutive regs of the same class. */
-
- if (other_mode != VOIDmode && other_mode != allocate_mode
- && ! modes_equiv_for_class_p (allocate_mode,
- other_mode, class))
- fatal_insn ("Two dissimilar machine modes both need groups of consecutive regs of the same class",
- insn);
- }
- else if (size == 1)
- {
- this_needs->regs[nongroup_need][(int) class] += 1;
- p = reg_class_superclasses[(int) class];
- while (*p != LIM_REG_CLASSES)
- this_needs->regs[nongroup_need][(int) *p++] += 1;
- }
- else
- abort ();
- }
-
- /* All reloads have been counted for this insn;
- now merge the various times of use.
- This sets insn_needs, etc., to the maximum total number
- of registers needed at any point in this insn. */
-
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- int in_max, out_max;
-
- /* Compute normal and nongroup needs. */
- for (j = 0; j <= 1; j++)
- {
- for (in_max = 0, out_max = 0, k = 0;
- k < reload_n_operands; k++)
- {
- in_max
- = MAX (in_max, insn_needs.in_addr[k].regs[j][i]);
- in_max
- = MAX (in_max,
- insn_needs.in_addr_addr[k].regs[j][i]);
- out_max
- = MAX (out_max, insn_needs.out_addr[k].regs[j][i]);
- out_max
- = MAX (out_max,
- insn_needs.out_addr_addr[k].regs[j][i]);
- }
-
- /* RELOAD_FOR_INSN reloads conflict with inputs, outputs,
- and operand addresses but not things used to reload
- them. Similarly, RELOAD_FOR_OPERAND_ADDRESS reloads
- don't conflict with things needed to reload inputs or
- outputs. */
-
- in_max = MAX (MAX (insn_needs.op_addr.regs[j][i],
- insn_needs.op_addr_reload.regs[j][i]),
- in_max);
-
- out_max = MAX (out_max, insn_needs.insn.regs[j][i]);
-
- insn_needs.input.regs[j][i]
- = MAX (insn_needs.input.regs[j][i]
- + insn_needs.op_addr.regs[j][i]
- + insn_needs.insn.regs[j][i],
- in_max + insn_needs.input.regs[j][i]);
-
- insn_needs.output.regs[j][i] += out_max;
- insn_needs.other.regs[j][i]
- += MAX (MAX (insn_needs.input.regs[j][i],
- insn_needs.output.regs[j][i]),
- insn_needs.other_addr.regs[j][i]);
-
- }
-
- /* Now compute group needs. */
- for (in_max = 0, out_max = 0, j = 0;
- j < reload_n_operands; j++)
- {
- in_max = MAX (in_max, insn_needs.in_addr[j].groups[i]);
- in_max = MAX (in_max,
- insn_needs.in_addr_addr[j].groups[i]);
- out_max
- = MAX (out_max, insn_needs.out_addr[j].groups[i]);
- out_max
- = MAX (out_max, insn_needs.out_addr_addr[j].groups[i]);
- }
-
- in_max = MAX (MAX (insn_needs.op_addr.groups[i],
- insn_needs.op_addr_reload.groups[i]),
- in_max);
- out_max = MAX (out_max, insn_needs.insn.groups[i]);
-
- insn_needs.input.groups[i]
- = MAX (insn_needs.input.groups[i]
- + insn_needs.op_addr.groups[i]
- + insn_needs.insn.groups[i],
- in_max + insn_needs.input.groups[i]);
-
- insn_needs.output.groups[i] += out_max;
- insn_needs.other.groups[i]
- += MAX (MAX (insn_needs.input.groups[i],
- insn_needs.output.groups[i]),
- insn_needs.other_addr.groups[i]);
- }
-
- /* If this is a CALL_INSN and caller-saves will need
- a spill register, act as if the spill register is
- needed for this insn. However, the spill register
- can be used by any reload of this insn, so we only
- need do something if no need for that class has
- been recorded.
-
- The assumption that every CALL_INSN will trigger a
- caller-save is highly conservative, however, the number
- of cases where caller-saves will need a spill register but
- a block containing a CALL_INSN won't need a spill register
- of that class should be quite rare.
-
- If a group is needed, the size and mode of the group will
- have been set up at the beginning of this loop. */
-
- if (GET_CODE (insn) == CALL_INSN
- && caller_save_spill_class != NO_REGS)
- {
- /* See if this register would conflict with any reload
- that needs a group. */
- int nongroup_need = 0;
- int *caller_save_needs;
-
- for (j = 0; j < n_reloads; j++)
- if ((CLASS_MAX_NREGS (reload_reg_class[j],
- (GET_MODE_SIZE (reload_outmode[j])
- > GET_MODE_SIZE (reload_inmode[j]))
- ? reload_outmode[j]
- : reload_inmode[j])
- > 1)
- && reg_classes_intersect_p (caller_save_spill_class,
- reload_reg_class[j]))
- {
- nongroup_need = 1;
- break;
- }
-
- caller_save_needs
- = (caller_save_group_size > 1
- ? insn_needs.other.groups
- : insn_needs.other.regs[nongroup_need]);
-
- if (caller_save_needs[(int) caller_save_spill_class] == 0)
- {
- register enum reg_class *p
- = reg_class_superclasses[(int) caller_save_spill_class];
-
- caller_save_needs[(int) caller_save_spill_class]++;
-
- while (*p != LIM_REG_CLASSES)
- caller_save_needs[(int) *p++] += 1;
- }
-
- /* Show that this basic block will need a register of
- this class. */
-
- if (global
- && ! (basic_block_needs[(int) caller_save_spill_class]
- [this_block]))
- {
- basic_block_needs[(int) caller_save_spill_class]
- [this_block] = 1;
- new_basic_block_needs = 1;
- }
- }
-
-#ifdef SMALL_REGISTER_CLASSES
- /* If this insn stores the value of a function call,
- and that value is in a register that has been spilled,
- and if the insn needs a reload in a class
- that might use that register as the reload register,
- then add add an extra need in that class.
- This makes sure we have a register available that does
- not overlap the return value. */
-
- if (SMALL_REGISTER_CLASSES && avoid_return_reg)
- {
- int regno = REGNO (avoid_return_reg);
- int nregs
- = HARD_REGNO_NREGS (regno, GET_MODE (avoid_return_reg));
- int r;
- int basic_needs[N_REG_CLASSES], basic_groups[N_REG_CLASSES];
-
- /* First compute the "basic needs", which counts a
- need only in the smallest class in which it
- is required. */
-
- bcopy ((char *) insn_needs.other.regs[0],
- (char *) basic_needs, sizeof basic_needs);
- bcopy ((char *) insn_needs.other.groups,
- (char *) basic_groups, sizeof basic_groups);
-
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- enum reg_class *p;
-
- if (basic_needs[i] >= 0)
- for (p = reg_class_superclasses[i];
- *p != LIM_REG_CLASSES; p++)
- basic_needs[(int) *p] -= basic_needs[i];
-
- if (basic_groups[i] >= 0)
- for (p = reg_class_superclasses[i];
- *p != LIM_REG_CLASSES; p++)
- basic_groups[(int) *p] -= basic_groups[i];
- }
-
- /* Now count extra regs if there might be a conflict with
- the return value register. */
-
- for (r = regno; r < regno + nregs; r++)
- if (spill_reg_order[r] >= 0)
- for (i = 0; i < N_REG_CLASSES; i++)
- if (TEST_HARD_REG_BIT (reg_class_contents[i], r))
- {
- if (basic_needs[i] > 0)
- {
- enum reg_class *p;
-
- insn_needs.other.regs[0][i]++;
- p = reg_class_superclasses[i];
- while (*p != LIM_REG_CLASSES)
- insn_needs.other.regs[0][(int) *p++]++;
- }
- if (basic_groups[i] > 0)
- {
- enum reg_class *p;
-
- insn_needs.other.groups[i]++;
- p = reg_class_superclasses[i];
- while (*p != LIM_REG_CLASSES)
- insn_needs.other.groups[(int) *p++]++;
- }
- }
- }
-#endif /* SMALL_REGISTER_CLASSES */
-
- /* For each class, collect maximum need of any insn. */
-
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- if (max_needs[i] < insn_needs.other.regs[0][i])
- {
- max_needs[i] = insn_needs.other.regs[0][i];
- max_needs_insn[i] = insn;
- }
- if (max_groups[i] < insn_needs.other.groups[i])
- {
- max_groups[i] = insn_needs.other.groups[i];
- max_groups_insn[i] = insn;
- }
- if (max_nongroups[i] < insn_needs.other.regs[1][i])
- {
- max_nongroups[i] = insn_needs.other.regs[1][i];
- max_nongroups_insn[i] = insn;
- }
- }
- }
- /* Note that there is a continue statement above. */
- }
-
- /* If we allocated any new memory locations, make another pass
- since it might have changed elimination offsets. */
- if (starting_frame_size != get_frame_size ())
- something_changed = 1;
-
- if (dumpfile)
- for (i = 0; i < N_REG_CLASSES; i++)
- {
- if (max_needs[i] > 0)
- fprintf (dumpfile,
- ";; Need %d reg%s of class %s (for insn %d).\n",
- max_needs[i], max_needs[i] == 1 ? "" : "s",
- reg_class_names[i], INSN_UID (max_needs_insn[i]));
- if (max_nongroups[i] > 0)
- fprintf (dumpfile,
- ";; Need %d nongroup reg%s of class %s (for insn %d).\n",
- max_nongroups[i], max_nongroups[i] == 1 ? "" : "s",
- reg_class_names[i], INSN_UID (max_nongroups_insn[i]));
- if (max_groups[i] > 0)
- fprintf (dumpfile,
- ";; Need %d group%s (%smode) of class %s (for insn %d).\n",
- max_groups[i], max_groups[i] == 1 ? "" : "s",
- mode_name[(int) group_mode[i]],
- reg_class_names[i], INSN_UID (max_groups_insn[i]));
- }
-
- /* If we have caller-saves, set up the save areas and see if caller-save
- will need a spill register. */
-
- if (caller_save_needed)
- {
- /* Set the offsets for setup_save_areas. */
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
- ep++)
- ep->previous_offset = ep->max_offset;
-
- if ( ! setup_save_areas (&something_changed)
- && caller_save_spill_class == NO_REGS)
- {
- /* The class we will need depends on whether the machine
- supports the sum of two registers for an address; see
- find_address_reloads for details. */
-
- caller_save_spill_class
- = double_reg_address_ok ? INDEX_REG_CLASS : BASE_REG_CLASS;
- caller_save_group_size
- = CLASS_MAX_NREGS (caller_save_spill_class, Pmode);
- something_changed = 1;
- }
- }
-
- /* See if anything that happened changes which eliminations are valid.
- For example, on the Sparc, whether or not the frame pointer can
- be eliminated can depend on what registers have been used. We need
- not check some conditions again (such as flag_omit_frame_pointer)
- since they can't have changed. */
-
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- if ((ep->from == HARD_FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED)
-#ifdef ELIMINABLE_REGS
- || ! CAN_ELIMINATE (ep->from, ep->to)
-#endif
- )
- ep->can_eliminate = 0;
-
- /* Look for the case where we have discovered that we can't replace
- register A with register B and that means that we will now be
- trying to replace register A with register C. This means we can
- no longer replace register C with register B and we need to disable
- such an elimination, if it exists. This occurs often with A == ap,
- B == sp, and C == fp. */
-
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- {
- struct elim_table *op;
- register int new_to = -1;
-
- if (! ep->can_eliminate && ep->can_eliminate_previous)
- {
- /* Find the current elimination for ep->from, if there is a
- new one. */
- for (op = reg_eliminate;
- op < &reg_eliminate[NUM_ELIMINABLE_REGS]; op++)
- if (op->from == ep->from && op->can_eliminate)
- {
- new_to = op->to;
- break;
- }
-
- /* See if there is an elimination of NEW_TO -> EP->TO. If so,
- disable it. */
- for (op = reg_eliminate;
- op < &reg_eliminate[NUM_ELIMINABLE_REGS]; op++)
- if (op->from == new_to && op->to == ep->to)
- op->can_eliminate = 0;
- }
- }
-
- /* See if any registers that we thought we could eliminate the previous
- time are no longer eliminable. If so, something has changed and we
- must spill the register. Also, recompute the number of eliminable
- registers and see if the frame pointer is needed; it is if there is
- no elimination of the frame pointer that we can perform. */
-
- frame_pointer_needed = 1;
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- {
- if (ep->can_eliminate && ep->from == FRAME_POINTER_REGNUM
- && ep->to != HARD_FRAME_POINTER_REGNUM)
- frame_pointer_needed = 0;
-
- if (! ep->can_eliminate && ep->can_eliminate_previous)
- {
- ep->can_eliminate_previous = 0;
- spill_hard_reg (ep->from, global, dumpfile, 1);
- something_changed = 1;
- num_eliminable--;
- }
- }
-
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- /* If we didn't need a frame pointer last time, but we do now, spill
- the hard frame pointer. */
- if (frame_pointer_needed && ! previous_frame_pointer_needed)
- {
- spill_hard_reg (HARD_FRAME_POINTER_REGNUM, global, dumpfile, 1);
- something_changed = 1;
- }
-#endif
-
- /* If all needs are met, we win. */
-
- for (i = 0; i < N_REG_CLASSES; i++)
- if (max_needs[i] > 0 || max_groups[i] > 0 || max_nongroups[i] > 0)
- break;
- if (i == N_REG_CLASSES && !new_basic_block_needs && ! something_changed)
- break;
-
- /* Not all needs are met; must spill some hard regs. */
-
- /* Put all registers spilled so far back in potential_reload_regs, but
- put them at the front, since we've already spilled most of the
- pseudos in them (we might have left some pseudos unspilled if they
- were in a block that didn't need any spill registers of a conflicting
- class. We used to try to mark off the need for those registers,
- but doing so properly is very complex and reallocating them is the
- simpler approach. First, "pack" potential_reload_regs by pushing
- any nonnegative entries towards the end. That will leave room
- for the registers we already spilled.
-
- Also, undo the marking of the spill registers from the last time
- around in FORBIDDEN_REGS since we will be probably be allocating
- them again below.
-
- ??? It is theoretically possible that we might end up not using one
- of our previously-spilled registers in this allocation, even though
- they are at the head of the list. It's not clear what to do about
- this, but it was no better before, when we marked off the needs met
- by the previously-spilled registers. With the current code, globals
- can be allocated into these registers, but locals cannot. */
-
- if (n_spills)
- {
- for (i = j = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--)
- if (potential_reload_regs[i] != -1)
- potential_reload_regs[j--] = potential_reload_regs[i];
-
- for (i = 0; i < n_spills; i++)
- {
- potential_reload_regs[i] = spill_regs[i];
- spill_reg_order[spill_regs[i]] = -1;
- CLEAR_HARD_REG_BIT (forbidden_regs, spill_regs[i]);
- }
-
- n_spills = 0;
- }
-
- /* Now find more reload regs to satisfy the remaining need
- Do it by ascending class number, since otherwise a reg
- might be spilled for a big class and might fail to count
- for a smaller class even though it belongs to that class.
-
- Count spilled regs in `spills', and add entries to
- `spill_regs' and `spill_reg_order'.
-
- ??? Note there is a problem here.
- When there is a need for a group in a high-numbered class,
- and also need for non-group regs that come from a lower class,
- the non-group regs are chosen first. If there aren't many regs,
- they might leave no room for a group.
-
- This was happening on the 386. To fix it, we added the code
- that calls possible_group_p, so that the lower class won't
- break up the last possible group.
-
- Really fixing the problem would require changes above
- in counting the regs already spilled, and in choose_reload_regs.
- It might be hard to avoid introducing bugs there. */
-
- CLEAR_HARD_REG_SET (counted_for_groups);
- CLEAR_HARD_REG_SET (counted_for_nongroups);
-
- for (class = 0; class < N_REG_CLASSES; class++)
- {
- /* First get the groups of registers.
- If we got single registers first, we might fragment
- possible groups. */
- while (max_groups[class] > 0)
- {
- /* If any single spilled regs happen to form groups,
- count them now. Maybe we don't really need
- to spill another group. */
- count_possible_groups (group_size, group_mode, max_groups,
- class);
-
- if (max_groups[class] <= 0)
- break;
-
- /* Groups of size 2 (the only groups used on most machines)
- are treated specially. */
- if (group_size[class] == 2)
- {
- /* First, look for a register that will complete a group. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- int other;
-
- j = potential_reload_regs[i];
- if (j >= 0 && ! TEST_HARD_REG_BIT (bad_spill_regs, j)
- &&
- ((j > 0 && (other = j - 1, spill_reg_order[other] >= 0)
- && TEST_HARD_REG_BIT (reg_class_contents[class], j)
- && TEST_HARD_REG_BIT (reg_class_contents[class], other)
- && HARD_REGNO_MODE_OK (other, group_mode[class])
- && ! TEST_HARD_REG_BIT (counted_for_nongroups,
- other)
- /* We don't want one part of another group.
- We could get "two groups" that overlap! */
- && ! TEST_HARD_REG_BIT (counted_for_groups, other))
- ||
- (j < FIRST_PSEUDO_REGISTER - 1
- && (other = j + 1, spill_reg_order[other] >= 0)
- && TEST_HARD_REG_BIT (reg_class_contents[class], j)
- && TEST_HARD_REG_BIT (reg_class_contents[class], other)
- && HARD_REGNO_MODE_OK (j, group_mode[class])
- && ! TEST_HARD_REG_BIT (counted_for_nongroups,
- other)
- && ! TEST_HARD_REG_BIT (counted_for_groups,
- other))))
- {
- register enum reg_class *p;
-
- /* We have found one that will complete a group,
- so count off one group as provided. */
- max_groups[class]--;
- p = reg_class_superclasses[class];
- while (*p != LIM_REG_CLASSES)
- {
- if (group_size [(int) *p] <= group_size [class])
- max_groups[(int) *p]--;
- p++;
- }
-
- /* Indicate both these regs are part of a group. */
- SET_HARD_REG_BIT (counted_for_groups, j);
- SET_HARD_REG_BIT (counted_for_groups, other);
- break;
- }
- }
- /* We can't complete a group, so start one. */
-#ifdef SMALL_REGISTER_CLASSES
- /* Look for a pair neither of which is explicitly used. */
- if (SMALL_REGISTER_CLASSES && i == FIRST_PSEUDO_REGISTER)
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- int k;
- j = potential_reload_regs[i];
- /* Verify that J+1 is a potential reload reg. */
- for (k = 0; k < FIRST_PSEUDO_REGISTER; k++)
- if (potential_reload_regs[k] == j + 1)
- break;
- if (j >= 0 && j + 1 < FIRST_PSEUDO_REGISTER
- && k < FIRST_PSEUDO_REGISTER
- && spill_reg_order[j] < 0 && spill_reg_order[j + 1] < 0
- && TEST_HARD_REG_BIT (reg_class_contents[class], j)
- && TEST_HARD_REG_BIT (reg_class_contents[class], j + 1)
- && HARD_REGNO_MODE_OK (j, group_mode[class])
- && ! TEST_HARD_REG_BIT (counted_for_nongroups,
- j + 1)
- && ! TEST_HARD_REG_BIT (bad_spill_regs, j + 1)
- /* Reject J at this stage
- if J+1 was explicitly used. */
- && ! regs_explicitly_used[j + 1])
- break;
- }
-#endif
- /* Now try any group at all
- whose registers are not in bad_spill_regs. */
- if (i == FIRST_PSEUDO_REGISTER)
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- int k;
- j = potential_reload_regs[i];
- /* Verify that J+1 is a potential reload reg. */
- for (k = 0; k < FIRST_PSEUDO_REGISTER; k++)
- if (potential_reload_regs[k] == j + 1)
- break;
- if (j >= 0 && j + 1 < FIRST_PSEUDO_REGISTER
- && k < FIRST_PSEUDO_REGISTER
- && spill_reg_order[j] < 0 && spill_reg_order[j + 1] < 0
- && TEST_HARD_REG_BIT (reg_class_contents[class], j)
- && TEST_HARD_REG_BIT (reg_class_contents[class], j + 1)
- && HARD_REGNO_MODE_OK (j, group_mode[class])
- && ! TEST_HARD_REG_BIT (counted_for_nongroups,
- j + 1)
- && ! TEST_HARD_REG_BIT (bad_spill_regs, j + 1))
- break;
- }
-
- /* I should be the index in potential_reload_regs
- of the new reload reg we have found. */
-
- if (i >= FIRST_PSEUDO_REGISTER)
- {
- /* There are no groups left to spill. */
- spill_failure (max_groups_insn[class]);
- failure = 1;
- goto failed;
- }
- else
- something_changed
- |= new_spill_reg (i, class, max_needs, NULL_PTR,
- global, dumpfile);
- }
- else
- {
- /* For groups of more than 2 registers,
- look for a sufficient sequence of unspilled registers,
- and spill them all at once. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- int k;
-
- j = potential_reload_regs[i];
- if (j >= 0
- && j + group_size[class] <= FIRST_PSEUDO_REGISTER
- && HARD_REGNO_MODE_OK (j, group_mode[class]))
- {
- /* Check each reg in the sequence. */
- for (k = 0; k < group_size[class]; k++)
- if (! (spill_reg_order[j + k] < 0
- && ! TEST_HARD_REG_BIT (bad_spill_regs, j + k)
- && TEST_HARD_REG_BIT (reg_class_contents[class], j + k)))
- break;
- /* We got a full sequence, so spill them all. */
- if (k == group_size[class])
- {
- register enum reg_class *p;
- for (k = 0; k < group_size[class]; k++)
- {
- int idx;
- SET_HARD_REG_BIT (counted_for_groups, j + k);
- for (idx = 0; idx < FIRST_PSEUDO_REGISTER; idx++)
- if (potential_reload_regs[idx] == j + k)
- break;
- something_changed
- |= new_spill_reg (idx, class,
- max_needs, NULL_PTR,
- global, dumpfile);
- }
-
- /* We have found one that will complete a group,
- so count off one group as provided. */
- max_groups[class]--;
- p = reg_class_superclasses[class];
- while (*p != LIM_REG_CLASSES)
- {
- if (group_size [(int) *p]
- <= group_size [class])
- max_groups[(int) *p]--;
- p++;
- }
- break;
- }
- }
- }
- /* We couldn't find any registers for this reload.
- Avoid going into an infinite loop. */
- if (i >= FIRST_PSEUDO_REGISTER)
- {
- /* There are no groups left. */
- spill_failure (max_groups_insn[class]);
- failure = 1;
- goto failed;
- }
- }
- }
-
- /* Now similarly satisfy all need for single registers. */
-
- while (max_needs[class] > 0 || max_nongroups[class] > 0)
- {
- /* If we spilled enough regs, but they weren't counted
- against the non-group need, see if we can count them now.
- If so, we can avoid some actual spilling. */
- if (max_needs[class] <= 0 && max_nongroups[class] > 0)
- for (i = 0; i < n_spills; i++)
- if (TEST_HARD_REG_BIT (reg_class_contents[class],
- spill_regs[i])
- && !TEST_HARD_REG_BIT (counted_for_groups,
- spill_regs[i])
- && !TEST_HARD_REG_BIT (counted_for_nongroups,
- spill_regs[i])
- && max_nongroups[class] > 0)
- {
- register enum reg_class *p;
-
- SET_HARD_REG_BIT (counted_for_nongroups, spill_regs[i]);
- max_nongroups[class]--;
- p = reg_class_superclasses[class];
- while (*p != LIM_REG_CLASSES)
- max_nongroups[(int) *p++]--;
- }
- if (max_needs[class] <= 0 && max_nongroups[class] <= 0)
- break;
-
- /* Consider the potential reload regs that aren't
- yet in use as reload regs, in order of preference.
- Find the most preferred one that's in this class. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (potential_reload_regs[i] >= 0
- && TEST_HARD_REG_BIT (reg_class_contents[class],
- potential_reload_regs[i])
- /* If this reg will not be available for groups,
- pick one that does not foreclose possible groups.
- This is a kludge, and not very general,
- but it should be sufficient to make the 386 work,
- and the problem should not occur on machines with
- more registers. */
- && (max_nongroups[class] == 0
- || possible_group_p (potential_reload_regs[i], max_groups)))
- break;
-
- /* If we couldn't get a register, try to get one even if we
- might foreclose possible groups. This may cause problems
- later, but that's better than aborting now, since it is
- possible that we will, in fact, be able to form the needed
- group even with this allocation. */
-
- if (i >= FIRST_PSEUDO_REGISTER
- && (asm_noperands (max_needs[class] > 0
- ? max_needs_insn[class]
- : max_nongroups_insn[class])
- < 0))
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (potential_reload_regs[i] >= 0
- && TEST_HARD_REG_BIT (reg_class_contents[class],
- potential_reload_regs[i]))
- break;
-
- /* I should be the index in potential_reload_regs
- of the new reload reg we have found. */
-
- if (i >= FIRST_PSEUDO_REGISTER)
- {
- /* There are no possible registers left to spill. */
- spill_failure (max_needs[class] > 0 ? max_needs_insn[class]
- : max_nongroups_insn[class]);
- failure = 1;
- goto failed;
- }
- else
- something_changed
- |= new_spill_reg (i, class, max_needs, max_nongroups,
- global, dumpfile);
- }
- }
- }
-
- /* If global-alloc was run, notify it of any register eliminations we have
- done. */
- if (global)
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- if (ep->can_eliminate)
- mark_elimination (ep->from, ep->to);
-
- /* Insert code to save and restore call-clobbered hard regs
- around calls. Tell if what mode to use so that we will process
- those insns in reload_as_needed if we have to. */
-
- if (caller_save_needed)
- save_call_clobbered_regs (num_eliminable ? QImode
- : caller_save_spill_class != NO_REGS ? HImode
- : VOIDmode);
-
- /* If a pseudo has no hard reg, delete the insns that made the equivalence.
- If that insn didn't set the register (i.e., it copied the register to
- memory), just delete that insn instead of the equivalencing insn plus
- anything now dead. If we call delete_dead_insn on that insn, we may
- delete the insn that actually sets the register if the register die
- there and that is incorrect. */
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_renumber[i] < 0 && reg_equiv_init[i] != 0
- && GET_CODE (reg_equiv_init[i]) != NOTE)
- {
- if (reg_set_p (regno_reg_rtx[i], PATTERN (reg_equiv_init[i])))
- delete_dead_insn (reg_equiv_init[i]);
- else
- {
- PUT_CODE (reg_equiv_init[i], NOTE);
- NOTE_SOURCE_FILE (reg_equiv_init[i]) = 0;
- NOTE_LINE_NUMBER (reg_equiv_init[i]) = NOTE_INSN_DELETED;
- }
- }
-
- /* Use the reload registers where necessary
- by generating move instructions to move the must-be-register
- values into or out of the reload registers. */
-
- if (something_needs_reloads || something_needs_elimination
- || (caller_save_needed && num_eliminable)
- || caller_save_spill_class != NO_REGS)
- reload_as_needed (first, global);
-
- /* If we were able to eliminate the frame pointer, show that it is no
- longer live at the start of any basic block. If it ls live by
- virtue of being in a pseudo, that pseudo will be marked live
- and hence the frame pointer will be known to be live via that
- pseudo. */
-
- if (! frame_pointer_needed)
- for (i = 0; i < n_basic_blocks; i++)
- basic_block_live_at_start[i][HARD_FRAME_POINTER_REGNUM / REGSET_ELT_BITS]
- &= ~ ((REGSET_ELT_TYPE) 1 << (HARD_FRAME_POINTER_REGNUM
- % REGSET_ELT_BITS));
-
- /* Come here (with failure set nonzero) if we can't get enough spill regs
- and we decide not to abort about it. */
- failed:
-
- reload_in_progress = 0;
-
- /* Now eliminate all pseudo regs by modifying them into
- their equivalent memory references.
- The REG-rtx's for the pseudos are modified in place,
- so all insns that used to refer to them now refer to memory.
-
- For a reg that has a reg_equiv_address, all those insns
- were changed by reloading so that no insns refer to it any longer;
- but the DECL_RTL of a variable decl may refer to it,
- and if so this causes the debugging info to mention the variable. */
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- {
- rtx addr = 0;
- int in_struct = 0;
- if (reg_equiv_mem[i])
- {
- addr = XEXP (reg_equiv_mem[i], 0);
- in_struct = MEM_IN_STRUCT_P (reg_equiv_mem[i]);
- }
- if (reg_equiv_address[i])
- addr = reg_equiv_address[i];
- if (addr)
- {
- if (reg_renumber[i] < 0)
- {
- rtx reg = regno_reg_rtx[i];
- XEXP (reg, 0) = addr;
- REG_USERVAR_P (reg) = 0;
- MEM_IN_STRUCT_P (reg) = in_struct;
- PUT_CODE (reg, MEM);
- }
- else if (reg_equiv_mem[i])
- XEXP (reg_equiv_mem[i], 0) = addr;
- }
- }
-
- /* Do a very simple CSE pass over just the hard registers. */
- if (optimize > 0)
- reload_cse_regs (first);
-
-#ifdef PRESERVE_DEATH_INFO_REGNO_P
- /* Make a pass over all the insns and remove death notes for things that
- are no longer registers or no longer die in the insn (e.g., an input
- and output pseudo being tied). */
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- rtx note, next;
-
- for (note = REG_NOTES (insn); note; note = next)
- {
- next = XEXP (note, 1);
- if (REG_NOTE_KIND (note) == REG_DEAD
- && (GET_CODE (XEXP (note, 0)) != REG
- || reg_set_p (XEXP (note, 0), PATTERN (insn))))
- remove_note (insn, note);
- }
- }
-#endif
-
- /* Indicate that we no longer have known memory locations or constants. */
- reg_equiv_constant = 0;
- reg_equiv_memory_loc = 0;
-
- if (scratch_list)
- free (scratch_list);
- scratch_list = 0;
- if (scratch_block)
- free (scratch_block);
- scratch_block = 0;
-
- CLEAR_HARD_REG_SET (used_spill_regs);
- for (i = 0; i < n_spills; i++)
- SET_HARD_REG_BIT (used_spill_regs, spill_regs[i]);
-
- return failure;
-}
-
-/* Nonzero if, after spilling reg REGNO for non-groups,
- it will still be possible to find a group if we still need one. */
-
-static int
-possible_group_p (regno, max_groups)
- int regno;
- int *max_groups;
-{
- int i;
- int class = (int) NO_REGS;
-
- for (i = 0; i < (int) N_REG_CLASSES; i++)
- if (max_groups[i] > 0)
- {
- class = i;
- break;
- }
-
- if (class == (int) NO_REGS)
- return 1;
-
- /* Consider each pair of consecutive registers. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER - 1; i++)
- {
- /* Ignore pairs that include reg REGNO. */
- if (i == regno || i + 1 == regno)
- continue;
-
- /* Ignore pairs that are outside the class that needs the group.
- ??? Here we fail to handle the case where two different classes
- independently need groups. But this never happens with our
- current machine descriptions. */
- if (! (TEST_HARD_REG_BIT (reg_class_contents[class], i)
- && TEST_HARD_REG_BIT (reg_class_contents[class], i + 1)))
- continue;
-
- /* A pair of consecutive regs we can still spill does the trick. */
- if (spill_reg_order[i] < 0 && spill_reg_order[i + 1] < 0
- && ! TEST_HARD_REG_BIT (bad_spill_regs, i)
- && ! TEST_HARD_REG_BIT (bad_spill_regs, i + 1))
- return 1;
-
- /* A pair of one already spilled and one we can spill does it
- provided the one already spilled is not otherwise reserved. */
- if (spill_reg_order[i] < 0
- && ! TEST_HARD_REG_BIT (bad_spill_regs, i)
- && spill_reg_order[i + 1] >= 0
- && ! TEST_HARD_REG_BIT (counted_for_groups, i + 1)
- && ! TEST_HARD_REG_BIT (counted_for_nongroups, i + 1))
- return 1;
- if (spill_reg_order[i + 1] < 0
- && ! TEST_HARD_REG_BIT (bad_spill_regs, i + 1)
- && spill_reg_order[i] >= 0
- && ! TEST_HARD_REG_BIT (counted_for_groups, i)
- && ! TEST_HARD_REG_BIT (counted_for_nongroups, i))
- return 1;
- }
-
- return 0;
-}
-
-/* Count any groups of CLASS that can be formed from the registers recently
- spilled. */
-
-static void
-count_possible_groups (group_size, group_mode, max_groups, class)
- int *group_size;
- enum machine_mode *group_mode;
- int *max_groups;
- int class;
-{
- HARD_REG_SET new;
- int i, j;
-
- /* Now find all consecutive groups of spilled registers
- and mark each group off against the need for such groups.
- But don't count them against ordinary need, yet. */
-
- if (group_size[class] == 0)
- return;
-
- CLEAR_HARD_REG_SET (new);
-
- /* Make a mask of all the regs that are spill regs in class I. */
- for (i = 0; i < n_spills; i++)
- if (TEST_HARD_REG_BIT (reg_class_contents[class], spill_regs[i])
- && ! TEST_HARD_REG_BIT (counted_for_groups, spill_regs[i])
- && ! TEST_HARD_REG_BIT (counted_for_nongroups, spill_regs[i]))
- SET_HARD_REG_BIT (new, spill_regs[i]);
-
- /* Find each consecutive group of them. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER && max_groups[class] > 0; i++)
- if (TEST_HARD_REG_BIT (new, i)
- && i + group_size[class] <= FIRST_PSEUDO_REGISTER
- && HARD_REGNO_MODE_OK (i, group_mode[class]))
- {
- for (j = 1; j < group_size[class]; j++)
- if (! TEST_HARD_REG_BIT (new, i + j))
- break;
-
- if (j == group_size[class])
- {
- /* We found a group. Mark it off against this class's need for
- groups, and against each superclass too. */
- register enum reg_class *p;
-
- max_groups[class]--;
- p = reg_class_superclasses[class];
- while (*p != LIM_REG_CLASSES)
- {
- if (group_size [(int) *p] <= group_size [class])
- max_groups[(int) *p]--;
- p++;
- }
-
- /* Don't count these registers again. */
- for (j = 0; j < group_size[class]; j++)
- SET_HARD_REG_BIT (counted_for_groups, i + j);
- }
-
- /* Skip to the last reg in this group. When i is incremented above,
- it will then point to the first reg of the next possible group. */
- i += j - 1;
- }
-}
-
-/* ALLOCATE_MODE is a register mode that needs to be reloaded. OTHER_MODE is
- another mode that needs to be reloaded for the same register class CLASS.
- If any reg in CLASS allows ALLOCATE_MODE but not OTHER_MODE, fail.
- ALLOCATE_MODE will never be smaller than OTHER_MODE.
-
- This code used to also fail if any reg in CLASS allows OTHER_MODE but not
- ALLOCATE_MODE. This test is unnecessary, because we will never try to put
- something of mode ALLOCATE_MODE into an OTHER_MODE register. Testing this
- causes unnecessary failures on machines requiring alignment of register
- groups when the two modes are different sizes, because the larger mode has
- more strict alignment rules than the smaller mode. */
-
-static int
-modes_equiv_for_class_p (allocate_mode, other_mode, class)
- enum machine_mode allocate_mode, other_mode;
- enum reg_class class;
-{
- register int regno;
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- {
- if (TEST_HARD_REG_BIT (reg_class_contents[(int) class], regno)
- && HARD_REGNO_MODE_OK (regno, allocate_mode)
- && ! HARD_REGNO_MODE_OK (regno, other_mode))
- return 0;
- }
- return 1;
-}
-
-/* Handle the failure to find a register to spill.
- INSN should be one of the insns which needed this particular spill reg. */
-
-static void
-spill_failure (insn)
- rtx insn;
-{
- if (asm_noperands (PATTERN (insn)) >= 0)
- error_for_asm (insn, "`asm' needs too many reloads");
- else
- fatal_insn ("Unable to find a register to spill.", insn);
-}
-
-/* Add a new register to the tables of available spill-registers
- (as well as spilling all pseudos allocated to the register).
- I is the index of this register in potential_reload_regs.
- CLASS is the regclass whose need is being satisfied.
- MAX_NEEDS and MAX_NONGROUPS are the vectors of needs,
- so that this register can count off against them.
- MAX_NONGROUPS is 0 if this register is part of a group.
- GLOBAL and DUMPFILE are the same as the args that `reload' got. */
-
-static int
-new_spill_reg (i, class, max_needs, max_nongroups, global, dumpfile)
- int i;
- int class;
- int *max_needs;
- int *max_nongroups;
- int global;
- FILE *dumpfile;
-{
- register enum reg_class *p;
- int val;
- int regno = potential_reload_regs[i];
-
- if (i >= FIRST_PSEUDO_REGISTER)
- abort (); /* Caller failed to find any register. */
-
- if (fixed_regs[regno] || TEST_HARD_REG_BIT (forbidden_regs, regno))
- fatal ("fixed or forbidden register was spilled.\n\
-This may be due to a compiler bug or to impossible asm\n\
-statements or clauses.");
-
- /* Make reg REGNO an additional reload reg. */
-
- potential_reload_regs[i] = -1;
- spill_regs[n_spills] = regno;
- spill_reg_order[regno] = n_spills;
- if (dumpfile)
- fprintf (dumpfile, "Spilling reg %d.\n", spill_regs[n_spills]);
-
- /* Clear off the needs we just satisfied. */
-
- max_needs[class]--;
- p = reg_class_superclasses[class];
- while (*p != LIM_REG_CLASSES)
- max_needs[(int) *p++]--;
-
- if (max_nongroups && max_nongroups[class] > 0)
- {
- SET_HARD_REG_BIT (counted_for_nongroups, regno);
- max_nongroups[class]--;
- p = reg_class_superclasses[class];
- while (*p != LIM_REG_CLASSES)
- max_nongroups[(int) *p++]--;
- }
-
- /* Spill every pseudo reg that was allocated to this reg
- or to something that overlaps this reg. */
-
- val = spill_hard_reg (spill_regs[n_spills], global, dumpfile, 0);
-
- /* If there are some registers still to eliminate and this register
- wasn't ever used before, additional stack space may have to be
- allocated to store this register. Thus, we may have changed the offset
- between the stack and frame pointers, so mark that something has changed.
- (If new pseudos were spilled, thus requiring more space, VAL would have
- been set non-zero by the call to spill_hard_reg above since additional
- reloads may be needed in that case.
-
- One might think that we need only set VAL to 1 if this is a call-used
- register. However, the set of registers that must be saved by the
- prologue is not identical to the call-used set. For example, the
- register used by the call insn for the return PC is a call-used register,
- but must be saved by the prologue. */
- if (num_eliminable && ! regs_ever_live[spill_regs[n_spills]])
- val = 1;
-
- regs_ever_live[spill_regs[n_spills]] = 1;
- n_spills++;
-
- return val;
-}
-
-/* Delete an unneeded INSN and any previous insns who sole purpose is loading
- data that is dead in INSN. */
-
-static void
-delete_dead_insn (insn)
- rtx insn;
-{
- rtx prev = prev_real_insn (insn);
- rtx prev_dest;
-
- /* If the previous insn sets a register that dies in our insn, delete it
- too. */
- if (prev && GET_CODE (PATTERN (prev)) == SET
- && (prev_dest = SET_DEST (PATTERN (prev)), GET_CODE (prev_dest) == REG)
- && reg_mentioned_p (prev_dest, PATTERN (insn))
- && find_regno_note (insn, REG_DEAD, REGNO (prev_dest)))
- delete_dead_insn (prev);
-
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
-}
-
-/* Modify the home of pseudo-reg I.
- The new home is present in reg_renumber[I].
-
- FROM_REG may be the hard reg that the pseudo-reg is being spilled from;
- or it may be -1, meaning there is none or it is not relevant.
- This is used so that all pseudos spilled from a given hard reg
- can share one stack slot. */
-
-static void
-alter_reg (i, from_reg)
- register int i;
- int from_reg;
-{
- /* When outputting an inline function, this can happen
- for a reg that isn't actually used. */
- if (regno_reg_rtx[i] == 0)
- return;
-
- /* If the reg got changed to a MEM at rtl-generation time,
- ignore it. */
- if (GET_CODE (regno_reg_rtx[i]) != REG)
- return;
-
- /* Modify the reg-rtx to contain the new hard reg
- number or else to contain its pseudo reg number. */
- REGNO (regno_reg_rtx[i])
- = reg_renumber[i] >= 0 ? reg_renumber[i] : i;
-
- /* If we have a pseudo that is needed but has no hard reg or equivalent,
- allocate a stack slot for it. */
-
- if (reg_renumber[i] < 0
- && reg_n_refs[i] > 0
- && reg_equiv_constant[i] == 0
- && reg_equiv_memory_loc[i] == 0)
- {
- register rtx x;
- int inherent_size = PSEUDO_REGNO_BYTES (i);
- int total_size = MAX (inherent_size, reg_max_ref_width[i]);
- int adjust = 0;
-
- /* Each pseudo reg has an inherent size which comes from its own mode,
- and a total size which provides room for paradoxical subregs
- which refer to the pseudo reg in wider modes.
-
- We can use a slot already allocated if it provides both
- enough inherent space and enough total space.
- Otherwise, we allocate a new slot, making sure that it has no less
- inherent space, and no less total space, then the previous slot. */
- if (from_reg == -1)
- {
- /* No known place to spill from => no slot to reuse. */
- x = assign_stack_local (GET_MODE (regno_reg_rtx[i]), total_size,
- inherent_size == total_size ? 0 : -1);
- if (BYTES_BIG_ENDIAN)
- /* Cancel the big-endian correction done in assign_stack_local.
- Get the address of the beginning of the slot.
- This is so we can do a big-endian correction unconditionally
- below. */
- adjust = inherent_size - total_size;
-
- RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (regno_reg_rtx[i]);
- }
- /* Reuse a stack slot if possible. */
- else if (spill_stack_slot[from_reg] != 0
- && spill_stack_slot_width[from_reg] >= total_size
- && (GET_MODE_SIZE (GET_MODE (spill_stack_slot[from_reg]))
- >= inherent_size))
- x = spill_stack_slot[from_reg];
- /* Allocate a bigger slot. */
- else
- {
- /* Compute maximum size needed, both for inherent size
- and for total size. */
- enum machine_mode mode = GET_MODE (regno_reg_rtx[i]);
- rtx stack_slot;
- if (spill_stack_slot[from_reg])
- {
- if (GET_MODE_SIZE (GET_MODE (spill_stack_slot[from_reg]))
- > inherent_size)
- mode = GET_MODE (spill_stack_slot[from_reg]);
- if (spill_stack_slot_width[from_reg] > total_size)
- total_size = spill_stack_slot_width[from_reg];
- }
- /* Make a slot with that size. */
- x = assign_stack_local (mode, total_size,
- inherent_size == total_size ? 0 : -1);
- stack_slot = x;
- if (BYTES_BIG_ENDIAN)
- {
- /* Cancel the big-endian correction done in assign_stack_local.
- Get the address of the beginning of the slot.
- This is so we can do a big-endian correction unconditionally
- below. */
- adjust = GET_MODE_SIZE (mode) - total_size;
- if (adjust)
- stack_slot = gen_rtx (MEM, mode_for_size (total_size
- * BITS_PER_UNIT,
- MODE_INT, 1),
- plus_constant (XEXP (x, 0), adjust));
- }
- spill_stack_slot[from_reg] = stack_slot;
- spill_stack_slot_width[from_reg] = total_size;
- }
-
- /* On a big endian machine, the "address" of the slot
- is the address of the low part that fits its inherent mode. */
- if (BYTES_BIG_ENDIAN && inherent_size < total_size)
- adjust += (total_size - inherent_size);
-
- /* If we have any adjustment to make, or if the stack slot is the
- wrong mode, make a new stack slot. */
- if (adjust != 0 || GET_MODE (x) != GET_MODE (regno_reg_rtx[i]))
- {
- x = gen_rtx (MEM, GET_MODE (regno_reg_rtx[i]),
- plus_constant (XEXP (x, 0), adjust));
- RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (regno_reg_rtx[i]);
- }
-
- /* Save the stack slot for later. */
- reg_equiv_memory_loc[i] = x;
- }
-}
-
-/* Mark the slots in regs_ever_live for the hard regs
- used by pseudo-reg number REGNO. */
-
-void
-mark_home_live (regno)
- int regno;
-{
- register int i, lim;
- i = reg_renumber[regno];
- if (i < 0)
- return;
- lim = i + HARD_REGNO_NREGS (i, PSEUDO_REGNO_MODE (regno));
- while (i < lim)
- regs_ever_live[i++] = 1;
-}
-
-/* Mark the registers used in SCRATCH as being live. */
-
-static void
-mark_scratch_live (scratch)
- rtx scratch;
-{
- register int i;
- int regno = REGNO (scratch);
- int lim = regno + HARD_REGNO_NREGS (regno, GET_MODE (scratch));
-
- for (i = regno; i < lim; i++)
- regs_ever_live[i] = 1;
-}
-
-/* This function handles the tracking of elimination offsets around branches.
-
- X is a piece of RTL being scanned.
-
- INSN is the insn that it came from, if any.
-
- INITIAL_P is non-zero if we are to set the offset to be the initial
- offset and zero if we are setting the offset of the label to be the
- current offset. */
-
-static void
-set_label_offsets (x, insn, initial_p)
- rtx x;
- rtx insn;
- int initial_p;
-{
- enum rtx_code code = GET_CODE (x);
- rtx tem;
- int i;
- struct elim_table *p;
-
- switch (code)
- {
- case LABEL_REF:
- if (LABEL_REF_NONLOCAL_P (x))
- return;
-
- x = XEXP (x, 0);
-
- /* ... fall through ... */
-
- case CODE_LABEL:
- /* If we know nothing about this label, set the desired offsets. Note
- that this sets the offset at a label to be the offset before a label
- if we don't know anything about the label. This is not correct for
- the label after a BARRIER, but is the best guess we can make. If
- we guessed wrong, we will suppress an elimination that might have
- been possible had we been able to guess correctly. */
-
- if (! offsets_known_at[CODE_LABEL_NUMBER (x)])
- {
- for (i = 0; i < NUM_ELIMINABLE_REGS; i++)
- offsets_at[CODE_LABEL_NUMBER (x)][i]
- = (initial_p ? reg_eliminate[i].initial_offset
- : reg_eliminate[i].offset);
- offsets_known_at[CODE_LABEL_NUMBER (x)] = 1;
- }
-
- /* Otherwise, if this is the definition of a label and it is
- preceded by a BARRIER, set our offsets to the known offset of
- that label. */
-
- else if (x == insn
- && (tem = prev_nonnote_insn (insn)) != 0
- && GET_CODE (tem) == BARRIER)
- {
- num_not_at_initial_offset = 0;
- for (i = 0; i < NUM_ELIMINABLE_REGS; i++)
- {
- reg_eliminate[i].offset = reg_eliminate[i].previous_offset
- = offsets_at[CODE_LABEL_NUMBER (x)][i];
- if (reg_eliminate[i].can_eliminate
- && (reg_eliminate[i].offset
- != reg_eliminate[i].initial_offset))
- num_not_at_initial_offset++;
- }
- }
-
- else
- /* If neither of the above cases is true, compare each offset
- with those previously recorded and suppress any eliminations
- where the offsets disagree. */
-
- for (i = 0; i < NUM_ELIMINABLE_REGS; i++)
- if (offsets_at[CODE_LABEL_NUMBER (x)][i]
- != (initial_p ? reg_eliminate[i].initial_offset
- : reg_eliminate[i].offset))
- reg_eliminate[i].can_eliminate = 0;
-
- return;
-
- case JUMP_INSN:
- set_label_offsets (PATTERN (insn), insn, initial_p);
-
- /* ... fall through ... */
-
- case INSN:
- case CALL_INSN:
- /* Any labels mentioned in REG_LABEL notes can be branched to indirectly
- and hence must have all eliminations at their initial offsets. */
- for (tem = REG_NOTES (x); tem; tem = XEXP (tem, 1))
- if (REG_NOTE_KIND (tem) == REG_LABEL)
- set_label_offsets (XEXP (tem, 0), insn, 1);
- return;
-
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- /* Each of the labels in the address vector must be at their initial
- offsets. We want the first first for ADDR_VEC and the second
- field for ADDR_DIFF_VEC. */
-
- for (i = 0; i < XVECLEN (x, code == ADDR_DIFF_VEC); i++)
- set_label_offsets (XVECEXP (x, code == ADDR_DIFF_VEC, i),
- insn, initial_p);
- return;
-
- case SET:
- /* We only care about setting PC. If the source is not RETURN,
- IF_THEN_ELSE, or a label, disable any eliminations not at
- their initial offsets. Similarly if any arm of the IF_THEN_ELSE
- isn't one of those possibilities. For branches to a label,
- call ourselves recursively.
-
- Note that this can disable elimination unnecessarily when we have
- a non-local goto since it will look like a non-constant jump to
- someplace in the current function. This isn't a significant
- problem since such jumps will normally be when all elimination
- pairs are back to their initial offsets. */
-
- if (SET_DEST (x) != pc_rtx)
- return;
-
- switch (GET_CODE (SET_SRC (x)))
- {
- case PC:
- case RETURN:
- return;
-
- case LABEL_REF:
- set_label_offsets (XEXP (SET_SRC (x), 0), insn, initial_p);
- return;
-
- case IF_THEN_ELSE:
- tem = XEXP (SET_SRC (x), 1);
- if (GET_CODE (tem) == LABEL_REF)
- set_label_offsets (XEXP (tem, 0), insn, initial_p);
- else if (GET_CODE (tem) != PC && GET_CODE (tem) != RETURN)
- break;
-
- tem = XEXP (SET_SRC (x), 2);
- if (GET_CODE (tem) == LABEL_REF)
- set_label_offsets (XEXP (tem, 0), insn, initial_p);
- else if (GET_CODE (tem) != PC && GET_CODE (tem) != RETURN)
- break;
- return;
- }
-
- /* If we reach here, all eliminations must be at their initial
- offset because we are doing a jump to a variable address. */
- for (p = reg_eliminate; p < &reg_eliminate[NUM_ELIMINABLE_REGS]; p++)
- if (p->offset != p->initial_offset)
- p->can_eliminate = 0;
- }
-}
-
-/* Used for communication between the next two function to properly share
- the vector for an ASM_OPERANDS. */
-
-static struct rtvec_def *old_asm_operands_vec, *new_asm_operands_vec;
-
-/* Scan X and replace any eliminable registers (such as fp) with a
- replacement (such as sp), plus an offset.
-
- MEM_MODE is the mode of an enclosing MEM. We need this to know how
- much to adjust a register for, e.g., PRE_DEC. Also, if we are inside a
- MEM, we are allowed to replace a sum of a register and the constant zero
- with the register, which we cannot do outside a MEM. In addition, we need
- to record the fact that a register is referenced outside a MEM.
-
- If INSN is an insn, it is the insn containing X. If we replace a REG
- in a SET_DEST with an equivalent MEM and INSN is non-zero, write a
- CLOBBER of the pseudo after INSN so find_equiv_regs will know that
- that the REG is being modified.
-
- Alternatively, INSN may be a note (an EXPR_LIST or INSN_LIST).
- That's used when we eliminate in expressions stored in notes.
- This means, do not set ref_outside_mem even if the reference
- is outside of MEMs.
-
- If we see a modification to a register we know about, take the
- appropriate action (see case SET, below).
-
- REG_EQUIV_MEM and REG_EQUIV_ADDRESS contain address that have had
- replacements done assuming all offsets are at their initial values. If
- they are not, or if REG_EQUIV_ADDRESS is nonzero for a pseudo we
- encounter, return the actual location so that find_reloads will do
- the proper thing. */
-
-rtx
-eliminate_regs (x, mem_mode, insn, storing)
- rtx x;
- enum machine_mode mem_mode;
- rtx insn;
- int storing;
-{
- enum rtx_code code = GET_CODE (x);
- struct elim_table *ep;
- int regno;
- rtx new;
- int i, j;
- char *fmt;
- int copied = 0;
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case RETURN:
- return x;
-
- case REG:
- regno = REGNO (x);
-
- /* First handle the case where we encounter a bare register that
- is eliminable. Replace it with a PLUS. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
- ep++)
- if (ep->from_rtx == x && ep->can_eliminate)
- {
- if (! mem_mode
- /* Refs inside notes don't count for this purpose. */
- && ! (insn != 0 && (GET_CODE (insn) == EXPR_LIST
- || GET_CODE (insn) == INSN_LIST)))
- ep->ref_outside_mem = 1;
- return plus_constant (ep->to_rtx, ep->previous_offset);
- }
-
- }
- else if (reg_equiv_memory_loc && reg_equiv_memory_loc[regno]
- && (reg_equiv_address[regno] || num_not_at_initial_offset))
- {
- /* In this case, find_reloads would attempt to either use an
- incorrect address (if something is not at its initial offset)
- or substitute an replaced address into an insn (which loses
- if the offset is changed by some later action). So we simply
- return the replaced stack slot (assuming it is changed by
- elimination) and ignore the fact that this is actually a
- reference to the pseudo. Ensure we make a copy of the
- address in case it is shared. */
- new = eliminate_regs (reg_equiv_memory_loc[regno],
- mem_mode, insn, 0);
- if (new != reg_equiv_memory_loc[regno])
- {
- cannot_omit_stores[regno] = 1;
- return copy_rtx (new);
- }
- }
- return x;
-
- case PLUS:
- /* If this is the sum of an eliminable register and a constant, rework
- the sum. */
- if (GET_CODE (XEXP (x, 0)) == REG
- && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER
- && CONSTANT_P (XEXP (x, 1)))
- {
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
- ep++)
- if (ep->from_rtx == XEXP (x, 0) && ep->can_eliminate)
- {
- if (! mem_mode
- /* Refs inside notes don't count for this purpose. */
- && ! (insn != 0 && (GET_CODE (insn) == EXPR_LIST
- || GET_CODE (insn) == INSN_LIST)))
- ep->ref_outside_mem = 1;
-
- /* The only time we want to replace a PLUS with a REG (this
- occurs when the constant operand of the PLUS is the negative
- of the offset) is when we are inside a MEM. We won't want
- to do so at other times because that would change the
- structure of the insn in a way that reload can't handle.
- We special-case the commonest situation in
- eliminate_regs_in_insn, so just replace a PLUS with a
- PLUS here, unless inside a MEM. */
- if (mem_mode != 0 && GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) == - ep->previous_offset)
- return ep->to_rtx;
- else
- return gen_rtx (PLUS, Pmode, ep->to_rtx,
- plus_constant (XEXP (x, 1),
- ep->previous_offset));
- }
-
- /* If the register is not eliminable, we are done since the other
- operand is a constant. */
- return x;
- }
-
- /* If this is part of an address, we want to bring any constant to the
- outermost PLUS. We will do this by doing register replacement in
- our operands and seeing if a constant shows up in one of them.
-
- We assume here this is part of an address (or a "load address" insn)
- since an eliminable register is not likely to appear in any other
- context.
-
- If we have (plus (eliminable) (reg)), we want to produce
- (plus (plus (replacement) (reg) (const))). If this was part of a
- normal add insn, (plus (replacement) (reg)) will be pushed as a
- reload. This is the desired action. */
-
- {
- rtx new0 = eliminate_regs (XEXP (x, 0), mem_mode, insn, 0);
- rtx new1 = eliminate_regs (XEXP (x, 1), mem_mode, insn, 0);
-
- if (new0 != XEXP (x, 0) || new1 != XEXP (x, 1))
- {
- /* If one side is a PLUS and the other side is a pseudo that
- didn't get a hard register but has a reg_equiv_constant,
- we must replace the constant here since it may no longer
- be in the position of any operand. */
- if (GET_CODE (new0) == PLUS && GET_CODE (new1) == REG
- && REGNO (new1) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[REGNO (new1)] < 0
- && reg_equiv_constant != 0
- && reg_equiv_constant[REGNO (new1)] != 0)
- new1 = reg_equiv_constant[REGNO (new1)];
- else if (GET_CODE (new1) == PLUS && GET_CODE (new0) == REG
- && REGNO (new0) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[REGNO (new0)] < 0
- && reg_equiv_constant[REGNO (new0)] != 0)
- new0 = reg_equiv_constant[REGNO (new0)];
-
- new = form_sum (new0, new1);
-
- /* As above, if we are not inside a MEM we do not want to
- turn a PLUS into something else. We might try to do so here
- for an addition of 0 if we aren't optimizing. */
- if (! mem_mode && GET_CODE (new) != PLUS)
- return gen_rtx (PLUS, GET_MODE (x), new, const0_rtx);
- else
- return new;
- }
- }
- return x;
-
- case MULT:
- /* If this is the product of an eliminable register and a
- constant, apply the distribute law and move the constant out
- so that we have (plus (mult ..) ..). This is needed in order
- to keep load-address insns valid. This case is pathological.
- We ignore the possibility of overflow here. */
- if (GET_CODE (XEXP (x, 0)) == REG
- && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER
- && GET_CODE (XEXP (x, 1)) == CONST_INT)
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
- ep++)
- if (ep->from_rtx == XEXP (x, 0) && ep->can_eliminate)
- {
- if (! mem_mode
- /* Refs inside notes don't count for this purpose. */
- && ! (insn != 0 && (GET_CODE (insn) == EXPR_LIST
- || GET_CODE (insn) == INSN_LIST)))
- ep->ref_outside_mem = 1;
-
- return
- plus_constant (gen_rtx (MULT, Pmode, ep->to_rtx, XEXP (x, 1)),
- ep->previous_offset * INTVAL (XEXP (x, 1)));
- }
-
- /* ... fall through ... */
-
- case CALL:
- case COMPARE:
- case MINUS:
- case DIV: case UDIV:
- case MOD: case UMOD:
- case AND: case IOR: case XOR:
- case ROTATERT: case ROTATE:
- case ASHIFTRT: case LSHIFTRT: case ASHIFT:
- case NE: case EQ:
- case GE: case GT: case GEU: case GTU:
- case LE: case LT: case LEU: case LTU:
- {
- rtx new0 = eliminate_regs (XEXP (x, 0), mem_mode, insn, 0);
- rtx new1
- = XEXP (x, 1) ? eliminate_regs (XEXP (x, 1), mem_mode, insn, 0) : 0;
-
- if (new0 != XEXP (x, 0) || new1 != XEXP (x, 1))
- return gen_rtx (code, GET_MODE (x), new0, new1);
- }
- return x;
-
- case EXPR_LIST:
- /* If we have something in XEXP (x, 0), the usual case, eliminate it. */
- if (XEXP (x, 0))
- {
- new = eliminate_regs (XEXP (x, 0), mem_mode, insn, 0);
- if (new != XEXP (x, 0))
- x = gen_rtx (EXPR_LIST, REG_NOTE_KIND (x), new, XEXP (x, 1));
- }
-
- /* ... fall through ... */
-
- case INSN_LIST:
- /* Now do eliminations in the rest of the chain. If this was
- an EXPR_LIST, this might result in allocating more memory than is
- strictly needed, but it simplifies the code. */
- if (XEXP (x, 1))
- {
- new = eliminate_regs (XEXP (x, 1), mem_mode, insn, 0);
- if (new != XEXP (x, 1))
- return gen_rtx (GET_CODE (x), GET_MODE (x), XEXP (x, 0), new);
- }
- return x;
-
- case PRE_INC:
- case POST_INC:
- case PRE_DEC:
- case POST_DEC:
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- if (ep->to_rtx == XEXP (x, 0))
- {
- int size = GET_MODE_SIZE (mem_mode);
-
- /* If more bytes than MEM_MODE are pushed, account for them. */
-#ifdef PUSH_ROUNDING
- if (ep->to_rtx == stack_pointer_rtx)
- size = PUSH_ROUNDING (size);
-#endif
- if (code == PRE_DEC || code == POST_DEC)
- ep->offset += size;
- else
- ep->offset -= size;
- }
-
- /* Fall through to generic unary operation case. */
- case STRICT_LOW_PART:
- case NEG: case NOT:
- case SIGN_EXTEND: case ZERO_EXTEND:
- case TRUNCATE: case FLOAT_EXTEND: case FLOAT_TRUNCATE:
- case FLOAT: case FIX:
- case UNSIGNED_FIX: case UNSIGNED_FLOAT:
- case ABS:
- case SQRT:
- case FFS:
- new = eliminate_regs (XEXP (x, 0), mem_mode, insn, 0);
- if (new != XEXP (x, 0))
- return gen_rtx (code, GET_MODE (x), new);
- return x;
-
- case SUBREG:
- /* Similar to above processing, but preserve SUBREG_WORD.
- Convert (subreg (mem)) to (mem) if not paradoxical.
- Also, if we have a non-paradoxical (subreg (pseudo)) and the
- pseudo didn't get a hard reg, we must replace this with the
- eliminated version of the memory location because push_reloads
- may do the replacement in certain circumstances. */
- if (GET_CODE (SUBREG_REG (x)) == REG
- && (GET_MODE_SIZE (GET_MODE (x))
- <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- && reg_equiv_memory_loc != 0
- && reg_equiv_memory_loc[REGNO (SUBREG_REG (x))] != 0)
- {
- new = eliminate_regs (reg_equiv_memory_loc[REGNO (SUBREG_REG (x))],
- mem_mode, insn, 0);
-
- /* If we didn't change anything, we must retain the pseudo. */
- if (new == reg_equiv_memory_loc[REGNO (SUBREG_REG (x))])
- new = SUBREG_REG (x);
- else
- {
- /* Otherwise, ensure NEW isn't shared in case we have to reload
- it. */
- new = copy_rtx (new);
-
- /* In this case, we must show that the pseudo is used in this
- insn so that delete_output_reload will do the right thing. */
- if (insn != 0 && GET_CODE (insn) != EXPR_LIST
- && GET_CODE (insn) != INSN_LIST)
- emit_insn_before (gen_rtx (USE, VOIDmode, SUBREG_REG (x)),
- insn);
- }
- }
- else
- new = eliminate_regs (SUBREG_REG (x), mem_mode, insn, 0);
-
- if (new != XEXP (x, 0))
- {
- int x_size = GET_MODE_SIZE (GET_MODE (x));
- int new_size = GET_MODE_SIZE (GET_MODE (new));
-
- /* When asked to spill a partial word subreg, we need to go
- ahead and spill the whole thing against the possibility
- that we reload the whole reg and find garbage at the top. */
- if (storing
- && GET_CODE (new) == MEM
- && x_size < new_size
- && ((x_size + UNITS_PER_WORD-1) / UNITS_PER_WORD
- == (new_size + UNITS_PER_WORD-1) / UNITS_PER_WORD))
- return new;
- else if (GET_CODE (new) == MEM
- && x_size <= new_size
-#ifdef LOAD_EXTEND_OP
- /* On these machines we will be reloading what is
- inside the SUBREG if it originally was a pseudo and
- the inner and outer modes are both a word or
- smaller. So leave the SUBREG then. */
- && ! (GET_CODE (SUBREG_REG (x)) == REG
- && x_size <= UNITS_PER_WORD
- && new_size <= UNITS_PER_WORD
- && x_size > new_size
- && INTEGRAL_MODE_P (GET_MODE (new))
- && LOAD_EXTEND_OP (GET_MODE (new)) != NIL)
-#endif
- )
- {
- int offset = SUBREG_WORD (x) * UNITS_PER_WORD;
- enum machine_mode mode = GET_MODE (x);
-
- if (BYTES_BIG_ENDIAN)
- offset += (MIN (UNITS_PER_WORD,
- GET_MODE_SIZE (GET_MODE (new)))
- - MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode)));
-
- PUT_MODE (new, mode);
- XEXP (new, 0) = plus_constant (XEXP (new, 0), offset);
- return new;
- }
- else
- return gen_rtx (SUBREG, GET_MODE (x), new, SUBREG_WORD (x));
- }
-
- return x;
-
- case USE:
- /* If using a register that is the source of an eliminate we still
- think can be performed, note it cannot be performed since we don't
- know how this register is used. */
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- if (ep->from_rtx == XEXP (x, 0))
- ep->can_eliminate = 0;
-
- new = eliminate_regs (XEXP (x, 0), mem_mode, insn, 0);
- if (new != XEXP (x, 0))
- return gen_rtx (code, GET_MODE (x), new);
- return x;
-
- case CLOBBER:
- /* If clobbering a register that is the replacement register for an
- elimination we still think can be performed, note that it cannot
- be performed. Otherwise, we need not be concerned about it. */
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- if (ep->to_rtx == XEXP (x, 0))
- ep->can_eliminate = 0;
-
- new = eliminate_regs (XEXP (x, 0), mem_mode, insn, 0);
- if (new != XEXP (x, 0))
- return gen_rtx (code, GET_MODE (x), new);
- return x;
-
- case ASM_OPERANDS:
- {
- rtx *temp_vec;
- /* Properly handle sharing input and constraint vectors. */
- if (ASM_OPERANDS_INPUT_VEC (x) != old_asm_operands_vec)
- {
- /* When we come to a new vector not seen before,
- scan all its elements; keep the old vector if none
- of them changes; otherwise, make a copy. */
- old_asm_operands_vec = ASM_OPERANDS_INPUT_VEC (x);
- temp_vec = (rtx *) alloca (XVECLEN (x, 3) * sizeof (rtx));
- for (i = 0; i < ASM_OPERANDS_INPUT_LENGTH (x); i++)
- temp_vec[i] = eliminate_regs (ASM_OPERANDS_INPUT (x, i),
- mem_mode, insn, 0);
-
- for (i = 0; i < ASM_OPERANDS_INPUT_LENGTH (x); i++)
- if (temp_vec[i] != ASM_OPERANDS_INPUT (x, i))
- break;
-
- if (i == ASM_OPERANDS_INPUT_LENGTH (x))
- new_asm_operands_vec = old_asm_operands_vec;
- else
- new_asm_operands_vec
- = gen_rtvec_v (ASM_OPERANDS_INPUT_LENGTH (x), temp_vec);
- }
-
- /* If we had to copy the vector, copy the entire ASM_OPERANDS. */
- if (new_asm_operands_vec == old_asm_operands_vec)
- return x;
-
- new = gen_rtx (ASM_OPERANDS, VOIDmode, ASM_OPERANDS_TEMPLATE (x),
- ASM_OPERANDS_OUTPUT_CONSTRAINT (x),
- ASM_OPERANDS_OUTPUT_IDX (x), new_asm_operands_vec,
- ASM_OPERANDS_INPUT_CONSTRAINT_VEC (x),
- ASM_OPERANDS_SOURCE_FILE (x),
- ASM_OPERANDS_SOURCE_LINE (x));
- new->volatil = x->volatil;
- return new;
- }
-
- case SET:
- /* Check for setting a register that we know about. */
- if (GET_CODE (SET_DEST (x)) == REG)
- {
- /* See if this is setting the replacement register for an
- elimination.
-
- If DEST is the hard frame pointer, we do nothing because we
- assume that all assignments to the frame pointer are for
- non-local gotos and are being done at a time when they are valid
- and do not disturb anything else. Some machines want to
- eliminate a fake argument pointer (or even a fake frame pointer)
- with either the real frame or the stack pointer. Assignments to
- the hard frame pointer must not prevent this elimination. */
-
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
- ep++)
- if (ep->to_rtx == SET_DEST (x)
- && SET_DEST (x) != hard_frame_pointer_rtx)
- {
- /* If it is being incremented, adjust the offset. Otherwise,
- this elimination can't be done. */
- rtx src = SET_SRC (x);
-
- if (GET_CODE (src) == PLUS
- && XEXP (src, 0) == SET_DEST (x)
- && GET_CODE (XEXP (src, 1)) == CONST_INT)
- ep->offset -= INTVAL (XEXP (src, 1));
- else
- ep->can_eliminate = 0;
- }
-
- /* Now check to see we are assigning to a register that can be
- eliminated. If so, it must be as part of a PARALLEL, since we
- will not have been called if this is a single SET. So indicate
- that we can no longer eliminate this reg. */
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
- ep++)
- if (ep->from_rtx == SET_DEST (x) && ep->can_eliminate)
- ep->can_eliminate = 0;
- }
-
- /* Now avoid the loop below in this common case. */
- {
- rtx new0 = eliminate_regs (SET_DEST (x), 0, insn, 1);
- rtx new1 = eliminate_regs (SET_SRC (x), 0, insn, 0);
-
- /* If SET_DEST changed from a REG to a MEM and INSN is an insn,
- write a CLOBBER insn. */
- if (GET_CODE (SET_DEST (x)) == REG && GET_CODE (new0) == MEM
- && insn != 0 && GET_CODE (insn) != EXPR_LIST
- && GET_CODE (insn) != INSN_LIST)
- emit_insn_after (gen_rtx (CLOBBER, VOIDmode, SET_DEST (x)), insn);
-
- if (new0 != SET_DEST (x) || new1 != SET_SRC (x))
- return gen_rtx (SET, VOIDmode, new0, new1);
- }
-
- return x;
-
- case MEM:
- /* Our only special processing is to pass the mode of the MEM to our
- recursive call and copy the flags. While we are here, handle this
- case more efficiently. */
- new = eliminate_regs (XEXP (x, 0), GET_MODE (x), insn, 0);
- if (new != XEXP (x, 0))
- {
- new = gen_rtx (MEM, GET_MODE (x), new);
- new->volatil = x->volatil;
- new->unchanging = x->unchanging;
- new->in_struct = x->in_struct;
- return new;
- }
- else
- return x;
- }
-
- /* Process each of our operands recursively. If any have changed, make a
- copy of the rtx. */
- fmt = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++, fmt++)
- {
- if (*fmt == 'e')
- {
- new = eliminate_regs (XEXP (x, i), mem_mode, insn, 0);
- if (new != XEXP (x, i) && ! copied)
- {
- rtx new_x = rtx_alloc (code);
- bcopy ((char *) x, (char *) new_x,
- (sizeof (*new_x) - sizeof (new_x->fld)
- + sizeof (new_x->fld[0]) * GET_RTX_LENGTH (code)));
- x = new_x;
- copied = 1;
- }
- XEXP (x, i) = new;
- }
- else if (*fmt == 'E')
- {
- int copied_vec = 0;
- for (j = 0; j < XVECLEN (x, i); j++)
- {
- new = eliminate_regs (XVECEXP (x, i, j), mem_mode, insn, 0);
- if (new != XVECEXP (x, i, j) && ! copied_vec)
- {
- rtvec new_v = gen_rtvec_vv (XVECLEN (x, i),
- XVEC (x, i)->elem);
- if (! copied)
- {
- rtx new_x = rtx_alloc (code);
- bcopy ((char *) x, (char *) new_x,
- (sizeof (*new_x) - sizeof (new_x->fld)
- + (sizeof (new_x->fld[0])
- * GET_RTX_LENGTH (code))));
- x = new_x;
- copied = 1;
- }
- XVEC (x, i) = new_v;
- copied_vec = 1;
- }
- XVECEXP (x, i, j) = new;
- }
- }
- }
-
- return x;
-}
-
-/* Scan INSN and eliminate all eliminable registers in it.
-
- If REPLACE is nonzero, do the replacement destructively. Also
- delete the insn as dead it if it is setting an eliminable register.
-
- If REPLACE is zero, do all our allocations in reload_obstack.
-
- If no eliminations were done and this insn doesn't require any elimination
- processing (these are not identical conditions: it might be updating sp,
- but not referencing fp; this needs to be seen during reload_as_needed so
- that the offset between fp and sp can be taken into consideration), zero
- is returned. Otherwise, 1 is returned. */
-
-static int
-eliminate_regs_in_insn (insn, replace)
- rtx insn;
- int replace;
-{
- rtx old_body = PATTERN (insn);
- rtx old_set = single_set (insn);
- rtx new_body;
- int val = 0;
- struct elim_table *ep;
-
- if (! replace)
- push_obstacks (&reload_obstack, &reload_obstack);
-
- if (old_set != 0 && GET_CODE (SET_DEST (old_set)) == REG
- && REGNO (SET_DEST (old_set)) < FIRST_PSEUDO_REGISTER)
- {
- /* Check for setting an eliminable register. */
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- if (ep->from_rtx == SET_DEST (old_set) && ep->can_eliminate)
- {
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- /* If this is setting the frame pointer register to the
- hardware frame pointer register and this is an elimination
- that will be done (tested above), this insn is really
- adjusting the frame pointer downward to compensate for
- the adjustment done before a nonlocal goto. */
- if (ep->from == FRAME_POINTER_REGNUM
- && ep->to == HARD_FRAME_POINTER_REGNUM)
- {
- rtx src = SET_SRC (old_set);
- int offset, ok = 0;
- rtx prev_insn, prev_set;
-
- if (src == ep->to_rtx)
- offset = 0, ok = 1;
- else if (GET_CODE (src) == PLUS
- && GET_CODE (XEXP (src, 0)) == CONST_INT)
- offset = INTVAL (XEXP (src, 0)), ok = 1;
- else if ((prev_insn = prev_nonnote_insn (insn)) != 0
- && (prev_set = single_set (prev_insn)) != 0
- && rtx_equal_p (SET_DEST (prev_set), src))
- {
- src = SET_SRC (prev_set);
- if (src == ep->to_rtx)
- offset = 0, ok = 1;
- else if (GET_CODE (src) == PLUS
- && GET_CODE (XEXP (src, 0)) == CONST_INT
- && XEXP (src, 1) == ep->to_rtx)
- offset = INTVAL (XEXP (src, 0)), ok = 1;
- else if (GET_CODE (src) == PLUS
- && GET_CODE (XEXP (src, 1)) == CONST_INT
- && XEXP (src, 0) == ep->to_rtx)
- offset = INTVAL (XEXP (src, 1)), ok = 1;
- }
-
- if (ok)
- {
- if (replace)
- {
- rtx src
- = plus_constant (ep->to_rtx, offset - ep->offset);
-
- /* First see if this insn remains valid when we
- make the change. If not, keep the INSN_CODE
- the same and let reload fit it up. */
- validate_change (insn, &SET_SRC (old_set), src, 1);
- validate_change (insn, &SET_DEST (old_set),
- ep->to_rtx, 1);
- if (! apply_change_group ())
- {
- SET_SRC (old_set) = src;
- SET_DEST (old_set) = ep->to_rtx;
- }
- }
-
- val = 1;
- goto done;
- }
- }
-#endif
-
- /* In this case this insn isn't serving a useful purpose. We
- will delete it in reload_as_needed once we know that this
- elimination is, in fact, being done.
-
- If REPLACE isn't set, we can't delete this insn, but needn't
- process it since it won't be used unless something changes. */
- if (replace)
- delete_dead_insn (insn);
- val = 1;
- goto done;
- }
-
- /* Check for (set (reg) (plus (reg from) (offset))) where the offset
- in the insn is the negative of the offset in FROM. Substitute
- (set (reg) (reg to)) for the insn and change its code.
-
- We have to do this here, rather than in eliminate_regs, do that we can
- change the insn code. */
-
- if (GET_CODE (SET_SRC (old_set)) == PLUS
- && GET_CODE (XEXP (SET_SRC (old_set), 0)) == REG
- && GET_CODE (XEXP (SET_SRC (old_set), 1)) == CONST_INT)
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
- ep++)
- if (ep->from_rtx == XEXP (SET_SRC (old_set), 0)
- && ep->can_eliminate)
- {
- /* We must stop at the first elimination that will be used.
- If this one would replace the PLUS with a REG, do it
- now. Otherwise, quit the loop and let eliminate_regs
- do its normal replacement. */
- if (ep->offset == - INTVAL (XEXP (SET_SRC (old_set), 1)))
- {
- /* We assume here that we don't need a PARALLEL of
- any CLOBBERs for this assignment. There's not
- much we can do if we do need it. */
- PATTERN (insn) = gen_rtx (SET, VOIDmode,
- SET_DEST (old_set), ep->to_rtx);
- INSN_CODE (insn) = -1;
- val = 1;
- goto done;
- }
-
- break;
- }
- }
-
- old_asm_operands_vec = 0;
-
- /* Replace the body of this insn with a substituted form. If we changed
- something, return non-zero.
-
- If we are replacing a body that was a (set X (plus Y Z)), try to
- re-recognize the insn. We do this in case we had a simple addition
- but now can do this as a load-address. This saves an insn in this
- common case. */
-
- new_body = eliminate_regs (old_body, 0, replace ? insn : NULL_RTX, 0);
- if (new_body != old_body)
- {
- /* If we aren't replacing things permanently and we changed something,
- make another copy to ensure that all the RTL is new. Otherwise
- things can go wrong if find_reload swaps commutative operands
- and one is inside RTL that has been copied while the other is not. */
-
- /* Don't copy an asm_operands because (1) there's no need and (2)
- copy_rtx can't do it properly when there are multiple outputs. */
- if (! replace && asm_noperands (old_body) < 0)
- new_body = copy_rtx (new_body);
-
- /* If we had a move insn but now we don't, rerecognize it. This will
- cause spurious re-recognition if the old move had a PARALLEL since
- the new one still will, but we can't call single_set without
- having put NEW_BODY into the insn and the re-recognition won't
- hurt in this rare case. */
- if (old_set != 0
- && ((GET_CODE (SET_SRC (old_set)) == REG
- && (GET_CODE (new_body) != SET
- || GET_CODE (SET_SRC (new_body)) != REG))
- /* If this was a load from or store to memory, compare
- the MEM in recog_operand to the one in the insn. If they
- are not equal, then rerecognize the insn. */
- || (old_set != 0
- && ((GET_CODE (SET_SRC (old_set)) == MEM
- && SET_SRC (old_set) != recog_operand[1])
- || (GET_CODE (SET_DEST (old_set)) == MEM
- && SET_DEST (old_set) != recog_operand[0])))
- /* If this was an add insn before, rerecognize. */
- || GET_CODE (SET_SRC (old_set)) == PLUS))
- {
- if (! validate_change (insn, &PATTERN (insn), new_body, 0))
- /* If recognition fails, store the new body anyway.
- It's normal to have recognition failures here
- due to bizarre memory addresses; reloading will fix them. */
- PATTERN (insn) = new_body;
- }
- else
- PATTERN (insn) = new_body;
-
- val = 1;
- }
-
- /* Loop through all elimination pairs. See if any have changed and
- recalculate the number not at initial offset.
-
- Compute the maximum offset (minimum offset if the stack does not
- grow downward) for each elimination pair.
-
- We also detect a cases where register elimination cannot be done,
- namely, if a register would be both changed and referenced outside a MEM
- in the resulting insn since such an insn is often undefined and, even if
- not, we cannot know what meaning will be given to it. Note that it is
- valid to have a register used in an address in an insn that changes it
- (presumably with a pre- or post-increment or decrement).
-
- If anything changes, return nonzero. */
-
- num_not_at_initial_offset = 0;
- for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
- {
- if (ep->previous_offset != ep->offset && ep->ref_outside_mem)
- ep->can_eliminate = 0;
-
- ep->ref_outside_mem = 0;
-
- if (ep->previous_offset != ep->offset)
- val = 1;
-
- ep->previous_offset = ep->offset;
- if (ep->can_eliminate && ep->offset != ep->initial_offset)
- num_not_at_initial_offset++;
-
-#ifdef STACK_GROWS_DOWNWARD
- ep->max_offset = MAX (ep->max_offset, ep->offset);
-#else
- ep->max_offset = MIN (ep->max_offset, ep->offset);
-#endif
- }
-
- done:
- /* If we changed something, perform elimination in REG_NOTES. This is
- needed even when REPLACE is zero because a REG_DEAD note might refer
- to a register that we eliminate and could cause a different number
- of spill registers to be needed in the final reload pass than in
- the pre-passes. */
- if (val && REG_NOTES (insn) != 0)
- REG_NOTES (insn) = eliminate_regs (REG_NOTES (insn), 0, REG_NOTES (insn), 0);
-
- if (! replace)
- pop_obstacks ();
-
- return val;
-}
-
-/* Given X, a SET or CLOBBER of DEST, if DEST is the target of a register
- replacement we currently believe is valid, mark it as not eliminable if X
- modifies DEST in any way other than by adding a constant integer to it.
-
- If DEST is the frame pointer, we do nothing because we assume that
- all assignments to the hard frame pointer are nonlocal gotos and are being
- done at a time when they are valid and do not disturb anything else.
- Some machines want to eliminate a fake argument pointer with either the
- frame or stack pointer. Assignments to the hard frame pointer must not
- prevent this elimination.
-
- Called via note_stores from reload before starting its passes to scan
- the insns of the function. */
-
-static void
-mark_not_eliminable (dest, x)
- rtx dest;
- rtx x;
-{
- register int i;
-
- /* A SUBREG of a hard register here is just changing its mode. We should
- not see a SUBREG of an eliminable hard register, but check just in
- case. */
- if (GET_CODE (dest) == SUBREG)
- dest = SUBREG_REG (dest);
-
- if (dest == hard_frame_pointer_rtx)
- return;
-
- for (i = 0; i < NUM_ELIMINABLE_REGS; i++)
- if (reg_eliminate[i].can_eliminate && dest == reg_eliminate[i].to_rtx
- && (GET_CODE (x) != SET
- || GET_CODE (SET_SRC (x)) != PLUS
- || XEXP (SET_SRC (x), 0) != dest
- || GET_CODE (XEXP (SET_SRC (x), 1)) != CONST_INT))
- {
- reg_eliminate[i].can_eliminate_previous
- = reg_eliminate[i].can_eliminate = 0;
- num_eliminable--;
- }
-}
-
-/* Kick all pseudos out of hard register REGNO.
- If GLOBAL is nonzero, try to find someplace else to put them.
- If DUMPFILE is nonzero, log actions taken on that file.
-
- If CANT_ELIMINATE is nonzero, it means that we are doing this spill
- because we found we can't eliminate some register. In the case, no pseudos
- are allowed to be in the register, even if they are only in a block that
- doesn't require spill registers, unlike the case when we are spilling this
- hard reg to produce another spill register.
-
- Return nonzero if any pseudos needed to be kicked out. */
-
-static int
-spill_hard_reg (regno, global, dumpfile, cant_eliminate)
- register int regno;
- int global;
- FILE *dumpfile;
- int cant_eliminate;
-{
- enum reg_class class = REGNO_REG_CLASS (regno);
- int something_changed = 0;
- register int i;
-
- SET_HARD_REG_BIT (forbidden_regs, regno);
-
- if (cant_eliminate)
- regs_ever_live[regno] = 1;
-
- /* Spill every pseudo reg that was allocated to this reg
- or to something that overlaps this reg. */
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- if (reg_renumber[i] >= 0
- && reg_renumber[i] <= regno
- && (reg_renumber[i]
- + HARD_REGNO_NREGS (reg_renumber[i],
- PSEUDO_REGNO_MODE (i))
- > regno))
- {
- /* If this register belongs solely to a basic block which needed no
- spilling of any class that this register is contained in,
- leave it be, unless we are spilling this register because
- it was a hard register that can't be eliminated. */
-
- if (! cant_eliminate
- && basic_block_needs[0]
- && reg_basic_block[i] >= 0
- && basic_block_needs[(int) class][reg_basic_block[i]] == 0)
- {
- enum reg_class *p;
-
- for (p = reg_class_superclasses[(int) class];
- *p != LIM_REG_CLASSES; p++)
- if (basic_block_needs[(int) *p][reg_basic_block[i]] > 0)
- break;
-
- if (*p == LIM_REG_CLASSES)
- continue;
- }
-
- /* Mark it as no longer having a hard register home. */
- reg_renumber[i] = -1;
- /* We will need to scan everything again. */
- something_changed = 1;
- if (global)
- retry_global_alloc (i, forbidden_regs);
-
- alter_reg (i, regno);
- if (dumpfile)
- {
- if (reg_renumber[i] == -1)
- fprintf (dumpfile, " Register %d now on stack.\n\n", i);
- else
- fprintf (dumpfile, " Register %d now in %d.\n\n",
- i, reg_renumber[i]);
- }
- }
- for (i = 0; i < scratch_list_length; i++)
- {
- if (scratch_list[i] && REGNO (scratch_list[i]) == regno)
- {
- if (! cant_eliminate && basic_block_needs[0]
- && ! basic_block_needs[(int) class][scratch_block[i]])
- {
- enum reg_class *p;
-
- for (p = reg_class_superclasses[(int) class];
- *p != LIM_REG_CLASSES; p++)
- if (basic_block_needs[(int) *p][scratch_block[i]] > 0)
- break;
-
- if (*p == LIM_REG_CLASSES)
- continue;
- }
- PUT_CODE (scratch_list[i], SCRATCH);
- scratch_list[i] = 0;
- something_changed = 1;
- continue;
- }
- }
-
- return something_changed;
-}
-
-/* Find all paradoxical subregs within X and update reg_max_ref_width.
- Also mark any hard registers used to store user variables as
- forbidden from being used for spill registers. */
-
-static void
-scan_paradoxical_subregs (x)
- register rtx x;
-{
- register int i;
- register char *fmt;
- register enum rtx_code code = GET_CODE (x);
-
- switch (code)
- {
- case REG:
-#ifdef SMALL_REGISTER_CLASSES
- if (SMALL_REGISTER_CLASSES
- && REGNO (x) < FIRST_PSEUDO_REGISTER
- && REG_USERVAR_P (x))
- SET_HARD_REG_BIT (forbidden_regs, REGNO (x));
-#endif
- return;
-
- case CONST_INT:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST_DOUBLE:
- case CC0:
- case PC:
- case USE:
- case CLOBBER:
- return;
-
- case SUBREG:
- if (GET_CODE (SUBREG_REG (x)) == REG
- && GET_MODE_SIZE (GET_MODE (x)) > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- reg_max_ref_width[REGNO (SUBREG_REG (x))]
- = GET_MODE_SIZE (GET_MODE (x));
- return;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- scan_paradoxical_subregs (XEXP (x, i));
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >=0; j--)
- scan_paradoxical_subregs (XVECEXP (x, i, j));
- }
- }
-}
-
-static int
-hard_reg_use_compare (p1p, p2p)
- const GENERIC_PTR p1p;
- const GENERIC_PTR p2p;
-{
- struct hard_reg_n_uses *p1 = (struct hard_reg_n_uses *)p1p,
- *p2 = (struct hard_reg_n_uses *)p2p;
- int tem = p1->uses - p2->uses;
- if (tem != 0) return tem;
- /* If regs are equally good, sort by regno,
- so that the results of qsort leave nothing to chance. */
- return p1->regno - p2->regno;
-}
-
-/* Choose the order to consider regs for use as reload registers
- based on how much trouble would be caused by spilling one.
- Store them in order of decreasing preference in potential_reload_regs. */
-
-static void
-order_regs_for_reload (global)
- int global;
-{
- register int i;
- register int o = 0;
- int large = 0;
-
- struct hard_reg_n_uses hard_reg_n_uses[FIRST_PSEUDO_REGISTER];
-
- CLEAR_HARD_REG_SET (bad_spill_regs);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- potential_reload_regs[i] = -1;
-
- /* Count number of uses of each hard reg by pseudo regs allocated to it
- and then order them by decreasing use. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- hard_reg_n_uses[i].uses = 0;
- hard_reg_n_uses[i].regno = i;
- }
-
- for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
- {
- int regno = reg_renumber[i];
- if (regno >= 0)
- {
- int lim = regno + HARD_REGNO_NREGS (regno, PSEUDO_REGNO_MODE (i));
- while (regno < lim)
- {
- /* If allocated by local-alloc, show more uses since
- we're not going to be able to reallocate it, but
- we might if allocated by global alloc. */
- if (global && reg_allocno[i] < 0)
- hard_reg_n_uses[regno].uses += (reg_n_refs[i] + 1) / 2;
-
- hard_reg_n_uses[regno++].uses += reg_n_refs[i];
- }
- }
- large += reg_n_refs[i];
- }
-
- /* Now fixed registers (which cannot safely be used for reloading)
- get a very high use count so they will be considered least desirable.
- Registers used explicitly in the rtl code are almost as bad. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (fixed_regs[i])
- {
- hard_reg_n_uses[i].uses += 2 * large + 2;
- SET_HARD_REG_BIT (bad_spill_regs, i);
- }
- else if (regs_explicitly_used[i])
- {
- hard_reg_n_uses[i].uses += large + 1;
- /* ??? We are doing this here because of the potential that
- bad code may be generated if a register explicitly used in
- an insn was used as a spill register for that insn. But
- not using these are spill registers may lose on some machine.
- We'll have to see how this works out. */
-#ifdef SMALL_REGISTER_CLASSES
- if (! SMALL_REGISTER_CLASSES)
-#endif
- SET_HARD_REG_BIT (bad_spill_regs, i);
- }
- }
- hard_reg_n_uses[HARD_FRAME_POINTER_REGNUM].uses += 2 * large + 2;
- SET_HARD_REG_BIT (bad_spill_regs, HARD_FRAME_POINTER_REGNUM);
-
-#ifdef ELIMINABLE_REGS
- /* If registers other than the frame pointer are eliminable, mark them as
- poor choices. */
- for (i = 0; i < NUM_ELIMINABLE_REGS; i++)
- {
- hard_reg_n_uses[reg_eliminate[i].from].uses += 2 * large + 2;
- SET_HARD_REG_BIT (bad_spill_regs, reg_eliminate[i].from);
- }
-#endif
-
- /* Prefer registers not so far used, for use in temporary loading.
- Among them, if REG_ALLOC_ORDER is defined, use that order.
- Otherwise, prefer registers not preserved by calls. */
-
-#ifdef REG_ALLOC_ORDER
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- int regno = reg_alloc_order[i];
-
- if (hard_reg_n_uses[regno].uses == 0)
- potential_reload_regs[o++] = regno;
- }
-#else
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (hard_reg_n_uses[i].uses == 0 && call_used_regs[i])
- potential_reload_regs[o++] = i;
- }
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (hard_reg_n_uses[i].uses == 0 && ! call_used_regs[i])
- potential_reload_regs[o++] = i;
- }
-#endif
-
- qsort (hard_reg_n_uses, FIRST_PSEUDO_REGISTER,
- sizeof hard_reg_n_uses[0], hard_reg_use_compare);
-
- /* Now add the regs that are already used,
- preferring those used less often. The fixed and otherwise forbidden
- registers will be at the end of this list. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (hard_reg_n_uses[i].uses != 0)
- potential_reload_regs[o++] = hard_reg_n_uses[i].regno;
-}
-
-/* Used in reload_as_needed to sort the spilled regs. */
-
-static int
-compare_spill_regs (r1p, r2p)
- const GENERIC_PTR r1p;
- const GENERIC_PTR r2p;
-{
- short r1 = *(short *)r1p, r2 = *(short *)r2p;
- return r1 - r2;
-}
-
-/* Reload pseudo-registers into hard regs around each insn as needed.
- Additional register load insns are output before the insn that needs it
- and perhaps store insns after insns that modify the reloaded pseudo reg.
-
- reg_last_reload_reg and reg_reloaded_contents keep track of
- which registers are already available in reload registers.
- We update these for the reloads that we perform,
- as the insns are scanned. */
-
-static void
-reload_as_needed (first, live_known)
- rtx first;
- int live_known;
-{
- register rtx insn;
- register int i;
- int this_block = 0;
- rtx x;
- rtx after_call = 0;
-
- bzero ((char *) spill_reg_rtx, sizeof spill_reg_rtx);
- bzero ((char *) spill_reg_store, sizeof spill_reg_store);
- reg_last_reload_reg = (rtx *) alloca (max_regno * sizeof (rtx));
- bzero ((char *) reg_last_reload_reg, max_regno * sizeof (rtx));
- reg_has_output_reload = (char *) alloca (max_regno);
- for (i = 0; i < n_spills; i++)
- {
- reg_reloaded_contents[i] = -1;
- reg_reloaded_insn[i] = 0;
- }
-
- /* Reset all offsets on eliminable registers to their initial values. */
-#ifdef ELIMINABLE_REGS
- for (i = 0; i < NUM_ELIMINABLE_REGS; i++)
- {
- INITIAL_ELIMINATION_OFFSET (reg_eliminate[i].from, reg_eliminate[i].to,
- reg_eliminate[i].initial_offset);
- reg_eliminate[i].previous_offset
- = reg_eliminate[i].offset = reg_eliminate[i].initial_offset;
- }
-#else
- INITIAL_FRAME_POINTER_OFFSET (reg_eliminate[0].initial_offset);
- reg_eliminate[0].previous_offset
- = reg_eliminate[0].offset = reg_eliminate[0].initial_offset;
-#endif
-
- num_not_at_initial_offset = 0;
-
- /* Order the spilled regs, so that allocate_reload_regs can guarantee to
- pack registers with group needs. */
- if (n_spills > 1)
- {
- qsort (spill_regs, n_spills, sizeof (short), compare_spill_regs);
- for (i = 0; i < n_spills; i++)
- spill_reg_order[spill_regs[i]] = i;
- }
-
- for (insn = first; insn;)
- {
- register rtx next = NEXT_INSN (insn);
-
- /* Notice when we move to a new basic block. */
- if (live_known && this_block + 1 < n_basic_blocks
- && insn == basic_block_head[this_block+1])
- ++this_block;
-
- /* If we pass a label, copy the offsets from the label information
- into the current offsets of each elimination. */
- if (GET_CODE (insn) == CODE_LABEL)
- {
- num_not_at_initial_offset = 0;
- for (i = 0; i < NUM_ELIMINABLE_REGS; i++)
- {
- reg_eliminate[i].offset = reg_eliminate[i].previous_offset
- = offsets_at[CODE_LABEL_NUMBER (insn)][i];
- if (reg_eliminate[i].can_eliminate
- && (reg_eliminate[i].offset
- != reg_eliminate[i].initial_offset))
- num_not_at_initial_offset++;
- }
- }
-
- else if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- rtx avoid_return_reg = 0;
- rtx oldpat = PATTERN (insn);
-
-#ifdef SMALL_REGISTER_CLASSES
- /* Set avoid_return_reg if this is an insn
- that might use the value of a function call. */
- if (SMALL_REGISTER_CLASSES && GET_CODE (insn) == CALL_INSN)
- {
- if (GET_CODE (PATTERN (insn)) == SET)
- after_call = SET_DEST (PATTERN (insn));
- else if (GET_CODE (PATTERN (insn)) == PARALLEL
- && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET)
- after_call = SET_DEST (XVECEXP (PATTERN (insn), 0, 0));
- else
- after_call = 0;
- }
- else if (SMALL_REGISTER_CLASSES
- && after_call != 0
- && !(GET_CODE (PATTERN (insn)) == SET
- && SET_DEST (PATTERN (insn)) == stack_pointer_rtx))
- {
- if (reg_referenced_p (after_call, PATTERN (insn)))
- avoid_return_reg = after_call;
- after_call = 0;
- }
-#endif /* SMALL_REGISTER_CLASSES */
-
- /* If this is a USE and CLOBBER of a MEM, ensure that any
- references to eliminable registers have been removed. */
-
- if ((GET_CODE (PATTERN (insn)) == USE
- || GET_CODE (PATTERN (insn)) == CLOBBER)
- && GET_CODE (XEXP (PATTERN (insn), 0)) == MEM)
- XEXP (XEXP (PATTERN (insn), 0), 0)
- = eliminate_regs (XEXP (XEXP (PATTERN (insn), 0), 0),
- GET_MODE (XEXP (PATTERN (insn), 0)),
- NULL_RTX, 0);
-
- /* If we need to do register elimination processing, do so.
- This might delete the insn, in which case we are done. */
- if (num_eliminable && GET_MODE (insn) == QImode)
- {
- eliminate_regs_in_insn (insn, 1);
- if (GET_CODE (insn) == NOTE)
- {
- insn = next;
- continue;
- }
- }
-
- if (GET_MODE (insn) == VOIDmode)
- n_reloads = 0;
- /* First find the pseudo regs that must be reloaded for this insn.
- This info is returned in the tables reload_... (see reload.h).
- Also modify the body of INSN by substituting RELOAD
- rtx's for those pseudo regs. */
- else
- {
- bzero (reg_has_output_reload, max_regno);
- CLEAR_HARD_REG_SET (reg_is_output_reload);
-
- find_reloads (insn, 1, spill_indirect_levels, live_known,
- spill_reg_order);
- }
-
- if (n_reloads > 0)
- {
- rtx prev = PREV_INSN (insn), next = NEXT_INSN (insn);
- rtx p;
- int class;
-
- /* If this block has not had spilling done for a
- particular clas and we have any non-optionals that need a
- spill reg in that class, abort. */
-
- for (class = 0; class < N_REG_CLASSES; class++)
- if (basic_block_needs[class] != 0
- && basic_block_needs[class][this_block] == 0)
- for (i = 0; i < n_reloads; i++)
- if (class == (int) reload_reg_class[i]
- && reload_reg_rtx[i] == 0
- && ! reload_optional[i]
- && (reload_in[i] != 0 || reload_out[i] != 0
- || reload_secondary_p[i] != 0))
- fatal_insn ("Non-optional registers need a spill register", insn);
-
- /* Now compute which reload regs to reload them into. Perhaps
- reusing reload regs from previous insns, or else output
- load insns to reload them. Maybe output store insns too.
- Record the choices of reload reg in reload_reg_rtx. */
- choose_reload_regs (insn, avoid_return_reg);
-
-#ifdef SMALL_REGISTER_CLASSES
- /* Merge any reloads that we didn't combine for fear of
- increasing the number of spill registers needed but now
- discover can be safely merged. */
- if (SMALL_REGISTER_CLASSES)
- merge_assigned_reloads (insn);
-#endif
-
- /* Generate the insns to reload operands into or out of
- their reload regs. */
- emit_reload_insns (insn);
-
- /* Substitute the chosen reload regs from reload_reg_rtx
- into the insn's body (or perhaps into the bodies of other
- load and store insn that we just made for reloading
- and that we moved the structure into). */
- subst_reloads ();
-
- /* If this was an ASM, make sure that all the reload insns
- we have generated are valid. If not, give an error
- and delete them. */
-
- if (asm_noperands (PATTERN (insn)) >= 0)
- for (p = NEXT_INSN (prev); p != next; p = NEXT_INSN (p))
- if (p != insn && GET_RTX_CLASS (GET_CODE (p)) == 'i'
- && (recog_memoized (p) < 0
- || (insn_extract (p),
- ! constrain_operands (INSN_CODE (p), 1))))
- {
- error_for_asm (insn,
- "`asm' operand requires impossible reload");
- PUT_CODE (p, NOTE);
- NOTE_SOURCE_FILE (p) = 0;
- NOTE_LINE_NUMBER (p) = NOTE_INSN_DELETED;
- }
- }
- /* Any previously reloaded spilled pseudo reg, stored in this insn,
- is no longer validly lying around to save a future reload.
- Note that this does not detect pseudos that were reloaded
- for this insn in order to be stored in
- (obeying register constraints). That is correct; such reload
- registers ARE still valid. */
- note_stores (oldpat, forget_old_reloads_1);
-
- /* There may have been CLOBBER insns placed after INSN. So scan
- between INSN and NEXT and use them to forget old reloads. */
- for (x = NEXT_INSN (insn); x != next; x = NEXT_INSN (x))
- if (GET_CODE (x) == INSN && GET_CODE (PATTERN (x)) == CLOBBER)
- note_stores (PATTERN (x), forget_old_reloads_1);
-
-#ifdef AUTO_INC_DEC
- /* Likewise for regs altered by auto-increment in this insn.
- But note that the reg-notes are not changed by reloading:
- they still contain the pseudo-regs, not the spill regs. */
- for (x = REG_NOTES (insn); x; x = XEXP (x, 1))
- if (REG_NOTE_KIND (x) == REG_INC)
- {
- /* See if this pseudo reg was reloaded in this insn.
- If so, its last-reload info is still valid
- because it is based on this insn's reload. */
- for (i = 0; i < n_reloads; i++)
- if (reload_out[i] == XEXP (x, 0))
- break;
-
- if (i == n_reloads)
- forget_old_reloads_1 (XEXP (x, 0), NULL_RTX);
- }
-#endif
- }
- /* A reload reg's contents are unknown after a label. */
- if (GET_CODE (insn) == CODE_LABEL)
- for (i = 0; i < n_spills; i++)
- {
- reg_reloaded_contents[i] = -1;
- reg_reloaded_insn[i] = 0;
- }
-
- /* Don't assume a reload reg is still good after a call insn
- if it is a call-used reg. */
- else if (GET_CODE (insn) == CALL_INSN)
- for (i = 0; i < n_spills; i++)
- if (call_used_regs[spill_regs[i]])
- {
- reg_reloaded_contents[i] = -1;
- reg_reloaded_insn[i] = 0;
- }
-
- /* In case registers overlap, allow certain insns to invalidate
- particular hard registers. */
-
-#ifdef INSN_CLOBBERS_REGNO_P
- for (i = 0 ; i < n_spills ; i++)
- if (INSN_CLOBBERS_REGNO_P (insn, spill_regs[i]))
- {
- reg_reloaded_contents[i] = -1;
- reg_reloaded_insn[i] = 0;
- }
-#endif
-
- insn = next;
-
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
- }
-}
-
-/* Discard all record of any value reloaded from X,
- or reloaded in X from someplace else;
- unless X is an output reload reg of the current insn.
-
- X may be a hard reg (the reload reg)
- or it may be a pseudo reg that was reloaded from. */
-
-static void
-forget_old_reloads_1 (x, ignored)
- rtx x;
- rtx ignored;
-{
- register int regno;
- int nr;
- int offset = 0;
-
- /* note_stores does give us subregs of hard regs. */
- while (GET_CODE (x) == SUBREG)
- {
- offset += SUBREG_WORD (x);
- x = SUBREG_REG (x);
- }
-
- if (GET_CODE (x) != REG)
- return;
-
- regno = REGNO (x) + offset;
-
- if (regno >= FIRST_PSEUDO_REGISTER)
- nr = 1;
- else
- {
- int i;
- nr = HARD_REGNO_NREGS (regno, GET_MODE (x));
- /* Storing into a spilled-reg invalidates its contents.
- This can happen if a block-local pseudo is allocated to that reg
- and it wasn't spilled because this block's total need is 0.
- Then some insn might have an optional reload and use this reg. */
- for (i = 0; i < nr; i++)
- if (spill_reg_order[regno + i] >= 0
- /* But don't do this if the reg actually serves as an output
- reload reg in the current instruction. */
- && (n_reloads == 0
- || ! TEST_HARD_REG_BIT (reg_is_output_reload, regno + i)))
- {
- reg_reloaded_contents[spill_reg_order[regno + i]] = -1;
- reg_reloaded_insn[spill_reg_order[regno + i]] = 0;
- }
- }
-
- /* Since value of X has changed,
- forget any value previously copied from it. */
-
- while (nr-- > 0)
- /* But don't forget a copy if this is the output reload
- that establishes the copy's validity. */
- if (n_reloads == 0 || reg_has_output_reload[regno + nr] == 0)
- reg_last_reload_reg[regno + nr] = 0;
-}
-
-/* For each reload, the mode of the reload register. */
-static enum machine_mode reload_mode[MAX_RELOADS];
-
-/* For each reload, the largest number of registers it will require. */
-static int reload_nregs[MAX_RELOADS];
-
-/* Comparison function for qsort to decide which of two reloads
- should be handled first. *P1 and *P2 are the reload numbers. */
-
-static int
-reload_reg_class_lower (r1p, r2p)
- const GENERIC_PTR r1p;
- const GENERIC_PTR r2p;
-{
- register int r1 = *(short *)r1p, r2 = *(short *)r2p;
- register int t;
-
- /* Consider required reloads before optional ones. */
- t = reload_optional[r1] - reload_optional[r2];
- if (t != 0)
- return t;
-
- /* Count all solitary classes before non-solitary ones. */
- t = ((reg_class_size[(int) reload_reg_class[r2]] == 1)
- - (reg_class_size[(int) reload_reg_class[r1]] == 1));
- if (t != 0)
- return t;
-
- /* Aside from solitaires, consider all multi-reg groups first. */
- t = reload_nregs[r2] - reload_nregs[r1];
- if (t != 0)
- return t;
-
- /* Consider reloads in order of increasing reg-class number. */
- t = (int) reload_reg_class[r1] - (int) reload_reg_class[r2];
- if (t != 0)
- return t;
-
- /* If reloads are equally urgent, sort by reload number,
- so that the results of qsort leave nothing to chance. */
- return r1 - r2;
-}
-
-/* The following HARD_REG_SETs indicate when each hard register is
- used for a reload of various parts of the current insn. */
-
-/* If reg is in use as a reload reg for a RELOAD_OTHER reload. */
-static HARD_REG_SET reload_reg_used;
-/* If reg is in use for a RELOAD_FOR_INPUT_ADDRESS reload for operand I. */
-static HARD_REG_SET reload_reg_used_in_input_addr[MAX_RECOG_OPERANDS];
-/* If reg is in use for a RELOAD_FOR_INPADDR_ADDRESS reload for operand I. */
-static HARD_REG_SET reload_reg_used_in_inpaddr_addr[MAX_RECOG_OPERANDS];
-/* If reg is in use for a RELOAD_FOR_OUTPUT_ADDRESS reload for operand I. */
-static HARD_REG_SET reload_reg_used_in_output_addr[MAX_RECOG_OPERANDS];
-/* If reg is in use for a RELOAD_FOR_OUTADDR_ADDRESS reload for operand I. */
-static HARD_REG_SET reload_reg_used_in_outaddr_addr[MAX_RECOG_OPERANDS];
-/* If reg is in use for a RELOAD_FOR_INPUT reload for operand I. */
-static HARD_REG_SET reload_reg_used_in_input[MAX_RECOG_OPERANDS];
-/* If reg is in use for a RELOAD_FOR_OUTPUT reload for operand I. */
-static HARD_REG_SET reload_reg_used_in_output[MAX_RECOG_OPERANDS];
-/* If reg is in use for a RELOAD_FOR_OPERAND_ADDRESS reload. */
-static HARD_REG_SET reload_reg_used_in_op_addr;
-/* If reg is in use for a RELOAD_FOR_OPADDR_ADDR reload. */
-static HARD_REG_SET reload_reg_used_in_op_addr_reload;
-/* If reg is in use for a RELOAD_FOR_INSN reload. */
-static HARD_REG_SET reload_reg_used_in_insn;
-/* If reg is in use for a RELOAD_FOR_OTHER_ADDRESS reload. */
-static HARD_REG_SET reload_reg_used_in_other_addr;
-
-/* If reg is in use as a reload reg for any sort of reload. */
-static HARD_REG_SET reload_reg_used_at_all;
-
-/* If reg is use as an inherited reload. We just mark the first register
- in the group. */
-static HARD_REG_SET reload_reg_used_for_inherit;
-
-/* Mark reg REGNO as in use for a reload of the sort spec'd by OPNUM and
- TYPE. MODE is used to indicate how many consecutive regs are
- actually used. */
-
-static void
-mark_reload_reg_in_use (regno, opnum, type, mode)
- int regno;
- int opnum;
- enum reload_type type;
- enum machine_mode mode;
-{
- int nregs = HARD_REGNO_NREGS (regno, mode);
- int i;
-
- for (i = regno; i < nregs + regno; i++)
- {
- switch (type)
- {
- case RELOAD_OTHER:
- SET_HARD_REG_BIT (reload_reg_used, i);
- break;
-
- case RELOAD_FOR_INPUT_ADDRESS:
- SET_HARD_REG_BIT (reload_reg_used_in_input_addr[opnum], i);
- break;
-
- case RELOAD_FOR_INPADDR_ADDRESS:
- SET_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[opnum], i);
- break;
-
- case RELOAD_FOR_OUTPUT_ADDRESS:
- SET_HARD_REG_BIT (reload_reg_used_in_output_addr[opnum], i);
- break;
-
- case RELOAD_FOR_OUTADDR_ADDRESS:
- SET_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[opnum], i);
- break;
-
- case RELOAD_FOR_OPERAND_ADDRESS:
- SET_HARD_REG_BIT (reload_reg_used_in_op_addr, i);
- break;
-
- case RELOAD_FOR_OPADDR_ADDR:
- SET_HARD_REG_BIT (reload_reg_used_in_op_addr_reload, i);
- break;
-
- case RELOAD_FOR_OTHER_ADDRESS:
- SET_HARD_REG_BIT (reload_reg_used_in_other_addr, i);
- break;
-
- case RELOAD_FOR_INPUT:
- SET_HARD_REG_BIT (reload_reg_used_in_input[opnum], i);
- break;
-
- case RELOAD_FOR_OUTPUT:
- SET_HARD_REG_BIT (reload_reg_used_in_output[opnum], i);
- break;
-
- case RELOAD_FOR_INSN:
- SET_HARD_REG_BIT (reload_reg_used_in_insn, i);
- break;
- }
-
- SET_HARD_REG_BIT (reload_reg_used_at_all, i);
- }
-}
-
-/* Similarly, but show REGNO is no longer in use for a reload. */
-
-static void
-clear_reload_reg_in_use (regno, opnum, type, mode)
- int regno;
- int opnum;
- enum reload_type type;
- enum machine_mode mode;
-{
- int nregs = HARD_REGNO_NREGS (regno, mode);
- int i;
-
- for (i = regno; i < nregs + regno; i++)
- {
- switch (type)
- {
- case RELOAD_OTHER:
- CLEAR_HARD_REG_BIT (reload_reg_used, i);
- break;
-
- case RELOAD_FOR_INPUT_ADDRESS:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_input_addr[opnum], i);
- break;
-
- case RELOAD_FOR_INPADDR_ADDRESS:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[opnum], i);
- break;
-
- case RELOAD_FOR_OUTPUT_ADDRESS:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_output_addr[opnum], i);
- break;
-
- case RELOAD_FOR_OUTADDR_ADDRESS:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[opnum], i);
- break;
-
- case RELOAD_FOR_OPERAND_ADDRESS:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_op_addr, i);
- break;
-
- case RELOAD_FOR_OPADDR_ADDR:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_op_addr_reload, i);
- break;
-
- case RELOAD_FOR_OTHER_ADDRESS:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_other_addr, i);
- break;
-
- case RELOAD_FOR_INPUT:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_input[opnum], i);
- break;
-
- case RELOAD_FOR_OUTPUT:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_output[opnum], i);
- break;
-
- case RELOAD_FOR_INSN:
- CLEAR_HARD_REG_BIT (reload_reg_used_in_insn, i);
- break;
- }
- }
-}
-
-/* 1 if reg REGNO is free as a reload reg for a reload of the sort
- specified by OPNUM and TYPE. */
-
-static int
-reload_reg_free_p (regno, opnum, type)
- int regno;
- int opnum;
- enum reload_type type;
-{
- int i;
-
- /* In use for a RELOAD_OTHER means it's not available for anything. */
- if (TEST_HARD_REG_BIT (reload_reg_used, regno))
- return 0;
-
- switch (type)
- {
- case RELOAD_OTHER:
- /* In use for anything means we can't use it for RELOAD_OTHER. */
- if (TEST_HARD_REG_BIT (reload_reg_used_in_other_addr, regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_op_addr, regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno))
- return 0;
-
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- return 1;
-
- case RELOAD_FOR_INPUT:
- if (TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_op_addr, regno))
- return 0;
-
- if (TEST_HARD_REG_BIT (reload_reg_used_in_op_addr_reload, regno))
- return 0;
-
- /* If it is used for some other input, can't use it. */
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
- return 0;
-
- /* If it is used in a later operand's address, can't use it. */
- for (i = opnum + 1; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno))
- return 0;
-
- return 1;
-
- case RELOAD_FOR_INPUT_ADDRESS:
- /* Can't use a register if it is used for an input address for this
- operand or used as an input in an earlier one. */
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[opnum], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[opnum], regno))
- return 0;
-
- for (i = 0; i < opnum; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
- return 0;
-
- return 1;
-
- case RELOAD_FOR_INPADDR_ADDRESS:
- /* Can't use a register if it is used for an input address
- address for this operand or used as an input in an earlier
- one. */
- if (TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[opnum], regno))
- return 0;
-
- for (i = 0; i < opnum; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
- return 0;
-
- return 1;
-
- case RELOAD_FOR_OUTPUT_ADDRESS:
- /* Can't use a register if it is used for an output address for this
- operand or used as an output in this or a later operand. */
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[opnum], regno))
- return 0;
-
- for (i = opnum; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- return 1;
-
- case RELOAD_FOR_OUTADDR_ADDRESS:
- /* Can't use a register if it is used for an output address
- address for this operand or used as an output in this or a
- later operand. */
- if (TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[opnum], regno))
- return 0;
-
- for (i = opnum; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- return 1;
-
- case RELOAD_FOR_OPERAND_ADDRESS:
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
- return 0;
-
- return (! TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno)
- && ! TEST_HARD_REG_BIT (reload_reg_used_in_op_addr, regno));
-
- case RELOAD_FOR_OPADDR_ADDR:
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
- return 0;
-
- return (!TEST_HARD_REG_BIT (reload_reg_used_in_op_addr_reload, regno));
-
- case RELOAD_FOR_OUTPUT:
- /* This cannot share a register with RELOAD_FOR_INSN reloads, other
- outputs, or an operand address for this or an earlier output. */
- if (TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno))
- return 0;
-
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- for (i = 0; i <= opnum; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno))
- return 0;
-
- return 1;
-
- case RELOAD_FOR_INSN:
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- return (! TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno)
- && ! TEST_HARD_REG_BIT (reload_reg_used_in_op_addr, regno));
-
- case RELOAD_FOR_OTHER_ADDRESS:
- return ! TEST_HARD_REG_BIT (reload_reg_used_in_other_addr, regno);
- }
- abort ();
-}
-
-/* Return 1 if the value in reload reg REGNO, as used by a reload
- needed for the part of the insn specified by OPNUM and TYPE,
- is not in use for a reload in any prior part of the insn.
-
- We can assume that the reload reg was already tested for availability
- at the time it is needed, and we should not check this again,
- in case the reg has already been marked in use. */
-
-static int
-reload_reg_free_before_p (regno, opnum, type)
- int regno;
- int opnum;
- enum reload_type type;
-{
- int i;
-
- switch (type)
- {
- case RELOAD_FOR_OTHER_ADDRESS:
- /* These always come first. */
- return 1;
-
- case RELOAD_OTHER:
- return ! TEST_HARD_REG_BIT (reload_reg_used_in_other_addr, regno);
-
- /* If this use is for part of the insn,
- check the reg is not in use for any prior part. It is tempting
- to try to do this by falling through from objecs that occur
- later in the insn to ones that occur earlier, but that will not
- correctly take into account the fact that here we MUST ignore
- things that would prevent the register from being allocated in
- the first place, since we know that it was allocated. */
-
- case RELOAD_FOR_OUTPUT_ADDRESS:
- case RELOAD_FOR_OUTADDR_ADDRESS:
- /* Earlier reloads are for earlier outputs or their addresses,
- any RELOAD_FOR_INSN reloads, any inputs or their addresses, or any
- RELOAD_FOR_OTHER_ADDRESS reloads (we know it can't conflict with
- RELOAD_OTHER).. */
- for (i = 0; i < opnum; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- if (TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno))
- return 0;
-
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
- return 0;
-
- return (! TEST_HARD_REG_BIT (reload_reg_used_in_other_addr, regno)
- && ! TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno)
- && ! TEST_HARD_REG_BIT (reload_reg_used_in_op_addr, regno));
-
- case RELOAD_FOR_OUTPUT:
- /* This can't be used in the output address for this operand and
- anything that can't be used for it, except that we've already
- tested for RELOAD_FOR_INSN objects. */
-
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[opnum], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[opnum], regno))
- return 0;
-
- for (i = 0; i < opnum; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_op_addr, regno))
- return 0;
-
- return ! TEST_HARD_REG_BIT (reload_reg_used_in_other_addr, regno);
-
- case RELOAD_FOR_OPERAND_ADDRESS:
- /* Earlier reloads include RELOAD_FOR_OPADDR_ADDR reloads. */
- if (TEST_HARD_REG_BIT (reload_reg_used_in_op_addr_reload, regno))
- return 0;
-
- /* ... fall through ... */
-
- case RELOAD_FOR_OPADDR_ADDR:
- case RELOAD_FOR_INSN:
- /* These can't conflict with inputs, or each other, so all we have to
- test is input addresses and the addresses of OTHER items. */
-
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno))
- return 0;
-
- return ! TEST_HARD_REG_BIT (reload_reg_used_in_other_addr, regno);
-
- case RELOAD_FOR_INPUT:
- /* The only things earlier are the address for this and
- earlier inputs, other inputs (which we know we don't conflict
- with), and addresses of RELOAD_OTHER objects. */
-
- for (i = 0; i <= opnum; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno))
- return 0;
-
- return ! TEST_HARD_REG_BIT (reload_reg_used_in_other_addr, regno);
-
- case RELOAD_FOR_INPUT_ADDRESS:
- case RELOAD_FOR_INPADDR_ADDRESS:
- /* Similarly, all we have to check is for use in earlier inputs'
- addresses. */
- for (i = 0; i < opnum; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno))
- return 0;
-
- return ! TEST_HARD_REG_BIT (reload_reg_used_in_other_addr, regno);
- }
- abort ();
-}
-
-/* Return 1 if the value in reload reg REGNO, as used by a reload
- needed for the part of the insn specified by OPNUM and TYPE,
- is still available in REGNO at the end of the insn.
-
- We can assume that the reload reg was already tested for availability
- at the time it is needed, and we should not check this again,
- in case the reg has already been marked in use. */
-
-static int
-reload_reg_reaches_end_p (regno, opnum, type)
- int regno;
- int opnum;
- enum reload_type type;
-{
- int i;
-
- switch (type)
- {
- case RELOAD_OTHER:
- /* Since a RELOAD_OTHER reload claims the reg for the entire insn,
- its value must reach the end. */
- return 1;
-
- /* If this use is for part of the insn,
- its value reaches if no subsequent part uses the same register.
- Just like the above function, don't try to do this with lots
- of fallthroughs. */
-
- case RELOAD_FOR_OTHER_ADDRESS:
- /* Here we check for everything else, since these don't conflict
- with anything else and everything comes later. */
-
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
- return 0;
-
- return (! TEST_HARD_REG_BIT (reload_reg_used_in_op_addr, regno)
- && ! TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno)
- && ! TEST_HARD_REG_BIT (reload_reg_used, regno));
-
- case RELOAD_FOR_INPUT_ADDRESS:
- case RELOAD_FOR_INPADDR_ADDRESS:
- /* Similar, except that we check only for this and subsequent inputs
- and the address of only subsequent inputs and we do not need
- to check for RELOAD_OTHER objects since they are known not to
- conflict. */
-
- for (i = opnum; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
- return 0;
-
- for (i = opnum + 1; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno))
- return 0;
-
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- if (TEST_HARD_REG_BIT (reload_reg_used_in_op_addr_reload, regno))
- return 0;
-
- return (! TEST_HARD_REG_BIT (reload_reg_used_in_op_addr, regno)
- && ! TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno));
-
- case RELOAD_FOR_INPUT:
- /* Similar to input address, except we start at the next operand for
- both input and input address and we do not check for
- RELOAD_FOR_OPERAND_ADDRESS and RELOAD_FOR_INSN since these
- would conflict. */
-
- for (i = opnum + 1; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_input_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_input[i], regno))
- return 0;
-
- /* ... fall through ... */
-
- case RELOAD_FOR_OPERAND_ADDRESS:
- /* Check outputs and their addresses. */
-
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- return 1;
-
- case RELOAD_FOR_OPADDR_ADDR:
- for (i = 0; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
- return 0;
-
- return (! TEST_HARD_REG_BIT (reload_reg_used_in_op_addr, regno)
- && !TEST_HARD_REG_BIT (reload_reg_used_in_insn, regno));
-
- case RELOAD_FOR_INSN:
- /* These conflict with other outputs with RELOAD_OTHER. So
- we need only check for output addresses. */
-
- opnum = -1;
-
- /* ... fall through ... */
-
- case RELOAD_FOR_OUTPUT:
- case RELOAD_FOR_OUTPUT_ADDRESS:
- case RELOAD_FOR_OUTADDR_ADDRESS:
- /* We already know these can't conflict with a later output. So the
- only thing to check are later output addresses. */
- for (i = opnum + 1; i < reload_n_operands; i++)
- if (TEST_HARD_REG_BIT (reload_reg_used_in_output_addr[i], regno)
- || TEST_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[i], regno))
- return 0;
-
- return 1;
- }
-
- abort ();
-}
-
-/* Return 1 if the reloads denoted by R1 and R2 cannot share a register.
- Return 0 otherwise.
-
- This function uses the same algorithm as reload_reg_free_p above. */
-
-static int
-reloads_conflict (r1, r2)
- int r1, r2;
-{
- enum reload_type r1_type = reload_when_needed[r1];
- enum reload_type r2_type = reload_when_needed[r2];
- int r1_opnum = reload_opnum[r1];
- int r2_opnum = reload_opnum[r2];
-
- /* RELOAD_OTHER conflicts with everything. */
- if (r2_type == RELOAD_OTHER)
- return 1;
-
- /* Otherwise, check conflicts differently for each type. */
-
- switch (r1_type)
- {
- case RELOAD_FOR_INPUT:
- return (r2_type == RELOAD_FOR_INSN
- || r2_type == RELOAD_FOR_OPERAND_ADDRESS
- || r2_type == RELOAD_FOR_OPADDR_ADDR
- || r2_type == RELOAD_FOR_INPUT
- || ((r2_type == RELOAD_FOR_INPUT_ADDRESS
- || r2_type == RELOAD_FOR_INPADDR_ADDRESS)
- && r2_opnum > r1_opnum));
-
- case RELOAD_FOR_INPUT_ADDRESS:
- return ((r2_type == RELOAD_FOR_INPUT_ADDRESS && r1_opnum == r2_opnum)
- || (r2_type == RELOAD_FOR_INPUT && r2_opnum < r1_opnum));
-
- case RELOAD_FOR_INPADDR_ADDRESS:
- return ((r2_type == RELOAD_FOR_INPADDR_ADDRESS && r1_opnum == r2_opnum)
- || (r2_type == RELOAD_FOR_INPUT && r2_opnum < r1_opnum));
-
- case RELOAD_FOR_OUTPUT_ADDRESS:
- return ((r2_type == RELOAD_FOR_OUTPUT_ADDRESS && r2_opnum == r1_opnum)
- || (r2_type == RELOAD_FOR_OUTPUT && r2_opnum >= r1_opnum));
-
- case RELOAD_FOR_OUTADDR_ADDRESS:
- return ((r2_type == RELOAD_FOR_OUTADDR_ADDRESS && r2_opnum == r1_opnum)
- || (r2_type == RELOAD_FOR_OUTPUT && r2_opnum >= r1_opnum));
-
- case RELOAD_FOR_OPERAND_ADDRESS:
- return (r2_type == RELOAD_FOR_INPUT || r2_type == RELOAD_FOR_INSN
- || r2_type == RELOAD_FOR_OPERAND_ADDRESS);
-
- case RELOAD_FOR_OPADDR_ADDR:
- return (r2_type == RELOAD_FOR_INPUT
- || r2_type == RELOAD_FOR_OPADDR_ADDR);
-
- case RELOAD_FOR_OUTPUT:
- return (r2_type == RELOAD_FOR_INSN || r2_type == RELOAD_FOR_OUTPUT
- || ((r2_type == RELOAD_FOR_OUTPUT_ADDRESS
- || r2_type == RELOAD_FOR_OUTADDR_ADDRESS)
- && r2_opnum >= r1_opnum));
-
- case RELOAD_FOR_INSN:
- return (r2_type == RELOAD_FOR_INPUT || r2_type == RELOAD_FOR_OUTPUT
- || r2_type == RELOAD_FOR_INSN
- || r2_type == RELOAD_FOR_OPERAND_ADDRESS);
-
- case RELOAD_FOR_OTHER_ADDRESS:
- return r2_type == RELOAD_FOR_OTHER_ADDRESS;
-
- case RELOAD_OTHER:
- return 1;
-
- default:
- abort ();
- }
-}
-
-/* Vector of reload-numbers showing the order in which the reloads should
- be processed. */
-short reload_order[MAX_RELOADS];
-
-/* Indexed by reload number, 1 if incoming value
- inherited from previous insns. */
-char reload_inherited[MAX_RELOADS];
-
-/* For an inherited reload, this is the insn the reload was inherited from,
- if we know it. Otherwise, this is 0. */
-rtx reload_inheritance_insn[MAX_RELOADS];
-
-/* If non-zero, this is a place to get the value of the reload,
- rather than using reload_in. */
-rtx reload_override_in[MAX_RELOADS];
-
-/* For each reload, the index in spill_regs of the spill register used,
- or -1 if we did not need one of the spill registers for this reload. */
-int reload_spill_index[MAX_RELOADS];
-
-/* Find a spill register to use as a reload register for reload R.
- LAST_RELOAD is non-zero if this is the last reload for the insn being
- processed.
-
- Set reload_reg_rtx[R] to the register allocated.
-
- If NOERROR is nonzero, we return 1 if successful,
- or 0 if we couldn't find a spill reg and we didn't change anything. */
-
-static int
-allocate_reload_reg (r, insn, last_reload, noerror)
- int r;
- rtx insn;
- int last_reload;
- int noerror;
-{
- int i;
- int pass;
- int count;
- rtx new;
- int regno;
-
- /* If we put this reload ahead, thinking it is a group,
- then insist on finding a group. Otherwise we can grab a
- reg that some other reload needs.
- (That can happen when we have a 68000 DATA_OR_FP_REG
- which is a group of data regs or one fp reg.)
- We need not be so restrictive if there are no more reloads
- for this insn.
-
- ??? Really it would be nicer to have smarter handling
- for that kind of reg class, where a problem like this is normal.
- Perhaps those classes should be avoided for reloading
- by use of more alternatives. */
-
- int force_group = reload_nregs[r] > 1 && ! last_reload;
-
- /* If we want a single register and haven't yet found one,
- take any reg in the right class and not in use.
- If we want a consecutive group, here is where we look for it.
-
- We use two passes so we can first look for reload regs to
- reuse, which are already in use for other reloads in this insn,
- and only then use additional registers.
- I think that maximizing reuse is needed to make sure we don't
- run out of reload regs. Suppose we have three reloads, and
- reloads A and B can share regs. These need two regs.
- Suppose A and B are given different regs.
- That leaves none for C. */
- for (pass = 0; pass < 2; pass++)
- {
- /* I is the index in spill_regs.
- We advance it round-robin between insns to use all spill regs
- equally, so that inherited reloads have a chance
- of leapfrogging each other. Don't do this, however, when we have
- group needs and failure would be fatal; if we only have a relatively
- small number of spill registers, and more than one of them has
- group needs, then by starting in the middle, we may end up
- allocating the first one in such a way that we are not left with
- sufficient groups to handle the rest. */
-
- if (noerror || ! force_group)
- i = last_spill_reg;
- else
- i = -1;
-
- for (count = 0; count < n_spills; count++)
- {
- int class = (int) reload_reg_class[r];
-
- i = (i + 1) % n_spills;
-
- if (reload_reg_free_p (spill_regs[i], reload_opnum[r],
- reload_when_needed[r])
- && TEST_HARD_REG_BIT (reg_class_contents[class], spill_regs[i])
- && HARD_REGNO_MODE_OK (spill_regs[i], reload_mode[r])
- /* Look first for regs to share, then for unshared. But
- don't share regs used for inherited reloads; they are
- the ones we want to preserve. */
- && (pass
- || (TEST_HARD_REG_BIT (reload_reg_used_at_all,
- spill_regs[i])
- && ! TEST_HARD_REG_BIT (reload_reg_used_for_inherit,
- spill_regs[i]))))
- {
- int nr = HARD_REGNO_NREGS (spill_regs[i], reload_mode[r]);
- /* Avoid the problem where spilling a GENERAL_OR_FP_REG
- (on 68000) got us two FP regs. If NR is 1,
- we would reject both of them. */
- if (force_group)
- nr = CLASS_MAX_NREGS (reload_reg_class[r], reload_mode[r]);
- /* If we need only one reg, we have already won. */
- if (nr == 1)
- {
- /* But reject a single reg if we demand a group. */
- if (force_group)
- continue;
- break;
- }
- /* Otherwise check that as many consecutive regs as we need
- are available here.
- Also, don't use for a group registers that are
- needed for nongroups. */
- if (! TEST_HARD_REG_BIT (counted_for_nongroups, spill_regs[i]))
- while (nr > 1)
- {
- regno = spill_regs[i] + nr - 1;
- if (!(TEST_HARD_REG_BIT (reg_class_contents[class], regno)
- && spill_reg_order[regno] >= 0
- && reload_reg_free_p (regno, reload_opnum[r],
- reload_when_needed[r])
- && ! TEST_HARD_REG_BIT (counted_for_nongroups,
- regno)))
- break;
- nr--;
- }
- if (nr == 1)
- break;
- }
- }
-
- /* If we found something on pass 1, omit pass 2. */
- if (count < n_spills)
- break;
- }
-
- /* We should have found a spill register by now. */
- if (count == n_spills)
- {
- if (noerror)
- return 0;
- goto failure;
- }
-
- /* I is the index in SPILL_REG_RTX of the reload register we are to
- allocate. Get an rtx for it and find its register number. */
-
- new = spill_reg_rtx[i];
-
- if (new == 0 || GET_MODE (new) != reload_mode[r])
- spill_reg_rtx[i] = new
- = gen_rtx (REG, reload_mode[r], spill_regs[i]);
-
- regno = true_regnum (new);
-
- /* Detect when the reload reg can't hold the reload mode.
- This used to be one `if', but Sequent compiler can't handle that. */
- if (HARD_REGNO_MODE_OK (regno, reload_mode[r]))
- {
- enum machine_mode test_mode = VOIDmode;
- if (reload_in[r])
- test_mode = GET_MODE (reload_in[r]);
- /* If reload_in[r] has VOIDmode, it means we will load it
- in whatever mode the reload reg has: to wit, reload_mode[r].
- We have already tested that for validity. */
- /* Aside from that, we need to test that the expressions
- to reload from or into have modes which are valid for this
- reload register. Otherwise the reload insns would be invalid. */
- if (! (reload_in[r] != 0 && test_mode != VOIDmode
- && ! HARD_REGNO_MODE_OK (regno, test_mode)))
- if (! (reload_out[r] != 0
- && ! HARD_REGNO_MODE_OK (regno, GET_MODE (reload_out[r]))))
- {
- /* The reg is OK. */
- last_spill_reg = i;
-
- /* Mark as in use for this insn the reload regs we use
- for this. */
- mark_reload_reg_in_use (spill_regs[i], reload_opnum[r],
- reload_when_needed[r], reload_mode[r]);
-
- reload_reg_rtx[r] = new;
- reload_spill_index[r] = i;
- return 1;
- }
- }
-
- /* The reg is not OK. */
- if (noerror)
- return 0;
-
- failure:
- if (asm_noperands (PATTERN (insn)) < 0)
- /* It's the compiler's fault. */
- fatal_insn ("Could not find a spill register", insn);
-
- /* It's the user's fault; the operand's mode and constraint
- don't match. Disable this reload so we don't crash in final. */
- error_for_asm (insn,
- "`asm' operand constraint incompatible with operand size");
- reload_in[r] = 0;
- reload_out[r] = 0;
- reload_reg_rtx[r] = 0;
- reload_optional[r] = 1;
- reload_secondary_p[r] = 1;
-
- return 1;
-}
-
-/* Assign hard reg targets for the pseudo-registers we must reload
- into hard regs for this insn.
- Also output the instructions to copy them in and out of the hard regs.
-
- For machines with register classes, we are responsible for
- finding a reload reg in the proper class. */
-
-static void
-choose_reload_regs (insn, avoid_return_reg)
- rtx insn;
- rtx avoid_return_reg;
-{
- register int i, j;
- int max_group_size = 1;
- enum reg_class group_class = NO_REGS;
- int inheritance;
-
- rtx save_reload_reg_rtx[MAX_RELOADS];
- char save_reload_inherited[MAX_RELOADS];
- rtx save_reload_inheritance_insn[MAX_RELOADS];
- rtx save_reload_override_in[MAX_RELOADS];
- int save_reload_spill_index[MAX_RELOADS];
- HARD_REG_SET save_reload_reg_used;
- HARD_REG_SET save_reload_reg_used_in_input_addr[MAX_RECOG_OPERANDS];
- HARD_REG_SET save_reload_reg_used_in_inpaddr_addr[MAX_RECOG_OPERANDS];
- HARD_REG_SET save_reload_reg_used_in_output_addr[MAX_RECOG_OPERANDS];
- HARD_REG_SET save_reload_reg_used_in_outaddr_addr[MAX_RECOG_OPERANDS];
- HARD_REG_SET save_reload_reg_used_in_input[MAX_RECOG_OPERANDS];
- HARD_REG_SET save_reload_reg_used_in_output[MAX_RECOG_OPERANDS];
- HARD_REG_SET save_reload_reg_used_in_op_addr;
- HARD_REG_SET save_reload_reg_used_in_op_addr_reload;
- HARD_REG_SET save_reload_reg_used_in_insn;
- HARD_REG_SET save_reload_reg_used_in_other_addr;
- HARD_REG_SET save_reload_reg_used_at_all;
-
- bzero (reload_inherited, MAX_RELOADS);
- bzero ((char *) reload_inheritance_insn, MAX_RELOADS * sizeof (rtx));
- bzero ((char *) reload_override_in, MAX_RELOADS * sizeof (rtx));
-
- CLEAR_HARD_REG_SET (reload_reg_used);
- CLEAR_HARD_REG_SET (reload_reg_used_at_all);
- CLEAR_HARD_REG_SET (reload_reg_used_in_op_addr);
- CLEAR_HARD_REG_SET (reload_reg_used_in_op_addr_reload);
- CLEAR_HARD_REG_SET (reload_reg_used_in_insn);
- CLEAR_HARD_REG_SET (reload_reg_used_in_other_addr);
-
- for (i = 0; i < reload_n_operands; i++)
- {
- CLEAR_HARD_REG_SET (reload_reg_used_in_output[i]);
- CLEAR_HARD_REG_SET (reload_reg_used_in_input[i]);
- CLEAR_HARD_REG_SET (reload_reg_used_in_input_addr[i]);
- CLEAR_HARD_REG_SET (reload_reg_used_in_inpaddr_addr[i]);
- CLEAR_HARD_REG_SET (reload_reg_used_in_output_addr[i]);
- CLEAR_HARD_REG_SET (reload_reg_used_in_outaddr_addr[i]);
- }
-
-#ifdef SMALL_REGISTER_CLASSES
- /* Don't bother with avoiding the return reg
- if we have no mandatory reload that could use it. */
- if (SMALL_REGISTER_CLASSES && avoid_return_reg)
- {
- int do_avoid = 0;
- int regno = REGNO (avoid_return_reg);
- int nregs
- = HARD_REGNO_NREGS (regno, GET_MODE (avoid_return_reg));
- int r;
-
- for (r = regno; r < regno + nregs; r++)
- if (spill_reg_order[r] >= 0)
- for (j = 0; j < n_reloads; j++)
- if (!reload_optional[j] && reload_reg_rtx[j] == 0
- && (reload_in[j] != 0 || reload_out[j] != 0
- || reload_secondary_p[j])
- &&
- TEST_HARD_REG_BIT (reg_class_contents[(int) reload_reg_class[j]], r))
- do_avoid = 1;
- if (!do_avoid)
- avoid_return_reg = 0;
- }
-#endif /* SMALL_REGISTER_CLASSES */
-
-#if 0 /* Not needed, now that we can always retry without inheritance. */
- /* See if we have more mandatory reloads than spill regs.
- If so, then we cannot risk optimizations that could prevent
- reloads from sharing one spill register.
-
- Since we will try finding a better register than reload_reg_rtx
- unless it is equal to reload_in or reload_out, count such reloads. */
-
- {
- int tem = 0;
-#ifdef SMALL_REGISTER_CLASSES
- if (SMALL_REGISTER_CLASSES)
- tem = (avoid_return_reg != 0);
-#endif
- for (j = 0; j < n_reloads; j++)
- if (! reload_optional[j]
- && (reload_in[j] != 0 || reload_out[j] != 0 || reload_secondary_p[j])
- && (reload_reg_rtx[j] == 0
- || (! rtx_equal_p (reload_reg_rtx[j], reload_in[j])
- && ! rtx_equal_p (reload_reg_rtx[j], reload_out[j]))))
- tem++;
- if (tem > n_spills)
- must_reuse = 1;
- }
-#endif
-
-#ifdef SMALL_REGISTER_CLASSES
- /* Don't use the subroutine call return reg for a reload
- if we are supposed to avoid it. */
- if (SMALL_REGISTER_CLASSES && avoid_return_reg)
- {
- int regno = REGNO (avoid_return_reg);
- int nregs
- = HARD_REGNO_NREGS (regno, GET_MODE (avoid_return_reg));
- int r;
-
- for (r = regno; r < regno + nregs; r++)
- if (spill_reg_order[r] >= 0)
- SET_HARD_REG_BIT (reload_reg_used, r);
- }
-#endif /* SMALL_REGISTER_CLASSES */
-
- /* In order to be certain of getting the registers we need,
- we must sort the reloads into order of increasing register class.
- Then our grabbing of reload registers will parallel the process
- that provided the reload registers.
-
- Also note whether any of the reloads wants a consecutive group of regs.
- If so, record the maximum size of the group desired and what
- register class contains all the groups needed by this insn. */
-
- for (j = 0; j < n_reloads; j++)
- {
- reload_order[j] = j;
- reload_spill_index[j] = -1;
-
- reload_mode[j]
- = (reload_inmode[j] == VOIDmode
- || (GET_MODE_SIZE (reload_outmode[j])
- > GET_MODE_SIZE (reload_inmode[j])))
- ? reload_outmode[j] : reload_inmode[j];
-
- reload_nregs[j] = CLASS_MAX_NREGS (reload_reg_class[j], reload_mode[j]);
-
- if (reload_nregs[j] > 1)
- {
- max_group_size = MAX (reload_nregs[j], max_group_size);
- group_class = reg_class_superunion[(int)reload_reg_class[j]][(int)group_class];
- }
-
- /* If we have already decided to use a certain register,
- don't use it in another way. */
- if (reload_reg_rtx[j])
- mark_reload_reg_in_use (REGNO (reload_reg_rtx[j]), reload_opnum[j],
- reload_when_needed[j], reload_mode[j]);
- }
-
- if (n_reloads > 1)
- qsort (reload_order, n_reloads, sizeof (short), reload_reg_class_lower);
-
- bcopy ((char *) reload_reg_rtx, (char *) save_reload_reg_rtx,
- sizeof reload_reg_rtx);
- bcopy (reload_inherited, save_reload_inherited, sizeof reload_inherited);
- bcopy ((char *) reload_inheritance_insn,
- (char *) save_reload_inheritance_insn,
- sizeof reload_inheritance_insn);
- bcopy ((char *) reload_override_in, (char *) save_reload_override_in,
- sizeof reload_override_in);
- bcopy ((char *) reload_spill_index, (char *) save_reload_spill_index,
- sizeof reload_spill_index);
- COPY_HARD_REG_SET (save_reload_reg_used, reload_reg_used);
- COPY_HARD_REG_SET (save_reload_reg_used_at_all, reload_reg_used_at_all);
- COPY_HARD_REG_SET (save_reload_reg_used_in_op_addr,
- reload_reg_used_in_op_addr);
-
- COPY_HARD_REG_SET (save_reload_reg_used_in_op_addr_reload,
- reload_reg_used_in_op_addr_reload);
-
- COPY_HARD_REG_SET (save_reload_reg_used_in_insn,
- reload_reg_used_in_insn);
- COPY_HARD_REG_SET (save_reload_reg_used_in_other_addr,
- reload_reg_used_in_other_addr);
-
- for (i = 0; i < reload_n_operands; i++)
- {
- COPY_HARD_REG_SET (save_reload_reg_used_in_output[i],
- reload_reg_used_in_output[i]);
- COPY_HARD_REG_SET (save_reload_reg_used_in_input[i],
- reload_reg_used_in_input[i]);
- COPY_HARD_REG_SET (save_reload_reg_used_in_input_addr[i],
- reload_reg_used_in_input_addr[i]);
- COPY_HARD_REG_SET (save_reload_reg_used_in_inpaddr_addr[i],
- reload_reg_used_in_inpaddr_addr[i]);
- COPY_HARD_REG_SET (save_reload_reg_used_in_output_addr[i],
- reload_reg_used_in_output_addr[i]);
- COPY_HARD_REG_SET (save_reload_reg_used_in_outaddr_addr[i],
- reload_reg_used_in_outaddr_addr[i]);
- }
-
- /* If -O, try first with inheritance, then turning it off.
- If not -O, don't do inheritance.
- Using inheritance when not optimizing leads to paradoxes
- with fp on the 68k: fp numbers (not NaNs) fail to be equal to themselves
- because one side of the comparison might be inherited. */
-
- for (inheritance = optimize > 0; inheritance >= 0; inheritance--)
- {
- /* Process the reloads in order of preference just found.
- Beyond this point, subregs can be found in reload_reg_rtx.
-
- This used to look for an existing reloaded home for all
- of the reloads, and only then perform any new reloads.
- But that could lose if the reloads were done out of reg-class order
- because a later reload with a looser constraint might have an old
- home in a register needed by an earlier reload with a tighter constraint.
-
- To solve this, we make two passes over the reloads, in the order
- described above. In the first pass we try to inherit a reload
- from a previous insn. If there is a later reload that needs a
- class that is a proper subset of the class being processed, we must
- also allocate a spill register during the first pass.
-
- Then make a second pass over the reloads to allocate any reloads
- that haven't been given registers yet. */
-
- CLEAR_HARD_REG_SET (reload_reg_used_for_inherit);
-
- for (j = 0; j < n_reloads; j++)
- {
- register int r = reload_order[j];
-
- /* Ignore reloads that got marked inoperative. */
- if (reload_out[r] == 0 && reload_in[r] == 0 && ! reload_secondary_p[r])
- continue;
-
- /* If find_reloads chose a to use reload_in or reload_out as a reload
- register, we don't need to chose one. Otherwise, try even if it found
- one since we might save an insn if we find the value lying around. */
- if (reload_in[r] != 0 && reload_reg_rtx[r] != 0
- && (rtx_equal_p (reload_in[r], reload_reg_rtx[r])
- || rtx_equal_p (reload_out[r], reload_reg_rtx[r])))
- continue;
-
-#if 0 /* No longer needed for correct operation.
- It might give better code, or might not; worth an experiment? */
- /* If this is an optional reload, we can't inherit from earlier insns
- until we are sure that any non-optional reloads have been allocated.
- The following code takes advantage of the fact that optional reloads
- are at the end of reload_order. */
- if (reload_optional[r] != 0)
- for (i = 0; i < j; i++)
- if ((reload_out[reload_order[i]] != 0
- || reload_in[reload_order[i]] != 0
- || reload_secondary_p[reload_order[i]])
- && ! reload_optional[reload_order[i]]
- && reload_reg_rtx[reload_order[i]] == 0)
- allocate_reload_reg (reload_order[i], insn, 0, inheritance);
-#endif
-
- /* First see if this pseudo is already available as reloaded
- for a previous insn. We cannot try to inherit for reloads
- that are smaller than the maximum number of registers needed
- for groups unless the register we would allocate cannot be used
- for the groups.
-
- We could check here to see if this is a secondary reload for
- an object that is already in a register of the desired class.
- This would avoid the need for the secondary reload register.
- But this is complex because we can't easily determine what
- objects might want to be loaded via this reload. So let a register
- be allocated here. In `emit_reload_insns' we suppress one of the
- loads in the case described above. */
-
- if (inheritance)
- {
- register int regno = -1;
- enum machine_mode mode;
-
- if (reload_in[r] == 0)
- ;
- else if (GET_CODE (reload_in[r]) == REG)
- {
- regno = REGNO (reload_in[r]);
- mode = GET_MODE (reload_in[r]);
- }
- else if (GET_CODE (reload_in_reg[r]) == REG)
- {
- regno = REGNO (reload_in_reg[r]);
- mode = GET_MODE (reload_in_reg[r]);
- }
-#if 0
- /* This won't work, since REGNO can be a pseudo reg number.
- Also, it takes much more hair to keep track of all the things
- that can invalidate an inherited reload of part of a pseudoreg. */
- else if (GET_CODE (reload_in[r]) == SUBREG
- && GET_CODE (SUBREG_REG (reload_in[r])) == REG)
- regno = REGNO (SUBREG_REG (reload_in[r])) + SUBREG_WORD (reload_in[r]);
-#endif
-
- if (regno >= 0 && reg_last_reload_reg[regno] != 0)
- {
- i = spill_reg_order[REGNO (reg_last_reload_reg[regno])];
-
- if (reg_reloaded_contents[i] == regno
- && (GET_MODE_SIZE (GET_MODE (reg_last_reload_reg[regno]))
- >= GET_MODE_SIZE (mode))
- && HARD_REGNO_MODE_OK (spill_regs[i], reload_mode[r])
- && TEST_HARD_REG_BIT (reg_class_contents[(int) reload_reg_class[r]],
- spill_regs[i])
- && (reload_nregs[r] == max_group_size
- || ! TEST_HARD_REG_BIT (reg_class_contents[(int) group_class],
- spill_regs[i]))
- && reload_reg_free_p (spill_regs[i], reload_opnum[r],
- reload_when_needed[r])
- && reload_reg_free_before_p (spill_regs[i],
- reload_opnum[r],
- reload_when_needed[r]))
- {
- /* If a group is needed, verify that all the subsequent
- registers still have their values intact. */
- int nr
- = HARD_REGNO_NREGS (spill_regs[i], reload_mode[r]);
- int k;
-
- for (k = 1; k < nr; k++)
- if (reg_reloaded_contents[spill_reg_order[spill_regs[i] + k]]
- != regno)
- break;
-
- if (k == nr)
- {
- int i1;
-
- /* We found a register that contains the
- value we need. If this register is the
- same as an `earlyclobber' operand of the
- current insn, just mark it as a place to
- reload from since we can't use it as the
- reload register itself. */
-
- for (i1 = 0; i1 < n_earlyclobbers; i1++)
- if (reg_overlap_mentioned_for_reload_p
- (reg_last_reload_reg[regno],
- reload_earlyclobbers[i1]))
- break;
-
- if (i1 != n_earlyclobbers
- /* Don't really use the inherited spill reg
- if we need it wider than we've got it. */
- || (GET_MODE_SIZE (reload_mode[r])
- > GET_MODE_SIZE (mode)))
- reload_override_in[r] = reg_last_reload_reg[regno];
- else
- {
- int k;
- /* We can use this as a reload reg. */
- /* Mark the register as in use for this part of
- the insn. */
- mark_reload_reg_in_use (spill_regs[i],
- reload_opnum[r],
- reload_when_needed[r],
- reload_mode[r]);
- reload_reg_rtx[r] = reg_last_reload_reg[regno];
- reload_inherited[r] = 1;
- reload_inheritance_insn[r]
- = reg_reloaded_insn[i];
- reload_spill_index[r] = i;
- for (k = 0; k < nr; k++)
- SET_HARD_REG_BIT (reload_reg_used_for_inherit,
- spill_regs[i + k]);
- }
- }
- }
- }
- }
-
- /* Here's another way to see if the value is already lying around. */
- if (inheritance
- && reload_in[r] != 0
- && ! reload_inherited[r]
- && reload_out[r] == 0
- && (CONSTANT_P (reload_in[r])
- || GET_CODE (reload_in[r]) == PLUS
- || GET_CODE (reload_in[r]) == REG
- || GET_CODE (reload_in[r]) == MEM)
- && (reload_nregs[r] == max_group_size
- || ! reg_classes_intersect_p (reload_reg_class[r], group_class)))
- {
- register rtx equiv
- = find_equiv_reg (reload_in[r], insn, reload_reg_class[r],
- -1, NULL_PTR, 0, reload_mode[r]);
- int regno;
-
- if (equiv != 0)
- {
- if (GET_CODE (equiv) == REG)
- regno = REGNO (equiv);
- else if (GET_CODE (equiv) == SUBREG)
- {
- /* This must be a SUBREG of a hard register.
- Make a new REG since this might be used in an
- address and not all machines support SUBREGs
- there. */
- regno = REGNO (SUBREG_REG (equiv)) + SUBREG_WORD (equiv);
- equiv = gen_rtx (REG, reload_mode[r], regno);
- }
- else
- abort ();
- }
-
- /* If we found a spill reg, reject it unless it is free
- and of the desired class. */
- if (equiv != 0
- && ((spill_reg_order[regno] >= 0
- && ! reload_reg_free_before_p (regno, reload_opnum[r],
- reload_when_needed[r]))
- || ! TEST_HARD_REG_BIT (reg_class_contents[(int) reload_reg_class[r]],
- regno)))
- equiv = 0;
-
- if (equiv != 0 && TEST_HARD_REG_BIT (reload_reg_used_at_all, regno))
- equiv = 0;
-
- if (equiv != 0 && ! HARD_REGNO_MODE_OK (regno, reload_mode[r]))
- equiv = 0;
-
- /* We found a register that contains the value we need.
- If this register is the same as an `earlyclobber' operand
- of the current insn, just mark it as a place to reload from
- since we can't use it as the reload register itself. */
-
- if (equiv != 0)
- for (i = 0; i < n_earlyclobbers; i++)
- if (reg_overlap_mentioned_for_reload_p (equiv,
- reload_earlyclobbers[i]))
- {
- reload_override_in[r] = equiv;
- equiv = 0;
- break;
- }
-
- /* JRV: If the equiv register we have found is
- explicitly clobbered in the current insn, mark but
- don't use, as above. */
-
- if (equiv != 0 && regno_clobbered_p (regno, insn))
- {
- reload_override_in[r] = equiv;
- equiv = 0;
- }
-
- /* If we found an equivalent reg, say no code need be generated
- to load it, and use it as our reload reg. */
- if (equiv != 0 && regno != HARD_FRAME_POINTER_REGNUM)
- {
- int nr = HARD_REGNO_NREGS (regno, reload_mode[r]);
- int k;
- reload_reg_rtx[r] = equiv;
- reload_inherited[r] = 1;
-
- /* If any of the hard registers in EQUIV are spill
- registers, mark them as in use for this insn. */
- for (k = 0; k < nr; k++)
- {
- i = spill_reg_order[regno + k];
- if (i >= 0)
- {
- mark_reload_reg_in_use (regno, reload_opnum[r],
- reload_when_needed[r],
- reload_mode[r]);
- SET_HARD_REG_BIT (reload_reg_used_for_inherit,
- regno + k);
- }
- }
- }
- }
-
- /* If we found a register to use already, or if this is an optional
- reload, we are done. */
- if (reload_reg_rtx[r] != 0 || reload_optional[r] != 0)
- continue;
-
-#if 0 /* No longer needed for correct operation. Might or might not
- give better code on the average. Want to experiment? */
-
- /* See if there is a later reload that has a class different from our
- class that intersects our class or that requires less register
- than our reload. If so, we must allocate a register to this
- reload now, since that reload might inherit a previous reload
- and take the only available register in our class. Don't do this
- for optional reloads since they will force all previous reloads
- to be allocated. Also don't do this for reloads that have been
- turned off. */
-
- for (i = j + 1; i < n_reloads; i++)
- {
- int s = reload_order[i];
-
- if ((reload_in[s] == 0 && reload_out[s] == 0
- && ! reload_secondary_p[s])
- || reload_optional[s])
- continue;
-
- if ((reload_reg_class[s] != reload_reg_class[r]
- && reg_classes_intersect_p (reload_reg_class[r],
- reload_reg_class[s]))
- || reload_nregs[s] < reload_nregs[r])
- break;
- }
-
- if (i == n_reloads)
- continue;
-
- allocate_reload_reg (r, insn, j == n_reloads - 1, inheritance);
-#endif
- }
-
- /* Now allocate reload registers for anything non-optional that
- didn't get one yet. */
- for (j = 0; j < n_reloads; j++)
- {
- register int r = reload_order[j];
-
- /* Ignore reloads that got marked inoperative. */
- if (reload_out[r] == 0 && reload_in[r] == 0 && ! reload_secondary_p[r])
- continue;
-
- /* Skip reloads that already have a register allocated or are
- optional. */
- if (reload_reg_rtx[r] != 0 || reload_optional[r])
- continue;
-
- if (! allocate_reload_reg (r, insn, j == n_reloads - 1, inheritance))
- break;
- }
-
- /* If that loop got all the way, we have won. */
- if (j == n_reloads)
- break;
-
- fail:
- /* Loop around and try without any inheritance. */
- /* First undo everything done by the failed attempt
- to allocate with inheritance. */
- bcopy ((char *) save_reload_reg_rtx, (char *) reload_reg_rtx,
- sizeof reload_reg_rtx);
- bcopy ((char *) save_reload_inherited, (char *) reload_inherited,
- sizeof reload_inherited);
- bcopy ((char *) save_reload_inheritance_insn,
- (char *) reload_inheritance_insn,
- sizeof reload_inheritance_insn);
- bcopy ((char *) save_reload_override_in, (char *) reload_override_in,
- sizeof reload_override_in);
- bcopy ((char *) save_reload_spill_index, (char *) reload_spill_index,
- sizeof reload_spill_index);
- COPY_HARD_REG_SET (reload_reg_used, save_reload_reg_used);
- COPY_HARD_REG_SET (reload_reg_used_at_all, save_reload_reg_used_at_all);
- COPY_HARD_REG_SET (reload_reg_used_in_op_addr,
- save_reload_reg_used_in_op_addr);
- COPY_HARD_REG_SET (reload_reg_used_in_op_addr_reload,
- save_reload_reg_used_in_op_addr_reload);
- COPY_HARD_REG_SET (reload_reg_used_in_insn,
- save_reload_reg_used_in_insn);
- COPY_HARD_REG_SET (reload_reg_used_in_other_addr,
- save_reload_reg_used_in_other_addr);
-
- for (i = 0; i < reload_n_operands; i++)
- {
- COPY_HARD_REG_SET (reload_reg_used_in_input[i],
- save_reload_reg_used_in_input[i]);
- COPY_HARD_REG_SET (reload_reg_used_in_output[i],
- save_reload_reg_used_in_output[i]);
- COPY_HARD_REG_SET (reload_reg_used_in_input_addr[i],
- save_reload_reg_used_in_input_addr[i]);
- COPY_HARD_REG_SET (reload_reg_used_in_inpaddr_addr[i],
- save_reload_reg_used_in_inpaddr_addr[i]);
- COPY_HARD_REG_SET (reload_reg_used_in_output_addr[i],
- save_reload_reg_used_in_output_addr[i]);
- COPY_HARD_REG_SET (reload_reg_used_in_outaddr_addr[i],
- save_reload_reg_used_in_outaddr_addr[i]);
- }
- }
-
- /* If we thought we could inherit a reload, because it seemed that
- nothing else wanted the same reload register earlier in the insn,
- verify that assumption, now that all reloads have been assigned. */
-
- for (j = 0; j < n_reloads; j++)
- {
- register int r = reload_order[j];
-
- if (reload_inherited[r] && reload_reg_rtx[r] != 0
- && ! reload_reg_free_before_p (true_regnum (reload_reg_rtx[r]),
- reload_opnum[r],
- reload_when_needed[r]))
- reload_inherited[r] = 0;
-
- /* If we found a better place to reload from,
- validate it in the same fashion, if it is a reload reg. */
- if (reload_override_in[r]
- && (GET_CODE (reload_override_in[r]) == REG
- || GET_CODE (reload_override_in[r]) == SUBREG))
- {
- int regno = true_regnum (reload_override_in[r]);
- if (spill_reg_order[regno] >= 0
- && ! reload_reg_free_before_p (regno, reload_opnum[r],
- reload_when_needed[r]))
- reload_override_in[r] = 0;
- }
- }
-
- /* Now that reload_override_in is known valid,
- actually override reload_in. */
- for (j = 0; j < n_reloads; j++)
- if (reload_override_in[j])
- reload_in[j] = reload_override_in[j];
-
- /* If this reload won't be done because it has been cancelled or is
- optional and not inherited, clear reload_reg_rtx so other
- routines (such as subst_reloads) don't get confused. */
- for (j = 0; j < n_reloads; j++)
- if (reload_reg_rtx[j] != 0
- && ((reload_optional[j] && ! reload_inherited[j])
- || (reload_in[j] == 0 && reload_out[j] == 0
- && ! reload_secondary_p[j])))
- {
- int regno = true_regnum (reload_reg_rtx[j]);
-
- if (spill_reg_order[regno] >= 0)
- clear_reload_reg_in_use (regno, reload_opnum[j],
- reload_when_needed[j], reload_mode[j]);
- reload_reg_rtx[j] = 0;
- }
-
- /* Record which pseudos and which spill regs have output reloads. */
- for (j = 0; j < n_reloads; j++)
- {
- register int r = reload_order[j];
-
- i = reload_spill_index[r];
-
- /* I is nonneg if this reload used one of the spill regs.
- If reload_reg_rtx[r] is 0, this is an optional reload
- that we opted to ignore. */
- if (reload_out[r] != 0 && GET_CODE (reload_out[r]) == REG
- && reload_reg_rtx[r] != 0)
- {
- register int nregno = REGNO (reload_out[r]);
- int nr = 1;
-
- if (nregno < FIRST_PSEUDO_REGISTER)
- nr = HARD_REGNO_NREGS (nregno, reload_mode[r]);
-
- while (--nr >= 0)
- reg_has_output_reload[nregno + nr] = 1;
-
- if (i >= 0)
- {
- nr = HARD_REGNO_NREGS (spill_regs[i], reload_mode[r]);
- while (--nr >= 0)
- SET_HARD_REG_BIT (reg_is_output_reload, spill_regs[i] + nr);
- }
-
- if (reload_when_needed[r] != RELOAD_OTHER
- && reload_when_needed[r] != RELOAD_FOR_OUTPUT
- && reload_when_needed[r] != RELOAD_FOR_INSN)
- abort ();
- }
- }
-}
-
-/* If SMALL_REGISTER_CLASSES are defined, we may not have merged two
- reloads of the same item for fear that we might not have enough reload
- registers. However, normally they will get the same reload register
- and hence actually need not be loaded twice.
-
- Here we check for the most common case of this phenomenon: when we have
- a number of reloads for the same object, each of which were allocated
- the same reload_reg_rtx, that reload_reg_rtx is not used for any other
- reload, and is not modified in the insn itself. If we find such,
- merge all the reloads and set the resulting reload to RELOAD_OTHER.
- This will not increase the number of spill registers needed and will
- prevent redundant code. */
-
-#ifdef SMALL_REGISTER_CLASSES
-
-static void
-merge_assigned_reloads (insn)
- rtx insn;
-{
- int i, j;
-
- /* Scan all the reloads looking for ones that only load values and
- are not already RELOAD_OTHER and ones whose reload_reg_rtx are
- assigned and not modified by INSN. */
-
- for (i = 0; i < n_reloads; i++)
- {
- if (reload_in[i] == 0 || reload_when_needed[i] == RELOAD_OTHER
- || reload_out[i] != 0 || reload_reg_rtx[i] == 0
- || reg_set_p (reload_reg_rtx[i], insn))
- continue;
-
- /* Look at all other reloads. Ensure that the only use of this
- reload_reg_rtx is in a reload that just loads the same value
- as we do. Note that any secondary reloads must be of the identical
- class since the values, modes, and result registers are the
- same, so we need not do anything with any secondary reloads. */
-
- for (j = 0; j < n_reloads; j++)
- {
- if (i == j || reload_reg_rtx[j] == 0
- || ! reg_overlap_mentioned_p (reload_reg_rtx[j],
- reload_reg_rtx[i]))
- continue;
-
- /* If the reload regs aren't exactly the same (e.g, different modes)
- or if the values are different, we can't merge anything with this
- reload register. */
-
- if (! rtx_equal_p (reload_reg_rtx[i], reload_reg_rtx[j])
- || reload_out[j] != 0 || reload_in[j] == 0
- || ! rtx_equal_p (reload_in[i], reload_in[j]))
- break;
- }
-
- /* If all is OK, merge the reloads. Only set this to RELOAD_OTHER if
- we, in fact, found any matching reloads. */
-
- if (j == n_reloads)
- {
- for (j = 0; j < n_reloads; j++)
- if (i != j && reload_reg_rtx[j] != 0
- && rtx_equal_p (reload_reg_rtx[i], reload_reg_rtx[j]))
- {
- reload_when_needed[i] = RELOAD_OTHER;
- reload_in[j] = 0;
- transfer_replacements (i, j);
- }
-
- /* If this is now RELOAD_OTHER, look for any reloads that load
- parts of this operand and set them to RELOAD_FOR_OTHER_ADDRESS
- if they were for inputs, RELOAD_OTHER for outputs. Note that
- this test is equivalent to looking for reloads for this operand
- number. */
-
- if (reload_when_needed[i] == RELOAD_OTHER)
- for (j = 0; j < n_reloads; j++)
- if (reload_in[j] != 0
- && reload_when_needed[i] != RELOAD_OTHER
- && reg_overlap_mentioned_for_reload_p (reload_in[j],
- reload_in[i]))
- reload_when_needed[j]
- = ((reload_when_needed[i] == RELOAD_FOR_INPUT_ADDRESS
- || reload_when_needed[i] == RELOAD_FOR_INPADDR_ADDRESS)
- ? RELOAD_FOR_OTHER_ADDRESS : RELOAD_OTHER);
- }
- }
-}
-#endif /* SMALL_RELOAD_CLASSES */
-
-/* Output insns to reload values in and out of the chosen reload regs. */
-
-static void
-emit_reload_insns (insn)
- rtx insn;
-{
- register int j;
- rtx input_reload_insns[MAX_RECOG_OPERANDS];
- rtx other_input_address_reload_insns = 0;
- rtx other_input_reload_insns = 0;
- rtx input_address_reload_insns[MAX_RECOG_OPERANDS];
- rtx inpaddr_address_reload_insns[MAX_RECOG_OPERANDS];
- rtx output_reload_insns[MAX_RECOG_OPERANDS];
- rtx output_address_reload_insns[MAX_RECOG_OPERANDS];
- rtx outaddr_address_reload_insns[MAX_RECOG_OPERANDS];
- rtx operand_reload_insns = 0;
- rtx other_operand_reload_insns = 0;
- rtx other_output_reload_insns[MAX_RECOG_OPERANDS];
- rtx following_insn = NEXT_INSN (insn);
- rtx before_insn = insn;
- int special;
- /* Values to be put in spill_reg_store are put here first. */
- rtx new_spill_reg_store[FIRST_PSEUDO_REGISTER];
-
- for (j = 0; j < reload_n_operands; j++)
- input_reload_insns[j] = input_address_reload_insns[j]
- = inpaddr_address_reload_insns[j]
- = output_reload_insns[j] = output_address_reload_insns[j]
- = outaddr_address_reload_insns[j]
- = other_output_reload_insns[j] = 0;
-
- /* Now output the instructions to copy the data into and out of the
- reload registers. Do these in the order that the reloads were reported,
- since reloads of base and index registers precede reloads of operands
- and the operands may need the base and index registers reloaded. */
-
- for (j = 0; j < n_reloads; j++)
- {
- register rtx old;
- rtx oldequiv_reg = 0;
- rtx this_reload_insn = 0;
-
- if (reload_spill_index[j] >= 0)
- new_spill_reg_store[reload_spill_index[j]] = 0;
-
- old = reload_in[j];
- if (old != 0 && ! reload_inherited[j]
- && ! rtx_equal_p (reload_reg_rtx[j], old)
- && reload_reg_rtx[j] != 0)
- {
- register rtx reloadreg = reload_reg_rtx[j];
- rtx oldequiv = 0;
- enum machine_mode mode;
- rtx *where;
-
- /* Determine the mode to reload in.
- This is very tricky because we have three to choose from.
- There is the mode the insn operand wants (reload_inmode[J]).
- There is the mode of the reload register RELOADREG.
- There is the intrinsic mode of the operand, which we could find
- by stripping some SUBREGs.
- It turns out that RELOADREG's mode is irrelevant:
- we can change that arbitrarily.
-
- Consider (SUBREG:SI foo:QI) as an operand that must be SImode;
- then the reload reg may not support QImode moves, so use SImode.
- If foo is in memory due to spilling a pseudo reg, this is safe,
- because the QImode value is in the least significant part of a
- slot big enough for a SImode. If foo is some other sort of
- memory reference, then it is impossible to reload this case,
- so previous passes had better make sure this never happens.
-
- Then consider a one-word union which has SImode and one of its
- members is a float, being fetched as (SUBREG:SF union:SI).
- We must fetch that as SFmode because we could be loading into
- a float-only register. In this case OLD's mode is correct.
-
- Consider an immediate integer: it has VOIDmode. Here we need
- to get a mode from something else.
-
- In some cases, there is a fourth mode, the operand's
- containing mode. If the insn specifies a containing mode for
- this operand, it overrides all others.
-
- I am not sure whether the algorithm here is always right,
- but it does the right things in those cases. */
-
- mode = GET_MODE (old);
- if (mode == VOIDmode)
- mode = reload_inmode[j];
-
-#ifdef SECONDARY_INPUT_RELOAD_CLASS
- /* If we need a secondary register for this operation, see if
- the value is already in a register in that class. Don't
- do this if the secondary register will be used as a scratch
- register. */
-
- if (reload_secondary_in_reload[j] >= 0
- && reload_secondary_in_icode[j] == CODE_FOR_nothing
- && optimize)
- oldequiv
- = find_equiv_reg (old, insn,
- reload_reg_class[reload_secondary_in_reload[j]],
- -1, NULL_PTR, 0, mode);
-#endif
-
- /* If reloading from memory, see if there is a register
- that already holds the same value. If so, reload from there.
- We can pass 0 as the reload_reg_p argument because
- any other reload has either already been emitted,
- in which case find_equiv_reg will see the reload-insn,
- or has yet to be emitted, in which case it doesn't matter
- because we will use this equiv reg right away. */
-
- if (oldequiv == 0 && optimize
- && (GET_CODE (old) == MEM
- || (GET_CODE (old) == REG
- && REGNO (old) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[REGNO (old)] < 0)))
- oldequiv = find_equiv_reg (old, insn, ALL_REGS,
- -1, NULL_PTR, 0, mode);
-
- if (oldequiv)
- {
- int regno = true_regnum (oldequiv);
-
- /* If OLDEQUIV is a spill register, don't use it for this
- if any other reload needs it at an earlier stage of this insn
- or at this stage. */
- if (spill_reg_order[regno] >= 0
- && (! reload_reg_free_p (regno, reload_opnum[j],
- reload_when_needed[j])
- || ! reload_reg_free_before_p (regno, reload_opnum[j],
- reload_when_needed[j])))
- oldequiv = 0;
-
- /* If OLDEQUIV is not a spill register,
- don't use it if any other reload wants it. */
- if (spill_reg_order[regno] < 0)
- {
- int k;
- for (k = 0; k < n_reloads; k++)
- if (reload_reg_rtx[k] != 0 && k != j
- && reg_overlap_mentioned_for_reload_p (reload_reg_rtx[k],
- oldequiv))
- {
- oldequiv = 0;
- break;
- }
- }
-
- /* If it is no cheaper to copy from OLDEQUIV into the
- reload register than it would be to move from memory,
- don't use it. Likewise, if we need a secondary register
- or memory. */
-
- if (oldequiv != 0
- && ((REGNO_REG_CLASS (regno) != reload_reg_class[j]
- && (REGISTER_MOVE_COST (REGNO_REG_CLASS (regno),
- reload_reg_class[j])
- >= MEMORY_MOVE_COST (mode)))
-#ifdef SECONDARY_INPUT_RELOAD_CLASS
- || (SECONDARY_INPUT_RELOAD_CLASS (reload_reg_class[j],
- mode, oldequiv)
- != NO_REGS)
-#endif
-#ifdef SECONDARY_MEMORY_NEEDED
- || SECONDARY_MEMORY_NEEDED (reload_reg_class[j],
- REGNO_REG_CLASS (regno),
- mode)
-#endif
- ))
- oldequiv = 0;
- }
-
- if (oldequiv == 0)
- oldequiv = old;
- else if (GET_CODE (oldequiv) == REG)
- oldequiv_reg = oldequiv;
- else if (GET_CODE (oldequiv) == SUBREG)
- oldequiv_reg = SUBREG_REG (oldequiv);
-
- /* If we are reloading from a register that was recently stored in
- with an output-reload, see if we can prove there was
- actually no need to store the old value in it. */
-
- if (optimize && GET_CODE (oldequiv) == REG
- && REGNO (oldequiv) < FIRST_PSEUDO_REGISTER
- && spill_reg_order[REGNO (oldequiv)] >= 0
- && spill_reg_store[spill_reg_order[REGNO (oldequiv)]] != 0
- && find_reg_note (insn, REG_DEAD, reload_in[j])
- /* This is unsafe if operand occurs more than once in current
- insn. Perhaps some occurrences weren't reloaded. */
- && count_occurrences (PATTERN (insn), reload_in[j]) == 1)
- delete_output_reload
- (insn, j, spill_reg_store[spill_reg_order[REGNO (oldequiv)]]);
-
- /* Encapsulate both RELOADREG and OLDEQUIV into that mode,
- then load RELOADREG from OLDEQUIV. Note that we cannot use
- gen_lowpart_common since it can do the wrong thing when
- RELOADREG has a multi-word mode. Note that RELOADREG
- must always be a REG here. */
-
- if (GET_MODE (reloadreg) != mode)
- reloadreg = gen_rtx (REG, mode, REGNO (reloadreg));
- while (GET_CODE (oldequiv) == SUBREG && GET_MODE (oldequiv) != mode)
- oldequiv = SUBREG_REG (oldequiv);
- if (GET_MODE (oldequiv) != VOIDmode
- && mode != GET_MODE (oldequiv))
- oldequiv = gen_rtx (SUBREG, mode, oldequiv, 0);
-
- /* Switch to the right place to emit the reload insns. */
- switch (reload_when_needed[j])
- {
- case RELOAD_OTHER:
- where = &other_input_reload_insns;
- break;
- case RELOAD_FOR_INPUT:
- where = &input_reload_insns[reload_opnum[j]];
- break;
- case RELOAD_FOR_INPUT_ADDRESS:
- where = &input_address_reload_insns[reload_opnum[j]];
- break;
- case RELOAD_FOR_INPADDR_ADDRESS:
- where = &inpaddr_address_reload_insns[reload_opnum[j]];
- break;
- case RELOAD_FOR_OUTPUT_ADDRESS:
- where = &output_address_reload_insns[reload_opnum[j]];
- break;
- case RELOAD_FOR_OUTADDR_ADDRESS:
- where = &outaddr_address_reload_insns[reload_opnum[j]];
- break;
- case RELOAD_FOR_OPERAND_ADDRESS:
- where = &operand_reload_insns;
- break;
- case RELOAD_FOR_OPADDR_ADDR:
- where = &other_operand_reload_insns;
- break;
- case RELOAD_FOR_OTHER_ADDRESS:
- where = &other_input_address_reload_insns;
- break;
- default:
- abort ();
- }
-
- push_to_sequence (*where);
- special = 0;
-
- /* Auto-increment addresses must be reloaded in a special way. */
- if (GET_CODE (oldequiv) == POST_INC
- || GET_CODE (oldequiv) == POST_DEC
- || GET_CODE (oldequiv) == PRE_INC
- || GET_CODE (oldequiv) == PRE_DEC)
- {
- /* We are not going to bother supporting the case where a
- incremented register can't be copied directly from
- OLDEQUIV since this seems highly unlikely. */
- if (reload_secondary_in_reload[j] >= 0)
- abort ();
- /* Prevent normal processing of this reload. */
- special = 1;
- /* Output a special code sequence for this case. */
- inc_for_reload (reloadreg, oldequiv, reload_inc[j]);
- }
-
- /* If we are reloading a pseudo-register that was set by the previous
- insn, see if we can get rid of that pseudo-register entirely
- by redirecting the previous insn into our reload register. */
-
- else if (optimize && GET_CODE (old) == REG
- && REGNO (old) >= FIRST_PSEUDO_REGISTER
- && dead_or_set_p (insn, old)
- /* This is unsafe if some other reload
- uses the same reg first. */
- && reload_reg_free_before_p (REGNO (reloadreg),
- reload_opnum[j],
- reload_when_needed[j]))
- {
- rtx temp = PREV_INSN (insn);
- while (temp && GET_CODE (temp) == NOTE)
- temp = PREV_INSN (temp);
- if (temp
- && GET_CODE (temp) == INSN
- && GET_CODE (PATTERN (temp)) == SET
- && SET_DEST (PATTERN (temp)) == old
- /* Make sure we can access insn_operand_constraint. */
- && asm_noperands (PATTERN (temp)) < 0
- /* This is unsafe if prev insn rejects our reload reg. */
- && constraint_accepts_reg_p (insn_operand_constraint[recog_memoized (temp)][0],
- reloadreg)
- /* This is unsafe if operand occurs more than once in current
- insn. Perhaps some occurrences aren't reloaded. */
- && count_occurrences (PATTERN (insn), old) == 1
- /* Don't risk splitting a matching pair of operands. */
- && ! reg_mentioned_p (old, SET_SRC (PATTERN (temp))))
- {
- /* Store into the reload register instead of the pseudo. */
- SET_DEST (PATTERN (temp)) = reloadreg;
- /* If these are the only uses of the pseudo reg,
- pretend for GDB it lives in the reload reg we used. */
- if (reg_n_deaths[REGNO (old)] == 1
- && reg_n_sets[REGNO (old)] == 1)
- {
- reg_renumber[REGNO (old)] = REGNO (reload_reg_rtx[j]);
- alter_reg (REGNO (old), -1);
- }
- special = 1;
- }
- }
-
- /* We can't do that, so output an insn to load RELOADREG. */
-
- if (! special)
- {
-#ifdef SECONDARY_INPUT_RELOAD_CLASS
- rtx second_reload_reg = 0;
- enum insn_code icode;
-
- /* If we have a secondary reload, pick up the secondary register
- and icode, if any. If OLDEQUIV and OLD are different or
- if this is an in-out reload, recompute whether or not we
- still need a secondary register and what the icode should
- be. If we still need a secondary register and the class or
- icode is different, go back to reloading from OLD if using
- OLDEQUIV means that we got the wrong type of register. We
- cannot have different class or icode due to an in-out reload
- because we don't make such reloads when both the input and
- output need secondary reload registers. */
-
- if (reload_secondary_in_reload[j] >= 0)
- {
- int secondary_reload = reload_secondary_in_reload[j];
- rtx real_oldequiv = oldequiv;
- rtx real_old = old;
-
- /* If OLDEQUIV is a pseudo with a MEM, get the real MEM
- and similarly for OLD.
- See comments in get_secondary_reload in reload.c. */
- if (GET_CODE (oldequiv) == REG
- && REGNO (oldequiv) >= FIRST_PSEUDO_REGISTER
- && reg_equiv_mem[REGNO (oldequiv)] != 0)
- real_oldequiv = reg_equiv_mem[REGNO (oldequiv)];
-
- if (GET_CODE (old) == REG
- && REGNO (old) >= FIRST_PSEUDO_REGISTER
- && reg_equiv_mem[REGNO (old)] != 0)
- real_old = reg_equiv_mem[REGNO (old)];
-
- second_reload_reg = reload_reg_rtx[secondary_reload];
- icode = reload_secondary_in_icode[j];
-
- if ((old != oldequiv && ! rtx_equal_p (old, oldequiv))
- || (reload_in[j] != 0 && reload_out[j] != 0))
- {
- enum reg_class new_class
- = SECONDARY_INPUT_RELOAD_CLASS (reload_reg_class[j],
- mode, real_oldequiv);
-
- if (new_class == NO_REGS)
- second_reload_reg = 0;
- else
- {
- enum insn_code new_icode;
- enum machine_mode new_mode;
-
- if (! TEST_HARD_REG_BIT (reg_class_contents[(int) new_class],
- REGNO (second_reload_reg)))
- oldequiv = old, real_oldequiv = real_old;
- else
- {
- new_icode = reload_in_optab[(int) mode];
- if (new_icode != CODE_FOR_nothing
- && ((insn_operand_predicate[(int) new_icode][0]
- && ! ((*insn_operand_predicate[(int) new_icode][0])
- (reloadreg, mode)))
- || (insn_operand_predicate[(int) new_icode][1]
- && ! ((*insn_operand_predicate[(int) new_icode][1])
- (real_oldequiv, mode)))))
- new_icode = CODE_FOR_nothing;
-
- if (new_icode == CODE_FOR_nothing)
- new_mode = mode;
- else
- new_mode = insn_operand_mode[(int) new_icode][2];
-
- if (GET_MODE (second_reload_reg) != new_mode)
- {
- if (!HARD_REGNO_MODE_OK (REGNO (second_reload_reg),
- new_mode))
- oldequiv = old, real_oldequiv = real_old;
- else
- second_reload_reg
- = gen_rtx (REG, new_mode,
- REGNO (second_reload_reg));
- }
- }
- }
- }
-
- /* If we still need a secondary reload register, check
- to see if it is being used as a scratch or intermediate
- register and generate code appropriately. If we need
- a scratch register, use REAL_OLDEQUIV since the form of
- the insn may depend on the actual address if it is
- a MEM. */
-
- if (second_reload_reg)
- {
- if (icode != CODE_FOR_nothing)
- {
- emit_insn (GEN_FCN (icode) (reloadreg, real_oldequiv,
- second_reload_reg));
- special = 1;
- }
- else
- {
- /* See if we need a scratch register to load the
- intermediate register (a tertiary reload). */
- enum insn_code tertiary_icode
- = reload_secondary_in_icode[secondary_reload];
-
- if (tertiary_icode != CODE_FOR_nothing)
- {
- rtx third_reload_reg
- = reload_reg_rtx[reload_secondary_in_reload[secondary_reload]];
-
- emit_insn ((GEN_FCN (tertiary_icode)
- (second_reload_reg, real_oldequiv,
- third_reload_reg)));
- }
- else
- gen_reload (second_reload_reg, oldequiv,
- reload_opnum[j],
- reload_when_needed[j]);
-
- oldequiv = second_reload_reg;
- }
- }
- }
-#endif
-
- if (! special && ! rtx_equal_p (reloadreg, oldequiv))
- gen_reload (reloadreg, oldequiv, reload_opnum[j],
- reload_when_needed[j]);
-
-#if defined(SECONDARY_INPUT_RELOAD_CLASS) && defined(PRESERVE_DEATH_INFO_REGNO_P)
- /* We may have to make a REG_DEAD note for the secondary reload
- register in the insns we just made. Find the last insn that
- mentioned the register. */
- if (! special && second_reload_reg
- && PRESERVE_DEATH_INFO_REGNO_P (REGNO (second_reload_reg)))
- {
- rtx prev;
-
- for (prev = get_last_insn (); prev;
- prev = PREV_INSN (prev))
- if (GET_RTX_CLASS (GET_CODE (prev) == 'i')
- && reg_overlap_mentioned_for_reload_p (second_reload_reg,
- PATTERN (prev)))
- {
- REG_NOTES (prev) = gen_rtx (EXPR_LIST, REG_DEAD,
- second_reload_reg,
- REG_NOTES (prev));
- break;
- }
- }
-#endif
- }
-
- this_reload_insn = get_last_insn ();
- /* End this sequence. */
- *where = get_insns ();
- end_sequence ();
- }
-
- /* Add a note saying the input reload reg
- dies in this insn, if anyone cares. */
-#ifdef PRESERVE_DEATH_INFO_REGNO_P
- if (old != 0
- && reload_reg_rtx[j] != old
- && reload_reg_rtx[j] != 0
- && reload_out[j] == 0
- && ! reload_inherited[j]
- && PRESERVE_DEATH_INFO_REGNO_P (REGNO (reload_reg_rtx[j])))
- {
- register rtx reloadreg = reload_reg_rtx[j];
-
-#if 0
- /* We can't abort here because we need to support this for sched.c.
- It's not terrible to miss a REG_DEAD note, but we should try
- to figure out how to do this correctly. */
- /* The code below is incorrect for address-only reloads. */
- if (reload_when_needed[j] != RELOAD_OTHER
- && reload_when_needed[j] != RELOAD_FOR_INPUT)
- abort ();
-#endif
-
- /* Add a death note to this insn, for an input reload. */
-
- if ((reload_when_needed[j] == RELOAD_OTHER
- || reload_when_needed[j] == RELOAD_FOR_INPUT)
- && ! dead_or_set_p (insn, reloadreg))
- REG_NOTES (insn)
- = gen_rtx (EXPR_LIST, REG_DEAD,
- reloadreg, REG_NOTES (insn));
- }
-
- /* When we inherit a reload, the last marked death of the reload reg
- may no longer really be a death. */
- if (reload_reg_rtx[j] != 0
- && PRESERVE_DEATH_INFO_REGNO_P (REGNO (reload_reg_rtx[j]))
- && reload_inherited[j])
- {
- /* Handle inheriting an output reload.
- Remove the death note from the output reload insn. */
- if (reload_spill_index[j] >= 0
- && GET_CODE (reload_in[j]) == REG
- && spill_reg_store[reload_spill_index[j]] != 0
- && find_regno_note (spill_reg_store[reload_spill_index[j]],
- REG_DEAD, REGNO (reload_reg_rtx[j])))
- remove_death (REGNO (reload_reg_rtx[j]),
- spill_reg_store[reload_spill_index[j]]);
- /* Likewise for input reloads that were inherited. */
- else if (reload_spill_index[j] >= 0
- && GET_CODE (reload_in[j]) == REG
- && spill_reg_store[reload_spill_index[j]] == 0
- && reload_inheritance_insn[j] != 0
- && find_regno_note (reload_inheritance_insn[j], REG_DEAD,
- REGNO (reload_reg_rtx[j])))
- remove_death (REGNO (reload_reg_rtx[j]),
- reload_inheritance_insn[j]);
- else
- {
- rtx prev;
-
- /* We got this register from find_equiv_reg.
- Search back for its last death note and get rid of it.
- But don't search back too far.
- Don't go past a place where this reg is set,
- since a death note before that remains valid. */
- for (prev = PREV_INSN (insn);
- prev && GET_CODE (prev) != CODE_LABEL;
- prev = PREV_INSN (prev))
- if (GET_RTX_CLASS (GET_CODE (prev)) == 'i'
- && dead_or_set_p (prev, reload_reg_rtx[j]))
- {
- if (find_regno_note (prev, REG_DEAD,
- REGNO (reload_reg_rtx[j])))
- remove_death (REGNO (reload_reg_rtx[j]), prev);
- break;
- }
- }
- }
-
- /* We might have used find_equiv_reg above to choose an alternate
- place from which to reload. If so, and it died, we need to remove
- that death and move it to one of the insns we just made. */
-
- if (oldequiv_reg != 0
- && PRESERVE_DEATH_INFO_REGNO_P (true_regnum (oldequiv_reg)))
- {
- rtx prev, prev1;
-
- for (prev = PREV_INSN (insn); prev && GET_CODE (prev) != CODE_LABEL;
- prev = PREV_INSN (prev))
- if (GET_RTX_CLASS (GET_CODE (prev)) == 'i'
- && dead_or_set_p (prev, oldequiv_reg))
- {
- if (find_regno_note (prev, REG_DEAD, REGNO (oldequiv_reg)))
- {
- for (prev1 = this_reload_insn;
- prev1; prev1 = PREV_INSN (prev1))
- if (GET_RTX_CLASS (GET_CODE (prev1) == 'i')
- && reg_overlap_mentioned_for_reload_p (oldequiv_reg,
- PATTERN (prev1)))
- {
- REG_NOTES (prev1) = gen_rtx (EXPR_LIST, REG_DEAD,
- oldequiv_reg,
- REG_NOTES (prev1));
- break;
- }
- remove_death (REGNO (oldequiv_reg), prev);
- }
- break;
- }
- }
-#endif
-
- /* If we are reloading a register that was recently stored in with an
- output-reload, see if we can prove there was
- actually no need to store the old value in it. */
-
- if (optimize && reload_inherited[j] && reload_spill_index[j] >= 0
- && reload_in[j] != 0
- && GET_CODE (reload_in[j]) == REG
-#if 0
- /* There doesn't seem to be any reason to restrict this to pseudos
- and doing so loses in the case where we are copying from a
- register of the wrong class. */
- && REGNO (reload_in[j]) >= FIRST_PSEUDO_REGISTER
-#endif
- && spill_reg_store[reload_spill_index[j]] != 0
- /* This is unsafe if some other reload uses the same reg first. */
- && reload_reg_free_before_p (spill_regs[reload_spill_index[j]],
- reload_opnum[j], reload_when_needed[j])
- && dead_or_set_p (insn, reload_in[j])
- /* This is unsafe if operand occurs more than once in current
- insn. Perhaps some occurrences weren't reloaded. */
- && count_occurrences (PATTERN (insn), reload_in[j]) == 1)
- delete_output_reload (insn, j,
- spill_reg_store[reload_spill_index[j]]);
-
- /* Input-reloading is done. Now do output-reloading,
- storing the value from the reload-register after the main insn
- if reload_out[j] is nonzero.
-
- ??? At some point we need to support handling output reloads of
- JUMP_INSNs or insns that set cc0. */
- old = reload_out[j];
- if (old != 0
- && reload_reg_rtx[j] != old
- && reload_reg_rtx[j] != 0)
- {
- register rtx reloadreg = reload_reg_rtx[j];
- register rtx second_reloadreg = 0;
- rtx note, p;
- enum machine_mode mode;
- int special = 0;
-
- /* An output operand that dies right away does need a reload,
- but need not be copied from it. Show the new location in the
- REG_UNUSED note. */
- if ((GET_CODE (old) == REG || GET_CODE (old) == SCRATCH)
- && (note = find_reg_note (insn, REG_UNUSED, old)) != 0)
- {
- XEXP (note, 0) = reload_reg_rtx[j];
- continue;
- }
- /* Likewise for a SUBREG of an operand that dies. */
- else if (GET_CODE (old) == SUBREG
- && GET_CODE (SUBREG_REG (old)) == REG
- && 0 != (note = find_reg_note (insn, REG_UNUSED,
- SUBREG_REG (old))))
- {
- XEXP (note, 0) = gen_lowpart_common (GET_MODE (old),
- reload_reg_rtx[j]);
- continue;
- }
- else if (GET_CODE (old) == SCRATCH)
- /* If we aren't optimizing, there won't be a REG_UNUSED note,
- but we don't want to make an output reload. */
- continue;
-
-#if 0
- /* Strip off of OLD any size-increasing SUBREGs such as
- (SUBREG:SI foo:QI 0). */
-
- while (GET_CODE (old) == SUBREG && SUBREG_WORD (old) == 0
- && (GET_MODE_SIZE (GET_MODE (old))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (old)))))
- old = SUBREG_REG (old);
-#endif
-
- /* If is a JUMP_INSN, we can't support output reloads yet. */
- if (GET_CODE (insn) == JUMP_INSN)
- abort ();
-
- if (reload_when_needed[j] == RELOAD_OTHER)
- start_sequence ();
- else
- push_to_sequence (output_reload_insns[reload_opnum[j]]);
-
- /* Determine the mode to reload in.
- See comments above (for input reloading). */
-
- mode = GET_MODE (old);
- if (mode == VOIDmode)
- {
- /* VOIDmode should never happen for an output. */
- if (asm_noperands (PATTERN (insn)) < 0)
- /* It's the compiler's fault. */
- fatal_insn ("VOIDmode on an output", insn);
- error_for_asm (insn, "output operand is constant in `asm'");
- /* Prevent crash--use something we know is valid. */
- mode = word_mode;
- old = gen_rtx (REG, mode, REGNO (reloadreg));
- }
-
- if (GET_MODE (reloadreg) != mode)
- reloadreg = gen_rtx (REG, mode, REGNO (reloadreg));
-
-#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
-
- /* If we need two reload regs, set RELOADREG to the intermediate
- one, since it will be stored into OLD. We might need a secondary
- register only for an input reload, so check again here. */
-
- if (reload_secondary_out_reload[j] >= 0)
- {
- rtx real_old = old;
-
- if (GET_CODE (old) == REG && REGNO (old) >= FIRST_PSEUDO_REGISTER
- && reg_equiv_mem[REGNO (old)] != 0)
- real_old = reg_equiv_mem[REGNO (old)];
-
- if((SECONDARY_OUTPUT_RELOAD_CLASS (reload_reg_class[j],
- mode, real_old)
- != NO_REGS))
- {
- second_reloadreg = reloadreg;
- reloadreg = reload_reg_rtx[reload_secondary_out_reload[j]];
-
- /* See if RELOADREG is to be used as a scratch register
- or as an intermediate register. */
- if (reload_secondary_out_icode[j] != CODE_FOR_nothing)
- {
- emit_insn ((GEN_FCN (reload_secondary_out_icode[j])
- (real_old, second_reloadreg, reloadreg)));
- special = 1;
- }
- else
- {
- /* See if we need both a scratch and intermediate reload
- register. */
-
- int secondary_reload = reload_secondary_out_reload[j];
- enum insn_code tertiary_icode
- = reload_secondary_out_icode[secondary_reload];
-
- if (GET_MODE (reloadreg) != mode)
- reloadreg = gen_rtx (REG, mode, REGNO (reloadreg));
-
- if (tertiary_icode != CODE_FOR_nothing)
- {
- rtx third_reloadreg
- = reload_reg_rtx[reload_secondary_out_reload[secondary_reload]];
- rtx tem;
-
- /* Copy primary reload reg to secondary reload reg.
- (Note that these have been swapped above, then
- secondary reload reg to OLD using our insn. */
-
- /* If REAL_OLD is a paradoxical SUBREG, remove it
- and try to put the opposite SUBREG on
- RELOADREG. */
- if (GET_CODE (real_old) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (real_old))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (real_old))))
- && 0 != (tem = gen_lowpart_common
- (GET_MODE (SUBREG_REG (real_old)),
- reloadreg)))
- real_old = SUBREG_REG (real_old), reloadreg = tem;
-
- gen_reload (reloadreg, second_reloadreg,
- reload_opnum[j], reload_when_needed[j]);
- emit_insn ((GEN_FCN (tertiary_icode)
- (real_old, reloadreg, third_reloadreg)));
- special = 1;
- }
-
- else
- /* Copy between the reload regs here and then to
- OUT later. */
-
- gen_reload (reloadreg, second_reloadreg,
- reload_opnum[j], reload_when_needed[j]);
- }
- }
- }
-#endif
-
- /* Output the last reload insn. */
- if (! special)
- gen_reload (old, reloadreg, reload_opnum[j],
- reload_when_needed[j]);
-
-#ifdef PRESERVE_DEATH_INFO_REGNO_P
- /* If final will look at death notes for this reg,
- put one on the last output-reload insn to use it. Similarly
- for any secondary register. */
- if (PRESERVE_DEATH_INFO_REGNO_P (REGNO (reloadreg)))
- for (p = get_last_insn (); p; p = PREV_INSN (p))
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
- && reg_overlap_mentioned_for_reload_p (reloadreg,
- PATTERN (p)))
- REG_NOTES (p) = gen_rtx (EXPR_LIST, REG_DEAD,
- reloadreg, REG_NOTES (p));
-
-#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
- if (! special && second_reloadreg
- && PRESERVE_DEATH_INFO_REGNO_P (REGNO (second_reloadreg)))
- for (p = get_last_insn (); p; p = PREV_INSN (p))
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i'
- && reg_overlap_mentioned_for_reload_p (second_reloadreg,
- PATTERN (p)))
- REG_NOTES (p) = gen_rtx (EXPR_LIST, REG_DEAD,
- second_reloadreg, REG_NOTES (p));
-#endif
-#endif
- /* Look at all insns we emitted, just to be safe. */
- for (p = get_insns (); p; p = NEXT_INSN (p))
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i')
- {
- /* If this output reload doesn't come from a spill reg,
- clear any memory of reloaded copies of the pseudo reg.
- If this output reload comes from a spill reg,
- reg_has_output_reload will make this do nothing. */
- note_stores (PATTERN (p), forget_old_reloads_1);
-
- if (reg_mentioned_p (reload_reg_rtx[j], PATTERN (p))
- && reload_spill_index[j] >= 0)
- new_spill_reg_store[reload_spill_index[j]] = p;
- }
-
- if (reload_when_needed[j] == RELOAD_OTHER)
- {
- emit_insns (other_output_reload_insns[reload_opnum[j]]);
- other_output_reload_insns[reload_opnum[j]] = get_insns ();
- }
- else
- output_reload_insns[reload_opnum[j]] = get_insns ();
-
- end_sequence ();
- }
- }
-
- /* Now write all the insns we made for reloads in the order expected by
- the allocation functions. Prior to the insn being reloaded, we write
- the following reloads:
-
- RELOAD_FOR_OTHER_ADDRESS reloads for input addresses.
-
- RELOAD_OTHER reloads.
-
- For each operand, any RELOAD_FOR_INPADDR_ADDRESS reloads followed
- by any RELOAD_FOR_INPUT_ADDRESS reloads followed by the
- RELOAD_FOR_INPUT reload for the operand.
-
- RELOAD_FOR_OPADDR_ADDRS reloads.
-
- RELOAD_FOR_OPERAND_ADDRESS reloads.
-
- After the insn being reloaded, we write the following:
-
- For each operand, any RELOAD_FOR_OUTADDR_ADDRESS reloads followed
- by any RELOAD_FOR_OUTPUT_ADDRESS reload followed by the
- RELOAD_FOR_OUTPUT reload, followed by any RELOAD_OTHER output
- reloads for the operand. The RELOAD_OTHER output reloads are
- output in descending order by reload number. */
-
- emit_insns_before (other_input_address_reload_insns, before_insn);
- emit_insns_before (other_input_reload_insns, before_insn);
-
- for (j = 0; j < reload_n_operands; j++)
- {
- emit_insns_before (inpaddr_address_reload_insns[j], before_insn);
- emit_insns_before (input_address_reload_insns[j], before_insn);
- emit_insns_before (input_reload_insns[j], before_insn);
- }
-
- emit_insns_before (other_operand_reload_insns, before_insn);
- emit_insns_before (operand_reload_insns, before_insn);
-
- for (j = 0; j < reload_n_operands; j++)
- {
- emit_insns_before (outaddr_address_reload_insns[j], following_insn);
- emit_insns_before (output_address_reload_insns[j], following_insn);
- emit_insns_before (output_reload_insns[j], following_insn);
- emit_insns_before (other_output_reload_insns[j], following_insn);
- }
-
- /* Move death notes from INSN
- to output-operand-address and output reload insns. */
-#ifdef PRESERVE_DEATH_INFO_REGNO_P
- {
- rtx insn1;
- /* Loop over those insns, last ones first. */
- for (insn1 = PREV_INSN (following_insn); insn1 != insn;
- insn1 = PREV_INSN (insn1))
- if (GET_CODE (insn1) == INSN && GET_CODE (PATTERN (insn1)) == SET)
- {
- rtx source = SET_SRC (PATTERN (insn1));
- rtx dest = SET_DEST (PATTERN (insn1));
-
- /* The note we will examine next. */
- rtx reg_notes = REG_NOTES (insn);
- /* The place that pointed to this note. */
- rtx *prev_reg_note = &REG_NOTES (insn);
-
- /* If the note is for something used in the source of this
- reload insn, or in the output address, move the note. */
- while (reg_notes)
- {
- rtx next_reg_notes = XEXP (reg_notes, 1);
- if (REG_NOTE_KIND (reg_notes) == REG_DEAD
- && GET_CODE (XEXP (reg_notes, 0)) == REG
- && ((GET_CODE (dest) != REG
- && reg_overlap_mentioned_for_reload_p (XEXP (reg_notes, 0),
- dest))
- || reg_overlap_mentioned_for_reload_p (XEXP (reg_notes, 0),
- source)))
- {
- *prev_reg_note = next_reg_notes;
- XEXP (reg_notes, 1) = REG_NOTES (insn1);
- REG_NOTES (insn1) = reg_notes;
- }
- else
- prev_reg_note = &XEXP (reg_notes, 1);
-
- reg_notes = next_reg_notes;
- }
- }
- }
-#endif
-
- /* For all the spill regs newly reloaded in this instruction,
- record what they were reloaded from, so subsequent instructions
- can inherit the reloads.
-
- Update spill_reg_store for the reloads of this insn.
- Copy the elements that were updated in the loop above. */
-
- for (j = 0; j < n_reloads; j++)
- {
- register int r = reload_order[j];
- register int i = reload_spill_index[r];
-
- /* I is nonneg if this reload used one of the spill regs.
- If reload_reg_rtx[r] is 0, this is an optional reload
- that we opted to ignore. */
-
- if (i >= 0 && reload_reg_rtx[r] != 0)
- {
- int nr
- = HARD_REGNO_NREGS (spill_regs[i], GET_MODE (reload_reg_rtx[r]));
- int k;
- int part_reaches_end = 0;
- int all_reaches_end = 1;
-
- /* For a multi register reload, we need to check if all or part
- of the value lives to the end. */
- for (k = 0; k < nr; k++)
- {
- if (reload_reg_reaches_end_p (spill_regs[i] + k, reload_opnum[r],
- reload_when_needed[r]))
- part_reaches_end = 1;
- else
- all_reaches_end = 0;
- }
-
- /* Ignore reloads that don't reach the end of the insn in
- entirety. */
- if (all_reaches_end)
- {
- /* First, clear out memory of what used to be in this spill reg.
- If consecutive registers are used, clear them all. */
-
- for (k = 0; k < nr; k++)
- {
- reg_reloaded_contents[spill_reg_order[spill_regs[i] + k]] = -1;
- reg_reloaded_insn[spill_reg_order[spill_regs[i] + k]] = 0;
- }
-
- /* Maybe the spill reg contains a copy of reload_out. */
- if (reload_out[r] != 0 && GET_CODE (reload_out[r]) == REG)
- {
- register int nregno = REGNO (reload_out[r]);
- int nnr = (nregno >= FIRST_PSEUDO_REGISTER ? 1
- : HARD_REGNO_NREGS (nregno,
- GET_MODE (reload_reg_rtx[r])));
-
- spill_reg_store[i] = new_spill_reg_store[i];
- reg_last_reload_reg[nregno] = reload_reg_rtx[r];
-
- /* If NREGNO is a hard register, it may occupy more than
- one register. If it does, say what is in the
- rest of the registers assuming that both registers
- agree on how many words the object takes. If not,
- invalidate the subsequent registers. */
-
- if (nregno < FIRST_PSEUDO_REGISTER)
- for (k = 1; k < nnr; k++)
- reg_last_reload_reg[nregno + k]
- = (nr == nnr
- ? gen_rtx (REG,
- reg_raw_mode[REGNO (reload_reg_rtx[r]) + k],
- REGNO (reload_reg_rtx[r]) + k)
- : 0);
-
- /* Now do the inverse operation. */
- for (k = 0; k < nr; k++)
- {
- reg_reloaded_contents[spill_reg_order[spill_regs[i] + k]]
- = (nregno >= FIRST_PSEUDO_REGISTER || nr != nnr
- ? nregno
- : nregno + k);
- reg_reloaded_insn[spill_reg_order[spill_regs[i] + k]] = insn;
- }
- }
-
- /* Maybe the spill reg contains a copy of reload_in. Only do
- something if there will not be an output reload for
- the register being reloaded. */
- else if (reload_out[r] == 0
- && reload_in[r] != 0
- && ((GET_CODE (reload_in[r]) == REG
- && ! reg_has_output_reload[REGNO (reload_in[r])])
- || (GET_CODE (reload_in_reg[r]) == REG
- && ! reg_has_output_reload[REGNO (reload_in_reg[r])])))
- {
- register int nregno;
- int nnr;
-
- if (GET_CODE (reload_in[r]) == REG)
- nregno = REGNO (reload_in[r]);
- else
- nregno = REGNO (reload_in_reg[r]);
-
- nnr = (nregno >= FIRST_PSEUDO_REGISTER ? 1
- : HARD_REGNO_NREGS (nregno,
- GET_MODE (reload_reg_rtx[r])));
-
- reg_last_reload_reg[nregno] = reload_reg_rtx[r];
-
- if (nregno < FIRST_PSEUDO_REGISTER)
- for (k = 1; k < nnr; k++)
- reg_last_reload_reg[nregno + k]
- = (nr == nnr
- ? gen_rtx (REG,
- reg_raw_mode[REGNO (reload_reg_rtx[r]) + k],
- REGNO (reload_reg_rtx[r]) + k)
- : 0);
-
- /* Unless we inherited this reload, show we haven't
- recently done a store. */
- if (! reload_inherited[r])
- spill_reg_store[i] = 0;
-
- for (k = 0; k < nr; k++)
- {
- reg_reloaded_contents[spill_reg_order[spill_regs[i] + k]]
- = (nregno >= FIRST_PSEUDO_REGISTER || nr != nnr
- ? nregno
- : nregno + k);
- reg_reloaded_insn[spill_reg_order[spill_regs[i] + k]]
- = insn;
- }
- }
- }
-
- /* However, if part of the reload reaches the end, then we must
- invalidate the old info for the part that survives to the end. */
- else if (part_reaches_end)
- {
- for (k = 0; k < nr; k++)
- if (reload_reg_reaches_end_p (spill_regs[i] + k,
- reload_opnum[r],
- reload_when_needed[r]))
- {
- reg_reloaded_contents[spill_reg_order[spill_regs[i] + k]] = -1;
- reg_reloaded_insn[spill_reg_order[spill_regs[i] + k]] = 0;
- }
- }
- }
-
- /* The following if-statement was #if 0'd in 1.34 (or before...).
- It's reenabled in 1.35 because supposedly nothing else
- deals with this problem. */
-
- /* If a register gets output-reloaded from a non-spill register,
- that invalidates any previous reloaded copy of it.
- But forget_old_reloads_1 won't get to see it, because
- it thinks only about the original insn. So invalidate it here. */
- if (i < 0 && reload_out[r] != 0 && GET_CODE (reload_out[r]) == REG)
- {
- register int nregno = REGNO (reload_out[r]);
- if (nregno >= FIRST_PSEUDO_REGISTER)
- reg_last_reload_reg[nregno] = 0;
- else
- {
- int num_regs = HARD_REGNO_NREGS (nregno,GET_MODE (reload_out[r]));
-
- while (num_regs-- > 0)
- reg_last_reload_reg[nregno + num_regs] = 0;
- }
- }
- }
-}
-
-/* Emit code to perform a reload from IN (which may be a reload register) to
- OUT (which may also be a reload register). IN or OUT is from operand
- OPNUM with reload type TYPE.
-
- Returns first insn emitted. */
-
-rtx
-gen_reload (out, in, opnum, type)
- rtx out;
- rtx in;
- int opnum;
- enum reload_type type;
-{
- rtx last = get_last_insn ();
- rtx tem;
-
- /* If IN is a paradoxical SUBREG, remove it and try to put the
- opposite SUBREG on OUT. Likewise for a paradoxical SUBREG on OUT. */
- if (GET_CODE (in) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (in))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (in))))
- && (tem = gen_lowpart_common (GET_MODE (SUBREG_REG (in)), out)) != 0)
- in = SUBREG_REG (in), out = tem;
- else if (GET_CODE (out) == SUBREG
- && (GET_MODE_SIZE (GET_MODE (out))
- > GET_MODE_SIZE (GET_MODE (SUBREG_REG (out))))
- && (tem = gen_lowpart_common (GET_MODE (SUBREG_REG (out)), in)) != 0)
- out = SUBREG_REG (out), in = tem;
-
- /* How to do this reload can get quite tricky. Normally, we are being
- asked to reload a simple operand, such as a MEM, a constant, or a pseudo
- register that didn't get a hard register. In that case we can just
- call emit_move_insn.
-
- We can also be asked to reload a PLUS that adds a register or a MEM to
- another register, constant or MEM. This can occur during frame pointer
- elimination and while reloading addresses. This case is handled by
- trying to emit a single insn to perform the add. If it is not valid,
- we use a two insn sequence.
-
- Finally, we could be called to handle an 'o' constraint by putting
- an address into a register. In that case, we first try to do this
- with a named pattern of "reload_load_address". If no such pattern
- exists, we just emit a SET insn and hope for the best (it will normally
- be valid on machines that use 'o').
-
- This entire process is made complex because reload will never
- process the insns we generate here and so we must ensure that
- they will fit their constraints and also by the fact that parts of
- IN might be being reloaded separately and replaced with spill registers.
- Because of this, we are, in some sense, just guessing the right approach
- here. The one listed above seems to work.
-
- ??? At some point, this whole thing needs to be rethought. */
-
- if (GET_CODE (in) == PLUS
- && (GET_CODE (XEXP (in, 0)) == REG
- || GET_CODE (XEXP (in, 0)) == SUBREG
- || GET_CODE (XEXP (in, 0)) == MEM)
- && (GET_CODE (XEXP (in, 1)) == REG
- || GET_CODE (XEXP (in, 1)) == SUBREG
- || CONSTANT_P (XEXP (in, 1))
- || GET_CODE (XEXP (in, 1)) == MEM))
- {
- /* We need to compute the sum of a register or a MEM and another
- register, constant, or MEM, and put it into the reload
- register. The best possible way of doing this is if the machine
- has a three-operand ADD insn that accepts the required operands.
-
- The simplest approach is to try to generate such an insn and see if it
- is recognized and matches its constraints. If so, it can be used.
-
- It might be better not to actually emit the insn unless it is valid,
- but we need to pass the insn as an operand to `recog' and
- `insn_extract' and it is simpler to emit and then delete the insn if
- not valid than to dummy things up. */
-
- rtx op0, op1, tem, insn;
- int code;
-
- op0 = find_replacement (&XEXP (in, 0));
- op1 = find_replacement (&XEXP (in, 1));
-
- /* Since constraint checking is strict, commutativity won't be
- checked, so we need to do that here to avoid spurious failure
- if the add instruction is two-address and the second operand
- of the add is the same as the reload reg, which is frequently
- the case. If the insn would be A = B + A, rearrange it so
- it will be A = A + B as constrain_operands expects. */
-
- if (GET_CODE (XEXP (in, 1)) == REG
- && REGNO (out) == REGNO (XEXP (in, 1)))
- tem = op0, op0 = op1, op1 = tem;
-
- if (op0 != XEXP (in, 0) || op1 != XEXP (in, 1))
- in = gen_rtx (PLUS, GET_MODE (in), op0, op1);
-
- insn = emit_insn (gen_rtx (SET, VOIDmode, out, in));
- code = recog_memoized (insn);
-
- if (code >= 0)
- {
- insn_extract (insn);
- /* We want constrain operands to treat this insn strictly in
- its validity determination, i.e., the way it would after reload
- has completed. */
- if (constrain_operands (code, 1))
- return insn;
- }
-
- delete_insns_since (last);
-
- /* If that failed, we must use a conservative two-insn sequence.
- use move to copy constant, MEM, or pseudo register to the reload
- register since "move" will be able to handle an arbitrary operand,
- unlike add which can't, in general. Then add the registers.
-
- If there is another way to do this for a specific machine, a
- DEFINE_PEEPHOLE should be specified that recognizes the sequence
- we emit below. */
-
- if (CONSTANT_P (op1) || GET_CODE (op1) == MEM || GET_CODE (op1) == SUBREG
- || (GET_CODE (op1) == REG
- && REGNO (op1) >= FIRST_PSEUDO_REGISTER))
- tem = op0, op0 = op1, op1 = tem;
-
- gen_reload (out, op0, opnum, type);
-
- /* If OP0 and OP1 are the same, we can use OUT for OP1.
- This fixes a problem on the 32K where the stack pointer cannot
- be used as an operand of an add insn. */
-
- if (rtx_equal_p (op0, op1))
- op1 = out;
-
- insn = emit_insn (gen_add2_insn (out, op1));
-
- /* If that failed, copy the address register to the reload register.
- Then add the constant to the reload register. */
-
- code = recog_memoized (insn);
-
- if (code >= 0)
- {
- insn_extract (insn);
- /* We want constrain operands to treat this insn strictly in
- its validity determination, i.e., the way it would after reload
- has completed. */
- if (constrain_operands (code, 1))
- return insn;
- }
-
- delete_insns_since (last);
-
- gen_reload (out, op1, opnum, type);
- emit_insn (gen_add2_insn (out, op0));
- }
-
-#ifdef SECONDARY_MEMORY_NEEDED
- /* If we need a memory location to do the move, do it that way. */
- else if (GET_CODE (in) == REG && REGNO (in) < FIRST_PSEUDO_REGISTER
- && GET_CODE (out) == REG && REGNO (out) < FIRST_PSEUDO_REGISTER
- && SECONDARY_MEMORY_NEEDED (REGNO_REG_CLASS (REGNO (in)),
- REGNO_REG_CLASS (REGNO (out)),
- GET_MODE (out)))
- {
- /* Get the memory to use and rewrite both registers to its mode. */
- rtx loc = get_secondary_mem (in, GET_MODE (out), opnum, type);
-
- if (GET_MODE (loc) != GET_MODE (out))
- out = gen_rtx (REG, GET_MODE (loc), REGNO (out));
-
- if (GET_MODE (loc) != GET_MODE (in))
- in = gen_rtx (REG, GET_MODE (loc), REGNO (in));
-
- gen_reload (loc, in, opnum, type);
- gen_reload (out, loc, opnum, type);
- }
-#endif
-
- /* If IN is a simple operand, use gen_move_insn. */
- else if (GET_RTX_CLASS (GET_CODE (in)) == 'o' || GET_CODE (in) == SUBREG)
- emit_insn (gen_move_insn (out, in));
-
-#ifdef HAVE_reload_load_address
- else if (HAVE_reload_load_address)
- emit_insn (gen_reload_load_address (out, in));
-#endif
-
- /* Otherwise, just write (set OUT IN) and hope for the best. */
- else
- emit_insn (gen_rtx (SET, VOIDmode, out, in));
-
- /* Return the first insn emitted.
- We can not just return get_last_insn, because there may have
- been multiple instructions emitted. Also note that gen_move_insn may
- emit more than one insn itself, so we can not assume that there is one
- insn emitted per emit_insn_before call. */
-
- return last ? NEXT_INSN (last) : get_insns ();
-}
-
-/* Delete a previously made output-reload
- whose result we now believe is not needed.
- First we double-check.
-
- INSN is the insn now being processed.
- OUTPUT_RELOAD_INSN is the insn of the output reload.
- J is the reload-number for this insn. */
-
-static void
-delete_output_reload (insn, j, output_reload_insn)
- rtx insn;
- int j;
- rtx output_reload_insn;
-{
- register rtx i1;
-
- /* Get the raw pseudo-register referred to. */
-
- rtx reg = reload_in[j];
- while (GET_CODE (reg) == SUBREG)
- reg = SUBREG_REG (reg);
-
- /* If the pseudo-reg we are reloading is no longer referenced
- anywhere between the store into it and here,
- and no jumps or labels intervene, then the value can get
- here through the reload reg alone.
- Otherwise, give up--return. */
- for (i1 = NEXT_INSN (output_reload_insn);
- i1 != insn; i1 = NEXT_INSN (i1))
- {
- if (GET_CODE (i1) == CODE_LABEL || GET_CODE (i1) == JUMP_INSN)
- return;
- if ((GET_CODE (i1) == INSN || GET_CODE (i1) == CALL_INSN)
- && reg_mentioned_p (reg, PATTERN (i1)))
- return;
- }
-
- if (cannot_omit_stores[REGNO (reg)])
- return;
-
- /* If this insn will store in the pseudo again,
- the previous store can be removed. */
- if (reload_out[j] == reload_in[j])
- delete_insn (output_reload_insn);
-
- /* See if the pseudo reg has been completely replaced
- with reload regs. If so, delete the store insn
- and forget we had a stack slot for the pseudo. */
- else if (reg_n_deaths[REGNO (reg)] == 1
- && reg_basic_block[REGNO (reg)] >= 0
- && find_regno_note (insn, REG_DEAD, REGNO (reg)))
- {
- rtx i2;
-
- /* We know that it was used only between here
- and the beginning of the current basic block.
- (We also know that the last use before INSN was
- the output reload we are thinking of deleting, but never mind that.)
- Search that range; see if any ref remains. */
- for (i2 = PREV_INSN (insn); i2; i2 = PREV_INSN (i2))
- {
- rtx set = single_set (i2);
-
- /* Uses which just store in the pseudo don't count,
- since if they are the only uses, they are dead. */
- if (set != 0 && SET_DEST (set) == reg)
- continue;
- if (GET_CODE (i2) == CODE_LABEL
- || GET_CODE (i2) == JUMP_INSN)
- break;
- if ((GET_CODE (i2) == INSN || GET_CODE (i2) == CALL_INSN)
- && reg_mentioned_p (reg, PATTERN (i2)))
- /* Some other ref remains;
- we can't do anything. */
- return;
- }
-
- /* Delete the now-dead stores into this pseudo. */
- for (i2 = PREV_INSN (insn); i2; i2 = PREV_INSN (i2))
- {
- rtx set = single_set (i2);
-
- if (set != 0 && SET_DEST (set) == reg)
- {
- /* This might be a basic block head,
- thus don't use delete_insn. */
- PUT_CODE (i2, NOTE);
- NOTE_SOURCE_FILE (i2) = 0;
- NOTE_LINE_NUMBER (i2) = NOTE_INSN_DELETED;
- }
- if (GET_CODE (i2) == CODE_LABEL
- || GET_CODE (i2) == JUMP_INSN)
- break;
- }
-
- /* For the debugging info,
- say the pseudo lives in this reload reg. */
- reg_renumber[REGNO (reg)] = REGNO (reload_reg_rtx[j]);
- alter_reg (REGNO (reg), -1);
- }
-}
-
-/* Output reload-insns to reload VALUE into RELOADREG.
- VALUE is an autoincrement or autodecrement RTX whose operand
- is a register or memory location;
- so reloading involves incrementing that location.
-
- INC_AMOUNT is the number to increment or decrement by (always positive).
- This cannot be deduced from VALUE. */
-
-static void
-inc_for_reload (reloadreg, value, inc_amount)
- rtx reloadreg;
- rtx value;
- int inc_amount;
-{
- /* REG or MEM to be copied and incremented. */
- rtx incloc = XEXP (value, 0);
- /* Nonzero if increment after copying. */
- int post = (GET_CODE (value) == POST_DEC || GET_CODE (value) == POST_INC);
- rtx last;
- rtx inc;
- rtx add_insn;
- int code;
-
- /* No hard register is equivalent to this register after
- inc/dec operation. If REG_LAST_RELOAD_REG were non-zero,
- we could inc/dec that register as well (maybe even using it for
- the source), but I'm not sure it's worth worrying about. */
- if (GET_CODE (incloc) == REG)
- reg_last_reload_reg[REGNO (incloc)] = 0;
-
- if (GET_CODE (value) == PRE_DEC || GET_CODE (value) == POST_DEC)
- inc_amount = - inc_amount;
-
- inc = GEN_INT (inc_amount);
-
- /* If this is post-increment, first copy the location to the reload reg. */
- if (post)
- emit_insn (gen_move_insn (reloadreg, incloc));
-
- /* See if we can directly increment INCLOC. Use a method similar to that
- in gen_reload. */
-
- last = get_last_insn ();
- add_insn = emit_insn (gen_rtx (SET, VOIDmode, incloc,
- gen_rtx (PLUS, GET_MODE (incloc),
- incloc, inc)));
-
- code = recog_memoized (add_insn);
- if (code >= 0)
- {
- insn_extract (add_insn);
- if (constrain_operands (code, 1))
- {
- /* If this is a pre-increment and we have incremented the value
- where it lives, copy the incremented value to RELOADREG to
- be used as an address. */
-
- if (! post)
- emit_insn (gen_move_insn (reloadreg, incloc));
-
- return;
- }
- }
-
- delete_insns_since (last);
-
- /* If couldn't do the increment directly, must increment in RELOADREG.
- The way we do this depends on whether this is pre- or post-increment.
- For pre-increment, copy INCLOC to the reload register, increment it
- there, then save back. */
-
- if (! post)
- {
- emit_insn (gen_move_insn (reloadreg, incloc));
- emit_insn (gen_add2_insn (reloadreg, inc));
- emit_insn (gen_move_insn (incloc, reloadreg));
- }
- else
- {
- /* Postincrement.
- Because this might be a jump insn or a compare, and because RELOADREG
- may not be available after the insn in an input reload, we must do
- the incrementation before the insn being reloaded for.
-
- We have already copied INCLOC to RELOADREG. Increment the copy in
- RELOADREG, save that back, then decrement RELOADREG so it has
- the original value. */
-
- emit_insn (gen_add2_insn (reloadreg, inc));
- emit_insn (gen_move_insn (incloc, reloadreg));
- emit_insn (gen_add2_insn (reloadreg, GEN_INT (-inc_amount)));
- }
-
- return;
-}
-
-/* Return 1 if we are certain that the constraint-string STRING allows
- the hard register REG. Return 0 if we can't be sure of this. */
-
-static int
-constraint_accepts_reg_p (string, reg)
- char *string;
- rtx reg;
-{
- int value = 0;
- int regno = true_regnum (reg);
- int c;
-
- /* Initialize for first alternative. */
- value = 0;
- /* Check that each alternative contains `g' or `r'. */
- while (1)
- switch (c = *string++)
- {
- case 0:
- /* If an alternative lacks `g' or `r', we lose. */
- return value;
- case ',':
- /* If an alternative lacks `g' or `r', we lose. */
- if (value == 0)
- return 0;
- /* Initialize for next alternative. */
- value = 0;
- break;
- case 'g':
- case 'r':
- /* Any general reg wins for this alternative. */
- if (TEST_HARD_REG_BIT (reg_class_contents[(int) GENERAL_REGS], regno))
- value = 1;
- break;
- default:
- /* Any reg in specified class wins for this alternative. */
- {
- enum reg_class class = REG_CLASS_FROM_LETTER (c);
-
- if (TEST_HARD_REG_BIT (reg_class_contents[(int) class], regno))
- value = 1;
- }
- }
-}
-
-/* Return the number of places FIND appears within X, but don't count
- an occurrence if some SET_DEST is FIND. */
-
-static int
-count_occurrences (x, find)
- register rtx x, find;
-{
- register int i, j;
- register enum rtx_code code;
- register char *format_ptr;
- int count;
-
- if (x == find)
- return 1;
- if (x == 0)
- return 0;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- return 0;
-
- case SET:
- if (SET_DEST (x) == find)
- return count_occurrences (SET_SRC (x), find);
- break;
- }
-
- format_ptr = GET_RTX_FORMAT (code);
- count = 0;
-
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- count += count_occurrences (XEXP (x, i), find);
- break;
-
- case 'E':
- if (XVEC (x, i) != NULL)
- {
- for (j = 0; j < XVECLEN (x, i); j++)
- count += count_occurrences (XVECEXP (x, i, j), find);
- }
- break;
- }
- }
- return count;
-}
-
-/* This array holds values which are equivalent to a hard register
- during reload_cse_regs. Each array element is an EXPR_LIST of
- values. Each time a hard register is set, we set the corresponding
- array element to the value. Each time a hard register is copied
- into memory, we add the memory location to the corresponding array
- element. We don't store values or memory addresses with side
- effects in this array.
-
- If the value is a CONST_INT, then the mode of the containing
- EXPR_LIST is the mode in which that CONST_INT was referenced.
-
- We sometimes clobber a specific entry in a list. In that case, we
- just set XEXP (list-entry, 0) to 0. */
-
-static rtx *reg_values;
-
-/* Invalidate any entries in reg_values which depend on REGNO,
- including those for REGNO itself. This is called if REGNO is
- changing. If CLOBBER is true, then always forget anything we
- currently know about REGNO. MODE is the mode of the assignment to
- REGNO, which is used to determine how many hard registers are being
- changed. If MODE is VOIDmode, then only REGNO is being changed;
- this is used when invalidating call clobbered registers across a
- call. */
-
-static void
-reload_cse_invalidate_regno (regno, mode, clobber)
- int regno;
- enum machine_mode mode;
- int clobber;
-{
- int endregno;
- register int i;
-
- /* Our callers don't always go through true_regnum; we may see a
- pseudo-register here from a CLOBBER or the like. We probably
- won't ever see a pseudo-register that has a real register number,
- for we check anyhow for safety. */
- if (regno >= FIRST_PSEUDO_REGISTER)
- regno = reg_renumber[regno];
- if (regno < 0)
- return;
-
- if (mode == VOIDmode)
- endregno = regno + 1;
- else
- endregno = regno + HARD_REGNO_NREGS (regno, mode);
-
- if (clobber)
- for (i = regno; i < endregno; i++)
- reg_values[i] = 0;
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- rtx x;
-
- for (x = reg_values[i]; x; x = XEXP (x, 1))
- {
- if (XEXP (x, 0) != 0
- && refers_to_regno_p (regno, endregno, XEXP (x, 0), NULL_RTX))
- {
- /* If this is the only entry on the list, clear
- reg_values[i]. Otherwise, just clear this entry on
- the list. */
- if (XEXP (x, 1) == 0 && x == reg_values[i])
- {
- reg_values[i] = 0;
- break;
- }
- XEXP (x, 0) = 0;
- }
- }
- }
-}
-
-/* The memory at address (plus MEM_BASE MEM_OFFSET), where MEM_OFFSET
- is a CONST_INT, is being changed. MEM_MODE is the mode of the
- memory reference. Return whether this change will invalidate VAL. */
-
-static int
-reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode, val)
- rtx mem_base;
- rtx mem_offset;
- enum machine_mode mem_mode;
- rtx val;
-{
- enum rtx_code code;
- char *fmt;
- int i;
-
- code = GET_CODE (val);
- switch (code)
- {
- /* Get rid of a few simple cases quickly. */
- case REG:
- case SUBREG:
- case PC:
- case CC0:
- case SCRATCH:
- case CONST:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- return 0;
-
- case MEM:
- {
- rtx val_base, val_offset;
-
- if (mem_mode == BLKmode || GET_MODE (val) == BLKmode)
- return 1;
-
- val_offset = const0_rtx;
- val_base = eliminate_constant_term (XEXP (val, 0), &val_offset);
-
- /* If MEM_BASE and VAL_BASE are the same, but the offsets do
- not overlap, then we do not have a conflict on this MEM.
- For complete safety, we still need to check that VAL_BASE
- itself does not contain an overlapping MEM.
-
- We can't simplify the check to just OFFSET + SIZE <=
- OTHER_OFFSET, because SIZE might cause OFFSET to wrap from
- positive to negative. If we used unsigned arithmetic, we
- would have the same problem wrapping around zero. */
-
- if (rtx_equal_p (mem_base, val_base)
- && ((INTVAL (mem_offset) < INTVAL (val_offset)
- && (INTVAL (mem_offset) + GET_MODE_SIZE (mem_mode)
- <= INTVAL (val_offset)))
- || (INTVAL (val_offset) < INTVAL (mem_offset)
- && (INTVAL (val_offset) + GET_MODE_SIZE (GET_MODE (val))
- <= INTVAL (mem_offset)))))
- return reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode,
- val_base);
-
- return 1;
- }
-
- default:
- break;
- }
-
- fmt = GET_RTX_FORMAT (code);
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- if (reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode,
- XEXP (val, i)))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- int j;
-
- for (j = 0; j < XVECLEN (val, i); j++)
- if (reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode,
- XVECEXP (val, i, j)))
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Invalidate any entries in reg_values which are changed because of a
- store to MEM_RTX. If this is called because of a non-const call
- instruction, MEM_RTX is (mem:BLK const0_rtx). */
-
-static void
-reload_cse_invalidate_mem (mem_rtx)
- rtx mem_rtx;
-{
- register int i;
- rtx mem_base, mem_offset;
- enum machine_mode mem_mode;
-
- /* We detect certain cases where memory addresses can not conflict:
- if they use the same register, and the offsets do not overlap. */
-
- mem_offset = const0_rtx;
- mem_base = eliminate_constant_term (XEXP (mem_rtx, 0), &mem_offset);
- mem_mode = GET_MODE (mem_rtx);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- rtx x;
-
- for (x = reg_values[i]; x; x = XEXP (x, 1))
- {
- if (XEXP (x, 0) != 0
- && reload_cse_mem_conflict_p (mem_base, mem_offset, mem_mode,
- XEXP (x, 0)))
- {
- /* If this is the only entry on the list, clear
- reg_values[i]. Otherwise, just clear this entry on
- the list. */
- if (XEXP (x, 1) == 0 && x == reg_values[i])
- {
- reg_values[i] = 0;
- break;
- }
- XEXP (x, 0) = 0;
- }
- }
- }
-}
-
-/* Invalidate DEST, which is being assigned to or clobbered. The
- second parameter exists so that this function can be passed to
- note_stores; it is ignored. */
-
-static void
-reload_cse_invalidate_rtx (dest, ignore)
- rtx dest;
- rtx ignore;
-{
- while (GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SUBREG)
- dest = XEXP (dest, 0);
-
- if (GET_CODE (dest) == REG)
- reload_cse_invalidate_regno (REGNO (dest), GET_MODE (dest), 1);
- else if (GET_CODE (dest) == MEM)
- reload_cse_invalidate_mem (dest);
-}
-
-/* Do a very simple CSE pass over the hard registers.
-
- This function detects no-op moves where we happened to assign two
- different pseudo-registers to the same hard register, and then
- copied one to the other. Reload will generate a useless
- instruction copying a register to itself.
-
- This function also detects cases where we load a value from memory
- into two different registers, and (if memory is more expensive than
- registers) changes it to simply copy the first register into the
- second register. */
-
-static void
-reload_cse_regs (first)
- rtx first;
-{
- char *firstobj;
- rtx callmem;
- register int i;
- rtx insn;
-
- reg_values = (rtx *) alloca (FIRST_PSEUDO_REGISTER * sizeof (rtx));
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- reg_values[i] = 0;
-
- /* Create our EXPR_LIST structures on reload_obstack, so that we can
- free them when we are done. */
- push_obstacks (&reload_obstack, &reload_obstack);
- firstobj = (char *) obstack_alloc (&reload_obstack, 0);
-
- /* We pass this to reload_cse_invalidate_mem to invalidate all of
- memory for a non-const call instruction. */
- callmem = gen_rtx (MEM, BLKmode, const0_rtx);
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- rtx body;
-
- if (GET_CODE (insn) == CODE_LABEL)
- {
- /* Forget all the register values at a code label. We don't
- try to do anything clever around jumps. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- reg_values[i] = 0;
-
- continue;
- }
-
-#ifdef NON_SAVING_SETJMP
- if (NON_SAVING_SETJMP && GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
- {
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- reg_values[i] = 0;
-
- continue;
- }
-#endif
-
- if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
- continue;
-
- /* If this is a call instruction, forget anything stored in a
- call clobbered register, or, if this is not a const call, in
- memory. */
- if (GET_CODE (insn) == CALL_INSN)
- {
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i])
- reload_cse_invalidate_regno (i, VOIDmode, 1);
-
- if (! CONST_CALL_P (insn))
- reload_cse_invalidate_mem (callmem);
- }
-
- body = PATTERN (insn);
- if (GET_CODE (body) == SET)
- {
- if (reload_cse_noop_set_p (body))
- {
- /* If we were preserving death notes, then we would want
- to remove any existing death note for the register
- being set. */
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
-
- /* We're done with this insn. */
- continue;
- }
-
- reload_cse_simplify_set (body, insn);
- reload_cse_record_set (body, body);
- }
- else if (GET_CODE (body) == PARALLEL)
- {
- int delete;
-
- /* If every action in a PARALLEL is a noop, we can delete
- the entire PARALLEL. */
- for (i = XVECLEN (body, 0) - 1; i >= 0; --i)
- if (GET_CODE (XVECEXP (body, 0, i)) != SET
- || ! reload_cse_noop_set_p (XVECEXP (body, 0, i)))
- break;
- if (i < 0)
- {
- /* If we were preserving death notes, then we would want
- to remove any existing death notes for the registers
- being set. */
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
-
- /* We're done with this insn. */
- continue;
- }
-
- /* Look through the PARALLEL and record the values being
- set, if possible. Also handle any CLOBBERs. */
- for (i = XVECLEN (body, 0) - 1; i >= 0; --i)
- {
- rtx x = XVECEXP (body, 0, i);
-
- if (GET_CODE (x) == SET)
- reload_cse_record_set (x, body);
- else
- note_stores (x, reload_cse_invalidate_rtx);
- }
- }
- else
- note_stores (body, reload_cse_invalidate_rtx);
-
-#ifdef AUTO_INC_DEC
- /* Clobber any registers which appear in REG_INC notes. We
- could keep track of the changes to their values, but it is
- unlikely to help. */
- {
- rtx x;
-
- for (x = REG_NOTES (insn); x; x = XEXP (x, 1))
- if (REG_NOTE_KIND (x) == REG_INC)
- reload_cse_invalidate_rtx (XEXP (x, 0), NULL_RTX);
- }
-#endif
-
- /* Look for any CLOBBERs in CALL_INSN_FUNCTION_USAGE, but only
- after we have processed the insn. */
- if (GET_CODE (insn) == CALL_INSN)
- {
- rtx x;
-
- for (x = CALL_INSN_FUNCTION_USAGE (insn); x; x = XEXP (x, 1))
- if (GET_CODE (XEXP (x, 0)) == CLOBBER)
- reload_cse_invalidate_rtx (XEXP (XEXP (x, 0), 0), NULL_RTX);
- }
- }
-
- /* Free all the temporary structures we created, and go back to the
- regular obstacks. */
- obstack_free (&reload_obstack, firstobj);
- pop_obstacks ();
-}
-
-/* Return whether the values known for REGNO are equal to VAL. MODE
- is the mode of the object that VAL is being copied to; this matters
- if VAL is a CONST_INT. */
-
-static int
-reload_cse_regno_equal_p (regno, val, mode)
- int regno;
- rtx val;
- enum machine_mode mode;
-{
- rtx x;
-
- if (val == 0)
- return 0;
-
- for (x = reg_values[regno]; x; x = XEXP (x, 1))
- if (XEXP (x, 0) != 0
- && rtx_equal_p (XEXP (x, 0), val)
- && (GET_CODE (val) != CONST_INT
- || mode == GET_MODE (x)
- || (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (x))
- && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
- GET_MODE_BITSIZE (GET_MODE (x))))))
- return 1;
-
- return 0;
-}
-
-/* See whether a single SET instruction is a nooop. */
-
-static int
-reload_cse_noop_set_p (set)
- rtx set;
-{
- rtx src, dest;
- enum machine_mode dest_mode;
- int dreg, sreg;
-
- src = SET_SRC (set);
- dest = SET_DEST (set);
- dest_mode = GET_MODE (dest);
-
- if (side_effects_p (src))
- return 0;
-
- dreg = true_regnum (dest);
- sreg = true_regnum (src);
-
- if (dreg >= 0)
- {
- /* Check for setting a register to itself. */
- if (dreg == sreg)
- return 1;
-
- /* Check for setting a register to a value which we already know
- is in the register. */
- if (reload_cse_regno_equal_p (dreg, src, dest_mode))
- return 1;
-
- /* Check for setting a register DREG to another register SREG
- where SREG is equal to a value which is already in DREG. */
- if (sreg >= 0)
- {
- rtx x;
-
- for (x = reg_values[sreg]; x; x = XEXP (x, 1))
- if (XEXP (x, 0) != 0
- && reload_cse_regno_equal_p (dreg, XEXP (x, 0), dest_mode))
- return 1;
- }
- }
- else if (GET_CODE (dest) == MEM)
- {
- /* Check for storing a register to memory when we know that the
- register is equivalent to the memory location. */
- if (sreg >= 0
- && reload_cse_regno_equal_p (sreg, dest, dest_mode)
- && ! side_effects_p (dest))
- return 1;
- }
-
- return 0;
-}
-
-/* Try to simplify a single SET instruction. SET is the set pattern.
- INSN is the instruction it came from. */
-
-static void
-reload_cse_simplify_set (set, insn)
- rtx set;
- rtx insn;
-{
- int dreg;
- rtx src;
- enum machine_mode dest_mode;
- enum reg_class dclass;
- register int i;
-
- /* We only handle one case: if we set a register to a value which is
- not a register, we try to find that value in some other register
- and change the set into a register copy. */
-
- dreg = true_regnum (SET_DEST (set));
- if (dreg < 0)
- return;
-
- src = SET_SRC (set);
- if (side_effects_p (src) || true_regnum (src) >= 0)
- return;
-
- /* If memory loads are cheaper than register copies, don't change
- them. */
- if (GET_CODE (src) == MEM && MEMORY_MOVE_COST (GET_MODE (src)) < 2)
- return;
-
- dest_mode = GET_MODE (SET_DEST (set));
- dclass = REGNO_REG_CLASS (dreg);
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- if (i != dreg
- && REGISTER_MOVE_COST (REGNO_REG_CLASS (i), dclass) == 2
- && reload_cse_regno_equal_p (i, src, dest_mode))
- {
- int validated;
-
- /* Pop back to the real obstacks while changing the insn. */
- pop_obstacks ();
-
- validated = validate_change (insn, &SET_SRC (set),
- gen_rtx (REG, dest_mode, i), 0);
-
- /* Go back to the obstack we are using for temporary
- storage. */
- push_obstacks (&reload_obstack, &reload_obstack);
-
- if (validated)
- return;
- }
- }
-}
-
-/* These two variables are used to pass information from
- reload_cse_record_set to reload_cse_check_clobber. */
-
-static int reload_cse_check_clobbered;
-static rtx reload_cse_check_src;
-
-/* See if DEST overlaps with RELOAD_CSE_CHECK_SRC. If it does, set
- RELOAD_CSE_CHECK_CLOBBERED. This is called via note_stores. The
- second argument, which is passed by note_stores, is ignored. */
-
-static void
-reload_cse_check_clobber (dest, ignore)
- rtx dest;
- rtx ignore;
-{
- if (reg_overlap_mentioned_p (dest, reload_cse_check_src))
- reload_cse_check_clobbered = 1;
-}
-
-/* Record the result of a SET instruction. SET is the set pattern.
- BODY is the pattern of the insn that it came from. */
-
-static void
-reload_cse_record_set (set, body)
- rtx set;
- rtx body;
-{
- rtx dest, src;
- int dreg, sreg;
- enum machine_mode dest_mode;
-
- dest = SET_DEST (set);
- src = SET_SRC (set);
- dreg = true_regnum (dest);
- sreg = true_regnum (src);
- dest_mode = GET_MODE (dest);
-
- /* We can only handle an assignment to a register, or a store of a
- register to a memory location. For other cases, we just clobber
- the destination. We also have to just clobber if there are side
- effects in SRC or DEST. */
- if ((dreg < 0 && GET_CODE (dest) != MEM)
- || side_effects_p (src)
- || side_effects_p (dest))
- {
- reload_cse_invalidate_rtx (dest, NULL_RTX);
- return;
- }
-
-#ifdef HAVE_cc0
- /* We don't try to handle values involving CC, because it's a pain
- to keep track of when they have to be invalidated. */
- if (reg_mentioned_p (cc0_rtx, src)
- || reg_mentioned_p (cc0_rtx, dest))
- {
- reload_cse_invalidate_rtx (dest, NULL_RTX);
- return;
- }
-#endif
-
- /* If BODY is a PARALLEL, then we need to see whether the source of
- SET is clobbered by some other instruction in the PARALLEL. */
- if (GET_CODE (body) == PARALLEL)
- {
- int i;
-
- for (i = XVECLEN (body, 0) - 1; i >= 0; --i)
- {
- rtx x;
-
- x = XVECEXP (body, 0, i);
- if (x == set)
- continue;
-
- reload_cse_check_clobbered = 0;
- reload_cse_check_src = src;
- note_stores (x, reload_cse_check_clobber);
- if (reload_cse_check_clobbered)
- {
- reload_cse_invalidate_rtx (dest, NULL_RTX);
- return;
- }
- }
- }
-
- if (dreg >= 0)
- {
- int i;
-
- /* This is an assignment to a register. Update the value we
- have stored for the register. */
- if (sreg >= 0)
- reg_values[dreg] = reg_values[sreg];
- else
- reg_values[dreg] = gen_rtx (EXPR_LIST, dest_mode, src, NULL_RTX);
-
- /* We've changed DREG, so invalidate any values held by other
- registers that depend upon it. */
- reload_cse_invalidate_regno (dreg, dest_mode, 0);
-
- /* If this assignment changes more than one hard register,
- forget anything we know about the others. */
- for (i = 1; i < HARD_REGNO_NREGS (dreg, dest_mode); i++)
- reg_values[dreg + i] = 0;
- }
- else if (GET_CODE (dest) == MEM)
- {
- /* Invalidate conflicting memory locations. */
- reload_cse_invalidate_mem (dest);
-
- /* If we're storing a register to memory, add DEST to the list
- in REG_VALUES. */
- if (sreg >= 0 && ! side_effects_p (dest))
- reg_values[sreg] = gen_rtx (EXPR_LIST, dest_mode, dest,
- reg_values[sreg]);
- }
- else
- {
- /* We should have bailed out earlier. */
- abort ();
- }
-}
diff --git a/gcc/reorg.c b/gcc/reorg.c
deleted file mode 100644
index 8cd44731a5e..00000000000
--- a/gcc/reorg.c
+++ /dev/null
@@ -1,4617 +0,0 @@
-/* Perform instruction reorganizations for delay slot filling.
- Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
- Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu).
- Hacked by Michael Tiemann (tiemann@cygnus.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. */
-
-/* Instruction reorganization pass.
-
- This pass runs after register allocation and final jump
- optimization. It should be the last pass to run before peephole.
- It serves primarily to fill delay slots of insns, typically branch
- and call insns. Other insns typically involve more complicated
- interactions of data dependencies and resource constraints, and
- are better handled by scheduling before register allocation (by the
- function `schedule_insns').
-
- The Branch Penalty is the number of extra cycles that are needed to
- execute a branch insn. On an ideal machine, branches take a single
- cycle, and the Branch Penalty is 0. Several RISC machines approach
- branch delays differently:
-
- The MIPS and AMD 29000 have a single branch delay slot. Most insns
- (except other branches) can be used to fill this slot. When the
- slot is filled, two insns execute in two cycles, reducing the
- branch penalty to zero.
-
- The Motorola 88000 conditionally exposes its branch delay slot,
- so code is shorter when it is turned off, but will run faster
- when useful insns are scheduled there.
-
- The IBM ROMP has two forms of branch and call insns, both with and
- without a delay slot. Much like the 88k, insns not using the delay
- slot can be shorted (2 bytes vs. 4 bytes), but will run slowed.
-
- The SPARC always has a branch delay slot, but its effects can be
- annulled when the branch is not taken. This means that failing to
- find other sources of insns, we can hoist an insn from the branch
- target that would only be safe to execute knowing that the branch
- is taken.
-
- The HP-PA always has a branch delay slot. For unconditional branches
- its effects can be annulled when the branch is taken. The effects
- of the delay slot in a conditional branch can be nullified for forward
- taken branches, or for untaken backward branches. This means
- we can hoist insns from the fall-through path for forward branches or
- steal insns from the target of backward branches.
-
- Three techniques for filling delay slots have been implemented so far:
-
- (1) `fill_simple_delay_slots' is the simplest, most efficient way
- to fill delay slots. This pass first looks for insns which come
- from before the branch and which are safe to execute after the
- branch. Then it searches after the insn requiring delay slots or,
- in the case of a branch, for insns that are after the point at
- which the branch merges into the fallthrough code, if such a point
- exists. When such insns are found, the branch penalty decreases
- and no code expansion takes place.
-
- (2) `fill_eager_delay_slots' is more complicated: it is used for
- scheduling conditional jumps, or for scheduling jumps which cannot
- be filled using (1). A machine need not have annulled jumps to use
- this strategy, but it helps (by keeping more options open).
- `fill_eager_delay_slots' tries to guess the direction the branch
- will go; if it guesses right 100% of the time, it can reduce the
- branch penalty as much as `fill_simple_delay_slots' does. If it
- guesses wrong 100% of the time, it might as well schedule nops (or
- on the m88k, unexpose the branch slot). When
- `fill_eager_delay_slots' takes insns from the fall-through path of
- the jump, usually there is no code expansion; when it takes insns
- from the branch target, there is code expansion if it is not the
- only way to reach that target.
-
- (3) `relax_delay_slots' uses a set of rules to simplify code that
- has been reorganized by (1) and (2). It finds cases where
- conditional test can be eliminated, jumps can be threaded, extra
- insns can be eliminated, etc. It is the job of (1) and (2) to do a
- good job of scheduling locally; `relax_delay_slots' takes care of
- making the various individual schedules work well together. It is
- especially tuned to handle the control flow interactions of branch
- insns. It does nothing for insns with delay slots that do not
- branch.
-
- On machines that use CC0, we are very conservative. We will not make
- a copy of an insn involving CC0 since we want to maintain a 1-1
- correspondence between the insn that sets and uses CC0. The insns are
- allowed to be separated by placing an insn that sets CC0 (but not an insn
- that uses CC0; we could do this, but it doesn't seem worthwhile) in a
- delay slot. In that case, we point each insn at the other with REG_CC_USER
- and REG_CC_SETTER notes. Note that these restrictions affect very few
- machines because most RISC machines with delay slots will not use CC0
- (the RT is the only known exception at this point).
-
- Not yet implemented:
-
- The Acorn Risc Machine can conditionally execute most insns, so
- it is profitable to move single insns into a position to execute
- based on the condition code of the previous insn.
-
- The HP-PA can conditionally nullify insns, providing a similar
- effect to the ARM, differing mostly in which insn is "in charge". */
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "insn-config.h"
-#include "conditions.h"
-#include "hard-reg-set.h"
-#include "basic-block.h"
-#include "regs.h"
-#include "insn-flags.h"
-#include "recog.h"
-#include "flags.h"
-#include "output.h"
-#include "obstack.h"
-#include "insn-attr.h"
-
-/* Import list of registers used as spill regs from reload. */
-extern HARD_REG_SET used_spill_regs;
-
-/* Import highest label used in function at end of reload. */
-extern int max_label_num_after_reload;
-
-
-#ifdef DELAY_SLOTS
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-#ifndef ANNUL_IFTRUE_SLOTS
-#define eligible_for_annul_true(INSN, SLOTS, TRIAL, FLAGS) 0
-#endif
-#ifndef ANNUL_IFFALSE_SLOTS
-#define eligible_for_annul_false(INSN, SLOTS, TRIAL, FLAGS) 0
-#endif
-
-/* Insns which have delay slots that have not yet been filled. */
-
-static struct obstack unfilled_slots_obstack;
-static rtx *unfilled_firstobj;
-
-/* Define macros to refer to the first and last slot containing unfilled
- insns. These are used because the list may move and its address
- should be recomputed at each use. */
-
-#define unfilled_slots_base \
- ((rtx *) obstack_base (&unfilled_slots_obstack))
-
-#define unfilled_slots_next \
- ((rtx *) obstack_next_free (&unfilled_slots_obstack))
-
-/* This structure is used to indicate which hardware resources are set or
- needed by insns so far. */
-
-struct resources
-{
- char memory; /* Insn sets or needs a memory location. */
- char unch_memory; /* Insn sets of needs a "unchanging" MEM. */
- char volatil; /* Insn sets or needs a volatile memory loc. */
- char cc; /* Insn sets or needs the condition codes. */
- HARD_REG_SET regs; /* Which registers are set or needed. */
-};
-
-/* Macro to clear all resources. */
-#define CLEAR_RESOURCE(RES) \
- do { (RES)->memory = (RES)->unch_memory = (RES)->volatil = (RES)->cc = 0; \
- CLEAR_HARD_REG_SET ((RES)->regs); } while (0)
-
-/* Indicates what resources are required at the beginning of the epilogue. */
-static struct resources start_of_epilogue_needs;
-
-/* Indicates what resources are required at function end. */
-static struct resources end_of_function_needs;
-
-/* Points to the label before the end of the function. */
-static rtx end_of_function_label;
-
-/* This structure is used to record liveness information at the targets or
- fallthrough insns of branches. We will most likely need the information
- at targets again, so save them in a hash table rather than recomputing them
- each time. */
-
-struct target_info
-{
- int uid; /* INSN_UID of target. */
- struct target_info *next; /* Next info for same hash bucket. */
- HARD_REG_SET live_regs; /* Registers live at target. */
- int block; /* Basic block number containing target. */
- int bb_tick; /* Generation count of basic block info. */
-};
-
-#define TARGET_HASH_PRIME 257
-
-/* Define the hash table itself. */
-static struct target_info **target_hash_table;
-
-/* For each basic block, we maintain a generation number of its basic
- block info, which is updated each time we move an insn from the
- target of a jump. This is the generation number indexed by block
- number. */
-
-static int *bb_ticks;
-
-/* Mapping between INSN_UID's and position in the code since INSN_UID's do
- not always monotonically increase. */
-static int *uid_to_ruid;
-
-/* Highest valid index in `uid_to_ruid'. */
-static int max_uid;
-
-static void mark_referenced_resources PROTO((rtx, struct resources *, int));
-static void mark_set_resources PROTO((rtx, struct resources *, int, int));
-static int stop_search_p PROTO((rtx, int));
-static int resource_conflicts_p PROTO((struct resources *,
- struct resources *));
-static int insn_references_resource_p PROTO((rtx, struct resources *, int));
-static int insn_sets_resources_p PROTO((rtx, struct resources *, int));
-static rtx find_end_label PROTO((void));
-static rtx emit_delay_sequence PROTO((rtx, rtx, int, int));
-static rtx add_to_delay_list PROTO((rtx, rtx));
-static void delete_from_delay_slot PROTO((rtx));
-static void delete_scheduled_jump PROTO((rtx));
-static void note_delay_statistics PROTO((int, int));
-static rtx optimize_skip PROTO((rtx));
-static int get_jump_flags PROTO((rtx, rtx));
-static int rare_destination PROTO((rtx));
-static int mostly_true_jump PROTO((rtx, rtx));
-static rtx get_branch_condition PROTO((rtx, rtx));
-static int condition_dominates_p PROTO((rtx, rtx));
-static rtx steal_delay_list_from_target PROTO((rtx, rtx, rtx, rtx,
- struct resources *,
- struct resources *,
- struct resources *,
- int, int *, int *, rtx *));
-static rtx steal_delay_list_from_fallthrough PROTO((rtx, rtx, rtx, rtx,
- struct resources *,
- struct resources *,
- struct resources *,
- int, int *, int *));
-static void try_merge_delay_insns PROTO((rtx, rtx));
-static rtx redundant_insn PROTO((rtx, rtx, rtx));
-static int own_thread_p PROTO((rtx, rtx, int));
-static int find_basic_block PROTO((rtx));
-static void update_block PROTO((rtx, rtx));
-static int reorg_redirect_jump PROTO((rtx, rtx));
-static void update_reg_dead_notes PROTO((rtx, rtx));
-static void fix_reg_dead_note PROTO((rtx, rtx));
-static void update_reg_unused_notes PROTO((rtx, rtx));
-static void update_live_status PROTO((rtx, rtx));
-static rtx next_insn_no_annul PROTO((rtx));
-static void mark_target_live_regs PROTO((rtx, struct resources *));
-static void fill_simple_delay_slots PROTO((rtx, int));
-static rtx fill_slots_from_thread PROTO((rtx, rtx, rtx, rtx, int, int,
- int, int, int, int *));
-static void fill_eager_delay_slots PROTO((rtx));
-static void relax_delay_slots PROTO((rtx));
-static void make_return_insns PROTO((rtx));
-static int redirect_with_delay_slots_safe_p PROTO ((rtx, rtx, rtx));
-static int redirect_with_delay_list_safe_p PROTO ((rtx, rtx, rtx));
-
-/* Given X, some rtl, and RES, a pointer to a `struct resource', mark
- which resources are references by the insn. If INCLUDE_CALLED_ROUTINE
- is TRUE, resources used by the called routine will be included for
- CALL_INSNs. */
-
-static void
-mark_referenced_resources (x, res, include_delayed_effects)
- register rtx x;
- register struct resources *res;
- register int include_delayed_effects;
-{
- register enum rtx_code code = GET_CODE (x);
- register int i, j;
- register char *format_ptr;
-
- /* Handle leaf items for which we set resource flags. Also, special-case
- CALL, SET and CLOBBER operators. */
- switch (code)
- {
- case CONST:
- case CONST_INT:
- case CONST_DOUBLE:
- case PC:
- case SYMBOL_REF:
- case LABEL_REF:
- return;
-
- case SUBREG:
- if (GET_CODE (SUBREG_REG (x)) != REG)
- mark_referenced_resources (SUBREG_REG (x), res, 0);
- else
- {
- int regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x);
- int last_regno = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
- for (i = regno; i < last_regno; i++)
- SET_HARD_REG_BIT (res->regs, i);
- }
- return;
-
- case REG:
- for (i = 0; i < HARD_REGNO_NREGS (REGNO (x), GET_MODE (x)); i++)
- SET_HARD_REG_BIT (res->regs, REGNO (x) + i);
- return;
-
- case MEM:
- /* If this memory shouldn't change, it really isn't referencing
- memory. */
- if (RTX_UNCHANGING_P (x))
- res->unch_memory = 1;
- else
- res->memory = 1;
- res->volatil = MEM_VOLATILE_P (x);
-
- /* Mark registers used to access memory. */
- mark_referenced_resources (XEXP (x, 0), res, 0);
- return;
-
- case CC0:
- res->cc = 1;
- return;
-
- case UNSPEC_VOLATILE:
- case ASM_INPUT:
- case TRAP_IF:
- /* Traditional asm's are always volatile. */
- res->volatil = 1;
- return;
-
- case ASM_OPERANDS:
- res->volatil = MEM_VOLATILE_P (x);
-
- /* For all ASM_OPERANDS, we must traverse the vector of input operands.
- We can not just fall through here since then we would be confused
- by the ASM_INPUT rtx inside ASM_OPERANDS, which do not indicate
- traditional asms unlike their normal usage. */
-
- for (i = 0; i < ASM_OPERANDS_INPUT_LENGTH (x); i++)
- mark_referenced_resources (ASM_OPERANDS_INPUT (x, i), res, 0);
- return;
-
- case CALL:
- /* The first operand will be a (MEM (xxx)) but doesn't really reference
- memory. The second operand may be referenced, though. */
- mark_referenced_resources (XEXP (XEXP (x, 0), 0), res, 0);
- mark_referenced_resources (XEXP (x, 1), res, 0);
- return;
-
- case SET:
- /* Usually, the first operand of SET is set, not referenced. But
- registers used to access memory are referenced. SET_DEST is
- also referenced if it is a ZERO_EXTRACT or SIGN_EXTRACT. */
-
- mark_referenced_resources (SET_SRC (x), res, 0);
-
- x = SET_DEST (x);
- if (GET_CODE (x) == SIGN_EXTRACT || GET_CODE (x) == ZERO_EXTRACT)
- mark_referenced_resources (x, res, 0);
- else if (GET_CODE (x) == SUBREG)
- x = SUBREG_REG (x);
- if (GET_CODE (x) == MEM)
- mark_referenced_resources (XEXP (x, 0), res, 0);
- return;
-
- case CLOBBER:
- return;
-
- case CALL_INSN:
- if (include_delayed_effects)
- {
- /* A CALL references memory, the frame pointer if it exists, the
- stack pointer, any global registers and any registers given in
- USE insns immediately in front of the CALL.
-
- However, we may have moved some of the parameter loading insns
- into the delay slot of this CALL. If so, the USE's for them
- don't count and should be skipped. */
- rtx insn = PREV_INSN (x);
- rtx sequence = 0;
- int seq_size = 0;
- rtx next = NEXT_INSN (x);
- int i;
-
- /* If we are part of a delay slot sequence, point at the SEQUENCE. */
- if (NEXT_INSN (insn) != x)
- {
- next = NEXT_INSN (NEXT_INSN (insn));
- sequence = PATTERN (NEXT_INSN (insn));
- seq_size = XVECLEN (sequence, 0);
- if (GET_CODE (sequence) != SEQUENCE)
- abort ();
- }
-
- res->memory = 1;
- SET_HARD_REG_BIT (res->regs, STACK_POINTER_REGNUM);
- if (frame_pointer_needed)
- {
- SET_HARD_REG_BIT (res->regs, FRAME_POINTER_REGNUM);
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- SET_HARD_REG_BIT (res->regs, HARD_FRAME_POINTER_REGNUM);
-#endif
- }
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i])
- SET_HARD_REG_BIT (res->regs, i);
-
- /* Check for a NOTE_INSN_SETJMP. If it exists, then we must
- assume that this call can need any register.
-
- This is done to be more conservative about how we handle setjmp.
- We assume that they both use and set all registers. Using all
- registers ensures that a register will not be considered dead
- just because it crosses a setjmp call. A register should be
- considered dead only if the setjmp call returns non-zero. */
- if (next && GET_CODE (next) == NOTE
- && NOTE_LINE_NUMBER (next) == NOTE_INSN_SETJMP)
- SET_HARD_REG_SET (res->regs);
-
- {
- rtx link;
-
- for (link = CALL_INSN_FUNCTION_USAGE (x);
- link;
- link = XEXP (link, 1))
- if (GET_CODE (XEXP (link, 0)) == USE)
- {
- for (i = 1; i < seq_size; i++)
- {
- rtx slot_pat = PATTERN (XVECEXP (sequence, 0, i));
- if (GET_CODE (slot_pat) == SET
- && rtx_equal_p (SET_DEST (slot_pat),
- SET_DEST (XEXP (link, 0))))
- break;
- }
- if (i >= seq_size)
- mark_referenced_resources (SET_DEST (XEXP (link, 0)),
- res, 0);
- }
- }
- }
-
- /* ... fall through to other INSN processing ... */
-
- case INSN:
- case JUMP_INSN:
-
-#ifdef INSN_REFERENCES_ARE_DELAYED
- if (! include_delayed_effects
- && INSN_REFERENCES_ARE_DELAYED (x))
- return;
-#endif
-
- /* No special processing, just speed up. */
- mark_referenced_resources (PATTERN (x), res, include_delayed_effects);
- return;
- }
-
- /* Process each sub-expression and flag what it needs. */
- format_ptr = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- switch (*format_ptr++)
- {
- case 'e':
- mark_referenced_resources (XEXP (x, i), res, include_delayed_effects);
- break;
-
- case 'E':
- for (j = 0; j < XVECLEN (x, i); j++)
- mark_referenced_resources (XVECEXP (x, i, j), res,
- include_delayed_effects);
- break;
- }
-}
-
-/* Given X, a part of an insn, and a pointer to a `struct resource', RES,
- indicate which resources are modified by the insn. If INCLUDE_CALLED_ROUTINE
- is nonzero, also mark resources potentially set by the called routine.
-
- If IN_DEST is nonzero, it means we are inside a SET. Otherwise,
- objects are being referenced instead of set.
-
- We never mark the insn as modifying the condition code unless it explicitly
- SETs CC0 even though this is not totally correct. The reason for this is
- that we require a SET of CC0 to immediately precede the reference to CC0.
- So if some other insn sets CC0 as a side-effect, we know it cannot affect
- our computation and thus may be placed in a delay slot. */
-
-static void
-mark_set_resources (x, res, in_dest, include_delayed_effects)
- register rtx x;
- register struct resources *res;
- int in_dest;
- int include_delayed_effects;
-{
- register enum rtx_code code;
- register int i, j;
- register char *format_ptr;
-
- restart:
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case NOTE:
- case BARRIER:
- case CODE_LABEL:
- case USE:
- case CONST_INT:
- case CONST_DOUBLE:
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST:
- case PC:
- /* These don't set any resources. */
- return;
-
- case CC0:
- if (in_dest)
- res->cc = 1;
- return;
-
- case CALL_INSN:
- /* Called routine modifies the condition code, memory, any registers
- that aren't saved across calls, global registers and anything
- explicitly CLOBBERed immediately after the CALL_INSN. */
-
- if (include_delayed_effects)
- {
- rtx next = NEXT_INSN (x);
- rtx prev = PREV_INSN (x);
- rtx link;
-
- res->cc = res->memory = 1;
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i] || global_regs[i])
- SET_HARD_REG_BIT (res->regs, i);
-
- /* If X is part of a delay slot sequence, then NEXT should be
- the first insn after the sequence. */
- if (NEXT_INSN (prev) != x)
- next = NEXT_INSN (NEXT_INSN (prev));
-
- for (link = CALL_INSN_FUNCTION_USAGE (x);
- link; link = XEXP (link, 1))
- if (GET_CODE (XEXP (link, 0)) == CLOBBER)
- mark_set_resources (SET_DEST (XEXP (link, 0)), res, 1, 0);
-
- /* Check for a NOTE_INSN_SETJMP. If it exists, then we must
- assume that this call can clobber any register. */
- if (next && GET_CODE (next) == NOTE
- && NOTE_LINE_NUMBER (next) == NOTE_INSN_SETJMP)
- SET_HARD_REG_SET (res->regs);
- }
-
- /* ... and also what it's RTL says it modifies, if anything. */
-
- case JUMP_INSN:
- case INSN:
-
- /* An insn consisting of just a CLOBBER (or USE) is just for flow
- and doesn't actually do anything, so we ignore it. */
-
-#ifdef INSN_SETS_ARE_DELAYED
- if (! include_delayed_effects
- && INSN_SETS_ARE_DELAYED (x))
- return;
-#endif
-
- x = PATTERN (x);
- if (GET_CODE (x) != USE && GET_CODE (x) != CLOBBER)
- goto restart;
- return;
-
- case SET:
- /* If the source of a SET is a CALL, this is actually done by
- the called routine. So only include it if we are to include the
- effects of the calling routine. */
-
- mark_set_resources (SET_DEST (x), res,
- (include_delayed_effects
- || GET_CODE (SET_SRC (x)) != CALL),
- 0);
-
- mark_set_resources (SET_SRC (x), res, 0, 0);
- return;
-
- case CLOBBER:
- mark_set_resources (XEXP (x, 0), res, 1, 0);
- return;
-
- case SEQUENCE:
- for (i = 0; i < XVECLEN (x, 0); i++)
- if (! (INSN_ANNULLED_BRANCH_P (XVECEXP (x, 0, 0))
- && INSN_FROM_TARGET_P (XVECEXP (x, 0, i))))
- mark_set_resources (XVECEXP (x, 0, i), res, 0,
- include_delayed_effects);
- return;
-
- case POST_INC:
- case PRE_INC:
- case POST_DEC:
- case PRE_DEC:
- mark_set_resources (XEXP (x, 0), res, 1, 0);
- return;
-
- case ZERO_EXTRACT:
- mark_set_resources (XEXP (x, 0), res, in_dest, 0);
- mark_set_resources (XEXP (x, 1), res, 0, 0);
- mark_set_resources (XEXP (x, 2), res, 0, 0);
- return;
-
- case MEM:
- if (in_dest)
- {
- res->memory = 1;
- res->unch_memory = RTX_UNCHANGING_P (x);
- res->volatil = MEM_VOLATILE_P (x);
- }
-
- mark_set_resources (XEXP (x, 0), res, 0, 0);
- return;
-
- case SUBREG:
- if (in_dest)
- {
- if (GET_CODE (SUBREG_REG (x)) != REG)
- mark_set_resources (SUBREG_REG (x), res,
- in_dest, include_delayed_effects);
- else
- {
- int regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x);
- int last_regno = regno + HARD_REGNO_NREGS (regno, GET_MODE (x));
- for (i = regno; i < last_regno; i++)
- SET_HARD_REG_BIT (res->regs, i);
- }
- }
- return;
-
- case REG:
- if (in_dest)
- for (i = 0; i < HARD_REGNO_NREGS (REGNO (x), GET_MODE (x)); i++)
- SET_HARD_REG_BIT (res->regs, REGNO (x) + i);
- return;
- }
-
- /* Process each sub-expression and flag what it needs. */
- format_ptr = GET_RTX_FORMAT (code);
- for (i = 0; i < GET_RTX_LENGTH (code); i++)
- switch (*format_ptr++)
- {
- case 'e':
- mark_set_resources (XEXP (x, i), res, in_dest, include_delayed_effects);
- break;
-
- case 'E':
- for (j = 0; j < XVECLEN (x, i); j++)
- mark_set_resources (XVECEXP (x, i, j), res, in_dest,
- include_delayed_effects);
- break;
- }
-}
-
-/* Return TRUE if this insn should stop the search for insn to fill delay
- slots. LABELS_P indicates that labels should terminate the search.
- In all cases, jumps terminate the search. */
-
-static int
-stop_search_p (insn, labels_p)
- rtx insn;
- int labels_p;
-{
- if (insn == 0)
- return 1;
-
- switch (GET_CODE (insn))
- {
- case NOTE:
- case CALL_INSN:
- return 0;
-
- case CODE_LABEL:
- return labels_p;
-
- case JUMP_INSN:
- case BARRIER:
- return 1;
-
- case INSN:
- /* OK unless it contains a delay slot or is an `asm' insn of some type.
- We don't know anything about these. */
- return (GET_CODE (PATTERN (insn)) == SEQUENCE
- || GET_CODE (PATTERN (insn)) == ASM_INPUT
- || asm_noperands (PATTERN (insn)) >= 0);
-
- default:
- abort ();
- }
-}
-
-/* Return TRUE if any resources are marked in both RES1 and RES2 or if either
- resource set contains a volatile memory reference. Otherwise, return FALSE. */
-
-static int
-resource_conflicts_p (res1, res2)
- struct resources *res1, *res2;
-{
- if ((res1->cc && res2->cc) || (res1->memory && res2->memory)
- || (res1->unch_memory && res2->unch_memory)
- || res1->volatil || res2->volatil)
- return 1;
-
-#ifdef HARD_REG_SET
- return (res1->regs & res2->regs) != HARD_CONST (0);
-#else
- {
- int i;
-
- for (i = 0; i < HARD_REG_SET_LONGS; i++)
- if ((res1->regs[i] & res2->regs[i]) != 0)
- return 1;
- return 0;
- }
-#endif
-}
-
-/* Return TRUE if any resource marked in RES, a `struct resources', is
- referenced by INSN. If INCLUDE_CALLED_ROUTINE is set, return if the called
- routine is using those resources.
-
- We compute this by computing all the resources referenced by INSN and
- seeing if this conflicts with RES. It might be faster to directly check
- ourselves, and this is the way it used to work, but it means duplicating
- a large block of complex code. */
-
-static int
-insn_references_resource_p (insn, res, include_delayed_effects)
- register rtx insn;
- register struct resources *res;
- int include_delayed_effects;
-{
- struct resources insn_res;
-
- CLEAR_RESOURCE (&insn_res);
- mark_referenced_resources (insn, &insn_res, include_delayed_effects);
- return resource_conflicts_p (&insn_res, res);
-}
-
-/* Return TRUE if INSN modifies resources that are marked in RES.
- INCLUDE_CALLED_ROUTINE is set if the actions of that routine should be
- included. CC0 is only modified if it is explicitly set; see comments
- in front of mark_set_resources for details. */
-
-static int
-insn_sets_resource_p (insn, res, include_delayed_effects)
- register rtx insn;
- register struct resources *res;
- int include_delayed_effects;
-{
- struct resources insn_sets;
-
- CLEAR_RESOURCE (&insn_sets);
- mark_set_resources (insn, &insn_sets, 0, include_delayed_effects);
- return resource_conflicts_p (&insn_sets, res);
-}
-
-/* Find a label at the end of the function or before a RETURN. If there is
- none, make one. */
-
-static rtx
-find_end_label ()
-{
- rtx insn;
-
- /* If we found one previously, return it. */
- if (end_of_function_label)
- return end_of_function_label;
-
- /* Otherwise, see if there is a label at the end of the function. If there
- is, it must be that RETURN insns aren't needed, so that is our return
- label and we don't have to do anything else. */
-
- insn = get_last_insn ();
- while (GET_CODE (insn) == NOTE
- || (GET_CODE (insn) == INSN
- && (GET_CODE (PATTERN (insn)) == USE
- || GET_CODE (PATTERN (insn)) == CLOBBER)))
- insn = PREV_INSN (insn);
-
- /* When a target threads its epilogue we might already have a
- suitable return insn. If so put a label before it for the
- end_of_function_label. */
- if (GET_CODE (insn) == BARRIER
- && GET_CODE (PREV_INSN (insn)) == JUMP_INSN
- && GET_CODE (PATTERN (PREV_INSN (insn))) == RETURN)
- {
- rtx temp = PREV_INSN (PREV_INSN (insn));
- end_of_function_label = gen_label_rtx ();
- LABEL_NUSES (end_of_function_label) = 0;
-
- /* Put the label before an USE insns that may proceed the RETURN insn. */
- while (GET_CODE (temp) == USE)
- temp = PREV_INSN (temp);
-
- emit_label_after (end_of_function_label, temp);
- }
-
- else if (GET_CODE (insn) == CODE_LABEL)
- end_of_function_label = insn;
- else
- {
- /* Otherwise, make a new label and emit a RETURN and BARRIER,
- if needed. */
- end_of_function_label = gen_label_rtx ();
- LABEL_NUSES (end_of_function_label) = 0;
- emit_label (end_of_function_label);
-#ifdef HAVE_return
- if (HAVE_return)
- {
- /* The return we make may have delay slots too. */
- rtx insn = gen_return ();
- insn = emit_jump_insn (insn);
- emit_barrier ();
- if (num_delay_slots (insn) > 0)
- obstack_ptr_grow (&unfilled_slots_obstack, insn);
- }
-#endif
- }
-
- /* Show one additional use for this label so it won't go away until
- we are done. */
- ++LABEL_NUSES (end_of_function_label);
-
- return end_of_function_label;
-}
-
-/* Put INSN and LIST together in a SEQUENCE rtx of LENGTH, and replace
- the pattern of INSN with the SEQUENCE.
-
- Chain the insns so that NEXT_INSN of each insn in the sequence points to
- the next and NEXT_INSN of the last insn in the sequence points to
- the first insn after the sequence. Similarly for PREV_INSN. This makes
- it easier to scan all insns.
-
- Returns the SEQUENCE that replaces INSN. */
-
-static rtx
-emit_delay_sequence (insn, list, length, avail)
- rtx insn;
- rtx list;
- int length;
- int avail;
-{
- register int i = 1;
- register rtx li;
- int had_barrier = 0;
-
- /* Allocate the the rtvec to hold the insns and the SEQUENCE. */
- rtvec seqv = rtvec_alloc (length + 1);
- rtx seq = gen_rtx (SEQUENCE, VOIDmode, seqv);
- rtx seq_insn = make_insn_raw (seq);
- rtx first = get_insns ();
- rtx last = get_last_insn ();
-
- /* Make a copy of the insn having delay slots. */
- rtx delay_insn = copy_rtx (insn);
-
- /* If INSN is followed by a BARRIER, delete the BARRIER since it will only
- confuse further processing. Update LAST in case it was the last insn.
- We will put the BARRIER back in later. */
- if (NEXT_INSN (insn) && GET_CODE (NEXT_INSN (insn)) == BARRIER)
- {
- delete_insn (NEXT_INSN (insn));
- last = get_last_insn ();
- had_barrier = 1;
- }
-
- /* Splice our SEQUENCE into the insn stream where INSN used to be. */
- NEXT_INSN (seq_insn) = NEXT_INSN (insn);
- PREV_INSN (seq_insn) = PREV_INSN (insn);
-
- if (insn == last)
- set_new_first_and_last_insn (first, seq_insn);
- else
- PREV_INSN (NEXT_INSN (seq_insn)) = seq_insn;
-
- if (insn == first)
- set_new_first_and_last_insn (seq_insn, last);
- else
- NEXT_INSN (PREV_INSN (seq_insn)) = seq_insn;
-
- /* Build our SEQUENCE and rebuild the insn chain. */
- XVECEXP (seq, 0, 0) = delay_insn;
- INSN_DELETED_P (delay_insn) = 0;
- PREV_INSN (delay_insn) = PREV_INSN (seq_insn);
-
- for (li = list; li; li = XEXP (li, 1), i++)
- {
- rtx tem = XEXP (li, 0);
- rtx note;
-
- /* Show that this copy of the insn isn't deleted. */
- INSN_DELETED_P (tem) = 0;
-
- XVECEXP (seq, 0, i) = tem;
- PREV_INSN (tem) = XVECEXP (seq, 0, i - 1);
- NEXT_INSN (XVECEXP (seq, 0, i - 1)) = tem;
-
- /* Remove any REG_DEAD notes because we can't rely on them now
- that the insn has been moved. */
- for (note = REG_NOTES (tem); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_DEAD)
- XEXP (note, 0) = const0_rtx;
- }
-
- NEXT_INSN (XVECEXP (seq, 0, length)) = NEXT_INSN (seq_insn);
-
- /* If the previous insn is a SEQUENCE, update the NEXT_INSN pointer on the
- last insn in that SEQUENCE to point to us. Similarly for the first
- insn in the following insn if it is a SEQUENCE. */
-
- if (PREV_INSN (seq_insn) && GET_CODE (PREV_INSN (seq_insn)) == INSN
- && GET_CODE (PATTERN (PREV_INSN (seq_insn))) == SEQUENCE)
- NEXT_INSN (XVECEXP (PATTERN (PREV_INSN (seq_insn)), 0,
- XVECLEN (PATTERN (PREV_INSN (seq_insn)), 0) - 1))
- = seq_insn;
-
- if (NEXT_INSN (seq_insn) && GET_CODE (NEXT_INSN (seq_insn)) == INSN
- && GET_CODE (PATTERN (NEXT_INSN (seq_insn))) == SEQUENCE)
- PREV_INSN (XVECEXP (PATTERN (NEXT_INSN (seq_insn)), 0, 0)) = seq_insn;
-
- /* If there used to be a BARRIER, put it back. */
- if (had_barrier)
- emit_barrier_after (seq_insn);
-
- if (i != length + 1)
- abort ();
-
- return seq_insn;
-}
-
-/* Add INSN to DELAY_LIST and return the head of the new list. The list must
- be in the order in which the insns are to be executed. */
-
-static rtx
-add_to_delay_list (insn, delay_list)
- rtx insn;
- rtx delay_list;
-{
- /* If we have an empty list, just make a new list element. If
- INSN has it's block number recorded, clear it since we may
- be moving the insn to a new block. */
-
- if (delay_list == 0)
- {
- struct target_info *tinfo;
-
- for (tinfo = target_hash_table[INSN_UID (insn) % TARGET_HASH_PRIME];
- tinfo; tinfo = tinfo->next)
- if (tinfo->uid == INSN_UID (insn))
- break;
-
- if (tinfo)
- tinfo->block = -1;
-
- return gen_rtx (INSN_LIST, VOIDmode, insn, NULL_RTX);
- }
-
- /* Otherwise this must be an INSN_LIST. Add INSN to the end of the
- list. */
- XEXP (delay_list, 1) = add_to_delay_list (insn, XEXP (delay_list, 1));
-
- return delay_list;
-}
-
-/* Delete INSN from the the delay slot of the insn that it is in. This may
- produce an insn without anything in its delay slots. */
-
-static void
-delete_from_delay_slot (insn)
- rtx insn;
-{
- rtx trial, seq_insn, seq, prev;
- rtx delay_list = 0;
- int i;
-
- /* We first must find the insn containing the SEQUENCE with INSN in its
- delay slot. Do this by finding an insn, TRIAL, where
- PREV_INSN (NEXT_INSN (TRIAL)) != TRIAL. */
-
- for (trial = insn;
- PREV_INSN (NEXT_INSN (trial)) == trial;
- trial = NEXT_INSN (trial))
- ;
-
- seq_insn = PREV_INSN (NEXT_INSN (trial));
- seq = PATTERN (seq_insn);
-
- /* Create a delay list consisting of all the insns other than the one
- we are deleting (unless we were the only one). */
- if (XVECLEN (seq, 0) > 2)
- for (i = 1; i < XVECLEN (seq, 0); i++)
- if (XVECEXP (seq, 0, i) != insn)
- delay_list = add_to_delay_list (XVECEXP (seq, 0, i), delay_list);
-
- /* Delete the old SEQUENCE, re-emit the insn that used to have the delay
- list, and rebuild the delay list if non-empty. */
- prev = PREV_INSN (seq_insn);
- trial = XVECEXP (seq, 0, 0);
- delete_insn (seq_insn);
- add_insn_after (trial, prev);
-
- if (GET_CODE (trial) == JUMP_INSN
- && (simplejump_p (trial) || GET_CODE (PATTERN (trial)) == RETURN))
- emit_barrier_after (trial);
-
- /* If there are any delay insns, remit them. Otherwise clear the
- annul flag. */
- if (delay_list)
- trial = emit_delay_sequence (trial, delay_list, XVECLEN (seq, 0) - 2, 0);
- else
- INSN_ANNULLED_BRANCH_P (trial) = 0;
-
- INSN_FROM_TARGET_P (insn) = 0;
-
- /* Show we need to fill this insn again. */
- obstack_ptr_grow (&unfilled_slots_obstack, trial);
-}
-
-/* Delete INSN, a JUMP_INSN. If it is a conditional jump, we must track down
- the insn that sets CC0 for it and delete it too. */
-
-static void
-delete_scheduled_jump (insn)
- rtx insn;
-{
- /* Delete the insn that sets cc0 for us. On machines without cc0, we could
- delete the insn that sets the condition code, but it is hard to find it.
- Since this case is rare anyway, don't bother trying; there would likely
- be other insns that became dead anyway, which we wouldn't know to
- delete. */
-
-#ifdef HAVE_cc0
- if (reg_mentioned_p (cc0_rtx, insn))
- {
- rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
-
- /* If a reg-note was found, it points to an insn to set CC0. This
- insn is in the delay list of some other insn. So delete it from
- the delay list it was in. */
- if (note)
- {
- if (! FIND_REG_INC_NOTE (XEXP (note, 0), NULL_RTX)
- && sets_cc0_p (PATTERN (XEXP (note, 0))) == 1)
- delete_from_delay_slot (XEXP (note, 0));
- }
- else
- {
- /* The insn setting CC0 is our previous insn, but it may be in
- a delay slot. It will be the last insn in the delay slot, if
- it is. */
- rtx trial = previous_insn (insn);
- if (GET_CODE (trial) == NOTE)
- trial = prev_nonnote_insn (trial);
- if (sets_cc0_p (PATTERN (trial)) != 1
- || FIND_REG_INC_NOTE (trial, 0))
- return;
- if (PREV_INSN (NEXT_INSN (trial)) == trial)
- delete_insn (trial);
- else
- delete_from_delay_slot (trial);
- }
- }
-#endif
-
- delete_insn (insn);
-}
-
-/* Counters for delay-slot filling. */
-
-#define NUM_REORG_FUNCTIONS 2
-#define MAX_DELAY_HISTOGRAM 3
-#define MAX_REORG_PASSES 2
-
-static int num_insns_needing_delays[NUM_REORG_FUNCTIONS][MAX_REORG_PASSES];
-
-static int num_filled_delays[NUM_REORG_FUNCTIONS][MAX_DELAY_HISTOGRAM+1][MAX_REORG_PASSES];
-
-static int reorg_pass_number;
-
-static void
-note_delay_statistics (slots_filled, index)
- int slots_filled, index;
-{
- num_insns_needing_delays[index][reorg_pass_number]++;
- if (slots_filled > MAX_DELAY_HISTOGRAM)
- slots_filled = MAX_DELAY_HISTOGRAM;
- num_filled_delays[index][slots_filled][reorg_pass_number]++;
-}
-
-#if defined(ANNUL_IFFALSE_SLOTS) || defined(ANNUL_IFTRUE_SLOTS)
-
-/* Optimize the following cases:
-
- 1. When a conditional branch skips over only one instruction,
- use an annulling branch and put that insn in the delay slot.
- Use either a branch that annuls when the condition if true or
- invert the test with a branch that annuls when the condition is
- false. This saves insns, since otherwise we must copy an insn
- from the L1 target.
-
- (orig) (skip) (otherwise)
- Bcc.n L1 Bcc',a L1 Bcc,a L1'
- insn insn insn2
- L1: L1: L1:
- insn2 insn2 insn2
- insn3 insn3 L1':
- insn3
-
- 2. When a conditional branch skips over only one instruction,
- and after that, it unconditionally branches somewhere else,
- perform the similar optimization. This saves executing the
- second branch in the case where the inverted condition is true.
-
- Bcc.n L1 Bcc',a L2
- insn insn
- L1: L1:
- Bra L2 Bra L2
-
- INSN is a JUMP_INSN.
-
- This should be expanded to skip over N insns, where N is the number
- of delay slots required. */
-
-static rtx
-optimize_skip (insn)
- register rtx insn;
-{
- register rtx trial = next_nonnote_insn (insn);
- rtx next_trial = next_active_insn (trial);
- rtx delay_list = 0;
- rtx target_label;
- int flags;
-
- flags = get_jump_flags (insn, JUMP_LABEL (insn));
-
- if (trial == 0
- || GET_CODE (trial) != INSN
- || GET_CODE (PATTERN (trial)) == SEQUENCE
- || recog_memoized (trial) < 0
- || (! eligible_for_annul_false (insn, 0, trial, flags)
- && ! eligible_for_annul_true (insn, 0, trial, flags)))
- return 0;
-
- /* There are two cases where we are just executing one insn (we assume
- here that a branch requires only one insn; this should be generalized
- at some point): Where the branch goes around a single insn or where
- we have one insn followed by a branch to the same label we branch to.
- In both of these cases, inverting the jump and annulling the delay
- slot give the same effect in fewer insns. */
- if ((next_trial == next_active_insn (JUMP_LABEL (insn)))
- || (next_trial != 0
- && GET_CODE (next_trial) == JUMP_INSN
- && JUMP_LABEL (insn) == JUMP_LABEL (next_trial)
- && (simplejump_p (next_trial)
- || GET_CODE (PATTERN (next_trial)) == RETURN)))
- {
- if (eligible_for_annul_false (insn, 0, trial, flags))
- {
- if (invert_jump (insn, JUMP_LABEL (insn)))
- INSN_FROM_TARGET_P (trial) = 1;
- else if (! eligible_for_annul_true (insn, 0, trial, flags))
- return 0;
- }
-
- delay_list = add_to_delay_list (trial, NULL_RTX);
- next_trial = next_active_insn (trial);
- update_block (trial, trial);
- delete_insn (trial);
-
- /* Also, if we are targeting an unconditional
- branch, thread our jump to the target of that branch. Don't
- change this into a RETURN here, because it may not accept what
- we have in the delay slot. We'll fix this up later. */
- if (next_trial && GET_CODE (next_trial) == JUMP_INSN
- && (simplejump_p (next_trial)
- || GET_CODE (PATTERN (next_trial)) == RETURN))
- {
- target_label = JUMP_LABEL (next_trial);
- if (target_label == 0)
- target_label = find_end_label ();
-
- /* Recompute the flags based on TARGET_LABEL since threading
- the jump to TARGET_LABEL may change the direction of the
- jump (which may change the circumstances in which the
- delay slot is nullified). */
- flags = get_jump_flags (insn, target_label);
- if (eligible_for_annul_true (insn, 0, trial, flags))
- reorg_redirect_jump (insn, target_label);
- }
-
- INSN_ANNULLED_BRANCH_P (insn) = 1;
- }
-
- return delay_list;
-}
-#endif
-
-
-/* Encode and return branch direction and prediction information for
- INSN assuming it will jump to LABEL.
-
- Non conditional branches return no direction information and
- are predicted as very likely taken. */
-
-static int
-get_jump_flags (insn, label)
- rtx insn, label;
-{
- int flags;
-
- /* get_jump_flags can be passed any insn with delay slots, these may
- be INSNs, CALL_INSNs, or JUMP_INSNs. Only JUMP_INSNs have branch
- direction information, and only if they are conditional jumps.
-
- If LABEL is zero, then there is no way to determine the branch
- direction. */
- if (GET_CODE (insn) == JUMP_INSN
- && (condjump_p (insn) || condjump_in_parallel_p (insn))
- && INSN_UID (insn) <= max_uid
- && label != 0
- && INSN_UID (label) <= max_uid)
- flags
- = (uid_to_ruid[INSN_UID (label)] > uid_to_ruid[INSN_UID (insn)])
- ? ATTR_FLAG_forward : ATTR_FLAG_backward;
- /* No valid direction information. */
- else
- flags = 0;
-
- /* If insn is a conditional branch call mostly_true_jump to get
- determine the branch prediction.
-
- Non conditional branches are predicted as very likely taken. */
- if (GET_CODE (insn) == JUMP_INSN
- && (condjump_p (insn) || condjump_in_parallel_p (insn)))
- {
- int prediction;
-
- prediction = mostly_true_jump (insn, get_branch_condition (insn, label));
- switch (prediction)
- {
- case 2:
- flags |= (ATTR_FLAG_very_likely | ATTR_FLAG_likely);
- break;
- case 1:
- flags |= ATTR_FLAG_likely;
- break;
- case 0:
- flags |= ATTR_FLAG_unlikely;
- break;
- case -1:
- flags |= (ATTR_FLAG_very_unlikely | ATTR_FLAG_unlikely);
- break;
-
- default:
- abort();
- }
- }
- else
- flags |= (ATTR_FLAG_very_likely | ATTR_FLAG_likely);
-
- return flags;
-}
-
-/* Return 1 if INSN is a destination that will be branched to rarely (the
- return point of a function); return 2 if DEST will be branched to very
- rarely (a call to a function that doesn't return). Otherwise,
- return 0. */
-
-static int
-rare_destination (insn)
- rtx insn;
-{
- int jump_count = 0;
- rtx next;
-
- for (; insn; insn = next)
- {
- if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, 0);
-
- next = NEXT_INSN (insn);
-
- switch (GET_CODE (insn))
- {
- case CODE_LABEL:
- return 0;
- case BARRIER:
- /* A BARRIER can either be after a JUMP_INSN or a CALL_INSN. We
- don't scan past JUMP_INSNs, so any barrier we find here must
- have been after a CALL_INSN and hence mean the call doesn't
- return. */
- return 2;
- case JUMP_INSN:
- if (GET_CODE (PATTERN (insn)) == RETURN)
- return 1;
- else if (simplejump_p (insn)
- && jump_count++ < 10)
- next = JUMP_LABEL (insn);
- else
- return 0;
- }
- }
-
- /* If we got here it means we hit the end of the function. So this
- is an unlikely destination. */
-
- return 1;
-}
-
-/* Return truth value of the statement that this branch
- is mostly taken. If we think that the branch is extremely likely
- to be taken, we return 2. If the branch is slightly more likely to be
- taken, return 1. If the branch is slightly less likely to be taken,
- return 0 and if the branch is highly unlikely to be taken, return -1.
-
- CONDITION, if non-zero, is the condition that JUMP_INSN is testing. */
-
-static int
-mostly_true_jump (jump_insn, condition)
- rtx jump_insn, condition;
-{
- rtx target_label = JUMP_LABEL (jump_insn);
- rtx insn;
- int rare_dest = rare_destination (target_label);
- int rare_fallthrough = rare_destination (NEXT_INSN (jump_insn));
-
- /* If branch probabilities are available, then use that number since it
- always gives a correct answer. */
- if (flag_branch_probabilities)
- {
- rtx note = find_reg_note (jump_insn, REG_BR_PROB, 0);;
- if (note)
- {
- int prob = XINT (note, 0);
-
- if (prob >= REG_BR_PROB_BASE * 9 / 10)
- return 2;
- else if (prob >= REG_BR_PROB_BASE / 2)
- return 1;
- else if (prob >= REG_BR_PROB_BASE / 10)
- return 0;
- else
- return -1;
- }
- }
-
- /* If this is a branch outside a loop, it is highly unlikely. */
- if (GET_CODE (PATTERN (jump_insn)) == SET
- && GET_CODE (SET_SRC (PATTERN (jump_insn))) == IF_THEN_ELSE
- && ((GET_CODE (XEXP (SET_SRC (PATTERN (jump_insn)), 1)) == LABEL_REF
- && LABEL_OUTSIDE_LOOP_P (XEXP (SET_SRC (PATTERN (jump_insn)), 1)))
- || (GET_CODE (XEXP (SET_SRC (PATTERN (jump_insn)), 2)) == LABEL_REF
- && LABEL_OUTSIDE_LOOP_P (XEXP (SET_SRC (PATTERN (jump_insn)), 2)))))
- return -1;
-
- if (target_label)
- {
- /* If this is the test of a loop, it is very likely true. We scan
- backwards from the target label. If we find a NOTE_INSN_LOOP_BEG
- before the next real insn, we assume the branch is to the top of
- the loop. */
- for (insn = PREV_INSN (target_label);
- insn && GET_CODE (insn) == NOTE;
- insn = PREV_INSN (insn))
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- return 2;
-
- /* If this is a jump to the test of a loop, it is likely true. We scan
- forwards from the target label. If we find a NOTE_INSN_LOOP_VTOP
- before the next real insn, we assume the branch is to the loop branch
- test. */
- for (insn = NEXT_INSN (target_label);
- insn && GET_CODE (insn) == NOTE;
- insn = PREV_INSN (insn))
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_VTOP)
- return 1;
- }
-
- /* Look at the relative rarities of the fallthrough and destination. If
- they differ, we can predict the branch that way. */
-
- switch (rare_fallthrough - rare_dest)
- {
- case -2:
- return -1;
- case -1:
- return 0;
- case 0:
- break;
- case 1:
- return 1;
- case 2:
- return 2;
- }
-
- /* If we couldn't figure out what this jump was, assume it won't be
- taken. This should be rare. */
- if (condition == 0)
- return 0;
-
- /* EQ tests are usually false and NE tests are usually true. Also,
- most quantities are positive, so we can make the appropriate guesses
- about signed comparisons against zero. */
- switch (GET_CODE (condition))
- {
- case CONST_INT:
- /* Unconditional branch. */
- return 1;
- case EQ:
- return 0;
- case NE:
- return 1;
- case LE:
- case LT:
- if (XEXP (condition, 1) == const0_rtx)
- return 0;
- break;
- case GE:
- case GT:
- if (XEXP (condition, 1) == const0_rtx)
- return 1;
- break;
- }
-
- /* Predict backward branches usually take, forward branches usually not. If
- we don't know whether this is forward or backward, assume the branch
- will be taken, since most are. */
- return (target_label == 0 || INSN_UID (jump_insn) > max_uid
- || INSN_UID (target_label) > max_uid
- || (uid_to_ruid[INSN_UID (jump_insn)]
- > uid_to_ruid[INSN_UID (target_label)]));;
-}
-
-/* Return the condition under which INSN will branch to TARGET. If TARGET
- is zero, return the condition under which INSN will return. If INSN is
- an unconditional branch, return const_true_rtx. If INSN isn't a simple
- type of jump, or it doesn't go to TARGET, return 0. */
-
-static rtx
-get_branch_condition (insn, target)
- rtx insn;
- rtx target;
-{
- rtx pat = PATTERN (insn);
- rtx src;
-
- if (condjump_in_parallel_p (insn))
- pat = XVECEXP (pat, 0, 0);
-
- if (GET_CODE (pat) == RETURN)
- return target == 0 ? const_true_rtx : 0;
-
- else if (GET_CODE (pat) != SET || SET_DEST (pat) != pc_rtx)
- return 0;
-
- src = SET_SRC (pat);
- if (GET_CODE (src) == LABEL_REF && XEXP (src, 0) == target)
- return const_true_rtx;
-
- else if (GET_CODE (src) == IF_THEN_ELSE
- && ((target == 0 && GET_CODE (XEXP (src, 1)) == RETURN)
- || (GET_CODE (XEXP (src, 1)) == LABEL_REF
- && XEXP (XEXP (src, 1), 0) == target))
- && XEXP (src, 2) == pc_rtx)
- return XEXP (src, 0);
-
- else if (GET_CODE (src) == IF_THEN_ELSE
- && ((target == 0 && GET_CODE (XEXP (src, 2)) == RETURN)
- || (GET_CODE (XEXP (src, 2)) == LABEL_REF
- && XEXP (XEXP (src, 2), 0) == target))
- && XEXP (src, 1) == pc_rtx)
- return gen_rtx (reverse_condition (GET_CODE (XEXP (src, 0))),
- GET_MODE (XEXP (src, 0)),
- XEXP (XEXP (src, 0), 0), XEXP (XEXP (src, 0), 1));
-
- return 0;
-}
-
-/* Return non-zero if CONDITION is more strict than the condition of
- INSN, i.e., if INSN will always branch if CONDITION is true. */
-
-static int
-condition_dominates_p (condition, insn)
- rtx condition;
- rtx insn;
-{
- rtx other_condition = get_branch_condition (insn, JUMP_LABEL (insn));
- enum rtx_code code = GET_CODE (condition);
- enum rtx_code other_code;
-
- if (rtx_equal_p (condition, other_condition)
- || other_condition == const_true_rtx)
- return 1;
-
- else if (condition == const_true_rtx || other_condition == 0)
- return 0;
-
- other_code = GET_CODE (other_condition);
- if (GET_RTX_LENGTH (code) != 2 || GET_RTX_LENGTH (other_code) != 2
- || ! rtx_equal_p (XEXP (condition, 0), XEXP (other_condition, 0))
- || ! rtx_equal_p (XEXP (condition, 1), XEXP (other_condition, 1)))
- return 0;
-
- return comparison_dominates_p (code, other_code);
-}
-
-/* Return non-zero if redirecting JUMP to NEWLABEL does not invalidate
- any insns already in the delay slot of JUMP. */
-
-static int
-redirect_with_delay_slots_safe_p (jump, newlabel, seq)
- rtx jump, newlabel, seq;
-{
- int flags, slots, i;
- rtx pat = PATTERN (seq);
-
- /* Make sure all the delay slots of this jump would still
- be valid after threading the jump. If they are still
- valid, then return non-zero. */
-
- flags = get_jump_flags (jump, newlabel);
- for (i = 1; i < XVECLEN (pat, 0); i++)
- if (! (
-#ifdef ANNUL_IFFALSE_SLOTS
- (INSN_ANNULLED_BRANCH_P (jump)
- && INSN_FROM_TARGET_P (XVECEXP (pat, 0, i)))
- ? eligible_for_annul_false (jump, i - 1,
- XVECEXP (pat, 0, i), flags) :
-#endif
-#ifdef ANNUL_IFTRUE_SLOTS
- (INSN_ANNULLED_BRANCH_P (jump)
- && ! INSN_FROM_TARGET_P (XVECEXP (pat, 0, i)))
- ? eligible_for_annul_true (jump, i - 1,
- XVECEXP (pat, 0, i), flags) :
-#endif
- eligible_for_delay (jump, i -1, XVECEXP (pat, 0, i), flags)))
- break;
-
- return (i == XVECLEN (pat, 0));
-}
-
-/* Return non-zero if redirecting JUMP to NEWLABEL does not invalidate
- any insns we wish to place in the delay slot of JUMP. */
-
-static int
-redirect_with_delay_list_safe_p (jump, newlabel, delay_list)
- rtx jump, newlabel, delay_list;
-{
- int flags, i;
- rtx li;
-
- /* Make sure all the insns in DELAY_LIST would still be
- valid after threading the jump. If they are still
- valid, then return non-zero. */
-
- flags = get_jump_flags (jump, newlabel);
- for (li = delay_list, i = 0; li; li = XEXP (li, 1), i++)
- if (! (
-#ifdef ANNUL_IFFALSE_SLOTS
- (INSN_ANNULLED_BRANCH_P (jump)
- && INSN_FROM_TARGET_P (XEXP (li, 0)))
- ? eligible_for_annul_false (jump, i, XEXP (li, 0), flags) :
-#endif
-#ifdef ANNUL_IFTRUE_SLOTS
- (INSN_ANNULLED_BRANCH_P (jump)
- && ! INSN_FROM_TARGET_P (XEXP (li, 0)))
- ? eligible_for_annul_true (jump, i, XEXP (li, 0), flags) :
-#endif
- eligible_for_delay (jump, i, XEXP (li, 0), flags)))
- break;
-
- return (li == NULL);
-}
-
-
-/* INSN branches to an insn whose pattern SEQ is a SEQUENCE. Given that
- the condition tested by INSN is CONDITION and the resources shown in
- OTHER_NEEDED are needed after INSN, see whether INSN can take all the insns
- from SEQ's delay list, in addition to whatever insns it may execute
- (in DELAY_LIST). SETS and NEEDED are denote resources already set and
- needed while searching for delay slot insns. Return the concatenated
- delay list if possible, otherwise, return 0.
-
- SLOTS_TO_FILL is the total number of slots required by INSN, and
- PSLOTS_FILLED points to the number filled so far (also the number of
- insns in DELAY_LIST). It is updated with the number that have been
- filled from the SEQUENCE, if any.
-
- PANNUL_P points to a non-zero value if we already know that we need
- to annul INSN. If this routine determines that annulling is needed,
- it may set that value non-zero.
-
- PNEW_THREAD points to a location that is to receive the place at which
- execution should continue. */
-
-static rtx
-steal_delay_list_from_target (insn, condition, seq, delay_list,
- sets, needed, other_needed,
- slots_to_fill, pslots_filled, pannul_p,
- pnew_thread)
- rtx insn, condition;
- rtx seq;
- rtx delay_list;
- struct resources *sets, *needed, *other_needed;
- int slots_to_fill;
- int *pslots_filled;
- int *pannul_p;
- rtx *pnew_thread;
-{
- rtx temp;
- int slots_remaining = slots_to_fill - *pslots_filled;
- int total_slots_filled = *pslots_filled;
- rtx new_delay_list = 0;
- int must_annul = *pannul_p;
- int i;
-
- /* We can't do anything if there are more delay slots in SEQ than we
- can handle, or if we don't know that it will be a taken branch.
- We know that it will be a taken branch if it is either an unconditional
- branch or a conditional branch with a stricter branch condition.
-
- Also, exit if the branch has more than one set, since then it is computing
- other results that can't be ignored, e.g. the HPPA mov&branch instruction.
- ??? It may be possible to move other sets into INSN in addition to
- moving the instructions in the delay slots. */
-
- if (XVECLEN (seq, 0) - 1 > slots_remaining
- || ! condition_dominates_p (condition, XVECEXP (seq, 0, 0))
- || ! single_set (XVECEXP (seq, 0, 0)))
- return delay_list;
-
- for (i = 1; i < XVECLEN (seq, 0); i++)
- {
- rtx trial = XVECEXP (seq, 0, i);
- int flags;
-
- if (insn_references_resource_p (trial, sets, 0)
- || insn_sets_resource_p (trial, needed, 0)
- || insn_sets_resource_p (trial, sets, 0)
-#ifdef HAVE_cc0
- /* If TRIAL sets CC0, we can't copy it, so we can't steal this
- delay list. */
- || find_reg_note (trial, REG_CC_USER, NULL_RTX)
-#endif
- /* If TRIAL is from the fallthrough code of an annulled branch insn
- in SEQ, we cannot use it. */
- || (INSN_ANNULLED_BRANCH_P (XVECEXP (seq, 0, 0))
- && ! INSN_FROM_TARGET_P (trial)))
- return delay_list;
-
- /* If this insn was already done (usually in a previous delay slot),
- pretend we put it in our delay slot. */
- if (redundant_insn (trial, insn, new_delay_list))
- continue;
-
- /* We will end up re-vectoring this branch, so compute flags
- based on jumping to the new label. */
- flags = get_jump_flags (insn, JUMP_LABEL (XVECEXP (seq, 0, 0)));
-
- if (! must_annul
- && ((condition == const_true_rtx
- || (! insn_sets_resource_p (trial, other_needed, 0)
- && ! may_trap_p (PATTERN (trial)))))
- ? eligible_for_delay (insn, total_slots_filled, trial, flags)
- : (must_annul = 1,
- eligible_for_annul_false (insn, total_slots_filled, trial, flags)))
- {
- temp = copy_rtx (trial);
- INSN_FROM_TARGET_P (temp) = 1;
- new_delay_list = add_to_delay_list (temp, new_delay_list);
- total_slots_filled++;
-
- if (--slots_remaining == 0)
- break;
- }
- else
- return delay_list;
- }
-
- /* Show the place to which we will be branching. */
- *pnew_thread = next_active_insn (JUMP_LABEL (XVECEXP (seq, 0, 0)));
-
- /* Add any new insns to the delay list and update the count of the
- number of slots filled. */
- *pslots_filled = total_slots_filled;
- *pannul_p = must_annul;
-
- if (delay_list == 0)
- return new_delay_list;
-
- for (temp = new_delay_list; temp; temp = XEXP (temp, 1))
- delay_list = add_to_delay_list (XEXP (temp, 0), delay_list);
-
- return delay_list;
-}
-
-/* Similar to steal_delay_list_from_target except that SEQ is on the
- fallthrough path of INSN. Here we only do something if the delay insn
- of SEQ is an unconditional branch. In that case we steal its delay slot
- for INSN since unconditional branches are much easier to fill. */
-
-static rtx
-steal_delay_list_from_fallthrough (insn, condition, seq,
- delay_list, sets, needed, other_needed,
- slots_to_fill, pslots_filled, pannul_p)
- rtx insn, condition;
- rtx seq;
- rtx delay_list;
- struct resources *sets, *needed, *other_needed;
- int slots_to_fill;
- int *pslots_filled;
- int *pannul_p;
-{
- int i;
- int flags;
-
- flags = get_jump_flags (insn, JUMP_LABEL (insn));
-
- /* We can't do anything if SEQ's delay insn isn't an
- unconditional branch. */
-
- if (! simplejump_p (XVECEXP (seq, 0, 0))
- && GET_CODE (PATTERN (XVECEXP (seq, 0, 0))) != RETURN)
- return delay_list;
-
- for (i = 1; i < XVECLEN (seq, 0); i++)
- {
- rtx trial = XVECEXP (seq, 0, i);
-
- /* If TRIAL sets CC0, stealing it will move it too far from the use
- of CC0. */
- if (insn_references_resource_p (trial, sets, 0)
- || insn_sets_resource_p (trial, needed, 0)
- || insn_sets_resource_p (trial, sets, 0)
-#ifdef HAVE_cc0
- || sets_cc0_p (PATTERN (trial))
-#endif
- )
-
- break;
-
- /* If this insn was already done, we don't need it. */
- if (redundant_insn (trial, insn, delay_list))
- {
- delete_from_delay_slot (trial);
- continue;
- }
-
- if (! *pannul_p
- && ((condition == const_true_rtx
- || (! insn_sets_resource_p (trial, other_needed, 0)
- && ! may_trap_p (PATTERN (trial)))))
- ? eligible_for_delay (insn, *pslots_filled, trial, flags)
- : (*pannul_p = 1,
- eligible_for_annul_true (insn, *pslots_filled, trial, flags)))
- {
- delete_from_delay_slot (trial);
- delay_list = add_to_delay_list (trial, delay_list);
-
- if (++(*pslots_filled) == slots_to_fill)
- break;
- }
- else
- break;
- }
-
- return delay_list;
-}
-
-/* Try merging insns starting at THREAD which match exactly the insns in
- INSN's delay list.
-
- If all insns were matched and the insn was previously annulling, the
- annul bit will be cleared.
-
- For each insn that is merged, if the branch is or will be non-annulling,
- we delete the merged insn. */
-
-static void
-try_merge_delay_insns (insn, thread)
- rtx insn, thread;
-{
- rtx trial, next_trial;
- rtx delay_insn = XVECEXP (PATTERN (insn), 0, 0);
- int annul_p = INSN_ANNULLED_BRANCH_P (delay_insn);
- int slot_number = 1;
- int num_slots = XVECLEN (PATTERN (insn), 0);
- rtx next_to_match = XVECEXP (PATTERN (insn), 0, slot_number);
- struct resources set, needed;
- rtx merged_insns = 0;
- int i;
- int flags;
-
- flags = get_jump_flags (delay_insn, JUMP_LABEL (delay_insn));
-
- CLEAR_RESOURCE (&needed);
- CLEAR_RESOURCE (&set);
-
- /* If this is not an annulling branch, take into account anything needed in
- NEXT_TO_MATCH. This prevents two increments from being incorrectly
- folded into one. If we are annulling, this would be the correct
- thing to do. (The alternative, looking at things set in NEXT_TO_MATCH
- will essentially disable this optimization. This method is somewhat of
- a kludge, but I don't see a better way.) */
- if (! annul_p)
- mark_referenced_resources (next_to_match, &needed, 1);
-
- for (trial = thread; !stop_search_p (trial, 1); trial = next_trial)
- {
- rtx pat = PATTERN (trial);
- rtx oldtrial = trial;
-
- next_trial = next_nonnote_insn (trial);
-
- /* TRIAL must be a CALL_INSN or INSN. Skip USE and CLOBBER. */
- if (GET_CODE (trial) == INSN
- && (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER))
- continue;
-
- if (GET_CODE (next_to_match) == GET_CODE (trial)
-#ifdef HAVE_cc0
- /* We can't share an insn that sets cc0. */
- && ! sets_cc0_p (pat)
-#endif
- && ! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
- && (trial = try_split (pat, trial, 0)) != 0
- /* Update next_trial, in case try_split succeeded. */
- && (next_trial = next_nonnote_insn (trial))
- /* Likewise THREAD. */
- && (thread = oldtrial == thread ? trial : thread)
- && rtx_equal_p (PATTERN (next_to_match), PATTERN (trial))
- /* Have to test this condition if annul condition is different
- from (and less restrictive than) non-annulling one. */
- && eligible_for_delay (delay_insn, slot_number - 1, trial, flags))
- {
-
- if (! annul_p)
- {
- update_block (trial, thread);
- if (trial == thread)
- thread = next_active_insn (thread);
-
- delete_insn (trial);
- INSN_FROM_TARGET_P (next_to_match) = 0;
- }
- else
- merged_insns = gen_rtx (INSN_LIST, VOIDmode, trial, merged_insns);
-
- if (++slot_number == num_slots)
- break;
-
- next_to_match = XVECEXP (PATTERN (insn), 0, slot_number);
- if (! annul_p)
- mark_referenced_resources (next_to_match, &needed, 1);
- }
-
- mark_set_resources (trial, &set, 0, 1);
- mark_referenced_resources (trial, &needed, 1);
- }
-
- /* See if we stopped on a filled insn. If we did, try to see if its
- delay slots match. */
- if (slot_number != num_slots
- && trial && GET_CODE (trial) == INSN
- && GET_CODE (PATTERN (trial)) == SEQUENCE
- && ! INSN_ANNULLED_BRANCH_P (XVECEXP (PATTERN (trial), 0, 0)))
- {
- rtx pat = PATTERN (trial);
- rtx filled_insn = XVECEXP (pat, 0, 0);
-
- /* Account for resources set/needed by the filled insn. */
- mark_set_resources (filled_insn, &set, 0, 1);
- mark_referenced_resources (filled_insn, &needed, 1);
-
- for (i = 1; i < XVECLEN (pat, 0); i++)
- {
- rtx dtrial = XVECEXP (pat, 0, i);
-
- if (! insn_references_resource_p (dtrial, &set, 1)
- && ! insn_sets_resource_p (dtrial, &set, 1)
- && ! insn_sets_resource_p (dtrial, &needed, 1)
-#ifdef HAVE_cc0
- && ! sets_cc0_p (PATTERN (dtrial))
-#endif
- && rtx_equal_p (PATTERN (next_to_match), PATTERN (dtrial))
- && eligible_for_delay (delay_insn, slot_number - 1, dtrial, flags))
- {
- if (! annul_p)
- {
- update_block (dtrial, thread);
- delete_from_delay_slot (dtrial);
- INSN_FROM_TARGET_P (next_to_match) = 0;
- }
- else
- merged_insns = gen_rtx (INSN_LIST, SImode, dtrial,
- merged_insns);
-
- if (++slot_number == num_slots)
- break;
-
- next_to_match = XVECEXP (PATTERN (insn), 0, slot_number);
- }
- }
- }
-
- /* If all insns in the delay slot have been matched and we were previously
- annulling the branch, we need not any more. In that case delete all the
- merged insns. Also clear the INSN_FROM_TARGET_P bit of each insn the
- the delay list so that we know that it isn't only being used at the
- target. */
- if (slot_number == num_slots && annul_p)
- {
- for (; merged_insns; merged_insns = XEXP (merged_insns, 1))
- {
- if (GET_MODE (merged_insns) == SImode)
- {
- update_block (XEXP (merged_insns, 0), thread);
- delete_from_delay_slot (XEXP (merged_insns, 0));
- }
- else
- {
- update_block (XEXP (merged_insns, 0), thread);
- delete_insn (XEXP (merged_insns, 0));
- }
- }
-
- INSN_ANNULLED_BRANCH_P (delay_insn) = 0;
-
- for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
- INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)) = 0;
- }
-}
-
-/* See if INSN is redundant with an insn in front of TARGET. Often this
- is called when INSN is a candidate for a delay slot of TARGET.
- DELAY_LIST are insns that will be placed in delay slots of TARGET in front
- of INSN. Often INSN will be redundant with an insn in a delay slot of
- some previous insn. This happens when we have a series of branches to the
- same label; in that case the first insn at the target might want to go
- into each of the delay slots.
-
- If we are not careful, this routine can take up a significant fraction
- of the total compilation time (4%), but only wins rarely. Hence we
- speed this routine up by making two passes. The first pass goes back
- until it hits a label and sees if it find an insn with an identical
- pattern. Only in this (relatively rare) event does it check for
- data conflicts.
-
- We do not split insns we encounter. This could cause us not to find a
- redundant insn, but the cost of splitting seems greater than the possible
- gain in rare cases. */
-
-static rtx
-redundant_insn (insn, target, delay_list)
- rtx insn;
- rtx target;
- rtx delay_list;
-{
- rtx target_main = target;
- rtx ipat = PATTERN (insn);
- rtx trial, pat;
- struct resources needed, set;
- int i;
-
- /* Scan backwards looking for a match. */
- for (trial = PREV_INSN (target); trial; trial = PREV_INSN (trial))
- {
- if (GET_CODE (trial) == CODE_LABEL)
- return 0;
-
- if (GET_RTX_CLASS (GET_CODE (trial)) != 'i')
- continue;
-
- pat = PATTERN (trial);
- if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
- continue;
-
- if (GET_CODE (pat) == SEQUENCE)
- {
- /* Stop for a CALL and its delay slots because it is difficult to
- track its resource needs correctly. */
- if (GET_CODE (XVECEXP (pat, 0, 0)) == CALL_INSN)
- return 0;
-
- /* Stop for an INSN or JUMP_INSN with delayed effects and its delay
- slots because it is difficult to track its resource needs
- correctly. */
-
-#ifdef INSN_SETS_ARE_DELAYED
- if (INSN_SETS_ARE_DELAYED (XVECEXP (pat, 0, 0)))
- return 0;
-#endif
-
-#ifdef INSN_REFERENCES_ARE_DELAYED
- if (INSN_REFERENCES_ARE_DELAYED (XVECEXP (pat, 0, 0)))
- return 0;
-#endif
-
- /* See if any of the insns in the delay slot match, updating
- resource requirements as we go. */
- for (i = XVECLEN (pat, 0) - 1; i > 0; i--)
- if (GET_CODE (XVECEXP (pat, 0, i)) == GET_CODE (insn)
- && rtx_equal_p (PATTERN (XVECEXP (pat, 0, i)), ipat))
- break;
-
- /* If found a match, exit this loop early. */
- if (i > 0)
- break;
- }
-
- else if (GET_CODE (trial) == GET_CODE (insn) && rtx_equal_p (pat, ipat))
- break;
- }
-
- /* If we didn't find an insn that matches, return 0. */
- if (trial == 0)
- return 0;
-
- /* See what resources this insn sets and needs. If they overlap, or
- if this insn references CC0, it can't be redundant. */
-
- CLEAR_RESOURCE (&needed);
- CLEAR_RESOURCE (&set);
- mark_set_resources (insn, &set, 0, 1);
- mark_referenced_resources (insn, &needed, 1);
-
- /* If TARGET is a SEQUENCE, get the main insn. */
- if (GET_CODE (target) == INSN && GET_CODE (PATTERN (target)) == SEQUENCE)
- target_main = XVECEXP (PATTERN (target), 0, 0);
-
- if (resource_conflicts_p (&needed, &set)
-#ifdef HAVE_cc0
- || reg_mentioned_p (cc0_rtx, ipat)
-#endif
- /* The insn requiring the delay may not set anything needed or set by
- INSN. */
- || insn_sets_resource_p (target_main, &needed, 1)
- || insn_sets_resource_p (target_main, &set, 1))
- return 0;
-
- /* Insns we pass may not set either NEEDED or SET, so merge them for
- simpler tests. */
- needed.memory |= set.memory;
- needed.unch_memory |= set.unch_memory;
- IOR_HARD_REG_SET (needed.regs, set.regs);
-
- /* This insn isn't redundant if it conflicts with an insn that either is
- or will be in a delay slot of TARGET. */
-
- while (delay_list)
- {
- if (insn_sets_resource_p (XEXP (delay_list, 0), &needed, 1))
- return 0;
- delay_list = XEXP (delay_list, 1);
- }
-
- if (GET_CODE (target) == INSN && GET_CODE (PATTERN (target)) == SEQUENCE)
- for (i = 1; i < XVECLEN (PATTERN (target), 0); i++)
- if (insn_sets_resource_p (XVECEXP (PATTERN (target), 0, i), &needed, 1))
- return 0;
-
- /* Scan backwards until we reach a label or an insn that uses something
- INSN sets or sets something insn uses or sets. */
-
- for (trial = PREV_INSN (target);
- trial && GET_CODE (trial) != CODE_LABEL;
- trial = PREV_INSN (trial))
- {
- if (GET_CODE (trial) != INSN && GET_CODE (trial) != CALL_INSN
- && GET_CODE (trial) != JUMP_INSN)
- continue;
-
- pat = PATTERN (trial);
- if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
- continue;
-
- if (GET_CODE (pat) == SEQUENCE)
- {
- /* If this is a CALL_INSN and its delay slots, it is hard to track
- the resource needs properly, so give up. */
- if (GET_CODE (XVECEXP (pat, 0, 0)) == CALL_INSN)
- return 0;
-
- /* If this this is an INSN or JUMP_INSN with delayed effects, it
- is hard to track the resource needs properly, so give up. */
-
-#ifdef INSN_SETS_ARE_DELAYED
- if (INSN_SETS_ARE_DELAYED (XVECEXP (pat, 0, 0)))
- return 0;
-#endif
-
-#ifdef INSN_REFERENCES_ARE_DELAYED
- if (INSN_REFERENCES_ARE_DELAYED (XVECEXP (pat, 0, 0)))
- return 0;
-#endif
-
- /* See if any of the insns in the delay slot match, updating
- resource requirements as we go. */
- for (i = XVECLEN (pat, 0) - 1; i > 0; i--)
- {
- rtx candidate = XVECEXP (pat, 0, i);
-
- /* If an insn will be annulled if the branch is false, it isn't
- considered as a possible duplicate insn. */
- if (rtx_equal_p (PATTERN (candidate), ipat)
- && ! (INSN_ANNULLED_BRANCH_P (XVECEXP (pat, 0, 0))
- && INSN_FROM_TARGET_P (candidate)))
- {
- /* Show that this insn will be used in the sequel. */
- INSN_FROM_TARGET_P (candidate) = 0;
- return candidate;
- }
-
- /* Unless this is an annulled insn from the target of a branch,
- we must stop if it sets anything needed or set by INSN. */
- if ((! INSN_ANNULLED_BRANCH_P (XVECEXP (pat, 0, 0))
- || ! INSN_FROM_TARGET_P (candidate))
- && insn_sets_resource_p (candidate, &needed, 1))
- return 0;
- }
-
-
- /* If the insn requiring the delay slot conflicts with INSN, we
- must stop. */
- if (insn_sets_resource_p (XVECEXP (pat, 0, 0), &needed, 1))
- return 0;
- }
- else
- {
- /* See if TRIAL is the same as INSN. */
- pat = PATTERN (trial);
- if (rtx_equal_p (pat, ipat))
- return trial;
-
- /* Can't go any further if TRIAL conflicts with INSN. */
- if (insn_sets_resource_p (trial, &needed, 1))
- return 0;
- }
- }
-
- return 0;
-}
-
-/* Return 1 if THREAD can only be executed in one way. If LABEL is non-zero,
- it is the target of the branch insn being scanned. If ALLOW_FALLTHROUGH
- is non-zero, we are allowed to fall into this thread; otherwise, we are
- not.
-
- If LABEL is used more than one or we pass a label other than LABEL before
- finding an active insn, we do not own this thread. */
-
-static int
-own_thread_p (thread, label, allow_fallthrough)
- rtx thread;
- rtx label;
- int allow_fallthrough;
-{
- rtx active_insn;
- rtx insn;
-
- /* We don't own the function end. */
- if (thread == 0)
- return 0;
-
- /* Get the first active insn, or THREAD, if it is an active insn. */
- active_insn = next_active_insn (PREV_INSN (thread));
-
- for (insn = thread; insn != active_insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == CODE_LABEL
- && (insn != label || LABEL_NUSES (insn) != 1))
- return 0;
-
- if (allow_fallthrough)
- return 1;
-
- /* Ensure that we reach a BARRIER before any insn or label. */
- for (insn = prev_nonnote_insn (thread);
- insn == 0 || GET_CODE (insn) != BARRIER;
- insn = prev_nonnote_insn (insn))
- if (insn == 0
- || GET_CODE (insn) == CODE_LABEL
- || (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) != USE
- && GET_CODE (PATTERN (insn)) != CLOBBER))
- return 0;
-
- return 1;
-}
-
-/* Find the number of the basic block that starts closest to INSN. Return -1
- if we couldn't find such a basic block. */
-
-static int
-find_basic_block (insn)
- rtx insn;
-{
- int i;
-
- /* Scan backwards to the previous BARRIER. Then see if we can find a
- label that starts a basic block. Return the basic block number. */
-
- for (insn = prev_nonnote_insn (insn);
- insn && GET_CODE (insn) != BARRIER;
- insn = prev_nonnote_insn (insn))
- ;
-
- /* The start of the function is basic block zero. */
- if (insn == 0)
- return 0;
-
- /* See if any of the upcoming CODE_LABELs start a basic block. If we reach
- anything other than a CODE_LABEL or note, we can't find this code. */
- for (insn = next_nonnote_insn (insn);
- insn && GET_CODE (insn) == CODE_LABEL;
- insn = next_nonnote_insn (insn))
- {
- for (i = 0; i < n_basic_blocks; i++)
- if (insn == basic_block_head[i])
- return i;
- }
-
- return -1;
-}
-
-/* Called when INSN is being moved from a location near the target of a jump.
- We leave a marker of the form (use (INSN)) immediately in front
- of WHERE for mark_target_live_regs. These markers will be deleted when
- reorg finishes.
-
- We used to try to update the live status of registers if WHERE is at
- the start of a basic block, but that can't work since we may remove a
- BARRIER in relax_delay_slots. */
-
-static void
-update_block (insn, where)
- rtx insn;
- rtx where;
-{
- int b;
-
- /* Ignore if this was in a delay slot and it came from the target of
- a branch. */
- if (INSN_FROM_TARGET_P (insn))
- return;
-
- emit_insn_before (gen_rtx (USE, VOIDmode, insn), where);
-
- /* INSN might be making a value live in a block where it didn't use to
- be. So recompute liveness information for this block. */
-
- b = find_basic_block (insn);
- if (b != -1)
- bb_ticks[b]++;
-}
-
-/* Similar to REDIRECT_JUMP except that we update the BB_TICKS entry for
- the basic block containing the jump. */
-
-static int
-reorg_redirect_jump (jump, nlabel)
- rtx jump;
- rtx nlabel;
-{
- int b = find_basic_block (jump);
-
- if (b != -1)
- bb_ticks[b]++;
-
- return redirect_jump (jump, nlabel);
-}
-
-/* Called when INSN is being moved forward into a delay slot of DELAYED_INSN.
- We check every instruction between INSN and DELAYED_INSN for REG_DEAD notes
- that reference values used in INSN. If we find one, then we move the
- REG_DEAD note to INSN.
-
- This is needed to handle the case where an later insn (after INSN) has a
- REG_DEAD note for a register used by INSN, and this later insn subsequently
- gets moved before a CODE_LABEL because it is a redundant insn. In this
- case, mark_target_live_regs may be confused into thinking the register
- is dead because it sees a REG_DEAD note immediately before a CODE_LABEL. */
-
-static void
-update_reg_dead_notes (insn, delayed_insn)
- rtx insn, delayed_insn;
-{
- rtx p, link, next;
-
- for (p = next_nonnote_insn (insn); p != delayed_insn;
- p = next_nonnote_insn (p))
- for (link = REG_NOTES (p); link; link = next)
- {
- next = XEXP (link, 1);
-
- if (REG_NOTE_KIND (link) != REG_DEAD
- || GET_CODE (XEXP (link, 0)) != REG)
- continue;
-
- if (reg_referenced_p (XEXP (link, 0), PATTERN (insn)))
- {
- /* Move the REG_DEAD note from P to INSN. */
- remove_note (p, link);
- XEXP (link, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = link;
- }
- }
-}
-
-/* Called when an insn redundant with start_insn is deleted. If there
- is a REG_DEAD note for the target of start_insn between start_insn
- and stop_insn, then the REG_DEAD note needs to be deleted since the
- value no longer dies there.
-
- If the REG_DEAD note isn't deleted, then mark_target_live_regs may be
- confused into thinking the register is dead. */
-
-static void
-fix_reg_dead_note (start_insn, stop_insn)
- rtx start_insn, stop_insn;
-{
- rtx p, link, next;
-
- for (p = next_nonnote_insn (start_insn); p != stop_insn;
- p = next_nonnote_insn (p))
- for (link = REG_NOTES (p); link; link = next)
- {
- next = XEXP (link, 1);
-
- if (REG_NOTE_KIND (link) != REG_DEAD
- || GET_CODE (XEXP (link, 0)) != REG)
- continue;
-
- if (reg_set_p (XEXP (link, 0), PATTERN (start_insn)))
- {
- remove_note (p, link);
- return;
- }
- }
-}
-
-/* Delete any REG_UNUSED notes that exist on INSN but not on REDUNDANT_INSN.
-
- This handles the case of udivmodXi4 instructions which optimize their
- output depending on whether any REG_UNUSED notes are present.
- we must make sure that INSN calculates as many results as REDUNDANT_INSN
- does. */
-
-static void
-update_reg_unused_notes (insn, redundant_insn)
- rtx insn, redundant_insn;
-{
- rtx p, link, next;
-
- for (link = REG_NOTES (insn); link; link = next)
- {
- next = XEXP (link, 1);
-
- if (REG_NOTE_KIND (link) != REG_UNUSED
- || GET_CODE (XEXP (link, 0)) != REG)
- continue;
-
- if (! find_regno_note (redundant_insn, REG_UNUSED,
- REGNO (XEXP (link, 0))))
- remove_note (insn, link);
- }
-}
-
-/* Marks registers possibly live at the current place being scanned by
- mark_target_live_regs. Used only by next two function. */
-
-static HARD_REG_SET current_live_regs;
-
-/* Marks registers for which we have seen a REG_DEAD note but no assignment.
- Also only used by the next two functions. */
-
-static HARD_REG_SET pending_dead_regs;
-
-/* Utility function called from mark_target_live_regs via note_stores.
- It deadens any CLOBBERed registers and livens any SET registers. */
-
-static void
-update_live_status (dest, x)
- rtx dest;
- rtx x;
-{
- int first_regno, last_regno;
- int i;
-
- if (GET_CODE (dest) != REG
- && (GET_CODE (dest) != SUBREG || GET_CODE (SUBREG_REG (dest)) != REG))
- return;
-
- if (GET_CODE (dest) == SUBREG)
- first_regno = REGNO (SUBREG_REG (dest)) + SUBREG_WORD (dest);
- else
- first_regno = REGNO (dest);
-
- last_regno = first_regno + HARD_REGNO_NREGS (first_regno, GET_MODE (dest));
-
- if (GET_CODE (x) == CLOBBER)
- for (i = first_regno; i < last_regno; i++)
- CLEAR_HARD_REG_BIT (current_live_regs, i);
- else
- for (i = first_regno; i < last_regno; i++)
- {
- SET_HARD_REG_BIT (current_live_regs, i);
- CLEAR_HARD_REG_BIT (pending_dead_regs, i);
- }
-}
-
-/* Similar to next_insn, but ignores insns in the delay slots of
- an annulled branch. */
-
-static rtx
-next_insn_no_annul (insn)
- rtx insn;
-{
- if (insn)
- {
- /* If INSN is an annulled branch, skip any insns from the target
- of the branch. */
- if (INSN_ANNULLED_BRANCH_P (insn)
- && NEXT_INSN (PREV_INSN (insn)) != insn)
- while (INSN_FROM_TARGET_P (NEXT_INSN (insn)))
- insn = NEXT_INSN (insn);
-
- insn = NEXT_INSN (insn);
- if (insn && GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, 0);
- }
-
- return insn;
-}
-
-/* A subroutine of mark_target_live_regs. Search forward from TARGET
- looking for registers that are set before they are used. These are dead.
- Stop after passing a few conditional jumps, and/or a small
- number of unconditional branches. */
-
-static rtx
-find_dead_or_set_registers (target, res, jump_target, jump_count, set, needed)
- rtx target;
- struct resources *res;
- rtx *jump_target;
- int jump_count;
- struct resources set, needed;
-{
- HARD_REG_SET scratch;
- rtx insn, next;
- rtx jump_insn = 0;
- int i;
-
- for (insn = target; insn; insn = next)
- {
- rtx this_jump_insn = insn;
-
- next = NEXT_INSN (insn);
- switch (GET_CODE (insn))
- {
- case CODE_LABEL:
- /* After a label, any pending dead registers that weren't yet
- used can be made dead. */
- AND_COMPL_HARD_REG_SET (pending_dead_regs, needed.regs);
- AND_COMPL_HARD_REG_SET (res->regs, pending_dead_regs);
- CLEAR_HARD_REG_SET (pending_dead_regs);
-
- if (CODE_LABEL_NUMBER (insn) < max_label_num_after_reload)
- {
- /* All spill registers are dead at a label, so kill all of the
- ones that aren't needed also. */
- COPY_HARD_REG_SET (scratch, used_spill_regs);
- AND_COMPL_HARD_REG_SET (scratch, needed.regs);
- AND_COMPL_HARD_REG_SET (res->regs, scratch);
- }
- continue;
-
- case BARRIER:
- case NOTE:
- continue;
-
- case INSN:
- if (GET_CODE (PATTERN (insn)) == USE)
- {
- /* If INSN is a USE made by update_block, we care about the
- underlying insn. Any registers set by the underlying insn
- are live since the insn is being done somewhere else. */
- if (GET_RTX_CLASS (GET_CODE (XEXP (PATTERN (insn), 0))) == 'i')
- mark_set_resources (XEXP (PATTERN (insn), 0), res, 0, 1);
-
- /* All other USE insns are to be ignored. */
- continue;
- }
- else if (GET_CODE (PATTERN (insn)) == CLOBBER)
- continue;
- else if (GET_CODE (PATTERN (insn)) == SEQUENCE)
- {
- /* An unconditional jump can be used to fill the delay slot
- of a call, so search for a JUMP_INSN in any position. */
- for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
- {
- this_jump_insn = XVECEXP (PATTERN (insn), 0, i);
- if (GET_CODE (this_jump_insn) == JUMP_INSN)
- break;
- }
- }
- }
-
- if (GET_CODE (this_jump_insn) == JUMP_INSN)
- {
- if (jump_count++ < 10)
- {
- if (simplejump_p (this_jump_insn)
- || GET_CODE (PATTERN (this_jump_insn)) == RETURN)
- {
- next = JUMP_LABEL (this_jump_insn);
- if (jump_insn == 0)
- {
- jump_insn = insn;
- if (jump_target)
- *jump_target = JUMP_LABEL (this_jump_insn);
- }
- }
- else if (condjump_p (this_jump_insn)
- || condjump_in_parallel_p (this_jump_insn))
- {
- struct resources target_set, target_res;
- struct resources fallthrough_res;
-
- /* We can handle conditional branches here by following
- both paths, and then IOR the results of the two paths
- together, which will give us registers that are dead
- on both paths. Since this is expensive, we give it
- a much higher cost than unconditional branches. The
- cost was chosen so that we will follow at most 1
- conditional branch. */
-
- jump_count += 4;
- if (jump_count >= 10)
- break;
-
- mark_referenced_resources (insn, &needed, 1);
-
- /* For an annulled branch, mark_set_resources ignores slots
- filled by instructions from the target. This is correct
- if the branch is not taken. Since we are following both
- paths from the branch, we must also compute correct info
- if the branch is taken. We do this by inverting all of
- the INSN_FROM_TARGET_P bits, calling mark_set_resources,
- and then inverting the INSN_FROM_TARGET_P bits again. */
-
- if (GET_CODE (PATTERN (insn)) == SEQUENCE
- && INSN_ANNULLED_BRANCH_P (this_jump_insn))
- {
- for (i = 1; i < XVECLEN (PATTERN (insn), 0); i++)
- INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i))
- = ! INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i));
-
- target_set = set;
- mark_set_resources (insn, &target_set, 0, 1);
-
- for (i = 1; i < XVECLEN (PATTERN (insn), 0); i++)
- INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i))
- = ! INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i));
-
- mark_set_resources (insn, &set, 0, 1);
- }
- else
- {
- mark_set_resources (insn, &set, 0, 1);
- target_set = set;
- }
-
- target_res = *res;
- COPY_HARD_REG_SET (scratch, target_set.regs);
- AND_COMPL_HARD_REG_SET (scratch, needed.regs);
- AND_COMPL_HARD_REG_SET (target_res.regs, scratch);
-
- fallthrough_res = *res;
- COPY_HARD_REG_SET (scratch, set.regs);
- AND_COMPL_HARD_REG_SET (scratch, needed.regs);
- AND_COMPL_HARD_REG_SET (fallthrough_res.regs, scratch);
-
- find_dead_or_set_registers (JUMP_LABEL (this_jump_insn),
- &target_res, 0, jump_count,
- target_set, needed);
- find_dead_or_set_registers (next,
- &fallthrough_res, 0, jump_count,
- set, needed);
- IOR_HARD_REG_SET (fallthrough_res.regs, target_res.regs);
- AND_HARD_REG_SET (res->regs, fallthrough_res.regs);
- break;
- }
- else
- break;
- }
- else
- {
- /* Don't try this optimization if we expired our jump count
- above, since that would mean there may be an infinite loop
- in the function being compiled. */
- jump_insn = 0;
- break;
- }
- }
-
- mark_referenced_resources (insn, &needed, 1);
- mark_set_resources (insn, &set, 0, 1);
-
- COPY_HARD_REG_SET (scratch, set.regs);
- AND_COMPL_HARD_REG_SET (scratch, needed.regs);
- AND_COMPL_HARD_REG_SET (res->regs, scratch);
- }
-
- return jump_insn;
-}
-
-/* Set the resources that are live at TARGET.
-
- If TARGET is zero, we refer to the end of the current function and can
- return our precomputed value.
-
- Otherwise, we try to find out what is live by consulting the basic block
- information. This is tricky, because we must consider the actions of
- reload and jump optimization, which occur after the basic block information
- has been computed.
-
- Accordingly, we proceed as follows::
-
- We find the previous BARRIER and look at all immediately following labels
- (with no intervening active insns) to see if any of them start a basic
- block. If we hit the start of the function first, we use block 0.
-
- Once we have found a basic block and a corresponding first insns, we can
- accurately compute the live status from basic_block_live_regs and
- reg_renumber. (By starting at a label following a BARRIER, we are immune
- to actions taken by reload and jump.) Then we scan all insns between
- that point and our target. For each CLOBBER (or for call-clobbered regs
- when we pass a CALL_INSN), mark the appropriate registers are dead. For
- a SET, mark them as live.
-
- We have to be careful when using REG_DEAD notes because they are not
- updated by such things as find_equiv_reg. So keep track of registers
- marked as dead that haven't been assigned to, and mark them dead at the
- next CODE_LABEL since reload and jump won't propagate values across labels.
-
- If we cannot find the start of a basic block (should be a very rare
- case, if it can happen at all), mark everything as potentially live.
-
- Next, scan forward from TARGET looking for things set or clobbered
- before they are used. These are not live.
-
- Because we can be called many times on the same target, save our results
- in a hash table indexed by INSN_UID. */
-
-static void
-mark_target_live_regs (target, res)
- rtx target;
- struct resources *res;
-{
- int b = -1;
- int i;
- struct target_info *tinfo;
- rtx insn, next;
- rtx jump_insn = 0;
- rtx jump_target;
- HARD_REG_SET scratch;
- struct resources set, needed;
- int jump_count = 0;
-
- /* Handle end of function. */
- if (target == 0)
- {
- *res = end_of_function_needs;
- return;
- }
-
- /* We have to assume memory is needed, but the CC isn't. */
- res->memory = 1;
- res->volatil = res->unch_memory = 0;
- res->cc = 0;
-
- /* See if we have computed this value already. */
- for (tinfo = target_hash_table[INSN_UID (target) % TARGET_HASH_PRIME];
- tinfo; tinfo = tinfo->next)
- if (tinfo->uid == INSN_UID (target))
- break;
-
- /* Start by getting the basic block number. If we have saved information,
- we can get it from there unless the insn at the start of the basic block
- has been deleted. */
- if (tinfo && tinfo->block != -1
- && ! INSN_DELETED_P (basic_block_head[tinfo->block]))
- b = tinfo->block;
-
- if (b == -1)
- b = find_basic_block (target);
-
- if (tinfo)
- {
- /* If the information is up-to-date, use it. Otherwise, we will
- update it below. */
- if (b == tinfo->block && b != -1 && tinfo->bb_tick == bb_ticks[b])
- {
- COPY_HARD_REG_SET (res->regs, tinfo->live_regs);
- return;
- }
- }
- else
- {
- /* Allocate a place to put our results and chain it into the
- hash table. */
- tinfo = (struct target_info *) oballoc (sizeof (struct target_info));
- tinfo->uid = INSN_UID (target);
- tinfo->block = b;
- tinfo->next = target_hash_table[INSN_UID (target) % TARGET_HASH_PRIME];
- target_hash_table[INSN_UID (target) % TARGET_HASH_PRIME] = tinfo;
- }
-
- CLEAR_HARD_REG_SET (pending_dead_regs);
-
- /* If we found a basic block, get the live registers from it and update
- them with anything set or killed between its start and the insn before
- TARGET. Otherwise, we must assume everything is live. */
- if (b != -1)
- {
- regset regs_live = basic_block_live_at_start[b];
- int offset, j;
- REGSET_ELT_TYPE bit;
- int regno;
- rtx start_insn, stop_insn;
-
- /* Compute hard regs live at start of block -- this is the real hard regs
- marked live, plus live pseudo regs that have been renumbered to
- hard regs. */
-
-#ifdef HARD_REG_SET
- current_live_regs = *regs_live;
-#else
- COPY_HARD_REG_SET (current_live_regs, regs_live);
-#endif
-
- for (offset = 0, i = 0; offset < regset_size; offset++)
- {
- if (regs_live[offset] == 0)
- i += REGSET_ELT_BITS;
- else
- for (bit = 1; bit && i < max_regno; bit <<= 1, i++)
- if ((regs_live[offset] & bit)
- && (regno = reg_renumber[i]) >= 0)
- for (j = regno;
- j < regno + HARD_REGNO_NREGS (regno,
- PSEUDO_REGNO_MODE (i));
- j++)
- SET_HARD_REG_BIT (current_live_regs, j);
- }
-
- /* Get starting and ending insn, handling the case where each might
- be a SEQUENCE. */
- start_insn = (b == 0 ? get_insns () : basic_block_head[b]);
- stop_insn = target;
-
- if (GET_CODE (start_insn) == INSN
- && GET_CODE (PATTERN (start_insn)) == SEQUENCE)
- start_insn = XVECEXP (PATTERN (start_insn), 0, 0);
-
- if (GET_CODE (stop_insn) == INSN
- && GET_CODE (PATTERN (stop_insn)) == SEQUENCE)
- stop_insn = next_insn (PREV_INSN (stop_insn));
-
- for (insn = start_insn; insn != stop_insn;
- insn = next_insn_no_annul (insn))
- {
- rtx link;
- rtx real_insn = insn;
-
- /* If this insn is from the target of a branch, it isn't going to
- be used in the sequel. If it is used in both cases, this
- test will not be true. */
- if (INSN_FROM_TARGET_P (insn))
- continue;
-
- /* If this insn is a USE made by update_block, we care about the
- underlying insn. */
- if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == USE
- && GET_RTX_CLASS (GET_CODE (XEXP (PATTERN (insn), 0))) == 'i')
- real_insn = XEXP (PATTERN (insn), 0);
-
- if (GET_CODE (real_insn) == CALL_INSN)
- {
- /* CALL clobbers all call-used regs that aren't fixed except
- sp, ap, and fp. Do this before setting the result of the
- call live. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i]
- && i != STACK_POINTER_REGNUM && i != FRAME_POINTER_REGNUM
- && i != ARG_POINTER_REGNUM
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && i != HARD_FRAME_POINTER_REGNUM
-#endif
-#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && ! (i == ARG_POINTER_REGNUM && fixed_regs[i])
-#endif
-#ifdef PIC_OFFSET_TABLE_REGNUM
- && ! (i == PIC_OFFSET_TABLE_REGNUM && flag_pic)
-#endif
- )
- CLEAR_HARD_REG_BIT (current_live_regs, i);
-
- /* A CALL_INSN sets any global register live, since it may
- have been modified by the call. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i])
- SET_HARD_REG_BIT (current_live_regs, i);
- }
-
- /* Mark anything killed in an insn to be deadened at the next
- label. Ignore USE insns; the only REG_DEAD notes will be for
- parameters. But they might be early. A CALL_INSN will usually
- clobber registers used for parameters. It isn't worth bothering
- with the unlikely case when it won't. */
- if ((GET_CODE (real_insn) == INSN
- && GET_CODE (PATTERN (real_insn)) != USE
- && GET_CODE (PATTERN (real_insn)) != CLOBBER)
- || GET_CODE (real_insn) == JUMP_INSN
- || GET_CODE (real_insn) == CALL_INSN)
- {
- for (link = REG_NOTES (real_insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_DEAD
- && GET_CODE (XEXP (link, 0)) == REG
- && REGNO (XEXP (link, 0)) < FIRST_PSEUDO_REGISTER)
- {
- int first_regno = REGNO (XEXP (link, 0));
- int last_regno
- = (first_regno
- + HARD_REGNO_NREGS (first_regno,
- GET_MODE (XEXP (link, 0))));
-
- for (i = first_regno; i < last_regno; i++)
- SET_HARD_REG_BIT (pending_dead_regs, i);
- }
-
- note_stores (PATTERN (real_insn), update_live_status);
-
- /* If any registers were unused after this insn, kill them.
- These notes will always be accurate. */
- for (link = REG_NOTES (real_insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == REG_UNUSED
- && GET_CODE (XEXP (link, 0)) == REG
- && REGNO (XEXP (link, 0)) < FIRST_PSEUDO_REGISTER)
- {
- int first_regno = REGNO (XEXP (link, 0));
- int last_regno
- = (first_regno
- + HARD_REGNO_NREGS (first_regno,
- GET_MODE (XEXP (link, 0))));
-
- for (i = first_regno; i < last_regno; i++)
- CLEAR_HARD_REG_BIT (current_live_regs, i);
- }
- }
-
- else if (GET_CODE (real_insn) == CODE_LABEL)
- {
- /* A label clobbers the pending dead registers since neither
- reload nor jump will propagate a value across a label. */
- AND_COMPL_HARD_REG_SET (current_live_regs, pending_dead_regs);
- CLEAR_HARD_REG_SET (pending_dead_regs);
- }
-
- /* The beginning of the epilogue corresponds to the end of the
- RTL chain when there are no epilogue insns. Certain resources
- are implicitly required at that point. */
- else if (GET_CODE (real_insn) == NOTE
- && NOTE_LINE_NUMBER (real_insn) == NOTE_INSN_EPILOGUE_BEG)
- IOR_HARD_REG_SET (current_live_regs, start_of_epilogue_needs.regs);
- }
-
- COPY_HARD_REG_SET (res->regs, current_live_regs);
- tinfo->block = b;
- tinfo->bb_tick = bb_ticks[b];
- }
- else
- /* We didn't find the start of a basic block. Assume everything
- in use. This should happen only extremely rarely. */
- SET_HARD_REG_SET (res->regs);
-
- CLEAR_RESOURCE (&set);
- CLEAR_RESOURCE (&needed);
-
- jump_insn = find_dead_or_set_registers (target, res, &jump_target, 0,
- set, needed);
-
- /* If we hit an unconditional branch, we have another way of finding out
- what is live: we can see what is live at the branch target and include
- anything used but not set before the branch. The only things that are
- live are those that are live using the above test and the test below. */
-
- if (jump_insn)
- {
- struct resources new_resources;
- rtx stop_insn = next_active_insn (jump_insn);
-
- mark_target_live_regs (next_active_insn (jump_target), &new_resources);
- CLEAR_RESOURCE (&set);
- CLEAR_RESOURCE (&needed);
-
- /* Include JUMP_INSN in the needed registers. */
- for (insn = target; insn != stop_insn; insn = next_active_insn (insn))
- {
- mark_referenced_resources (insn, &needed, 1);
-
- COPY_HARD_REG_SET (scratch, needed.regs);
- AND_COMPL_HARD_REG_SET (scratch, set.regs);
- IOR_HARD_REG_SET (new_resources.regs, scratch);
-
- mark_set_resources (insn, &set, 0, 1);
- }
-
- AND_HARD_REG_SET (res->regs, new_resources.regs);
- }
-
- COPY_HARD_REG_SET (tinfo->live_regs, res->regs);
-}
-
-/* Scan a function looking for insns that need a delay slot and find insns to
- put into the delay slot.
-
- NON_JUMPS_P is non-zero if we are to only try to fill non-jump insns (such
- as calls). We do these first since we don't want jump insns (that are
- easier to fill) to get the only insns that could be used for non-jump insns.
- When it is zero, only try to fill JUMP_INSNs.
-
- When slots are filled in this manner, the insns (including the
- delay_insn) are put together in a SEQUENCE rtx. In this fashion,
- it is possible to tell whether a delay slot has really been filled
- or not. `final' knows how to deal with this, by communicating
- through FINAL_SEQUENCE. */
-
-static void
-fill_simple_delay_slots (first, non_jumps_p)
- rtx first;
- int non_jumps_p;
-{
- register rtx insn, pat, trial, next_trial;
- register int i, j;
- int num_unfilled_slots = unfilled_slots_next - unfilled_slots_base;
- struct resources needed, set;
- int slots_to_fill, slots_filled;
- rtx delay_list;
-
- for (i = 0; i < num_unfilled_slots; i++)
- {
- int flags;
- /* Get the next insn to fill. If it has already had any slots assigned,
- we can't do anything with it. Maybe we'll improve this later. */
-
- insn = unfilled_slots_base[i];
- if (insn == 0
- || INSN_DELETED_P (insn)
- || (GET_CODE (insn) == INSN
- && GET_CODE (PATTERN (insn)) == SEQUENCE)
- || (GET_CODE (insn) == JUMP_INSN && non_jumps_p)
- || (GET_CODE (insn) != JUMP_INSN && ! non_jumps_p))
- continue;
-
- if (GET_CODE (insn) == JUMP_INSN)
- flags = get_jump_flags (insn, JUMP_LABEL (insn));
- else
- flags = get_jump_flags (insn, NULL_RTX);
- slots_to_fill = num_delay_slots (insn);
- if (slots_to_fill == 0)
- abort ();
-
- /* This insn needs, or can use, some delay slots. SLOTS_TO_FILL
- says how many. After initialization, first try optimizing
-
- call _foo call _foo
- nop add %o7,.-L1,%o7
- b,a L1
- nop
-
- If this case applies, the delay slot of the call is filled with
- the unconditional jump. This is done first to avoid having the
- delay slot of the call filled in the backward scan. Also, since
- the unconditional jump is likely to also have a delay slot, that
- insn must exist when it is subsequently scanned.
-
- This is tried on each insn with delay slots as some machines
- have insns which perform calls, but are not represented as
- CALL_INSNs. */
-
- slots_filled = 0;
- delay_list = 0;
-
- if ((trial = next_active_insn (insn))
- && GET_CODE (trial) == JUMP_INSN
- && simplejump_p (trial)
- && eligible_for_delay (insn, slots_filled, trial, flags)
- && no_labels_between_p (insn, trial))
- {
- rtx *tmp;
- slots_filled++;
- delay_list = add_to_delay_list (trial, delay_list);
-
- /* TRIAL may have had its delay slot filled, then unfilled. When
- the delay slot is unfilled, TRIAL is placed back on the unfilled
- slots obstack. Unfortunately, it is placed on the end of the
- obstack, not in its original location. Therefore, we must search
- from entry i + 1 to the end of the unfilled slots obstack to
- try and find TRIAL. */
- tmp = &unfilled_slots_base[i + 1];
- while (*tmp != trial && tmp != unfilled_slots_next)
- tmp++;
-
- /* Remove the unconditional jump from consideration for delay slot
- filling and unthread it. */
- if (*tmp == trial)
- *tmp = 0;
- {
- rtx next = NEXT_INSN (trial);
- rtx prev = PREV_INSN (trial);
- if (prev)
- NEXT_INSN (prev) = next;
- if (next)
- PREV_INSN (next) = prev;
- }
- }
-
- /* Now, scan backwards from the insn to search for a potential
- delay-slot candidate. Stop searching when a label or jump is hit.
-
- For each candidate, if it is to go into the delay slot (moved
- forward in execution sequence), it must not need or set any resources
- that were set by later insns and must not set any resources that
- are needed for those insns.
-
- The delay slot insn itself sets resources unless it is a call
- (in which case the called routine, not the insn itself, is doing
- the setting). */
-
- if (slots_filled < slots_to_fill)
- {
- CLEAR_RESOURCE (&needed);
- CLEAR_RESOURCE (&set);
- mark_set_resources (insn, &set, 0, 0);
- mark_referenced_resources (insn, &needed, 0);
-
- for (trial = prev_nonnote_insn (insn); ! stop_search_p (trial, 1);
- trial = next_trial)
- {
- next_trial = prev_nonnote_insn (trial);
-
- /* This must be an INSN or CALL_INSN. */
- pat = PATTERN (trial);
-
- /* USE and CLOBBER at this level was just for flow; ignore it. */
- if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
- continue;
-
- /* Check for resource conflict first, to avoid unnecessary
- splitting. */
- if (! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
-#ifdef HAVE_cc0
- /* Can't separate set of cc0 from its use. */
- && ! (reg_mentioned_p (cc0_rtx, pat)
- && ! sets_cc0_p (cc0_rtx, pat))
-#endif
- )
- {
- trial = try_split (pat, trial, 1);
- next_trial = prev_nonnote_insn (trial);
- if (eligible_for_delay (insn, slots_filled, trial, flags))
- {
- /* In this case, we are searching backward, so if we
- find insns to put on the delay list, we want
- to put them at the head, rather than the
- tail, of the list. */
-
- update_reg_dead_notes (trial, insn);
- delay_list = gen_rtx (INSN_LIST, VOIDmode,
- trial, delay_list);
- update_block (trial, trial);
- delete_insn (trial);
- if (slots_to_fill == ++slots_filled)
- break;
- continue;
- }
- }
-
- mark_set_resources (trial, &set, 0, 1);
- mark_referenced_resources (trial, &needed, 1);
- }
- }
-
- /* If all needed slots haven't been filled, we come here. */
-
- /* Try to optimize case of jumping around a single insn. */
-#if defined(ANNUL_IFFALSE_SLOTS) || defined(ANNUL_IFTRUE_SLOTS)
- if (slots_filled != slots_to_fill
- && delay_list == 0
- && GET_CODE (insn) == JUMP_INSN
- && (condjump_p (insn) || condjump_in_parallel_p (insn)))
- {
- delay_list = optimize_skip (insn);
- if (delay_list)
- slots_filled += 1;
- }
-#endif
-
- /* Try to get insns from beyond the insn needing the delay slot.
- These insns can neither set or reference resources set in insns being
- skipped, cannot set resources in the insn being skipped, and, if this
- is a CALL_INSN (or a CALL_INSN is passed), cannot trap (because the
- call might not return).
-
- There used to be code which continued past the target label if
- we saw all uses of the target label. This code did not work,
- because it failed to account for some instructions which were
- both annulled and marked as from the target. This can happen as a
- result of optimize_skip. Since this code was redundant with
- fill_eager_delay_slots anyways, it was just deleted. */
-
- if (slots_filled != slots_to_fill
- && (GET_CODE (insn) != JUMP_INSN
- || ((condjump_p (insn) || condjump_in_parallel_p (insn))
- && ! simplejump_p (insn)
- && JUMP_LABEL (insn) != 0)))
- {
- rtx target = 0;
- int maybe_never = 0;
- struct resources needed_at_jump;
-
- CLEAR_RESOURCE (&needed);
- CLEAR_RESOURCE (&set);
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- mark_set_resources (insn, &set, 0, 1);
- mark_referenced_resources (insn, &needed, 1);
- maybe_never = 1;
- }
- else
- {
- mark_set_resources (insn, &set, 0, 1);
- mark_referenced_resources (insn, &needed, 1);
- if (GET_CODE (insn) == JUMP_INSN)
- target = JUMP_LABEL (insn);
- }
-
- for (trial = next_nonnote_insn (insn); trial; trial = next_trial)
- {
- rtx pat, trial_delay;
-
- next_trial = next_nonnote_insn (trial);
-
- if (GET_CODE (trial) == CODE_LABEL
- || GET_CODE (trial) == BARRIER)
- break;
-
- /* We must have an INSN, JUMP_INSN, or CALL_INSN. */
- pat = PATTERN (trial);
-
- /* Stand-alone USE and CLOBBER are just for flow. */
- if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
- continue;
-
- /* If this already has filled delay slots, get the insn needing
- the delay slots. */
- if (GET_CODE (pat) == SEQUENCE)
- trial_delay = XVECEXP (pat, 0, 0);
- else
- trial_delay = trial;
-
- /* If this is a jump insn to our target, indicate that we have
- seen another jump to it. If we aren't handling a conditional
- jump, stop our search. Otherwise, compute the needs at its
- target and add them to NEEDED. */
- if (GET_CODE (trial_delay) == JUMP_INSN)
- {
- if (target == 0)
- break;
- else if (JUMP_LABEL (trial_delay) != target)
- {
- mark_target_live_regs
- (next_active_insn (JUMP_LABEL (trial_delay)),
- &needed_at_jump);
- needed.memory |= needed_at_jump.memory;
- needed.unch_memory |= needed_at_jump.unch_memory;
- IOR_HARD_REG_SET (needed.regs, needed_at_jump.regs);
- }
- }
-
- /* See if we have a resource problem before we try to
- split. */
- if (target == 0
- && GET_CODE (pat) != SEQUENCE
- && ! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
-#ifdef HAVE_cc0
- && ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat))
-#endif
- && ! (maybe_never && may_trap_p (pat))
- && (trial = try_split (pat, trial, 0))
- && eligible_for_delay (insn, slots_filled, trial, flags))
- {
- next_trial = next_nonnote_insn (trial);
- delay_list = add_to_delay_list (trial, delay_list);
-
-#ifdef HAVE_cc0
- if (reg_mentioned_p (cc0_rtx, pat))
- link_cc0_insns (trial);
-#endif
-
- delete_insn (trial);
- if (slots_to_fill == ++slots_filled)
- break;
- continue;
- }
-
- mark_set_resources (trial, &set, 0, 1);
- mark_referenced_resources (trial, &needed, 1);
-
- /* Ensure we don't put insns between the setting of cc and the
- comparison by moving a setting of cc into an earlier delay
- slot since these insns could clobber the condition code. */
- set.cc = 1;
-
- /* If this is a call or jump, we might not get here. */
- if (GET_CODE (trial_delay) == CALL_INSN
- || GET_CODE (trial_delay) == JUMP_INSN)
- maybe_never = 1;
- }
-
- /* If there are slots left to fill and our search was stopped by an
- unconditional branch, try the insn at the branch target. We can
- redirect the branch if it works.
-
- Don't do this if the insn at the branch target is a branch. */
- if (slots_to_fill != slots_filled
- && trial
- && GET_CODE (trial) == JUMP_INSN
- && simplejump_p (trial)
- && (target == 0 || JUMP_LABEL (trial) == target)
- && (next_trial = next_active_insn (JUMP_LABEL (trial))) != 0
- && ! (GET_CODE (next_trial) == INSN
- && GET_CODE (PATTERN (next_trial)) == SEQUENCE)
- && GET_CODE (next_trial) != JUMP_INSN
- && ! insn_references_resource_p (next_trial, &set, 1)
- && ! insn_sets_resource_p (next_trial, &set, 1)
- && ! insn_sets_resource_p (next_trial, &needed, 1)
-#ifdef HAVE_cc0
- && ! reg_mentioned_p (cc0_rtx, PATTERN (next_trial))
-#endif
- && ! (maybe_never && may_trap_p (PATTERN (next_trial)))
- && (next_trial = try_split (PATTERN (next_trial), next_trial, 0))
- && eligible_for_delay (insn, slots_filled, next_trial, flags))
- {
- rtx new_label = next_active_insn (next_trial);
-
- if (new_label != 0)
- new_label = get_label_before (new_label);
- else
- new_label = find_end_label ();
-
- delay_list
- = add_to_delay_list (copy_rtx (next_trial), delay_list);
- slots_filled++;
- reorg_redirect_jump (trial, new_label);
-
- /* If we merged because we both jumped to the same place,
- redirect the original insn also. */
- if (target)
- reorg_redirect_jump (insn, new_label);
- }
- }
-
- /* If this is an unconditional jump, then try to get insns from the
- target of the jump. */
- if (GET_CODE (insn) == JUMP_INSN
- && simplejump_p (insn)
- && slots_filled != slots_to_fill)
- delay_list
- = fill_slots_from_thread (insn, const_true_rtx,
- next_active_insn (JUMP_LABEL (insn)),
- NULL, 1, 1,
- own_thread_p (JUMP_LABEL (insn),
- JUMP_LABEL (insn), 0),
- 0, slots_to_fill, &slots_filled);
-
- if (delay_list)
- unfilled_slots_base[i]
- = emit_delay_sequence (insn, delay_list,
- slots_filled, slots_to_fill);
-
- if (slots_to_fill == slots_filled)
- unfilled_slots_base[i] = 0;
-
- note_delay_statistics (slots_filled, 0);
- }
-
-#ifdef DELAY_SLOTS_FOR_EPILOGUE
- /* See if the epilogue needs any delay slots. Try to fill them if so.
- The only thing we can do is scan backwards from the end of the
- function. If we did this in a previous pass, it is incorrect to do it
- again. */
- if (current_function_epilogue_delay_list)
- return;
-
- slots_to_fill = DELAY_SLOTS_FOR_EPILOGUE;
- if (slots_to_fill == 0)
- return;
-
- slots_filled = 0;
- CLEAR_RESOURCE (&set);
-
- /* The frame pointer and stack pointer are needed at the beginning of
- the epilogue, so instructions setting them can not be put in the
- epilogue delay slot. However, everything else needed at function
- end is safe, so we don't want to use end_of_function_needs here. */
- CLEAR_RESOURCE (&needed);
- if (frame_pointer_needed)
- {
- SET_HARD_REG_BIT (needed.regs, FRAME_POINTER_REGNUM);
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- SET_HARD_REG_BIT (needed.regs, HARD_FRAME_POINTER_REGNUM);
-#endif
-#ifdef EXIT_IGNORE_STACK
- if (! EXIT_IGNORE_STACK)
-#endif
- SET_HARD_REG_BIT (needed.regs, STACK_POINTER_REGNUM);
- }
- else
- SET_HARD_REG_BIT (needed.regs, STACK_POINTER_REGNUM);
-
-#ifdef EPILOGUE_USES
- for (i = 0; i <FIRST_PSEUDO_REGISTER; i++)
- {
- if (EPILOGUE_USES (i))
- SET_HARD_REG_BIT (needed.regs, i);
- }
-#endif
-
- for (trial = get_last_insn (); ! stop_search_p (trial, 1);
- trial = PREV_INSN (trial))
- {
- if (GET_CODE (trial) == NOTE)
- continue;
- pat = PATTERN (trial);
- if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
- continue;
-
- if (! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
-#ifdef HAVE_cc0
- /* Don't want to mess with cc0 here. */
- && ! reg_mentioned_p (cc0_rtx, pat)
-#endif
- )
- {
- trial = try_split (pat, trial, 1);
- if (ELIGIBLE_FOR_EPILOGUE_DELAY (trial, slots_filled))
- {
- /* Here as well we are searching backward, so put the
- insns we find on the head of the list. */
-
- current_function_epilogue_delay_list
- = gen_rtx (INSN_LIST, VOIDmode, trial,
- current_function_epilogue_delay_list);
- mark_referenced_resources (trial, &end_of_function_needs, 1);
- update_block (trial, trial);
- delete_insn (trial);
-
- /* Clear deleted bit so final.c will output the insn. */
- INSN_DELETED_P (trial) = 0;
-
- if (slots_to_fill == ++slots_filled)
- break;
- continue;
- }
- }
-
- mark_set_resources (trial, &set, 0, 1);
- mark_referenced_resources (trial, &needed, 1);
- }
-
- note_delay_statistics (slots_filled, 0);
-#endif
-}
-
-/* Try to find insns to place in delay slots.
-
- INSN is the jump needing SLOTS_TO_FILL delay slots. It tests CONDITION
- or is an unconditional branch if CONDITION is const_true_rtx.
- *PSLOTS_FILLED is updated with the number of slots that we have filled.
-
- THREAD is a flow-of-control, either the insns to be executed if the
- branch is true or if the branch is false, THREAD_IF_TRUE says which.
-
- OPPOSITE_THREAD is the thread in the opposite direction. It is used
- to see if any potential delay slot insns set things needed there.
-
- LIKELY is non-zero if it is extremely likely that the branch will be
- taken and THREAD_IF_TRUE is set. This is used for the branch at the
- end of a loop back up to the top.
-
- OWN_THREAD and OWN_OPPOSITE_THREAD are true if we are the only user of the
- thread. I.e., it is the fallthrough code of our jump or the target of the
- jump when we are the only jump going there.
-
- If OWN_THREAD is false, it must be the "true" thread of a jump. In that
- case, we can only take insns from the head of the thread for our delay
- slot. We then adjust the jump to point after the insns we have taken. */
-
-static rtx
-fill_slots_from_thread (insn, condition, thread, opposite_thread, likely,
- thread_if_true, own_thread, own_opposite_thread,
- slots_to_fill, pslots_filled)
- rtx insn;
- rtx condition;
- rtx thread, opposite_thread;
- int likely;
- int thread_if_true;
- int own_thread, own_opposite_thread;
- int slots_to_fill, *pslots_filled;
-{
- rtx new_thread;
- rtx delay_list = 0;
- struct resources opposite_needed, set, needed;
- rtx trial;
- int lose = 0;
- int must_annul = 0;
- int flags;
-
- /* Validate our arguments. */
- if ((condition == const_true_rtx && ! thread_if_true)
- || (! own_thread && ! thread_if_true))
- abort ();
-
- flags = get_jump_flags (insn, JUMP_LABEL (insn));
-
- /* If our thread is the end of subroutine, we can't get any delay
- insns from that. */
- if (thread == 0)
- return 0;
-
- /* If this is an unconditional branch, nothing is needed at the
- opposite thread. Otherwise, compute what is needed there. */
- if (condition == const_true_rtx)
- CLEAR_RESOURCE (&opposite_needed);
- else
- mark_target_live_regs (opposite_thread, &opposite_needed);
-
- /* If the insn at THREAD can be split, do it here to avoid having to
- update THREAD and NEW_THREAD if it is done in the loop below. Also
- initialize NEW_THREAD. */
-
- new_thread = thread = try_split (PATTERN (thread), thread, 0);
-
- /* Scan insns at THREAD. We are looking for an insn that can be removed
- from THREAD (it neither sets nor references resources that were set
- ahead of it and it doesn't set anything needs by the insns ahead of
- it) and that either can be placed in an annulling insn or aren't
- needed at OPPOSITE_THREAD. */
-
- CLEAR_RESOURCE (&needed);
- CLEAR_RESOURCE (&set);
-
- /* If we do not own this thread, we must stop as soon as we find
- something that we can't put in a delay slot, since all we can do
- is branch into THREAD at a later point. Therefore, labels stop
- the search if this is not the `true' thread. */
-
- for (trial = thread;
- ! stop_search_p (trial, ! thread_if_true) && (! lose || own_thread);
- trial = next_nonnote_insn (trial))
- {
- rtx pat, old_trial;
-
- /* If we have passed a label, we no longer own this thread. */
- if (GET_CODE (trial) == CODE_LABEL)
- {
- own_thread = 0;
- continue;
- }
-
- pat = PATTERN (trial);
- if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
- continue;
-
- /* If TRIAL conflicts with the insns ahead of it, we lose. Also,
- don't separate or copy insns that set and use CC0. */
- if (! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
-#ifdef HAVE_cc0
- && ! (reg_mentioned_p (cc0_rtx, pat)
- && (! own_thread || ! sets_cc0_p (pat)))
-#endif
- )
- {
- rtx prior_insn;
-
- /* If TRIAL is redundant with some insn before INSN, we don't
- actually need to add it to the delay list; we can merely pretend
- we did. */
- if (prior_insn = redundant_insn (trial, insn, delay_list))
- {
- fix_reg_dead_note (prior_insn, insn);
- if (own_thread)
- {
- update_block (trial, thread);
- if (trial == thread)
- {
- thread = next_active_insn (thread);
- if (new_thread == trial)
- new_thread = thread;
- }
-
- delete_insn (trial);
- }
- else
- {
- update_reg_unused_notes (prior_insn, trial);
- new_thread = next_active_insn (trial);
- }
-
- continue;
- }
-
- /* There are two ways we can win: If TRIAL doesn't set anything
- needed at the opposite thread and can't trap, or if it can
- go into an annulled delay slot. */
- if (condition == const_true_rtx
- || (! insn_sets_resource_p (trial, &opposite_needed, 1)
- && ! may_trap_p (pat)))
- {
- old_trial = trial;
- trial = try_split (pat, trial, 0);
- if (new_thread == old_trial)
- new_thread = trial;
- if (thread == old_trial)
- thread = trial;
- pat = PATTERN (trial);
- if (eligible_for_delay (insn, *pslots_filled, trial, flags))
- goto winner;
- }
- else if (0
-#ifdef ANNUL_IFTRUE_SLOTS
- || ! thread_if_true
-#endif
-#ifdef ANNUL_IFFALSE_SLOTS
- || thread_if_true
-#endif
- )
- {
- old_trial = trial;
- trial = try_split (pat, trial, 0);
- if (new_thread == old_trial)
- new_thread = trial;
- if (thread == old_trial)
- thread = trial;
- pat = PATTERN (trial);
- if ((thread_if_true
- ? eligible_for_annul_false (insn, *pslots_filled, trial, flags)
- : eligible_for_annul_true (insn, *pslots_filled, trial, flags)))
- {
- rtx temp;
-
- must_annul = 1;
- winner:
-
-#ifdef HAVE_cc0
- if (reg_mentioned_p (cc0_rtx, pat))
- link_cc0_insns (trial);
-#endif
-
- /* If we own this thread, delete the insn. If this is the
- destination of a branch, show that a basic block status
- may have been updated. In any case, mark the new
- starting point of this thread. */
- if (own_thread)
- {
- update_block (trial, thread);
- if (trial == thread)
- {
- thread = next_active_insn (thread);
- if (new_thread == trial)
- new_thread = thread;
- }
- delete_insn (trial);
- }
- else
- new_thread = next_active_insn (trial);
-
- temp = own_thread ? trial : copy_rtx (trial);
- if (thread_if_true)
- INSN_FROM_TARGET_P (temp) = 1;
-
- delay_list = add_to_delay_list (temp, delay_list);
-
- if (slots_to_fill == ++(*pslots_filled))
- {
- /* Even though we have filled all the slots, we
- may be branching to a location that has a
- redundant insn. Skip any if so. */
- while (new_thread && ! own_thread
- && ! insn_sets_resource_p (new_thread, &set, 1)
- && ! insn_sets_resource_p (new_thread, &needed, 1)
- && ! insn_references_resource_p (new_thread,
- &set, 1)
- && redundant_insn (new_thread, insn, delay_list))
- new_thread = next_active_insn (new_thread);
- break;
- }
-
- continue;
- }
- }
- }
-
- /* This insn can't go into a delay slot. */
- lose = 1;
- mark_set_resources (trial, &set, 0, 1);
- mark_referenced_resources (trial, &needed, 1);
-
- /* Ensure we don't put insns between the setting of cc and the comparison
- by moving a setting of cc into an earlier delay slot since these insns
- could clobber the condition code. */
- set.cc = 1;
-
- /* If this insn is a register-register copy and the next insn has
- a use of our destination, change it to use our source. That way,
- it will become a candidate for our delay slot the next time
- through this loop. This case occurs commonly in loops that
- scan a list.
-
- We could check for more complex cases than those tested below,
- but it doesn't seem worth it. It might also be a good idea to try
- to swap the two insns. That might do better.
-
- We can't do this if the next insn modifies our destination, because
- that would make the replacement into the insn invalid. We also can't
- do this if it modifies our source, because it might be an earlyclobber
- operand. This latter test also prevents updating the contents of
- a PRE_INC. */
-
- if (GET_CODE (trial) == INSN && GET_CODE (pat) == SET
- && GET_CODE (SET_SRC (pat)) == REG
- && GET_CODE (SET_DEST (pat)) == REG)
- {
- rtx next = next_nonnote_insn (trial);
-
- if (next && GET_CODE (next) == INSN
- && GET_CODE (PATTERN (next)) != USE
- && ! reg_set_p (SET_DEST (pat), next)
- && ! reg_set_p (SET_SRC (pat), next)
- && reg_referenced_p (SET_DEST (pat), PATTERN (next)))
- validate_replace_rtx (SET_DEST (pat), SET_SRC (pat), next);
- }
- }
-
- /* If we stopped on a branch insn that has delay slots, see if we can
- steal some of the insns in those slots. */
- if (trial && GET_CODE (trial) == INSN
- && GET_CODE (PATTERN (trial)) == SEQUENCE
- && GET_CODE (XVECEXP (PATTERN (trial), 0, 0)) == JUMP_INSN)
- {
- /* If this is the `true' thread, we will want to follow the jump,
- so we can only do this if we have taken everything up to here. */
- if (thread_if_true && trial == new_thread)
- delay_list
- = steal_delay_list_from_target (insn, condition, PATTERN (trial),
- delay_list, &set, &needed,
- &opposite_needed, slots_to_fill,
- pslots_filled, &must_annul,
- &new_thread);
- else if (! thread_if_true)
- delay_list
- = steal_delay_list_from_fallthrough (insn, condition,
- PATTERN (trial),
- delay_list, &set, &needed,
- &opposite_needed, slots_to_fill,
- pslots_filled, &must_annul);
- }
-
- /* If we haven't found anything for this delay slot and it is very
- likely that the branch will be taken, see if the insn at our target
- increments or decrements a register with an increment that does not
- depend on the destination register. If so, try to place the opposite
- arithmetic insn after the jump insn and put the arithmetic insn in the
- delay slot. If we can't do this, return. */
- if (delay_list == 0 && likely && new_thread
- && GET_CODE (new_thread) == INSN
- && GET_CODE (PATTERN (new_thread)) != ASM_INPUT
- && asm_noperands (PATTERN (new_thread)) < 0)
- {
- rtx pat = PATTERN (new_thread);
- rtx dest;
- rtx src;
-
- trial = new_thread;
- pat = PATTERN (trial);
-
- if (GET_CODE (trial) != INSN || GET_CODE (pat) != SET
- || ! eligible_for_delay (insn, 0, trial, flags))
- return 0;
-
- dest = SET_DEST (pat), src = SET_SRC (pat);
- if ((GET_CODE (src) == PLUS || GET_CODE (src) == MINUS)
- && rtx_equal_p (XEXP (src, 0), dest)
- && ! reg_overlap_mentioned_p (dest, XEXP (src, 1)))
- {
- rtx other = XEXP (src, 1);
- rtx new_arith;
- rtx ninsn;
-
- /* If this is a constant adjustment, use the same code with
- the negated constant. Otherwise, reverse the sense of the
- arithmetic. */
- if (GET_CODE (other) == CONST_INT)
- new_arith = gen_rtx (GET_CODE (src), GET_MODE (src), dest,
- negate_rtx (GET_MODE (src), other));
- else
- new_arith = gen_rtx (GET_CODE (src) == PLUS ? MINUS : PLUS,
- GET_MODE (src), dest, other);
-
- ninsn = emit_insn_after (gen_rtx (SET, VOIDmode, dest, new_arith),
- insn);
-
- if (recog_memoized (ninsn) < 0
- || (insn_extract (ninsn),
- ! constrain_operands (INSN_CODE (ninsn), 1)))
- {
- delete_insn (ninsn);
- return 0;
- }
-
- if (own_thread)
- {
- update_block (trial, thread);
- if (trial == thread)
- {
- thread = next_active_insn (thread);
- if (new_thread == trial)
- new_thread = thread;
- }
- delete_insn (trial);
- }
- else
- new_thread = next_active_insn (trial);
-
- ninsn = own_thread ? trial : copy_rtx (trial);
- if (thread_if_true)
- INSN_FROM_TARGET_P (ninsn) = 1;
-
- delay_list = add_to_delay_list (ninsn, NULL_RTX);
- (*pslots_filled)++;
- }
- }
-
- if (delay_list && must_annul)
- INSN_ANNULLED_BRANCH_P (insn) = 1;
-
- /* If we are to branch into the middle of this thread, find an appropriate
- label or make a new one if none, and redirect INSN to it. If we hit the
- end of the function, use the end-of-function label. */
- if (new_thread != thread)
- {
- rtx label;
-
- if (! thread_if_true)
- abort ();
-
- if (new_thread && GET_CODE (new_thread) == JUMP_INSN
- && (simplejump_p (new_thread)
- || GET_CODE (PATTERN (new_thread)) == RETURN)
- && redirect_with_delay_list_safe_p (insn,
- JUMP_LABEL (new_thread),
- delay_list))
- new_thread = follow_jumps (JUMP_LABEL (new_thread));
-
- if (new_thread == 0)
- label = find_end_label ();
- else if (GET_CODE (new_thread) == CODE_LABEL)
- label = new_thread;
- else
- label = get_label_before (new_thread);
-
- reorg_redirect_jump (insn, label);
- }
-
- return delay_list;
-}
-
-/* Make another attempt to find insns to place in delay slots.
-
- We previously looked for insns located in front of the delay insn
- and, for non-jump delay insns, located behind the delay insn.
-
- Here only try to schedule jump insns and try to move insns from either
- the target or the following insns into the delay slot. If annulling is
- supported, we will be likely to do this. Otherwise, we can do this only
- if safe. */
-
-static void
-fill_eager_delay_slots (first)
- rtx first;
-{
- register rtx insn;
- register int i;
- int num_unfilled_slots = unfilled_slots_next - unfilled_slots_base;
-
- for (i = 0; i < num_unfilled_slots; i++)
- {
- rtx condition;
- rtx target_label, insn_at_target, fallthrough_insn;
- rtx delay_list = 0;
- int own_target;
- int own_fallthrough;
- int prediction, slots_to_fill, slots_filled;
-
- insn = unfilled_slots_base[i];
- if (insn == 0
- || INSN_DELETED_P (insn)
- || GET_CODE (insn) != JUMP_INSN
- || ! (condjump_p (insn) || condjump_in_parallel_p (insn)))
- continue;
-
- slots_to_fill = num_delay_slots (insn);
- if (slots_to_fill == 0)
- abort ();
-
- slots_filled = 0;
- target_label = JUMP_LABEL (insn);
- condition = get_branch_condition (insn, target_label);
-
- if (condition == 0)
- continue;
-
- /* Get the next active fallthrough and target insns and see if we own
- them. Then see whether the branch is likely true. We don't need
- to do a lot of this for unconditional branches. */
-
- insn_at_target = next_active_insn (target_label);
- own_target = own_thread_p (target_label, target_label, 0);
-
- if (condition == const_true_rtx)
- {
- own_fallthrough = 0;
- fallthrough_insn = 0;
- prediction = 2;
- }
- else
- {
- fallthrough_insn = next_active_insn (insn);
- own_fallthrough = own_thread_p (NEXT_INSN (insn), NULL_RTX, 1);
- prediction = mostly_true_jump (insn, condition);
- }
-
- /* If this insn is expected to branch, first try to get insns from our
- target, then our fallthrough insns. If it is not, expected to branch,
- try the other order. */
-
- if (prediction > 0)
- {
- delay_list
- = fill_slots_from_thread (insn, condition, insn_at_target,
- fallthrough_insn, prediction == 2, 1,
- own_target, own_fallthrough,
- slots_to_fill, &slots_filled);
-
- if (delay_list == 0 && own_fallthrough)
- {
- /* Even though we didn't find anything for delay slots,
- we might have found a redundant insn which we deleted
- from the thread that was filled. So we have to recompute
- the next insn at the target. */
- target_label = JUMP_LABEL (insn);
- insn_at_target = next_active_insn (target_label);
-
- delay_list
- = fill_slots_from_thread (insn, condition, fallthrough_insn,
- insn_at_target, 0, 0,
- own_fallthrough, own_target,
- slots_to_fill, &slots_filled);
- }
- }
- else
- {
- if (own_fallthrough)
- delay_list
- = fill_slots_from_thread (insn, condition, fallthrough_insn,
- insn_at_target, 0, 0,
- own_fallthrough, own_target,
- slots_to_fill, &slots_filled);
-
- if (delay_list == 0)
- delay_list
- = fill_slots_from_thread (insn, condition, insn_at_target,
- next_active_insn (insn), 0, 1,
- own_target, own_fallthrough,
- slots_to_fill, &slots_filled);
- }
-
- if (delay_list)
- unfilled_slots_base[i]
- = emit_delay_sequence (insn, delay_list,
- slots_filled, slots_to_fill);
-
- if (slots_to_fill == slots_filled)
- unfilled_slots_base[i] = 0;
-
- note_delay_statistics (slots_filled, 1);
- }
-}
-
-/* Once we have tried two ways to fill a delay slot, make a pass over the
- code to try to improve the results and to do such things as more jump
- threading. */
-
-static void
-relax_delay_slots (first)
- rtx first;
-{
- register rtx insn, next, pat;
- register rtx trial, delay_insn, target_label;
-
- /* Look at every JUMP_INSN and see if we can improve it. */
- for (insn = first; insn; insn = next)
- {
- rtx other;
-
- next = next_active_insn (insn);
-
- /* If this is a jump insn, see if it now jumps to a jump, jumps to
- the next insn, or jumps to a label that is not the last of a
- group of consecutive labels. */
- if (GET_CODE (insn) == JUMP_INSN
- && (condjump_p (insn) || condjump_in_parallel_p (insn))
- && (target_label = JUMP_LABEL (insn)) != 0)
- {
- target_label = follow_jumps (target_label);
- target_label = prev_label (next_active_insn (target_label));
-
- if (target_label == 0)
- target_label = find_end_label ();
-
- if (next_active_insn (target_label) == next
- && ! condjump_in_parallel_p (insn))
- {
- delete_jump (insn);
- continue;
- }
-
- if (target_label != JUMP_LABEL (insn))
- reorg_redirect_jump (insn, target_label);
-
- /* See if this jump branches around a unconditional jump.
- If so, invert this jump and point it to the target of the
- second jump. */
- if (next && GET_CODE (next) == JUMP_INSN
- && (simplejump_p (next) || GET_CODE (PATTERN (next)) == RETURN)
- && next_active_insn (target_label) == next_active_insn (next)
- && no_labels_between_p (insn, next))
- {
- rtx label = JUMP_LABEL (next);
-
- /* Be careful how we do this to avoid deleting code or
- labels that are momentarily dead. See similar optimization
- in jump.c.
-
- We also need to ensure we properly handle the case when
- invert_jump fails. */
-
- ++LABEL_NUSES (target_label);
- if (label)
- ++LABEL_NUSES (label);
-
- if (invert_jump (insn, label))
- {
- delete_insn (next);
- next = insn;
- }
-
- if (label)
- --LABEL_NUSES (label);
-
- if (--LABEL_NUSES (target_label) == 0)
- delete_insn (target_label);
-
- continue;
- }
- }
-
- /* If this is an unconditional jump and the previous insn is a
- conditional jump, try reversing the condition of the previous
- insn and swapping our targets. The next pass might be able to
- fill the slots.
-
- Don't do this if we expect the conditional branch to be true, because
- we would then be making the more common case longer. */
-
- if (GET_CODE (insn) == JUMP_INSN
- && (simplejump_p (insn) || GET_CODE (PATTERN (insn)) == RETURN)
- && (other = prev_active_insn (insn)) != 0
- && (condjump_p (other) || condjump_in_parallel_p (other))
- && no_labels_between_p (other, insn)
- && 0 < mostly_true_jump (other,
- get_branch_condition (other,
- JUMP_LABEL (other))))
- {
- rtx other_target = JUMP_LABEL (other);
- target_label = JUMP_LABEL (insn);
-
- /* Increment the count of OTHER_TARGET, so it doesn't get deleted
- as we move the label. */
- if (other_target)
- ++LABEL_NUSES (other_target);
-
- if (invert_jump (other, target_label))
- reorg_redirect_jump (insn, other_target);
-
- if (other_target)
- --LABEL_NUSES (other_target);
- }
-
- /* Now look only at cases where we have filled a delay slot. */
- if (GET_CODE (insn) != INSN
- || GET_CODE (PATTERN (insn)) != SEQUENCE)
- continue;
-
- pat = PATTERN (insn);
- delay_insn = XVECEXP (pat, 0, 0);
-
- /* See if the first insn in the delay slot is redundant with some
- previous insn. Remove it from the delay slot if so; then set up
- to reprocess this insn. */
- if (redundant_insn (XVECEXP (pat, 0, 1), delay_insn, 0))
- {
- delete_from_delay_slot (XVECEXP (pat, 0, 1));
- next = prev_active_insn (next);
- continue;
- }
-
- /* Now look only at the cases where we have a filled JUMP_INSN. */
- if (GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) != JUMP_INSN
- || ! (condjump_p (XVECEXP (PATTERN (insn), 0, 0))
- || condjump_in_parallel_p (XVECEXP (PATTERN (insn), 0, 0))))
- continue;
-
- target_label = JUMP_LABEL (delay_insn);
-
- if (target_label)
- {
- /* If this jump goes to another unconditional jump, thread it, but
- don't convert a jump into a RETURN here. */
- trial = follow_jumps (target_label);
- /* We use next_real_insn instead of next_active_insn, so that
- the special USE insns emitted by reorg won't be ignored.
- If they are ignored, then they will get deleted if target_label
- is now unreachable, and that would cause mark_target_live_regs
- to fail. */
- trial = prev_label (next_real_insn (trial));
- if (trial == 0 && target_label != 0)
- trial = find_end_label ();
-
- if (trial != target_label
- && redirect_with_delay_slots_safe_p (delay_insn, trial, insn))
- {
- reorg_redirect_jump (delay_insn, trial);
- target_label = trial;
- }
-
- /* If the first insn at TARGET_LABEL is redundant with a previous
- insn, redirect the jump to the following insn process again. */
- trial = next_active_insn (target_label);
- if (trial && GET_CODE (PATTERN (trial)) != SEQUENCE
- && redundant_insn (trial, insn, 0))
- {
- rtx tmp;
-
- /* Figure out where to emit the special USE insn so we don't
- later incorrectly compute register live/death info. */
- tmp = next_active_insn (trial);
- if (tmp == 0)
- tmp = find_end_label ();
-
- /* Insert the special USE insn and update dataflow info. */
- update_block (trial, tmp);
-
- /* Now emit a label before the special USE insn, and
- redirect our jump to the new label. */
- target_label = get_label_before (PREV_INSN (tmp));
- reorg_redirect_jump (delay_insn, target_label);
- next = insn;
- continue;
- }
-
- /* Similarly, if it is an unconditional jump with one insn in its
- delay list and that insn is redundant, thread the jump. */
- if (trial && GET_CODE (PATTERN (trial)) == SEQUENCE
- && XVECLEN (PATTERN (trial), 0) == 2
- && GET_CODE (XVECEXP (PATTERN (trial), 0, 0)) == JUMP_INSN
- && (simplejump_p (XVECEXP (PATTERN (trial), 0, 0))
- || GET_CODE (PATTERN (XVECEXP (PATTERN (trial), 0, 0))) == RETURN)
- && redundant_insn (XVECEXP (PATTERN (trial), 0, 1), insn, 0))
- {
- target_label = JUMP_LABEL (XVECEXP (PATTERN (trial), 0, 0));
- if (target_label == 0)
- target_label = find_end_label ();
-
- if (redirect_with_delay_slots_safe_p (delay_insn, target_label,
- insn))
- {
- reorg_redirect_jump (delay_insn, target_label);
- next = insn;
- continue;
- }
- }
- }
-
- if (! INSN_ANNULLED_BRANCH_P (delay_insn)
- && prev_active_insn (target_label) == insn
- && ! condjump_in_parallel_p (delay_insn)
-#ifdef HAVE_cc0
- /* If the last insn in the delay slot sets CC0 for some insn,
- various code assumes that it is in a delay slot. We could
- put it back where it belonged and delete the register notes,
- but it doesn't seem worthwhile in this uncommon case. */
- && ! find_reg_note (XVECEXP (pat, 0, XVECLEN (pat, 0) - 1),
- REG_CC_USER, NULL_RTX)
-#endif
- )
- {
- int i;
-
- /* All this insn does is execute its delay list and jump to the
- following insn. So delete the jump and just execute the delay
- list insns.
-
- We do this by deleting the INSN containing the SEQUENCE, then
- re-emitting the insns separately, and then deleting the jump.
- This allows the count of the jump target to be properly
- decremented. */
-
- /* Clear the from target bit, since these insns are no longer
- in delay slots. */
- for (i = 0; i < XVECLEN (pat, 0); i++)
- INSN_FROM_TARGET_P (XVECEXP (pat, 0, i)) = 0;
-
- trial = PREV_INSN (insn);
- delete_insn (insn);
- emit_insn_after (pat, trial);
- delete_scheduled_jump (delay_insn);
- continue;
- }
-
- /* See if this is an unconditional jump around a single insn which is
- identical to the one in its delay slot. In this case, we can just
- delete the branch and the insn in its delay slot. */
- if (next && GET_CODE (next) == INSN
- && prev_label (next_active_insn (next)) == target_label
- && simplejump_p (insn)
- && XVECLEN (pat, 0) == 2
- && rtx_equal_p (PATTERN (next), PATTERN (XVECEXP (pat, 0, 1))))
- {
- delete_insn (insn);
- continue;
- }
-
- /* See if this jump (with its delay slots) branches around another
- jump (without delay slots). If so, invert this jump and point
- it to the target of the second jump. We cannot do this for
- annulled jumps, though. Again, don't convert a jump to a RETURN
- here. */
- if (! INSN_ANNULLED_BRANCH_P (delay_insn)
- && next && GET_CODE (next) == JUMP_INSN
- && (simplejump_p (next) || GET_CODE (PATTERN (next)) == RETURN)
- && next_active_insn (target_label) == next_active_insn (next)
- && no_labels_between_p (insn, next))
- {
- rtx label = JUMP_LABEL (next);
- rtx old_label = JUMP_LABEL (delay_insn);
-
- if (label == 0)
- label = find_end_label ();
-
- if (redirect_with_delay_slots_safe_p (delay_insn, label, insn))
- {
- /* Be careful how we do this to avoid deleting code or labels
- that are momentarily dead. See similar optimization in
- jump.c */
- if (old_label)
- ++LABEL_NUSES (old_label);
-
- if (invert_jump (delay_insn, label))
- {
- int i;
-
- /* Must update the INSN_FROM_TARGET_P bits now that
- the branch is reversed, so that mark_target_live_regs
- will handle the delay slot insn correctly. */
- for (i = 1; i < XVECLEN (PATTERN (insn), 0); i++)
- {
- rtx slot = XVECEXP (PATTERN (insn), 0, i);
- INSN_FROM_TARGET_P (slot) = ! INSN_FROM_TARGET_P (slot);
- }
-
- delete_insn (next);
- next = insn;
- }
-
- if (old_label && --LABEL_NUSES (old_label) == 0)
- delete_insn (old_label);
- continue;
- }
- }
-
- /* If we own the thread opposite the way this insn branches, see if we
- can merge its delay slots with following insns. */
- if (INSN_FROM_TARGET_P (XVECEXP (pat, 0, 1))
- && own_thread_p (NEXT_INSN (insn), 0, 1))
- try_merge_delay_insns (insn, next);
- else if (! INSN_FROM_TARGET_P (XVECEXP (pat, 0, 1))
- && own_thread_p (target_label, target_label, 0))
- try_merge_delay_insns (insn, next_active_insn (target_label));
-
- /* If we get here, we haven't deleted INSN. But we may have deleted
- NEXT, so recompute it. */
- next = next_active_insn (insn);
- }
-}
-
-#ifdef HAVE_return
-
-/* Look for filled jumps to the end of function label. We can try to convert
- them into RETURN insns if the insns in the delay slot are valid for the
- RETURN as well. */
-
-static void
-make_return_insns (first)
- rtx first;
-{
- rtx insn, jump_insn, pat;
- rtx real_return_label = end_of_function_label;
- int slots, i;
-
- /* See if there is a RETURN insn in the function other than the one we
- made for END_OF_FUNCTION_LABEL. If so, set up anything we can't change
- into a RETURN to jump to it. */
- for (insn = first; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == JUMP_INSN && GET_CODE (PATTERN (insn)) == RETURN)
- {
- real_return_label = get_label_before (insn);
- break;
- }
-
- /* Show an extra usage of REAL_RETURN_LABEL so it won't go away if it
- was equal to END_OF_FUNCTION_LABEL. */
- LABEL_NUSES (real_return_label)++;
-
- /* Clear the list of insns to fill so we can use it. */
- obstack_free (&unfilled_slots_obstack, unfilled_firstobj);
-
- for (insn = first; insn; insn = NEXT_INSN (insn))
- {
- int flags;
-
- /* Only look at filled JUMP_INSNs that go to the end of function
- label. */
- if (GET_CODE (insn) != INSN
- || GET_CODE (PATTERN (insn)) != SEQUENCE
- || GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) != JUMP_INSN
- || JUMP_LABEL (XVECEXP (PATTERN (insn), 0, 0)) != end_of_function_label)
- continue;
-
- pat = PATTERN (insn);
- jump_insn = XVECEXP (pat, 0, 0);
-
- /* If we can't make the jump into a RETURN, try to redirect it to the best
- RETURN and go on to the next insn. */
- if (! reorg_redirect_jump (jump_insn, NULL_RTX))
- {
- /* Make sure redirecting the jump will not invalidate the delay
- slot insns. */
- if (redirect_with_delay_slots_safe_p (jump_insn,
- real_return_label,
- insn))
- reorg_redirect_jump (jump_insn, real_return_label);
- continue;
- }
-
- /* See if this RETURN can accept the insns current in its delay slot.
- It can if it has more or an equal number of slots and the contents
- of each is valid. */
-
- flags = get_jump_flags (jump_insn, JUMP_LABEL (jump_insn));
- slots = num_delay_slots (jump_insn);
- if (slots >= XVECLEN (pat, 0) - 1)
- {
- for (i = 1; i < XVECLEN (pat, 0); i++)
- if (! (
-#ifdef ANNUL_IFFALSE_SLOTS
- (INSN_ANNULLED_BRANCH_P (jump_insn)
- && INSN_FROM_TARGET_P (XVECEXP (pat, 0, i)))
- ? eligible_for_annul_false (jump_insn, i - 1,
- XVECEXP (pat, 0, i), flags) :
-#endif
-#ifdef ANNUL_IFTRUE_SLOTS
- (INSN_ANNULLED_BRANCH_P (jump_insn)
- && ! INSN_FROM_TARGET_P (XVECEXP (pat, 0, i)))
- ? eligible_for_annul_true (jump_insn, i - 1,
- XVECEXP (pat, 0, i), flags) :
-#endif
- eligible_for_delay (jump_insn, i -1, XVECEXP (pat, 0, i), flags)))
- break;
- }
- else
- i = 0;
-
- if (i == XVECLEN (pat, 0))
- continue;
-
- /* We have to do something with this insn. If it is an unconditional
- RETURN, delete the SEQUENCE and output the individual insns,
- followed by the RETURN. Then set things up so we try to find
- insns for its delay slots, if it needs some. */
- if (GET_CODE (PATTERN (jump_insn)) == RETURN)
- {
- rtx prev = PREV_INSN (insn);
-
- delete_insn (insn);
- for (i = 1; i < XVECLEN (pat, 0); i++)
- prev = emit_insn_after (PATTERN (XVECEXP (pat, 0, i)), prev);
-
- insn = emit_jump_insn_after (PATTERN (jump_insn), prev);
- emit_barrier_after (insn);
-
- if (slots)
- obstack_ptr_grow (&unfilled_slots_obstack, insn);
- }
- else
- /* It is probably more efficient to keep this with its current
- delay slot as a branch to a RETURN. */
- reorg_redirect_jump (jump_insn, real_return_label);
- }
-
- /* Now delete REAL_RETURN_LABEL if we never used it. Then try to fill any
- new delay slots we have created. */
- if (--LABEL_NUSES (real_return_label) == 0)
- delete_insn (real_return_label);
-
- fill_simple_delay_slots (first, 1);
- fill_simple_delay_slots (first, 0);
-}
-#endif
-
-/* Try to find insns to place in delay slots. */
-
-void
-dbr_schedule (first, file)
- rtx first;
- FILE *file;
-{
- rtx insn, next, epilogue_insn = 0;
- int i;
-#if 0
- int old_flag_no_peephole = flag_no_peephole;
-
- /* Execute `final' once in prescan mode to delete any insns that won't be
- used. Don't let final try to do any peephole optimization--it will
- ruin dataflow information for this pass. */
-
- flag_no_peephole = 1;
- final (first, 0, NO_DEBUG, 1, 1);
- flag_no_peephole = old_flag_no_peephole;
-#endif
-
- /* If the current function has no insns other than the prologue and
- epilogue, then do not try to fill any delay slots. */
- if (n_basic_blocks == 0)
- return;
-
- /* Find the highest INSN_UID and allocate and initialize our map from
- INSN_UID's to position in code. */
- for (max_uid = 0, insn = first; insn; insn = NEXT_INSN (insn))
- {
- if (INSN_UID (insn) > max_uid)
- max_uid = INSN_UID (insn);
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_EPILOGUE_BEG)
- epilogue_insn = insn;
- }
-
- uid_to_ruid = (int *) alloca ((max_uid + 1) * sizeof (int *));
- for (i = 0, insn = first; insn; i++, insn = NEXT_INSN (insn))
- uid_to_ruid[INSN_UID (insn)] = i;
-
- /* Initialize the list of insns that need filling. */
- if (unfilled_firstobj == 0)
- {
- gcc_obstack_init (&unfilled_slots_obstack);
- unfilled_firstobj = (rtx *) obstack_alloc (&unfilled_slots_obstack, 0);
- }
-
- for (insn = next_active_insn (first); insn; insn = next_active_insn (insn))
- {
- rtx target;
-
- INSN_ANNULLED_BRANCH_P (insn) = 0;
- INSN_FROM_TARGET_P (insn) = 0;
-
- /* Skip vector tables. We can't get attributes for them. */
- if (GET_CODE (insn) == JUMP_INSN
- && (GET_CODE (PATTERN (insn)) == ADDR_VEC
- || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC))
- continue;
-
- if (num_delay_slots (insn) > 0)
- obstack_ptr_grow (&unfilled_slots_obstack, insn);
-
- /* Ensure all jumps go to the last of a set of consecutive labels. */
- if (GET_CODE (insn) == JUMP_INSN
- && (condjump_p (insn) || condjump_in_parallel_p (insn))
- && JUMP_LABEL (insn) != 0
- && ((target = prev_label (next_active_insn (JUMP_LABEL (insn))))
- != JUMP_LABEL (insn)))
- redirect_jump (insn, target);
- }
-
- /* Indicate what resources are required to be valid at the end of the current
- function. The condition code never is and memory always is. If the
- frame pointer is needed, it is and so is the stack pointer unless
- EXIT_IGNORE_STACK is non-zero. If the frame pointer is not needed, the
- stack pointer is. Registers used to return the function value are
- needed. Registers holding global variables are needed. */
-
- end_of_function_needs.cc = 0;
- end_of_function_needs.memory = 1;
- end_of_function_needs.unch_memory = 0;
- CLEAR_HARD_REG_SET (end_of_function_needs.regs);
-
- if (frame_pointer_needed)
- {
- SET_HARD_REG_BIT (end_of_function_needs.regs, FRAME_POINTER_REGNUM);
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- SET_HARD_REG_BIT (end_of_function_needs.regs, HARD_FRAME_POINTER_REGNUM);
-#endif
-#ifdef EXIT_IGNORE_STACK
- if (! EXIT_IGNORE_STACK)
-#endif
- SET_HARD_REG_BIT (end_of_function_needs.regs, STACK_POINTER_REGNUM);
- }
- else
- SET_HARD_REG_BIT (end_of_function_needs.regs, STACK_POINTER_REGNUM);
-
- if (current_function_return_rtx != 0
- && GET_CODE (current_function_return_rtx) == REG)
- mark_referenced_resources (current_function_return_rtx,
- &end_of_function_needs, 1);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i]
-#ifdef EPILOGUE_USES
- || EPILOGUE_USES (i)
-#endif
- )
- SET_HARD_REG_BIT (end_of_function_needs.regs, i);
-
- /* The registers required to be live at the end of the function are
- represented in the flow information as being dead just prior to
- reaching the end of the function. For example, the return of a value
- might be represented by a USE of the return register immediately
- followed by an unconditional jump to the return label where the
- return label is the end of the RTL chain. The end of the RTL chain
- is then taken to mean that the return register is live.
-
- This sequence is no longer maintained when epilogue instructions are
- added to the RTL chain. To reconstruct the original meaning, the
- start of the epilogue (NOTE_INSN_EPILOGUE_BEG) is regarded as the
- point where these registers become live (start_of_epilogue_needs).
- If epilogue instructions are present, the registers set by those
- instructions won't have been processed by flow. Thus, those
- registers are additionally required at the end of the RTL chain
- (end_of_function_needs). */
-
- start_of_epilogue_needs = end_of_function_needs;
-
- while (epilogue_insn = next_nonnote_insn (epilogue_insn))
- mark_set_resources (epilogue_insn, &end_of_function_needs, 0, 1);
-
- /* Show we haven't computed an end-of-function label yet. */
- end_of_function_label = 0;
-
- /* Allocate and initialize the tables used by mark_target_live_regs. */
- target_hash_table
- = (struct target_info **) alloca ((TARGET_HASH_PRIME
- * sizeof (struct target_info *)));
- bzero ((char *) target_hash_table,
- TARGET_HASH_PRIME * sizeof (struct target_info *));
-
- bb_ticks = (int *) alloca (n_basic_blocks * sizeof (int));
- bzero ((char *) bb_ticks, n_basic_blocks * sizeof (int));
-
- /* Initialize the statistics for this function. */
- bzero ((char *) num_insns_needing_delays, sizeof num_insns_needing_delays);
- bzero ((char *) num_filled_delays, sizeof num_filled_delays);
-
- /* Now do the delay slot filling. Try everything twice in case earlier
- changes make more slots fillable. */
-
- for (reorg_pass_number = 0;
- reorg_pass_number < MAX_REORG_PASSES;
- reorg_pass_number++)
- {
- fill_simple_delay_slots (first, 1);
- fill_simple_delay_slots (first, 0);
- fill_eager_delay_slots (first);
- relax_delay_slots (first);
- }
-
- /* Delete any USE insns made by update_block; subsequent passes don't need
- them or know how to deal with them. */
- for (insn = first; insn; insn = next)
- {
- next = NEXT_INSN (insn);
-
- if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == USE
- && GET_RTX_CLASS (GET_CODE (XEXP (PATTERN (insn), 0))) == 'i')
- next = delete_insn (insn);
- }
-
- /* If we made an end of function label, indicate that it is now
- safe to delete it by undoing our prior adjustment to LABEL_NUSES.
- If it is now unused, delete it. */
- if (end_of_function_label && --LABEL_NUSES (end_of_function_label) == 0)
- delete_insn (end_of_function_label);
-
-#ifdef HAVE_return
- if (HAVE_return && end_of_function_label != 0)
- make_return_insns (first);
-#endif
-
- obstack_free (&unfilled_slots_obstack, unfilled_firstobj);
-
- /* It is not clear why the line below is needed, but it does seem to be. */
- unfilled_firstobj = (rtx *) obstack_alloc (&unfilled_slots_obstack, 0);
-
- /* Reposition the prologue and epilogue notes in case we moved the
- prologue/epilogue insns. */
- reposition_prologue_and_epilogue_notes (first);
-
- if (file)
- {
- register int i, j, need_comma;
-
- for (reorg_pass_number = 0;
- reorg_pass_number < MAX_REORG_PASSES;
- reorg_pass_number++)
- {
- fprintf (file, ";; Reorg pass #%d:\n", reorg_pass_number + 1);
- for (i = 0; i < NUM_REORG_FUNCTIONS; i++)
- {
- need_comma = 0;
- fprintf (file, ";; Reorg function #%d\n", i);
-
- fprintf (file, ";; %d insns needing delay slots\n;; ",
- num_insns_needing_delays[i][reorg_pass_number]);
-
- for (j = 0; j < MAX_DELAY_HISTOGRAM; j++)
- if (num_filled_delays[i][j][reorg_pass_number])
- {
- if (need_comma)
- fprintf (file, ", ");
- need_comma = 1;
- fprintf (file, "%d got %d delays",
- num_filled_delays[i][j][reorg_pass_number], j);
- }
- fprintf (file, "\n");
- }
- }
- }
-}
-#endif /* DELAY_SLOTS */
diff --git a/gcc/rtl.c b/gcc/rtl.c
deleted file mode 100644
index a391c3857d8..00000000000
--- a/gcc/rtl.c
+++ /dev/null
@@ -1,855 +0,0 @@
-/* Allocate and read RTL for GNU C Compiler.
- Copyright (C) 1987, 1988, 1991, 1994, 1997 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. */
-
-
-#include "config.h"
-#include <ctype.h>
-#include <stdio.h>
-#include "rtl.h"
-#include "real.h"
-
-#include "obstack.h"
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-/* Obstack used for allocating RTL objects.
- Between functions, this is the permanent_obstack.
- While parsing and expanding a function, this is maybepermanent_obstack
- so we can save it if it is an inline function.
- During optimization and output, this is function_obstack. */
-
-extern struct obstack *rtl_obstack;
-
-#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
-extern long atol();
-#endif
-
-/* Indexed by rtx code, gives number of operands for an rtx with that code.
- Does NOT include rtx header data (code and links).
- This array is initialized in init_rtl. */
-
-int rtx_length[NUM_RTX_CODE + 1];
-
-/* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */
-
-#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME ,
-
-char *rtx_name[] = {
-#include "rtl.def" /* rtl expressions are documented here */
-};
-
-#undef DEF_RTL_EXPR
-
-/* Indexed by machine mode, gives the name of that machine mode.
- This name does not include the letters "mode". */
-
-#define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) NAME,
-
-char *mode_name[(int) MAX_MACHINE_MODE] = {
-#include "machmode.def"
-
-#ifdef EXTRA_CC_MODES
- EXTRA_CC_NAMES
-#endif
-
-};
-
-#undef DEF_MACHMODE
-
-/* Indexed by machine mode, gives the length of the mode, in bytes.
- GET_MODE_CLASS uses this. */
-
-#define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) CLASS,
-
-enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
-#include "machmode.def"
-};
-
-#undef DEF_MACHMODE
-
-/* Indexed by machine mode, gives the length of the mode, in bytes.
- GET_MODE_SIZE uses this. */
-
-#define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) SIZE,
-
-int mode_size[(int) MAX_MACHINE_MODE] = {
-#include "machmode.def"
-};
-
-#undef DEF_MACHMODE
-
-/* Indexed by machine mode, gives the length of the mode's subunit.
- GET_MODE_UNIT_SIZE uses this. */
-
-#define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) UNIT,
-
-int mode_unit_size[(int) MAX_MACHINE_MODE] = {
-#include "machmode.def" /* machine modes are documented here */
-};
-
-#undef DEF_MACHMODE
-
-/* Indexed by machine mode, gives next wider natural mode
- (QI -> HI -> SI -> DI, etc.) Widening multiply instructions
- use this. */
-
-#define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) \
- (enum machine_mode) WIDER,
-
-enum machine_mode mode_wider_mode[(int) MAX_MACHINE_MODE] = {
-#include "machmode.def" /* machine modes are documented here */
-};
-
-#undef DEF_MACHMODE
-
-/* Indexed by mode class, gives the narrowest mode for each class. */
-
-enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS];
-
-/* Indexed by rtx code, gives a sequence of operand-types for
- rtx's of that code. The sequence is a C string in which
- each character describes one operand. */
-
-char *rtx_format[] = {
- /* "*" undefined.
- can cause a warning message
- "0" field is unused (or used in a phase-dependent manner)
- prints nothing
- "i" an integer
- prints the integer
- "n" like "i", but prints entries from `note_insn_name'
- "w" an integer of width HOST_BITS_PER_WIDE_INT
- prints the integer
- "s" a pointer to a string
- prints the string
- "S" like "s", but optional:
- the containing rtx may end before this operand
- "e" a pointer to an rtl expression
- prints the expression
- "E" a pointer to a vector that points to a number of rtl expressions
- prints a list of the rtl expressions
- "V" like "E", but optional:
- the containing rtx may end before this operand
- "u" a pointer to another insn
- prints the uid of the insn. */
-
-#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT ,
-#include "rtl.def" /* rtl expressions are defined here */
-#undef DEF_RTL_EXPR
-};
-
-/* Indexed by rtx code, gives a character representing the "class" of
- that rtx code. See rtl.def for documentation on the defined classes. */
-
-char rtx_class[] = {
-#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) CLASS,
-#include "rtl.def" /* rtl expressions are defined here */
-#undef DEF_RTL_EXPR
-};
-
-/* Names for kinds of NOTEs and REG_NOTEs. */
-
-char *note_insn_name[] = { 0 , "NOTE_INSN_DELETED",
- "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
- "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
- "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP",
- "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
- "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
- "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
- "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END",
- "NOTE_REPEATED_LINE_NUMBER" };
-
-char *reg_note_name[] = { "", "REG_DEAD", "REG_INC", "REG_EQUIV", "REG_WAS_0",
- "REG_EQUAL", "REG_RETVAL", "REG_LIBCALL",
- "REG_NONNEG", "REG_NO_CONFLICT", "REG_UNUSED",
- "REG_CC_SETTER", "REG_CC_USER", "REG_LABEL",
- "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB",
- "REG_EXEC_COUNT" };
-
-/* Allocate an rtx vector of N elements.
- Store the length, and initialize all elements to zero. */
-
-rtvec
-rtvec_alloc (n)
- int n;
-{
- rtvec rt;
- int i;
-
- rt = (rtvec) obstack_alloc (rtl_obstack,
- sizeof (struct rtvec_def)
- + (( n - 1) * sizeof (rtunion)));
-
- /* clear out the vector */
- PUT_NUM_ELEM (rt, n);
-
- for (i = 0; i < n; i++)
- rt->elem[i].rtwint = 0;
-
- return rt;
-}
-
-/* Allocate an rtx of code CODE. The CODE is stored in the rtx;
- all the rest is initialized to zero. */
-
-rtx
-rtx_alloc (code)
- RTX_CODE code;
-{
- rtx rt;
- register struct obstack *ob = rtl_obstack;
- register int nelts = GET_RTX_LENGTH (code);
- register int length = sizeof (struct rtx_def)
- + (nelts - 1) * sizeof (rtunion);
-
- /* This function is called more than any other in GCC,
- so we manipulate the obstack directly.
-
- Even though rtx objects are word aligned, we may be sharing an obstack
- with tree nodes, which may have to be double-word aligned. So align
- our length to the alignment mask in the obstack. */
-
- length = (length + ob->alignment_mask) & ~ ob->alignment_mask;
-
- if (ob->chunk_limit - ob->next_free < length)
- _obstack_newchunk (ob, length);
- rt = (rtx)ob->object_base;
- ob->next_free += length;
- ob->object_base = ob->next_free;
-
- /* We want to clear everything up to the FLD array. Normally, this is
- one int, but we don't want to assume that and it isn't very portable
- anyway; this is. */
-
- length = (sizeof (struct rtx_def) - sizeof (rtunion) - 1) / sizeof (int);
- for (; length >= 0; length--)
- ((int *) rt)[length] = 0;
-
- PUT_CODE (rt, code);
-
- return rt;
-}
-
-/* Free the rtx X and all RTL allocated since X. */
-
-void
-rtx_free (x)
- rtx x;
-{
- obstack_free (rtl_obstack, x);
-}
-
-/* Create a new copy of an rtx.
- Recursively copies the operands of the rtx,
- except for those few rtx codes that are sharable. */
-
-rtx
-copy_rtx (orig)
- register rtx orig;
-{
- register rtx copy;
- register int i, j;
- register RTX_CODE code;
- register char *format_ptr;
-
- code = GET_CODE (orig);
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- case SCRATCH:
- /* SCRATCH must be shared because they represent distinct values. */
- return orig;
-
- case CONST:
- /* CONST can be shared if it contains a SYMBOL_REF. If it contains
- a LABEL_REF, it isn't sharable. */
- if (GET_CODE (XEXP (orig, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
- && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
- return orig;
- break;
-
- /* A MEM with a constant address is not sharable. The problem is that
- the constant address may need to be reloaded. If the mem is shared,
- then reloading one copy of this mem will cause all copies to appear
- to have been reloaded. */
- }
-
- copy = rtx_alloc (code);
- PUT_MODE (copy, GET_MODE (orig));
- copy->in_struct = orig->in_struct;
- copy->volatil = orig->volatil;
- copy->unchanging = orig->unchanging;
- copy->integrated = orig->integrated;
-
- format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- XEXP (copy, i) = XEXP (orig, i);
- if (XEXP (orig, i) != NULL)
- XEXP (copy, i) = copy_rtx (XEXP (orig, i));
- break;
-
- case '0':
- case 'u':
- XEXP (copy, i) = XEXP (orig, i);
- break;
-
- case 'E':
- case 'V':
- XVEC (copy, i) = XVEC (orig, i);
- if (XVEC (orig, i) != NULL)
- {
- XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
- for (j = 0; j < XVECLEN (copy, i); j++)
- XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j));
- }
- break;
-
- case 'w':
- XWINT (copy, i) = XWINT (orig, i);
- break;
-
- case 'i':
- XINT (copy, i) = XINT (orig, i);
- break;
-
- case 's':
- case 'S':
- XSTR (copy, i) = XSTR (orig, i);
- break;
-
- default:
- abort ();
- }
- }
- return copy;
-}
-
-/* Similar to `copy_rtx' except that if MAY_SHARE is present, it is
- placed in the result directly, rather than being copied. */
-
-rtx
-copy_most_rtx (orig, may_share)
- register rtx orig;
- register rtx may_share;
-{
- register rtx copy;
- register int i, j;
- register RTX_CODE code;
- register char *format_ptr;
-
- if (orig == may_share)
- return orig;
-
- code = GET_CODE (orig);
-
- switch (code)
- {
- case REG:
- case QUEUED:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CODE_LABEL:
- case PC:
- case CC0:
- return orig;
- }
-
- copy = rtx_alloc (code);
- PUT_MODE (copy, GET_MODE (orig));
- copy->in_struct = orig->in_struct;
- copy->volatil = orig->volatil;
- copy->unchanging = orig->unchanging;
- copy->integrated = orig->integrated;
-
- format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- XEXP (copy, i) = XEXP (orig, i);
- if (XEXP (orig, i) != NULL && XEXP (orig, i) != may_share)
- XEXP (copy, i) = copy_most_rtx (XEXP (orig, i), may_share);
- break;
-
- case '0':
- case 'u':
- XEXP (copy, i) = XEXP (orig, i);
- break;
-
- case 'E':
- case 'V':
- XVEC (copy, i) = XVEC (orig, i);
- if (XVEC (orig, i) != NULL)
- {
- XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
- for (j = 0; j < XVECLEN (copy, i); j++)
- XVECEXP (copy, i, j)
- = copy_most_rtx (XVECEXP (orig, i, j), may_share);
- }
- break;
-
- case 'w':
- XWINT (copy, i) = XWINT (orig, i);
- break;
-
- case 'n':
- case 'i':
- XINT (copy, i) = XINT (orig, i);
- break;
-
- case 's':
- case 'S':
- XSTR (copy, i) = XSTR (orig, i);
- break;
-
- default:
- abort ();
- }
- }
- return copy;
-}
-
-/* Subroutines of read_rtx. */
-
-/* Dump code after printing a message. Used when read_rtx finds
- invalid data. */
-
-static void
-dump_and_abort (expected_c, actual_c, infile)
- int expected_c, actual_c;
- FILE *infile;
-{
- int c, i;
-
- if (expected_c >= 0)
- fprintf (stderr,
- "Expected character %c. Found character %c.",
- expected_c, actual_c);
- fprintf (stderr, " At file position: %ld\n", ftell (infile));
- fprintf (stderr, "Following characters are:\n\t");
- for (i = 0; i < 200; i++)
- {
- c = getc (infile);
- if (EOF == c) break;
- putc (c, stderr);
- }
- fprintf (stderr, "Aborting.\n");
- abort ();
-}
-
-/* Read chars from INFILE until a non-whitespace char
- and return that. Comments, both Lisp style and C style,
- are treated as whitespace.
- Tools such as genflags use this function. */
-
-int
-read_skip_spaces (infile)
- FILE *infile;
-{
- register int c;
- while (c = getc (infile))
- {
- if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
- ;
- else if (c == ';')
- {
- while ((c = getc (infile)) && c != '\n') ;
- }
- else if (c == '/')
- {
- register int prevc;
- c = getc (infile);
- if (c != '*')
- dump_and_abort ('*', c, infile);
-
- prevc = 0;
- while (c = getc (infile))
- {
- if (prevc == '*' && c == '/')
- break;
- prevc = c;
- }
- }
- else break;
- }
- return c;
-}
-
-/* Read an rtx code name into the buffer STR[].
- It is terminated by any of the punctuation chars of rtx printed syntax. */
-
-static void
-read_name (str, infile)
- char *str;
- FILE *infile;
-{
- register char *p;
- register int c;
-
- c = read_skip_spaces(infile);
-
- p = str;
- while (1)
- {
- if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
- break;
- if (c == ':' || c == ')' || c == ']' || c == '"' || c == '/'
- || c == '(' || c == '[')
- {
- ungetc (c, infile);
- break;
- }
- *p++ = c;
- c = getc (infile);
- }
- if (p == str)
- {
- fprintf (stderr, "missing name or number");
- dump_and_abort (-1, -1, infile);
- }
-
- *p = 0;
-}
-
-/* Read an rtx in printed representation from INFILE
- and return an actual rtx in core constructed accordingly.
- read_rtx is not used in the compiler proper, but rather in
- the utilities gen*.c that construct C code from machine descriptions. */
-
-rtx
-read_rtx (infile)
- FILE *infile;
-{
- register int i, j, list_counter;
- RTX_CODE tmp_code;
- register char *format_ptr;
- /* tmp_char is a buffer used for reading decimal integers
- and names of rtx types and machine modes.
- Therefore, 256 must be enough. */
- char tmp_char[256];
- rtx return_rtx;
- register int c;
- int tmp_int;
- HOST_WIDE_INT tmp_wide;
-
- /* Linked list structure for making RTXs: */
- struct rtx_list
- {
- struct rtx_list *next;
- rtx value; /* Value of this node... */
- };
-
- c = read_skip_spaces (infile); /* Should be open paren. */
- if (c != '(')
- dump_and_abort ('(', c, infile);
-
- read_name (tmp_char, infile);
-
- tmp_code = UNKNOWN;
-
- for (i=0; i < NUM_RTX_CODE; i++) /* @@ might speed this search up */
- {
- if (!(strcmp (tmp_char, GET_RTX_NAME (i))))
- {
- tmp_code = (RTX_CODE) i; /* get value for name */
- break;
- }
- }
- if (tmp_code == UNKNOWN)
- {
- fprintf (stderr,
- "Unknown rtx read in rtl.read_rtx(). Code name was %s .",
- tmp_char);
- }
- /* (NIL) stands for an expression that isn't there. */
- if (tmp_code == NIL)
- {
- /* Discard the closeparen. */
- while ((c = getc (infile)) && c != ')');
- return 0;
- }
-
- return_rtx = rtx_alloc (tmp_code); /* if we end up with an insn expression
- then we free this space below. */
- format_ptr = GET_RTX_FORMAT (GET_CODE (return_rtx));
-
- /* If what follows is `: mode ', read it and
- store the mode in the rtx. */
-
- i = read_skip_spaces (infile);
- if (i == ':')
- {
- register int k;
- read_name (tmp_char, infile);
- for (k = 0; k < NUM_MACHINE_MODES; k++)
- if (!strcmp (GET_MODE_NAME (k), tmp_char))
- break;
-
- PUT_MODE (return_rtx, (enum machine_mode) k );
- }
- else
- ungetc (i, infile);
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (return_rtx)); i++)
- switch (*format_ptr++)
- {
- /* 0 means a field for internal use only.
- Don't expect it to be present in the input. */
- case '0':
- break;
-
- case 'e':
- case 'u':
- XEXP (return_rtx, i) = read_rtx (infile);
- break;
-
- case 'V':
- /* 'V' is an optional vector: if a closeparen follows,
- just store NULL for this element. */
- c = read_skip_spaces (infile);
- ungetc (c, infile);
- if (c == ')')
- {
- XVEC (return_rtx, i) = 0;
- break;
- }
- /* Now process the vector. */
-
- case 'E':
- {
- register struct rtx_list *next_rtx, *rtx_list_link;
- struct rtx_list *list_rtx;
-
- c = read_skip_spaces (infile);
- if (c != '[')
- dump_and_abort ('[', c, infile);
-
- /* add expressions to a list, while keeping a count */
- next_rtx = NULL;
- list_counter = 0;
- while ((c = read_skip_spaces (infile)) && c != ']')
- {
- ungetc (c, infile);
- list_counter++;
- rtx_list_link = (struct rtx_list *)
- alloca (sizeof (struct rtx_list));
- rtx_list_link->value = read_rtx (infile);
- if (next_rtx == 0)
- list_rtx = rtx_list_link;
- else
- next_rtx->next = rtx_list_link;
- next_rtx = rtx_list_link;
- rtx_list_link->next = 0;
- }
- /* get vector length and allocate it */
- XVEC (return_rtx, i) = (list_counter
- ? rtvec_alloc (list_counter) : NULL_RTVEC);
- if (list_counter > 0)
- {
- next_rtx = list_rtx;
- for (j = 0; j < list_counter; j++,
- next_rtx = next_rtx->next)
- XVECEXP (return_rtx, i, j) = next_rtx->value;
- }
- /* close bracket gotten */
- }
- break;
-
- case 'S':
- /* 'S' is an optional string: if a closeparen follows,
- just store NULL for this element. */
- c = read_skip_spaces (infile);
- ungetc (c, infile);
- if (c == ')')
- {
- XSTR (return_rtx, i) = 0;
- break;
- }
-
- case 's':
- {
- int saw_paren = 0;
- register char *stringbuf;
-
- c = read_skip_spaces (infile);
- if (c == '(')
- {
- saw_paren = 1;
- c = read_skip_spaces (infile);
- }
- if (c != '"')
- dump_and_abort ('"', c, infile);
-
- while (1)
- {
- c = getc (infile); /* Read the string */
- if (c == '\\')
- {
- c = getc (infile); /* Read the string */
- /* \; makes stuff for a C string constant containing
- newline and tab. */
- if (c == ';')
- {
- obstack_grow (rtl_obstack, "\\n\\t", 4);
- continue;
- }
- }
- else if (c == '"')
- break;
-
- obstack_1grow (rtl_obstack, c);
- }
-
- obstack_1grow (rtl_obstack, 0);
- stringbuf = (char *) obstack_finish (rtl_obstack);
-
- if (saw_paren)
- {
- c = read_skip_spaces (infile);
- if (c != ')')
- dump_and_abort (')', c, infile);
- }
- XSTR (return_rtx, i) = stringbuf;
- }
- break;
-
- case 'w':
- read_name (tmp_char, infile);
-#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
- tmp_wide = atoi (tmp_char);
-#else
- tmp_wide = atol (tmp_char);
-#endif
- XWINT (return_rtx, i) = tmp_wide;
- break;
-
- case 'i':
- case 'n':
- read_name (tmp_char, infile);
- tmp_int = atoi (tmp_char);
- XINT (return_rtx, i) = tmp_int;
- break;
-
- default:
- fprintf (stderr,
- "switch format wrong in rtl.read_rtx(). format was: %c.\n",
- format_ptr[-1]);
- fprintf (stderr, "\tfile position: %ld\n", ftell (infile));
- abort ();
- }
-
- c = read_skip_spaces (infile);
- if (c != ')')
- dump_and_abort (')', c, infile);
-
- return return_rtx;
-}
-
-/* This is called once per compilation, before any rtx's are constructed.
- It initializes the vector `rtx_length', the extra CC modes, if any,
- and computes certain commonly-used modes. */
-
-void
-init_rtl ()
-{
- int min_class_size[(int) MAX_MODE_CLASS];
- enum machine_mode mode;
- int i;
-
- for (i = 0; i < NUM_RTX_CODE; i++)
- rtx_length[i] = strlen (rtx_format[i]);
-
- /* Make CONST_DOUBLE bigger, if real values are bigger than
- it normally expects to have room for.
- Note that REAL_VALUE_TYPE is not defined by default,
- since tree.h is not included. But the default dfn as `double'
- would do no harm. */
-#ifdef REAL_VALUE_TYPE
- i = sizeof (REAL_VALUE_TYPE) / sizeof (rtunion) + 2;
- if (rtx_length[(int) CONST_DOUBLE] < i)
- {
- char *s = (char *) xmalloc (i + 1);
- rtx_length[(int) CONST_DOUBLE] = i;
- rtx_format[(int) CONST_DOUBLE] = s;
- *s++ = 'e';
- *s++ = '0';
- /* Set the GET_RTX_FORMAT of CONST_DOUBLE to a string
- of as many `w's as we now have elements. Subtract two from
- the size to account for the 'e' and the '0'. */
- for (i = 2; i < rtx_length[(int) CONST_DOUBLE]; i++)
- *s++ = 'w';
- *s++ = 0;
- }
-#endif
-
-#ifdef EXTRA_CC_MODES
- for (i = (int) CCmode + 1; i < (int) MAX_MACHINE_MODE; i++)
- {
- mode_class[i] = MODE_CC;
- mode_size[i] = mode_size[(int) CCmode];
- mode_unit_size[i] = mode_unit_size[(int) CCmode];
- mode_wider_mode[i - 1] = (enum machine_mode) i;
- mode_wider_mode[i] = VOIDmode;
- }
-#endif
-
- /* Find the narrowest mode for each class. */
-
- for (i = 0; i < (int) MAX_MODE_CLASS; i++)
- min_class_size[i] = 1000;
-
- for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
- mode = (enum machine_mode) ((int) mode + 1))
- {
- if (GET_MODE_SIZE (mode) < min_class_size[(int) GET_MODE_CLASS (mode)])
- {
- class_narrowest_mode[(int) GET_MODE_CLASS (mode)] = mode;
- min_class_size[(int) GET_MODE_CLASS (mode)] = GET_MODE_SIZE (mode);
- }
- }
-}
-
-#ifdef memset
-gcc_memset (dest, value, len)
- char *dest;
- int value;
- int len;
-{
- while (len-- > 0)
- *dest++ = value;
-}
-#endif /* memset */
diff --git a/gcc/rtl.def b/gcc/rtl.def
deleted file mode 100644
index ac51b6d50f7..00000000000
--- a/gcc/rtl.def
+++ /dev/null
@@ -1,764 +0,0 @@
-/* This file contains the definitions and documentation for the
- Register Transfer Expressions (rtx's) that make up the
- Register Transfer Language (rtl) used in the Back End of the GNU compiler.
- Copyright (C) 1987, 1988, 1992, 1994, 1995 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. */
-
-
-/* Expression definitions and descriptions for all targets are in this file.
- Some will not be used for some targets.
-
- The fields in the cpp macro call "DEF_RTL_EXPR()"
- are used to create declarations in the C source of the compiler.
-
- The fields are:
-
- 1. The internal name of the rtx used in the C source.
- It is a tag in the enumeration "enum rtx_code" defined in "rtl.h".
- By convention these are in UPPER_CASE.
-
- 2. The name of the rtx in the external ASCII format read by
- read_rtx(), and printed by print_rtx().
- These names are stored in rtx_name[].
- By convention these are the internal (field 1) names in lower_case.
-
- 3. The print format, and type of each rtx->fld[] (field) in this rtx.
- These formats are stored in rtx_format[].
- The meaning of the formats is documented in front of this array in rtl.c
-
- 4. The class of the rtx. These are stored in rtx_class and are accessed
- via the GET_RTX_CLASS macro. They are defined as follows:
-
- "o" an rtx code that can be used to represent an object (e.g, REG, MEM)
- "<" an rtx code for a comparison (e.g, EQ, NE, LT)
- "1" an rtx code for a unary arithmetic expression (e.g, NEG, NOT)
- "c" an rtx code for a commutative binary operation (e.g,, PLUS, MULT)
- "3" an rtx code for a non-bitfield three input operation (IF_THEN_ELSE)
- "2" an rtx code for a non-commutative binary operation (e.g., MINUS, DIV)
- "b" an rtx code for a bit-field operation (ZERO_EXTRACT, SIGN_EXTRACT)
- "i" an rtx code for a machine insn (INSN, JUMP_INSN, CALL_INSN)
- "m" an rtx code for something that matches in insns (e.g, MATCH_DUP)
- "x" everything else
-
- */
-
-/* ---------------------------------------------------------------------
- Expressions (and "meta" expressions) used for structuring the
- rtl representation of a program.
- --------------------------------------------------------------------- */
-
-/* an expression code name unknown to the reader */
-DEF_RTL_EXPR(UNKNOWN, "UnKnown", "*", 'x')
-
-/* (NIL) is used by rtl reader and printer to represent a null pointer. */
-
-DEF_RTL_EXPR(NIL, "nil", "*", 'x')
-
-/* ---------------------------------------------------------------------
- Expressions used in constructing lists.
- --------------------------------------------------------------------- */
-
-/* a linked list of expressions */
-DEF_RTL_EXPR(EXPR_LIST, "expr_list", "ee", 'x')
-
-/* a linked list of instructions.
- The insns are represented in print by their uids. */
-DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue", 'x')
-
-/* ----------------------------------------------------------------------
- Expression types for machine descriptions.
- These do not appear in actual rtl code in the compiler.
- ---------------------------------------------------------------------- */
-
-/* Appears only in machine descriptions.
- Means use the function named by the second arg (the string)
- as a predicate; if matched, store the structure that was matched
- in the operand table at index specified by the first arg (the integer).
- If the second arg is the null string, the structure is just stored.
-
- A third string argument indicates to the register allocator restrictions
- on where the operand can be allocated.
-
- If the target needs no restriction on any instruction this field should
- be the null string.
-
- The string is prepended by:
- '=' to indicate the operand is only written to.
- '+' to indicate the operand is both read and written to.
-
- Each character in the string represents an allocatable class for an operand.
- 'g' indicates the operand can be any valid class.
- 'i' indicates the operand can be immediate (in the instruction) data.
- 'r' indicates the operand can be in a register.
- 'm' indicates the operand can be in memory.
- 'o' a subset of the 'm' class. Those memory addressing modes that
- can be offset at compile time (have a constant added to them).
-
- Other characters indicate target dependent operand classes and
- are described in each target's machine description.
-
- For instructions with more than one operand, sets of classes can be
- separated by a comma to indicate the appropriate multi-operand constraints.
- There must be a 1 to 1 correspondence between these sets of classes in
- all operands for an instruction.
- */
-DEF_RTL_EXPR(MATCH_OPERAND, "match_operand", "iss", 'm')
-
-/* Appears only in machine descriptions.
- Means match a SCRATCH or a register. When used to generate rtl, a
- SCRATCH is generated. As for MATCH_OPERAND, the mode specifies
- the desired mode and the first argument is the operand number.
- The second argument is the constraint. */
-DEF_RTL_EXPR(MATCH_SCRATCH, "match_scratch", "is", 'm')
-
-/* Appears only in machine descriptions.
- Means match only something equal to what is stored in the operand table
- at the index specified by the argument. */
-DEF_RTL_EXPR(MATCH_DUP, "match_dup", "i", 'm')
-
-/* Appears only in machine descriptions.
- Means apply a predicate, AND match recursively the operands of the rtx.
- Operand 0 is the operand-number, as in match_operand.
- Operand 1 is a predicate to apply (as a string, a function name).
- Operand 2 is a vector of expressions, each of which must match
- one subexpression of the rtx this construct is matching. */
-DEF_RTL_EXPR(MATCH_OPERATOR, "match_operator", "isE", 'm')
-
-/* Appears only in machine descriptions.
- Means to match a PARALLEL of arbitrary length. The predicate is applied
- to the PARALLEL and the initial expressions in the PARALLEL are matched.
- Operand 0 is the operand-number, as in match_operand.
- Operand 1 is a predicate to apply to the PARALLEL.
- Operand 2 is a vector of expressions, each of which must match the
- corresponding element in the PARALLEL. */
-DEF_RTL_EXPR(MATCH_PARALLEL, "match_parallel", "isE", 'm')
-
-/* Appears only in machine descriptions.
- Means match only something equal to what is stored in the operand table
- at the index specified by the argument. For MATCH_OPERATOR. */
-DEF_RTL_EXPR(MATCH_OP_DUP, "match_op_dup", "iE", 'm')
-
-/* Appears only in machine descriptions.
- Means match only something equal to what is stored in the operand table
- at the index specified by the argument. For MATCH_PARALLEL. */
-DEF_RTL_EXPR(MATCH_PAR_DUP, "match_par_dup", "iE", 'm')
-
-/* Appears only in machine descriptions.
- Defines the pattern for one kind of instruction.
- Operand:
- 0: names this instruction.
- If the name is the null string, the instruction is in the
- machine description just to be recognized, and will never be emitted by
- the tree to rtl expander.
- 1: is the pattern.
- 2: is a string which is a C expression
- giving an additional condition for recognizing this pattern.
- A null string means no extra condition.
- 3: is the action to execute if this pattern is matched.
- If this assembler code template starts with a * then it is a fragment of
- C code to run to decide on a template to use. Otherwise, it is the
- template to use.
- 4: optionally, a vector of attributes for this insn.
- */
-DEF_RTL_EXPR(DEFINE_INSN, "define_insn", "sEssV", 'x')
-
-/* Definition of a peephole optimization.
- 1st operand: vector of insn patterns to match
- 2nd operand: C expression that must be true
- 3rd operand: template or C code to produce assembler output.
- 4: optionally, a vector of attributes for this insn.
- */
-DEF_RTL_EXPR(DEFINE_PEEPHOLE, "define_peephole", "EssV", 'x')
-
-/* Definition of a split operation.
- 1st operand: insn pattern to match
- 2nd operand: C expression that must be true
- 3rd operand: vector of insn patterns to place into a SEQUENCE
- 4th operand: optionally, some C code to execute before generating the
- insns. This might, for example, create some RTX's and store them in
- elements of `recog_operand' for use by the vector of insn-patterns.
- (`operands' is an alias here for `recog_operand'). */
-DEF_RTL_EXPR(DEFINE_SPLIT, "define_split", "EsES", 'x')
-
-/* Definition of a combiner pattern.
- Operands not defined yet. */
-DEF_RTL_EXPR(DEFINE_COMBINE, "define_combine", "Ess", 'x')
-
-/* Define how to generate multiple insns for a standard insn name.
- 1st operand: the insn name.
- 2nd operand: vector of insn-patterns.
- Use match_operand to substitute an element of `recog_operand'.
- 3rd operand: C expression that must be true for this to be available.
- This may not test any operands.
- 4th operand: Extra C code to execute before generating the insns.
- This might, for example, create some RTX's and store them in
- elements of `recog_operand' for use by the vector of insn-patterns.
- (`operands' is an alias here for `recog_operand'). */
-DEF_RTL_EXPR(DEFINE_EXPAND, "define_expand", "sEss", 'x')
-
-/* Define a requirement for delay slots.
- 1st operand: Condition involving insn attributes that, if true,
- indicates that the insn requires the number of delay slots
- shown.
- 2nd operand: Vector whose length is the three times the number of delay
- slots required.
- Each entry gives three conditions, each involving attributes.
- The first must be true for an insn to occupy that delay slot
- location. The second is true for all insns that can be
- annulled if the branch is true and the third is true for all
- insns that can be annulled if the branch is false.
-
- Multiple DEFINE_DELAYs may be present. They indicate differing
- requirements for delay slots. */
-DEF_RTL_EXPR(DEFINE_DELAY, "define_delay", "eE", 'x')
-
-/* Define a set of insns that requires a function unit. This means that
- these insns produce their result after a delay and that there may be
- restrictions on the number of insns of this type that can be scheduled
- simultaneously.
-
- More than one DEFINE_FUNCTION_UNIT can be specified for a function unit.
- Each gives a set of operations and associated delays. The first three
- operands must be the same for each operation for the same function unit.
-
- All delays are specified in cycles.
-
- 1st operand: Name of function unit (mostly for documentation)
- 2nd operand: Number of identical function units in CPU
- 3rd operand: Total number of simultaneous insns that can execute on this
- function unit; 0 if unlimited.
- 4th operand: Condition involving insn attribute, that, if true, specifies
- those insns that this expression applies to.
- 5th operand: Constant delay after which insn result will be
- available.
- 6th operand: Delay until next insn can be scheduled on the function unit
- executing this operation. The meaning depends on whether or
- not the next operand is supplied.
- 7th operand: If this operand is not specified, the 6th operand gives the
- number of cycles after the instruction matching the 4th
- operand begins using the function unit until a subsequent
- insn can begin. A value of zero should be used for a
- unit with no issue constraints. If only one operation can
- be executed a time and the unit is busy for the entire time,
- the 3rd operand should be specified as 1, the 6th operand
- sould be specified as 0, and the 7th operand should not
- be specified.
-
- If this operand is specified, it is a list of attribute
- expressions. If an insn for which any of these expressions
- is true is currently executing on the function unit, the
- issue delay will be given by the 6th operand. Otherwise,
- the insn can be immediately scheduled (subject to the limit
- on the number of simultaneous operations executing on the
- unit.) */
-DEF_RTL_EXPR(DEFINE_FUNCTION_UNIT, "define_function_unit", "siieiiV", 'x')
-
-/* Define attribute computation for `asm' instructions. */
-DEF_RTL_EXPR(DEFINE_ASM_ATTRIBUTES, "define_asm_attributes", "V", 'x' )
-
-/* SEQUENCE appears in the result of a `gen_...' function
- for a DEFINE_EXPAND that wants to make several insns.
- Its elements are the bodies of the insns that should be made.
- `emit_insn' takes the SEQUENCE apart and makes separate insns. */
-DEF_RTL_EXPR(SEQUENCE, "sequence", "E", 'x')
-
-/* Refers to the address of its argument.
- This appears only in machine descriptions, indicating that
- any expression that would be acceptable as the operand of MEM
- should be matched. */
-DEF_RTL_EXPR(ADDRESS, "address", "e", 'm')
-
-/* ----------------------------------------------------------------------
- Expressions used for insn attributes. These also do not appear in
- actual rtl code in the compiler.
- ---------------------------------------------------------------------- */
-
-/* Definition of an insn attribute.
- 1st operand: name of the attribute
- 2nd operand: comma-separated list of possible attribute values
- 3rd operand: expression for the default value of the attribute. */
-DEF_RTL_EXPR(DEFINE_ATTR, "define_attr", "sse", 'x')
-
-/* Marker for the name of an attribute. */
-DEF_RTL_EXPR(ATTR, "attr", "s", 'x')
-
-/* For use in the last (optional) operand of DEFINE_INSN or DEFINE_PEEPHOLE and
- in DEFINE_ASM_INSN to specify an attribute to assign to insns matching that
- pattern.
-
- (set_attr "name" "value") is equivalent to
- (set (attr "name") (const_string "value")) */
-DEF_RTL_EXPR(SET_ATTR, "set_attr", "ss", 'x')
-
-/* In the last operand of DEFINE_INSN and DEFINE_PEEPHOLE, this can be used to
- specify that attribute values are to be assigned according to the
- alternative matched.
-
- The following three expressions are equivalent:
-
- (set (attr "att") (cond [(eq_attrq "alternative" "1") (const_string "a1")
- (eq_attrq "alternative" "2") (const_string "a2")]
- (const_string "a3")))
- (set_attr_alternative "att" [(const_string "a1") (const_string "a2")
- (const_string "a3")])
- (set_attr "att" "a1,a2,a3")
- */
-DEF_RTL_EXPR(SET_ATTR_ALTERNATIVE, "set_attr_alternative", "sE", 'x')
-
-/* A conditional expression true if the value of the specified attribute of
- the current insn equals the specified value. The first operand is the
- attribute name and the second is the comparison value. */
-DEF_RTL_EXPR(EQ_ATTR, "eq_attr", "ss", 'x')
-
-/* A conditional expression which is true if the specified flag is
- true for the insn being scheduled in reorg.
-
- genattr.c defines the following flags which can be tested by
- (attr_flag "foo") expressions in eligible_for_delay.
-
- forward, backward, very_likely, likely, very_unlikely, and unlikely. */
-
-DEF_RTL_EXPR (ATTR_FLAG, "attr_flag", "s", 'x')
-
-/* ----------------------------------------------------------------------
- Expression types used for things in the instruction chain.
-
- All formats must start with "iuu" to handle the chain.
- Each insn expression holds an rtl instruction and its semantics
- during back-end processing.
- See macros's in "rtl.h" for the meaning of each rtx->fld[].
-
- ---------------------------------------------------------------------- */
-
-/* An instruction that cannot jump. */
-DEF_RTL_EXPR(INSN, "insn", "iuueiee", 'i')
-
-/* An instruction that can possibly jump.
- Fields ( rtx->fld[] ) have exact same meaning as INSN's. */
-DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "iuueiee0", 'i')
-
-/* An instruction that can possibly call a subroutine
- but which will not change which instruction comes next
- in the current function.
- Field ( rtx->fld[7] ) is CALL_INSN_FUNCTION_USAGE.
- All other fields ( rtx->fld[] ) have exact same meaning as INSN's. */
-DEF_RTL_EXPR(CALL_INSN, "call_insn", "iuueieee", 'i')
-
-/* A marker that indicates that control will not flow through. */
-DEF_RTL_EXPR(BARRIER, "barrier", "iuu", 'x')
-
-/* Holds a label that is followed by instructions.
- Operand:
- 3: is a number that is unique in the entire compilation.
- 4: is the user-given name of the label, if any.
- 5: is used in jump.c for the use-count of the label.
- and in flow.c to point to the chain of label_ref's to this label. */
-DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuis0", 'x')
-
-/* Say where in the code a source line starts, for symbol table's sake.
- Contains a filename and a line number. Line numbers <= 0 are special:
- 0 is used in a dummy placed at the front of every function
- just so there will never be a need to delete the first insn;
- -1 indicates a dummy; insns to be deleted by flow analysis and combining
- are really changed to NOTEs with a number of -1.
- -2 means beginning of a name binding contour; output N_LBRAC.
- -3 means end of a contour; output N_RBRAC. */
-DEF_RTL_EXPR(NOTE, "note", "iuusn", 'x')
-
-/* INLINE_HEADER is use by inline function machinery. The information
- it contains helps to build the mapping function between the rtx's of
- the function to be inlined and the current function being expanded. */
-
-DEF_RTL_EXPR(INLINE_HEADER, "inline_header", "iuuuiiiiiieeiiEeEss", 'x')
-
-/* ----------------------------------------------------------------------
- Top level constituents of INSN, JUMP_INSN and CALL_INSN.
- ---------------------------------------------------------------------- */
-
-/* Several operations to be done in parallel. */
-DEF_RTL_EXPR(PARALLEL, "parallel", "E", 'x')
-
-/* A string that is passed through to the assembler as input.
- One can obviously pass comments through by using the
- assembler comment syntax.
- These occur in an insn all by themselves as the PATTERN.
- They also appear inside an ASM_OPERANDS
- as a convenient way to hold a string. */
-DEF_RTL_EXPR(ASM_INPUT, "asm_input", "s", 'x')
-
-/* An assembler instruction with operands.
- 1st operand is the instruction template.
- 2nd operand is the constraint for the output.
- 3rd operand is the number of the output this expression refers to.
- When an insn stores more than one value, a separate ASM_OPERANDS
- is made for each output; this integer distinguishes them.
- 4th is a vector of values of input operands.
- 5th is a vector of modes and constraints for the input operands.
- Each element is an ASM_INPUT containing a constraint string
- and whose mode indicates the mode of the input operand.
- 6th is the name of the containing source file.
- 7th is the source line number. */
-DEF_RTL_EXPR(ASM_OPERANDS, "asm_operands", "ssiEEsi", 'x')
-
-/* A machine-specific operation.
- 1st operand is a vector of operands being used by the operation so that
- any needed reloads can be done.
- 2nd operand is a unique value saying which of a number of machine-specific
- operations is to be performed.
- (Note that the vector must be the first operand because of the way that
- genrecog.c record positions within an insn.)
- This can occur all by itself in a PATTERN, as a component of a PARALLEL,
- or inside an expression. */
-DEF_RTL_EXPR(UNSPEC, "unspec", "Ei", 'x')
-
-/* Similar, but a volatile operation and one which may trap. */
-DEF_RTL_EXPR(UNSPEC_VOLATILE, "unspec_volatile", "Ei", 'x')
-
-/* Vector of addresses, stored as full words. */
-/* Each element is a LABEL_REF to a CODE_LABEL whose address we want. */
-DEF_RTL_EXPR(ADDR_VEC, "addr_vec", "E", 'x')
-
-/* Vector of address differences X0 - BASE, X1 - BASE, ...
- First operand is BASE; the vector contains the X's.
- The machine mode of this rtx says how much space to leave
- for each difference. */
-DEF_RTL_EXPR(ADDR_DIFF_VEC, "addr_diff_vec", "eE", 'x')
-
-/* ----------------------------------------------------------------------
- At the top level of an instruction (perhaps under PARALLEL).
- ---------------------------------------------------------------------- */
-
-/* Assignment.
- Operand 1 is the location (REG, MEM, PC, CC0 or whatever) assigned to.
- Operand 2 is the value stored there.
- ALL assignment must use SET.
- Instructions that do multiple assignments must use multiple SET,
- under PARALLEL. */
-DEF_RTL_EXPR(SET, "set", "ee", 'x')
-
-/* Indicate something is used in a way that we don't want to explain.
- For example, subroutine calls will use the register
- in which the static chain is passed. */
-DEF_RTL_EXPR(USE, "use", "e", 'x')
-
-/* Indicate something is clobbered in a way that we don't want to explain.
- For example, subroutine calls will clobber some physical registers
- (the ones that are by convention not saved). */
-DEF_RTL_EXPR(CLOBBER, "clobber", "e", 'x')
-
-/* Call a subroutine.
- Operand 1 is the address to call.
- Operand 2 is the number of arguments. */
-
-DEF_RTL_EXPR(CALL, "call", "ee", 'x')
-
-/* Return from a subroutine. */
-
-DEF_RTL_EXPR(RETURN, "return", "", 'x')
-
-/* Conditional trap.
- Operand 1 is the condition.
- Operand 2 is the trap code.
- For an unconditional trap, make the condition (const_int 1). */
-DEF_RTL_EXPR(TRAP_IF, "trap_if", "ei", 'x')
-
-/* ----------------------------------------------------------------------
- Primitive values for use in expressions.
- ---------------------------------------------------------------------- */
-
-/* numeric integer constant */
-DEF_RTL_EXPR(CONST_INT, "const_int", "w", 'o')
-
-/* numeric double constant.
- Operand 0 is the MEM that stores this constant in memory,
- or various other things (see comments at immed_double_const in varasm.c).
- Operand 1 is a chain of all CONST_DOUBLEs in use in the current function.
- Remaining operands hold the actual value.
- The number of operands may be more than 2 if cross-compiling;
- see init_rtl. */
-DEF_RTL_EXPR(CONST_DOUBLE, "const_double", "e0ww", 'o')
-
-/* String constant. Used only for attributes right now. */
-DEF_RTL_EXPR(CONST_STRING, "const_string", "s", 'o')
-
-/* This is used to encapsulate an expression whose value is constant
- (such as the sum of a SYMBOL_REF and a CONST_INT) so that it will be
- recognized as a constant operand rather than by arithmetic instructions. */
-
-DEF_RTL_EXPR(CONST, "const", "e", 'o')
-
-/* program counter. Ordinary jumps are represented
- by a SET whose first operand is (PC). */
-DEF_RTL_EXPR(PC, "pc", "", 'o')
-
-/* A register. The "operand" is the register number, accessed
- with the REGNO macro. If this number is less than FIRST_PSEUDO_REGISTER
- than a hardware register is being referred to. */
-DEF_RTL_EXPR(REG, "reg", "i", 'o')
-
-/* A scratch register. This represents a register used only within a
- single insn. It will be turned into a REG during register allocation
- or reload unless the constraint indicates that the register won't be
- needed, in which case it can remain a SCRATCH. This code is
- marked as having one operand so it can be turned into a REG. */
-DEF_RTL_EXPR(SCRATCH, "scratch", "0", 'o')
-
-/* One word of a multi-word value.
- The first operand is the complete value; the second says which word.
- The WORDS_BIG_ENDIAN flag controls whether word number 0
- (as numbered in a SUBREG) is the most or least significant word.
-
- This is also used to refer to a value in a different machine mode.
- For example, it can be used to refer to a SImode value as if it were
- Qimode, or vice versa. Then the word number is always 0. */
-DEF_RTL_EXPR(SUBREG, "subreg", "ei", 'x')
-
-/* This one-argument rtx is used for move instructions
- that are guaranteed to alter only the low part of a destination.
- Thus, (SET (SUBREG:HI (REG...)) (MEM:HI ...))
- has an unspecified effect on the high part of REG,
- but (SET (STRICT_LOW_PART (SUBREG:HI (REG...))) (MEM:HI ...))
- is guaranteed to alter only the bits of REG that are in HImode.
-
- The actual instruction used is probably the same in both cases,
- but the register constraints may be tighter when STRICT_LOW_PART
- is in use. */
-
-DEF_RTL_EXPR(STRICT_LOW_PART, "strict_low_part", "e", 'x')
-
-/* (CONCAT a b) represents the virtual concatenation of a and b
- to make a value that has as many bits as a and b put together.
- This is used for complex values. Normally it appears only
- in DECL_RTLs and during RTL generation, but not in the insn chain. */
-DEF_RTL_EXPR(CONCAT, "concat", "ee", 'o')
-
-/* A memory location; operand is the address.
- Can be nested inside a VOLATILE. */
-DEF_RTL_EXPR(MEM, "mem", "e", 'o')
-
-/* Reference to an assembler label in the code for this function.
- The operand is a CODE_LABEL found in the insn chain.
- The unprinted fields 1 and 2 are used in flow.c for the
- LABEL_NEXTREF and CONTAINING_INSN. */
-DEF_RTL_EXPR(LABEL_REF, "label_ref", "u00", 'o')
-
-/* Reference to a named label: the string that is the first operand,
- with `_' added implicitly in front.
- Exception: if the first character explicitly given is `*',
- to give it to the assembler, remove the `*' and do not add `_'. */
-DEF_RTL_EXPR(SYMBOL_REF, "symbol_ref", "s", 'o')
-
-/* The condition code register is represented, in our imagination,
- as a register holding a value that can be compared to zero.
- In fact, the machine has already compared them and recorded the
- results; but instructions that look at the condition code
- pretend to be looking at the entire value and comparing it. */
-DEF_RTL_EXPR(CC0, "cc0", "", 'o')
-
-/* =====================================================================
- A QUEUED expression really points to a member of the queue of instructions
- to be output later for postincrement/postdecrement.
- QUEUED expressions never become part of instructions.
- When a QUEUED expression would be put into an instruction,
- instead either the incremented variable or a copy of its previous
- value is used.
-
- Operands are:
- 0. the variable to be incremented (a REG rtx).
- 1. the incrementing instruction, or 0 if it hasn't been output yet.
- 2. A REG rtx for a copy of the old value of the variable, or 0 if none yet.
- 3. the body to use for the incrementing instruction
- 4. the next QUEUED expression in the queue.
- ====================================================================== */
-
-DEF_RTL_EXPR(QUEUED, "queued", "eeeee", 'x')
-
-/* ----------------------------------------------------------------------
- Expressions for operators in an rtl pattern
- ---------------------------------------------------------------------- */
-
-/* if_then_else. This is used in representing ordinary
- conditional jump instructions.
- Operand:
- 0: condition
- 1: then expr
- 2: else expr */
-DEF_RTL_EXPR(IF_THEN_ELSE, "if_then_else", "eee", '3')
-
-/* General conditional. The first operand is a vector composed of pairs of
- expressions. The first element of each pair is evaluated, in turn.
- The value of the conditional is the second expression of the first pair
- whose first expression evaluates non-zero. If none of the expressions is
- true, the second operand will be used as the value of the conditional.
-
- This should be replaced with use of IF_THEN_ELSE. */
-DEF_RTL_EXPR(COND, "cond", "Ee", 'x')
-
-/* Comparison, produces a condition code result. */
-DEF_RTL_EXPR(COMPARE, "compare", "ee", '2')
-
-/* plus */
-DEF_RTL_EXPR(PLUS, "plus", "ee", 'c')
-
-/* Operand 0 minus operand 1. */
-DEF_RTL_EXPR(MINUS, "minus", "ee", '2')
-
-/* Minus operand 0. */
-DEF_RTL_EXPR(NEG, "neg", "e", '1')
-
-DEF_RTL_EXPR(MULT, "mult", "ee", 'c')
-
-/* Operand 0 divided by operand 1. */
-DEF_RTL_EXPR(DIV, "div", "ee", '2')
-/* Remainder of operand 0 divided by operand 1. */
-DEF_RTL_EXPR(MOD, "mod", "ee", '2')
-
-/* Unsigned divide and remainder. */
-DEF_RTL_EXPR(UDIV, "udiv", "ee", '2')
-DEF_RTL_EXPR(UMOD, "umod", "ee", '2')
-
-/* Bitwise operations. */
-DEF_RTL_EXPR(AND, "and", "ee", 'c')
-
-DEF_RTL_EXPR(IOR, "ior", "ee", 'c')
-
-DEF_RTL_EXPR(XOR, "xor", "ee", 'c')
-
-DEF_RTL_EXPR(NOT, "not", "e", '1')
-
-/* Operand:
- 0: value to be shifted.
- 1: number of bits. */
-DEF_RTL_EXPR(ASHIFT, "ashift", "ee", '2')
-DEF_RTL_EXPR(ROTATE, "rotate", "ee", '2')
-
-/* Right shift operations, for machines where these are not the same
- as left shifting with a negative argument. */
-
-DEF_RTL_EXPR(ASHIFTRT, "ashiftrt", "ee", '2')
-DEF_RTL_EXPR(LSHIFTRT, "lshiftrt", "ee", '2')
-DEF_RTL_EXPR(ROTATERT, "rotatert", "ee", '2')
-
-/* Minimum and maximum values of two operands. We need both signed and
- unsigned forms. (We cannot use MIN for SMIN because it conflicts
- with a macro of the same name.) */
-
-DEF_RTL_EXPR(SMIN, "smin", "ee", 'c')
-DEF_RTL_EXPR(SMAX, "smax", "ee", 'c')
-DEF_RTL_EXPR(UMIN, "umin", "ee", 'c')
-DEF_RTL_EXPR(UMAX, "umax", "ee", 'c')
-
-/* These unary operations are used to represent incrementation
- and decrementation as they occur in memory addresses.
- The amount of increment or decrement are not represented
- because they can be understood from the machine-mode of the
- containing MEM. These operations exist in only two cases:
- 1. pushes onto the stack.
- 2. created automatically by the life_analysis pass in flow.c. */
-DEF_RTL_EXPR(PRE_DEC, "pre_dec", "e", 'x')
-DEF_RTL_EXPR(PRE_INC, "pre_inc", "e", 'x')
-DEF_RTL_EXPR(POST_DEC, "post_dec", "e", 'x')
-DEF_RTL_EXPR(POST_INC, "post_inc", "e", 'x')
-
-/* Comparison operations. The ordered comparisons exist in two
- flavors, signed and unsigned. */
-DEF_RTL_EXPR(NE, "ne", "ee", '<')
-DEF_RTL_EXPR(EQ, "eq", "ee", '<')
-DEF_RTL_EXPR(GE, "ge", "ee", '<')
-DEF_RTL_EXPR(GT, "gt", "ee", '<')
-DEF_RTL_EXPR(LE, "le", "ee", '<')
-DEF_RTL_EXPR(LT, "lt", "ee", '<')
-DEF_RTL_EXPR(GEU, "geu", "ee", '<')
-DEF_RTL_EXPR(GTU, "gtu", "ee", '<')
-DEF_RTL_EXPR(LEU, "leu", "ee", '<')
-DEF_RTL_EXPR(LTU, "ltu", "ee", '<')
-
-/* Represents the result of sign-extending the sole operand.
- The machine modes of the operand and of the SIGN_EXTEND expression
- determine how much sign-extension is going on. */
-DEF_RTL_EXPR(SIGN_EXTEND, "sign_extend", "e", '1')
-
-/* Similar for zero-extension (such as unsigned short to int). */
-DEF_RTL_EXPR(ZERO_EXTEND, "zero_extend", "e", '1')
-
-/* Similar but here the operand has a wider mode. */
-DEF_RTL_EXPR(TRUNCATE, "truncate", "e", '1')
-
-/* Similar for extending floating-point values (such as SFmode to DFmode). */
-DEF_RTL_EXPR(FLOAT_EXTEND, "float_extend", "e", '1')
-DEF_RTL_EXPR(FLOAT_TRUNCATE, "float_truncate", "e", '1')
-
-/* Conversion of fixed point operand to floating point value. */
-DEF_RTL_EXPR(FLOAT, "float", "e", '1')
-
-/* With fixed-point machine mode:
- Conversion of floating point operand to fixed point value.
- Value is defined only when the operand's value is an integer.
- With floating-point machine mode (and operand with same mode):
- Operand is rounded toward zero to produce an integer value
- represented in floating point. */
-DEF_RTL_EXPR(FIX, "fix", "e", '1')
-
-/* Conversion of unsigned fixed point operand to floating point value. */
-DEF_RTL_EXPR(UNSIGNED_FLOAT, "unsigned_float", "e", '1')
-
-/* With fixed-point machine mode:
- Conversion of floating point operand to *unsigned* fixed point value.
- Value is defined only when the operand's value is an integer. */
-DEF_RTL_EXPR(UNSIGNED_FIX, "unsigned_fix", "e", '1')
-
-/* Absolute value */
-DEF_RTL_EXPR(ABS, "abs", "e", '1')
-
-/* Square root */
-DEF_RTL_EXPR(SQRT, "sqrt", "e", '1')
-
-/* Find first bit that is set.
- Value is 1 + number of trailing zeros in the arg.,
- or 0 if arg is 0. */
-DEF_RTL_EXPR(FFS, "ffs", "e", '1')
-
-/* Reference to a signed bit-field of specified size and position.
- Operand 0 is the memory unit (usually SImode or QImode) which
- contains the field's first bit. Operand 1 is the width, in bits.
- Operand 2 is the number of bits in the memory unit before the
- first bit of this field.
- If BITS_BIG_ENDIAN is defined, the first bit is the msb and
- operand 2 counts from the msb of the memory unit.
- Otherwise, the first bit is the lsb and operand 2 counts from
- the lsb of the memory unit. */
-DEF_RTL_EXPR(SIGN_EXTRACT, "sign_extract", "eee", 'b')
-
-/* Similar for unsigned bit-field. */
-DEF_RTL_EXPR(ZERO_EXTRACT, "zero_extract", "eee", 'b')
-
-/* For RISC machines. These save memory when splitting insns. */
-
-/* HIGH are the high-order bits of a constant expression. */
-DEF_RTL_EXPR(HIGH, "high", "e", 'o')
-
-/* LO_SUM is the sum of a register and the low-order bits
- of a constant expression. */
-DEF_RTL_EXPR(LO_SUM, "lo_sum", "ee", 'o')
-
-/*
-Local variables:
-mode:c
-End:
-*/
diff --git a/gcc/rtl.h b/gcc/rtl.h
deleted file mode 100644
index 3ae3982d11e..00000000000
--- a/gcc/rtl.h
+++ /dev/null
@@ -1,960 +0,0 @@
-/* Register Transfer Language (RTL) definitions for GNU C-Compiler
- Copyright (C) 1987, 91-96, 1997 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. */
-
-
-#include "machmode.h"
-
-#undef FFS /* Some systems predefine this symbol; don't let it interfere. */
-#undef FLOAT /* Likewise. */
-#undef ABS /* Likewise. */
-#undef PC /* Likewise. */
-
-#ifndef TREE_CODE
-union tree_node;
-#endif
-
-/* Register Transfer Language EXPRESSIONS CODES */
-
-#define RTX_CODE enum rtx_code
-enum rtx_code {
-
-#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
-#include "rtl.def" /* rtl expressions are documented here */
-#undef DEF_RTL_EXPR
-
- LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for
- NUM_RTX_CODE.
- Assumes default enum value assignment. */
-
-#define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE)
- /* The cast here, saves many elsewhere. */
-
-extern int rtx_length[];
-#define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
-
-extern char *rtx_name[];
-#define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
-
-extern char *rtx_format[];
-#define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)])
-
-extern char rtx_class[];
-#define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)])
-
-/* Common union for an element of an rtx. */
-
-typedef union rtunion_def
-{
- HOST_WIDE_INT rtwint;
- int rtint;
- char *rtstr;
- struct rtx_def *rtx;
- struct rtvec_def *rtvec;
- enum machine_mode rttype;
-} rtunion;
-
-/* RTL expression ("rtx"). */
-
-typedef struct rtx_def
-{
-#ifdef ONLY_INT_FIELDS
-#ifdef CODE_FIELD_BUG
- unsigned int code : 16;
-#else
- unsigned short code;
-#endif
-#else
- /* The kind of expression this is. */
- enum rtx_code code : 16;
-#endif
- /* The kind of value the expression has. */
-#ifdef ONLY_INT_FIELDS
- int mode : 8;
-#else
- enum machine_mode mode : 8;
-#endif
- /* 1 in an INSN if it can alter flow of control
- within this function. Not yet used! */
- unsigned int jump : 1;
- /* 1 in an INSN if it can call another function. Not yet used! */
- unsigned int call : 1;
- /* 1 in a MEM or REG if value of this expression will never change
- during the current function, even though it is not
- manifestly constant.
- 1 in a SUBREG if it is from a promoted variable that is unsigned.
- 1 in a SYMBOL_REF if it addresses something in the per-function
- constants pool.
- 1 in a CALL_INSN if it is a const call.
- 1 in a JUMP_INSN if it is a branch that should be annulled. Valid from
- reorg until end of compilation; cleared before used. */
- unsigned int unchanging : 1;
- /* 1 in a MEM expression if contents of memory are volatile.
- 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL or BARRIER
- if it is deleted.
- 1 in a REG expression if corresponds to a variable declared by the user.
- 0 for an internally generated temporary.
- In a SYMBOL_REF, this flag is used for machine-specific purposes.
- In a LABEL_REF or in a REG_LABEL note, this is LABEL_REF_NONLOCAL_P. */
- unsigned int volatil : 1;
- /* 1 in a MEM referring to a field of a structure (not a union!).
- 0 if the MEM was a variable or the result of a * operator in C;
- 1 if it was the result of a . or -> operator (on a struct) in C.
- 1 in a REG if the register is used only in exit code a loop.
- 1 in a SUBREG expression if was generated from a variable with a
- promoted mode.
- 1 in a CODE_LABEL if the label is used for nonlocal gotos
- and must not be deleted even if its count is zero.
- 1 in a LABEL_REF if this is a reference to a label outside the
- current loop.
- 1 in an INSN, JUMP_INSN, or CALL_INSN if this insn must be scheduled
- together with the preceding insn. Valid only within sched.
- 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and
- from the target of a branch. Valid from reorg until end of compilation;
- cleared before used. */
- unsigned int in_struct : 1;
- /* 1 if this rtx is used. This is used for copying shared structure.
- See `unshare_all_rtl'.
- In a REG, this is not needed for that purpose, and used instead
- in `leaf_renumber_regs_insn'.
- In a SYMBOL_REF, means that emit_library_call
- has used it as the function. */
- unsigned int used : 1;
- /* Nonzero if this rtx came from procedure integration.
- In a REG, nonzero means this reg refers to the return value
- of the current function. */
- unsigned integrated : 1;
- /* Nonzero if this rtx is related to the call frame, either changing how
- we compute the frame address or saving and restoring registers in
- the prologue and epilogue. */
- unsigned frame_related : 1;
- /* The first element of the operands of this rtx.
- The number of operands and their types are controlled
- by the `code' field, according to rtl.def. */
- rtunion fld[1];
-} *rtx;
-
-#include "gansidecl.h"
-
-#define NULL_RTX (rtx) 0
-
-/* Define macros to access the `code' field of the rtx. */
-
-#ifdef SHORT_ENUM_BUG
-#define GET_CODE(RTX) ((enum rtx_code) ((RTX)->code))
-#define PUT_CODE(RTX, CODE) ((RTX)->code = ((short) (CODE)))
-#else
-#define GET_CODE(RTX) ((RTX)->code)
-#define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE))
-#endif
-
-#define GET_MODE(RTX) ((RTX)->mode)
-#define PUT_MODE(RTX, MODE) ((RTX)->mode = (MODE))
-
-#define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
-#define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
-#define RTX_FRAME_RELATED_P(RTX) ((RTX)->frame_related)
-
-/* RTL vector. These appear inside RTX's when there is a need
- for a variable number of things. The principle use is inside
- PARALLEL expressions. */
-
-typedef struct rtvec_def{
- unsigned num_elem; /* number of elements */
- rtunion elem[1];
-} *rtvec;
-
-#define NULL_RTVEC (rtvec) 0
-
-#define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem)
-#define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (unsigned) NUM)
-
-#define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[(I)].rtx)
-
-/* 1 if X is a REG. */
-
-#define REG_P(X) (GET_CODE (X) == REG)
-
-/* 1 if X is a constant value that is an integer. */
-
-#define CONSTANT_P(X) \
- (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST_DOUBLE \
- || GET_CODE (X) == CONST || GET_CODE (X) == HIGH)
-
-/* General accessor macros for accessing the fields of an rtx. */
-
-#define XEXP(RTX, N) ((RTX)->fld[N].rtx)
-#define XINT(RTX, N) ((RTX)->fld[N].rtint)
-#define XWINT(RTX, N) ((RTX)->fld[N].rtwint)
-#define XSTR(RTX, N) ((RTX)->fld[N].rtstr)
-#define XVEC(RTX, N) ((RTX)->fld[N].rtvec)
-#define XVECLEN(RTX, N) ((RTX)->fld[N].rtvec->num_elem)
-#define XVECEXP(RTX,N,M)((RTX)->fld[N].rtvec->elem[M].rtx)
-
-/* ACCESS MACROS for particular fields of insns. */
-
-/* Holds a unique number for each insn.
- These are not necessarily sequentially increasing. */
-#define INSN_UID(INSN) ((INSN)->fld[0].rtint)
-
-/* Chain insns together in sequence. */
-#define PREV_INSN(INSN) ((INSN)->fld[1].rtx)
-#define NEXT_INSN(INSN) ((INSN)->fld[2].rtx)
-
-/* The body of an insn. */
-#define PATTERN(INSN) ((INSN)->fld[3].rtx)
-
-/* Code number of instruction, from when it was recognized.
- -1 means this instruction has not been recognized yet. */
-#define INSN_CODE(INSN) ((INSN)->fld[4].rtint)
-
-/* Set up in flow.c; empty before then.
- Holds a chain of INSN_LIST rtx's whose first operands point at
- previous insns with direct data-flow connections to this one.
- That means that those insns set variables whose next use is in this insn.
- They are always in the same basic block as this insn. */
-#define LOG_LINKS(INSN) ((INSN)->fld[5].rtx)
-
-/* 1 if insn has been deleted. */
-#define INSN_DELETED_P(INSN) ((INSN)->volatil)
-
-/* 1 if insn is a call to a const function. */
-#define CONST_CALL_P(INSN) ((INSN)->unchanging)
-
-/* 1 if insn is a branch that should not unconditionally execute its
- delay slots, i.e., it is an annulled branch. */
-#define INSN_ANNULLED_BRANCH_P(INSN) ((INSN)->unchanging)
-
-/* 1 if insn is in a delay slot and is from the target of the branch. If
- the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
- executed if the branch is taken. For annulled branches with this bit
- clear, the insn should be executed only if the branch is not taken. */
-#define INSN_FROM_TARGET_P(INSN) ((INSN)->in_struct)
-
-/* Holds a list of notes on what this insn does to various REGs.
- It is a chain of EXPR_LIST rtx's, where the second operand
- is the chain pointer and the first operand is the REG being described.
- The mode field of the EXPR_LIST contains not a real machine mode
- but a value that says what this note says about the REG:
- REG_DEAD means that the value in REG dies in this insn (i.e., it is
- not needed past this insn). If REG is set in this insn, the REG_DEAD
- note may, but need not, be omitted.
- REG_INC means that the REG is autoincremented or autodecremented.
- REG_EQUIV describes the insn as a whole; it says that the insn
- sets a register to a constant value or to be equivalent to a memory
- address. If the register is spilled to the stack then the constant
- value should be substituted for it. The contents of the REG_EQUIV
- is the constant value or memory address, which may be different
- from the source of the SET although it has the same value. A
- REG_EQUIV note may also appear on an insn which copies a register
- parameter to a pseudo-register, if there is a memory address which
- could be used to hold that pseudo-register throughout the function.
- REG_EQUAL is like REG_EQUIV except that the destination
- is only momentarily equal to the specified rtx. Therefore, it
- cannot be used for substitution; but it can be used for cse.
- REG_RETVAL means that this insn copies the return-value of
- a library call out of the hard reg for return values. This note
- is actually an INSN_LIST and it points to the first insn involved
- in setting up arguments for the call. flow.c uses this to delete
- the entire library call when its result is dead.
- REG_LIBCALL is the inverse of REG_RETVAL: it goes on the first insn
- of the library call and points at the one that has the REG_RETVAL.
- REG_WAS_0 says that the register set in this insn held 0 before the insn.
- The contents of the note is the insn that stored the 0.
- If that insn is deleted or patched to a NOTE, the REG_WAS_0 is inoperative.
- The REG_WAS_0 note is actually an INSN_LIST, not an EXPR_LIST.
- REG_NONNEG means that the register is always nonnegative during
- the containing loop. This is used in branches so that decrement and
- branch instructions terminating on zero can be matched. There must be
- an insn pattern in the md file named `decrement_and_branch_until_zero'
- or else this will never be added to any instructions.
- REG_NO_CONFLICT means there is no conflict *after this insn*
- between the register in the note and the destination of this insn.
- REG_UNUSED identifies a register set in this insn and never used.
- REG_CC_SETTER and REG_CC_USER link a pair of insns that set and use
- CC0, respectively. Normally, these are required to be consecutive insns,
- but we permit putting a cc0-setting insn in the delay slot of a branch
- as long as only one copy of the insn exists. In that case, these notes
- point from one to the other to allow code generation to determine what
- any require information and to properly update CC_STATUS.
- REG_LABEL points to a CODE_LABEL. Used by non-JUMP_INSNs to
- say that the CODE_LABEL contained in the REG_LABEL note is used
- by the insn.
- REG_DEP_ANTI is used in LOG_LINKS which represent anti (write after read)
- dependencies. REG_DEP_OUTPUT is used in LOG_LINKS which represent output
- (write after write) dependencies. Data dependencies, which are the only
- type of LOG_LINK created by flow, are represented by a 0 reg note kind. */
-/* REG_BR_PROB is attached to JUMP_INSNs and CALL_INSNs when the flag
- -fbranch-probabilities is given. It has an integer value. For jumps,
- it is the probability that this is a taken branch. For calls, it is the
- probability that this call won't return.
- REG_EXEC_COUNT is attached to the first insn of each basic block, and
- the first insn after each CALL_INSN. It indicates how many times this
- block was executed. */
-
-#define REG_NOTES(INSN) ((INSN)->fld[6].rtx)
-
-/* Don't forget to change reg_note_name in rtl.c. */
-enum reg_note { REG_DEAD = 1, REG_INC = 2, REG_EQUIV = 3, REG_WAS_0 = 4,
- REG_EQUAL = 5, REG_RETVAL = 6, REG_LIBCALL = 7,
- REG_NONNEG = 8, REG_NO_CONFLICT = 9, REG_UNUSED = 10,
- REG_CC_SETTER = 11, REG_CC_USER = 12, REG_LABEL = 13,
- REG_DEP_ANTI = 14, REG_DEP_OUTPUT = 15, REG_BR_PROB = 16,
- REG_EXEC_COUNT = 17 };
-/* The base value for branch probability notes. */
-#define REG_BR_PROB_BASE 10000
-
-/* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */
-#define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK))
-#define PUT_REG_NOTE_KIND(LINK,KIND) PUT_MODE(LINK, (enum machine_mode) (KIND))
-
-/* Names for REG_NOTE's in EXPR_LIST insn's. */
-
-extern char *reg_note_name[];
-#define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)])
-
-/* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of
- USE and CLOBBER expressions.
- USE expressions list the registers filled with arguments that
- are passed to the function.
- CLOBBER expressions document the registers explicitly clobbered
- by this CALL_INSN.
- Pseudo registers can not be mentioned in this list. */
-#define CALL_INSN_FUNCTION_USAGE(INSN) ((INSN)->fld[7].rtx)
-
-/* The label-number of a code-label. The assembler label
- is made from `L' and the label-number printed in decimal.
- Label numbers are unique in a compilation. */
-#define CODE_LABEL_NUMBER(INSN) ((INSN)->fld[3].rtint)
-
-#define LINE_NUMBER NOTE
-
-/* In a NOTE that is a line number, this is a string for the file name
- that the line is in. We use the same field to record block numbers
- temporarily in NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes.
- (We avoid lots of casts between ints and pointers if we use a
- different macro for the bock number.) */
-
-#define NOTE_SOURCE_FILE(INSN) ((INSN)->fld[3].rtstr)
-#define NOTE_BLOCK_NUMBER(INSN) ((INSN)->fld[3].rtint)
-
-/* In a NOTE that is a line number, this is the line number.
- Other kinds of NOTEs are identified by negative numbers here. */
-#define NOTE_LINE_NUMBER(INSN) ((INSN)->fld[4].rtint)
-
-/* Codes that appear in the NOTE_LINE_NUMBER field
- for kinds of notes that are not line numbers.
-
- Notice that we do not try to use zero here for any of
- the special note codes because sometimes the source line
- actually can be zero! This happens (for example) when we
- are generating code for the per-translation-unit constructor
- and destructor routines for some C++ translation unit.
-
- If you should change any of the following values, or if you
- should add a new value here, don't forget to change the
- note_insn_name array in rtl.c. */
-
-/* This note is used to get rid of an insn
- when it isn't safe to patch the insn out of the chain. */
-#define NOTE_INSN_DELETED -1
-#define NOTE_INSN_BLOCK_BEG -2
-#define NOTE_INSN_BLOCK_END -3
-#define NOTE_INSN_LOOP_BEG -4
-#define NOTE_INSN_LOOP_END -5
-/* This kind of note is generated at the end of the function body,
- just before the return insn or return label.
- In an optimizing compilation it is deleted by the first jump optimization,
- after enabling that optimizer to determine whether control can fall
- off the end of the function body without a return statement. */
-#define NOTE_INSN_FUNCTION_END -6
-/* This kind of note is generated just after each call to `setjmp', et al. */
-#define NOTE_INSN_SETJMP -7
-/* Generated at the place in a loop that `continue' jumps to. */
-#define NOTE_INSN_LOOP_CONT -8
-/* Generated at the start of a duplicated exit test. */
-#define NOTE_INSN_LOOP_VTOP -9
-/* This marks the point immediately after the last prologue insn. */
-#define NOTE_INSN_PROLOGUE_END -10
-/* This marks the point immediately prior to the first epilogue insn. */
-#define NOTE_INSN_EPILOGUE_BEG -11
-/* Generated in place of user-declared labels when they are deleted. */
-#define NOTE_INSN_DELETED_LABEL -12
-/* This note indicates the start of the real body of the function,
- i.e. the point just after all of the parms have been moved into
- their homes, etc. */
-#define NOTE_INSN_FUNCTION_BEG -13
-/* These note where exception handling regions begin and end. */
-#define NOTE_INSN_EH_REGION_BEG -14
-#define NOTE_INSN_EH_REGION_END -15
-/* Generated whenever a duplicate line number note is output. For example,
- one is output after the end of an inline function, in order to prevent
- the line containing the inline call from being counted twice in gcov. */
-#define NOTE_REPEATED_LINE_NUMBER -16
-
-
-#if 0 /* These are not used, and I don't know what they were for. --rms. */
-#define NOTE_DECL_NAME(INSN) ((INSN)->fld[3].rtstr)
-#define NOTE_DECL_CODE(INSN) ((INSN)->fld[4].rtint)
-#define NOTE_DECL_RTL(INSN) ((INSN)->fld[5].rtx)
-#define NOTE_DECL_IDENTIFIER(INSN) ((INSN)->fld[6].rtint)
-#define NOTE_DECL_TYPE(INSN) ((INSN)->fld[7].rtint)
-#endif /* 0 */
-
-/* Names for NOTE insn's other than line numbers. */
-
-extern char *note_insn_name[];
-#define GET_NOTE_INSN_NAME(NOTE_CODE) (note_insn_name[-(NOTE_CODE)])
-
-/* The name of a label, in case it corresponds to an explicit label
- in the input source code. */
-#define LABEL_NAME(LABEL) ((LABEL)->fld[4].rtstr)
-
-/* In jump.c, each label contains a count of the number
- of LABEL_REFs that point at it, so unused labels can be deleted. */
-#define LABEL_NUSES(LABEL) ((LABEL)->fld[5].rtint)
-
-/* The rest is used instead of the above, in a CODE_LABEL,
- if bytecode is being output.
- We make the slightly kludgy assumption that a LABEL has enough slots
- to hold these things. That happens to be true. */
-
-/* For static or external objects. */
-#define BYTECODE_LABEL(X) (XEXP ((X), 0))
-
-/* For goto labels inside bytecode functions. */
-#define BYTECODE_BC_LABEL(X) (*(struct bc_label **) &XEXP ((X), 1))
-
-/* In jump.c, each JUMP_INSN can point to a label that it can jump to,
- so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
- be decremented and possibly the label can be deleted. */
-#define JUMP_LABEL(INSN) ((INSN)->fld[7].rtx)
-
-/* Once basic blocks are found in flow.c,
- each CODE_LABEL starts a chain that goes through
- all the LABEL_REFs that jump to that label.
- The chain eventually winds up at the CODE_LABEL; it is circular. */
-#define LABEL_REFS(LABEL) ((LABEL)->fld[5].rtx)
-
-/* This is the field in the LABEL_REF through which the circular chain
- of references to a particular label is linked.
- This chain is set up in flow.c. */
-
-#define LABEL_NEXTREF(REF) ((REF)->fld[1].rtx)
-
-/* Once basic blocks are found in flow.c,
- Each LABEL_REF points to its containing instruction with this field. */
-
-#define CONTAINING_INSN(RTX) ((RTX)->fld[2].rtx)
-
-/* For a REG rtx, REGNO extracts the register number. */
-
-#define REGNO(RTX) ((RTX)->fld[0].rtint)
-
-/* For a REG rtx, REG_FUNCTION_VALUE_P is nonzero if the reg
- is the current function's return value. */
-
-#define REG_FUNCTION_VALUE_P(RTX) ((RTX)->integrated)
-
-/* 1 in a REG rtx if it corresponds to a variable declared by the user. */
-#define REG_USERVAR_P(RTX) ((RTX)->volatil)
-
-/* For a CONST_INT rtx, INTVAL extracts the integer. */
-
-#define INTVAL(RTX) ((RTX)->fld[0].rtwint)
-
-/* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of.
- SUBREG_WORD extracts the word-number. */
-
-#define SUBREG_REG(RTX) ((RTX)->fld[0].rtx)
-#define SUBREG_WORD(RTX) ((RTX)->fld[1].rtint)
-
-/* 1 if the REG contained in SUBREG_REG is already known to be
- sign- or zero-extended from the mode of the SUBREG to the mode of
- the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the
- extension.
-
- When used as a LHS, is means that this extension must be done
- when assigning to SUBREG_REG. */
-
-#define SUBREG_PROMOTED_VAR_P(RTX) ((RTX)->in_struct)
-#define SUBREG_PROMOTED_UNSIGNED_P(RTX) ((RTX)->unchanging)
-
-/* Access various components of an ASM_OPERANDS rtx. */
-
-#define ASM_OPERANDS_TEMPLATE(RTX) XSTR ((RTX), 0)
-#define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XSTR ((RTX), 1)
-#define ASM_OPERANDS_OUTPUT_IDX(RTX) XINT ((RTX), 2)
-#define ASM_OPERANDS_INPUT_VEC(RTX) XVEC ((RTX), 3)
-#define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XVEC ((RTX), 4)
-#define ASM_OPERANDS_INPUT(RTX, N) XVECEXP ((RTX), 3, (N))
-#define ASM_OPERANDS_INPUT_LENGTH(RTX) XVECLEN ((RTX), 3)
-#define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) XSTR (XVECEXP ((RTX), 4, (N)), 0)
-#define ASM_OPERANDS_INPUT_MODE(RTX, N) GET_MODE (XVECEXP ((RTX), 4, (N)))
-#define ASM_OPERANDS_SOURCE_FILE(RTX) XSTR ((RTX), 5)
-#define ASM_OPERANDS_SOURCE_LINE(RTX) XINT ((RTX), 6)
-
-/* For a MEM rtx, 1 if it's a volatile reference.
- Also in an ASM_OPERANDS rtx. */
-#define MEM_VOLATILE_P(RTX) ((RTX)->volatil)
-
-/* For a MEM rtx, 1 if it refers to a structure or union component. */
-#define MEM_IN_STRUCT_P(RTX) ((RTX)->in_struct)
-
-/* For a LABEL_REF, 1 means that this reference is to a label outside the
- loop containing the reference. */
-#define LABEL_OUTSIDE_LOOP_P(RTX) ((RTX)->in_struct)
-
-/* For a LABEL_REF, 1 means it is for a nonlocal label. */
-/* Likewise in an EXPR_LIST for a REG_LABEL note. */
-#define LABEL_REF_NONLOCAL_P(RTX) ((RTX)->volatil)
-
-/* For a CODE_LABEL, 1 means always consider this label to be needed. */
-#define LABEL_PRESERVE_P(RTX) ((RTX)->in_struct)
-
-/* For a REG, 1 means the register is used only in an exit test of a loop. */
-#define REG_LOOP_TEST_P(RTX) ((RTX)->in_struct)
-
-/* During sched, for an insn, 1 means that the insn must be scheduled together
- with the preceding insn. */
-#define SCHED_GROUP_P(INSN) ((INSN)->in_struct)
-
-/* During sched, for the LOG_LINKS of an insn, these cache the adjusted
- cost of the dependence link. The cost of executing an instruction
- may vary based on how the results are used. LINK_COST_ZERO is 1 when
- the cost through the link varies and is unchanged (i.e., the link has
- zero additional cost). LINK_COST_FREE is 1 when the cost through the
- link is zero (i.e., the link makes the cost free). In other cases,
- the adjustment to the cost is recomputed each time it is needed. */
-#define LINK_COST_ZERO(X) ((X)->jump)
-#define LINK_COST_FREE(X) ((X)->call)
-
-/* For a SET rtx, SET_DEST is the place that is set
- and SET_SRC is the value it is set to. */
-#define SET_DEST(RTX) ((RTX)->fld[0].rtx)
-#define SET_SRC(RTX) ((RTX)->fld[1].rtx)
-
-/* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
-#define TRAP_CONDITION(RTX) ((RTX)->fld[0].rtx)
-
-/* 1 in a SYMBOL_REF if it addresses this function's constants pool. */
-#define CONSTANT_POOL_ADDRESS_P(RTX) ((RTX)->unchanging)
-
-/* Flag in a SYMBOL_REF for machine-specific purposes. */
-#define SYMBOL_REF_FLAG(RTX) ((RTX)->volatil)
-
-/* 1 means a SYMBOL_REF has been the library function in emit_library_call. */
-#define SYMBOL_REF_USED(RTX) ((RTX)->used)
-
-/* For an INLINE_HEADER rtx, FIRST_FUNCTION_INSN is the first insn
- of the function that is not involved in copying parameters to
- pseudo-registers. FIRST_PARM_INSN is the very first insn of
- the function, including the parameter copying.
- We keep this around in case we must splice
- this function into the assembly code at the end of the file.
- FIRST_LABELNO is the first label number used by the function (inclusive).
- LAST_LABELNO is the last label used by the function (exclusive).
- MAX_REGNUM is the largest pseudo-register used by that function.
- FUNCTION_ARGS_SIZE is the size of the argument block in the stack.
- POPS_ARGS is the number of bytes of input arguments popped by the function
- STACK_SLOT_LIST is the list of stack slots.
- FORCED_LABELS is the list of labels whose address was taken.
- FUNCTION_FLAGS are where single-bit flags are saved.
- OUTGOING_ARGS_SIZE is the size of the largest outgoing stack parameter list.
- ORIGINAL_ARG_VECTOR is a vector of the original DECL_RTX values
- for the function arguments.
- ORIGINAL_DECL_INITIAL is a pointer to the original DECL_INITIAL for the
- function.
- INLINE_REGNO_REG_RTX, INLINE_REGNO_POINTER_FLAG, and
- INLINE_REGNO_POINTER_ALIGN are pointers to the corresponding arrays.
-
- We want this to lay down like an INSN. The PREV_INSN field
- is always NULL. The NEXT_INSN field always points to the
- first function insn of the function being squirreled away. */
-
-#define FIRST_FUNCTION_INSN(RTX) ((RTX)->fld[2].rtx)
-#define FIRST_PARM_INSN(RTX) ((RTX)->fld[3].rtx)
-#define FIRST_LABELNO(RTX) ((RTX)->fld[4].rtint)
-#define LAST_LABELNO(RTX) ((RTX)->fld[5].rtint)
-#define MAX_PARMREG(RTX) ((RTX)->fld[6].rtint)
-#define MAX_REGNUM(RTX) ((RTX)->fld[7].rtint)
-#define FUNCTION_ARGS_SIZE(RTX) ((RTX)->fld[8].rtint)
-#define POPS_ARGS(RTX) ((RTX)->fld[9].rtint)
-#define STACK_SLOT_LIST(RTX) ((RTX)->fld[10].rtx)
-#define FORCED_LABELS(RTX) ((RTX)->fld[11].rtx)
-#define FUNCTION_FLAGS(RTX) ((RTX)->fld[12].rtint)
-#define OUTGOING_ARGS_SIZE(RTX) ((RTX)->fld[13].rtint)
-#define ORIGINAL_ARG_VECTOR(RTX) ((RTX)->fld[14].rtvec)
-#define ORIGINAL_DECL_INITIAL(RTX) ((RTX)->fld[15].rtx)
-#define INLINE_REGNO_REG_RTX(RTX) ((RTX)->fld[16].rtvec)
-#define INLINE_REGNO_POINTER_FLAG(RTX) ((RTX)->fld[17].rtstr)
-#define INLINE_REGNO_POINTER_ALIGN(RTX) ((RTX)->fld[18].rtstr)
-
-/* In FUNCTION_FLAGS we save some variables computed when emitting the code
- for the function and which must be `or'ed into the current flag values when
- insns from that function are being inlined. */
-
-/* These ought to be an enum, but non-ANSI compilers don't like that. */
-#define FUNCTION_FLAGS_CALLS_ALLOCA 01
-#define FUNCTION_FLAGS_CALLS_SETJMP 02
-#define FUNCTION_FLAGS_RETURNS_STRUCT 04
-#define FUNCTION_FLAGS_RETURNS_PCC_STRUCT 010
-#define FUNCTION_FLAGS_NEEDS_CONTEXT 020
-#define FUNCTION_FLAGS_HAS_NONLOCAL_LABEL 040
-#define FUNCTION_FLAGS_RETURNS_POINTER 0100
-#define FUNCTION_FLAGS_USES_CONST_POOL 0200
-#define FUNCTION_FLAGS_CALLS_LONGJMP 0400
-#define FUNCTION_FLAGS_USES_PIC_OFFSET_TABLE 01000
-
-/* Define a macro to look for REG_INC notes,
- but save time on machines where they never exist. */
-
-/* Don't continue this line--convex cc version 4.1 would lose. */
-#if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
-#define FIND_REG_INC_NOTE(insn, reg) (find_reg_note ((insn), REG_INC, (reg)))
-#else
-#define FIND_REG_INC_NOTE(insn, reg) 0
-#endif
-
-/* Indicate whether the machine has any sort of auto increment addressing.
- If not, we can avoid checking for REG_INC notes. */
-
-/* Don't continue this line--convex cc version 4.1 would lose. */
-#if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT))
-#define AUTO_INC_DEC
-#endif
-
-/* Generally useful functions. */
-
-/* The following functions accept a wide integer argument. Rather than
- having to cast on every function call, we use a macro instead, that is
- defined here and in tree.h. */
-
-#ifndef exact_log2
-#define exact_log2(N) exact_log2_wide ((HOST_WIDE_INT) (N))
-#define floor_log2(N) floor_log2_wide ((HOST_WIDE_INT) (N))
-#endif
-
-#define plus_constant(X,C) plus_constant_wide (X, (HOST_WIDE_INT) (C))
-
-#define plus_constant_for_output(X,C) \
- plus_constant_for_output_wide (X, (HOST_WIDE_INT) (C))
-
-extern rtx plus_constant_wide PROTO((rtx, HOST_WIDE_INT));
-extern rtx plus_constant_for_output_wide PROTO((rtx, HOST_WIDE_INT));
-
-#define GEN_INT(N) gen_rtx (CONST_INT, VOIDmode, (HOST_WIDE_INT) (N))
-
-extern rtx bc_gen_rtx ();
-
-extern rtx gen_rtx PVPROTO((enum rtx_code,
- enum machine_mode, ...));
-extern rtvec gen_rtvec PVPROTO((int, ...));
-
-extern rtx read_rtx STDIO_PROTO((FILE *));
-
-#if 0
-/* At present, don't prototype xrealloc, since all of the callers don't
- cast their pointers to char *, and all of the xrealloc's don't use
- void * yet. */
-extern char *xmalloc PROTO((size_t));
-extern char *xrealloc PROTO((void *, size_t));
-#else
-extern char *xmalloc ();
-extern char *xrealloc ();
-#endif
-
-extern char *oballoc PROTO((int));
-extern char *permalloc PROTO((int));
-extern void free PROTO((void *));
-extern rtx rtx_alloc PROTO((RTX_CODE));
-extern rtvec rtvec_alloc PROTO((int));
-extern rtx find_reg_note PROTO((rtx, enum reg_note, rtx));
-extern rtx find_regno_note PROTO((rtx, enum reg_note, int));
-extern int find_reg_fusage PROTO((rtx, enum rtx_code, rtx));
-extern int find_regno_fusage PROTO((rtx, enum rtx_code, int));
-extern HOST_WIDE_INT get_integer_term PROTO((rtx));
-extern rtx get_related_value PROTO((rtx));
-extern rtx single_set PROTO((rtx));
-extern rtx find_last_value PROTO((rtx, rtx *, rtx));
-extern rtx copy_rtx PROTO((rtx));
-extern rtx copy_rtx_if_shared PROTO((rtx));
-extern rtx copy_most_rtx PROTO((rtx, rtx));
-extern rtx replace_rtx PROTO((rtx, rtx, rtx));
-extern rtvec gen_rtvec_v PROTO((int, rtx *));
-extern rtvec gen_rtvec_vv PROTO((int, rtunion *));
-extern rtx gen_reg_rtx PROTO((enum machine_mode));
-extern rtx gen_label_rtx PROTO((void));
-extern rtx gen_inline_header_rtx PROTO((rtx, rtx, int, int, int, int,
- int, int, rtx, rtx, int, int,
- rtvec, rtx,
- rtvec, char *, char *));
-extern rtx gen_lowpart_common PROTO((enum machine_mode, rtx));
-extern rtx gen_lowpart PROTO((enum machine_mode, rtx));
-extern rtx gen_lowpart_if_possible PROTO((enum machine_mode, rtx));
-extern rtx gen_highpart PROTO((enum machine_mode, rtx));
-extern rtx gen_realpart PROTO((enum machine_mode, rtx));
-extern rtx gen_imagpart PROTO((enum machine_mode, rtx));
-extern rtx operand_subword PROTO((rtx, int, int, enum machine_mode));
-extern rtx operand_subword_force PROTO((rtx, int, enum machine_mode));
-extern int subreg_lowpart_p PROTO((rtx));
-extern rtx make_safe_from PROTO((rtx, rtx));
-extern rtx convert_memory_address PROTO((enum machine_mode, rtx));
-extern rtx memory_address PROTO((enum machine_mode, rtx));
-extern rtx get_insns PROTO((void));
-extern rtx get_last_insn PROTO((void));
-extern rtx get_last_insn_anywhere PROTO((void));
-extern void start_sequence PROTO((void));
-extern void push_to_sequence PROTO((rtx));
-extern void end_sequence PROTO((void));
-extern rtx gen_sequence PROTO((void));
-extern rtx immed_double_const PROTO((HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode));
-extern rtx force_const_mem PROTO((enum machine_mode, rtx));
-extern rtx force_reg PROTO((enum machine_mode, rtx));
-extern rtx get_pool_constant PROTO((rtx));
-extern enum machine_mode get_pool_mode PROTO((rtx));
-extern int get_pool_offset PROTO((rtx));
-extern rtx simplify_subtraction PROTO((rtx));
-extern rtx assign_stack_local PROTO((enum machine_mode, int, int));
-extern rtx assign_stack_temp PROTO((enum machine_mode, int, int));
-extern rtx assign_temp PROTO((union tree_node *, int,
- int, int));
-extern rtx protect_from_queue PROTO((rtx, int));
-extern void emit_queue PROTO((void));
-extern rtx emit_move_insn PROTO((rtx, rtx));
-extern rtx emit_insn_before PROTO((rtx, rtx));
-extern rtx emit_jump_insn_before PROTO((rtx, rtx));
-extern rtx emit_call_insn_before PROTO((rtx, rtx));
-extern rtx emit_barrier_before PROTO((rtx));
-extern rtx emit_note_before PROTO((int, rtx));
-extern rtx emit_insn_after PROTO((rtx, rtx));
-extern rtx emit_jump_insn_after PROTO((rtx, rtx));
-extern rtx emit_barrier_after PROTO((rtx));
-extern rtx emit_label_after PROTO((rtx, rtx));
-extern rtx emit_note_after PROTO((int, rtx));
-extern rtx emit_line_note_after PROTO((char *, int, rtx));
-extern rtx emit_insn PROTO((rtx));
-extern rtx emit_insns PROTO((rtx));
-extern rtx emit_insns_before PROTO((rtx, rtx));
-extern rtx emit_insns_after PROTO((rtx, rtx));
-extern rtx emit_jump_insn PROTO((rtx));
-extern rtx emit_call_insn PROTO((rtx));
-extern rtx emit_label PROTO((rtx));
-extern rtx emit_barrier PROTO((void));
-extern rtx emit_line_note PROTO((char *, int));
-extern rtx emit_note PROTO((char *, int));
-extern rtx emit_line_note_force PROTO((char *, int));
-extern rtx make_insn_raw PROTO((rtx));
-extern rtx previous_insn PROTO((rtx));
-extern rtx next_insn PROTO((rtx));
-extern rtx prev_nonnote_insn PROTO((rtx));
-extern rtx next_nonnote_insn PROTO((rtx));
-extern rtx prev_real_insn PROTO((rtx));
-extern rtx next_real_insn PROTO((rtx));
-extern rtx prev_active_insn PROTO((rtx));
-extern rtx next_active_insn PROTO((rtx));
-extern rtx prev_label PROTO((rtx));
-extern rtx next_label PROTO((rtx));
-extern rtx next_cc0_user PROTO((rtx));
-extern rtx prev_cc0_setter PROTO((rtx));
-extern rtx reg_set_last PROTO((rtx, rtx));
-extern rtx next_nondeleted_insn PROTO((rtx));
-extern enum rtx_code reverse_condition PROTO((enum rtx_code));
-extern enum rtx_code swap_condition PROTO((enum rtx_code));
-extern enum rtx_code unsigned_condition PROTO((enum rtx_code));
-extern enum rtx_code signed_condition PROTO((enum rtx_code));
-extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *, int, enum machine_mode));
-extern rtx squeeze_notes PROTO((rtx, rtx));
-extern rtx delete_insn PROTO((rtx));
-extern void delete_jump PROTO((rtx));
-extern rtx get_label_before PROTO((rtx));
-extern rtx get_label_after PROTO((rtx));
-extern rtx follow_jumps PROTO((rtx));
-extern rtx adj_offsettable_operand PROTO((rtx, int));
-extern rtx try_split PROTO((rtx, rtx, int));
-extern rtx split_insns PROTO((rtx, rtx));
-extern rtx simplify_unary_operation PROTO((enum rtx_code, enum machine_mode, rtx, enum machine_mode));
-extern rtx simplify_binary_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
-extern rtx simplify_ternary_operation PROTO((enum rtx_code, enum machine_mode, enum machine_mode, rtx, rtx, rtx));
-extern rtx simplify_relational_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
-extern rtx nonlocal_label_rtx_list PROTO((void));
-extern rtx gen_move_insn PROTO((rtx, rtx));
-extern rtx gen_jump PROTO((rtx));
-extern rtx gen_beq PROTO((rtx));
-extern rtx gen_bge PROTO((rtx));
-extern rtx gen_ble PROTO((rtx));
-extern rtx eliminate_constant_term PROTO((rtx, rtx *));
-extern rtx expand_complex_abs PROTO((enum machine_mode, rtx, rtx, int));
-extern enum machine_mode choose_hard_reg_mode PROTO((int, int));
-
-/* Maximum number of parallel sets and clobbers in any insn in this fn.
- Always at least 3, since the combiner could put that many togetherm
- and we want this to remain correct for all the remaining passes. */
-
-extern int max_parallel;
-
-extern int asm_noperands PROTO((rtx));
-extern char *decode_asm_operands PROTO((rtx, rtx *, rtx **, char **, enum machine_mode *));
-
-extern enum reg_class reg_preferred_class PROTO((int));
-extern enum reg_class reg_alternate_class PROTO((int));
-
-extern rtx get_first_nonparm_insn PROTO((void));
-
-/* Standard pieces of rtx, to be substituted directly into things. */
-extern rtx pc_rtx;
-extern rtx cc0_rtx;
-extern rtx const0_rtx;
-extern rtx const1_rtx;
-extern rtx const2_rtx;
-extern rtx constm1_rtx;
-extern rtx const_true_rtx;
-
-extern rtx const_tiny_rtx[3][(int) MAX_MACHINE_MODE];
-
-/* Returns a constant 0 rtx in mode MODE. Integer modes are treated the
- same as VOIDmode. */
-
-#define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)])
-
-/* Likewise, for the constants 1 and 2. */
-
-#define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)])
-#define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)])
-
-/* All references to certain hard regs, except those created
- by allocating pseudo regs into them (when that's possible),
- go through these unique rtx objects. */
-extern rtx stack_pointer_rtx;
-extern rtx frame_pointer_rtx;
-extern rtx hard_frame_pointer_rtx;
-extern rtx arg_pointer_rtx;
-extern rtx pic_offset_table_rtx;
-extern rtx struct_value_rtx;
-extern rtx struct_value_incoming_rtx;
-extern rtx static_chain_rtx;
-extern rtx static_chain_incoming_rtx;
-
-/* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
- is used to represent the frame pointer. This is because the
- hard frame pointer and the automatic variables are separated by an amount
- that cannot be determined until after register allocation. We can assume
- that in this case ELIMINABLE_REGS will be defined, one action of which
- will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */
-#ifndef HARD_FRAME_POINTER_REGNUM
-#define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM
-#endif
-
-/* Virtual registers are used during RTL generation to refer to locations into
- the stack frame when the actual location isn't known until RTL generation
- is complete. The routine instantiate_virtual_regs replaces these with
- the proper value, which is normally {frame,arg,stack}_pointer_rtx plus
- a constant. */
-
-#define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER)
-
-/* This points to the first word of the incoming arguments passed on the stack,
- either by the caller or by the callee when pretending it was passed by the
- caller. */
-
-extern rtx virtual_incoming_args_rtx;
-
-#define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER)
-
-/* If FRAME_GROWS_DOWNWARD, this points to immediately above the first
- variable on the stack. Otherwise, it points to the first variable on
- the stack. */
-
-extern rtx virtual_stack_vars_rtx;
-
-#define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1)
-
-/* This points to the location of dynamically-allocated memory on the stack
- immediately after the stack pointer has been adjusted by the amount
- desired. */
-
-extern rtx virtual_stack_dynamic_rtx;
-
-#define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2)
-
-/* This points to the location in the stack at which outgoing arguments should
- be written when the stack is pre-pushed (arguments pushed using push
- insns always use sp). */
-
-extern rtx virtual_outgoing_args_rtx;
-
-#define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3)
-
-#define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 3)
-
-extern rtx find_next_ref PROTO((rtx, rtx));
-extern rtx *find_single_use PROTO((rtx, rtx, rtx *));
-
-/* It is hard to write the prototype for expand_expr, since it needs
- expr.h to be included for the enumeration. */
-
-extern rtx expand_expr ();
-
-extern rtx output_constant_def PROTO((union tree_node *));
-extern rtx immed_real_const PROTO((union tree_node *));
-extern union tree_node *make_tree PROTO((union tree_node *, rtx));
-
-/* Abort routines */
-extern void fatal_insn_not_found PROTO((rtx));
-extern void fatal_insn PROTO((char *, rtx));
-
-/* Define a default value for STORE_FLAG_VALUE. */
-
-#ifndef STORE_FLAG_VALUE
-#define STORE_FLAG_VALUE 1
-#endif
-
-/* Nonzero after end of reload pass.
- Set to 1 or 0 by toplev.c. */
-
-extern int reload_completed;
-
-/* Set to 1 while reload_as_needed is operating.
- Required by some machines to handle any generated moves differently. */
-
-extern int reload_in_progress;
-
-/* If this is nonzero, we do not bother generating VOLATILE
- around volatile memory references, and we are willing to
- output indirect addresses. If cse is to follow, we reject
- indirect addresses so a useful potential cse is generated;
- if it is used only once, instruction combination will produce
- the same indirect address eventually. */
-extern int cse_not_expected;
-
-/* Indexed by pseudo register number, gives the rtx for that pseudo.
- Allocated in parallel with regno_pointer_flag. */
-extern rtx *regno_reg_rtx;
-
-/* Vector indexed by regno; contains the alignment in bytes for a
- register that contains a pointer, if known. */
-extern char *regno_pointer_align;
-#define REGNO_POINTER_ALIGN(REGNO) regno_pointer_align[REGNO]
-
-/* Translates rtx code to tree code, for those codes needed by
- REAL_ARITHMETIC. The function returns an int because the caller may not
- know what `enum tree_code' means. */
-
-extern int rtx_to_tree_code PROTO((enum rtx_code));
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
deleted file mode 100644
index 3e6b4aea45b..00000000000
--- a/gcc/rtlanal.c
+++ /dev/null
@@ -1,1849 +0,0 @@
-/* Analyze RTL for C-Compiler
- Copyright (C) 1987, 88, 9-5, 1996 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. */
-
-
-#include "config.h"
-#include "rtl.h"
-
-void note_stores ();
-int reg_set_p ();
-
-/* Bit flags that specify the machine subtype we are compiling for.
- Bits are tested using macros TARGET_... defined in the tm.h file
- and set by `-m...' switches. Must be defined in rtlanal.c. */
-
-int target_flags;
-
-/* Return 1 if the value of X is unstable
- (would be different at a different point in the program).
- The frame pointer, arg pointer, etc. are considered stable
- (within one function) and so is anything marked `unchanging'. */
-
-int
-rtx_unstable_p (x)
- rtx x;
-{
- register RTX_CODE code = GET_CODE (x);
- register int i;
- register char *fmt;
-
- if (code == MEM)
- return ! RTX_UNCHANGING_P (x);
-
- if (code == QUEUED)
- return 1;
-
- if (code == CONST || code == CONST_INT)
- return 0;
-
- if (code == REG)
- return ! (REGNO (x) == FRAME_POINTER_REGNUM
- || REGNO (x) == HARD_FRAME_POINTER_REGNUM
- || REGNO (x) == ARG_POINTER_REGNUM
- || RTX_UNCHANGING_P (x));
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- if (rtx_unstable_p (XEXP (x, i)))
- return 1;
- return 0;
-}
-
-/* Return 1 if X has a value that can vary even between two
- executions of the program. 0 means X can be compared reliably
- against certain constants or near-constants.
- The frame pointer and the arg pointer are considered constant. */
-
-int
-rtx_varies_p (x)
- rtx x;
-{
- register RTX_CODE code = GET_CODE (x);
- register int i;
- register char *fmt;
-
- switch (code)
- {
- case MEM:
- case QUEUED:
- return 1;
-
- case CONST:
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- return 0;
-
- case REG:
- /* Note that we have to test for the actual rtx used for the frame
- and arg pointers and not just the register number in case we have
- eliminated the frame and/or arg pointer and are using it
- for pseudos. */
- return ! (x == frame_pointer_rtx || x == hard_frame_pointer_rtx
- || x == arg_pointer_rtx);
-
- case LO_SUM:
- /* The operand 0 of a LO_SUM is considered constant
- (in fact is it related specifically to operand 1). */
- return rtx_varies_p (XEXP (x, 1));
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- if (rtx_varies_p (XEXP (x, i)))
- return 1;
- return 0;
-}
-
-/* Return 0 if the use of X as an address in a MEM can cause a trap. */
-
-int
-rtx_addr_can_trap_p (x)
- register rtx x;
-{
- register enum rtx_code code = GET_CODE (x);
-
- switch (code)
- {
- case SYMBOL_REF:
- case LABEL_REF:
- /* SYMBOL_REF is problematic due to the possible presence of
- a #pragma weak, but to say that loads from symbols can trap is
- *very* costly. It's not at all clear what's best here. For
- now, we ignore the impact of #pragma weak. */
- return 0;
-
- case REG:
- /* As in rtx_varies_p, we have to use the actual rtx, not reg number. */
- return ! (x == frame_pointer_rtx || x == hard_frame_pointer_rtx
- || x == stack_pointer_rtx || x == arg_pointer_rtx);
-
- case CONST:
- return rtx_addr_can_trap_p (XEXP (x, 0));
-
- case PLUS:
- /* An address is assumed not to trap if it is an address that can't
- trap plus a constant integer. */
- return (rtx_addr_can_trap_p (XEXP (x, 0))
- || GET_CODE (XEXP (x, 1)) != CONST_INT);
-
- case LO_SUM:
- return rtx_addr_can_trap_p (XEXP (x, 1));
- }
-
- /* If it isn't one of the case above, it can cause a trap. */
- return 1;
-}
-
-/* Return 1 if X refers to a memory location whose address
- cannot be compared reliably with constant addresses,
- or if X refers to a BLKmode memory object. */
-
-int
-rtx_addr_varies_p (x)
- rtx x;
-{
- register enum rtx_code code;
- register int i;
- register char *fmt;
-
- if (x == 0)
- return 0;
-
- code = GET_CODE (x);
- if (code == MEM)
- return GET_MODE (x) == BLKmode || rtx_varies_p (XEXP (x, 0));
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- {
- if (rtx_addr_varies_p (XEXP (x, i)))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (rtx_addr_varies_p (XVECEXP (x, i, j)))
- return 1;
- }
- return 0;
-}
-
-/* Return the value of the integer term in X, if one is apparent;
- otherwise return 0.
- Only obvious integer terms are detected.
- This is used in cse.c with the `related_value' field.*/
-
-HOST_WIDE_INT
-get_integer_term (x)
- rtx x;
-{
- if (GET_CODE (x) == CONST)
- x = XEXP (x, 0);
-
- if (GET_CODE (x) == MINUS
- && GET_CODE (XEXP (x, 1)) == CONST_INT)
- return - INTVAL (XEXP (x, 1));
- if (GET_CODE (x) == PLUS
- && GET_CODE (XEXP (x, 1)) == CONST_INT)
- return INTVAL (XEXP (x, 1));
- return 0;
-}
-
-/* If X is a constant, return the value sans apparent integer term;
- otherwise return 0.
- Only obvious integer terms are detected. */
-
-rtx
-get_related_value (x)
- rtx x;
-{
- if (GET_CODE (x) != CONST)
- return 0;
- x = XEXP (x, 0);
- if (GET_CODE (x) == PLUS
- && GET_CODE (XEXP (x, 1)) == CONST_INT)
- return XEXP (x, 0);
- else if (GET_CODE (x) == MINUS
- && GET_CODE (XEXP (x, 1)) == CONST_INT)
- return XEXP (x, 0);
- return 0;
-}
-
-/* Nonzero if register REG appears somewhere within IN.
- Also works if REG is not a register; in this case it checks
- for a subexpression of IN that is Lisp "equal" to REG. */
-
-int
-reg_mentioned_p (reg, in)
- register rtx reg, in;
-{
- register char *fmt;
- register int i;
- register enum rtx_code code;
-
- if (in == 0)
- return 0;
-
- if (reg == in)
- return 1;
-
- if (GET_CODE (in) == LABEL_REF)
- return reg == XEXP (in, 0);
-
- code = GET_CODE (in);
-
- switch (code)
- {
- /* Compare registers by number. */
- case REG:
- return GET_CODE (reg) == REG && REGNO (in) == REGNO (reg);
-
- /* These codes have no constituent expressions
- and are unique. */
- case SCRATCH:
- case CC0:
- case PC:
- return 0;
-
- case CONST_INT:
- return GET_CODE (reg) == CONST_INT && INTVAL (in) == INTVAL (reg);
-
- case CONST_DOUBLE:
- /* These are kept unique for a given value. */
- return 0;
- }
-
- if (GET_CODE (reg) == code && rtx_equal_p (reg, in))
- return 1;
-
- fmt = GET_RTX_FORMAT (code);
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (in, i) - 1; j >= 0; j--)
- if (reg_mentioned_p (reg, XVECEXP (in, i, j)))
- return 1;
- }
- else if (fmt[i] == 'e'
- && reg_mentioned_p (reg, XEXP (in, i)))
- return 1;
- }
- return 0;
-}
-
-/* Return 1 if in between BEG and END, exclusive of BEG and END, there is
- no CODE_LABEL insn. */
-
-int
-no_labels_between_p (beg, end)
- rtx beg, end;
-{
- register rtx p;
- for (p = NEXT_INSN (beg); p != end; p = NEXT_INSN (p))
- if (GET_CODE (p) == CODE_LABEL)
- return 0;
- return 1;
-}
-
-/* Nonzero if register REG is used in an insn between
- FROM_INSN and TO_INSN (exclusive of those two). */
-
-int
-reg_used_between_p (reg, from_insn, to_insn)
- rtx reg, from_insn, to_insn;
-{
- register rtx insn;
-
- if (from_insn == to_insn)
- return 0;
-
- for (insn = NEXT_INSN (from_insn); insn != to_insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && (reg_overlap_mentioned_p (reg, PATTERN (insn))
- || (GET_CODE (insn) == CALL_INSN
- && (find_reg_fusage (insn, USE, reg)
- || find_reg_fusage (insn, CLOBBER, reg)))))
- return 1;
- return 0;
-}
-
-/* Nonzero if the old value of X, a register, is referenced in BODY. If X
- is entirely replaced by a new value and the only use is as a SET_DEST,
- we do not consider it a reference. */
-
-int
-reg_referenced_p (x, body)
- rtx x;
- rtx body;
-{
- int i;
-
- switch (GET_CODE (body))
- {
- case SET:
- if (reg_overlap_mentioned_p (x, SET_SRC (body)))
- return 1;
-
- /* If the destination is anything other than CC0, PC, a REG or a SUBREG
- of a REG that occupies all of the REG, the insn references X if
- it is mentioned in the destination. */
- if (GET_CODE (SET_DEST (body)) != CC0
- && GET_CODE (SET_DEST (body)) != PC
- && GET_CODE (SET_DEST (body)) != REG
- && ! (GET_CODE (SET_DEST (body)) == SUBREG
- && GET_CODE (SUBREG_REG (SET_DEST (body))) == REG
- && (((GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (body))))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
- == ((GET_MODE_SIZE (GET_MODE (SET_DEST (body)))
- + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)))
- && reg_overlap_mentioned_p (x, SET_DEST (body)))
- return 1;
- break;
-
- case ASM_OPERANDS:
- for (i = ASM_OPERANDS_INPUT_LENGTH (body) - 1; i >= 0; i--)
- if (reg_overlap_mentioned_p (x, ASM_OPERANDS_INPUT (body, i)))
- return 1;
- break;
-
- case CALL:
- case USE:
- return reg_overlap_mentioned_p (x, body);
-
- case TRAP_IF:
- return reg_overlap_mentioned_p (x, TRAP_CONDITION (body));
-
- case UNSPEC:
- case UNSPEC_VOLATILE:
- case PARALLEL:
- for (i = XVECLEN (body, 0) - 1; i >= 0; i--)
- if (reg_referenced_p (x, XVECEXP (body, 0, i)))
- return 1;
- break;
- }
-
- return 0;
-}
-
-/* Nonzero if register REG is referenced in an insn between
- FROM_INSN and TO_INSN (exclusive of those two). Sets of REG do
- not count. */
-
-int
-reg_referenced_between_p (reg, from_insn, to_insn)
- rtx reg, from_insn, to_insn;
-{
- register rtx insn;
-
- if (from_insn == to_insn)
- return 0;
-
- for (insn = NEXT_INSN (from_insn); insn != to_insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && (reg_referenced_p (reg, PATTERN (insn))
- || (GET_CODE (insn) == CALL_INSN
- && find_reg_fusage (insn, USE, reg))))
- return 1;
- return 0;
-}
-
-/* Nonzero if register REG is set or clobbered in an insn between
- FROM_INSN and TO_INSN (exclusive of those two). */
-
-int
-reg_set_between_p (reg, from_insn, to_insn)
- rtx reg, from_insn, to_insn;
-{
- register rtx insn;
-
- if (from_insn == to_insn)
- return 0;
-
- for (insn = NEXT_INSN (from_insn); insn != to_insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_set_p (reg, insn))
- return 1;
- return 0;
-}
-
-/* Internals of reg_set_between_p. */
-
-static rtx reg_set_reg;
-static int reg_set_flag;
-
-static void
-reg_set_p_1 (x, pat)
- rtx x;
-{
- /* We don't want to return 1 if X is a MEM that contains a register
- within REG_SET_REG. */
-
- if ((GET_CODE (x) != MEM)
- && reg_overlap_mentioned_p (reg_set_reg, x))
- reg_set_flag = 1;
-}
-
-int
-reg_set_p (reg, insn)
- rtx reg, insn;
-{
- rtx body = insn;
-
- /* We can be passed an insn or part of one. If we are passed an insn,
- check if a side-effect of the insn clobbers REG. */
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- if (FIND_REG_INC_NOTE (insn, reg)
- || (GET_CODE (insn) == CALL_INSN
- /* We'd like to test call_used_regs here, but rtlanal.c can't
- reference that variable due to its use in genattrtab. So
- we'll just be more conservative.
-
- ??? Unless we could ensure that the CALL_INSN_FUNCTION_USAGE
- information holds all clobbered registers. */
- && ((GET_CODE (reg) == REG
- && REGNO (reg) < FIRST_PSEUDO_REGISTER)
- || GET_CODE (reg) == MEM
- || find_reg_fusage (insn, CLOBBER, reg))))
- return 1;
-
- body = PATTERN (insn);
- }
-
- reg_set_reg = reg;
- reg_set_flag = 0;
- note_stores (body, reg_set_p_1);
- return reg_set_flag;
-}
-
-/* Similar to reg_set_between_p, but check all registers in X. Return 0
- only if none of them are modified between START and END. Return 1 if
- X contains a MEM; this routine does not perform any memory aliasing. */
-
-int
-modified_between_p (x, start, end)
- rtx x;
- rtx start, end;
-{
- enum rtx_code code = GET_CODE (x);
- char *fmt;
- int i, j;
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- return 0;
-
- case PC:
- case CC0:
- return 1;
-
- case MEM:
- /* If the memory is not constant, assume it is modified. If it is
- constant, we still have to check the address. */
- if (! RTX_UNCHANGING_P (x))
- return 1;
- break;
-
- case REG:
- return reg_set_between_p (x, start, end);
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e' && modified_between_p (XEXP (x, i), start, end))
- return 1;
-
- if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (modified_between_p (XVECEXP (x, i, j), start, end))
- return 1;
- }
-
- return 0;
-}
-
-/* Similar to reg_set_p, but check all registers in X. Return 0 only if none
- of them are modified in INSN. Return 1 if X contains a MEM; this routine
- does not perform any memory aliasing. */
-
-int
-modified_in_p (x, insn)
- rtx x;
- rtx insn;
-{
- enum rtx_code code = GET_CODE (x);
- char *fmt;
- int i, j;
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- return 0;
-
- case PC:
- case CC0:
- return 1;
-
- case MEM:
- /* If the memory is not constant, assume it is modified. If it is
- constant, we still have to check the address. */
- if (! RTX_UNCHANGING_P (x))
- return 1;
- break;
-
- case REG:
- return reg_set_p (x, insn);
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e' && modified_in_p (XEXP (x, i), insn))
- return 1;
-
- if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (modified_in_p (XVECEXP (x, i, j), insn))
- return 1;
- }
-
- return 0;
-}
-
-/* Given an INSN, return a SET expression if this insn has only a single SET.
- It may also have CLOBBERs, USEs, or SET whose output
- will not be used, which we ignore. */
-
-rtx
-single_set (insn)
- rtx insn;
-{
- rtx set;
- int i;
-
- if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
- return 0;
-
- if (GET_CODE (PATTERN (insn)) == SET)
- return PATTERN (insn);
-
- else if (GET_CODE (PATTERN (insn)) == PARALLEL)
- {
- for (i = 0, set = 0; i < XVECLEN (PATTERN (insn), 0); i++)
- if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET
- && (! find_reg_note (insn, REG_UNUSED,
- SET_DEST (XVECEXP (PATTERN (insn), 0, i)))
- || side_effects_p (XVECEXP (PATTERN (insn), 0, i))))
- {
- if (set)
- return 0;
- else
- set = XVECEXP (PATTERN (insn), 0, i);
- }
- return set;
- }
-
- return 0;
-}
-
-/* Return the last thing that X was assigned from before *PINSN. Verify that
- the object is not modified up to VALID_TO. If it was, if we hit
- a partial assignment to X, or hit a CODE_LABEL first, return X. If we
- found an assignment, update *PINSN to point to it. */
-
-rtx
-find_last_value (x, pinsn, valid_to)
- rtx x;
- rtx *pinsn;
- rtx valid_to;
-{
- rtx p;
-
- for (p = PREV_INSN (*pinsn); p && GET_CODE (p) != CODE_LABEL;
- p = PREV_INSN (p))
- if (GET_RTX_CLASS (GET_CODE (p)) == 'i')
- {
- rtx set = single_set (p);
- rtx note = find_reg_note (p, REG_EQUAL, NULL_RTX);
-
- if (set && rtx_equal_p (x, SET_DEST (set)))
- {
- rtx src = SET_SRC (set);
-
- if (note && GET_CODE (XEXP (note, 0)) != EXPR_LIST)
- src = XEXP (note, 0);
-
- if (! modified_between_p (src, PREV_INSN (p), valid_to)
- /* Reject hard registers because we don't usually want
- to use them; we'd rather use a pseudo. */
- && ! (GET_CODE (src) == REG
- && REGNO (src) < FIRST_PSEUDO_REGISTER))
- {
- *pinsn = p;
- return src;
- }
- }
-
- /* If set in non-simple way, we don't have a value. */
- if (reg_set_p (x, p))
- break;
- }
-
- return x;
-}
-
-/* Return nonzero if register in range [REGNO, ENDREGNO)
- appears either explicitly or implicitly in X
- other than being stored into.
-
- References contained within the substructure at LOC do not count.
- LOC may be zero, meaning don't ignore anything. */
-
-int
-refers_to_regno_p (regno, endregno, x, loc)
- int regno, endregno;
- rtx x;
- rtx *loc;
-{
- register int i;
- register RTX_CODE code;
- register char *fmt;
-
- repeat:
- /* The contents of a REG_NONNEG note is always zero, so we must come here
- upon repeat in case the last REG_NOTE is a REG_NONNEG note. */
- if (x == 0)
- return 0;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case REG:
- i = REGNO (x);
-
- /* If we modifying the stack, frame, or argument pointer, it will
- clobber a virtual register. In fact, we could be more precise,
- but it isn't worth it. */
- if ((i == STACK_POINTER_REGNUM
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || i == ARG_POINTER_REGNUM
-#endif
- || i == FRAME_POINTER_REGNUM)
- && regno >= FIRST_VIRTUAL_REGISTER && regno <= LAST_VIRTUAL_REGISTER)
- return 1;
-
- return (endregno > i
- && regno < i + (i < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (i, GET_MODE (x))
- : 1));
-
- case SUBREG:
- /* If this is a SUBREG of a hard reg, we can see exactly which
- registers are being modified. Otherwise, handle normally. */
- if (GET_CODE (SUBREG_REG (x)) == REG
- && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER)
- {
- int inner_regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x);
- int inner_endregno
- = inner_regno + (inner_regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
-
- return endregno > inner_regno && regno < inner_endregno;
- }
- break;
-
- case CLOBBER:
- case SET:
- if (&SET_DEST (x) != loc
- /* Note setting a SUBREG counts as referring to the REG it is in for
- a pseudo but not for hard registers since we can
- treat each word individually. */
- && ((GET_CODE (SET_DEST (x)) == SUBREG
- && loc != &SUBREG_REG (SET_DEST (x))
- && GET_CODE (SUBREG_REG (SET_DEST (x))) == REG
- && REGNO (SUBREG_REG (SET_DEST (x))) >= FIRST_PSEUDO_REGISTER
- && refers_to_regno_p (regno, endregno,
- SUBREG_REG (SET_DEST (x)), loc))
- || (GET_CODE (SET_DEST (x)) != REG
- && refers_to_regno_p (regno, endregno, SET_DEST (x), loc))))
- return 1;
-
- if (code == CLOBBER || loc == &SET_SRC (x))
- return 0;
- x = SET_SRC (x);
- goto repeat;
- }
-
- /* X does not match, so try its subexpressions. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e' && loc != &XEXP (x, i))
- {
- if (i == 0)
- {
- x = XEXP (x, 0);
- goto repeat;
- }
- else
- if (refers_to_regno_p (regno, endregno, XEXP (x, i), loc))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >=0; j--)
- if (loc != &XVECEXP (x, i, j)
- && refers_to_regno_p (regno, endregno, XVECEXP (x, i, j), loc))
- return 1;
- }
- }
- return 0;
-}
-
-/* Nonzero if modifying X will affect IN. If X is a register or a SUBREG,
- we check if any register number in X conflicts with the relevant register
- numbers. If X is a constant, return 0. If X is a MEM, return 1 iff IN
- contains a MEM (we don't bother checking for memory addresses that can't
- conflict because we expect this to be a rare case. */
-
-int
-reg_overlap_mentioned_p (x, in)
- rtx x, in;
-{
- int regno, endregno;
-
- if (GET_CODE (x) == SUBREG)
- {
- regno = REGNO (SUBREG_REG (x));
- if (regno < FIRST_PSEUDO_REGISTER)
- regno += SUBREG_WORD (x);
- }
- else if (GET_CODE (x) == REG)
- regno = REGNO (x);
- else if (CONSTANT_P (x))
- return 0;
- else if (GET_CODE (x) == MEM)
- {
- char *fmt;
- int i;
-
- if (GET_CODE (in) == MEM)
- return 1;
-
- fmt = GET_RTX_FORMAT (GET_CODE (in));
-
- for (i = GET_RTX_LENGTH (GET_CODE (in)) - 1; i >= 0; i--)
- if (fmt[i] == 'e' && reg_overlap_mentioned_p (x, XEXP (in, i)))
- return 1;
-
- return 0;
- }
- else if (GET_CODE (x) == SCRATCH || GET_CODE (x) == PC
- || GET_CODE (x) == CC0)
- return reg_mentioned_p (x, in);
- else
- abort ();
-
- endregno = regno + (regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1);
-
- return refers_to_regno_p (regno, endregno, in, NULL_PTR);
-}
-
-/* Used for communications between the next few functions. */
-
-static int reg_set_last_unknown;
-static rtx reg_set_last_value;
-static int reg_set_last_first_regno, reg_set_last_last_regno;
-
-/* Called via note_stores from reg_set_last. */
-
-static void
-reg_set_last_1 (x, pat)
- rtx x;
- rtx pat;
-{
- int first, last;
-
- /* If X is not a register, or is not one in the range we care
- about, ignore. */
- if (GET_CODE (x) != REG)
- return;
-
- first = REGNO (x);
- last = first + (first < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (first, GET_MODE (x)) : 1);
-
- if (first >= reg_set_last_last_regno
- || last <= reg_set_last_first_regno)
- return;
-
- /* If this is a CLOBBER or is some complex LHS, or doesn't modify
- exactly the registers we care about, show we don't know the value. */
- if (GET_CODE (pat) == CLOBBER || SET_DEST (pat) != x
- || first != reg_set_last_first_regno
- || last != reg_set_last_last_regno)
- reg_set_last_unknown = 1;
- else
- reg_set_last_value = SET_SRC (pat);
-}
-
-/* Return the last value to which REG was set prior to INSN. If we can't
- find it easily, return 0.
-
- We only return a REG, SUBREG, or constant because it is too hard to
- check if a MEM remains unchanged. */
-
-rtx
-reg_set_last (x, insn)
- rtx x;
- rtx insn;
-{
- rtx orig_insn = insn;
-
- reg_set_last_first_regno = REGNO (x);
-
- reg_set_last_last_regno
- = reg_set_last_first_regno
- + (reg_set_last_first_regno < FIRST_PSEUDO_REGISTER
- ? HARD_REGNO_NREGS (reg_set_last_first_regno, GET_MODE (x)) : 1);
-
- reg_set_last_unknown = 0;
- reg_set_last_value = 0;
-
- /* Scan backwards until reg_set_last_1 changed one of the above flags.
- Stop when we reach a label or X is a hard reg and we reach a
- CALL_INSN (if reg_set_last_last_regno is a hard reg).
-
- If we find a set of X, ensure that its SET_SRC remains unchanged. */
-
- /* We compare with <= here, because reg_set_last_last_regno
- is actually the number of the first reg *not* in X. */
- for (;
- insn && GET_CODE (insn) != CODE_LABEL
- && ! (GET_CODE (insn) == CALL_INSN
- && reg_set_last_last_regno <= FIRST_PSEUDO_REGISTER);
- insn = PREV_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- note_stores (PATTERN (insn), reg_set_last_1);
- if (reg_set_last_unknown)
- return 0;
- else if (reg_set_last_value)
- {
- if (CONSTANT_P (reg_set_last_value)
- || ((GET_CODE (reg_set_last_value) == REG
- || GET_CODE (reg_set_last_value) == SUBREG)
- && ! reg_set_between_p (reg_set_last_value,
- insn, orig_insn)))
- return reg_set_last_value;
- else
- return 0;
- }
- }
-
- return 0;
-}
-
-/* This is 1 until after the rtl generation pass. */
-int rtx_equal_function_value_matters;
-
-/* Return 1 if X and Y are identical-looking rtx's.
- This is the Lisp function EQUAL for rtx arguments. */
-
-int
-rtx_equal_p (x, y)
- rtx x, y;
-{
- register int i;
- register int j;
- register enum rtx_code code;
- register char *fmt;
-
- if (x == y)
- return 1;
- if (x == 0 || y == 0)
- return 0;
-
- code = GET_CODE (x);
- /* Rtx's of different codes cannot be equal. */
- if (code != GET_CODE (y))
- return 0;
-
- /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
- (REG:SI x) and (REG:HI x) are NOT equivalent. */
-
- if (GET_MODE (x) != GET_MODE (y))
- return 0;
-
- /* REG, LABEL_REF, and SYMBOL_REF can be compared nonrecursively. */
-
- if (code == REG)
- /* Until rtl generation is complete, don't consider a reference to the
- return register of the current function the same as the return from a
- called function. This eases the job of function integration. Once the
- distinction is no longer needed, they can be considered equivalent. */
- return (REGNO (x) == REGNO (y)
- && (! rtx_equal_function_value_matters
- || REG_FUNCTION_VALUE_P (x) == REG_FUNCTION_VALUE_P (y)));
- else if (code == LABEL_REF)
- return XEXP (x, 0) == XEXP (y, 0);
- else if (code == SYMBOL_REF)
- return XSTR (x, 0) == XSTR (y, 0);
- else if (code == SCRATCH || code == CONST_DOUBLE)
- return 0;
-
- /* Compare the elements. If any pair of corresponding elements
- fail to match, return 0 for the whole things. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- switch (fmt[i])
- {
- case 'w':
- if (XWINT (x, i) != XWINT (y, i))
- return 0;
- break;
-
- case 'n':
- case 'i':
- if (XINT (x, i) != XINT (y, i))
- return 0;
- break;
-
- case 'V':
- case 'E':
- /* Two vectors must have the same length. */
- if (XVECLEN (x, i) != XVECLEN (y, i))
- return 0;
-
- /* And the corresponding elements must match. */
- for (j = 0; j < XVECLEN (x, i); j++)
- if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
- return 0;
- break;
-
- case 'e':
- if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0)
- return 0;
- break;
-
- case 'S':
- case 's':
- if (strcmp (XSTR (x, i), XSTR (y, i)))
- return 0;
- break;
-
- case 'u':
- /* These are just backpointers, so they don't matter. */
- break;
-
- case '0':
- break;
-
- /* It is believed that rtx's at this level will never
- contain anything but integers and other rtx's,
- except for within LABEL_REFs and SYMBOL_REFs. */
- default:
- abort ();
- }
- }
- return 1;
-}
-
-/* Call FUN on each register or MEM that is stored into or clobbered by X.
- (X would be the pattern of an insn).
- FUN receives two arguments:
- the REG, MEM, CC0 or PC being stored in or clobbered,
- the SET or CLOBBER rtx that does the store.
-
- If the item being stored in or clobbered is a SUBREG of a hard register,
- the SUBREG will be passed. */
-
-void
-note_stores (x, fun)
- register rtx x;
- void (*fun) ();
-{
- if ((GET_CODE (x) == SET || GET_CODE (x) == CLOBBER))
- {
- register rtx dest = SET_DEST (x);
- while ((GET_CODE (dest) == SUBREG
- && (GET_CODE (SUBREG_REG (dest)) != REG
- || REGNO (SUBREG_REG (dest)) >= FIRST_PSEUDO_REGISTER))
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == STRICT_LOW_PART)
- dest = XEXP (dest, 0);
- (*fun) (dest, x);
- }
- else if (GET_CODE (x) == PARALLEL)
- {
- register int i;
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- {
- register rtx y = XVECEXP (x, 0, i);
- if (GET_CODE (y) == SET || GET_CODE (y) == CLOBBER)
- {
- register rtx dest = SET_DEST (y);
- while ((GET_CODE (dest) == SUBREG
- && (GET_CODE (SUBREG_REG (dest)) != REG
- || (REGNO (SUBREG_REG (dest))
- >= FIRST_PSEUDO_REGISTER)))
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == SIGN_EXTRACT
- || GET_CODE (dest) == STRICT_LOW_PART)
- dest = XEXP (dest, 0);
- (*fun) (dest, y);
- }
- }
- }
-}
-
-/* Return nonzero if X's old contents don't survive after INSN.
- This will be true if X is (cc0) or if X is a register and
- X dies in INSN or because INSN entirely sets X.
-
- "Entirely set" means set directly and not through a SUBREG,
- ZERO_EXTRACT or SIGN_EXTRACT, so no trace of the old contents remains.
- Likewise, REG_INC does not count.
-
- REG may be a hard or pseudo reg. Renumbering is not taken into account,
- but for this use that makes no difference, since regs don't overlap
- during their lifetimes. Therefore, this function may be used
- at any time after deaths have been computed (in flow.c).
-
- If REG is a hard reg that occupies multiple machine registers, this
- function will only return 1 if each of those registers will be replaced
- by INSN. */
-
-int
-dead_or_set_p (insn, x)
- rtx insn;
- rtx x;
-{
- register int regno, last_regno;
- register int i;
-
- /* Can't use cc0_rtx below since this file is used by genattrtab.c. */
- if (GET_CODE (x) == CC0)
- return 1;
-
- if (GET_CODE (x) != REG)
- abort ();
-
- regno = REGNO (x);
- last_regno = (regno >= FIRST_PSEUDO_REGISTER ? regno
- : regno + HARD_REGNO_NREGS (regno, GET_MODE (x)) - 1);
-
- for (i = regno; i <= last_regno; i++)
- if (! dead_or_set_regno_p (insn, i))
- return 0;
-
- return 1;
-}
-
-/* Utility function for dead_or_set_p to check an individual register. Also
- called from flow.c. */
-
-int
-dead_or_set_regno_p (insn, test_regno)
- rtx insn;
- int test_regno;
-{
- int regno, endregno;
- rtx link;
-
- /* See if there is a death note for something that includes TEST_REGNO. */
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- {
- if (REG_NOTE_KIND (link) != REG_DEAD || GET_CODE (XEXP (link, 0)) != REG)
- continue;
-
- regno = REGNO (XEXP (link, 0));
- endregno = (regno >= FIRST_PSEUDO_REGISTER ? regno + 1
- : regno + HARD_REGNO_NREGS (regno,
- GET_MODE (XEXP (link, 0))));
-
- if (test_regno >= regno && test_regno < endregno)
- return 1;
- }
-
- if (GET_CODE (insn) == CALL_INSN
- && find_regno_fusage (insn, CLOBBER, test_regno))
- return 1;
-
- if (GET_CODE (PATTERN (insn)) == SET)
- {
- rtx dest = SET_DEST (PATTERN (insn));
-
- /* A value is totally replaced if it is the destination or the
- destination is a SUBREG of REGNO that does not change the number of
- words in it. */
- if (GET_CODE (dest) == SUBREG
- && (((GET_MODE_SIZE (GET_MODE (dest))
- + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
- == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest)))
- + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
- dest = SUBREG_REG (dest);
-
- if (GET_CODE (dest) != REG)
- return 0;
-
- regno = REGNO (dest);
- endregno = (regno >= FIRST_PSEUDO_REGISTER ? regno + 1
- : regno + HARD_REGNO_NREGS (regno, GET_MODE (dest)));
-
- return (test_regno >= regno && test_regno < endregno);
- }
- else if (GET_CODE (PATTERN (insn)) == PARALLEL)
- {
- register int i;
-
- for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
- {
- rtx body = XVECEXP (PATTERN (insn), 0, i);
-
- if (GET_CODE (body) == SET || GET_CODE (body) == CLOBBER)
- {
- rtx dest = SET_DEST (body);
-
- if (GET_CODE (dest) == SUBREG
- && (((GET_MODE_SIZE (GET_MODE (dest))
- + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
- == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest)))
- + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
- dest = SUBREG_REG (dest);
-
- if (GET_CODE (dest) != REG)
- continue;
-
- regno = REGNO (dest);
- endregno = (regno >= FIRST_PSEUDO_REGISTER ? regno + 1
- : regno + HARD_REGNO_NREGS (regno, GET_MODE (dest)));
-
- if (test_regno >= regno && test_regno < endregno)
- return 1;
- }
- }
- }
-
- return 0;
-}
-
-/* Return the reg-note of kind KIND in insn INSN, if there is one.
- If DATUM is nonzero, look for one whose datum is DATUM. */
-
-rtx
-find_reg_note (insn, kind, datum)
- rtx insn;
- enum reg_note kind;
- rtx datum;
-{
- register rtx link;
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == kind
- && (datum == 0 || datum == XEXP (link, 0)))
- return link;
- return 0;
-}
-
-/* Return the reg-note of kind KIND in insn INSN which applies to register
- number REGNO, if any. Return 0 if there is no such reg-note. Note that
- the REGNO of this NOTE need not be REGNO if REGNO is a hard register;
- it might be the case that the note overlaps REGNO. */
-
-rtx
-find_regno_note (insn, kind, regno)
- rtx insn;
- enum reg_note kind;
- int regno;
-{
- register rtx link;
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (REG_NOTE_KIND (link) == kind
- /* Verify that it is a register, so that scratch and MEM won't cause a
- problem here. */
- && GET_CODE (XEXP (link, 0)) == REG
- && REGNO (XEXP (link, 0)) <= regno
- && ((REGNO (XEXP (link, 0))
- + (REGNO (XEXP (link, 0)) >= FIRST_PSEUDO_REGISTER ? 1
- : HARD_REGNO_NREGS (REGNO (XEXP (link, 0)),
- GET_MODE (XEXP (link, 0)))))
- > regno))
- return link;
- return 0;
-}
-
-/* Return true if DATUM, or any overlap of DATUM, of kind CODE is found
- in the CALL_INSN_FUNCTION_USAGE information of INSN. */
-
-int
-find_reg_fusage (insn, code, datum)
- rtx insn;
- enum rtx_code code;
- rtx datum;
-{
- /* If it's not a CALL_INSN, it can't possibly have a
- CALL_INSN_FUNCTION_USAGE field, so don't bother checking. */
- if (GET_CODE (insn) != CALL_INSN)
- return 0;
-
- if (! datum)
- abort();
-
- if (GET_CODE (datum) != REG)
- {
- register rtx link;
-
- for (link = CALL_INSN_FUNCTION_USAGE (insn);
- link;
- link = XEXP (link, 1))
- if (GET_CODE (XEXP (link, 0)) == code
- && rtx_equal_p (datum, SET_DEST (XEXP (link, 0))))
- return 1;
- }
- else
- {
- register int regno = REGNO (datum);
-
- /* CALL_INSN_FUNCTION_USAGE information cannot contain references
- to pseudo registers, so don't bother checking. */
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int end_regno = regno + HARD_REGNO_NREGS (regno, GET_MODE (datum));
- int i;
-
- for (i = regno; i < end_regno; i++)
- if (find_regno_fusage (insn, code, i))
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Return true if REGNO, or any overlap of REGNO, of kind CODE is found
- in the CALL_INSN_FUNCTION_USAGE information of INSN. */
-
-int
-find_regno_fusage (insn, code, regno)
- rtx insn;
- enum rtx_code code;
- int regno;
-{
- register rtx link;
-
- /* CALL_INSN_FUNCTION_USAGE information cannot contain references
- to pseudo registers, so don't bother checking. */
-
- if (regno >= FIRST_PSEUDO_REGISTER
- || GET_CODE (insn) != CALL_INSN )
- return 0;
-
- for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
- {
- register int regnote;
- register rtx op;
-
- if (GET_CODE (op = XEXP (link, 0)) == code
- && GET_CODE (SET_DEST (op)) == REG
- && (regnote = REGNO (SET_DEST (op))) <= regno
- && regnote
- + HARD_REGNO_NREGS (regnote, GET_MODE (SET_DEST (op)))
- > regno)
- return 1;
- }
-
- return 0;
-}
-
-/* Remove register note NOTE from the REG_NOTES of INSN. */
-
-void
-remove_note (insn, note)
- register rtx note;
- register rtx insn;
-{
- register rtx link;
-
- if (REG_NOTES (insn) == note)
- {
- REG_NOTES (insn) = XEXP (note, 1);
- return;
- }
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- if (XEXP (link, 1) == note)
- {
- XEXP (link, 1) = XEXP (note, 1);
- return;
- }
-
- abort ();
-}
-
-/* Nonzero if X contains any volatile instructions. These are instructions
- which may cause unpredictable machine state instructions, and thus no
- instructions should be moved or combined across them. This includes
- only volatile asms and UNSPEC_VOLATILE instructions. */
-
-int
-volatile_insn_p (x)
- rtx x;
-{
- register RTX_CODE code;
-
- code = GET_CODE (x);
- switch (code)
- {
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST_INT:
- case CONST:
- case CONST_DOUBLE:
- case CC0:
- case PC:
- case REG:
- case SCRATCH:
- case CLOBBER:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- case CALL:
- case MEM:
- return 0;
-
- case UNSPEC_VOLATILE:
- /* case TRAP_IF: This isn't clear yet. */
- return 1;
-
- case ASM_OPERANDS:
- if (MEM_VOLATILE_P (x))
- return 1;
- }
-
- /* Recursively scan the operands of this expression. */
-
- {
- register char *fmt = GET_RTX_FORMAT (code);
- register int i;
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- if (volatile_insn_p (XEXP (x, i)))
- return 1;
- }
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (volatile_insn_p (XVECEXP (x, i, j)))
- return 1;
- }
- }
- }
- return 0;
-}
-
-/* Nonzero if X contains any volatile memory references
- UNSPEC_VOLATILE operations or volatile ASM_OPERANDS expressions. */
-
-int
-volatile_refs_p (x)
- rtx x;
-{
- register RTX_CODE code;
-
- code = GET_CODE (x);
- switch (code)
- {
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST_INT:
- case CONST:
- case CONST_DOUBLE:
- case CC0:
- case PC:
- case REG:
- case SCRATCH:
- case CLOBBER:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- return 0;
-
- case CALL:
- case UNSPEC_VOLATILE:
- /* case TRAP_IF: This isn't clear yet. */
- return 1;
-
- case MEM:
- case ASM_OPERANDS:
- if (MEM_VOLATILE_P (x))
- return 1;
- }
-
- /* Recursively scan the operands of this expression. */
-
- {
- register char *fmt = GET_RTX_FORMAT (code);
- register int i;
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- if (volatile_refs_p (XEXP (x, i)))
- return 1;
- }
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (volatile_refs_p (XVECEXP (x, i, j)))
- return 1;
- }
- }
- }
- return 0;
-}
-
-/* Similar to above, except that it also rejects register pre- and post-
- incrementing. */
-
-int
-side_effects_p (x)
- rtx x;
-{
- register RTX_CODE code;
-
- code = GET_CODE (x);
- switch (code)
- {
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST_INT:
- case CONST:
- case CONST_DOUBLE:
- case CC0:
- case PC:
- case REG:
- case SCRATCH:
- case ASM_INPUT:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- return 0;
-
- case CLOBBER:
- /* Reject CLOBBER with a non-VOID mode. These are made by combine.c
- when some combination can't be done. If we see one, don't think
- that we can simplify the expression. */
- return (GET_MODE (x) != VOIDmode);
-
- case PRE_INC:
- case PRE_DEC:
- case POST_INC:
- case POST_DEC:
- case CALL:
- case UNSPEC_VOLATILE:
- /* case TRAP_IF: This isn't clear yet. */
- return 1;
-
- case MEM:
- case ASM_OPERANDS:
- if (MEM_VOLATILE_P (x))
- return 1;
- }
-
- /* Recursively scan the operands of this expression. */
-
- {
- register char *fmt = GET_RTX_FORMAT (code);
- register int i;
-
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- if (side_effects_p (XEXP (x, i)))
- return 1;
- }
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (side_effects_p (XVECEXP (x, i, j)))
- return 1;
- }
- }
- }
- return 0;
-}
-
-/* Return nonzero if evaluating rtx X might cause a trap. */
-
-int
-may_trap_p (x)
- rtx x;
-{
- int i;
- enum rtx_code code;
- char *fmt;
-
- if (x == 0)
- return 0;
- code = GET_CODE (x);
- switch (code)
- {
- /* Handle these cases quickly. */
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case LABEL_REF:
- case CONST:
- case PC:
- case CC0:
- case REG:
- case SCRATCH:
- return 0;
-
- /* Conditional trap can trap! */
- case UNSPEC_VOLATILE:
- case TRAP_IF:
- return 1;
-
- /* Memory ref can trap unless it's a static var or a stack slot. */
- case MEM:
- return rtx_addr_can_trap_p (XEXP (x, 0));
-
- /* Division by a non-constant might trap. */
- case DIV:
- case MOD:
- case UDIV:
- case UMOD:
- if (! CONSTANT_P (XEXP (x, 1)))
- return 1;
- /* This was const0_rtx, but by not using that,
- we can link this file into other programs. */
- if (GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) == 0)
- return 1;
- case EXPR_LIST:
- /* An EXPR_LIST is used to represent a function call. This
- certainly may trap. */
- return 1;
- default:
- /* Any floating arithmetic may trap. */
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
- return 1;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- if (may_trap_p (XEXP (x, i)))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- if (may_trap_p (XVECEXP (x, i, j)))
- return 1;
- }
- }
- return 0;
-}
-
-/* Return nonzero if X contains a comparison that is not either EQ or NE,
- i.e., an inequality. */
-
-int
-inequality_comparisons_p (x)
- rtx x;
-{
- register char *fmt;
- register int len, i;
- register enum rtx_code code = GET_CODE (x);
-
- switch (code)
- {
- case REG:
- case SCRATCH:
- case PC:
- case CC0:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case LABEL_REF:
- case SYMBOL_REF:
- return 0;
-
- case LT:
- case LTU:
- case GT:
- case GTU:
- case LE:
- case LEU:
- case GE:
- case GEU:
- return 1;
- }
-
- len = GET_RTX_LENGTH (code);
- fmt = GET_RTX_FORMAT (code);
-
- for (i = 0; i < len; i++)
- {
- if (fmt[i] == 'e')
- {
- if (inequality_comparisons_p (XEXP (x, i)))
- return 1;
- }
- else if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (inequality_comparisons_p (XVECEXP (x, i, j)))
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Replace any occurrence of FROM in X with TO.
-
- Note that copying is not done so X must not be shared unless all copies
- are to be modified. */
-
-rtx
-replace_rtx (x, from, to)
- rtx x, from, to;
-{
- register int i, j;
- register char *fmt;
-
- if (x == from)
- return to;
-
- /* Allow this function to make replacements in EXPR_LISTs. */
- if (x == 0)
- return 0;
-
- fmt = GET_RTX_FORMAT (GET_CODE (x));
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- XEXP (x, i) = replace_rtx (XEXP (x, i), from, to);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- XVECEXP (x, i, j) = replace_rtx (XVECEXP (x, i, j), from, to);
- }
-
- return x;
-}
-
-/* Throughout the rtx X, replace many registers according to REG_MAP.
- Return the replacement for X (which may be X with altered contents).
- REG_MAP[R] is the replacement for register R, or 0 for don't replace.
- NREGS is the length of REG_MAP; regs >= NREGS are not mapped.
-
- We only support REG_MAP entries of REG or SUBREG. Also, hard registers
- should not be mapped to pseudos or vice versa since validate_change
- is not called.
-
- If REPLACE_DEST is 1, replacements are also done in destinations;
- otherwise, only sources are replaced. */
-
-rtx
-replace_regs (x, reg_map, nregs, replace_dest)
- rtx x;
- rtx *reg_map;
- int nregs;
- int replace_dest;
-{
- register enum rtx_code code;
- register int i;
- register char *fmt;
-
- if (x == 0)
- return x;
-
- code = GET_CODE (x);
- switch (code)
- {
- case SCRATCH:
- case PC:
- case CC0:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- return x;
-
- case REG:
- /* Verify that the register has an entry before trying to access it. */
- if (REGNO (x) < nregs && reg_map[REGNO (x)] != 0)
- {
- /* SUBREGs can't be shared. Always return a copy to ensure that if
- this replacement occurs more than once then each instance will
- get distinct rtx. */
- if (GET_CODE (reg_map[REGNO (x)]) == SUBREG)
- return copy_rtx (reg_map[REGNO (x)]);
- return reg_map[REGNO (x)];
- }
- return x;
-
- case SUBREG:
- /* Prevent making nested SUBREGs. */
- if (GET_CODE (SUBREG_REG (x)) == REG && REGNO (SUBREG_REG (x)) < nregs
- && reg_map[REGNO (SUBREG_REG (x))] != 0
- && GET_CODE (reg_map[REGNO (SUBREG_REG (x))]) == SUBREG)
- {
- rtx map_val = reg_map[REGNO (SUBREG_REG (x))];
- rtx map_inner = SUBREG_REG (map_val);
-
- if (GET_MODE (x) == GET_MODE (map_inner))
- return map_inner;
- else
- {
- /* We cannot call gen_rtx here since we may be linked with
- genattrtab.c. */
- /* Let's try clobbering the incoming SUBREG and see
- if this is really safe. */
- SUBREG_REG (x) = map_inner;
- SUBREG_WORD (x) += SUBREG_WORD (map_val);
- return x;
-#if 0
- rtx new = rtx_alloc (SUBREG);
- PUT_MODE (new, GET_MODE (x));
- SUBREG_REG (new) = map_inner;
- SUBREG_WORD (new) = SUBREG_WORD (x) + SUBREG_WORD (map_val);
-#endif
- }
- }
- break;
-
- case SET:
- if (replace_dest)
- SET_DEST (x) = replace_regs (SET_DEST (x), reg_map, nregs, 0);
-
- else if (GET_CODE (SET_DEST (x)) == MEM
- || GET_CODE (SET_DEST (x)) == STRICT_LOW_PART)
- /* Even if we are not to replace destinations, replace register if it
- is CONTAINED in destination (destination is memory or
- STRICT_LOW_PART). */
- XEXP (SET_DEST (x), 0) = replace_regs (XEXP (SET_DEST (x), 0),
- reg_map, nregs, 0);
- else if (GET_CODE (SET_DEST (x)) == ZERO_EXTRACT)
- /* Similarly, for ZERO_EXTRACT we replace all operands. */
- break;
-
- SET_SRC (x) = replace_regs (SET_SRC (x), reg_map, nregs, 0);
- return x;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- XEXP (x, i) = replace_regs (XEXP (x, i), reg_map, nregs, replace_dest);
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- XVECEXP (x, i, j) = replace_regs (XVECEXP (x, i, j), reg_map,
- nregs, replace_dest);
- }
- }
- return x;
-}
diff --git a/gcc/scan-decls.c b/gcc/scan-decls.c
deleted file mode 100644
index 253f3fc22b3..00000000000
--- a/gcc/scan-decls.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* scan-decls.c - Extracts declarations from cpp output.
- Copyright (C) 1993, 1995 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, 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.
-
- Written by Per Bothner <bothner@cygnus.com>, July 1993. */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "hconfig.h"
-#include "cpplib.h"
-
-int brace_nesting = 0;
-
-/* The first extern_C_braces_length elements of extern_C_braces
- indicate the (brace nesting levels of) left braces that were
- prefixed by extern "C". */
-int extern_C_braces_length = 0;
-char extern_C_braces[20];
-#define in_extern_C_brace (extern_C_braces_length>0)
-
-/* True if the function declaration currently being scanned is
- prefixed by extern "C". */
-int current_extern_C = 0;
-
-static void
-skip_to_closing_brace (pfile)
- cpp_reader *pfile;
-{
- int nesting = 1;
- for (;;)
- {
- enum cpp_token token = cpp_get_token (pfile);
- if (token == CPP_EOF)
- break;
- if (token == CPP_LBRACE)
- nesting++;
- if (token == CPP_RBRACE && --nesting == 0)
- break;
- }
-}
-
-/* This function scans a C source file (actually, the output of cpp),
- reading from FP. It looks for function declarations, and
- external variable declarations.
-
- The following grammar (as well as some extra stuff) is recognized:
-
- declaration:
- (decl-specifier)* declarator ("," declarator)* ";"
- decl-specifier:
- identifier
- keyword
- extern "C"
- declarator:
- (ptr-operator)* dname [ "(" argument-declaration-list ")" ]
- ptr-operator:
- ("*" | "&") ("const" | "volatile")*
- dname:
- identifier
-
-Here dname is the actual name being declared.
-*/
-
-int
-scan_decls (pfile, argc, argv)
- cpp_reader *pfile;
- int argc;
- char **argv;
-{
- int saw_extern, saw_inline;
- int old_written;
- /* If declarator_start is non-zero, it marks the start of the current
- declarator. If it is zero, we are either still parsing the
- decl-specs, or prev_id_start marks the start of the declarator. */
- int declarator_start;
- int prev_id_start, prev_id_end;
- enum cpp_token token;
-
- new_statement:
- CPP_SET_WRITTEN (pfile, 0);
- token = cpp_get_token (pfile);
-
- handle_statement:
- current_extern_C = 0;
- saw_extern = 0;
- saw_inline = 0;
- if (token == CPP_RBRACE)
- {
- /* Pop an 'extern "C"' nesting level, if appropriate. */
- if (extern_C_braces_length
- && extern_C_braces[extern_C_braces_length - 1] == brace_nesting)
- extern_C_braces_length--;
- brace_nesting--;
- goto new_statement;
- }
- if (token == CPP_LBRACE)
- {
- brace_nesting++;
- goto new_statement;
- }
- if (token == CPP_EOF)
- return 0;
- if (token == CPP_SEMICOLON)
- goto new_statement;
- if (token != CPP_NAME)
- goto new_statement;
-
- prev_id_start = 0;
- declarator_start = 0;
- for (;;)
- {
- int start_written = CPP_WRITTEN (pfile);
- token = cpp_get_token (pfile);
- handle_token:
- switch (token)
- {
- case CPP_LPAREN:
- /* Looks like this is the start of a formal parameter list. */
- if (prev_id_start)
- {
- int nesting = 1;
- int have_arg_list = 0;
- cpp_buffer *fbuf = cpp_file_buffer (pfile);
- long func_lineno;
- cpp_buf_line_and_col (fbuf, &func_lineno, NULL);
- for (;;)
- {
- token = cpp_get_token (pfile);
- if (token == CPP_LPAREN)
- nesting++;
- else if (token == CPP_RPAREN)
- {
- nesting--;
- if (nesting == 0)
- break;
- }
- else if (token == CPP_EOF)
- break;
- else if (token == CPP_NAME || token == CPP_3DOTS)
- have_arg_list = 1;
- }
- recognized_function (pfile->token_buffer + prev_id_start,
- prev_id_end - prev_id_start,
- (saw_inline ? 'I'
- : in_extern_C_brace || current_extern_C
- ? 'F' : 'f'),
- pfile->token_buffer, prev_id_start,
- have_arg_list,
- fbuf->nominal_fname, func_lineno);
- token = cpp_get_non_space_token (pfile);
- if (token == CPP_LBRACE)
- {
- /* skip body of (normally) inline function */
- skip_to_closing_brace (pfile);
- goto new_statement;
- }
- goto maybe_handle_comma;
- }
- break;
- case CPP_OTHER:
- if (CPP_WRITTEN (pfile) == start_written + 1
- && (CPP_PWRITTEN (pfile)[-1] == '*'
- || CPP_PWRITTEN (pfile)[-1] == '&'))
- declarator_start = start_written;
- else
- goto handle_statement;
- break;
- case CPP_COMMA:
- case CPP_SEMICOLON:
- if (prev_id_start && saw_extern)
- {
- recognized_extern (pfile->token_buffer + prev_id_start,
- prev_id_end - prev_id_start,
- pfile->token_buffer,
- prev_id_start);
- }
- /* ... fall through ... */
- maybe_handle_comma:
- if (token != CPP_COMMA)
- goto new_statement;
- handle_comma:
- /* Handle multiple declarators in a single declaration,
- as in: extern char *strcpy (), *strcat (), ... ; */
- if (declarator_start == 0)
- declarator_start = prev_id_start;
- CPP_SET_WRITTEN (pfile, declarator_start);
- break;
- case CPP_NAME:
- /* "inline" and "extern" are recognized but skipped */
- if (strcmp (pfile->token_buffer, "inline") == 0)
- {
- saw_inline = 1;
- CPP_SET_WRITTEN (pfile, start_written);
- }
- if (strcmp (pfile->token_buffer, "extern") == 0)
- {
- saw_extern = 1;
- CPP_SET_WRITTEN (pfile, start_written);
- token = cpp_get_non_space_token (pfile);
- if (token == CPP_STRING
- && strcmp (pfile->token_buffer, "\"C\"") == 0)
- {
- CPP_SET_WRITTEN (pfile, start_written);
- current_extern_C = 1;
- token = cpp_get_non_space_token (pfile);
- if (token == CPP_LBRACE)
- {
- brace_nesting++;
- extern_C_braces[extern_C_braces_length++]
- = brace_nesting;
- goto new_statement;
- }
- }
- else
- goto handle_token;
- break;
- }
- /* This may be the name of a variable or function. */
- prev_id_start = start_written;
- prev_id_end = CPP_WRITTEN (pfile);
- break;
-
- case CPP_EOF:
- return; /* ??? FIXME */
-
- case CPP_LBRACE: case CPP_RBRACE: case CPP_DIRECTIVE:
- goto new_statement; /* handle_statement? */
-
- case CPP_HSPACE: case CPP_VSPACE: case CPP_COMMENT: case CPP_POP:
- /* Skip initial white space. */
- if (start_written == 0)
- CPP_SET_WRITTEN (pfile, 0);
- break;
-
- default:
- prev_id_start = 0;
- }
- }
-}
diff --git a/gcc/scan-types.sh b/gcc/scan-types.sh
deleted file mode 100755
index a7fa2384979..00000000000
--- a/gcc/scan-types.sh
+++ /dev/null
@@ -1,139 +0,0 @@
-#! /bin/sh
-# Deduce values of standard ANSI and POSIX types (e.g. size_t, pid_t).
-# Emits macros definitions for these, and some other types.
-# Intended to be used to massage the sys-protos.h file.
-# Expects one arg, which is the GCC source directory.
-
-CC=${CC-"./xgcc -B$1/"}
-CPP=${CPP-`echo ${CC} -E -I"$1/"`}
-SED=sed
-
-# Generate definitions for the standard types (such as mode_t)
-# compatible with those in the standard C header files.
-# It works by a dummy program through the C pre-processor, and then
-# using sed to search for typedefs in the output.
-
-cat >st-dummy.c <<!EOF!
-#include <sys/types.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <time.h>
-#include <signal.h>
-#ifdef size_t
-typedef size_t Xsize_t;
-#elif defined(__SIZE_TYPE__)
-typedef __SIZE_TYPE__ Xsize_t;
-#endif
-#ifdef va_list
-typedef va_list XXXva_list;
-#endif
-!EOF!
-
-if ${CPP} st-dummy.c >TMP ; then true
-else
- echo "scan-types: could not invoke ${CPP} on st-dummy.c" 1>&2 ; exit 1
-fi
-tr ' ' ' ' <TMP >st-dummy.out
-
-for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t size_t ssize_t time_t uid_t va_list int32_t uint_32_t ; do
- IMPORTED=`eval 'echo $'"$TYPE"`
- if [ -n "${IMPORTED}" ] ; then
- eval "$TYPE='$IMPORTED"
- else
- # Search st-dummy.out for a typedef for $TYPE, and write it out
- # to TMP in #define syntax.
- rm -f TMP
- ${SED} -n -e "s|.*typedef *\(.*\) X*$TYPE *;.*|\1|w TMP" <st-dummy.out>/dev/null
- # Now select the first definition.
- if [ -s TMP ]; then
- # VALUE is now the typedef'd definition of $TYPE.
- eval "VALUE='`${SED} -e 's| *$||' -e '2,$d' <TMP`'"
- # Unless VALUE contains a blank, look for a typedef for it
- # in turn (this could be a loop, but that would be over-kill).
- if echo $VALUE | grep " " >/dev/null ; then true
- else
- rm -f TMP
- ${SED} -n -e "s|.*typedef[ ][ ]*\(.*[^a-zA-Z0-9_]\)${VALUE}[ ]*;.*|\1|w TMP" <st-dummy.out>/dev/null
- if [ -s TMP ]; then
- eval "VALUE='`${SED} -e '2,$d' -e 's|[ ]*$||' <TMP`'"
- fi
- fi
- eval "$TYPE='$VALUE'"
- fi
- fi
-done
-
-cat <<!EOF!
-#define ${macro_prefix}clock_t ${clock_t-int /* default */}
-#define ${macro_prefix}dev_t ${dev_t-int /* default */}
-#define ${macro_prefix}fpos_t ${fpos_t-long /* default */}
-#define ${macro_prefix}gid_t ${gid_t-int /* default */}
-#define ${macro_prefix}ino_t ${ino_t-int /* default */}
-#define ${macro_prefix}mode_t ${mode_t-int /* default */}
-#define ${macro_prefix}nlink_t ${nlink_t-int /* default */}
-#define ${macro_prefix}off_t ${off_t-long /* default */}
-#define ${macro_prefix}pid_t ${pid_t-int /* default */}
-#define ${macro_prefix}ptrdiff_t __PTRDIFF_TYPE__
-#define ${macro_prefix}size_t __SIZE_TYPE__
-#define ${macro_prefix}time_t ${time_t-int /* default */}
-#define ${macro_prefix}uid_t ${uid_t-int /* default */}
-#define ${macro_prefix}wchar_t __WCHAR_TYPE__
-#define ${macro_prefix}int32_t ${int32_t-int /* default */}
-#define ${macro_prefix}uint32_t ${uint32_t-unsigned int /* default */}
-!EOF!
-
-# (wait_arg_t*) should be (int*), according to Posix, but
-# BSD traditionally used (union wait*). Use (void*) to allow either usage.
-echo "#define ${macro_prefix}wait_arg_t void"
-
-# ssize_t is the signed version of size_t
-if [ -n "${ssize_t}" ] ; then
- echo "#define ${macro_prefix}ssize_t ${ssize_t}"
-elif [ -z "${size_t}" ] ; then
- echo "#define ${macro_prefix}ssize_t long"
-else
- # Remove "unsigned" from ${size_t} to get ${ssize_t}.
- tmp="`echo ${size_t} | ${SED} -e 's|unsigned||g' -e 's| | |g'`"
- if [ -z "$tmp" ] ; then
- tmp=int
- else
- # check $tmp doesn't conflict with <unistd.h>
- echo "#include <unistd.h>
- extern $tmp read();" >st-dummy.c
- ${CC} -c st-dummy.c >/dev/null 2>&1 || tmp=int
- fi
- echo "#define ${macro_prefix}ssize_t $tmp /* default */"
-fi
-
-# va_list can cause problems (e.g. some systems have va_list as a struct).
-# Check to see if ${va_list-char*} really is compatible with stdarg.h.
-cat >st-dummy.c <<!EOF!
-#define X_va_list ${va_list-char* /* default */}
-extern long foo(X_va_list ap); /* Check that X_va_list compiles on its own */
-#include <stdarg.h>
-long foo(X_va_list ap) { return va_arg(ap, long); }
-long bar(int i, ...)
-{ va_list ap; long j; va_start(ap, i); j = foo(ap); va_end(ap); return j; }
-!EOF!
-if ${CC} -c st-dummy.c >/dev/null 2>&1 ; then
- # Ok: We have something that works.
- echo "#define ${macro_prefix}va_list ${va_list-char* /* default */}"
-else
- # No, it breaks. Indicate that <stdarg.h> must be included.
- echo "#define ${macro_prefix}NEED_STDARG_H
-#define ${macro_prefix}va_list va_list"
-fi
-
-# stuff needed for curses.h
-
-# This isn't correct for SVR4 (for example). However, we only
-# use this when adding a missing prototype, so it shouldn't matter.
-echo "#define chtype int"
-# sys-protos.h uses non-standard names (due to the CHTYPE argument problem).
-echo "#define box32 box"
-echo "#define initscr32 initscr"
-echo "#define w32addch waddch"
-echo "#define w32insch winsch"
-
-rm -f st-dummy.c st-dummy.o TMP st-dummy.out
diff --git a/gcc/scan.c b/gcc/scan.c
deleted file mode 100644
index 4f575b38a9f..00000000000
--- a/gcc/scan.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* Utility functions for scan-decls and fix-header programs.
- Copyright (C) 1993, 1994 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, 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. */
-
-#include "scan.h"
-#include "hconfig.h"
-#include <ctype.h>
-
-int lineno = 1;
-int source_lineno = 1;
-sstring source_filename;
-
-void
-make_sstring_space (str, count)
- sstring *str;
- int count;
-{
- int cur_pos = str->ptr - str->base;
- int cur_size = str->limit - str->base;
- int new_size = cur_pos + count + 100;
-
- if (new_size <= cur_size)
- return;
-
- if (str->base == NULL)
- str->base = xmalloc (new_size);
- else
- str->base = xrealloc (str->base, new_size);
- str->ptr = str->base + cur_size;
- str->limit = str->base + new_size;
-}
-
-void
-sstring_append (dst, src)
- sstring *dst;
- sstring *src;
-{
- register char *d, *s;
- register count = SSTRING_LENGTH(src);
- MAKE_SSTRING_SPACE(dst, count + 1);
- d = dst->ptr;
- s = src->base;
- while (--count >= 0) *d++ = *s++;
- dst->ptr = d;
- *d = 0;
-}
-
-int
-scan_ident (fp, s, c)
- register FILE *fp;
- register sstring *s;
- int c;
-{
- s->ptr = s->base;
- if (isalpha(c) || c == '_')
- {
- for (;;)
- {
- SSTRING_PUT(s, c);
- c = getc (fp);
- if (c == EOF || !(isalnum(c) || c == '_'))
- break;
- }
- }
- MAKE_SSTRING_SPACE(s, 1);
- *s->ptr = 0;
- return c;
-}
-
-int
-scan_string (fp, s, init)
- register FILE *fp;
- register sstring *s;
-{
- int c;
- for (;;)
- {
- c = getc (fp);
- if (c == EOF || c == '\n')
- break;
- if (c == init)
- {
- c = getc (fp);
- break;
- }
- if (c == '\\')
- {
- c = getc (fp);
- if (c == EOF)
- break;
- if (c == '\n')
- continue;
- }
- SSTRING_PUT(s, c);
- }
- MAKE_SSTRING_SPACE(s, 1);
- *s->ptr = 0;
- return c;
-}
-
-/* Skip horizontal white spaces (spaces, tabs, and C-style comments). */
-
-int
-skip_spaces (fp, c)
- register FILE *fp;
- int c;
-{
- for (;;)
- {
- if (c == ' ' || c == '\t')
- c = getc (fp);
- else if (c == '/')
- {
- c = getc (fp);
- if (c != '*')
- {
- ungetc (c, fp);
- return '/';
- }
- c = getc (fp);
- for (;;)
- {
- if (c == EOF)
- return EOF;
- else if (c != '*')
- {
- if (c == '\n')
- source_lineno++, lineno++;
- c = getc (fp);
- }
- else if ((c = getc (fp)) == '/')
- return getc (fp);
- }
- }
- else
- break;
- }
- return c;
-}
-
-int
-read_upto (fp, str, delim)
- FILE *fp;
- sstring *str;
- int delim;
-{
- int ch;
- for (;;)
- {
- ch = getc (fp);
- if (ch == EOF || ch == delim)
- break;
- SSTRING_PUT(str, ch);
- }
- MAKE_SSTRING_SPACE(str, 1);
- *str->ptr = 0;
- return ch;
-}
-
-int
-get_token (fp, s)
- register FILE *fp;
- register sstring *s;
-{
- int c;
- s->ptr = s->base;
- retry:
- c = ' ';
- c = skip_spaces (fp, c);
- if (c == '\n')
- {
- source_lineno++;
- lineno++;
- goto retry;
- }
- if (c == '#')
- {
- c = get_token (fp, s);
- if (c == INT_TOKEN)
- {
- source_lineno = atoi (s->base) - 1; /* '\n' will add 1 */
- get_token (fp, &source_filename);
- }
- for (;;)
- {
- c = getc (fp);
- if (c == EOF)
- return EOF;
- if (c == '\n')
- {
- source_lineno++;
- lineno++;
- goto retry;
- }
- }
- }
- if (c == EOF)
- return EOF;
- if (isdigit (c))
- {
- do
- {
- SSTRING_PUT(s, c);
- c = getc (fp);
- } while (c != EOF && isdigit(c));
- ungetc (c, fp);
- c = INT_TOKEN;
- goto done;
- }
- if (isalpha (c) || c == '_')
- {
- c = scan_ident (fp, s, c);
- ungetc (c, fp);
- return IDENTIFIER_TOKEN;
- }
- if (c == '\'' || c == '"')
- {
- c = scan_string (fp, s, c);
- ungetc (c, fp);
- return c == '\'' ? CHAR_TOKEN : STRING_TOKEN;
- }
- SSTRING_PUT(s, c);
- done:
- MAKE_SSTRING_SPACE(s, 1);
- *s->ptr = 0;
- return c;
-}
diff --git a/gcc/scan.h b/gcc/scan.h
deleted file mode 100644
index 929a1ef5fee..00000000000
--- a/gcc/scan.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* scan.h - Utility declarations for scan-decls and fix-header programs.
- Copyright (C) 1993 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, 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. */
-
-#include <stdio.h>
-
-typedef struct sstring
-{
- char *base;
- char *ptr;
- char *limit;
-} sstring;
-
-#define INIT_SSTRING(STR) ((STR)->base = 0, (STR)->ptr = 0, (STR)->limit = 0)
-#define FREE_SSTRING(STR) do { if ((STR)->base) free (STR)->base; } while(0)
-#define SSTRING_PUT(STR, C) do {\
- if ((STR)->limit <= (STR)->ptr) make_sstring_space (STR, 1); \
- *(STR)->ptr++ = (C); } while (0)
-#define SSTRING_LENGTH(STR) ((STR)->ptr - (STR)->base)
-#define MAKE_SSTRING_SPACE(STR, COUNT) \
- if ((STR)->limit - (STR)->ptr < (COUNT)) make_sstring_space (STR, COUNT);
-
-#ifndef _PARAMS
-#if defined(__STDC__) || defined(__cplusplus)
-#define _PARAMS(args) args
-#else
-#define _PARAMS(args) ()
-#endif
-#endif
-
-struct partial_proto;
-struct fn_decl
-{
- char *fname;
- char *rtype;
- char *params;
- struct partial_proto *partial;
-};
-
-extern int lineno;
-extern void sstring_append _PARAMS((sstring *, sstring *));
-extern void make_sstring_space _PARAMS((sstring *, int));
-extern int skip_spaces _PARAMS((FILE *, int));
-extern int scan_ident _PARAMS((FILE *, sstring *, int));
-extern int scan_string _PARAMS((FILE *, sstring *, int));
-extern int read_upto _PARAMS((FILE *, sstring *, int));
-extern char *xmalloc _PARAMS((unsigned));
-extern char *xrealloc _PARAMS((char *, unsigned));
-extern unsigned long hash _PARAMS((const char *));
-
-/* get_token is a simple C lexer. */
-#define IDENTIFIER_TOKEN 300
-#define CHAR_TOKEN 301
-#define STRING_TOKEN 302
-#define INT_TOKEN 303
-extern int get_token _PARAMS ((FILE *, sstring *));
-
-/* Current file and line numer, taking #-directives into account */
-extern int source_lineno;
-extern sstring source_filename;
-/* Current physical line number */
-extern int lineno;
diff --git a/gcc/sched.c b/gcc/sched.c
deleted file mode 100644
index d7fe1ca250c..00000000000
--- a/gcc/sched.c
+++ /dev/null
@@ -1,5137 +0,0 @@
-/* Instruction scheduling pass.
- Copyright (C) 1992, 93-96, 1997 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.com)
- Enhanced by, and currently maintained by, Jim Wilson (wilson@cygnus.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. */
-
-/* Instruction scheduling pass.
-
- This pass implements list scheduling within basic blocks. It is
- run after flow analysis, but before register allocation. The
- scheduler works as follows:
-
- We compute insn priorities based on data dependencies. Flow
- analysis only creates a fraction of the data-dependencies we must
- observe: namely, only those dependencies which the combiner can be
- expected to use. For this pass, we must therefore create the
- remaining dependencies we need to observe: register dependencies,
- memory dependencies, dependencies to keep function calls in order,
- and the dependence between a conditional branch and the setting of
- condition codes are all dealt with here.
-
- The scheduler first traverses the data flow graph, starting with
- the last instruction, and proceeding to the first, assigning
- values to insn_priority as it goes. This sorts the instructions
- topologically by data dependence.
-
- Once priorities have been established, we order the insns using
- list scheduling. This works as follows: starting with a list of
- all the ready insns, and sorted according to priority number, we
- schedule the insn from the end of the list by placing its
- predecessors in the list according to their priority order. We
- consider this insn scheduled by setting the pointer to the "end" of
- the list to point to the previous insn. When an insn has no
- predecessors, we either queue it until sufficient time has elapsed
- or add it to the ready list. As the instructions are scheduled or
- when stalls are introduced, the queue advances and dumps insns into
- the ready list. When all insns down to the lowest priority have
- been scheduled, the critical path of the basic block has been made
- as short as possible. The remaining insns are then scheduled in
- remaining slots.
-
- Function unit conflicts are resolved during reverse list scheduling
- by tracking the time when each insn is committed to the schedule
- and from that, the time the function units it uses must be free.
- As insns on the ready list are considered for scheduling, those
- that would result in a blockage of the already committed insns are
- queued until no blockage will result. Among the remaining insns on
- the ready list to be considered, the first one with the largest
- potential for causing a subsequent blockage is chosen.
-
- The following list shows the order in which we want to break ties
- among insns in the ready list:
-
- 1. choose insn with lowest conflict cost, ties broken by
- 2. choose insn with the longest path to end of bb, ties broken by
- 3. choose insn that kills the most registers, ties broken by
- 4. choose insn that conflicts with the most ready insns, or finally
- 5. choose insn with lowest UID.
-
- Memory references complicate matters. Only if we can be certain
- that memory references are not part of the data dependency graph
- (via true, anti, or output dependence), can we move operations past
- memory references. To first approximation, reads can be done
- independently, while writes introduce dependencies. Better
- approximations will yield fewer dependencies.
-
- Dependencies set up by memory references are treated in exactly the
- same way as other dependencies, by using LOG_LINKS.
-
- Having optimized the critical path, we may have also unduly
- extended the lifetimes of some registers. If an operation requires
- that constants be loaded into registers, it is certainly desirable
- to load those constants as early as necessary, but no earlier.
- I.e., it will not do to load up a bunch of registers at the
- beginning of a basic block only to use them at the end, if they
- could be loaded later, since this may result in excessive register
- utilization.
-
- Note that since branches are never in basic blocks, but only end
- basic blocks, this pass will not do any branch scheduling. But
- that is ok, since we can use GNU's delayed branch scheduling
- pass to take care of this case.
-
- Also note that no further optimizations based on algebraic identities
- are performed, so this pass would be a good one to perform instruction
- splitting, such as breaking up a multiply instruction into shifts
- and adds where that is profitable.
-
- Given the memory aliasing analysis that this pass should perform,
- it should be possible to remove redundant stores to memory, and to
- load values from registers instead of hitting memory.
-
- This pass must update information that subsequent passes expect to be
- correct. Namely: reg_n_refs, reg_n_sets, reg_n_deaths,
- reg_n_calls_crossed, and reg_live_length. Also, basic_block_head,
- basic_block_end.
-
- The information in the line number notes is carefully retained by
- this pass. Notes that refer to the starting and ending of
- exception regions are also carefully retained by this pass. All
- other NOTE insns are grouped in their same relative order at the
- beginning of basic blocks that have been scheduled. */
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "basic-block.h"
-#include "regs.h"
-#include "hard-reg-set.h"
-#include "flags.h"
-#include "insn-config.h"
-#include "insn-attr.h"
-
-#ifdef INSN_SCHEDULING
-/* Arrays set up by scheduling for the same respective purposes as
- similar-named arrays set up by flow analysis. We work with these
- arrays during the scheduling pass so we can compare values against
- unscheduled code.
-
- Values of these arrays are copied at the end of this pass into the
- arrays set up by flow analysis. */
-static short *sched_reg_n_deaths;
-static int *sched_reg_n_calls_crossed;
-static int *sched_reg_live_length;
-
-/* Element N is the next insn that sets (hard or pseudo) register
- N within the current basic block; or zero, if there is no
- such insn. Needed for new registers which may be introduced
- by splitting insns. */
-static rtx *reg_last_uses;
-static rtx *reg_last_sets;
-static regset reg_pending_sets;
-static int reg_pending_sets_all;
-
-/* Vector indexed by INSN_UID giving the original ordering of the insns. */
-static int *insn_luid;
-#define INSN_LUID(INSN) (insn_luid[INSN_UID (INSN)])
-
-/* Vector indexed by INSN_UID giving each instruction a priority. */
-static int *insn_priority;
-#define INSN_PRIORITY(INSN) (insn_priority[INSN_UID (INSN)])
-
-static short *insn_costs;
-#define INSN_COST(INSN) insn_costs[INSN_UID (INSN)]
-
-/* Vector indexed by INSN_UID giving an encoding of the function units
- used. */
-static short *insn_units;
-#define INSN_UNIT(INSN) insn_units[INSN_UID (INSN)]
-
-/* Vector indexed by INSN_UID giving an encoding of the blockage range
- function. The unit and the range are encoded. */
-static unsigned int *insn_blockage;
-#define INSN_BLOCKAGE(INSN) insn_blockage[INSN_UID (INSN)]
-#define UNIT_BITS 5
-#define BLOCKAGE_MASK ((1 << BLOCKAGE_BITS) - 1)
-#define ENCODE_BLOCKAGE(U,R) \
- ((((U) << UNIT_BITS) << BLOCKAGE_BITS \
- | MIN_BLOCKAGE_COST (R)) << BLOCKAGE_BITS \
- | MAX_BLOCKAGE_COST (R))
-#define UNIT_BLOCKED(B) ((B) >> (2 * BLOCKAGE_BITS))
-#define BLOCKAGE_RANGE(B) \
- (((((B) >> BLOCKAGE_BITS) & BLOCKAGE_MASK) << (HOST_BITS_PER_INT / 2)) \
- | (B) & BLOCKAGE_MASK)
-
-/* Encodings of the `<name>_unit_blockage_range' function. */
-#define MIN_BLOCKAGE_COST(R) ((R) >> (HOST_BITS_PER_INT / 2))
-#define MAX_BLOCKAGE_COST(R) ((R) & ((1 << (HOST_BITS_PER_INT / 2)) - 1))
-
-#define DONE_PRIORITY -1
-#define MAX_PRIORITY 0x7fffffff
-#define TAIL_PRIORITY 0x7ffffffe
-#define LAUNCH_PRIORITY 0x7f000001
-#define DONE_PRIORITY_P(INSN) (INSN_PRIORITY (INSN) < 0)
-#define LOW_PRIORITY_P(INSN) ((INSN_PRIORITY (INSN) & 0x7f000000) == 0)
-
-/* Vector indexed by INSN_UID giving number of insns referring to this insn. */
-static int *insn_ref_count;
-#define INSN_REF_COUNT(INSN) (insn_ref_count[INSN_UID (INSN)])
-
-/* Vector indexed by INSN_UID giving line-number note in effect for each
- insn. For line-number notes, this indicates whether the note may be
- reused. */
-static rtx *line_note;
-#define LINE_NOTE(INSN) (line_note[INSN_UID (INSN)])
-
-/* Vector indexed by basic block number giving the starting line-number
- for each basic block. */
-static rtx *line_note_head;
-
-/* List of important notes we must keep around. This is a pointer to the
- last element in the list. */
-static rtx note_list;
-
-/* Regsets telling whether a given register is live or dead before the last
- scheduled insn. Must scan the instructions once before scheduling to
- determine what registers are live or dead at the end of the block. */
-static regset bb_dead_regs;
-static regset bb_live_regs;
-
-/* Regset telling whether a given register is live after the insn currently
- being scheduled. Before processing an insn, this is equal to bb_live_regs
- above. This is used so that we can find registers that are newly born/dead
- after processing an insn. */
-static regset old_live_regs;
-
-/* The chain of REG_DEAD notes. REG_DEAD notes are removed from all insns
- during the initial scan and reused later. If there are not exactly as
- many REG_DEAD notes in the post scheduled code as there were in the
- prescheduled code then we trigger an abort because this indicates a bug. */
-static rtx dead_notes;
-
-/* Queues, etc. */
-
-/* An instruction is ready to be scheduled when all insns following it
- have already been scheduled. It is important to ensure that all
- insns which use its result will not be executed until its result
- has been computed. An insn is maintained in one of four structures:
-
- (P) the "Pending" set of insns which cannot be scheduled until
- their dependencies have been satisfied.
- (Q) the "Queued" set of insns that can be scheduled when sufficient
- time has passed.
- (R) the "Ready" list of unscheduled, uncommitted insns.
- (S) the "Scheduled" list of insns.
-
- Initially, all insns are either "Pending" or "Ready" depending on
- whether their dependencies are satisfied.
-
- Insns move from the "Ready" list to the "Scheduled" list as they
- are committed to the schedule. As this occurs, the insns in the
- "Pending" list have their dependencies satisfied and move to either
- the "Ready" list or the "Queued" set depending on whether
- sufficient time has passed to make them ready. As time passes,
- insns move from the "Queued" set to the "Ready" list. Insns may
- move from the "Ready" list to the "Queued" set if they are blocked
- due to a function unit conflict.
-
- The "Pending" list (P) are the insns in the LOG_LINKS of the unscheduled
- insns, i.e., those that are ready, queued, and pending.
- The "Queued" set (Q) is implemented by the variable `insn_queue'.
- The "Ready" list (R) is implemented by the variables `ready' and
- `n_ready'.
- The "Scheduled" list (S) is the new insn chain built by this pass.
-
- The transition (R->S) is implemented in the scheduling loop in
- `schedule_block' when the best insn to schedule is chosen.
- The transition (R->Q) is implemented in `schedule_select' when an
- insn is found to to have a function unit conflict with the already
- committed insns.
- The transitions (P->R and P->Q) are implemented in `schedule_insn' as
- insns move from the ready list to the scheduled list.
- The transition (Q->R) is implemented at the top of the scheduling
- loop in `schedule_block' as time passes or stalls are introduced. */
-
-/* Implement a circular buffer to delay instructions until sufficient
- time has passed. INSN_QUEUE_SIZE is a power of two larger than
- MAX_BLOCKAGE and MAX_READY_COST computed by genattr.c. This is the
- longest time an isnsn may be queued. */
-static rtx insn_queue[INSN_QUEUE_SIZE];
-static int q_ptr = 0;
-static int q_size = 0;
-#define NEXT_Q(X) (((X)+1) & (INSN_QUEUE_SIZE-1))
-#define NEXT_Q_AFTER(X,C) (((X)+C) & (INSN_QUEUE_SIZE-1))
-
-/* Vector indexed by INSN_UID giving the minimum clock tick at which
- the insn becomes ready. This is used to note timing constraints for
- insns in the pending list. */
-static int *insn_tick;
-#define INSN_TICK(INSN) (insn_tick[INSN_UID (INSN)])
-
-/* Data structure for keeping track of register information
- during that register's life. */
-
-struct sometimes
-{
- short offset; short bit;
- short live_length; short calls_crossed;
-};
-
-/* Forward declarations. */
-static rtx canon_rtx PROTO((rtx));
-static int rtx_equal_for_memref_p PROTO((rtx, rtx));
-static rtx find_symbolic_term PROTO((rtx));
-static int memrefs_conflict_p PROTO((int, rtx, int, rtx,
- HOST_WIDE_INT));
-static void add_dependence PROTO((rtx, rtx, enum reg_note));
-static void remove_dependence PROTO((rtx, rtx));
-static rtx find_insn_list PROTO((rtx, rtx));
-static int insn_unit PROTO((rtx));
-static unsigned int blockage_range PROTO((int, rtx));
-static void clear_units PROTO((void));
-static void prepare_unit PROTO((int));
-static int actual_hazard_this_instance PROTO((int, int, rtx, int, int));
-static void schedule_unit PROTO((int, rtx, int));
-static int actual_hazard PROTO((int, rtx, int, int));
-static int potential_hazard PROTO((int, rtx, int));
-static int insn_cost PROTO((rtx, rtx, rtx));
-static int priority PROTO((rtx));
-static void free_pending_lists PROTO((void));
-static void add_insn_mem_dependence PROTO((rtx *, rtx *, rtx, rtx));
-static void flush_pending_lists PROTO((rtx, int));
-static void sched_analyze_1 PROTO((rtx, rtx));
-static void sched_analyze_2 PROTO((rtx, rtx));
-static void sched_analyze_insn PROTO((rtx, rtx, rtx));
-static int sched_analyze PROTO((rtx, rtx));
-static void sched_note_set PROTO((int, rtx, int));
-static int rank_for_schedule PROTO((rtx *, rtx *));
-static void swap_sort PROTO((rtx *, int));
-static void queue_insn PROTO((rtx, int));
-static int birthing_insn PROTO((rtx));
-static void adjust_priority PROTO((rtx));
-static int schedule_insn PROTO((rtx, rtx *, int, int));
-static int schedule_select PROTO((rtx *, int, int, FILE *));
-static void create_reg_dead_note PROTO((rtx, rtx));
-static void attach_deaths PROTO((rtx, rtx, int));
-static void attach_deaths_insn PROTO((rtx));
-static rtx unlink_notes PROTO((rtx, rtx));
-static int new_sometimes_live PROTO((struct sometimes *, int, int,
- int));
-static void finish_sometimes_live PROTO((struct sometimes *, int));
-static rtx reemit_notes PROTO((rtx, rtx));
-static void schedule_block PROTO((int, FILE *));
-static rtx regno_use_in PROTO((int, rtx));
-static void split_hard_reg_notes PROTO((rtx, rtx, rtx, rtx));
-static void new_insn_dead_notes PROTO((rtx, rtx, rtx, rtx));
-static void update_n_sets PROTO((rtx, int));
-static void update_flow_info PROTO((rtx, rtx, rtx, rtx));
-
-/* Main entry point of this file. */
-void schedule_insns PROTO((FILE *));
-
-#endif /* INSN_SCHEDULING */
-
-#define SIZE_FOR_MODE(X) (GET_MODE_SIZE (GET_MODE (X)))
-
-/* Vector indexed by N giving the initial (unchanging) value known
- for pseudo-register N. */
-static rtx *reg_known_value;
-
-/* Vector recording for each reg_known_value whether it is due to a
- REG_EQUIV note. Future passes (viz., reload) may replace the
- pseudo with the equivalent expression and so we account for the
- dependences that would be introduced if that happens. */
-/* ??? This is a problem only on the Convex. The REG_EQUIV notes created in
- assign_parms mention the arg pointer, and there are explicit insns in the
- RTL that modify the arg pointer. Thus we must ensure that such insns don't
- get scheduled across each other because that would invalidate the REG_EQUIV
- notes. One could argue that the REG_EQUIV notes are wrong, but solving
- the problem in the scheduler will likely give better code, so we do it
- here. */
-static char *reg_known_equiv_p;
-
-/* Indicates number of valid entries in reg_known_value. */
-static int reg_known_value_size;
-
-static rtx
-canon_rtx (x)
- rtx x;
-{
- /* Recursively look for equivalences. */
- if (GET_CODE (x) == REG && REGNO (x) >= FIRST_PSEUDO_REGISTER
- && REGNO (x) <= reg_known_value_size)
- return reg_known_value[REGNO (x)] == x
- ? x : canon_rtx (reg_known_value[REGNO (x)]);
- else if (GET_CODE (x) == PLUS)
- {
- rtx x0 = canon_rtx (XEXP (x, 0));
- rtx x1 = canon_rtx (XEXP (x, 1));
-
- if (x0 != XEXP (x, 0) || x1 != XEXP (x, 1))
- {
- /* We can tolerate LO_SUMs being offset here; these
- rtl are used for nothing other than comparisons. */
- if (GET_CODE (x0) == CONST_INT)
- return plus_constant_for_output (x1, INTVAL (x0));
- else if (GET_CODE (x1) == CONST_INT)
- return plus_constant_for_output (x0, INTVAL (x1));
- return gen_rtx (PLUS, GET_MODE (x), x0, x1);
- }
- }
- /* This gives us much better alias analysis when called from
- the loop optimizer. Note we want to leave the original
- MEM alone, but need to return the canonicalized MEM with
- all the flags with their original values. */
- else if (GET_CODE (x) == MEM)
- {
- rtx copy = copy_rtx (x);
- XEXP (copy, 0) = canon_rtx (XEXP (copy, 0));
- x = copy;
- }
- return x;
-}
-
-/* Set up all info needed to perform alias analysis on memory references. */
-
-void
-init_alias_analysis ()
-{
- int maxreg = max_reg_num ();
- rtx insn;
- rtx note;
- rtx set;
-
- reg_known_value_size = maxreg;
-
- reg_known_value
- = (rtx *) oballoc ((maxreg-FIRST_PSEUDO_REGISTER) * sizeof (rtx))
- - FIRST_PSEUDO_REGISTER;
- bzero ((char *) (reg_known_value + FIRST_PSEUDO_REGISTER),
- (maxreg-FIRST_PSEUDO_REGISTER) * sizeof (rtx));
-
- reg_known_equiv_p
- = (char *) oballoc ((maxreg -FIRST_PSEUDO_REGISTER) * sizeof (char))
- - FIRST_PSEUDO_REGISTER;
- bzero (reg_known_equiv_p + FIRST_PSEUDO_REGISTER,
- (maxreg - FIRST_PSEUDO_REGISTER) * sizeof (char));
-
- /* Fill in the entries with known constant values. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if ((set = single_set (insn)) != 0
- && GET_CODE (SET_DEST (set)) == REG
- && REGNO (SET_DEST (set)) >= FIRST_PSEUDO_REGISTER
- && (((note = find_reg_note (insn, REG_EQUAL, 0)) != 0
- && reg_n_sets[REGNO (SET_DEST (set))] == 1)
- || (note = find_reg_note (insn, REG_EQUIV, NULL_RTX)) != 0)
- && GET_CODE (XEXP (note, 0)) != EXPR_LIST)
- {
- int regno = REGNO (SET_DEST (set));
- reg_known_value[regno] = XEXP (note, 0);
- reg_known_equiv_p[regno] = REG_NOTE_KIND (note) == REG_EQUIV;
- }
-
- /* Fill in the remaining entries. */
- while (--maxreg >= FIRST_PSEUDO_REGISTER)
- if (reg_known_value[maxreg] == 0)
- reg_known_value[maxreg] = regno_reg_rtx[maxreg];
-}
-
-/* Return 1 if X and Y are identical-looking rtx's.
-
- We use the data in reg_known_value above to see if two registers with
- different numbers are, in fact, equivalent. */
-
-static int
-rtx_equal_for_memref_p (x, y)
- rtx x, y;
-{
- register int i;
- register int j;
- register enum rtx_code code;
- register char *fmt;
-
- if (x == 0 && y == 0)
- return 1;
- if (x == 0 || y == 0)
- return 0;
- x = canon_rtx (x);
- y = canon_rtx (y);
-
- if (x == y)
- return 1;
-
- code = GET_CODE (x);
- /* Rtx's of different codes cannot be equal. */
- if (code != GET_CODE (y))
- return 0;
-
- /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
- (REG:SI x) and (REG:HI x) are NOT equivalent. */
-
- if (GET_MODE (x) != GET_MODE (y))
- return 0;
-
- /* REG, LABEL_REF, and SYMBOL_REF can be compared nonrecursively. */
-
- if (code == REG)
- return REGNO (x) == REGNO (y);
- if (code == LABEL_REF)
- return XEXP (x, 0) == XEXP (y, 0);
- if (code == SYMBOL_REF)
- return XSTR (x, 0) == XSTR (y, 0);
-
- /* For commutative operations, the RTX match if the operand match in any
- order. Also handle the simple binary and unary cases without a loop. */
- if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c')
- return ((rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0))
- && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1)))
- || (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 1))
- && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 0))));
- else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == '2')
- return (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0))
- && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1)));
- else if (GET_RTX_CLASS (code) == '1')
- return rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0));
-
- /* Compare the elements. If any pair of corresponding elements
- fail to match, return 0 for the whole things. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- switch (fmt[i])
- {
- case 'w':
- if (XWINT (x, i) != XWINT (y, i))
- return 0;
- break;
-
- case 'n':
- case 'i':
- if (XINT (x, i) != XINT (y, i))
- return 0;
- break;
-
- case 'V':
- case 'E':
- /* Two vectors must have the same length. */
- if (XVECLEN (x, i) != XVECLEN (y, i))
- return 0;
-
- /* And the corresponding elements must match. */
- for (j = 0; j < XVECLEN (x, i); j++)
- if (rtx_equal_for_memref_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
- return 0;
- break;
-
- case 'e':
- if (rtx_equal_for_memref_p (XEXP (x, i), XEXP (y, i)) == 0)
- return 0;
- break;
-
- case 'S':
- case 's':
- if (strcmp (XSTR (x, i), XSTR (y, i)))
- return 0;
- break;
-
- case 'u':
- /* These are just backpointers, so they don't matter. */
- break;
-
- case '0':
- break;
-
- /* It is believed that rtx's at this level will never
- contain anything but integers and other rtx's,
- except for within LABEL_REFs and SYMBOL_REFs. */
- default:
- abort ();
- }
- }
- return 1;
-}
-
-/* Given an rtx X, find a SYMBOL_REF or LABEL_REF within
- X and return it, or return 0 if none found. */
-
-static rtx
-find_symbolic_term (x)
- rtx x;
-{
- register int i;
- register enum rtx_code code;
- register char *fmt;
-
- code = GET_CODE (x);
- if (code == SYMBOL_REF || code == LABEL_REF)
- return x;
- if (GET_RTX_CLASS (code) == 'o')
- return 0;
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- rtx t;
-
- if (fmt[i] == 'e')
- {
- t = find_symbolic_term (XEXP (x, i));
- if (t != 0)
- return t;
- }
- else if (fmt[i] == 'E')
- break;
- }
- return 0;
-}
-
-/* Return nonzero if X and Y (memory addresses) could reference the
- same location in memory. C is an offset accumulator. When
- C is nonzero, we are testing aliases between X and Y + C.
- XSIZE is the size in bytes of the X reference,
- similarly YSIZE is the size in bytes for Y.
-
- If XSIZE or YSIZE is zero, we do not know the amount of memory being
- referenced (the reference was BLKmode), so make the most pessimistic
- assumptions.
-
- We recognize the following cases of non-conflicting memory:
-
- (1) addresses involving the frame pointer cannot conflict
- with addresses involving static variables.
- (2) static variables with different addresses cannot conflict.
-
- Nice to notice that varying addresses cannot conflict with fp if no
- local variables had their addresses taken, but that's too hard now. */
-
-/* ??? In Fortran, references to a array parameter can never conflict with
- another array parameter. */
-
-static int
-memrefs_conflict_p (xsize, x, ysize, y, c)
- rtx x, y;
- int xsize, ysize;
- HOST_WIDE_INT c;
-{
- if (GET_CODE (x) == HIGH)
- x = XEXP (x, 0);
- else if (GET_CODE (x) == LO_SUM)
- x = XEXP (x, 1);
- else
- x = canon_rtx (x);
- if (GET_CODE (y) == HIGH)
- y = XEXP (y, 0);
- else if (GET_CODE (y) == LO_SUM)
- y = XEXP (y, 1);
- else
- y = canon_rtx (y);
-
- if (rtx_equal_for_memref_p (x, y))
- return (xsize == 0 || ysize == 0 ||
- (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0));
-
- if (y == frame_pointer_rtx || y == hard_frame_pointer_rtx
- || y == stack_pointer_rtx)
- {
- rtx t = y;
- int tsize = ysize;
- y = x; ysize = xsize;
- x = t; xsize = tsize;
- }
-
- if (x == frame_pointer_rtx || x == hard_frame_pointer_rtx
- || x == stack_pointer_rtx)
- {
- rtx y1;
-
- if (CONSTANT_P (y))
- return 0;
-
- if (GET_CODE (y) == PLUS
- && canon_rtx (XEXP (y, 0)) == x
- && (y1 = canon_rtx (XEXP (y, 1)))
- && GET_CODE (y1) == CONST_INT)
- {
- c += INTVAL (y1);
- return (xsize == 0 || ysize == 0
- || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0));
- }
-
- if (GET_CODE (y) == PLUS
- && (y1 = canon_rtx (XEXP (y, 0)))
- && CONSTANT_P (y1))
- return 0;
-
- return 1;
- }
-
- if (GET_CODE (x) == PLUS)
- {
- /* The fact that X is canonicalized means that this
- PLUS rtx is canonicalized. */
- rtx x0 = XEXP (x, 0);
- rtx x1 = XEXP (x, 1);
-
- if (GET_CODE (y) == PLUS)
- {
- /* The fact that Y is canonicalized means that this
- PLUS rtx is canonicalized. */
- rtx y0 = XEXP (y, 0);
- rtx y1 = XEXP (y, 1);
-
- if (rtx_equal_for_memref_p (x1, y1))
- return memrefs_conflict_p (xsize, x0, ysize, y0, c);
- if (rtx_equal_for_memref_p (x0, y0))
- return memrefs_conflict_p (xsize, x1, ysize, y1, c);
- if (GET_CODE (x1) == CONST_INT)
- if (GET_CODE (y1) == CONST_INT)
- return memrefs_conflict_p (xsize, x0, ysize, y0,
- c - INTVAL (x1) + INTVAL (y1));
- else
- return memrefs_conflict_p (xsize, x0, ysize, y, c - INTVAL (x1));
- else if (GET_CODE (y1) == CONST_INT)
- return memrefs_conflict_p (xsize, x, ysize, y0, c + INTVAL (y1));
-
- /* Handle case where we cannot understand iteration operators,
- but we notice that the base addresses are distinct objects. */
- x = find_symbolic_term (x);
- if (x == 0)
- return 1;
- y = find_symbolic_term (y);
- if (y == 0)
- return 1;
- return rtx_equal_for_memref_p (x, y);
- }
- else if (GET_CODE (x1) == CONST_INT)
- return memrefs_conflict_p (xsize, x0, ysize, y, c - INTVAL (x1));
- }
- else if (GET_CODE (y) == PLUS)
- {
- /* The fact that Y is canonicalized means that this
- PLUS rtx is canonicalized. */
- rtx y0 = XEXP (y, 0);
- rtx y1 = XEXP (y, 1);
-
- if (GET_CODE (y1) == CONST_INT)
- return memrefs_conflict_p (xsize, x, ysize, y0, c + INTVAL (y1));
- else
- return 1;
- }
-
- if (GET_CODE (x) == GET_CODE (y))
- switch (GET_CODE (x))
- {
- case MULT:
- {
- /* Handle cases where we expect the second operands to be the
- same, and check only whether the first operand would conflict
- or not. */
- rtx x0, y0;
- rtx x1 = canon_rtx (XEXP (x, 1));
- rtx y1 = canon_rtx (XEXP (y, 1));
- if (! rtx_equal_for_memref_p (x1, y1))
- return 1;
- x0 = canon_rtx (XEXP (x, 0));
- y0 = canon_rtx (XEXP (y, 0));
- if (rtx_equal_for_memref_p (x0, y0))
- return (xsize == 0 || ysize == 0
- || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0));
-
- /* Can't properly adjust our sizes. */
- if (GET_CODE (x1) != CONST_INT)
- return 1;
- xsize /= INTVAL (x1);
- ysize /= INTVAL (x1);
- c /= INTVAL (x1);
- return memrefs_conflict_p (xsize, x0, ysize, y0, c);
- }
- }
-
- if (CONSTANT_P (x))
- {
- if (GET_CODE (x) == CONST_INT && GET_CODE (y) == CONST_INT)
- {
- c += (INTVAL (y) - INTVAL (x));
- return (xsize == 0 || ysize == 0
- || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0));
- }
-
- if (GET_CODE (x) == CONST)
- {
- if (GET_CODE (y) == CONST)
- return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)),
- ysize, canon_rtx (XEXP (y, 0)), c);
- else
- return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)),
- ysize, y, c);
- }
- if (GET_CODE (y) == CONST)
- return memrefs_conflict_p (xsize, x, ysize,
- canon_rtx (XEXP (y, 0)), c);
-
- if (CONSTANT_P (y))
- return (rtx_equal_for_memref_p (x, y)
- && (xsize == 0 || ysize == 0
- || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0)));
-
- return 1;
- }
- return 1;
-}
-
-/* Functions to compute memory dependencies.
-
- Since we process the insns in execution order, we can build tables
- to keep track of what registers are fixed (and not aliased), what registers
- are varying in known ways, and what registers are varying in unknown
- ways.
-
- If both memory references are volatile, then there must always be a
- dependence between the two references, since their order can not be
- changed. A volatile and non-volatile reference can be interchanged
- though.
-
- A MEM_IN_STRUCT reference at a non-QImode non-AND varying address can never
- conflict with a non-MEM_IN_STRUCT reference at a fixed address. We must
- allow QImode aliasing because the ANSI C standard allows character
- pointers to alias anything. We are assuming that characters are
- always QImode here. We also must allow AND addresses, because they may
- generate accesses outside the object being referenced. This is used to
- generate aligned addresses from unaligned addresses, for instance, the
- alpha storeqi_unaligned pattern. */
-
-/* Read dependence: X is read after read in MEM takes place. There can
- only be a dependence here if both reads are volatile. */
-
-int
-read_dependence (mem, x)
- rtx mem;
- rtx x;
-{
- return MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem);
-}
-
-/* True dependence: X is read after store in MEM takes place. */
-
-int
-true_dependence (mem, x)
- rtx mem;
- rtx x;
-{
- /* If X is an unchanging read, then it can't possibly conflict with any
- non-unchanging store. It may conflict with an unchanging write though,
- because there may be a single store to this address to initialize it.
- Just fall through to the code below to resolve the case where we have
- both an unchanging read and an unchanging write. This won't handle all
- cases optimally, but the possible performance loss should be
- negligible. */
- x = canon_rtx (x);
- mem = canon_rtx (mem);
- if (RTX_UNCHANGING_P (x) && ! RTX_UNCHANGING_P (mem))
- return 0;
-
- return ((MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
- || (memrefs_conflict_p (SIZE_FOR_MODE (mem), XEXP (mem, 0),
- SIZE_FOR_MODE (x), XEXP (x, 0), 0)
- && ! (MEM_IN_STRUCT_P (mem) && rtx_addr_varies_p (mem)
- && GET_MODE (mem) != QImode
- && GET_CODE (XEXP (mem, 0)) != AND
- && ! MEM_IN_STRUCT_P (x) && ! rtx_addr_varies_p (x))
- && ! (MEM_IN_STRUCT_P (x) && rtx_addr_varies_p (x)
- && GET_MODE (x) != QImode
- && GET_CODE (XEXP (x, 0)) != AND
- && ! MEM_IN_STRUCT_P (mem) && ! rtx_addr_varies_p (mem))));
-}
-
-/* Anti dependence: X is written after read in MEM takes place. */
-
-int
-anti_dependence (mem, x)
- rtx mem;
- rtx x;
-{
- /* If MEM is an unchanging read, then it can't possibly conflict with
- the store to X, because there is at most one store to MEM, and it must
- have occurred somewhere before MEM. */
- x = canon_rtx (x);
- mem = canon_rtx (mem);
- if (RTX_UNCHANGING_P (mem))
- return 0;
-
- return ((MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
- || (memrefs_conflict_p (SIZE_FOR_MODE (mem), XEXP (mem, 0),
- SIZE_FOR_MODE (x), XEXP (x, 0), 0)
- && ! (MEM_IN_STRUCT_P (mem) && rtx_addr_varies_p (mem)
- && GET_MODE (mem) != QImode
- && GET_CODE (XEXP (mem, 0)) != AND
- && ! MEM_IN_STRUCT_P (x) && ! rtx_addr_varies_p (x))
- && ! (MEM_IN_STRUCT_P (x) && rtx_addr_varies_p (x)
- && GET_MODE (x) != QImode
- && GET_CODE (XEXP (x, 0)) != AND
- && ! MEM_IN_STRUCT_P (mem) && ! rtx_addr_varies_p (mem))));
-}
-
-/* Output dependence: X is written after store in MEM takes place. */
-
-int
-output_dependence (mem, x)
- rtx mem;
- rtx x;
-{
- x = canon_rtx (x);
- mem = canon_rtx (mem);
- return ((MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
- || (memrefs_conflict_p (SIZE_FOR_MODE (mem), XEXP (mem, 0),
- SIZE_FOR_MODE (x), XEXP (x, 0), 0)
- && ! (MEM_IN_STRUCT_P (mem) && rtx_addr_varies_p (mem)
- && GET_MODE (mem) != QImode
- && GET_CODE (XEXP (mem, 0)) != AND
- && ! MEM_IN_STRUCT_P (x) && ! rtx_addr_varies_p (x))
- && ! (MEM_IN_STRUCT_P (x) && rtx_addr_varies_p (x)
- && GET_MODE (x) != QImode
- && GET_CODE (XEXP (x, 0)) != AND
- && ! MEM_IN_STRUCT_P (mem) && ! rtx_addr_varies_p (mem))));
-}
-
-/* Helper functions for instruction scheduling. */
-
-/* Add ELEM wrapped in an INSN_LIST with reg note kind DEP_TYPE to the
- LOG_LINKS of INSN, if not already there. DEP_TYPE indicates the type
- of dependence that this link represents. */
-
-static void
-add_dependence (insn, elem, dep_type)
- rtx insn;
- rtx elem;
- enum reg_note dep_type;
-{
- rtx link, next;
-
- /* Don't depend an insn on itself. */
- if (insn == elem)
- return;
-
- /* If elem is part of a sequence that must be scheduled together, then
- make the dependence point to the last insn of the sequence.
- When HAVE_cc0, it is possible for NOTEs to exist between users and
- setters of the condition codes, so we must skip past notes here.
- Otherwise, NOTEs are impossible here. */
-
- next = NEXT_INSN (elem);
-
-#ifdef HAVE_cc0
- while (next && GET_CODE (next) == NOTE)
- next = NEXT_INSN (next);
-#endif
-
- if (next && SCHED_GROUP_P (next)
- && GET_CODE (next) != CODE_LABEL)
- {
- /* Notes will never intervene here though, so don't bother checking
- for them. */
- /* We must reject CODE_LABELs, so that we don't get confused by one
- that has LABEL_PRESERVE_P set, which is represented by the same
- bit in the rtl as SCHED_GROUP_P. A CODE_LABEL can never be
- SCHED_GROUP_P. */
- while (NEXT_INSN (next) && SCHED_GROUP_P (NEXT_INSN (next))
- && GET_CODE (NEXT_INSN (next)) != CODE_LABEL)
- next = NEXT_INSN (next);
-
- /* Again, don't depend an insn on itself. */
- if (insn == next)
- return;
-
- /* Make the dependence to NEXT, the last insn of the group, instead
- of the original ELEM. */
- elem = next;
- }
-
- /* Check that we don't already have this dependence. */
- for (link = LOG_LINKS (insn); link; link = XEXP (link, 1))
- if (XEXP (link, 0) == elem)
- {
- /* If this is a more restrictive type of dependence than the existing
- one, then change the existing dependence to this type. */
- if ((int) dep_type < (int) REG_NOTE_KIND (link))
- PUT_REG_NOTE_KIND (link, dep_type);
- return;
- }
- /* Might want to check one level of transitivity to save conses. */
-
- link = rtx_alloc (INSN_LIST);
- /* Insn dependency, not data dependency. */
- PUT_REG_NOTE_KIND (link, dep_type);
- XEXP (link, 0) = elem;
- XEXP (link, 1) = LOG_LINKS (insn);
- LOG_LINKS (insn) = link;
-}
-
-/* Remove ELEM wrapped in an INSN_LIST from the LOG_LINKS
- of INSN. Abort if not found. */
-
-static void
-remove_dependence (insn, elem)
- rtx insn;
- rtx elem;
-{
- rtx prev, link;
- int found = 0;
-
- for (prev = 0, link = LOG_LINKS (insn); link;
- prev = link, link = XEXP (link, 1))
- {
- if (XEXP (link, 0) == elem)
- {
- if (prev)
- XEXP (prev, 1) = XEXP (link, 1);
- else
- LOG_LINKS (insn) = XEXP (link, 1);
- found = 1;
- }
- }
-
- if (! found)
- abort ();
- return;
-}
-
-#ifndef INSN_SCHEDULING
-void
-schedule_insns (dump_file)
- FILE *dump_file;
-{
-}
-#else
-#ifndef __GNUC__
-#define __inline
-#endif
-
-/* Computation of memory dependencies. */
-
-/* The *_insns and *_mems are paired lists. Each pending memory operation
- will have a pointer to the MEM rtx on one list and a pointer to the
- containing insn on the other list in the same place in the list. */
-
-/* We can't use add_dependence like the old code did, because a single insn
- may have multiple memory accesses, and hence needs to be on the list
- once for each memory access. Add_dependence won't let you add an insn
- to a list more than once. */
-
-/* An INSN_LIST containing all insns with pending read operations. */
-static rtx pending_read_insns;
-
-/* An EXPR_LIST containing all MEM rtx's which are pending reads. */
-static rtx pending_read_mems;
-
-/* An INSN_LIST containing all insns with pending write operations. */
-static rtx pending_write_insns;
-
-/* An EXPR_LIST containing all MEM rtx's which are pending writes. */
-static rtx pending_write_mems;
-
-/* Indicates the combined length of the two pending lists. We must prevent
- these lists from ever growing too large since the number of dependencies
- produced is at least O(N*N), and execution time is at least O(4*N*N), as
- a function of the length of these pending lists. */
-
-static int pending_lists_length;
-
-/* An INSN_LIST containing all INSN_LISTs allocated but currently unused. */
-
-static rtx unused_insn_list;
-
-/* An EXPR_LIST containing all EXPR_LISTs allocated but currently unused. */
-
-static rtx unused_expr_list;
-
-/* The last insn upon which all memory references must depend.
- This is an insn which flushed the pending lists, creating a dependency
- between it and all previously pending memory references. This creates
- a barrier (or a checkpoint) which no memory reference is allowed to cross.
-
- This includes all non constant CALL_INSNs. When we do interprocedural
- alias analysis, this restriction can be relaxed.
- This may also be an INSN that writes memory if the pending lists grow
- too large. */
-
-static rtx last_pending_memory_flush;
-
-/* The last function call we have seen. All hard regs, and, of course,
- the last function call, must depend on this. */
-
-static rtx last_function_call;
-
-/* The LOG_LINKS field of this is a list of insns which use a pseudo register
- that does not already cross a call. We create dependencies between each
- of those insn and the next call insn, to ensure that they won't cross a call
- after scheduling is done. */
-
-static rtx sched_before_next_call;
-
-/* Pointer to the last instruction scheduled. Used by rank_for_schedule,
- so that insns independent of the last scheduled insn will be preferred
- over dependent instructions. */
-
-static rtx last_scheduled_insn;
-
-/* Process an insn's memory dependencies. There are four kinds of
- dependencies:
-
- (0) read dependence: read follows read
- (1) true dependence: read follows write
- (2) anti dependence: write follows read
- (3) output dependence: write follows write
-
- We are careful to build only dependencies which actually exist, and
- use transitivity to avoid building too many links. */
-
-/* Return the INSN_LIST containing INSN in LIST, or NULL
- if LIST does not contain INSN. */
-
-__inline static rtx
-find_insn_list (insn, list)
- rtx insn;
- rtx list;
-{
- while (list)
- {
- if (XEXP (list, 0) == insn)
- return list;
- list = XEXP (list, 1);
- }
- return 0;
-}
-
-/* Compute the function units used by INSN. This caches the value
- returned by function_units_used. A function unit is encoded as the
- unit number if the value is non-negative and the compliment of a
- mask if the value is negative. A function unit index is the
- non-negative encoding. */
-
-__inline static int
-insn_unit (insn)
- rtx insn;
-{
- register int unit = INSN_UNIT (insn);
-
- if (unit == 0)
- {
- recog_memoized (insn);
-
- /* A USE insn, or something else we don't need to understand.
- We can't pass these directly to function_units_used because it will
- trigger a fatal error for unrecognizable insns. */
- if (INSN_CODE (insn) < 0)
- unit = -1;
- else
- {
- unit = function_units_used (insn);
- /* Increment non-negative values so we can cache zero. */
- if (unit >= 0) unit++;
- }
- /* We only cache 16 bits of the result, so if the value is out of
- range, don't cache it. */
- if (FUNCTION_UNITS_SIZE < HOST_BITS_PER_SHORT
- || unit >= 0
- || (~unit & ((1 << (HOST_BITS_PER_SHORT - 1)) - 1)) == 0)
- INSN_UNIT (insn) = unit;
- }
- return (unit > 0 ? unit - 1 : unit);
-}
-
-/* Compute the blockage range for executing INSN on UNIT. This caches
- the value returned by the blockage_range_function for the unit.
- These values are encoded in an int where the upper half gives the
- minimum value and the lower half gives the maximum value. */
-
-__inline static unsigned int
-blockage_range (unit, insn)
- int unit;
- rtx insn;
-{
- unsigned int blockage = INSN_BLOCKAGE (insn);
- unsigned int range;
-
- if (UNIT_BLOCKED (blockage) != unit + 1)
- {
- range = function_units[unit].blockage_range_function (insn);
- /* We only cache the blockage range for one unit and then only if
- the values fit. */
- if (HOST_BITS_PER_INT >= UNIT_BITS + 2 * BLOCKAGE_BITS)
- INSN_BLOCKAGE (insn) = ENCODE_BLOCKAGE (unit + 1, range);
- }
- else
- range = BLOCKAGE_RANGE (blockage);
-
- return range;
-}
-
-/* A vector indexed by function unit instance giving the last insn to use
- the unit. The value of the function unit instance index for unit U
- instance I is (U + I * FUNCTION_UNITS_SIZE). */
-static rtx unit_last_insn[FUNCTION_UNITS_SIZE * MAX_MULTIPLICITY];
-
-/* A vector indexed by function unit instance giving the minimum time when
- the unit will unblock based on the maximum blockage cost. */
-static int unit_tick[FUNCTION_UNITS_SIZE * MAX_MULTIPLICITY];
-
-/* A vector indexed by function unit number giving the number of insns
- that remain to use the unit. */
-static int unit_n_insns[FUNCTION_UNITS_SIZE];
-
-/* Reset the function unit state to the null state. */
-
-static void
-clear_units ()
-{
- bzero ((char *) unit_last_insn, sizeof (unit_last_insn));
- bzero ((char *) unit_tick, sizeof (unit_tick));
- bzero ((char *) unit_n_insns, sizeof (unit_n_insns));
-}
-
-/* Record an insn as one that will use the units encoded by UNIT. */
-
-__inline static void
-prepare_unit (unit)
- int unit;
-{
- int i;
-
- if (unit >= 0)
- unit_n_insns[unit]++;
- else
- for (i = 0, unit = ~unit; unit; i++, unit >>= 1)
- if ((unit & 1) != 0)
- prepare_unit (i);
-}
-
-/* Return the actual hazard cost of executing INSN on the unit UNIT,
- instance INSTANCE at time CLOCK if the previous actual hazard cost
- was COST. */
-
-__inline static int
-actual_hazard_this_instance (unit, instance, insn, clock, cost)
- int unit, instance, clock, cost;
- rtx insn;
-{
- int tick = unit_tick[instance];
-
- if (tick - clock > cost)
- {
- /* The scheduler is operating in reverse, so INSN is the executing
- insn and the unit's last insn is the candidate insn. We want a
- more exact measure of the blockage if we execute INSN at CLOCK
- given when we committed the execution of the unit's last insn.
-
- The blockage value is given by either the unit's max blockage
- constant, blockage range function, or blockage function. Use
- the most exact form for the given unit. */
-
- if (function_units[unit].blockage_range_function)
- {
- if (function_units[unit].blockage_function)
- tick += (function_units[unit].blockage_function
- (insn, unit_last_insn[instance])
- - function_units[unit].max_blockage);
- else
- tick += ((int) MAX_BLOCKAGE_COST (blockage_range (unit, insn))
- - function_units[unit].max_blockage);
- }
- if (tick - clock > cost)
- cost = tick - clock;
- }
- return cost;
-}
-
-/* Record INSN as having begun execution on the units encoded by UNIT at
- time CLOCK. */
-
-__inline static void
-schedule_unit (unit, insn, clock)
- int unit, clock;
- rtx insn;
-{
- int i;
-
- if (unit >= 0)
- {
- int instance = unit;
-#if MAX_MULTIPLICITY > 1
- /* Find the first free instance of the function unit and use that
- one. We assume that one is free. */
- for (i = function_units[unit].multiplicity - 1; i > 0; i--)
- {
- if (! actual_hazard_this_instance (unit, instance, insn, clock, 0))
- break;
- instance += FUNCTION_UNITS_SIZE;
- }
-#endif
- unit_last_insn[instance] = insn;
- unit_tick[instance] = (clock + function_units[unit].max_blockage);
- }
- else
- for (i = 0, unit = ~unit; unit; i++, unit >>= 1)
- if ((unit & 1) != 0)
- schedule_unit (i, insn, clock);
-}
-
-/* Return the actual hazard cost of executing INSN on the units encoded by
- UNIT at time CLOCK if the previous actual hazard cost was COST. */
-
-__inline static int
-actual_hazard (unit, insn, clock, cost)
- int unit, clock, cost;
- rtx insn;
-{
- int i;
-
- if (unit >= 0)
- {
- /* Find the instance of the function unit with the minimum hazard. */
- int instance = unit;
- int best_cost = actual_hazard_this_instance (unit, instance, insn,
- clock, cost);
- int this_cost;
-
-#if MAX_MULTIPLICITY > 1
- if (best_cost > cost)
- {
- for (i = function_units[unit].multiplicity - 1; i > 0; i--)
- {
- instance += FUNCTION_UNITS_SIZE;
- this_cost = actual_hazard_this_instance (unit, instance, insn,
- clock, cost);
- if (this_cost < best_cost)
- {
- best_cost = this_cost;
- if (this_cost <= cost)
- break;
- }
- }
- }
-#endif
- cost = MAX (cost, best_cost);
- }
- else
- for (i = 0, unit = ~unit; unit; i++, unit >>= 1)
- if ((unit & 1) != 0)
- cost = actual_hazard (i, insn, clock, cost);
-
- return cost;
-}
-
-/* Return the potential hazard cost of executing an instruction on the
- units encoded by UNIT if the previous potential hazard cost was COST.
- An insn with a large blockage time is chosen in preference to one
- with a smaller time; an insn that uses a unit that is more likely
- to be used is chosen in preference to one with a unit that is less
- used. We are trying to minimize a subsequent actual hazard. */
-
-__inline static int
-potential_hazard (unit, insn, cost)
- int unit, cost;
- rtx insn;
-{
- int i, ncost;
- unsigned int minb, maxb;
-
- if (unit >= 0)
- {
- minb = maxb = function_units[unit].max_blockage;
- if (maxb > 1)
- {
- if (function_units[unit].blockage_range_function)
- {
- maxb = minb = blockage_range (unit, insn);
- maxb = MAX_BLOCKAGE_COST (maxb);
- minb = MIN_BLOCKAGE_COST (minb);
- }
-
- if (maxb > 1)
- {
- /* Make the number of instructions left dominate. Make the
- minimum delay dominate the maximum delay. If all these
- are the same, use the unit number to add an arbitrary
- ordering. Other terms can be added. */
- ncost = minb * 0x40 + maxb;
- ncost *= (unit_n_insns[unit] - 1) * 0x1000 + unit;
- if (ncost > cost)
- cost = ncost;
- }
- }
- }
- else
- for (i = 0, unit = ~unit; unit; i++, unit >>= 1)
- if ((unit & 1) != 0)
- cost = potential_hazard (i, insn, cost);
-
- return cost;
-}
-
-/* Compute cost of executing INSN given the dependence LINK on the insn USED.
- This is the number of virtual cycles taken between instruction issue and
- instruction results. */
-
-__inline static int
-insn_cost (insn, link, used)
- rtx insn, link, used;
-{
- register int cost = INSN_COST (insn);
-
- if (cost == 0)
- {
- recog_memoized (insn);
-
- /* A USE insn, or something else we don't need to understand.
- We can't pass these directly to result_ready_cost because it will
- trigger a fatal error for unrecognizable insns. */
- if (INSN_CODE (insn) < 0)
- {
- INSN_COST (insn) = 1;
- return 1;
- }
- else
- {
- cost = result_ready_cost (insn);
-
- if (cost < 1)
- cost = 1;
-
- INSN_COST (insn) = cost;
- }
- }
-
- /* A USE insn should never require the value used to be computed. This
- allows the computation of a function's result and parameter values to
- overlap the return and call. */
- recog_memoized (used);
- if (INSN_CODE (used) < 0)
- LINK_COST_FREE (link) = 1;
-
- /* If some dependencies vary the cost, compute the adjustment. Most
- commonly, the adjustment is complete: either the cost is ignored
- (in the case of an output- or anti-dependence), or the cost is
- unchanged. These values are cached in the link as LINK_COST_FREE
- and LINK_COST_ZERO. */
-
- if (LINK_COST_FREE (link))
- cost = 1;
-#ifdef ADJUST_COST
- else if (! LINK_COST_ZERO (link))
- {
- int ncost = cost;
-
- ADJUST_COST (used, link, insn, ncost);
- if (ncost <= 1)
- LINK_COST_FREE (link) = ncost = 1;
- if (cost == ncost)
- LINK_COST_ZERO (link) = 1;
- cost = ncost;
- }
-#endif
- return cost;
-}
-
-/* Compute the priority number for INSN. */
-
-static int
-priority (insn)
- rtx insn;
-{
- if (insn && GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- int prev_priority;
- int max_priority;
- int this_priority = INSN_PRIORITY (insn);
- rtx prev;
-
- if (this_priority > 0)
- return this_priority;
-
- max_priority = 1;
-
- /* Nonzero if these insns must be scheduled together. */
- if (SCHED_GROUP_P (insn))
- {
- prev = insn;
- while (SCHED_GROUP_P (prev))
- {
- prev = PREV_INSN (prev);
- INSN_REF_COUNT (prev) += 1;
- }
- }
-
- for (prev = LOG_LINKS (insn); prev; prev = XEXP (prev, 1))
- {
- rtx x = XEXP (prev, 0);
-
- /* A dependence pointing to a note or deleted insn is always
- obsolete, because sched_analyze_insn will have created any
- necessary new dependences which replace it. Notes and deleted
- insns can be created when instructions are deleted by insn
- splitting, or by register allocation. */
- if (GET_CODE (x) == NOTE || INSN_DELETED_P (x))
- {
- remove_dependence (insn, x);
- continue;
- }
-
- /* Clear the link cost adjustment bits. */
- LINK_COST_FREE (prev) = 0;
-#ifdef ADJUST_COST
- LINK_COST_ZERO (prev) = 0;
-#endif
-
- /* This priority calculation was chosen because it results in the
- least instruction movement, and does not hurt the performance
- of the resulting code compared to the old algorithm.
- This makes the sched algorithm more stable, which results
- in better code, because there is less register pressure,
- cross jumping is more likely to work, and debugging is easier.
-
- When all instructions have a latency of 1, there is no need to
- move any instructions. Subtracting one here ensures that in such
- cases all instructions will end up with a priority of one, and
- hence no scheduling will be done.
-
- The original code did not subtract the one, and added the
- insn_cost of the current instruction to its priority (e.g.
- move the insn_cost call down to the end). */
-
- prev_priority = priority (x) + insn_cost (x, prev, insn) - 1;
-
- if (prev_priority > max_priority)
- max_priority = prev_priority;
- INSN_REF_COUNT (x) += 1;
- }
-
- prepare_unit (insn_unit (insn));
- INSN_PRIORITY (insn) = max_priority;
- return INSN_PRIORITY (insn);
- }
- return 0;
-}
-
-/* Remove all INSN_LISTs and EXPR_LISTs from the pending lists and add
- them to the unused_*_list variables, so that they can be reused. */
-
-static void
-free_pending_lists ()
-{
- register rtx link, prev_link;
-
- if (pending_read_insns)
- {
- prev_link = pending_read_insns;
- link = XEXP (prev_link, 1);
-
- while (link)
- {
- prev_link = link;
- link = XEXP (link, 1);
- }
-
- XEXP (prev_link, 1) = unused_insn_list;
- unused_insn_list = pending_read_insns;
- pending_read_insns = 0;
- }
-
- if (pending_write_insns)
- {
- prev_link = pending_write_insns;
- link = XEXP (prev_link, 1);
-
- while (link)
- {
- prev_link = link;
- link = XEXP (link, 1);
- }
-
- XEXP (prev_link, 1) = unused_insn_list;
- unused_insn_list = pending_write_insns;
- pending_write_insns = 0;
- }
-
- if (pending_read_mems)
- {
- prev_link = pending_read_mems;
- link = XEXP (prev_link, 1);
-
- while (link)
- {
- prev_link = link;
- link = XEXP (link, 1);
- }
-
- XEXP (prev_link, 1) = unused_expr_list;
- unused_expr_list = pending_read_mems;
- pending_read_mems = 0;
- }
-
- if (pending_write_mems)
- {
- prev_link = pending_write_mems;
- link = XEXP (prev_link, 1);
-
- while (link)
- {
- prev_link = link;
- link = XEXP (link, 1);
- }
-
- XEXP (prev_link, 1) = unused_expr_list;
- unused_expr_list = pending_write_mems;
- pending_write_mems = 0;
- }
-}
-
-/* Add an INSN and MEM reference pair to a pending INSN_LIST and MEM_LIST.
- The MEM is a memory reference contained within INSN, which we are saving
- so that we can do memory aliasing on it. */
-
-static void
-add_insn_mem_dependence (insn_list, mem_list, insn, mem)
- rtx *insn_list, *mem_list, insn, mem;
-{
- register rtx link;
-
- if (unused_insn_list)
- {
- link = unused_insn_list;
- unused_insn_list = XEXP (link, 1);
- }
- else
- link = rtx_alloc (INSN_LIST);
- XEXP (link, 0) = insn;
- XEXP (link, 1) = *insn_list;
- *insn_list = link;
-
- if (unused_expr_list)
- {
- link = unused_expr_list;
- unused_expr_list = XEXP (link, 1);
- }
- else
- link = rtx_alloc (EXPR_LIST);
- XEXP (link, 0) = mem;
- XEXP (link, 1) = *mem_list;
- *mem_list = link;
-
- pending_lists_length++;
-}
-
-/* Make a dependency between every memory reference on the pending lists
- and INSN, thus flushing the pending lists. If ONLY_WRITE, don't flush
- the read list. */
-
-static void
-flush_pending_lists (insn, only_write)
- rtx insn;
- int only_write;
-{
- rtx link;
-
- while (pending_read_insns && ! only_write)
- {
- add_dependence (insn, XEXP (pending_read_insns, 0), REG_DEP_ANTI);
-
- link = pending_read_insns;
- pending_read_insns = XEXP (pending_read_insns, 1);
- XEXP (link, 1) = unused_insn_list;
- unused_insn_list = link;
-
- link = pending_read_mems;
- pending_read_mems = XEXP (pending_read_mems, 1);
- XEXP (link, 1) = unused_expr_list;
- unused_expr_list = link;
- }
- while (pending_write_insns)
- {
- add_dependence (insn, XEXP (pending_write_insns, 0), REG_DEP_ANTI);
-
- link = pending_write_insns;
- pending_write_insns = XEXP (pending_write_insns, 1);
- XEXP (link, 1) = unused_insn_list;
- unused_insn_list = link;
-
- link = pending_write_mems;
- pending_write_mems = XEXP (pending_write_mems, 1);
- XEXP (link, 1) = unused_expr_list;
- unused_expr_list = link;
- }
- pending_lists_length = 0;
-
- if (last_pending_memory_flush)
- add_dependence (insn, last_pending_memory_flush, REG_DEP_ANTI);
-
- last_pending_memory_flush = insn;
-}
-
-/* Analyze a single SET or CLOBBER rtx, X, creating all dependencies generated
- by the write to the destination of X, and reads of everything mentioned. */
-
-static void
-sched_analyze_1 (x, insn)
- rtx x;
- rtx insn;
-{
- register int regno;
- register rtx dest = SET_DEST (x);
-
- if (dest == 0)
- return;
-
- while (GET_CODE (dest) == STRICT_LOW_PART || GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == SIGN_EXTRACT)
- {
- if (GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == SIGN_EXTRACT)
- {
- /* The second and third arguments are values read by this insn. */
- sched_analyze_2 (XEXP (dest, 1), insn);
- sched_analyze_2 (XEXP (dest, 2), insn);
- }
- dest = SUBREG_REG (dest);
- }
-
- if (GET_CODE (dest) == REG)
- {
- register int i;
-
- regno = REGNO (dest);
-
- /* A hard reg in a wide mode may really be multiple registers.
- If so, mark all of them just like the first. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- i = HARD_REGNO_NREGS (regno, GET_MODE (dest));
- while (--i >= 0)
- {
- rtx u;
-
- for (u = reg_last_uses[regno+i]; u; u = XEXP (u, 1))
- add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
- reg_last_uses[regno + i] = 0;
- if (reg_last_sets[regno + i])
- add_dependence (insn, reg_last_sets[regno + i],
- REG_DEP_OUTPUT);
- reg_pending_sets[(regno + i) / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << ((regno + i) % REGSET_ELT_BITS);
- if ((call_used_regs[i] || global_regs[i])
- && last_function_call)
- /* Function calls clobber all call_used regs. */
- add_dependence (insn, last_function_call, REG_DEP_ANTI);
- }
- }
- else
- {
- rtx u;
-
- for (u = reg_last_uses[regno]; u; u = XEXP (u, 1))
- add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
- reg_last_uses[regno] = 0;
- if (reg_last_sets[regno])
- add_dependence (insn, reg_last_sets[regno], REG_DEP_OUTPUT);
- reg_pending_sets[regno / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
-
- /* Pseudos that are REG_EQUIV to something may be replaced
- by that during reloading. We need only add dependencies for
- the address in the REG_EQUIV note. */
- if (! reload_completed
- && reg_known_equiv_p[regno]
- && GET_CODE (reg_known_value[regno]) == MEM)
- sched_analyze_2 (XEXP (reg_known_value[regno], 0), insn);
-
- /* Don't let it cross a call after scheduling if it doesn't
- already cross one. */
- if (reg_n_calls_crossed[regno] == 0 && last_function_call)
- add_dependence (insn, last_function_call, REG_DEP_ANTI);
- }
- }
- else if (GET_CODE (dest) == MEM)
- {
- /* Writing memory. */
-
- if (pending_lists_length > 32)
- {
- /* Flush all pending reads and writes to prevent the pending lists
- from getting any larger. Insn scheduling runs too slowly when
- these lists get long. The number 32 was chosen because it
- seems like a reasonable number. When compiling GCC with itself,
- this flush occurs 8 times for sparc, and 10 times for m88k using
- the number 32. */
- flush_pending_lists (insn, 0);
- }
- else
- {
- rtx pending, pending_mem;
-
- pending = pending_read_insns;
- pending_mem = pending_read_mems;
- while (pending)
- {
- /* If a dependency already exists, don't create a new one. */
- if (! find_insn_list (XEXP (pending, 0), LOG_LINKS (insn)))
- if (anti_dependence (XEXP (pending_mem, 0), dest))
- add_dependence (insn, XEXP (pending, 0), REG_DEP_ANTI);
-
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
- }
-
- pending = pending_write_insns;
- pending_mem = pending_write_mems;
- while (pending)
- {
- /* If a dependency already exists, don't create a new one. */
- if (! find_insn_list (XEXP (pending, 0), LOG_LINKS (insn)))
- if (output_dependence (XEXP (pending_mem, 0), dest))
- add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
-
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
- }
-
- if (last_pending_memory_flush)
- add_dependence (insn, last_pending_memory_flush, REG_DEP_ANTI);
-
- add_insn_mem_dependence (&pending_write_insns, &pending_write_mems,
- insn, dest);
- }
- sched_analyze_2 (XEXP (dest, 0), insn);
- }
-
- /* Analyze reads. */
- if (GET_CODE (x) == SET)
- sched_analyze_2 (SET_SRC (x), insn);
-}
-
-/* Analyze the uses of memory and registers in rtx X in INSN. */
-
-static void
-sched_analyze_2 (x, insn)
- rtx x;
- rtx insn;
-{
- register int i;
- register int j;
- register enum rtx_code code;
- register char *fmt;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case SYMBOL_REF:
- case CONST:
- case LABEL_REF:
- /* Ignore constants. Note that we must handle CONST_DOUBLE here
- because it may have a cc0_rtx in its CONST_DOUBLE_CHAIN field, but
- this does not mean that this insn is using cc0. */
- return;
-
-#ifdef HAVE_cc0
- case CC0:
- {
- rtx link, prev;
-
- /* User of CC0 depends on immediately preceding insn. */
- SCHED_GROUP_P (insn) = 1;
-
- /* There may be a note before this insn now, but all notes will
- be removed before we actually try to schedule the insns, so
- it won't cause a problem later. We must avoid it here though. */
- prev = prev_nonnote_insn (insn);
-
- /* Make a copy of all dependencies on the immediately previous insn,
- and add to this insn. This is so that all the dependencies will
- apply to the group. Remove an explicit dependence on this insn
- as SCHED_GROUP_P now represents it. */
-
- if (find_insn_list (prev, LOG_LINKS (insn)))
- remove_dependence (insn, prev);
-
- for (link = LOG_LINKS (prev); link; link = XEXP (link, 1))
- add_dependence (insn, XEXP (link, 0), REG_NOTE_KIND (link));
-
- return;
- }
-#endif
-
- case REG:
- {
- int regno = REGNO (x);
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int i;
-
- i = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (--i >= 0)
- {
- reg_last_uses[regno + i]
- = gen_rtx (INSN_LIST, VOIDmode,
- insn, reg_last_uses[regno + i]);
- if (reg_last_sets[regno + i])
- add_dependence (insn, reg_last_sets[regno + i], 0);
- if ((call_used_regs[regno + i] || global_regs[regno + i])
- && last_function_call)
- /* Function calls clobber all call_used regs. */
- add_dependence (insn, last_function_call, REG_DEP_ANTI);
- }
- }
- else
- {
- reg_last_uses[regno]
- = gen_rtx (INSN_LIST, VOIDmode, insn, reg_last_uses[regno]);
- if (reg_last_sets[regno])
- add_dependence (insn, reg_last_sets[regno], 0);
-
- /* Pseudos that are REG_EQUIV to something may be replaced
- by that during reloading. We need only add dependencies for
- the address in the REG_EQUIV note. */
- if (! reload_completed
- && reg_known_equiv_p[regno]
- && GET_CODE (reg_known_value[regno]) == MEM)
- sched_analyze_2 (XEXP (reg_known_value[regno], 0), insn);
-
- /* If the register does not already cross any calls, then add this
- insn to the sched_before_next_call list so that it will still
- not cross calls after scheduling. */
- if (reg_n_calls_crossed[regno] == 0)
- add_dependence (sched_before_next_call, insn, REG_DEP_ANTI);
- }
- return;
- }
-
- case MEM:
- {
- /* Reading memory. */
-
- rtx pending, pending_mem;
-
- pending = pending_read_insns;
- pending_mem = pending_read_mems;
- while (pending)
- {
- /* If a dependency already exists, don't create a new one. */
- if (! find_insn_list (XEXP (pending, 0), LOG_LINKS (insn)))
- if (read_dependence (XEXP (pending_mem, 0), x))
- add_dependence (insn, XEXP (pending, 0), REG_DEP_ANTI);
-
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
- }
-
- pending = pending_write_insns;
- pending_mem = pending_write_mems;
- while (pending)
- {
- /* If a dependency already exists, don't create a new one. */
- if (! find_insn_list (XEXP (pending, 0), LOG_LINKS (insn)))
- if (true_dependence (XEXP (pending_mem, 0), x))
- add_dependence (insn, XEXP (pending, 0), 0);
-
- pending = XEXP (pending, 1);
- pending_mem = XEXP (pending_mem, 1);
- }
- if (last_pending_memory_flush)
- add_dependence (insn, last_pending_memory_flush, REG_DEP_ANTI);
-
- /* Always add these dependencies to pending_reads, since
- this insn may be followed by a write. */
- add_insn_mem_dependence (&pending_read_insns, &pending_read_mems,
- insn, x);
-
- /* Take advantage of tail recursion here. */
- sched_analyze_2 (XEXP (x, 0), insn);
- return;
- }
-
- case ASM_OPERANDS:
- case ASM_INPUT:
- case UNSPEC_VOLATILE:
- case TRAP_IF:
- {
- rtx u;
-
- /* Traditional and volatile asm instructions must be considered to use
- and clobber all hard registers, all pseudo-registers and all of
- memory. So must TRAP_IF and UNSPEC_VOLATILE operations.
-
- Consider for instance a volatile asm that changes the fpu rounding
- mode. An insn should not be moved across this even if it only uses
- pseudo-regs because it might give an incorrectly rounded result. */
- if (code != ASM_OPERANDS || MEM_VOLATILE_P (x))
- {
- int max_reg = max_reg_num ();
- for (i = 0; i < max_reg; i++)
- {
- for (u = reg_last_uses[i]; u; u = XEXP (u, 1))
- add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
- reg_last_uses[i] = 0;
- if (reg_last_sets[i])
- add_dependence (insn, reg_last_sets[i], 0);
- }
- reg_pending_sets_all = 1;
-
- flush_pending_lists (insn, 0);
- }
-
- /* For all ASM_OPERANDS, we must traverse the vector of input operands.
- We can not just fall through here since then we would be confused
- by the ASM_INPUT rtx inside ASM_OPERANDS, which do not indicate
- traditional asms unlike their normal usage. */
-
- if (code == ASM_OPERANDS)
- {
- for (j = 0; j < ASM_OPERANDS_INPUT_LENGTH (x); j++)
- sched_analyze_2 (ASM_OPERANDS_INPUT (x, j), insn);
- return;
- }
- break;
- }
-
- case PRE_DEC:
- case POST_DEC:
- case PRE_INC:
- case POST_INC:
- /* These both read and modify the result. We must handle them as writes
- to get proper dependencies for following instructions. We must handle
- them as reads to get proper dependencies from this to previous
- instructions. Thus we need to pass them to both sched_analyze_1
- and sched_analyze_2. We must call sched_analyze_2 first in order
- to get the proper antecedent for the read. */
- sched_analyze_2 (XEXP (x, 0), insn);
- sched_analyze_1 (x, insn);
- return;
- }
-
- /* Other cases: walk the insn. */
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- sched_analyze_2 (XEXP (x, i), insn);
- else if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- sched_analyze_2 (XVECEXP (x, i, j), insn);
- }
-}
-
-/* Analyze an INSN with pattern X to find all dependencies. */
-
-static void
-sched_analyze_insn (x, insn, loop_notes)
- rtx x, insn;
- rtx loop_notes;
-{
- register RTX_CODE code = GET_CODE (x);
- rtx link;
- int maxreg = max_reg_num ();
- int i;
-
- if (code == SET || code == CLOBBER)
- sched_analyze_1 (x, insn);
- else if (code == PARALLEL)
- {
- register int i;
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- {
- code = GET_CODE (XVECEXP (x, 0, i));
- if (code == SET || code == CLOBBER)
- sched_analyze_1 (XVECEXP (x, 0, i), insn);
- else
- sched_analyze_2 (XVECEXP (x, 0, i), insn);
- }
- }
- else
- sched_analyze_2 (x, insn);
-
- /* Mark registers CLOBBERED or used by called function. */
- if (GET_CODE (insn) == CALL_INSN)
- for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
- {
- if (GET_CODE (XEXP (link, 0)) == CLOBBER)
- sched_analyze_1 (XEXP (link, 0), insn);
- else
- sched_analyze_2 (XEXP (link, 0), insn);
- }
-
- /* If there is a {LOOP,EHREGION}_{BEG,END} note in the middle of a basic block, then
- we must be sure that no instructions are scheduled across it.
- Otherwise, the reg_n_refs info (which depends on loop_depth) would
- become incorrect. */
-
- if (loop_notes)
- {
- int max_reg = max_reg_num ();
- rtx link;
-
- for (i = 0; i < max_reg; i++)
- {
- rtx u;
- for (u = reg_last_uses[i]; u; u = XEXP (u, 1))
- add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
- reg_last_uses[i] = 0;
- if (reg_last_sets[i])
- add_dependence (insn, reg_last_sets[i], 0);
- }
- reg_pending_sets_all = 1;
-
- flush_pending_lists (insn, 0);
-
- link = loop_notes;
- while (XEXP (link, 1))
- link = XEXP (link, 1);
- XEXP (link, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = loop_notes;
- }
-
- /* After reload, it is possible for an instruction to have a REG_DEAD note
- for a register that actually dies a few instructions earlier. For
- example, this can happen with SECONDARY_MEMORY_NEEDED reloads.
- In this case, we must consider the insn to use the register mentioned
- in the REG_DEAD note. Otherwise, we may accidentally move this insn
- after another insn that sets the register, thus getting obviously invalid
- rtl. This confuses reorg which believes that REG_DEAD notes are still
- meaningful.
-
- ??? We would get better code if we fixed reload to put the REG_DEAD
- notes in the right places, but that may not be worth the effort. */
-
- if (reload_completed)
- {
- rtx note;
-
- for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_DEAD)
- sched_analyze_2 (XEXP (note, 0), insn);
- }
-
- for (i = 0; i < regset_size; i++)
- {
- REGSET_ELT_TYPE sets = reg_pending_sets[i];
- if (sets)
- {
- register int bit;
- for (bit = 0; bit < REGSET_ELT_BITS; bit++)
- if (sets & ((REGSET_ELT_TYPE) 1 << bit))
- reg_last_sets[i * REGSET_ELT_BITS + bit] = insn;
- reg_pending_sets[i] = 0;
- }
- }
- if (reg_pending_sets_all)
- {
- for (i = 0; i < maxreg; i++)
- reg_last_sets[i] = insn;
- reg_pending_sets_all = 0;
- }
-
- /* Handle function calls and function returns created by the epilogue
- threading code. */
- if (GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN)
- {
- rtx dep_insn;
- rtx prev_dep_insn;
-
- /* When scheduling instructions, we make sure calls don't lose their
- accompanying USE insns by depending them one on another in order.
-
- Also, we must do the same thing for returns created by the epilogue
- threading code. Note this code works only in this special case,
- because other passes make no guarantee that they will never emit
- an instruction between a USE and a RETURN. There is such a guarantee
- for USE instructions immediately before a call. */
-
- prev_dep_insn = insn;
- dep_insn = PREV_INSN (insn);
- while (GET_CODE (dep_insn) == INSN
- && GET_CODE (PATTERN (dep_insn)) == USE
- && GET_CODE (XEXP (PATTERN (dep_insn), 0)) == REG)
- {
- SCHED_GROUP_P (prev_dep_insn) = 1;
-
- /* Make a copy of all dependencies on dep_insn, and add to insn.
- This is so that all of the dependencies will apply to the
- group. */
-
- for (link = LOG_LINKS (dep_insn); link; link = XEXP (link, 1))
- add_dependence (insn, XEXP (link, 0), REG_NOTE_KIND (link));
-
- prev_dep_insn = dep_insn;
- dep_insn = PREV_INSN (dep_insn);
- }
- }
-}
-
-/* Analyze every insn between HEAD and TAIL inclusive, creating LOG_LINKS
- for every dependency. */
-
-static int
-sched_analyze (head, tail)
- rtx head, tail;
-{
- register rtx insn;
- register int n_insns = 0;
- register rtx u;
- register int luid = 0;
- rtx loop_notes = 0;
-
- for (insn = head; ; insn = NEXT_INSN (insn))
- {
- INSN_LUID (insn) = luid++;
-
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN)
- {
- sched_analyze_insn (PATTERN (insn), insn, loop_notes);
- loop_notes = 0;
- n_insns += 1;
- }
- else if (GET_CODE (insn) == CALL_INSN)
- {
- rtx x;
- register int i;
-
- /* Any instruction using a hard register which may get clobbered
- by a call needs to be marked as dependent on this call.
- This prevents a use of a hard return reg from being moved
- past a void call (i.e. it does not explicitly set the hard
- return reg). */
-
- /* If this call is followed by a NOTE_INSN_SETJMP, then assume that
- all registers, not just hard registers, may be clobbered by this
- call. */
-
- /* Insn, being a CALL_INSN, magically depends on
- `last_function_call' already. */
-
- if (NEXT_INSN (insn) && GET_CODE (NEXT_INSN (insn)) == NOTE
- && NOTE_LINE_NUMBER (NEXT_INSN (insn)) == NOTE_INSN_SETJMP)
- {
- int max_reg = max_reg_num ();
- for (i = 0; i < max_reg; i++)
- {
- for (u = reg_last_uses[i]; u; u = XEXP (u, 1))
- add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
- reg_last_uses[i] = 0;
- if (reg_last_sets[i])
- add_dependence (insn, reg_last_sets[i], 0);
- }
- reg_pending_sets_all = 1;
-
- /* Add a pair of fake REG_NOTEs which we will later
- convert back into a NOTE_INSN_SETJMP note. See
- reemit_notes for why we use a pair of of NOTEs. */
-
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_DEAD,
- GEN_INT (0),
- REG_NOTES (insn));
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_DEAD,
- GEN_INT (NOTE_INSN_SETJMP),
- REG_NOTES (insn));
- }
- else
- {
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i] || global_regs[i])
- {
- for (u = reg_last_uses[i]; u; u = XEXP (u, 1))
- add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
- reg_last_uses[i] = 0;
- if (reg_last_sets[i])
- add_dependence (insn, reg_last_sets[i], REG_DEP_ANTI);
- reg_pending_sets[i / REGSET_ELT_BITS]
- |= (REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS);
- }
- }
-
- /* For each insn which shouldn't cross a call, add a dependence
- between that insn and this call insn. */
- x = LOG_LINKS (sched_before_next_call);
- while (x)
- {
- add_dependence (insn, XEXP (x, 0), REG_DEP_ANTI);
- x = XEXP (x, 1);
- }
- LOG_LINKS (sched_before_next_call) = 0;
-
- sched_analyze_insn (PATTERN (insn), insn, loop_notes);
- loop_notes = 0;
-
- /* In the absence of interprocedural alias analysis, we must flush
- all pending reads and writes, and start new dependencies starting
- from here. But only flush writes for constant calls (which may
- be passed a pointer to something we haven't written yet). */
- flush_pending_lists (insn, CONST_CALL_P (insn));
-
- /* Depend this function call (actually, the user of this
- function call) on all hard register clobberage. */
- last_function_call = insn;
- n_insns += 1;
- }
-
- /* See comments on reemit_notes as to why we do this. */
- else if (GET_CODE (insn) == NOTE
- && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END
- || (NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP
- && GET_CODE (PREV_INSN (insn)) != CALL_INSN)))
- {
- loop_notes = gen_rtx (EXPR_LIST, REG_DEAD,
- GEN_INT (NOTE_BLOCK_NUMBER (insn)), loop_notes);
- loop_notes = gen_rtx (EXPR_LIST, REG_DEAD,
- GEN_INT (NOTE_LINE_NUMBER (insn)), loop_notes);
- CONST_CALL_P (loop_notes) = CONST_CALL_P (insn);
- }
-
- if (insn == tail)
- return n_insns;
- }
-
- abort ();
-}
-
-/* Called when we see a set of a register. If death is true, then we are
- scanning backwards. Mark that register as unborn. If nobody says
- otherwise, that is how things will remain. If death is false, then we
- are scanning forwards. Mark that register as being born. */
-
-static void
-sched_note_set (b, x, death)
- int b;
- rtx x;
- int death;
-{
- register int regno;
- register rtx reg = SET_DEST (x);
- int subreg_p = 0;
-
- if (reg == 0)
- return;
-
- while (GET_CODE (reg) == SUBREG || GET_CODE (reg) == STRICT_LOW_PART
- || GET_CODE (reg) == SIGN_EXTRACT || GET_CODE (reg) == ZERO_EXTRACT)
- {
- /* Must treat modification of just one hardware register of a multi-reg
- value or just a byte field of a register exactly the same way that
- mark_set_1 in flow.c does, i.e. anything except a paradoxical subreg
- does not kill the entire register. */
- if (GET_CODE (reg) != SUBREG
- || REG_SIZE (SUBREG_REG (reg)) > REG_SIZE (reg))
- subreg_p = 1;
-
- reg = SUBREG_REG (reg);
- }
-
- if (GET_CODE (reg) != REG)
- return;
-
- /* Global registers are always live, so the code below does not apply
- to them. */
-
- regno = REGNO (reg);
- if (regno >= FIRST_PSEUDO_REGISTER || ! global_regs[regno])
- {
- register int offset = regno / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
-
- if (death)
- {
- /* If we only set part of the register, then this set does not
- kill it. */
- if (subreg_p)
- return;
-
- /* Try killing this register. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int j = HARD_REGNO_NREGS (regno, GET_MODE (reg));
- while (--j >= 0)
- {
- offset = (regno + j) / REGSET_ELT_BITS;
- bit = (REGSET_ELT_TYPE) 1 << ((regno + j) % REGSET_ELT_BITS);
-
- bb_live_regs[offset] &= ~bit;
- bb_dead_regs[offset] |= bit;
- }
- }
- else
- {
- bb_live_regs[offset] &= ~bit;
- bb_dead_regs[offset] |= bit;
- }
- }
- else
- {
- /* Make the register live again. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int j = HARD_REGNO_NREGS (regno, GET_MODE (reg));
- while (--j >= 0)
- {
- offset = (regno + j) / REGSET_ELT_BITS;
- bit = (REGSET_ELT_TYPE) 1 << ((regno + j) % REGSET_ELT_BITS);
-
- bb_live_regs[offset] |= bit;
- bb_dead_regs[offset] &= ~bit;
- }
- }
- else
- {
- bb_live_regs[offset] |= bit;
- bb_dead_regs[offset] &= ~bit;
- }
- }
- }
-}
-
-/* Macros and functions for keeping the priority queue sorted, and
- dealing with queueing and dequeueing of instructions. */
-
-#define SCHED_SORT(READY, NEW_READY, OLD_READY) \
- do { if ((NEW_READY) - (OLD_READY) == 1) \
- swap_sort (READY, NEW_READY); \
- else if ((NEW_READY) - (OLD_READY) > 1) \
- qsort (READY, NEW_READY, sizeof (rtx), rank_for_schedule); } \
- while (0)
-
-/* Returns a positive value if y is preferred; returns a negative value if
- x is preferred. Should never return 0, since that will make the sort
- unstable. */
-
-static int
-rank_for_schedule (x, y)
- rtx *x, *y;
-{
- rtx tmp = *y;
- rtx tmp2 = *x;
- rtx link;
- int tmp_class, tmp2_class;
- int value;
-
- /* Choose the instruction with the highest priority, if different. */
- if (value = INSN_PRIORITY (tmp) - INSN_PRIORITY (tmp2))
- return value;
-
- if (last_scheduled_insn)
- {
- /* Classify the instructions into three classes:
- 1) Data dependent on last schedule insn.
- 2) Anti/Output dependent on last scheduled insn.
- 3) Independent of last scheduled insn, or has latency of one.
- Choose the insn from the highest numbered class if different. */
- link = find_insn_list (tmp, LOG_LINKS (last_scheduled_insn));
- if (link == 0 || insn_cost (tmp, link, last_scheduled_insn) == 1)
- tmp_class = 3;
- else if (REG_NOTE_KIND (link) == 0) /* Data dependence. */
- tmp_class = 1;
- else
- tmp_class = 2;
-
- link = find_insn_list (tmp2, LOG_LINKS (last_scheduled_insn));
- if (link == 0 || insn_cost (tmp2, link, last_scheduled_insn) == 1)
- tmp2_class = 3;
- else if (REG_NOTE_KIND (link) == 0) /* Data dependence. */
- tmp2_class = 1;
- else
- tmp2_class = 2;
-
- if (value = tmp_class - tmp2_class)
- return value;
- }
-
- /* If insns are equally good, sort by INSN_LUID (original insn order),
- so that we make the sort stable. This minimizes instruction movement,
- thus minimizing sched's effect on debugging and cross-jumping. */
- return INSN_LUID (tmp) - INSN_LUID (tmp2);
-}
-
-/* Resort the array A in which only element at index N may be out of order. */
-
-__inline static void
-swap_sort (a, n)
- rtx *a;
- int n;
-{
- rtx insn = a[n-1];
- int i = n-2;
-
- while (i >= 0 && rank_for_schedule (a+i, &insn) >= 0)
- {
- a[i+1] = a[i];
- i -= 1;
- }
- a[i+1] = insn;
-}
-
-static int max_priority;
-
-/* Add INSN to the insn queue so that it fires at least N_CYCLES
- before the currently executing insn. */
-
-__inline static void
-queue_insn (insn, n_cycles)
- rtx insn;
- int n_cycles;
-{
- int next_q = NEXT_Q_AFTER (q_ptr, n_cycles);
- NEXT_INSN (insn) = insn_queue[next_q];
- insn_queue[next_q] = insn;
- q_size += 1;
-}
-
-/* Return nonzero if PAT is the pattern of an insn which makes a
- register live. */
-
-__inline static int
-birthing_insn_p (pat)
- rtx pat;
-{
- int j;
-
- if (reload_completed == 1)
- return 0;
-
- if (GET_CODE (pat) == SET
- && GET_CODE (SET_DEST (pat)) == REG)
- {
- rtx dest = SET_DEST (pat);
- int i = REGNO (dest);
- int offset = i / REGSET_ELT_BITS;
- REGSET_ELT_TYPE bit = (REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS);
-
- /* It would be more accurate to use refers_to_regno_p or
- reg_mentioned_p to determine when the dest is not live before this
- insn. */
-
- if (bb_live_regs[offset] & bit)
- return (reg_n_sets[i] == 1);
-
- return 0;
- }
- if (GET_CODE (pat) == PARALLEL)
- {
- for (j = 0; j < XVECLEN (pat, 0); j++)
- if (birthing_insn_p (XVECEXP (pat, 0, j)))
- return 1;
- }
- return 0;
-}
-
-/* PREV is an insn that is ready to execute. Adjust its priority if that
- will help shorten register lifetimes. */
-
-__inline static void
-adjust_priority (prev)
- rtx prev;
-{
- /* Trying to shorten register lives after reload has completed
- is useless and wrong. It gives inaccurate schedules. */
- if (reload_completed == 0)
- {
- rtx note;
- int n_deaths = 0;
-
- /* ??? This code has no effect, because REG_DEAD notes are removed
- before we ever get here. */
- for (note = REG_NOTES (prev); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_DEAD)
- n_deaths += 1;
-
- /* Defer scheduling insns which kill registers, since that
- shortens register lives. Prefer scheduling insns which
- make registers live for the same reason. */
- switch (n_deaths)
- {
- default:
- INSN_PRIORITY (prev) >>= 3;
- break;
- case 3:
- INSN_PRIORITY (prev) >>= 2;
- break;
- case 2:
- case 1:
- INSN_PRIORITY (prev) >>= 1;
- break;
- case 0:
- if (birthing_insn_p (PATTERN (prev)))
- {
- int max = max_priority;
-
- if (max > INSN_PRIORITY (prev))
- INSN_PRIORITY (prev) = max;
- }
- break;
- }
-#ifdef ADJUST_PRIORITY
- ADJUST_PRIORITY (prev);
-#endif
- }
-}
-
-/* INSN is the "currently executing insn". Launch each insn which was
- waiting on INSN (in the backwards dataflow sense). READY is a
- vector of insns which are ready to fire. N_READY is the number of
- elements in READY. CLOCK is the current virtual cycle. */
-
-static int
-schedule_insn (insn, ready, n_ready, clock)
- rtx insn;
- rtx *ready;
- int n_ready;
- int clock;
-{
- rtx link;
- int new_ready = n_ready;
-
- if (MAX_BLOCKAGE > 1)
- schedule_unit (insn_unit (insn), insn, clock);
-
- if (LOG_LINKS (insn) == 0)
- return n_ready;
-
- /* This is used by the function adjust_priority above. */
- if (n_ready > 0)
- max_priority = MAX (INSN_PRIORITY (ready[0]), INSN_PRIORITY (insn));
- else
- max_priority = INSN_PRIORITY (insn);
-
- for (link = LOG_LINKS (insn); link != 0; link = XEXP (link, 1))
- {
- rtx prev = XEXP (link, 0);
- int cost = insn_cost (prev, link, insn);
-
- if ((INSN_REF_COUNT (prev) -= 1) != 0)
- {
- /* We satisfied one requirement to fire PREV. Record the earliest
- time when PREV can fire. No need to do this if the cost is 1,
- because PREV can fire no sooner than the next cycle. */
- if (cost > 1)
- INSN_TICK (prev) = MAX (INSN_TICK (prev), clock + cost);
- }
- else
- {
- /* We satisfied the last requirement to fire PREV. Ensure that all
- timing requirements are satisfied. */
- if (INSN_TICK (prev) - clock > cost)
- cost = INSN_TICK (prev) - clock;
-
- /* Adjust the priority of PREV and either put it on the ready
- list or queue it. */
- adjust_priority (prev);
- if (cost <= 1)
- ready[new_ready++] = prev;
- else
- queue_insn (prev, cost);
- }
- }
-
- return new_ready;
-}
-
-/* Given N_READY insns in the ready list READY at time CLOCK, queue
- those that are blocked due to function unit hazards and rearrange
- the remaining ones to minimize subsequent function unit hazards. */
-
-static int
-schedule_select (ready, n_ready, clock, file)
- rtx *ready;
- int n_ready, clock;
- FILE *file;
-{
- int pri = INSN_PRIORITY (ready[0]);
- int i, j, k, q, cost, best_cost, best_insn = 0, new_ready = n_ready;
- rtx insn;
-
- /* Work down the ready list in groups of instructions with the same
- priority value. Queue insns in the group that are blocked and
- select among those that remain for the one with the largest
- potential hazard. */
- for (i = 0; i < n_ready; i = j)
- {
- int opri = pri;
- for (j = i + 1; j < n_ready; j++)
- if ((pri = INSN_PRIORITY (ready[j])) != opri)
- break;
-
- /* Queue insns in the group that are blocked. */
- for (k = i, q = 0; k < j; k++)
- {
- insn = ready[k];
- if ((cost = actual_hazard (insn_unit (insn), insn, clock, 0)) != 0)
- {
- q++;
- ready[k] = 0;
- queue_insn (insn, cost);
- if (file)
- fprintf (file, "\n;; blocking insn %d for %d cycles",
- INSN_UID (insn), cost);
- }
- }
- new_ready -= q;
-
- /* Check the next group if all insns were queued. */
- if (j - i - q == 0)
- continue;
-
- /* If more than one remains, select the first one with the largest
- potential hazard. */
- else if (j - i - q > 1)
- {
- best_cost = -1;
- for (k = i; k < j; k++)
- {
- if ((insn = ready[k]) == 0)
- continue;
- if ((cost = potential_hazard (insn_unit (insn), insn, 0))
- > best_cost)
- {
- best_cost = cost;
- best_insn = k;
- }
- }
- }
- /* We have found a suitable insn to schedule. */
- break;
- }
-
- /* Move the best insn to be front of the ready list. */
- if (best_insn != 0)
- {
- if (file)
- {
- fprintf (file, ", now");
- for (i = 0; i < n_ready; i++)
- if (ready[i])
- fprintf (file, " %d", INSN_UID (ready[i]));
- fprintf (file, "\n;; insn %d has a greater potential hazard",
- INSN_UID (ready[best_insn]));
- }
- for (i = best_insn; i > 0; i--)
- {
- insn = ready[i-1];
- ready[i-1] = ready[i];
- ready[i] = insn;
- }
- }
-
- /* Compact the ready list. */
- if (new_ready < n_ready)
- for (i = j = 0; i < n_ready; i++)
- if (ready[i])
- ready[j++] = ready[i];
-
- return new_ready;
-}
-
-/* Add a REG_DEAD note for REG to INSN, reusing a REG_DEAD note from the
- dead_notes list. */
-
-static void
-create_reg_dead_note (reg, insn)
- rtx reg, insn;
-{
- rtx link;
-
- /* The number of registers killed after scheduling must be the same as the
- number of registers killed before scheduling. The number of REG_DEAD
- notes may not be conserved, i.e. two SImode hard register REG_DEAD notes
- might become one DImode hard register REG_DEAD note, but the number of
- registers killed will be conserved.
-
- We carefully remove REG_DEAD notes from the dead_notes list, so that
- there will be none left at the end. If we run out early, then there
- is a bug somewhere in flow, combine and/or sched. */
-
- if (dead_notes == 0)
- {
-#if 1
- abort ();
-#else
- link = rtx_alloc (EXPR_LIST);
- PUT_REG_NOTE_KIND (link, REG_DEAD);
-#endif
- }
- else
- {
- /* Number of regs killed by REG. */
- int regs_killed = (REGNO (reg) >= FIRST_PSEUDO_REGISTER ? 1
- : HARD_REGNO_NREGS (REGNO (reg), GET_MODE (reg)));
- /* Number of regs killed by REG_DEAD notes taken off the list. */
- int reg_note_regs;
-
- link = dead_notes;
- reg_note_regs = (REGNO (XEXP (link, 0)) >= FIRST_PSEUDO_REGISTER ? 1
- : HARD_REGNO_NREGS (REGNO (XEXP (link, 0)),
- GET_MODE (XEXP (link, 0))));
- while (reg_note_regs < regs_killed)
- {
- link = XEXP (link, 1);
- reg_note_regs += (REGNO (XEXP (link, 0)) >= FIRST_PSEUDO_REGISTER ? 1
- : HARD_REGNO_NREGS (REGNO (XEXP (link, 0)),
- GET_MODE (XEXP (link, 0))));
- }
- dead_notes = XEXP (link, 1);
-
- /* If we took too many regs kills off, put the extra ones back. */
- while (reg_note_regs > regs_killed)
- {
- rtx temp_reg, temp_link;
-
- temp_reg = gen_rtx (REG, word_mode, 0);
- temp_link = rtx_alloc (EXPR_LIST);
- PUT_REG_NOTE_KIND (temp_link, REG_DEAD);
- XEXP (temp_link, 0) = temp_reg;
- XEXP (temp_link, 1) = dead_notes;
- dead_notes = temp_link;
- reg_note_regs--;
- }
- }
-
- XEXP (link, 0) = reg;
- XEXP (link, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = link;
-}
-
-/* Subroutine on attach_deaths_insn--handles the recursive search
- through INSN. If SET_P is true, then x is being modified by the insn. */
-
-static void
-attach_deaths (x, insn, set_p)
- rtx x;
- rtx insn;
- int set_p;
-{
- register int i;
- register int j;
- register enum rtx_code code;
- register char *fmt;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- switch (code)
- {
- case CONST_INT:
- case CONST_DOUBLE:
- case LABEL_REF:
- case SYMBOL_REF:
- case CONST:
- case CODE_LABEL:
- case PC:
- case CC0:
- /* Get rid of the easy cases first. */
- return;
-
- case REG:
- {
- /* If the register dies in this insn, queue that note, and mark
- this register as needing to die. */
- /* This code is very similar to mark_used_1 (if set_p is false)
- and mark_set_1 (if set_p is true) in flow.c. */
-
- register int regno = REGNO (x);
- register int offset = regno / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
- REGSET_ELT_TYPE all_needed = (old_live_regs[offset] & bit);
- REGSET_ELT_TYPE some_needed = (old_live_regs[offset] & bit);
-
- if (set_p)
- return;
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int n;
-
- n = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (--n > 0)
- {
- some_needed |= (old_live_regs[(regno + n) / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1
- << ((regno + n) % REGSET_ELT_BITS)));
- all_needed &= (old_live_regs[(regno + n) / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1
- << ((regno + n) % REGSET_ELT_BITS)));
- }
- }
-
- /* If it wasn't live before we started, then add a REG_DEAD note.
- We must check the previous lifetime info not the current info,
- because we may have to execute this code several times, e.g.
- once for a clobber (which doesn't add a note) and later
- for a use (which does add a note).
-
- Always make the register live. We must do this even if it was
- live before, because this may be an insn which sets and uses
- the same register, in which case the register has already been
- killed, so we must make it live again.
-
- Global registers are always live, and should never have a REG_DEAD
- note added for them, so none of the code below applies to them. */
-
- if (regno >= FIRST_PSEUDO_REGISTER || ! global_regs[regno])
- {
- /* Never add REG_DEAD notes for the FRAME_POINTER_REGNUM or the
- STACK_POINTER_REGNUM, since these are always considered to be
- live. Similarly for ARG_POINTER_REGNUM if it is fixed. */
- if (regno != FRAME_POINTER_REGNUM
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && ! (regno == HARD_FRAME_POINTER_REGNUM)
-#endif
-#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && ! (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
-#endif
- && regno != STACK_POINTER_REGNUM)
- {
- /* ??? It is perhaps a dead_or_set_p bug that it does
- not check for REG_UNUSED notes itself. This is necessary
- for the case where the SET_DEST is a subreg of regno, as
- dead_or_set_p handles subregs specially. */
- if (! all_needed && ! dead_or_set_p (insn, x)
- && ! find_reg_note (insn, REG_UNUSED, x))
- {
- /* Check for the case where the register dying partially
- overlaps the register set by this insn. */
- if (regno < FIRST_PSEUDO_REGISTER
- && HARD_REGNO_NREGS (regno, GET_MODE (x)) > 1)
- {
- int n = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (--n >= 0)
- some_needed |= dead_or_set_regno_p (insn, regno + n);
- }
-
- /* If none of the words in X is needed, make a REG_DEAD
- note. Otherwise, we must make partial REG_DEAD
- notes. */
- if (! some_needed)
- create_reg_dead_note (x, insn);
- else
- {
- int i;
-
- /* Don't make a REG_DEAD note for a part of a
- register that is set in the insn. */
- for (i = HARD_REGNO_NREGS (regno, GET_MODE (x)) - 1;
- i >= 0; i--)
- if ((old_live_regs[(regno + i) / REGSET_ELT_BITS]
- & ((REGSET_ELT_TYPE) 1
- << ((regno +i) % REGSET_ELT_BITS))) == 0
- && ! dead_or_set_regno_p (insn, regno + i))
- create_reg_dead_note (gen_rtx (REG,
- reg_raw_mode[regno + i],
- regno + i),
- insn);
- }
- }
- }
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int j = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (--j >= 0)
- {
- offset = (regno + j) / REGSET_ELT_BITS;
- bit
- = (REGSET_ELT_TYPE) 1 << ((regno + j) % REGSET_ELT_BITS);
-
- bb_dead_regs[offset] &= ~bit;
- bb_live_regs[offset] |= bit;
- }
- }
- else
- {
- bb_dead_regs[offset] &= ~bit;
- bb_live_regs[offset] |= bit;
- }
- }
- return;
- }
-
- case MEM:
- /* Handle tail-recursive case. */
- attach_deaths (XEXP (x, 0), insn, 0);
- return;
-
- case SUBREG:
- case STRICT_LOW_PART:
- /* These two cases preserve the value of SET_P, so handle them
- separately. */
- attach_deaths (XEXP (x, 0), insn, set_p);
- return;
-
- case ZERO_EXTRACT:
- case SIGN_EXTRACT:
- /* This case preserves the value of SET_P for the first operand, but
- clears it for the other two. */
- attach_deaths (XEXP (x, 0), insn, set_p);
- attach_deaths (XEXP (x, 1), insn, 0);
- attach_deaths (XEXP (x, 2), insn, 0);
- return;
-
- default:
- /* Other cases: walk the insn. */
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- attach_deaths (XEXP (x, i), insn, 0);
- else if (fmt[i] == 'E')
- for (j = 0; j < XVECLEN (x, i); j++)
- attach_deaths (XVECEXP (x, i, j), insn, 0);
- }
- }
-}
-
-/* After INSN has executed, add register death notes for each register
- that is dead after INSN. */
-
-static void
-attach_deaths_insn (insn)
- rtx insn;
-{
- rtx x = PATTERN (insn);
- register RTX_CODE code = GET_CODE (x);
- rtx link;
-
- if (code == SET)
- {
- attach_deaths (SET_SRC (x), insn, 0);
-
- /* A register might die here even if it is the destination, e.g.
- it is the target of a volatile read and is otherwise unused.
- Hence we must always call attach_deaths for the SET_DEST. */
- attach_deaths (SET_DEST (x), insn, 1);
- }
- else if (code == PARALLEL)
- {
- register int i;
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- {
- code = GET_CODE (XVECEXP (x, 0, i));
- if (code == SET)
- {
- attach_deaths (SET_SRC (XVECEXP (x, 0, i)), insn, 0);
-
- attach_deaths (SET_DEST (XVECEXP (x, 0, i)), insn, 1);
- }
- /* Flow does not add REG_DEAD notes to registers that die in
- clobbers, so we can't either. */
- else if (code != CLOBBER)
- attach_deaths (XVECEXP (x, 0, i), insn, 0);
- }
- }
- /* If this is a CLOBBER, only add REG_DEAD notes to registers inside a
- MEM being clobbered, just like flow. */
- else if (code == CLOBBER && GET_CODE (XEXP (x, 0)) == MEM)
- attach_deaths (XEXP (XEXP (x, 0), 0), insn, 0);
- /* Otherwise don't add a death note to things being clobbered. */
- else if (code != CLOBBER)
- attach_deaths (x, insn, 0);
-
- /* Make death notes for things used in the called function. */
- if (GET_CODE (insn) == CALL_INSN)
- for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
- attach_deaths (XEXP (XEXP (link, 0), 0), insn,
- GET_CODE (XEXP (link, 0)) == CLOBBER);
-}
-
-/* Delete notes beginning with INSN and maybe put them in the chain
- of notes ended by NOTE_LIST.
- Returns the insn following the notes. */
-
-static rtx
-unlink_notes (insn, tail)
- rtx insn, tail;
-{
- rtx prev = PREV_INSN (insn);
-
- while (insn != tail && GET_CODE (insn) == NOTE)
- {
- rtx next = NEXT_INSN (insn);
- /* Delete the note from its current position. */
- if (prev)
- NEXT_INSN (prev) = next;
- if (next)
- PREV_INSN (next) = prev;
-
- if (write_symbols != NO_DEBUG && NOTE_LINE_NUMBER (insn) > 0)
- /* Record line-number notes so they can be reused. */
- LINE_NOTE (insn) = insn;
-
- /* Don't save away NOTE_INSN_SETJMPs, because they must remain
- immediately after the call they follow. We use a fake
- (REG_DEAD (const_int -1)) note to remember them.
- Likewise with NOTE_INSN_{LOOP,EHREGION}_{BEG, END}. */
- else if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_SETJMP
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_BEG
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_END
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_BEG
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_END)
- {
- /* Insert the note at the end of the notes list. */
- PREV_INSN (insn) = note_list;
- if (note_list)
- NEXT_INSN (note_list) = insn;
- note_list = insn;
- }
-
- insn = next;
- }
- return insn;
-}
-
-/* Constructor for `sometimes' data structure. */
-
-static int
-new_sometimes_live (regs_sometimes_live, offset, bit, sometimes_max)
- struct sometimes *regs_sometimes_live;
- int offset, bit;
- int sometimes_max;
-{
- register struct sometimes *p;
- register int regno = offset * REGSET_ELT_BITS + bit;
-
- /* There should never be a register greater than max_regno here. If there
- is, it means that a define_split has created a new pseudo reg. This
- is not allowed, since there will not be flow info available for any
- new register, so catch the error here. */
- if (regno >= max_regno)
- abort ();
-
- p = &regs_sometimes_live[sometimes_max];
- p->offset = offset;
- p->bit = bit;
- p->live_length = 0;
- p->calls_crossed = 0;
- sometimes_max++;
- return sometimes_max;
-}
-
-/* Count lengths of all regs we are currently tracking,
- and find new registers no longer live. */
-
-static void
-finish_sometimes_live (regs_sometimes_live, sometimes_max)
- struct sometimes *regs_sometimes_live;
- int sometimes_max;
-{
- int i;
-
- for (i = 0; i < sometimes_max; i++)
- {
- register struct sometimes *p = &regs_sometimes_live[i];
- int regno;
-
- regno = p->offset * REGSET_ELT_BITS + p->bit;
-
- sched_reg_live_length[regno] += p->live_length;
- sched_reg_n_calls_crossed[regno] += p->calls_crossed;
- }
-}
-
-/* Search INSN for fake REG_DEAD note pairs for NOTE_INSN_SETJMP,
- NOTE_INSN_{LOOP,EHREGION}_{BEG,END}; and convert them back into
- NOTEs. The REG_DEAD note following first one is contains the saved
- value for NOTE_BLOCK_NUMBER which is useful for
- NOTE_INSN_EH_REGION_{BEG,END} NOTEs. LAST is the last instruction
- output by the instruction scheduler. Return the new value of LAST. */
-
-static rtx
-reemit_notes (insn, last)
- rtx insn;
- rtx last;
-{
- rtx note;
-
- for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
- {
- if (REG_NOTE_KIND (note) == REG_DEAD
- && GET_CODE (XEXP (note, 0)) == CONST_INT)
- {
- if (INTVAL (XEXP (note, 0)) == NOTE_INSN_SETJMP)
- {
- CONST_CALL_P (emit_note_after (INTVAL (XEXP (note, 0)), insn))
- = CONST_CALL_P (note);
- remove_note (insn, note);
- note = XEXP (note, 1);
- }
- else
- {
- last = emit_note_before (INTVAL (XEXP (note, 0)), last);
- remove_note (insn, note);
- note = XEXP (note, 1);
- NOTE_BLOCK_NUMBER (last) = INTVAL (XEXP (note, 0));
- }
- remove_note (insn, note);
- }
- }
- return last;
-}
-
-/* Use modified list scheduling to rearrange insns in basic block
- B. FILE, if nonzero, is where we dump interesting output about
- this pass. */
-
-static void
-schedule_block (b, file)
- int b;
- FILE *file;
-{
- rtx insn, last;
- rtx *ready, link;
- int i, j, n_ready = 0, new_ready, n_insns;
- int sched_n_insns = 0;
- int clock;
-#define NEED_NOTHING 0
-#define NEED_HEAD 1
-#define NEED_TAIL 2
- int new_needs;
-
- /* HEAD and TAIL delimit the region being scheduled. */
- rtx head = basic_block_head[b];
- rtx tail = basic_block_end[b];
- /* PREV_HEAD and NEXT_TAIL are the boundaries of the insns
- being scheduled. When the insns have been ordered,
- these insns delimit where the new insns are to be
- spliced back into the insn chain. */
- rtx next_tail;
- rtx prev_head;
-
- /* Keep life information accurate. */
- register struct sometimes *regs_sometimes_live;
- int sometimes_max;
-
- if (file)
- fprintf (file, ";;\t -- basic block number %d from %d to %d --\n",
- b, INSN_UID (basic_block_head[b]), INSN_UID (basic_block_end[b]));
-
- i = max_reg_num ();
- reg_last_uses = (rtx *) alloca (i * sizeof (rtx));
- bzero ((char *) reg_last_uses, i * sizeof (rtx));
- reg_last_sets = (rtx *) alloca (i * sizeof (rtx));
- bzero ((char *) reg_last_sets, i * sizeof (rtx));
- reg_pending_sets = (regset) alloca (regset_bytes);
- bzero ((char *) reg_pending_sets, regset_bytes);
- reg_pending_sets_all = 0;
- clear_units ();
-
- /* Remove certain insns at the beginning from scheduling,
- by advancing HEAD. */
-
- /* At the start of a function, before reload has run, don't delay getting
- parameters from hard registers into pseudo registers. */
- if (reload_completed == 0 && b == 0)
- {
- while (head != tail
- && GET_CODE (head) == NOTE
- && NOTE_LINE_NUMBER (head) != NOTE_INSN_FUNCTION_BEG)
- head = NEXT_INSN (head);
- while (head != tail
- && GET_CODE (head) == INSN
- && GET_CODE (PATTERN (head)) == SET)
- {
- rtx src = SET_SRC (PATTERN (head));
- while (GET_CODE (src) == SUBREG
- || GET_CODE (src) == SIGN_EXTEND
- || GET_CODE (src) == ZERO_EXTEND
- || GET_CODE (src) == SIGN_EXTRACT
- || GET_CODE (src) == ZERO_EXTRACT)
- src = XEXP (src, 0);
- if (GET_CODE (src) != REG
- || REGNO (src) >= FIRST_PSEUDO_REGISTER)
- break;
- /* Keep this insn from ever being scheduled. */
- INSN_REF_COUNT (head) = 1;
- head = NEXT_INSN (head);
- }
- }
-
- /* Don't include any notes or labels at the beginning of the
- basic block, or notes at the ends of basic blocks. */
- while (head != tail)
- {
- if (GET_CODE (head) == NOTE)
- head = NEXT_INSN (head);
- else if (GET_CODE (tail) == NOTE)
- tail = PREV_INSN (tail);
- else if (GET_CODE (head) == CODE_LABEL)
- head = NEXT_INSN (head);
- else break;
- }
- /* If the only insn left is a NOTE or a CODE_LABEL, then there is no need
- to schedule this block. */
- if (head == tail
- && (GET_CODE (head) == NOTE || GET_CODE (head) == CODE_LABEL))
- return;
-
-#if 0
- /* This short-cut doesn't work. It does not count call insns crossed by
- registers in reg_sometimes_live. It does not mark these registers as
- dead if they die in this block. It does not mark these registers live
- (or create new reg_sometimes_live entries if necessary) if they are born
- in this block.
-
- The easy solution is to just always schedule a block. This block only
- has one insn, so this won't slow down this pass by much. */
-
- if (head == tail)
- return;
-#endif
-
- /* Now HEAD through TAIL are the insns actually to be rearranged;
- Let PREV_HEAD and NEXT_TAIL enclose them. */
- prev_head = PREV_INSN (head);
- next_tail = NEXT_INSN (tail);
-
- /* Initialize basic block data structures. */
- dead_notes = 0;
- pending_read_insns = 0;
- pending_read_mems = 0;
- pending_write_insns = 0;
- pending_write_mems = 0;
- pending_lists_length = 0;
- last_pending_memory_flush = 0;
- last_function_call = 0;
- last_scheduled_insn = 0;
-
- LOG_LINKS (sched_before_next_call) = 0;
-
- n_insns = sched_analyze (head, tail);
- if (n_insns == 0)
- {
- free_pending_lists ();
- return;
- }
-
- /* Allocate vector to hold insns to be rearranged (except those
- insns which are controlled by an insn with SCHED_GROUP_P set).
- All these insns are included between ORIG_HEAD and ORIG_TAIL,
- as those variables ultimately are set up. */
- ready = (rtx *) alloca ((n_insns+1) * sizeof (rtx));
-
- /* TAIL is now the last of the insns to be rearranged.
- Put those insns into the READY vector. */
- insn = tail;
-
- /* For all branches, calls, uses, and cc0 setters, force them to remain
- in order at the end of the block by adding dependencies and giving
- the last a high priority. There may be notes present, and prev_head
- may also be a note.
-
- Branches must obviously remain at the end. Calls should remain at the
- end since moving them results in worse register allocation. Uses remain
- at the end to ensure proper register allocation. cc0 setters remaim
- at the end because they can't be moved away from their cc0 user. */
- last = 0;
- while (GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN
- || (GET_CODE (insn) == INSN
- && (GET_CODE (PATTERN (insn)) == USE
-#ifdef HAVE_cc0
- || sets_cc0_p (PATTERN (insn))
-#endif
- ))
- || GET_CODE (insn) == NOTE)
- {
- if (GET_CODE (insn) != NOTE)
- {
- priority (insn);
- if (last == 0)
- {
- ready[n_ready++] = insn;
- INSN_PRIORITY (insn) = TAIL_PRIORITY - i;
- INSN_REF_COUNT (insn) = 0;
- }
- else if (! find_insn_list (insn, LOG_LINKS (last)))
- {
- add_dependence (last, insn, REG_DEP_ANTI);
- INSN_REF_COUNT (insn)++;
- }
- last = insn;
-
- /* Skip over insns that are part of a group. */
- while (SCHED_GROUP_P (insn))
- {
- insn = prev_nonnote_insn (insn);
- priority (insn);
- }
- }
-
- insn = PREV_INSN (insn);
- /* Don't overrun the bounds of the basic block. */
- if (insn == prev_head)
- break;
- }
-
- /* Assign priorities to instructions. Also check whether they
- are in priority order already. If so then I will be nonnegative.
- We use this shortcut only before reloading. */
-#if 0
- i = reload_completed ? DONE_PRIORITY : MAX_PRIORITY;
-#endif
-
- for (; insn != prev_head; insn = PREV_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- priority (insn);
- if (INSN_REF_COUNT (insn) == 0)
- {
- if (last == 0)
- ready[n_ready++] = insn;
- else
- {
- /* Make this dependent on the last of the instructions
- that must remain in order at the end of the block. */
- add_dependence (last, insn, REG_DEP_ANTI);
- INSN_REF_COUNT (insn) = 1;
- }
- }
- if (SCHED_GROUP_P (insn))
- {
- while (SCHED_GROUP_P (insn))
- {
- insn = prev_nonnote_insn (insn);
- priority (insn);
- }
- continue;
- }
-#if 0
- if (i < 0)
- continue;
- if (INSN_PRIORITY (insn) < i)
- i = INSN_PRIORITY (insn);
- else if (INSN_PRIORITY (insn) > i)
- i = DONE_PRIORITY;
-#endif
- }
- }
-
-#if 0
- /* This short-cut doesn't work. It does not count call insns crossed by
- registers in reg_sometimes_live. It does not mark these registers as
- dead if they die in this block. It does not mark these registers live
- (or create new reg_sometimes_live entries if necessary) if they are born
- in this block.
-
- The easy solution is to just always schedule a block. These blocks tend
- to be very short, so this doesn't slow down this pass by much. */
-
- /* If existing order is good, don't bother to reorder. */
- if (i != DONE_PRIORITY)
- {
- if (file)
- fprintf (file, ";; already scheduled\n");
-
- if (reload_completed == 0)
- {
- for (i = 0; i < sometimes_max; i++)
- regs_sometimes_live[i].live_length += n_insns;
-
- finish_sometimes_live (regs_sometimes_live, sometimes_max);
- }
- free_pending_lists ();
- return;
- }
-#endif
-
- /* Scan all the insns to be scheduled, removing NOTE insns
- and register death notes.
- Line number NOTE insns end up in NOTE_LIST.
- Register death notes end up in DEAD_NOTES.
-
- Recreate the register life information for the end of this basic
- block. */
-
- if (reload_completed == 0)
- {
- bcopy ((char *) basic_block_live_at_start[b], (char *) bb_live_regs,
- regset_bytes);
- bzero ((char *) bb_dead_regs, regset_bytes);
-
- if (b == 0)
- {
- /* This is the first block in the function. There may be insns
- before head that we can't schedule. We still need to examine
- them though for accurate register lifetime analysis. */
-
- /* We don't want to remove any REG_DEAD notes as the code below
- does. */
-
- for (insn = basic_block_head[b]; insn != head;
- insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- /* See if the register gets born here. */
- /* We must check for registers being born before we check for
- registers dying. It is possible for a register to be born
- and die in the same insn, e.g. reading from a volatile
- memory location into an otherwise unused register. Such
- a register must be marked as dead after this insn. */
- if (GET_CODE (PATTERN (insn)) == SET
- || GET_CODE (PATTERN (insn)) == CLOBBER)
- sched_note_set (b, PATTERN (insn), 0);
- else if (GET_CODE (PATTERN (insn)) == PARALLEL)
- {
- int j;
- for (j = XVECLEN (PATTERN (insn), 0) - 1; j >= 0; j--)
- if (GET_CODE (XVECEXP (PATTERN (insn), 0, j)) == SET
- || GET_CODE (XVECEXP (PATTERN (insn), 0, j)) == CLOBBER)
- sched_note_set (b, XVECEXP (PATTERN (insn), 0, j), 0);
-
- /* ??? This code is obsolete and should be deleted. It
- is harmless though, so we will leave it in for now. */
- for (j = XVECLEN (PATTERN (insn), 0) - 1; j >= 0; j--)
- if (GET_CODE (XVECEXP (PATTERN (insn), 0, j)) == USE)
- sched_note_set (b, XVECEXP (PATTERN (insn), 0, j), 0);
- }
-
- /* Each call clobbers (makes live) all call-clobbered regs
- that are not global or fixed. Note that the function-value
- reg is a call_clobbered reg. */
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- int j;
- for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
- if (call_used_regs[j] && ! global_regs[j]
- && ! fixed_regs[j])
- {
- register int offset = j / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (j % REGSET_ELT_BITS);
-
- bb_live_regs[offset] |= bit;
- bb_dead_regs[offset] &= ~bit;
- }
- }
-
- for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
- {
- if ((REG_NOTE_KIND (link) == REG_DEAD
- || REG_NOTE_KIND (link) == REG_UNUSED)
- /* Verify that the REG_NOTE has a valid value. */
- && GET_CODE (XEXP (link, 0)) == REG)
- {
- register int regno = REGNO (XEXP (link, 0));
- register int offset = regno / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int j = HARD_REGNO_NREGS (regno,
- GET_MODE (XEXP (link, 0)));
- while (--j >= 0)
- {
- offset = (regno + j) / REGSET_ELT_BITS;
- bit = ((REGSET_ELT_TYPE) 1
- << ((regno + j) % REGSET_ELT_BITS));
-
- bb_live_regs[offset] &= ~bit;
- bb_dead_regs[offset] |= bit;
- }
- }
- else
- {
- bb_live_regs[offset] &= ~bit;
- bb_dead_regs[offset] |= bit;
- }
- }
- }
- }
- }
- }
-
- /* If debugging information is being produced, keep track of the line
- number notes for each insn. */
- if (write_symbols != NO_DEBUG)
- {
- /* We must use the true line number for the first insn in the block
- that was computed and saved at the start of this pass. We can't
- use the current line number, because scheduling of the previous
- block may have changed the current line number. */
- rtx line = line_note_head[b];
-
- for (insn = basic_block_head[b];
- insn != next_tail;
- insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
- line = insn;
- else
- LINE_NOTE (insn) = line;
- }
-
- for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
- {
- rtx prev, next, link;
-
- /* Farm out notes. This is needed to keep the debugger from
- getting completely deranged. */
- if (GET_CODE (insn) == NOTE)
- {
- prev = insn;
- insn = unlink_notes (insn, next_tail);
- if (prev == tail)
- abort ();
- if (prev == head)
- abort ();
- if (insn == next_tail)
- abort ();
- }
-
- if (reload_completed == 0
- && GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- {
- /* See if the register gets born here. */
- /* We must check for registers being born before we check for
- registers dying. It is possible for a register to be born and
- die in the same insn, e.g. reading from a volatile memory
- location into an otherwise unused register. Such a register
- must be marked as dead after this insn. */
- if (GET_CODE (PATTERN (insn)) == SET
- || GET_CODE (PATTERN (insn)) == CLOBBER)
- sched_note_set (b, PATTERN (insn), 0);
- else if (GET_CODE (PATTERN (insn)) == PARALLEL)
- {
- int j;
- for (j = XVECLEN (PATTERN (insn), 0) - 1; j >= 0; j--)
- if (GET_CODE (XVECEXP (PATTERN (insn), 0, j)) == SET
- || GET_CODE (XVECEXP (PATTERN (insn), 0, j)) == CLOBBER)
- sched_note_set (b, XVECEXP (PATTERN (insn), 0, j), 0);
-
- /* ??? This code is obsolete and should be deleted. It
- is harmless though, so we will leave it in for now. */
- for (j = XVECLEN (PATTERN (insn), 0) - 1; j >= 0; j--)
- if (GET_CODE (XVECEXP (PATTERN (insn), 0, j)) == USE)
- sched_note_set (b, XVECEXP (PATTERN (insn), 0, j), 0);
- }
-
- /* Each call clobbers (makes live) all call-clobbered regs that are
- not global or fixed. Note that the function-value reg is a
- call_clobbered reg. */
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- int j;
- for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
- if (call_used_regs[j] && ! global_regs[j]
- && ! fixed_regs[j])
- {
- register int offset = j / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (j % REGSET_ELT_BITS);
-
- bb_live_regs[offset] |= bit;
- bb_dead_regs[offset] &= ~bit;
- }
- }
-
- /* Need to know what registers this insn kills. */
- for (prev = 0, link = REG_NOTES (insn); link; link = next)
- {
- next = XEXP (link, 1);
- if ((REG_NOTE_KIND (link) == REG_DEAD
- || REG_NOTE_KIND (link) == REG_UNUSED)
- /* Verify that the REG_NOTE has a valid value. */
- && GET_CODE (XEXP (link, 0)) == REG)
- {
- register int regno = REGNO (XEXP (link, 0));
- register int offset = regno / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (regno % REGSET_ELT_BITS);
-
- /* Only unlink REG_DEAD notes; leave REG_UNUSED notes
- alone. */
- if (REG_NOTE_KIND (link) == REG_DEAD)
- {
- if (prev)
- XEXP (prev, 1) = next;
- else
- REG_NOTES (insn) = next;
- XEXP (link, 1) = dead_notes;
- dead_notes = link;
- }
- else
- prev = link;
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int j = HARD_REGNO_NREGS (regno,
- GET_MODE (XEXP (link, 0)));
- while (--j >= 0)
- {
- offset = (regno + j) / REGSET_ELT_BITS;
- bit = ((REGSET_ELT_TYPE) 1
- << ((regno + j) % REGSET_ELT_BITS));
-
- bb_live_regs[offset] &= ~bit;
- bb_dead_regs[offset] |= bit;
- }
- }
- else
- {
- bb_live_regs[offset] &= ~bit;
- bb_dead_regs[offset] |= bit;
- }
- }
- else
- prev = link;
- }
- }
- }
-
- if (reload_completed == 0)
- {
- /* Keep track of register lives. */
- old_live_regs = (regset) alloca (regset_bytes);
- regs_sometimes_live
- = (struct sometimes *) alloca (max_regno * sizeof (struct sometimes));
- sometimes_max = 0;
-
- /* Start with registers live at end. */
- for (j = 0; j < regset_size; j++)
- {
- REGSET_ELT_TYPE live = bb_live_regs[j];
- old_live_regs[j] = live;
- if (live)
- {
- register int bit;
- for (bit = 0; bit < REGSET_ELT_BITS; bit++)
- if (live & ((REGSET_ELT_TYPE) 1 << bit))
- sometimes_max = new_sometimes_live (regs_sometimes_live, j,
- bit, sometimes_max);
- }
- }
- }
-
- SCHED_SORT (ready, n_ready, 1);
-
- if (file)
- {
- fprintf (file, ";; ready list initially:\n;; ");
- for (i = 0; i < n_ready; i++)
- fprintf (file, "%d ", INSN_UID (ready[i]));
- fprintf (file, "\n\n");
-
- for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
- if (INSN_PRIORITY (insn) > 0)
- fprintf (file, ";; insn[%4d]: priority = %4d, ref_count = %4d\n",
- INSN_UID (insn), INSN_PRIORITY (insn),
- INSN_REF_COUNT (insn));
- }
-
- /* Now HEAD and TAIL are going to become disconnected
- entirely from the insn chain. */
- tail = 0;
-
- /* Q_SIZE will always be zero here. */
- q_ptr = 0; clock = 0;
- bzero ((char *) insn_queue, sizeof (insn_queue));
-
- /* Now, perform list scheduling. */
-
- /* Where we start inserting insns is after TAIL. */
- last = next_tail;
-
- new_needs = (NEXT_INSN (prev_head) == basic_block_head[b]
- ? NEED_HEAD : NEED_NOTHING);
- if (PREV_INSN (next_tail) == basic_block_end[b])
- new_needs |= NEED_TAIL;
-
- new_ready = n_ready;
- while (sched_n_insns < n_insns)
- {
- q_ptr = NEXT_Q (q_ptr); clock++;
-
- /* Add all pending insns that can be scheduled without stalls to the
- ready list. */
- for (insn = insn_queue[q_ptr]; insn; insn = NEXT_INSN (insn))
- {
- if (file)
- fprintf (file, ";; launching %d before %d with no stalls at T-%d\n",
- INSN_UID (insn), INSN_UID (last), clock);
- ready[new_ready++] = insn;
- q_size -= 1;
- }
- insn_queue[q_ptr] = 0;
-
- /* If there are no ready insns, stall until one is ready and add all
- of the pending insns at that point to the ready list. */
- if (new_ready == 0)
- {
- register int stalls;
-
- for (stalls = 1; stalls < INSN_QUEUE_SIZE; stalls++)
- if (insn = insn_queue[NEXT_Q_AFTER (q_ptr, stalls)])
- {
- for (; insn; insn = NEXT_INSN (insn))
- {
- if (file)
- fprintf (file, ";; launching %d before %d with %d stalls at T-%d\n",
- INSN_UID (insn), INSN_UID (last), stalls, clock);
- ready[new_ready++] = insn;
- q_size -= 1;
- }
- insn_queue[NEXT_Q_AFTER (q_ptr, stalls)] = 0;
- break;
- }
-
- q_ptr = NEXT_Q_AFTER (q_ptr, stalls); clock += stalls;
- }
-
- /* There should be some instructions waiting to fire. */
- if (new_ready == 0)
- abort ();
-
- if (file)
- {
- fprintf (file, ";; ready list at T-%d:", clock);
- for (i = 0; i < new_ready; i++)
- fprintf (file, " %d (%x)",
- INSN_UID (ready[i]), INSN_PRIORITY (ready[i]));
- }
-
- /* Sort the ready list and choose the best insn to schedule. Select
- which insn should issue in this cycle and queue those that are
- blocked by function unit hazards.
-
- N_READY holds the number of items that were scheduled the last time,
- minus the one instruction scheduled on the last loop iteration; it
- is not modified for any other reason in this loop. */
-
- SCHED_SORT (ready, new_ready, n_ready);
- if (MAX_BLOCKAGE > 1)
- {
- new_ready = schedule_select (ready, new_ready, clock, file);
- if (new_ready == 0)
- {
- if (file)
- fprintf (file, "\n");
- /* We must set n_ready here, to ensure that sorting always
- occurs when we come back to the SCHED_SORT line above. */
- n_ready = 0;
- continue;
- }
- }
- n_ready = new_ready;
- last_scheduled_insn = insn = ready[0];
-
- /* The first insn scheduled becomes the new tail. */
- if (tail == 0)
- tail = insn;
-
- if (file)
- {
- fprintf (file, ", now");
- for (i = 0; i < n_ready; i++)
- fprintf (file, " %d", INSN_UID (ready[i]));
- fprintf (file, "\n");
- }
-
- if (DONE_PRIORITY_P (insn))
- abort ();
-
- if (reload_completed == 0)
- {
- /* Process this insn, and each insn linked to this one which must
- be immediately output after this insn. */
- do
- {
- /* First we kill registers set by this insn, and then we
- make registers used by this insn live. This is the opposite
- order used above because we are traversing the instructions
- backwards. */
-
- /* Strictly speaking, we should scan REG_UNUSED notes and make
- every register mentioned there live, however, we will just
- kill them again immediately below, so there doesn't seem to
- be any reason why we bother to do this. */
-
- /* See if this is the last notice we must take of a register. */
- if (GET_CODE (PATTERN (insn)) == SET
- || GET_CODE (PATTERN (insn)) == CLOBBER)
- sched_note_set (b, PATTERN (insn), 1);
- else if (GET_CODE (PATTERN (insn)) == PARALLEL)
- {
- int j;
- for (j = XVECLEN (PATTERN (insn), 0) - 1; j >= 0; j--)
- if (GET_CODE (XVECEXP (PATTERN (insn), 0, j)) == SET
- || GET_CODE (XVECEXP (PATTERN (insn), 0, j)) == CLOBBER)
- sched_note_set (b, XVECEXP (PATTERN (insn), 0, j), 1);
- }
-
- /* This code keeps life analysis information up to date. */
- if (GET_CODE (insn) == CALL_INSN)
- {
- register struct sometimes *p;
-
- /* A call kills all call used registers that are not
- global or fixed, except for those mentioned in the call
- pattern which will be made live again later. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i] && ! global_regs[i]
- && ! fixed_regs[i])
- {
- register int offset = i / REGSET_ELT_BITS;
- register REGSET_ELT_TYPE bit
- = (REGSET_ELT_TYPE) 1 << (i % REGSET_ELT_BITS);
-
- bb_live_regs[offset] &= ~bit;
- bb_dead_regs[offset] |= bit;
- }
-
- /* Regs live at the time of a call instruction must not
- go in a register clobbered by calls. Record this for
- all regs now live. Note that insns which are born or
- die in a call do not cross a call, so this must be done
- after the killings (above) and before the births
- (below). */
- p = regs_sometimes_live;
- for (i = 0; i < sometimes_max; i++, p++)
- if (bb_live_regs[p->offset]
- & ((REGSET_ELT_TYPE) 1 << p->bit))
- p->calls_crossed += 1;
- }
-
- /* Make every register used live, and add REG_DEAD notes for
- registers which were not live before we started. */
- attach_deaths_insn (insn);
-
- /* Find registers now made live by that instruction. */
- for (i = 0; i < regset_size; i++)
- {
- REGSET_ELT_TYPE diff = bb_live_regs[i] & ~old_live_regs[i];
- if (diff)
- {
- register int bit;
- old_live_regs[i] |= diff;
- for (bit = 0; bit < REGSET_ELT_BITS; bit++)
- if (diff & ((REGSET_ELT_TYPE) 1 << bit))
- sometimes_max
- = new_sometimes_live (regs_sometimes_live, i, bit,
- sometimes_max);
- }
- }
-
- /* Count lengths of all regs we are worrying about now,
- and handle registers no longer live. */
-
- for (i = 0; i < sometimes_max; i++)
- {
- register struct sometimes *p = &regs_sometimes_live[i];
- int regno = p->offset*REGSET_ELT_BITS + p->bit;
-
- p->live_length += 1;
-
- if ((bb_live_regs[p->offset]
- & ((REGSET_ELT_TYPE) 1 << p->bit)) == 0)
- {
- /* This is the end of one of this register's lifetime
- segments. Save the lifetime info collected so far,
- and clear its bit in the old_live_regs entry. */
- sched_reg_live_length[regno] += p->live_length;
- sched_reg_n_calls_crossed[regno] += p->calls_crossed;
- old_live_regs[p->offset]
- &= ~((REGSET_ELT_TYPE) 1 << p->bit);
-
- /* Delete the reg_sometimes_live entry for this reg by
- copying the last entry over top of it. */
- *p = regs_sometimes_live[--sometimes_max];
- /* ...and decrement i so that this newly copied entry
- will be processed. */
- i--;
- }
- }
-
- link = insn;
- insn = PREV_INSN (insn);
- }
- while (SCHED_GROUP_P (link));
-
- /* Set INSN back to the insn we are scheduling now. */
- insn = ready[0];
- }
-
- /* Schedule INSN. Remove it from the ready list. */
- ready += 1;
- n_ready -= 1;
-
- sched_n_insns += 1;
- NEXT_INSN (insn) = last;
- PREV_INSN (last) = insn;
-
- /* Everything that precedes INSN now either becomes "ready", if
- it can execute immediately before INSN, or "pending", if
- there must be a delay. Give INSN high enough priority that
- at least one (maybe more) reg-killing insns can be launched
- ahead of all others. Mark INSN as scheduled by changing its
- priority to -1. */
- INSN_PRIORITY (insn) = LAUNCH_PRIORITY;
- new_ready = schedule_insn (insn, ready, n_ready, clock);
- INSN_PRIORITY (insn) = DONE_PRIORITY;
-
- /* Schedule all prior insns that must not be moved. */
- if (SCHED_GROUP_P (insn))
- {
- /* Disable these insns from being launched, in case one of the
- insns in the group has a dependency on an earlier one. */
- link = insn;
- while (SCHED_GROUP_P (link))
- {
- /* Disable these insns from being launched by anybody. */
- link = PREV_INSN (link);
- INSN_REF_COUNT (link) = 0;
- }
-
- /* Now handle each group insn like the main insn was handled
- above. */
- link = insn;
- while (SCHED_GROUP_P (link))
- {
- link = PREV_INSN (link);
-
- sched_n_insns += 1;
-
- /* ??? Why don't we set LAUNCH_PRIORITY here? */
- new_ready = schedule_insn (link, ready, new_ready, clock);
- INSN_PRIORITY (link) = DONE_PRIORITY;
- }
- }
-
- /* Put back NOTE_INSN_SETJMP,
- NOTE_INSN_{LOOP,EHREGION}_{BEGIN,END} notes. */
-
- /* To prime the loop. We need to handle INSN and all the insns in the
- sched group. */
- last = NEXT_INSN (insn);
- do
- {
- insn = PREV_INSN (last);
-
- /* Maintain a valid chain so emit_note_before works.
- This is necessary because PREV_INSN (insn) isn't valid
- (if ! SCHED_GROUP_P) and if it points to an insn already
- scheduled, a circularity will result. */
- if (! SCHED_GROUP_P (insn))
- {
- NEXT_INSN (prev_head) = insn;
- PREV_INSN (insn) = prev_head;
- }
-
- last = reemit_notes (insn, insn);
- }
- while (SCHED_GROUP_P (insn));
- }
- if (q_size != 0)
- abort ();
-
- if (reload_completed == 0)
- finish_sometimes_live (regs_sometimes_live, sometimes_max);
-
- /* HEAD is now the first insn in the chain of insns that
- been scheduled by the loop above.
- TAIL is the last of those insns. */
- head = last;
-
- /* NOTE_LIST is the end of a chain of notes previously found
- among the insns. Insert them at the beginning of the insns. */
- if (note_list != 0)
- {
- rtx note_head = note_list;
- while (PREV_INSN (note_head))
- note_head = PREV_INSN (note_head);
-
- PREV_INSN (head) = note_list;
- NEXT_INSN (note_list) = head;
- head = note_head;
- }
-
- /* There should be no REG_DEAD notes leftover at the end.
- In practice, this can occur as the result of bugs in flow, combine.c,
- and/or sched.c. The values of the REG_DEAD notes remaining are
- meaningless, because dead_notes is just used as a free list. */
-#if 1
- if (dead_notes != 0)
- abort ();
-#endif
-
- if (new_needs & NEED_HEAD)
- basic_block_head[b] = head;
- PREV_INSN (head) = prev_head;
- NEXT_INSN (prev_head) = head;
-
- if (new_needs & NEED_TAIL)
- basic_block_end[b] = tail;
- NEXT_INSN (tail) = next_tail;
- PREV_INSN (next_tail) = tail;
-
- /* Restore the line-number notes of each insn. */
- if (write_symbols != NO_DEBUG)
- {
- rtx line, note, prev, new;
- int notes = 0;
-
- head = basic_block_head[b];
- next_tail = NEXT_INSN (basic_block_end[b]);
-
- /* Determine the current line-number. We want to know the current
- line number of the first insn of the block here, in case it is
- different from the true line number that was saved earlier. If
- different, then we need a line number note before the first insn
- of this block. If it happens to be the same, then we don't want to
- emit another line number note here. */
- for (line = head; line; line = PREV_INSN (line))
- if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
- break;
-
- /* Walk the insns keeping track of the current line-number and inserting
- the line-number notes as needed. */
- for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
- line = insn;
- /* This used to emit line number notes before every non-deleted note.
- However, this confuses a debugger, because line notes not separated
- by real instructions all end up at the same address. I can find no
- use for line number notes before other notes, so none are emitted. */
- else if (GET_CODE (insn) != NOTE
- && (note = LINE_NOTE (insn)) != 0
- && note != line
- && (line == 0
- || NOTE_LINE_NUMBER (note) != NOTE_LINE_NUMBER (line)
- || NOTE_SOURCE_FILE (note) != NOTE_SOURCE_FILE (line)))
- {
- line = note;
- prev = PREV_INSN (insn);
- if (LINE_NOTE (note))
- {
- /* Re-use the original line-number note. */
- LINE_NOTE (note) = 0;
- PREV_INSN (note) = prev;
- NEXT_INSN (prev) = note;
- PREV_INSN (insn) = note;
- NEXT_INSN (note) = insn;
- }
- else
- {
- notes++;
- new = emit_note_after (NOTE_LINE_NUMBER (note), prev);
- NOTE_SOURCE_FILE (new) = NOTE_SOURCE_FILE (note);
- RTX_INTEGRATED_P (new) = RTX_INTEGRATED_P (note);
- }
- }
- if (file && notes)
- fprintf (file, ";; added %d line-number notes\n", notes);
- }
-
- if (file)
- {
- fprintf (file, ";; total time = %d\n;; new basic block head = %d\n;; new basic block end = %d\n\n",
- clock, INSN_UID (basic_block_head[b]), INSN_UID (basic_block_end[b]));
- }
-
- /* Yow! We're done! */
- free_pending_lists ();
-
- return;
-}
-
-/* Subroutine of split_hard_reg_notes. Searches X for any reference to
- REGNO, returning the rtx of the reference found if any. Otherwise,
- returns 0. */
-
-static rtx
-regno_use_in (regno, x)
- int regno;
- rtx x;
-{
- register char *fmt;
- int i, j;
- rtx tem;
-
- if (GET_CODE (x) == REG && REGNO (x) == regno)
- return x;
-
- fmt = GET_RTX_FORMAT (GET_CODE (x));
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- if (tem = regno_use_in (regno, XEXP (x, i)))
- return tem;
- }
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- if (tem = regno_use_in (regno , XVECEXP (x, i, j)))
- return tem;
- }
-
- return 0;
-}
-
-/* Subroutine of update_flow_info. Determines whether any new REG_NOTEs are
- needed for the hard register mentioned in the note. This can happen
- if the reference to the hard register in the original insn was split into
- several smaller hard register references in the split insns. */
-
-static void
-split_hard_reg_notes (note, first, last, orig_insn)
- rtx note, first, last, orig_insn;
-{
- rtx reg, temp, link;
- int n_regs, i, new_reg;
- rtx insn;
-
- /* Assume that this is a REG_DEAD note. */
- if (REG_NOTE_KIND (note) != REG_DEAD)
- abort ();
-
- reg = XEXP (note, 0);
-
- n_regs = HARD_REGNO_NREGS (REGNO (reg), GET_MODE (reg));
-
- for (i = 0; i < n_regs; i++)
- {
- new_reg = REGNO (reg) + i;
-
- /* Check for references to new_reg in the split insns. */
- for (insn = last; ; insn = PREV_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && (temp = regno_use_in (new_reg, PATTERN (insn))))
- {
- /* Create a new reg dead note here. */
- link = rtx_alloc (EXPR_LIST);
- PUT_REG_NOTE_KIND (link, REG_DEAD);
- XEXP (link, 0) = temp;
- XEXP (link, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = link;
-
- /* If killed multiple registers here, then add in the excess. */
- i += HARD_REGNO_NREGS (REGNO (temp), GET_MODE (temp)) - 1;
-
- break;
- }
- /* It isn't mentioned anywhere, so no new reg note is needed for
- this register. */
- if (insn == first)
- break;
- }
- }
-}
-
-/* Subroutine of update_flow_info. Determines whether a SET or CLOBBER in an
- insn created by splitting needs a REG_DEAD or REG_UNUSED note added. */
-
-static void
-new_insn_dead_notes (pat, insn, last, orig_insn)
- rtx pat, insn, last, orig_insn;
-{
- rtx dest, tem, set;
-
- /* PAT is either a CLOBBER or a SET here. */
- dest = XEXP (pat, 0);
-
- while (GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == SIGN_EXTRACT)
- dest = XEXP (dest, 0);
-
- if (GET_CODE (dest) == REG)
- {
- for (tem = last; tem != insn; tem = PREV_INSN (tem))
- {
- if (GET_RTX_CLASS (GET_CODE (tem)) == 'i'
- && reg_overlap_mentioned_p (dest, PATTERN (tem))
- && (set = single_set (tem)))
- {
- rtx tem_dest = SET_DEST (set);
-
- while (GET_CODE (tem_dest) == ZERO_EXTRACT
- || GET_CODE (tem_dest) == SUBREG
- || GET_CODE (tem_dest) == STRICT_LOW_PART
- || GET_CODE (tem_dest) == SIGN_EXTRACT)
- tem_dest = XEXP (tem_dest, 0);
-
- if (! rtx_equal_p (tem_dest, dest))
- {
- /* Use the same scheme as combine.c, don't put both REG_DEAD
- and REG_UNUSED notes on the same insn. */
- if (! find_regno_note (tem, REG_UNUSED, REGNO (dest))
- && ! find_regno_note (tem, REG_DEAD, REGNO (dest)))
- {
- rtx note = rtx_alloc (EXPR_LIST);
- PUT_REG_NOTE_KIND (note, REG_DEAD);
- XEXP (note, 0) = dest;
- XEXP (note, 1) = REG_NOTES (tem);
- REG_NOTES (tem) = note;
- }
- /* The reg only dies in one insn, the last one that uses
- it. */
- break;
- }
- else if (reg_overlap_mentioned_p (dest, SET_SRC (set)))
- /* We found an instruction that both uses the register,
- and sets it, so no new REG_NOTE is needed for this set. */
- break;
- }
- }
- /* If this is a set, it must die somewhere, unless it is the dest of
- the original insn, and hence is live after the original insn. Abort
- if it isn't supposed to be live after the original insn.
-
- If this is a clobber, then just add a REG_UNUSED note. */
- if (tem == insn)
- {
- int live_after_orig_insn = 0;
- rtx pattern = PATTERN (orig_insn);
- int i;
-
- if (GET_CODE (pat) == CLOBBER)
- {
- rtx note = rtx_alloc (EXPR_LIST);
- PUT_REG_NOTE_KIND (note, REG_UNUSED);
- XEXP (note, 0) = dest;
- XEXP (note, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = note;
- return;
- }
-
- /* The original insn could have multiple sets, so search the
- insn for all sets. */
- if (GET_CODE (pattern) == SET)
- {
- if (reg_overlap_mentioned_p (dest, SET_DEST (pattern)))
- live_after_orig_insn = 1;
- }
- else if (GET_CODE (pattern) == PARALLEL)
- {
- for (i = 0; i < XVECLEN (pattern, 0); i++)
- if (GET_CODE (XVECEXP (pattern, 0, i)) == SET
- && reg_overlap_mentioned_p (dest,
- SET_DEST (XVECEXP (pattern,
- 0, i))))
- live_after_orig_insn = 1;
- }
-
- if (! live_after_orig_insn)
- abort ();
- }
- }
-}
-
-/* Subroutine of update_flow_info. Update the value of reg_n_sets for all
- registers modified by X. INC is -1 if the containing insn is being deleted,
- and is 1 if the containing insn is a newly generated insn. */
-
-static void
-update_n_sets (x, inc)
- rtx x;
- int inc;
-{
- rtx dest = SET_DEST (x);
-
- while (GET_CODE (dest) == STRICT_LOW_PART || GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == SIGN_EXTRACT)
- dest = SUBREG_REG (dest);
-
- if (GET_CODE (dest) == REG)
- {
- int regno = REGNO (dest);
-
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- register int i;
- int endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (dest));
-
- for (i = regno; i < endregno; i++)
- reg_n_sets[i] += inc;
- }
- else
- reg_n_sets[regno] += inc;
- }
-}
-
-/* Updates all flow-analysis related quantities (including REG_NOTES) for
- the insns from FIRST to LAST inclusive that were created by splitting
- ORIG_INSN. NOTES are the original REG_NOTES. */
-
-static void
-update_flow_info (notes, first, last, orig_insn)
- rtx notes;
- rtx first, last;
- rtx orig_insn;
-{
- rtx insn, note;
- rtx next;
- rtx orig_dest, temp;
- rtx set;
-
- /* Get and save the destination set by the original insn. */
-
- orig_dest = single_set (orig_insn);
- if (orig_dest)
- orig_dest = SET_DEST (orig_dest);
-
- /* Move REG_NOTES from the original insn to where they now belong. */
-
- for (note = notes; note; note = next)
- {
- next = XEXP (note, 1);
- switch (REG_NOTE_KIND (note))
- {
- case REG_DEAD:
- case REG_UNUSED:
- /* Move these notes from the original insn to the last new insn where
- the register is now set. */
-
- for (insn = last; ; insn = PREV_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_mentioned_p (XEXP (note, 0), PATTERN (insn)))
- {
- /* If this note refers to a multiple word hard register, it
- may have been split into several smaller hard register
- references, so handle it specially. */
- temp = XEXP (note, 0);
- if (REG_NOTE_KIND (note) == REG_DEAD
- && GET_CODE (temp) == REG
- && REGNO (temp) < FIRST_PSEUDO_REGISTER
- && HARD_REGNO_NREGS (REGNO (temp), GET_MODE (temp)) > 1)
- split_hard_reg_notes (note, first, last, orig_insn);
- else
- {
- XEXP (note, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = note;
- }
-
- /* Sometimes need to convert REG_UNUSED notes to REG_DEAD
- notes. */
- /* ??? This won't handle multiple word registers correctly,
- but should be good enough for now. */
- if (REG_NOTE_KIND (note) == REG_UNUSED
- && ! dead_or_set_p (insn, XEXP (note, 0)))
- PUT_REG_NOTE_KIND (note, REG_DEAD);
-
- /* The reg only dies in one insn, the last one that uses
- it. */
- break;
- }
- /* It must die somewhere, fail it we couldn't find where it died.
-
- If this is a REG_UNUSED note, then it must be a temporary
- register that was not needed by this instantiation of the
- pattern, so we can safely ignore it. */
- if (insn == first)
- {
- /* After reload, REG_DEAD notes come sometimes an
- instruction after the register actually dies. */
- if (reload_completed && REG_NOTE_KIND (note) == REG_DEAD)
- {
- XEXP (note, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = note;
- break;
- }
-
- if (REG_NOTE_KIND (note) != REG_UNUSED)
- abort ();
-
- break;
- }
- }
- break;
-
- case REG_WAS_0:
- /* This note applies to the dest of the original insn. Find the
- first new insn that now has the same dest, and move the note
- there. */
-
- if (! orig_dest)
- abort ();
-
- for (insn = first; ; insn = NEXT_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && (temp = single_set (insn))
- && rtx_equal_p (SET_DEST (temp), orig_dest))
- {
- XEXP (note, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = note;
- /* The reg is only zero before one insn, the first that
- uses it. */
- break;
- }
- /* If this note refers to a multiple word hard
- register, it may have been split into several smaller
- hard register references. We could split the notes,
- but simply dropping them is good enough. */
- if (GET_CODE (orig_dest) == REG
- && REGNO (orig_dest) < FIRST_PSEUDO_REGISTER
- && HARD_REGNO_NREGS (REGNO (orig_dest),
- GET_MODE (orig_dest)) > 1)
- break;
- /* It must be set somewhere, fail if we couldn't find where it
- was set. */
- if (insn == last)
- abort ();
- }
- break;
-
- case REG_EQUAL:
- case REG_EQUIV:
- /* A REG_EQUIV or REG_EQUAL note on an insn with more than one
- set is meaningless. Just drop the note. */
- if (! orig_dest)
- break;
-
- case REG_NO_CONFLICT:
- /* These notes apply to the dest of the original insn. Find the last
- new insn that now has the same dest, and move the note there. */
-
- if (! orig_dest)
- abort ();
-
- for (insn = last; ; insn = PREV_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && (temp = single_set (insn))
- && rtx_equal_p (SET_DEST (temp), orig_dest))
- {
- XEXP (note, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = note;
- /* Only put this note on one of the new insns. */
- break;
- }
-
- /* The original dest must still be set someplace. Abort if we
- couldn't find it. */
- if (insn == first)
- {
- /* However, if this note refers to a multiple word hard
- register, it may have been split into several smaller
- hard register references. We could split the notes,
- but simply dropping them is good enough. */
- if (GET_CODE (orig_dest) == REG
- && REGNO (orig_dest) < FIRST_PSEUDO_REGISTER
- && HARD_REGNO_NREGS (REGNO (orig_dest),
- GET_MODE (orig_dest)) > 1)
- break;
- /* Likewise for multi-word memory references. */
- if (GET_CODE (orig_dest) == MEM
- && SIZE_FOR_MODE (orig_dest) > MOVE_MAX)
- break;
- abort ();
- }
- }
- break;
-
- case REG_LIBCALL:
- /* Move a REG_LIBCALL note to the first insn created, and update
- the corresponding REG_RETVAL note. */
- XEXP (note, 1) = REG_NOTES (first);
- REG_NOTES (first) = note;
-
- insn = XEXP (note, 0);
- note = find_reg_note (insn, REG_RETVAL, NULL_RTX);
- if (note)
- XEXP (note, 0) = first;
- break;
-
- case REG_EXEC_COUNT:
- /* Move a REG_EXEC_COUNT note to the first insn created. */
- XEXP (note, 1) = REG_NOTES (first);
- REG_NOTES (first) = note;
- break;
-
- case REG_RETVAL:
- /* Move a REG_RETVAL note to the last insn created, and update
- the corresponding REG_LIBCALL note. */
- XEXP (note, 1) = REG_NOTES (last);
- REG_NOTES (last) = note;
-
- insn = XEXP (note, 0);
- note = find_reg_note (insn, REG_LIBCALL, NULL_RTX);
- if (note)
- XEXP (note, 0) = last;
- break;
-
- case REG_NONNEG:
- case REG_BR_PROB:
- /* This should be moved to whichever instruction is a JUMP_INSN. */
-
- for (insn = last; ; insn = PREV_INSN (insn))
- {
- if (GET_CODE (insn) == JUMP_INSN)
- {
- XEXP (note, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = note;
- /* Only put this note on one of the new insns. */
- break;
- }
- /* Fail if we couldn't find a JUMP_INSN. */
- if (insn == first)
- abort ();
- }
- break;
-
- case REG_INC:
- /* reload sometimes leaves obsolete REG_INC notes around. */
- if (reload_completed)
- break;
- /* This should be moved to whichever instruction now has the
- increment operation. */
- abort ();
-
- case REG_LABEL:
- /* Should be moved to the new insn(s) which use the label. */
- for (insn = first; insn != NEXT_INSN (last); insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_mentioned_p (XEXP (note, 0), PATTERN (insn)))
- REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_LABEL,
- XEXP (note, 0), REG_NOTES (insn));
- break;
-
- case REG_CC_SETTER:
- case REG_CC_USER:
- /* These two notes will never appear until after reorg, so we don't
- have to handle them here. */
- default:
- abort ();
- }
- }
-
- /* Each new insn created, except the last, has a new set. If the destination
- is a register, then this reg is now live across several insns, whereas
- previously the dest reg was born and died within the same insn. To
- reflect this, we now need a REG_DEAD note on the insn where this
- dest reg dies.
-
- Similarly, the new insns may have clobbers that need REG_UNUSED notes. */
-
- for (insn = first; insn != last; insn = NEXT_INSN (insn))
- {
- rtx pat;
- int i;
-
- pat = PATTERN (insn);
- if (GET_CODE (pat) == SET || GET_CODE (pat) == CLOBBER)
- new_insn_dead_notes (pat, insn, last, orig_insn);
- else if (GET_CODE (pat) == PARALLEL)
- {
- for (i = 0; i < XVECLEN (pat, 0); i++)
- if (GET_CODE (XVECEXP (pat, 0, i)) == SET
- || GET_CODE (XVECEXP (pat, 0, i)) == CLOBBER)
- new_insn_dead_notes (XVECEXP (pat, 0, i), insn, last, orig_insn);
- }
- }
-
- /* If any insn, except the last, uses the register set by the last insn,
- then we need a new REG_DEAD note on that insn. In this case, there
- would not have been a REG_DEAD note for this register in the original
- insn because it was used and set within one insn.
-
- There is no new REG_DEAD note needed if the last insn uses the register
- that it is setting. */
-
- set = single_set (last);
- if (set)
- {
- rtx dest = SET_DEST (set);
-
- while (GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == SUBREG
- || GET_CODE (dest) == STRICT_LOW_PART
- || GET_CODE (dest) == SIGN_EXTRACT)
- dest = XEXP (dest, 0);
-
- if (GET_CODE (dest) == REG
- /* Global registers are always live, so the code below does not
- apply to them. */
- && (REGNO (dest) >= FIRST_PSEUDO_REGISTER
- || ! global_regs[REGNO (dest)])
- && ! reg_overlap_mentioned_p (dest, SET_SRC (set)))
- {
- for (insn = PREV_INSN (last); ; insn = PREV_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_mentioned_p (dest, PATTERN (insn))
- && (set = single_set (insn)))
- {
- rtx insn_dest = SET_DEST (set);
-
- while (GET_CODE (insn_dest) == ZERO_EXTRACT
- || GET_CODE (insn_dest) == SUBREG
- || GET_CODE (insn_dest) == STRICT_LOW_PART
- || GET_CODE (insn_dest) == SIGN_EXTRACT)
- insn_dest = XEXP (insn_dest, 0);
-
- if (insn_dest != dest)
- {
- note = rtx_alloc (EXPR_LIST);
- PUT_REG_NOTE_KIND (note, REG_DEAD);
- XEXP (note, 0) = dest;
- XEXP (note, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = note;
- /* The reg only dies in one insn, the last one
- that uses it. */
- break;
- }
- }
- if (insn == first)
- break;
- }
- }
- }
-
- /* If the original dest is modifying a multiple register target, and the
- original instruction was split such that the original dest is now set
- by two or more SUBREG sets, then the split insns no longer kill the
- destination of the original insn.
-
- In this case, if there exists an instruction in the same basic block,
- before the split insn, which uses the original dest, and this use is
- killed by the original insn, then we must remove the REG_DEAD note on
- this insn, because it is now superfluous.
-
- This does not apply when a hard register gets split, because the code
- knows how to handle overlapping hard registers properly. */
- if (orig_dest && GET_CODE (orig_dest) == REG)
- {
- int found_orig_dest = 0;
- int found_split_dest = 0;
-
- for (insn = first; ; insn = NEXT_INSN (insn))
- {
- set = single_set (insn);
- if (set)
- {
- if (GET_CODE (SET_DEST (set)) == REG
- && REGNO (SET_DEST (set)) == REGNO (orig_dest))
- {
- found_orig_dest = 1;
- break;
- }
- else if (GET_CODE (SET_DEST (set)) == SUBREG
- && SUBREG_REG (SET_DEST (set)) == orig_dest)
- {
- found_split_dest = 1;
- break;
- }
- }
-
- if (insn == last)
- break;
- }
-
- if (found_split_dest)
- {
- /* Search backwards from FIRST, looking for the first insn that uses
- the original dest. Stop if we pass a CODE_LABEL or a JUMP_INSN.
- If we find an insn, and it has a REG_DEAD note, then delete the
- note. */
-
- for (insn = first; insn; insn = PREV_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL
- || GET_CODE (insn) == JUMP_INSN)
- break;
- else if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_mentioned_p (orig_dest, insn))
- {
- note = find_regno_note (insn, REG_DEAD, REGNO (orig_dest));
- if (note)
- remove_note (insn, note);
- }
- }
- }
- else if (! found_orig_dest)
- {
- /* This should never happen. */
- abort ();
- }
- }
-
- /* Update reg_n_sets. This is necessary to prevent local alloc from
- converting REG_EQUAL notes to REG_EQUIV when splitting has modified
- a reg from set once to set multiple times. */
-
- {
- rtx x = PATTERN (orig_insn);
- RTX_CODE code = GET_CODE (x);
-
- if (code == SET || code == CLOBBER)
- update_n_sets (x, -1);
- else if (code == PARALLEL)
- {
- int i;
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- {
- code = GET_CODE (XVECEXP (x, 0, i));
- if (code == SET || code == CLOBBER)
- update_n_sets (XVECEXP (x, 0, i), -1);
- }
- }
-
- for (insn = first; ; insn = NEXT_INSN (insn))
- {
- x = PATTERN (insn);
- code = GET_CODE (x);
-
- if (code == SET || code == CLOBBER)
- update_n_sets (x, 1);
- else if (code == PARALLEL)
- {
- int i;
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- {
- code = GET_CODE (XVECEXP (x, 0, i));
- if (code == SET || code == CLOBBER)
- update_n_sets (XVECEXP (x, 0, i), 1);
- }
- }
-
- if (insn == last)
- break;
- }
- }
-}
-
-/* The one entry point in this file. DUMP_FILE is the dump file for
- this pass. */
-
-void
-schedule_insns (dump_file)
- FILE *dump_file;
-{
- int max_uid = MAX_INSNS_PER_SPLIT * (get_max_uid () + 1);
- int b;
- rtx insn;
-
- /* Taking care of this degenerate case makes the rest of
- this code simpler. */
- if (n_basic_blocks == 0)
- return;
-
- /* Create an insn here so that we can hang dependencies off of it later. */
- sched_before_next_call
- = gen_rtx (INSN, VOIDmode, 0, NULL_RTX, NULL_RTX,
- NULL_RTX, 0, NULL_RTX, 0);
-
- /* Initialize the unused_*_lists. We can't use the ones left over from
- the previous function, because gcc has freed that memory. We can use
- the ones left over from the first sched pass in the second pass however,
- so only clear them on the first sched pass. The first pass is before
- reload if flag_schedule_insns is set, otherwise it is afterwards. */
-
- if (reload_completed == 0 || ! flag_schedule_insns)
- {
- unused_insn_list = 0;
- unused_expr_list = 0;
- }
-
- /* We create no insns here, only reorder them, so we
- remember how far we can cut back the stack on exit. */
-
- /* Allocate data for this pass. See comments, above,
- for what these vectors do. */
- insn_luid = (int *) alloca (max_uid * sizeof (int));
- insn_priority = (int *) alloca (max_uid * sizeof (int));
- insn_tick = (int *) alloca (max_uid * sizeof (int));
- insn_costs = (short *) alloca (max_uid * sizeof (short));
- insn_units = (short *) alloca (max_uid * sizeof (short));
- insn_blockage = (unsigned int *) alloca (max_uid * sizeof (unsigned int));
- insn_ref_count = (int *) alloca (max_uid * sizeof (int));
-
- if (reload_completed == 0)
- {
- sched_reg_n_deaths = (short *) alloca (max_regno * sizeof (short));
- sched_reg_n_calls_crossed = (int *) alloca (max_regno * sizeof (int));
- sched_reg_live_length = (int *) alloca (max_regno * sizeof (int));
- bb_dead_regs = (regset) alloca (regset_bytes);
- bb_live_regs = (regset) alloca (regset_bytes);
- bzero ((char *) sched_reg_n_calls_crossed, max_regno * sizeof (int));
- bzero ((char *) sched_reg_live_length, max_regno * sizeof (int));
- bcopy ((char *) reg_n_deaths, (char *) sched_reg_n_deaths,
- max_regno * sizeof (short));
- init_alias_analysis ();
- }
- else
- {
- sched_reg_n_deaths = 0;
- sched_reg_n_calls_crossed = 0;
- sched_reg_live_length = 0;
- bb_dead_regs = 0;
- bb_live_regs = 0;
- if (! flag_schedule_insns)
- init_alias_analysis ();
- }
-
- if (write_symbols != NO_DEBUG)
- {
- rtx line;
-
- line_note = (rtx *) alloca (max_uid * sizeof (rtx));
- bzero ((char *) line_note, max_uid * sizeof (rtx));
- line_note_head = (rtx *) alloca (n_basic_blocks * sizeof (rtx));
- bzero ((char *) line_note_head, n_basic_blocks * sizeof (rtx));
-
- /* Determine the line-number at the start of each basic block.
- This must be computed and saved now, because after a basic block's
- predecessor has been scheduled, it is impossible to accurately
- determine the correct line number for the first insn of the block. */
-
- for (b = 0; b < n_basic_blocks; b++)
- for (line = basic_block_head[b]; line; line = PREV_INSN (line))
- if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
- {
- line_note_head[b] = line;
- break;
- }
- }
-
- bzero ((char *) insn_luid, max_uid * sizeof (int));
- bzero ((char *) insn_priority, max_uid * sizeof (int));
- bzero ((char *) insn_tick, max_uid * sizeof (int));
- bzero ((char *) insn_costs, max_uid * sizeof (short));
- bzero ((char *) insn_units, max_uid * sizeof (short));
- bzero ((char *) insn_blockage, max_uid * sizeof (unsigned int));
- bzero ((char *) insn_ref_count, max_uid * sizeof (int));
-
- /* Schedule each basic block, block by block. */
-
- /* ??? Add a NOTE after the last insn of the last basic block. It is not
- known why this is done. */
- /* ??? Perhaps it's done to ensure NEXT_TAIL in schedule_block is a
- valid insn. */
-
- insn = basic_block_end[n_basic_blocks-1];
- if (NEXT_INSN (insn) == 0
- || (GET_CODE (insn) != NOTE
- && GET_CODE (insn) != CODE_LABEL
- /* Don't emit a NOTE if it would end up between an unconditional
- jump and a BARRIER. */
- && ! (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (NEXT_INSN (insn)) == BARRIER)))
- emit_note_after (NOTE_INSN_DELETED, basic_block_end[n_basic_blocks-1]);
-
- for (b = 0; b < n_basic_blocks; b++)
- {
- rtx insn, next;
-
- note_list = 0;
-
- for (insn = basic_block_head[b]; ; insn = next)
- {
- rtx prev;
- rtx set;
-
- /* Can't use `next_real_insn' because that
- might go across CODE_LABELS and short-out basic blocks. */
- next = NEXT_INSN (insn);
- if (GET_CODE (insn) != INSN)
- {
- if (insn == basic_block_end[b])
- break;
-
- continue;
- }
-
- /* Don't split no-op move insns. These should silently disappear
- later in final. Splitting such insns would break the code
- that handles REG_NO_CONFLICT blocks. */
- set = single_set (insn);
- if (set && rtx_equal_p (SET_SRC (set), SET_DEST (set)))
- {
- if (insn == basic_block_end[b])
- break;
-
- /* Nops get in the way while scheduling, so delete them now if
- register allocation has already been done. It is too risky
- to try to do this before register allocation, and there are
- unlikely to be very many nops then anyways. */
- if (reload_completed)
- {
- PUT_CODE (insn, NOTE);
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- NOTE_SOURCE_FILE (insn) = 0;
- }
-
- continue;
- }
-
- /* Split insns here to get max fine-grain parallelism. */
- prev = PREV_INSN (insn);
- /* It is probably not worthwhile to try to split again in the
- second pass. However, if flag_schedule_insns is not set,
- the first and only (if any) scheduling pass is after reload. */
- if (reload_completed == 0 || ! flag_schedule_insns)
- {
- rtx last, first = PREV_INSN (insn);
- rtx notes = REG_NOTES (insn);
-
- last = try_split (PATTERN (insn), insn, 1);
- if (last != insn)
- {
- /* try_split returns the NOTE that INSN became. */
- first = NEXT_INSN (first);
- update_flow_info (notes, first, last, insn);
-
- PUT_CODE (insn, NOTE);
- NOTE_SOURCE_FILE (insn) = 0;
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- if (insn == basic_block_head[b])
- basic_block_head[b] = first;
- if (insn == basic_block_end[b])
- {
- basic_block_end[b] = last;
- break;
- }
- }
- }
-
- if (insn == basic_block_end[b])
- break;
- }
-
- schedule_block (b, dump_file);
-
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
- }
-
- /* Reposition the prologue and epilogue notes in case we moved the
- prologue/epilogue insns. */
- if (reload_completed)
- reposition_prologue_and_epilogue_notes (get_insns ());
-
- if (write_symbols != NO_DEBUG)
- {
- rtx line = 0;
- rtx insn = get_insns ();
- int active_insn = 0;
- int notes = 0;
-
- /* Walk the insns deleting redundant line-number notes. Many of these
- are already present. The remainder tend to occur at basic
- block boundaries. */
- for (insn = get_last_insn (); insn; insn = PREV_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
- {
- /* If there are no active insns following, INSN is redundant. */
- if (active_insn == 0)
- {
- notes++;
- NOTE_SOURCE_FILE (insn) = 0;
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- }
- /* If the line number is unchanged, LINE is redundant. */
- else if (line
- && NOTE_LINE_NUMBER (line) == NOTE_LINE_NUMBER (insn)
- && NOTE_SOURCE_FILE (line) == NOTE_SOURCE_FILE (insn))
- {
- notes++;
- NOTE_SOURCE_FILE (line) = 0;
- NOTE_LINE_NUMBER (line) = NOTE_INSN_DELETED;
- line = insn;
- }
- else
- line = insn;
- active_insn = 0;
- }
- else if (! ((GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
- || (GET_CODE (insn) == INSN
- && (GET_CODE (PATTERN (insn)) == USE
- || GET_CODE (PATTERN (insn)) == CLOBBER))))
- active_insn++;
-
- if (dump_file && notes)
- fprintf (dump_file, ";; deleted %d line-number notes\n", notes);
- }
-
- if (reload_completed == 0)
- {
- int regno;
- for (regno = 0; regno < max_regno; regno++)
- if (sched_reg_live_length[regno])
- {
- if (dump_file)
- {
- if (reg_live_length[regno] > sched_reg_live_length[regno])
- fprintf (dump_file,
- ";; register %d life shortened from %d to %d\n",
- regno, reg_live_length[regno],
- sched_reg_live_length[regno]);
- /* Negative values are special; don't overwrite the current
- reg_live_length value if it is negative. */
- else if (reg_live_length[regno] < sched_reg_live_length[regno]
- && reg_live_length[regno] >= 0)
- fprintf (dump_file,
- ";; register %d life extended from %d to %d\n",
- regno, reg_live_length[regno],
- sched_reg_live_length[regno]);
-
- if (! reg_n_calls_crossed[regno]
- && sched_reg_n_calls_crossed[regno])
- fprintf (dump_file,
- ";; register %d now crosses calls\n", regno);
- else if (reg_n_calls_crossed[regno]
- && ! sched_reg_n_calls_crossed[regno]
- && reg_basic_block[regno] != REG_BLOCK_GLOBAL)
- fprintf (dump_file,
- ";; register %d no longer crosses calls\n", regno);
-
- }
- /* Negative values are special; don't overwrite the current
- reg_live_length value if it is negative. */
- if (reg_live_length[regno] >= 0)
- reg_live_length[regno] = sched_reg_live_length[regno];
-
- /* We can't change the value of reg_n_calls_crossed to zero for
- pseudos which are live in more than one block.
-
- This is because combine might have made an optimization which
- invalidated basic_block_live_at_start and reg_n_calls_crossed,
- but it does not update them. If we update reg_n_calls_crossed
- here, the two variables are now inconsistent, and this might
- confuse the caller-save code into saving a register that doesn't
- need to be saved. This is only a problem when we zero calls
- crossed for a pseudo live in multiple basic blocks.
-
- Alternatively, we could try to correctly update basic block live
- at start here in sched, but that seems complicated. */
- if (sched_reg_n_calls_crossed[regno]
- || reg_basic_block[regno] != REG_BLOCK_GLOBAL)
- reg_n_calls_crossed[regno] = sched_reg_n_calls_crossed[regno];
- }
- }
-}
-#endif /* INSN_SCHEDULING */
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
deleted file mode 100644
index 12924c02862..00000000000
--- a/gcc/sdbout.c
+++ /dev/null
@@ -1,1628 +0,0 @@
-/* Output sdb-format symbol table information from GNU compiler.
- Copyright (C) 1988, 92, 93, 94, 95, 96, 1997 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. */
-
-/* mike@tredysvr.Tredydev.Unisys.COM says:
-I modified the struct.c example and have a nm of a .o resulting from the
-AT&T C compiler. From the example below I would conclude the following:
-
-1. All .defs from structures are emitted as scanned. The example below
- clearly shows the symbol table entries for BoxRec2 are after the first
- function.
-
-2. All functions and their locals (including statics) are emitted as scanned.
-
-3. All nested unnamed union and structure .defs must be emitted before
- the structure in which they are nested. The AT&T assembler is a
- one pass beast as far as symbolics are concerned.
-
-4. All structure .defs are emitted before the typedefs that refer to them.
-
-5. All top level static and external variable definitions are moved to the
- end of file with all top level statics occurring first before externs.
-
-6. All undefined references are at the end of the file.
-*/
-
-#include "config.h"
-
-#ifdef SDB_DEBUGGING_INFO
-
-#include "tree.h"
-#include "rtl.h"
-#include <stdio.h>
-#include "regs.h"
-#include "defaults.h"
-#include "flags.h"
-#include "insn-config.h"
-#include "reload.h"
-
-/* Mips systems use the SDB functions to dump out symbols, but do not
- supply usable syms.h include files. Which syms.h file to use is a
- target parameter so don't use the native one if we're cross compiling. */
-
-#if defined(USG) && !defined(MIPS) && !defined (hpux) && !defined(_WIN32) && !defined(__linux__) && !defined(CROSS_COMPILE)
-#include <syms.h>
-/* Use T_INT if we don't have T_VOID. */
-#ifndef T_VOID
-#define T_VOID T_INT
-#endif
-#else
-#include "gsyms.h"
-#endif
-
-/* #include <storclass.h> used to be this instead of syms.h. */
-
-/* 1 if PARM is passed to this function in memory. */
-
-#define PARM_PASSED_IN_MEMORY(PARM) \
- (GET_CODE (DECL_INCOMING_RTL (PARM)) == MEM)
-
-/* A C expression for the integer offset value of an automatic variable
- (C_AUTO) having address X (an RTX). */
-#ifndef DEBUGGER_AUTO_OFFSET
-#define DEBUGGER_AUTO_OFFSET(X) \
- (GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0)
-#endif
-
-/* A C expression for the integer offset value of an argument (C_ARG)
- having address X (an RTX). The nominal offset is OFFSET. */
-#ifndef DEBUGGER_ARG_OFFSET
-#define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET)
-#endif
-
-/* Line number of beginning of current function, minus one.
- Negative means not in a function or not using sdb. */
-
-int sdb_begin_function_line = -1;
-
-/* Counter to generate unique "names" for nameless struct members. */
-
-static int unnamed_struct_number = 0;
-
-extern FILE *asm_out_file;
-
-extern tree current_function_decl;
-
-void sdbout_init ();
-void sdbout_symbol ();
-void sdbout_types();
-
-static char *gen_fake_label PROTO((void));
-static int plain_type PROTO((tree));
-static int template_name_p PROTO((tree));
-static void sdbout_record_type_name PROTO((tree));
-static int plain_type_1 PROTO((tree, int));
-static void sdbout_block PROTO((tree));
-static void sdbout_syms PROTO((tree));
-static void sdbout_queue_anonymous_type PROTO((tree));
-static void sdbout_dequeue_anonymous_types PROTO((void));
-static void sdbout_type PROTO((tree));
-static void sbdout_field_types PROTO((tree));
-static void sdbout_one_type PROTO((tree));
-static void sdbout_parms PROTO((tree));
-static void sdbout_reg_parms PROTO((tree));
-
-/* Define the default sizes for various types. */
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-/* Random macros describing parts of SDB data. */
-
-/* Put something here if lines get too long */
-#define CONTIN
-
-/* Default value of delimiter is ";". */
-#ifndef SDB_DELIM
-#define SDB_DELIM ";"
-#endif
-
-/* Maximum number of dimensions the assembler will allow. */
-#ifndef SDB_MAX_DIM
-#define SDB_MAX_DIM 4
-#endif
-
-#ifndef PUT_SDB_SCL
-#define PUT_SDB_SCL(a) fprintf(asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_INT_VAL
-#define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\t.val\t%d%s", (a), SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_VAL
-#define PUT_SDB_VAL(a) \
-( fputs ("\t.val\t", asm_out_file), \
- output_addr_const (asm_out_file, (a)), \
- fprintf (asm_out_file, SDB_DELIM))
-#endif
-
-#ifndef PUT_SDB_DEF
-#define PUT_SDB_DEF(a) \
-do { fprintf (asm_out_file, "\t.def\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, SDB_DELIM); } while (0)
-#endif
-
-#ifndef PUT_SDB_PLAIN_DEF
-#define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\t.def\t.%s%s",a, SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_ENDEF
-#define PUT_SDB_ENDEF fputs("\t.endef\n", asm_out_file)
-#endif
-
-#ifndef PUT_SDB_TYPE
-#define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_SIZE
-#define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\t.size\t%d%s", a, SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_START_DIM
-#define PUT_SDB_START_DIM fprintf(asm_out_file, "\t.dim\t")
-#endif
-
-#ifndef PUT_SDB_NEXT_DIM
-#define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
-#endif
-
-#ifndef PUT_SDB_LAST_DIM
-#define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d%s", a, SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_TAG
-#define PUT_SDB_TAG(a) \
-do { fprintf (asm_out_file, "\t.tag\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, a); \
- fprintf (asm_out_file, SDB_DELIM); } while (0)
-#endif
-
-#ifndef PUT_SDB_BLOCK_START
-#define PUT_SDB_BLOCK_START(LINE) \
- fprintf (asm_out_file, \
- "\t.def\t.bb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_BLOCK_END
-#define PUT_SDB_BLOCK_END(LINE) \
- fprintf (asm_out_file, \
- "\t.def\t.eb%s\t.val\t.%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_FUNCTION_START
-#define PUT_SDB_FUNCTION_START(LINE) \
- fprintf (asm_out_file, \
- "\t.def\t.bf%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_FUNCTION_END
-#define PUT_SDB_FUNCTION_END(LINE) \
- fprintf (asm_out_file, \
- "\t.def\t.ef%s\t.val\t.%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
-#endif
-
-#ifndef PUT_SDB_EPILOGUE_END
-#define PUT_SDB_EPILOGUE_END(NAME) \
-do { fprintf (asm_out_file, "\t.def\t"); \
- ASM_OUTPUT_LABELREF (asm_out_file, NAME); \
- fprintf (asm_out_file, \
- "%s\t.val\t.%s\t.scl\t-1%s\t.endef\n", \
- SDB_DELIM, SDB_DELIM, SDB_DELIM); } while (0)
-#endif
-
-#ifndef SDB_GENERATE_FAKE
-#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
- sprintf ((BUFFER), ".%dfake", (NUMBER));
-#endif
-
-/* Return the sdb tag identifier string for TYPE
- if TYPE has already been defined; otherwise return a null pointer. */
-
-#define KNOWN_TYPE_TAG(type) TYPE_SYMTAB_POINTER (type)
-
-/* Set the sdb tag identifier string for TYPE to NAME. */
-
-#define SET_KNOWN_TYPE_TAG(TYPE, NAME) \
- TYPE_SYMTAB_POINTER (TYPE) = (NAME)
-
-/* Return the name (a string) of the struct, union or enum tag
- described by the TREE_LIST node LINK. This is 0 for an anonymous one. */
-
-#define TAG_NAME(link) \
- (((link) && TREE_PURPOSE ((link)) \
- && IDENTIFIER_POINTER (TREE_PURPOSE ((link)))) \
- ? IDENTIFIER_POINTER (TREE_PURPOSE ((link))) : (char *) 0)
-
-/* Ensure we don't output a negative line number. */
-#define MAKE_LINE_SAFE(line) \
- if (line <= sdb_begin_function_line) line = sdb_begin_function_line + 1
-
-/* Perform linker optimization of merging header file definitions together
- for targets with MIPS_DEBUGGING_INFO defined. This won't work without a
- post 960826 version of GAS. Nothing breaks with earlier versions of GAS,
- the optimization just won't be done. The native assembler already has the
- necessary support. */
-
-#ifdef MIPS_DEBUGGING_INFO
-
-#ifndef PUT_SDB_SRC_FILE
-#define PUT_SDB_SRC_FILE(FILENAME) \
-output_file_directive (asm_out_file, (FILENAME))
-#endif
-
-/* ECOFF linkers have an optimization that does the same kind of thing as
- N_BINCL/E_INCL in stabs: eliminate duplicate debug information in the
- executable. To achieve this, GCC must output a .file for each file
- name change. */
-
-/* This is a stack of input files. */
-
-struct sdb_file
-{
- struct sdb_file *next;
- char *name;
-};
-
-/* This is the top of the stack. */
-
-static struct sdb_file *current_file;
-
-#endif /* MIPS_DEBUGGING_INFO */
-
-/* Set up for SDB output at the start of compilation. */
-
-void
-sdbout_init (asm_file, input_file_name, syms)
- FILE *asm_file;
- char *input_file_name;
- tree syms;
-{
-#ifdef MIPS_DEBUGGING_INFO
- current_file = (struct sdb_file *) xmalloc (sizeof *current_file);
- current_file->next = NULL;
- current_file->name = input_file_name;
-#endif
-
-#ifdef RMS_QUICK_HACK_1
- tree t;
- for (t = syms; t; t = TREE_CHAIN (t))
- if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
- && !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
- sdbout_symbol (t, 0);
-#endif
-}
-
-#if 0
-
-/* return the tag identifier for type
- */
-
-char *
-tag_of_ru_type (type,link)
- tree type,link;
-{
- if (TYPE_SYMTAB_ADDRESS (type))
- return TYPE_SYMTAB_ADDRESS (type);
- if (link && TREE_PURPOSE (link)
- && IDENTIFIER_POINTER (TREE_PURPOSE (link)))
- TYPE_SYMTAB_ADDRESS (type) = IDENTIFIER_POINTER (TREE_PURPOSE (link));
- else
- return (char *) TYPE_SYMTAB_ADDRESS (type);
-}
-#endif
-
-/* Return a unique string to name an anonymous type. */
-
-static char *
-gen_fake_label ()
-{
- char label[10];
- char *labelstr;
- SDB_GENERATE_FAKE (label, unnamed_struct_number);
- unnamed_struct_number++;
- labelstr = (char *) permalloc (strlen (label) + 1);
- strcpy (labelstr, label);
- return labelstr;
-}
-
-/* Return the number which describes TYPE for SDB.
- For pointers, etc., this function is recursive.
- Each record, union or enumeral type must already have had a
- tag number output. */
-
-/* The number is given by d6d5d4d3d2d1bbbb
- where bbbb is 4 bit basic type, and di indicate one of notype,ptr,fn,array.
- Thus, char *foo () has bbbb=T_CHAR
- d1=D_FCN
- d2=D_PTR
- N_BTMASK= 017 1111 basic type field.
- N_TSHIFT= 2 derived type shift
- N_BTSHFT= 4 Basic type shift */
-
-/* Produce the number that describes a pointer, function or array type.
- PREV is the number describing the target, value or element type.
- DT_type describes how to transform that type. */
-#define PUSH_DERIVED_LEVEL(DT_type,PREV) \
- ((((PREV) & ~(int)N_BTMASK) << (int)N_TSHIFT) \
- | ((int)DT_type << (int)N_BTSHFT) \
- | ((PREV) & (int)N_BTMASK))
-
-/* Number of elements used in sdb_dims. */
-static int sdb_n_dims = 0;
-
-/* Table of array dimensions of current type. */
-static int sdb_dims[SDB_MAX_DIM];
-
-/* Size of outermost array currently being processed. */
-static int sdb_type_size = -1;
-
-static int
-plain_type (type)
- tree type;
-{
- int val = plain_type_1 (type, 0);
-
- /* If we have already saved up some array dimensions, print them now. */
- if (sdb_n_dims > 0)
- {
- int i;
- PUT_SDB_START_DIM;
- for (i = sdb_n_dims - 1; i > 0; i--)
- PUT_SDB_NEXT_DIM (sdb_dims[i]);
- PUT_SDB_LAST_DIM (sdb_dims[0]);
- sdb_n_dims = 0;
-
- sdb_type_size = int_size_in_bytes (type);
- /* Don't kill sdb if type is not laid out or has variable size. */
- if (sdb_type_size < 0)
- sdb_type_size = 0;
- }
- /* If we have computed the size of an array containing this type,
- print it now. */
- if (sdb_type_size >= 0)
- {
- PUT_SDB_SIZE (sdb_type_size);
- sdb_type_size = -1;
- }
- return val;
-}
-
-static int
-template_name_p (name)
- tree name;
-{
- register char *ptr = IDENTIFIER_POINTER (name);
- while (*ptr && *ptr != '<')
- ptr++;
-
- return *ptr != '\0';
-}
-
-static void
-sdbout_record_type_name (type)
- tree type;
-{
- char *name = 0;
- int no_name;
-
- if (KNOWN_TYPE_TAG (type))
- return;
-
- if (TYPE_NAME (type) != 0)
- {
- tree t = 0;
- /* Find the IDENTIFIER_NODE for the type name. */
- if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- t = TYPE_NAME (type);
- else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL)
- {
- t = DECL_NAME (TYPE_NAME (type));
- /* The DECL_NAME for templates includes "<>", which breaks
- most assemblers. Use its assembler name instead, which
- has been mangled into being safe. */
- if (t && template_name_p (t))
- t = DECL_ASSEMBLER_NAME (TYPE_NAME (type));
- }
-
- /* Now get the name as a string, or invent one. */
- if (t != NULL_TREE)
- name = IDENTIFIER_POINTER (t);
- }
-
- no_name = (name == 0 || *name == 0);
- if (no_name)
- name = gen_fake_label ();
-
- SET_KNOWN_TYPE_TAG (type, name);
-#ifdef SDB_ALLOW_FORWARD_REFERENCES
- if (no_name)
- sdbout_queue_anonymous_type (type);
-#endif
-}
-
-/* Return the .type value for type TYPE.
-
- LEVEL indicates how many levels deep we have recursed into the type.
- The SDB debug format can only represent 6 derived levels of types.
- After that, we must output inaccurate debug info. We deliberately
- stop before the 7th level, so that ADA recursive types will not give an
- infinite loop. */
-
-static int
-plain_type_1 (type, level)
- tree type;
- int level;
-{
- if (type == 0)
- type = void_type_node;
- else if (type == error_mark_node)
- type = integer_type_node;
- else
- type = TYPE_MAIN_VARIANT (type);
-
- switch (TREE_CODE (type))
- {
- case VOID_TYPE:
- return T_VOID;
- case INTEGER_TYPE:
- {
- int size = int_size_in_bytes (type) * BITS_PER_UNIT;
-
- /* Carefully distinguish all the standard types of C,
- without messing up if the language is not C.
- Note that we check only for the names that contain spaces;
- other names might occur by coincidence in other languages. */
- if (TYPE_NAME (type) != 0
- && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_NAME (TYPE_NAME (type)) != 0
- && TREE_CODE (DECL_NAME (TYPE_NAME (type))) == IDENTIFIER_NODE)
- {
- char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
-
- if (!strcmp (name, "unsigned char"))
- return T_UCHAR;
- if (!strcmp (name, "signed char"))
- return T_CHAR;
- if (!strcmp (name, "unsigned int"))
- return T_UINT;
- if (!strcmp (name, "short int"))
- return T_SHORT;
- if (!strcmp (name, "short unsigned int"))
- return T_USHORT;
- if (!strcmp (name, "long int"))
- return T_LONG;
- if (!strcmp (name, "long unsigned int"))
- return T_ULONG;
- }
-
- if (size == CHAR_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? T_UCHAR : T_CHAR);
- if (size == SHORT_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? T_USHORT : T_SHORT);
- if (size == INT_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? T_UINT : T_INT);
- if (size == LONG_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
- if (size == LONG_LONG_TYPE_SIZE) /* better than nothing */
- return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
- return 0;
- }
-
- case REAL_TYPE:
- {
- int precision = TYPE_PRECISION (type);
- if (precision == FLOAT_TYPE_SIZE)
- return T_FLOAT;
- if (precision == DOUBLE_TYPE_SIZE)
- return T_DOUBLE;
-#ifdef EXTENDED_SDB_BASIC_TYPES
- if (precision == LONG_DOUBLE_TYPE_SIZE)
- return T_LNGDBL;
-#endif
- return 0;
- }
-
- case ARRAY_TYPE:
- {
- int m;
- if (level >= 6)
- return T_VOID;
- else
- m = plain_type_1 (TREE_TYPE (type), level+1);
- if (sdb_n_dims < SDB_MAX_DIM)
- sdb_dims[sdb_n_dims++]
- = (TYPE_DOMAIN (type)
- ? (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
- - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1)
- : 0);
- return PUSH_DERIVED_LEVEL (DT_ARY, m);
- }
-
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- case ENUMERAL_TYPE:
- {
- char *tag;
-#ifdef SDB_ALLOW_FORWARD_REFERENCES
- sdbout_record_type_name (type);
-#endif
-#ifndef SDB_ALLOW_UNKNOWN_REFERENCES
- if ((TREE_ASM_WRITTEN (type) && KNOWN_TYPE_TAG (type) != 0)
-#ifdef SDB_ALLOW_FORWARD_REFERENCES
- || TYPE_MODE (type) != VOIDmode
-#endif
- )
-#endif
- {
- /* Output the referenced structure tag name
- only if the .def has already been finished.
- At least on 386, the Unix assembler
- cannot handle forward references to tags. */
- /* But the 88100, it requires them, sigh... */
- /* And the MIPS requires unknown refs as well... */
- tag = KNOWN_TYPE_TAG (type);
- PUT_SDB_TAG (tag);
- /* These 3 lines used to follow the close brace.
- However, a size of 0 without a tag implies a tag of 0,
- so if we don't know a tag, we can't mention the size. */
- sdb_type_size = int_size_in_bytes (type);
- if (sdb_type_size < 0)
- sdb_type_size = 0;
- }
- return ((TREE_CODE (type) == RECORD_TYPE) ? T_STRUCT
- : (TREE_CODE (type) == UNION_TYPE) ? T_UNION
- : (TREE_CODE (type) == QUAL_UNION_TYPE) ? T_UNION
- : T_ENUM);
- }
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- {
- int m;
- if (level >= 6)
- return T_VOID;
- else
- m = plain_type_1 (TREE_TYPE (type), level+1);
- return PUSH_DERIVED_LEVEL (DT_PTR, m);
- }
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- {
- int m;
- if (level >= 6)
- return T_VOID;
- else
- m = plain_type_1 (TREE_TYPE (type), level+1);
- return PUSH_DERIVED_LEVEL (DT_FCN, m);
- }
- default:
- return 0;
- }
-}
-
-/* Output the symbols defined in block number DO_BLOCK.
- Set NEXT_BLOCK_NUMBER to 0 before calling.
-
- This function works by walking the tree structure of blocks,
- counting blocks until it finds the desired block. */
-
-static int do_block = 0;
-
-static int next_block_number;
-
-static void
-sdbout_block (block)
- register tree block;
-{
- while (block)
- {
- /* Ignore blocks never expanded or otherwise marked as real. */
- if (TREE_USED (block))
- {
- /* When we reach the specified block, output its symbols. */
- if (next_block_number == do_block)
- {
- sdbout_syms (BLOCK_VARS (block));
- }
-
- /* If we are past the specified block, stop the scan. */
- if (next_block_number > do_block)
- return;
-
- next_block_number++;
-
- /* Scan the blocks within this block. */
- sdbout_block (BLOCK_SUBBLOCKS (block));
- }
-
- block = BLOCK_CHAIN (block);
- }
-}
-
-/* Call sdbout_symbol on each decl in the chain SYMS. */
-
-static void
-sdbout_syms (syms)
- tree syms;
-{
- while (syms)
- {
- if (TREE_CODE (syms) != LABEL_DECL)
- sdbout_symbol (syms, 1);
- syms = TREE_CHAIN (syms);
- }
-}
-
-/* Output SDB information for a symbol described by DECL.
- LOCAL is nonzero if the symbol is not file-scope. */
-
-void
-sdbout_symbol (decl, local)
- tree decl;
- int local;
-{
- tree type = TREE_TYPE (decl);
- tree context = NULL_TREE;
- rtx value;
- int regno = -1;
- char *name;
-
- sdbout_one_type (type);
-
-#if 0 /* This loses when functions are marked to be ignored,
- which happens in the C++ front end. */
- if (DECL_IGNORED_P (decl))
- return;
-#endif
-
- switch (TREE_CODE (decl))
- {
- case CONST_DECL:
- /* Enum values are defined by defining the enum type. */
- return;
-
- case FUNCTION_DECL:
- /* Don't mention a nested function under its parent. */
- context = decl_function_context (decl);
- if (context == current_function_decl)
- return;
- /* Check DECL_INITIAL to distinguish declarations from definitions.
- Don't output debug info here for declarations; they will have
- a DECL_INITIAL value of 0. */
- if (! DECL_INITIAL (decl))
- return;
- if (GET_CODE (DECL_RTL (decl)) != MEM
- || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
- return;
- PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
- PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
- PUT_SDB_SCL (TREE_PUBLIC (decl) ? C_EXT : C_STAT);
- break;
-
- case TYPE_DECL:
- /* Done with tagged types. */
- if (DECL_NAME (decl) == 0)
- return;
- if (DECL_IGNORED_P (decl))
- return;
-
- /* Output typedef name. */
- if (template_name_p (DECL_NAME (decl)))
- PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
- else
- PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_NAME (decl)));
- PUT_SDB_SCL (C_TPDEF);
- break;
-
- case PARM_DECL:
- /* Parm decls go in their own separate chains
- and are output by sdbout_reg_parms and sdbout_parms. */
- abort ();
-
- case VAR_DECL:
- /* Don't mention a variable that is external.
- Let the file that defines it describe it. */
- if (DECL_EXTERNAL (decl))
- return;
-
- /* Ignore __FUNCTION__, etc. */
- if (DECL_IGNORED_P (decl))
- return;
-
- /* If there was an error in the declaration, don't dump core
- if there is no RTL associated with the variable doesn't
- exist. */
- if (DECL_RTL (decl) == 0)
- return;
-
- DECL_RTL (decl) = eliminate_regs (DECL_RTL (decl), 0, NULL_RTX, 0);
-#ifdef LEAF_REG_REMAP
- if (leaf_function)
- leaf_renumber_regs_insn (DECL_RTL (decl));
-#endif
- value = DECL_RTL (decl);
-
- /* Don't mention a variable at all
- if it was completely optimized into nothingness.
-
- If DECL was from an inline function, then its rtl
- is not identically the rtl that was used in this
- particular compilation. */
- if (GET_CODE (value) == REG)
- {
- regno = REGNO (DECL_RTL (decl));
- if (regno >= FIRST_PSEUDO_REGISTER)
- return;
- }
- else if (GET_CODE (value) == SUBREG)
- {
- int offset = 0;
- while (GET_CODE (value) == SUBREG)
- {
- offset += SUBREG_WORD (value);
- value = SUBREG_REG (value);
- }
- if (GET_CODE (value) == REG)
- {
- regno = REGNO (value);
- if (regno >= FIRST_PSEUDO_REGISTER)
- return;
- regno += offset;
- }
- alter_subreg (DECL_RTL (decl));
- value = DECL_RTL (decl);
- }
- /* Don't output anything if an auto variable
- gets RTL that is static.
- GAS version 2.2 can't handle such output. */
- else if (GET_CODE (value) == MEM && CONSTANT_P (XEXP (value, 0))
- && ! TREE_STATIC (decl))
- return;
-
- /* Emit any structure, union, or enum type that has not been output.
- This occurs for tag-less structs (et al) used to declare variables
- within functions. */
- if (TREE_CODE (type) == ENUMERAL_TYPE
- || TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE
- || TREE_CODE (type) == QUAL_UNION_TYPE)
- {
- if (TYPE_SIZE (type) != 0 /* not a forward reference */
- && KNOWN_TYPE_TAG (type) == 0) /* not yet declared */
- sdbout_one_type (type);
- }
-
- /* Defer SDB information for top-level initialized variables! */
- if (! local
- && GET_CODE (value) == MEM
- && DECL_INITIAL (decl))
- return;
-
- /* C++ in 2.3 makes nameless symbols. That will be fixed later.
- For now, avoid crashing. */
- if (DECL_NAME (decl) == NULL_TREE)
- return;
-
- /* Record the name for, starting a symtab entry. */
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-
- if (GET_CODE (value) == MEM
- && GET_CODE (XEXP (value, 0)) == SYMBOL_REF)
- {
- PUT_SDB_DEF (name);
- if (TREE_PUBLIC (decl))
- {
- PUT_SDB_VAL (XEXP (value, 0));
- PUT_SDB_SCL (C_EXT);
- }
- else
- {
- PUT_SDB_VAL (XEXP (value, 0));
- PUT_SDB_SCL (C_STAT);
- }
- }
- else if (regno >= 0)
- {
- PUT_SDB_DEF (name);
- PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (regno));
- PUT_SDB_SCL (C_REG);
- }
- else if (GET_CODE (value) == MEM
- && (GET_CODE (XEXP (value, 0)) == MEM
- || (GET_CODE (XEXP (value, 0)) == REG
- && REGNO (XEXP (value, 0)) != HARD_FRAME_POINTER_REGNUM
- && REGNO (XEXP (value, 0)) != STACK_POINTER_REGNUM)))
- /* If the value is indirect by memory or by a register
- that isn't the frame pointer
- then it means the object is variable-sized and address through
- that register or stack slot. COFF has no way to represent this
- so all we can do is output the variable as a pointer. */
- {
- PUT_SDB_DEF (name);
- if (GET_CODE (XEXP (value, 0)) == REG)
- {
- PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (XEXP (value, 0))));
- PUT_SDB_SCL (C_REG);
- }
- else
- {
- /* DECL_RTL looks like (MEM (MEM (PLUS (REG...)
- (CONST_INT...)))).
- We want the value of that CONST_INT. */
- /* Encore compiler hates a newline in a macro arg, it seems. */
- PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
- (XEXP (XEXP (value, 0), 0)));
- PUT_SDB_SCL (C_AUTO);
- }
-
- type = build_pointer_type (TREE_TYPE (decl));
- }
- else if (GET_CODE (value) == MEM
- && ((GET_CODE (XEXP (value, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
- && GET_CODE (XEXP (XEXP (value, 0), 1)) == CONST_INT)
- /* This is for variables which are at offset zero from
- the frame pointer. This happens on the Alpha.
- Non-frame pointer registers are excluded above. */
- || (GET_CODE (XEXP (value, 0)) == REG)))
- {
- /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
- or (MEM (REG...)). We want the value of that CONST_INT
- or zero. */
- PUT_SDB_DEF (name);
- PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET (XEXP (value, 0)));
- PUT_SDB_SCL (C_AUTO);
- }
- else if (GET_CODE (value) == MEM && GET_CODE (XEXP (value, 0)) == CONST)
- {
- /* Handle an obscure case which can arise when optimizing and
- when there are few available registers. (This is *always*
- the case for i386/i486 targets). The DECL_RTL looks like
- (MEM (CONST ...)) even though this variable is a local `auto'
- or a local `register' variable. In effect, what has happened
- is that the reload pass has seen that all assignments and
- references for one such a local variable can be replaced by
- equivalent assignments and references to some static storage
- variable, thereby avoiding the need for a register. In such
- cases we're forced to lie to debuggers and tell them that
- this variable was itself `static'. */
- PUT_SDB_DEF (name);
- PUT_SDB_VAL (XEXP (XEXP (value, 0), 0));
- PUT_SDB_SCL (C_STAT);
- }
- else
- {
- /* It is something we don't know how to represent for SDB. */
- return;
- }
- break;
- }
- PUT_SDB_TYPE (plain_type (type));
- PUT_SDB_ENDEF;
-}
-
-/* Output SDB information for a top-level initialized variable
- that has been delayed. */
-
-void
-sdbout_toplevel_data (decl)
- tree decl;
-{
- tree type = TREE_TYPE (decl);
-
- if (DECL_IGNORED_P (decl))
- return;
-
- if (! (TREE_CODE (decl) == VAR_DECL
- && GET_CODE (DECL_RTL (decl)) == MEM
- && DECL_INITIAL (decl)))
- abort ();
-
- PUT_SDB_DEF (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
- PUT_SDB_VAL (XEXP (DECL_RTL (decl), 0));
- if (TREE_PUBLIC (decl))
- {
- PUT_SDB_SCL (C_EXT);
- }
- else
- {
- PUT_SDB_SCL (C_STAT);
- }
- PUT_SDB_TYPE (plain_type (type));
- PUT_SDB_ENDEF;
-}
-
-#ifdef SDB_ALLOW_FORWARD_REFERENCES
-
-/* Machinery to record and output anonymous types. */
-
-static tree anonymous_types;
-
-static void
-sdbout_queue_anonymous_type (type)
- tree type;
-{
- anonymous_types = saveable_tree_cons (NULL_TREE, type, anonymous_types);
-}
-
-static void
-sdbout_dequeue_anonymous_types ()
-{
- register tree types, link;
-
- while (anonymous_types)
- {
- types = nreverse (anonymous_types);
- anonymous_types = NULL_TREE;
-
- for (link = types; link; link = TREE_CHAIN (link))
- {
- register tree type = TREE_VALUE (link);
-
- if (type && ! TREE_ASM_WRITTEN (type))
- sdbout_one_type (type);
- }
- }
-}
-
-#endif
-
-/* Given a chain of ..._TYPE nodes, all of which have names,
- output definitions of those names, as typedefs. */
-
-void
-sdbout_types (types)
- register tree types;
-{
- register tree link;
-
- for (link = types; link; link = TREE_CHAIN (link))
- sdbout_one_type (link);
-
-#ifdef SDB_ALLOW_FORWARD_REFERENCES
- sdbout_dequeue_anonymous_types ();
-#endif
-}
-
-static void
-sdbout_type (type)
- tree type;
-{
- if (type == error_mark_node)
- type = integer_type_node;
- PUT_SDB_TYPE (plain_type (type));
-}
-
-/* Output types of the fields of type TYPE, if they are structs.
-
- Formerly did not chase through pointer types, since that could be circular.
- They must come before TYPE, since forward refs are not allowed.
- Now james@bigtex.cactus.org says to try them. */
-
-static void
-sdbout_field_types (type)
- tree type;
-{
- tree tail;
- for (tail = TYPE_FIELDS (type); tail; tail = TREE_CHAIN (tail))
- if (TREE_CODE (TREE_TYPE (tail)) == POINTER_TYPE)
- sdbout_one_type (TREE_TYPE (TREE_TYPE (tail)));
- else
- sdbout_one_type (TREE_TYPE (tail));
-}
-
-/* Use this to put out the top level defined record and union types
- for later reference. If this is a struct with a name, then put that
- name out. Other unnamed structs will have .xxfake labels generated so
- that they may be referred to later.
- The label will be stored in the KNOWN_TYPE_TAG slot of a type.
- It may NOT be called recursively. */
-
-static void
-sdbout_one_type (type)
- tree type;
-{
- if (current_function_decl != NULL_TREE
- && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
- ; /* Don't change section amid function. */
- else
- text_section ();
-
- switch (TREE_CODE (type))
- {
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- case ENUMERAL_TYPE:
- type = TYPE_MAIN_VARIANT (type);
- /* Don't output a type twice. */
- if (TREE_ASM_WRITTEN (type))
- /* James said test TREE_ASM_BEING_WRITTEN here. */
- return;
-
- /* Output nothing if type is not yet defined. */
- if (TYPE_SIZE (type) == 0)
- return;
-
- TREE_ASM_WRITTEN (type) = 1;
-#if 1
- /* This is reputed to cause trouble with the following case,
- but perhaps checking TYPE_SIZE above will fix it. */
-
- /* Here is a test case:
-
- struct foo {
- struct badstr *bbb;
- } forwardref;
-
- typedef struct intermediate {
- int aaaa;
- } intermediate_ref;
-
- typedef struct badstr {
- int ccccc;
- } badtype; */
-
-#if 0
- TREE_ASM_BEING_WRITTEN (type) = 1;
-#endif
- /* This change, which ought to make better output,
- used to make the COFF assembler unhappy.
- Changes involving KNOWN_TYPE_TAG may fix the problem. */
- /* Before really doing anything, output types we want to refer to. */
- /* Note that in version 1 the following two lines
- are not used if forward references are in use. */
- if (TREE_CODE (type) != ENUMERAL_TYPE)
- sdbout_field_types (type);
-#if 0
- TREE_ASM_WRITTEN (type) = 1;
-#endif
-#endif
-
- /* Output a structure type. */
- {
- int size = int_size_in_bytes (type);
- int member_scl;
- tree tem;
- int i, n_baseclasses = 0;
-
- /* Record the type tag, but not in its permanent place just yet. */
- sdbout_record_type_name (type);
-
- PUT_SDB_DEF (KNOWN_TYPE_TAG (type));
-
- switch (TREE_CODE (type))
- {
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- PUT_SDB_SCL (C_UNTAG);
- PUT_SDB_TYPE (T_UNION);
- member_scl = C_MOU;
- break;
-
- case RECORD_TYPE:
- PUT_SDB_SCL (C_STRTAG);
- PUT_SDB_TYPE (T_STRUCT);
- member_scl = C_MOS;
- break;
-
- case ENUMERAL_TYPE:
- PUT_SDB_SCL (C_ENTAG);
- PUT_SDB_TYPE (T_ENUM);
- member_scl = C_MOE;
- break;
- }
-
- PUT_SDB_SIZE (size);
- PUT_SDB_ENDEF;
-
- /* Print out the base class information with fields
- named after the types they hold. */
- if (TYPE_BINFO (type)
- && TYPE_BINFO_BASETYPES (type))
- n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
- for (i = 0; i < n_baseclasses; i++)
- {
- tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)), i);
- tree child_type = BINFO_TYPE (child);
- tree child_type_name;
- if (TYPE_NAME (child_type) == 0)
- continue;
- if (TREE_CODE (TYPE_NAME (child_type)) == IDENTIFIER_NODE)
- child_type_name = TYPE_NAME (child_type);
- else if (TREE_CODE (TYPE_NAME (child_type)) == TYPE_DECL)
- {
- child_type_name = DECL_NAME (TYPE_NAME (child_type));
- if (child_type_name && template_name_p (child_type_name))
- child_type_name
- = DECL_ASSEMBLER_NAME (TYPE_NAME (child_type));
- }
- else
- continue;
-
- CONTIN;
- PUT_SDB_DEF (IDENTIFIER_POINTER (child_type_name));
- PUT_SDB_INT_VAL (TREE_INT_CST_LOW (BINFO_OFFSET (child)));
- PUT_SDB_SCL (member_scl);
- sdbout_type (BINFO_TYPE (child));
- PUT_SDB_ENDEF;
- }
-
- /* output the individual fields */
-
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
- {
- PUT_SDB_DEF (IDENTIFIER_POINTER (TREE_PURPOSE (tem)));
- PUT_SDB_INT_VAL (TREE_INT_CST_LOW (TREE_VALUE (tem)));
- PUT_SDB_SCL (C_MOE);
- PUT_SDB_TYPE (T_MOE);
- PUT_SDB_ENDEF;
- }
-
- else /* record or union type */
- for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
- /* Output the name, type, position (in bits), size (in bits)
- of each field. */
-
- /* Omit here the nameless fields that are used to skip bits.
- Also omit fields with variable size or position.
- Also omit non FIELD_DECL nodes that GNU C++ may put here. */
- if (TREE_CODE (tem) == FIELD_DECL
- && DECL_NAME (tem) != 0
- && TREE_CODE (DECL_SIZE (tem)) == INTEGER_CST
- && TREE_CODE (DECL_FIELD_BITPOS (tem)) == INTEGER_CST)
- {
- char *name;
-
- CONTIN;
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (tem));
- PUT_SDB_DEF (name);
- if (DECL_BIT_FIELD_TYPE (tem))
- {
- PUT_SDB_INT_VAL (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
- PUT_SDB_SCL (C_FIELD);
- sdbout_type (DECL_BIT_FIELD_TYPE (tem));
- PUT_SDB_SIZE (TREE_INT_CST_LOW (DECL_SIZE (tem)));
- }
- else
- {
- PUT_SDB_INT_VAL (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem))
- / BITS_PER_UNIT);
- PUT_SDB_SCL (member_scl);
- sdbout_type (TREE_TYPE (tem));
- }
- PUT_SDB_ENDEF;
- }
- /* output end of a structure,union, or enumeral definition */
-
- PUT_SDB_PLAIN_DEF ("eos");
- PUT_SDB_INT_VAL (size);
- PUT_SDB_SCL (C_EOS);
- PUT_SDB_TAG (KNOWN_TYPE_TAG (type));
- PUT_SDB_SIZE (size);
- PUT_SDB_ENDEF;
- break;
- }
- }
-}
-
-/* The following two functions output definitions of function parameters.
- Each parameter gets a definition locating it in the parameter list.
- Each parameter that is a register variable gets a second definition
- locating it in the register.
-
- Printing or argument lists in gdb uses the definitions that
- locate in the parameter list. But reference to the variable in
- expressions uses preferentially the definition as a register. */
-
-/* Output definitions, referring to storage in the parmlist,
- of all the parms in PARMS, which is a chain of PARM_DECL nodes. */
-
-static void
-sdbout_parms (parms)
- tree parms;
-{
- for (; parms; parms = TREE_CHAIN (parms))
- if (DECL_NAME (parms))
- {
- int current_sym_value = 0;
- char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
-
- if (name == 0 || *name == 0)
- name = gen_fake_label ();
-
- /* Perform any necessary register eliminations on the parameter's rtl,
- so that the debugging output will be accurate. */
- DECL_INCOMING_RTL (parms) =
- eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX, 0);
- DECL_RTL (parms) = eliminate_regs (DECL_RTL (parms), 0, NULL_RTX, 0);
-
- if (PARM_PASSED_IN_MEMORY (parms))
- {
- rtx addr = XEXP (DECL_INCOMING_RTL (parms), 0);
- tree type;
-
- /* ??? Here we assume that the parm address is indexed
- off the frame pointer or arg pointer.
- If that is not true, we produce meaningless results,
- but do not crash. */
- if (GET_CODE (addr) == PLUS
- && GET_CODE (XEXP (addr, 1)) == CONST_INT)
- current_sym_value = INTVAL (XEXP (addr, 1));
- else
- current_sym_value = 0;
-
- if (GET_CODE (DECL_RTL (parms)) == REG
- && REGNO (DECL_RTL (parms)) >= 0
- && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
- type = DECL_ARG_TYPE (parms);
- else
- {
- int original_sym_value = current_sym_value;
-
- /* This is the case where the parm is passed as an int or
- double and it is converted to a char, short or float
- and stored back in the parmlist. In this case, describe
- the parm with the variable's declared type, and adjust
- the address if the least significant bytes (which we are
- using) are not the first ones. */
- if (BYTES_BIG_ENDIAN
- && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
- current_sym_value +=
- (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
- - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
-
- if (GET_CODE (DECL_RTL (parms)) == MEM
- && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
- && (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1))
- == CONST_INT)
- && (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1))
- == current_sym_value))
- type = TREE_TYPE (parms);
- else
- {
- current_sym_value = original_sym_value;
- type = DECL_ARG_TYPE (parms);
- }
- }
-
- PUT_SDB_DEF (name);
- PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value, addr));
- PUT_SDB_SCL (C_ARG);
- PUT_SDB_TYPE (plain_type (type));
- PUT_SDB_ENDEF;
- }
- else if (GET_CODE (DECL_RTL (parms)) == REG)
- {
- rtx best_rtl;
- /* Parm passed in registers and lives in registers or nowhere. */
-
- /* If parm lives in a register, use that register;
- pretend the parm was passed there. It would be more consistent
- to describe the register where the parm was passed,
- but in practice that register usually holds something else. */
- if (REGNO (DECL_RTL (parms)) >= 0
- && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER)
- best_rtl = DECL_RTL (parms);
- /* If the parm lives nowhere,
- use the register where it was passed. */
- else
- best_rtl = DECL_INCOMING_RTL (parms);
-
- PUT_SDB_DEF (name);
- PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (best_rtl)));
- PUT_SDB_SCL (C_REGPARM);
- PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
- PUT_SDB_ENDEF;
- }
- else if (GET_CODE (DECL_RTL (parms)) == MEM
- && XEXP (DECL_RTL (parms), 0) != const0_rtx)
- {
- /* Parm was passed in registers but lives on the stack. */
-
- /* DECL_RTL looks like (MEM (PLUS (REG...) (CONST_INT...))),
- in which case we want the value of that CONST_INT,
- or (MEM (REG ...)) or (MEM (MEM ...)),
- in which case we use a value of zero. */
- if (GET_CODE (XEXP (DECL_RTL (parms), 0)) == REG
- || GET_CODE (XEXP (DECL_RTL (parms), 0)) == MEM)
- current_sym_value = 0;
- else
- current_sym_value = INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1));
-
- /* Again, this assumes the offset is based on the arg pointer. */
- PUT_SDB_DEF (name);
- PUT_SDB_INT_VAL (DEBUGGER_ARG_OFFSET (current_sym_value,
- XEXP (DECL_RTL (parms), 0)));
- PUT_SDB_SCL (C_ARG);
- PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
- PUT_SDB_ENDEF;
- }
- }
-}
-
-/* Output definitions for the places where parms live during the function,
- when different from where they were passed, when the parms were passed
- in memory.
-
- It is not useful to do this for parms passed in registers
- that live during the function in different registers, because it is
- impossible to look in the passed register for the passed value,
- so we use the within-the-function register to begin with.
-
- PARMS is a chain of PARM_DECL nodes. */
-
-static void
-sdbout_reg_parms (parms)
- tree parms;
-{
- for (; parms; parms = TREE_CHAIN (parms))
- if (DECL_NAME (parms))
- {
- char *name = IDENTIFIER_POINTER (DECL_NAME (parms));
-
- /* Report parms that live in registers during the function
- but were passed in memory. */
- if (GET_CODE (DECL_RTL (parms)) == REG
- && REGNO (DECL_RTL (parms)) >= 0
- && REGNO (DECL_RTL (parms)) < FIRST_PSEUDO_REGISTER
- && PARM_PASSED_IN_MEMORY (parms))
- {
- if (name == 0 || *name == 0)
- name = gen_fake_label ();
- PUT_SDB_DEF (name);
- PUT_SDB_INT_VAL (DBX_REGISTER_NUMBER (REGNO (DECL_RTL (parms))));
- PUT_SDB_SCL (C_REG);
- PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
- PUT_SDB_ENDEF;
- }
- /* Report parms that live in memory but not where they were passed. */
- else if (GET_CODE (DECL_RTL (parms)) == MEM
- && GET_CODE (XEXP (DECL_RTL (parms), 0)) == PLUS
- && GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 1)) == CONST_INT
- && PARM_PASSED_IN_MEMORY (parms)
- && ! rtx_equal_p (DECL_RTL (parms), DECL_INCOMING_RTL (parms)))
- {
-#if 0 /* ??? It is not clear yet what should replace this. */
- int offset = DECL_OFFSET (parms) / BITS_PER_UNIT;
- /* A parm declared char is really passed as an int,
- so it occupies the least significant bytes.
- On a big-endian machine those are not the low-numbered ones. */
- if (BYTES_BIG_ENDIAN
- && offset != -1
- && TREE_TYPE (parms) != DECL_ARG_TYPE (parms))
- offset += (GET_MODE_SIZE (TYPE_MODE (DECL_ARG_TYPE (parms)))
- - GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))));
- if (INTVAL (XEXP (XEXP (DECL_RTL (parms), 0), 1)) != offset) {...}
-#endif
- {
- if (name == 0 || *name == 0)
- name = gen_fake_label ();
- PUT_SDB_DEF (name);
- PUT_SDB_INT_VAL (DEBUGGER_AUTO_OFFSET
- (XEXP (DECL_RTL (parms), 0)));
- PUT_SDB_SCL (C_AUTO);
- PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
- PUT_SDB_ENDEF;
- }
- }
- }
-}
-
-/* Describe the beginning of an internal block within a function.
- Also output descriptions of variables defined in this block.
-
- N is the number of the block, by order of beginning, counting from 1,
- and not counting the outermost (function top-level) block.
- The blocks match the BLOCKs in DECL_INITIAL (current_function_decl),
- if the count starts at 0 for the outermost one. */
-
-void
-sdbout_begin_block (file, line, n)
- FILE *file;
- int line;
- int n;
-{
- tree decl = current_function_decl;
- MAKE_LINE_SAFE (line);
-
- /* The SCO compiler does not emit a separate block for the function level
- scope, so we avoid it here also. However, mips ECOFF compilers do emit
- a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
-#ifndef MIPS_DEBUGGING_INFO
- if (n != 1)
-#endif
- PUT_SDB_BLOCK_START (line - sdb_begin_function_line);
-
- if (n == 1)
- {
- /* Include the outermost BLOCK's variables in block 1. */
- next_block_number = 0;
- do_block = 0;
- sdbout_block (DECL_INITIAL (decl));
- }
- /* If -g1, suppress all the internal symbols of functions
- except for arguments. */
- if (debug_info_level != DINFO_LEVEL_TERSE)
- {
- next_block_number = 0;
- do_block = n;
- sdbout_block (DECL_INITIAL (decl));
- }
-
-#ifdef SDB_ALLOW_FORWARD_REFERENCES
- sdbout_dequeue_anonymous_types ();
-#endif
-}
-
-/* Describe the end line-number of an internal block within a function. */
-
-void
-sdbout_end_block (file, line, n)
- FILE *file;
- int line;
- int n;
-{
- MAKE_LINE_SAFE (line);
-
- /* The SCO compiler does not emit a separate block for the function level
- scope, so we avoid it here also. However, mips ECOFF compilers do emit
- a separate block, so we retain it when MIPS_DEBUGGING_INFO is defined. */
-#ifndef MIPS_DEBUGGING_INFO
- if (n != 1)
-#endif
- PUT_SDB_BLOCK_END (line - sdb_begin_function_line);
-}
-
-/* Output sdb info for the current function name.
- Called from assemble_start_function. */
-
-void
-sdbout_mark_begin_function ()
-{
- sdbout_symbol (current_function_decl, 0);
-}
-
-/* Called at beginning of function body (after prologue).
- Record the function's starting line number, so we can output
- relative line numbers for the other lines.
- Describe beginning of outermost block.
- Also describe the parameter list. */
-
-void
-sdbout_begin_function (line)
- int line;
-{
- sdb_begin_function_line = line - 1;
- PUT_SDB_FUNCTION_START (line);
- sdbout_parms (DECL_ARGUMENTS (current_function_decl));
- sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl));
-}
-
-/* Called at end of function (before epilogue).
- Describe end of outermost block. */
-
-void
-sdbout_end_function (line)
- int line;
-{
-#ifdef SDB_ALLOW_FORWARD_REFERENCES
- sdbout_dequeue_anonymous_types ();
-#endif
-
- MAKE_LINE_SAFE (line);
- PUT_SDB_FUNCTION_END (line - sdb_begin_function_line);
-
- /* Indicate we are between functions, for line-number output. */
- sdb_begin_function_line = -1;
-}
-
-/* Output sdb info for the absolute end of a function.
- Called after the epilogue is output. */
-
-void
-sdbout_end_epilogue ()
-{
- char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl));
- PUT_SDB_EPILOGUE_END (name);
-}
-
-/* Output sdb info for the given label. Called only if LABEL_NAME (insn)
- is present. */
-
-void
-sdbout_label (insn)
- register rtx insn;
-{
- PUT_SDB_DEF (LABEL_NAME (insn));
- PUT_SDB_VAL (insn);
- PUT_SDB_SCL (C_LABEL);
- PUT_SDB_TYPE (T_NULL);
- PUT_SDB_ENDEF;
-}
-
-/* Change to reading from a new source file. */
-
-void
-sdbout_start_new_source_file (filename)
- char *filename;
-{
-#ifdef MIPS_DEBUGGING_INFO
- struct sdb_file *n = (struct sdb_file *) xmalloc (sizeof *n);
-
- n->next = current_file;
- n->name = filename;
- current_file = n;
- PUT_SDB_SRC_FILE (filename);
-#endif
-}
-
-/* Revert to reading a previous source file. */
-
-void
-sdbout_resume_previous_source_file ()
-{
-#ifdef MIPS_DEBUGGING_INFO
- struct sdb_file *next;
-
- next = current_file->next;
- free (current_file);
- current_file = next;
- PUT_SDB_SRC_FILE (current_file->name);
-#endif
-}
-
-#endif /* SDB_DEBUGGING_INFO */
diff --git a/gcc/sort-protos b/gcc/sort-protos
deleted file mode 100755
index 493e9f08a8f..00000000000
--- a/gcc/sort-protos
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-# Sort the sys-protos.h file in its usual order.
-# Invoke as `sort-protos sys-protos.h'.
-
-input=$1
-
-sed 's/\(.*[ \*]\)\([a-zA-Z0-9_][a-zA-Z0-9_]*\)[ ]*\(([^\*].*\)$/\2%\1%\3/' $input | sort -u | awk -F% '{printf "%-30.30s%s%s\n", $2, $1, $3}' > tmp.$input
-
-mv -f tmp.$input $input
diff --git a/gcc/stack.h b/gcc/stack.h
deleted file mode 100644
index 198b41e75d0..00000000000
--- a/gcc/stack.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* stack.h - structed access to object stacks
- Copyright (C) 1988 Free Software Foundation, Inc.
- Contributed by Michael Tiemann (tiemann@cygnus.com).
-
-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, 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. */
-
-/* Summary: this file contains additional structures that layer
- on top of obstacks for GNU C++. */
-
-/* Stack of data placed on obstacks. */
-
-struct stack_level
-{
- /* Pointer back to previous such level. */
- struct stack_level *prev;
-
- /* Point to obstack we should return to. */
- struct obstack *obstack;
-
- /* First place we start putting data. */
- tree *first;
-
- /* Number of entries we can have from `first'.
- Right now we are dumb: if we overflow, abort. */
- int limit;
-};
-
-struct stack_level *push_stack_level PROTO((struct obstack *, char *, int));
-struct stack_level *pop_stack_level PROTO((struct stack_level *));
diff --git a/gcc/stmt.c b/gcc/stmt.c
deleted file mode 100644
index a3f42d5a0cc..00000000000
--- a/gcc/stmt.c
+++ /dev/null
@@ -1,6189 +0,0 @@
-/* Expands front end tree to back end RTL for GNU C-Compiler
- Copyright (C) 1987, 88, 89, 92-5, 1996 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 handles the generation of rtl code from tree structure
- above the level of expressions, using subroutines in exp*.c and emit-rtl.c.
- It also creates the rtl expressions for parameters and auto variables
- and has full responsibility for allocating stack slots.
-
- The functions whose names start with `expand_' are called by the
- parser to generate RTL instructions for various kinds of constructs.
-
- Some control and binding constructs require calling several such
- functions at different times. For example, a simple if-then
- is expanded by calling `expand_start_cond' (with the condition-expression
- as argument) before parsing the then-clause and calling `expand_end_cond'
- after parsing the then-clause. */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <ctype.h>
-
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "except.h"
-#include "function.h"
-#include "insn-flags.h"
-#include "insn-config.h"
-#include "insn-codes.h"
-#include "expr.h"
-#include "hard-reg-set.h"
-#include "obstack.h"
-#include "loop.h"
-#include "recog.h"
-#include "machmode.h"
-
-#include "bytecode.h"
-#include "bc-typecd.h"
-#include "bc-opcode.h"
-#include "bc-optab.h"
-#include "bc-emit.h"
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-struct obstack stmt_obstack;
-
-/* Filename and line number of last line-number note,
- whether we actually emitted it or not. */
-char *emit_filename;
-int emit_lineno;
-
-/* Nonzero if within a ({...}) grouping, in which case we must
- always compute a value for each expr-stmt in case it is the last one. */
-
-int expr_stmts_for_value;
-
-/* Each time we expand an expression-statement,
- record the expr's type and its RTL value here. */
-
-static tree last_expr_type;
-static rtx last_expr_value;
-
-/* Each time we expand the end of a binding contour (in `expand_end_bindings')
- and we emit a new NOTE_INSN_BLOCK_END note, we save a pointer to it here.
- This is used by the `remember_end_note' function to record the endpoint
- of each generated block in its associated BLOCK node. */
-
-static rtx last_block_end_note;
-
-/* Number of binding contours started so far in this function. */
-
-int block_start_count;
-
-/* Nonzero if function being compiled needs to
- return the address of where it has put a structure value. */
-
-extern int current_function_returns_pcc_struct;
-
-/* Label that will go on parm cleanup code, if any.
- Jumping to this label runs cleanup code for parameters, if
- such code must be run. Following this code is the logical return label. */
-
-extern rtx cleanup_label;
-
-/* Label that will go on function epilogue.
- Jumping to this label serves as a "return" instruction
- on machines which require execution of the epilogue on all returns. */
-
-extern rtx return_label;
-
-/* Offset to end of allocated area of stack frame.
- If stack grows down, this is the address of the last stack slot allocated.
- If stack grows up, this is the address for the next slot. */
-extern int frame_offset;
-
-/* Label to jump back to for tail recursion, or 0 if we have
- not yet needed one for this function. */
-extern rtx tail_recursion_label;
-
-/* Place after which to insert the tail_recursion_label if we need one. */
-extern rtx tail_recursion_reentry;
-
-/* Location at which to save the argument pointer if it will need to be
- referenced. There are two cases where this is done: if nonlocal gotos
- exist, or if vars whose is an offset from the argument pointer will be
- needed by inner routines. */
-
-extern rtx arg_pointer_save_area;
-
-/* Chain of all RTL_EXPRs that have insns in them. */
-extern tree rtl_expr_chain;
-
-#if 0 /* Turned off because 0 seems to work just as well. */
-/* Cleanup lists are required for binding levels regardless of whether
- that binding level has cleanups or not. This node serves as the
- cleanup list whenever an empty list is required. */
-static tree empty_cleanup_list;
-#endif
-
-/* Functions and data structures for expanding case statements. */
-
-/* Case label structure, used to hold info on labels within case
- statements. We handle "range" labels; for a single-value label
- as in C, the high and low limits are the same.
-
- An AVL tree of case nodes is initially created, and later transformed
- to a list linked via the RIGHT fields in the nodes. Nodes with
- higher case values are later in the list.
-
- Switch statements can be output in one of two forms. A branch table
- is used if there are more than a few labels and the labels are dense
- within the range between the smallest and largest case value. If a
- branch table is used, no further manipulations are done with the case
- node chain.
-
- The alternative to the use of a branch table is to generate a series
- of compare and jump insns. When that is done, we use the LEFT, RIGHT,
- and PARENT fields to hold a binary tree. Initially the tree is
- totally unbalanced, with everything on the right. We balance the tree
- with nodes on the left having lower case values than the parent
- and nodes on the right having higher values. We then output the tree
- in order. */
-
-struct case_node
-{
- struct case_node *left; /* Left son in binary tree */
- struct case_node *right; /* Right son in binary tree; also node chain */
- struct case_node *parent; /* Parent of node in binary tree */
- tree low; /* Lowest index value for this label */
- tree high; /* Highest index value for this label */
- tree code_label; /* Label to jump to when node matches */
- int balance;
-};
-
-typedef struct case_node case_node;
-typedef struct case_node *case_node_ptr;
-
-/* These are used by estimate_case_costs and balance_case_nodes. */
-
-/* This must be a signed type, and non-ANSI compilers lack signed char. */
-static short *cost_table;
-static int use_cost_table;
-
-/* Stack of control and binding constructs we are currently inside.
-
- These constructs begin when you call `expand_start_WHATEVER'
- and end when you call `expand_end_WHATEVER'. This stack records
- info about how the construct began that tells the end-function
- what to do. It also may provide information about the construct
- to alter the behavior of other constructs within the body.
- For example, they may affect the behavior of C `break' and `continue'.
-
- Each construct gets one `struct nesting' object.
- All of these objects are chained through the `all' field.
- `nesting_stack' points to the first object (innermost construct).
- The position of an entry on `nesting_stack' is in its `depth' field.
-
- Each type of construct has its own individual stack.
- For example, loops have `loop_stack'. Each object points to the
- next object of the same type through the `next' field.
-
- Some constructs are visible to `break' exit-statements and others
- are not. Which constructs are visible depends on the language.
- Therefore, the data structure allows each construct to be visible
- or not, according to the args given when the construct is started.
- The construct is visible if the `exit_label' field is non-null.
- In that case, the value should be a CODE_LABEL rtx. */
-
-struct nesting
-{
- struct nesting *all;
- struct nesting *next;
- int depth;
- rtx exit_label;
- union
- {
- /* For conds (if-then and if-then-else statements). */
- struct
- {
- /* Label for the end of the if construct.
- There is none if EXITFLAG was not set
- and no `else' has been seen yet. */
- rtx endif_label;
- /* Label for the end of this alternative.
- This may be the end of the if or the next else/elseif. */
- rtx next_label;
- } cond;
- /* For loops. */
- struct
- {
- /* Label at the top of the loop; place to loop back to. */
- rtx start_label;
- /* Label at the end of the whole construct. */
- rtx end_label;
- /* Label before a jump that branches to the end of the whole
- construct. This is where destructors go if any. */
- rtx alt_end_label;
- /* Label for `continue' statement to jump to;
- this is in front of the stepper of the loop. */
- rtx continue_label;
- } loop;
- /* For variable binding contours. */
- struct
- {
- /* Sequence number of this binding contour within the function,
- in order of entry. */
- int block_start_count;
- /* Nonzero => value to restore stack to on exit. Complemented by
- bc_stack_level (see below) when generating bytecodes. */
- rtx stack_level;
- /* The NOTE that starts this contour.
- Used by expand_goto to check whether the destination
- is within each contour or not. */
- rtx first_insn;
- /* Innermost containing binding contour that has a stack level. */
- struct nesting *innermost_stack_block;
- /* List of cleanups to be run on exit from this contour.
- This is a list of expressions to be evaluated.
- The TREE_PURPOSE of each link is the ..._DECL node
- which the cleanup pertains to. */
- tree cleanups;
- /* List of cleanup-lists of blocks containing this block,
- as they were at the locus where this block appears.
- There is an element for each containing block,
- ordered innermost containing block first.
- The tail of this list can be 0 (was empty_cleanup_list),
- if all remaining elements would be empty lists.
- The element's TREE_VALUE is the cleanup-list of that block,
- which may be null. */
- tree outer_cleanups;
- /* Chain of labels defined inside this binding contour.
- For contours that have stack levels or cleanups. */
- struct label_chain *label_chain;
- /* Number of function calls seen, as of start of this block. */
- int function_call_count;
- /* Bytecode specific: stack level to restore stack to on exit. */
- int bc_stack_level;
- } block;
- /* For switch (C) or case (Pascal) statements,
- and also for dummies (see `expand_start_case_dummy'). */
- struct
- {
- /* The insn after which the case dispatch should finally
- be emitted. Zero for a dummy. */
- rtx start;
- /* For bytecodes, the case table is in-lined right in the code.
- A label is needed for skipping over this block. It is only
- used when generating bytecodes. */
- rtx skip_label;
- /* A list of case labels; it is first built as an AVL tree.
- During expand_end_case, this is converted to a list, and may be
- rearranged into a nearly balanced binary tree. */
- struct case_node *case_list;
- /* Label to jump to if no case matches. */
- tree default_label;
- /* The expression to be dispatched on. */
- tree index_expr;
- /* Type that INDEX_EXPR should be converted to. */
- tree nominal_type;
- /* Number of range exprs in case statement. */
- int num_ranges;
- /* Name of this kind of statement, for warnings. */
- char *printname;
- /* Nonzero if a case label has been seen in this case stmt. */
- char seenlabel;
- } case_stmt;
- } data;
-};
-
-/* Chain of all pending binding contours. */
-struct nesting *block_stack;
-
-/* If any new stacks are added here, add them to POPSTACKS too. */
-
-/* Chain of all pending binding contours that restore stack levels
- or have cleanups. */
-struct nesting *stack_block_stack;
-
-/* Chain of all pending conditional statements. */
-struct nesting *cond_stack;
-
-/* Chain of all pending loops. */
-struct nesting *loop_stack;
-
-/* Chain of all pending case or switch statements. */
-struct nesting *case_stack;
-
-/* Separate chain including all of the above,
- chained through the `all' field. */
-struct nesting *nesting_stack;
-
-/* Number of entries on nesting_stack now. */
-int nesting_depth;
-
-/* Allocate and return a new `struct nesting'. */
-
-#define ALLOC_NESTING() \
- (struct nesting *) obstack_alloc (&stmt_obstack, sizeof (struct nesting))
-
-/* Pop the nesting stack element by element until we pop off
- the element which is at the top of STACK.
- Update all the other stacks, popping off elements from them
- as we pop them from nesting_stack. */
-
-#define POPSTACK(STACK) \
-do { struct nesting *target = STACK; \
- struct nesting *this; \
- do { this = nesting_stack; \
- if (loop_stack == this) \
- loop_stack = loop_stack->next; \
- if (cond_stack == this) \
- cond_stack = cond_stack->next; \
- if (block_stack == this) \
- block_stack = block_stack->next; \
- if (stack_block_stack == this) \
- stack_block_stack = stack_block_stack->next; \
- if (case_stack == this) \
- case_stack = case_stack->next; \
- nesting_depth = nesting_stack->depth - 1; \
- nesting_stack = this->all; \
- obstack_free (&stmt_obstack, this); } \
- while (this != target); } while (0)
-
-/* In some cases it is impossible to generate code for a forward goto
- until the label definition is seen. This happens when it may be necessary
- for the goto to reset the stack pointer: we don't yet know how to do that.
- So expand_goto puts an entry on this fixup list.
- Each time a binding contour that resets the stack is exited,
- we check each fixup.
- If the target label has now been defined, we can insert the proper code. */
-
-struct goto_fixup
-{
- /* Points to following fixup. */
- struct goto_fixup *next;
- /* Points to the insn before the jump insn.
- If more code must be inserted, it goes after this insn. */
- rtx before_jump;
- /* The LABEL_DECL that this jump is jumping to, or 0
- for break, continue or return. */
- tree target;
- /* The BLOCK for the place where this goto was found. */
- tree context;
- /* The CODE_LABEL rtx that this is jumping to. */
- rtx target_rtl;
- /* Number of binding contours started in current function
- before the label reference. */
- int block_start_count;
- /* The outermost stack level that should be restored for this jump.
- Each time a binding contour that resets the stack is exited,
- if the target label is *not* yet defined, this slot is updated. */
- rtx stack_level;
- /* List of lists of cleanup expressions to be run by this goto.
- There is one element for each block that this goto is within.
- The tail of this list can be 0 (was empty_cleanup_list),
- if all remaining elements would be empty.
- The TREE_VALUE contains the cleanup list of that block as of the
- time this goto was seen.
- The TREE_ADDRESSABLE flag is 1 for a block that has been exited. */
- tree cleanup_list_list;
-
- /* Bytecode specific members follow */
-
- /* The label that this jump is jumping to, or 0 for break, continue
- or return. */
- struct bc_label *bc_target;
-
- /* The label we use for the fixup patch */
- struct bc_label *label;
-
- /* True (non-0) if fixup has been handled */
- int bc_handled:1;
-
- /* Like stack_level above, except refers to the interpreter stack */
- int bc_stack_level;
-};
-
-static struct goto_fixup *goto_fixup_chain;
-
-/* Within any binding contour that must restore a stack level,
- all labels are recorded with a chain of these structures. */
-
-struct label_chain
-{
- /* Points to following fixup. */
- struct label_chain *next;
- tree label;
-};
-static void expand_goto_internal PROTO((tree, rtx, rtx));
-static void bc_expand_goto_internal PROTO((enum bytecode_opcode,
- struct bc_label *, tree));
-static int expand_fixup PROTO((tree, rtx, rtx));
-static void bc_expand_fixup PROTO((enum bytecode_opcode,
- struct bc_label *, int));
-static void fixup_gotos PROTO((struct nesting *, rtx, tree,
- rtx, int));
-static void bc_fixup_gotos PROTO((struct nesting *, int, tree,
- rtx, int));
-static void bc_expand_start_cond PROTO((tree, int));
-static void bc_expand_end_cond PROTO((void));
-static void bc_expand_start_else PROTO((void));
-static void bc_expand_end_loop PROTO((void));
-static void bc_expand_end_bindings PROTO((tree, int, int));
-static void bc_expand_decl PROTO((tree, tree));
-static void bc_expand_variable_local_init PROTO((tree));
-static void bc_expand_decl_init PROTO((tree));
-static void expand_null_return_1 PROTO((rtx, int));
-static void expand_value_return PROTO((rtx));
-static int tail_recursion_args PROTO((tree, tree));
-static void expand_cleanups PROTO((tree, tree, int, int));
-static void bc_expand_start_case PROTO((struct nesting *, tree,
- tree, char *));
-static int bc_pushcase PROTO((tree, tree));
-static void bc_check_for_full_enumeration_handling PROTO((tree));
-static void bc_expand_end_case PROTO((tree));
-static void do_jump_if_equal PROTO((rtx, rtx, rtx, int));
-static int estimate_case_costs PROTO((case_node_ptr));
-static void group_case_nodes PROTO((case_node_ptr));
-static void balance_case_nodes PROTO((case_node_ptr *,
- case_node_ptr));
-static int node_has_low_bound PROTO((case_node_ptr, tree));
-static int node_has_high_bound PROTO((case_node_ptr, tree));
-static int node_is_bounded PROTO((case_node_ptr, tree));
-static void emit_jump_if_reachable PROTO((rtx));
-static void emit_case_nodes PROTO((rtx, case_node_ptr, rtx, tree));
-static int add_case_node PROTO((tree, tree, tree, tree *));
-static struct case_node *case_tree2list PROTO((case_node *, case_node *));
-
-extern rtx bc_allocate_local ();
-extern rtx bc_allocate_variable_array ();
-
-void
-init_stmt ()
-{
- gcc_obstack_init (&stmt_obstack);
- init_eh ();
-}
-
-void
-init_stmt_for_function ()
-{
- /* We are not currently within any block, conditional, loop or case. */
- block_stack = 0;
- stack_block_stack = 0;
- loop_stack = 0;
- case_stack = 0;
- cond_stack = 0;
- nesting_stack = 0;
- nesting_depth = 0;
-
- block_start_count = 0;
-
- /* No gotos have been expanded yet. */
- goto_fixup_chain = 0;
-
- /* We are not processing a ({...}) grouping. */
- expr_stmts_for_value = 0;
- last_expr_type = 0;
-
- init_eh_for_function ();
-}
-
-void
-save_stmt_status (p)
- struct function *p;
-{
- p->block_stack = block_stack;
- p->stack_block_stack = stack_block_stack;
- p->cond_stack = cond_stack;
- p->loop_stack = loop_stack;
- p->case_stack = case_stack;
- p->nesting_stack = nesting_stack;
- p->nesting_depth = nesting_depth;
- p->block_start_count = block_start_count;
- p->last_expr_type = last_expr_type;
- p->last_expr_value = last_expr_value;
- p->expr_stmts_for_value = expr_stmts_for_value;
- p->emit_filename = emit_filename;
- p->emit_lineno = emit_lineno;
- p->goto_fixup_chain = goto_fixup_chain;
- save_eh_status (p);
-}
-
-void
-restore_stmt_status (p)
- struct function *p;
-{
- block_stack = p->block_stack;
- stack_block_stack = p->stack_block_stack;
- cond_stack = p->cond_stack;
- loop_stack = p->loop_stack;
- case_stack = p->case_stack;
- nesting_stack = p->nesting_stack;
- nesting_depth = p->nesting_depth;
- block_start_count = p->block_start_count;
- last_expr_type = p->last_expr_type;
- last_expr_value = p->last_expr_value;
- expr_stmts_for_value = p->expr_stmts_for_value;
- emit_filename = p->emit_filename;
- emit_lineno = p->emit_lineno;
- goto_fixup_chain = p->goto_fixup_chain;
- restore_eh_status (p);
-}
-
-/* Emit a no-op instruction. */
-
-void
-emit_nop ()
-{
- rtx last_insn;
-
- if (!output_bytecode)
- {
- last_insn = get_last_insn ();
- if (!optimize
- && (GET_CODE (last_insn) == CODE_LABEL
- || (GET_CODE (last_insn) == NOTE
- && prev_real_insn (last_insn) == 0)))
- emit_insn (gen_nop ());
- }
-}
-
-/* Return the rtx-label that corresponds to a LABEL_DECL,
- creating it if necessary. */
-
-rtx
-label_rtx (label)
- tree label;
-{
- if (TREE_CODE (label) != LABEL_DECL)
- abort ();
-
- if (DECL_RTL (label))
- return DECL_RTL (label);
-
- return DECL_RTL (label) = gen_label_rtx ();
-}
-
-/* Add an unconditional jump to LABEL as the next sequential instruction. */
-
-void
-emit_jump (label)
- rtx label;
-{
- do_pending_stack_adjust ();
- emit_jump_insn (gen_jump (label));
- emit_barrier ();
-}
-
-/* Emit code to jump to the address
- specified by the pointer expression EXP. */
-
-void
-expand_computed_goto (exp)
- tree exp;
-{
- if (output_bytecode)
- {
- bc_expand_expr (exp);
- bc_emit_instruction (jumpP);
- }
- else
- {
- rtx x = expand_expr (exp, NULL_RTX, VOIDmode, 0);
-
-#ifdef POINTERS_EXTEND_UNSIGNED
- x = convert_memory_address (Pmode, x);
-#endif
-
- emit_queue ();
- do_pending_stack_adjust ();
- emit_indirect_jump (x);
- }
-}
-
-/* Handle goto statements and the labels that they can go to. */
-
-/* Specify the location in the RTL code of a label LABEL,
- which is a LABEL_DECL tree node.
-
- This is used for the kind of label that the user can jump to with a
- goto statement, and for alternatives of a switch or case statement.
- RTL labels generated for loops and conditionals don't go through here;
- they are generated directly at the RTL level, by other functions below.
-
- Note that this has nothing to do with defining label *names*.
- Languages vary in how they do that and what that even means. */
-
-void
-expand_label (label)
- tree label;
-{
- struct label_chain *p;
-
- if (output_bytecode)
- {
- if (! DECL_RTL (label))
- DECL_RTL (label) = bc_gen_rtx ((char *) 0, 0, bc_get_bytecode_label ());
- if (! bc_emit_bytecode_labeldef (BYTECODE_BC_LABEL (DECL_RTL (label))))
- error ("multiply defined label");
- return;
- }
-
- do_pending_stack_adjust ();
- emit_label (label_rtx (label));
- if (DECL_NAME (label))
- LABEL_NAME (DECL_RTL (label)) = IDENTIFIER_POINTER (DECL_NAME (label));
-
- if (stack_block_stack != 0)
- {
- p = (struct label_chain *) oballoc (sizeof (struct label_chain));
- p->next = stack_block_stack->data.block.label_chain;
- stack_block_stack->data.block.label_chain = p;
- p->label = label;
- }
-}
-
-/* Declare that LABEL (a LABEL_DECL) may be used for nonlocal gotos
- from nested functions. */
-
-void
-declare_nonlocal_label (label)
- tree label;
-{
- nonlocal_labels = tree_cons (NULL_TREE, label, nonlocal_labels);
- LABEL_PRESERVE_P (label_rtx (label)) = 1;
- if (nonlocal_goto_handler_slot == 0)
- {
- nonlocal_goto_handler_slot
- = assign_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0);
- emit_stack_save (SAVE_NONLOCAL,
- &nonlocal_goto_stack_level,
- PREV_INSN (tail_recursion_reentry));
- }
-}
-
-/* Generate RTL code for a `goto' statement with target label LABEL.
- LABEL should be a LABEL_DECL tree node that was or will later be
- defined with `expand_label'. */
-
-void
-expand_goto (label)
- tree label;
-{
- tree context;
-
- if (output_bytecode)
- {
- expand_goto_internal (label, label_rtx (label), NULL_RTX);
- return;
- }
-
- /* Check for a nonlocal goto to a containing function. */
- context = decl_function_context (label);
- if (context != 0 && context != current_function_decl)
- {
- struct function *p = find_function_data (context);
- rtx label_ref = gen_rtx (LABEL_REF, Pmode, label_rtx (label));
- rtx temp;
-
- p->has_nonlocal_label = 1;
- current_function_has_nonlocal_goto = 1;
- LABEL_REF_NONLOCAL_P (label_ref) = 1;
-
- /* Copy the rtl for the slots so that they won't be shared in
- case the virtual stack vars register gets instantiated differently
- in the parent than in the child. */
-
-#if HAVE_nonlocal_goto
- if (HAVE_nonlocal_goto)
- emit_insn (gen_nonlocal_goto (lookup_static_chain (label),
- copy_rtx (p->nonlocal_goto_handler_slot),
- copy_rtx (p->nonlocal_goto_stack_level),
- label_ref));
- else
-#endif
- {
- rtx addr;
-
- /* Restore frame pointer for containing function.
- This sets the actual hard register used for the frame pointer
- to the location of the function's incoming static chain info.
- The non-local goto handler will then adjust it to contain the
- proper value and reload the argument pointer, if needed. */
- emit_move_insn (hard_frame_pointer_rtx, lookup_static_chain (label));
-
- /* We have now loaded the frame pointer hardware register with
- the address of that corresponds to the start of the virtual
- stack vars. So replace virtual_stack_vars_rtx in all
- addresses we use with stack_pointer_rtx. */
-
- /* Get addr of containing function's current nonlocal goto handler,
- which will do any cleanups and then jump to the label. */
- addr = copy_rtx (p->nonlocal_goto_handler_slot);
- temp = copy_to_reg (replace_rtx (addr, virtual_stack_vars_rtx,
- hard_frame_pointer_rtx));
-
- /* Restore the stack pointer. Note this uses fp just restored. */
- addr = p->nonlocal_goto_stack_level;
- if (addr)
- addr = replace_rtx (copy_rtx (addr),
- virtual_stack_vars_rtx,
- hard_frame_pointer_rtx);
-
- emit_stack_restore (SAVE_NONLOCAL, addr, NULL_RTX);
-
- /* Put in the static chain register the nonlocal label address. */
- emit_move_insn (static_chain_rtx, label_ref);
- /* USE of hard_frame_pointer_rtx added for consistency; not clear if
- really needed. */
- emit_insn (gen_rtx (USE, VOIDmode, hard_frame_pointer_rtx));
- emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
- emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
- emit_indirect_jump (temp);
- }
- }
- else
- expand_goto_internal (label, label_rtx (label), NULL_RTX);
-}
-
-/* Generate RTL code for a `goto' statement with target label BODY.
- LABEL should be a LABEL_REF.
- LAST_INSN, if non-0, is the rtx we should consider as the last
- insn emitted (for the purposes of cleaning up a return). */
-
-static void
-expand_goto_internal (body, label, last_insn)
- tree body;
- rtx label;
- rtx last_insn;
-{
- struct nesting *block;
- rtx stack_level = 0;
-
- /* NOTICE! If a bytecode instruction other than `jump' is needed,
- then the caller has to call bc_expand_goto_internal()
- directly. This is rather an exceptional case, and there aren't
- that many places where this is necessary. */
- if (output_bytecode)
- {
- expand_goto_internal (body, label, last_insn);
- return;
- }
-
- if (GET_CODE (label) != CODE_LABEL)
- abort ();
-
- /* If label has already been defined, we can tell now
- whether and how we must alter the stack level. */
-
- if (PREV_INSN (label) != 0)
- {
- /* Find the innermost pending block that contains the label.
- (Check containment by comparing insn-uids.)
- Then restore the outermost stack level within that block,
- and do cleanups of all blocks contained in it. */
- for (block = block_stack; block; block = block->next)
- {
- if (INSN_UID (block->data.block.first_insn) < INSN_UID (label))
- break;
- if (block->data.block.stack_level != 0)
- stack_level = block->data.block.stack_level;
- /* Execute the cleanups for blocks we are exiting. */
- if (block->data.block.cleanups != 0)
- {
- expand_cleanups (block->data.block.cleanups, NULL_TREE, 1, 1);
- do_pending_stack_adjust ();
- }
- }
-
- if (stack_level)
- {
- /* Ensure stack adjust isn't done by emit_jump, as this
- would clobber the stack pointer. This one should be
- deleted as dead by flow. */
- clear_pending_stack_adjust ();
- do_pending_stack_adjust ();
- emit_stack_restore (SAVE_BLOCK, stack_level, NULL_RTX);
- }
-
- if (body != 0 && DECL_TOO_LATE (body))
- error ("jump to `%s' invalidly jumps into binding contour",
- IDENTIFIER_POINTER (DECL_NAME (body)));
- }
- /* Label not yet defined: may need to put this goto
- on the fixup list. */
- else if (! expand_fixup (body, label, last_insn))
- {
- /* No fixup needed. Record that the label is the target
- of at least one goto that has no fixup. */
- if (body != 0)
- TREE_ADDRESSABLE (body) = 1;
- }
-
- emit_jump (label);
-}
-
-/* Generate a jump with OPCODE to the given bytecode LABEL which is
- found within BODY. */
-
-static void
-bc_expand_goto_internal (opcode, label, body)
- enum bytecode_opcode opcode;
- struct bc_label *label;
- tree body;
-{
- struct nesting *block;
- int stack_level = -1;
-
- /* If the label is defined, adjust the stack as necessary.
- If it's not defined, we have to push the reference on the
- fixup list. */
-
- if (label->defined)
- {
-
- /* Find the innermost pending block that contains the label.
- (Check containment by comparing bytecode uids.) Then restore the
- outermost stack level within that block. */
-
- for (block = block_stack; block; block = block->next)
- {
- if (BYTECODE_BC_LABEL (block->data.block.first_insn)->uid < label->uid)
- break;
- if (block->data.block.bc_stack_level)
- stack_level = block->data.block.bc_stack_level;
-
- /* Execute the cleanups for blocks we are exiting. */
- if (block->data.block.cleanups != 0)
- {
- expand_cleanups (block->data.block.cleanups, NULL_TREE, 1, 1);
- do_pending_stack_adjust ();
- }
- }
-
- /* Restore the stack level. If we need to adjust the stack, we
- must do so after the jump, since the jump may depend on
- what's on the stack. Thus, any stack-modifying conditional
- jumps (these are the only ones that rely on what's on the
- stack) go into the fixup list. */
-
- if (stack_level >= 0
- && stack_depth != stack_level
- && opcode != jump)
-
- bc_expand_fixup (opcode, label, stack_level);
- else
- {
- if (stack_level >= 0)
- bc_adjust_stack (stack_depth - stack_level);
-
- if (body && DECL_BIT_FIELD (body))
- error ("jump to `%s' invalidly jumps into binding contour",
- IDENTIFIER_POINTER (DECL_NAME (body)));
-
- /* Emit immediate jump */
- bc_emit_bytecode (opcode);
- bc_emit_bytecode_labelref (label);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
- }
- }
- else
- /* Put goto in the fixup list */
- bc_expand_fixup (opcode, label, stack_level);
-}
-
-/* Generate if necessary a fixup for a goto
- whose target label in tree structure (if any) is TREE_LABEL
- and whose target in rtl is RTL_LABEL.
-
- If LAST_INSN is nonzero, we pretend that the jump appears
- after insn LAST_INSN instead of at the current point in the insn stream.
-
- The fixup will be used later to insert insns just before the goto.
- Those insns will restore the stack level as appropriate for the
- target label, and will (in the case of C++) also invoke any object
- destructors which have to be invoked when we exit the scopes which
- are exited by the goto.
-
- Value is nonzero if a fixup is made. */
-
-static int
-expand_fixup (tree_label, rtl_label, last_insn)
- tree tree_label;
- rtx rtl_label;
- rtx last_insn;
-{
- struct nesting *block, *end_block;
-
- /* See if we can recognize which block the label will be output in.
- This is possible in some very common cases.
- If we succeed, set END_BLOCK to that block.
- Otherwise, set it to 0. */
-
- if (cond_stack
- && (rtl_label == cond_stack->data.cond.endif_label
- || rtl_label == cond_stack->data.cond.next_label))
- end_block = cond_stack;
- /* If we are in a loop, recognize certain labels which
- are likely targets. This reduces the number of fixups
- we need to create. */
- else if (loop_stack
- && (rtl_label == loop_stack->data.loop.start_label
- || rtl_label == loop_stack->data.loop.end_label
- || rtl_label == loop_stack->data.loop.continue_label))
- end_block = loop_stack;
- else
- end_block = 0;
-
- /* Now set END_BLOCK to the binding level to which we will return. */
-
- if (end_block)
- {
- struct nesting *next_block = end_block->all;
- block = block_stack;
-
- /* First see if the END_BLOCK is inside the innermost binding level.
- If so, then no cleanups or stack levels are relevant. */
- while (next_block && next_block != block)
- next_block = next_block->all;
-
- if (next_block)
- return 0;
-
- /* Otherwise, set END_BLOCK to the innermost binding level
- which is outside the relevant control-structure nesting. */
- next_block = block_stack->next;
- for (block = block_stack; block != end_block; block = block->all)
- if (block == next_block)
- next_block = next_block->next;
- end_block = next_block;
- }
-
- /* Does any containing block have a stack level or cleanups?
- If not, no fixup is needed, and that is the normal case
- (the only case, for standard C). */
- for (block = block_stack; block != end_block; block = block->next)
- if (block->data.block.stack_level != 0
- || block->data.block.cleanups != 0)
- break;
-
- if (block != end_block)
- {
- /* Ok, a fixup is needed. Add a fixup to the list of such. */
- struct goto_fixup *fixup
- = (struct goto_fixup *) oballoc (sizeof (struct goto_fixup));
- /* In case an old stack level is restored, make sure that comes
- after any pending stack adjust. */
- /* ?? If the fixup isn't to come at the present position,
- doing the stack adjust here isn't useful. Doing it with our
- settings at that location isn't useful either. Let's hope
- someone does it! */
- if (last_insn == 0)
- do_pending_stack_adjust ();
- fixup->target = tree_label;
- fixup->target_rtl = rtl_label;
-
- /* Create a BLOCK node and a corresponding matched set of
- NOTE_INSN_BEGIN_BLOCK and NOTE_INSN_END_BLOCK notes at
- this point. The notes will encapsulate any and all fixup
- code which we might later insert at this point in the insn
- stream. Also, the BLOCK node will be the parent (i.e. the
- `SUPERBLOCK') of any other BLOCK nodes which we might create
- later on when we are expanding the fixup code. */
-
- {
- register rtx original_before_jump
- = last_insn ? last_insn : get_last_insn ();
-
- start_sequence ();
- pushlevel (0);
- fixup->before_jump = emit_note (NULL_PTR, NOTE_INSN_BLOCK_BEG);
- last_block_end_note = emit_note (NULL_PTR, NOTE_INSN_BLOCK_END);
- fixup->context = poplevel (1, 0, 0); /* Create the BLOCK node now! */
- end_sequence ();
- emit_insns_after (fixup->before_jump, original_before_jump);
- }
-
- fixup->block_start_count = block_start_count;
- fixup->stack_level = 0;
- fixup->cleanup_list_list
- = (((block->data.block.outer_cleanups
-#if 0
- && block->data.block.outer_cleanups != empty_cleanup_list
-#endif
- )
- || block->data.block.cleanups)
- ? tree_cons (NULL_TREE, block->data.block.cleanups,
- block->data.block.outer_cleanups)
- : 0);
- fixup->next = goto_fixup_chain;
- goto_fixup_chain = fixup;
- }
-
- return block != 0;
-}
-
-
-/* Generate bytecode jump with OPCODE to a fixup routine that links to LABEL.
- Make the fixup restore the stack level to STACK_LEVEL. */
-
-static void
-bc_expand_fixup (opcode, label, stack_level)
- enum bytecode_opcode opcode;
- struct bc_label *label;
- int stack_level;
-{
- struct goto_fixup *fixup
- = (struct goto_fixup *) oballoc (sizeof (struct goto_fixup));
-
- fixup->label = bc_get_bytecode_label ();
- fixup->bc_target = label;
- fixup->bc_stack_level = stack_level;
- fixup->bc_handled = FALSE;
-
- fixup->next = goto_fixup_chain;
- goto_fixup_chain = fixup;
-
- /* Insert a jump to the fixup code */
- bc_emit_bytecode (opcode);
- bc_emit_bytecode_labelref (fixup->label);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-}
-
-/* Expand any needed fixups in the outputmost binding level of the
- function. FIRST_INSN is the first insn in the function. */
-
-void
-expand_fixups (first_insn)
- rtx first_insn;
-{
- fixup_gotos (NULL_PTR, NULL_RTX, NULL_TREE, first_insn, 0);
-}
-
-/* When exiting a binding contour, process all pending gotos requiring fixups.
- THISBLOCK is the structure that describes the block being exited.
- STACK_LEVEL is the rtx for the stack level to restore exiting this contour.
- CLEANUP_LIST is a list of expressions to evaluate on exiting this contour.
- FIRST_INSN is the insn that began this contour.
-
- Gotos that jump out of this contour must restore the
- stack level and do the cleanups before actually jumping.
-
- DONT_JUMP_IN nonzero means report error there is a jump into this
- contour from before the beginning of the contour.
- This is also done if STACK_LEVEL is nonzero. */
-
-static void
-fixup_gotos (thisblock, stack_level, cleanup_list, first_insn, dont_jump_in)
- struct nesting *thisblock;
- rtx stack_level;
- tree cleanup_list;
- rtx first_insn;
- int dont_jump_in;
-{
- register struct goto_fixup *f, *prev;
-
- if (output_bytecode)
- {
- /* ??? The second arg is the bc stack level, which is not the same
- as STACK_LEVEL. I have no idea what should go here, so I'll
- just pass 0. */
- bc_fixup_gotos (thisblock, 0, cleanup_list, first_insn, dont_jump_in);
- return;
- }
-
- /* F is the fixup we are considering; PREV is the previous one. */
- /* We run this loop in two passes so that cleanups of exited blocks
- are run first, and blocks that are exited are marked so
- afterwards. */
-
- for (prev = 0, f = goto_fixup_chain; f; prev = f, f = f->next)
- {
- /* Test for a fixup that is inactive because it is already handled. */
- if (f->before_jump == 0)
- {
- /* Delete inactive fixup from the chain, if that is easy to do. */
- if (prev != 0)
- prev->next = f->next;
- }
- /* Has this fixup's target label been defined?
- If so, we can finalize it. */
- else if (PREV_INSN (f->target_rtl) != 0)
- {
- register rtx cleanup_insns;
-
- /* Get the first non-label after the label
- this goto jumps to. If that's before this scope begins,
- we don't have a jump into the scope. */
- rtx after_label = f->target_rtl;
- while (after_label != 0 && GET_CODE (after_label) == CODE_LABEL)
- after_label = NEXT_INSN (after_label);
-
- /* If this fixup jumped into this contour from before the beginning
- of this contour, report an error. */
- /* ??? Bug: this does not detect jumping in through intermediate
- blocks that have stack levels or cleanups.
- It detects only a problem with the innermost block
- around the label. */
- if (f->target != 0
- && (dont_jump_in || stack_level || cleanup_list)
- /* If AFTER_LABEL is 0, it means the jump goes to the end
- of the rtl, which means it jumps into this scope. */
- && (after_label == 0
- || INSN_UID (first_insn) < INSN_UID (after_label))
- && INSN_UID (first_insn) > INSN_UID (f->before_jump)
- && ! DECL_ERROR_ISSUED (f->target))
- {
- error_with_decl (f->target,
- "label `%s' used before containing binding contour");
- /* Prevent multiple errors for one label. */
- DECL_ERROR_ISSUED (f->target) = 1;
- }
-
- /* We will expand the cleanups into a sequence of their own and
- then later on we will attach this new sequence to the insn
- stream just ahead of the actual jump insn. */
-
- start_sequence ();
-
- /* Temporarily restore the lexical context where we will
- logically be inserting the fixup code. We do this for the
- sake of getting the debugging information right. */
-
- pushlevel (0);
- set_block (f->context);
-
- /* Expand the cleanups for blocks this jump exits. */
- if (f->cleanup_list_list)
- {
- tree lists;
- for (lists = f->cleanup_list_list; lists; lists = TREE_CHAIN (lists))
- /* Marked elements correspond to blocks that have been closed.
- Do their cleanups. */
- if (TREE_ADDRESSABLE (lists)
- && TREE_VALUE (lists) != 0)
- {
- expand_cleanups (TREE_VALUE (lists), NULL_TREE, 1, 1);
- /* Pop any pushes done in the cleanups,
- in case function is about to return. */
- do_pending_stack_adjust ();
- }
- }
-
- /* Restore stack level for the biggest contour that this
- jump jumps out of. */
- if (f->stack_level)
- emit_stack_restore (SAVE_BLOCK, f->stack_level, f->before_jump);
-
- /* Finish up the sequence containing the insns which implement the
- necessary cleanups, and then attach that whole sequence to the
- insn stream just ahead of the actual jump insn. Attaching it
- at that point insures that any cleanups which are in fact
- implicit C++ object destructions (which must be executed upon
- leaving the block) appear (to the debugger) to be taking place
- in an area of the generated code where the object(s) being
- destructed are still "in scope". */
-
- cleanup_insns = get_insns ();
- poplevel (1, 0, 0);
-
- end_sequence ();
- emit_insns_after (cleanup_insns, f->before_jump);
-
-
- f->before_jump = 0;
- }
- }
-
- /* For any still-undefined labels, do the cleanups for this block now.
- We must do this now since items in the cleanup list may go out
- of scope when the block ends. */
- for (prev = 0, f = goto_fixup_chain; f; prev = f, f = f->next)
- if (f->before_jump != 0
- && PREV_INSN (f->target_rtl) == 0
- /* Label has still not appeared. If we are exiting a block with
- a stack level to restore, that started before the fixup,
- mark this stack level as needing restoration
- when the fixup is later finalized. */
- && thisblock != 0
- /* Note: if THISBLOCK == 0 and we have a label that hasn't appeared, it
- means the label is undefined. That's erroneous, but possible. */
- && (thisblock->data.block.block_start_count
- <= f->block_start_count))
- {
- tree lists = f->cleanup_list_list;
- rtx cleanup_insns;
-
- for (; lists; lists = TREE_CHAIN (lists))
- /* If the following elt. corresponds to our containing block
- then the elt. must be for this block. */
- if (TREE_CHAIN (lists) == thisblock->data.block.outer_cleanups)
- {
- start_sequence ();
- pushlevel (0);
- set_block (f->context);
- expand_cleanups (TREE_VALUE (lists), NULL_TREE, 1, 1);
- do_pending_stack_adjust ();
- cleanup_insns = get_insns ();
- poplevel (1, 0, 0);
- end_sequence ();
- if (cleanup_insns != 0)
- f->before_jump
- = emit_insns_after (cleanup_insns, f->before_jump);
-
- f->cleanup_list_list = TREE_CHAIN (lists);
- }
-
- if (stack_level)
- f->stack_level = stack_level;
- }
-}
-
-
-/* When exiting a binding contour, process all pending gotos requiring fixups.
- Note: STACK_DEPTH is not altered.
-
- The arguments are currently not used in the bytecode compiler, but we may
- need them one day for languages other than C.
-
- THISBLOCK is the structure that describes the block being exited.
- STACK_LEVEL is the rtx for the stack level to restore exiting this contour.
- CLEANUP_LIST is a list of expressions to evaluate on exiting this contour.
- FIRST_INSN is the insn that began this contour.
-
- Gotos that jump out of this contour must restore the
- stack level and do the cleanups before actually jumping.
-
- DONT_JUMP_IN nonzero means report error there is a jump into this
- contour from before the beginning of the contour.
- This is also done if STACK_LEVEL is nonzero. */
-
-static void
-bc_fixup_gotos (thisblock, stack_level, cleanup_list, first_insn, dont_jump_in)
- struct nesting *thisblock;
- int stack_level;
- tree cleanup_list;
- rtx first_insn;
- int dont_jump_in;
-{
- register struct goto_fixup *f, *prev;
- int saved_stack_depth;
-
- /* F is the fixup we are considering; PREV is the previous one. */
-
- for (prev = 0, f = goto_fixup_chain; f; prev = f, f = f->next)
- {
- /* Test for a fixup that is inactive because it is already handled. */
- if (f->before_jump == 0)
- {
- /* Delete inactive fixup from the chain, if that is easy to do. */
- if (prev)
- prev->next = f->next;
- }
-
- /* Emit code to restore the stack and continue */
- bc_emit_bytecode_labeldef (f->label);
-
- /* Save stack_depth across call, since bc_adjust_stack () will alter
- the perceived stack depth via the instructions generated. */
-
- if (f->bc_stack_level >= 0)
- {
- saved_stack_depth = stack_depth;
- bc_adjust_stack (stack_depth - f->bc_stack_level);
- stack_depth = saved_stack_depth;
- }
-
- bc_emit_bytecode (jump);
- bc_emit_bytecode_labelref (f->bc_target);
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
- }
-
- goto_fixup_chain = NULL;
-}
-
-/* Generate RTL for an asm statement (explicit assembler code).
- BODY is a STRING_CST node containing the assembler code text,
- or an ADDR_EXPR containing a STRING_CST. */
-
-void
-expand_asm (body)
- tree body;
-{
- if (output_bytecode)
- {
- error ("`asm' is invalid when generating bytecode");
- return;
- }
-
- if (TREE_CODE (body) == ADDR_EXPR)
- body = TREE_OPERAND (body, 0);
-
- emit_insn (gen_rtx (ASM_INPUT, VOIDmode,
- TREE_STRING_POINTER (body)));
- last_expr_type = 0;
-}
-
-/* Generate RTL for an asm statement with arguments.
- STRING is the instruction template.
- OUTPUTS is a list of output arguments (lvalues); INPUTS a list of inputs.
- Each output or input has an expression in the TREE_VALUE and
- a constraint-string in the TREE_PURPOSE.
- CLOBBERS is a list of STRING_CST nodes each naming a hard register
- that is clobbered by this insn.
-
- Not all kinds of lvalue that may appear in OUTPUTS can be stored directly.
- Some elements of OUTPUTS may be replaced with trees representing temporary
- values. The caller should copy those temporary values to the originally
- specified lvalues.
-
- VOL nonzero means the insn is volatile; don't optimize it. */
-
-void
-expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
- tree string, outputs, inputs, clobbers;
- int vol;
- char *filename;
- int line;
-{
- rtvec argvec, constraints;
- rtx body;
- int ninputs = list_length (inputs);
- int noutputs = list_length (outputs);
- int ninout = 0;
- int nclobbers;
- tree tail;
- register int i;
- /* Vector of RTX's of evaluated output operands. */
- rtx *output_rtx = (rtx *) alloca (noutputs * sizeof (rtx));
- int *inout_opnum = (int *) alloca (noutputs * sizeof (int));
- enum machine_mode *inout_mode
- = (enum machine_mode *) alloca (noutputs * sizeof (enum machine_mode));
- /* The insn we have emitted. */
- rtx insn;
-
- if (output_bytecode)
- {
- error ("`asm' is invalid when generating bytecode");
- return;
- }
-
- /* Count the number of meaningful clobbered registers, ignoring what
- we would ignore later. */
- nclobbers = 0;
- for (tail = clobbers; tail; tail = TREE_CHAIN (tail))
- {
- char *regname = TREE_STRING_POINTER (TREE_VALUE (tail));
- i = decode_reg_name (regname);
- if (i >= 0 || i == -4)
- ++nclobbers;
- else if (i == -2)
- error ("unknown register name `%s' in `asm'", regname);
- }
-
- last_expr_type = 0;
-
- for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
- {
- tree val = TREE_VALUE (tail);
- tree type = TREE_TYPE (val);
- tree val1;
- int j;
- int found_equal = 0;
- int found_plus = 0;
- int allows_reg = 0;
-
- /* If there's an erroneous arg, emit no insn. */
- if (TREE_TYPE (val) == error_mark_node)
- return;
-
- /* Make sure constraint has `=' and does not have `+'. Also, see
- if it allows any register. Be liberal on the latter test, since
- the worst that happens if we get it wrong is we issue an error
- message. */
-
- for (j = 0; j < TREE_STRING_LENGTH (TREE_PURPOSE (tail)) - 1; j++)
- switch (TREE_STRING_POINTER (TREE_PURPOSE (tail))[j])
- {
- case '+':
- /* Make sure we can specify the matching operand. */
- if (i > 9)
- {
- error ("output operand constraint %d contains `+'", i);
- return;
- }
-
- /* Replace '+' with '='. */
- TREE_STRING_POINTER (TREE_PURPOSE (tail))[j] = '=';
- found_plus = 1;
- break;
-
- case '=':
- found_equal = 1;
- break;
-
- case '?': case '!': case '*': case '%': case '&':
- case 'V': case 'm': case 'o': case '<': case '>':
- case 'E': case 'F': case 'G': case 'H': case 'X':
- case 's': case 'i': case 'n':
- case 'I': case 'J': case 'K': case 'L': case 'M':
- case 'N': case 'O': case 'P': case ',':
-#ifdef EXTRA_CONSTRAINT
- case 'Q': case 'R': case 'S': case 'T': case 'U':
-#endif
- break;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- error ("matching constraint not valid in output operand");
- break;
-
- case 'p': case 'g': case 'r':
- default:
- allows_reg = 1;
- break;
- }
-
- if (! found_equal && ! found_plus)
- {
- error ("output operand constraint lacks `='");
- return;
- }
-
- /* If an output operand is not a decl or indirect ref and our constraint
- allows a register, make a temporary to act as an intermediate.
- Make the asm insn write into that, then our caller will copy it to
- the real output operand. Likewise for promoted variables. */
-
- if (TREE_CODE (val) == INDIRECT_REF
- || (TREE_CODE_CLASS (TREE_CODE (val)) == 'd'
- && ! (GET_CODE (DECL_RTL (val)) == REG
- && GET_MODE (DECL_RTL (val)) != TYPE_MODE (type)))
- || ! allows_reg
- || found_plus)
- {
- if (! allows_reg)
- mark_addressable (TREE_VALUE (tail));
-
- output_rtx[i]
- = expand_expr (TREE_VALUE (tail), NULL_RTX, VOIDmode, 0);
-
- if (! allows_reg && GET_CODE (output_rtx[i]) != MEM)
- error ("output number %d not directly addressable", i);
- }
- else
- {
- output_rtx[i] = assign_temp (type, 0, 0, 0);
- TREE_VALUE (tail) = make_tree (type, output_rtx[i]);
- }
-
- if (found_plus)
- {
- inout_mode[ninout] = TYPE_MODE (TREE_TYPE (TREE_VALUE (tail)));
- inout_opnum[ninout++] = i;
- }
- }
-
- ninputs += ninout;
- if (ninputs + noutputs > MAX_RECOG_OPERANDS)
- {
- error ("more than %d operands in `asm'", MAX_RECOG_OPERANDS);
- return;
- }
-
- /* Make vectors for the expression-rtx and constraint strings. */
-
- argvec = rtvec_alloc (ninputs);
- constraints = rtvec_alloc (ninputs);
-
- body = gen_rtx (ASM_OPERANDS, VOIDmode,
- TREE_STRING_POINTER (string), "", 0, argvec, constraints,
- filename, line);
- MEM_VOLATILE_P (body) = vol;
-
- /* Eval the inputs and put them into ARGVEC.
- Put their constraints into ASM_INPUTs and store in CONSTRAINTS. */
-
- i = 0;
- for (tail = inputs; tail; tail = TREE_CHAIN (tail))
- {
- int j;
- int allows_reg = 0;
-
- /* If there's an erroneous arg, emit no insn,
- because the ASM_INPUT would get VOIDmode
- and that could cause a crash in reload. */
- if (TREE_TYPE (TREE_VALUE (tail)) == error_mark_node)
- return;
- if (TREE_PURPOSE (tail) == NULL_TREE)
- {
- error ("hard register `%s' listed as input operand to `asm'",
- TREE_STRING_POINTER (TREE_VALUE (tail)) );
- return;
- }
-
- /* Make sure constraint has neither `=' nor `+'. */
-
- for (j = 0; j < TREE_STRING_LENGTH (TREE_PURPOSE (tail)) - 1; j++)
- switch (TREE_STRING_POINTER (TREE_PURPOSE (tail))[j])
- {
- case '+': case '=':
- error ("input operand constraint contains `%c'",
- TREE_STRING_POINTER (TREE_PURPOSE (tail))[j]);
- return;
-
- case '?': case '!': case '*': case '%': case '&':
- case 'V': case 'm': case 'o': case '<': case '>':
- case 'E': case 'F': case 'G': case 'H': case 'X':
- case 's': case 'i': case 'n':
- case 'I': case 'J': case 'K': case 'L': case 'M':
- case 'N': case 'O': case 'P': case ',':
-#ifdef EXTRA_CONSTRAINT
- case 'Q': case 'R': case 'S': case 'T': case 'U':
-#endif
- break;
-
- /* Whether or not a numeric constraint allows a register is
- decided by the matching constraint, and so there is no need
- to do anything special with them. We must handle them in
- the default case, so that we don't unnecessarily force
- operands to memory. */
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- if (TREE_STRING_POINTER (TREE_PURPOSE (tail))[j]
- >= '0' + noutputs)
- error ("matching constraint references invalid operand number");
-
- /* ... fall through ... */
-
- case 'p': case 'g': case 'r':
- default:
- allows_reg = 1;
- break;
- }
-
- if (! allows_reg)
- mark_addressable (TREE_VALUE (tail));
-
- XVECEXP (body, 3, i) /* argvec */
- = expand_expr (TREE_VALUE (tail), NULL_RTX, VOIDmode, 0);
- if (CONSTANT_P (XVECEXP (body, 3, i))
- && ! general_operand (XVECEXP (body, 3, i),
- TYPE_MODE (TREE_TYPE (TREE_VALUE (tail)))))
- {
- if (allows_reg)
- XVECEXP (body, 3, i)
- = force_reg (TYPE_MODE (TREE_TYPE (TREE_VALUE (tail))),
- XVECEXP (body, 3, i));
- else
- XVECEXP (body, 3, i)
- = force_const_mem (TYPE_MODE (TREE_TYPE (TREE_VALUE (tail))),
- XVECEXP (body, 3, i));
- }
-
- if (! allows_reg
- && (GET_CODE (XVECEXP (body, 3, i)) == REG
- || GET_CODE (XVECEXP (body, 3, i)) == SUBREG
- || GET_CODE (XVECEXP (body, 3, i)) == CONCAT))
- {
- tree type = TREE_TYPE (TREE_VALUE (tail));
- rtx memloc = assign_temp (type, 1, 1, 1);
-
- emit_move_insn (memloc, XVECEXP (body, 3, i));
- XVECEXP (body, 3, i) = memloc;
- }
-
- XVECEXP (body, 4, i) /* constraints */
- = gen_rtx (ASM_INPUT, TYPE_MODE (TREE_TYPE (TREE_VALUE (tail))),
- TREE_STRING_POINTER (TREE_PURPOSE (tail)));
- i++;
- }
-
- /* Protect all the operands from the queue,
- now that they have all been evaluated. */
-
- for (i = 0; i < ninputs - ninout; i++)
- XVECEXP (body, 3, i) = protect_from_queue (XVECEXP (body, 3, i), 0);
-
- for (i = 0; i < noutputs; i++)
- output_rtx[i] = protect_from_queue (output_rtx[i], 1);
-
- /* For in-out operands, copy output rtx to input rtx. */
- for (i = 0; i < ninout; i++)
- {
- static char match[9+1][2]
- = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
- int j = inout_opnum[i];
-
- XVECEXP (body, 3, ninputs - ninout + i) /* argvec */
- = output_rtx[j];
- XVECEXP (body, 4, ninputs - ninout + i) /* constraints */
- = gen_rtx (ASM_INPUT, inout_mode[j], match[j]);
- }
-
- /* Now, for each output, construct an rtx
- (set OUTPUT (asm_operands INSN OUTPUTNUMBER OUTPUTCONSTRAINT
- ARGVEC CONSTRAINTS))
- If there is more than one, put them inside a PARALLEL. */
-
- if (noutputs == 1 && nclobbers == 0)
- {
- XSTR (body, 1) = TREE_STRING_POINTER (TREE_PURPOSE (outputs));
- insn = emit_insn (gen_rtx (SET, VOIDmode, output_rtx[0], body));
- }
- else if (noutputs == 0 && nclobbers == 0)
- {
- /* No output operands: put in a raw ASM_OPERANDS rtx. */
- insn = emit_insn (body);
- }
- else
- {
- rtx obody = body;
- int num = noutputs;
- if (num == 0) num = 1;
- body = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (num + nclobbers));
-
- /* For each output operand, store a SET. */
-
- for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++)
- {
- XVECEXP (body, 0, i)
- = gen_rtx (SET, VOIDmode,
- output_rtx[i],
- gen_rtx (ASM_OPERANDS, VOIDmode,
- TREE_STRING_POINTER (string),
- TREE_STRING_POINTER (TREE_PURPOSE (tail)),
- i, argvec, constraints,
- filename, line));
- MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol;
- }
-
- /* If there are no outputs (but there are some clobbers)
- store the bare ASM_OPERANDS into the PARALLEL. */
-
- if (i == 0)
- XVECEXP (body, 0, i++) = obody;
-
- /* Store (clobber REG) for each clobbered register specified. */
-
- for (tail = clobbers; tail; tail = TREE_CHAIN (tail))
- {
- char *regname = TREE_STRING_POINTER (TREE_VALUE (tail));
- int j = decode_reg_name (regname);
-
- if (j < 0)
- {
- if (j == -3) /* `cc', which is not a register */
- continue;
-
- if (j == -4) /* `memory', don't cache memory across asm */
- {
- XVECEXP (body, 0, i++)
- = gen_rtx (CLOBBER, VOIDmode,
- gen_rtx (MEM, BLKmode,
- gen_rtx (SCRATCH, VOIDmode, 0)));
- continue;
- }
-
- /* Ignore unknown register, error already signalled. */
- continue;
- }
-
- /* Use QImode since that's guaranteed to clobber just one reg. */
- XVECEXP (body, 0, i++)
- = gen_rtx (CLOBBER, VOIDmode, gen_rtx (REG, QImode, j));
- }
-
- insn = emit_insn (body);
- }
-
- free_temp_slots ();
-}
-
-/* Generate RTL to evaluate the expression EXP
- and remember it in case this is the VALUE in a ({... VALUE; }) constr. */
-
-void
-expand_expr_stmt (exp)
- tree exp;
-{
- if (output_bytecode)
- {
- int org_stack_depth = stack_depth;
-
- bc_expand_expr (exp);
-
- /* Restore stack depth */
- if (stack_depth < org_stack_depth)
- abort ();
-
- bc_emit_instruction (drop);
-
- last_expr_type = TREE_TYPE (exp);
- return;
- }
-
- /* If -W, warn about statements with no side effects,
- except for an explicit cast to void (e.g. for assert()), and
- except inside a ({...}) where they may be useful. */
- if (expr_stmts_for_value == 0 && exp != error_mark_node)
- {
- if (! TREE_SIDE_EFFECTS (exp) && (extra_warnings || warn_unused)
- && !(TREE_CODE (exp) == CONVERT_EXPR
- && TREE_TYPE (exp) == void_type_node))
- warning_with_file_and_line (emit_filename, emit_lineno,
- "statement with no effect");
- else if (warn_unused)
- warn_if_unused_value (exp);
- }
-
- /* If EXP is of function type and we are expanding statements for
- value, convert it to pointer-to-function. */
- if (expr_stmts_for_value && TREE_CODE (TREE_TYPE (exp)) == FUNCTION_TYPE)
- exp = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (exp)), exp);
-
- last_expr_type = TREE_TYPE (exp);
- if (! flag_syntax_only)
- last_expr_value = expand_expr (exp,
- (expr_stmts_for_value
- ? NULL_RTX : const0_rtx),
- VOIDmode, 0);
-
- /* If all we do is reference a volatile value in memory,
- copy it to a register to be sure it is actually touched. */
- if (last_expr_value != 0 && GET_CODE (last_expr_value) == MEM
- && TREE_THIS_VOLATILE (exp))
- {
- if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode)
- ;
- else if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
- copy_to_reg (last_expr_value);
- else
- {
- rtx lab = gen_label_rtx ();
-
- /* Compare the value with itself to reference it. */
- emit_cmp_insn (last_expr_value, last_expr_value, EQ,
- expand_expr (TYPE_SIZE (last_expr_type),
- NULL_RTX, VOIDmode, 0),
- BLKmode, 0,
- TYPE_ALIGN (last_expr_type) / BITS_PER_UNIT);
- emit_jump_insn ((*bcc_gen_fctn[(int) EQ]) (lab));
- emit_label (lab);
- }
- }
-
- /* If this expression is part of a ({...}) and is in memory, we may have
- to preserve temporaries. */
- preserve_temp_slots (last_expr_value);
-
- /* Free any temporaries used to evaluate this expression. Any temporary
- used as a result of this expression will already have been preserved
- above. */
- free_temp_slots ();
-
- emit_queue ();
-}
-
-/* Warn if EXP contains any computations whose results are not used.
- Return 1 if a warning is printed; 0 otherwise. */
-
-int
-warn_if_unused_value (exp)
- tree exp;
-{
- if (TREE_USED (exp))
- return 0;
-
- switch (TREE_CODE (exp))
- {
- case PREINCREMENT_EXPR:
- case POSTINCREMENT_EXPR:
- case PREDECREMENT_EXPR:
- case POSTDECREMENT_EXPR:
- case MODIFY_EXPR:
- case INIT_EXPR:
- case TARGET_EXPR:
- case CALL_EXPR:
- case METHOD_CALL_EXPR:
- case RTL_EXPR:
- case WITH_CLEANUP_EXPR:
- case EXIT_EXPR:
- /* We don't warn about COND_EXPR because it may be a useful
- construct if either arm contains a side effect. */
- case COND_EXPR:
- return 0;
-
- case BIND_EXPR:
- /* For a binding, warn if no side effect within it. */
- return warn_if_unused_value (TREE_OPERAND (exp, 1));
-
- case SAVE_EXPR:
- return warn_if_unused_value (TREE_OPERAND (exp, 1));
-
- case TRUTH_ORIF_EXPR:
- case TRUTH_ANDIF_EXPR:
- /* In && or ||, warn if 2nd operand has no side effect. */
- return warn_if_unused_value (TREE_OPERAND (exp, 1));
-
- case COMPOUND_EXPR:
- if (TREE_NO_UNUSED_WARNING (exp))
- return 0;
- if (warn_if_unused_value (TREE_OPERAND (exp, 0)))
- return 1;
- /* Let people do `(foo (), 0)' without a warning. */
- if (TREE_CONSTANT (TREE_OPERAND (exp, 1)))
- return 0;
- return warn_if_unused_value (TREE_OPERAND (exp, 1));
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- case NON_LVALUE_EXPR:
- /* Don't warn about values cast to void. */
- if (TREE_TYPE (exp) == void_type_node)
- return 0;
- /* Don't warn about conversions not explicit in the user's program. */
- if (TREE_NO_UNUSED_WARNING (exp))
- return 0;
- /* Assignment to a cast usually results in a cast of a modify.
- Don't complain about that. There can be an arbitrary number of
- casts before the modify, so we must loop until we find the first
- non-cast expression and then test to see if that is a modify. */
- {
- tree tem = TREE_OPERAND (exp, 0);
-
- while (TREE_CODE (tem) == CONVERT_EXPR || TREE_CODE (tem) == NOP_EXPR)
- tem = TREE_OPERAND (tem, 0);
-
- if (TREE_CODE (tem) == MODIFY_EXPR || TREE_CODE (tem) == INIT_EXPR
- || TREE_CODE (tem) == CALL_EXPR)
- return 0;
- }
- goto warn;
-
- case INDIRECT_REF:
- /* Don't warn about automatic dereferencing of references, since
- the user cannot control it. */
- if (TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == REFERENCE_TYPE)
- return warn_if_unused_value (TREE_OPERAND (exp, 0));
- /* ... fall through ... */
-
- default:
- /* Referencing a volatile value is a side effect, so don't warn. */
- if ((TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
- || TREE_CODE_CLASS (TREE_CODE (exp)) == 'r')
- && TREE_THIS_VOLATILE (exp))
- return 0;
- warn:
- warning_with_file_and_line (emit_filename, emit_lineno,
- "value computed is not used");
- return 1;
- }
-}
-
-/* Clear out the memory of the last expression evaluated. */
-
-void
-clear_last_expr ()
-{
- last_expr_type = 0;
-}
-
-/* Begin a statement which will return a value.
- Return the RTL_EXPR for this statement expr.
- The caller must save that value and pass it to expand_end_stmt_expr. */
-
-tree
-expand_start_stmt_expr ()
-{
- int momentary;
- tree t;
-
- /* When generating bytecode just note down the stack depth */
- if (output_bytecode)
- return (build_int_2 (stack_depth, 0));
-
- /* Make the RTL_EXPR node temporary, not momentary,
- so that rtl_expr_chain doesn't become garbage. */
- momentary = suspend_momentary ();
- t = make_node (RTL_EXPR);
- resume_momentary (momentary);
- do_pending_stack_adjust ();
- start_sequence_for_rtl_expr (t);
- NO_DEFER_POP;
- expr_stmts_for_value++;
- return t;
-}
-
-/* Restore the previous state at the end of a statement that returns a value.
- Returns a tree node representing the statement's value and the
- insns to compute the value.
-
- The nodes of that expression have been freed by now, so we cannot use them.
- But we don't want to do that anyway; the expression has already been
- evaluated and now we just want to use the value. So generate a RTL_EXPR
- with the proper type and RTL value.
-
- If the last substatement was not an expression,
- return something with type `void'. */
-
-tree
-expand_end_stmt_expr (t)
- tree t;
-{
- if (output_bytecode)
- {
- int i;
- tree t;
-
-
- /* At this point, all expressions have been evaluated in order.
- However, all expression values have been popped when evaluated,
- which means we have to recover the last expression value. This is
- the last value removed by means of a `drop' instruction. Instead
- of adding code to inhibit dropping the last expression value, it
- is here recovered by undoing the `drop'. Since `drop' is
- equivalent to `adjustackSI [1]', it can be undone with `adjstackSI
- [-1]'. */
-
- bc_adjust_stack (-1);
-
- if (!last_expr_type)
- last_expr_type = void_type_node;
-
- t = make_node (RTL_EXPR);
- TREE_TYPE (t) = last_expr_type;
- RTL_EXPR_RTL (t) = NULL;
- RTL_EXPR_SEQUENCE (t) = NULL;
-
- /* Don't consider deleting this expr or containing exprs at tree level. */
- TREE_THIS_VOLATILE (t) = 1;
-
- last_expr_type = 0;
- return t;
- }
-
- OK_DEFER_POP;
-
- if (last_expr_type == 0)
- {
- last_expr_type = void_type_node;
- last_expr_value = const0_rtx;
- }
- else if (last_expr_value == 0)
- /* There are some cases where this can happen, such as when the
- statement is void type. */
- last_expr_value = const0_rtx;
- else if (GET_CODE (last_expr_value) != REG && ! CONSTANT_P (last_expr_value))
- /* Remove any possible QUEUED. */
- last_expr_value = protect_from_queue (last_expr_value, 0);
-
- emit_queue ();
-
- TREE_TYPE (t) = last_expr_type;
- RTL_EXPR_RTL (t) = last_expr_value;
- RTL_EXPR_SEQUENCE (t) = get_insns ();
-
- rtl_expr_chain = tree_cons (NULL_TREE, t, rtl_expr_chain);
-
- end_sequence ();
-
- /* Don't consider deleting this expr or containing exprs at tree level. */
- TREE_SIDE_EFFECTS (t) = 1;
- /* Propagate volatility of the actual RTL expr. */
- TREE_THIS_VOLATILE (t) = volatile_refs_p (last_expr_value);
-
- last_expr_type = 0;
- expr_stmts_for_value--;
-
- return t;
-}
-
-/* Generate RTL for the start of an if-then. COND is the expression
- whose truth should be tested.
-
- If EXITFLAG is nonzero, this conditional is visible to
- `exit_something'. */
-
-void
-expand_start_cond (cond, exitflag)
- tree cond;
- int exitflag;
-{
- struct nesting *thiscond = ALLOC_NESTING ();
-
- /* Make an entry on cond_stack for the cond we are entering. */
-
- thiscond->next = cond_stack;
- thiscond->all = nesting_stack;
- thiscond->depth = ++nesting_depth;
- thiscond->data.cond.next_label = gen_label_rtx ();
- /* Before we encounter an `else', we don't need a separate exit label
- unless there are supposed to be exit statements
- to exit this conditional. */
- thiscond->exit_label = exitflag ? gen_label_rtx () : 0;
- thiscond->data.cond.endif_label = thiscond->exit_label;
- cond_stack = thiscond;
- nesting_stack = thiscond;
-
- if (output_bytecode)
- bc_expand_start_cond (cond, exitflag);
- else
- do_jump (cond, thiscond->data.cond.next_label, NULL_RTX);
-}
-
-/* Generate RTL between then-clause and the elseif-clause
- of an if-then-elseif-.... */
-
-void
-expand_start_elseif (cond)
- tree cond;
-{
- if (cond_stack->data.cond.endif_label == 0)
- cond_stack->data.cond.endif_label = gen_label_rtx ();
- emit_jump (cond_stack->data.cond.endif_label);
- emit_label (cond_stack->data.cond.next_label);
- cond_stack->data.cond.next_label = gen_label_rtx ();
- do_jump (cond, cond_stack->data.cond.next_label, NULL_RTX);
-}
-
-/* Generate RTL between the then-clause and the else-clause
- of an if-then-else. */
-
-void
-expand_start_else ()
-{
- if (cond_stack->data.cond.endif_label == 0)
- cond_stack->data.cond.endif_label = gen_label_rtx ();
-
- if (output_bytecode)
- {
- bc_expand_start_else ();
- return;
- }
-
- emit_jump (cond_stack->data.cond.endif_label);
- emit_label (cond_stack->data.cond.next_label);
- cond_stack->data.cond.next_label = 0; /* No more _else or _elseif calls. */
-}
-
-/* After calling expand_start_else, turn this "else" into an "else if"
- by providing another condition. */
-
-void
-expand_elseif (cond)
- tree cond;
-{
- cond_stack->data.cond.next_label = gen_label_rtx ();
- do_jump (cond, cond_stack->data.cond.next_label, NULL_RTX);
-}
-
-/* Generate RTL for the end of an if-then.
- Pop the record for it off of cond_stack. */
-
-void
-expand_end_cond ()
-{
- struct nesting *thiscond = cond_stack;
-
- if (output_bytecode)
- bc_expand_end_cond ();
- else
- {
- do_pending_stack_adjust ();
- if (thiscond->data.cond.next_label)
- emit_label (thiscond->data.cond.next_label);
- if (thiscond->data.cond.endif_label)
- emit_label (thiscond->data.cond.endif_label);
- }
-
- POPSTACK (cond_stack);
- last_expr_type = 0;
-}
-
-
-/* Generate code for the start of an if-then. COND is the expression
- whose truth is to be tested; if EXITFLAG is nonzero this conditional
- is to be visible to exit_something. It is assumed that the caller
- has pushed the previous context on the cond stack. */
-
-static void
-bc_expand_start_cond (cond, exitflag)
- tree cond;
- int exitflag;
-{
- struct nesting *thiscond = cond_stack;
-
- thiscond->data.case_stmt.nominal_type = cond;
- if (! exitflag)
- thiscond->exit_label = gen_label_rtx ();
- bc_expand_expr (cond);
- bc_emit_bytecode (xjumpifnot);
- bc_emit_bytecode_labelref (BYTECODE_BC_LABEL (thiscond->exit_label));
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-}
-
-/* Generate the label for the end of an if with
- no else- clause. */
-
-static void
-bc_expand_end_cond ()
-{
- struct nesting *thiscond = cond_stack;
-
- bc_emit_bytecode_labeldef (BYTECODE_BC_LABEL (thiscond->exit_label));
-}
-
-/* Generate code for the start of the else- clause of
- an if-then-else. */
-
-static void
-bc_expand_start_else ()
-{
- struct nesting *thiscond = cond_stack;
-
- thiscond->data.cond.endif_label = thiscond->exit_label;
- thiscond->exit_label = gen_label_rtx ();
- bc_emit_bytecode (jump);
- bc_emit_bytecode_labelref (BYTECODE_BC_LABEL (thiscond->exit_label));
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-
- bc_emit_bytecode_labeldef (BYTECODE_BC_LABEL (thiscond->data.cond.endif_label));
-}
-
-/* Generate RTL for the start of a loop. EXIT_FLAG is nonzero if this
- loop should be exited by `exit_something'. This is a loop for which
- `expand_continue' will jump to the top of the loop.
-
- Make an entry on loop_stack to record the labels associated with
- this loop. */
-
-struct nesting *
-expand_start_loop (exit_flag)
- int exit_flag;
-{
- register struct nesting *thisloop = ALLOC_NESTING ();
-
- /* Make an entry on loop_stack for the loop we are entering. */
-
- thisloop->next = loop_stack;
- thisloop->all = nesting_stack;
- thisloop->depth = ++nesting_depth;
- thisloop->data.loop.start_label = gen_label_rtx ();
- thisloop->data.loop.end_label = gen_label_rtx ();
- thisloop->data.loop.alt_end_label = 0;
- thisloop->data.loop.continue_label = thisloop->data.loop.start_label;
- thisloop->exit_label = exit_flag ? thisloop->data.loop.end_label : 0;
- loop_stack = thisloop;
- nesting_stack = thisloop;
-
- if (output_bytecode)
- {
- bc_emit_bytecode_labeldef (BYTECODE_BC_LABEL (thisloop->data.loop.start_label));
- return thisloop;
- }
-
- do_pending_stack_adjust ();
- emit_queue ();
- emit_note (NULL_PTR, NOTE_INSN_LOOP_BEG);
- emit_label (thisloop->data.loop.start_label);
-
- return thisloop;
-}
-
-/* Like expand_start_loop but for a loop where the continuation point
- (for expand_continue_loop) will be specified explicitly. */
-
-struct nesting *
-expand_start_loop_continue_elsewhere (exit_flag)
- int exit_flag;
-{
- struct nesting *thisloop = expand_start_loop (exit_flag);
- loop_stack->data.loop.continue_label = gen_label_rtx ();
- return thisloop;
-}
-
-/* Specify the continuation point for a loop started with
- expand_start_loop_continue_elsewhere.
- Use this at the point in the code to which a continue statement
- should jump. */
-
-void
-expand_loop_continue_here ()
-{
- if (output_bytecode)
- {
- bc_emit_bytecode_labeldef (BYTECODE_BC_LABEL (loop_stack->data.loop.continue_label));
- return;
- }
- do_pending_stack_adjust ();
- emit_note (NULL_PTR, NOTE_INSN_LOOP_CONT);
- emit_label (loop_stack->data.loop.continue_label);
-}
-
-/* End a loop. */
-
-static void
-bc_expand_end_loop ()
-{
- struct nesting *thisloop = loop_stack;
-
- bc_emit_bytecode (jump);
- bc_emit_bytecode_labelref (BYTECODE_BC_LABEL (thisloop->data.loop.start_label));
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-
- bc_emit_bytecode_labeldef (BYTECODE_BC_LABEL (thisloop->exit_label));
- POPSTACK (loop_stack);
- last_expr_type = 0;
-}
-
-
-/* Finish a loop. Generate a jump back to the top and the loop-exit label.
- Pop the block off of loop_stack. */
-
-void
-expand_end_loop ()
-{
- register rtx insn;
- register rtx start_label;
- rtx last_test_insn = 0;
- int num_insns = 0;
-
- if (output_bytecode)
- {
- bc_expand_end_loop ();
- return;
- }
-
- insn = get_last_insn ();
- start_label = loop_stack->data.loop.start_label;
-
- /* Mark the continue-point at the top of the loop if none elsewhere. */
- if (start_label == loop_stack->data.loop.continue_label)
- emit_note_before (NOTE_INSN_LOOP_CONT, start_label);
-
- do_pending_stack_adjust ();
-
- /* If optimizing, perhaps reorder the loop. If the loop
- starts with a conditional exit, roll that to the end
- where it will optimize together with the jump back.
-
- We look for the last conditional branch to the exit that we encounter
- before hitting 30 insns or a CALL_INSN. If we see an unconditional
- branch to the exit first, use it.
-
- We must also stop at NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes
- because moving them is not valid. */
-
- if (optimize
- &&
- ! (GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) == SET
- && SET_DEST (PATTERN (insn)) == pc_rtx
- && GET_CODE (SET_SRC (PATTERN (insn))) == IF_THEN_ELSE))
- {
- /* Scan insns from the top of the loop looking for a qualified
- conditional exit. */
- for (insn = NEXT_INSN (loop_stack->data.loop.start_label); insn;
- insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == CODE_LABEL)
- break;
-
- if (GET_CODE (insn) == NOTE
- && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
- || NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END))
- break;
-
- if (GET_CODE (insn) == JUMP_INSN || GET_CODE (insn) == INSN)
- num_insns++;
-
- if (last_test_insn && num_insns > 30)
- break;
-
- if (GET_CODE (insn) == JUMP_INSN && GET_CODE (PATTERN (insn)) == SET
- && SET_DEST (PATTERN (insn)) == pc_rtx
- && GET_CODE (SET_SRC (PATTERN (insn))) == IF_THEN_ELSE
- && ((GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 1)) == LABEL_REF
- && ((XEXP (XEXP (SET_SRC (PATTERN (insn)), 1), 0)
- == loop_stack->data.loop.end_label)
- || (XEXP (XEXP (SET_SRC (PATTERN (insn)), 1), 0)
- == loop_stack->data.loop.alt_end_label)))
- || (GET_CODE (XEXP (SET_SRC (PATTERN (insn)), 2)) == LABEL_REF
- && ((XEXP (XEXP (SET_SRC (PATTERN (insn)), 2), 0)
- == loop_stack->data.loop.end_label)
- || (XEXP (XEXP (SET_SRC (PATTERN (insn)), 2), 0)
- == loop_stack->data.loop.alt_end_label)))))
- last_test_insn = insn;
-
- if (last_test_insn == 0 && GET_CODE (insn) == JUMP_INSN
- && GET_CODE (PATTERN (insn)) == SET
- && SET_DEST (PATTERN (insn)) == pc_rtx
- && GET_CODE (SET_SRC (PATTERN (insn))) == LABEL_REF
- && ((XEXP (SET_SRC (PATTERN (insn)), 0)
- == loop_stack->data.loop.end_label)
- || (XEXP (SET_SRC (PATTERN (insn)), 0)
- == loop_stack->data.loop.alt_end_label)))
- /* Include BARRIER. */
- last_test_insn = NEXT_INSN (insn);
- }
-
- if (last_test_insn != 0 && last_test_insn != get_last_insn ())
- {
- /* We found one. Move everything from there up
- to the end of the loop, and add a jump into the loop
- to jump to there. */
- register rtx newstart_label = gen_label_rtx ();
- register rtx start_move = start_label;
-
- /* If the start label is preceded by a NOTE_INSN_LOOP_CONT note,
- then we want to move this note also. */
- if (GET_CODE (PREV_INSN (start_move)) == NOTE
- && (NOTE_LINE_NUMBER (PREV_INSN (start_move))
- == NOTE_INSN_LOOP_CONT))
- start_move = PREV_INSN (start_move);
-
- emit_label_after (newstart_label, PREV_INSN (start_move));
- reorder_insns (start_move, last_test_insn, get_last_insn ());
- emit_jump_insn_after (gen_jump (start_label),
- PREV_INSN (newstart_label));
- emit_barrier_after (PREV_INSN (newstart_label));
- start_label = newstart_label;
- }
- }
-
- emit_jump (start_label);
- emit_note (NULL_PTR, NOTE_INSN_LOOP_END);
- emit_label (loop_stack->data.loop.end_label);
-
- POPSTACK (loop_stack);
-
- last_expr_type = 0;
-}
-
-/* Generate a jump to the current loop's continue-point.
- This is usually the top of the loop, but may be specified
- explicitly elsewhere. If not currently inside a loop,
- return 0 and do nothing; caller will print an error message. */
-
-int
-expand_continue_loop (whichloop)
- struct nesting *whichloop;
-{
- last_expr_type = 0;
- if (whichloop == 0)
- whichloop = loop_stack;
- if (whichloop == 0)
- return 0;
- expand_goto_internal (NULL_TREE, whichloop->data.loop.continue_label,
- NULL_RTX);
- return 1;
-}
-
-/* Generate a jump to exit the current loop. If not currently inside a loop,
- return 0 and do nothing; caller will print an error message. */
-
-int
-expand_exit_loop (whichloop)
- struct nesting *whichloop;
-{
- last_expr_type = 0;
- if (whichloop == 0)
- whichloop = loop_stack;
- if (whichloop == 0)
- return 0;
- expand_goto_internal (NULL_TREE, whichloop->data.loop.end_label, NULL_RTX);
- return 1;
-}
-
-/* Generate a conditional jump to exit the current loop if COND
- evaluates to zero. If not currently inside a loop,
- return 0 and do nothing; caller will print an error message. */
-
-int
-expand_exit_loop_if_false (whichloop, cond)
- struct nesting *whichloop;
- tree cond;
-{
- last_expr_type = 0;
- if (whichloop == 0)
- whichloop = loop_stack;
- if (whichloop == 0)
- return 0;
- if (output_bytecode)
- {
- bc_expand_expr (cond);
- bc_expand_goto_internal (xjumpifnot,
- BYTECODE_BC_LABEL (whichloop->exit_label),
- NULL_TREE);
- }
- else
- {
- /* In order to handle fixups, we actually create a conditional jump
- around a unconditional branch to exit the loop. If fixups are
- necessary, they go before the unconditional branch. */
-
- rtx label = gen_label_rtx ();
- rtx last_insn;
-
- do_jump (cond, NULL_RTX, label);
- last_insn = get_last_insn ();
- if (GET_CODE (last_insn) == CODE_LABEL)
- whichloop->data.loop.alt_end_label = last_insn;
- expand_goto_internal (NULL_TREE, whichloop->data.loop.end_label,
- NULL_RTX);
- emit_label (label);
- }
-
- return 1;
-}
-
-/* Return non-zero if we should preserve sub-expressions as separate
- pseudos. We never do so if we aren't optimizing. We always do so
- if -fexpensive-optimizations.
-
- Otherwise, we only do so if we are in the "early" part of a loop. I.e.,
- the loop may still be a small one. */
-
-int
-preserve_subexpressions_p ()
-{
- rtx insn;
-
- if (flag_expensive_optimizations)
- return 1;
-
- if (optimize == 0 || loop_stack == 0)
- return 0;
-
- insn = get_last_insn_anywhere ();
-
- return (insn
- && (INSN_UID (insn) - INSN_UID (loop_stack->data.loop.start_label)
- < n_non_fixed_regs * 3));
-
-}
-
-/* Generate a jump to exit the current loop, conditional, binding contour
- or case statement. Not all such constructs are visible to this function,
- only those started with EXIT_FLAG nonzero. Individual languages use
- the EXIT_FLAG parameter to control which kinds of constructs you can
- exit this way.
-
- If not currently inside anything that can be exited,
- return 0 and do nothing; caller will print an error message. */
-
-int
-expand_exit_something ()
-{
- struct nesting *n;
- last_expr_type = 0;
- for (n = nesting_stack; n; n = n->all)
- if (n->exit_label != 0)
- {
- expand_goto_internal (NULL_TREE, n->exit_label, NULL_RTX);
- return 1;
- }
-
- return 0;
-}
-
-/* Generate RTL to return from the current function, with no value.
- (That is, we do not do anything about returning any value.) */
-
-void
-expand_null_return ()
-{
- struct nesting *block = block_stack;
- rtx last_insn = 0;
-
- if (output_bytecode)
- {
- bc_emit_instruction (ret);
- return;
- }
-
- /* Does any pending block have cleanups? */
-
- while (block && block->data.block.cleanups == 0)
- block = block->next;
-
- /* If yes, use a goto to return, since that runs cleanups. */
-
- expand_null_return_1 (last_insn, block != 0);
-}
-
-/* Generate RTL to return from the current function, with value VAL. */
-
-static void
-expand_value_return (val)
- rtx val;
-{
- struct nesting *block = block_stack;
- rtx last_insn = get_last_insn ();
- rtx return_reg = DECL_RTL (DECL_RESULT (current_function_decl));
-
- /* Copy the value to the return location
- unless it's already there. */
-
- if (return_reg != val)
- {
-#ifdef PROMOTE_FUNCTION_RETURN
- tree type = TREE_TYPE (DECL_RESULT (current_function_decl));
- int unsignedp = TREE_UNSIGNED (type);
- enum machine_mode mode
- = promote_mode (type, DECL_MODE (DECL_RESULT (current_function_decl)),
- &unsignedp, 1);
-
- if (GET_MODE (val) != VOIDmode && GET_MODE (val) != mode)
- convert_move (return_reg, val, unsignedp);
- else
-#endif
- emit_move_insn (return_reg, val);
- }
- if (GET_CODE (return_reg) == REG
- && REGNO (return_reg) < FIRST_PSEUDO_REGISTER)
- emit_insn (gen_rtx (USE, VOIDmode, return_reg));
- /* Handle calls that return values in multiple non-contiguous locations.
- The Irix 6 ABI has examples of this. */
- else if (GET_CODE (return_reg) == PARALLEL)
- {
- int i;
-
- for (i = 0; i < XVECLEN (return_reg, 0); i++)
- {
- rtx x = XEXP (XVECEXP (return_reg, 0, i), 0);
-
- if (GET_CODE (x) == REG
- && REGNO (x) < FIRST_PSEUDO_REGISTER)
- emit_insn (gen_rtx (USE, VOIDmode, x));
- }
- }
-
- /* Does any pending block have cleanups? */
-
- while (block && block->data.block.cleanups == 0)
- block = block->next;
-
- /* If yes, use a goto to return, since that runs cleanups.
- Use LAST_INSN to put cleanups *before* the move insn emitted above. */
-
- expand_null_return_1 (last_insn, block != 0);
-}
-
-/* Output a return with no value. If LAST_INSN is nonzero,
- pretend that the return takes place after LAST_INSN.
- If USE_GOTO is nonzero then don't use a return instruction;
- go to the return label instead. This causes any cleanups
- of pending blocks to be executed normally. */
-
-static void
-expand_null_return_1 (last_insn, use_goto)
- rtx last_insn;
- int use_goto;
-{
- rtx end_label = cleanup_label ? cleanup_label : return_label;
-
- clear_pending_stack_adjust ();
- do_pending_stack_adjust ();
- last_expr_type = 0;
-
- /* PCC-struct return always uses an epilogue. */
- if (current_function_returns_pcc_struct || use_goto)
- {
- if (end_label == 0)
- end_label = return_label = gen_label_rtx ();
- expand_goto_internal (NULL_TREE, end_label, last_insn);
- return;
- }
-
- /* Otherwise output a simple return-insn if one is available,
- unless it won't do the job. */
-#ifdef HAVE_return
- if (HAVE_return && use_goto == 0 && cleanup_label == 0)
- {
- emit_jump_insn (gen_return ());
- emit_barrier ();
- return;
- }
-#endif
-
- /* Otherwise jump to the epilogue. */
- expand_goto_internal (NULL_TREE, end_label, last_insn);
-}
-
-/* Generate RTL to evaluate the expression RETVAL and return it
- from the current function. */
-
-void
-expand_return (retval)
- tree retval;
-{
- /* If there are any cleanups to be performed, then they will
- be inserted following LAST_INSN. It is desirable
- that the last_insn, for such purposes, should be the
- last insn before computing the return value. Otherwise, cleanups
- which call functions can clobber the return value. */
- /* ??? rms: I think that is erroneous, because in C++ it would
- run destructors on variables that might be used in the subsequent
- computation of the return value. */
- rtx last_insn = 0;
- register rtx val = 0;
- register rtx op0;
- tree retval_rhs;
- int cleanups;
- struct nesting *block;
-
- /* Bytecode returns are quite simple, just leave the result on the
- arithmetic stack. */
- if (output_bytecode)
- {
- bc_expand_expr (retval);
- bc_emit_instruction (ret);
- return;
- }
-
- /* If function wants no value, give it none. */
- if (TREE_CODE (TREE_TYPE (TREE_TYPE (current_function_decl))) == VOID_TYPE)
- {
- expand_expr (retval, NULL_RTX, VOIDmode, 0);
- emit_queue ();
- expand_null_return ();
- return;
- }
-
- /* Are any cleanups needed? E.g. C++ destructors to be run? */
- /* This is not sufficient. We also need to watch for cleanups of the
- expression we are about to expand. Unfortunately, we cannot know
- if it has cleanups until we expand it, and we want to change how we
- expand it depending upon if we need cleanups. We can't win. */
-#if 0
- cleanups = any_pending_cleanups (1);
-#else
- cleanups = 1;
-#endif
-
- if (TREE_CODE (retval) == RESULT_DECL)
- retval_rhs = retval;
- else if ((TREE_CODE (retval) == MODIFY_EXPR || TREE_CODE (retval) == INIT_EXPR)
- && TREE_CODE (TREE_OPERAND (retval, 0)) == RESULT_DECL)
- retval_rhs = TREE_OPERAND (retval, 1);
- else if (TREE_TYPE (retval) == void_type_node)
- /* Recognize tail-recursive call to void function. */
- retval_rhs = retval;
- else
- retval_rhs = NULL_TREE;
-
- /* Only use `last_insn' if there are cleanups which must be run. */
- if (cleanups || cleanup_label != 0)
- last_insn = get_last_insn ();
-
- /* Distribute return down conditional expr if either of the sides
- may involve tail recursion (see test below). This enhances the number
- of tail recursions we see. Don't do this always since it can produce
- sub-optimal code in some cases and we distribute assignments into
- conditional expressions when it would help. */
-
- if (optimize && retval_rhs != 0
- && frame_offset == 0
- && TREE_CODE (retval_rhs) == COND_EXPR
- && (TREE_CODE (TREE_OPERAND (retval_rhs, 1)) == CALL_EXPR
- || TREE_CODE (TREE_OPERAND (retval_rhs, 2)) == CALL_EXPR))
- {
- rtx label = gen_label_rtx ();
- tree expr;
-
- do_jump (TREE_OPERAND (retval_rhs, 0), label, NULL_RTX);
- expr = build (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (current_function_decl)),
- DECL_RESULT (current_function_decl),
- TREE_OPERAND (retval_rhs, 1));
- TREE_SIDE_EFFECTS (expr) = 1;
- expand_return (expr);
- emit_label (label);
-
- expr = build (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (current_function_decl)),
- DECL_RESULT (current_function_decl),
- TREE_OPERAND (retval_rhs, 2));
- TREE_SIDE_EFFECTS (expr) = 1;
- expand_return (expr);
- return;
- }
-
- /* For tail-recursive call to current function,
- just jump back to the beginning.
- It's unsafe if any auto variable in this function
- has its address taken; for simplicity,
- require stack frame to be empty. */
- if (optimize && retval_rhs != 0
- && frame_offset == 0
- && TREE_CODE (retval_rhs) == CALL_EXPR
- && TREE_CODE (TREE_OPERAND (retval_rhs, 0)) == ADDR_EXPR
- && TREE_OPERAND (TREE_OPERAND (retval_rhs, 0), 0) == current_function_decl
- /* Finish checking validity, and if valid emit code
- to set the argument variables for the new call. */
- && tail_recursion_args (TREE_OPERAND (retval_rhs, 1),
- DECL_ARGUMENTS (current_function_decl)))
- {
- if (tail_recursion_label == 0)
- {
- tail_recursion_label = gen_label_rtx ();
- emit_label_after (tail_recursion_label,
- tail_recursion_reentry);
- }
- emit_queue ();
- expand_goto_internal (NULL_TREE, tail_recursion_label, last_insn);
- emit_barrier ();
- return;
- }
-#ifdef HAVE_return
- /* This optimization is safe if there are local cleanups
- because expand_null_return takes care of them.
- ??? I think it should also be safe when there is a cleanup label,
- because expand_null_return takes care of them, too.
- Any reason why not? */
- if (HAVE_return && cleanup_label == 0
- && ! current_function_returns_pcc_struct
- && BRANCH_COST <= 1)
- {
- /* If this is return x == y; then generate
- if (x == y) return 1; else return 0;
- if we can do it with explicit return insns and branches are cheap,
- but not if we have the corresponding scc insn. */
- int has_scc = 0;
- if (retval_rhs)
- switch (TREE_CODE (retval_rhs))
- {
- case EQ_EXPR:
-#ifdef HAVE_seq
- has_scc = HAVE_seq;
-#endif
- case NE_EXPR:
-#ifdef HAVE_sne
- has_scc = HAVE_sne;
-#endif
- case GT_EXPR:
-#ifdef HAVE_sgt
- has_scc = HAVE_sgt;
-#endif
- case GE_EXPR:
-#ifdef HAVE_sge
- has_scc = HAVE_sge;
-#endif
- case LT_EXPR:
-#ifdef HAVE_slt
- has_scc = HAVE_slt;
-#endif
- case LE_EXPR:
-#ifdef HAVE_sle
- has_scc = HAVE_sle;
-#endif
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- case TRUTH_AND_EXPR:
- case TRUTH_OR_EXPR:
- case TRUTH_NOT_EXPR:
- case TRUTH_XOR_EXPR:
- if (! has_scc)
- {
- op0 = gen_label_rtx ();
- jumpifnot (retval_rhs, op0);
- expand_value_return (const1_rtx);
- emit_label (op0);
- expand_value_return (const0_rtx);
- return;
- }
- }
- }
-#endif /* HAVE_return */
-
- /* If the result is an aggregate that is being returned in one (or more)
- registers, load the registers here. The compiler currently can't handle
- copying a BLKmode value into registers. We could put this code in a
- more general area (for use by everyone instead of just function
- call/return), but until this feature is generally usable it is kept here
- (and in expand_call). The value must go into a pseudo in case there
- are cleanups that will clobber the real return register. */
-
- if (retval_rhs != 0
- && TYPE_MODE (TREE_TYPE (retval_rhs)) == BLKmode
- && GET_CODE (DECL_RTL (DECL_RESULT (current_function_decl))) == REG)
- {
- int i, bitpos, xbitpos;
- int big_endian_correction = 0;
- int bytes = int_size_in_bytes (TREE_TYPE (retval_rhs));
- int n_regs = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
- int bitsize = MIN (TYPE_ALIGN (TREE_TYPE (retval_rhs)),BITS_PER_WORD);
- rtx *result_pseudos = (rtx *) alloca (sizeof (rtx) * n_regs);
- rtx result_reg, src, dst;
- rtx result_val = expand_expr (retval_rhs, NULL_RTX, VOIDmode, 0);
- enum machine_mode tmpmode, result_reg_mode;
-
- /* Structures whose size is not a multiple of a word are aligned
- to the least significant byte (to the right). On a BYTES_BIG_ENDIAN
- machine, this means we must skip the empty high order bytes when
- calculating the bit offset. */
- if (BYTES_BIG_ENDIAN && bytes % UNITS_PER_WORD)
- big_endian_correction = (BITS_PER_WORD - ((bytes % UNITS_PER_WORD)
- * BITS_PER_UNIT));
-
- /* Copy the structure BITSIZE bits at a time. */
- for (bitpos = 0, xbitpos = big_endian_correction;
- bitpos < bytes * BITS_PER_UNIT;
- bitpos += bitsize, xbitpos += bitsize)
- {
- /* We need a new destination pseudo each time xbitpos is
- on a word boundary and when xbitpos == big_endian_correction
- (the first time through). */
- if (xbitpos % BITS_PER_WORD == 0
- || xbitpos == big_endian_correction)
- {
- /* Generate an appropriate register. */
- dst = gen_reg_rtx (word_mode);
- result_pseudos[xbitpos / BITS_PER_WORD] = dst;
-
- /* Clobber the destination before we move anything into it. */
- emit_insn (gen_rtx (CLOBBER, VOIDmode, dst));
- }
-
- /* We need a new source operand each time bitpos is on a word
- boundary. */
- if (bitpos % BITS_PER_WORD == 0)
- src = operand_subword_force (result_val,
- bitpos / BITS_PER_WORD,
- BLKmode);
-
- /* Use bitpos for the source extraction (left justified) and
- xbitpos for the destination store (right justified). */
- store_bit_field (dst, bitsize, xbitpos % BITS_PER_WORD, word_mode,
- extract_bit_field (src, bitsize,
- bitpos % BITS_PER_WORD, 1,
- NULL_RTX, word_mode,
- word_mode,
- bitsize / BITS_PER_UNIT,
- BITS_PER_WORD),
- bitsize / BITS_PER_UNIT, BITS_PER_WORD);
- }
-
- /* Find the smallest integer mode large enough to hold the
- entire structure and use that mode instead of BLKmode
- on the USE insn for the return register. */
- bytes = int_size_in_bytes (TREE_TYPE (retval_rhs));
- for (tmpmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
- tmpmode != MAX_MACHINE_MODE;
- tmpmode = GET_MODE_WIDER_MODE (tmpmode))
- {
- /* Have we found a large enough mode? */
- if (GET_MODE_SIZE (tmpmode) >= bytes)
- break;
- }
-
- /* No suitable mode found. */
- if (tmpmode == MAX_MACHINE_MODE)
- abort ();
-
- PUT_MODE (DECL_RTL (DECL_RESULT (current_function_decl)), tmpmode);
-
- if (GET_MODE_SIZE (tmpmode) < GET_MODE_SIZE (word_mode))
- result_reg_mode = word_mode;
- else
- result_reg_mode = tmpmode;
- result_reg = gen_reg_rtx (result_reg_mode);
-
- /* Now that the value is in pseudos, copy it to the result reg(s). */
- expand_cleanups_to (NULL_TREE);
- emit_queue ();
- free_temp_slots ();
- for (i = 0; i < n_regs; i++)
- emit_move_insn (operand_subword (result_reg, i, 0, result_reg_mode),
- result_pseudos[i]);
-
- if (tmpmode != result_reg_mode)
- result_reg = gen_lowpart (tmpmode, result_reg);
-
- expand_value_return (result_reg);
- }
- else if (cleanups
- && retval_rhs != 0
- && TREE_TYPE (retval_rhs) != void_type_node
- && GET_CODE (DECL_RTL (DECL_RESULT (current_function_decl))) == REG)
- {
- /* Calculate the return value into a pseudo reg. */
- val = gen_reg_rtx (DECL_MODE (DECL_RESULT (current_function_decl)));
- val = expand_expr (retval_rhs, val, GET_MODE (val), 0);
- val = force_not_mem (val);
- expand_cleanups_to (NULL_TREE);
- emit_queue ();
- /* All temporaries have now been used. */
- free_temp_slots ();
- /* Return the calculated value, doing cleanups first. */
- expand_value_return (val);
- }
- else
- {
- /* No cleanups or no hard reg used;
- calculate value into hard return reg. */
- expand_expr (retval, const0_rtx, VOIDmode, 0);
- expand_cleanups_to (NULL_TREE);
- emit_queue ();
- free_temp_slots ();
- expand_value_return (DECL_RTL (DECL_RESULT (current_function_decl)));
- }
-}
-
-/* Return 1 if the end of the generated RTX is not a barrier.
- This means code already compiled can drop through. */
-
-int
-drop_through_at_end_p ()
-{
- rtx insn = get_last_insn ();
- while (insn && GET_CODE (insn) == NOTE)
- insn = PREV_INSN (insn);
- return insn && GET_CODE (insn) != BARRIER;
-}
-
-/* Emit code to alter this function's formal parms for a tail-recursive call.
- ACTUALS is a list of actual parameter expressions (chain of TREE_LISTs).
- FORMALS is the chain of decls of formals.
- Return 1 if this can be done;
- otherwise return 0 and do not emit any code. */
-
-static int
-tail_recursion_args (actuals, formals)
- tree actuals, formals;
-{
- register tree a = actuals, f = formals;
- register int i;
- register rtx *argvec;
-
- /* Check that number and types of actuals are compatible
- with the formals. This is not always true in valid C code.
- Also check that no formal needs to be addressable
- and that all formals are scalars. */
-
- /* Also count the args. */
-
- for (a = actuals, f = formals, i = 0; a && f; a = TREE_CHAIN (a), f = TREE_CHAIN (f), i++)
- {
- if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (a)))
- != TYPE_MAIN_VARIANT (TREE_TYPE (f)))
- return 0;
- if (GET_CODE (DECL_RTL (f)) != REG || DECL_MODE (f) == BLKmode)
- return 0;
- }
- if (a != 0 || f != 0)
- return 0;
-
- /* Compute all the actuals. */
-
- argvec = (rtx *) alloca (i * sizeof (rtx));
-
- for (a = actuals, i = 0; a; a = TREE_CHAIN (a), i++)
- argvec[i] = expand_expr (TREE_VALUE (a), NULL_RTX, VOIDmode, 0);
-
- /* Find which actual values refer to current values of previous formals.
- Copy each of them now, before any formal is changed. */
-
- for (a = actuals, i = 0; a; a = TREE_CHAIN (a), i++)
- {
- int copy = 0;
- register int j;
- for (f = formals, j = 0; j < i; f = TREE_CHAIN (f), j++)
- if (reg_mentioned_p (DECL_RTL (f), argvec[i]))
- { copy = 1; break; }
- if (copy)
- argvec[i] = copy_to_reg (argvec[i]);
- }
-
- /* Store the values of the actuals into the formals. */
-
- for (f = formals, a = actuals, i = 0; f;
- f = TREE_CHAIN (f), a = TREE_CHAIN (a), i++)
- {
- if (GET_MODE (DECL_RTL (f)) == GET_MODE (argvec[i]))
- emit_move_insn (DECL_RTL (f), argvec[i]);
- else
- convert_move (DECL_RTL (f), argvec[i],
- TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (a))));
- }
-
- free_temp_slots ();
- return 1;
-}
-
-/* Generate the RTL code for entering a binding contour.
- The variables are declared one by one, by calls to `expand_decl'.
-
- EXIT_FLAG is nonzero if this construct should be visible to
- `exit_something'. */
-
-void
-expand_start_bindings (exit_flag)
- int exit_flag;
-{
- struct nesting *thisblock = ALLOC_NESTING ();
- rtx note = output_bytecode ? 0 : emit_note (NULL_PTR, NOTE_INSN_BLOCK_BEG);
-
- /* Make an entry on block_stack for the block we are entering. */
-
- thisblock->next = block_stack;
- thisblock->all = nesting_stack;
- thisblock->depth = ++nesting_depth;
- thisblock->data.block.stack_level = 0;
- thisblock->data.block.cleanups = 0;
- thisblock->data.block.function_call_count = 0;
-#if 0
- if (block_stack)
- {
- if (block_stack->data.block.cleanups == NULL_TREE
- && (block_stack->data.block.outer_cleanups == NULL_TREE
- || block_stack->data.block.outer_cleanups == empty_cleanup_list))
- thisblock->data.block.outer_cleanups = empty_cleanup_list;
- else
- thisblock->data.block.outer_cleanups
- = tree_cons (NULL_TREE, block_stack->data.block.cleanups,
- block_stack->data.block.outer_cleanups);
- }
- else
- thisblock->data.block.outer_cleanups = 0;
-#endif
-#if 1
- if (block_stack
- && !(block_stack->data.block.cleanups == NULL_TREE
- && block_stack->data.block.outer_cleanups == NULL_TREE))
- thisblock->data.block.outer_cleanups
- = tree_cons (NULL_TREE, block_stack->data.block.cleanups,
- block_stack->data.block.outer_cleanups);
- else
- thisblock->data.block.outer_cleanups = 0;
-#endif
- thisblock->data.block.label_chain = 0;
- thisblock->data.block.innermost_stack_block = stack_block_stack;
- thisblock->data.block.first_insn = note;
- thisblock->data.block.block_start_count = ++block_start_count;
- thisblock->exit_label = exit_flag ? gen_label_rtx () : 0;
- block_stack = thisblock;
- nesting_stack = thisblock;
-
- if (!output_bytecode)
- {
- /* Make a new level for allocating stack slots. */
- push_temp_slots ();
- }
-}
-
-/* Given a pointer to a BLOCK node, save a pointer to the most recently
- generated NOTE_INSN_BLOCK_END in the BLOCK_END_NOTE field of the given
- BLOCK node. */
-
-void
-remember_end_note (block)
- register tree block;
-{
- BLOCK_END_NOTE (block) = last_block_end_note;
- last_block_end_note = NULL_RTX;
-}
-
-/* Generate RTL code to terminate a binding contour.
- VARS is the chain of VAR_DECL nodes
- for the variables bound in this contour.
- MARK_ENDS is nonzero if we should put a note at the beginning
- and end of this binding contour.
-
- DONT_JUMP_IN is nonzero if it is not valid to jump into this contour.
- (That is true automatically if the contour has a saved stack level.) */
-
-void
-expand_end_bindings (vars, mark_ends, dont_jump_in)
- tree vars;
- int mark_ends;
- int dont_jump_in;
-{
- register struct nesting *thisblock = block_stack;
- register tree decl;
-
- if (output_bytecode)
- {
- bc_expand_end_bindings (vars, mark_ends, dont_jump_in);
- return;
- }
-
- if (warn_unused)
- for (decl = vars; decl; decl = TREE_CHAIN (decl))
- if (! TREE_USED (decl) && TREE_CODE (decl) == VAR_DECL
- && ! DECL_IN_SYSTEM_HEADER (decl))
- warning_with_decl (decl, "unused variable `%s'");
-
- if (thisblock->exit_label)
- {
- do_pending_stack_adjust ();
- emit_label (thisblock->exit_label);
- }
-
- /* If necessary, make a handler for nonlocal gotos taking
- place in the function calls in this block. */
- if (function_call_count != thisblock->data.block.function_call_count
- && nonlocal_labels
- /* Make handler for outermost block
- if there were any nonlocal gotos to this function. */
- && (thisblock->next == 0 ? current_function_has_nonlocal_label
- /* Make handler for inner block if it has something
- special to do when you jump out of it. */
- : (thisblock->data.block.cleanups != 0
- || thisblock->data.block.stack_level != 0)))
- {
- tree link;
- rtx afterward = gen_label_rtx ();
- rtx handler_label = gen_label_rtx ();
- rtx save_receiver = gen_reg_rtx (Pmode);
- rtx insns;
-
- /* Don't let jump_optimize delete the handler. */
- LABEL_PRESERVE_P (handler_label) = 1;
-
- /* Record the handler address in the stack slot for that purpose,
- during this block, saving and restoring the outer value. */
- if (thisblock->next != 0)
- {
- emit_move_insn (nonlocal_goto_handler_slot, save_receiver);
-
- start_sequence ();
- emit_move_insn (save_receiver, nonlocal_goto_handler_slot);
- insns = get_insns ();
- end_sequence ();
- emit_insns_before (insns, thisblock->data.block.first_insn);
- }
-
- start_sequence ();
- emit_move_insn (nonlocal_goto_handler_slot,
- gen_rtx (LABEL_REF, Pmode, handler_label));
- insns = get_insns ();
- end_sequence ();
- emit_insns_before (insns, thisblock->data.block.first_insn);
-
- /* Jump around the handler; it runs only when specially invoked. */
- emit_jump (afterward);
- emit_label (handler_label);
-
-#ifdef HAVE_nonlocal_goto
- if (! HAVE_nonlocal_goto)
-#endif
- /* First adjust our frame pointer to its actual value. It was
- previously set to the start of the virtual area corresponding to
- the stacked variables when we branched here and now needs to be
- adjusted to the actual hardware fp value.
-
- Assignments are to virtual registers are converted by
- instantiate_virtual_regs into the corresponding assignment
- to the underlying register (fp in this case) that makes
- the original assignment true.
- So the following insn will actually be
- decrementing fp by STARTING_FRAME_OFFSET. */
- emit_move_insn (virtual_stack_vars_rtx, hard_frame_pointer_rtx);
-
-#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- if (fixed_regs[ARG_POINTER_REGNUM])
- {
-#ifdef ELIMINABLE_REGS
- /* If the argument pointer can be eliminated in favor of the
- frame pointer, we don't need to restore it. We assume here
- that if such an elimination is present, it can always be used.
- This is the case on all known machines; if we don't make this
- assumption, we do unnecessary saving on many machines. */
- static struct elims {int from, to;} elim_regs[] = ELIMINABLE_REGS;
- int i;
-
- for (i = 0; i < sizeof elim_regs / sizeof elim_regs[0]; i++)
- if (elim_regs[i].from == ARG_POINTER_REGNUM
- && elim_regs[i].to == HARD_FRAME_POINTER_REGNUM)
- break;
-
- if (i == sizeof elim_regs / sizeof elim_regs [0])
-#endif
- {
- /* Now restore our arg pointer from the address at which it
- was saved in our stack frame.
- If there hasn't be space allocated for it yet, make
- some now. */
- if (arg_pointer_save_area == 0)
- arg_pointer_save_area
- = assign_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0);
- emit_move_insn (virtual_incoming_args_rtx,
- /* We need a pseudo here, or else
- instantiate_virtual_regs_1 complains. */
- copy_to_reg (arg_pointer_save_area));
- }
- }
-#endif
-
-#ifdef HAVE_nonlocal_goto_receiver
- if (HAVE_nonlocal_goto_receiver)
- emit_insn (gen_nonlocal_goto_receiver ());
-#endif
-
- /* The handler expects the desired label address in the static chain
- register. It tests the address and does an appropriate jump
- to whatever label is desired. */
- for (link = nonlocal_labels; link; link = TREE_CHAIN (link))
- /* Skip any labels we shouldn't be able to jump to from here. */
- if (! DECL_TOO_LATE (TREE_VALUE (link)))
- {
- rtx not_this = gen_label_rtx ();
- rtx this = gen_label_rtx ();
- do_jump_if_equal (static_chain_rtx,
- gen_rtx (LABEL_REF, Pmode, DECL_RTL (TREE_VALUE (link))),
- this, 0);
- emit_jump (not_this);
- emit_label (this);
- expand_goto (TREE_VALUE (link));
- emit_label (not_this);
- }
- /* If label is not recognized, abort. */
- emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "abort"), 0,
- VOIDmode, 0);
- emit_barrier ();
- emit_label (afterward);
- }
-
- /* Don't allow jumping into a block that has cleanups or a stack level. */
- if (dont_jump_in
- || thisblock->data.block.stack_level != 0
- || thisblock->data.block.cleanups != 0)
- {
- struct label_chain *chain;
-
- /* Any labels in this block are no longer valid to go to.
- Mark them to cause an error message. */
- for (chain = thisblock->data.block.label_chain; chain; chain = chain->next)
- {
- DECL_TOO_LATE (chain->label) = 1;
- /* If any goto without a fixup came to this label,
- that must be an error, because gotos without fixups
- come from outside all saved stack-levels and all cleanups. */
- if (TREE_ADDRESSABLE (chain->label))
- error_with_decl (chain->label,
- "label `%s' used before containing binding contour");
- }
- }
-
- /* Restore stack level in effect before the block
- (only if variable-size objects allocated). */
- /* Perform any cleanups associated with the block. */
-
- if (thisblock->data.block.stack_level != 0
- || thisblock->data.block.cleanups != 0)
- {
- /* Only clean up here if this point can actually be reached. */
- int reachable = GET_CODE (get_last_insn ()) != BARRIER;
-
- /* Don't let cleanups affect ({...}) constructs. */
- int old_expr_stmts_for_value = expr_stmts_for_value;
- rtx old_last_expr_value = last_expr_value;
- tree old_last_expr_type = last_expr_type;
- expr_stmts_for_value = 0;
-
- /* Do the cleanups. */
- expand_cleanups (thisblock->data.block.cleanups, NULL_TREE, 0, reachable);
- if (reachable)
- do_pending_stack_adjust ();
-
- expr_stmts_for_value = old_expr_stmts_for_value;
- last_expr_value = old_last_expr_value;
- last_expr_type = old_last_expr_type;
-
- /* Restore the stack level. */
-
- if (reachable && thisblock->data.block.stack_level != 0)
- {
- emit_stack_restore (thisblock->next ? SAVE_BLOCK : SAVE_FUNCTION,
- thisblock->data.block.stack_level, NULL_RTX);
- if (nonlocal_goto_handler_slot != 0)
- emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level,
- NULL_RTX);
- }
-
- /* Any gotos out of this block must also do these things.
- Also report any gotos with fixups that came to labels in this
- level. */
- fixup_gotos (thisblock,
- thisblock->data.block.stack_level,
- thisblock->data.block.cleanups,
- thisblock->data.block.first_insn,
- dont_jump_in);
- }
-
- /* Mark the beginning and end of the scope if requested.
- We do this now, after running cleanups on the variables
- just going out of scope, so they are in scope for their cleanups. */
-
- if (mark_ends)
- last_block_end_note = emit_note (NULL_PTR, NOTE_INSN_BLOCK_END);
- else
- /* Get rid of the beginning-mark if we don't make an end-mark. */
- NOTE_LINE_NUMBER (thisblock->data.block.first_insn) = NOTE_INSN_DELETED;
-
- /* If doing stupid register allocation, make sure lives of all
- register variables declared here extend thru end of scope. */
-
- if (obey_regdecls)
- for (decl = vars; decl; decl = TREE_CHAIN (decl))
- {
- rtx rtl = DECL_RTL (decl);
- if (TREE_CODE (decl) == VAR_DECL && rtl != 0)
- use_variable (rtl);
- }
-
- /* Restore block_stack level for containing block. */
-
- stack_block_stack = thisblock->data.block.innermost_stack_block;
- POPSTACK (block_stack);
-
- /* Pop the stack slot nesting and free any slots at this level. */
- pop_temp_slots ();
-}
-
-
-/* End a binding contour.
- VARS is the chain of VAR_DECL nodes for the variables bound
- in this contour. MARK_ENDS is nonzer if we should put a note
- at the beginning and end of this binding contour.
- DONT_JUMP_IN is nonzero if it is not valid to jump into this
- contour. */
-
-static void
-bc_expand_end_bindings (vars, mark_ends, dont_jump_in)
- tree vars;
- int mark_ends;
- int dont_jump_in;
-{
- struct nesting *thisbind = nesting_stack;
- tree decl;
-
- if (warn_unused)
- for (decl = vars; decl; decl = TREE_CHAIN (decl))
- if (! TREE_USED (TREE_VALUE (decl)) && TREE_CODE (TREE_VALUE (decl)) == VAR_DECL)
- warning_with_decl (decl, "unused variable `%s'");
-
- if (thisbind->exit_label)
- bc_emit_bytecode_labeldef (BYTECODE_BC_LABEL (thisbind->exit_label));
-
- /* Pop block/bindings off stack */
- POPSTACK (block_stack);
-}
-
-/* Generate RTL for the automatic variable declaration DECL.
- (Other kinds of declarations are simply ignored if seen here.) */
-
-void
-expand_decl (decl)
- register tree decl;
-{
- struct nesting *thisblock = block_stack;
- tree type;
-
- if (output_bytecode)
- {
- bc_expand_decl (decl, 0);
- return;
- }
-
- type = TREE_TYPE (decl);
-
- /* Only automatic variables need any expansion done.
- Static and external variables, and external functions,
- will be handled by `assemble_variable' (called from finish_decl).
- TYPE_DECL and CONST_DECL require nothing.
- PARM_DECLs are handled in `assign_parms'. */
-
- if (TREE_CODE (decl) != VAR_DECL)
- return;
- if (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
- return;
-
- /* Create the RTL representation for the variable. */
-
- if (type == error_mark_node)
- DECL_RTL (decl) = gen_rtx (MEM, BLKmode, const0_rtx);
- else if (DECL_SIZE (decl) == 0)
- /* Variable with incomplete type. */
- {
- if (DECL_INITIAL (decl) == 0)
- /* Error message was already done; now avoid a crash. */
- DECL_RTL (decl) = assign_stack_temp (DECL_MODE (decl), 0, 1);
- else
- /* An initializer is going to decide the size of this array.
- Until we know the size, represent its address with a reg. */
- DECL_RTL (decl) = gen_rtx (MEM, BLKmode, gen_reg_rtx (Pmode));
- MEM_IN_STRUCT_P (DECL_RTL (decl)) = AGGREGATE_TYPE_P (type);
- }
- else if (DECL_MODE (decl) != BLKmode
- /* If -ffloat-store, don't put explicit float vars
- into regs. */
- && !(flag_float_store
- && TREE_CODE (type) == REAL_TYPE)
- && ! TREE_THIS_VOLATILE (decl)
- && ! TREE_ADDRESSABLE (decl)
- && (DECL_REGISTER (decl) || ! obey_regdecls))
- {
- /* Automatic variable that can go in a register. */
- int unsignedp = TREE_UNSIGNED (type);
- enum machine_mode reg_mode
- = promote_mode (type, DECL_MODE (decl), &unsignedp, 0);
-
- DECL_RTL (decl) = gen_reg_rtx (reg_mode);
- mark_user_reg (DECL_RTL (decl));
-
- if (TREE_CODE (type) == POINTER_TYPE)
- mark_reg_pointer (DECL_RTL (decl),
- (TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl)))
- / BITS_PER_UNIT));
- }
-
- else if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
- {
- /* Variable of fixed size that goes on the stack. */
- rtx oldaddr = 0;
- rtx addr;
-
- /* If we previously made RTL for this decl, it must be an array
- whose size was determined by the initializer.
- The old address was a register; set that register now
- to the proper address. */
- if (DECL_RTL (decl) != 0)
- {
- if (GET_CODE (DECL_RTL (decl)) != MEM
- || GET_CODE (XEXP (DECL_RTL (decl), 0)) != REG)
- abort ();
- oldaddr = XEXP (DECL_RTL (decl), 0);
- }
-
- DECL_RTL (decl)
- = assign_stack_temp (DECL_MODE (decl),
- ((TREE_INT_CST_LOW (DECL_SIZE (decl))
- + BITS_PER_UNIT - 1)
- / BITS_PER_UNIT),
- 1);
- MEM_IN_STRUCT_P (DECL_RTL (decl)) = AGGREGATE_TYPE_P (TREE_TYPE (decl));
-
- /* Set alignment we actually gave this decl. */
- DECL_ALIGN (decl) = (DECL_MODE (decl) == BLKmode ? BIGGEST_ALIGNMENT
- : GET_MODE_BITSIZE (DECL_MODE (decl)));
-
- if (oldaddr)
- {
- addr = force_operand (XEXP (DECL_RTL (decl), 0), oldaddr);
- if (addr != oldaddr)
- emit_move_insn (oldaddr, addr);
- }
-
- /* If this is a memory ref that contains aggregate components,
- mark it as such for cse and loop optimize. */
- MEM_IN_STRUCT_P (DECL_RTL (decl)) = AGGREGATE_TYPE_P (TREE_TYPE (decl));
-#if 0
- /* If this is in memory because of -ffloat-store,
- set the volatile bit, to prevent optimizations from
- undoing the effects. */
- if (flag_float_store && TREE_CODE (type) == REAL_TYPE)
- MEM_VOLATILE_P (DECL_RTL (decl)) = 1;
-#endif
- }
- else
- /* Dynamic-size object: must push space on the stack. */
- {
- rtx address, size;
-
- /* Record the stack pointer on entry to block, if have
- not already done so. */
- if (thisblock->data.block.stack_level == 0)
- {
- do_pending_stack_adjust ();
- emit_stack_save (thisblock->next ? SAVE_BLOCK : SAVE_FUNCTION,
- &thisblock->data.block.stack_level,
- thisblock->data.block.first_insn);
- stack_block_stack = thisblock;
- }
-
- /* Compute the variable's size, in bytes. */
- size = expand_expr (size_binop (CEIL_DIV_EXPR,
- DECL_SIZE (decl),
- size_int (BITS_PER_UNIT)),
- NULL_RTX, VOIDmode, 0);
- free_temp_slots ();
-
- /* Allocate space on the stack for the variable. Note that
- DECL_ALIGN says how the variable is to be aligned and we
- cannot use it to conclude anything about the alignment of
- the size. */
- address = allocate_dynamic_stack_space (size, NULL_RTX,
- TYPE_ALIGN (TREE_TYPE (decl)));
-
- /* Reference the variable indirect through that rtx. */
- DECL_RTL (decl) = gen_rtx (MEM, DECL_MODE (decl), address);
-
- /* If this is a memory ref that contains aggregate components,
- mark it as such for cse and loop optimize. */
- MEM_IN_STRUCT_P (DECL_RTL (decl)) = AGGREGATE_TYPE_P (TREE_TYPE (decl));
-
- /* Indicate the alignment we actually gave this variable. */
-#ifdef STACK_BOUNDARY
- DECL_ALIGN (decl) = STACK_BOUNDARY;
-#else
- DECL_ALIGN (decl) = BIGGEST_ALIGNMENT;
-#endif
- }
-
- if (TREE_THIS_VOLATILE (decl))
- MEM_VOLATILE_P (DECL_RTL (decl)) = 1;
-#if 0 /* A variable is not necessarily unchanging
- just because it is const. RTX_UNCHANGING_P
- means no change in the function,
- not merely no change in the variable's scope.
- It is correct to set RTX_UNCHANGING_P if the variable's scope
- is the whole function. There's no convenient way to test that. */
- if (TREE_READONLY (decl))
- RTX_UNCHANGING_P (DECL_RTL (decl)) = 1;
-#endif
-
- /* If doing stupid register allocation, make sure life of any
- register variable starts here, at the start of its scope. */
-
- if (obey_regdecls)
- use_variable (DECL_RTL (decl));
-}
-
-
-/* Generate code for the automatic variable declaration DECL. For
- most variables this just means we give it a stack offset. The
- compiler sometimes emits cleanups without variables and we will
- have to deal with those too. */
-
-static void
-bc_expand_decl (decl, cleanup)
- tree decl;
- tree cleanup;
-{
- tree type;
-
- if (!decl)
- {
- /* A cleanup with no variable. */
- if (!cleanup)
- abort ();
-
- return;
- }
-
- /* Only auto variables need any work. */
- if (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl) || DECL_EXTERNAL (decl))
- return;
-
- type = TREE_TYPE (decl);
-
- if (type == error_mark_node)
- DECL_RTL (decl) = bc_gen_rtx ((char *) 0, 0, (struct bc_label *) 0);
-
- else if (DECL_SIZE (decl) == 0)
-
- /* Variable with incomplete type. The stack offset herein will be
- fixed later in expand_decl_init (). */
- DECL_RTL (decl) = bc_gen_rtx ((char *) 0, 0, (struct bc_label *) 0);
-
- else if (TREE_CONSTANT (DECL_SIZE (decl)))
- {
- DECL_RTL (decl) = bc_allocate_local (TREE_INT_CST_LOW (DECL_SIZE (decl)) / BITS_PER_UNIT,
- DECL_ALIGN (decl));
- }
- else
- DECL_RTL (decl) = bc_allocate_variable_array (DECL_SIZE (decl));
-}
-
-/* Emit code to perform the initialization of a declaration DECL. */
-
-void
-expand_decl_init (decl)
- tree decl;
-{
- int was_used = TREE_USED (decl);
-
- if (output_bytecode)
- {
- bc_expand_decl_init (decl);
- return;
- }
-
- /* If this is a CONST_DECL, we don't have to generate any code, but
- if DECL_INITIAL is a constant, call expand_expr to force TREE_CST_RTL
- to be set while in the obstack containing the constant. If we don't
- do this, we can lose if we have functions nested three deep and the middle
- function makes a CONST_DECL whose DECL_INITIAL is a STRING_CST while
- the innermost function is the first to expand that STRING_CST. */
- if (TREE_CODE (decl) == CONST_DECL)
- {
- if (DECL_INITIAL (decl) && TREE_CONSTANT (DECL_INITIAL (decl)))
- expand_expr (DECL_INITIAL (decl), NULL_RTX, VOIDmode,
- EXPAND_INITIALIZER);
- return;
- }
-
- if (TREE_STATIC (decl))
- return;
-
- /* Compute and store the initial value now. */
-
- if (DECL_INITIAL (decl) == error_mark_node)
- {
- enum tree_code code = TREE_CODE (TREE_TYPE (decl));
- if (code == INTEGER_TYPE || code == REAL_TYPE || code == ENUMERAL_TYPE
- || code == POINTER_TYPE)
- expand_assignment (decl, convert (TREE_TYPE (decl), integer_zero_node),
- 0, 0);
- emit_queue ();
- }
- else if (DECL_INITIAL (decl) && TREE_CODE (DECL_INITIAL (decl)) != TREE_LIST)
- {
- emit_line_note (DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
- expand_assignment (decl, DECL_INITIAL (decl), 0, 0);
- emit_queue ();
- }
-
- /* Don't let the initialization count as "using" the variable. */
- TREE_USED (decl) = was_used;
-
- /* Free any temporaries we made while initializing the decl. */
- preserve_temp_slots (NULL_RTX);
- free_temp_slots ();
-}
-
-/* Expand initialization for variable-sized types. Allocate array
- using newlocalSI and set local variable, which is a pointer to the
- storage. */
-
-static void
-bc_expand_variable_local_init (decl)
- tree decl;
-{
- /* Evaluate size expression and coerce to SI */
- bc_expand_expr (DECL_SIZE (decl));
-
- /* Type sizes are always (?) of TREE_CODE INTEGER_CST, so
- no coercion is necessary (?) */
-
-/* emit_typecode_conversion (preferred_typecode (TYPE_MODE (DECL_SIZE (decl)),
- TREE_UNSIGNED (DECL_SIZE (decl))), SIcode); */
-
- /* Emit code to allocate array */
- bc_emit_instruction (newlocalSI);
-
- /* Store array pointer in local variable. This is the only instance
- where we actually want the address of the pointer to the
- variable-size block, rather than the pointer itself. We avoid
- using expand_address() since that would cause the pointer to be
- pushed rather than its address. Hence the hard-coded reference;
- notice also that the variable is always local (no global
- variable-size type variables). */
-
- bc_load_localaddr (DECL_RTL (decl));
- bc_emit_instruction (storeP);
-}
-
-
-/* Emit code to initialize a declaration. */
-
-static void
-bc_expand_decl_init (decl)
- tree decl;
-{
- int org_stack_depth;
-
- /* Statical initializers are handled elsewhere */
-
- if (TREE_STATIC (decl))
- return;
-
- /* Memory original stack depth */
- org_stack_depth = stack_depth;
-
- /* If the type is variable-size, we first create its space (we ASSUME
- it CAN'T be static). We do this regardless of whether there's an
- initializer assignment or not. */
-
- if (TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
- bc_expand_variable_local_init (decl);
-
- /* Expand initializer assignment */
- if (DECL_INITIAL (decl) == error_mark_node)
- {
- enum tree_code code = TREE_CODE (TREE_TYPE (decl));
-
- if (code == INTEGER_TYPE || code == REAL_TYPE || code == ENUMERAL_TYPE
- || code == POINTER_TYPE)
-
- expand_assignment (TREE_TYPE (decl), decl, 0, 0);
- }
- else if (DECL_INITIAL (decl))
- expand_assignment (TREE_TYPE (decl), decl, 0, 0);
-
- /* Restore stack depth */
- if (org_stack_depth > stack_depth)
- abort ();
-
- bc_adjust_stack (stack_depth - org_stack_depth);
-}
-
-
-/* CLEANUP is an expression to be executed at exit from this binding contour;
- for example, in C++, it might call the destructor for this variable.
-
- We wrap CLEANUP in an UNSAVE_EXPR node, so that we can expand the
- CLEANUP multiple times, and have the correct semantics. This
- happens in exception handling, and for non-local gotos.
-
- If CLEANUP is nonzero and DECL is zero, we record a cleanup
- that is not associated with any particular variable. */
-
-int
-expand_decl_cleanup (decl, cleanup)
- tree decl, cleanup;
-{
- struct nesting *thisblock = block_stack;
-
- /* Error if we are not in any block. */
- if (thisblock == 0)
- return 0;
-
- /* Record the cleanup if there is one. */
-
- if (cleanup != 0)
- {
- cleanup = unsave_expr (cleanup);
-
- thisblock->data.block.cleanups
- = temp_tree_cons (decl, cleanup, thisblock->data.block.cleanups);
- /* If this block has a cleanup, it belongs in stack_block_stack. */
- stack_block_stack = thisblock;
- expand_eh_region_start ();
- }
- return 1;
-}
-
-/* DECL is an anonymous union. CLEANUP is a cleanup for DECL.
- DECL_ELTS is the list of elements that belong to DECL's type.
- In each, the TREE_VALUE is a VAR_DECL, and the TREE_PURPOSE a cleanup. */
-
-void
-expand_anon_union_decl (decl, cleanup, decl_elts)
- tree decl, cleanup, decl_elts;
-{
- struct nesting *thisblock = block_stack;
- rtx x;
-
- expand_decl (decl);
- expand_decl_cleanup (decl, cleanup);
- x = DECL_RTL (decl);
-
- while (decl_elts)
- {
- tree decl_elt = TREE_VALUE (decl_elts);
- tree cleanup_elt = TREE_PURPOSE (decl_elts);
- enum machine_mode mode = TYPE_MODE (TREE_TYPE (decl_elt));
-
- /* Propagate the union's alignment to the elements. */
- DECL_ALIGN (decl_elt) = DECL_ALIGN (decl);
-
- /* If the element has BLKmode and the union doesn't, the union is
- aligned such that the element doesn't need to have BLKmode, so
- change the element's mode to the appropriate one for its size. */
- if (mode == BLKmode && DECL_MODE (decl) != BLKmode)
- DECL_MODE (decl_elt) = mode
- = mode_for_size (TREE_INT_CST_LOW (DECL_SIZE (decl_elt)),
- MODE_INT, 1);
-
- /* (SUBREG (MEM ...)) at RTL generation time is invalid, so we
- instead create a new MEM rtx with the proper mode. */
- if (GET_CODE (x) == MEM)
- {
- if (mode == GET_MODE (x))
- DECL_RTL (decl_elt) = x;
- else
- {
- DECL_RTL (decl_elt) = gen_rtx (MEM, mode, copy_rtx (XEXP (x, 0)));
- MEM_IN_STRUCT_P (DECL_RTL (decl_elt)) = MEM_IN_STRUCT_P (x);
- RTX_UNCHANGING_P (DECL_RTL (decl_elt)) = RTX_UNCHANGING_P (x);
- }
- }
- else if (GET_CODE (x) == REG)
- {
- if (mode == GET_MODE (x))
- DECL_RTL (decl_elt) = x;
- else
- DECL_RTL (decl_elt) = gen_rtx (SUBREG, mode, x, 0);
- }
- else
- abort ();
-
- /* Record the cleanup if there is one. */
-
- if (cleanup != 0)
- thisblock->data.block.cleanups
- = temp_tree_cons (decl_elt, cleanup_elt,
- thisblock->data.block.cleanups);
-
- decl_elts = TREE_CHAIN (decl_elts);
- }
-}
-
-/* Expand a list of cleanups LIST.
- Elements may be expressions or may be nested lists.
-
- If DONT_DO is nonnull, then any list-element
- whose TREE_PURPOSE matches DONT_DO is omitted.
- This is sometimes used to avoid a cleanup associated with
- a value that is being returned out of the scope.
-
- If IN_FIXUP is non-zero, we are generating this cleanup for a fixup
- goto and handle protection regions specially in that case.
-
- If REACHABLE, we emit code, otherwise just inform the exception handling
- code about this finalization. */
-
-static void
-expand_cleanups (list, dont_do, in_fixup, reachable)
- tree list;
- tree dont_do;
- int in_fixup;
- int reachable;
-{
- tree tail;
- for (tail = list; tail; tail = TREE_CHAIN (tail))
- if (dont_do == 0 || TREE_PURPOSE (tail) != dont_do)
- {
- if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
- expand_cleanups (TREE_VALUE (tail), dont_do, in_fixup, reachable);
- else
- {
- if (! in_fixup)
- expand_eh_region_end (TREE_VALUE (tail));
-
- if (reachable)
- {
- /* Cleanups may be run multiple times. For example,
- when exiting a binding contour, we expand the
- cleanups associated with that contour. When a goto
- within that binding contour has a target outside that
- contour, it will expand all cleanups from its scope to
- the target. Though the cleanups are expanded multiple
- times, the control paths are non-overlapping so the
- cleanups will not be executed twice. */
- expand_expr (TREE_VALUE (tail), const0_rtx, VOIDmode, 0);
- free_temp_slots ();
- }
- }
- }
-}
-
-/* Move all cleanups from the current block_stack
- to the containing block_stack, where they are assumed to
- have been created. If anything can cause a temporary to
- be created, but not expanded for more than one level of
- block_stacks, then this code will have to change. */
-
-void
-move_cleanups_up ()
-{
- struct nesting *block = block_stack;
- struct nesting *outer = block->next;
-
- outer->data.block.cleanups
- = chainon (block->data.block.cleanups,
- outer->data.block.cleanups);
- block->data.block.cleanups = 0;
-}
-
-tree
-last_cleanup_this_contour ()
-{
- if (block_stack == 0)
- return 0;
-
- return block_stack->data.block.cleanups;
-}
-
-/* Return 1 if there are any pending cleanups at this point.
- If THIS_CONTOUR is nonzero, check the current contour as well.
- Otherwise, look only at the contours that enclose this one. */
-
-int
-any_pending_cleanups (this_contour)
- int this_contour;
-{
- struct nesting *block;
-
- if (block_stack == 0)
- return 0;
-
- if (this_contour && block_stack->data.block.cleanups != NULL)
- return 1;
- if (block_stack->data.block.cleanups == 0
- && (block_stack->data.block.outer_cleanups == 0
-#if 0
- || block_stack->data.block.outer_cleanups == empty_cleanup_list
-#endif
- ))
- return 0;
-
- for (block = block_stack->next; block; block = block->next)
- if (block->data.block.cleanups != 0)
- return 1;
-
- return 0;
-}
-
-/* Enter a case (Pascal) or switch (C) statement.
- Push a block onto case_stack and nesting_stack
- to accumulate the case-labels that are seen
- and to record the labels generated for the statement.
-
- EXIT_FLAG is nonzero if `exit_something' should exit this case stmt.
- Otherwise, this construct is transparent for `exit_something'.
-
- EXPR is the index-expression to be dispatched on.
- TYPE is its nominal type. We could simply convert EXPR to this type,
- but instead we take short cuts. */
-
-void
-expand_start_case (exit_flag, expr, type, printname)
- int exit_flag;
- tree expr;
- tree type;
- char *printname;
-{
- register struct nesting *thiscase = ALLOC_NESTING ();
-
- /* Make an entry on case_stack for the case we are entering. */
-
- thiscase->next = case_stack;
- thiscase->all = nesting_stack;
- thiscase->depth = ++nesting_depth;
- thiscase->exit_label = exit_flag ? gen_label_rtx () : 0;
- thiscase->data.case_stmt.case_list = 0;
- thiscase->data.case_stmt.index_expr = expr;
- thiscase->data.case_stmt.nominal_type = type;
- thiscase->data.case_stmt.default_label = 0;
- thiscase->data.case_stmt.num_ranges = 0;
- thiscase->data.case_stmt.printname = printname;
- thiscase->data.case_stmt.seenlabel = 0;
- case_stack = thiscase;
- nesting_stack = thiscase;
-
- if (output_bytecode)
- {
- bc_expand_start_case (thiscase, expr, type, printname);
- return;
- }
-
- do_pending_stack_adjust ();
-
- /* Make sure case_stmt.start points to something that won't
- need any transformation before expand_end_case. */
- if (GET_CODE (get_last_insn ()) != NOTE)
- emit_note (NULL_PTR, NOTE_INSN_DELETED);
-
- thiscase->data.case_stmt.start = get_last_insn ();
-}
-
-
-/* Enter a case statement. It is assumed that the caller has pushed
- the current context onto the case stack. */
-
-static void
-bc_expand_start_case (thiscase, expr, type, printname)
- struct nesting *thiscase;
- tree expr;
- tree type;
- char *printname;
-{
- bc_expand_expr (expr);
- bc_expand_conversion (TREE_TYPE (expr), type);
-
- /* For cases, the skip is a place we jump to that's emitted after
- the size of the jump table is known. */
-
- thiscase->data.case_stmt.skip_label = gen_label_rtx ();
- bc_emit_bytecode (jump);
- bc_emit_bytecode_labelref (BYTECODE_BC_LABEL (thiscase->data.case_stmt.skip_label));
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-}
-
-
-/* Start a "dummy case statement" within which case labels are invalid
- and are not connected to any larger real case statement.
- This can be used if you don't want to let a case statement jump
- into the middle of certain kinds of constructs. */
-
-void
-expand_start_case_dummy ()
-{
- register struct nesting *thiscase = ALLOC_NESTING ();
-
- /* Make an entry on case_stack for the dummy. */
-
- thiscase->next = case_stack;
- thiscase->all = nesting_stack;
- thiscase->depth = ++nesting_depth;
- thiscase->exit_label = 0;
- thiscase->data.case_stmt.case_list = 0;
- thiscase->data.case_stmt.start = 0;
- thiscase->data.case_stmt.nominal_type = 0;
- thiscase->data.case_stmt.default_label = 0;
- thiscase->data.case_stmt.num_ranges = 0;
- case_stack = thiscase;
- nesting_stack = thiscase;
-}
-
-/* End a dummy case statement. */
-
-void
-expand_end_case_dummy ()
-{
- POPSTACK (case_stack);
-}
-
-/* Return the data type of the index-expression
- of the innermost case statement, or null if none. */
-
-tree
-case_index_expr_type ()
-{
- if (case_stack)
- return TREE_TYPE (case_stack->data.case_stmt.index_expr);
- return 0;
-}
-
-/* Accumulate one case or default label inside a case or switch statement.
- VALUE is the value of the case (a null pointer, for a default label).
- The function CONVERTER, when applied to arguments T and V,
- converts the value V to the type T.
-
- If not currently inside a case or switch statement, return 1 and do
- nothing. The caller will print a language-specific error message.
- If VALUE is a duplicate or overlaps, return 2 and do nothing
- except store the (first) duplicate node in *DUPLICATE.
- If VALUE is out of range, return 3 and do nothing.
- If we are jumping into the scope of a cleaup or var-sized array, return 5.
- Return 0 on success.
-
- Extended to handle range statements. */
-
-int
-pushcase (value, converter, label, duplicate)
- register tree value;
- tree (*converter) PROTO((tree, tree));
- register tree label;
- tree *duplicate;
-{
- register struct case_node **l;
- register struct case_node *n;
- tree index_type;
- tree nominal_type;
-
- if (output_bytecode)
- return bc_pushcase (value, label);
-
- /* Fail if not inside a real case statement. */
- if (! (case_stack && case_stack->data.case_stmt.start))
- return 1;
-
- if (stack_block_stack
- && stack_block_stack->depth > case_stack->depth)
- return 5;
-
- index_type = TREE_TYPE (case_stack->data.case_stmt.index_expr);
- nominal_type = case_stack->data.case_stmt.nominal_type;
-
- /* If the index is erroneous, avoid more problems: pretend to succeed. */
- if (index_type == error_mark_node)
- return 0;
-
- /* Convert VALUE to the type in which the comparisons are nominally done. */
- if (value != 0)
- value = (*converter) (nominal_type, value);
-
- /* If this is the first label, warn if any insns have been emitted. */
- if (case_stack->data.case_stmt.seenlabel == 0)
- {
- rtx insn;
- for (insn = case_stack->data.case_stmt.start;
- insn;
- insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL)
- break;
- if (GET_CODE (insn) != NOTE
- && (GET_CODE (insn) != INSN || GET_CODE (PATTERN (insn)) != USE))
- {
- warning ("unreachable code at beginning of %s",
- case_stack->data.case_stmt.printname);
- break;
- }
- }
- }
- case_stack->data.case_stmt.seenlabel = 1;
-
- /* Fail if this value is out of range for the actual type of the index
- (which may be narrower than NOMINAL_TYPE). */
- if (value != 0 && ! int_fits_type_p (value, index_type))
- return 3;
-
- /* Fail if this is a duplicate or overlaps another entry. */
- if (value == 0)
- {
- if (case_stack->data.case_stmt.default_label != 0)
- {
- *duplicate = case_stack->data.case_stmt.default_label;
- return 2;
- }
- case_stack->data.case_stmt.default_label = label;
- }
- else
- return add_case_node (value, value, label, duplicate);
-
- expand_label (label);
- return 0;
-}
-
-/* Like pushcase but this case applies to all values
- between VALUE1 and VALUE2 (inclusive).
- The return value is the same as that of pushcase
- but there is one additional error code:
- 4 means the specified range was empty. */
-
-int
-pushcase_range (value1, value2, converter, label, duplicate)
- register tree value1, value2;
- tree (*converter) PROTO((tree, tree));
- register tree label;
- tree *duplicate;
-{
- register struct case_node **l;
- register struct case_node *n;
- tree index_type;
- tree nominal_type;
-
- /* Fail if not inside a real case statement. */
- if (! (case_stack && case_stack->data.case_stmt.start))
- return 1;
-
- if (stack_block_stack
- && stack_block_stack->depth > case_stack->depth)
- return 5;
-
- index_type = TREE_TYPE (case_stack->data.case_stmt.index_expr);
- nominal_type = case_stack->data.case_stmt.nominal_type;
-
- /* If the index is erroneous, avoid more problems: pretend to succeed. */
- if (index_type == error_mark_node)
- return 0;
-
- /* If this is the first label, warn if any insns have been emitted. */
- if (case_stack->data.case_stmt.seenlabel == 0)
- {
- rtx insn;
- for (insn = case_stack->data.case_stmt.start;
- insn;
- insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL)
- break;
- if (GET_CODE (insn) != NOTE
- && (GET_CODE (insn) != INSN || GET_CODE (PATTERN (insn)) != USE))
- {
- warning ("unreachable code at beginning of %s",
- case_stack->data.case_stmt.printname);
- break;
- }
- }
- }
- case_stack->data.case_stmt.seenlabel = 1;
-
- /* Convert VALUEs to type in which the comparisons are nominally done. */
- if (value1 == 0) /* Negative infinity. */
- value1 = TYPE_MIN_VALUE(index_type);
- value1 = (*converter) (nominal_type, value1);
-
- if (value2 == 0) /* Positive infinity. */
- value2 = TYPE_MAX_VALUE(index_type);
- value2 = (*converter) (nominal_type, value2);
-
- /* Fail if these values are out of range. */
- if (! int_fits_type_p (value1, index_type))
- return 3;
-
- if (! int_fits_type_p (value2, index_type))
- return 3;
-
- /* Fail if the range is empty. */
- if (tree_int_cst_lt (value2, value1))
- return 4;
-
- return add_case_node (value1, value2, label, duplicate);
-}
-
-/* Do the actual insertion of a case label for pushcase and pushcase_range
- into case_stack->data.case_stmt.case_list. Use an AVL tree to avoid
- slowdown for large switch statements. */
-
-static int
-add_case_node (low, high, label, duplicate)
- tree low, high;
- tree label;
- tree *duplicate;
-{
- struct case_node *p, **q, *r;
-
- q = &case_stack->data.case_stmt.case_list;
- p = *q;
-
- while (r = *q)
- {
- p = r;
-
- /* Keep going past elements distinctly greater than HIGH. */
- if (tree_int_cst_lt (high, p->low))
- q = &p->left;
-
- /* or distinctly less than LOW. */
- else if (tree_int_cst_lt (p->high, low))
- q = &p->right;
-
- else
- {
- /* We have an overlap; this is an error. */
- *duplicate = p->code_label;
- return 2;
- }
- }
-
- /* Add this label to the chain, and succeed.
- Copy LOW, HIGH so they are on temporary rather than momentary
- obstack and will thus survive till the end of the case statement. */
-
- r = (struct case_node *) oballoc (sizeof (struct case_node));
- r->low = copy_node (low);
-
- /* If the bounds are equal, turn this into the one-value case. */
-
- if (tree_int_cst_equal (low, high))
- r->high = r->low;
- else
- {
- r->high = copy_node (high);
- case_stack->data.case_stmt.num_ranges++;
- }
-
- r->code_label = label;
- expand_label (label);
-
- *q = r;
- r->parent = p;
- r->left = 0;
- r->right = 0;
- r->balance = 0;
-
- while (p)
- {
- struct case_node *s;
-
- if (r == p->left)
- {
- int b;
-
- if (! (b = p->balance))
- /* Growth propagation from left side. */
- p->balance = -1;
- else if (b < 0)
- {
- if (r->balance < 0)
- {
- /* R-Rotation */
- if (p->left = s = r->right)
- s->parent = p;
-
- r->right = p;
- p->balance = 0;
- r->balance = 0;
- s = p->parent;
- p->parent = r;
-
- if (r->parent = s)
- {
- if (s->left == p)
- s->left = r;
- else
- s->right = r;
- }
- else
- case_stack->data.case_stmt.case_list = r;
- }
- else
- /* r->balance == +1 */
- {
- /* LR-Rotation */
-
- int b2;
- struct case_node *t = r->right;
-
- if (p->left = s = t->right)
- s->parent = p;
-
- t->right = p;
- if (r->right = s = t->left)
- s->parent = r;
-
- t->left = r;
- b = t->balance;
- b2 = b < 0;
- p->balance = b2;
- b2 = -b2 - b;
- r->balance = b2;
- t->balance = 0;
- s = p->parent;
- p->parent = t;
- r->parent = t;
-
- if (t->parent = s)
- {
- if (s->left == p)
- s->left = t;
- else
- s->right = t;
- }
- else
- case_stack->data.case_stmt.case_list = t;
- }
- break;
- }
-
- else
- {
- /* p->balance == +1; growth of left side balances the node. */
- p->balance = 0;
- break;
- }
- }
- else
- /* r == p->right */
- {
- int b;
-
- if (! (b = p->balance))
- /* Growth propagation from right side. */
- p->balance++;
- else if (b > 0)
- {
- if (r->balance > 0)
- {
- /* L-Rotation */
-
- if (p->right = s = r->left)
- s->parent = p;
-
- r->left = p;
- p->balance = 0;
- r->balance = 0;
- s = p->parent;
- p->parent = r;
- if (r->parent = s)
- {
- if (s->left == p)
- s->left = r;
- else
- s->right = r;
- }
-
- else
- case_stack->data.case_stmt.case_list = r;
- }
-
- else
- /* r->balance == -1 */
- {
- /* RL-Rotation */
- int b2;
- struct case_node *t = r->left;
-
- if (p->right = s = t->left)
- s->parent = p;
-
- t->left = p;
-
- if (r->left = s = t->right)
- s->parent = r;
-
- t->right = r;
- b = t->balance;
- b2 = b < 0;
- r->balance = b2;
- b2 = -b2 - b;
- p->balance = b2;
- t->balance = 0;
- s = p->parent;
- p->parent = t;
- r->parent = t;
-
- if (t->parent = s)
- {
- if (s->left == p)
- s->left = t;
- else
- s->right = t;
- }
-
- else
- case_stack->data.case_stmt.case_list = t;
- }
- break;
- }
- else
- {
- /* p->balance == -1; growth of right side balances the node. */
- p->balance = 0;
- break;
- }
- }
-
- r = p;
- p = p->parent;
- }
-
- return 0;
-}
-
-/* Accumulate one case or default label; VALUE is the value of the
- case, or nil for a default label. If not currently inside a case,
- return 1 and do nothing. If VALUE is a duplicate or overlaps, return
- 2 and do nothing. If VALUE is out of range, return 3 and do nothing.
- Return 0 on success. This function is a leftover from the earlier
- bytecode compiler, which was based on gcc 1.37. It should be
- merged into pushcase. */
-
-static int
-bc_pushcase (value, label)
- tree value;
- tree label;
-{
- struct nesting *thiscase = case_stack;
- struct case_node *case_label, *new_label;
-
- if (! thiscase)
- return 1;
-
- /* Fail if duplicate, overlap, or out of type range. */
- if (value)
- {
- value = convert (thiscase->data.case_stmt.nominal_type, value);
- if (! int_fits_type_p (value, thiscase->data.case_stmt.nominal_type))
- return 3;
-
- for (case_label = thiscase->data.case_stmt.case_list;
- case_label->left; case_label = case_label->left)
- if (! tree_int_cst_lt (case_label->left->high, value))
- break;
-
- if (case_label != thiscase->data.case_stmt.case_list
- && ! tree_int_cst_lt (case_label->high, value)
- || (case_label->left && ! tree_int_cst_lt (value, case_label->left->low)))
- return 2;
-
- new_label = (struct case_node *) oballoc (sizeof (struct case_node));
- new_label->low = new_label->high = copy_node (value);
- new_label->code_label = label;
- new_label->left = case_label->left;
-
- case_label->left = new_label;
- thiscase->data.case_stmt.num_ranges++;
- }
- else
- {
- if (thiscase->data.case_stmt.default_label)
- return 2;
- thiscase->data.case_stmt.default_label = label;
- }
-
- expand_label (label);
- return 0;
-}
-
-/* Returns the number of possible values of TYPE.
- Returns -1 if the number is unknown or variable.
- Returns -2 if the number does not fit in a HOST_WIDE_INT.
- Sets *SPARENESS to 2 if TYPE is an ENUMERAL_TYPE whose values
- do not increase monotonically (there may be duplicates);
- to 1 if the values increase monotonically, but not always by 1;
- otherwise sets it to 0. */
-
-HOST_WIDE_INT
-all_cases_count (type, spareness)
- tree type;
- int *spareness;
-{
- HOST_WIDE_INT count, count_high = 0;
- *spareness = 0;
-
- switch (TREE_CODE (type))
- {
- tree t;
- case BOOLEAN_TYPE:
- count = 2;
- break;
- case CHAR_TYPE:
- count = 1 << BITS_PER_UNIT;
- break;
- default:
- case INTEGER_TYPE:
- if (TREE_CODE (TYPE_MIN_VALUE (type)) != INTEGER_CST
- || TREE_CODE (TYPE_MAX_VALUE (type)) != INTEGER_CST)
- return -1;
- else
- {
- /* count
- = TREE_INT_CST_LOW (TYPE_MAX_VALUE (type))
- - TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)) + 1
- but with overflow checking. */
- tree mint = TYPE_MIN_VALUE (type);
- tree maxt = TYPE_MAX_VALUE (type);
- HOST_WIDE_INT lo, hi;
- neg_double(TREE_INT_CST_LOW (mint), TREE_INT_CST_HIGH (mint),
- &lo, &hi);
- add_double(TREE_INT_CST_LOW (maxt), TREE_INT_CST_HIGH (maxt),
- lo, hi, &lo, &hi);
- add_double (lo, hi, 1, 0, &lo, &hi);
- if (hi != 0 || lo < 0)
- return -2;
- count = lo;
- }
- break;
- case ENUMERAL_TYPE:
- count = 0;
- for (t = TYPE_VALUES (type); t != NULL_TREE; t = TREE_CHAIN (t))
- {
- if (TREE_CODE (TYPE_MIN_VALUE (type)) != INTEGER_CST
- || TREE_CODE (TREE_VALUE (t)) != INTEGER_CST
- || TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)) + count
- != TREE_INT_CST_LOW (TREE_VALUE (t)))
- *spareness = 1;
- count++;
- }
- if (*spareness == 1)
- {
- tree prev = TREE_VALUE (TYPE_VALUES (type));
- for (t = TYPE_VALUES (type); t = TREE_CHAIN (t), t != NULL_TREE; )
- {
- if (! tree_int_cst_lt (prev, TREE_VALUE (t)))
- {
- *spareness = 2;
- break;
- }
- prev = TREE_VALUE (t);
- }
-
- }
- }
- return count;
-}
-
-
-#define BITARRAY_TEST(ARRAY, INDEX) \
- ((ARRAY)[(unsigned) (INDEX) / HOST_BITS_PER_CHAR]\
- & (1 << ((unsigned) (INDEX) % HOST_BITS_PER_CHAR)))
-#define BITARRAY_SET(ARRAY, INDEX) \
- ((ARRAY)[(unsigned) (INDEX) / HOST_BITS_PER_CHAR]\
- |= 1 << ((unsigned) (INDEX) % HOST_BITS_PER_CHAR))
-
-/* Set the elements of the bitstring CASES_SEEN (which has length COUNT),
- with the case values we have seen, assuming the case expression
- has the given TYPE.
- SPARSENESS is as determined by all_cases_count.
-
- The time needed is proportional to COUNT, unless
- SPARSENESS is 2, in which case quadratic time is needed. */
-
-void
-mark_seen_cases (type, cases_seen, count, sparseness)
- tree type;
- unsigned char *cases_seen;
- long count;
- int sparseness;
-{
- long i;
-
- tree next_node_to_try = NULL_TREE;
- long next_node_offset = 0;
-
- register struct case_node *n, *root = case_stack->data.case_stmt.case_list;
- tree val = make_node (INTEGER_CST);
- TREE_TYPE (val) = type;
- if (! root)
- ; /* Do nothing */
- else if (sparseness == 2)
- {
- tree t;
- HOST_WIDE_INT xlo;
-
- /* This less efficient loop is only needed to handle
- duplicate case values (multiple enum constants
- with the same value). */
- TREE_TYPE (val) = TREE_TYPE (root->low);
- for (t = TYPE_VALUES (type), xlo = 0; t != NULL_TREE;
- t = TREE_CHAIN (t), xlo++)
- {
- TREE_INT_CST_LOW (val) = TREE_INT_CST_LOW (TREE_VALUE (t));
- TREE_INT_CST_HIGH (val) = TREE_INT_CST_HIGH (TREE_VALUE (t));
- n = root;
- do
- {
- /* Keep going past elements distinctly greater than VAL. */
- if (tree_int_cst_lt (val, n->low))
- n = n->left;
-
- /* or distinctly less than VAL. */
- else if (tree_int_cst_lt (n->high, val))
- n = n->right;
-
- else
- {
- /* We have found a matching range. */
- BITARRAY_SET (cases_seen, xlo);
- break;
- }
- }
- while (n);
- }
- }
- else
- {
- if (root->left)
- case_stack->data.case_stmt.case_list = root = case_tree2list (root, 0);
- for (n = root; n; n = n->right)
- {
- TREE_INT_CST_LOW (val) = TREE_INT_CST_LOW (n->low);
- TREE_INT_CST_HIGH (val) = TREE_INT_CST_HIGH (n->low);
- while ( ! tree_int_cst_lt (n->high, val))
- {
- /* Calculate (into xlo) the "offset" of the integer (val).
- The element with lowest value has offset 0, the next smallest
- element has offset 1, etc. */
-
- HOST_WIDE_INT xlo, xhi;
- tree t;
- if (sparseness && TYPE_VALUES (type) != NULL_TREE)
- {
- /* The TYPE_VALUES will be in increasing order, so
- starting searching where we last ended. */
- t = next_node_to_try;
- xlo = next_node_offset;
- xhi = 0;
- for (;;)
- {
- if (t == NULL_TREE)
- {
- t = TYPE_VALUES (type);
- xlo = 0;
- }
- if (tree_int_cst_equal (val, TREE_VALUE (t)))
- {
- next_node_to_try = TREE_CHAIN (t);
- next_node_offset = xlo + 1;
- break;
- }
- xlo++;
- t = TREE_CHAIN (t);
- if (t == next_node_to_try)
- {
- xlo = -1;
- break;
- }
- }
- }
- else
- {
- t = TYPE_MIN_VALUE (type);
- if (t)
- neg_double (TREE_INT_CST_LOW (t), TREE_INT_CST_HIGH (t),
- &xlo, &xhi);
- else
- xlo = xhi = 0;
- add_double (xlo, xhi,
- TREE_INT_CST_LOW (val), TREE_INT_CST_HIGH (val),
- &xlo, &xhi);
- }
-
- if (xhi == 0 && xlo >= 0 && xlo < count)
- BITARRAY_SET (cases_seen, xlo);
- add_double (TREE_INT_CST_LOW (val), TREE_INT_CST_HIGH (val),
- 1, 0,
- &TREE_INT_CST_LOW (val), &TREE_INT_CST_HIGH (val));
- }
- }
- }
-}
-
-/* Called when the index of a switch statement is an enumerated type
- and there is no default label.
-
- Checks that all enumeration literals are covered by the case
- expressions of a switch. Also, warn if there are any extra
- switch cases that are *not* elements of the enumerated type.
-
- If all enumeration literals were covered by the case expressions,
- turn one of the expressions into the default expression since it should
- not be possible to fall through such a switch. */
-
-void
-check_for_full_enumeration_handling (type)
- tree type;
-{
- register struct case_node *n;
- register struct case_node **l;
- register tree chain;
- int all_values = 1;
-
- /* True iff the selector type is a numbered set mode. */
- int sparseness = 0;
-
- /* The number of possible selector values. */
- HOST_WIDE_INT size;
-
- /* For each possible selector value. a one iff it has been matched
- by a case value alternative. */
- unsigned char *cases_seen;
-
- /* The allocated size of cases_seen, in chars. */
- long bytes_needed;
- tree t;
-
- if (output_bytecode)
- {
- bc_check_for_full_enumeration_handling (type);
- return;
- }
-
- if (! warn_switch)
- return;
-
- size = all_cases_count (type, &sparseness);
- bytes_needed = (size + HOST_BITS_PER_CHAR) / HOST_BITS_PER_CHAR;
-
- if (size > 0 && size < 600000
- /* We deliberately use malloc here - not xmalloc. */
- && (cases_seen = (unsigned char *) malloc (bytes_needed)) != NULL)
- {
- long i;
- tree v = TYPE_VALUES (type);
- bzero (cases_seen, bytes_needed);
-
- /* The time complexity of this code is normally O(N), where
- N being the number of members in the enumerated type.
- However, if type is a ENUMERAL_TYPE whose values do not
- increase monotonically, O(N*log(N)) time may be needed. */
-
- mark_seen_cases (type, cases_seen, size, sparseness);
-
- for (i = 0; v != NULL_TREE && i < size; i++, v = TREE_CHAIN (v))
- {
- if (BITARRAY_TEST(cases_seen, i) == 0)
- warning ("enumeration value `%s' not handled in switch",
- IDENTIFIER_POINTER (TREE_PURPOSE (v)));
- }
-
- free (cases_seen);
- }
-
- /* Now we go the other way around; we warn if there are case
- expressions that don't correspond to enumerators. This can
- occur since C and C++ don't enforce type-checking of
- assignments to enumeration variables. */
-
- if (case_stack->data.case_stmt.case_list
- && case_stack->data.case_stmt.case_list->left)
- case_stack->data.case_stmt.case_list
- = case_tree2list (case_stack->data.case_stmt.case_list, 0);
- if (warn_switch)
- for (n = case_stack->data.case_stmt.case_list; n; n = n->right)
- {
- for (chain = TYPE_VALUES (type);
- chain && !tree_int_cst_equal (n->low, TREE_VALUE (chain));
- chain = TREE_CHAIN (chain))
- ;
-
- if (!chain)
- {
- if (TYPE_NAME (type) == 0)
- warning ("case value `%d' not in enumerated type",
- TREE_INT_CST_LOW (n->low));
- else
- warning ("case value `%d' not in enumerated type `%s'",
- TREE_INT_CST_LOW (n->low),
- IDENTIFIER_POINTER ((TREE_CODE (TYPE_NAME (type))
- == IDENTIFIER_NODE)
- ? TYPE_NAME (type)
- : DECL_NAME (TYPE_NAME (type))));
- }
- if (!tree_int_cst_equal (n->low, n->high))
- {
- for (chain = TYPE_VALUES (type);
- chain && !tree_int_cst_equal (n->high, TREE_VALUE (chain));
- chain = TREE_CHAIN (chain))
- ;
-
- if (!chain)
- {
- if (TYPE_NAME (type) == 0)
- warning ("case value `%d' not in enumerated type",
- TREE_INT_CST_LOW (n->high));
- else
- warning ("case value `%d' not in enumerated type `%s'",
- TREE_INT_CST_LOW (n->high),
- IDENTIFIER_POINTER ((TREE_CODE (TYPE_NAME (type))
- == IDENTIFIER_NODE)
- ? TYPE_NAME (type)
- : DECL_NAME (TYPE_NAME (type))));
- }
- }
- }
-
-#if 0
- /* ??? This optimization is disabled because it causes valid programs to
- fail. ANSI C does not guarantee that an expression with enum type
- will have a value that is the same as one of the enumeration literals. */
-
- /* If all values were found as case labels, make one of them the default
- label. Thus, this switch will never fall through. We arbitrarily pick
- the last one to make the default since this is likely the most
- efficient choice. */
-
- if (all_values)
- {
- for (l = &case_stack->data.case_stmt.case_list;
- (*l)->right != 0;
- l = &(*l)->right)
- ;
-
- case_stack->data.case_stmt.default_label = (*l)->code_label;
- *l = 0;
- }
-#endif /* 0 */
-}
-
-
-/* Check that all enumeration literals are covered by the case
- expressions of a switch. Also warn if there are any cases
- that are not elements of the enumerated type. */
-
-static void
-bc_check_for_full_enumeration_handling (type)
- tree type;
-{
- struct nesting *thiscase = case_stack;
- struct case_node *c;
- tree e;
-
- /* Check for enums not handled. */
- for (e = TYPE_VALUES (type); e; e = TREE_CHAIN (e))
- {
- for (c = thiscase->data.case_stmt.case_list->left;
- c && tree_int_cst_lt (c->high, TREE_VALUE (e));
- c = c->left)
- ;
- if (! (c && tree_int_cst_equal (c->low, TREE_VALUE (e))))
- warning ("enumerated value `%s' not handled in switch",
- IDENTIFIER_POINTER (TREE_PURPOSE (e)));
- }
-
- /* Check for cases not in the enumeration. */
- for (c = thiscase->data.case_stmt.case_list->left; c; c = c->left)
- {
- for (e = TYPE_VALUES (type);
- e && !tree_int_cst_equal (c->low, TREE_VALUE (e));
- e = TREE_CHAIN (e))
- ;
- if (! e)
- warning ("case value `%d' not in enumerated type `%s'",
- TREE_INT_CST_LOW (c->low),
- IDENTIFIER_POINTER (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE
- ? TYPE_NAME (type)
- : DECL_NAME (TYPE_NAME (type))));
- }
-}
-
-/* Terminate a case (Pascal) or switch (C) statement
- in which ORIG_INDEX is the expression to be tested.
- Generate the code to test it and jump to the right place. */
-
-void
-expand_end_case (orig_index)
- tree orig_index;
-{
- tree minval, maxval, range, orig_minval;
- rtx default_label = 0;
- register struct case_node *n;
- int count;
- rtx index;
- rtx table_label;
- int ncases;
- rtx *labelvec;
- register int i;
- rtx before_case;
- register struct nesting *thiscase = case_stack;
- tree index_expr, index_type;
- int unsignedp;
-
- if (output_bytecode)
- {
- bc_expand_end_case (orig_index);
- return;
- }
-
- table_label = gen_label_rtx ();
- index_expr = thiscase->data.case_stmt.index_expr;
- index_type = TREE_TYPE (index_expr);
- unsignedp = TREE_UNSIGNED (index_type);
-
- do_pending_stack_adjust ();
-
- /* An ERROR_MARK occurs for various reasons including invalid data type. */
- if (index_type != error_mark_node)
- {
- /* If switch expression was an enumerated type, check that all
- enumeration literals are covered by the cases.
- No sense trying this if there's a default case, however. */
-
- if (!thiscase->data.case_stmt.default_label
- && TREE_CODE (TREE_TYPE (orig_index)) == ENUMERAL_TYPE
- && TREE_CODE (index_expr) != INTEGER_CST)
- check_for_full_enumeration_handling (TREE_TYPE (orig_index));
-
- /* If this is the first label, warn if any insns have been emitted. */
- if (thiscase->data.case_stmt.seenlabel == 0)
- {
- rtx insn;
- for (insn = get_last_insn ();
- insn != case_stack->data.case_stmt.start;
- insn = PREV_INSN (insn))
- if (GET_CODE (insn) != NOTE
- && (GET_CODE (insn) != INSN || GET_CODE (PATTERN (insn))!= USE))
- {
- warning ("unreachable code at beginning of %s",
- case_stack->data.case_stmt.printname);
- break;
- }
- }
-
- /* If we don't have a default-label, create one here,
- after the body of the switch. */
- if (thiscase->data.case_stmt.default_label == 0)
- {
- thiscase->data.case_stmt.default_label
- = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
- expand_label (thiscase->data.case_stmt.default_label);
- }
- default_label = label_rtx (thiscase->data.case_stmt.default_label);
-
- before_case = get_last_insn ();
-
- if (thiscase->data.case_stmt.case_list
- && thiscase->data.case_stmt.case_list->left)
- thiscase->data.case_stmt.case_list
- = case_tree2list(thiscase->data.case_stmt.case_list, 0);
-
- /* Simplify the case-list before we count it. */
- group_case_nodes (thiscase->data.case_stmt.case_list);
-
- /* Get upper and lower bounds of case values.
- Also convert all the case values to the index expr's data type. */
-
- count = 0;
- for (n = thiscase->data.case_stmt.case_list; n; n = n->right)
- {
- /* Check low and high label values are integers. */
- if (TREE_CODE (n->low) != INTEGER_CST)
- abort ();
- if (TREE_CODE (n->high) != INTEGER_CST)
- abort ();
-
- n->low = convert (index_type, n->low);
- n->high = convert (index_type, n->high);
-
- /* Count the elements and track the largest and smallest
- of them (treating them as signed even if they are not). */
- if (count++ == 0)
- {
- minval = n->low;
- maxval = n->high;
- }
- else
- {
- if (INT_CST_LT (n->low, minval))
- minval = n->low;
- if (INT_CST_LT (maxval, n->high))
- maxval = n->high;
- }
- /* A range counts double, since it requires two compares. */
- if (! tree_int_cst_equal (n->low, n->high))
- count++;
- }
-
- orig_minval = minval;
-
- /* Compute span of values. */
- if (count != 0)
- range = fold (build (MINUS_EXPR, index_type, maxval, minval));
-
- if (count == 0)
- {
- expand_expr (index_expr, const0_rtx, VOIDmode, 0);
- emit_queue ();
- emit_jump (default_label);
- }
-
- /* If range of values is much bigger than number of values,
- make a sequence of conditional branches instead of a dispatch.
- If the switch-index is a constant, do it this way
- because we can optimize it. */
-
-#ifndef CASE_VALUES_THRESHOLD
-#ifdef HAVE_casesi
-#define CASE_VALUES_THRESHOLD (HAVE_casesi ? 4 : 5)
-#else
- /* If machine does not have a case insn that compares the
- bounds, this means extra overhead for dispatch tables
- which raises the threshold for using them. */
-#define CASE_VALUES_THRESHOLD 5
-#endif /* HAVE_casesi */
-#endif /* CASE_VALUES_THRESHOLD */
-
- else if (TREE_INT_CST_HIGH (range) != 0
- || count < CASE_VALUES_THRESHOLD
- || ((unsigned HOST_WIDE_INT) (TREE_INT_CST_LOW (range))
- > 10 * count)
-#ifndef ASM_OUTPUT_ADDR_DIFF_ELT
- || flag_pic
-#endif
- || TREE_CODE (index_expr) == INTEGER_CST
- /* These will reduce to a constant. */
- || (TREE_CODE (index_expr) == CALL_EXPR
- && TREE_CODE (TREE_OPERAND (index_expr, 0)) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (TREE_OPERAND (index_expr, 0), 0)) == FUNCTION_DECL
- && DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (index_expr, 0), 0)) == BUILT_IN_CLASSIFY_TYPE)
- || (TREE_CODE (index_expr) == COMPOUND_EXPR
- && TREE_CODE (TREE_OPERAND (index_expr, 1)) == INTEGER_CST))
- {
- index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0);
-
- /* If the index is a short or char that we do not have
- an insn to handle comparisons directly, convert it to
- a full integer now, rather than letting each comparison
- generate the conversion. */
-
- if (GET_MODE_CLASS (GET_MODE (index)) == MODE_INT
- && (cmp_optab->handlers[(int) GET_MODE(index)].insn_code
- == CODE_FOR_nothing))
- {
- enum machine_mode wider_mode;
- for (wider_mode = GET_MODE (index); wider_mode != VOIDmode;
- wider_mode = GET_MODE_WIDER_MODE (wider_mode))
- if (cmp_optab->handlers[(int) wider_mode].insn_code
- != CODE_FOR_nothing)
- {
- index = convert_to_mode (wider_mode, index, unsignedp);
- break;
- }
- }
-
- emit_queue ();
- do_pending_stack_adjust ();
-
- index = protect_from_queue (index, 0);
- if (GET_CODE (index) == MEM)
- index = copy_to_reg (index);
- if (GET_CODE (index) == CONST_INT
- || TREE_CODE (index_expr) == INTEGER_CST)
- {
- /* Make a tree node with the proper constant value
- if we don't already have one. */
- if (TREE_CODE (index_expr) != INTEGER_CST)
- {
- index_expr
- = build_int_2 (INTVAL (index),
- unsignedp || INTVAL (index) >= 0 ? 0 : -1);
- index_expr = convert (index_type, index_expr);
- }
-
- /* For constant index expressions we need only
- issue a unconditional branch to the appropriate
- target code. The job of removing any unreachable
- code is left to the optimisation phase if the
- "-O" option is specified. */
- for (n = thiscase->data.case_stmt.case_list; n; n = n->right)
- if (! tree_int_cst_lt (index_expr, n->low)
- && ! tree_int_cst_lt (n->high, index_expr))
- break;
-
- if (n)
- emit_jump (label_rtx (n->code_label));
- else
- emit_jump (default_label);
- }
- else
- {
- /* If the index expression is not constant we generate
- a binary decision tree to select the appropriate
- target code. This is done as follows:
-
- The list of cases is rearranged into a binary tree,
- nearly optimal assuming equal probability for each case.
-
- The tree is transformed into RTL, eliminating
- redundant test conditions at the same time.
-
- If program flow could reach the end of the
- decision tree an unconditional jump to the
- default code is emitted. */
-
- use_cost_table
- = (TREE_CODE (TREE_TYPE (orig_index)) != ENUMERAL_TYPE
- && estimate_case_costs (thiscase->data.case_stmt.case_list));
- balance_case_nodes (&thiscase->data.case_stmt.case_list,
- NULL_PTR);
- emit_case_nodes (index, thiscase->data.case_stmt.case_list,
- default_label, index_type);
- emit_jump_if_reachable (default_label);
- }
- }
- else
- {
- int win = 0;
-#ifdef HAVE_casesi
- if (HAVE_casesi)
- {
- enum machine_mode index_mode = SImode;
- int index_bits = GET_MODE_BITSIZE (index_mode);
- rtx op1, op2;
- enum machine_mode op_mode;
-
- /* Convert the index to SImode. */
- if (GET_MODE_BITSIZE (TYPE_MODE (index_type))
- > GET_MODE_BITSIZE (index_mode))
- {
- enum machine_mode omode = TYPE_MODE (index_type);
- rtx rangertx = expand_expr (range, NULL_RTX, VOIDmode, 0);
-
- /* We must handle the endpoints in the original mode. */
- index_expr = build (MINUS_EXPR, index_type,
- index_expr, minval);
- minval = integer_zero_node;
- index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0);
- emit_cmp_insn (rangertx, index, LTU, NULL_RTX, omode, 1, 0);
- emit_jump_insn (gen_bltu (default_label));
- /* Now we can safely truncate. */
- index = convert_to_mode (index_mode, index, 0);
- }
- else
- {
- if (TYPE_MODE (index_type) != index_mode)
- {
- index_expr = convert (type_for_size (index_bits, 0),
- index_expr);
- index_type = TREE_TYPE (index_expr);
- }
-
- index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0);
- }
- emit_queue ();
- index = protect_from_queue (index, 0);
- do_pending_stack_adjust ();
-
- op_mode = insn_operand_mode[(int)CODE_FOR_casesi][0];
- if (! (*insn_operand_predicate[(int)CODE_FOR_casesi][0])
- (index, op_mode))
- index = copy_to_mode_reg (op_mode, index);
-
- op1 = expand_expr (minval, NULL_RTX, VOIDmode, 0);
-
- op_mode = insn_operand_mode[(int)CODE_FOR_casesi][1];
- if (! (*insn_operand_predicate[(int)CODE_FOR_casesi][1])
- (op1, op_mode))
- op1 = copy_to_mode_reg (op_mode, op1);
-
- op2 = expand_expr (range, NULL_RTX, VOIDmode, 0);
-
- op_mode = insn_operand_mode[(int)CODE_FOR_casesi][2];
- if (! (*insn_operand_predicate[(int)CODE_FOR_casesi][2])
- (op2, op_mode))
- op2 = copy_to_mode_reg (op_mode, op2);
-
- emit_jump_insn (gen_casesi (index, op1, op2,
- table_label, default_label));
- win = 1;
- }
-#endif
-#ifdef HAVE_tablejump
- if (! win && HAVE_tablejump)
- {
- index_expr = convert (thiscase->data.case_stmt.nominal_type,
- fold (build (MINUS_EXPR, index_type,
- index_expr, minval)));
- index_type = TREE_TYPE (index_expr);
- index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0);
- emit_queue ();
- index = protect_from_queue (index, 0);
- do_pending_stack_adjust ();
-
- do_tablejump (index, TYPE_MODE (index_type),
- expand_expr (range, NULL_RTX, VOIDmode, 0),
- table_label, default_label);
- win = 1;
- }
-#endif
- if (! win)
- abort ();
-
- /* Get table of labels to jump to, in order of case index. */
-
- ncases = TREE_INT_CST_LOW (range) + 1;
- labelvec = (rtx *) alloca (ncases * sizeof (rtx));
- bzero ((char *) labelvec, ncases * sizeof (rtx));
-
- for (n = thiscase->data.case_stmt.case_list; n; n = n->right)
- {
- register HOST_WIDE_INT i
- = TREE_INT_CST_LOW (n->low) - TREE_INT_CST_LOW (orig_minval);
-
- while (1)
- {
- labelvec[i]
- = gen_rtx (LABEL_REF, Pmode, label_rtx (n->code_label));
- if (i + TREE_INT_CST_LOW (orig_minval)
- == TREE_INT_CST_LOW (n->high))
- break;
- i++;
- }
- }
-
- /* Fill in the gaps with the default. */
- for (i = 0; i < ncases; i++)
- if (labelvec[i] == 0)
- labelvec[i] = gen_rtx (LABEL_REF, Pmode, default_label);
-
- /* Output the table */
- emit_label (table_label);
-
- /* This would be a lot nicer if CASE_VECTOR_PC_RELATIVE
- were an expression, instead of an #ifdef/#ifndef. */
- if (
-#ifdef CASE_VECTOR_PC_RELATIVE
- 1 ||
-#endif
- flag_pic)
- emit_jump_insn (gen_rtx (ADDR_DIFF_VEC, CASE_VECTOR_MODE,
- gen_rtx (LABEL_REF, Pmode, table_label),
- gen_rtvec_v (ncases, labelvec)));
- else
- emit_jump_insn (gen_rtx (ADDR_VEC, CASE_VECTOR_MODE,
- gen_rtvec_v (ncases, labelvec)));
-
- /* If the case insn drops through the table,
- after the table we must jump to the default-label.
- Otherwise record no drop-through after the table. */
-#ifdef CASE_DROPS_THROUGH
- emit_jump (default_label);
-#else
- emit_barrier ();
-#endif
- }
-
- before_case = squeeze_notes (NEXT_INSN (before_case), get_last_insn ());
- reorder_insns (before_case, get_last_insn (),
- thiscase->data.case_stmt.start);
- }
-
- if (thiscase->exit_label)
- emit_label (thiscase->exit_label);
-
- POPSTACK (case_stack);
-
- free_temp_slots ();
-}
-
-/* Convert the tree NODE into a list linked by the right field, with the left
- field zeroed. RIGHT is used for recursion; it is a list to be placed
- rightmost in the resulting list. */
-
-static struct case_node *
-case_tree2list (node, right)
- struct case_node *node, *right;
-{
- struct case_node *left;
-
- if (node->right)
- right = case_tree2list (node->right, right);
-
- node->right = right;
- if (left = node->left)
- {
- node->left = 0;
- return case_tree2list (left, node);
- }
-
- return node;
-}
-
-/* Terminate a case statement. EXPR is the original index
- expression. */
-
-static void
-bc_expand_end_case (expr)
- tree expr;
-{
- struct nesting *thiscase = case_stack;
- enum bytecode_opcode opcode;
- struct bc_label *jump_label;
- struct case_node *c;
-
- bc_emit_bytecode (jump);
- bc_emit_bytecode_labelref (BYTECODE_BC_LABEL (thiscase->exit_label));
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-
- /* Now that the size of the jump table is known, emit the actual
- indexed jump instruction. */
- bc_emit_bytecode_labeldef (BYTECODE_BC_LABEL (thiscase->data.case_stmt.skip_label));
-
- opcode = TYPE_MODE (thiscase->data.case_stmt.nominal_type) == SImode
- ? TREE_UNSIGNED (thiscase->data.case_stmt.nominal_type) ? caseSU : caseSI
- : TREE_UNSIGNED (thiscase->data.case_stmt.nominal_type) ? caseDU : caseDI;
-
- bc_emit_bytecode (opcode);
-
- /* Now emit the case instructions literal arguments, in order.
- In addition to the value on the stack, it uses:
- 1. The address of the jump table.
- 2. The size of the jump table.
- 3. The default label. */
-
- jump_label = bc_get_bytecode_label ();
- bc_emit_bytecode_labelref (jump_label);
- bc_emit_bytecode_const ((char *) &thiscase->data.case_stmt.num_ranges,
- sizeof thiscase->data.case_stmt.num_ranges);
-
- if (thiscase->data.case_stmt.default_label)
- bc_emit_bytecode_labelref (BYTECODE_BC_LABEL (DECL_RTL (thiscase->data.case_stmt.default_label)));
- else
- bc_emit_bytecode_labelref (BYTECODE_BC_LABEL (thiscase->exit_label));
-
- /* Output the jump table. */
-
- bc_align_bytecode (3 /* PTR_ALIGN */);
- bc_emit_bytecode_labeldef (jump_label);
-
- if (TYPE_MODE (thiscase->data.case_stmt.nominal_type) == SImode)
- for (c = thiscase->data.case_stmt.case_list->left; c; c = c->left)
- {
- opcode = TREE_INT_CST_LOW (c->low);
- bc_emit_bytecode_const ((char *) &opcode, sizeof opcode);
-
- opcode = TREE_INT_CST_LOW (c->high);
- bc_emit_bytecode_const ((char *) &opcode, sizeof opcode);
-
- bc_emit_bytecode_labelref (BYTECODE_BC_LABEL (DECL_RTL (c->code_label)));
- }
- else
- if (TYPE_MODE (thiscase->data.case_stmt.nominal_type) == DImode)
- for (c = thiscase->data.case_stmt.case_list->left; c; c = c->left)
- {
- bc_emit_bytecode_DI_const (c->low);
- bc_emit_bytecode_DI_const (c->high);
-
- bc_emit_bytecode_labelref (BYTECODE_BC_LABEL (DECL_RTL (c->code_label)));
- }
- else
- /* Bad mode */
- abort ();
-
-
- bc_emit_bytecode_labeldef (BYTECODE_BC_LABEL (thiscase->exit_label));
-
- /* Possibly issue enumeration warnings. */
-
- if (!thiscase->data.case_stmt.default_label
- && TREE_CODE (TREE_TYPE (expr)) == ENUMERAL_TYPE
- && TREE_CODE (expr) != INTEGER_CST
- && warn_switch)
- check_for_full_enumeration_handling (TREE_TYPE (expr));
-
-
-#ifdef DEBUG_PRINT_CODE
- fputc ('\n', stderr);
-#endif
-
- POPSTACK (case_stack);
-}
-
-
-/* Return unique bytecode ID. */
-
-int
-bc_new_uid ()
-{
- static int bc_uid = 0;
-
- return (++bc_uid);
-}
-
-/* Generate code to jump to LABEL if OP1 and OP2 are equal. */
-
-static void
-do_jump_if_equal (op1, op2, label, unsignedp)
- rtx op1, op2, label;
- int unsignedp;
-{
- if (GET_CODE (op1) == CONST_INT
- && GET_CODE (op2) == CONST_INT)
- {
- if (INTVAL (op1) == INTVAL (op2))
- emit_jump (label);
- }
- else
- {
- enum machine_mode mode = GET_MODE (op1);
- if (mode == VOIDmode)
- mode = GET_MODE (op2);
- emit_cmp_insn (op1, op2, EQ, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn (gen_beq (label));
- }
-}
-
-/* Not all case values are encountered equally. This function
- uses a heuristic to weight case labels, in cases where that
- looks like a reasonable thing to do.
-
- Right now, all we try to guess is text, and we establish the
- following weights:
-
- chars above space: 16
- digits: 16
- default: 12
- space, punct: 8
- tab: 4
- newline: 2
- other "\" chars: 1
- remaining chars: 0
-
- If we find any cases in the switch that are not either -1 or in the range
- of valid ASCII characters, or are control characters other than those
- commonly used with "\", don't treat this switch scanning text.
-
- Return 1 if these nodes are suitable for cost estimation, otherwise
- return 0. */
-
-static int
-estimate_case_costs (node)
- case_node_ptr node;
-{
- tree min_ascii = build_int_2 (-1, -1);
- tree max_ascii = convert (TREE_TYPE (node->high), build_int_2 (127, 0));
- case_node_ptr n;
- int i;
-
- /* If we haven't already made the cost table, make it now. Note that the
- lower bound of the table is -1, not zero. */
-
- if (cost_table == NULL)
- {
- cost_table = ((short *) xmalloc (129 * sizeof (short))) + 1;
- bzero ((char *) (cost_table - 1), 129 * sizeof (short));
-
- for (i = 0; i < 128; i++)
- {
- if (isalnum (i))
- cost_table[i] = 16;
- else if (ispunct (i))
- cost_table[i] = 8;
- else if (iscntrl (i))
- cost_table[i] = -1;
- }
-
- cost_table[' '] = 8;
- cost_table['\t'] = 4;
- cost_table['\0'] = 4;
- cost_table['\n'] = 2;
- cost_table['\f'] = 1;
- cost_table['\v'] = 1;
- cost_table['\b'] = 1;
- }
-
- /* See if all the case expressions look like text. It is text if the
- constant is >= -1 and the highest constant is <= 127. Do all comparisons
- as signed arithmetic since we don't want to ever access cost_table with a
- value less than -1. Also check that none of the constants in a range
- are strange control characters. */
-
- for (n = node; n; n = n->right)
- {
- if ((INT_CST_LT (n->low, min_ascii)) || INT_CST_LT (max_ascii, n->high))
- return 0;
-
- for (i = TREE_INT_CST_LOW (n->low); i <= TREE_INT_CST_LOW (n->high); i++)
- if (cost_table[i] < 0)
- return 0;
- }
-
- /* All interesting values are within the range of interesting
- ASCII characters. */
- return 1;
-}
-
-/* Scan an ordered list of case nodes
- combining those with consecutive values or ranges.
-
- Eg. three separate entries 1: 2: 3: become one entry 1..3: */
-
-static void
-group_case_nodes (head)
- case_node_ptr head;
-{
- case_node_ptr node = head;
-
- while (node)
- {
- rtx lb = next_real_insn (label_rtx (node->code_label));
- rtx lb2;
- case_node_ptr np = node;
-
- /* Try to group the successors of NODE with NODE. */
- while (((np = np->right) != 0)
- /* Do they jump to the same place? */
- && ((lb2 = next_real_insn (label_rtx (np->code_label))) == lb
- || (lb != 0 && lb2 != 0
- && simplejump_p (lb)
- && simplejump_p (lb2)
- && rtx_equal_p (SET_SRC (PATTERN (lb)),
- SET_SRC (PATTERN (lb2)))))
- /* Are their ranges consecutive? */
- && tree_int_cst_equal (np->low,
- fold (build (PLUS_EXPR,
- TREE_TYPE (node->high),
- node->high,
- integer_one_node)))
- /* An overflow is not consecutive. */
- && tree_int_cst_lt (node->high,
- fold (build (PLUS_EXPR,
- TREE_TYPE (node->high),
- node->high,
- integer_one_node))))
- {
- node->high = np->high;
- }
- /* NP is the first node after NODE which can't be grouped with it.
- Delete the nodes in between, and move on to that node. */
- node->right = np;
- node = np;
- }
-}
-
-/* Take an ordered list of case nodes
- and transform them into a near optimal binary tree,
- on the assumption that any target code selection value is as
- likely as any other.
-
- The transformation is performed by splitting the ordered
- list into two equal sections plus a pivot. The parts are
- then attached to the pivot as left and right branches. Each
- branch is is then transformed recursively. */
-
-static void
-balance_case_nodes (head, parent)
- case_node_ptr *head;
- case_node_ptr parent;
-{
- register case_node_ptr np;
-
- np = *head;
- if (np)
- {
- int cost = 0;
- int i = 0;
- int ranges = 0;
- register case_node_ptr *npp;
- case_node_ptr left;
-
- /* Count the number of entries on branch. Also count the ranges. */
-
- while (np)
- {
- if (!tree_int_cst_equal (np->low, np->high))
- {
- ranges++;
- if (use_cost_table)
- cost += cost_table[TREE_INT_CST_LOW (np->high)];
- }
-
- if (use_cost_table)
- cost += cost_table[TREE_INT_CST_LOW (np->low)];
-
- i++;
- np = np->right;
- }
-
- if (i > 2)
- {
- /* Split this list if it is long enough for that to help. */
- npp = head;
- left = *npp;
- if (use_cost_table)
- {
- /* Find the place in the list that bisects the list's total cost,
- Here I gets half the total cost. */
- int n_moved = 0;
- i = (cost + 1) / 2;
- while (1)
- {
- /* Skip nodes while their cost does not reach that amount. */
- if (!tree_int_cst_equal ((*npp)->low, (*npp)->high))
- i -= cost_table[TREE_INT_CST_LOW ((*npp)->high)];
- i -= cost_table[TREE_INT_CST_LOW ((*npp)->low)];
- if (i <= 0)
- break;
- npp = &(*npp)->right;
- n_moved += 1;
- }
- if (n_moved == 0)
- {
- /* Leave this branch lopsided, but optimize left-hand
- side and fill in `parent' fields for right-hand side. */
- np = *head;
- np->parent = parent;
- balance_case_nodes (&np->left, np);
- for (; np->right; np = np->right)
- np->right->parent = np;
- return;
- }
- }
- /* If there are just three nodes, split at the middle one. */
- else if (i == 3)
- npp = &(*npp)->right;
- else
- {
- /* Find the place in the list that bisects the list's total cost,
- where ranges count as 2.
- Here I gets half the total cost. */
- i = (i + ranges + 1) / 2;
- while (1)
- {
- /* Skip nodes while their cost does not reach that amount. */
- if (!tree_int_cst_equal ((*npp)->low, (*npp)->high))
- i--;
- i--;
- if (i <= 0)
- break;
- npp = &(*npp)->right;
- }
- }
- *head = np = *npp;
- *npp = 0;
- np->parent = parent;
- np->left = left;
-
- /* Optimize each of the two split parts. */
- balance_case_nodes (&np->left, np);
- balance_case_nodes (&np->right, np);
- }
- else
- {
- /* Else leave this branch as one level,
- but fill in `parent' fields. */
- np = *head;
- np->parent = parent;
- for (; np->right; np = np->right)
- np->right->parent = np;
- }
- }
-}
-
-/* Search the parent sections of the case node tree
- to see if a test for the lower bound of NODE would be redundant.
- INDEX_TYPE is the type of the index expression.
-
- The instructions to generate the case decision tree are
- output in the same order as nodes are processed so it is
- known that if a parent node checks the range of the current
- node minus one that the current node is bounded at its lower
- span. Thus the test would be redundant. */
-
-static int
-node_has_low_bound (node, index_type)
- case_node_ptr node;
- tree index_type;
-{
- tree low_minus_one;
- case_node_ptr pnode;
-
- /* If the lower bound of this node is the lowest value in the index type,
- we need not test it. */
-
- if (tree_int_cst_equal (node->low, TYPE_MIN_VALUE (index_type)))
- return 1;
-
- /* If this node has a left branch, the value at the left must be less
- than that at this node, so it cannot be bounded at the bottom and
- we need not bother testing any further. */
-
- if (node->left)
- return 0;
-
- low_minus_one = fold (build (MINUS_EXPR, TREE_TYPE (node->low),
- node->low, integer_one_node));
-
- /* If the subtraction above overflowed, we can't verify anything.
- Otherwise, look for a parent that tests our value - 1. */
-
- if (! tree_int_cst_lt (low_minus_one, node->low))
- return 0;
-
- for (pnode = node->parent; pnode; pnode = pnode->parent)
- if (tree_int_cst_equal (low_minus_one, pnode->high))
- return 1;
-
- return 0;
-}
-
-/* Search the parent sections of the case node tree
- to see if a test for the upper bound of NODE would be redundant.
- INDEX_TYPE is the type of the index expression.
-
- The instructions to generate the case decision tree are
- output in the same order as nodes are processed so it is
- known that if a parent node checks the range of the current
- node plus one that the current node is bounded at its upper
- span. Thus the test would be redundant. */
-
-static int
-node_has_high_bound (node, index_type)
- case_node_ptr node;
- tree index_type;
-{
- tree high_plus_one;
- case_node_ptr pnode;
-
- /* If the upper bound of this node is the highest value in the type
- of the index expression, we need not test against it. */
-
- if (tree_int_cst_equal (node->high, TYPE_MAX_VALUE (index_type)))
- return 1;
-
- /* If this node has a right branch, the value at the right must be greater
- than that at this node, so it cannot be bounded at the top and
- we need not bother testing any further. */
-
- if (node->right)
- return 0;
-
- high_plus_one = fold (build (PLUS_EXPR, TREE_TYPE (node->high),
- node->high, integer_one_node));
-
- /* If the addition above overflowed, we can't verify anything.
- Otherwise, look for a parent that tests our value + 1. */
-
- if (! tree_int_cst_lt (node->high, high_plus_one))
- return 0;
-
- for (pnode = node->parent; pnode; pnode = pnode->parent)
- if (tree_int_cst_equal (high_plus_one, pnode->low))
- return 1;
-
- return 0;
-}
-
-/* Search the parent sections of the
- case node tree to see if both tests for the upper and lower
- bounds of NODE would be redundant. */
-
-static int
-node_is_bounded (node, index_type)
- case_node_ptr node;
- tree index_type;
-{
- return (node_has_low_bound (node, index_type)
- && node_has_high_bound (node, index_type));
-}
-
-/* Emit an unconditional jump to LABEL unless it would be dead code. */
-
-static void
-emit_jump_if_reachable (label)
- rtx label;
-{
- if (GET_CODE (get_last_insn ()) != BARRIER)
- emit_jump (label);
-}
-
-/* Emit step-by-step code to select a case for the value of INDEX.
- The thus generated decision tree follows the form of the
- case-node binary tree NODE, whose nodes represent test conditions.
- INDEX_TYPE is the type of the index of the switch.
-
- Care is taken to prune redundant tests from the decision tree
- by detecting any boundary conditions already checked by
- emitted rtx. (See node_has_high_bound, node_has_low_bound
- and node_is_bounded, above.)
-
- Where the test conditions can be shown to be redundant we emit
- an unconditional jump to the target code. As a further
- optimization, the subordinates of a tree node are examined to
- check for bounded nodes. In this case conditional and/or
- unconditional jumps as a result of the boundary check for the
- current node are arranged to target the subordinates associated
- code for out of bound conditions on the current node node.
-
- We can assume that when control reaches the code generated here,
- the index value has already been compared with the parents
- of this node, and determined to be on the same side of each parent
- as this node is. Thus, if this node tests for the value 51,
- and a parent tested for 52, we don't need to consider
- the possibility of a value greater than 51. If another parent
- tests for the value 50, then this node need not test anything. */
-
-static void
-emit_case_nodes (index, node, default_label, index_type)
- rtx index;
- case_node_ptr node;
- rtx default_label;
- tree index_type;
-{
- /* If INDEX has an unsigned type, we must make unsigned branches. */
- int unsignedp = TREE_UNSIGNED (index_type);
- typedef rtx rtx_function ();
- rtx_function *gen_bgt_pat = unsignedp ? gen_bgtu : gen_bgt;
- rtx_function *gen_bge_pat = unsignedp ? gen_bgeu : gen_bge;
- rtx_function *gen_blt_pat = unsignedp ? gen_bltu : gen_blt;
- rtx_function *gen_ble_pat = unsignedp ? gen_bleu : gen_ble;
- enum machine_mode mode = GET_MODE (index);
-
- /* See if our parents have already tested everything for us.
- If they have, emit an unconditional jump for this node. */
- if (node_is_bounded (node, index_type))
- emit_jump (label_rtx (node->code_label));
-
- else if (tree_int_cst_equal (node->low, node->high))
- {
- /* Node is single valued. First see if the index expression matches
- this node and then check our children, if any. */
-
- do_jump_if_equal (index, expand_expr (node->low, NULL_RTX, VOIDmode, 0),
- label_rtx (node->code_label), unsignedp);
-
- if (node->right != 0 && node->left != 0)
- {
- /* This node has children on both sides.
- Dispatch to one side or the other
- by comparing the index value with this node's value.
- If one subtree is bounded, check that one first,
- so we can avoid real branches in the tree. */
-
- if (node_is_bounded (node->right, index_type))
- {
- emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
- VOIDmode, 0),
- GT, NULL_RTX, mode, unsignedp, 0);
-
- emit_jump_insn ((*gen_bgt_pat) (label_rtx (node->right->code_label)));
- emit_case_nodes (index, node->left, default_label, index_type);
- }
-
- else if (node_is_bounded (node->left, index_type))
- {
- emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
- VOIDmode, 0),
- LT, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_blt_pat) (label_rtx (node->left->code_label)));
- emit_case_nodes (index, node->right, default_label, index_type);
- }
-
- else
- {
- /* Neither node is bounded. First distinguish the two sides;
- then emit the code for one side at a time. */
-
- tree test_label
- = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
-
- /* See if the value is on the right. */
- emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
- VOIDmode, 0),
- GT, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_bgt_pat) (label_rtx (test_label)));
-
- /* Value must be on the left.
- Handle the left-hand subtree. */
- emit_case_nodes (index, node->left, default_label, index_type);
- /* If left-hand subtree does nothing,
- go to default. */
- emit_jump_if_reachable (default_label);
-
- /* Code branches here for the right-hand subtree. */
- expand_label (test_label);
- emit_case_nodes (index, node->right, default_label, index_type);
- }
- }
-
- else if (node->right != 0 && node->left == 0)
- {
- /* Here we have a right child but no left so we issue conditional
- branch to default and process the right child.
-
- Omit the conditional branch to default if we it avoid only one
- right child; it costs too much space to save so little time. */
-
- if (node->right->right || node->right->left
- || !tree_int_cst_equal (node->right->low, node->right->high))
- {
- if (!node_has_low_bound (node, index_type))
- {
- emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
- VOIDmode, 0),
- LT, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_blt_pat) (default_label));
- }
-
- emit_case_nodes (index, node->right, default_label, index_type);
- }
- else
- /* We cannot process node->right normally
- since we haven't ruled out the numbers less than
- this node's value. So handle node->right explicitly. */
- do_jump_if_equal (index,
- expand_expr (node->right->low, NULL_RTX,
- VOIDmode, 0),
- label_rtx (node->right->code_label), unsignedp);
- }
-
- else if (node->right == 0 && node->left != 0)
- {
- /* Just one subtree, on the left. */
-
-#if 0 /* The following code and comment were formerly part
- of the condition here, but they didn't work
- and I don't understand what the idea was. -- rms. */
- /* If our "most probable entry" is less probable
- than the default label, emit a jump to
- the default label using condition codes
- already lying around. With no right branch,
- a branch-greater-than will get us to the default
- label correctly. */
- if (use_cost_table
- && cost_table[TREE_INT_CST_LOW (node->high)] < 12)
- ;
-#endif /* 0 */
- if (node->left->left || node->left->right
- || !tree_int_cst_equal (node->left->low, node->left->high))
- {
- if (!node_has_high_bound (node, index_type))
- {
- emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
- VOIDmode, 0),
- GT, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_bgt_pat) (default_label));
- }
-
- emit_case_nodes (index, node->left, default_label, index_type);
- }
- else
- /* We cannot process node->left normally
- since we haven't ruled out the numbers less than
- this node's value. So handle node->left explicitly. */
- do_jump_if_equal (index,
- expand_expr (node->left->low, NULL_RTX,
- VOIDmode, 0),
- label_rtx (node->left->code_label), unsignedp);
- }
- }
- else
- {
- /* Node is a range. These cases are very similar to those for a single
- value, except that we do not start by testing whether this node
- is the one to branch to. */
-
- if (node->right != 0 && node->left != 0)
- {
- /* Node has subtrees on both sides.
- If the right-hand subtree is bounded,
- test for it first, since we can go straight there.
- Otherwise, we need to make a branch in the control structure,
- then handle the two subtrees. */
- tree test_label = 0;
-
- emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
- VOIDmode, 0),
- GT, NULL_RTX, mode, unsignedp, 0);
-
- if (node_is_bounded (node->right, index_type))
- /* Right hand node is fully bounded so we can eliminate any
- testing and branch directly to the target code. */
- emit_jump_insn ((*gen_bgt_pat) (label_rtx (node->right->code_label)));
- else
- {
- /* Right hand node requires testing.
- Branch to a label where we will handle it later. */
-
- test_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
- emit_jump_insn ((*gen_bgt_pat) (label_rtx (test_label)));
- }
-
- /* Value belongs to this node or to the left-hand subtree. */
-
- emit_cmp_insn (index, expand_expr (node->low, NULL_RTX, VOIDmode, 0),
- GE, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_bge_pat) (label_rtx (node->code_label)));
-
- /* Handle the left-hand subtree. */
- emit_case_nodes (index, node->left, default_label, index_type);
-
- /* If right node had to be handled later, do that now. */
-
- if (test_label)
- {
- /* If the left-hand subtree fell through,
- don't let it fall into the right-hand subtree. */
- emit_jump_if_reachable (default_label);
-
- expand_label (test_label);
- emit_case_nodes (index, node->right, default_label, index_type);
- }
- }
-
- else if (node->right != 0 && node->left == 0)
- {
- /* Deal with values to the left of this node,
- if they are possible. */
- if (!node_has_low_bound (node, index_type))
- {
- emit_cmp_insn (index, expand_expr (node->low, NULL_RTX,
- VOIDmode, 0),
- LT, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_blt_pat) (default_label));
- }
-
- /* Value belongs to this node or to the right-hand subtree. */
-
- emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
- VOIDmode, 0),
- LE, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_ble_pat) (label_rtx (node->code_label)));
-
- emit_case_nodes (index, node->right, default_label, index_type);
- }
-
- else if (node->right == 0 && node->left != 0)
- {
- /* Deal with values to the right of this node,
- if they are possible. */
- if (!node_has_high_bound (node, index_type))
- {
- emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
- VOIDmode, 0),
- GT, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_bgt_pat) (default_label));
- }
-
- /* Value belongs to this node or to the left-hand subtree. */
-
- emit_cmp_insn (index, expand_expr (node->low, NULL_RTX, VOIDmode, 0),
- GE, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_bge_pat) (label_rtx (node->code_label)));
-
- emit_case_nodes (index, node->left, default_label, index_type);
- }
-
- else
- {
- /* Node has no children so we check low and high bounds to remove
- redundant tests. Only one of the bounds can exist,
- since otherwise this node is bounded--a case tested already. */
-
- if (!node_has_high_bound (node, index_type))
- {
- emit_cmp_insn (index, expand_expr (node->high, NULL_RTX,
- VOIDmode, 0),
- GT, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_bgt_pat) (default_label));
- }
-
- if (!node_has_low_bound (node, index_type))
- {
- emit_cmp_insn (index, expand_expr (node->low, NULL_RTX,
- VOIDmode, 0),
- LT, NULL_RTX, mode, unsignedp, 0);
- emit_jump_insn ((*gen_blt_pat) (default_label));
- }
-
- emit_jump (label_rtx (node->code_label));
- }
- }
-}
-
-/* These routines are used by the loop unrolling code. They copy BLOCK trees
- so that the debugging info will be correct for the unrolled loop. */
-
-/* Indexed by block number, contains a pointer to the N'th block node. */
-
-static tree *block_vector;
-
-void
-find_loop_tree_blocks ()
-{
- tree block = DECL_INITIAL (current_function_decl);
-
- block_vector = identify_blocks (block, get_insns ());
-}
-
-void
-unroll_block_trees ()
-{
- tree block = DECL_INITIAL (current_function_decl);
-
- reorder_blocks (block_vector, block, get_insns ());
-}
-
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
deleted file mode 100644
index 98f5596bf6c..00000000000
--- a/gcc/stor-layout.c
+++ /dev/null
@@ -1,1242 +0,0 @@
-/* C-compiler utilities for types and variables storage layout
- Copyright (C) 1987, 88, 92-96, 1997 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. */
-
-
-#include "config.h"
-#include <stdio.h>
-
-#include "tree.h"
-#include "flags.h"
-#include "except.h"
-#include "function.h"
-
-#define CEIL(x,y) (((x) + (y) - 1) / (y))
-
-/* Data type for the expressions representing sizes of data types.
- It is the first integer type laid out.
- In C, this is int. */
-
-tree sizetype;
-
-/* An integer constant with value 0 whose type is sizetype. */
-
-tree size_zero_node;
-
-/* An integer constant with value 1 whose type is sizetype. */
-
-tree size_one_node;
-
-/* If nonzero, this is an upper limit on alignment of structure fields.
- The value is measured in bits. */
-int maximum_field_alignment;
-
-/* If non-zero, the alignment of a bitstring or (power-)set value, in bits.
- May be overridden by front-ends. */
-int set_alignment = 0;
-
-static enum machine_mode smallest_mode_for_size PROTO((unsigned int,
- enum mode_class));
-static tree layout_record PROTO((tree));
-static void layout_union PROTO((tree));
-
-/* SAVE_EXPRs for sizes of types and decls, waiting to be expanded. */
-
-static tree pending_sizes;
-
-/* Nonzero means cannot safely call expand_expr now,
- so put variable sizes onto `pending_sizes' instead. */
-
-int immediate_size_expand;
-
-tree
-get_pending_sizes ()
-{
- tree chain = pending_sizes;
- tree t;
-
- /* Put each SAVE_EXPR into the current function. */
- for (t = chain; t; t = TREE_CHAIN (t))
- SAVE_EXPR_CONTEXT (TREE_VALUE (t)) = current_function_decl;
- pending_sizes = 0;
- return chain;
-}
-
-void
-put_pending_sizes (chain)
- tree chain;
-{
- if (pending_sizes)
- abort ();
-
- pending_sizes = chain;
-}
-
-/* Given a size SIZE that may not be a constant, return a SAVE_EXPR
- to serve as the actual size-expression for a type or decl. */
-
-tree
-variable_size (size)
- tree size;
-{
- /* If the language-processor is to take responsibility for variable-sized
- items (e.g., languages which have elaboration procedures like Ada),
- just return SIZE unchanged. Likewise for self-referential sizes. */
- if (TREE_CONSTANT (size)
- || global_bindings_p () < 0 || contains_placeholder_p (size))
- return size;
-
- size = save_expr (size);
-
- if (global_bindings_p ())
- {
- if (TREE_CONSTANT (size))
- error ("type size can't be explicitly evaluated");
- else
- error ("variable-size type declared outside of any function");
-
- return size_int (1);
- }
-
- if (immediate_size_expand)
- /* NULL_RTX is not defined; neither is the rtx type.
- Also, we would like to pass const0_rtx here, but don't have it. */
- expand_expr (size, expand_expr (integer_zero_node, NULL_PTR, VOIDmode, 0),
- VOIDmode, 0);
- else
- pending_sizes = tree_cons (NULL_TREE, size, pending_sizes);
-
- return size;
-}
-
-#ifndef MAX_FIXED_MODE_SIZE
-#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode)
-#endif
-
-/* Return the machine mode to use for a nonscalar of SIZE bits.
- The mode must be in class CLASS, and have exactly that many bits.
- If LIMIT is nonzero, modes of wider than MAX_FIXED_MODE_SIZE will not
- be used. */
-
-enum machine_mode
-mode_for_size (size, class, limit)
- unsigned int size;
- enum mode_class class;
- int limit;
-{
- register enum machine_mode mode;
-
- if (limit && size > MAX_FIXED_MODE_SIZE)
- return BLKmode;
-
- /* Get the first mode which has this size, in the specified class. */
- for (mode = GET_CLASS_NARROWEST_MODE (class); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if (GET_MODE_BITSIZE (mode) == size)
- return mode;
-
- return BLKmode;
-}
-
-/* Similar, but never return BLKmode; return the narrowest mode that
- contains at least the requested number of bits. */
-
-static enum machine_mode
-smallest_mode_for_size (size, class)
- unsigned int size;
- enum mode_class class;
-{
- register enum machine_mode mode;
-
- /* Get the first mode which has at least this size, in the
- specified class. */
- for (mode = GET_CLASS_NARROWEST_MODE (class); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- if (GET_MODE_BITSIZE (mode) >= size)
- return mode;
-
- abort ();
-}
-
-/* Return the value of VALUE, rounded up to a multiple of DIVISOR. */
-
-tree
-round_up (value, divisor)
- tree value;
- int divisor;
-{
- return size_binop (MULT_EXPR,
- size_binop (CEIL_DIV_EXPR, value, size_int (divisor)),
- size_int (divisor));
-}
-
-/* Set the size, mode and alignment of a ..._DECL node.
- TYPE_DECL does need this for C++.
- Note that LABEL_DECL and CONST_DECL nodes do not need this,
- and FUNCTION_DECL nodes have them set up in a special (and simple) way.
- Don't call layout_decl for them.
-
- KNOWN_ALIGN is the amount of alignment we can assume this
- decl has with no special effort. It is relevant only for FIELD_DECLs
- and depends on the previous fields.
- All that matters about KNOWN_ALIGN is which powers of 2 divide it.
- If KNOWN_ALIGN is 0, it means, "as much alignment as you like":
- the record will be aligned to suit. */
-
-void
-layout_decl (decl, known_align)
- tree decl;
- unsigned known_align;
-{
- register tree type = TREE_TYPE (decl);
- register enum tree_code code = TREE_CODE (decl);
- int spec_size = DECL_FIELD_SIZE (decl);
-
- if (code == CONST_DECL)
- return;
-
- if (code != VAR_DECL && code != PARM_DECL && code != RESULT_DECL
- && code != FIELD_DECL && code != TYPE_DECL)
- abort ();
-
- if (type == error_mark_node)
- {
- type = void_type_node;
- spec_size = 0;
- }
-
- /* Usually the size and mode come from the data type without change. */
-
- DECL_MODE (decl) = TYPE_MODE (type);
- TREE_UNSIGNED (decl) = TREE_UNSIGNED (type);
- if (DECL_SIZE (decl) == 0)
- DECL_SIZE (decl) = TYPE_SIZE (type);
-
- if (code == FIELD_DECL && DECL_BIT_FIELD (decl))
- {
- if (spec_size == 0 && DECL_NAME (decl) != 0)
- abort ();
-
- /* Size is specified number of bits. */
- DECL_SIZE (decl) = size_int (spec_size);
- }
- /* Force alignment required for the data type.
- But if the decl itself wants greater alignment, don't override that.
- Likewise, if the decl is packed, don't override it. */
- else if (DECL_ALIGN (decl) == 0
- || (! DECL_PACKED (decl) && TYPE_ALIGN (type) > DECL_ALIGN (decl)))
- DECL_ALIGN (decl) = TYPE_ALIGN (type);
-
- /* See if we can use an ordinary integer mode for a bit-field. */
- /* Conditions are: a fixed size that is correct for another mode
- and occupying a complete byte or bytes on proper boundary. */
- if (code == FIELD_DECL)
- {
- DECL_BIT_FIELD_TYPE (decl) = DECL_BIT_FIELD (decl) ? type : 0;
- if (maximum_field_alignment != 0)
- DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment);
- else if (DECL_PACKED (decl))
- DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
- }
-
- if (DECL_BIT_FIELD (decl)
- && TYPE_SIZE (type) != 0
- && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT)
- {
- register enum machine_mode xmode
- = mode_for_size (TREE_INT_CST_LOW (DECL_SIZE (decl)), MODE_INT, 1);
-
- if (xmode != BLKmode
- && known_align % GET_MODE_ALIGNMENT (xmode) == 0)
- {
- DECL_ALIGN (decl) = MAX (GET_MODE_ALIGNMENT (xmode),
- DECL_ALIGN (decl));
- DECL_MODE (decl) = xmode;
- DECL_SIZE (decl) = size_int (GET_MODE_BITSIZE (xmode));
- /* This no longer needs to be accessed as a bit field. */
- DECL_BIT_FIELD (decl) = 0;
- }
- }
-
- /* Turn off DECL_BIT_FIELD if we won't need it set. */
- if (DECL_BIT_FIELD (decl) && TYPE_MODE (type) == BLKmode
- && known_align % TYPE_ALIGN (type) == 0
- && DECL_SIZE (decl) != 0
- && (TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST
- || (TREE_INT_CST_LOW (DECL_SIZE (decl)) % BITS_PER_UNIT) == 0)
- && DECL_ALIGN (decl) >= TYPE_ALIGN (type))
- DECL_BIT_FIELD (decl) = 0;
-
- /* Evaluate nonconstant size only once, either now or as soon as safe. */
- if (DECL_SIZE (decl) != 0 && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
- DECL_SIZE (decl) = variable_size (DECL_SIZE (decl));
-}
-
-/* Lay out a RECORD_TYPE type (a C struct).
- This means laying out the fields, determining their positions,
- and computing the overall size and required alignment of the record.
- Note that if you set the TYPE_ALIGN before calling this
- then the struct is aligned to at least that boundary.
-
- If the type has basetypes, you must call layout_basetypes
- before calling this function.
-
- The return value is a list of static members of the record.
- They still need to be laid out. */
-
-static tree
-layout_record (rec)
- tree rec;
-{
- register tree field;
-#ifdef STRUCTURE_SIZE_BOUNDARY
- unsigned record_align = MAX (STRUCTURE_SIZE_BOUNDARY, TYPE_ALIGN (rec));
-#else
- unsigned record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (rec));
-#endif
- /* These must be laid out *after* the record is. */
- tree pending_statics = NULL_TREE;
- /* Record size so far is CONST_SIZE + VAR_SIZE bits,
- where CONST_SIZE is an integer
- and VAR_SIZE is a tree expression.
- If VAR_SIZE is null, the size is just CONST_SIZE.
- Naturally we try to avoid using VAR_SIZE. */
- register HOST_WIDE_INT const_size = 0;
- register tree var_size = 0;
- /* Once we start using VAR_SIZE, this is the maximum alignment
- that we know VAR_SIZE has. */
- register int var_align = BITS_PER_UNIT;
-
-
- for (field = TYPE_FIELDS (rec); field; field = TREE_CHAIN (field))
- {
- register int known_align = var_size ? var_align : const_size;
- register int desired_align;
-
- /* If FIELD is static, then treat it like a separate variable,
- not really like a structure field.
- If it is a FUNCTION_DECL, it's a method.
- In both cases, all we do is lay out the decl,
- and we do it *after* the record is laid out. */
-
- if (TREE_CODE (field) == VAR_DECL)
- {
- pending_statics = tree_cons (NULL_TREE, field, pending_statics);
- continue;
- }
- /* Enumerators and enum types which are local to this class need not
- be laid out. Likewise for initialized constant fields. */
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- /* Lay out the field so we know what alignment it needs.
- For a packed field, use the alignment as specified,
- disregarding what the type would want. */
- if (DECL_PACKED (field))
- desired_align = DECL_ALIGN (field);
- layout_decl (field, known_align);
- if (! DECL_PACKED (field))
- desired_align = DECL_ALIGN (field);
- /* Some targets (i.e. VMS) limit struct field alignment
- to a lower boundary than alignment of variables. */
-#ifdef BIGGEST_FIELD_ALIGNMENT
- desired_align = MIN (desired_align, BIGGEST_FIELD_ALIGNMENT);
-#endif
-#ifdef ADJUST_FIELD_ALIGN
- desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
-#endif
-
- /* Record must have at least as much alignment as any field.
- Otherwise, the alignment of the field within the record
- is meaningless. */
-
-#ifndef PCC_BITFIELD_TYPE_MATTERS
- record_align = MAX (record_align, desired_align);
-#else
- if (PCC_BITFIELD_TYPE_MATTERS && TREE_TYPE (field) != error_mark_node
- && DECL_BIT_FIELD_TYPE (field)
- && ! integer_zerop (TYPE_SIZE (TREE_TYPE (field))))
- {
- /* For these machines, a zero-length field does not
- affect the alignment of the structure as a whole.
- It does, however, affect the alignment of the next field
- within the structure. */
- if (! integer_zerop (DECL_SIZE (field)))
- record_align = MAX (record_align, desired_align);
- else if (! DECL_PACKED (field))
- desired_align = TYPE_ALIGN (TREE_TYPE (field));
- /* A named bit field of declared type `int'
- forces the entire structure to have `int' alignment. */
- if (DECL_NAME (field) != 0)
- {
- int type_align = TYPE_ALIGN (TREE_TYPE (field));
- if (maximum_field_alignment != 0)
- type_align = MIN (type_align, maximum_field_alignment);
- else if (TYPE_PACKED (rec))
- type_align = MIN (type_align, BITS_PER_UNIT);
-
- record_align = MAX (record_align, type_align);
- }
- }
- else
- record_align = MAX (record_align, desired_align);
-#endif
-
- /* Does this field automatically have alignment it needs
- by virtue of the fields that precede it and the record's
- own alignment? */
-
- if (const_size % desired_align != 0
- || (var_align % desired_align != 0
- && var_size != 0))
- {
- /* No, we need to skip space before this field.
- Bump the cumulative size to multiple of field alignment. */
-
- if (var_size == 0
- || var_align % desired_align == 0)
- const_size
- = CEIL (const_size, desired_align) * desired_align;
- else
- {
- if (const_size > 0)
- var_size = size_binop (PLUS_EXPR, var_size,
- size_int (const_size));
- const_size = 0;
- var_size = round_up (var_size, desired_align);
- var_align = MIN (var_align, desired_align);
- }
- }
-
-#ifdef PCC_BITFIELD_TYPE_MATTERS
- if (PCC_BITFIELD_TYPE_MATTERS
- && TREE_CODE (field) == FIELD_DECL
- && TREE_TYPE (field) != error_mark_node
- && DECL_BIT_FIELD_TYPE (field)
- && !DECL_PACKED (field)
- && maximum_field_alignment == 0
- && !integer_zerop (DECL_SIZE (field)))
- {
- int type_align = TYPE_ALIGN (TREE_TYPE (field));
- register tree dsize = DECL_SIZE (field);
- int field_size = TREE_INT_CST_LOW (dsize);
-
- /* A bit field may not span more units of alignment of its type
- than its type itself. Advance to next boundary if necessary. */
- if ((const_size / type_align - (const_size + field_size) / type_align)
- > TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (field))) / type_align)
- const_size = CEIL (const_size, type_align) * type_align;
- }
-#endif
-
-/* No existing machine description uses this parameter.
- So I have made it in this aspect identical to PCC_BITFIELD_TYPE_MATTERS. */
-#ifdef BITFIELD_NBYTES_LIMITED
- if (BITFIELD_NBYTES_LIMITED
- && TREE_CODE (field) == FIELD_DECL
- && TREE_TYPE (field) != error_mark_node
- && DECL_BIT_FIELD_TYPE (field)
- && !DECL_PACKED (field)
- && !integer_zerop (DECL_SIZE (field)))
- {
- int type_align = TYPE_ALIGN (TREE_TYPE (field));
- register tree dsize = DECL_SIZE (field);
- int field_size = TREE_INT_CST_LOW (dsize);
-
- if (maximum_field_alignment != 0)
- type_align = MIN (type_align, maximum_field_alignment);
- else if (TYPE_PACKED (rec))
- type_align = MIN (type_align, BITS_PER_UNIT);
-
- /* A bit field may not span the unit of alignment of its type.
- Advance to next boundary if necessary. */
- if (const_size / type_align
- != (const_size + field_size - 1) / type_align)
- const_size = CEIL (const_size, type_align) * type_align;
- }
-#endif
-
- /* Size so far becomes the position of this field. */
-
- if (var_size && const_size)
- DECL_FIELD_BITPOS (field)
- = size_binop (PLUS_EXPR, var_size, size_int (const_size));
- else if (var_size)
- DECL_FIELD_BITPOS (field) = var_size;
- else
- {
- DECL_FIELD_BITPOS (field) = size_int (const_size);
-
- /* If this field ended up more aligned than we thought it
- would be (we approximate this by seeing if its position
- changed), lay out the field again; perhaps we can use an
- integral mode for it now. */
- if (known_align != const_size)
- layout_decl (field, const_size);
- }
-
- /* Now add size of this field to the size of the record. */
-
- {
- register tree dsize = DECL_SIZE (field);
-
- /* This can happen when we have an invalid nested struct definition,
- such as struct j { struct j { int i; } }. The error message is
- printed in finish_struct. */
- if (dsize == 0)
- /* Do nothing. */;
- else if (TREE_CODE (dsize) == INTEGER_CST
- && ! TREE_CONSTANT_OVERFLOW (dsize)
- && TREE_INT_CST_HIGH (dsize) == 0
- && TREE_INT_CST_LOW (dsize) + const_size >= const_size)
- /* Use const_size if there's no overflow. */
- const_size += TREE_INT_CST_LOW (dsize);
- else
- {
- if (var_size == 0)
- var_size = dsize;
- else
- var_size = size_binop (PLUS_EXPR, var_size, dsize);
- }
- }
- }
-
- /* Work out the total size and alignment of the record
- as one expression and store in the record type.
- Round it up to a multiple of the record's alignment. */
-
- if (var_size == 0)
- {
- TYPE_SIZE (rec) = size_int (const_size);
- }
- else
- {
- if (const_size)
- var_size
- = size_binop (PLUS_EXPR, var_size, size_int (const_size));
- TYPE_SIZE (rec) = var_size;
- }
-
- /* Determine the desired alignment. */
-#ifdef ROUND_TYPE_ALIGN
- TYPE_ALIGN (rec) = ROUND_TYPE_ALIGN (rec, TYPE_ALIGN (rec), record_align);
-#else
- TYPE_ALIGN (rec) = MAX (TYPE_ALIGN (rec), record_align);
-#endif
-
-#ifdef ROUND_TYPE_SIZE
- TYPE_SIZE (rec) = ROUND_TYPE_SIZE (rec, TYPE_SIZE (rec), TYPE_ALIGN (rec));
-#else
- /* Round the size up to be a multiple of the required alignment */
- TYPE_SIZE (rec) = round_up (TYPE_SIZE (rec), TYPE_ALIGN (rec));
-#endif
-
- return pending_statics;
-}
-
-/* Lay out a UNION_TYPE or QUAL_UNION_TYPE type.
- Lay out all the fields, set their positions to zero,
- and compute the size and alignment of the union (maximum of any field).
- Note that if you set the TYPE_ALIGN before calling this
- then the union align is aligned to at least that boundary. */
-
-static void
-layout_union (rec)
- tree rec;
-{
- register tree field;
-#ifdef STRUCTURE_SIZE_BOUNDARY
- unsigned union_align = STRUCTURE_SIZE_BOUNDARY;
-#else
- unsigned union_align = BITS_PER_UNIT;
-#endif
-
- /* The size of the union, based on the fields scanned so far,
- is max (CONST_SIZE, VAR_SIZE).
- VAR_SIZE may be null; then CONST_SIZE by itself is the size. */
- register int const_size = 0;
- register tree var_size = 0;
-
- /* If this is a QUAL_UNION_TYPE, we want to process the fields in
- the reverse order in building the COND_EXPR that denotes its
- size. We reverse them again later. */
- if (TREE_CODE (rec) == QUAL_UNION_TYPE)
- TYPE_FIELDS (rec) = nreverse (TYPE_FIELDS (rec));
-
- for (field = TYPE_FIELDS (rec); field; field = TREE_CHAIN (field))
- {
- /* Enums which are local to this class need not be laid out. */
- if (TREE_CODE (field) == CONST_DECL || TREE_CODE (field) == TYPE_DECL)
- continue;
-
- layout_decl (field, 0);
- DECL_FIELD_BITPOS (field) = size_int (0);
-
- /* Union must be at least as aligned as any field requires. */
-
- union_align = MAX (union_align, DECL_ALIGN (field));
-
-#ifdef PCC_BITFIELD_TYPE_MATTERS
- /* On the m88000, a bit field of declare type `int'
- forces the entire union to have `int' alignment. */
- if (PCC_BITFIELD_TYPE_MATTERS && DECL_BIT_FIELD_TYPE (field))
- union_align = MAX (union_align, TYPE_ALIGN (TREE_TYPE (field)));
-#endif
-
- if (TREE_CODE (rec) == UNION_TYPE)
- {
- /* Set union_size to max (decl_size, union_size).
- There are more and less general ways to do this.
- Use only CONST_SIZE unless forced to use VAR_SIZE. */
-
- if (TREE_CODE (DECL_SIZE (field)) == INTEGER_CST)
- const_size
- = MAX (const_size, TREE_INT_CST_LOW (DECL_SIZE (field)));
- else if (var_size == 0)
- var_size = DECL_SIZE (field);
- else
- var_size = size_binop (MAX_EXPR, var_size, DECL_SIZE (field));
- }
- else if (TREE_CODE (rec) == QUAL_UNION_TYPE)
- var_size = fold (build (COND_EXPR, sizetype, DECL_QUALIFIER (field),
- DECL_SIZE (field),
- var_size ? var_size : integer_zero_node));
- }
-
- if (TREE_CODE (rec) == QUAL_UNION_TYPE)
- TYPE_FIELDS (rec) = nreverse (TYPE_FIELDS (rec));
-
- /* Determine the ultimate size of the union (in bytes). */
- if (NULL == var_size)
- TYPE_SIZE (rec) = size_int (CEIL (const_size, BITS_PER_UNIT)
- * BITS_PER_UNIT);
- else if (const_size == 0)
- TYPE_SIZE (rec) = var_size;
- else
- TYPE_SIZE (rec) = size_binop (MAX_EXPR, var_size,
- round_up (size_int (const_size),
- BITS_PER_UNIT));
-
- /* Determine the desired alignment. */
-#ifdef ROUND_TYPE_ALIGN
- TYPE_ALIGN (rec) = ROUND_TYPE_ALIGN (rec, TYPE_ALIGN (rec), union_align);
-#else
- TYPE_ALIGN (rec) = MAX (TYPE_ALIGN (rec), union_align);
-#endif
-
-#ifdef ROUND_TYPE_SIZE
- TYPE_SIZE (rec) = ROUND_TYPE_SIZE (rec, TYPE_SIZE (rec), TYPE_ALIGN (rec));
-#else
- /* Round the size up to be a multiple of the required alignment */
- TYPE_SIZE (rec) = round_up (TYPE_SIZE (rec), TYPE_ALIGN (rec));
-#endif
-}
-
-/* Calculate the mode, size, and alignment for TYPE.
- For an array type, calculate the element separation as well.
- Record TYPE on the chain of permanent or temporary types
- so that dbxout will find out about it.
-
- TYPE_SIZE of a type is nonzero if the type has been laid out already.
- layout_type does nothing on such a type.
-
- If the type is incomplete, its TYPE_SIZE remains zero. */
-
-void
-layout_type (type)
- tree type;
-{
- int old;
- tree pending_statics;
-
- if (type == 0)
- abort ();
-
- /* Do nothing if type has been laid out before. */
- if (TYPE_SIZE (type))
- return;
-
- /* Make sure all nodes we allocate are not momentary;
- they must last past the current statement. */
- old = suspend_momentary ();
-
- /* Put all our nodes into the same obstack as the type. Also,
- make expressions saveable (this is a no-op for permanent types). */
-
- push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
- saveable_allocation ();
-
- switch (TREE_CODE (type))
- {
- case LANG_TYPE:
- /* This kind of type is the responsibility
- of the language-specific code. */
- abort ();
-
- case INTEGER_TYPE:
- case ENUMERAL_TYPE:
- case CHAR_TYPE:
- if (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
- && tree_int_cst_sgn (TYPE_MIN_VALUE (type)) >= 0)
- TREE_UNSIGNED (type) = 1;
-
- TYPE_MODE (type) = smallest_mode_for_size (TYPE_PRECISION (type),
- MODE_INT);
- TYPE_SIZE (type) = size_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
- break;
-
- case REAL_TYPE:
- TYPE_MODE (type) = mode_for_size (TYPE_PRECISION (type), MODE_FLOAT, 0);
- TYPE_SIZE (type) = size_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
- break;
-
- case COMPLEX_TYPE:
- TREE_UNSIGNED (type) = TREE_UNSIGNED (TREE_TYPE (type));
- TYPE_MODE (type)
- = mode_for_size (2 * TYPE_PRECISION (TREE_TYPE (type)),
- (TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE
- ? MODE_COMPLEX_INT : MODE_COMPLEX_FLOAT),
- 0);
- TYPE_SIZE (type) = size_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
- break;
-
- case VOID_TYPE:
- TYPE_SIZE (type) = size_zero_node;
- TYPE_ALIGN (type) = 1;
- TYPE_MODE (type) = VOIDmode;
- break;
-
- case OFFSET_TYPE:
- TYPE_SIZE (type) = size_int (POINTER_SIZE);
- TYPE_MODE (type) = ptr_mode;
- break;
-
- case FUNCTION_TYPE:
- case METHOD_TYPE:
- TYPE_MODE (type) = mode_for_size (2 * POINTER_SIZE, MODE_INT, 0);
- TYPE_SIZE (type) = size_int (2 * POINTER_SIZE);
- break;
-
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- TYPE_MODE (type) = ptr_mode;
- TYPE_SIZE (type) = size_int (POINTER_SIZE);
- TREE_UNSIGNED (type) = 1;
- TYPE_PRECISION (type) = POINTER_SIZE;
- break;
-
- case ARRAY_TYPE:
- {
- register tree index = TYPE_DOMAIN (type);
- register tree element = TREE_TYPE (type);
-
- build_pointer_type (element);
-
- /* We need to know both bounds in order to compute the size. */
- if (index && TYPE_MAX_VALUE (index) && TYPE_MIN_VALUE (index)
- && TYPE_SIZE (element))
- {
- tree ub = TYPE_MAX_VALUE (index);
- tree lb = TYPE_MIN_VALUE (index);
- tree length;
-
- /* If UB is max (lb - 1, x), remove the MAX_EXPR since the
- test for negative below covers it. */
- if (TREE_CODE (ub) == MAX_EXPR
- && TREE_CODE (TREE_OPERAND (ub, 0)) == MINUS_EXPR
- && integer_onep (TREE_OPERAND (TREE_OPERAND (ub, 0), 1))
- && operand_equal_p (TREE_OPERAND (TREE_OPERAND (ub, 0), 0),
- lb, 0))
- ub = TREE_OPERAND (ub, 1);
- else if (TREE_CODE (ub) == MAX_EXPR
- && TREE_CODE (TREE_OPERAND (ub, 1)) == MINUS_EXPR
- && integer_onep (TREE_OPERAND (TREE_OPERAND (ub, 1), 1))
- && operand_equal_p (TREE_OPERAND (TREE_OPERAND (ub, 1),
- 0),
- lb, 0))
- ub = TREE_OPERAND (ub, 0);
-
- length = size_binop (PLUS_EXPR, size_one_node,
- size_binop (MINUS_EXPR, ub, lb));
-
- /* If neither bound is a constant and sizetype is signed, make
- sure the size is never negative. We should really do this
- if *either* bound is non-constant, but this is the best
- compromise between C and Ada. */
- if (! TREE_UNSIGNED (sizetype)
- && TREE_CODE (TYPE_MIN_VALUE (index)) != INTEGER_CST
- && TREE_CODE (TYPE_MAX_VALUE (index)) != INTEGER_CST)
- length = size_binop (MAX_EXPR, length, size_zero_node);
-
- TYPE_SIZE (type) = size_binop (MULT_EXPR, length,
- TYPE_SIZE (element));
- }
-
- /* Now round the alignment and size,
- using machine-dependent criteria if any. */
-
-#ifdef ROUND_TYPE_ALIGN
- TYPE_ALIGN (type)
- = ROUND_TYPE_ALIGN (type, TYPE_ALIGN (element), BITS_PER_UNIT);
-#else
- TYPE_ALIGN (type) = MAX (TYPE_ALIGN (element), BITS_PER_UNIT);
-#endif
-
-#ifdef ROUND_TYPE_SIZE
- if (TYPE_SIZE (type) != 0)
- TYPE_SIZE (type)
- = ROUND_TYPE_SIZE (type, TYPE_SIZE (type), TYPE_ALIGN (type));
-#endif
-
- TYPE_MODE (type) = BLKmode;
- if (TYPE_SIZE (type) != 0
- && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- /* BLKmode elements force BLKmode aggregate;
- else extract/store fields may lose. */
- && (TYPE_MODE (TREE_TYPE (type)) != BLKmode
- || TYPE_NO_FORCE_BLK (TREE_TYPE (type))))
- {
- TYPE_MODE (type)
- = mode_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)),
- MODE_INT, 1);
-
- if (STRICT_ALIGNMENT && TYPE_ALIGN (type) < BIGGEST_ALIGNMENT
- && TYPE_ALIGN (type) < TREE_INT_CST_LOW (TYPE_SIZE (type))
- && TYPE_MODE (type) != BLKmode)
- {
- TYPE_NO_FORCE_BLK (type) = 1;
- TYPE_MODE (type) = BLKmode;
- }
- }
- break;
- }
-
- case RECORD_TYPE:
- pending_statics = layout_record (type);
- TYPE_MODE (type) = BLKmode;
- if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
- {
- tree field;
- /* A record which has any BLKmode members must itself be BLKmode;
- it can't go in a register.
- Unless the member is BLKmode only because it isn't aligned. */
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- {
- int bitpos;
-
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- if (TYPE_MODE (TREE_TYPE (field)) == BLKmode
- && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field)))
- goto record_lose;
-
- if (TREE_CODE (DECL_FIELD_BITPOS (field)) != INTEGER_CST)
- goto record_lose;
-
- bitpos = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field));
-
- /* Must be BLKmode if any field crosses a word boundary,
- since extract_bit_field can't handle that in registers. */
- if (bitpos / BITS_PER_WORD
- != ((TREE_INT_CST_LOW (DECL_SIZE (field)) + bitpos - 1)
- / BITS_PER_WORD)
- /* But there is no problem if the field is entire words. */
- && TREE_INT_CST_LOW (DECL_SIZE (field)) % BITS_PER_WORD == 0)
- goto record_lose;
- }
-
- TYPE_MODE (type)
- = mode_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)),
- MODE_INT, 1);
-
- /* If structure's known alignment is less than
- what the scalar mode would need, and it matters,
- then stick with BLKmode. */
- if (STRICT_ALIGNMENT
- && ! (TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT
- || (TYPE_ALIGN (type)
- >= TREE_INT_CST_LOW (TYPE_SIZE (type)))))
- {
- if (TYPE_MODE (type) != BLKmode)
- /* If this is the only reason this type is BLKmode,
- then don't force containing types to be BLKmode. */
- TYPE_NO_FORCE_BLK (type) = 1;
- TYPE_MODE (type) = BLKmode;
- }
-
- record_lose: ;
- }
-
- /* Lay out any static members. This is done now
- because their type may use the record's type. */
- while (pending_statics)
- {
- layout_decl (TREE_VALUE (pending_statics), 0);
- pending_statics = TREE_CHAIN (pending_statics);
- }
- break;
-
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- layout_union (type);
- TYPE_MODE (type) = BLKmode;
- if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- /* If structure's known alignment is less than
- what the scalar mode would need, and it matters,
- then stick with BLKmode. */
- && (! STRICT_ALIGNMENT
- || TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT
- || TYPE_ALIGN (type) >= TREE_INT_CST_LOW (TYPE_SIZE (type))))
- {
- tree field;
- /* A union which has any BLKmode members must itself be BLKmode;
- it can't go in a register.
- Unless the member is BLKmode only because it isn't aligned. */
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- {
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
-
- if (TYPE_MODE (TREE_TYPE (field)) == BLKmode
- && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field)))
- goto union_lose;
- }
-
- TYPE_MODE (type)
- = mode_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)),
- MODE_INT, 1);
-
- union_lose: ;
- }
- break;
-
- /* Pascal and Chill types */
- case BOOLEAN_TYPE: /* store one byte/boolean for now. */
- TYPE_MODE (type) = QImode;
- TYPE_SIZE (type) = size_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
- TYPE_PRECISION (type) = 1;
- TYPE_ALIGN (type) = GET_MODE_ALIGNMENT (TYPE_MODE (type));
- if (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
- && tree_int_cst_sgn (TYPE_MIN_VALUE (type)) >= 0)
- TREE_UNSIGNED (type) = 1;
- break;
-
- case SET_TYPE:
- if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) != INTEGER_CST
- || TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) != INTEGER_CST)
- abort();
- else
- {
-#ifndef SET_WORD_SIZE
-#define SET_WORD_SIZE BITS_PER_WORD
-#endif
- int alignment = set_alignment ? set_alignment : SET_WORD_SIZE;
- int size_in_bits =
- TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
- - TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) + 1;
- int rounded_size
- = ((size_in_bits + alignment - 1) / alignment) * alignment;
- if (rounded_size > alignment)
- TYPE_MODE (type) = BLKmode;
- else
- TYPE_MODE (type) = mode_for_size (alignment, MODE_INT, 1);
- TYPE_SIZE (type) = size_int (rounded_size);
- TYPE_ALIGN (type) = alignment;
- TYPE_PRECISION (type) = size_in_bits;
- }
- break;
-
- case FILE_TYPE:
- /* The size may vary in different languages, so the language front end
- should fill in the size. */
- TYPE_ALIGN (type) = BIGGEST_ALIGNMENT;
- TYPE_MODE (type) = BLKmode;
- break;
-
- default:
- abort ();
- } /* end switch */
-
- /* Normally, use the alignment corresponding to the mode chosen.
- However, where strict alignment is not required, avoid
- over-aligning structures, since most compilers do not do this
- alignment. */
-
- if (TYPE_MODE (type) != BLKmode && TYPE_MODE (type) != VOIDmode
- && (STRICT_ALIGNMENT
- || (TREE_CODE (type) != RECORD_TYPE && TREE_CODE (type) != UNION_TYPE
- && TREE_CODE (type) != QUAL_UNION_TYPE
- && TREE_CODE (type) != ARRAY_TYPE)))
- TYPE_ALIGN (type) = GET_MODE_ALIGNMENT (TYPE_MODE (type));
-
- /* Evaluate nonconstant size only once, either now or as soon as safe. */
- if (TYPE_SIZE (type) != 0 && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- TYPE_SIZE (type) = variable_size (TYPE_SIZE (type));
-
- /* Also layout any other variants of the type. */
- if (TYPE_NEXT_VARIANT (type)
- || type != TYPE_MAIN_VARIANT (type))
- {
- tree variant;
- /* Record layout info of this variant. */
- tree size = TYPE_SIZE (type);
- int align = TYPE_ALIGN (type);
- enum machine_mode mode = TYPE_MODE (type);
-
- /* Copy it into all variants. */
- for (variant = TYPE_MAIN_VARIANT (type);
- variant;
- variant = TYPE_NEXT_VARIANT (variant))
- {
- TYPE_SIZE (variant) = size;
- TYPE_ALIGN (variant) = align;
- TYPE_MODE (variant) = mode;
- }
- }
-
- pop_obstacks ();
- resume_momentary (old);
-}
-
-/* Create and return a type for signed integers of PRECISION bits. */
-
-tree
-make_signed_type (precision)
- int precision;
-{
- register tree type = make_node (INTEGER_TYPE);
-
- TYPE_PRECISION (type) = precision;
-
- /* Create the extreme values based on the number of bits. */
-
- TYPE_MIN_VALUE (type)
- = build_int_2 ((precision - HOST_BITS_PER_WIDE_INT > 0
- ? 0 : (HOST_WIDE_INT) (-1) << (precision - 1)),
- (((HOST_WIDE_INT) (-1)
- << (precision - HOST_BITS_PER_WIDE_INT - 1 > 0
- ? precision - HOST_BITS_PER_WIDE_INT - 1
- : 0))));
- TYPE_MAX_VALUE (type)
- = build_int_2 ((precision - HOST_BITS_PER_WIDE_INT > 0
- ? -1 : ((HOST_WIDE_INT) 1 << (precision - 1)) - 1),
- (precision - HOST_BITS_PER_WIDE_INT - 1 > 0
- ? (((HOST_WIDE_INT) 1
- << (precision - HOST_BITS_PER_WIDE_INT - 1))) - 1
- : 0));
-
- /* Give this type's extreme values this type as their type. */
-
- TREE_TYPE (TYPE_MIN_VALUE (type)) = type;
- TREE_TYPE (TYPE_MAX_VALUE (type)) = type;
-
- /* The first type made with this or `make_unsigned_type'
- is the type for size values. */
-
- if (sizetype == 0)
- {
- sizetype = type;
- }
-
- /* Lay out the type: set its alignment, size, etc. */
-
- layout_type (type);
-
- return type;
-}
-
-/* Create and return a type for unsigned integers of PRECISION bits. */
-
-tree
-make_unsigned_type (precision)
- int precision;
-{
- register tree type = make_node (INTEGER_TYPE);
-
- TYPE_PRECISION (type) = precision;
-
- /* The first type made with this or `make_signed_type'
- is the type for size values. */
-
- if (sizetype == 0)
- {
- sizetype = type;
- }
-
- fixup_unsigned_type (type);
- return type;
-}
-
-/* Set the extreme values of TYPE based on its precision in bits,
- then lay it out. Used when make_signed_type won't do
- because the tree code is not INTEGER_TYPE.
- E.g. for Pascal, when the -fsigned-char option is given. */
-
-void
-fixup_signed_type (type)
- tree type;
-{
- register int precision = TYPE_PRECISION (type);
-
- TYPE_MIN_VALUE (type)
- = build_int_2 ((precision - HOST_BITS_PER_WIDE_INT > 0
- ? 0 : (HOST_WIDE_INT) (-1) << (precision - 1)),
- (((HOST_WIDE_INT) (-1)
- << (precision - HOST_BITS_PER_WIDE_INT - 1 > 0
- ? precision - HOST_BITS_PER_WIDE_INT - 1
- : 0))));
- TYPE_MAX_VALUE (type)
- = build_int_2 ((precision - HOST_BITS_PER_WIDE_INT > 0
- ? -1 : ((HOST_WIDE_INT) 1 << (precision - 1)) - 1),
- (precision - HOST_BITS_PER_WIDE_INT - 1 > 0
- ? (((HOST_WIDE_INT) 1
- << (precision - HOST_BITS_PER_WIDE_INT - 1))) - 1
- : 0));
-
- TREE_TYPE (TYPE_MIN_VALUE (type)) = type;
- TREE_TYPE (TYPE_MAX_VALUE (type)) = type;
-
- /* Lay out the type: set its alignment, size, etc. */
-
- layout_type (type);
-}
-
-/* Set the extreme values of TYPE based on its precision in bits,
- then lay it out. This is used both in `make_unsigned_type'
- and for enumeral types. */
-
-void
-fixup_unsigned_type (type)
- tree type;
-{
- register int precision = TYPE_PRECISION (type);
-
- TYPE_MIN_VALUE (type) = build_int_2 (0, 0);
- TYPE_MAX_VALUE (type)
- = build_int_2 (precision - HOST_BITS_PER_WIDE_INT >= 0
- ? -1 : ((HOST_WIDE_INT) 1 << precision) - 1,
- precision - HOST_BITS_PER_WIDE_INT > 0
- ? ((unsigned HOST_WIDE_INT) ~0
- >> (HOST_BITS_PER_WIDE_INT
- - (precision - HOST_BITS_PER_WIDE_INT)))
- : 0);
- TREE_TYPE (TYPE_MIN_VALUE (type)) = type;
- TREE_TYPE (TYPE_MAX_VALUE (type)) = type;
-
- /* Lay out the type: set its alignment, size, etc. */
-
- layout_type (type);
-}
-
-/* Find the best machine mode to use when referencing a bit field of length
- BITSIZE bits starting at BITPOS.
-
- The underlying object is known to be aligned to a boundary of ALIGN bits.
- If LARGEST_MODE is not VOIDmode, it means that we should not use a mode
- larger than LARGEST_MODE (usually SImode).
-
- If no mode meets all these conditions, we return VOIDmode. Otherwise, if
- VOLATILEP is true or SLOW_BYTE_ACCESS is false, we return the smallest
- mode meeting these conditions.
-
- Otherwise (VOLATILEP is false and SLOW_BYTE_ACCESS is true), we return
- the largest mode (but a mode no wider than UNITS_PER_WORD) that meets
- all the conditions. */
-
-enum machine_mode
-get_best_mode (bitsize, bitpos, align, largest_mode, volatilep)
- int bitsize, bitpos;
- int align;
- enum machine_mode largest_mode;
- int volatilep;
-{
- enum machine_mode mode;
- int unit;
-
- /* Find the narrowest integer mode that contains the bit field. */
- for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
- mode = GET_MODE_WIDER_MODE (mode))
- {
- unit = GET_MODE_BITSIZE (mode);
- if (bitpos / unit == (bitpos + bitsize - 1) / unit)
- break;
- }
-
- if (mode == MAX_MACHINE_MODE
- /* It is tempting to omit the following line
- if STRICT_ALIGNMENT is true.
- But that is incorrect, since if the bitfield uses part of 3 bytes
- and we use a 4-byte mode, we could get a spurious segv
- if the extra 4th byte is past the end of memory.
- (Though at least one Unix compiler ignores this problem:
- that on the Sequent 386 machine. */
- || MIN (unit, BIGGEST_ALIGNMENT) > align
- || (largest_mode != VOIDmode && unit > GET_MODE_BITSIZE (largest_mode)))
- return VOIDmode;
-
- if (SLOW_BYTE_ACCESS && ! volatilep)
- {
- enum machine_mode wide_mode = VOIDmode, tmode;
-
- for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT); tmode != VOIDmode;
- tmode = GET_MODE_WIDER_MODE (tmode))
- {
- unit = GET_MODE_BITSIZE (tmode);
- if (bitpos / unit == (bitpos + bitsize - 1) / unit
- && unit <= BITS_PER_WORD
- && unit <= MIN (align, BIGGEST_ALIGNMENT)
- && (largest_mode == VOIDmode
- || unit <= GET_MODE_BITSIZE (largest_mode)))
- wide_mode = tmode;
- }
-
- if (wide_mode != VOIDmode)
- return wide_mode;
- }
-
- return mode;
-}
-
-/* Save all variables describing the current status into the structure *P.
- This is used before starting a nested function. */
-
-void
-save_storage_status (p)
- struct function *p;
-{
-#if 0 /* Need not save, since always 0 and non0 (resp.) within a function. */
- p->pending_sizes = pending_sizes;
- p->immediate_size_expand = immediate_size_expand;
-#endif /* 0 */
-}
-
-/* Restore all variables describing the current status from the structure *P.
- This is used after a nested function. */
-
-void
-restore_storage_status (p)
- struct function *p;
-{
-#if 0
- pending_sizes = p->pending_sizes;
- immediate_size_expand = p->immediate_size_expand;
-#endif /* 0 */
-}
diff --git a/gcc/stupid.c b/gcc/stupid.c
deleted file mode 100644
index 6f100253c0d..00000000000
--- a/gcc/stupid.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/* Dummy data flow analysis for GNU compiler in nonoptimizing mode.
- Copyright (C) 1987, 1991, 1994, 1995, 1996 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 performs stupid register allocation, which is used
- when cc1 gets the -noreg switch (which is when cc does not get -O).
-
- Stupid register allocation goes in place of the the flow_analysis,
- local_alloc and global_alloc passes. combine_instructions cannot
- be done with stupid allocation because the data flow info that it needs
- is not computed here.
-
- In stupid allocation, the only user-defined variables that can
- go in registers are those declared "register". They are assumed
- to have a life span equal to their scope. Other user variables
- are given stack slots in the rtl-generation pass and are not
- represented as pseudo regs. A compiler-generated temporary
- is assumed to live from its first mention to its last mention.
-
- Since each pseudo-reg's life span is just an interval, it can be
- represented as a pair of numbers, each of which identifies an insn by
- its position in the function (number of insns before it). The first
- thing done for stupid allocation is to compute such a number for each
- insn. It is called the suid. Then the life-interval of each
- pseudo reg is computed. Then the pseudo regs are ordered by priority
- and assigned hard regs in priority order. */
-
-#include <stdio.h>
-#include "config.h"
-#include "rtl.h"
-#include "hard-reg-set.h"
-#include "regs.h"
-#include "flags.h"
-
-/* Vector mapping INSN_UIDs to suids.
- The suids are like uids but increase monotonically always.
- We use them to see whether a subroutine call came
- between a variable's birth and its death. */
-
-static int *uid_suid;
-
-/* Get the suid of an insn. */
-
-#define INSN_SUID(INSN) (uid_suid[INSN_UID (INSN)])
-
-/* Record the suid of the last CALL_INSN
- so we can tell whether a pseudo reg crosses any calls. */
-
-static int last_call_suid;
-
-/* Record the suid of the last NOTE_INSN_SETJMP
- so we can tell whether a pseudo reg crosses any setjmp. */
-
-static int last_setjmp_suid;
-
-/* Element N is suid of insn where life span of pseudo reg N ends.
- Element is 0 if register N has not been seen yet on backward scan. */
-
-static int *reg_where_dead;
-
-/* Element N is suid of insn where life span of pseudo reg N begins. */
-
-static int *reg_where_born;
-
-/* Numbers of pseudo-regs to be allocated, highest priority first. */
-
-static int *reg_order;
-
-/* Indexed by reg number (hard or pseudo), nonzero if register is live
- at the current point in the instruction stream. */
-
-static char *regs_live;
-
-/* Indexed by reg number, nonzero if reg was used in a SUBREG that changes
- its size. */
-
-static char *regs_change_size;
-
-/* Indexed by reg number, nonzero if reg crosses a setjmp. */
-
-static char *regs_crosses_setjmp;
-
-/* Indexed by insn's suid, the set of hard regs live after that insn. */
-
-static HARD_REG_SET *after_insn_hard_regs;
-
-/* Record that hard reg REGNO is live after insn INSN. */
-
-#define MARK_LIVE_AFTER(INSN,REGNO) \
- SET_HARD_REG_BIT (after_insn_hard_regs[INSN_SUID (INSN)], (REGNO))
-
-static int stupid_reg_compare PROTO((const GENERIC_PTR,const GENERIC_PTR));
-static int stupid_find_reg PROTO((int, enum reg_class, enum machine_mode,
- int, int, int));
-static void stupid_mark_refs PROTO((rtx, rtx));
-
-/* Stupid life analysis is for the case where only variables declared
- `register' go in registers. For this case, we mark all
- pseudo-registers that belong to register variables as
- dying in the last instruction of the function, and all other
- pseudo registers as dying in the last place they are referenced.
- Hard registers are marked as dying in the last reference before
- the end or before each store into them. */
-
-void
-stupid_life_analysis (f, nregs, file)
- rtx f;
- int nregs;
- FILE *file;
-{
- register int i;
- register rtx last, insn;
- int max_uid, max_suid;
-
- bzero (regs_ever_live, sizeof regs_ever_live);
-
- regs_live = (char *) alloca (nregs);
-
- /* First find the last real insn, and count the number of insns,
- and assign insns their suids. */
-
- for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
- if (INSN_UID (insn) > i)
- i = INSN_UID (insn);
-
- max_uid = i + 1;
- uid_suid = (int *) alloca ((i + 1) * sizeof (int));
-
- /* Compute the mapping from uids to suids.
- Suids are numbers assigned to insns, like uids,
- except that suids increase monotonically through the code. */
-
- last = 0; /* In case of empty function body */
- for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
- {
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- last = insn;
-
- INSN_SUID (insn) = ++i;
- }
-
- last_call_suid = i + 1;
- last_setjmp_suid = i + 1;
- max_suid = i + 1;
-
- max_regno = nregs;
-
- /* Allocate tables to record info about regs. */
-
- reg_where_dead = (int *) alloca (nregs * sizeof (int));
- bzero ((char *) reg_where_dead, nregs * sizeof (int));
-
- reg_where_born = (int *) alloca (nregs * sizeof (int));
- bzero ((char *) reg_where_born, nregs * sizeof (int));
-
- reg_order = (int *) alloca (nregs * sizeof (int));
- bzero ((char *) reg_order, nregs * sizeof (int));
-
- regs_change_size = (char *) alloca (nregs * sizeof (char));
- bzero ((char *) regs_change_size, nregs * sizeof (char));
-
- regs_crosses_setjmp = (char *) alloca (nregs * sizeof (char));
- bzero ((char *) regs_crosses_setjmp, nregs * sizeof (char));
-
- reg_renumber = (short *) oballoc (nregs * sizeof (short));
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- reg_renumber[i] = i;
-
- for (i = FIRST_VIRTUAL_REGISTER; i < max_regno; i++)
- reg_renumber[i] = -1;
-
- after_insn_hard_regs
- = (HARD_REG_SET *) alloca (max_suid * sizeof (HARD_REG_SET));
-
- bzero ((char *) after_insn_hard_regs, max_suid * sizeof (HARD_REG_SET));
-
- /* Allocate and zero out many data structures
- that will record the data from lifetime analysis. */
-
- allocate_for_life_analysis ();
-
- for (i = 0; i < max_regno; i++)
- reg_n_deaths[i] = 1;
-
- bzero (regs_live, nregs);
-
- /* Find where each pseudo register is born and dies,
- by scanning all insns from the end to the start
- and noting all mentions of the registers.
-
- Also find where each hard register is live
- and record that info in after_insn_hard_regs.
- regs_live[I] is 1 if hard reg I is live
- at the current point in the scan. */
-
- for (insn = last; insn; insn = PREV_INSN (insn))
- {
- register HARD_REG_SET *p = after_insn_hard_regs + INSN_SUID (insn);
-
- /* Copy the info in regs_live into the element of after_insn_hard_regs
- for the current position in the rtl code. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (regs_live[i])
- SET_HARD_REG_BIT (*p, i);
-
- /* Update which hard regs are currently live
- and also the birth and death suids of pseudo regs
- based on the pattern of this insn. */
-
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- stupid_mark_refs (PATTERN (insn), insn);
-
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
- last_setjmp_suid = INSN_SUID (insn);
-
- /* Mark all call-clobbered regs as live after each call insn
- so that a pseudo whose life span includes this insn
- will not go in one of them.
- Then mark those regs as all dead for the continuing scan
- of the insns before the call. */
-
- if (GET_CODE (insn) == CALL_INSN)
- {
- last_call_suid = INSN_SUID (insn);
- IOR_HARD_REG_SET (after_insn_hard_regs[last_call_suid],
- call_used_reg_set);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i])
- regs_live[i] = 0;
-
- /* It is important that this be done after processing the insn's
- pattern because we want the function result register to still
- be live if it's also used to pass arguments. */
- stupid_mark_refs (CALL_INSN_FUNCTION_USAGE (insn), insn);
- }
- }
-
- /* Now decide the order in which to allocate the pseudo registers. */
-
- for (i = LAST_VIRTUAL_REGISTER + 1; i < max_regno; i++)
- reg_order[i] = i;
-
- qsort (&reg_order[LAST_VIRTUAL_REGISTER + 1],
- max_regno - LAST_VIRTUAL_REGISTER - 1, sizeof (int),
- stupid_reg_compare);
-
- /* Now, in that order, try to find hard registers for those pseudo regs. */
-
- for (i = LAST_VIRTUAL_REGISTER + 1; i < max_regno; i++)
- {
- register int r = reg_order[i];
-
- /* Some regnos disappear from the rtl. Ignore them to avoid crash.
- Also don't allocate registers that cross a setjmp. */
- if (regno_reg_rtx[r] == 0 || regs_crosses_setjmp[r])
- continue;
-
- /* Now find the best hard-register class for this pseudo register */
- if (N_REG_CLASSES > 1)
- reg_renumber[r] = stupid_find_reg (reg_n_calls_crossed[r],
- reg_preferred_class (r),
- PSEUDO_REGNO_MODE (r),
- reg_where_born[r],
- reg_where_dead[r],
- regs_change_size[r]);
-
- /* If no reg available in that class, try alternate class. */
- if (reg_renumber[r] == -1 && reg_alternate_class (r) != NO_REGS)
- reg_renumber[r] = stupid_find_reg (reg_n_calls_crossed[r],
- reg_alternate_class (r),
- PSEUDO_REGNO_MODE (r),
- reg_where_born[r],
- reg_where_dead[r],
- regs_change_size[r]);
- }
-
- if (file)
- dump_flow_info (file);
-}
-
-/* Comparison function for qsort.
- Returns -1 (1) if register *R1P is higher priority than *R2P. */
-
-static int
-stupid_reg_compare (r1p, r2p)
- const GENERIC_PTR r1p;
- const GENERIC_PTR r2p;
-{
- register int r1 = *(int *)r1p, r2 = *(int *)r2p;
- register int len1 = reg_where_dead[r1] - reg_where_born[r1];
- register int len2 = reg_where_dead[r2] - reg_where_born[r2];
- int tem;
-
- tem = len2 - len1;
- if (tem != 0)
- return tem;
-
- tem = reg_n_refs[r1] - reg_n_refs[r2];
- if (tem != 0)
- return tem;
-
- /* If regs are equally good, sort by regno,
- so that the results of qsort leave nothing to chance. */
- return r1 - r2;
-}
-
-/* Find a block of SIZE words of hard registers in reg_class CLASS
- that can hold a value of machine-mode MODE
- (but actually we test only the first of the block for holding MODE)
- currently free from after insn whose suid is BORN_INSN
- through the insn whose suid is DEAD_INSN,
- and return the number of the first of them.
- Return -1 if such a block cannot be found.
-
- If CALL_PRESERVED is nonzero, insist on registers preserved
- over subroutine calls, and return -1 if cannot find such.
-
- If CHANGES_SIZE is nonzero, it means this register was used as the
- operand of a SUBREG that changes its size. */
-
-static int
-stupid_find_reg (call_preserved, class, mode,
- born_insn, dead_insn, changes_size)
- int call_preserved;
- enum reg_class class;
- enum machine_mode mode;
- int born_insn, dead_insn;
- int changes_size;
-{
- register int i, ins;
-#ifdef HARD_REG_SET
- register /* Declare them register if they are scalars. */
-#endif
- HARD_REG_SET used, this_reg;
-#ifdef ELIMINABLE_REGS
- static struct {int from, to; } eliminables[] = ELIMINABLE_REGS;
-#endif
-
- /* If this register's life is more than 5,000 insns, we probably
- can't allocate it, so don't waste the time trying. This avoids
- quadratic behavior on programs that have regularly-occurring
- SAVE_EXPRs. */
- if (dead_insn > born_insn + 5000)
- return -1;
-
- COPY_HARD_REG_SET (used,
- call_preserved ? call_used_reg_set : fixed_reg_set);
-
-#ifdef ELIMINABLE_REGS
- for (i = 0; i < sizeof eliminables / sizeof eliminables[0]; i++)
- SET_HARD_REG_BIT (used, eliminables[i].from);
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- SET_HARD_REG_BIT (used, HARD_FRAME_POINTER_REGNUM);
-#endif
-#else
- SET_HARD_REG_BIT (used, FRAME_POINTER_REGNUM);
-#endif
-
- for (ins = born_insn; ins < dead_insn; ins++)
- IOR_HARD_REG_SET (used, after_insn_hard_regs[ins]);
-
- IOR_COMPL_HARD_REG_SET (used, reg_class_contents[(int) class]);
-
-#ifdef CLASS_CANNOT_CHANGE_SIZE
- if (changes_size)
- IOR_HARD_REG_SET (used,
- reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE]);
-#endif
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
-#ifdef REG_ALLOC_ORDER
- int regno = reg_alloc_order[i];
-#else
- int regno = i;
-#endif
-
- /* If a register has screwy overlap problems,
- don't use it at all if not optimizing.
- Actually this is only for the 387 stack register,
- and it's because subsequent code won't work. */
-#ifdef OVERLAPPING_REGNO_P
- if (OVERLAPPING_REGNO_P (regno))
- continue;
-#endif
-
- if (! TEST_HARD_REG_BIT (used, regno)
- && HARD_REGNO_MODE_OK (regno, mode))
- {
- register int j;
- register int size1 = HARD_REGNO_NREGS (regno, mode);
- for (j = 1; j < size1 && ! TEST_HARD_REG_BIT (used, regno + j); j++);
- if (j == size1)
- {
- CLEAR_HARD_REG_SET (this_reg);
- while (--j >= 0)
- SET_HARD_REG_BIT (this_reg, regno + j);
- for (ins = born_insn; ins < dead_insn; ins++)
- {
- IOR_HARD_REG_SET (after_insn_hard_regs[ins], this_reg);
- }
- return regno;
- }
-#ifndef REG_ALLOC_ORDER
- i += j; /* Skip starting points we know will lose */
-#endif
- }
- }
-
- return -1;
-}
-
-/* Walk X, noting all assignments and references to registers
- and recording what they imply about life spans.
- INSN is the current insn, supplied so we can find its suid. */
-
-static void
-stupid_mark_refs (x, insn)
- rtx x, insn;
-{
- register RTX_CODE code;
- register char *fmt;
- register int regno, i;
-
- if (x == 0)
- return;
-
- code = GET_CODE (x);
-
- if (code == SET || code == CLOBBER)
- {
- if (SET_DEST (x) != 0
- && (GET_CODE (SET_DEST (x)) == REG
- || (GET_CODE (SET_DEST (x)) == SUBREG
- && GET_CODE (SUBREG_REG (SET_DEST (x))) == REG
- && (REGNO (SUBREG_REG (SET_DEST (x)))
- >= FIRST_PSEUDO_REGISTER))))
- {
- /* Register is being assigned. */
- /* If setting a SUBREG, we treat the entire reg as being set. */
- if (GET_CODE (SET_DEST (x)) == SUBREG)
- regno = REGNO (SUBREG_REG (SET_DEST (x)));
- else
- regno = REGNO (SET_DEST (x));
-
- /* For hard regs, update the where-live info. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- register int j
- = HARD_REGNO_NREGS (regno, GET_MODE (SET_DEST (x)));
-
- while (--j >= 0)
- {
- regs_ever_live[regno+j] = 1;
- regs_live[regno+j] = 0;
-
- /* The following line is for unused outputs;
- they do get stored even though never used again. */
- MARK_LIVE_AFTER (insn, regno+j);
-
- /* When a hard reg is clobbered, mark it in use
- just before this insn, so it is live all through. */
- if (code == CLOBBER && INSN_SUID (insn) > 0)
- SET_HARD_REG_BIT (after_insn_hard_regs[INSN_SUID (insn) - 1],
- regno+j);
- }
- }
- /* For pseudo regs, record where born, where dead, number of
- times used, and whether live across a call. */
- else
- {
- /* Update the life-interval bounds of this pseudo reg. */
-
- /* When a pseudo-reg is CLOBBERed, it is born just before
- the clobbering insn. When setting, just after. */
- int where_born = INSN_SUID (insn) - (code == CLOBBER);
-
- reg_where_born[regno] = where_born;
-
- /* The reg must live at least one insn even
- in it is never again used--because it has to go
- in SOME hard reg. Mark it as dying after the current
- insn so that it will conflict with any other outputs of
- this insn. */
- if (reg_where_dead[regno] < where_born + 2)
- {
- reg_where_dead[regno] = where_born + 2;
- regs_live[regno] = 1;
- }
-
- /* Count the refs of this reg. */
- reg_n_refs[regno]++;
-
- if (last_call_suid < reg_where_dead[regno])
- reg_n_calls_crossed[regno] += 1;
-
- if (last_setjmp_suid < reg_where_dead[regno])
- regs_crosses_setjmp[regno] = 1;
- }
- }
-
- /* Record references from the value being set,
- or from addresses in the place being set if that's not a reg.
- If setting a SUBREG, we treat the entire reg as *used*. */
- if (code == SET)
- {
- stupid_mark_refs (SET_SRC (x), insn);
- if (GET_CODE (SET_DEST (x)) != REG)
- stupid_mark_refs (SET_DEST (x), insn);
- }
- return;
- }
-
- else if (code == SUBREG
- && GET_CODE (SUBREG_REG (x)) == REG
- && REGNO (SUBREG_REG (x)) >= FIRST_PSEUDO_REGISTER
- && (GET_MODE_SIZE (GET_MODE (x))
- != GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- && (INTEGRAL_MODE_P (GET_MODE (x))
- || INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (x)))))
- regs_change_size[REGNO (SUBREG_REG (x))] = 1;
-
- /* Register value being used, not set. */
-
- else if (code == REG)
- {
- regno = REGNO (x);
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- /* Hard reg: mark it live for continuing scan of previous insns. */
- register int j = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (--j >= 0)
- {
- regs_ever_live[regno+j] = 1;
- regs_live[regno+j] = 1;
- }
- }
- else
- {
- /* Pseudo reg: record first use, last use and number of uses. */
-
- reg_where_born[regno] = INSN_SUID (insn);
- reg_n_refs[regno]++;
- if (regs_live[regno] == 0)
- {
- regs_live[regno] = 1;
- reg_where_dead[regno] = INSN_SUID (insn);
- }
- }
- return;
- }
-
- /* Recursive scan of all other rtx's. */
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- stupid_mark_refs (XEXP (x, i), insn);
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- stupid_mark_refs (XVECEXP (x, i, j), insn);
- }
- }
-}
diff --git a/gcc/sys-protos.h b/gcc/sys-protos.h
deleted file mode 100644
index ab6e407e8f1..00000000000
--- a/gcc/sys-protos.h
+++ /dev/null
@@ -1,1354 +0,0 @@
-extern int TLappend(/* ??? */);
-extern int TLassign(/* ??? */);
-extern int TLclose(/* ??? */);
-extern int TLdelete(/* ??? */);
-extern int TLfreeentry(/* ??? */);
-extern ENTRY TLgetentry(/* ??? */);
-extern unsigned char * TLgetfield(/* ??? */);
-extern int TLopen(/* ??? */);
-extern int TLread(/* ??? */);
-extern int TLsearch1(/* ??? */);
-extern int TLsubst(/* ??? */);
-extern int TLsync(/* ??? */);
-extern int TLwrite(/* ??? */);
-extern int __acancel(int, const long int *, int);
-extern int __aread(int, int, char *, uint, ecb_t *);
-extern void __assert(const char *, const char *, int);
-extern int __asyncio(int, aioop_t *, int);
-extern int __awrite(int, int, char *, uint, ecb_t *);
-extern void __eprintf(const char *);
-extern int __evcntl(evver_t, evcntlcmds_t, long int, long int);
-extern int __evexit(evver_t, idtype_t, id_t, const ecb_t *);
-extern int __evexitset(evver_t, const procset_t *, hostid_t, const ecb_t *);
-extern int __evpoll(evver_t, evpollcmds_t, event_t *, int, const hrtime_t *);
-extern int __evpollmore(evver_t, event_t *, int);
-extern int __evpost(evver_t, event_t *, int, int);
-extern int __evqcntl(evver_t, int, evqcntlcmds_t, long int);
-extern int __evsig(evver_t, const sigset_t *, const ecb_t *, evsiginfo_t *, int);
-extern int __evtrap(evver_t, evpollcmds_t, event_t *, int, long int, void (*) (event_t *, int, long int, evcontext_t *), const evta_t *);
-extern int __evtrapcancel(evver_t, long int *, int);
-extern int __filbuf(FILE *);
-extern int __flsbuf(int, FILE *);
-extern major_t __major(int, dev_t);
-extern dev_t __makedev(int, major_t, minor_t);
-extern minor_t __minor(int, dev_t);
-extern long int __priocntl(/* ??? */);
-extern long int __priocntlset(/* ??? */);
-extern void _exit(int);
-extern int _filbuf(FILE *);
-extern int _flsbuf(unsigned int, FILE *);
-extern int _fxstat(int, int, struct stat *);
-extern u_long _getlong(/* ??? */);
-extern u_short _getshort(/* ??? */);
-extern int _getsyx(int *, int *);
-extern int _longjmp(jmp_buf, int);
-extern int _lxstat(int, const char *, struct stat *);
-extern int _meta(int);
-extern struct nd_hostservlist _netdir_getbyaddr(struct netconfig *, struct netbuf *);
-extern struct nd_addrlist * _netdir_getbyname(struct netconfig *, struct nd_hostserv *);
-extern int _overlay(WINDOW *, WINDOW *, int);
-extern int _ring(int);
-extern int _rpc_dtbsize(/* ??? */);
-extern int _rpc_endconf(/* ??? */);
-extern u_int _rpc_get_a_size(/* ??? */);
-extern u_int _rpc_get_t_size(/* ??? */);
-extern struct netconfig * _rpc_getconf(/* ??? */);
-extern struct netconfig * _rpc_getconfip(/* ??? */);
-extern char * _rpc_gethostname(/* ??? */);
-extern int _rpc_setconf(/* ??? */);
-extern void _s_aligned_copy(/* ??? */);
-extern struct _si_user * _s_checkfd(/* ??? */);
-extern void _s_close(/* ??? */);
-extern int _s_do_ioctl(/* ??? */);
-extern int _s_getfamily(/* ??? */);
-extern int _s_getudata(/* ??? */);
-extern int _s_is_ok(/* ??? */);
-extern struct netconfig * _s_match(/* ??? */);
-extern int _s_max(/* ??? */);
-extern int _s_min(/* ??? */);
-extern struct _si_user * _s_open(/* ??? */);
-extern int _s_soreceive(/* ??? */);
-extern int _s_sosend(/* ??? */);
-extern int _s_uxpathlen(/* ??? */);
-extern int _setecho(int);
-extern int _setjmp(jmp_buf);
-extern int _setnonl(int);
-extern void _setqiflush(int);
-extern char * _taddr2uaddr(struct netconfig *, struct netbuf *);
-extern int _tolower(int);
-extern int _toupper(int);
-extern struct netbuf * _uaddr2taddr(struct netconfig *, char *);
-extern bool _xdr_yprequest(/* ??? */);
-extern bool _xdr_ypresponse(/* ??? */);
-extern int _xftw(int, const char *, int (*) (const char *, const struct stat *, int), int);
-extern int _xmknod(int, const char *, mode_t, dev_t);
-extern int _xstat(int, const char *, struct stat *);
-extern int _yp_dobind(/* ??? */);
-extern long int a64l(const char *);
-extern char * aatos(char *, struct address *, int);
-extern void abort(void);
-extern int abs(int);
-extern int access(const char *, int);
-extern int acct(const char *);
-extern double acos(double);
-extern float acosf(float);
-extern double acosh(double);
-extern int addexportent(FILE *, char *, char *);
-extern int addseverity(int, const char *);
-extern int adjtime(struct timeval *, struct timeval *);
-extern int advance(const char *, const char *);
-extern unsigned int alarm(unsigned int);
-extern void * alloca(size_t);
-extern int and(void);
-extern int ascftime(char *, const char *, const struct tm *);
-extern char * asctime(const struct tm *);
-extern double asin(double);
-extern float asinf(float);
-extern double asinh(double);
-extern struct address * astoa(char *, struct address *);
-extern double atan(double);
-extern double atan2(double, double);
-extern float atan2f(float, float);
-extern float atanf(float);
-extern double atanh(double);
-extern int atexit(void (*) (void));
-extern double atof(const char *);
-extern int atoi(const char *);
-extern long int atol(const char *);
-extern char * atos(char *, struct netbuf *, int);
-extern void auth_destroy(AUTH *);
-extern AUTH * authdes_create(/* ??? */);
-extern void authdes_getcred(struct authdes_cred *, short *, short *, short *, int *);
-extern AUTH * authdes_seccreate(/* ??? */);
-extern AUTH * authnone_create(void);
-extern AUTH * authsys_create(char *, int, int, int, int *);
-extern AUTH * authsys_create_default(void);
-extern AUTH * authunix_create(char *, int, int, int, int *);
-extern AUTH * authunix_create_default(void);
-extern char * basename(char *);
-extern int baudrate(void);
-extern int bcmp(const void *, const void *, size_t);
-extern void bcopy(const void *, void *, size_t);
-extern int beep(void);
-extern void (* berk_signal(int, void (*) (int, ...))) (int, ...);
-extern char * bgets(char *, size_t, FILE *, char *);
-extern int bottom_panel(PANEL *);
-extern int box32(WINDOW *, chtype, chtype);
-extern int brk(void *);
-extern void * bsearch(const void *, const void *, size_t, size_t, int (*) (const void *, const void *));
-extern size_t bufsplit(char *, size_t, char *);
-extern void bzero(void *, size_t);
-extern long int calchash(/* ??? */);
-extern void * calloc(size_t, size_t);
-extern void callrpc(char *, unsigned long, unsigned long, unsigned long, xdrproc_t, char *, xdrproc_t, char *);
-extern bool can_change_color(void);
-extern int catclose(nl_catd);
-extern char * catgets(nl_catd, int, int, char *);
-extern nl_catd catopen(const char *, int);
-extern int cbreak(void);
-extern double cbrt(double);
-extern double ceil(double);
-extern float ceilf(float);
-extern speed_t cfgetispeed(const struct termios *);
-extern speed_t cfgetospeed(const struct termios *);
-extern void cfree(void *);
-extern int cfsetispeed(struct termios *, speed_t);
-extern int cfsetospeed(struct termios *, speed_t);
-extern int cftime(char *, char *, const time_t *);
-extern int chdir(const char *);
-extern int chmod(const char *, mode_t);
-extern int chown(const char *, uid_t, gid_t);
-extern int chroot(const char *);
-extern void clean_GEN_rd(/* ??? */);
-extern void cleanup(/* ??? */);
-extern void clearerr(FILE *);
-extern int clearok(WINDOW *, int);
-extern enum clnt_stat clnt_broadcast(unsigned long, unsigned long, unsigned long, xdrproc_t, char *, xdrproc_t, char *, resultproc_t);
-extern enum clnt_stat clnt_call(CLIENT *, unsigned long, xdrproc_t, char *, xdrproc_t, char *, struct timeval);
-extern bool_t clnt_control(CLIENT *, int, char *);
-extern CLIENT * clnt_create(char *, unsigned long, unsigned long, char *);
-extern void clnt_destroy(CLIENT *);
-extern int clnt_freeres(CLIENT *, xdrproc_t, char *);
-extern void clnt_geterr(CLIENT *, struct rpc_err *);
-extern void clnt_pcreateerror(char *);
-extern void clnt_perrno(enum clnt_stat);
-extern void clnt_perror(CLIENT *, char *);
-extern char * clnt_spcreateerror(char *);
-extern char * clnt_sperrno(enum clnt_stat);
-extern char * clnt_sperror(CLIENT *, char *);
-extern CLIENT * clnt_tli_create(/* ??? */);
-extern CLIENT * clnt_tp_create(/* ??? */);
-extern CLIENT * clnt_vc_create(/* ??? */);
-extern CLIENT * clntraw_create(unsigned long, unsigned long);
-extern CLIENT * clnttcp_create(struct sockaddr_in *, unsigned long, unsigned long, int *, unsigned int, unsigned int *);
-extern CLIENT * clntudp_bufcreate(struct sockaddr_in *, unsigned long, unsigned long, struct timeval, int *, unsigned int, unsigned int);
-extern CLIENT * clntudp_create(struct sockaddr_in *, unsigned long, unsigned long, struct timeval, int *);
-extern clock_t clock(void);
-extern int close(int);
-extern int closedir(DIR *);
-extern int color_content(int, short int *, short int *, short int *);
-extern char * compile(const char *, char *, char *);
-extern char * copylist(const char *, off_t *);
-extern double copysign(double, double);
-extern int copywin(WINDOW *, WINDOW *, int, int, int, int, int, int, int);
-extern double cos(double);
-extern float cosf(float);
-extern double cosh(double);
-extern float coshf(float);
-extern struct rd_user * cr_rduser(/* ??? */);
-extern int creat(const char *, mode_t);
-extern int crmode(void);
-extern char * crypt(const char *, const char *);
-extern int crypt_close(int *);
-extern char * ctermid(char *);
-extern char * ctime(const time_t *);
-extern FIELD * current_field(FORM *);
-extern ITEM * current_item(MENU *);
-extern int curs_set(int);
-extern void curserr(void);
-extern char * cuserid(char *);
-extern int data_ahead(FORM *);
-extern int data_behind(FORM *);
-extern void dbmclose(void);
-extern void dbminit(const char *);
-extern int def_prog_mode(void);
-extern int def_shell_mode(void);
-extern char * defread(/* ??? */);
-extern int del_panel(PANEL *);
-extern void del_rduser(/* ??? */);
-extern void delay(long int);
-extern int delay_output(int);
-extern void delete(datum);
-extern void delscreen(SCREEN *);
-extern int delterm(TERMINAL *);
-extern int delwin(WINDOW *);
-extern WINDOW * derwin(WINDOW *, int, int, int, int);
-extern char * des_crypt(const char *, const char *);
-extern void des_encrypt(char *, int);
-extern void des_setkey(const char *);
-extern char * devattr(/* ??? */);
-extern int devfree(/* ??? */);
-extern char ** devreserv(/* ??? */);
-extern int dial(CALL);
-extern double difftime(time_t, time_t);
-extern char * dirname(char *);
-extern div_t div(int, int);
-extern int dlclose(void *);
-extern char * dlerror(void);
-extern void * dlopen(char *, int);
-extern void * dlsym(void *, char *);
-extern void dma_access(u_char, u_int, u_int, u_char, u_char);
-extern int doupdate(void);
-extern int drainio(int);
-extern double drand48(void);
-extern double drem(double, double);
-extern int drv_getevtoken(/* ??? */);
-extern void drv_relevtoken(/* ??? */);
-extern int dup(int);
-extern int dup2(int, int);
-extern FIELD * dup_field(FIELD *, int, int);
-extern WINDOW * dupwin(WINDOW *);
-extern int dynamic_field_info(FIELD *, int *, int *, int *);
-extern int dysize(int);
-extern int eaccess(const char *, int);
-extern int echo(void);
-extern char * ecvt(double, int, int *, int *);
-extern size_t elf32_fsize(Elf_Type, size_t, unsigned int);
-extern Elf32_Ehdr * elf32_getehdr(Elf *);
-extern Elf32_Phdr * elf32_getphdr(Elf *);
-extern Elf32_Shdr * elf32_getshdr(Elf_Scn *);
-extern Elf32_Ehdr * elf32_newehdr(Elf *);
-extern Elf32_Phdr * elf32_newphdr(Elf *, size_t);
-extern Elf_Data * elf32_xlatetof(Elf_Data *, const Elf_Data *, unsigned int);
-extern Elf_Data * elf32_xlatetom(Elf_Data *, const Elf_Data *, unsigned int);
-extern Elf * elf_begin(int, Elf_Cmd, Elf *);
-extern int elf_cntl(Elf *, Elf_Cmd);
-extern int elf_end(Elf *);
-extern const char * elf_errmsg(int);
-extern int elf_errno(void);
-extern void elf_fill(int);
-extern unsigned int elf_flagdata(Elf_Data *, Elf_Cmd, unsigned int);
-extern unsigned int elf_flagehdr(Elf *, Elf_Cmd, unsigned int);
-extern unsigned int elf_flagelf(Elf *, Elf_Cmd, unsigned int);
-extern unsigned int elf_flagphdr(Elf *, Elf_Cmd, unsigned int);
-extern unsigned int elf_flagscn(Elf_Scn *, Elf_Cmd, unsigned int);
-extern unsigned int elf_flagshdr(Elf_Scn *, Elf_Cmd, unsigned int);
-extern Elf_Arhdr * elf_getarhdr(Elf *);
-extern Elf_Arsym * elf_getarsym(Elf *, size_t *);
-extern off_t elf_getbase(Elf *);
-extern Elf_Data * elf_getdata(Elf_Scn *, Elf_Data *);
-extern char * elf_getident(Elf *, size_t *);
-extern Elf_Scn * elf_getscn(Elf *, size_t);
-extern long unsigned int elf_hash(const char *);
-extern Elf_Kind elf_kind(Elf *);
-extern size_t elf_ndxscn(Elf_Scn *);
-extern Elf_Data * elf_newdata(Elf_Scn *);
-extern Elf_Scn * elf_newscn(Elf *);
-extern Elf_Cmd elf_next(Elf *);
-extern Elf_Scn * elf_nextscn(Elf *, Elf_Scn *);
-extern size_t elf_rand(Elf *, size_t);
-extern Elf_Data * elf_rawdata(Elf_Scn *, Elf_Data *);
-extern char * elf_rawfile(Elf *, size_t *);
-extern char * elf_strptr(Elf *, size_t, size_t);
-extern off_t elf_update(Elf *, Elf_Cmd);
-extern unsigned int elf_version(unsigned int);
-extern void encrypt(char *, int);
-extern void endgrent(void);
-extern int endnetconfig(void *);
-extern int endnetpath(void *);
-extern void endpwent(void);
-extern void endrpcent(void);
-extern void endspent(void);
-extern void endutent(void);
-extern void endutxent(void);
-extern int endwin(void);
-extern double erand(short *);
-extern double erand48(short unsigned int *);
-extern char erasechar(void);
-extern double erf(double);
-extern double erfc(double);
-extern int execl(const char *, const char *, ...);
-extern int execle(const char *, const char *, ...);
-extern int execlp(const char *, const char *, ...);
-extern int exect(const char *, const char **, char **);
-extern int execv(const char *, char *const *);
-extern int execve(const char *, char *const *, char *const *);
-extern int execvp(const char *, char *const *);
-extern void exit(int);
-extern double exp(double);
-extern float expf(float);
-extern double fabs(double);
-extern float fabsf(float);
-extern int fattach(int, const char *);
-extern int fchdir(int);
-extern int fchmod(int, mode_t);
-extern int fchown(int, uid_t, gid_t);
-extern int fclose(FILE *);
-extern int fcntl(int, int, ...);
-extern char * fcvt(double, int, int *, int *);
-extern int fdetach(const char *);
-extern FILE * fdopen(int, const char *);
-extern int feof(FILE *);
-extern int ferror(FILE *);
-extern datum fetch(datum);
-extern int fflush(FILE *);
-extern int ffs(int);
-extern int fgetc(FILE *);
-extern struct group * fgetgrent(FILE *);
-extern int fgetpos(FILE *, fpos_t *);
-extern struct passwd * fgetpwent(FILE *);
-extern char * fgets(char *, int, FILE *);
-extern struct spwd * fgetspent(FILE *);
-extern char * field_arg(FIELD *);
-extern chtype field_back(FIELD *);
-extern char * field_buffer(FIELD *, int);
-extern int field_count(FORM *);
-extern chtype field_fore(FIELD *);
-extern int field_index(FIELD *);
-extern int field_info(FIELD *, int *, int *, int *, int *, int *, int *);
-extern PTF_void field_init(FORM *);
-extern int field_just(FIELD *);
-extern OPTIONS field_opts(FIELD *);
-extern int field_opts_off(FIELD *, OPTIONS);
-extern int field_opts_on(FIELD *, OPTIONS);
-extern int field_pad(FIELD *);
-extern int field_status(FIELD *);
-extern PTF_void field_term(FORM *);
-extern FIELDTYPE * field_type(FIELD *);
-extern char * field_userptr(FIELD *);
-extern int fileno(FILE *);
-extern int filter(void);
-extern int finite(double);
-extern datum firsthash(/* ??? */);
-extern datum firstkey(void);
-extern int flash(void);
-extern int flock(int, int);
-extern double floor(double);
-extern float floorf(float);
-extern int flushinp(void);
-extern double fmod(double, double);
-extern float fmodf(float, float);
-extern int fmtmsg(long int, const char *, int, const char *, const char *, const char *);
-extern FILE * fopen(const char *, const char *);
-extern pid_t fork(void);
-extern int form_driver(FORM *, int);
-extern FIELD ** form_fields(FORM *);
-extern PTF_void form_init(FORM *);
-extern OPTIONS form_opts(FORM *);
-extern int form_opts_off(FORM *, OPTIONS);
-extern int form_opts_on(FORM *, OPTIONS);
-extern int form_page(FORM *);
-extern WINDOW * form_sub(FORM *);
-extern PTF_void form_term(FORM *);
-extern char * form_userptr(FORM *);
-extern WINDOW * form_win(FORM *);
-extern long int fpathconf(int, int);
-extern fpclass_t fpclass(double);
-extern int fpgetmask(void);
-extern fp_rnd fpgetround(void);
-extern int fpgetsticky(void);
-extern int fprintf(FILE *, const char *, ...);
-extern int fpsetmask(int);
-extern fp_rnd fpsetround(fp_rnd);
-extern int fpsetsticky(int);
-extern int fputc(int, FILE *);
-extern int fputs(const char *, FILE *);
-extern size_t fread(void *, size_t, size_t, FILE *);
-extern void free(void *);
-extern int free_field(FIELD *);
-extern int free_fieldtype(FIELDTYPE *);
-extern int free_form(FORM *);
-extern int free_item(ITEM *);
-extern int free_menu(MENU *);
-extern void freenetconfigent(struct netconfig *);
-extern FILE * freopen(const char *, const char *, FILE *);
-extern double frexp(double, int *);
-extern int fscanf(FILE *, const char *, ...);
-extern int fseek(FILE *, long int, int);
-extern int fsetpos(FILE *, const fpos_t *);
-extern int fstat(int, struct stat *);
-extern int fstatfs(int, struct statfs *, int, int);
-extern int fstatvfs(int, struct statvfs *);
-extern int fsync(int);
-extern long int ftell(FILE *);
-extern key_t ftok(const char *, int);
-extern int ftruncate(int, off_t);
-extern int ftw(const char *, int (*) (const char *, const struct stat *, int), int);
-extern size_t fwrite(const void *, size_t, size_t, FILE *);
-extern double gamma(double);
-extern char * gcvt(double, int, char *);
-extern int get_error(/* ??? */);
-extern chtype getattrs(WINDOW *);
-extern int getbegx(WINDOW *);
-extern int getbegy(WINDOW *);
-extern chtype getbkgd(WINDOW *);
-extern long unsigned int getbmap(void);
-extern int getc(FILE *);
-extern char * getcap(/* ??? */);
-extern int getchar(void);
-extern int getcontext(ucontext_t *);
-extern int getcurx(WINDOW *);
-extern int getcury(WINDOW *);
-extern char * getcwd(char *, size_t);
-extern struct tm * getdate(const char *);
-extern int getdents(int, struct dirent *, unsigned int);
-extern char ** getdev(/* ??? */);
-extern char ** getdgrp(/* ??? */);
-extern int getdomainname(char *, int);
-extern int getdtablesize(void);
-extern gid_t getegid(void);
-extern char * getenv(const char *);
-extern struct errhdr * geterec(/* ??? */);
-extern struct errhdr * geteslot(/* ??? */);
-extern uid_t geteuid(void);
-extern gid_t getgid(void);
-extern struct group * getgrent(void);
-extern struct group * getgrgid(gid_t);
-extern struct group * getgrnam(const char *);
-extern int getgroups(int, gid_t *);
-extern struct hostent * gethostbyaddr(/* ??? */);
-extern struct hostent * gethostbyname(/* ??? */);
-extern struct hostent * gethostent(/* ??? */);
-#ifdef __alpha__
-extern int gethostid(void);
-#else
-extern long gethostid(void);
-#endif
-extern int gethostname(char *, size_t);
-extern int getitimer(int, struct itimerval *);
-extern char * getlogin(void);
-extern int getmaxx(WINDOW *);
-extern int getmaxy(WINDOW *);
-extern int getmntany(FILE *, struct mnttab *, struct mnttab *);
-extern int getmntent(/* ??? */);
-extern long unsigned int getmouse(void);
-extern int getmsg(int, struct strbuf *, struct strbuf *, int *);
-extern struct netent * getnetbyaddr(/* ??? */);
-extern struct netent * getnetbyname(/* ??? */);
-extern struct netconfig * getnetconfig(void *);
-extern struct netconfig * getnetconfigent(char *);
-extern struct netent * getnetent(/* ??? */);
-extern struct netconfig * getnetpath(void *);
-extern int getopt(int, char *const *, const char *);
-extern int getpagesize(void);
-extern int getparx(WINDOW *);
-extern int getpary(WINDOW *);
-extern char * getpass(const char *);
-extern pid_t getpgid(pid_t);
-extern pid_t getpgrp(void);
-extern pid_t getpgrp2(pid_t);
-extern pid_t getpid(void);
-extern int getpmsg(int, struct strbuf *, struct strbuf *, int *, int *);
-extern pid_t getppid(void);
-extern int getpriority(int, int);
-extern struct protoent * getprotobyname(/* ??? */);
-extern struct protoent * getprotobynumber(/* ??? */);
-extern struct protoent * getprotoent(/* ??? */);
-extern int getpw(int, char *);
-extern struct passwd * getpwent(void);
-extern struct passwd * getpwnam(const char *);
-extern struct passwd * getpwuid(uid_t);
-extern int getrlimit(int, struct rlimit *);
-extern int getrnge(char *);
-extern struct rpcent * getrpcbyname(const char *);
-extern struct rpcent * getrpcbynumber(int);
-extern struct rpcent * getrpcent(void);
-extern int getrusage(int, struct rusage *);
-extern char * gets(char *);
-extern struct servent * getservbyname(/* ??? */);
-extern struct servent * getservbyport(/* ??? */);
-extern struct servent * getservent(/* ??? */);
-extern pid_t getsid(pid_t);
-extern struct spwd * getspent(void);
-extern struct spwd * getspnam(const char *);
-extern int getsubopt(char **, char *const *, char **);
-extern int gettmode(void);
-extern char * gettxt(const char *, const char *);
-extern uid_t getuid(void);
-extern struct utmp * getutent(void);
-extern struct utmp * getutid(const struct utmp *);
-extern struct utmp * getutline(const struct utmp *);
-extern void getutmp(const struct utmpx *, struct utmp *);
-extern void getutmpx(const struct utmp *, struct utmpx *);
-extern struct utmpx * getutxent(void);
-extern struct utmpx * getutxid(const struct utmpx *);
-extern struct utmpx * getutxline(const struct utmpx *);
-extern int getvfsany(FILE *, struct vfstab *, struct vfstab *);
-extern int getvfsent(FILE *, struct vfstab *);
-extern int getvfsfile(FILE *, struct vfstab *, char *);
-extern int getvfsspec(FILE *, struct vfstab *, char *);
-extern int getvol(/* ??? */);
-extern int getw(FILE *);
-extern char * getwd(char *);
-extern void getwidth(eucwidth_t *);
-extern WINDOW * getwin(FILE *);
-extern int gmatch(const char *, const char *);
-extern struct tm * gmtime(const time_t *);
-extern int gsignal(int);
-extern int halfdelay(int);
-extern bool has_colors(void);
-extern int has_ic(void);
-extern int has_il(void);
-extern long int hashinc(/* ??? */);
-extern char * hasmntopt(/* ??? */);
-extern int hcreate(size_t);
-extern void hdestroy(void);
-extern int hide_panel(PANEL *);
-extern int host2netname(char *, char *, char *);
-extern int hrtalarm(hrtcmd_t *, int);
-extern int hrtcancel(const long int *, int);
-extern int hrtcntl(int, int, interval_t *, hrtime_t *);
-extern int hrtsleep(hrtcmd_t *);
-extern ENTRY * hsearch(ENTRY, ACTION);
-extern long unsigned int htonl(long unsigned int);
-extern short unsigned int htons(unsigned int);
-extern double hypot(double, double);
-extern void idcok(WINDOW *, int);
-extern int idlok(WINDOW *, int);
-extern void immedok(WINDOW *, int);
-extern char * index(const char *, int);
-extern long unsigned int inet_addr(/* ??? */);
-extern struct in_addr inet_makeaddr(/* ??? */);
-extern long unsigned int inet_network(/* ??? */);
-extern char * inet_ntoa(/* ??? */);
-extern int init_color(int, int, int, int);
-extern int init_pair(int, int, int);
-extern int initgroups(const char *, gid_t);
-extern WINDOW * initscr(/* ??? */);
-extern WINDOW * initscr32(void);
-extern char * initstate(unsigned, char *, int);
-extern void insque(struct qelem *, struct qelem *);
-extern int intrflush(WINDOW *, int);
-extern int ioctl(int, int, ...);
-extern int is_linetouched(WINDOW *, int);
-extern int is_wintouched(WINDOW *);
-extern int isalnum(int);
-extern int isalpha(int);
-extern int isascii(int);
-extern int isatty(int);
-extern int iscntrl(int);
-extern int isdigit(int);
-extern int isencrypt(const char *, size_t);
-extern int isendwin(void);
-extern int isgraph(int);
-extern int isinf(double);
-extern int islower(int);
-extern int isnan(double);
-extern int isnand(double);
-extern int isnanf(float);
-extern int isprint(int);
-extern int ispunct(int);
-extern int isspace(int);
-extern int isupper(int);
-extern int isxdigit(int);
-extern int item_count(MENU *);
-extern char * item_description(ITEM *);
-extern int item_index(ITEM *);
-extern PTF_void item_init(MENU *);
-extern char * item_name(ITEM *);
-extern OPTIONS item_opts(ITEM *);
-extern int item_opts_off(ITEM *, OPTIONS);
-extern int item_opts_on(ITEM *, OPTIONS);
-extern PTF_void item_term(MENU *);
-extern char * item_userptr(ITEM *);
-extern int item_value(ITEM *);
-extern int item_visible(ITEM *);
-extern long int itol(/* ??? */);
-extern double j0(double);
-extern double j1(double);
-extern double jn(int, double);
-extern long int jrand48(short unsigned int *);
-extern char * keyname(int);
-extern int keypad(WINDOW *, int);
-extern int kill(pid_t, int);
-extern char killchar(void);
-extern int killpg(int, int);
-extern void l3tol(long int *, const char *, int);
-extern char * l64a(long int);
-extern long int labs(long int);
-extern dl_t ladd(/* ??? */);
-extern int lchown(const char *, uid_t, gid_t);
-extern int lckpwdf(void);
-extern void lcong48(short unsigned int *);
-extern int ldaclose(struct ldfile *);
-extern int ldahread(struct ldfile *, archdr *);
-extern struct ldfile * ldaopen(const char *, struct ldfile *);
-extern int ldclose(struct ldfile *);
-extern double ldexp(double, int);
-extern int ldfhread(struct ldfile *, struct filehdr *);
-extern char * ldgetname(struct ldfile *, const struct syment *);
-extern ldiv_t ldiv(long int, long int);
-extern dl_t ldivide(/* ??? */);
-extern int ldlinit(struct ldfile *, long int);
-extern int ldlitem(struct ldfile *, unsigned int, struct lineno *);
-extern int ldlread(struct ldfile *, long int, unsigned int, struct lineno *);
-extern int ldlseek(struct ldfile *, unsigned int);
-extern int ldnlseek(struct ldfile *, const char *);
-extern int ldnrseek(struct ldfile *, const char *);
-extern int ldnshread(struct ldfile *, const char *, struct scnhdr *);
-extern int ldnsseek(struct ldfile *, const char *);
-extern int ldohseek(struct ldfile *);
-extern struct ldfile * ldopen(const char *, struct ldfile *);
-extern int ldrseek(struct ldfile *, unsigned int);
-extern int ldshread(struct ldfile *, unsigned int, struct scnhdr *);
-extern int ldsseek(struct ldfile *, unsigned int);
-extern long int ldtbindex(struct ldfile *);
-extern int ldtbread(struct ldfile *, long int, struct syment *);
-extern int ldtbseek(struct ldfile *);
-extern int leaveok(WINDOW *, int);
-extern dl_t lexp10(/* ??? */);
-extern void * lfind(const void *, const void *, size_t *, size_t, int (*) (const void *, const void *));
-extern double lgamma(double);
-extern int link(const char *, const char *);
-extern FIELD * link_field(FIELD *, int, int);
-extern FIELDTYPE * link_fieldtype(FIELDTYPE *, FIELDTYPE *);
-extern char ** listdev(/* ??? */);
-extern char ** listdgrp(/* ??? */);
-extern dl_t llog10(/* ??? */);
-extern dl_t lmul(/* ??? */);
-extern struct lconv * localeconv(void);
-extern struct tm * localtime(const time_t *);
-extern int lock(int, int, long);
-extern int lockf(int, int, off_t);
-extern double log(double);
-extern double log10(double);
-extern float log10f(float);
-extern double logb(double);
-extern float logf(float);
-extern char * logname(void);
-extern void longjmp(jmp_buf, int);
-extern char * longname(void);
-extern long int lrand48(void);
-extern void * lsearch(const void *, void *, size_t *, size_t, int (*) (const void *, const void *));
-extern off_t lseek(int, off_t, int);
-extern dl_t lshiftl(/* ??? */);
-extern int lstat(const char *, struct stat *);
-extern dl_t lsub(/* ??? */);
-extern void ltol3(char *, const long int *, int);
-extern int m_addch(int);
-extern int m_addstr(char *);
-extern int m_clear(void);
-extern int m_erase(void);
-extern WINDOW * m_initscr(void);
-extern int m_move(int, int);
-extern SCREEN * m_newterm(char *, FILE *, FILE *);
-extern int m_refresh(void);
-extern int maillock(char *, int);
-extern int mailunlock(void);
-extern major_t major(dev_t);
-extern datum makdatum(/* ??? */);
-extern void makecontext(ucontext_t *, void (*) (/* ??? */), int, ...);
-extern dev_t makedev(major_t, minor_t);
-extern struct utmpx * makeutx(const struct utmpx *);
-extern struct mallinfo mallinfo(void);
-extern void * malloc(size_t);
-extern int mallopt(int, int);
-extern int map_button(long unsigned int);
-extern int matherr(struct exception *);
-extern int mbftowc(char *, wchar_t *, int (*) (/* ??? */), int *);
-extern int mblen(const char *, size_t);
-extern size_t mbstowcs(wchar_t *, const char *, size_t);
-extern int mbtowc(wchar_t *, const char *, size_t);
-extern void * memalign(size_t, size_t);
-extern void * memccpy(void *, const void *, int, size_t);
-extern void * memchr(const void *, int, size_t);
-extern int memcmp(const void *, const void *, size_t);
-extern void * memcpy(void *, const void *, size_t);
-extern int memlock(/* ??? */);
-extern int memlocked(/* ??? */);
-extern void * memmove(void *, const void *, size_t);
-extern void * memset(void *, int, size_t);
-extern int memunlock(/* ??? */);
-extern chtype menu_back(MENU *);
-extern int menu_driver(MENU *, int);
-extern chtype menu_fore(MENU *);
-extern void menu_format(MENU *, int *, int *);
-extern chtype menu_grey(MENU *);
-extern PTF_void menu_init(MENU *);
-extern ITEM ** menu_items(MENU *);
-extern char * menu_mark(MENU *);
-extern OPTIONS menu_opts(MENU *);
-extern int menu_opts_off(MENU *, OPTIONS);
-extern int menu_opts_on(MENU *, OPTIONS);
-extern int menu_pad(MENU *);
-extern char * menu_pattern(MENU *);
-extern WINDOW * menu_sub(MENU *);
-extern PTF_void menu_term(MENU *);
-extern char * menu_userptr(MENU *);
-extern WINDOW * menu_win(MENU *);
-extern int meta(WINDOW *, int);
-extern void mfree(struct map *, size_t, u_long);
-extern int mincore(caddr_t, size_t, char *);
-extern minor_t minor(dev_t);
-extern int mkdir(const char *, mode_t);
-extern int mkdirp(const char *, mode_t);
-extern int mkfifo(const char *, mode_t);
-extern int mknod(const char *, mode_t, dev_t);
-extern int mkstemp(char *);
-extern char * mktemp(char *);
-extern time_t mktime(struct tm *);
-extern caddr_t mmap(/* ??? */);
-extern double modf(double, double *);
-extern float modff(float, float *);
-extern struct utmpx * modutx(const struct utmpx *);
-extern void monitor(int (*) (/* ??? */), int (*) (/* ??? */), WORD *, int, int);
-extern int mount(const char *, const char *, int, ...);
-extern int mouse_off(long int);
-extern int mouse_on(long int);
-extern int mouse_set(long int);
-extern int move_field(FIELD *, int, int);
-extern int move_panel(PANEL *, int, int);
-extern int mprotect(/* ??? */);
-extern long int mrand48(void);
-extern int msgctl(int, int, ...);
-extern int msgget(key_t, int);
-extern int msgrcv(int, void *, size_t, long int, int);
-extern int msgsnd(int, const void *, size_t, int);
-extern int munmap(/* ??? */);
-extern int mvcur(int, int, int, int);
-extern int mvderwin(WINDOW *, int, int);
-extern int mvprintw(int, int, ...);
-extern int mvscanw(int, int, ...);
-extern int mvwin(WINDOW *, int, int);
-extern int mvwprintw(WINDOW *, int, int, ...);
-extern int mvwscanw(WINDOW *, int, int, ...);
-extern int napms(int);
-extern void netdir_free(char *, int);
-extern int netdir_getbyaddr(struct netconfig *, struct nd_hostservlist **, struct netbuf *);
-extern int netdir_getbyname(struct netconfig *, struct nd_hostserv *, struct nd_addrlist **);
-extern int netdir_options(struct netconfig *, int, int, char *);
-extern void netdir_perror(char *);
-extern char * netdir_sperror(/* ??? */);
-extern FIELD * new_field(int, int, int, int, int, int);
-extern FIELDTYPE * new_fieldtype(PTF_int, PTF_int);
-extern FORM * new_form(FIELD **);
-extern ITEM * new_item(char *, char *);
-extern MENU * new_menu(ITEM **);
-extern int new_page(FIELD *);
-extern PANEL * new_panel(WINDOW *);
-extern int newkey(char *, int, int);
-extern WINDOW * newpad(int, int);
-extern SCREEN * newscreen(char *, int, int, int, FILE *, FILE *);
-extern SCREEN * newterm32(char *, FILE *, FILE *);
-extern WINDOW * newwin(int, int, int, int);
-extern double nextafter(double, double);
-extern datum nextkey(datum);
-extern int nftw(const char *, int (*) (const char *, const struct stat *, int, struct FTW *), int, int);
-extern int nice(int);
-extern int nl(void);
-extern char * nl_langinfo(nl_item);
-extern int nlist(const char *, struct nlist *);
-extern int nocbreak(void);
-extern int nocrmode(void);
-extern int nodelay(WINDOW *, int);
-extern int noecho(void);
-extern int nonl(void);
-extern int noraw(void);
-extern int notimeout(WINDOW *, int);
-extern long int nrand48(short unsigned int *);
-extern int ns_close(/* ??? */);
-extern struct nssend * ns_rcv(/* ??? */);
-extern int ns_send(/* ??? */);
-extern int ns_setup(/* ??? */);
-extern long unsigned int ntohl(long unsigned int);
-extern short unsigned int ntohs(unsigned int);
-extern int nuname(struct utsname *);
-extern int open(const char *, int, ...);
-extern DIR * opendir(const char *);
-extern int openprivwait(/* ??? */);
-extern int openwait(/* ??? */);
-extern int overlay(WINDOW *, WINDOW *);
-extern int overwrite(WINDOW *, WINDOW *);
-extern int p2close(FILE **);
-extern int p2open(const char *, FILE **);
-extern int p32echochar(WINDOW *, chtype);
-extern char * p_cdname(/* ??? */);
-extern char * p_class(/* ??? */);
-extern char * p_rr(/* ??? */);
-extern char * p_type(/* ??? */);
-extern int pair_content(int, short int *, short int *);
-extern PANEL * panel_above(PANEL *);
-extern PANEL * panel_below(PANEL *);
-extern char * panel_userptr(PANEL *);
-extern WINDOW * panel_window(PANEL *);
-extern long int pathconf(const char *, int);
-extern char * pathfind(const char *, const char *, const char *);
-extern int pause(void);
-extern int pclose(FILE *);
-extern void perror(const char *);
-extern struct pfdat * pfind(/* ??? */);
-extern int pglstlk(/* ??? */);
-extern int pglstunlk(/* ??? */);
-extern int pid_slot(proc_t *);
-extern int pipe(int *);
-extern int plock(int);
-extern struct pmaplist * pmap_getmaps(/* ??? */);
-extern u_short pmap_getport(/* ??? */);
-extern enum clnt_stat pmap_rmtcall(/* ??? */);
-extern int pmap_set(/* ??? */);
-extern int pmap_unset(/* ??? */);
-extern int pnoutrefresh(WINDOW *, int, int, int, int, int, int);
-extern int poll(struct pollfd *, long unsigned int, int);
-extern FILE * popen(const char *, const char *);
-extern int pos_form_cursor(FORM *);
-extern int pos_menu_cursor(MENU *);
-extern int post_form(FORM *);
-extern int post_menu(MENU *);
-extern double pow(double, double);
-extern float powf(float, float);
-extern int prefresh(WINDOW *, int, int, int, int, int, int);
-extern int printf(const char *, ...);
-extern int printw(char *, ...);
-extern void privsig(/* ??? */);
-extern void profil(short unsigned int *, size_t, int, unsigned int);
-extern void psiginfo(siginfo_t *, char *);
-extern void psignal(int, const char *);
-extern int ptrace(int, pid_t, int, int);
-extern int putc(int, FILE *);
-extern int putchar(int);
-extern int putenv(char *);
-extern int putmsg(int, const struct strbuf *, const struct strbuf *, int);
-extern int putp(char *);
-extern int putpmsg(int, const struct strbuf *, const struct strbuf *, int, int);
-extern int putpwent(const struct passwd *, FILE *);
-extern int puts(const char *);
-extern int putspent(const struct spwd *, FILE *);
-extern struct utmp * pututline(const struct utmp *);
-extern struct utmpx * pututxline(const struct utmpx *);
-extern int putw(int, FILE *);
-extern int putwin(WINDOW *, FILE *);
-extern void qsort(void *, size_t, size_t, int (*) (const void *, const void *));
-extern int raise(int);
-extern int rand(void);
-extern long random(void);
-extern int raw(void);
-extern ssize_t read(int, void *, size_t);
-extern struct dirent * readdir(DIR *);
-extern ssize_t readlink(const char *, char *, size_t);
-extern void * realloc(void *, size_t);
-extern char * realpath(char *, char *);
-extern int redrawwin(WINDOW *);
-extern char * regcmp(const char *, ...);
-extern char * regex(const char *, const char *, ...);
-extern double remainder(double, double);
-extern int remio(/* ??? */);
-extern int remove(const char *);
-extern void remque(struct qelem *);
-extern int rename(const char *, const char *);
-extern int replace_panel(PANEL *, WINDOW *);
-extern int request_mouse_pos(void);
-extern struct reservdev ** reservdev(/* ??? */);
-extern int reset_prog_mode(void);
-extern int reset_shell_mode(void);
-extern int resetty(void);
-extern int restartterm(char *, int, int *);
-extern void rewind(FILE *);
-extern void rewinddir(DIR *);
-extern int rf_falloc(/* ??? */);
-extern char * rindex(const char *, int);
-extern double rint(double);
-extern int ripoffline(int, int (*) (WINDOW *, int));
-extern int rmdir(const char *);
-extern int rmdirp(char *, char *);
-extern enum clnt_stat rpc_broadcast(/* ??? */);
-extern enum clnt_stat rpc_call(/* ??? */);
-extern int rpcb_getaddr(/* ??? */);
-extern RPCBLIST * rpcb_getmaps(/* ??? */);
-extern int rpcb_gettime(/* ??? */);
-extern enum clnt_stat rpcb_rmtcall(/* ??? */);
-extern int rpcb_set(/* ??? */);
-extern char * rpcb_taddr2uaddr(/* ??? */);
-extern struct netbuf * rpcb_uaddr2taddr(/* ??? */);
-extern int rpcb_unset(/* ??? */);
-extern void rpctest_service(/* ??? */);
-extern int run_crypt(long int, char *, unsigned int, int *);
-extern int run_setkey(int *, const char *);
-extern int savetty(void);
-extern void * sbrk(int);
-extern double scalb(double, double);
-extern int scale_form(FORM *, int *, int *);
-extern int scale_menu(MENU *, int *, int *);
-extern int scanf(const char *, ...);
-extern int scanw(char *, ...);
-extern int scr_dump(char *);
-extern int scr_init(char *);
-extern int scr_restore(char *);
-extern int scroll(WINDOW *);
-extern int scrollok(WINDOW *, int);
-extern int scrwidth(wchar_t);
-extern int sdfree(char *);
-extern char * sdget(char *, int, ...);
-extern short unsigned int * seed48(short unsigned int *);
-extern void seekdir(DIR *, long int);
-extern int semctl(int, int, int, ...);
-extern int semget(key_t, int, int);
-extern int semop(int, struct sembuf *, unsigned int);
-extern int send(int, char *, int, int);
-extern int set_current_field(FORM *, FIELD *);
-extern int set_current_item(MENU *, ITEM *);
-extern int set_field_back(FIELD *, chtype);
-extern int set_field_buffer(FIELD *, int, char *);
-extern int set_field_fore(FIELD *, chtype);
-extern int set_field_init(FORM *, PTF_void);
-extern int set_field_just(FIELD *, int);
-extern int set_field_opts(FIELD *, OPTIONS);
-extern int set_field_pad(FIELD *, int);
-extern int set_field_status(FIELD *, int);
-extern int set_field_term(FORM *, PTF_void);
-extern int set_field_type(FIELD *, FIELDTYPE *, ...);
-extern int set_field_userptr(FIELD *, char *);
-extern int set_fieldtype_arg(FIELDTYPE *, PTF_charP, PTF_charP, PTF_void);
-extern int set_fieldtype_choice(FIELDTYPE *, PTF_int, PTF_int);
-extern int set_form_fields(FORM *, FIELD **);
-extern int set_form_init(FORM *, PTF_void);
-extern int set_form_opts(FORM *, OPTIONS);
-extern int set_form_page(FORM *, int);
-extern int set_form_sub(FORM *, WINDOW *);
-extern int set_form_term(FORM *, PTF_void);
-extern int set_form_userptr(FORM *, char *);
-extern int set_form_win(FORM *, WINDOW *);
-extern int set_item_init(MENU *, PTF_void);
-extern int set_item_opts(ITEM *, OPTIONS);
-extern int set_item_term(MENU *, PTF_void);
-extern int set_item_userptr(ITEM *, char *);
-extern int set_item_value(ITEM *, int);
-extern int set_max_field(FIELD *, int);
-extern int set_menu_back(MENU *, chtype);
-extern int set_menu_fore(MENU *, chtype);
-extern int set_menu_format(MENU *, int, int);
-extern int set_menu_grey(MENU *, chtype);
-extern int set_menu_init(MENU *, PTF_void);
-extern int set_menu_items(MENU *, ITEM **);
-extern int set_menu_mark(MENU *, char *);
-extern int set_menu_opts(MENU *, OPTIONS);
-extern int set_menu_pad(MENU *, int);
-extern int set_menu_pattern(MENU *, char *);
-extern int set_menu_sub(MENU *, WINDOW *);
-extern int set_menu_term(MENU *, PTF_void);
-extern int set_menu_userptr(MENU *, char *);
-extern int set_menu_win(MENU *, WINDOW *);
-extern int set_new_page(FIELD *, int);
-extern int set_panel_userptr(PANEL *, char *);
-extern int set_top_row(MENU *, int);
-extern void setbuf(FILE *, char *);
-extern int setcontext(ucontext_t *);
-extern SCREEN * setcurscreen(SCREEN *);
-extern TERMINAL * setcurterm(TERMINAL *);
-extern FILE * setexportent(void);
-extern int setgid(gid_t);
-extern void setgrent(void);
-extern int setgroups(int, const gid_t *);
-extern int sethostname(char *, int);
-extern int setitimer(int, struct itimerval *, struct itimerval *);
-extern int setjmp(jmp_buf);
-extern void setkey(const char *);
-extern char * setlocale(int, const char *);
-extern FILE * setmntent(char *, char *);
-extern void * setnetconfig(void);
-extern void * setnetpath(void);
-extern int setpgid(pid_t, pid_t);
-extern pid_t setpgrp(void);
-extern int setpgrp2(pid_t, pid_t);
-extern int setpriority(int, int, int);
-extern int setprivwait(/* ??? */);
-extern void setpwent(void);
-extern int setregid(gid_t, gid_t);
-extern int setreuid(uid_t, uid_t);
-extern int setrlimit(int, struct rlimit *);
-extern int setrpcent(int);
-extern pid_t setsid(void);
-extern void setspent(void);
-extern char * setstate(char *);
-extern int setsyx(int, int);
-extern int setterm(char *);
-extern int setuid(uid_t);
-extern int setupterm(char *, int, int *);
-extern void setutent(void);
-extern void setutxent(void);
-extern int setvbuf(FILE *, char *, int, size_t);
-extern long int sgetl(const char *);
-extern void * shmat(int, void *, int);
-extern int shmctl(int, int, ...);
-extern int shmdt(void *);
-extern int shmget(key_t, int, int);
-extern int show_panel(PANEL *);
-extern int sigaction(int, const struct sigaction *, struct sigaction *);
-extern int sigaddset(sigset_t *, int);
-extern int sigaltstack(const stack_t *, stack_t *);
-extern int sigblock(int);
-extern int sigdelset(sigset_t *, int);
-extern int sigemptyset(sigset_t *);
-extern int sigfillset(sigset_t *);
-extern int sighold(int);
-extern int sigignore(int);
-extern int siginterrupt(int, int);
-extern int sigismember(const sigset_t *, int);
-extern void siglongjmp(sigjmp_buf, int);
-extern signal_ret_t (* signal(int, signal_ret_t (*) (int))) (int);
-extern int sigpause(int);
-extern int sigpending(sigset_t *);
-extern int sigprocmask(int, const sigset_t *, sigset_t *);
-extern int sigrelse(int);
-extern int sigsend(idtype_t, id_t, int);
-extern int sigsendset(const procset_t *, int);
-extern void (* sigset(int, void (*) (int))) (int);
-extern int sigsetjmp(sigjmp_buf, int);
-extern int sigsetmask(int);
-extern int sigsuspend(sigset_t *);
-extern double sin(double);
-extern float sinf(float);
-extern double sinh(double);
-extern float sinhf(float);
-extern unsigned int sleep(unsigned int);
-extern int slk_attroff(chtype);
-extern int slk_attron(chtype);
-extern int slk_attrset(chtype);
-extern int slk_clear(void);
-extern int slk_init(int);
-extern char * slk_label(int);
-extern int slk_noutrefresh(void);
-extern int slk_refresh(void);
-extern int slk_restore(void);
-extern int slk_set(int, char *, int);
-extern int slk_start(int, int *);
-extern int slk_touch(void);
-extern int socket (int, int, int);
-extern void * sprayproc_clear_1(/* ??? */);
-extern spraycumul * sprayproc_get_1(/* ??? */);
-extern void * sprayproc_spray_1(/* ??? */);
-extern int sprintf(char *, const char *, ...);
-extern void sputl(long int, char *);
-extern double sqrt(double);
-extern float sqrtf(float);
-extern void srand(unsigned int);
-extern void srand48(long int);
-extern void srandom(int);
-extern int sscanf(const char *, const char *, ...);
-extern int (* ssignal(int, int (*) (int))) (int);
-extern int start_color(void);
-extern int stat(const char *, struct stat *);
-extern int statfs(const char *, struct statfs *, int, int);
-extern int statvfs(const char *, struct statvfs *);
-extern int step(const char *, const char *);
-extern int stime(const time_t *);
-extern struct netbuf * stoa(char *, struct netbuf *);
-extern void store(datum, datum);
-extern char * strcadd(char *, const char *);
-extern int strcasecmp(const char *, const char *);
-extern char * strcat(char *, const char *);
-extern char * strccpy(char *, const char *);
-extern char * strchr(const char *, int);
-extern void strclearctty(/* ??? */);
-extern void strclearpg(/* ??? */);
-extern void strclearsid(/* ??? */);
-extern int strcmp(const char *, const char *);
-extern int strcoll(const char *, const char *);
-extern char * strcpy(char *, const char *);
-extern size_t strcspn(const char *, const char *);
-extern char * strdup(const char *);
-extern char * streadd(char *, const char *, const char *);
-extern char * strecpy(char *, const char *, const char *);
-extern char * strerror(int);
-extern int strfind(const char *, const char *);
-extern size_t strftime(char *, size_t, const char *, const struct tm *);
-extern size_t strlen(const char *);
-extern int strncasecmp(const char *, const char *, size_t);
-extern char * strncat(char *, const char *, size_t);
-extern int strncmp(const char *, const char *, size_t);
-extern char * strncpy(char *, const char *, size_t);
-extern char * strpbrk(const char *, const char *);
-extern char * strrchr(const char *, int);
-extern char * strrspn(const char *, const char *);
-extern size_t strspn(const char *, const char *);
-extern char * strstr(const char *, const char *);
-extern double strtod(const char *, char **);
-extern char * strtok(char *, const char *);
-extern long int strtol(const char *, char **, int);
-extern long unsigned int strtoul(const char *, char **, int);
-extern char * strtrns(const char *, const char *, const char *, char *);
-extern size_t strxfrm(char *, const char *, size_t);
-extern WINDOW * subpad(WINDOW *, int, int, int, int);
-extern WINDOW * subwin(WINDOW *, int, int, int, int);
-extern int svc_create(/* ??? */);
-extern SVCXPRT * svc_fd_create(/* ??? */);
-extern void svc_getreqset(/* ??? */);
-extern SVCXPRT * svc_raw_create(/* ??? */);
-extern int svc_reg(/* ??? */);
-extern SVCXPRT * svc_tli_create(/* ??? */);
-extern SVCXPRT * svc_tp_create(/* ??? */);
-extern void svc_unreg(/* ??? */);
-extern SVCXPRT * svc_vc_create(/* ??? */);
-extern void svcerr_systemerr(/* ??? */);
-extern SVCXPRT * svcfd_create(/* ??? */);
-extern SVCXPRT * svcraw_create(/* ??? */);
-extern SVCXPRT * svctcp_create(/* ??? */);
-extern SVCXPRT * svcudp_bufcreate(/* ??? */);
-extern SVCXPRT * svcudp_create(/* ??? */);
-extern void swab(const char *, char *, int);
-extern int swapcontext(ucontext_t *, ucontext_t *);
-extern int symlink(const char *, const char *);
-extern void sync(void);
-extern int syncok(WINDOW *, int);
-extern int syscall(int, ...);
-extern long int sysconf(int);
-extern int sysfs(int, ...);
-extern int sysinfo(int, char *, long int);
-extern int system(const char *);
-extern char * taddr2uaddr(struct netconfig *, struct netbuf *);
-extern double tan(double);
-extern float tanf(float);
-extern double tanh(double);
-extern float tanhf(float);
-extern int tcdrain(int);
-extern int tcflow(int, int);
-extern int tcflush(int, int);
-extern int tcgetattr(int, struct termios *);
-extern pid_t tcgetpgrp(int);
-extern pid_t tcgetsid(int);
-extern int tcsendbreak(int, int);
-extern int tcsetattr(int, int, const struct termios *);
-extern int tcsetpgrp(int, pid_t);
-extern void * tdelete(const void *, void **, int (*) (const void *, const void *));
-extern long int telldir(DIR *);
-extern char * tempnam(const char *, const char *);
-extern chtype termattrs(void);
-extern void termerr(void);
-extern char * termname(void);
-extern void * tfind(const void *, void *const *, int (*) (const void *, const void *));
-extern int tgetent(char *, char *);
-extern int tgetflag(char *);
-extern int tgetnum(char *);
-extern char * tgetstr(char *, char **);
-extern char * tgoto(char *, int, int);
-extern char * tigetstr(char *);
-extern time_t time(time_t *);
-extern clock_t times(struct tms *);
-extern char * timezone(int, int);
-extern void tinputfd(int);
-extern FILE * tmpfile(void);
-extern char * tmpnam(char *);
-extern int toascii(int);
-extern int tolower(int);
-extern int top_panel(PANEL *);
-extern int top_row(MENU *);
-extern int touchline(WINDOW *, int, int);
-extern int touchwin(WINDOW *);
-extern int toupper(int);
-extern char * tparm(/* ??? */);
-extern int tputs(char *, int, int (*) (char));
-extern int traceoff(void);
-extern int traceon(void);
-extern int truncate(const char *, off_t);
-extern void * tsearch(const void *, void **, int (*) (const void *, const void *));
-extern char * ttyname(int);
-extern int ttyslot(void);
-extern void twalk(void *, void (*) (void *, VISIT, int));
-extern int typeahead(int);
-extern void tzset(void);
-extern struct netbuf * uaddr2taddr(struct netconfig *, char *);
-extern int uadmin(int, int, int);
-extern unsigned ualarm(unsigned, unsigned);
-extern int ulckpwdf(void);
-extern long int ulimit(int, ...);
-extern mode_t umask(mode_t);
-extern int umount(const char *);
-extern int uname(struct utsname *);
-extern char * unctrl(int);
-extern void undial(int);
-extern int ungetc(int, FILE *);
-extern int ungetch(int);
-extern int unlink(const char *);
-extern int unordered(double, double);
-extern int unpost_form(FORM *);
-extern int unpost_menu(MENU *);
-extern int unremio(/* ??? */);
-extern int untouchwin(WINDOW *);
-extern void update_panels(void);
-extern void updwtmp(const char *, struct utmp *);
-extern void updwtmpx(const char *, struct utmpx *);
-extern void use_env(int);
-extern unsigned usleep(unsigned);
-extern int ustat(dev_t, struct ustat *);
-extern int utime(const char *, const struct utimbuf *);
-extern int utmpname(const char *);
-extern int utmpxname(const char *);
-extern void va_end(__gnuc_va_list);
-extern int vadvise(int);
-extern void * valloc(size_t);
-extern pid_t vfork(void);
-extern int vfprintf(FILE *, const char *, __gnuc_va_list);
-extern int vhangup(void);
-extern int vid32attr(chtype);
-extern int vid32puts(chtype, int (*) (char));
-extern void vidupdate(chtype, chtype, int (*) (char));
-extern int vn_close(/* ??? */);
-extern int vprintf(const char *, __gnuc_va_list);
-extern int vsprintf(char *, const char *, __gnuc_va_list);
-extern int vwprintw(WINDOW *, char *, void *);
-extern int vwscanw(WINDOW *, char *, void *);
-extern int w32addch(WINDOW *, chtype);
-extern int w32attroff(WINDOW *, chtype);
-extern int w32attron(WINDOW *, chtype);
-extern int w32attrset(WINDOW *, chtype);
-extern int w32echochar(WINDOW *, chtype);
-extern int w32insch(WINDOW *, chtype);
-extern int waddchnstr(WINDOW *, chtype *, int);
-extern int waddnstr(WINDOW *, char *, int);
-extern int waddstr(WINDOW *, char *);
-extern pid_t wait(wait_arg_t *);
-extern pid_t wait3(union wait *, int, struct rusage *);
-extern int waitid(idtype_t, id_t, siginfo_t *, int);
-extern pid_t waitpid(pid_t, int *, int);
-extern void * wallproc_wall_1(/* ??? */);
-extern int wbkgd(WINDOW *, chtype);
-extern void wbkgdset(WINDOW *, chtype);
-extern int wborder(WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype);
-extern int wclear(WINDOW *);
-extern int wclrtobot(WINDOW *);
-extern int wclrtoeol(WINDOW *);
-extern size_t wcstombs(char *, const wchar_t *, size_t);
-extern int wctomb(char *, wchar_t);
-extern void wcursyncup(WINDOW *);
-extern int wdelch(WINDOW *);
-extern int wdeleteln(WINDOW *);
-extern int werase(WINDOW *);
-extern int wgetch(WINDOW *);
-extern int wgetnstr(WINDOW *, char *, int);
-extern int wgetstr(WINDOW *, char *);
-extern int whline(WINDOW *, chtype, int);
-extern chtype winch(WINDOW *);
-extern int winchnstr(WINDOW *, chtype *, int);
-extern int winchstr(WINDOW *, chtype *);
-extern int winnstr(WINDOW *, char *, int);
-extern int winsdelln(WINDOW *, int);
-extern int winsertln(WINDOW *);
-extern int winsnstr(WINDOW *, char *, int);
-extern int winstr(WINDOW *, char *);
-extern int wisprint(wchar_t);
-extern void wmouse_position(WINDOW *, int *, int *);
-extern int wmove(WINDOW *, int, int);
-extern int wnoutrefresh(WINDOW *);
-extern int wprintw(WINDOW *, ...);
-extern int wredrawln(WINDOW *, int, int);
-extern int wrefresh(WINDOW *);
-extern ssize_t write(int, const void *, size_t);
-extern int wscanw(WINDOW *, ...);
-extern int wscrl(WINDOW *, int);
-extern int wsetscrreg(WINDOW *, int, int);
-extern int wstandend(WINDOW *);
-extern int wstandout(WINDOW *);
-extern void wsyncdown(WINDOW *);
-extern void wsyncup(WINDOW *);
-extern void wtimeout(WINDOW *, int);
-extern int wtouchln(WINDOW *, int, int, int);
-extern int wvline(WINDOW *, chtype, int);
-extern bool xdr_datum(/* ??? */);
-extern int xdr_double(/* ??? */);
-extern int xdr_exports(/* ??? */);
-extern int xdr_fhstatus(/* ??? */);
-extern int xdr_float(/* ??? */);
-extern int xdr_keybuf(/* ??? */);
-extern int xdr_mountlist(/* ??? */);
-extern int xdr_netbuf(/* ??? */);
-extern int xdr_path(/* ??? */);
-extern int xdr_pmap(/* ??? */);
-extern int xdr_pmaplist(/* ??? */);
-extern int xdr_pointer(/* ??? */);
-extern int xdr_reference(/* ??? */);
-extern int xdr_rmtcall_args(/* ??? */);
-extern int xdr_rmtcallres(/* ??? */);
-extern int xdr_rpcb(/* ??? */);
-extern int xdr_rpcb_rmtcallargs(/* ??? */);
-extern int xdr_rpcb_rmtcallres(/* ??? */);
-extern int xdr_rpcblist(/* ??? */);
-extern int xdr_sprayarr(/* ??? */);
-extern int xdr_spraycumul(/* ??? */);
-extern int xdr_spraytimeval(/* ??? */);
-extern int xdr_u_char(/* ??? */);
-extern int xdr_utmparr(/* ??? */);
-extern int xdr_utmpidlearr(/* ??? */);
-extern int xdr_vector(/* ??? */);
-extern int xdr_yp_buf(/* ??? */);
-extern bool xdr_yp_inaddr(/* ??? */);
-extern bool xdr_ypall(/* ??? */);
-extern int xdr_ypdelete_args(/* ??? */);
-extern bool xdr_ypdomain_wrap_string(/* ??? */);
-extern bool xdr_ypmap_parms(/* ??? */);
-extern bool xdr_ypmap_wrap_string(/* ??? */);
-extern bool xdr_ypowner_wrap_string(/* ??? */);
-extern bool xdr_yppushresp_xfr(/* ??? */);
-extern bool xdr_ypreq_key(/* ??? */);
-extern bool xdr_ypreq_newxfr(/* ??? */);
-extern bool xdr_ypreq_nokey(/* ??? */);
-extern bool xdr_ypreq_xfr(/* ??? */);
-extern bool xdr_ypresp_key_val(/* ??? */);
-extern bool xdr_ypresp_maplist(/* ??? */);
-extern bool xdr_ypresp_master(/* ??? */);
-extern bool xdr_ypresp_order(/* ??? */);
-extern bool xdr_ypresp_val(/* ??? */);
-extern int xdr_ypupdate_args(/* ??? */);
-extern void xdrrec_create(/* ??? */);
-extern int xdrrec_endofrecord(/* ??? */);
-extern int xdrrec_eof(/* ??? */);
-extern int xdrrec_skiprecord(/* ??? */);
-extern void xdrstdio_create(/* ??? */);
-extern void xprt_register(/* ??? */);
-extern void xprt_unregister(/* ??? */);
-extern double y0(double);
-extern double y1(double);
-extern double yn(int, double);
-extern int yp_all(char *, char *, struct ypall_callback *);
-extern int yp_bind(const char *);
-extern int yp_first(char *, char *, char **, int *, char **, int *);
-extern int yp_get_default_domain(char **);
-extern int yp_master(char *, char *, char **);
-extern int yp_match(char *, char *, char *, int, char **, int *);
-extern int yp_next(char *, char *, char *, int, char **, int *, char **, int *);
-extern int yp_order(char *, char *, int *);
-extern void yp_unbind(const char *);
-extern char * yperr_string(int);
-extern int ypprot_err(unsigned int);
-extern u_int * ypu_change_1(/* ??? */);
-extern u_int * ypu_delete_1(/* ??? */);
-extern u_int * ypu_insert_1(/* ??? */);
-extern u_int * ypu_store_1(/* ??? */);
diff --git a/gcc/sys-types.h b/gcc/sys-types.h
deleted file mode 100644
index 7db46f112c5..00000000000
--- a/gcc/sys-types.h
+++ /dev/null
@@ -1,240 +0,0 @@
-enum clnt_stat { ___fake1 };
-enum auth_stat { ___fake2 };
-
-struct netconfig;
-struct netbuf;
-struct address;
-struct tm;
-struct ldfile;
-struct syment;
-struct stat;
-struct timeval;
-struct termios;
-struct tms;
-struct dma_cb;
-struct cred;
-struct vnode;
-struct vattr;
-struct uarg;
-struct statfs;
-struct statvfs;
-struct dirent;
-struct itimerval;
-struct mnttab;
-struct strbuf;
-struct vfstab;
-struct ldfile;
-struct syment;
-struct scnhdr;
-struct exception;
-struct nd_hostservlist;
-struct nd_hostserv;
-struct utsname;
-struct uio;
-struct pid;
-struct pollfd;
-struct nlist;
-struct passwd;
-struct spwd;
-struct flock;
-struct seg;
-struct sembuf;
-struct sigaction;
-struct utimbuf;
-struct map;
-struct filehdr;
-struct lineno;
-struct nd_addrlist;
-struct FTW;
-struct buf;
-struct ustat;
-struct qelem;
-struct prpsinfo;
-struct user;
-struct qelem;
-struct execenv;
-struct utmpx;
-
-struct direct;
-struct tm;
-struct stat;
-struct rlimit;
-struct rusage;
-struct sockaddr;
-struct sockaddr_in;
-struct timeval { int i; };
-struct exportent;
-struct fstab;
-struct hostent;
-struct in_addr { int i; };
-struct ldfile;
-struct mallinfo { int i; };
-struct mint;
-struct nmtent;
-struct netent;
-struct pmaplist;
-struct protoent;
-struct rpcent;
-struct servent;
-struct authdes_cred;
-struct rpc_err;
-struct ypall_callback;
-
-union wait;
-
-/* Get size_t and wchar_t. */
-#include <stddef.h>
-
-/* #include "sys/types.h" */
-#define ssize_t int
-
-/* The actual types used here are mostly wrong,
- but it is not supposed to matter what types we use here. */
-
-typedef int dev_t;
-typedef int pid_t;
-typedef int gid_t;
-typedef int off_t;
-typedef int mode_t;
-typedef int uid_t;
-
-typedef int proc_t;
-typedef int time_t;
-typedef int addr_t;
-typedef int caddr_t;
-typedef int clock_t;
-typedef int div_t;
-typedef int ldiv_t;
-typedef int dl_t;
-typedef int major_t;
-typedef int minor_t;
-typedef int emcp_t;
-typedef int fpclass_t;
-typedef int index_t;
-typedef int ecb_t;
-typedef int aioop_t;
-typedef int evver_t;
-typedef int evcntlcmds_t;
-typedef int idtype_t;
-typedef int id_t;
-typedef int procset_t;
-typedef int hostid_t;
-typedef int evpollcmds_t;
-typedef int event_t;
-typedef int hrtime_t;
-typedef int evqcntlcmds_t;
-typedef int sigset_t;
-typedef int evsiginfo_t;
-typedef int evcontext_t;
-typedef int evta_t;
-typedef int speed_t;
-typedef int rlim_t;
-typedef int cred_t;
-typedef int file_t;
-typedef int vnode_t;
-typedef int vfs_t;
-typedef int fpos_t;
-typedef int exhda_t;
-typedef int ucontext_t;
-typedef int sess_t;
-typedef int hrtcmd_t;
-typedef int interval_t;
-typedef int key_t;
-typedef int daddr_t;
-typedef int stack_t;
-typedef int sigaction_t;
-typedef int siginfo_t;
-typedef int mblk_t;
-typedef int paddr_t;
-typedef int qband_t;
-typedef int queue_t;
-typedef int rf_resource_t;
-typedef int sr_mount_t;
-typedef int timer_t;
-typedef int fpregset_t;
-typedef int prstatus_t;
-typedef int vfssw_t;
-typedef int eucwidth_t;
-typedef int page_t;
-
-typedef int u_int;
-typedef int u_short;
-typedef int u_long;
-typedef int u_char;
-
-typedef int ushort;
-typedef int ulong;
-typedef int uint;
-
-typedef int __gnuc_va_list;
-
-typedef int archdr;
-typedef int AUTH;
-typedef int CLIENT;
-typedef int DIR;
-typedef int ENTRY;
-typedef int Elf;
-typedef int Elf32_Ehdr;
-typedef int Elf32_Phdr;
-typedef int Elf32_Shdr;
-typedef int Elf_Arhdr;
-typedef int Elf_Arsym;
-typedef int Elf_Cmd;
-typedef int Elf_Data;
-typedef int Elf_Scn;
-typedef int Elf_Type;
-typedef int Elf_Kind;
-typedef int FIELD;
-typedef int FIELDTYPE;
-typedef int PTF_int;
-typedef int PTF_void;
-typedef int PTF_charP;
-typedef int FILE;
-typedef int FORM;
-typedef int ITEM;
-typedef int MENU;
-typedef int OPTIONS;
-typedef int PANEL;
-typedef int FTP_void;
-typedef int RPCBLIST;
-typedef int SCREEN;
-typedef int SVCXPRT;
-typedef int TERMINAL;
-typedef int WINDOW;
-typedef int bool;
-typedef int nl_catd;
-typedef int nl_item;
-typedef int chtype;
-typedef int datum;
-typedef int fp_rnd;
-typedef int spraycumul;
-typedef int WORD;
-typedef int VISIT;
-typedef int ACTION;
-
-typedef int *jmp_buf;
-typedef int *sigjmp_buf;
-typedef int xdrproc_t;
-typedef int CALL;
-typedef int bool_t;
-typedef int DBM;
-typedef int des_block;
-typedef int resultproc_t;
-
-
-#ifdef BSD
-
-#define mode_t int
-#define uid_t int
-#define gid_t int
-#define time_t long
-#define pid_t int
-#define signal_ret_t int
-#define wait_arg_t union wait
-
-#else
-
-#define signal_ret_t void
-#define wait_arg_t int
-
-#endif
diff --git a/gcc/texinfo.tex b/gcc/texinfo.tex
deleted file mode 100644
index 1d782ca32c0..00000000000
--- a/gcc/texinfo.tex
+++ /dev/null
@@ -1,4758 +0,0 @@
-%% TeX macros to handle Texinfo files.
-%% $Id: texinfo.tex,v 2.193.1.1 1997/01/04 19:21:48 karl Exp $
-
-% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
-% 94, 95, 96, 97 Free Software Foundation, Inc.
-
-%This texinfo.tex 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, or (at
-%your option) any later version.
-
-%This texinfo.tex file 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 texinfo.tex file; see the file COPYING. If not, write
-%to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-%Boston, MA 02111-1307, USA.
-
-
-%In other words, you are welcome to use, share and improve this program.
-%You are forbidden to forbid anyone else to use, share and improve
-%what you give them. Help stamp out software-hoarding!
-
-
-% Send bug reports to bug-texinfo@prep.ai.mit.edu.
-% Please include a *precise* test case in each bug report.
-
-
-% Make it possible to create a .fmt file just by loading this file:
-% if the underlying format is not loaded, start by loading it now.
-% Added by gildea November 1993.
-\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
-
-% This automatically updates the version number based on RCS.
-\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
-\deftexinfoversion$Revision: 2.193.1.1 $
-\message{Loading texinfo package [Version \texinfoversion]:}
-
-% If in a .fmt file, print the version number
-% and turn on active characters that we couldn't do earlier because
-% they might have appeared in the input file name.
-\everyjob{\message{[Texinfo version \texinfoversion]}\message{}
- \catcode`+=\active \catcode`\_=\active}
-
-% Save some parts of plain tex whose names we will redefine.
-
-\let\ptexb=\b
-\let\ptexbullet=\bullet
-\let\ptexc=\c
-\let\ptexcomma=\,
-\let\ptexdot=\.
-\let\ptexdots=\dots
-\let\ptexend=\end
-\let\ptexequiv = \equiv
-\let\ptexi=\i
-\let\ptexlbrace=\{
-\let\ptexrbrace=\}
-\let\ptexstar=\*
-\let\ptext=\t
-
-% Be sure we're in horizontal mode when doing a tie, since we make space
-% equivalent to this in @example-like environments. Otherwise, a space
-% at the beginning of a line will start with \penalty -- and
-% since \penalty is valid in vertical mode, we'd end up putting the
-% penalty on the vertical list instead of in the new paragraph.
-{\catcode`@ = 11
- % Avoid using \@M directly, because that causes trouble
- % if the definition is written into an index file.
- \global\let\tiepenalty = \@M
- \gdef\tie{\leavevmode\penalty\tiepenalty\ }
-}
-
-
-\message{Basics,}
-\chardef\other=12
-
-% If this character appears in an error message or help string, it
-% starts a new line in the output.
-\newlinechar = `^^J
-
-% Set up fixed words for English.
-\ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
-\def\putwordInfo{Info}%
-\ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
-\ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
-\ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
-\ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
-\ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
-\ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
-\ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
-\ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
-\ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
-
-% Ignore a token.
-%
-\def\gobble#1{}
-
-\hyphenation{ap-pen-dix}
-\hyphenation{mini-buf-fer mini-buf-fers}
-\hyphenation{eshell}
-
-% Margin to add to right of even pages, to left of odd pages.
-\newdimen \bindingoffset
-\newdimen \normaloffset
-\newdimen\pagewidth \newdimen\pageheight
-
-% Sometimes it is convenient to have everything in the transcript file
-% and nothing on the terminal. We don't just call \tracingall here,
-% since that produces some useless output on the terminal.
-%
-\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
-\def\loggingall{\tracingcommands2 \tracingstats2
- \tracingpages1 \tracingoutput1 \tracinglostchars1
- \tracingmacros2 \tracingparagraphs1 \tracingrestores1
- \showboxbreadth\maxdimen\showboxdepth\maxdimen
-}%
-
-%---------------------Begin change-----------------------
-%
-%%%% For @cropmarks command.
-% Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
-%
-\newdimen\cornerlong \newdimen\cornerthick
-\newdimen \topandbottommargin
-\newdimen \outerhsize \newdimen \outervsize
-\cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
-\outerhsize=7in
-%\outervsize=9.5in
-% Alternative @smallbook page size is 9.25in
-\outervsize=9.25in
-\topandbottommargin=.75in
-%
-%---------------------End change-----------------------
-
-% Main output routine.
-\chardef\PAGE = 255
-\output = {\onepageout{\pagecontents\PAGE}}
-
-\newbox\headlinebox \newbox\footlinebox
-
-% \onepageout takes a vbox as an argument. Note that \pagecontents
-% does insertions, but you have to call it yourself.
-\def\onepageout#1{%
- \hoffset=\normaloffset
- \ifodd\pageno \advance\hoffset by \bindingoffset
- \else \advance\hoffset by -\bindingoffset\fi
- %
- % Do this outside of the \shipout so @code etc. will be expanded in
- % the headline as they should be, not taken literally (outputting ''code).
- \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
- \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
- %
- {%
- % Have to do this stuff outside the \shipout because we want it to
- % take effect in \write's, yet the group defined by the \vbox ends
- % before the \shipout runs.
- %
- \escapechar = `\\ % use backslash in output files.
- \indexdummies % don't expand commands in the output.
- \normalturnoffactive % \ in index entries must not stay \, e.g., if
- % the page break happens to be in the middle of an example.
- \shipout\vbox{%
- \unvbox\headlinebox
- \pagebody{#1}%
- \unvbox\footlinebox
- }%
- }%
- \advancepageno
- \ifnum\outputpenalty>-20000 \else\dosupereject\fi
-}
-
-%%%% For @cropmarks command %%%%
-
-% Here is a modification of the main output routine for Near East Publications
-% This provides right-angle cropmarks at all four corners.
-% The contents of the page are centerlined into the cropmarks,
-% and any desired binding offset is added as an \hskip on either
-% site of the centerlined box. (P. A. MacKay, 12 November, 1986)
-%
-\def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
-{\escapechar=`\\\relax % makes sure backslash is used in output files.
- \shipout
- \vbox to \outervsize{\hsize=\outerhsize
- \vbox{\line{\ewtop\hfill\ewtop}}
- \nointerlineskip
- \line{\vbox{\moveleft\cornerthick\nstop}
- \hfill
- \vbox{\moveright\cornerthick\nstop}}
- \vskip \topandbottommargin
- \centerline{\ifodd\pageno\hskip\bindingoffset\fi
- \vbox{
- {\let\hsize=\pagewidth \makeheadline}
- \pagebody{#1}
- {\let\hsize=\pagewidth \makefootline}}
- \ifodd\pageno\else\hskip\bindingoffset\fi}
- \vskip \topandbottommargin plus1fill minus1fill
- \boxmaxdepth\cornerthick
- \line{\vbox{\moveleft\cornerthick\nsbot}
- \hfill
- \vbox{\moveright\cornerthick\nsbot}}
- \nointerlineskip
- \vbox{\line{\ewbot\hfill\ewbot}}
- }}
- \advancepageno
- \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
-%
-% Do @cropmarks to get crop marks
-\def\cropmarks{\let\onepageout=\croppageout }
-
-\newinsert\margin \dimen\margin=\maxdimen
-
-\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
-{\catcode`\@ =11
-\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
-% marginal hacks, juha@viisa.uucp (Juha Takala)
-\ifvoid\margin\else % marginal info is present
- \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
-\dimen@=\dp#1 \unvbox#1
-\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
-\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
-}
-
-%
-% Here are the rules for the cropmarks. Note that they are
-% offset so that the space between them is truly \outerhsize or \outervsize
-% (P. A. MacKay, 12 November, 1986)
-%
-\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
-\def\nstop{\vbox
- {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
-\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
-\def\nsbot{\vbox
- {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
-
-% Parse an argument, then pass it to #1. The argument is the rest of
-% the input line (except we remove a trailing comment). #1 should be a
-% macro which expects an ordinary undelimited TeX argument.
-%
-\def\parsearg#1{%
- \let\next = #1%
- \begingroup
- \obeylines
- \futurelet\temp\parseargx
-}
-
-% If the next token is an obeyed space (from an @example environment or
-% the like), remove it and recurse. Otherwise, we're done.
-\def\parseargx{%
- % \obeyedspace is defined far below, after the definition of \sepspaces.
- \ifx\obeyedspace\temp
- \expandafter\parseargdiscardspace
- \else
- \expandafter\parseargline
- \fi
-}
-
-% Remove a single space (as the delimiter token to the macro call).
-{\obeyspaces %
- \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
-
-{\obeylines %
- \gdef\parseargline#1^^M{%
- \endgroup % End of the group started in \parsearg.
- %
- % First remove any @c comment, then any @comment.
- % Result of each macro is put in \toks0.
- \argremovec #1\c\relax %
- \expandafter\argremovecomment \the\toks0 \comment\relax %
- %
- % Call the caller's macro, saved as \next in \parsearg.
- \expandafter\next\expandafter{\the\toks0}%
- }%
-}
-
-% Since all \c{,omment} does is throw away the argument, we can let TeX
-% do that for us. The \relax here is matched by the \relax in the call
-% in \parseargline; it could be more or less anything, its purpose is
-% just to delimit the argument to the \c.
-\def\argremovec#1\c#2\relax{\toks0 = {#1}}
-\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
-
-% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
-% @end itemize @c foo
-% will have two active spaces as part of the argument with the
-% `itemize'. Here we remove all active spaces from #1, and assign the
-% result to \toks0.
-%
-% This loses if there are any *other* active characters besides spaces
-% in the argument -- _ ^ +, for example -- since they get expanded.
-% Fortunately, Texinfo does not define any such commands. (If it ever
-% does, the catcode of the characters in questionwill have to be changed
-% here.) But this means we cannot call \removeactivespaces as part of
-% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
-% that \parsearg gets might well have any character at all in it.
-%
-\def\removeactivespaces#1{%
- \begingroup
- \ignoreactivespaces
- \edef\temp{#1}%
- \global\toks0 = \expandafter{\temp}%
- \endgroup
-}
-
-% Change the active space to expand to nothing.
-%
-\begingroup
- \obeyspaces
- \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
-\endgroup
-
-
-\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
-
-%% These are used to keep @begin/@end levels from running away
-%% Call \inENV within environments (after a \begingroup)
-\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
-\def\ENVcheck{%
-\ifENV\errmessage{Still within an environment. Type Return to continue.}
-\endgroup\fi} % This is not perfect, but it should reduce lossage
-
-% @begin foo is the same as @foo, for now.
-\newhelp\EMsimple{Type <Return> to continue.}
-
-\outer\def\begin{\parsearg\beginxxx}
-
-\def\beginxxx #1{%
-\expandafter\ifx\csname #1\endcsname\relax
-{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
-\csname #1\endcsname\fi}
-
-% @end foo executes the definition of \Efoo.
-%
-\def\end{\parsearg\endxxx}
-\def\endxxx #1{%
- \removeactivespaces{#1}%
- \edef\endthing{\the\toks0}%
- %
- \expandafter\ifx\csname E\endthing\endcsname\relax
- \expandafter\ifx\csname \endthing\endcsname\relax
- % There's no \foo, i.e., no ``environment'' foo.
- \errhelp = \EMsimple
- \errmessage{Undefined command `@end \endthing'}%
- \else
- \unmatchedenderror\endthing
- \fi
- \else
- % Everything's ok; the right environment has been started.
- \csname E\endthing\endcsname
- \fi
-}
-
-% There is an environment #1, but it hasn't been started. Give an error.
-%
-\def\unmatchedenderror#1{%
- \errhelp = \EMsimple
- \errmessage{This `@end #1' doesn't have a matching `@#1'}%
-}
-
-% Define the control sequence \E#1 to give an unmatched @end error.
-%
-\def\defineunmatchedend#1{%
- \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
-}
-
-
-% Single-spacing is done by various environments (specifically, in
-% \nonfillstart and \quotations).
-\newskip\singlespaceskip \singlespaceskip = 12.5pt
-\def\singlespace{%
- % Why was this kern here? It messes up equalizing space above and below
- % environments. --karl, 6may93
- %{\advance \baselineskip by -\singlespaceskip
- %\kern \baselineskip}%
- \setleading \singlespaceskip
-}
-
-%% Simple single-character @ commands
-
-% @@ prints an @
-% Kludge this until the fonts are right (grr).
-\def\@{{\tt \char '100}}
-
-% This is turned off because it was never documented
-% and you can use @w{...} around a quote to suppress ligatures.
-%% Define @` and @' to be the same as ` and '
-%% but suppressing ligatures.
-%\def\`{{`}}
-%\def\'{{'}}
-
-% Used to generate quoted braces.
-\def\mylbrace {{\tt \char '173}}
-\def\myrbrace {{\tt \char '175}}
-\let\{=\mylbrace
-\let\}=\myrbrace
-\begingroup
- % Definitions to produce actual \{ & \} command in an index.
- \catcode`\{ = 12 \catcode`\} = 12
- \catcode`\[ = 1 \catcode`\] = 2
- \catcode`\@ = 0 \catcode`\\ = 12
- @gdef@lbracecmd[\{]%
- @gdef@rbracecmd[\}]%
-@endgroup
-
-% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
-% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
-\let\, = \c
-\let\dotaccent = \.
-\def\ringaccent#1{{\accent23 #1}}
-\let\tieaccent = \t
-\let\ubaraccent = \b
-\let\udotaccent = \d
-
-% Other special characters: @questiondown @exclamdown
-% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
-\def\questiondown{?`}
-\def\exclamdown{!`}
-
-% Dotless i and dotless j, used for accents.
-\def\imacro{i}
-\def\jmacro{j}
-\def\dotless#1{%
- \def\temp{#1}%
- \ifx\temp\imacro \ptexi
- \else\ifx\temp\jmacro \j
- \else \errmessage{@dotless can be used only with i or j}%
- \fi\fi
-}
-
-% @: forces normal size whitespace following.
-\def\:{\spacefactor=1000 }
-
-% @* forces a line break.
-\def\*{\hfil\break\hbox{}\ignorespaces}
-
-% @. is an end-of-sentence period.
-\def\.{.\spacefactor=3000 }
-
-% @enddots{} is an end-of-sentence ellipsis.
-\gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
-
-% @! is an end-of-sentence bang.
-\gdef\!{!\spacefactor=3000 }
-
-% @? is an end-of-sentence query.
-\gdef\?{?\spacefactor=3000 }
-
-% @w prevents a word break. Without the \leavevmode, @w at the
-% beginning of a paragraph, when TeX is still in vertical mode, would
-% produce a whole line of output instead of starting the paragraph.
-\def\w#1{\leavevmode\hbox{#1}}
-
-% @group ... @end group forces ... to be all on one page, by enclosing
-% it in a TeX vbox. We use \vtop instead of \vbox to construct the box
-% to keep its height that of a normal line. According to the rules for
-% \topskip (p.114 of the TeXbook), the glue inserted is
-% max (\topskip - \ht (first item), 0). If that height is large,
-% therefore, no glue is inserted, and the space between the headline and
-% the text is small, which looks bad.
-%
-\def\group{\begingroup
- \ifnum\catcode13=\active \else
- \errhelp = \groupinvalidhelp
- \errmessage{@group invalid in context where filling is enabled}%
- \fi
- %
- % The \vtop we start below produces a box with normal height and large
- % depth; thus, TeX puts \baselineskip glue before it, and (when the
- % next line of text is done) \lineskip glue after it. (See p.82 of
- % the TeXbook.) Thus, space below is not quite equal to space
- % above. But it's pretty close.
- \def\Egroup{%
- \egroup % End the \vtop.
- \endgroup % End the \group.
- }%
- %
- \vtop\bgroup
- % We have to put a strut on the last line in case the @group is in
- % the midst of an example, rather than completely enclosing it.
- % Otherwise, the interline space between the last line of the group
- % and the first line afterwards is too small. But we can't put the
- % strut in \Egroup, since there it would be on a line by itself.
- % Hence this just inserts a strut at the beginning of each line.
- \everypar = {\strut}%
- %
- % Since we have a strut on every line, we don't need any of TeX's
- % normal interline spacing.
- \offinterlineskip
- %
- % OK, but now we have to do something about blank
- % lines in the input in @example-like environments, which normally
- % just turn into \lisppar, which will insert no space now that we've
- % turned off the interline space. Simplest is to make them be an
- % empty paragraph.
- \ifx\par\lisppar
- \edef\par{\leavevmode \par}%
- %
- % Reset ^^M's definition to new definition of \par.
- \obeylines
- \fi
- %
- % Do @comment since we are called inside an environment such as
- % @example, where each end-of-line in the input causes an
- % end-of-line in the output. We don't want the end-of-line after
- % the `@group' to put extra space in the output. Since @group
- % should appear on a line by itself (according to the Texinfo
- % manual), we don't worry about eating any user text.
- \comment
-}
-%
-% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
-% message, so this ends up printing `@group can only ...'.
-%
-\newhelp\groupinvalidhelp{%
-group can only be used in environments such as @example,^^J%
-where each line of input produces a line of output.}
-
-% @need space-in-mils
-% forces a page break if there is not space-in-mils remaining.
-
-\newdimen\mil \mil=0.001in
-
-\def\need{\parsearg\needx}
-
-% Old definition--didn't work.
-%\def\needx #1{\par %
-%% This method tries to make TeX break the page naturally
-%% if the depth of the box does not fit.
-%{\baselineskip=0pt%
-%\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
-%\prevdepth=-1000pt
-%}}
-
-\def\needx#1{%
- % Go into vertical mode, so we don't make a big box in the middle of a
- % paragraph.
- \par
- %
- % Don't add any leading before our big empty box, but allow a page
- % break, since the best break might be right here.
- \allowbreak
- \nointerlineskip
- \vtop to #1\mil{\vfil}%
- %
- % TeX does not even consider page breaks if a penalty added to the
- % main vertical list is 10000 or more. But in order to see if the
- % empty box we just added fits on the page, we must make it consider
- % page breaks. On the other hand, we don't want to actually break the
- % page after the empty box. So we use a penalty of 9999.
- %
- % There is an extremely small chance that TeX will actually break the
- % page at this \penalty, if there are no other feasible breakpoints in
- % sight. (If the user is using lots of big @group commands, which
- % almost-but-not-quite fill up a page, TeX will have a hard time doing
- % good page breaking, for example.) However, I could not construct an
- % example where a page broke at this \penalty; if it happens in a real
- % document, then we can reconsider our strategy.
- \penalty9999
- %
- % Back up by the size of the box, whether we did a page break or not.
- \kern -#1\mil
- %
- % Do not allow a page break right after this kern.
- \nobreak
-}
-
-% @br forces paragraph break
-
-\let\br = \par
-
-% @dots{} output some dots
-
-\def\dots{$\ldots$}
-
-% @page forces the start of a new page
-
-\def\page{\par\vfill\supereject}
-
-% @exdent text....
-% outputs text on separate line in roman font, starting at standard page margin
-
-% This records the amount of indent in the innermost environment.
-% That's how much \exdent should take out.
-\newskip\exdentamount
-
-% This defn is used inside fill environments such as @defun.
-\def\exdent{\parsearg\exdentyyy}
-\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
-
-% This defn is used inside nofill environments such as @example.
-\def\nofillexdent{\parsearg\nofillexdentyyy}
-\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
-\leftline{\hskip\leftskip{\rm#1}}}}
-
-% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
-
-\def\inmargin#1{%
-\strut\vadjust{\nobreak\kern-\strutdepth
- \vtop to \strutdepth{\baselineskip\strutdepth\vss
- \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
-\newskip\inmarginspacing \inmarginspacing=1cm
-\def\strutdepth{\dp\strutbox}
-
-%\hbox{{\rm#1}}\hfil\break}}
-
-% @include file insert text of that file as input.
-% Allow normal characters that we make active in the argument (a file name).
-\def\include{\begingroup
- \catcode`\\=12
- \catcode`~=12
- \catcode`^=12
- \catcode`_=12
- \catcode`|=12
- \catcode`<=12
- \catcode`>=12
- \catcode`+=12
- \parsearg\includezzz}
-% Restore active chars for included file.
-\def\includezzz#1{\endgroup\begingroup
- % Read the included file in a group so nested @include's work.
- \def\thisfile{#1}%
- \input\thisfile
-\endgroup}
-
-\def\thisfile{}
-
-% @center line outputs that line, centered
-
-\def\center{\parsearg\centerzzz}
-\def\centerzzz #1{{\advance\hsize by -\leftskip
-\advance\hsize by -\rightskip
-\centerline{#1}}}
-
-% @sp n outputs n lines of vertical space
-
-\def\sp{\parsearg\spxxx}
-\def\spxxx #1{\vskip #1\baselineskip}
-
-% @comment ...line which is ignored...
-% @c is the same as @comment
-% @ignore ... @end ignore is another way to write a comment
-
-\def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
-\parsearg \commentxxx}
-
-\def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
-
-\let\c=\comment
-
-% @paragraphindent is defined for the Info formatting commands only.
-\let\paragraphindent=\comment
-
-% Prevent errors for section commands.
-% Used in @ignore and in failing conditionals.
-\def\ignoresections{%
-\let\chapter=\relax
-\let\unnumbered=\relax
-\let\top=\relax
-\let\unnumberedsec=\relax
-\let\unnumberedsection=\relax
-\let\unnumberedsubsec=\relax
-\let\unnumberedsubsection=\relax
-\let\unnumberedsubsubsec=\relax
-\let\unnumberedsubsubsection=\relax
-\let\section=\relax
-\let\subsec=\relax
-\let\subsubsec=\relax
-\let\subsection=\relax
-\let\subsubsection=\relax
-\let\appendix=\relax
-\let\appendixsec=\relax
-\let\appendixsection=\relax
-\let\appendixsubsec=\relax
-\let\appendixsubsection=\relax
-\let\appendixsubsubsec=\relax
-\let\appendixsubsubsection=\relax
-\let\contents=\relax
-\let\smallbook=\relax
-\let\titlepage=\relax
-}
-
-% Used in nested conditionals, where we have to parse the Texinfo source
-% and so want to turn off most commands, in case they are used
-% incorrectly.
-%
-\def\ignoremorecommands{%
- \let\defcodeindex = \relax
- \let\defcv = \relax
- \let\deffn = \relax
- \let\deffnx = \relax
- \let\defindex = \relax
- \let\defivar = \relax
- \let\defmac = \relax
- \let\defmethod = \relax
- \let\defop = \relax
- \let\defopt = \relax
- \let\defspec = \relax
- \let\deftp = \relax
- \let\deftypefn = \relax
- \let\deftypefun = \relax
- \let\deftypevar = \relax
- \let\deftypevr = \relax
- \let\defun = \relax
- \let\defvar = \relax
- \let\defvr = \relax
- \let\ref = \relax
- \let\xref = \relax
- \let\printindex = \relax
- \let\pxref = \relax
- \let\settitle = \relax
- \let\setchapternewpage = \relax
- \let\setchapterstyle = \relax
- \let\everyheading = \relax
- \let\evenheading = \relax
- \let\oddheading = \relax
- \let\everyfooting = \relax
- \let\evenfooting = \relax
- \let\oddfooting = \relax
- \let\headings = \relax
- \let\include = \relax
- \let\lowersections = \relax
- \let\down = \relax
- \let\raisesections = \relax
- \let\up = \relax
- \let\set = \relax
- \let\clear = \relax
- \let\item = \relax
-}
-
-% Ignore @ignore ... @end ignore.
-%
-\def\ignore{\doignore{ignore}}
-
-% Also ignore @ifinfo, @ifhtml, @html, @menu, and @direntry text.
-%
-\def\ifinfo{\doignore{ifinfo}}
-\def\ifhtml{\doignore{ifhtml}}
-\def\html{\doignore{html}}
-\def\menu{\doignore{menu}}
-\def\direntry{\doignore{direntry}}
-
-% Also ignore @macro ... @end macro. The user must run texi2dvi,
-% which runs makeinfo to do macro expansion. Ignore @unmacro, too.
-\def\macro{\doignore{macro}}
-\let\unmacro = \comment
-
-
-% @dircategory CATEGORY -- specify a category of the dir file
-% which this file should belong to. Ignore this in TeX.
-\let\dircategory = \comment
-
-% Ignore text until a line `@end #1'.
-%
-\def\doignore#1{\begingroup
- % Don't complain about control sequences we have declared \outer.
- \ignoresections
- %
- % Define a command to swallow text until we reach `@end #1'.
- \long\def\doignoretext##1\end #1{\enddoignore}%
- %
- % Make sure that spaces turn into tokens that match what \doignoretext wants.
- \catcode32 = 10
- %
- % And now expand that command.
- \doignoretext
-}
-
-% What we do to finish off ignored text.
-%
-\def\enddoignore{\endgroup\ignorespaces}%
-
-\newif\ifwarnedobs\warnedobsfalse
-\def\obstexwarn{%
- \ifwarnedobs\relax\else
- % We need to warn folks that they may have trouble with TeX 3.0.
- % This uses \immediate\write16 rather than \message to get newlines.
- \immediate\write16{}
- \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
- \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
- \immediate\write16{If you are running another version of TeX, relax.}
- \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
- \immediate\write16{ Then upgrade your TeX installation if you can.}
- \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
- \immediate\write16{If you are stuck with version 3.0, run the}
- \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
- \immediate\write16{ to use a workaround.}
- \immediate\write16{}
- \global\warnedobstrue
- \fi
-}
-
-% **In TeX 3.0, setting text in \nullfont hangs tex. For a
-% workaround (which requires the file ``dummy.tfm'' to be installed),
-% uncomment the following line:
-%%%%%\font\nullfont=dummy\let\obstexwarn=\relax
-
-% Ignore text, except that we keep track of conditional commands for
-% purposes of nesting, up to an `@end #1' command.
-%
-\def\nestedignore#1{%
- \obstexwarn
- % We must actually expand the ignored text to look for the @end
- % command, so that nested ignore constructs work. Thus, we put the
- % text into a \vbox and then do nothing with the result. To minimize
- % the change of memory overflow, we follow the approach outlined on
- % page 401 of the TeXbook: make the current font be a dummy font.
- %
- \setbox0 = \vbox\bgroup
- % Don't complain about control sequences we have declared \outer.
- \ignoresections
- %
- % Define `@end #1' to end the box, which will in turn undefine the
- % @end command again.
- \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
- %
- % We are going to be parsing Texinfo commands. Most cause no
- % trouble when they are used incorrectly, but some commands do
- % complicated argument parsing or otherwise get confused, so we
- % undefine them.
- %
- % We can't do anything about stray @-signs, unfortunately;
- % they'll produce `undefined control sequence' errors.
- \ignoremorecommands
- %
- % Set the current font to be \nullfont, a TeX primitive, and define
- % all the font commands to also use \nullfont. We don't use
- % dummy.tfm, as suggested in the TeXbook, because not all sites
- % might have that installed. Therefore, math mode will still
- % produce output, but that should be an extremely small amount of
- % stuff compared to the main input.
- %
- \nullfont
- \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
- \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
- \let\tensf = \nullfont
- % Similarly for index fonts (mostly for their use in
- % smallexample)
- \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
- \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
- \let\indsf = \nullfont
- %
- % Don't complain when characters are missing from the fonts.
- \tracinglostchars = 0
- %
- % Don't bother to do space factor calculations.
- \frenchspacing
- %
- % Don't report underfull hboxes.
- \hbadness = 10000
- %
- % Do minimal line-breaking.
- \pretolerance = 10000
- %
- % Do not execute instructions in @tex
- \def\tex{\doignore{tex}}
-}
-
-% @set VAR sets the variable VAR to an empty value.
-% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
-%
-% Since we want to separate VAR from REST-OF-LINE (which might be
-% empty), we can't just use \parsearg; we have to insert a space of our
-% own to delimit the rest of the line, and then take it out again if we
-% didn't need it. Make sure the catcode of space is correct to avoid
-% losing inside @example, for instance.
-%
-\def\set{\begingroup\catcode` =10
- \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
- \parsearg\setxxx}
-\def\setxxx#1{\setyyy#1 \endsetyyy}
-\def\setyyy#1 #2\endsetyyy{%
- \def\temp{#2}%
- \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
- \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
- \fi
- \endgroup
-}
-% Can't use \xdef to pre-expand #2 and save some time, since \temp or
-% \next or other control sequences that we've defined might get us into
-% an infinite loop. Consider `@set foo @cite{bar}'.
-\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
-
-% @clear VAR clears (i.e., unsets) the variable VAR.
-%
-\def\clear{\parsearg\clearxxx}
-\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
-
-% @value{foo} gets the text saved in variable foo.
-%
-\def\value{\begingroup
- \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
- \valuexxx}
-\def\valuexxx#1{%
- \expandafter\ifx\csname SET#1\endcsname\relax
- {\{No value for ``#1''\}}%
- \else
- \csname SET#1\endcsname
- \fi
-\endgroup}
-
-% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
-% with @set.
-%
-\def\ifset{\parsearg\ifsetxxx}
-\def\ifsetxxx #1{%
- \expandafter\ifx\csname SET#1\endcsname\relax
- \expandafter\ifsetfail
- \else
- \expandafter\ifsetsucceed
- \fi
-}
-\def\ifsetsucceed{\conditionalsucceed{ifset}}
-\def\ifsetfail{\nestedignore{ifset}}
-\defineunmatchedend{ifset}
-
-% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
-% defined with @set, or has been undefined with @clear.
-%
-\def\ifclear{\parsearg\ifclearxxx}
-\def\ifclearxxx #1{%
- \expandafter\ifx\csname SET#1\endcsname\relax
- \expandafter\ifclearsucceed
- \else
- \expandafter\ifclearfail
- \fi
-}
-\def\ifclearsucceed{\conditionalsucceed{ifclear}}
-\def\ifclearfail{\nestedignore{ifclear}}
-\defineunmatchedend{ifclear}
-
-% @iftex always succeeds; we read the text following, through @end
-% iftex). But `@end iftex' should be valid only after an @iftex.
-%
-\def\iftex{\conditionalsucceed{iftex}}
-\defineunmatchedend{iftex}
-
-% We can't just want to start a group at @iftex (for example) and end it
-% at @end iftex, since then @set commands inside the conditional have no
-% effect (they'd get reverted at the end of the group). So we must
-% define \Eiftex to redefine itself to be its previous value. (We can't
-% just define it to fail again with an ``unmatched end'' error, since
-% the @ifset might be nested.)
-%
-\def\conditionalsucceed#1{%
- \edef\temp{%
- % Remember the current value of \E#1.
- \let\nece{prevE#1} = \nece{E#1}%
- %
- % At the `@end #1', redefine \E#1 to be its previous value.
- \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
- }%
- \temp
-}
-
-% We need to expand lots of \csname's, but we don't want to expand the
-% control sequences after we've constructed them.
-%
-\def\nece#1{\expandafter\noexpand\csname#1\endcsname}
-
-% @asis just yields its argument. Used with @table, for example.
-%
-\def\asis#1{#1}
-
-% @math means output in math mode.
-% We don't use $'s directly in the definition of \math because control
-% sequences like \math are expanded when the toc file is written. Then,
-% we read the toc file back, the $'s will be normal characters (as they
-% should be, according to the definition of Texinfo). So we must use a
-% control sequence to switch into and out of math mode.
-%
-% This isn't quite enough for @math to work properly in indices, but it
-% seems unlikely it will ever be needed there.
-%
-\let\implicitmath = $
-\def\math#1{\implicitmath #1\implicitmath}
-
-% @bullet and @minus need the same treatment as @math, just above.
-\def\bullet{\implicitmath\ptexbullet\implicitmath}
-\def\minus{\implicitmath-\implicitmath}
-
-\def\node{\ENVcheck\parsearg\nodezzz}
-\def\nodezzz#1{\nodexxx [#1,]}
-\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
-\let\nwnode=\node
-\let\lastnode=\relax
-
-\def\donoderef{\ifx\lastnode\relax\else
-\expandafter\expandafter\expandafter\setref{\lastnode}\fi
-\global\let\lastnode=\relax}
-
-\def\unnumbnoderef{\ifx\lastnode\relax\else
-\expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
-\global\let\lastnode=\relax}
-
-\def\appendixnoderef{\ifx\lastnode\relax\else
-\expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
-\global\let\lastnode=\relax}
-
-% @refill is a no-op.
-\let\refill=\relax
-
-% @setfilename is done at the beginning of every texinfo file.
-% So open here the files we need to have open while reading the input.
-% This makes it possible to make a .fmt file for texinfo.
-\def\setfilename{%
- \readauxfile
- \opencontents
- \openindices
- \fixbackslash % Turn off hack to swallow `\input texinfo'.
- \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
- \comment % Ignore the actual filename.
-}
-
-% @bye.
-\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
-
-% \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx}
-% \def\macroxxx#1#2 \end macro{%
-% \expandafter\gdef\macrotemp#1{#2}%
-% \endgroup}
-
-%\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx}
-%\def\linemacroxxx#1#2 \end linemacro{%
-%\let\parsearg=\relax
-%\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}%
-%\expandafter\xdef\macrotemp{\parsearg\macrotempx}%
-%\expandafter\gdef\macrotempx#1{#2}%
-%\endgroup}
-
-%\def\butfirst#1{}
-
-
-\message{fonts,}
-
-% Font-change commands.
-
-% Texinfo supports the sans serif font style, which plain TeX does not.
-% So we set up a \sf analogous to plain's \rm, etc.
-\newfam\sffam
-\def\sf{\fam=\sffam \tensf}
-\let\li = \sf % Sometimes we call it \li, not \sf.
-
-% We don't need math for this one.
-\def\ttsl{\tenttsl}
-
-%% Try out Computer Modern fonts at \magstephalf
-\let\mainmagstep=\magstephalf
-
-% Set the font macro #1 to the font named #2, adding on the
-% specified font prefix (normally `cm').
-% #3 is the font's design size, #4 is a scale factor
-\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
-
-% Use cm as the default font prefix.
-% To specify the font prefix, you must define \fontprefix
-% before you read in texinfo.tex.
-\ifx\fontprefix\undefined
-\def\fontprefix{cm}
-\fi
-% Support font families that don't use the same naming scheme as CM.
-\def\rmshape{r}
-\def\rmbshape{bx} %where the normal face is bold
-\def\bfshape{b}
-\def\bxshape{bx}
-\def\ttshape{tt}
-\def\ttbshape{tt}
-\def\ttslshape{sltt}
-\def\itshape{ti}
-\def\itbshape{bxti}
-\def\slshape{sl}
-\def\slbshape{bxsl}
-\def\sfshape{ss}
-\def\sfbshape{ss}
-\def\scshape{csc}
-\def\scbshape{csc}
-
-\ifx\bigger\relax
-\let\mainmagstep=\magstep1
-\setfont\textrm\rmshape{12}{1000}
-\setfont\texttt\ttshape{12}{1000}
-\else
-\setfont\textrm\rmshape{10}{\mainmagstep}
-\setfont\texttt\ttshape{10}{\mainmagstep}
-\fi
-% Instead of cmb10, you many want to use cmbx10.
-% cmbx10 is a prettier font on its own, but cmb10
-% looks better when embedded in a line with cmr10.
-\setfont\textbf\bfshape{10}{\mainmagstep}
-\setfont\textit\itshape{10}{\mainmagstep}
-\setfont\textsl\slshape{10}{\mainmagstep}
-\setfont\textsf\sfshape{10}{\mainmagstep}
-\setfont\textsc\scshape{10}{\mainmagstep}
-\setfont\textttsl\ttslshape{10}{\mainmagstep}
-\font\texti=cmmi10 scaled \mainmagstep
-\font\textsy=cmsy10 scaled \mainmagstep
-
-% A few fonts for @defun, etc.
-\setfont\defbf\bxshape{10}{\magstep1} %was 1314
-\setfont\deftt\ttshape{10}{\magstep1}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
-
-% Fonts for indices and small examples (9pt).
-% We actually use the slanted font rather than the italic,
-% because texinfo normally uses the slanted fonts for that.
-% Do not make many font distinctions in general in the index, since they
-% aren't very useful.
-\setfont\ninett\ttshape{9}{1000}
-\setfont\indrm\rmshape{9}{1000}
-\setfont\indit\slshape{9}{1000}
-\let\indsl=\indit
-\let\indtt=\ninett
-\let\indttsl=\ninett
-\let\indsf=\indrm
-\let\indbf=\indrm
-\setfont\indsc\scshape{10}{900}
-\font\indi=cmmi9
-\font\indsy=cmsy9
-
-% Chapter (and unnumbered) fonts (17.28pt).
-\setfont\chaprm\rmbshape{12}{\magstep2}
-\setfont\chapit\itbshape{10}{\magstep3}
-\setfont\chapsl\slbshape{10}{\magstep3}
-\setfont\chaptt\ttbshape{12}{\magstep2}
-\setfont\chapttsl\ttslshape{10}{\magstep3}
-\setfont\chapsf\sfbshape{12}{\magstep2}
-\let\chapbf=\chaprm
-\setfont\chapsc\scbshape{10}{\magstep3}
-\font\chapi=cmmi12 scaled \magstep2
-\font\chapsy=cmsy10 scaled \magstep3
-
-% Section fonts (14.4pt).
-\setfont\secrm\rmbshape{12}{\magstep1}
-\setfont\secit\itbshape{10}{\magstep2}
-\setfont\secsl\slbshape{10}{\magstep2}
-\setfont\sectt\ttbshape{12}{\magstep1}
-\setfont\secttsl\ttslshape{10}{\magstep2}
-\setfont\secsf\sfbshape{12}{\magstep1}
-\let\secbf\secrm
-\setfont\secsc\scbshape{10}{\magstep2}
-\font\seci=cmmi12 scaled \magstep1
-\font\secsy=cmsy10 scaled \magstep2
-
-% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
-% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
-% \setfont\ssecsl\slshape{10}{\magstep1}
-% \setfont\ssectt\ttshape{10}{\magstep1}
-% \setfont\ssecsf\sfshape{10}{\magstep1}
-
-%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
-%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
-%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
-%\setfont\ssectt\ttshape{10}{1315}
-%\setfont\ssecsf\sfshape{10}{1315}
-
-%\let\ssecbf=\ssecrm
-
-% Subsection fonts (13.15pt).
-\setfont\ssecrm\rmbshape{12}{\magstephalf}
-\setfont\ssecit\itbshape{10}{1315}
-\setfont\ssecsl\slbshape{10}{1315}
-\setfont\ssectt\ttbshape{12}{\magstephalf}
-\setfont\ssecttsl\ttslshape{10}{\magstep1}
-\setfont\ssecsf\sfbshape{12}{\magstephalf}
-\let\ssecbf\ssecrm
-\setfont\ssecsc\scbshape{10}{\magstep1}
-\font\sseci=cmmi12 scaled \magstephalf
-\font\ssecsy=cmsy10 scaled \magstep1
-% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
-% but that is not a standard magnification.
-
-% Fonts for title page:
-\setfont\titlerm\rmbshape{12}{\magstep3}
-\let\authorrm = \secrm
-
-% In order for the font changes to affect most math symbols and letters,
-% we have to define the \textfont of the standard families. Since
-% texinfo doesn't allow for producing subscripts and superscripts, we
-% don't bother to reset \scriptfont and \scriptscriptfont (which would
-% also require loading a lot more fonts).
-%
-\def\resetmathfonts{%
- \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
- \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
- \textfont\ttfam = \tentt \textfont\sffam = \tensf
-}
-
-
-% The font-changing commands redefine the meanings of \tenSTYLE, instead
-% of just \STYLE. We do this so that font changes will continue to work
-% in math mode, where it is the current \fam that is relevant in most
-% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
-% \tenbf}, for example. By redefining \tenbf, we obviate the need to
-% redefine \bf itself.
-\def\textfonts{%
- \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
- \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
- \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
- \resetmathfonts}
-\def\chapfonts{%
- \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
- \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
- \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
- \resetmathfonts \setleading{19pt}}
-\def\secfonts{%
- \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
- \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
- \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
- \resetmathfonts \setleading{16pt}}
-\def\subsecfonts{%
- \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
- \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
- \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
- \resetmathfonts \setleading{15pt}}
-\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
-\def\indexfonts{%
- \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
- \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
- \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
- \resetmathfonts \setleading{12pt}}
-
-% Set up the default fonts, so we can use them for creating boxes.
-%
-\textfonts
-
-% Count depth in font-changes, for error checks
-\newcount\fontdepth \fontdepth=0
-
-% Fonts for short table of contents.
-\setfont\shortcontrm\rmshape{12}{1000}
-\setfont\shortcontbf\bxshape{12}{1000}
-\setfont\shortcontsl\slshape{12}{1000}
-
-%% Add scribe-like font environments, plus @l for inline lisp (usually sans
-%% serif) and @ii for TeX italic
-
-% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
-% unless the following character is such as not to need one.
-\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
-\def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
-
-\let\i=\smartitalic
-\let\var=\smartitalic
-\let\dfn=\smartitalic
-\let\emph=\smartitalic
-\let\cite=\smartitalic
-
-\def\b#1{{\bf #1}}
-\let\strong=\b
-
-% We can't just use \exhyphenpenalty, because that only has effect at
-% the end of a paragraph. Restore normal hyphenation at the end of the
-% group within which \nohyphenation is presumably called.
-%
-\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
-\def\restorehyphenation{\hyphenchar\font = `- }
-
-\def\t#1{%
- {\tt \rawbackslash \frenchspacing #1}%
- \null
-}
-\let\ttfont=\t
-\def\samp #1{`\tclose{#1}'\null}
-\setfont\smallrm\rmshape{8}{1000}
-\font\smallsy=cmsy9
-\def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
- \raise0.4pt\hbox{$\langle$}\kern-.08em\vtop{%
- \vbox{\hrule\kern-0.4pt
- \hbox{\raise0.4pt\hbox{\vphantom{$\langle$}}#1}}%
- \kern-0.4pt\hrule}%
- \kern-.06em\raise0.4pt\hbox{$\rangle$}}}}
-% The old definition, with no lozenge:
-%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
-\def\ctrl #1{{\tt \rawbackslash \hat}#1}
-
-\let\file=\samp
-\let\url=\samp % perhaps include a hypertex \special eventually
-\def\email#1{$\langle${\tt #1}$\rangle$}
-
-% @code is a modification of @t,
-% which makes spaces the same size as normal in the surrounding text.
-\def\tclose#1{%
- {%
- % Change normal interword space to be same as for the current font.
- \spaceskip = \fontdimen2\font
- %
- % Switch to typewriter.
- \tt
- %
- % But `\ ' produces the large typewriter interword space.
- \def\ {{\spaceskip = 0pt{} }}%
- %
- % Turn off hyphenation.
- \nohyphenation
- %
- \rawbackslash
- \frenchspacing
- #1%
- }%
- \null
-}
-
-% We *must* turn on hyphenation at `-' and `_' in \code.
-% Otherwise, it is too hard to avoid overfull hboxes
-% in the Emacs manual, the Library manual, etc.
-
-% Unfortunately, TeX uses one parameter (\hyphenchar) to control
-% both hyphenation at - and hyphenation within words.
-% We must therefore turn them both off (\tclose does that)
-% and arrange explicitly to hyphenate at a dash.
-% -- rms.
-{
-\catcode`\-=\active
-\catcode`\_=\active
-\catcode`\|=\active
-\global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
-% The following is used by \doprintindex to insure that long function names
-% wrap around. It is necessary for - and _ to be active before the index is
-% read from the file, as \entry parses the arguments long before \code is
-% ever called. -- mycroft
-% _ is always active; and it shouldn't be \let = to an _ that is a
-% subscript character anyway. Then, @cindex @samp{_} (for example)
-% fails. --karl
-\global\def\indexbreaks{%
- \catcode`\-=\active \let-\realdash
-}
-}
-
-\def\realdash{-}
-\def\codedash{-\discretionary{}{}{}}
-\def\codeunder{\normalunderscore\discretionary{}{}{}}
-\def\codex #1{\tclose{#1}\endgroup}
-
-%\let\exp=\tclose %Was temporary
-
-% @kbd is like @code, except that if the argument is just one @key command,
-% then @kbd has no effect.
-%
-\def\xkey{\key}
-\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
-\ifx\one\xkey\ifx\threex\three \key{#2}%
-\else{\tclose{\ttsl\look}}\fi
-\else{\tclose{\ttsl\look}}\fi}
-
-% Check if we are currently using a typewriter font. Since all the
-% Computer Modern typewriter fonts have zero interword stretch (and
-% shrink), and it is reasonable to expect all typewriter fonts to have
-% this property, we can check that font parameter.
-%
-\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
-
-% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
-% argument is to make the input look right: @dmn{pt} instead of
-% @dmn{}pt.
-%
-\def\dmn#1{\thinspace #1}
-
-\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
-
-% @l was never documented to mean ``switch to the Lisp font'',
-% and it is not used as such in any manual I can find. We need it for
-% Polish suppressed-l. --karl, 22sep96.
-%\def\l#1{{\li #1}\null}
-
-\def\r#1{{\rm #1}} % roman font
-% Use of \lowercase was suggested.
-\def\sc#1{{\smallcaps#1}} % smallcaps font
-\def\ii#1{{\it #1}} % italic font
-
-% @pounds{} is a sterling sign.
-\def\pounds{{\it\$}}
-
-
-\message{page headings,}
-
-\newskip\titlepagetopglue \titlepagetopglue = 1.5in
-\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
-
-% First the title page. Must do @settitle before @titlepage.
-\def\titlefont#1{{\titlerm #1}}
-
-\newif\ifseenauthor
-\newif\iffinishedtitlepage
-
-\def\shorttitlepage{\parsearg\shorttitlepagezzz}
-\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
- \endgroup\page\hbox{}\page}
-
-\def\titlepage{\begingroup \parindent=0pt \textfonts
- \let\subtitlerm=\tenrm
-% I deinstalled the following change because \cmr12 is undefined.
-% This change was not in the ChangeLog anyway. --rms.
-% \let\subtitlerm=\cmr12
- \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
- %
- \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
- %
- % Leave some space at the very top of the page.
- \vglue\titlepagetopglue
- %
- % Now you can print the title using @title.
- \def\title{\parsearg\titlezzz}%
- \def\titlezzz##1{\leftline{\titlefont{##1}}
- % print a rule at the page bottom also.
- \finishedtitlepagefalse
- \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
- % No rule at page bottom unless we print one at the top with @title.
- \finishedtitlepagetrue
- %
- % Now you can put text using @subtitle.
- \def\subtitle{\parsearg\subtitlezzz}%
- \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
- %
- % @author should come last, but may come many times.
- \def\author{\parsearg\authorzzz}%
- \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
- {\authorfont \leftline{##1}}}%
- %
- % Most title ``pages'' are actually two pages long, with space
- % at the top of the second. We don't want the ragged left on the second.
- \let\oldpage = \page
- \def\page{%
- \iffinishedtitlepage\else
- \finishtitlepage
- \fi
- \oldpage
- \let\page = \oldpage
- \hbox{}}%
-% \def\page{\oldpage \hbox{}}
-}
-
-\def\Etitlepage{%
- \iffinishedtitlepage\else
- \finishtitlepage
- \fi
- % It is important to do the page break before ending the group,
- % because the headline and footline are only empty inside the group.
- % If we use the new definition of \page, we always get a blank page
- % after the title page, which we certainly don't want.
- \oldpage
- \endgroup
- \HEADINGSon
-}
-
-\def\finishtitlepage{%
- \vskip4pt \hrule height 2pt width \hsize
- \vskip\titlepagebottomglue
- \finishedtitlepagetrue
-}
-
-%%% Set up page headings and footings.
-
-\let\thispage=\folio
-
-\newtoks \evenheadline % Token sequence for heading line of even pages
-\newtoks \oddheadline % Token sequence for heading line of odd pages
-\newtoks \evenfootline % Token sequence for footing line of even pages
-\newtoks \oddfootline % Token sequence for footing line of odd pages
-
-% Now make Tex use those variables
-\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
- \else \the\evenheadline \fi}}
-\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
- \else \the\evenfootline \fi}\HEADINGShook}
-\let\HEADINGShook=\relax
-
-% Commands to set those variables.
-% For example, this is what @headings on does
-% @evenheading @thistitle|@thispage|@thischapter
-% @oddheading @thischapter|@thispage|@thistitle
-% @evenfooting @thisfile||
-% @oddfooting ||@thisfile
-
-\def\evenheading{\parsearg\evenheadingxxx}
-\def\oddheading{\parsearg\oddheadingxxx}
-\def\everyheading{\parsearg\everyheadingxxx}
-
-\def\evenfooting{\parsearg\evenfootingxxx}
-\def\oddfooting{\parsearg\oddfootingxxx}
-\def\everyfooting{\parsearg\everyfootingxxx}
-
-{\catcode`\@=0 %
-
-\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
-\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
-\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
-\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
-\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
-\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
-\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
-\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
-\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
-\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
-\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-%
-}% unbind the catcode of @.
-
-% @headings double turns headings on for double-sided printing.
-% @headings single turns headings on for single-sided printing.
-% @headings off turns them off.
-% @headings on same as @headings double, retained for compatibility.
-% @headings after turns on double-sided headings after this page.
-% @headings doubleafter turns on double-sided headings after this page.
-% @headings singleafter turns on single-sided headings after this page.
-% By default, they are off at the start of a document,
-% and turned `on' after @end titlepage.
-
-\def\headings #1 {\csname HEADINGS#1\endcsname}
-
-\def\HEADINGSoff{
-\global\evenheadline={\hfil} \global\evenfootline={\hfil}
-\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
-\HEADINGSoff
-% When we turn headings on, set the page number to 1.
-% For double-sided printing, put current file name in lower left corner,
-% chapter name on inside top of right hand pages, document
-% title on inside top of left hand pages, and page numbers on outside top
-% edge of all pages.
-\def\HEADINGSdouble{
-\global\pageno=1
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chapoddpage
-}
-\let\contentsalignmacro = \chappager
-
-% For single-sided printing, chapter title goes across top left of page,
-% page number on top right.
-\def\HEADINGSsingle{
-\global\pageno=1
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chappager
-}
-\def\HEADINGSon{\HEADINGSdouble}
-
-\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
-\let\HEADINGSdoubleafter=\HEADINGSafter
-\def\HEADINGSdoublex{%
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chapoddpage
-}
-
-\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
-\def\HEADINGSsinglex{%
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chappager
-}
-
-% Subroutines used in generating headings
-% Produces Day Month Year style of output.
-\def\today{\number\day\space
-\ifcase\month\or
-January\or February\or March\or April\or May\or June\or
-July\or August\or September\or October\or November\or December\fi
-\space\number\year}
-
-% Use this if you want the Month Day, Year style of output.
-%\def\today{\ifcase\month\or
-%January\or February\or March\or April\or May\or June\or
-%July\or August\or September\or October\or November\or December\fi
-%\space\number\day, \number\year}
-
-% @settitle line... specifies the title of the document, for headings
-% It generates no output of its own
-
-\def\thistitle{No Title}
-\def\settitle{\parsearg\settitlezzz}
-\def\settitlezzz #1{\gdef\thistitle{#1}}
-
-
-\message{tables,}
-
-% @tabs -- simple alignment
-
-% These don't work. For one thing, \+ is defined as outer.
-% So these macros cannot even be defined.
-
-%\def\tabs{\parsearg\tabszzz}
-%\def\tabszzz #1{\settabs\+#1\cr}
-%\def\tabline{\parsearg\tablinezzz}
-%\def\tablinezzz #1{\+#1\cr}
-%\def\&{&}
-
-% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
-
-% default indentation of table text
-\newdimen\tableindent \tableindent=.8in
-% default indentation of @itemize and @enumerate text
-\newdimen\itemindent \itemindent=.3in
-% margin between end of table item and start of table text.
-\newdimen\itemmargin \itemmargin=.1in
-
-% used internally for \itemindent minus \itemmargin
-\newdimen\itemmax
-
-% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
-% these defs.
-% They also define \itemindex
-% to index the item name in whatever manner is desired (perhaps none).
-
-\newif\ifitemxneedsnegativevskip
-
-\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
-
-\def\internalBitem{\smallbreak \parsearg\itemzzz}
-\def\internalBitemx{\itemxpar \parsearg\itemzzz}
-
-\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
-\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
-
-\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
-\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
-
-\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
- \itemzzz {#1}}
-
-\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
- \itemzzz {#1}}
-
-\def\itemzzz #1{\begingroup %
- \advance\hsize by -\rightskip
- \advance\hsize by -\tableindent
- \setbox0=\hbox{\itemfont{#1}}%
- \itemindex{#1}%
- \nobreak % This prevents a break before @itemx.
- %
- % Be sure we are not still in the middle of a paragraph.
- %{\parskip = 0in
- %\par
- %}%
- %
- % If the item text does not fit in the space we have, put it on a line
- % by itself, and do not allow a page break either before or after that
- % line. We do not start a paragraph here because then if the next
- % command is, e.g., @kindex, the whatsit would get put into the
- % horizontal list on a line by itself, resulting in extra blank space.
- \ifdim \wd0>\itemmax
- %
- % Make this a paragraph so we get the \parskip glue and wrapping,
- % but leave it ragged-right.
- \begingroup
- \advance\leftskip by-\tableindent
- \advance\hsize by\tableindent
- \advance\rightskip by0pt plus1fil
- \leavevmode\unhbox0\par
- \endgroup
- %
- % We're going to be starting a paragraph, but we don't want the
- % \parskip glue -- logically it's part of the @item we just started.
- \nobreak \vskip-\parskip
- %
- % Stop a page break at the \parskip glue coming up. Unfortunately
- % we can't prevent a possible page break at the following
- % \baselineskip glue.
- \nobreak
- \endgroup
- \itemxneedsnegativevskipfalse
- \else
- % The item text fits into the space. Start a paragraph, so that the
- % following text (if any) will end up on the same line. Since that
- % text will be indented by \tableindent, we make the item text be in
- % a zero-width box.
- \noindent
- \rlap{\hskip -\tableindent\box0}\ignorespaces%
- \endgroup%
- \itemxneedsnegativevskiptrue%
- \fi
-}
-
-\def\item{\errmessage{@item while not in a table}}
-\def\itemx{\errmessage{@itemx while not in a table}}
-\def\kitem{\errmessage{@kitem while not in a table}}
-\def\kitemx{\errmessage{@kitemx while not in a table}}
-\def\xitem{\errmessage{@xitem while not in a table}}
-\def\xitemx{\errmessage{@xitemx while not in a table}}
-
-%% Contains a kludge to get @end[description] to work
-\def\description{\tablez{\dontindex}{1}{}{}{}{}}
-
-\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
-{\obeylines\obeyspaces%
-\gdef\tablex #1^^M{%
-\tabley\dontindex#1 \endtabley}}
-
-\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
-{\obeylines\obeyspaces%
-\gdef\ftablex #1^^M{%
-\tabley\fnitemindex#1 \endtabley
-\def\Eftable{\endgraf\afterenvbreak\endgroup}%
-\let\Etable=\relax}}
-
-\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
-{\obeylines\obeyspaces%
-\gdef\vtablex #1^^M{%
-\tabley\vritemindex#1 \endtabley
-\def\Evtable{\endgraf\afterenvbreak\endgroup}%
-\let\Etable=\relax}}
-
-\def\dontindex #1{}
-\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
-\def\vritemindex #1{\doind {vr}{\code{#1}}}%
-
-{\obeyspaces %
-\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
-\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
-
-\def\tablez #1#2#3#4#5#6{%
-\aboveenvbreak %
-\begingroup %
-\def\Edescription{\Etable}% Necessary kludge.
-\let\itemindex=#1%
-\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
-\ifnum 0#4>0 \tableindent=#4\mil \fi %
-\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
-\def\itemfont{#2}%
-\itemmax=\tableindent %
-\advance \itemmax by -\itemmargin %
-\advance \leftskip by \tableindent %
-\exdentamount=\tableindent
-\parindent = 0pt
-\parskip = \smallskipamount
-\ifdim \parskip=0pt \parskip=2pt \fi%
-\def\Etable{\endgraf\afterenvbreak\endgroup}%
-\let\item = \internalBitem %
-\let\itemx = \internalBitemx %
-\let\kitem = \internalBkitem %
-\let\kitemx = \internalBkitemx %
-\let\xitem = \internalBxitem %
-\let\xitemx = \internalBxitemx %
-}
-
-% This is the counter used by @enumerate, which is really @itemize
-
-\newcount \itemno
-
-\def\itemize{\parsearg\itemizezzz}
-
-\def\itemizezzz #1{%
- \begingroup % ended by the @end itemsize
- \itemizey {#1}{\Eitemize}
-}
-
-\def\itemizey #1#2{%
-\aboveenvbreak %
-\itemmax=\itemindent %
-\advance \itemmax by -\itemmargin %
-\advance \leftskip by \itemindent %
-\exdentamount=\itemindent
-\parindent = 0pt %
-\parskip = \smallskipamount %
-\ifdim \parskip=0pt \parskip=2pt \fi%
-\def#2{\endgraf\afterenvbreak\endgroup}%
-\def\itemcontents{#1}%
-\let\item=\itemizeitem}
-
-% Set sfcode to normal for the chars that usually have another value.
-% These are `.?!:;,'
-\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
- \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
-
-% \splitoff TOKENS\endmark defines \first to be the first token in
-% TOKENS, and \rest to be the remainder.
-%
-\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
-
-% Allow an optional argument of an uppercase letter, lowercase letter,
-% or number, to specify the first label in the enumerated list. No
-% argument is the same as `1'.
-%
-\def\enumerate{\parsearg\enumeratezzz}
-\def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
-\def\enumeratey #1 #2\endenumeratey{%
- \begingroup % ended by the @end enumerate
- %
- % If we were given no argument, pretend we were given `1'.
- \def\thearg{#1}%
- \ifx\thearg\empty \def\thearg{1}\fi
- %
- % Detect if the argument is a single token. If so, it might be a
- % letter. Otherwise, the only valid thing it can be is a number.
- % (We will always have one token, because of the test we just made.
- % This is a good thing, since \splitoff doesn't work given nothing at
- % all -- the first parameter is undelimited.)
- \expandafter\splitoff\thearg\endmark
- \ifx\rest\empty
- % Only one token in the argument. It could still be anything.
- % A ``lowercase letter'' is one whose \lccode is nonzero.
- % An ``uppercase letter'' is one whose \lccode is both nonzero, and
- % not equal to itself.
- % Otherwise, we assume it's a number.
- %
- % We need the \relax at the end of the \ifnum lines to stop TeX from
- % continuing to look for a <number>.
- %
- \ifnum\lccode\expandafter`\thearg=0\relax
- \numericenumerate % a number (we hope)
- \else
- % It's a letter.
- \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
- \lowercaseenumerate % lowercase letter
- \else
- \uppercaseenumerate % uppercase letter
- \fi
- \fi
- \else
- % Multiple tokens in the argument. We hope it's a number.
- \numericenumerate
- \fi
-}
-
-% An @enumerate whose labels are integers. The starting integer is
-% given in \thearg.
-%
-\def\numericenumerate{%
- \itemno = \thearg
- \startenumeration{\the\itemno}%
-}
-
-% The starting (lowercase) letter is in \thearg.
-\def\lowercaseenumerate{%
- \itemno = \expandafter`\thearg
- \startenumeration{%
- % Be sure we're not beyond the end of the alphabet.
- \ifnum\itemno=0
- \errmessage{No more lowercase letters in @enumerate; get a bigger
- alphabet}%
- \fi
- \char\lccode\itemno
- }%
-}
-
-% The starting (uppercase) letter is in \thearg.
-\def\uppercaseenumerate{%
- \itemno = \expandafter`\thearg
- \startenumeration{%
- % Be sure we're not beyond the end of the alphabet.
- \ifnum\itemno=0
- \errmessage{No more uppercase letters in @enumerate; get a bigger
- alphabet}
- \fi
- \char\uccode\itemno
- }%
-}
-
-% Call itemizey, adding a period to the first argument and supplying the
-% common last two arguments. Also subtract one from the initial value in
-% \itemno, since @item increments \itemno.
-%
-\def\startenumeration#1{%
- \advance\itemno by -1
- \itemizey{#1.}\Eenumerate\flushcr
-}
-
-% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
-% to @enumerate.
-%
-\def\alphaenumerate{\enumerate{a}}
-\def\capsenumerate{\enumerate{A}}
-\def\Ealphaenumerate{\Eenumerate}
-\def\Ecapsenumerate{\Eenumerate}
-
-% Definition of @item while inside @itemize.
-
-\def\itemizeitem{%
-\advance\itemno by 1
-{\let\par=\endgraf \smallbreak}%
-\ifhmode \errmessage{\in hmode at itemizeitem}\fi
-{\parskip=0in \hskip 0pt
-\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
-\vadjust{\penalty 1200}}%
-\flushcr}
-
-% @multitable macros
-% Amy Hendrickson, 8/18/94, 3/6/96
-%
-% @multitable ... @end multitable will make as many columns as desired.
-% Contents of each column will wrap at width given in preamble. Width
-% can be specified either with sample text given in a template line,
-% or in percent of \hsize, the current width of text on page.
-
-% Table can continue over pages but will only break between lines.
-
-% To make preamble:
-%
-% Either define widths of columns in terms of percent of \hsize:
-% @multitable @columnfractions .25 .3 .45
-% @item ...
-%
-% Numbers following @columnfractions are the percent of the total
-% current hsize to be used for each column. You may use as many
-% columns as desired.
-
-
-% Or use a template:
-% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-% @item ...
-% using the widest term desired in each column.
-%
-% For those who want to use more than one line's worth of words in
-% the preamble, break the line within one argument and it
-% will parse correctly, i.e.,
-%
-% @multitable {Column 1 template} {Column 2 template} {Column 3
-% template}
-% Not:
-% @multitable {Column 1 template} {Column 2 template}
-% {Column 3 template}
-
-% Each new table line starts with @item, each subsequent new column
-% starts with @tab. Empty columns may be produced by supplying @tab's
-% with nothing between them for as many times as empty columns are needed,
-% ie, @tab@tab@tab will produce two empty columns.
-
-% @item, @tab, @multitable or @end multitable do not need to be on their
-% own lines, but it will not hurt if they are.
-
-% Sample multitable:
-
-% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-% @item first col stuff @tab second col stuff @tab third col
-% @item
-% first col stuff
-% @tab
-% second col stuff
-% @tab
-% third col
-% @item first col stuff @tab second col stuff
-% @tab Many paragraphs of text may be used in any column.
-%
-% They will wrap at the width determined by the template.
-% @item@tab@tab This will be in third column.
-% @end multitable
-
-% Default dimensions may be reset by user.
-% @multitableparskip is vertical space between paragraphs in table.
-% @multitableparindent is paragraph indent in table.
-% @multitablecolmargin is horizontal space to be left between columns.
-% @multitablelinespace is space to leave between table items, baseline
-% to baseline.
-% 0pt means it depends on current normal line spacing.
-
-%%%%
-% Dimensions
-
-\newskip\multitableparskip
-\newskip\multitableparindent
-\newdimen\multitablecolspace
-\newskip\multitablelinespace
-\multitableparskip=0pt
-\multitableparindent=6pt
-\multitablecolspace=12pt
-\multitablelinespace=0pt
-
-%%%%
-% Macros used to set up halign preamble:
-\let\endsetuptable\relax
-\def\xendsetuptable{\endsetuptable}
-\let\columnfractions\relax
-\def\xcolumnfractions{\columnfractions}
-\newif\ifsetpercent
-
-%% 2/1/96, to allow fractions to be given with more than one digit.
-\def\pickupwholefraction#1 {\global\advance\colcount by1 %
-\expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
-\setuptable}
-
-\newcount\colcount
-\def\setuptable#1{\def\firstarg{#1}%
-\ifx\firstarg\xendsetuptable\let\go\relax%
-\else
- \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
- \else
- \ifsetpercent
- \let\go\pickupwholefraction % In this case arg of setuptable
- % is the decimal point before the
- % number given in percent of hsize.
- % We don't need this so we don't use it.
- \else
- \global\advance\colcount by1
- \setbox0=\hbox{#1 }% Add a normal word space as a separator;
- % typically that is always in the input, anyway.
- \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
- \fi%
- \fi%
-\ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
-\fi\go}
-
-%%%%
-% multitable syntax
-\def\tab{&\hskip1sp\relax} % 2/2/96
- % tiny skip here makes sure this column space is
- % maintained, even if it is never used.
-
-
-%%%%
-% @multitable ... @end multitable definitions:
-
-\def\multitable{\parsearg\dotable}
-
-\def\dotable#1{\bgroup
-\let\item\cr
-\tolerance=9500
-\hbadness=9500
-\setmultitablespacing
-\parskip=\multitableparskip
-\parindent=\multitableparindent
-\overfullrule=0pt
-\global\colcount=0\relax%
-\def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
- % To parse everything between @multitable and @item :
-\setuptable#1 \endsetuptable
- % Need to reset this to 0 after \setuptable.
-\global\colcount=0\relax%
- %
- % This preamble sets up a generic column definition, which will
- % be used as many times as user calls for columns.
- % \vtop will set a single line and will also let text wrap and
- % continue for many paragraphs if desired.
-\halign\bgroup&\global\advance\colcount by 1\relax%
-\multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
- % In order to keep entries from bumping into each other
- % we will add a \leftskip of \multitablecolspace to all columns after
- % the first one.
- % If a template has been used, we will add \multitablecolspace
- % to the width of each template entry.
- % If user has set preamble in terms of percent of \hsize
- % we will use that dimension as the width of the column, and
- % the \leftskip will keep entries from bumping into each other.
- % Table will start at left margin and final column will justify at
- % right margin.
-\ifnum\colcount=1
-\else
- \ifsetpercent
- \else
- % If user has <not> set preamble in terms of percent of \hsize
- % we will advance \hsize by \multitablecolspace
- \advance\hsize by \multitablecolspace
- \fi
- % In either case we will make \leftskip=\multitablecolspace:
-\leftskip=\multitablecolspace
-\fi
- % Ignoring space at the beginning and end avoids an occasional spurious
- % blank line, when TeX decides to break the line at the space before the
- % box from the multistrut, so the strut ends up on a line by itself.
- % For example:
- % @multitable @columnfractions .11 .89
- % @item @code{#}
- % @tab Legal holiday which is valid in major parts of the whole country.
- % Is automatically provided with highlighting sequences respectively marking
- % characters.
- \noindent\ignorespaces##\unskip\multistrut}\cr
- % \everycr will reset column counter, \colcount, at the end of
- % each line. Every column entry will cause \colcount to advance by one.
- % The table preamble
- % looks at the current \colcount to find the correct column width.
-\global\everycr{\noalign{%
-% \filbreak%% keeps underfull box messages off when table breaks over pages.
-% Maybe so, but it also creates really weird page breaks when the table
-% breaks over pages Wouldn't \vfil be better? Wait until the problem
-% manifests itself, so it can be fixed for real --karl.
-\global\colcount=0\relax}}
-}
-
-\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
-% If so, do nothing. If not, give it an appropriate dimension based on
-% current baselineskip.
-\ifdim\multitablelinespace=0pt
-%% strut to put in table in case some entry doesn't have descenders,
-%% to keep lines equally spaced
-\let\multistrut = \strut
-%% Test to see if parskip is larger than space between lines of
-%% table. If not, do nothing.
-%% If so, set to same dimension as multitablelinespace.
-\else
-\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
-width0pt\relax} \fi
-\ifdim\multitableparskip>\multitablelinespace
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
- %% than skip between lines in the table.
-\fi%
-\ifdim\multitableparskip=0pt
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
- %% than skip between lines in the table.
-\fi}
-
-
-\message{indexing,}
-% Index generation facilities
-
-% Define \newwrite to be identical to plain tex's \newwrite
-% except not \outer, so it can be used within \newindex.
-{\catcode`\@=11
-\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
-
-% \newindex {foo} defines an index named foo.
-% It automatically defines \fooindex such that
-% \fooindex ...rest of line... puts an entry in the index foo.
-% It also defines \fooindfile to be the number of the output channel for
-% the file that accumulates this index. The file's extension is foo.
-% The name of an index should be no more than 2 characters long
-% for the sake of vms.
-
-\def\newindex #1{
-\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
-\openout \csname#1indfile\endcsname \jobname.#1 % Open the file
-\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
-\noexpand\doindex {#1}}
-}
-
-% @defindex foo == \newindex{foo}
-
-\def\defindex{\parsearg\newindex}
-
-% Define @defcodeindex, like @defindex except put all entries in @code.
-
-\def\newcodeindex #1{
-\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
-\openout \csname#1indfile\endcsname \jobname.#1 % Open the file
-\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
-\noexpand\docodeindex {#1}}
-}
-
-\def\defcodeindex{\parsearg\newcodeindex}
-
-% @synindex foo bar makes index foo feed into index bar.
-% Do this instead of @defindex foo if you don't want it as a separate index.
-\def\synindex #1 #2 {%
-\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
-\expandafter\let\csname#1indfile\endcsname=\synindexfoo
-\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
-\noexpand\doindex {#2}}%
-}
-
-% @syncodeindex foo bar similar, but put all entries made for index foo
-% inside @code.
-\def\syncodeindex #1 #2 {%
-\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
-\expandafter\let\csname#1indfile\endcsname=\synindexfoo
-\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
-\noexpand\docodeindex {#2}}%
-}
-
-% Define \doindex, the driver for all \fooindex macros.
-% Argument #1 is generated by the calling \fooindex macro,
-% and it is "foo", the name of the index.
-
-% \doindex just uses \parsearg; it calls \doind for the actual work.
-% This is because \doind is more useful to call from other macros.
-
-% There is also \dosubind {index}{topic}{subtopic}
-% which makes an entry in a two-level index such as the operation index.
-
-\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
-\def\singleindexer #1{\doind{\indexname}{#1}}
-
-% like the previous two, but they put @code around the argument.
-\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
-\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
-
-\def\indexdummies{%
-% Take care of the plain tex accent commands.
-\def\"{\realbackslash "}%
-\def\`{\realbackslash `}%
-\def\'{\realbackslash '}%
-\def\^{\realbackslash ^}%
-\def\~{\realbackslash ~}%
-\def\={\realbackslash =}%
-\def\b{\realbackslash b}%
-\def\c{\realbackslash c}%
-\def\d{\realbackslash d}%
-\def\u{\realbackslash u}%
-\def\v{\realbackslash v}%
-\def\H{\realbackslash H}%
-% Take care of the plain tex special European modified letters.
-\def\oe{\realbackslash oe}%
-\def\ae{\realbackslash ae}%
-\def\aa{\realbackslash aa}%
-\def\OE{\realbackslash OE}%
-\def\AE{\realbackslash AE}%
-\def\AA{\realbackslash AA}%
-\def\o{\realbackslash o}%
-\def\O{\realbackslash O}%
-\def\l{\realbackslash l}%
-\def\L{\realbackslash L}%
-\def\ss{\realbackslash ss}%
-% Take care of texinfo commands likely to appear in an index entry.
-% (Must be a way to avoid doing expansion at all, and thus not have to
-% laboriously list every single command here.)
-\def\@{@}% will be @@ when we switch to @ as escape char.
-%\let\{ = \lbracecmd
-%\let\} = \rbracecmd
-\def\_{{\realbackslash _}}%
-\def\w{\realbackslash w }%
-\def\bf{\realbackslash bf }%
-%\def\rm{\realbackslash rm }%
-\def\sl{\realbackslash sl }%
-\def\sf{\realbackslash sf}%
-\def\tt{\realbackslash tt}%
-\def\gtr{\realbackslash gtr}%
-\def\less{\realbackslash less}%
-\def\hat{\realbackslash hat}%
-%\def\char{\realbackslash char}%
-\def\TeX{\realbackslash TeX}%
-\def\dots{\realbackslash dots }%
-\def\copyright{\realbackslash copyright }%
-\def\tclose##1{\realbackslash tclose {##1}}%
-\def\code##1{\realbackslash code {##1}}%
-\def\dotless##1{\realbackslash dotless {##1}}%
-\def\samp##1{\realbackslash samp {##1}}%
-\def\,##1{\realbackslash ,{##1}}%
-\def\t##1{\realbackslash t {##1}}%
-\def\r##1{\realbackslash r {##1}}%
-\def\i##1{\realbackslash i {##1}}%
-\def\b##1{\realbackslash b {##1}}%
-\def\cite##1{\realbackslash cite {##1}}%
-\def\key##1{\realbackslash key {##1}}%
-\def\file##1{\realbackslash file {##1}}%
-\def\var##1{\realbackslash var {##1}}%
-\def\kbd##1{\realbackslash kbd {##1}}%
-\def\dfn##1{\realbackslash dfn {##1}}%
-\def\emph##1{\realbackslash emph {##1}}%
-\unsepspaces
-}
-
-% If an index command is used in an @example environment, any spaces
-% therein should become regular spaces in the raw index file, not the
-% expansion of \tie (\\leavevmode \penalty \@M \ ).
-{\obeyspaces
- \gdef\unsepspaces{\obeyspaces\let =\space}}
-
-% \indexnofonts no-ops all font-change commands.
-% This is used when outputting the strings to sort the index by.
-\def\indexdummyfont#1{#1}
-\def\indexdummytex{TeX}
-\def\indexdummydots{...}
-
-\def\indexnofonts{%
-% Just ignore accents.
-\let\,=\indexdummyfont
-\let\"=\indexdummyfont
-\let\`=\indexdummyfont
-\let\'=\indexdummyfont
-\let\^=\indexdummyfont
-\let\~=\indexdummyfont
-\let\==\indexdummyfont
-\let\b=\indexdummyfont
-\let\c=\indexdummyfont
-\let\d=\indexdummyfont
-\let\u=\indexdummyfont
-\let\v=\indexdummyfont
-\let\H=\indexdummyfont
-\let\dotless=\indexdummyfont
-% Take care of the plain tex special European modified letters.
-\def\oe{oe}%
-\def\ae{ae}%
-\def\aa{aa}%
-\def\OE{OE}%
-\def\AE{AE}%
-\def\AA{AA}%
-\def\o{o}%
-\def\O{O}%
-\def\l{l}%
-\def\L{L}%
-\def\ss{ss}%
-\let\w=\indexdummyfont
-\let\t=\indexdummyfont
-\let\r=\indexdummyfont
-\let\i=\indexdummyfont
-\let\b=\indexdummyfont
-\let\emph=\indexdummyfont
-\let\strong=\indexdummyfont
-\let\cite=\indexdummyfont
-\let\sc=\indexdummyfont
-%Don't no-op \tt, since it isn't a user-level command
-% and is used in the definitions of the active chars like <, >, |...
-%\let\tt=\indexdummyfont
-\let\tclose=\indexdummyfont
-\let\code=\indexdummyfont
-\let\file=\indexdummyfont
-\let\samp=\indexdummyfont
-\let\kbd=\indexdummyfont
-\let\key=\indexdummyfont
-\let\var=\indexdummyfont
-\let\TeX=\indexdummytex
-\let\dots=\indexdummydots
-\def\@{@}%
-}
-
-% To define \realbackslash, we must make \ not be an escape.
-% We must first make another character (@) an escape
-% so we do not become unable to do a definition.
-
-{\catcode`\@=0 \catcode`\\=\other
-@gdef@realbackslash{\}}
-
-\let\indexbackslash=0 %overridden during \printindex.
-
-\let\SETmarginindex=\relax %initialize!
-% workhorse for all \fooindexes
-% #1 is name of index, #2 is stuff to put there
-\def\doind #1#2{%
- % Put the index entry in the margin if desired.
- \ifx\SETmarginindex\relax\else
- \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
- \fi
- {%
- \count255=\lastpenalty
- {%
- \indexdummies % Must do this here, since \bf, etc expand at this stage
- \escapechar=`\\
- {%
- \let\folio=0% We will expand all macros now EXCEPT \folio.
- \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
- % so it will be output as is; and it will print as backslash.
- %
- % First process the index-string with all font commands turned off
- % to get the string to sort by.
- {\indexnofonts \xdef\indexsorttmp{#2}}%
- %
- % Now produce the complete index entry, with both the sort key and the
- % original text, including any font commands.
- \toks0 = {#2}%
- \edef\temp{%
- \write\csname#1indfile\endcsname{%
- \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
- }%
- \temp
- }%
- }%
- \penalty\count255
- }%
-}
-
-\def\dosubind #1#2#3{%
-{\count10=\lastpenalty %
-{\indexdummies % Must do this here, since \bf, etc expand at this stage
-\escapechar=`\\%
-{\let\folio=0%
-\def\rawbackslashxx{\indexbackslash}%
-%
-% Now process the index-string once, with all font commands turned off,
-% to get the string to sort the index by.
-{\indexnofonts
-\xdef\temp1{#2 #3}%
-}%
-% Now produce the complete index entry. We process the index-string again,
-% this time with font commands expanded, to get what to print in the index.
-\edef\temp{%
-\write \csname#1indfile\endcsname{%
-\realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
-\temp }%
-}\penalty\count10}}
-
-% The index entry written in the file actually looks like
-% \entry {sortstring}{page}{topic}
-% or
-% \entry {sortstring}{page}{topic}{subtopic}
-% The texindex program reads in these files and writes files
-% containing these kinds of lines:
-% \initial {c}
-% before the first topic whose initial is c
-% \entry {topic}{pagelist}
-% for a topic that is used without subtopics
-% \primary {topic}
-% for the beginning of a topic that is used with subtopics
-% \secondary {subtopic}{pagelist}
-% for each subtopic.
-
-% Define the user-accessible indexing commands
-% @findex, @vindex, @kindex, @cindex.
-
-\def\findex {\fnindex}
-\def\kindex {\kyindex}
-\def\cindex {\cpindex}
-\def\vindex {\vrindex}
-\def\tindex {\tpindex}
-\def\pindex {\pgindex}
-
-\def\cindexsub {\begingroup\obeylines\cindexsub}
-{\obeylines %
-\gdef\cindexsub "#1" #2^^M{\endgroup %
-\dosubind{cp}{#2}{#1}}}
-
-% Define the macros used in formatting output of the sorted index material.
-
-% This is what you call to cause a particular index to get printed.
-% Write
-% @unnumbered Function Index
-% @printindex fn
-
-\def\printindex{\parsearg\doprintindex}
-
-\def\doprintindex#1{\begingroup
- \dobreak \chapheadingskip{10000}%
- %
- \indexfonts \rm
- \tolerance = 9500
- \indexbreaks
- \def\indexbackslash{\rawbackslashxx}%
- % Index files are almost Texinfo source, but we use \ as the escape
- % character. It would be better to use @, but that's too big a change
- % to make right now.
- \catcode`\\ = 0
- \catcode`\@ = 11
- \escapechar = `\\
- \begindoublecolumns
- %
- % See if the index file exists and is nonempty.
- \openin 1 \jobname.#1s
- \ifeof 1
- % \enddoublecolumns gets confused if there is no text in the index,
- % and it loses the chapter title and the aux file entries for the
- % index. The easiest way to prevent this problem is to make sure
- % there is some text.
- (Index is nonexistent)
- \else
- %
- % If the index file exists but is empty, then \openin leaves \ifeof
- % false. We have to make TeX try to read something from the file, so
- % it can discover if there is anything in it.
- \read 1 to \temp
- \ifeof 1
- (Index is empty)
- \else
- \input \jobname.#1s
- \fi
- \fi
- \closein 1
- \enddoublecolumns
-\endgroup}
-
-% These macros are used by the sorted index file itself.
-% Change them to control the appearance of the index.
-
-% Same as \bigskipamount except no shrink.
-% \balancecolumns gets confused if there is any shrink.
-\newskip\initialskipamount \initialskipamount 12pt plus4pt
-
-\def\initial #1{%
-{\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
-\ifdim\lastskip<\initialskipamount
-\removelastskip \penalty-200 \vskip \initialskipamount\fi
-\line{\secbf#1\hfill}\kern 2pt\penalty10000}}
-
-% This typesets a paragraph consisting of #1, dot leaders, and then #2
-% flush to the right margin. It is used for index and table of contents
-% entries. The paragraph is indented by \leftskip.
-%
-\def\entry #1#2{\begingroup
- %
- % Start a new paragraph if necessary, so our assignments below can't
- % affect previous text.
- \par
- %
- % Do not fill out the last line with white space.
- \parfillskip = 0in
- %
- % No extra space above this paragraph.
- \parskip = 0in
- %
- % Do not prefer a separate line ending with a hyphen to fewer lines.
- \finalhyphendemerits = 0
- %
- % \hangindent is only relevant when the entry text and page number
- % don't both fit on one line. In that case, bob suggests starting the
- % dots pretty far over on the line. Unfortunately, a large
- % indentation looks wrong when the entry text itself is broken across
- % lines. So we use a small indentation and put up with long leaders.
- %
- % \hangafter is reset to 1 (which is the value we want) at the start
- % of each paragraph, so we need not do anything with that.
- \hangindent=2em
- %
- % When the entry text needs to be broken, just fill out the first line
- % with blank space.
- \rightskip = 0pt plus1fil
- %
- % Start a ``paragraph'' for the index entry so the line breaking
- % parameters we've set above will have an effect.
- \noindent
- %
- % Insert the text of the index entry. TeX will do line-breaking on it.
- #1%
- % The following is kludged to not output a line of dots in the index if
- % there are no page numbers. The next person who breaks this will be
- % cursed by a Unix daemon.
- \def\tempa{{\rm }}%
- \def\tempb{#2}%
- \edef\tempc{\tempa}%
- \edef\tempd{\tempb}%
- \ifx\tempc\tempd\ \else%
- %
- % If we must, put the page number on a line of its own, and fill out
- % this line with blank space. (The \hfil is overwhelmed with the
- % fill leaders glue in \indexdotfill if the page number does fit.)
- \hfil\penalty50
- \null\nobreak\indexdotfill % Have leaders before the page number.
- %
- % The `\ ' here is removed by the implicit \unskip that TeX does as
- % part of (the primitive) \par. Without it, a spurious underfull
- % \hbox ensues.
- \ #2% The page number ends the paragraph.
- \fi%
- \par
-\endgroup}
-
-% Like \dotfill except takes at least 1 em.
-\def\indexdotfill{\cleaders
- \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
-
-\def\primary #1{\line{#1\hfil}}
-
-\newskip\secondaryindent \secondaryindent=0.5cm
-
-\def\secondary #1#2{
-{\parfillskip=0in \parskip=0in
-\hangindent =1in \hangafter=1
-\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
-}}
-
-% Define two-column mode, which we use to typeset indexes.
-% Adapted from the TeXbook, page 416, which is to say,
-% the manmac.tex format used to print the TeXbook itself.
-\catcode`\@=11
-
-\newbox\partialpage
-\newdimen\doublecolumnhsize
-
-\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
- % Grab any single-column material above us.
- \output = {\global\setbox\partialpage
- =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
- \eject
- %
- % Now switch to the double-column output routine.
- \output={\doublecolumnout}%
- %
- % Change the page size parameters. We could do this once outside this
- % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
- % format, but then we repeat the same computation. Repeating a couple
- % of assignments once per index is clearly meaningless for the
- % execution time, so we may as well do it once.
- %
- % First we halve the line length, less a little for the gutter between
- % the columns. We compute the gutter based on the line length, so it
- % changes automatically with the paper format. The magic constant
- % below is chosen so that the gutter has the same value (well, +- <
- % 1pt) as it did when we hard-coded it.
- %
- % We put the result in a separate register, \doublecolumhsize, so we
- % can restore it in \pagesofar, after \hsize itself has (potentially)
- % been clobbered.
- %
- \doublecolumnhsize = \hsize
- \advance\doublecolumnhsize by -.04154\hsize
- \divide\doublecolumnhsize by 2
- \hsize = \doublecolumnhsize
- %
- % Double the \vsize as well. (We don't need a separate register here,
- % since nobody clobbers \vsize.)
- \vsize = 2\vsize
-}
-\def\doublecolumnout{%
- \splittopskip=\topskip \splitmaxdepth=\maxdepth
- % Get the available space for the double columns -- the normal
- % (undoubled) page height minus any material left over from the
- % previous page.
- \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
- % box0 will be the left-hand column, box1 the right.
- \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
- \onepageout\pagesofar
- \unvbox255 \penalty\outputpenalty
-}
-\def\pagesofar{%
- % The contents of the output page -- any previous material,
- % followed by the two boxes we just split.
- \unvbox\partialpage
- \hsize = \doublecolumnhsize
- \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
-}
-\def\enddoublecolumns{%
- \output={\balancecolumns}\eject % split what we have
- \endgroup
- % Back to normal single-column typesetting, but take account of the
- % fact that we just accumulated some stuff on the output page.
- \pagegoal=\vsize
-}
-\def\balancecolumns{%
- % Called on the last page of the double column material.
- \setbox0=\vbox{\unvbox255}%
- \dimen@ = \ht0
- \advance\dimen@ by \topskip
- \advance\dimen@ by-\baselineskip
- \divide\dimen@ by 2
- \splittopskip = \topskip
- % Loop until we get a decent breakpoint.
- {\vbadness=10000 \loop \global\setbox3=\copy0
- \global\setbox1=\vsplit3 to\dimen@
- \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}%
- \setbox0=\vbox to\dimen@{\unvbox1}%
- \setbox2=\vbox to\dimen@{\unvbox3}%
- \pagesofar
-}
-\catcode `\@=\other
-
-
-\message{sectioning,}
-% Define chapters, sections, etc.
-
-\newcount \chapno
-\newcount \secno \secno=0
-\newcount \subsecno \subsecno=0
-\newcount \subsubsecno \subsubsecno=0
-
-% This counter is funny since it counts through charcodes of letters A, B, ...
-\newcount \appendixno \appendixno = `\@
-\def\appendixletter{\char\the\appendixno}
-
-\newwrite \contentsfile
-% This is called from \setfilename.
-\def\opencontents{\openout \contentsfile = \jobname.toc}
-
-% Each @chapter defines this as the name of the chapter.
-% page headings and footings can use it. @section does likewise
-
-\def\thischapter{} \def\thissection{}
-\def\seccheck#1{\if \pageno<0 %
-\errmessage{@#1 not allowed after generating table of contents}\fi
-%
-}
-
-\def\chapternofonts{%
-\let\rawbackslash=\relax%
-\let\frenchspacing=\relax%
-\def\result{\realbackslash result}
-\def\equiv{\realbackslash equiv}
-\def\expansion{\realbackslash expansion}
-\def\print{\realbackslash print}
-\def\TeX{\realbackslash TeX}
-\def\dots{\realbackslash dots}
-\def\copyright{\realbackslash copyright}
-\def\tt{\realbackslash tt}
-\def\bf{\realbackslash bf }
-\def\w{\realbackslash w}
-\def\less{\realbackslash less}
-\def\gtr{\realbackslash gtr}
-\def\hat{\realbackslash hat}
-\def\char{\realbackslash char}
-\def\tclose##1{\realbackslash tclose {##1}}
-\def\code##1{\realbackslash code {##1}}
-\def\samp##1{\realbackslash samp {##1}}
-\def\r##1{\realbackslash r {##1}}
-\def\b##1{\realbackslash b {##1}}
-\def\key##1{\realbackslash key {##1}}
-\def\file##1{\realbackslash file {##1}}
-\def\kbd##1{\realbackslash kbd {##1}}
-% These are redefined because @smartitalic wouldn't work inside xdef.
-\def\i##1{\realbackslash i {##1}}
-\def\cite##1{\realbackslash cite {##1}}
-\def\var##1{\realbackslash var {##1}}
-\def\emph##1{\realbackslash emph {##1}}
-\def\dfn##1{\realbackslash dfn {##1}}
-}
-
-\newcount\absseclevel % used to calculate proper heading level
-\newcount\secbase\secbase=0 % @raise/lowersections modify this count
-
-% @raisesections: treat @section as chapter, @subsection as section, etc.
-\def\raisesections{\global\advance\secbase by -1}
-\let\up=\raisesections % original BFox name
-
-% @lowersections: treat @chapter as section, @section as subsection, etc.
-\def\lowersections{\global\advance\secbase by 1}
-\let\down=\lowersections % original BFox name
-
-% Choose a numbered-heading macro
-% #1 is heading level if unmodified by @raisesections or @lowersections
-% #2 is text for heading
-\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
- \chapterzzz{#2}
-\or
- \seczzz{#2}
-\or
- \numberedsubseczzz{#2}
-\or
- \numberedsubsubseczzz{#2}
-\else
- \ifnum \absseclevel<0
- \chapterzzz{#2}
- \else
- \numberedsubsubseczzz{#2}
- \fi
-\fi
-}
-
-% like \numhead, but chooses appendix heading levels
-\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
- \appendixzzz{#2}
-\or
- \appendixsectionzzz{#2}
-\or
- \appendixsubseczzz{#2}
-\or
- \appendixsubsubseczzz{#2}
-\else
- \ifnum \absseclevel<0
- \appendixzzz{#2}
- \else
- \appendixsubsubseczzz{#2}
- \fi
-\fi
-}
-
-% like \numhead, but chooses numberless heading levels
-\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
- \unnumberedzzz{#2}
-\or
- \unnumberedseczzz{#2}
-\or
- \unnumberedsubseczzz{#2}
-\or
- \unnumberedsubsubseczzz{#2}
-\else
- \ifnum \absseclevel<0
- \unnumberedzzz{#2}
- \else
- \unnumberedsubsubseczzz{#2}
- \fi
-\fi
-}
-
-
-\def\thischaptername{No Chapter Title}
-\outer\def\chapter{\parsearg\chapteryyy}
-\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
-\def\chapterzzz #1{\seccheck{chapter}%
-\secno=0 \subsecno=0 \subsubsecno=0
-\global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
-\chapmacro {#1}{\the\chapno}%
-\gdef\thissection{#1}%
-\gdef\thischaptername{#1}%
-% We don't substitute the actual chapter name into \thischapter
-% because we don't want its macros evaluated now.
-\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
-{\chapternofonts%
-\edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\donoderef %
-\global\let\section = \numberedsec
-\global\let\subsection = \numberedsubsec
-\global\let\subsubsection = \numberedsubsubsec
-}}
-
-\outer\def\appendix{\parsearg\appendixyyy}
-\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
-\def\appendixzzz #1{\seccheck{appendix}%
-\secno=0 \subsecno=0 \subsubsecno=0
-\global\advance \appendixno by 1 \message{Appendix \appendixletter}%
-\chapmacro {#1}{\putwordAppendix{} \appendixletter}%
-\gdef\thissection{#1}%
-\gdef\thischaptername{#1}%
-\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
-{\chapternofonts%
-\edef\temp{{\realbackslash chapentry
- {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\appendixnoderef %
-\global\let\section = \appendixsec
-\global\let\subsection = \appendixsubsec
-\global\let\subsubsection = \appendixsubsubsec
-}}
-
-% @centerchap is like @unnumbered, but the heading is centered.
-\outer\def\centerchap{\parsearg\centerchapyyy}
-\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
-
-\outer\def\top{\parsearg\unnumberedyyy}
-\outer\def\unnumbered{\parsearg\unnumberedyyy}
-\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
-\def\unnumberedzzz #1{\seccheck{unnumbered}%
-\secno=0 \subsecno=0 \subsubsecno=0
-%
-% This used to be simply \message{#1}, but TeX fully expands the
-% argument to \message. Therefore, if #1 contained @-commands, TeX
-% expanded them. For example, in `@unnumbered The @cite{Book}', TeX
-% expanded @cite (which turns out to cause errors because \cite is meant
-% to be executed, not expanded).
-%
-% Anyway, we don't want the fully-expanded definition of @cite to appear
-% as a result of the \message, we just want `@cite' itself. We use
-% \the<toks register> to achieve this: TeX expands \the<toks> only once,
-% simply yielding the contents of the <toks register>.
-\toks0 = {#1}\message{(\the\toks0)}%
-%
-\unnumbchapmacro {#1}%
-\gdef\thischapter{#1}\gdef\thissection{#1}%
-{\chapternofonts%
-\edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\unnumbnoderef %
-\global\let\section = \unnumberedsec
-\global\let\subsection = \unnumberedsubsec
-\global\let\subsubsection = \unnumberedsubsubsec
-}}
-
-\outer\def\numberedsec{\parsearg\secyyy}
-\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
-\def\seczzz #1{\seccheck{section}%
-\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
-\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash secentry %
-{#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\donoderef %
-\penalty 10000 %
-}}
-
-\outer\def\appendixsection{\parsearg\appendixsecyyy}
-\outer\def\appendixsec{\parsearg\appendixsecyyy}
-\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
-\def\appendixsectionzzz #1{\seccheck{appendixsection}%
-\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
-\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash secentry %
-{#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\appendixnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
-\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
-\def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
-\plainsecheading {#1}\gdef\thissection{#1}%
-{\chapternofonts%
-\edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\unnumbnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
-\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
-\def\numberedsubseczzz #1{\seccheck{subsection}%
-\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
-\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash subsecentry %
-{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\donoderef %
-\penalty 10000 %
-}}
-
-\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
-\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
-\def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
-\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
-\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash subsecentry %
-{#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\appendixnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
-\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
-\def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
-\plainsubsecheading {#1}\gdef\thissection{#1}%
-{\chapternofonts%
-\edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\unnumbnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
-\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
-\def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
-\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
-\subsubsecheading {#1}
- {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash subsubsecentry %
- {#1}
- {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
- {\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\donoderef %
-\penalty 10000 %
-}}
-
-\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
-\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
-\def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
-\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
-\subsubsecheading {#1}
- {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash subsubsecentry{#1}%
- {\appendixletter}
- {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\appendixnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
-\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
-\def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
-\plainsubsubsecheading {#1}\gdef\thissection{#1}%
-{\chapternofonts%
-\edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\unnumbnoderef %
-\penalty 10000 %
-}}
-
-% These are variants which are not "outer", so they can appear in @ifinfo.
-% Actually, they should now be obsolete; ordinary section commands should work.
-\def\infotop{\parsearg\unnumberedzzz}
-\def\infounnumbered{\parsearg\unnumberedzzz}
-\def\infounnumberedsec{\parsearg\unnumberedseczzz}
-\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
-\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
-
-\def\infoappendix{\parsearg\appendixzzz}
-\def\infoappendixsec{\parsearg\appendixseczzz}
-\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
-\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
-
-\def\infochapter{\parsearg\chapterzzz}
-\def\infosection{\parsearg\sectionzzz}
-\def\infosubsection{\parsearg\subsectionzzz}
-\def\infosubsubsection{\parsearg\subsubsectionzzz}
-
-% These macros control what the section commands do, according
-% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
-% Define them by default for a numbered chapter.
-\global\let\section = \numberedsec
-\global\let\subsection = \numberedsubsec
-\global\let\subsubsection = \numberedsubsubsec
-
-% Define @majorheading, @heading and @subheading
-
-% NOTE on use of \vbox for chapter headings, section headings, and
-% such:
-% 1) We use \vbox rather than the earlier \line to permit
-% overlong headings to fold.
-% 2) \hyphenpenalty is set to 10000 because hyphenation in a
-% heading is obnoxious; this forbids it.
-% 3) Likewise, headings look best if no \parindent is used, and
-% if justification is not attempted. Hence \raggedright.
-
-
-\def\majorheading{\parsearg\majorheadingzzz}
-\def\majorheadingzzz #1{%
-{\advance\chapheadingskip by 10pt \chapbreak }%
-{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\raggedright
- \rm #1\hfill}}\bigskip \par\penalty 200}
-
-\def\chapheading{\parsearg\chapheadingzzz}
-\def\chapheadingzzz #1{\chapbreak %
-{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\raggedright
- \rm #1\hfill}}\bigskip \par\penalty 200}
-
-% @heading, @subheading, @subsubheading.
-\def\heading{\parsearg\plainsecheading}
-\def\subheading{\parsearg\plainsubsecheading}
-\def\subsubheading{\parsearg\plainsubsubsecheading}
-
-% These macros generate a chapter, section, etc. heading only
-% (including whitespace, linebreaking, etc. around it),
-% given all the information in convenient, parsed form.
-
-%%% Args are the skip and penalty (usually negative)
-\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
-
-\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
-
-%%% Define plain chapter starts, and page on/off switching for it
-% Parameter controlling skip before chapter headings (if needed)
-
-\newskip\chapheadingskip
-
-\def\chapbreak{\dobreak \chapheadingskip {-4000}}
-\def\chappager{\par\vfill\supereject}
-\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
-
-\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
-
-\def\CHAPPAGoff{
-\global\let\contentsalignmacro = \chappager
-\global\let\pchapsepmacro=\chapbreak
-\global\let\pagealignmacro=\chappager}
-
-\def\CHAPPAGon{
-\global\let\contentsalignmacro = \chappager
-\global\let\pchapsepmacro=\chappager
-\global\let\pagealignmacro=\chappager
-\global\def\HEADINGSon{\HEADINGSsingle}}
-
-\def\CHAPPAGodd{
-\global\let\contentsalignmacro = \chapoddpage
-\global\let\pchapsepmacro=\chapoddpage
-\global\let\pagealignmacro=\chapoddpage
-\global\def\HEADINGSon{\HEADINGSdouble}}
-
-\CHAPPAGon
-
-\def\CHAPFplain{
-\global\let\chapmacro=\chfplain
-\global\let\unnumbchapmacro=\unnchfplain
-\global\let\centerchapmacro=\centerchfplain}
-
-% Plain chapter opening.
-% #1 is the text, #2 the chapter number or empty if unnumbered.
-\def\chfplain#1#2{%
- \pchapsepmacro
- {%
- \chapfonts \rm
- \def\chapnum{#2}%
- \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
- \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
- \hangindent = \wd0 \centerparametersmaybe
- \unhbox0 #1\par}%
- }%
- \nobreak\bigskip % no page break after a chapter title
- \nobreak
-}
-
-% Plain opening for unnumbered.
-\def\unnchfplain#1{\chfplain{#1}{}}
-
-% @centerchap -- centered and unnumbered.
-\let\centerparametersmaybe = \relax
-\def\centerchfplain#1{{%
- \def\centerparametersmaybe{%
- \advance\rightskip by 3\rightskip
- \leftskip = \rightskip
- \parfillskip = 0pt
- }%
- \chfplain{#1}{}%
-}}
-
-\CHAPFplain % The default
-
-\def\unnchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\raggedright
- \rm #1\hfill}}\bigskip \par\penalty 10000 %
-}
-
-\def\chfopen #1#2{\chapoddpage {\chapfonts
-\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
-\par\penalty 5000 %
-}
-
-\def\centerchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt
- \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 %
-}
-
-\def\CHAPFopen{
-\global\let\chapmacro=\chfopen
-\global\let\unnumbchapmacro=\unnchfopen
-\global\let\centerchapmacro=\centerchfopen}
-
-
-% Section titles.
-\newskip\secheadingskip
-\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
-\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
-\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
-
-% Subsection titles.
-\newskip \subsecheadingskip
-\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
-\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
-\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
-
-% Subsubsection titles.
-\let\subsubsecheadingskip = \subsecheadingskip
-\let\subsubsecheadingbreak = \subsecheadingbreak
-\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
-\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
-
-
-% Print any size section title.
-%
-% #1 is the section type (sec/subsec/subsubsec), #2 is the section
-% number (maybe empty), #3 the text.
-\def\sectionheading#1#2#3{%
- {%
- \expandafter\advance\csname #1headingskip\endcsname by \parskip
- \csname #1headingbreak\endcsname
- }%
- {%
- % Switch to the right set of fonts.
- \csname #1fonts\endcsname \rm
- %
- % Only insert the separating space if we have a section number.
- \def\secnum{#2}%
- \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
- %
- \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
- \hangindent = \wd0 % zero if no section number
- \unhbox0 #3}%
- }%
- \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
-}
-
-
-\message{toc printing,}
-% Finish up the main text and prepare to read what we've written
-% to \contentsfile.
-
-\newskip\contentsrightmargin \contentsrightmargin=1in
-\def\startcontents#1{%
- % If @setchapternewpage on, and @headings double, the contents should
- % start on an odd page, unlike chapters. Thus, we maintain
- % \contentsalignmacro in parallel with \pagealignmacro.
- % From: Torbjorn Granlund <tege@matematik.su.se>
- \contentsalignmacro
- \immediate\closeout \contentsfile
- \ifnum \pageno>0
- \pageno = -1 % Request roman numbered pages.
- \fi
- % Don't need to put `Contents' or `Short Contents' in the headline.
- % It is abundantly clear what they are.
- \unnumbchapmacro{#1}\def\thischapter{}%
- \begingroup % Set up to handle contents files properly.
- \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
- \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
- \raggedbottom % Worry more about breakpoints than the bottom.
- \advance\hsize by -\contentsrightmargin % Don't use the full line length.
-}
-
-
-% Normal (long) toc.
-\outer\def\contents{%
- \startcontents{\putwordTableofContents}%
- \input \jobname.toc
- \endgroup
- \vfill \eject
-}
-
-% And just the chapters.
-\outer\def\summarycontents{%
- \startcontents{\putwordShortContents}%
- %
- \let\chapentry = \shortchapentry
- \let\unnumbchapentry = \shortunnumberedentry
- % We want a true roman here for the page numbers.
- \secfonts
- \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
- \rm
- \hyphenpenalty = 10000
- \advance\baselineskip by 1pt % Open it up a little.
- \def\secentry ##1##2##3##4{}
- \def\unnumbsecentry ##1##2{}
- \def\subsecentry ##1##2##3##4##5{}
- \def\unnumbsubsecentry ##1##2{}
- \def\subsubsecentry ##1##2##3##4##5##6{}
- \def\unnumbsubsubsecentry ##1##2{}
- \input \jobname.toc
- \endgroup
- \vfill \eject
-}
-\let\shortcontents = \summarycontents
-
-% These macros generate individual entries in the table of contents.
-% The first argument is the chapter or section name.
-% The last argument is the page number.
-% The arguments in between are the chapter number, section number, ...
-
-% Chapter-level things, for both the long and short contents.
-\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
-
-% See comments in \dochapentry re vbox and related settings
-\def\shortchapentry#1#2#3{%
- \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
-}
-
-% Typeset the label for a chapter or appendix for the short contents.
-% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
-% We could simplify the code here by writing out an \appendixentry
-% command in the toc file for appendices, instead of using \chapentry
-% for both, but it doesn't seem worth it.
-\setbox0 = \hbox{\shortcontrm \putwordAppendix }
-\newdimen\shortappendixwidth \shortappendixwidth = \wd0
-
-\def\shortchaplabel#1{%
- % We typeset #1 in a box of constant width, regardless of the text of
- % #1, so the chapter titles will come out aligned.
- \setbox0 = \hbox{#1}%
- \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
- %
- % This space should be plenty, since a single number is .5em, and the
- % widest letter (M) is 1em, at least in the Computer Modern fonts.
- % (This space doesn't include the extra space that gets added after
- % the label; that gets put in by \shortchapentry above.)
- \advance\dimen0 by 1.1em
- \hbox to \dimen0{#1\hfil}%
-}
-
-\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
-\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
-
-% Sections.
-\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
-\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
-
-% Subsections.
-\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
-\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
-
-% And subsubsections.
-\def\subsubsecentry#1#2#3#4#5#6{%
- \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
-\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
-
-% This parameter controls the indentation of the various levels.
-\newdimen\tocindent \tocindent = 3pc
-
-% Now for the actual typesetting. In all these, #1 is the text and #2 is the
-% page number.
-%
-% If the toc has to be broken over pages, we want it to be at chapters
-% if at all possible; hence the \penalty.
-\def\dochapentry#1#2{%
- \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
- \begingroup
- \chapentryfonts
- \tocentry{#1}{\dopageno{#2}}%
- \endgroup
- \nobreak\vskip .25\baselineskip plus.1\baselineskip
-}
-
-\def\dosecentry#1#2{\begingroup
- \secentryfonts \leftskip=\tocindent
- \tocentry{#1}{\dopageno{#2}}%
-\endgroup}
-
-\def\dosubsecentry#1#2{\begingroup
- \subsecentryfonts \leftskip=2\tocindent
- \tocentry{#1}{\dopageno{#2}}%
-\endgroup}
-
-\def\dosubsubsecentry#1#2{\begingroup
- \subsubsecentryfonts \leftskip=3\tocindent
- \tocentry{#1}{\dopageno{#2}}%
-\endgroup}
-
-% Final typesetting of a toc entry; we use the same \entry macro as for
-% the index entries, but we want to suppress hyphenation here. (We
-% can't do that in the \entry macro, since index entries might consist
-% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
-%
-% \turnoffactive is for the sake of @" used for umlauts.
-\def\tocentry#1#2{\begingroup
- \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
- \entry{\turnoffactive #1}{\turnoffactive #2}%
-\endgroup}
-
-% Space between chapter (or whatever) number and the title.
-\def\labelspace{\hskip1em \relax}
-
-\def\dopageno#1{{\rm #1}}
-\def\doshortpageno#1{{\rm #1}}
-
-\def\chapentryfonts{\secfonts \rm}
-\def\secentryfonts{\textfonts}
-\let\subsecentryfonts = \textfonts
-\let\subsubsecentryfonts = \textfonts
-
-
-\message{environments,}
-
-% Since these characters are used in examples, it should be an even number of
-% \tt widths. Each \tt character is 1en, so two makes it 1em.
-% Furthermore, these definitions must come after we define our fonts.
-\newbox\dblarrowbox \newbox\longdblarrowbox
-\newbox\pushcharbox \newbox\bullbox
-\newbox\equivbox \newbox\errorbox
-
-%{\tentt
-%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
-%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
-%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
-%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
-% Adapted from the manmac format (p.420 of TeXbook)
-%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
-% depth .1ex\hfil}
-%}
-
-% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
-\def\point{$\star$}
-\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
-\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
-\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
-\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
-
-% Adapted from the TeXbook's \boxit.
-{\tentt \global\dimen0 = 3em}% Width of the box.
-\dimen2 = .55pt % Thickness of rules
-% The text. (`r' is open on the right, `e' somewhat less so on the left.)
-\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
-
-\global\setbox\errorbox=\hbox to \dimen0{\hfil
- \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
- \advance\hsize by -2\dimen2 % Rules.
- \vbox{
- \hrule height\dimen2
- \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
- \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
- \kern3pt\vrule width\dimen2}% Space to right.
- \hrule height\dimen2}
- \hfil}
-
-% The @error{} command.
-\def\error{\leavevmode\lower.7ex\copy\errorbox}
-
-% @tex ... @end tex escapes into raw Tex temporarily.
-% One exception: @ is still an escape character, so that @end tex works.
-% But \@ or @@ will get a plain tex @ character.
-
-\def\tex{\begingroup
-\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
-\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
-\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
-\catcode `\%=14
-\catcode 43=12 % plus
-\catcode`\"=12
-\catcode`\==12
-\catcode`\|=12
-\catcode`\<=12
-\catcode`\>=12
-\escapechar=`\\
-%
-\let\,=\ptexcomma
-\let\{=\ptexlbrace
-\let\}=\ptexrbrace
-\let\.=\ptexdot
-\let\*=\ptexstar
-\let\dots=\ptexdots
-\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}
-\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}
-\def\@{@}%
-\let\bullet=\ptexbullet
-\let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext
-%
-\let\Etex=\endgroup}
-
-% Define @lisp ... @endlisp.
-% @lisp does a \begingroup so it can rebind things,
-% including the definition of @endlisp (which normally is erroneous).
-
-% Amount to narrow the margins by for @lisp.
-\newskip\lispnarrowing \lispnarrowing=0.4in
-
-% This is the definition that ^^M gets inside @lisp, @example, and other
-% such environments. \null is better than a space, since it doesn't
-% have any width.
-\def\lisppar{\null\endgraf}
-
-% Make each space character in the input produce a normal interword
-% space in the output. Don't allow a line break at this space, as this
-% is used only in environments like @example, where each line of input
-% should produce a line of output anyway.
-%
-{\obeyspaces %
-\gdef\sepspaces{\obeyspaces\let =\tie}}
-
-% Define \obeyedspace to be our active space, whatever it is. This is
-% for use in \parsearg.
-{\sepspaces%
-\global\let\obeyedspace= }
-
-% This space is always present above and below environments.
-\newskip\envskipamount \envskipamount = 0pt
-
-% Make spacing and below environment symmetrical. We use \parskip here
-% to help in doing that, since in @example-like environments \parskip
-% is reset to zero; thus the \afterenvbreak inserts no space -- but the
-% start of the next paragraph will insert \parskip
-%
-\def\aboveenvbreak{{\advance\envskipamount by \parskip
-\endgraf \ifdim\lastskip<\envskipamount
-\removelastskip \penalty-50 \vskip\envskipamount \fi}}
-
-\let\afterenvbreak = \aboveenvbreak
-
-% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
-\let\nonarrowing=\relax
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \cartouche: draw rectangle w/rounded corners around argument
-\font\circle=lcircle10
-\newdimen\circthick
-\newdimen\cartouter\newdimen\cartinner
-\newskip\normbskip\newskip\normpskip\newskip\normlskip
-\circthick=\fontdimen8\circle
-%
-\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
-\def\ctr{{\hskip 6pt\circle\char'010}}
-\def\cbl{{\circle\char'012\hskip -6pt}}
-\def\cbr{{\hskip 6pt\circle\char'011}}
-\def\carttop{\hbox to \cartouter{\hskip\lskip
- \ctl\leaders\hrule height\circthick\hfil\ctr
- \hskip\rskip}}
-\def\cartbot{\hbox to \cartouter{\hskip\lskip
- \cbl\leaders\hrule height\circthick\hfil\cbr
- \hskip\rskip}}
-%
-\newskip\lskip\newskip\rskip
-
-\long\def\cartouche{%
-\begingroup
- \lskip=\leftskip \rskip=\rightskip
- \leftskip=0pt\rightskip=0pt %we want these *outside*.
- \cartinner=\hsize \advance\cartinner by-\lskip
- \advance\cartinner by-\rskip
- \cartouter=\hsize
- \advance\cartouter by 18pt % allow for 3pt kerns on either
-% side, and for 6pt waste from
-% each corner char
- \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
- % Flag to tell @lisp, etc., not to narrow margin.
- \let\nonarrowing=\comment
- \vbox\bgroup
- \baselineskip=0pt\parskip=0pt\lineskip=0pt
- \carttop
- \hbox\bgroup
- \hskip\lskip
- \vrule\kern3pt
- \vbox\bgroup
- \hsize=\cartinner
- \kern3pt
- \begingroup
- \baselineskip=\normbskip
- \lineskip=\normlskip
- \parskip=\normpskip
- \vskip -\parskip
-\def\Ecartouche{%
- \endgroup
- \kern3pt
- \egroup
- \kern3pt\vrule
- \hskip\rskip
- \egroup
- \cartbot
- \egroup
-\endgroup
-}}
-
-
-% This macro is called at the beginning of all the @example variants,
-% inside a group.
-\def\nonfillstart{%
- \aboveenvbreak
- \inENV % This group ends at the end of the body
- \hfuzz = 12pt % Don't be fussy
- \sepspaces % Make spaces be word-separators rather than space tokens.
- \singlespace
- \let\par = \lisppar % don't ignore blank lines
- \obeylines % each line of input is a line of output
- \parskip = 0pt
- \parindent = 0pt
- \emergencystretch = 0pt % don't try to avoid overfull boxes
- % @cartouche defines \nonarrowing to inhibit narrowing
- % at next level down.
- \ifx\nonarrowing\relax
- \advance \leftskip by \lispnarrowing
- \exdentamount=\lispnarrowing
- \let\exdent=\nofillexdent
- \let\nonarrowing=\relax
- \fi
-}
-
-% To ending an @example-like environment, we first end the paragraph
-% (via \afterenvbreak's vertical glue), and then the group. That way we
-% keep the zero \parskip that the environments set -- \parskip glue
-% will be inserted at the beginning of the next paragraph in the
-% document, after the environment.
-%
-\def\nonfillfinish{\afterenvbreak\endgroup}%
-
-% This macro is
-\def\lisp{\begingroup
- \nonfillstart
- \let\Elisp = \nonfillfinish
- \tt
- \rawbackslash % have \ input char produce \ char from current font
- \gobble
-}
-
-% Define the \E... control sequence only if we are inside the
-% environment, so the error checking in \end will work.
-%
-% We must call \lisp last in the definition, since it reads the
-% return following the @example (or whatever) command.
-%
-\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
-\def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
-\def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
-
-% @smallexample and @smalllisp. This is not used unless the @smallbook
-% command is given. Originally contributed by Pavel@xerox.
-%
-\def\smalllispx{\begingroup
- \nonfillstart
- \let\Esmalllisp = \nonfillfinish
- \let\Esmallexample = \nonfillfinish
- %
- % Smaller fonts for small examples.
- \indexfonts \tt
- \rawbackslash % make \ output the \ character from the current font (tt)
- \gobble
-}
-
-% This is @display; same as @lisp except use roman font.
-%
-\def\display{\begingroup
- \nonfillstart
- \let\Edisplay = \nonfillfinish
- \gobble
-}
-
-% This is @format; same as @display except don't narrow margins.
-%
-\def\format{\begingroup
- \let\nonarrowing = t
- \nonfillstart
- \let\Eformat = \nonfillfinish
- \gobble
-}
-
-% @flushleft (same as @format) and @flushright.
-%
-\def\flushleft{\begingroup
- \let\nonarrowing = t
- \nonfillstart
- \let\Eflushleft = \nonfillfinish
- \gobble
-}
-\def\flushright{\begingroup
- \let\nonarrowing = t
- \nonfillstart
- \let\Eflushright = \nonfillfinish
- \advance\leftskip by 0pt plus 1fill
- \gobble}
-
-% @quotation does normal linebreaking (hence we can't use \nonfillstart)
-% and narrows the margins.
-%
-\def\quotation{%
- \begingroup\inENV %This group ends at the end of the @quotation body
- {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
- \singlespace
- \parindent=0pt
- % We have retained a nonzero parskip for the environment, since we're
- % doing normal filling. So to avoid extra space below the environment...
- \def\Equotation{\parskip = 0pt \nonfillfinish}%
- %
- % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
- \ifx\nonarrowing\relax
- \advance\leftskip by \lispnarrowing
- \advance\rightskip by \lispnarrowing
- \exdentamount = \lispnarrowing
- \let\nonarrowing = \relax
- \fi
-}
-
-\message{defuns,}
-% Define formatter for defuns
-% First, allow user to change definition object font (\df) internally
-\def\setdeffont #1 {\csname DEF#1\endcsname}
-
-\newskip\defbodyindent \defbodyindent=.4in
-\newskip\defargsindent \defargsindent=50pt
-\newskip\deftypemargin \deftypemargin=12pt
-\newskip\deflastargmargin \deflastargmargin=18pt
-
-\newcount\parencount
-% define \functionparens, which makes ( and ) and & do special things.
-% \functionparens affects the group it is contained in.
-\def\activeparens{%
-\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
-\catcode`\[=\active \catcode`\]=\active}
-
-% Make control sequences which act like normal parenthesis chars.
-\let\lparen = ( \let\rparen = )
-
-{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
-
-% Be sure that we always have a definition for `(', etc. For example,
-% if the fn name has parens in it, \boldbrax will not be in effect yet,
-% so TeX would otherwise complain about undefined control sequence.
-\global\let(=\lparen \global\let)=\rparen
-\global\let[=\lbrack \global\let]=\rbrack
-
-\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
-\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
-% This is used to turn on special parens
-% but make & act ordinary (given that it's active).
-\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
-
-% Definitions of (, ) and & used in args for functions.
-% This is the definition of ( outside of all parentheses.
-\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
-\global\advance\parencount by 1 }
-%
-% This is the definition of ( when already inside a level of parens.
-\gdef\opnested{\char`\(\global\advance\parencount by 1 }
-%
-\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
-% also in that case restore the outer-level definition of (.
-\ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
-\global\advance \parencount by -1 }
-% If we encounter &foo, then turn on ()-hacking afterwards
-\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
-%
-\gdef\normalparens{\boldbrax\let&=\ampnr}
-} % End of definition inside \activeparens
-%% These parens (in \boldbrax) actually are a little bolder than the
-%% contained text. This is especially needed for [ and ]
-\def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
-\def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
-
-% First, defname, which formats the header line itself.
-% #1 should be the function name.
-% #2 should be the type of definition, such as "Function".
-
-\def\defname #1#2{%
-% Get the values of \leftskip and \rightskip as they were
-% outside the @def...
-\dimen2=\leftskip
-\advance\dimen2 by -\defbodyindent
-\dimen3=\rightskip
-\advance\dimen3 by -\defbodyindent
-\noindent %
-\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
-\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
-\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
-\parshape 2 0in \dimen0 \defargsindent \dimen1 %
-% Now output arg 2 ("Function" or some such)
-% ending at \deftypemargin from the right margin,
-% but stuck inside a box of width 0 so it does not interfere with linebreaking
-{% Adjust \hsize to exclude the ambient margins,
-% so that \rightline will obey them.
-\advance \hsize by -\dimen2 \advance \hsize by -\dimen3
-\rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
-% Make all lines underfull and no complaints:
-\tolerance=10000 \hbadness=10000
-\advance\leftskip by -\defbodyindent
-\exdentamount=\defbodyindent
-{\df #1}\enskip % Generate function name
-}
-
-% Actually process the body of a definition
-% #1 should be the terminating control sequence, such as \Edefun.
-% #2 should be the "another name" control sequence, such as \defunx.
-% #3 should be the control sequence that actually processes the header,
-% such as \defunheader.
-
-\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup %
-\catcode 61=\active % 61 is `='
-\obeylines\activeparens\spacesplit#3}
-
-\def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
-
-\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2##1 ##2 {\def#4{##1}%
-\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
-
-% These parsing functions are similar to the preceding ones
-% except that they do not make parens into active characters.
-% These are used for "variables" since they have no arguments.
-
-\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2{\begingroup\obeylines\spacesplit#3}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup %
-\catcode 61=\active %
-\obeylines\spacesplit#3}
-
-% This is used for \def{tp,vr}parsebody. It could probably be used for
-% some of the others, too, with some judicious conditionals.
-%
-\def\parsebodycommon#1#2#3{%
- \begingroup\inENV %
- \medbreak %
- % Define the end token that this defining construct specifies
- % so that it will exit this group.
- \def#1{\endgraf\endgroup\medbreak}%
- \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
- \parindent=0in
- \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
- \exdentamount=\defbodyindent
- \begingroup\obeylines
-}
-
-\def\defvrparsebody#1#2#3#4 {%
- \parsebodycommon{#1}{#2}{#3}%
- \spacesplit{#3{#4}}%
-}
-
-% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
-% type is just `struct', because we lose the braces in `{struct
-% termios}' when \spacesplit reads its undelimited argument. Sigh.
-% \let\deftpparsebody=\defvrparsebody
-%
-% So, to get around this, we put \empty in with the type name. That
-% way, TeX won't find exactly `{...}' as an undelimited argument, and
-% won't strip off the braces.
-%
-\def\deftpparsebody #1#2#3#4 {%
- \parsebodycommon{#1}{#2}{#3}%
- \spacesplit{\parsetpheaderline{#3{#4}}}\empty
-}
-
-% Fine, but then we have to eventually remove the \empty *and* the
-% braces (if any). That's what this does.
-%
-\def\removeemptybraces\empty#1\relax{#1}
-
-% After \spacesplit has done its work, this is called -- #1 is the final
-% thing to call, #2 the type name (which starts with \empty), and #3
-% (which might be empty) the arguments.
-%
-\def\parsetpheaderline#1#2#3{%
- #1{\removeemptybraces#2\relax}{#3}%
-}%
-
-\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2##1 ##2 {\def#4{##1}%
-\begingroup\obeylines\spacesplit{#3{##2}}}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup\obeylines\spacesplit{#3{#5}}}
-
-% Split up #2 at the first space token.
-% call #1 with two arguments:
-% the first is all of #2 before the space token,
-% the second is all of #2 after that space token.
-% If #2 contains no space token, all of it is passed as the first arg
-% and the second is passed as empty.
-
-{\obeylines
-\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
-\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
-\ifx\relax #3%
-#1{#2}{}\else #1{#2}{#3#4}\fi}}
-
-% So much for the things common to all kinds of definitions.
-
-% Define @defun.
-
-% First, define the processing that is wanted for arguments of \defun
-% Use this to expand the args and terminate the paragraph they make up
-
-\def\defunargs #1{\functionparens \sl
-% Expand, preventing hyphenation at `-' chars.
-% Note that groups don't affect changes in \hyphenchar.
-\hyphenchar\tensl=0
-#1%
-\hyphenchar\tensl=45
-\ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
-\interlinepenalty=10000
-\advance\rightskip by 0pt plus 1fil
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000%
-}
-
-\def\deftypefunargs #1{%
-% Expand, preventing hyphenation at `-' chars.
-% Note that groups don't affect changes in \hyphenchar.
-% Use \boldbraxnoamp, not \functionparens, so that & is not special.
-\boldbraxnoamp
-\tclose{#1}% avoid \code because of side effects on active chars
-\interlinepenalty=10000
-\advance\rightskip by 0pt plus 1fil
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000%
-}
-
-% Do complete processing of one @defun or @defunx line already parsed.
-
-% @deffn Command forward-char nchars
-
-\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
-
-\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
-\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @defun == @deffn Function
-
-\def\defun{\defparsebody\Edefun\defunx\defunheader}
-
-\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{Function}%
-\defunargs {#2}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @deftypefun int foobar (int @var{foo}, float @var{bar})
-
-\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
-
-% #1 is the data type. #2 is the name and args.
-\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
-% #1 is the data type, #2 the name, #3 the args.
-\def\deftypefunheaderx #1#2 #3\relax{%
-\doind {fn}{\code{#2}}% Make entry in function index
-\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
-\deftypefunargs {#3}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
-
-\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
-
-% \defheaderxcond#1\relax$$$
-% puts #1 in @code, followed by a space, but does nothing if #1 is null.
-\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
-
-% #1 is the classification. #2 is the data type. #3 is the name and args.
-\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
-% #1 is the classification, #2 the data type, #3 the name, #4 the args.
-\def\deftypefnheaderx #1#2#3 #4\relax{%
-\doind {fn}{\code{#3}}% Make entry in function index
-\begingroup
-\normalparens % notably, turn off `&' magic, which prevents
-% at least some C++ text from working
-\defname {\defheaderxcond#2\relax$$$#3}{#1}%
-\deftypefunargs {#4}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @defmac == @deffn Macro
-
-\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
-
-\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{Macro}%
-\defunargs {#2}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @defspec == @deffn Special Form
-
-\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
-
-\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{Special Form}%
-\defunargs {#2}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% This definition is run if you use @defunx
-% anywhere other than immediately after a @defun or @defunx.
-
-\def\deffnx #1 {\errmessage{@deffnx in invalid context}}
-\def\defunx #1 {\errmessage{@defunx in invalid context}}
-\def\defmacx #1 {\errmessage{@defmacx in invalid context}}
-\def\defspecx #1 {\errmessage{@defspecx in invalid context}}
-\def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
-\def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
-
-% @defmethod, and so on
-
-% @defop {Funny Method} foo-class frobnicate argument
-
-\def\defop #1 {\def\defoptype{#1}%
-\defopparsebody\Edefop\defopx\defopheader\defoptype}
-
-\def\defopheader #1#2#3{%
-\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
-\begingroup\defname {#2}{\defoptype{} on #1}%
-\defunargs {#3}\endgroup %
-}
-
-% @defmethod == @defop Method
-
-\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
-
-\def\defmethodheader #1#2#3{%
-\dosubind {fn}{\code{#2}}{on #1}% entry in function index
-\begingroup\defname {#2}{Method on #1}%
-\defunargs {#3}\endgroup %
-}
-
-% @defcv {Class Option} foo-class foo-flag
-
-\def\defcv #1 {\def\defcvtype{#1}%
-\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
-
-\def\defcvarheader #1#2#3{%
-\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
-\begingroup\defname {#2}{\defcvtype{} of #1}%
-\defvarargs {#3}\endgroup %
-}
-
-% @defivar == @defcv {Instance Variable}
-
-\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
-
-\def\defivarheader #1#2#3{%
-\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
-\begingroup\defname {#2}{Instance Variable of #1}%
-\defvarargs {#3}\endgroup %
-}
-
-% These definitions are run if you use @defmethodx, etc.,
-% anywhere other than immediately after a @defmethod, etc.
-
-\def\defopx #1 {\errmessage{@defopx in invalid context}}
-\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
-\def\defcvx #1 {\errmessage{@defcvx in invalid context}}
-\def\defivarx #1 {\errmessage{@defivarx in invalid context}}
-
-% Now @defvar
-
-% First, define the processing that is wanted for arguments of @defvar.
-% This is actually simple: just print them in roman.
-% This must expand the args and terminate the paragraph they make up
-\def\defvarargs #1{\normalparens #1%
-\interlinepenalty=10000
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000}
-
-% @defvr Counter foo-count
-
-\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
-
-\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
-\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
-
-% @defvar == @defvr Variable
-
-\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
-
-\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
-\begingroup\defname {#1}{Variable}%
-\defvarargs {#2}\endgroup %
-}
-
-% @defopt == @defvr {User Option}
-
-\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
-
-\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
-\begingroup\defname {#1}{User Option}%
-\defvarargs {#2}\endgroup %
-}
-
-% @deftypevar int foobar
-
-\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
-
-% #1 is the data type. #2 is the name, perhaps followed by text that
-% is actually part of the data type, which should not be put into the index.
-\def\deftypevarheader #1#2{%
-\dovarind#2 \relax% Make entry in variables index
-\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
-\interlinepenalty=10000
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000
-\endgroup}
-\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
-
-% @deftypevr {Global Flag} int enable
-
-\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
-
-\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
-\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
-\interlinepenalty=10000
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000
-\endgroup}
-
-% This definition is run if you use @defvarx
-% anywhere other than immediately after a @defvar or @defvarx.
-
-\def\defvrx #1 {\errmessage{@defvrx in invalid context}}
-\def\defvarx #1 {\errmessage{@defvarx in invalid context}}
-\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
-\def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
-\def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
-
-% Now define @deftp
-% Args are printed in bold, a slight difference from @defvar.
-
-\def\deftpargs #1{\bf \defvarargs{#1}}
-
-% @deftp Class window height width ...
-
-\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
-
-\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
-\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
-
-% This definition is run if you use @deftpx, etc
-% anywhere other than immediately after a @deftp, etc.
-
-\def\deftpx #1 {\errmessage{@deftpx in invalid context}}
-
-
-\message{cross reference,}
-% Define cross-reference macros
-\newwrite \auxfile
-
-\newif\ifhavexrefs % True if xref values are known.
-\newif\ifwarnedxrefs % True if we warned once that they aren't known.
-
-% @inforef is simple.
-\def\inforef #1{\inforefzzz #1,,,,**}
-\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
- node \samp{\ignorespaces#1{}}}
-
-% \setref{foo} defines a cross-reference point named foo.
-
-\def\setref#1{%
-\dosetq{#1-title}{Ytitle}%
-\dosetq{#1-pg}{Ypagenumber}%
-\dosetq{#1-snt}{Ysectionnumberandtype}}
-
-\def\unnumbsetref#1{%
-\dosetq{#1-title}{Ytitle}%
-\dosetq{#1-pg}{Ypagenumber}%
-\dosetq{#1-snt}{Ynothing}}
-
-\def\appendixsetref#1{%
-\dosetq{#1-title}{Ytitle}%
-\dosetq{#1-pg}{Ypagenumber}%
-\dosetq{#1-snt}{Yappendixletterandtype}}
-
-% \xref, \pxref, and \ref generate cross-references to specified points.
-% For \xrefX, #1 is the node name, #2 the name of the Info
-% cross-reference, #3 the printed node name, #4 the name of the Info
-% file, #5 the name of the printed manual. All but the node name can be
-% omitted.
-%
-\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
-\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
-\def\ref#1{\xrefX[#1,,,,,,,]}
-\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
- \def\printedmanual{\ignorespaces #5}%
- \def\printednodename{\ignorespaces #3}%
- \setbox1=\hbox{\printedmanual}%
- \setbox0=\hbox{\printednodename}%
- \ifdim \wd0 = 0pt
- % No printed node name was explicitly given.
- \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
- % Use the node name inside the square brackets.
- \def\printednodename{\ignorespaces #1}%
- \else
- % Use the actual chapter/section title appear inside
- % the square brackets. Use the real section title if we have it.
- \ifdim \wd1>0pt%
- % It is in another manual, so we don't have it.
- \def\printednodename{\ignorespaces #1}%
- \else
- \ifhavexrefs
- % We know the real title if we have the xref values.
- \def\printednodename{\refx{#1-title}{}}%
- \else
- % Otherwise just copy the Info node name.
- \def\printednodename{\ignorespaces #1}%
- \fi%
- \fi
- \fi
- \fi
- %
- % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
- % insert empty discretionaries after hyphens, which means that it will
- % not find a line break at a hyphen in a node names. Since some manuals
- % are best written with fairly long node names, containing hyphens, this
- % is a loss. Therefore, we give the text of the node name again, so it
- % is as if TeX is seeing it for the first time.
- \ifdim \wd1 > 0pt
- \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
- \else
- % _ (for example) has to be the character _ for the purposes of the
- % control sequence corresponding to the node, but it has to expand
- % into the usual \leavevmode...\vrule stuff for purposes of
- % printing. So we \turnoffactive for the \refx-snt, back on for the
- % printing, back off for the \refx-pg.
- {\turnoffactive \refx{#1-snt}{}}%
- \space [\printednodename],\space
- \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
- \fi
-\endgroup}
-
-% \dosetq is the interface for calls from other macros
-
-% Use \turnoffactive so that punctuation chars such as underscore
-% work in node names.
-\def\dosetq #1#2{{\let\folio=0 \turnoffactive
-\edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
-\next}}
-
-% \internalsetq {foo}{page} expands into
-% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
-% When the aux file is read, ' is the escape character
-
-\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
-
-% Things to be expanded by \internalsetq
-
-\def\Ypagenumber{\folio}
-
-\def\Ytitle{\thissection}
-
-\def\Ynothing{}
-
-\def\Ysectionnumberandtype{%
-\ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
-\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
-\else \ifnum \subsubsecno=0 %
-\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
-\else %
-\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
-\fi \fi \fi }
-
-\def\Yappendixletterandtype{%
-\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
-\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
-\else \ifnum \subsubsecno=0 %
-\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
-\else %
-\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
-\fi \fi \fi }
-
-\gdef\xreftie{'tie}
-
-% Use TeX 3.0's \inputlineno to get the line number, for better error
-% messages, but if we're using an old version of TeX, don't do anything.
-%
-\ifx\inputlineno\thisisundefined
- \let\linenumber = \empty % Non-3.0.
-\else
- \def\linenumber{\the\inputlineno:\space}
-\fi
-
-% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
-% If its value is nonempty, SUFFIX is output afterward.
-
-\def\refx#1#2{%
- \expandafter\ifx\csname X#1\endcsname\relax
- % If not defined, say something at least.
- $\langle$un\-de\-fined$\rangle$%
- \ifhavexrefs
- \message{\linenumber Undefined cross reference `#1'.}%
- \else
- \ifwarnedxrefs\else
- \global\warnedxrefstrue
- \message{Cross reference values unknown; you must run TeX again.}%
- \fi
- \fi
- \else
- % It's defined, so just use it.
- \csname X#1\endcsname
- \fi
- #2% Output the suffix in any case.
-}
-
-% This is the macro invoked by entries in the aux file.
-\def\xrdef #1#2{{%
- \catcode`\'=\other
- \expandafter\gdef\csname X#1\endcsname{#2}%
-}}
-
-% Read the last existing aux file, if any. No error if none exists.
-\def\readauxfile{\begingroup
- \catcode`\^^@=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\^^C=\other
- \catcode`\^^D=\other
- \catcode`\^^E=\other
- \catcode`\^^F=\other
- \catcode`\^^G=\other
- \catcode`\^^H=\other
- \catcode`\ =\other
- \catcode`\^^L=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode26=\other
- \catcode`\^^[=\other
- \catcode`\^^\=\other
- \catcode`\^^]=\other
- \catcode`\^^^=\other
- \catcode`\^^_=\other
- \catcode`\@=\other
- \catcode`\^=\other
- % It was suggested to define this as 7, which would allow ^^e4 etc.
- % in xref tags, i.e., node names. But since ^^e4 notation isn't
- % supported in the main text, it doesn't seem desirable. Furthermore,
- % that is not enough: for node names that actually contain a ^
- % character, we would end up writing a line like this: 'xrdef {'hat
- % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
- % argument, and \hat is not an expandable control sequence. It could
- % all be worked out, but why? Either we support ^^ or we don't.
- %
- % The other change necessary for this was to define \auxhat:
- % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
- % and then to call \auxhat in \setq.
- %
- \catcode`\~=\other
- \catcode`\[=\other
- \catcode`\]=\other
- \catcode`\"=\other
- \catcode`\_=\other
- \catcode`\|=\other
- \catcode`\<=\other
- \catcode`\>=\other
- \catcode`\$=\other
- \catcode`\#=\other
- \catcode`\&=\other
- % `\+ does not work, so use 43.
- \catcode43=\other
- % Make the characters 128-255 be printing characters
- {%
- \count 1=128
- \def\loop{%
- \catcode\count 1=\other
- \advance\count 1 by 1
- \ifnum \count 1<256 \loop \fi
- }%
- }%
- % The aux file uses ' as the escape (for now).
- % Turn off \ as an escape so we do not lose on
- % entries which were dumped with control sequences in their names.
- % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
- % Reference to such entries still does not work the way one would wish,
- % but at least they do not bomb out when the aux file is read in.
- \catcode`\{=1
- \catcode`\}=2
- \catcode`\%=\other
- \catcode`\'=0
- \catcode`\\=\other
- %
- \openin 1 \jobname.aux
- \ifeof 1 \else
- \closein 1
- \input \jobname.aux
- \global\havexrefstrue
- \global\warnedobstrue
- \fi
- % Open the new aux file. TeX will close it automatically at exit.
- \openout\auxfile=\jobname.aux
-\endgroup}
-
-
-% Footnotes.
-
-\newcount \footnoteno
-
-% The trailing space in the following definition for supereject is
-% vital for proper filling; pages come out unaligned when you do a
-% pagealignmacro call if that space before the closing brace is
-% removed. (Generally, numeric constants should always be followed by a
-% space to prevent strange expansion errors.)
-\def\supereject{\par\penalty -20000\footnoteno =0 }
-
-% @footnotestyle is meaningful for info output only..
-\let\footnotestyle=\comment
-
-\let\ptexfootnote=\footnote
-
-{\catcode `\@=11
-%
-% Auto-number footnotes. Otherwise like plain.
-\gdef\footnote{%
- \global\advance\footnoteno by \@ne
- \edef\thisfootno{$^{\the\footnoteno}$}%
- %
- % In case the footnote comes at the end of a sentence, preserve the
- % extra spacing after we do the footnote number.
- \let\@sf\empty
- \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
- %
- % Remove inadvertent blank space before typesetting the footnote number.
- \unskip
- \thisfootno\@sf
- \footnotezzz
-}%
-
-% Don't bother with the trickery in plain.tex to not require the
-% footnote text as a parameter. Our footnotes don't need to be so general.
-%
-% Oh yes, they do; otherwise, @ifset and anything else that uses
-% \parseargline fail inside footnotes because the tokens are fixed when
-% the footnote is read. --karl, 16nov96.
-%
-\long\gdef\footnotezzz{\insert\footins\bgroup
- % We want to typeset this text as a normal paragraph, even if the
- % footnote reference occurs in (for example) a display environment.
- % So reset some parameters.
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\ht\strutbox % top baseline for broken footnotes
- \splitmaxdepth\dp\strutbox
- \floatingpenalty\@MM
- \leftskip\z@skip
- \rightskip\z@skip
- \spaceskip\z@skip
- \xspaceskip\z@skip
- \parindent\defaultparindent
- %
- % Hang the footnote text off the number.
- \hang
- \textindent{\thisfootno}%
- %
- % Don't crash into the line above the footnote text. Since this
- % expands into a box, it must come within the paragraph, lest it
- % provide a place where TeX can split the footnote.
- \footstrut
- \futurelet\next\fo@t
-}
-\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
- \else\let\next\f@t\fi \next}
-\def\f@@t{\bgroup\aftergroup\@foot\let\next}
-\def\f@t#1{#1\@foot}
-\def\@foot{\strut\egroup}
-
-}%end \catcode `\@=11
-
-% Set the baselineskip to #1, and the lineskip and strut size
-% correspondingly. There is no deep meaning behind these magic numbers
-% used as factors; they just match (closely enough) what Knuth defined.
-%
-\def\lineskipfactor{.08333}
-\def\strutheightpercent{.70833}
-\def\strutdepthpercent {.29167}
-%
-\def\setleading#1{%
- \normalbaselineskip = #1\relax
- \normallineskip = \lineskipfactor\normalbaselineskip
- \normalbaselines
- \setbox\strutbox =\hbox{%
- \vrule width0pt height\strutheightpercent\baselineskip
- depth \strutdepthpercent \baselineskip
- }%
-}
-
-% @| inserts a changebar to the left of the current line. It should
-% surround any changed text. This approach does *not* work if the
-% change spans more than two lines of output. To handle that, we would
-% have adopt a much more difficult approach (putting marks into the main
-% vertical list for the beginning and end of each change).
-%
-\def\|{%
- % \vadjust can only be used in horizontal mode.
- \leavevmode
- %
- % Append this vertical mode material after the current line in the output.
- \vadjust{%
- % We want to insert a rule with the height and depth of the current
- % leading; that is exactly what \strutbox is supposed to record.
- \vskip-\baselineskip
- %
- % \vadjust-items are inserted at the left edge of the type. So
- % the \llap here moves out into the left-hand margin.
- \llap{%
- %
- % For a thicker or thinner bar, change the `1pt'.
- \vrule height\baselineskip width1pt
- %
- % This is the space between the bar and the text.
- \hskip 12pt
- }%
- }%
-}
-
-% For a final copy, take out the rectangles
-% that mark overfull boxes (in case you have decided
-% that the text looks ok even though it passes the margin).
-%
-\def\finalout{\overfullrule=0pt}
-
-
-% End of control word definitions.
-
-\message{and turning on texinfo input format.}
-
-\def\openindices{%
- \newindex{cp}%
- \newcodeindex{fn}%
- \newcodeindex{vr}%
- \newcodeindex{tp}%
- \newcodeindex{ky}%
- \newcodeindex{pg}%
-}
-
-% Set some numeric style parameters, for 8.5 x 11 format.
-
-\hsize = 6in
-\hoffset = .25in
-\newdimen\defaultparindent \defaultparindent = 15pt
-\parindent = \defaultparindent
-\parskip 3pt plus 2pt minus 1pt
-\setleading{13.2pt}
-\advance\topskip by 1.2cm
-
-\chapheadingskip = 15pt plus 4pt minus 2pt
-\secheadingskip = 12pt plus 3pt minus 2pt
-\subsecheadingskip = 9pt plus 2pt minus 2pt
-
-% Prevent underfull vbox error messages.
-\vbadness=10000
-
-% Following George Bush, just get rid of widows and orphans.
-\widowpenalty=10000
-\clubpenalty=10000
-
-% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
-% using an old version of TeX, don't do anything. We want the amount of
-% stretch added to depend on the line length, hence the dependence on
-% \hsize. This makes it come to about 9pt for the 8.5x11 format.
-%
-\ifx\emergencystretch\thisisundefined
- % Allow us to assign to \emergencystretch anyway.
- \def\emergencystretch{\dimen0}%
-\else
- \emergencystretch = \hsize
- \divide\emergencystretch by 45
-\fi
-
-% Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
-\def\smallbook{
- \global\chapheadingskip = 15pt plus 4pt minus 2pt
- \global\secheadingskip = 12pt plus 3pt minus 2pt
- \global\subsecheadingskip = 9pt plus 2pt minus 2pt
- %
- \global\lispnarrowing = 0.3in
- \setleading{12pt}
- \advance\topskip by -1cm
- \global\parskip 2pt plus 1pt
- \global\hsize = 5in
- \global\vsize=7.5in
- \global\tolerance=700
- \global\hfuzz=1pt
- \global\contentsrightmargin=0pt
- \global\deftypemargin=0pt
- \global\defbodyindent=.5cm
- %
- \global\pagewidth=\hsize
- \global\pageheight=\vsize
- %
- \global\let\smalllisp=\smalllispx
- \global\let\smallexample=\smalllispx
- \global\def\Esmallexample{\Esmalllisp}
-}
-
-% Use @afourpaper to print on European A4 paper.
-\def\afourpaper{
-\global\tolerance=700
-\global\hfuzz=1pt
-\setleading{12pt}
-\global\parskip 15pt plus 1pt
-
-\global\vsize= 53\baselineskip
-\advance\vsize by \topskip
-%\global\hsize= 5.85in % A4 wide 10pt
-\global\hsize= 6.5in
-\global\outerhsize=\hsize
-\global\advance\outerhsize by 0.5in
-\global\outervsize=\vsize
-\global\advance\outervsize by 0.6in
-
-\global\pagewidth=\hsize
-\global\pageheight=\vsize
-}
-
-\bindingoffset=0pt
-\normaloffset=\hoffset
-\pagewidth=\hsize
-\pageheight=\vsize
-
-% Allow control of the text dimensions. Parameters in order: textheight;
-% textwidth; voffset; hoffset; binding offset; topskip.
-% All require a dimension;
-% header is additional; added length extends the bottom of the page.
-
-\def\changepagesizes#1#2#3#4#5#6{
- \global\vsize= #1
- \global\topskip= #6
- \advance\vsize by \topskip
- \global\voffset= #3
- \global\hsize= #2
- \global\outerhsize=\hsize
- \global\advance\outerhsize by 0.5in
- \global\outervsize=\vsize
- \global\advance\outervsize by 0.6in
- \global\pagewidth=\hsize
- \global\pageheight=\vsize
- \global\normaloffset= #4
- \global\bindingoffset= #5}
-
-% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
-% 29mm, hence bottom margin 28mm, nominal side margin 3cm.
-\def\afourlatex
- {\global\tolerance=700
- \global\hfuzz=1pt
- \setleading{12pt}
- \global\parskip 15pt plus 1pt
- \advance\baselineskip by 1.6pt
- \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}
- }
-
-% Use @afourwide to print on European A4 paper in wide format.
-\def\afourwide{\afourpaper
-\changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}}
-
-% Define macros to output various characters with catcode for normal text.
-\catcode`\"=\other
-\catcode`\~=\other
-\catcode`\^=\other
-\catcode`\_=\other
-\catcode`\|=\other
-\catcode`\<=\other
-\catcode`\>=\other
-\catcode`\+=\other
-\def\normaldoublequote{"}
-\def\normaltilde{~}
-\def\normalcaret{^}
-\def\normalunderscore{_}
-\def\normalverticalbar{|}
-\def\normalless{<}
-\def\normalgreater{>}
-\def\normalplus{+}
-
-% This macro is used to make a character print one way in ttfont
-% where it can probably just be output, and another way in other fonts,
-% where something hairier probably needs to be done.
-%
-% #1 is what to print if we are indeed using \tt; #2 is what to print
-% otherwise. Since all the Computer Modern typewriter fonts have zero
-% interword stretch (and shrink), and it is reasonable to expect all
-% typewriter fonts to have this, we can check that font parameter.
-%
-\def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
-
-% Turn off all special characters except @
-% (and those which the user can use as if they were ordinary).
-% Most of these we simply print from the \tt font, but for some, we can
-% use math or other variants that look better in normal text.
-
-\catcode`\"=\active
-\def\activedoublequote{{\tt \char '042}}
-\let"=\activedoublequote
-\catcode`\~=\active
-\def~{{\tt \char '176}}
-\chardef\hat=`\^
-\catcode`\^=\active
-\def^{{\tt \hat}}
-
-\catcode`\_=\active
-\def_{\ifusingtt\normalunderscore\_}
-% Subroutine for the previous macro.
-\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
-
-\catcode`\|=\active
-\def|{{\tt \char '174}}
-\chardef \less=`\<
-\catcode`\<=\active
-\def<{{\tt \less}}
-\chardef \gtr=`\>
-\catcode`\>=\active
-\def>{{\tt \gtr}}
-\catcode`\+=\active
-\def+{{\tt \char 43}}
-%\catcode 27=\active
-%\def^^[{$\diamondsuit$}
-
-% Set up an active definition for =, but don't enable it most of the time.
-{\catcode`\==\active
-\global\def={{\tt \char 61}}}
-
-\catcode`+=\active
-\catcode`\_=\active
-
-% If a .fmt file is being used, characters that might appear in a file
-% name cannot be active until we have parsed the command line.
-% So turn them off again, and have \everyjob (or @setfilename) turn them on.
-% \otherifyactive is called near the end of this file.
-\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
-
-\catcode`\@=0
-
-% \rawbackslashxx output one backslash character in current font
-\global\chardef\rawbackslashxx=`\\
-%{\catcode`\\=\other
-%@gdef@rawbackslashxx{\}}
-
-% \rawbackslash redefines \ as input to do \rawbackslashxx.
-{\catcode`\\=\active
-@gdef@rawbackslash{@let\=@rawbackslashxx }}
-
-% \normalbackslash outputs one backslash in fixed width font.
-\def\normalbackslash{{\tt\rawbackslashxx}}
-
-% Say @foo, not \foo, in error messages.
-\escapechar=`\@
-
-% \catcode 17=0 % Define control-q
-\catcode`\\=\active
-
-% Used sometimes to turn off (effectively) the active characters
-% even after parsing them.
-@def@turnoffactive{@let"=@normaldoublequote
-@let\=@realbackslash
-@let~=@normaltilde
-@let^=@normalcaret
-@let_=@normalunderscore
-@let|=@normalverticalbar
-@let<=@normalless
-@let>=@normalgreater
-@let+=@normalplus}
-
-@def@normalturnoffactive{@let"=@normaldoublequote
-@let\=@normalbackslash
-@let~=@normaltilde
-@let^=@normalcaret
-@let_=@normalunderscore
-@let|=@normalverticalbar
-@let<=@normalless
-@let>=@normalgreater
-@let+=@normalplus}
-
-% Make _ and + \other characters, temporarily.
-% This is canceled by @fixbackslash.
-@otherifyactive
-
-% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
-% That is what \eatinput is for; after that, the `\' should revert to printing
-% a backslash.
-%
-@gdef@eatinput input texinfo{@fixbackslash}
-@global@let\ = @eatinput
-
-% On the other hand, perhaps the file did not have a `\input texinfo'. Then
-% the first `\{ in the file would cause an error. This macro tries to fix
-% that, assuming it is called before the first `\' could plausibly occur.
-% Also back turn on active characters that might appear in the input
-% file name, in case not using a pre-dumped format.
-%
-@gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
- @catcode`+=@active @catcode`@_=@active}
-
-%% These look ok in all fonts, so just make them not special. The @rm below
-%% makes sure that the current font starts out as the newly loaded cmr10
-@catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
-
-@textfonts
-@rm
-
-@c Local variables:
-@c page-delimiter: "^\\\\message"
-@c End:
diff --git a/gcc/tm.texi b/gcc/tm.texi
deleted file mode 100644
index 83d51bb87e8..00000000000
--- a/gcc/tm.texi
+++ /dev/null
@@ -1,6918 +0,0 @@
-@c Copyright (C) 1988,89,92,93,94,96 Free Software Foundation, Inc.
-@c This is part of the GCC manual.
-@c For copying conditions, see the file gcc.texi.
-
-@node Target Macros
-@chapter Target Description Macros
-@cindex machine description macros
-@cindex target description macros
-@cindex macros, target description
-@cindex @file{tm.h} macros
-
-In addition to the file @file{@var{machine}.md}, a machine description
-includes a C header file conventionally given the name
-@file{@var{machine}.h}. This header file defines numerous macros
-that convey the information about the target machine that does not fit
-into the scheme of the @file{.md} file. The file @file{tm.h} should be
-a link to @file{@var{machine}.h}. The header file @file{config.h}
-includes @file{tm.h} and most compiler source files include
-@file{config.h}.
-
-@menu
-* Driver:: Controlling how the driver runs the compilation passes.
-* Run-time Target:: Defining @samp{-m} options like @samp{-m68000} and @samp{-m68020}.
-* Storage Layout:: Defining sizes and alignments of data.
-* Type Layout:: Defining sizes and properties of basic user data types.
-* Registers:: Naming and describing the hardware registers.
-* Register Classes:: Defining the classes of hardware registers.
-* Stack and Calling:: Defining which way the stack grows and by how much.
-* Varargs:: Defining the varargs macros.
-* Trampolines:: Code set up at run time to enter a nested function.
-* Library Calls:: Controlling how library routines are implicitly called.
-* Addressing Modes:: Defining addressing modes valid for memory operands.
-* Condition Code:: Defining how insns update the condition code.
-* Costs:: Defining relative costs of different operations.
-* Sections:: Dividing storage into text, data, and other sections.
-* PIC:: Macros for position independent code.
-* Assembler Format:: Defining how to write insns and pseudo-ops to output.
-* Debugging Info:: Defining the format of debugging output.
-* Cross-compilation:: Handling floating point for cross-compilers.
-* Misc:: Everything else.
-@end menu
-
-@node Driver
-@section Controlling the Compilation Driver, @file{gcc}
-@cindex driver
-@cindex controlling the compilation driver
-
-@c prevent bad page break with this line
-You can control the compilation driver.
-
-@table @code
-@findex SWITCH_TAKES_ARG
-@item SWITCH_TAKES_ARG (@var{char})
-A C expression which determines whether the option @samp{-@var{char}}
-takes arguments. The value should be the number of arguments that
-option takes--zero, for many options.
-
-By default, this macro is defined as
-@code{DEFAULT_SWITCH_TAKES_ARG}, which handles the standard options
-properly. You need not define @code{SWITCH_TAKES_ARG} unless you
-wish to add additional options which take arguments. Any redefinition
-should call @code{DEFAULT_SWITCH_TAKES_ARG} and then check for
-additional options.
-
-@findex WORD_SWITCH_TAKES_ARG
-@item WORD_SWITCH_TAKES_ARG (@var{name})
-A C expression which determines whether the option @samp{-@var{name}}
-takes arguments. The value should be the number of arguments that
-option takes--zero, for many options. This macro rather than
-@code{SWITCH_TAKES_ARG} is used for multi-character option names.
-
-By default, this macro is defined as
-@code{DEFAULT_WORD_SWITCH_TAKES_ARG}, which handles the standard options
-properly. You need not define @code{WORD_SWITCH_TAKES_ARG} unless you
-wish to add additional options which take arguments. Any redefinition
-should call @code{DEFAULT_WORD_SWITCH_TAKES_ARG} and then check for
-additional options.
-
-@findex SWITCHES_NEED_SPACES
-@item SWITCHES_NEED_SPACES
-A string-valued C expression which enumerates the options for which
-the linker needs a space between the option and its argument.
-
-If this macro is not defined, the default value is @code{""}.
-
-@findex CPP_SPEC
-@item CPP_SPEC
-A C string constant that tells the GNU CC driver program options to
-pass to CPP. It can also specify how to translate options you
-give to GNU CC into options for GNU CC to pass to the CPP.
-
-Do not define this macro if it does not need to do anything.
-
-@findex NO_BUILTIN_SIZE_TYPE
-@item NO_BUILTIN_SIZE_TYPE
-If this macro is defined, the preprocessor will not define the builtin macro
-@code{__SIZE_TYPE__}. The macro @code{__SIZE_TYPE__} must then be defined
-by @code{CPP_SPEC} instead.
-
-This should be defined if @code{SIZE_TYPE} depends on target dependent flags
-which are not accessible to the preprocessor. Otherwise, it should not
-be defined.
-
-@findex NO_BUILTIN_PTRDIFF_TYPE
-@item NO_BUILTIN_PTRDIFF_TYPE
-If this macro is defined, the preprocessor will not define the builtin macro
-@code{__PTRDIFF_TYPE__}. The macro @code{__PTRDIFF_TYPE__} must then be
-defined by @code{CPP_SPEC} instead.
-
-This should be defined if @code{PTRDIFF_TYPE} depends on target dependent flags
-which are not accessible to the preprocessor. Otherwise, it should not
-be defined.
-
-@findex SIGNED_CHAR_SPEC
-@item SIGNED_CHAR_SPEC
-A C string constant that tells the GNU CC driver program options to
-pass to CPP. By default, this macro is defined to pass the option
-@samp{-D__CHAR_UNSIGNED__} to CPP if @code{char} will be treated as
-@code{unsigned char} by @code{cc1}.
-
-Do not define this macro unless you need to override the default
-definition.
-
-@findex CC1_SPEC
-@item CC1_SPEC
-A C string constant that tells the GNU CC driver program options to
-pass to @code{cc1}. It can also specify how to translate options you
-give to GNU CC into options for GNU CC to pass to the @code{cc1}.
-
-Do not define this macro if it does not need to do anything.
-
-@findex CC1PLUS_SPEC
-@item CC1PLUS_SPEC
-A C string constant that tells the GNU CC driver program options to
-pass to @code{cc1plus}. It can also specify how to translate options you
-give to GNU CC into options for GNU CC to pass to the @code{cc1plus}.
-
-Do not define this macro if it does not need to do anything.
-
-@findex ASM_SPEC
-@item ASM_SPEC
-A C string constant that tells the GNU CC driver program options to
-pass to the assembler. It can also specify how to translate options
-you give to GNU CC into options for GNU CC to pass to the assembler.
-See the file @file{sun3.h} for an example of this.
-
-Do not define this macro if it does not need to do anything.
-
-@findex ASM_FINAL_SPEC
-@item ASM_FINAL_SPEC
-A C string constant that tells the GNU CC driver program how to
-run any programs which cleanup after the normal assembler.
-Normally, this is not needed. See the file @file{mips.h} for
-an example of this.
-
-Do not define this macro if it does not need to do anything.
-
-@findex LINK_SPEC
-@item LINK_SPEC
-A C string constant that tells the GNU CC driver program options to
-pass to the linker. It can also specify how to translate options you
-give to GNU CC into options for GNU CC to pass to the linker.
-
-Do not define this macro if it does not need to do anything.
-
-@findex LIB_SPEC
-@item LIB_SPEC
-Another C string constant used much like @code{LINK_SPEC}. The difference
-between the two is that @code{LIB_SPEC} is used at the end of the
-command given to the linker.
-
-If this macro is not defined, a default is provided that
-loads the standard C library from the usual place. See @file{gcc.c}.
-
-@findex LIBGCC_SPEC
-@item LIBGCC_SPEC
-Another C string constant that tells the GNU CC driver program
-how and when to place a reference to @file{libgcc.a} into the
-linker command line. This constant is placed both before and after
-the value of @code{LIB_SPEC}.
-
-If this macro is not defined, the GNU CC driver provides a default that
-passes the string @samp{-lgcc} to the linker unless the @samp{-shared}
-option is specified.
-
-@findex STARTFILE_SPEC
-@item STARTFILE_SPEC
-Another C string constant used much like @code{LINK_SPEC}. The
-difference between the two is that @code{STARTFILE_SPEC} is used at
-the very beginning of the command given to the linker.
-
-If this macro is not defined, a default is provided that loads the
-standard C startup file from the usual place. See @file{gcc.c}.
-
-@findex ENDFILE_SPEC
-@item ENDFILE_SPEC
-Another C string constant used much like @code{LINK_SPEC}. The
-difference between the two is that @code{ENDFILE_SPEC} is used at
-the very end of the command given to the linker.
-
-Do not define this macro if it does not need to do anything.
-
-@findex EXTRA_SPECS
-@item EXTRA_SPECS
-Define this macro to provide additional specifications to put in the
-@file{specs} file that can be used in various specifications like
-@code{CC1_SPEC}.
-
-The definition should be an initializer for an array of structures,
-containing a string constant, that defines the specification name, and a
-string constant that provides the specification.
-
-Do not define this macro if it does not need to do anything.
-
-@code{EXTRA_SPECS} is useful when an architecture contains several
-related targets, which have various @code{..._SPECS} which are similar
-to each other, and the maintainer would like one central place to keep
-these definitions.
-
-For example, the PowerPC System V.4 targets use @code{EXTRA_SPECS} to
-define either @code{_CALL_SYSV} when the System V calling sequence is
-used or @code{_CALL_AIX} when the older AIX-based calling sequence is
-used.
-
-The @file{config/rs6000/rs6000.h} target file defines:
-
-@example
-#define EXTRA_SPECS \
- @{ "cpp_sysv_default", CPP_SYSV_DEFAULT @},
-
-#define CPP_SYS_DEFAULT ""
-@end example
-
-The @file{config/rs6000/sysv.h} target file defines:
-@smallexample
-#undef CPP_SPEC
-#define CPP_SPEC \
-"%@{posix: -D_POSIX_SOURCE @} \
-%@{mcall-sysv: -D_CALL_SYSV @} %@{mcall-aix: -D_CALL_AIX @} \
-%@{!mcall-sysv: %@{!mcall-aix: %(cpp_sysv_default) @}@} \
-%@{msoft-float: -D_SOFT_FLOAT@} %@{mcpu=403: -D_SOFT_FLOAT@}"
-
-#undef CPP_SYSV_DEFAULT
-#define CPP_SYSV_DEFAULT "-D_CALL_SYSV"
-@end smallexample
-
-while the @file{config/rs6000/eabiaix.h} target file defines
-@code{CPP_SYSV_DEFAULT} as:
-
-@smallexample
-#undef CPP_SYSV_DEFAULT
-#define CPP_SYSV_DEFAULT "-D_CALL_AIX"
-@end smallexample
-
-@findex LINK_LIBGCC_SPECIAL
-@item LINK_LIBGCC_SPECIAL
-Define this macro if the driver program should find the library
-@file{libgcc.a} itself and should not pass @samp{-L} options to the
-linker. If you do not define this macro, the driver program will pass
-the argument @samp{-lgcc} to tell the linker to do the search and will
-pass @samp{-L} options to it.
-
-@findex LINK_LIBGCC_SPECIAL_1
-@item LINK_LIBGCC_SPECIAL_1
-Define this macro if the driver program should find the library
-@file{libgcc.a}. If you do not define this macro, the driver program will pass
-the argument @samp{-lgcc} to tell the linker to do the search.
-This macro is similar to @code{LINK_LIBGCC_SPECIAL}, except that it does
-not affect @samp{-L} options.
-
-@findex MULTILIB_DEFAULTS
-@item MULTILIB_DEFAULTS
-Define this macro as a C expression for the initializer of an array of
-string to tell the driver program which options are defaults for this
-target and thus do not need to be handled specially when using
-@code{MULTILIB_OPTIONS}.
-
-Do not define this macro if @code{MULTILIB_OPTIONS} is not defined in
-the target makefile fragment or if none of the options listed in
-@code{MULTILIB_OPTIONS} are set by default.
-@xref{Target Fragment}.
-
-@findex RELATIVE_PREFIX_NOT_LINKDIR
-@item RELATIVE_PREFIX_NOT_LINKDIR
-Define this macro to tell @code{gcc} that it should only translate
-a @samp{-B} prefix into a @samp{-L} linker option if the prefix
-indicates an absolute file name.
-
-@findex STANDARD_EXEC_PREFIX
-@item STANDARD_EXEC_PREFIX
-Define this macro as a C string constant if you wish to override the
-standard choice of @file{/usr/local/lib/gcc-lib/} as the default prefix to
-try when searching for the executable files of the compiler.
-
-@findex MD_EXEC_PREFIX
-@item MD_EXEC_PREFIX
-If defined, this macro is an additional prefix to try after
-@code{STANDARD_EXEC_PREFIX}. @code{MD_EXEC_PREFIX} is not searched
-when the @samp{-b} option is used, or the compiler is built as a cross
-compiler.
-
-@findex STANDARD_STARTFILE_PREFIX
-@item STANDARD_STARTFILE_PREFIX
-Define this macro as a C string constant if you wish to override the
-standard choice of @file{/usr/local/lib/} as the default prefix to
-try when searching for startup files such as @file{crt0.o}.
-
-@findex MD_STARTFILE_PREFIX
-@item MD_STARTFILE_PREFIX
-If defined, this macro supplies an additional prefix to try after the
-standard prefixes. @code{MD_EXEC_PREFIX} is not searched when the
-@samp{-b} option is used, or when the compiler is built as a cross
-compiler.
-
-@findex MD_STARTFILE_PREFIX_1
-@item MD_STARTFILE_PREFIX_1
-If defined, this macro supplies yet another prefix to try after the
-standard prefixes. It is not searched when the @samp{-b} option is
-used, or when the compiler is built as a cross compiler.
-
-@findex INIT_ENVIRONMENT
-@item INIT_ENVIRONMENT
-Define this macro as a C string constant if you with to set environment
-variables for programs called by the driver, such as the assembler and
-loader. The driver passes the value of this macro to @code{putenv} to
-initialize the necessary environment variables.
-
-@findex LOCAL_INCLUDE_DIR
-@item LOCAL_INCLUDE_DIR
-Define this macro as a C string constant if you wish to override the
-standard choice of @file{/usr/local/include} as the default prefix to
-try when searching for local header files. @code{LOCAL_INCLUDE_DIR}
-comes before @code{SYSTEM_INCLUDE_DIR} in the search order.
-
-Cross compilers do not use this macro and do not search either
-@file{/usr/local/include} or its replacement.
-
-@findex SYSTEM_INCLUDE_DIR
-@item SYSTEM_INCLUDE_DIR
-Define this macro as a C string constant if you wish to specify a
-system-specific directory to search for header files before the standard
-directory. @code{SYSTEM_INCLUDE_DIR} comes before
-@code{STANDARD_INCLUDE_DIR} in the search order.
-
-Cross compilers do not use this macro and do not search the directory
-specified.
-
-@findex STANDARD_INCLUDE_DIR
-@item STANDARD_INCLUDE_DIR
-Define this macro as a C string constant if you wish to override the
-standard choice of @file{/usr/include} as the default prefix to
-try when searching for header files.
-
-Cross compilers do not use this macro and do not search either
-@file{/usr/include} or its replacement.
-
-@findex INCLUDE_DEFAULTS
-@item INCLUDE_DEFAULTS
-Define this macro if you wish to override the entire default search path
-for include files. The default search path includes
-@code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR},
-@code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and
-@code{STANDARD_INCLUDE_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR}
-and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile},
-and specify private search areas for GCC. The directory
-@code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs.
-
-The definition should be an initializer for an array of structures.
-Each array element should have two elements: the directory name (a
-string constant) and a flag for C++-only directories. Mark the end of
-the array with a null element. For example, here is the definition used
-for VMS:
-
-@example
-#define INCLUDE_DEFAULTS \
-@{ \
- @{ "GNU_GXX_INCLUDE:", 1@}, \
- @{ "GNU_CC_INCLUDE:", 0@}, \
- @{ "SYS$SYSROOT:[SYSLIB.]", 0@}, \
- @{ ".", 0@}, \
- @{ 0, 0@} \
-@}
-@end example
-@end table
-
-Here is the order of prefixes tried for exec files:
-
-@enumerate
-@item
-Any prefixes specified by the user with @samp{-B}.
-
-@item
-The environment variable @code{GCC_EXEC_PREFIX}, if any.
-
-@item
-The directories specified by the environment variable @code{COMPILER_PATH}.
-
-@item
-The macro @code{STANDARD_EXEC_PREFIX}.
-
-@item
-@file{/usr/lib/gcc/}.
-
-@item
-The macro @code{MD_EXEC_PREFIX}, if any.
-@end enumerate
-
-Here is the order of prefixes tried for startfiles:
-
-@enumerate
-@item
-Any prefixes specified by the user with @samp{-B}.
-
-@item
-The environment variable @code{GCC_EXEC_PREFIX}, if any.
-
-@item
-The directories specified by the environment variable @code{LIBRARY_PATH}
-(native only, cross compilers do not use this).
-
-@item
-The macro @code{STANDARD_EXEC_PREFIX}.
-
-@item
-@file{/usr/lib/gcc/}.
-
-@item
-The macro @code{MD_EXEC_PREFIX}, if any.
-
-@item
-The macro @code{MD_STARTFILE_PREFIX}, if any.
-
-@item
-The macro @code{STANDARD_STARTFILE_PREFIX}.
-
-@item
-@file{/lib/}.
-
-@item
-@file{/usr/lib/}.
-@end enumerate
-
-@node Run-time Target
-@section Run-time Target Specification
-@cindex run-time target specification
-@cindex predefined macros
-@cindex target specifications
-
-@c prevent bad page break with this line
-Here are run-time target specifications.
-
-@table @code
-@findex CPP_PREDEFINES
-@item CPP_PREDEFINES
-Define this to be a string constant containing @samp{-D} options to
-define the predefined macros that identify this machine and system.
-These macros will be predefined unless the @samp{-ansi} option is
-specified.
-
-In addition, a parallel set of macros are predefined, whose names are
-made by appending @samp{__} at the beginning and at the end. These
-@samp{__} macros are permitted by the ANSI standard, so they are
-predefined regardless of whether @samp{-ansi} is specified.
-
-For example, on the Sun, one can use the following value:
-
-@smallexample
-"-Dmc68000 -Dsun -Dunix"
-@end smallexample
-
-The result is to define the macros @code{__mc68000__}, @code{__sun__}
-and @code{__unix__} unconditionally, and the macros @code{mc68000},
-@code{sun} and @code{unix} provided @samp{-ansi} is not specified.
-
-@findex extern int target_flags
-@item extern int target_flags;
-This declaration should be present.
-
-@cindex optional hardware or system features
-@cindex features, optional, in system conventions
-@item TARGET_@dots{}
-This series of macros is to allow compiler command arguments to
-enable or disable the use of optional features of the target machine.
-For example, one machine description serves both the 68000 and
-the 68020; a command argument tells the compiler whether it should
-use 68020-only instructions or not. This command argument works
-by means of a macro @code{TARGET_68020} that tests a bit in
-@code{target_flags}.
-
-Define a macro @code{TARGET_@var{featurename}} for each such option.
-Its definition should test a bit in @code{target_flags}; for example:
-
-@smallexample
-#define TARGET_68020 (target_flags & 1)
-@end smallexample
-
-One place where these macros are used is in the condition-expressions
-of instruction patterns. Note how @code{TARGET_68020} appears
-frequently in the 68000 machine description file, @file{m68k.md}.
-Another place they are used is in the definitions of the other
-macros in the @file{@var{machine}.h} file.
-
-@findex TARGET_SWITCHES
-@item TARGET_SWITCHES
-This macro defines names of command options to set and clear
-bits in @code{target_flags}. Its definition is an initializer
-with a subgrouping for each command option.
-
-Each subgrouping contains a string constant, that defines the option
-name, and a number, which contains the bits to set in
-@code{target_flags}. A negative number says to clear bits instead;
-the negative of the number is which bits to clear. The actual option
-name is made by appending @samp{-m} to the specified name.
-
-One of the subgroupings should have a null string. The number in
-this grouping is the default value for @code{target_flags}. Any
-target options act starting with that value.
-
-Here is an example which defines @samp{-m68000} and @samp{-m68020}
-with opposite meanings, and picks the latter as the default:
-
-@smallexample
-#define TARGET_SWITCHES \
- @{ @{ "68020", 1@}, \
- @{ "68000", -1@}, \
- @{ "", 1@}@}
-@end smallexample
-
-@findex TARGET_OPTIONS
-@item TARGET_OPTIONS
-This macro is similar to @code{TARGET_SWITCHES} but defines names of command
-options that have values. Its definition is an initializer with a
-subgrouping for each command option.
-
-Each subgrouping contains a string constant, that defines the fixed part
-of the option name, and the address of a variable. The variable, type
-@code{char *}, is set to the variable part of the given option if the fixed
-part matches. The actual option name is made by appending @samp{-m} to the
-specified name.
-
-Here is an example which defines @samp{-mshort-data-@var{number}}. If the
-given option is @samp{-mshort-data-512}, the variable @code{m88k_short_data}
-will be set to the string @code{"512"}.
-
-@smallexample
-extern char *m88k_short_data;
-#define TARGET_OPTIONS \
- @{ @{ "short-data-", &m88k_short_data @} @}
-@end smallexample
-
-@findex TARGET_VERSION
-@item TARGET_VERSION
-This macro is a C statement to print on @code{stderr} a string
-describing the particular machine description choice. Every machine
-description should define @code{TARGET_VERSION}. For example:
-
-@smallexample
-#ifdef MOTOROLA
-#define TARGET_VERSION \
- fprintf (stderr, " (68k, Motorola syntax)");
-#else
-#define TARGET_VERSION \
- fprintf (stderr, " (68k, MIT syntax)");
-#endif
-@end smallexample
-
-@findex OVERRIDE_OPTIONS
-@item OVERRIDE_OPTIONS
-Sometimes certain combinations of command options do not make sense on
-a particular target machine. You can define a macro
-@code{OVERRIDE_OPTIONS} to take account of this. This macro, if
-defined, is executed once just after all the command options have been
-parsed.
-
-Don't use this macro to turn on various extra optimizations for
-@samp{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for.
-
-@findex OPTIMIZATION_OPTIONS
-@item OPTIMIZATION_OPTIONS (@var{level})
-Some machines may desire to change what optimizations are performed for
-various optimization levels. This macro, if defined, is executed once
-just after the optimization level is determined and before the remainder
-of the command options have been parsed. Values set in this macro are
-used as the default values for the other command line options.
-
-@var{level} is the optimization level specified; 2 if @samp{-O2} is
-specified, 1 if @samp{-O} is specified, and 0 if neither is specified.
-
-You should not use this macro to change options that are not
-machine-specific. These should uniformly selected by the same
-optimization level on all supported machines. Use this macro to enable
-machine-specific optimizations.
-
-@strong{Do not examine @code{write_symbols} in
-this macro!} The debugging options are not supposed to alter the
-generated code.
-
-@findex CAN_DEBUG_WITHOUT_FP
-@item CAN_DEBUG_WITHOUT_FP
-Define this macro if debugging can be performed even without a frame
-pointer. If this macro is defined, GNU CC will turn on the
-@samp{-fomit-frame-pointer} option whenever @samp{-O} is specified.
-@end table
-
-@node Storage Layout
-@section Storage Layout
-@cindex storage layout
-
-Note that the definitions of the macros in this table which are sizes or
-alignments measured in bits do not need to be constant. They can be C
-expressions that refer to static variables, such as the @code{target_flags}.
-@xref{Run-time Target}.
-
-@table @code
-@findex BITS_BIG_ENDIAN
-@item BITS_BIG_ENDIAN
-Define this macro to have the value 1 if the most significant bit in a
-byte has the lowest number; otherwise define it to have the value zero.
-This means that bit-field instructions count from the most significant
-bit. If the machine has no bit-field instructions, then this must still
-be defined, but it doesn't matter which value it is defined to. This
-macro need not be a constant.
-
-This macro does not affect the way structure fields are packed into
-bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}.
-
-@findex BYTES_BIG_ENDIAN
-@item BYTES_BIG_ENDIAN
-Define this macro to have the value 1 if the most significant byte in a
-word has the lowest number. This macro need not be a constant.
-
-@findex WORDS_BIG_ENDIAN
-@item WORDS_BIG_ENDIAN
-Define this macro to have the value 1 if, in a multiword object, the
-most significant word has the lowest number. This applies to both
-memory locations and registers; GNU CC fundamentally assumes that the
-order of words in memory is the same as the order in registers. This
-macro need not be a constant.
-
-@findex LIBGCC2_WORDS_BIG_ENDIAN
-@item LIBGCC2_WORDS_BIG_ENDIAN
-Define this macro if WORDS_BIG_ENDIAN is not constant. This must be a
-constant value with the same meaning as WORDS_BIG_ENDIAN, which will be
-used only when compiling libgcc2.c. Typically the value will be set
-based on preprocessor defines.
-
-@findex FLOAT_WORDS_BIG_ENDIAN
-@item FLOAT_WORDS_BIG_ENDIAN
-Define this macro to have the value 1 if @code{DFmode}, @code{XFmode} or
-@code{TFmode} floating point numbers are stored in memory with the word
-containing the sign bit at the lowest address; otherwise define it to
-have the value 0. This macro need not be a constant.
-
-You need not define this macro if the ordering is the same as for
-multi-word integers.
-
-@findex BITS_PER_UNIT
-@item BITS_PER_UNIT
-Define this macro to be the number of bits in an addressable storage
-unit (byte); normally 8.
-
-@findex BITS_PER_WORD
-@item BITS_PER_WORD
-Number of bits in a word; normally 32.
-
-@findex MAX_BITS_PER_WORD
-@item MAX_BITS_PER_WORD
-Maximum number of bits in a word. If this is undefined, the default is
-@code{BITS_PER_WORD}. Otherwise, it is the constant value that is the
-largest value that @code{BITS_PER_WORD} can have at run-time.
-
-@findex UNITS_PER_WORD
-@item UNITS_PER_WORD
-Number of storage units in a word; normally 4.
-
-@findex MIN_UNITS_PER_WORD
-@item MIN_UNITS_PER_WORD
-Minimum number of units in a word. If this is undefined, the default is
-@code{UNITS_PER_WORD}. Otherwise, it is the constant value that is the
-smallest value that @code{UNITS_PER_WORD} can have at run-time.
-
-@findex POINTER_SIZE
-@item POINTER_SIZE
-Width of a pointer, in bits. You must specify a value no wider than the
-width of @code{Pmode}. If it is not equal to the width of @code{Pmode},
-you must define @code{POINTERS_EXTEND_UNSIGNED}.
-
-@findex POINTERS_EXTEND_UNSIGNED
-@item POINTERS_EXTEND_UNSIGNED
-A C expression whose value is nonzero if pointers that need to be
-extended from being @code{POINTER_SIZE} bits wide to @code{Pmode}
-are sign-extended and zero if they are zero-extended.
-
-You need not define this macro if the @code{POINTER_SIZE} is equal
-to the width of @code{Pmode}.
-
-@findex PROMOTE_MODE
-@item PROMOTE_MODE (@var{m}, @var{unsignedp}, @var{type})
-A macro to update @var{m} and @var{unsignedp} when an object whose type
-is @var{type} and which has the specified mode and signedness is to be
-stored in a register. This macro is only called when @var{type} is a
-scalar type.
-
-On most RISC machines, which only have operations that operate on a full
-register, define this macro to set @var{m} to @code{word_mode} if
-@var{m} is an integer mode narrower than @code{BITS_PER_WORD}. In most
-cases, only integer modes should be widened because wider-precision
-floating-point operations are usually more expensive than their narrower
-counterparts.
-
-For most machines, the macro definition does not change @var{unsignedp}.
-However, some machines, have instructions that preferentially handle
-either signed or unsigned quantities of certain modes. For example, on
-the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
-sign-extend the result to 64 bits. On such machines, set
-@var{unsignedp} according to which kind of extension is more efficient.
-
-Do not define this macro if it would never modify @var{m}.
-
-@findex PROMOTE_FUNCTION_ARGS
-@item PROMOTE_FUNCTION_ARGS
-Define this macro if the promotion described by @code{PROMOTE_MODE}
-should also be done for outgoing function arguments.
-
-@findex PROMOTE_FUNCTION_RETURN
-@item PROMOTE_FUNCTION_RETURN
-Define this macro if the promotion described by @code{PROMOTE_MODE}
-should also be done for the return value of functions.
-
-If this macro is defined, @code{FUNCTION_VALUE} must perform the same
-promotions done by @code{PROMOTE_MODE}.
-
-@findex PROMOTE_FOR_CALL_ONLY
-@item PROMOTE_FOR_CALL_ONLY
-Define this macro if the promotion described by @code{PROMOTE_MODE}
-should @emph{only} be performed for outgoing function arguments or
-function return values, as specified by @code{PROMOTE_FUNCTION_ARGS}
-and @code{PROMOTE_FUNCTION_RETURN}, respectively.
-
-@findex PARM_BOUNDARY
-@item PARM_BOUNDARY
-Normal alignment required for function parameters on the stack, in
-bits. All stack parameters receive at least this much alignment
-regardless of data type. On most machines, this is the same as the
-size of an integer.
-
-@findex STACK_BOUNDARY
-@item STACK_BOUNDARY
-Define this macro if you wish to preserve a certain alignment for
-the stack pointer. The definition is a C expression
-for the desired alignment (measured in bits).
-
-@cindex @code{PUSH_ROUNDING}, interaction with @code{STACK_BOUNDARY}
-If @code{PUSH_ROUNDING} is not defined, the stack will always be aligned
-to the specified boundary. If @code{PUSH_ROUNDING} is defined and specifies a
-less strict alignment than @code{STACK_BOUNDARY}, the stack may be
-momentarily unaligned while pushing arguments.
-
-@findex FUNCTION_BOUNDARY
-@item FUNCTION_BOUNDARY
-Alignment required for a function entry point, in bits.
-
-@findex BIGGEST_ALIGNMENT
-@item BIGGEST_ALIGNMENT
-Biggest alignment that any data type can require on this machine, in bits.
-
-@findex BIGGEST_FIELD_ALIGNMENT
-@item BIGGEST_FIELD_ALIGNMENT
-Biggest alignment that any structure field can require on this machine,
-in bits. If defined, this overrides @code{BIGGEST_ALIGNMENT} for
-structure fields only.
-
-@findex ADJUST_FIELD_ALIGN
-@item ADJUST_FIELD_ALIGN (@var{field}, @var{computed})
-An expression for the alignment of a structure field @var{field} if the
-alignment computed in the usual way is @var{computed}. GNU CC uses
-this value instead of the value in @code{BIGGEST_ALIGNMENT} or
-@code{BIGGEST_FIELD_ALIGNMENT}, if defined, for structure fields only.
-
-@findex MAX_OFILE_ALIGNMENT
-@item MAX_OFILE_ALIGNMENT
-Biggest alignment supported by the object file format of this machine.
-Use this macro to limit the alignment which can be specified using the
-@code{__attribute__ ((aligned (@var{n})))} construct. If not defined,
-the default value is @code{BIGGEST_ALIGNMENT}.
-
-@findex DATA_ALIGNMENT
-@item DATA_ALIGNMENT (@var{type}, @var{basic-align})
-If defined, a C expression to compute the alignment for a static
-variable. @var{type} is the data type, and @var{basic-align} is the
-alignment that the object would ordinarily have. The value of this
-macro is used instead of that alignment to align the object.
-
-If this macro is not defined, then @var{basic-align} is used.
-
-@findex strcpy
-One use of this macro is to increase alignment of medium-size data to
-make it all fit in fewer cache lines. Another is to cause character
-arrays to be word-aligned so that @code{strcpy} calls that copy
-constants to character arrays can be done inline.
-
-@findex CONSTANT_ALIGNMENT
-@item CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})
-If defined, a C expression to compute the alignment given to a constant
-that is being placed in memory. @var{constant} is the constant and
-@var{basic-align} is the alignment that the object would ordinarily
-have. The value of this macro is used instead of that alignment to
-align the object.
-
-If this macro is not defined, then @var{basic-align} is used.
-
-The typical use of this macro is to increase alignment for string
-constants to be word aligned so that @code{strcpy} calls that copy
-constants can be done inline.
-
-@findex EMPTY_FIELD_BOUNDARY
-@item EMPTY_FIELD_BOUNDARY
-Alignment in bits to be given to a structure bit field that follows an
-empty field such as @code{int : 0;}.
-
-Note that @code{PCC_BITFIELD_TYPE_MATTERS} also affects the alignment
-that results from an empty field.
-
-@findex STRUCTURE_SIZE_BOUNDARY
-@item STRUCTURE_SIZE_BOUNDARY
-Number of bits which any structure or union's size must be a multiple of.
-Each structure or union's size is rounded up to a multiple of this.
-
-If you do not define this macro, the default is the same as
-@code{BITS_PER_UNIT}.
-
-@findex STRICT_ALIGNMENT
-@item STRICT_ALIGNMENT
-Define this macro to be the value 1 if instructions will fail to work
-if given data not on the nominal alignment. If instructions will merely
-go slower in that case, define this macro as 0.
-
-@findex PCC_BITFIELD_TYPE_MATTERS
-@item PCC_BITFIELD_TYPE_MATTERS
-Define this if you wish to imitate the way many other C compilers handle
-alignment of bitfields and the structures that contain them.
-
-The behavior is that the type written for a bitfield (@code{int},
-@code{short}, or other integer type) imposes an alignment for the
-entire structure, as if the structure really did contain an ordinary
-field of that type. In addition, the bitfield is placed within the
-structure so that it would fit within such a field, not crossing a
-boundary for it.
-
-Thus, on most machines, a bitfield whose type is written as @code{int}
-would not cross a four-byte boundary, and would force four-byte
-alignment for the whole structure. (The alignment used may not be four
-bytes; it is controlled by the other alignment parameters.)
-
-If the macro is defined, its definition should be a C expression;
-a nonzero value for the expression enables this behavior.
-
-Note that if this macro is not defined, or its value is zero, some
-bitfields may cross more than one alignment boundary. The compiler can
-support such references if there are @samp{insv}, @samp{extv}, and
-@samp{extzv} insns that can directly reference memory.
-
-The other known way of making bitfields work is to define
-@code{STRUCTURE_SIZE_BOUNDARY} as large as @code{BIGGEST_ALIGNMENT}.
-Then every structure can be accessed with fullwords.
-
-Unless the machine has bitfield instructions or you define
-@code{STRUCTURE_SIZE_BOUNDARY} that way, you must define
-@code{PCC_BITFIELD_TYPE_MATTERS} to have a nonzero value.
-
-If your aim is to make GNU CC use the same conventions for laying out
-bitfields as are used by another compiler, here is how to investigate
-what the other compiler does. Compile and run this program:
-
-@example
-struct foo1
-@{
- char x;
- char :0;
- char y;
-@};
-
-struct foo2
-@{
- char x;
- int :0;
- char y;
-@};
-
-main ()
-@{
- printf ("Size of foo1 is %d\n",
- sizeof (struct foo1));
- printf ("Size of foo2 is %d\n",
- sizeof (struct foo2));
- exit (0);
-@}
-@end example
-
-If this prints 2 and 5, then the compiler's behavior is what you would
-get from @code{PCC_BITFIELD_TYPE_MATTERS}.
-
-@findex BITFIELD_NBYTES_LIMITED
-@item BITFIELD_NBYTES_LIMITED
-Like PCC_BITFIELD_TYPE_MATTERS except that its effect is limited to
-aligning a bitfield within the structure.
-
-@findex ROUND_TYPE_SIZE
-@item ROUND_TYPE_SIZE (@var{struct}, @var{size}, @var{align})
-Define this macro as an expression for the overall size of a structure
-(given by @var{struct} as a tree node) when the size computed from the
-fields is @var{size} and the alignment is @var{align}.
-
-The default is to round @var{size} up to a multiple of @var{align}.
-
-@findex ROUND_TYPE_ALIGN
-@item ROUND_TYPE_ALIGN (@var{struct}, @var{computed}, @var{specified})
-Define this macro as an expression for the alignment of a structure
-(given by @var{struct} as a tree node) if the alignment computed in the
-usual way is @var{computed} and the alignment explicitly specified was
-@var{specified}.
-
-The default is to use @var{specified} if it is larger; otherwise, use
-the smaller of @var{computed} and @code{BIGGEST_ALIGNMENT}
-
-@findex MAX_FIXED_MODE_SIZE
-@item MAX_FIXED_MODE_SIZE
-An integer expression for the size in bits of the largest integer
-machine mode that should actually be used. All integer machine modes of
-this size or smaller can be used for structures and unions with the
-appropriate sizes. If this macro is undefined, @code{GET_MODE_BITSIZE
-(DImode)} is assumed.
-
-@findex CHECK_FLOAT_VALUE
-@item CHECK_FLOAT_VALUE (@var{mode}, @var{value}, @var{overflow})
-A C statement to validate the value @var{value} (of type
-@code{double}) for mode @var{mode}. This means that you check whether
-@var{value} fits within the possible range of values for mode
-@var{mode} on this target machine. The mode @var{mode} is always
-a mode of class @code{MODE_FLOAT}. @var{overflow} is nonzero if
-the value is already known to be out of range.
-
-If @var{value} is not valid or if @var{overflow} is nonzero, you should
-set @var{overflow} to 1 and then assign some valid value to @var{value}.
-Allowing an invalid value to go through the compiler can produce
-incorrect assembler code which may even cause Unix assemblers to crash.
-
-This macro need not be defined if there is no work for it to do.
-
-@findex TARGET_FLOAT_FORMAT
-@item TARGET_FLOAT_FORMAT
-A code distinguishing the floating point format of the target machine.
-There are three defined values:
-
-@table @code
-@findex IEEE_FLOAT_FORMAT
-@item IEEE_FLOAT_FORMAT
-This code indicates IEEE floating point. It is the default; there is no
-need to define this macro when the format is IEEE.
-
-@findex VAX_FLOAT_FORMAT
-@item VAX_FLOAT_FORMAT
-This code indicates the peculiar format used on the Vax.
-
-@findex UNKNOWN_FLOAT_FORMAT
-@item UNKNOWN_FLOAT_FORMAT
-This code indicates any other format.
-@end table
-
-The value of this macro is compared with @code{HOST_FLOAT_FORMAT}
-(@pxref{Config}) to determine whether the target machine has the same
-format as the host machine. If any other formats are actually in use on
-supported machines, new codes should be defined for them.
-
-The ordering of the component words of floating point values stored in
-memory is controlled by @code{FLOAT_WORDS_BIG_ENDIAN} for the target
-machine and @code{HOST_FLOAT_WORDS_BIG_ENDIAN} for the host.
-@end table
-
-@node Type Layout
-@section Layout of Source Language Data Types
-
-These macros define the sizes and other characteristics of the standard
-basic data types used in programs being compiled. Unlike the macros in
-the previous section, these apply to specific features of C and related
-languages, rather than to fundamental aspects of storage layout.
-
-@table @code
-@findex INT_TYPE_SIZE
-@item INT_TYPE_SIZE
-A C expression for the size in bits of the type @code{int} on the
-target machine. If you don't define this, the default is one word.
-
-@findex MAX_INT_TYPE_SIZE
-@item MAX_INT_TYPE_SIZE
-Maximum number for the size in bits of the type @code{int} on the target
-machine. If this is undefined, the default is @code{INT_TYPE_SIZE}.
-Otherwise, it is the constant value that is the largest value that
-@code{INT_TYPE_SIZE} can have at run-time. This is used in @code{cpp}.
-
-@findex SHORT_TYPE_SIZE
-@item SHORT_TYPE_SIZE
-A C expression for the size in bits of the type @code{short} on the
-target machine. If you don't define this, the default is half a word.
-(If this would be less than one storage unit, it is rounded up to one
-unit.)
-
-@findex LONG_TYPE_SIZE
-@item LONG_TYPE_SIZE
-A C expression for the size in bits of the type @code{long} on the
-target machine. If you don't define this, the default is one word.
-
-@findex MAX_LONG_TYPE_SIZE
-@item MAX_LONG_TYPE_SIZE
-Maximum number for the size in bits of the type @code{long} on the
-target machine. If this is undefined, the default is
-@code{LONG_TYPE_SIZE}. Otherwise, it is the constant value that is the
-largest value that @code{LONG_TYPE_SIZE} can have at run-time. This is
-used in @code{cpp}.
-
-@findex LONG_LONG_TYPE_SIZE
-@item LONG_LONG_TYPE_SIZE
-A C expression for the size in bits of the type @code{long long} on the
-target machine. If you don't define this, the default is two
-words. If you want to support GNU Ada on your machine, the value of
-macro must be at least 64.
-
-@findex CHAR_TYPE_SIZE
-@item CHAR_TYPE_SIZE
-A C expression for the size in bits of the type @code{char} on the
-target machine. If you don't define this, the default is one quarter
-of a word. (If this would be less than one storage unit, it is rounded up
-to one unit.)
-
-@findex MAX_CHAR_TYPE_SIZE
-@item MAX_CHAR_TYPE_SIZE
-Maximum number for the size in bits of the type @code{char} on the
-target machine. If this is undefined, the default is
-@code{CHAR_TYPE_SIZE}. Otherwise, it is the constant value that is the
-largest value that @code{CHAR_TYPE_SIZE} can have at run-time. This is
-used in @code{cpp}.
-
-@findex FLOAT_TYPE_SIZE
-@item FLOAT_TYPE_SIZE
-A C expression for the size in bits of the type @code{float} on the
-target machine. If you don't define this, the default is one word.
-
-@findex DOUBLE_TYPE_SIZE
-@item DOUBLE_TYPE_SIZE
-A C expression for the size in bits of the type @code{double} on the
-target machine. If you don't define this, the default is two
-words.
-
-@findex LONG_DOUBLE_TYPE_SIZE
-@item LONG_DOUBLE_TYPE_SIZE
-A C expression for the size in bits of the type @code{long double} on
-the target machine. If you don't define this, the default is two
-words.
-
-@findex DEFAULT_SIGNED_CHAR
-@item DEFAULT_SIGNED_CHAR
-An expression whose value is 1 or 0, according to whether the type
-@code{char} should be signed or unsigned by default. The user can
-always override this default with the options @samp{-fsigned-char}
-and @samp{-funsigned-char}.
-
-@findex DEFAULT_SHORT_ENUMS
-@item DEFAULT_SHORT_ENUMS
-A C expression to determine whether to give an @code{enum} type
-only as many bytes as it takes to represent the range of possible values
-of that type. A nonzero value means to do that; a zero value means all
-@code{enum} types should be allocated like @code{int}.
-
-If you don't define the macro, the default is 0.
-
-@findex SIZE_TYPE
-@item SIZE_TYPE
-A C expression for a string describing the name of the data type to use
-for size values. The typedef name @code{size_t} is defined using the
-contents of the string.
-
-The string can contain more than one keyword. If so, separate them with
-spaces, and write first any length keyword, then @code{unsigned} if
-appropriate, and finally @code{int}. The string must exactly match one
-of the data type names defined in the function
-@code{init_decl_processing} in the file @file{c-decl.c}. You may not
-omit @code{int} or change the order---that would cause the compiler to
-crash on startup.
-
-If you don't define this macro, the default is @code{"long unsigned
-int"}.
-
-@findex PTRDIFF_TYPE
-@item PTRDIFF_TYPE
-A C expression for a string describing the name of the data type to use
-for the result of subtracting two pointers. The typedef name
-@code{ptrdiff_t} is defined using the contents of the string. See
-@code{SIZE_TYPE} above for more information.
-
-If you don't define this macro, the default is @code{"long int"}.
-
-@findex WCHAR_TYPE
-@item WCHAR_TYPE
-A C expression for a string describing the name of the data type to use
-for wide characters. The typedef name @code{wchar_t} is defined using
-the contents of the string. See @code{SIZE_TYPE} above for more
-information.
-
-If you don't define this macro, the default is @code{"int"}.
-
-@findex WCHAR_TYPE_SIZE
-@item WCHAR_TYPE_SIZE
-A C expression for the size in bits of the data type for wide
-characters. This is used in @code{cpp}, which cannot make use of
-@code{WCHAR_TYPE}.
-
-@findex MAX_WCHAR_TYPE_SIZE
-@item MAX_WCHAR_TYPE_SIZE
-Maximum number for the size in bits of the data type for wide
-characters. If this is undefined, the default is
-@code{WCHAR_TYPE_SIZE}. Otherwise, it is the constant value that is the
-largest value that @code{WCHAR_TYPE_SIZE} can have at run-time. This is
-used in @code{cpp}.
-
-@findex OBJC_INT_SELECTORS
-@item OBJC_INT_SELECTORS
-Define this macro if the type of Objective C selectors should be
-@code{int}.
-
-If this macro is not defined, then selectors should have the type
-@code{struct objc_selector *}.
-
-@findex OBJC_SELECTORS_WITHOUT_LABELS
-@item OBJC_SELECTORS_WITHOUT_LABELS
-Define this macro if the compiler can group all the selectors together
-into a vector and use just one label at the beginning of the vector.
-Otherwise, the compiler must give each selector its own assembler
-label.
-
-On certain machines, it is important to have a separate label for each
-selector because this enables the linker to eliminate duplicate selectors.
-
-@findex TARGET_BELL
-@item TARGET_BELL
-A C constant expression for the integer value for escape sequence
-@samp{\a}.
-
-@findex TARGET_TAB
-@findex TARGET_BS
-@findex TARGET_NEWLINE
-@item TARGET_BS
-@itemx TARGET_TAB
-@itemx TARGET_NEWLINE
-C constant expressions for the integer values for escape sequences
-@samp{\b}, @samp{\t} and @samp{\n}.
-
-@findex TARGET_VT
-@findex TARGET_FF
-@findex TARGET_CR
-@item TARGET_VT
-@itemx TARGET_FF
-@itemx TARGET_CR
-C constant expressions for the integer values for escape sequences
-@samp{\v}, @samp{\f} and @samp{\r}.
-@end table
-
-@node Registers
-@section Register Usage
-@cindex register usage
-
-This section explains how to describe what registers the target machine
-has, and how (in general) they can be used.
-
-The description of which registers a specific instruction can use is
-done with register classes; see @ref{Register Classes}. For information
-on using registers to access a stack frame, see @ref{Frame Registers}.
-For passing values in registers, see @ref{Register Arguments}.
-For returning values in registers, see @ref{Scalar Return}.
-
-@menu
-* Register Basics:: Number and kinds of registers.
-* Allocation Order:: Order in which registers are allocated.
-* Values in Registers:: What kinds of values each reg can hold.
-* Leaf Functions:: Renumbering registers for leaf functions.
-* Stack Registers:: Handling a register stack such as 80387.
-* Obsolete Register Macros:: Macros formerly used for the 80387.
-@end menu
-
-@node Register Basics
-@subsection Basic Characteristics of Registers
-
-@c prevent bad page break with this line
-Registers have various characteristics.
-
-@table @code
-@findex FIRST_PSEUDO_REGISTER
-@item FIRST_PSEUDO_REGISTER
-Number of hardware registers known to the compiler. They receive
-numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first
-pseudo register's number really is assigned the number
-@code{FIRST_PSEUDO_REGISTER}.
-
-@item FIXED_REGISTERS
-@findex FIXED_REGISTERS
-@cindex fixed register
-An initializer that says which registers are used for fixed purposes
-all throughout the compiled code and are therefore not available for
-general allocation. These would include the stack pointer, the frame
-pointer (except on machines where that can be used as a general
-register when no frame pointer is needed), the program counter on
-machines where that is considered one of the addressable registers,
-and any other numbered register with a standard use.
-
-This information is expressed as a sequence of numbers, separated by
-commas and surrounded by braces. The @var{n}th number is 1 if
-register @var{n} is fixed, 0 otherwise.
-
-The table initialized from this macro, and the table initialized by
-the following one, may be overridden at run time either automatically,
-by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by
-the user with the command options @samp{-ffixed-@var{reg}},
-@samp{-fcall-used-@var{reg}} and @samp{-fcall-saved-@var{reg}}.
-
-@findex CALL_USED_REGISTERS
-@item CALL_USED_REGISTERS
-@cindex call-used register
-@cindex call-clobbered register
-@cindex call-saved register
-Like @code{FIXED_REGISTERS} but has 1 for each register that is
-clobbered (in general) by function calls as well as for fixed
-registers. This macro therefore identifies the registers that are not
-available for general allocation of values that must live across
-function calls.
-
-If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler
-automatically saves it on function entry and restores it on function
-exit, if the register is used within the function.
-
-@findex CONDITIONAL_REGISTER_USAGE
-@findex fixed_regs
-@findex call_used_regs
-@item CONDITIONAL_REGISTER_USAGE
-Zero or more C statements that may conditionally modify two variables
-@code{fixed_regs} and @code{call_used_regs} (both of type @code{char
-[]}) after they have been initialized from the two preceding macros.
-
-This is necessary in case the fixed or call-clobbered registers depend
-on target flags.
-
-You need not define this macro if it has no work to do.
-
-@cindex disabling certain registers
-@cindex controlling register usage
-If the usage of an entire class of registers depends on the target
-flags, you may indicate this to GCC by using this macro to modify
-@code{fixed_regs} and @code{call_used_regs} to 1 for each of the
-registers in the classes which should not be used by GCC. Also define
-the macro @code{REG_CLASS_FROM_LETTER} to return @code{NO_REGS} if it
-is called with a letter for a class that shouldn't be used.
-
-(However, if this class is not included in @code{GENERAL_REGS} and all
-of the insn patterns whose constraints permit this class are
-controlled by target switches, then GCC will automatically avoid using
-these registers when the target switches are opposed to them.)
-
-@findex NON_SAVING_SETJMP
-@item NON_SAVING_SETJMP
-If this macro is defined and has a nonzero value, it means that
-@code{setjmp} and related functions fail to save the registers, or that
-@code{longjmp} fails to restore them. To compensate, the compiler
-avoids putting variables in registers in functions that use
-@code{setjmp}.
-
-@findex INCOMING_REGNO
-@item INCOMING_REGNO (@var{out})
-Define this macro if the target machine has register windows. This C
-expression returns the register number as seen by the called function
-corresponding to the register number @var{out} as seen by the calling
-function. Return @var{out} if register number @var{out} is not an
-outbound register.
-
-@findex OUTGOING_REGNO
-@item OUTGOING_REGNO (@var{in})
-Define this macro if the target machine has register windows. This C
-expression returns the register number as seen by the calling function
-corresponding to the register number @var{in} as seen by the called
-function. Return @var{in} if register number @var{in} is not an inbound
-register.
-
-@ignore
-@findex PC_REGNUM
-@item PC_REGNUM
-If the program counter has a register number, define this as that
-register number. Otherwise, do not define it.
-@end ignore
-@end table
-
-@node Allocation Order
-@subsection Order of Allocation of Registers
-@cindex order of register allocation
-@cindex register allocation order
-
-@c prevent bad page break with this line
-Registers are allocated in order.
-
-@table @code
-@findex REG_ALLOC_ORDER
-@item REG_ALLOC_ORDER
-If defined, an initializer for a vector of integers, containing the
-numbers of hard registers in the order in which GNU CC should prefer
-to use them (from most preferred to least).
-
-If this macro is not defined, registers are used lowest numbered first
-(all else being equal).
-
-One use of this macro is on machines where the highest numbered
-registers must always be saved and the save-multiple-registers
-instruction supports only sequences of consecutive registers. On such
-machines, define @code{REG_ALLOC_ORDER} to be an initializer that lists
-the highest numbered allocatable register first.
-
-@findex ORDER_REGS_FOR_LOCAL_ALLOC
-@item ORDER_REGS_FOR_LOCAL_ALLOC
-A C statement (sans semicolon) to choose the order in which to allocate
-hard registers for pseudo-registers local to a basic block.
-
-Store the desired register order in the array @code{reg_alloc_order}.
-Element 0 should be the register to allocate first; element 1, the next
-register; and so on.
-
-The macro body should not assume anything about the contents of
-@code{reg_alloc_order} before execution of the macro.
-
-On most machines, it is not necessary to define this macro.
-@end table
-
-@node Values in Registers
-@subsection How Values Fit in Registers
-
-This section discusses the macros that describe which kinds of values
-(specifically, which machine modes) each register can hold, and how many
-consecutive registers are needed for a given mode.
-
-@table @code
-@findex HARD_REGNO_NREGS
-@item HARD_REGNO_NREGS (@var{regno}, @var{mode})
-A C expression for the number of consecutive hard registers, starting
-at register number @var{regno}, required to hold a value of mode
-@var{mode}.
-
-On a machine where all registers are exactly one word, a suitable
-definition of this macro is
-
-@smallexample
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
- / UNITS_PER_WORD))
-@end smallexample
-
-@findex HARD_REGNO_MODE_OK
-@item HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
-A C expression that is nonzero if it is permissible to store a value
-of mode @var{mode} in hard register number @var{regno} (or in several
-registers starting with that one). For a machine where all registers
-are equivalent, a suitable definition is
-
-@smallexample
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-@end smallexample
-
-It is not necessary for this macro to check for the numbers of fixed
-registers, because the allocation mechanism considers them to be always
-occupied.
-
-@cindex register pairs
-On some machines, double-precision values must be kept in even/odd
-register pairs. The way to implement that is to define this macro
-to reject odd register numbers for such modes.
-
-@ignore
-@c I think this is not true now
-GNU CC assumes that it can always move values between registers and
-(suitably addressed) memory locations. If it is impossible to move a
-value of a certain mode between memory and certain registers, then
-@code{HARD_REGNO_MODE_OK} must not allow this mode in those registers.
-@end ignore
-
-The minimum requirement for a mode to be OK in a register is that the
-@samp{mov@var{mode}} instruction pattern support moves between the
-register and any other hard register for which the mode is OK; and that
-moving a value into the register and back out not alter it.
-
-Since the same instruction used to move @code{SImode} will work for all
-narrower integer modes, it is not necessary on any machine for
-@code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided
-you define patterns @samp{movhi}, etc., to take advantage of this. This
-is useful because of the interaction between @code{HARD_REGNO_MODE_OK}
-and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes
-to be tieable.
-
-Many machines have special registers for floating point arithmetic.
-Often people assume that floating point machine modes are allowed only
-in floating point registers. This is not true. Any registers that
-can hold integers can safely @emph{hold} a floating point machine
-mode, whether or not floating arithmetic can be done on it in those
-registers. Integer move instructions can be used to move the values.
-
-On some machines, though, the converse is true: fixed-point machine
-modes may not go in floating registers. This is true if the floating
-registers normalize any value stored in them, because storing a
-non-floating value there would garble it. In this case,
-@code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
-floating registers. But if the floating registers do not automatically
-normalize, if you can store any bit pattern in one and retrieve it
-unchanged without a trap, then any machine mode may go in a floating
-register, so you can define this macro to say so.
-
-The primary significance of special floating registers is rather that
-they are the registers acceptable in floating point arithmetic
-instructions. However, this is of no concern to
-@code{HARD_REGNO_MODE_OK}. You handle it by writing the proper
-constraints for those instructions.
-
-On some machines, the floating registers are especially slow to access,
-so that it is better to store a value in a stack frame than in such a
-register if floating point arithmetic is not being done. As long as the
-floating registers are not in class @code{GENERAL_REGS}, they will not
-be used unless some pattern's constraint asks for one.
-
-@findex MODES_TIEABLE_P
-@item MODES_TIEABLE_P (@var{mode1}, @var{mode2})
-A C expression that is nonzero if it is desirable to choose register
-allocation so as to avoid move instructions between a value of mode
-@var{mode1} and a value of mode @var{mode2}.
-
-If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
-@code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are ever different
-for any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1},
-@var{mode2})} must be zero.
-@end table
-
-@node Leaf Functions
-@subsection Handling Leaf Functions
-
-@cindex leaf functions
-@cindex functions, leaf
-On some machines, a leaf function (i.e., one which makes no calls) can run
-more efficiently if it does not make its own register window. Often this
-means it is required to receive its arguments in the registers where they
-are passed by the caller, instead of the registers where they would
-normally arrive.
-
-The special treatment for leaf functions generally applies only when
-other conditions are met; for example, often they may use only those
-registers for its own variables and temporaries. We use the term ``leaf
-function'' to mean a function that is suitable for this special
-handling, so that functions with no calls are not necessarily ``leaf
-functions''.
-
-GNU CC assigns register numbers before it knows whether the function is
-suitable for leaf function treatment. So it needs to renumber the
-registers in order to output a leaf function. The following macros
-accomplish this.
-
-@table @code
-@findex LEAF_REGISTERS
-@item LEAF_REGISTERS
-A C initializer for a vector, indexed by hard register number, which
-contains 1 for a register that is allowable in a candidate for leaf
-function treatment.
-
-If leaf function treatment involves renumbering the registers, then the
-registers marked here should be the ones before renumbering---those that
-GNU CC would ordinarily allocate. The registers which will actually be
-used in the assembler code, after renumbering, should not be marked with 1
-in this vector.
-
-Define this macro only if the target machine offers a way to optimize
-the treatment of leaf functions.
-
-@findex LEAF_REG_REMAP
-@item LEAF_REG_REMAP (@var{regno})
-A C expression whose value is the register number to which @var{regno}
-should be renumbered, when a function is treated as a leaf function.
-
-If @var{regno} is a register number which should not appear in a leaf
-function before renumbering, then the expression should yield -1, which
-will cause the compiler to abort.
-
-Define this macro only if the target machine offers a way to optimize the
-treatment of leaf functions, and registers need to be renumbered to do
-this.
-@end table
-
-@findex leaf_function
-Normally, @code{FUNCTION_PROLOGUE} and @code{FUNCTION_EPILOGUE} must
-treat leaf functions specially. It can test the C variable
-@code{leaf_function} which is nonzero for leaf functions. (The variable
-@code{leaf_function} is defined only if @code{LEAF_REGISTERS} is
-defined.)
-@c changed this to fix overfull. ALSO: why the "it" at the beginning
-@c of the next paragraph?! --mew 2feb93
-
-@node Stack Registers
-@subsection Registers That Form a Stack
-
-There are special features to handle computers where some of the
-``registers'' form a stack, as in the 80387 coprocessor for the 80386.
-Stack registers are normally written by pushing onto the stack, and are
-numbered relative to the top of the stack.
-
-Currently, GNU CC can only handle one group of stack-like registers, and
-they must be consecutively numbered.
-
-@table @code
-@findex STACK_REGS
-@item STACK_REGS
-Define this if the machine has any stack-like registers.
-
-@findex FIRST_STACK_REG
-@item FIRST_STACK_REG
-The number of the first stack-like register. This one is the top
-of the stack.
-
-@findex LAST_STACK_REG
-@item LAST_STACK_REG
-The number of the last stack-like register. This one is the bottom of
-the stack.
-@end table
-
-@node Obsolete Register Macros
-@subsection Obsolete Macros for Controlling Register Usage
-
-These features do not work very well. They exist because they used to
-be required to generate correct code for the 80387 coprocessor of the
-80386. They are no longer used by that machine description and may be
-removed in a later version of the compiler. Don't use them!
-
-@table @code
-@findex OVERLAPPING_REGNO_P
-@item OVERLAPPING_REGNO_P (@var{regno})
-If defined, this is a C expression whose value is nonzero if hard
-register number @var{regno} is an overlapping register. This means a
-hard register which overlaps a hard register with a different number.
-(Such overlap is undesirable, but occasionally it allows a machine to
-be supported which otherwise could not be.) This macro must return
-nonzero for @emph{all} the registers which overlap each other. GNU CC
-can use an overlapping register only in certain limited ways. It can
-be used for allocation within a basic block, and may be spilled for
-reloading; that is all.
-
-If this macro is not defined, it means that none of the hard registers
-overlap each other. This is the usual situation.
-
-@findex INSN_CLOBBERS_REGNO_P
-@item INSN_CLOBBERS_REGNO_P (@var{insn}, @var{regno})
-If defined, this is a C expression whose value should be nonzero if
-the insn @var{insn} has the effect of mysteriously clobbering the
-contents of hard register number @var{regno}. By ``mysterious'' we
-mean that the insn's RTL expression doesn't describe such an effect.
-
-If this macro is not defined, it means that no insn clobbers registers
-mysteriously. This is the usual situation; all else being equal,
-it is best for the RTL expression to show all the activity.
-
-@cindex death notes
-@findex PRESERVE_DEATH_INFO_REGNO_P
-@item PRESERVE_DEATH_INFO_REGNO_P (@var{regno})
-If defined, this is a C expression whose value is nonzero if correct
-@code{REG_DEAD} notes are needed for hard register number @var{regno}
-after reload.
-
-You would arrange to preserve death info for a register when some of the
-code in the machine description which is executed to write the assembler
-code looks at the death notes. This is necessary only when the actual
-hardware feature which GNU CC thinks of as a register is not actually a
-register of the usual sort. (It might, for example, be a hardware
-stack.)
-
-It is also useful for peepholes and linker relaxation.
-
-If this macro is not defined, it means that no death notes need to be
-preserved, and some may even be incorrect. This is the usual situation.
-@end table
-
-@node Register Classes
-@section Register Classes
-@cindex register class definitions
-@cindex class definitions, register
-
-On many machines, the numbered registers are not all equivalent.
-For example, certain registers may not be allowed for indexed addressing;
-certain registers may not be allowed in some instructions. These machine
-restrictions are described to the compiler using @dfn{register classes}.
-
-You define a number of register classes, giving each one a name and saying
-which of the registers belong to it. Then you can specify register classes
-that are allowed as operands to particular instruction patterns.
-
-@findex ALL_REGS
-@findex NO_REGS
-In general, each register will belong to several classes. In fact, one
-class must be named @code{ALL_REGS} and contain all the registers. Another
-class must be named @code{NO_REGS} and contain no registers. Often the
-union of two classes will be another class; however, this is not required.
-
-@findex GENERAL_REGS
-One of the classes must be named @code{GENERAL_REGS}. There is nothing
-terribly special about the name, but the operand constraint letters
-@samp{r} and @samp{g} specify this class. If @code{GENERAL_REGS} is
-the same as @code{ALL_REGS}, just define it as a macro which expands
-to @code{ALL_REGS}.
-
-Order the classes so that if class @var{x} is contained in class @var{y}
-then @var{x} has a lower class number than @var{y}.
-
-The way classes other than @code{GENERAL_REGS} are specified in operand
-constraints is through machine-dependent operand constraint letters.
-You can define such letters to correspond to various classes, then use
-them in operand constraints.
-
-You should define a class for the union of two classes whenever some
-instruction allows both classes. For example, if an instruction allows
-either a floating point (coprocessor) register or a general register for a
-certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}
-which includes both of them. Otherwise you will get suboptimal code.
-
-You must also specify certain redundant information about the register
-classes: for each class, which classes contain it and which ones are
-contained in it; for each pair of classes, the largest class contained
-in their union.
-
-When a value occupying several consecutive registers is expected in a
-certain class, all the registers used must belong to that class.
-Therefore, register classes cannot be used to enforce a requirement for
-a register pair to start with an even-numbered register. The way to
-specify this requirement is with @code{HARD_REGNO_MODE_OK}.
-
-Register classes used for input-operands of bitwise-and or shift
-instructions have a special requirement: each such class must have, for
-each fixed-point machine mode, a subclass whose registers can transfer that
-mode to or from memory. For example, on some machines, the operations for
-single-byte values (@code{QImode}) are limited to certain registers. When
-this is so, each register class that is used in a bitwise-and or shift
-instruction must have a subclass consisting of registers from which
-single-byte values can be loaded or stored. This is so that
-@code{PREFERRED_RELOAD_CLASS} can always have a possible value to return.
-
-@table @code
-@findex enum reg_class
-@item enum reg_class
-An enumeral type that must be defined with all the register class names
-as enumeral values. @code{NO_REGS} must be first. @code{ALL_REGS}
-must be the last register class, followed by one more enumeral value,
-@code{LIM_REG_CLASSES}, which is not a register class but rather
-tells how many classes there are.
-
-Each register class has a number, which is the value of casting
-the class name to type @code{int}. The number serves as an index
-in many of the tables described below.
-
-@findex N_REG_CLASSES
-@item N_REG_CLASSES
-The number of distinct register classes, defined as follows:
-
-@example
-#define N_REG_CLASSES (int) LIM_REG_CLASSES
-@end example
-
-@findex REG_CLASS_NAMES
-@item REG_CLASS_NAMES
-An initializer containing the names of the register classes as C string
-constants. These names are used in writing some of the debugging dumps.
-
-@findex REG_CLASS_CONTENTS
-@item REG_CLASS_CONTENTS
-An initializer containing the contents of the register classes, as integers
-which are bit masks. The @var{n}th integer specifies the contents of class
-@var{n}. The way the integer @var{mask} is interpreted is that
-register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.
-
-When the machine has more than 32 registers, an integer does not suffice.
-Then the integers are replaced by sub-initializers, braced groupings containing
-several integers. Each sub-initializer must be suitable as an initializer
-for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.
-
-@findex REGNO_REG_CLASS
-@item REGNO_REG_CLASS (@var{regno})
-A C expression whose value is a register class containing hard register
-@var{regno}. In general there is more than one such class; choose a class
-which is @dfn{minimal}, meaning that no smaller class also contains the
-register.
-
-@findex BASE_REG_CLASS
-@item BASE_REG_CLASS
-A macro whose definition is the name of the class to which a valid
-base register must belong. A base register is one used in an address
-which is the register value plus a displacement.
-
-@findex INDEX_REG_CLASS
-@item INDEX_REG_CLASS
-A macro whose definition is the name of the class to which a valid
-index register must belong. An index register is one used in an
-address where its value is either multiplied by a scale factor or
-added to another register (as well as added to a displacement).
-
-@findex REG_CLASS_FROM_LETTER
-@item REG_CLASS_FROM_LETTER (@var{char})
-A C expression which defines the machine-dependent operand constraint
-letters for register classes. If @var{char} is such a letter, the
-value should be the register class corresponding to it. Otherwise,
-the value should be @code{NO_REGS}. The register letter @samp{r},
-corresponding to class @code{GENERAL_REGS}, will not be passed
-to this macro; you do not need to handle it.
-
-@findex REGNO_OK_FOR_BASE_P
-@item REGNO_OK_FOR_BASE_P (@var{num})
-A C expression which is nonzero if register number @var{num} is
-suitable for use as a base register in operand addresses. It may be
-either a suitable hard register or a pseudo register that has been
-allocated such a hard register.
-
-@findex REGNO_OK_FOR_INDEX_P
-@item REGNO_OK_FOR_INDEX_P (@var{num})
-A C expression which is nonzero if register number @var{num} is
-suitable for use as an index register in operand addresses. It may be
-either a suitable hard register or a pseudo register that has been
-allocated such a hard register.
-
-The difference between an index register and a base register is that
-the index register may be scaled. If an address involves the sum of
-two registers, neither one of them scaled, then either one may be
-labeled the ``base'' and the other the ``index''; but whichever
-labeling is used must fit the machine's constraints of which registers
-may serve in each capacity. The compiler will try both labelings,
-looking for one that is valid, and will reload one or both registers
-only if neither labeling works.
-
-@findex PREFERRED_RELOAD_CLASS
-@item PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
-A C expression that places additional restrictions on the register class
-to use when it is necessary to copy value @var{x} into a register in class
-@var{class}. The value is a register class; perhaps @var{class}, or perhaps
-another, smaller class. On many machines, the following definition is
-safe:
-
-@example
-#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
-@end example
-
-Sometimes returning a more restrictive class makes better code. For
-example, on the 68000, when @var{x} is an integer constant that is in range
-for a @samp{moveq} instruction, the value of this macro is always
-@code{DATA_REGS} as long as @var{class} includes the data registers.
-Requiring a data register guarantees that a @samp{moveq} will be used.
-
-If @var{x} is a @code{const_double}, by returning @code{NO_REGS}
-you can force @var{x} into a memory constant. This is useful on
-certain machines where immediate floating values cannot be loaded into
-certain kinds of registers.
-
-@findex PREFERRED_OUTPUT_RELOAD_CLASS
-@item PREFERRED_OUTPUT_RELOAD_CLASS (@var{x}, @var{class})
-Like @code{PREFERRED_RELOAD_CLASS}, but for output reloads instead of
-input reloads. If you don't define this macro, the default is to use
-@var{class}, unchanged.
-
-@findex LIMIT_RELOAD_CLASS
-@item LIMIT_RELOAD_CLASS (@var{mode}, @var{class})
-A C expression that places additional restrictions on the register class
-to use when it is necessary to be able to hold a value of mode
-@var{mode} in a reload register for which class @var{class} would
-ordinarily be used.
-
-Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used when
-there are certain modes that simply can't go in certain reload classes.
-
-The value is a register class; perhaps @var{class}, or perhaps another,
-smaller class.
-
-Don't define this macro unless the target machine has limitations which
-require the macro to do something nontrivial.
-
-@findex SECONDARY_RELOAD_CLASS
-@findex SECONDARY_INPUT_RELOAD_CLASS
-@findex SECONDARY_OUTPUT_RELOAD_CLASS
-@item SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
-@itemx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
-@itemx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
-Many machines have some registers that cannot be copied directly to or
-from memory or even from other types of registers. An example is the
-@samp{MQ} register, which on most machines, can only be copied to or
-from general registers, but not memory. Some machines allow copying all
-registers to and from memory, but require a scratch register for stores
-to some memory locations (e.g., those with symbolic address on the RT,
-and those with certain symbolic address on the Sparc when compiling
-PIC). In some cases, both an intermediate and a scratch register are
-required.
-
-You should define these macros to indicate to the reload phase that it may
-need to allocate at least one register for a reload in addition to the
-register to contain the data. Specifically, if copying @var{x} to a
-register @var{class} in @var{mode} requires an intermediate register,
-you should define @code{SECONDARY_INPUT_RELOAD_CLASS} to return the
-largest register class all of whose registers can be used as
-intermediate registers or scratch registers.
-
-If copying a register @var{class} in @var{mode} to @var{x} requires an
-intermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS}
-should be defined to return the largest register class required. If the
-requirements for input and output reloads are the same, the macro
-@code{SECONDARY_RELOAD_CLASS} should be used instead of defining both
-macros identically.
-
-The values returned by these macros are often @code{GENERAL_REGS}.
-Return @code{NO_REGS} if no spare register is needed; i.e., if @var{x}
-can be directly copied to or from a register of @var{class} in
-@var{mode} without requiring a scratch register. Do not define this
-macro if it would always return @code{NO_REGS}.
-
-If a scratch register is required (either with or without an
-intermediate register), you should define patterns for
-@samp{reload_in@var{m}} or @samp{reload_out@var{m}}, as required
-(@pxref{Standard Names}. These patterns, which will normally be
-implemented with a @code{define_expand}, should be similar to the
-@samp{mov@var{m}} patterns, except that operand 2 is the scratch
-register.
-
-Define constraints for the reload register and scratch register that
-contain a single register class. If the original reload register (whose
-class is @var{class}) can meet the constraint given in the pattern, the
-value returned by these macros is used for the class of the scratch
-register. Otherwise, two additional reload registers are required.
-Their classes are obtained from the constraints in the insn pattern.
-
-@var{x} might be a pseudo-register or a @code{subreg} of a
-pseudo-register, which could either be in a hard register or in memory.
-Use @code{true_regnum} to find out; it will return -1 if the pseudo is
-in memory and the hard register number if it is in a register.
-
-These macros should not be used in the case where a particular class of
-registers can only be copied to memory and not to another class of
-registers. In that case, secondary reload registers are not needed and
-would not be helpful. Instead, a stack location must be used to perform
-the copy and the @code{mov@var{m}} pattern should use memory as a
-intermediate storage. This case often occurs between floating-point and
-general registers.
-
-@findex SECONDARY_MEMORY_NEEDED
-@item SECONDARY_MEMORY_NEEDED (@var{class1}, @var{class2}, @var{m})
-Certain machines have the property that some registers cannot be copied
-to some other registers without using memory. Define this macro on
-those machines to be a C expression that is non-zero if objects of mode
-@var{m} in registers of @var{class1} can only be copied to registers of
-class @var{class2} by storing a register of @var{class1} into memory
-and loading that memory location into a register of @var{class2}.
-
-Do not define this macro if its value would always be zero.
-
-@findex SECONDARY_MEMORY_NEEDED_RTX
-@item SECONDARY_MEMORY_NEEDED_RTX (@var{mode})
-Normally when @code{SECONDARY_MEMORY_NEEDED} is defined, the compiler
-allocates a stack slot for a memory location needed for register copies.
-If this macro is defined, the compiler instead uses the memory location
-defined by this macro.
-
-Do not define this macro if you do not define
-@code{SECONDARY_MEMORY_NEEDED}.
-
-@findex SECONDARY_MEMORY_NEEDED_MODE
-@item SECONDARY_MEMORY_NEEDED_MODE (@var{mode})
-When the compiler needs a secondary memory location to copy between two
-registers of mode @var{mode}, it normally allocates sufficient memory to
-hold a quantity of @code{BITS_PER_WORD} bits and performs the store and
-load operations in a mode that many bits wide and whose class is the
-same as that of @var{mode}.
-
-This is right thing to do on most machines because it ensures that all
-bits of the register are copied and prevents accesses to the registers
-in a narrower mode, which some machines prohibit for floating-point
-registers.
-
-However, this default behavior is not correct on some machines, such as
-the DEC Alpha, that store short integers in floating-point registers
-differently than in integer registers. On those machines, the default
-widening will not work correctly and you must define this macro to
-suppress that widening in some cases. See the file @file{alpha.h} for
-details.
-
-Do not define this macro if you do not define
-@code{SECONDARY_MEMORY_NEEDED} or if widening @var{mode} to a mode that
-is @code{BITS_PER_WORD} bits wide is correct for your machine.
-
-@findex SMALL_REGISTER_CLASSES
-@item SMALL_REGISTER_CLASSES
-Normally the compiler avoids choosing registers that have been
-explicitly mentioned in the rtl as spill registers (these registers are
-normally those used to pass parameters and return values). However,
-some machines have so few registers of certain classes that there
-would not be enough registers to use as spill registers if this were
-done.
-
-Define @code{SMALL_REGISTER_CLASSES} on these machines. When it is
-defined, the compiler allows registers explicitly used in the rtl to be
-used as spill registers but avoids extending the lifetime of these
-registers.
-
-It is always safe to define this macro, but if you unnecessarily define
-it, you will reduce the amount of optimizations that can be performed in
-some cases. If you do not define this macro when it is required, the
-compiler will run out of spill registers and print a fatal error
-message. For most machines, you should not define this macro.
-
-@findex CLASS_LIKELY_SPILLED_P
-@item CLASS_LIKELY_SPILLED_P (@var{class})
-A C expression whose value is nonzero if pseudos that have been assigned
-to registers of class @var{class} would likely be spilled because
-registers of @var{class} are needed for spill registers.
-
-The default value of this macro returns 1 if @var{class} has exactly one
-register and zero otherwise. On most machines, this default should be
-used. Only define this macro to some other expression if pseudo
-allocated by @file{local-alloc.c} end up in memory because their hard
-registers were needed for spill registers. If this macro returns nonzero
-for those classes, those pseudos will only be allocated by
-@file{global.c}, which knows how to reallocate the pseudo to another
-register. If there would not be another register available for
-reallocation, you should not change the definition of this macro since
-the only effect of such a definition would be to slow down register
-allocation.
-
-@findex CLASS_MAX_NREGS
-@item CLASS_MAX_NREGS (@var{class}, @var{mode})
-A C expression for the maximum number of consecutive registers
-of class @var{class} needed to hold a value of mode @var{mode}.
-
-This is closely related to the macro @code{HARD_REGNO_NREGS}. In fact,
-the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})}
-should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno},
-@var{mode})} for all @var{regno} values in the class @var{class}.
-
-This macro helps control the handling of multiple-word values
-in the reload pass.
-
-@item CLASS_CANNOT_CHANGE_SIZE
-If defined, a C expression for a class that contains registers which the
-compiler must always access in a mode that is the same size as the mode
-in which it loaded the register.
-
-For the example, loading 32-bit integer or floating-point objects into
-floating-point registers on the Alpha extends them to 64-bits.
-Therefore loading a 64-bit object and then storing it as a 32-bit object
-does not store the low-order 32-bits, as would be the case for a normal
-register. Therefore, @file{alpha.h} defines this macro as
-@code{FLOAT_REGS}.
-@end table
-
-Three other special macros describe which operands fit which constraint
-letters.
-
-@table @code
-@findex CONST_OK_FOR_LETTER_P
-@item CONST_OK_FOR_LETTER_P (@var{value}, @var{c})
-A C expression that defines the machine-dependent operand constraint letters
-that specify particular ranges of integer values. If @var{c} is one
-of those letters, the expression should check that @var{value}, an integer,
-is in the appropriate range and return 1 if so, 0 otherwise. If @var{c} is
-not one of those letters, the value should be 0 regardless of @var{value}.
-
-@findex CONST_DOUBLE_OK_FOR_LETTER_P
-@item CONST_DOUBLE_OK_FOR_LETTER_P (@var{value}, @var{c})
-A C expression that defines the machine-dependent operand constraint
-letters that specify particular ranges of @code{const_double} values.
-
-If @var{c} is one of those letters, the expression should check that
-@var{value}, an RTX of code @code{const_double}, is in the appropriate
-range and return 1 if so, 0 otherwise. If @var{c} is not one of those
-letters, the value should be 0 regardless of @var{value}.
-
-@code{const_double} is used for all floating-point constants and for
-@code{DImode} fixed-point constants. A given letter can accept either
-or both kinds of values. It can use @code{GET_MODE} to distinguish
-between these kinds.
-
-@findex EXTRA_CONSTRAINT
-@item EXTRA_CONSTRAINT (@var{value}, @var{c})
-A C expression that defines the optional machine-dependent constraint
-letters that can be used to segregate specific types of operands,
-usually memory references, for the target machine. Normally this macro
-will not be defined. If it is required for a particular target machine,
-it should return 1 if @var{value} corresponds to the operand type
-represented by the constraint letter @var{c}. If @var{c} is not defined
-as an extra constraint, the value returned should be 0 regardless of
-@var{value}.
-
-For example, on the ROMP, load instructions cannot have their output in r0 if
-the memory reference contains a symbolic address. Constraint letter
-@samp{Q} is defined as representing a memory address that does
-@emph{not} contain a symbolic address. An alternative is specified with
-a @samp{Q} constraint on the input and @samp{r} on the output. The next
-alternative specifies @samp{m} on the input and a register class that
-does not include r0 on the output.
-@end table
-
-@node Stack and Calling
-@section Stack Layout and Calling Conventions
-@cindex calling conventions
-
-@c prevent bad page break with this line
-This describes the stack layout and calling conventions.
-
-@menu
-* Frame Layout::
-* Frame Registers::
-* Elimination::
-* Stack Arguments::
-* Register Arguments::
-* Scalar Return::
-* Aggregate Return::
-* Caller Saves::
-* Function Entry::
-* Profiling::
-@end menu
-
-@node Frame Layout
-@subsection Basic Stack Layout
-@cindex stack frame layout
-@cindex frame layout
-
-@c prevent bad page break with this line
-Here is the basic stack layout.
-
-@table @code
-@findex STACK_GROWS_DOWNWARD
-@item STACK_GROWS_DOWNWARD
-Define this macro if pushing a word onto the stack moves the stack
-pointer to a smaller address.
-
-When we say, ``define this macro if @dots{},'' it means that the
-compiler checks this macro only with @code{#ifdef} so the precise
-definition used does not matter.
-
-@findex FRAME_GROWS_DOWNWARD
-@item FRAME_GROWS_DOWNWARD
-Define this macro if the addresses of local variable slots are at negative
-offsets from the frame pointer.
-
-@findex ARGS_GROW_DOWNWARD
-@item ARGS_GROW_DOWNWARD
-Define this macro if successive arguments to a function occupy decreasing
-addresses on the stack.
-
-@findex STARTING_FRAME_OFFSET
-@item STARTING_FRAME_OFFSET
-Offset from the frame pointer to the first local variable slot to be allocated.
-
-If @code{FRAME_GROWS_DOWNWARD}, find the next slot's offset by
-subtracting the first slot's length from @code{STARTING_FRAME_OFFSET}.
-Otherwise, it is found by adding the length of the first slot to the
-value @code{STARTING_FRAME_OFFSET}.
-@c i'm not sure if the above is still correct.. had to change it to get
-@c rid of an overfull. --mew 2feb93
-
-@findex STACK_POINTER_OFFSET
-@item STACK_POINTER_OFFSET
-Offset from the stack pointer register to the first location at which
-outgoing arguments are placed. If not specified, the default value of
-zero is used. This is the proper value for most machines.
-
-If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
-the first location at which outgoing arguments are placed.
-
-@findex FIRST_PARM_OFFSET
-@item FIRST_PARM_OFFSET (@var{fundecl})
-Offset from the argument pointer register to the first argument's
-address. On some machines it may depend on the data type of the
-function.
-
-If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
-the first argument's address.
-
-@findex STACK_DYNAMIC_OFFSET
-@item STACK_DYNAMIC_OFFSET (@var{fundecl})
-Offset from the stack pointer register to an item dynamically allocated
-on the stack, e.g., by @code{alloca}.
-
-The default value for this macro is @code{STACK_POINTER_OFFSET} plus the
-length of the outgoing arguments. The default is correct for most
-machines. See @file{function.c} for details.
-
-@findex DYNAMIC_CHAIN_ADDRESS
-@item DYNAMIC_CHAIN_ADDRESS (@var{frameaddr})
-A C expression whose value is RTL representing the address in a stack
-frame where the pointer to the caller's frame is stored. Assume that
-@var{frameaddr} is an RTL expression for the address of the stack frame
-itself.
-
-If you don't define this macro, the default is to return the value
-of @var{frameaddr}---that is, the stack frame address is also the
-address of the stack word that points to the previous frame.
-
-@findex SETUP_FRAME_ADDRESSES
-@item SETUP_FRAME_ADDRESSES ()
-If defined, a C expression that produces the machine-specific code to
-setup the stack so that arbitrary frames can be accessed. For example,
-on the Sparc, we must flush all of the register windows to the stack
-before we can access arbitrary stack frames.
-This macro will seldom need to be defined.
-
-@findex RETURN_ADDR_RTX
-@item RETURN_ADDR_RTX (@var{count}, @var{frameaddr})
-A C expression whose value is RTL representing the value of the return
-address for the frame @var{count} steps up from the current frame.
-@var{frameaddr} is the frame pointer of the @var{count} frame, or
-the frame pointer of the @var{count} @minus{} 1 frame if
-@code{RETURN_ADDR_IN_PREVIOUS_FRAME} is defined.
-
-@findex RETURN_ADDR_IN_PREVIOUS_FRAME
-@item RETURN_ADDR_IN_PREVIOUS_FRAME
-Define this if the return address of a particular stack frame is accessed
-from the frame pointer of the previous stack frame.
-@end table
-
-@need 2000
-@node Frame Registers
-@subsection Registers That Address the Stack Frame
-
-@c prevent bad page break with this line
-This discusses registers that address the stack frame.
-
-@table @code
-@findex STACK_POINTER_REGNUM
-@item STACK_POINTER_REGNUM
-The register number of the stack pointer register, which must also be a
-fixed register according to @code{FIXED_REGISTERS}. On most machines,
-the hardware determines which register this is.
-
-@findex FRAME_POINTER_REGNUM
-@item FRAME_POINTER_REGNUM
-The register number of the frame pointer register, which is used to
-access automatic variables in the stack frame. On some machines, the
-hardware determines which register this is. On other machines, you can
-choose any register you wish for this purpose.
-
-@findex HARD_FRAME_POINTER_REGNUM
-@item HARD_FRAME_POINTER_REGNUM
-On some machines the offset between the frame pointer and starting
-offset of the automatic variables is not known until after register
-allocation has been done (for example, because the saved registers are
-between these two locations). On those machines, define
-@code{FRAME_POINTER_REGNUM} the number of a special, fixed register to
-be used internally until the offset is known, and define
-@code{HARD_FRAME_POINTER_REGNUM} to be actual the hard register number
-used for the frame pointer.
-
-You should define this macro only in the very rare circumstances when it
-is not possible to calculate the offset between the frame pointer and
-the automatic variables until after register allocation has been
-completed. When this macro is defined, you must also indicate in your
-definition of @code{ELIMINABLE_REGS} how to eliminate
-@code{FRAME_POINTER_REGNUM} into either @code{HARD_FRAME_POINTER_REGNUM}
-or @code{STACK_POINTER_REGNUM}.
-
-Do not define this macro if it would be the same as
-@code{FRAME_POINTER_REGNUM}.
-
-@findex ARG_POINTER_REGNUM
-@item ARG_POINTER_REGNUM
-The register number of the arg pointer register, which is used to access
-the function's argument list. On some machines, this is the same as the
-frame pointer register. On some machines, the hardware determines which
-register this is. On other machines, you can choose any register you
-wish for this purpose. If this is not the same register as the frame
-pointer register, then you must mark it as a fixed register according to
-@code{FIXED_REGISTERS}, or arrange to be able to eliminate it
-(@pxref{Elimination}).
-
-@findex RETURN_ADDRESS_POINTER_REGNUM
-@item RETURN_ADDRESS_POINTER_REGNUM
-The register number of the return address pointer register, which is used to
-access the current function's return address from the stack. On some
-machines, the return address is not at a fixed offset from the frame
-pointer or stack pointer or argument pointer. This register can be defined
-to point to the return address on the stack, and then be converted by
-@code{ELIMINABLE_REGS} into either the frame pointer or stack pointer.
-
-Do not define this macro unless there is no other way to get the return
-address from the stack.
-
-@findex STATIC_CHAIN_REGNUM
-@findex STATIC_CHAIN_INCOMING_REGNUM
-@item STATIC_CHAIN_REGNUM
-@itemx STATIC_CHAIN_INCOMING_REGNUM
-Register numbers used for passing a function's static chain pointer. If
-register windows are used, the register number as seen by the called
-function is @code{STATIC_CHAIN_INCOMING_REGNUM}, while the register
-number as seen by the calling function is @code{STATIC_CHAIN_REGNUM}. If
-these registers are the same, @code{STATIC_CHAIN_INCOMING_REGNUM} need
-not be defined.@refill
-
-The static chain register need not be a fixed register.
-
-If the static chain is passed in memory, these macros should not be
-defined; instead, the next two macros should be defined.
-
-@findex STATIC_CHAIN
-@findex STATIC_CHAIN_INCOMING
-@item STATIC_CHAIN
-@itemx STATIC_CHAIN_INCOMING
-If the static chain is passed in memory, these macros provide rtx giving
-@code{mem} expressions that denote where they are stored.
-@code{STATIC_CHAIN} and @code{STATIC_CHAIN_INCOMING} give the locations
-as seen by the calling and called functions, respectively. Often the former
-will be at an offset from the stack pointer and the latter at an offset from
-the frame pointer.@refill
-
-@findex stack_pointer_rtx
-@findex frame_pointer_rtx
-@findex arg_pointer_rtx
-The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and
-@code{arg_pointer_rtx} will have been initialized prior to the use of these
-macros and should be used to refer to those items.
-
-If the static chain is passed in a register, the two previous macros should
-be defined instead.
-@end table
-
-@node Elimination
-@subsection Eliminating Frame Pointer and Arg Pointer
-
-@c prevent bad page break with this line
-This is about eliminating the frame pointer and arg pointer.
-
-@table @code
-@findex FRAME_POINTER_REQUIRED
-@item FRAME_POINTER_REQUIRED
-A C expression which is nonzero if a function must have and use a frame
-pointer. This expression is evaluated in the reload pass. If its value is
-nonzero the function will have a frame pointer.
-
-The expression can in principle examine the current function and decide
-according to the facts, but on most machines the constant 0 or the
-constant 1 suffices. Use 0 when the machine allows code to be generated
-with no frame pointer, and doing so saves some time or space. Use 1
-when there is no possible advantage to avoiding a frame pointer.
-
-In certain cases, the compiler does not know how to produce valid code
-without a frame pointer. The compiler recognizes those cases and
-automatically gives the function a frame pointer regardless of what
-@code{FRAME_POINTER_REQUIRED} says. You don't need to worry about
-them.@refill
-
-In a function that does not require a frame pointer, the frame pointer
-register can be allocated for ordinary usage, unless you mark it as a
-fixed register. See @code{FIXED_REGISTERS} for more information.
-
-@findex INITIAL_FRAME_POINTER_OFFSET
-@findex get_frame_size
-@item INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
-A C statement to store in the variable @var{depth-var} the difference
-between the frame pointer and the stack pointer values immediately after
-the function prologue. The value would be computed from information
-such as the result of @code{get_frame_size ()} and the tables of
-registers @code{regs_ever_live} and @code{call_used_regs}.
-
-If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
-need not be defined. Otherwise, it must be defined even if
-@code{FRAME_POINTER_REQUIRED} is defined to always be true; in that
-case, you may set @var{depth-var} to anything.
-
-@findex ELIMINABLE_REGS
-@item ELIMINABLE_REGS
-If defined, this macro specifies a table of register pairs used to
-eliminate unneeded registers that point into the stack frame. If it is not
-defined, the only elimination attempted by the compiler is to replace
-references to the frame pointer with references to the stack pointer.
-
-The definition of this macro is a list of structure initializations, each
-of which specifies an original and replacement register.
-
-On some machines, the position of the argument pointer is not known until
-the compilation is completed. In such a case, a separate hard register
-must be used for the argument pointer. This register can be eliminated by
-replacing it with either the frame pointer or the argument pointer,
-depending on whether or not the frame pointer has been eliminated.
-
-In this case, you might specify:
-@example
-#define ELIMINABLE_REGS \
-@{@{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM@}, \
- @{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM@}, \
- @{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM@}@}
-@end example
-
-Note that the elimination of the argument pointer with the stack pointer is
-specified first since that is the preferred elimination.
-
-@findex CAN_ELIMINATE
-@item CAN_ELIMINATE (@var{from-reg}, @var{to-reg})
-A C expression that returns non-zero if the compiler is allowed to try
-to replace register number @var{from-reg} with register number
-@var{to-reg}. This macro need only be defined if @code{ELIMINABLE_REGS}
-is defined, and will usually be the constant 1, since most of the cases
-preventing register elimination are things that the compiler already
-knows about.
-
-@findex INITIAL_ELIMINATION_OFFSET
-@item INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})
-This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. It
-specifies the initial difference between the specified pair of
-registers. This macro must be defined if @code{ELIMINABLE_REGS} is
-defined.
-
-@findex LONGJMP_RESTORE_FROM_STACK
-@item LONGJMP_RESTORE_FROM_STACK
-Define this macro if the @code{longjmp} function restores registers from
-the stack frames, rather than from those saved specifically by
-@code{setjmp}. Certain quantities must not be kept in registers across
-a call to @code{setjmp} on such machines.
-@end table
-
-@node Stack Arguments
-@subsection Passing Function Arguments on the Stack
-@cindex arguments on stack
-@cindex stack arguments
-
-The macros in this section control how arguments are passed
-on the stack. See the following section for other macros that
-control passing certain arguments in registers.
-
-@table @code
-@findex PROMOTE_PROTOTYPES
-@item PROMOTE_PROTOTYPES
-Define this macro if an argument declared in a prototype as an
-integral type smaller than @code{int} should actually be passed as an
-@code{int}. In addition to avoiding errors in certain cases of
-mismatch, it also makes for better code on certain machines.
-
-@findex PUSH_ROUNDING
-@item PUSH_ROUNDING (@var{npushed})
-A C expression that is the number of bytes actually pushed onto the
-stack when an instruction attempts to push @var{npushed} bytes.
-
-If the target machine does not have a push instruction, do not define
-this macro. That directs GNU CC to use an alternate strategy: to
-allocate the entire argument block and then store the arguments into
-it.
-
-On some machines, the definition
-
-@example
-#define PUSH_ROUNDING(BYTES) (BYTES)
-@end example
-
-@noindent
-will suffice. But on other machines, instructions that appear
-to push one byte actually push two bytes in an attempt to maintain
-alignment. Then the definition should be
-
-@example
-#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
-@end example
-
-@findex ACCUMULATE_OUTGOING_ARGS
-@findex current_function_outgoing_args_size
-@item ACCUMULATE_OUTGOING_ARGS
-If defined, the maximum amount of space required for outgoing arguments
-will be computed and placed into the variable
-@code{current_function_outgoing_args_size}. No space will be pushed
-onto the stack for each call; instead, the function prologue should
-increase the stack frame size by this amount.
-
-Defining both @code{PUSH_ROUNDING} and @code{ACCUMULATE_OUTGOING_ARGS}
-is not proper.
-
-@findex REG_PARM_STACK_SPACE
-@item REG_PARM_STACK_SPACE (@var{fndecl})
-Define this macro if functions should assume that stack space has been
-allocated for arguments even when their values are passed in
-registers.
-
-The value of this macro is the size, in bytes, of the area reserved for
-arguments passed in registers for the function represented by @var{fndecl}.
-
-This space can be allocated by the caller, or be a part of the
-machine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} says
-which.
-@c above is overfull. not sure what to do. --mew 5feb93 did
-@c something, not sure if it looks good. --mew 10feb93
-
-@findex MAYBE_REG_PARM_STACK_SPACE
-@findex FINAL_REG_PARM_STACK_SPACE
-@item MAYBE_REG_PARM_STACK_SPACE
-@itemx FINAL_REG_PARM_STACK_SPACE (@var{const_size}, @var{var_size})
-Define these macros in addition to the one above if functions might
-allocate stack space for arguments even when their values are passed
-in registers. These should be used when the stack space allocated
-for arguments in registers is not a simple constant independent of the
-function declaration.
-
-The value of the first macro is the size, in bytes, of the area that
-we should initially assume would be reserved for arguments passed in registers.
-
-The value of the second macro is the actual size, in bytes, of the area
-that will be reserved for arguments passed in registers. This takes two
-arguments: an integer representing the number of bytes of fixed sized
-arguments on the stack, and a tree representing the number of bytes of
-variable sized arguments on the stack.
-
-When these macros are defined, @code{REG_PARM_STACK_SPACE} will only be
-called for libcall functions, the current function, or for a function
-being called when it is known that such stack space must be allocated.
-In each case this value can be easily computed.
-
-When deciding whether a called function needs such stack space, and how
-much space to reserve, GNU CC uses these two macros instead of
-@code{REG_PARM_STACK_SPACE}.
-
-@findex OUTGOING_REG_PARM_STACK_SPACE
-@item OUTGOING_REG_PARM_STACK_SPACE
-Define this if it is the responsibility of the caller to allocate the area
-reserved for arguments passed in registers.
-
-If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controls
-whether the space for these arguments counts in the value of
-@code{current_function_outgoing_args_size}.
-
-@findex STACK_PARMS_IN_REG_PARM_AREA
-@item STACK_PARMS_IN_REG_PARM_AREA
-Define this macro if @code{REG_PARM_STACK_SPACE} is defined, but the
-stack parameters don't skip the area specified by it.
-@c i changed this, makes more sens and it should have taken care of the
-@c overfull.. not as specific, tho. --mew 5feb93
-
-Normally, when a parameter is not passed in registers, it is placed on the
-stack beyond the @code{REG_PARM_STACK_SPACE} area. Defining this macro
-suppresses this behavior and causes the parameter to be passed on the
-stack in its natural location.
-
-@findex RETURN_POPS_ARGS
-@item RETURN_POPS_ARGS (@var{fundecl}, @var{funtype}, @var{stack-size})
-A C expression that should indicate the number of bytes of its own
-arguments that a function pops on returning, or 0 if the
-function pops no arguments and the caller must therefore pop them all
-after the function returns.
-
-@var{fundecl} is a C variable whose value is a tree node that describes
-the function in question. Normally it is a node of type
-@code{FUNCTION_DECL} that describes the declaration of the function.
-From this you can obtain the DECL_MACHINE_ATTRIBUTES of the function.
-
-@var{funtype} is a C variable whose value is a tree node that
-describes the function in question. Normally it is a node of type
-@code{FUNCTION_TYPE} that describes the data type of the function.
-From this it is possible to obtain the data types of the value and
-arguments (if known).
-
-When a call to a library function is being considered, @var{funtype}
-will contain an identifier node for the library function. Thus, if
-you need to distinguish among various library functions, you can do so
-by their names. Note that ``library function'' in this context means
-a function used to perform arithmetic, whose name is known specially
-in the compiler and was not mentioned in the C code being compiled.
-
-@var{stack-size} is the number of bytes of arguments passed on the
-stack. If a variable number of bytes is passed, it is zero, and
-argument popping will always be the responsibility of the calling function.
-
-On the Vax, all functions always pop their arguments, so the definition
-of this macro is @var{stack-size}. On the 68000, using the standard
-calling convention, no functions pop their arguments, so the value of
-the macro is always 0 in this case. But an alternative calling
-convention is available in which functions that take a fixed number of
-arguments pop them but other functions (such as @code{printf}) pop
-nothing (the caller pops all). When this convention is in use,
-@var{funtype} is examined to determine whether a function takes a fixed
-number of arguments.
-@end table
-
-@node Register Arguments
-@subsection Passing Arguments in Registers
-@cindex arguments in registers
-@cindex registers arguments
-
-This section describes the macros which let you control how various
-types of arguments are passed in registers or how they are arranged in
-the stack.
-
-@table @code
-@findex FUNCTION_ARG
-@item FUNCTION_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
-A C expression that controls whether a function argument is passed
-in a register, and which register.
-
-The arguments are @var{cum}, which summarizes all the previous
-arguments; @var{mode}, the machine mode of the argument; @var{type},
-the data type of the argument as a tree node or 0 if that is not known
-(which happens for C support library functions); and @var{named},
-which is 1 for an ordinary argument and 0 for nameless arguments that
-correspond to @samp{@dots{}} in the called function's prototype.
-
-The value of the expression is usually either a @code{reg} RTX for the
-hard register in which to pass the argument, or zero to pass the
-argument on the stack.
-
-For machines like the Vax and 68000, where normally all arguments are
-pushed, zero suffices as a definition.
-
-The value of the expression can also be a @code{parallel} RTX. This is
-used when an argument is passed in multiple locations. The mode of the
-of the @code{parallel} should be the mode of the entire argument. The
-@code{parallel} holds any number of @code{expr_list} pairs; each one
-describes where part of the argument is passed. In each @code{expr_list},
-the first operand can be either a @code{reg} RTX for the hard register
-in which to pass this part of the argument, or zero to pass the argument
-on the stack. If this operand is a @code{reg}, then the mode indicates
-how large this part of the argument is. The second operand of the
-@code{expr_list} is a @code{const_int} which gives the offset in bytes
-into the entire argument where this part starts.
-
-@cindex @file{stdarg.h} and register arguments
-The usual way to make the ANSI library @file{stdarg.h} work on a machine
-where some arguments are usually passed in registers, is to cause
-nameless arguments to be passed on the stack instead. This is done
-by making @code{FUNCTION_ARG} return 0 whenever @var{named} is 0.
-
-@cindex @code{MUST_PASS_IN_STACK}, and @code{FUNCTION_ARG}
-@cindex @code{REG_PARM_STACK_SPACE}, and @code{FUNCTION_ARG}
-You may use the macro @code{MUST_PASS_IN_STACK (@var{mode}, @var{type})}
-in the definition of this macro to determine if this argument is of a
-type that must be passed in the stack. If @code{REG_PARM_STACK_SPACE}
-is not defined and @code{FUNCTION_ARG} returns non-zero for such an
-argument, the compiler will abort. If @code{REG_PARM_STACK_SPACE} is
-defined, the argument will be computed in the stack and then loaded into
-a register.
-
-@findex FUNCTION_INCOMING_ARG
-@item FUNCTION_INCOMING_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
-Define this macro if the target machine has ``register windows'', so
-that the register in which a function sees an arguments is not
-necessarily the same as the one in which the caller passed the
-argument.
-
-For such machines, @code{FUNCTION_ARG} computes the register in which
-the caller passes the value, and @code{FUNCTION_INCOMING_ARG} should
-be defined in a similar fashion to tell the function being called
-where the arguments will arrive.
-
-If @code{FUNCTION_INCOMING_ARG} is not defined, @code{FUNCTION_ARG}
-serves both purposes.@refill
-
-@findex FUNCTION_ARG_PARTIAL_NREGS
-@item FUNCTION_ARG_PARTIAL_NREGS (@var{cum}, @var{mode}, @var{type}, @var{named})
-A C expression for the number of words, at the beginning of an
-argument, must be put in registers. The value must be zero for
-arguments that are passed entirely in registers or that are entirely
-pushed on the stack.
-
-On some machines, certain arguments must be passed partially in
-registers and partially in memory. On these machines, typically the
-first @var{n} words of arguments are passed in registers, and the rest
-on the stack. If a multi-word argument (a @code{double} or a
-structure) crosses that boundary, its first few words must be passed
-in registers and the rest must be pushed. This macro tells the
-compiler when this occurs, and how many of the words should go in
-registers.
-
-@code{FUNCTION_ARG} for these arguments should return the first
-register to be used by the caller for this argument; likewise
-@code{FUNCTION_INCOMING_ARG}, for the called function.
-
-@findex FUNCTION_ARG_PASS_BY_REFERENCE
-@item FUNCTION_ARG_PASS_BY_REFERENCE (@var{cum}, @var{mode}, @var{type}, @var{named})
-A C expression that indicates when an argument must be passed by reference.
-If nonzero for an argument, a copy of that argument is made in memory and a
-pointer to the argument is passed instead of the argument itself.
-The pointer is passed in whatever way is appropriate for passing a pointer
-to that type.
-
-On machines where @code{REG_PARM_STACK_SPACE} is not defined, a suitable
-definition of this macro might be
-@smallexample
-#define FUNCTION_ARG_PASS_BY_REFERENCE\
-(CUM, MODE, TYPE, NAMED) \
- MUST_PASS_IN_STACK (MODE, TYPE)
-@end smallexample
-@c this is *still* too long. --mew 5feb93
-
-@findex FUNCTION_ARG_CALLEE_COPIES
-@item FUNCTION_ARG_CALLEE_COPIES (@var{cum}, @var{mode}, @var{type}, @var{named})
-If defined, a C expression that indicates when it is the called function's
-responsibility to make a copy of arguments passed by invisible reference.
-Normally, the caller makes a copy and passes the address of the copy to the
-routine being called. When FUNCTION_ARG_CALLEE_COPIES is defined and is
-nonzero, the caller does not make a copy. Instead, it passes a pointer to the
-``live'' value. The called function must not modify this value. If it can be
-determined that the value won't be modified, it need not make a copy;
-otherwise a copy must be made.
-
-@findex CUMULATIVE_ARGS
-@item CUMULATIVE_ARGS
-A C type for declaring a variable that is used as the first argument of
-@code{FUNCTION_ARG} and other related values. For some target machines,
-the type @code{int} suffices and can hold the number of bytes of
-argument so far.
-
-There is no need to record in @code{CUMULATIVE_ARGS} anything about the
-arguments that have been passed on the stack. The compiler has other
-variables to keep track of that. For target machines on which all
-arguments are passed on the stack, there is no need to store anything in
-@code{CUMULATIVE_ARGS}; however, the data structure must exist and
-should not be empty, so use @code{int}.
-
-@findex INIT_CUMULATIVE_ARGS
-@item INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype}, @var{libname}, @var{indirect})
-A C statement (sans semicolon) for initializing the variable @var{cum}
-for the state at the beginning of the argument list. The variable has
-type @code{CUMULATIVE_ARGS}. The value of @var{fntype} is the tree node
-for the data type of the function which will receive the args, or 0
-if the args are to a compiler support library function. The value of
-@var{indirect} is nonzero when processing an indirect call, for example
-a call through a function pointer. The value of @var{indirect} is zero
-for a call to an explicitly named function, a library function call, or when
-@code{INIT_CUMULATIVE_ARGS} is used to find arguments for the function
-being compiled.
-
-When processing a call to a compiler support library function,
-@var{libname} identifies which one. It is a @code{symbol_ref} rtx which
-contains the name of the function, as a string. @var{libname} is 0 when
-an ordinary C function call is being processed. Thus, each time this
-macro is called, either @var{libname} or @var{fntype} is nonzero, but
-never both of them at once.
-
-@findex INIT_CUMULATIVE_INCOMING_ARGS
-@item INIT_CUMULATIVE_INCOMING_ARGS (@var{cum}, @var{fntype}, @var{libname})
-Like @code{INIT_CUMULATIVE_ARGS} but overrides it for the purposes of
-finding the arguments for the function being compiled. If this macro is
-undefined, @code{INIT_CUMULATIVE_ARGS} is used instead.
-
-The value passed for @var{libname} is always 0, since library routines
-with special calling conventions are never compiled with GNU CC. The
-argument @var{libname} exists for symmetry with
-@code{INIT_CUMULATIVE_ARGS}.
-@c could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe.
-@c --mew 5feb93 i switched the order of the sentences. --mew 10feb93
-
-@findex FUNCTION_ARG_ADVANCE
-@item FUNCTION_ARG_ADVANCE (@var{cum}, @var{mode}, @var{type}, @var{named})
-A C statement (sans semicolon) to update the summarizer variable
-@var{cum} to advance past an argument in the argument list. The
-values @var{mode}, @var{type} and @var{named} describe that argument.
-Once this is done, the variable @var{cum} is suitable for analyzing
-the @emph{following} argument with @code{FUNCTION_ARG}, etc.@refill
-
-This macro need not do anything if the argument in question was passed
-on the stack. The compiler knows how to track the amount of stack space
-used for arguments without any special help.
-
-@findex FUNCTION_ARG_PADDING
-@item FUNCTION_ARG_PADDING (@var{mode}, @var{type})
-If defined, a C expression which determines whether, and in which direction,
-to pad out an argument with extra space. The value should be of type
-@code{enum direction}: either @code{upward} to pad above the argument,
-@code{downward} to pad below, or @code{none} to inhibit padding.
-
-The @emph{amount} of padding is always just enough to reach the next
-multiple of @code{FUNCTION_ARG_BOUNDARY}; this macro does not control
-it.
-
-This macro has a default definition which is right for most systems.
-For little-endian machines, the default is to pad upward. For
-big-endian machines, the default is to pad downward for an argument of
-constant size shorter than an @code{int}, and upward otherwise.
-
-@findex FUNCTION_ARG_BOUNDARY
-@item FUNCTION_ARG_BOUNDARY (@var{mode}, @var{type})
-If defined, a C expression that gives the alignment boundary, in bits,
-of an argument with the specified mode and type. If it is not defined,
-@code{PARM_BOUNDARY} is used for all arguments.
-
-@findex FUNCTION_ARG_REGNO_P
-@item FUNCTION_ARG_REGNO_P (@var{regno})
-A C expression that is nonzero if @var{regno} is the number of a hard
-register in which function arguments are sometimes passed. This does
-@emph{not} include implicit arguments such as the static chain and
-the structure-value address. On many machines, no registers can be
-used for this purpose since all function arguments are pushed on the
-stack.
-@end table
-
-@node Scalar Return
-@subsection How Scalar Function Values Are Returned
-@cindex return values in registers
-@cindex values, returned by functions
-@cindex scalars, returned as values
-
-This section discusses the macros that control returning scalars as
-values---values that can fit in registers.
-
-@table @code
-@findex TRADITIONAL_RETURN_FLOAT
-@item TRADITIONAL_RETURN_FLOAT
-Define this macro if @samp{-traditional} should not cause functions
-declared to return @code{float} to convert the value to @code{double}.
-
-@findex FUNCTION_VALUE
-@item FUNCTION_VALUE (@var{valtype}, @var{func})
-A C expression to create an RTX representing the place where a
-function returns a value of data type @var{valtype}. @var{valtype} is
-a tree node representing a data type. Write @code{TYPE_MODE
-(@var{valtype})} to get the machine mode used to represent that type.
-On many machines, only the mode is relevant. (Actually, on most
-machines, scalar values are returned in the same place regardless of
-mode).@refill
-
-The value of the expression is usually a @code{reg} RTX for the hard
-register where the return value is stored. The value can also be a
-@code{parallel} RTX, if the return value is in multiple places. See
-@code{FUNCTION_ARG} for an explanation of the @code{parallel} form.
-
-If @code{PROMOTE_FUNCTION_RETURN} is defined, you must apply the same
-promotion rules specified in @code{PROMOTE_MODE} if @var{valtype} is a
-scalar type.
-
-If the precise function being called is known, @var{func} is a tree
-node (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
-pointer. This makes it possible to use a different value-returning
-convention for specific functions when all their calls are
-known.@refill
-
-@code{FUNCTION_VALUE} is not used for return vales with aggregate data
-types, because these are returned in another way. See
-@code{STRUCT_VALUE_REGNUM} and related macros, below.
-
-@findex FUNCTION_OUTGOING_VALUE
-@item FUNCTION_OUTGOING_VALUE (@var{valtype}, @var{func})
-Define this macro if the target machine has ``register windows''
-so that the register in which a function returns its value is not
-the same as the one in which the caller sees the value.
-
-For such machines, @code{FUNCTION_VALUE} computes the register in which
-the caller will see the value. @code{FUNCTION_OUTGOING_VALUE} should be
-defined in a similar fashion to tell the function where to put the
-value.@refill
-
-If @code{FUNCTION_OUTGOING_VALUE} is not defined,
-@code{FUNCTION_VALUE} serves both purposes.@refill
-
-@code{FUNCTION_OUTGOING_VALUE} is not used for return vales with
-aggregate data types, because these are returned in another way. See
-@code{STRUCT_VALUE_REGNUM} and related macros, below.
-
-@findex LIBCALL_VALUE
-@item LIBCALL_VALUE (@var{mode})
-A C expression to create an RTX representing the place where a library
-function returns a value of mode @var{mode}. If the precise function
-being called is known, @var{func} is a tree node
-(@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
-pointer. This makes it possible to use a different value-returning
-convention for specific functions when all their calls are
-known.@refill
-
-Note that ``library function'' in this context means a compiler
-support routine, used to perform arithmetic, whose name is known
-specially by the compiler and was not mentioned in the C code being
-compiled.
-
-The definition of @code{LIBRARY_VALUE} need not be concerned aggregate
-data types, because none of the library functions returns such types.
-
-@findex FUNCTION_VALUE_REGNO_P
-@item FUNCTION_VALUE_REGNO_P (@var{regno})
-A C expression that is nonzero if @var{regno} is the number of a hard
-register in which the values of called function may come back.
-
-A register whose use for returning values is limited to serving as the
-second of a pair (for a value of type @code{double}, say) need not be
-recognized by this macro. So for most machines, this definition
-suffices:
-
-@example
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-@end example
-
-If the machine has register windows, so that the caller and the called
-function use different registers for the return value, this macro
-should recognize only the caller's register numbers.
-
-@findex APPLY_RESULT_SIZE
-@item APPLY_RESULT_SIZE
-Define this macro if @samp{untyped_call} and @samp{untyped_return}
-need more space than is implied by @code{FUNCTION_VALUE_REGNO_P} for
-saving and restoring an arbitrary return value.
-@end table
-
-@node Aggregate Return
-@subsection How Large Values Are Returned
-@cindex aggregates as return values
-@cindex large return values
-@cindex returning aggregate values
-@cindex structure value address
-
-When a function value's mode is @code{BLKmode} (and in some other
-cases), the value is not returned according to @code{FUNCTION_VALUE}
-(@pxref{Scalar Return}). Instead, the caller passes the address of a
-block of memory in which the value should be stored. This address
-is called the @dfn{structure value address}.
-
-This section describes how to control returning structure values in
-memory.
-
-@table @code
-@findex RETURN_IN_MEMORY
-@item RETURN_IN_MEMORY (@var{type})
-A C expression which can inhibit the returning of certain function
-values in registers, based on the type of value. A nonzero value says
-to return the function value in memory, just as large structures are
-always returned. Here @var{type} will be a C expression of type
-@code{tree}, representing the data type of the value.
-
-Note that values of mode @code{BLKmode} must be explicitly handled
-by this macro. Also, the option @samp{-fpcc-struct-return}
-takes effect regardless of this macro. On most systems, it is
-possible to leave the macro undefined; this causes a default
-definition to be used, whose value is the constant 1 for @code{BLKmode}
-values, and 0 otherwise.
-
-Do not use this macro to indicate that structures and unions should always
-be returned in memory. You should instead use @code{DEFAULT_PCC_STRUCT_RETURN}
-to indicate this.
-
-@findex DEFAULT_PCC_STRUCT_RETURN
-@item DEFAULT_PCC_STRUCT_RETURN
-Define this macro to be 1 if all structure and union return values must be
-in memory. Since this results in slower code, this should be defined
-only if needed for compatibility with other compilers or with an ABI.
-If you define this macro to be 0, then the conventions used for structure
-and union return values are decided by the @code{RETURN_IN_MEMORY} macro.
-
-If not defined, this defaults to the value 1.
-
-@findex STRUCT_VALUE_REGNUM
-@item STRUCT_VALUE_REGNUM
-If the structure value address is passed in a register, then
-@code{STRUCT_VALUE_REGNUM} should be the number of that register.
-
-@findex STRUCT_VALUE
-@item STRUCT_VALUE
-If the structure value address is not passed in a register, define
-@code{STRUCT_VALUE} as an expression returning an RTX for the place
-where the address is passed. If it returns 0, the address is passed as
-an ``invisible'' first argument.
-
-@findex STRUCT_VALUE_INCOMING_REGNUM
-@item STRUCT_VALUE_INCOMING_REGNUM
-On some architectures the place where the structure value address
-is found by the called function is not the same place that the
-caller put it. This can be due to register windows, or it could
-be because the function prologue moves it to a different place.
-
-If the incoming location of the structure value address is in a
-register, define this macro as the register number.
-
-@findex STRUCT_VALUE_INCOMING
-@item STRUCT_VALUE_INCOMING
-If the incoming location is not a register, then you should define
-@code{STRUCT_VALUE_INCOMING} as an expression for an RTX for where the
-called function should find the value. If it should find the value on
-the stack, define this to create a @code{mem} which refers to the frame
-pointer. A definition of 0 means that the address is passed as an
-``invisible'' first argument.
-
-@findex PCC_STATIC_STRUCT_RETURN
-@item PCC_STATIC_STRUCT_RETURN
-Define this macro if the usual system convention on the target machine
-for returning structures and unions is for the called function to return
-the address of a static variable containing the value.
-
-Do not define this if the usual system convention is for the caller to
-pass an address to the subroutine.
-
-This macro has effect in @samp{-fpcc-struct-return} mode, but it does
-nothing when you use @samp{-freg-struct-return} mode.
-@end table
-
-@node Caller Saves
-@subsection Caller-Saves Register Allocation
-
-If you enable it, GNU CC can save registers around function calls. This
-makes it possible to use call-clobbered registers to hold variables that
-must live across calls.
-
-@table @code
-@findex DEFAULT_CALLER_SAVES
-@item DEFAULT_CALLER_SAVES
-Define this macro if function calls on the target machine do not preserve
-any registers; in other words, if @code{CALL_USED_REGISTERS} has 1
-for all registers. This macro enables @samp{-fcaller-saves} by default.
-Eventually that option will be enabled by default on all machines and both
-the option and this macro will be eliminated.
-
-@findex CALLER_SAVE_PROFITABLE
-@item CALLER_SAVE_PROFITABLE (@var{refs}, @var{calls})
-A C expression to determine whether it is worthwhile to consider placing
-a pseudo-register in a call-clobbered hard register and saving and
-restoring it around each function call. The expression should be 1 when
-this is worth doing, and 0 otherwise.
-
-If you don't define this macro, a default is used which is good on most
-machines: @code{4 * @var{calls} < @var{refs}}.
-@end table
-
-@node Function Entry
-@subsection Function Entry and Exit
-@cindex function entry and exit
-@cindex prologue
-@cindex epilogue
-
-This section describes the macros that output function entry
-(@dfn{prologue}) and exit (@dfn{epilogue}) code.
-
-@table @code
-@findex FUNCTION_PROLOGUE
-@item FUNCTION_PROLOGUE (@var{file}, @var{size})
-A C compound statement that outputs the assembler code for entry to a
-function. The prologue is responsible for setting up the stack frame,
-initializing the frame pointer register, saving registers that must be
-saved, and allocating @var{size} additional bytes of storage for the
-local variables. @var{size} is an integer. @var{file} is a stdio
-stream to which the assembler code should be output.
-
-The label for the beginning of the function need not be output by this
-macro. That has already been done when the macro is run.
-
-@findex regs_ever_live
-To determine which registers to save, the macro can refer to the array
-@code{regs_ever_live}: element @var{r} is nonzero if hard register
-@var{r} is used anywhere within the function. This implies the function
-prologue should save register @var{r}, provided it is not one of the
-call-used registers. (@code{FUNCTION_EPILOGUE} must likewise use
-@code{regs_ever_live}.)
-
-On machines that have ``register windows'', the function entry code does
-not save on the stack the registers that are in the windows, even if
-they are supposed to be preserved by function calls; instead it takes
-appropriate steps to ``push'' the register stack, if any non-call-used
-registers are used in the function.
-
-@findex frame_pointer_needed
-On machines where functions may or may not have frame-pointers, the
-function entry code must vary accordingly; it must set up the frame
-pointer if one is wanted, and not otherwise. To determine whether a
-frame pointer is in wanted, the macro can refer to the variable
-@code{frame_pointer_needed}. The variable's value will be 1 at run
-time in a function that needs a frame pointer. @xref{Elimination}.
-
-The function entry code is responsible for allocating any stack space
-required for the function. This stack space consists of the regions
-listed below. In most cases, these regions are allocated in the
-order listed, with the last listed region closest to the top of the
-stack (the lowest address if @code{STACK_GROWS_DOWNWARD} is defined, and
-the highest address if it is not defined). You can use a different order
-for a machine if doing so is more convenient or required for
-compatibility reasons. Except in cases where required by standard
-or by a debugger, there is no reason why the stack layout used by GCC
-need agree with that used by other compilers for a machine.
-
-@itemize @bullet
-@item
-@findex current_function_pretend_args_size
-A region of @code{current_function_pretend_args_size} bytes of
-uninitialized space just underneath the first argument arriving on the
-stack. (This may not be at the very start of the allocated stack region
-if the calling sequence has pushed anything else since pushing the stack
-arguments. But usually, on such machines, nothing else has been pushed
-yet, because the function prologue itself does all the pushing.) This
-region is used on machines where an argument may be passed partly in
-registers and partly in memory, and, in some cases to support the
-features in @file{varargs.h} and @file{stdargs.h}.
-
-@item
-An area of memory used to save certain registers used by the function.
-The size of this area, which may also include space for such things as
-the return address and pointers to previous stack frames, is
-machine-specific and usually depends on which registers have been used
-in the function. Machines with register windows often do not require
-a save area.
-
-@item
-A region of at least @var{size} bytes, possibly rounded up to an allocation
-boundary, to contain the local variables of the function. On some machines,
-this region and the save area may occur in the opposite order, with the
-save area closer to the top of the stack.
-
-@item
-@cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames
-Optionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of
-@code{current_function_outgoing_args_size} bytes to be used for outgoing
-argument lists of the function. @xref{Stack Arguments}.
-@end itemize
-
-Normally, it is necessary for the macros @code{FUNCTION_PROLOGUE} and
-@code{FUNCTION_EPILOGUE} to treat leaf functions specially. The C
-variable @code{leaf_function} is nonzero for such a function.
-
-@findex EXIT_IGNORE_STACK
-@item EXIT_IGNORE_STACK
-Define this macro as a C expression that is nonzero if the return
-instruction or the function epilogue ignores the value of the stack
-pointer; in other words, if it is safe to delete an instruction to
-adjust the stack pointer before a return from the function.
-
-Note that this macro's value is relevant only for functions for which
-frame pointers are maintained. It is never safe to delete a final
-stack adjustment in a function that has no frame pointer, and the
-compiler knows this regardless of @code{EXIT_IGNORE_STACK}.
-
-@findex EPILOGUE_USES
-@item EPILOGUE_USES (@var{regno})
-Define this macro as a C expression that is nonzero for registers are
-used by the epilogue or the @samp{return} pattern. The stack and frame
-pointer registers are already be assumed to be used as needed.
-
-@findex FUNCTION_EPILOGUE
-@item FUNCTION_EPILOGUE (@var{file}, @var{size})
-A C compound statement that outputs the assembler code for exit from a
-function. The epilogue is responsible for restoring the saved
-registers and stack pointer to their values when the function was
-called, and returning control to the caller. This macro takes the
-same arguments as the macro @code{FUNCTION_PROLOGUE}, and the
-registers to restore are determined from @code{regs_ever_live} and
-@code{CALL_USED_REGISTERS} in the same way.
-
-On some machines, there is a single instruction that does all the work
-of returning from the function. On these machines, give that
-instruction the name @samp{return} and do not define the macro
-@code{FUNCTION_EPILOGUE} at all.
-
-Do not define a pattern named @samp{return} if you want the
-@code{FUNCTION_EPILOGUE} to be used. If you want the target switches
-to control whether return instructions or epilogues are used, define a
-@samp{return} pattern with a validity condition that tests the target
-switches appropriately. If the @samp{return} pattern's validity
-condition is false, epilogues will be used.
-
-On machines where functions may or may not have frame-pointers, the
-function exit code must vary accordingly. Sometimes the code for these
-two cases is completely different. To determine whether a frame pointer
-is wanted, the macro can refer to the variable
-@code{frame_pointer_needed}. The variable's value will be 1 when compiling
-a function that needs a frame pointer.
-
-Normally, @code{FUNCTION_PROLOGUE} and @code{FUNCTION_EPILOGUE} must
-treat leaf functions specially. The C variable @code{leaf_function} is
-nonzero for such a function. @xref{Leaf Functions}.
-
-On some machines, some functions pop their arguments on exit while
-others leave that for the caller to do. For example, the 68020 when
-given @samp{-mrtd} pops arguments in functions that take a fixed
-number of arguments.
-
-@findex current_function_pops_args
-Your definition of the macro @code{RETURN_POPS_ARGS} decides which
-functions pop their own arguments. @code{FUNCTION_EPILOGUE} needs to
-know what was decided. The variable that is called
-@code{current_function_pops_args} is the number of bytes of its
-arguments that a function should pop. @xref{Scalar Return}.
-@c what is the "its arguments" in the above sentence referring to, pray
-@c tell? --mew 5feb93
-
-@findex DELAY_SLOTS_FOR_EPILOGUE
-@item DELAY_SLOTS_FOR_EPILOGUE
-Define this macro if the function epilogue contains delay slots to which
-instructions from the rest of the function can be ``moved''. The
-definition should be a C expression whose value is an integer
-representing the number of delay slots there.
-
-@findex ELIGIBLE_FOR_EPILOGUE_DELAY
-@item ELIGIBLE_FOR_EPILOGUE_DELAY (@var{insn}, @var{n})
-A C expression that returns 1 if @var{insn} can be placed in delay
-slot number @var{n} of the epilogue.
-
-The argument @var{n} is an integer which identifies the delay slot now
-being considered (since different slots may have different rules of
-eligibility). It is never negative and is always less than the number
-of epilogue delay slots (what @code{DELAY_SLOTS_FOR_EPILOGUE} returns).
-If you reject a particular insn for a given delay slot, in principle, it
-may be reconsidered for a subsequent delay slot. Also, other insns may
-(at least in principle) be considered for the so far unfilled delay
-slot.
-
-@findex current_function_epilogue_delay_list
-@findex final_scan_insn
-The insns accepted to fill the epilogue delay slots are put in an RTL
-list made with @code{insn_list} objects, stored in the variable
-@code{current_function_epilogue_delay_list}. The insn for the first
-delay slot comes first in the list. Your definition of the macro
-@code{FUNCTION_EPILOGUE} should fill the delay slots by outputting the
-insns in this list, usually by calling @code{final_scan_insn}.
-
-You need not define this macro if you did not define
-@code{DELAY_SLOTS_FOR_EPILOGUE}.
-
-@findex ASM_OUTPUT_MI_THUNK
-@item ASM_OUTPUT_MI_THUNK (@var{file}, @var{thunk_fndecl}, @var{delta}, @var{function})
-A C compound statement that outputs the assembler code for a thunk
-function, used to implement C++ virtual function calls with multiple
-inheritance. The thunk acts as a wrapper around a virtual function,
-adjusting the implicit object parameter before handing control off to
-the real function.
-
-First, emit code to add the integer @var{delta} to the location that
-contains the incoming first argument. Assume that this argument
-contains a pointer, and is the one used to pass the @code{this} pointer
-in C++. This is the incoming argument @emph{before} the function prologue,
-e.g. @samp{%o0} on a sparc. The addition must preserve the values of
-all other incoming arguments.
-
-After the addition, emit code to jump to @var{function}, which is a
-@code{FUNCTION_DECL}. This is a direct pure jump, not a call, and does
-not touch the return address. Hence returning from @var{FUNCTION} will
-return to whoever called the current @samp{thunk}.
-
-The effect must be as if @var{function} had been called directly with
-the adjusted first argument. This macro is responsible for emitting all
-of the code for a thunk function; @code{FUNCTION_PROLOGUE} and
-@code{FUNCTION_EPILOGUE} are not invoked.
-
-The @var{thunk_fndecl} is redundant. (@var{delta} and @var{function}
-have already been extracted from it.) It might possibly be useful on
-some targets, but probably not.
-
-For many targets, the target-independent code in the C++ frontend will
-be sufficient and you can leave this macro undefined. You need to
-define this macro if the code generated by default would clobber any of
-the incoming arguments; this is only likely if parameters can be passed
-in registers. You should also define this macro if the default code is
-sub-optimal.
-@end table
-
-@node Profiling
-@subsection Generating Code for Profiling
-@cindex profiling, code generation
-
-These macros will help you generate code for profiling.
-
-@table @code
-@findex FUNCTION_PROFILER
-@item FUNCTION_PROFILER (@var{file}, @var{labelno})
-A C statement or compound statement to output to @var{file} some
-assembler code to call the profiling subroutine @code{mcount}.
-Before calling, the assembler code must load the address of a
-counter variable into a register where @code{mcount} expects to
-find the address. The name of this variable is @samp{LP} followed
-by the number @var{labelno}, so you would generate the name using
-@samp{LP%d} in a @code{fprintf}.
-
-@findex mcount
-The details of how the address should be passed to @code{mcount} are
-determined by your operating system environment, not by GNU CC. To
-figure them out, compile a small program for profiling using the
-system's installed C compiler and look at the assembler code that
-results.
-
-@findex PROFILE_BEFORE_PROLOGUE
-@item PROFILE_BEFORE_PROLOGUE
-Define this macro if the code for function profiling should come before
-the function prologue. Normally, the profiling code comes after.
-
-@findex FUNCTION_BLOCK_PROFILER
-@vindex profile_block_flag
-@item FUNCTION_BLOCK_PROFILER (@var{file}, @var{labelno})
-A C statement or compound statement to output to @var{file} some
-assembler code to initialize basic-block profiling for the current
-object module. The global compile flag @code{profile_block_flag}
-distingishes two profile modes.
-
-@table @code
-@findex __bb_init_func
-@item profile_block_flag != 2
-Output code to call the subroutine @code{__bb_init_func} once per
-object module, passing it as its sole argument the address of a block
-allocated in the object module.
-
-The name of the block is a local symbol made with this statement:
-
-@smallexample
-ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 0);
-@end smallexample
-
-Of course, since you are writing the definition of
-@code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
-can take a short cut in the definition of this macro and use the name
-that you know will result.
-
-The first word of this block is a flag which will be nonzero if the
-object module has already been initialized. So test this word first,
-and do not call @code{__bb_init_func} if the flag is
-nonzero. BLOCK_OR_LABEL contains a unique number which may be used to
-generate a label as a branch destination when @code{__bb_init_func}
-will not be called.
-
-Described in assembler language, the code to be output looks like:
-
-@example
- cmp (LPBX0),0
- bne local_label
- parameter1 <- LPBX0
- call __bb_init_func
-local_label:
-@end example
-
-@findex __bb_init_trace_func
-@item profile_block_flag == 2
-Output code to call the subroutine @code{__bb_init_trace_func}
-and pass two parameters to it. The first parameter is the same as
-for @code{__bb_init_func}. The second parameter is the number of the
-first basic block of the function as given by BLOCK_OR_LABEL. Note
-that @code{__bb_init_trace_func} has to be called, even if the object
-module has been initialized already.
-
-Described in assembler language, the code to be output looks like:
-@example
-parameter1 <- LPBX0
-parameter2 <- BLOCK_OR_LABEL
-call __bb_init_trace_func
-@end example
-@end table
-
-@findex BLOCK_PROFILER
-@vindex profile_block_flag
-@item BLOCK_PROFILER (@var{file}, @var{blockno})
-A C statement or compound statement to output to @var{file} some
-assembler code to increment the count associated with the basic
-block number @var{blockno}. The global compile flag
-@code{profile_block_flag} distingishes two profile modes.
-
-@table @code
-@item profile_block_flag != 2
-Output code to increment the counter directly. Basic blocks are
-numbered separately from zero within each compilation. The count
-associated with block number @var{blockno} is at index
-@var{blockno} in a vector of words; the name of this array is a local
-symbol made with this statement:
-
-@smallexample
-ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 2);
-@end smallexample
-
-@c This paragraph is the same as one a few paragraphs up.
-@c That is not an error.
-Of course, since you are writing the definition of
-@code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
-can take a short cut in the definition of this macro and use the name
-that you know will result.
-
-Described in assembler language, the code to be output looks like:
-
-@smallexample
-inc (LPBX2+4*BLOCKNO)
-@end smallexample
-
-@vindex __bb
-@findex __bb_trace_func
-@item profile_block_flag == 2
-Output code to initialize the global structure @code{__bb} and
-call the function @code{__bb_trace_func}, which will increment the
-counter.
-
-@code{__bb} consists of two words. In the first word, the current
-basic block number, as given by BLOCKNO, has to be stored. In
-the second word, the address of a block allocated in the object
-module has to be stored. The address is given by the label created
-with this statement:
-
-@smallexample
-ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 0);
-@end smallexample
-
-Described in assembler language, the code to be output looks like:
-@example
-move BLOCKNO -> (__bb)
-move LPBX0 -> (__bb+4)
-call __bb_trace_func
-@end example
-@end table
-
-@findex FUNCTION_BLOCK_PROFILER_EXIT
-@findex __bb_trace_ret
-@vindex profile_block_flag
-@item FUNCTION_BLOCK_PROFILER_EXIT (@var{file})
-A C statement or compound statement to output to @var{file}
-assembler code to call function @code{__bb_trace_ret}. The
-assembler code should only be output
-if the global compile flag @code{profile_block_flag} == 2. This
-macro has to be used at every place where code for returning from
-a function is generated (e.g. @code{FUNCTION_EPILOGUE}). Although
-you have to write the definition of @code{FUNCTION_EPILOGUE}
-as well, you have to define this macro to tell the compiler, that
-the proper call to @code{__bb_trace_ret} is produced.
-
-@findex MACHINE_STATE_SAVE
-@findex __bb_init_trace_func
-@findex __bb_trace_func
-@findex __bb_trace_ret
-@item MACHINE_STATE_SAVE (@var{id})
-A C statement or compound statement to save all registers, which may
-be clobbered by a function call, including condition codes. The
-@code{asm} statement will be mostly likely needed to handle this
-task. Local labels in the assembler code can be concatenated with the
-string @var{id}, to obtain a unique lable name.
-
-Registers or condition codes clobbered by @code{FUNCTION_PROLOGUE} or
-@code{FUNCTION_EPILOGUE} must be saved in the macros
-@code{FUNCTION_BLOCK_PROFILER}, @code{FUNCTION_BLOCK_PROFILER_EXIT} and
-@code{BLOCK_PROFILER} prior calling @code{__bb_init_trace_func},
-@code{__bb_trace_ret} and @code{__bb_trace_func} respectively.
-
-@findex MACHINE_STATE_RESTORE
-@findex __bb_init_trace_func
-@findex __bb_trace_func
-@findex __bb_trace_ret
-@item MACHINE_STATE_RESTORE (@var{id})
-A C statement or compound statement to restore all registers, including
-condition codes, saved by @code{MACHINE_STATE_SAVE}.
-
-Registers or condition codes clobbered by @code{FUNCTION_PROLOGUE} or
-@code{FUNCTION_EPILOGUE} must be restored in the macros
-@code{FUNCTION_BLOCK_PROFILER}, @code{FUNCTION_BLOCK_PROFILER_EXIT} and
-@code{BLOCK_PROFILER} after calling @code{__bb_init_trace_func},
-@code{__bb_trace_ret} and @code{__bb_trace_func} respectively.
-
-@findex BLOCK_PROFILER_CODE
-@item BLOCK_PROFILER_CODE
-A C function or functions which are needed in the library to
-support block profiling.
-@end table
-
-@node Varargs
-@section Implementing the Varargs Macros
-@cindex varargs implementation
-
-GNU CC comes with an implementation of @file{varargs.h} and
-@file{stdarg.h} that work without change on machines that pass arguments
-on the stack. Other machines require their own implementations of
-varargs, and the two machine independent header files must have
-conditionals to include it.
-
-ANSI @file{stdarg.h} differs from traditional @file{varargs.h} mainly in
-the calling convention for @code{va_start}. The traditional
-implementation takes just one argument, which is the variable in which
-to store the argument pointer. The ANSI implementation of
-@code{va_start} takes an additional second argument. The user is
-supposed to write the last named argument of the function here.
-
-However, @code{va_start} should not use this argument. The way to find
-the end of the named arguments is with the built-in functions described
-below.
-
-@table @code
-@findex __builtin_saveregs
-@item __builtin_saveregs ()
-Use this built-in function to save the argument registers in memory so
-that the varargs mechanism can access them. Both ANSI and traditional
-versions of @code{va_start} must use @code{__builtin_saveregs}, unless
-you use @code{SETUP_INCOMING_VARARGS} (see below) instead.
-
-On some machines, @code{__builtin_saveregs} is open-coded under the
-control of the macro @code{EXPAND_BUILTIN_SAVEREGS}. On other machines,
-it calls a routine written in assembler language, found in
-@file{libgcc2.c}.
-
-Code generated for the call to @code{__builtin_saveregs} appears at the
-beginning of the function, as opposed to where the call to
-@code{__builtin_saveregs} is written, regardless of what the code is.
-This is because the registers must be saved before the function starts
-to use them for its own purposes.
-@c i rewrote the first sentence above to fix an overfull hbox. --mew
-@c 10feb93
-
-@findex __builtin_args_info
-@item __builtin_args_info (@var{category})
-Use this built-in function to find the first anonymous arguments in
-registers.
-
-In general, a machine may have several categories of registers used for
-arguments, each for a particular category of data types. (For example,
-on some machines, floating-point registers are used for floating-point
-arguments while other arguments are passed in the general registers.)
-To make non-varargs functions use the proper calling convention, you
-have defined the @code{CUMULATIVE_ARGS} data type to record how many
-registers in each category have been used so far
-
-@code{__builtin_args_info} accesses the same data structure of type
-@code{CUMULATIVE_ARGS} after the ordinary argument layout is finished
-with it, with @var{category} specifying which word to access. Thus, the
-value indicates the first unused register in a given category.
-
-Normally, you would use @code{__builtin_args_info} in the implementation
-of @code{va_start}, accessing each category just once and storing the
-value in the @code{va_list} object. This is because @code{va_list} will
-have to update the values, and there is no way to alter the
-values accessed by @code{__builtin_args_info}.
-
-@findex __builtin_next_arg
-@item __builtin_next_arg (@var{lastarg})
-This is the equivalent of @code{__builtin_args_info}, for stack
-arguments. It returns the address of the first anonymous stack
-argument, as type @code{void *}. If @code{ARGS_GROW_DOWNWARD}, it
-returns the address of the location above the first anonymous stack
-argument. Use it in @code{va_start} to initialize the pointer for
-fetching arguments from the stack. Also use it in @code{va_start} to
-verify that the second parameter @var{lastarg} is the last named argument
-of the current function.
-
-@findex __builtin_classify_type
-@item __builtin_classify_type (@var{object})
-Since each machine has its own conventions for which data types are
-passed in which kind of register, your implementation of @code{va_arg}
-has to embody these conventions. The easiest way to categorize the
-specified data type is to use @code{__builtin_classify_type} together
-with @code{sizeof} and @code{__alignof__}.
-
-@code{__builtin_classify_type} ignores the value of @var{object},
-considering only its data type. It returns an integer describing what
-kind of type that is---integer, floating, pointer, structure, and so on.
-
-The file @file{typeclass.h} defines an enumeration that you can use to
-interpret the values of @code{__builtin_classify_type}.
-@end table
-
-These machine description macros help implement varargs:
-
-@table @code
-@findex EXPAND_BUILTIN_SAVEREGS
-@item EXPAND_BUILTIN_SAVEREGS (@var{args})
-If defined, is a C expression that produces the machine-specific code
-for a call to @code{__builtin_saveregs}. This code will be moved to the
-very beginning of the function, before any parameter access are made.
-The return value of this function should be an RTX that contains the
-value to use as the return of @code{__builtin_saveregs}.
-
-The argument @var{args} is a @code{tree_list} containing the arguments
-that were passed to @code{__builtin_saveregs}.
-
-If this macro is not defined, the compiler will output an ordinary
-call to the library function @samp{__builtin_saveregs}.
-
-@c !!! a bug in texinfo; how to make the entry on the @item line allow
-@c more than one line of text... help... --mew 10feb93
-@findex SETUP_INCOMING_VARARGS
-@item SETUP_INCOMING_VARARGS (@var{args_so_far}, @var{mode}, @var{type},
-@var{pretend_args_size}, @var{second_time})
-This macro offers an alternative to using @code{__builtin_saveregs} and
-defining the macro @code{EXPAND_BUILTIN_SAVEREGS}. Use it to store the
-anonymous register arguments into the stack so that all the arguments
-appear to have been passed consecutively on the stack. Once this is
-done, you can use the standard implementation of varargs that works for
-machines that pass all their arguments on the stack.
-
-The argument @var{args_so_far} is the @code{CUMULATIVE_ARGS} data
-structure, containing the values that obtain after processing of the
-named arguments. The arguments @var{mode} and @var{type} describe the
-last named argument---its machine mode and its data type as a tree node.
-
-The macro implementation should do two things: first, push onto the
-stack all the argument registers @emph{not} used for the named
-arguments, and second, store the size of the data thus pushed into the
-@code{int}-valued variable whose name is supplied as the argument
-@var{pretend_args_size}. The value that you store here will serve as
-additional offset for setting up the stack frame.
-
-Because you must generate code to push the anonymous arguments at
-compile time without knowing their data types,
-@code{SETUP_INCOMING_VARARGS} is only useful on machines that have just
-a single category of argument register and use it uniformly for all data
-types.
-
-If the argument @var{second_time} is nonzero, it means that the
-arguments of the function are being analyzed for the second time. This
-happens for an inline function, which is not actually compiled until the
-end of the source file. The macro @code{SETUP_INCOMING_VARARGS} should
-not generate any instructions in this case.
-
-@findex STRICT_ARGUMENT_NAMING
-@item STRICT_ARGUMENT_NAMING
-Define this macro if the location where a function argument is passed
-depends on whether or not it is a named argument.
-
-This macro controls how the @var{named} argument to @code{FUNCTION_ARG}
-is set for varargs and stdarg functions. With this macro defined,
-the @var{named} argument is always true for named arguments, and false for
-unnamed arguments. If this is not defined, but @code{SETUP_INCOMING_VARARGS}
-is defined, then all arguments are treated as named. Otherwise, all named
-arguments except the last are treated as named.
-@end table
-
-@node Trampolines
-@section Trampolines for Nested Functions
-@cindex trampolines for nested functions
-@cindex nested functions, trampolines for
-
-A @dfn{trampoline} is a small piece of code that is created at run time
-when the address of a nested function is taken. It normally resides on
-the stack, in the stack frame of the containing function. These macros
-tell GNU CC how to generate code to allocate and initialize a
-trampoline.
-
-The instructions in the trampoline must do two things: load a constant
-address into the static chain register, and jump to the real address of
-the nested function. On CISC machines such as the m68k, this requires
-two instructions, a move immediate and a jump. Then the two addresses
-exist in the trampoline as word-long immediate operands. On RISC
-machines, it is often necessary to load each address into a register in
-two parts. Then pieces of each address form separate immediate
-operands.
-
-The code generated to initialize the trampoline must store the variable
-parts---the static chain value and the function address---into the
-immediate operands of the instructions. On a CISC machine, this is
-simply a matter of copying each address to a memory reference at the
-proper offset from the start of the trampoline. On a RISC machine, it
-may be necessary to take out pieces of the address and store them
-separately.
-
-@table @code
-@findex TRAMPOLINE_TEMPLATE
-@item TRAMPOLINE_TEMPLATE (@var{file})
-A C statement to output, on the stream @var{file}, assembler code for a
-block of data that contains the constant parts of a trampoline. This
-code should not include a label---the label is taken care of
-automatically.
-
-If you do not define this macro, it means no template is needed
-for the target. Do not define this macro on systems where the block move
-code to copy the trampoline into place would be larger than the code
-to generate it on the spot.
-
-@findex TRAMPOLINE_SECTION
-@item TRAMPOLINE_SECTION
-The name of a subroutine to switch to the section in which the
-trampoline template is to be placed (@pxref{Sections}). The default is
-a value of @samp{readonly_data_section}, which places the trampoline in
-the section containing read-only data.
-
-@findex TRAMPOLINE_SIZE
-@item TRAMPOLINE_SIZE
-A C expression for the size in bytes of the trampoline, as an integer.
-
-@findex TRAMPOLINE_ALIGNMENT
-@item TRAMPOLINE_ALIGNMENT
-Alignment required for trampolines, in bits.
-
-If you don't define this macro, the value of @code{BIGGEST_ALIGNMENT}
-is used for aligning trampolines.
-
-@findex INITIALIZE_TRAMPOLINE
-@item INITIALIZE_TRAMPOLINE (@var{addr}, @var{fnaddr}, @var{static_chain})
-A C statement to initialize the variable parts of a trampoline.
-@var{addr} is an RTX for the address of the trampoline; @var{fnaddr} is
-an RTX for the address of the nested function; @var{static_chain} is an
-RTX for the static chain value that should be passed to the function
-when it is called.
-
-@findex ALLOCATE_TRAMPOLINE
-@item ALLOCATE_TRAMPOLINE (@var{fp})
-A C expression to allocate run-time space for a trampoline. The
-expression value should be an RTX representing a memory reference to the
-space for the trampoline.
-
-@cindex @code{FUNCTION_EPILOGUE} and trampolines
-@cindex @code{FUNCTION_PROLOGUE} and trampolines
-If this macro is not defined, by default the trampoline is allocated as
-a stack slot. This default is right for most machines. The exceptions
-are machines where it is impossible to execute instructions in the stack
-area. On such machines, you may have to implement a separate stack,
-using this macro in conjunction with @code{FUNCTION_PROLOGUE} and
-@code{FUNCTION_EPILOGUE}.
-
-@var{fp} points to a data structure, a @code{struct function}, which
-describes the compilation status of the immediate containing function of
-the function which the trampoline is for. Normally (when
-@code{ALLOCATE_TRAMPOLINE} is not defined), the stack slot for the
-trampoline is in the stack frame of this containing function. Other
-allocation strategies probably must do something analogous with this
-information.
-@end table
-
-Implementing trampolines is difficult on many machines because they have
-separate instruction and data caches. Writing into a stack location
-fails to clear the memory in the instruction cache, so when the program
-jumps to that location, it executes the old contents.
-
-Here are two possible solutions. One is to clear the relevant parts of
-the instruction cache whenever a trampoline is set up. The other is to
-make all trampolines identical, by having them jump to a standard
-subroutine. The former technique makes trampoline execution faster; the
-latter makes initialization faster.
-
-To clear the instruction cache when a trampoline is initialized, define
-the following macros which describe the shape of the cache.
-
-@table @code
-@findex INSN_CACHE_SIZE
-@item INSN_CACHE_SIZE
-The total size in bytes of the cache.
-
-@findex INSN_CACHE_LINE_WIDTH
-@item INSN_CACHE_LINE_WIDTH
-The length in bytes of each cache line. The cache is divided into cache
-lines which are disjoint slots, each holding a contiguous chunk of data
-fetched from memory. Each time data is brought into the cache, an
-entire line is read at once. The data loaded into a cache line is
-always aligned on a boundary equal to the line size.
-
-@findex INSN_CACHE_DEPTH
-@item INSN_CACHE_DEPTH
-The number of alternative cache lines that can hold any particular memory
-location.
-@end table
-
-Alternatively, if the machine has system calls or instructions to clear
-the instruction cache directly, you can define the following macro.
-
-@table @code
-@findex CLEAR_INSN_CACHE
-@item CLEAR_INSN_CACHE (@var{BEG}, @var{END})
-If defined, expands to a C expression clearing the @emph{instruction
-cache} in the specified interval. If it is not defined, and the macro
-INSN_CACHE_SIZE is defined, some generic code is generated to clear the
-cache. The definition of this macro would typically be a series of
-@code{asm} statements. Both @var{BEG} and @var{END} are both pointer
-expressions.
-@end table
-
-To use a standard subroutine, define the following macro. In addition,
-you must make sure that the instructions in a trampoline fill an entire
-cache line with identical instructions, or else ensure that the
-beginning of the trampoline code is always aligned at the same point in
-its cache line. Look in @file{m68k.h} as a guide.
-
-@table @code
-@findex TRANSFER_FROM_TRAMPOLINE
-@item TRANSFER_FROM_TRAMPOLINE
-Define this macro if trampolines need a special subroutine to do their
-work. The macro should expand to a series of @code{asm} statements
-which will be compiled with GNU CC. They go in a library function named
-@code{__transfer_from_trampoline}.
-
-If you need to avoid executing the ordinary prologue code of a compiled
-C function when you jump to the subroutine, you can do so by placing a
-special label of your own in the assembler code. Use one @code{asm}
-statement to generate an assembler label, and another to make the label
-global. Then trampolines can use that label to jump directly to your
-special assembler code.
-@end table
-
-@node Library Calls
-@section Implicit Calls to Library Routines
-@cindex library subroutine names
-@cindex @file{libgcc.a}
-
-@c prevent bad page break with this line
-Here is an explanation of implicit calls to library routines.
-
-@table @code
-@findex MULSI3_LIBCALL
-@item MULSI3_LIBCALL
-A C string constant giving the name of the function to call for
-multiplication of one signed full-word by another. If you do not
-define this macro, the default name is used, which is @code{__mulsi3},
-a function defined in @file{libgcc.a}.
-
-@findex DIVSI3_LIBCALL
-@item DIVSI3_LIBCALL
-A C string constant giving the name of the function to call for
-division of one signed full-word by another. If you do not define
-this macro, the default name is used, which is @code{__divsi3}, a
-function defined in @file{libgcc.a}.
-
-@findex UDIVSI3_LIBCALL
-@item UDIVSI3_LIBCALL
-A C string constant giving the name of the function to call for
-division of one unsigned full-word by another. If you do not define
-this macro, the default name is used, which is @code{__udivsi3}, a
-function defined in @file{libgcc.a}.
-
-@findex MODSI3_LIBCALL
-@item MODSI3_LIBCALL
-A C string constant giving the name of the function to call for the
-remainder in division of one signed full-word by another. If you do
-not define this macro, the default name is used, which is
-@code{__modsi3}, a function defined in @file{libgcc.a}.
-
-@findex UMODSI3_LIBCALL
-@item UMODSI3_LIBCALL
-A C string constant giving the name of the function to call for the
-remainder in division of one unsigned full-word by another. If you do
-not define this macro, the default name is used, which is
-@code{__umodsi3}, a function defined in @file{libgcc.a}.
-
-@findex MULDI3_LIBCALL
-@item MULDI3_LIBCALL
-A C string constant giving the name of the function to call for
-multiplication of one signed double-word by another. If you do not
-define this macro, the default name is used, which is @code{__muldi3},
-a function defined in @file{libgcc.a}.
-
-@findex DIVDI3_LIBCALL
-@item DIVDI3_LIBCALL
-A C string constant giving the name of the function to call for
-division of one signed double-word by another. If you do not define
-this macro, the default name is used, which is @code{__divdi3}, a
-function defined in @file{libgcc.a}.
-
-@findex UDIVDI3_LIBCALL
-@item UDIVDI3_LIBCALL
-A C string constant giving the name of the function to call for
-division of one unsigned full-word by another. If you do not define
-this macro, the default name is used, which is @code{__udivdi3}, a
-function defined in @file{libgcc.a}.
-
-@findex MODDI3_LIBCALL
-@item MODDI3_LIBCALL
-A C string constant giving the name of the function to call for the
-remainder in division of one signed double-word by another. If you do
-not define this macro, the default name is used, which is
-@code{__moddi3}, a function defined in @file{libgcc.a}.
-
-@findex UMODDI3_LIBCALL
-@item UMODDI3_LIBCALL
-A C string constant giving the name of the function to call for the
-remainder in division of one unsigned full-word by another. If you do
-not define this macro, the default name is used, which is
-@code{__umoddi3}, a function defined in @file{libgcc.a}.
-
-@findex INIT_TARGET_OPTABS
-@item INIT_TARGET_OPTABS
-Define this macro as a C statement that declares additional library
-routines renames existing ones. @code{init_optabs} calls this macro after
-initializing all the normal library routines.
-
-@findex TARGET_EDOM
-@cindex @code{EDOM}, implicit usage
-@item TARGET_EDOM
-The value of @code{EDOM} on the target machine, as a C integer constant
-expression. If you don't define this macro, GNU CC does not attempt to
-deposit the value of @code{EDOM} into @code{errno} directly. Look in
-@file{/usr/include/errno.h} to find the value of @code{EDOM} on your
-system.
-
-If you do not define @code{TARGET_EDOM}, then compiled code reports
-domain errors by calling the library function and letting it report the
-error. If mathematical functions on your system use @code{matherr} when
-there is an error, then you should leave @code{TARGET_EDOM} undefined so
-that @code{matherr} is used normally.
-
-@findex GEN_ERRNO_RTX
-@cindex @code{errno}, implicit usage
-@item GEN_ERRNO_RTX
-Define this macro as a C expression to create an rtl expression that
-refers to the global ``variable'' @code{errno}. (On certain systems,
-@code{errno} may not actually be a variable.) If you don't define this
-macro, a reasonable default is used.
-
-@findex TARGET_MEM_FUNCTIONS
-@cindex @code{bcopy}, implicit usage
-@cindex @code{memcpy}, implicit usage
-@cindex @code{bzero}, implicit usage
-@cindex @code{memset}, implicit usage
-@item TARGET_MEM_FUNCTIONS
-Define this macro if GNU CC should generate calls to the System V
-(and ANSI C) library functions @code{memcpy} and @code{memset}
-rather than the BSD functions @code{bcopy} and @code{bzero}.
-
-@findex LIBGCC_NEEDS_DOUBLE
-@item LIBGCC_NEEDS_DOUBLE
-Define this macro if only @code{float} arguments cannot be passed to
-library routines (so they must be converted to @code{double}). This
-macro affects both how library calls are generated and how the library
-routines in @file{libgcc1.c} accept their arguments. It is useful on
-machines where floating and fixed point arguments are passed
-differently, such as the i860.
-
-@findex FLOAT_ARG_TYPE
-@item FLOAT_ARG_TYPE
-Define this macro to override the type used by the library routines to
-pick up arguments of type @code{float}. (By default, they use a union
-of @code{float} and @code{int}.)
-
-The obvious choice would be @code{float}---but that won't work with
-traditional C compilers that expect all arguments declared as @code{float}
-to arrive as @code{double}. To avoid this conversion, the library routines
-ask for the value as some other type and then treat it as a @code{float}.
-
-On some systems, no other type will work for this. For these systems,
-you must use @code{LIBGCC_NEEDS_DOUBLE} instead, to force conversion of
-the values @code{double} before they are passed.
-
-@findex FLOATIFY
-@item FLOATIFY (@var{passed-value})
-Define this macro to override the way library routines redesignate a
-@code{float} argument as a @code{float} instead of the type it was
-passed as. The default is an expression which takes the @code{float}
-field of the union.
-
-@findex FLOAT_VALUE_TYPE
-@item FLOAT_VALUE_TYPE
-Define this macro to override the type used by the library routines to
-return values that ought to have type @code{float}. (By default, they
-use @code{int}.)
-
-The obvious choice would be @code{float}---but that won't work with
-traditional C compilers gratuitously convert values declared as
-@code{float} into @code{double}.
-
-@findex INTIFY
-@item INTIFY (@var{float-value})
-Define this macro to override the way the value of a
-@code{float}-returning library routine should be packaged in order to
-return it. These functions are actually declared to return type
-@code{FLOAT_VALUE_TYPE} (normally @code{int}).
-
-These values can't be returned as type @code{float} because traditional
-C compilers would gratuitously convert the value to a @code{double}.
-
-A local variable named @code{intify} is always available when the macro
-@code{INTIFY} is used. It is a union of a @code{float} field named
-@code{f} and a field named @code{i} whose type is
-@code{FLOAT_VALUE_TYPE} or @code{int}.
-
-If you don't define this macro, the default definition works by copying
-the value through that union.
-
-@findex nongcc_SI_type
-@item nongcc_SI_type
-Define this macro as the name of the data type corresponding to
-@code{SImode} in the system's own C compiler.
-
-You need not define this macro if that type is @code{long int}, as it usually
-is.
-
-@findex nongcc_word_type
-@item nongcc_word_type
-Define this macro as the name of the data type corresponding to the
-word_mode in the system's own C compiler.
-
-You need not define this macro if that type is @code{long int}, as it usually
-is.
-
-@findex perform_@dots{}
-@item perform_@dots{}
-Define these macros to supply explicit C statements to carry out various
-arithmetic operations on types @code{float} and @code{double} in the
-library routines in @file{libgcc1.c}. See that file for a full list
-of these macros and their arguments.
-
-On most machines, you don't need to define any of these macros, because
-the C compiler that comes with the system takes care of doing them.
-
-@findex NEXT_OBJC_RUNTIME
-@item NEXT_OBJC_RUNTIME
-Define this macro to generate code for Objective C message sending using
-the calling convention of the NeXT system. This calling convention
-involves passing the object, the selector and the method arguments all
-at once to the method-lookup library function.
-
-The default calling convention passes just the object and the selector
-to the lookup function, which returns a pointer to the method.
-@end table
-
-@node Addressing Modes
-@section Addressing Modes
-@cindex addressing modes
-
-@c prevent bad page break with this line
-This is about addressing modes.
-
-@table @code
-@findex HAVE_POST_INCREMENT
-@item HAVE_POST_INCREMENT
-Define this macro if the machine supports post-increment addressing.
-
-@findex HAVE_PRE_INCREMENT
-@findex HAVE_POST_DECREMENT
-@findex HAVE_PRE_DECREMENT
-@item HAVE_PRE_INCREMENT
-@itemx HAVE_POST_DECREMENT
-@itemx HAVE_PRE_DECREMENT
-Similar for other kinds of addressing.
-
-@findex CONSTANT_ADDRESS_P
-@item CONSTANT_ADDRESS_P (@var{x})
-A C expression that is 1 if the RTX @var{x} is a constant which
-is a valid address. On most machines, this can be defined as
-@code{CONSTANT_P (@var{x})}, but a few machines are more restrictive
-in which constant addresses are supported.
-
-@findex CONSTANT_P
-@code{CONSTANT_P} accepts integer-values expressions whose values are
-not explicitly known, such as @code{symbol_ref}, @code{label_ref}, and
-@code{high} expressions and @code{const} arithmetic expressions, in
-addition to @code{const_int} and @code{const_double} expressions.
-
-@findex MAX_REGS_PER_ADDRESS
-@item MAX_REGS_PER_ADDRESS
-A number, the maximum number of registers that can appear in a valid
-memory address. Note that it is up to you to specify a value equal to
-the maximum number that @code{GO_IF_LEGITIMATE_ADDRESS} would ever
-accept.
-
-@findex GO_IF_LEGITIMATE_ADDRESS
-@item GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})
-A C compound statement with a conditional @code{goto @var{label};}
-executed if @var{x} (an RTX) is a legitimate memory address on the
-target machine for a memory operand of mode @var{mode}.
-
-It usually pays to define several simpler macros to serve as
-subroutines for this one. Otherwise it may be too complicated to
-understand.
-
-This macro must exist in two variants: a strict variant and a
-non-strict one. The strict variant is used in the reload pass. It
-must be defined so that any pseudo-register that has not been
-allocated a hard register is considered a memory reference. In
-contexts where some kind of register is required, a pseudo-register
-with no hard register must be rejected.
-
-The non-strict variant is used in other passes. It must be defined to
-accept all pseudo-registers in every context where some kind of
-register is required.
-
-@findex REG_OK_STRICT
-Compiler source files that want to use the strict variant of this
-macro define the macro @code{REG_OK_STRICT}. You should use an
-@code{#ifdef REG_OK_STRICT} conditional to define the strict variant
-in that case and the non-strict variant otherwise.
-
-Subroutines to check for acceptable registers for various purposes (one
-for base registers, one for index registers, and so on) are typically
-among the subroutines used to define @code{GO_IF_LEGITIMATE_ADDRESS}.
-Then only these subroutine macros need have two variants; the higher
-levels of macros may be the same whether strict or not.@refill
-
-Normally, constant addresses which are the sum of a @code{symbol_ref}
-and an integer are stored inside a @code{const} RTX to mark them as
-constant. Therefore, there is no need to recognize such sums
-specifically as legitimate addresses. Normally you would simply
-recognize any @code{const} as legitimate.
-
-Usually @code{PRINT_OPERAND_ADDRESS} is not prepared to handle constant
-sums that are not marked with @code{const}. It assumes that a naked
-@code{plus} indicates indexing. If so, then you @emph{must} reject such
-naked constant sums as illegitimate addresses, so that none of them will
-be given to @code{PRINT_OPERAND_ADDRESS}.
-
-@cindex @code{ENCODE_SECTION_INFO} and address validation
-On some machines, whether a symbolic address is legitimate depends on
-the section that the address refers to. On these machines, define the
-macro @code{ENCODE_SECTION_INFO} to store the information into the
-@code{symbol_ref}, and then check for it here. When you see a
-@code{const}, you will have to look inside it to find the
-@code{symbol_ref} in order to determine the section. @xref{Assembler
-Format}.
-
-@findex saveable_obstack
-The best way to modify the name string is by adding text to the
-beginning, with suitable punctuation to prevent any ambiguity. Allocate
-the new name in @code{saveable_obstack}. You will have to modify
-@code{ASM_OUTPUT_LABELREF} to remove and decode the added text and
-output the name accordingly, and define @code{STRIP_NAME_ENCODING} to
-access the original name string.
-
-You can check the information stored here into the @code{symbol_ref} in
-the definitions of the macros @code{GO_IF_LEGITIMATE_ADDRESS} and
-@code{PRINT_OPERAND_ADDRESS}.
-
-@findex REG_OK_FOR_BASE_P
-@item REG_OK_FOR_BASE_P (@var{x})
-A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
-RTX) is valid for use as a base register. For hard registers, it
-should always accept those which the hardware permits and reject the
-others. Whether the macro accepts or rejects pseudo registers must be
-controlled by @code{REG_OK_STRICT} as described above. This usually
-requires two variant definitions, of which @code{REG_OK_STRICT}
-controls the one actually used.
-
-@findex REG_OK_FOR_INDEX_P
-@item REG_OK_FOR_INDEX_P (@var{x})
-A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
-RTX) is valid for use as an index register.
-
-The difference between an index register and a base register is that
-the index register may be scaled. If an address involves the sum of
-two registers, neither one of them scaled, then either one may be
-labeled the ``base'' and the other the ``index''; but whichever
-labeling is used must fit the machine's constraints of which registers
-may serve in each capacity. The compiler will try both labelings,
-looking for one that is valid, and will reload one or both registers
-only if neither labeling works.
-
-@findex LEGITIMIZE_ADDRESS
-@item LEGITIMIZE_ADDRESS (@var{x}, @var{oldx}, @var{mode}, @var{win})
-A C compound statement that attempts to replace @var{x} with a valid
-memory address for an operand of mode @var{mode}. @var{win} will be a
-C statement label elsewhere in the code; the macro definition may use
-
-@example
-GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{win});
-@end example
-
-@noindent
-to avoid further processing if the address has become legitimate.
-
-@findex break_out_memory_refs
-@var{x} will always be the result of a call to @code{break_out_memory_refs},
-and @var{oldx} will be the operand that was given to that function to produce
-@var{x}.
-
-The code generated by this macro should not alter the substructure of
-@var{x}. If it transforms @var{x} into a more legitimate form, it
-should assign @var{x} (which will always be a C variable) a new value.
-
-It is not necessary for this macro to come up with a legitimate
-address. The compiler has standard ways of doing so in all cases. In
-fact, it is safe for this macro to do nothing. But often a
-machine-dependent strategy can generate better code.
-
-@findex GO_IF_MODE_DEPENDENT_ADDRESS
-@item GO_IF_MODE_DEPENDENT_ADDRESS (@var{addr}, @var{label})
-A C statement or compound statement with a conditional @code{goto
-@var{label};} executed if memory address @var{x} (an RTX) can have
-different meanings depending on the machine mode of the memory
-reference it is used for or if the address is valid for some modes
-but not others.
-
-Autoincrement and autodecrement addresses typically have mode-dependent
-effects because the amount of the increment or decrement is the size
-of the operand being addressed. Some machines have other mode-dependent
-addresses. Many RISC machines have no mode-dependent addresses.
-
-You may assume that @var{addr} is a valid address for the machine.
-
-@findex LEGITIMATE_CONSTANT_P
-@item LEGITIMATE_CONSTANT_P (@var{x})
-A C expression that is nonzero if @var{x} is a legitimate constant for
-an immediate operand on the target machine. You can assume that
-@var{x} satisfies @code{CONSTANT_P}, so you need not check this. In fact,
-@samp{1} is a suitable definition for this macro on machines where
-anything @code{CONSTANT_P} is valid.@refill
-@end table
-
-@node Condition Code
-@section Condition Code Status
-@cindex condition code status
-
-@c prevent bad page break with this line
-This describes the condition code status.
-
-@findex cc_status
-The file @file{conditions.h} defines a variable @code{cc_status} to
-describe how the condition code was computed (in case the interpretation of
-the condition code depends on the instruction that it was set by). This
-variable contains the RTL expressions on which the condition code is
-currently based, and several standard flags.
-
-Sometimes additional machine-specific flags must be defined in the machine
-description header file. It can also add additional machine-specific
-information by defining @code{CC_STATUS_MDEP}.
-
-@table @code
-@findex CC_STATUS_MDEP
-@item CC_STATUS_MDEP
-C code for a data type which is used for declaring the @code{mdep}
-component of @code{cc_status}. It defaults to @code{int}.
-
-This macro is not used on machines that do not use @code{cc0}.
-
-@findex CC_STATUS_MDEP_INIT
-@item CC_STATUS_MDEP_INIT
-A C expression to initialize the @code{mdep} field to ``empty''.
-The default definition does nothing, since most machines don't use
-the field anyway. If you want to use the field, you should probably
-define this macro to initialize it.
-
-This macro is not used on machines that do not use @code{cc0}.
-
-@findex NOTICE_UPDATE_CC
-@item NOTICE_UPDATE_CC (@var{exp}, @var{insn})
-A C compound statement to set the components of @code{cc_status}
-appropriately for an insn @var{insn} whose body is @var{exp}. It is
-this macro's responsibility to recognize insns that set the condition
-code as a byproduct of other activity as well as those that explicitly
-set @code{(cc0)}.
-
-This macro is not used on machines that do not use @code{cc0}.
-
-If there are insns that do not set the condition code but do alter
-other machine registers, this macro must check to see whether they
-invalidate the expressions that the condition code is recorded as
-reflecting. For example, on the 68000, insns that store in address
-registers do not set the condition code, which means that usually
-@code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for such
-insns. But suppose that the previous insn set the condition code
-based on location @samp{a4@@(102)} and the current insn stores a new
-value in @samp{a4}. Although the condition code is not changed by
-this, it will no longer be true that it reflects the contents of
-@samp{a4@@(102)}. Therefore, @code{NOTICE_UPDATE_CC} must alter
-@code{cc_status} in this case to say that nothing is known about the
-condition code value.
-
-The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal
-with the results of peephole optimization: insns whose patterns are
-@code{parallel} RTXs containing various @code{reg}, @code{mem} or
-constants which are just the operands. The RTL structure of these
-insns is not sufficient to indicate what the insns actually do. What
-@code{NOTICE_UPDATE_CC} should do when it sees one is just to run
-@code{CC_STATUS_INIT}.
-
-A possible definition of @code{NOTICE_UPDATE_CC} is to call a function
-that looks at an attribute (@pxref{Insn Attributes}) named, for example,
-@samp{cc}. This avoids having detailed information about patterns in
-two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.
-
-@findex EXTRA_CC_MODES
-@item EXTRA_CC_MODES
-A list of names to be used for additional modes for condition code
-values in registers (@pxref{Jump Patterns}). These names are added
-to @code{enum machine_mode} and all have class @code{MODE_CC}. By
-convention, they should start with @samp{CC} and end with @samp{mode}.
-
-You should only define this macro if your machine does not use @code{cc0}
-and only if additional modes are required.
-
-@findex EXTRA_CC_NAMES
-@item EXTRA_CC_NAMES
-A list of C strings giving the names for the modes listed in
-@code{EXTRA_CC_MODES}. For example, the Sparc defines this macro and
-@code{EXTRA_CC_MODES} as
-
-@smallexample
-#define EXTRA_CC_MODES CC_NOOVmode, CCFPmode, CCFPEmode
-#define EXTRA_CC_NAMES "CC_NOOV", "CCFP", "CCFPE"
-@end smallexample
-
-This macro is not required if @code{EXTRA_CC_MODES} is not defined.
-
-@findex SELECT_CC_MODE
-@item SELECT_CC_MODE (@var{op}, @var{x}, @var{y})
-Returns a mode from class @code{MODE_CC} to be used when comparison
-operation code @var{op} is applied to rtx @var{x} and @var{y}. For
-example, on the Sparc, @code{SELECT_CC_MODE} is defined as (see
-@pxref{Jump Patterns} for a description of the reason for this
-definition)
-
-@smallexample
-#define SELECT_CC_MODE(OP,X,Y) \
- (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
- : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
- || GET_CODE (X) == NEG) \
- ? CC_NOOVmode : CCmode))
-@end smallexample
-
-You need not define this macro if @code{EXTRA_CC_MODES} is not defined.
-
-@findex CANONICALIZE_COMPARISON
-@item CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1})
-One some machines not all possible comparisons are defined, but you can
-convert an invalid comparison into a valid one. For example, the Alpha
-does not have a @code{GT} comparison, but you can use an @code{LT}
-comparison instead and swap the order of the operands.
-
-On such machines, define this macro to be a C statement to do any
-required conversions. @var{code} is the initial comparison code
-and @var{op0} and @var{op1} are the left and right operands of the
-comparison, respectively. You should modify @var{code}, @var{op0}, and
-@var{op1} as required.
-
-GNU CC will not assume that the comparison resulting from this macro is
-valid but will see if the resulting insn matches a pattern in the
-@file{md} file.
-
-You need not define this macro if it would never change the comparison
-code or operands.
-
-@findex REVERSIBLE_CC_MODE
-@item REVERSIBLE_CC_MODE (@var{mode})
-A C expression whose value is one if it is always safe to reverse a
-comparison whose mode is @var{mode}. If @code{SELECT_CC_MODE}
-can ever return @var{mode} for a floating-point inequality comparison,
-then @code{REVERSIBLE_CC_MODE (@var{mode})} must be zero.
-
-You need not define this macro if it would always returns zero or if the
-floating-point format is anything other than @code{IEEE_FLOAT_FORMAT}.
-For example, here is the definition used on the Sparc, where floating-point
-inequality comparisons are always given @code{CCFPEmode}:
-
-@smallexample
-#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
-@end smallexample
-
-@end table
-
-@node Costs
-@section Describing Relative Costs of Operations
-@cindex costs of instructions
-@cindex relative costs
-@cindex speed of instructions
-
-These macros let you describe the relative speed of various operations
-on the target machine.
-
-@table @code
-@findex CONST_COSTS
-@item CONST_COSTS (@var{x}, @var{code}, @var{outer_code})
-A part of a C @code{switch} statement that describes the relative costs
-of constant RTL expressions. It must contain @code{case} labels for
-expression codes @code{const_int}, @code{const}, @code{symbol_ref},
-@code{label_ref} and @code{const_double}. Each case must ultimately
-reach a @code{return} statement to return the relative cost of the use
-of that kind of constant value in an expression. The cost may depend on
-the precise value of the constant, which is available for examination in
-@var{x}, and the rtx code of the expression in which it is contained,
-found in @var{outer_code}.
-
-@var{code} is the expression code---redundant, since it can be
-obtained with @code{GET_CODE (@var{x})}.
-
-@findex RTX_COSTS
-@findex COSTS_N_INSNS
-@item RTX_COSTS (@var{x}, @var{code}, @var{outer_code})
-Like @code{CONST_COSTS} but applies to nonconstant RTL expressions.
-This can be used, for example, to indicate how costly a multiply
-instruction is. In writing this macro, you can use the construct
-@code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fast
-instructions. @var{outer_code} is the code of the expression in which
-@var{x} is contained.
-
-This macro is optional; do not define it if the default cost assumptions
-are adequate for the target machine.
-
-@findex ADDRESS_COST
-@item ADDRESS_COST (@var{address})
-An expression giving the cost of an addressing mode that contains
-@var{address}. If not defined, the cost is computed from
-the @var{address} expression and the @code{CONST_COSTS} values.
-
-For most CISC machines, the default cost is a good approximation of the
-true cost of the addressing mode. However, on RISC machines, all
-instructions normally have the same length and execution time. Hence
-all addresses will have equal costs.
-
-In cases where more than one form of an address is known, the form with
-the lowest cost will be used. If multiple forms have the same, lowest,
-cost, the one that is the most complex will be used.
-
-For example, suppose an address that is equal to the sum of a register
-and a constant is used twice in the same basic block. When this macro
-is not defined, the address will be computed in a register and memory
-references will be indirect through that register. On machines where
-the cost of the addressing mode containing the sum is no higher than
-that of a simple indirect reference, this will produce an additional
-instruction and possibly require an additional register. Proper
-specification of this macro eliminates this overhead for such machines.
-
-Similar use of this macro is made in strength reduction of loops.
-
-@var{address} need not be valid as an address. In such a case, the cost
-is not relevant and can be any value; invalid addresses need not be
-assigned a different cost.
-
-On machines where an address involving more than one register is as
-cheap as an address computation involving only one register, defining
-@code{ADDRESS_COST} to reflect this can cause two registers to be live
-over a region of code where only one would have been if
-@code{ADDRESS_COST} were not defined in that manner. This effect should
-be considered in the definition of this macro. Equivalent costs should
-probably only be given to addresses with different numbers of registers
-on machines with lots of registers.
-
-This macro will normally either not be defined or be defined as a
-constant.
-
-@findex REGISTER_MOVE_COST
-@item REGISTER_MOVE_COST (@var{from}, @var{to})
-A C expression for the cost of moving data from a register in class
-@var{from} to one in class @var{to}. The classes are expressed using
-the enumeration values such as @code{GENERAL_REGS}. A value of 2 is the
-default; other values are interpreted relative to that.
-
-It is not required that the cost always equal 2 when @var{from} is the
-same as @var{to}; on some machines it is expensive to move between
-registers if they are not general registers.
-
-If reload sees an insn consisting of a single @code{set} between two
-hard registers, and if @code{REGISTER_MOVE_COST} applied to their
-classes returns a value of 2, reload does not check to ensure that the
-constraints of the insn are met. Setting a cost of other than 2 will
-allow reload to verify that the constraints are met. You should do this
-if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
-
-@findex MEMORY_MOVE_COST
-@item MEMORY_MOVE_COST (@var{m})
-A C expression for the cost of moving data of mode @var{m} between a
-register and memory. A value of 4 is the default; this cost is relative
-to those in @code{REGISTER_MOVE_COST}.
-
-If moving between registers and memory is more expensive than between
-two registers, you should define this macro to express the relative cost.
-
-@findex BRANCH_COST
-@item BRANCH_COST
-A C expression for the cost of a branch instruction. A value of 1 is
-the default; other values are interpreted relative to that.
-@end table
-
-Here are additional macros which do not specify precise relative costs,
-but only that certain actions are more expensive than GNU CC would
-ordinarily expect.
-
-@table @code
-@findex SLOW_BYTE_ACCESS
-@item SLOW_BYTE_ACCESS
-Define this macro as a C expression which is nonzero if accessing less
-than a word of memory (i.e. a @code{char} or a @code{short}) is no
-faster than accessing a word of memory, i.e., if such access
-require more than one instruction or if there is no difference in cost
-between byte and (aligned) word loads.
-
-When this macro is not defined, the compiler will access a field by
-finding the smallest containing object; when it is defined, a fullword
-load will be used if alignment permits. Unless bytes accesses are
-faster than word accesses, using word accesses is preferable since it
-may eliminate subsequent memory access if subsequent accesses occur to
-other fields in the same word of the structure, but to different bytes.
-
-@findex SLOW_ZERO_EXTEND
-@item SLOW_ZERO_EXTEND
-Define this macro if zero-extension (of a @code{char} or @code{short}
-to an @code{int}) can be done faster if the destination is a register
-that is known to be zero.
-
-If you define this macro, you must have instruction patterns that
-recognize RTL structures like this:
-
-@smallexample
-(set (strict_low_part (subreg:QI (reg:SI @dots{}) 0)) @dots{})
-@end smallexample
-
-@noindent
-and likewise for @code{HImode}.
-
-@findex SLOW_UNALIGNED_ACCESS
-@item SLOW_UNALIGNED_ACCESS
-Define this macro to be the value 1 if unaligned accesses have a cost
-many times greater than aligned accesses, for example if they are
-emulated in a trap handler.
-
-When this macro is non-zero, the compiler will act as if
-@code{STRICT_ALIGNMENT} were non-zero when generating code for block
-moves. This can cause significantly more instructions to be produced.
-Therefore, do not set this macro non-zero if unaligned accesses only add a
-cycle or two to the time for a memory access.
-
-If the value of this macro is always zero, it need not be defined.
-
-@findex DONT_REDUCE_ADDR
-@item DONT_REDUCE_ADDR
-Define this macro to inhibit strength reduction of memory addresses.
-(On some machines, such strength reduction seems to do harm rather
-than good.)
-
-@findex MOVE_RATIO
-@item MOVE_RATIO
-The number of scalar move insns which should be generated instead of a
-string move insn or a library call. Increasing the value will always
-make code faster, but eventually incurs high cost in increased code size.
-
-If you don't define this, a reasonable default is used.
-
-@findex NO_FUNCTION_CSE
-@item NO_FUNCTION_CSE
-Define this macro if it is as good or better to call a constant
-function address than to call an address kept in a register.
-
-@findex NO_RECURSIVE_FUNCTION_CSE
-@item NO_RECURSIVE_FUNCTION_CSE
-Define this macro if it is as good or better for a function to call
-itself with an explicit address than to call an address kept in a
-register.
-
-@findex ADJUST_COST
-@item ADJUST_COST (@var{insn}, @var{link}, @var{dep_insn}, @var{cost})
-A C statement (sans semicolon) to update the integer variable @var{cost}
-based on the relationship between @var{insn} that is dependent on
-@var{dep_insn} through the dependence @var{link}. The default is to
-make no adjustment to @var{cost}. This can be used for example to
-specify to the scheduler that an output- or anti-dependence does not
-incur the same cost as a data-dependence.
-
-@findex ADJUST_PRIORITY
-@item ADJUST_PRIORITY (@var{insn})
-A C statement (sans semicolon) to update the integer scheduling
-priority @code{INSN_PRIORITY(@var{insn})}. Reduce the priority
-to execute the @var{insn} earlier, increase the priority to execute
-@var{insn} later. Do not define this macro if you do not need to
-adjust the scheduling priorities of insns.
-@end table
-
-@node Sections
-@section Dividing the Output into Sections (Texts, Data, @dots{})
-@c the above section title is WAY too long. maybe cut the part between
-@c the (...)? --mew 10feb93
-
-An object file is divided into sections containing different types of
-data. In the most common case, there are three sections: the @dfn{text
-section}, which holds instructions and read-only data; the @dfn{data
-section}, which holds initialized writable data; and the @dfn{bss
-section}, which holds uninitialized data. Some systems have other kinds
-of sections.
-
-The compiler must tell the assembler when to switch sections. These
-macros control what commands to output to tell the assembler this. You
-can also define additional sections.
-
-@table @code
-@findex TEXT_SECTION_ASM_OP
-@item TEXT_SECTION_ASM_OP
-A C expression whose value is a string containing the assembler
-operation that should precede instructions and read-only data. Normally
-@code{".text"} is right.
-
-@findex DATA_SECTION_ASM_OP
-@item DATA_SECTION_ASM_OP
-A C expression whose value is a string containing the assembler
-operation to identify the following data as writable initialized data.
-Normally @code{".data"} is right.
-
-@findex SHARED_SECTION_ASM_OP
-@item SHARED_SECTION_ASM_OP
-If defined, a C expression whose value is a string containing the
-assembler operation to identify the following data as shared data. If
-not defined, @code{DATA_SECTION_ASM_OP} will be used.
-
-@findex BSS_SECTION_ASM_OP
-@item BSS_SECTION_ASM_OP
-If defined, a C expression whose value is a string containing the
-assembler operation to identify the following data as uninitialized global
-data. If not defined, and neither @code{ASM_OUTPUT_BSS} nor
-@code{ASM_OUTPUT_ALIGNED_BSS} are defined, uninitialized global data will be
-output in the data section if @samp{-fno-common} is passed, otherwise
-@code{ASM_OUTPUT_COMMON} will be used.
-
-@findex SHARED_BSS_SECTION_ASM_OP
-@item SHARED_BSS_SECTION_ASM_OP
-If defined, a C expression whose value is a string containing the
-assembler operation to identify the following data as uninitialized global
-shared data. If not defined, and @code{BSS_SECTION_ASM_OP} is, the latter
-will be used.
-
-@findex INIT_SECTION_ASM_OP
-@item INIT_SECTION_ASM_OP
-If defined, a C expression whose value is a string containing the
-assembler operation to identify the following data as initialization
-code. If not defined, GNU CC will assume such a section does not
-exist.
-
-@findex EXTRA_SECTIONS
-@findex in_text
-@findex in_data
-@item EXTRA_SECTIONS
-A list of names for sections other than the standard two, which are
-@code{in_text} and @code{in_data}. You need not define this macro
-on a system with no other sections (that GCC needs to use).
-
-@findex EXTRA_SECTION_FUNCTIONS
-@findex text_section
-@findex data_section
-@item EXTRA_SECTION_FUNCTIONS
-One or more functions to be defined in @file{varasm.c}. These
-functions should do jobs analogous to those of @code{text_section} and
-@code{data_section}, for your additional sections. Do not define this
-macro if you do not define @code{EXTRA_SECTIONS}.
-
-@findex READONLY_DATA_SECTION
-@item READONLY_DATA_SECTION
-On most machines, read-only variables, constants, and jump tables are
-placed in the text section. If this is not the case on your machine,
-this macro should be defined to be the name of a function (either
-@code{data_section} or a function defined in @code{EXTRA_SECTIONS}) that
-switches to the section to be used for read-only items.
-
-If these items should be placed in the text section, this macro should
-not be defined.
-
-@findex SELECT_SECTION
-@item SELECT_SECTION (@var{exp}, @var{reloc})
-A C statement or statements to switch to the appropriate section for
-output of @var{exp}. You can assume that @var{exp} is either a
-@code{VAR_DECL} node or a constant of some sort. @var{reloc}
-indicates whether the initial value of @var{exp} requires link-time
-relocations. Select the section by calling @code{text_section} or one
-of the alternatives for other sections.
-
-Do not define this macro if you put all read-only variables and
-constants in the read-only data section (usually the text section).
-
-@findex SELECT_RTX_SECTION
-@item SELECT_RTX_SECTION (@var{mode}, @var{rtx})
-A C statement or statements to switch to the appropriate section for
-output of @var{rtx} in mode @var{mode}. You can assume that @var{rtx}
-is some kind of constant in RTL. The argument @var{mode} is redundant
-except in the case of a @code{const_int} rtx. Select the section by
-calling @code{text_section} or one of the alternatives for other
-sections.
-
-Do not define this macro if you put all constants in the read-only
-data section.
-
-@findex JUMP_TABLES_IN_TEXT_SECTION
-@item JUMP_TABLES_IN_TEXT_SECTION
-Define this macro if jump tables (for @code{tablejump} insns) should be
-output in the text section, along with the assembler instructions.
-Otherwise, the readonly data section is used.
-
-This macro is irrelevant if there is no separate readonly data section.
-
-@findex ENCODE_SECTION_INFO
-@item ENCODE_SECTION_INFO (@var{decl})
-Define this macro if references to a symbol must be treated differently
-depending on something about the variable or function named by the
-symbol (such as what section it is in).
-
-The macro definition, if any, is executed immediately after the rtl for
-@var{decl} has been created and stored in @code{DECL_RTL (@var{decl})}.
-The value of the rtl will be a @code{mem} whose address is a
-@code{symbol_ref}.
-
-@cindex @code{SYMBOL_REF_FLAG}, in @code{ENCODE_SECTION_INFO}
-The usual thing for this macro to do is to record a flag in the
-@code{symbol_ref} (such as @code{SYMBOL_REF_FLAG}) or to store a
-modified name string in the @code{symbol_ref} (if one bit is not enough
-information).
-
-@findex STRIP_NAME_ENCODING
-@item STRIP_NAME_ENCODING (@var{var}, @var{sym_name})
-Decode @var{sym_name} and store the real name part in @var{var}, sans
-the characters that encode section info. Define this macro if
-@code{ENCODE_SECTION_INFO} alters the symbol's name string.
-
-@findex UNIQUE_SECTION
-@item UNIQUE_SECTION (@var{decl})
-For objects going into their own sections, a C expression of the name of the
-section, expressed as a STRING_CST node, to put @var{decl} into. The
-STRING_CST node must be allocated in the saveable obstack. Function
-@code{build_string} can be used to do this. If you do not define this macro,
-GNU CC will use the symbol name as the section name.
-@end table
-
-@node PIC
-@section Position Independent Code
-@cindex position independent code
-@cindex PIC
-
-This section describes macros that help implement generation of position
-independent code. Simply defining these macros is not enough to
-generate valid PIC; you must also add support to the macros
-@code{GO_IF_LEGITIMATE_ADDRESS} and @code{PRINT_OPERAND_ADDRESS}, as
-well as @code{LEGITIMIZE_ADDRESS}. You must modify the definition of
-@samp{movsi} to do something appropriate when the source operand
-contains a symbolic address. You may also need to alter the handling of
-switch statements so that they use relative addresses.
-@c i rearranged the order of the macros above to try to force one of
-@c them to the next line, to eliminate an overfull hbox. --mew 10feb93
-
-@table @code
-@findex PIC_OFFSET_TABLE_REGNUM
-@item PIC_OFFSET_TABLE_REGNUM
-The register number of the register used to address a table of static
-data addresses in memory. In some cases this register is defined by a
-processor's ``application binary interface'' (ABI). When this macro
-is defined, RTL is generated for this register once, as with the stack
-pointer and frame pointer registers. If this macro is not defined, it
-is up to the machine-dependent files to allocate such a register (if
-necessary).
-
-@findex PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
-@item PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
-Define this macro if the register defined by
-@code{PIC_OFFSET_TABLE_REGNUM} is clobbered by calls. Do not define
-this macro if @code{PPIC_OFFSET_TABLE_REGNUM} is not defined.
-
-@findex FINALIZE_PIC
-@item FINALIZE_PIC
-By generating position-independent code, when two different programs (A
-and B) share a common library (libC.a), the text of the library can be
-shared whether or not the library is linked at the same address for both
-programs. In some of these environments, position-independent code
-requires not only the use of different addressing modes, but also
-special code to enable the use of these addressing modes.
-
-The @code{FINALIZE_PIC} macro serves as a hook to emit these special
-codes once the function is being compiled into assembly code, but not
-before. (It is not done before, because in the case of compiling an
-inline function, it would lead to multiple PIC prologues being
-included in functions which used inline functions and were compiled to
-assembly language.)
-
-@findex LEGITIMATE_PIC_OPERAND_P
-@item LEGITIMATE_PIC_OPERAND_P (@var{x})
-A C expression that is nonzero if @var{x} is a legitimate immediate
-operand on the target machine when generating position independent code.
-You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not
-check this. You can also assume @var{flag_pic} is true, so you need not
-check it either. You need not define this macro if all constants
-(including @code{SYMBOL_REF}) can be immediate operands when generating
-position independent code.
-@end table
-
-@node Assembler Format
-@section Defining the Output Assembler Language
-
-This section describes macros whose principal purpose is to describe how
-to write instructions in assembler language--rather than what the
-instructions do.
-
-@menu
-* File Framework:: Structural information for the assembler file.
-* Data Output:: Output of constants (numbers, strings, addresses).
-* Uninitialized Data:: Output of uninitialized variables.
-* Label Output:: Output and generation of labels.
-* Initialization:: General principles of initialization
- and termination routines.
-* Macros for Initialization::
- Specific macros that control the handling of
- initialization and termination routines.
-* Instruction Output:: Output of actual instructions.
-* Dispatch Tables:: Output of jump tables.
-* Exception Region Output:: Output of exception region code.
-* Alignment Output:: Pseudo ops for alignment and skipping data.
-@end menu
-
-@node File Framework
-@subsection The Overall Framework of an Assembler File
-@cindex assembler format
-@cindex output of assembler code
-
-@c prevent bad page break with this line
-This describes the overall framework of an assembler file.
-
-@table @code
-@findex ASM_FILE_START
-@item ASM_FILE_START (@var{stream})
-A C expression which outputs to the stdio stream @var{stream}
-some appropriate text to go at the start of an assembler file.
-
-Normally this macro is defined to output a line containing
-@samp{#NO_APP}, which is a comment that has no effect on most
-assemblers but tells the GNU assembler that it can save time by not
-checking for certain assembler constructs.
-
-On systems that use SDB, it is necessary to output certain commands;
-see @file{attasm.h}.
-
-@findex ASM_FILE_END
-@item ASM_FILE_END (@var{stream})
-A C expression which outputs to the stdio stream @var{stream}
-some appropriate text to go at the end of an assembler file.
-
-If this macro is not defined, the default is to output nothing
-special at the end of the file. Most systems don't require any
-definition.
-
-On systems that use SDB, it is necessary to output certain commands;
-see @file{attasm.h}.
-
-@findex ASM_IDENTIFY_GCC
-@item ASM_IDENTIFY_GCC (@var{file})
-A C statement to output assembler commands which will identify
-the object file as having been compiled with GNU CC (or another
-GNU compiler).
-
-If you don't define this macro, the string @samp{gcc_compiled.:}
-is output. This string is calculated to define a symbol which,
-on BSD systems, will never be defined for any other reason.
-GDB checks for the presence of this symbol when reading the
-symbol table of an executable.
-
-On non-BSD systems, you must arrange communication with GDB in
-some other fashion. If GDB is not used on your system, you can
-define this macro with an empty body.
-
-@findex ASM_COMMENT_START
-@item ASM_COMMENT_START
-A C string constant describing how to begin a comment in the target
-assembler language. The compiler assumes that the comment will end at
-the end of the line.
-
-@findex ASM_APP_ON
-@item ASM_APP_ON
-A C string constant for text to be output before each @code{asm}
-statement or group of consecutive ones. Normally this is
-@code{"#APP"}, which is a comment that has no effect on most
-assemblers but tells the GNU assembler that it must check the lines
-that follow for all valid assembler constructs.
-
-@findex ASM_APP_OFF
-@item ASM_APP_OFF
-A C string constant for text to be output after each @code{asm}
-statement or group of consecutive ones. Normally this is
-@code{"#NO_APP"}, which tells the GNU assembler to resume making the
-time-saving assumptions that are valid for ordinary compiler output.
-
-@findex ASM_OUTPUT_SOURCE_FILENAME
-@item ASM_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
-A C statement to output COFF information or DWARF debugging information
-which indicates that filename @var{name} is the current source file to
-the stdio stream @var{stream}.
-
-This macro need not be defined if the standard form of output
-for the file format in use is appropriate.
-
-@findex ASM_OUTPUT_SOURCE_LINE
-@item ASM_OUTPUT_SOURCE_LINE (@var{stream}, @var{line})
-A C statement to output DBX or SDB debugging information before code
-for line number @var{line} of the current source file to the
-stdio stream @var{stream}.
-
-This macro need not be defined if the standard form of debugging
-information for the debugger in use is appropriate.
-
-@findex ASM_OUTPUT_IDENT
-@item ASM_OUTPUT_IDENT (@var{stream}, @var{string})
-A C statement to output something to the assembler file to handle a
-@samp{#ident} directive containing the text @var{string}. If this
-macro is not defined, nothing is output for a @samp{#ident} directive.
-
-@findex ASM_OUTPUT_SECTION_NAME
-@item ASM_OUTPUT_SECTION_NAME (@var{stream}, @var{decl}, @var{name})
-A C statement to output something to the assembler file to switch to section
-@var{name} for object @var{decl} which is either a @code{FUNCTION_DECL}, a
-@code{VAR_DECL} or @code{NULL_TREE}. Some target formats do not support
-arbitrary sections. Do not define this macro in such cases.
-
-At present this macro is only used to support section attributes.
-When this macro is undefined, section attributes are disabled.
-
-@findex OBJC_PROLOGUE
-@item OBJC_PROLOGUE
-A C statement to output any assembler statements which are required to
-precede any Objective C object definitions or message sending. The
-statement is executed only when compiling an Objective C program.
-@end table
-
-@need 2000
-@node Data Output
-@subsection Output of Data
-
-@c prevent bad page break with this line
-This describes data output.
-
-@table @code
-@findex ASM_OUTPUT_LONG_DOUBLE
-@findex ASM_OUTPUT_DOUBLE
-@findex ASM_OUTPUT_FLOAT
-@item ASM_OUTPUT_LONG_DOUBLE (@var{stream}, @var{value})
-@itemx ASM_OUTPUT_DOUBLE (@var{stream}, @var{value})
-@itemx ASM_OUTPUT_FLOAT (@var{stream}, @var{value})
-@itemx ASM_OUTPUT_THREE_QUARTER_FLOAT (@var{stream}, @var{value})
-@itemx ASM_OUTPUT_SHORT_FLOAT (@var{stream}, @var{value})
-@itemx ASM_OUTPUT_BYTE_FLOAT (@var{stream}, @var{value})
-A C statement to output to the stdio stream @var{stream} an assembler
-instruction to assemble a floating-point constant of @code{TFmode},
-@code{DFmode}, @code{SFmode}, @code{TQFmode}, @code{HFmode}, or
-@code{QFmode}, respectively, whose value is @var{value}. @var{value}
-will be a C expression of type @code{REAL_VALUE_TYPE}. Macros such as
-@code{REAL_VALUE_TO_TARGET_DOUBLE} are useful for writing these
-definitions.
-
-@findex ASM_OUTPUT_QUADRUPLE_INT
-@findex ASM_OUTPUT_DOUBLE_INT
-@findex ASM_OUTPUT_INT
-@findex ASM_OUTPUT_SHORT
-@findex ASM_OUTPUT_CHAR
-@findex output_addr_const
-@item ASM_OUTPUT_QUADRUPLE_INT (@var{stream}, @var{exp})
-@itemx ASM_OUTPUT_DOUBLE_INT (@var{stream}, @var{exp})
-@itemx ASM_OUTPUT_INT (@var{stream}, @var{exp})
-@itemx ASM_OUTPUT_SHORT (@var{stream}, @var{exp})
-@itemx ASM_OUTPUT_CHAR (@var{stream}, @var{exp})
-A C statement to output to the stdio stream @var{stream} an assembler
-instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes,
-respectively, whose value is @var{value}. The argument @var{exp} will
-be an RTL expression which represents a constant value. Use
-@samp{output_addr_const (@var{stream}, @var{exp})} to output this value
-as an assembler expression.@refill
-
-For sizes larger than @code{UNITS_PER_WORD}, if the action of a macro
-would be identical to repeatedly calling the macro corresponding to
-a size of @code{UNITS_PER_WORD}, once for each word, you need not define
-the macro.
-
-@findex ASM_OUTPUT_BYTE
-@item ASM_OUTPUT_BYTE (@var{stream}, @var{value})
-A C statement to output to the stdio stream @var{stream} an assembler
-instruction to assemble a single byte containing the number @var{value}.
-
-@findex ASM_BYTE_OP
-@item ASM_BYTE_OP
-A C string constant giving the pseudo-op to use for a sequence of
-single-byte constants. If this macro is not defined, the default is
-@code{"byte"}.
-
-@findex ASM_OUTPUT_ASCII
-@item ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len})
-A C statement to output to the stdio stream @var{stream} an assembler
-instruction to assemble a string constant containing the @var{len}
-bytes at @var{ptr}. @var{ptr} will be a C expression of type
-@code{char *} and @var{len} a C expression of type @code{int}.
-
-If the assembler has a @code{.ascii} pseudo-op as found in the
-Berkeley Unix assembler, do not define the macro
-@code{ASM_OUTPUT_ASCII}.
-
-@findex ASM_OUTPUT_POOL_PROLOGUE
-@item ASM_OUTPUT_POOL_PROLOGUE (@var{file} @var{funname} @var{fundecl} @var{size})
-A C statement to output assembler commands to define the start of the
-constant pool for a function. @var{funname} is a string giving
-the name of the function. Should the return type of the function
-be required, it can be obtained via @var{fundecl}. @var{size}
-is the size, in bytes, of the constant pool that will be written
-immediately after this call.
-
-If no constant-pool prefix is required, the usual case, this macro need
-not be defined.
-
-@findex ASM_OUTPUT_SPECIAL_POOL_ENTRY
-@item ASM_OUTPUT_SPECIAL_POOL_ENTRY (@var{file}, @var{x}, @var{mode}, @var{align}, @var{labelno}, @var{jumpto})
-A C statement (with or without semicolon) to output a constant in the
-constant pool, if it needs special treatment. (This macro need not do
-anything for RTL expressions that can be output normally.)
-
-The argument @var{file} is the standard I/O stream to output the
-assembler code on. @var{x} is the RTL expression for the constant to
-output, and @var{mode} is the machine mode (in case @var{x} is a
-@samp{const_int}). @var{align} is the required alignment for the value
-@var{x}; you should output an assembler directive to force this much
-alignment.
-
-The argument @var{labelno} is a number to use in an internal label for
-the address of this pool entry. The definition of this macro is
-responsible for outputting the label definition at the proper place.
-Here is how to do this:
-
-@example
-ASM_OUTPUT_INTERNAL_LABEL (@var{file}, "LC", @var{labelno});
-@end example
-
-When you output a pool entry specially, you should end with a
-@code{goto} to the label @var{jumpto}. This will prevent the same pool
-entry from being output a second time in the usual manner.
-
-You need not define this macro if it would do nothing.
-
-@findex IS_ASM_LOGICAL_LINE_SEPARATOR
-@item IS_ASM_LOGICAL_LINE_SEPARATOR (@var{C})
-Define this macro as a C expression which is nonzero if @var{C} is
-used as a logical line separator by the assembler.
-
-If you do not define this macro, the default is that only
-the character @samp{;} is treated as a logical line separator.
-
-
-@findex ASM_OPEN_PAREN
-@findex ASM_CLOSE_PAREN
-@item ASM_OPEN_PAREN
-@itemx ASM_CLOSE_PAREN
-These macros are defined as C string constant, describing the syntax
-in the assembler for grouping arithmetic expressions. The following
-definitions are correct for most assemblers:
-
-@example
-#define ASM_OPEN_PAREN "("
-#define ASM_CLOSE_PAREN ")"
-@end example
-@end table
-
- These macros are provided by @file{real.h} for writing the definitions
-of @code{ASM_OUTPUT_DOUBLE} and the like:
-
-@table @code
-@item REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l})
-@itemx REAL_VALUE_TO_TARGET_DOUBLE (@var{x}, @var{l})
-@itemx REAL_VALUE_TO_TARGET_LONG_DOUBLE (@var{x}, @var{l})
-@findex REAL_VALUE_TO_TARGET_SINGLE
-@findex REAL_VALUE_TO_TARGET_DOUBLE
-@findex REAL_VALUE_TO_TARGET_LONG_DOUBLE
-These translate @var{x}, of type @code{REAL_VALUE_TYPE}, to the target's
-floating point representation, and store its bit pattern in the array of
-@code{long int} whose address is @var{l}. The number of elements in the
-output array is determined by the size of the desired target floating
-point data type: 32 bits of it go in each @code{long int} array
-element. Each array element holds 32 bits of the result, even if
-@code{long int} is wider than 32 bits on the host machine.
-
-The array element values are designed so that you can print them out
-using @code{fprintf} in the order they should appear in the target
-machine's memory.
-
-@item REAL_VALUE_TO_DECIMAL (@var{x}, @var{format}, @var{string})
-@findex REAL_VALUE_TO_DECIMAL
-This macro converts @var{x}, of type @code{REAL_VALUE_TYPE}, to a
-decimal number and stores it as a string into @var{string}.
-You must pass, as @var{string}, the address of a long enough block
-of space to hold the result.
-
-The argument @var{format} is a @code{printf}-specification that serves
-as a suggestion for how to format the output string.
-@end table
-
-@node Uninitialized Data
-@subsection Output of Uninitialized Variables
-
-Each of the macros in this section is used to do the whole job of
-outputting a single uninitialized variable.
-
-@table @code
-@findex ASM_OUTPUT_COMMON
-@item ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} the assembler definition of a common-label named
-@var{name} whose size is @var{size} bytes. The variable @var{rounded}
-is the size rounded up to whatever alignment the caller wants.
-
-Use the expression @code{assemble_name (@var{stream}, @var{name})} to
-output the name itself; before and after that, output the additional
-assembler syntax for defining the name, and a newline.
-
-This macro controls how the assembler definitions of uninitialized
-common global variables are output.
-
-@findex ASM_OUTPUT_ALIGNED_COMMON
-@item ASM_OUTPUT_ALIGNED_COMMON (@var{stream}, @var{name}, @var{size}, @var{alignment})
-Like @code{ASM_OUTPUT_COMMON} except takes the required alignment as a
-separate, explicit argument. If you define this macro, it is used in
-place of @code{ASM_OUTPUT_COMMON}, and gives you more flexibility in
-handling the required alignment of the variable. The alignment is specified
-as the number of bits.
-
-@findex ASM_OUTPUT_SHARED_COMMON
-@item ASM_OUTPUT_SHARED_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
-If defined, it is similar to @code{ASM_OUTPUT_COMMON}, except that it
-is used when @var{name} is shared. If not defined, @code{ASM_OUTPUT_COMMON}
-will be used.
-
-@findex ASM_OUTPUT_BSS
-@item ASM_OUTPUT_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{rounded})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} the assembler definition of uninitialized global @var{decl} named
-@var{name} whose size is @var{size} bytes. The variable @var{rounded}
-is the size rounded up to whatever alignment the caller wants.
-
-Try to use function @code{asm_output_bss} defined in @file{varasm.c} when
-defining this macro. If unable, use the expression
-@code{assemble_name (@var{stream}, @var{name})} to output the name itself;
-before and after that, output the additional assembler syntax for defining
-the name, and a newline.
-
-This macro controls how the assembler definitions of uninitialized global
-variables are output. This macro exists to properly support languages like
-@code{c++} which do not have @code{common} data. However, this macro currently
-is not defined for all targets. If this macro and
-@code{ASM_OUTPUT_ALIGNED_BSS} are not defined then @code{ASM_OUTPUT_COMMON}
-or @code{ASM_OUTPUT_ALIGNED_COMMON} is used.
-
-@findex ASM_OUTPUT_ALIGNED_BSS
-@item ASM_OUTPUT_ALIGNED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
-Like @code{ASM_OUTPUT_BSS} except takes the required alignment as a
-separate, explicit argument. If you define this macro, it is used in
-place of @code{ASM_OUTPUT_BSS}, and gives you more flexibility in
-handling the required alignment of the variable. The alignment is specified
-as the number of bits.
-
-Try to use function @code{asm_output_aligned_bss} defined in file
-@file{varasm.c} when defining this macro.
-
-@findex ASM_OUTPUT_SHARED_BSS
-@item ASM_OUTPUT_SHARED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{rounded})
-If defined, it is similar to @code{ASM_OUTPUT_BSS}, except that it
-is used when @var{name} is shared. If not defined, @code{ASM_OUTPUT_BSS}
-will be used.
-
-@findex ASM_OUTPUT_LOCAL
-@item ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} the assembler definition of a local-common-label named
-@var{name} whose size is @var{size} bytes. The variable @var{rounded}
-is the size rounded up to whatever alignment the caller wants.
-
-Use the expression @code{assemble_name (@var{stream}, @var{name})} to
-output the name itself; before and after that, output the additional
-assembler syntax for defining the name, and a newline.
-
-This macro controls how the assembler definitions of uninitialized
-static variables are output.
-
-@findex ASM_OUTPUT_ALIGNED_LOCAL
-@item ASM_OUTPUT_ALIGNED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{alignment})
-Like @code{ASM_OUTPUT_LOCAL} except takes the required alignment as a
-separate, explicit argument. If you define this macro, it is used in
-place of @code{ASM_OUTPUT_LOCAL}, and gives you more flexibility in
-handling the required alignment of the variable. The alignment is specified
-as the number of bits.
-
-@findex ASM_OUTPUT_SHARED_LOCAL
-@item ASM_OUTPUT_SHARED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
-If defined, it is similar to @code{ASM_OUTPUT_LOCAL}, except that it
-is used when @var{name} is shared. If not defined, @code{ASM_OUTPUT_LOCAL}
-will be used.
-@end table
-
-@node Label Output
-@subsection Output and Generation of Labels
-
-@c prevent bad page break with this line
-This is about outputting labels.
-
-@table @code
-@findex ASM_OUTPUT_LABEL
-@findex assemble_name
-@item ASM_OUTPUT_LABEL (@var{stream}, @var{name})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} the assembler definition of a label named @var{name}.
-Use the expression @code{assemble_name (@var{stream}, @var{name})} to
-output the name itself; before and after that, output the additional
-assembler syntax for defining the name, and a newline.
-
-@findex ASM_DECLARE_FUNCTION_NAME
-@item ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} any text necessary for declaring the name @var{name} of a
-function which is being defined. This macro is responsible for
-outputting the label definition (perhaps using
-@code{ASM_OUTPUT_LABEL}). The argument @var{decl} is the
-@code{FUNCTION_DECL} tree node representing the function.
-
-If this macro is not defined, then the function name is defined in the
-usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
-
-@findex ASM_DECLARE_FUNCTION_SIZE
-@item ASM_DECLARE_FUNCTION_SIZE (@var{stream}, @var{name}, @var{decl})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} any text necessary for declaring the size of a function
-which is being defined. The argument @var{name} is the name of the
-function. The argument @var{decl} is the @code{FUNCTION_DECL} tree node
-representing the function.
-
-If this macro is not defined, then the function size is not defined.
-
-@findex ASM_DECLARE_OBJECT_NAME
-@item ASM_DECLARE_OBJECT_NAME (@var{stream}, @var{name}, @var{decl})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} any text necessary for declaring the name @var{name} of an
-initialized variable which is being defined. This macro must output the
-label definition (perhaps using @code{ASM_OUTPUT_LABEL}). The argument
-@var{decl} is the @code{VAR_DECL} tree node representing the variable.
-
-If this macro is not defined, then the variable name is defined in the
-usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
-
-@findex ASM_FINISH_DECLARE_OBJECT
-@item ASM_FINISH_DECLARE_OBJECT (@var{stream}, @var{decl}, @var{toplevel}, @var{atend})
-A C statement (sans semicolon) to finish up declaring a variable name
-once the compiler has processed its initializer fully and thus has had a
-chance to determine the size of an array when controlled by an
-initializer. This is used on systems where it's necessary to declare
-something about the size of the object.
-
-If you don't define this macro, that is equivalent to defining it to do
-nothing.
-
-@findex ASM_GLOBALIZE_LABEL
-@item ASM_GLOBALIZE_LABEL (@var{stream}, @var{name})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} some commands that will make the label @var{name} global;
-that is, available for reference from other files. Use the expression
-@code{assemble_name (@var{stream}, @var{name})} to output the name
-itself; before and after that, output the additional assembler syntax
-for making that name global, and a newline.
-
-@findex ASM_WEAKEN_LABEL
-@item ASM_WEAKEN_LABEL
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} some commands that will make the label @var{name} weak;
-that is, available for reference from other files but only used if
-no other definition is available. Use the expression
-@code{assemble_name (@var{stream}, @var{name})} to output the name
-itself; before and after that, output the additional assembler syntax
-for making that name weak, and a newline.
-
-If you don't define this macro, GNU CC will not support weak
-symbols and you should not define the @code{SUPPORTS_WEAK} macro.
-
-@findex SUPPORTS_WEAK
-@item SUPPORTS_WEAK
-A C expression which evaluates to true if the target supports weak symbols.
-
-If you don't define this macro, @file{defaults.h} provides a default
-definition. If @code{ASM_WEAKEN_LABEL} is defined, the default
-definition is @samp{1}; otherwise, it is @samp{0}. Define this macro if
-you want to control weak symbol support with a compiler flag such as
-@samp{-melf}.
-
-@findex MAKE_DECL_ONE_ONLY (@var{decl})
-@item MAKE_DECL_ONE_ONLY
-A C statement (sans semicolon) to mark @var{decl} to be emitted as a
-public symbol such that extra copies in multiple translation units will
-be discarded by the linker. Define this macro if your object file
-format provides support for this concept, such as the @samp{COMDAT}
-section flags in the Microsoft Windows PE/COFF format, and this support
-requires changes to @var{decl}, such as putting it in a separate section.
-
-@findex SUPPORTS_WEAK
-@item SUPPORTS_WEAK
-A C expression which evaluates to true if the target supports one-only
-semantics.
-
-If you don't define this macro, @file{varasm.c} provides a default
-definition. If @code{MAKE_DECL_ONE_ONLY} is defined, the default
-definition is @samp{1}; otherwise, it is @samp{0}. Define this macro if
-you want to control weak symbol support with a compiler flag, or if
-setting the @code{DECL_ONE_ONLY} flag is enough to mark a declaration to
-be emitted as one-only.
-
-@findex ASM_OUTPUT_EXTERNAL
-@item ASM_OUTPUT_EXTERNAL (@var{stream}, @var{decl}, @var{name})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} any text necessary for declaring the name of an external
-symbol named @var{name} which is referenced in this compilation but
-not defined. The value of @var{decl} is the tree node for the
-declaration.
-
-This macro need not be defined if it does not need to output anything.
-The GNU assembler and most Unix assemblers don't require anything.
-
-@findex ASM_OUTPUT_EXTERNAL_LIBCALL
-@item ASM_OUTPUT_EXTERNAL_LIBCALL (@var{stream}, @var{symref})
-A C statement (sans semicolon) to output on @var{stream} an assembler
-pseudo-op to declare a library function name external. The name of the
-library function is given by @var{symref}, which has type @code{rtx} and
-is a @code{symbol_ref}.
-
-This macro need not be defined if it does not need to output anything.
-The GNU assembler and most Unix assemblers don't require anything.
-
-@findex ASM_OUTPUT_LABELREF
-@item ASM_OUTPUT_LABELREF (@var{stream}, @var{name})
-A C statement (sans semicolon) to output to the stdio stream
-@var{stream} a reference in assembler syntax to a label named
-@var{name}. This should add @samp{_} to the front of the name, if that
-is customary on your operating system, as it is in most Berkeley Unix
-systems. This macro is used in @code{assemble_name}.
-
-@ignore @c Seems not to exist anymore.
-@findex ASM_OUTPUT_LABELREF_AS_INT
-@item ASM_OUTPUT_LABELREF_AS_INT (@var{file}, @var{label})
-Define this macro for systems that use the program @code{collect2}.
-The definition should be a C statement to output a word containing
-a reference to the label @var{label}.
-@end ignore
-
-@findex ASM_OUTPUT_INTERNAL_LABEL
-@item ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{prefix}, @var{num})
-A C statement to output to the stdio stream @var{stream} a label whose
-name is made from the string @var{prefix} and the number @var{num}.
-
-It is absolutely essential that these labels be distinct from the labels
-used for user-level functions and variables. Otherwise, certain programs
-will have name conflicts with internal labels.
-
-It is desirable to exclude internal labels from the symbol table of the
-object file. Most assemblers have a naming convention for labels that
-should be excluded; on many systems, the letter @samp{L} at the
-beginning of a label has this effect. You should find out what
-convention your system uses, and follow it.
-
-The usual definition of this macro is as follows:
-
-@example
-fprintf (@var{stream}, "L%s%d:\n", @var{prefix}, @var{num})
-@end example
-
-@findex ASM_GENERATE_INTERNAL_LABEL
-@item ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num})
-A C statement to store into the string @var{string} a label whose name
-is made from the string @var{prefix} and the number @var{num}.
-
-This string, when output subsequently by @code{assemble_name}, should
-produce the output that @code{ASM_OUTPUT_INTERNAL_LABEL} would produce
-with the same @var{prefix} and @var{num}.
-
-If the string begins with @samp{*}, then @code{assemble_name} will
-output the rest of the string unchanged. It is often convenient for
-@code{ASM_GENERATE_INTERNAL_LABEL} to use @samp{*} in this way. If the
-string doesn't start with @samp{*}, then @code{ASM_OUTPUT_LABELREF} gets
-to output the string, and may change it. (Of course,
-@code{ASM_OUTPUT_LABELREF} is also part of your machine description, so
-you should know what it does on your machine.)
-
-@findex ASM_FORMAT_PRIVATE_NAME
-@item ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number})
-A C expression to assign to @var{outvar} (which is a variable of type
-@code{char *}) a newly allocated string made from the string
-@var{name} and the number @var{number}, with some suitable punctuation
-added. Use @code{alloca} to get space for the string.
-
-The string will be used as an argument to @code{ASM_OUTPUT_LABELREF} to
-produce an assembler label for an internal static variable whose name is
-@var{name}. Therefore, the string must be such as to result in valid
-assembler code. The argument @var{number} is different each time this
-macro is executed; it prevents conflicts between similarly-named
-internal static variables in different scopes.
-
-Ideally this string should not be a valid C identifier, to prevent any
-conflict with the user's own symbols. Most assemblers allow periods
-or percent signs in assembler symbols; putting at least one of these
-between the name and the number will suffice.
-
-@findex ASM_OUTPUT_DEF
-@item ASM_OUTPUT_DEF (@var{stream}, @var{name}, @var{value})
-A C statement to output to the stdio stream @var{stream} assembler code
-which defines (equates) the symbol @var{name} to have the value @var{value}.
-
-If SET_ASM_OP is defined, a default definition is provided which is
-correct for most systems.
-
-@findex ASM_OUTPUT_WEAK_ALIAS
-@item ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
-A C statement to output to the stdio stream @var{stream} assembler code
-which defines (equates) the weak symbol @var{name} to have the value
-@var{value}.
-
-Define this macro if the target only supports weak aliases; define
-ASM_OUTPUT_DEF instead if possible.
-
-@findex OBJC_GEN_METHOD_LABEL
-@item OBJC_GEN_METHOD_LABEL (@var{buf}, @var{is_inst}, @var{class_name}, @var{cat_name}, @var{sel_name})
-Define this macro to override the default assembler names used for
-Objective C methods.
-
-The default name is a unique method number followed by the name of the
-class (e.g.@: @samp{_1_Foo}). For methods in categories, the name of
-the category is also included in the assembler name (e.g.@:
-@samp{_1_Foo_Bar}).
-
-These names are safe on most systems, but make debugging difficult since
-the method's selector is not present in the name. Therefore, particular
-systems define other ways of computing names.
-
-@var{buf} is an expression of type @code{char *} which gives you a
-buffer in which to store the name; its length is as long as
-@var{class_name}, @var{cat_name} and @var{sel_name} put together, plus
-50 characters extra.
-
-The argument @var{is_inst} specifies whether the method is an instance
-method or a class method; @var{class_name} is the name of the class;
-@var{cat_name} is the name of the category (or NULL if the method is not
-in a category); and @var{sel_name} is the name of the selector.
-
-On systems where the assembler can handle quoted names, you can use this
-macro to provide more human-readable names.
-@end table
-
-@node Initialization
-@subsection How Initialization Functions Are Handled
-@cindex initialization routines
-@cindex termination routines
-@cindex constructors, output of
-@cindex destructors, output of
-
-The compiled code for certain languages includes @dfn{constructors}
-(also called @dfn{initialization routines})---functions to initialize
-data in the program when the program is started. These functions need
-to be called before the program is ``started''---that is to say, before
-@code{main} is called.
-
-Compiling some languages generates @dfn{destructors} (also called
-@dfn{termination routines}) that should be called when the program
-terminates.
-
-To make the initialization and termination functions work, the compiler
-must output something in the assembler code to cause those functions to
-be called at the appropriate time. When you port the compiler to a new
-system, you need to specify how to do this.
-
-There are two major ways that GCC currently supports the execution of
-initialization and termination functions. Each way has two variants.
-Much of the structure is common to all four variations.
-
-@findex __CTOR_LIST__
-@findex __DTOR_LIST__
-The linker must build two lists of these functions---a list of
-initialization functions, called @code{__CTOR_LIST__}, and a list of
-termination functions, called @code{__DTOR_LIST__}.
-
-Each list always begins with an ignored function pointer (which may hold
-0, @minus{}1, or a count of the function pointers after it, depending on
-the environment). This is followed by a series of zero or more function
-pointers to constructors (or destructors), followed by a function
-pointer containing zero.
-
-Depending on the operating system and its executable file format, either
-@file{crtstuff.c} or @file{libgcc2.c} traverses these lists at startup
-time and exit time. Constructors are called in reverse order of the
-list; destructors in forward order.
-
-The best way to handle static constructors works only for object file
-formats which provide arbitrarily-named sections. A section is set
-aside for a list of constructors, and another for a list of destructors.
-Traditionally these are called @samp{.ctors} and @samp{.dtors}. Each
-object file that defines an initialization function also puts a word in
-the constructor section to point to that function. The linker
-accumulates all these words into one contiguous @samp{.ctors} section.
-Termination functions are handled similarly.
-
-To use this method, you need appropriate definitions of the macros
-@code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR}. Usually
-you can get them by including @file{svr4.h}.
-
-When arbitrary sections are available, there are two variants, depending
-upon how the code in @file{crtstuff.c} is called. On systems that
-support an @dfn{init} section which is executed at program startup,
-parts of @file{crtstuff.c} are compiled into that section. The
-program is linked by the @code{gcc} driver like this:
-
-@example
-ld -o @var{output_file} crtbegin.o @dots{} crtend.o -lgcc
-@end example
-
-The head of a function (@code{__do_global_ctors}) appears in the init
-section of @file{crtbegin.o}; the remainder of the function appears in
-the init section of @file{crtend.o}. The linker will pull these two
-parts of the section together, making a whole function. If any of the
-user's object files linked into the middle of it contribute code, then that
-code will be executed as part of the body of @code{__do_global_ctors}.
-
-To use this variant, you must define the @code{INIT_SECTION_ASM_OP}
-macro properly.
-
-If no init section is available, do not define
-@code{INIT_SECTION_ASM_OP}. Then @code{__do_global_ctors} is built into
-the text section like all other functions, and resides in
-@file{libgcc.a}. When GCC compiles any function called @code{main}, it
-inserts a procedure call to @code{__main} as the first executable code
-after the function prologue. The @code{__main} function, also defined
-in @file{libgcc2.c}, simply calls @file{__do_global_ctors}.
-
-In file formats that don't support arbitrary sections, there are again
-two variants. In the simplest variant, the GNU linker (GNU @code{ld})
-and an `a.out' format must be used. In this case,
-@code{ASM_OUTPUT_CONSTRUCTOR} is defined to produce a @code{.stabs}
-entry of type @samp{N_SETT}, referencing the name @code{__CTOR_LIST__},
-and with the address of the void function containing the initialization
-code as its value. The GNU linker recognizes this as a request to add
-the value to a ``set''; the values are accumulated, and are eventually
-placed in the executable as a vector in the format described above, with
-a leading (ignored) count and a trailing zero element.
-@code{ASM_OUTPUT_DESTRUCTOR} is handled similarly. Since no init
-section is available, the absence of @code{INIT_SECTION_ASM_OP} causes
-the compilation of @code{main} to call @code{__main} as above, starting
-the initialization process.
-
-The last variant uses neither arbitrary sections nor the GNU linker.
-This is preferable when you want to do dynamic linking and when using
-file formats which the GNU linker does not support, such as `ECOFF'. In
-this case, @code{ASM_OUTPUT_CONSTRUCTOR} does not produce an
-@code{N_SETT} symbol; initialization and termination functions are
-recognized simply by their names. This requires an extra program in the
-linkage step, called @code{collect2}. This program pretends to be the
-linker, for use with GNU CC; it does its job by running the ordinary
-linker, but also arranges to include the vectors of initialization and
-termination functions. These functions are called via @code{__main} as
-described above.
-
-Choosing among these configuration options has been simplified by a set
-of operating-system-dependent files in the @file{config} subdirectory.
-These files define all of the relevant parameters. Usually it is
-sufficient to include one into your specific machine-dependent
-configuration file. These files are:
-
-@table @file
-@item aoutos.h
-For operating systems using the `a.out' format.
-
-@item next.h
-For operating systems using the `MachO' format.
-
-@item svr3.h
-For System V Release 3 and similar systems using `COFF' format.
-
-@item svr4.h
-For System V Release 4 and similar systems using `ELF' format.
-
-@item vms.h
-For the VMS operating system.
-@end table
-
-@ifinfo
-The following section describes the specific macros that control and
-customize the handling of initialization and termination functions.
-@end ifinfo
-
-@node Macros for Initialization
-@subsection Macros Controlling Initialization Routines
-
-Here are the macros that control how the compiler handles initialization
-and termination functions:
-
-@table @code
-@findex INIT_SECTION_ASM_OP
-@item INIT_SECTION_ASM_OP
-If defined, a C string constant for the assembler operation to identify
-the following data as initialization code. If not defined, GNU CC will
-assume such a section does not exist. When you are using special
-sections for initialization and termination functions, this macro also
-controls how @file{crtstuff.c} and @file{libgcc2.c} arrange to run the
-initialization functions.
-
-@item HAS_INIT_SECTION
-@findex HAS_INIT_SECTION
-If defined, @code{main} will not call @code{__main} as described above.
-This macro should be defined for systems that control the contents of the
-init section on a symbol-by-symbol basis, such as OSF/1, and should not
-be defined explicitly for systems that support
-@code{INIT_SECTION_ASM_OP}.
-
-@item LD_INIT_SWITCH
-@findex LD_INIT_SWITCH
-If defined, a C string constant for a switch that tells the linker that
-the following symbol is an initialization routine.
-
-@item LD_FINI_SWITCH
-@findex LD_FINI_SWITCH
-If defined, a C string constant for a switch that tells the linker that
-the following symbol is a finalization routine.
-
-@item INVOKE__main
-@findex INVOKE__main
-If defined, @code{main} will call @code{__main} despite the presence of
-@code{INIT_SECTION_ASM_OP}. This macro should be defined for systems
-where the init section is not actually run automatically, but is still
-useful for collecting the lists of constructors and destructors.
-
-@item ASM_OUTPUT_CONSTRUCTOR (@var{stream}, @var{name})
-@findex ASM_OUTPUT_CONSTRUCTOR
-Define this macro as a C statement to output on the stream @var{stream}
-the assembler code to arrange to call the function named @var{name} at
-initialization time.
-
-Assume that @var{name} is the name of a C function generated
-automatically by the compiler. This function takes no arguments. Use
-the function @code{assemble_name} to output the name @var{name}; this
-performs any system-specific syntactic transformations such as adding an
-underscore.
-
-If you don't define this macro, nothing special is output to arrange to
-call the function. This is correct when the function will be called in
-some other manner---for example, by means of the @code{collect2} program,
-which looks through the symbol table to find these functions by their
-names.
-
-@item ASM_OUTPUT_DESTRUCTOR (@var{stream}, @var{name})
-@findex ASM_OUTPUT_DESTRUCTOR
-This is like @code{ASM_OUTPUT_CONSTRUCTOR} but used for termination
-functions rather than initialization functions.
-@end table
-
-If your system uses @code{collect2} as the means of processing
-constructors, then that program normally uses @code{nm} to scan an
-object file for constructor functions to be called. On certain kinds of
-systems, you can define these macros to make @code{collect2} work faster
-(and, in some cases, make it work at all):
-
-@table @code
-@findex OBJECT_FORMAT_COFF
-@item OBJECT_FORMAT_COFF
-Define this macro if the system uses COFF (Common Object File Format)
-object files, so that @code{collect2} can assume this format and scan
-object files directly for dynamic constructor/destructor functions.
-
-@findex OBJECT_FORMAT_ROSE
-@item OBJECT_FORMAT_ROSE
-Define this macro if the system uses ROSE format object files, so that
-@code{collect2} can assume this format and scan object files directly
-for dynamic constructor/destructor functions.
-
-These macros are effective only in a native compiler; @code{collect2} as
-part of a cross compiler always uses @code{nm} for the target machine.
-
-@findex REAL_NM_FILE_NAME
-@item REAL_NM_FILE_NAME
-Define this macro as a C string constant containing the file name to use
-to execute @code{nm}. The default is to search the path normally for
-@code{nm}.
-
-If your system supports shared libraries and has a program to list the
-dynamic dependencies of a given library or executable, you can define
-these macros to enable support for running initialization and
-termination functions in shared libraries:
-
-@findex LDD_SUFFIX
-@item LDD_SUFFIX
-Define this macro to a C string constant containing the name of the
-program which lists dynamic dependencies, like @code{"ldd"} under SunOS 4.
-
-@findex PARSE_LDD_OUTPUT
-@item PARSE_LDD_OUTPUT (@var{PTR})
-Define this macro to be C code that extracts filenames from the output
-of the program denoted by @code{LDD_SUFFIX}. @var{PTR} is a variable
-of type @code{char *} that points to the beginning of a line of output
-from @code{LDD_SUFFIX}. If the line lists a dynamic dependency, the
-code must advance @var{PTR} to the beginning of the filename on that
-line. Otherwise, it must set @var{PTR} to @code{NULL}.
-
-@end table
-
-@node Instruction Output
-@subsection Output of Assembler Instructions
-
-@c prevent bad page break with this line
-This describes assembler instruction output.
-
-@table @code
-@findex REGISTER_NAMES
-@item REGISTER_NAMES
-A C initializer containing the assembler's names for the machine
-registers, each one as a C string constant. This is what translates
-register numbers in the compiler into assembler language.
-
-@findex ADDITIONAL_REGISTER_NAMES
-@item ADDITIONAL_REGISTER_NAMES
-If defined, a C initializer for an array of structures containing a name
-and a register number. This macro defines additional names for hard
-registers, thus allowing the @code{asm} option in declarations to refer
-to registers using alternate names.
-
-@findex ASM_OUTPUT_OPCODE
-@item ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr})
-Define this macro if you are using an unusual assembler that
-requires different names for the machine instructions.
-
-The definition is a C statement or statements which output an
-assembler instruction opcode to the stdio stream @var{stream}. The
-macro-operand @var{ptr} is a variable of type @code{char *} which
-points to the opcode name in its ``internal'' form---the form that is
-written in the machine description. The definition should output the
-opcode name to @var{stream}, performing any translation you desire, and
-increment the variable @var{ptr} to point at the end of the opcode
-so that it will not be output twice.
-
-In fact, your macro definition may process less than the entire opcode
-name, or more than the opcode name; but if you want to process text
-that includes @samp{%}-sequences to substitute operands, you must take
-care of the substitution yourself. Just be sure to increment
-@var{ptr} over whatever text should not be output normally.
-
-@findex recog_operand
-If you need to look at the operand values, they can be found as the
-elements of @code{recog_operand}.
-
-If the macro definition does nothing, the instruction is output
-in the usual way.
-
-@findex FINAL_PRESCAN_INSN
-@item FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands})
-If defined, a C statement to be executed just prior to the output of
-assembler code for @var{insn}, to modify the extracted operands so
-they will be output differently.
-
-Here the argument @var{opvec} is the vector containing the operands
-extracted from @var{insn}, and @var{noperands} is the number of
-elements of the vector which contain meaningful data for this insn.
-The contents of this vector are what will be used to convert the insn
-template into assembler code, so you can change the assembler output
-by changing the contents of the vector.
-
-This macro is useful when various assembler syntaxes share a single
-file of instruction patterns; by defining this macro differently, you
-can cause a large class of instructions to be output differently (such
-as with rearranged operands). Naturally, variations in assembler
-syntax affecting individual insn patterns ought to be handled by
-writing conditional output routines in those patterns.
-
-If this macro is not defined, it is equivalent to a null statement.
-
-@findex FINAL_PRESCAN_LABEL
-@item FINAL_PRESCAN_LABEL
-If defined, @code{FINAL_PRESCAN_INSN} will be called on each
-@code{CODE_LABEL}. In that case, @var{opvec} will be a null pointer and
-@var{noperands} will be zero.
-
-@findex PRINT_OPERAND
-@item PRINT_OPERAND (@var{stream}, @var{x}, @var{code})
-A C compound statement to output to stdio stream @var{stream} the
-assembler syntax for an instruction operand @var{x}. @var{x} is an
-RTL expression.
-
-@var{code} is a value that can be used to specify one of several ways
-of printing the operand. It is used when identical operands must be
-printed differently depending on the context. @var{code} comes from
-the @samp{%} specification that was used to request printing of the
-operand. If the specification was just @samp{%@var{digit}} then
-@var{code} is 0; if the specification was @samp{%@var{ltr}
-@var{digit}} then @var{code} is the ASCII code for @var{ltr}.
-
-@findex reg_names
-If @var{x} is a register, this macro should print the register's name.
-The names can be found in an array @code{reg_names} whose type is
-@code{char *[]}. @code{reg_names} is initialized from
-@code{REGISTER_NAMES}.
-
-When the machine description has a specification @samp{%@var{punct}}
-(a @samp{%} followed by a punctuation character), this macro is called
-with a null pointer for @var{x} and the punctuation character for
-@var{code}.
-
-@findex PRINT_OPERAND_PUNCT_VALID_P
-@item PRINT_OPERAND_PUNCT_VALID_P (@var{code})
-A C expression which evaluates to true if @var{code} is a valid
-punctuation character for use in the @code{PRINT_OPERAND} macro. If
-@code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that no
-punctuation characters (except for the standard one, @samp{%}) are used
-in this way.
-
-@findex PRINT_OPERAND_ADDRESS
-@item PRINT_OPERAND_ADDRESS (@var{stream}, @var{x})
-A C compound statement to output to stdio stream @var{stream} the
-assembler syntax for an instruction operand that is a memory reference
-whose address is @var{x}. @var{x} is an RTL expression.
-
-@cindex @code{ENCODE_SECTION_INFO} usage
-On some machines, the syntax for a symbolic address depends on the
-section that the address refers to. On these machines, define the macro
-@code{ENCODE_SECTION_INFO} to store the information into the
-@code{symbol_ref}, and then check for it here. @xref{Assembler Format}.
-
-@findex DBR_OUTPUT_SEQEND
-@findex dbr_sequence_length
-@item DBR_OUTPUT_SEQEND(@var{file})
-A C statement, to be executed after all slot-filler instructions have
-been output. If necessary, call @code{dbr_sequence_length} to
-determine the number of slots filled in a sequence (zero if not
-currently outputting a sequence), to decide how many no-ops to output,
-or whatever.
-
-Don't define this macro if it has nothing to do, but it is helpful in
-reading assembly output if the extent of the delay sequence is made
-explicit (e.g. with white space).
-
-@findex final_sequence
-Note that output routines for instructions with delay slots must be
-prepared to deal with not being output as part of a sequence (i.e.
-when the scheduling pass is not run, or when no slot fillers could be
-found.) The variable @code{final_sequence} is null when not
-processing a sequence, otherwise it contains the @code{sequence} rtx
-being output.
-
-@findex REGISTER_PREFIX
-@findex LOCAL_LABEL_PREFIX
-@findex USER_LABEL_PREFIX
-@findex IMMEDIATE_PREFIX
-@findex asm_fprintf
-@item REGISTER_PREFIX
-@itemx LOCAL_LABEL_PREFIX
-@itemx USER_LABEL_PREFIX
-@itemx IMMEDIATE_PREFIX
-If defined, C string expressions to be used for the @samp{%R}, @samp{%L},
-@samp{%U}, and @samp{%I} options of @code{asm_fprintf} (see
-@file{final.c}). These are useful when a single @file{md} file must
-support multiple assembler formats. In that case, the various @file{tm.h}
-files can define these macros differently.
-
-@findex ASSEMBLER_DIALECT
-@item ASSEMBLER_DIALECT
-If your target supports multiple dialects of assembler language (such as
-different opcodes), define this macro as a C expression that gives the
-numeric index of the assembler language dialect to use, with zero as the
-first variant.
-
-If this macro is defined, you may use constructs of the form
-@samp{@{option0|option1|option2@dots{}@}} in the output
-templates of patterns (@pxref{Output Template}) or in the first argument
-of @code{asm_fprintf}. This construct outputs @samp{option0},
-@samp{option1} or @samp{option2}, etc., if the value of
-@code{ASSEMBLER_DIALECT} is zero, one or two, etc. Any special
-characters within these strings retain their usual meaning.
-
-If you do not define this macro, the characters @samp{@{}, @samp{|} and
-@samp{@}} do not have any special meaning when used in templates or
-operands to @code{asm_fprintf}.
-
-Define the macros @code{REGISTER_PREFIX}, @code{LOCAL_LABEL_PREFIX},
-@code{USER_LABEL_PREFIX} and @code{IMMEDIATE_PREFIX} if you can express
-the variations in assemble language syntax with that mechanism. Define
-@code{ASSEMBLER_DIALECT} and use the @samp{@{option0|option1@}} syntax
-if the syntax variant are larger and involve such things as different
-opcodes or operand order.
-
-@findex ASM_OUTPUT_REG_PUSH
-@item ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno})
-A C expression to output to @var{stream} some assembler code
-which will push hard register number @var{regno} onto the stack.
-The code need not be optimal, since this macro is used only when
-profiling.
-
-@findex ASM_OUTPUT_REG_POP
-@item ASM_OUTPUT_REG_POP (@var{stream}, @var{regno})
-A C expression to output to @var{stream} some assembler code
-which will pop hard register number @var{regno} off of the stack.
-The code need not be optimal, since this macro is used only when
-profiling.
-@end table
-
-@node Dispatch Tables
-@subsection Output of Dispatch Tables
-
-@c prevent bad page break with this line
-This concerns dispatch tables.
-
-@table @code
-@cindex dispatch table
-@findex ASM_OUTPUT_ADDR_DIFF_ELT
-@item ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{value}, @var{rel})
-A C statement to output to the stdio stream @var{stream} an assembler
-pseudo-instruction to generate a difference between two labels.
-@var{value} and @var{rel} are the numbers of two internal labels. The
-definitions of these labels are output using
-@code{ASM_OUTPUT_INTERNAL_LABEL}, and they must be printed in the same
-way here. For example,
-
-@example
-fprintf (@var{stream}, "\t.word L%d-L%d\n",
- @var{value}, @var{rel})
-@end example
-
-You must provide this macro on machines where the addresses in a
-dispatch table are relative to the table's own address. If defined, GNU
-CC will also use this macro on all machines when producing PIC.
-
-@findex ASM_OUTPUT_ADDR_VEC_ELT
-@item ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value})
-This macro should be provided on machines where the addresses
-in a dispatch table are absolute.
-
-The definition should be a C statement to output to the stdio stream
-@var{stream} an assembler pseudo-instruction to generate a reference to
-a label. @var{value} is the number of an internal label whose
-definition is output using @code{ASM_OUTPUT_INTERNAL_LABEL}.
-For example,
-
-@example
-fprintf (@var{stream}, "\t.word L%d\n", @var{value})
-@end example
-
-@findex ASM_OUTPUT_CASE_LABEL
-@item ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table})
-Define this if the label before a jump-table needs to be output
-specially. The first three arguments are the same as for
-@code{ASM_OUTPUT_INTERNAL_LABEL}; the fourth argument is the
-jump-table which follows (a @code{jump_insn} containing an
-@code{addr_vec} or @code{addr_diff_vec}).
-
-This feature is used on system V to output a @code{swbeg} statement
-for the table.
-
-If this macro is not defined, these labels are output with
-@code{ASM_OUTPUT_INTERNAL_LABEL}.
-
-@findex ASM_OUTPUT_CASE_END
-@item ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table})
-Define this if something special must be output at the end of a
-jump-table. The definition should be a C statement to be executed
-after the assembler code for the table is written. It should write
-the appropriate code to stdio stream @var{stream}. The argument
-@var{table} is the jump-table insn, and @var{num} is the label-number
-of the preceding label.
-
-If this macro is not defined, nothing special is output at the end of
-the jump-table.
-@end table
-
-@node Exception Region Output
-@subsection Assembler Commands for Exception Regions
-
-@c prevent bad page break with this line
-
-This describes commands marking the start and the end of an exception
-region.
-
-@table @code
-@findex ASM_OUTPUT_EH_REGION_BEG
-@item ASM_OUTPUT_EH_REGION_BEG ()
-A C expression to output text to mark the start of an exception region.
-
-This macro need not be defined on most platforms.
-
-@findex ASM_OUTPUT_EH_REGION_END
-@item ASM_OUTPUT_EH_REGION_END ()
-A C expression to output text to mark the end of an exception region.
-
-This macro need not be defined on most platforms.
-
-@findex OMIT_EH_TABLE
-@item OMIT_EH_TABLE ()
-A C expression that is nonzero if the normal exception table output
-should be omitted.
-
-This macro need not be defined on most platforms.
-
-@findex EH_TABLE_LOOKUP
-@item EH_TABLE_LOOKUP ()
-Alternate runtime support for looking up an exception at runtime and
-finding the associated handler, if the default method won't work.
-
-This macro need not be defined on most platforms.
-
-@findex DOESNT_NEED_UNWINDER
-@item DOESNT_NEED_UNWINDER
-A C expression that decides whether or not the current function needs to
-have a function unwinder generated for it. See the file @code{except.c}
-for details on when to define this, and how.
-
-@findex MASK_RETURN_ADDR
-@item MASK_RETURN_ADDR
-An rtx used to mask the return address found via RETURN_ADDR_RTX, so
-that it does not contain any extraneous set bits in it.
-@end table
-
-@node Alignment Output
-@subsection Assembler Commands for Alignment
-
-@c prevent bad page break with this line
-This describes commands for alignment.
-
-@table @code
-@findex ASM_OUTPUT_ALIGN_CODE
-@item ASM_OUTPUT_ALIGN_CODE (@var{file})
-A C expression to output text to align the location counter in the way
-that is desirable at a point in the code that is reached only by
-jumping.
-
-This macro need not be defined if you don't want any special alignment
-to be done at such a time. Most machine descriptions do not currently
-define the macro.
-
-@findex ASM_OUTPUT_LOOP_ALIGN
-@item ASM_OUTPUT_LOOP_ALIGN (@var{file})
-A C expression to output text to align the location counter in the way
-that is desirable at the beginning of a loop.
-
-This macro need not be defined if you don't want any special alignment
-to be done at such a time. Most machine descriptions do not currently
-define the macro.
-
-@findex ASM_OUTPUT_SKIP
-@item ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
-A C statement to output to the stdio stream @var{stream} an assembler
-instruction to advance the location counter by @var{nbytes} bytes.
-Those bytes should be zero when loaded. @var{nbytes} will be a C
-expression of type @code{int}.
-
-@findex ASM_NO_SKIP_IN_TEXT
-@item ASM_NO_SKIP_IN_TEXT
-Define this macro if @code{ASM_OUTPUT_SKIP} should not be used in the
-text section because it fails put zeros in the bytes that are skipped.
-This is true on many Unix systems, where the pseudo--op to skip bytes
-produces no-op instructions rather than zeros when used in the text
-section.
-
-@findex ASM_OUTPUT_ALIGN
-@item ASM_OUTPUT_ALIGN (@var{stream}, @var{power})
-A C statement to output to the stdio stream @var{stream} an assembler
-command to advance the location counter to a multiple of 2 to the
-@var{power} bytes. @var{power} will be a C expression of type @code{int}.
-@end table
-
-@need 3000
-@node Debugging Info
-@section Controlling Debugging Information Format
-
-@c prevent bad page break with this line
-This describes how to specify debugging information.
-
-@menu
-* All Debuggers:: Macros that affect all debugging formats uniformly.
-* DBX Options:: Macros enabling specific options in DBX format.
-* DBX Hooks:: Hook macros for varying DBX format.
-* File Names and DBX:: Macros controlling output of file names in DBX format.
-* SDB and DWARF:: Macros for SDB (COFF) and DWARF formats.
-@end menu
-
-@node All Debuggers
-@subsection Macros Affecting All Debugging Formats
-
-@c prevent bad page break with this line
-These macros affect all debugging formats.
-
-@table @code
-@findex DBX_REGISTER_NUMBER
-@item DBX_REGISTER_NUMBER (@var{regno})
-A C expression that returns the DBX register number for the compiler
-register number @var{regno}. In simple cases, the value of this
-expression may be @var{regno} itself. But sometimes there are some
-registers that the compiler knows about and DBX does not, or vice
-versa. In such cases, some register may need to have one number in
-the compiler and another for DBX.
-
-If two registers have consecutive numbers inside GNU CC, and they can be
-used as a pair to hold a multiword value, then they @emph{must} have
-consecutive numbers after renumbering with @code{DBX_REGISTER_NUMBER}.
-Otherwise, debuggers will be unable to access such a pair, because they
-expect register pairs to be consecutive in their own numbering scheme.
-
-If you find yourself defining @code{DBX_REGISTER_NUMBER} in way that
-does not preserve register pairs, then what you must do instead is
-redefine the actual register numbering scheme.
-
-@findex DEBUGGER_AUTO_OFFSET
-@item DEBUGGER_AUTO_OFFSET (@var{x})
-A C expression that returns the integer offset value for an automatic
-variable having address @var{x} (an RTL expression). The default
-computation assumes that @var{x} is based on the frame-pointer and
-gives the offset from the frame-pointer. This is required for targets
-that produce debugging output for DBX or COFF-style debugging output
-for SDB and allow the frame-pointer to be eliminated when the
-@samp{-g} options is used.
-
-@findex DEBUGGER_ARG_OFFSET
-@item DEBUGGER_ARG_OFFSET (@var{offset}, @var{x})
-A C expression that returns the integer offset value for an argument
-having address @var{x} (an RTL expression). The nominal offset is
-@var{offset}.
-
-@findex PREFERRED_DEBUGGING_TYPE
-@item PREFERRED_DEBUGGING_TYPE
-A C expression that returns the type of debugging output GNU CC produces
-when the user specifies @samp{-g} or @samp{-ggdb}. Define this if you
-have arranged for GNU CC to support more than one format of debugging
-output. Currently, the allowable values are @code{DBX_DEBUG},
-@code{SDB_DEBUG}, @code{DWARF_DEBUG}, @code{DWARF2_DEBUG}, and
-@code{XCOFF_DEBUG}.
-
-The value of this macro only affects the default debugging output; the
-user can always get a specific type of output by using @samp{-gstabs},
-@samp{-gcoff}, @samp{-gdwarf-1}, @samp{-gdwarf-2}, or @samp{-gxcoff}.
-@end table
-
-@node DBX Options
-@subsection Specific Options for DBX Output
-
-@c prevent bad page break with this line
-These are specific options for DBX output.
-
-@table @code
-@findex DBX_DEBUGGING_INFO
-@item DBX_DEBUGGING_INFO
-Define this macro if GNU CC should produce debugging output for DBX
-in response to the @samp{-g} option.
-
-@findex XCOFF_DEBUGGING_INFO
-@item XCOFF_DEBUGGING_INFO
-Define this macro if GNU CC should produce XCOFF format debugging output
-in response to the @samp{-g} option. This is a variant of DBX format.
-
-@findex DEFAULT_GDB_EXTENSIONS
-@item DEFAULT_GDB_EXTENSIONS
-Define this macro to control whether GNU CC should by default generate
-GDB's extended version of DBX debugging information (assuming DBX-format
-debugging information is enabled at all). If you don't define the
-macro, the default is 1: always generate the extended information
-if there is any occasion to.
-
-@findex DEBUG_SYMS_TEXT
-@item DEBUG_SYMS_TEXT
-Define this macro if all @code{.stabs} commands should be output while
-in the text section.
-
-@findex ASM_STABS_OP
-@item ASM_STABS_OP
-A C string constant naming the assembler pseudo op to use instead of
-@code{.stabs} to define an ordinary debugging symbol. If you don't
-define this macro, @code{.stabs} is used. This macro applies only to
-DBX debugging information format.
-
-@findex ASM_STABD_OP
-@item ASM_STABD_OP
-A C string constant naming the assembler pseudo op to use instead of
-@code{.stabd} to define a debugging symbol whose value is the current
-location. If you don't define this macro, @code{.stabd} is used.
-This macro applies only to DBX debugging information format.
-
-@findex ASM_STABN_OP
-@item ASM_STABN_OP
-A C string constant naming the assembler pseudo op to use instead of
-@code{.stabn} to define a debugging symbol with no name. If you don't
-define this macro, @code{.stabn} is used. This macro applies only to
-DBX debugging information format.
-
-@findex DBX_NO_XREFS
-@item DBX_NO_XREFS
-Define this macro if DBX on your system does not support the construct
-@samp{xs@var{tagname}}. On some systems, this construct is used to
-describe a forward reference to a structure named @var{tagname}.
-On other systems, this construct is not supported at all.
-
-@findex DBX_CONTIN_LENGTH
-@item DBX_CONTIN_LENGTH
-A symbol name in DBX-format debugging information is normally
-continued (split into two separate @code{.stabs} directives) when it
-exceeds a certain length (by default, 80 characters). On some
-operating systems, DBX requires this splitting; on others, splitting
-must not be done. You can inhibit splitting by defining this macro
-with the value zero. You can override the default splitting-length by
-defining this macro as an expression for the length you desire.
-
-@findex DBX_CONTIN_CHAR
-@item DBX_CONTIN_CHAR
-Normally continuation is indicated by adding a @samp{\} character to
-the end of a @code{.stabs} string when a continuation follows. To use
-a different character instead, define this macro as a character
-constant for the character you want to use. Do not define this macro
-if backslash is correct for your system.
-
-@findex DBX_STATIC_STAB_DATA_SECTION
-@item DBX_STATIC_STAB_DATA_SECTION
-Define this macro if it is necessary to go to the data section before
-outputting the @samp{.stabs} pseudo-op for a non-global static
-variable.
-
-@findex DBX_TYPE_DECL_STABS_CODE
-@item DBX_TYPE_DECL_STABS_CODE
-The value to use in the ``code'' field of the @code{.stabs} directive
-for a typedef. The default is @code{N_LSYM}.
-
-@findex DBX_STATIC_CONST_VAR_CODE
-@item DBX_STATIC_CONST_VAR_CODE
-The value to use in the ``code'' field of the @code{.stabs} directive
-for a static variable located in the text section. DBX format does not
-provide any ``right'' way to do this. The default is @code{N_FUN}.
-
-@findex DBX_REGPARM_STABS_CODE
-@item DBX_REGPARM_STABS_CODE
-The value to use in the ``code'' field of the @code{.stabs} directive
-for a parameter passed in registers. DBX format does not provide any
-``right'' way to do this. The default is @code{N_RSYM}.
-
-@findex DBX_REGPARM_STABS_LETTER
-@item DBX_REGPARM_STABS_LETTER
-The letter to use in DBX symbol data to identify a symbol as a parameter
-passed in registers. DBX format does not customarily provide any way to
-do this. The default is @code{'P'}.
-
-@findex DBX_MEMPARM_STABS_LETTER
-@item DBX_MEMPARM_STABS_LETTER
-The letter to use in DBX symbol data to identify a symbol as a stack
-parameter. The default is @code{'p'}.
-
-@findex DBX_FUNCTION_FIRST
-@item DBX_FUNCTION_FIRST
-Define this macro if the DBX information for a function and its
-arguments should precede the assembler code for the function. Normally,
-in DBX format, the debugging information entirely follows the assembler
-code.
-
-@findex DBX_LBRAC_FIRST
-@item DBX_LBRAC_FIRST
-Define this macro if the @code{N_LBRAC} symbol for a block should
-precede the debugging information for variables and functions defined in
-that block. Normally, in DBX format, the @code{N_LBRAC} symbol comes
-first.
-
-@findex DBX_BLOCKS_FUNCTION_RELATIVE
-@item DBX_BLOCKS_FUNCTION_RELATIVE
-Define this macro if the value of a symbol describing the scope of a
-block (@code{N_LBRAC} or @code{N_RBRAC}) should be relative to the start
-of the enclosing function. Normally, GNU C uses an absolute address.
-
-@findex DBX_USE_BINCL
-@item DBX_USE_BINCL
-Define this macro if GNU C should generate @code{N_BINCL} and
-@code{N_EINCL} stabs for included header files, as on Sun systems. This
-macro also directs GNU C to output a type number as a pair of a file
-number and a type number within the file. Normally, GNU C does not
-generate @code{N_BINCL} or @code{N_EINCL} stabs, and it outputs a single
-number for a type number.
-@end table
-
-@node DBX Hooks
-@subsection Open-Ended Hooks for DBX Format
-
-@c prevent bad page break with this line
-These are hooks for DBX format.
-
-@table @code
-@findex DBX_OUTPUT_LBRAC
-@item DBX_OUTPUT_LBRAC (@var{stream}, @var{name})
-Define this macro to say how to output to @var{stream} the debugging
-information for the start of a scope level for variable names. The
-argument @var{name} is the name of an assembler symbol (for use with
-@code{assemble_name}) whose value is the address where the scope begins.
-
-@findex DBX_OUTPUT_RBRAC
-@item DBX_OUTPUT_RBRAC (@var{stream}, @var{name})
-Like @code{DBX_OUTPUT_LBRAC}, but for the end of a scope level.
-
-@findex DBX_OUTPUT_ENUM
-@item DBX_OUTPUT_ENUM (@var{stream}, @var{type})
-Define this macro if the target machine requires special handling to
-output an enumeration type. The definition should be a C statement
-(sans semicolon) to output the appropriate information to @var{stream}
-for the type @var{type}.
-
-@findex DBX_OUTPUT_FUNCTION_END
-@item DBX_OUTPUT_FUNCTION_END (@var{stream}, @var{function})
-Define this macro if the target machine requires special output at the
-end of the debugging information for a function. The definition should
-be a C statement (sans semicolon) to output the appropriate information
-to @var{stream}. @var{function} is the @code{FUNCTION_DECL} node for
-the function.
-
-@findex DBX_OUTPUT_STANDARD_TYPES
-@item DBX_OUTPUT_STANDARD_TYPES (@var{syms})
-Define this macro if you need to control the order of output of the
-standard data types at the beginning of compilation. The argument
-@var{syms} is a @code{tree} which is a chain of all the predefined
-global symbols, including names of data types.
-
-Normally, DBX output starts with definitions of the types for integers
-and characters, followed by all the other predefined types of the
-particular language in no particular order.
-
-On some machines, it is necessary to output different particular types
-first. To do this, define @code{DBX_OUTPUT_STANDARD_TYPES} to output
-those symbols in the necessary order. Any predefined types that you
-don't explicitly output will be output afterward in no particular order.
-
-Be careful not to define this macro so that it works only for C. There
-are no global variables to access most of the built-in types, because
-another language may have another set of types. The way to output a
-particular type is to look through @var{syms} to see if you can find it.
-Here is an example:
-
-@smallexample
-@{
- tree decl;
- for (decl = syms; decl; decl = TREE_CHAIN (decl))
- if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
- "long int"))
- dbxout_symbol (decl);
- @dots{}
-@}
-@end smallexample
-
-@noindent
-This does nothing if the expected type does not exist.
-
-See the function @code{init_decl_processing} in @file{c-decl.c} to find
-the names to use for all the built-in C types.
-
-Here is another way of finding a particular type:
-
-@c this is still overfull. --mew 10feb93
-@smallexample
-@{
- tree decl;
- for (decl = syms; decl; decl = TREE_CHAIN (decl))
- if (TREE_CODE (decl) == TYPE_DECL
- && (TREE_CODE (TREE_TYPE (decl))
- == INTEGER_CST)
- && TYPE_PRECISION (TREE_TYPE (decl)) == 16
- && TYPE_UNSIGNED (TREE_TYPE (decl)))
-@group
- /* @r{This must be @code{unsigned short}.} */
- dbxout_symbol (decl);
- @dots{}
-@}
-@end group
-@end smallexample
-
-@findex NO_DBX_FUNCTION_END
-@item NO_DBX_FUNCTION_END
-Some stabs encapsulation formats (in particular ECOFF), cannot handle the
-@code{.stabs "",N_FUN,,0,0,Lscope-function-1} gdb dbx extention construct.
-On those machines, define this macro to turn this feature off without
-disturbing the rest of the gdb extensions.
-
-@end table
-
-@node File Names and DBX
-@subsection File Names in DBX Format
-
-@c prevent bad page break with this line
-This describes file names in DBX format.
-
-@table @code
-@findex DBX_WORKING_DIRECTORY
-@item DBX_WORKING_DIRECTORY
-Define this if DBX wants to have the current directory recorded in each
-object file.
-
-Note that the working directory is always recorded if GDB extensions are
-enabled.
-
-@findex DBX_OUTPUT_MAIN_SOURCE_FILENAME
-@item DBX_OUTPUT_MAIN_SOURCE_FILENAME (@var{stream}, @var{name})
-A C statement to output DBX debugging information to the stdio stream
-@var{stream} which indicates that file @var{name} is the main source
-file---the file specified as the input file for compilation.
-This macro is called only once, at the beginning of compilation.
-
-This macro need not be defined if the standard form of output
-for DBX debugging information is appropriate.
-
-@findex DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
-@item DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (@var{stream}, @var{name})
-A C statement to output DBX debugging information to the stdio stream
-@var{stream} which indicates that the current directory during
-compilation is named @var{name}.
-
-This macro need not be defined if the standard form of output
-for DBX debugging information is appropriate.
-
-@findex DBX_OUTPUT_MAIN_SOURCE_FILE_END
-@item DBX_OUTPUT_MAIN_SOURCE_FILE_END (@var{stream}, @var{name})
-A C statement to output DBX debugging information at the end of
-compilation of the main source file @var{name}.
-
-If you don't define this macro, nothing special is output at the end
-of compilation, which is correct for most machines.
-
-@findex DBX_OUTPUT_SOURCE_FILENAME
-@item DBX_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
-A C statement to output DBX debugging information to the stdio stream
-@var{stream} which indicates that file @var{name} is the current source
-file. This output is generated each time input shifts to a different
-source file as a result of @samp{#include}, the end of an included file,
-or a @samp{#line} command.
-
-This macro need not be defined if the standard form of output
-for DBX debugging information is appropriate.
-@end table
-
-@need 2000
-@node SDB and DWARF
-@subsection Macros for SDB and DWARF Output
-
-@c prevent bad page break with this line
-Here are macros for SDB and DWARF output.
-
-@table @code
-@findex SDB_DEBUGGING_INFO
-@item SDB_DEBUGGING_INFO
-Define this macro if GNU CC should produce COFF-style debugging output
-for SDB in response to the @samp{-g} option.
-
-@findex DWARF_DEBUGGING_INFO
-@item DWARF_DEBUGGING_INFO
-Define this macro if GNU CC should produce dwarf format debugging output
-in response to the @samp{-g} option.
-
-@findex DWARF2_DEBUGGING_INFO
-@item DWARF2_DEBUGGING_INFO
-Define this macro if GNU CC should produce dwarf version 2 format
-debugging output in response to the @samp{-g} option.
-
-@findex PUT_SDB_@dots{}
-@item PUT_SDB_@dots{}
-Define these macros to override the assembler syntax for the special
-SDB assembler directives. See @file{sdbout.c} for a list of these
-macros and their arguments. If the standard syntax is used, you need
-not define them yourself.
-
-@findex SDB_DELIM
-@item SDB_DELIM
-Some assemblers do not support a semicolon as a delimiter, even between
-SDB assembler directives. In that case, define this macro to be the
-delimiter to use (usually @samp{\n}). It is not necessary to define
-a new set of @code{PUT_SDB_@var{op}} macros if this is the only change
-required.
-
-@findex SDB_GENERATE_FAKE
-@item SDB_GENERATE_FAKE
-Define this macro to override the usual method of constructing a dummy
-name for anonymous structure and union types. See @file{sdbout.c} for
-more information.
-
-@findex SDB_ALLOW_UNKNOWN_REFERENCES
-@item SDB_ALLOW_UNKNOWN_REFERENCES
-Define this macro to allow references to unknown structure,
-union, or enumeration tags to be emitted. Standard COFF does not
-allow handling of unknown references, MIPS ECOFF has support for
-it.
-
-@findex SDB_ALLOW_FORWARD_REFERENCES
-@item SDB_ALLOW_FORWARD_REFERENCES
-Define this macro to allow references to structure, union, or
-enumeration tags that have not yet been seen to be handled. Some
-assemblers choke if forward tags are used, while some require it.
-@end table
-
-@node Cross-compilation
-@section Cross Compilation and Floating Point
-@cindex cross compilation and floating point
-@cindex floating point and cross compilation
-
-While all modern machines use 2's complement representation for integers,
-there are a variety of representations for floating point numbers. This
-means that in a cross-compiler the representation of floating point numbers
-in the compiled program may be different from that used in the machine
-doing the compilation.
-
-@findex atof
-Because different representation systems may offer different amounts of
-range and precision, the cross compiler cannot safely use the host
-machine's floating point arithmetic. Therefore, floating point constants
-must be represented in the target machine's format. This means that the
-cross compiler cannot use @code{atof} to parse a floating point constant;
-it must have its own special routine to use instead. Also, constant
-folding must emulate the target machine's arithmetic (or must not be done
-at all).
-
-The macros in the following table should be defined only if you are cross
-compiling between different floating point formats.
-
-Otherwise, don't define them. Then default definitions will be set up which
-use @code{double} as the data type, @code{==} to test for equality, etc.
-
-You don't need to worry about how many times you use an operand of any
-of these macros. The compiler never uses operands which have side effects.
-
-@table @code
-@findex REAL_VALUE_TYPE
-@item REAL_VALUE_TYPE
-A macro for the C data type to be used to hold a floating point value
-in the target machine's format. Typically this would be a
-@code{struct} containing an array of @code{int}.
-
-@findex REAL_VALUES_EQUAL
-@item REAL_VALUES_EQUAL (@var{x}, @var{y})
-A macro for a C expression which compares for equality the two values,
-@var{x} and @var{y}, both of type @code{REAL_VALUE_TYPE}.
-
-@findex REAL_VALUES_LESS
-@item REAL_VALUES_LESS (@var{x}, @var{y})
-A macro for a C expression which tests whether @var{x} is less than
-@var{y}, both values being of type @code{REAL_VALUE_TYPE} and
-interpreted as floating point numbers in the target machine's
-representation.
-
-@findex REAL_VALUE_LDEXP
-@findex ldexp
-@item REAL_VALUE_LDEXP (@var{x}, @var{scale})
-A macro for a C expression which performs the standard library
-function @code{ldexp}, but using the target machine's floating point
-representation. Both @var{x} and the value of the expression have
-type @code{REAL_VALUE_TYPE}. The second argument, @var{scale}, is an
-integer.
-
-@findex REAL_VALUE_FIX
-@item REAL_VALUE_FIX (@var{x})
-A macro whose definition is a C expression to convert the target-machine
-floating point value @var{x} to a signed integer. @var{x} has type
-@code{REAL_VALUE_TYPE}.
-
-@findex REAL_VALUE_UNSIGNED_FIX
-@item REAL_VALUE_UNSIGNED_FIX (@var{x})
-A macro whose definition is a C expression to convert the target-machine
-floating point value @var{x} to an unsigned integer. @var{x} has type
-@code{REAL_VALUE_TYPE}.
-
-@findex REAL_VALUE_RNDZINT
-@item REAL_VALUE_RNDZINT (@var{x})
-A macro whose definition is a C expression to round the target-machine
-floating point value @var{x} towards zero to an integer value (but still
-as a floating point number). @var{x} has type @code{REAL_VALUE_TYPE},
-and so does the value.
-
-@findex REAL_VALUE_UNSIGNED_RNDZINT
-@item REAL_VALUE_UNSIGNED_RNDZINT (@var{x})
-A macro whose definition is a C expression to round the target-machine
-floating point value @var{x} towards zero to an unsigned integer value
-(but still represented as a floating point number). @var{x} has type
-@code{REAL_VALUE_TYPE}, and so does the value.
-
-@findex REAL_VALUE_ATOF
-@item REAL_VALUE_ATOF (@var{string}, @var{mode})
-A macro for a C expression which converts @var{string}, an expression of
-type @code{char *}, into a floating point number in the target machine's
-representation for mode @var{mode}. The value has type
-@code{REAL_VALUE_TYPE}.
-
-@findex REAL_INFINITY
-@item REAL_INFINITY
-Define this macro if infinity is a possible floating point value, and
-therefore division by 0 is legitimate.
-
-@findex REAL_VALUE_ISINF
-@findex isinf
-@item REAL_VALUE_ISINF (@var{x})
-A macro for a C expression which determines whether @var{x}, a floating
-point value, is infinity. The value has type @code{int}.
-By default, this is defined to call @code{isinf}.
-
-@findex REAL_VALUE_ISNAN
-@findex isnan
-@item REAL_VALUE_ISNAN (@var{x})
-A macro for a C expression which determines whether @var{x}, a floating
-point value, is a ``nan'' (not-a-number). The value has type
-@code{int}. By default, this is defined to call @code{isnan}.
-@end table
-
-@cindex constant folding and floating point
-Define the following additional macros if you want to make floating
-point constant folding work while cross compiling. If you don't
-define them, cross compilation is still possible, but constant folding
-will not happen for floating point values.
-
-@table @code
-@findex REAL_ARITHMETIC
-@item REAL_ARITHMETIC (@var{output}, @var{code}, @var{x}, @var{y})
-A macro for a C statement which calculates an arithmetic operation of
-the two floating point values @var{x} and @var{y}, both of type
-@code{REAL_VALUE_TYPE} in the target machine's representation, to
-produce a result of the same type and representation which is stored
-in @var{output} (which will be a variable).
-
-The operation to be performed is specified by @var{code}, a tree code
-which will always be one of the following: @code{PLUS_EXPR},
-@code{MINUS_EXPR}, @code{MULT_EXPR}, @code{RDIV_EXPR},
-@code{MAX_EXPR}, @code{MIN_EXPR}.@refill
-
-@cindex overflow while constant folding
-The expansion of this macro is responsible for checking for overflow.
-If overflow happens, the macro expansion should execute the statement
-@code{return 0;}, which indicates the inability to perform the
-arithmetic operation requested.
-
-@findex REAL_VALUE_NEGATE
-@item REAL_VALUE_NEGATE (@var{x})
-A macro for a C expression which returns the negative of the floating
-point value @var{x}. Both @var{x} and the value of the expression
-have type @code{REAL_VALUE_TYPE} and are in the target machine's
-floating point representation.
-
-There is no way for this macro to report overflow, since overflow
-can't happen in the negation operation.
-
-@findex REAL_VALUE_TRUNCATE
-@item REAL_VALUE_TRUNCATE (@var{mode}, @var{x})
-A macro for a C expression which converts the floating point value
-@var{x} to mode @var{mode}.
-
-Both @var{x} and the value of the expression are in the target machine's
-floating point representation and have type @code{REAL_VALUE_TYPE}.
-However, the value should have an appropriate bit pattern to be output
-properly as a floating constant whose precision accords with mode
-@var{mode}.
-
-There is no way for this macro to report overflow.
-
-@findex REAL_VALUE_TO_INT
-@item REAL_VALUE_TO_INT (@var{low}, @var{high}, @var{x})
-A macro for a C expression which converts a floating point value
-@var{x} into a double-precision integer which is then stored into
-@var{low} and @var{high}, two variables of type @var{int}.
-
-@item REAL_VALUE_FROM_INT (@var{x}, @var{low}, @var{high}, @var{mode})
-@findex REAL_VALUE_FROM_INT
-A macro for a C expression which converts a double-precision integer
-found in @var{low} and @var{high}, two variables of type @var{int},
-into a floating point value which is then stored into @var{x}.
-The value is in the target machine's representation for mode @var{mode}
-and has the type @code{REAL_VALUE_TYPE}.
-@end table
-
-@node Misc
-@section Miscellaneous Parameters
-@cindex parameters, miscellaneous
-
-@c prevent bad page break with this line
-Here are several miscellaneous parameters.
-
-@table @code
-@item PREDICATE_CODES
-@findex PREDICATE_CODES
-Define this if you have defined special-purpose predicates in the file
-@file{@var{machine}.c}. This macro is called within an initializer of an
-array of structures. The first field in the structure is the name of a
-predicate and the second field is an array of rtl codes. For each
-predicate, list all rtl codes that can be in expressions matched by the
-predicate. The list should have a trailing comma. Here is an example
-of two entries in the list for a typical RISC machine:
-
-@smallexample
-#define PREDICATE_CODES \
- @{"gen_reg_rtx_operand", @{SUBREG, REG@}@}, \
- @{"reg_or_short_cint_operand", @{SUBREG, REG, CONST_INT@}@},
-@end smallexample
-
-Defining this macro does not affect the generated code (however,
-incorrect definitions that omit an rtl code that may be matched by the
-predicate can cause the compiler to malfunction). Instead, it allows
-the table built by @file{genrecog} to be more compact and efficient,
-thus speeding up the compiler. The most important predicates to include
-in the list specified by this macro are thoses used in the most insn
-patterns.
-
-@findex CASE_VECTOR_MODE
-@item CASE_VECTOR_MODE
-An alias for a machine mode name. This is the machine mode that
-elements of a jump-table should have.
-
-@findex CASE_VECTOR_PC_RELATIVE
-@item CASE_VECTOR_PC_RELATIVE
-Define this macro if jump-tables should contain relative addresses.
-
-@findex CASE_DROPS_THROUGH
-@item CASE_DROPS_THROUGH
-Define this if control falls through a @code{case} insn when the index
-value is out of range. This means the specified default-label is
-actually ignored by the @code{case} insn proper.
-
-@findex CASE_VALUES_THRESHOLD
-@item CASE_VALUES_THRESHOLD
-Define this to be the smallest number of different values for which it
-is best to use a jump-table instead of a tree of conditional branches.
-The default is four for machines with a @code{casesi} instruction and
-five otherwise. This is best for most machines.
-
-@findex WORD_REGISTER_OPERATIONS
-@item WORD_REGISTER_OPERATIONS
-Define this macro if operations between registers with integral mode
-smaller than a word are always performed on the entire register.
-Most RISC machines have this property and most CISC machines do not.
-
-@findex LOAD_EXTEND_OP
-@item LOAD_EXTEND_OP (@var{mode})
-Define this macro to be a C expression indicating when insns that read
-memory in @var{mode}, an integral mode narrower than a word, set the
-bits outside of @var{mode} to be either the sign-extension or the
-zero-extension of the data read. Return @code{SIGN_EXTEND} for values
-of @var{mode} for which the
-insn sign-extends, @code{ZERO_EXTEND} for which it zero-extends, and
-@code{NIL} for other modes.
-
-This macro is not called with @var{mode} non-integral or with a width
-greater than or equal to @code{BITS_PER_WORD}, so you may return any
-value in this case. Do not define this macro if it would always return
-@code{NIL}. On machines where this macro is defined, you will normally
-define it as the constant @code{SIGN_EXTEND} or @code{ZERO_EXTEND}.
-
-@findex IMPLICIT_FIX_EXPR
-@item IMPLICIT_FIX_EXPR
-An alias for a tree code that should be used by default for conversion
-of floating point values to fixed point. Normally,
-@code{FIX_ROUND_EXPR} is used.@refill
-
-@findex FIXUNS_TRUNC_LIKE_FIX_TRUNC
-@item FIXUNS_TRUNC_LIKE_FIX_TRUNC
-Define this macro if the same instructions that convert a floating
-point number to a signed fixed point number also convert validly to an
-unsigned one.
-
-@findex EASY_DIV_EXPR
-@item EASY_DIV_EXPR
-An alias for a tree code that is the easiest kind of division to
-compile code for in the general case. It may be
-@code{TRUNC_DIV_EXPR}, @code{FLOOR_DIV_EXPR}, @code{CEIL_DIV_EXPR} or
-@code{ROUND_DIV_EXPR}. These four division operators differ in how
-they round the result to an integer. @code{EASY_DIV_EXPR} is used
-when it is permissible to use any of those kinds of division and the
-choice should be made on the basis of efficiency.@refill
-
-@findex MOVE_MAX
-@item MOVE_MAX
-The maximum number of bytes that a single instruction can move quickly
-between memory and registers or between two memory locations.
-
-@findex MAX_MOVE_MAX
-@item MAX_MOVE_MAX
-The maximum number of bytes that a single instruction can move quickly
-between memory and registers or between two memory locations. If this
-is undefined, the default is @code{MOVE_MAX}. Otherwise, it is the
-constant value that is the largest value that @code{MOVE_MAX} can have
-at run-time.
-
-@findex SHIFT_COUNT_TRUNCATED
-@item SHIFT_COUNT_TRUNCATED
-A C expression that is nonzero if on this machine the number of bits
-actually used for the count of a shift operation is equal to the number
-of bits needed to represent the size of the object being shifted. When
-this macro is non-zero, the compiler will assume that it is safe to omit
-a sign-extend, zero-extend, and certain bitwise `and' instructions that
-truncates the count of a shift operation. On machines that have
-instructions that act on bitfields at variable positions, which may
-include `bit test' instructions, a nonzero @code{SHIFT_COUNT_TRUNCATED}
-also enables deletion of truncations of the values that serve as
-arguments to bitfield instructions.
-
-If both types of instructions truncate the count (for shifts) and
-position (for bitfield operations), or if no variable-position bitfield
-instructions exist, you should define this macro.
-
-However, on some machines, such as the 80386 and the 680x0, truncation
-only applies to shift operations and not the (real or pretended)
-bitfield operations. Define @code{SHIFT_COUNT_TRUNCATED} to be zero on
-such machines. Instead, add patterns to the @file{md} file that include
-the implied truncation of the shift instructions.
-
-You need not define this macro if it would always have the value of zero.
-
-@findex TRULY_NOOP_TRUNCATION
-@item TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
-A C expression which is nonzero if on this machine it is safe to
-``convert'' an integer of @var{inprec} bits to one of @var{outprec}
-bits (where @var{outprec} is smaller than @var{inprec}) by merely
-operating on it as if it had only @var{outprec} bits.
-
-On many machines, this expression can be 1.
-
-@c rearranged this, removed the phrase "it is reported that". this was
-@c to fix an overfull hbox. --mew 10feb93
-When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes for
-modes for which @code{MODES_TIEABLE_P} is 0, suboptimal code can result.
-If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 in
-such cases may improve things.
-
-@findex STORE_FLAG_VALUE
-@item STORE_FLAG_VALUE
-A C expression describing the value returned by a comparison operator
-with an integral mode and stored by a store-flag instruction
-(@samp{s@var{cond}}) when the condition is true. This description must
-apply to @emph{all} the @samp{s@var{cond}} patterns and all the
-comparison operators whose results have a @code{MODE_INT} mode.
-
-A value of 1 or -1 means that the instruction implementing the
-comparison operator returns exactly 1 or -1 when the comparison is true
-and 0 when the comparison is false. Otherwise, the value indicates
-which bits of the result are guaranteed to be 1 when the comparison is
-true. This value is interpreted in the mode of the comparison
-operation, which is given by the mode of the first operand in the
-@samp{s@var{cond}} pattern. Either the low bit or the sign bit of
-@code{STORE_FLAG_VALUE} be on. Presently, only those bits are used by
-the compiler.
-
-If @code{STORE_FLAG_VALUE} is neither 1 or -1, the compiler will
-generate code that depends only on the specified bits. It can also
-replace comparison operators with equivalent operations if they cause
-the required bits to be set, even if the remaining bits are undefined.
-For example, on a machine whose comparison operators return an
-@code{SImode} value and where @code{STORE_FLAG_VALUE} is defined as
-@samp{0x80000000}, saying that just the sign bit is relevant, the
-expression
-
-@smallexample
-(ne:SI (and:SI @var{x} (const_int @var{power-of-2})) (const_int 0))
-@end smallexample
-
-@noindent
-can be converted to
-
-@smallexample
-(ashift:SI @var{x} (const_int @var{n}))
-@end smallexample
-
-@noindent
-where @var{n} is the appropriate shift count to move the bit being
-tested into the sign bit.
-
-There is no way to describe a machine that always sets the low-order bit
-for a true value, but does not guarantee the value of any other bits,
-but we do not know of any machine that has such an instruction. If you
-are trying to port GNU CC to such a machine, include an instruction to
-perform a logical-and of the result with 1 in the pattern for the
-comparison operators and let us know
-@ifset USING
-(@pxref{Bug Reporting,,How to Report Bugs}).
-@end ifset
-@ifclear USING
-(@pxref{Bug Reporting,,How to Report Bugs,gcc.info,Using GCC}).
-@end ifclear
-
-Often, a machine will have multiple instructions that obtain a value
-from a comparison (or the condition codes). Here are rules to guide the
-choice of value for @code{STORE_FLAG_VALUE}, and hence the instructions
-to be used:
-
-@itemize @bullet
-@item
-Use the shortest sequence that yields a valid definition for
-@code{STORE_FLAG_VALUE}. It is more efficient for the compiler to
-``normalize'' the value (convert it to, e.g., 1 or 0) than for the
-comparison operators to do so because there may be opportunities to
-combine the normalization with other operations.
-
-@item
-For equal-length sequences, use a value of 1 or -1, with -1 being
-slightly preferred on machines with expensive jumps and 1 preferred on
-other machines.
-
-@item
-As a second choice, choose a value of @samp{0x80000001} if instructions
-exist that set both the sign and low-order bits but do not define the
-others.
-
-@item
-Otherwise, use a value of @samp{0x80000000}.
-@end itemize
-
-Many machines can produce both the value chosen for
-@code{STORE_FLAG_VALUE} and its negation in the same number of
-instructions. On those machines, you should also define a pattern for
-those cases, e.g., one matching
-
-@smallexample
-(set @var{A} (neg:@var{m} (ne:@var{m} @var{B} @var{C})))
-@end smallexample
-
-Some machines can also perform @code{and} or @code{plus} operations on
-condition code values with less instructions than the corresponding
-@samp{s@var{cond}} insn followed by @code{and} or @code{plus}. On those
-machines, define the appropriate patterns. Use the names @code{incscc}
-and @code{decscc}, respectively, for the patterns which perform
-@code{plus} or @code{minus} operations on condition code values. See
-@file{rs6000.md} for some examples. The GNU Superoptizer can be used to
-find such instruction sequences on other machines.
-
-You need not define @code{STORE_FLAG_VALUE} if the machine has no store-flag
-instructions.
-
-@findex FLOAT_STORE_FLAG_VALUE
-@item FLOAT_STORE_FLAG_VALUE
-A C expression that gives a non-zero floating point value that is
-returned when comparison operators with floating-point results are true.
-Define this macro on machine that have comparison operations that return
-floating-point values. If there are no such operations, do not define
-this macro.
-
-@findex Pmode
-@item Pmode
-An alias for the machine mode for pointers. On most machines, define
-this to be the integer mode corresponding to the width of a hardware
-pointer; @code{SImode} on 32-bit machine or @code{DImode} on 64-bit machines.
-On some machines you must define this to be one of the partial integer
-modes, such as @code{PSImode}.
-
-The width of @code{Pmode} must be at least as large as the value of
-@code{POINTER_SIZE}. If it is not equal, you must define the macro
-@code{POINTERS_EXTEND_UNSIGNED} to specify how pointers are extended
-to @code{Pmode}.
-
-@findex FUNCTION_MODE
-@item FUNCTION_MODE
-An alias for the machine mode used for memory references to functions
-being called, in @code{call} RTL expressions. On most machines this
-should be @code{QImode}.
-
-@findex INTEGRATE_THRESHOLD
-@item INTEGRATE_THRESHOLD (@var{decl})
-A C expression for the maximum number of instructions above which the
-function @var{decl} should not be inlined. @var{decl} is a
-@code{FUNCTION_DECL} node.
-
-The default definition of this macro is 64 plus 8 times the number of
-arguments that the function accepts. Some people think a larger
-threshold should be used on RISC machines.
-
-@findex SCCS_DIRECTIVE
-@item SCCS_DIRECTIVE
-Define this if the preprocessor should ignore @code{#sccs} directives
-and print no error message.
-
-@findex NO_IMPLICIT_EXTERN_C
-@item NO_IMPLICIT_EXTERN_C
-Define this macro if the system header files support C++ as well as C.
-This macro inhibits the usual method of using system header files in
-C++, which is to pretend that the file's contents are enclosed in
-@samp{extern "C" @{@dots{}@}}.
-
-@findex HANDLE_PRAGMA
-@findex #pragma
-@findex pragma
-@item HANDLE_PRAGMA (@var{stream}, @var{node})
-Define this macro if you want to implement any pragmas. If defined, it
-is a C expression whose value is 1 if the pragma was handled by the function.
-The argument @var{stream} is the stdio input stream from which the source text
-can be read. @var{node} is the tree node for the identifier after the
-@code{#pragma}.
-
-It is generally a bad idea to implement new uses of @code{#pragma}. The
-only reason to define this macro is for compatibility with other
-compilers that do support @code{#pragma} for the sake of any user
-programs which already use it.
-
-@findex VALID_MACHINE_DECL_ATTRIBUTE
-@item VALID_MACHINE_DECL_ATTRIBUTE (@var{decl}, @var{attributes}, @var{identifier}, @var{args})
-If defined, a C expression whose value is nonzero if @var{identifier} with
-arguments @var{args} is a valid machine specific attribute for @var{decl}.
-The attributes in @var{attributes} have previously been assigned to @var{decl}.
-
-@findex VALID_MACHINE_TYPE_ATTRIBUTE
-@item VALID_MACHINE_TYPE_ATTRIBUTE (@var{type}, @var{attributes}, @var{identifier}, @var{args})
-If defined, a C expression whose value is nonzero if @var{identifier} with
-arguments @var{args} is a valid machine specific attribute for @var{type}.
-The attributes in @var{attributes} have previously been assigned to @var{type}.
-
-@findex COMP_TYPE_ATTRIBUTES
-@item COMP_TYPE_ATTRIBUTES (@var{type1}, @var{type2})
-If defined, a C expression whose value is zero if the attributes on
-@var{type1} and @var{type2} are incompatible, one if they are compatible,
-and two if they are nearly compatible (which causes a warning to be
-generated).
-
-@findex SET_DEFAULT_TYPE_ATTRIBUTES
-@item SET_DEFAULT_TYPE_ATTRIBUTES (@var{type})
-If defined, a C statement that assigns default attributes to
-newly defined @var{type}.
-
-@findex DOLLARS_IN_IDENTIFIERS
-@item DOLLARS_IN_IDENTIFIERS
-Define this macro to control use of the character @samp{$} in identifier
-names. 0 means @samp{$} is not allowed by default; 1 means it is allowed.
-1 is the default; there is no need to define this macro in that case.
-This macro controls the compiler proper; it does not affect the preprocessor.
-
-@findex NO_DOLLAR_IN_LABEL
-@item NO_DOLLAR_IN_LABEL
-Define this macro if the assembler does not accept the character
-@samp{$} in label names. By default constructors and destructors in
-G++ have @samp{$} in the identifiers. If this macro is defined,
-@samp{.} is used instead.
-
-@findex NO_DOT_IN_LABEL
-@item NO_DOT_IN_LABEL
-Define this macro if the assembler does not accept the character
-@samp{.} in label names. By default constructors and destructors in G++
-have names that use @samp{.}. If this macro is defined, these names
-are rewritten to avoid @samp{.}.
-
-@findex DEFAULT_MAIN_RETURN
-@item DEFAULT_MAIN_RETURN
-Define this macro if the target system expects every program's @code{main}
-function to return a standard ``success'' value by default (if no other
-value is explicitly returned).
-
-The definition should be a C statement (sans semicolon) to generate the
-appropriate rtl instructions. It is used only when compiling the end of
-@code{main}.
-
-@item HAVE_ATEXIT
-@findex HAVE_ATEXIT
-Define this if the target system supports the function
-@code{atexit} from the ANSI C standard. If this is not defined,
-and @code{INIT_SECTION_ASM_OP} is not defined, a default
-@code{exit} function will be provided to support C++.
-
-@item EXIT_BODY
-@findex EXIT_BODY
-Define this if your @code{exit} function needs to do something
-besides calling an external function @code{_cleanup} before
-terminating with @code{_exit}. The @code{EXIT_BODY} macro is
-only needed if netiher @code{HAVE_ATEXIT} nor
-@code{INIT_SECTION_ASM_OP} are defined.
-
-@findex INSN_SETS_ARE_DELAYED
-@item INSN_SETS_ARE_DELAYED (@var{insn})
-Define this macro as a C expression that is nonzero if it is safe for the
-delay slot scheduler to place instructions in the delay slot of @var{insn},
-even if they appear to use a resource set or clobbered in @var{insn}.
-@var{insn} is always a @code{jump_insn} or an @code{insn}; GNU CC knows that
-every @code{call_insn} has this behavior. On machines where some @code{insn}
-or @code{jump_insn} is really a function call and hence has this behavior,
-you should define this macro.
-
-You need not define this macro if it would always return zero.
-
-@findex INSN_REFERENCES_ARE_DELAYED
-@item INSN_REFERENCES_ARE_DELAYED (@var{insn})
-Define this macro as a C expression that is nonzero if it is safe for the
-delay slot scheduler to place instructions in the delay slot of @var{insn},
-even if they appear to set or clobber a resource referenced in @var{insn}.
-@var{insn} is always a @code{jump_insn} or an @code{insn}. On machines where
-some @code{insn} or @code{jump_insn} is really a function call and its operands
-are registers whose use is actually in the subroutine it calls, you should
-define this macro. Doing so allows the delay slot scheduler to move
-instructions which copy arguments into the argument registers into the delay
-slot of @var{insn}.
-
-You need not define this macro if it would always return zero.
-
-@findex MACHINE_DEPENDENT_REORG
-@item MACHINE_DEPENDENT_REORG (@var{insn})
-In rare cases, correct code generation requires extra machine
-dependent processing between the second jump optimization pass and
-delayed branch scheduling. On those machines, define this macro as a C
-statement to act on the code starting at @var{insn}.
-
-@findex GIV_SORT_CRITERION
-@item GIV_SORT_CRITERION (@var{giv1}, @var{giv2})
-In some cases, the strength reduction optimization pass can produce better
-code if this is defined. This macro controls the order that induction
-variables are combined. This macro is particularly useful if the target has
-limited addressing modes. For instance, the SH target has only positive
-offsets in addresses. Thus sorting to put the smallest address first
-allows the most combinations to be found.
-
-@end table
diff --git a/gcc/toplev.c b/gcc/toplev.c
deleted file mode 100644
index 287e26b1021..00000000000
--- a/gcc/toplev.c
+++ /dev/null
@@ -1,4458 +0,0 @@
-/* Top level of GNU C compiler
- Copyright (C) 1987, 88, 89, 92-6, 1997 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 top level of cc1/c++.
- It parses command args, opens files, invokes the various passes
- in the proper order, and counts the time used by each.
- Error messages and low-level interface to malloc also handled here. */
-
-#include "config.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <stdio.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <sys/types.h>
-#include <ctype.h>
-#include <sys/stat.h>
-
-#ifndef _WIN32
-#ifdef USG
-#undef FLOAT
-#include <sys/param.h>
-/* This is for hpux. It is a real screw. They should change hpux. */
-#undef FLOAT
-#include <sys/times.h>
-#include <time.h> /* Correct for hpux at least. Is it good on other USG? */
-#undef FFS /* Some systems define this in param.h. */
-#else
-#ifndef VMS
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
-#endif
-#endif
-
-#include "input.h"
-#include "tree.h"
-#include "rtl.h"
-#include "flags.h"
-#include "insn-attr.h"
-#include "defaults.h"
-#include "output.h"
-#include "bytecode.h"
-#include "bc-emit.h"
-#include "except.h"
-
-#ifdef XCOFF_DEBUGGING_INFO
-#include "xcoffout.h"
-#endif
-
-#ifdef VMS
-/* The extra parameters substantially improve the I/O performance. */
-static FILE *
-vms_fopen (fname, type)
- char * fname;
- char * type;
-{
- /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
- fixed arguments, which matches ANSI's specification but not VAXCRTL's
- pre-ANSI implementation. This hack circumvents the mismatch problem. */
- FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
-
- if (*type == 'w')
- return (*vmslib_fopen) (fname, type, "mbc=32",
- "deq=64", "fop=tef", "shr=nil");
- else
- return (*vmslib_fopen) (fname, type, "mbc=32");
-}
-#define fopen vms_fopen
-#endif /* VMS */
-
-#ifndef DEFAULT_GDB_EXTENSIONS
-#define DEFAULT_GDB_EXTENSIONS 1
-#endif
-
-/* If more than one debugging type is supported, you must define
- PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
-
- This is one long line cause VAXC can't handle a \-newline. */
-#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
-#ifndef PREFERRED_DEBUGGING_TYPE
-You Lose! You must define PREFERRED_DEBUGGING_TYPE!
-#endif /* no PREFERRED_DEBUGGING_TYPE */
-#else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
- so the following code needn't care. */
-#ifdef DBX_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-#endif
-#ifdef SDB_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
-#endif
-#ifdef DWARF_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-#endif
-#ifdef XCOFF_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
-#endif
-#endif /* More than one debugger format enabled. */
-
-/* If still not defined, must have been because no debugging formats
- are supported. */
-#ifndef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE NO_DEBUG
-#endif
-
-extern int rtx_equal_function_value_matters;
-
-#if ! (defined (VMS) || defined (OS2))
-extern char **environ;
-#endif
-extern char *version_string, *language_string;
-
-/* Carry information from ASM_DECLARE_OBJECT_NAME
- to ASM_FINISH_DECLARE_OBJECT. */
-
-extern int size_directive_output;
-extern tree last_assemble_variable_decl;
-
-extern void init_lex ();
-extern void init_decl_processing ();
-extern void init_obstacks ();
-extern void init_tree_codes ();
-extern void init_rtl ();
-extern void init_regs ();
-extern void init_optabs ();
-extern void init_stmt ();
-extern void init_reg_sets ();
-extern void dump_flow_info ();
-extern void dump_sched_info ();
-extern void dump_local_alloc ();
-
-void rest_of_decl_compilation ();
-void error_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
-void error_with_decl PVPROTO((tree decl, char *s, ...));
-void error_for_asm PVPROTO((rtx insn, char *s, ...));
-void error PVPROTO((char *s, ...));
-void fatal PVPROTO((char *s, ...));
-void warning_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
-void warning_with_decl PVPROTO((tree decl, char *s, ...));
-void warning_for_asm PVPROTO((rtx insn, char *s, ...));
-void warning PVPROTO((char *s, ...));
-void pedwarn PVPROTO((char *s, ...));
-void pedwarn_with_decl PVPROTO((tree decl, char *s, ...));
-void pedwarn_with_file_and_line PVPROTO((char *file, int line, char *s, ...));
-void sorry PVPROTO((char *s, ...));
-void really_sorry PVPROTO((char *s, ...));
-void fancy_abort ();
-#ifndef abort
-void abort ();
-#endif
-void set_target_switch ();
-static char *decl_name ();
-
-void print_version ();
-int print_single_switch ();
-void print_switch_values ();
-/* Length of line when printing switch values. */
-#define MAX_LINE 75
-
-#ifdef __alpha
-extern char *sbrk ();
-#endif
-
-/* Name of program invoked, sans directories. */
-
-char *progname;
-
-/* Copy of arguments to main. */
-int save_argc;
-char **save_argv;
-
-/* Name of current original source file (what was input to cpp).
- This comes from each #-command in the actual input. */
-
-char *input_filename;
-
-/* Name of top-level original source file (what was input to cpp).
- This comes from the #-command at the beginning of the actual input.
- If there isn't any there, then this is the cc1 input file name. */
-
-char *main_input_filename;
-
-/* Stream for reading from the input file. */
-
-FILE *finput;
-
-/* Current line number in real source file. */
-
-int lineno;
-
-/* Stack of currently pending input files. */
-
-struct file_stack *input_file_stack;
-
-/* Incremented on each change to input_file_stack. */
-int input_file_stack_tick;
-
-/* FUNCTION_DECL for function now being parsed or compiled. */
-
-extern tree current_function_decl;
-
-/* Name to use as base of names for dump output files. */
-
-char *dump_base_name;
-
-/* Bit flags that specify the machine subtype we are compiling for.
- Bits are tested using macros TARGET_... defined in the tm.h file
- and set by `-m...' switches. Must be defined in rtlanal.c. */
-
-extern int target_flags;
-
-/* Flags saying which kinds of debugging dump have been requested. */
-
-int rtl_dump = 0;
-int rtl_dump_and_exit = 0;
-int jump_opt_dump = 0;
-int cse_dump = 0;
-int loop_dump = 0;
-int cse2_dump = 0;
-int branch_prob_dump = 0;
-int flow_dump = 0;
-int combine_dump = 0;
-int sched_dump = 0;
-int local_reg_dump = 0;
-int global_reg_dump = 0;
-int sched2_dump = 0;
-int jump2_opt_dump = 0;
-int dbr_sched_dump = 0;
-int flag_print_asm_name = 0;
-int stack_reg_dump = 0;
-
-/* Name for output file of assembly code, specified with -o. */
-
-char *asm_file_name;
-
-/* Value of the -G xx switch, and whether it was passed or not. */
-int g_switch_value;
-int g_switch_set;
-
-/* Type(s) of debugging information we are producing (if any).
- See flags.h for the definitions of the different possible
- types of debugging information. */
-enum debug_info_type write_symbols = NO_DEBUG;
-
-/* 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;
-
-/* Nonzero means use GNU-only extensions in the generated symbolic
- debugging information. */
-/* Currently, this only has an effect when write_symbols is set to
- DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
-int use_gnu_debug_info_extensions = 0;
-
-/* Nonzero means do optimizations. -O.
- Particular numeric values stand for particular amounts of optimization;
- thus, -O2 stores 2 here. However, the optimizations beyond the basic
- ones are not controlled directly by this variable. Instead, they are
- controlled by individual `flag_...' variables that are defaulted
- based on this variable. */
-
-int optimize = 0;
-
-/* Number of error messages and warning messages so far. */
-
-int errorcount = 0;
-int warningcount = 0;
-int sorrycount = 0;
-
-/* Flag to output bytecode instead of native assembler */
-int output_bytecode = 0;
-
-/* Pointer to function to compute the name to use to print a declaration.
- DECL is the declaration in question.
- VERBOSITY determines what information will be printed:
- 0: DECL_NAME, demangled as necessary.
- 1: and scope information.
- 2: and any other information that might be interesting, such as function
- parameter types in C++. */
-
-char *(*decl_printable_name) (/* tree decl, int verbosity */);
-
-/* Pointer to function to compute rtl for a language-specific tree code. */
-
-struct rtx_def *(*lang_expand_expr) ();
-
-/* Pointer to function to finish handling an incomplete decl at the
- end of compilation. */
-
-void (*incomplete_decl_finalize_hook) () = 0;
-
-/* Highest label number used at the end of reload. */
-
-int max_label_num_after_reload;
-
-/* Nonzero if generating code to do profiling. */
-
-int profile_flag = 0;
-
-/* Nonzero if generating code to do profiling on a line-by-line basis. */
-
-int profile_block_flag;
-
-/* Nonzero if generating code to profile program flow graph arcs. */
-
-int profile_arc_flag = 0;
-
-/* Nonzero if generating info for gcov to calculate line test coverage. */
-
-int flag_test_coverage = 0;
-
-/* Nonzero indicates that branch taken probabilities should be calculated. */
-
-int flag_branch_probabilities = 0;
-
-/* Nonzero for -pedantic switch: warn about anything
- that standard spec forbids. */
-
-int pedantic = 0;
-
-/* Temporarily suppress certain warnings.
- This is set while reading code from a system header file. */
-
-int in_system_header = 0;
-
-/* Nonzero means do stupid register allocation.
- Currently, this is 1 if `optimize' is 0. */
-
-int obey_regdecls = 0;
-
-/* Don't print functions as they are compiled and don't print
- times taken by the various passes. -quiet. */
-
-int quiet_flag = 0;
-
-/* -f flags. */
-
-/* Nonzero means `char' should be signed. */
-
-int flag_signed_char;
-
-/* Nonzero means give an enum type only as many bytes as it needs. */
-
-int flag_short_enums;
-
-/* 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. */
-
-#ifdef DEFAULT_CALLER_SAVES
-int flag_caller_saves = 1;
-#else
-int flag_caller_saves = 0;
-#endif
-
-/* Nonzero if structures and unions should be returned in memory.
-
- This should only be defined if compatibility with another compiler or
- with an ABI is needed, because it results in slower code. */
-
-#ifndef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 1
-#endif
-
-/* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
-
-int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
-
-/* Nonzero for -fforce-mem: load memory value into a register
- before arithmetic on it. This makes better cse but slower compilation. */
-
-int flag_force_mem = 0;
-
-/* Nonzero for -fforce-addr: load memory address into a register before
- reference to memory. This makes better cse but slower compilation. */
-
-int flag_force_addr = 0;
-
-/* Nonzero for -fdefer-pop: don't pop args after each function call;
- instead save them up to pop many calls' args with one insns. */
-
-int flag_defer_pop = 0;
-
-/* Nonzero for -ffloat-store: don't allocate floats and doubles
- in extended-precision registers. */
-
-int flag_float_store = 0;
-
-/* Nonzero for -fcse-follow-jumps:
- have cse follow jumps to do a more extensive job. */
-
-int flag_cse_follow_jumps;
-
-/* Nonzero for -fcse-skip-blocks:
- have cse follow a branch around a block. */
-int flag_cse_skip_blocks;
-
-/* Nonzero for -fexpensive-optimizations:
- perform miscellaneous relatively-expensive optimizations. */
-int flag_expensive_optimizations;
-
-/* Nonzero for -fthread-jumps:
- have jump optimize output of loop. */
-
-int flag_thread_jumps;
-
-/* Nonzero enables strength-reduction in loop.c. */
-
-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_unroll_loops;
-
-/* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
- This is generally not a win. */
-
-int flag_unroll_all_loops;
-
-/* Nonzero for -fwritable-strings:
- store string constants in data segment and don't uniquize them. */
-
-int flag_writable_strings = 0;
-
-/* Nonzero means don't put addresses of constant functions in registers.
- Used for compiling the Unix kernel, where strange substitutions are
- done on the assembly output. */
-
-int flag_no_function_cse = 0;
-
-/* Nonzero for -fomit-frame-pointer:
- don't make a frame pointer in simple functions that don't require one. */
-
-int flag_omit_frame_pointer = 0;
-
-/* Nonzero means place each function into its own section on those platforms
- which support arbitrary section names and unlimited numbers of sections. */
-
-int flag_function_sections = 0;
-
-/* Nonzero to inhibit use of define_optimization peephole opts. */
-
-int flag_no_peephole = 0;
-
-/* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
- operations in the interest of optimization. For example it allows
- GCC to assume arguments to sqrt are nonnegative numbers, allowing
- faster code for sqrt to be generated. */
-
-int flag_fast_math = 0;
-
-/* Nonzero means all references through pointers are volatile. */
-
-int flag_volatile;
-
-/* Nonzero means treat all global and extern variables as global. */
-
-int flag_volatile_global;
-
-/* Nonzero means just do syntax checking; don't output anything. */
-
-int flag_syntax_only = 0;
-
-/* Nonzero means to rerun cse after loop optimization. This increases
- compilation time about 20% and picks up a few more common expressions. */
-
-static int flag_rerun_cse_after_loop;
-
-/* Nonzero for -finline-functions: ok to inline functions that look like
- good inline candidates. */
-
-int flag_inline_functions;
-
-/* Nonzero for -fkeep-inline-functions: even if we make a function
- go inline everywhere, keep its definition around for debugging
- purposes. */
-
-int flag_keep_inline_functions;
-
-/* Nonzero means that functions will not be inlined. */
-
-int flag_no_inline;
-
-/* Nonzero means that we should emit static const variables
- regardless of whether or not optimization is turned on. */
-
-int flag_keep_static_consts = 1;
-
-/* Nonzero means we should be saving declaration info into a .X file. */
-
-int flag_gen_aux_info = 0;
-
-/* Specified name of aux-info file. */
-
-static char *aux_info_file_name;
-
-/* Nonzero means make the text shared if supported. */
-
-int flag_shared_data;
-
-/* Nonzero means schedule into delayed branch slots if supported. */
-
-int flag_delayed_branch;
-
-/* Nonzero means to run cleanups after CALL_EXPRs. */
-
-int flag_short_temps;
-
-/* Nonzero if we are compiling pure (sharable) code.
- Value is 1 if we are doing reasonable (i.e. simple
- offset into offset table) pic. Value is 2 if we can
- only perform register offsets. */
-
-int flag_pic;
-
-/* Nonzero means generate extra code for exception handling and enable
- exception handling. */
-
-int flag_exceptions = 1;
-
-/* Nonzero means don't place uninitialized global data in common storage
- by default. */
-
-int flag_no_common;
-
-/* Nonzero means pretend it is OK to examine bits of target floats,
- even if that isn't true. The resulting code will have incorrect constants,
- but the same series of instructions that the native compiler would make. */
-
-int flag_pretend_float;
-
-/* Nonzero means change certain warnings into errors.
- Usually these are warnings about failure to conform to some standard. */
-
-int flag_pedantic_errors = 0;
-
-/* flag_schedule_insns means schedule insns within basic blocks (before
- local_alloc).
- flag_schedule_insns_after_reload means schedule insns after
- global_alloc. */
-
-int flag_schedule_insns = 0;
-int flag_schedule_insns_after_reload = 0;
-
-/* -finhibit-size-directive inhibits output of .size for ELF.
- This is used only for compiling crtstuff.c,
- and it may be extended to other effects
- needed for crtstuff.c on other systems. */
-int flag_inhibit_size_directive = 0;
-
-/* -fverbose-asm causes extra commentary information to be produced 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).
- -fverbose-asm is the default. -fno-verbose-asm causes the extra information
- to be omitted and is useful when comparing two assembler files. */
-
-int flag_verbose_asm = 1;
-
-/* -dA causes debug commentary information to be produced 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).
- Currently, this switch is only used by dwarfout.c; however, it is intended
- to be a catchall for printing debug information in the assembler file. */
-
-int flag_debug_asm = 0;
-
-/* -fgnu-linker specifies use of the GNU linker for initializations.
- (Or, more generally, a linker that handles initializations.)
- -fno-gnu-linker says that collect2 will be used. */
-#ifdef USE_COLLECT2
-int flag_gnu_linker = 0;
-#else
-int flag_gnu_linker = 1;
-#endif
-
-/* Tag all structures with __attribute__(packed) */
-int flag_pack_struct = 0;
-
-/* Table of language-independent -f options.
- STRING is the option name. VARIABLE is the address of the variable.
- ON_VALUE is the value to store in VARIABLE
- if `-fSTRING' is seen as an option.
- (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
-
-struct { char *string; int *variable; int on_value;} f_options[] =
-{
- {"float-store", &flag_float_store, 1},
- {"volatile", &flag_volatile, 1},
- {"volatile-global", &flag_volatile_global, 1},
- {"defer-pop", &flag_defer_pop, 1},
- {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
- {"cse-follow-jumps", &flag_cse_follow_jumps, 1},
- {"cse-skip-blocks", &flag_cse_skip_blocks, 1},
- {"expensive-optimizations", &flag_expensive_optimizations, 1},
- {"thread-jumps", &flag_thread_jumps, 1},
- {"strength-reduce", &flag_strength_reduce, 1},
- {"unroll-loops", &flag_unroll_loops, 1},
- {"unroll-all-loops", &flag_unroll_all_loops, 1},
- {"writable-strings", &flag_writable_strings, 1},
- {"peephole", &flag_no_peephole, 0},
- {"force-mem", &flag_force_mem, 1},
- {"force-addr", &flag_force_addr, 1},
- {"function-cse", &flag_no_function_cse, 0},
- {"inline-functions", &flag_inline_functions, 1},
- {"keep-inline-functions", &flag_keep_inline_functions, 1},
- {"inline", &flag_no_inline, 0},
- {"keep-static-consts", &flag_keep_static_consts, 1},
- {"syntax-only", &flag_syntax_only, 1},
- {"shared-data", &flag_shared_data, 1},
- {"caller-saves", &flag_caller_saves, 1},
- {"pcc-struct-return", &flag_pcc_struct_return, 1},
- {"reg-struct-return", &flag_pcc_struct_return, 0},
- {"delayed-branch", &flag_delayed_branch, 1},
- {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
- {"pretend-float", &flag_pretend_float, 1},
- {"schedule-insns", &flag_schedule_insns, 1},
- {"schedule-insns2", &flag_schedule_insns_after_reload, 1},
- {"pic", &flag_pic, 1},
- {"PIC", &flag_pic, 2},
- {"exceptions", &flag_exceptions, 1},
- {"profile-arcs", &profile_arc_flag, 1},
- {"test-coverage", &flag_test_coverage, 1},
- {"branch-probabilities", &flag_branch_probabilities, 1},
- {"fast-math", &flag_fast_math, 1},
- {"common", &flag_no_common, 0},
- {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
- {"function-sections", &flag_function_sections, 1},
- {"verbose-asm", &flag_verbose_asm, 1},
- {"gnu-linker", &flag_gnu_linker, 1},
- {"pack-struct", &flag_pack_struct, 1},
- {"bytecode", &output_bytecode, 1}
-};
-
-/* Table of language-specific options. */
-
-char *lang_options[] =
-{
- "-ansi",
- "-fallow-single-precision",
-
- "-fsigned-bitfields",
- "-funsigned-bitfields",
- "-fno-signed-bitfields",
- "-fno-unsigned-bitfields",
- "-fsigned-char",
- "-funsigned-char",
- "-fno-signed-char",
- "-fno-unsigned-char",
-
- "-ftraditional",
- "-traditional",
- "-fnotraditional",
- "-fno-traditional",
-
- "-fasm",
- "-fno-asm",
- "-fbuiltin",
- "-fno-builtin",
- "-fhosted",
- "-fno-hosted",
- "-ffreestanding",
- "-fno-freestanding",
- "-fcond-mismatch",
- "-fno-cond-mismatch",
- "-fdollars-in-identifiers",
- "-fno-dollars-in-identifiers",
- "-fident",
- "-fno-ident",
- "-fshort-double",
- "-fno-short-double",
- "-fshort-enums",
- "-fno-short-enums",
-
- "-Wall",
- "-Wbad-function-cast",
- "-Wno-bad-function-cast",
- "-Wcast-qual",
- "-Wno-cast-qual",
- "-Wchar-subscripts",
- "-Wno-char-subscripts",
- "-Wcomment",
- "-Wno-comment",
- "-Wcomments",
- "-Wno-comments",
- "-Wconversion",
- "-Wno-conversion",
- "-Wformat",
- "-Wno-format",
- "-Wimport",
- "-Wno-import",
- "-Wimplicit",
- "-Wno-implicit",
- "-Wmain",
- "-Wno-main",
- "-Wmissing-braces",
- "-Wno-missing-braces",
- "-Wmissing-declarations",
- "-Wno-missing-declarations",
- "-Wmissing-prototypes",
- "-Wno-missing-prototypes",
- "-Wnested-externs",
- "-Wno-nested-externs",
- "-Wparentheses",
- "-Wno-parentheses",
- "-Wpointer-arith",
- "-Wno-pointer-arith",
- "-Wredundant-decls",
- "-Wno-redundant-decls",
- "-Wsign-compare",
- "-Wno-sign-compare",
- "-Wstrict-prototypes",
- "-Wno-strict-prototypes",
- "-Wtraditional",
- "-Wno-traditional",
- "-Wtrigraphs",
- "-Wno-trigraphs",
- "-Wwrite-strings",
- "-Wno-write-strings",
-
- /* these are for obj c */
- "-lang-objc",
- "-gen-decls",
- "-fgnu-runtime",
- "-fno-gnu-runtime",
- "-fnext-runtime",
- "-fno-next-runtime",
- "-Wselector",
- "-Wno-selector",
- "-Wprotocol",
- "-Wno-protocol",
-
-#include "options.h"
- 0
-};
-
-/* Options controlling warnings */
-
-/* Don't print warning messages. -w. */
-
-int inhibit_warnings = 0;
-
-/* Print various extra warnings. -W. */
-
-int extra_warnings = 0;
-
-/* Treat warnings as errors. -Werror. */
-
-int warnings_are_errors = 0;
-
-/* Nonzero to warn about unused local variables. */
-
-int warn_unused;
-
-/* Nonzero to warn about variables used before they are initialized. */
-
-int warn_uninitialized;
-
-/* Nonzero means warn about all declarations which shadow others. */
-
-int warn_shadow;
-
-/* Warn if a switch on an enum fails to have a case for every enum value. */
-
-int warn_switch;
-
-/* Nonzero means warn about function definitions that default the return type
- or that use a null return and have a return-type other than void. */
-
-int warn_return_type;
-
-/* Nonzero means warn about pointer casts that increase the required
- alignment of the target type (and might therefore lead to a crash
- due to a misaligned access). */
-
-int warn_cast_align;
-
-/* Nonzero means warn about any identifiers that match in the first N
- characters. The value N is in `id_clash_len'. */
-
-int warn_id_clash;
-unsigned id_clash_len;
-
-/* Nonzero means warn about any objects definitions whose size is larger
- than N bytes. Also want about function definitions whose returned
- values are larger than N bytes. The value N is in `larger_than_size'. */
-
-int warn_larger_than;
-unsigned larger_than_size;
-
-/* Nonzero means warn if inline function is too large. */
-
-int warn_inline;
-
-/* Warn if a function returns an aggregate,
- since there are often incompatible calling conventions for doing this. */
-
-int warn_aggregate_return;
-
-/* Likewise for -W. */
-
-struct { char *string; int *variable; int on_value;} W_options[] =
-{
- {"unused", &warn_unused, 1},
- {"error", &warnings_are_errors, 1},
- {"shadow", &warn_shadow, 1},
- {"switch", &warn_switch, 1},
- {"aggregate-return", &warn_aggregate_return, 1},
- {"cast-align", &warn_cast_align, 1},
- {"uninitialized", &warn_uninitialized, 1},
- {"inline", &warn_inline, 1}
-};
-
-/* Output files for assembler code (real compiler output)
- and debugging dumps. */
-
-FILE *asm_out_file;
-FILE *aux_info_file;
-FILE *rtl_dump_file;
-FILE *jump_opt_dump_file;
-FILE *cse_dump_file;
-FILE *loop_dump_file;
-FILE *cse2_dump_file;
-FILE *branch_prob_dump_file;
-FILE *flow_dump_file;
-FILE *combine_dump_file;
-FILE *sched_dump_file;
-FILE *local_reg_dump_file;
-FILE *global_reg_dump_file;
-FILE *sched2_dump_file;
-FILE *jump2_opt_dump_file;
-FILE *dbr_sched_dump_file;
-FILE *stack_reg_dump_file;
-
-/* Time accumulators, to count the total time spent in various passes. */
-
-int parse_time;
-int varconst_time;
-int integration_time;
-int jump_time;
-int cse_time;
-int loop_time;
-int cse2_time;
-int branch_prob_time;
-int flow_time;
-int combine_time;
-int sched_time;
-int local_alloc_time;
-int global_alloc_time;
-int sched2_time;
-int dbr_sched_time;
-int shorten_branch_time;
-int stack_reg_time;
-int final_time;
-int symout_time;
-int dump_time;
-
-/* Return time used so far, in microseconds. */
-
-int
-get_run_time ()
-{
-#ifndef _WIN32
-#ifdef USG
- struct tms tms;
-#else
-#ifndef VMS
- struct rusage rusage;
-#else
- struct
- {
- int proc_user_time;
- int proc_system_time;
- int child_user_time;
- int child_system_time;
- } vms_times;
-#endif
-#endif
-#endif
-
- if (quiet_flag)
- return 0;
-#ifdef _WIN32
- if (clock() < 0)
- return 0;
- else
- return (clock() * 1000);
-#else /* not _WIN32 */
-#ifdef USG
- times (&tms);
- return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
-#else
-#ifndef VMS
- getrusage (0, &rusage);
- return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
- + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
-#else /* VMS */
- times (&vms_times);
- return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
-#endif
-#endif
-#endif
-}
-
-#define TIMEVAR(VAR, BODY) \
-do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
-
-void
-print_time (str, total)
- char *str;
- int total;
-{
- fprintf (stderr,
- "time in %s: %d.%06d\n",
- str, total / 1000000, total % 1000000);
-}
-
-/* Count an error or warning. Return 1 if the message should be printed. */
-
-int
-count_error (warningp)
- int warningp;
-{
- if (warningp && inhibit_warnings)
- return 0;
-
- if (warningp && !warnings_are_errors)
- warningcount++;
- else
- {
- static int warning_message = 0;
-
- if (warningp && !warning_message)
- {
- fprintf (stderr, "%s: warnings being treated as errors\n", progname);
- warning_message = 1;
- }
- errorcount++;
- }
-
- return 1;
-}
-
-/* Print a fatal error message. NAME is the text.
- Also include a system error message based on `errno'. */
-
-void
-pfatal_with_name (name)
- char *name;
-{
- fprintf (stderr, "%s: ", progname);
- perror (name);
- exit (FATAL_EXIT_CODE);
-}
-
-void
-fatal_io_error (name)
- char *name;
-{
- fprintf (stderr, "%s: %s: I/O error\n", progname, name);
- exit (FATAL_EXIT_CODE);
-}
-
-/* Called to give a better error message for a bad insn rather than
- just calling abort(). */
-
-void
-fatal_insn (message, insn)
- char *message;
- rtx insn;
-{
- if (!output_bytecode)
- {
- error (message);
- debug_rtx (insn);
- }
- if (asm_out_file)
- fflush (asm_out_file);
- if (aux_info_file)
- fflush (aux_info_file);
- if (rtl_dump_file)
- fflush (rtl_dump_file);
- if (jump_opt_dump_file)
- fflush (jump_opt_dump_file);
- if (cse_dump_file)
- fflush (cse_dump_file);
- if (loop_dump_file)
- fflush (loop_dump_file);
- if (cse2_dump_file)
- fflush (cse2_dump_file);
- if (flow_dump_file)
- fflush (flow_dump_file);
- if (combine_dump_file)
- fflush (combine_dump_file);
- if (sched_dump_file)
- fflush (sched_dump_file);
- if (local_reg_dump_file)
- fflush (local_reg_dump_file);
- if (global_reg_dump_file)
- fflush (global_reg_dump_file);
- if (sched2_dump_file)
- fflush (sched2_dump_file);
- if (jump2_opt_dump_file)
- fflush (jump2_opt_dump_file);
- if (dbr_sched_dump_file)
- fflush (dbr_sched_dump_file);
- if (stack_reg_dump_file)
- fflush (stack_reg_dump_file);
- fflush (stdout);
- fflush (stderr);
- abort ();
-}
-
-/* Called to give a better error message when we don't have an insn to match
- what we are looking for or if the insn's constraints aren't satisfied,
- rather than just calling abort(). */
-
-void
-fatal_insn_not_found (insn)
- rtx insn;
-{
- if (INSN_CODE (insn) < 0)
- fatal_insn ("internal error--unrecognizable insn:", insn);
- else
- fatal_insn ("internal error--insn does not satisfy its constraints:", insn);
-}
-
-/* This is the default decl_printable_name function. */
-
-static char *
-decl_name (decl, verbosity)
- tree decl;
- int verbosity;
-{
- return IDENTIFIER_POINTER (DECL_NAME (decl));
-}
-
-static int need_error_newline;
-
-/* Function of last error message;
- more generally, function such that if next error message is in it
- then we don't have to mention the function name. */
-static tree last_error_function = NULL;
-
-/* Used to detect when input_file_stack has changed since last described. */
-static int last_error_tick;
-
-/* Called when the start of a function definition is parsed,
- this function prints on stderr the name of the function. */
-
-void
-announce_function (decl)
- tree decl;
-{
- if (! quiet_flag)
- {
- if (rtl_dump_and_exit)
- fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
- else
- fprintf (stderr, " %s", (*decl_printable_name) (decl, 2));
- fflush (stderr);
- need_error_newline = 1;
- last_error_function = current_function_decl;
- }
-}
-
-/* The default function to print out name of current function that caused
- an error. */
-
-void
-default_print_error_function (file)
- char *file;
-{
- if (last_error_function != current_function_decl)
- {
- char *kind = "function";
- if (current_function_decl != 0
- && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
- kind = "method";
-
- if (file)
- fprintf (stderr, "%s: ", file);
-
- if (current_function_decl == NULL)
- fprintf (stderr, "At top level:\n");
- else
- {
- char *name = (*decl_printable_name) (current_function_decl, 2);
- fprintf (stderr, "In %s `%s':\n", kind, name);
- }
-
- last_error_function = current_function_decl;
- }
-}
-
-/* Called by report_error_function to print out function name.
- * Default may be overridden by language front-ends. */
-
-void (*print_error_function) PROTO((char *)) = default_print_error_function;
-
-/* Prints out, if necessary, the name of the current function
- that caused an error. Called from all error and warning functions. */
-
-void
-report_error_function (file)
- char *file;
-{
- struct file_stack *p;
-
- if (need_error_newline)
- {
- fprintf (stderr, "\n");
- need_error_newline = 0;
- }
-
- (*print_error_function) (file);
-
- if (input_file_stack && input_file_stack->next != 0
- && input_file_stack_tick != last_error_tick
- && file == input_filename)
- {
- fprintf (stderr, "In file included");
- for (p = input_file_stack->next; p; p = p->next)
- {
- fprintf (stderr, " from %s:%d", p->name, p->line);
- if (p->next)
- fprintf (stderr, ",\n ");
- }
- fprintf (stderr, ":\n");
- last_error_tick = input_file_stack_tick;
- }
-}
-
-/* Print a message. */
-
-static void
-vmessage (prefix, s, ap)
- char *prefix;
- char *s;
- va_list ap;
-{
- if (prefix)
- fprintf (stderr, "%s: ", prefix);
-
-#ifdef HAVE_VPRINTF
- vfprintf (stderr, s, ap);
-#else
- {
- HOST_WIDE_INT v1 = va_arg(ap, HOST_WIDE_INT);
- HOST_WIDE_INT v2 = va_arg(ap, HOST_WIDE_INT);
- HOST_WIDE_INT v3 = va_arg(ap, HOST_WIDE_INT);
- HOST_WIDE_INT v4 = va_arg(ap, HOST_WIDE_INT);
- fprintf (stderr, s, v1, v2, v3, v4);
- }
-#endif
-}
-
-/* Print a message relevant to line LINE of file FILE. */
-
-static void
-v_message_with_file_and_line (file, line, prefix, s, ap)
- char *file;
- int line;
- char *prefix;
- char *s;
- va_list ap;
-{
- if (file)
- fprintf (stderr, "%s:%d: ", file, line);
- else
- fprintf (stderr, "%s: ", progname);
-
- vmessage (prefix, s, ap);
- fputc ('\n', stderr);
-}
-
-/* Print a message relevant to the given DECL. */
-
-static void
-v_message_with_decl (decl, prefix, s, ap)
- tree decl;
- char *prefix;
- char *s;
- va_list ap;
-{
- char *n, *p;
-
- fprintf (stderr, "%s:%d: ",
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
-
- if (prefix)
- fprintf (stderr, "%s: ", prefix);
-
- /* Do magic to get around lack of varargs support for insertion
- of arguments into existing list. We know that the decl is first;
- we ass_u_me that it will be printed with "%s". */
-
- for (p = s; *p; ++p)
- {
- if (*p == '%')
- {
- if (*(p + 1) == '%')
- ++p;
- else
- break;
- }
- }
-
- if (p > s) /* Print the left-hand substring. */
- {
- char fmt[sizeof "%.255s"];
- long width = p - s;
-
- if (width > 255L) width = 255L; /* arbitrary */
- sprintf (fmt, "%%.%lds", width);
- fprintf (stderr, fmt, s);
- }
-
- if (*p == '%') /* Print the name. */
- {
- char *n = (DECL_NAME (decl)
- ? (*decl_printable_name) (decl, 2)
- : "((anonymous))");
- fputs (n, stderr);
- while (*p)
- {
- ++p;
- if (isalpha (*(p - 1) & 0xFF))
- break;
- }
- }
-
- if (*p) /* Print the rest of the message. */
- vmessage ((char *)NULL, p, ap);
-
- fputc ('\n', stderr);
-}
-
-/* Figure file and line of the given INSN. */
-
-static void
-file_and_line_for_asm (insn, pfile, pline)
- rtx insn;
- char **pfile;
- int *pline;
-{
- rtx body = PATTERN (insn);
- rtx asmop;
-
- /* Find the (or one of the) ASM_OPERANDS in the insn. */
- if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
- asmop = SET_SRC (body);
- else if (GET_CODE (body) == ASM_OPERANDS)
- asmop = body;
- else if (GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == SET)
- asmop = SET_SRC (XVECEXP (body, 0, 0));
- else if (GET_CODE (body) == PARALLEL
- && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
- asmop = XVECEXP (body, 0, 0);
- else
- asmop = NULL;
-
- if (asmop)
- {
- *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
- *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
- }
- else
- {
- *pfile = input_filename;
- *pline = lineno;
- }
-}
-
-/* Report an error at line LINE of file FILE. */
-
-static void
-v_error_with_file_and_line (file, line, s, ap)
- char *file;
- int line;
- char *s;
- va_list ap;
-{
- count_error (0);
- report_error_function (file);
- v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
-}
-
-void
-error_with_file_and_line VPROTO((char *file, int line, char *s, ...))
-{
-#ifndef __STDC__
- char *file;
- int line;
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- file = va_arg (ap, char *);
- line = va_arg (ap, int);
- s = va_arg (ap, char *);
-#endif
-
- v_error_with_file_and_line (file, line, s, ap);
- va_end (ap);
-}
-
-/* Report an error at the declaration DECL.
- S is a format string which uses %s to substitute the declaration
- name; subsequent substitutions are a la printf. */
-
-static void
-v_error_with_decl (decl, s, ap)
- tree decl;
- char *s;
- va_list ap;
-{
- count_error (0);
- report_error_function (DECL_SOURCE_FILE (decl));
- v_message_with_decl (decl, (char *)NULL, s, ap);
-}
-
-void
-error_with_decl VPROTO((tree decl, char *s, ...))
-{
-#ifndef __STDC__
- tree decl;
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- decl = va_arg (ap, tree);
- s = va_arg (ap, char *);
-#endif
-
- v_error_with_decl (decl, s, ap);
- va_end (ap);
-}
-
-/* Report an error at the line number of the insn INSN.
- This is used only when INSN is an `asm' with operands,
- and each ASM_OPERANDS records its own source file and line. */
-
-static void
-v_error_for_asm (insn, s, ap)
- rtx insn;
- char *s;
- va_list ap;
-{
- char *file;
- int line;
-
- count_error (0);
- file_and_line_for_asm (insn, &file, &line);
- report_error_function (file);
- v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
-}
-
-void
-error_for_asm VPROTO((rtx insn, char *s, ...))
-{
-#ifndef __STDC__
- rtx insn;
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- insn = va_arg (ap, rtx);
- s = va_arg (ap, char *);
-#endif
-
- v_error_for_asm (insn, s, ap);
- va_end (ap);
-}
-
-/* Report an error at the current line number. */
-
-static void
-verror (s, ap)
- char *s;
- va_list ap;
-{
- v_error_with_file_and_line (input_filename, lineno, s, ap);
-}
-
-void
-error VPROTO((char *s, ...))
-{
-#ifndef __STDC__
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- s = va_arg (ap, char *);
-#endif
-
- verror (s, ap);
- va_end (ap);
-}
-
-/* Report a fatal error at the current line number. */
-
-static void
-vfatal (s, ap)
- char *s;
- va_list ap;
-{
- verror (s, ap);
- exit (FATAL_EXIT_CODE);
-}
-
-void
-fatal VPROTO((char *s, ...))
-{
-#ifndef __STDC__
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- s = va_arg (ap, char *);
-#endif
-
- vfatal (s, ap);
- va_end (ap);
-}
-
-/* Report a warning at line LINE of file FILE. */
-
-static void
-v_warning_with_file_and_line (file, line, s, ap)
- char *file;
- int line;
- char *s;
- va_list ap;
-{
- if (count_error (1))
- {
- report_error_function (file);
- v_message_with_file_and_line (file, line, "warning", s, ap);
- }
-}
-
-void
-warning_with_file_and_line VPROTO((char *file, int line, char *s, ...))
-{
-#ifndef __STDC__
- char *file;
- int line;
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- file = va_arg (ap, char *);
- line = va_arg (ap, int);
- s = va_arg (ap, char *);
-#endif
-
- v_warning_with_file_and_line (file, line, s, ap);
- va_end (ap);
-}
-
-/* Report a warning at the declaration DECL.
- S is a format string which uses %s to substitute the declaration
- name; subsequent substitutions are a la printf. */
-
-static void
-v_warning_with_decl (decl, s, ap)
- tree decl;
- char *s;
- va_list ap;
-{
- if (count_error (1))
- {
- report_error_function (DECL_SOURCE_FILE (decl));
- v_message_with_decl (decl, "warning", s, ap);
- }
-}
-
-void
-warning_with_decl VPROTO((tree decl, char *s, ...))
-{
-#ifndef __STDC__
- tree decl;
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- decl = va_arg (ap, tree);
- s = va_arg (ap, char *);
-#endif
-
- v_warning_with_decl (decl, s, ap);
- va_end (ap);
-}
-
-/* Report a warning at the line number of the insn INSN.
- This is used only when INSN is an `asm' with operands,
- and each ASM_OPERANDS records its own source file and line. */
-
-static void
-v_warning_for_asm (insn, s, ap)
- rtx insn;
- char *s;
- va_list ap;
-{
- if (count_error (1))
- {
- char *file;
- int line;
-
- file_and_line_for_asm (insn, &file, &line);
- report_error_function (file);
- v_message_with_file_and_line (file, line, "warning", s, ap);
- }
-}
-
-void
-warning_for_asm VPROTO((rtx insn, char *s, ...))
-{
-#ifndef __STDC__
- rtx insn;
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- insn = va_arg (ap, rtx);
- s = va_arg (ap, char *);
-#endif
-
- v_warning_for_asm (insn, s, ap);
- va_end (ap);
-}
-
-/* Report a warning at the current line number. */
-
-static void
-vwarning (s, ap)
- char *s;
- va_list ap;
-{
- v_warning_with_file_and_line (input_filename, lineno, s, ap);
-}
-
-void
-warning VPROTO((char *s, ...))
-{
-#ifndef __STDC__
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- s = va_arg (ap, char *);
-#endif
-
- vwarning (s, ap);
- va_end (ap);
-}
-
-/* These functions issue either warnings or errors depending on
- -pedantic-errors. */
-
-static void
-vpedwarn (s, ap)
- char *s;
- va_list ap;
-{
- if (flag_pedantic_errors)
- verror (s, ap);
- else
- vwarning (s, ap);
-}
-
-void
-pedwarn VPROTO((char *s, ...))
-{
-#ifndef __STDC__
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- s = va_arg (ap, char *);
-#endif
-
- vpedwarn (s, ap);
- va_end (ap);
-}
-
-static void
-v_pedwarn_with_decl (decl, s, ap)
- tree decl;
- char *s;
- va_list ap;
-{
- /* We don't want -pedantic-errors to cause the compilation to fail from
- "errors" in system header files. Sometimes fixincludes can't fix what's
- broken (eg: unsigned char bitfields - fixing it may change the alignment
- which will cause programs to mysteriously fail because the C library
- or kernel uses the original layout). There's no point in issuing a
- warning either, it's just unnecessary noise. */
-
- if (! DECL_IN_SYSTEM_HEADER (decl))
- {
- if (flag_pedantic_errors)
- v_error_with_decl (decl, s, ap);
- else
- v_warning_with_decl (decl, s, ap);
- }
-}
-
-void
-pedwarn_with_decl VPROTO((tree decl, char *s, ...))
-{
-#ifndef __STDC__
- tree decl;
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- decl = va_arg (ap, tree);
- s = va_arg (ap, char *);
-#endif
-
- v_pedwarn_with_decl (decl, s, ap);
- va_end (ap);
-}
-
-static void
-v_pedwarn_with_file_and_line (file, line, s, ap)
- char *file;
- int line;
- char *s;
- va_list ap;
-{
- if (flag_pedantic_errors)
- v_error_with_file_and_line (file, line, s, ap);
- else
- v_warning_with_file_and_line (file, line, s, ap);
-}
-
-void
-pedwarn_with_file_and_line VPROTO((char *file, int line, char *s, ...))
-{
-#ifndef __STDC__
- char *file;
- int line;
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- file = va_arg (ap, char *);
- line = va_arg (ap, int);
- s = va_arg (ap, char *);
-#endif
-
- v_pedwarn_with_file_and_line (file, line, s, ap);
- va_end (ap);
-}
-
-/* Apologize for not implementing some feature. */
-
-static void
-vsorry (s, ap)
- char *s;
- va_list ap;
-{
- sorrycount++;
- if (input_filename)
- fprintf (stderr, "%s:%d: ", input_filename, lineno);
- else
- fprintf (stderr, "%s: ", progname);
- vmessage ("sorry, not implemented", s, ap);
- fputc ('\n', stderr);
-}
-
-void
-sorry VPROTO((char *s, ...))
-{
-#ifndef __STDC__
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- s = va_arg (ap, char *);
-#endif
-
- vsorry (s, ap);
- va_end (ap);
-}
-
-/* Apologize for not implementing some feature, then quit. */
-
-static void
-v_really_sorry (s, ap)
- char *s;
- va_list ap;
-{
- sorrycount++;
- if (input_filename)
- fprintf (stderr, "%s:%d: ", input_filename, lineno);
- else
- fprintf (stderr, "%s: ", progname);
- vmessage ("sorry, not implemented", s, ap);
- fatal (" (fatal)\n");
-}
-
-void
-really_sorry VPROTO((char *s, ...))
-{
-#ifndef __STDC__
- char *s;
-#endif
- va_list ap;
-
- VA_START (ap, s);
-
-#ifndef __STDC__
- s = va_arg (ap, char *);
-#endif
-
- v_really_sorry (s, ap);
- va_end (ap);
-}
-
-/* More 'friendly' abort that prints the line and file.
- config.h can #define abort fancy_abort if you like that sort of thing.
-
- I don't think this is actually a good idea.
- Other sorts of crashes will look a certain way.
- It is a good thing if crashes from calling abort look the same way.
- -- RMS */
-
-void
-fancy_abort ()
-{
- fatal ("internal gcc abort");
-}
-
-/* This calls abort and is used to avoid problems when abort if a macro.
- It is used when we need to pass the address of abort. */
-
-void
-do_abort ()
-{
- abort ();
-}
-
-/* When `malloc.c' is compiled with `rcheck' defined,
- it calls this function to report clobberage. */
-
-void
-botch (s)
-{
- abort ();
-}
-
-/* Same as `malloc' but report error if no memory available. */
-
-char *
-xmalloc (size)
- unsigned size;
-{
- register char *value = (char *) malloc (size);
- if (value == 0)
- fatal ("virtual memory exhausted");
- return value;
-}
-
-/* Same as `realloc' but report error if no memory available. */
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- int size;
-{
- char *result = (char *) realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted");
- return result;
-}
-
-/* Same as `strdup' but report error if no memory available. */
-
-char *
-xstrdup (s)
- register char *s;
-{
- register char *result = (char *) malloc (strlen (s) + 1);
-
- if (! result)
- fatal ("virtual memory exhausted");
- strcpy (result, s);
- return result;
-}
-
-/* Return the logarithm of X, base 2, considering X unsigned,
- if X is a power of 2. Otherwise, returns -1.
-
- This should be used via the `exact_log2' macro. */
-
-int
-exact_log2_wide (x)
- register unsigned HOST_WIDE_INT x;
-{
- register int log = 0;
- /* Test for 0 or a power of 2. */
- if (x == 0 || x != (x & -x))
- return -1;
- while ((x >>= 1) != 0)
- log++;
- return log;
-}
-
-/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
- If X is 0, return -1.
-
- This should be used via the floor_log2 macro. */
-
-int
-floor_log2_wide (x)
- register unsigned HOST_WIDE_INT x;
-{
- register int log = -1;
- while (x != 0)
- log++,
- x >>= 1;
- return log;
-}
-
-static int float_handler_set;
-int float_handled;
-jmp_buf float_handler;
-
-/* Signals actually come here. */
-
-static void
-float_signal (signo)
- /* If this is missing, some compilers complain. */
- int signo;
-{
- if (float_handled == 0)
- abort ();
-#if defined (USG) || defined (hpux)
- signal (SIGFPE, float_signal); /* re-enable the signal catcher */
-#endif
- float_handled = 0;
- signal (SIGFPE, float_signal);
- longjmp (float_handler, 1);
-}
-
-/* Specify where to longjmp to when a floating arithmetic error happens.
- If HANDLER is 0, it means don't handle the errors any more. */
-
-void
-set_float_handler (handler)
- jmp_buf handler;
-{
- float_handled = (handler != 0);
- if (handler)
- bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
-
- if (float_handled && ! float_handler_set)
- {
- signal (SIGFPE, float_signal);
- float_handler_set = 1;
- }
-}
-
-/* Specify, in HANDLER, where to longjmp to when a floating arithmetic
- error happens, pushing the previous specification into OLD_HANDLER.
- Return an indication of whether there was a previous handler in effect. */
-
-int
-push_float_handler (handler, old_handler)
- jmp_buf handler, old_handler;
-{
- int was_handled = float_handled;
-
- float_handled = 1;
- if (was_handled)
- bcopy ((char *) float_handler, (char *) old_handler,
- sizeof (float_handler));
-
- bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
- return was_handled;
-}
-
-/* Restore the previous specification of whether and where to longjmp to
- when a floating arithmetic error happens. */
-
-void
-pop_float_handler (handled, handler)
- int handled;
- jmp_buf handler;
-{
- float_handled = handled;
- if (handled)
- bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler));
-}
-
-/* Handler for SIGPIPE. */
-
-static void
-pipe_closed (signo)
- /* If this is missing, some compilers complain. */
- int signo;
-{
- fatal ("output pipe has been closed");
-}
-
-/* Strip off a legitimate source ending from the input string NAME of
- length LEN. Rather than having to know the names used by all of
- our front ends, we strip off an ending of a period followed by one,
- two, or three characters. */
-
-void
-strip_off_ending (name, len)
- char *name;
- int len;
-{
- if (len > 2 && name[len - 2] == '.')
- name[len - 2] = '\0';
- else if (len > 3 && name[len - 3] == '.')
- name[len - 3] = '\0';
- else if (len > 4 && name[len - 4] == '.')
- name[len - 4] = '\0';
-}
-
-/* Output a quoted string. */
-
-void
-output_quoted_string (asm_file, string)
- FILE *asm_file;
- char *string;
-{
- char c;
-
- putc ('\"', asm_file);
- while ((c = *string++) != 0)
- {
- if (c == '\"' || c == '\\')
- putc ('\\', asm_file);
- putc (c, asm_file);
- }
- putc ('\"', asm_file);
-}
-
-/* Output a file name in the form wanted by System V. */
-
-void
-output_file_directive (asm_file, input_name)
- FILE *asm_file;
- char *input_name;
-{
- int len = strlen (input_name);
- char *na = input_name + len;
-
- /* NA gets INPUT_NAME sans directory names. */
- while (na > input_name)
- {
- if (na[-1] == '/')
- break;
- na--;
- }
-
-#ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
- ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
-#else
-#ifdef ASM_OUTPUT_SOURCE_FILENAME
- ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
-#else
- fprintf (asm_file, "\t.file\t");
- output_quoted_string (asm_file, na);
- fputc ('\n', asm_file);
-#endif
-#endif
-}
-
-/* Routine to build language identifier for object file. */
-
-static void
-output_lang_identify (asm_out_file)
- FILE *asm_out_file;
-{
- int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
- char *s = (char *) alloca (len);
- sprintf (s, "__gnu_compiled_%s", lang_identify ());
- ASM_OUTPUT_LABEL (asm_out_file, s);
-}
-
-/* Routine to open a dump file. */
-
-static FILE *
-open_dump_file (base_name, suffix)
- char *base_name;
- char *suffix;
-{
- FILE *f;
- char *dumpname = (char *) alloca (strlen (base_name) + strlen (suffix) + 1);
-
- strcpy (dumpname, base_name);
- strcat (dumpname, suffix);
- f = fopen (dumpname, "w");
- if (f == 0)
- pfatal_with_name (dumpname);
- return f;
-}
-
-/* Compile an entire file of output from cpp, named NAME.
- Write a file of assembly output and various debugging dumps. */
-
-static void
-compile_file (name)
- char *name;
-{
- tree globals;
- int start_time;
-
- int name_specified = name != 0;
-
- if (dump_base_name == 0)
- dump_base_name = name ? name : "gccdump";
-
- parse_time = 0;
- varconst_time = 0;
- integration_time = 0;
- jump_time = 0;
- cse_time = 0;
- loop_time = 0;
- cse2_time = 0;
- branch_prob_time = 0;
- flow_time = 0;
- combine_time = 0;
- sched_time = 0;
- local_alloc_time = 0;
- global_alloc_time = 0;
- sched2_time = 0;
- dbr_sched_time = 0;
- shorten_branch_time = 0;
- stack_reg_time = 0;
- final_time = 0;
- symout_time = 0;
- dump_time = 0;
-
- /* Open input file. */
-
- if (name == 0 || !strcmp (name, "-"))
- {
- finput = stdin;
- name = "stdin";
- }
- else
- finput = fopen (name, "r");
- if (finput == 0)
- pfatal_with_name (name);
-
-#ifdef IO_BUFFER_SIZE
- setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
-#endif
-
- /* Initialize data in various passes. */
-
- init_obstacks ();
- init_tree_codes ();
- init_lex ();
- /* Some of these really don't need to be called when generating bytecode,
- but the options would have to be parsed first to know that. -bson */
- init_rtl ();
- init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
- || debug_info_level == DINFO_LEVEL_VERBOSE
- || flag_test_coverage);
- init_regs ();
- init_decl_processing ();
- init_optabs ();
- init_stmt ();
- init_expmed ();
- init_expr_once ();
- init_loop ();
- init_reload ();
-
- if (flag_caller_saves)
- init_caller_save ();
-
- /* If auxiliary info generation is desired, open the output file.
- This goes in the same directory as the source file--unlike
- all the other output files. */
- if (flag_gen_aux_info)
- {
- aux_info_file = fopen (aux_info_file_name, "w");
- if (aux_info_file == 0)
- pfatal_with_name (aux_info_file_name);
- }
-
- /* If rtl dump desired, open the output file. */
- if (rtl_dump)
- rtl_dump_file = open_dump_file (dump_base_name, ".rtl");
-
- /* If jump_opt dump desired, open the output file. */
- if (jump_opt_dump)
- jump_opt_dump_file = open_dump_file (dump_base_name, ".jump");
-
- /* If cse dump desired, open the output file. */
- if (cse_dump)
- cse_dump_file = open_dump_file (dump_base_name, ".cse");
-
- /* If loop dump desired, open the output file. */
- if (loop_dump)
- loop_dump_file = open_dump_file (dump_base_name, ".loop");
-
- /* If cse2 dump desired, open the output file. */
- if (cse2_dump)
- cse2_dump_file = open_dump_file (dump_base_name, ".cse2");
-
- /* If branch_prob dump desired, open the output file. */
- if (branch_prob_dump)
- branch_prob_dump_file = open_dump_file (dump_base_name, ".bp");
-
- /* If flow dump desired, open the output file. */
- if (flow_dump)
- flow_dump_file = open_dump_file (dump_base_name, ".flow");
-
- /* If combine dump desired, open the output file. */
- if (combine_dump)
- combine_dump_file = open_dump_file (dump_base_name, ".combine");
-
- /* If scheduling dump desired, open the output file. */
- if (sched_dump)
- sched_dump_file = open_dump_file (dump_base_name, ".sched");
-
- /* If local_reg dump desired, open the output file. */
- if (local_reg_dump)
- local_reg_dump_file = open_dump_file (dump_base_name, ".lreg");
-
- /* If global_reg dump desired, open the output file. */
- if (global_reg_dump)
- global_reg_dump_file = open_dump_file (dump_base_name, ".greg");
-
- /* If 2nd scheduling dump desired, open the output file. */
- if (sched2_dump)
- sched2_dump_file = open_dump_file (dump_base_name, ".sched2");
-
- /* If jump2_opt dump desired, open the output file. */
- if (jump2_opt_dump)
- jump2_opt_dump_file = open_dump_file (dump_base_name, ".jump2");
-
- /* If dbr_sched dump desired, open the output file. */
- if (dbr_sched_dump)
- dbr_sched_dump_file = open_dump_file (dump_base_name, ".dbr");
-
-#ifdef STACK_REGS
-
- /* If stack_reg dump desired, open the output file. */
- if (stack_reg_dump)
- stack_reg_dump_file = open_dump_file (dump_base_name, ".stack");
-
-#endif
-
- /* Open assembler code output file. */
-
- if (! name_specified && asm_file_name == 0)
- asm_out_file = stdout;
- else
- {
- int len = strlen (dump_base_name);
- register char *dumpname = (char *) xmalloc (len + 6);
- strcpy (dumpname, dump_base_name);
- strip_off_ending (dumpname, len);
- strcat (dumpname, ".s");
- if (asm_file_name == 0)
- {
- asm_file_name = (char *) xmalloc (strlen (dumpname) + 1);
- strcpy (asm_file_name, dumpname);
- }
- if (!strcmp (asm_file_name, "-"))
- asm_out_file = stdout;
- else
- asm_out_file = fopen (asm_file_name, "w");
- if (asm_out_file == 0)
- pfatal_with_name (asm_file_name);
- }
-
-#ifdef IO_BUFFER_SIZE
- setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
- _IOFBF, IO_BUFFER_SIZE);
-#endif
-
- input_filename = name;
-
- /* Put an entry on the input file stack for the main input file. */
- input_file_stack
- = (struct file_stack *) xmalloc (sizeof (struct file_stack));
- input_file_stack->next = 0;
- input_file_stack->name = input_filename;
-
- /* Perform language-specific initialization.
- This may set main_input_filename. */
- lang_init ();
-
- /* If the input doesn't start with a #line, use the input name
- as the official input file name. */
- if (main_input_filename == 0)
- main_input_filename = name;
-
- if (!output_bytecode)
- {
- ASM_FILE_START (asm_out_file);
-
-#ifdef ASM_COMMENT_START
- if (flag_verbose_asm)
- {
- /* Print the list of options in effect. */
- print_version (asm_out_file, ASM_COMMENT_START);
- print_switch_values (asm_out_file, 0, MAX_LINE,
- ASM_COMMENT_START, " ", "\n");
- /* Add a blank line here so it appears in assembler output but not
- screen output. */
- fprintf (asm_out_file, "\n");
- }
-#endif
- }
-
- /* Output something to inform GDB that this compilation was by GCC. Also
- serves to tell GDB file consists of bytecodes. */
- if (output_bytecode)
- fprintf (asm_out_file, "bc_gcc2_compiled.:\n");
- else
- {
-#ifndef ASM_IDENTIFY_GCC
- fprintf (asm_out_file, "gcc2_compiled.:\n");
-#else
- ASM_IDENTIFY_GCC (asm_out_file);
-#endif
- }
-
- /* Output something to identify which front-end produced this file. */
-#ifdef ASM_IDENTIFY_LANGUAGE
- ASM_IDENTIFY_LANGUAGE (asm_out_file);
-#endif
-
-#ifndef ASM_OUTPUT_SECTION_NAME
- if (flag_function_sections)
- {
- warning ("-ffunction-sections not supported for this target.");
- flag_function_sections = 0;
- }
-#endif
-
- if (flag_function_sections
- && (profile_flag || profile_block_flag))
- {
- warning ("-ffunction-sections disabled; it makes profiling impossible.");
- flag_function_sections = 0;
- }
-
- if (flag_function_sections && write_symbols != NO_DEBUG)
- warning ("-ffunction-sections may affect debugging on some targets.");
-
- if (output_bytecode)
- {
- if (profile_flag || profile_block_flag)
- error ("profiling not supported in bytecode compilation");
- }
- else
- {
- /* ??? Note: There used to be a conditional here
- to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
- This was to guarantee separation between gcc_compiled. and
- the first function, for the sake of dbx on Suns.
- However, having the extra zero here confused the Emacs
- code for unexec, and might confuse other programs too.
- Therefore, I took out that change.
- In future versions we should find another way to solve
- that dbx problem. -- rms, 23 May 93. */
-
- /* Don't let the first function fall at the same address
- as gcc_compiled., if profiling. */
- if (profile_flag || profile_block_flag)
- assemble_zeros (UNITS_PER_WORD);
- }
-
- /* If dbx symbol table desired, initialize writing it
- and output the predefined types. */
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
- TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
- getdecls ()));
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
- getdecls ()));
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- TIMEVAR (symout_time, dwarf2out_init (asm_out_file, main_input_filename));
-#endif
-
- /* Initialize yet another pass. */
-
- if (!output_bytecode)
- init_final (main_input_filename);
- init_branch_prob (dump_base_name);
-
- start_time = get_run_time ();
-
- /* Call the parser, which parses the entire file
- (calling rest_of_compilation for each function). */
-
- if (yyparse () != 0)
- {
- if (errorcount == 0)
- fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
-
- /* In case there were missing closebraces,
- get us back to the global binding level. */
- while (! global_bindings_p ())
- poplevel (0, 0, 0);
- }
-
- output_func_start_profiler ();
-
- /* Compilation is now finished except for writing
- what's left of the symbol table output. */
-
- parse_time += get_run_time () - start_time;
-
- parse_time -= integration_time;
- parse_time -= varconst_time;
-
- globals = getdecls ();
-
- /* Really define vars that have had only a tentative definition.
- Really output inline functions that must actually be callable
- and have not been output so far. */
-
- {
- int len = list_length (globals);
- tree *vec = (tree *) alloca (sizeof (tree) * len);
- int i;
- tree decl;
- int reconsider = 1;
-
- /* Process the decls in reverse order--earliest first.
- Put them into VEC from back to front, then take out from front. */
-
- for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
- vec[len - i - 1] = decl;
-
- for (i = 0; i < len; i++)
- {
- decl = vec[i];
-
- /* We're not deferring this any longer. */
- DECL_DEFER_OUTPUT (decl) = 0;
-
- if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
- && incomplete_decl_finalize_hook != 0)
- (*incomplete_decl_finalize_hook) (decl);
- }
-
- /* Now emit any global variables or functions that we have been putting
- off. We need to loop in case one of the things emitted here
- references another one which comes earlier in the list. */
- while (reconsider)
- {
- reconsider = 0;
- for (i = 0; i < len; i++)
- {
- decl = vec[i];
-
- if (TREE_ASM_WRITTEN (decl) || DECL_EXTERNAL (decl))
- continue;
-
- /* Don't write out static consts, unless we still need them.
-
- We also keep static consts if not optimizing (for debugging),
- unless the user specified -fno-keep-static-consts.
- ??? They might be better written into the debug information.
- This is possible when using DWARF.
-
- A language processor that wants static constants to be always
- written out (even if it is not used) is responsible for
- calling rest_of_decl_compilation itself. E.g. the C front-end
- calls rest_of_decl_compilation from finish_decl.
- One motivation for this is that is conventional in some
- environments to write things like:
- static const char rcsid[] = "... version string ...";
- intending to force the string to be in the executable.
-
- A language processor that would prefer to have unneeded
- static constants "optimized away" would just defer writing
- them out until here. E.g. C++ does this, because static
- constants are often defined in header files.
-
- ??? A tempting alternative (for both C and C++) would be
- to force a constant to be written if and only if it is
- defined in a main file, as opposed to an include file. */
-
- if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
- && (! TREE_READONLY (decl)
- || TREE_PUBLIC (decl)
- || (!optimize && flag_keep_static_consts)
- || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
- {
- reconsider = 1;
- rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
- }
-
- if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_INITIAL (decl) != 0
- && DECL_SAVED_INSNS (decl) != 0
- && (flag_keep_inline_functions
- || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
- {
- reconsider = 1;
- temporary_allocation ();
- output_inline_function (decl);
- permanent_allocation (1);
- }
- }
- }
-
- /* Now that all possible functions have been output, we can dump
- the exception table. */
-
- if (exception_table_p ())
- output_exception_table ();
-
- for (i = 0; i < len; i++)
- {
- decl = vec[i];
-
- if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
- && ! TREE_ASM_WRITTEN (decl))
- /* Cancel the RTL for this decl so that, if debugging info
- output for global variables is still to come,
- this one will be omitted. */
- DECL_RTL (decl) = NULL;
-
- /* Warn about any function
- declared static but not defined.
- We don't warn about variables,
- because many programs have static variables
- that exist only to get some text into the object file. */
- if (TREE_CODE (decl) == FUNCTION_DECL
- && (warn_unused
- || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
- && DECL_INITIAL (decl) == 0
- && DECL_EXTERNAL (decl)
- && ! DECL_ARTIFICIAL (decl)
- && ! TREE_PUBLIC (decl))
- {
- pedwarn_with_decl (decl,
- "`%s' declared `static' but never defined");
- /* This symbol is effectively an "extern" declaration now. */
- TREE_PUBLIC (decl) = 1;
- assemble_external (decl);
- }
-
- /* Warn about static fns or vars defined but not used,
- but not about inline functions or static consts
- since defining those in header files is normal practice. */
- if (warn_unused
- && ((TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
- || (TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
- && ! DECL_IN_SYSTEM_HEADER (decl)
- && ! DECL_EXTERNAL (decl)
- && ! TREE_PUBLIC (decl)
- && ! TREE_USED (decl)
- && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
- /* The TREE_USED bit for file-scope decls
- is kept in the identifier, to handle multiple
- external decls in different scopes. */
- && ! TREE_USED (DECL_NAME (decl)))
- warning_with_decl (decl, "`%s' defined but not used");
-
-#ifdef SDB_DEBUGGING_INFO
- /* The COFF linker can move initialized global vars to the end.
- And that can screw up the symbol ordering.
- By putting the symbols in that order to begin with,
- we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */
- if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
- && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
- && ! DECL_EXTERNAL (decl)
- && DECL_RTL (decl) != 0)
- TIMEVAR (symout_time, sdbout_symbol (decl, 0));
-
- /* Output COFF information for non-global
- file-scope initialized variables. */
- if (write_symbols == SDB_DEBUG
- && TREE_CODE (decl) == VAR_DECL
- && DECL_INITIAL (decl)
- && ! DECL_EXTERNAL (decl)
- && DECL_RTL (decl) != 0
- && GET_CODE (DECL_RTL (decl)) == MEM)
- TIMEVAR (symout_time, sdbout_toplevel_data (decl));
-#endif /* SDB_DEBUGGING_INFO */
-#ifdef DWARF_DEBUGGING_INFO
- /* Output DWARF information for file-scope tentative data object
- declarations, file-scope (extern) function declarations (which
- had no corresponding body) and file-scope tagged type declarations
- and definitions which have not yet been forced out. */
-
- if (write_symbols == DWARF_DEBUG
- && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
- TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- /* Output DWARF2 information for file-scope tentative data object
- declarations, file-scope (extern) function declarations (which
- had no corresponding body) and file-scope tagged type declarations
- and definitions which have not yet been forced out. */
-
- if (write_symbols == DWARF2_DEBUG
- && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
- TIMEVAR (symout_time, dwarf2out_decl (decl));
-#endif
- }
- }
-
- /* Write out any pending weak symbol declarations. */
-
- weak_finish ();
-
- /* Do dbx symbols */
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
- TIMEVAR (symout_time,
- {
- dbxout_finish (asm_out_file, main_input_filename);
- });
-#endif
-
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- TIMEVAR (symout_time,
- {
- dwarfout_finish ();
- });
-#endif
-
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- TIMEVAR (symout_time,
- {
- dwarf2out_finish ();
- });
-#endif
-
- /* Output some stuff at end of file if nec. */
-
- if (!output_bytecode)
- {
- end_final (dump_base_name);
- end_branch_prob (branch_prob_dump_file);
-
-#ifdef ASM_FILE_END
- ASM_FILE_END (asm_out_file);
-#endif
- }
-
- /* Language-specific end of compilation actions. */
-
- lang_finish ();
-
- if (output_bytecode)
- bc_write_file (asm_out_file);
-
- /* Close the dump files. */
-
- if (flag_gen_aux_info)
- {
- fclose (aux_info_file);
- if (errorcount)
- unlink (aux_info_file_name);
- }
-
- if (rtl_dump)
- fclose (rtl_dump_file);
-
- if (jump_opt_dump)
- fclose (jump_opt_dump_file);
-
- if (cse_dump)
- fclose (cse_dump_file);
-
- if (loop_dump)
- fclose (loop_dump_file);
-
- if (cse2_dump)
- fclose (cse2_dump_file);
-
- if (branch_prob_dump)
- fclose (branch_prob_dump_file);
-
- if (flow_dump)
- fclose (flow_dump_file);
-
- if (combine_dump)
- {
- dump_combine_total_stats (combine_dump_file);
- fclose (combine_dump_file);
- }
-
- if (sched_dump)
- fclose (sched_dump_file);
-
- if (local_reg_dump)
- fclose (local_reg_dump_file);
-
- if (global_reg_dump)
- fclose (global_reg_dump_file);
-
- if (sched2_dump)
- fclose (sched2_dump_file);
-
- if (jump2_opt_dump)
- fclose (jump2_opt_dump_file);
-
- if (dbr_sched_dump)
- fclose (dbr_sched_dump_file);
-
-#ifdef STACK_REGS
- if (stack_reg_dump)
- fclose (stack_reg_dump_file);
-#endif
-
- /* Close non-debugging input and output files. Take special care to note
- whether fclose returns an error, since the pages might still be on the
- buffer chain while the file is open. */
-
- fclose (finput);
- if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
- fatal_io_error (asm_file_name);
-
- /* Print the times. */
-
- if (! quiet_flag)
- {
- fprintf (stderr,"\n");
- print_time ("parse", parse_time);
-
- if (!output_bytecode)
- {
- print_time ("integration", integration_time);
- print_time ("jump", jump_time);
- print_time ("cse", cse_time);
- print_time ("loop", loop_time);
- print_time ("cse2", cse2_time);
- print_time ("branch-probabilities", branch_prob_time);
- print_time ("flow", flow_time);
- print_time ("combine", combine_time);
- print_time ("sched", sched_time);
- print_time ("local-alloc", local_alloc_time);
- print_time ("global-alloc", global_alloc_time);
- print_time ("sched2", sched2_time);
- print_time ("dbranch", dbr_sched_time);
- print_time ("shorten-branch", shorten_branch_time);
- print_time ("stack-reg", stack_reg_time);
- print_time ("final", final_time);
- print_time ("varconst", varconst_time);
- print_time ("symout", symout_time);
- print_time ("dump", dump_time);
- }
- }
-}
-
-/* This is called from various places for FUNCTION_DECL, VAR_DECL,
- and TYPE_DECL nodes.
-
- This does nothing for local (non-static) variables.
- Otherwise, it sets up the RTL and outputs any assembler code
- (label definition, storage allocation and initialization).
-
- DECL is the declaration. If ASMSPEC is nonzero, it specifies
- the assembler symbol name to be used. TOP_LEVEL is nonzero
- if this declaration is not within a function. */
-
-void
-rest_of_decl_compilation (decl, asmspec, top_level, at_end)
- tree decl;
- char *asmspec;
- int top_level;
- int at_end;
-{
- /* Declarations of variables, and of functions defined elsewhere. */
-
-/* The most obvious approach, to put an #ifndef around where
- this macro is used, doesn't work since it's inside a macro call. */
-#ifndef ASM_FINISH_DECLARE_OBJECT
-#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
-#endif
-
- /* Forward declarations for nested functions are not "external",
- but we need to treat them as if they were. */
- if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
- || TREE_CODE (decl) == FUNCTION_DECL)
- TIMEVAR (varconst_time,
- {
- make_decl_rtl (decl, asmspec, top_level);
- /* Initialized extern variable exists to be replaced
- with its value, or represents something that will be
- output in another file. */
- if (! (TREE_CODE (decl) == VAR_DECL
- && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
- && DECL_INITIAL (decl) != 0
- && DECL_INITIAL (decl) != error_mark_node))
- /* Don't output anything
- when a tentative file-scope definition is seen.
- But at end of compilation, do output code for them. */
- if (! (! at_end && top_level
- && (DECL_INITIAL (decl) == 0
- || DECL_INITIAL (decl) == error_mark_node)))
- assemble_variable (decl, top_level, at_end, 0);
- if (!output_bytecode
- && decl == last_assemble_variable_decl)
- {
- ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
- top_level, at_end);
- }
- });
- else if (DECL_REGISTER (decl) && asmspec != 0)
- {
- if (decode_reg_name (asmspec) >= 0)
- {
- DECL_RTL (decl) = 0;
- make_decl_rtl (decl, asmspec, top_level);
- }
- else
- error ("invalid register name `%s' for register variable", asmspec);
- }
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
- && TREE_CODE (decl) == TYPE_DECL)
- TIMEVAR (symout_time, dbxout_symbol (decl, 0));
-#endif
-#ifdef SDB_DEBUGGING_INFO
- else if (write_symbols == SDB_DEBUG && top_level
- && TREE_CODE (decl) == TYPE_DECL)
- TIMEVAR (symout_time, sdbout_symbol (decl, 0));
-#endif
-}
-
-/* Called after finishing a record, union or enumeral type. */
-
-void
-rest_of_type_compilation (type, toplev)
- tree type;
- int toplev;
-{
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
- TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
-#endif
-}
-
-/* This is called from finish_function (within yyparse)
- after each top-level definition is parsed.
- It is supposed to compile that function or variable
- and output the assembler code for it.
- After we return, the tree storage is freed. */
-
-void
-rest_of_compilation (decl)
- tree decl;
-{
- register rtx insns;
- int start_time = get_run_time ();
- int tem;
- /* Nonzero if we have saved the original DECL_INITIAL of the function,
- to be restored after we finish compiling the function
- (for use when compiling inline calls to this function). */
- tree saved_block_tree = 0;
- /* Likewise, for DECL_ARGUMENTS. */
- tree saved_arguments = 0;
- int failure = 0;
-
- if (output_bytecode)
- return;
-
- /* If we are reconsidering an inline function
- at the end of compilation, skip the stuff for making it inline. */
-
- if (DECL_SAVED_INSNS (decl) == 0)
- {
- int inlineable = 0;
- char *lose;
-
- /* If requested, consider whether to make this function inline. */
- if (DECL_INLINE (decl) || flag_inline_functions)
- TIMEVAR (integration_time,
- {
- lose = function_cannot_inline_p (decl);
- if (lose || ! optimize)
- {
- if (warn_inline && DECL_INLINE (decl))
- warning_with_decl (decl, lose);
- DECL_ABSTRACT_ORIGIN (decl) = 0;
- /* Don't really compile an extern inline function.
- If we can't make it inline, pretend
- it was only declared. */
- if (DECL_EXTERNAL (decl))
- {
- DECL_INITIAL (decl) = 0;
- goto exit_rest_of_compilation;
- }
- }
- else
- /* ??? Note that this has the effect of making it look
- like "inline" was specified for a function if we choose
- to inline it. This isn't quite right, but it's
- probably not worth the trouble to fix. */
- inlineable = DECL_INLINE (decl) = 1;
- });
-
- insns = get_insns ();
-
- /* Dump the rtl code if we are dumping rtl. */
-
- if (rtl_dump)
- TIMEVAR (dump_time,
- {
- fprintf (rtl_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- if (DECL_SAVED_INSNS (decl))
- fprintf (rtl_dump_file, ";; (integrable)\n\n");
- print_rtl (rtl_dump_file, insns);
- fflush (rtl_dump_file);
- });
-
- /* If function is inline, and we don't yet know whether to
- compile it by itself, defer decision till end of compilation.
- finish_compilation will call rest_of_compilation again
- for those functions that need to be output. Also defer those
- functions that we are supposed to defer. We cannot defer
- functions containing nested functions since the nested function
- data is in our non-saved obstack. */
-
- if (! current_function_contains_functions
- && (DECL_DEFER_OUTPUT (decl)
- || (DECL_INLINE (decl)
- && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
- && ! flag_keep_inline_functions)
- || DECL_EXTERNAL (decl)))))
- {
- DECL_DEFER_OUTPUT (decl) = 1;
-
- /* If -Wreturn-type, we have to do a bit of compilation. */
- if (! warn_return_type)
- {
-#ifdef DWARF_DEBUGGING_INFO
- /* Generate the DWARF info for the "abstract" instance
- of a function which we may later generate inlined and/or
- out-of-line instances of. */
- if (write_symbols == DWARF_DEBUG)
- {
- set_decl_abstract_flags (decl, 1);
- TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
- set_decl_abstract_flags (decl, 0);
- }
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- /* Generate the DWARF2 info for the "abstract" instance
- of a function which we may later generate inlined and/or
- out-of-line instances of. */
- if (write_symbols == DWARF2_DEBUG)
- {
- set_decl_abstract_flags (decl, 1);
- TIMEVAR (symout_time, dwarf2out_decl (decl));
- set_decl_abstract_flags (decl, 0);
- }
-#endif
- TIMEVAR (integration_time, save_for_inline_nocopy (decl));
- RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlineable;
- goto exit_rest_of_compilation;
- }
- }
-
- /* If we have to compile the function now, save its rtl and subdecls
- so that its compilation will not affect what others get. */
- if (inlineable || DECL_DEFER_OUTPUT (decl))
- {
-#ifdef DWARF_DEBUGGING_INFO
- /* Generate the DWARF info for the "abstract" instance of
- a function which we will generate an out-of-line instance
- of almost immediately (and which we may also later generate
- various inlined instances of). */
- if (write_symbols == DWARF_DEBUG)
- {
- set_decl_abstract_flags (decl, 1);
- TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
- set_decl_abstract_flags (decl, 0);
- }
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- /* Generate the DWARF2 info for the "abstract" instance of
- a function which we will generate an out-of-line instance
- of almost immediately (and which we may also later generate
- various inlined instances of). */
- if (write_symbols == DWARF2_DEBUG)
- {
- set_decl_abstract_flags (decl, 1);
- TIMEVAR (symout_time, dwarf2out_decl (decl));
- set_decl_abstract_flags (decl, 0);
- }
-#endif
- saved_block_tree = DECL_INITIAL (decl);
- saved_arguments = DECL_ARGUMENTS (decl);
- TIMEVAR (integration_time, save_for_inline_copying (decl));
- RTX_INTEGRATED_P (DECL_SAVED_INSNS (decl)) = inlineable;
- }
-
- /* If specified extern inline but we aren't inlining it, we are
- done. */
- if (DECL_INLINE (decl) && DECL_EXTERNAL (decl))
- goto exit_rest_of_compilation;
- }
-
- if (! DECL_DEFER_OUTPUT (decl))
- TREE_ASM_WRITTEN (decl) = 1;
-
- /* Now that integrate will no longer see our rtl, we need not distinguish
- between the return value of this function and the return value of called
- functions. */
- rtx_equal_function_value_matters = 0;
-
- /* Don't return yet if -Wreturn-type; we need to do jump_optimize. */
- if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
- {
- goto exit_rest_of_compilation;
- }
-
- /* Add an unwinder for exception handling, if needed.
- This must be done before we finalize PIC code. */
- emit_unwinder ();
-
-#ifdef FINALIZE_PIC
- /* If we are doing position-independent code generation, now
- is the time to output special prologues and epilogues.
- We do not want to do this earlier, because it just clutters
- up inline functions with meaningless insns. */
- if (flag_pic)
- FINALIZE_PIC;
-#endif
-
- /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
- Note that that may have been done above, in save_for_inline_copying.
- The call to resume_temporary_allocation near the end of this function
- goes back to the usual state of affairs. This must be done after
- we've built up any unwinders for exception handling, and done
- the FINALIZE_PIC work, if necessary. */
-
- rtl_in_current_obstack ();
-
- insns = get_insns ();
-
- /* Copy any shared structure that should not be shared. */
-
- unshare_all_rtl (insns);
-
- /* Instantiate all virtual registers. */
-
- instantiate_virtual_regs (current_function_decl, get_insns ());
-
- /* See if we have allocated stack slots that are not directly addressable.
- If so, scan all the insns and create explicit address computation
- for all references to such slots. */
-/* fixup_stack_slots (); */
-
- /* Find all the EH handlers. */
- find_exception_handler_labels ();
-
- /* Always do one jump optimization pass to ensure that JUMP_LABEL fields
- are initialized and to compute whether control can drop off the end
- of the function. */
- TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
- TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
-
- /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
- if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
- goto exit_rest_of_compilation;
-
- /* Dump rtl code after jump, if we are doing that. */
-
- if (jump_opt_dump)
- TIMEVAR (dump_time,
- {
- fprintf (jump_opt_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- print_rtl (jump_opt_dump_file, insns);
- fflush (jump_opt_dump_file);
- });
-
- /* Perform common subexpression elimination.
- Nonzero value from `cse_main' means that jumps were simplified
- and some code may now be unreachable, so do
- jump optimization again. */
-
- if (cse_dump)
- TIMEVAR (dump_time,
- {
- fprintf (cse_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- });
-
- if (optimize > 0)
- {
- TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
-
- if (flag_thread_jumps)
- /* Hacks by tiemann & kenner. */
- TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 1));
-
- TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
- 0, cse_dump_file));
- TIMEVAR (cse_time, delete_dead_from_cse (insns, max_reg_num ()));
-
- if (tem || optimize > 1)
- TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
- }
-
- /* Dump rtl code after cse, if we are doing that. */
-
- if (cse_dump)
- TIMEVAR (dump_time,
- {
- print_rtl (cse_dump_file, insns);
- fflush (cse_dump_file);
- });
-
- if (loop_dump)
- TIMEVAR (dump_time,
- {
- fprintf (loop_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- });
-
- /* Move constant computations out of loops. */
-
- if (optimize > 0)
- {
- TIMEVAR (loop_time,
- {
- loop_optimize (insns, loop_dump_file);
- });
- }
-
- /* Dump rtl code after loop opt, if we are doing that. */
-
- if (loop_dump)
- TIMEVAR (dump_time,
- {
- print_rtl (loop_dump_file, insns);
- fflush (loop_dump_file);
- });
-
- if (cse2_dump)
- TIMEVAR (dump_time,
- {
- fprintf (cse2_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- });
-
- if (optimize > 0 && flag_rerun_cse_after_loop)
- {
- /* Running another jump optimization pass before the second
- cse pass sometimes simplifies the RTL enough to allow
- the second CSE pass to do a better job. Jump_optimize can change
- max_reg_num so we must rerun reg_scan afterwards.
- ??? Rework to not call reg_scan so often. */
- TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
- TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
-
- TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
- TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
- 1, cse2_dump_file));
- if (tem)
- TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
- }
-
- if (optimize > 0 && flag_thread_jumps)
- {
- /* This pass of jump threading straightens out code
- that was kinked by loop optimization. */
- TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
- TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
- }
- /* Dump rtl code after cse, if we are doing that. */
-
- if (cse2_dump)
- TIMEVAR (dump_time,
- {
- print_rtl (cse2_dump_file, insns);
- fflush (cse2_dump_file);
- });
-
- if (branch_prob_dump)
- TIMEVAR (dump_time,
- {
- fprintf (branch_prob_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- });
-
- if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
- TIMEVAR (branch_prob_time,
- {
- branch_prob (insns, branch_prob_dump_file);
- });
-
- if (branch_prob_dump)
- TIMEVAR (dump_time,
- {
- print_rtl (branch_prob_dump_file, insns);
- fflush (branch_prob_dump_file);
- });
- /* We are no longer anticipating cse in this function, at least. */
-
- cse_not_expected = 1;
-
- /* Now we choose between stupid (pcc-like) register allocation
- (if we got the -noreg switch and not -opt)
- and smart register allocation. */
-
- if (optimize > 0) /* Stupid allocation probably won't work */
- obey_regdecls = 0; /* if optimizations being done. */
-
- regclass_init ();
-
- /* Print function header into flow dump now
- because doing the flow analysis makes some of the dump. */
-
- if (flow_dump)
- TIMEVAR (dump_time,
- {
- fprintf (flow_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- });
-
- if (obey_regdecls)
- {
- TIMEVAR (flow_time,
- {
- regclass (insns, max_reg_num ());
- stupid_life_analysis (insns, max_reg_num (),
- flow_dump_file);
- });
- }
- else
- {
- /* Do control and data flow analysis,
- and write some of the results to dump file. */
-
- TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (),
- flow_dump_file));
- if (warn_uninitialized)
- {
- uninitialized_vars_warning (DECL_INITIAL (decl));
- setjmp_args_warning ();
- }
- }
-
- /* Dump rtl after flow analysis. */
-
- if (flow_dump)
- TIMEVAR (dump_time,
- {
- print_rtl (flow_dump_file, insns);
- fflush (flow_dump_file);
- });
-
- /* If -opt, try combining insns through substitution. */
-
- if (optimize > 0)
- TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
-
- /* Dump rtl code after insn combination. */
-
- if (combine_dump)
- TIMEVAR (dump_time,
- {
- fprintf (combine_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- dump_combine_stats (combine_dump_file);
- print_rtl (combine_dump_file, insns);
- fflush (combine_dump_file);
- });
-
- /* Print function header into sched dump now
- because doing the sched analysis makes some of the dump. */
-
- if (sched_dump)
- TIMEVAR (dump_time,
- {
- fprintf (sched_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- });
-
- if (optimize > 0 && flag_schedule_insns)
- {
- /* Do control and data sched analysis,
- and write some of the results to dump file. */
-
- TIMEVAR (sched_time, schedule_insns (sched_dump_file));
- }
-
- /* Dump rtl after instruction scheduling. */
-
- if (sched_dump)
- TIMEVAR (dump_time,
- {
- print_rtl (sched_dump_file, insns);
- fflush (sched_dump_file);
- });
-
- /* Unless we did stupid register allocation,
- allocate pseudo-regs that are used only within 1 basic block. */
-
- if (!obey_regdecls)
- TIMEVAR (local_alloc_time,
- {
- regclass (insns, max_reg_num ());
- local_alloc ();
- });
-
- /* Dump rtl code after allocating regs within basic blocks. */
-
- if (local_reg_dump)
- TIMEVAR (dump_time,
- {
- fprintf (local_reg_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- dump_flow_info (local_reg_dump_file);
- dump_local_alloc (local_reg_dump_file);
- print_rtl (local_reg_dump_file, insns);
- fflush (local_reg_dump_file);
- });
-
- if (global_reg_dump)
- TIMEVAR (dump_time,
- fprintf (global_reg_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl))));
-
- /* Save the last label number used so far, so reorg can tell
- when it's safe to kill spill regs. */
- max_label_num_after_reload = max_label_num ();
-
- /* Unless we did stupid register allocation,
- allocate remaining pseudo-regs, then do the reload pass
- fixing up any insns that are invalid. */
-
- TIMEVAR (global_alloc_time,
- {
- if (!obey_regdecls)
- failure = global_alloc (global_reg_dump_file);
- else
- failure = reload (insns, 0, global_reg_dump_file);
- });
-
- if (global_reg_dump)
- TIMEVAR (dump_time,
- {
- dump_global_regs (global_reg_dump_file);
- print_rtl (global_reg_dump_file, insns);
- fflush (global_reg_dump_file);
- });
-
- if (failure)
- goto exit_rest_of_compilation;
-
- reload_completed = 1;
-
- /* On some machines, the prologue and epilogue code, or parts thereof,
- can be represented as RTL. Doing so lets us schedule insns between
- it and the rest of the code and also allows delayed branch
- scheduling to operate in the epilogue. */
-
- thread_prologue_and_epilogue_insns (insns);
-
- if (optimize > 0 && flag_schedule_insns_after_reload)
- {
- if (sched2_dump)
- TIMEVAR (dump_time,
- {
- fprintf (sched2_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- });
-
- /* Do control and data sched analysis again,
- and write some more of the results to dump file. */
-
- TIMEVAR (sched2_time, schedule_insns (sched2_dump_file));
-
- /* Dump rtl after post-reorder instruction scheduling. */
-
- if (sched2_dump)
- TIMEVAR (dump_time,
- {
- print_rtl (sched2_dump_file, insns);
- fflush (sched2_dump_file);
- });
- }
-
-#ifdef LEAF_REGISTERS
- leaf_function = 0;
- if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
- leaf_function = 1;
-#endif
-
- /* One more attempt to remove jumps to .+1
- left by dead-store-elimination.
- Also do cross-jumping this time
- and delete no-op move insns. */
-
- if (optimize > 0)
- {
- TIMEVAR (jump_time, jump_optimize (insns, 1, 1, 0));
- }
-
- /* Dump rtl code after jump, if we are doing that. */
-
- if (jump2_opt_dump)
- TIMEVAR (dump_time,
- {
- fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- print_rtl (jump2_opt_dump_file, insns);
- fflush (jump2_opt_dump_file);
- });
-
- /* If a machine dependent reorganization is needed, call it. */
-#ifdef MACHINE_DEPENDENT_REORG
- MACHINE_DEPENDENT_REORG (insns);
-#endif
-
- /* If a scheduling pass for delayed branches is to be done,
- call the scheduling code. */
-
-#ifdef DELAY_SLOTS
- if (optimize > 0 && flag_delayed_branch)
- {
- TIMEVAR (dbr_sched_time, dbr_schedule (insns, dbr_sched_dump_file));
- if (dbr_sched_dump)
- {
- TIMEVAR (dump_time,
- {
- fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- print_rtl (dbr_sched_dump_file, insns);
- fflush (dbr_sched_dump_file);
- });
- }
- }
-#endif
-
- /* Shorten branches. */
- TIMEVAR (shorten_branch_time,
- {
- shorten_branches (get_insns ());
- });
-
-#ifdef STACK_REGS
- TIMEVAR (stack_reg_time, reg_to_stack (insns, stack_reg_dump_file));
- if (stack_reg_dump)
- {
- TIMEVAR (dump_time,
- {
- fprintf (stack_reg_dump_file, "\n;; Function %s\n\n",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- print_rtl (stack_reg_dump_file, insns);
- fflush (stack_reg_dump_file);
- });
- }
-#endif
-
- /* Now turn the rtl into assembler code. */
-
- TIMEVAR (final_time,
- {
- rtx x;
- char *fnname;
-
- /* Get the function's name, as described by its RTL.
- This may be different from the DECL_NAME name used
- in the source file. */
-
- x = DECL_RTL (decl);
- if (GET_CODE (x) != MEM)
- abort ();
- x = XEXP (x, 0);
- if (GET_CODE (x) != SYMBOL_REF)
- abort ();
- fnname = XSTR (x, 0);
-
- assemble_start_function (decl, fnname);
- final_start_function (insns, asm_out_file, optimize);
- final (insns, asm_out_file, optimize, 0);
- final_end_function (insns, asm_out_file, optimize);
- assemble_end_function (decl, fnname);
- fflush (asm_out_file);
- });
-
- /* Write DBX symbols if requested */
-
- /* Note that for those inline functions where we don't initially
- know for certain that we will be generating an out-of-line copy,
- the first invocation of this routine (rest_of_compilation) will
- skip over this code by doing a `goto exit_rest_of_compilation;'.
- Later on, finish_compilation will call rest_of_compilation again
- for those inline functions that need to have out-of-line copies
- generated. During that call, we *will* be routed past here. */
-
-#ifdef DBX_DEBUGGING_INFO
- if (write_symbols == DBX_DEBUG)
- TIMEVAR (symout_time, dbxout_function (decl));
-#endif
-
-#ifdef DWARF_DEBUGGING_INFO
- if (write_symbols == DWARF_DEBUG)
- TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
-#endif
-
-#ifdef DWARF2_DEBUGGING_INFO
- if (write_symbols == DWARF2_DEBUG)
- TIMEVAR (symout_time, dwarf2out_decl (decl));
-#endif
-
- exit_rest_of_compilation:
-
- /* In case the function was not output,
- don't leave any temporary anonymous types
- queued up for sdb output. */
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- sdbout_types (NULL_TREE);
-#endif
-
- /* Put back the tree of subblocks and list of arguments
- from before we copied them.
- Code generation and the output of debugging info may have modified
- the copy, but the original is unchanged. */
-
- if (saved_block_tree != 0)
- {
- DECL_INITIAL (decl) = saved_block_tree;
- DECL_ARGUMENTS (decl) = saved_arguments;
- DECL_ABSTRACT_ORIGIN (decl) = NULL_TREE;
- }
-
- reload_completed = 0;
-
- /* Clear out the insn_length contents now that they are no longer valid. */
- init_insn_lengths ();
-
- /* Clear out the real_constant_chain before some of the rtx's
- it runs through become garbage. */
-
- clear_const_double_mem ();
-
- /* Cancel the effect of rtl_in_current_obstack. */
-
- resume_temporary_allocation ();
-
- /* Show no temporary slots allocated. */
-
- init_temp_slots ();
-
- /* The parsing time is all the time spent in yyparse
- *except* what is spent in this function. */
-
- parse_time -= get_run_time () - start_time;
-}
-
-/* Entry point of cc1/c++. Decode command args, then call compile_file.
- Exit code is 35 if can't open files, 34 if fatal error,
- 33 if had nonfatal errors, else success. */
-
-int
-main (argc, argv, envp)
- int argc;
- char **argv;
- char **envp;
-{
- register int i;
- char *filename = 0;
- int flag_print_mem = 0;
- int version_flag = 0;
- char *p;
-
- /* save in case md file wants to emit args as a comment. */
- save_argc = argc;
- save_argv = argv;
-
- p = argv[0] + strlen (argv[0]);
- while (p != argv[0] && p[-1] != '/'
-#ifdef DIR_SEPARATOR
- && p[-1] != DIR_SEPARATOR
-#endif
- )
- --p;
- progname = p;
-
-#ifdef RLIMIT_STACK
- /* Get rid of any avoidable limit on stack size. */
- {
- struct rlimit rlim;
-
- /* Set the stack limit huge so that alloca does not fail. */
- getrlimit (RLIMIT_STACK, &rlim);
- rlim.rlim_cur = rlim.rlim_max;
- setrlimit (RLIMIT_STACK, &rlim);
- }
-#endif /* RLIMIT_STACK */
-
- signal (SIGFPE, float_signal);
-
-#ifdef SIGPIPE
- signal (SIGPIPE, pipe_closed);
-#endif
-
- decl_printable_name = decl_name;
- lang_expand_expr = (struct rtx_def *(*)()) do_abort;
-
- /* Initialize whether `char' is signed. */
- flag_signed_char = DEFAULT_SIGNED_CHAR;
-#ifdef DEFAULT_SHORT_ENUMS
- /* Initialize how much space enums occupy, by default. */
- flag_short_enums = DEFAULT_SHORT_ENUMS;
-#endif
-
- /* Scan to see what optimization level has been specified. That will
- determine the default value of many flags. */
- for (i = 1; i < argc; i++)
- {
- if (!strcmp (argv[i], "-O"))
- {
- optimize = 1;
- }
- else if (argv[i][0] == '-' && argv[i][1] == 'O')
- {
- /* Handle -O2, -O3, -O69, ... */
- char *p = &argv[i][2];
- int c;
-
- while (c = *p++)
- if (! (c >= '0' && c <= '9'))
- break;
- if (c == 0)
- optimize = atoi (&argv[i][2]);
- }
- }
-
- obey_regdecls = (optimize == 0);
-
- if (optimize >= 1)
- {
- flag_defer_pop = 1;
- flag_thread_jumps = 1;
-#ifdef DELAY_SLOTS
- flag_delayed_branch = 1;
-#endif
-#ifdef CAN_DEBUG_WITHOUT_FP
- flag_omit_frame_pointer = 1;
-#endif
- }
-
- if (optimize >= 2)
- {
- flag_cse_follow_jumps = 1;
- flag_cse_skip_blocks = 1;
- flag_expensive_optimizations = 1;
- flag_strength_reduce = 1;
- flag_rerun_cse_after_loop = 1;
- flag_caller_saves = 1;
- flag_force_mem = 1;
-#ifdef INSN_SCHEDULING
- flag_schedule_insns = 1;
- flag_schedule_insns_after_reload = 1;
-#endif
- }
-
- if (optimize >= 3)
- {
- flag_inline_functions = 1;
- }
-
- /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
- modify it. */
- target_flags = 0;
- set_target_switch ("");
-
-#ifdef OPTIMIZATION_OPTIONS
- /* Allow default optimizations to be specified on a per-machine basis. */
- OPTIMIZATION_OPTIONS (optimize);
-#endif
-
- /* Initialize register usage now so switches may override. */
- init_reg_sets ();
-
- for (i = 1; i < argc; i++)
- {
- int j;
- /* If this is a language-specific option,
- decode it in a language-specific way. */
- for (j = 0; lang_options[j] != 0; j++)
- if (!strncmp (argv[i], lang_options[j],
- strlen (lang_options[j])))
- break;
- if (lang_options[j] != 0)
- /* If the option is valid for *some* language,
- treat it as valid even if this language doesn't understand it. */
- lang_decode_option (argv[i]);
- else if (argv[i][0] == '-' && argv[i][1] != 0)
- {
- register char *str = argv[i] + 1;
- if (str[0] == 'Y')
- str++;
-
- if (str[0] == 'm')
- set_target_switch (&str[1]);
- else if (!strcmp (str, "dumpbase"))
- {
- dump_base_name = argv[++i];
- }
- else if (str[0] == 'd')
- {
- register char *p = &str[1];
- while (*p)
- switch (*p++)
- {
- case 'a':
- branch_prob_dump = 1;
- combine_dump = 1;
- dbr_sched_dump = 1;
- flow_dump = 1;
- global_reg_dump = 1;
- jump_opt_dump = 1;
- jump2_opt_dump = 1;
- local_reg_dump = 1;
- loop_dump = 1;
- rtl_dump = 1;
- cse_dump = 1, cse2_dump = 1;
- sched_dump = 1;
- sched2_dump = 1;
- stack_reg_dump = 1;
- break;
- case 'b':
- branch_prob_dump = 1;
- break;
- case 'k':
- stack_reg_dump = 1;
- break;
- case 'c':
- combine_dump = 1;
- break;
- case 'd':
- dbr_sched_dump = 1;
- break;
- case 'f':
- flow_dump = 1;
- break;
- case 'g':
- global_reg_dump = 1;
- break;
- case 'j':
- jump_opt_dump = 1;
- break;
- case 'J':
- jump2_opt_dump = 1;
- break;
- case 'l':
- local_reg_dump = 1;
- break;
- case 'L':
- loop_dump = 1;
- break;
- case 'm':
- flag_print_mem = 1;
- break;
- case 'p':
- flag_print_asm_name = 1;
- break;
- case 'r':
- rtl_dump = 1;
- break;
- case 's':
- cse_dump = 1;
- break;
- case 't':
- cse2_dump = 1;
- break;
- case 'S':
- sched_dump = 1;
- break;
- case 'R':
- sched2_dump = 1;
- break;
- case 'y':
- set_yydebug (1);
- break;
- case 'x':
- rtl_dump_and_exit = 1;
- break;
- case 'A':
- flag_debug_asm = 1;
- break;
- }
- }
- else if (str[0] == 'f')
- {
- register char *p = &str[1];
- int found = 0;
-
- /* Some kind of -f option.
- P's value is the option sans `-f'.
- Search for it in the table of options. */
-
- for (j = 0;
- !found && j < sizeof (f_options) / sizeof (f_options[0]);
- j++)
- {
- if (!strcmp (p, f_options[j].string))
- {
- *f_options[j].variable = f_options[j].on_value;
- /* A goto here would be cleaner,
- but breaks the vax pcc. */
- found = 1;
- }
- if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
- && ! strcmp (p+3, f_options[j].string))
- {
- *f_options[j].variable = ! f_options[j].on_value;
- found = 1;
- }
- }
-
- if (found)
- ;
- else if (!strncmp (p, "fixed-", 6))
- fix_register (&p[6], 1, 1);
- else if (!strncmp (p, "call-used-", 10))
- fix_register (&p[10], 0, 1);
- else if (!strncmp (p, "call-saved-", 11))
- fix_register (&p[11], 0, 0);
- else
- error ("Invalid option `%s'", argv[i]);
- }
- else if (str[0] == 'O')
- {
- register char *p = str+1;
- while (*p && *p >= '0' && *p <= '9')
- p++;
- if (*p == '\0')
- ;
- else
- error ("Invalid option `%s'", argv[i]);
- }
- else if (!strcmp (str, "pedantic"))
- pedantic = 1;
- else if (!strcmp (str, "pedantic-errors"))
- flag_pedantic_errors = pedantic = 1;
- else if (!strcmp (str, "quiet"))
- quiet_flag = 1;
- else if (!strcmp (str, "version"))
- version_flag = 1;
- else if (!strcmp (str, "w"))
- inhibit_warnings = 1;
- else if (!strcmp (str, "W"))
- {
- extra_warnings = 1;
- /* We save the value of warn_uninitialized, since if they put
- -Wuninitialized on the command line, we need to generate a
- warning about not using it without also specifying -O. */
- if (warn_uninitialized != 1)
- warn_uninitialized = 2;
- }
- else if (str[0] == 'W')
- {
- register char *p = &str[1];
- int found = 0;
-
- /* Some kind of -W option.
- P's value is the option sans `-W'.
- Search for it in the table of options. */
-
- for (j = 0;
- !found && j < sizeof (W_options) / sizeof (W_options[0]);
- j++)
- {
- if (!strcmp (p, W_options[j].string))
- {
- *W_options[j].variable = W_options[j].on_value;
- /* A goto here would be cleaner,
- but breaks the vax pcc. */
- found = 1;
- }
- if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
- && ! strcmp (p+3, W_options[j].string))
- {
- *W_options[j].variable = ! W_options[j].on_value;
- found = 1;
- }
- }
-
- if (found)
- ;
- else if (!strncmp (p, "id-clash-", 9))
- {
- char *endp = p + 9;
-
- while (*endp)
- {
- if (*endp >= '0' && *endp <= '9')
- endp++;
- else
- {
- error ("Invalid option `%s'", argv[i]);
- goto id_clash_lose;
- }
- }
- warn_id_clash = 1;
- id_clash_len = atoi (str + 10);
- id_clash_lose: ;
- }
- else if (!strncmp (p, "larger-than-", 12))
- {
- char *endp = p + 12;
-
- while (*endp)
- {
- if (*endp >= '0' && *endp <= '9')
- endp++;
- else
- {
- error ("Invalid option `%s'", argv[i]);
- goto larger_than_lose;
- }
- }
- warn_larger_than = 1;
- larger_than_size = atoi (str + 13);
- larger_than_lose: ;
- }
- else
- error ("Invalid option `%s'", argv[i]);
- }
- else if (!strcmp (str, "p"))
- {
- profile_flag = 1;
- }
- else if (!strcmp (str, "a"))
- {
-#if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
- warning ("`-a' option (basic block profile) not supported");
-#else
- profile_block_flag = (profile_block_flag < 2) ? 1 : 3;
-#endif
- }
- else if (!strcmp (str, "ax"))
- {
-#if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
- warning ("`-ax' option (jump profiling) not supported");
-#else
- profile_block_flag = (!profile_block_flag
- || profile_block_flag == 2) ? 2 : 3;
-#endif
- }
- else if (str[0] == 'g')
- {
- unsigned len;
- unsigned level;
- /* A lot of code assumes write_symbols == NO_DEBUG if the
- debugging level is 0 (thus -gstabs1 -gstabs0 would lose track
- of what debugging type has been selected). This records the
- selected type. It is an error to specify more than one
- debugging type. */
- static enum debug_info_type selected_debug_type = NO_DEBUG;
- /* Non-zero if debugging format has been explicitly set.
- -g and -ggdb don't explicitly set the debugging format so
- -gdwarf -g3 is equivalent to -gdwarf3. */
- static int type_explicitly_set_p = 0;
- /* Table of supported debugging formats. */
- static struct {
- char *arg;
- /* Since PREFERRED_DEBUGGING_TYPE isn't necessarily a
- constant expression, we use NO_DEBUG in its place. */
- enum debug_info_type debug_type;
- int use_extensions_p;
- } *da, debug_args[] = {
- { "g", NO_DEBUG, DEFAULT_GDB_EXTENSIONS },
- { "ggdb", NO_DEBUG, 1 },
-#ifdef DBX_DEBUGGING_INFO
- { "gstabs", DBX_DEBUG, 0 },
- { "gstabs+", DBX_DEBUG, 1 },
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- { "gdwarf", DWARF_DEBUG, 0 },
- { "gdwarf+", DWARF_DEBUG, 1 },
-#endif
-#ifdef DWARF2_DEBUGGING_INFO
- { "gdwarf-2", DWARF2_DEBUG, 0 },
-#endif
-#ifdef XCOFF_DEBUGGING_INFO
- { "gxcoff", XCOFF_DEBUG, 0 },
- { "gxcoff+", XCOFF_DEBUG, 1 },
-#endif
-#ifdef SDB_DEBUGGING_INFO
- { "gcoff", SDB_DEBUG, 0 },
-#endif
- { 0, 0, 0 }
- };
- /* Indexed by enum debug_info_type. */
- static char *debug_type_names[] = {
- "none", "stabs", "coff", "dwarf-1", "dwarf-2", "xcoff"
- };
-
- /* Look up STR in the table. */
- for (da = debug_args; da->arg; da++)
- {
- if (! strncmp (str, da->arg, strlen (da->arg)))
- {
- enum debug_info_type type = da->debug_type;
- char *p, *q;
-
- p = str + strlen (da->arg);
- if (*p && (*p < '0' || *p > '9'))
- continue;
- q = p;
- while (*q && (*q >= '0' && *q <= '9'))
- q++;
- if (*p)
- level = atoi (p);
- else
- level = 2; /* default debugging info level */
- if (*q || level > 3)
- {
- warning ("invalid debug level specification in option: `-%s'",
- str);
- /* ??? This error message is incorrect in the case of
- -g4 -g. */
- warning ("no debugging information will be generated");
- level = 0;
- }
-
- /* ??? A few targets use STR in the
- definition of PREFERRED_DEBUGGING_TYPE! */
- if (type == NO_DEBUG)
- type = PREFERRED_DEBUGGING_TYPE;
-
- if (type == NO_DEBUG)
- warning ("`-%s' not supported by this configuration of GCC",
- str);
-
- /* Does it conflict with an already selected type? */
- if (type_explicitly_set_p
- /* -g/-ggdb don't conflict with anything */
- && da->debug_type != NO_DEBUG
- && type != selected_debug_type)
- warning ("`-%s' ignored, conflicts with `-g%s'",
- str, debug_type_names[(int) selected_debug_type]);
- else
- {
- /* If the format has already been set, -g/-ggdb
- only change the debug level. */
- if (type_explicitly_set_p
- && da->debug_type == NO_DEBUG)
- ; /* don't change debugging type */
- else
- {
- selected_debug_type = type;
- type_explicitly_set_p = da->debug_type != NO_DEBUG;
- }
- write_symbols = (level == 0
- ? NO_DEBUG
- : selected_debug_type);
- use_gnu_debug_info_extensions = da->use_extensions_p;
- debug_info_level = (enum debug_info_level) level;
- }
- break;
- }
- }
- if (! da->arg)
- warning ("`-%s' not supported by this configuration of GCC",
- str);
- }
- else if (!strcmp (str, "o"))
- {
- asm_file_name = argv[++i];
- }
- else if (str[0] == 'G')
- {
- g_switch_set = TRUE;
- g_switch_value = atoi ((str[1] != '\0') ? str+1 : argv[++i]);
- }
- else if (!strncmp (str, "aux-info", 8))
- {
- flag_gen_aux_info = 1;
- aux_info_file_name = (str[8] != '\0' ? str+8 : argv[++i]);
- }
- else
- error ("Invalid option `%s'", argv[i]);
- }
- else if (argv[i][0] == '+')
- error ("Invalid option `%s'", argv[i]);
- else
- filename = argv[i];
- }
-
- /* Initialize for bytecode output. A good idea to do this as soon as
- possible after the "-f" options have been parsed. */
- if (output_bytecode)
- {
-#ifndef TARGET_SUPPORTS_BYTECODE
- /* Just die with a fatal error if not supported */
- fatal ("-fbytecode not supported for this target");
-#else
- bc_initialize ();
-#endif
- }
-
- if (optimize == 0)
- {
- /* Inlining does not work if not optimizing,
- so force it not to be done. */
- flag_no_inline = 1;
- warn_inline = 0;
-
- /* The c_decode_option and lang_decode_option functions set
- this to `2' if -Wall is used, so we can avoid giving out
- lots of errors for people who don't realize what -Wall does. */
- if (warn_uninitialized == 1)
- warning ("-Wuninitialized is not supported without -O");
- }
-
-#ifdef OVERRIDE_OPTIONS
- /* Some machines may reject certain combinations of options. */
- OVERRIDE_OPTIONS;
-#endif
-
- if (profile_block_flag == 3)
- {
- warning ("`-ax' and `-a' are conflicting options. `-a' ignored.");
- profile_block_flag = 2;
- }
-
- /* Unrolling all loops implies that standard loop unrolling must also
- be done. */
- if (flag_unroll_all_loops)
- flag_unroll_loops = 1;
- /* 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_unroll_loops)
- {
- flag_strength_reduce = 1;
- flag_rerun_cse_after_loop = 1;
- }
-
- /* Warn about options that are not supported on this machine. */
-#ifndef INSN_SCHEDULING
- if (flag_schedule_insns || flag_schedule_insns_after_reload)
- warning ("instruction scheduling not supported on this target machine");
-#endif
-#ifndef DELAY_SLOTS
- if (flag_delayed_branch)
- warning ("this target machine does not have delayed branches");
-#endif
-
- /* If we are in verbose mode, write out the version and maybe all the
- option flags in use. */
- if (version_flag)
- {
- print_version (stderr, "");
- if (! quiet_flag)
- print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
- }
-
- compile_file (filename);
-
-#if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN32__))
- if (flag_print_mem)
- {
- char *lim = (char *) sbrk (0);
-
- fprintf (stderr, "Data size %d.\n",
- lim - (char *) &environ);
- fflush (stderr);
-
-#ifdef USG
- system ("ps -l 1>&2");
-#else /* not USG */
- system ("ps v");
-#endif /* not USG */
- }
-#endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN32) */
-
- if (errorcount)
- exit (FATAL_EXIT_CODE);
- if (sorrycount)
- exit (FATAL_EXIT_CODE);
- exit (SUCCESS_EXIT_CODE);
- return 0;
-}
-
-/* Decode -m switches. */
-
-/* Here is a table, controlled by the tm.h file, listing each -m switch
- and which bits in `target_switches' it should set or clear.
- If VALUE is positive, it is bits to set.
- If VALUE is negative, -VALUE is bits to clear.
- (The sign bit is not used so there is no confusion.) */
-
-struct {char *name; int value;} target_switches []
- = TARGET_SWITCHES;
-
-/* This table is similar, but allows the switch to have a value. */
-
-#ifdef TARGET_OPTIONS
-struct {char *prefix; char ** variable;} target_options []
- = TARGET_OPTIONS;
-#endif
-
-/* Decode the switch -mNAME. */
-
-void
-set_target_switch (name)
- char *name;
-{
- register int j;
- int valid = 0;
-
- for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
- if (!strcmp (target_switches[j].name, name))
- {
- if (target_switches[j].value < 0)
- target_flags &= ~-target_switches[j].value;
- else
- target_flags |= target_switches[j].value;
- valid = 1;
- }
-
-#ifdef TARGET_OPTIONS
- if (!valid)
- for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
- {
- int len = strlen (target_options[j].prefix);
- if (!strncmp (target_options[j].prefix, name, len))
- {
- *target_options[j].variable = name + len;
- valid = 1;
- }
- }
-#endif
-
- if (!valid)
- error ("Invalid option `%s'", name);
-}
-
-/* Print version information to FILE.
- Each line begins with INDENT (for the case where FILE is the
- assembler output file). */
-
-void
-print_version (file, indent)
- FILE *file;
- char *indent;
-{
- fprintf (file, "%s%s%s version %s", indent, *indent != 0 ? " " : "",
- language_string, version_string);
- fprintf (file, " (%s)", TARGET_NAME);
-#ifdef __GNUC__
-#ifndef __VERSION__
-#define __VERSION__ "[unknown]"
-#endif
- fprintf (file, " compiled by GNU C version %s.\n", __VERSION__);
-#else
- fprintf (file, " compiled by CC.\n");
-#endif
-}
-
-/* Print an option value and return the adjusted position in the line.
- ??? We don't handle error returns from fprintf (disk full); presumably
- other code will catch a disk full though. */
-
-int
-print_single_switch (file, pos, max, indent, sep, term, type, name)
- FILE *file;
- int pos, max;
- char *indent, *sep, *term, *type, *name;
-{
- /* The ultrix fprintf returns 0 on success, so compute the result we want
- here since we need it for the following test. */
- int len = strlen (sep) + strlen (type) + strlen (name);
-
- if (pos != 0
- && pos + len > max)
- {
- fprintf (file, "%s", term);
- pos = 0;
- }
- if (pos == 0)
- {
- fprintf (file, "%s", indent);
- pos = strlen (indent);
- }
- fprintf (file, "%s%s%s", sep, type, name);
- pos += len;
- return pos;
-}
-
-/* Print active target switches to FILE.
- POS is the current cursor position and MAX is the size of a "line".
- Each line begins with INDENT and ends with TERM.
- Each switch is separated from the next by SEP. */
-
-void
-print_switch_values (file, pos, max, indent, sep, term)
- FILE *file;
- int pos, max;
- char *indent, *sep, *term;
-{
- int j, flags;
- char **p;
-
- /* Print the options as passed. */
-
- pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
- "options passed: ", "");
-
- for (p = &save_argv[1]; *p != NULL; p++)
- if (**p == '-')
- {
- /* Ignore these. */
- if (strcmp (*p, "-o") == 0)
- {
- if (p[1] != NULL)
- p++;
- continue;
- }
- if (strcmp (*p, "-quiet") == 0)
- continue;
- if (strcmp (*p, "-version") == 0)
- continue;
- if ((*p)[1] == 'd')
- continue;
-
- pos = print_single_switch (file, pos, max, indent, sep, term, *p, "");
- }
- if (pos > 0)
- fprintf (file, "%s", term);
-
- /* Print the -f and -m options that have been enabled.
- We don't handle language specific options but printing argv
- should suffice. */
-
- pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
- "options enabled: ", "");
-
- for (j = 0; j < sizeof f_options / sizeof f_options[0]; 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);
-
- /* Print target specific options. */
-
- flags = target_flags;
- for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
- if (target_switches[j].name[0] != '\0'
- && target_switches[j].value > 0
- && ((target_switches[j].value & target_flags)
- == target_switches[j].value))
- {
- pos = print_single_switch (file, pos, max, indent, sep, term,
- "-m", target_switches[j].name);
- flags &= ~ target_switches[j].value;
- }
-
-#ifdef TARGET_OPTIONS
- for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
- if (*target_options[j].variable != NULL)
- {
- char prefix[256];
- sprintf (prefix, "-m%s", target_options[j].prefix);
- pos = print_single_switch (file, pos, max, indent, sep, term,
- prefix, *target_options[j].variable);
- }
-#endif
-
- fprintf (file, "%s", term);
-}
-
-/* Record the beginning of a new source file, named FILENAME. */
-
-void
-debug_start_source_file (filename)
- register char *filename;
-{
-#ifdef DBX_DEBUGGING_INFO
- if (write_symbols == DBX_DEBUG)
- dbxout_start_new_source_file (filename);
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF_DEBUG)
- dwarfout_start_new_source_file (filename);
-#endif /* DWARF_DEBUGGING_INFO */
-#ifdef DWARF2_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF2_DEBUG)
- dwarf2out_start_source_file (filename);
-#endif /* DWARF2_DEBUGGING_INFO */
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- sdbout_start_new_source_file (filename);
-#endif
-}
-
-/* Record the resumption of a source file. LINENO is the line number in
- the source file we are returning to. */
-
-void
-debug_end_source_file (lineno)
- register unsigned lineno;
-{
-#ifdef DBX_DEBUGGING_INFO
- if (write_symbols == DBX_DEBUG)
- dbxout_resume_previous_source_file ();
-#endif
-#ifdef DWARF_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF_DEBUG)
- dwarfout_resume_previous_source_file (lineno);
-#endif /* DWARF_DEBUGGING_INFO */
-#ifdef DWARF2_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF2_DEBUG)
- dwarf2out_end_source_file ();
-#endif /* DWARF2_DEBUGGING_INFO */
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG)
- sdbout_resume_previous_source_file ();
-#endif
-}
-
-/* Called from check_newline in c-parse.y. The `buffer' parameter contains
- the tail part of the directive line, i.e. the part which is past the
- initial whitespace, #, whitespace, directive-name, whitespace part. */
-
-void
-debug_define (lineno, buffer)
- register unsigned lineno;
- register char *buffer;
-{
-#ifdef DWARF_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF_DEBUG)
- dwarfout_define (lineno, buffer);
-#endif /* DWARF_DEBUGGING_INFO */
-#ifdef DWARF2_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF2_DEBUG)
- dwarf2out_define (lineno, buffer);
-#endif /* DWARF2_DEBUGGING_INFO */
-}
-
-/* Called from check_newline in c-parse.y. The `buffer' parameter contains
- the tail part of the directive line, i.e. the part which is past the
- initial whitespace, #, whitespace, directive-name, whitespace part. */
-
-void
-debug_undef (lineno, buffer)
- register unsigned lineno;
- register char *buffer;
-{
-#ifdef DWARF_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF_DEBUG)
- dwarfout_undef (lineno, buffer);
-#endif /* DWARF_DEBUGGING_INFO */
-#ifdef DWARF2_DEBUGGING_INFO
- if (debug_info_level == DINFO_LEVEL_VERBOSE
- && write_symbols == DWARF2_DEBUG)
- dwarf2out_undef (lineno, buffer);
-#endif /* DWARF2_DEBUGGING_INFO */
-}
diff --git a/gcc/tree.c b/gcc/tree.c
deleted file mode 100644
index f09c36a6518..00000000000
--- a/gcc/tree.c
+++ /dev/null
@@ -1,4612 +0,0 @@
-/* Language-independent node constructors for parse phase of GNU compiler.
- Copyright (C) 1987, 88, 92-96, 1997 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 contains the low level primitives for operating on tree nodes,
- including allocation, list operations, interning of identifiers,
- construction of data type nodes and statement nodes,
- and construction of type conversion nodes. It also contains
- tables index by tree code that describe how to take apart
- nodes of that code.
-
- It is intended to be language-independent, but occasionally
- calls language-dependent routines defined (for C) in typecheck.c.
-
- The low-level allocation routines oballoc and permalloc
- are used also for allocating many other kinds of objects
- by all passes of the compiler. */
-
-#include <setjmp.h>
-#include "config.h"
-#include "flags.h"
-#include "tree.h"
-#include "except.h"
-#include "function.h"
-#include "obstack.h"
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <stdio.h>
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
-/* Tree nodes of permanent duration are allocated in this obstack.
- They are the identifier nodes, and everything outside of
- the bodies and parameters of function definitions. */
-
-struct obstack permanent_obstack;
-
-/* The initial RTL, and all ..._TYPE nodes, in a function
- are allocated in this obstack. Usually they are freed at the
- end of the function, but if the function is inline they are saved.
- For top-level functions, this is maybepermanent_obstack.
- Separate obstacks are made for nested functions. */
-
-struct obstack *function_maybepermanent_obstack;
-
-/* This is the function_maybepermanent_obstack for top-level functions. */
-
-struct obstack maybepermanent_obstack;
-
-/* This is a list of function_maybepermanent_obstacks for top-level inline
- functions that are compiled in the middle of compiling other functions. */
-
-struct simple_obstack_stack *toplev_inline_obstacks;
-
-/* This is a list of function_maybepermanent_obstacks for inline functions
- nested in the current function that were compiled in the middle of
- compiling other functions. */
-
-struct simple_obstack_stack *inline_obstacks;
-
-/* The contents of the current function definition are allocated
- in this obstack, and all are freed at the end of the function.
- For top-level functions, this is temporary_obstack.
- Separate obstacks are made for nested functions. */
-
-struct obstack *function_obstack;
-
-/* This is used for reading initializers of global variables. */
-
-struct obstack temporary_obstack;
-
-/* The tree nodes of an expression are allocated
- in this obstack, and all are freed at the end of the expression. */
-
-struct obstack momentary_obstack;
-
-/* The tree nodes of a declarator are allocated
- in this obstack, and all are freed when the declarator
- has been parsed. */
-
-static struct obstack temp_decl_obstack;
-
-/* This points at either permanent_obstack
- or the current function_maybepermanent_obstack. */
-
-struct obstack *saveable_obstack;
-
-/* This is same as saveable_obstack during parse and expansion phase;
- it points to the current function's obstack during optimization.
- This is the obstack to be used for creating rtl objects. */
-
-struct obstack *rtl_obstack;
-
-/* This points at either permanent_obstack or the current function_obstack. */
-
-struct obstack *current_obstack;
-
-/* This points at either permanent_obstack or the current function_obstack
- or momentary_obstack. */
-
-struct obstack *expression_obstack;
-
-/* Stack of obstack selections for push_obstacks and pop_obstacks. */
-
-struct obstack_stack
-{
- struct obstack_stack *next;
- struct obstack *current;
- struct obstack *saveable;
- struct obstack *expression;
- struct obstack *rtl;
-};
-
-struct obstack_stack *obstack_stack;
-
-/* Obstack for allocating struct obstack_stack entries. */
-
-static struct obstack obstack_stack_obstack;
-
-/* Addresses of first objects in some obstacks.
- This is for freeing their entire contents. */
-char *maybepermanent_firstobj;
-char *temporary_firstobj;
-char *momentary_firstobj;
-char *temp_decl_firstobj;
-
-/* This is used to preserve objects (mainly array initializers) that need to
- live until the end of the current function, but no further. */
-char *momentary_function_firstobj;
-
-/* Nonzero means all ..._TYPE nodes should be allocated permanently. */
-
-int all_types_permanent;
-
-/* Stack of places to restore the momentary obstack back to. */
-
-struct momentary_level
-{
- /* Pointer back to previous such level. */
- struct momentary_level *prev;
- /* First object allocated within this level. */
- char *base;
- /* Value of expression_obstack saved at entry to this level. */
- struct obstack *obstack;
-};
-
-struct momentary_level *momentary_stack;
-
-/* Table indexed by tree code giving a string containing a character
- classifying the tree code. Possibilities are
- t, d, s, c, r, <, 1, 2 and e. See tree.def for details. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-
-char *standard_tree_code_type[] = {
-#include "tree.def"
-};
-#undef DEFTREECODE
-
-/* Table indexed by tree code giving number of expression
- operands beyond the fixed part of the node structure.
- Not used for types or decls. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
-
-int standard_tree_code_length[] = {
-#include "tree.def"
-};
-#undef DEFTREECODE
-
-/* Names of tree components.
- Used for printing out the tree and error messages. */
-#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
-
-char *standard_tree_code_name[] = {
-#include "tree.def"
-};
-#undef DEFTREECODE
-
-/* Table indexed by tree code giving a string containing a character
- classifying the tree code. Possibilities are
- t, d, s, c, r, e, <, 1 and 2. See tree.def for details. */
-
-char **tree_code_type;
-
-/* Table indexed by tree code giving number of expression
- operands beyond the fixed part of the node structure.
- Not used for types or decls. */
-
-int *tree_code_length;
-
-/* Table indexed by tree code giving name of tree code, as a string. */
-
-char **tree_code_name;
-
-/* Statistics-gathering stuff. */
-typedef enum
-{
- d_kind,
- t_kind,
- b_kind,
- s_kind,
- r_kind,
- e_kind,
- c_kind,
- id_kind,
- op_id_kind,
- perm_list_kind,
- temp_list_kind,
- vec_kind,
- x_kind,
- lang_decl,
- lang_type,
- all_kinds
-} tree_node_kind;
-
-int tree_node_counts[(int)all_kinds];
-int tree_node_sizes[(int)all_kinds];
-int id_string_size = 0;
-
-char *tree_node_kind_names[] = {
- "decls",
- "types",
- "blocks",
- "stmts",
- "refs",
- "exprs",
- "constants",
- "identifiers",
- "op_identifiers",
- "perm_tree_lists",
- "temp_tree_lists",
- "vecs",
- "random kinds",
- "lang_decl kinds",
- "lang_type kinds"
-};
-
-/* Hash table for uniquizing IDENTIFIER_NODEs by name. */
-
-#define MAX_HASH_TABLE 1009
-static tree hash_table[MAX_HASH_TABLE]; /* id hash buckets */
-
-/* 0 while creating built-in identifiers. */
-static int do_identifier_warnings;
-
-/* Unique id for next decl created. */
-static int next_decl_uid;
-/* Unique id for next type created. */
-static int next_type_uid = 1;
-
-/* Here is how primitive or already-canonicalized types' hash
- codes are made. */
-#define TYPE_HASH(TYPE) ((HOST_WIDE_INT) (TYPE) & 0777777)
-
-extern char *mode_name[];
-
-void gcc_obstack_init ();
-
-/* Init the principal obstacks. */
-
-void
-init_obstacks ()
-{
- gcc_obstack_init (&obstack_stack_obstack);
- gcc_obstack_init (&permanent_obstack);
-
- gcc_obstack_init (&temporary_obstack);
- temporary_firstobj = (char *) obstack_alloc (&temporary_obstack, 0);
- gcc_obstack_init (&momentary_obstack);
- momentary_firstobj = (char *) obstack_alloc (&momentary_obstack, 0);
- momentary_function_firstobj = momentary_firstobj;
- gcc_obstack_init (&maybepermanent_obstack);
- maybepermanent_firstobj
- = (char *) obstack_alloc (&maybepermanent_obstack, 0);
- gcc_obstack_init (&temp_decl_obstack);
- temp_decl_firstobj = (char *) obstack_alloc (&temp_decl_obstack, 0);
-
- function_obstack = &temporary_obstack;
- function_maybepermanent_obstack = &maybepermanent_obstack;
- current_obstack = &permanent_obstack;
- expression_obstack = &permanent_obstack;
- rtl_obstack = saveable_obstack = &permanent_obstack;
-
- /* Init the hash table of identifiers. */
- bzero ((char *) hash_table, sizeof hash_table);
-}
-
-void
-gcc_obstack_init (obstack)
- struct obstack *obstack;
-{
- /* Let particular systems override the size of a chunk. */
-#ifndef OBSTACK_CHUNK_SIZE
-#define OBSTACK_CHUNK_SIZE 0
-#endif
- /* Let them override the alloc and free routines too. */
-#ifndef OBSTACK_CHUNK_ALLOC
-#define OBSTACK_CHUNK_ALLOC xmalloc
-#endif
-#ifndef OBSTACK_CHUNK_FREE
-#define OBSTACK_CHUNK_FREE free
-#endif
- _obstack_begin (obstack, OBSTACK_CHUNK_SIZE, 0,
- (void *(*) ()) OBSTACK_CHUNK_ALLOC,
- (void (*) ()) OBSTACK_CHUNK_FREE);
-}
-
-/* Save all variables describing the current status into the structure *P.
- This is used before starting a nested function.
-
- CONTEXT is the decl_function_context for the function we're about to
- compile; if it isn't current_function_decl, we have to play some games. */
-
-void
-save_tree_status (p, context)
- struct function *p;
- tree context;
-{
- p->all_types_permanent = all_types_permanent;
- p->momentary_stack = momentary_stack;
- p->maybepermanent_firstobj = maybepermanent_firstobj;
- p->temporary_firstobj = temporary_firstobj;
- p->momentary_firstobj = momentary_firstobj;
- p->momentary_function_firstobj = momentary_function_firstobj;
- p->function_obstack = function_obstack;
- p->function_maybepermanent_obstack = function_maybepermanent_obstack;
- p->current_obstack = current_obstack;
- p->expression_obstack = expression_obstack;
- p->saveable_obstack = saveable_obstack;
- p->rtl_obstack = rtl_obstack;
- p->inline_obstacks = inline_obstacks;
-
- if (context == current_function_decl)
- /* Objects that need to be saved in this function can be in the nonsaved
- obstack of the enclosing function since they can't possibly be needed
- once it has returned. */
- function_maybepermanent_obstack = function_obstack;
- else
- {
- /* We're compiling a function which isn't nested in the current
- function. We need to create a new maybepermanent_obstack for this
- function, since it can't go onto any of the existing obstacks. */
- struct simple_obstack_stack **head;
- struct simple_obstack_stack *current;
-
- if (context == NULL_TREE)
- head = &toplev_inline_obstacks;
- else
- {
- struct function *f = find_function_data (context);
- head = &f->inline_obstacks;
- }
-
- current = ((struct simple_obstack_stack *)
- xmalloc (sizeof (struct simple_obstack_stack)));
-
- current->obstack = (struct obstack *) xmalloc (sizeof (struct obstack));
- function_maybepermanent_obstack = current->obstack;
- gcc_obstack_init (function_maybepermanent_obstack);
-
- current->next = *head;
- *head = current;
- }
-
- maybepermanent_firstobj
- = (char *) obstack_finish (function_maybepermanent_obstack);
-
- function_obstack = (struct obstack *) xmalloc (sizeof (struct obstack));
- gcc_obstack_init (function_obstack);
-
- current_obstack = &permanent_obstack;
- expression_obstack = &permanent_obstack;
- rtl_obstack = saveable_obstack = &permanent_obstack;
-
- temporary_firstobj = (char *) obstack_alloc (&temporary_obstack, 0);
- momentary_firstobj = (char *) obstack_finish (&momentary_obstack);
- momentary_function_firstobj = momentary_firstobj;
-}
-
-/* Restore all variables describing the current status from the structure *P.
- This is used after a nested function. */
-
-void
-restore_tree_status (p)
- struct function *p;
-{
- all_types_permanent = p->all_types_permanent;
- momentary_stack = p->momentary_stack;
-
- obstack_free (&momentary_obstack, momentary_function_firstobj);
-
- /* Free saveable storage used by the function just compiled and not
- saved.
-
- CAUTION: This is in function_obstack of the containing function.
- So we must be sure that we never allocate from that obstack during
- the compilation of a nested function if we expect it to survive
- past the nested function's end. */
- obstack_free (function_maybepermanent_obstack, maybepermanent_firstobj);
-
- obstack_free (function_obstack, 0);
- free (function_obstack);
-
- temporary_firstobj = p->temporary_firstobj;
- momentary_firstobj = p->momentary_firstobj;
- momentary_function_firstobj = p->momentary_function_firstobj;
- maybepermanent_firstobj = p->maybepermanent_firstobj;
- function_obstack = p->function_obstack;
- function_maybepermanent_obstack = p->function_maybepermanent_obstack;
- current_obstack = p->current_obstack;
- expression_obstack = p->expression_obstack;
- saveable_obstack = p->saveable_obstack;
- rtl_obstack = p->rtl_obstack;
- inline_obstacks = p->inline_obstacks;
-}
-
-/* Start allocating on the temporary (per function) obstack.
- This is done in start_function before parsing the function body,
- and before each initialization at top level, and to go back
- to temporary allocation after doing permanent_allocation. */
-
-void
-temporary_allocation ()
-{
- /* Note that function_obstack at top level points to temporary_obstack.
- But within a nested function context, it is a separate obstack. */
- current_obstack = function_obstack;
- expression_obstack = function_obstack;
- rtl_obstack = saveable_obstack = function_maybepermanent_obstack;
- momentary_stack = 0;
- inline_obstacks = 0;
-}
-
-/* Start allocating on the permanent obstack but don't
- free the temporary data. After calling this, call
- `permanent_allocation' to fully resume permanent allocation status. */
-
-void
-end_temporary_allocation ()
-{
- current_obstack = &permanent_obstack;
- expression_obstack = &permanent_obstack;
- rtl_obstack = saveable_obstack = &permanent_obstack;
-}
-
-/* Resume allocating on the temporary obstack, undoing
- effects of `end_temporary_allocation'. */
-
-void
-resume_temporary_allocation ()
-{
- current_obstack = function_obstack;
- expression_obstack = function_obstack;
- rtl_obstack = saveable_obstack = function_maybepermanent_obstack;
-}
-
-/* While doing temporary allocation, switch to allocating in such a
- way as to save all nodes if the function is inlined. Call
- resume_temporary_allocation to go back to ordinary temporary
- allocation. */
-
-void
-saveable_allocation ()
-{
- /* Note that function_obstack at top level points to temporary_obstack.
- But within a nested function context, it is a separate obstack. */
- expression_obstack = current_obstack = saveable_obstack;
-}
-
-/* Switch to current obstack CURRENT and maybepermanent obstack SAVEABLE,
- recording the previously current obstacks on a stack.
- This does not free any storage in any obstack. */
-
-void
-push_obstacks (current, saveable)
- struct obstack *current, *saveable;
-{
- struct obstack_stack *p
- = (struct obstack_stack *) obstack_alloc (&obstack_stack_obstack,
- (sizeof (struct obstack_stack)));
-
- p->current = current_obstack;
- p->saveable = saveable_obstack;
- p->expression = expression_obstack;
- p->rtl = rtl_obstack;
- p->next = obstack_stack;
- obstack_stack = p;
-
- current_obstack = current;
- expression_obstack = current;
- rtl_obstack = saveable_obstack = saveable;
-}
-
-/* Save the current set of obstacks, but don't change them. */
-
-void
-push_obstacks_nochange ()
-{
- struct obstack_stack *p
- = (struct obstack_stack *) obstack_alloc (&obstack_stack_obstack,
- (sizeof (struct obstack_stack)));
-
- p->current = current_obstack;
- p->saveable = saveable_obstack;
- p->expression = expression_obstack;
- p->rtl = rtl_obstack;
- p->next = obstack_stack;
- obstack_stack = p;
-}
-
-/* Pop the obstack selection stack. */
-
-void
-pop_obstacks ()
-{
- struct obstack_stack *p = obstack_stack;
- obstack_stack = p->next;
-
- current_obstack = p->current;
- saveable_obstack = p->saveable;
- expression_obstack = p->expression;
- rtl_obstack = p->rtl;
-
- obstack_free (&obstack_stack_obstack, p);
-}
-
-/* Nonzero if temporary allocation is currently in effect.
- Zero if currently doing permanent allocation. */
-
-int
-allocation_temporary_p ()
-{
- return current_obstack != &permanent_obstack;
-}
-
-/* Go back to allocating on the permanent obstack
- and free everything in the temporary obstack.
-
- FUNCTION_END is true only if we have just finished compiling a function.
- In that case, we also free preserved initial values on the momentary
- obstack. */
-
-void
-permanent_allocation (function_end)
- int function_end;
-{
- /* Free up previous temporary obstack data */
- obstack_free (&temporary_obstack, temporary_firstobj);
- if (function_end)
- {
- obstack_free (&momentary_obstack, momentary_function_firstobj);
- momentary_firstobj = momentary_function_firstobj;
- }
- else
- obstack_free (&momentary_obstack, momentary_firstobj);
- obstack_free (function_maybepermanent_obstack, maybepermanent_firstobj);
- obstack_free (&temp_decl_obstack, temp_decl_firstobj);
-
- /* Free up the maybepermanent_obstacks for any of our nested functions
- which were compiled at a lower level. */
- while (inline_obstacks)
- {
- struct simple_obstack_stack *current = inline_obstacks;
- inline_obstacks = current->next;
- obstack_free (current->obstack, 0);
- free (current->obstack);
- free (current);
- }
-
- current_obstack = &permanent_obstack;
- expression_obstack = &permanent_obstack;
- rtl_obstack = saveable_obstack = &permanent_obstack;
-}
-
-/* Save permanently everything on the maybepermanent_obstack. */
-
-void
-preserve_data ()
-{
- maybepermanent_firstobj
- = (char *) obstack_alloc (function_maybepermanent_obstack, 0);
-}
-
-void
-preserve_initializer ()
-{
- struct momentary_level *tem;
- char *old_momentary;
-
- temporary_firstobj
- = (char *) obstack_alloc (&temporary_obstack, 0);
- maybepermanent_firstobj
- = (char *) obstack_alloc (function_maybepermanent_obstack, 0);
-
- old_momentary = momentary_firstobj;
- momentary_firstobj
- = (char *) obstack_alloc (&momentary_obstack, 0);
- if (momentary_firstobj != old_momentary)
- for (tem = momentary_stack; tem; tem = tem->prev)
- tem->base = momentary_firstobj;
-}
-
-/* Start allocating new rtl in current_obstack.
- Use resume_temporary_allocation
- to go back to allocating rtl in saveable_obstack. */
-
-void
-rtl_in_current_obstack ()
-{
- rtl_obstack = current_obstack;
-}
-
-/* Start allocating rtl from saveable_obstack. Intended to be used after
- a call to push_obstacks_nochange. */
-
-void
-rtl_in_saveable_obstack ()
-{
- rtl_obstack = saveable_obstack;
-}
-
-/* Allocate SIZE bytes in the current obstack
- and return a pointer to them.
- In practice the current obstack is always the temporary one. */
-
-char *
-oballoc (size)
- int size;
-{
- return (char *) obstack_alloc (current_obstack, size);
-}
-
-/* Free the object PTR in the current obstack
- as well as everything allocated since PTR.
- In practice the current obstack is always the temporary one. */
-
-void
-obfree (ptr)
- char *ptr;
-{
- obstack_free (current_obstack, ptr);
-}
-
-/* Allocate SIZE bytes in the permanent obstack
- and return a pointer to them. */
-
-char *
-permalloc (size)
- int size;
-{
- return (char *) obstack_alloc (&permanent_obstack, size);
-}
-
-/* Allocate NELEM items of SIZE bytes in the permanent obstack
- and return a pointer to them. The storage is cleared before
- returning the value. */
-
-char *
-perm_calloc (nelem, size)
- int nelem;
- long size;
-{
- char *rval = (char *) obstack_alloc (&permanent_obstack, nelem * size);
- bzero (rval, nelem * size);
- return rval;
-}
-
-/* Allocate SIZE bytes in the saveable obstack
- and return a pointer to them. */
-
-char *
-savealloc (size)
- int size;
-{
- return (char *) obstack_alloc (saveable_obstack, size);
-}
-
-/* Print out which obstack an object is in. */
-
-void
-print_obstack_name (object, file, prefix)
- char *object;
- FILE *file;
- char *prefix;
-{
- struct obstack *obstack = NULL;
- char *obstack_name = NULL;
- struct function *p;
-
- for (p = outer_function_chain; p; p = p->next)
- {
- if (_obstack_allocated_p (p->function_obstack, object))
- {
- obstack = p->function_obstack;
- obstack_name = "containing function obstack";
- }
- if (_obstack_allocated_p (p->function_maybepermanent_obstack, object))
- {
- obstack = p->function_maybepermanent_obstack;
- obstack_name = "containing function maybepermanent obstack";
- }
- }
-
- if (_obstack_allocated_p (&obstack_stack_obstack, object))
- {
- obstack = &obstack_stack_obstack;
- obstack_name = "obstack_stack_obstack";
- }
- else if (_obstack_allocated_p (function_obstack, object))
- {
- obstack = function_obstack;
- obstack_name = "function obstack";
- }
- else if (_obstack_allocated_p (&permanent_obstack, object))
- {
- obstack = &permanent_obstack;
- obstack_name = "permanent_obstack";
- }
- else if (_obstack_allocated_p (&momentary_obstack, object))
- {
- obstack = &momentary_obstack;
- obstack_name = "momentary_obstack";
- }
- else if (_obstack_allocated_p (function_maybepermanent_obstack, object))
- {
- obstack = function_maybepermanent_obstack;
- obstack_name = "function maybepermanent obstack";
- }
- else if (_obstack_allocated_p (&temp_decl_obstack, object))
- {
- obstack = &temp_decl_obstack;
- obstack_name = "temp_decl_obstack";
- }
-
- /* Check to see if the object is in the free area of the obstack. */
- if (obstack != NULL)
- {
- if (object >= obstack->next_free
- && object < obstack->chunk_limit)
- fprintf (file, "%s in free portion of obstack %s",
- prefix, obstack_name);
- else
- fprintf (file, "%s allocated from %s", prefix, obstack_name);
- }
- else
- fprintf (file, "%s not allocated from any obstack", prefix);
-}
-
-void
-debug_obstack (object)
- char *object;
-{
- print_obstack_name (object, stderr, "object");
- fprintf (stderr, ".\n");
-}
-
-/* Return 1 if OBJ is in the permanent obstack.
- This is slow, and should be used only for debugging.
- Use TREE_PERMANENT for other purposes. */
-
-int
-object_permanent_p (obj)
- tree obj;
-{
- return _obstack_allocated_p (&permanent_obstack, obj);
-}
-
-/* Start a level of momentary allocation.
- In C, each compound statement has its own level
- and that level is freed at the end of each statement.
- All expression nodes are allocated in the momentary allocation level. */
-
-void
-push_momentary ()
-{
- struct momentary_level *tem
- = (struct momentary_level *) obstack_alloc (&momentary_obstack,
- sizeof (struct momentary_level));
- tem->prev = momentary_stack;
- tem->base = (char *) obstack_base (&momentary_obstack);
- tem->obstack = expression_obstack;
- momentary_stack = tem;
- expression_obstack = &momentary_obstack;
-}
-
-/* Set things up so the next clear_momentary will only clear memory
- past our present position in momentary_obstack. */
-
-void
-preserve_momentary ()
-{
- momentary_stack->base = (char *) obstack_base (&momentary_obstack);
-}
-
-/* Free all the storage in the current momentary-allocation level.
- In C, this happens at the end of each statement. */
-
-void
-clear_momentary ()
-{
- obstack_free (&momentary_obstack, momentary_stack->base);
-}
-
-/* Discard a level of momentary allocation.
- In C, this happens at the end of each compound statement.
- Restore the status of expression node allocation
- that was in effect before this level was created. */
-
-void
-pop_momentary ()
-{
- struct momentary_level *tem = momentary_stack;
- momentary_stack = tem->prev;
- expression_obstack = tem->obstack;
- /* We can't free TEM from the momentary_obstack, because there might
- be objects above it which have been saved. We can free back to the
- stack of the level we are popping off though. */
- obstack_free (&momentary_obstack, tem->base);
-}
-
-/* Pop back to the previous level of momentary allocation,
- but don't free any momentary data just yet. */
-
-void
-pop_momentary_nofree ()
-{
- struct momentary_level *tem = momentary_stack;
- momentary_stack = tem->prev;
- expression_obstack = tem->obstack;
-}
-
-/* Call when starting to parse a declaration:
- make expressions in the declaration last the length of the function.
- Returns an argument that should be passed to resume_momentary later. */
-
-int
-suspend_momentary ()
-{
- register int tem = expression_obstack == &momentary_obstack;
- expression_obstack = saveable_obstack;
- return tem;
-}
-
-/* Call when finished parsing a declaration:
- restore the treatment of node-allocation that was
- in effect before the suspension.
- YES should be the value previously returned by suspend_momentary. */
-
-void
-resume_momentary (yes)
- int yes;
-{
- if (yes)
- expression_obstack = &momentary_obstack;
-}
-
-/* Init the tables indexed by tree code.
- Note that languages can add to these tables to define their own codes. */
-
-void
-init_tree_codes ()
-{
- tree_code_type = (char **) xmalloc (sizeof (standard_tree_code_type));
- tree_code_length = (int *) xmalloc (sizeof (standard_tree_code_length));
- tree_code_name = (char **) xmalloc (sizeof (standard_tree_code_name));
- bcopy ((char *) standard_tree_code_type, (char *) tree_code_type,
- sizeof (standard_tree_code_type));
- bcopy ((char *) standard_tree_code_length, (char *) tree_code_length,
- sizeof (standard_tree_code_length));
- bcopy ((char *) standard_tree_code_name, (char *) tree_code_name,
- sizeof (standard_tree_code_name));
-}
-
-/* Return a newly allocated node of code CODE.
- Initialize the node's unique id and its TREE_PERMANENT flag.
- For decl and type nodes, some other fields are initialized.
- The rest of the node is initialized to zero.
-
- Achoo! I got a code in the node. */
-
-tree
-make_node (code)
- enum tree_code code;
-{
- register tree t;
- register int type = TREE_CODE_CLASS (code);
- register int length;
- register struct obstack *obstack = current_obstack;
- register int i;
- register tree_node_kind kind;
-
- switch (type)
- {
- case 'd': /* A decl node */
-#ifdef GATHER_STATISTICS
- kind = d_kind;
-#endif
- length = sizeof (struct tree_decl);
- /* All decls in an inline function need to be saved. */
- if (obstack != &permanent_obstack)
- obstack = saveable_obstack;
-
- /* PARM_DECLs go on the context of the parent. If this is a nested
- function, then we must allocate the PARM_DECL on the parent's
- obstack, so that they will live to the end of the parent's
- closing brace. This is necessary in case we try to inline the
- function into its parent.
-
- PARM_DECLs of top-level functions do not have this problem. However,
- we allocate them where we put the FUNCTION_DECL for languages such as
- Ada that need to consult some flags in the PARM_DECLs of the function
- when calling it.
-
- See comment in restore_tree_status for why we can't put this
- in function_obstack. */
- if (code == PARM_DECL && obstack != &permanent_obstack)
- {
- tree context = 0;
- if (current_function_decl)
- context = decl_function_context (current_function_decl);
-
- if (context)
- obstack
- = find_function_data (context)->function_maybepermanent_obstack;
- }
- break;
-
- case 't': /* a type node */
-#ifdef GATHER_STATISTICS
- kind = t_kind;
-#endif
- length = sizeof (struct tree_type);
- /* All data types are put where we can preserve them if nec. */
- if (obstack != &permanent_obstack)
- obstack = all_types_permanent ? &permanent_obstack : saveable_obstack;
- break;
-
- case 'b': /* a lexical block */
-#ifdef GATHER_STATISTICS
- kind = b_kind;
-#endif
- length = sizeof (struct tree_block);
- /* All BLOCK nodes are put where we can preserve them if nec. */
- if (obstack != &permanent_obstack)
- obstack = saveable_obstack;
- break;
-
- case 's': /* an expression with side effects */
-#ifdef GATHER_STATISTICS
- kind = s_kind;
- goto usual_kind;
-#endif
- case 'r': /* a reference */
-#ifdef GATHER_STATISTICS
- kind = r_kind;
- goto usual_kind;
-#endif
- case 'e': /* an expression */
- case '<': /* a comparison expression */
- case '1': /* a unary arithmetic expression */
- case '2': /* a binary arithmetic expression */
-#ifdef GATHER_STATISTICS
- kind = e_kind;
- usual_kind:
-#endif
- obstack = expression_obstack;
- /* All BIND_EXPR nodes are put where we can preserve them if nec. */
- if (code == BIND_EXPR && obstack != &permanent_obstack)
- obstack = saveable_obstack;
- length = sizeof (struct tree_exp)
- + (tree_code_length[(int) code] - 1) * sizeof (char *);
- break;
-
- case 'c': /* a constant */
-#ifdef GATHER_STATISTICS
- kind = c_kind;
-#endif
- obstack = expression_obstack;
-
- /* We can't use tree_code_length for INTEGER_CST, since the number of
- words is machine-dependent due to varying length of HOST_WIDE_INT,
- which might be wider than a pointer (e.g., long long). Similarly
- for REAL_CST, since the number of words is machine-dependent due
- to varying size and alignment of `double'. */
-
- if (code == INTEGER_CST)
- length = sizeof (struct tree_int_cst);
- else if (code == REAL_CST)
- length = sizeof (struct tree_real_cst);
- else
- length = sizeof (struct tree_common)
- + tree_code_length[(int) code] * sizeof (char *);
- break;
-
- case 'x': /* something random, like an identifier. */
-#ifdef GATHER_STATISTICS
- if (code == IDENTIFIER_NODE)
- kind = id_kind;
- else if (code == OP_IDENTIFIER)
- kind = op_id_kind;
- else if (code == TREE_VEC)
- kind = vec_kind;
- else
- kind = x_kind;
-#endif
- length = sizeof (struct tree_common)
- + tree_code_length[(int) code] * sizeof (char *);
- /* Identifier nodes are always permanent since they are
- unique in a compiler run. */
- if (code == IDENTIFIER_NODE) obstack = &permanent_obstack;
- break;
-
- default:
- abort ();
- }
-
- t = (tree) obstack_alloc (obstack, length);
-
-#ifdef GATHER_STATISTICS
- tree_node_counts[(int)kind]++;
- tree_node_sizes[(int)kind] += length;
-#endif
-
- /* Clear a word at a time. */
- for (i = (length / sizeof (int)) - 1; i >= 0; i--)
- ((int *) t)[i] = 0;
- /* Clear any extra bytes. */
- for (i = length / sizeof (int) * sizeof (int); i < length; i++)
- ((char *) t)[i] = 0;
-
- TREE_SET_CODE (t, code);
- if (obstack == &permanent_obstack)
- TREE_PERMANENT (t) = 1;
-
- switch (type)
- {
- case 's':
- TREE_SIDE_EFFECTS (t) = 1;
- TREE_TYPE (t) = void_type_node;
- break;
-
- case 'd':
- if (code != FUNCTION_DECL)
- DECL_ALIGN (t) = 1;
- DECL_IN_SYSTEM_HEADER (t)
- = in_system_header && (obstack == &permanent_obstack);
- DECL_SOURCE_LINE (t) = lineno;
- DECL_SOURCE_FILE (t) = (input_filename) ? input_filename : "<built-in>";
- DECL_UID (t) = next_decl_uid++;
- break;
-
- case 't':
- TYPE_UID (t) = next_type_uid++;
- TYPE_ALIGN (t) = 1;
- TYPE_MAIN_VARIANT (t) = t;
- TYPE_OBSTACK (t) = obstack;
- TYPE_ATTRIBUTES (t) = NULL_TREE;
-#ifdef SET_DEFAULT_TYPE_ATTRIBUTES
- SET_DEFAULT_TYPE_ATTRIBUTES (t);
-#endif
- break;
-
- case 'c':
- TREE_CONSTANT (t) = 1;
- break;
- }
-
- return t;
-}
-
-/* Return a new node with the same contents as NODE
- except that its TREE_CHAIN is zero and it has a fresh uid. */
-
-tree
-copy_node (node)
- tree node;
-{
- register tree t;
- register enum tree_code code = TREE_CODE (node);
- register int length;
- register int i;
-
- switch (TREE_CODE_CLASS (code))
- {
- case 'd': /* A decl node */
- length = sizeof (struct tree_decl);
- break;
-
- case 't': /* a type node */
- length = sizeof (struct tree_type);
- break;
-
- case 'b': /* a lexical block node */
- length = sizeof (struct tree_block);
- break;
-
- case 'r': /* a reference */
- case 'e': /* an expression */
- case 's': /* an expression with side effects */
- case '<': /* a comparison expression */
- case '1': /* a unary arithmetic expression */
- case '2': /* a binary arithmetic expression */
- length = sizeof (struct tree_exp)
- + (tree_code_length[(int) code] - 1) * sizeof (char *);
- break;
-
- case 'c': /* a constant */
- /* We can't use tree_code_length for INTEGER_CST, since the number of
- words is machine-dependent due to varying length of HOST_WIDE_INT,
- which might be wider than a pointer (e.g., long long). Similarly
- for REAL_CST, since the number of words is machine-dependent due
- to varying size and alignment of `double'. */
- if (code == INTEGER_CST)
- length = sizeof (struct tree_int_cst);
- else if (code == REAL_CST)
- length = sizeof (struct tree_real_cst);
- else
- length = (sizeof (struct tree_common)
- + tree_code_length[(int) code] * sizeof (char *));
- break;
-
- case 'x': /* something random, like an identifier. */
- length = sizeof (struct tree_common)
- + tree_code_length[(int) code] * sizeof (char *);
- if (code == TREE_VEC)
- length += (TREE_VEC_LENGTH (node) - 1) * sizeof (char *);
- }
-
- t = (tree) obstack_alloc (current_obstack, length);
-
- for (i = (length / sizeof (int)) - 1; i >= 0; i--)
- ((int *) t)[i] = ((int *) node)[i];
- /* Clear any extra bytes. */
- for (i = length / sizeof (int) * sizeof (int); i < length; i++)
- ((char *) t)[i] = ((char *) node)[i];
-
- TREE_CHAIN (t) = 0;
- TREE_ASM_WRITTEN (t) = 0;
-
- if (TREE_CODE_CLASS (code) == 'd')
- DECL_UID (t) = next_decl_uid++;
- else if (TREE_CODE_CLASS (code) == 't')
- {
- TYPE_UID (t) = next_type_uid++;
- TYPE_OBSTACK (t) = current_obstack;
-
- /* The following is so that the debug code for
- the copy is different from the original type.
- The two statements usually duplicate each other
- (because they clear fields of the same union),
- but the optimizer should catch that. */
- TYPE_SYMTAB_POINTER (t) = 0;
- TYPE_SYMTAB_ADDRESS (t) = 0;
- }
-
- TREE_PERMANENT (t) = (current_obstack == &permanent_obstack);
-
- return t;
-}
-
-/* Return a copy of a chain of nodes, chained through the TREE_CHAIN field.
- For example, this can copy a list made of TREE_LIST nodes. */
-
-tree
-copy_list (list)
- tree list;
-{
- tree head;
- register tree prev, next;
-
- if (list == 0)
- return 0;
-
- head = prev = copy_node (list);
- next = TREE_CHAIN (list);
- while (next)
- {
- TREE_CHAIN (prev) = copy_node (next);
- prev = TREE_CHAIN (prev);
- next = TREE_CHAIN (next);
- }
- return head;
-}
-
-#define HASHBITS 30
-
-/* Return an IDENTIFIER_NODE whose name is TEXT (a null-terminated string).
- If an identifier with that name has previously been referred to,
- the same node is returned this time. */
-
-tree
-get_identifier (text)
- register char *text;
-{
- register int hi;
- register int i;
- register tree idp;
- register int len, hash_len;
-
- /* Compute length of text in len. */
- for (len = 0; text[len]; len++);
-
- /* Decide how much of that length to hash on */
- hash_len = len;
- if (warn_id_clash && len > id_clash_len)
- hash_len = id_clash_len;
-
- /* Compute hash code */
- hi = hash_len * 613 + (unsigned) text[0];
- for (i = 1; i < hash_len; i += 2)
- hi = ((hi * 613) + (unsigned) (text[i]));
-
- hi &= (1 << HASHBITS) - 1;
- hi %= MAX_HASH_TABLE;
-
- /* Search table for identifier */
- for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp))
- if (IDENTIFIER_LENGTH (idp) == len
- && IDENTIFIER_POINTER (idp)[0] == text[0]
- && !bcmp (IDENTIFIER_POINTER (idp), text, len))
- return idp; /* <-- return if found */
-
- /* Not found; optionally warn about a similar identifier */
- if (warn_id_clash && do_identifier_warnings && len >= id_clash_len)
- for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp))
- if (!strncmp (IDENTIFIER_POINTER (idp), text, id_clash_len))
- {
- warning ("`%s' and `%s' identical in first %d characters",
- IDENTIFIER_POINTER (idp), text, id_clash_len);
- break;
- }
-
- if (tree_code_length[(int) IDENTIFIER_NODE] < 0)
- abort (); /* set_identifier_size hasn't been called. */
-
- /* Not found, create one, add to chain */
- idp = make_node (IDENTIFIER_NODE);
- IDENTIFIER_LENGTH (idp) = len;
-#ifdef GATHER_STATISTICS
- id_string_size += len;
-#endif
-
- IDENTIFIER_POINTER (idp) = obstack_copy0 (&permanent_obstack, text, len);
-
- TREE_CHAIN (idp) = hash_table[hi];
- hash_table[hi] = idp;
- return idp; /* <-- return if created */
-}
-
-/* If an identifier with the name TEXT (a null-terminated string) has
- previously been referred to, return that node; otherwise return
- NULL_TREE. */
-
-tree
-maybe_get_identifier (text)
- register char *text;
-{
- register int hi;
- register int i;
- register tree idp;
- register int len, hash_len;
-
- /* Compute length of text in len. */
- for (len = 0; text[len]; len++);
-
- /* Decide how much of that length to hash on */
- hash_len = len;
- if (warn_id_clash && len > id_clash_len)
- hash_len = id_clash_len;
-
- /* Compute hash code */
- hi = hash_len * 613 + (unsigned) text[0];
- for (i = 1; i < hash_len; i += 2)
- hi = ((hi * 613) + (unsigned) (text[i]));
-
- hi &= (1 << HASHBITS) - 1;
- hi %= MAX_HASH_TABLE;
-
- /* Search table for identifier */
- for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp))
- if (IDENTIFIER_LENGTH (idp) == len
- && IDENTIFIER_POINTER (idp)[0] == text[0]
- && !bcmp (IDENTIFIER_POINTER (idp), text, len))
- return idp; /* <-- return if found */
-
- return NULL_TREE;
-}
-
-/* Enable warnings on similar identifiers (if requested).
- Done after the built-in identifiers are created. */
-
-void
-start_identifier_warnings ()
-{
- do_identifier_warnings = 1;
-}
-
-/* Record the size of an identifier node for the language in use.
- SIZE is the total size in bytes.
- This is called by the language-specific files. This must be
- called before allocating any identifiers. */
-
-void
-set_identifier_size (size)
- int size;
-{
- tree_code_length[(int) IDENTIFIER_NODE]
- = (size - sizeof (struct tree_common)) / sizeof (tree);
-}
-
-/* Return a newly constructed INTEGER_CST node whose constant value
- is specified by the two ints LOW and HI.
- The TREE_TYPE is set to `int'.
-
- This function should be used via the `build_int_2' macro. */
-
-tree
-build_int_2_wide (low, hi)
- HOST_WIDE_INT low, hi;
-{
- register tree t = make_node (INTEGER_CST);
- TREE_INT_CST_LOW (t) = low;
- TREE_INT_CST_HIGH (t) = hi;
- TREE_TYPE (t) = integer_type_node;
- return t;
-}
-
-/* Return a new REAL_CST node whose type is TYPE and value is D. */
-
-tree
-build_real (type, d)
- tree type;
- REAL_VALUE_TYPE d;
-{
- tree v;
- int overflow = 0;
-
- /* Check for valid float value for this type on this target machine;
- if not, can print error message and store a valid value in D. */
-#ifdef CHECK_FLOAT_VALUE
- CHECK_FLOAT_VALUE (TYPE_MODE (type), d, overflow);
-#endif
-
- v = make_node (REAL_CST);
- TREE_TYPE (v) = type;
- TREE_REAL_CST (v) = d;
- TREE_OVERFLOW (v) = TREE_CONSTANT_OVERFLOW (v) = overflow;
- return v;
-}
-
-/* Return a new REAL_CST node whose type is TYPE
- and whose value is the integer value of the INTEGER_CST node I. */
-
-#if !defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC)
-
-REAL_VALUE_TYPE
-real_value_from_int_cst (type, i)
- tree type, i;
-{
- REAL_VALUE_TYPE d;
- REAL_VALUE_TYPE e;
- /* Some 386 compilers mishandle unsigned int to float conversions,
- so introduce a temporary variable E to avoid those bugs. */
-
-#ifdef REAL_ARITHMETIC
- if (! TREE_UNSIGNED (TREE_TYPE (i)))
- REAL_VALUE_FROM_INT (d, TREE_INT_CST_LOW (i), TREE_INT_CST_HIGH (i),
- TYPE_MODE (type));
- else
- REAL_VALUE_FROM_UNSIGNED_INT (d, TREE_INT_CST_LOW (i),
- TREE_INT_CST_HIGH (i), TYPE_MODE (type));
-#else /* not REAL_ARITHMETIC */
- if (TREE_INT_CST_HIGH (i) < 0 && ! TREE_UNSIGNED (TREE_TYPE (i)))
- {
- d = (double) (~ TREE_INT_CST_HIGH (i));
- e = ((double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2))
- * (double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2)));
- d *= e;
- e = (double) (unsigned HOST_WIDE_INT) (~ TREE_INT_CST_LOW (i));
- d += e;
- d = (- d - 1.0);
- }
- else
- {
- d = (double) (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (i);
- e = ((double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2))
- * (double) ((HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2)));
- d *= e;
- e = (double) (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (i);
- d += e;
- }
-#endif /* not REAL_ARITHMETIC */
- return d;
-}
-
-/* This function can't be implemented if we can't do arithmetic
- on the float representation. */
-
-tree
-build_real_from_int_cst (type, i)
- tree type;
- tree i;
-{
- tree v;
- int overflow = TREE_OVERFLOW (i);
- REAL_VALUE_TYPE d;
- jmp_buf float_error;
-
- v = make_node (REAL_CST);
- TREE_TYPE (v) = type;
-
- if (setjmp (float_error))
- {
- d = dconst0;
- overflow = 1;
- goto got_it;
- }
-
- set_float_handler (float_error);
-
-#ifdef REAL_ARITHMETIC
- d = real_value_from_int_cst (type, i);
-#else
- d = REAL_VALUE_TRUNCATE (TYPE_MODE (type),
- real_value_from_int_cst (type, i));
-#endif
-
- /* Check for valid float value for this type on this target machine. */
-
- got_it:
- set_float_handler (NULL_PTR);
-
-#ifdef CHECK_FLOAT_VALUE
- CHECK_FLOAT_VALUE (TYPE_MODE (type), d, overflow);
-#endif
-
- TREE_REAL_CST (v) = d;
- TREE_OVERFLOW (v) = TREE_CONSTANT_OVERFLOW (v) = overflow;
- return v;
-}
-
-#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
-
-/* Return a newly constructed STRING_CST node whose value is
- the LEN characters at STR.
- The TREE_TYPE is not initialized. */
-
-tree
-build_string (len, str)
- int len;
- char *str;
-{
- /* Put the string in saveable_obstack since it will be placed in the RTL
- for an "asm" statement and will also be kept around a while if
- deferring constant output in varasm.c. */
-
- register tree s = make_node (STRING_CST);
- TREE_STRING_LENGTH (s) = len;
- TREE_STRING_POINTER (s) = obstack_copy0 (saveable_obstack, str, len);
- return s;
-}
-
-/* Return a newly constructed COMPLEX_CST node whose value is
- specified by the real and imaginary parts REAL and IMAG.
- Both REAL and IMAG should be constant nodes. TYPE, if specified,
- will be the type of the COMPLEX_CST; otherwise a new type will be made. */
-
-tree
-build_complex (type, real, imag)
- tree type;
- tree real, imag;
-{
- register tree t = make_node (COMPLEX_CST);
-
- TREE_REALPART (t) = real;
- TREE_IMAGPART (t) = imag;
- TREE_TYPE (t) = type ? type : build_complex_type (TREE_TYPE (real));
- TREE_OVERFLOW (t) = TREE_OVERFLOW (real) | TREE_OVERFLOW (imag);
- TREE_CONSTANT_OVERFLOW (t)
- = TREE_CONSTANT_OVERFLOW (real) | TREE_CONSTANT_OVERFLOW (imag);
- return t;
-}
-
-/* Build a newly constructed TREE_VEC node of length LEN. */
-
-tree
-make_tree_vec (len)
- int len;
-{
- register tree t;
- register int length = (len-1) * sizeof (tree) + sizeof (struct tree_vec);
- register struct obstack *obstack = current_obstack;
- register int i;
-
-#ifdef GATHER_STATISTICS
- tree_node_counts[(int)vec_kind]++;
- tree_node_sizes[(int)vec_kind] += length;
-#endif
-
- t = (tree) obstack_alloc (obstack, length);
-
- for (i = (length / sizeof (int)) - 1; i >= 0; i--)
- ((int *) t)[i] = 0;
-
- TREE_SET_CODE (t, TREE_VEC);
- TREE_VEC_LENGTH (t) = len;
- if (obstack == &permanent_obstack)
- TREE_PERMANENT (t) = 1;
-
- return t;
-}
-
-/* Return 1 if EXPR is the integer constant zero or a complex constant
- of zero. */
-
-int
-integer_zerop (expr)
- tree expr;
-{
- STRIP_NOPS (expr);
-
- return ((TREE_CODE (expr) == INTEGER_CST
- && ! TREE_CONSTANT_OVERFLOW (expr)
- && TREE_INT_CST_LOW (expr) == 0
- && TREE_INT_CST_HIGH (expr) == 0)
- || (TREE_CODE (expr) == COMPLEX_CST
- && integer_zerop (TREE_REALPART (expr))
- && integer_zerop (TREE_IMAGPART (expr))));
-}
-
-/* Return 1 if EXPR is the integer constant one or the corresponding
- complex constant. */
-
-int
-integer_onep (expr)
- tree expr;
-{
- STRIP_NOPS (expr);
-
- return ((TREE_CODE (expr) == INTEGER_CST
- && ! TREE_CONSTANT_OVERFLOW (expr)
- && TREE_INT_CST_LOW (expr) == 1
- && TREE_INT_CST_HIGH (expr) == 0)
- || (TREE_CODE (expr) == COMPLEX_CST
- && integer_onep (TREE_REALPART (expr))
- && integer_zerop (TREE_IMAGPART (expr))));
-}
-
-/* Return 1 if EXPR is an integer containing all 1's in as much precision as
- it contains. Likewise for the corresponding complex constant. */
-
-int
-integer_all_onesp (expr)
- tree expr;
-{
- register int prec;
- register int uns;
-
- STRIP_NOPS (expr);
-
- if (TREE_CODE (expr) == COMPLEX_CST
- && integer_all_onesp (TREE_REALPART (expr))
- && integer_zerop (TREE_IMAGPART (expr)))
- return 1;
-
- else if (TREE_CODE (expr) != INTEGER_CST
- || TREE_CONSTANT_OVERFLOW (expr))
- return 0;
-
- uns = TREE_UNSIGNED (TREE_TYPE (expr));
- if (!uns)
- return TREE_INT_CST_LOW (expr) == -1 && TREE_INT_CST_HIGH (expr) == -1;
-
- /* Note that using TYPE_PRECISION here is wrong. We care about the
- actual bits, not the (arbitrary) range of the type. */
- prec = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (expr)));
- if (prec >= HOST_BITS_PER_WIDE_INT)
- {
- int high_value, shift_amount;
-
- shift_amount = prec - HOST_BITS_PER_WIDE_INT;
-
- if (shift_amount > HOST_BITS_PER_WIDE_INT)
- /* Can not handle precisions greater than twice the host int size. */
- abort ();
- else if (shift_amount == HOST_BITS_PER_WIDE_INT)
- /* Shifting by the host word size is undefined according to the ANSI
- standard, so we must handle this as a special case. */
- high_value = -1;
- else
- high_value = ((HOST_WIDE_INT) 1 << shift_amount) - 1;
-
- return TREE_INT_CST_LOW (expr) == -1
- && TREE_INT_CST_HIGH (expr) == high_value;
- }
- else
- return TREE_INT_CST_LOW (expr) == ((HOST_WIDE_INT) 1 << prec) - 1;
-}
-
-/* Return 1 if EXPR is an integer constant that is a power of 2 (i.e., has only
- one bit on). */
-
-int
-integer_pow2p (expr)
- tree expr;
-{
- int prec;
- HOST_WIDE_INT high, low;
-
- STRIP_NOPS (expr);
-
- if (TREE_CODE (expr) == COMPLEX_CST
- && integer_pow2p (TREE_REALPART (expr))
- && integer_zerop (TREE_IMAGPART (expr)))
- return 1;
-
- if (TREE_CODE (expr) != INTEGER_CST || TREE_CONSTANT_OVERFLOW (expr))
- return 0;
-
- prec = (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE
- ? POINTER_SIZE : TYPE_PRECISION (TREE_TYPE (expr)));
- high = TREE_INT_CST_HIGH (expr);
- low = TREE_INT_CST_LOW (expr);
-
- /* First clear all bits that are beyond the type's precision in case
- we've been sign extended. */
-
- if (prec == 2 * HOST_BITS_PER_WIDE_INT)
- ;
- else if (prec > HOST_BITS_PER_WIDE_INT)
- high &= ~((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
- else
- {
- high = 0;
- if (prec < HOST_BITS_PER_WIDE_INT)
- low &= ~((HOST_WIDE_INT) (-1) << prec);
- }
-
- if (high == 0 && low == 0)
- return 0;
-
- return ((high == 0 && (low & (low - 1)) == 0)
- || (low == 0 && (high & (high - 1)) == 0));
-}
-
-/* Return the power of two represented by a tree node known to be a
- power of two. */
-
-int
-tree_log2 (expr)
- tree expr;
-{
- int prec;
- HOST_WIDE_INT high, low;
-
- STRIP_NOPS (expr);
-
- if (TREE_CODE (expr) == COMPLEX_CST)
- return tree_log2 (TREE_REALPART (expr));
-
- prec = (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE
- ? POINTER_SIZE : TYPE_PRECISION (TREE_TYPE (expr)));
-
- high = TREE_INT_CST_HIGH (expr);
- low = TREE_INT_CST_LOW (expr);
-
- /* First clear all bits that are beyond the type's precision in case
- we've been sign extended. */
-
- if (prec == 2 * HOST_BITS_PER_WIDE_INT)
- ;
- else if (prec > HOST_BITS_PER_WIDE_INT)
- high &= ~((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
- else
- {
- high = 0;
- if (prec < HOST_BITS_PER_WIDE_INT)
- low &= ~((HOST_WIDE_INT) (-1) << prec);
- }
-
- return (high != 0 ? HOST_BITS_PER_WIDE_INT + exact_log2 (high)
- : exact_log2 (low));
-}
-
-/* Return 1 if EXPR is the real constant zero. */
-
-int
-real_zerop (expr)
- tree expr;
-{
- STRIP_NOPS (expr);
-
- return ((TREE_CODE (expr) == REAL_CST
- && ! TREE_CONSTANT_OVERFLOW (expr)
- && REAL_VALUES_EQUAL (TREE_REAL_CST (expr), dconst0))
- || (TREE_CODE (expr) == COMPLEX_CST
- && real_zerop (TREE_REALPART (expr))
- && real_zerop (TREE_IMAGPART (expr))));
-}
-
-/* Return 1 if EXPR is the real constant one in real or complex form. */
-
-int
-real_onep (expr)
- tree expr;
-{
- STRIP_NOPS (expr);
-
- return ((TREE_CODE (expr) == REAL_CST
- && ! TREE_CONSTANT_OVERFLOW (expr)
- && REAL_VALUES_EQUAL (TREE_REAL_CST (expr), dconst1))
- || (TREE_CODE (expr) == COMPLEX_CST
- && real_onep (TREE_REALPART (expr))
- && real_zerop (TREE_IMAGPART (expr))));
-}
-
-/* Return 1 if EXPR is the real constant two. */
-
-int
-real_twop (expr)
- tree expr;
-{
- STRIP_NOPS (expr);
-
- return ((TREE_CODE (expr) == REAL_CST
- && ! TREE_CONSTANT_OVERFLOW (expr)
- && REAL_VALUES_EQUAL (TREE_REAL_CST (expr), dconst2))
- || (TREE_CODE (expr) == COMPLEX_CST
- && real_twop (TREE_REALPART (expr))
- && real_zerop (TREE_IMAGPART (expr))));
-}
-
-/* Nonzero if EXP is a constant or a cast of a constant. */
-
-int
-really_constant_p (exp)
- tree exp;
-{
- /* This is not quite the same as STRIP_NOPS. It does more. */
- while (TREE_CODE (exp) == NOP_EXPR
- || TREE_CODE (exp) == CONVERT_EXPR
- || TREE_CODE (exp) == NON_LVALUE_EXPR)
- exp = TREE_OPERAND (exp, 0);
- return TREE_CONSTANT (exp);
-}
-
-/* Return first list element whose TREE_VALUE is ELEM.
- Return 0 if ELEM is not in LIST. */
-
-tree
-value_member (elem, list)
- tree elem, list;
-{
- while (list)
- {
- if (elem == TREE_VALUE (list))
- return list;
- list = TREE_CHAIN (list);
- }
- return NULL_TREE;
-}
-
-/* Return first list element whose TREE_PURPOSE is ELEM.
- Return 0 if ELEM is not in LIST. */
-
-tree
-purpose_member (elem, list)
- tree elem, list;
-{
- while (list)
- {
- if (elem == TREE_PURPOSE (list))
- return list;
- list = TREE_CHAIN (list);
- }
- return NULL_TREE;
-}
-
-/* Return first list element whose BINFO_TYPE is ELEM.
- Return 0 if ELEM is not in LIST. */
-
-tree
-binfo_member (elem, list)
- tree elem, list;
-{
- while (list)
- {
- if (elem == BINFO_TYPE (list))
- return list;
- list = TREE_CHAIN (list);
- }
- return NULL_TREE;
-}
-
-/* Return nonzero if ELEM is part of the chain CHAIN. */
-
-int
-chain_member (elem, chain)
- tree elem, chain;
-{
- while (chain)
- {
- if (elem == chain)
- return 1;
- chain = TREE_CHAIN (chain);
- }
-
- return 0;
-}
-
-/* Return nonzero if ELEM is equal to TREE_VALUE (CHAIN) for any piece of
- chain CHAIN. */
-/* ??? This function was added for machine specific attributes but is no
- longer used. It could be deleted if we could confirm all front ends
- don't use it. */
-
-int
-chain_member_value (elem, chain)
- tree elem, chain;
-{
- while (chain)
- {
- if (elem == TREE_VALUE (chain))
- return 1;
- chain = TREE_CHAIN (chain);
- }
-
- return 0;
-}
-
-/* Return nonzero if ELEM is equal to TREE_PURPOSE (CHAIN)
- for any piece of chain CHAIN. */
-/* ??? This function was added for machine specific attributes but is no
- longer used. It could be deleted if we could confirm all front ends
- don't use it. */
-
-int
-chain_member_purpose (elem, chain)
- tree elem, chain;
-{
- while (chain)
- {
- if (elem == TREE_PURPOSE (chain))
- return 1;
- chain = TREE_CHAIN (chain);
- }
-
- return 0;
-}
-
-/* Return the length of a chain of nodes chained through TREE_CHAIN.
- We expect a null pointer to mark the end of the chain.
- This is the Lisp primitive `length'. */
-
-int
-list_length (t)
- tree t;
-{
- register tree tail;
- register int len = 0;
-
- for (tail = t; tail; tail = TREE_CHAIN (tail))
- len++;
-
- return len;
-}
-
-/* Concatenate two chains of nodes (chained through TREE_CHAIN)
- by modifying the last node in chain 1 to point to chain 2.
- This is the Lisp primitive `nconc'. */
-
-tree
-chainon (op1, op2)
- tree op1, op2;
-{
-
- if (op1)
- {
- register tree t1;
- register tree t2;
-
- for (t1 = op1; TREE_CHAIN (t1); t1 = TREE_CHAIN (t1))
- ;
- TREE_CHAIN (t1) = op2;
- for (t2 = op2; t2; t2 = TREE_CHAIN (t2))
- if (t2 == t1)
- abort (); /* Circularity created. */
- return op1;
- }
- else return op2;
-}
-
-/* Return the last node in a chain of nodes (chained through TREE_CHAIN). */
-
-tree
-tree_last (chain)
- register tree chain;
-{
- register tree next;
- if (chain)
- while (next = TREE_CHAIN (chain))
- chain = next;
- return chain;
-}
-
-/* Reverse the order of elements in the chain T,
- and return the new head of the chain (old last element). */
-
-tree
-nreverse (t)
- tree t;
-{
- register tree prev = 0, decl, next;
- for (decl = t; decl; decl = next)
- {
- next = TREE_CHAIN (decl);
- TREE_CHAIN (decl) = prev;
- prev = decl;
- }
- return prev;
-}
-
-/* Given a chain CHAIN of tree nodes,
- construct and return a list of those nodes. */
-
-tree
-listify (chain)
- tree chain;
-{
- tree result = NULL_TREE;
- tree in_tail = chain;
- tree out_tail = NULL_TREE;
-
- while (in_tail)
- {
- tree next = tree_cons (NULL_TREE, in_tail, NULL_TREE);
- if (out_tail)
- TREE_CHAIN (out_tail) = next;
- else
- result = next;
- out_tail = next;
- in_tail = TREE_CHAIN (in_tail);
- }
-
- return result;
-}
-
-/* Return a newly created TREE_LIST node whose
- purpose and value fields are PARM and VALUE. */
-
-tree
-build_tree_list (parm, value)
- tree parm, value;
-{
- register tree t = make_node (TREE_LIST);
- TREE_PURPOSE (t) = parm;
- TREE_VALUE (t) = value;
- return t;
-}
-
-/* Similar, but build on the temp_decl_obstack. */
-
-tree
-build_decl_list (parm, value)
- tree parm, value;
-{
- register tree node;
- register struct obstack *ambient_obstack = current_obstack;
- current_obstack = &temp_decl_obstack;
- node = build_tree_list (parm, value);
- current_obstack = ambient_obstack;
- return node;
-}
-
-/* Return a newly created TREE_LIST node whose
- purpose and value fields are PARM and VALUE
- and whose TREE_CHAIN is CHAIN. */
-
-tree
-tree_cons (purpose, value, chain)
- tree purpose, value, chain;
-{
-#if 0
- register tree node = make_node (TREE_LIST);
-#else
- register int i;
- register tree node = (tree) obstack_alloc (current_obstack, sizeof (struct tree_list));
-#ifdef GATHER_STATISTICS
- tree_node_counts[(int)x_kind]++;
- tree_node_sizes[(int)x_kind] += sizeof (struct tree_list);
-#endif
-
- for (i = (sizeof (struct tree_common) / sizeof (int)) - 1; i >= 0; i--)
- ((int *) node)[i] = 0;
-
- TREE_SET_CODE (node, TREE_LIST);
- if (current_obstack == &permanent_obstack)
- TREE_PERMANENT (node) = 1;
-#endif
-
- TREE_CHAIN (node) = chain;
- TREE_PURPOSE (node) = purpose;
- TREE_VALUE (node) = value;
- return node;
-}
-
-/* Similar, but build on the temp_decl_obstack. */
-
-tree
-decl_tree_cons (purpose, value, chain)
- tree purpose, value, chain;
-{
- register tree node;
- register struct obstack *ambient_obstack = current_obstack;
- current_obstack = &temp_decl_obstack;
- node = tree_cons (purpose, value, chain);
- current_obstack = ambient_obstack;
- return node;
-}
-
-/* Same as `tree_cons' but make a permanent object. */
-
-tree
-perm_tree_cons (purpose, value, chain)
- tree purpose, value, chain;
-{
- register tree node;
- register struct obstack *ambient_obstack = current_obstack;
- current_obstack = &permanent_obstack;
-
- node = tree_cons (purpose, value, chain);
- current_obstack = ambient_obstack;
- return node;
-}
-
-/* Same as `tree_cons', but make this node temporary, regardless. */
-
-tree
-temp_tree_cons (purpose, value, chain)
- tree purpose, value, chain;
-{
- register tree node;
- register struct obstack *ambient_obstack = current_obstack;
- current_obstack = &temporary_obstack;
-
- node = tree_cons (purpose, value, chain);
- current_obstack = ambient_obstack;
- return node;
-}
-
-/* Same as `tree_cons', but save this node if the function's RTL is saved. */
-
-tree
-saveable_tree_cons (purpose, value, chain)
- tree purpose, value, chain;
-{
- register tree node;
- register struct obstack *ambient_obstack = current_obstack;
- current_obstack = saveable_obstack;
-
- node = tree_cons (purpose, value, chain);
- current_obstack = ambient_obstack;
- return node;
-}
-
-/* Return the size nominally occupied by an object of type TYPE
- when it resides in memory. The value is measured in units of bytes,
- and its data type is that normally used for type sizes
- (which is the first type created by make_signed_type or
- make_unsigned_type). */
-
-tree
-size_in_bytes (type)
- tree type;
-{
- tree t;
-
- if (type == error_mark_node)
- return integer_zero_node;
- type = TYPE_MAIN_VARIANT (type);
- if (TYPE_SIZE (type) == 0)
- {
- incomplete_type_error (NULL_TREE, type);
- return integer_zero_node;
- }
- t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
- size_int (BITS_PER_UNIT));
- if (TREE_CODE (t) == INTEGER_CST)
- force_fit_type (t, 0);
- return t;
-}
-
-/* Return the size of TYPE (in bytes) as an integer,
- or return -1 if the size can vary. */
-
-int
-int_size_in_bytes (type)
- tree type;
-{
- unsigned int size;
- if (type == error_mark_node)
- return 0;
- type = TYPE_MAIN_VARIANT (type);
- if (TYPE_SIZE (type) == 0)
- return -1;
- if (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- return -1;
- if (TREE_INT_CST_HIGH (TYPE_SIZE (type)) != 0)
- {
- tree t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
- size_int (BITS_PER_UNIT));
- return TREE_INT_CST_LOW (t);
- }
- size = TREE_INT_CST_LOW (TYPE_SIZE (type));
- return (size + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
-}
-
-/* Return, as a tree node, the number of elements for TYPE (which is an
- ARRAY_TYPE) minus one. This counts only elements of the top array. */
-
-tree
-array_type_nelts (type)
- tree type;
-{
- tree index_type = TYPE_DOMAIN (type);
-
- return (integer_zerop (TYPE_MIN_VALUE (index_type))
- ? TYPE_MAX_VALUE (index_type)
- : fold (build (MINUS_EXPR, TREE_TYPE (TYPE_MAX_VALUE (index_type)),
- TYPE_MAX_VALUE (index_type),
- TYPE_MIN_VALUE (index_type))));
-}
-
-/* Return nonzero if arg is static -- a reference to an object in
- static storage. This is not the same as the C meaning of `static'. */
-
-int
-staticp (arg)
- tree arg;
-{
- switch (TREE_CODE (arg))
- {
- case FUNCTION_DECL:
- /* Nested functions aren't static, since taking their address
- involves a trampoline. */
- return decl_function_context (arg) == 0 || DECL_NO_STATIC_CHAIN (arg);
- case VAR_DECL:
- return TREE_STATIC (arg) || DECL_EXTERNAL (arg);
-
- case CONSTRUCTOR:
- return TREE_STATIC (arg);
-
- case STRING_CST:
- return 1;
-
- /* If we are referencing a bitfield, we can't evaluate an
- ADDR_EXPR at compile time and so it isn't a constant. */
- case COMPONENT_REF:
- return (! DECL_BIT_FIELD (TREE_OPERAND (arg, 1))
- && staticp (TREE_OPERAND (arg, 0)));
-
- case BIT_FIELD_REF:
- return 0;
-
-#if 0
- /* This case is technically correct, but results in setting
- TREE_CONSTANT on ADDR_EXPRs that cannot be evaluated at
- compile time. */
- case INDIRECT_REF:
- return TREE_CONSTANT (TREE_OPERAND (arg, 0));
-#endif
-
- case ARRAY_REF:
- if (TREE_CODE (TYPE_SIZE (TREE_TYPE (arg))) == INTEGER_CST
- && TREE_CODE (TREE_OPERAND (arg, 1)) == INTEGER_CST)
- return staticp (TREE_OPERAND (arg, 0));
- }
-
- return 0;
-}
-
-/* Wrap a SAVE_EXPR around EXPR, if appropriate.
- Do this to any expression which may be used in more than one place,
- but must be evaluated only once.
-
- Normally, expand_expr would reevaluate the expression each time.
- Calling save_expr produces something that is evaluated and recorded
- the first time expand_expr is called on it. Subsequent calls to
- expand_expr just reuse the recorded value.
-
- The call to expand_expr that generates code that actually computes
- the value is the first call *at compile time*. Subsequent calls
- *at compile time* generate code to use the saved value.
- This produces correct result provided that *at run time* control
- always flows through the insns made by the first expand_expr
- before reaching the other places where the save_expr was evaluated.
- You, the caller of save_expr, must make sure this is so.
-
- Constants, and certain read-only nodes, are returned with no
- SAVE_EXPR because that is safe. Expressions containing placeholders
- are not touched; see tree.def for an explanation of what these
- are used for. */
-
-tree
-save_expr (expr)
- tree expr;
-{
- register tree t = fold (expr);
-
- /* We don't care about whether this can be used as an lvalue in this
- context. */
- while (TREE_CODE (t) == NON_LVALUE_EXPR)
- t = TREE_OPERAND (t, 0);
-
- /* If the tree evaluates to a constant, then we don't want to hide that
- fact (i.e. this allows further folding, and direct checks for constants).
- However, a read-only object that has side effects cannot be bypassed.
- Since it is no problem to reevaluate literals, we just return the
- literal node. */
-
- if (TREE_CONSTANT (t) || (TREE_READONLY (t) && ! TREE_SIDE_EFFECTS (t))
- || TREE_CODE (t) == SAVE_EXPR || TREE_CODE (t) == ERROR_MARK)
- return t;
-
- /* If T contains a PLACEHOLDER_EXPR, we must evaluate it each time, since
- it means that the size or offset of some field of an object depends on
- the value within another field.
-
- Note that it must not be the case that T contains both a PLACEHOLDER_EXPR
- and some variable since it would then need to be both evaluated once and
- evaluated more than once. Front-ends must assure this case cannot
- happen by surrounding any such subexpressions in their own SAVE_EXPR
- and forcing evaluation at the proper time. */
- if (contains_placeholder_p (t))
- return t;
-
- t = build (SAVE_EXPR, TREE_TYPE (expr), t, current_function_decl, NULL_TREE);
-
- /* This expression might be placed ahead of a jump to ensure that the
- value was computed on both sides of the jump. So make sure it isn't
- eliminated as dead. */
- TREE_SIDE_EFFECTS (t) = 1;
- return t;
-}
-
-/* Arrange for an expression to be expanded multiple independent
- times. This is useful for cleanup actions, as the backend can
- expand them multiple times in different places. */
-
-tree
-unsave_expr (expr)
- tree expr;
-{
- tree t;
-
- /* If this is already protected, no sense in protecting it again. */
- if (TREE_CODE (expr) == UNSAVE_EXPR)
- return expr;
-
- t = build1 (UNSAVE_EXPR, TREE_TYPE (expr), expr);
- TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (expr);
- return t;
-}
-
-/* Modify a tree in place so that all the evaluate only once things
- are cleared out. Return the EXPR given. */
-
-tree
-unsave_expr_now (expr)
- tree expr;
-{
- enum tree_code code;
- register int i;
-
- if (expr == NULL_TREE)
- return expr;
-
- code = TREE_CODE (expr);
- switch (code)
- {
- case SAVE_EXPR:
- SAVE_EXPR_RTL (expr) = 0;
- break;
-
- case TARGET_EXPR:
- TREE_OPERAND (expr, 1) = TREE_OPERAND (expr, 3);
- TREE_OPERAND (expr, 3) = NULL_TREE;
- break;
-
- case RTL_EXPR:
- /* I don't yet know how to emit a sequence multiple times. */
- if (RTL_EXPR_SEQUENCE (expr) != 0)
- abort ();
- break;
-
- case CALL_EXPR:
- CALL_EXPR_RTL (expr) = 0;
- if (TREE_OPERAND (expr, 1)
- && TREE_CODE (TREE_OPERAND (expr, 1)) == TREE_LIST)
- {
- tree exp = TREE_OPERAND (expr, 1);
- while (exp)
- {
- unsave_expr_now (TREE_VALUE (exp));
- exp = TREE_CHAIN (exp);
- }
- }
- break;
- }
-
- switch (TREE_CODE_CLASS (code))
- {
- case 'c': /* a constant */
- case 't': /* a type node */
- case 'x': /* something random, like an identifier or an ERROR_MARK. */
- case 'd': /* A decl node */
- case 'b': /* A block node */
- return expr;
-
- case 'e': /* an expression */
- case 'r': /* a reference */
- case 's': /* an expression with side effects */
- case '<': /* a comparison expression */
- case '2': /* a binary arithmetic expression */
- case '1': /* a unary arithmetic expression */
- for (i = tree_code_length[(int) code] - 1; i >= 0; i--)
- unsave_expr_now (TREE_OPERAND (expr, i));
- return expr;
-
- default:
- abort ();
- }
-}
-
-/* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size
- or offset that depends on a field within a record.
-
- Note that we only allow such expressions within simple arithmetic
- or a COND_EXPR. */
-
-int
-contains_placeholder_p (exp)
- tree exp;
-{
- register enum tree_code code = TREE_CODE (exp);
- tree inner;
-
- /* If we have a WITH_RECORD_EXPR, it "cancels" any PLACEHOLDER_EXPR
- in it since it is supplying a value for it. */
- if (code == WITH_RECORD_EXPR)
- return 0;
- else if (code == PLACEHOLDER_EXPR)
- return 1;
-
- switch (TREE_CODE_CLASS (code))
- {
- case 'r':
- for (inner = TREE_OPERAND (exp, 0);
- TREE_CODE_CLASS (TREE_CODE (inner)) == 'r';
- inner = TREE_OPERAND (inner, 0))
- ;
- return TREE_CODE (inner) == PLACEHOLDER_EXPR;
-
- case '1':
- case '2': case '<':
- case 'e':
- switch (tree_code_length[(int) code])
- {
- case 1:
- return contains_placeholder_p (TREE_OPERAND (exp, 0));
- case 2:
- return (code != RTL_EXPR
- && code != CONSTRUCTOR
- && ! (code == SAVE_EXPR && SAVE_EXPR_RTL (exp) != 0)
- && code != WITH_RECORD_EXPR
- && (contains_placeholder_p (TREE_OPERAND (exp, 0))
- || contains_placeholder_p (TREE_OPERAND (exp, 1))));
- case 3:
- return (code == COND_EXPR
- && (contains_placeholder_p (TREE_OPERAND (exp, 0))
- || contains_placeholder_p (TREE_OPERAND (exp, 1))
- || contains_placeholder_p (TREE_OPERAND (exp, 2))));
- }
- }
-
- return 0;
-}
-
-/* Given a tree EXP, a FIELD_DECL F, and a replacement value R,
- return a tree with all occurrences of references to F in a
- PLACEHOLDER_EXPR replaced by R. Note that we assume here that EXP
- contains only arithmetic expressions. */
-
-tree
-substitute_in_expr (exp, f, r)
- tree exp;
- tree f;
- tree r;
-{
- enum tree_code code = TREE_CODE (exp);
- tree op0, op1, op2;
- tree new = 0;
- tree inner;
-
- switch (TREE_CODE_CLASS (code))
- {
- case 'c':
- case 'd':
- return exp;
-
- case 'x':
- if (code == PLACEHOLDER_EXPR)
- return exp;
- break;
-
- case '1':
- case '2':
- case '<':
- case 'e':
- switch (tree_code_length[(int) code])
- {
- case 1:
- op0 = substitute_in_expr (TREE_OPERAND (exp, 0), f, r);
- if (op0 == TREE_OPERAND (exp, 0))
- return exp;
-
- new = fold (build1 (code, TREE_TYPE (exp), op0));
- break;
-
- case 2:
- /* An RTL_EXPR cannot contain a PLACEHOLDER_EXPR; a CONSTRUCTOR
- could, but we don't support it. */
- if (code == RTL_EXPR)
- return exp;
- else if (code == CONSTRUCTOR)
- abort ();
-
- op0 = substitute_in_expr (TREE_OPERAND (exp, 0), f, r);
- op1 = substitute_in_expr (TREE_OPERAND (exp, 1), f, r);
- if (op0 == TREE_OPERAND (exp, 0) && op1 == TREE_OPERAND (exp, 1))
- return exp;
-
- new = fold (build (code, TREE_TYPE (exp), op0, op1));
- break;
-
- case 3:
- /* It cannot be that anything inside a SAVE_EXPR contains a
- PLACEHOLDER_EXPR. */
- if (code == SAVE_EXPR)
- return exp;
-
- if (code != COND_EXPR)
- abort ();
-
- op0 = substitute_in_expr (TREE_OPERAND (exp, 0), f, r);
- op1 = substitute_in_expr (TREE_OPERAND (exp, 1), f, r);
- op2 = substitute_in_expr (TREE_OPERAND (exp, 2), f, r);
- if (op0 == TREE_OPERAND (exp, 0) && op1 == TREE_OPERAND (exp, 1)
- && op2 == TREE_OPERAND (exp, 2))
- return exp;
-
- new = fold (build (code, TREE_TYPE (exp), op0, op1, op2));
- }
-
- break;
-
- case 'r':
- switch (code)
- {
- case COMPONENT_REF:
- /* If this expression is getting a value from a PLACEHOLDER_EXPR
- and it is the right field, replace it with R. */
- for (inner = TREE_OPERAND (exp, 0);
- TREE_CODE_CLASS (TREE_CODE (inner)) == 'r';
- inner = TREE_OPERAND (inner, 0))
- ;
- if (TREE_CODE (inner) == PLACEHOLDER_EXPR
- && TREE_OPERAND (exp, 1) == f)
- return r;
-
- /* If this expression hasn't been completed let, leave it
- alone. */
- if (TREE_CODE (inner) == PLACEHOLDER_EXPR
- && TREE_TYPE (inner) == 0)
- return exp;
-
- op0 = substitute_in_expr (TREE_OPERAND (exp, 0), f, r);
- if (op0 == TREE_OPERAND (exp, 0))
- return exp;
-
- new = fold (build (code, TREE_TYPE (exp), op0,
- TREE_OPERAND (exp, 1)));
- break;
-
- case BIT_FIELD_REF:
- op0 = substitute_in_expr (TREE_OPERAND (exp, 0), f, r);
- op1 = substitute_in_expr (TREE_OPERAND (exp, 1), f, r);
- op2 = substitute_in_expr (TREE_OPERAND (exp, 2), f, r);
- if (op0 == TREE_OPERAND (exp, 0) && op1 == TREE_OPERAND (exp, 1)
- && op2 == TREE_OPERAND (exp, 2))
- return exp;
-
- new = fold (build (code, TREE_TYPE (exp), op0, op1, op2));
- break;
-
- case INDIRECT_REF:
- case BUFFER_REF:
- op0 = substitute_in_expr (TREE_OPERAND (exp, 0), f, r);
- if (op0 == TREE_OPERAND (exp, 0))
- return exp;
-
- new = fold (build1 (code, TREE_TYPE (exp), op0));
- break;
- }
- }
-
- /* If it wasn't one of the cases we handle, give up. */
- if (new == 0)
- abort ();
-
- TREE_READONLY (new) = TREE_READONLY (exp);
- return new;
-}
-
-/* Stabilize a reference so that we can use it any number of times
- without causing its operands to be evaluated more than once.
- Returns the stabilized reference. This works by means of save_expr,
- so see the caveats in the comments about save_expr.
-
- Also allows conversion expressions whose operands are references.
- Any other kind of expression is returned unchanged. */
-
-tree
-stabilize_reference (ref)
- tree ref;
-{
- register tree result;
- register enum tree_code code = TREE_CODE (ref);
-
- switch (code)
- {
- case VAR_DECL:
- case PARM_DECL:
- case RESULT_DECL:
- /* No action is needed in this case. */
- return ref;
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- case FLOAT_EXPR:
- case FIX_TRUNC_EXPR:
- case FIX_FLOOR_EXPR:
- case FIX_ROUND_EXPR:
- case FIX_CEIL_EXPR:
- result = build_nt (code, stabilize_reference (TREE_OPERAND (ref, 0)));
- break;
-
- case INDIRECT_REF:
- result = build_nt (INDIRECT_REF,
- stabilize_reference_1 (TREE_OPERAND (ref, 0)));
- break;
-
- case COMPONENT_REF:
- result = build_nt (COMPONENT_REF,
- stabilize_reference (TREE_OPERAND (ref, 0)),
- TREE_OPERAND (ref, 1));
- break;
-
- case BIT_FIELD_REF:
- result = build_nt (BIT_FIELD_REF,
- stabilize_reference (TREE_OPERAND (ref, 0)),
- stabilize_reference_1 (TREE_OPERAND (ref, 1)),
- stabilize_reference_1 (TREE_OPERAND (ref, 2)));
- break;
-
- case ARRAY_REF:
- result = build_nt (ARRAY_REF,
- stabilize_reference (TREE_OPERAND (ref, 0)),
- stabilize_reference_1 (TREE_OPERAND (ref, 1)));
- break;
-
- case COMPOUND_EXPR:
- /* We cannot wrap the first expression in a SAVE_EXPR, as then
- it wouldn't be ignored. This matters when dealing with
- volatiles. */
- return stabilize_reference_1 (ref);
-
- case RTL_EXPR:
- result = build1 (INDIRECT_REF, TREE_TYPE (ref),
- save_expr (build1 (ADDR_EXPR,
- build_pointer_type (TREE_TYPE (ref)),
- ref)));
- break;
-
-
- /* If arg isn't a kind of lvalue we recognize, make no change.
- Caller should recognize the error for an invalid lvalue. */
- default:
- return ref;
-
- case ERROR_MARK:
- return error_mark_node;
- }
-
- TREE_TYPE (result) = TREE_TYPE (ref);
- TREE_READONLY (result) = TREE_READONLY (ref);
- TREE_SIDE_EFFECTS (result) = TREE_SIDE_EFFECTS (ref);
- TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (ref);
- TREE_RAISES (result) = TREE_RAISES (ref);
-
- return result;
-}
-
-/* Subroutine of stabilize_reference; this is called for subtrees of
- references. Any expression with side-effects must be put in a SAVE_EXPR
- to ensure that it is only evaluated once.
-
- We don't put SAVE_EXPR nodes around everything, because assigning very
- simple expressions to temporaries causes us to miss good opportunities
- for optimizations. Among other things, the opportunity to fold in the
- addition of a constant into an addressing mode often gets lost, e.g.
- "y[i+1] += x;". In general, we take the approach that we should not make
- an assignment unless we are forced into it - i.e., that any non-side effect
- operator should be allowed, and that cse should take care of coalescing
- multiple utterances of the same expression should that prove fruitful. */
-
-tree
-stabilize_reference_1 (e)
- tree e;
-{
- register tree result;
- register enum tree_code code = TREE_CODE (e);
-
- /* We cannot ignore const expressions because it might be a reference
- to a const array but whose index contains side-effects. But we can
- ignore things that are actual constant or that already have been
- handled by this function. */
-
- if (TREE_CONSTANT (e) || code == SAVE_EXPR)
- return e;
-
- switch (TREE_CODE_CLASS (code))
- {
- case 'x':
- case 't':
- case 'd':
- case 'b':
- case '<':
- case 's':
- case 'e':
- case 'r':
- /* If the expression has side-effects, then encase it in a SAVE_EXPR
- so that it will only be evaluated once. */
- /* The reference (r) and comparison (<) classes could be handled as
- below, but it is generally faster to only evaluate them once. */
- if (TREE_SIDE_EFFECTS (e))
- return save_expr (e);
- return e;
-
- case 'c':
- /* Constants need no processing. In fact, we should never reach
- here. */
- return e;
-
- case '2':
- /* Division is slow and tends to be compiled with jumps,
- especially the division by powers of 2 that is often
- found inside of an array reference. So do it just once. */
- if (code == TRUNC_DIV_EXPR || code == TRUNC_MOD_EXPR
- || code == FLOOR_DIV_EXPR || code == FLOOR_MOD_EXPR
- || code == CEIL_DIV_EXPR || code == CEIL_MOD_EXPR
- || code == ROUND_DIV_EXPR || code == ROUND_MOD_EXPR)
- return save_expr (e);
- /* Recursively stabilize each operand. */
- result = build_nt (code, stabilize_reference_1 (TREE_OPERAND (e, 0)),
- stabilize_reference_1 (TREE_OPERAND (e, 1)));
- break;
-
- case '1':
- /* Recursively stabilize each operand. */
- result = build_nt (code, stabilize_reference_1 (TREE_OPERAND (e, 0)));
- break;
-
- default:
- abort ();
- }
-
- TREE_TYPE (result) = TREE_TYPE (e);
- TREE_READONLY (result) = TREE_READONLY (e);
- TREE_SIDE_EFFECTS (result) = TREE_SIDE_EFFECTS (e);
- TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e);
- TREE_RAISES (result) = TREE_RAISES (e);
-
- return result;
-}
-
-/* Low-level constructors for expressions. */
-
-/* Build an expression of code CODE, data type TYPE,
- and operands as specified by the arguments ARG1 and following arguments.
- Expressions and reference nodes can be created this way.
- Constants, decls, types and misc nodes cannot be. */
-
-tree
-build VPROTO((enum tree_code code, tree tt, ...))
-{
-#ifndef __STDC__
- enum tree_code code;
- tree tt;
-#endif
- va_list p;
- register tree t;
- register int length;
- register int i;
-
- VA_START (p, tt);
-
-#ifndef __STDC__
- code = va_arg (p, enum tree_code);
- tt = va_arg (p, tree);
-#endif
-
- t = make_node (code);
- length = tree_code_length[(int) code];
- TREE_TYPE (t) = tt;
-
- if (length == 2)
- {
- /* This is equivalent to the loop below, but faster. */
- register tree arg0 = va_arg (p, tree);
- register tree arg1 = va_arg (p, tree);
- TREE_OPERAND (t, 0) = arg0;
- TREE_OPERAND (t, 1) = arg1;
- if ((arg0 && TREE_SIDE_EFFECTS (arg0))
- || (arg1 && TREE_SIDE_EFFECTS (arg1)))
- TREE_SIDE_EFFECTS (t) = 1;
- TREE_RAISES (t)
- = (arg0 && TREE_RAISES (arg0)) || (arg1 && TREE_RAISES (arg1));
- }
- else if (length == 1)
- {
- register tree arg0 = va_arg (p, tree);
-
- /* Call build1 for this! */
- if (TREE_CODE_CLASS (code) != 's')
- abort ();
- TREE_OPERAND (t, 0) = arg0;
- if (arg0 && TREE_SIDE_EFFECTS (arg0))
- TREE_SIDE_EFFECTS (t) = 1;
- TREE_RAISES (t) = (arg0 && TREE_RAISES (arg0));
- }
- else
- {
- for (i = 0; i < length; i++)
- {
- register tree operand = va_arg (p, tree);
- TREE_OPERAND (t, i) = operand;
- if (operand)
- {
- if (TREE_SIDE_EFFECTS (operand))
- TREE_SIDE_EFFECTS (t) = 1;
- if (TREE_RAISES (operand))
- TREE_RAISES (t) = 1;
- }
- }
- }
- va_end (p);
- return t;
-}
-
-/* Same as above, but only builds for unary operators.
- Saves lions share of calls to `build'; cuts down use
- of varargs, which is expensive for RISC machines. */
-
-tree
-build1 (code, type, node)
- enum tree_code code;
- tree type;
- tree node;
-{
- register struct obstack *obstack = expression_obstack;
- register int i, length;
- register tree_node_kind kind;
- register tree t;
-
-#ifdef GATHER_STATISTICS
- if (TREE_CODE_CLASS (code) == 'r')
- kind = r_kind;
- else
- kind = e_kind;
-#endif
-
- length = sizeof (struct tree_exp);
-
- t = (tree) obstack_alloc (obstack, length);
-
-#ifdef GATHER_STATISTICS
- tree_node_counts[(int)kind]++;
- tree_node_sizes[(int)kind] += length;
-#endif
-
- for (i = (length / sizeof (int)) - 1; i >= 0; i--)
- ((int *) t)[i] = 0;
-
- TREE_TYPE (t) = type;
- TREE_SET_CODE (t, code);
-
- if (obstack == &permanent_obstack)
- TREE_PERMANENT (t) = 1;
-
- TREE_OPERAND (t, 0) = node;
- if (node)
- {
- if (TREE_SIDE_EFFECTS (node))
- TREE_SIDE_EFFECTS (t) = 1;
- if (TREE_RAISES (node))
- TREE_RAISES (t) = 1;
- }
-
- return t;
-}
-
-/* Similar except don't specify the TREE_TYPE
- and leave the TREE_SIDE_EFFECTS as 0.
- It is permissible for arguments to be null,
- or even garbage if their values do not matter. */
-
-tree
-build_nt VPROTO((enum tree_code code, ...))
-{
-#ifndef __STDC__
- enum tree_code code;
-#endif
- va_list p;
- register tree t;
- register int length;
- register int i;
-
- VA_START (p, code);
-
-#ifndef __STDC__
- code = va_arg (p, enum tree_code);
-#endif
-
- t = make_node (code);
- length = tree_code_length[(int) code];
-
- for (i = 0; i < length; i++)
- TREE_OPERAND (t, i) = va_arg (p, tree);
-
- va_end (p);
- return t;
-}
-
-/* Similar to `build_nt', except we build
- on the temp_decl_obstack, regardless. */
-
-tree
-build_parse_node VPROTO((enum tree_code code, ...))
-{
-#ifndef __STDC__
- enum tree_code code;
-#endif
- register struct obstack *ambient_obstack = expression_obstack;
- va_list p;
- register tree t;
- register int length;
- register int i;
-
- VA_START (p, code);
-
-#ifndef __STDC__
- code = va_arg (p, enum tree_code);
-#endif
-
- expression_obstack = &temp_decl_obstack;
-
- t = make_node (code);
- length = tree_code_length[(int) code];
-
- for (i = 0; i < length; i++)
- TREE_OPERAND (t, i) = va_arg (p, tree);
-
- va_end (p);
- expression_obstack = ambient_obstack;
- return t;
-}
-
-#if 0
-/* Commented out because this wants to be done very
- differently. See cp-lex.c. */
-tree
-build_op_identifier (op1, op2)
- tree op1, op2;
-{
- register tree t = make_node (OP_IDENTIFIER);
- TREE_PURPOSE (t) = op1;
- TREE_VALUE (t) = op2;
- return t;
-}
-#endif
-
-/* Create a DECL_... node of code CODE, name NAME and data type TYPE.
- We do NOT enter this node in any sort of symbol table.
-
- layout_decl is used to set up the decl's storage layout.
- Other slots are initialized to 0 or null pointers. */
-
-tree
-build_decl (code, name, type)
- enum tree_code code;
- tree name, type;
-{
- register tree t;
-
- t = make_node (code);
-
-/* if (type == error_mark_node)
- type = integer_type_node; */
-/* That is not done, deliberately, so that having error_mark_node
- as the type can suppress useless errors in the use of this variable. */
-
- DECL_NAME (t) = name;
- DECL_ASSEMBLER_NAME (t) = name;
- TREE_TYPE (t) = type;
-
- if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
- layout_decl (t, 0);
- else if (code == FUNCTION_DECL)
- DECL_MODE (t) = FUNCTION_MODE;
-
- return t;
-}
-
-/* BLOCK nodes are used to represent the structure of binding contours
- and declarations, once those contours have been exited and their contents
- compiled. This information is used for outputting debugging info. */
-
-tree
-build_block (vars, tags, subblocks, supercontext, chain)
- tree vars, tags, subblocks, supercontext, chain;
-{
- register tree block = make_node (BLOCK);
- BLOCK_VARS (block) = vars;
- BLOCK_TYPE_TAGS (block) = tags;
- BLOCK_SUBBLOCKS (block) = subblocks;
- BLOCK_SUPERCONTEXT (block) = supercontext;
- BLOCK_CHAIN (block) = chain;
- return block;
-}
-
-/* Return a declaration like DDECL except that its DECL_MACHINE_ATTRIBUTE
- is ATTRIBUTE. */
-
-tree
-build_decl_attribute_variant (ddecl, attribute)
- tree ddecl, attribute;
-{
- DECL_MACHINE_ATTRIBUTES (ddecl) = attribute;
- return ddecl;
-}
-
-/* Return a type like TTYPE except that its TYPE_ATTRIBUTE
- is ATTRIBUTE.
-
- Record such modified types already made so we don't make duplicates. */
-
-tree
-build_type_attribute_variant (ttype, attribute)
- tree ttype, attribute;
-{
- if ( ! attribute_list_equal (TYPE_ATTRIBUTES (ttype), attribute))
- {
- register int hashcode;
- register struct obstack *ambient_obstack = current_obstack;
- tree ntype;
-
- if (ambient_obstack != &permanent_obstack)
- current_obstack = TYPE_OBSTACK (ttype);
-
- ntype = copy_node (ttype);
- current_obstack = ambient_obstack;
-
- TYPE_POINTER_TO (ntype) = 0;
- TYPE_REFERENCE_TO (ntype) = 0;
- TYPE_ATTRIBUTES (ntype) = attribute;
-
- /* Create a new main variant of TYPE. */
- TYPE_MAIN_VARIANT (ntype) = ntype;
- TYPE_NEXT_VARIANT (ntype) = 0;
- TYPE_READONLY (ntype) = TYPE_VOLATILE (ntype) = 0;
-
- hashcode = TYPE_HASH (TREE_CODE (ntype))
- + TYPE_HASH (TREE_TYPE (ntype))
- + attribute_hash_list (attribute);
-
- switch (TREE_CODE (ntype))
- {
- case FUNCTION_TYPE:
- hashcode += TYPE_HASH (TYPE_ARG_TYPES (ntype));
- break;
- case ARRAY_TYPE:
- hashcode += TYPE_HASH (TYPE_DOMAIN (ntype));
- break;
- case INTEGER_TYPE:
- hashcode += TYPE_HASH (TYPE_MAX_VALUE (ntype));
- break;
- case REAL_TYPE:
- hashcode += TYPE_HASH (TYPE_PRECISION (ntype));
- break;
- }
-
- ntype = type_hash_canon (hashcode, ntype);
- ttype = build_type_variant (ntype, TYPE_READONLY (ttype),
- TYPE_VOLATILE (ttype));
- }
-
- return ttype;
-}
-
-/* Return a 1 if ATTR_NAME and ATTR_ARGS is valid for either declaration DECL
- or type TYPE and 0 otherwise. Validity is determined the configuration
- macros VALID_MACHINE_DECL_ATTRIBUTE and VALID_MACHINE_TYPE_ATTRIBUTE. */
-
-int
-valid_machine_attribute (attr_name, attr_args, decl, type)
- tree attr_name, attr_args;
- tree decl;
- tree type;
-{
- int valid = 0;
- tree decl_attr_list = decl != 0 ? DECL_MACHINE_ATTRIBUTES (decl) : 0;
- tree type_attr_list = TYPE_ATTRIBUTES (type);
-
- if (TREE_CODE (attr_name) != IDENTIFIER_NODE)
- abort ();
-
-#ifdef VALID_MACHINE_DECL_ATTRIBUTE
- if (decl != 0
- && VALID_MACHINE_DECL_ATTRIBUTE (decl, decl_attr_list, attr_name, attr_args))
- {
- tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
- decl_attr_list);
-
- if (attr != NULL_TREE)
- {
- /* Override existing arguments. Declarations are unique so we can
- modify this in place. */
- TREE_VALUE (attr) = attr_args;
- }
- else
- {
- decl_attr_list = tree_cons (attr_name, attr_args, decl_attr_list);
- decl = build_decl_attribute_variant (decl, decl_attr_list);
- }
-
- valid = 1;
- }
-#endif
-
-#ifdef VALID_MACHINE_TYPE_ATTRIBUTE
- if (VALID_MACHINE_TYPE_ATTRIBUTE (type, type_attr_list, attr_name, attr_args))
- {
- tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
- type_attr_list);
-
- if (attr != NULL_TREE)
- {
- /* Override existing arguments.
- ??? This currently works since attribute arguments are not
- included in `attribute_hash_list'. Something more complicated
- may be needed in the future. */
- TREE_VALUE (attr) = attr_args;
- }
- else
- {
- type_attr_list = tree_cons (attr_name, attr_args, type_attr_list);
- type = build_type_attribute_variant (type, type_attr_list);
- }
- if (decl != 0)
- TREE_TYPE (decl) = type;
- valid = 1;
- }
-
- /* Handle putting a type attribute on pointer-to-function-type by putting
- the attribute on the function type. */
- else if (TREE_CODE (type) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
- && VALID_MACHINE_TYPE_ATTRIBUTE (TREE_TYPE (type), type_attr_list,
- attr_name, attr_args))
- {
- tree inner_type = TREE_TYPE (type);
- tree inner_attr_list = TYPE_ATTRIBUTES (inner_type);
- tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
- type_attr_list);
-
- if (attr != NULL_TREE)
- TREE_VALUE (attr) = attr_args;
- else
- {
- inner_attr_list = tree_cons (attr_name, attr_args, inner_attr_list);
- inner_type = build_type_attribute_variant (inner_type,
- inner_attr_list);
- }
-
- if (decl != 0)
- TREE_TYPE (decl) = build_pointer_type (inner_type);
-
- valid = 1;
- }
-#endif
-
- return valid;
-}
-
-/* Return non-zero if IDENT is a valid name for attribute ATTR,
- or zero if not.
-
- We try both `text' and `__text__', ATTR may be either one. */
-/* ??? It might be a reasonable simplification to require ATTR to be only
- `text'. One might then also require attribute lists to be stored in
- their canonicalized form. */
-
-int
-is_attribute_p (attr, ident)
- char *attr;
- tree ident;
-{
- int ident_len, attr_len;
- char *p;
-
- if (TREE_CODE (ident) != IDENTIFIER_NODE)
- return 0;
-
- if (strcmp (attr, IDENTIFIER_POINTER (ident)) == 0)
- return 1;
-
- p = IDENTIFIER_POINTER (ident);
- ident_len = strlen (p);
- attr_len = strlen (attr);
-
- /* If ATTR is `__text__', IDENT must be `text'; and vice versa. */
- if (attr[0] == '_')
- {
- if (attr[1] != '_'
- || attr[attr_len - 2] != '_'
- || attr[attr_len - 1] != '_')
- abort ();
- if (ident_len == attr_len - 4
- && strncmp (attr + 2, p, attr_len - 4) == 0)
- return 1;
- }
- else
- {
- if (ident_len == attr_len + 4
- && p[0] == '_' && p[1] == '_'
- && p[ident_len - 2] == '_' && p[ident_len - 1] == '_'
- && strncmp (attr, p + 2, attr_len) == 0)
- return 1;
- }
-
- return 0;
-}
-
-/* Given an attribute name and a list of attributes, return a pointer to the
- attribute's list element if the attribute is part of the list, or NULL_TREE
- if not found. */
-
-tree
-lookup_attribute (attr_name, list)
- char *attr_name;
- tree list;
-{
- tree l;
-
- for (l = list; l; l = TREE_CHAIN (l))
- {
- if (TREE_CODE (TREE_PURPOSE (l)) != IDENTIFIER_NODE)
- abort ();
- if (is_attribute_p (attr_name, TREE_PURPOSE (l)))
- return l;
- }
-
- return NULL_TREE;
-}
-
-/* Return an attribute list that is the union of a1 and a2. */
-
-tree
-merge_attributes (a1, a2)
- register tree a1, a2;
-{
- tree attributes;
-
- /* Either one unset? Take the set one. */
-
- if (! (attributes = a1))
- attributes = a2;
-
- /* One that completely contains the other? Take it. */
-
- else if (a2 && ! attribute_list_contained (a1, a2))
- if (attribute_list_contained (a2, a1))
- attributes = a2;
- else
- {
- /* Pick the longest list, and hang on the other list. */
- /* ??? For the moment we punt on the issue of attrs with args. */
-
- if (list_length (a1) < list_length (a2))
- attributes = a2, a2 = a1;
-
- for (; a2; a2 = TREE_CHAIN (a2))
- if (lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (a2)),
- attributes) == NULL_TREE)
- {
- a1 = copy_node (a2);
- TREE_CHAIN (a1) = attributes;
- attributes = a1;
- }
- }
- return attributes;
-}
-
-/* Return a type like TYPE except that its TYPE_READONLY is CONSTP
- and its TYPE_VOLATILE is VOLATILEP.
-
- Such variant types already made are recorded so that duplicates
- are not made.
-
- A variant types should never be used as the type of an expression.
- Always copy the variant information into the TREE_READONLY
- and TREE_THIS_VOLATILE of the expression, and then give the expression
- as its type the "main variant", the variant whose TYPE_READONLY
- and TYPE_VOLATILE are zero. Use TYPE_MAIN_VARIANT to find the
- main variant. */
-
-tree
-build_type_variant (type, constp, volatilep)
- tree type;
- int constp, volatilep;
-{
- register tree t;
-
- /* Treat any nonzero argument as 1. */
- constp = !!constp;
- volatilep = !!volatilep;
-
- /* Search the chain of variants to see if there is already one there just
- like the one we need to have. If so, use that existing one. We must
- preserve the TYPE_NAME, since there is code that depends on this. */
-
- for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
- if (constp == TYPE_READONLY (t) && volatilep == TYPE_VOLATILE (t)
- && TYPE_NAME (t) == TYPE_NAME (type))
- return t;
-
- /* We need a new one. */
-
- t = build_type_copy (type);
- TYPE_READONLY (t) = constp;
- TYPE_VOLATILE (t) = volatilep;
-
- return t;
-}
-
-/* Give TYPE a new main variant: NEW_MAIN.
- This is the right thing to do only when something else
- about TYPE is modified in place. */
-
-void
-change_main_variant (type, new_main)
- tree type, new_main;
-{
- tree t;
- tree omain = TYPE_MAIN_VARIANT (type);
-
- /* Remove TYPE from the TYPE_NEXT_VARIANT chain of its main variant. */
- if (TYPE_NEXT_VARIANT (omain) == type)
- TYPE_NEXT_VARIANT (omain) = TYPE_NEXT_VARIANT (type);
- else
- for (t = TYPE_NEXT_VARIANT (omain); t && TYPE_NEXT_VARIANT (t);
- t = TYPE_NEXT_VARIANT (t))
- if (TYPE_NEXT_VARIANT (t) == type)
- {
- TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (type);
- break;
- }
-
- TYPE_MAIN_VARIANT (type) = new_main;
- TYPE_NEXT_VARIANT (type) = TYPE_NEXT_VARIANT (new_main);
- TYPE_NEXT_VARIANT (new_main) = type;
-}
-
-/* Create a new variant of TYPE, equivalent but distinct.
- This is so the caller can modify it. */
-
-tree
-build_type_copy (type)
- tree type;
-{
- register tree t, m = TYPE_MAIN_VARIANT (type);
- register struct obstack *ambient_obstack = current_obstack;
-
- current_obstack = TYPE_OBSTACK (type);
- t = copy_node (type);
- current_obstack = ambient_obstack;
-
- TYPE_POINTER_TO (t) = 0;
- TYPE_REFERENCE_TO (t) = 0;
-
- /* Add this type to the chain of variants of TYPE. */
- TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
- TYPE_NEXT_VARIANT (m) = t;
-
- return t;
-}
-
-/* Hashing of types so that we don't make duplicates.
- The entry point is `type_hash_canon'. */
-
-/* Each hash table slot is a bucket containing a chain
- of these structures. */
-
-struct type_hash
-{
- struct type_hash *next; /* Next structure in the bucket. */
- int hashcode; /* Hash code of this type. */
- tree type; /* The type recorded here. */
-};
-
-/* Now here is the hash table. When recording a type, it is added
- to the slot whose index is the hash code mod the table size.
- Note that the hash table is used for several kinds of types
- (function types, array types and array index range types, for now).
- While all these live in the same table, they are completely independent,
- and the hash code is computed differently for each of these. */
-
-#define TYPE_HASH_SIZE 59
-struct type_hash *type_hash_table[TYPE_HASH_SIZE];
-
-/* Compute a hash code for a list of types (chain of TREE_LIST nodes
- with types in the TREE_VALUE slots), by adding the hash codes
- of the individual types. */
-
-int
-type_hash_list (list)
- tree list;
-{
- register int hashcode;
- register tree tail;
- for (hashcode = 0, tail = list; tail; tail = TREE_CHAIN (tail))
- hashcode += TYPE_HASH (TREE_VALUE (tail));
- return hashcode;
-}
-
-/* Look in the type hash table for a type isomorphic to TYPE.
- If one is found, return it. Otherwise return 0. */
-
-tree
-type_hash_lookup (hashcode, type)
- int hashcode;
- tree type;
-{
- register struct type_hash *h;
- for (h = type_hash_table[hashcode % TYPE_HASH_SIZE]; h; h = h->next)
- if (h->hashcode == hashcode
- && TREE_CODE (h->type) == TREE_CODE (type)
- && TREE_TYPE (h->type) == TREE_TYPE (type)
- && attribute_list_equal (TYPE_ATTRIBUTES (h->type),
- TYPE_ATTRIBUTES (type))
- && (TYPE_MAX_VALUE (h->type) == TYPE_MAX_VALUE (type)
- || tree_int_cst_equal (TYPE_MAX_VALUE (h->type),
- TYPE_MAX_VALUE (type)))
- && (TYPE_MIN_VALUE (h->type) == TYPE_MIN_VALUE (type)
- || tree_int_cst_equal (TYPE_MIN_VALUE (h->type),
- TYPE_MIN_VALUE (type)))
- /* Note that TYPE_DOMAIN is TYPE_ARG_TYPES for FUNCTION_TYPE. */
- && (TYPE_DOMAIN (h->type) == TYPE_DOMAIN (type)
- || (TYPE_DOMAIN (h->type)
- && TREE_CODE (TYPE_DOMAIN (h->type)) == TREE_LIST
- && TYPE_DOMAIN (type)
- && TREE_CODE (TYPE_DOMAIN (type)) == TREE_LIST
- && type_list_equal (TYPE_DOMAIN (h->type),
- TYPE_DOMAIN (type)))))
- return h->type;
- return 0;
-}
-
-/* Add an entry to the type-hash-table
- for a type TYPE whose hash code is HASHCODE. */
-
-void
-type_hash_add (hashcode, type)
- int hashcode;
- tree type;
-{
- register struct type_hash *h;
-
- h = (struct type_hash *) oballoc (sizeof (struct type_hash));
- h->hashcode = hashcode;
- h->type = type;
- h->next = type_hash_table[hashcode % TYPE_HASH_SIZE];
- type_hash_table[hashcode % TYPE_HASH_SIZE] = h;
-}
-
-/* Given TYPE, and HASHCODE its hash code, return the canonical
- object for an identical type if one already exists.
- Otherwise, return TYPE, and record it as the canonical object
- if it is a permanent object.
-
- To use this function, first create a type of the sort you want.
- Then compute its hash code from the fields of the type that
- make it different from other similar types.
- Then call this function and use the value.
- This function frees the type you pass in if it is a duplicate. */
-
-/* Set to 1 to debug without canonicalization. Never set by program. */
-int debug_no_type_hash = 0;
-
-tree
-type_hash_canon (hashcode, type)
- int hashcode;
- tree type;
-{
- tree t1;
-
- if (debug_no_type_hash)
- return type;
-
- t1 = type_hash_lookup (hashcode, type);
- if (t1 != 0)
- {
- obstack_free (TYPE_OBSTACK (type), type);
-#ifdef GATHER_STATISTICS
- tree_node_counts[(int)t_kind]--;
- tree_node_sizes[(int)t_kind] -= sizeof (struct tree_type);
-#endif
- return t1;
- }
-
- /* If this is a permanent type, record it for later reuse. */
- if (TREE_PERMANENT (type))
- type_hash_add (hashcode, type);
-
- return type;
-}
-
-/* Compute a hash code for a list of attributes (chain of TREE_LIST nodes
- with names in the TREE_PURPOSE slots and args in the TREE_VALUE slots),
- by adding the hash codes of the individual attributes. */
-
-int
-attribute_hash_list (list)
- tree list;
-{
- register int hashcode;
- register tree tail;
- for (hashcode = 0, tail = list; tail; tail = TREE_CHAIN (tail))
- /* ??? Do we want to add in TREE_VALUE too? */
- hashcode += TYPE_HASH (TREE_PURPOSE (tail));
- return hashcode;
-}
-
-/* Given two lists of attributes, return true if list l2 is
- equivalent to l1. */
-
-int
-attribute_list_equal (l1, l2)
- tree l1, l2;
-{
- return attribute_list_contained (l1, l2)
- && attribute_list_contained (l2, l1);
-}
-
-/* Given two lists of attributes, return true if list L2 is
- completely contained within L1. */
-/* ??? This would be faster if attribute names were stored in a canonicalized
- form. Otherwise, if L1 uses `foo' and L2 uses `__foo__', the long method
- must be used to show these elements are equivalent (which they are). */
-/* ??? It's not clear that attributes with arguments will always be handled
- correctly. */
-
-int
-attribute_list_contained (l1, l2)
- tree l1, l2;
-{
- register tree t1, t2;
-
- /* First check the obvious, maybe the lists are identical. */
- if (l1 == l2)
- return 1;
-
- /* Maybe the lists are similar. */
- for (t1 = l1, t2 = l2;
- t1 && t2
- && TREE_PURPOSE (t1) == TREE_PURPOSE (t2)
- && TREE_VALUE (t1) == TREE_VALUE (t2);
- t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2));
-
- /* Maybe the lists are equal. */
- if (t1 == 0 && t2 == 0)
- return 1;
-
- for (; t2; t2 = TREE_CHAIN (t2))
- {
- tree attr
- = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), l1);
-
- if (attr == NULL_TREE)
- return 0;
- if (simple_cst_equal (TREE_VALUE (t2), TREE_VALUE (attr)) != 1)
- return 0;
- }
-
- return 1;
-}
-
-/* Given two lists of types
- (chains of TREE_LIST nodes with types in the TREE_VALUE slots)
- return 1 if the lists contain the same types in the same order.
- Also, the TREE_PURPOSEs must match. */
-
-int
-type_list_equal (l1, l2)
- tree l1, l2;
-{
- register tree t1, t2;
-
- for (t1 = l1, t2 = l2; t1 && t2; t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2))
- if (TREE_VALUE (t1) != TREE_VALUE (t2)
- || (TREE_PURPOSE (t1) != TREE_PURPOSE (t2)
- && ! (1 == simple_cst_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2))
- && (TREE_TYPE (TREE_PURPOSE (t1))
- == TREE_TYPE (TREE_PURPOSE (t2))))))
- return 0;
-
- return t1 == t2;
-}
-
-/* Nonzero if integer constants T1 and T2
- represent the same constant value. */
-
-int
-tree_int_cst_equal (t1, t2)
- tree t1, t2;
-{
- if (t1 == t2)
- return 1;
- if (t1 == 0 || t2 == 0)
- return 0;
- if (TREE_CODE (t1) == INTEGER_CST
- && TREE_CODE (t2) == INTEGER_CST
- && TREE_INT_CST_LOW (t1) == TREE_INT_CST_LOW (t2)
- && TREE_INT_CST_HIGH (t1) == TREE_INT_CST_HIGH (t2))
- return 1;
- return 0;
-}
-
-/* Nonzero if integer constants T1 and T2 represent values that satisfy <.
- The precise way of comparison depends on their data type. */
-
-int
-tree_int_cst_lt (t1, t2)
- tree t1, t2;
-{
- if (t1 == t2)
- return 0;
-
- if (!TREE_UNSIGNED (TREE_TYPE (t1)))
- return INT_CST_LT (t1, t2);
- return INT_CST_LT_UNSIGNED (t1, t2);
-}
-
-/* Return an indication of the sign of the integer constant T.
- The return value is -1 if T < 0, 0 if T == 0, and 1 if T > 0.
- Note that -1 will never be returned it T's type is unsigned. */
-
-int
-tree_int_cst_sgn (t)
- tree t;
-{
- if (TREE_INT_CST_LOW (t) == 0 && TREE_INT_CST_HIGH (t) == 0)
- return 0;
- else if (TREE_UNSIGNED (TREE_TYPE (t)))
- return 1;
- else if (TREE_INT_CST_HIGH (t) < 0)
- return -1;
- else
- return 1;
-}
-
-/* Compare two constructor-element-type constants. Return 1 if the lists
- are known to be equal; otherwise return 0. */
-
-int
-simple_cst_list_equal (l1, l2)
- tree l1, l2;
-{
- while (l1 != NULL_TREE && l2 != NULL_TREE)
- {
- if (simple_cst_equal (TREE_VALUE (l1), TREE_VALUE (l2)) != 1)
- return 0;
-
- l1 = TREE_CHAIN (l1);
- l2 = TREE_CHAIN (l2);
- }
-
- return (l1 == l2);
-}
-
-/* Return truthvalue of whether T1 is the same tree structure as T2.
- Return 1 if they are the same.
- Return 0 if they are understandably different.
- Return -1 if either contains tree structure not understood by
- this function. */
-
-int
-simple_cst_equal (t1, t2)
- tree t1, t2;
-{
- register enum tree_code code1, code2;
- int cmp;
-
- if (t1 == t2)
- return 1;
- if (t1 == 0 || t2 == 0)
- return 0;
-
- code1 = TREE_CODE (t1);
- code2 = TREE_CODE (t2);
-
- if (code1 == NOP_EXPR || code1 == CONVERT_EXPR || code1 == NON_LVALUE_EXPR)
- if (code2 == NOP_EXPR || code2 == CONVERT_EXPR || code2 == NON_LVALUE_EXPR)
- return simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- else
- return simple_cst_equal (TREE_OPERAND (t1, 0), t2);
- else if (code2 == NOP_EXPR || code2 == CONVERT_EXPR
- || code2 == NON_LVALUE_EXPR)
- return simple_cst_equal (t1, TREE_OPERAND (t2, 0));
-
- if (code1 != code2)
- return 0;
-
- switch (code1)
- {
- case INTEGER_CST:
- return TREE_INT_CST_LOW (t1) == TREE_INT_CST_LOW (t2)
- && TREE_INT_CST_HIGH (t1) == TREE_INT_CST_HIGH (t2);
-
- case REAL_CST:
- return REAL_VALUES_EQUAL (TREE_REAL_CST (t1), TREE_REAL_CST (t2));
-
- case STRING_CST:
- return TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2)
- && !bcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2),
- TREE_STRING_LENGTH (t1));
-
- case CONSTRUCTOR:
- abort ();
-
- case SAVE_EXPR:
- return simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
-
- case CALL_EXPR:
- cmp = simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- if (cmp <= 0)
- return cmp;
- return simple_cst_list_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
-
- case TARGET_EXPR:
- /* Special case: if either target is an unallocated VAR_DECL,
- it means that it's going to be unified with whatever the
- TARGET_EXPR is really supposed to initialize, so treat it
- as being equivalent to anything. */
- if ((TREE_CODE (TREE_OPERAND (t1, 0)) == VAR_DECL
- && DECL_NAME (TREE_OPERAND (t1, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t1, 0)) == 0)
- || (TREE_CODE (TREE_OPERAND (t2, 0)) == VAR_DECL
- && DECL_NAME (TREE_OPERAND (t2, 0)) == NULL_TREE
- && DECL_RTL (TREE_OPERAND (t2, 0)) == 0))
- cmp = 1;
- else
- cmp = simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- if (cmp <= 0)
- return cmp;
- return simple_cst_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
-
- case WITH_CLEANUP_EXPR:
- cmp = simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- if (cmp <= 0)
- return cmp;
- return simple_cst_equal (TREE_OPERAND (t1, 2), TREE_OPERAND (t1, 2));
-
- case COMPONENT_REF:
- if (TREE_OPERAND (t1, 1) == TREE_OPERAND (t2, 1))
- return simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
- return 0;
-
- case VAR_DECL:
- case PARM_DECL:
- case CONST_DECL:
- case FUNCTION_DECL:
- return 0;
- }
-
- /* This general rule works for most tree codes. All exceptions should be
- handled above. If this is a language-specific tree code, we can't
- trust what might be in the operand, so say we don't know
- the situation. */
- if ((int) code1
- >= sizeof standard_tree_code_type / sizeof standard_tree_code_type[0])
- return -1;
-
- switch (TREE_CODE_CLASS (code1))
- {
- int i;
- case '1':
- case '2':
- case '<':
- case 'e':
- case 'r':
- case 's':
- cmp = 1;
- for (i=0; i<tree_code_length[(int) code1]; ++i)
- {
- cmp = simple_cst_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
- if (cmp <= 0)
- return cmp;
- }
- return cmp;
- }
-
- return -1;
-}
-
-/* Constructors for pointer, array and function types.
- (RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE nodes are
- constructed by language-dependent code, not here.) */
-
-/* Construct, lay out and return the type of pointers to TO_TYPE.
- If such a type has already been constructed, reuse it. */
-
-tree
-build_pointer_type (to_type)
- tree to_type;
-{
- register tree t = TYPE_POINTER_TO (to_type);
-
- /* First, if we already have a type for pointers to TO_TYPE, use it. */
-
- if (t)
- return t;
-
- /* We need a new one. Put this in the same obstack as TO_TYPE. */
- push_obstacks (TYPE_OBSTACK (to_type), TYPE_OBSTACK (to_type));
- t = make_node (POINTER_TYPE);
- pop_obstacks ();
-
- TREE_TYPE (t) = to_type;
-
- /* Record this type as the pointer to TO_TYPE. */
- TYPE_POINTER_TO (to_type) = t;
-
- /* Lay out the type. This function has many callers that are concerned
- with expression-construction, and this simplifies them all.
- Also, it guarantees the TYPE_SIZE is in the same obstack as the type. */
- layout_type (t);
-
- return t;
-}
-
-/* Create a type of integers to be the TYPE_DOMAIN of an ARRAY_TYPE.
- MAXVAL should be the maximum value in the domain
- (one less than the length of the array). */
-
-tree
-build_index_type (maxval)
- tree maxval;
-{
- register tree itype = make_node (INTEGER_TYPE);
-
- TYPE_PRECISION (itype) = TYPE_PRECISION (sizetype);
- TYPE_MIN_VALUE (itype) = size_zero_node;
-
- push_obstacks (TYPE_OBSTACK (itype), TYPE_OBSTACK (itype));
- TYPE_MAX_VALUE (itype) = convert (sizetype, maxval);
- pop_obstacks ();
-
- TYPE_MODE (itype) = TYPE_MODE (sizetype);
- TYPE_SIZE (itype) = TYPE_SIZE (sizetype);
- TYPE_ALIGN (itype) = TYPE_ALIGN (sizetype);
- if (TREE_CODE (maxval) == INTEGER_CST)
- {
- int maxint = (int) TREE_INT_CST_LOW (maxval);
- /* If the domain should be empty, make sure the maxval
- remains -1 and is not spoiled by truncation. */
- if (INT_CST_LT (maxval, integer_zero_node))
- {
- TYPE_MAX_VALUE (itype) = build_int_2 (-1, -1);
- TREE_TYPE (TYPE_MAX_VALUE (itype)) = sizetype;
- }
- return type_hash_canon (maxint < 0 ? ~maxint : maxint, itype);
- }
- else
- return itype;
-}
-
-/* Create a range of some discrete type TYPE (an INTEGER_TYPE,
- ENUMERAL_TYPE, BOOLEAN_TYPE, or CHAR_TYPE), with
- low bound LOWVAL and high bound HIGHVAL.
- if TYPE==NULL_TREE, sizetype is used. */
-
-tree
-build_range_type (type, lowval, highval)
- tree type, lowval, highval;
-{
- register tree itype = make_node (INTEGER_TYPE);
-
- TREE_TYPE (itype) = type;
- if (type == NULL_TREE)
- type = sizetype;
-
- push_obstacks (TYPE_OBSTACK (itype), TYPE_OBSTACK (itype));
- TYPE_MIN_VALUE (itype) = convert (type, lowval);
- TYPE_MAX_VALUE (itype) = convert (type, highval);
- pop_obstacks ();
-
- TYPE_PRECISION (itype) = TYPE_PRECISION (type);
- TYPE_MODE (itype) = TYPE_MODE (type);
- TYPE_SIZE (itype) = TYPE_SIZE (type);
- TYPE_ALIGN (itype) = TYPE_ALIGN (type);
- if ((TREE_CODE (lowval) == INTEGER_CST)
- && (TREE_CODE (highval) == INTEGER_CST))
- {
- HOST_WIDE_INT highint = TREE_INT_CST_LOW (highval);
- HOST_WIDE_INT lowint = TREE_INT_CST_LOW (lowval);
- int maxint = (int) (highint - lowint);
- return type_hash_canon (maxint < 0 ? ~maxint : maxint, itype);
- }
- else
- return itype;
-}
-
-/* Just like build_index_type, but takes lowval and highval instead
- of just highval (maxval). */
-
-tree
-build_index_2_type (lowval,highval)
- tree lowval, highval;
-{
- return build_range_type (NULL_TREE, lowval, highval);
-}
-
-/* Return nonzero iff ITYPE1 and ITYPE2 are equal (in the LISP sense).
- Needed because when index types are not hashed, equal index types
- built at different times appear distinct, even though structurally,
- they are not. */
-
-int
-index_type_equal (itype1, itype2)
- tree itype1, itype2;
-{
- if (TREE_CODE (itype1) != TREE_CODE (itype2))
- return 0;
- if (TREE_CODE (itype1) == INTEGER_TYPE)
- {
- if (TYPE_PRECISION (itype1) != TYPE_PRECISION (itype2)
- || TYPE_MODE (itype1) != TYPE_MODE (itype2)
- || simple_cst_equal (TYPE_SIZE (itype1), TYPE_SIZE (itype2)) != 1
- || TYPE_ALIGN (itype1) != TYPE_ALIGN (itype2))
- return 0;
- if (1 == simple_cst_equal (TYPE_MIN_VALUE (itype1),
- TYPE_MIN_VALUE (itype2))
- && 1 == simple_cst_equal (TYPE_MAX_VALUE (itype1),
- TYPE_MAX_VALUE (itype2)))
- return 1;
- }
-
- return 0;
-}
-
-/* Construct, lay out and return the type of arrays of elements with ELT_TYPE
- and number of elements specified by the range of values of INDEX_TYPE.
- If such a type has already been constructed, reuse it. */
-
-tree
-build_array_type (elt_type, index_type)
- tree elt_type, index_type;
-{
- register tree t;
- int hashcode;
-
- if (TREE_CODE (elt_type) == FUNCTION_TYPE)
- {
- error ("arrays of functions are not meaningful");
- elt_type = integer_type_node;
- }
-
- /* Make sure TYPE_POINTER_TO (elt_type) is filled in. */
- build_pointer_type (elt_type);
-
- /* Allocate the array after the pointer type,
- in case we free it in type_hash_canon. */
- t = make_node (ARRAY_TYPE);
- TREE_TYPE (t) = elt_type;
- TYPE_DOMAIN (t) = index_type;
-
- if (index_type == 0)
- {
- return t;
- }
-
- hashcode = TYPE_HASH (elt_type) + TYPE_HASH (index_type);
- t = type_hash_canon (hashcode, t);
-
-#if 0 /* This led to crashes, because it could put a temporary node
- on the TYPE_NEXT_VARIANT chain of a permanent one. */
- /* The main variant of an array type should always
- be an array whose element type is the main variant. */
- if (elt_type != TYPE_MAIN_VARIANT (elt_type))
- change_main_variant (t, build_array_type (TYPE_MAIN_VARIANT (elt_type),
- index_type));
-#endif
-
- if (TYPE_SIZE (t) == 0)
- layout_type (t);
- return t;
-}
-
-/* Construct, lay out and return
- the type of functions returning type VALUE_TYPE
- given arguments of types ARG_TYPES.
- ARG_TYPES is a chain of TREE_LIST nodes whose TREE_VALUEs
- are data type nodes for the arguments of the function.
- If such a type has already been constructed, reuse it. */
-
-tree
-build_function_type (value_type, arg_types)
- tree value_type, arg_types;
-{
- register tree t;
- int hashcode;
-
- if (TREE_CODE (value_type) == FUNCTION_TYPE)
- {
- error ("function return type cannot be function");
- value_type = integer_type_node;
- }
-
- /* Make a node of the sort we want. */
- t = make_node (FUNCTION_TYPE);
- TREE_TYPE (t) = value_type;
- TYPE_ARG_TYPES (t) = arg_types;
-
- /* If we already have such a type, use the old one and free this one. */
- hashcode = TYPE_HASH (value_type) + type_hash_list (arg_types);
- t = type_hash_canon (hashcode, t);
-
- if (TYPE_SIZE (t) == 0)
- layout_type (t);
- return t;
-}
-
-/* Build the node for the type of references-to-TO_TYPE. */
-
-tree
-build_reference_type (to_type)
- tree to_type;
-{
- register tree t = TYPE_REFERENCE_TO (to_type);
- register struct obstack *ambient_obstack = current_obstack;
- register struct obstack *ambient_saveable_obstack = saveable_obstack;
-
- /* First, if we already have a type for pointers to TO_TYPE, use it. */
-
- if (t)
- return t;
-
- /* We need a new one. If TO_TYPE is permanent, make this permanent too. */
- if (TREE_PERMANENT (to_type))
- {
- current_obstack = &permanent_obstack;
- saveable_obstack = &permanent_obstack;
- }
-
- t = make_node (REFERENCE_TYPE);
- TREE_TYPE (t) = to_type;
-
- /* Record this type as the pointer to TO_TYPE. */
- TYPE_REFERENCE_TO (to_type) = t;
-
- layout_type (t);
-
- current_obstack = ambient_obstack;
- saveable_obstack = ambient_saveable_obstack;
- return t;
-}
-
-/* Construct, lay out and return the type of methods belonging to class
- BASETYPE and whose arguments and values are described by TYPE.
- If that type exists already, reuse it.
- TYPE must be a FUNCTION_TYPE node. */
-
-tree
-build_method_type (basetype, type)
- tree basetype, type;
-{
- register tree t;
- int hashcode;
-
- /* Make a node of the sort we want. */
- t = make_node (METHOD_TYPE);
-
- if (TREE_CODE (type) != FUNCTION_TYPE)
- abort ();
-
- TYPE_METHOD_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype);
- TREE_TYPE (t) = TREE_TYPE (type);
-
- /* The actual arglist for this function includes a "hidden" argument
- which is "this". Put it into the list of argument types. */
-
- TYPE_ARG_TYPES (t)
- = tree_cons (NULL_TREE,
- build_pointer_type (basetype), TYPE_ARG_TYPES (type));
-
- /* If we already have such a type, use the old one and free this one. */
- hashcode = TYPE_HASH (basetype) + TYPE_HASH (type);
- t = type_hash_canon (hashcode, t);
-
- if (TYPE_SIZE (t) == 0)
- layout_type (t);
-
- return t;
-}
-
-/* Construct, lay out and return the type of offsets to a value
- of type TYPE, within an object of type BASETYPE.
- If a suitable offset type exists already, reuse it. */
-
-tree
-build_offset_type (basetype, type)
- tree basetype, type;
-{
- register tree t;
- int hashcode;
-
- /* Make a node of the sort we want. */
- t = make_node (OFFSET_TYPE);
-
- TYPE_OFFSET_BASETYPE (t) = TYPE_MAIN_VARIANT (basetype);
- TREE_TYPE (t) = type;
-
- /* If we already have such a type, use the old one and free this one. */
- hashcode = TYPE_HASH (basetype) + TYPE_HASH (type);
- t = type_hash_canon (hashcode, t);
-
- if (TYPE_SIZE (t) == 0)
- layout_type (t);
-
- return t;
-}
-
-/* Create a complex type whose components are COMPONENT_TYPE. */
-
-tree
-build_complex_type (component_type)
- tree component_type;
-{
- register tree t;
- int hashcode;
-
- /* Make a node of the sort we want. */
- t = make_node (COMPLEX_TYPE);
-
- TREE_TYPE (t) = TYPE_MAIN_VARIANT (component_type);
- TYPE_VOLATILE (t) = TYPE_VOLATILE (component_type);
- TYPE_READONLY (t) = TYPE_READONLY (component_type);
-
- /* If we already have such a type, use the old one and free this one. */
- hashcode = TYPE_HASH (component_type);
- t = type_hash_canon (hashcode, t);
-
- if (TYPE_SIZE (t) == 0)
- layout_type (t);
-
- return t;
-}
-
-/* Return OP, stripped of any conversions to wider types as much as is safe.
- Converting the value back to OP's type makes a value equivalent to OP.
-
- If FOR_TYPE is nonzero, we return a value which, if converted to
- type FOR_TYPE, would be equivalent to converting OP to type FOR_TYPE.
-
- If FOR_TYPE is nonzero, unaligned bit-field references may be changed to the
- narrowest type that can hold the value, even if they don't exactly fit.
- Otherwise, bit-field references are changed to a narrower type
- only if they can be fetched directly from memory in that type.
-
- OP must have integer, real or enumeral type. Pointers are not allowed!
-
- There are some cases where the obvious value we could return
- would regenerate to OP if converted to OP's type,
- but would not extend like OP to wider types.
- If FOR_TYPE indicates such extension is contemplated, we eschew such values.
- For example, if OP is (unsigned short)(signed char)-1,
- we avoid returning (signed char)-1 if FOR_TYPE is int,
- even though extending that to an unsigned short would regenerate OP,
- since the result of extending (signed char)-1 to (int)
- is different from (int) OP. */
-
-tree
-get_unwidened (op, for_type)
- register tree op;
- tree for_type;
-{
- /* Set UNS initially if converting OP to FOR_TYPE is a zero-extension. */
- /* TYPE_PRECISION is safe in place of type_precision since
- pointer types are not allowed. */
- register tree type = TREE_TYPE (op);
- register unsigned final_prec
- = TYPE_PRECISION (for_type != 0 ? for_type : type);
- register int uns
- = (for_type != 0 && for_type != type
- && final_prec > TYPE_PRECISION (type)
- && TREE_UNSIGNED (type));
- register tree win = op;
-
- while (TREE_CODE (op) == NOP_EXPR)
- {
- register int bitschange
- = TYPE_PRECISION (TREE_TYPE (op))
- - TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op, 0)));
-
- /* Truncations are many-one so cannot be removed.
- Unless we are later going to truncate down even farther. */
- if (bitschange < 0
- && final_prec > TYPE_PRECISION (TREE_TYPE (op)))
- break;
-
- /* See what's inside this conversion. If we decide to strip it,
- we will set WIN. */
- op = TREE_OPERAND (op, 0);
-
- /* If we have not stripped any zero-extensions (uns is 0),
- we can strip any kind of extension.
- If we have previously stripped a zero-extension,
- only zero-extensions can safely be stripped.
- Any extension can be stripped if the bits it would produce
- are all going to be discarded later by truncating to FOR_TYPE. */
-
- if (bitschange > 0)
- {
- if (! uns || final_prec <= TYPE_PRECISION (TREE_TYPE (op)))
- win = op;
- /* TREE_UNSIGNED says whether this is a zero-extension.
- Let's avoid computing it if it does not affect WIN
- and if UNS will not be needed again. */
- if ((uns || TREE_CODE (op) == NOP_EXPR)
- && TREE_UNSIGNED (TREE_TYPE (op)))
- {
- uns = 1;
- win = op;
- }
- }
- }
-
- if (TREE_CODE (op) == COMPONENT_REF
- /* Since type_for_size always gives an integer type. */
- && TREE_CODE (type) != REAL_TYPE
- /* Don't crash if field not layed out yet. */
- && DECL_SIZE (TREE_OPERAND (op, 1)) != 0)
- {
- unsigned innerprec = TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (op, 1)));
- type = type_for_size (innerprec, TREE_UNSIGNED (TREE_OPERAND (op, 1)));
-
- /* We can get this structure field in the narrowest type it fits in.
- If FOR_TYPE is 0, do this only for a field that matches the
- narrower type exactly and is aligned for it
- The resulting extension to its nominal type (a fullword type)
- must fit the same conditions as for other extensions. */
-
- if (innerprec < TYPE_PRECISION (TREE_TYPE (op))
- && (for_type || ! DECL_BIT_FIELD (TREE_OPERAND (op, 1)))
- && (! uns || final_prec <= innerprec
- || TREE_UNSIGNED (TREE_OPERAND (op, 1)))
- && type != 0)
- {
- win = build (COMPONENT_REF, type, TREE_OPERAND (op, 0),
- TREE_OPERAND (op, 1));
- TREE_SIDE_EFFECTS (win) = TREE_SIDE_EFFECTS (op);
- TREE_THIS_VOLATILE (win) = TREE_THIS_VOLATILE (op);
- TREE_RAISES (win) = TREE_RAISES (op);
- }
- }
- return win;
-}
-
-/* Return OP or a simpler expression for a narrower value
- which can be sign-extended or zero-extended to give back OP.
- Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended
- or 0 if the value should be sign-extended. */
-
-tree
-get_narrower (op, unsignedp_ptr)
- register tree op;
- int *unsignedp_ptr;
-{
- register int uns = 0;
- int first = 1;
- register tree win = op;
-
- while (TREE_CODE (op) == NOP_EXPR)
- {
- register int bitschange
- = TYPE_PRECISION (TREE_TYPE (op))
- - TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op, 0)));
-
- /* Truncations are many-one so cannot be removed. */
- if (bitschange < 0)
- break;
-
- /* See what's inside this conversion. If we decide to strip it,
- we will set WIN. */
- op = TREE_OPERAND (op, 0);
-
- if (bitschange > 0)
- {
- /* An extension: the outermost one can be stripped,
- but remember whether it is zero or sign extension. */
- if (first)
- uns = TREE_UNSIGNED (TREE_TYPE (op));
- /* Otherwise, if a sign extension has been stripped,
- only sign extensions can now be stripped;
- if a zero extension has been stripped, only zero-extensions. */
- else if (uns != TREE_UNSIGNED (TREE_TYPE (op)))
- break;
- first = 0;
- }
- else /* bitschange == 0 */
- {
- /* A change in nominal type can always be stripped, but we must
- preserve the unsignedness. */
- if (first)
- uns = TREE_UNSIGNED (TREE_TYPE (op));
- first = 0;
- }
-
- win = op;
- }
-
- if (TREE_CODE (op) == COMPONENT_REF
- /* Since type_for_size always gives an integer type. */
- && TREE_CODE (TREE_TYPE (op)) != REAL_TYPE)
- {
- unsigned innerprec = TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (op, 1)));
- tree type = type_for_size (innerprec, TREE_UNSIGNED (op));
-
- /* We can get this structure field in a narrower type that fits it,
- but the resulting extension to its nominal type (a fullword type)
- must satisfy the same conditions as for other extensions.
-
- Do this only for fields that are aligned (not bit-fields),
- because when bit-field insns will be used there is no
- advantage in doing this. */
-
- if (innerprec < TYPE_PRECISION (TREE_TYPE (op))
- && ! DECL_BIT_FIELD (TREE_OPERAND (op, 1))
- && (first || uns == TREE_UNSIGNED (TREE_OPERAND (op, 1)))
- && type != 0)
- {
- if (first)
- uns = TREE_UNSIGNED (TREE_OPERAND (op, 1));
- win = build (COMPONENT_REF, type, TREE_OPERAND (op, 0),
- TREE_OPERAND (op, 1));
- TREE_SIDE_EFFECTS (win) = TREE_SIDE_EFFECTS (op);
- TREE_THIS_VOLATILE (win) = TREE_THIS_VOLATILE (op);
- TREE_RAISES (win) = TREE_RAISES (op);
- }
- }
- *unsignedp_ptr = uns;
- return win;
-}
-
-/* Return the precision of a type, for arithmetic purposes.
- Supports all types on which arithmetic is possible
- (including pointer types).
- It's not clear yet what will be right for complex types. */
-
-int
-type_precision (type)
- register tree type;
-{
- return ((TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE
- || TREE_CODE (type) == REAL_TYPE)
- ? TYPE_PRECISION (type) : POINTER_SIZE);
-}
-
-/* Nonzero if integer constant C has a value that is permissible
- for type TYPE (an INTEGER_TYPE). */
-
-int
-int_fits_type_p (c, type)
- tree c, type;
-{
- if (TREE_UNSIGNED (type))
- return (! (TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
- && INT_CST_LT_UNSIGNED (TYPE_MAX_VALUE (type), c))
- && ! (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
- && INT_CST_LT_UNSIGNED (c, TYPE_MIN_VALUE (type))));
- else
- return (! (TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
- && INT_CST_LT (TYPE_MAX_VALUE (type), c))
- && ! (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
- && INT_CST_LT (c, TYPE_MIN_VALUE (type))));
-}
-
-/* Return the innermost context enclosing DECL that is
- a FUNCTION_DECL, or zero if none. */
-
-tree
-decl_function_context (decl)
- tree decl;
-{
- tree context;
-
- if (TREE_CODE (decl) == ERROR_MARK)
- return 0;
-
- if (TREE_CODE (decl) == SAVE_EXPR)
- context = SAVE_EXPR_CONTEXT (decl);
- else
- context = DECL_CONTEXT (decl);
-
- while (context && TREE_CODE (context) != FUNCTION_DECL)
- {
- if (TREE_CODE (context) == RECORD_TYPE
- || TREE_CODE (context) == UNION_TYPE
- || TREE_CODE (context) == QUAL_UNION_TYPE)
- context = TYPE_CONTEXT (context);
- else if (TREE_CODE (context) == TYPE_DECL)
- context = DECL_CONTEXT (context);
- else if (TREE_CODE (context) == BLOCK)
- context = BLOCK_SUPERCONTEXT (context);
- else
- /* Unhandled CONTEXT !? */
- abort ();
- }
-
- return context;
-}
-
-/* Return the innermost context enclosing DECL that is
- a RECORD_TYPE, UNION_TYPE or QUAL_UNION_TYPE, or zero if none.
- TYPE_DECLs and FUNCTION_DECLs are transparent to this function. */
-
-tree
-decl_type_context (decl)
- tree decl;
-{
- tree context = DECL_CONTEXT (decl);
-
- while (context)
- {
- if (TREE_CODE (context) == RECORD_TYPE
- || TREE_CODE (context) == UNION_TYPE
- || TREE_CODE (context) == QUAL_UNION_TYPE)
- return context;
- if (TREE_CODE (context) == TYPE_DECL
- || TREE_CODE (context) == FUNCTION_DECL)
- context = DECL_CONTEXT (context);
- else if (TREE_CODE (context) == BLOCK)
- context = BLOCK_SUPERCONTEXT (context);
- else
- /* Unhandled CONTEXT!? */
- abort ();
- }
- return NULL_TREE;
-}
-
-void
-print_obstack_statistics (str, o)
- char *str;
- struct obstack *o;
-{
- struct _obstack_chunk *chunk = o->chunk;
- int n_chunks = 0;
- int n_alloc = 0;
-
- while (chunk)
- {
- n_chunks += 1;
- n_alloc += chunk->limit - &chunk->contents[0];
- chunk = chunk->prev;
- }
- fprintf (stderr, "obstack %s: %d bytes, %d chunks\n",
- str, n_alloc, n_chunks);
-}
-void
-dump_tree_statistics ()
-{
- int i;
- int total_nodes, total_bytes;
-
- fprintf (stderr, "\n??? tree nodes created\n\n");
-#ifdef GATHER_STATISTICS
- fprintf (stderr, "Kind Nodes Bytes\n");
- fprintf (stderr, "-------------------------------------\n");
- total_nodes = total_bytes = 0;
- for (i = 0; i < (int) all_kinds; i++)
- {
- fprintf (stderr, "%-20s %6d %9d\n", tree_node_kind_names[i],
- tree_node_counts[i], tree_node_sizes[i]);
- total_nodes += tree_node_counts[i];
- total_bytes += tree_node_sizes[i];
- }
- fprintf (stderr, "%-20s %9d\n", "identifier names", id_string_size);
- fprintf (stderr, "-------------------------------------\n");
- fprintf (stderr, "%-20s %6d %9d\n", "Total", total_nodes, total_bytes);
- fprintf (stderr, "-------------------------------------\n");
-#else
- fprintf (stderr, "(No per-node statistics)\n");
-#endif
- print_lang_statistics ();
-}
-
-#define FILE_FUNCTION_PREFIX_LEN 9
-
-#ifndef NO_DOLLAR_IN_LABEL
-#define FILE_FUNCTION_FORMAT "_GLOBAL_$D$%s"
-#else /* NO_DOLLAR_IN_LABEL */
-#ifndef NO_DOT_IN_LABEL
-#define FILE_FUNCTION_FORMAT "_GLOBAL_.D.%s"
-#else /* NO_DOT_IN_LABEL */
-#define FILE_FUNCTION_FORMAT "_GLOBAL__D_%s"
-#endif /* NO_DOT_IN_LABEL */
-#endif /* NO_DOLLAR_IN_LABEL */
-
-extern char * first_global_object_name;
-
-/* If KIND=='I', return a suitable global initializer (constructor) name.
- If KIND=='D', return a suitable global clean-up (destructor) name. */
-
-tree
-get_file_function_name (kind)
- int kind;
-{
- char *buf;
- register char *p;
-
- if (first_global_object_name)
- p = first_global_object_name;
- else if (main_input_filename)
- p = main_input_filename;
- else
- p = input_filename;
-
- buf = (char *) alloca (sizeof (FILE_FUNCTION_FORMAT) + strlen (p));
-
- /* Set up the name of the file-level functions we may need. */
- /* Use a global object (which is already required to be unique over
- the program) rather than the file name (which imposes extra
- constraints). -- Raeburn@MIT.EDU, 10 Jan 1990. */
- sprintf (buf, FILE_FUNCTION_FORMAT, p);
-
- /* Don't need to pull weird characters out of global names. */
- if (p != first_global_object_name)
- {
- for (p = buf+11; *p; p++)
- if (! ((*p >= '0' && *p <= '9')
-#if 0 /* we always want labels, which are valid C++ identifiers (+ `$') */
-#ifndef ASM_IDENTIFY_GCC /* this is required if `.' is invalid -- k. raeburn */
- || *p == '.'
-#endif
-#endif
-#ifndef NO_DOLLAR_IN_LABEL /* this for `$'; unlikely, but... -- kr */
- || *p == '$'
-#endif
-#ifndef NO_DOT_IN_LABEL /* this for `.'; unlikely, but... */
- || *p == '.'
-#endif
- || (*p >= 'A' && *p <= 'Z')
- || (*p >= 'a' && *p <= 'z')))
- *p = '_';
- }
-
- buf[FILE_FUNCTION_PREFIX_LEN] = kind;
-
- return get_identifier (buf);
-}
-
-/* Expand (the constant part of) a SET_TYPE CONSTRUCTOR node.
- The result is placed in BUFFER (which has length BIT_SIZE),
- with one bit in each char ('\000' or '\001').
-
- If the constructor is constant, NULL_TREE is returned.
- Otherwise, a TREE_LIST of the non-constant elements is emitted. */
-
-tree
-get_set_constructor_bits (init, buffer, bit_size)
- tree init;
- char *buffer;
- int bit_size;
-{
- int i;
- tree vals;
- HOST_WIDE_INT domain_min
- = TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (init))));
- tree non_const_bits = NULL_TREE;
- for (i = 0; i < bit_size; i++)
- buffer[i] = 0;
-
- for (vals = TREE_OPERAND (init, 1);
- vals != NULL_TREE; vals = TREE_CHAIN (vals))
- {
- if (TREE_CODE (TREE_VALUE (vals)) != INTEGER_CST
- || (TREE_PURPOSE (vals) != NULL_TREE
- && TREE_CODE (TREE_PURPOSE (vals)) != INTEGER_CST))
- non_const_bits =
- tree_cons (TREE_PURPOSE (vals), TREE_VALUE (vals), non_const_bits);
- else if (TREE_PURPOSE (vals) != NULL_TREE)
- {
- /* Set a range of bits to ones. */
- HOST_WIDE_INT lo_index
- = TREE_INT_CST_LOW (TREE_PURPOSE (vals)) - domain_min;
- HOST_WIDE_INT hi_index
- = TREE_INT_CST_LOW (TREE_VALUE (vals)) - domain_min;
- if (lo_index < 0 || lo_index >= bit_size
- || hi_index < 0 || hi_index >= bit_size)
- abort ();
- for ( ; lo_index <= hi_index; lo_index++)
- buffer[lo_index] = 1;
- }
- else
- {
- /* Set a single bit to one. */
- HOST_WIDE_INT index
- = TREE_INT_CST_LOW (TREE_VALUE (vals)) - domain_min;
- if (index < 0 || index >= bit_size)
- {
- error ("invalid initializer for bit string");
- return NULL_TREE;
- }
- buffer[index] = 1;
- }
- }
- return non_const_bits;
-}
-
-/* Expand (the constant part of) a SET_TYPE CONSTRUCTOR node.
- The result is placed in BUFFER (which is an array of bytes).
- If the constructor is constant, NULL_TREE is returned.
- Otherwise, a TREE_LIST of the non-constant elements is emitted. */
-
-tree
-get_set_constructor_bytes (init, buffer, wd_size)
- tree init;
- unsigned char *buffer;
- int wd_size;
-{
- int i;
- tree vals = TREE_OPERAND (init, 1);
- int set_word_size = BITS_PER_UNIT;
- int bit_size = wd_size * set_word_size;
- int bit_pos = 0;
- unsigned char *bytep = buffer;
- char *bit_buffer = (char *) alloca(bit_size);
- tree non_const_bits = get_set_constructor_bits (init, bit_buffer, bit_size);
-
- for (i = 0; i < wd_size; i++)
- buffer[i] = 0;
-
- for (i = 0; i < bit_size; i++)
- {
- if (bit_buffer[i])
- {
- if (BYTES_BIG_ENDIAN)
- *bytep |= (1 << (set_word_size - 1 - bit_pos));
- else
- *bytep |= 1 << bit_pos;
- }
- bit_pos++;
- if (bit_pos >= set_word_size)
- bit_pos = 0, bytep++;
- }
- return non_const_bits;
-}
diff --git a/gcc/tree.def b/gcc/tree.def
deleted file mode 100644
index 8ba266a4efa..00000000000
--- a/gcc/tree.def
+++ /dev/null
@@ -1,725 +0,0 @@
-/* This file contains the definitions and documentation for the
- tree codes used in the GNU C compiler.
- Copyright (C) 1987, 1988, 1993, 1995 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. */
-
-
-/* The third argument can be:
- "x" for an exceptional code (fits no category).
- "t" for a type object code.
- "b" for a lexical block.
- "c" for codes for constants.
- "d" for codes for declarations (also serving as variable refs).
- "r" for codes for references to storage.
- "<" for codes for comparison expressions.
- "1" for codes for unary arithmetic expressions.
- "2" for codes for binary arithmetic expressions.
- "s" for codes for expressions with inherent side effects.
- "e" for codes for other kinds of expressions. */
-
-/* For `r', `e', `<', `1', `2', `s' and `x' nodes,
- the 4th element is the number of argument slots to allocate.
- This determines the size of the tree node object. */
-
-/* Any erroneous construct is parsed into a node of this type.
- This type of node is accepted without complaint in all contexts
- by later parsing activities, to avoid multiple error messages
- for one error.
- No fields in these nodes are used except the TREE_CODE. */
-DEFTREECODE (ERROR_MARK, "error_mark", "x", 0)
-
-/* Used to represent a name (such as, in the DECL_NAME of a decl node).
- Internally it looks like a STRING_CST node.
- There is only one IDENTIFIER_NODE ever made for any particular name.
- Use `get_identifier' to get it (or create it, the first time). */
-DEFTREECODE (IDENTIFIER_NODE, "identifier_node", "x", -1)
-
-/* Used to hold information to identify an operator (or combination
- of two operators) considered as a `noun' rather than a `verb'.
- The first operand is encoded in the TREE_TYPE field. */
-DEFTREECODE (OP_IDENTIFIER, "op_identifier", "x", 2)
-
-/* Has the TREE_VALUE and TREE_PURPOSE fields. */
-/* These nodes are made into lists by chaining through the
- TREE_CHAIN field. The elements of the list live in the
- TREE_VALUE fields, while TREE_PURPOSE fields are occasionally
- used as well to get the effect of Lisp association lists. */
-DEFTREECODE (TREE_LIST, "tree_list", "x", 2)
-
-/* These nodes contain an array of tree nodes. */
-DEFTREECODE (TREE_VEC, "tree_vec", "x", 2)
-
-/* A symbol binding block. These are arranged in a tree,
- where the BLOCK_SUBBLOCKS field contains a chain of subblocks
- chained through the BLOCK_CHAIN field.
- BLOCK_SUPERCONTEXT points to the parent block.
- For a block which represents the outermost scope of a function, it
- points to the FUNCTION_DECL node.
- BLOCK_VARS points to a chain of decl nodes.
- BLOCK_TYPE_TAGS points to a chain of types which have their own names.
- BLOCK_CHAIN points to the next BLOCK at the same level.
- BLOCK_ABSTRACT_ORIGIN points to the original (abstract) tree node which
- this block is an instance of, or else is NULL to indicate that this
- block is not an instance of anything else. When non-NULL, the value
- could either point to another BLOCK node or it could point to a
- FUNCTION_DECL node (e.g. in the case of a block representing the
- outermost scope of a particular inlining of a function).
- BLOCK_ABSTRACT is non-zero if the block represents an abstract
- instance of a block (i.e. one which is nested within an abstract
- instance of a inline function. */
-DEFTREECODE (BLOCK, "block", "b", 0)
-
-/* Each data type is represented by a tree node whose code is one of
- the following: */
-/* Each node that represents a data type has a component TYPE_SIZE
- containing a tree that is an expression for the size in bits.
- The TYPE_MODE contains the machine mode for values of this type.
- The TYPE_POINTER_TO field contains a type for a pointer to this type,
- or zero if no such has been created yet.
- The TYPE_NEXT_VARIANT field is used to chain together types
- that are variants made by type modifiers such as "const" and "volatile".
- The TYPE_MAIN_VARIANT field, in any member of such a chain,
- points to the start of the chain.
- The TYPE_NONCOPIED_PARTS field is a list specifying which parts
- of an object of this type should *not* be copied by assignment.
- The TREE_PURPOSE of each element is the offset of the part
- and the TREE_VALUE is the size in bits of the part.
- The TYPE_NAME field contains info on the name used in the program
- for this type (for GDB symbol table output). It is either a
- TYPE_DECL node, for types that are typedefs, or an IDENTIFIER_NODE
- in the case of structs, unions or enums that are known with a tag,
- or zero for types that have no special name.
- The TYPE_CONTEXT for any sort of type which could have a name or
- which could have named members (e.g. tagged types in C/C++) will
- point to the node which represents the scope of the given type, or
- will be NULL_TREE if the type has "file scope". For most types, this
- will point to a BLOCK node or a FUNCTION_DECL node, but it could also
- point to a FUNCTION_TYPE node (for types whose scope is limited to the
- formal parameter list of some function type specification) or it
- could point to a RECORD_TYPE, UNION_TYPE or QUAL_UNION_TYPE node
- (for C++ "member" types).
- For non-tagged-types, TYPE_CONTEXT need not be set to anything in
- particular, since any type which is of some type category (e.g.
- an array type or a function type) which cannot either have a name
- itself or have named members doesn't really have a "scope" per se.
- The TREE_CHAIN field is used as a forward-references to names for
- ENUMERAL_TYPE, RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE nodes;
- see below. */
-
-DEFTREECODE (VOID_TYPE, "void_type", "t", 0) /* The void type in C */
-
-/* Integer types in all languages, including char in C.
- Also used for sub-ranges of other discrete types.
- Has components TYPE_MIN_VALUE, TYPE_MAX_VALUE (expressions, inclusive)
- and TYPE_PRECISION (number of bits used by this type).
- In the case of a subrange type in Pascal, the TREE_TYPE
- of this will point at the supertype (another INTEGER_TYPE,
- or an ENUMERAL_TYPE, CHAR_TYPE, or BOOLEAN_TYPE).
- Otherwise, the TREE_TYPE is zero. */
-DEFTREECODE (INTEGER_TYPE, "integer_type", "t", 0)
-
-/* C's float and double. Different floating types are distinguished
- by machine mode and by the TYPE_SIZE and the TYPE_PRECISION. */
-DEFTREECODE (REAL_TYPE, "real_type", "t", 0)
-
-/* Complex number types. The TREE_TYPE field is the data type
- of the real and imaginary parts. */
-DEFTREECODE (COMPLEX_TYPE, "complex_type", "t", 0)
-
-/* C enums. The type node looks just like an INTEGER_TYPE node.
- The symbols for the values of the enum type are defined by
- CONST_DECL nodes, but the type does not point to them;
- however, the TYPE_VALUES is a list in which each element's TREE_PURPOSE
- is a name and the TREE_VALUE is the value (an INTEGER_CST node). */
-/* A forward reference `enum foo' when no enum named foo is defined yet
- has zero (a null pointer) in its TYPE_SIZE. The tag name is in
- the TYPE_NAME field. If the type is later defined, the normal
- fields are filled in.
- RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE forward refs are
- treated similarly. */
-DEFTREECODE (ENUMERAL_TYPE, "enumeral_type", "t", 0)
-
-/* Pascal's boolean type (true or false are the only values);
- no special fields needed. */
-DEFTREECODE (BOOLEAN_TYPE, "boolean_type", "t", 0)
-
-/* CHAR in Pascal; not used in C.
- No special fields needed. */
-DEFTREECODE (CHAR_TYPE, "char_type", "t", 0)
-
-/* All pointer-to-x types have code POINTER_TYPE.
- The TREE_TYPE points to the node for the type pointed to. */
-DEFTREECODE (POINTER_TYPE, "pointer_type", "t", 0)
-
-/* An offset is a pointer relative to an object.
- The TREE_TYPE field is the type of the object at the offset.
- The TYPE_OFFSET_BASETYPE points to the node for the type of object
- that the offset is relative to. */
-DEFTREECODE (OFFSET_TYPE, "offset_type", "t", 0)
-
-/* A reference is like a pointer except that it is coerced
- automatically to the value it points to. Used in C++. */
-DEFTREECODE (REFERENCE_TYPE, "reference_type", "t", 0)
-
-/* METHOD_TYPE is the type of a function which takes an extra first
- argument for "self", which is not present in the declared argument list.
- The TREE_TYPE is the return type of the method. The TYPE_METHOD_BASETYPE
- is the type of "self". TYPE_ARG_TYPES is the real argument list, which
- includes the hidden argument for "self". */
-DEFTREECODE (METHOD_TYPE, "method_type", "t", 0)
-
-/* Used for Pascal; details not determined right now. */
-DEFTREECODE (FILE_TYPE, "file_type", "t", 0)
-
-/* Types of arrays. Special fields:
- TREE_TYPE Type of an array element.
- TYPE_DOMAIN Type to index by.
- Its range of values specifies the array length.
- TYPE_SEP Expression for units from one elt to the next.
- TYPE_SEP_UNIT Number of bits in a unit for previous.
- The field TYPE_POINTER_TO (TREE_TYPE (array_type)) is always nonzero
- and holds the type to coerce a value of that array type to in C.
- TYPE_STRING_FLAG indicates a string (in contrast to an array of chars)
- in languages (such as Chill) that make a distinction. */
-/* Array types in C or Pascal */
-DEFTREECODE (ARRAY_TYPE, "array_type", "t", 0)
-
-/* Types of sets for Pascal. Special fields are the same as
- in an array type. The target type is always a boolean type.
- Used for both bitstrings and powersets in Chill;
- TYPE_STRING_FLAG indicates a bitstring. */
-DEFTREECODE (SET_TYPE, "set_type", "t", 0)
-
-/* Struct in C, or record in Pascal. */
-/* Special fields:
- TYPE_FIELDS chain of FIELD_DECLs for the fields of the struct,
- and VAR_DECLs, TYPE_DECLs and CONST_DECLs for record-scope variables,
- types and enumerators.
- A few may need to be added for Pascal. */
-/* See the comment above, before ENUMERAL_TYPE, for how
- forward references to struct tags are handled in C. */
-DEFTREECODE (RECORD_TYPE, "record_type", "t", 0)
-
-/* Union in C. Like a struct, except that the offsets of the fields
- will all be zero. */
-/* See the comment above, before ENUMERAL_TYPE, for how
- forward references to union tags are handled in C. */
-DEFTREECODE (UNION_TYPE, "union_type", "t", 0) /* C union type */
-
-/* Similar to UNION_TYPE, except that the expressions in DECL_QUALIFIER
- in each FIELD_DECL determine what the union contains. The first
- field whose DECL_QUALIFIER expression is true is deemed to occupy
- the union. */
-DEFTREECODE (QUAL_UNION_TYPE, "qual_union_type", "t", 0)
-
-/* Type of functions. Special fields:
- TREE_TYPE type of value returned.
- TYPE_ARG_TYPES list of types of arguments expected.
- this list is made of TREE_LIST nodes.
- Types of "Procedures" in languages where they are different from functions
- have code FUNCTION_TYPE also, but then TREE_TYPE is zero or void type. */
-DEFTREECODE (FUNCTION_TYPE, "function_type", "t", 0)
-
-/* This is a language-specific kind of type.
- Its meaning is defined by the language front end.
- layout_type does not know how to lay this out,
- so the front-end must do so manually. */
-DEFTREECODE (LANG_TYPE, "lang_type", "t", 0)
-
-/* Expressions */
-
-/* First, the constants. */
-
-/* Contents are in TREE_INT_CST_LOW and TREE_INT_CST_HIGH fields,
- 32 bits each, giving us a 64 bit constant capability.
- Note: constants of type char in Pascal are INTEGER_CST,
- and so are pointer constants such as nil in Pascal or NULL in C.
- `(int *) 1' in C also results in an INTEGER_CST. */
-DEFTREECODE (INTEGER_CST, "integer_cst", "c", 2)
-
-/* Contents are in TREE_REAL_CST field. Also there is TREE_CST_RTL. */
-DEFTREECODE (REAL_CST, "real_cst", "c", 3)
-
-/* Contents are in TREE_REALPART and TREE_IMAGPART fields,
- whose contents are other constant nodes.
- Also there is TREE_CST_RTL. */
-DEFTREECODE (COMPLEX_CST, "complex_cst", "c", 3)
-
-/* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields.
- Also there is TREE_CST_RTL. */
-DEFTREECODE (STRING_CST, "string_cst", "c", 3)
-
-/* Declarations. All references to names are represented as ..._DECL nodes.
- The decls in one binding context are chained through the TREE_CHAIN field.
- Each DECL has a DECL_NAME field which contains an IDENTIFIER_NODE.
- (Some decls, most often labels, may have zero as the DECL_NAME).
- DECL_CONTEXT points to the node representing the context in which
- this declaration has its scope. For FIELD_DECLs, this is the
- RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE node that the field
- is a member of. For VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL,
- and CONST_DECL nodes, this points to either the FUNCTION_DECL for the
- containing function, the RECORD_TYPE or UNION_TYPE for the containing
- type, or NULL_TREE if the given decl has "file scope".
- DECL_ABSTRACT_ORIGIN, if non-NULL, points to the original (abstract)
- ..._DECL node of which this decl is an (inlined or template expanded)
- instance.
- The TREE_TYPE field holds the data type of the object, when relevant.
- LABEL_DECLs have no data type. For TYPE_DECL, the TREE_TYPE field
- contents are the type whose name is being declared.
- The DECL_ALIGN, DECL_SIZE,
- and DECL_MODE fields exist in decl nodes just as in type nodes.
- They are unused in LABEL_DECL, TYPE_DECL and CONST_DECL nodes.
-
- DECL_OFFSET holds an integer number of bits offset for the location.
- DECL_VOFFSET holds an expression for a variable offset; it is
- to be multiplied by DECL_VOFFSET_UNIT (an integer).
- These fields are relevant only in FIELD_DECLs and PARM_DECLs.
-
- DECL_INITIAL holds the value to initialize a variable to,
- or the value of a constant. For a function, it holds the body
- (a node of type BLOCK representing the function's binding contour
- and whose body contains the function's statements.) For a LABEL_DECL
- in C, it is a flag, nonzero if the label's definition has been seen.
-
- PARM_DECLs use a special field:
- DECL_ARG_TYPE is the type in which the argument is actually
- passed, which may be different from its type within the function.
-
- FUNCTION_DECLs use four special fields:
- DECL_ARGUMENTS holds a chain of PARM_DECL nodes for the arguments.
- DECL_RESULT holds a RESULT_DECL node for the value of a function,
- or it is 0 for a function that returns no value.
- (C functions returning void have zero here.)
- DECL_RESULT_TYPE holds the type in which the result is actually
- returned. This is usually the same as the type of DECL_RESULT,
- but (1) it may be a wider integer type and
- (2) it remains valid, for the sake of inlining, even after the
- function's compilation is done.
- DECL_FUNCTION_CODE is a code number that is nonzero for
- built-in functions. Its value is an enum built_in_function
- that says which built-in function it is.
-
- DECL_SOURCE_FILE holds a filename string and DECL_SOURCE_LINE
- holds a line number. In some cases these can be the location of
- a reference, if no definition has been seen.
-
- DECL_ABSTRACT is non-zero if the decl represents an abstract instance
- of a decl (i.e. one which is nested within an abstract instance of a
- inline function. */
-
-DEFTREECODE (FUNCTION_DECL, "function_decl", "d", 0)
-DEFTREECODE (LABEL_DECL, "label_decl", "d", 0)
-DEFTREECODE (CONST_DECL, "const_decl", "d", 0)
-DEFTREECODE (TYPE_DECL, "type_decl", "d", 0)
-DEFTREECODE (VAR_DECL, "var_decl", "d", 0)
-DEFTREECODE (PARM_DECL, "parm_decl", "d", 0)
-DEFTREECODE (RESULT_DECL, "result_decl", "d", 0)
-DEFTREECODE (FIELD_DECL, "field_decl", "d", 0)
-
-/* References to storage. */
-
-/* Value is structure or union component.
- Operand 0 is the structure or union (an expression);
- operand 1 is the field (a node of type FIELD_DECL). */
-DEFTREECODE (COMPONENT_REF, "component_ref", "r", 2)
-
-/* Reference to a group of bits within an object. Similar to COMPONENT_REF
- except the position is given explicitly rather than via a FIELD_DECL.
- Operand 0 is the structure or union expression;
- operand 1 is a tree giving the number of bits being referenced;
- operand 2 is a tree giving the position of the first referenced bit.
- The field can be either a signed or unsigned field;
- TREE_UNSIGNED says which. */
-DEFTREECODE (BIT_FIELD_REF, "bit_field_ref", "r", 3)
-
-/* C unary `*' or Pascal `^'. One operand, an expression for a pointer. */
-DEFTREECODE (INDIRECT_REF, "indirect_ref", "r", 1)
-
-/* Pascal `^` on a file. One operand, an expression for the file. */
-DEFTREECODE (BUFFER_REF, "buffer_ref", "r", 1)
-
-/* Array indexing in languages other than C.
- Operand 0 is the array; operand 1 is a list of indices
- stored as a chain of TREE_LIST nodes. */
-DEFTREECODE (ARRAY_REF, "array_ref", "r", 2)
-
-/* Constructor: return an aggregate value made from specified components.
- In C, this is used only for structure and array initializers.
- Also used for SET_TYPE in Chill (and potentially Pascal).
- The first "operand" is really a pointer to the RTL,
- for constant constructors only.
- The second operand is a list of component values
- made out of a chain of TREE_LIST nodes.
-
- For ARRAY_TYPE:
- The TREE_PURPOSE of each node is the corresponding index.
- If the TREE_PURPOSE is a RANGE_EXPR, it is a short-hand for many nodes,
- one for each index in the range. (If the corresponding TREE_VALUE
- has side-effects, they are evaluated once for each element. Wrap the
- value in a SAVE_EXPR if you want to evaluate side effects only once.)
-
- For RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE:
- The TREE_PURPOSE of each node is a FIELD_DECL.
-
- For SET_TYPE:
- The TREE_VALUE specifies a value (index) in the set that is true.
- If TREE_PURPOSE is non-NULL, it specifies the lower limit of a
- range of true values. Elements not listed are false (not in the set). */
-DEFTREECODE (CONSTRUCTOR, "constructor", "e", 2)
-
-/* The expression types are mostly straightforward, with the fourth argument
- of DEFTREECODE saying how many operands there are.
- Unless otherwise specified, the operands are expressions and the
- types of all the operands and the expression must all be the same. */
-
-/* Contains two expressions to compute, one followed by the other.
- the first value is ignored. The second one's value is used. The
- type of the first expression need not agree with the other types. */
-DEFTREECODE (COMPOUND_EXPR, "compound_expr", "e", 2)
-
-/* Assignment expression. Operand 0 is the what to set; 1, the new value. */
-DEFTREECODE (MODIFY_EXPR, "modify_expr", "e", 2)
-
-/* Initialization expression. Operand 0 is the variable to initialize;
- Operand 1 is the initializer. */
-DEFTREECODE (INIT_EXPR, "init_expr", "e", 2)
-
-/* For TARGET_EXPR, operand 0 is the target of an initialization,
- operand 1 is the initializer for the target,
- and operand 2 is the cleanup for this node, if any.
- and operand 3 is the saved initializer after this node has been
- expanded once, this is so we can re-expand the tree later. */
-DEFTREECODE (TARGET_EXPR, "target_expr", "e", 4)
-
-/* Conditional expression ( ... ? ... : ... in C).
- Operand 0 is the condition.
- Operand 1 is the then-value.
- Operand 2 is the else-value.
- Operand 0 may be of any types, but the types of operands 1 and 2
- must be the same and the same as the the of this expression. */
-DEFTREECODE (COND_EXPR, "cond_expr", "e", 3)
-
-/* Declare local variables, including making RTL and allocating space.
- Operand 0 is a chain of VAR_DECL nodes for the variables.
- Operand 1 is the body, the expression to be computed using
- the variables. The value of operand 1 becomes that of the BIND_EXPR.
- Operand 2 is the BLOCK that corresponds to these bindings
- for debugging purposes. If this BIND_EXPR is actually expanded,
- that sets the TREE_USED flag in the BLOCK.
-
- The BIND_EXPR is not responsible for informing parsers
- about these variables. If the body is coming from the input file,
- then the code that creates the BIND_EXPR is also responsible for
- informing the parser of the variables.
-
- If the BIND_EXPR is ever expanded, its TREE_USED flag is set.
- This tells the code for debugging symbol tables not to ignore the BIND_EXPR.
- If the BIND_EXPR should be output for debugging but will not be expanded,
- set the TREE_USED flag by hand.
-
- In order for the BIND_EXPR to be known at all, the code that creates it
- must also install it as a subblock in the tree of BLOCK
- nodes for the function. */
-DEFTREECODE (BIND_EXPR, "bind_expr", "e", 3)
-
-/* Function call. Operand 0 is the function.
- Operand 1 is the argument list, a list of expressions
- made out of a chain of TREE_LIST nodes.
- There is no operand 2. That slot is used for the
- CALL_EXPR_RTL macro (see preexpand_calls). */
-DEFTREECODE (CALL_EXPR, "call_expr", "e", 3)
-
-/* Call a method. Operand 0 is the method, whose type is a METHOD_TYPE.
- Operand 1 is the expression for "self".
- Operand 2 is the list of explicit arguments. */
-DEFTREECODE (METHOD_CALL_EXPR, "method_call_expr", "e", 4)
-
-/* Specify a value to compute along with its corresponding cleanup.
- Operand 0 argument is an expression whose value needs a cleanup.
- Operand 1 is an RTL_EXPR which will eventually represent that value.
- Operand 2 is the cleanup expression for the object.
- The RTL_EXPR is used in this expression, which is how the expression
- manages to act on the proper value.
- The cleanup is executed by the first enclosing CLEANUP_POINT_EXPR, if
- it exists, otherwise it is the responsibility of the caller to manually
- call expand_cleanups_to, as needed. */
-DEFTREECODE (WITH_CLEANUP_EXPR, "with_cleanup_expr", "e", 3)
-
-/* Specify a cleanup point.
- Operand 0 is an expression that may have cleanups. If it does, those
- cleanups are executed after the expression is expanded.
-
- Note that if the expression is a reference to storage, it is forced out
- of memory before the cleanups are run. This is necessary to handle
- cases where the cleanups modify the storage referenced; in the
- expression 't.i', if 't' is a struct with an integer member 'i' and a
- cleanup which modifies 'i', the value of the expression depends on
- whether the cleanup is run before or after 't.i' is evaluated. When
- expand_expr is run on 't.i', it returns a MEM. This is not good enough;
- the value of 't.i' must be forced out of memory.
-
- As a consequence, the operand of a CLEANUP_POINT_EXPR must not have
- BLKmode, because it will not be forced out of memory. */
-DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", "e", 1)
-
-/* The following two codes are used in languages that have types where
- the position and/or sizes of fields vary from object to object of the
- same type, i.e., where some other field in the object contains a value
- that is used in the computation of another field's offset or size.
-
- For example, a record type with a discriminant in Ada is such a type.
- This mechanism is also used to create "fat pointers" for unconstrained
- array types in Ada; the fat pointer is a structure one of whose fields is
- a pointer to the actual array type and the other field is a pointer to a
- template, which is a structure containing the bounds of the array. The
- bounds in the type pointed to by the first field in the fat pointer refer
- to the values in the template.
-
- These "self-references" are doing using a PLACEHOLDER_EXPR. This is a
- node that will later be replaced with the object being referenced. Its type
- is that of the object and selects which object to use from a chain of
- references (see below).
-
- When we wish to evaluate a size or offset, we check it is contains a
- placeholder. If it does, we construct a WITH_RECORD_EXPR that contains
- both the expression we wish to evaluate and an expression within which the
- object may be found. The latter expression is the object itself in
- the simple case of an Ada record with discriminant, but it can be the
- array in the case of an unconstrained array.
-
- In the latter case, we need the fat pointer, because the bounds of the
- array can only be accessed from it. However, we rely here on the fact that
- the expression for the array contains the dereference of the fat pointer
- that obtained the array pointer.
-
- Accordingly, when looking for the object to substitute in place of
- a PLACEHOLDER_EXPR, we look down the first operand of the expression
- passed as the second operand to WITH_RECORD_EXPR until we find something
- of the desired type or reach a constant. */
-
-/* Denotes a record to later be supplied with a WITH_RECORD_EXPR when
- evaluating this expression. The type of this expression is used to
- find the record to replace it. */
-DEFTREECODE (PLACEHOLDER_EXPR, "placeholder_expr", "x", 0)
-
-/* Provide an expression that references a record to be used in place
- of a PLACEHOLDER_EXPR. The record to be used is the record within
- operand 1 that has the same type as the PLACEHOLDER_EXPR in
- operand 0. */
-DEFTREECODE (WITH_RECORD_EXPR, "with_record_expr", "e", 2)
-
-/* Simple arithmetic. */
-DEFTREECODE (PLUS_EXPR, "plus_expr", "2", 2)
-DEFTREECODE (MINUS_EXPR, "minus_expr", "2", 2)
-DEFTREECODE (MULT_EXPR, "mult_expr", "2", 2)
-
-/* Division for integer result that rounds the quotient toward zero. */
-DEFTREECODE (TRUNC_DIV_EXPR, "trunc_div_expr", "2", 2)
-
-/* Division for integer result that rounds the quotient toward infinity. */
-DEFTREECODE (CEIL_DIV_EXPR, "ceil_div_expr", "2", 2)
-
-/* Division for integer result that rounds toward minus infinity. */
-DEFTREECODE (FLOOR_DIV_EXPR, "floor_div_expr", "2", 2)
-
-/* Division for integer result that rounds toward nearest integer. */
-DEFTREECODE (ROUND_DIV_EXPR, "round_div_expr", "2", 2)
-
-/* Four kinds of remainder that go with the four kinds of division. */
-DEFTREECODE (TRUNC_MOD_EXPR, "trunc_mod_expr", "2", 2)
-DEFTREECODE (CEIL_MOD_EXPR, "ceil_mod_expr", "2", 2)
-DEFTREECODE (FLOOR_MOD_EXPR, "floor_mod_expr", "2", 2)
-DEFTREECODE (ROUND_MOD_EXPR, "round_mod_expr", "2", 2)
-
-/* Division for real result. */
-DEFTREECODE (RDIV_EXPR, "rdiv_expr", "2", 2)
-
-/* Division which is not supposed to need rounding.
- Used for pointer subtraction in C. */
-DEFTREECODE (EXACT_DIV_EXPR, "exact_div_expr", "2", 2)
-
-/* Conversion of real to fixed point: four ways to round,
- like the four ways to divide.
- CONVERT_EXPR can also be used to convert a real to an integer,
- and that is what is used in languages that do not have ways of
- specifying which of these is wanted. Maybe these are not needed. */
-DEFTREECODE (FIX_TRUNC_EXPR, "fix_trunc_expr", "1", 1)
-DEFTREECODE (FIX_CEIL_EXPR, "fix_ceil_expr", "1", 1)
-DEFTREECODE (FIX_FLOOR_EXPR, "fix_floor_expr", "1", 1)
-DEFTREECODE (FIX_ROUND_EXPR, "fix_round_expr", "1", 1)
-
-/* Conversion of an integer to a real. */
-DEFTREECODE (FLOAT_EXPR, "float_expr", "1", 1)
-
-/* Exponentiation. Operands may have any types;
- constraints on value type are not known yet. */
-DEFTREECODE (EXPON_EXPR, "expon_expr", "2", 2)
-
-/* Unary negation. */
-DEFTREECODE (NEGATE_EXPR, "negate_expr", "1", 1)
-
-DEFTREECODE (MIN_EXPR, "min_expr", "2", 2)
-DEFTREECODE (MAX_EXPR, "max_expr", "2", 2)
-DEFTREECODE (ABS_EXPR, "abs_expr", "1", 1)
-DEFTREECODE (FFS_EXPR, "ffs_expr", "1", 1)
-
-/* Shift operations for shift and rotate.
- Shift is supposed to mean logical shift if done on an
- unsigned type, arithmetic shift on a signed type.
- The second operand is the number of bits to
- shift by; it need not be the same type as the first operand and result. */
-DEFTREECODE (LSHIFT_EXPR, "lshift_expr", "2", 2)
-DEFTREECODE (RSHIFT_EXPR, "rshift_expr", "2", 2)
-DEFTREECODE (LROTATE_EXPR, "lrotate_expr", "2", 2)
-DEFTREECODE (RROTATE_EXPR, "rrotate_expr", "2", 2)
-
-/* Bitwise operations. Operands have same mode as result. */
-DEFTREECODE (BIT_IOR_EXPR, "bit_ior_expr", "2", 2)
-DEFTREECODE (BIT_XOR_EXPR, "bit_xor_expr", "2", 2)
-DEFTREECODE (BIT_AND_EXPR, "bit_and_expr", "2", 2)
-DEFTREECODE (BIT_ANDTC_EXPR, "bit_andtc_expr", "2", 2)
-DEFTREECODE (BIT_NOT_EXPR, "bit_not_expr", "1", 1)
-
-/* Combination of boolean values or of integers considered only
- as zero or nonzero. ANDIF and ORIF allow the second operand
- not to be computed if the value of the expression is determined
- from the first operand. AND, OR, and XOR always compute the second
- operand whether its value is needed or not (for side effects). */
-DEFTREECODE (TRUTH_ANDIF_EXPR, "truth_andif_expr", "e", 2)
-DEFTREECODE (TRUTH_ORIF_EXPR, "truth_orif_expr", "e", 2)
-DEFTREECODE (TRUTH_AND_EXPR, "truth_and_expr", "e", 2)
-DEFTREECODE (TRUTH_OR_EXPR, "truth_or_expr", "e", 2)
-DEFTREECODE (TRUTH_XOR_EXPR, "truth_xor_expr", "e", 2)
-DEFTREECODE (TRUTH_NOT_EXPR, "truth_not_expr", "e", 1)
-
-/* Relational operators.
- `EQ_EXPR' and `NE_EXPR' are allowed for any types.
- The others are allowed only for integer (or pointer or enumeral)
- or real types.
- In all cases the operands will have the same type,
- and the value is always the type used by the language for booleans. */
-DEFTREECODE (LT_EXPR, "lt_expr", "<", 2)
-DEFTREECODE (LE_EXPR, "le_expr", "<", 2)
-DEFTREECODE (GT_EXPR, "gt_expr", "<", 2)
-DEFTREECODE (GE_EXPR, "ge_expr", "<", 2)
-DEFTREECODE (EQ_EXPR, "eq_expr", "<", 2)
-DEFTREECODE (NE_EXPR, "ne_expr", "<", 2)
-
-/* Operations for Pascal sets. Not used now. */
-DEFTREECODE (IN_EXPR, "in_expr", "2", 2)
-DEFTREECODE (SET_LE_EXPR, "set_le_expr", "<", 2)
-DEFTREECODE (CARD_EXPR, "card_expr", "1", 1)
-DEFTREECODE (RANGE_EXPR, "range_expr", "2", 2)
-
-/* Represents a conversion of type of a value.
- All conversions, including implicit ones, must be
- represented by CONVERT_EXPR or NOP_EXPR nodes. */
-DEFTREECODE (CONVERT_EXPR, "convert_expr", "1", 1)
-
-/* Represents a conversion expected to require no code to be generated. */
-DEFTREECODE (NOP_EXPR, "nop_expr", "1", 1)
-
-/* Value is same as argument, but guaranteed not an lvalue. */
-DEFTREECODE (NON_LVALUE_EXPR, "non_lvalue_expr", "1", 1)
-
-/* Represents something we computed once and will use multiple times.
- First operand is that expression. Second is the function decl
- in which the SAVE_EXPR was created. The third operand is the RTL,
- nonzero only after the expression has been computed. */
-DEFTREECODE (SAVE_EXPR, "save_expr", "e", 3)
-
-/* For a UNSAVE_EXPR, operand 0 is the value to unsave. By unsave, we
- mean that all _EXPRs such as TARGET_EXPRs, SAVE_EXPRs,
- CALL_EXPRs and RTL_EXPRs, that are protected
- from being evaluated more than once should be reset so that a new
- expand_expr call of this expr will cause those to be re-evaluated.
- This is useful when we want to reuse a tree in different places,
- but where we must re-expand. */
-DEFTREECODE (UNSAVE_EXPR, "unsave_expr", "e", 1)
-
-/* Represents something whose RTL has already been expanded
- as a sequence which should be emitted when this expression is expanded.
- The first operand is the RTL to emit. It is the first of a chain of insns.
- The second is the RTL expression for the result. */
-DEFTREECODE (RTL_EXPR, "rtl_expr", "e", 2)
-
-/* & in C. Value is the address at which the operand's value resides.
- Operand may have any mode. Result mode is Pmode. */
-DEFTREECODE (ADDR_EXPR, "addr_expr", "e", 1)
-
-/* Non-lvalue reference or pointer to an object. */
-DEFTREECODE (REFERENCE_EXPR, "reference_expr", "e", 1)
-
-/* Operand is a function constant; result is a function variable value
- of typeEPmode. Used only for languages that need static chains. */
-DEFTREECODE (ENTRY_VALUE_EXPR, "entry_value_expr", "e", 1)
-
-/* Given two real or integer operands of the same type,
- returns a complex value of the corresponding complex type. */
-DEFTREECODE (COMPLEX_EXPR, "complex_expr", "2", 2)
-
-/* Complex conjugate of operand. Used only on complex types. */
-DEFTREECODE (CONJ_EXPR, "conj_expr", "1", 1)
-
-/* Used only on an operand of complex type, these return
- a value of the corresponding component type. */
-DEFTREECODE (REALPART_EXPR, "realpart_expr", "1", 1)
-DEFTREECODE (IMAGPART_EXPR, "imagpart_expr", "1", 1)
-
-/* Nodes for ++ and -- in C.
- The second arg is how much to increment or decrement by.
- For a pointer, it would be the size of the object pointed to. */
-DEFTREECODE (PREDECREMENT_EXPR, "predecrement_expr", "e", 2)
-DEFTREECODE (PREINCREMENT_EXPR, "preincrement_expr", "e", 2)
-DEFTREECODE (POSTDECREMENT_EXPR, "postdecrement_expr", "e", 2)
-DEFTREECODE (POSTINCREMENT_EXPR, "postincrement_expr", "e", 2)
-
-/* These types of expressions have no useful value,
- and always have side effects. */
-
-/* A label definition, encapsulated as a statement.
- Operand 0 is the LABEL_DECL node for the label that appears here.
- The type should be void and the value should be ignored. */
-DEFTREECODE (LABEL_EXPR, "label_expr", "s", 1)
-
-/* GOTO. Operand 0 is a LABEL_DECL node.
- The type should be void and the value should be ignored. */
-DEFTREECODE (GOTO_EXPR, "goto_expr", "s", 1)
-
-/* RETURN. Evaluates operand 0, then returns from the current function.
- Presumably that operand is an assignment that stores into the
- RESULT_DECL that hold the value to be returned.
- The operand may be null.
- The type should be void and the value should be ignored. */
-DEFTREECODE (RETURN_EXPR, "return_expr", "s", 1)
-
-/* Exit the inner most loop conditionally. Operand 0 is the condition.
- The type should be void and the value should be ignored. */
-DEFTREECODE (EXIT_EXPR, "exit_expr", "s", 1)
-
-/* A loop. Operand 0 is the body of the loop.
- It must contain an EXIT_EXPR or is an infinite loop.
- The type should be void and the value should be ignored. */
-DEFTREECODE (LOOP_EXPR, "loop_expr", "s", 1)
-
-/*
-Local variables:
-mode:c
-End:
-*/
diff --git a/gcc/tree.h b/gcc/tree.h
deleted file mode 100644
index ec1ce349a45..00000000000
--- a/gcc/tree.h
+++ /dev/null
@@ -1,1817 +0,0 @@
-/* Front-end tree definitions for GNU compiler.
- Copyright (C) 1989, 93, 94, 95, 96, 1997 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. */
-
-#include "machmode.h"
-
-#ifndef RTX_CODE
-struct rtx_def;
-#endif
-
-/* Codes of tree nodes */
-
-#define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM,
-
-enum tree_code {
-#include "tree.def"
-
- LAST_AND_UNUSED_TREE_CODE /* A convenient way to get a value for
- NUM_TREE_CODE. */
-};
-
-#undef DEFTREECODE
-
-/* Number of tree codes. */
-#define NUM_TREE_CODES ((int)LAST_AND_UNUSED_TREE_CODE)
-
-/* Indexed by enum tree_code, contains a character which is
- `<' for a comparison expression, `1', for a unary arithmetic
- expression, `2' for a binary arithmetic expression, `e' for
- other types of expressions, `r' for a reference, `c' for a
- constant, `d' for a decl, `t' for a type, `s' for a statement,
- and `x' for anything else (TREE_LIST, IDENTIFIER, etc). */
-
-extern char **tree_code_type;
-#define TREE_CODE_CLASS(CODE) (*tree_code_type[(int) (CODE)])
-
-/* Number of argument-words in each kind of tree-node. */
-
-extern int *tree_code_length;
-
-/* Names of tree components. */
-
-extern char **tree_code_name;
-
-/* Codes that identify the various built in functions
- so that expand_call can identify them quickly. */
-
-enum built_in_function
-{
- NOT_BUILT_IN,
- BUILT_IN_ALLOCA,
- BUILT_IN_ABS,
- BUILT_IN_FABS,
- BUILT_IN_LABS,
- BUILT_IN_FFS,
- BUILT_IN_DIV,
- BUILT_IN_LDIV,
- BUILT_IN_FFLOOR,
- BUILT_IN_FCEIL,
- BUILT_IN_FMOD,
- BUILT_IN_FREM,
- BUILT_IN_MEMCPY,
- BUILT_IN_MEMCMP,
- BUILT_IN_MEMSET,
- BUILT_IN_STRCPY,
- BUILT_IN_STRCMP,
- BUILT_IN_STRLEN,
- BUILT_IN_FSQRT,
- BUILT_IN_SIN,
- BUILT_IN_COS,
- BUILT_IN_GETEXP,
- BUILT_IN_GETMAN,
- BUILT_IN_SAVEREGS,
- BUILT_IN_CLASSIFY_TYPE,
- BUILT_IN_NEXT_ARG,
- BUILT_IN_ARGS_INFO,
- BUILT_IN_CONSTANT_P,
- BUILT_IN_FRAME_ADDRESS,
- BUILT_IN_RETURN_ADDRESS,
- BUILT_IN_CALLER_RETURN_ADDRESS,
- BUILT_IN_APPLY_ARGS,
- BUILT_IN_APPLY,
- BUILT_IN_RETURN,
- BUILT_IN_SETJMP,
- BUILT_IN_LONGJMP,
-
- /* C++ extensions */
- BUILT_IN_NEW,
- BUILT_IN_VEC_NEW,
- BUILT_IN_DELETE,
- BUILT_IN_VEC_DELETE,
-
- /* Upper bound on non-language-specific builtins. */
- END_BUILTINS
-};
-
-/* The definition of tree nodes fills the next several pages. */
-
-/* A tree node can represent a data type, a variable, an expression
- or a statement. Each node has a TREE_CODE which says what kind of
- thing it represents. Some common codes are:
- INTEGER_TYPE -- represents a type of integers.
- ARRAY_TYPE -- represents a type of pointer.
- VAR_DECL -- represents a declared variable.
- INTEGER_CST -- represents a constant integer value.
- PLUS_EXPR -- represents a sum (an expression).
-
- As for the contents of a tree node: there are some fields
- that all nodes share. Each TREE_CODE has various special-purpose
- fields as well. The fields of a node are never accessed directly,
- always through accessor macros. */
-
-/* This type is used everywhere to refer to a tree node. */
-
-typedef union tree_node *tree;
-
-/* Every kind of tree node starts with this structure,
- so all nodes have these fields.
-
- See the accessor macros, defined below, for documentation of the fields. */
-
-struct tree_common
-{
- union tree_node *chain;
- union tree_node *type;
-#ifdef ONLY_INT_FIELDS
- unsigned int code : 8;
-#else
- enum tree_code code : 8;
-#endif
-
- unsigned side_effects_flag : 1;
- unsigned constant_flag : 1;
- unsigned permanent_flag : 1;
- unsigned addressable_flag : 1;
- unsigned volatile_flag : 1;
- unsigned readonly_flag : 1;
- unsigned unsigned_flag : 1;
- unsigned asm_written_flag: 1;
-
- unsigned used_flag : 1;
- unsigned raises_flag : 1;
- unsigned static_flag : 1;
- unsigned public_flag : 1;
- unsigned private_flag : 1;
- unsigned protected_flag : 1;
-
- unsigned lang_flag_0 : 1;
- unsigned lang_flag_1 : 1;
- unsigned lang_flag_2 : 1;
- unsigned lang_flag_3 : 1;
- unsigned lang_flag_4 : 1;
- unsigned lang_flag_5 : 1;
- unsigned lang_flag_6 : 1;
- /* There is room for three more flags. */
-};
-
-/* The following table lists the uses of each of the above flags and
- for which types of nodes they are defined. Note that expressions
- include decls.
-
- addressable_flag:
-
- TREE_ADDRESSABLE in
- VAR_DECL, FUNCTION_DECL, CONSTRUCTOR, LABEL_DECL, ..._TYPE
- IDENTIFIER_NODE
-
- static_flag:
-
- TREE_STATIC in
- VAR_DECL, FUNCTION_DECL, CONSTRUCTOR
- TREE_NO_UNUSED_WARNING in
- CONVERT_EXPR, NOP_EXPR, COMPOUND_EXPR
- TREE_VIA_VIRTUAL in
- TREE_LIST or TREE_VEC
- TREE_CONSTANT_OVERFLOW in
- INTEGER_CST, REAL_CST, COMPLEX_CST
- TREE_SYMBOL_REFERENCED in
- IDENTIFIER_NODE
-
- public_flag:
-
- TREE_OVERFLOW in
- INTEGER_CST, REAL_CST, COMPLEX_CST
- TREE_PUBLIC in
- VAR_DECL or FUNCTION_DECL
- TREE_VIA_PUBLIC in
- TREE_LIST or TREE_VEC
-
- private_flag:
-
- TREE_VIA_PRIVATE in
- TREE_LIST or TREE_VEC
- TREE_PRIVATE in
- ??? unspecified nodes
-
- protected_flag:
-
- TREE_VIA_PROTECTED in
- TREE_LIST
- TREE_PROTECTED in
- BLOCK
- ??? unspecified nodes
-
- side_effects_flag:
-
- TREE_SIDE_EFFECTS in
- all expressions
-
- volatile_flag:
-
- TREE_THIS_VOLATILE in
- all expressions
- TYPE_VOLATILE in
- ..._TYPE
-
- readonly_flag:
-
- TREE_READONLY in
- VAR_DECL, PARM_DECL, FIELD_DECL, ..._REF
- ITERATOR_BOUND_P in
- VAR_DECL if iterator (C)
- TYPE_READONLY in
- ..._TYPE
-
- constant_flag:
-
- TREE_CONSTANT in
- all expressions
-
- permanent_flag: TREE_PERMANENT in all nodes
-
- unsigned_flag:
-
- TREE_UNSIGNED in
- INTEGER_TYPE, ENUMERAL_TYPE, FIELD_DECL
- DECL_BUILT_IN_NONANSI in
- FUNCTION_DECL
- TREE_PARMLIST in
- TREE_PARMLIST (C++)
-
- asm_written_flag:
-
- TREE_ASM_WRITTEN in
- VAR_DECL, FUNCTION_DECL, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE
- BLOCK
-
- used_flag:
-
- TREE_USED in
- expressions, IDENTIFIER_NODE
-
- raises_flag:
-
- TREE_RAISES in
- expressions
-
- */
-/* Define accessors for the fields that all tree nodes have
- (though some fields are not used for all kinds of nodes). */
-
-/* The tree-code says what kind of node it is.
- Codes are defined in tree.def. */
-#define TREE_CODE(NODE) ((enum tree_code) (NODE)->common.code)
-#define TREE_SET_CODE(NODE, VALUE) ((NODE)->common.code = (int) (VALUE))
-
-/* In all nodes that are expressions, this is the data type of the expression.
- In POINTER_TYPE nodes, this is the type that the pointer points to.
- In ARRAY_TYPE nodes, this is the type of the elements. */
-#define TREE_TYPE(NODE) ((NODE)->common.type)
-
-/* Nodes are chained together for many purposes.
- Types are chained together to record them for being output to the debugger
- (see the function `chain_type').
- Decls in the same scope are chained together to record the contents
- of the scope.
- Statement nodes for successive statements used to be chained together.
- Often lists of things are represented by TREE_LIST nodes that
- are chained together. */
-
-#define TREE_CHAIN(NODE) ((NODE)->common.chain)
-
-/* Given an expression as a tree, strip any NON_LVALUE_EXPRs and NOP_EXPRs
- that don't change the machine mode. */
-
-#define STRIP_NOPS(EXP) \
- while ((TREE_CODE (EXP) == NOP_EXPR \
- || TREE_CODE (EXP) == CONVERT_EXPR \
- || TREE_CODE (EXP) == NON_LVALUE_EXPR) \
- && (TYPE_MODE (TREE_TYPE (EXP)) \
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
- (EXP) = TREE_OPERAND (EXP, 0);
-
-/* Like STRIP_NOPS, but don't alter the TREE_TYPE either. */
-
-#define STRIP_TYPE_NOPS(EXP) \
- while ((TREE_CODE (EXP) == NOP_EXPR \
- || TREE_CODE (EXP) == CONVERT_EXPR \
- || TREE_CODE (EXP) == NON_LVALUE_EXPR) \
- && (TREE_TYPE (EXP) \
- == TREE_TYPE (TREE_OPERAND (EXP, 0)))) \
- (EXP) = TREE_OPERAND (EXP, 0);
-
-/* Nonzero if TYPE represents an integral type. Note that we do not
- include COMPLEX types here. */
-
-#define INTEGRAL_TYPE_P(TYPE) \
- (TREE_CODE (TYPE) == INTEGER_TYPE || TREE_CODE (TYPE) == ENUMERAL_TYPE \
- || TREE_CODE (TYPE) == BOOLEAN_TYPE || TREE_CODE (TYPE) == CHAR_TYPE)
-
-/* Nonzero if TYPE represents a floating-point type, including complex
- floating-point types. */
-
-#define FLOAT_TYPE_P(TYPE) \
- (TREE_CODE (TYPE) == REAL_TYPE \
- || (TREE_CODE (TYPE) == COMPLEX_TYPE \
- && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE))
-
-/* Nonzero if TYPE represents an aggregate (multi-component) type. */
-
-#define AGGREGATE_TYPE_P(TYPE) \
- (TREE_CODE (TYPE) == ARRAY_TYPE || TREE_CODE (TYPE) == RECORD_TYPE \
- || TREE_CODE (TYPE) == UNION_TYPE || TREE_CODE (TYPE) == QUAL_UNION_TYPE \
- || TREE_CODE (TYPE) == SET_TYPE)
-
-/* Nonzero if TYPE represents a pointer type. */
-
-#define POINTER_TYPE_P(TYPE) \
- (TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE)
-
-/* Define many boolean fields that all tree nodes have. */
-
-/* In VAR_DECL nodes, nonzero means address of this is needed.
- So it cannot be in a register.
- In a FUNCTION_DECL, nonzero means its address is needed.
- So it must be compiled even if it is an inline function.
- In CONSTRUCTOR nodes, it means object constructed must be in memory.
- In LABEL_DECL nodes, it means a goto for this label has been seen
- from a place outside all binding contours that restore stack levels.
- In ..._TYPE nodes, it means that objects of this type must
- be fully addressable. This means that pieces of this
- object cannot go into register parameters, for example.
- In IDENTIFIER_NODEs, this means that some extern decl for this name
- had its address taken. That matters for inline functions. */
-#define TREE_ADDRESSABLE(NODE) ((NODE)->common.addressable_flag)
-
-/* In a VAR_DECL, nonzero means allocate static storage.
- In a FUNCTION_DECL, nonzero if function has been defined.
- In a CONSTRUCTOR, nonzero means allocate static storage. */
-#define TREE_STATIC(NODE) ((NODE)->common.static_flag)
-
-/* In a CONVERT_EXPR, NOP_EXPR or COMPOUND_EXPR, this means the node was
- made implicitly and should not lead to an "unused value" warning. */
-#define TREE_NO_UNUSED_WARNING(NODE) ((NODE)->common.static_flag)
-
-/* Nonzero for a TREE_LIST or TREE_VEC node means that the derivation
- chain is via a `virtual' declaration. */
-#define TREE_VIA_VIRTUAL(NODE) ((NODE)->common.static_flag)
-
-/* In an INTEGER_CST, REAL_CST, or COMPLEX_CST, this means there was an
- overflow in folding. This is distinct from TREE_OVERFLOW because ANSI C
- requires a diagnostic when overflows occur in constant expressions. */
-#define TREE_CONSTANT_OVERFLOW(NODE) ((NODE)->common.static_flag)
-
-/* In an IDENTIFIER_NODE, this means that assemble_name was called with
- this string as an argument. */
-#define TREE_SYMBOL_REFERENCED(NODE) ((NODE)->common.static_flag)
-
-/* In an INTEGER_CST, REAL_CST, of COMPLEX_CST, this means there was an
- overflow in folding, and no warning has been issued for this subexpression.
- TREE_OVERFLOW implies TREE_CONSTANT_OVERFLOW, but not vice versa. */
-#define TREE_OVERFLOW(NODE) ((NODE)->common.public_flag)
-
-/* In a VAR_DECL or FUNCTION_DECL,
- nonzero means name is to be accessible from outside this module.
- In an identifier node, nonzero means an external declaration
- accessible from outside this module was previously seen
- for this name in an inner scope. */
-#define TREE_PUBLIC(NODE) ((NODE)->common.public_flag)
-
-/* Nonzero for TREE_LIST or TREE_VEC node means that the path to the
- base class is via a `public' declaration, which preserves public
- fields from the base class as public. */
-#define TREE_VIA_PUBLIC(NODE) ((NODE)->common.public_flag)
-
-/* Ditto, for `private' declarations. */
-#define TREE_VIA_PRIVATE(NODE) ((NODE)->common.private_flag)
-
-/* Nonzero for TREE_LIST node means that the path to the
- base class is via a `protected' declaration, which preserves
- protected fields from the base class as protected.
- OVERLOADED. */
-#define TREE_VIA_PROTECTED(NODE) ((NODE)->common.protected_flag)
-
-/* In any expression, nonzero means it has side effects or reevaluation
- of the whole expression could produce a different value.
- This is set if any subexpression is a function call, a side effect
- or a reference to a volatile variable.
- In a ..._DECL, this is set only if the declaration said `volatile'. */
-#define TREE_SIDE_EFFECTS(NODE) ((NODE)->common.side_effects_flag)
-
-/* Nonzero means this expression is volatile in the C sense:
- its address should be of type `volatile WHATEVER *'.
- In other words, the declared item is volatile qualified.
- This is used in _DECL nodes and _REF nodes.
-
- In a ..._TYPE node, means this type is volatile-qualified.
- But use TYPE_VOLATILE instead of this macro when the node is a type,
- because eventually we may make that a different bit.
-
- If this bit is set in an expression, so is TREE_SIDE_EFFECTS. */
-#define TREE_THIS_VOLATILE(NODE) ((NODE)->common.volatile_flag)
-
-/* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
- nonzero means it may not be the lhs of an assignment.
- In a ..._TYPE node, means this type is const-qualified
- (but the macro TYPE_READONLY should be used instead of this macro
- when the node is a type). */
-#define TREE_READONLY(NODE) ((NODE)->common.readonly_flag)
-
-/* Value of expression is constant.
- Always appears in all ..._CST nodes.
- May also appear in an arithmetic expression, an ADDR_EXPR or a CONSTRUCTOR
- if the value is constant. */
-#define TREE_CONSTANT(NODE) ((NODE)->common.constant_flag)
-
-/* Nonzero means permanent node;
- node will continue to exist for the entire compiler run.
- Otherwise it will be recycled at the end of the function. */
-#define TREE_PERMANENT(NODE) ((NODE)->common.permanent_flag)
-
-/* In INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type.
- In FIELD_DECL nodes, means an unsigned bit field.
- The same bit is used in functions as DECL_BUILT_IN_NONANSI. */
-#define TREE_UNSIGNED(NODE) ((NODE)->common.unsigned_flag)
-
-/* Nonzero in a VAR_DECL means assembler code has been written.
- Nonzero in a FUNCTION_DECL means that the function has been compiled.
- This is interesting in an inline function, since it might not need
- to be compiled separately.
- Nonzero in a RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE or ENUMERAL_TYPE
- if the sdb debugging info for the type has been written.
- In a BLOCK node, nonzero if reorder_blocks has already seen this block. */
-#define TREE_ASM_WRITTEN(NODE) ((NODE)->common.asm_written_flag)
-
-/* Nonzero in a _DECL if the name is used in its scope.
- Nonzero in an expr node means inhibit warning if value is unused.
- In IDENTIFIER_NODEs, this means that some extern decl for this name
- was used. */
-#define TREE_USED(NODE) ((NODE)->common.used_flag)
-
-/* Nonzero for a tree node whose evaluation could result
- in the raising of an exception. Not implemented yet. */
-#define TREE_RAISES(NODE) ((NODE)->common.raises_flag)
-
-/* Used in classes in C++. */
-#define TREE_PRIVATE(NODE) ((NODE)->common.private_flag)
-/* Used in classes in C++.
- In a BLOCK node, this is BLOCK_HANDLER_BLOCK. */
-#define TREE_PROTECTED(NODE) ((NODE)->common.protected_flag)
-
-/* These flags are available for each language front end to use internally. */
-#define TREE_LANG_FLAG_0(NODE) ((NODE)->common.lang_flag_0)
-#define TREE_LANG_FLAG_1(NODE) ((NODE)->common.lang_flag_1)
-#define TREE_LANG_FLAG_2(NODE) ((NODE)->common.lang_flag_2)
-#define TREE_LANG_FLAG_3(NODE) ((NODE)->common.lang_flag_3)
-#define TREE_LANG_FLAG_4(NODE) ((NODE)->common.lang_flag_4)
-#define TREE_LANG_FLAG_5(NODE) ((NODE)->common.lang_flag_5)
-#define TREE_LANG_FLAG_6(NODE) ((NODE)->common.lang_flag_6)
-
-/* Define additional fields and accessors for nodes representing constants. */
-
-/* In an INTEGER_CST node. These two together make a 2-word integer.
- If the data type is signed, the value is sign-extended to 2 words
- even though not all of them may really be in use.
- In an unsigned constant shorter than 2 words, the extra bits are 0. */
-#define TREE_INT_CST_LOW(NODE) ((NODE)->int_cst.int_cst_low)
-#define TREE_INT_CST_HIGH(NODE) ((NODE)->int_cst.int_cst_high)
-
-#define INT_CST_LT(A, B) \
-(TREE_INT_CST_HIGH (A) < TREE_INT_CST_HIGH (B) \
- || (TREE_INT_CST_HIGH (A) == TREE_INT_CST_HIGH (B) \
- && ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (A) \
- < (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (B))))
-
-#define INT_CST_LT_UNSIGNED(A, B) \
-(((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
- < (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (B)) \
- || (((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (A) \
- == (unsigned HOST_WIDE_INT ) TREE_INT_CST_HIGH (B)) \
- && (((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (A) \
- < (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (B)))))
-
-struct tree_int_cst
-{
- char common[sizeof (struct tree_common)];
- struct rtx_def *rtl; /* acts as link to register transfer language
- (rtl) info */
- HOST_WIDE_INT int_cst_low;
- HOST_WIDE_INT int_cst_high;
-};
-
-/* In REAL_CST, STRING_CST, COMPLEX_CST nodes, and CONSTRUCTOR nodes,
- and generally in all kinds of constants that could
- be given labels (rather than being immediate). */
-
-#define TREE_CST_RTL(NODE) ((NODE)->real_cst.rtl)
-
-/* In a REAL_CST node. */
-/* We can represent a real value as either a `double' or a string.
- Strings don't allow for any optimization, but they do allow
- for cross-compilation. */
-
-#define TREE_REAL_CST(NODE) ((NODE)->real_cst.real_cst)
-
-#include "real.h"
-
-struct tree_real_cst
-{
- char common[sizeof (struct tree_common)];
- struct rtx_def *rtl; /* acts as link to register transfer language
- (rtl) info */
- REAL_VALUE_TYPE real_cst;
-};
-
-/* In a STRING_CST */
-#define TREE_STRING_LENGTH(NODE) ((NODE)->string.length)
-#define TREE_STRING_POINTER(NODE) ((NODE)->string.pointer)
-
-struct tree_string
-{
- char common[sizeof (struct tree_common)];
- struct rtx_def *rtl; /* acts as link to register transfer language
- (rtl) info */
- int length;
- char *pointer;
-};
-
-/* In a COMPLEX_CST node. */
-#define TREE_REALPART(NODE) ((NODE)->complex.real)
-#define TREE_IMAGPART(NODE) ((NODE)->complex.imag)
-
-struct tree_complex
-{
- char common[sizeof (struct tree_common)];
- struct rtx_def *rtl; /* acts as link to register transfer language
- (rtl) info */
- union tree_node *real;
- union tree_node *imag;
-};
-
-/* Define fields and accessors for some special-purpose tree nodes. */
-
-#define IDENTIFIER_LENGTH(NODE) ((NODE)->identifier.length)
-#define IDENTIFIER_POINTER(NODE) ((NODE)->identifier.pointer)
-
-struct tree_identifier
-{
- char common[sizeof (struct tree_common)];
- int length;
- char *pointer;
-};
-
-/* In a TREE_LIST node. */
-#define TREE_PURPOSE(NODE) ((NODE)->list.purpose)
-#define TREE_VALUE(NODE) ((NODE)->list.value)
-
-struct tree_list
-{
- char common[sizeof (struct tree_common)];
- union tree_node *purpose;
- union tree_node *value;
-};
-
-/* In a TREE_VEC node. */
-#define TREE_VEC_LENGTH(NODE) ((NODE)->vec.length)
-#define TREE_VEC_ELT(NODE,I) ((NODE)->vec.a[I])
-#define TREE_VEC_END(NODE) (&((NODE)->vec.a[(NODE)->vec.length]))
-
-struct tree_vec
-{
- char common[sizeof (struct tree_common)];
- int length;
- union tree_node *a[1];
-};
-
-/* Define fields and accessors for some nodes that represent expressions. */
-
-/* In a SAVE_EXPR node. */
-#define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND(NODE, 1)
-#define SAVE_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2])
-
-/* In a RTL_EXPR node. */
-#define RTL_EXPR_SEQUENCE(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[0])
-#define RTL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[1])
-
-/* In a CALL_EXPR node. */
-#define CALL_EXPR_RTL(NODE) (*(struct rtx_def **) &(NODE)->exp.operands[2])
-
-/* In a CONSTRUCTOR node. */
-#define CONSTRUCTOR_ELTS(NODE) TREE_OPERAND (NODE, 1)
-
-/* In ordinary expression nodes. */
-#define TREE_OPERAND(NODE, I) ((NODE)->exp.operands[I])
-#define TREE_COMPLEXITY(NODE) ((NODE)->exp.complexity)
-
-struct tree_exp
-{
- char common[sizeof (struct tree_common)];
- int complexity;
- union tree_node *operands[1];
-};
-
-/* In a BLOCK node. */
-#define BLOCK_VARS(NODE) ((NODE)->block.vars)
-#define BLOCK_TYPE_TAGS(NODE) ((NODE)->block.type_tags)
-#define BLOCK_SUBBLOCKS(NODE) ((NODE)->block.subblocks)
-#define BLOCK_SUPERCONTEXT(NODE) ((NODE)->block.supercontext)
-/* Note: when changing this, make sure to find the places
- that use chainon or nreverse. */
-#define BLOCK_CHAIN(NODE) TREE_CHAIN (NODE)
-#define BLOCK_ABSTRACT_ORIGIN(NODE) ((NODE)->block.abstract_origin)
-#define BLOCK_ABSTRACT(NODE) ((NODE)->block.abstract_flag)
-#define BLOCK_END_NOTE(NODE) ((NODE)->block.end_note)
-
-/* Nonzero means that this block is prepared to handle exceptions
- listed in the BLOCK_VARS slot. */
-#define BLOCK_HANDLER_BLOCK(NODE) ((NODE)->block.handler_block_flag)
-
-struct tree_block
-{
- char common[sizeof (struct tree_common)];
-
- unsigned handler_block_flag : 1;
- unsigned abstract_flag : 1;
-
- union tree_node *vars;
- union tree_node *type_tags;
- union tree_node *subblocks;
- union tree_node *supercontext;
- union tree_node *abstract_origin;
- struct rtx_def *end_note;
-};
-
-/* Define fields and accessors for nodes representing data types. */
-
-/* See tree.def for documentation of the use of these fields.
- Look at the documentation of the various ..._TYPE tree codes. */
-
-#define TYPE_UID(NODE) ((NODE)->type.uid)
-#define TYPE_SIZE(NODE) ((NODE)->type.size)
-#define TYPE_MODE(NODE) ((NODE)->type.mode)
-#define TYPE_VALUES(NODE) ((NODE)->type.values)
-#define TYPE_DOMAIN(NODE) ((NODE)->type.values)
-#define TYPE_FIELDS(NODE) ((NODE)->type.values)
-#define TYPE_METHODS(NODE) ((NODE)->type.maxval)
-#define TYPE_VFIELD(NODE) ((NODE)->type.minval)
-#define TYPE_ARG_TYPES(NODE) ((NODE)->type.values)
-#define TYPE_METHOD_BASETYPE(NODE) ((NODE)->type.maxval)
-#define TYPE_OFFSET_BASETYPE(NODE) ((NODE)->type.maxval)
-#define TYPE_POINTER_TO(NODE) ((NODE)->type.pointer_to)
-#define TYPE_REFERENCE_TO(NODE) ((NODE)->type.reference_to)
-#define TYPE_MIN_VALUE(NODE) ((NODE)->type.minval)
-#define TYPE_MAX_VALUE(NODE) ((NODE)->type.maxval)
-#define TYPE_PRECISION(NODE) ((NODE)->type.precision)
-#define TYPE_SYMTAB_ADDRESS(NODE) ((NODE)->type.symtab.address)
-#define TYPE_SYMTAB_POINTER(NODE) ((NODE)->type.symtab.pointer)
-#define TYPE_NAME(NODE) ((NODE)->type.name)
-#define TYPE_NEXT_VARIANT(NODE) ((NODE)->type.next_variant)
-#define TYPE_MAIN_VARIANT(NODE) ((NODE)->type.main_variant)
-#define TYPE_BINFO(NODE) ((NODE)->type.binfo)
-#define TYPE_NONCOPIED_PARTS(NODE) ((NODE)->type.noncopied_parts)
-#define TYPE_CONTEXT(NODE) ((NODE)->type.context)
-#define TYPE_OBSTACK(NODE) ((NODE)->type.obstack)
-#define TYPE_LANG_SPECIFIC(NODE) ((NODE)->type.lang_specific)
-
-/* A TREE_LIST of IDENTIFIER nodes of the attributes that apply
- to this type. */
-#define TYPE_ATTRIBUTES(NODE) ((NODE)->type.attributes)
-
-/* The alignment necessary for objects of this type.
- The value is an int, measured in bits. */
-#define TYPE_ALIGN(NODE) ((NODE)->type.align)
-
-#define TYPE_STUB_DECL(NODE) (TREE_CHAIN (NODE))
-
-/* In a RECORD_TYPE, UNION_TYPE or QUAL_UNION_TYPE, it means the type
- has BLKmode only because it lacks the alignment requirement for
- its size. */
-#define TYPE_NO_FORCE_BLK(NODE) ((NODE)->type.no_force_blk_flag)
-
-/* Nonzero in a type considered volatile as a whole. */
-#define TYPE_VOLATILE(NODE) ((NODE)->common.volatile_flag)
-
-/* Means this type is const-qualified. */
-#define TYPE_READONLY(NODE) ((NODE)->common.readonly_flag)
-
-/* These flags are available for each language front end to use internally. */
-#define TYPE_LANG_FLAG_0(NODE) ((NODE)->type.lang_flag_0)
-#define TYPE_LANG_FLAG_1(NODE) ((NODE)->type.lang_flag_1)
-#define TYPE_LANG_FLAG_2(NODE) ((NODE)->type.lang_flag_2)
-#define TYPE_LANG_FLAG_3(NODE) ((NODE)->type.lang_flag_3)
-#define TYPE_LANG_FLAG_4(NODE) ((NODE)->type.lang_flag_4)
-#define TYPE_LANG_FLAG_5(NODE) ((NODE)->type.lang_flag_5)
-#define TYPE_LANG_FLAG_6(NODE) ((NODE)->type.lang_flag_6)
-
-/* If set in an ARRAY_TYPE, indicates a string type (for languages
- that distinguish string from array of char).
- If set in a SET_TYPE, indicates a bitstring type. */
-#define TYPE_STRING_FLAG(NODE) ((NODE)->type.string_flag)
-
-/* If non-NULL, this is a upper bound of the size (in bytes) of an
- object of the given ARRAY_TYPE. This allows temporaries to be allocated. */
-#define TYPE_ARRAY_MAX_SIZE(ARRAY_TYPE) TYPE_MAX_VALUE (ARRAY_TYPE)
-
-/* Indicates that objects of this type must be initialized by calling a
- function when they are created. */
-#define TYPE_NEEDS_CONSTRUCTING(NODE) ((NODE)->type.needs_constructing_flag)
-
-/* Indicates that objects of this type (a UNION_TYPE), should be passed
- the same way that the first union alternative would be passed. */
-#define TYPE_TRANSPARENT_UNION(NODE) ((NODE)->type.transparent_union_flag)
-
-/* Indicated that objects of this type should be layed out in as
- compact a way as possible. */
-#define TYPE_PACKED(NODE) ((NODE)->type.packed_flag)
-
-struct tree_type
-{
- char common[sizeof (struct tree_common)];
- union tree_node *values;
- union tree_node *size;
- union tree_node *attributes;
- unsigned uid;
-
- unsigned char precision;
-#ifdef ONLY_INT_FIELDS
- int mode : 8;
-#else
- enum machine_mode mode : 8;
-#endif
-
- unsigned string_flag : 1;
- unsigned no_force_blk_flag : 1;
- unsigned needs_constructing_flag : 1;
- unsigned transparent_union_flag : 1;
- unsigned packed_flag : 1;
- unsigned lang_flag_0 : 1;
- unsigned lang_flag_1 : 1;
- unsigned lang_flag_2 : 1;
- unsigned lang_flag_3 : 1;
- unsigned lang_flag_4 : 1;
- unsigned lang_flag_5 : 1;
- unsigned lang_flag_6 : 1;
- /* room for 4 more bits */
-
- unsigned int align;
- union tree_node *pointer_to;
- union tree_node *reference_to;
- union {int address; char *pointer; } symtab;
- union tree_node *name;
- union tree_node *minval;
- union tree_node *maxval;
- union tree_node *next_variant;
- union tree_node *main_variant;
- union tree_node *binfo;
- union tree_node *noncopied_parts;
- union tree_node *context;
- struct obstack *obstack;
- /* Points to a structure whose details depend on the language in use. */
- struct lang_type *lang_specific;
-};
-
-/* Define accessor macros for information about type inheritance
- and basetypes.
-
- A "basetype" means a particular usage of a data type for inheritance
- in another type. Each such basetype usage has its own "binfo"
- object to describe it. The binfo object is a TREE_VEC node.
-
- Inheritance is represented by the binfo nodes allocated for a
- given type. For example, given types C and D, such that D is
- inherited by C, 3 binfo nodes will be allocated: one for describing
- the binfo properties of C, similarly one for D, and one for
- describing the binfo properties of D as a base type for C.
- Thus, given a pointer to class C, one can get a pointer to the binfo
- of D acting as a basetype for C by looking at C's binfo's basetypes. */
-
-/* The actual data type node being inherited in this basetype. */
-#define BINFO_TYPE(NODE) TREE_TYPE (NODE)
-
-/* The offset where this basetype appears in its containing type.
- BINFO_OFFSET slot holds the offset (in bytes)
- from the base of the complete object to the base of the part of the
- object that is allocated on behalf of this `type'.
- This is always 0 except when there is multiple inheritance. */
-
-#define BINFO_OFFSET(NODE) TREE_VEC_ELT ((NODE), 1)
-#define TYPE_BINFO_OFFSET(NODE) BINFO_OFFSET (TYPE_BINFO (NODE))
-#define BINFO_OFFSET_ZEROP(NODE) (BINFO_OFFSET (NODE) == integer_zero_node)
-
-/* The virtual function table belonging to this basetype. Virtual
- function tables provide a mechanism for run-time method dispatching.
- The entries of a virtual function table are language-dependent. */
-
-#define BINFO_VTABLE(NODE) TREE_VEC_ELT ((NODE), 2)
-#define TYPE_BINFO_VTABLE(NODE) BINFO_VTABLE (TYPE_BINFO (NODE))
-
-/* The virtual functions in the virtual function table. This is
- a TREE_LIST that is used as an initial approximation for building
- a virtual function table for this basetype. */
-#define BINFO_VIRTUALS(NODE) TREE_VEC_ELT ((NODE), 3)
-#define TYPE_BINFO_VIRTUALS(NODE) BINFO_VIRTUALS (TYPE_BINFO (NODE))
-
-/* A vector of additional binfos for the types inherited by this basetype.
-
- If this basetype describes type D as inherited in C,
- and if the basetypes of D are E anf F,
- then this vector contains binfos for inheritance of E and F by C.
-
- ??? This could probably be done by just allocating the
- base types at the end of this TREE_VEC (instead of using
- another TREE_VEC). This would simplify the calculation
- of how many basetypes a given type had. */
-#define BINFO_BASETYPES(NODE) TREE_VEC_ELT ((NODE), 4)
-#define TYPE_BINFO_BASETYPES(NODE) TREE_VEC_ELT (TYPE_BINFO (NODE), 4)
-
-/* For a BINFO record describing an inheritance, this yields a pointer
- to the artificial FIELD_DECL node which contains the "virtual base
- class pointer" for the given inheritance. */
-
-#define BINFO_VPTR_FIELD(NODE) TREE_VEC_ELT ((NODE), 5)
-
-/* Accessor macro to get to the Nth basetype of this basetype. */
-#define BINFO_BASETYPE(NODE,N) TREE_VEC_ELT (BINFO_BASETYPES (NODE), (N))
-#define TYPE_BINFO_BASETYPE(NODE,N) BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (NODE)), (N)))
-
-/* Slot used to build a chain that represents a use of inheritance.
- For example, if X is derived from Y, and Y is derived from Z,
- then this field can be used to link the binfo node for X to
- the binfo node for X's Y to represent the use of inheritance
- from X to Y. Similarly, this slot of the binfo node for X's Y
- can point to the Z from which Y is inherited (in X's inheritance
- hierarchy). In this fashion, one can represent and traverse specific
- uses of inheritance using the binfo nodes themselves (instead of
- consing new space pointing to binfo nodes).
- It is up to the language-dependent front-ends to maintain
- this information as necessary. */
-#define BINFO_INHERITANCE_CHAIN(NODE) TREE_VEC_ELT ((NODE), 0)
-
-/* Define fields and accessors for nodes representing declared names. */
-
-/* This is the name of the object as written by the user.
- It is an IDENTIFIER_NODE. */
-#define DECL_NAME(NODE) ((NODE)->decl.name)
-/* This is the name of the object as the assembler will see it
- (but before any translations made by ASM_OUTPUT_LABELREF).
- Often this is the same as DECL_NAME.
- It is an IDENTIFIER_NODE. */
-#define DECL_ASSEMBLER_NAME(NODE) ((NODE)->decl.assembler_name)
-/* Records the section name in a section attribute. Used to pass
- the name from decl_attributes to make_function_rtl and make_decl_rtl. */
-#define DECL_SECTION_NAME(NODE) ((NODE)->decl.section_name)
-/* For FIELD_DECLs, this is the
- RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE node that the field is
- a member of. For VAR_DECL, PARM_DECL, FUNCTION_DECL, LABEL_DECL,
- and CONST_DECL nodes, this points to either the FUNCTION_DECL for the
- containing function, the RECORD_TYPE or UNION_TYPE for the containing
- type, or NULL_TREE if the given decl has "file scope". */
-#define DECL_CONTEXT(NODE) ((NODE)->decl.context)
-#define DECL_FIELD_CONTEXT(NODE) ((NODE)->decl.context)
-/* In a DECL this is the field where configuration dependent machine
- attributes are store */
-#define DECL_MACHINE_ATTRIBUTES(NODE) ((NODE)->decl.machine_attributes)
-/* In a FIELD_DECL, this is the field position, counting in bits,
- of the bit closest to the beginning of the structure. */
-#define DECL_FIELD_BITPOS(NODE) ((NODE)->decl.arguments)
-/* In a FIELD_DECL, this indicates whether the field was a bit-field and
- if so, the type that was originally specified for it.
- TREE_TYPE may have been modified (in finish_struct). */
-#define DECL_BIT_FIELD_TYPE(NODE) ((NODE)->decl.result)
-/* In FUNCTION_DECL, a chain of ..._DECL nodes. */
-/* VAR_DECL and PARM_DECL reserve the arguments slot
- for language-specific uses. */
-#define DECL_ARGUMENTS(NODE) ((NODE)->decl.arguments)
-/* In FUNCTION_DECL, holds the decl for the return value. */
-#define DECL_RESULT(NODE) ((NODE)->decl.result)
-/* For a TYPE_DECL, holds the "original" type. (TREE_TYPE has the copy.) */
-#define DECL_ORIGINAL_TYPE(NODE) ((NODE)->decl.result)
-/* In PARM_DECL, holds the type as written (perhaps a function or array). */
-#define DECL_ARG_TYPE_AS_WRITTEN(NODE) ((NODE)->decl.result)
-/* For a FUNCTION_DECL, holds the tree of BINDINGs.
- For a VAR_DECL, holds the initial value.
- For a PARM_DECL, not used--default
- values for parameters are encoded in the type of the function,
- not in the PARM_DECL slot. */
-#define DECL_INITIAL(NODE) ((NODE)->decl.initial)
-/* For a PARM_DECL, records the data type used to pass the argument,
- which may be different from the type seen in the program. */
-#define DECL_ARG_TYPE(NODE) ((NODE)->decl.initial) /* In PARM_DECL. */
-/* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which
- if nonzero, indicates that the field occupies the type. */
-#define DECL_QUALIFIER(NODE) ((NODE)->decl.initial)
-/* These two fields describe where in the source code the declaration was. */
-#define DECL_SOURCE_FILE(NODE) ((NODE)->decl.filename)
-#define DECL_SOURCE_LINE(NODE) ((NODE)->decl.linenum)
-/* Holds the size of the datum, as a tree expression.
- Need not be constant. */
-#define DECL_SIZE(NODE) ((NODE)->decl.size)
-/* Holds the alignment required for the datum. */
-#define DECL_ALIGN(NODE) ((NODE)->decl.frame_size.u)
-/* Holds the machine mode corresponding to the declaration of a variable or
- field. Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
- FIELD_DECL. */
-#define DECL_MODE(NODE) ((NODE)->decl.mode)
-/* Holds the RTL expression for the value of a variable or function. If
- PROMOTED_MODE is defined, the mode of this expression may not be same
- as DECL_MODE. In that case, DECL_MODE contains the mode corresponding
- to the variable's data type, while the mode
- of DECL_RTL is the mode actually used to contain the data. */
-#define DECL_RTL(NODE) ((NODE)->decl.rtl)
-/* For PARM_DECL, holds an RTL for the stack slot or register
- where the data was actually passed. */
-#define DECL_INCOMING_RTL(NODE) ((NODE)->decl.saved_insns.r)
-/* For FUNCTION_DECL, if it is inline, holds the saved insn chain. */
-#define DECL_SAVED_INSNS(NODE) ((NODE)->decl.saved_insns.r)
-/* For FUNCTION_DECL, if it is inline,
- holds the size of the stack frame, as an integer. */
-#define DECL_FRAME_SIZE(NODE) ((NODE)->decl.frame_size.i)
-/* For FUNCTION_DECL, if it is built-in,
- this identifies which built-in operation it is. */
-#define DECL_FUNCTION_CODE(NODE) ((NODE)->decl.frame_size.f)
-#define DECL_SET_FUNCTION_CODE(NODE,VAL) ((NODE)->decl.frame_size.f = (VAL))
-/* For a FIELD_DECL, holds the size of the member as an integer. */
-#define DECL_FIELD_SIZE(NODE) ((NODE)->decl.saved_insns.i)
-
-/* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways.
- Before the struct containing the FUNCTION_DECL is laid out,
- DECL_VINDEX may point to a FUNCTION_DECL in a base class which
- is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual
- function. When the class is laid out, this pointer is changed
- to an INTEGER_CST node which is suitable for use as an index
- into the virtual function table. */
-#define DECL_VINDEX(NODE) ((NODE)->decl.vindex)
-/* For FIELD_DECLS, DECL_FCONTEXT is the *first* baseclass in
- which this FIELD_DECL is defined. This information is needed when
- writing debugging information about vfield and vbase decls for C++. */
-#define DECL_FCONTEXT(NODE) ((NODE)->decl.vindex)
-
-/* Every ..._DECL node gets a unique number. */
-#define DECL_UID(NODE) ((NODE)->decl.uid)
-
-/* For any sort of a ..._DECL node, this points to the original (abstract)
- decl node which this decl is an instance of, or else it is NULL indicating
- that this decl is not an instance of some other decl. */
-#define DECL_ABSTRACT_ORIGIN(NODE) ((NODE)->decl.abstract_origin)
-
-/* Nonzero for any sort of ..._DECL node means this decl node represents
- an inline instance of some original (abstract) decl from an inline function;
- suppress any warnings about shadowing some other variable. */
-#define DECL_FROM_INLINE(NODE) (DECL_ABSTRACT_ORIGIN (NODE) != (tree) 0)
-
-/* Nonzero if a _DECL means that the name of this decl should be ignored
- for symbolic debug purposes. */
-#define DECL_IGNORED_P(NODE) ((NODE)->decl.ignored_flag)
-
-/* Nonzero for a given ..._DECL node means that this node represents an
- "abstract instance" of the given declaration (e.g. in the original
- declaration of an inline function). When generating symbolic debugging
- information, we mustn't try to generate any address information for nodes
- marked as "abstract instances" because we don't actually generate
- any code or allocate any data space for such instances. */
-#define DECL_ABSTRACT(NODE) ((NODE)->decl.abstract_flag)
-
-/* Nonzero if a _DECL means that no warnings should be generated just
- because this decl is unused. */
-#define DECL_IN_SYSTEM_HEADER(NODE) ((NODE)->decl.in_system_header_flag)
-
-/* Nonzero for a given ..._DECL node means that this node should be
- put in .common, if possible. If a DECL_INITIAL is given, and it
- is not error_mark_node, then the decl cannot be put in .common. */
-#define DECL_COMMON(NODE) ((NODE)->decl.common_flag)
-
-/* Language-specific decl information. */
-#define DECL_LANG_SPECIFIC(NODE) ((NODE)->decl.lang_specific)
-
-/* In a VAR_DECL or FUNCTION_DECL,
- nonzero means external reference:
- do not allocate storage, and refer to a definition elsewhere. */
-#define DECL_EXTERNAL(NODE) ((NODE)->decl.external_flag)
-
-/* In a TYPE_DECL
- nonzero means the detail info about this type is not dumped into stabs.
- Instead it will generate cross reference ('x') of names.
- This uses the same flag as DECL_EXTERNAL. */
-#define TYPE_DECL_SUPPRESS_DEBUG(NODE) ((NODE)->decl.external_flag)
-
-
-/* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'. */
-#define DECL_REGISTER(NODE) ((NODE)->decl.regdecl_flag)
-/* In LABEL_DECL nodes, nonzero means that an error message about
- jumping into such a binding contour has been printed for this label. */
-#define DECL_ERROR_ISSUED(NODE) ((NODE)->decl.regdecl_flag)
-/* In a FIELD_DECL, indicates this field should be bit-packed. */
-#define DECL_PACKED(NODE) ((NODE)->decl.regdecl_flag)
-/* In a FUNCTION_DECL with a non-zero DECL_CONTEXT, indicates that a
- static chain is not needed. */
-#define DECL_NO_STATIC_CHAIN(NODE) ((NODE)->decl.regdecl_flag)
-
-/* Nonzero in a ..._DECL means this variable is ref'd from a nested function.
- For VAR_DECL nodes, PARM_DECL nodes, and FUNCTION_DECL nodes.
-
- For LABEL_DECL nodes, nonzero if nonlocal gotos to the label are permitted.
-
- Also set in some languages for variables, etc., outside the normal
- lexical scope, such as class instance variables. */
-#define DECL_NONLOCAL(NODE) ((NODE)->decl.nonlocal_flag)
-
-/* Nonzero in a FUNCTION_DECL means this function can be substituted
- where it is called. */
-#define DECL_INLINE(NODE) ((NODE)->decl.inline_flag)
-
-/* Nonzero in a FUNCTION_DECL means this is a built-in function
- that is not specified by ansi C and that users are supposed to be allowed
- to redefine for any purpose whatever. */
-#define DECL_BUILT_IN_NONANSI(NODE) ((NODE)->common.unsigned_flag)
-
-/* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed
- specially. */
-#define DECL_BIT_FIELD(NODE) ((NODE)->decl.bit_field_flag)
-/* In a LABEL_DECL, nonzero means label was defined inside a binding
- contour that restored a stack level and which is now exited. */
-#define DECL_TOO_LATE(NODE) ((NODE)->decl.bit_field_flag)
-/* In a FUNCTION_DECL, nonzero means a built in function. */
-#define DECL_BUILT_IN(NODE) ((NODE)->decl.bit_field_flag)
-/* In a VAR_DECL that's static,
- nonzero if the space is in the text section. */
-#define DECL_IN_TEXT_SECTION(NODE) ((NODE)->decl.bit_field_flag)
-
-/* Used in VAR_DECLs to indicate that the variable is a vtable.
- Used in FIELD_DECLs for vtable pointers.
- Used in FUNCTION_DECLs to indicate that the function is virtual. */
-#define DECL_VIRTUAL_P(NODE) ((NODE)->decl.virtual_flag)
-
-/* Used to indicate that the linkage status of this DECL is not yet known,
- so it should not be output now. */
-#define DECL_DEFER_OUTPUT(NODE) ((NODE)->decl.defer_output)
-
-/* Used in PARM_DECLs whose type are unions to indicate that the
- argument should be passed in the same way that the first union
- alternative would be passed. */
-#define DECL_TRANSPARENT_UNION(NODE) ((NODE)->decl.transparent_union)
-
-/* Used in FUNCTION_DECLs to indicate that they should be run automatically
- at the beginning or end of execution. */
-#define DECL_STATIC_CONSTRUCTOR(NODE) ((NODE)->decl.static_ctor_flag)
-#define DECL_STATIC_DESTRUCTOR(NODE) ((NODE)->decl.static_dtor_flag)
-
-/* Used to indicate that this DECL represents a compiler-generated entity. */
-#define DECL_ARTIFICIAL(NODE) ((NODE)->decl.artificial_flag)
-
-/* Used to indicate that this DECL has weak linkage. */
-#define DECL_WEAK(NODE) ((NODE)->decl.weak_flag)
-
-/* Used in TREE_PUBLIC decls to indicate that copies of this DECL in
- multiple translation units should be merged. */
-#define DECL_ONE_ONLY(NODE) ((NODE)->decl.transparent_union)
-
-/* Additional flags for language-specific uses. */
-#define DECL_LANG_FLAG_0(NODE) ((NODE)->decl.lang_flag_0)
-#define DECL_LANG_FLAG_1(NODE) ((NODE)->decl.lang_flag_1)
-#define DECL_LANG_FLAG_2(NODE) ((NODE)->decl.lang_flag_2)
-#define DECL_LANG_FLAG_3(NODE) ((NODE)->decl.lang_flag_3)
-#define DECL_LANG_FLAG_4(NODE) ((NODE)->decl.lang_flag_4)
-#define DECL_LANG_FLAG_5(NODE) ((NODE)->decl.lang_flag_5)
-#define DECL_LANG_FLAG_6(NODE) ((NODE)->decl.lang_flag_6)
-#define DECL_LANG_FLAG_7(NODE) ((NODE)->decl.lang_flag_7)
-
-struct tree_decl
-{
- char common[sizeof (struct tree_common)];
- char *filename;
- int linenum;
- unsigned int uid;
- union tree_node *size;
-#ifdef ONLY_INT_FIELDS
- int mode : 8;
-#else
- enum machine_mode mode : 8;
-#endif
-
- unsigned external_flag : 1;
- unsigned nonlocal_flag : 1;
- unsigned regdecl_flag : 1;
- unsigned inline_flag : 1;
- unsigned bit_field_flag : 1;
- unsigned virtual_flag : 1;
- unsigned ignored_flag : 1;
- unsigned abstract_flag : 1;
-
- unsigned in_system_header_flag : 1;
- unsigned common_flag : 1;
- unsigned defer_output : 1;
- unsigned transparent_union : 1;
- unsigned static_ctor_flag : 1;
- unsigned static_dtor_flag : 1;
- unsigned artificial_flag : 1;
- unsigned weak_flag : 1;
- /* room for no more */
-
- unsigned lang_flag_0 : 1;
- unsigned lang_flag_1 : 1;
- unsigned lang_flag_2 : 1;
- unsigned lang_flag_3 : 1;
- unsigned lang_flag_4 : 1;
- unsigned lang_flag_5 : 1;
- unsigned lang_flag_6 : 1;
- unsigned lang_flag_7 : 1;
-
- /* For a FUNCTION_DECL, if inline, this is the size of frame needed.
- If built-in, this is the code for which built-in function.
- For other kinds of decls, this is DECL_ALIGN. */
- union {
- int i;
- unsigned int u;
- enum built_in_function f;
- } frame_size;
-
- union tree_node *name;
- union tree_node *context;
- union tree_node *arguments;
- union tree_node *result;
- union tree_node *initial;
- union tree_node *abstract_origin;
- union tree_node *assembler_name;
- union tree_node *section_name;
- union tree_node *machine_attributes;
- struct rtx_def *rtl; /* acts as link to register transfer language
- (rtl) info */
- /* For FUNCTION_DECLs: points to insn that constitutes its definition
- on the permanent obstack. For any other kind of decl, this is the
- alignment. */
- union {
- struct rtx_def *r;
- HOST_WIDE_INT i;
- } saved_insns;
- union tree_node *vindex;
- /* Points to a structure whose details depend on the language in use. */
- struct lang_decl *lang_specific;
-};
-
-/* Define the overall contents of a tree node.
- It may be any of the structures declared above
- for various types of node. */
-
-union tree_node
-{
- struct tree_common common;
- struct tree_int_cst int_cst;
- struct tree_real_cst real_cst;
- struct tree_string string;
- struct tree_complex complex;
- struct tree_identifier identifier;
- struct tree_decl decl;
- struct tree_type type;
- struct tree_list list;
- struct tree_vec vec;
- struct tree_exp exp;
- struct tree_block block;
- };
-
-#include "gansidecl.h"
-
-#define NULL_TREE (tree) NULL
-
-/* The following functions accept a wide integer argument. Rather than
- having to cast on every function call, we use a macro instead, that is
- defined here and in rtl.h. */
-
-#ifndef exact_log2
-#define exact_log2(N) exact_log2_wide ((HOST_WIDE_INT) (N))
-#define floor_log2(N) floor_log2_wide ((HOST_WIDE_INT) (N))
-#endif
-
-#if 0
-/* At present, don't prototype xrealloc, since all of the callers don't
- cast their pointers to char *, and all of the xrealloc's don't use
- void * yet. */
-extern char *xmalloc PROTO((size_t));
-extern char *xrealloc PROTO((void *, size_t));
-#else
-extern char *xmalloc ();
-extern char *xrealloc ();
-#endif
-
-extern char *xstrdup PROTO((char *));
-
-extern char *oballoc PROTO((int));
-extern char *permalloc PROTO((int));
-extern char *savealloc PROTO((int));
-extern void free PROTO((void *));
-
-/* Lowest level primitive for allocating a node.
- The TREE_CODE is the only argument. Contents are initialized
- to zero except for a few of the common fields. */
-
-extern tree make_node PROTO((enum tree_code));
-
-/* Make a copy of a node, with all the same contents except
- for TREE_PERMANENT. (The copy is permanent
- iff nodes being made now are permanent.) */
-
-extern tree copy_node PROTO((tree));
-
-/* Make a copy of a chain of TREE_LIST nodes. */
-
-extern tree copy_list PROTO((tree));
-
-/* Make a TREE_VEC. */
-
-extern tree make_tree_vec PROTO((int));
-
-/* Return the (unique) IDENTIFIER_NODE node for a given name.
- The name is supplied as a char *. */
-
-extern tree get_identifier PROTO((char *));
-
-/* If an identifier with the name TEXT (a null-terminated string) has
- previously been referred to, return that node; otherwise return
- NULL_TREE. */
-
-extern tree maybe_get_identifier PROTO((char *));
-
-/* Construct various types of nodes. */
-
-#define build_int_2(LO,HI) \
- build_int_2_wide ((HOST_WIDE_INT) (LO), (HOST_WIDE_INT) (HI))
-
-extern tree build PVPROTO((enum tree_code, tree, ...));
-extern tree build_nt PVPROTO((enum tree_code, ...));
-extern tree build_parse_node PVPROTO((enum tree_code, ...));
-
-extern tree build_int_2_wide PROTO((HOST_WIDE_INT, HOST_WIDE_INT));
-extern tree build_real PROTO((tree, REAL_VALUE_TYPE));
-extern tree build_real_from_int_cst PROTO((tree, tree));
-extern tree build_complex PROTO((tree, tree, tree));
-extern tree build_string PROTO((int, char *));
-extern tree build1 PROTO((enum tree_code, tree, tree));
-extern tree build_tree_list PROTO((tree, tree));
-extern tree build_decl_list PROTO((tree, tree));
-extern tree build_decl PROTO((enum tree_code, tree, tree));
-extern tree build_block PROTO((tree, tree, tree, tree, tree));
-
-/* Construct various nodes representing data types. */
-
-extern tree make_signed_type PROTO((int));
-extern tree make_unsigned_type PROTO((int));
-extern tree signed_or_unsigned_type PROTO((int, tree));
-extern void fixup_unsigned_type PROTO((tree));
-extern tree build_pointer_type PROTO((tree));
-extern tree build_reference_type PROTO((tree));
-extern tree build_index_type PROTO((tree));
-extern tree build_index_2_type PROTO((tree, tree));
-extern tree build_array_type PROTO((tree, tree));
-extern tree build_function_type PROTO((tree, tree));
-extern tree build_method_type PROTO((tree, tree));
-extern tree build_offset_type PROTO((tree, tree));
-extern tree build_complex_type PROTO((tree));
-extern tree array_type_nelts PROTO((tree));
-
-extern tree value_member PROTO((tree, tree));
-extern tree purpose_member PROTO((tree, tree));
-extern tree binfo_member PROTO((tree, tree));
-extern int attribute_hash_list PROTO((tree));
-extern int attribute_list_equal PROTO((tree, tree));
-extern int attribute_list_contained PROTO((tree, tree));
-extern int tree_int_cst_equal PROTO((tree, tree));
-extern int tree_int_cst_lt PROTO((tree, tree));
-extern int tree_int_cst_sgn PROTO((tree));
-extern int index_type_equal PROTO((tree, tree));
-
-/* From expmed.c. Since rtl.h is included after tree.h, we can't
- put the prototype here. Rtl.h does declare the prototype if
- tree.h had been included. */
-
-extern tree make_tree ();
-
-/* Return a type like TTYPE except that its TYPE_ATTRIBUTES
- is ATTRIBUTE.
-
- Such modified types already made are recorded so that duplicates
- are not made. */
-
-extern tree build_type_attribute_variant PROTO((tree, tree));
-extern tree build_decl_attribute_variant PROTO((tree, tree));
-
-/* Return 1 if an attribute and its arguments are valid for a decl or type. */
-
-extern int valid_machine_attribute PROTO((tree, tree, tree, tree));
-
-/* Given a tree node and a string, return non-zero if the tree node is
- a valid attribute name for the string. */
-
-extern int is_attribute_p PROTO((char *, tree));
-
-/* Given an attribute name and a list of attributes, return the list element
- of the attribute or NULL_TREE if not found. */
-
-extern tree lookup_attribute PROTO((char *, tree));
-
-/* Given two attributes lists, return a list of their union. */
-
-extern tree merge_attributes PROTO((tree, tree));
-
-/* Given a type node TYPE, and CONSTP and VOLATILEP, return a type
- for the same kind of data as TYPE describes.
- Variants point to the "main variant" (which has neither CONST nor VOLATILE)
- via TYPE_MAIN_VARIANT, and it points to a chain of other variants
- so that duplicate variants are never made.
- Only main variants should ever appear as types of expressions. */
-
-extern tree build_type_variant PROTO((tree, int, int));
-
-/* Make a copy of a type node. */
-
-extern tree build_type_copy PROTO((tree));
-
-/* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT,
- TYPE_ALIGN and TYPE_MODE fields.
- If called more than once on one node, does nothing except
- for the first time. */
-
-extern void layout_type PROTO((tree));
-
-/* Given a hashcode and a ..._TYPE node (for which the hashcode was made),
- return a canonicalized ..._TYPE node, so that duplicates are not made.
- How the hash code is computed is up to the caller, as long as any two
- callers that could hash identical-looking type nodes agree. */
-
-extern tree type_hash_canon PROTO((int, tree));
-
-/* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node,
- calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE
- fields. Call this only once for any given decl node.
-
- Second argument is the boundary that this field can be assumed to
- be starting at (in bits). Zero means it can be assumed aligned
- on any boundary that may be needed. */
-
-extern void layout_decl PROTO((tree, unsigned));
-
-/* Return an expr equal to X but certainly not valid as an lvalue. */
-
-extern tree non_lvalue PROTO((tree));
-extern tree pedantic_non_lvalue PROTO((tree));
-
-extern tree convert PROTO((tree, tree));
-extern tree size_in_bytes PROTO((tree));
-extern int int_size_in_bytes PROTO((tree));
-extern tree size_binop PROTO((enum tree_code, tree, tree));
-extern tree size_int PROTO((unsigned HOST_WIDE_INT));
-extern tree round_up PROTO((tree, int));
-extern tree get_pending_sizes PROTO((void));
-extern void put_pending_sizes PROTO((tree));
-
-/* Type for sizes of data-type. */
-
-extern tree sizetype;
-
-/* If nonzero, an upper limit on alignment of structure fields, in bits. */
-extern int maximum_field_alignment;
-
-/* If non-zero, the alignment of a bitstring or (power-)set value, in bits. */
-extern int set_alignment;
-
-/* Concatenate two lists (chains of TREE_LIST nodes) X and Y
- by making the last node in X point to Y.
- Returns X, except if X is 0 returns Y. */
-
-extern tree chainon PROTO((tree, tree));
-
-/* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */
-
-extern tree tree_cons PROTO((tree, tree, tree));
-extern tree perm_tree_cons PROTO((tree, tree, tree));
-extern tree temp_tree_cons PROTO((tree, tree, tree));
-extern tree saveable_tree_cons PROTO((tree, tree, tree));
-extern tree decl_tree_cons PROTO((tree, tree, tree));
-
-/* Return the last tree node in a chain. */
-
-extern tree tree_last PROTO((tree));
-
-/* Reverse the order of elements in a chain, and return the new head. */
-
-extern tree nreverse PROTO((tree));
-
-/* Returns the length of a chain of nodes
- (number of chain pointers to follow before reaching a null pointer). */
-
-extern int list_length PROTO((tree));
-
-/* integer_zerop (tree x) is nonzero if X is an integer constant of value 0 */
-
-extern int integer_zerop PROTO((tree));
-
-/* integer_onep (tree x) is nonzero if X is an integer constant of value 1 */
-
-extern int integer_onep PROTO((tree));
-
-/* integer_all_onesp (tree x) is nonzero if X is an integer constant
- all of whose significant bits are 1. */
-
-extern int integer_all_onesp PROTO((tree));
-
-/* integer_pow2p (tree x) is nonzero is X is an integer constant with
- exactly one bit 1. */
-
-extern int integer_pow2p PROTO((tree));
-
-/* staticp (tree x) is nonzero if X is a reference to data allocated
- at a fixed address in memory. */
-
-extern int staticp PROTO((tree));
-
-/* Gets an error if argument X is not an lvalue.
- Also returns 1 if X is an lvalue, 0 if not. */
-
-extern int lvalue_or_else PROTO((tree, char *));
-
-/* save_expr (EXP) returns an expression equivalent to EXP
- but it can be used multiple times within context CTX
- and only evaluate EXP once. */
-
-extern tree save_expr PROTO((tree));
-
-/* unsave_expr (EXP) returns an expression equivalent to EXP but it
- can be used multiple times and will evaluate EXP, in it's entirety
- each time. */
-
-extern tree unsave_expr PROTO((tree));
-
-/* unsave_expr_now (EXP) resets EXP in place, so that it can be
- expanded again. */
-
-extern tree unsave_expr_now PROTO((tree));
-
-/* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size
- or offset that depends on a field within a record.
-
- Note that we only allow such expressions within simple arithmetic
- or a COND_EXPR. */
-
-extern int contains_placeholder_p PROTO((tree));
-
-/* Given a tree EXP, a FIELD_DECL F, and a replacement value R,
- return a tree with all occurrences of references to F in a
- PLACEHOLDER_EXPR replaced by R. Note that we assume here that EXP
- contains only arithmetic expressions. */
-
-extern tree substitute_in_expr PROTO((tree, tree, tree));
-
-/* variable_size (EXP) is like save_expr (EXP) except that it
- is for the special case of something that is part of a
- variable size for a data type. It makes special arrangements
- to compute the value at the right time when the data type
- belongs to a function parameter. */
-
-extern tree variable_size PROTO((tree));
-
-/* stabilize_reference (EXP) returns an reference equivalent to EXP
- but it can be used multiple times
- and only evaluate the subexpressions once. */
-
-extern tree stabilize_reference PROTO((tree));
-
-/* Subroutine of stabilize_reference; this is called for subtrees of
- references. Any expression with side-effects must be put in a SAVE_EXPR
- to ensure that it is only evaluated once. */
-
-extern tree stabilize_reference_1 PROTO((tree));
-
-/* Return EXP, stripped of any conversions to wider types
- in such a way that the result of converting to type FOR_TYPE
- is the same as if EXP were converted to FOR_TYPE.
- If FOR_TYPE is 0, it signifies EXP's type. */
-
-extern tree get_unwidened PROTO((tree, tree));
-
-/* Return OP or a simpler expression for a narrower value
- which can be sign-extended or zero-extended to give back OP.
- Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended
- or 0 if the value should be sign-extended. */
-
-extern tree get_narrower PROTO((tree, int *));
-
-/* Given MODE and UNSIGNEDP, return a suitable type-tree
- with that mode.
- The definition of this resides in language-specific code
- as the repertoire of available types may vary. */
-
-extern tree type_for_mode PROTO((enum machine_mode, int));
-
-/* Given PRECISION and UNSIGNEDP, return a suitable type-tree
- for an integer type with at least that precision.
- The definition of this resides in language-specific code
- as the repertoire of available types may vary. */
-
-extern tree type_for_size PROTO((unsigned, int));
-
-/* Given an integer type T, return a type like T but unsigned.
- If T is unsigned, the value is T.
- The definition of this resides in language-specific code
- as the repertoire of available types may vary. */
-
-extern tree unsigned_type PROTO((tree));
-
-/* Given an integer type T, return a type like T but signed.
- If T is signed, the value is T.
- The definition of this resides in language-specific code
- as the repertoire of available types may vary. */
-
-extern tree signed_type PROTO((tree));
-
-/* This function must be defined in the language-specific files.
- expand_expr calls it to build the cleanup-expression for a TARGET_EXPR.
- This is defined in a language-specific file. */
-
-extern tree maybe_build_cleanup PROTO((tree));
-
-/* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF,
- look for nested component-refs or array-refs at constant positions
- and find the ultimate containing object, which is returned. */
-
-extern tree get_inner_reference PROTO((tree, int *, int *, tree *,
- enum machine_mode *, int *,
- int *, int *));
-
-/* Return the FUNCTION_DECL which provides this _DECL with its context,
- or zero if none. */
-extern tree decl_function_context PROTO((tree));
-
-/* Return the RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE which provides
- this _DECL with its context, or zero if none. */
-extern tree decl_type_context PROTO((tree));
-
-/* Given the FUNCTION_DECL for the current function,
- return zero if it is ok for this function to be inline.
- Otherwise return a warning message with a single %s
- for the function's name. */
-
-extern char *function_cannot_inline_p PROTO((tree));
-
-/* Return 1 if EXPR is the real constant zero. */
-extern int real_zerop PROTO((tree));
-
-/* Declare commonly used variables for tree structure. */
-
-/* An integer constant with value 0 */
-extern tree integer_zero_node;
-
-/* An integer constant with value 1 */
-extern tree integer_one_node;
-
-/* An integer constant with value 0 whose type is sizetype. */
-extern tree size_zero_node;
-
-/* An integer constant with value 1 whose type is sizetype. */
-extern tree size_one_node;
-
-/* A constant of type pointer-to-int and value 0 */
-extern tree null_pointer_node;
-
-/* A node of type ERROR_MARK. */
-extern tree error_mark_node;
-
-/* The type node for the void type. */
-extern tree void_type_node;
-
-/* The type node for the ordinary (signed) integer type. */
-extern tree integer_type_node;
-
-/* The type node for the unsigned integer type. */
-extern tree unsigned_type_node;
-
-/* The type node for the ordinary character type. */
-extern tree char_type_node;
-
-/* Points to the name of the input file from which the current input
- being parsed originally came (before it went into cpp). */
-extern char *input_filename;
-
-/* Current line number in input file. */
-extern int lineno;
-
-/* Nonzero for -pedantic switch: warn about anything
- that standard C forbids. */
-extern int pedantic;
-
-/* Nonzero means lvalues are limited to those valid in pedantic ANSI C.
- Zero means allow extended lvalues. */
-
-extern int pedantic_lvalues;
-
-/* Nonzero means can safely call expand_expr now;
- otherwise layout_type puts variable sizes onto `pending_sizes' instead. */
-
-extern int immediate_size_expand;
-
-/* Points to the FUNCTION_DECL of the function whose body we are reading. */
-
-extern tree current_function_decl;
-
-/* Nonzero if function being compiled can call setjmp. */
-
-extern int current_function_calls_setjmp;
-
-/* Nonzero if function being compiled can call longjmp. */
-
-extern int current_function_calls_longjmp;
-
-/* Nonzero means all ..._TYPE nodes should be allocated permanently. */
-
-extern int all_types_permanent;
-
-/* Pointer to function to compute the name to use to print a declaration.
- DECL is the declaration in question.
- VERBOSITY determines what information will be printed:
- 0: DECL_NAME, demangled as necessary.
- 1: and scope information.
- 2: and any other information that might be interesting, such as function
- parameter types in C++. */
-
-extern char *(*decl_printable_name) (/* tree decl, int verbosity */);
-
-/* Pointer to function to finish handling an incomplete decl at the
- end of compilation. */
-
-extern void (*incomplete_decl_finalize_hook) ();
-
-/* In tree.c */
-extern char *perm_calloc PROTO((int, long));
-extern tree get_set_constructor_bits PROTO((tree, char *, int));
-extern tree get_set_constructor_bytes PROTO((tree,
- unsigned char *, int));
-
-/* In stmt.c */
-
-extern void expand_fixups PROTO((struct rtx_def *));
-extern tree expand_start_stmt_expr PROTO((void));
-extern tree expand_end_stmt_expr PROTO((tree));
-extern void expand_expr_stmt PROTO((tree));
-extern int warn_if_unused_value PROTO((tree));
-extern void expand_decl_init PROTO((tree));
-extern void clear_last_expr PROTO((void));
-extern void expand_label PROTO((tree));
-extern void expand_goto PROTO((tree));
-extern void expand_asm PROTO((tree));
-extern void expand_start_cond PROTO((tree, int));
-extern void expand_end_cond PROTO((void));
-extern void expand_start_else PROTO((void));
-extern void expand_start_elseif PROTO((tree));
-extern struct nesting *expand_start_loop PROTO((int));
-extern struct nesting *expand_start_loop_continue_elsewhere PROTO((int));
-extern void expand_loop_continue_here PROTO((void));
-extern void expand_end_loop PROTO((void));
-extern int expand_continue_loop PROTO((struct nesting *));
-extern int expand_exit_loop PROTO((struct nesting *));
-extern int expand_exit_loop_if_false PROTO((struct nesting *,
- tree));
-extern int expand_exit_something PROTO((void));
-
-extern void expand_null_return PROTO((void));
-extern void expand_return PROTO((tree));
-extern void expand_start_bindings PROTO((int));
-extern void expand_end_bindings PROTO((tree, int, int));
-extern tree last_cleanup_this_contour PROTO((void));
-extern void expand_start_case PROTO((int, tree, tree,
- char *));
-extern void expand_end_case PROTO((tree));
-extern int pushcase PROTO((tree,
- tree (*) (tree, tree),
- tree, tree *));
-extern int pushcase_range PROTO((tree, tree,
- tree (*) (tree, tree),
- tree, tree *));
-
-/* In fold-const.c */
-
-/* Fold constants as much as possible in an expression.
- Returns the simplified expression.
- Acts only on the top level of the expression;
- if the argument itself cannot be simplified, its
- subexpressions are not changed. */
-
-extern tree fold PROTO((tree));
-
-extern int force_fit_type PROTO((tree, int));
-extern int add_double PROTO((HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT *, HOST_WIDE_INT *));
-extern int neg_double PROTO((HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT *, HOST_WIDE_INT *));
-extern int mul_double PROTO((HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT *, HOST_WIDE_INT *));
-extern void lshift_double PROTO((HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT, int, HOST_WIDE_INT *,
- HOST_WIDE_INT *, int));
-extern void rshift_double PROTO((HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT, int,
- HOST_WIDE_INT *, HOST_WIDE_INT *, int));
-extern void lrotate_double PROTO((HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT, int, HOST_WIDE_INT *,
- HOST_WIDE_INT *));
-extern void rrotate_double PROTO((HOST_WIDE_INT, HOST_WIDE_INT,
- HOST_WIDE_INT, int, HOST_WIDE_INT *,
- HOST_WIDE_INT *));
-extern int operand_equal_p PROTO((tree, tree, int));
-extern tree invert_truthvalue PROTO((tree));
-
-/* The language front-end must define these functions. */
-
-/* Function of no arguments for initializing lexical scanning. */
-extern void init_lex PROTO((void));
-/* Function of no arguments for initializing the symbol table. */
-extern void init_decl_processing PROTO((void));
-
-/* Functions called with no arguments at the beginning and end or processing
- the input source file. */
-extern void lang_init PROTO((void));
-extern void lang_finish PROTO((void));
-
-/* Function to identify which front-end produced the output file. */
-extern char *lang_identify PROTO((void));
-
-/* Function to replace the DECL_LANG_SPECIFIC field of a DECL with a copy. */
-extern void copy_lang_decl PROTO((tree));
-
-/* Function called with no arguments to parse and compile the input. */
-extern int yyparse PROTO((void));
-/* Function called with option as argument
- to decode options starting with -f or -W or +.
- It should return nonzero if it handles the option. */
-extern int lang_decode_option PROTO((char *));
-
-/* Functions for processing symbol declarations. */
-/* Function to enter a new lexical scope.
- Takes one argument: always zero when called from outside the front end. */
-extern void pushlevel PROTO((int));
-/* Function to exit a lexical scope. It returns a BINDING for that scope.
- Takes three arguments:
- KEEP -- nonzero if there were declarations in this scope.
- REVERSE -- reverse the order of decls before returning them.
- FUNCTIONBODY -- nonzero if this level is the body of a function. */
-extern tree poplevel PROTO((int, int, int));
-/* Set the BLOCK node for the current scope level. */
-extern void set_block PROTO((tree));
-/* Function to add a decl to the current scope level.
- Takes one argument, a decl to add.
- Returns that decl, or, if the same symbol is already declared, may
- return a different decl for that name. */
-extern tree pushdecl PROTO((tree));
-/* Function to return the chain of decls so far in the current scope level. */
-extern tree getdecls PROTO((void));
-/* Function to return the chain of structure tags in the current scope level. */
-extern tree gettags PROTO((void));
-
-extern tree build_range_type PROTO((tree, tree, tree));
-
-/* Call when starting to parse a declaration:
- make expressions in the declaration last the length of the function.
- Returns an argument that should be passed to resume_momentary later. */
-extern int suspend_momentary PROTO((void));
-
-extern int allocation_temporary_p PROTO((void));
-
-/* Call when finished parsing a declaration:
- restore the treatment of node-allocation that was
- in effect before the suspension.
- YES should be the value previously returned by suspend_momentary. */
-extern void resume_momentary PROTO((int));
-
-/* Called after finishing a record, union or enumeral type. */
-extern void rest_of_type_compilation PROTO((tree, int));
-
-/* Save the current set of obstacks, but don't change them. */
-extern void push_obstacks_nochange PROTO((void));
-
-extern void permanent_allocation PROTO((int));
-
-extern void push_momentary PROTO((void));
-
-extern void clear_momentary PROTO((void));
-
-extern void pop_momentary PROTO((void));
-
-extern void end_temporary_allocation PROTO((void));
-
-/* Pop the obstack selection stack. */
-extern void pop_obstacks PROTO((void));
diff --git a/gcc/typeclass.h b/gcc/typeclass.h
deleted file mode 100644
index b1660425361..00000000000
--- a/gcc/typeclass.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Values returned by __builtin_classify_type. */
-
-enum type_class
-{
- no_type_class = -1,
- void_type_class, integer_type_class, char_type_class,
- enumeral_type_class, boolean_type_class,
- pointer_type_class, reference_type_class, offset_type_class,
- real_type_class, complex_type_class,
- function_type_class, method_type_class,
- record_type_class, union_type_class,
- array_type_class, string_type_class, set_type_class, file_type_class,
- lang_type_class
-};
diff --git a/gcc/unprotoize.c b/gcc/unprotoize.c
deleted file mode 100644
index bfdb7d2e018..00000000000
--- a/gcc/unprotoize.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "protoize.c"
diff --git a/gcc/unroll.c b/gcc/unroll.c
deleted file mode 100644
index 2ab6b2a16bc..00000000000
--- a/gcc/unroll.c
+++ /dev/null
@@ -1,3625 +0,0 @@
-/* Try to unroll loops, and split induction variables.
- Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
- Contributed by James E. Wilson, Cygnus Support/UC Berkeley.
-
-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. */
-
-/* Try to unroll a loop, and split induction variables.
-
- Loops for which the number of iterations can be calculated exactly are
- handled specially. If the number of iterations times the insn_count is
- less than MAX_UNROLLED_INSNS, then the loop is unrolled completely.
- Otherwise, we try to unroll the loop a number of times modulo the number
- of iterations, so that only one exit test will be needed. It is unrolled
- a number of times approximately equal to MAX_UNROLLED_INSNS divided by
- the insn count.
-
- Otherwise, if the number of iterations can be calculated exactly at
- run time, and the loop is always entered at the top, then we try to
- precondition the loop. That is, at run time, calculate how many times
- the loop will execute, and then execute the loop body a few times so
- that the remaining iterations will be some multiple of 4 (or 2 if the
- loop is large). Then fall through to a loop unrolled 4 (or 2) times,
- with only one exit test needed at the end of the loop.
-
- Otherwise, if the number of iterations can not be calculated exactly,
- not even at run time, then we still unroll the loop a number of times
- approximately equal to MAX_UNROLLED_INSNS divided by the insn count,
- but there must be an exit test after each copy of the loop body.
-
- For each induction variable, which is dead outside the loop (replaceable)
- or for which we can easily calculate the final value, if we can easily
- calculate its value at each place where it is set as a function of the
- current loop unroll count and the variable's value at loop entry, then
- the induction variable is split into `N' different variables, one for
- each copy of the loop body. One variable is live across the backward
- branch, and the others are all calculated as a function of this variable.
- This helps eliminate data dependencies, and leads to further opportunities
- for cse. */
-
-/* Possible improvements follow: */
-
-/* ??? Add an extra pass somewhere to determine whether unrolling will
- give any benefit. E.g. after generating all unrolled insns, compute the
- cost of all insns and compare against cost of insns in rolled loop.
-
- - On traditional architectures, unrolling a non-constant bound loop
- is a win if there is a giv whose only use is in memory addresses, the
- memory addresses can be split, and hence giv increments can be
- eliminated.
- - It is also a win if the loop is executed many times, and preconditioning
- can be performed for the loop.
- Add code to check for these and similar cases. */
-
-/* ??? Improve control of which loops get unrolled. Could use profiling
- info to only unroll the most commonly executed loops. Perhaps have
- a user specifyable option to control the amount of code expansion,
- or the percent of loops to consider for unrolling. Etc. */
-
-/* ??? Look at the register copies inside the loop to see if they form a
- simple permutation. If so, iterate the permutation until it gets back to
- the start state. This is how many times we should unroll the loop, for
- best results, because then all register copies can be eliminated.
- For example, the lisp nreverse function should be unrolled 3 times
- while (this)
- {
- next = this->cdr;
- this->cdr = prev;
- prev = this;
- this = next;
- }
-
- ??? The number of times to unroll the loop may also be based on data
- references in the loop. For example, if we have a loop that references
- x[i-1], x[i], and x[i+1], we should unroll it a multiple of 3 times. */
-
-/* ??? Add some simple linear equation solving capability so that we can
- determine the number of loop iterations for more complex loops.
- For example, consider this loop from gdb
- #define SWAP_TARGET_AND_HOST(buffer,len)
- {
- char tmp;
- char *p = (char *) buffer;
- char *q = ((char *) buffer) + len - 1;
- int iterations = (len + 1) >> 1;
- int i;
- for (p; p < q; p++, q--;)
- {
- tmp = *q;
- *q = *p;
- *p = tmp;
- }
- }
- Note that:
- start value = p = &buffer + current_iteration
- end value = q = &buffer + len - 1 - current_iteration
- Given the loop exit test of "p < q", then there must be "q - p" iterations,
- set equal to zero and solve for number of iterations:
- q - p = len - 1 - 2*current_iteration = 0
- current_iteration = (len - 1) / 2
- Hence, there are (len - 1) / 2 (rounded up to the nearest integer)
- iterations of this loop. */
-
-/* ??? Currently, no labels are marked as loop invariant when doing loop
- unrolling. This is because an insn inside the loop, that loads the address
- of a label inside the loop into a register, could be moved outside the loop
- by the invariant code motion pass if labels were invariant. If the loop
- is subsequently unrolled, the code will be wrong because each unrolled
- body of the loop will use the same address, whereas each actually needs a
- different address. A case where this happens is when a loop containing
- a switch statement is unrolled.
-
- It would be better to let labels be considered invariant. When we
- unroll loops here, check to see if any insns using a label local to the
- loop were moved before the loop. If so, then correct the problem, by
- moving the insn back into the loop, or perhaps replicate the insn before
- the loop, one copy for each time the loop is unrolled. */
-
-/* The prime factors looked for when trying to unroll a loop by some
- number which is modulo the total number of iterations. Just checking
- for these 4 prime factors will find at least one factor for 75% of
- all numbers theoretically. Practically speaking, this will succeed
- almost all of the time since loops are generally a multiple of 2
- and/or 5. */
-
-#define NUM_FACTORS 4
-
-struct _factor { int factor, count; } factors[NUM_FACTORS]
- = { {2, 0}, {3, 0}, {5, 0}, {7, 0}};
-
-/* Describes the different types of loop unrolling performed. */
-
-enum unroll_types { UNROLL_COMPLETELY, UNROLL_MODULO, UNROLL_NAIVE };
-
-#include "config.h"
-#include "rtl.h"
-#include "insn-config.h"
-#include "integrate.h"
-#include "regs.h"
-#include "flags.h"
-#include "expr.h"
-#include <stdio.h>
-#include "loop.h"
-
-/* This controls which loops are unrolled, and by how much we unroll
- them. */
-
-#ifndef MAX_UNROLLED_INSNS
-#define MAX_UNROLLED_INSNS 100
-#endif
-
-/* Indexed by register number, if non-zero, then it contains a pointer
- to a struct induction for a DEST_REG giv which has been combined with
- one of more address givs. This is needed because whenever such a DEST_REG
- giv is modified, we must modify the value of all split address givs
- that were combined with this DEST_REG giv. */
-
-static struct induction **addr_combined_regs;
-
-/* Indexed by register number, if this is a splittable induction variable,
- then this will hold the current value of the register, which depends on the
- iteration number. */
-
-static rtx *splittable_regs;
-
-/* Indexed by register number, if this is a splittable induction variable,
- then this will hold the number of instructions in the loop that modify
- the induction variable. Used to ensure that only the last insn modifying
- a split iv will update the original iv of the dest. */
-
-static int *splittable_regs_updates;
-
-/* Values describing the current loop's iteration variable. These are set up
- by loop_iterations, and used by precondition_loop_p. */
-
-static rtx loop_iteration_var;
-static rtx loop_initial_value;
-static rtx loop_increment;
-static rtx loop_final_value;
-static enum rtx_code loop_comparison_code;
-
-/* Forward declarations. */
-
-static void init_reg_map PROTO((struct inline_remap *, int));
-static int precondition_loop_p PROTO((rtx *, rtx *, rtx *, rtx, rtx));
-static rtx calculate_giv_inc PROTO((rtx, rtx, int));
-static rtx initial_reg_note_copy PROTO((rtx, struct inline_remap *));
-static void final_reg_note_copy PROTO((rtx, struct inline_remap *));
-static void copy_loop_body PROTO((rtx, rtx, struct inline_remap *, rtx, int,
- enum unroll_types, rtx, rtx, rtx, rtx));
-static void iteration_info PROTO((rtx, rtx *, rtx *, rtx, rtx));
-static rtx approx_final_value PROTO((enum rtx_code, rtx, int *, int *));
-static int find_splittable_regs PROTO((enum unroll_types, rtx, rtx, rtx, int));
-static int find_splittable_givs PROTO((struct iv_class *,enum unroll_types,
- rtx, rtx, rtx, int));
-static int reg_dead_after_loop PROTO((rtx, rtx, rtx));
-static rtx fold_rtx_mult_add PROTO((rtx, rtx, rtx, enum machine_mode));
-static rtx remap_split_bivs PROTO((rtx));
-
-/* Try to unroll one loop and split induction variables in the loop.
-
- The loop is described by the arguments LOOP_END, INSN_COUNT, and
- LOOP_START. END_INSERT_BEFORE indicates where insns should be added
- which need to be executed when the loop falls through. STRENGTH_REDUCTION_P
- indicates whether information generated in the strength reduction pass
- is available.
-
- This function is intended to be called from within `strength_reduce'
- in loop.c. */
-
-void
-unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
- strength_reduce_p)
- rtx loop_end;
- int insn_count;
- rtx loop_start;
- rtx end_insert_before;
- int strength_reduce_p;
-{
- int i, j, temp;
- int unroll_number = 1;
- rtx copy_start, copy_end;
- rtx insn, copy, sequence, pattern, tem;
- int max_labelno, max_insnno;
- rtx insert_before;
- struct inline_remap *map;
- char *local_label;
- char *local_regno;
- int maxregnum;
- int new_maxregnum;
- rtx exit_label = 0;
- rtx start_label;
- struct iv_class *bl;
- int splitting_not_safe = 0;
- enum unroll_types unroll_type;
- int loop_preconditioned = 0;
- rtx safety_label;
- /* This points to the last real insn in the loop, which should be either
- a JUMP_INSN (for conditional jumps) or a BARRIER (for unconditional
- jumps). */
- rtx last_loop_insn;
-
- /* Don't bother unrolling huge loops. Since the minimum factor is
- two, loops greater than one half of MAX_UNROLLED_INSNS will never
- be unrolled. */
- if (insn_count > MAX_UNROLLED_INSNS / 2)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Unrolling failure: Loop too big.\n");
- return;
- }
-
- /* When emitting debugger info, we can't unroll loops with unequal numbers
- of block_beg and block_end notes, because that would unbalance the block
- structure of the function. This can happen as a result of the
- "if (foo) bar; else break;" optimization in jump.c. */
- /* ??? Gcc has a general policy that -g is never supposed to change the code
- that the compiler emits, so we must disable this optimization always,
- even if debug info is not being output. This is rare, so this should
- not be a significant performance problem. */
-
- if (1 /* write_symbols != NO_DEBUG */)
- {
- int block_begins = 0;
- int block_ends = 0;
-
- for (insn = loop_start; insn != loop_end; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
- block_begins++;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END)
- block_ends++;
- }
- }
-
- if (block_begins != block_ends)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Unrolling failure: Unbalanced block notes.\n");
- return;
- }
- }
-
- /* Determine type of unroll to perform. Depends on the number of iterations
- and the size of the loop. */
-
- /* If there is no strength reduce info, then set loop_n_iterations to zero.
- This can happen if strength_reduce can't find any bivs in the loop.
- A value of zero indicates that the number of iterations could not be
- calculated. */
-
- if (! strength_reduce_p)
- loop_n_iterations = 0;
-
- if (loop_dump_stream && loop_n_iterations > 0)
- fprintf (loop_dump_stream,
- "Loop unrolling: %d iterations.\n", loop_n_iterations);
-
- /* Find and save a pointer to the last nonnote insn in the loop. */
-
- last_loop_insn = prev_nonnote_insn (loop_end);
-
- /* Calculate how many times to unroll the loop. Indicate whether or
- not the loop is being completely unrolled. */
-
- if (loop_n_iterations == 1)
- {
- /* If number of iterations is exactly 1, then eliminate the compare and
- branch at the end of the loop since they will never be taken.
- Then return, since no other action is needed here. */
-
- /* If the last instruction is not a BARRIER or a JUMP_INSN, then
- don't do anything. */
-
- if (GET_CODE (last_loop_insn) == BARRIER)
- {
- /* Delete the jump insn. This will delete the barrier also. */
- delete_insn (PREV_INSN (last_loop_insn));
- }
- else if (GET_CODE (last_loop_insn) == JUMP_INSN)
- {
-#ifdef HAVE_cc0
- /* The immediately preceding insn is a compare which must be
- deleted. */
- delete_insn (last_loop_insn);
- delete_insn (PREV_INSN (last_loop_insn));
-#else
- /* The immediately preceding insn may not be the compare, so don't
- delete it. */
- delete_insn (last_loop_insn);
-#endif
- }
- return;
- }
- else if (loop_n_iterations > 0
- && loop_n_iterations * insn_count < MAX_UNROLLED_INSNS)
- {
- unroll_number = loop_n_iterations;
- unroll_type = UNROLL_COMPLETELY;
- }
- else if (loop_n_iterations > 0)
- {
- /* Try to factor the number of iterations. Don't bother with the
- general case, only using 2, 3, 5, and 7 will get 75% of all
- numbers theoretically, and almost all in practice. */
-
- for (i = 0; i < NUM_FACTORS; i++)
- factors[i].count = 0;
-
- temp = loop_n_iterations;
- for (i = NUM_FACTORS - 1; i >= 0; i--)
- while (temp % factors[i].factor == 0)
- {
- factors[i].count++;
- temp = temp / factors[i].factor;
- }
-
- /* Start with the larger factors first so that we generally
- get lots of unrolling. */
-
- unroll_number = 1;
- temp = insn_count;
- for (i = 3; i >= 0; i--)
- while (factors[i].count--)
- {
- if (temp * factors[i].factor < MAX_UNROLLED_INSNS)
- {
- unroll_number *= factors[i].factor;
- temp *= factors[i].factor;
- }
- else
- break;
- }
-
- /* If we couldn't find any factors, then unroll as in the normal
- case. */
- if (unroll_number == 1)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: No factors found.\n");
- }
- else
- unroll_type = UNROLL_MODULO;
- }
-
-
- /* Default case, calculate number of times to unroll loop based on its
- size. */
- if (unroll_number == 1)
- {
- if (8 * insn_count < MAX_UNROLLED_INSNS)
- unroll_number = 8;
- else if (4 * insn_count < MAX_UNROLLED_INSNS)
- unroll_number = 4;
- else
- unroll_number = 2;
-
- unroll_type = UNROLL_NAIVE;
- }
-
- /* Now we know how many times to unroll the loop. */
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Unrolling loop %d times.\n", unroll_number);
-
-
- if (unroll_type == UNROLL_COMPLETELY || unroll_type == UNROLL_MODULO)
- {
- /* Loops of these types should never start with a jump down to
- the exit condition test. For now, check for this case just to
- be sure. UNROLL_NAIVE loops can be of this form, this case is
- handled below. */
- insn = loop_start;
- while (GET_CODE (insn) != CODE_LABEL && GET_CODE (insn) != JUMP_INSN)
- insn = NEXT_INSN (insn);
- if (GET_CODE (insn) == JUMP_INSN)
- abort ();
- }
-
- if (unroll_type == UNROLL_COMPLETELY)
- {
- /* Completely unrolling the loop: Delete the compare and branch at
- the end (the last two instructions). This delete must done at the
- very end of loop unrolling, to avoid problems with calls to
- back_branch_in_range_p, which is called by find_splittable_regs.
- All increments of splittable bivs/givs are changed to load constant
- instructions. */
-
- copy_start = loop_start;
-
- /* Set insert_before to the instruction immediately after the JUMP_INSN
- (or BARRIER), so that any NOTEs between the JUMP_INSN and the end of
- the loop will be correctly handled by copy_loop_body. */
- insert_before = NEXT_INSN (last_loop_insn);
-
- /* Set copy_end to the insn before the jump at the end of the loop. */
- if (GET_CODE (last_loop_insn) == BARRIER)
- copy_end = PREV_INSN (PREV_INSN (last_loop_insn));
- else if (GET_CODE (last_loop_insn) == JUMP_INSN)
- {
-#ifdef HAVE_cc0
- /* The instruction immediately before the JUMP_INSN is a compare
- instruction which we do not want to copy. */
- copy_end = PREV_INSN (PREV_INSN (last_loop_insn));
-#else
- /* The instruction immediately before the JUMP_INSN may not be the
- compare, so we must copy it. */
- copy_end = PREV_INSN (last_loop_insn);
-#endif
- }
- else
- {
- /* We currently can't unroll a loop if it doesn't end with a
- JUMP_INSN. There would need to be a mechanism that recognizes
- this case, and then inserts a jump after each loop body, which
- jumps to after the last loop body. */
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Unrolling failure: loop does not end with a JUMP_INSN.\n");
- return;
- }
- }
- else if (unroll_type == UNROLL_MODULO)
- {
- /* Partially unrolling the loop: The compare and branch at the end
- (the last two instructions) must remain. Don't copy the compare
- and branch instructions at the end of the loop. Insert the unrolled
- code immediately before the compare/branch at the end so that the
- code will fall through to them as before. */
-
- copy_start = loop_start;
-
- /* Set insert_before to the jump insn at the end of the loop.
- Set copy_end to before the jump insn at the end of the loop. */
- if (GET_CODE (last_loop_insn) == BARRIER)
- {
- insert_before = PREV_INSN (last_loop_insn);
- copy_end = PREV_INSN (insert_before);
- }
- else if (GET_CODE (last_loop_insn) == JUMP_INSN)
- {
-#ifdef HAVE_cc0
- /* The instruction immediately before the JUMP_INSN is a compare
- instruction which we do not want to copy or delete. */
- insert_before = PREV_INSN (last_loop_insn);
- copy_end = PREV_INSN (insert_before);
-#else
- /* The instruction immediately before the JUMP_INSN may not be the
- compare, so we must copy it. */
- insert_before = last_loop_insn;
- copy_end = PREV_INSN (last_loop_insn);
-#endif
- }
- else
- {
- /* We currently can't unroll a loop if it doesn't end with a
- JUMP_INSN. There would need to be a mechanism that recognizes
- this case, and then inserts a jump after each loop body, which
- jumps to after the last loop body. */
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Unrolling failure: loop does not end with a JUMP_INSN.\n");
- return;
- }
- }
- else
- {
- /* Normal case: Must copy the compare and branch instructions at the
- end of the loop. */
-
- if (GET_CODE (last_loop_insn) == BARRIER)
- {
- /* Loop ends with an unconditional jump and a barrier.
- Handle this like above, don't copy jump and barrier.
- This is not strictly necessary, but doing so prevents generating
- unconditional jumps to an immediately following label.
-
- This will be corrected below if the target of this jump is
- not the start_label. */
-
- insert_before = PREV_INSN (last_loop_insn);
- copy_end = PREV_INSN (insert_before);
- }
- else if (GET_CODE (last_loop_insn) == JUMP_INSN)
- {
- /* Set insert_before to immediately after the JUMP_INSN, so that
- NOTEs at the end of the loop will be correctly handled by
- copy_loop_body. */
- insert_before = NEXT_INSN (last_loop_insn);
- copy_end = last_loop_insn;
- }
- else
- {
- /* We currently can't unroll a loop if it doesn't end with a
- JUMP_INSN. There would need to be a mechanism that recognizes
- this case, and then inserts a jump after each loop body, which
- jumps to after the last loop body. */
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Unrolling failure: loop does not end with a JUMP_INSN.\n");
- return;
- }
-
- /* If copying exit test branches because they can not be eliminated,
- then must convert the fall through case of the branch to a jump past
- the end of the loop. Create a label to emit after the loop and save
- it for later use. Do not use the label after the loop, if any, since
- it might be used by insns outside the loop, or there might be insns
- added before it later by final_[bg]iv_value which must be after
- the real exit label. */
- exit_label = gen_label_rtx ();
-
- insn = loop_start;
- while (GET_CODE (insn) != CODE_LABEL && GET_CODE (insn) != JUMP_INSN)
- insn = NEXT_INSN (insn);
-
- if (GET_CODE (insn) == JUMP_INSN)
- {
- /* The loop starts with a jump down to the exit condition test.
- Start copying the loop after the barrier following this
- jump insn. */
- copy_start = NEXT_INSN (insn);
-
- /* Splitting induction variables doesn't work when the loop is
- entered via a jump to the bottom, because then we end up doing
- a comparison against a new register for a split variable, but
- we did not execute the set insn for the new register because
- it was skipped over. */
- splitting_not_safe = 1;
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Splitting not safe, because loop not entered at top.\n");
- }
- else
- copy_start = loop_start;
- }
-
- /* This should always be the first label in the loop. */
- start_label = NEXT_INSN (copy_start);
- /* There may be a line number note and/or a loop continue note here. */
- while (GET_CODE (start_label) == NOTE)
- start_label = NEXT_INSN (start_label);
- if (GET_CODE (start_label) != CODE_LABEL)
- {
- /* This can happen as a result of jump threading. If the first insns in
- the loop test the same condition as the loop's backward jump, or the
- opposite condition, then the backward jump will be modified to point
- to elsewhere, and the loop's start label is deleted.
-
- This case currently can not be handled by the loop unrolling code. */
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Unrolling failure: unknown insns between BEG note and loop label.\n");
- return;
- }
- if (LABEL_NAME (start_label))
- {
- /* The jump optimization pass must have combined the original start label
- with a named label for a goto. We can't unroll this case because
- jumps which go to the named label must be handled differently than
- jumps to the loop start, and it is impossible to differentiate them
- in this case. */
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Unrolling failure: loop start label is gone\n");
- return;
- }
-
- if (unroll_type == UNROLL_NAIVE
- && GET_CODE (last_loop_insn) == BARRIER
- && start_label != JUMP_LABEL (PREV_INSN (last_loop_insn)))
- {
- /* In this case, we must copy the jump and barrier, because they will
- not be converted to jumps to an immediately following label. */
-
- insert_before = NEXT_INSN (last_loop_insn);
- copy_end = last_loop_insn;
- }
-
- if (unroll_type == UNROLL_NAIVE
- && GET_CODE (last_loop_insn) == JUMP_INSN
- && start_label != JUMP_LABEL (last_loop_insn))
- {
- /* ??? The loop ends with a conditional branch that does not branch back
- to the loop start label. In this case, we must emit an unconditional
- branch to the loop exit after emitting the final branch.
- copy_loop_body does not have support for this currently, so we
- give up. It doesn't seem worthwhile to unroll anyways since
- unrolling would increase the number of branch instructions
- executed. */
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Unrolling failure: final conditional branch not to loop start\n");
- return;
- }
-
- /* Allocate a translation table for the labels and insn numbers.
- They will be filled in as we copy the insns in the loop. */
-
- max_labelno = max_label_num ();
- max_insnno = get_max_uid ();
-
- map = (struct inline_remap *) alloca (sizeof (struct inline_remap));
-
- map->integrating = 0;
-
- /* Allocate the label map. */
-
- if (max_labelno > 0)
- {
- map->label_map = (rtx *) alloca (max_labelno * sizeof (rtx));
-
- local_label = (char *) alloca (max_labelno);
- bzero (local_label, max_labelno);
- }
- else
- map->label_map = 0;
-
- /* Search the loop and mark all local labels, i.e. the ones which have to
- be distinct labels when copied. For all labels which might be
- non-local, set their label_map entries to point to themselves.
- If they happen to be local their label_map entries will be overwritten
- before the loop body is copied. The label_map entries for local labels
- will be set to a different value each time the loop body is copied. */
-
- for (insn = copy_start; insn != loop_end; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL)
- local_label[CODE_LABEL_NUMBER (insn)] = 1;
- else if (GET_CODE (insn) == JUMP_INSN)
- {
- if (JUMP_LABEL (insn))
- map->label_map[CODE_LABEL_NUMBER (JUMP_LABEL (insn))]
- = JUMP_LABEL (insn);
- else if (GET_CODE (PATTERN (insn)) == ADDR_VEC
- || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
- {
- rtx pat = PATTERN (insn);
- int diff_vec_p = GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC;
- int len = XVECLEN (pat, diff_vec_p);
- rtx label;
-
- for (i = 0; i < len; i++)
- {
- label = XEXP (XVECEXP (pat, diff_vec_p, i), 0);
- map->label_map[CODE_LABEL_NUMBER (label)] = label;
- }
- }
- }
- }
-
- /* Allocate space for the insn map. */
-
- map->insn_map = (rtx *) alloca (max_insnno * sizeof (rtx));
-
- /* Set this to zero, to indicate that we are doing loop unrolling,
- not function inlining. */
- map->inline_target = 0;
-
- /* The register and constant maps depend on the number of registers
- present, so the final maps can't be created until after
- find_splittable_regs is called. However, they are needed for
- preconditioning, so we create temporary maps when preconditioning
- is performed. */
-
- /* The preconditioning code may allocate two new pseudo registers. */
- maxregnum = max_reg_num ();
-
- /* Allocate and zero out the splittable_regs and addr_combined_regs
- arrays. These must be zeroed here because they will be used if
- loop preconditioning is performed, and must be zero for that case.
-
- It is safe to do this here, since the extra registers created by the
- preconditioning code and find_splittable_regs will never be used
- to access the splittable_regs[] and addr_combined_regs[] arrays. */
-
- splittable_regs = (rtx *) alloca (maxregnum * sizeof (rtx));
- bzero ((char *) splittable_regs, maxregnum * sizeof (rtx));
- splittable_regs_updates = (int *) alloca (maxregnum * sizeof (int));
- bzero ((char *) splittable_regs_updates, maxregnum * sizeof (int));
- addr_combined_regs
- = (struct induction **) alloca (maxregnum * sizeof (struct induction *));
- bzero ((char *) addr_combined_regs, maxregnum * sizeof (struct induction *));
- /* We must limit it to max_reg_before_loop, because only these pseudo
- registers have valid regno_first_uid info. Any register created after
- that is unlikely to be local to the loop anyways. */
- local_regno = (char *) alloca (max_reg_before_loop);
- bzero (local_regno, max_reg_before_loop);
-
- /* Mark all local registers, i.e. the ones which are referenced only
- inside the loop. */
- if (INSN_UID (copy_end) < max_uid_for_loop)
- {
- int copy_start_luid = INSN_LUID (copy_start);
- int copy_end_luid = INSN_LUID (copy_end);
-
- /* If a register is used in the jump insn, we must not duplicate it
- since it will also be used outside the loop. */
- if (GET_CODE (copy_end) == JUMP_INSN)
- copy_end_luid--;
- /* If copy_start points to the NOTE that starts the loop, then we must
- use the next luid, because invariant pseudo-regs moved out of the loop
- have their lifetimes modified to start here, but they are not safe
- to duplicate. */
- if (copy_start == loop_start)
- copy_start_luid++;
-
- /* If a pseudo's lifetime is entirely contained within this loop, then we
- can use a different pseudo in each unrolled copy of the loop. This
- results in better code. */
- for (j = FIRST_PSEUDO_REGISTER; j < max_reg_before_loop; ++j)
- if (regno_first_uid[j] > 0 && regno_first_uid[j] <= max_uid_for_loop
- && uid_luid[regno_first_uid[j]] >= copy_start_luid
- && regno_last_uid[j] > 0 && regno_last_uid[j] <= max_uid_for_loop
- && uid_luid[regno_last_uid[j]] <= copy_end_luid)
- {
- /* However, we must also check for loop-carried dependencies.
- If the value the pseudo has at the end of iteration X is
- used by iteration X+1, then we can not use a different pseudo
- for each unrolled copy of the loop. */
- /* A pseudo is safe if regno_first_uid is a set, and this
- set dominates all instructions from regno_first_uid to
- regno_last_uid. */
- /* ??? This check is simplistic. We would get better code if
- this check was more sophisticated. */
- if (set_dominates_use (j, regno_first_uid[j], regno_last_uid[j],
- copy_start, copy_end))
- local_regno[j] = 1;
-
- if (loop_dump_stream)
- {
- if (local_regno[j])
- fprintf (loop_dump_stream, "Marked reg %d as local\n", j);
- else
- fprintf (loop_dump_stream, "Did not mark reg %d as local\n",
- j);
- }
- }
- }
-
- /* If this loop requires exit tests when unrolled, check to see if we
- can precondition the loop so as to make the exit tests unnecessary.
- Just like variable splitting, this is not safe if the loop is entered
- via a jump to the bottom. Also, can not do this if no strength
- reduce info, because precondition_loop_p uses this info. */
-
- /* Must copy the loop body for preconditioning before the following
- find_splittable_regs call since that will emit insns which need to
- be after the preconditioned loop copies, but immediately before the
- unrolled loop copies. */
-
- /* Also, it is not safe to split induction variables for the preconditioned
- copies of the loop body. If we split induction variables, then the code
- assumes that each induction variable can be represented as a function
- of its initial value and the loop iteration number. This is not true
- in this case, because the last preconditioned copy of the loop body
- could be any iteration from the first up to the `unroll_number-1'th,
- depending on the initial value of the iteration variable. Therefore
- we can not split induction variables here, because we can not calculate
- their value. Hence, this code must occur before find_splittable_regs
- is called. */
-
- if (unroll_type == UNROLL_NAIVE && ! splitting_not_safe && strength_reduce_p)
- {
- rtx initial_value, final_value, increment;
-
- if (precondition_loop_p (&initial_value, &final_value, &increment,
- loop_start, loop_end))
- {
- register rtx diff, temp;
- enum machine_mode mode;
- rtx *labels;
- int abs_inc, neg_inc;
-
- map->reg_map = (rtx *) alloca (maxregnum * sizeof (rtx));
-
- map->const_equiv_map = (rtx *) alloca (maxregnum * sizeof (rtx));
- map->const_age_map = (unsigned *) alloca (maxregnum
- * sizeof (unsigned));
- map->const_equiv_map_size = maxregnum;
- global_const_equiv_map = map->const_equiv_map;
- global_const_equiv_map_size = maxregnum;
-
- init_reg_map (map, maxregnum);
-
- /* Limit loop unrolling to 4, since this will make 7 copies of
- the loop body. */
- if (unroll_number > 4)
- unroll_number = 4;
-
- /* Save the absolute value of the increment, and also whether or
- not it is negative. */
- neg_inc = 0;
- abs_inc = INTVAL (increment);
- if (abs_inc < 0)
- {
- abs_inc = - abs_inc;
- neg_inc = 1;
- }
-
- start_sequence ();
-
- /* Decide what mode to do these calculations in. Choose the larger
- of final_value's mode and initial_value's mode, or a full-word if
- both are constants. */
- mode = GET_MODE (final_value);
- if (mode == VOIDmode)
- {
- mode = GET_MODE (initial_value);
- if (mode == VOIDmode)
- mode = word_mode;
- }
- else if (mode != GET_MODE (initial_value)
- && (GET_MODE_SIZE (mode)
- < GET_MODE_SIZE (GET_MODE (initial_value))))
- mode = GET_MODE (initial_value);
-
- /* Calculate the difference between the final and initial values.
- Final value may be a (plus (reg x) (const_int 1)) rtx.
- Let the following cse pass simplify this if initial value is
- a constant.
-
- We must copy the final and initial values here to avoid
- improperly shared rtl. */
-
- diff = expand_binop (mode, sub_optab, copy_rtx (final_value),
- copy_rtx (initial_value), NULL_RTX, 0,
- OPTAB_LIB_WIDEN);
-
- /* Now calculate (diff % (unroll * abs (increment))) by using an
- and instruction. */
- diff = expand_binop (GET_MODE (diff), and_optab, diff,
- GEN_INT (unroll_number * abs_inc - 1),
- NULL_RTX, 0, OPTAB_LIB_WIDEN);
-
- /* Now emit a sequence of branches to jump to the proper precond
- loop entry point. */
-
- labels = (rtx *) alloca (sizeof (rtx) * unroll_number);
- for (i = 0; i < unroll_number; i++)
- labels[i] = gen_label_rtx ();
-
- /* Check for the case where the initial value is greater than or
- equal to the final value. In that case, we want to execute
- exactly one loop iteration. The code below will fail for this
- case. This check does not apply if the loop has a NE
- comparison at the end. */
-
- if (loop_comparison_code != NE)
- {
- emit_cmp_insn (initial_value, final_value, neg_inc ? LE : GE,
- NULL_RTX, mode, 0, 0);
- if (neg_inc)
- emit_jump_insn (gen_ble (labels[1]));
- else
- emit_jump_insn (gen_bge (labels[1]));
- JUMP_LABEL (get_last_insn ()) = labels[1];
- LABEL_NUSES (labels[1])++;
- }
-
- /* Assuming the unroll_number is 4, and the increment is 2, then
- for a negative increment: for a positive increment:
- diff = 0,1 precond 0 diff = 0,7 precond 0
- diff = 2,3 precond 3 diff = 1,2 precond 1
- diff = 4,5 precond 2 diff = 3,4 precond 2
- diff = 6,7 precond 1 diff = 5,6 precond 3 */
-
- /* We only need to emit (unroll_number - 1) branches here, the
- last case just falls through to the following code. */
-
- /* ??? This would give better code if we emitted a tree of branches
- instead of the current linear list of branches. */
-
- for (i = 0; i < unroll_number - 1; i++)
- {
- int cmp_const;
- enum rtx_code cmp_code;
-
- /* For negative increments, must invert the constant compared
- against, except when comparing against zero. */
- if (i == 0)
- {
- cmp_const = 0;
- cmp_code = EQ;
- }
- else if (neg_inc)
- {
- cmp_const = unroll_number - i;
- cmp_code = GE;
- }
- else
- {
- cmp_const = i;
- cmp_code = LE;
- }
-
- emit_cmp_insn (diff, GEN_INT (abs_inc * cmp_const),
- cmp_code, NULL_RTX, mode, 0, 0);
-
- if (i == 0)
- emit_jump_insn (gen_beq (labels[i]));
- else if (neg_inc)
- emit_jump_insn (gen_bge (labels[i]));
- else
- emit_jump_insn (gen_ble (labels[i]));
- JUMP_LABEL (get_last_insn ()) = labels[i];
- LABEL_NUSES (labels[i])++;
- }
-
- /* If the increment is greater than one, then we need another branch,
- to handle other cases equivalent to 0. */
-
- /* ??? This should be merged into the code above somehow to help
- simplify the code here, and reduce the number of branches emitted.
- For the negative increment case, the branch here could easily
- be merged with the `0' case branch above. For the positive
- increment case, it is not clear how this can be simplified. */
-
- if (abs_inc != 1)
- {
- int cmp_const;
- enum rtx_code cmp_code;
-
- if (neg_inc)
- {
- cmp_const = abs_inc - 1;
- cmp_code = LE;
- }
- else
- {
- cmp_const = abs_inc * (unroll_number - 1) + 1;
- cmp_code = GE;
- }
-
- emit_cmp_insn (diff, GEN_INT (cmp_const), cmp_code, NULL_RTX,
- mode, 0, 0);
-
- if (neg_inc)
- emit_jump_insn (gen_ble (labels[0]));
- else
- emit_jump_insn (gen_bge (labels[0]));
- JUMP_LABEL (get_last_insn ()) = labels[0];
- LABEL_NUSES (labels[0])++;
- }
-
- sequence = gen_sequence ();
- end_sequence ();
- emit_insn_before (sequence, loop_start);
-
- /* Only the last copy of the loop body here needs the exit
- test, so set copy_end to exclude the compare/branch here,
- and then reset it inside the loop when get to the last
- copy. */
-
- if (GET_CODE (last_loop_insn) == BARRIER)
- copy_end = PREV_INSN (PREV_INSN (last_loop_insn));
- else if (GET_CODE (last_loop_insn) == JUMP_INSN)
- {
-#ifdef HAVE_cc0
- /* The immediately preceding insn is a compare which we do not
- want to copy. */
- copy_end = PREV_INSN (PREV_INSN (last_loop_insn));
-#else
- /* The immediately preceding insn may not be a compare, so we
- must copy it. */
- copy_end = PREV_INSN (last_loop_insn);
-#endif
- }
- else
- abort ();
-
- for (i = 1; i < unroll_number; i++)
- {
- emit_label_after (labels[unroll_number - i],
- PREV_INSN (loop_start));
-
- bzero ((char *) map->insn_map, max_insnno * sizeof (rtx));
- bzero ((char *) map->const_equiv_map, maxregnum * sizeof (rtx));
- bzero ((char *) map->const_age_map,
- maxregnum * sizeof (unsigned));
- map->const_age = 0;
-
- for (j = 0; j < max_labelno; j++)
- if (local_label[j])
- map->label_map[j] = gen_label_rtx ();
-
- for (j = FIRST_PSEUDO_REGISTER; j < max_reg_before_loop; j++)
- if (local_regno[j])
- map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j]));
-
- /* The last copy needs the compare/branch insns at the end,
- so reset copy_end here if the loop ends with a conditional
- branch. */
-
- if (i == unroll_number - 1)
- {
- if (GET_CODE (last_loop_insn) == BARRIER)
- copy_end = PREV_INSN (PREV_INSN (last_loop_insn));
- else
- copy_end = last_loop_insn;
- }
-
- /* None of the copies are the `last_iteration', so just
- pass zero for that parameter. */
- copy_loop_body (copy_start, copy_end, map, exit_label, 0,
- unroll_type, start_label, loop_end,
- loop_start, copy_end);
- }
- emit_label_after (labels[0], PREV_INSN (loop_start));
-
- if (GET_CODE (last_loop_insn) == BARRIER)
- {
- insert_before = PREV_INSN (last_loop_insn);
- copy_end = PREV_INSN (insert_before);
- }
- else
- {
-#ifdef HAVE_cc0
- /* The immediately preceding insn is a compare which we do not
- want to copy. */
- insert_before = PREV_INSN (last_loop_insn);
- copy_end = PREV_INSN (insert_before);
-#else
- /* The immediately preceding insn may not be a compare, so we
- must copy it. */
- insert_before = last_loop_insn;
- copy_end = PREV_INSN (last_loop_insn);
-#endif
- }
-
- /* Set unroll type to MODULO now. */
- unroll_type = UNROLL_MODULO;
- loop_preconditioned = 1;
- }
- }
-
- /* 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_unroll_all_loops)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Unrolling failure: Naive unrolling not being done.\n");
- return;
- }
-
- /* At this point, we are guaranteed to unroll the loop. */
-
- /* For each biv and giv, determine whether it can be safely split into
- a different variable for each unrolled copy of the loop body.
- We precalculate and save this info here, since computing it is
- expensive.
-
- Do this before deleting any instructions from the loop, so that
- back_branch_in_range_p will work correctly. */
-
- if (splitting_not_safe)
- temp = 0;
- else
- temp = find_splittable_regs (unroll_type, loop_start, loop_end,
- end_insert_before, unroll_number);
-
- /* find_splittable_regs may have created some new registers, so must
- reallocate the reg_map with the new larger size, and must realloc
- the constant maps also. */
-
- maxregnum = max_reg_num ();
- map->reg_map = (rtx *) alloca (maxregnum * sizeof (rtx));
-
- init_reg_map (map, maxregnum);
-
- /* Space is needed in some of the map for new registers, so new_maxregnum
- is an (over)estimate of how many registers will exist at the end. */
- new_maxregnum = maxregnum + (temp * unroll_number * 2);
-
- /* Must realloc space for the constant maps, because the number of registers
- may have changed. */
-
- map->const_equiv_map = (rtx *) alloca (new_maxregnum * sizeof (rtx));
- map->const_age_map = (unsigned *) alloca (new_maxregnum * sizeof (unsigned));
-
- map->const_equiv_map_size = new_maxregnum;
- global_const_equiv_map = map->const_equiv_map;
- global_const_equiv_map_size = new_maxregnum;
-
- /* Search the list of bivs and givs to find ones which need to be remapped
- when split, and set their reg_map entry appropriately. */
-
- for (bl = loop_iv_list; bl; bl = bl->next)
- {
- if (REGNO (bl->biv->src_reg) != bl->regno)
- map->reg_map[bl->regno] = bl->biv->src_reg;
-#if 0
- /* Currently, non-reduced/final-value givs are never split. */
- for (v = bl->giv; v; v = v->next_iv)
- if (REGNO (v->src_reg) != bl->regno)
- map->reg_map[REGNO (v->dest_reg)] = v->src_reg;
-#endif
- }
-
- /* Use our current register alignment and pointer flags. */
- map->regno_pointer_flag = regno_pointer_flag;
- map->regno_pointer_align = regno_pointer_align;
-
- /* If the loop is being partially unrolled, and the iteration variables
- are being split, and are being renamed for the split, then must fix up
- the compare/jump instruction at the end of the loop to refer to the new
- registers. This compare isn't copied, so the registers used in it
- will never be replaced if it isn't done here. */
-
- if (unroll_type == UNROLL_MODULO)
- {
- insn = NEXT_INSN (copy_end);
- if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN)
- PATTERN (insn) = remap_split_bivs (PATTERN (insn));
- }
-
- /* For unroll_number - 1 times, make a copy of each instruction
- between copy_start and copy_end, and insert these new instructions
- before the end of the loop. */
-
- for (i = 0; i < unroll_number; i++)
- {
- bzero ((char *) map->insn_map, max_insnno * sizeof (rtx));
- bzero ((char *) map->const_equiv_map, new_maxregnum * sizeof (rtx));
- bzero ((char *) map->const_age_map, new_maxregnum * sizeof (unsigned));
- map->const_age = 0;
-
- for (j = 0; j < max_labelno; j++)
- if (local_label[j])
- map->label_map[j] = gen_label_rtx ();
-
- for (j = FIRST_PSEUDO_REGISTER; j < max_reg_before_loop; j++)
- if (local_regno[j])
- map->reg_map[j] = gen_reg_rtx (GET_MODE (regno_reg_rtx[j]));
-
- /* If loop starts with a branch to the test, then fix it so that
- it points to the test of the first unrolled copy of the loop. */
- if (i == 0 && loop_start != copy_start)
- {
- insn = PREV_INSN (copy_start);
- pattern = PATTERN (insn);
-
- tem = map->label_map[CODE_LABEL_NUMBER
- (XEXP (SET_SRC (pattern), 0))];
- SET_SRC (pattern) = gen_rtx (LABEL_REF, VOIDmode, tem);
-
- /* Set the jump label so that it can be used by later loop unrolling
- passes. */
- JUMP_LABEL (insn) = tem;
- LABEL_NUSES (tem)++;
- }
-
- copy_loop_body (copy_start, copy_end, map, exit_label,
- i == unroll_number - 1, unroll_type, start_label,
- loop_end, insert_before, insert_before);
- }
-
- /* Before deleting any insns, emit a CODE_LABEL immediately after the last
- insn to be deleted. This prevents any runaway delete_insn call from
- more insns that it should, as it always stops at a CODE_LABEL. */
-
- /* Delete the compare and branch at the end of the loop if completely
- unrolling the loop. Deleting the backward branch at the end also
- deletes the code label at the start of the loop. This is done at
- the very end to avoid problems with back_branch_in_range_p. */
-
- if (unroll_type == UNROLL_COMPLETELY)
- safety_label = emit_label_after (gen_label_rtx (), last_loop_insn);
- else
- safety_label = emit_label_after (gen_label_rtx (), copy_end);
-
- /* Delete all of the original loop instructions. Don't delete the
- LOOP_BEG note, or the first code label in the loop. */
-
- insn = NEXT_INSN (copy_start);
- while (insn != safety_label)
- {
- if (insn != start_label)
- insn = delete_insn (insn);
- else
- insn = NEXT_INSN (insn);
- }
-
- /* Can now delete the 'safety' label emitted to protect us from runaway
- delete_insn calls. */
- if (INSN_DELETED_P (safety_label))
- abort ();
- delete_insn (safety_label);
-
- /* If exit_label exists, emit it after the loop. Doing the emit here
- forces it to have a higher INSN_UID than any insn in the unrolled loop.
- This is needed so that mostly_true_jump in reorg.c will treat jumps
- to this loop end label correctly, i.e. predict that they are usually
- not taken. */
- if (exit_label)
- emit_label_after (exit_label, loop_end);
-}
-
-/* Return true if the loop can be safely, and profitably, preconditioned
- so that the unrolled copies of the loop body don't need exit tests.
-
- This only works if final_value, initial_value and increment can be
- determined, and if increment is a constant power of 2.
- If increment is not a power of 2, then the preconditioning modulo
- operation would require a real modulo instead of a boolean AND, and this
- is not considered `profitable'. */
-
-/* ??? If the loop is known to be executed very many times, or the machine
- has a very cheap divide instruction, then preconditioning is a win even
- when the increment is not a power of 2. Use RTX_COST to compute
- whether divide is cheap. */
-
-static int
-precondition_loop_p (initial_value, final_value, increment, loop_start,
- loop_end)
- rtx *initial_value, *final_value, *increment;
- rtx loop_start, loop_end;
-{
-
- if (loop_n_iterations > 0)
- {
- *initial_value = const0_rtx;
- *increment = const1_rtx;
- *final_value = GEN_INT (loop_n_iterations);
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Preconditioning: Success, number of iterations known, %d.\n",
- loop_n_iterations);
- return 1;
- }
-
- if (loop_initial_value == 0)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Preconditioning: Could not find initial value.\n");
- return 0;
- }
- else if (loop_increment == 0)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Preconditioning: Could not find increment value.\n");
- return 0;
- }
- else if (GET_CODE (loop_increment) != CONST_INT)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Preconditioning: Increment not a constant.\n");
- return 0;
- }
- else if ((exact_log2 (INTVAL (loop_increment)) < 0)
- && (exact_log2 (- INTVAL (loop_increment)) < 0))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Preconditioning: Increment not a constant power of 2.\n");
- return 0;
- }
-
- /* Unsigned_compare and compare_dir can be ignored here, since they do
- not matter for preconditioning. */
-
- if (loop_final_value == 0)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Preconditioning: EQ comparison loop.\n");
- return 0;
- }
-
- /* Must ensure that final_value is invariant, so call invariant_p to
- check. Before doing so, must check regno against max_reg_before_loop
- to make sure that the register is in the range covered by invariant_p.
- If it isn't, then it is most likely a biv/giv which by definition are
- not invariant. */
- if ((GET_CODE (loop_final_value) == REG
- && REGNO (loop_final_value) >= max_reg_before_loop)
- || (GET_CODE (loop_final_value) == PLUS
- && REGNO (XEXP (loop_final_value, 0)) >= max_reg_before_loop)
- || ! invariant_p (loop_final_value))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Preconditioning: Final value not invariant.\n");
- return 0;
- }
-
- /* Fail for floating point values, since the caller of this function
- does not have code to deal with them. */
- if (GET_MODE_CLASS (GET_MODE (loop_final_value)) == MODE_FLOAT
- || GET_MODE_CLASS (GET_MODE (loop_initial_value)) == MODE_FLOAT)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Preconditioning: Floating point final or initial value.\n");
- return 0;
- }
-
- /* Now set initial_value to be the iteration_var, since that may be a
- simpler expression, and is guaranteed to be correct if all of the
- above tests succeed.
-
- We can not use the initial_value as calculated, because it will be
- one too small for loops of the form "while (i-- > 0)". We can not
- emit code before the loop_skip_over insns to fix this problem as this
- will then give a number one too large for loops of the form
- "while (--i > 0)".
-
- Note that all loops that reach here are entered at the top, because
- this function is not called if the loop starts with a jump. */
-
- /* Fail if loop_iteration_var is not live before loop_start, since we need
- to test its value in the preconditioning code. */
-
- if (uid_luid[regno_first_uid[REGNO (loop_iteration_var)]]
- > INSN_LUID (loop_start))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Preconditioning: Iteration var not live before loop start.\n");
- return 0;
- }
-
- *initial_value = loop_iteration_var;
- *increment = loop_increment;
- *final_value = loop_final_value;
-
- /* Success! */
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Preconditioning: Successful.\n");
- return 1;
-}
-
-
-/* All pseudo-registers must be mapped to themselves. Two hard registers
- must be mapped, VIRTUAL_STACK_VARS_REGNUM and VIRTUAL_INCOMING_ARGS_
- REGNUM, to avoid function-inlining specific conversions of these
- registers. All other hard regs can not be mapped because they may be
- used with different
- modes. */
-
-static void
-init_reg_map (map, maxregnum)
- struct inline_remap *map;
- int maxregnum;
-{
- int i;
-
- for (i = maxregnum - 1; i > LAST_VIRTUAL_REGISTER; i--)
- map->reg_map[i] = regno_reg_rtx[i];
- /* Just clear the rest of the entries. */
- for (i = LAST_VIRTUAL_REGISTER; i >= 0; i--)
- map->reg_map[i] = 0;
-
- map->reg_map[VIRTUAL_STACK_VARS_REGNUM]
- = regno_reg_rtx[VIRTUAL_STACK_VARS_REGNUM];
- map->reg_map[VIRTUAL_INCOMING_ARGS_REGNUM]
- = regno_reg_rtx[VIRTUAL_INCOMING_ARGS_REGNUM];
-}
-
-/* Strength-reduction will often emit code for optimized biv/givs which
- calculates their value in a temporary register, and then copies the result
- to the iv. This procedure reconstructs the pattern computing the iv;
- verifying that all operands are of the proper form.
-
- The return value is the amount that the giv is incremented by. */
-
-static rtx
-calculate_giv_inc (pattern, src_insn, regno)
- rtx pattern, src_insn;
- int regno;
-{
- rtx increment;
- rtx increment_total = 0;
- int tries = 0;
-
- retry:
- /* Verify that we have an increment insn here. First check for a plus
- as the set source. */
- if (GET_CODE (SET_SRC (pattern)) != PLUS)
- {
- /* SR sometimes computes the new giv value in a temp, then copies it
- to the new_reg. */
- src_insn = PREV_INSN (src_insn);
- pattern = PATTERN (src_insn);
- if (GET_CODE (SET_SRC (pattern)) != PLUS)
- abort ();
-
- /* The last insn emitted is not needed, so delete it to avoid confusing
- the second cse pass. This insn sets the giv unnecessarily. */
- delete_insn (get_last_insn ());
- }
-
- /* Verify that we have a constant as the second operand of the plus. */
- increment = XEXP (SET_SRC (pattern), 1);
- if (GET_CODE (increment) != CONST_INT)
- {
- /* SR sometimes puts the constant in a register, especially if it is
- too big to be an add immed operand. */
- src_insn = PREV_INSN (src_insn);
- increment = SET_SRC (PATTERN (src_insn));
-
- /* SR may have used LO_SUM to compute the constant if it is too large
- for a load immed operand. In this case, the constant is in operand
- one of the LO_SUM rtx. */
- if (GET_CODE (increment) == LO_SUM)
- increment = XEXP (increment, 1);
- else if (GET_CODE (increment) == IOR
- || GET_CODE (increment) == ASHIFT)
- {
- /* The rs6000 port loads some constants with IOR.
- The alpha port loads some constants with ASHIFT. */
- rtx second_part = XEXP (increment, 1);
- enum rtx_code code = GET_CODE (increment);
-
- src_insn = PREV_INSN (src_insn);
- increment = SET_SRC (PATTERN (src_insn));
- /* Don't need the last insn anymore. */
- delete_insn (get_last_insn ());
-
- if (GET_CODE (second_part) != CONST_INT
- || GET_CODE (increment) != CONST_INT)
- abort ();
-
- if (code == IOR)
- increment = GEN_INT (INTVAL (increment) | INTVAL (second_part));
- else
- increment = GEN_INT (INTVAL (increment) << INTVAL (second_part));
- }
-
- if (GET_CODE (increment) != CONST_INT)
- abort ();
-
- /* The insn loading the constant into a register is no longer needed,
- so delete it. */
- delete_insn (get_last_insn ());
- }
-
- if (increment_total)
- increment_total = GEN_INT (INTVAL (increment_total) + INTVAL (increment));
- else
- increment_total = increment;
-
- /* Check that the source register is the same as the register we expected
- to see as the source. If not, something is seriously wrong. */
- if (GET_CODE (XEXP (SET_SRC (pattern), 0)) != REG
- || REGNO (XEXP (SET_SRC (pattern), 0)) != regno)
- {
- /* Some machines (e.g. the romp), may emit two add instructions for
- certain constants, so lets try looking for another add immediately
- before this one if we have only seen one add insn so far. */
-
- if (tries == 0)
- {
- tries++;
-
- src_insn = PREV_INSN (src_insn);
- pattern = PATTERN (src_insn);
-
- delete_insn (get_last_insn ());
-
- goto retry;
- }
-
- abort ();
- }
-
- return increment_total;
-}
-
-/* Copy REG_NOTES, except for insn references, because not all insn_map
- entries are valid yet. We do need to copy registers now though, because
- the reg_map entries can change during copying. */
-
-static rtx
-initial_reg_note_copy (notes, map)
- rtx notes;
- struct inline_remap *map;
-{
- rtx copy;
-
- if (notes == 0)
- return 0;
-
- copy = rtx_alloc (GET_CODE (notes));
- PUT_MODE (copy, GET_MODE (notes));
-
- if (GET_CODE (notes) == EXPR_LIST)
- XEXP (copy, 0) = copy_rtx_and_substitute (XEXP (notes, 0), map);
- else if (GET_CODE (notes) == INSN_LIST)
- /* Don't substitute for these yet. */
- XEXP (copy, 0) = XEXP (notes, 0);
- else
- abort ();
-
- XEXP (copy, 1) = initial_reg_note_copy (XEXP (notes, 1), map);
-
- return copy;
-}
-
-/* Fixup insn references in copied REG_NOTES. */
-
-static void
-final_reg_note_copy (notes, map)
- rtx notes;
- struct inline_remap *map;
-{
- rtx note;
-
- for (note = notes; note; note = XEXP (note, 1))
- if (GET_CODE (note) == INSN_LIST)
- XEXP (note, 0) = map->insn_map[INSN_UID (XEXP (note, 0))];
-}
-
-/* Copy each instruction in the loop, substituting from map as appropriate.
- This is very similar to a loop in expand_inline_function. */
-
-static void
-copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration,
- unroll_type, start_label, loop_end, insert_before,
- copy_notes_from)
- rtx copy_start, copy_end;
- struct inline_remap *map;
- rtx exit_label;
- int last_iteration;
- enum unroll_types unroll_type;
- rtx start_label, loop_end, insert_before, copy_notes_from;
-{
- rtx insn, pattern;
- rtx tem, copy;
- int dest_reg_was_split, i;
- rtx cc0_insn = 0;
- rtx final_label = 0;
- rtx giv_inc, giv_dest_reg, giv_src_reg;
-
- /* If this isn't the last iteration, then map any references to the
- start_label to final_label. Final label will then be emitted immediately
- after the end of this loop body if it was ever used.
-
- If this is the last iteration, then map references to the start_label
- to itself. */
- if (! last_iteration)
- {
- final_label = gen_label_rtx ();
- map->label_map[CODE_LABEL_NUMBER (start_label)] = final_label;
- }
- else
- map->label_map[CODE_LABEL_NUMBER (start_label)] = start_label;
-
- start_sequence ();
-
- insn = copy_start;
- do
- {
- insn = NEXT_INSN (insn);
-
- map->orig_asm_operands_vector = 0;
-
- switch (GET_CODE (insn))
- {
- case INSN:
- pattern = PATTERN (insn);
- copy = 0;
- giv_inc = 0;
-
- /* Check to see if this is a giv that has been combined with
- some split address givs. (Combined in the sense that
- `combine_givs' in loop.c has put two givs in the same register.)
- In this case, we must search all givs based on the same biv to
- find the address givs. Then split the address givs.
- Do this before splitting the giv, since that may map the
- SET_DEST to a new register. */
-
- if (GET_CODE (pattern) == SET
- && GET_CODE (SET_DEST (pattern)) == REG
- && addr_combined_regs[REGNO (SET_DEST (pattern))])
- {
- struct iv_class *bl;
- struct induction *v, *tv;
- int regno = REGNO (SET_DEST (pattern));
-
- v = addr_combined_regs[REGNO (SET_DEST (pattern))];
- bl = reg_biv_class[REGNO (v->src_reg)];
-
- /* Although the giv_inc amount is not needed here, we must call
- calculate_giv_inc here since it might try to delete the
- last insn emitted. If we wait until later to call it,
- we might accidentally delete insns generated immediately
- below by emit_unrolled_add. */
-
- giv_inc = calculate_giv_inc (pattern, insn, regno);
-
- /* Now find all address giv's that were combined with this
- giv 'v'. */
- for (tv = bl->giv; tv; tv = tv->next_iv)
- if (tv->giv_type == DEST_ADDR && tv->same == v)
- {
- int this_giv_inc;
-
- /* If this DEST_ADDR giv was not split, then ignore it. */
- if (*tv->location != tv->dest_reg)
- continue;
-
- /* Scale this_giv_inc if the multiplicative factors of
- the two givs are different. */
- this_giv_inc = INTVAL (giv_inc);
- if (tv->mult_val != v->mult_val)
- this_giv_inc = (this_giv_inc / INTVAL (v->mult_val)
- * INTVAL (tv->mult_val));
-
- tv->dest_reg = plus_constant (tv->dest_reg, this_giv_inc);
- *tv->location = tv->dest_reg;
-
- if (last_iteration && unroll_type != UNROLL_COMPLETELY)
- {
- /* Must emit an insn to increment the split address
- giv. Add in the const_adjust field in case there
- was a constant eliminated from the address. */
- rtx value, dest_reg;
-
- /* tv->dest_reg will be either a bare register,
- or else a register plus a constant. */
- if (GET_CODE (tv->dest_reg) == REG)
- dest_reg = tv->dest_reg;
- else
- dest_reg = XEXP (tv->dest_reg, 0);
-
- /* Check for shared address givs, and avoid
- incrementing the shared pseudo reg more than
- once. */
- if (! tv->same_insn)
- {
- /* tv->dest_reg may actually be a (PLUS (REG)
- (CONST)) here, so we must call plus_constant
- to add the const_adjust amount before calling
- emit_unrolled_add below. */
- value = plus_constant (tv->dest_reg,
- tv->const_adjust);
-
- /* The constant could be too large for an add
- immediate, so can't directly emit an insn
- here. */
- emit_unrolled_add (dest_reg, XEXP (value, 0),
- XEXP (value, 1));
- }
-
- /* Reset the giv to be just the register again, in case
- it is used after the set we have just emitted.
- We must subtract the const_adjust factor added in
- above. */
- tv->dest_reg = plus_constant (dest_reg,
- - tv->const_adjust);
- *tv->location = tv->dest_reg;
- }
- }
- }
-
- /* If this is a setting of a splittable variable, then determine
- how to split the variable, create a new set based on this split,
- and set up the reg_map so that later uses of the variable will
- use the new split variable. */
-
- dest_reg_was_split = 0;
-
- if (GET_CODE (pattern) == SET
- && GET_CODE (SET_DEST (pattern)) == REG
- && splittable_regs[REGNO (SET_DEST (pattern))])
- {
- int regno = REGNO (SET_DEST (pattern));
-
- dest_reg_was_split = 1;
-
- /* Compute the increment value for the giv, if it wasn't
- already computed above. */
-
- if (giv_inc == 0)
- giv_inc = calculate_giv_inc (pattern, insn, regno);
- giv_dest_reg = SET_DEST (pattern);
- giv_src_reg = SET_DEST (pattern);
-
- if (unroll_type == UNROLL_COMPLETELY)
- {
- /* Completely unrolling the loop. Set the induction
- variable to a known constant value. */
-
- /* The value in splittable_regs may be an invariant
- value, so we must use plus_constant here. */
- splittable_regs[regno]
- = plus_constant (splittable_regs[regno], INTVAL (giv_inc));
-
- if (GET_CODE (splittable_regs[regno]) == PLUS)
- {
- giv_src_reg = XEXP (splittable_regs[regno], 0);
- giv_inc = XEXP (splittable_regs[regno], 1);
- }
- else
- {
- /* The splittable_regs value must be a REG or a
- CONST_INT, so put the entire value in the giv_src_reg
- variable. */
- giv_src_reg = splittable_regs[regno];
- giv_inc = const0_rtx;
- }
- }
- else
- {
- /* Partially unrolling loop. Create a new pseudo
- register for the iteration variable, and set it to
- be a constant plus the original register. Except
- on the last iteration, when the result has to
- go back into the original iteration var register. */
-
- /* Handle bivs which must be mapped to a new register
- when split. This happens for bivs which need their
- final value set before loop entry. The new register
- for the biv was stored in the biv's first struct
- induction entry by find_splittable_regs. */
-
- if (regno < max_reg_before_loop
- && reg_iv_type[regno] == BASIC_INDUCT)
- {
- giv_src_reg = reg_biv_class[regno]->biv->src_reg;
- giv_dest_reg = giv_src_reg;
- }
-
-#if 0
- /* If non-reduced/final-value givs were split, then
- this would have to remap those givs also. See
- find_splittable_regs. */
-#endif
-
- splittable_regs[regno]
- = GEN_INT (INTVAL (giv_inc)
- + INTVAL (splittable_regs[regno]));
- giv_inc = splittable_regs[regno];
-
- /* Now split the induction variable by changing the dest
- of this insn to a new register, and setting its
- reg_map entry to point to this new register.
-
- If this is the last iteration, and this is the last insn
- that will update the iv, then reuse the original dest,
- to ensure that the iv will have the proper value when
- the loop exits or repeats.
-
- Using splittable_regs_updates here like this is safe,
- because it can only be greater than one if all
- instructions modifying the iv are always executed in
- order. */
-
- if (! last_iteration
- || (splittable_regs_updates[regno]-- != 1))
- {
- tem = gen_reg_rtx (GET_MODE (giv_src_reg));
- giv_dest_reg = tem;
- map->reg_map[regno] = tem;
- }
- else
- map->reg_map[regno] = giv_src_reg;
- }
-
- /* The constant being added could be too large for an add
- immediate, so can't directly emit an insn here. */
- emit_unrolled_add (giv_dest_reg, giv_src_reg, giv_inc);
- copy = get_last_insn ();
- pattern = PATTERN (copy);
- }
- else
- {
- pattern = copy_rtx_and_substitute (pattern, map);
- copy = emit_insn (pattern);
- }
- REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
-
-#ifdef HAVE_cc0
- /* If this insn is setting CC0, it may need to look at
- the insn that uses CC0 to see what type of insn it is.
- In that case, the call to recog via validate_change will
- fail. So don't substitute constants here. Instead,
- do it when we emit the following insn.
-
- For example, see the pyr.md file. That machine has signed and
- unsigned compares. The compare patterns must check the
- following branch insn to see which what kind of compare to
- emit.
-
- If the previous insn set CC0, substitute constants on it as
- well. */
- if (sets_cc0_p (PATTERN (copy)) != 0)
- cc0_insn = copy;
- else
- {
- if (cc0_insn)
- try_constants (cc0_insn, map);
- cc0_insn = 0;
- try_constants (copy, map);
- }
-#else
- try_constants (copy, map);
-#endif
-
- /* Make split induction variable constants `permanent' since we
- know there are no backward branches across iteration variable
- settings which would invalidate this. */
- if (dest_reg_was_split)
- {
- int regno = REGNO (SET_DEST (pattern));
-
- if (regno < map->const_equiv_map_size
- && map->const_age_map[regno] == map->const_age)
- map->const_age_map[regno] = -1;
- }
- break;
-
- case JUMP_INSN:
- pattern = copy_rtx_and_substitute (PATTERN (insn), map);
- copy = emit_jump_insn (pattern);
- REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
-
- if (JUMP_LABEL (insn) == start_label && insn == copy_end
- && ! last_iteration)
- {
- /* This is a branch to the beginning of the loop; this is the
- last insn being copied; and this is not the last iteration.
- In this case, we want to change the original fall through
- case to be a branch past the end of the loop, and the
- original jump label case to fall_through. */
-
- if (invert_exp (pattern, copy))
- {
- if (! redirect_exp (&pattern,
- map->label_map[CODE_LABEL_NUMBER
- (JUMP_LABEL (insn))],
- exit_label, copy))
- abort ();
- }
- else
- {
- rtx jmp;
- rtx lab = gen_label_rtx ();
- /* Can't do it by reversing the jump (probably because we
- couldn't reverse the conditions), so emit a new
- jump_insn after COPY, and redirect the jump around
- that. */
- jmp = emit_jump_insn_after (gen_jump (exit_label), copy);
- jmp = emit_barrier_after (jmp);
- emit_label_after (lab, jmp);
- LABEL_NUSES (lab) = 0;
- if (! redirect_exp (&pattern,
- map->label_map[CODE_LABEL_NUMBER
- (JUMP_LABEL (insn))],
- lab, copy))
- abort ();
- }
- }
-
-#ifdef HAVE_cc0
- if (cc0_insn)
- try_constants (cc0_insn, map);
- cc0_insn = 0;
-#endif
- try_constants (copy, map);
-
- /* Set the jump label of COPY correctly to avoid problems with
- later passes of unroll_loop, if INSN had jump label set. */
- if (JUMP_LABEL (insn))
- {
- rtx label = 0;
-
- /* Can't use the label_map for every insn, since this may be
- the backward branch, and hence the label was not mapped. */
- if (GET_CODE (pattern) == SET)
- {
- tem = SET_SRC (pattern);
- if (GET_CODE (tem) == LABEL_REF)
- label = XEXP (tem, 0);
- else if (GET_CODE (tem) == IF_THEN_ELSE)
- {
- if (XEXP (tem, 1) != pc_rtx)
- label = XEXP (XEXP (tem, 1), 0);
- else
- label = XEXP (XEXP (tem, 2), 0);
- }
- }
-
- if (label && GET_CODE (label) == CODE_LABEL)
- JUMP_LABEL (copy) = label;
- else
- {
- /* An unrecognizable jump insn, probably the entry jump
- for a switch statement. This label must have been mapped,
- so just use the label_map to get the new jump label. */
- JUMP_LABEL (copy)
- = map->label_map[CODE_LABEL_NUMBER (JUMP_LABEL (insn))];
- }
-
- /* If this is a non-local jump, then must increase the label
- use count so that the label will not be deleted when the
- original jump is deleted. */
- LABEL_NUSES (JUMP_LABEL (copy))++;
- }
- else if (GET_CODE (PATTERN (copy)) == ADDR_VEC
- || GET_CODE (PATTERN (copy)) == ADDR_DIFF_VEC)
- {
- rtx pat = PATTERN (copy);
- int diff_vec_p = GET_CODE (pat) == ADDR_DIFF_VEC;
- int len = XVECLEN (pat, diff_vec_p);
- int i;
-
- for (i = 0; i < len; i++)
- LABEL_NUSES (XEXP (XVECEXP (pat, diff_vec_p, i), 0))++;
- }
-
- /* If this used to be a conditional jump insn but whose branch
- direction is now known, we must do something special. */
- if (condjump_p (insn) && !simplejump_p (insn) && map->last_pc_value)
- {
-#ifdef HAVE_cc0
- /* The previous insn set cc0 for us. So delete it. */
- delete_insn (PREV_INSN (copy));
-#endif
-
- /* If this is now a no-op, delete it. */
- if (map->last_pc_value == pc_rtx)
- {
- /* Don't let delete_insn delete the label referenced here,
- because we might possibly need it later for some other
- instruction in the loop. */
- if (JUMP_LABEL (copy))
- LABEL_NUSES (JUMP_LABEL (copy))++;
- delete_insn (copy);
- if (JUMP_LABEL (copy))
- LABEL_NUSES (JUMP_LABEL (copy))--;
- copy = 0;
- }
- else
- /* Otherwise, this is unconditional jump so we must put a
- BARRIER after it. We could do some dead code elimination
- here, but jump.c will do it just as well. */
- emit_barrier ();
- }
- break;
-
- case CALL_INSN:
- pattern = copy_rtx_and_substitute (PATTERN (insn), map);
- copy = emit_call_insn (pattern);
- REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
-
- /* Because the USAGE information potentially contains objects other
- than hard registers, we need to copy it. */
- CALL_INSN_FUNCTION_USAGE (copy) =
- copy_rtx_and_substitute (CALL_INSN_FUNCTION_USAGE (insn), map);
-
-#ifdef HAVE_cc0
- if (cc0_insn)
- try_constants (cc0_insn, map);
- cc0_insn = 0;
-#endif
- try_constants (copy, map);
-
- /* Be lazy and assume CALL_INSNs clobber all hard registers. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- map->const_equiv_map[i] = 0;
- break;
-
- case CODE_LABEL:
- /* If this is the loop start label, then we don't need to emit a
- copy of this label since no one will use it. */
-
- if (insn != start_label)
- {
- copy = emit_label (map->label_map[CODE_LABEL_NUMBER (insn)]);
- map->const_age++;
- }
- break;
-
- case BARRIER:
- copy = emit_barrier ();
- break;
-
- case NOTE:
- /* VTOP notes are valid only before the loop exit test. If placed
- anywhere else, loop may generate bad code. */
-
- if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED
- && (NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_VTOP
- || (last_iteration && unroll_type != UNROLL_COMPLETELY)))
- copy = emit_note (NOTE_SOURCE_FILE (insn),
- NOTE_LINE_NUMBER (insn));
- else
- copy = 0;
- break;
-
- default:
- abort ();
- break;
- }
-
- map->insn_map[INSN_UID (insn)] = copy;
- }
- while (insn != copy_end);
-
- /* Now finish coping the REG_NOTES. */
- insn = copy_start;
- do
- {
- insn = NEXT_INSN (insn);
- if ((GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN
- || GET_CODE (insn) == CALL_INSN)
- && map->insn_map[INSN_UID (insn)])
- final_reg_note_copy (REG_NOTES (map->insn_map[INSN_UID (insn)]), map);
- }
- while (insn != copy_end);
-
- /* There may be notes between copy_notes_from and loop_end. Emit a copy of
- each of these notes here, since there may be some important ones, such as
- NOTE_INSN_BLOCK_END notes, in this group. We don't do this on the last
- iteration, because the original notes won't be deleted.
-
- We can't use insert_before here, because when from preconditioning,
- insert_before points before the loop. We can't use copy_end, because
- there may be insns already inserted after it (which we don't want to
- copy) when not from preconditioning code. */
-
- if (! last_iteration)
- {
- for (insn = copy_notes_from; insn != loop_end; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED)
- emit_note (NOTE_SOURCE_FILE (insn), NOTE_LINE_NUMBER (insn));
- }
- }
-
- if (final_label && LABEL_NUSES (final_label) > 0)
- emit_label (final_label);
-
- tem = gen_sequence ();
- end_sequence ();
- emit_insn_before (tem, insert_before);
-}
-
-/* Emit an insn, using the expand_binop to ensure that a valid insn is
- emitted. This will correctly handle the case where the increment value
- won't fit in the immediate field of a PLUS insns. */
-
-void
-emit_unrolled_add (dest_reg, src_reg, increment)
- rtx dest_reg, src_reg, increment;
-{
- rtx result;
-
- result = expand_binop (GET_MODE (dest_reg), add_optab, src_reg, increment,
- dest_reg, 0, OPTAB_LIB_WIDEN);
-
- if (dest_reg != result)
- emit_move_insn (dest_reg, result);
-}
-
-/* Searches the insns between INSN and LOOP_END. Returns 1 if there
- is a backward branch in that range that branches to somewhere between
- LOOP_START and INSN. Returns 0 otherwise. */
-
-/* ??? This is quadratic algorithm. Could be rewritten to be linear.
- In practice, this is not a problem, because this function is seldom called,
- and uses a negligible amount of CPU time on average. */
-
-int
-back_branch_in_range_p (insn, loop_start, loop_end)
- rtx insn;
- rtx loop_start, loop_end;
-{
- rtx p, q, target_insn;
-
- /* Stop before we get to the backward branch at the end of the loop. */
- loop_end = prev_nonnote_insn (loop_end);
- if (GET_CODE (loop_end) == BARRIER)
- loop_end = PREV_INSN (loop_end);
-
- /* Check in case insn has been deleted, search forward for first non
- deleted insn following it. */
- while (INSN_DELETED_P (insn))
- insn = NEXT_INSN (insn);
-
- /* Check for the case where insn is the last insn in the loop. */
- if (insn == loop_end)
- return 0;
-
- for (p = NEXT_INSN (insn); p != loop_end; p = NEXT_INSN (p))
- {
- if (GET_CODE (p) == JUMP_INSN)
- {
- target_insn = JUMP_LABEL (p);
-
- /* Search from loop_start to insn, to see if one of them is
- the target_insn. We can't use INSN_LUID comparisons here,
- since insn may not have an LUID entry. */
- for (q = loop_start; q != insn; q = NEXT_INSN (q))
- if (q == target_insn)
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Try to generate the simplest rtx for the expression
- (PLUS (MULT mult1 mult2) add1). This is used to calculate the initial
- value of giv's. */
-
-static rtx
-fold_rtx_mult_add (mult1, mult2, add1, mode)
- rtx mult1, mult2, add1;
- enum machine_mode mode;
-{
- rtx temp, mult_res;
- rtx result;
-
- /* The modes must all be the same. This should always be true. For now,
- check to make sure. */
- if ((GET_MODE (mult1) != mode && GET_MODE (mult1) != VOIDmode)
- || (GET_MODE (mult2) != mode && GET_MODE (mult2) != VOIDmode)
- || (GET_MODE (add1) != mode && GET_MODE (add1) != VOIDmode))
- abort ();
-
- /* Ensure that if at least one of mult1/mult2 are constant, then mult2
- will be a constant. */
- if (GET_CODE (mult1) == CONST_INT)
- {
- temp = mult2;
- mult2 = mult1;
- mult1 = temp;
- }
-
- mult_res = simplify_binary_operation (MULT, mode, mult1, mult2);
- if (! mult_res)
- mult_res = gen_rtx (MULT, mode, mult1, mult2);
-
- /* Again, put the constant second. */
- if (GET_CODE (add1) == CONST_INT)
- {
- temp = add1;
- add1 = mult_res;
- mult_res = temp;
- }
-
- result = simplify_binary_operation (PLUS, mode, add1, mult_res);
- if (! result)
- result = gen_rtx (PLUS, mode, add1, mult_res);
-
- return result;
-}
-
-/* Searches the list of induction struct's for the biv BL, to try to calculate
- the total increment value for one iteration of the loop as a constant.
-
- Returns the increment value as an rtx, simplified as much as possible,
- if it can be calculated. Otherwise, returns 0. */
-
-rtx
-biv_total_increment (bl, loop_start, loop_end)
- struct iv_class *bl;
- rtx loop_start, loop_end;
-{
- struct induction *v;
- rtx result;
-
- /* For increment, must check every instruction that sets it. Each
- instruction must be executed only once each time through the loop.
- To verify this, we check that the the insn is always executed, and that
- there are no backward branches after the insn that branch to before it.
- Also, the insn must have a mult_val of one (to make sure it really is
- an increment). */
-
- result = const0_rtx;
- for (v = bl->biv; v; v = v->next_iv)
- {
- if (v->always_computable && v->mult_val == const1_rtx
- && ! back_branch_in_range_p (v->insn, loop_start, loop_end))
- result = fold_rtx_mult_add (result, const1_rtx, v->add_val, v->mode);
- else
- return 0;
- }
-
- return result;
-}
-
-/* Determine the initial value of the iteration variable, and the amount
- that it is incremented each loop. Use the tables constructed by
- the strength reduction pass to calculate these values.
-
- Initial_value and/or increment are set to zero if their values could not
- be calculated. */
-
-static void
-iteration_info (iteration_var, initial_value, increment, loop_start, loop_end)
- rtx iteration_var, *initial_value, *increment;
- rtx loop_start, loop_end;
-{
- struct iv_class *bl;
- struct induction *v, *b;
-
- /* Clear the result values, in case no answer can be found. */
- *initial_value = 0;
- *increment = 0;
-
- /* The iteration variable can be either a giv or a biv. Check to see
- which it is, and compute the variable's initial value, and increment
- value if possible. */
-
- /* If this is a new register, can't handle it since we don't have any
- reg_iv_type entry for it. */
- if (REGNO (iteration_var) >= max_reg_before_loop)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: No reg_iv_type entry for iteration var.\n");
- return;
- }
-
- /* Reject iteration variables larger than the host wide int size, since they
- could result in a number of iterations greater than the range of our
- `unsigned HOST_WIDE_INT' variable loop_n_iterations. */
- else if ((GET_MODE_BITSIZE (GET_MODE (iteration_var))
- > HOST_BITS_PER_WIDE_INT))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Iteration var rejected because mode too large.\n");
- return;
- }
- else if (GET_MODE_CLASS (GET_MODE (iteration_var)) != MODE_INT)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Iteration var not an integer.\n");
- return;
- }
- else if (reg_iv_type[REGNO (iteration_var)] == BASIC_INDUCT)
- {
- /* Grab initial value, only useful if it is a constant. */
- bl = reg_biv_class[REGNO (iteration_var)];
- *initial_value = bl->initial_value;
-
- *increment = biv_total_increment (bl, loop_start, loop_end);
- }
- else if (reg_iv_type[REGNO (iteration_var)] == GENERAL_INDUCT)
- {
-#if 1
- /* ??? The code below does not work because the incorrect number of
- iterations is calculated when the biv is incremented after the giv
- is set (which is the usual case). This can probably be accounted
- for by biasing the initial_value by subtracting the amount of the
- increment that occurs between the giv set and the giv test. However,
- a giv as an iterator is very rare, so it does not seem worthwhile
- to handle this. */
- /* ??? An example failure is: i = 6; do {;} while (i++ < 9). */
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Giv iterators are not handled.\n");
- return;
-#else
- /* Initial value is mult_val times the biv's initial value plus
- add_val. Only useful if it is a constant. */
- v = reg_iv_info[REGNO (iteration_var)];
- bl = reg_biv_class[REGNO (v->src_reg)];
- *initial_value = fold_rtx_mult_add (v->mult_val, bl->initial_value,
- v->add_val, v->mode);
-
- /* Increment value is mult_val times the increment value of the biv. */
-
- *increment = biv_total_increment (bl, loop_start, loop_end);
- if (*increment)
- *increment = fold_rtx_mult_add (v->mult_val, *increment, const0_rtx,
- v->mode);
-#endif
- }
- else
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Not basic or general induction var.\n");
- return;
- }
-}
-
-/* Calculate the approximate final value of the iteration variable
- which has an loop exit test with code COMPARISON_CODE and comparison value
- of COMPARISON_VALUE. Also returns an indication of whether the comparison
- was signed or unsigned, and the direction of the comparison. This info is
- needed to calculate the number of loop iterations. */
-
-static rtx
-approx_final_value (comparison_code, comparison_value, unsigned_p, compare_dir)
- enum rtx_code comparison_code;
- rtx comparison_value;
- int *unsigned_p;
- int *compare_dir;
-{
- /* Calculate the final value of the induction variable.
- The exact final value depends on the branch operator, and increment sign.
- This is only an approximate value. It will be wrong if the iteration
- variable is not incremented by one each time through the loop, and
- approx final value - start value % increment != 0. */
-
- *unsigned_p = 0;
- switch (comparison_code)
- {
- case LEU:
- *unsigned_p = 1;
- case LE:
- *compare_dir = 1;
- return plus_constant (comparison_value, 1);
- case GEU:
- *unsigned_p = 1;
- case GE:
- *compare_dir = -1;
- return plus_constant (comparison_value, -1);
- case EQ:
- /* Can not calculate a final value for this case. */
- *compare_dir = 0;
- return 0;
- case LTU:
- *unsigned_p = 1;
- case LT:
- *compare_dir = 1;
- return comparison_value;
- break;
- case GTU:
- *unsigned_p = 1;
- case GT:
- *compare_dir = -1;
- return comparison_value;
- case NE:
- *compare_dir = 0;
- return comparison_value;
- default:
- abort ();
- }
-}
-
-/* For each biv and giv, determine whether it can be safely split into
- a different variable for each unrolled copy of the loop body. If it
- is safe to split, then indicate that by saving some useful info
- in the splittable_regs array.
-
- If the loop is being completely unrolled, then splittable_regs will hold
- the current value of the induction variable while the loop is unrolled.
- It must be set to the initial value of the induction variable here.
- Otherwise, splittable_regs will hold the difference between the current
- value of the induction variable and the value the induction variable had
- at the top of the loop. It must be set to the value 0 here.
-
- Returns the total number of instructions that set registers that are
- splittable. */
-
-/* ?? If the loop is only unrolled twice, then most of the restrictions to
- constant values are unnecessary, since we can easily calculate increment
- values in this case even if nothing is constant. The increment value
- should not involve a multiply however. */
-
-/* ?? Even if the biv/giv increment values aren't constant, it may still
- be beneficial to split the variable if the loop is only unrolled a few
- times, since multiplies by small integers (1,2,3,4) are very cheap. */
-
-static int
-find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before,
- unroll_number)
- enum unroll_types unroll_type;
- rtx loop_start, loop_end;
- rtx end_insert_before;
- int unroll_number;
-{
- struct iv_class *bl;
- struct induction *v;
- rtx increment, tem;
- rtx biv_final_value;
- int biv_splittable;
- int result = 0;
-
- for (bl = loop_iv_list; bl; bl = bl->next)
- {
- /* Biv_total_increment must return a constant value,
- otherwise we can not calculate the split values. */
-
- increment = biv_total_increment (bl, loop_start, loop_end);
- if (! increment || GET_CODE (increment) != CONST_INT)
- continue;
-
- /* The loop must be unrolled completely, or else have a known number
- of iterations and only one exit, or else the biv must be dead
- outside the loop, or else the final value must be known. Otherwise,
- it is unsafe to split the biv since it may not have the proper
- value on loop exit. */
-
- /* loop_number_exit_count is non-zero if the loop has an exit other than
- a fall through at the end. */
-
- biv_splittable = 1;
- biv_final_value = 0;
- if (unroll_type != UNROLL_COMPLETELY
- && (loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]]
- || unroll_type == UNROLL_NAIVE)
- && (uid_luid[regno_last_uid[bl->regno]] >= INSN_LUID (loop_end)
- || ! bl->init_insn
- || INSN_UID (bl->init_insn) >= max_uid_for_loop
- || (uid_luid[regno_first_uid[bl->regno]]
- < INSN_LUID (bl->init_insn))
- || reg_mentioned_p (bl->biv->dest_reg, SET_SRC (bl->init_set)))
- && ! (biv_final_value = final_biv_value (bl, loop_start, loop_end)))
- biv_splittable = 0;
-
- /* If any of the insns setting the BIV don't do so with a simple
- PLUS, we don't know how to split it. */
- for (v = bl->biv; biv_splittable && v; v = v->next_iv)
- if ((tem = single_set (v->insn)) == 0
- || GET_CODE (SET_DEST (tem)) != REG
- || REGNO (SET_DEST (tem)) != bl->regno
- || GET_CODE (SET_SRC (tem)) != PLUS)
- biv_splittable = 0;
-
- /* If final value is non-zero, then must emit an instruction which sets
- the value of the biv to the proper value. This is done after
- handling all of the givs, since some of them may need to use the
- biv's value in their initialization code. */
-
- /* This biv is splittable. If completely unrolling the loop, save
- the biv's initial value. Otherwise, save the constant zero. */
-
- if (biv_splittable == 1)
- {
- if (unroll_type == UNROLL_COMPLETELY)
- {
- /* If the initial value of the biv is itself (i.e. it is too
- complicated for strength_reduce to compute), or is a hard
- register, or it isn't invariant, then we must create a new
- pseudo reg to hold the initial value of the biv. */
-
- if (GET_CODE (bl->initial_value) == REG
- && (REGNO (bl->initial_value) == bl->regno
- || REGNO (bl->initial_value) < FIRST_PSEUDO_REGISTER
- || ! invariant_p (bl->initial_value)))
- {
- rtx tem = gen_reg_rtx (bl->biv->mode);
-
- emit_insn_before (gen_move_insn (tem, bl->biv->src_reg),
- loop_start);
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Biv %d initial value remapped to %d.\n",
- bl->regno, REGNO (tem));
-
- splittable_regs[bl->regno] = tem;
- }
- else
- splittable_regs[bl->regno] = bl->initial_value;
- }
- else
- splittable_regs[bl->regno] = const0_rtx;
-
- /* Save the number of instructions that modify the biv, so that
- we can treat the last one specially. */
-
- splittable_regs_updates[bl->regno] = bl->biv_count;
- result += bl->biv_count;
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Biv %d safe to split.\n", bl->regno);
- }
-
- /* Check every giv that depends on this biv to see whether it is
- splittable also. Even if the biv isn't splittable, givs which
- depend on it may be splittable if the biv is live outside the
- loop, and the givs aren't. */
-
- result += find_splittable_givs (bl, unroll_type, loop_start, loop_end,
- increment, unroll_number);
-
- /* If final value is non-zero, then must emit an instruction which sets
- the value of the biv to the proper value. This is done after
- handling all of the givs, since some of them may need to use the
- biv's value in their initialization code. */
- if (biv_final_value)
- {
- /* If the loop has multiple exits, emit the insns before the
- loop to ensure that it will always be executed no matter
- how the loop exits. Otherwise emit the insn after the loop,
- since this is slightly more efficient. */
- if (! loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]])
- emit_insn_before (gen_move_insn (bl->biv->src_reg,
- biv_final_value),
- end_insert_before);
- else
- {
- /* Create a new register to hold the value of the biv, and then
- set the biv to its final value before the loop start. The biv
- is set to its final value before loop start to ensure that
- this insn will always be executed, no matter how the loop
- exits. */
- rtx tem = gen_reg_rtx (bl->biv->mode);
- emit_insn_before (gen_move_insn (tem, bl->biv->src_reg),
- loop_start);
- emit_insn_before (gen_move_insn (bl->biv->src_reg,
- biv_final_value),
- loop_start);
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Biv %d mapped to %d for split.\n",
- REGNO (bl->biv->src_reg), REGNO (tem));
-
- /* Set up the mapping from the original biv register to the new
- register. */
- bl->biv->src_reg = tem;
- }
- }
- }
- return result;
-}
-
-/* Return 1 if the first and last unrolled copy of the address giv V is valid
- for the instruction that is using it. Do not make any changes to that
- instruction. */
-
-static int
-verify_addresses (v, giv_inc, unroll_number)
- struct induction *v;
- rtx giv_inc;
- int unroll_number;
-{
- int ret = 1;
- rtx orig_addr = *v->location;
- rtx last_addr = plus_constant (v->dest_reg,
- INTVAL (giv_inc) * (unroll_number - 1));
-
- /* First check to see if either address would fail. */
- if (! validate_change (v->insn, v->location, v->dest_reg, 0)
- || ! validate_change (v->insn, v->location, last_addr, 0))
- ret = 0;
-
- /* Now put things back the way they were before. This will always
- succeed. */
- validate_change (v->insn, v->location, orig_addr, 0);
-
- return ret;
-}
-
-/* For every giv based on the biv BL, check to determine whether it is
- splittable. This is a subroutine to find_splittable_regs ().
-
- Return the number of instructions that set splittable registers. */
-
-static int
-find_splittable_givs (bl, unroll_type, loop_start, loop_end, increment,
- unroll_number)
- struct iv_class *bl;
- enum unroll_types unroll_type;
- rtx loop_start, loop_end;
- rtx increment;
- int unroll_number;
-{
- struct induction *v, *v2;
- rtx final_value;
- rtx tem;
- int result = 0;
-
- /* Scan the list of givs, and set the same_insn field when there are
- multiple identical givs in the same insn. */
- for (v = bl->giv; v; v = v->next_iv)
- for (v2 = v->next_iv; v2; v2 = v2->next_iv)
- if (v->insn == v2->insn && rtx_equal_p (v->new_reg, v2->new_reg)
- && ! v2->same_insn)
- v2->same_insn = v;
-
- for (v = bl->giv; v; v = v->next_iv)
- {
- rtx giv_inc, value;
-
- /* Only split the giv if it has already been reduced, or if the loop is
- being completely unrolled. */
- if (unroll_type != UNROLL_COMPLETELY && v->ignore)
- continue;
-
- /* The giv can be split if the insn that sets the giv is executed once
- and only once on every iteration of the loop. */
- /* An address giv can always be split. v->insn is just a use not a set,
- and hence it does not matter whether it is always executed. All that
- matters is that all the biv increments are always executed, and we
- won't reach here if they aren't. */
- if (v->giv_type != DEST_ADDR
- && (! v->always_computable
- || back_branch_in_range_p (v->insn, loop_start, loop_end)))
- continue;
-
- /* The giv increment value must be a constant. */
- giv_inc = fold_rtx_mult_add (v->mult_val, increment, const0_rtx,
- v->mode);
- if (! giv_inc || GET_CODE (giv_inc) != CONST_INT)
- continue;
-
- /* The loop must be unrolled completely, or else have a known number of
- iterations and only one exit, or else the giv must be dead outside
- the loop, or else the final value of the giv must be known.
- Otherwise, it is not safe to split the giv since it may not have the
- proper value on loop exit. */
-
- /* The used outside loop test will fail for DEST_ADDR givs. They are
- never used outside the loop anyways, so it is always safe to split a
- DEST_ADDR giv. */
-
- final_value = 0;
- if (unroll_type != UNROLL_COMPLETELY
- && (loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]]
- || unroll_type == UNROLL_NAIVE)
- && v->giv_type != DEST_ADDR
- && ((regno_first_uid[REGNO (v->dest_reg)] != INSN_UID (v->insn)
- /* Check for the case where the pseudo is set by a shift/add
- sequence, in which case the first insn setting the pseudo
- is the first insn of the shift/add sequence. */
- && (! (tem = find_reg_note (v->insn, REG_RETVAL, NULL_RTX))
- || (regno_first_uid[REGNO (v->dest_reg)]
- != INSN_UID (XEXP (tem, 0)))))
- /* Line above always fails if INSN was moved by loop opt. */
- || (uid_luid[regno_last_uid[REGNO (v->dest_reg)]]
- >= INSN_LUID (loop_end)))
- && ! (final_value = v->final_value))
- continue;
-
-#if 0
- /* Currently, non-reduced/final-value givs are never split. */
- /* Should emit insns after the loop if possible, as the biv final value
- code below does. */
-
- /* If the final value is non-zero, and the giv has not been reduced,
- then must emit an instruction to set the final value. */
- if (final_value && !v->new_reg)
- {
- /* Create a new register to hold the value of the giv, and then set
- the giv to its final value before the loop start. The giv is set
- to its final value before loop start to ensure that this insn
- will always be executed, no matter how we exit. */
- tem = gen_reg_rtx (v->mode);
- emit_insn_before (gen_move_insn (tem, v->dest_reg), loop_start);
- emit_insn_before (gen_move_insn (v->dest_reg, final_value),
- loop_start);
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "Giv %d mapped to %d for split.\n",
- REGNO (v->dest_reg), REGNO (tem));
-
- v->src_reg = tem;
- }
-#endif
-
- /* This giv is splittable. If completely unrolling the loop, save the
- giv's initial value. Otherwise, save the constant zero for it. */
-
- if (unroll_type == UNROLL_COMPLETELY)
- {
- /* It is not safe to use bl->initial_value here, because it may not
- be invariant. It is safe to use the initial value stored in
- the splittable_regs array if it is set. In rare cases, it won't
- be set, so then we do exactly the same thing as
- find_splittable_regs does to get a safe value. */
- rtx biv_initial_value;
-
- if (splittable_regs[bl->regno])
- biv_initial_value = splittable_regs[bl->regno];
- else if (GET_CODE (bl->initial_value) != REG
- || (REGNO (bl->initial_value) != bl->regno
- && REGNO (bl->initial_value) >= FIRST_PSEUDO_REGISTER))
- biv_initial_value = bl->initial_value;
- else
- {
- rtx tem = gen_reg_rtx (bl->biv->mode);
-
- emit_insn_before (gen_move_insn (tem, bl->biv->src_reg),
- loop_start);
- biv_initial_value = tem;
- }
- value = fold_rtx_mult_add (v->mult_val, biv_initial_value,
- v->add_val, v->mode);
- }
- else
- value = const0_rtx;
-
- if (v->new_reg)
- {
- /* If a giv was combined with another giv, then we can only split
- this giv if the giv it was combined with was reduced. This
- is because the value of v->new_reg is meaningless in this
- case. */
- if (v->same && ! v->same->new_reg)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "giv combined with unreduced giv not split.\n");
- continue;
- }
- /* If the giv is an address destination, it could be something other
- than a simple register, these have to be treated differently. */
- else if (v->giv_type == DEST_REG)
- {
- /* If value is not a constant, register, or register plus
- constant, then compute its value into a register before
- loop start. This prevents invalid rtx sharing, and should
- generate better code. We can use bl->initial_value here
- instead of splittable_regs[bl->regno] because this code
- is going before the loop start. */
- if (unroll_type == UNROLL_COMPLETELY
- && GET_CODE (value) != CONST_INT
- && GET_CODE (value) != REG
- && (GET_CODE (value) != PLUS
- || GET_CODE (XEXP (value, 0)) != REG
- || GET_CODE (XEXP (value, 1)) != CONST_INT))
- {
- rtx tem = gen_reg_rtx (v->mode);
- emit_iv_add_mult (bl->initial_value, v->mult_val,
- v->add_val, tem, loop_start);
- value = tem;
- }
-
- splittable_regs[REGNO (v->new_reg)] = value;
- }
- else
- {
- /* Splitting address givs is useful since it will often allow us
- to eliminate some increment insns for the base giv as
- unnecessary. */
-
- /* If the addr giv is combined with a dest_reg giv, then all
- references to that dest reg will be remapped, which is NOT
- what we want for split addr regs. We always create a new
- register for the split addr giv, just to be safe. */
-
- /* ??? If there are multiple address givs which have been
- combined with the same dest_reg giv, then we may only need
- one new register for them. Pulling out constants below will
- catch some of the common cases of this. Currently, I leave
- the work of simplifying multiple address givs to the
- following cse pass. */
-
- /* As a special case, if we have multiple identical address givs
- within a single instruction, then we do use a single pseudo
- reg for both. This is necessary in case one is a match_dup
- of the other. */
-
- v->const_adjust = 0;
-
- if (v->same_insn)
- {
- v->dest_reg = v->same_insn->dest_reg;
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Sharing address givs in insn %d\n",
- INSN_UID (v->insn));
- }
- else if (unroll_type != UNROLL_COMPLETELY)
- {
- /* If not completely unrolling the loop, then create a new
- register to hold the split value of the DEST_ADDR giv.
- Emit insn to initialize its value before loop start. */
- tem = gen_reg_rtx (v->mode);
-
- /* If the address giv has a constant in its new_reg value,
- then this constant can be pulled out and put in value,
- instead of being part of the initialization code. */
-
- if (GET_CODE (v->new_reg) == PLUS
- && GET_CODE (XEXP (v->new_reg, 1)) == CONST_INT)
- {
- v->dest_reg
- = plus_constant (tem, INTVAL (XEXP (v->new_reg,1)));
-
- /* Only succeed if this will give valid addresses.
- Try to validate both the first and the last
- address resulting from loop unrolling, if
- one fails, then can't do const elim here. */
- if (verify_addresses (v, giv_inc, unroll_number))
- {
- /* Save the negative of the eliminated const, so
- that we can calculate the dest_reg's increment
- value later. */
- v->const_adjust = - INTVAL (XEXP (v->new_reg, 1));
-
- v->new_reg = XEXP (v->new_reg, 0);
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Eliminating constant from giv %d\n",
- REGNO (tem));
- }
- else
- v->dest_reg = tem;
- }
- else
- v->dest_reg = tem;
-
- /* If the address hasn't been checked for validity yet, do so
- now, and fail completely if either the first or the last
- unrolled copy of the address is not a valid address
- for the instruction that uses it. */
- if (v->dest_reg == tem
- && ! verify_addresses (v, giv_inc, unroll_number))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Invalid address for giv at insn %d\n",
- INSN_UID (v->insn));
- continue;
- }
-
- /* To initialize the new register, just move the value of
- new_reg into it. This is not guaranteed to give a valid
- instruction on machines with complex addressing modes.
- If we can't recognize it, then delete it and emit insns
- to calculate the value from scratch. */
- emit_insn_before (gen_rtx (SET, VOIDmode, tem,
- copy_rtx (v->new_reg)),
- loop_start);
- if (recog_memoized (PREV_INSN (loop_start)) < 0)
- {
- rtx sequence, ret;
-
- /* We can't use bl->initial_value to compute the initial
- value, because the loop may have been preconditioned.
- We must calculate it from NEW_REG. Try using
- force_operand instead of emit_iv_add_mult. */
- delete_insn (PREV_INSN (loop_start));
-
- start_sequence ();
- ret = force_operand (v->new_reg, tem);
- if (ret != tem)
- emit_move_insn (tem, ret);
- sequence = gen_sequence ();
- end_sequence ();
- emit_insn_before (sequence, loop_start);
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Invalid init insn, rewritten.\n");
- }
- }
- else
- {
- v->dest_reg = value;
-
- /* Check the resulting address for validity, and fail
- if the resulting address would be invalid. */
- if (! verify_addresses (v, giv_inc, unroll_number))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Invalid address for giv at insn %d\n",
- INSN_UID (v->insn));
- continue;
- }
- }
-
- /* Store the value of dest_reg into the insn. This sharing
- will not be a problem as this insn will always be copied
- later. */
-
- *v->location = v->dest_reg;
-
- /* If this address giv is combined with a dest reg giv, then
- save the base giv's induction pointer so that we will be
- able to handle this address giv properly. The base giv
- itself does not have to be splittable. */
-
- if (v->same && v->same->giv_type == DEST_REG)
- addr_combined_regs[REGNO (v->same->new_reg)] = v->same;
-
- if (GET_CODE (v->new_reg) == REG)
- {
- /* This giv maybe hasn't been combined with any others.
- Make sure that it's giv is marked as splittable here. */
-
- splittable_regs[REGNO (v->new_reg)] = value;
-
- /* Make it appear to depend upon itself, so that the
- giv will be properly split in the main loop above. */
- if (! v->same)
- {
- v->same = v;
- addr_combined_regs[REGNO (v->new_reg)] = v;
- }
- }
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream, "DEST_ADDR giv being split.\n");
- }
- }
- else
- {
-#if 0
- /* Currently, unreduced giv's can't be split. This is not too much
- of a problem since unreduced giv's are not live across loop
- iterations anyways. When unrolling a loop completely though,
- it makes sense to reduce&split givs when possible, as this will
- result in simpler instructions, and will not require that a reg
- be live across loop iterations. */
-
- splittable_regs[REGNO (v->dest_reg)] = value;
- fprintf (stderr, "Giv %d at insn %d not reduced\n",
- REGNO (v->dest_reg), INSN_UID (v->insn));
-#else
- continue;
-#endif
- }
-
- /* Givs are only updated once by definition. Mark it so if this is
- a splittable register. Don't need to do anything for address givs
- where this may not be a register. */
-
- if (GET_CODE (v->new_reg) == REG)
- splittable_regs_updates[REGNO (v->new_reg)] = 1;
-
- result++;
-
- if (loop_dump_stream)
- {
- int regnum;
-
- if (GET_CODE (v->dest_reg) == CONST_INT)
- regnum = -1;
- else if (GET_CODE (v->dest_reg) != REG)
- regnum = REGNO (XEXP (v->dest_reg, 0));
- else
- regnum = REGNO (v->dest_reg);
- fprintf (loop_dump_stream, "Giv %d at insn %d safe to split.\n",
- regnum, INSN_UID (v->insn));
- }
- }
-
- return result;
-}
-
-/* Try to prove that the register is dead after the loop exits. Trace every
- loop exit looking for an insn that will always be executed, which sets
- the register to some value, and appears before the first use of the register
- is found. If successful, then return 1, otherwise return 0. */
-
-/* ?? Could be made more intelligent in the handling of jumps, so that
- it can search past if statements and other similar structures. */
-
-static int
-reg_dead_after_loop (reg, loop_start, loop_end)
- rtx reg, loop_start, loop_end;
-{
- rtx insn, label;
- enum rtx_code code;
- int jump_count = 0;
- int label_count = 0;
- int this_loop_num = uid_loop_num[INSN_UID (loop_start)];
-
- /* In addition to checking all exits of this loop, we must also check
- all exits of inner nested loops that would exit this loop. We don't
- have any way to identify those, so we just give up if there are any
- such inner loop exits. */
-
- for (label = loop_number_exit_labels[this_loop_num]; label;
- label = LABEL_NEXTREF (label))
- label_count++;
-
- if (label_count != loop_number_exit_count[this_loop_num])
- return 0;
-
- /* HACK: Must also search the loop fall through exit, create a label_ref
- here which points to the loop_end, and append the loop_number_exit_labels
- list to it. */
- label = gen_rtx (LABEL_REF, VOIDmode, loop_end);
- LABEL_NEXTREF (label) = loop_number_exit_labels[this_loop_num];
-
- for ( ; label; label = LABEL_NEXTREF (label))
- {
- /* Succeed if find an insn which sets the biv or if reach end of
- function. Fail if find an insn that uses the biv, or if come to
- a conditional jump. */
-
- insn = NEXT_INSN (XEXP (label, 0));
- while (insn)
- {
- code = GET_CODE (insn);
- if (GET_RTX_CLASS (code) == 'i')
- {
- rtx set;
-
- if (reg_referenced_p (reg, PATTERN (insn)))
- return 0;
-
- set = single_set (insn);
- if (set && rtx_equal_p (SET_DEST (set), reg))
- break;
- }
-
- if (code == JUMP_INSN)
- {
- if (GET_CODE (PATTERN (insn)) == RETURN)
- break;
- else if (! simplejump_p (insn)
- /* Prevent infinite loop following infinite loops. */
- || jump_count++ > 20)
- return 0;
- else
- insn = JUMP_LABEL (insn);
- }
-
- insn = NEXT_INSN (insn);
- }
- }
-
- /* Success, the register is dead on all loop exits. */
- return 1;
-}
-
-/* Try to calculate the final value of the biv, the value it will have at
- the end of the loop. If we can do it, return that value. */
-
-rtx
-final_biv_value (bl, loop_start, loop_end)
- struct iv_class *bl;
- rtx loop_start, loop_end;
-{
- rtx increment, tem;
-
- /* ??? This only works for MODE_INT biv's. Reject all others for now. */
-
- if (GET_MODE_CLASS (bl->biv->mode) != MODE_INT)
- return 0;
-
- /* The final value for reversed bivs must be calculated differently than
- for ordinary bivs. In this case, there is already an insn after the
- loop which sets this biv's final value (if necessary), and there are
- no other loop exits, so we can return any value. */
- if (bl->reversed)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Final biv value for %d, reversed biv.\n", bl->regno);
-
- return const0_rtx;
- }
-
- /* Try to calculate the final value as initial value + (number of iterations
- * increment). For this to work, increment must be invariant, the only
- exit from the loop must be the fall through at the bottom (otherwise
- it may not have its final value when the loop exits), and the initial
- value of the biv must be invariant. */
-
- if (loop_n_iterations != 0
- && ! loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]]
- && invariant_p (bl->initial_value))
- {
- increment = biv_total_increment (bl, loop_start, loop_end);
-
- if (increment && invariant_p (increment))
- {
- /* Can calculate the loop exit value, emit insns after loop
- end to calculate this value into a temporary register in
- case it is needed later. */
-
- tem = gen_reg_rtx (bl->biv->mode);
- /* Make sure loop_end is not the last insn. */
- if (NEXT_INSN (loop_end) == 0)
- emit_note_after (NOTE_INSN_DELETED, loop_end);
- emit_iv_add_mult (increment, GEN_INT (loop_n_iterations),
- bl->initial_value, tem, NEXT_INSN (loop_end));
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Final biv value for %d, calculated.\n", bl->regno);
-
- return tem;
- }
- }
-
- /* Check to see if the biv is dead at all loop exits. */
- if (reg_dead_after_loop (bl->biv->src_reg, loop_start, loop_end))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Final biv value for %d, biv dead after loop exit.\n",
- bl->regno);
-
- return const0_rtx;
- }
-
- return 0;
-}
-
-/* Try to calculate the final value of the giv, the value it will have at
- the end of the loop. If we can do it, return that value. */
-
-rtx
-final_giv_value (v, loop_start, loop_end)
- struct induction *v;
- rtx loop_start, loop_end;
-{
- struct iv_class *bl;
- rtx insn;
- rtx increment, tem;
- rtx insert_before, seq;
-
- bl = reg_biv_class[REGNO (v->src_reg)];
-
- /* The final value for givs which depend on reversed bivs must be calculated
- differently than for ordinary givs. In this case, there is already an
- insn after the loop which sets this giv's final value (if necessary),
- and there are no other loop exits, so we can return any value. */
- if (bl->reversed)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Final giv value for %d, depends on reversed biv\n",
- REGNO (v->dest_reg));
- return const0_rtx;
- }
-
- /* Try to calculate the final value as a function of the biv it depends
- upon. The only exit from the loop must be the fall through at the bottom
- (otherwise it may not have its final value when the loop exits). */
-
- /* ??? Can calculate the final giv value by subtracting off the
- extra biv increments times the giv's mult_val. The loop must have
- only one exit for this to work, but the loop iterations does not need
- to be known. */
-
- if (loop_n_iterations != 0
- && ! loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]])
- {
- /* ?? It is tempting to use the biv's value here since these insns will
- be put after the loop, and hence the biv will have its final value
- then. However, this fails if the biv is subsequently eliminated.
- Perhaps determine whether biv's are eliminable before trying to
- determine whether giv's are replaceable so that we can use the
- biv value here if it is not eliminable. */
-
- increment = biv_total_increment (bl, loop_start, loop_end);
-
- if (increment && invariant_p (increment))
- {
- /* Can calculate the loop exit value of its biv as
- (loop_n_iterations * increment) + initial_value */
-
- /* The loop exit value of the giv is then
- (final_biv_value - extra increments) * mult_val + add_val.
- The extra increments are any increments to the biv which
- occur in the loop after the giv's value is calculated.
- We must search from the insn that sets the giv to the end
- of the loop to calculate this value. */
-
- insert_before = NEXT_INSN (loop_end);
-
- /* Put the final biv value in tem. */
- tem = gen_reg_rtx (bl->biv->mode);
- emit_iv_add_mult (increment, GEN_INT (loop_n_iterations),
- bl->initial_value, tem, insert_before);
-
- /* Subtract off extra increments as we find them. */
- for (insn = NEXT_INSN (v->insn); insn != loop_end;
- insn = NEXT_INSN (insn))
- {
- struct induction *biv;
-
- for (biv = bl->biv; biv; biv = biv->next_iv)
- if (biv->insn == insn)
- {
- start_sequence ();
- tem = expand_binop (GET_MODE (tem), sub_optab, tem,
- biv->add_val, NULL_RTX, 0,
- OPTAB_LIB_WIDEN);
- seq = gen_sequence ();
- end_sequence ();
- emit_insn_before (seq, insert_before);
- }
- }
-
- /* Now calculate the giv's final value. */
- emit_iv_add_mult (tem, v->mult_val, v->add_val, tem,
- insert_before);
-
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Final giv value for %d, calc from biv's value.\n",
- REGNO (v->dest_reg));
-
- return tem;
- }
- }
-
- /* Replaceable giv's should never reach here. */
- if (v->replaceable)
- abort ();
-
- /* Check to see if the biv is dead at all loop exits. */
- if (reg_dead_after_loop (v->dest_reg, loop_start, loop_end))
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Final giv value for %d, giv dead after loop exit.\n",
- REGNO (v->dest_reg));
-
- return const0_rtx;
- }
-
- return 0;
-}
-
-
-/* Calculate the number of loop iterations. Returns the exact number of loop
- iterations if it can be calculated, otherwise returns zero. */
-
-unsigned HOST_WIDE_INT
-loop_iterations (loop_start, loop_end)
- rtx loop_start, loop_end;
-{
- rtx comparison, comparison_value;
- rtx iteration_var, initial_value, increment, final_value;
- enum rtx_code comparison_code;
- HOST_WIDE_INT i;
- int increment_dir;
- int unsigned_compare, compare_dir, final_larger;
- unsigned long tempu;
- rtx last_loop_insn;
-
- /* First find the iteration variable. If the last insn is a conditional
- branch, and the insn before tests a register value, make that the
- iteration variable. */
-
- loop_initial_value = 0;
- loop_increment = 0;
- loop_final_value = 0;
- loop_iteration_var = 0;
-
- /* We used to use pren_nonnote_insn here, but that fails because it might
- accidentally get the branch for a contained loop if the branch for this
- loop was deleted. We can only trust branches immediately before the
- loop_end. */
- last_loop_insn = PREV_INSN (loop_end);
-
- comparison = get_condition_for_loop (last_loop_insn);
- if (comparison == 0)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: No final conditional branch found.\n");
- return 0;
- }
-
- /* ??? Get_condition may switch position of induction variable and
- invariant register when it canonicalizes the comparison. */
-
- comparison_code = GET_CODE (comparison);
- iteration_var = XEXP (comparison, 0);
- comparison_value = XEXP (comparison, 1);
-
- if (GET_CODE (iteration_var) != REG)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Comparison not against register.\n");
- return 0;
- }
-
- /* Loop iterations is always called before any new registers are created
- now, so this should never occur. */
-
- if (REGNO (iteration_var) >= max_reg_before_loop)
- abort ();
-
- iteration_info (iteration_var, &initial_value, &increment,
- loop_start, loop_end);
- if (initial_value == 0)
- /* iteration_info already printed a message. */
- return 0;
-
- /* If the comparison value is an invariant register, then try to find
- its value from the insns before the start of the loop. */
-
- if (GET_CODE (comparison_value) == REG && invariant_p (comparison_value))
- {
- rtx insn, set;
-
- for (insn = PREV_INSN (loop_start); insn ; insn = PREV_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL)
- break;
-
- else if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
- && reg_set_p (comparison_value, insn))
- {
- /* We found the last insn before the loop that sets the register.
- If it sets the entire register, and has a REG_EQUAL note,
- then use the value of the REG_EQUAL note. */
- if ((set = single_set (insn))
- && (SET_DEST (set) == comparison_value))
- {
- rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
- /* Only use the REG_EQUAL note if it is a constant.
- Other things, divide in particular, will cause
- problems later if we use them. */
- if (note && GET_CODE (XEXP (note, 0)) != EXPR_LIST
- && CONSTANT_P (XEXP (note, 0)))
- comparison_value = XEXP (note, 0);
- }
- break;
- }
- }
- }
-
- final_value = approx_final_value (comparison_code, comparison_value,
- &unsigned_compare, &compare_dir);
-
- /* Save the calculated values describing this loop's bounds, in case
- precondition_loop_p will need them later. These values can not be
- recalculated inside precondition_loop_p because strength reduction
- optimizations may obscure the loop's structure. */
-
- loop_iteration_var = iteration_var;
- loop_initial_value = initial_value;
- loop_increment = increment;
- loop_final_value = final_value;
- loop_comparison_code = comparison_code;
-
- if (increment == 0)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Increment value can't be calculated.\n");
- return 0;
- }
- else if (GET_CODE (increment) != CONST_INT)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Increment value not constant.\n");
- return 0;
- }
- else if (GET_CODE (initial_value) != CONST_INT)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Initial value not constant.\n");
- return 0;
- }
- else if (final_value == 0)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: EQ comparison loop.\n");
- return 0;
- }
- else if (GET_CODE (final_value) != CONST_INT)
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Final value not constant.\n");
- return 0;
- }
-
- /* ?? Final value and initial value do not have to be constants.
- Only their difference has to be constant. When the iteration variable
- is an array address, the final value and initial value might both
- be addresses with the same base but different constant offsets.
- Final value must be invariant for this to work.
-
- To do this, need some way to find the values of registers which are
- invariant. */
-
- /* Final_larger is 1 if final larger, 0 if they are equal, otherwise -1. */
- if (unsigned_compare)
- final_larger
- = ((unsigned HOST_WIDE_INT) INTVAL (final_value)
- > (unsigned HOST_WIDE_INT) INTVAL (initial_value))
- - ((unsigned HOST_WIDE_INT) INTVAL (final_value)
- < (unsigned HOST_WIDE_INT) INTVAL (initial_value));
- else
- final_larger = (INTVAL (final_value) > INTVAL (initial_value))
- - (INTVAL (final_value) < INTVAL (initial_value));
-
- if (INTVAL (increment) > 0)
- increment_dir = 1;
- else if (INTVAL (increment) == 0)
- increment_dir = 0;
- else
- increment_dir = -1;
-
- /* There are 27 different cases: compare_dir = -1, 0, 1;
- final_larger = -1, 0, 1; increment_dir = -1, 0, 1.
- There are 4 normal cases, 4 reverse cases (where the iteration variable
- will overflow before the loop exits), 4 infinite loop cases, and 15
- immediate exit (0 or 1 iteration depending on loop type) cases.
- Only try to optimize the normal cases. */
-
- /* (compare_dir/final_larger/increment_dir)
- Normal cases: (0/-1/-1), (0/1/1), (-1/-1/-1), (1/1/1)
- Reverse cases: (0/-1/1), (0/1/-1), (-1/-1/1), (1/1/-1)
- Infinite loops: (0/-1/0), (0/1/0), (-1/-1/0), (1/1/0)
- Immediate exit: (0/0/X), (-1/0/X), (-1/1/X), (1/0/X), (1/-1/X) */
-
- /* ?? If the meaning of reverse loops (where the iteration variable
- will overflow before the loop exits) is undefined, then could
- eliminate all of these special checks, and just always assume
- the loops are normal/immediate/infinite. Note that this means
- the sign of increment_dir does not have to be known. Also,
- since it does not really hurt if immediate exit loops or infinite loops
- are optimized, then that case could be ignored also, and hence all
- loops can be optimized.
-
- According to ANSI Spec, the reverse loop case result is undefined,
- because the action on overflow is undefined.
-
- See also the special test for NE loops below. */
-
- if (final_larger == increment_dir && final_larger != 0
- && (final_larger == compare_dir || compare_dir == 0))
- /* Normal case. */
- ;
- else
- {
- if (loop_dump_stream)
- fprintf (loop_dump_stream,
- "Loop unrolling: Not normal loop.\n");
- return 0;
- }
-
- /* Calculate the number of iterations, final_value is only an approximation,
- so correct for that. Note that tempu and loop_n_iterations are
- unsigned, because they can be as large as 2^n - 1. */
-
- i = INTVAL (increment);
- if (i > 0)
- tempu = INTVAL (final_value) - INTVAL (initial_value);
- else if (i < 0)
- {
- tempu = INTVAL (initial_value) - INTVAL (final_value);
- i = -i;
- }
- else
- abort ();
-
- /* For NE tests, make sure that the iteration variable won't miss the
- final value. If tempu mod i is not zero, then the iteration variable
- will overflow before the loop exits, and we can not calculate the
- number of iterations. */
- if (compare_dir == 0 && (tempu % i) != 0)
- return 0;
-
- return tempu / i + ((tempu % i) != 0);
-}
-
-/* Replace uses of split bivs with their split pseudo register. This is
- for original instructions which remain after loop unrolling without
- copying. */
-
-static rtx
-remap_split_bivs (x)
- rtx x;
-{
- register enum rtx_code code;
- register int i;
- register char *fmt;
-
- if (x == 0)
- return x;
-
- code = GET_CODE (x);
- switch (code)
- {
- case SCRATCH:
- case PC:
- case CC0:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST:
- case SYMBOL_REF:
- case LABEL_REF:
- return x;
-
- case REG:
-#if 0
- /* If non-reduced/final-value givs were split, then this would also
- have to remap those givs also. */
-#endif
- if (REGNO (x) < max_reg_before_loop
- && reg_iv_type[REGNO (x)] == BASIC_INDUCT)
- return reg_biv_class[REGNO (x)]->biv->src_reg;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- XEXP (x, i) = remap_split_bivs (XEXP (x, i));
- if (fmt[i] == 'E')
- {
- register int j;
- for (j = 0; j < XVECLEN (x, i); j++)
- XVECEXP (x, i, j) = remap_split_bivs (XVECEXP (x, i, j));
- }
- }
- return x;
-}
-
-/* If FIRST_UID is a set of REGNO, and FIRST_UID dominates LAST_UID (e.g.
- FIST_UID is always executed if LAST_UID is), then return 1. Otherwise
- return 0. COPY_START is where we can start looking for the insns
- FIRST_UID and LAST_UID. COPY_END is where we stop looking for these
- insns.
-
- If there is no JUMP_INSN between LOOP_START and FIRST_UID, then FIRST_UID
- must dominate LAST_UID.
-
- If there is a CODE_LABEL between FIRST_UID and LAST_UID, then FIRST_UID
- may not dominate LAST_UID.
-
- If there is no CODE_LABEL between FIRST_UID and LAST_UID, then FIRST_UID
- must dominate LAST_UID. */
-
-int
-set_dominates_use (regno, first_uid, last_uid, copy_start, copy_end)
- int regno;
- int first_uid;
- int last_uid;
- rtx copy_start;
- rtx copy_end;
-{
- int passed_jump = 0;
- rtx p = NEXT_INSN (copy_start);
-
- while (INSN_UID (p) != first_uid)
- {
- if (GET_CODE (p) == JUMP_INSN)
- passed_jump= 1;
- /* Could not find FIRST_UID. */
- if (p == copy_end)
- return 0;
- p = NEXT_INSN (p);
- }
-
- /* Verify that FIRST_UID is an insn that entirely sets REGNO. */
- if (GET_RTX_CLASS (GET_CODE (p)) != 'i'
- || ! dead_or_set_regno_p (p, regno))
- return 0;
-
- /* FIRST_UID is always executed. */
- if (passed_jump == 0)
- return 1;
-
- while (INSN_UID (p) != last_uid)
- {
- /* If we see a CODE_LABEL between FIRST_UID and LAST_UID, then we
- can not be sure that FIRST_UID dominates LAST_UID. */
- if (GET_CODE (p) == CODE_LABEL)
- return 0;
- p = NEXT_INSN (p);
- }
-
- /* FIRST_UID is always executed if LAST_UID is executed. */
- return 1;
-}
diff --git a/gcc/varasm.c b/gcc/varasm.c
deleted file mode 100644
index c422fbc3a08..00000000000
--- a/gcc/varasm.c
+++ /dev/null
@@ -1,4508 +0,0 @@
-/* Output variables, constants and external declarations, for GNU compiler.
- Copyright (C) 1987, 88, 89, 92-6, 1997 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 handles generation of all the assembler code
- *except* the instructions of a function.
- This includes declarations of variables and their initial values.
-
- We also output the assembler code for constants stored in memory
- and are responsible for combining constants with the same value. */
-
-#include <stdio.h>
-#include <setjmp.h>
-/* #include <stab.h> */
-#include "config.h"
-#include "rtl.h"
-#include "tree.h"
-#include "flags.h"
-#include "except.h"
-#include "function.h"
-#include "expr.h"
-#include "output.h"
-#include "hard-reg-set.h"
-#include "regs.h"
-#include "defaults.h"
-#include "real.h"
-#include "bytecode.h"
-
-#include "obstack.h"
-#include "c-pragma.h"
-
-#ifdef XCOFF_DEBUGGING_INFO
-#include "xcoffout.h"
-#endif
-
-#include <ctype.h>
-
-#ifndef TRAMPOLINE_ALIGNMENT
-#define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
-#endif
-
-#ifndef ASM_STABS_OP
-#define ASM_STABS_OP ".stabs"
-#endif
-
-/* This macro gets just the user-specified name
- out of the string in a SYMBOL_REF. On most machines,
- we discard the * if any and that's all. */
-#ifndef STRIP_NAME_ENCODING
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
- (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'))
-#endif
-
-/* File in which assembler code is being written. */
-
-extern FILE *asm_out_file;
-
-/* The (assembler) name of the first globally-visible object output. */
-char *first_global_object_name;
-
-extern struct obstack *current_obstack;
-extern struct obstack *saveable_obstack;
-extern struct obstack *rtl_obstack;
-extern struct obstack permanent_obstack;
-#define obstack_chunk_alloc xmalloc
-
-/* Number for making the label on the next
- constant that is stored in memory. */
-
-int const_labelno;
-
-/* Number for making the label on the next
- static variable internal to a function. */
-
-int var_labelno;
-
-/* Carry information from ASM_DECLARE_OBJECT_NAME
- to ASM_FINISH_DECLARE_OBJECT. */
-
-int size_directive_output;
-
-/* The last decl for which assemble_variable was called,
- if it did ASM_DECLARE_OBJECT_NAME.
- If the last call to assemble_variable didn't do that,
- this holds 0. */
-
-tree last_assemble_variable_decl;
-
-
-#ifdef HANDLE_PRAGMA_WEAK
-/* Any weak symbol declarations waiting to be emitted. */
-
-struct weak_syms
-{
- struct weak_syms *next;
- char *name;
- char *value;
-};
-
-static struct weak_syms *weak_decls;
-#endif
-
-/* Nonzero if at least one function definition has been seen. */
-
-static int function_defined;
-
-struct addr_const;
-struct constant_descriptor;
-struct rtx_const;
-struct pool_constant;
-
-static void bc_make_decl_rtl PROTO((tree, char *, int));
-static char *strip_reg_name PROTO((char *));
-static void bc_output_ascii PROTO((FILE *, char *, int));
-static int contains_pointers_p PROTO((tree));
-static void decode_addr_const PROTO((tree, struct addr_const *));
-static int const_hash PROTO((tree));
-static int compare_constant PROTO((tree,
- struct constant_descriptor *));
-static char *compare_constant_1 PROTO((tree, char *));
-static struct constant_descriptor *record_constant PROTO((tree));
-static void record_constant_1 PROTO((tree));
-static tree copy_constant PROTO((tree));
-static void output_constant_def_contents PROTO((tree, int, int));
-static void decode_rtx_const PROTO((enum machine_mode, rtx,
- struct rtx_const *));
-static int const_hash_rtx PROTO((enum machine_mode, rtx));
-static int compare_constant_rtx PROTO((enum machine_mode, rtx,
- struct constant_descriptor *));
-static struct constant_descriptor *record_constant_rtx PROTO((enum machine_mode,
- rtx));
-static struct pool_constant *find_pool_constant PROTO((rtx));
-static void mark_constant_pool PROTO((void));
-static void mark_constants PROTO((rtx));
-static int output_addressed_constants PROTO((tree));
-static void output_after_function_constants PROTO((void));
-static void bc_assemble_integer PROTO((tree, int));
-static void output_constructor PROTO((tree, int));
-
-static enum in_section { no_section, in_text, in_data, in_named
-#ifdef BSS_SECTION_ASM_OP
- , in_bss
-#endif
-#ifdef EXTRA_SECTIONS
- , EXTRA_SECTIONS
-#endif
-} in_section = no_section;
-
-/* Return a non-zero value if DECL has a section attribute. */
-#define IN_NAMED_SECTION(DECL) \
- ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \
- && DECL_SECTION_NAME (DECL) != NULL_TREE)
-
-/* Text of section name when in_section == in_named. */
-static char *in_named_name;
-
-/* Define functions like text_section for any extra sections. */
-#ifdef EXTRA_SECTION_FUNCTIONS
-EXTRA_SECTION_FUNCTIONS
-#endif
-
-/* Tell assembler to switch to text section. */
-
-void
-text_section ()
-{
- if (in_section != in_text)
- {
- if (output_bytecode)
- bc_text ();
- else
- fprintf (asm_out_file, "%s\n", TEXT_SECTION_ASM_OP);
-
- in_section = in_text;
- }
-}
-
-/* Tell assembler to switch to data section. */
-
-void
-data_section ()
-{
- if (in_section != in_data)
- {
- if (output_bytecode)
- bc_data ();
- else
- {
- if (flag_shared_data)
- {
-#ifdef SHARED_SECTION_ASM_OP
- fprintf (asm_out_file, "%s\n", SHARED_SECTION_ASM_OP);
-#else
- fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP);
-#endif
- }
- else
- fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP);
- }
-
- in_section = in_data;
- }
-}
-
-/* Tell assembler to switch to read-only data section. This is normally
- the text section. */
-
-void
-readonly_data_section ()
-{
-#ifdef READONLY_DATA_SECTION
- READONLY_DATA_SECTION (); /* Note this can call data_section. */
-#else
- text_section ();
-#endif
-}
-
-/* Determine if we're in the text section. */
-
-int
-in_text_section ()
-{
- return in_section == in_text;
-}
-
-/* Determine if we're in the data section. */
-
-int
-in_data_section ()
-{
- return in_section == in_data;
-}
-
-/* Tell assembler to change to section NAME for DECL.
- If DECL is NULL, just switch to section NAME.
- If NAME is NULL, get the name from DECL. */
-
-void
-named_section (decl, name)
- tree decl;
- char *name;
-{
- if (decl != NULL_TREE
- && TREE_CODE_CLASS (TREE_CODE (decl)) != 'd')
- abort ();
- if (name == NULL)
- name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
-
- if (in_section != in_named || strcmp (name, in_named_name))
- {
- in_named_name = obstack_alloc (&permanent_obstack, strlen (name) + 1);
- strcpy (in_named_name, name);
- in_section = in_named;
-
-#ifdef ASM_OUTPUT_SECTION_NAME
- ASM_OUTPUT_SECTION_NAME (asm_out_file, decl, name);
-#else
- /* Section attributes are not supported if this macro isn't provided -
- some host formats don't support them at all. The front-end should
- already have flagged this as an error. */
- abort ();
-#endif
- }
-}
-
-#ifdef BSS_SECTION_ASM_OP
-
-/* Tell the assembler to switch to the bss section. */
-
-void
-bss_section ()
-{
- if (in_section != in_bss)
- {
- if (output_bytecode)
- bc_data ();
- else
- {
-#ifdef SHARED_BSS_SECTION_ASM_OP
- if (flag_shared_data)
- fprintf (asm_out_file, "%s\n", SHARED_BSS_SECTION_ASM_OP);
- else
-#endif
- fprintf (asm_out_file, "%s\n", BSS_SECTION_ASM_OP);
- }
-
- in_section = in_bss;
- }
-}
-
-#ifdef ASM_OUTPUT_BSS
-
-/* Utility function for ASM_OUTPUT_BSS for targets to use if
- they don't support alignments in .bss.
- ??? It is believed that this function will work in most cases so such
- support is localized here. */
-
-static void
-asm_output_bss (file, decl, name, size, rounded)
- FILE *file;
- tree decl;
- char *name;
- int size, rounded;
-{
- ASM_GLOBALIZE_LABEL (file, name);
- bss_section ();
-#ifdef ASM_DECLARE_OBJECT_NAME
- last_assemble_variable_decl = decl;
- ASM_DECLARE_OBJECT_NAME (file, name, decl);
-#else
- /* Standard thing is just output label for the object. */
- ASM_OUTPUT_LABEL (file, name);
-#endif /* ASM_DECLARE_OBJECT_NAME */
- ASM_OUTPUT_SKIP (file, rounded);
-}
-
-#endif
-
-#ifdef ASM_OUTPUT_ALIGNED_BSS
-
-/* Utility function for targets to use in implementing
- ASM_OUTPUT_ALIGNED_BSS.
- ??? It is believed that this function will work in most cases so such
- support is localized here. */
-
-static void
-asm_output_aligned_bss (file, decl, name, size, align)
- FILE *file;
- tree decl;
- char *name;
- int size, align;
-{
- ASM_GLOBALIZE_LABEL (file, name);
- bss_section ();
- ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
-#ifdef ASM_DECLARE_OBJECT_NAME
- last_assemble_variable_decl = decl;
- ASM_DECLARE_OBJECT_NAME (file, name, decl);
-#else
- /* Standard thing is just output label for the object. */
- ASM_OUTPUT_LABEL (file, name);
-#endif /* ASM_DECLARE_OBJECT_NAME */
- ASM_OUTPUT_SKIP (file, size ? size : 1);
-}
-
-#endif
-
-#endif /* BSS_SECTION_ASM_OP */
-
-/* Switch to the section for function DECL.
-
- If DECL is NULL_TREE, switch to the text section.
- ??? It's not clear that we will ever be passed NULL_TREE, but it's
- safer to handle it. */
-
-void
-function_section (decl)
- tree decl;
-{
- if (decl != NULL_TREE
- && DECL_SECTION_NAME (decl) != NULL_TREE)
- named_section (decl, (char *) 0);
- else
- text_section ();
-}
-
-/* Switch to section for variable DECL.
-
- RELOC is the `reloc' argument to SELECT_SECTION. */
-
-void
-variable_section (decl, reloc)
- tree decl;
- int reloc;
-{
- if (IN_NAMED_SECTION (decl))
- named_section (decl, NULL);
- else
- {
- /* C++ can have const variables that get initialized from constructors,
- and thus can not be in a readonly section. We prevent this by
- verifying that the initial value is constant for objects put in a
- readonly section.
-
- error_mark_node is used by the C front end to indicate that the
- initializer has not been seen yet. In this case, we assume that
- the initializer must be constant.
-
- C++ uses error_mark_node for variables that have complicated
- initializers, but these variables go in BSS so we won't be called
- for them. */
-
-#ifdef SELECT_SECTION
- SELECT_SECTION (decl, reloc);
-#else
- if (TREE_READONLY (decl)
- && ! TREE_THIS_VOLATILE (decl)
- && DECL_INITIAL (decl)
- && (DECL_INITIAL (decl) == error_mark_node
- || TREE_CONSTANT (DECL_INITIAL (decl)))
- && ! (flag_pic && reloc))
- readonly_data_section ();
- else
- data_section ();
-#endif
- }
-}
-
-/* Tell assembler to switch to the section for the exception handling
- table. */
-
-void
-exception_section ()
-{
-#ifdef ASM_OUTPUT_SECTION_NAME
- named_section (NULL_TREE, ".gcc_except_table");
-#else
- if (flag_pic)
- data_section ();
- else
-#if defined (EXCEPTION_SECTION)
- EXCEPTION_SECTION ();
-#else
- readonly_data_section ();
-#endif
-#endif
-}
-
-/* Create the rtl to represent a function, for a function definition.
- DECL is a FUNCTION_DECL node which describes which function.
- The rtl is stored into DECL. */
-
-void
-make_function_rtl (decl)
- tree decl;
-{
- char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-
- if (output_bytecode)
- {
- if (DECL_RTL (decl) == 0)
- DECL_RTL (decl) = bc_gen_rtx (name, 0, (struct bc_label *) 0);
-
- /* Record that at least one function has been defined. */
- function_defined = 1;
- return;
- }
-
- /* Rename a nested function to avoid conflicts. */
- if (decl_function_context (decl) != 0
- && DECL_INITIAL (decl) != 0
- && DECL_RTL (decl) == 0)
- {
- char *label;
-
- name = IDENTIFIER_POINTER (DECL_NAME (decl));
- ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno);
- name = obstack_copy0 (saveable_obstack, label, strlen (label));
- var_labelno++;
- }
-
- if (DECL_RTL (decl) == 0)
- {
- DECL_RTL (decl)
- = gen_rtx (MEM, DECL_MODE (decl),
- gen_rtx (SYMBOL_REF, Pmode, name));
-
- /* Optionally set flags or add text to the name to record information
- such as that it is a function name. If the name is changed, the macro
- ASM_OUTPUT_LABELREF will have to know how to strip this information. */
-#ifdef ENCODE_SECTION_INFO
- ENCODE_SECTION_INFO (decl);
-#endif
- }
-
- /* Record at least one function has been defined. */
- function_defined = 1;
-}
-
-/* Create the DECL_RTL for a declaration for a static or external
- variable or static or external function.
- ASMSPEC, if not 0, is the string which the user specified
- as the assembler symbol name.
- TOP_LEVEL is nonzero if this is a file-scope variable.
- This is never called for PARM_DECLs. */
-
-static void
-bc_make_decl_rtl (decl, asmspec, top_level)
- tree decl;
- char *asmspec;
- int top_level;
-{
- register char *name = TREE_STRING_POINTER (DECL_ASSEMBLER_NAME (decl));
-
- if (DECL_RTL (decl) == 0)
- {
- /* Print an error message for register variables. */
- if (DECL_REGISTER (decl))
- error ("global register variables not supported in the interpreter");
-
- /* Handle ordinary static variables and functions. */
- if (DECL_RTL (decl) == 0)
- {
- /* Can't use just the variable's own name for a variable
- whose scope is less than the whole file.
- Concatenate a distinguishing number. */
- if (!top_level && !DECL_EXTERNAL (decl) && asmspec == 0)
- {
- char *label;
-
- ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno);
- name = obstack_copy0 (saveable_obstack, label, strlen (label));
- var_labelno++;
- }
-
- DECL_RTL (decl) = bc_gen_rtx (name, 0, (struct bc_label *) 0);
- }
- }
-}
-
-/* Given NAME, a putative register name, discard any customary prefixes. */
-
-static char *
-strip_reg_name (name)
- char *name;
-{
-#ifdef REGISTER_PREFIX
- if (!strncmp (name, REGISTER_PREFIX, strlen (REGISTER_PREFIX)))
- name += strlen (REGISTER_PREFIX);
-#endif
- if (name[0] == '%' || name[0] == '#')
- name++;
- return name;
-}
-
-/* Decode an `asm' spec for a declaration as a register name.
- Return the register number, or -1 if nothing specified,
- or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized,
- or -3 if ASMSPEC is `cc' and is not recognized,
- or -4 if ASMSPEC is `memory' and is not recognized.
- Accept an exact spelling or a decimal number.
- Prefixes such as % are optional. */
-
-int
-decode_reg_name (asmspec)
- char *asmspec;
-{
- if (asmspec != 0)
- {
- int i;
-
- /* Get rid of confusing prefixes. */
- asmspec = strip_reg_name (asmspec);
-
- /* Allow a decimal number as a "register name". */
- for (i = strlen (asmspec) - 1; i >= 0; i--)
- if (! (asmspec[i] >= '0' && asmspec[i] <= '9'))
- break;
- if (asmspec[0] != 0 && i < 0)
- {
- i = atoi (asmspec);
- if (i < FIRST_PSEUDO_REGISTER && i >= 0)
- return i;
- else
- return -2;
- }
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (reg_names[i][0]
- && ! strcmp (asmspec, strip_reg_name (reg_names[i])))
- return i;
-
-#ifdef ADDITIONAL_REGISTER_NAMES
- {
- static struct { char *name; int number; } table[]
- = ADDITIONAL_REGISTER_NAMES;
-
- for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
- if (! strcmp (asmspec, table[i].name))
- return table[i].number;
- }
-#endif /* ADDITIONAL_REGISTER_NAMES */
-
- if (!strcmp (asmspec, "memory"))
- return -4;
-
- if (!strcmp (asmspec, "cc"))
- return -3;
-
- return -2;
- }
-
- return -1;
-}
-
-/* Create the DECL_RTL for a declaration for a static or external variable
- or static or external function.
- ASMSPEC, if not 0, is the string which the user specified
- as the assembler symbol name.
- TOP_LEVEL is nonzero if this is a file-scope variable.
-
- This is never called for PARM_DECL nodes. */
-
-void
-make_decl_rtl (decl, asmspec, top_level)
- tree decl;
- char *asmspec;
- int top_level;
-{
- register char *name = 0;
- int reg_number;
-
- if (output_bytecode)
- {
- bc_make_decl_rtl (decl, asmspec, top_level);
- return;
- }
-
- reg_number = decode_reg_name (asmspec);
-
- if (DECL_ASSEMBLER_NAME (decl) != NULL_TREE)
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-
- if (reg_number == -2)
- {
- /* ASMSPEC is given, and not the name of a register. */
- name = (char *) obstack_alloc (saveable_obstack,
- strlen (asmspec) + 2);
- name[0] = '*';
- strcpy (&name[1], asmspec);
- }
-
- /* For a duplicate declaration, we can be called twice on the
- same DECL node. Don't discard the RTL already made. */
- if (DECL_RTL (decl) == 0)
- {
- DECL_RTL (decl) = 0;
-
- /* First detect errors in declaring global registers. */
- if (TREE_CODE (decl) != FUNCTION_DECL
- && DECL_REGISTER (decl) && reg_number == -1)
- error_with_decl (decl,
- "register name not specified for `%s'");
- else if (TREE_CODE (decl) != FUNCTION_DECL
- && DECL_REGISTER (decl) && reg_number < 0)
- error_with_decl (decl,
- "invalid register name for `%s'");
- else if ((reg_number >= 0 || reg_number == -3)
- && (TREE_CODE (decl) == FUNCTION_DECL
- && ! DECL_REGISTER (decl)))
- error_with_decl (decl,
- "register name given for non-register variable `%s'");
- else if (TREE_CODE (decl) != FUNCTION_DECL
- && DECL_REGISTER (decl)
- && TYPE_MODE (TREE_TYPE (decl)) == BLKmode)
- error_with_decl (decl,
- "data type of `%s' isn't suitable for a register");
- else if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl)
- && ! HARD_REGNO_MODE_OK (reg_number,
- TYPE_MODE (TREE_TYPE (decl))))
- error_with_decl (decl,
- "register number for `%s' isn't suitable for data type");
- /* Now handle properly declared static register variables. */
- else if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl))
- {
- int nregs;
-
- if (DECL_INITIAL (decl) != 0 && top_level)
- {
- DECL_INITIAL (decl) = 0;
- error ("global register variable has initial value");
- }
- if (fixed_regs[reg_number] == 0
- && function_defined && top_level)
- error ("global register variable follows a function definition");
- if (TREE_THIS_VOLATILE (decl))
- warning ("volatile register variables don't work as you might wish");
-
- /* If the user specified one of the eliminables registers here,
- e.g., FRAME_POINTER_REGNUM, we don't want to get this variable
- confused with that register and be eliminated. Although this
- usage is somewhat suspect, we nevertheless use the following
- kludge to avoid setting DECL_RTL to frame_pointer_rtx. */
-
- DECL_RTL (decl)
- = gen_rtx (REG, DECL_MODE (decl), FIRST_PSEUDO_REGISTER);
- REGNO (DECL_RTL (decl)) = reg_number;
- REG_USERVAR_P (DECL_RTL (decl)) = 1;
-
- if (top_level)
- {
- /* Make this register global, so not usable for anything
- else. */
- nregs = HARD_REGNO_NREGS (reg_number, DECL_MODE (decl));
- while (nregs > 0)
- globalize_reg (reg_number + --nregs);
- }
- }
- /* Specifying a section attribute on a variable forces it into a
- non-.bss section, and thus it cannot be common. */
- else if (TREE_CODE (decl) == VAR_DECL
- && DECL_SECTION_NAME (decl) != NULL_TREE
- && DECL_INITIAL (decl) == NULL_TREE
- && DECL_COMMON (decl))
- DECL_COMMON (decl) = 0;
-
- /* Now handle ordinary static variables and functions (in memory).
- Also handle vars declared register invalidly. */
- if (DECL_RTL (decl) == 0)
- {
- /* Can't use just the variable's own name for a variable
- whose scope is less than the whole file.
- Concatenate a distinguishing number. */
- if (!top_level && !DECL_EXTERNAL (decl) && asmspec == 0)
- {
- char *label;
-
- ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno);
- name = obstack_copy0 (saveable_obstack, label, strlen (label));
- var_labelno++;
- }
-
- if (name == 0)
- abort ();
-
- DECL_RTL (decl) = gen_rtx (MEM, DECL_MODE (decl),
- gen_rtx (SYMBOL_REF, Pmode, name));
-
- /* If this variable is to be treated as volatile, show its
- tree node has side effects. If it has side effects, either
- because of this test or from TREE_THIS_VOLATILE also
- being set, show the MEM is volatile. */
- if (flag_volatile_global && TREE_CODE (decl) == VAR_DECL
- && TREE_PUBLIC (decl))
- TREE_SIDE_EFFECTS (decl) = 1;
- if (TREE_SIDE_EFFECTS (decl))
- MEM_VOLATILE_P (DECL_RTL (decl)) = 1;
-
- if (TREE_READONLY (decl))
- RTX_UNCHANGING_P (DECL_RTL (decl)) = 1;
- MEM_IN_STRUCT_P (DECL_RTL (decl))
- = AGGREGATE_TYPE_P (TREE_TYPE (decl));
-
- /* Optionally set flags or add text to the name to record information
- such as that it is a function name.
- If the name is changed, the macro ASM_OUTPUT_LABELREF
- will have to know how to strip this information. */
-#ifdef ENCODE_SECTION_INFO
- ENCODE_SECTION_INFO (decl);
-#endif
- }
- }
- /* If the old RTL had the wrong mode, fix the mode. */
- else if (GET_MODE (DECL_RTL (decl)) != DECL_MODE (decl))
- {
- rtx rtl = DECL_RTL (decl);
- PUT_MODE (rtl, DECL_MODE (decl));
- }
-}
-
-/* Make the rtl for variable VAR be volatile.
- Use this only for static variables. */
-
-void
-make_var_volatile (var)
- tree var;
-{
- if (GET_CODE (DECL_RTL (var)) != MEM)
- abort ();
-
- MEM_VOLATILE_P (DECL_RTL (var)) = 1;
-}
-
-/* Output alignment directive to align for constant expression EXP. */
-
-void
-assemble_constant_align (exp)
- tree exp;
-{
- int align;
-
- /* Align the location counter as required by EXP's data type. */
- align = TYPE_ALIGN (TREE_TYPE (exp));
-#ifdef CONSTANT_ALIGNMENT
- align = CONSTANT_ALIGNMENT (exp, align);
-#endif
-
- if (align > BITS_PER_UNIT)
- ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
-}
-
-/* Output a string of literal assembler code
- for an `asm' keyword used between functions. */
-
-void
-assemble_asm (string)
- tree string;
-{
- if (output_bytecode)
- {
- error ("asm statements not allowed in interpreter");
- return;
- }
-
- app_enable ();
-
- if (TREE_CODE (string) == ADDR_EXPR)
- string = TREE_OPERAND (string, 0);
-
- fprintf (asm_out_file, "\t%s\n", TREE_STRING_POINTER (string));
-}
-
-#if 0 /* This should no longer be needed, because
- flag_gnu_linker should be 0 on these systems,
- which should prevent any output
- if ASM_OUTPUT_CONSTRUCTOR and ASM_OUTPUT_DESTRUCTOR are absent. */
-#if !(defined(DBX_DEBUGGING_INFO) && !defined(FASCIST_ASSEMBLER))
-#ifndef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(file, name)
-#endif
-#ifndef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(file, name)
-#endif
-#endif
-#endif /* 0 */
-
-/* Record an element in the table of global destructors.
- How this is done depends on what sort of assembler and linker
- are in use.
-
- NAME should be the name of a global function to be called
- at exit time. This name is output using assemble_name. */
-
-void
-assemble_destructor (name)
- char *name;
-{
-#ifdef ASM_OUTPUT_DESTRUCTOR
- ASM_OUTPUT_DESTRUCTOR (asm_out_file, name);
-#else
- if (flag_gnu_linker)
- {
- /* Now tell GNU LD that this is part of the static destructor set. */
- /* This code works for any machine provided you use GNU as/ld. */
- fprintf (asm_out_file, "%s \"___DTOR_LIST__\",22,0,0,", ASM_STABS_OP);
- assemble_name (asm_out_file, name);
- fputc ('\n', asm_out_file);
- }
-#endif
-}
-
-/* Likewise for global constructors. */
-
-void
-assemble_constructor (name)
- char *name;
-{
-#ifdef ASM_OUTPUT_CONSTRUCTOR
- ASM_OUTPUT_CONSTRUCTOR (asm_out_file, name);
-#else
- if (flag_gnu_linker)
- {
- /* Now tell GNU LD that this is part of the static constructor set. */
- /* This code works for any machine provided you use GNU as/ld. */
- fprintf (asm_out_file, "%s \"___CTOR_LIST__\",22,0,0,", ASM_STABS_OP);
- assemble_name (asm_out_file, name);
- fputc ('\n', asm_out_file);
- }
-#endif
-}
-
-/* Likewise for entries we want to record for garbage collection.
- Garbage collection is still under development. */
-
-void
-assemble_gc_entry (name)
- char *name;
-{
-#ifdef ASM_OUTPUT_GC_ENTRY
- ASM_OUTPUT_GC_ENTRY (asm_out_file, name);
-#else
- if (flag_gnu_linker)
- {
- /* Now tell GNU LD that this is part of the static constructor set. */
- fprintf (asm_out_file, "%s \"___PTR_LIST__\",22,0,0,", ASM_STABS_OP);
- assemble_name (asm_out_file, name);
- fputc ('\n', asm_out_file);
- }
-#endif
-}
-
-/* CONSTANT_POOL_BEFORE_FUNCTION may be defined as an expression with
- a non-zero value if the constant pool should be output before the
- start of the function, or a zero value if the pool should output
- after the end of the function. The default is to put it before the
- start. */
-
-#ifndef CONSTANT_POOL_BEFORE_FUNCTION
-#define CONSTANT_POOL_BEFORE_FUNCTION 1
-#endif
-
-/* Output assembler code for the constant pool of a function and associated
- with defining the name of the function. DECL describes the function.
- NAME is the function's name. For the constant pool, we use the current
- constant pool data. */
-
-void
-assemble_start_function (decl, fnname)
- tree decl;
- char *fnname;
-{
- int align;
-
- /* The following code does not need preprocessing in the assembler. */
-
- app_disable ();
-
- if (CONSTANT_POOL_BEFORE_FUNCTION)
- output_constant_pool (fnname, decl);
-
-#ifdef ASM_OUTPUT_SECTION_NAME
- /* If the function is to be put in its own section and it's not in a section
- already, indicate so. */
- if (flag_function_sections
- && DECL_SECTION_NAME (decl) == NULL_TREE)
- {
-#ifdef UNIQUE_SECTION
- DECL_SECTION_NAME(decl) = UNIQUE_SECTION (decl);
-#else
- char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
- /* Strip off any encoding in name. */
- STRIP_NAME_ENCODING (name, name);
- DECL_SECTION_NAME (decl) = build_string (strlen (name), name);
-#endif
- }
-#endif
-
- function_section (decl);
-
- /* Tell assembler to move to target machine's alignment for functions. */
- align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT);
- if (align > 0)
- {
- if (output_bytecode)
- BC_OUTPUT_ALIGN (asm_out_file, align);
- else
- ASM_OUTPUT_ALIGN (asm_out_file, align);
- }
-
-#ifdef ASM_OUTPUT_FUNCTION_PREFIX
- ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file, fnname);
-#endif
-
-#ifdef SDB_DEBUGGING_INFO
- /* Output SDB definition of the function. */
- if (write_symbols == SDB_DEBUG)
- sdbout_mark_begin_function ();
-#endif
-
-#ifdef DBX_DEBUGGING_INFO
- /* Output DBX definition of the function. */
- if (write_symbols == DBX_DEBUG)
- dbxout_begin_function (decl);
-#endif
-
- /* Make function name accessible from other files, if appropriate. */
-
- if (TREE_PUBLIC (decl))
- {
- if (!first_global_object_name && ! DECL_WEAK (decl)
- && ! DECL_ONE_ONLY (decl))
- {
- char *p;
-
- STRIP_NAME_ENCODING (p, fnname);
- first_global_object_name = permalloc (strlen (p) + 1);
- strcpy (first_global_object_name, p);
- }
-
-#ifdef ASM_WEAKEN_LABEL
- if (DECL_WEAK (decl))
- ASM_WEAKEN_LABEL (asm_out_file, fnname);
- else
-#endif
- if (output_bytecode)
- BC_GLOBALIZE_LABEL (asm_out_file, fnname);
- else
- ASM_GLOBALIZE_LABEL (asm_out_file, fnname);
- }
-
- /* Do any machine/system dependent processing of the function name */
- if (output_bytecode)
- BC_OUTPUT_LABEL (asm_out_file, fnname);
- else
- {
-#ifdef ASM_DECLARE_FUNCTION_NAME
- ASM_DECLARE_FUNCTION_NAME (asm_out_file, fnname, current_function_decl);
-#else
- /* Standard thing is just output label for the function. */
- ASM_OUTPUT_LABEL (asm_out_file, fnname);
-#endif /* ASM_DECLARE_FUNCTION_NAME */
- }
-}
-
-/* Output assembler code associated with defining the size of the
- function. DECL describes the function. NAME is the function's name. */
-
-void
-assemble_end_function (decl, fnname)
- tree decl;
- char *fnname;
-{
-#ifdef ASM_DECLARE_FUNCTION_SIZE
- ASM_DECLARE_FUNCTION_SIZE (asm_out_file, fnname, decl);
-#endif
- if (! CONSTANT_POOL_BEFORE_FUNCTION)
- output_constant_pool (fnname, decl);
-
- /* Output any constants which should appear after the function. */
- output_after_function_constants ();
-}
-
-/* Assemble code to leave SIZE bytes of zeros. */
-
-void
-assemble_zeros (size)
- int size;
-{
- if (output_bytecode)
- {
- bc_emit_const_skip (size);
- return;
- }
-
-#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 ())
- {
- int i;
-
- for (i = 0; i < size - 20; i += 20)
- {
-#ifdef ASM_BYTE_OP
- fprintf (asm_out_file,
- "%s 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n", ASM_BYTE_OP);
-#else
- fprintf (asm_out_file,
- "\tbyte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n");
-#endif
- }
- if (i < size)
- {
-#ifdef ASM_BYTE_OP
- fprintf (asm_out_file, "%s 0", ASM_BYTE_OP);
-#else
- fprintf (asm_out_file, "\tbyte 0");
-#endif
- i++;
- for (; i < size; i++)
- fprintf (asm_out_file, ",0");
- fprintf (asm_out_file, "\n");
- }
- }
- else
-#endif
- if (size > 0)
- {
- if (output_bytecode)
- BC_OUTPUT_SKIP (asm_out_file, size);
- else
- ASM_OUTPUT_SKIP (asm_out_file, size);
- }
-}
-
-/* Assemble an alignment pseudo op for an ALIGN-bit boundary. */
-
-void
-assemble_align (align)
- int align;
-{
- if (align > BITS_PER_UNIT)
- ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
-}
-
-/* Assemble a string constant with the specified C string as contents. */
-
-void
-assemble_string (p, size)
- char *p;
- int size;
-{
- register int i;
- int pos = 0;
- int maximum = 2000;
-
- if (output_bytecode)
- {
- bc_emit (p, size);
- return;
- }
-
- /* If the string is very long, split it up. */
-
- while (pos < size)
- {
- int thissize = size - pos;
- if (thissize > maximum)
- thissize = maximum;
-
- if (output_bytecode)
- bc_output_ascii (asm_out_file, p, thissize);
- else
- {
- ASM_OUTPUT_ASCII (asm_out_file, p, thissize);
- }
-
- pos += thissize;
- p += thissize;
- }
-}
-
-static void
-bc_output_ascii (file, p, size)
- FILE *file;
- char *p;
- int size;
-{
- BC_OUTPUT_ASCII (file, p, size);
-}
-
-/* Assemble everything that is needed for a variable or function declaration.
- Not used for automatic variables, and not used for function definitions.
- Should not be called for variables of incomplete structure type.
-
- TOP_LEVEL is nonzero if this variable has file scope.
- AT_END is nonzero if this is the special handling, at end of compilation,
- to define things that have had only tentative definitions.
- DONT_OUTPUT_DATA if nonzero means don't actually output the
- initial value (that will be done by the caller). */
-
-void
-assemble_variable (decl, top_level, at_end, dont_output_data)
- tree decl;
- int top_level;
- int at_end;
- int dont_output_data;
-{
- register char *name;
- int align;
- tree size_tree;
- int reloc = 0;
- enum in_section saved_in_section;
-
- last_assemble_variable_decl = 0;
-
- if (output_bytecode)
- return;
-
- if (GET_CODE (DECL_RTL (decl)) == REG)
- {
- /* Do output symbol info for global register variables, but do nothing
- else for them. */
-
- if (TREE_ASM_WRITTEN (decl))
- return;
- TREE_ASM_WRITTEN (decl) = 1;
-
- if (!output_bytecode)
- {
-#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
- /* File-scope global variables are output here. */
- if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
- && top_level)
- dbxout_symbol (decl, 0);
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG && top_level
- /* Leave initialized global vars for end of compilation;
- see comment in compile_file. */
- && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0))
- sdbout_symbol (decl, 0);
-#endif
- }
-
- /* Don't output any DWARF debugging information for variables here.
- In the case of local variables, the information for them is output
- when we do our recursive traversal of the tree representation for
- the entire containing function. In the case of file-scope variables,
- we output information for all of them at the very end of compilation
- while we are doing our final traversal of the chain of file-scope
- declarations. */
-
- return;
- }
-
- /* Normally no need to say anything here for external references,
- since assemble_external is called by the language-specific code
- when a declaration is first seen. */
-
- if (DECL_EXTERNAL (decl))
- return;
-
- /* Output no assembler code for a function declaration.
- Only definitions of functions output anything. */
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- return;
-
- /* If type was incomplete when the variable was declared,
- see if it is complete now. */
-
- if (DECL_SIZE (decl) == 0)
- layout_decl (decl, 0);
-
- /* Still incomplete => don't allocate it; treat the tentative defn
- (which is what it must have been) as an `extern' reference. */
-
- if (!dont_output_data && DECL_SIZE (decl) == 0)
- {
- error_with_file_and_line (DECL_SOURCE_FILE (decl),
- DECL_SOURCE_LINE (decl),
- "storage size of `%s' isn't known",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
- TREE_ASM_WRITTEN (decl) = 1;
- return;
- }
-
- /* The first declaration of a variable that comes through this function
- decides whether it is global (in C, has external linkage)
- or local (in C, has internal linkage). So do nothing more
- if this function has already run. */
-
- if (TREE_ASM_WRITTEN (decl))
- return;
-
- TREE_ASM_WRITTEN (decl) = 1;
-
- app_disable ();
-
- if (! dont_output_data)
- {
- if (TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
- goto finish;
-
- /* This is better than explicit arithmetic, since it avoids overflow. */
- size_tree = size_binop (CEIL_DIV_EXPR,
- DECL_SIZE (decl), size_int (BITS_PER_UNIT));
-
- if (TREE_INT_CST_HIGH (size_tree) != 0)
- {
- error_with_decl (decl, "size of variable `%s' is too large");
- goto finish;
- }
- }
-
- name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
-
- if (TREE_PUBLIC (decl) && DECL_NAME (decl)
- && ! first_global_object_name
- && ! (DECL_COMMON (decl) && (DECL_INITIAL (decl) == 0
- || DECL_INITIAL (decl) == error_mark_node))
- && ! DECL_WEAK (decl)
- && ! DECL_ONE_ONLY (decl))
- {
- char *p;
-
- STRIP_NAME_ENCODING (p, name);
- first_global_object_name = permalloc (strlen (p) + 1);
- strcpy (first_global_object_name, p);
- }
-
- /* Handle uninitialized definitions. */
-
- if ((DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)
- /* If the target can't output uninitialized but not common global data
- in .bss, then we have to use .data. */
-#if ! defined (ASM_OUTPUT_BSS) && ! defined (ASM_OUTPUT_ALIGNED_BSS)
- && DECL_COMMON (decl)
-#endif
- && ! dont_output_data)
- {
- int size = TREE_INT_CST_LOW (size_tree);
- int rounded = size;
-
- /* Don't allocate zero bytes of common,
- since that means "undefined external" in the linker. */
- if (size == 0) rounded = 1;
- /* Round size up to multiple of BIGGEST_ALIGNMENT bits
- so that each uninitialized object starts on such a boundary. */
- rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1;
- rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)
- * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
-
-#ifdef DBX_DEBUGGING_INFO
- /* File-scope global variables are output here. */
- if (write_symbols == DBX_DEBUG && top_level)
- dbxout_symbol (decl, 0);
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG && top_level
- /* Leave initialized global vars for end of compilation;
- see comment in compile_file. */
- && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0))
- sdbout_symbol (decl, 0);
-#endif
-
- /* Don't output any DWARF debugging information for variables here.
- In the case of local variables, the information for them is output
- when we do our recursive traversal of the tree representation for
- the entire containing function. In the case of file-scope variables,
- we output information for all of them at the very end of compilation
- while we are doing our final traversal of the chain of file-scope
- declarations. */
-
-#if 0 /* ??? We should either delete this or add a comment describing what
- it was intended to do and why we shouldn't delete it. */
- if (flag_shared_data)
- data_section ();
-#endif
-
- if (TREE_PUBLIC (decl)
-#if defined (ASM_OUTPUT_BSS) || defined (ASM_OUTPUT_ALIGNED_BSS)
- && DECL_COMMON (decl)
-#endif
- )
- {
-#ifdef ASM_OUTPUT_SHARED_COMMON
- if (flag_shared_data)
- ASM_OUTPUT_SHARED_COMMON (asm_out_file, name, size, rounded);
- else
-#endif
- if (output_bytecode)
- {
- BC_OUTPUT_COMMON (asm_out_file, name, size, rounded);
- }
- else
- {
-#ifdef ASM_OUTPUT_ALIGNED_COMMON
- ASM_OUTPUT_ALIGNED_COMMON (asm_out_file, name, size,
- DECL_ALIGN (decl));
-#else
- ASM_OUTPUT_COMMON (asm_out_file, name, size, rounded);
-#endif
- }
- }
-#if defined (ASM_OUTPUT_BSS) || defined (ASM_OUTPUT_ALIGNED_BSS)
- else if (TREE_PUBLIC (decl))
- {
-#ifdef ASM_OUTPUT_SHARED_BSS
- if (flag_shared_data)
- ASM_OUTPUT_SHARED_BSS (asm_out_file, decl, name, size, rounded);
- else
-#endif
- if (output_bytecode)
- {
- BC_OUTPUT_BSS (asm_out_file, name, size, rounded);
- }
- else
- {
-#ifdef ASM_OUTPUT_ALIGNED_BSS
- ASM_OUTPUT_ALIGNED_BSS (asm_out_file, decl, name, size,
- DECL_ALIGN (decl));
-#else
- ASM_OUTPUT_BSS (asm_out_file, decl, name, size, rounded);
-#endif
- }
- }
-#endif /* ASM_OUTPUT_BSS || ASM_OUTPUT_ALIGNED_BSS */
- else
- {
-#ifdef ASM_OUTPUT_SHARED_LOCAL
- if (flag_shared_data)
- ASM_OUTPUT_SHARED_LOCAL (asm_out_file, name, size, rounded);
- else
-#endif
- if (output_bytecode)
- {
- BC_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
- }
- else
- {
-#ifdef ASM_OUTPUT_ALIGNED_LOCAL
- ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size,
- DECL_ALIGN (decl));
-#else
- ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
-#endif
- }
- }
- goto finish;
- }
-
- /* Handle initialized definitions.
- Also handle uninitialized global definitions if -fno-common and the
- target doesn't support ASM_OUTPUT_BSS. */
-
- /* First make the assembler name(s) global if appropriate. */
- if (TREE_PUBLIC (decl) && DECL_NAME (decl))
- {
-#ifdef ASM_WEAKEN_LABEL
- if (DECL_WEAK (decl))
- ASM_WEAKEN_LABEL (asm_out_file, name);
- else
-#endif
- ASM_GLOBALIZE_LABEL (asm_out_file, name);
- }
-#if 0
- for (d = equivalents; d; d = TREE_CHAIN (d))
- {
- tree e = TREE_VALUE (d);
- if (TREE_PUBLIC (e) && DECL_NAME (e))
- ASM_GLOBALIZE_LABEL (asm_out_file,
- XSTR (XEXP (DECL_RTL (e), 0), 0));
- }
-#endif
-
- /* Output any data that we will need to use the address of. */
- if (DECL_INITIAL (decl) == error_mark_node)
- reloc = contains_pointers_p (TREE_TYPE (decl));
- else if (DECL_INITIAL (decl))
- reloc = output_addressed_constants (DECL_INITIAL (decl));
-
- /* Switch to the appropriate section. */
- variable_section (decl, reloc);
-
- /* dbxout.c needs to know this. */
- if (in_text_section ())
- DECL_IN_TEXT_SECTION (decl) = 1;
-
- /* Record current section so we can restore it if dbxout.c clobbers it. */
- saved_in_section = in_section;
-
- /* Output the dbx info now that we have chosen the section. */
-
-#ifdef DBX_DEBUGGING_INFO
- /* File-scope global variables are output here. */
- if (write_symbols == DBX_DEBUG && top_level)
- dbxout_symbol (decl, 0);
-#endif
-#ifdef SDB_DEBUGGING_INFO
- if (write_symbols == SDB_DEBUG && top_level
- /* Leave initialized global vars for end of compilation;
- see comment in compile_file. */
- && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0))
- sdbout_symbol (decl, 0);
-#endif
-
- /* Don't output any DWARF debugging information for variables here.
- In the case of local variables, the information for them is output
- when we do our recursive traversal of the tree representation for
- the entire containing function. In the case of file-scope variables,
- we output information for all of them at the very end of compilation
- while we are doing our final traversal of the chain of file-scope
- declarations. */
-
- /* If the debugging output changed sections, reselect the section
- that's supposed to be selected. */
- if (in_section != saved_in_section)
- variable_section (decl, reloc);
-
- /* Compute and output the alignment of this data. */
-
- align = DECL_ALIGN (decl);
- /* In the case for initialing an array whose length isn't specified,
- where we have not yet been able to do the layout,
- figure out the proper alignment now. */
- if (dont_output_data && DECL_SIZE (decl) == 0
- && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
- align = MAX (align, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl))));
-
- /* Some object file formats have a maximum alignment which they support.
- In particular, a.out format supports a maximum alignment of 4. */
-#ifndef MAX_OFILE_ALIGNMENT
-#define MAX_OFILE_ALIGNMENT BIGGEST_ALIGNMENT
-#endif
- if (align > MAX_OFILE_ALIGNMENT)
- {
- warning_with_decl (decl,
- "alignment of `%s' is greater than maximum object file alignment");
- align = MAX_OFILE_ALIGNMENT;
- }
-#ifdef DATA_ALIGNMENT
- /* On some machines, it is good to increase alignment sometimes. */
- align = DATA_ALIGNMENT (TREE_TYPE (decl), align);
-#endif
-#ifdef CONSTANT_ALIGNMENT
- if (DECL_INITIAL (decl))
- align = CONSTANT_ALIGNMENT (DECL_INITIAL (decl), align);
-#endif
-
- /* Reset the alignment in case we have made it tighter, so we can benefit
- from it in get_pointer_alignment. */
- DECL_ALIGN (decl) = align;
-
- if (align > BITS_PER_UNIT)
- {
- if (output_bytecode)
- BC_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
- else
- ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
- }
-
- /* Do any machine/system dependent processing of the object. */
- if (output_bytecode)
- BC_OUTPUT_LABEL (asm_out_file, name);
- else
- {
-#ifdef ASM_DECLARE_OBJECT_NAME
- last_assemble_variable_decl = decl;
- ASM_DECLARE_OBJECT_NAME (asm_out_file, name, decl);
-#else
- /* Standard thing is just output label for the object. */
- ASM_OUTPUT_LABEL (asm_out_file, name);
-#endif /* ASM_DECLARE_OBJECT_NAME */
- }
-
- if (!dont_output_data)
- {
- if (DECL_INITIAL (decl))
- /* Output the actual data. */
- output_constant (DECL_INITIAL (decl), TREE_INT_CST_LOW (size_tree));
- else
- /* Leave space for it. */
- assemble_zeros (TREE_INT_CST_LOW (size_tree));
- }
-
- finish:
-#ifdef XCOFF_DEBUGGING_INFO
- /* Unfortunately, the IBM assembler cannot handle stabx before the actual
- declaration. When something like ".stabx "aa:S-2",aa,133,0" is emitted
- and `aa' hasn't been output yet, the assembler generates a stab entry with
- a value of zero, in addition to creating an unnecessary external entry
- for `aa'. Hence, we must postpone dbxout_symbol to here at the end. */
-
- /* File-scope global variables are output here. */
- if (write_symbols == XCOFF_DEBUG && top_level)
- {
- saved_in_section = in_section;
-
- dbxout_symbol (decl, 0);
-
- if (in_section != saved_in_section)
- variable_section (decl, reloc);
- }
-#else
- /* There must be a statement after a label. */
- ;
-#endif
-}
-
-/* Return 1 if type TYPE contains any pointers. */
-
-static int
-contains_pointers_p (type)
- tree type;
-{
- switch (TREE_CODE (type))
- {
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- /* I'm not sure whether OFFSET_TYPE needs this treatment,
- so I'll play safe and return 1. */
- case OFFSET_TYPE:
- return 1;
-
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- {
- tree fields;
- /* For a type that has fields, see if the fields have pointers. */
- for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
- if (TREE_CODE (fields) == FIELD_DECL
- && contains_pointers_p (TREE_TYPE (fields)))
- return 1;
- return 0;
- }
-
- case ARRAY_TYPE:
- /* An array type contains pointers if its element type does. */
- return contains_pointers_p (TREE_TYPE (type));
-
- default:
- return 0;
- }
-}
-
-/* Output text storage for constructor CONSTR. */
-
-void
-bc_output_constructor (constr, size)
- tree constr;
- int size;
-{
- int i;
-
- /* Must always be a literal; non-literal constructors are handled
- differently. */
-
- if (!TREE_CONSTANT (constr))
- abort ();
-
- /* Always const */
- text_section ();
-
- /* Align */
- for (i = 0; TYPE_ALIGN (constr) >= BITS_PER_UNIT << (i + 1); i++)
- ;
-
- if (i > 0)
- BC_OUTPUT_ALIGN (asm_out_file, i);
-
- /* Output data */
- output_constant (constr, size);
-}
-
-/* Create storage for constructor CONSTR. */
-
-void
-bc_output_data_constructor (constr)
- tree constr;
-{
- int i;
-
- /* Put in data section */
- data_section ();
-
- /* Align */
- for (i = 0; TYPE_ALIGN (constr) >= BITS_PER_UNIT << (i + 1); i++);
- if (i > 0)
- BC_OUTPUT_ALIGN (asm_out_file, i);
-
- /* The constructor is filled in at runtime. */
- BC_OUTPUT_SKIP (asm_out_file, int_size_in_bytes (TREE_TYPE (constr)));
-}
-
-/* Output something to declare an external symbol to the assembler.
- (Most assemblers don't need this, so we normally output nothing.)
- Do nothing if DECL is not external. */
-
-void
-assemble_external (decl)
- tree decl;
-{
- if (output_bytecode)
- return;
-
-#ifdef ASM_OUTPUT_EXTERNAL
- if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd'
- && DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
- {
- rtx rtl = DECL_RTL (decl);
-
- if (GET_CODE (rtl) == MEM && GET_CODE (XEXP (rtl, 0)) == SYMBOL_REF
- && ! SYMBOL_REF_USED (XEXP (rtl, 0)))
- {
- /* Some systems do require some output. */
- SYMBOL_REF_USED (XEXP (rtl, 0)) = 1;
- ASM_OUTPUT_EXTERNAL (asm_out_file, decl, XSTR (XEXP (rtl, 0), 0));
- }
- }
-#endif
-}
-
-/* Similar, for calling a library function FUN. */
-
-void
-assemble_external_libcall (fun)
- rtx fun;
-{
-#ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
- if (!output_bytecode)
- {
- /* Declare library function name external when first used, if nec. */
- if (! SYMBOL_REF_USED (fun))
- {
- SYMBOL_REF_USED (fun) = 1;
- ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun);
- }
- }
-#endif
-}
-
-/* Declare the label NAME global. */
-
-void
-assemble_global (name)
- char *name;
-{
- ASM_GLOBALIZE_LABEL (asm_out_file, name);
-}
-
-/* Assemble a label named NAME. */
-
-void
-assemble_label (name)
- char *name;
-{
- if (output_bytecode)
- BC_OUTPUT_LABEL (asm_out_file, name);
- else
- ASM_OUTPUT_LABEL (asm_out_file, name);
-}
-
-/* Output to FILE a reference to the assembler name of a C-level name NAME.
- If NAME starts with a *, the rest of NAME is output verbatim.
- Otherwise NAME is transformed in an implementation-defined way
- (usually by the addition of an underscore).
- Many macros in the tm file are defined to call this function. */
-
-void
-assemble_name (file, name)
- FILE *file;
- char *name;
-{
- char *real_name;
- tree id;
-
- STRIP_NAME_ENCODING (real_name, name);
-
- id = maybe_get_identifier (real_name);
- if (id)
- TREE_SYMBOL_REFERENCED (id) = 1;
-
- if (name[0] == '*')
- {
- if (output_bytecode)
- bc_emit_labelref (name, 0);
- else
- fputs (&name[1], file);
- }
- else
- {
- if (output_bytecode)
- BC_OUTPUT_LABELREF (file, name);
- else
- ASM_OUTPUT_LABELREF (file, name);
- }
-}
-
-/* Allocate SIZE bytes writable static space with a gensym name
- and return an RTX to refer to its address. */
-
-rtx
-assemble_static_space (size)
- int size;
-{
- char name[12];
- char *namestring;
- rtx x;
- /* Round size up to multiple of BIGGEST_ALIGNMENT bits
- so that each uninitialized object starts on such a boundary. */
- int rounded = ((size + (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1)
- / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)
- * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
-
-#if 0
- if (flag_shared_data)
- data_section ();
-#endif
-
- ASM_GENERATE_INTERNAL_LABEL (name, "LF", const_labelno);
- ++const_labelno;
-
- namestring = (char *) obstack_alloc (saveable_obstack,
- strlen (name) + 2);
- strcpy (namestring, name);
-
- if (output_bytecode)
- x = bc_gen_rtx (namestring, 0, (struct bc_label *) 0);
- else
- x = gen_rtx (SYMBOL_REF, Pmode, namestring);
-
- if (output_bytecode)
- {
- BC_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
- }
- else
- {
-#ifdef ASM_OUTPUT_ALIGNED_LOCAL
- ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, BIGGEST_ALIGNMENT);
-#else
- ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
-#endif
- }
- return x;
-}
-
-/* Assemble the static constant template for function entry trampolines.
- This is done at most once per compilation.
- Returns an RTX for the address of the template. */
-
-#ifdef TRAMPOLINE_TEMPLATE
-rtx
-assemble_trampoline_template ()
-{
- char label[256];
- char *name;
- int align;
-
- /* Shouldn't get here */
- if (output_bytecode)
- abort ();
-
- /* By default, put trampoline templates in read-only data section. */
-
-#ifdef TRAMPOLINE_SECTION
- TRAMPOLINE_SECTION ();
-#else
- readonly_data_section ();
-#endif
-
- /* Write the assembler code to define one. */
- align = floor_log2 (TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT);
- if (align > 0)
- ASM_OUTPUT_ALIGN (asm_out_file, align);
-
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LTRAMP", 0);
- TRAMPOLINE_TEMPLATE (asm_out_file);
-
- /* Record the rtl to refer to it. */
- ASM_GENERATE_INTERNAL_LABEL (label, "LTRAMP", 0);
- name
- = (char *) obstack_copy0 (&permanent_obstack, label, strlen (label));
- return gen_rtx (SYMBOL_REF, Pmode, name);
-}
-#endif
-
-/* Assemble the integer constant X into an object of SIZE bytes.
- X must be either a CONST_INT or CONST_DOUBLE.
-
- Return 1 if we were able to output the constant, otherwise 0. If FORCE is
- non-zero, abort if we can't output the constant. */
-
-int
-assemble_integer (x, size, force)
- rtx x;
- int size;
- int force;
-{
- /* First try to use the standard 1, 2, 4, 8, and 16 byte
- ASM_OUTPUT... macros. */
-
- switch (size)
- {
-#ifdef ASM_OUTPUT_CHAR
- case 1:
- ASM_OUTPUT_CHAR (asm_out_file, x);
- return 1;
-#endif
-
-#ifdef ASM_OUTPUT_SHORT
- case 2:
- ASM_OUTPUT_SHORT (asm_out_file, x);
- return 1;
-#endif
-
-#ifdef ASM_OUTPUT_INT
- case 4:
- ASM_OUTPUT_INT (asm_out_file, x);
- return 1;
-#endif
-
-#ifdef ASM_OUTPUT_DOUBLE_INT
- case 8:
- ASM_OUTPUT_DOUBLE_INT (asm_out_file, x);
- return 1;
-#endif
-
-#ifdef ASM_OUTPUT_QUADRUPLE_INT
- case 16:
- ASM_OUTPUT_QUADRUPLE_INT (asm_out_file, x);
- return 1;
-#endif
- }
-
- /* If we couldn't do it that way, there are two other possibilities: First,
- if the machine can output an explicit byte and this is a 1 byte constant,
- we can use ASM_OUTPUT_BYTE. */
-
-#ifdef ASM_OUTPUT_BYTE
- if (size == 1 && GET_CODE (x) == CONST_INT)
- {
- ASM_OUTPUT_BYTE (asm_out_file, INTVAL (x));
- return 1;
- }
-#endif
-
- /* Finally, if SIZE is larger than a single word, try to output the constant
- one word at a time. */
-
- if (size > UNITS_PER_WORD)
- {
- int i;
- enum machine_mode mode
- = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0);
- rtx word;
-
- for (i = 0; i < size / UNITS_PER_WORD; i++)
- {
- word = operand_subword (x, i, 0, mode);
-
- if (word == 0)
- break;
-
- if (! assemble_integer (word, UNITS_PER_WORD, 0))
- break;
- }
-
- if (i == size / UNITS_PER_WORD)
- return 1;
- /* If we output at least one word and then could not finish,
- there is no valid way to continue. */
- if (i > 0)
- abort ();
- }
-
- if (force)
- abort ();
-
- return 0;
-}
-
-/* Assemble the floating-point constant D into an object of size MODE. */
-
-void
-assemble_real (d, mode)
- REAL_VALUE_TYPE d;
- enum machine_mode mode;
-{
- jmp_buf output_constant_handler;
-
- if (setjmp (output_constant_handler))
- {
- error ("floating point trap outputting a constant");
-#ifdef REAL_IS_NOT_DOUBLE
- bzero ((char *) &d, sizeof d);
- d = dconst0;
-#else
- d = 0;
-#endif
- }
-
- set_float_handler (output_constant_handler);
-
- switch (mode)
- {
-#ifdef ASM_OUTPUT_BYTE_FLOAT
- case QFmode:
- ASM_OUTPUT_BYTE_FLOAT (asm_out_file, d);
- break;
-#endif
-#ifdef ASM_OUTPUT_SHORT_FLOAT
- case HFmode:
- ASM_OUTPUT_SHORT_FLOAT (asm_out_file, d);
- break;
-#endif
-#ifdef ASM_OUTPUT_THREE_QUARTER_FLOAT
- case TQFmode:
- ASM_OUTPUT_THREE_QUARTER_FLOAT (asm_out_file, d);
- break;
-#endif
-#ifdef ASM_OUTPUT_FLOAT
- case SFmode:
- ASM_OUTPUT_FLOAT (asm_out_file, d);
- break;
-#endif
-
-#ifdef ASM_OUTPUT_DOUBLE
- case DFmode:
- ASM_OUTPUT_DOUBLE (asm_out_file, d);
- break;
-#endif
-
-#ifdef ASM_OUTPUT_LONG_DOUBLE
- case XFmode:
- case TFmode:
- ASM_OUTPUT_LONG_DOUBLE (asm_out_file, d);
- break;
-#endif
-
- default:
- abort ();
- }
-
- set_float_handler (NULL_PTR);
-}
-
-/* Here we combine duplicate floating constants to make
- CONST_DOUBLE rtx's, and force those out to memory when necessary. */
-
-/* Chain of all CONST_DOUBLE rtx's constructed for the current function.
- They are chained through the CONST_DOUBLE_CHAIN.
- A CONST_DOUBLE rtx has CONST_DOUBLE_MEM != cc0_rtx iff it is on this chain.
- In that case, CONST_DOUBLE_MEM is either a MEM,
- or const0_rtx if no MEM has been made for this CONST_DOUBLE yet.
-
- (CONST_DOUBLE_MEM is used only for top-level functions.
- See force_const_mem for explanation.) */
-
-static rtx const_double_chain;
-
-/* Return a CONST_DOUBLE or CONST_INT for a value specified as a pair of ints.
- For an integer, I0 is the low-order word and I1 is the high-order word.
- For a real number, I0 is the word with the low address
- and I1 is the word with the high address. */
-
-rtx
-immed_double_const (i0, i1, mode)
- HOST_WIDE_INT i0, i1;
- enum machine_mode mode;
-{
- register rtx r;
- int in_current_obstack;
-
- if (GET_MODE_CLASS (mode) == MODE_INT
- || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
- {
- /* We clear out all bits that don't belong in MODE, unless they and our
- sign bit are all one. So we get either a reasonable negative value
- or a reasonable unsigned value for this mode. */
- int width = GET_MODE_BITSIZE (mode);
- if (width < HOST_BITS_PER_WIDE_INT
- && ((i0 & ((HOST_WIDE_INT) (-1) << (width - 1)))
- != ((HOST_WIDE_INT) (-1) << (width - 1))))
- i0 &= ((HOST_WIDE_INT) 1 << width) - 1, i1 = 0;
- else if (width == HOST_BITS_PER_WIDE_INT
- && ! (i1 == ~0 && i0 < 0))
- i1 = 0;
- else if (width > 2 * HOST_BITS_PER_WIDE_INT)
- /* We cannot represent this value as a constant. */
- abort ();
-
- /* If this would be an entire word for the target, but is not for
- the host, then sign-extend on the host so that the number will look
- the same way on the host that it would on the target.
-
- For example, when building a 64 bit alpha hosted 32 bit sparc
- targeted compiler, then we want the 32 bit unsigned value -1 to be
- represented as a 64 bit value -1, and not as 0x00000000ffffffff.
- The later confuses the sparc backend. */
-
- if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width
- && (i0 & ((HOST_WIDE_INT) 1 << (width - 1))))
- i0 |= ((HOST_WIDE_INT) (-1) << width);
-
- /* If MODE fits within HOST_BITS_PER_WIDE_INT, always use a CONST_INT.
-
- ??? Strictly speaking, this is wrong if we create a CONST_INT
- for a large unsigned constant with the size of MODE being
- HOST_BITS_PER_WIDE_INT and later try to interpret that constant in a
- wider mode. In that case we will mis-interpret it as a negative
- number.
-
- Unfortunately, the only alternative is to make a CONST_DOUBLE
- for any constant in any mode if it is an unsigned constant larger
- than the maximum signed integer in an int on the host. However,
- doing this will break everyone that always expects to see a CONST_INT
- for SImode and smaller.
-
- We have always been making CONST_INTs in this case, so nothing new
- is being broken. */
-
- if (width <= HOST_BITS_PER_WIDE_INT)
- i1 = (i0 < 0) ? ~0 : 0;
-
- /* If this integer fits in one word, return a CONST_INT. */
- if ((i1 == 0 && i0 >= 0)
- || (i1 == ~0 && i0 < 0))
- return GEN_INT (i0);
-
- /* We use VOIDmode for integers. */
- mode = VOIDmode;
- }
-
- /* Search the chain for an existing CONST_DOUBLE with the right value.
- If one is found, return it. */
-
- for (r = const_double_chain; r; r = CONST_DOUBLE_CHAIN (r))
- if (CONST_DOUBLE_LOW (r) == i0 && CONST_DOUBLE_HIGH (r) == i1
- && GET_MODE (r) == mode)
- return r;
-
- /* No; make a new one and add it to the chain.
-
- We may be called by an optimizer which may be discarding any memory
- allocated during its processing (such as combine and loop). However,
- we will be leaving this constant on the chain, so we cannot tolerate
- freed memory. So switch to saveable_obstack for this allocation
- and then switch back if we were in current_obstack. */
-
- push_obstacks_nochange ();
- rtl_in_saveable_obstack ();
- r = gen_rtx (CONST_DOUBLE, mode, 0, i0, i1);
- pop_obstacks ();
-
- /* Don't touch const_double_chain in nested function; see force_const_mem.
- Also, don't touch it if not inside any function. */
- if (outer_function_chain == 0 && current_function_decl != 0)
- {
- CONST_DOUBLE_CHAIN (r) = const_double_chain;
- const_double_chain = r;
- }
-
- /* Store const0_rtx in mem-slot since this CONST_DOUBLE is on the chain.
- Actual use of mem-slot is only through force_const_mem. */
-
- CONST_DOUBLE_MEM (r) = const0_rtx;
-
- return r;
-}
-
-/* Return a CONST_DOUBLE for a specified `double' value
- and machine mode. */
-
-rtx
-immed_real_const_1 (d, mode)
- REAL_VALUE_TYPE d;
- enum machine_mode mode;
-{
- union real_extract u;
- register rtx r;
- int in_current_obstack;
-
- /* Get the desired `double' value as a sequence of ints
- since that is how they are stored in a CONST_DOUBLE. */
-
- u.d = d;
-
- /* Detect special cases. */
-
- /* Avoid REAL_VALUES_EQUAL here in order to distinguish minus zero. */
- if (!bcmp ((char *) &dconst0, (char *) &d, sizeof d))
- return CONST0_RTX (mode);
- /* Check for NaN first, because some ports (specifically the i386) do not
- emit correct ieee-fp code by default, and thus will generate a core
- dump here if we pass a NaN to REAL_VALUES_EQUAL and if REAL_VALUES_EQUAL
- does a floating point comparison. */
- else if (! REAL_VALUE_ISNAN (d) && REAL_VALUES_EQUAL (dconst1, d))
- return CONST1_RTX (mode);
-
- if (sizeof u == 2 * sizeof (HOST_WIDE_INT))
- return immed_double_const (u.i[0], u.i[1], mode);
-
- /* The rest of this function handles the case where
- a float value requires more than 2 ints of space.
- It will be deleted as dead code on machines that don't need it. */
-
- /* Search the chain for an existing CONST_DOUBLE with the right value.
- If one is found, return it. */
-
- for (r = const_double_chain; r; r = CONST_DOUBLE_CHAIN (r))
- if (! bcmp ((char *) &CONST_DOUBLE_LOW (r), (char *) &u, sizeof u)
- && GET_MODE (r) == mode)
- return r;
-
- /* No; make a new one and add it to the chain.
-
- We may be called by an optimizer which may be discarding any memory
- allocated during its processing (such as combine and loop). However,
- we will be leaving this constant on the chain, so we cannot tolerate
- freed memory. So switch to saveable_obstack for this allocation
- and then switch back if we were in current_obstack. */
-
- push_obstacks_nochange ();
- rtl_in_saveable_obstack ();
- r = rtx_alloc (CONST_DOUBLE);
- PUT_MODE (r, mode);
- bcopy ((char *) &u, (char *) &CONST_DOUBLE_LOW (r), sizeof u);
- pop_obstacks ();
-
- /* Don't touch const_double_chain in nested function; see force_const_mem.
- Also, don't touch it if not inside any function. */
- if (outer_function_chain == 0 && current_function_decl != 0)
- {
- CONST_DOUBLE_CHAIN (r) = const_double_chain;
- const_double_chain = r;
- }
-
- /* Store const0_rtx in CONST_DOUBLE_MEM since this CONST_DOUBLE is on the
- chain, but has not been allocated memory. Actual use of CONST_DOUBLE_MEM
- is only through force_const_mem. */
-
- CONST_DOUBLE_MEM (r) = const0_rtx;
-
- return r;
-}
-
-/* Return a CONST_DOUBLE rtx for a value specified by EXP,
- which must be a REAL_CST tree node. */
-
-rtx
-immed_real_const (exp)
- tree exp;
-{
- return immed_real_const_1 (TREE_REAL_CST (exp), TYPE_MODE (TREE_TYPE (exp)));
-}
-
-/* At the end of a function, forget the memory-constants
- previously made for CONST_DOUBLEs. Mark them as not on real_constant_chain.
- Also clear out real_constant_chain and clear out all the chain-pointers. */
-
-void
-clear_const_double_mem ()
-{
- register rtx r, next;
-
- /* Don't touch CONST_DOUBLE_MEM for nested functions.
- See force_const_mem for explanation. */
- if (outer_function_chain != 0)
- return;
-
- for (r = const_double_chain; r; r = next)
- {
- next = CONST_DOUBLE_CHAIN (r);
- CONST_DOUBLE_CHAIN (r) = 0;
- CONST_DOUBLE_MEM (r) = cc0_rtx;
- }
- const_double_chain = 0;
-}
-
-/* Given an expression EXP with a constant value,
- reduce it to the sum of an assembler symbol and an integer.
- Store them both in the structure *VALUE.
- Abort if EXP does not reduce. */
-
-struct addr_const
-{
- rtx base;
- HOST_WIDE_INT offset;
-};
-
-static void
-decode_addr_const (exp, value)
- tree exp;
- struct addr_const *value;
-{
- register tree target = TREE_OPERAND (exp, 0);
- register int offset = 0;
- register rtx x;
-
- while (1)
- {
- if (TREE_CODE (target) == COMPONENT_REF
- && (TREE_CODE (DECL_FIELD_BITPOS (TREE_OPERAND (target, 1)))
- == INTEGER_CST))
- {
- offset += TREE_INT_CST_LOW (DECL_FIELD_BITPOS (TREE_OPERAND (target, 1))) / BITS_PER_UNIT;
- target = TREE_OPERAND (target, 0);
- }
- else if (TREE_CODE (target) == ARRAY_REF)
- {
- if (TREE_CODE (TREE_OPERAND (target, 1)) != INTEGER_CST
- || TREE_CODE (TYPE_SIZE (TREE_TYPE (target))) != INTEGER_CST)
- abort ();
- offset += ((TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (target)))
- * TREE_INT_CST_LOW (TREE_OPERAND (target, 1)))
- / BITS_PER_UNIT);
- target = TREE_OPERAND (target, 0);
- }
- else
- break;
- }
-
- switch (TREE_CODE (target))
- {
- case VAR_DECL:
- case FUNCTION_DECL:
- x = DECL_RTL (target);
- break;
-
- case LABEL_DECL:
- if (output_bytecode)
- /* FIXME: this may not be correct, check it */
- x = bc_gen_rtx (TREE_STRING_POINTER (target), 0, (struct bc_label *) 0);
- else
- x = gen_rtx (MEM, FUNCTION_MODE,
- gen_rtx (LABEL_REF, VOIDmode,
- label_rtx (TREE_OPERAND (exp, 0))));
- break;
-
- case REAL_CST:
- case STRING_CST:
- case COMPLEX_CST:
- case CONSTRUCTOR:
- case INTEGER_CST:
- x = TREE_CST_RTL (target);
- break;
-
- default:
- abort ();
- }
-
- if (!output_bytecode)
- {
- if (GET_CODE (x) != MEM)
- abort ();
- x = XEXP (x, 0);
- }
-
- value->base = x;
- value->offset = offset;
-}
-
-/* Uniquize all constants that appear in memory.
- Each constant in memory thus far output is recorded
- in `const_hash_table' with a `struct constant_descriptor'
- that contains a polish representation of the value of
- the constant.
-
- We cannot store the trees in the hash table
- because the trees may be temporary. */
-
-struct constant_descriptor
-{
- struct constant_descriptor *next;
- char *label;
- char contents[1];
-};
-
-#define HASHBITS 30
-#define MAX_HASH_TABLE 1009
-static struct constant_descriptor *const_hash_table[MAX_HASH_TABLE];
-
-/* Compute a hash code for a constant expression. */
-
-static int
-const_hash (exp)
- tree exp;
-{
- register char *p;
- register int len, hi, i;
- register enum tree_code code = TREE_CODE (exp);
-
- /* Either set P and LEN to the address and len of something to hash and
- exit the switch or return a value. */
-
- switch (code)
- {
- case INTEGER_CST:
- p = (char *) &TREE_INT_CST_LOW (exp);
- len = 2 * sizeof TREE_INT_CST_LOW (exp);
- break;
-
- case REAL_CST:
- p = (char *) &TREE_REAL_CST (exp);
- len = sizeof TREE_REAL_CST (exp);
- break;
-
- case STRING_CST:
- p = TREE_STRING_POINTER (exp);
- len = TREE_STRING_LENGTH (exp);
- break;
-
- case COMPLEX_CST:
- return (const_hash (TREE_REALPART (exp)) * 5
- + const_hash (TREE_IMAGPART (exp)));
-
- case CONSTRUCTOR:
- if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
- {
- len = int_size_in_bytes (TREE_TYPE (exp));
- p = (char *) alloca (len);
- get_set_constructor_bytes (exp, (unsigned char *) p, len);
- break;
- }
- else
- {
- register tree link;
-
- /* For record type, include the type in the hashing.
- We do not do so for array types
- because (1) the sizes of the elements are sufficient
- and (2) distinct array types can have the same constructor.
- Instead, we include the array size because the constructor could
- be shorter. */
- if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
- hi = ((HOST_WIDE_INT) TREE_TYPE (exp) & ((1 << HASHBITS) - 1))
- % MAX_HASH_TABLE;
- else
- hi = ((5 + int_size_in_bytes (TREE_TYPE (exp)))
- & ((1 << HASHBITS) - 1)) % MAX_HASH_TABLE;
-
- for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link))
- if (TREE_VALUE (link))
- hi
- = (hi * 603 + const_hash (TREE_VALUE (link))) % MAX_HASH_TABLE;
-
- return hi;
- }
-
- case ADDR_EXPR:
- {
- struct addr_const value;
-
- decode_addr_const (exp, &value);
- if (GET_CODE (value.base) == SYMBOL_REF)
- {
- /* Don't hash the address of the SYMBOL_REF;
- only use the offset and the symbol name. */
- hi = value.offset;
- p = XSTR (value.base, 0);
- for (i = 0; p[i] != 0; i++)
- hi = ((hi * 613) + (unsigned) (p[i]));
- }
- else if (GET_CODE (value.base) == LABEL_REF)
- hi = value.offset + CODE_LABEL_NUMBER (XEXP (value.base, 0)) * 13;
-
- hi &= (1 << HASHBITS) - 1;
- hi %= MAX_HASH_TABLE;
- }
- return hi;
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- return (const_hash (TREE_OPERAND (exp, 0)) * 9
- + const_hash (TREE_OPERAND (exp, 1)));
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- case NON_LVALUE_EXPR:
- return const_hash (TREE_OPERAND (exp, 0)) * 7 + 2;
- }
-
- /* Compute hashing function */
- hi = len;
- for (i = 0; i < len; i++)
- hi = ((hi * 613) + (unsigned) (p[i]));
-
- hi &= (1 << HASHBITS) - 1;
- hi %= MAX_HASH_TABLE;
- return hi;
-}
-
-/* Compare a constant expression EXP with a constant-descriptor DESC.
- Return 1 if DESC describes a constant with the same value as EXP. */
-
-static int
-compare_constant (exp, desc)
- tree exp;
- struct constant_descriptor *desc;
-{
- return 0 != compare_constant_1 (exp, desc->contents);
-}
-
-/* Compare constant expression EXP with a substring P of a constant descriptor.
- If they match, return a pointer to the end of the substring matched.
- If they do not match, return 0.
-
- Since descriptors are written in polish prefix notation,
- this function can be used recursively to test one operand of EXP
- against a subdescriptor, and if it succeeds it returns the
- address of the subdescriptor for the next operand. */
-
-static char *
-compare_constant_1 (exp, p)
- tree exp;
- char *p;
-{
- register char *strp;
- register int len;
- register enum tree_code code = TREE_CODE (exp);
-
- if (code != (enum tree_code) *p++)
- return 0;
-
- /* Either set STRP, P and LEN to pointers and length to compare and exit the
- switch, or return the result of the comparison. */
-
- switch (code)
- {
- case INTEGER_CST:
- /* Integer constants are the same only if the same width of type. */
- if (*p++ != TYPE_PRECISION (TREE_TYPE (exp)))
- return 0;
-
- strp = (char *) &TREE_INT_CST_LOW (exp);
- len = 2 * sizeof TREE_INT_CST_LOW (exp);
- break;
-
- case REAL_CST:
- /* Real constants are the same only if the same width of type. */
- if (*p++ != TYPE_PRECISION (TREE_TYPE (exp)))
- return 0;
-
- strp = (char *) &TREE_REAL_CST (exp);
- len = sizeof TREE_REAL_CST (exp);
- break;
-
- case STRING_CST:
- if (flag_writable_strings)
- return 0;
-
- strp = TREE_STRING_POINTER (exp);
- len = TREE_STRING_LENGTH (exp);
- if (bcmp ((char *) &TREE_STRING_LENGTH (exp), p,
- sizeof TREE_STRING_LENGTH (exp)))
- return 0;
-
- p += sizeof TREE_STRING_LENGTH (exp);
- break;
-
- case COMPLEX_CST:
- p = compare_constant_1 (TREE_REALPART (exp), p);
- if (p == 0)
- return 0;
-
- return compare_constant_1 (TREE_IMAGPART (exp), p);
-
- case CONSTRUCTOR:
- if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
- {
- int xlen = len = int_size_in_bytes (TREE_TYPE (exp));
-
- strp = (char *) alloca (len);
- get_set_constructor_bytes (exp, (unsigned char *) strp, len);
- if (bcmp ((char *) &xlen, p, sizeof xlen))
- return 0;
-
- p += sizeof xlen;
- break;
- }
- else
- {
- register tree link;
- int length = list_length (CONSTRUCTOR_ELTS (exp));
- tree type;
-
- if (bcmp ((char *) &length, p, sizeof length))
- return 0;
-
- p += sizeof length;
-
- /* For record constructors, insist that the types match.
- For arrays, just verify both constructors are for arrays. */
- if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
- type = TREE_TYPE (exp);
- else
- type = 0;
-
- if (bcmp ((char *) &type, p, sizeof type))
- return 0;
-
- p += sizeof type;
-
- /* For arrays, insist that the size in bytes match. */
- if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
- {
- int size = int_size_in_bytes (TREE_TYPE (exp));
- if (bcmp ((char *) &size, p, sizeof size))
- return 0;
-
- p += sizeof size;
- }
-
- for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link))
- {
- if (TREE_VALUE (link))
- {
- if ((p = compare_constant_1 (TREE_VALUE (link), p)) == 0)
- return 0;
- }
- else
- {
- tree zero = 0;
-
- if (bcmp ((char *) &zero, p, sizeof zero))
- return 0;
-
- p += sizeof zero;
- }
- }
-
- return p;
- }
-
- case ADDR_EXPR:
- {
- struct addr_const value;
-
- decode_addr_const (exp, &value);
- strp = (char *) &value.offset;
- len = sizeof value.offset;
- /* Compare the offset. */
- while (--len >= 0)
- if (*p++ != *strp++)
- return 0;
-
- /* Compare symbol name. */
- strp = XSTR (value.base, 0);
- len = strlen (strp) + 1;
- }
- break;
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- p = compare_constant_1 (TREE_OPERAND (exp, 0), p);
- if (p == 0)
- return 0;
-
- return compare_constant_1 (TREE_OPERAND (exp, 1), p);
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- case NON_LVALUE_EXPR:
- return compare_constant_1 (TREE_OPERAND (exp, 0), p);
- }
-
- /* Compare constant contents. */
- while (--len >= 0)
- if (*p++ != *strp++)
- return 0;
-
- return p;
-}
-
-/* Construct a constant descriptor for the expression EXP.
- It is up to the caller to enter the descriptor in the hash table. */
-
-static struct constant_descriptor *
-record_constant (exp)
- tree exp;
-{
- struct constant_descriptor *next = 0;
- char *label = 0;
-
- /* Make a struct constant_descriptor. The first two pointers will
- be filled in later. Here we just leave space for them. */
-
- obstack_grow (&permanent_obstack, (char *) &next, sizeof next);
- obstack_grow (&permanent_obstack, (char *) &label, sizeof label);
- record_constant_1 (exp);
- return (struct constant_descriptor *) obstack_finish (&permanent_obstack);
-}
-
-/* Add a description of constant expression EXP
- to the object growing in `permanent_obstack'.
- No need to return its address; the caller will get that
- from the obstack when the object is complete. */
-
-static void
-record_constant_1 (exp)
- tree exp;
-{
- register char *strp;
- register int len;
- register enum tree_code code = TREE_CODE (exp);
-
- obstack_1grow (&permanent_obstack, (unsigned int) code);
-
- switch (code)
- {
- case INTEGER_CST:
- obstack_1grow (&permanent_obstack, TYPE_PRECISION (TREE_TYPE (exp)));
- strp = (char *) &TREE_INT_CST_LOW (exp);
- len = 2 * sizeof TREE_INT_CST_LOW (exp);
- break;
-
- case REAL_CST:
- obstack_1grow (&permanent_obstack, TYPE_PRECISION (TREE_TYPE (exp)));
- strp = (char *) &TREE_REAL_CST (exp);
- len = sizeof TREE_REAL_CST (exp);
- break;
-
- case STRING_CST:
- if (flag_writable_strings)
- return;
-
- strp = TREE_STRING_POINTER (exp);
- len = TREE_STRING_LENGTH (exp);
- obstack_grow (&permanent_obstack, (char *) &TREE_STRING_LENGTH (exp),
- sizeof TREE_STRING_LENGTH (exp));
- break;
-
- case COMPLEX_CST:
- record_constant_1 (TREE_REALPART (exp));
- record_constant_1 (TREE_IMAGPART (exp));
- return;
-
- case CONSTRUCTOR:
- if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
- {
- int nbytes = int_size_in_bytes (TREE_TYPE (exp));
- obstack_grow (&permanent_obstack, &nbytes, sizeof (nbytes));
- obstack_blank (&permanent_obstack, nbytes);
- get_set_constructor_bytes
- (exp, (unsigned char *) permanent_obstack.next_free-nbytes,
- nbytes);
- return;
- }
- else
- {
- register tree link;
- int length = list_length (CONSTRUCTOR_ELTS (exp));
- tree type;
-
- obstack_grow (&permanent_obstack, (char *) &length, sizeof length);
-
- /* For record constructors, insist that the types match.
- For arrays, just verify both constructors are for arrays. */
- if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
- type = TREE_TYPE (exp);
- else
- type = 0;
- obstack_grow (&permanent_obstack, (char *) &type, sizeof type);
-
- /* For arrays, insist that the size in bytes match. */
- if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
- {
- int size = int_size_in_bytes (TREE_TYPE (exp));
- obstack_grow (&permanent_obstack, (char *) &size, sizeof size);
- }
-
- for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link))
- {
- if (TREE_VALUE (link))
- record_constant_1 (TREE_VALUE (link));
- else
- {
- tree zero = 0;
-
- obstack_grow (&permanent_obstack,
- (char *) &zero, sizeof zero);
- }
- }
- }
- return;
-
- case ADDR_EXPR:
- {
- struct addr_const value;
-
- decode_addr_const (exp, &value);
- /* Record the offset. */
- obstack_grow (&permanent_obstack,
- (char *) &value.offset, sizeof value.offset);
- /* Record the symbol name. */
- obstack_grow (&permanent_obstack, XSTR (value.base, 0),
- strlen (XSTR (value.base, 0)) + 1);
- }
- return;
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- record_constant_1 (TREE_OPERAND (exp, 0));
- record_constant_1 (TREE_OPERAND (exp, 1));
- return;
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- case NON_LVALUE_EXPR:
- record_constant_1 (TREE_OPERAND (exp, 0));
- return;
-
- default:
- abort ();
- }
-
- /* Record constant contents. */
- obstack_grow (&permanent_obstack, strp, len);
-}
-
-/* Record a list of constant expressions that were passed to
- output_constant_def but that could not be output right away. */
-
-struct deferred_constant
-{
- struct deferred_constant *next;
- tree exp;
- int reloc;
- int labelno;
-};
-
-static struct deferred_constant *deferred_constants;
-
-/* Another list of constants which should be output after the
- function. */
-static struct deferred_constant *after_function_constants;
-
-/* Nonzero means defer output of addressed subconstants
- (i.e., those for which output_constant_def is called.) */
-static int defer_addressed_constants_flag;
-
-/* Start deferring output of subconstants. */
-
-void
-defer_addressed_constants ()
-{
- defer_addressed_constants_flag++;
-}
-
-/* Stop deferring output of subconstants,
- and output now all those that have been deferred. */
-
-void
-output_deferred_addressed_constants ()
-{
- struct deferred_constant *p, *next;
-
- defer_addressed_constants_flag--;
-
- if (defer_addressed_constants_flag > 0)
- return;
-
- for (p = deferred_constants; p; p = next)
- {
- output_constant_def_contents (p->exp, p->reloc, p->labelno);
- next = p->next;
- free (p);
- }
-
- deferred_constants = 0;
-}
-
-/* Output any constants which should appear after a function. */
-
-static void
-output_after_function_constants ()
-{
- struct deferred_constant *p, *next;
-
- for (p = after_function_constants; p; p = next)
- {
- output_constant_def_contents (p->exp, p->reloc, p->labelno);
- next = p->next;
- free (p);
- }
-
- after_function_constants = 0;
-}
-
-/* Make a copy of the whole tree structure for a constant.
- This handles the same types of nodes that compare_constant
- and record_constant handle. */
-
-static tree
-copy_constant (exp)
- tree exp;
-{
- switch (TREE_CODE (exp))
- {
- case ADDR_EXPR:
- /* For ADDR_EXPR, we do not want to copy the decl whose address
- is requested. We do want to copy constants though. */
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == 'c')
- return build1 (TREE_CODE (exp), TREE_TYPE (exp),
- copy_constant (TREE_OPERAND (exp, 0)));
- else
- return copy_node (exp);
-
- case INTEGER_CST:
- case REAL_CST:
- case STRING_CST:
- return copy_node (exp);
-
- case COMPLEX_CST:
- return build_complex (TREE_TYPE (exp),
- copy_constant (TREE_REALPART (exp)),
- copy_constant (TREE_IMAGPART (exp)));
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- return build (TREE_CODE (exp), TREE_TYPE (exp),
- copy_constant (TREE_OPERAND (exp, 0)),
- copy_constant (TREE_OPERAND (exp, 1)));
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- case NON_LVALUE_EXPR:
- return build1 (TREE_CODE (exp), TREE_TYPE (exp),
- copy_constant (TREE_OPERAND (exp, 0)));
-
- case CONSTRUCTOR:
- {
- tree copy = copy_node (exp);
- tree list = copy_list (CONSTRUCTOR_ELTS (exp));
- tree tail;
-
- CONSTRUCTOR_ELTS (copy) = list;
- for (tail = list; tail; tail = TREE_CHAIN (tail))
- TREE_VALUE (tail) = copy_constant (TREE_VALUE (tail));
- if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
- for (tail = list; tail; tail = TREE_CHAIN (tail))
- TREE_PURPOSE (tail) = copy_constant (TREE_PURPOSE (tail));
-
- return copy;
- }
-
- default:
- abort ();
- }
-}
-
-/* Return an rtx representing a reference to constant data in memory
- for the constant expression EXP.
-
- If assembler code for such a constant has already been output,
- return an rtx to refer to it.
- Otherwise, output such a constant in memory (or defer it for later)
- and generate an rtx for it.
-
- The TREE_CST_RTL of EXP is set up to point to that rtx.
- The const_hash_table records which constants already have label strings. */
-
-rtx
-output_constant_def (exp)
- tree exp;
-{
- register int hash;
- register struct constant_descriptor *desc;
- char label[256];
- char *found = 0;
- int reloc;
- register rtx def;
-
- if (TREE_CST_RTL (exp))
- return TREE_CST_RTL (exp);
-
- /* Make sure any other constants whose addresses appear in EXP
- are assigned label numbers. */
-
- reloc = output_addressed_constants (exp);
-
- /* Compute hash code of EXP. Search the descriptors for that hash code
- to see if any of them describes EXP. If yes, the descriptor records
- the label number already assigned. */
-
- hash = const_hash (exp) % MAX_HASH_TABLE;
-
- for (desc = const_hash_table[hash]; desc; desc = desc->next)
- if (compare_constant (exp, desc))
- {
- found = desc->label;
- break;
- }
-
- if (found == 0)
- {
- /* No constant equal to EXP is known to have been output.
- Make a constant descriptor to enter EXP in the hash table.
- Assign the label number and record it in the descriptor for
- future calls to this function to find. */
-
- /* Create a string containing the label name, in LABEL. */
- ASM_GENERATE_INTERNAL_LABEL (label, "LC", const_labelno);
-
- desc = record_constant (exp);
- desc->next = const_hash_table[hash];
- desc->label
- = (char *) obstack_copy0 (&permanent_obstack, label, strlen (label));
- const_hash_table[hash] = desc;
- }
- else
- {
- /* Create a string containing the label name, in LABEL. */
- ASM_GENERATE_INTERNAL_LABEL (label, "LC", const_labelno);
- }
-
- /* We have a symbol name; construct the SYMBOL_REF and the MEM. */
-
- push_obstacks_nochange ();
- if (TREE_PERMANENT (exp))
- end_temporary_allocation ();
-
- def = gen_rtx (SYMBOL_REF, Pmode, desc->label);
-
- TREE_CST_RTL (exp)
- = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)), def);
- RTX_UNCHANGING_P (TREE_CST_RTL (exp)) = 1;
- if (AGGREGATE_TYPE_P (TREE_TYPE (exp)))
- MEM_IN_STRUCT_P (TREE_CST_RTL (exp)) = 1;
-
- pop_obstacks ();
-
- /* Optionally set flags or add text to the name to record information
- such as that it is a function name. If the name is changed, the macro
- ASM_OUTPUT_LABELREF will have to know how to strip this information. */
-#ifdef ENCODE_SECTION_INFO
- ENCODE_SECTION_INFO (exp);
-#endif
-
- /* If this is the first time we've seen this particular constant,
- output it (or defer its output for later). */
- if (found == 0)
- {
- int after_function = 0;
-
-#ifdef CONSTANT_AFTER_FUNCTION_P
- if (current_function_decl != 0
- && CONSTANT_AFTER_FUNCTION_P (exp))
- after_function = 1;
-#endif
-
- if (defer_addressed_constants_flag || after_function)
- {
- struct deferred_constant *p;
- p = (struct deferred_constant *) xmalloc (sizeof (struct deferred_constant));
-
- push_obstacks_nochange ();
- suspend_momentary ();
- p->exp = copy_constant (exp);
- pop_obstacks ();
- p->reloc = reloc;
- p->labelno = const_labelno++;
- if (after_function)
- {
- p->next = after_function_constants;
- after_function_constants = p;
- }
- else
- {
- p->next = deferred_constants;
- deferred_constants = p;
- }
- }
- else
- output_constant_def_contents (exp, reloc, const_labelno++);
- }
-
- return TREE_CST_RTL (exp);
-}
-
-/* Now output assembler code to define the label for EXP,
- and follow it with the data of EXP. */
-
-static void
-output_constant_def_contents (exp, reloc, labelno)
- tree exp;
- int reloc;
- int labelno;
-{
- int align;
-
- if (IN_NAMED_SECTION (exp))
- named_section (exp, NULL);
- else
- {
- /* First switch to text section, except for writable strings. */
-#ifdef SELECT_SECTION
- SELECT_SECTION (exp, reloc);
-#else
- if (((TREE_CODE (exp) == STRING_CST) && flag_writable_strings)
- || (flag_pic && reloc))
- data_section ();
- else
- readonly_data_section ();
-#endif
- }
-
- /* Align the location counter as required by EXP's data type. */
- align = TYPE_ALIGN (TREE_TYPE (exp));
-#ifdef CONSTANT_ALIGNMENT
- align = CONSTANT_ALIGNMENT (exp, align);
-#endif
-
- if (align > BITS_PER_UNIT)
- {
- if (!output_bytecode)
- {
- ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
- }
- else
- {
- BC_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT));
- }
- }
-
- /* Output the label itself. */
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LC", labelno);
-
- /* Output the value of EXP. */
- output_constant (exp,
- (TREE_CODE (exp) == STRING_CST
- ? TREE_STRING_LENGTH (exp)
- : int_size_in_bytes (TREE_TYPE (exp))));
-
-}
-
-/* Similar hash facility for making memory-constants
- from constant rtl-expressions. It is used on RISC machines
- where immediate integer arguments and constant addresses are restricted
- so that such constants must be stored in memory.
-
- This pool of constants is reinitialized for each function
- so each function gets its own constants-pool that comes right before it.
-
- All structures allocated here are discarded when functions are saved for
- inlining, so they do not need to be allocated permanently. */
-
-#define MAX_RTX_HASH_TABLE 61
-static struct constant_descriptor **const_rtx_hash_table;
-
-/* Structure to represent sufficient information about a constant so that
- it can be output when the constant pool is output, so that function
- integration can be done, and to simplify handling on machines that reference
- constant pool as base+displacement. */
-
-struct pool_constant
-{
- struct constant_descriptor *desc;
- struct pool_constant *next;
- enum machine_mode mode;
- rtx constant;
- int labelno;
- int align;
- int offset;
- int mark;
-};
-
-/* Pointers to first and last constant in pool. */
-
-static struct pool_constant *first_pool, *last_pool;
-
-/* Current offset in constant pool (does not include any machine-specific
- header. */
-
-static int pool_offset;
-
-/* Structure used to maintain hash table mapping symbols used to their
- corresponding constants. */
-
-struct pool_sym
-{
- char *label;
- struct pool_constant *pool;
- struct pool_sym *next;
-};
-
-static struct pool_sym **const_rtx_sym_hash_table;
-
-/* Hash code for a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true.
- The argument is XSTR (... , 0) */
-
-#define SYMHASH(LABEL) \
- ((((HOST_WIDE_INT) (LABEL)) & ((1 << HASHBITS) - 1)) % MAX_RTX_HASH_TABLE)
-
-/* Initialize constant pool hashing for next function. */
-
-void
-init_const_rtx_hash_table ()
-{
- const_rtx_hash_table
- = ((struct constant_descriptor **)
- oballoc (MAX_RTX_HASH_TABLE * sizeof (struct constant_descriptor *)));
- const_rtx_sym_hash_table
- = ((struct pool_sym **)
- oballoc (MAX_RTX_HASH_TABLE * sizeof (struct pool_sym *)));
- bzero ((char *) const_rtx_hash_table,
- MAX_RTX_HASH_TABLE * sizeof (struct constant_descriptor *));
- bzero ((char *) const_rtx_sym_hash_table,
- MAX_RTX_HASH_TABLE * sizeof (struct pool_sym *));
-
- first_pool = last_pool = 0;
- pool_offset = 0;
-}
-
-/* Save and restore status for a nested function. */
-
-void
-save_varasm_status (p)
- struct function *p;
-{
- p->const_rtx_hash_table = const_rtx_hash_table;
- p->const_rtx_sym_hash_table = const_rtx_sym_hash_table;
- p->first_pool = first_pool;
- p->last_pool = last_pool;
- p->pool_offset = pool_offset;
-}
-
-void
-restore_varasm_status (p)
- struct function *p;
-{
- const_rtx_hash_table = p->const_rtx_hash_table;
- const_rtx_sym_hash_table = p->const_rtx_sym_hash_table;
- first_pool = p->first_pool;
- last_pool = p->last_pool;
- pool_offset = p->pool_offset;
-}
-
-enum kind { RTX_DOUBLE, RTX_INT };
-
-struct rtx_const
-{
-#ifdef ONLY_INT_FIELDS
- unsigned int kind : 16;
- unsigned int mode : 16;
-#else
- enum kind kind : 16;
- enum machine_mode mode : 16;
-#endif
- union {
- union real_extract du;
- struct addr_const addr;
- struct {HOST_WIDE_INT high, low;} di;
- } un;
-};
-
-/* Express an rtx for a constant integer (perhaps symbolic)
- as the sum of a symbol or label plus an explicit integer.
- They are stored into VALUE. */
-
-static void
-decode_rtx_const (mode, x, value)
- enum machine_mode mode;
- rtx x;
- struct rtx_const *value;
-{
- /* Clear the whole structure, including any gaps. */
-
- {
- int *p = (int *) value;
- int *end = (int *) (value + 1);
- while (p < end)
- *p++ = 0;
- }
-
- value->kind = RTX_INT; /* Most usual kind. */
- value->mode = mode;
-
- switch (GET_CODE (x))
- {
- case CONST_DOUBLE:
- value->kind = RTX_DOUBLE;
- if (GET_MODE (x) != VOIDmode)
- {
- value->mode = GET_MODE (x);
- bcopy ((char *) &CONST_DOUBLE_LOW (x),
- (char *) &value->un.du, sizeof value->un.du);
- }
- else
- {
- value->un.di.low = CONST_DOUBLE_LOW (x);
- value->un.di.high = CONST_DOUBLE_HIGH (x);
- }
- break;
-
- case CONST_INT:
- value->un.addr.offset = INTVAL (x);
- break;
-
- case SYMBOL_REF:
- case LABEL_REF:
- case PC:
- value->un.addr.base = x;
- break;
-
- case CONST:
- x = XEXP (x, 0);
- if (GET_CODE (x) == PLUS)
- {
- value->un.addr.base = XEXP (x, 0);
- if (GET_CODE (XEXP (x, 1)) != CONST_INT)
- abort ();
- value->un.addr.offset = INTVAL (XEXP (x, 1));
- }
- else if (GET_CODE (x) == MINUS)
- {
- value->un.addr.base = XEXP (x, 0);
- if (GET_CODE (XEXP (x, 1)) != CONST_INT)
- abort ();
- value->un.addr.offset = - INTVAL (XEXP (x, 1));
- }
- else
- abort ();
- break;
-
- default:
- abort ();
- }
-
- if (value->kind == RTX_INT && value->un.addr.base != 0)
- switch (GET_CODE (value->un.addr.base))
- {
- case SYMBOL_REF:
- case LABEL_REF:
- /* Use the string's address, not the SYMBOL_REF's address,
- for the sake of addresses of library routines.
- For a LABEL_REF, compare labels. */
- value->un.addr.base = XEXP (value->un.addr.base, 0);
- }
-}
-
-/* Given a MINUS expression, simplify it if both sides
- include the same symbol. */
-
-rtx
-simplify_subtraction (x)
- rtx x;
-{
- struct rtx_const val0, val1;
-
- decode_rtx_const (GET_MODE (x), XEXP (x, 0), &val0);
- decode_rtx_const (GET_MODE (x), XEXP (x, 1), &val1);
-
- if (val0.un.addr.base == val1.un.addr.base)
- return GEN_INT (val0.un.addr.offset - val1.un.addr.offset);
- return x;
-}
-
-/* Compute a hash code for a constant RTL expression. */
-
-static int
-const_hash_rtx (mode, x)
- enum machine_mode mode;
- rtx x;
-{
- register int hi, i;
-
- struct rtx_const value;
- decode_rtx_const (mode, x, &value);
-
- /* Compute hashing function */
- hi = 0;
- for (i = 0; i < sizeof value / sizeof (int); i++)
- hi += ((int *) &value)[i];
-
- hi &= (1 << HASHBITS) - 1;
- hi %= MAX_RTX_HASH_TABLE;
- return hi;
-}
-
-/* Compare a constant rtl object X with a constant-descriptor DESC.
- Return 1 if DESC describes a constant with the same value as X. */
-
-static int
-compare_constant_rtx (mode, x, desc)
- enum machine_mode mode;
- rtx x;
- struct constant_descriptor *desc;
-{
- register int *p = (int *) desc->contents;
- register int *strp;
- register int len;
- struct rtx_const value;
-
- decode_rtx_const (mode, x, &value);
- strp = (int *) &value;
- len = sizeof value / sizeof (int);
-
- /* Compare constant contents. */
- while (--len >= 0)
- if (*p++ != *strp++)
- return 0;
-
- return 1;
-}
-
-/* Construct a constant descriptor for the rtl-expression X.
- It is up to the caller to enter the descriptor in the hash table. */
-
-static struct constant_descriptor *
-record_constant_rtx (mode, x)
- enum machine_mode mode;
- rtx x;
-{
- struct constant_descriptor *ptr;
- char *label;
- struct rtx_const value;
-
- decode_rtx_const (mode, x, &value);
-
- /* Put these things in the saveable obstack so we can ensure it won't
- be freed if we are called from combine or some other phase that discards
- memory allocated from function_obstack (current_obstack). */
- obstack_grow (saveable_obstack, &ptr, sizeof ptr);
- obstack_grow (saveable_obstack, &label, sizeof label);
-
- /* Record constant contents. */
- obstack_grow (saveable_obstack, &value, sizeof value);
-
- return (struct constant_descriptor *) obstack_finish (saveable_obstack);
-}
-
-/* Given a constant rtx X, make (or find) a memory constant for its value
- and return a MEM rtx to refer to it in memory. */
-
-rtx
-force_const_mem (mode, x)
- enum machine_mode mode;
- rtx x;
-{
- register int hash;
- register struct constant_descriptor *desc;
- char label[256];
- char *found = 0;
- rtx def;
-
- /* If we want this CONST_DOUBLE in the same mode as it is in memory
- (this will always be true for floating CONST_DOUBLEs that have been
- placed in memory, but not for VOIDmode (integer) CONST_DOUBLEs),
- use the previous copy. Otherwise, make a new one. Note that in
- the unlikely event that this same CONST_DOUBLE is used in two different
- modes in an alternating fashion, we will allocate a lot of different
- memory locations, but this should be extremely rare. */
-
- /* Don't use CONST_DOUBLE_MEM in a nested function.
- Nested functions have their own constant pools,
- so they can't share the same values in CONST_DOUBLE_MEM
- with the containing function. */
- if (outer_function_chain == 0)
- if (GET_CODE (x) == CONST_DOUBLE
- && GET_CODE (CONST_DOUBLE_MEM (x)) == MEM
- && GET_MODE (CONST_DOUBLE_MEM (x)) == mode)
- return CONST_DOUBLE_MEM (x);
-
- /* Compute hash code of X. Search the descriptors for that hash code
- to see if any of them describes X. If yes, the descriptor records
- the label number already assigned. */
-
- hash = const_hash_rtx (mode, x);
-
- for (desc = const_rtx_hash_table[hash]; desc; desc = desc->next)
- if (compare_constant_rtx (mode, x, desc))
- {
- found = desc->label;
- break;
- }
-
- if (found == 0)
- {
- register struct pool_constant *pool;
- register struct pool_sym *sym;
- int align;
-
- /* No constant equal to X is known to have been output.
- Make a constant descriptor to enter X in the hash table.
- Assign the label number and record it in the descriptor for
- future calls to this function to find. */
-
- desc = record_constant_rtx (mode, x);
- desc->next = const_rtx_hash_table[hash];
- const_rtx_hash_table[hash] = desc;
-
- /* Align the location counter as required by EXP's data type. */
- align = (mode == VOIDmode) ? UNITS_PER_WORD : GET_MODE_SIZE (mode);
- if (align > BIGGEST_ALIGNMENT / BITS_PER_UNIT)
- align = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
-
- pool_offset += align - 1;
- pool_offset &= ~ (align - 1);
-
- /* If RTL is not being placed into the saveable obstack, make a
- copy of X that is in the saveable obstack in case we are
- being called from combine or some other phase that discards
- memory it allocates. We used to only do this if it is a
- CONST; however, reload can allocate a CONST_INT when
- eliminating registers. */
- if (rtl_obstack != saveable_obstack
- && (GET_CODE (x) == CONST || GET_CODE (x) == CONST_INT))
- {
- push_obstacks_nochange ();
- rtl_in_saveable_obstack ();
-
- if (GET_CODE (x) == CONST)
- x = gen_rtx (CONST, GET_MODE (x),
- gen_rtx (PLUS, GET_MODE (x),
- XEXP (XEXP (x, 0), 0),
- XEXP (XEXP (x, 0), 1)));
- else
- x = GEN_INT (INTVAL (x));
-
- pop_obstacks ();
- }
-
- /* Allocate a pool constant descriptor, fill it in, and chain it in. */
-
- pool = (struct pool_constant *) savealloc (sizeof (struct pool_constant));
- pool->desc = desc;
- pool->constant = x;
- pool->mode = mode;
- pool->labelno = const_labelno;
- pool->align = align;
- pool->offset = pool_offset;
- pool->mark = 1;
- pool->next = 0;
-
- if (last_pool == 0)
- first_pool = pool;
- else
- last_pool->next = pool;
-
- last_pool = pool;
- pool_offset += GET_MODE_SIZE (mode);
-
- /* Create a string containing the label name, in LABEL. */
- ASM_GENERATE_INTERNAL_LABEL (label, "LC", const_labelno);
-
- ++const_labelno;
-
- desc->label = found
- = (char *) obstack_copy0 (saveable_obstack, label, strlen (label));
-
- /* Add label to symbol hash table. */
- hash = SYMHASH (found);
- sym = (struct pool_sym *) savealloc (sizeof (struct pool_sym));
- sym->label = found;
- sym->pool = pool;
- sym->next = const_rtx_sym_hash_table[hash];
- const_rtx_sym_hash_table[hash] = sym;
- }
-
- /* We have a symbol name; construct the SYMBOL_REF and the MEM. */
-
- def = gen_rtx (MEM, mode, gen_rtx (SYMBOL_REF, Pmode, found));
-
- RTX_UNCHANGING_P (def) = 1;
- /* Mark the symbol_ref as belonging to this constants pool. */
- CONSTANT_POOL_ADDRESS_P (XEXP (def, 0)) = 1;
- current_function_uses_const_pool = 1;
-
- if (outer_function_chain == 0)
- if (GET_CODE (x) == CONST_DOUBLE)
- {
- if (CONST_DOUBLE_MEM (x) == cc0_rtx)
- {
- CONST_DOUBLE_CHAIN (x) = const_double_chain;
- const_double_chain = x;
- }
- CONST_DOUBLE_MEM (x) = def;
- }
-
- return def;
-}
-
-/* Given a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true, return a pointer to
- the corresponding pool_constant structure. */
-
-static struct pool_constant *
-find_pool_constant (addr)
- rtx addr;
-{
- struct pool_sym *sym;
- char *label = XSTR (addr, 0);
-
- for (sym = const_rtx_sym_hash_table[SYMHASH (label)]; sym; sym = sym->next)
- if (sym->label == label)
- return sym->pool;
-
- abort ();
-}
-
-/* Given a constant pool SYMBOL_REF, return the corresponding constant. */
-
-rtx
-get_pool_constant (addr)
- rtx addr;
-{
- return (find_pool_constant (addr))->constant;
-}
-
-/* Similar, return the mode. */
-
-enum machine_mode
-get_pool_mode (addr)
- rtx addr;
-{
- return (find_pool_constant (addr))->mode;
-}
-
-/* Similar, return the offset in the constant pool. */
-
-int
-get_pool_offset (addr)
- rtx addr;
-{
- return (find_pool_constant (addr))->offset;
-}
-
-/* Return the size of the constant pool. */
-
-int
-get_pool_size ()
-{
- return pool_offset;
-}
-
-/* Write all the constants in the constant pool. */
-
-void
-output_constant_pool (fnname, fndecl)
- char *fnname;
- tree fndecl;
-{
- struct pool_constant *pool;
- rtx x;
- union real_extract u;
-
- /* It is possible for gcc to call force_const_mem and then to later
- discard the instructions which refer to the constant. In such a
- case we do not need to output the constant. */
- if (optimize >= 0 && flag_expensive_optimizations)
- mark_constant_pool ();
-
-#ifdef ASM_OUTPUT_POOL_PROLOGUE
- ASM_OUTPUT_POOL_PROLOGUE (asm_out_file, fnname, fndecl, pool_offset);
-#endif
-
- for (pool = first_pool; pool; pool = pool->next)
- {
- x = pool->constant;
-
- if (! pool->mark)
- continue;
-
- /* See if X is a LABEL_REF (or a CONST referring to a LABEL_REF)
- whose CODE_LABEL has been deleted. This can occur if a jump table
- is eliminated by optimization. If so, write a constant of zero
- instead. Note that this can also happen by turning the
- CODE_LABEL into a NOTE. */
- if (((GET_CODE (x) == LABEL_REF
- && (INSN_DELETED_P (XEXP (x, 0))
- || GET_CODE (XEXP (x, 0)) == NOTE)))
- || (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF
- && (INSN_DELETED_P (XEXP (XEXP (XEXP (x, 0), 0), 0))
- || GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == NOTE)))
- x = const0_rtx;
-
- /* First switch to correct section. */
-#ifdef SELECT_RTX_SECTION
- SELECT_RTX_SECTION (pool->mode, x);
-#else
- readonly_data_section ();
-#endif
-
-#ifdef ASM_OUTPUT_SPECIAL_POOL_ENTRY
- ASM_OUTPUT_SPECIAL_POOL_ENTRY (asm_out_file, x, pool->mode,
- pool->align, pool->labelno, done);
-#endif
-
- if (pool->align > 1)
- ASM_OUTPUT_ALIGN (asm_out_file, exact_log2 (pool->align));
-
- /* Output the label. */
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LC", pool->labelno);
-
- /* Output the value of the constant itself. */
- switch (GET_MODE_CLASS (pool->mode))
- {
- case MODE_FLOAT:
- if (GET_CODE (x) != CONST_DOUBLE)
- abort ();
-
- bcopy ((char *) &CONST_DOUBLE_LOW (x), (char *) &u, sizeof u);
- assemble_real (u.d, pool->mode);
- break;
-
- case MODE_INT:
- case MODE_PARTIAL_INT:
- assemble_integer (x, GET_MODE_SIZE (pool->mode), 1);
- break;
-
- default:
- abort ();
- }
-
- done: ;
- }
-
-#ifdef ASM_OUTPUT_POOL_EPILOGUE
- ASM_OUTPUT_POOL_EPILOGUE (asm_out_file, fnname, fndecl, pool_offset);
-#endif
-
- /* Done with this pool. */
- first_pool = last_pool = 0;
-}
-
-/* Look through the instructions for this function, and mark all the
- entries in the constant pool which are actually being used. */
-
-static void
-mark_constant_pool ()
-{
- register rtx insn;
- struct pool_constant *pool;
-
- if (first_pool == 0)
- return;
-
- for (pool = first_pool; pool; pool = pool->next)
- pool->mark = 0;
-
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- mark_constants (PATTERN (insn));
-
- for (insn = current_function_epilogue_delay_list;
- insn;
- insn = XEXP (insn, 1))
- if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
- mark_constants (PATTERN (insn));
-}
-
-static void
-mark_constants (x)
- register rtx x;
-{
- register int i;
- register char *format_ptr;
-
- if (x == 0)
- return;
-
- if (GET_CODE (x) == SYMBOL_REF)
- {
- if (CONSTANT_POOL_ADDRESS_P (x))
- find_pool_constant (x)->mark = 1;
- return;
- }
-
- /* Insns may appear inside a SEQUENCE. Only check the patterns of
- insns, not any notes that may be attached. We don't want to mark
- a constant just because it happens to appear in a REG_EQUIV note. */
- if (GET_RTX_CLASS (GET_CODE (x)) == 'i')
- {
- mark_constants (PATTERN (x));
- return;
- }
-
- format_ptr = GET_RTX_FORMAT (GET_CODE (x));
-
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (x)); i++)
- {
- switch (*format_ptr++)
- {
- case 'e':
- mark_constants (XEXP (x, i));
- break;
-
- case 'E':
- if (XVEC (x, i) != 0)
- {
- register int j;
-
- for (j = 0; j < XVECLEN (x, i); j++)
- mark_constants (XVECEXP (x, i, j));
- }
- break;
-
- case 'S':
- case 's':
- case '0':
- case 'i':
- case 'w':
- case 'n':
- case 'u':
- break;
-
- default:
- abort ();
- }
- }
-}
-
-/* Find all the constants whose addresses are referenced inside of EXP,
- and make sure assembler code with a label has been output for each one.
- Indicate whether an ADDR_EXPR has been encountered. */
-
-static int
-output_addressed_constants (exp)
- tree exp;
-{
- int reloc = 0;
-
- switch (TREE_CODE (exp))
- {
- case ADDR_EXPR:
- {
- register tree constant = TREE_OPERAND (exp, 0);
-
- while (TREE_CODE (constant) == COMPONENT_REF)
- {
- constant = TREE_OPERAND (constant, 0);
- }
-
- if (TREE_CODE_CLASS (TREE_CODE (constant)) == 'c'
- || TREE_CODE (constant) == CONSTRUCTOR)
- /* No need to do anything here
- for addresses of variables or functions. */
- output_constant_def (constant);
- }
- reloc = 1;
- break;
-
- case PLUS_EXPR:
- case MINUS_EXPR:
- reloc = output_addressed_constants (TREE_OPERAND (exp, 0));
- reloc |= output_addressed_constants (TREE_OPERAND (exp, 1));
- break;
-
- case NOP_EXPR:
- case CONVERT_EXPR:
- case NON_LVALUE_EXPR:
- reloc = output_addressed_constants (TREE_OPERAND (exp, 0));
- break;
-
- case CONSTRUCTOR:
- {
- register tree link;
- for (link = CONSTRUCTOR_ELTS (exp); link; link = TREE_CHAIN (link))
- if (TREE_VALUE (link) != 0)
- reloc |= output_addressed_constants (TREE_VALUE (link));
- }
- break;
-
- case ERROR_MARK:
- break;
- }
- return reloc;
-}
-
-/* Output assembler code for constant EXP to FILE, with no label.
- This includes the pseudo-op such as ".int" or ".byte", and a newline.
- Assumes output_addressed_constants has been done on EXP already.
-
- Generate exactly SIZE bytes of assembler data, padding at the end
- with zeros if necessary. SIZE must always be specified.
-
- SIZE is important for structure constructors,
- since trailing members may have been omitted from the constructor.
- It is also important for initialization of arrays from string constants
- since the full length of the string constant might not be wanted.
- It is also needed for initialization of unions, where the initializer's
- type is just one member, and that may not be as long as the union.
-
- There a case in which we would fail to output exactly SIZE bytes:
- for a structure constructor that wants to produce more than SIZE bytes.
- But such constructors will never be generated for any possible input. */
-
-void
-output_constant (exp, size)
- register tree exp;
- register int size;
-{
- register enum tree_code code = TREE_CODE (TREE_TYPE (exp));
- rtx x;
-
- if (size == 0)
- return;
-
- /* Eliminate the NON_LVALUE_EXPR_EXPR that makes a cast not be an lvalue.
- That way we get the constant (we hope) inside it. Also, strip off any
- NOP_EXPR that converts between two record, union, array, or set types. */
- while ((TREE_CODE (exp) == NOP_EXPR
- && (TREE_TYPE (exp) == TREE_TYPE (TREE_OPERAND (exp, 0))
- || AGGREGATE_TYPE_P (TREE_TYPE (exp))))
- || TREE_CODE (exp) == NON_LVALUE_EXPR)
- exp = TREE_OPERAND (exp, 0);
-
- /* Allow a constructor with no elements for any data type.
- This means to fill the space with zeros. */
- if (TREE_CODE (exp) == CONSTRUCTOR && CONSTRUCTOR_ELTS (exp) == 0)
- {
- if (output_bytecode)
- bc_emit_const_skip (size);
- else
- assemble_zeros (size);
- return;
- }
-
- switch (code)
- {
- case CHAR_TYPE:
- case BOOLEAN_TYPE:
- case INTEGER_TYPE:
- case ENUMERAL_TYPE:
- case POINTER_TYPE:
- case REFERENCE_TYPE:
- /* ??? What about (int)((float)(int)&foo + 4) */
- while (TREE_CODE (exp) == NOP_EXPR || TREE_CODE (exp) == CONVERT_EXPR
- || TREE_CODE (exp) == NON_LVALUE_EXPR)
- exp = TREE_OPERAND (exp, 0);
-
- if (! assemble_integer (expand_expr (exp, NULL_RTX, VOIDmode,
- EXPAND_INITIALIZER),
- size, 0))
- error ("initializer for integer value is too complicated");
- size = 0;
- break;
-
- case REAL_TYPE:
- if (TREE_CODE (exp) != REAL_CST)
- error ("initializer for floating value is not a floating constant");
-
- assemble_real (TREE_REAL_CST (exp),
- mode_for_size (size * BITS_PER_UNIT, MODE_FLOAT, 0));
- size = 0;
- break;
-
- case COMPLEX_TYPE:
- output_constant (TREE_REALPART (exp), size / 2);
- output_constant (TREE_IMAGPART (exp), size / 2);
- size -= (size / 2) * 2;
- break;
-
- case ARRAY_TYPE:
- if (TREE_CODE (exp) == CONSTRUCTOR)
- {
- output_constructor (exp, size);
- return;
- }
- else if (TREE_CODE (exp) == STRING_CST)
- {
- int excess = 0;
-
- if (size > TREE_STRING_LENGTH (exp))
- {
- excess = size - TREE_STRING_LENGTH (exp);
- size = TREE_STRING_LENGTH (exp);
- }
-
- assemble_string (TREE_STRING_POINTER (exp), size);
- size = excess;
- }
- else
- abort ();
- break;
-
- case RECORD_TYPE:
- case UNION_TYPE:
- if (TREE_CODE (exp) == CONSTRUCTOR)
- output_constructor (exp, size);
- else
- abort ();
- return;
-
- case SET_TYPE:
- if (TREE_CODE (exp) == INTEGER_CST)
- assemble_integer (expand_expr (exp, NULL_RTX,
- VOIDmode, EXPAND_INITIALIZER),
- size, 1);
- else if (TREE_CODE (exp) == CONSTRUCTOR)
- {
- unsigned char *buffer = (unsigned char *) alloca (size);
- if (get_set_constructor_bytes (exp, buffer, size))
- abort ();
- assemble_string ((char *) buffer, size);
- }
- else
- error ("unknown set constructor type");
- return;
- }
-
- if (size > 0)
- assemble_zeros (size);
-}
-
-/* Bytecode specific code to output assembler for integer. */
-
-static void
-bc_assemble_integer (exp, size)
- tree exp;
- int size;
-{
- tree const_part;
- tree addr_part;
- tree tmp;
-
- /* FIXME: is this fold() business going to be as good as the
- expand_expr() using EXPAND_SUM above in the RTL case? I
- hate RMS.
- FIXME: Copied as is from BC-GCC1; may need work. Don't hate. -bson */
-
- exp = fold (exp);
-
- while (TREE_CODE (exp) == NOP_EXPR || TREE_CODE (exp) == CONVERT_EXPR
- || TREE_CODE (exp) == NON_LVALUE_EXPR)
- exp = TREE_OPERAND (exp, 0);
- if (TREE_CODE (exp) == INTEGER_CST)
- {
- const_part = exp;
- addr_part = 0;
- }
- else if (TREE_CODE (exp) == PLUS_EXPR)
- {
- const_part = TREE_OPERAND (exp, 0);
- while (TREE_CODE (const_part) == NOP_EXPR
- || TREE_CODE (const_part) == CONVERT_EXPR
- || TREE_CODE (const_part) == NON_LVALUE_EXPR)
- const_part = TREE_OPERAND (const_part, 0);
- addr_part = TREE_OPERAND (exp, 1);
- while (TREE_CODE (addr_part) == NOP_EXPR
- || TREE_CODE (addr_part) == CONVERT_EXPR
- || TREE_CODE (addr_part) == NON_LVALUE_EXPR)
- addr_part = TREE_OPERAND (addr_part, 0);
- if (TREE_CODE (const_part) != INTEGER_CST)
- tmp = const_part, const_part = addr_part, addr_part = tmp;
- if (TREE_CODE (const_part) != INTEGER_CST
- || TREE_CODE (addr_part) != ADDR_EXPR)
- abort (); /* FIXME: we really haven't considered
- all the possible cases here. */
- }
- else if (TREE_CODE (exp) == ADDR_EXPR)
- {
- const_part = integer_zero_node;
- addr_part = exp;
- }
- else
- abort (); /* FIXME: ditto previous. */
-
- if (addr_part == 0)
- {
- if (size == 1)
- {
- char c = TREE_INT_CST_LOW (const_part);
- bc_emit (&c, 1);
- size -= 1;
- }
- else if (size == 2)
- {
- short s = TREE_INT_CST_LOW (const_part);
- bc_emit ((char *) &s, 2);
- size -= 2;
- }
- else if (size == 4)
- {
- int i = TREE_INT_CST_LOW (const_part);
- bc_emit ((char *) &i, 4);
- size -= 4;
- }
- else if (size == 8)
- {
- if (WORDS_BIG_ENDIAN)
- {
- int i = TREE_INT_CST_HIGH (const_part);
- bc_emit ((char *) &i, 4);
- i = TREE_INT_CST_LOW (const_part);
- bc_emit ((char *) &i, 4);
- }
- else
- {
- int i = TREE_INT_CST_LOW (const_part);
- bc_emit ((char *) &i, 4);
- i = TREE_INT_CST_HIGH (const_part);
- bc_emit ((char *) &i, 4);
- }
- size -= 8;
- }
- }
- else
- if (size == 4
- && TREE_CODE (TREE_OPERAND (addr_part, 0)) == VAR_DECL)
- bc_emit_labelref (IDENTIFIER_POINTER
- (DECL_ASSEMBLER_NAME (TREE_OPERAND (addr_part, 0))),
- TREE_INT_CST_LOW (const_part));
- else
- abort (); /* FIXME: there may be more cases. */
-}
-
-/* Subroutine of output_constant, used for CONSTRUCTORs
- (aggregate constants).
- Generate at least SIZE bytes, padding if necessary. */
-
-static void
-output_constructor (exp, size)
- tree exp;
- int size;
-{
- register tree link, field = 0;
- HOST_WIDE_INT min_index = 0;
- /* Number of bytes output or skipped so far.
- In other words, current position within the constructor. */
- int total_bytes = 0;
- /* Non-zero means BYTE contains part of a byte, to be output. */
- int byte_buffer_in_use = 0;
- register int byte;
-
- if (HOST_BITS_PER_WIDE_INT < BITS_PER_UNIT)
- abort ();
-
- if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
- field = TYPE_FIELDS (TREE_TYPE (exp));
-
- if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
- && TYPE_DOMAIN (TREE_TYPE (exp)) != 0)
- min_index
- = TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (exp))));
-
- /* As LINK goes through the elements of the constant,
- FIELD goes through the structure fields, if the constant is a structure.
- if the constant is a union, then we override this,
- by getting the field from the TREE_LIST element.
- But the constant could also be an array. Then FIELD is zero. */
- for (link = CONSTRUCTOR_ELTS (exp);
- link;
- link = TREE_CHAIN (link),
- field = field ? TREE_CHAIN (field) : 0)
- {
- tree val = TREE_VALUE (link);
- tree index = 0;
-
- /* the element in a union constructor specifies the proper field. */
-
- if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE)
- {
- /* if available, use the type given by link */
- if (TREE_PURPOSE (link) != 0)
- field = TREE_PURPOSE (link);
- }
-
- if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
- index = TREE_PURPOSE (link);
-
- /* Eliminate the marker that makes a cast not be an lvalue. */
- if (val != 0)
- STRIP_NOPS (val);
-
- if (index && TREE_CODE (index) == RANGE_EXPR)
- {
- register int fieldsize
- = int_size_in_bytes (TREE_TYPE (TREE_TYPE (exp)));
- HOST_WIDE_INT lo_index = TREE_INT_CST_LOW (TREE_OPERAND (index, 0));
- HOST_WIDE_INT hi_index = TREE_INT_CST_LOW (TREE_OPERAND (index, 1));
- HOST_WIDE_INT index;
- for (index = lo_index; index <= hi_index; index++)
- {
- /* Output the element's initial value. */
- if (val == 0)
- assemble_zeros (fieldsize);
- else
- output_constant (val, fieldsize);
-
- /* Count its size. */
- total_bytes += fieldsize;
- }
- }
- else if (field == 0 || !DECL_BIT_FIELD (field))
- {
- /* An element that is not a bit-field. */
-
- register int fieldsize;
- /* Since this structure is static,
- we know the positions are constant. */
- int bitpos = (field ? (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))
- / BITS_PER_UNIT)
- : 0);
- if (index != 0)
- bitpos = (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (val)))
- / BITS_PER_UNIT
- * (TREE_INT_CST_LOW (index) - min_index));
-
- /* Output any buffered-up bit-fields preceding this element. */
- if (byte_buffer_in_use)
- {
- ASM_OUTPUT_BYTE (asm_out_file, byte);
- total_bytes++;
- byte_buffer_in_use = 0;
- }
-
- /* Advance to offset of this element.
- Note no alignment needed in an array, since that is guaranteed
- if each element has the proper size. */
- if ((field != 0 || index != 0) && bitpos != total_bytes)
- {
- if (!output_bytecode)
- assemble_zeros (bitpos - total_bytes);
- else
- bc_emit_const_skip (bitpos - total_bytes);
- total_bytes = bitpos;
- }
-
- /* Determine size this element should occupy. */
- if (field)
- {
- if (TREE_CODE (DECL_SIZE (field)) != INTEGER_CST)
- abort ();
- if (TREE_INT_CST_LOW (DECL_SIZE (field)) > 100000)
- {
- /* This avoids overflow trouble. */
- tree size_tree = size_binop (CEIL_DIV_EXPR,
- DECL_SIZE (field),
- size_int (BITS_PER_UNIT));
- fieldsize = TREE_INT_CST_LOW (size_tree);
- }
- else
- {
- fieldsize = TREE_INT_CST_LOW (DECL_SIZE (field));
- fieldsize = (fieldsize + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
- }
- }
- else
- fieldsize = int_size_in_bytes (TREE_TYPE (TREE_TYPE (exp)));
-
- /* Output the element's initial value. */
- if (val == 0)
- assemble_zeros (fieldsize);
- else
- output_constant (val, fieldsize);
-
- /* Count its size. */
- total_bytes += fieldsize;
- }
- else if (val != 0 && TREE_CODE (val) != INTEGER_CST)
- error ("invalid initial value for member `%s'",
- IDENTIFIER_POINTER (DECL_NAME (field)));
- else
- {
- /* Element that is a bit-field. */
-
- int next_offset = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field));
- int end_offset
- = (next_offset + TREE_INT_CST_LOW (DECL_SIZE (field)));
-
- if (val == 0)
- val = integer_zero_node;
-
- /* If this field does not start in this (or, next) byte,
- skip some bytes. */
- if (next_offset / BITS_PER_UNIT != total_bytes)
- {
- /* Output remnant of any bit field in previous bytes. */
- if (byte_buffer_in_use)
- {
- ASM_OUTPUT_BYTE (asm_out_file, byte);
- total_bytes++;
- byte_buffer_in_use = 0;
- }
-
- /* If still not at proper byte, advance to there. */
- if (next_offset / BITS_PER_UNIT != total_bytes)
- {
- assemble_zeros (next_offset / BITS_PER_UNIT - total_bytes);
- total_bytes = next_offset / BITS_PER_UNIT;
- }
- }
-
- if (! byte_buffer_in_use)
- byte = 0;
-
- /* We must split the element into pieces that fall within
- separate bytes, and combine each byte with previous or
- following bit-fields. */
-
- /* next_offset is the offset n fbits from the beginning of
- the structure to the next bit of this element to be processed.
- end_offset is the offset of the first bit past the end of
- this element. */
- while (next_offset < end_offset)
- {
- int this_time;
- int shift;
- HOST_WIDE_INT value;
- int next_byte = next_offset / BITS_PER_UNIT;
- int next_bit = next_offset % BITS_PER_UNIT;
-
- /* Advance from byte to byte
- within this element when necessary. */
- while (next_byte != total_bytes)
- {
- ASM_OUTPUT_BYTE (asm_out_file, byte);
- total_bytes++;
- byte = 0;
- }
-
- /* Number of bits we can process at once
- (all part of the same byte). */
- this_time = MIN (end_offset - next_offset,
- BITS_PER_UNIT - next_bit);
- if (BYTES_BIG_ENDIAN)
- {
- /* On big-endian machine, take the most significant bits
- first (of the bits that are significant)
- and put them into bytes from the most significant end. */
- shift = end_offset - next_offset - this_time;
- /* Don't try to take a bunch of bits that cross
- the word boundary in the INTEGER_CST. */
- if (shift < HOST_BITS_PER_WIDE_INT
- && shift + this_time > HOST_BITS_PER_WIDE_INT)
- {
- this_time -= (HOST_BITS_PER_WIDE_INT - shift);
- shift = HOST_BITS_PER_WIDE_INT;
- }
-
- /* Now get the bits from the appropriate constant word. */
- if (shift < HOST_BITS_PER_WIDE_INT)
- {
- value = TREE_INT_CST_LOW (val);
- }
- else if (shift < 2 * HOST_BITS_PER_WIDE_INT)
- {
- value = TREE_INT_CST_HIGH (val);
- shift -= HOST_BITS_PER_WIDE_INT;
- }
- else
- abort ();
- byte |= (((value >> shift)
- & (((HOST_WIDE_INT) 1 << this_time) - 1))
- << (BITS_PER_UNIT - this_time - next_bit));
- }
- else
- {
- /* On little-endian machines,
- take first the least significant bits of the value
- and pack them starting at the least significant
- bits of the bytes. */
- shift = (next_offset
- - TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field)));
- /* Don't try to take a bunch of bits that cross
- the word boundary in the INTEGER_CST. */
- if (shift < HOST_BITS_PER_WIDE_INT
- && shift + this_time > HOST_BITS_PER_WIDE_INT)
- {
- this_time -= (HOST_BITS_PER_WIDE_INT - shift);
- shift = HOST_BITS_PER_WIDE_INT;
- }
-
- /* Now get the bits from the appropriate constant word. */
- if (shift < HOST_BITS_PER_INT)
- value = TREE_INT_CST_LOW (val);
- else if (shift < 2 * HOST_BITS_PER_WIDE_INT)
- {
- value = TREE_INT_CST_HIGH (val);
- shift -= HOST_BITS_PER_WIDE_INT;
- }
- else
- abort ();
- byte |= (((value >> shift)
- & (((HOST_WIDE_INT) 1 << this_time) - 1))
- << next_bit);
- }
- next_offset += this_time;
- byte_buffer_in_use = 1;
- }
- }
- }
- if (byte_buffer_in_use)
- {
- ASM_OUTPUT_BYTE (asm_out_file, byte);
- total_bytes++;
- }
- if (total_bytes < size)
- assemble_zeros (size - total_bytes);
-}
-
-/* Output asm to handle ``#pragma weak'' */
-
-void
-handle_pragma_weak (what, name, value)
- enum pragma_state what;
- char *name, *value;
-{
-#ifdef HANDLE_PRAGMA_WEAK
- if (what == ps_name || what == ps_value)
- {
- struct weak_syms *weak =
- (struct weak_syms *)permalloc (sizeof (struct weak_syms));
- weak->next = weak_decls;
- weak->name = permalloc (strlen (name) + 1);
- strcpy (weak->name, name);
-
- if (what != ps_value)
- weak->value = NULL_PTR;
-
- else
- {
- weak->value = permalloc (strlen (value) + 1);
- strcpy (weak->value, value);
- }
-
- weak_decls = weak;
- }
- else if (! (what == ps_done || what == ps_start))
- warning ("malformed `#pragma weak'");
-#endif /* HANDLE_PRAGMA_WEAK */
-}
-
-/* Declare DECL to be a weak symbol. */
-
-void
-declare_weak (decl)
- tree decl;
-{
- if (! TREE_PUBLIC (decl))
- error_with_decl (decl, "weak declaration of `%s' must be public");
- else if (TREE_ASM_WRITTEN (decl))
- error_with_decl (decl, "weak declaration of `%s' must precede definition");
- else if (SUPPORTS_WEAK)
- DECL_WEAK (decl) = 1;
-}
-
-/* Emit any pending weak declarations. */
-
-void
-weak_finish ()
-{
-#ifdef HANDLE_PRAGMA_WEAK
- if (HANDLE_PRAGMA_WEAK)
- {
- struct weak_syms *t;
- for (t = weak_decls; t; t = t->next)
- {
- ASM_WEAKEN_LABEL (asm_out_file, t->name);
- if (t->value)
- ASM_OUTPUT_DEF (asm_out_file, t->name, t->value);
- }
- }
-#endif
-}
-
-void
-assemble_alias (decl, target)
- tree decl, target;
-{
- char *name;
-
- make_decl_rtl (decl, (char *) 0, 1);
- name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
-
-#ifdef ASM_OUTPUT_DEF
- /* Make name accessible from other files, if appropriate. */
-
- if (TREE_PUBLIC (decl))
- {
-#ifdef ASM_WEAKEN_LABEL
- if (DECL_WEAK (decl))
- ASM_WEAKEN_LABEL (asm_out_file, name);
- else
-#endif
- if (output_bytecode)
- BC_GLOBALIZE_LABEL (asm_out_file, name);
- else
- ASM_GLOBALIZE_LABEL (asm_out_file, name);
- }
-
- ASM_OUTPUT_DEF (asm_out_file, name, IDENTIFIER_POINTER (target));
- TREE_ASM_WRITTEN (decl) = 1;
-#else
-#ifdef ASM_OUTPUT_WEAK_ALIAS
- if (! DECL_WEAK (decl))
- warning ("only weak aliases are supported in this configuration");
-
- ASM_OUTPUT_WEAK_ALIAS (asm_out_file, name, IDENTIFIER_POINTER (target));
- TREE_ASM_WRITTEN (decl) = 1;
-#else
- warning ("alias definitions not supported in this configuration; ignored");
-#endif
-#endif
-}
-
-/* This determines whether or not we support link-once semantics. */
-#ifndef SUPPORTS_ONE_ONLY
-#ifdef MAKE_DECL_ONE_ONLY
-#define SUPPORTS_ONE_ONLY 1
-#else
-#define SUPPORTS_ONE_ONLY 0
-#endif
-#endif
-
-/* Returns 1 if the target configuration supports defining public symbols
- so that one of them will be chosen at link time instead of generating a
- multiply-defined symbol error, whether through the use of weak symbols or
- a target-specific mechanism for having duplicates discarded. */
-
-int
-supports_one_only ()
-{
- if (SUPPORTS_ONE_ONLY)
- return 1;
- return SUPPORTS_WEAK;
-}
-
-/* Set up DECL as a public symbol that can be defined in multiple
- translation units without generating a linker error. */
-
-void
-make_decl_one_only (decl)
- tree decl;
-{
- if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL)
- abort ();
-
- TREE_PUBLIC (decl) = 1;
-
- if (TREE_CODE (decl) == VAR_DECL
- && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
- DECL_COMMON (decl) = 1;
- else if (SUPPORTS_ONE_ONLY)
- {
-#ifdef MAKE_DECL_ONE_ONLY
- MAKE_DECL_ONE_ONLY (decl);
-#endif
- DECL_ONE_ONLY (decl) = 1;
- }
- else if (SUPPORTS_WEAK)
- DECL_WEAK (decl) = 1;
- else
- abort ();
-}
diff --git a/gcc/vmsconfig.com b/gcc/vmsconfig.com
deleted file mode 100644
index 088a4956887..00000000000
--- a/gcc/vmsconfig.com
+++ /dev/null
@@ -1,489 +0,0 @@
-$ !
-$ ! Set up to compile GCC on VMS.
-$ !
-$! Set the def dir to proper place for use in batch. Works for interactive too.
-$flnm = f$enviroment("PROCEDURE") ! get current procedure name
-$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
-$ !
-$set symbol/scope=(nolocal,noglobal)
-$if f$trnlnm("IFILE$").nes."" then close/noLog ifile$
-$ !
-$ echo = "write sys$output"
-$ !
-$ arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2
-$ arch = f$element(arch_indx,"|","|vax|alpha|")
-$ !
-$ if f$search("config.h") .nes. "" then delete config.h.*
-$ copy [.config.'arch']xm-vms.h []config.h
-$ echo "Linked `config.h' to `[.config.''arch']xm-vms.h'."
-$ !
-$ if f$search("tconfig.h") .nes. "" then delete tconfig.h.*
-$ create []tconfig.h
-$DECK
-/* tconfig.h == config.h :: target and host configurations are the same */
-#include "config.h"
-$EOD
-$ echo "Created `tconfig.h'.
-$ !
-$ if f$search("hconfig.h") .nes. "" then delete hconfig.h.*
-$ create []hconfig.h
-$DECK
-/* hconfig.h == config.h :: host and target configurations are the same */
-#include "config.h"
-$EOD
-$ echo "Created `hconfig.h'.
-$ !
-$ if f$search("tm.h") .nes. "" then delete tm.h.*
-$!! copy [.config.'arch']vms.h []tm.h
-$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
- [.config.'arch']vms.h /output=[]tm.h
-$DECK
-!
-! Copy file, changing lines of the form
-! #include "vax/*"
-! or
-! #include "alpha/*"
-! into
-! #include "config-*"
-!
- file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
- targ := LINE_BEGIN & '#include' & SPAN(ASCII(32)+ASCII(9))
- & '"' & ('vax' | 'alpha') & '/';
- rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
- LOOP
- incl := SEARCH_QUIETLY(targ, FORWARD, EXACT, rang);
- EXITIF incl = 0;
- POSITION(BEGINNING_OF(incl));
- ERASE(incl);
- COPY_TEXT('#include "config-');
- rang := CREATE_RANGE(END_OF(incl), END_OF(file));
- ENDLOOP;
- WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
- QUIT
-$EOD
-$ echo "Generated `tm.h' from `[.config.''arch']vms.h'."
-$ !
-$ !crude hack to allow compiling from [.cp] subdirectory
-$ if f$search("config-''arch'.h") .nes. "" then delete config-'arch'.h;*
-$ copy [.config.'arch']'arch'.h []config-'arch'.h
-$ echo "Linked `config-''arch'.h' to `[.config.''arch']''arch'.h' for `tm.h'."
-$ !
-$ call make_lang_incl "options.h"
-$ !
-$ call make_lang_incl "specs.h"
-$ !
-$ if f$search("''arch'.md") .nes. "" then delete 'arch'.md;*
-$ copy [.config.'arch']'arch'.md []'arch'.md
-$ echo "Copied `''arch'.md' from `[.config.''arch']''arch'.md'."
-$ !
-$ if f$search("aux-output.c") .nes. "" then delete aux-output.c.*
-$ copy [.config.'arch']'arch'.c []aux-output.c
-$ echo "Linked `aux-output.c' to `[.config.''arch']''arch'.c'.
-$ !
-$!
-$!
-$! Create the file version.opt, which helps identify the executable.
-$!
-$search version.c version_string,"="/match=and/output=t.tmp
-$open ifile$ t.tmp
-$read ifile$ line
-$close ifile$
-$delete t.tmp;
-$ijk=f$locate("""",line)+1
-$line=f$extract(ijk,f$length(line)-ijk,line)
-$ijk=f$locate("""",line)
-$line=f$extract(0,ijk,line)
-$ijk=f$locate("\n",line)
-$line=f$extract(0,ijk,line)
-$!
-$i=0
-$loop:
-$elm=f$element(i," ",line)
-$if elm.eqs."" then goto no_ident
-$if (elm.les."9").and.(elm.ges."0") then goto write_ident
-$i=i+1
-$goto loop
-$!
-$no_ident:
-$elm="?.??"
-$!
-$!
-$write_ident:
-$open/write ifile$ version.opt
-$write ifile$ "ident="+""""+elm+""""
-$close ifile$
-$purge version.opt
-$!
-$!
-$! create linker options files that lists all of the components for all
-$! possible compilers. We do this by editing the file Makefile.in, and
-$! generating the relevant files from it.
-$!
-$!
-$! Make a copy of the makefile if the sources are on a disk that is NFS
-$! mounted on a unix machine.
-$if f$search("Makefile.in").eqs."" .and. f$search("$M$akefile.in").nes."" -
- then copy $M$akefile.in Makefile.in
-$! This should be automated across all front-end subdirectories.
-$! For now, it's hardcoded.
-$if f$search("[.cp]Makefile.in").eqs."" .and. f$search("[.cp]$M$akefile.in").nes."" -
- then copy [.cp]$M$akefile.in [.cp]Makefile.in
-$!
-$!
-$echo "Now processing Makefile.in to generate linker option files."
-$edit/TPU/noJournal/noSection/noDisplay/Command=sys$input: Makefile.in -
- /Start_Position=('arch_indx') ! 1 for vax, 2 for alpha
-!!
-VARIABLE makefile_buf, opt_file_buf, complist_buf, extra_compilers; ! Globals.
-VARIABLE arch; ! String 'vax' or 'alpha', set in configure_makefile().
-
-!!
-PROCEDURE process_makefile( )
- !
- ! Interpret Makefile.in and subsidiary Make-lang.in templates.
- !
- LOCAL range1, cmark, makefilename;
-
- makefilename := GET_INFO (COMMAND_LINE, 'FILE_NAME'); ! "Makefile.in"
- makefile_buf := CREATE_BUFFER ("makefile", makefilename);
- opt_file_buf := CREATE_BUFFER ("opt_file");
- complist_buf := CREATE_BUFFER ("complist");
- extra_compilers := CREATE_ARRAY;
- !
- SET (NO_WRITE, makefile_buf, ON); ! Used as workspace; don't save it.
- SET (OUTPUT_FILE, complist_buf, "compilers.list");
- !
- ! Make some textual substitutions.
- !
- configure_makefile ();
- !
- ! Collect a list of supported compilers (``COMPILERS=xxx'' macro).
- !
- identify_compilers ();
- !
- ! Plus other known compilers described by Make-lang.in makefile fragments.
- ! Add new entries as needed; args are (target name, subdirectory name).
- !
- additional_compiler ("cc1plus", "cp");
- !
- WRITE_FILE (complist_buf); ! Now save "compilers.list".
- !
- ! Add to this list, as required. The file "Makefile.in" is searched for
- ! a tag that looks like "LINE_BEGIN + 'tag + (optional space) + "="".
- ! The contents are assumed to be a list of object files, and from this
- ! list a VMS linker options file is generated.
- !
- generate_option_file ("OBJS", "=", "independent.opt");
- generate_option_file ("LIB2FUNCS", "=", "libgcc2.list");
- generate_option_file ("BC_ALL", "=", "bc_all.list");
- generate_option_file ("BI_OBJ", "=", "bi_all.opt");
- !
- ! Now change OBJS in the Makefile, so each language specific options file
- ! does not pick up all of the language independent files.
- !
- POSITION (BEGINNING_OF (makefile_buf));
- COPY_TEXT ("OBJS="); ! New copy with empty value, seen before real OBJS.
- SPLIT_LINE;
- !
- ! Lastly, process each compiler-specific object dependency list.
- !
- POSITION (BEGINNING_OF (complist_buf));
- LOOP
- cmark := MARK (NONE);
- EXITIF (cmark = END_OF (complist_buf));
- ! The current line contains the name of a compiler target, such as "cc1".
- MESSAGE (CURRENT_LINE); ! Give some interactive feedback.
- generate_option_file (CURRENT_LINE, ":", CURRENT_LINE + "-objs.opt");
- POSITION (cmark);
- MOVE_VERTICAL (1); ! Go to the next line.
- ENDLOOP;
-ENDPROCEDURE; !process_makefile
-!!
-
-PROCEDURE process_objc_lib( )
- !
- ! Interpret objc/Makefile, after finishing the top makefile.
- !
- ON_ERROR
- [TPU$_OPENIN]:
- MESSAGE ("Cannot load objc/Makefile for ""ObjClib""; skipping it.");
- RETURN;
- ENDON_ERROR;
-
- ERASE (makefile_buf); !discard top Makefile
- POSITION (END_OF (makefile_buf));
- READ_FILE ("[.objc]Makefile"); !load objc one
- MESSAGE ("objclib");
- pat_replace (ASCII(9), " "); !change any <tab> to <space>
- generate_option_file ("OBJC_O", "=", "objc-objs.opt");
- POSITION (BEGINNING_OF (makefile_buf));
- ! Join any continuation lines; we want the header list to be one line.
- pat_replace ("\" & LINE_END, );
- generate_option_file ("OBJC_H", "=", "objc-hdrs.list");
-ENDPROCEDURE; !process_objc_lib
-!!
-
-PROCEDURE configure_makefile( )
- !
- ! Plug in some values normally handled by `configure'. Rather than
- ! replacing the dummy entries, insert the real entries before them.
- !
- IF (GET_INFO (COMMAND_LINE, 'START_RECORD') <> 2) THEN
- arch := 'vax';
- ELSE
- arch := 'alpha';
- ENDIF;
- POSITION (BEGINNING_OF (makefile_buf));
- COPY_TEXT ("target=" + arch + "-vms"); SPLIT_LINE;
- COPY_TEXT ("out_file=aux-output.c"); SPLIT_LINE; ! 'arch'/'arch'.c
- COPY_TEXT ("out_object_file=aux-output.o"); SPLIT_LINE; ! aux-output.obj
- COPY_TEXT ("md_file=" + arch + ".md"); SPLIT_LINE; ! 'arch'/'arch'.md
- COPY_TEXT ("tm_file=tm.h"); SPLIT_LINE; ! 'arch'/tm-vms.h
-ENDPROCEDURE; !configure_makefile
-!!
-
-PROCEDURE identify_compilers( )
- !
- ! Retrieve the list of supported compilers from Makefile.in, and put them
- ! into file "compilers.list", one per line, for subsequent access from DCL.
- !
- LOCAL range1;
-
- ! Strip most comments from the makefile, to speed up subsequent processing.
- POSITION (BEGINNING_OF (makefile_buf));
- pat_replace (LINE_BEGIN & "#" & REMAIN & LINE_END, );
-!# ! Convert directory references to VMS syntax (actually, just strip it).
-!# pat_replace (" $(srcdir)/", " ");
- ! Look up the ``COMPILERS=cc1 xyzzy'' Makefile macro and put
- ! its ``cc1 xyzzy'' value into the compilers buffer.
- POSITION (BEGINNING_OF (complist_buf));
-!#--at some point we may want to add this--
-!# recursive_fetch_tag ("CCCP", "="); ! Include the preprocessor.
-!# POSITION (END_OF (complist_buf));
- recursive_fetch_tag ("COMPILERS", "=");
- ! Convert all spaces into newlines, then remove any blank lines.
- pat_replace (SPAN(" "), LINE_END);
- pat_replace (LINE_BEGIN & LINE_END, );
-ENDPROCEDURE; !identify_compilers
-!!
-
-PROCEDURE additional_compiler( cname, subdir )
- !
- ! Load Make-lang.in for compiler CNAME from SUBDIR and append it to the
- ! end of Makefile.in's buffer. Add CNAME to the "compilers.list" buffer.
- !
- ON_ERROR
- ! Don't abort if user removes the supporting subdirectory for a
- ! language she's not interested in.
- [TPU$_OPENIN]:
- MESSAGE ("Cannot load " + subdir + "/Make-lang.in for "
- + '"' + cname + '"' + "; skipping it.");
- RETURN;
- ENDON_ERROR;
-
- POSITION (END_OF (makefile_buf));
- SPLIT_LINE; ! Separate with a blank line.
- READ_FILE ("[." + subdir + "]Make-lang.in"); ! Load Makefile fragment.
- ! Make sure that $(xxx_OTH_SRCS) expands to empty string by renaming $(it)
- pat_replace ("_OTH_SRCS)", "_OTH_SRCS_dummy_)");
- ! Convert subdirectory references into VMS syntax.
- pat_replace ("$(srcdir)/" + subdir + "/", "[." + subdir + "]");
- ! Add this name to compilers.list.
- POSITION (END_OF (complist_buf));
- COPY_TEXT (cname);
- ! Make array entry indexed by compiler's file name; its value is arbitrary.
- extra_compilers{cname} := subdir;
-ENDPROCEDURE; !additional_compiler
-!!
-
-PROCEDURE generate_option_file( tag_name, punct, outfile_name )
- !
- ! Produce a file listing the names of particular object files, for use
- ! as input to the linker and also for use in finding source names by
- ! make-cc1.com. Generally, any name suffix will be suppressed.
- !
- LOCAL range1, range2;
-
- POSITION (BEGINNING_OF (opt_file_buf));
- recursive_fetch_tag (tag_name, punct);
- ! First fix up for subdirectory/Make-lang.in.
- IF (pat_replace ("stamp-objlist" & (SPAN(" ")|LINE_END), " ") > 0) THEN
- recursive_fetch_tag ("stamp-objlist", ":");
- ENDIF;
- ! Now fix up a few things in the output buffer.
- pat_replace (("bytecode"|"Makefile") & (SPAN(" ")|LINE_END), " ");
-!# FILL (CURRENT_BUFFER, " ", 1, 80, 0); ! Condense things a bit.
- pat_replace ("." & ("o"|"c"|"y") & ((SPAN(" ")&LINE_END)|LINE_END), LINE_END);
- pat_replace ("." & ("o"|"c"|"y") & SPAN(" "), ",");
- pat_replace (".h" & (SPAN(" ")|LINE_END), ".h,");
- ! Remove trailing commas, if present.
- pat_replace ("," & ((SPAN(" ")&LINE_END)|LINE_END), LINE_END);
- ! Get rid of spaces and blank lines.
- pat_replace (SPAN(" "), LINE_END);
- pat_replace (LINE_BEGIN & LINE_END, );
- ! Second fix up for subdirectory/Make-lang.in;
- ! avoid "sticky defaults" when linker processes the resulting options file.
- IF (extra_compilers{outfile_name - "-objs.opt"} <> TPU$K_UNSPECIFIED) THEN
- POSITION (BEGINNING_OF (opt_file_buf));
- range1 := CREATE_RANGE (MARK (NONE), END_OF (CURRENT_BUFFER), NONE);
- LOOP
- range2 := SEARCH_QUIETLY (LINE_BEGIN | ",", FORWARD, EXACT, range1);
- EXITIF (range2 = 0);
- POSITION (BEGINNING_OF (range2));
- IF (CURRENT_CHARACTER = ",") THEN MOVE_HORIZONTAL (1); ENDIF;
- ! If it's not already "[.subdir]name", explicitly make it "[]name".
- IF (CURRENT_CHARACTER <> "[") THEN COPY_TEXT ("[]"); ENDIF;
- MOVE_HORIZONTAL (1);
- MODIFY_RANGE (range1, MARK (NONE), END_OF (range1));
- ENDLOOP;
- ENDIF;
- ! Now write the output file.
- SET (OUTPUT_FILE, opt_file_buf, outfile_name);
- WRITE_FILE (opt_file_buf);
- ERASE (opt_file_buf); ! Clear buffer out for next opt_file pass.
-ENDPROCEDURE; !generate_option_file
-!!
-
-PROCEDURE recursive_fetch_tag( tag_n, punct )
- !
- ! Look up TAG_N, copy it to OPT_FILE_BUF, and then translate any $(...)
- ! definitions that appear. The translation is put at the current point.
- !
- LOCAL mark1, mark2, range1, tag_range, tag_string;
-
- fetch_tag (tag_n, punct);
- ! Substitute any makefile symbols $(...).
- POSITION (BEGINNING_OF (CURRENT_BUFFER));
- LOOP
- range1 := SEARCH_QUIETLY ("$(" &
- SPAN("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ#~0123456789")
- & ")", FORWARD, EXACT);
- EXITIF (range1 = 0);
- POSITION (BEGINNING_OF (range1));
- MOVE_HORIZONTAL (2); ! Past opening "$(".
- mark1 := MARK (NONE);
- POSITION (END_OF (range1));
- MOVE_HORIZONTAL (-1); ! In front of closing ")".
- mark2 := MARK (NONE);
- tag_range := CREATE_RANGE (mark1, mark2, NONE);
- POSITION (END_OF (range1));
- tag_string := STR (tag_range);
- ERASE (range1);
- fetch_tag (tag_string, "=");
- POSITION (BEGINNING_OF (CURRENT_BUFFER));
- ENDLOOP;
-ENDPROCEDURE; !recursive_fetch_tag
-!!
-
-PROCEDURE fetch_tag( tag_n, punct )
- !
- ! Looks up the translation of a tag, and inserts it at the current location
- ! in the buffer.
- !
- LOCAL mark0, mark1, mark2, range2;
-
- mark0 := MARK (NONE); ! Remember where we started; restore before return.
- POSITION (BEGINNING_OF (makefile_buf));
- ! The tag definition always starts in the first column, and might have
- ! optional space(es) before "=" or ":" punctuation.
- range2 := SEARCH_QUIETLY (LINE_BEGIN & tag_n & ((SPAN(" ") & punct) | punct),
- FORWARD, EXACT);
- IF (range2 = 0) THEN
- POSITION (mark0);
- RETURN;
- ENDIF;
- POSITION (END_OF (range2));
- MOVE_HORIZONTAL (1); ! Move beyond "TAG=".
- mark1 := MARK (NONE);
- POSITION (BEGINNING_OF (range2));
- LOOP
- MOVE_VERTICAL (1);
- MOVE_HORIZONTAL (-2);
- EXITIF (CURRENT_CHARACTER <> "\");
- ERASE_CHARACTER (1);
- MOVE_HORIZONTAL (1);
- ENDLOOP;
- MOVE_HORIZONTAL (1);
- mark2 := MARK (NONE);
- range2 := CREATE_RANGE (mark1, mark2, NONE);
- POSITION (mark0);
- IF (LENGTH (range2) <> 0) THEN
- COPY_TEXT (range2);
- ENDIF;
-ENDPROCEDURE; !fetch_tag
-!!
-
-PROCEDURE pat_replace( oldstring, newstring )
- !
- ! Replace all occurrences of a pattern.
- !
- LOCAL range1, range2, kill_it, count;
-
- count := 0;
- kill_it := (GET_INFO (newstring, 'TYPE') = UNSPECIFIED); ! Omitted arg.
- range1 := CREATE_RANGE (BEGINNING_OF (CURRENT_BUFFER),
- END_OF (CURRENT_BUFFER), NONE);
- LOOP
- range2 := SEARCH_QUIETLY (oldstring, FORWARD, EXACT, range1);
- EXITIF (range2 = 0);
- count := count + 1;
- POSITION (BEGINNING_OF (range2));
- ERASE (range2);
- IF (newstring = LINE_END) THEN
- SPLIT_LINE;
- ELSE IF (NOT kill_it) THEN
- COPY_TEXT (newstring);
- ENDIF; ENDIF;
- MODIFY_RANGE (range1, MARK (NONE), END_OF (range1));
- ENDLOOP;
- RETURN count;
-ENDPROCEDURE; !pat_replace
-!!
-
-!
-! This is the main routine.
-!
-process_makefile ();
-process_objc_lib (); !this uses a different makefile
-QUIT; ! All done; don't write any modified buffers.
-!!
-$ echo ""
-$!
-$! Remove excessive versions of the option files...
-$!
-$ purge *.opt,*.list
-$!
-$!
-$!
-$ if f$search("config.status") .nes. "" then delete config.status.*
-$ create config.status
-$ open/append ifile$ config.status
-$ write ifile$ "Links are now set up for use with a ''arch' running VMS."
-$ close ifile$
-$ type config.status
-$ echo ""
-$!
-$ exit
-$
-$!
-$! Construct a header file based on subdirectory contents
-$!
-$make_lang_incl: subroutine
-$ if f$search(p1).nes."" then delete 'p1';*
-$ create 'p1' !empty file with ordinary text-file attributes
-$ open/Append ifile$ 'p1'
-$ write ifile$ "/* ''p1' */"
-$ hfile = f$search("[]''p1'")
-$ topdir = f$parse(hfile,,,"DIRECTORY") - "]"
-$lang_incl_loop:
-$ hfile = f$search("[.*]lang-''p1'")
-$ if hfile.eqs."" then goto lang_incl_done
-$ dir = f$parse(hfile,,,"DIRECTORY") - "]"
-$! convert absolute path to relative one, yielding "[.subdir]"
-$ dir = "[" + f$edit(dir - topdir,"LOWERCASE") + "]"
-$ write ifile$ "#include ""''dir'lang-''p1'"""
-$ goto lang_incl_loop
-$lang_incl_done:
-$ close ifile$
-$ echo "Created `''p1''."
-$ endsubroutine !make_lang_incl
diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c
deleted file mode 100644
index 60f6b32758b..00000000000
--- a/gcc/xcoffout.c
+++ /dev/null
@@ -1,531 +0,0 @@
-/* Output xcoff-format symbol table information from GNU compiler.
- Copyright (C) 1992, 1994, 1995 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. */
-
-
-/* Output xcoff-format symbol table data. The main functionality is contained
- in dbxout.c. This file implements the sdbout-like parts of the xcoff
- interface. Many functions are very similar to their counterparts in
- sdbout.c. */
-
-/* Include this first, because it may define MIN and MAX. */
-#include <stdio.h>
-
-#include "config.h"
-#include "tree.h"
-#include "rtl.h"
-#include "flags.h"
-
-#ifdef XCOFF_DEBUGGING_INFO
-
-/* This defines the C_* storage classes. */
-#include <dbxstclass.h>
-
-#include "xcoffout.h"
-
-#if defined (USG) || defined (NO_STAB_H)
-#include "gstab.h"
-#else
-#include <stab.h>
-
-/* This is a GNU extension we need to reference in this file. */
-#ifndef N_CATCH
-#define N_CATCH 0x54
-#endif
-#endif
-
-/* Line number of beginning of current function, minus one.
- Negative means not in a function or not using xcoff. */
-
-static int xcoff_begin_function_line = -1;
-static int xcoff_inlining = 0;
-
-/* Name of the current include file. */
-
-char *xcoff_current_include_file;
-
-/* Name of the current function file. This is the file the `.bf' is
- emitted from. In case a line is emitted from a different file,
- (by including that file of course), then the line number will be
- absolute. */
-
-static char *xcoff_current_function_file;
-
-/* Names of bss and data sections. These should be unique names for each
- compilation unit. */
-
-char *xcoff_bss_section_name;
-char *xcoff_private_data_section_name;
-char *xcoff_read_only_section_name;
-
-/* Last source file name mentioned in a NOTE insn. */
-
-char *xcoff_lastfile;
-
-/* Macro definitions used below. */
-
-#define ABS_OR_RELATIVE_LINENO(LINENO) \
-((xcoff_inlining) ? (LINENO) : (LINENO) - xcoff_begin_function_line)
-
-/* Output source line numbers via ".line" rather than ".stabd". */
-#define ASM_OUTPUT_SOURCE_LINE(FILE,LINENUM) \
- do { \
- if (xcoff_begin_function_line >= 0) \
- fprintf (FILE, "\t.line\t%d\n", ABS_OR_RELATIVE_LINENO (LINENUM)); \
- } while (0)
-
-#define ASM_OUTPUT_LFB(FILE,LINENUM) \
-{ \
- if (xcoff_begin_function_line == -1) \
- { \
- xcoff_begin_function_line = (LINENUM) - 1;\
- fprintf (FILE, "\t.bf\t%d\n", (LINENUM)); \
- } \
- xcoff_current_function_file \
- = (xcoff_current_include_file \
- ? xcoff_current_include_file : main_input_filename); \
-}
-
-#define ASM_OUTPUT_LFE(FILE,LINENUM) \
- do { \
- fprintf (FILE, "\t.ef\t%d\n", (LINENUM)); \
- xcoff_begin_function_line = -1; \
- } while (0)
-
-#define ASM_OUTPUT_LBB(FILE,LINENUM,BLOCKNUM) \
- fprintf (FILE, "\t.bb\t%d\n", ABS_OR_RELATIVE_LINENO (LINENUM))
-
-#define ASM_OUTPUT_LBE(FILE,LINENUM,BLOCKNUM) \
- fprintf (FILE, "\t.eb\t%d\n", ABS_OR_RELATIVE_LINENO (LINENUM))
-
-/* Support routines for XCOFF debugging info. */
-
-/* Assign NUMBER as the stabx type number for the type described by NAME.
- Search all decls in the list SYMS to find the type NAME. */
-
-static void
-assign_type_number (syms, name, number)
- tree syms;
- char *name;
- int number;
-{
- tree decl;
-
- for (decl = syms; decl; decl = TREE_CHAIN (decl))
- if (DECL_NAME (decl)
- && strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)), name) == 0)
- {
- TREE_ASM_WRITTEN (decl) = 1;
- TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = number;
- }
-}
-
-/* Setup gcc primitive types to use the XCOFF built-in type numbers where
- possible. */
-
-void
-xcoff_output_standard_types (syms)
- tree syms;
-{
- /* Handle built-in C types here. */
-
- assign_type_number (syms, "int", -1);
- assign_type_number (syms, "char", -2);
- assign_type_number (syms, "short int", -3);
- assign_type_number (syms, "long int", (TARGET_64BIT ? -31 : -4));
- assign_type_number (syms, "unsigned char", -5);
- assign_type_number (syms, "signed char", -6);
- assign_type_number (syms, "short unsigned int", -7);
- assign_type_number (syms, "unsigned int", -8);
- /* No such type "unsigned". */
- assign_type_number (syms, "long unsigned int", (TARGET_64BIT ? -32 : -10));
- assign_type_number (syms, "void", -11);
- assign_type_number (syms, "float", -12);
- assign_type_number (syms, "double", -13);
- assign_type_number (syms, "long double", -14);
- /* Pascal and Fortran types run from -15 to -29. */
- assign_type_number (syms, "wchar", -30);
- assign_type_number (syms, "long long int", -31);
- assign_type_number (syms, "long long unsigned int", -32);
- /* Additional Fortran types run from -33 to -37. */
-
- /* ??? Should also handle built-in C++ and Obj-C types. There perhaps
- aren't any that C doesn't already have. */
-}
-
-/* Print an error message for unrecognized stab codes. */
-
-#define UNKNOWN_STAB(STR) \
- do { \
- fprintf(stderr, "Error, unknown stab %s: : 0x%x\n", STR, stab); \
- fflush (stderr); \
- } while (0)
-
-/* Conversion routine from BSD stabs to AIX storage classes. */
-
-int
-stab_to_sclass (stab)
- int stab;
-{
- switch (stab)
- {
- case N_GSYM:
- return C_GSYM;
-
- case N_FNAME:
- UNKNOWN_STAB ("N_FNAME");
- abort();
-
- case N_FUN:
- return C_FUN;
-
- case N_STSYM:
- case N_LCSYM:
- return C_STSYM;
-
-#ifdef N_MAIN
- case N_MAIN:
- UNKNOWN_STAB ("N_MAIN");
- abort ();
-#endif
-
- case N_RSYM:
- return C_RSYM;
-
- case N_SSYM:
- UNKNOWN_STAB ("N_SSYM");
- abort ();
-
- case N_RPSYM:
- return C_RPSYM;
-
- case N_PSYM:
- return C_PSYM;
- case N_LSYM:
- return C_LSYM;
- case N_DECL:
- return C_DECL;
- case N_ENTRY:
- return C_ENTRY;
-
- case N_SO:
- UNKNOWN_STAB ("N_SO");
- abort ();
-
- case N_SOL:
- UNKNOWN_STAB ("N_SOL");
- abort ();
-
- case N_SLINE:
- UNKNOWN_STAB ("N_SLINE");
- abort ();
-
-#ifdef N_DSLINE
- case N_DSLINE:
- UNKNOWN_STAB ("N_DSLINE");
- abort ();
-#endif
-
-#ifdef N_BSLINE
- case N_BSLINE:
- UNKNOWN_STAB ("N_BSLINE");
- abort ();
-#endif
-#if 0
- /* This has the same value as N_BSLINE. */
- case N_BROWS:
- UNKNOWN_STAB ("N_BROWS");
- abort ();
-#endif
-
-#ifdef N_BINCL
- case N_BINCL:
- UNKNOWN_STAB ("N_BINCL");
- abort ();
-#endif
-
-#ifdef N_EINCL
- case N_EINCL:
- UNKNOWN_STAB ("N_EINCL");
- abort ();
-#endif
-
-#ifdef N_EXCL
- case N_EXCL:
- UNKNOWN_STAB ("N_EXCL");
- abort ();
-#endif
-
- case N_LBRAC:
- UNKNOWN_STAB ("N_LBRAC");
- abort ();
-
- case N_RBRAC:
- UNKNOWN_STAB ("N_RBRAC");
- abort ();
-
- case N_BCOMM:
- return C_BCOMM;
- case N_ECOMM:
- return C_ECOMM;
- case N_ECOML:
- return C_ECOML;
-
- case N_LENG:
- UNKNOWN_STAB ("N_LENG");
- abort ();
-
- case N_PC:
- UNKNOWN_STAB ("N_PC");
- abort ();
-
-#ifdef N_M2C
- case N_M2C:
- UNKNOWN_STAB ("N_M2C");
- abort ();
-#endif
-
-#ifdef N_SCOPE
- case N_SCOPE:
- UNKNOWN_STAB ("N_SCOPE");
- abort ();
-#endif
-
- case N_CATCH:
- UNKNOWN_STAB ("N_CATCH");
- abort ();
-
- default:
- UNKNOWN_STAB ("default");
- abort ();
- }
-}
-
-/* Output debugging info to FILE to switch to sourcefile FILENAME.
- INLINE_P is true if this is from an inlined function. */
-
-void
-xcoffout_source_file (file, filename, inline_p)
- FILE *file;
- char *filename;
- int inline_p;
-{
- if (filename
- && (xcoff_lastfile == 0 || strcmp (filename, xcoff_lastfile)
- || (inline_p && ! xcoff_inlining)
- || (! inline_p && xcoff_inlining)))
- {
- if (xcoff_current_include_file)
- {
- fprintf (file, "\t.ei\t");
- output_quoted_string (file, xcoff_current_include_file);
- fprintf (file, "\n");
- xcoff_current_include_file = NULL;
- }
- xcoff_inlining=inline_p;
- if (strcmp (main_input_filename, filename) || inline_p)
- {
- fprintf (file, "\t.bi\t");
- output_quoted_string (file, filename);
- fprintf (file, "\n");
- xcoff_current_include_file = filename;
- }
-
- xcoff_lastfile = filename;
- }
-}
-
-/* Output a line number symbol entry into output stream FILE,
- for source file FILENAME and line number NOTE. */
-
-void
-xcoffout_source_line (file, filename, note)
- FILE *file;
- char *filename;
- rtx note;
-{
- xcoffout_source_file (file, filename, RTX_INTEGRATED_P (note));
-
- ASM_OUTPUT_SOURCE_LINE (file, NOTE_LINE_NUMBER (note));
-}
-
-/* Output the symbols defined in block number DO_BLOCK.
- Set NEXT_BLOCK_NUMBER to 0 before calling.
-
- This function works by walking the tree structure of blocks,
- counting blocks until it finds the desired block. */
-
-static int do_block = 0;
-
-static int next_block_number;
-
-static void
-xcoffout_block (block, depth, args)
- register tree block;
- int depth;
- tree args;
-{
- while (block)
- {
- /* Ignore blocks never expanded or otherwise marked as real. */
- if (TREE_USED (block))
- {
- /* When we reach the specified block, output its symbols. */
- if (next_block_number == do_block)
- {
- /* Output the syms of the block. */
- if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
- dbxout_syms (BLOCK_VARS (block));
- if (args)
- dbxout_reg_parms (args);
-
- /* We are now done with the block. Don't go to inner blocks. */
- return;
- }
- /* If we are past the specified block, stop the scan. */
- else if (next_block_number >= do_block)
- return;
-
- next_block_number++;
-
- /* Output the subblocks. */
- xcoffout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
- }
- block = BLOCK_CHAIN (block);
- }
-}
-
-/* Describe the beginning of an internal block within a function.
- Also output descriptions of variables defined in this block.
-
- N is the number of the block, by order of beginning, counting from 1,
- and not counting the outermost (function top-level) block.
- The blocks match the BLOCKs in DECL_INITIAL (current_function_decl),
- if the count starts at 0 for the outermost one. */
-
-void
-xcoffout_begin_block (file, line, n)
- FILE *file;
- int line;
- int n;
-{
- tree decl = current_function_decl;
-
-
- /* The IBM AIX compiler does not emit a .bb for the function level scope,
- so we avoid it here also. */
- if (n != 1)
- ASM_OUTPUT_LBB (file, line, n);
-
- do_block = n;
- next_block_number = 0;
- xcoffout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
-}
-
-/* Describe the end line-number of an internal block within a function. */
-
-void
-xcoffout_end_block (file, line, n)
- FILE *file;
- int line;
- int n;
-{
- if (n != 1)
- ASM_OUTPUT_LBE (file, line, n);
-}
-
-/* Called at beginning of function (before prologue).
- Declare function as needed for debugging. */
-
-void
-xcoffout_declare_function (file, decl, name)
- FILE *file;
- tree decl;
- char *name;
-{
- char *n = name;
- int i;
-
- if (*n == '*')
- n++;
- else
- for (i = 0; name[i]; ++i)
- {
- if (name[i] == '[')
- {
- n = (char *) alloca (i + 1);
- strncpy (n, name, i);
- n[i] = '\0';
- break;
- }
- }
-
- /* Any pending .bi or .ei must occur before the .function pseudo op.
- Otherwise debuggers will think that the function is in the previous
- file and/or at the wrong line number. */
- xcoffout_source_file (file, DECL_SOURCE_FILE (decl), 0);
- dbxout_symbol (decl, 0);
- fprintf (file, "\t.function .%s,.%s,16,044,FE..%s-.%s\n", n, n, n, n);
-}
-
-/* Called at beginning of function body (after prologue).
- Record the function's starting line number, so we can output
- relative line numbers for the other lines.
- Record the file name that this function is contained in. */
-
-void
-xcoffout_begin_function (file, last_linenum)
- FILE *file;
- int last_linenum;
-{
- ASM_OUTPUT_LFB (file, last_linenum);
- dbxout_parms (DECL_ARGUMENTS (current_function_decl));
- ASM_OUTPUT_SOURCE_LINE (file, last_linenum);
-}
-
-/* Called at end of function (before epilogue).
- Describe end of outermost block. */
-
-void
-xcoffout_end_function (file, last_linenum)
- FILE *file;
- int last_linenum;
-{
- ASM_OUTPUT_LFE (file, last_linenum);
-}
-
-/* Output xcoff info for the absolute end of a function.
- Called after the epilogue is output. */
-
-void
-xcoffout_end_epilogue (file)
- FILE *file;
-{
- /* We need to pass the correct function size to .function, otherwise,
- the xas assembler can't figure out the correct size for the function
- aux entry. So, we emit a label after the last instruction which can
- be used by the .function pseudo op to calculate the function size. */
-
- char *fname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
- if (*fname == '*')
- ++fname;
- fprintf (file, "FE..");
- ASM_OUTPUT_LABEL (file, fname);
-}
-#endif /* XCOFF_DEBUGGING_INFO */
diff --git a/gcc/xcoffout.h b/gcc/xcoffout.h
deleted file mode 100644
index 8a97eaff3bd..00000000000
--- a/gcc/xcoffout.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* XCOFF definitions. These are needed in dbxout.c, final.c,
- and xcoffout.h. */
-
-#define ASM_STABS_OP ".stabx"
-
-/* Tags and typedefs are C_DECL in XCOFF, not C_LSYM. */
-
-#define DBX_TYPE_DECL_STABS_CODE N_DECL
-
-/* Use the XCOFF predefined type numbers. */
-
-/* ??? According to metin, typedef stabx must go in text control section,
- but he did not make this changes everywhere where such typedef stabx
- can be emitted, so it is really needed or not? */
-
-#define DBX_OUTPUT_STANDARD_TYPES(SYMS) \
-{ \
- text_section (); \
- xcoff_output_standard_types (SYMS); \
-}
-
-/* Any type with a negative type index has already been output. */
-
-#define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0)
-
-/* Must use N_STSYM for static const variables (those in the text section)
- instead of N_FUN. */
-
-#define DBX_STATIC_CONST_VAR_CODE N_STSYM
-
-/* For static variables, output code to define the start of a static block.
-
- ??? The IBM rs6000/AIX assembler has a bug that causes bss block debug
- info to be occasionally lost. A simple example is this:
- int a; static int b;
- The commands `gcc -g -c tmp.c; dump -t tmp.o' gives
-[10] m 0x00000016 1 0 0x8f 0x0000 .bs
-[11] m 0x00000000 1 0 0x90 0x0000 .es
-...
-[21] m 0x00000000 -2 0 0x85 0x0000 b:S-1
- which is wrong. The `b:S-1' must be between the `.bs' and `.es'.
- We can apparently work around the problem by forcing the text section
- (even if we are already in the text section) immediately before outputting
- the `.bs'. This should be fixed in the next major AIX release (3.3?). */
-
-#define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \
-{ \
- if ((CODE) == N_STSYM) \
- fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\
- else if ((CODE) == N_LCSYM) \
- { \
- fprintf ((ASMFILE), "%s\n", TEXT_SECTION_ASM_OP); \
- fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \
- } \
-}
-
-/* For static variables, output code to define the end of a static block. */
-
-#define DBX_STATIC_BLOCK_END(ASMFILE,CODE) \
-{ \
- if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \
- fputs ("\t.es\n", (ASMFILE)); \
-}
-
-/* We must use N_RPYSM instead of N_RSYM for register parameters. */
-
-#define DBX_REGPARM_STABS_CODE N_RPSYM
-
-/* We must use 'R' instead of 'P' for register parameters. */
-
-#define DBX_REGPARM_STABS_LETTER 'R'
-
-/* Define our own finish symbol function, since xcoff stabs have their
- own different format. */
-
-#define DBX_FINISH_SYMBOL(SYM) \
-{ \
- if (current_sym_addr && current_sym_code == N_FUN) \
- fprintf (asmfile, "\",."); \
- else \
- fprintf (asmfile, "\","); \
- /* If we are writing a function name, we must ensure that \
- there is no storage-class suffix on the name. */ \
- if (current_sym_addr && current_sym_code == N_FUN \
- && GET_CODE (current_sym_addr) == SYMBOL_REF) \
- { \
- char *_p = XSTR (current_sym_addr, 0); \
- if (*_p == '*') \
- fprintf (asmfile, "%s", _p+1); \
- else \
- for (; *_p != '[' && *_p; _p++) \
- fprintf (asmfile, "%c", *_p); \
- } \
- else if (current_sym_addr) \
- output_addr_const (asmfile, current_sym_addr); \
- else if (current_sym_code == N_GSYM) \
- assemble_name (asmfile, XSTR (XEXP (DECL_RTL (sym), 0), 0)); \
- else \
- fprintf (asmfile, "%d", current_sym_value); \
- fprintf (asmfile, ",%d,0\n", stab_to_sclass (current_sym_code)); \
-}
-
-/* These are IBM XCOFF extensions we need to reference in dbxout.c
- and xcoffout.c. */
-
-/* AIX XCOFF uses this for typedefs. This can have any value, since it is
- only used for translation into a C_DECL storage class. */
-#ifndef N_DECL
-#define N_DECL 0x8c
-#endif
-/* AIX XCOFF uses this for parameters passed in registers. This can have
- any value, since it is only used for translation into a C_RPSYM storage
- class. */
-#ifndef N_RPSYM
-#define N_RPSYM 0x8e
-#endif
-
-/* Name of the current include file. */
-
-extern char *xcoff_current_include_file;
-
-/* Names of bss and data sections. These should be unique names for each
- compilation unit. */
-
-extern char *xcoff_bss_section_name;
-extern char *xcoff_private_data_section_name;
-extern char *xcoff_read_only_section_name;
-
-/* Last source file name mentioned in a NOTE insn. */
-
-extern char *xcoff_lastfile;
-
-/* Don't write out path name for main source file. */
-#define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE,FILENAME)
-
-/* Write out main source file name using ".file" rather than ".stabs".
- We don't actually do this here, because the assembler gets confused if there
- is more than one .file directive. ASM_FILE_START in config/rs6000/rs6000.h
- is already emitting a .file directory, so we don't output one here also.
- Initialize xcoff_lastfile. */
-#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \
- xcoff_lastfile = (FILENAME)
-
-/* If we are still in an include file, its end must be marked. */
-#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
-{ \
- if (xcoff_current_include_file) \
- { \
- fputs ("\t.ei\t", (FILE)); \
- output_quoted_string ((FILE), xcoff_current_include_file); \
- putc ('\n', (FILE)); \
- xcoff_current_include_file = NULL; \
- } \
-}
-
-/* Do not break .stabs pseudos into continuations. */
-#define DBX_CONTIN_LENGTH 0
-
-/* Don't try to use the `x' type-cross-reference character in DBX data.
- Also has the consequence of putting each struct, union or enum
- into a separate .stabs, containing only cross-refs to the others. */
-#define DBX_NO_XREFS
-
-/* We must put stabs in the text section. If we don't the assembler
- won't handle them correctly; it will sometimes put stabs where gdb
- can't find them. */
-
-#define DEBUG_SYMS_TEXT